From: Cris Di Sclafani Date: Fri, 30 Oct 2020 16:00:29 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=57382f0d77d9c1eafef0f23210e9bfbfbb86e6cf;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index eb7b805..6ee44d9 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-30T15:30:56.119Z", "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-30T15:52:00.198Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ef4e6d9..dcfa190 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-30T15:30:56.119Z", "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-30T15:52:00.198Z", "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 29db3c9..0f3154b 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 _0xf791=['motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','getDataValue','action','STRING','contactManager','motionbar','jscripty','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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]'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf791,0x11f));var _0x1f79=function(_0x274f14,_0x27dd7f){_0x274f14=_0x274f14-0x0;var _0x13b97e=_0xf791[_0x274f14];return _0x13b97e;};'use strict';var Sequelize=require(_0x1f79('0x0'));module[_0x1f79('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x28acbb){return this[_0x1f79('0x2')](_0x1f79('0x3'));}},'action':{'type':Sequelize[_0x1f79('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1f79('0x5'),'integration',_0x1f79('0x6'),_0x1f79('0x7'),'urlForward','browser',_0x1f79('0x8'),_0x1f79('0x9')]],'msg':_0x1f79('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x1f79('0x4')](0x1000),'comment':_0x1f79('0xb')},'data2':{'type':Sequelize[_0x1f79('0x4')](0x1000),'comment':_0x1f79('0xc')},'data3':{'type':Sequelize[_0x1f79('0x4')](0x1000),'comment':_0x1f79('0xd')},'data4':{'type':Sequelize[_0x1f79('0x4')](0x1000)},'data5':{'type':Sequelize[_0x1f79('0x4')](0x1000)},'data6':{'type':Sequelize[_0x1f79('0x4')]},'data7':{'type':Sequelize[_0x1f79('0xe')]}}; \ No newline at end of file +var _0x32c6=['urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','STRING','motionbar','jscripty'];(function(_0x2e3d56,_0x4fb6ed){var _0x1815c1=function(_0x45a5fd){while(--_0x45a5fd){_0x2e3d56['push'](_0x2e3d56['shift']());}};_0x1815c1(++_0x4fb6ed);}(_0x32c6,0xf2));var _0x632c=function(_0x244f1f,_0x27b839){_0x244f1f=_0x244f1f-0x0;var _0x237b65=_0x32c6[_0x244f1f];return _0x237b65;};'use strict';var Sequelize=require(_0x632c('0x0'));module['exports']={'name':{'type':Sequelize[_0x632c('0x1')],'get':function(_0x5ec66b){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x632c('0x2')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x632c('0x3'),_0x632c('0x4'),_0x632c('0x5'),'browser',_0x632c('0x6'),_0x632c('0x7')]],'msg':_0x632c('0x8')}},'comment':_0x632c('0x8')},'data1':{'type':Sequelize[_0x632c('0x2')](0x1000),'comment':_0x632c('0x9')},'data2':{'type':Sequelize[_0x632c('0x2')](0x1000),'comment':_0x632c('0xa')},'data3':{'type':Sequelize[_0x632c('0x2')](0x1000),'comment':_0x632c('0xb')},'data4':{'type':Sequelize[_0x632c('0x2')](0x1000)},'data5':{'type':Sequelize[_0x632c('0x2')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x632c('0xc')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 6704a76..e803da3 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 _0x64ee=['params','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','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','apply','reject','save','then','destroy','error','stack','name','send','update','body','find','Action'];(function(_0x2333c0,_0x5c6c0c){var _0x2c8c88=function(_0x559797){while(--_0x559797){_0x2333c0['push'](_0x2333c0['shift']());}};_0x2c8c88(++_0x5c6c0c);}(_0x64ee,0x122));var _0xe64e=function(_0x11541a,_0x1dd673){_0x11541a=_0x11541a-0x0;var _0x5dded5=_0x64ee[_0x11541a];return _0x5dded5;};'use strict';var pdf=require(_0xe64e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe64e('0x1'));var zipdir=require(_0xe64e('0x2'));var jsonpatch=require(_0xe64e('0x3'));var rp=require(_0xe64e('0x4'));var moment=require(_0xe64e('0x5'));var BPromise=require(_0xe64e('0x6'));var Mustache=require('mustache');var util=require(_0xe64e('0x7'));var path=require(_0xe64e('0x8'));var sox=require(_0xe64e('0x9'));var csv=require(_0xe64e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe64e('0xb'));var squel=require(_0xe64e('0xc'));var crypto=require(_0xe64e('0xd'));var jsforce=require(_0xe64e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe64e('0xf'));var Papa=require('papaparse');var Redis=require(_0xe64e('0x10'));var authService=require(_0xe64e('0x11'));var qs=require(_0xe64e('0x12'));var as=require(_0xe64e('0x13'));var hardwareService=require(_0xe64e('0x14'));var logger=require(_0xe64e('0x15'))(_0xe64e('0x16'));var utils=require(_0xe64e('0x17'));var config=require('../../config/environment');var db=require(_0xe64e('0x18'))['db'];function respondWithStatusCode(_0xdc2989,_0x1ed575){_0x1ed575=_0x1ed575||0xcc;return function(_0x144964){if(_0x144964){return _0xdc2989[_0xe64e('0x19')](_0x1ed575);}return _0xdc2989[_0xe64e('0x1a')](_0x1ed575)[_0xe64e('0x1b')]();};}function respondWithResult(_0x4c7ea8,_0x2ece82){_0x2ece82=_0x2ece82||0xc8;return function(_0x236650){if(_0x236650){return _0x4c7ea8[_0xe64e('0x1a')](_0x2ece82)[_0xe64e('0x1c')](_0x236650);}};}function respondWithFilteredResult(_0x48753f,_0x40e552){return function(_0x264d94){if(_0x264d94){var _0x608037=_0x264d94[_0xe64e('0x1d')],_0x4e7996=_0x40e552[_0xe64e('0x1e')],_0x51555e=_0x40e552[_0xe64e('0x1e')]+_0x40e552[_0xe64e('0x1f')],_0xad1461;if(_0x51555e>=_0x608037){_0x51555e=_0x608037;_0xad1461=0xc8;}else{_0xad1461=0xce;}_0x48753f['status'](_0xad1461);return _0x48753f[_0xe64e('0x20')]('Content-Range',_0x4e7996+'-'+_0x51555e+'/'+_0x608037)['json'](_0x264d94);}return null;};}function patchUpdates(_0x163cdd){return function(_0x463f46){try{jsonpatch[_0xe64e('0x21')](_0x463f46,_0x163cdd,!![]);}catch(_0x4f38de){return BPromise[_0xe64e('0x22')](_0x4f38de);}return _0x463f46[_0xe64e('0x23')]();};}function saveUpdates(_0x2111f7,_0x4b65e2){return function(_0x16300b){if(_0x16300b){return _0x16300b['update'](_0x2111f7)[_0xe64e('0x24')](function(_0x5b3030){return _0x5b3030;});}return null;};}function removeEntity(_0x19a9ee,_0x4520e5){return function(_0x251302){if(_0x251302){return _0x251302[_0xe64e('0x25')]()[_0xe64e('0x24')](function(){_0x19a9ee['status'](0xcc)[_0xe64e('0x1b')]();});}};}function handleEntityNotFound(_0x2b0c47,_0x2b8b95){return function(_0xc473b8){if(!_0xc473b8){_0x2b0c47[_0xe64e('0x19')](0x194);}return _0xc473b8;};}function handleError(_0x5879a9,_0x147414){_0x147414=_0x147414||0x1f4;return function(_0x21a58a){logger[_0xe64e('0x26')](_0x21a58a[_0xe64e('0x27')]);if(_0x21a58a[_0xe64e('0x28')]){delete _0x21a58a['name'];}_0x5879a9[_0xe64e('0x1a')](_0x147414)[_0xe64e('0x29')](_0x21a58a);};}exports[_0xe64e('0x2a')]=function(_0x9b7a2b,_0xfc7fef){if(_0x9b7a2b[_0xe64e('0x2b')]['id']){delete _0x9b7a2b[_0xe64e('0x2b')]['id'];}return db['Action'][_0xe64e('0x2c')]({'where':{'id':_0x9b7a2b['params']['id']}})['then'](handleEntityNotFound(_0xfc7fef,null))[_0xe64e('0x24')](saveUpdates(_0x9b7a2b[_0xe64e('0x2b')],null))['then'](respondWithResult(_0xfc7fef,null))['catch'](handleError(_0xfc7fef,null));};exports[_0xe64e('0x25')]=function(_0x2a18d0,_0x1c33a5){return db[_0xe64e('0x2d')][_0xe64e('0x2c')]({'where':{'id':_0x2a18d0[_0xe64e('0x2e')]['id']}})[_0xe64e('0x24')](handleEntityNotFound(_0x1c33a5,null))[_0xe64e('0x24')](removeEntity(_0x1c33a5,null))[_0xe64e('0x2f')](handleError(_0x1c33a5,null));}; \ No newline at end of file +var _0xe8dd=['request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','error','stack','send','body','Action','params','then','catch','find','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0xe8dd,0x83));var _0xde8d=function(_0x462a51,_0x128123){_0x462a51=_0x462a51-0x0;var _0x350c3b=_0xe8dd[_0x462a51];return _0x350c3b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xde8d('0x0'));var rimraf=require(_0xde8d('0x1'));var zipdir=require(_0xde8d('0x2'));var jsonpatch=require(_0xde8d('0x3'));var rp=require(_0xde8d('0x4'));var moment=require(_0xde8d('0x5'));var BPromise=require(_0xde8d('0x6'));var Mustache=require(_0xde8d('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xde8d('0x8'));var ejs=require(_0xde8d('0x9'));var fs=require('fs');var _=require(_0xde8d('0xa'));var squel=require(_0xde8d('0xb'));var crypto=require(_0xde8d('0xc'));var jsforce=require(_0xde8d('0xd'));var deskjs=require(_0xde8d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xde8d('0xf'));var Papa=require(_0xde8d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xde8d('0x11'));var as=require(_0xde8d('0x12'));var hardwareService=require(_0xde8d('0x13'));var logger=require(_0xde8d('0x14'))(_0xde8d('0x15'));var utils=require(_0xde8d('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41c88e,_0x50e72b){_0x50e72b=_0x50e72b||0xcc;return function(_0x305ff3){if(_0x305ff3){return _0x41c88e[_0xde8d('0x17')](_0x50e72b);}return _0x41c88e[_0xde8d('0x18')](_0x50e72b)[_0xde8d('0x19')]();};}function respondWithResult(_0x2b762b,_0x6d95a2){_0x6d95a2=_0x6d95a2||0xc8;return function(_0x49f3e5){if(_0x49f3e5){return _0x2b762b[_0xde8d('0x18')](_0x6d95a2)[_0xde8d('0x1a')](_0x49f3e5);}};}function respondWithFilteredResult(_0x570ecc,_0x21bce6){return function(_0x3ab2de){if(_0x3ab2de){var _0x2cc2d2=_0x3ab2de[_0xde8d('0x1b')],_0x1df4ea=_0x21bce6[_0xde8d('0x1c')],_0x3809b3=_0x21bce6[_0xde8d('0x1c')]+_0x21bce6[_0xde8d('0x1d')],_0xa59cc9;if(_0x3809b3>=_0x2cc2d2){_0x3809b3=_0x2cc2d2;_0xa59cc9=0xc8;}else{_0xa59cc9=0xce;}_0x570ecc[_0xde8d('0x18')](_0xa59cc9);return _0x570ecc[_0xde8d('0x1e')](_0xde8d('0x1f'),_0x1df4ea+'-'+_0x3809b3+'/'+_0x2cc2d2)['json'](_0x3ab2de);}return null;};}function patchUpdates(_0x50cbcd){return function(_0x136038){try{jsonpatch['apply'](_0x136038,_0x50cbcd,!![]);}catch(_0x1810b3){return BPromise[_0xde8d('0x20')](_0x1810b3);}return _0x136038[_0xde8d('0x21')]();};}function saveUpdates(_0x1c62b6,_0x18e387){return function(_0x2475b1){if(_0x2475b1){return _0x2475b1[_0xde8d('0x22')](_0x1c62b6)['then'](function(_0x116948){return _0x116948;});}return null;};}function removeEntity(_0x114bcb,_0x3788bd){return function(_0x3e4e16){if(_0x3e4e16){return _0x3e4e16[_0xde8d('0x23')]()['then'](function(){_0x114bcb[_0xde8d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39596d,_0xc367b7){return function(_0x234f01){if(!_0x234f01){_0x39596d[_0xde8d('0x17')](0x194);}return _0x234f01;};}function handleError(_0x534f21,_0x5c4350){_0x5c4350=_0x5c4350||0x1f4;return function(_0x361642){logger[_0xde8d('0x24')](_0x361642[_0xde8d('0x25')]);if(_0x361642['name']){delete _0x361642['name'];}_0x534f21[_0xde8d('0x18')](_0x5c4350)[_0xde8d('0x26')](_0x361642);};}exports[_0xde8d('0x22')]=function(_0x37a389,_0x5d65cf){if(_0x37a389[_0xde8d('0x27')]['id']){delete _0x37a389[_0xde8d('0x27')]['id'];}return db[_0xde8d('0x28')]['find']({'where':{'id':_0x37a389[_0xde8d('0x29')]['id']}})[_0xde8d('0x2a')](handleEntityNotFound(_0x5d65cf,null))[_0xde8d('0x2a')](saveUpdates(_0x37a389['body'],null))[_0xde8d('0x2a')](respondWithResult(_0x5d65cf,null))[_0xde8d('0x2b')](handleError(_0x5d65cf,null));};exports[_0xde8d('0x23')]=function(_0x42d45a,_0x708ed2){return db[_0xde8d('0x28')][_0xde8d('0x2c')]({'where':{'id':_0x42d45a[_0xde8d('0x29')]['id']}})[_0xde8d('0x2a')](handleEntityNotFound(_0x708ed2,null))['then'](removeEntity(_0x708ed2,null))[_0xde8d('0x2b')](handleError(_0x708ed2,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index bc9710a..9a91bb0 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 _0x34df=['util','../../config/logger','request-promise','path','rimraf','./action.attributes','exports','define','Action','tools_actions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34df,0x1a4));var _0xf34d=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0x34df[_0x56b138];return _0x3df878;};'use strict';var _=require('lodash');var util=require(_0xf34d('0x0'));var logger=require(_0xf34d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf34d('0x2'));var fs=require('fs');var path=require(_0xf34d('0x3'));var rimraf=require(_0xf34d('0x4'));var config=require('../../config/environment');var attributes=require(_0xf34d('0x5'));module[_0xf34d('0x6')]=function(_0x3ca501,_0x258f35){return _0x3ca501[_0xf34d('0x7')](_0xf34d('0x8'),attributes,{'tableName':_0xf34d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01ef=['./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4eaa4c,_0x2f7422){var _0x15aec6=function(_0x23efc9){while(--_0x23efc9){_0x4eaa4c['push'](_0x4eaa4c['shift']());}};_0x15aec6(++_0x2f7422);}(_0x01ef,0x131));var _0xf01e=function(_0x15f4ad,_0xabccd2){_0x15f4ad=_0x15f4ad-0x0;var _0x21d9d0=_0x01ef[_0x15f4ad];return _0x21d9d0;};'use strict';var _=require(_0xf01e('0x0'));var util=require('util');var logger=require(_0xf01e('0x1'))(_0xf01e('0x2'));var moment=require(_0xf01e('0x3'));var BPromise=require(_0xf01e('0x4'));var rp=require(_0xf01e('0x5'));var fs=require('fs');var path=require(_0xf01e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf01e('0x7'));module[_0xf01e('0x8')]=function(_0x18016f,_0x197aef){return _0x18016f[_0xf01e('0x9')](_0xf01e('0xa'),attributes,{'tableName':_0xf01e('0xb'),'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 44f641d..09bd259 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 _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1bc509,_0x2eb50e){var _0x3fac54=function(_0x301618){while(--_0x301618){_0x1bc509['push'](_0x1bc509['shift']());}};_0x3fac54(++_0x2eb50e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xb7e7[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var 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')]('Action,\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);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index d07f8e7..d00cd4e 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 _0x89b7=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','/:id'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0x89b7,0x7f));var _0x789b=function(_0x5c7ea7,_0x4f7d6f){_0x5c7ea7=_0x5c7ea7-0x0;var _0x4c3cf1=_0x89b7[_0x5c7ea7];return _0x4c3cf1;};'use strict';var multer=require(_0x789b('0x0'));var util=require(_0x789b('0x1'));var path=require(_0x789b('0x2'));var timeout=require(_0x789b('0x3'));var express=require(_0x789b('0x4'));var router=express[_0x789b('0x5')]();var auth=require(_0x789b('0x6'));var interaction=require(_0x789b('0x7'));var config=require(_0x789b('0x8'));var controller=require(_0x789b('0x9'));router['put']('/:id',auth[_0x789b('0xa')](),controller[_0x789b('0xb')]);router['delete'](_0x789b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x789b('0xd')]=router; \ No newline at end of file +var _0xf9ab=['destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','update','/:id'];(function(_0x3258e3,_0x1e84f8){var _0x2e8fbd=function(_0x2789f6){while(--_0x2789f6){_0x3258e3['push'](_0x3258e3['shift']());}};_0x2e8fbd(++_0x1e84f8);}(_0xf9ab,0xf8));var _0xbf9a=function(_0x2488bd,_0x4df529){_0x2488bd=_0x2488bd-0x0;var _0x4feebb=_0xf9ab[_0x2488bd];return _0x4feebb;};'use strict';var multer=require(_0xbf9a('0x0'));var util=require(_0xbf9a('0x1'));var path=require(_0xbf9a('0x2'));var timeout=require(_0xbf9a('0x3'));var express=require('express');var router=express[_0xbf9a('0x4')]();var auth=require(_0xbf9a('0x5'));var interaction=require(_0xbf9a('0x6'));var config=require(_0xbf9a('0x7'));var controller=require(_0xbf9a('0x8'));router[_0xbf9a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbf9a('0xa')]);router['delete'](_0xbf9a('0xb'),auth['isAuthenticated'](),controller[_0xbf9a('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index f4b925c..5808e20 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 _0xf6d1=['sequelize','exports','STRING'];(function(_0x43f552,_0x42808c){var _0x17911b=function(_0x4407a7){while(--_0x4407a7){_0x43f552['push'](_0x43f552['shift']());}};_0x17911b(++_0x42808c);}(_0xf6d1,0xd8));var _0x1f6d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf6d1[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x1f6d('0x0'));module[_0x1f6d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1f6d('0x2')]},'parent':{'type':Sequelize[_0x1f6d('0x2')]},'table':{'type':Sequelize[_0x1f6d('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4398=['TEXT','sequelize','exports','STRING'];(function(_0x319412,_0x3e5995){var _0x2d78b3=function(_0x295ed6){while(--_0x295ed6){_0x319412['push'](_0x319412['shift']());}};_0x2d78b3(++_0x3e5995);}(_0x4398,0x1e5));var _0x8439=function(_0x555d83,_0x54f804){_0x555d83=_0x555d83-0x0;var _0x386ff3=_0x4398[_0x555d83];return _0x386ff3;};'use strict';var Sequelize=require(_0x8439('0x0'));module[_0x8439('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8439('0x2')]},'parent':{'type':Sequelize[_0x8439('0x2')]},'table':{'type':Sequelize[_0x8439('0x2')]},'conditions':{'type':Sequelize[_0x8439('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5b95013..4b5cbfb 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 _0x4849=['offset','limit','set','Content-Range','reject','update','then','CustomReports','UserProfileResource','destroy','stack','name','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','params','find','catch','create','body','get','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','metric','replace','function','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','MetricId','groupBy','%s.%s\x20=\x20%s.%s','QueryTypes','web','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','output','../../files/reports','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','dbH','sendStatus','status','end','json','count'];(function(_0x312ea4,_0x1dbcb0){var _0x467369=function(_0x5a8dd9){while(--_0x5a8dd9){_0x312ea4['push'](_0x312ea4['shift']());}};_0x467369(++_0x1dbcb0);}(_0x4849,0x86));var _0x9484=function(_0x9a3880,_0x8368e6){_0x9a3880=_0x9a3880-0x0;var _0x2fd0db=_0x4849[_0x9a3880];return _0x2fd0db;};'use strict';var pdf=require(_0x9484('0x0'));var emlformat=require(_0x9484('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9484('0x2'));var jsonpatch=require(_0x9484('0x3'));var rp=require(_0x9484('0x4'));var moment=require(_0x9484('0x5'));var BPromise=require(_0x9484('0x6'));var Mustache=require(_0x9484('0x7'));var util=require(_0x9484('0x8'));var path=require('path');var sox=require(_0x9484('0x9'));var csv=require(_0x9484('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9484('0xb'));var squel=require(_0x9484('0xc'));var crypto=require(_0x9484('0xd'));var jsforce=require(_0x9484('0xe'));var deskjs=require(_0x9484('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9484('0x10'));var Papa=require(_0x9484('0x11'));var Redis=require(_0x9484('0x12'));var authService=require(_0x9484('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9484('0x14'));var hardwareService=require(_0x9484('0x15'));var logger=require(_0x9484('0x16'))(_0x9484('0x17'));var utils=require(_0x9484('0x18'));var config=require(_0x9484('0x19'));var db=require(_0x9484('0x1a'))['db'];var dbH=require('../../mysqldb')[_0x9484('0x1b')];function respondWithStatusCode(_0x3deb1e,_0x5e3f76){_0x5e3f76=_0x5e3f76||0xcc;return function(_0x5ed6a9){if(_0x5ed6a9){return _0x3deb1e[_0x9484('0x1c')](_0x5e3f76);}return _0x3deb1e[_0x9484('0x1d')](_0x5e3f76)[_0x9484('0x1e')]();};}function respondWithResult(_0x4200c1,_0x81eb94){_0x81eb94=_0x81eb94||0xc8;return function(_0x39699c){if(_0x39699c){return _0x4200c1[_0x9484('0x1d')](_0x81eb94)[_0x9484('0x1f')](_0x39699c);}};}function respondWithFilteredResult(_0x207007,_0x37cf72){return function(_0x4bb57e){if(_0x4bb57e){var _0x96d182=_0x4bb57e[_0x9484('0x20')],_0x44b13e=_0x37cf72[_0x9484('0x21')],_0x58dab8=_0x37cf72[_0x9484('0x21')]+_0x37cf72[_0x9484('0x22')],_0x44ee26;if(_0x58dab8>=_0x96d182){_0x58dab8=_0x96d182;_0x44ee26=0xc8;}else{_0x44ee26=0xce;}_0x207007['status'](_0x44ee26);return _0x207007[_0x9484('0x23')](_0x9484('0x24'),_0x44b13e+'-'+_0x58dab8+'/'+_0x96d182)[_0x9484('0x1f')](_0x4bb57e);}return null;};}function patchUpdates(_0x45f183){return function(_0x431751){try{jsonpatch['apply'](_0x431751,_0x45f183,!![]);}catch(_0x230097){return BPromise[_0x9484('0x25')](_0x230097);}return _0x431751['save']();};}function saveUpdates(_0x42fe66,_0x5f0937){return function(_0x1558e4){if(_0x1558e4){return _0x1558e4[_0x9484('0x26')](_0x42fe66)[_0x9484('0x27')](function(_0xa04f20){return _0xa04f20;});}return null;};}function removeEntity(_0x890846,_0x39240b){return function(_0x43939e){if(_0x43939e){return _0x43939e['destroy']()['then'](function(){var _0x4bfc05=_0x43939e['get']({'plain':!![]});var _0x45c2c4=_0x9484('0x28');return db[_0x9484('0x29')][_0x9484('0x2a')]({'where':{'type':_0x45c2c4,'resourceId':_0x4bfc05['id']}})[_0x9484('0x27')](function(){return _0x43939e;});})[_0x9484('0x27')](function(){_0x890846['status'](0xcc)[_0x9484('0x1e')]();});}};}function handleEntityNotFound(_0x53ffc3,_0x58dc7b){return function(_0x4b7eb9){if(!_0x4b7eb9){_0x53ffc3[_0x9484('0x1c')](0x194);}return _0x4b7eb9;};}function handleError(_0x37552c,_0x425760){_0x425760=_0x425760||0x1f4;return function(_0x11a90c){logger['error'](_0x11a90c[_0x9484('0x2b')]);if(_0x11a90c[_0x9484('0x2c')]){delete _0x11a90c[_0x9484('0x2c')];}_0x37552c['status'](_0x425760)['send'](_0x11a90c);};}exports['index']=function(_0x1cd898,_0x11e9b0){var _0x10a8d7={},_0x4da693={},_0x1650e5={'count':0x0,'rows':[]};var _0x30cfd5=_[_0x9484('0x2d')](db[_0x9484('0x2e')][_0x9484('0x2f')],function(_0xb10926){return{'name':_0xb10926[_0x9484('0x30')],'type':_0xb10926[_0x9484('0x31')][_0x9484('0x32')]};});_0x4da693[_0x9484('0x33')]=_['map'](_0x30cfd5,_0x9484('0x2c'));_0x4da693[_0x9484('0x34')]=_[_0x9484('0x35')](_0x1cd898[_0x9484('0x34')]);_0x4da693[_0x9484('0x36')]=_[_0x9484('0x37')](_0x4da693[_0x9484('0x33')],_0x4da693[_0x9484('0x34')]);_0x10a8d7[_0x9484('0x38')]=_[_0x9484('0x37')](_0x4da693[_0x9484('0x33')],qs[_0x9484('0x39')](_0x1cd898[_0x9484('0x34')]['fields']));_0x10a8d7[_0x9484('0x38')]=_0x10a8d7[_0x9484('0x38')][_0x9484('0x3a')]?_0x10a8d7[_0x9484('0x38')]:_0x4da693[_0x9484('0x33')];if(!_0x1cd898[_0x9484('0x34')][_0x9484('0x3b')](_0x9484('0x3c'))){_0x10a8d7['limit']=qs[_0x9484('0x22')](_0x1cd898[_0x9484('0x34')][_0x9484('0x22')]);_0x10a8d7[_0x9484('0x21')]=qs[_0x9484('0x21')](_0x1cd898['query'][_0x9484('0x21')]);}_0x10a8d7[_0x9484('0x3d')]=qs[_0x9484('0x3e')](_0x1cd898[_0x9484('0x34')][_0x9484('0x3e')]);_0x10a8d7[_0x9484('0x3f')]=qs[_0x9484('0x36')](_['pick'](_0x1cd898['query'],_0x4da693[_0x9484('0x36')]),_0x30cfd5);if(_0x1cd898[_0x9484('0x34')][_0x9484('0x40')]){_0x10a8d7[_0x9484('0x3f')]=_[_0x9484('0x41')](_0x10a8d7['where'],{'$or':_['map'](_0x30cfd5,function(_0xcee4c){if(_0xcee4c['type']!==_0x9484('0x42')){var _0x4806fc={};_0x4806fc[_0xcee4c[_0x9484('0x2c')]]={'$like':'%'+_0x1cd898[_0x9484('0x34')]['filter']+'%'};return _0x4806fc;}})});}_0x10a8d7=_['merge']({},_0x10a8d7,_0x1cd898[_0x9484('0x43')]);var _0x905ce0={'where':_0x10a8d7[_0x9484('0x3f')]};return db[_0x9484('0x2e')][_0x9484('0x20')](_0x905ce0)['then'](function(_0x25d30e){_0x1650e5[_0x9484('0x20')]=_0x25d30e;if(_0x1cd898[_0x9484('0x34')][_0x9484('0x44')]){_0x10a8d7[_0x9484('0x45')]=[{'all':!![]}];}return db[_0x9484('0x2e')]['findAll'](_0x10a8d7);})[_0x9484('0x27')](function(_0x224441){_0x1650e5['rows']=_0x224441;return _0x1650e5;})[_0x9484('0x27')](respondWithFilteredResult(_0x11e9b0,_0x10a8d7))['catch'](handleError(_0x11e9b0,null));};exports['show']=function(_0xa22a,_0x4fd8eb){var _0x254d7e={'raw':![],'where':{'id':_0xa22a[_0x9484('0x46')]['id']}},_0x3baa5c={};_0x3baa5c['model']=_['keys'](db[_0x9484('0x2e')][_0x9484('0x2f')]);_0x3baa5c[_0x9484('0x34')]=_[_0x9484('0x35')](_0xa22a[_0x9484('0x34')]);_0x3baa5c[_0x9484('0x36')]=_[_0x9484('0x37')](_0x3baa5c['model'],_0x3baa5c[_0x9484('0x34')]);_0x254d7e['attributes']=_[_0x9484('0x37')](_0x3baa5c[_0x9484('0x33')],qs[_0x9484('0x39')](_0xa22a[_0x9484('0x34')][_0x9484('0x39')]));_0x254d7e[_0x9484('0x38')]=_0x254d7e[_0x9484('0x38')]['length']?_0x254d7e[_0x9484('0x38')]:_0x3baa5c['model'];if(_0xa22a['query'][_0x9484('0x44')]){_0x254d7e[_0x9484('0x45')]=[{'all':!![]}];}_0x254d7e=_['merge']({},_0x254d7e,_0xa22a[_0x9484('0x43')]);return db[_0x9484('0x2e')][_0x9484('0x47')](_0x254d7e)[_0x9484('0x27')](handleEntityNotFound(_0x4fd8eb,null))['then'](respondWithResult(_0x4fd8eb,null))[_0x9484('0x48')](handleError(_0x4fd8eb,null));};exports[_0x9484('0x49')]=function(_0x391903,_0x6c72d9){return db['AnalyticCustomReport'][_0x9484('0x49')](_0x391903[_0x9484('0x4a')],{})[_0x9484('0x27')](function(_0x390faf){var _0x255c6e=_0x391903['user'][_0x9484('0x4b')]({'plain':!![]});if(!_0x255c6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x255c6e[_0x9484('0x4c')]===_0x9484('0x4d')){var _0x599b0e=_0x390faf[_0x9484('0x4b')]({'plain':!![]});var _0x3b22ff=_0x9484('0x4e');return db[_0x9484('0x4f')]['find']({'where':{'name':_0x3b22ff,'userProfileId':_0x255c6e[_0x9484('0x50')]},'raw':!![]})[_0x9484('0x27')](function(_0x50c607){if(_0x50c607&&_0x50c607[_0x9484('0x51')]===0x0){return db['UserProfileResource'][_0x9484('0x49')]({'name':_0x599b0e[_0x9484('0x2c')],'resourceId':_0x599b0e['id'],'type':_0x9484('0x28'),'sectionId':_0x50c607['id']},{})[_0x9484('0x27')](function(){return _0x390faf;});}else{return _0x390faf;}})[_0x9484('0x48')](function(_0x433249){logger['error'](_0x9484('0x52'),_0x433249);throw _0x433249;});}return _0x390faf;})[_0x9484('0x27')](respondWithResult(_0x6c72d9,0xc9))['catch'](handleError(_0x6c72d9,null));};exports[_0x9484('0x26')]=function(_0x114ea6,_0x3124f8){if(_0x114ea6[_0x9484('0x4a')]['id']){delete _0x114ea6[_0x9484('0x4a')]['id'];}return db['AnalyticCustomReport'][_0x9484('0x47')]({'where':{'id':_0x114ea6['params']['id']}})[_0x9484('0x27')](handleEntityNotFound(_0x3124f8,null))[_0x9484('0x27')](saveUpdates(_0x114ea6['body'],null))[_0x9484('0x27')](respondWithResult(_0x3124f8,null))[_0x9484('0x48')](handleError(_0x3124f8,null));};exports[_0x9484('0x2a')]=function(_0x395aaa,_0xaa62e4){return db[_0x9484('0x2e')][_0x9484('0x47')]({'where':{'id':_0x395aaa[_0x9484('0x46')]['id']}})['then'](handleEntityNotFound(_0xaa62e4,null))[_0x9484('0x27')](removeEntity(_0xaa62e4,null))['catch'](handleError(_0xaa62e4,null));};exports[_0x9484('0x53')]=function(_0x4162f1,_0x880736){var _0x153637=0xa;var _0x1046a5=[_0x9484('0x54'),_0x9484('0x55'),_0x9484('0x56'),_0x9484('0x57')];var _0x43a401={'SUM':_0x9484('0x58'),'COUNT':_0x9484('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9484('0x5a'),'MIN':_0x9484('0x5b'),'AVG':_0x9484('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9484('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x28525f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9484('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9484('0x5f')};var _0x54e78d=function(_0x124db1){return!_[_0x9484('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x9484('0x61')],_0x124db1);};var _0x181779=function(_0x3aae2c){if(!_0x3aae2c||!_0x3aae2c[_0x9484('0x62')][_0x9484('0x3a')]){return'';}for(var _0x10facc='(',_0x5b7dc3=0x0;_0x5b7dc3<_0x3aae2c[_0x9484('0x62')]['length'];_0x5b7dc3+=0x1){_0x5b7dc3>0x0&&(_0x10facc+='\x20'+_0x3aae2c[_0x9484('0x63')]+'\x20');_0x10facc+=_0x3aae2c['rules'][_0x5b7dc3]['group']?_0x181779(_0x3aae2c['rules'][_0x5b7dc3][_0x9484('0x64')]):_0x3aae2c[_0x9484('0x62')][_0x5b7dc3][_0x9484('0x65')]+'\x20'+_0x3aae2c[_0x9484('0x62')][_0x5b7dc3]['condition']+(_0x54e78d(_0x3aae2c[_0x9484('0x62')][_0x5b7dc3][_0x9484('0x66')])?'\x20'+_0x3aae2c[_0x9484('0x62')][_0x5b7dc3][_0x9484('0x67')]:'');}return _0x10facc+')';};var _0x474a90={'where':{'id':_0x4162f1[_0x9484('0x46')]['id']}},_0x5edcfb,_0x1e990d,_0x3fe362,_0x57590e,_0x406522;_0x474a90=_[_0x9484('0x41')]({},_0x474a90,_0x4162f1['options']);return db[_0x9484('0x2e')][_0x9484('0x47')](_0x474a90)['then'](function(_0x48f752){if(_0x48f752){_0x5edcfb=_0x48f752;return _0x48f752[_0x9484('0x68')]();}return null;})[_0x9484('0x27')](function(_0x19a20a){if(_0x19a20a){if(!_0x19a20a['length']){throw new db[(_0x9484('0x69'))][(_0x9484('0x6a'))](_0x9484('0x6b'),0x193);}_0x1e990d=_0x19a20a;return db[_0x9484('0x6c')][_0x9484('0x6d')]({'raw':!![]});}return null;})['then'](function(_0x573ecb){if(_0x573ecb){_0x3fe362=_[_0x9484('0x6e')](_0x573ecb,'id');var _0x16dfc4;var _0x177322=squel[_0x9484('0x6f')]();_0x177322[_0x9484('0x70')](_0x5edcfb[_0x9484('0x71')]);for(var _0x30a364=0x0;_0x30a364<_0x1e990d[_0x9484('0x3a')];_0x30a364+=0x1){_0x16dfc4=_0x1e990d[_0x30a364]['MetricId']?_0x3fe362[_0x1e990d[_0x30a364]['MetricId']][_0x9484('0x72')]:_0x1e990d[_0x30a364]['field'];_0x16dfc4=_0x1e990d[_0x30a364]['function']?_[_0x9484('0x73')](_0x43a401[_0x1e990d[_0x30a364][_0x9484('0x74')]],'%s',_0x16dfc4):_0x16dfc4;_0x16dfc4=_0x1e990d[_0x30a364][_0x9484('0x75')]?_['replace'](_0x28525f[_0x1e990d[_0x30a364]['format']],'%s',_0x16dfc4):_0x16dfc4;if(_0x1e990d[_0x30a364]['groupBy']){_0x177322[_0x9484('0x64')](_0x16dfc4);}_0x1e990d[_0x30a364][_0x9484('0x76')]&&_0x177322[_0x9484('0x3d')](_0x16dfc4,_0x1e990d[_0x30a364][_0x9484('0x76')]===_0x9484('0x77')?![]:!![]);_0x177322['field'](_0x16dfc4,_0x1e990d[_0x30a364][_0x9484('0x78')]||_0x16dfc4);}if(_0x5edcfb[_0x9484('0x79')]){_0x5edcfb['joins']=JSON['parse'](_0x5edcfb['joins']);for(var _0x34d62a=0x0;_0x34d62a<_0x5edcfb[_0x9484('0x79')]['length'];_0x34d62a+=0x1){if(_0x5edcfb['joins'][_0x34d62a][_0x9484('0x31')]&&_[_0x9484('0x60')](_0x1046a5,_0x5edcfb[_0x9484('0x79')][_0x34d62a]['type'])&&_0x5edcfb[_0x9484('0x79')][_0x34d62a][_0x9484('0x7a')]&&_0x5edcfb[_0x9484('0x79')][_0x34d62a][_0x9484('0x7b')]&&_0x5edcfb[_0x9484('0x79')][_0x34d62a][_0x9484('0x7c')]){_0x177322[_0x5edcfb[_0x9484('0x79')][_0x34d62a][_0x9484('0x31')]](_0x5edcfb['joins'][_0x34d62a][_0x9484('0x7b')],null,util[_0x9484('0x75')]('%s.%s\x20=\x20%s.%s',_0x5edcfb['table'],_0x5edcfb['joins'][_0x34d62a]['parentKey'],_0x5edcfb['joins'][_0x34d62a]['foreignTable'],_0x5edcfb[_0x9484('0x79')][_0x34d62a][_0x9484('0x7c')]));}}}if(_0x5edcfb[_0x9484('0x7d')]){_0x5edcfb[_0x9484('0x7d')]=JSON[_0x9484('0x7e')](_0x5edcfb[_0x9484('0x7d')]);_0x177322[_0x9484('0x3f')](_0x181779(_0x5edcfb['conditions'][_0x9484('0x64')]));}_0x406522=_0x177322[_0x9484('0x7f')]();_0x177322[_0x9484('0x22')](_0x153637);_0x177322[_0x9484('0x21')](0x0);logger[_0x9484('0x80')](_0x9484('0x81'),_0x177322[_0x9484('0x82')]());return db[_0x9484('0x83')][_0x9484('0x34')](_0x177322[_0x9484('0x82')](),{'type':db[_0x9484('0x83')]['QueryTypes'][_0x9484('0x84')]});}})[_0x9484('0x27')](respondWithResult(_0x880736,null))[_0x9484('0x48')](handleError(_0x880736,null));};function runReport(_0x2d983e,_0x327ee2,_0x172320){var _0x525fe4=_0x327ee2[_0x9484('0x2c')];var _0x555874=0xa;var _0x25f9b2=[_0x9484('0x54'),_0x9484('0x55'),_0x9484('0x56'),_0x9484('0x57')];var _0xac9cf2={'SUM':_0x9484('0x58'),'COUNT':_0x9484('0x59'),'COUNT DISTINCT':_0x9484('0x85'),'MAX':_0x9484('0x5a'),'MIN':'MIN(%s)','AVG':_0x9484('0x5c'),'GROUP_CONCAT':_0x9484('0x86'),'GROUP_CONCAT ASC':_0x9484('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1a7e09={'SEC_TO_TIME':_0x9484('0x87'),'DATE':'DATE(%s)','HOUR':_0x9484('0x88'),'ROUND':_0x9484('0x89'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x348a49=function(_0x3184ad){return!_[_0x9484('0x60')]([_0x9484('0x8a'),_0x9484('0x8b'),'IS\x20EMPTY',_0x9484('0x61')],_0x3184ad);};var _0x58a232=function(_0x38ddcc){if(!_0x38ddcc||!_0x38ddcc[_0x9484('0x62')][_0x9484('0x3a')]){return'';}for(var _0x17fb60='(',_0x4d6382=0x0;_0x4d6382<_0x38ddcc[_0x9484('0x62')][_0x9484('0x3a')];_0x4d6382+=0x1){_0x4d6382>0x0&&(_0x17fb60+='\x20'+_0x38ddcc['operator']+'\x20');_0x17fb60+=_0x38ddcc['rules'][_0x4d6382][_0x9484('0x64')]?_0x58a232(_0x38ddcc['rules'][_0x4d6382][_0x9484('0x64')]):_0x38ddcc[_0x9484('0x62')][_0x4d6382][_0x9484('0x65')]+'\x20'+_0x38ddcc[_0x9484('0x62')][_0x4d6382][_0x9484('0x66')]+(_0x348a49(_0x38ddcc[_0x9484('0x62')][_0x4d6382][_0x9484('0x66')])?'\x20'+_0x38ddcc[_0x9484('0x62')][_0x4d6382][_0x9484('0x67')]:'');}return _0x17fb60+')';};var _0x5bd6c3={'where':{'id':_0x2d983e['id']}},_0x3bf3a9,_0x57d0c7,_0x3ba6d3,_0x19e74f,_0x13451c;_0x5bd6c3=_[_0x9484('0x41')]({},_0x5bd6c3,_0x172320);return db[_0x9484('0x2e')]['find'](_0x5bd6c3)['then'](function(_0x16b440){if(_0x16b440){_0x3bf3a9=_0x16b440;return _0x16b440[_0x9484('0x68')]();}return null;})[_0x9484('0x27')](function(_0xf4baaa){if(_0xf4baaa){if(!_0xf4baaa[_0x9484('0x3a')]){throw new db[(_0x9484('0x69'))][(_0x9484('0x6a'))](_0x9484('0x6b'),0x193);}_0x57d0c7=_0xf4baaa;return db[_0x9484('0x6c')][_0x9484('0x6d')]({'raw':!![]});}return null;})['then'](function(_0x9642be){if(_0x9642be){_0x3ba6d3=_['keyBy'](_0x9642be,'id');var _0x18bbdf;var _0x4a3d96=squel[_0x9484('0x6f')]();_0x4a3d96[_0x9484('0x70')](_0x3bf3a9[_0x9484('0x71')]);for(var _0x2a9273=0x0;_0x2a9273<_0x57d0c7[_0x9484('0x3a')];_0x2a9273+=0x1){_0x18bbdf=_0x57d0c7[_0x2a9273][_0x9484('0x8c')]?_0x3ba6d3[_0x57d0c7[_0x2a9273]['MetricId']][_0x9484('0x72')]:_0x57d0c7[_0x2a9273][_0x9484('0x65')];_0x18bbdf=_0x57d0c7[_0x2a9273][_0x9484('0x74')]?_['replace'](_0xac9cf2[_0x57d0c7[_0x2a9273][_0x9484('0x74')]],'%s',_0x18bbdf):_0x18bbdf;_0x18bbdf=_0x57d0c7[_0x2a9273]['format']?_[_0x9484('0x73')](_0x1a7e09[_0x57d0c7[_0x2a9273][_0x9484('0x75')]],'%s',_0x18bbdf):_0x18bbdf;if(_0x57d0c7[_0x2a9273][_0x9484('0x8d')]){_0x4a3d96[_0x9484('0x64')](_0x18bbdf);}_0x57d0c7[_0x2a9273][_0x9484('0x76')]&&_0x4a3d96['order'](_0x18bbdf,_0x57d0c7[_0x2a9273][_0x9484('0x76')]==='DESC'?![]:!![]);_0x4a3d96['field'](_0x18bbdf,_0x57d0c7[_0x2a9273][_0x9484('0x78')]||_0x18bbdf);}if(_0x3bf3a9['joins']){_0x3bf3a9['joins']=JSON[_0x9484('0x7e')](_0x3bf3a9['joins']);for(var _0x157f2a=0x0;_0x157f2a<_0x3bf3a9[_0x9484('0x79')][_0x9484('0x3a')];_0x157f2a+=0x1){if(_0x3bf3a9[_0x9484('0x79')][_0x157f2a][_0x9484('0x31')]&&_[_0x9484('0x60')](_0x25f9b2,_0x3bf3a9[_0x9484('0x79')][_0x157f2a]['type'])&&_0x3bf3a9[_0x9484('0x79')][_0x157f2a][_0x9484('0x7a')]&&_0x3bf3a9['joins'][_0x157f2a][_0x9484('0x7b')]&&_0x3bf3a9[_0x9484('0x79')][_0x157f2a]['foreignKey']){_0x4a3d96[_0x3bf3a9['joins'][_0x157f2a][_0x9484('0x31')]](_0x3bf3a9[_0x9484('0x79')][_0x157f2a][_0x9484('0x7b')],null,util[_0x9484('0x75')](_0x9484('0x8e'),_0x3bf3a9[_0x9484('0x71')],_0x3bf3a9[_0x9484('0x79')][_0x157f2a][_0x9484('0x7a')],_0x3bf3a9[_0x9484('0x79')][_0x157f2a][_0x9484('0x7b')],_0x3bf3a9[_0x9484('0x79')][_0x157f2a]['foreignKey']));}}}if(_0x3bf3a9[_0x9484('0x7d')]){_0x3bf3a9[_0x9484('0x7d')]=JSON[_0x9484('0x7e')](_0x3bf3a9[_0x9484('0x7d')]);_0x4a3d96[_0x9484('0x3f')](_0x58a232(_0x3bf3a9[_0x9484('0x7d')][_0x9484('0x64')]));}_0x13451c=_0x4a3d96[_0x9484('0x7f')]();_0x4a3d96[_0x9484('0x22')](_0x555874);_0x4a3d96[_0x9484('0x21')](0x0);logger[_0x9484('0x80')](_0x9484('0x81'),_0x4a3d96['toString']());return db['sequelize'][_0x9484('0x34')](_0x4a3d96[_0x9484('0x82')](),{'type':db['sequelize'][_0x9484('0x8f')][_0x9484('0x84')]});}})[_0x9484('0x27')](function(_0x4db460){if(!_0x4db460[_0x9484('0x3a')]){throw new db[(_0x9484('0x69'))][(_0x9484('0x6a'))]('No\x20available\x20data',0xcc);}if(_0x327ee2['output']===_0x9484('0x90')){return null;}var _0x218030=_['merge'](_0x327ee2,{'name':_0x327ee2['fullPath']||_0x327ee2[_0x9484('0x2c')]||_0x3bf3a9['name'],'basename':_0x525fe4,'savename':util[_0x9484('0x75')](_0x9484('0x91'),_0x327ee2[_0x9484('0x2c')]||_0x3bf3a9[_0x9484('0x2c')],require('randomstring')[_0x9484('0x92')](0x4),_0x327ee2['output']||_0x9484('0x93')),'reportId':_0x3bf3a9['id'],'reportType':_0x9484('0x94')});return db[_0x9484('0x95')]['create'](_0x218030,{'raw':!![]});})[_0x9484('0x27')](function(_0x2171e7){if(_0x3bf3a9['table']===_0x9484('0x96')){_0x13451c[_0x9484('0x3f')](_0x3bf3a9[_0x9484('0x71')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x327ee2['startDate'],_0x327ee2['endDate']);}else{_0x13451c[_0x9484('0x3f')](_0x3bf3a9['table']+_0x9484('0x97'),_0x327ee2[_0x9484('0x98')],_0x327ee2[_0x9484('0x99')]);}if(_0x2171e7){logger[_0x9484('0x9a')]('Run\x20Query:',_0x13451c[_0x9484('0x82')]());require(_0x9484('0x9b'))[_0x9484('0x9c')](path['join'](__dirname,_0x9484('0x9d'),_0x2171e7[_0x9484('0x9e')]),[_0x2171e7['id'],_0x13451c[_0x9484('0x82')](),path[_0x9484('0x54')](__dirname,_0x9484('0x9f'),_0x2171e7[_0x9484('0xa0')]),_0x525fe4]);return _0x2171e7;}else{var _0x4a352c=squel['select']();_0x4a352c[_0x9484('0x70')]('('+_0x13451c[_0x9484('0x82')]()+')',_0x9484('0xa1'));_0x4a352c[_0x9484('0x65')](_0x9484('0xa2'),_0x9484('0x20'));_0x13451c[_0x9484('0x22')](_0x327ee2[_0x9484('0x22')]||_0x555874);_0x13451c[_0x9484('0x21')](_0x327ee2[_0x9484('0x21')]||0x0);return dbH[_0x9484('0x83')][_0x9484('0x34')](_0x4a352c[_0x9484('0x82')](),{'type':dbH[_0x9484('0x83')][_0x9484('0x8f')][_0x9484('0x84')]})[_0x9484('0x27')](function(_0x1113d0){if(!_0x1113d0[_0x9484('0x3a')]){_0x19e74f=0x0;}else{_0x19e74f=_0x1113d0[0x0][_0x9484('0x20')]||0x0;}return dbH[_0x9484('0x83')][_0x9484('0x34')](_0x13451c[_0x9484('0x82')](),{'type':dbH['sequelize'][_0x9484('0x8f')]['SELECT']});})['then'](function(_0x5c1cce){return{'rows':_0x5c1cce||[],'count':_0x19e74f};});}});}exports[_0x9484('0xa3')]=function(_0x34bcd3,_0x474da8){return runReport(_0x34bcd3[_0x9484('0x46')],_0x34bcd3[_0x9484('0x34')],_0x34bcd3[_0x9484('0x43')])[_0x9484('0x27')](respondWithResult(_0x474da8,null))[_0x9484('0x48')](handleError(_0x474da8,null));};exports[_0x9484('0xa4')]=runReport;exports[_0x9484('0x34')]=function(_0x162cce,_0x4b3ca6){var _0x26dff9=0xa;var _0xb51894=['join',_0x9484('0x55'),_0x9484('0x56'),_0x9484('0x57')];var _0x5756f4={'SUM':_0x9484('0x58'),'COUNT':_0x9484('0x59'),'COUNT DISTINCT':_0x9484('0x85'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x9484('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9484('0xa5')};var _0x424812={'SEC_TO_TIME':_0x9484('0x87'),'DATE':_0x9484('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x9484('0x89'),'UNIX_TIMESTAMP':_0x9484('0x5f')};var _0x533cd3=function(_0x306c1d){return!_['includes']([_0x9484('0x8a'),'IS\x20NOT\x20NULL',_0x9484('0xa6'),_0x9484('0x61')],_0x306c1d);};var _0x3e4228=function(_0x38d798){if(!_0x38d798||!_0x38d798['rules'][_0x9484('0x3a')]){return'';}for(var _0x38a9c9='(',_0x168db9=0x0;_0x168db9<_0x38d798[_0x9484('0x62')][_0x9484('0x3a')];_0x168db9+=0x1){_0x168db9>0x0&&(_0x38a9c9+='\x20'+_0x38d798[_0x9484('0x63')]+'\x20');_0x38a9c9+=_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x64')]?_0x3e4228(_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x64')]):_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x65')]+'\x20'+_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x66')]+(_0x533cd3(_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x66')])?'\x20'+_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x67')]:'');}return _0x38a9c9+')';};var _0x3e573b={'where':{'id':_0x162cce[_0x9484('0x46')]['id']}},_0x464c4a,_0x4fd6c6,_0x3580d3,_0x3a45f2,_0xe9488b;_0x3e573b=_[_0x9484('0x41')]({},_0x3e573b,_0x162cce['options']);return db[_0x9484('0x2e')]['find'](_0x3e573b)[_0x9484('0x27')](function(_0x1be136){if(_0x1be136){_0x464c4a=_0x1be136;return _0x1be136[_0x9484('0x68')]();}return null;})['then'](function(_0x971ed3){if(_0x971ed3){if(!_0x971ed3[_0x9484('0x3a')]){throw new db[(_0x9484('0x69'))][(_0x9484('0x6a'))](_0x9484('0x6b'),0x193);}_0x4fd6c6=_0x971ed3;return db[_0x9484('0x6c')][_0x9484('0x6d')]({'raw':!![]});}return null;})[_0x9484('0x27')](function(_0x33f83f){if(_0x33f83f){_0x3580d3=_[_0x9484('0x6e')](_0x33f83f,'id');var _0x360d1d;var _0x53adbf=squel[_0x9484('0x6f')]();_0x53adbf[_0x9484('0x70')](_0x464c4a[_0x9484('0x71')]);for(var _0x54d850=0x0;_0x54d850<_0x4fd6c6['length'];_0x54d850+=0x1){_0x360d1d=_0x4fd6c6[_0x54d850]['MetricId']?_0x3580d3[_0x4fd6c6[_0x54d850][_0x9484('0x8c')]][_0x9484('0x72')]:_0x4fd6c6[_0x54d850][_0x9484('0x65')];_0x360d1d=_0x4fd6c6[_0x54d850][_0x9484('0x74')]?_[_0x9484('0x73')](_0x5756f4[_0x4fd6c6[_0x54d850][_0x9484('0x74')]],'%s',_0x360d1d):_0x360d1d;_0x360d1d=_0x4fd6c6[_0x54d850]['format']?_[_0x9484('0x73')](_0x424812[_0x4fd6c6[_0x54d850][_0x9484('0x75')]],'%s',_0x360d1d):_0x360d1d;if(_0x4fd6c6[_0x54d850][_0x9484('0x8d')]){_0x53adbf[_0x9484('0x64')](_0x360d1d);}_0x4fd6c6[_0x54d850][_0x9484('0x76')]&&_0x53adbf['order'](_0x360d1d,_0x4fd6c6[_0x54d850][_0x9484('0x76')]===_0x9484('0x77')?![]:!![]);_0x53adbf['field'](_0x360d1d,_0x4fd6c6[_0x54d850][_0x9484('0x78')]||_0x360d1d);}if(_0x464c4a[_0x9484('0x79')]){_0x464c4a[_0x9484('0x79')]=JSON['parse'](_0x464c4a[_0x9484('0x79')]);for(var _0xfe9d8b=0x0;_0xfe9d8b<_0x464c4a[_0x9484('0x79')][_0x9484('0x3a')];_0xfe9d8b+=0x1){if(_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x31')]&&_[_0x9484('0x60')](_0xb51894,_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x31')])&&_0x464c4a['joins'][_0xfe9d8b]['parentKey']&&_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x7b')]&&_0x464c4a[_0x9484('0x79')][_0xfe9d8b]['foreignKey']){_0x53adbf[_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x31')]](_0x464c4a['joins'][_0xfe9d8b]['foreignTable'],null,util[_0x9484('0x75')]('%s.%s\x20=\x20%s.%s',_0x464c4a[_0x9484('0x71')],_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x7a')],_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x7b')],_0x464c4a[_0x9484('0x79')][_0xfe9d8b]['foreignKey']));}}}if(_0x464c4a['conditions']){_0x464c4a['conditions']=JSON[_0x9484('0x7e')](_0x464c4a[_0x9484('0x7d')]);_0x53adbf[_0x9484('0x3f')](_0x3e4228(_0x464c4a['conditions']['group']));}_0xe9488b=_0x53adbf[_0x9484('0x7f')]();_0x53adbf[_0x9484('0x22')](_0x26dff9);_0x53adbf[_0x9484('0x21')](0x0);logger[_0x9484('0x80')](_0x9484('0x81'),_0x53adbf['toString']());return db[_0x9484('0x83')][_0x9484('0x34')](_0x53adbf[_0x9484('0x82')](),{'type':db[_0x9484('0x83')][_0x9484('0x8f')][_0x9484('0x84')]});}})[_0x9484('0x27')](function(){return{'sql':_0xe9488b['toString']()};})[_0x9484('0x27')](respondWithResult(_0x4b3ca6,null))['catch'](handleError(_0x4b3ca6,null));}; \ No newline at end of file +var _0x049e=['metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','HOUR(%s)','UNIX_TIMESTAMP(%s)','AnalyticMetric','alias','debug','No\x20available\x20data','output','fullPath','randomstring','generate','csv','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','COUNT(*)','count','QueryTypes','runReport','SUM(%s)','MIN(%s)','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','dbH','sendStatus','end','json','offset','status','reject','save','update','then','UserProfileResource','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','role','get','Reports','UserProfileSection','userProfileId','CustomReports','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId'];(function(_0xd1d73e,_0x5ea73a){var _0x4eb7fe=function(_0x4a214a){while(--_0x4a214a){_0xd1d73e['push'](_0xd1d73e['shift']());}};_0x4eb7fe(++_0x5ea73a);}(_0x049e,0x16a));var _0xe049=function(_0x4b8156,_0x437af2){_0x4b8156=_0x4b8156-0x0;var _0x4a819c=_0x049e[_0x4b8156];return _0x4a819c;};'use strict';var pdf=require(_0xe049('0x0'));var emlformat=require(_0xe049('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe049('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe049('0x3'));var moment=require(_0xe049('0x4'));var BPromise=require(_0xe049('0x5'));var Mustache=require(_0xe049('0x6'));var util=require(_0xe049('0x7'));var path=require('path');var sox=require(_0xe049('0x8'));var csv=require(_0xe049('0x9'));var ejs=require(_0xe049('0xa'));var fs=require('fs');var _=require(_0xe049('0xb'));var squel=require(_0xe049('0xc'));var crypto=require(_0xe049('0xd'));var jsforce=require(_0xe049('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe049('0x9'));var querystring=require(_0xe049('0xf'));var Papa=require(_0xe049('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe049('0x11'));var as=require(_0xe049('0x12'));var hardwareService=require(_0xe049('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe049('0x14'));var db=require(_0xe049('0x15'))['db'];var dbH=require(_0xe049('0x15'))[_0xe049('0x16')];function respondWithStatusCode(_0x301c7e,_0x1021e7){_0x1021e7=_0x1021e7||0xcc;return function(_0xdd1814){if(_0xdd1814){return _0x301c7e[_0xe049('0x17')](_0x1021e7);}return _0x301c7e['status'](_0x1021e7)[_0xe049('0x18')]();};}function respondWithResult(_0x3f4a57,_0x3924a4){_0x3924a4=_0x3924a4||0xc8;return function(_0x35fd0d){if(_0x35fd0d){return _0x3f4a57['status'](_0x3924a4)[_0xe049('0x19')](_0x35fd0d);}};}function respondWithFilteredResult(_0xcc35b6,_0x5c90fd){return function(_0x388be0){if(_0x388be0){var _0x26b40c=_0x388be0['count'],_0x526d25=_0x5c90fd[_0xe049('0x1a')],_0x8b9bfe=_0x5c90fd['offset']+_0x5c90fd['limit'],_0x5291a9;if(_0x8b9bfe>=_0x26b40c){_0x8b9bfe=_0x26b40c;_0x5291a9=0xc8;}else{_0x5291a9=0xce;}_0xcc35b6[_0xe049('0x1b')](_0x5291a9);return _0xcc35b6['set']('Content-Range',_0x526d25+'-'+_0x8b9bfe+'/'+_0x26b40c)[_0xe049('0x19')](_0x388be0);}return null;};}function patchUpdates(_0x1092ec){return function(_0x5ae414){try{jsonpatch['apply'](_0x5ae414,_0x1092ec,!![]);}catch(_0x22af56){return BPromise[_0xe049('0x1c')](_0x22af56);}return _0x5ae414[_0xe049('0x1d')]();};}function saveUpdates(_0x430421,_0x517aea){return function(_0x572f29){if(_0x572f29){return _0x572f29[_0xe049('0x1e')](_0x430421)[_0xe049('0x1f')](function(_0x572a80){return _0x572a80;});}return null;};}function removeEntity(_0x36a03b,_0x3f14eb){return function(_0x10cb90){if(_0x10cb90){return _0x10cb90['destroy']()[_0xe049('0x1f')](function(){var _0x3b0f54=_0x10cb90['get']({'plain':!![]});var _0x4848c9='CustomReports';return db[_0xe049('0x20')]['destroy']({'where':{'type':_0x4848c9,'resourceId':_0x3b0f54['id']}})['then'](function(){return _0x10cb90;});})[_0xe049('0x1f')](function(){_0x36a03b[_0xe049('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f5233,_0x181432){return function(_0x3e5c7f){if(!_0x3e5c7f){_0x1f5233[_0xe049('0x17')](0x194);}return _0x3e5c7f;};}function handleError(_0x293dd2,_0x1843b8){_0x1843b8=_0x1843b8||0x1f4;return function(_0x5b0e64){logger['error'](_0x5b0e64[_0xe049('0x21')]);if(_0x5b0e64['name']){delete _0x5b0e64[_0xe049('0x22')];}_0x293dd2['status'](_0x1843b8)[_0xe049('0x23')](_0x5b0e64);};}exports[_0xe049('0x24')]=function(_0x5adcd6,_0x432a6e){var _0x364630={},_0xb64700={},_0x33353d={'count':0x0,'rows':[]};var _0x4464b2=_[_0xe049('0x25')](db[_0xe049('0x26')][_0xe049('0x27')],function(_0x4038f0){return{'name':_0x4038f0[_0xe049('0x28')],'type':_0x4038f0[_0xe049('0x29')]['key']};});_0xb64700[_0xe049('0x2a')]=_[_0xe049('0x25')](_0x4464b2,'name');_0xb64700['query']=_['keys'](_0x5adcd6['query']);_0xb64700[_0xe049('0x2b')]=_[_0xe049('0x2c')](_0xb64700[_0xe049('0x2a')],_0xb64700[_0xe049('0x2d')]);_0x364630[_0xe049('0x2e')]=_['intersection'](_0xb64700[_0xe049('0x2a')],qs[_0xe049('0x2f')](_0x5adcd6[_0xe049('0x2d')][_0xe049('0x2f')]));_0x364630[_0xe049('0x2e')]=_0x364630['attributes'][_0xe049('0x30')]?_0x364630['attributes']:_0xb64700[_0xe049('0x2a')];if(!_0x5adcd6['query'][_0xe049('0x31')](_0xe049('0x32'))){_0x364630[_0xe049('0x33')]=qs[_0xe049('0x33')](_0x5adcd6[_0xe049('0x2d')][_0xe049('0x33')]);_0x364630[_0xe049('0x1a')]=qs[_0xe049('0x1a')](_0x5adcd6[_0xe049('0x2d')][_0xe049('0x1a')]);}_0x364630[_0xe049('0x34')]=qs['sort'](_0x5adcd6[_0xe049('0x2d')][_0xe049('0x35')]);_0x364630[_0xe049('0x36')]=qs[_0xe049('0x2b')](_[_0xe049('0x37')](_0x5adcd6[_0xe049('0x2d')],_0xb64700[_0xe049('0x2b')]),_0x4464b2);if(_0x5adcd6[_0xe049('0x2d')]['filter']){_0x364630[_0xe049('0x36')]=_[_0xe049('0x38')](_0x364630[_0xe049('0x36')],{'$or':_[_0xe049('0x25')](_0x4464b2,function(_0x5e9613){if(_0x5e9613[_0xe049('0x29')]!==_0xe049('0x39')){var _0x3963e6={};_0x3963e6[_0x5e9613[_0xe049('0x22')]]={'$like':'%'+_0x5adcd6[_0xe049('0x2d')]['filter']+'%'};return _0x3963e6;}})});}_0x364630=_[_0xe049('0x38')]({},_0x364630,_0x5adcd6[_0xe049('0x3a')]);var _0x21f6e6={'where':_0x364630['where']};return db[_0xe049('0x26')]['count'](_0x21f6e6)['then'](function(_0x19dbc4){_0x33353d['count']=_0x19dbc4;if(_0x5adcd6[_0xe049('0x2d')][_0xe049('0x3b')]){_0x364630[_0xe049('0x3c')]=[{'all':!![]}];}return db[_0xe049('0x26')][_0xe049('0x3d')](_0x364630);})['then'](function(_0x4261da){_0x33353d[_0xe049('0x3e')]=_0x4261da;return _0x33353d;})['then'](respondWithFilteredResult(_0x432a6e,_0x364630))['catch'](handleError(_0x432a6e,null));};exports[_0xe049('0x3f')]=function(_0x20d264,_0x482072){var _0x215eea={'raw':![],'where':{'id':_0x20d264[_0xe049('0x40')]['id']}},_0x82e245={};_0x82e245['model']=_[_0xe049('0x41')](db[_0xe049('0x26')]['rawAttributes']);_0x82e245[_0xe049('0x2d')]=_[_0xe049('0x41')](_0x20d264[_0xe049('0x2d')]);_0x82e245[_0xe049('0x2b')]=_[_0xe049('0x2c')](_0x82e245['model'],_0x82e245['query']);_0x215eea[_0xe049('0x2e')]=_[_0xe049('0x2c')](_0x82e245[_0xe049('0x2a')],qs[_0xe049('0x2f')](_0x20d264[_0xe049('0x2d')][_0xe049('0x2f')]));_0x215eea['attributes']=_0x215eea[_0xe049('0x2e')][_0xe049('0x30')]?_0x215eea['attributes']:_0x82e245[_0xe049('0x2a')];if(_0x20d264['query'][_0xe049('0x3b')]){_0x215eea['include']=[{'all':!![]}];}_0x215eea=_[_0xe049('0x38')]({},_0x215eea,_0x20d264['options']);return db[_0xe049('0x26')][_0xe049('0x42')](_0x215eea)[_0xe049('0x1f')](handleEntityNotFound(_0x482072,null))[_0xe049('0x1f')](respondWithResult(_0x482072,null))[_0xe049('0x43')](handleError(_0x482072,null));};exports['create']=function(_0x210a1c,_0x2310ff){return db[_0xe049('0x26')][_0xe049('0x44')](_0x210a1c[_0xe049('0x45')],{})[_0xe049('0x1f')](function(_0x12f9b8){var _0x1b94b5=_0x210a1c[_0xe049('0x46')]['get']({'plain':!![]});if(!_0x1b94b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b94b5[_0xe049('0x47')]===_0xe049('0x46')){var _0x32ff60=_0x12f9b8[_0xe049('0x48')]({'plain':!![]});var _0x254dc6=_0xe049('0x49');return db[_0xe049('0x4a')][_0xe049('0x42')]({'where':{'name':_0x254dc6,'userProfileId':_0x1b94b5[_0xe049('0x4b')]},'raw':!![]})[_0xe049('0x1f')](function(_0x451883){if(_0x451883&&_0x451883['autoAssociation']===0x0){return db[_0xe049('0x20')][_0xe049('0x44')]({'name':_0x32ff60[_0xe049('0x22')],'resourceId':_0x32ff60['id'],'type':_0xe049('0x4c'),'sectionId':_0x451883['id']},{})[_0xe049('0x1f')](function(){return _0x12f9b8;});}else{return _0x12f9b8;}})[_0xe049('0x43')](function(_0x373a49){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x373a49);throw _0x373a49;});}return _0x12f9b8;})['then'](respondWithResult(_0x2310ff,0xc9))[_0xe049('0x43')](handleError(_0x2310ff,null));};exports[_0xe049('0x1e')]=function(_0x47f0c5,_0x2e361b){if(_0x47f0c5[_0xe049('0x45')]['id']){delete _0x47f0c5[_0xe049('0x45')]['id'];}return db[_0xe049('0x26')]['find']({'where':{'id':_0x47f0c5['params']['id']}})[_0xe049('0x1f')](handleEntityNotFound(_0x2e361b,null))[_0xe049('0x1f')](saveUpdates(_0x47f0c5['body'],null))['then'](respondWithResult(_0x2e361b,null))[_0xe049('0x43')](handleError(_0x2e361b,null));};exports['destroy']=function(_0x3ef1fa,_0x2a1e06){return db['AnalyticCustomReport'][_0xe049('0x42')]({'where':{'id':_0x3ef1fa['params']['id']}})[_0xe049('0x1f')](handleEntityNotFound(_0x2a1e06,null))[_0xe049('0x1f')](removeEntity(_0x2a1e06,null))['catch'](handleError(_0x2a1e06,null));};exports[_0xe049('0x4d')]=function(_0x3508f8,_0x21c0dc){var _0x439be7=0xa;var _0x421d54=[_0xe049('0x4e'),_0xe049('0x4f'),_0xe049('0x50'),_0xe049('0x51')];var _0x35f367={'SUM':'SUM(%s)','COUNT':_0xe049('0x52'),'COUNT DISTINCT':_0xe049('0x53'),'MAX':_0xe049('0x54'),'MIN':'MIN(%s)','AVG':_0xe049('0x55'),'GROUP_CONCAT':_0xe049('0x56'),'GROUP_CONCAT ASC':_0xe049('0x57'),'GROUP_CONCAT DESC':_0xe049('0x58')};var _0x1840b6={'SEC_TO_TIME':_0xe049('0x59'),'DATE':_0xe049('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0xe049('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x440b63=function(_0x51f90a){return!_[_0xe049('0x5c')]([_0xe049('0x5d'),_0xe049('0x5e'),_0xe049('0x5f'),_0xe049('0x60')],_0x51f90a);};var _0x4af8a3=function(_0x329a6d){if(!_0x329a6d||!_0x329a6d[_0xe049('0x61')][_0xe049('0x30')]){return'';}for(var _0xad43b0='(',_0x190bd4=0x0;_0x190bd4<_0x329a6d[_0xe049('0x61')][_0xe049('0x30')];_0x190bd4+=0x1){_0x190bd4>0x0&&(_0xad43b0+='\x20'+_0x329a6d[_0xe049('0x62')]+'\x20');_0xad43b0+=_0x329a6d['rules'][_0x190bd4]['group']?_0x4af8a3(_0x329a6d[_0xe049('0x61')][_0x190bd4][_0xe049('0x63')]):_0x329a6d['rules'][_0x190bd4][_0xe049('0x64')]+'\x20'+_0x329a6d[_0xe049('0x61')][_0x190bd4][_0xe049('0x65')]+(_0x440b63(_0x329a6d[_0xe049('0x61')][_0x190bd4]['condition'])?'\x20'+_0x329a6d['rules'][_0x190bd4][_0xe049('0x66')]:'');}return _0xad43b0+')';};var _0x57290e={'where':{'id':_0x3508f8[_0xe049('0x40')]['id']}},_0x4386c5,_0x3cfaf6,_0x3c61f8,_0x1a109a,_0x1ffabc;_0x57290e=_[_0xe049('0x38')]({},_0x57290e,_0x3508f8[_0xe049('0x3a')]);return db['AnalyticCustomReport'][_0xe049('0x42')](_0x57290e)[_0xe049('0x1f')](function(_0x334522){if(_0x334522){_0x4386c5=_0x334522;return _0x334522[_0xe049('0x67')]();}return null;})[_0xe049('0x1f')](function(_0x5496c9){if(_0x5496c9){if(!_0x5496c9[_0xe049('0x30')]){throw new db[(_0xe049('0x68'))][(_0xe049('0x69'))](_0xe049('0x6a'),0x193);}_0x3cfaf6=_0x5496c9;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xe049('0x1f')](function(_0xde9419){if(_0xde9419){_0x3c61f8=_[_0xe049('0x6b')](_0xde9419,'id');var _0x51678c;var _0x35f98f=squel[_0xe049('0x6c')]();_0x35f98f[_0xe049('0x6d')](_0x4386c5[_0xe049('0x6e')]);for(var _0x3227d3=0x0;_0x3227d3<_0x3cfaf6[_0xe049('0x30')];_0x3227d3+=0x1){_0x51678c=_0x3cfaf6[_0x3227d3][_0xe049('0x6f')]?_0x3c61f8[_0x3cfaf6[_0x3227d3][_0xe049('0x6f')]][_0xe049('0x70')]:_0x3cfaf6[_0x3227d3][_0xe049('0x64')];_0x51678c=_0x3cfaf6[_0x3227d3][_0xe049('0x71')]?_[_0xe049('0x72')](_0x35f367[_0x3cfaf6[_0x3227d3]['function']],'%s',_0x51678c):_0x51678c;_0x51678c=_0x3cfaf6[_0x3227d3]['format']?_[_0xe049('0x72')](_0x1840b6[_0x3cfaf6[_0x3227d3][_0xe049('0x73')]],'%s',_0x51678c):_0x51678c;if(_0x3cfaf6[_0x3227d3][_0xe049('0x74')]){_0x35f98f['group'](_0x51678c);}_0x3cfaf6[_0x3227d3][_0xe049('0x75')]&&_0x35f98f[_0xe049('0x34')](_0x51678c,_0x3cfaf6[_0x3227d3]['orderBy']===_0xe049('0x76')?![]:!![]);_0x35f98f[_0xe049('0x64')](_0x51678c,_0x3cfaf6[_0x3227d3]['alias']||_0x51678c);}if(_0x4386c5[_0xe049('0x77')]){_0x4386c5[_0xe049('0x77')]=JSON[_0xe049('0x78')](_0x4386c5[_0xe049('0x77')]);for(var _0xf95e5c=0x0;_0xf95e5c<_0x4386c5[_0xe049('0x77')][_0xe049('0x30')];_0xf95e5c+=0x1){if(_0x4386c5[_0xe049('0x77')][_0xf95e5c][_0xe049('0x29')]&&_[_0xe049('0x5c')](_0x421d54,_0x4386c5[_0xe049('0x77')][_0xf95e5c][_0xe049('0x29')])&&_0x4386c5[_0xe049('0x77')][_0xf95e5c]['parentKey']&&_0x4386c5[_0xe049('0x77')][_0xf95e5c]['foreignTable']&&_0x4386c5['joins'][_0xf95e5c][_0xe049('0x79')]){_0x35f98f[_0x4386c5[_0xe049('0x77')][_0xf95e5c][_0xe049('0x29')]](_0x4386c5['joins'][_0xf95e5c][_0xe049('0x7a')],null,util['format'](_0xe049('0x7b'),_0x4386c5['table'],_0x4386c5[_0xe049('0x77')][_0xf95e5c][_0xe049('0x7c')],_0x4386c5[_0xe049('0x77')][_0xf95e5c][_0xe049('0x7a')],_0x4386c5[_0xe049('0x77')][_0xf95e5c][_0xe049('0x79')]));}}}if(_0x4386c5[_0xe049('0x7d')]){_0x4386c5[_0xe049('0x7d')]=JSON['parse'](_0x4386c5['conditions']);_0x35f98f[_0xe049('0x36')](_0x4af8a3(_0x4386c5[_0xe049('0x7d')][_0xe049('0x63')]));}_0x1ffabc=_0x35f98f[_0xe049('0x7e')]();_0x35f98f[_0xe049('0x33')](_0x439be7);_0x35f98f[_0xe049('0x1a')](0x0);logger['debug'](_0xe049('0x7f'),_0x35f98f['toString']());return db['sequelize'][_0xe049('0x2d')](_0x35f98f[_0xe049('0x80')](),{'type':db[_0xe049('0x81')]['QueryTypes'][_0xe049('0x82')]});}})['then'](respondWithResult(_0x21c0dc,null))['catch'](handleError(_0x21c0dc,null));};function runReport(_0x36d52b,_0x7f31d7,_0x3f11a7){var _0x5c2340=_0x7f31d7['name'];var _0x287fc8=0xa;var _0xb12f8e=['join',_0xe049('0x4f'),_0xe049('0x50'),_0xe049('0x51')];var _0x328c13={'SUM':'SUM(%s)','COUNT':_0xe049('0x52'),'COUNT DISTINCT':_0xe049('0x53'),'MAX':_0xe049('0x54'),'MIN':'MIN(%s)','AVG':_0xe049('0x55'),'GROUP_CONCAT':_0xe049('0x56'),'GROUP_CONCAT ASC':_0xe049('0x57'),'GROUP_CONCAT DESC':_0xe049('0x58')};var _0x5dc69b={'SEC_TO_TIME':_0xe049('0x59'),'DATE':_0xe049('0x5a'),'HOUR':_0xe049('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe049('0x84')};var _0x9aa9d0=function(_0x5afbd0){return!_[_0xe049('0x5c')]([_0xe049('0x5d'),'IS\x20NOT\x20NULL',_0xe049('0x5f'),_0xe049('0x60')],_0x5afbd0);};var _0x1950ae=function(_0x37ca72){if(!_0x37ca72||!_0x37ca72[_0xe049('0x61')][_0xe049('0x30')]){return'';}for(var _0x142105='(',_0x5746ff=0x0;_0x5746ff<_0x37ca72['rules']['length'];_0x5746ff+=0x1){_0x5746ff>0x0&&(_0x142105+='\x20'+_0x37ca72[_0xe049('0x62')]+'\x20');_0x142105+=_0x37ca72['rules'][_0x5746ff][_0xe049('0x63')]?_0x1950ae(_0x37ca72[_0xe049('0x61')][_0x5746ff][_0xe049('0x63')]):_0x37ca72[_0xe049('0x61')][_0x5746ff][_0xe049('0x64')]+'\x20'+_0x37ca72[_0xe049('0x61')][_0x5746ff][_0xe049('0x65')]+(_0x9aa9d0(_0x37ca72['rules'][_0x5746ff]['condition'])?'\x20'+_0x37ca72[_0xe049('0x61')][_0x5746ff][_0xe049('0x66')]:'');}return _0x142105+')';};var _0x5c1322={'where':{'id':_0x36d52b['id']}},_0x4c1a59,_0x221836,_0x4e2ebf,_0x51324d,_0x328318;_0x5c1322=_[_0xe049('0x38')]({},_0x5c1322,_0x3f11a7);return db[_0xe049('0x26')][_0xe049('0x42')](_0x5c1322)[_0xe049('0x1f')](function(_0x4475c4){if(_0x4475c4){_0x4c1a59=_0x4475c4;return _0x4475c4['getFields']();}return null;})[_0xe049('0x1f')](function(_0x112dc4){if(_0x112dc4){if(!_0x112dc4[_0xe049('0x30')]){throw new db['Sequelize']['ValidationErrorItem'](_0xe049('0x6a'),0x193);}_0x221836=_0x112dc4;return db[_0xe049('0x85')][_0xe049('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x97af2c){if(_0x97af2c){_0x4e2ebf=_[_0xe049('0x6b')](_0x97af2c,'id');var _0x1e733b;var _0x1b60de=squel[_0xe049('0x6c')]();_0x1b60de[_0xe049('0x6d')](_0x4c1a59[_0xe049('0x6e')]);for(var _0x2090aa=0x0;_0x2090aa<_0x221836['length'];_0x2090aa+=0x1){_0x1e733b=_0x221836[_0x2090aa][_0xe049('0x6f')]?_0x4e2ebf[_0x221836[_0x2090aa][_0xe049('0x6f')]][_0xe049('0x70')]:_0x221836[_0x2090aa][_0xe049('0x64')];_0x1e733b=_0x221836[_0x2090aa][_0xe049('0x71')]?_[_0xe049('0x72')](_0x328c13[_0x221836[_0x2090aa][_0xe049('0x71')]],'%s',_0x1e733b):_0x1e733b;_0x1e733b=_0x221836[_0x2090aa][_0xe049('0x73')]?_[_0xe049('0x72')](_0x5dc69b[_0x221836[_0x2090aa][_0xe049('0x73')]],'%s',_0x1e733b):_0x1e733b;if(_0x221836[_0x2090aa]['groupBy']){_0x1b60de['group'](_0x1e733b);}_0x221836[_0x2090aa]['orderBy']&&_0x1b60de['order'](_0x1e733b,_0x221836[_0x2090aa][_0xe049('0x75')]==='DESC'?![]:!![]);_0x1b60de['field'](_0x1e733b,_0x221836[_0x2090aa][_0xe049('0x86')]||_0x1e733b);}if(_0x4c1a59['joins']){_0x4c1a59['joins']=JSON[_0xe049('0x78')](_0x4c1a59[_0xe049('0x77')]);for(var _0x47d39e=0x0;_0x47d39e<_0x4c1a59[_0xe049('0x77')][_0xe049('0x30')];_0x47d39e+=0x1){if(_0x4c1a59[_0xe049('0x77')][_0x47d39e]['type']&&_[_0xe049('0x5c')](_0xb12f8e,_0x4c1a59[_0xe049('0x77')][_0x47d39e]['type'])&&_0x4c1a59[_0xe049('0x77')][_0x47d39e][_0xe049('0x7c')]&&_0x4c1a59[_0xe049('0x77')][_0x47d39e][_0xe049('0x7a')]&&_0x4c1a59[_0xe049('0x77')][_0x47d39e][_0xe049('0x79')]){_0x1b60de[_0x4c1a59[_0xe049('0x77')][_0x47d39e][_0xe049('0x29')]](_0x4c1a59[_0xe049('0x77')][_0x47d39e][_0xe049('0x7a')],null,util[_0xe049('0x73')](_0xe049('0x7b'),_0x4c1a59[_0xe049('0x6e')],_0x4c1a59[_0xe049('0x77')][_0x47d39e]['parentKey'],_0x4c1a59['joins'][_0x47d39e]['foreignTable'],_0x4c1a59[_0xe049('0x77')][_0x47d39e]['foreignKey']));}}}if(_0x4c1a59[_0xe049('0x7d')]){_0x4c1a59['conditions']=JSON[_0xe049('0x78')](_0x4c1a59[_0xe049('0x7d')]);_0x1b60de['where'](_0x1950ae(_0x4c1a59[_0xe049('0x7d')][_0xe049('0x63')]));}_0x328318=_0x1b60de['clone']();_0x1b60de[_0xe049('0x33')](_0x287fc8);_0x1b60de['offset'](0x0);logger[_0xe049('0x87')](_0xe049('0x7f'),_0x1b60de[_0xe049('0x80')]());return db[_0xe049('0x81')]['query'](_0x1b60de[_0xe049('0x80')](),{'type':db['sequelize']['QueryTypes']['SELECT']});}})[_0xe049('0x1f')](function(_0x300fe7){if(!_0x300fe7[_0xe049('0x30')]){throw new db[(_0xe049('0x68'))][(_0xe049('0x69'))](_0xe049('0x88'),0xcc);}if(_0x7f31d7[_0xe049('0x89')]==='web'){return null;}var _0xfee72d=_['merge'](_0x7f31d7,{'name':_0x7f31d7[_0xe049('0x8a')]||_0x7f31d7['name']||_0x4c1a59[_0xe049('0x22')],'basename':_0x5c2340,'savename':util[_0xe049('0x73')]('%s-%s.%s',_0x7f31d7[_0xe049('0x22')]||_0x4c1a59[_0xe049('0x22')],require(_0xe049('0x8b'))[_0xe049('0x8c')](0x4),_0x7f31d7[_0xe049('0x89')]||_0xe049('0x8d')),'reportId':_0x4c1a59['id'],'reportType':_0xe049('0x8e')});return db['AnalyticExtractedReport'][_0xe049('0x44')](_0xfee72d,{'raw':!![]});})['then'](function(_0x3008f5){if(_0x4c1a59[_0xe049('0x6e')]==='cdr'){_0x328318[_0xe049('0x36')](_0x4c1a59[_0xe049('0x6e')]+_0xe049('0x8f'),_0x7f31d7[_0xe049('0x90')],_0x7f31d7[_0xe049('0x91')]);}else{_0x328318['where'](_0x4c1a59[_0xe049('0x6e')]+_0xe049('0x92'),_0x7f31d7[_0xe049('0x90')],_0x7f31d7[_0xe049('0x91')]);}if(_0x3008f5){logger[_0xe049('0x93')](_0xe049('0x94'),_0x328318[_0xe049('0x80')]());require(_0xe049('0x95'))[_0xe049('0x96')](path[_0xe049('0x4e')](__dirname,_0xe049('0x97'),_0x3008f5[_0xe049('0x89')]),[_0x3008f5['id'],_0x328318[_0xe049('0x80')](),path[_0xe049('0x4e')](__dirname,'../../files/reports',_0x3008f5['savename']),_0x5c2340]);return _0x3008f5;}else{var _0x185144=squel[_0xe049('0x6c')]();_0x185144[_0xe049('0x6d')]('('+_0x328318['toString']()+')','countTable');_0x185144[_0xe049('0x64')](_0xe049('0x98'),_0xe049('0x99'));_0x328318[_0xe049('0x33')](_0x7f31d7[_0xe049('0x33')]||_0x287fc8);_0x328318[_0xe049('0x1a')](_0x7f31d7[_0xe049('0x1a')]||0x0);return dbH[_0xe049('0x81')][_0xe049('0x2d')](_0x185144['toString'](),{'type':dbH[_0xe049('0x81')][_0xe049('0x9a')][_0xe049('0x82')]})['then'](function(_0x4ffe16){if(!_0x4ffe16['length']){_0x51324d=0x0;}else{_0x51324d=_0x4ffe16[0x0]['count']||0x0;}return dbH[_0xe049('0x81')][_0xe049('0x2d')](_0x328318['toString'](),{'type':dbH[_0xe049('0x81')][_0xe049('0x9a')][_0xe049('0x82')]});})[_0xe049('0x1f')](function(_0x19b8d7){return{'rows':_0x19b8d7||[],'count':_0x51324d};});}});}exports['run']=function(_0x49dbd7,_0x4d8a25){return runReport(_0x49dbd7[_0xe049('0x40')],_0x49dbd7['query'],_0x49dbd7[_0xe049('0x3a')])[_0xe049('0x1f')](respondWithResult(_0x4d8a25,null))[_0xe049('0x43')](handleError(_0x4d8a25,null));};exports[_0xe049('0x9b')]=runReport;exports[_0xe049('0x2d')]=function(_0x369598,_0x224fba){var _0xf8ff=0xa;var _0x1ffb01=[_0xe049('0x4e'),_0xe049('0x4f'),_0xe049('0x50'),_0xe049('0x51')];var _0x2509f5={'SUM':_0xe049('0x9c'),'COUNT':_0xe049('0x52'),'COUNT DISTINCT':_0xe049('0x53'),'MAX':'MAX(%s)','MIN':_0xe049('0x9d'),'AVG':_0xe049('0x55'),'GROUP_CONCAT':_0xe049('0x56'),'GROUP_CONCAT ASC':_0xe049('0x57'),'GROUP_CONCAT DESC':_0xe049('0x58')};var _0x14d545={'SEC_TO_TIME':_0xe049('0x59'),'DATE':_0xe049('0x5a'),'HOUR':_0xe049('0x83'),'ROUND':_0xe049('0x5b'),'UNIX_TIMESTAMP':_0xe049('0x84')};var _0x507bdc=function(_0x4ef9f5){return!_[_0xe049('0x5c')]([_0xe049('0x5d'),'IS\x20NOT\x20NULL',_0xe049('0x5f'),'IS\x20NOT\x20EMPTY'],_0x4ef9f5);};var _0x32ecdd=function(_0x5e4a2a){if(!_0x5e4a2a||!_0x5e4a2a[_0xe049('0x61')]['length']){return'';}for(var _0x391b44='(',_0x55a8fe=0x0;_0x55a8fe<_0x5e4a2a['rules'][_0xe049('0x30')];_0x55a8fe+=0x1){_0x55a8fe>0x0&&(_0x391b44+='\x20'+_0x5e4a2a['operator']+'\x20');_0x391b44+=_0x5e4a2a[_0xe049('0x61')][_0x55a8fe][_0xe049('0x63')]?_0x32ecdd(_0x5e4a2a[_0xe049('0x61')][_0x55a8fe][_0xe049('0x63')]):_0x5e4a2a['rules'][_0x55a8fe][_0xe049('0x64')]+'\x20'+_0x5e4a2a[_0xe049('0x61')][_0x55a8fe][_0xe049('0x65')]+(_0x507bdc(_0x5e4a2a[_0xe049('0x61')][_0x55a8fe][_0xe049('0x65')])?'\x20'+_0x5e4a2a[_0xe049('0x61')][_0x55a8fe]['value']:'');}return _0x391b44+')';};var _0x4344fb={'where':{'id':_0x369598[_0xe049('0x40')]['id']}},_0xaa7e8d,_0x3d7a5f,_0x756119,_0x52a94b,_0x17e0b6;_0x4344fb=_['merge']({},_0x4344fb,_0x369598[_0xe049('0x3a')]);return db[_0xe049('0x26')]['find'](_0x4344fb)[_0xe049('0x1f')](function(_0x1613c9){if(_0x1613c9){_0xaa7e8d=_0x1613c9;return _0x1613c9['getFields']();}return null;})[_0xe049('0x1f')](function(_0x1597e1){if(_0x1597e1){if(!_0x1597e1['length']){throw new db[(_0xe049('0x68'))][(_0xe049('0x69'))](_0xe049('0x6a'),0x193);}_0x3d7a5f=_0x1597e1;return db[_0xe049('0x85')][_0xe049('0x3d')]({'raw':!![]});}return null;})[_0xe049('0x1f')](function(_0x470888){if(_0x470888){_0x756119=_[_0xe049('0x6b')](_0x470888,'id');var _0x5e99ab;var _0x142cdb=squel['select']();_0x142cdb[_0xe049('0x6d')](_0xaa7e8d[_0xe049('0x6e')]);for(var _0x4049bd=0x0;_0x4049bd<_0x3d7a5f[_0xe049('0x30')];_0x4049bd+=0x1){_0x5e99ab=_0x3d7a5f[_0x4049bd][_0xe049('0x6f')]?_0x756119[_0x3d7a5f[_0x4049bd][_0xe049('0x6f')]][_0xe049('0x70')]:_0x3d7a5f[_0x4049bd][_0xe049('0x64')];_0x5e99ab=_0x3d7a5f[_0x4049bd]['function']?_['replace'](_0x2509f5[_0x3d7a5f[_0x4049bd][_0xe049('0x71')]],'%s',_0x5e99ab):_0x5e99ab;_0x5e99ab=_0x3d7a5f[_0x4049bd]['format']?_['replace'](_0x14d545[_0x3d7a5f[_0x4049bd][_0xe049('0x73')]],'%s',_0x5e99ab):_0x5e99ab;if(_0x3d7a5f[_0x4049bd]['groupBy']){_0x142cdb['group'](_0x5e99ab);}_0x3d7a5f[_0x4049bd]['orderBy']&&_0x142cdb[_0xe049('0x34')](_0x5e99ab,_0x3d7a5f[_0x4049bd][_0xe049('0x75')]===_0xe049('0x76')?![]:!![]);_0x142cdb[_0xe049('0x64')](_0x5e99ab,_0x3d7a5f[_0x4049bd][_0xe049('0x86')]||_0x5e99ab);}if(_0xaa7e8d[_0xe049('0x77')]){_0xaa7e8d['joins']=JSON[_0xe049('0x78')](_0xaa7e8d[_0xe049('0x77')]);for(var _0x1dd2e9=0x0;_0x1dd2e9<_0xaa7e8d[_0xe049('0x77')][_0xe049('0x30')];_0x1dd2e9+=0x1){if(_0xaa7e8d[_0xe049('0x77')][_0x1dd2e9][_0xe049('0x29')]&&_[_0xe049('0x5c')](_0x1ffb01,_0xaa7e8d['joins'][_0x1dd2e9][_0xe049('0x29')])&&_0xaa7e8d[_0xe049('0x77')][_0x1dd2e9][_0xe049('0x7c')]&&_0xaa7e8d[_0xe049('0x77')][_0x1dd2e9][_0xe049('0x7a')]&&_0xaa7e8d[_0xe049('0x77')][_0x1dd2e9][_0xe049('0x79')]){_0x142cdb[_0xaa7e8d[_0xe049('0x77')][_0x1dd2e9][_0xe049('0x29')]](_0xaa7e8d[_0xe049('0x77')][_0x1dd2e9]['foreignTable'],null,util[_0xe049('0x73')](_0xe049('0x7b'),_0xaa7e8d[_0xe049('0x6e')],_0xaa7e8d[_0xe049('0x77')][_0x1dd2e9][_0xe049('0x7c')],_0xaa7e8d[_0xe049('0x77')][_0x1dd2e9]['foreignTable'],_0xaa7e8d[_0xe049('0x77')][_0x1dd2e9]['foreignKey']));}}}if(_0xaa7e8d[_0xe049('0x7d')]){_0xaa7e8d[_0xe049('0x7d')]=JSON[_0xe049('0x78')](_0xaa7e8d[_0xe049('0x7d')]);_0x142cdb[_0xe049('0x36')](_0x32ecdd(_0xaa7e8d[_0xe049('0x7d')][_0xe049('0x63')]));}_0x17e0b6=_0x142cdb[_0xe049('0x7e')]();_0x142cdb[_0xe049('0x33')](_0xf8ff);_0x142cdb[_0xe049('0x1a')](0x0);logger[_0xe049('0x87')]('Limited\x20Query:',_0x142cdb['toString']());return db[_0xe049('0x81')][_0xe049('0x2d')](_0x142cdb['toString'](),{'type':db['sequelize'][_0xe049('0x9a')][_0xe049('0x82')]});}})['then'](function(){return{'sql':_0x17e0b6['toString']()};})['then'](respondWithResult(_0x224fba,null))[_0xe049('0x43')](handleError(_0x224fba,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a2d4832..fdcfef3 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 _0x6962=['path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util','api','moment','bluebird'];(function(_0x4e1a35,_0x4e13d7){var _0x582820=function(_0x4c06a6){while(--_0x4c06a6){_0x4e1a35['push'](_0x4e1a35['shift']());}};_0x582820(++_0x4e13d7);}(_0x6962,0x73));var _0x2696=function(_0x54c878,_0x45156c){_0x54c878=_0x54c878-0x0;var _0x4494f7=_0x6962[_0x54c878];return _0x4494f7;};'use strict';var _=require(_0x2696('0x0'));var util=require(_0x2696('0x1'));var logger=require('../../config/logger')(_0x2696('0x2'));var moment=require(_0x2696('0x3'));var BPromise=require(_0x2696('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2696('0x5'));var rimraf=require(_0x2696('0x6'));var config=require(_0x2696('0x7'));var attributes=require(_0x2696('0x8'));module[_0x2696('0x9')]=function(_0x562bc9,_0x3b7a58){return _0x562bc9[_0x2696('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x2696('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fef=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x3de8af,_0x422dea){var _0x34b286=function(_0x3785e2){while(--_0x3785e2){_0x3de8af['push'](_0x3de8af['shift']());}};_0x34b286(++_0x422dea);}(_0x2fef,0x1a3));var _0xf2fe=function(_0x4fab1e,_0x34b507){_0x4fab1e=_0x4fab1e-0x0;var _0x59bf51=_0x2fef[_0x4fab1e];return _0x59bf51;};'use strict';var _=require(_0xf2fe('0x0'));var util=require(_0xf2fe('0x1'));var logger=require(_0xf2fe('0x2'))(_0xf2fe('0x3'));var moment=require(_0xf2fe('0x4'));var BPromise=require('bluebird');var rp=require(_0xf2fe('0x5'));var fs=require('fs');var path=require(_0xf2fe('0x6'));var rimraf=require('rimraf');var config=require(_0xf2fe('0x7'));var attributes=require(_0xf2fe('0x8'));module[_0xf2fe('0x9')]=function(_0x5c8301,_0x28bd5d){return _0x5c8301[_0xf2fe('0xa')](_0xf2fe('0xb'),attributes,{'tableName':_0xf2fe('0xc'),'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 5e93f9a..b4c2bed 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 _0xfc71=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x131390,_0xd0846e){var _0x550870=function(_0x13e841){while(--_0x13e841){_0x131390['push'](_0x131390['shift']());}};_0x550870(++_0xd0846e);}(_0xfc71,0x8b));var _0x1fc7=function(_0x9647da,_0x1f7117){_0x9647da=_0x9647da-0x0;var _0x25c414=_0xfc71[_0x9647da];return _0x25c414;};'use strict';var _=require(_0x1fc7('0x0'));var util=require(_0x1fc7('0x1'));var moment=require('moment');var BPromise=require(_0x1fc7('0x2'));var rs=require(_0x1fc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1fc7('0x4'))['db'];var utils=require(_0x1fc7('0x5'));var logger=require(_0x1fc7('0x6'))(_0x1fc7('0x7'));var config=require(_0x1fc7('0x8'));var jayson=require(_0x1fc7('0x9'));var client=jayson[_0x1fc7('0xa')][_0x1fc7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44e66b,_0x30c189,_0x3914e4){return new BPromise(function(_0x14a468,_0x4def10){return client[_0x1fc7('0xc')](_0x44e66b,_0x3914e4)[_0x1fc7('0xd')](function(_0x3a276d){logger[_0x1fc7('0xe')](_0x1fc7('0xf'),_0x30c189,_0x1fc7('0x10'));logger[_0x1fc7('0x11')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x30c189,_0x1fc7('0x10'),JSON[_0x1fc7('0x12')](_0x3a276d));if(_0x3a276d[_0x1fc7('0x13')]){if(_0x3a276d['error'][_0x1fc7('0x14')]===0x1f4){logger[_0x1fc7('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x30c189,_0x3a276d[_0x1fc7('0x13')][_0x1fc7('0x15')]);return _0x4def10(_0x3a276d[_0x1fc7('0x13')][_0x1fc7('0x15')]);}logger['error'](_0x1fc7('0xf'),_0x30c189,_0x3a276d[_0x1fc7('0x13')][_0x1fc7('0x15')]);return _0x14a468(_0x3a276d['error']['message']);}else{logger[_0x1fc7('0xe')](_0x1fc7('0xf'),_0x30c189,_0x1fc7('0x10'));_0x14a468(_0x3a276d['result'][_0x1fc7('0x15')]);}})[_0x1fc7('0x16')](function(_0x54e29c){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x30c189,_0x54e29c);_0x4def10(_0x54e29c);});});} \ No newline at end of file +var _0x5e87=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0x5e87,0x119));var _0x75e8=function(_0x1646af,_0x411b04){_0x1646af=_0x1646af-0x0;var _0x5c9714=_0x5e87[_0x1646af];return _0x5c9714;};'use strict';var _=require(_0x75e8('0x0'));var util=require('util');var moment=require(_0x75e8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75e8('0x2'));var db=require(_0x75e8('0x3'))['db'];var utils=require(_0x75e8('0x4'));var logger=require(_0x75e8('0x5'))('rpc');var config=require(_0x75e8('0x6'));var jayson=require(_0x75e8('0x7'));var client=jayson['client'][_0x75e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x458aad,_0x4f98d5,_0x5792ac){return new BPromise(function(_0x3857ca,_0x54577c){return client[_0x75e8('0x9')](_0x458aad,_0x5792ac)[_0x75e8('0xa')](function(_0x55ede3){logger[_0x75e8('0xb')](_0x75e8('0xc'),_0x4f98d5,_0x75e8('0xd'));logger[_0x75e8('0xe')](_0x75e8('0xf'),_0x4f98d5,'request\x20sent',JSON[_0x75e8('0x10')](_0x55ede3));if(_0x55ede3[_0x75e8('0x11')]){if(_0x55ede3[_0x75e8('0x11')][_0x75e8('0x12')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4f98d5,_0x55ede3[_0x75e8('0x11')][_0x75e8('0x13')]);return _0x54577c(_0x55ede3['error'][_0x75e8('0x13')]);}logger[_0x75e8('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4f98d5,_0x55ede3[_0x75e8('0x11')][_0x75e8('0x13')]);return _0x3857ca(_0x55ede3[_0x75e8('0x11')][_0x75e8('0x13')]);}else{logger['info'](_0x75e8('0xc'),_0x4f98d5,_0x75e8('0xd'));_0x3857ca(_0x55ede3[_0x75e8('0x14')][_0x75e8('0x13')]);}})[_0x75e8('0x15')](function(_0x161a82){logger[_0x75e8('0x11')](_0x75e8('0xc'),_0x4f98d5,_0x161a82);_0x54577c(_0x161a82);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2405c2d..22b73dd 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 _0xf8ab=['put','/:id','delete','multer','util','path','express','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id/preview','/:id/run','run','query','post','create'];(function(_0xbe0633,_0x1a3590){var _0x14ef18=function(_0x3a84c7){while(--_0x3a84c7){_0xbe0633['push'](_0xbe0633['shift']());}};_0x14ef18(++_0x1a3590);}(_0xf8ab,0x1cb));var _0xbf8a=function(_0x392416,_0x5edecb){_0x392416=_0x392416-0x0;var _0x495907=_0xf8ab[_0x392416];return _0x495907;};'use strict';var multer=require(_0xbf8a('0x0'));var util=require(_0xbf8a('0x1'));var path=require(_0xbf8a('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf8a('0x3'));var router=express['Router']();var auth=require(_0xbf8a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbf8a('0x5'));var controller=require(_0xbf8a('0x6'));router['get']('/',auth[_0xbf8a('0x7')](),controller[_0xbf8a('0x8')]);router[_0xbf8a('0x9')]('/:id',auth[_0xbf8a('0x7')](),controller['show']);router[_0xbf8a('0x9')](_0xbf8a('0xa'),auth[_0xbf8a('0x7')](),controller['preview']);router[_0xbf8a('0x9')](_0xbf8a('0xb'),auth[_0xbf8a('0x7')](),controller[_0xbf8a('0xc')]);router[_0xbf8a('0x9')]('/:id/query',auth['isAuthenticated'](),controller[_0xbf8a('0xd')]);router[_0xbf8a('0xe')]('/',auth[_0xbf8a('0x7')](),controller[_0xbf8a('0xf')]);router[_0xbf8a('0x10')](_0xbf8a('0x11'),auth[_0xbf8a('0x7')](),controller['update']);router[_0xbf8a('0x12')]('/:id',auth[_0xbf8a('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8f25=['query','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/query'];(function(_0x16f0db,_0x149a0d){var _0x1f30ff=function(_0x301c45){while(--_0x301c45){_0x16f0db['push'](_0x16f0db['shift']());}};_0x1f30ff(++_0x149a0d);}(_0x8f25,0x110));var _0x58f2=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x8f25[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x58f2('0x0'));var util=require('util');var path=require(_0x58f2('0x1'));var timeout=require(_0x58f2('0x2'));var express=require(_0x58f2('0x3'));var router=express[_0x58f2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x58f2('0x5'));var config=require(_0x58f2('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x58f2('0x7')]('/',auth[_0x58f2('0x8')](),controller[_0x58f2('0x9')]);router[_0x58f2('0x7')](_0x58f2('0xa'),auth[_0x58f2('0x8')](),controller[_0x58f2('0xb')]);router[_0x58f2('0x7')](_0x58f2('0xc'),auth[_0x58f2('0x8')](),controller['preview']);router[_0x58f2('0x7')]('/:id/run',auth[_0x58f2('0x8')](),controller['run']);router[_0x58f2('0x7')](_0x58f2('0xd'),auth['isAuthenticated'](),controller[_0x58f2('0xe')]);router[_0x58f2('0xf')]('/',auth[_0x58f2('0x8')](),controller[_0x58f2('0x10')]);router[_0x58f2('0x11')](_0x58f2('0xa'),auth['isAuthenticated'](),controller[_0x58f2('0x12')]);router[_0x58f2('0x13')](_0x58f2('0xa'),auth[_0x58f2('0x8')](),controller[_0x58f2('0x14')]);module[_0x58f2('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 f1fb52a..7c27591 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 _0xfa4d=['TEXT','exports','STRING'];(function(_0x57e545,_0x34d6d8){var _0x33fa1e=function(_0x55664e){while(--_0x55664e){_0x57e545['push'](_0x57e545['shift']());}};_0x33fa1e(++_0x34d6d8);}(_0xfa4d,0x64));var _0xdfa4=function(_0x29d643,_0x16adc5){_0x29d643=_0x29d643-0x0;var _0x20fced=_0xfa4d[_0x29d643];return _0x20fced;};'use strict';var Sequelize=require('sequelize');module[_0xdfa4('0x0')]={'name':{'type':Sequelize[_0xdfa4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xdfa4('0x1')]},'parent':{'type':Sequelize[_0xdfa4('0x1')]},'table':{'type':Sequelize[_0xdfa4('0x1')]},'conditions':{'type':Sequelize[_0xdfa4('0x2')]},'joins':{'type':Sequelize[_0xdfa4('0x2')]}}; \ No newline at end of file +var _0xe176=['exports','STRING','TEXT','sequelize'];(function(_0x1ebcce,_0x50bdcf){var _0x36d3b7=function(_0x2a575b){while(--_0x2a575b){_0x1ebcce['push'](_0x1ebcce['shift']());}};_0x36d3b7(++_0x50bdcf);}(_0xe176,0x12b));var _0x6e17=function(_0x3a7490,_0x265112){_0x3a7490=_0x3a7490-0x0;var _0x4209ab=_0xe176[_0x3a7490];return _0x4209ab;};'use strict';var Sequelize=require(_0x6e17('0x0'));module[_0x6e17('0x1')]={'name':{'type':Sequelize[_0x6e17('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6e17('0x2')]},'parent':{'type':Sequelize[_0x6e17('0x2')]},'table':{'type':Sequelize[_0x6e17('0x2')]},'conditions':{'type':Sequelize[_0x6e17('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 8e250ef..49280f6 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 _0x4114=['zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','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','dbH','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','error','name','index','map','AnalyticDefaultReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','findAll','rows','catch','show','params','rawAttributes','includeAll','include','options','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','preview','join','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','Limited\x20Query:','toString','QueryTypes','SELECT','COUNT(%s)','MIN(%s)','SEC_TO_TIME(%s)','ROUND(%s)','DESC','debug','No\x20available\x20data','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','clone','html-pdf','eml-format','rimraf'];(function(_0xccaf5,_0x7c8b40){var _0x293e64=function(_0x1540cf){while(--_0x1540cf){_0xccaf5['push'](_0xccaf5['shift']());}};_0x293e64(++_0x7c8b40);}(_0x4114,0x14b));var _0x4411=function(_0x136a7a,_0x3218f8){_0x136a7a=_0x136a7a-0x0;var _0x5d3632=_0x4114[_0x136a7a];return _0x5d3632;};'use strict';var pdf=require(_0x4411('0x0'));var emlformat=require(_0x4411('0x1'));var rimraf=require(_0x4411('0x2'));var zipdir=require(_0x4411('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4411('0x4'));var moment=require(_0x4411('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4411('0x6'));var util=require('util');var path=require(_0x4411('0x7'));var sox=require(_0x4411('0x8'));var csv=require(_0x4411('0x9'));var ejs=require(_0x4411('0xa'));var fs=require('fs');var _=require(_0x4411('0xb'));var squel=require(_0x4411('0xc'));var crypto=require(_0x4411('0xd'));var jsforce=require(_0x4411('0xe'));var deskjs=require(_0x4411('0xf'));var toCsv=require(_0x4411('0x9'));var querystring=require(_0x4411('0x10'));var Papa=require('papaparse');var Redis=require(_0x4411('0x11'));var authService=require(_0x4411('0x12'));var qs=require(_0x4411('0x13'));var as=require(_0x4411('0x14'));var hardwareService=require(_0x4411('0x15'));var logger=require(_0x4411('0x16'))(_0x4411('0x17'));var utils=require(_0x4411('0x18'));var config=require('../../config/environment');var db=require(_0x4411('0x19'))['db'];var dbH=require(_0x4411('0x19'))[_0x4411('0x1a')];function respondWithStatusCode(_0x1c1984,_0x3ac441){_0x3ac441=_0x3ac441||0xcc;return function(_0x250905){if(_0x250905){return _0x1c1984[_0x4411('0x1b')](_0x3ac441);}return _0x1c1984[_0x4411('0x1c')](_0x3ac441)['end']();};}function respondWithResult(_0x27ab16,_0x248871){_0x248871=_0x248871||0xc8;return function(_0x68756c){if(_0x68756c){return _0x27ab16[_0x4411('0x1c')](_0x248871)[_0x4411('0x1d')](_0x68756c);}};}function respondWithFilteredResult(_0x180343,_0x4788fe){return function(_0x503084){if(_0x503084){var _0x39c6b7=_0x503084[_0x4411('0x1e')],_0x1c45d8=_0x4788fe[_0x4411('0x1f')],_0x253b85=_0x4788fe[_0x4411('0x1f')]+_0x4788fe[_0x4411('0x20')],_0x559b61;if(_0x253b85>=_0x39c6b7){_0x253b85=_0x39c6b7;_0x559b61=0xc8;}else{_0x559b61=0xce;}_0x180343[_0x4411('0x1c')](_0x559b61);return _0x180343[_0x4411('0x21')](_0x4411('0x22'),_0x1c45d8+'-'+_0x253b85+'/'+_0x39c6b7)['json'](_0x503084);}return null;};}function patchUpdates(_0x543d99){return function(_0x220187){try{jsonpatch[_0x4411('0x23')](_0x220187,_0x543d99,!![]);}catch(_0x394575){return BPromise[_0x4411('0x24')](_0x394575);}return _0x220187[_0x4411('0x25')]();};}function saveUpdates(_0x1147eb,_0x1820b3){return function(_0x359dd0){if(_0x359dd0){return _0x359dd0[_0x4411('0x26')](_0x1147eb)[_0x4411('0x27')](function(_0x4bcb0d){return _0x4bcb0d;});}return null;};}function removeEntity(_0x2cf33b,_0x2664a6){return function(_0x29c901){if(_0x29c901){return _0x29c901[_0x4411('0x28')]()[_0x4411('0x27')](function(){var _0x24e5b7=_0x29c901['get']({'plain':!![]});var _0x269191='DefaultReports';return db[_0x4411('0x29')][_0x4411('0x28')]({'where':{'type':_0x269191,'resourceId':_0x24e5b7['id']}})[_0x4411('0x27')](function(){return _0x29c901;});})['then'](function(){_0x2cf33b[_0x4411('0x1c')](0xcc)[_0x4411('0x2a')]();});}};}function handleEntityNotFound(_0x282bc8,_0x313081){return function(_0xdb06ec){if(!_0xdb06ec){_0x282bc8[_0x4411('0x1b')](0x194);}return _0xdb06ec;};}function handleError(_0x1a4a24,_0x3cb533){_0x3cb533=_0x3cb533||0x1f4;return function(_0x10b81c){logger[_0x4411('0x2b')](_0x10b81c['stack']);if(_0x10b81c['name']){delete _0x10b81c[_0x4411('0x2c')];}_0x1a4a24[_0x4411('0x1c')](_0x3cb533)['send'](_0x10b81c);};}exports[_0x4411('0x2d')]=function(_0xe6ba5d,_0x286470){var _0x2515d4={},_0x1181ec={},_0x2a67bb={'count':0x0,'rows':[]};var _0x2a946d=_[_0x4411('0x2e')](db[_0x4411('0x2f')]['rawAttributes'],function(_0x162972){return{'name':_0x162972[_0x4411('0x30')],'type':_0x162972['type'][_0x4411('0x31')]};});_0x1181ec[_0x4411('0x32')]=_['map'](_0x2a946d,'name');_0x1181ec[_0x4411('0x33')]=_[_0x4411('0x34')](_0xe6ba5d[_0x4411('0x33')]);_0x1181ec[_0x4411('0x35')]=_[_0x4411('0x36')](_0x1181ec[_0x4411('0x32')],_0x1181ec['query']);_0x2515d4[_0x4411('0x37')]=_[_0x4411('0x36')](_0x1181ec[_0x4411('0x32')],qs[_0x4411('0x38')](_0xe6ba5d[_0x4411('0x33')][_0x4411('0x38')]));_0x2515d4[_0x4411('0x37')]=_0x2515d4[_0x4411('0x37')][_0x4411('0x39')]?_0x2515d4[_0x4411('0x37')]:_0x1181ec[_0x4411('0x32')];if(!_0xe6ba5d[_0x4411('0x33')][_0x4411('0x3a')](_0x4411('0x3b'))){_0x2515d4[_0x4411('0x20')]=qs[_0x4411('0x20')](_0xe6ba5d['query'][_0x4411('0x20')]);_0x2515d4[_0x4411('0x1f')]=qs['offset'](_0xe6ba5d[_0x4411('0x33')][_0x4411('0x1f')]);}_0x2515d4[_0x4411('0x3c')]=qs[_0x4411('0x3d')](_0xe6ba5d[_0x4411('0x33')][_0x4411('0x3d')]);_0x2515d4[_0x4411('0x3e')]=qs[_0x4411('0x35')](_['pick'](_0xe6ba5d[_0x4411('0x33')],_0x1181ec['filters']),_0x2a946d);if(_0xe6ba5d[_0x4411('0x33')]['filter']){_0x2515d4[_0x4411('0x3e')]=_['merge'](_0x2515d4[_0x4411('0x3e')],{'$or':_['map'](_0x2a946d,function(_0xd1b5d6){if(_0xd1b5d6[_0x4411('0x3f')]!==_0x4411('0x40')){var _0x5090c0={};_0x5090c0[_0xd1b5d6[_0x4411('0x2c')]]={'$like':'%'+_0xe6ba5d[_0x4411('0x33')][_0x4411('0x41')]+'%'};return _0x5090c0;}})});}_0x2515d4=_[_0x4411('0x42')]({},_0x2515d4,_0xe6ba5d['options']);var _0x597a57={'where':_0x2515d4['where']};return db['AnalyticDefaultReport'][_0x4411('0x1e')](_0x597a57)[_0x4411('0x27')](function(_0x445abe){_0x2a67bb[_0x4411('0x1e')]=_0x445abe;if(_0xe6ba5d[_0x4411('0x33')]['includeAll']){_0x2515d4['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x4411('0x43')](_0x2515d4);})[_0x4411('0x27')](function(_0x450f1b){_0x2a67bb[_0x4411('0x44')]=_0x450f1b;return _0x2a67bb;})[_0x4411('0x27')](respondWithFilteredResult(_0x286470,_0x2515d4))[_0x4411('0x45')](handleError(_0x286470,null));};exports[_0x4411('0x46')]=function(_0x54fce3,_0x2e5e53){var _0x525429={'raw':!![],'where':{'id':_0x54fce3[_0x4411('0x47')]['id']}},_0x5ee5ce={};_0x5ee5ce['model']=_[_0x4411('0x34')](db[_0x4411('0x2f')][_0x4411('0x48')]);_0x5ee5ce[_0x4411('0x33')]=_[_0x4411('0x34')](_0x54fce3[_0x4411('0x33')]);_0x5ee5ce['filters']=_[_0x4411('0x36')](_0x5ee5ce[_0x4411('0x32')],_0x5ee5ce[_0x4411('0x33')]);_0x525429['attributes']=_[_0x4411('0x36')](_0x5ee5ce[_0x4411('0x32')],qs['fields'](_0x54fce3['query'][_0x4411('0x38')]));_0x525429[_0x4411('0x37')]=_0x525429[_0x4411('0x37')][_0x4411('0x39')]?_0x525429[_0x4411('0x37')]:_0x5ee5ce[_0x4411('0x32')];if(_0x54fce3[_0x4411('0x33')][_0x4411('0x49')]){_0x525429[_0x4411('0x4a')]=[{'all':!![]}];}_0x525429=_[_0x4411('0x42')]({},_0x525429,_0x54fce3[_0x4411('0x4b')]);return db[_0x4411('0x2f')][_0x4411('0x4c')](_0x525429)[_0x4411('0x27')](handleEntityNotFound(_0x2e5e53,null))[_0x4411('0x27')](respondWithResult(_0x2e5e53,null))['catch'](handleError(_0x2e5e53,null));};exports[_0x4411('0x4d')]=function(_0x1fd5d4,_0xd15aa1){return db[_0x4411('0x2f')]['create'](_0x1fd5d4[_0x4411('0x4e')],{})[_0x4411('0x27')](function(_0x91f05d){var _0x4d7f63=_0x1fd5d4[_0x4411('0x4f')]['get']({'plain':!![]});if(!_0x4d7f63)throw new Error(_0x4411('0x50'));if(_0x4d7f63[_0x4411('0x51')]===_0x4411('0x4f')){var _0xb17afd=_0x91f05d['get']({'plain':!![]});var _0x2cf173='Reports';return db[_0x4411('0x52')][_0x4411('0x4c')]({'where':{'name':_0x2cf173,'userProfileId':_0x4d7f63[_0x4411('0x53')]},'raw':!![]})[_0x4411('0x27')](function(_0x23c530){if(_0x23c530&&_0x23c530[_0x4411('0x54')]===0x0){return db[_0x4411('0x29')][_0x4411('0x4d')]({'name':_0xb17afd[_0x4411('0x2c')],'resourceId':_0xb17afd['id'],'type':'DefaultReports','sectionId':_0x23c530['id']},{})[_0x4411('0x27')](function(){return _0x91f05d;});}else{return _0x91f05d;}})[_0x4411('0x45')](function(_0x425b66){logger['error'](_0x4411('0x55'),_0x425b66);throw _0x425b66;});}return _0x91f05d;})[_0x4411('0x27')](respondWithResult(_0xd15aa1,0xc9))[_0x4411('0x45')](handleError(_0xd15aa1,null));};exports[_0x4411('0x26')]=function(_0x21e826,_0x507101){if(_0x21e826[_0x4411('0x4e')]['id']){delete _0x21e826[_0x4411('0x4e')]['id'];}return db[_0x4411('0x2f')]['find']({'where':{'id':_0x21e826[_0x4411('0x47')]['id']}})['then'](handleEntityNotFound(_0x507101,null))[_0x4411('0x27')](saveUpdates(_0x21e826[_0x4411('0x4e')],null))[_0x4411('0x27')](respondWithResult(_0x507101,null))[_0x4411('0x45')](handleError(_0x507101,null));};exports['destroy']=function(_0x1485eb,_0x46bb8d){return db['AnalyticDefaultReport'][_0x4411('0x4c')]({'where':{'id':_0x1485eb[_0x4411('0x47')]['id']}})[_0x4411('0x27')](handleEntityNotFound(_0x46bb8d,null))['then'](removeEntity(_0x46bb8d,null))[_0x4411('0x45')](handleError(_0x46bb8d,null));};exports[_0x4411('0x56')]=function(_0xcab3a,_0x7e1d0d){var _0x4e7a02=0xa;var _0x44402a=[_0x4411('0x57'),_0x4411('0x58'),_0x4411('0x59'),_0x4411('0x5a')];var _0x2d671e={'SUM':_0x4411('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4411('0x5c'),'MIN':'MIN(%s)','AVG':_0x4411('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4411('0x5e'),'GROUP_CONCAT DESC':_0x4411('0x5f')};var _0xd6a862={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4411('0x60'),'HOUR':_0x4411('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xea221b=function(_0x2030f4){return!_[_0x4411('0x62')]([_0x4411('0x63'),_0x4411('0x64'),_0x4411('0x65'),_0x4411('0x66')],_0x2030f4);};var _0x4ecd3e=function(_0x28eef6){if(!_0x28eef6||!_0x28eef6[_0x4411('0x67')][_0x4411('0x39')]){return'';}for(var _0x44186e='(',_0xc063dd=0x0;_0xc063dd<_0x28eef6[_0x4411('0x67')][_0x4411('0x39')];_0xc063dd+=0x1){_0xc063dd>0x0&&(_0x44186e+='\x20'+_0x28eef6[_0x4411('0x68')]+'\x20');_0x44186e+=_0x28eef6[_0x4411('0x67')][_0xc063dd]['group']?_0x4ecd3e(_0x28eef6['rules'][_0xc063dd][_0x4411('0x69')]):_0x28eef6['rules'][_0xc063dd]['field']+'\x20'+_0x28eef6[_0x4411('0x67')][_0xc063dd][_0x4411('0x6a')]+(_0xea221b(_0x28eef6[_0x4411('0x67')][_0xc063dd][_0x4411('0x6a')])?'\x20'+_0x28eef6['rules'][_0xc063dd][_0x4411('0x6b')]:'');}return _0x44186e+')';};var _0x4db41c={'where':{'id':_0xcab3a['params']['id']}},_0x507d6d,_0x151aef,_0x3ba7f4,_0x461dd2,_0x4ee248;_0x4db41c=_['merge']({},_0x4db41c,_0xcab3a['options']);return db['AnalyticDefaultReport'][_0x4411('0x4c')](_0x4db41c)['then'](function(_0x3085c){if(_0x3085c){_0x507d6d=_0x3085c;return _0x3085c[_0x4411('0x6c')]();}return null;})[_0x4411('0x27')](function(_0x1a40d5){if(_0x1a40d5){if(!_0x1a40d5['length']){throw new db[(_0x4411('0x6d'))][(_0x4411('0x6e'))](_0x4411('0x6f'),0x193);}_0x151aef=_0x1a40d5;return db[_0x4411('0x70')][_0x4411('0x43')]({'raw':!![]});}return null;})[_0x4411('0x27')](function(_0x44103d){if(_0x44103d){_0x3ba7f4=_[_0x4411('0x71')](_0x44103d,'id');var _0x22087a;var _0x55c3be=squel[_0x4411('0x72')]();_0x55c3be[_0x4411('0x73')](_0x507d6d[_0x4411('0x74')]);for(var _0x3a6ba4=0x0;_0x3a6ba4<_0x151aef[_0x4411('0x39')];_0x3a6ba4+=0x1){_0x22087a=_0x151aef[_0x3a6ba4][_0x4411('0x75')]?_0x3ba7f4[_0x151aef[_0x3a6ba4]['MetricId']][_0x4411('0x76')]:_0x151aef[_0x3a6ba4][_0x4411('0x77')];_0x22087a=_0x151aef[_0x3a6ba4][_0x4411('0x78')]?_[_0x4411('0x79')](_0x2d671e[_0x151aef[_0x3a6ba4][_0x4411('0x78')]],'%s',_0x22087a):_0x22087a;_0x22087a=_0x151aef[_0x3a6ba4][_0x4411('0x7a')]?_[_0x4411('0x79')](_0xd6a862[_0x151aef[_0x3a6ba4][_0x4411('0x7a')]],'%s',_0x22087a):_0x22087a;if(_0x151aef[_0x3a6ba4][_0x4411('0x7b')]){_0x55c3be[_0x4411('0x69')](_0x22087a);}_0x151aef[_0x3a6ba4][_0x4411('0x7c')]&&_0x55c3be[_0x4411('0x3c')](_0x22087a,_0x151aef[_0x3a6ba4][_0x4411('0x7c')]==='DESC'?![]:!![]);_0x55c3be[_0x4411('0x77')](_0x22087a,_0x151aef[_0x3a6ba4][_0x4411('0x7d')]||_0x22087a);}if(_0x507d6d['joins']){_0x507d6d[_0x4411('0x7e')]=JSON[_0x4411('0x7f')](_0x507d6d['joins']);for(var _0x7b4501=0x0;_0x7b4501<_0x507d6d[_0x4411('0x7e')][_0x4411('0x39')];_0x7b4501+=0x1){if(_0x507d6d[_0x4411('0x7e')][_0x7b4501][_0x4411('0x3f')]&&_['includes'](_0x44402a,_0x507d6d['joins'][_0x7b4501]['type'])&&_0x507d6d[_0x4411('0x7e')][_0x7b4501][_0x4411('0x80')]&&_0x507d6d[_0x4411('0x7e')][_0x7b4501]['foreignTable']&&_0x507d6d['joins'][_0x7b4501][_0x4411('0x81')]){_0x55c3be[_0x507d6d['joins'][_0x7b4501]['type']](_0x507d6d[_0x4411('0x7e')][_0x7b4501][_0x4411('0x82')],null,util[_0x4411('0x7a')](_0x4411('0x83'),_0x507d6d[_0x4411('0x74')],_0x507d6d[_0x4411('0x7e')][_0x7b4501][_0x4411('0x80')],_0x507d6d[_0x4411('0x7e')][_0x7b4501][_0x4411('0x82')],_0x507d6d['joins'][_0x7b4501][_0x4411('0x81')]));}}}if(_0x507d6d[_0x4411('0x84')]){_0x507d6d['conditions']=JSON[_0x4411('0x7f')](_0x507d6d['conditions']);_0x55c3be[_0x4411('0x3e')](_0x4ecd3e(_0x507d6d[_0x4411('0x84')][_0x4411('0x69')]));}_0x4ee248=_0x55c3be['clone']();_0x55c3be[_0x4411('0x20')](_0x4e7a02);_0x55c3be['offset'](0x0);logger['debug'](_0x4411('0x85'),_0x55c3be[_0x4411('0x86')]());return db['sequelize'][_0x4411('0x33')](_0x55c3be[_0x4411('0x86')](),{'type':db['sequelize'][_0x4411('0x87')][_0x4411('0x88')]});}})[_0x4411('0x27')](respondWithResult(_0x7e1d0d,null))[_0x4411('0x45')](handleError(_0x7e1d0d,null));};function runReport(_0x3b9dca,_0xf81a54,_0x392661){var _0x12d848=_0xf81a54[_0x4411('0x2c')];var _0x36fb2d=0xa;var _0x10fca9=[_0x4411('0x57'),_0x4411('0x58'),'right_join',_0x4411('0x5a')];var _0x4eafb4={'SUM':_0x4411('0x5b'),'COUNT':_0x4411('0x89'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4411('0x5c'),'MIN':_0x4411('0x8a'),'AVG':_0x4411('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4411('0x5e'),'GROUP_CONCAT DESC':_0x4411('0x5f')};var _0x29fe20={'SEC_TO_TIME':_0x4411('0x8b'),'DATE':_0x4411('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x4411('0x8c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2585a0=function(_0x11359d){return!_['includes']([_0x4411('0x63'),_0x4411('0x64'),'IS\x20EMPTY',_0x4411('0x66')],_0x11359d);};var _0x25b084=function(_0x340391){if(!_0x340391||!_0x340391[_0x4411('0x67')][_0x4411('0x39')]){return'';}for(var _0x114c54='(',_0x48e45c=0x0;_0x48e45c<_0x340391[_0x4411('0x67')][_0x4411('0x39')];_0x48e45c+=0x1){_0x48e45c>0x0&&(_0x114c54+='\x20'+_0x340391[_0x4411('0x68')]+'\x20');_0x114c54+=_0x340391[_0x4411('0x67')][_0x48e45c][_0x4411('0x69')]?_0x25b084(_0x340391[_0x4411('0x67')][_0x48e45c][_0x4411('0x69')]):_0x340391[_0x4411('0x67')][_0x48e45c][_0x4411('0x77')]+'\x20'+_0x340391[_0x4411('0x67')][_0x48e45c][_0x4411('0x6a')]+(_0x2585a0(_0x340391[_0x4411('0x67')][_0x48e45c]['condition'])?'\x20'+_0x340391[_0x4411('0x67')][_0x48e45c]['value']:'');}return _0x114c54+')';};var _0x47316c={'where':{'id':_0x3b9dca['id']}},_0x1a2fc2,_0x42c886,_0x4dfe50,_0x586dde,_0x11bee9;_0x47316c=_[_0x4411('0x42')]({},_0x47316c,_0x392661);return db[_0x4411('0x2f')][_0x4411('0x4c')](_0x47316c)[_0x4411('0x27')](function(_0x1a433d){if(_0x1a433d){_0x1a2fc2=_0x1a433d;return _0x1a433d[_0x4411('0x6c')]();}return null;})['then'](function(_0x56f8b0){if(_0x56f8b0){if(!_0x56f8b0[_0x4411('0x39')]){throw new db['Sequelize'][(_0x4411('0x6e'))](_0x4411('0x6f'),0x193);}_0x42c886=_0x56f8b0;return db[_0x4411('0x70')][_0x4411('0x43')]({'raw':!![]});}return null;})['then'](function(_0x2b91ab){if(_0x2b91ab){_0x4dfe50=_[_0x4411('0x71')](_0x2b91ab,'id');var _0x5f5f5c;var _0x3caab5=squel['select']();_0x3caab5[_0x4411('0x73')](_0x1a2fc2[_0x4411('0x74')]);for(var _0x38b57a=0x0;_0x38b57a<_0x42c886['length'];_0x38b57a+=0x1){_0x5f5f5c=_0x42c886[_0x38b57a][_0x4411('0x75')]?_0x4dfe50[_0x42c886[_0x38b57a]['MetricId']][_0x4411('0x76')]:_0x42c886[_0x38b57a][_0x4411('0x77')];_0x5f5f5c=_0x42c886[_0x38b57a][_0x4411('0x78')]?_['replace'](_0x4eafb4[_0x42c886[_0x38b57a][_0x4411('0x78')]],'%s',_0x5f5f5c):_0x5f5f5c;_0x5f5f5c=_0x42c886[_0x38b57a]['format']?_[_0x4411('0x79')](_0x29fe20[_0x42c886[_0x38b57a][_0x4411('0x7a')]],'%s',_0x5f5f5c):_0x5f5f5c;if(_0x42c886[_0x38b57a][_0x4411('0x7b')]){_0x3caab5['group'](_0x5f5f5c);}_0x42c886[_0x38b57a][_0x4411('0x7c')]&&_0x3caab5[_0x4411('0x3c')](_0x5f5f5c,_0x42c886[_0x38b57a][_0x4411('0x7c')]===_0x4411('0x8d')?![]:!![]);_0x3caab5['field'](_0x5f5f5c,_0x42c886[_0x38b57a][_0x4411('0x7d')]||_0x5f5f5c);}if(_0x1a2fc2['joins']){_0x1a2fc2[_0x4411('0x7e')]=JSON[_0x4411('0x7f')](_0x1a2fc2[_0x4411('0x7e')]);for(var _0x29e1a6=0x0;_0x29e1a6<_0x1a2fc2[_0x4411('0x7e')]['length'];_0x29e1a6+=0x1){if(_0x1a2fc2[_0x4411('0x7e')][_0x29e1a6][_0x4411('0x3f')]&&_['includes'](_0x10fca9,_0x1a2fc2[_0x4411('0x7e')][_0x29e1a6][_0x4411('0x3f')])&&_0x1a2fc2[_0x4411('0x7e')][_0x29e1a6][_0x4411('0x80')]&&_0x1a2fc2['joins'][_0x29e1a6][_0x4411('0x82')]&&_0x1a2fc2['joins'][_0x29e1a6][_0x4411('0x81')]){_0x3caab5[_0x1a2fc2[_0x4411('0x7e')][_0x29e1a6]['type']](_0x1a2fc2[_0x4411('0x7e')][_0x29e1a6]['foreignTable'],null,util[_0x4411('0x7a')]('%s.%s\x20=\x20%s.%s',_0x1a2fc2[_0x4411('0x74')],_0x1a2fc2[_0x4411('0x7e')][_0x29e1a6][_0x4411('0x80')],_0x1a2fc2[_0x4411('0x7e')][_0x29e1a6][_0x4411('0x82')],_0x1a2fc2['joins'][_0x29e1a6][_0x4411('0x81')]));}}}if(_0x1a2fc2[_0x4411('0x84')]){_0x1a2fc2[_0x4411('0x84')]=JSON[_0x4411('0x7f')](_0x1a2fc2[_0x4411('0x84')]);_0x3caab5[_0x4411('0x3e')](_0x25b084(_0x1a2fc2[_0x4411('0x84')][_0x4411('0x69')]));}_0x11bee9=_0x3caab5['clone']();_0x3caab5['limit'](_0x36fb2d);_0x3caab5[_0x4411('0x1f')](0x0);logger[_0x4411('0x8e')](_0x4411('0x85'),_0x3caab5['toString']());return db['sequelize'][_0x4411('0x33')](_0x3caab5['toString'](),{'type':db['sequelize'][_0x4411('0x87')][_0x4411('0x88')]});}})[_0x4411('0x27')](function(_0x481495){if(!_0x481495[_0x4411('0x39')]){throw new db[(_0x4411('0x6d'))][(_0x4411('0x6e'))](_0x4411('0x8f'),0xcc);}if(_0xf81a54[_0x4411('0x90')]===_0x4411('0x91')){return null;}var _0x19a833=_[_0x4411('0x42')](_0xf81a54,{'name':_0xf81a54[_0x4411('0x92')]||_0xf81a54['name']||_0x1a2fc2[_0x4411('0x2c')],'basename':_0x12d848,'savename':util[_0x4411('0x7a')]('%s-%s.%s',_0xf81a54[_0x4411('0x2c')]||_0x1a2fc2['name'],require(_0x4411('0x93'))[_0x4411('0x94')](0x4),_0xf81a54[_0x4411('0x90')]||_0x4411('0x95')),'reportId':_0x1a2fc2['id'],'reportType':_0x4411('0x96')});return db[_0x4411('0x97')]['create'](_0x19a833,{'raw':!![]});})[_0x4411('0x27')](function(_0x509152){if(_0x1a2fc2[_0x4411('0x74')]==='cdr'){_0x11bee9[_0x4411('0x3e')](_0x1a2fc2['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xf81a54[_0x4411('0x98')],_0xf81a54[_0x4411('0x99')]);}else{_0x11bee9[_0x4411('0x3e')](_0x1a2fc2[_0x4411('0x74')]+_0x4411('0x9a'),_0xf81a54['startDate'],_0xf81a54[_0x4411('0x99')]);}if(_0x509152){logger[_0x4411('0x9b')](_0x4411('0x9c'),_0x11bee9[_0x4411('0x86')]());require('child_process')[_0x4411('0x9d')](path[_0x4411('0x57')](__dirname,_0x4411('0x9e'),_0x509152[_0x4411('0x90')]),[_0x509152['id'],_0x11bee9[_0x4411('0x86')](),path[_0x4411('0x57')](__dirname,_0x4411('0x9f'),_0x509152[_0x4411('0xa0')]),_0x12d848]);return _0x509152;}else{var _0x4d1482=squel[_0x4411('0x72')]();_0x4d1482[_0x4411('0x73')]('('+_0x11bee9['toString']()+')',_0x4411('0xa1'));_0x4d1482[_0x4411('0x77')](_0x4411('0xa2'),_0x4411('0x1e'));_0x11bee9[_0x4411('0x20')](_0xf81a54[_0x4411('0x20')]||_0x36fb2d);_0x11bee9['offset'](_0xf81a54[_0x4411('0x1f')]||0x0);return dbH[_0x4411('0xa3')][_0x4411('0x33')](_0x4d1482[_0x4411('0x86')](),{'type':dbH[_0x4411('0xa3')][_0x4411('0x87')]['SELECT']})[_0x4411('0x27')](function(_0x2ae0e9){if(!_0x2ae0e9[_0x4411('0x39')]){_0x586dde=0x0;}else{_0x586dde=_0x2ae0e9[0x0][_0x4411('0x1e')]||0x0;}return dbH[_0x4411('0xa3')]['query'](_0x11bee9[_0x4411('0x86')](),{'type':dbH[_0x4411('0xa3')][_0x4411('0x87')][_0x4411('0x88')]});})[_0x4411('0x27')](function(_0x5e8ff7){return{'rows':_0x5e8ff7||[],'count':_0x586dde};});}});}exports['run']=function(_0x5bcdd2,_0x11c2af){return runReport(_0x5bcdd2[_0x4411('0x47')],_0x5bcdd2['query'],_0x5bcdd2[_0x4411('0x4b')])[_0x4411('0x27')](respondWithResult(_0x11c2af,null))['catch'](handleError(_0x11c2af,null));};exports['runReport']=runReport;exports[_0x4411('0x33')]=function(_0x3eae5d,_0x1a5013){var _0x1c4571=0xa;var _0x3ad318=[_0x4411('0x57'),'left_join',_0x4411('0x59'),'cross_join'];var _0x55525d={'SUM':_0x4411('0x5b'),'COUNT':_0x4411('0x89'),'COUNT DISTINCT':_0x4411('0xa4'),'MAX':_0x4411('0x5c'),'MIN':_0x4411('0x8a'),'AVG':_0x4411('0x5d'),'GROUP_CONCAT':_0x4411('0xa5'),'GROUP_CONCAT ASC':_0x4411('0x5e'),'GROUP_CONCAT DESC':_0x4411('0x5f')};var _0x2bf25f={'SEC_TO_TIME':_0x4411('0x8b'),'DATE':_0x4411('0x60'),'HOUR':_0x4411('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2f63a0=function(_0x239020){return!_[_0x4411('0x62')]([_0x4411('0x63'),_0x4411('0x64'),_0x4411('0x65'),'IS\x20NOT\x20EMPTY'],_0x239020);};var _0x2ad748=function(_0x5eeb34){if(!_0x5eeb34||!_0x5eeb34[_0x4411('0x67')][_0x4411('0x39')]){return'';}for(var _0x45cd32='(',_0x5d4ce1=0x0;_0x5d4ce1<_0x5eeb34[_0x4411('0x67')][_0x4411('0x39')];_0x5d4ce1+=0x1){_0x5d4ce1>0x0&&(_0x45cd32+='\x20'+_0x5eeb34[_0x4411('0x68')]+'\x20');_0x45cd32+=_0x5eeb34['rules'][_0x5d4ce1]['group']?_0x2ad748(_0x5eeb34[_0x4411('0x67')][_0x5d4ce1][_0x4411('0x69')]):_0x5eeb34[_0x4411('0x67')][_0x5d4ce1]['field']+'\x20'+_0x5eeb34[_0x4411('0x67')][_0x5d4ce1]['condition']+(_0x2f63a0(_0x5eeb34['rules'][_0x5d4ce1][_0x4411('0x6a')])?'\x20'+_0x5eeb34['rules'][_0x5d4ce1]['value']:'');}return _0x45cd32+')';};var _0x52c0fb={'where':{'id':_0x3eae5d[_0x4411('0x47')]['id']}},_0x53e88f,_0x3af2f5,_0x4e056e,_0x4c15f0,_0x1c2ccb;_0x52c0fb=_['merge']({},_0x52c0fb,_0x3eae5d[_0x4411('0x4b')]);return db[_0x4411('0x2f')][_0x4411('0x4c')](_0x52c0fb)['then'](function(_0x7eca6a){if(_0x7eca6a){_0x53e88f=_0x7eca6a;return _0x7eca6a[_0x4411('0x6c')]();}return null;})[_0x4411('0x27')](function(_0x219737){if(_0x219737){if(!_0x219737[_0x4411('0x39')]){throw new db[(_0x4411('0x6d'))]['ValidationErrorItem'](_0x4411('0x6f'),0x193);}_0x3af2f5=_0x219737;return db[_0x4411('0x70')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1840fb){if(_0x1840fb){_0x4e056e=_[_0x4411('0x71')](_0x1840fb,'id');var _0x4942e6;var _0x9f410e=squel[_0x4411('0x72')]();_0x9f410e[_0x4411('0x73')](_0x53e88f[_0x4411('0x74')]);for(var _0x4fdbd7=0x0;_0x4fdbd7<_0x3af2f5[_0x4411('0x39')];_0x4fdbd7+=0x1){_0x4942e6=_0x3af2f5[_0x4fdbd7][_0x4411('0x75')]?_0x4e056e[_0x3af2f5[_0x4fdbd7][_0x4411('0x75')]][_0x4411('0x76')]:_0x3af2f5[_0x4fdbd7][_0x4411('0x77')];_0x4942e6=_0x3af2f5[_0x4fdbd7][_0x4411('0x78')]?_['replace'](_0x55525d[_0x3af2f5[_0x4fdbd7][_0x4411('0x78')]],'%s',_0x4942e6):_0x4942e6;_0x4942e6=_0x3af2f5[_0x4fdbd7][_0x4411('0x7a')]?_['replace'](_0x2bf25f[_0x3af2f5[_0x4fdbd7][_0x4411('0x7a')]],'%s',_0x4942e6):_0x4942e6;if(_0x3af2f5[_0x4fdbd7]['groupBy']){_0x9f410e['group'](_0x4942e6);}_0x3af2f5[_0x4fdbd7][_0x4411('0x7c')]&&_0x9f410e[_0x4411('0x3c')](_0x4942e6,_0x3af2f5[_0x4fdbd7]['orderBy']===_0x4411('0x8d')?![]:!![]);_0x9f410e['field'](_0x4942e6,_0x3af2f5[_0x4fdbd7]['alias']||_0x4942e6);}if(_0x53e88f[_0x4411('0x7e')]){_0x53e88f[_0x4411('0x7e')]=JSON['parse'](_0x53e88f[_0x4411('0x7e')]);for(var _0x50b081=0x0;_0x50b081<_0x53e88f['joins'][_0x4411('0x39')];_0x50b081+=0x1){if(_0x53e88f[_0x4411('0x7e')][_0x50b081][_0x4411('0x3f')]&&_[_0x4411('0x62')](_0x3ad318,_0x53e88f['joins'][_0x50b081][_0x4411('0x3f')])&&_0x53e88f['joins'][_0x50b081][_0x4411('0x80')]&&_0x53e88f[_0x4411('0x7e')][_0x50b081][_0x4411('0x82')]&&_0x53e88f[_0x4411('0x7e')][_0x50b081][_0x4411('0x81')]){_0x9f410e[_0x53e88f['joins'][_0x50b081][_0x4411('0x3f')]](_0x53e88f[_0x4411('0x7e')][_0x50b081][_0x4411('0x82')],null,util['format'](_0x4411('0x83'),_0x53e88f['table'],_0x53e88f[_0x4411('0x7e')][_0x50b081][_0x4411('0x80')],_0x53e88f['joins'][_0x50b081]['foreignTable'],_0x53e88f['joins'][_0x50b081][_0x4411('0x81')]));}}}if(_0x53e88f['conditions']){_0x53e88f[_0x4411('0x84')]=JSON[_0x4411('0x7f')](_0x53e88f[_0x4411('0x84')]);_0x9f410e[_0x4411('0x3e')](_0x2ad748(_0x53e88f[_0x4411('0x84')]['group']));}_0x1c2ccb=_0x9f410e[_0x4411('0xa6')]();_0x9f410e[_0x4411('0x20')](_0x1c4571);_0x9f410e[_0x4411('0x1f')](0x0);logger[_0x4411('0x8e')](_0x4411('0x85'),_0x9f410e[_0x4411('0x86')]());return db['sequelize'][_0x4411('0x33')](_0x9f410e['toString'](),{'type':db['sequelize'][_0x4411('0x87')][_0x4411('0x88')]});}})[_0x4411('0x27')](function(){return{'sql':_0x1c2ccb[_0x4411('0x86')]()};})[_0x4411('0x27')](respondWithResult(_0x1a5013,null))[_0x4411('0x45')](handleError(_0x1a5013,null));}; \ No newline at end of file +var _0xbf61=['alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','sequelize','QueryTypes','cross_join','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','IS\x20EMPTY','select','from','metric','groupBy','DESC','debug','toString','SELECT','Sequelize','No\x20available\x20data','web','%s-%s.%s','randomstring','generate','output','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','left_join','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','jsforce','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','json','count','offset','limit','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','preview','join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table','MetricId','function','replace','orderBy'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0xbf61,0xd7));var _0x1bf6=function(_0x5ea79b,_0x3b647f){_0x5ea79b=_0x5ea79b-0x0;var _0x2a6eac=_0xbf61[_0x5ea79b];return _0x2a6eac;};'use strict';var pdf=require(_0x1bf6('0x0'));var emlformat=require(_0x1bf6('0x1'));var rimraf=require(_0x1bf6('0x2'));var zipdir=require(_0x1bf6('0x3'));var jsonpatch=require(_0x1bf6('0x4'));var rp=require(_0x1bf6('0x5'));var moment=require(_0x1bf6('0x6'));var BPromise=require(_0x1bf6('0x7'));var Mustache=require('mustache');var util=require(_0x1bf6('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1bf6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1bf6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1bf6('0x9'));var querystring=require(_0x1bf6('0xb'));var Papa=require(_0x1bf6('0xc'));var Redis=require(_0x1bf6('0xd'));var authService=require(_0x1bf6('0xe'));var qs=require(_0x1bf6('0xf'));var as=require(_0x1bf6('0x10'));var hardwareService=require(_0x1bf6('0x11'));var logger=require(_0x1bf6('0x12'))('api');var utils=require(_0x1bf6('0x13'));var config=require(_0x1bf6('0x14'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1bf6('0x15'))['dbH'];function respondWithStatusCode(_0x5c189a,_0x2bd858){_0x2bd858=_0x2bd858||0xcc;return function(_0x3c4f2f){if(_0x3c4f2f){return _0x5c189a[_0x1bf6('0x16')](_0x2bd858);}return _0x5c189a[_0x1bf6('0x17')](_0x2bd858)[_0x1bf6('0x18')]();};}function respondWithResult(_0x1fa717,_0x4eb3a7){_0x4eb3a7=_0x4eb3a7||0xc8;return function(_0x38e67f){if(_0x38e67f){return _0x1fa717[_0x1bf6('0x17')](_0x4eb3a7)[_0x1bf6('0x19')](_0x38e67f);}};}function respondWithFilteredResult(_0x2e3e96,_0x40c81b){return function(_0x16c1a0){if(_0x16c1a0){var _0x587a76=_0x16c1a0[_0x1bf6('0x1a')],_0x480089=_0x40c81b[_0x1bf6('0x1b')],_0x560c96=_0x40c81b['offset']+_0x40c81b[_0x1bf6('0x1c')],_0x3d9e93;if(_0x560c96>=_0x587a76){_0x560c96=_0x587a76;_0x3d9e93=0xc8;}else{_0x3d9e93=0xce;}_0x2e3e96[_0x1bf6('0x17')](_0x3d9e93);return _0x2e3e96['set']('Content-Range',_0x480089+'-'+_0x560c96+'/'+_0x587a76)[_0x1bf6('0x19')](_0x16c1a0);}return null;};}function patchUpdates(_0x43e647){return function(_0x3026ed){try{jsonpatch[_0x1bf6('0x1d')](_0x3026ed,_0x43e647,!![]);}catch(_0x19888d){return BPromise[_0x1bf6('0x1e')](_0x19888d);}return _0x3026ed[_0x1bf6('0x1f')]();};}function saveUpdates(_0x1eec86,_0x38d55d){return function(_0x4605f0){if(_0x4605f0){return _0x4605f0['update'](_0x1eec86)[_0x1bf6('0x20')](function(_0x1323f9){return _0x1323f9;});}return null;};}function removeEntity(_0x30dd6a,_0x3817a4){return function(_0x38cf74){if(_0x38cf74){return _0x38cf74[_0x1bf6('0x21')]()['then'](function(){var _0xf190f1=_0x38cf74[_0x1bf6('0x22')]({'plain':!![]});var _0x2d6fe3=_0x1bf6('0x23');return db[_0x1bf6('0x24')][_0x1bf6('0x21')]({'where':{'type':_0x2d6fe3,'resourceId':_0xf190f1['id']}})[_0x1bf6('0x20')](function(){return _0x38cf74;});})[_0x1bf6('0x20')](function(){_0x30dd6a['status'](0xcc)[_0x1bf6('0x18')]();});}};}function handleEntityNotFound(_0x446d48,_0x40a2ea){return function(_0x1a87bc){if(!_0x1a87bc){_0x446d48[_0x1bf6('0x16')](0x194);}return _0x1a87bc;};}function handleError(_0x212962,_0x326df9){_0x326df9=_0x326df9||0x1f4;return function(_0xb89a3a){logger[_0x1bf6('0x25')](_0xb89a3a[_0x1bf6('0x26')]);if(_0xb89a3a[_0x1bf6('0x27')]){delete _0xb89a3a[_0x1bf6('0x27')];}_0x212962['status'](_0x326df9)[_0x1bf6('0x28')](_0xb89a3a);};}exports[_0x1bf6('0x29')]=function(_0x1798be,_0x2ad276){var _0x24b2fa={},_0x446865={},_0x25af2a={'count':0x0,'rows':[]};var _0x545b9a=_['map'](db[_0x1bf6('0x2a')][_0x1bf6('0x2b')],function(_0x38f320){return{'name':_0x38f320[_0x1bf6('0x2c')],'type':_0x38f320[_0x1bf6('0x2d')][_0x1bf6('0x2e')]};});_0x446865['model']=_[_0x1bf6('0x2f')](_0x545b9a,_0x1bf6('0x27'));_0x446865['query']=_[_0x1bf6('0x30')](_0x1798be[_0x1bf6('0x31')]);_0x446865[_0x1bf6('0x32')]=_['intersection'](_0x446865['model'],_0x446865[_0x1bf6('0x31')]);_0x24b2fa['attributes']=_[_0x1bf6('0x33')](_0x446865[_0x1bf6('0x34')],qs[_0x1bf6('0x35')](_0x1798be[_0x1bf6('0x31')][_0x1bf6('0x35')]));_0x24b2fa['attributes']=_0x24b2fa[_0x1bf6('0x36')]['length']?_0x24b2fa['attributes']:_0x446865[_0x1bf6('0x34')];if(!_0x1798be[_0x1bf6('0x31')]['hasOwnProperty'](_0x1bf6('0x37'))){_0x24b2fa[_0x1bf6('0x1c')]=qs[_0x1bf6('0x1c')](_0x1798be[_0x1bf6('0x31')][_0x1bf6('0x1c')]);_0x24b2fa[_0x1bf6('0x1b')]=qs[_0x1bf6('0x1b')](_0x1798be['query']['offset']);}_0x24b2fa[_0x1bf6('0x38')]=qs[_0x1bf6('0x39')](_0x1798be[_0x1bf6('0x31')][_0x1bf6('0x39')]);_0x24b2fa[_0x1bf6('0x3a')]=qs[_0x1bf6('0x32')](_[_0x1bf6('0x3b')](_0x1798be[_0x1bf6('0x31')],_0x446865['filters']),_0x545b9a);if(_0x1798be[_0x1bf6('0x31')][_0x1bf6('0x3c')]){_0x24b2fa[_0x1bf6('0x3a')]=_['merge'](_0x24b2fa[_0x1bf6('0x3a')],{'$or':_[_0x1bf6('0x2f')](_0x545b9a,function(_0x2192f3){if(_0x2192f3['type']!=='VIRTUAL'){var _0x150cdd={};_0x150cdd[_0x2192f3['name']]={'$like':'%'+_0x1798be['query']['filter']+'%'};return _0x150cdd;}})});}_0x24b2fa=_[_0x1bf6('0x3d')]({},_0x24b2fa,_0x1798be[_0x1bf6('0x3e')]);var _0x4a093b={'where':_0x24b2fa[_0x1bf6('0x3a')]};return db[_0x1bf6('0x2a')][_0x1bf6('0x1a')](_0x4a093b)[_0x1bf6('0x20')](function(_0x4499a2){_0x25af2a[_0x1bf6('0x1a')]=_0x4499a2;if(_0x1798be[_0x1bf6('0x31')][_0x1bf6('0x3f')]){_0x24b2fa[_0x1bf6('0x40')]=[{'all':!![]}];}return db[_0x1bf6('0x2a')][_0x1bf6('0x41')](_0x24b2fa);})[_0x1bf6('0x20')](function(_0xcaf87a){_0x25af2a[_0x1bf6('0x42')]=_0xcaf87a;return _0x25af2a;})[_0x1bf6('0x20')](respondWithFilteredResult(_0x2ad276,_0x24b2fa))[_0x1bf6('0x43')](handleError(_0x2ad276,null));};exports['show']=function(_0x30eb81,_0xe05544){var _0x6b37a={'raw':!![],'where':{'id':_0x30eb81[_0x1bf6('0x44')]['id']}},_0x406e4b={};_0x406e4b['model']=_['keys'](db[_0x1bf6('0x2a')][_0x1bf6('0x2b')]);_0x406e4b[_0x1bf6('0x31')]=_['keys'](_0x30eb81[_0x1bf6('0x31')]);_0x406e4b[_0x1bf6('0x32')]=_[_0x1bf6('0x33')](_0x406e4b['model'],_0x406e4b[_0x1bf6('0x31')]);_0x6b37a['attributes']=_[_0x1bf6('0x33')](_0x406e4b[_0x1bf6('0x34')],qs[_0x1bf6('0x35')](_0x30eb81[_0x1bf6('0x31')][_0x1bf6('0x35')]));_0x6b37a[_0x1bf6('0x36')]=_0x6b37a[_0x1bf6('0x36')][_0x1bf6('0x45')]?_0x6b37a[_0x1bf6('0x36')]:_0x406e4b[_0x1bf6('0x34')];if(_0x30eb81['query']['includeAll']){_0x6b37a[_0x1bf6('0x40')]=[{'all':!![]}];}_0x6b37a=_['merge']({},_0x6b37a,_0x30eb81[_0x1bf6('0x3e')]);return db[_0x1bf6('0x2a')][_0x1bf6('0x46')](_0x6b37a)[_0x1bf6('0x20')](handleEntityNotFound(_0xe05544,null))[_0x1bf6('0x20')](respondWithResult(_0xe05544,null))[_0x1bf6('0x43')](handleError(_0xe05544,null));};exports[_0x1bf6('0x47')]=function(_0xb32083,_0x528c11){return db['AnalyticDefaultReport']['create'](_0xb32083[_0x1bf6('0x48')],{})[_0x1bf6('0x20')](function(_0x272a39){var _0x101a55=_0xb32083[_0x1bf6('0x49')]['get']({'plain':!![]});if(!_0x101a55)throw new Error(_0x1bf6('0x4a'));if(_0x101a55[_0x1bf6('0x4b')]===_0x1bf6('0x49')){var _0x5717fd=_0x272a39[_0x1bf6('0x22')]({'plain':!![]});var _0x476fb1='Reports';return db[_0x1bf6('0x4c')][_0x1bf6('0x46')]({'where':{'name':_0x476fb1,'userProfileId':_0x101a55[_0x1bf6('0x4d')]},'raw':!![]})[_0x1bf6('0x20')](function(_0x1713ea){if(_0x1713ea&&_0x1713ea[_0x1bf6('0x4e')]===0x0){return db[_0x1bf6('0x24')][_0x1bf6('0x47')]({'name':_0x5717fd[_0x1bf6('0x27')],'resourceId':_0x5717fd['id'],'type':_0x1bf6('0x23'),'sectionId':_0x1713ea['id']},{})['then'](function(){return _0x272a39;});}else{return _0x272a39;}})[_0x1bf6('0x43')](function(_0x11f797){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11f797);throw _0x11f797;});}return _0x272a39;})['then'](respondWithResult(_0x528c11,0xc9))['catch'](handleError(_0x528c11,null));};exports[_0x1bf6('0x4f')]=function(_0xd6a351,_0x3349b4){if(_0xd6a351[_0x1bf6('0x48')]['id']){delete _0xd6a351[_0x1bf6('0x48')]['id'];}return db[_0x1bf6('0x2a')][_0x1bf6('0x46')]({'where':{'id':_0xd6a351[_0x1bf6('0x44')]['id']}})[_0x1bf6('0x20')](handleEntityNotFound(_0x3349b4,null))[_0x1bf6('0x20')](saveUpdates(_0xd6a351['body'],null))['then'](respondWithResult(_0x3349b4,null))[_0x1bf6('0x43')](handleError(_0x3349b4,null));};exports['destroy']=function(_0x5b8d97,_0x203cd6){return db[_0x1bf6('0x2a')][_0x1bf6('0x46')]({'where':{'id':_0x5b8d97['params']['id']}})['then'](handleEntityNotFound(_0x203cd6,null))[_0x1bf6('0x20')](removeEntity(_0x203cd6,null))['catch'](handleError(_0x203cd6,null));};exports[_0x1bf6('0x50')]=function(_0x112fc4,_0x3be492){var _0x477159=0xa;var _0x2e23eb=[_0x1bf6('0x51'),'left_join',_0x1bf6('0x52'),'cross_join'];var _0x5eb871={'SUM':_0x1bf6('0x53'),'COUNT':_0x1bf6('0x54'),'COUNT DISTINCT':_0x1bf6('0x55'),'MAX':_0x1bf6('0x56'),'MIN':_0x1bf6('0x57'),'AVG':_0x1bf6('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1bf6('0x59'),'GROUP_CONCAT DESC':_0x1bf6('0x5a')};var _0x220054={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1bf6('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1bf6('0x5c')};var _0x403a40=function(_0x2f8285){return!_[_0x1bf6('0x5d')]([_0x1bf6('0x5e'),_0x1bf6('0x5f'),'IS\x20EMPTY',_0x1bf6('0x60')],_0x2f8285);};var _0x43aa62=function(_0x176730){if(!_0x176730||!_0x176730[_0x1bf6('0x61')][_0x1bf6('0x45')]){return'';}for(var _0x321dc6='(',_0x92f141=0x0;_0x92f141<_0x176730[_0x1bf6('0x61')]['length'];_0x92f141+=0x1){_0x92f141>0x0&&(_0x321dc6+='\x20'+_0x176730[_0x1bf6('0x62')]+'\x20');_0x321dc6+=_0x176730[_0x1bf6('0x61')][_0x92f141][_0x1bf6('0x63')]?_0x43aa62(_0x176730['rules'][_0x92f141]['group']):_0x176730['rules'][_0x92f141][_0x1bf6('0x64')]+'\x20'+_0x176730[_0x1bf6('0x61')][_0x92f141]['condition']+(_0x403a40(_0x176730[_0x1bf6('0x61')][_0x92f141][_0x1bf6('0x65')])?'\x20'+_0x176730['rules'][_0x92f141][_0x1bf6('0x66')]:'');}return _0x321dc6+')';};var _0x504013={'where':{'id':_0x112fc4['params']['id']}},_0x4cebf6,_0x1cdab4,_0x50de64,_0xa56b24,_0x2f944a;_0x504013=_[_0x1bf6('0x3d')]({},_0x504013,_0x112fc4[_0x1bf6('0x3e')]);return db[_0x1bf6('0x2a')][_0x1bf6('0x46')](_0x504013)[_0x1bf6('0x20')](function(_0xc263b1){if(_0xc263b1){_0x4cebf6=_0xc263b1;return _0xc263b1[_0x1bf6('0x67')]();}return null;})['then'](function(_0xb00c20){if(_0xb00c20){if(!_0xb00c20[_0x1bf6('0x45')]){throw new db['Sequelize'][(_0x1bf6('0x68'))](_0x1bf6('0x69'),0x193);}_0x1cdab4=_0xb00c20;return db[_0x1bf6('0x6a')][_0x1bf6('0x41')]({'raw':!![]});}return null;})[_0x1bf6('0x20')](function(_0x204365){if(_0x204365){_0x50de64=_[_0x1bf6('0x6b')](_0x204365,'id');var _0x41d60c;var _0x418054=squel['select']();_0x418054['from'](_0x4cebf6[_0x1bf6('0x6c')]);for(var _0x1a7a5e=0x0;_0x1a7a5e<_0x1cdab4[_0x1bf6('0x45')];_0x1a7a5e+=0x1){_0x41d60c=_0x1cdab4[_0x1a7a5e]['MetricId']?_0x50de64[_0x1cdab4[_0x1a7a5e][_0x1bf6('0x6d')]]['metric']:_0x1cdab4[_0x1a7a5e][_0x1bf6('0x64')];_0x41d60c=_0x1cdab4[_0x1a7a5e]['function']?_['replace'](_0x5eb871[_0x1cdab4[_0x1a7a5e][_0x1bf6('0x6e')]],'%s',_0x41d60c):_0x41d60c;_0x41d60c=_0x1cdab4[_0x1a7a5e]['format']?_[_0x1bf6('0x6f')](_0x220054[_0x1cdab4[_0x1a7a5e]['format']],'%s',_0x41d60c):_0x41d60c;if(_0x1cdab4[_0x1a7a5e]['groupBy']){_0x418054[_0x1bf6('0x63')](_0x41d60c);}_0x1cdab4[_0x1a7a5e][_0x1bf6('0x70')]&&_0x418054[_0x1bf6('0x38')](_0x41d60c,_0x1cdab4[_0x1a7a5e][_0x1bf6('0x70')]==='DESC'?![]:!![]);_0x418054[_0x1bf6('0x64')](_0x41d60c,_0x1cdab4[_0x1a7a5e][_0x1bf6('0x71')]||_0x41d60c);}if(_0x4cebf6[_0x1bf6('0x72')]){_0x4cebf6[_0x1bf6('0x72')]=JSON[_0x1bf6('0x73')](_0x4cebf6[_0x1bf6('0x72')]);for(var _0x5c3c48=0x0;_0x5c3c48<_0x4cebf6[_0x1bf6('0x72')][_0x1bf6('0x45')];_0x5c3c48+=0x1){if(_0x4cebf6['joins'][_0x5c3c48]['type']&&_['includes'](_0x2e23eb,_0x4cebf6[_0x1bf6('0x72')][_0x5c3c48][_0x1bf6('0x2d')])&&_0x4cebf6[_0x1bf6('0x72')][_0x5c3c48][_0x1bf6('0x74')]&&_0x4cebf6[_0x1bf6('0x72')][_0x5c3c48][_0x1bf6('0x75')]&&_0x4cebf6[_0x1bf6('0x72')][_0x5c3c48][_0x1bf6('0x76')]){_0x418054[_0x4cebf6[_0x1bf6('0x72')][_0x5c3c48][_0x1bf6('0x2d')]](_0x4cebf6[_0x1bf6('0x72')][_0x5c3c48]['foreignTable'],null,util[_0x1bf6('0x77')](_0x1bf6('0x78'),_0x4cebf6[_0x1bf6('0x6c')],_0x4cebf6[_0x1bf6('0x72')][_0x5c3c48][_0x1bf6('0x74')],_0x4cebf6[_0x1bf6('0x72')][_0x5c3c48][_0x1bf6('0x75')],_0x4cebf6['joins'][_0x5c3c48]['foreignKey']));}}}if(_0x4cebf6[_0x1bf6('0x79')]){_0x4cebf6[_0x1bf6('0x79')]=JSON[_0x1bf6('0x73')](_0x4cebf6[_0x1bf6('0x79')]);_0x418054['where'](_0x43aa62(_0x4cebf6[_0x1bf6('0x79')]['group']));}_0x2f944a=_0x418054[_0x1bf6('0x7a')]();_0x418054[_0x1bf6('0x1c')](_0x477159);_0x418054['offset'](0x0);logger['debug'](_0x1bf6('0x7b'),_0x418054['toString']());return db[_0x1bf6('0x7c')][_0x1bf6('0x31')](_0x418054['toString'](),{'type':db['sequelize'][_0x1bf6('0x7d')]['SELECT']});}})[_0x1bf6('0x20')](respondWithResult(_0x3be492,null))['catch'](handleError(_0x3be492,null));};function runReport(_0x485d88,_0x34cd7e,_0x58c3aa){var _0x35ade8=_0x34cd7e[_0x1bf6('0x27')];var _0x3694d2=0xa;var _0x453a3d=['join','left_join',_0x1bf6('0x52'),_0x1bf6('0x7e')];var _0x5f1cbe={'SUM':_0x1bf6('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1bf6('0x56'),'MIN':_0x1bf6('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1bf6('0x7f'),'GROUP_CONCAT ASC':_0x1bf6('0x59'),'GROUP_CONCAT DESC':_0x1bf6('0x5a')};var _0x2aa3fc={'SEC_TO_TIME':_0x1bf6('0x80'),'DATE':_0x1bf6('0x5b'),'HOUR':_0x1bf6('0x81'),'ROUND':_0x1bf6('0x82'),'UNIX_TIMESTAMP':_0x1bf6('0x5c')};var _0x29df0a=function(_0x2526be){return!_[_0x1bf6('0x5d')]([_0x1bf6('0x5e'),'IS\x20NOT\x20NULL',_0x1bf6('0x83'),_0x1bf6('0x60')],_0x2526be);};var _0xeb3e10=function(_0x1da9f4){if(!_0x1da9f4||!_0x1da9f4[_0x1bf6('0x61')][_0x1bf6('0x45')]){return'';}for(var _0x555fc1='(',_0x2739ee=0x0;_0x2739ee<_0x1da9f4[_0x1bf6('0x61')][_0x1bf6('0x45')];_0x2739ee+=0x1){_0x2739ee>0x0&&(_0x555fc1+='\x20'+_0x1da9f4['operator']+'\x20');_0x555fc1+=_0x1da9f4[_0x1bf6('0x61')][_0x2739ee]['group']?_0xeb3e10(_0x1da9f4['rules'][_0x2739ee][_0x1bf6('0x63')]):_0x1da9f4[_0x1bf6('0x61')][_0x2739ee]['field']+'\x20'+_0x1da9f4[_0x1bf6('0x61')][_0x2739ee][_0x1bf6('0x65')]+(_0x29df0a(_0x1da9f4[_0x1bf6('0x61')][_0x2739ee][_0x1bf6('0x65')])?'\x20'+_0x1da9f4[_0x1bf6('0x61')][_0x2739ee][_0x1bf6('0x66')]:'');}return _0x555fc1+')';};var _0x2dd85d={'where':{'id':_0x485d88['id']}},_0x2b441a,_0xf3ffa4,_0x26343d,_0x41ebe2,_0x17f59e;_0x2dd85d=_['merge']({},_0x2dd85d,_0x58c3aa);return db[_0x1bf6('0x2a')][_0x1bf6('0x46')](_0x2dd85d)[_0x1bf6('0x20')](function(_0x4cfe73){if(_0x4cfe73){_0x2b441a=_0x4cfe73;return _0x4cfe73[_0x1bf6('0x67')]();}return null;})[_0x1bf6('0x20')](function(_0x5d8b21){if(_0x5d8b21){if(!_0x5d8b21[_0x1bf6('0x45')]){throw new db['Sequelize'][(_0x1bf6('0x68'))](_0x1bf6('0x69'),0x193);}_0xf3ffa4=_0x5d8b21;return db[_0x1bf6('0x6a')][_0x1bf6('0x41')]({'raw':!![]});}return null;})[_0x1bf6('0x20')](function(_0x11ef52){if(_0x11ef52){_0x26343d=_[_0x1bf6('0x6b')](_0x11ef52,'id');var _0xf5933c;var _0x33d331=squel[_0x1bf6('0x84')]();_0x33d331[_0x1bf6('0x85')](_0x2b441a[_0x1bf6('0x6c')]);for(var _0xfe3987=0x0;_0xfe3987<_0xf3ffa4[_0x1bf6('0x45')];_0xfe3987+=0x1){_0xf5933c=_0xf3ffa4[_0xfe3987][_0x1bf6('0x6d')]?_0x26343d[_0xf3ffa4[_0xfe3987][_0x1bf6('0x6d')]][_0x1bf6('0x86')]:_0xf3ffa4[_0xfe3987]['field'];_0xf5933c=_0xf3ffa4[_0xfe3987][_0x1bf6('0x6e')]?_[_0x1bf6('0x6f')](_0x5f1cbe[_0xf3ffa4[_0xfe3987]['function']],'%s',_0xf5933c):_0xf5933c;_0xf5933c=_0xf3ffa4[_0xfe3987]['format']?_[_0x1bf6('0x6f')](_0x2aa3fc[_0xf3ffa4[_0xfe3987]['format']],'%s',_0xf5933c):_0xf5933c;if(_0xf3ffa4[_0xfe3987][_0x1bf6('0x87')]){_0x33d331[_0x1bf6('0x63')](_0xf5933c);}_0xf3ffa4[_0xfe3987][_0x1bf6('0x70')]&&_0x33d331[_0x1bf6('0x38')](_0xf5933c,_0xf3ffa4[_0xfe3987]['orderBy']===_0x1bf6('0x88')?![]:!![]);_0x33d331[_0x1bf6('0x64')](_0xf5933c,_0xf3ffa4[_0xfe3987][_0x1bf6('0x71')]||_0xf5933c);}if(_0x2b441a[_0x1bf6('0x72')]){_0x2b441a[_0x1bf6('0x72')]=JSON[_0x1bf6('0x73')](_0x2b441a[_0x1bf6('0x72')]);for(var _0x1db08e=0x0;_0x1db08e<_0x2b441a['joins'][_0x1bf6('0x45')];_0x1db08e+=0x1){if(_0x2b441a[_0x1bf6('0x72')][_0x1db08e][_0x1bf6('0x2d')]&&_[_0x1bf6('0x5d')](_0x453a3d,_0x2b441a[_0x1bf6('0x72')][_0x1db08e][_0x1bf6('0x2d')])&&_0x2b441a[_0x1bf6('0x72')][_0x1db08e][_0x1bf6('0x74')]&&_0x2b441a[_0x1bf6('0x72')][_0x1db08e][_0x1bf6('0x75')]&&_0x2b441a[_0x1bf6('0x72')][_0x1db08e][_0x1bf6('0x76')]){_0x33d331[_0x2b441a[_0x1bf6('0x72')][_0x1db08e][_0x1bf6('0x2d')]](_0x2b441a[_0x1bf6('0x72')][_0x1db08e][_0x1bf6('0x75')],null,util[_0x1bf6('0x77')](_0x1bf6('0x78'),_0x2b441a['table'],_0x2b441a[_0x1bf6('0x72')][_0x1db08e][_0x1bf6('0x74')],_0x2b441a[_0x1bf6('0x72')][_0x1db08e][_0x1bf6('0x75')],_0x2b441a['joins'][_0x1db08e]['foreignKey']));}}}if(_0x2b441a[_0x1bf6('0x79')]){_0x2b441a[_0x1bf6('0x79')]=JSON[_0x1bf6('0x73')](_0x2b441a[_0x1bf6('0x79')]);_0x33d331[_0x1bf6('0x3a')](_0xeb3e10(_0x2b441a[_0x1bf6('0x79')]['group']));}_0x17f59e=_0x33d331[_0x1bf6('0x7a')]();_0x33d331[_0x1bf6('0x1c')](_0x3694d2);_0x33d331[_0x1bf6('0x1b')](0x0);logger[_0x1bf6('0x89')](_0x1bf6('0x7b'),_0x33d331[_0x1bf6('0x8a')]());return db[_0x1bf6('0x7c')][_0x1bf6('0x31')](_0x33d331[_0x1bf6('0x8a')](),{'type':db[_0x1bf6('0x7c')][_0x1bf6('0x7d')][_0x1bf6('0x8b')]});}})[_0x1bf6('0x20')](function(_0x25c7be){if(!_0x25c7be[_0x1bf6('0x45')]){throw new db[(_0x1bf6('0x8c'))][(_0x1bf6('0x68'))](_0x1bf6('0x8d'),0xcc);}if(_0x34cd7e['output']===_0x1bf6('0x8e')){return null;}var _0x252c6e=_[_0x1bf6('0x3d')](_0x34cd7e,{'name':_0x34cd7e['fullPath']||_0x34cd7e[_0x1bf6('0x27')]||_0x2b441a[_0x1bf6('0x27')],'basename':_0x35ade8,'savename':util[_0x1bf6('0x77')](_0x1bf6('0x8f'),_0x34cd7e[_0x1bf6('0x27')]||_0x2b441a[_0x1bf6('0x27')],require(_0x1bf6('0x90'))[_0x1bf6('0x91')](0x4),_0x34cd7e[_0x1bf6('0x92')]||'csv'),'reportId':_0x2b441a['id'],'reportType':_0x1bf6('0x93')});return db['AnalyticExtractedReport'][_0x1bf6('0x47')](_0x252c6e,{'raw':!![]});})[_0x1bf6('0x20')](function(_0x1c3558){if(_0x2b441a[_0x1bf6('0x6c')]===_0x1bf6('0x94')){_0x17f59e[_0x1bf6('0x3a')](_0x2b441a[_0x1bf6('0x6c')]+_0x1bf6('0x95'),_0x34cd7e[_0x1bf6('0x96')],_0x34cd7e[_0x1bf6('0x97')]);}else{_0x17f59e[_0x1bf6('0x3a')](_0x2b441a['table']+_0x1bf6('0x98'),_0x34cd7e[_0x1bf6('0x96')],_0x34cd7e[_0x1bf6('0x97')]);}if(_0x1c3558){logger[_0x1bf6('0x99')](_0x1bf6('0x9a'),_0x17f59e[_0x1bf6('0x8a')]());require(_0x1bf6('0x9b'))[_0x1bf6('0x9c')](path[_0x1bf6('0x51')](__dirname,_0x1bf6('0x9d'),_0x1c3558[_0x1bf6('0x92')]),[_0x1c3558['id'],_0x17f59e['toString'](),path['join'](__dirname,_0x1bf6('0x9e'),_0x1c3558[_0x1bf6('0x9f')]),_0x35ade8]);return _0x1c3558;}else{var _0x121896=squel['select']();_0x121896[_0x1bf6('0x85')]('('+_0x17f59e['toString']()+')','countTable');_0x121896[_0x1bf6('0x64')](_0x1bf6('0xa0'),_0x1bf6('0x1a'));_0x17f59e[_0x1bf6('0x1c')](_0x34cd7e[_0x1bf6('0x1c')]||_0x3694d2);_0x17f59e[_0x1bf6('0x1b')](_0x34cd7e['offset']||0x0);return dbH[_0x1bf6('0x7c')]['query'](_0x121896[_0x1bf6('0x8a')](),{'type':dbH[_0x1bf6('0x7c')][_0x1bf6('0x7d')][_0x1bf6('0x8b')]})[_0x1bf6('0x20')](function(_0xce157c){if(!_0xce157c['length']){_0x41ebe2=0x0;}else{_0x41ebe2=_0xce157c[0x0][_0x1bf6('0x1a')]||0x0;}return dbH[_0x1bf6('0x7c')][_0x1bf6('0x31')](_0x17f59e[_0x1bf6('0x8a')](),{'type':dbH[_0x1bf6('0x7c')]['QueryTypes'][_0x1bf6('0x8b')]});})[_0x1bf6('0x20')](function(_0x163502){return{'rows':_0x163502||[],'count':_0x41ebe2};});}});}exports[_0x1bf6('0xa1')]=function(_0x328bd4,_0x342b60){return runReport(_0x328bd4[_0x1bf6('0x44')],_0x328bd4['query'],_0x328bd4[_0x1bf6('0x3e')])[_0x1bf6('0x20')](respondWithResult(_0x342b60,null))[_0x1bf6('0x43')](handleError(_0x342b60,null));};exports[_0x1bf6('0xa2')]=runReport;exports[_0x1bf6('0x31')]=function(_0xf64ddb,_0x2d4930){var _0x257f78=0xa;var _0xc840e0=['join',_0x1bf6('0xa3'),'right_join','cross_join'];var _0x12b5a6={'SUM':_0x1bf6('0x53'),'COUNT':_0x1bf6('0x54'),'COUNT DISTINCT':_0x1bf6('0x55'),'MAX':_0x1bf6('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x1bf6('0x7f'),'GROUP_CONCAT ASC':_0x1bf6('0x59'),'GROUP_CONCAT DESC':_0x1bf6('0x5a')};var _0x5da655={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1bf6('0x5b'),'HOUR':_0x1bf6('0x81'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x450c86=function(_0x1e16bf){return!_[_0x1bf6('0x5d')]([_0x1bf6('0x5e'),'IS\x20NOT\x20NULL',_0x1bf6('0x83'),'IS\x20NOT\x20EMPTY'],_0x1e16bf);};var _0x475621=function(_0x16e7d8){if(!_0x16e7d8||!_0x16e7d8[_0x1bf6('0x61')][_0x1bf6('0x45')]){return'';}for(var _0x3aab23='(',_0xe2ac56=0x0;_0xe2ac56<_0x16e7d8[_0x1bf6('0x61')][_0x1bf6('0x45')];_0xe2ac56+=0x1){_0xe2ac56>0x0&&(_0x3aab23+='\x20'+_0x16e7d8[_0x1bf6('0x62')]+'\x20');_0x3aab23+=_0x16e7d8[_0x1bf6('0x61')][_0xe2ac56][_0x1bf6('0x63')]?_0x475621(_0x16e7d8['rules'][_0xe2ac56][_0x1bf6('0x63')]):_0x16e7d8[_0x1bf6('0x61')][_0xe2ac56][_0x1bf6('0x64')]+'\x20'+_0x16e7d8[_0x1bf6('0x61')][_0xe2ac56][_0x1bf6('0x65')]+(_0x450c86(_0x16e7d8[_0x1bf6('0x61')][_0xe2ac56]['condition'])?'\x20'+_0x16e7d8['rules'][_0xe2ac56][_0x1bf6('0x66')]:'');}return _0x3aab23+')';};var _0x1ac02e={'where':{'id':_0xf64ddb[_0x1bf6('0x44')]['id']}},_0x469fcc,_0x313a04,_0x389285,_0xef2957,_0x41b070;_0x1ac02e=_[_0x1bf6('0x3d')]({},_0x1ac02e,_0xf64ddb[_0x1bf6('0x3e')]);return db[_0x1bf6('0x2a')][_0x1bf6('0x46')](_0x1ac02e)['then'](function(_0x166814){if(_0x166814){_0x469fcc=_0x166814;return _0x166814[_0x1bf6('0x67')]();}return null;})[_0x1bf6('0x20')](function(_0x5276e9){if(_0x5276e9){if(!_0x5276e9[_0x1bf6('0x45')]){throw new db[(_0x1bf6('0x8c'))][(_0x1bf6('0x68'))](_0x1bf6('0x69'),0x193);}_0x313a04=_0x5276e9;return db[_0x1bf6('0x6a')][_0x1bf6('0x41')]({'raw':!![]});}return null;})[_0x1bf6('0x20')](function(_0x541742){if(_0x541742){_0x389285=_[_0x1bf6('0x6b')](_0x541742,'id');var _0x14ad37;var _0x13e2f1=squel[_0x1bf6('0x84')]();_0x13e2f1[_0x1bf6('0x85')](_0x469fcc['table']);for(var _0x3bd4ba=0x0;_0x3bd4ba<_0x313a04[_0x1bf6('0x45')];_0x3bd4ba+=0x1){_0x14ad37=_0x313a04[_0x3bd4ba][_0x1bf6('0x6d')]?_0x389285[_0x313a04[_0x3bd4ba]['MetricId']][_0x1bf6('0x86')]:_0x313a04[_0x3bd4ba]['field'];_0x14ad37=_0x313a04[_0x3bd4ba][_0x1bf6('0x6e')]?_[_0x1bf6('0x6f')](_0x12b5a6[_0x313a04[_0x3bd4ba][_0x1bf6('0x6e')]],'%s',_0x14ad37):_0x14ad37;_0x14ad37=_0x313a04[_0x3bd4ba][_0x1bf6('0x77')]?_['replace'](_0x5da655[_0x313a04[_0x3bd4ba][_0x1bf6('0x77')]],'%s',_0x14ad37):_0x14ad37;if(_0x313a04[_0x3bd4ba][_0x1bf6('0x87')]){_0x13e2f1[_0x1bf6('0x63')](_0x14ad37);}_0x313a04[_0x3bd4ba][_0x1bf6('0x70')]&&_0x13e2f1['order'](_0x14ad37,_0x313a04[_0x3bd4ba][_0x1bf6('0x70')]===_0x1bf6('0x88')?![]:!![]);_0x13e2f1['field'](_0x14ad37,_0x313a04[_0x3bd4ba][_0x1bf6('0x71')]||_0x14ad37);}if(_0x469fcc[_0x1bf6('0x72')]){_0x469fcc[_0x1bf6('0x72')]=JSON[_0x1bf6('0x73')](_0x469fcc[_0x1bf6('0x72')]);for(var _0x1f69a9=0x0;_0x1f69a9<_0x469fcc[_0x1bf6('0x72')][_0x1bf6('0x45')];_0x1f69a9+=0x1){if(_0x469fcc[_0x1bf6('0x72')][_0x1f69a9][_0x1bf6('0x2d')]&&_[_0x1bf6('0x5d')](_0xc840e0,_0x469fcc[_0x1bf6('0x72')][_0x1f69a9][_0x1bf6('0x2d')])&&_0x469fcc[_0x1bf6('0x72')][_0x1f69a9]['parentKey']&&_0x469fcc[_0x1bf6('0x72')][_0x1f69a9]['foreignTable']&&_0x469fcc['joins'][_0x1f69a9][_0x1bf6('0x76')]){_0x13e2f1[_0x469fcc[_0x1bf6('0x72')][_0x1f69a9][_0x1bf6('0x2d')]](_0x469fcc[_0x1bf6('0x72')][_0x1f69a9]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x469fcc[_0x1bf6('0x6c')],_0x469fcc[_0x1bf6('0x72')][_0x1f69a9][_0x1bf6('0x74')],_0x469fcc['joins'][_0x1f69a9][_0x1bf6('0x75')],_0x469fcc[_0x1bf6('0x72')][_0x1f69a9][_0x1bf6('0x76')]));}}}if(_0x469fcc[_0x1bf6('0x79')]){_0x469fcc[_0x1bf6('0x79')]=JSON['parse'](_0x469fcc['conditions']);_0x13e2f1[_0x1bf6('0x3a')](_0x475621(_0x469fcc['conditions'][_0x1bf6('0x63')]));}_0x41b070=_0x13e2f1[_0x1bf6('0x7a')]();_0x13e2f1[_0x1bf6('0x1c')](_0x257f78);_0x13e2f1['offset'](0x0);logger[_0x1bf6('0x89')](_0x1bf6('0x7b'),_0x13e2f1[_0x1bf6('0x8a')]());return db[_0x1bf6('0x7c')][_0x1bf6('0x31')](_0x13e2f1[_0x1bf6('0x8a')](),{'type':db[_0x1bf6('0x7c')]['QueryTypes']['SELECT']});}})[_0x1bf6('0x20')](function(){return{'sql':_0x41b070[_0x1bf6('0x8a')]()};})[_0x1bf6('0x20')](respondWithResult(_0x2d4930,null))[_0x1bf6('0x43')](handleError(_0x2d4930,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index d1006a7..95fe27f 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x437660,_0x1c47ca){var _0x5771ef=function(_0x1a005a){while(--_0x1a005a){_0x437660['push'](_0x437660['shift']());}};_0x5771ef(++_0x1c47ca);}(_0x5fab,0x177));var _0xb5fa=function(_0xf58288,_0x35333c){_0xf58288=_0xf58288-0x0;var _0x196e87=_0x5fab[_0xf58288];return _0x196e87;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x3f994d,_0x249d72){var _0x5309b4=function(_0x545307){while(--_0x545307){_0x3f994d['push'](_0x3f994d['shift']());}};_0x5309b4(++_0x249d72);}(_0x7a54,0x106));var _0x47a5=function(_0x1fac8,_0x4d5e88){_0x1fac8=_0x1fac8-0x0;var _0x274927=_0x7a54[_0x1fac8];return _0x274927;};'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 47eb566..5b61f67 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 _0x8cc8=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x47fe90,_0x18792d){var _0x20572b=function(_0x56d2e2){while(--_0x56d2e2){_0x47fe90['push'](_0x47fe90['shift']());}};_0x20572b(++_0x18792d);}(_0x8cc8,0x177));var _0x88cc=function(_0x4b154c,_0x3874bc){_0x4b154c=_0x4b154c-0x0;var _0x5c0e8e=_0x8cc8[_0x4b154c];return _0x5c0e8e;};'use strict';var _=require(_0x88cc('0x0'));var util=require(_0x88cc('0x1'));var moment=require(_0x88cc('0x2'));var BPromise=require(_0x88cc('0x3'));var rs=require(_0x88cc('0x4'));var fs=require('fs');var Redis=require(_0x88cc('0x5'));var db=require(_0x88cc('0x6'))['db'];var utils=require(_0x88cc('0x7'));var logger=require(_0x88cc('0x8'))(_0x88cc('0x9'));var config=require(_0x88cc('0xa'));var jayson=require(_0x88cc('0xb'));var client=jayson[_0x88cc('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58bdd5,_0x3d35ed,_0x2db13a){return new BPromise(function(_0x219585,_0x4471b0){return client['request'](_0x58bdd5,_0x2db13a)[_0x88cc('0xd')](function(_0x2e77ae){logger['info'](_0x88cc('0xe'),_0x3d35ed,'request\x20sent');logger[_0x88cc('0xf')](_0x88cc('0x10'),_0x3d35ed,_0x88cc('0x11'),JSON[_0x88cc('0x12')](_0x2e77ae));if(_0x2e77ae['error']){if(_0x2e77ae[_0x88cc('0x13')][_0x88cc('0x14')]===0x1f4){logger[_0x88cc('0x13')](_0x88cc('0xe'),_0x3d35ed,_0x2e77ae[_0x88cc('0x13')][_0x88cc('0x15')]);return _0x4471b0(_0x2e77ae[_0x88cc('0x13')][_0x88cc('0x15')]);}logger['error'](_0x88cc('0xe'),_0x3d35ed,_0x2e77ae[_0x88cc('0x13')][_0x88cc('0x15')]);return _0x219585(_0x2e77ae[_0x88cc('0x13')][_0x88cc('0x15')]);}else{logger[_0x88cc('0x16')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d35ed,_0x88cc('0x11'));_0x219585(_0x2e77ae[_0x88cc('0x17')][_0x88cc('0x15')]);}})[_0x88cc('0x18')](function(_0x13ff73){logger['error'](_0x88cc('0xe'),_0x3d35ed,_0x13ff73);_0x4471b0(_0x13ff73);});});} \ No newline at end of file +var _0x3d7f=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','randomstring'];(function(_0x49aa99,_0x4ef618){var _0x1786d7=function(_0x302531){while(--_0x302531){_0x49aa99['push'](_0x49aa99['shift']());}};_0x1786d7(++_0x4ef618);}(_0x3d7f,0x1a1));var _0xf3d7=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x3d7f[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0xf3d7('0x0'));var util=require('util');var moment=require(_0xf3d7('0x1'));var BPromise=require('bluebird');var rs=require(_0xf3d7('0x2'));var fs=require('fs');var Redis=require(_0xf3d7('0x3'));var db=require(_0xf3d7('0x4'))['db'];var utils=require(_0xf3d7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf3d7('0x6'));var jayson=require(_0xf3d7('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe200,_0x17d875,_0x4fffe9){return new BPromise(function(_0x50fce6,_0x19c27d){return client[_0xf3d7('0x8')](_0x3fe200,_0x4fffe9)[_0xf3d7('0x9')](function(_0x2334e2){logger[_0xf3d7('0xa')](_0xf3d7('0xb'),_0x17d875,_0xf3d7('0xc'));logger[_0xf3d7('0xd')](_0xf3d7('0xe'),_0x17d875,_0xf3d7('0xc'),JSON[_0xf3d7('0xf')](_0x2334e2));if(_0x2334e2['error']){if(_0x2334e2['error'][_0xf3d7('0x10')]===0x1f4){logger[_0xf3d7('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x17d875,_0x2334e2[_0xf3d7('0x11')][_0xf3d7('0x12')]);return _0x19c27d(_0x2334e2[_0xf3d7('0x11')]['message']);}logger[_0xf3d7('0x11')](_0xf3d7('0xb'),_0x17d875,_0x2334e2[_0xf3d7('0x11')][_0xf3d7('0x12')]);return _0x50fce6(_0x2334e2[_0xf3d7('0x11')][_0xf3d7('0x12')]);}else{logger['info'](_0xf3d7('0xb'),_0x17d875,_0xf3d7('0xc'));_0x50fce6(_0x2334e2[_0xf3d7('0x13')][_0xf3d7('0x12')]);}})[_0xf3d7('0x14')](function(_0x2bfef5){logger[_0xf3d7('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x17d875,_0x2bfef5);_0x19c27d(_0x2bfef5);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 75ed757..1fd12c6 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 _0x9256=['isAuthenticated','index','show','/:id/preview','preview','/:id/run','/:id/query','post','create','put','/:id','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x37f85a,_0x240e20){var _0x190eeb=function(_0x2ae374){while(--_0x2ae374){_0x37f85a['push'](_0x37f85a['shift']());}};_0x190eeb(++_0x240e20);}(_0x9256,0x120));var _0x6925=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9256[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6925('0x0'));var util=require(_0x6925('0x1'));var path=require(_0x6925('0x2'));var timeout=require(_0x6925('0x3'));var express=require(_0x6925('0x4'));var router=express[_0x6925('0x5')]();var auth=require(_0x6925('0x6'));var interaction=require(_0x6925('0x7'));var config=require(_0x6925('0x8'));var controller=require(_0x6925('0x9'));router[_0x6925('0xa')]('/',auth[_0x6925('0xb')](),controller[_0x6925('0xc')]);router[_0x6925('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6925('0xd')]);router[_0x6925('0xa')](_0x6925('0xe'),auth['isAuthenticated'](),controller[_0x6925('0xf')]);router['get'](_0x6925('0x10'),auth[_0x6925('0xb')](),controller['run']);router[_0x6925('0xa')](_0x6925('0x11'),auth[_0x6925('0xb')](),controller['query']);router[_0x6925('0x12')]('/',auth[_0x6925('0xb')](),controller[_0x6925('0x13')]);router[_0x6925('0x14')](_0x6925('0x15'),auth[_0x6925('0xb')](),controller[_0x6925('0x16')]);router['delete'](_0x6925('0x15'),auth[_0x6925('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x060d=['index','get','/:id','show','/:id/preview','preview','/:id/run','/:id/query','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x060d,0x16d));var _0xd060=function(_0x59a186,_0x1d5746){_0x59a186=_0x59a186-0x0;var _0xcb7105=_0x060d[_0x59a186];return _0xcb7105;};'use strict';var multer=require(_0xd060('0x0'));var util=require(_0xd060('0x1'));var path=require('path');var timeout=require(_0xd060('0x2'));var express=require(_0xd060('0x3'));var router=express[_0xd060('0x4')]();var auth=require(_0xd060('0x5'));var interaction=require(_0xd060('0x6'));var config=require(_0xd060('0x7'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0xd060('0x8')](),controller[_0xd060('0x9')]);router[_0xd060('0xa')](_0xd060('0xb'),auth[_0xd060('0x8')](),controller[_0xd060('0xc')]);router[_0xd060('0xa')](_0xd060('0xd'),auth['isAuthenticated'](),controller[_0xd060('0xe')]);router[_0xd060('0xa')](_0xd060('0xf'),auth[_0xd060('0x8')](),controller['run']);router[_0xd060('0xa')](_0xd060('0x10'),auth[_0xd060('0x8')](),controller['query']);router['post']('/',auth[_0xd060('0x8')](),controller[_0xd060('0x11')]);router['put'](_0xd060('0xb'),auth[_0xd060('0x8')](),controller[_0xd060('0x12')]);router[_0xd060('0x13')](_0xd060('0xb'),auth[_0xd060('0x8')](),controller[_0xd060('0x14')]);module[_0xd060('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index a7f0798..68816a0 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 _0xeed5=['DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','moment','STRING','pdf','xlsx'];(function(_0x32a9a2,_0x1a31c5){var _0x598836=function(_0x16c158){while(--_0x16c158){_0x32a9a2['push'](_0x32a9a2['shift']());}};_0x598836(++_0x1a31c5);}(_0xeed5,0xe2));var _0x5eed=function(_0x40192b,_0x43bf7e){_0x40192b=_0x40192b-0x0;var _0x4c9e4f=_0xeed5[_0x40192b];return _0x4c9e4f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5eed('0x0'));module['exports']={'name':{'type':Sequelize[_0x5eed('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x5eed('0x2'),_0x5eed('0x3')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x5eed('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x5eed('0x4')]},'endDate':{'type':Sequelize[_0x5eed('0x4')]},'status':{'type':Sequelize[_0x5eed('0x1')],'defaultValue':_0x5eed('0x5')},'type':{'type':Sequelize['ENUM']('manual',_0x5eed('0x6')),'allowNull':![],'defaultValue':_0x5eed('0x7')},'reportId':{'type':Sequelize[_0x5eed('0x8')](0xb)[_0x5eed('0x9')]},'reportType':{'type':Sequelize[_0x5eed('0x1')]}}; \ No newline at end of file +var _0x2214=['manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2214,0x117));var _0x4221=function(_0x42b3d7,_0x55c529){_0x42b3d7=_0x42b3d7-0x0;var _0x15988a=_0x2214[_0x42b3d7];return _0x15988a;};'use strict';var Sequelize=require(_0x4221('0x0'));var moment=require(_0x4221('0x1'));module[_0x4221('0x2')]={'name':{'type':Sequelize[_0x4221('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x4221('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x4221('0x4')](_0x4221('0x5'),_0x4221('0x6'),_0x4221('0x7')),'allowNull':![],'defaultValue':_0x4221('0x5')},'savename':{'type':Sequelize[_0x4221('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x4221('0x8')]},'endDate':{'type':Sequelize[_0x4221('0x8')]},'status':{'type':Sequelize[_0x4221('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x4221('0x9'),_0x4221('0xa')),'allowNull':![],'defaultValue':_0x4221('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x4221('0xb')]},'reportType':{'type':Sequelize[_0x4221('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index cb2010d..615fc43 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 _0xfbeb=['intersection','fields','nolimit','order','sort','where','pick','filter','merge','type','count','includeAll','findAll','rows','catch','length','include','options','find','create','body','user','UserProfileSection','userProfileId','error','params','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','model','map','query','keys','filters','attributes'];(function(_0x4b68eb,_0x354dcb){var _0x5e0c4a=function(_0x2c0a81){while(--_0x2c0a81){_0x4b68eb['push'](_0x4b68eb['shift']());}};_0x5e0c4a(++_0x354dcb);}(_0xfbeb,0x18f));var _0xbfbe=function(_0x5eb442,_0xe2ae2e){_0x5eb442=_0x5eb442-0x0;var _0x53aad0=_0xfbeb[_0x5eb442];return _0x53aad0;};'use strict';var pdf=require(_0xbfbe('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbfbe('0x1'));var zipdir=require(_0xbfbe('0x2'));var jsonpatch=require(_0xbfbe('0x3'));var rp=require(_0xbfbe('0x4'));var moment=require(_0xbfbe('0x5'));var BPromise=require(_0xbfbe('0x6'));var Mustache=require(_0xbfbe('0x7'));var util=require(_0xbfbe('0x8'));var path=require('path');var sox=require(_0xbfbe('0x9'));var csv=require('to-csv');var ejs=require(_0xbfbe('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbfbe('0xb'));var crypto=require(_0xbfbe('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbfbe('0xd'));var toCsv=require(_0xbfbe('0xe'));var querystring=require(_0xbfbe('0xf'));var Papa=require('papaparse');var Redis=require(_0xbfbe('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfbe('0x11'));var logger=require(_0xbfbe('0x12'))(_0xbfbe('0x13'));var utils=require(_0xbfbe('0x14'));var config=require(_0xbfbe('0x15'));var db=require(_0xbfbe('0x16'))['db'];function respondWithStatusCode(_0x22eeaf,_0x2bef8c){_0x2bef8c=_0x2bef8c||0xcc;return function(_0xab6850){if(_0xab6850){return _0x22eeaf[_0xbfbe('0x17')](_0x2bef8c);}return _0x22eeaf[_0xbfbe('0x18')](_0x2bef8c)[_0xbfbe('0x19')]();};}function respondWithResult(_0x27d39a,_0x487303){_0x487303=_0x487303||0xc8;return function(_0x5b1b89){if(_0x5b1b89){return _0x27d39a['status'](_0x487303)['json'](_0x5b1b89);}};}function respondWithFilteredResult(_0x5dabed,_0x511a78){return function(_0x5f1723){if(_0x5f1723){var _0x56b16d=_0x5f1723['count'],_0xfb2234=_0x511a78['offset'],_0x217a43=_0x511a78[_0xbfbe('0x1a')]+_0x511a78[_0xbfbe('0x1b')],_0x14244f;if(_0x217a43>=_0x56b16d){_0x217a43=_0x56b16d;_0x14244f=0xc8;}else{_0x14244f=0xce;}_0x5dabed[_0xbfbe('0x18')](_0x14244f);return _0x5dabed['set'](_0xbfbe('0x1c'),_0xfb2234+'-'+_0x217a43+'/'+_0x56b16d)['json'](_0x5f1723);}return null;};}function patchUpdates(_0x10a5c7){return function(_0xff6723){try{jsonpatch[_0xbfbe('0x1d')](_0xff6723,_0x10a5c7,!![]);}catch(_0x344f49){return BPromise[_0xbfbe('0x1e')](_0x344f49);}return _0xff6723[_0xbfbe('0x1f')]();};}function saveUpdates(_0x7eb34b,_0x426bdf){return function(_0x1a4e4b){if(_0x1a4e4b){return _0x1a4e4b[_0xbfbe('0x20')](_0x7eb34b)[_0xbfbe('0x21')](function(_0x296874){return _0x296874;});}return null;};}function removeEntity(_0x1dd0a3,_0x33e352){return function(_0xaac30c){if(_0xaac30c){return _0xaac30c[_0xbfbe('0x22')]()['then'](function(){var _0x3a22b9=_0xaac30c[_0xbfbe('0x23')]({'plain':!![]});var _0x581910=_0xbfbe('0x24');return db[_0xbfbe('0x25')][_0xbfbe('0x22')]({'where':{'type':_0x581910,'resourceId':_0x3a22b9['id']}})[_0xbfbe('0x21')](function(){return _0xaac30c;});})[_0xbfbe('0x21')](function(){_0x1dd0a3[_0xbfbe('0x18')](0xcc)[_0xbfbe('0x19')]();});}};}function handleEntityNotFound(_0x4b9444,_0x213b12){return function(_0x57d57e){if(!_0x57d57e){_0x4b9444[_0xbfbe('0x17')](0x194);}return _0x57d57e;};}function handleError(_0xc470a1,_0x19311d){_0x19311d=_0x19311d||0x1f4;return function(_0x2aebe){logger['error'](_0x2aebe[_0xbfbe('0x26')]);if(_0x2aebe['name']){delete _0x2aebe[_0xbfbe('0x27')];}_0xc470a1[_0xbfbe('0x18')](_0x19311d)[_0xbfbe('0x28')](_0x2aebe);};}exports[_0xbfbe('0x29')]=function(_0x2dfa21,_0x34bd16){var _0x14afc6={},_0x1788bd={},_0x4dc14e={'count':0x0,'rows':[]};var _0x5ee1ef=_['map'](db[_0xbfbe('0x2a')][_0xbfbe('0x2b')],function(_0x1d47fd){return{'name':_0x1d47fd[_0xbfbe('0x2c')],'type':_0x1d47fd['type']['key']};});_0x1788bd[_0xbfbe('0x2d')]=_[_0xbfbe('0x2e')](_0x5ee1ef,_0xbfbe('0x27'));_0x1788bd[_0xbfbe('0x2f')]=_[_0xbfbe('0x30')](_0x2dfa21['query']);_0x1788bd[_0xbfbe('0x31')]=_['intersection'](_0x1788bd[_0xbfbe('0x2d')],_0x1788bd[_0xbfbe('0x2f')]);_0x14afc6[_0xbfbe('0x32')]=_[_0xbfbe('0x33')](_0x1788bd[_0xbfbe('0x2d')],qs[_0xbfbe('0x34')](_0x2dfa21['query'][_0xbfbe('0x34')]));_0x14afc6['attributes']=_0x14afc6['attributes']['length']?_0x14afc6[_0xbfbe('0x32')]:_0x1788bd[_0xbfbe('0x2d')];if(!_0x2dfa21[_0xbfbe('0x2f')]['hasOwnProperty'](_0xbfbe('0x35'))){_0x14afc6[_0xbfbe('0x1b')]=qs['limit'](_0x2dfa21[_0xbfbe('0x2f')][_0xbfbe('0x1b')]);_0x14afc6[_0xbfbe('0x1a')]=qs[_0xbfbe('0x1a')](_0x2dfa21['query']['offset']);}_0x14afc6[_0xbfbe('0x36')]=qs[_0xbfbe('0x37')](_0x2dfa21[_0xbfbe('0x2f')][_0xbfbe('0x37')]);_0x14afc6[_0xbfbe('0x38')]=qs['filters'](_[_0xbfbe('0x39')](_0x2dfa21[_0xbfbe('0x2f')],_0x1788bd[_0xbfbe('0x31')]),_0x5ee1ef);if(_0x2dfa21[_0xbfbe('0x2f')][_0xbfbe('0x3a')]){_0x14afc6[_0xbfbe('0x38')]=_[_0xbfbe('0x3b')](_0x14afc6[_0xbfbe('0x38')],{'$or':_[_0xbfbe('0x2e')](_0x5ee1ef,function(_0x26d58d){if(_0x26d58d[_0xbfbe('0x3c')]!=='VIRTUAL'){var _0x5d6cff={};_0x5d6cff[_0x26d58d[_0xbfbe('0x27')]]={'$like':'%'+_0x2dfa21[_0xbfbe('0x2f')][_0xbfbe('0x3a')]+'%'};return _0x5d6cff;}})});}_0x14afc6=_[_0xbfbe('0x3b')]({},_0x14afc6,_0x2dfa21['options']);var _0xc4d112={'where':_0x14afc6[_0xbfbe('0x38')]};return db['AnalyticExtractedReport'][_0xbfbe('0x3d')](_0xc4d112)[_0xbfbe('0x21')](function(_0x23757c){_0x4dc14e[_0xbfbe('0x3d')]=_0x23757c;if(_0x2dfa21[_0xbfbe('0x2f')][_0xbfbe('0x3e')]){_0x14afc6['include']=[{'all':!![]}];}return db[_0xbfbe('0x2a')][_0xbfbe('0x3f')](_0x14afc6);})[_0xbfbe('0x21')](function(_0x2224f4){_0x4dc14e[_0xbfbe('0x40')]=_0x2224f4;return _0x4dc14e;})[_0xbfbe('0x21')](respondWithFilteredResult(_0x34bd16,_0x14afc6))[_0xbfbe('0x41')](handleError(_0x34bd16,null));};exports['show']=function(_0x311c42,_0x1e2897){var _0x298ce0={'raw':!![],'where':{'id':_0x311c42['params']['id']}},_0x392c3b={};_0x392c3b[_0xbfbe('0x2d')]=_[_0xbfbe('0x30')](db['AnalyticExtractedReport'][_0xbfbe('0x2b')]);_0x392c3b[_0xbfbe('0x2f')]=_[_0xbfbe('0x30')](_0x311c42[_0xbfbe('0x2f')]);_0x392c3b[_0xbfbe('0x31')]=_['intersection'](_0x392c3b[_0xbfbe('0x2d')],_0x392c3b['query']);_0x298ce0[_0xbfbe('0x32')]=_[_0xbfbe('0x33')](_0x392c3b['model'],qs[_0xbfbe('0x34')](_0x311c42[_0xbfbe('0x2f')][_0xbfbe('0x34')]));_0x298ce0[_0xbfbe('0x32')]=_0x298ce0[_0xbfbe('0x32')][_0xbfbe('0x42')]?_0x298ce0[_0xbfbe('0x32')]:_0x392c3b[_0xbfbe('0x2d')];if(_0x311c42['query'][_0xbfbe('0x3e')]){_0x298ce0[_0xbfbe('0x43')]=[{'all':!![]}];}_0x298ce0=_['merge']({},_0x298ce0,_0x311c42[_0xbfbe('0x44')]);return db[_0xbfbe('0x2a')][_0xbfbe('0x45')](_0x298ce0)[_0xbfbe('0x21')](handleEntityNotFound(_0x1e2897,null))[_0xbfbe('0x21')](respondWithResult(_0x1e2897,null))[_0xbfbe('0x41')](handleError(_0x1e2897,null));};exports[_0xbfbe('0x46')]=function(_0xdc60e9,_0x2625e7){return db[_0xbfbe('0x2a')][_0xbfbe('0x46')](_0xdc60e9[_0xbfbe('0x47')],{})[_0xbfbe('0x21')](function(_0x1de0a8){var _0x50ff90=_0xdc60e9[_0xbfbe('0x48')][_0xbfbe('0x23')]({'plain':!![]});if(!_0x50ff90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50ff90['role']===_0xbfbe('0x48')){var _0x45fd13=_0x1de0a8[_0xbfbe('0x23')]({'plain':!![]});var _0x3c8689=_0xbfbe('0x24');return db[_0xbfbe('0x49')]['find']({'where':{'name':_0x3c8689,'userProfileId':_0x50ff90[_0xbfbe('0x4a')]},'raw':!![]})[_0xbfbe('0x21')](function(_0x700b83){if(_0x700b83&&_0x700b83['autoAssociation']===0x0){return db[_0xbfbe('0x25')][_0xbfbe('0x46')]({'name':_0x45fd13[_0xbfbe('0x27')],'resourceId':_0x45fd13['id'],'type':_0x700b83['name'],'sectionId':_0x700b83['id']},{})[_0xbfbe('0x21')](function(){return _0x1de0a8;});}else{return _0x1de0a8;}})[_0xbfbe('0x41')](function(_0x2f4152){logger[_0xbfbe('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f4152);throw _0x2f4152;});}return _0x1de0a8;})[_0xbfbe('0x21')](respondWithResult(_0x2625e7,0xc9))[_0xbfbe('0x41')](handleError(_0x2625e7,null));};exports[_0xbfbe('0x20')]=function(_0x13057d,_0x57b70c){if(_0x13057d[_0xbfbe('0x47')]['id']){delete _0x13057d[_0xbfbe('0x47')]['id'];}return db[_0xbfbe('0x2a')][_0xbfbe('0x45')]({'where':{'id':_0x13057d['params']['id']}})[_0xbfbe('0x21')](handleEntityNotFound(_0x57b70c,null))[_0xbfbe('0x21')](saveUpdates(_0x13057d[_0xbfbe('0x47')],null))[_0xbfbe('0x21')](respondWithResult(_0x57b70c,null))['catch'](handleError(_0x57b70c,null));};exports[_0xbfbe('0x22')]=function(_0x4cf388,_0x52efd0){return db[_0xbfbe('0x2a')][_0xbfbe('0x45')]({'where':{'id':_0x4cf388[_0xbfbe('0x4c')]['id']}})[_0xbfbe('0x21')](handleEntityNotFound(_0x52efd0,null))['then'](removeEntity(_0x52efd0,null))[_0xbfbe('0x41')](handleError(_0x52efd0,null));};exports[_0xbfbe('0x4d')]=function(_0x174f4d,_0x467e93,_0x30b0e9){return db[_0xbfbe('0x2a')][_0xbfbe('0x45')]({'where':{'id':_0x174f4d[_0xbfbe('0x4c')]['id']},'attributes':[_0xbfbe('0x27'),_0xbfbe('0x4e'),_0xbfbe('0x4f'),_0xbfbe('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x467e93,null))[_0xbfbe('0x21')](function(_0x432ff5){if(_0x432ff5){if(!fs[_0xbfbe('0x51')](path[_0xbfbe('0x52')](config['root'],_0xbfbe('0x53'),_0x432ff5['savename']))){throw new db[(_0xbfbe('0x54'))][(_0xbfbe('0x55'))](_0xbfbe('0x56'));}if(_0x174f4d[_0xbfbe('0x2f')][_0xbfbe('0x57')]){return _0x467e93[_0xbfbe('0x17')](0xc8);}return _0x467e93[_0xbfbe('0x4d')](path[_0xbfbe('0x52')](config['root'],_0xbfbe('0x53'),_0x432ff5['savename']),util[_0xbfbe('0x58')]('%s.%s',_0x432ff5['basename']||_0x432ff5['name'],_0x432ff5[_0xbfbe('0x50')][_0xbfbe('0x59')]()));}})[_0xbfbe('0x41')](handleError(_0x467e93,null));}; \ No newline at end of file +var _0x82d6=['set','Content-Range','json','apply','reject','save','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','key','model','query','keys','attributes','intersection','hasOwnProperty','nolimit','limit','sort','filters','pick','where','merge','type','filter','options','findAll','rows','show','fields','length','includeAll','include','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','exists','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x82d6,0x100));var _0x682d=function(_0xcf45d2,_0xc81c25){_0xcf45d2=_0xcf45d2-0x0;var _0x2873c1=_0x82d6[_0xcf45d2];return _0x2873c1;};'use strict';var pdf=require(_0x682d('0x0'));var emlformat=require(_0x682d('0x1'));var rimraf=require(_0x682d('0x2'));var zipdir=require(_0x682d('0x3'));var jsonpatch=require(_0x682d('0x4'));var rp=require(_0x682d('0x5'));var moment=require(_0x682d('0x6'));var BPromise=require(_0x682d('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x682d('0x8'));var sox=require(_0x682d('0x9'));var csv=require('to-csv');var ejs=require(_0x682d('0xa'));var fs=require('fs');var _=require(_0x682d('0xb'));var squel=require(_0x682d('0xc'));var crypto=require('crypto');var jsforce=require(_0x682d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x682d('0xe'));var Papa=require(_0x682d('0xf'));var Redis=require(_0x682d('0x10'));var authService=require(_0x682d('0x11'));var qs=require(_0x682d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x682d('0x13'))(_0x682d('0x14'));var utils=require(_0x682d('0x15'));var config=require(_0x682d('0x16'));var db=require(_0x682d('0x17'))['db'];function respondWithStatusCode(_0x2cc8f6,_0x300a33){_0x300a33=_0x300a33||0xcc;return function(_0x546113){if(_0x546113){return _0x2cc8f6[_0x682d('0x18')](_0x300a33);}return _0x2cc8f6[_0x682d('0x19')](_0x300a33)[_0x682d('0x1a')]();};}function respondWithResult(_0x46ffa1,_0x1c276c){_0x1c276c=_0x1c276c||0xc8;return function(_0x6ebac2){if(_0x6ebac2){return _0x46ffa1['status'](_0x1c276c)['json'](_0x6ebac2);}};}function respondWithFilteredResult(_0x3d1da9,_0x3ac8ad){return function(_0x246e82){if(_0x246e82){var _0x4a56bb=_0x246e82[_0x682d('0x1b')],_0x430ff2=_0x3ac8ad[_0x682d('0x1c')],_0x140227=_0x3ac8ad[_0x682d('0x1c')]+_0x3ac8ad['limit'],_0x31ee49;if(_0x140227>=_0x4a56bb){_0x140227=_0x4a56bb;_0x31ee49=0xc8;}else{_0x31ee49=0xce;}_0x3d1da9[_0x682d('0x19')](_0x31ee49);return _0x3d1da9[_0x682d('0x1d')](_0x682d('0x1e'),_0x430ff2+'-'+_0x140227+'/'+_0x4a56bb)[_0x682d('0x1f')](_0x246e82);}return null;};}function patchUpdates(_0x13e94c){return function(_0x1b0d7d){try{jsonpatch[_0x682d('0x20')](_0x1b0d7d,_0x13e94c,!![]);}catch(_0x4eb095){return BPromise[_0x682d('0x21')](_0x4eb095);}return _0x1b0d7d[_0x682d('0x22')]();};}function saveUpdates(_0x15bb7f,_0x524adb){return function(_0x592029){if(_0x592029){return _0x592029['update'](_0x15bb7f)[_0x682d('0x23')](function(_0x48a475){return _0x48a475;});}return null;};}function removeEntity(_0x2aae23,_0xbecd6){return function(_0x1551a4){if(_0x1551a4){return _0x1551a4[_0x682d('0x24')]()[_0x682d('0x23')](function(){var _0x1224b8=_0x1551a4['get']({'plain':!![]});var _0x2443e7=_0x682d('0x25');return db[_0x682d('0x26')]['destroy']({'where':{'type':_0x2443e7,'resourceId':_0x1224b8['id']}})[_0x682d('0x23')](function(){return _0x1551a4;});})[_0x682d('0x23')](function(){_0x2aae23[_0x682d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d32fc,_0x244d0b){return function(_0xf7f23){if(!_0xf7f23){_0x1d32fc[_0x682d('0x18')](0x194);}return _0xf7f23;};}function handleError(_0x484c51,_0xea87cc){_0xea87cc=_0xea87cc||0x1f4;return function(_0x5ac32c){logger[_0x682d('0x27')](_0x5ac32c[_0x682d('0x28')]);if(_0x5ac32c[_0x682d('0x29')]){delete _0x5ac32c['name'];}_0x484c51[_0x682d('0x19')](_0xea87cc)[_0x682d('0x2a')](_0x5ac32c);};}exports['index']=function(_0x5a7f9d,_0xaf40b){var _0x39a881={},_0x253fad={},_0x3f95ab={'count':0x0,'rows':[]};var _0x5d5ba9=_[_0x682d('0x2b')](db[_0x682d('0x2c')][_0x682d('0x2d')],function(_0x4b0b52){return{'name':_0x4b0b52['fieldName'],'type':_0x4b0b52['type'][_0x682d('0x2e')]};});_0x253fad[_0x682d('0x2f')]=_['map'](_0x5d5ba9,_0x682d('0x29'));_0x253fad[_0x682d('0x30')]=_[_0x682d('0x31')](_0x5a7f9d[_0x682d('0x30')]);_0x253fad['filters']=_['intersection'](_0x253fad[_0x682d('0x2f')],_0x253fad[_0x682d('0x30')]);_0x39a881[_0x682d('0x32')]=_[_0x682d('0x33')](_0x253fad[_0x682d('0x2f')],qs['fields'](_0x5a7f9d[_0x682d('0x30')]['fields']));_0x39a881[_0x682d('0x32')]=_0x39a881[_0x682d('0x32')]['length']?_0x39a881[_0x682d('0x32')]:_0x253fad[_0x682d('0x2f')];if(!_0x5a7f9d[_0x682d('0x30')][_0x682d('0x34')](_0x682d('0x35'))){_0x39a881[_0x682d('0x36')]=qs[_0x682d('0x36')](_0x5a7f9d[_0x682d('0x30')]['limit']);_0x39a881[_0x682d('0x1c')]=qs['offset'](_0x5a7f9d[_0x682d('0x30')][_0x682d('0x1c')]);}_0x39a881['order']=qs[_0x682d('0x37')](_0x5a7f9d[_0x682d('0x30')][_0x682d('0x37')]);_0x39a881['where']=qs[_0x682d('0x38')](_[_0x682d('0x39')](_0x5a7f9d['query'],_0x253fad[_0x682d('0x38')]),_0x5d5ba9);if(_0x5a7f9d[_0x682d('0x30')]['filter']){_0x39a881[_0x682d('0x3a')]=_[_0x682d('0x3b')](_0x39a881['where'],{'$or':_['map'](_0x5d5ba9,function(_0xa3a130){if(_0xa3a130[_0x682d('0x3c')]!=='VIRTUAL'){var _0x30bdd7={};_0x30bdd7[_0xa3a130['name']]={'$like':'%'+_0x5a7f9d[_0x682d('0x30')][_0x682d('0x3d')]+'%'};return _0x30bdd7;}})});}_0x39a881=_[_0x682d('0x3b')]({},_0x39a881,_0x5a7f9d[_0x682d('0x3e')]);var _0x4664d8={'where':_0x39a881[_0x682d('0x3a')]};return db[_0x682d('0x2c')][_0x682d('0x1b')](_0x4664d8)[_0x682d('0x23')](function(_0x58d4dd){_0x3f95ab[_0x682d('0x1b')]=_0x58d4dd;if(_0x5a7f9d[_0x682d('0x30')]['includeAll']){_0x39a881['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x682d('0x3f')](_0x39a881);})[_0x682d('0x23')](function(_0x32acb4){_0x3f95ab[_0x682d('0x40')]=_0x32acb4;return _0x3f95ab;})['then'](respondWithFilteredResult(_0xaf40b,_0x39a881))['catch'](handleError(_0xaf40b,null));};exports[_0x682d('0x41')]=function(_0x2a0e56,_0x2e265a){var _0x3eb74e={'raw':!![],'where':{'id':_0x2a0e56['params']['id']}},_0x2bbc65={};_0x2bbc65['model']=_[_0x682d('0x31')](db[_0x682d('0x2c')]['rawAttributes']);_0x2bbc65[_0x682d('0x30')]=_[_0x682d('0x31')](_0x2a0e56['query']);_0x2bbc65[_0x682d('0x38')]=_[_0x682d('0x33')](_0x2bbc65[_0x682d('0x2f')],_0x2bbc65['query']);_0x3eb74e[_0x682d('0x32')]=_[_0x682d('0x33')](_0x2bbc65[_0x682d('0x2f')],qs[_0x682d('0x42')](_0x2a0e56[_0x682d('0x30')][_0x682d('0x42')]));_0x3eb74e[_0x682d('0x32')]=_0x3eb74e[_0x682d('0x32')][_0x682d('0x43')]?_0x3eb74e[_0x682d('0x32')]:_0x2bbc65['model'];if(_0x2a0e56[_0x682d('0x30')][_0x682d('0x44')]){_0x3eb74e[_0x682d('0x45')]=[{'all':!![]}];}_0x3eb74e=_['merge']({},_0x3eb74e,_0x2a0e56[_0x682d('0x3e')]);return db[_0x682d('0x2c')][_0x682d('0x46')](_0x3eb74e)[_0x682d('0x23')](handleEntityNotFound(_0x2e265a,null))[_0x682d('0x23')](respondWithResult(_0x2e265a,null))[_0x682d('0x47')](handleError(_0x2e265a,null));};exports[_0x682d('0x48')]=function(_0x387b41,_0x3a62f0){return db['AnalyticExtractedReport'][_0x682d('0x48')](_0x387b41['body'],{})[_0x682d('0x23')](function(_0x20ab58){var _0x5e4344=_0x387b41[_0x682d('0x49')][_0x682d('0x4a')]({'plain':!![]});if(!_0x5e4344)throw new Error(_0x682d('0x4b'));if(_0x5e4344[_0x682d('0x4c')]===_0x682d('0x49')){var _0x554fed=_0x20ab58[_0x682d('0x4a')]({'plain':!![]});var _0x34975c=_0x682d('0x25');return db[_0x682d('0x4d')][_0x682d('0x46')]({'where':{'name':_0x34975c,'userProfileId':_0x5e4344[_0x682d('0x4e')]},'raw':!![]})[_0x682d('0x23')](function(_0x153b90){if(_0x153b90&&_0x153b90[_0x682d('0x4f')]===0x0){return db['UserProfileResource'][_0x682d('0x48')]({'name':_0x554fed[_0x682d('0x29')],'resourceId':_0x554fed['id'],'type':_0x153b90[_0x682d('0x29')],'sectionId':_0x153b90['id']},{})[_0x682d('0x23')](function(){return _0x20ab58;});}else{return _0x20ab58;}})[_0x682d('0x47')](function(_0x1d9aca){logger[_0x682d('0x27')](_0x682d('0x50'),_0x1d9aca);throw _0x1d9aca;});}return _0x20ab58;})[_0x682d('0x23')](respondWithResult(_0x3a62f0,0xc9))[_0x682d('0x47')](handleError(_0x3a62f0,null));};exports['update']=function(_0x520883,_0x4973b4){if(_0x520883[_0x682d('0x51')]['id']){delete _0x520883[_0x682d('0x51')]['id'];}return db[_0x682d('0x2c')][_0x682d('0x46')]({'where':{'id':_0x520883['params']['id']}})['then'](handleEntityNotFound(_0x4973b4,null))[_0x682d('0x23')](saveUpdates(_0x520883[_0x682d('0x51')],null))['then'](respondWithResult(_0x4973b4,null))[_0x682d('0x47')](handleError(_0x4973b4,null));};exports[_0x682d('0x24')]=function(_0x49e47a,_0x591103){return db[_0x682d('0x2c')][_0x682d('0x46')]({'where':{'id':_0x49e47a[_0x682d('0x52')]['id']}})[_0x682d('0x23')](handleEntityNotFound(_0x591103,null))[_0x682d('0x23')](removeEntity(_0x591103,null))[_0x682d('0x47')](handleError(_0x591103,null));};exports[_0x682d('0x53')]=function(_0x59bd98,_0x1fe25a,_0x25ef80){return db[_0x682d('0x2c')][_0x682d('0x46')]({'where':{'id':_0x59bd98[_0x682d('0x52')]['id']},'attributes':[_0x682d('0x29'),_0x682d('0x54'),_0x682d('0x55'),_0x682d('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x1fe25a,null))[_0x682d('0x23')](function(_0x58e44d){if(_0x58e44d){if(!fs['existsSync'](path[_0x682d('0x57')](config[_0x682d('0x58')],_0x682d('0x59'),_0x58e44d[_0x682d('0x55')]))){throw new db[(_0x682d('0x5a'))][(_0x682d('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x59bd98['query'][_0x682d('0x5c')]){return _0x1fe25a[_0x682d('0x18')](0xc8);}return _0x1fe25a[_0x682d('0x53')](path[_0x682d('0x57')](config['root'],_0x682d('0x59'),_0x58e44d['savename']),util['format'](_0x682d('0x5d'),_0x58e44d[_0x682d('0x54')]||_0x58e44d[_0x682d('0x29')],_0x58e44d[_0x682d('0x56')][_0x682d('0x5e')]()));}})['catch'](handleError(_0x1fe25a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b4fe41a..030ff10 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 _0x032d=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','lodash'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x032d,0x137));var _0xd032=function(_0x34ffea,_0x1a6761){_0x34ffea=_0x34ffea-0x0;var _0x48b48d=_0x032d[_0x34ffea];return _0x48b48d;};'use strict';var _=require(_0xd032('0x0'));var util=require(_0xd032('0x1'));var logger=require(_0xd032('0x2'))(_0xd032('0x3'));var moment=require(_0xd032('0x4'));var BPromise=require(_0xd032('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd032('0x6'));var rimraf=require(_0xd032('0x7'));var config=require(_0xd032('0x8'));var attributes=require(_0xd032('0x9'));module[_0xd032('0xa')]=function(_0x1b7e5e,_0xaaaa6){return _0x1b7e5e['define'](_0xd032('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e86=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x28a8e4,_0x91294a){var _0x127409=function(_0x2baff6){while(--_0x2baff6){_0x28a8e4['push'](_0x28a8e4['shift']());}};_0x127409(++_0x91294a);}(_0x3e86,0x157));var _0x63e8=function(_0x50d1f9,_0x414ff1){_0x50d1f9=_0x50d1f9-0x0;var _0x4e64da=_0x3e86[_0x50d1f9];return _0x4e64da;};'use strict';var _=require(_0x63e8('0x0'));var util=require(_0x63e8('0x1'));var logger=require(_0x63e8('0x2'))(_0x63e8('0x3'));var moment=require(_0x63e8('0x4'));var BPromise=require(_0x63e8('0x5'));var rp=require(_0x63e8('0x6'));var fs=require('fs');var path=require(_0x63e8('0x7'));var rimraf=require(_0x63e8('0x8'));var config=require(_0x63e8('0x9'));var attributes=require(_0x63e8('0xa'));module[_0x63e8('0xb')]=function(_0x43a4f7,_0xa1536){return _0x43a4f7['define'](_0x63e8('0xc'),attributes,{'tableName':_0x63e8('0xd'),'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 b17c291..18ec291 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 _0xbaf7=['../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','message','error','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x454629,_0x486c3f){var _0xb6121c=function(_0x14db28){while(--_0x14db28){_0x454629['push'](_0x454629['shift']());}};_0xb6121c(++_0x486c3f);}(_0xbaf7,0x142));var _0x7baf=function(_0x5f5cbb,_0xbd6e7){_0x5f5cbb=_0x5f5cbb-0x0;var _0x2b0c2f=_0xbaf7[_0x5f5cbb];return _0x2b0c2f;};'use strict';var _=require(_0x7baf('0x0'));var util=require(_0x7baf('0x1'));var moment=require(_0x7baf('0x2'));var BPromise=require('bluebird');var rs=require(_0x7baf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7baf('0x4'))['db'];var utils=require(_0x7baf('0x5'));var logger=require(_0x7baf('0x6'))(_0x7baf('0x7'));var config=require(_0x7baf('0x8'));var jayson=require(_0x7baf('0x9'));var client=jayson[_0x7baf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31bc70,_0x14c3c5,_0x13f367){return new BPromise(function(_0x495013,_0xaa39ef){return client[_0x7baf('0xb')](_0x31bc70,_0x13f367)[_0x7baf('0xc')](function(_0x3bbb18){logger[_0x7baf('0xd')](_0x7baf('0xe'),_0x14c3c5,_0x7baf('0xf'));logger[_0x7baf('0x10')](_0x7baf('0x11'),_0x14c3c5,_0x7baf('0xf'),JSON[_0x7baf('0x12')](_0x3bbb18));if(_0x3bbb18['error']){if(_0x3bbb18['error']['code']===0x1f4){logger['error'](_0x7baf('0xe'),_0x14c3c5,_0x3bbb18['error'][_0x7baf('0x13')]);return _0xaa39ef(_0x3bbb18['error'][_0x7baf('0x13')]);}logger[_0x7baf('0x14')](_0x7baf('0xe'),_0x14c3c5,_0x3bbb18[_0x7baf('0x14')][_0x7baf('0x13')]);return _0x495013(_0x3bbb18['error']['message']);}else{logger[_0x7baf('0xd')](_0x7baf('0xe'),_0x14c3c5,_0x7baf('0xf'));_0x495013(_0x3bbb18['result'][_0x7baf('0x13')]);}})[_0x7baf('0x15')](function(_0x382a20){logger[_0x7baf('0x14')](_0x7baf('0xe'),_0x14c3c5,_0x382a20);_0xaa39ef(_0x382a20);});});} \ No newline at end of file +var _0x6e76=['code','message','info','result','catch','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x54cd3f,_0x2d7378){var _0x344818=function(_0x5bc0bc){while(--_0x5bc0bc){_0x54cd3f['push'](_0x54cd3f['shift']());}};_0x344818(++_0x2d7378);}(_0x6e76,0x11d));var _0x66e7=function(_0x660c3b,_0x3c9ff2){_0x660c3b=_0x660c3b-0x0;var _0x36977d=_0x6e76[_0x660c3b];return _0x36977d;};'use strict';var _=require(_0x66e7('0x0'));var util=require(_0x66e7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x66e7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x66e7('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x66e7('0x4'));var jayson=require(_0x66e7('0x5'));var client=jayson[_0x66e7('0x6')][_0x66e7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x487d53,_0xe1875a,_0x567729){return new BPromise(function(_0x28ebb3,_0x489a28){return client[_0x66e7('0x8')](_0x487d53,_0x567729)[_0x66e7('0x9')](function(_0x431075){logger['info'](_0x66e7('0xa'),_0xe1875a,_0x66e7('0xb'));logger[_0x66e7('0xc')](_0x66e7('0xd'),_0xe1875a,'request\x20sent',JSON['stringify'](_0x431075));if(_0x431075['error']){if(_0x431075[_0x66e7('0xe')][_0x66e7('0xf')]===0x1f4){logger[_0x66e7('0xe')](_0x66e7('0xa'),_0xe1875a,_0x431075[_0x66e7('0xe')][_0x66e7('0x10')]);return _0x489a28(_0x431075['error']['message']);}logger[_0x66e7('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xe1875a,_0x431075['error'][_0x66e7('0x10')]);return _0x28ebb3(_0x431075[_0x66e7('0xe')]['message']);}else{logger[_0x66e7('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xe1875a,_0x66e7('0xb'));_0x28ebb3(_0x431075[_0x66e7('0x12')][_0x66e7('0x10')]);}})[_0x66e7('0x13')](function(_0x4711c7){logger['error'](_0x66e7('0xa'),_0xe1875a,_0x4711c7);_0x489a28(_0x4711c7);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 5f2e21b..49e807f 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 _0x3173=['show','download','post','create','put','update','destroy','exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated'];(function(_0x3bdbda,_0x2d813c){var _0x14abc5=function(_0xfcd5e4){while(--_0xfcd5e4){_0x3bdbda['push'](_0x3bdbda['shift']());}};_0x14abc5(++_0x2d813c);}(_0x3173,0x13a));var _0x3317=function(_0x1ff0a2,_0x4e4ab7){_0x1ff0a2=_0x1ff0a2-0x0;var _0x5129ca=_0x3173[_0x1ff0a2];return _0x5129ca;};'use strict';var multer=require(_0x3317('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3317('0x1'));var router=express['Router']();var auth=require(_0x3317('0x2'));var interaction=require(_0x3317('0x3'));var config=require(_0x3317('0x4'));var controller=require(_0x3317('0x5'));router[_0x3317('0x6')]('/',auth['isAuthenticated'](),controller[_0x3317('0x7')]);router[_0x3317('0x6')](_0x3317('0x8'),auth[_0x3317('0x9')](),controller[_0x3317('0xa')]);router[_0x3317('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x3317('0xb')]);router[_0x3317('0xc')]('/',auth[_0x3317('0x9')](),controller[_0x3317('0xd')]);router[_0x3317('0xe')]('/:id',auth[_0x3317('0x9')](),controller[_0x3317('0xf')]);router['delete'](_0x3317('0x8'),auth[_0x3317('0x9')](),controller[_0x3317('0x10')]);module[_0x3317('0x11')]=router; \ No newline at end of file +var _0xc064=['index','/:id','show','get','download','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated'];(function(_0x57436f,_0x943c45){var _0x3709d8=function(_0x15a324){while(--_0x15a324){_0x57436f['push'](_0x57436f['shift']());}};_0x3709d8(++_0x943c45);}(_0xc064,0x174));var _0x4c06=function(_0x40d013,_0x2edeaf){_0x40d013=_0x40d013-0x0;var _0x2eec2c=_0xc064[_0x40d013];return _0x2eec2c;};'use strict';var multer=require(_0x4c06('0x0'));var util=require(_0x4c06('0x1'));var path=require('path');var timeout=require(_0x4c06('0x2'));var express=require(_0x4c06('0x3'));var router=express[_0x4c06('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4c06('0x5'));var config=require('../../config/environment');var controller=require(_0x4c06('0x6'));router['get']('/',auth[_0x4c06('0x7')](),controller[_0x4c06('0x8')]);router['get'](_0x4c06('0x9'),auth[_0x4c06('0x7')](),controller[_0x4c06('0xa')]);router[_0x4c06('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x4c06('0xc')]);router[_0x4c06('0xd')]('/',auth['isAuthenticated'](),controller[_0x4c06('0xe')]);router[_0x4c06('0xf')](_0x4c06('0x9'),auth[_0x4c06('0x7')](),controller[_0x4c06('0x10')]);router[_0x4c06('0x11')](_0x4c06('0x9'),auth['isAuthenticated'](),controller[_0x4c06('0x12')]);module[_0x4c06('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 28c6f6c..d46b56e 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 _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x3881bf,_0x1b016){var _0x539015=function(_0x5a5aea){while(--_0x5a5aea){_0x3881bf['push'](_0x3881bf['shift']());}};_0x539015(++_0x1b016);}(_0x814b,0x1a2));var _0xb814=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x814b[_0x2468b5];return _0x1056e4;};'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 +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x57d867,_0x2ee50b){var _0x33d270=function(_0x43a7b5){while(--_0x43a7b5){_0x57d867['push'](_0x57d867['shift']());}};_0x33d270(++_0x2ee50b);}(_0x814b,0x1a2));var _0xb814=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0x814b[_0x2f6233];return _0x1c9c36;};'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 309df7c..cfa05aa 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 _0xbeff=['end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','AnalyticFieldReport','includeAll','show','params','length','include','find','create','body','catch','bulkCreate','destroy','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0xbeff,0x13e));var _0xfbef=function(_0x3fe651,_0x416b77){_0x3fe651=_0x3fe651-0x0;var _0x545d94=_0xbeff[_0x3fe651];return _0x545d94;};'use strict';var pdf=require(_0xfbef('0x0'));var emlformat=require(_0xfbef('0x1'));var rimraf=require(_0xfbef('0x2'));var zipdir=require(_0xfbef('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbef('0x4'));var moment=require(_0xfbef('0x5'));var BPromise=require(_0xfbef('0x6'));var Mustache=require(_0xfbef('0x7'));var util=require(_0xfbef('0x8'));var path=require(_0xfbef('0x9'));var sox=require(_0xfbef('0xa'));var csv=require(_0xfbef('0xb'));var ejs=require(_0xfbef('0xc'));var fs=require('fs');var _=require(_0xfbef('0xd'));var squel=require(_0xfbef('0xe'));var crypto=require(_0xfbef('0xf'));var jsforce=require(_0xfbef('0x10'));var deskjs=require(_0xfbef('0x11'));var toCsv=require('to-csv');var querystring=require(_0xfbef('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfbef('0x13'));var qs=require(_0xfbef('0x14'));var as=require(_0xfbef('0x15'));var hardwareService=require(_0xfbef('0x16'));var logger=require(_0xfbef('0x17'))(_0xfbef('0x18'));var utils=require(_0xfbef('0x19'));var config=require(_0xfbef('0x1a'));var db=require(_0xfbef('0x1b'))['db'];function respondWithStatusCode(_0x4d9dd4,_0x28df2d){_0x28df2d=_0x28df2d||0xcc;return function(_0x13f4e2){if(_0x13f4e2){return _0x4d9dd4[_0xfbef('0x1c')](_0x28df2d);}return _0x4d9dd4[_0xfbef('0x1d')](_0x28df2d)[_0xfbef('0x1e')]();};}function respondWithResult(_0x50fee5,_0x200f5e){_0x200f5e=_0x200f5e||0xc8;return function(_0x44d2a7){if(_0x44d2a7){return _0x50fee5[_0xfbef('0x1d')](_0x200f5e)[_0xfbef('0x1f')](_0x44d2a7);}};}function respondWithFilteredResult(_0x3f3963,_0x1f4b3f){return function(_0x4549b2){if(_0x4549b2){var _0xb7f745=_0x4549b2[_0xfbef('0x20')],_0xb1c31a=_0x1f4b3f[_0xfbef('0x21')],_0xc2616d=_0x1f4b3f['offset']+_0x1f4b3f['limit'],_0x40e77d;if(_0xc2616d>=_0xb7f745){_0xc2616d=_0xb7f745;_0x40e77d=0xc8;}else{_0x40e77d=0xce;}_0x3f3963[_0xfbef('0x1d')](_0x40e77d);return _0x3f3963[_0xfbef('0x22')](_0xfbef('0x23'),_0xb1c31a+'-'+_0xc2616d+'/'+_0xb7f745)[_0xfbef('0x1f')](_0x4549b2);}return null;};}function patchUpdates(_0x39a345){return function(_0x371af4){try{jsonpatch[_0xfbef('0x24')](_0x371af4,_0x39a345,!![]);}catch(_0x26b8c0){return BPromise[_0xfbef('0x25')](_0x26b8c0);}return _0x371af4[_0xfbef('0x26')]();};}function saveUpdates(_0x471df0,_0x5369f1){return function(_0x475599){if(_0x475599){return _0x475599[_0xfbef('0x27')](_0x471df0)[_0xfbef('0x28')](function(_0x1f6750){return _0x1f6750;});}return null;};}function removeEntity(_0x428ad8,_0x2cfc47){return function(_0x461941){if(_0x461941){return _0x461941['destroy']()['then'](function(){_0x428ad8[_0xfbef('0x1d')](0xcc)[_0xfbef('0x1e')]();});}};}function handleEntityNotFound(_0x242c2e,_0x344626){return function(_0xb99935){if(!_0xb99935){_0x242c2e[_0xfbef('0x1c')](0x194);}return _0xb99935;};}function handleError(_0x19cddb,_0x3fac85){_0x3fac85=_0x3fac85||0x1f4;return function(_0x486773){logger[_0xfbef('0x29')](_0x486773[_0xfbef('0x2a')]);if(_0x486773[_0xfbef('0x2b')]){delete _0x486773['name'];}_0x19cddb['status'](_0x3fac85)[_0xfbef('0x2c')](_0x486773);};}exports[_0xfbef('0x2d')]=function(_0x3b5646,_0x1573fa){var _0x492b51={},_0x341ee2={},_0x407184={'count':0x0,'rows':[]};var _0x56ae04=_[_0xfbef('0x2e')](db['AnalyticFieldReport'][_0xfbef('0x2f')],function(_0x180d3f){return{'name':_0x180d3f[_0xfbef('0x30')],'type':_0x180d3f['type'][_0xfbef('0x31')]};});_0x341ee2[_0xfbef('0x32')]=_[_0xfbef('0x2e')](_0x56ae04,_0xfbef('0x2b'));_0x341ee2[_0xfbef('0x33')]=_[_0xfbef('0x34')](_0x3b5646[_0xfbef('0x33')]);_0x341ee2[_0xfbef('0x35')]=_[_0xfbef('0x36')](_0x341ee2['model'],_0x341ee2[_0xfbef('0x33')]);_0x492b51[_0xfbef('0x37')]=_[_0xfbef('0x36')](_0x341ee2['model'],qs[_0xfbef('0x38')](_0x3b5646['query'][_0xfbef('0x38')]));_0x492b51[_0xfbef('0x37')]=_0x492b51['attributes']['length']?_0x492b51[_0xfbef('0x37')]:_0x341ee2['model'];if(!_0x3b5646[_0xfbef('0x33')][_0xfbef('0x39')](_0xfbef('0x3a'))){_0x492b51[_0xfbef('0x3b')]=qs['limit'](_0x3b5646['query']['limit']);_0x492b51[_0xfbef('0x21')]=qs[_0xfbef('0x21')](_0x3b5646['query'][_0xfbef('0x21')]);}_0x492b51[_0xfbef('0x3c')]=qs[_0xfbef('0x3d')](_0x3b5646['query']['sort']);_0x492b51['where']=qs[_0xfbef('0x35')](_[_0xfbef('0x3e')](_0x3b5646[_0xfbef('0x33')],_0x341ee2['filters']),_0x56ae04);if(_0x3b5646[_0xfbef('0x33')][_0xfbef('0x3f')]){_0x492b51[_0xfbef('0x40')]=_[_0xfbef('0x41')](_0x492b51[_0xfbef('0x40')],{'$or':_[_0xfbef('0x2e')](_0x56ae04,function(_0x34e246){if(_0x34e246['type']!=='VIRTUAL'){var _0x128c35={};_0x128c35[_0x34e246[_0xfbef('0x2b')]]={'$like':'%'+_0x3b5646['query'][_0xfbef('0x3f')]+'%'};return _0x128c35;}})});}_0x492b51=_[_0xfbef('0x41')]({},_0x492b51,_0x3b5646[_0xfbef('0x42')]);var _0x2efb39={'where':_0x492b51[_0xfbef('0x40')]};return db[_0xfbef('0x43')][_0xfbef('0x20')](_0x2efb39)[_0xfbef('0x28')](function(_0xe82946){_0x407184['count']=_0xe82946;if(_0x3b5646['query'][_0xfbef('0x44')]){_0x492b51['include']=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x492b51);})[_0xfbef('0x28')](function(_0xeb3157){_0x407184['rows']=_0xeb3157;return _0x407184;})[_0xfbef('0x28')](respondWithFilteredResult(_0x1573fa,_0x492b51))['catch'](handleError(_0x1573fa,null));};exports[_0xfbef('0x45')]=function(_0x1af6eb,_0x20cf74){var _0x103984={'raw':![],'where':{'id':_0x1af6eb[_0xfbef('0x46')]['id']}},_0x5841d2={};_0x5841d2[_0xfbef('0x32')]=_['keys'](db['AnalyticFieldReport'][_0xfbef('0x2f')]);_0x5841d2[_0xfbef('0x33')]=_[_0xfbef('0x34')](_0x1af6eb['query']);_0x5841d2['filters']=_[_0xfbef('0x36')](_0x5841d2[_0xfbef('0x32')],_0x5841d2[_0xfbef('0x33')]);_0x103984[_0xfbef('0x37')]=_[_0xfbef('0x36')](_0x5841d2[_0xfbef('0x32')],qs[_0xfbef('0x38')](_0x1af6eb[_0xfbef('0x33')][_0xfbef('0x38')]));_0x103984['attributes']=_0x103984['attributes'][_0xfbef('0x47')]?_0x103984[_0xfbef('0x37')]:_0x5841d2[_0xfbef('0x32')];if(_0x1af6eb[_0xfbef('0x33')][_0xfbef('0x44')]){_0x103984[_0xfbef('0x48')]=[{'all':!![]}];}_0x103984=_[_0xfbef('0x41')]({},_0x103984,_0x1af6eb[_0xfbef('0x42')]);return db[_0xfbef('0x43')][_0xfbef('0x49')](_0x103984)[_0xfbef('0x28')](handleEntityNotFound(_0x20cf74,null))[_0xfbef('0x28')](respondWithResult(_0x20cf74,null))['catch'](handleError(_0x20cf74,null));};exports[_0xfbef('0x4a')]=function(_0x21a517,_0x2672f9){return db[_0xfbef('0x43')][_0xfbef('0x4a')](_0x21a517[_0xfbef('0x4b')],{})[_0xfbef('0x28')](respondWithResult(_0x2672f9,0xc9))[_0xfbef('0x4c')](handleError(_0x2672f9,null));};exports[_0xfbef('0x4d')]=function(_0x5519d2,_0xa8e45a){return db[_0xfbef('0x43')][_0xfbef('0x4d')](_0x5519d2[_0xfbef('0x4b')],{'raw':![],'individualHooks':!![]})[_0xfbef('0x28')](respondWithResult(_0xa8e45a,0xc9))['catch'](handleError(_0xa8e45a,null));};exports[_0xfbef('0x27')]=function(_0x27e9de,_0x43afad){if(_0x27e9de['body']['id']){delete _0x27e9de[_0xfbef('0x4b')]['id'];}return db[_0xfbef('0x43')]['find']({'where':{'id':_0x27e9de[_0xfbef('0x46')]['id']}})[_0xfbef('0x28')](handleEntityNotFound(_0x43afad,null))[_0xfbef('0x28')](saveUpdates(_0x27e9de[_0xfbef('0x4b')],null))['then'](respondWithResult(_0x43afad,null))[_0xfbef('0x4c')](handleError(_0x43afad,null));};exports[_0xfbef('0x4e')]=function(_0x564912,_0x443f62){return db[_0xfbef('0x43')][_0xfbef('0x49')]({'where':{'id':_0x564912[_0xfbef('0x46')]['id']}})[_0xfbef('0x28')](handleEntityNotFound(_0x443f62,null))[_0xfbef('0x28')](removeEntity(_0x443f62,null))[_0xfbef('0x4c')](handleError(_0x443f62,null));};exports[_0xfbef('0x4f')]=function(_0x12cdeb,_0xe32ec4){return db[_0xfbef('0x43')]['destroy']({'where':{'id':_0x12cdeb['query'][_0xfbef('0x50')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xe32ec4,0xcc))[_0xfbef('0x4c')](handleError(_0xe32ec4,null));};exports['addFields']=function(_0x4f15d9,_0x50c3af,_0x441f15){return db[_0xfbef('0x51')][_0xfbef('0x52')]({'where':{'id':_0x4f15d9[_0xfbef('0x46')]['id']}})['then'](handleEntityNotFound(_0x50c3af,null))[_0xfbef('0x28')](function(_0x16b433){if(_0x16b433){return db[_0xfbef('0x53')][_0xfbef('0x54')](function(_0x2f3b5f){return db[_0xfbef('0x43')][_0xfbef('0x4e')]({'where':{'CustomReportId':_0x4f15d9[_0xfbef('0x46')]['id']},'transaction':_0x2f3b5f})[_0xfbef('0x28')](function(_0x386b53){var _0x288e86=_[_0xfbef('0x2e')](_0x4f15d9[_0xfbef('0x4b')],function(_0x209c5f){delete _0x209c5f['id'];_0x209c5f[_0xfbef('0x55')]=_0x4f15d9[_0xfbef('0x46')]['id'];return _0x209c5f;});return db[_0xfbef('0x43')][_0xfbef('0x4d')](_0x288e86,{'transaction':_0x2f3b5f});});})['then'](function(){return db[_0xfbef('0x43')][_0xfbef('0x56')]({'where':{'CustomReportId':_0x4f15d9[_0xfbef('0x46')]['id']}});});}})[_0xfbef('0x28')](respondWithResult(_0x50c3af,null))['catch'](handleError(_0x50c3af,null));}; \ No newline at end of file +var _0xbf65=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','params','includeAll','find','create','bulkCreate','body','catch','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','findAll','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','name','index','map','AnalyticFieldReport','rawAttributes','type','model','keys','query','filters','intersection'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xbf65,0xb5));var _0x5bf6=function(_0x2542d1,_0xdb7645){_0x2542d1=_0x2542d1-0x0;var _0xec2ce7=_0xbf65[_0x2542d1];return _0xec2ce7;};'use strict';var pdf=require(_0x5bf6('0x0'));var emlformat=require(_0x5bf6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5bf6('0x2'));var jsonpatch=require(_0x5bf6('0x3'));var rp=require('request-promise');var moment=require(_0x5bf6('0x4'));var BPromise=require(_0x5bf6('0x5'));var Mustache=require(_0x5bf6('0x6'));var util=require(_0x5bf6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5bf6('0x8'));var ejs=require(_0x5bf6('0x9'));var fs=require('fs');var _=require(_0x5bf6('0xa'));var squel=require(_0x5bf6('0xb'));var crypto=require(_0x5bf6('0xc'));var jsforce=require(_0x5bf6('0xd'));var deskjs=require(_0x5bf6('0xe'));var toCsv=require(_0x5bf6('0x8'));var querystring=require('querystring');var Papa=require(_0x5bf6('0xf'));var Redis=require(_0x5bf6('0x10'));var authService=require(_0x5bf6('0x11'));var qs=require(_0x5bf6('0x12'));var as=require(_0x5bf6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bf6('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5bf6('0x15'))['db'];function respondWithStatusCode(_0x401175,_0x46508a){_0x46508a=_0x46508a||0xcc;return function(_0x3720a0){if(_0x3720a0){return _0x401175['sendStatus'](_0x46508a);}return _0x401175[_0x5bf6('0x16')](_0x46508a)[_0x5bf6('0x17')]();};}function respondWithResult(_0x578203,_0x55a93a){_0x55a93a=_0x55a93a||0xc8;return function(_0x31ed60){if(_0x31ed60){return _0x578203[_0x5bf6('0x16')](_0x55a93a)[_0x5bf6('0x18')](_0x31ed60);}};}function respondWithFilteredResult(_0x568704,_0x40ba10){return function(_0xf02880){if(_0xf02880){var _0x575e17=_0xf02880[_0x5bf6('0x19')],_0x53e900=_0x40ba10[_0x5bf6('0x1a')],_0x1fdc6c=_0x40ba10['offset']+_0x40ba10[_0x5bf6('0x1b')],_0x253529;if(_0x1fdc6c>=_0x575e17){_0x1fdc6c=_0x575e17;_0x253529=0xc8;}else{_0x253529=0xce;}_0x568704[_0x5bf6('0x16')](_0x253529);return _0x568704[_0x5bf6('0x1c')](_0x5bf6('0x1d'),_0x53e900+'-'+_0x1fdc6c+'/'+_0x575e17)[_0x5bf6('0x18')](_0xf02880);}return null;};}function patchUpdates(_0x5b64e5){return function(_0x5811d6){try{jsonpatch['apply'](_0x5811d6,_0x5b64e5,!![]);}catch(_0x2a1b95){return BPromise[_0x5bf6('0x1e')](_0x2a1b95);}return _0x5811d6['save']();};}function saveUpdates(_0x54440a,_0xadc39e){return function(_0x4f393a){if(_0x4f393a){return _0x4f393a[_0x5bf6('0x1f')](_0x54440a)[_0x5bf6('0x20')](function(_0x147940){return _0x147940;});}return null;};}function removeEntity(_0x10d2df,_0x4e2a1e){return function(_0xbd25fd){if(_0xbd25fd){return _0xbd25fd[_0x5bf6('0x21')]()[_0x5bf6('0x20')](function(){_0x10d2df[_0x5bf6('0x16')](0xcc)[_0x5bf6('0x17')]();});}};}function handleEntityNotFound(_0x1964c3,_0x238bfa){return function(_0x1df590){if(!_0x1df590){_0x1964c3[_0x5bf6('0x22')](0x194);}return _0x1df590;};}function handleError(_0xc559c2,_0x34ea03){_0x34ea03=_0x34ea03||0x1f4;return function(_0x461292){logger[_0x5bf6('0x23')](_0x461292['stack']);if(_0x461292[_0x5bf6('0x24')]){delete _0x461292[_0x5bf6('0x24')];}_0xc559c2[_0x5bf6('0x16')](_0x34ea03)['send'](_0x461292);};}exports[_0x5bf6('0x25')]=function(_0x3c8e20,_0x2b92fe){var _0x5b651f={},_0x23579b={},_0x3f05a6={'count':0x0,'rows':[]};var _0x7ef62f=_[_0x5bf6('0x26')](db[_0x5bf6('0x27')][_0x5bf6('0x28')],function(_0x5c3d85){return{'name':_0x5c3d85['fieldName'],'type':_0x5c3d85[_0x5bf6('0x29')]['key']};});_0x23579b[_0x5bf6('0x2a')]=_[_0x5bf6('0x26')](_0x7ef62f,_0x5bf6('0x24'));_0x23579b['query']=_[_0x5bf6('0x2b')](_0x3c8e20[_0x5bf6('0x2c')]);_0x23579b[_0x5bf6('0x2d')]=_[_0x5bf6('0x2e')](_0x23579b[_0x5bf6('0x2a')],_0x23579b[_0x5bf6('0x2c')]);_0x5b651f[_0x5bf6('0x2f')]=_['intersection'](_0x23579b['model'],qs['fields'](_0x3c8e20[_0x5bf6('0x2c')][_0x5bf6('0x30')]));_0x5b651f['attributes']=_0x5b651f['attributes'][_0x5bf6('0x31')]?_0x5b651f['attributes']:_0x23579b[_0x5bf6('0x2a')];if(!_0x3c8e20['query'][_0x5bf6('0x32')](_0x5bf6('0x33'))){_0x5b651f[_0x5bf6('0x1b')]=qs[_0x5bf6('0x1b')](_0x3c8e20['query']['limit']);_0x5b651f['offset']=qs[_0x5bf6('0x1a')](_0x3c8e20[_0x5bf6('0x2c')][_0x5bf6('0x1a')]);}_0x5b651f[_0x5bf6('0x34')]=qs['sort'](_0x3c8e20[_0x5bf6('0x2c')][_0x5bf6('0x35')]);_0x5b651f['where']=qs[_0x5bf6('0x2d')](_[_0x5bf6('0x36')](_0x3c8e20[_0x5bf6('0x2c')],_0x23579b[_0x5bf6('0x2d')]),_0x7ef62f);if(_0x3c8e20['query'][_0x5bf6('0x37')]){_0x5b651f[_0x5bf6('0x38')]=_[_0x5bf6('0x39')](_0x5b651f[_0x5bf6('0x38')],{'$or':_[_0x5bf6('0x26')](_0x7ef62f,function(_0x2afaf4){if(_0x2afaf4[_0x5bf6('0x29')]!==_0x5bf6('0x3a')){var _0x5e0620={};_0x5e0620[_0x2afaf4[_0x5bf6('0x24')]]={'$like':'%'+_0x3c8e20['query'][_0x5bf6('0x37')]+'%'};return _0x5e0620;}})});}_0x5b651f=_[_0x5bf6('0x39')]({},_0x5b651f,_0x3c8e20[_0x5bf6('0x3b')]);var _0x247e56={'where':_0x5b651f['where']};return db[_0x5bf6('0x27')][_0x5bf6('0x19')](_0x247e56)['then'](function(_0x613a0b){_0x3f05a6['count']=_0x613a0b;if(_0x3c8e20[_0x5bf6('0x2c')]['includeAll']){_0x5b651f[_0x5bf6('0x3c')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x5b651f);})[_0x5bf6('0x20')](function(_0x5b4202){_0x3f05a6[_0x5bf6('0x3d')]=_0x5b4202;return _0x3f05a6;})[_0x5bf6('0x20')](respondWithFilteredResult(_0x2b92fe,_0x5b651f))['catch'](handleError(_0x2b92fe,null));};exports['show']=function(_0x16a7f3,_0x123f15){var _0x54f61f={'raw':![],'where':{'id':_0x16a7f3[_0x5bf6('0x3e')]['id']}},_0x4da9d8={};_0x4da9d8[_0x5bf6('0x2a')]=_[_0x5bf6('0x2b')](db[_0x5bf6('0x27')][_0x5bf6('0x28')]);_0x4da9d8[_0x5bf6('0x2c')]=_['keys'](_0x16a7f3[_0x5bf6('0x2c')]);_0x4da9d8[_0x5bf6('0x2d')]=_[_0x5bf6('0x2e')](_0x4da9d8[_0x5bf6('0x2a')],_0x4da9d8[_0x5bf6('0x2c')]);_0x54f61f[_0x5bf6('0x2f')]=_['intersection'](_0x4da9d8[_0x5bf6('0x2a')],qs[_0x5bf6('0x30')](_0x16a7f3['query'][_0x5bf6('0x30')]));_0x54f61f[_0x5bf6('0x2f')]=_0x54f61f['attributes'][_0x5bf6('0x31')]?_0x54f61f[_0x5bf6('0x2f')]:_0x4da9d8['model'];if(_0x16a7f3[_0x5bf6('0x2c')][_0x5bf6('0x3f')]){_0x54f61f['include']=[{'all':!![]}];}_0x54f61f=_['merge']({},_0x54f61f,_0x16a7f3[_0x5bf6('0x3b')]);return db[_0x5bf6('0x27')][_0x5bf6('0x40')](_0x54f61f)[_0x5bf6('0x20')](handleEntityNotFound(_0x123f15,null))[_0x5bf6('0x20')](respondWithResult(_0x123f15,null))['catch'](handleError(_0x123f15,null));};exports[_0x5bf6('0x41')]=function(_0x350b58,_0x2480e0){return db[_0x5bf6('0x27')][_0x5bf6('0x41')](_0x350b58['body'],{})[_0x5bf6('0x20')](respondWithResult(_0x2480e0,0xc9))['catch'](handleError(_0x2480e0,null));};exports[_0x5bf6('0x42')]=function(_0x106645,_0x1e5e09){return db[_0x5bf6('0x27')]['bulkCreate'](_0x106645[_0x5bf6('0x43')],{'raw':![],'individualHooks':!![]})[_0x5bf6('0x20')](respondWithResult(_0x1e5e09,0xc9))[_0x5bf6('0x44')](handleError(_0x1e5e09,null));};exports[_0x5bf6('0x1f')]=function(_0x1069de,_0x2ad6b8){if(_0x1069de['body']['id']){delete _0x1069de[_0x5bf6('0x43')]['id'];}return db[_0x5bf6('0x27')]['find']({'where':{'id':_0x1069de[_0x5bf6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2ad6b8,null))[_0x5bf6('0x20')](saveUpdates(_0x1069de[_0x5bf6('0x43')],null))['then'](respondWithResult(_0x2ad6b8,null))['catch'](handleError(_0x2ad6b8,null));};exports[_0x5bf6('0x21')]=function(_0x51b513,_0x18fa18){return db[_0x5bf6('0x27')][_0x5bf6('0x40')]({'where':{'id':_0x51b513[_0x5bf6('0x3e')]['id']}})[_0x5bf6('0x20')](handleEntityNotFound(_0x18fa18,null))[_0x5bf6('0x20')](removeEntity(_0x18fa18,null))[_0x5bf6('0x44')](handleError(_0x18fa18,null));};exports['bulkDestroy']=function(_0x2c4cc8,_0x81c78b){return db[_0x5bf6('0x27')][_0x5bf6('0x21')]({'where':{'id':_0x2c4cc8[_0x5bf6('0x2c')][_0x5bf6('0x45')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x81c78b,0xcc))['catch'](handleError(_0x81c78b,null));};exports[_0x5bf6('0x46')]=function(_0x3a4e39,_0x275b1b,_0x1d2203){return db[_0x5bf6('0x47')][_0x5bf6('0x48')]({'where':{'id':_0x3a4e39[_0x5bf6('0x3e')]['id']}})[_0x5bf6('0x20')](handleEntityNotFound(_0x275b1b,null))[_0x5bf6('0x20')](function(_0x155948){if(_0x155948){return db[_0x5bf6('0x49')][_0x5bf6('0x4a')](function(_0x108682){return db[_0x5bf6('0x27')][_0x5bf6('0x21')]({'where':{'CustomReportId':_0x3a4e39[_0x5bf6('0x3e')]['id']},'transaction':_0x108682})[_0x5bf6('0x20')](function(_0x12d69f){var _0x4dc616=_[_0x5bf6('0x26')](_0x3a4e39[_0x5bf6('0x43')],function(_0xd24024){delete _0xd24024['id'];_0xd24024['CustomReportId']=_0x3a4e39[_0x5bf6('0x3e')]['id'];return _0xd24024;});return db[_0x5bf6('0x27')][_0x5bf6('0x42')](_0x4dc616,{'transaction':_0x108682});});})['then'](function(){return db[_0x5bf6('0x27')][_0x5bf6('0x4b')]({'where':{'CustomReportId':_0x3a4e39[_0x5bf6('0x3e')]['id']}});});}})[_0x5bf6('0x20')](respondWithResult(_0x275b1b,null))[_0x5bf6('0x44')](handleError(_0x275b1b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 4985597..897a7ad 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 _0xb9cf=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x4a21be,_0x4f8c11){var _0x2bd67a=function(_0x5c7964){while(--_0x5c7964){_0x4a21be['push'](_0x4a21be['shift']());}};_0x2bd67a(++_0x4f8c11);}(_0xb9cf,0x98));var _0xfb9c=function(_0x1b7ff9,_0x187c24){_0x1b7ff9=_0x1b7ff9-0x0;var _0x5268a2=_0xb9cf[_0x1b7ff9];return _0x5268a2;};'use strict';var _=require(_0xfb9c('0x0'));var util=require(_0xfb9c('0x1'));var logger=require(_0xfb9c('0x2'))(_0xfb9c('0x3'));var moment=require(_0xfb9c('0x4'));var BPromise=require(_0xfb9c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb9c('0x6'));var rimraf=require(_0xfb9c('0x7'));var config=require(_0xfb9c('0x8'));var attributes=require(_0xfb9c('0x9'));module[_0xfb9c('0xa')]=function(_0x353043,_0x317420){return _0x353043[_0xfb9c('0xb')](_0xfb9c('0xc'),attributes,{'tableName':_0xfb9c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb00c=['request-promise','path','rimraf','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb00c,0x10f));var _0xcb00=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0xb00c[_0x23a79e];return _0x3dab57;};'use strict';var _=require(_0xcb00('0x0'));var util=require('util');var logger=require(_0xcb00('0x1'))(_0xcb00('0x2'));var moment=require(_0xcb00('0x3'));var BPromise=require(_0xcb00('0x4'));var rp=require(_0xcb00('0x5'));var fs=require('fs');var path=require(_0xcb00('0x6'));var rimraf=require(_0xcb00('0x7'));var config=require('../../config/environment');var attributes=require(_0xcb00('0x8'));module['exports']=function(_0x3a0b51,_0x2d83b8){return _0x3a0b51[_0xcb00('0x9')](_0xcb00('0xa'),attributes,{'tableName':_0xcb00('0xb'),'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 90c522d..62f9907 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 _0x8648=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','bluebird'];(function(_0x375f7a,_0x373c24){var _0x2d3a5b=function(_0x1a7b4f){while(--_0x1a7b4f){_0x375f7a['push'](_0x375f7a['shift']());}};_0x2d3a5b(++_0x373c24);}(_0x8648,0xcd));var _0x8864=function(_0x53bcdc,_0x3b0993){_0x53bcdc=_0x53bcdc-0x0;var _0x36f6fb=_0x8648[_0x53bcdc];return _0x36f6fb;};'use strict';var _=require(_0x8864('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8864('0x1'));var rs=require(_0x8864('0x2'));var fs=require('fs');var Redis=require(_0x8864('0x3'));var db=require(_0x8864('0x4'))['db'];var utils=require(_0x8864('0x5'));var logger=require(_0x8864('0x6'))(_0x8864('0x7'));var config=require(_0x8864('0x8'));var jayson=require(_0x8864('0x9'));var client=jayson['client'][_0x8864('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1593ae,_0x5e1295,_0x381214){return new BPromise(function(_0x5bf0e1,_0x50985a){return client[_0x8864('0xb')](_0x1593ae,_0x381214)[_0x8864('0xc')](function(_0x2e4b56){logger[_0x8864('0xd')](_0x8864('0xe'),_0x5e1295,'request\x20sent');logger['debug'](_0x8864('0xf'),_0x5e1295,'request\x20sent',JSON[_0x8864('0x10')](_0x2e4b56));if(_0x2e4b56[_0x8864('0x11')]){if(_0x2e4b56['error'][_0x8864('0x12')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5e1295,_0x2e4b56[_0x8864('0x11')][_0x8864('0x13')]);return _0x50985a(_0x2e4b56[_0x8864('0x11')][_0x8864('0x13')]);}logger[_0x8864('0x11')](_0x8864('0xe'),_0x5e1295,_0x2e4b56[_0x8864('0x11')][_0x8864('0x13')]);return _0x5bf0e1(_0x2e4b56['error']['message']);}else{logger[_0x8864('0xd')](_0x8864('0xe'),_0x5e1295,_0x8864('0x14'));_0x5bf0e1(_0x2e4b56[_0x8864('0x15')][_0x8864('0x13')]);}})[_0x8864('0x16')](function(_0x1584ec){logger[_0x8864('0x11')](_0x8864('0xe'),_0x5e1295,_0x1584ec);_0x50985a(_0x1584ec);});});} \ No newline at end of file +var _0xf62e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xf62e,0x7b));var _0xef62=function(_0x46376b,_0x46cebd){_0x46376b=_0x46376b-0x0;var _0x1d5c24=_0xf62e[_0x46376b];return _0x1d5c24;};'use strict';var _=require(_0xef62('0x0'));var util=require(_0xef62('0x1'));var moment=require(_0xef62('0x2'));var BPromise=require(_0xef62('0x3'));var rs=require(_0xef62('0x4'));var fs=require('fs');var Redis=require(_0xef62('0x5'));var db=require(_0xef62('0x6'))['db'];var utils=require(_0xef62('0x7'));var logger=require(_0xef62('0x8'))(_0xef62('0x9'));var config=require('../../config/environment');var jayson=require(_0xef62('0xa'));var client=jayson[_0xef62('0xb')][_0xef62('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x467187,_0x2ee14e,_0x2edbfe){return new BPromise(function(_0x14df3d,_0x5327a9){return client[_0xef62('0xd')](_0x467187,_0x2edbfe)[_0xef62('0xe')](function(_0x337974){logger[_0xef62('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2ee14e,_0xef62('0x10'));logger[_0xef62('0x11')](_0xef62('0x12'),_0x2ee14e,_0xef62('0x10'),JSON[_0xef62('0x13')](_0x337974));if(_0x337974[_0xef62('0x14')]){if(_0x337974[_0xef62('0x14')][_0xef62('0x15')]===0x1f4){logger[_0xef62('0x14')](_0xef62('0x16'),_0x2ee14e,_0x337974[_0xef62('0x14')][_0xef62('0x17')]);return _0x5327a9(_0x337974[_0xef62('0x14')][_0xef62('0x17')]);}logger[_0xef62('0x14')](_0xef62('0x16'),_0x2ee14e,_0x337974[_0xef62('0x14')][_0xef62('0x17')]);return _0x14df3d(_0x337974[_0xef62('0x14')][_0xef62('0x17')]);}else{logger['info'](_0xef62('0x16'),_0x2ee14e,'request\x20sent');_0x14df3d(_0x337974['result'][_0xef62('0x17')]);}})[_0xef62('0x18')](function(_0x3f74b3){logger[_0xef62('0x14')](_0xef62('0x16'),_0x2ee14e,_0x3f74b3);_0x5327a9(_0x3f74b3);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d8c0512..addd551 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 _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x55ca,0x126));var _0xa55c=function(_0x1907cd,_0x202496){_0x1907cd=_0x1907cd-0x0;var _0xc77506=_0x55ca[_0x1907cd];return _0xc77506;};'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')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('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 2dc5c33..0cc2dd4 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 _0x09e4=['name','TEXT','sequelize','exports','STRING'];(function(_0x419d47,_0x2795dd){var _0x40ac84=function(_0x27c4fe){while(--_0x27c4fe){_0x419d47['push'](_0x419d47['shift']());}};_0x40ac84(++_0x2795dd);}(_0x09e4,0x1ce));var _0x409e=function(_0x3b56ff,_0x52ac2d){_0x3b56ff=_0x3b56ff-0x0;var _0x50ac37=_0x09e4[_0x3b56ff];return _0x50ac37;};'use strict';var Sequelize=require(_0x409e('0x0'));module[_0x409e('0x1')]={'name':{'type':Sequelize[_0x409e('0x2')],'allowNull':![],'unique':_0x409e('0x3')},'table':{'type':Sequelize[_0x409e('0x2')]},'metric':{'type':Sequelize[_0x409e('0x4')]},'description':{'type':Sequelize[_0x409e('0x2')]}}; \ No newline at end of file +var _0xa397=['TEXT','sequelize','STRING','name'];(function(_0x8dea05,_0x2a9cab){var _0x1c793c=function(_0x3952aa){while(--_0x3952aa){_0x8dea05['push'](_0x8dea05['shift']());}};_0x1c793c(++_0x2a9cab);}(_0xa397,0xdd));var _0x7a39=function(_0x492015,_0xa46139){_0x492015=_0x492015-0x0;var _0x4ca226=_0xa397[_0x492015];return _0x4ca226;};'use strict';var Sequelize=require(_0x7a39('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a39('0x1')],'allowNull':![],'unique':_0x7a39('0x2')},'table':{'type':Sequelize[_0x7a39('0x1')]},'metric':{'type':Sequelize[_0x7a39('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 029eb1c..e1ab0ff 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 _0x3495=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','save','then','destroy','get','Metrics','UserProfileResource','stack','name','send','index','AnalyticMetric','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','count','includeAll','catch','show','rawAttributes','include','options','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x242c62,_0x2fd8fd){var _0x5d9f4d=function(_0x41b2d8){while(--_0x41b2d8){_0x242c62['push'](_0x242c62['shift']());}};_0x5d9f4d(++_0x2fd8fd);}(_0x3495,0x1de));var _0x5349=function(_0x3d78d9,_0x2b135b){_0x3d78d9=_0x3d78d9-0x0;var _0x5a64b9=_0x3495[_0x3d78d9];return _0x5a64b9;};'use strict';var pdf=require(_0x5349('0x0'));var emlformat=require(_0x5349('0x1'));var rimraf=require(_0x5349('0x2'));var zipdir=require(_0x5349('0x3'));var jsonpatch=require(_0x5349('0x4'));var rp=require(_0x5349('0x5'));var moment=require(_0x5349('0x6'));var BPromise=require(_0x5349('0x7'));var Mustache=require(_0x5349('0x8'));var util=require('util');var path=require(_0x5349('0x9'));var sox=require(_0x5349('0xa'));var csv=require('to-csv');var ejs=require(_0x5349('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5349('0xc'));var crypto=require('crypto');var jsforce=require(_0x5349('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5349('0xe'));var querystring=require(_0x5349('0xf'));var Papa=require(_0x5349('0x10'));var Redis=require(_0x5349('0x11'));var authService=require(_0x5349('0x12'));var qs=require(_0x5349('0x13'));var as=require(_0x5349('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5349('0x15'))('api');var utils=require(_0x5349('0x16'));var config=require(_0x5349('0x17'));var db=require(_0x5349('0x18'))['db'];function respondWithStatusCode(_0x11d230,_0x2f5172){_0x2f5172=_0x2f5172||0xcc;return function(_0x3c592a){if(_0x3c592a){return _0x11d230[_0x5349('0x19')](_0x2f5172);}return _0x11d230[_0x5349('0x1a')](_0x2f5172)[_0x5349('0x1b')]();};}function respondWithResult(_0x3890a8,_0x534e31){_0x534e31=_0x534e31||0xc8;return function(_0x2fde66){if(_0x2fde66){return _0x3890a8[_0x5349('0x1a')](_0x534e31)['json'](_0x2fde66);}};}function respondWithFilteredResult(_0x1ed049,_0x269f7f){return function(_0x2fe611){if(_0x2fe611){var _0x49bbec=_0x2fe611['count'],_0x5bcb3a=_0x269f7f[_0x5349('0x1c')],_0x558fbb=_0x269f7f['offset']+_0x269f7f[_0x5349('0x1d')],_0x1fcbba;if(_0x558fbb>=_0x49bbec){_0x558fbb=_0x49bbec;_0x1fcbba=0xc8;}else{_0x1fcbba=0xce;}_0x1ed049[_0x5349('0x1a')](_0x1fcbba);return _0x1ed049[_0x5349('0x1e')](_0x5349('0x1f'),_0x5bcb3a+'-'+_0x558fbb+'/'+_0x49bbec)['json'](_0x2fe611);}return null;};}function patchUpdates(_0x22d1ca){return function(_0x24e74c){try{jsonpatch[_0x5349('0x20')](_0x24e74c,_0x22d1ca,!![]);}catch(_0x443b0a){return BPromise['reject'](_0x443b0a);}return _0x24e74c[_0x5349('0x21')]();};}function saveUpdates(_0x3594a4,_0x4f2cb6){return function(_0x4c96dc){if(_0x4c96dc){return _0x4c96dc['update'](_0x3594a4)[_0x5349('0x22')](function(_0x48ba3c){return _0x48ba3c;});}return null;};}function removeEntity(_0x270593,_0x1ff911){return function(_0x164978){if(_0x164978){return _0x164978[_0x5349('0x23')]()[_0x5349('0x22')](function(){var _0x29e912=_0x164978[_0x5349('0x24')]({'plain':!![]});var _0x43a0c2=_0x5349('0x25');return db[_0x5349('0x26')][_0x5349('0x23')]({'where':{'type':_0x43a0c2,'resourceId':_0x29e912['id']}})[_0x5349('0x22')](function(){return _0x164978;});})['then'](function(){_0x270593[_0x5349('0x1a')](0xcc)[_0x5349('0x1b')]();});}};}function handleEntityNotFound(_0x41d67e,_0x49435a){return function(_0x404700){if(!_0x404700){_0x41d67e['sendStatus'](0x194);}return _0x404700;};}function handleError(_0x1afba7,_0x203896){_0x203896=_0x203896||0x1f4;return function(_0x1db8cc){logger['error'](_0x1db8cc[_0x5349('0x27')]);if(_0x1db8cc[_0x5349('0x28')]){delete _0x1db8cc[_0x5349('0x28')];}_0x1afba7[_0x5349('0x1a')](_0x203896)[_0x5349('0x29')](_0x1db8cc);};}exports[_0x5349('0x2a')]=function(_0x3b6faa,_0x463a42){var _0x39b3a9={},_0x5b5d6c={},_0x3b3e79={'count':0x0,'rows':[]};var _0x1ab20a=_['map'](db[_0x5349('0x2b')]['rawAttributes'],function(_0x1df8b0){return{'name':_0x1df8b0[_0x5349('0x2c')],'type':_0x1df8b0[_0x5349('0x2d')][_0x5349('0x2e')]};});_0x5b5d6c[_0x5349('0x2f')]=_[_0x5349('0x30')](_0x1ab20a,'name');_0x5b5d6c[_0x5349('0x31')]=_[_0x5349('0x32')](_0x3b6faa[_0x5349('0x31')]);_0x5b5d6c[_0x5349('0x33')]=_['intersection'](_0x5b5d6c['model'],_0x5b5d6c[_0x5349('0x31')]);_0x39b3a9[_0x5349('0x34')]=_[_0x5349('0x35')](_0x5b5d6c['model'],qs[_0x5349('0x36')](_0x3b6faa['query'][_0x5349('0x36')]));_0x39b3a9[_0x5349('0x34')]=_0x39b3a9[_0x5349('0x34')][_0x5349('0x37')]?_0x39b3a9[_0x5349('0x34')]:_0x5b5d6c[_0x5349('0x2f')];if(!_0x3b6faa['query']['hasOwnProperty'](_0x5349('0x38'))){_0x39b3a9[_0x5349('0x1d')]=qs[_0x5349('0x1d')](_0x3b6faa[_0x5349('0x31')][_0x5349('0x1d')]);_0x39b3a9[_0x5349('0x1c')]=qs[_0x5349('0x1c')](_0x3b6faa['query']['offset']);}_0x39b3a9[_0x5349('0x39')]=qs['sort'](_0x3b6faa['query'][_0x5349('0x3a')]);_0x39b3a9['where']=qs[_0x5349('0x33')](_[_0x5349('0x3b')](_0x3b6faa[_0x5349('0x31')],_0x5b5d6c['filters']),_0x1ab20a);if(_0x3b6faa[_0x5349('0x31')]['filter']){_0x39b3a9[_0x5349('0x3c')]=_[_0x5349('0x3d')](_0x39b3a9[_0x5349('0x3c')],{'$or':_['map'](_0x1ab20a,function(_0x48a765){if(_0x48a765['type']!==_0x5349('0x3e')){var _0x26da1e={};_0x26da1e[_0x48a765[_0x5349('0x28')]]={'$like':'%'+_0x3b6faa[_0x5349('0x31')][_0x5349('0x3f')]+'%'};return _0x26da1e;}})});}_0x39b3a9=_[_0x5349('0x3d')]({},_0x39b3a9,_0x3b6faa['options']);var _0x52ab9d={'where':_0x39b3a9[_0x5349('0x3c')]};return db[_0x5349('0x2b')][_0x5349('0x40')](_0x52ab9d)['then'](function(_0x7ca6dc){_0x3b3e79[_0x5349('0x40')]=_0x7ca6dc;if(_0x3b6faa[_0x5349('0x31')][_0x5349('0x41')]){_0x39b3a9['include']=[{'all':!![]}];}return db[_0x5349('0x2b')]['findAll'](_0x39b3a9);})[_0x5349('0x22')](function(_0x196d68){_0x3b3e79['rows']=_0x196d68;return _0x3b3e79;})[_0x5349('0x22')](respondWithFilteredResult(_0x463a42,_0x39b3a9))[_0x5349('0x42')](handleError(_0x463a42,null));};exports[_0x5349('0x43')]=function(_0x370849,_0x173904){var _0xd29178={'raw':!![],'where':{'id':_0x370849['params']['id']}},_0x4252ec={};_0x4252ec['model']=_[_0x5349('0x32')](db[_0x5349('0x2b')][_0x5349('0x44')]);_0x4252ec[_0x5349('0x31')]=_['keys'](_0x370849[_0x5349('0x31')]);_0x4252ec['filters']=_['intersection'](_0x4252ec[_0x5349('0x2f')],_0x4252ec[_0x5349('0x31')]);_0xd29178[_0x5349('0x34')]=_[_0x5349('0x35')](_0x4252ec['model'],qs[_0x5349('0x36')](_0x370849[_0x5349('0x31')][_0x5349('0x36')]));_0xd29178[_0x5349('0x34')]=_0xd29178[_0x5349('0x34')][_0x5349('0x37')]?_0xd29178[_0x5349('0x34')]:_0x4252ec[_0x5349('0x2f')];if(_0x370849[_0x5349('0x31')][_0x5349('0x41')]){_0xd29178[_0x5349('0x45')]=[{'all':!![]}];}_0xd29178=_[_0x5349('0x3d')]({},_0xd29178,_0x370849[_0x5349('0x46')]);return db[_0x5349('0x2b')]['find'](_0xd29178)['then'](handleEntityNotFound(_0x173904,null))[_0x5349('0x22')](respondWithResult(_0x173904,null))[_0x5349('0x42')](handleError(_0x173904,null));};exports[_0x5349('0x47')]=function(_0x366634,_0x5e8cf3){return db[_0x5349('0x2b')]['create'](_0x366634[_0x5349('0x48')],{})[_0x5349('0x22')](function(_0x1fa080){var _0x3652dc=_0x366634[_0x5349('0x49')][_0x5349('0x24')]({'plain':!![]});if(!_0x3652dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3652dc[_0x5349('0x4a')]==='user'){var _0x7374d6=_0x1fa080[_0x5349('0x24')]({'plain':!![]});var _0x35ca92=_0x5349('0x25');return db[_0x5349('0x4b')]['find']({'where':{'name':_0x35ca92,'userProfileId':_0x3652dc[_0x5349('0x4c')]},'raw':!![]})[_0x5349('0x22')](function(_0x3891af){if(_0x3891af&&_0x3891af[_0x5349('0x4d')]===0x0){return db['UserProfileResource'][_0x5349('0x47')]({'name':_0x7374d6[_0x5349('0x28')],'resourceId':_0x7374d6['id'],'type':_0x3891af[_0x5349('0x28')],'sectionId':_0x3891af['id']},{})[_0x5349('0x22')](function(){return _0x1fa080;});}else{return _0x1fa080;}})[_0x5349('0x42')](function(_0x1a82af){logger[_0x5349('0x4e')](_0x5349('0x4f'),_0x1a82af);throw _0x1a82af;});}return _0x1fa080;})[_0x5349('0x22')](respondWithResult(_0x5e8cf3,0xc9))[_0x5349('0x42')](handleError(_0x5e8cf3,null));};exports[_0x5349('0x50')]=function(_0x2a6f80,_0x1286a2){if(_0x2a6f80[_0x5349('0x48')]['id']){delete _0x2a6f80[_0x5349('0x48')]['id'];}return db[_0x5349('0x2b')][_0x5349('0x51')]({'where':{'id':_0x2a6f80[_0x5349('0x52')]['id']}})['then'](handleEntityNotFound(_0x1286a2,null))[_0x5349('0x22')](saveUpdates(_0x2a6f80[_0x5349('0x48')],null))['then'](respondWithResult(_0x1286a2,null))['catch'](handleError(_0x1286a2,null));};exports[_0x5349('0x23')]=function(_0x450751,_0x13cbb5){return db[_0x5349('0x2b')][_0x5349('0x51')]({'where':{'id':_0x450751[_0x5349('0x52')]['id']}})[_0x5349('0x22')](handleEntityNotFound(_0x13cbb5,null))['then'](removeEntity(_0x13cbb5,null))[_0x5349('0x42')](handleError(_0x13cbb5,null));}; \ No newline at end of file +var _0xbbbc=['params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','get','Metrics','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','keys','filters','intersection','model','attributes','fields','query','length','order','sort','pick','filter','where','merge','VIRTUAL','count','include','findAll','rows','show'];(function(_0x342dff,_0x18183b){var _0x464a10=function(_0x23688e){while(--_0x23688e){_0x342dff['push'](_0x342dff['shift']());}};_0x464a10(++_0x18183b);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x47eeaf,_0x10eaaa){_0x47eeaf=_0x47eeaf-0x0;var _0x128198=_0xbbbc[_0x47eeaf];return _0x128198;};'use strict';var pdf=require(_0xcbbb('0x0'));var emlformat=require(_0xcbbb('0x1'));var rimraf=require(_0xcbbb('0x2'));var zipdir=require(_0xcbbb('0x3'));var jsonpatch=require(_0xcbbb('0x4'));var rp=require(_0xcbbb('0x5'));var moment=require(_0xcbbb('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xcbbb('0x7'));var util=require(_0xcbbb('0x8'));var path=require(_0xcbbb('0x9'));var sox=require(_0xcbbb('0xa'));var csv=require(_0xcbbb('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xb'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x631188,_0x53e651){_0x53e651=_0x53e651||0xcc;return function(_0x56f81){if(_0x56f81){return _0x631188['sendStatus'](_0x53e651);}return _0x631188[_0xcbbb('0x17')](_0x53e651)[_0xcbbb('0x18')]();};}function respondWithResult(_0x1cece7,_0x47ea6a){_0x47ea6a=_0x47ea6a||0xc8;return function(_0x27ba56){if(_0x27ba56){return _0x1cece7[_0xcbbb('0x17')](_0x47ea6a)[_0xcbbb('0x19')](_0x27ba56);}};}function respondWithFilteredResult(_0x273e13,_0x47e679){return function(_0x5af226){if(_0x5af226){var _0x1bba39=_0x5af226['count'],_0x30297d=_0x47e679[_0xcbbb('0x1a')],_0xf76038=_0x47e679['offset']+_0x47e679[_0xcbbb('0x1b')],_0x188698;if(_0xf76038>=_0x1bba39){_0xf76038=_0x1bba39;_0x188698=0xc8;}else{_0x188698=0xce;}_0x273e13[_0xcbbb('0x17')](_0x188698);return _0x273e13[_0xcbbb('0x1c')]('Content-Range',_0x30297d+'-'+_0xf76038+'/'+_0x1bba39)['json'](_0x5af226);}return null;};}function patchUpdates(_0x4bcd9a){return function(_0x31c768){try{jsonpatch[_0xcbbb('0x1d')](_0x31c768,_0x4bcd9a,!![]);}catch(_0x26c5eb){return BPromise[_0xcbbb('0x1e')](_0x26c5eb);}return _0x31c768[_0xcbbb('0x1f')]();};}function saveUpdates(_0x1cca90,_0x45de5f){return function(_0x2be36c){if(_0x2be36c){return _0x2be36c[_0xcbbb('0x20')](_0x1cca90)[_0xcbbb('0x21')](function(_0x594b3f){return _0x594b3f;});}return null;};}function removeEntity(_0x44a568,_0xe07b0){return function(_0x159c62){if(_0x159c62){return _0x159c62[_0xcbbb('0x22')]()[_0xcbbb('0x21')](function(){var _0x155e19=_0x159c62[_0xcbbb('0x23')]({'plain':!![]});var _0xabb565=_0xcbbb('0x24');return db['UserProfileResource'][_0xcbbb('0x22')]({'where':{'type':_0xabb565,'resourceId':_0x155e19['id']}})[_0xcbbb('0x21')](function(){return _0x159c62;});})['then'](function(){_0x44a568[_0xcbbb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48dfc4,_0x575d56){return function(_0x32e070){if(!_0x32e070){_0x48dfc4['sendStatus'](0x194);}return _0x32e070;};}function handleError(_0x59c422,_0x5499a1){_0x5499a1=_0x5499a1||0x1f4;return function(_0x4439ea){logger['error'](_0x4439ea['stack']);if(_0x4439ea[_0xcbbb('0x25')]){delete _0x4439ea[_0xcbbb('0x25')];}_0x59c422[_0xcbbb('0x17')](_0x5499a1)[_0xcbbb('0x26')](_0x4439ea);};}exports[_0xcbbb('0x27')]=function(_0x39ba8b,_0x3d4c0d){var _0x1c986d={},_0x2a023f={},_0x26c05e={'count':0x0,'rows':[]};var _0x1c2ac9=_[_0xcbbb('0x28')](db[_0xcbbb('0x29')][_0xcbbb('0x2a')],function(_0x2a9639){return{'name':_0x2a9639[_0xcbbb('0x2b')],'type':_0x2a9639[_0xcbbb('0x2c')][_0xcbbb('0x2d')]};});_0x2a023f['model']=_[_0xcbbb('0x28')](_0x1c2ac9,_0xcbbb('0x25'));_0x2a023f['query']=_[_0xcbbb('0x2e')](_0x39ba8b['query']);_0x2a023f[_0xcbbb('0x2f')]=_[_0xcbbb('0x30')](_0x2a023f[_0xcbbb('0x31')],_0x2a023f['query']);_0x1c986d[_0xcbbb('0x32')]=_[_0xcbbb('0x30')](_0x2a023f[_0xcbbb('0x31')],qs[_0xcbbb('0x33')](_0x39ba8b[_0xcbbb('0x34')][_0xcbbb('0x33')]));_0x1c986d[_0xcbbb('0x32')]=_0x1c986d[_0xcbbb('0x32')][_0xcbbb('0x35')]?_0x1c986d[_0xcbbb('0x32')]:_0x2a023f['model'];if(!_0x39ba8b['query']['hasOwnProperty']('nolimit')){_0x1c986d[_0xcbbb('0x1b')]=qs[_0xcbbb('0x1b')](_0x39ba8b[_0xcbbb('0x34')][_0xcbbb('0x1b')]);_0x1c986d[_0xcbbb('0x1a')]=qs[_0xcbbb('0x1a')](_0x39ba8b[_0xcbbb('0x34')][_0xcbbb('0x1a')]);}_0x1c986d[_0xcbbb('0x36')]=qs[_0xcbbb('0x37')](_0x39ba8b[_0xcbbb('0x34')][_0xcbbb('0x37')]);_0x1c986d['where']=qs['filters'](_[_0xcbbb('0x38')](_0x39ba8b['query'],_0x2a023f['filters']),_0x1c2ac9);if(_0x39ba8b['query'][_0xcbbb('0x39')]){_0x1c986d[_0xcbbb('0x3a')]=_[_0xcbbb('0x3b')](_0x1c986d[_0xcbbb('0x3a')],{'$or':_[_0xcbbb('0x28')](_0x1c2ac9,function(_0x2727f5){if(_0x2727f5[_0xcbbb('0x2c')]!==_0xcbbb('0x3c')){var _0x159691={};_0x159691[_0x2727f5[_0xcbbb('0x25')]]={'$like':'%'+_0x39ba8b[_0xcbbb('0x34')]['filter']+'%'};return _0x159691;}})});}_0x1c986d=_[_0xcbbb('0x3b')]({},_0x1c986d,_0x39ba8b['options']);var _0x2bb5e1={'where':_0x1c986d[_0xcbbb('0x3a')]};return db[_0xcbbb('0x29')][_0xcbbb('0x3d')](_0x2bb5e1)[_0xcbbb('0x21')](function(_0x3107a6){_0x26c05e['count']=_0x3107a6;if(_0x39ba8b['query']['includeAll']){_0x1c986d[_0xcbbb('0x3e')]=[{'all':!![]}];}return db[_0xcbbb('0x29')][_0xcbbb('0x3f')](_0x1c986d);})[_0xcbbb('0x21')](function(_0x15f2b1){_0x26c05e[_0xcbbb('0x40')]=_0x15f2b1;return _0x26c05e;})[_0xcbbb('0x21')](respondWithFilteredResult(_0x3d4c0d,_0x1c986d))['catch'](handleError(_0x3d4c0d,null));};exports[_0xcbbb('0x41')]=function(_0x22076a,_0x5550d2){var _0x15b3bc={'raw':!![],'where':{'id':_0x22076a[_0xcbbb('0x42')]['id']}},_0xa8eff0={};_0xa8eff0[_0xcbbb('0x31')]=_[_0xcbbb('0x2e')](db['AnalyticMetric'][_0xcbbb('0x2a')]);_0xa8eff0['query']=_['keys'](_0x22076a[_0xcbbb('0x34')]);_0xa8eff0[_0xcbbb('0x2f')]=_[_0xcbbb('0x30')](_0xa8eff0[_0xcbbb('0x31')],_0xa8eff0[_0xcbbb('0x34')]);_0x15b3bc[_0xcbbb('0x32')]=_[_0xcbbb('0x30')](_0xa8eff0[_0xcbbb('0x31')],qs[_0xcbbb('0x33')](_0x22076a[_0xcbbb('0x34')][_0xcbbb('0x33')]));_0x15b3bc[_0xcbbb('0x32')]=_0x15b3bc[_0xcbbb('0x32')][_0xcbbb('0x35')]?_0x15b3bc['attributes']:_0xa8eff0[_0xcbbb('0x31')];if(_0x22076a[_0xcbbb('0x34')][_0xcbbb('0x43')]){_0x15b3bc[_0xcbbb('0x3e')]=[{'all':!![]}];}_0x15b3bc=_['merge']({},_0x15b3bc,_0x22076a['options']);return db['AnalyticMetric'][_0xcbbb('0x44')](_0x15b3bc)[_0xcbbb('0x21')](handleEntityNotFound(_0x5550d2,null))[_0xcbbb('0x21')](respondWithResult(_0x5550d2,null))[_0xcbbb('0x45')](handleError(_0x5550d2,null));};exports[_0xcbbb('0x46')]=function(_0x1ef25b,_0x6f31f9){return db['AnalyticMetric'][_0xcbbb('0x46')](_0x1ef25b[_0xcbbb('0x47')],{})[_0xcbbb('0x21')](function(_0x2f8158){var _0x478c22=_0x1ef25b[_0xcbbb('0x48')][_0xcbbb('0x23')]({'plain':!![]});if(!_0x478c22)throw new Error(_0xcbbb('0x49'));if(_0x478c22[_0xcbbb('0x4a')]==='user'){var _0x5e0366=_0x2f8158[_0xcbbb('0x23')]({'plain':!![]});var _0x421137=_0xcbbb('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x421137,'userProfileId':_0x478c22['userProfileId']},'raw':!![]})[_0xcbbb('0x21')](function(_0x3070d9){if(_0x3070d9&&_0x3070d9['autoAssociation']===0x0){return db[_0xcbbb('0x4b')][_0xcbbb('0x46')]({'name':_0x5e0366[_0xcbbb('0x25')],'resourceId':_0x5e0366['id'],'type':_0x3070d9[_0xcbbb('0x25')],'sectionId':_0x3070d9['id']},{})['then'](function(){return _0x2f8158;});}else{return _0x2f8158;}})[_0xcbbb('0x45')](function(_0x1e4bb0){logger[_0xcbbb('0x4c')](_0xcbbb('0x4d'),_0x1e4bb0);throw _0x1e4bb0;});}return _0x2f8158;})[_0xcbbb('0x21')](respondWithResult(_0x6f31f9,0xc9))[_0xcbbb('0x45')](handleError(_0x6f31f9,null));};exports[_0xcbbb('0x20')]=function(_0x1d9136,_0x2d3990){if(_0x1d9136[_0xcbbb('0x47')]['id']){delete _0x1d9136[_0xcbbb('0x47')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x1d9136[_0xcbbb('0x42')]['id']}})[_0xcbbb('0x21')](handleEntityNotFound(_0x2d3990,null))[_0xcbbb('0x21')](saveUpdates(_0x1d9136['body'],null))[_0xcbbb('0x21')](respondWithResult(_0x2d3990,null))['catch'](handleError(_0x2d3990,null));};exports[_0xcbbb('0x22')]=function(_0x3bf4bf,_0x317633){return db[_0xcbbb('0x29')][_0xcbbb('0x44')]({'where':{'id':_0x3bf4bf[_0xcbbb('0x42')]['id']}})['then'](handleEntityNotFound(_0x317633,null))['then'](removeEntity(_0x317633,null))['catch'](handleError(_0x317633,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 3869e07..7c8c0a5 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 _0x0df0=['request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','moment'];(function(_0x18f807,_0x515512){var _0x1d7cd5=function(_0x31dc0b){while(--_0x31dc0b){_0x18f807['push'](_0x18f807['shift']());}};_0x1d7cd5(++_0x515512);}(_0x0df0,0x1dd));var _0x00df=function(_0x56e790,_0x5bec09){_0x56e790=_0x56e790-0x0;var _0x4fa9fa=_0x0df0[_0x56e790];return _0x4fa9fa;};'use strict';var _=require('lodash');var util=require(_0x00df('0x0'));var logger=require(_0x00df('0x1'))(_0x00df('0x2'));var moment=require(_0x00df('0x3'));var BPromise=require('bluebird');var rp=require(_0x00df('0x4'));var fs=require('fs');var path=require(_0x00df('0x5'));var rimraf=require(_0x00df('0x6'));var config=require(_0x00df('0x7'));var attributes=require(_0x00df('0x8'));module[_0x00df('0x9')]=function(_0x324500,_0x5aef8c){return _0x324500[_0x00df('0xa')](_0x00df('0xb'),attributes,{'tableName':_0x00df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9641=['request-promise','path','rimraf','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','bluebird'];(function(_0x1e06d9,_0x223006){var _0x13fb1f=function(_0x49600d){while(--_0x49600d){_0x1e06d9['push'](_0x1e06d9['shift']());}};_0x13fb1f(++_0x223006);}(_0x9641,0xf9));var _0x1964=function(_0x2d25a2,_0x134e12){_0x2d25a2=_0x2d25a2-0x0;var _0x5ca405=_0x9641[_0x2d25a2];return _0x5ca405;};'use strict';var _=require(_0x1964('0x0'));var util=require(_0x1964('0x1'));var logger=require(_0x1964('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1964('0x3'));var rp=require(_0x1964('0x4'));var fs=require('fs');var path=require(_0x1964('0x5'));var rimraf=require(_0x1964('0x6'));var config=require('../../config/environment');var attributes=require(_0x1964('0x7'));module['exports']=function(_0x5d98b0,_0x30e355){return _0x5d98b0[_0x1964('0x8')](_0x1964('0x9'),attributes,{'tableName':_0x1964('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 7c83105..243d7f1 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 _0xd5dc=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','message','error','request\x20sent','catch','lodash','util','moment','randomstring'];(function(_0x5dc8c3,_0x22eee9){var _0x456a93=function(_0x12a63d){while(--_0x12a63d){_0x5dc8c3['push'](_0x5dc8c3['shift']());}};_0x456a93(++_0x22eee9);}(_0xd5dc,0x6f));var _0xcd5d=function(_0x3049f8,_0xb5bede){_0x3049f8=_0x3049f8-0x0;var _0x2fda1d=_0xd5dc[_0x3049f8];return _0x2fda1d;};'use strict';var _=require(_0xcd5d('0x0'));var util=require(_0xcd5d('0x1'));var moment=require(_0xcd5d('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd5d('0x3'));var fs=require('fs');var Redis=require(_0xcd5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd5d('0x5'));var logger=require(_0xcd5d('0x6'))(_0xcd5d('0x7'));var config=require(_0xcd5d('0x8'));var jayson=require(_0xcd5d('0x9'));var client=jayson[_0xcd5d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34e0bc,_0x2bb79c,_0x5c48c7){return new BPromise(function(_0x581a01,_0x1936ba){return client[_0xcd5d('0xb')](_0x34e0bc,_0x5c48c7)[_0xcd5d('0xc')](function(_0x21f8b3){logger[_0xcd5d('0xd')](_0xcd5d('0xe'),_0x2bb79c,'request\x20sent');logger[_0xcd5d('0xf')](_0xcd5d('0x10'),_0x2bb79c,'request\x20sent',JSON[_0xcd5d('0x11')](_0x21f8b3));if(_0x21f8b3['error']){if(_0x21f8b3['error'][_0xcd5d('0x12')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x2bb79c,_0x21f8b3['error'][_0xcd5d('0x13')]);return _0x1936ba(_0x21f8b3[_0xcd5d('0x14')][_0xcd5d('0x13')]);}logger['error'](_0xcd5d('0xe'),_0x2bb79c,_0x21f8b3[_0xcd5d('0x14')]['message']);return _0x581a01(_0x21f8b3[_0xcd5d('0x14')][_0xcd5d('0x13')]);}else{logger[_0xcd5d('0xd')](_0xcd5d('0xe'),_0x2bb79c,_0xcd5d('0x15'));_0x581a01(_0x21f8b3['result']['message']);}})[_0xcd5d('0x16')](function(_0x5ad188){logger[_0xcd5d('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x2bb79c,_0x5ad188);_0x1936ba(_0x5ad188);});});} \ No newline at end of file +var _0xb3ad=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','rpc','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x119b96,_0x587acd){var _0x516cbf=function(_0x5d4b36){while(--_0x5d4b36){_0x119b96['push'](_0x119b96['shift']());}};_0x516cbf(++_0x587acd);}(_0xb3ad,0x14a));var _0xdb3a=function(_0x1e6413,_0x39405d){_0x1e6413=_0x1e6413-0x0;var _0x6bb277=_0xb3ad[_0x1e6413];return _0x6bb277;};'use strict';var _=require(_0xdb3a('0x0'));var util=require(_0xdb3a('0x1'));var moment=require(_0xdb3a('0x2'));var BPromise=require(_0xdb3a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdb3a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb3a('0x6')][_0xdb3a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f477a,_0x520cf2,_0x4e2de7){return new BPromise(function(_0x57f0fa,_0x4a2581){return client[_0xdb3a('0x8')](_0x5f477a,_0x4e2de7)['then'](function(_0x2af056){logger[_0xdb3a('0x9')](_0xdb3a('0xa'),_0x520cf2,_0xdb3a('0xb'));logger[_0xdb3a('0xc')](_0xdb3a('0xd'),_0x520cf2,'request\x20sent',JSON[_0xdb3a('0xe')](_0x2af056));if(_0x2af056[_0xdb3a('0xf')]){if(_0x2af056[_0xdb3a('0xf')]['code']===0x1f4){logger[_0xdb3a('0xf')](_0xdb3a('0xa'),_0x520cf2,_0x2af056[_0xdb3a('0xf')]['message']);return _0x4a2581(_0x2af056['error'][_0xdb3a('0x10')]);}logger[_0xdb3a('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x520cf2,_0x2af056['error']['message']);return _0x57f0fa(_0x2af056[_0xdb3a('0xf')]['message']);}else{logger[_0xdb3a('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x520cf2,_0xdb3a('0xb'));_0x57f0fa(_0x2af056[_0xdb3a('0x11')][_0xdb3a('0x10')]);}})[_0xdb3a('0x12')](function(_0x6642fc){logger[_0xdb3a('0xf')](_0xdb3a('0xa'),_0x520cf2,_0x6642fc);_0x4a2581(_0x6642fc);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d1f7fec..634ef63 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 _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x53ec,0x192));var _0xc53e=function(_0x254c9e,_0xab8a1b){_0x254c9e=_0x254c9e-0x0;var _0x2d4cb6=_0x53ec[_0x254c9e];return _0x2d4cb6;};'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 +var _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x5027b1,_0x6c2346){var _0x5ef581=function(_0xb14398){while(--_0xb14398){_0x5027b1['push'](_0x5027b1['shift']());}};_0x5ef581(++_0x6c2346);}(_0x2542,0x169));var _0x2254=function(_0xf8007b,_0x4e7be5){_0xf8007b=_0xf8007b-0x0;var _0x42a7ec=_0x2542[_0xf8007b];return _0x42a7ec;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 42fd947..6ed5813 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 _0xb18f=['exports','TEXT','sequelize'];(function(_0x45fbed,_0x4ef9a8){var _0x404d70=function(_0x36f9d9){while(--_0x36f9d9){_0x45fbed['push'](_0x45fbed['shift']());}};_0x404d70(++_0x4ef9a8);}(_0xb18f,0xa1));var _0xfb18=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xb18f[_0x1e6659];return _0x4d16e4;};'use strict';var Sequelize=require(_0xfb18('0x0'));module[_0xfb18('0x1')]={'tree':{'type':Sequelize[_0xfb18('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xea10=['exports','TEXT'];(function(_0x4b7c99,_0x96e395){var _0x5851ba=function(_0x53ba79){while(--_0x53ba79){_0x4b7c99['push'](_0x4b7c99['shift']());}};_0x5851ba(++_0x96e395);}(_0xea10,0x1e0));var _0x0ea1=function(_0x20d3f8,_0x5cfb13){_0x20d3f8=_0x20d3f8-0x0;var _0x2d3480=_0xea10[_0x20d3f8];return _0x2d3480;};'use strict';var Sequelize=require('sequelize');module[_0x0ea1('0x0')]={'tree':{'type':Sequelize[_0x0ea1('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index fe7c526..ca2bd9c 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 _0xea04=['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','limit','set','Content-Range','reject','save','update','then','error','name','map','AnalyticTreeReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse'];(function(_0x1761f2,_0x2f64bd){var _0x1a3063=function(_0x476350){while(--_0x476350){_0x1761f2['push'](_0x1761f2['shift']());}};_0x1a3063(++_0x2f64bd);}(_0xea04,0x105));var _0x4ea0=function(_0x243bba,_0x1ea69f){_0x243bba=_0x243bba-0x0;var _0x12e696=_0xea04[_0x243bba];return _0x12e696;};'use strict';var pdf=require(_0x4ea0('0x0'));var emlformat=require(_0x4ea0('0x1'));var rimraf=require(_0x4ea0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4ea0('0x3'));var moment=require('moment');var BPromise=require(_0x4ea0('0x4'));var Mustache=require(_0x4ea0('0x5'));var util=require(_0x4ea0('0x6'));var path=require('path');var sox=require(_0x4ea0('0x7'));var csv=require(_0x4ea0('0x8'));var ejs=require(_0x4ea0('0x9'));var fs=require('fs');var _=require(_0x4ea0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ea0('0xb'));var deskjs=require(_0x4ea0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4ea0('0xd'));var Papa=require(_0x4ea0('0xe'));var Redis=require(_0x4ea0('0xf'));var authService=require(_0x4ea0('0x10'));var qs=require(_0x4ea0('0x11'));var as=require(_0x4ea0('0x12'));var hardwareService=require(_0x4ea0('0x13'));var logger=require('../../config/logger')(_0x4ea0('0x14'));var utils=require(_0x4ea0('0x15'));var config=require(_0x4ea0('0x16'));var db=require(_0x4ea0('0x17'))['db'];function respondWithStatusCode(_0x1613b2,_0x5acd73){_0x5acd73=_0x5acd73||0xcc;return function(_0x54089c){if(_0x54089c){return _0x1613b2[_0x4ea0('0x18')](_0x5acd73);}return _0x1613b2[_0x4ea0('0x19')](_0x5acd73)[_0x4ea0('0x1a')]();};}function respondWithResult(_0x22e5c9,_0x13093f){_0x13093f=_0x13093f||0xc8;return function(_0x1a99c4){if(_0x1a99c4){return _0x22e5c9[_0x4ea0('0x19')](_0x13093f)[_0x4ea0('0x1b')](_0x1a99c4);}};}function respondWithFilteredResult(_0x4adcc3,_0x109122){return function(_0x1b4f10){if(_0x1b4f10){var _0x25b786=_0x1b4f10[_0x4ea0('0x1c')],_0xf2a53d=_0x109122[_0x4ea0('0x1d')],_0x375377=_0x109122[_0x4ea0('0x1d')]+_0x109122[_0x4ea0('0x1e')],_0x22118a;if(_0x375377>=_0x25b786){_0x375377=_0x25b786;_0x22118a=0xc8;}else{_0x22118a=0xce;}_0x4adcc3[_0x4ea0('0x19')](_0x22118a);return _0x4adcc3[_0x4ea0('0x1f')](_0x4ea0('0x20'),_0xf2a53d+'-'+_0x375377+'/'+_0x25b786)['json'](_0x1b4f10);}return null;};}function patchUpdates(_0x542954){return function(_0x200710){try{jsonpatch['apply'](_0x200710,_0x542954,!![]);}catch(_0x3d19ca){return BPromise[_0x4ea0('0x21')](_0x3d19ca);}return _0x200710[_0x4ea0('0x22')]();};}function saveUpdates(_0x2ac08d,_0x6de371){return function(_0x1f210c){if(_0x1f210c){return _0x1f210c[_0x4ea0('0x23')](_0x2ac08d)[_0x4ea0('0x24')](function(_0x798e77){return _0x798e77;});}return null;};}function removeEntity(_0x18d6d6,_0x239976){return function(_0x540631){if(_0x540631){return _0x540631['destroy']()[_0x4ea0('0x24')](function(){_0x18d6d6[_0x4ea0('0x19')](0xcc)[_0x4ea0('0x1a')]();});}};}function handleEntityNotFound(_0x992d43,_0x12d4d2){return function(_0x45303f){if(!_0x45303f){_0x992d43['sendStatus'](0x194);}return _0x45303f;};}function handleError(_0x3f64f7,_0x3e0692){_0x3e0692=_0x3e0692||0x1f4;return function(_0x895cc9){logger[_0x4ea0('0x25')](_0x895cc9['stack']);if(_0x895cc9[_0x4ea0('0x26')]){delete _0x895cc9[_0x4ea0('0x26')];}_0x3f64f7[_0x4ea0('0x19')](_0x3e0692)['send'](_0x895cc9);};}exports['index']=function(_0x3ea3cf,_0x525f76){var _0x1083dd={},_0x4cd05e={},_0xf950f4={'count':0x0,'rows':[]};var _0x16e0bc=_[_0x4ea0('0x27')](db[_0x4ea0('0x28')][_0x4ea0('0x29')],function(_0x160530){return{'name':_0x160530[_0x4ea0('0x2a')],'type':_0x160530[_0x4ea0('0x2b')]['key']};});_0x4cd05e['model']=_[_0x4ea0('0x27')](_0x16e0bc,_0x4ea0('0x26'));_0x4cd05e[_0x4ea0('0x2c')]=_[_0x4ea0('0x2d')](_0x3ea3cf[_0x4ea0('0x2c')]);_0x4cd05e[_0x4ea0('0x2e')]=_['intersection'](_0x4cd05e[_0x4ea0('0x2f')],_0x4cd05e[_0x4ea0('0x2c')]);_0x1083dd[_0x4ea0('0x30')]=_[_0x4ea0('0x31')](_0x4cd05e[_0x4ea0('0x2f')],qs['fields'](_0x3ea3cf[_0x4ea0('0x2c')][_0x4ea0('0x32')]));_0x1083dd[_0x4ea0('0x30')]=_0x1083dd[_0x4ea0('0x30')][_0x4ea0('0x33')]?_0x1083dd[_0x4ea0('0x30')]:_0x4cd05e[_0x4ea0('0x2f')];if(!_0x3ea3cf[_0x4ea0('0x2c')][_0x4ea0('0x34')]('nolimit')){_0x1083dd['limit']=qs[_0x4ea0('0x1e')](_0x3ea3cf[_0x4ea0('0x2c')][_0x4ea0('0x1e')]);_0x1083dd['offset']=qs[_0x4ea0('0x1d')](_0x3ea3cf[_0x4ea0('0x2c')][_0x4ea0('0x1d')]);}_0x1083dd['order']=qs['sort'](_0x3ea3cf['query'][_0x4ea0('0x35')]);_0x1083dd['where']=qs[_0x4ea0('0x2e')](_[_0x4ea0('0x36')](_0x3ea3cf[_0x4ea0('0x2c')],_0x4cd05e[_0x4ea0('0x2e')]),_0x16e0bc);if(_0x3ea3cf['query'][_0x4ea0('0x37')]){_0x1083dd[_0x4ea0('0x38')]=_[_0x4ea0('0x39')](_0x1083dd[_0x4ea0('0x38')],{'$or':_['map'](_0x16e0bc,function(_0x20cca3){if(_0x20cca3[_0x4ea0('0x2b')]!==_0x4ea0('0x3a')){var _0x47b30d={};_0x47b30d[_0x20cca3[_0x4ea0('0x26')]]={'$like':'%'+_0x3ea3cf[_0x4ea0('0x2c')][_0x4ea0('0x37')]+'%'};return _0x47b30d;}})});}_0x1083dd=_['merge']({},_0x1083dd,_0x3ea3cf[_0x4ea0('0x3b')]);var _0x139cf8={'where':_0x1083dd['where']};return db[_0x4ea0('0x28')]['count'](_0x139cf8)[_0x4ea0('0x24')](function(_0x1b2583){_0xf950f4['count']=_0x1b2583;if(_0x3ea3cf[_0x4ea0('0x2c')][_0x4ea0('0x3c')]){_0x1083dd['include']=[{'all':!![]}];}return db[_0x4ea0('0x28')]['findAll'](_0x1083dd);})[_0x4ea0('0x24')](function(_0x5d7ba4){_0xf950f4[_0x4ea0('0x3d')]=_0x5d7ba4;return _0xf950f4;})[_0x4ea0('0x24')](respondWithFilteredResult(_0x525f76,_0x1083dd))[_0x4ea0('0x3e')](handleError(_0x525f76,null));};exports[_0x4ea0('0x3f')]=function(_0x5cbf90,_0x5c8f70){var _0x2e7b95={'raw':!![],'where':{'id':_0x5cbf90[_0x4ea0('0x40')]['id']}},_0x30060f={};_0x30060f[_0x4ea0('0x2f')]=_['keys'](db[_0x4ea0('0x28')][_0x4ea0('0x29')]);_0x30060f[_0x4ea0('0x2c')]=_[_0x4ea0('0x2d')](_0x5cbf90[_0x4ea0('0x2c')]);_0x30060f[_0x4ea0('0x2e')]=_[_0x4ea0('0x31')](_0x30060f[_0x4ea0('0x2f')],_0x30060f['query']);_0x2e7b95['attributes']=_['intersection'](_0x30060f[_0x4ea0('0x2f')],qs[_0x4ea0('0x32')](_0x5cbf90[_0x4ea0('0x2c')][_0x4ea0('0x32')]));_0x2e7b95['attributes']=_0x2e7b95[_0x4ea0('0x30')][_0x4ea0('0x33')]?_0x2e7b95['attributes']:_0x30060f['model'];if(_0x5cbf90[_0x4ea0('0x2c')][_0x4ea0('0x3c')]){_0x2e7b95[_0x4ea0('0x41')]=[{'all':!![]}];}_0x2e7b95=_[_0x4ea0('0x39')]({},_0x2e7b95,_0x5cbf90[_0x4ea0('0x3b')]);return db[_0x4ea0('0x28')][_0x4ea0('0x42')](_0x2e7b95)[_0x4ea0('0x24')](handleEntityNotFound(_0x5c8f70,null))[_0x4ea0('0x24')](respondWithResult(_0x5c8f70,null))['catch'](handleError(_0x5c8f70,null));};exports[_0x4ea0('0x43')]=function(_0x44044c,_0x58e9e9){return db['AnalyticTreeReport'][_0x4ea0('0x43')](_0x44044c[_0x4ea0('0x44')],{})[_0x4ea0('0x24')](respondWithResult(_0x58e9e9,0xc9))[_0x4ea0('0x3e')](handleError(_0x58e9e9,null));};exports[_0x4ea0('0x23')]=function(_0x4c9ec4,_0x784e69){if(_0x4c9ec4[_0x4ea0('0x44')]['id']){delete _0x4c9ec4[_0x4ea0('0x44')]['id'];}return db[_0x4ea0('0x28')][_0x4ea0('0x42')]({'where':{'id':_0x4c9ec4[_0x4ea0('0x40')]['id']}})[_0x4ea0('0x24')](handleEntityNotFound(_0x784e69,null))[_0x4ea0('0x24')](saveUpdates(_0x4c9ec4[_0x4ea0('0x44')],null))[_0x4ea0('0x24')](respondWithResult(_0x784e69,null))[_0x4ea0('0x3e')](handleError(_0x784e69,null));};exports['destroy']=function(_0x274525,_0x3ab0a3){return db['AnalyticTreeReport'][_0x4ea0('0x42')]({'where':{'id':_0x274525['params']['id']}})[_0x4ea0('0x24')](handleEntityNotFound(_0x3ab0a3,null))[_0x4ea0('0x24')](removeEntity(_0x3ab0a3,null))['catch'](handleError(_0x3ab0a3,null));}; \ No newline at end of file +var _0xfbc4=['sort','where','pick','map','merge','options','include','findAll','rows','catch','show','length','includeAll','create','body','update','find','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','Content-Range','apply','save','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order'];(function(_0x5bb3f8,_0x5f3bcb){var _0x332911=function(_0x1bcde2){while(--_0x1bcde2){_0x5bb3f8['push'](_0x5bb3f8['shift']());}};_0x332911(++_0x5f3bcb);}(_0xfbc4,0xa6));var _0x4fbc=function(_0x6f759b,_0x3ff90f){_0x6f759b=_0x6f759b-0x0;var _0x58868a=_0xfbc4[_0x6f759b];return _0x58868a;};'use strict';var pdf=require(_0x4fbc('0x0'));var emlformat=require(_0x4fbc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4fbc('0x2'));var jsonpatch=require(_0x4fbc('0x3'));var rp=require(_0x4fbc('0x4'));var moment=require(_0x4fbc('0x5'));var BPromise=require(_0x4fbc('0x6'));var Mustache=require(_0x4fbc('0x7'));var util=require(_0x4fbc('0x8'));var path=require(_0x4fbc('0x9'));var sox=require(_0x4fbc('0xa'));var csv=require('to-csv');var ejs=require(_0x4fbc('0xb'));var fs=require('fs');var _=require(_0x4fbc('0xc'));var squel=require(_0x4fbc('0xd'));var crypto=require(_0x4fbc('0xe'));var jsforce=require(_0x4fbc('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4fbc('0x10'));var Papa=require(_0x4fbc('0x11'));var Redis=require(_0x4fbc('0x12'));var authService=require(_0x4fbc('0x13'));var qs=require(_0x4fbc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fbc('0x15'))(_0x4fbc('0x16'));var utils=require(_0x4fbc('0x17'));var config=require(_0x4fbc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42041d,_0x2cc71e){_0x2cc71e=_0x2cc71e||0xcc;return function(_0x2ad68c){if(_0x2ad68c){return _0x42041d[_0x4fbc('0x19')](_0x2cc71e);}return _0x42041d[_0x4fbc('0x1a')](_0x2cc71e)[_0x4fbc('0x1b')]();};}function respondWithResult(_0x3c30c9,_0xbfeed1){_0xbfeed1=_0xbfeed1||0xc8;return function(_0x4b041a){if(_0x4b041a){return _0x3c30c9[_0x4fbc('0x1a')](_0xbfeed1)['json'](_0x4b041a);}};}function respondWithFilteredResult(_0x3e9922,_0x1a40fe){return function(_0x2805e5){if(_0x2805e5){var _0x446fd2=_0x2805e5[_0x4fbc('0x1c')],_0x52483f=_0x1a40fe[_0x4fbc('0x1d')],_0x467358=_0x1a40fe[_0x4fbc('0x1d')]+_0x1a40fe['limit'],_0x345704;if(_0x467358>=_0x446fd2){_0x467358=_0x446fd2;_0x345704=0xc8;}else{_0x345704=0xce;}_0x3e9922[_0x4fbc('0x1a')](_0x345704);return _0x3e9922['set'](_0x4fbc('0x1e'),_0x52483f+'-'+_0x467358+'/'+_0x446fd2)['json'](_0x2805e5);}return null;};}function patchUpdates(_0x48a95a){return function(_0x149603){try{jsonpatch[_0x4fbc('0x1f')](_0x149603,_0x48a95a,!![]);}catch(_0x1d51c2){return BPromise['reject'](_0x1d51c2);}return _0x149603[_0x4fbc('0x20')]();};}function saveUpdates(_0x4eaa1d,_0x185987){return function(_0x515d18){if(_0x515d18){return _0x515d18['update'](_0x4eaa1d)[_0x4fbc('0x21')](function(_0x77fa57){return _0x77fa57;});}return null;};}function removeEntity(_0x29a9e8,_0x73c82e){return function(_0x416c76){if(_0x416c76){return _0x416c76[_0x4fbc('0x22')]()[_0x4fbc('0x21')](function(){_0x29a9e8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44e0d8,_0x15c805){return function(_0xbdc68b){if(!_0xbdc68b){_0x44e0d8[_0x4fbc('0x19')](0x194);}return _0xbdc68b;};}function handleError(_0x1e6e83,_0xc754b1){_0xc754b1=_0xc754b1||0x1f4;return function(_0x2e74f3){logger[_0x4fbc('0x23')](_0x2e74f3[_0x4fbc('0x24')]);if(_0x2e74f3['name']){delete _0x2e74f3[_0x4fbc('0x25')];}_0x1e6e83[_0x4fbc('0x1a')](_0xc754b1)[_0x4fbc('0x26')](_0x2e74f3);};}exports[_0x4fbc('0x27')]=function(_0x3a1b81,_0x3fc164){var _0x25a379={},_0x13632e={},_0xcb4ae3={'count':0x0,'rows':[]};var _0x2b71e0=_['map'](db[_0x4fbc('0x28')][_0x4fbc('0x29')],function(_0x2febf5){return{'name':_0x2febf5[_0x4fbc('0x2a')],'type':_0x2febf5[_0x4fbc('0x2b')][_0x4fbc('0x2c')]};});_0x13632e[_0x4fbc('0x2d')]=_['map'](_0x2b71e0,'name');_0x13632e['query']=_[_0x4fbc('0x2e')](_0x3a1b81['query']);_0x13632e[_0x4fbc('0x2f')]=_['intersection'](_0x13632e[_0x4fbc('0x2d')],_0x13632e[_0x4fbc('0x30')]);_0x25a379['attributes']=_[_0x4fbc('0x31')](_0x13632e[_0x4fbc('0x2d')],qs[_0x4fbc('0x32')](_0x3a1b81[_0x4fbc('0x30')]['fields']));_0x25a379['attributes']=_0x25a379[_0x4fbc('0x33')]['length']?_0x25a379['attributes']:_0x13632e[_0x4fbc('0x2d')];if(!_0x3a1b81[_0x4fbc('0x30')][_0x4fbc('0x34')](_0x4fbc('0x35'))){_0x25a379['limit']=qs[_0x4fbc('0x36')](_0x3a1b81[_0x4fbc('0x30')]['limit']);_0x25a379[_0x4fbc('0x1d')]=qs[_0x4fbc('0x1d')](_0x3a1b81['query'][_0x4fbc('0x1d')]);}_0x25a379[_0x4fbc('0x37')]=qs[_0x4fbc('0x38')](_0x3a1b81[_0x4fbc('0x30')]['sort']);_0x25a379[_0x4fbc('0x39')]=qs[_0x4fbc('0x2f')](_[_0x4fbc('0x3a')](_0x3a1b81[_0x4fbc('0x30')],_0x13632e['filters']),_0x2b71e0);if(_0x3a1b81[_0x4fbc('0x30')]['filter']){_0x25a379[_0x4fbc('0x39')]=_['merge'](_0x25a379[_0x4fbc('0x39')],{'$or':_[_0x4fbc('0x3b')](_0x2b71e0,function(_0x35762d){if(_0x35762d[_0x4fbc('0x2b')]!=='VIRTUAL'){var _0x5e6d2b={};_0x5e6d2b[_0x35762d[_0x4fbc('0x25')]]={'$like':'%'+_0x3a1b81[_0x4fbc('0x30')]['filter']+'%'};return _0x5e6d2b;}})});}_0x25a379=_[_0x4fbc('0x3c')]({},_0x25a379,_0x3a1b81[_0x4fbc('0x3d')]);var _0x42f1d3={'where':_0x25a379['where']};return db[_0x4fbc('0x28')]['count'](_0x42f1d3)[_0x4fbc('0x21')](function(_0x3b12e6){_0xcb4ae3[_0x4fbc('0x1c')]=_0x3b12e6;if(_0x3a1b81[_0x4fbc('0x30')]['includeAll']){_0x25a379[_0x4fbc('0x3e')]=[{'all':!![]}];}return db[_0x4fbc('0x28')][_0x4fbc('0x3f')](_0x25a379);})['then'](function(_0x810f65){_0xcb4ae3[_0x4fbc('0x40')]=_0x810f65;return _0xcb4ae3;})[_0x4fbc('0x21')](respondWithFilteredResult(_0x3fc164,_0x25a379))[_0x4fbc('0x41')](handleError(_0x3fc164,null));};exports[_0x4fbc('0x42')]=function(_0x28cc8c,_0x21019f){var _0x272978={'raw':!![],'where':{'id':_0x28cc8c['params']['id']}},_0x2829fd={};_0x2829fd[_0x4fbc('0x2d')]=_[_0x4fbc('0x2e')](db['AnalyticTreeReport'][_0x4fbc('0x29')]);_0x2829fd[_0x4fbc('0x30')]=_['keys'](_0x28cc8c['query']);_0x2829fd[_0x4fbc('0x2f')]=_[_0x4fbc('0x31')](_0x2829fd[_0x4fbc('0x2d')],_0x2829fd['query']);_0x272978[_0x4fbc('0x33')]=_[_0x4fbc('0x31')](_0x2829fd[_0x4fbc('0x2d')],qs[_0x4fbc('0x32')](_0x28cc8c[_0x4fbc('0x30')][_0x4fbc('0x32')]));_0x272978[_0x4fbc('0x33')]=_0x272978[_0x4fbc('0x33')][_0x4fbc('0x43')]?_0x272978['attributes']:_0x2829fd[_0x4fbc('0x2d')];if(_0x28cc8c['query'][_0x4fbc('0x44')]){_0x272978[_0x4fbc('0x3e')]=[{'all':!![]}];}_0x272978=_['merge']({},_0x272978,_0x28cc8c[_0x4fbc('0x3d')]);return db[_0x4fbc('0x28')]['find'](_0x272978)[_0x4fbc('0x21')](handleEntityNotFound(_0x21019f,null))['then'](respondWithResult(_0x21019f,null))[_0x4fbc('0x41')](handleError(_0x21019f,null));};exports[_0x4fbc('0x45')]=function(_0x22d06c,_0x5de2b8){return db[_0x4fbc('0x28')]['create'](_0x22d06c[_0x4fbc('0x46')],{})['then'](respondWithResult(_0x5de2b8,0xc9))[_0x4fbc('0x41')](handleError(_0x5de2b8,null));};exports[_0x4fbc('0x47')]=function(_0x54b297,_0x281ac2){if(_0x54b297[_0x4fbc('0x46')]['id']){delete _0x54b297[_0x4fbc('0x46')]['id'];}return db[_0x4fbc('0x28')][_0x4fbc('0x48')]({'where':{'id':_0x54b297[_0x4fbc('0x49')]['id']}})[_0x4fbc('0x21')](handleEntityNotFound(_0x281ac2,null))['then'](saveUpdates(_0x54b297[_0x4fbc('0x46')],null))[_0x4fbc('0x21')](respondWithResult(_0x281ac2,null))[_0x4fbc('0x41')](handleError(_0x281ac2,null));};exports['destroy']=function(_0x29087a,_0x27e72f){return db[_0x4fbc('0x28')][_0x4fbc('0x48')]({'where':{'id':_0x29087a[_0x4fbc('0x49')]['id']}})['then'](handleEntityNotFound(_0x27e72f,null))[_0x4fbc('0x21')](removeEntity(_0x27e72f,null))['catch'](handleError(_0x27e72f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a81fe20..267375e 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 _0xbcb5=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x5cb54b,_0x5b038c){var _0xaeb5c4=function(_0x10ab41){while(--_0x10ab41){_0x5cb54b['push'](_0x5cb54b['shift']());}};_0xaeb5c4(++_0x5b038c);}(_0xbcb5,0x15f));var _0x5bcb=function(_0x62ae40,_0x573e9a){_0x62ae40=_0x62ae40-0x0;var _0x5364cb=_0xbcb5[_0x62ae40];return _0x5364cb;};'use strict';var _=require(_0x5bcb('0x0'));var util=require(_0x5bcb('0x1'));var logger=require(_0x5bcb('0x2'))(_0x5bcb('0x3'));var moment=require('moment');var BPromise=require(_0x5bcb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bcb('0x5'));var rimraf=require(_0x5bcb('0x6'));var config=require(_0x5bcb('0x7'));var attributes=require(_0x5bcb('0x8'));module[_0x5bcb('0x9')]=function(_0x4b5df3,_0x52ccc2){return _0x4b5df3[_0x5bcb('0xa')](_0x5bcb('0xb'),attributes,{'tableName':_0x5bcb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd6=['define','analytics_report_trees','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./analyticTreeReport.attributes'];(function(_0x51afd2,_0x1c238c){var _0x30a347=function(_0x5cca66){while(--_0x5cca66){_0x51afd2['push'](_0x51afd2['shift']());}};_0x30a347(++_0x1c238c);}(_0x7bd6,0x178));var _0x67bd=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x7bd6[_0x3e3bee];return _0x3ae14c;};'use strict';var _=require(_0x67bd('0x0'));var util=require(_0x67bd('0x1'));var logger=require(_0x67bd('0x2'))(_0x67bd('0x3'));var moment=require(_0x67bd('0x4'));var BPromise=require('bluebird');var rp=require(_0x67bd('0x5'));var fs=require('fs');var path=require(_0x67bd('0x6'));var rimraf=require(_0x67bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x67bd('0x8'));module['exports']=function(_0x2043a3,_0x5996ea){return _0x2043a3[_0x67bd('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x67bd('0xa'),'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 136cdc4..c57683a 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 _0x4e35=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticTreeReport,\x20%s,\x20%s'];(function(_0x3f74ac,_0x2dca2a){var _0x32fc00=function(_0x2ffa2b){while(--_0x2ffa2b){_0x3f74ac['push'](_0x3f74ac['shift']());}};_0x32fc00(++_0x2dca2a);}(_0x4e35,0x76));var _0x54e3=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x4e35[_0x310d10];return _0x1fb8af;};'use strict';var _=require(_0x54e3('0x0'));var util=require(_0x54e3('0x1'));var moment=require(_0x54e3('0x2'));var BPromise=require(_0x54e3('0x3'));var rs=require(_0x54e3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x54e3('0x6'))(_0x54e3('0x7'));var config=require(_0x54e3('0x8'));var jayson=require(_0x54e3('0x9'));var client=jayson['client'][_0x54e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15af7a,_0x4af0f4,_0x5ab1b2){return new BPromise(function(_0x1514a6,_0x1b7731){return client[_0x54e3('0xb')](_0x15af7a,_0x5ab1b2)[_0x54e3('0xc')](function(_0x42ae5b){logger[_0x54e3('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4af0f4,_0x54e3('0xe'));logger[_0x54e3('0xf')](_0x54e3('0x10'),_0x4af0f4,_0x54e3('0xe'),JSON[_0x54e3('0x11')](_0x42ae5b));if(_0x42ae5b[_0x54e3('0x12')]){if(_0x42ae5b['error']['code']===0x1f4){logger['error'](_0x54e3('0x13'),_0x4af0f4,_0x42ae5b[_0x54e3('0x12')][_0x54e3('0x14')]);return _0x1b7731(_0x42ae5b[_0x54e3('0x12')][_0x54e3('0x14')]);}logger[_0x54e3('0x12')](_0x54e3('0x13'),_0x4af0f4,_0x42ae5b[_0x54e3('0x12')][_0x54e3('0x14')]);return _0x1514a6(_0x42ae5b['error'][_0x54e3('0x14')]);}else{logger[_0x54e3('0xd')](_0x54e3('0x13'),_0x4af0f4,_0x54e3('0xe'));_0x1514a6(_0x42ae5b[_0x54e3('0x15')][_0x54e3('0x14')]);}})[_0x54e3('0x16')](function(_0x11e84e){logger[_0x54e3('0x12')](_0x54e3('0x13'),_0x4af0f4,_0x11e84e);_0x1b7731(_0x11e84e);});});} \ No newline at end of file +var _0xe030=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x5d02c9,_0x5adbd0){var _0x1abd12=function(_0x48deb4){while(--_0x48deb4){_0x5d02c9['push'](_0x5d02c9['shift']());}};_0x1abd12(++_0x5adbd0);}(_0xe030,0xaf));var _0x0e03=function(_0xb4e2df,_0x1cbb7c){_0xb4e2df=_0xb4e2df-0x0;var _0x5e95ba=_0xe030[_0xb4e2df];return _0x5e95ba;};'use strict';var _=require(_0x0e03('0x0'));var util=require(_0x0e03('0x1'));var moment=require(_0x0e03('0x2'));var BPromise=require('bluebird');var rs=require(_0x0e03('0x3'));var fs=require('fs');var Redis=require(_0x0e03('0x4'));var db=require(_0x0e03('0x5'))['db'];var utils=require(_0x0e03('0x6'));var logger=require(_0x0e03('0x7'))(_0x0e03('0x8'));var config=require(_0x0e03('0x9'));var jayson=require(_0x0e03('0xa'));var client=jayson[_0x0e03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d3d98,_0x1bc484,_0x3dd215){return new BPromise(function(_0x240588,_0x23f874){return client['request'](_0x3d3d98,_0x3dd215)[_0x0e03('0xc')](function(_0x614bd7){logger['info'](_0x0e03('0xd'),_0x1bc484,_0x0e03('0xe'));logger['debug'](_0x0e03('0xf'),_0x1bc484,_0x0e03('0xe'),JSON[_0x0e03('0x10')](_0x614bd7));if(_0x614bd7[_0x0e03('0x11')]){if(_0x614bd7[_0x0e03('0x11')]['code']===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x1bc484,_0x614bd7[_0x0e03('0x11')][_0x0e03('0x12')]);return _0x23f874(_0x614bd7[_0x0e03('0x11')][_0x0e03('0x12')]);}logger['error'](_0x0e03('0xd'),_0x1bc484,_0x614bd7[_0x0e03('0x11')][_0x0e03('0x12')]);return _0x240588(_0x614bd7[_0x0e03('0x11')][_0x0e03('0x12')]);}else{logger[_0x0e03('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1bc484,_0x0e03('0xe'));_0x240588(_0x614bd7[_0x0e03('0x14')][_0x0e03('0x12')]);}})[_0x0e03('0x15')](function(_0x58f5d7){logger[_0x0e03('0x11')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1bc484,_0x58f5d7);_0x23f874(_0x58f5d7);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 8240e95..8775a51 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 _0x92db=['Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','util','connect-timeout'];(function(_0x5cc486,_0x41ac4c){var _0x2ef367=function(_0x5456b0){while(--_0x5456b0){_0x5cc486['push'](_0x5cc486['shift']());}};_0x2ef367(++_0x41ac4c);}(_0x92db,0x163));var _0xb92d=function(_0x43aae6,_0x4c34d6){_0x43aae6=_0x43aae6-0x0;var _0x1913bb=_0x92db[_0x43aae6];return _0x1913bb;};'use strict';var multer=require('multer');var util=require(_0xb92d('0x0'));var path=require('path');var timeout=require(_0xb92d('0x1'));var express=require('express');var router=express[_0xb92d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xb92d('0x3'));var config=require(_0xb92d('0x4'));var controller=require(_0xb92d('0x5'));router[_0xb92d('0x6')]('/',auth[_0xb92d('0x7')](),controller[_0xb92d('0x8')]);router['get']('/:id',auth[_0xb92d('0x7')](),controller[_0xb92d('0x9')]);router[_0xb92d('0xa')]('/',auth[_0xb92d('0x7')](),controller[_0xb92d('0xb')]);router[_0xb92d('0xc')](_0xb92d('0xd'),auth[_0xb92d('0x7')](),controller[_0xb92d('0xe')]);router[_0xb92d('0xf')](_0xb92d('0xd'),auth[_0xb92d('0x7')](),controller['destroy']);module[_0xb92d('0x10')]=router; \ No newline at end of file +var _0x6a4e=['show','post','isAuthenticated','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','index'];(function(_0x26ecbc,_0x2f8aef){var _0x25d408=function(_0x1c2a51){while(--_0x1c2a51){_0x26ecbc['push'](_0x26ecbc['shift']());}};_0x25d408(++_0x2f8aef);}(_0x6a4e,0x139));var _0xe6a4=function(_0x5cfa35,_0x5eb7f0){_0x5cfa35=_0x5cfa35-0x0;var _0xf7dffb=_0x6a4e[_0x5cfa35];return _0xf7dffb;};'use strict';var multer=require(_0xe6a4('0x0'));var util=require(_0xe6a4('0x1'));var path=require(_0xe6a4('0x2'));var timeout=require(_0xe6a4('0x3'));var express=require('express');var router=express[_0xe6a4('0x4')]();var auth=require(_0xe6a4('0x5'));var interaction=require(_0xe6a4('0x6'));var config=require('../../config/environment');var controller=require(_0xe6a4('0x7'));router[_0xe6a4('0x8')]('/',auth['isAuthenticated'](),controller[_0xe6a4('0x9')]);router[_0xe6a4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe6a4('0xa')]);router[_0xe6a4('0xb')]('/',auth[_0xe6a4('0xc')](),controller[_0xe6a4('0xd')]);router[_0xe6a4('0xe')](_0xe6a4('0xf'),auth['isAuthenticated'](),controller[_0xe6a4('0x10')]);router[_0xe6a4('0x11')]('/:id',auth[_0xe6a4('0xc')](),controller['destroy']);module[_0xe6a4('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 2b27454..38bcc98 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 _0x81d4=['sequelize','exports','STRING'];(function(_0xffc0e7,_0x4ae80b){var _0x21ea1a=function(_0x44a9a2){while(--_0x44a9a2){_0xffc0e7['push'](_0xffc0e7['shift']());}};_0x21ea1a(++_0x4ae80b);}(_0x81d4,0xc0));var _0x481d=function(_0x406ef5,_0x5bf927){_0x406ef5=_0x406ef5-0x0;var _0x2b96d2=_0x81d4[_0x406ef5];return _0x2b96d2;};'use strict';var Sequelize=require(_0x481d('0x0'));module[_0x481d('0x1')]={'name':{'type':Sequelize[_0x481d('0x2')]},'basename':{'type':Sequelize[_0x481d('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9043=['exports','STRING'];(function(_0x35c33d,_0x46defa){var _0x5139b3=function(_0x427391){while(--_0x427391){_0x35c33d['push'](_0x35c33d['shift']());}};_0x5139b3(++_0x46defa);}(_0x9043,0xd0));var _0x3904=function(_0x2d9ae8,_0x3985fc){_0x2d9ae8=_0x2d9ae8-0x0;var _0x2be845=_0x9043[_0x2d9ae8];return _0x2be845;};'use strict';var Sequelize=require('sequelize');module[_0x3904('0x0')]={'name':{'type':Sequelize[_0x3904('0x1')]},'basename':{'type':Sequelize[_0x3904('0x1')]},'type':{'type':Sequelize[_0x3904('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index d09c0e6..c3dc42d 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 _0x6e98=['intersection','find','catch','params','omit','createdAt','updatedAt','body','file','originalname','basename','filename','mimetype','create','download','findOne','root','server/files/attachments/','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','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','../../mysqldb','sendStatus','end','status','count','offset','json','reject','update','then','destroy','error','stack','name','map','Attachment','rawAttributes','fieldName','keys','query','filters','fields','attributes','length','model','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','merge','includeAll','include','findAll','rows'];(function(_0x3bdb7c,_0x2b2e13){var _0x299ed4=function(_0xef4f5a){while(--_0xef4f5a){_0x3bdb7c['push'](_0x3bdb7c['shift']());}};_0x299ed4(++_0x2b2e13);}(_0x6e98,0xff));var _0x86e9=function(_0xf93076,_0x1acb30){_0xf93076=_0xf93076-0x0;var _0x33d1da=_0x6e98[_0xf93076];return _0x33d1da;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x86e9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x86e9('0x1'));var rp=require('request-promise');var moment=require(_0x86e9('0x2'));var BPromise=require(_0x86e9('0x3'));var Mustache=require(_0x86e9('0x4'));var util=require(_0x86e9('0x5'));var path=require(_0x86e9('0x6'));var sox=require(_0x86e9('0x7'));var csv=require(_0x86e9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x86e9('0x9'));var squel=require(_0x86e9('0xa'));var crypto=require(_0x86e9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x86e9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x86e9('0xd'));var Papa=require(_0x86e9('0xe'));var Redis=require(_0x86e9('0xf'));var authService=require(_0x86e9('0x10'));var qs=require(_0x86e9('0x11'));var as=require(_0x86e9('0x12'));var hardwareService=require(_0x86e9('0x13'));var logger=require(_0x86e9('0x14'))(_0x86e9('0x15'));var utils=require(_0x86e9('0x16'));var config=require('../../config/environment');var db=require(_0x86e9('0x17'))['db'];function respondWithStatusCode(_0xeec1d5,_0x11e4eb){_0x11e4eb=_0x11e4eb||0xcc;return function(_0x1dd62a){if(_0x1dd62a){return _0xeec1d5[_0x86e9('0x18')](_0x11e4eb);}return _0xeec1d5['status'](_0x11e4eb)[_0x86e9('0x19')]();};}function respondWithResult(_0x596a1c,_0x2fadb7){_0x2fadb7=_0x2fadb7||0xc8;return function(_0x20b1b4){if(_0x20b1b4){return _0x596a1c[_0x86e9('0x1a')](_0x2fadb7)['json'](_0x20b1b4);}};}function respondWithFilteredResult(_0x8fdfd,_0x227461){return function(_0x10f2ef){if(_0x10f2ef){var _0x26ea51=_0x10f2ef[_0x86e9('0x1b')],_0x197097=_0x227461[_0x86e9('0x1c')],_0x54b6ef=_0x227461[_0x86e9('0x1c')]+_0x227461['limit'],_0x20f48a;if(_0x54b6ef>=_0x26ea51){_0x54b6ef=_0x26ea51;_0x20f48a=0xc8;}else{_0x20f48a=0xce;}_0x8fdfd[_0x86e9('0x1a')](_0x20f48a);return _0x8fdfd['set']('Content-Range',_0x197097+'-'+_0x54b6ef+'/'+_0x26ea51)[_0x86e9('0x1d')](_0x10f2ef);}return null;};}function patchUpdates(_0x49d03f){return function(_0x5efb16){try{jsonpatch['apply'](_0x5efb16,_0x49d03f,!![]);}catch(_0x3f6db7){return BPromise[_0x86e9('0x1e')](_0x3f6db7);}return _0x5efb16['save']();};}function saveUpdates(_0x3e526a,_0x2de0e1){return function(_0x433dfa){if(_0x433dfa){return _0x433dfa[_0x86e9('0x1f')](_0x3e526a)[_0x86e9('0x20')](function(_0x2a8450){return _0x2a8450;});}return null;};}function removeEntity(_0x5bb92f,_0x45064a){return function(_0x1cc1c3){if(_0x1cc1c3){return _0x1cc1c3[_0x86e9('0x21')]()[_0x86e9('0x20')](function(){_0x5bb92f[_0x86e9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd4298,_0x54527d){return function(_0x48ab9d){if(!_0x48ab9d){_0xd4298[_0x86e9('0x18')](0x194);}return _0x48ab9d;};}function handleError(_0x27de41,_0x46f0f8){_0x46f0f8=_0x46f0f8||0x1f4;return function(_0x309081){logger[_0x86e9('0x22')](_0x309081[_0x86e9('0x23')]);if(_0x309081[_0x86e9('0x24')]){delete _0x309081[_0x86e9('0x24')];}_0x27de41['status'](_0x46f0f8)['send'](_0x309081);};}exports['index']=function(_0x3fc785,_0x1208d7){var _0x14ef6b={},_0x41645f={},_0x39aae0={'count':0x0,'rows':[]};var _0x481619=_[_0x86e9('0x25')](db[_0x86e9('0x26')][_0x86e9('0x27')],function(_0x3bf0d9){return{'name':_0x3bf0d9[_0x86e9('0x28')],'type':_0x3bf0d9['type']['key']};});_0x41645f['model']=_[_0x86e9('0x25')](_0x481619,_0x86e9('0x24'));_0x41645f['query']=_[_0x86e9('0x29')](_0x3fc785[_0x86e9('0x2a')]);_0x41645f[_0x86e9('0x2b')]=_['intersection'](_0x41645f['model'],_0x41645f['query']);_0x14ef6b['attributes']=_['intersection'](_0x41645f['model'],qs['fields'](_0x3fc785[_0x86e9('0x2a')][_0x86e9('0x2c')]));_0x14ef6b['attributes']=_0x14ef6b[_0x86e9('0x2d')][_0x86e9('0x2e')]?_0x14ef6b['attributes']:_0x41645f[_0x86e9('0x2f')];if(!_0x3fc785[_0x86e9('0x2a')][_0x86e9('0x30')](_0x86e9('0x31'))){_0x14ef6b[_0x86e9('0x32')]=qs[_0x86e9('0x32')](_0x3fc785[_0x86e9('0x2a')]['limit']);_0x14ef6b[_0x86e9('0x1c')]=qs['offset'](_0x3fc785['query'][_0x86e9('0x1c')]);}_0x14ef6b['order']=qs[_0x86e9('0x33')](_0x3fc785[_0x86e9('0x2a')][_0x86e9('0x33')]);_0x14ef6b[_0x86e9('0x34')]=qs[_0x86e9('0x2b')](_[_0x86e9('0x35')](_0x3fc785[_0x86e9('0x2a')],_0x41645f[_0x86e9('0x2b')]),_0x481619);if(_0x3fc785['query'][_0x86e9('0x36')]){_0x14ef6b[_0x86e9('0x34')]=_['merge'](_0x14ef6b[_0x86e9('0x34')],{'$or':_[_0x86e9('0x25')](_0x481619,function(_0x405889){if(_0x405889[_0x86e9('0x37')]!=='VIRTUAL'){var _0x259380={};_0x259380[_0x405889[_0x86e9('0x24')]]={'$like':'%'+_0x3fc785[_0x86e9('0x2a')][_0x86e9('0x36')]+'%'};return _0x259380;}})});}_0x14ef6b=_[_0x86e9('0x38')]({},_0x14ef6b,_0x3fc785['options']);var _0x3d3280={'where':_0x14ef6b[_0x86e9('0x34')]};return db[_0x86e9('0x26')]['count'](_0x3d3280)[_0x86e9('0x20')](function(_0x2a9210){_0x39aae0['count']=_0x2a9210;if(_0x3fc785[_0x86e9('0x2a')][_0x86e9('0x39')]){_0x14ef6b[_0x86e9('0x3a')]=[{'all':!![]}];}return db[_0x86e9('0x26')][_0x86e9('0x3b')](_0x14ef6b);})[_0x86e9('0x20')](function(_0x1e0a98){_0x39aae0[_0x86e9('0x3c')]=_0x1e0a98;return _0x39aae0;})['then'](respondWithFilteredResult(_0x1208d7,_0x14ef6b))['catch'](handleError(_0x1208d7,null));};exports['show']=function(_0x37e225,_0x5ea145){var _0x10755b={'raw':!![],'where':{'id':_0x37e225['params']['id']}},_0x30362c={};_0x30362c['model']=_['keys'](db[_0x86e9('0x26')][_0x86e9('0x27')]);_0x30362c['query']=_[_0x86e9('0x29')](_0x37e225[_0x86e9('0x2a')]);_0x30362c[_0x86e9('0x2b')]=_['intersection'](_0x30362c[_0x86e9('0x2f')],_0x30362c['query']);_0x10755b['attributes']=_[_0x86e9('0x3d')](_0x30362c[_0x86e9('0x2f')],qs['fields'](_0x37e225[_0x86e9('0x2a')][_0x86e9('0x2c')]));_0x10755b['attributes']=_0x10755b[_0x86e9('0x2d')][_0x86e9('0x2e')]?_0x10755b[_0x86e9('0x2d')]:_0x30362c[_0x86e9('0x2f')];if(_0x37e225[_0x86e9('0x2a')][_0x86e9('0x39')]){_0x10755b[_0x86e9('0x3a')]=[{'all':!![]}];}_0x10755b=_[_0x86e9('0x38')]({},_0x10755b,_0x37e225['options']);return db['Attachment'][_0x86e9('0x3e')](_0x10755b)[_0x86e9('0x20')](handleEntityNotFound(_0x5ea145,null))[_0x86e9('0x20')](respondWithResult(_0x5ea145,null))[_0x86e9('0x3f')](handleError(_0x5ea145,null));};exports['clone']=function(_0x296f9d,_0x4c21ca){var _0x2cead2={'where':{'id':_0x296f9d[_0x86e9('0x40')]['id']}},_0x4e0f55={};_0x4e0f55[_0x86e9('0x2f')]=_['keys'](db[_0x86e9('0x26')][_0x86e9('0x27')]);_0x2cead2[_0x86e9('0x2d')]=_[_0x86e9('0x3d')](_0x4e0f55['model'],qs[_0x86e9('0x2c')](_0x296f9d['query'][_0x86e9('0x2c')]));_0x2cead2[_0x86e9('0x2d')]=_0x2cead2[_0x86e9('0x2d')]['length']?_0x2cead2['attributes']:_0x4e0f55[_0x86e9('0x2f')];if(_0x296f9d[_0x86e9('0x2a')]['includeAll']){_0x2cead2[_0x86e9('0x3a')]=[{'all':!![]}];}_0x2cead2=_['merge']({},_0x2cead2,_0x296f9d['options']);return db['Attachment']['find'](_0x2cead2)[_0x86e9('0x20')](handleEntityNotFound(_0x4c21ca,null))[_0x86e9('0x20')](function(_0x1fa238){if(_0x1fa238){var _0x36f416=_0x1fa238['get']({'plain':!![]});_0x36f416=qs[_0x86e9('0x41')](_0x36f416,['id',_0x86e9('0x42'),_0x86e9('0x43')]);_0x296f9d['body']=_[_0x86e9('0x41')](_0x296f9d[_0x86e9('0x44')],['id','createdAt',_0x86e9('0x43')]);return db['Attachment']['create'](_[_0x86e9('0x38')](_0x36f416,_0x296f9d['body']),{'include':_0x296f9d[_0x86e9('0x2a')][_0x86e9('0x39')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4c21ca,0xc9))[_0x86e9('0x3f')](handleError(_0x4c21ca,null));};exports[_0x86e9('0x1f')]=function(_0x34207e,_0x5cc2fe){if(_0x34207e[_0x86e9('0x44')]['id']){delete _0x34207e[_0x86e9('0x44')]['id'];}return db['Attachment'][_0x86e9('0x3e')]({'where':{'id':_0x34207e[_0x86e9('0x40')]['id']}})[_0x86e9('0x20')](handleEntityNotFound(_0x5cc2fe,null))['then'](saveUpdates(_0x34207e['body'],null))[_0x86e9('0x20')](respondWithResult(_0x5cc2fe,null))[_0x86e9('0x3f')](handleError(_0x5cc2fe,null));};exports[_0x86e9('0x21')]=function(_0x2855cb,_0x46ce1f){return db[_0x86e9('0x26')][_0x86e9('0x3e')]({'where':{'id':_0x2855cb['params']['id']}})['then'](handleEntityNotFound(_0x46ce1f,null))[_0x86e9('0x20')](removeEntity(_0x46ce1f,null))['catch'](handleError(_0x46ce1f,null));};exports['create']=function(_0x4375f1,_0x59775c,_0x2dc8c1){_0x4375f1['body'][_0x86e9('0x24')]=_0x4375f1[_0x86e9('0x45')][_0x86e9('0x46')];_0x4375f1[_0x86e9('0x44')][_0x86e9('0x47')]=_0x4375f1[_0x86e9('0x45')][_0x86e9('0x48')];_0x4375f1[_0x86e9('0x44')][_0x86e9('0x37')]=_0x4375f1[_0x86e9('0x45')][_0x86e9('0x49')];return db[_0x86e9('0x26')][_0x86e9('0x4a')](_0x4375f1[_0x86e9('0x44')])[_0x86e9('0x20')](respondWithResult(_0x59775c,0xc9))['catch'](handleError(_0x59775c,null));};exports[_0x86e9('0x4b')]=function(_0x150017,_0x4461d9,_0x3aeafb){return db[_0x86e9('0x26')][_0x86e9('0x4c')]({'where':{'id':_0x150017[_0x86e9('0x40')]['id']},'raw':!![]})[_0x86e9('0x20')](handleEntityNotFound(_0x4461d9,null))[_0x86e9('0x20')](function(_0x47b673){if(_0x47b673){return _0x4461d9[_0x86e9('0x4b')](path['join'](config[_0x86e9('0x4d')],_0x86e9('0x4e'),_0x47b673[_0x86e9('0x47')]));}})[_0x86e9('0x3f')](handleError(_0x4461d9,null));}; \ No newline at end of file +var _0x5d0b=['filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','clone','find','get','omit','updatedAt','create','body','file','filename','mimetype','download','findOne','join','root','server/files/attachments/','basename','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','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','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick'];(function(_0x4a0a4c,_0x74a4f9){var _0x1a945c=function(_0x539715){while(--_0x539715){_0x4a0a4c['push'](_0x4a0a4c['shift']());}};_0x1a945c(++_0x74a4f9);}(_0x5d0b,0xce));var _0xb5d0=function(_0x32e90a,_0x317d6f){_0x32e90a=_0x32e90a-0x0;var _0x3ad167=_0x5d0b[_0x32e90a];return _0x3ad167;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb5d0('0x0'));var rimraf=require(_0xb5d0('0x1'));var zipdir=require(_0xb5d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb5d0('0x3'));var BPromise=require(_0xb5d0('0x4'));var Mustache=require(_0xb5d0('0x5'));var util=require(_0xb5d0('0x6'));var path=require('path');var sox=require(_0xb5d0('0x7'));var csv=require('to-csv');var ejs=require(_0xb5d0('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb5d0('0x9'));var crypto=require(_0xb5d0('0xa'));var jsforce=require(_0xb5d0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb5d0('0xc'));var querystring=require(_0xb5d0('0xd'));var Papa=require(_0xb5d0('0xe'));var Redis=require(_0xb5d0('0xf'));var authService=require(_0xb5d0('0x10'));var qs=require(_0xb5d0('0x11'));var as=require(_0xb5d0('0x12'));var hardwareService=require(_0xb5d0('0x13'));var logger=require(_0xb5d0('0x14'))(_0xb5d0('0x15'));var utils=require(_0xb5d0('0x16'));var config=require(_0xb5d0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34634c,_0x506bdd){_0x506bdd=_0x506bdd||0xcc;return function(_0x32ac37){if(_0x32ac37){return _0x34634c['sendStatus'](_0x506bdd);}return _0x34634c[_0xb5d0('0x18')](_0x506bdd)[_0xb5d0('0x19')]();};}function respondWithResult(_0xecddbc,_0x13a49d){_0x13a49d=_0x13a49d||0xc8;return function(_0x56bfc0){if(_0x56bfc0){return _0xecddbc['status'](_0x13a49d)[_0xb5d0('0x1a')](_0x56bfc0);}};}function respondWithFilteredResult(_0x21e17d,_0x586ea0){return function(_0x212c58){if(_0x212c58){var _0x4ef1d3=_0x212c58[_0xb5d0('0x1b')],_0x19dc79=_0x586ea0[_0xb5d0('0x1c')],_0x1fda26=_0x586ea0[_0xb5d0('0x1c')]+_0x586ea0[_0xb5d0('0x1d')],_0x139a40;if(_0x1fda26>=_0x4ef1d3){_0x1fda26=_0x4ef1d3;_0x139a40=0xc8;}else{_0x139a40=0xce;}_0x21e17d['status'](_0x139a40);return _0x21e17d[_0xb5d0('0x1e')](_0xb5d0('0x1f'),_0x19dc79+'-'+_0x1fda26+'/'+_0x4ef1d3)['json'](_0x212c58);}return null;};}function patchUpdates(_0x1a0417){return function(_0x2d4fe0){try{jsonpatch[_0xb5d0('0x20')](_0x2d4fe0,_0x1a0417,!![]);}catch(_0x33fb84){return BPromise[_0xb5d0('0x21')](_0x33fb84);}return _0x2d4fe0[_0xb5d0('0x22')]();};}function saveUpdates(_0x3d5987,_0x14a0b3){return function(_0x47173a){if(_0x47173a){return _0x47173a[_0xb5d0('0x23')](_0x3d5987)[_0xb5d0('0x24')](function(_0x58eb35){return _0x58eb35;});}return null;};}function removeEntity(_0x23cc12,_0x255343){return function(_0x4cc991){if(_0x4cc991){return _0x4cc991[_0xb5d0('0x25')]()['then'](function(){_0x23cc12[_0xb5d0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x565768,_0x4de414){return function(_0x4cfb80){if(!_0x4cfb80){_0x565768[_0xb5d0('0x26')](0x194);}return _0x4cfb80;};}function handleError(_0xd8119f,_0x399e46){_0x399e46=_0x399e46||0x1f4;return function(_0x179f00){logger[_0xb5d0('0x27')](_0x179f00[_0xb5d0('0x28')]);if(_0x179f00[_0xb5d0('0x29')]){delete _0x179f00['name'];}_0xd8119f[_0xb5d0('0x18')](_0x399e46)[_0xb5d0('0x2a')](_0x179f00);};}exports[_0xb5d0('0x2b')]=function(_0x2f4ba1,_0x3d7807){var _0x13062d={},_0x3a7e84={},_0x4ca125={'count':0x0,'rows':[]};var _0x36fd27=_[_0xb5d0('0x2c')](db[_0xb5d0('0x2d')][_0xb5d0('0x2e')],function(_0x29fe9e){return{'name':_0x29fe9e['fieldName'],'type':_0x29fe9e[_0xb5d0('0x2f')][_0xb5d0('0x30')]};});_0x3a7e84[_0xb5d0('0x31')]=_[_0xb5d0('0x2c')](_0x36fd27,_0xb5d0('0x29'));_0x3a7e84[_0xb5d0('0x32')]=_[_0xb5d0('0x33')](_0x2f4ba1[_0xb5d0('0x32')]);_0x3a7e84[_0xb5d0('0x34')]=_[_0xb5d0('0x35')](_0x3a7e84[_0xb5d0('0x31')],_0x3a7e84['query']);_0x13062d[_0xb5d0('0x36')]=_[_0xb5d0('0x35')](_0x3a7e84[_0xb5d0('0x31')],qs[_0xb5d0('0x37')](_0x2f4ba1['query'][_0xb5d0('0x37')]));_0x13062d[_0xb5d0('0x36')]=_0x13062d[_0xb5d0('0x36')][_0xb5d0('0x38')]?_0x13062d[_0xb5d0('0x36')]:_0x3a7e84['model'];if(!_0x2f4ba1[_0xb5d0('0x32')]['hasOwnProperty'](_0xb5d0('0x39'))){_0x13062d[_0xb5d0('0x1d')]=qs[_0xb5d0('0x1d')](_0x2f4ba1['query'][_0xb5d0('0x1d')]);_0x13062d[_0xb5d0('0x1c')]=qs[_0xb5d0('0x1c')](_0x2f4ba1[_0xb5d0('0x32')]['offset']);}_0x13062d[_0xb5d0('0x3a')]=qs['sort'](_0x2f4ba1[_0xb5d0('0x32')][_0xb5d0('0x3b')]);_0x13062d['where']=qs[_0xb5d0('0x34')](_[_0xb5d0('0x3c')](_0x2f4ba1[_0xb5d0('0x32')],_0x3a7e84['filters']),_0x36fd27);if(_0x2f4ba1['query'][_0xb5d0('0x3d')]){_0x13062d[_0xb5d0('0x3e')]=_[_0xb5d0('0x3f')](_0x13062d[_0xb5d0('0x3e')],{'$or':_[_0xb5d0('0x2c')](_0x36fd27,function(_0x1f591c){if(_0x1f591c[_0xb5d0('0x2f')]!==_0xb5d0('0x40')){var _0x34c551={};_0x34c551[_0x1f591c[_0xb5d0('0x29')]]={'$like':'%'+_0x2f4ba1[_0xb5d0('0x32')][_0xb5d0('0x3d')]+'%'};return _0x34c551;}})});}_0x13062d=_[_0xb5d0('0x3f')]({},_0x13062d,_0x2f4ba1[_0xb5d0('0x41')]);var _0x1bf7aa={'where':_0x13062d[_0xb5d0('0x3e')]};return db[_0xb5d0('0x2d')][_0xb5d0('0x1b')](_0x1bf7aa)[_0xb5d0('0x24')](function(_0x4d0d29){_0x4ca125['count']=_0x4d0d29;if(_0x2f4ba1[_0xb5d0('0x32')][_0xb5d0('0x42')]){_0x13062d['include']=[{'all':!![]}];}return db[_0xb5d0('0x2d')][_0xb5d0('0x43')](_0x13062d);})[_0xb5d0('0x24')](function(_0xc02022){_0x4ca125[_0xb5d0('0x44')]=_0xc02022;return _0x4ca125;})[_0xb5d0('0x24')](respondWithFilteredResult(_0x3d7807,_0x13062d))[_0xb5d0('0x45')](handleError(_0x3d7807,null));};exports[_0xb5d0('0x46')]=function(_0x16953c,_0x523e23){var _0x43fa69={'raw':!![],'where':{'id':_0x16953c[_0xb5d0('0x47')]['id']}},_0x4f132f={};_0x4f132f[_0xb5d0('0x31')]=_['keys'](db[_0xb5d0('0x2d')]['rawAttributes']);_0x4f132f[_0xb5d0('0x32')]=_[_0xb5d0('0x33')](_0x16953c[_0xb5d0('0x32')]);_0x4f132f[_0xb5d0('0x34')]=_['intersection'](_0x4f132f[_0xb5d0('0x31')],_0x4f132f[_0xb5d0('0x32')]);_0x43fa69['attributes']=_[_0xb5d0('0x35')](_0x4f132f['model'],qs[_0xb5d0('0x37')](_0x16953c[_0xb5d0('0x32')][_0xb5d0('0x37')]));_0x43fa69[_0xb5d0('0x36')]=_0x43fa69['attributes'][_0xb5d0('0x38')]?_0x43fa69[_0xb5d0('0x36')]:_0x4f132f['model'];if(_0x16953c[_0xb5d0('0x32')][_0xb5d0('0x42')]){_0x43fa69[_0xb5d0('0x48')]=[{'all':!![]}];}_0x43fa69=_['merge']({},_0x43fa69,_0x16953c[_0xb5d0('0x41')]);return db[_0xb5d0('0x2d')]['find'](_0x43fa69)[_0xb5d0('0x24')](handleEntityNotFound(_0x523e23,null))[_0xb5d0('0x24')](respondWithResult(_0x523e23,null))['catch'](handleError(_0x523e23,null));};exports[_0xb5d0('0x49')]=function(_0x5e73af,_0x1c1744){var _0x222d0f={'where':{'id':_0x5e73af[_0xb5d0('0x47')]['id']}},_0x4cad32={};_0x4cad32[_0xb5d0('0x31')]=_[_0xb5d0('0x33')](db['Attachment']['rawAttributes']);_0x222d0f[_0xb5d0('0x36')]=_[_0xb5d0('0x35')](_0x4cad32[_0xb5d0('0x31')],qs[_0xb5d0('0x37')](_0x5e73af[_0xb5d0('0x32')]['fields']));_0x222d0f[_0xb5d0('0x36')]=_0x222d0f[_0xb5d0('0x36')][_0xb5d0('0x38')]?_0x222d0f[_0xb5d0('0x36')]:_0x4cad32[_0xb5d0('0x31')];if(_0x5e73af[_0xb5d0('0x32')][_0xb5d0('0x42')]){_0x222d0f['include']=[{'all':!![]}];}_0x222d0f=_[_0xb5d0('0x3f')]({},_0x222d0f,_0x5e73af['options']);return db[_0xb5d0('0x2d')][_0xb5d0('0x4a')](_0x222d0f)[_0xb5d0('0x24')](handleEntityNotFound(_0x1c1744,null))[_0xb5d0('0x24')](function(_0x20f4df){if(_0x20f4df){var _0x418834=_0x20f4df[_0xb5d0('0x4b')]({'plain':!![]});_0x418834=qs[_0xb5d0('0x4c')](_0x418834,['id','createdAt','updatedAt']);_0x5e73af['body']=_[_0xb5d0('0x4c')](_0x5e73af['body'],['id','createdAt',_0xb5d0('0x4d')]);return db[_0xb5d0('0x2d')][_0xb5d0('0x4e')](_['merge'](_0x418834,_0x5e73af[_0xb5d0('0x4f')]),{'include':_0x5e73af[_0xb5d0('0x32')][_0xb5d0('0x42')]?[{'all':!![]}]:undefined});}})[_0xb5d0('0x24')](respondWithResult(_0x1c1744,0xc9))[_0xb5d0('0x45')](handleError(_0x1c1744,null));};exports['update']=function(_0x430cf1,_0x54b7c2){if(_0x430cf1[_0xb5d0('0x4f')]['id']){delete _0x430cf1[_0xb5d0('0x4f')]['id'];}return db[_0xb5d0('0x2d')][_0xb5d0('0x4a')]({'where':{'id':_0x430cf1[_0xb5d0('0x47')]['id']}})['then'](handleEntityNotFound(_0x54b7c2,null))[_0xb5d0('0x24')](saveUpdates(_0x430cf1[_0xb5d0('0x4f')],null))[_0xb5d0('0x24')](respondWithResult(_0x54b7c2,null))[_0xb5d0('0x45')](handleError(_0x54b7c2,null));};exports[_0xb5d0('0x25')]=function(_0x383e24,_0x1f40dd){return db[_0xb5d0('0x2d')][_0xb5d0('0x4a')]({'where':{'id':_0x383e24['params']['id']}})['then'](handleEntityNotFound(_0x1f40dd,null))[_0xb5d0('0x24')](removeEntity(_0x1f40dd,null))[_0xb5d0('0x45')](handleError(_0x1f40dd,null));};exports[_0xb5d0('0x4e')]=function(_0x2b5c56,_0x4b3cb4,_0x55772c){_0x2b5c56[_0xb5d0('0x4f')][_0xb5d0('0x29')]=_0x2b5c56[_0xb5d0('0x50')]['originalname'];_0x2b5c56[_0xb5d0('0x4f')]['basename']=_0x2b5c56[_0xb5d0('0x50')][_0xb5d0('0x51')];_0x2b5c56[_0xb5d0('0x4f')][_0xb5d0('0x2f')]=_0x2b5c56[_0xb5d0('0x50')][_0xb5d0('0x52')];return db['Attachment'][_0xb5d0('0x4e')](_0x2b5c56[_0xb5d0('0x4f')])[_0xb5d0('0x24')](respondWithResult(_0x4b3cb4,0xc9))['catch'](handleError(_0x4b3cb4,null));};exports[_0xb5d0('0x53')]=function(_0xb0c349,_0x41fcea,_0x52c3e0){return db[_0xb5d0('0x2d')][_0xb5d0('0x54')]({'where':{'id':_0xb0c349['params']['id']},'raw':!![]})[_0xb5d0('0x24')](handleEntityNotFound(_0x41fcea,null))[_0xb5d0('0x24')](function(_0x498ae5){if(_0x498ae5){return _0x41fcea['download'](path[_0xb5d0('0x55')](config[_0xb5d0('0x56')],_0xb5d0('0x57'),_0x498ae5[_0xb5d0('0x58')]));}})['catch'](handleError(_0x41fcea,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4134c55..4acf9bf 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','Attachment','util'];(function(_0xa8bd05,_0x20f53d){var _0x1be566=function(_0x30579b){while(--_0x30579b){_0xa8bd05['push'](_0xa8bd05['shift']());}};_0x1be566(++_0x20f53d);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ab779,_0x17d890){_0x4ab779=_0x4ab779-0x0;var _0x394088=_0xedd9[_0x4ab779];return _0x394088;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x579c=['define','attachments','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x579c,0xda));var _0xc579=function(_0x220f8f,_0x55a260){_0x220f8f=_0x220f8f-0x0;var _0x288a14=_0x579c[_0x220f8f];return _0x288a14;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var logger=require(_0xc579('0x2'))(_0xc579('0x3'));var moment=require(_0xc579('0x4'));var BPromise=require('bluebird');var rp=require(_0xc579('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var attributes=require(_0xc579('0x8'));module[_0xc579('0x9')]=function(_0x124ee5,_0x1bd276){return _0x124ee5[_0xc579('0xa')]('Attachment',attributes,{'tableName':_0xc579('0xb'),'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 07464c4..4c01f1e 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 _0x0f44=['code','message','result','Attachment','create','body','options','then','debug','CreateAttachment','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x0f44,0x149));var _0x40f4=function(_0x108567,_0x593bec){_0x108567=_0x108567-0x0;var _0x14be2d=_0x0f44[_0x108567];return _0x14be2d;};'use strict';var _=require(_0x40f4('0x0'));var util=require(_0x40f4('0x1'));var moment=require('moment');var BPromise=require(_0x40f4('0x2'));var rs=require(_0x40f4('0x3'));var fs=require('fs');var Redis=require(_0x40f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x40f4('0x5'));var logger=require(_0x40f4('0x6'))(_0x40f4('0x7'));var config=require(_0x40f4('0x8'));var jayson=require(_0x40f4('0x9'));var client=jayson[_0x40f4('0xa')][_0x40f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2159ca,_0xf7197b,_0x215a20){return new BPromise(function(_0x3e99ef,_0x323fef){return client[_0x40f4('0xc')](_0x2159ca,_0x215a20)['then'](function(_0x1c9a83){logger[_0x40f4('0xd')](_0x40f4('0xe'),_0xf7197b,'request\x20sent');logger['debug'](_0x40f4('0xf'),_0xf7197b,_0x40f4('0x10'),JSON[_0x40f4('0x11')](_0x1c9a83));if(_0x1c9a83[_0x40f4('0x12')]){if(_0x1c9a83[_0x40f4('0x12')][_0x40f4('0x13')]===0x1f4){logger[_0x40f4('0x12')](_0x40f4('0xe'),_0xf7197b,_0x1c9a83[_0x40f4('0x12')][_0x40f4('0x14')]);return _0x323fef(_0x1c9a83['error']['message']);}logger[_0x40f4('0x12')](_0x40f4('0xe'),_0xf7197b,_0x1c9a83[_0x40f4('0x12')][_0x40f4('0x14')]);return _0x3e99ef(_0x1c9a83[_0x40f4('0x12')][_0x40f4('0x14')]);}else{logger[_0x40f4('0xd')]('Attachment,\x20%s,\x20%s',_0xf7197b,_0x40f4('0x10'));_0x3e99ef(_0x1c9a83[_0x40f4('0x15')][_0x40f4('0x14')]);}})['catch'](function(_0x348eb2){logger[_0x40f4('0x12')]('Attachment,\x20%s,\x20%s',_0xf7197b,_0x348eb2);_0x323fef(_0x348eb2);});});}exports['CreateAttachment']=function(_0x25d6a2){var _0x4fe08d=this;return new Promise(function(_0x1ccd02,_0x1f6d43){return db[_0x40f4('0x16')][_0x40f4('0x17')](_0x25d6a2[_0x40f4('0x18')],{'raw':_0x25d6a2[_0x40f4('0x19')]?_0x25d6a2[_0x40f4('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x40f4('0x1a')](function(_0x3f611c){logger['info']('CreateAttachment',_0x25d6a2);logger[_0x40f4('0x1b')]('CreateAttachment',_0x25d6a2,JSON['stringify'](_0x3f611c));_0x1ccd02(_0x3f611c);})['catch'](function(_0x4296a2){logger[_0x40f4('0x12')](_0x40f4('0x1c'),_0x4296a2[_0x40f4('0x14')],_0x25d6a2);_0x1f6d43(_0x4fe08d[_0x40f4('0x12')](0x1f4,_0x4296a2[_0x40f4('0x14')]));});});}; \ No newline at end of file +var _0x2084=['Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','Attachment','create','body','options','CreateAttachment','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x1408b4,_0x22e866){var _0x39276b=function(_0x5d7918){while(--_0x5d7918){_0x1408b4['push'](_0x1408b4['shift']());}};_0x39276b(++_0x22e866);}(_0x2084,0x11c));var _0x4208=function(_0x61afde,_0x3b92d0){_0x61afde=_0x61afde-0x0;var _0x111608=_0x2084[_0x61afde];return _0x111608;};'use strict';var _=require('lodash');var util=require(_0x4208('0x0'));var moment=require(_0x4208('0x1'));var BPromise=require(_0x4208('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4208('0x3'));var db=require(_0x4208('0x4'))['db'];var utils=require(_0x4208('0x5'));var logger=require(_0x4208('0x6'))(_0x4208('0x7'));var config=require(_0x4208('0x8'));var jayson=require(_0x4208('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40f25e,_0x3fbf73,_0x1b1f86){return new BPromise(function(_0x4f8fcf,_0xfd47ca){return client[_0x4208('0xa')](_0x40f25e,_0x1b1f86)[_0x4208('0xb')](function(_0x17ca29){logger[_0x4208('0xc')](_0x4208('0xd'),_0x3fbf73,_0x4208('0xe'));logger[_0x4208('0xf')](_0x4208('0x10'),_0x3fbf73,_0x4208('0xe'),JSON['stringify'](_0x17ca29));if(_0x17ca29[_0x4208('0x11')]){if(_0x17ca29['error'][_0x4208('0x12')]===0x1f4){logger[_0x4208('0x11')]('Attachment,\x20%s,\x20%s',_0x3fbf73,_0x17ca29[_0x4208('0x11')][_0x4208('0x13')]);return _0xfd47ca(_0x17ca29[_0x4208('0x11')][_0x4208('0x13')]);}logger[_0x4208('0x11')](_0x4208('0xd'),_0x3fbf73,_0x17ca29[_0x4208('0x11')][_0x4208('0x13')]);return _0x4f8fcf(_0x17ca29[_0x4208('0x11')]['message']);}else{logger['info'](_0x4208('0xd'),_0x3fbf73,_0x4208('0xe'));_0x4f8fcf(_0x17ca29['result']['message']);}})[_0x4208('0x14')](function(_0x3f3ce8){logger[_0x4208('0x11')](_0x4208('0xd'),_0x3fbf73,_0x3f3ce8);_0xfd47ca(_0x3f3ce8);});});}exports['CreateAttachment']=function(_0x643948){var _0x2e034c=this;return new Promise(function(_0x364951,_0xb4441d){return db[_0x4208('0x15')][_0x4208('0x16')](_0x643948[_0x4208('0x17')],{'raw':_0x643948[_0x4208('0x18')]?_0x643948[_0x4208('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x4208('0xb')](function(_0x573313){logger[_0x4208('0xc')](_0x4208('0x19'),_0x643948);logger[_0x4208('0xf')](_0x4208('0x19'),_0x643948,JSON[_0x4208('0x1a')](_0x573313));_0x364951(_0x573313);})['catch'](function(_0x442aba){logger['error']('CreateAttachment',_0x442aba['message'],_0x643948);_0xb4441d(_0x2e034c[_0x4208('0x11')](0x1f4,_0x442aba[_0x4208('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9f5ef4b..0e52111 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 _0x6c00=['index','show','download','post','/:id/clone','clone','diskStorage','join','format','%s-%s','replace','single','file','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','isAuthenticated'];(function(_0x5c5096,_0x3ceeec){var _0x235ded=function(_0x5ac063){while(--_0x5ac063){_0x5c5096['push'](_0x5c5096['shift']());}};_0x235ded(++_0x3ceeec);}(_0x6c00,0x1a9));var _0x06c0=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0x6c00[_0x17b0d4];return _0x2d02c7;};'use strict';var multer=require(_0x06c0('0x0'));var util=require(_0x06c0('0x1'));var path=require(_0x06c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x06c0('0x3'));var router=express[_0x06c0('0x4')]();var auth=require(_0x06c0('0x5'));var interaction=require(_0x06c0('0x6'));var config=require('../../config/environment');var controller=require(_0x06c0('0x7'));router[_0x06c0('0x8')]('/',auth[_0x06c0('0x9')](),controller[_0x06c0('0xa')]);router[_0x06c0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x06c0('0xb')]);router[_0x06c0('0x8')]('/:id/download',auth[_0x06c0('0x9')](),controller[_0x06c0('0xc')]);router[_0x06c0('0xd')](_0x06c0('0xe'),auth[_0x06c0('0x9')](),controller[_0x06c0('0xf')]);var upload=multer({'storage':multer[_0x06c0('0x10')]({'destination':function(_0x139770,_0x3bad48,_0x804c54){_0x804c54(null,path[_0x06c0('0x11')](config['root'],'server/files/attachments/'));},'filename':function(_0x394397,_0xc05495,_0x462ee2){_0x462ee2(null,util[_0x06c0('0x12')](_0x06c0('0x13'),Date['now'](),_0xc05495['originalname'][_0x06c0('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x06c0('0xd')]('/',upload[_0x06c0('0x15')](_0x06c0('0x16')),controller[_0x06c0('0x17')]);router[_0x06c0('0x18')](_0x06c0('0x19'),auth['isAuthenticated'](),controller[_0x06c0('0x1a')]);router[_0x06c0('0x1b')](_0x06c0('0x19'),auth[_0x06c0('0x9')](),controller[_0x06c0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x843e=['single','file','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname'];(function(_0x4a779c,_0x48ad01){var _0x212bea=function(_0x4d1967){while(--_0x4d1967){_0x4a779c['push'](_0x4a779c['shift']());}};_0x212bea(++_0x48ad01);}(_0x843e,0xcd));var _0xe843=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x843e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe843('0x0'));var util=require(_0xe843('0x1'));var path=require(_0xe843('0x2'));var timeout=require(_0xe843('0x3'));var express=require('express');var router=express[_0xe843('0x4')]();var auth=require(_0xe843('0x5'));var interaction=require(_0xe843('0x6'));var config=require(_0xe843('0x7'));var controller=require(_0xe843('0x8'));router[_0xe843('0x9')]('/',auth[_0xe843('0xa')](),controller['index']);router[_0xe843('0x9')](_0xe843('0xb'),auth['isAuthenticated'](),controller[_0xe843('0xc')]);router[_0xe843('0x9')](_0xe843('0xd'),auth[_0xe843('0xa')](),controller[_0xe843('0xe')]);router[_0xe843('0xf')](_0xe843('0x10'),auth[_0xe843('0xa')](),controller[_0xe843('0x11')]);var upload=multer({'storage':multer[_0xe843('0x12')]({'destination':function(_0x1c42f7,_0x19235c,_0x355d22){_0x355d22(null,path[_0xe843('0x13')](config[_0xe843('0x14')],_0xe843('0x15')));},'filename':function(_0x29d047,_0x1bf702,_0x569445){_0x569445(null,util[_0xe843('0x16')](_0xe843('0x17'),Date[_0xe843('0x18')](),_0x1bf702[_0xe843('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe843('0xf')]('/',upload[_0xe843('0x1a')](_0xe843('0x1b')),controller['create']);router[_0xe843('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xe843('0x1d')]);router[_0xe843('0x1e')](_0xe843('0xb'),auth[_0xe843('0xa')](),controller[_0xe843('0x1f')]);module[_0xe843('0x20')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index f031c4b..905ce5c 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 _0xb6a5=['allowedLoginAttempts','then','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','blockDuration','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','profile','/login','clientID','clientSecret','secret','callbackURL','findOne'];(function(_0x31d478,_0x6dc61d){var _0x416219=function(_0xc49291){while(--_0xc49291){_0x31d478['push'](_0x31d478['shift']());}};_0x416219(++_0x6dc61d);}(_0xb6a5,0xd4));var _0x5b6a=function(_0x5ec418,_0x334eb6){_0x5ec418=_0x5ec418-0x0;var _0x10acdf=_0xb6a5[_0x5ec418];return _0x10acdf;};'use strict';var _=require(_0x5b6a('0x0'));var passport=require(_0x5b6a('0x1'));var GoogleStrategy=require(_0x5b6a('0x2'))['Strategy'];var moment=require(_0x5b6a('0x3'));var db=require(_0x5b6a('0x4'))['db'];var config=require(_0x5b6a('0x5'));var signToken=require(_0x5b6a('0x6'))[_0x5b6a('0x7')];var utils=require(_0x5b6a('0x8'));exports[_0x5b6a('0x9')]=passport[_0x5b6a('0xa')](_0x5b6a('0xb'),{'failureRedirect':'/login','scope':[_0x5b6a('0xc'),'email'],'session':![]});exports['callback']=passport['authenticate'](_0x5b6a('0xb'),{'failureRedirect':_0x5b6a('0xd'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x5b6a('0xb')]?config[_0x5b6a('0xb')][_0x5b6a('0xe')]:'id','clientSecret':config[_0x5b6a('0xb')]?config[_0x5b6a('0xb')][_0x5b6a('0xf')]:_0x5b6a('0x10'),'callbackURL':config[_0x5b6a('0xb')]?config[_0x5b6a('0xb')][_0x5b6a('0x11')]:''},function(_0x5e7b96,_0x2e44b3,_0x58208f,_0x163f4b){var _0xc47645,_0x2d90b9;return db['Setting'][_0x5b6a('0x12')]({'where':{'id':0x1},'attributes':[_0x5b6a('0x13'),'blockDuration'],'raw':!![]})[_0x5b6a('0x14')](function(_0xd9299e){_0xc47645=_0xd9299e;return db['User'][_0x5b6a('0x15')]({'where':{'email':_[_0x5b6a('0x16')](_0x58208f['emails'],_0x5b6a('0x17')),'role':{'$or':[_0x5b6a('0x18'),_0x5b6a('0x19'),_0x5b6a('0x1a')]}}});})[_0x5b6a('0x14')](function(_0x164931){_0x2d90b9=_0x164931;if(_0x2d90b9){if(_0x2d90b9['disabled']){return _0x163f4b(_0x5b6a('0x1b'));}else if(_0xc47645['blockDuration']>0x0){if(_0x2d90b9['blocked']){if(moment(_0x2d90b9['blockedAt'])[_0x5b6a('0x1c')](_0xc47645[_0x5b6a('0x1d')],'minutes')>moment()){return _0x163f4b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x5b6a('0x1e')](_0x2d90b9,0x0,![],null)[_0x5b6a('0x14')](function(){return utils[_0x5b6a('0x1f')](_0x2d90b9);})[_0x5b6a('0x14')](function(){return _0x163f4b(null,_0x2d90b9);});}}else{return utils[_0x5b6a('0x1f')](_0x2d90b9)['then'](function(){return _0x163f4b(null,_0x2d90b9);});}}else{return utils['getLicense'](_0x2d90b9)[_0x5b6a('0x14')](function(){return _0x163f4b(null,_0x2d90b9);});}}return _0x163f4b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x5b6a('0x20')](function(_0x51a473){_0x163f4b(_0x51a473);});})); \ No newline at end of file +var _0x8a2a=['Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','google','profile','email','callback','authenticate','/login','use','clientID','clientSecret','Setting','findOne','blockDuration','then','User','find','map','emails','value','admin','user','blocked','blockedAt','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8a2a,0x174));var _0xa8a2=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x8a2a[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0xa8a2('0x0'));var passport=require(_0xa8a2('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0xa8a2('0x2')];var moment=require('moment');var db=require(_0xa8a2('0x3'))['db'];var config=require(_0xa8a2('0x4'));var signToken=require(_0xa8a2('0x5'))[_0xa8a2('0x6')];var utils=require('../../config/utils');exports['login']=passport['authenticate'](_0xa8a2('0x7'),{'failureRedirect':'/login','scope':[_0xa8a2('0x8'),_0xa8a2('0x9')],'session':![]});exports[_0xa8a2('0xa')]=passport[_0xa8a2('0xb')](_0xa8a2('0x7'),{'failureRedirect':_0xa8a2('0xc'),'session':![]});passport[_0xa8a2('0xd')](new GoogleStrategy({'clientID':config[_0xa8a2('0x7')]?config[_0xa8a2('0x7')][_0xa8a2('0xe')]:'id','clientSecret':config[_0xa8a2('0x7')]?config[_0xa8a2('0x7')][_0xa8a2('0xf')]:'secret','callbackURL':config['google']?config[_0xa8a2('0x7')]['callbackURL']:''},function(_0x5b2af6,_0x3c4da9,_0x294b3d,_0x424fa8){var _0x423d42,_0x2d4f87;return db[_0xa8a2('0x10')][_0xa8a2('0x11')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa8a2('0x12')],'raw':!![]})[_0xa8a2('0x13')](function(_0x15f6e9){_0x423d42=_0x15f6e9;return db[_0xa8a2('0x14')][_0xa8a2('0x15')]({'where':{'email':_[_0xa8a2('0x16')](_0x294b3d[_0xa8a2('0x17')],_0xa8a2('0x18')),'role':{'$or':[_0xa8a2('0x19'),_0xa8a2('0x1a'),'agent']}}});})[_0xa8a2('0x13')](function(_0x42f813){_0x2d4f87=_0x42f813;if(_0x2d4f87){if(_0x2d4f87['disabled']){return _0x424fa8('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x423d42[_0xa8a2('0x12')]>0x0){if(_0x2d4f87[_0xa8a2('0x1b')]){if(moment(_0x2d4f87[_0xa8a2('0x1c')])[_0xa8a2('0x1d')](_0x423d42[_0xa8a2('0x12')],'minutes')>moment()){return _0x424fa8(_0xa8a2('0x1e'));}else{return utils[_0xa8a2('0x1f')](_0x2d4f87,0x0,![],null)[_0xa8a2('0x13')](function(){return utils[_0xa8a2('0x20')](_0x2d4f87);})[_0xa8a2('0x13')](function(){return _0x424fa8(null,_0x2d4f87);});}}else{return utils['getLicense'](_0x2d4f87)[_0xa8a2('0x13')](function(){return _0x424fa8(null,_0x2d4f87);});}}else{return utils['getLicense'](_0x2d4f87)['then'](function(){return _0x424fa8(null,_0x2d4f87);});}}return _0x424fa8(_0xa8a2('0x1e'));})[_0xa8a2('0x21')](function(_0x108835){_0x424fa8(_0x108835);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index ff06671..3d7d9da 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 _0x8bdf=['/callback','callback','isMiddleware','express','passport','Router','./authGoogle.controller','../user/user.controller.js','get','login'];(function(_0x4a58eb,_0x5aac55){var _0x1ce75c=function(_0x3d565c){while(--_0x3d565c){_0x4a58eb['push'](_0x4a58eb['shift']());}};_0x1ce75c(++_0x5aac55);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8bdf[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0xf8bd('0x0'));var passport=require(_0xf8bd('0x1'));var router=express[_0xf8bd('0x2')]();var controller=require(_0xf8bd('0x3'));var userController=require(_0xf8bd('0x4'));var authService=require('../../components/auth/service');router[_0xf8bd('0x5')]('/',controller[_0xf8bd('0x6')]);router[_0xf8bd('0x5')](_0xf8bd('0x7'),controller[_0xf8bd('0x8')],authService[_0xf8bd('0x9')],userController['login'],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0xbd3b=['exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback'];(function(_0x4bd33b,_0x2b7fbe){var _0x5e2048=function(_0x27c634){while(--_0x27c634){_0x4bd33b['push'](_0x4bd33b['shift']());}};_0x5e2048(++_0x2b7fbe);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x3ae1c8,_0x4f1c21){_0x3ae1c8=_0x3ae1c8-0x0;var _0x5a2621=_0xbd3b[_0x3ae1c8];return _0x5a2621;};'use strict';var express=require(_0xbbd3('0x0'));var passport=require(_0xbbd3('0x1'));var router=express[_0xbbd3('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xbbd3('0x3'));var authService=require(_0xbbd3('0x4'));router[_0xbbd3('0x5')]('/',controller[_0xbbd3('0x6')]);router['get'](_0xbbd3('0x7'),controller[_0xbbd3('0x8')],authService['isMiddleware'],userController[_0xbbd3('0x6')],authService['setTokenCookie']);module[_0xbbd3('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 917f1d0..ac3ca37 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 _0xd3d3=['blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','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','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','params','token','securePassword','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0xd3d3,0xa1));var _0x3d3d=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xd3d3[_0x10004e];return _0x5af990;};'use strict';var util=require(_0x3d3d('0x0'));var passport=require(_0x3d3d('0x1'));var LocalStrategy=require(_0x3d3d('0x2'))[_0x3d3d('0x3')];var jayson=require(_0x3d3d('0x4'));var _=require(_0x3d3d('0x5'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x3d3d('0x6'))['db'];var authService=require(_0x3d3d('0x7'));var utils=require(_0x3d3d('0x8'));var client=jayson['client'][_0x3d3d('0x9')]({'port':0x232b});function localAuthenticate(_0x2eeec,_0x52d016,_0x5d2548,_0x4d4587){var _0x15ded0,_0x33a017;return db[_0x3d3d('0xa')][_0x3d3d('0xb')]({'where':{'id':0x1},'attributes':[_0x3d3d('0xc'),_0x3d3d('0xd')],'raw':!![]})[_0x3d3d('0xe')](function(_0xe2e8ff){_0x15ded0=_0xe2e8ff;return _0x2eeec[_0x3d3d('0xb')]({'attributes':['id',_0x3d3d('0xf'),_0x3d3d('0x10'),_0x3d3d('0x11'),_0x3d3d('0x12'),_0x3d3d('0x13'),_0x3d3d('0x14'),_0x3d3d('0x15'),'loginAttempts'],'where':{'name':_0x52d016,'role':{'$or':[_0x3d3d('0x16'),'user',_0x3d3d('0x17')]}}});})[_0x3d3d('0xe')](function(_0x4d9e7f){if(!_0x4d9e7f||_0x4d9e7f&&_0x4d9e7f[_0x3d3d('0xf')]!==_0x52d016){throw new Error(_0x3d3d('0x18'));}else{_0x33a017=_0x4d9e7f;return _0x33a017;}})[_0x3d3d('0xe')](function(){_0x33a017[_0x3d3d('0x19')](_0x5d2548,function(_0x2a8b08,_0x298fbb){var _0x46b679=_0x33a017[_0x3d3d('0x1a')]+0x1;if(_0x2a8b08){return _0x4d4587(_0x2a8b08);}else if(!_0x298fbb){if(_0x33a017['disabled']){return _0x4d4587(null,![],{'message':_0x3d3d('0x18')});}else if(_0x15ded0['allowedLoginAttempts']>0x0){if(_0x33a017['blocked']){if(_0x15ded0[_0x3d3d('0xd')]>0x0){if(moment(_0x33a017[_0x3d3d('0x15')])[_0x3d3d('0x1b')](_0x15ded0[_0x3d3d('0xd')],_0x3d3d('0x1c'))>moment()){return _0x4d4587(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3d3d('0x1d')](_0x33a017,_0x46b679,![],null)['then'](function(){return _0x4d4587(null,![],{'message':_0x3d3d('0x18')});});}}else{return _0x4d4587(null,![],{'message':_0x3d3d('0x18')});}}else{if(_0x46b679>=_0x15ded0[_0x3d3d('0xc')]){return utils['clearBlockUser'](_0x33a017,0x0,!![],moment())[_0x3d3d('0xe')](function(){return _0x4d4587(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x3d3d('0x1d')](_0x33a017,_0x46b679,![],null)[_0x3d3d('0xe')](function(){return _0x4d4587(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x4d4587(null,![],{'message':_0x3d3d('0x18')});}}else{if(_0x33a017[_0x3d3d('0x13')]){return _0x4d4587(null,![],{'message':_0x3d3d('0x18')});}else if(_0x15ded0[_0x3d3d('0xc')]>0x0){if(_0x33a017[_0x3d3d('0x14')]){if(_0x15ded0[_0x3d3d('0xd')]>0x0){if(moment(_0x33a017[_0x3d3d('0x15')])[_0x3d3d('0x1b')](_0x15ded0[_0x3d3d('0xd')],_0x3d3d('0x1c'))>moment()){return _0x4d4587(null,![],{'message':_0x3d3d('0x18')});}else{return utils[_0x3d3d('0x1d')](_0x33a017,0x0,![],null)[_0x3d3d('0xe')](function(){return utils['getLicense'](_0x33a017);})[_0x3d3d('0xe')](function(){return _0x4d4587(null,_0x33a017);});}}else{return _0x4d4587(null,![],{'message':_0x3d3d('0x18')});}}else{return utils[_0x3d3d('0x1d')](_0x33a017,0x0,![],null)['then'](function(){return utils[_0x3d3d('0x1e')](_0x33a017);})[_0x3d3d('0xe')](function(){return _0x4d4587(null,_0x33a017);})['catch'](function(_0x5e1b03){return _0x4d4587(null,![],_0x5e1b03);});}}else{if(_0x33a017[_0x3d3d('0x14')]){return _0x4d4587(null,![],{'message':_0x3d3d('0x18')});}else{return utils[_0x3d3d('0x1e')](_0x33a017)['then'](function(){return _0x4d4587(null,_0x33a017);});}}}});})[_0x3d3d('0x1f')](function(_0x23b2ba){return _0x4d4587(null,![],_0x23b2ba);});}function sendServiceMail(_0x39b1a7){return db[_0x3d3d('0x20')][_0x3d3d('0x21')]({'where':{'service':!![]},'attributes':['id','name',_0x3d3d('0x22')],'include':[{'model':db[_0x3d3d('0x23')],'as':_0x3d3d('0x24')}]})[_0x3d3d('0xe')](function(_0x48ae9d){if(!_0x48ae9d){throw new Error(_0x3d3d('0x25'));}var _0x42f007={'tls':{'rejectUnauthorized':![]}};if(_0x48ae9d[_0x3d3d('0x24')][_0x3d3d('0x26')]){_0x42f007[_0x3d3d('0x26')]=_0x48ae9d[_0x3d3d('0x24')][_0x3d3d('0x26')];}else{_0x42f007[_0x3d3d('0x27')]=_0x48ae9d['Smtp'][_0x3d3d('0x27')];_0x42f007[_0x3d3d('0x28')]=_0x48ae9d[_0x3d3d('0x24')][_0x3d3d('0x28')];_0x42f007['secure']=_0x48ae9d[_0x3d3d('0x24')][_0x3d3d('0x29')];}if(_0x48ae9d[_0x3d3d('0x24')][_0x3d3d('0x2a')]){_0x42f007[_0x3d3d('0x2b')]={'user':_0x48ae9d[_0x3d3d('0x24')]['user'],'pass':_0x48ae9d[_0x3d3d('0x24')][_0x3d3d('0x2c')]};}var _0x4da471={'account':_0x42f007,'message':_['merge']({'from':util[_0x3d3d('0x2d')](_0x3d3d('0x2e'),_0x48ae9d[_0x3d3d('0xf')],_0x48ae9d[_0x3d3d('0x22')]||_0x48ae9d[_0x3d3d('0x24')][_0x3d3d('0x2f')])},_0x39b1a7)};return client[_0x3d3d('0x30')](_0x3d3d('0x31'),_0x4da471);})[_0x3d3d('0xe')](function(_0x5810c6){if(_0x5810c6[_0x3d3d('0x32')]){throw new Error(util[_0x3d3d('0x2d')](_0x3d3d('0x33'),_0x5810c6[_0x3d3d('0x32')]['message']||JSON[_0x3d3d('0x34')](_0x5810c6[_0x3d3d('0x32')])));}return!![];});}function handleError(_0x46916b,_0x414b7f,_0x15d034){return _0x46916b['status'](_0x414b7f||0x1f4)[_0x3d3d('0x35')]({'message':_0x15d034?_0x15d034[_0x3d3d('0x36')]||_0x15d034:''});}function checkPasswordPattern(_0x354f97,_0x2eeaf8,_0x325f4b){if(_0x325f4b){var _0x4ac83a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ac83a[_0x3d3d('0x37')](_0x2eeaf8)){return _0x354f97;}else{throw new Error(_0x3d3d('0x38'));}}else{return _0x354f97;}}exports[_0x3d3d('0x39')]=function(_0x529e05,_0x3d7d00,_0x333176){passport['authenticate'](_0x3d3d('0x3a'),function(_0x12eaee,_0x1b56b1,_0x42f280){var _0x434164=_0x12eaee||_0x42f280;if(_0x434164){return handleError(_0x3d7d00,0x191,_0x434164);}if(!_0x1b56b1){return handleError(_0x3d7d00,0x194,{'message':_0x3d3d('0x3b')});}else{var _0x1732aa={'payload':{'id':_0x1b56b1['id'],'role':_0x1b56b1[_0x3d3d('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x3d3d('0x3c')](_0x1732aa)[_0x3d3d('0xe')](function(_0x228826){_0x3d7d00[_0x3d3d('0x3d')]({'id':_0x1b56b1['id'],'token':_0x228826,'statusCall':'','isAlreadyLogged':_0x1b56b1['online']});});}})(_0x529e05,_0x3d7d00,_0x333176);};exports[_0x3d3d('0x3e')]=function(_0x112c70,_0x257663,_0x2a2d47){if(!_0x112c70['body']['email']){return handleError(_0x257663,0x1f4,{'message':_0x3d3d('0x3f')});}var _0x457e26=rs[_0x3d3d('0x40')]();_0x112c70[_0x3d3d('0x41')][_0x3d3d('0x22')]=_0x112c70['body'][_0x3d3d('0x22')][_0x3d3d('0x42')]()[_0x3d3d('0x43')]();var _0x384f34;return db[_0x3d3d('0xa')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x3d3d('0xd')],'raw':!![]})['then'](function(_0x45c354){_0x384f34=_0x45c354;return db[_0x3d3d('0x44')][_0x3d3d('0x21')]({'where':{'email':_0x112c70[_0x3d3d('0x41')][_0x3d3d('0x22')]}});})[_0x3d3d('0xe')](function(_0x59d0ed){if(!_0x59d0ed){throw new Error(_0x3d3d('0x45'));}if(_0x59d0ed[_0x3d3d('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x59d0ed[_0x3d3d('0x14')]){if(moment(_0x59d0ed['blockedAt'])[_0x3d3d('0x1b')](_0x384f34['blockDuration'],_0x3d3d('0x1c'))>moment()){throw new Error(_0x3d3d('0x46'));}else{_0x59d0ed[_0x3d3d('0x14')]=![];_0x59d0ed[_0x3d3d('0x15')]=null;}}_0x59d0ed[_0x3d3d('0x47')]=_0x457e26;_0x59d0ed['resetPasswordExpires']=Date[_0x3d3d('0x48')]()+0x36ee80;return _0x59d0ed[_0x3d3d('0x49')]();})['then'](function(){return sendServiceMail({'to':_0x112c70[_0x3d3d('0x41')][_0x3d3d('0x22')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x3d3d('0x4a')+_0x3d3d('0x4b')+_0x3d3d('0x4c')+_0x112c70['headers'][_0x3d3d('0x27')]+_0x3d3d('0x4d')+_0x457e26+'\x0a\x0a'+_0x3d3d('0x4e')});})[_0x3d3d('0xe')](function(){_0x257663[_0x3d3d('0x4f')](0xc8)[_0x3d3d('0x35')]({'message':_0x3d3d('0x50')});})['catch'](function(_0x471b8d){return handleError(_0x257663,0x1f4,_0x471b8d);});};exports['reset']=function(_0x15ddeb,_0x5a5f26,_0x422a7b){var _0x34f673;return db[_0x3d3d('0x44')]['find']({'where':{'resetPasswordToken':_0x15ddeb[_0x3d3d('0x51')][_0x3d3d('0x52')],'resetPasswordExpires':{'$gt':Date[_0x3d3d('0x48')]()}}})['then'](function(_0x2d76b4){_0x34f673=_0x2d76b4;if(!_0x34f673){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x3d3d('0xa')][_0x3d3d('0xb')]({'attributes':['id',_0x3d3d('0x53')]});})['then'](function(_0x5ab60b){return checkPasswordPattern(_0x5ab60b,_0x15ddeb[_0x3d3d('0x41')][_0x3d3d('0x10')],_0x5ab60b[_0x3d3d('0x53')]);})[_0x3d3d('0xe')](function(){_0x34f673[_0x3d3d('0x10')]=_0x15ddeb[_0x3d3d('0x41')][_0x3d3d('0x10')];_0x34f673[_0x3d3d('0x47')]=null;_0x34f673[_0x3d3d('0x54')]=null;return _0x34f673[_0x3d3d('0x49')]();})[_0x3d3d('0xe')](function(){_0x5a5f26['status'](0xc8)[_0x3d3d('0x35')]({'message':_0x3d3d('0x55')});})[_0x3d3d('0x1f')](function(_0x163859){return handleError(_0x5a5f26,0x1f4,_0x163859);});};passport[_0x3d3d('0x56')](new LocalStrategy({'usernameField':'name','passwordField':_0x3d3d('0x10')},function(_0xc8d408,_0x796c3e,_0x5b590b){return localAuthenticate(db[_0x3d3d('0x44')],_0xc8d408,_0x796c3e,_0x5b590b);})); \ No newline at end of file +var _0xe162=['minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','status','Reset\x20Email\x20sent!','reset','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../components/auth/service','client','Setting','findOne','allowedLoginAttempts','blockDuration','password','salt','blockedAt','admin','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blocked','clearBlockUser','disabled','add','getLicense','catch','MailAccount','find','name','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','user','merge','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','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','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x395524,_0x31ac11){var _0x3f6568=function(_0x43d86d){while(--_0x43d86d){_0x395524['push'](_0x395524['shift']());}};_0x3f6568(++_0x31ac11);}(_0xe162,0xb2));var _0x2e16=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe162[_0x8c43de];return _0xa6591b;};'use strict';var util=require(_0x2e16('0x0'));var passport=require(_0x2e16('0x1'));var LocalStrategy=require(_0x2e16('0x2'))[_0x2e16('0x3')];var jayson=require(_0x2e16('0x4'));var _=require(_0x2e16('0x5'));var rs=require(_0x2e16('0x6'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x2e16('0x7'));var utils=require('../../config/utils');var client=jayson[_0x2e16('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x348857,_0x18ca90,_0x615517,_0x388f96){var _0x4b9e66,_0x4875bb;return db[_0x2e16('0x9')][_0x2e16('0xa')]({'where':{'id':0x1},'attributes':[_0x2e16('0xb'),_0x2e16('0xc')],'raw':!![]})['then'](function(_0xeec465){_0x4b9e66=_0xeec465;return _0x348857[_0x2e16('0xa')]({'attributes':['id','name',_0x2e16('0xd'),_0x2e16('0xe'),'role','disabled','blocked',_0x2e16('0xf'),'loginAttempts'],'where':{'name':_0x18ca90,'role':{'$or':[_0x2e16('0x10'),'user',_0x2e16('0x11')]}}});})[_0x2e16('0x12')](function(_0x281bd6){if(!_0x281bd6||_0x281bd6&&_0x281bd6['name']!==_0x18ca90){throw new Error(_0x2e16('0x13'));}else{_0x4875bb=_0x281bd6;return _0x4875bb;}})[_0x2e16('0x12')](function(){_0x4875bb[_0x2e16('0x14')](_0x615517,function(_0x528992,_0xd3904c){var _0xc39a84=_0x4875bb[_0x2e16('0x15')]+0x1;if(_0x528992){return _0x388f96(_0x528992);}else if(!_0xd3904c){if(_0x4875bb['disabled']){return _0x388f96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4b9e66[_0x2e16('0xb')]>0x0){if(_0x4875bb[_0x2e16('0x16')]){if(_0x4b9e66[_0x2e16('0xc')]>0x0){if(moment(_0x4875bb[_0x2e16('0xf')])['add'](_0x4b9e66['blockDuration'],'minutes')>moment()){return _0x388f96(null,![],{'message':_0x2e16('0x13')});}else{return utils[_0x2e16('0x17')](_0x4875bb,_0xc39a84,![],null)['then'](function(){return _0x388f96(null,![],{'message':_0x2e16('0x13')});});}}else{return _0x388f96(null,![],{'message':_0x2e16('0x13')});}}else{if(_0xc39a84>=_0x4b9e66['allowedLoginAttempts']){return utils['clearBlockUser'](_0x4875bb,0x0,!![],moment())[_0x2e16('0x12')](function(){return _0x388f96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x4875bb,_0xc39a84,![],null)[_0x2e16('0x12')](function(){return _0x388f96(null,![],{'message':_0x2e16('0x13')});});}}}else{return _0x388f96(null,![],{'message':_0x2e16('0x13')});}}else{if(_0x4875bb[_0x2e16('0x18')]){return _0x388f96(null,![],{'message':_0x2e16('0x13')});}else if(_0x4b9e66[_0x2e16('0xb')]>0x0){if(_0x4875bb['blocked']){if(_0x4b9e66[_0x2e16('0xc')]>0x0){if(moment(_0x4875bb[_0x2e16('0xf')])[_0x2e16('0x19')](_0x4b9e66[_0x2e16('0xc')],'minutes')>moment()){return _0x388f96(null,![],{'message':_0x2e16('0x13')});}else{return utils[_0x2e16('0x17')](_0x4875bb,0x0,![],null)[_0x2e16('0x12')](function(){return utils['getLicense'](_0x4875bb);})['then'](function(){return _0x388f96(null,_0x4875bb);});}}else{return _0x388f96(null,![],{'message':_0x2e16('0x13')});}}else{return utils[_0x2e16('0x17')](_0x4875bb,0x0,![],null)['then'](function(){return utils[_0x2e16('0x1a')](_0x4875bb);})[_0x2e16('0x12')](function(){return _0x388f96(null,_0x4875bb);})[_0x2e16('0x1b')](function(_0x4f3912){return _0x388f96(null,![],_0x4f3912);});}}else{if(_0x4875bb['blocked']){return _0x388f96(null,![],{'message':_0x2e16('0x13')});}else{return utils['getLicense'](_0x4875bb)[_0x2e16('0x12')](function(){return _0x388f96(null,_0x4875bb);});}}}});})[_0x2e16('0x1b')](function(_0x48be80){return _0x388f96(null,![],_0x48be80);});}function sendServiceMail(_0x55e570){return db[_0x2e16('0x1c')][_0x2e16('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x2e16('0x1e'),_0x2e16('0x1f')],'include':[{'model':db[_0x2e16('0x20')],'as':_0x2e16('0x21')}]})[_0x2e16('0x12')](function(_0x508a0){if(!_0x508a0){throw new Error(_0x2e16('0x22'));}var _0x25167f={'tls':{'rejectUnauthorized':![]}};if(_0x508a0[_0x2e16('0x21')][_0x2e16('0x23')]){_0x25167f[_0x2e16('0x23')]=_0x508a0[_0x2e16('0x21')]['service'];}else{_0x25167f[_0x2e16('0x24')]=_0x508a0[_0x2e16('0x21')][_0x2e16('0x24')];_0x25167f[_0x2e16('0x25')]=_0x508a0[_0x2e16('0x21')]['port'];_0x25167f[_0x2e16('0x26')]=_0x508a0[_0x2e16('0x21')]['secure'];}if(_0x508a0[_0x2e16('0x21')][_0x2e16('0x27')]){_0x25167f['auth']={'user':_0x508a0[_0x2e16('0x21')][_0x2e16('0x28')],'pass':_0x508a0['Smtp']['pass']};}var _0x252389={'account':_0x25167f,'message':_[_0x2e16('0x29')]({'from':util[_0x2e16('0x2a')](_0x2e16('0x2b'),_0x508a0[_0x2e16('0x1e')],_0x508a0[_0x2e16('0x1f')]||_0x508a0[_0x2e16('0x21')][_0x2e16('0x28')])},_0x55e570)};return client['request']('SendMail',_0x252389);})[_0x2e16('0x12')](function(_0x1fe3be){if(_0x1fe3be[_0x2e16('0x2c')]){throw new Error(util[_0x2e16('0x2a')](_0x2e16('0x2d'),_0x1fe3be[_0x2e16('0x2c')]['message']||JSON[_0x2e16('0x2e')](_0x1fe3be['error'])));}return!![];});}function handleError(_0x19f3b7,_0x1e3877,_0x43b278){return _0x19f3b7['status'](_0x1e3877||0x1f4)[_0x2e16('0x2f')]({'message':_0x43b278?_0x43b278[_0x2e16('0x30')]||_0x43b278:''});}function checkPasswordPattern(_0x1452ac,_0x531729,_0x282517){if(_0x282517){var _0x38b60a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38b60a[_0x2e16('0x31')](_0x531729)){return _0x1452ac;}else{throw new Error(_0x2e16('0x32'));}}else{return _0x1452ac;}}exports[_0x2e16('0x33')]=function(_0xa804f6,_0x209668,_0x3a7691){passport[_0x2e16('0x14')](_0x2e16('0x34'),function(_0x17b446,_0x46fc4e,_0x4e57c9){var _0x24c9c2=_0x17b446||_0x4e57c9;if(_0x24c9c2){return handleError(_0x209668,0x191,_0x24c9c2);}if(!_0x46fc4e){return handleError(_0x209668,0x194,{'message':_0x2e16('0x35')});}else{var _0x122e67={'payload':{'id':_0x46fc4e['id'],'role':_0x46fc4e['role']},'options':{'expiresIn':0x15180}};return authService[_0x2e16('0x36')](_0x122e67)[_0x2e16('0x12')](function(_0x36b449){_0x209668[_0x2e16('0x37')]({'id':_0x46fc4e['id'],'token':_0x36b449,'statusCall':'','isAlreadyLogged':_0x46fc4e['online']});});}})(_0xa804f6,_0x209668,_0x3a7691);};exports['forgot']=function(_0x2cee37,_0x2ca021,_0x30fc46){if(!_0x2cee37[_0x2e16('0x38')]['email']){return handleError(_0x2ca021,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x228ab9=rs[_0x2e16('0x39')]();_0x2cee37[_0x2e16('0x38')][_0x2e16('0x1f')]=_0x2cee37['body'][_0x2e16('0x1f')][_0x2e16('0x3a')]()[_0x2e16('0x3b')]();var _0x1f1ebe;return db[_0x2e16('0x9')][_0x2e16('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2e16('0xc')],'raw':!![]})[_0x2e16('0x12')](function(_0xf75ae9){_0x1f1ebe=_0xf75ae9;return db[_0x2e16('0x3c')][_0x2e16('0x1d')]({'where':{'email':_0x2cee37[_0x2e16('0x38')]['email']}});})['then'](function(_0x16e3d9){if(!_0x16e3d9){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x16e3d9['disabled']){throw new Error(_0x2e16('0x3d'));}if(_0x16e3d9[_0x2e16('0x16')]){if(moment(_0x16e3d9['blockedAt'])['add'](_0x1f1ebe[_0x2e16('0xc')],_0x2e16('0x3e'))>moment()){throw new Error(_0x2e16('0x3f'));}else{_0x16e3d9['blocked']=![];_0x16e3d9[_0x2e16('0xf')]=null;}}_0x16e3d9[_0x2e16('0x40')]=_0x228ab9;_0x16e3d9[_0x2e16('0x41')]=Date[_0x2e16('0x42')]()+0x36ee80;return _0x16e3d9[_0x2e16('0x43')]();})['then'](function(){return sendServiceMail({'to':_0x2cee37[_0x2e16('0x38')][_0x2e16('0x1f')],'subject':_0x2e16('0x44'),'text':_0x2e16('0x45')+_0x2e16('0x46')+_0x2e16('0x47')+_0x2cee37[_0x2e16('0x48')][_0x2e16('0x24')]+_0x2e16('0x49')+_0x228ab9+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x2e16('0x12')](function(){_0x2ca021[_0x2e16('0x4a')](0xc8)['send']({'message':_0x2e16('0x4b')});})[_0x2e16('0x1b')](function(_0x4995cd){return handleError(_0x2ca021,0x1f4,_0x4995cd);});};exports[_0x2e16('0x4c')]=function(_0x1d7474,_0xcb9f32,_0x496eef){var _0x38ac51;return db['User'][_0x2e16('0x1d')]({'where':{'resetPasswordToken':_0x1d7474['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x2e16('0x42')]()}}})[_0x2e16('0x12')](function(_0x26a887){_0x38ac51=_0x26a887;if(!_0x38ac51){throw new Error(_0x2e16('0x4d'));}return db[_0x2e16('0x9')][_0x2e16('0xa')]({'attributes':['id',_0x2e16('0x4e')]});})[_0x2e16('0x12')](function(_0x1365c6){return checkPasswordPattern(_0x1365c6,_0x1d7474[_0x2e16('0x38')][_0x2e16('0xd')],_0x1365c6[_0x2e16('0x4e')]);})[_0x2e16('0x12')](function(){_0x38ac51[_0x2e16('0xd')]=_0x1d7474[_0x2e16('0x38')][_0x2e16('0xd')];_0x38ac51[_0x2e16('0x40')]=null;_0x38ac51[_0x2e16('0x41')]=null;return _0x38ac51['save']();})[_0x2e16('0x12')](function(){_0xcb9f32[_0x2e16('0x4a')](0xc8)[_0x2e16('0x2f')]({'message':'Password\x20reset!'});})['catch'](function(_0x299a0f){return handleError(_0xcb9f32,0x1f4,_0x299a0f);});};passport[_0x2e16('0x4f')](new LocalStrategy({'usernameField':_0x2e16('0x1e'),'passwordField':_0x2e16('0xd')},function(_0x486d48,_0x831995,_0x5b62c7){return localAuthenticate(db[_0x2e16('0x3c')],_0x486d48,_0x831995,_0x5b62c7);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 61588e8..59b6c4a 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 _0x7c3a=['reset','exports','./authLocal.controller','post','login','forgot','/reset/:token'];(function(_0x292db3,_0x5e5e03){var _0x1687e5=function(_0x28d064){while(--_0x28d064){_0x292db3['push'](_0x292db3['shift']());}};_0x1687e5(++_0x5e5e03);}(_0x7c3a,0x18a));var _0xa7c3=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7c3a[_0x45e98e];return _0x374dba;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xa7c3('0x0'));router[_0xa7c3('0x1')]('/',controller[_0xa7c3('0x2')]);router[_0xa7c3('0x1')]('/forgot',controller[_0xa7c3('0x3')]);router[_0xa7c3('0x1')](_0xa7c3('0x4'),controller[_0xa7c3('0x5')]);module[_0xa7c3('0x6')]=router; \ No newline at end of file +var _0x842a=['express','Router','./authLocal.controller','post','login','forgot','/reset/:token','reset'];(function(_0x37563e,_0x5c3f33){var _0x2bf4fb=function(_0xa22170){while(--_0xa22170){_0x37563e['push'](_0x37563e['shift']());}};_0x2bf4fb(++_0x5c3f33);}(_0x842a,0x98));var _0xa842=function(_0x334d1e,_0x28a488){_0x334d1e=_0x334d1e-0x0;var _0x3b33ba=_0x842a[_0x334d1e];return _0x3b33ba;};'use strict';var express=require(_0xa842('0x0'));var router=express[_0xa842('0x1')]();var controller=require(_0xa842('0x2'));router[_0xa842('0x3')]('/',controller[_0xa842('0x4')]);router[_0xa842('0x3')]('/forgot',controller[_0xa842('0x5')]);router[_0xa842('0x3')](_0xa842('0x6'),controller[_0xa842('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index df6f53e..4f9d307 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 _0x3af7=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x154d77,_0x1993ea){var _0x306342=function(_0x1e3e9d){while(--_0x1e3e9d){_0x154d77['push'](_0x154d77['shift']());}};_0x306342(++_0x1993ea);}(_0x3af7,0x1e4));var _0x73af=function(_0xde9e41,_0x37ba38){_0xde9e41=_0xde9e41-0x0;var _0x1ac9cb=_0x3af7[_0xde9e41];return _0x1ac9cb;};'use strict';var Sequelize=require(_0x73af('0x0'));module[_0x73af('0x1')]={'name':{'type':Sequelize[_0x73af('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x73af('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x73af('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xc575=['STRING','BOOLEAN','sequelize'];(function(_0x2e819c,_0x3f99a5){var _0x24e271=function(_0x27d596){while(--_0x27d596){_0x2e819c['push'](_0x2e819c['shift']());}};_0x24e271(++_0x3f99a5);}(_0xc575,0x6b));var _0x5c57=function(_0x14d250,_0x4b2e12){_0x14d250=_0x14d250-0x0;var _0xb991d8=_0xc575[_0x14d250];return _0xb991d8;};'use strict';var Sequelize=require(_0x5c57('0x0'));module['exports']={'name':{'type':Sequelize[_0x5c57('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x5c57('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5c57('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 82dbc47..6829735 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 _0x72f8=['fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','options','create','body','find','addConditions','Condition','ids','getConditions','findOne','order','nolimit','addActions','Action','omit','getActions','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','Automation','fieldName','key','model','map','keys','filters','intersection','query','attributes'];(function(_0x544463,_0x214963){var _0x1add2a=function(_0x5e1006){while(--_0x5e1006){_0x544463['push'](_0x544463['shift']());}};_0x1add2a(++_0x214963);}(_0x72f8,0x1b5));var _0x872f=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x72f8[_0x4e9d3c];return _0x2d0825;};'use strict';var pdf=require(_0x872f('0x0'));var emlformat=require(_0x872f('0x1'));var rimraf=require(_0x872f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x872f('0x3'));var BPromise=require(_0x872f('0x4'));var Mustache=require(_0x872f('0x5'));var util=require(_0x872f('0x6'));var path=require(_0x872f('0x7'));var sox=require('sox');var csv=require(_0x872f('0x8'));var ejs=require(_0x872f('0x9'));var fs=require('fs');var _=require(_0x872f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x872f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x872f('0x8'));var querystring=require(_0x872f('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x872f('0xd'));var qs=require(_0x872f('0xe'));var as=require(_0x872f('0xf'));var hardwareService=require(_0x872f('0x10'));var logger=require(_0x872f('0x11'))(_0x872f('0x12'));var utils=require(_0x872f('0x13'));var config=require(_0x872f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d8d74,_0x300ab4){_0x300ab4=_0x300ab4||0xcc;return function(_0xec3659){if(_0xec3659){return _0x2d8d74[_0x872f('0x15')](_0x300ab4);}return _0x2d8d74[_0x872f('0x16')](_0x300ab4)[_0x872f('0x17')]();};}function respondWithResult(_0x308e3c,_0x3dcbca){_0x3dcbca=_0x3dcbca||0xc8;return function(_0x1c84c){if(_0x1c84c){return _0x308e3c['status'](_0x3dcbca)[_0x872f('0x18')](_0x1c84c);}};}function respondWithFilteredResult(_0x1a906a,_0x30195b){return function(_0x24dad6){if(_0x24dad6){var _0x274143=_0x24dad6[_0x872f('0x19')],_0x37231e=_0x30195b[_0x872f('0x1a')],_0x1193ca=_0x30195b[_0x872f('0x1a')]+_0x30195b[_0x872f('0x1b')],_0x33b3f7;if(_0x1193ca>=_0x274143){_0x1193ca=_0x274143;_0x33b3f7=0xc8;}else{_0x33b3f7=0xce;}_0x1a906a[_0x872f('0x16')](_0x33b3f7);return _0x1a906a[_0x872f('0x1c')](_0x872f('0x1d'),_0x37231e+'-'+_0x1193ca+'/'+_0x274143)['json'](_0x24dad6);}return null;};}function patchUpdates(_0x1797f5){return function(_0x18379f){try{jsonpatch[_0x872f('0x1e')](_0x18379f,_0x1797f5,!![]);}catch(_0xee744f){return BPromise[_0x872f('0x1f')](_0xee744f);}return _0x18379f['save']();};}function saveUpdates(_0x854a3e,_0x378ae1){return function(_0x29ae94){if(_0x29ae94){return _0x29ae94['update'](_0x854a3e)['then'](function(_0x464cb5){return _0x464cb5;});}return null;};}function removeEntity(_0x2160f0,_0x3d325a){return function(_0x2e6742){if(_0x2e6742){return _0x2e6742[_0x872f('0x20')]()[_0x872f('0x21')](function(){_0x2160f0[_0x872f('0x16')](0xcc)[_0x872f('0x17')]();});}};}function handleEntityNotFound(_0x71629,_0x4ce3d1){return function(_0x37ff60){if(!_0x37ff60){_0x71629['sendStatus'](0x194);}return _0x37ff60;};}function handleError(_0x439c96,_0x4d699a){_0x4d699a=_0x4d699a||0x1f4;return function(_0x14c416){logger[_0x872f('0x22')](_0x14c416[_0x872f('0x23')]);if(_0x14c416['name']){delete _0x14c416[_0x872f('0x24')];}_0x439c96[_0x872f('0x16')](_0x4d699a)[_0x872f('0x25')](_0x14c416);};}exports[_0x872f('0x26')]=function(_0x445328,_0x4d0712){var _0x1638db={},_0x2d1ad6={},_0x21ad3d={'count':0x0,'rows':[]};var _0x20fa4f=_['map'](db[_0x872f('0x27')]['rawAttributes'],function(_0x4aca01){return{'name':_0x4aca01[_0x872f('0x28')],'type':_0x4aca01['type'][_0x872f('0x29')]};});_0x2d1ad6[_0x872f('0x2a')]=_[_0x872f('0x2b')](_0x20fa4f,'name');_0x2d1ad6['query']=_[_0x872f('0x2c')](_0x445328['query']);_0x2d1ad6[_0x872f('0x2d')]=_[_0x872f('0x2e')](_0x2d1ad6[_0x872f('0x2a')],_0x2d1ad6[_0x872f('0x2f')]);_0x1638db[_0x872f('0x30')]=_['intersection'](_0x2d1ad6[_0x872f('0x2a')],qs[_0x872f('0x31')](_0x445328[_0x872f('0x2f')][_0x872f('0x31')]));_0x1638db[_0x872f('0x30')]=_0x1638db[_0x872f('0x30')][_0x872f('0x32')]?_0x1638db[_0x872f('0x30')]:_0x2d1ad6['model'];if(!_0x445328[_0x872f('0x2f')][_0x872f('0x33')]('nolimit')){_0x1638db[_0x872f('0x1b')]=qs[_0x872f('0x1b')](_0x445328[_0x872f('0x2f')][_0x872f('0x1b')]);_0x1638db['offset']=qs['offset'](_0x445328[_0x872f('0x2f')][_0x872f('0x1a')]);}_0x1638db['order']=qs[_0x872f('0x34')](_0x445328[_0x872f('0x2f')][_0x872f('0x34')]);_0x1638db[_0x872f('0x35')]=qs[_0x872f('0x2d')](_[_0x872f('0x36')](_0x445328['query'],_0x2d1ad6[_0x872f('0x2d')]),_0x20fa4f);if(_0x445328[_0x872f('0x2f')][_0x872f('0x37')]){_0x1638db[_0x872f('0x35')]=_[_0x872f('0x38')](_0x1638db[_0x872f('0x35')],{'$or':_[_0x872f('0x2b')](_0x20fa4f,function(_0x583b73){if(_0x583b73[_0x872f('0x39')]!==_0x872f('0x3a')){var _0x16d4d1={};_0x16d4d1[_0x583b73[_0x872f('0x24')]]={'$like':'%'+_0x445328['query'][_0x872f('0x37')]+'%'};return _0x16d4d1;}})});}_0x1638db=_[_0x872f('0x38')]({},_0x1638db,_0x445328['options']);var _0x24c60c={'where':_0x1638db['where']};return db[_0x872f('0x27')][_0x872f('0x19')](_0x24c60c)[_0x872f('0x21')](function(_0x100f39){_0x21ad3d[_0x872f('0x19')]=_0x100f39;if(_0x445328[_0x872f('0x2f')][_0x872f('0x3b')]){_0x1638db[_0x872f('0x3c')]=[{'all':!![]}];}return db[_0x872f('0x27')]['findAll'](_0x1638db);})[_0x872f('0x21')](function(_0x2b6308){_0x21ad3d[_0x872f('0x3d')]=_0x2b6308;return _0x21ad3d;})['then'](respondWithFilteredResult(_0x4d0712,_0x1638db))[_0x872f('0x3e')](handleError(_0x4d0712,null));};exports[_0x872f('0x3f')]=function(_0x2411b5,_0x10be05){var _0x419dee={'raw':![],'where':{'id':_0x2411b5[_0x872f('0x40')]['id']}},_0x481cb0={};_0x481cb0[_0x872f('0x2a')]=_[_0x872f('0x2c')](db[_0x872f('0x27')][_0x872f('0x41')]);_0x481cb0['query']=_['keys'](_0x2411b5[_0x872f('0x2f')]);_0x481cb0[_0x872f('0x2d')]=_[_0x872f('0x2e')](_0x481cb0[_0x872f('0x2a')],_0x481cb0['query']);_0x419dee[_0x872f('0x30')]=_['intersection'](_0x481cb0[_0x872f('0x2a')],qs['fields'](_0x2411b5[_0x872f('0x2f')][_0x872f('0x31')]));_0x419dee['attributes']=_0x419dee[_0x872f('0x30')][_0x872f('0x32')]?_0x419dee['attributes']:_0x481cb0[_0x872f('0x2a')];if(_0x2411b5['query'][_0x872f('0x3b')]){_0x419dee['include']=[{'all':!![]}];}_0x419dee=_['merge']({},_0x419dee,_0x2411b5[_0x872f('0x42')]);return db[_0x872f('0x27')]['find'](_0x419dee)[_0x872f('0x21')](handleEntityNotFound(_0x10be05,null))[_0x872f('0x21')](respondWithResult(_0x10be05,null))[_0x872f('0x3e')](handleError(_0x10be05,null));};exports[_0x872f('0x43')]=function(_0x74248,_0xd86f13){return db[_0x872f('0x27')]['create'](_0x74248[_0x872f('0x44')],{})['then'](respondWithResult(_0xd86f13,0xc9))['catch'](handleError(_0xd86f13,null));};exports['update']=function(_0x1fde69,_0x55b1f8){if(_0x1fde69[_0x872f('0x44')]['id']){delete _0x1fde69[_0x872f('0x44')]['id'];}return db[_0x872f('0x27')][_0x872f('0x45')]({'where':{'id':_0x1fde69['params']['id']}})[_0x872f('0x21')](handleEntityNotFound(_0x55b1f8,null))[_0x872f('0x21')](saveUpdates(_0x1fde69['body'],null))['then'](respondWithResult(_0x55b1f8,null))['catch'](handleError(_0x55b1f8,null));};exports[_0x872f('0x20')]=function(_0x199609,_0xb7499b){return db['Automation'][_0x872f('0x45')]({'where':{'id':_0x199609['params']['id']}})[_0x872f('0x21')](handleEntityNotFound(_0xb7499b,null))[_0x872f('0x21')](removeEntity(_0xb7499b,null))[_0x872f('0x3e')](handleError(_0xb7499b,null));};exports[_0x872f('0x46')]=function(_0x1b315e,_0x29a307,_0x581b5e){return db[_0x872f('0x47')][_0x872f('0x45')]({'where':{'id':_0x1b315e['params']['id']}})[_0x872f('0x21')](handleEntityNotFound(_0x29a307,null))['then'](function(_0x455a2c){if(_0x455a2c){return _0x455a2c[_0x872f('0x46')](_0x1b315e['body'][_0x872f('0x48')],_['omit'](_0x1b315e[_0x872f('0x44')],[_0x872f('0x48'),'id'])||{});}})[_0x872f('0x21')](respondWithResult(_0x29a307,null))['catch'](handleError(_0x29a307,null));};exports[_0x872f('0x49')]=function(_0x1689f2,_0x4cda97,_0x44d171){var _0x5e199d={};var _0x4140ec={};var _0x3ec269;var _0xaccbf5;return db['Automation'][_0x872f('0x4a')]({'where':{'id':_0x1689f2[_0x872f('0x40')]['id']}})[_0x872f('0x21')](handleEntityNotFound(_0x4cda97,null))[_0x872f('0x21')](function(_0xc42c01){if(_0xc42c01){_0x3ec269=_0xc42c01;_0x4140ec[_0x872f('0x2a')]=_[_0x872f('0x2c')](db['Condition']['rawAttributes']);_0x4140ec['query']=_[_0x872f('0x2c')](_0x1689f2['query']);_0x4140ec[_0x872f('0x2d')]=_[_0x872f('0x2e')](_0x4140ec[_0x872f('0x2a')],_0x4140ec[_0x872f('0x2f')]);_0x5e199d['attributes']=_[_0x872f('0x2e')](_0x4140ec['model'],qs[_0x872f('0x31')](_0x1689f2[_0x872f('0x2f')]['fields']));_0x5e199d['attributes']=_0x5e199d[_0x872f('0x30')][_0x872f('0x32')]?_0x5e199d[_0x872f('0x30')]:_0x4140ec[_0x872f('0x2a')];_0x5e199d[_0x872f('0x4b')]=qs[_0x872f('0x34')](_0x1689f2[_0x872f('0x2f')][_0x872f('0x34')]);_0x5e199d['where']=qs[_0x872f('0x2d')](_[_0x872f('0x36')](_0x1689f2[_0x872f('0x2f')],_0x4140ec['filters']));if(_0x1689f2[_0x872f('0x2f')][_0x872f('0x37')]){_0x5e199d[_0x872f('0x35')]=_[_0x872f('0x38')](_0x5e199d[_0x872f('0x35')],{'$or':_[_0x872f('0x2b')](_0x5e199d[_0x872f('0x30')],function(_0x691949){var _0x474f6c={};_0x474f6c[_0x691949]={'$like':'%'+_0x1689f2[_0x872f('0x2f')][_0x872f('0x37')]+'%'};return _0x474f6c;})});}_0x5e199d=_[_0x872f('0x38')]({},_0x5e199d,_0x1689f2[_0x872f('0x42')]);return _0x3ec269[_0x872f('0x49')](_0x5e199d);}})[_0x872f('0x21')](function(_0x560291){if(_0x560291){_0xaccbf5=_0x560291[_0x872f('0x32')];if(!_0x1689f2[_0x872f('0x2f')][_0x872f('0x33')](_0x872f('0x4c'))){_0x5e199d[_0x872f('0x1b')]=qs['limit'](_0x1689f2['query'][_0x872f('0x1b')]);_0x5e199d[_0x872f('0x1a')]=qs[_0x872f('0x1a')](_0x1689f2['query']['offset']);}return _0x3ec269[_0x872f('0x49')](_0x5e199d);}})[_0x872f('0x21')](function(_0x45ca59){if(_0x45ca59){return _0x45ca59?{'count':_0xaccbf5,'rows':_0x45ca59}:null;}})[_0x872f('0x21')](respondWithResult(_0x4cda97,null))[_0x872f('0x3e')](handleError(_0x4cda97,null));};exports[_0x872f('0x4d')]=function(_0x21e09e,_0x12910c,_0x309c31){return db[_0x872f('0x4e')][_0x872f('0x45')]({'where':{'id':_0x21e09e[_0x872f('0x40')]['id']}})[_0x872f('0x21')](handleEntityNotFound(_0x12910c,null))[_0x872f('0x21')](function(_0x1efb0e){if(_0x1efb0e){return _0x1efb0e[_0x872f('0x4d')](_0x21e09e['body'][_0x872f('0x48')],_[_0x872f('0x4f')](_0x21e09e['body'],[_0x872f('0x48'),'id'])||{});}})['then'](respondWithResult(_0x12910c,null))[_0x872f('0x3e')](handleError(_0x12910c,null));};exports[_0x872f('0x50')]=function(_0x317649,_0x19d90b,_0x39ec0a){var _0x3ac2dd={};var _0x166b20={};var _0x4d247c;var _0x13d5fe;return db[_0x872f('0x27')]['findOne']({'where':{'id':_0x317649[_0x872f('0x40')]['id']}})[_0x872f('0x21')](handleEntityNotFound(_0x19d90b,null))['then'](function(_0x146147){if(_0x146147){_0x4d247c=_0x146147;_0x166b20[_0x872f('0x2a')]=_['keys'](db[_0x872f('0x4e')]['rawAttributes']);_0x166b20[_0x872f('0x2f')]=_[_0x872f('0x2c')](_0x317649['query']);_0x166b20['filters']=_[_0x872f('0x2e')](_0x166b20[_0x872f('0x2a')],_0x166b20[_0x872f('0x2f')]);_0x3ac2dd['attributes']=_[_0x872f('0x2e')](_0x166b20[_0x872f('0x2a')],qs[_0x872f('0x31')](_0x317649['query']['fields']));_0x3ac2dd[_0x872f('0x30')]=_0x3ac2dd[_0x872f('0x30')]['length']?_0x3ac2dd[_0x872f('0x30')]:_0x166b20['model'];_0x3ac2dd['order']=qs['sort'](_0x317649[_0x872f('0x2f')][_0x872f('0x34')]);_0x3ac2dd[_0x872f('0x35')]=qs[_0x872f('0x2d')](_[_0x872f('0x36')](_0x317649[_0x872f('0x2f')],_0x166b20[_0x872f('0x2d')]));if(_0x317649['query']['filter']){_0x3ac2dd[_0x872f('0x35')]=_[_0x872f('0x38')](_0x3ac2dd[_0x872f('0x35')],{'$or':_[_0x872f('0x2b')](_0x3ac2dd[_0x872f('0x30')],function(_0x27acb7){var _0x23371b={};_0x23371b[_0x27acb7]={'$like':'%'+_0x317649[_0x872f('0x2f')]['filter']+'%'};return _0x23371b;})});}_0x3ac2dd=_['merge']({},_0x3ac2dd,_0x317649['options']);return _0x4d247c[_0x872f('0x50')](_0x3ac2dd);}})[_0x872f('0x21')](function(_0x49ee80){if(_0x49ee80){_0x13d5fe=_0x49ee80[_0x872f('0x32')];if(!_0x317649['query']['hasOwnProperty']('nolimit')){_0x3ac2dd[_0x872f('0x1b')]=qs[_0x872f('0x1b')](_0x317649[_0x872f('0x2f')][_0x872f('0x1b')]);_0x3ac2dd[_0x872f('0x1a')]=qs[_0x872f('0x1a')](_0x317649[_0x872f('0x2f')][_0x872f('0x1a')]);}return _0x4d247c[_0x872f('0x50')](_0x3ac2dd);}})[_0x872f('0x21')](function(_0x52dc80){if(_0x52dc80){return _0x52dc80?{'count':_0x13d5fe,'rows':_0x52dc80}:null;}})['then'](respondWithResult(_0x19d90b,null))[_0x872f('0x3e')](handleError(_0x19d90b,null));}; \ No newline at end of file +var _0xb953=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','where','rows','catch','show','params','includeAll','include','options','find','create','body','Condition','addConditions','ids','omit','findOne','order','pick','getConditions','addActions','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0xb953,0x89));var _0x3b95=function(_0x1361eb,_0x428cb1){_0x1361eb=_0x1361eb-0x0;var _0x587843=_0xb953[_0x1361eb];return _0x587843;};'use strict';var pdf=require(_0x3b95('0x0'));var emlformat=require(_0x3b95('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3b95('0x2'));var jsonpatch=require(_0x3b95('0x3'));var rp=require('request-promise');var moment=require(_0x3b95('0x4'));var BPromise=require(_0x3b95('0x5'));var Mustache=require(_0x3b95('0x6'));var util=require('util');var path=require(_0x3b95('0x7'));var sox=require(_0x3b95('0x8'));var csv=require(_0x3b95('0x9'));var ejs=require(_0x3b95('0xa'));var fs=require('fs');var _=require(_0x3b95('0xb'));var squel=require('squel');var crypto=require(_0x3b95('0xc'));var jsforce=require(_0x3b95('0xd'));var deskjs=require(_0x3b95('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3b95('0xf'));var Papa=require('papaparse');var Redis=require(_0x3b95('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b95('0x11'));var as=require(_0x3b95('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b95('0x13'))('api');var utils=require(_0x3b95('0x14'));var config=require(_0x3b95('0x15'));var db=require(_0x3b95('0x16'))['db'];function respondWithStatusCode(_0x364e27,_0x73e06b){_0x73e06b=_0x73e06b||0xcc;return function(_0x11b96b){if(_0x11b96b){return _0x364e27['sendStatus'](_0x73e06b);}return _0x364e27[_0x3b95('0x17')](_0x73e06b)['end']();};}function respondWithResult(_0x42f6da,_0x6a34db){_0x6a34db=_0x6a34db||0xc8;return function(_0x144cf1){if(_0x144cf1){return _0x42f6da['status'](_0x6a34db)[_0x3b95('0x18')](_0x144cf1);}};}function respondWithFilteredResult(_0x52eeb6,_0x11fe4e){return function(_0x4d0b21){if(_0x4d0b21){var _0x54323d=_0x4d0b21[_0x3b95('0x19')],_0xb099ae=_0x11fe4e[_0x3b95('0x1a')],_0x197777=_0x11fe4e['offset']+_0x11fe4e[_0x3b95('0x1b')],_0x4a1eab;if(_0x197777>=_0x54323d){_0x197777=_0x54323d;_0x4a1eab=0xc8;}else{_0x4a1eab=0xce;}_0x52eeb6[_0x3b95('0x17')](_0x4a1eab);return _0x52eeb6[_0x3b95('0x1c')](_0x3b95('0x1d'),_0xb099ae+'-'+_0x197777+'/'+_0x54323d)[_0x3b95('0x18')](_0x4d0b21);}return null;};}function patchUpdates(_0x5104a4){return function(_0x5a7453){try{jsonpatch[_0x3b95('0x1e')](_0x5a7453,_0x5104a4,!![]);}catch(_0x5f5661){return BPromise[_0x3b95('0x1f')](_0x5f5661);}return _0x5a7453[_0x3b95('0x20')]();};}function saveUpdates(_0x36cf1c,_0x524f5b){return function(_0x137502){if(_0x137502){return _0x137502[_0x3b95('0x21')](_0x36cf1c)[_0x3b95('0x22')](function(_0x52d842){return _0x52d842;});}return null;};}function removeEntity(_0x4531ec,_0x2743a4){return function(_0x2cc4c9){if(_0x2cc4c9){return _0x2cc4c9[_0x3b95('0x23')]()[_0x3b95('0x22')](function(){_0x4531ec[_0x3b95('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x448b5f,_0x58ebf8){return function(_0xe38925){if(!_0xe38925){_0x448b5f[_0x3b95('0x24')](0x194);}return _0xe38925;};}function handleError(_0x209a77,_0x4bec8e){_0x4bec8e=_0x4bec8e||0x1f4;return function(_0x556692){logger[_0x3b95('0x25')](_0x556692[_0x3b95('0x26')]);if(_0x556692['name']){delete _0x556692[_0x3b95('0x27')];}_0x209a77[_0x3b95('0x17')](_0x4bec8e)[_0x3b95('0x28')](_0x556692);};}exports[_0x3b95('0x29')]=function(_0x398755,_0xd40b17){var _0x85fc99={},_0x5667b5={},_0x23c9af={'count':0x0,'rows':[]};var _0x28aa55=_[_0x3b95('0x2a')](db[_0x3b95('0x2b')][_0x3b95('0x2c')],function(_0x116a68){return{'name':_0x116a68['fieldName'],'type':_0x116a68[_0x3b95('0x2d')][_0x3b95('0x2e')]};});_0x5667b5[_0x3b95('0x2f')]=_[_0x3b95('0x2a')](_0x28aa55,_0x3b95('0x27'));_0x5667b5['query']=_[_0x3b95('0x30')](_0x398755[_0x3b95('0x31')]);_0x5667b5[_0x3b95('0x32')]=_['intersection'](_0x5667b5[_0x3b95('0x2f')],_0x5667b5[_0x3b95('0x31')]);_0x85fc99[_0x3b95('0x33')]=_[_0x3b95('0x34')](_0x5667b5[_0x3b95('0x2f')],qs[_0x3b95('0x35')](_0x398755[_0x3b95('0x31')][_0x3b95('0x35')]));_0x85fc99[_0x3b95('0x33')]=_0x85fc99[_0x3b95('0x33')][_0x3b95('0x36')]?_0x85fc99['attributes']:_0x5667b5[_0x3b95('0x2f')];if(!_0x398755['query'][_0x3b95('0x37')](_0x3b95('0x38'))){_0x85fc99[_0x3b95('0x1b')]=qs[_0x3b95('0x1b')](_0x398755[_0x3b95('0x31')]['limit']);_0x85fc99[_0x3b95('0x1a')]=qs['offset'](_0x398755['query'][_0x3b95('0x1a')]);}_0x85fc99['order']=qs['sort'](_0x398755[_0x3b95('0x31')][_0x3b95('0x39')]);_0x85fc99['where']=qs[_0x3b95('0x32')](_['pick'](_0x398755[_0x3b95('0x31')],_0x5667b5[_0x3b95('0x32')]),_0x28aa55);if(_0x398755[_0x3b95('0x31')][_0x3b95('0x3a')]){_0x85fc99['where']=_[_0x3b95('0x3b')](_0x85fc99['where'],{'$or':_[_0x3b95('0x2a')](_0x28aa55,function(_0x5aaa0a){if(_0x5aaa0a[_0x3b95('0x2d')]!==_0x3b95('0x3c')){var _0x90642a={};_0x90642a[_0x5aaa0a[_0x3b95('0x27')]]={'$like':'%'+_0x398755[_0x3b95('0x31')][_0x3b95('0x3a')]+'%'};return _0x90642a;}})});}_0x85fc99=_[_0x3b95('0x3b')]({},_0x85fc99,_0x398755['options']);var _0x55386f={'where':_0x85fc99[_0x3b95('0x3d')]};return db[_0x3b95('0x2b')][_0x3b95('0x19')](_0x55386f)[_0x3b95('0x22')](function(_0x3a9670){_0x23c9af[_0x3b95('0x19')]=_0x3a9670;if(_0x398755['query']['includeAll']){_0x85fc99['include']=[{'all':!![]}];}return db[_0x3b95('0x2b')]['findAll'](_0x85fc99);})[_0x3b95('0x22')](function(_0x5eff1d){_0x23c9af[_0x3b95('0x3e')]=_0x5eff1d;return _0x23c9af;})[_0x3b95('0x22')](respondWithFilteredResult(_0xd40b17,_0x85fc99))[_0x3b95('0x3f')](handleError(_0xd40b17,null));};exports[_0x3b95('0x40')]=function(_0x5668c6,_0x566378){var _0x229f0e={'raw':![],'where':{'id':_0x5668c6[_0x3b95('0x41')]['id']}},_0x1353de={};_0x1353de['model']=_['keys'](db[_0x3b95('0x2b')][_0x3b95('0x2c')]);_0x1353de[_0x3b95('0x31')]=_[_0x3b95('0x30')](_0x5668c6['query']);_0x1353de[_0x3b95('0x32')]=_['intersection'](_0x1353de[_0x3b95('0x2f')],_0x1353de[_0x3b95('0x31')]);_0x229f0e[_0x3b95('0x33')]=_[_0x3b95('0x34')](_0x1353de[_0x3b95('0x2f')],qs[_0x3b95('0x35')](_0x5668c6[_0x3b95('0x31')]['fields']));_0x229f0e[_0x3b95('0x33')]=_0x229f0e[_0x3b95('0x33')][_0x3b95('0x36')]?_0x229f0e[_0x3b95('0x33')]:_0x1353de[_0x3b95('0x2f')];if(_0x5668c6[_0x3b95('0x31')][_0x3b95('0x42')]){_0x229f0e[_0x3b95('0x43')]=[{'all':!![]}];}_0x229f0e=_[_0x3b95('0x3b')]({},_0x229f0e,_0x5668c6[_0x3b95('0x44')]);return db[_0x3b95('0x2b')][_0x3b95('0x45')](_0x229f0e)[_0x3b95('0x22')](handleEntityNotFound(_0x566378,null))[_0x3b95('0x22')](respondWithResult(_0x566378,null))[_0x3b95('0x3f')](handleError(_0x566378,null));};exports[_0x3b95('0x46')]=function(_0x2ba0d4,_0x3d2bc9){return db[_0x3b95('0x2b')][_0x3b95('0x46')](_0x2ba0d4[_0x3b95('0x47')],{})['then'](respondWithResult(_0x3d2bc9,0xc9))[_0x3b95('0x3f')](handleError(_0x3d2bc9,null));};exports[_0x3b95('0x21')]=function(_0x1ddae1,_0x41a2aa){if(_0x1ddae1[_0x3b95('0x47')]['id']){delete _0x1ddae1[_0x3b95('0x47')]['id'];}return db[_0x3b95('0x2b')][_0x3b95('0x45')]({'where':{'id':_0x1ddae1[_0x3b95('0x41')]['id']}})['then'](handleEntityNotFound(_0x41a2aa,null))[_0x3b95('0x22')](saveUpdates(_0x1ddae1['body'],null))[_0x3b95('0x22')](respondWithResult(_0x41a2aa,null))[_0x3b95('0x3f')](handleError(_0x41a2aa,null));};exports[_0x3b95('0x23')]=function(_0x458a8a,_0x7bf5ff){return db[_0x3b95('0x2b')][_0x3b95('0x45')]({'where':{'id':_0x458a8a['params']['id']}})['then'](handleEntityNotFound(_0x7bf5ff,null))['then'](removeEntity(_0x7bf5ff,null))[_0x3b95('0x3f')](handleError(_0x7bf5ff,null));};exports['addConditions']=function(_0x3baa13,_0x590dcb,_0x2c274c){return db[_0x3b95('0x48')]['find']({'where':{'id':_0x3baa13[_0x3b95('0x41')]['id']}})[_0x3b95('0x22')](handleEntityNotFound(_0x590dcb,null))[_0x3b95('0x22')](function(_0x5209c9){if(_0x5209c9){return _0x5209c9[_0x3b95('0x49')](_0x3baa13[_0x3b95('0x47')][_0x3b95('0x4a')],_[_0x3b95('0x4b')](_0x3baa13[_0x3b95('0x47')],['ids','id'])||{});}})[_0x3b95('0x22')](respondWithResult(_0x590dcb,null))['catch'](handleError(_0x590dcb,null));};exports['getConditions']=function(_0x2d6bab,_0x44d0ce,_0x42d8fa){var _0xc67370={};var _0x2413ca={};var _0x32302b;var _0x329a69;return db[_0x3b95('0x2b')][_0x3b95('0x4c')]({'where':{'id':_0x2d6bab[_0x3b95('0x41')]['id']}})[_0x3b95('0x22')](handleEntityNotFound(_0x44d0ce,null))['then'](function(_0x408d70){if(_0x408d70){_0x32302b=_0x408d70;_0x2413ca[_0x3b95('0x2f')]=_[_0x3b95('0x30')](db['Condition'][_0x3b95('0x2c')]);_0x2413ca['query']=_[_0x3b95('0x30')](_0x2d6bab['query']);_0x2413ca[_0x3b95('0x32')]=_[_0x3b95('0x34')](_0x2413ca['model'],_0x2413ca[_0x3b95('0x31')]);_0xc67370[_0x3b95('0x33')]=_['intersection'](_0x2413ca['model'],qs[_0x3b95('0x35')](_0x2d6bab[_0x3b95('0x31')][_0x3b95('0x35')]));_0xc67370[_0x3b95('0x33')]=_0xc67370['attributes']['length']?_0xc67370[_0x3b95('0x33')]:_0x2413ca['model'];_0xc67370[_0x3b95('0x4d')]=qs[_0x3b95('0x39')](_0x2d6bab[_0x3b95('0x31')][_0x3b95('0x39')]);_0xc67370['where']=qs[_0x3b95('0x32')](_[_0x3b95('0x4e')](_0x2d6bab['query'],_0x2413ca[_0x3b95('0x32')]));if(_0x2d6bab['query'][_0x3b95('0x3a')]){_0xc67370[_0x3b95('0x3d')]=_[_0x3b95('0x3b')](_0xc67370[_0x3b95('0x3d')],{'$or':_['map'](_0xc67370[_0x3b95('0x33')],function(_0x37f176){var _0x433eb7={};_0x433eb7[_0x37f176]={'$like':'%'+_0x2d6bab[_0x3b95('0x31')][_0x3b95('0x3a')]+'%'};return _0x433eb7;})});}_0xc67370=_[_0x3b95('0x3b')]({},_0xc67370,_0x2d6bab[_0x3b95('0x44')]);return _0x32302b[_0x3b95('0x4f')](_0xc67370);}})[_0x3b95('0x22')](function(_0xd22d88){if(_0xd22d88){_0x329a69=_0xd22d88[_0x3b95('0x36')];if(!_0x2d6bab[_0x3b95('0x31')][_0x3b95('0x37')](_0x3b95('0x38'))){_0xc67370[_0x3b95('0x1b')]=qs[_0x3b95('0x1b')](_0x2d6bab[_0x3b95('0x31')][_0x3b95('0x1b')]);_0xc67370[_0x3b95('0x1a')]=qs[_0x3b95('0x1a')](_0x2d6bab[_0x3b95('0x31')][_0x3b95('0x1a')]);}return _0x32302b[_0x3b95('0x4f')](_0xc67370);}})[_0x3b95('0x22')](function(_0x11ffc9){if(_0x11ffc9){return _0x11ffc9?{'count':_0x329a69,'rows':_0x11ffc9}:null;}})[_0x3b95('0x22')](respondWithResult(_0x44d0ce,null))[_0x3b95('0x3f')](handleError(_0x44d0ce,null));};exports[_0x3b95('0x50')]=function(_0x748aee,_0x10a501,_0x5c21aa){return db[_0x3b95('0x51')][_0x3b95('0x45')]({'where':{'id':_0x748aee['params']['id']}})[_0x3b95('0x22')](handleEntityNotFound(_0x10a501,null))[_0x3b95('0x22')](function(_0x519343){if(_0x519343){return _0x519343[_0x3b95('0x50')](_0x748aee[_0x3b95('0x47')][_0x3b95('0x4a')],_['omit'](_0x748aee[_0x3b95('0x47')],[_0x3b95('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x10a501,null))[_0x3b95('0x3f')](handleError(_0x10a501,null));};exports[_0x3b95('0x52')]=function(_0x1b9c58,_0x373380,_0x85ae15){var _0x1792ed={};var _0x3c580c={};var _0x3003ba;var _0xd1bdea;return db[_0x3b95('0x2b')]['findOne']({'where':{'id':_0x1b9c58[_0x3b95('0x41')]['id']}})[_0x3b95('0x22')](handleEntityNotFound(_0x373380,null))[_0x3b95('0x22')](function(_0x2eb282){if(_0x2eb282){_0x3003ba=_0x2eb282;_0x3c580c['model']=_['keys'](db['Action'][_0x3b95('0x2c')]);_0x3c580c['query']=_[_0x3b95('0x30')](_0x1b9c58[_0x3b95('0x31')]);_0x3c580c[_0x3b95('0x32')]=_[_0x3b95('0x34')](_0x3c580c[_0x3b95('0x2f')],_0x3c580c[_0x3b95('0x31')]);_0x1792ed['attributes']=_[_0x3b95('0x34')](_0x3c580c[_0x3b95('0x2f')],qs[_0x3b95('0x35')](_0x1b9c58[_0x3b95('0x31')]['fields']));_0x1792ed[_0x3b95('0x33')]=_0x1792ed[_0x3b95('0x33')][_0x3b95('0x36')]?_0x1792ed[_0x3b95('0x33')]:_0x3c580c[_0x3b95('0x2f')];_0x1792ed[_0x3b95('0x4d')]=qs['sort'](_0x1b9c58[_0x3b95('0x31')][_0x3b95('0x39')]);_0x1792ed['where']=qs[_0x3b95('0x32')](_[_0x3b95('0x4e')](_0x1b9c58[_0x3b95('0x31')],_0x3c580c[_0x3b95('0x32')]));if(_0x1b9c58[_0x3b95('0x31')][_0x3b95('0x3a')]){_0x1792ed[_0x3b95('0x3d')]=_[_0x3b95('0x3b')](_0x1792ed[_0x3b95('0x3d')],{'$or':_['map'](_0x1792ed['attributes'],function(_0x5b3ded){var _0x4de33f={};_0x4de33f[_0x5b3ded]={'$like':'%'+_0x1b9c58[_0x3b95('0x31')][_0x3b95('0x3a')]+'%'};return _0x4de33f;})});}_0x1792ed=_[_0x3b95('0x3b')]({},_0x1792ed,_0x1b9c58[_0x3b95('0x44')]);return _0x3003ba[_0x3b95('0x52')](_0x1792ed);}})[_0x3b95('0x22')](function(_0x215f26){if(_0x215f26){_0xd1bdea=_0x215f26[_0x3b95('0x36')];if(!_0x1b9c58[_0x3b95('0x31')]['hasOwnProperty'](_0x3b95('0x38'))){_0x1792ed[_0x3b95('0x1b')]=qs[_0x3b95('0x1b')](_0x1b9c58['query'][_0x3b95('0x1b')]);_0x1792ed[_0x3b95('0x1a')]=qs[_0x3b95('0x1a')](_0x1b9c58[_0x3b95('0x31')][_0x3b95('0x1a')]);}return _0x3003ba[_0x3b95('0x52')](_0x1792ed);}})[_0x3b95('0x22')](function(_0x48995){if(_0x48995){return _0x48995?{'count':_0xd1bdea,'rows':_0x48995}:null;}})['then'](respondWithResult(_0x373380,null))[_0x3b95('0x3f')](handleError(_0x373380,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 50c1488..71c1e0a 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 _0x425d=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation'];(function(_0x11ec4b,_0x46287c){var _0x58f422=function(_0x2c4c3e){while(--_0x2c4c3e){_0x11ec4b['push'](_0x11ec4b['shift']());}};_0x58f422(++_0x46287c);}(_0x425d,0x1e0));var _0xd425=function(_0x24bfc6,_0x24399d){_0x24bfc6=_0x24bfc6-0x0;var _0x33bdb0=_0x425d[_0x24bfc6];return _0x33bdb0;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var BPromise=require(_0xd425('0x4'));var rp=require(_0xd425('0x5'));var fs=require('fs');var path=require(_0xd425('0x6'));var rimraf=require(_0xd425('0x7'));var config=require('../../config/environment');var attributes=require(_0xd425('0x8'));module[_0xd425('0x9')]=function(_0xc4e080,_0x36866e){return _0xc4e080[_0xd425('0xa')](_0xd425('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x9a19,0x114));var _0x99a1=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x9a19[_0x270adf];return _0x29eda9;};'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 diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index e3c8d16..dc171c3 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 _0xe93b=['client','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x28ffe7,_0x37530c){var _0x4dd6ba=function(_0x1c6a6a){while(--_0x1c6a6a){_0x28ffe7['push'](_0x28ffe7['shift']());}};_0x4dd6ba(++_0x37530c);}(_0xe93b,0x1c2));var _0xbe93=function(_0x13e8e1,_0x36032d){_0x13e8e1=_0x13e8e1-0x0;var _0x507f03=_0xe93b[_0x13e8e1];return _0x507f03;};'use strict';var _=require('lodash');var util=require(_0xbe93('0x0'));var moment=require(_0xbe93('0x1'));var BPromise=require(_0xbe93('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe93('0x3'));var db=require(_0xbe93('0x4'))['db'];var utils=require(_0xbe93('0x5'));var logger=require(_0xbe93('0x6'))(_0xbe93('0x7'));var config=require(_0xbe93('0x8'));var jayson=require(_0xbe93('0x9'));var client=jayson[_0xbe93('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d79b4,_0x29bc15,_0x317a09){return new BPromise(function(_0xb5f3bb,_0x3832c0){return client[_0xbe93('0xb')](_0x1d79b4,_0x317a09)[_0xbe93('0xc')](function(_0x3ed10a){logger[_0xbe93('0xd')]('Automation,\x20%s,\x20%s',_0x29bc15,_0xbe93('0xe'));logger[_0xbe93('0xf')](_0xbe93('0x10'),_0x29bc15,_0xbe93('0xe'),JSON[_0xbe93('0x11')](_0x3ed10a));if(_0x3ed10a[_0xbe93('0x12')]){if(_0x3ed10a['error'][_0xbe93('0x13')]===0x1f4){logger[_0xbe93('0x12')](_0xbe93('0x14'),_0x29bc15,_0x3ed10a['error']['message']);return _0x3832c0(_0x3ed10a[_0xbe93('0x12')][_0xbe93('0x15')]);}logger[_0xbe93('0x12')]('Automation,\x20%s,\x20%s',_0x29bc15,_0x3ed10a['error'][_0xbe93('0x15')]);return _0xb5f3bb(_0x3ed10a[_0xbe93('0x12')][_0xbe93('0x15')]);}else{logger[_0xbe93('0xd')](_0xbe93('0x14'),_0x29bc15,_0xbe93('0xe'));_0xb5f3bb(_0x3ed10a['result'][_0xbe93('0x15')]);}})[_0xbe93('0x16')](function(_0x481af3){logger[_0xbe93('0x12')](_0xbe93('0x14'),_0x29bc15,_0x481af3);_0x3832c0(_0x481af3);});});} \ No newline at end of file +var _0xb54c=['stringify','error','code','Automation,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xa1faf3,_0x495f04){var _0x55e7be=function(_0x42d384){while(--_0x42d384){_0xa1faf3['push'](_0xa1faf3['shift']());}};_0x55e7be(++_0x495f04);}(_0xb54c,0x1d5));var _0xcb54=function(_0x33acae,_0x523cce){_0x33acae=_0x33acae-0x0;var _0xdd24b0=_0xb54c[_0x33acae];return _0xdd24b0;};'use strict';var _=require(_0xcb54('0x0'));var util=require(_0xcb54('0x1'));var moment=require('moment');var BPromise=require(_0xcb54('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb54('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb54('0x4'));var logger=require(_0xcb54('0x5'))(_0xcb54('0x6'));var config=require(_0xcb54('0x7'));var jayson=require(_0xcb54('0x8'));var client=jayson['client'][_0xcb54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x530fce,_0x43ac38,_0x477b58){return new BPromise(function(_0x3b2a29,_0x434d93){return client[_0xcb54('0xa')](_0x530fce,_0x477b58)[_0xcb54('0xb')](function(_0x314a0f){logger['info']('Automation,\x20%s,\x20%s',_0x43ac38,'request\x20sent');logger[_0xcb54('0xc')](_0xcb54('0xd'),_0x43ac38,_0xcb54('0xe'),JSON[_0xcb54('0xf')](_0x314a0f));if(_0x314a0f[_0xcb54('0x10')]){if(_0x314a0f['error'][_0xcb54('0x11')]===0x1f4){logger['error'](_0xcb54('0x12'),_0x43ac38,_0x314a0f[_0xcb54('0x10')][_0xcb54('0x13')]);return _0x434d93(_0x314a0f[_0xcb54('0x10')][_0xcb54('0x13')]);}logger['error'](_0xcb54('0x12'),_0x43ac38,_0x314a0f['error']['message']);return _0x3b2a29(_0x314a0f[_0xcb54('0x10')][_0xcb54('0x13')]);}else{logger[_0xcb54('0x14')]('Automation,\x20%s,\x20%s',_0x43ac38,_0xcb54('0xe'));_0x3b2a29(_0x314a0f[_0xcb54('0x15')][_0xcb54('0x13')]);}})['catch'](function(_0x6460e6){logger[_0xcb54('0x10')]('Automation,\x20%s,\x20%s',_0x43ac38,_0x6460e6);_0x434d93(_0x6460e6);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 51e05af..ba7f508 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 _0x5b2a=['../../config/environment','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','update','delete','exports','multer','path','express','../../components/auth/service'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x5b2a,0x150));var _0xa5b2=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x5b2a[_0x79cd47];return _0x3b9484;};'use strict';var multer=require(_0xa5b2('0x0'));var util=require('util');var path=require(_0xa5b2('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5b2('0x2'));var router=express['Router']();var auth=require(_0xa5b2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa5b2('0x4'));var controller=require('./automation.controller');router[_0xa5b2('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa5b2('0x5')](_0xa5b2('0x6'),auth[_0xa5b2('0x7')](),controller[_0xa5b2('0x8')]);router[_0xa5b2('0x5')](_0xa5b2('0x9'),auth[_0xa5b2('0x7')](),controller[_0xa5b2('0xa')]);router[_0xa5b2('0x5')](_0xa5b2('0xb'),auth[_0xa5b2('0x7')](),controller[_0xa5b2('0xc')]);router[_0xa5b2('0xd')]('/',auth['isAuthenticated'](),controller[_0xa5b2('0xe')]);router[_0xa5b2('0xd')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xa5b2('0xf')]);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0xa5b2('0x10')]);router['put']('/:id',auth[_0xa5b2('0x7')](),controller[_0xa5b2('0x11')]);router[_0xa5b2('0x12')](_0xa5b2('0x6'),auth[_0xa5b2('0x7')](),controller['destroy']);module[_0xa5b2('0x13')]=router; \ No newline at end of file +var _0xadd7=['put','update','delete','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions'];(function(_0x3dcfb9,_0x56d93c){var _0x27688b=function(_0x34935d){while(--_0x34935d){_0x3dcfb9['push'](_0x3dcfb9['shift']());}};_0x27688b(++_0x56d93c);}(_0xadd7,0x1b9));var _0x7add=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xadd7[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x7add('0x0'));var path=require(_0x7add('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7add('0x2')]();var auth=require(_0x7add('0x3'));var interaction=require(_0x7add('0x4'));var config=require(_0x7add('0x5'));var controller=require(_0x7add('0x6'));router[_0x7add('0x7')]('/',auth['isAuthenticated'](),controller[_0x7add('0x8')]);router[_0x7add('0x7')](_0x7add('0x9'),auth[_0x7add('0xa')](),controller[_0x7add('0xb')]);router['get'](_0x7add('0xc'),auth['isAuthenticated'](),controller[_0x7add('0xd')]);router[_0x7add('0x7')](_0x7add('0xe'),auth['isAuthenticated'](),controller[_0x7add('0xf')]);router[_0x7add('0x10')]('/',auth['isAuthenticated'](),controller[_0x7add('0x11')]);router[_0x7add('0x10')](_0x7add('0xc'),auth['isAuthenticated'](),controller[_0x7add('0x12')]);router[_0x7add('0x10')](_0x7add('0xe'),auth[_0x7add('0xa')](),controller['addActions']);router[_0x7add('0x13')](_0x7add('0x9'),auth[_0x7add('0xa')](),controller[_0x7add('0x14')]);router[_0x7add('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7add('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 0691185..82a3634 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 _0x9eb9=['DESC','Cut\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC'];(function(_0x24c2c3,_0x31eabf){var _0x6e30ac=function(_0xfbf8f1){while(--_0xfbf8f1){_0x24c2c3['push'](_0x24c2c3['shift']());}};_0x6e30ac(++_0x31eabf);}(_0x9eb9,0x1b8));var _0x99eb=function(_0x47bc89,_0x456e04){_0x47bc89=_0x47bc89-0x0;var _0x25fbe2=_0x9eb9[_0x47bc89];return _0x25fbe2;};'use strict';var Sequelize=require(_0x99eb('0x0'));module[_0x99eb('0x1')]={'name':{'type':Sequelize[_0x99eb('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x99eb('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x99eb('0x4')],'defaultValue':0x0,'comment':_0x99eb('0x5')},'limitCalls':{'type':Sequelize[_0x99eb('0x6')](0x4)[_0x99eb('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x99eb('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x99eb('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x99eb('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x99eb('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x99eb('0x6')](0x5)[_0x99eb('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x99eb('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x99eb('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x99eb('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x99eb('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x99eb('0x6')](0x5)[_0x99eb('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x99eb('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x99eb('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x99eb('0xd')},'dialTimezone':{'type':Sequelize[_0x99eb('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x99eb('0x2')],'defaultValue':_0x99eb('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x99eb('0x3')](_0x99eb('0xf'),_0x99eb('0x10'),_0x99eb('0x11')),'defaultValue':_0x99eb('0xf')},'dialAMDActive':{'type':Sequelize[_0x99eb('0x4')],'defaultValue':0x0,'comment':_0x99eb('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x99eb('0x6')](0x9)[_0x99eb('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x99eb('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x99eb('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x99eb('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x99eb('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x99eb('0x6')](0x9)[_0x99eb('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x99eb('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x99eb('0x6')](0x9)[_0x99eb('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x99eb('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x99eb('0x6')](0x9)[_0x99eb('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x99eb('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x99eb('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x99eb('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x99eb('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x99eb('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x99eb('0x6')](0x9)[_0x99eb('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x99eb('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x99eb('0x3')]('DESC',_0x99eb('0x1b')),'defaultValue':_0x99eb('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x99eb('0x6')](0x3)[_0x99eb('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x99eb('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x99eb('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x99eb('0x6')](0x3)[_0x99eb('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x99eb('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x99eb('0x6')](0x5)[_0x99eb('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x99eb('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x99eb('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x99eb('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x99eb('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x99eb('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x99eb('0x6')](0x3)[_0x99eb('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x99eb('0x6')](0x5)[_0x99eb('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x99eb('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x99eb('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x99eb('0x6')](0x5)[_0x99eb('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x99eb('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x99eb('0x6')](0x3)[_0x99eb('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x99eb('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x99eb('0x6')](0x5)[_0x99eb('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x99eb('0x26')}}; \ No newline at end of file +var _0xec87=['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)','07:00-22:00,*,*,*','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING'];(function(_0x33b880,_0xa71851){var _0x2390b0=function(_0x2cad49){while(--_0x2cad49){_0x33b880['push'](_0x33b880['shift']());}};_0x2390b0(++_0xa71851);}(_0xec87,0x162));var _0x7ec8=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0xec87[_0x1597e2];return _0x4c8c0a;};'use strict';var Sequelize=require(_0x7ec8('0x0'));module[_0x7ec8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7ec8('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7ec8('0x3')](_0x7ec8('0x4')),'allowNull':![],'defaultValue':_0x7ec8('0x4')},'description':{'type':Sequelize[_0x7ec8('0x5')]},'active':{'type':Sequelize[_0x7ec8('0x6')],'defaultValue':0x0,'comment':_0x7ec8('0x7')},'limitCalls':{'type':Sequelize[_0x7ec8('0x8')](0x4)[_0x7ec8('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7ec8('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7ec8('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7ec8('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7ec8('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ec8('0xb')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7ec8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ec8('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7ec8('0x8')](0x5)[_0x7ec8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7ec8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ec8('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7ec8('0x8')](0x5)[_0x7ec8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ec8('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7ec8('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x7ec8('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7ec8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ec8('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7ec8('0x8')](0x3)[_0x7ec8('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7ec8('0x11')},'dialTimezone':{'type':Sequelize[_0x7ec8('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7ec8('0x5')],'defaultValue':_0x7ec8('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x7ec8('0x3')](_0x7ec8('0x13'),'never','onlyIfOpen'),'defaultValue':_0x7ec8('0x13')},'dialAMDActive':{'type':Sequelize[_0x7ec8('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x7ec8('0x8')](0x9)[_0x7ec8('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7ec8('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x7ec8('0x8')](0x9)[_0x7ec8('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7ec8('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7ec8('0x8')](0x9)[_0x7ec8('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7ec8('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7ec8('0x8')](0x9)[_0x7ec8('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7ec8('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x7ec8('0x8')](0x9)[_0x7ec8('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7ec8('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7ec8('0x8')](0x9)[_0x7ec8('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7ec8('0x8')](0x9)[_0x7ec8('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7ec8('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7ec8('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7ec8('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7ec8('0x8')](0x9)[_0x7ec8('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7ec8('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7ec8('0x3')](_0x7ec8('0x1c'),_0x7ec8('0x1d')),'defaultValue':_0x7ec8('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7ec8('0x8')](0x3)[_0x7ec8('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7ec8('0x1e')},'dialCutDigit':{'type':Sequelize[_0x7ec8('0x8')](0x3)[_0x7ec8('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7ec8('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7ec8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7ec8('0x8')](0x5)[_0x7ec8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x7ec8('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ec8('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x7ec8('0x8')](0x5)[_0x7ec8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ec8('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7ec8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ec8('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7ec8('0x8')](0x5)[_0x7ec8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ec8('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x7ec8('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ec8('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7ec8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ec8('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7ec8('0x8')](0x3)[_0x7ec8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ec8('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7ec8('0x8')](0x5)[_0x7ec8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ec8('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 7e99357..e3147fb 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 _0x0625=['getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','into','deletedAt\x20IS\x20NULL','push','all','removeLists','CmHopper','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','apply','reject','save','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','Campaign','findAll','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','getHoppers','findOne','nolimit','CmHopperHistory','order','rows','CmHopperFinal','CampaignId','CmHopperBlack'];(function(_0x25e7cb,_0x1326df){var _0x4ac0f3=function(_0x4b1679){while(--_0x4b1679){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x4ac0f3(++_0x1326df);}(_0x0625,0xb2));var _0x5062=function(_0xd11615,_0xecd492){_0xd11615=_0xd11615-0x0;var _0x18a16c=_0x0625[_0xd11615];return _0x18a16c;};'use strict';var pdf=require(_0x5062('0x0'));var emlformat=require(_0x5062('0x1'));var rimraf=require(_0x5062('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5062('0x3'));var rp=require(_0x5062('0x4'));var moment=require(_0x5062('0x5'));var BPromise=require(_0x5062('0x6'));var Mustache=require(_0x5062('0x7'));var util=require(_0x5062('0x8'));var path=require(_0x5062('0x9'));var sox=require(_0x5062('0xa'));var csv=require('to-csv');var ejs=require(_0x5062('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5062('0xc'));var crypto=require(_0x5062('0xd'));var jsforce=require(_0x5062('0xe'));var deskjs=require(_0x5062('0xf'));var toCsv=require(_0x5062('0x10'));var querystring=require(_0x5062('0x11'));var Papa=require(_0x5062('0x12'));var Redis=require(_0x5062('0x13'));var authService=require(_0x5062('0x14'));var qs=require(_0x5062('0x15'));var as=require(_0x5062('0x16'));var hardwareService=require(_0x5062('0x17'));var logger=require(_0x5062('0x18'))(_0x5062('0x19'));var utils=require(_0x5062('0x1a'));var config=require(_0x5062('0x1b'));var db=require(_0x5062('0x1c'))['db'];function respondWithStatusCode(_0x53fb27,_0x998383){_0x998383=_0x998383||0xcc;return function(_0x439cb6){if(_0x439cb6){return _0x53fb27[_0x5062('0x1d')](_0x998383);}return _0x53fb27[_0x5062('0x1e')](_0x998383)[_0x5062('0x1f')]();};}function respondWithResult(_0x29113c,_0x427b08){_0x427b08=_0x427b08||0xc8;return function(_0x2a44d4){if(_0x2a44d4){return _0x29113c[_0x5062('0x1e')](_0x427b08)[_0x5062('0x20')](_0x2a44d4);}};}function respondWithFilteredResult(_0x25cf9a,_0xce925e){return function(_0x1693ea){if(_0x1693ea){var _0x5847f1=_0x1693ea['count'],_0x40da23=_0xce925e['offset'],_0x2f15f8=_0xce925e['offset']+_0xce925e['limit'],_0x2e110d;if(_0x2f15f8>=_0x5847f1){_0x2f15f8=_0x5847f1;_0x2e110d=0xc8;}else{_0x2e110d=0xce;}_0x25cf9a[_0x5062('0x1e')](_0x2e110d);return _0x25cf9a['set']('Content-Range',_0x40da23+'-'+_0x2f15f8+'/'+_0x5847f1)[_0x5062('0x20')](_0x1693ea);}return null;};}function patchUpdates(_0x234050){return function(_0x15f61e){try{jsonpatch[_0x5062('0x21')](_0x15f61e,_0x234050,!![]);}catch(_0x5f392e){return BPromise[_0x5062('0x22')](_0x5f392e);}return _0x15f61e[_0x5062('0x23')]();};}function saveUpdates(_0x40c662,_0x174b8c){return function(_0x4e4ae0){if(_0x4e4ae0){return _0x4e4ae0['update'](_0x40c662)[_0x5062('0x24')](function(_0x2b01a7){return _0x2b01a7;});}return null;};}function removeEntity(_0x513a03,_0x82a8b2){return function(_0x2d29ba){if(_0x2d29ba){return _0x2d29ba[_0x5062('0x25')]()[_0x5062('0x24')](function(){var _0x12a431=_0x2d29ba['get']({'plain':!![]});var _0x53995a=_0x5062('0x26');return db[_0x5062('0x27')][_0x5062('0x25')]({'where':{'type':_0x53995a,'resourceId':_0x12a431['id']}})[_0x5062('0x24')](function(){return _0x2d29ba;});})[_0x5062('0x24')](function(){_0x513a03[_0x5062('0x1e')](0xcc)[_0x5062('0x1f')]();});}};}function handleEntityNotFound(_0x13d572,_0xc56d9f){return function(_0x3c6a7c){if(!_0x3c6a7c){_0x13d572[_0x5062('0x1d')](0x194);}return _0x3c6a7c;};}function handleError(_0x2cd4af,_0xf2a0bb){_0xf2a0bb=_0xf2a0bb||0x1f4;return function(_0xe05baa){logger[_0x5062('0x28')](_0xe05baa[_0x5062('0x29')]);if(_0xe05baa[_0x5062('0x2a')]){delete _0xe05baa[_0x5062('0x2a')];}_0x2cd4af[_0x5062('0x1e')](_0xf2a0bb)[_0x5062('0x2b')](_0xe05baa);};}exports[_0x5062('0x2c')]=function(_0x4ab8a1,_0x206af9){var _0x2fd862={},_0x1bfa97={},_0x1c70e4={'count':0x0,'rows':[]};var _0x10f655=_['map'](db['Campaign'][_0x5062('0x2d')],function(_0x3893c9){return{'name':_0x3893c9[_0x5062('0x2e')],'type':_0x3893c9[_0x5062('0x2f')][_0x5062('0x30')]};});_0x1bfa97[_0x5062('0x31')]=_[_0x5062('0x32')](_0x10f655,_0x5062('0x2a'));_0x1bfa97[_0x5062('0x33')]=_[_0x5062('0x34')](_0x4ab8a1['query']);_0x1bfa97['filters']=_[_0x5062('0x35')](_0x1bfa97['model'],_0x1bfa97[_0x5062('0x33')]);_0x2fd862['attributes']=_[_0x5062('0x35')](_0x1bfa97[_0x5062('0x31')],qs[_0x5062('0x36')](_0x4ab8a1['query'][_0x5062('0x36')]));_0x2fd862[_0x5062('0x37')]=_0x2fd862[_0x5062('0x37')][_0x5062('0x38')]?_0x2fd862[_0x5062('0x37')]:_0x1bfa97[_0x5062('0x31')];if(!_0x4ab8a1['query'][_0x5062('0x39')]('nolimit')){_0x2fd862[_0x5062('0x3a')]=qs['limit'](_0x4ab8a1[_0x5062('0x33')][_0x5062('0x3a')]);_0x2fd862[_0x5062('0x3b')]=qs[_0x5062('0x3b')](_0x4ab8a1[_0x5062('0x33')][_0x5062('0x3b')]);}_0x2fd862['order']=qs[_0x5062('0x3c')](_0x4ab8a1[_0x5062('0x33')][_0x5062('0x3c')]);_0x2fd862[_0x5062('0x3d')]=qs[_0x5062('0x3e')](_[_0x5062('0x3f')](_0x4ab8a1[_0x5062('0x33')],_0x1bfa97['filters']),_0x10f655);if(_0x4ab8a1[_0x5062('0x33')][_0x5062('0x40')]){_0x2fd862[_0x5062('0x3d')]=_[_0x5062('0x41')](_0x2fd862[_0x5062('0x3d')],{'$or':_[_0x5062('0x32')](_0x10f655,function(_0x2f27ac){if(_0x2f27ac['type']!==_0x5062('0x42')){var _0xabc82b={};_0xabc82b[_0x2f27ac[_0x5062('0x2a')]]={'$like':'%'+_0x4ab8a1[_0x5062('0x33')][_0x5062('0x40')]+'%'};return _0xabc82b;}})});}_0x2fd862=_[_0x5062('0x41')]({},_0x2fd862,_0x4ab8a1[_0x5062('0x43')]);var _0xc9bea9={'where':_0x2fd862['where']};return db['Campaign'][_0x5062('0x44')](_0xc9bea9)[_0x5062('0x24')](function(_0x45b815){_0x1c70e4[_0x5062('0x44')]=_0x45b815;if(_0x4ab8a1[_0x5062('0x33')][_0x5062('0x45')]){_0x2fd862[_0x5062('0x46')]=[{'all':!![]}];}return db[_0x5062('0x47')][_0x5062('0x48')](_0x2fd862);})[_0x5062('0x24')](function(_0x273cb6){_0x1c70e4['rows']=_0x273cb6;return _0x1c70e4;})['then'](respondWithFilteredResult(_0x206af9,_0x2fd862))[_0x5062('0x49')](handleError(_0x206af9,null));};exports['show']=function(_0xaa1cc4,_0x12dab2){var _0x377d36={'raw':![],'where':{'id':_0xaa1cc4[_0x5062('0x4a')]['id']}},_0x2e453e={};_0x2e453e[_0x5062('0x31')]=_[_0x5062('0x34')](db[_0x5062('0x47')][_0x5062('0x2d')]);_0x2e453e['query']=_['keys'](_0xaa1cc4[_0x5062('0x33')]);_0x2e453e['filters']=_[_0x5062('0x35')](_0x2e453e['model'],_0x2e453e[_0x5062('0x33')]);_0x377d36[_0x5062('0x37')]=_[_0x5062('0x35')](_0x2e453e[_0x5062('0x31')],qs[_0x5062('0x36')](_0xaa1cc4['query']['fields']));_0x377d36[_0x5062('0x37')]=_0x377d36[_0x5062('0x37')][_0x5062('0x38')]?_0x377d36[_0x5062('0x37')]:_0x2e453e[_0x5062('0x31')];if(_0xaa1cc4[_0x5062('0x33')]['includeAll']){_0x377d36['include']=[{'all':!![]}];}_0x377d36=_[_0x5062('0x41')]({},_0x377d36,_0xaa1cc4[_0x5062('0x43')]);return db[_0x5062('0x47')][_0x5062('0x4b')](_0x377d36)['then'](handleEntityNotFound(_0x12dab2,null))[_0x5062('0x24')](respondWithResult(_0x12dab2,null))[_0x5062('0x49')](handleError(_0x12dab2,null));};exports[_0x5062('0x4c')]=function(_0x3203d4,_0x1320fa){return db['Campaign']['create'](_0x3203d4[_0x5062('0x4d')],{})[_0x5062('0x24')](function(_0x217084){var _0x241b9a=_0x3203d4[_0x5062('0x4e')][_0x5062('0x4f')]({'plain':!![]});if(!_0x241b9a)throw new Error(_0x5062('0x50'));if(_0x241b9a[_0x5062('0x51')]===_0x5062('0x4e')){var _0xcb56a6=_0x217084[_0x5062('0x4f')]({'plain':!![]});var _0x4498a7=_0x5062('0x26');return db[_0x5062('0x52')]['find']({'where':{'name':_0x4498a7,'userProfileId':_0x241b9a[_0x5062('0x53')]},'raw':!![]})[_0x5062('0x24')](function(_0x2cc890){if(_0x2cc890&&_0x2cc890[_0x5062('0x54')]===0x0){return db['UserProfileResource'][_0x5062('0x4c')]({'name':_0xcb56a6[_0x5062('0x2a')],'resourceId':_0xcb56a6['id'],'type':_0x2cc890['name'],'sectionId':_0x2cc890['id']},{})[_0x5062('0x24')](function(){return _0x217084;});}else{return _0x217084;}})[_0x5062('0x49')](function(_0x3a1172){logger[_0x5062('0x28')](_0x5062('0x55'),_0x3a1172);throw _0x3a1172;});}return _0x217084;})[_0x5062('0x24')](respondWithResult(_0x1320fa,0xc9))[_0x5062('0x49')](handleError(_0x1320fa,null));};exports[_0x5062('0x56')]=function(_0x15f69e,_0x4bf9ce){var _0x2eb92c={'where':{'id':_0x15f69e['params']['id']}},_0x347914={};_0x347914[_0x5062('0x31')]=_[_0x5062('0x34')](db[_0x5062('0x47')][_0x5062('0x2d')]);_0x2eb92c[_0x5062('0x37')]=_['intersection'](_0x347914['model'],qs['fields'](_0x15f69e[_0x5062('0x33')]['fields']));_0x2eb92c[_0x5062('0x37')]=_0x2eb92c[_0x5062('0x37')]['length']?_0x2eb92c[_0x5062('0x37')]:_0x347914[_0x5062('0x31')];if(_0x15f69e[_0x5062('0x33')]['includeAll']){_0x2eb92c[_0x5062('0x46')]=[{'all':!![]}];}_0x2eb92c=_[_0x5062('0x41')]({},_0x2eb92c,_0x15f69e[_0x5062('0x43')]);return db['Campaign'][_0x5062('0x4b')](_0x2eb92c)[_0x5062('0x24')](handleEntityNotFound(_0x4bf9ce,null))[_0x5062('0x24')](function(_0x4a7068){if(_0x4a7068){var _0x3f5300=_0x4a7068[_0x5062('0x4f')]({'plain':!![]});_0x3f5300=qs[_0x5062('0x57')](_0x3f5300,['id',_0x5062('0x58'),_0x5062('0x59')]);_0x15f69e[_0x5062('0x4d')]=_[_0x5062('0x57')](_0x15f69e['body'],['id',_0x5062('0x58'),_0x5062('0x59')]);return db[_0x5062('0x47')][_0x5062('0x4c')](_[_0x5062('0x41')](_0x3f5300,_0x15f69e[_0x5062('0x4d')]),{'include':_0x15f69e['query'][_0x5062('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x351132){var _0x43512a=_0x15f69e[_0x5062('0x4e')][_0x5062('0x4f')]({'plain':!![]});if(!_0x43512a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43512a[_0x5062('0x51')]==='user'){var _0x479754=_0x351132[_0x5062('0x4f')]({'plain':!![]});var _0x1d89df=_0x5062('0x26');return db[_0x5062('0x52')][_0x5062('0x4b')]({'where':{'name':_0x1d89df,'userProfileId':_0x43512a['userProfileId']},'raw':!![]})[_0x5062('0x24')](function(_0x560680){if(_0x560680&&_0x560680[_0x5062('0x54')]===0x0){return db[_0x5062('0x27')][_0x5062('0x4c')]({'name':_0x479754[_0x5062('0x2a')],'resourceId':_0x479754['id'],'type':_0x560680[_0x5062('0x2a')],'sectionId':_0x560680['id']},{})[_0x5062('0x24')](function(){return _0x351132;});}else{return _0x351132;}})['catch'](function(_0x41982f){logger[_0x5062('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41982f);throw _0x41982f;});}return _0x351132;});}})['then'](respondWithResult(_0x4bf9ce,0xc9))[_0x5062('0x49')](handleError(_0x4bf9ce,null));};exports[_0x5062('0x5a')]=function(_0x2df61f,_0x5dace8){if(_0x2df61f[_0x5062('0x4d')]['id']){delete _0x2df61f[_0x5062('0x4d')]['id'];}return db[_0x5062('0x47')][_0x5062('0x4b')]({'where':{'id':_0x2df61f[_0x5062('0x4a')]['id']}})[_0x5062('0x24')](handleEntityNotFound(_0x5dace8,null))[_0x5062('0x24')](saveUpdates(_0x2df61f[_0x5062('0x4d')],null))['then'](respondWithResult(_0x5dace8,null))['catch'](handleError(_0x5dace8,null));};exports[_0x5062('0x25')]=function(_0x3f10c8,_0x45bff6){return db['Campaign']['find']({'where':{'id':_0x3f10c8['params']['id']}})[_0x5062('0x24')](handleEntityNotFound(_0x45bff6,null))[_0x5062('0x24')](removeEntity(_0x45bff6,null))['catch'](handleError(_0x45bff6,null));};exports[_0x5062('0x5b')]=function(_0x1e5aff,_0x2dd265,_0x237386){var _0x198ac8={'raw':!![],'where':{}};var _0x5a9b58={};var _0x58805f={'count':0x0,'rows':[]};return db[_0x5062('0x47')][_0x5062('0x5c')]({'where':{'id':_0x1e5aff['params']['id']}})[_0x5062('0x24')](handleEntityNotFound(_0x2dd265,null))[_0x5062('0x24')](function(_0x16bfdc){if(_0x16bfdc){_0x5a9b58[_0x5062('0x31')]=_[_0x5062('0x34')](db['CmHopper'][_0x5062('0x2d')]);_0x5a9b58['query']=_[_0x5062('0x34')](_0x1e5aff[_0x5062('0x33')]);_0x5a9b58['filters']=_['intersection'](_0x5a9b58[_0x5062('0x31')],_0x5a9b58[_0x5062('0x33')]);_0x198ac8['attributes']=_[_0x5062('0x35')](_0x5a9b58[_0x5062('0x31')],qs['fields'](_0x1e5aff[_0x5062('0x33')][_0x5062('0x36')]));_0x198ac8['attributes']=_0x198ac8[_0x5062('0x37')][_0x5062('0x38')]?_0x198ac8[_0x5062('0x37')]:_0x5a9b58[_0x5062('0x31')];if(!_0x1e5aff[_0x5062('0x33')][_0x5062('0x39')](_0x5062('0x5d'))){_0x198ac8[_0x5062('0x3a')]=qs[_0x5062('0x3a')](_0x1e5aff[_0x5062('0x33')][_0x5062('0x3a')]);_0x198ac8[_0x5062('0x3b')]=qs['offset'](_0x1e5aff[_0x5062('0x33')][_0x5062('0x3b')]);}_0x198ac8['order']=qs[_0x5062('0x3c')](_0x1e5aff[_0x5062('0x33')]['sort']);_0x198ac8[_0x5062('0x3d')]=qs['filters'](_['pick'](_0x1e5aff[_0x5062('0x33')],_0x5a9b58[_0x5062('0x3e')]));_0x198ac8[_0x5062('0x3d')]['CampaignId']=_0x16bfdc['id'];if(_0x1e5aff['query'][_0x5062('0x40')]){_0x198ac8[_0x5062('0x3d')]=_[_0x5062('0x41')](_0x198ac8[_0x5062('0x3d')],{'$or':_[_0x5062('0x32')](_0x198ac8[_0x5062('0x37')],function(_0x109d9d){var _0x352c11={};_0x352c11[_0x109d9d]={'$like':'%'+_0x1e5aff[_0x5062('0x33')][_0x5062('0x40')]+'%'};return _0x352c11;})});}_0x198ac8=_['merge']({},_0x198ac8,_0x1e5aff['options']);return db['CmHopper'][_0x5062('0x44')]({'where':_0x198ac8[_0x5062('0x3d')]})['then'](function(_0x14d2f1){_0x58805f[_0x5062('0x44')]=_0x14d2f1;if(_0x1e5aff[_0x5062('0x33')][_0x5062('0x45')]){_0x198ac8[_0x5062('0x46')]=[{'all':!![]}];}return db['CmHopper'][_0x5062('0x48')](_0x198ac8);})['then'](function(_0xfbb902){_0x58805f['rows']=_0xfbb902;return _0x58805f;});}})[_0x5062('0x24')](respondWithFilteredResult(_0x2dd265,_0x198ac8))[_0x5062('0x49')](handleError(_0x2dd265,null));};exports['getHopperHistories']=function(_0x123e4d,_0x3d52b5,_0x3a8bba){var _0x2b9788={'raw':!![],'where':{}};var _0x5c0f63={};var _0x37d150={'count':0x0,'rows':[]};return db[_0x5062('0x47')][_0x5062('0x5c')]({'where':{'id':_0x123e4d['params']['id']}})[_0x5062('0x24')](handleEntityNotFound(_0x3d52b5,null))[_0x5062('0x24')](function(_0x45b935){if(_0x45b935){_0x5c0f63[_0x5062('0x31')]=_['keys'](db[_0x5062('0x5e')][_0x5062('0x2d')]);_0x5c0f63[_0x5062('0x33')]=_[_0x5062('0x34')](_0x123e4d['query']);_0x5c0f63[_0x5062('0x3e')]=_[_0x5062('0x35')](_0x5c0f63[_0x5062('0x31')],_0x5c0f63['query']);_0x2b9788[_0x5062('0x37')]=_[_0x5062('0x35')](_0x5c0f63[_0x5062('0x31')],qs[_0x5062('0x36')](_0x123e4d[_0x5062('0x33')]['fields']));_0x2b9788['attributes']=_0x2b9788['attributes'][_0x5062('0x38')]?_0x2b9788['attributes']:_0x5c0f63[_0x5062('0x31')];if(!_0x123e4d[_0x5062('0x33')]['hasOwnProperty']('nolimit')){_0x2b9788[_0x5062('0x3a')]=qs['limit'](_0x123e4d['query'][_0x5062('0x3a')]);_0x2b9788[_0x5062('0x3b')]=qs[_0x5062('0x3b')](_0x123e4d['query']['offset']);}_0x2b9788[_0x5062('0x5f')]=qs[_0x5062('0x3c')](_0x123e4d[_0x5062('0x33')]['sort']);_0x2b9788[_0x5062('0x3d')]=qs[_0x5062('0x3e')](_['pick'](_0x123e4d[_0x5062('0x33')],_0x5c0f63[_0x5062('0x3e')]));_0x2b9788[_0x5062('0x3d')]['CampaignId']=_0x45b935['id'];if(_0x123e4d['query'][_0x5062('0x40')]){_0x2b9788['where']=_['merge'](_0x2b9788[_0x5062('0x3d')],{'$or':_[_0x5062('0x32')](_0x2b9788[_0x5062('0x37')],function(_0x3f9eee){var _0x8394b6={};_0x8394b6[_0x3f9eee]={'$like':'%'+_0x123e4d['query'][_0x5062('0x40')]+'%'};return _0x8394b6;})});}_0x2b9788=_[_0x5062('0x41')]({},_0x2b9788,_0x123e4d[_0x5062('0x43')]);return db[_0x5062('0x5e')][_0x5062('0x44')]({'where':_0x2b9788[_0x5062('0x3d')]})[_0x5062('0x24')](function(_0x19441b){_0x37d150[_0x5062('0x44')]=_0x19441b;if(_0x123e4d['query'][_0x5062('0x45')]){_0x2b9788[_0x5062('0x46')]=[{'all':!![]}];}return db[_0x5062('0x5e')][_0x5062('0x48')](_0x2b9788);})[_0x5062('0x24')](function(_0x2e4dfd){_0x37d150[_0x5062('0x60')]=_0x2e4dfd;return _0x37d150;});}})[_0x5062('0x24')](respondWithFilteredResult(_0x3d52b5,_0x2b9788))['catch'](handleError(_0x3d52b5,null));};exports['getHopperFinals']=function(_0x5a5f0b,_0x1bffdd,_0x1d01b2){var _0x545e65={'raw':!![],'where':{}};var _0xf42a6f={};var _0x139504={'count':0x0,'rows':[]};return db['Campaign'][_0x5062('0x5c')]({'where':{'id':_0x5a5f0b['params']['id']}})['then'](handleEntityNotFound(_0x1bffdd,null))[_0x5062('0x24')](function(_0x347da0){if(_0x347da0){_0xf42a6f[_0x5062('0x31')]=_[_0x5062('0x34')](db[_0x5062('0x61')]['rawAttributes']);_0xf42a6f[_0x5062('0x33')]=_[_0x5062('0x34')](_0x5a5f0b[_0x5062('0x33')]);_0xf42a6f[_0x5062('0x3e')]=_[_0x5062('0x35')](_0xf42a6f[_0x5062('0x31')],_0xf42a6f[_0x5062('0x33')]);_0x545e65['attributes']=_[_0x5062('0x35')](_0xf42a6f[_0x5062('0x31')],qs['fields'](_0x5a5f0b[_0x5062('0x33')][_0x5062('0x36')]));_0x545e65[_0x5062('0x37')]=_0x545e65[_0x5062('0x37')]['length']?_0x545e65[_0x5062('0x37')]:_0xf42a6f['model'];if(!_0x5a5f0b['query'][_0x5062('0x39')](_0x5062('0x5d'))){_0x545e65[_0x5062('0x3a')]=qs[_0x5062('0x3a')](_0x5a5f0b[_0x5062('0x33')][_0x5062('0x3a')]);_0x545e65[_0x5062('0x3b')]=qs[_0x5062('0x3b')](_0x5a5f0b['query'][_0x5062('0x3b')]);}_0x545e65[_0x5062('0x5f')]=qs[_0x5062('0x3c')](_0x5a5f0b[_0x5062('0x33')]['sort']);_0x545e65[_0x5062('0x3d')]=qs['filters'](_[_0x5062('0x3f')](_0x5a5f0b[_0x5062('0x33')],_0xf42a6f[_0x5062('0x3e')]));_0x545e65[_0x5062('0x3d')][_0x5062('0x62')]=_0x347da0['id'];if(_0x5a5f0b['query'][_0x5062('0x40')]){_0x545e65[_0x5062('0x3d')]=_[_0x5062('0x41')](_0x545e65[_0x5062('0x3d')],{'$or':_[_0x5062('0x32')](_0x545e65[_0x5062('0x37')],function(_0x2a7208){var _0x44cc56={};_0x44cc56[_0x2a7208]={'$like':'%'+_0x5a5f0b['query'][_0x5062('0x40')]+'%'};return _0x44cc56;})});}_0x545e65=_[_0x5062('0x41')]({},_0x545e65,_0x5a5f0b['options']);return db[_0x5062('0x61')]['count']({'where':_0x545e65[_0x5062('0x3d')]})['then'](function(_0x3b9a7a){_0x139504['count']=_0x3b9a7a;if(_0x5a5f0b[_0x5062('0x33')]['includeAll']){_0x545e65[_0x5062('0x46')]=[{'all':!![]}];}return db[_0x5062('0x61')][_0x5062('0x48')](_0x545e65);})['then'](function(_0x166b29){_0x139504[_0x5062('0x60')]=_0x166b29;return _0x139504;});}})[_0x5062('0x24')](respondWithFilteredResult(_0x1bffdd,_0x545e65))[_0x5062('0x49')](handleError(_0x1bffdd,null));};exports['getHopperBlacks']=function(_0x1d6b06,_0x210000,_0x51ba76){var _0x6422a0={'raw':!![],'where':{}};var _0x4e2c42={};var _0x47378a={'count':0x0,'rows':[]};return db[_0x5062('0x47')][_0x5062('0x5c')]({'where':{'id':_0x1d6b06[_0x5062('0x4a')]['id']}})[_0x5062('0x24')](handleEntityNotFound(_0x210000,null))['then'](function(_0x3c18e7){if(_0x3c18e7){_0x4e2c42[_0x5062('0x31')]=_[_0x5062('0x34')](db['CmHopperBlack']['rawAttributes']);_0x4e2c42[_0x5062('0x33')]=_[_0x5062('0x34')](_0x1d6b06[_0x5062('0x33')]);_0x4e2c42[_0x5062('0x3e')]=_['intersection'](_0x4e2c42['model'],_0x4e2c42['query']);_0x6422a0[_0x5062('0x37')]=_[_0x5062('0x35')](_0x4e2c42[_0x5062('0x31')],qs[_0x5062('0x36')](_0x1d6b06[_0x5062('0x33')][_0x5062('0x36')]));_0x6422a0[_0x5062('0x37')]=_0x6422a0['attributes'][_0x5062('0x38')]?_0x6422a0['attributes']:_0x4e2c42[_0x5062('0x31')];if(!_0x1d6b06['query']['hasOwnProperty'](_0x5062('0x5d'))){_0x6422a0[_0x5062('0x3a')]=qs[_0x5062('0x3a')](_0x1d6b06[_0x5062('0x33')][_0x5062('0x3a')]);_0x6422a0[_0x5062('0x3b')]=qs[_0x5062('0x3b')](_0x1d6b06[_0x5062('0x33')]['offset']);}_0x6422a0[_0x5062('0x5f')]=qs[_0x5062('0x3c')](_0x1d6b06['query'][_0x5062('0x3c')]);_0x6422a0[_0x5062('0x3d')]=qs[_0x5062('0x3e')](_[_0x5062('0x3f')](_0x1d6b06[_0x5062('0x33')],_0x4e2c42[_0x5062('0x3e')]));_0x6422a0[_0x5062('0x3d')]['CampaignId']=_0x3c18e7['id'];if(_0x1d6b06[_0x5062('0x33')]['filter']){_0x6422a0[_0x5062('0x3d')]=_[_0x5062('0x41')](_0x6422a0[_0x5062('0x3d')],{'$or':_[_0x5062('0x32')](_0x6422a0[_0x5062('0x37')],function(_0x3b8c23){var _0x4f413e={};_0x4f413e[_0x3b8c23]={'$like':'%'+_0x1d6b06['query'][_0x5062('0x40')]+'%'};return _0x4f413e;})});}_0x6422a0=_['merge']({},_0x6422a0,_0x1d6b06[_0x5062('0x43')]);return db[_0x5062('0x63')]['count']({'where':_0x6422a0[_0x5062('0x3d')]})[_0x5062('0x24')](function(_0x794d42){_0x47378a[_0x5062('0x44')]=_0x794d42;if(_0x1d6b06[_0x5062('0x33')]['includeAll']){_0x6422a0[_0x5062('0x46')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x6422a0);})[_0x5062('0x24')](function(_0x1a5d40){_0x47378a[_0x5062('0x60')]=_0x1a5d40;return _0x47378a;});}})[_0x5062('0x24')](respondWithFilteredResult(_0x210000,_0x6422a0))[_0x5062('0x49')](handleError(_0x210000,null));};exports[_0x5062('0x64')]=function(_0x2ea113,_0x372761,_0xa06aec){var _0x24bd1d={};var _0x204ae3={};var _0x494eab;var _0x380c3c;return db[_0x5062('0x47')][_0x5062('0x5c')]({'where':{'id':_0x2ea113['params']['id']}})[_0x5062('0x24')](handleEntityNotFound(_0x372761,null))[_0x5062('0x24')](function(_0x1cdb94){if(_0x1cdb94){_0x494eab=_0x1cdb94;_0x204ae3[_0x5062('0x31')]=_[_0x5062('0x34')](db[_0x5062('0x65')]['rawAttributes']);_0x204ae3[_0x5062('0x33')]=_['keys'](_0x2ea113['query']);_0x204ae3[_0x5062('0x3e')]=_['intersection'](_0x204ae3['model'],_0x204ae3[_0x5062('0x33')]);_0x24bd1d[_0x5062('0x37')]=_[_0x5062('0x35')](_0x204ae3['model'],qs[_0x5062('0x36')](_0x2ea113['query'][_0x5062('0x36')]));_0x24bd1d[_0x5062('0x37')]=_0x24bd1d[_0x5062('0x37')][_0x5062('0x38')]?_0x24bd1d[_0x5062('0x37')]:_0x204ae3[_0x5062('0x31')];_0x24bd1d[_0x5062('0x5f')]=qs[_0x5062('0x3c')](_0x2ea113[_0x5062('0x33')][_0x5062('0x3c')]);_0x24bd1d[_0x5062('0x3d')]=qs[_0x5062('0x3e')](_[_0x5062('0x3f')](_0x2ea113[_0x5062('0x33')],_0x204ae3[_0x5062('0x3e')]));if(_0x2ea113[_0x5062('0x33')][_0x5062('0x40')]){_0x24bd1d['where']=_[_0x5062('0x41')](_0x24bd1d[_0x5062('0x3d')],{'$or':_['map'](_0x24bd1d[_0x5062('0x37')],function(_0x4a0dc5){var _0x36b222={};_0x36b222[_0x4a0dc5]={'$like':'%'+_0x2ea113[_0x5062('0x33')]['filter']+'%'};return _0x36b222;})});}_0x24bd1d=_['merge']({},_0x24bd1d,_0x2ea113[_0x5062('0x43')]);return _0x494eab[_0x5062('0x64')](_0x24bd1d);}})[_0x5062('0x24')](function(_0x5b11d2){if(_0x5b11d2){_0x380c3c=_0x5b11d2['length'];if(!_0x2ea113['query']['hasOwnProperty'](_0x5062('0x5d'))){_0x24bd1d[_0x5062('0x3a')]=qs[_0x5062('0x3a')](_0x2ea113[_0x5062('0x33')][_0x5062('0x3a')]);_0x24bd1d[_0x5062('0x3b')]=qs[_0x5062('0x3b')](_0x2ea113[_0x5062('0x33')][_0x5062('0x3b')]);}return _0x494eab[_0x5062('0x64')](_0x24bd1d);}})[_0x5062('0x24')](function(_0x417054){if(_0x417054){return _0x417054?{'count':_0x380c3c,'rows':_0x417054}:null;}})['then'](respondWithResult(_0x372761,null))['catch'](handleError(_0x372761,null));};exports[_0x5062('0x66')]=function(_0x2b1762,_0x4ef0f0,_0x12e077){var _0x1de03d,_0x32576b;return db['Campaign']['find']({'where':{'id':_0x2b1762[_0x5062('0x4a')]['id']}})[_0x5062('0x24')](handleEntityNotFound(_0x4ef0f0,null))[_0x5062('0x24')](function(_0x1e60ca){if(_0x1e60ca){_0x32576b=_0x1e60ca;return _0x1e60ca[_0x5062('0x66')](_0x2b1762[_0x5062('0x4d')][_0x5062('0x67')],_[_0x5062('0x57')](_0x2b1762[_0x5062('0x4d')],[_0x5062('0x67'),'id'])||{});}return null;})[_0x5062('0x68')](function(_0x3bee7b){var _0x185368;_0x1de03d=_0x3bee7b||[];var _0x31bcac=[];if(_0x3bee7b){for(var _0x4fd833=0x0;_0x4fd833<_0x3bee7b['length'];_0x4fd833+=0x1){var _0xf8903e=_0x3bee7b[_0x4fd833][_0x5062('0x4f')]({'plain':!![]});_0x32576b[_0x5062('0x69')]=_0x2b1762[_0x5062('0x4d')][_0x5062('0x69')]?_0x2b1762['body'][_0x5062('0x69')]:_0x32576b['dialCheckDuplicateType'];switch(_0x32576b[_0x5062('0x69')]){case _0x5062('0x6a'):_0x185368=squel[_0x5062('0x6b')]()['into'](_0x5062('0x6c'))[_0x5062('0x6d')]([_0x5062('0x6e'),_0x5062('0x6f'),_0x5062('0x70'),_0x5062('0x71'),_0x5062('0x62'),'createdAt',_0x5062('0x59')],squel[_0x5062('0x72')]()[_0x5062('0x73')](_0x5062('0x6e'),_0x5062('0x6e'))[_0x5062('0x73')](_0x5062('0x74'),'scheduledAt')[_0x5062('0x73')]('id',_0x5062('0x70'))[_0x5062('0x73')](_0xf8903e['CmListId']['toString'](),'ListId')[_0x5062('0x73')](_0x2b1762[_0x5062('0x4a')]['id'][_0x5062('0x75')](),_0x5062('0x62'))[_0x5062('0x73')](_0x5062('0x74'),_0x5062('0x58'))[_0x5062('0x73')](_0x5062('0x74'),_0x5062('0x59'))[_0x5062('0x76')](_0x5062('0x77'))[_0x5062('0x3d')]('deletedAt\x20IS\x20NULL')[_0x5062('0x3d')](_0x5062('0x78'),_0xf8903e[_0x5062('0x79')][_0x5062('0x75')]())[_0x5062('0x3d')](_0x5062('0x7a'))[_0x5062('0x3d')](_0x5062('0x7b'),squel['select']()[_0x5062('0x73')]('COALESCE(calleridnum,\x27\x27)')[_0x5062('0x76')](_0x5062('0x7c'))['where']('CampaignId\x20=\x20?',_0x2b1762['params']['id'][_0x5062('0x75')]()))[_0x5062('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5062('0x72')]()['field'](_0x5062('0x7d'))['from'](_0x5062('0x6c'))['where'](_0x5062('0x7e'),_0x2b1762['params']['id'][_0x5062('0x75')]())))['toString']();break;case _0x5062('0x7f'):_0x185368=squel[_0x5062('0x6b')]()[_0x5062('0x80')](_0x5062('0x6c'))['fromQuery'](['phone',_0x5062('0x6f'),'ContactId','ListId',_0x5062('0x62'),_0x5062('0x58'),_0x5062('0x59')],squel[_0x5062('0x72')]()[_0x5062('0x73')]('phone',_0x5062('0x6e'))[_0x5062('0x73')](_0x5062('0x74'),'scheduledAt')[_0x5062('0x73')]('id',_0x5062('0x70'))[_0x5062('0x73')](_0xf8903e['CmListId'][_0x5062('0x75')](),_0x5062('0x71'))['field'](_0x2b1762[_0x5062('0x4a')]['id'][_0x5062('0x75')](),_0x5062('0x62'))[_0x5062('0x73')](_0x5062('0x74'),_0x5062('0x58'))[_0x5062('0x73')](_0x5062('0x74'),_0x5062('0x59'))[_0x5062('0x76')](_0x5062('0x77'))[_0x5062('0x3d')](_0x5062('0x81'))['where'](_0x5062('0x78'),_0xf8903e[_0x5062('0x79')]['toString']())[_0x5062('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x5062('0x7b'),squel['select']()[_0x5062('0x73')](_0x5062('0x7d'))[_0x5062('0x76')](_0x5062('0x6c'))[_0x5062('0x3d')](_0x5062('0x7e'),_0x2b1762[_0x5062('0x4a')]['id']['toString']())))[_0x5062('0x75')]();break;default:_0x185368=squel[_0x5062('0x6b')]()[_0x5062('0x80')](_0x5062('0x6c'))[_0x5062('0x6d')](['phone',_0x5062('0x6f'),_0x5062('0x70'),'ListId',_0x5062('0x62'),_0x5062('0x58'),_0x5062('0x59')],squel[_0x5062('0x72')]()[_0x5062('0x73')](_0x5062('0x6e'),_0x5062('0x6e'))[_0x5062('0x73')](_0x5062('0x74'),_0x5062('0x6f'))['field']('id',_0x5062('0x70'))['field'](_0xf8903e[_0x5062('0x79')][_0x5062('0x75')](),_0x5062('0x71'))['field'](_0x2b1762[_0x5062('0x4a')]['id'][_0x5062('0x75')](),_0x5062('0x62'))[_0x5062('0x73')](_0x5062('0x74'),_0x5062('0x58'))[_0x5062('0x73')]('NOW()',_0x5062('0x59'))[_0x5062('0x76')](_0x5062('0x77'))[_0x5062('0x3d')](_0x5062('0x81'))[_0x5062('0x3d')]('ListId\x20=\x20?',_0xf8903e['CmListId'][_0x5062('0x75')]())[_0x5062('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x5062('0x75')]();}_0x31bcac[_0x5062('0x82')](db['sequelize'][_0x5062('0x33')](_0x185368));}return BPromise[_0x5062('0x83')](_0x31bcac);}})[_0x5062('0x24')](function(){return _0x1de03d;})['then'](respondWithResult(_0x4ef0f0,null))[_0x5062('0x49')](handleError(_0x4ef0f0,null));};exports['removeLists']=function(_0x183a77,_0x4a4b70,_0x52ccf8){return db[_0x5062('0x47')][_0x5062('0x4b')]({'where':{'id':_0x183a77[_0x5062('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a4b70,null))[_0x5062('0x24')](function(_0x370a1a){if(_0x370a1a){return _0x370a1a[_0x5062('0x84')](_0x183a77[_0x5062('0x33')][_0x5062('0x67')]);}})[_0x5062('0x24')](function(_0x2bff33){if(_0x2bff33){return db[_0x5062('0x85')][_0x5062('0x25')]({'where':{'ListId':_0x183a77[_0x5062('0x33')]['ids'],'CampaignId':_0x183a77[_0x5062('0x4a')]['id']}})['then'](function(){return _0x2bff33;});}})[_0x5062('0x24')](respondWithStatusCode(_0x4a4b70,null))[_0x5062('0x49')](handleError(_0x4a4b70,null));};exports[_0x5062('0x86')]=function(_0x4d594e,_0x8a4c36,_0x1fd845){var _0x45b096={'raw':!![],'where':{}};var _0x59a73c={};var _0x205860={'count':0x0,'rows':[]};return db[_0x5062('0x47')][_0x5062('0x5c')]({'where':{'id':_0x4d594e['params']['id']}})[_0x5062('0x24')](handleEntityNotFound(_0x8a4c36,null))[_0x5062('0x24')](function(_0x5b7eb8){if(_0x5b7eb8){_0x59a73c['model']=_[_0x5062('0x34')](db[_0x5062('0x65')][_0x5062('0x2d')]);_0x59a73c[_0x5062('0x33')]=_[_0x5062('0x34')](_0x4d594e[_0x5062('0x33')]);_0x59a73c['filters']=_['intersection'](_0x59a73c[_0x5062('0x31')],_0x59a73c[_0x5062('0x33')]);_0x45b096[_0x5062('0x37')]=_[_0x5062('0x35')](_0x59a73c[_0x5062('0x31')],qs[_0x5062('0x36')](_0x4d594e['query'][_0x5062('0x36')]));_0x45b096[_0x5062('0x37')]=_0x45b096['attributes'][_0x5062('0x38')]?_0x45b096[_0x5062('0x37')]:_0x59a73c['model'];if(!_0x4d594e['query'][_0x5062('0x39')](_0x5062('0x5d'))){_0x45b096[_0x5062('0x3a')]=qs['limit'](_0x4d594e[_0x5062('0x33')][_0x5062('0x3a')]);_0x45b096[_0x5062('0x3b')]=qs[_0x5062('0x3b')](_0x4d594e[_0x5062('0x33')][_0x5062('0x3b')]);}_0x45b096[_0x5062('0x5f')]=qs[_0x5062('0x3c')](_0x4d594e[_0x5062('0x33')][_0x5062('0x3c')]);_0x45b096[_0x5062('0x3d')]=qs['filters'](_[_0x5062('0x3f')](_0x4d594e[_0x5062('0x33')],_0x59a73c['filters']));_0x45b096[_0x5062('0x3d')][_0x5062('0x62')]=_0x5b7eb8['id'];if(_0x4d594e[_0x5062('0x33')]['filter']){_0x45b096[_0x5062('0x3d')]=_[_0x5062('0x41')](_0x45b096[_0x5062('0x3d')],{'$or':_[_0x5062('0x32')](_0x45b096[_0x5062('0x37')],function(_0x305823){var _0x31e4c1={};_0x31e4c1[_0x305823]={'$like':'%'+_0x4d594e['query'][_0x5062('0x40')]+'%'};return _0x31e4c1;})});}_0x45b096=_['merge']({},_0x45b096,_0x4d594e[_0x5062('0x43')]);return db['CmList'][_0x5062('0x44')]({'where':_0x45b096[_0x5062('0x3d')]})[_0x5062('0x24')](function(_0x4c34fe){_0x205860[_0x5062('0x44')]=_0x4c34fe;if(_0x4d594e[_0x5062('0x33')][_0x5062('0x45')]){_0x45b096[_0x5062('0x46')]=[{'all':!![]}];}return db['CmList'][_0x5062('0x48')](_0x45b096);})[_0x5062('0x24')](function(_0x4d8dd8){_0x205860[_0x5062('0x60')]=_0x4d8dd8;return _0x205860;});}})['then'](respondWithFilteredResult(_0x8a4c36,_0x45b096))[_0x5062('0x49')](handleError(_0x8a4c36,null));};exports[_0x5062('0x87')]=function(_0x51d77b,_0xf26037,_0x4f063b){var _0x36ca22,_0x264663;return db[_0x5062('0x47')][_0x5062('0x4b')]({'where':{'id':_0x51d77b[_0x5062('0x4a')]['id']}})[_0x5062('0x24')](handleEntityNotFound(_0xf26037,null))[_0x5062('0x24')](function(_0x405953){if(_0x405953){_0x264663=_0x405953;return _0x405953['addBlackLists'](_0x51d77b[_0x5062('0x4d')][_0x5062('0x67')],_[_0x5062('0x57')](_0x51d77b['body'],[_0x5062('0x67'),'id'])||{});}return null;})[_0x5062('0x68')](function(_0x2bc89d){var _0x53b70c;_0x36ca22=_0x2bc89d||[];var _0x104722=[];if(_0x2bc89d){for(var _0x112f5a=0x0;_0x112f5a<_0x2bc89d[_0x5062('0x38')];_0x112f5a+=0x1){var _0x1a9adc=_0x2bc89d[_0x112f5a][_0x5062('0x4f')]({'plain':!![]});_0x53b70c=squel['insert']()[_0x5062('0x80')](_0x5062('0x88'))[_0x5062('0x6d')]([_0x5062('0x6e'),_0x5062('0x70'),_0x5062('0x71'),_0x5062('0x62'),_0x5062('0x58'),_0x5062('0x59')],squel['select']()['field'](_0x5062('0x6e'),_0x5062('0x6e'))[_0x5062('0x73')]('id','ContactId')[_0x5062('0x73')](_0x1a9adc[_0x5062('0x79')]['toString'](),_0x5062('0x71'))[_0x5062('0x73')](_0x51d77b[_0x5062('0x4a')]['id'][_0x5062('0x75')](),_0x5062('0x62'))[_0x5062('0x73')](_0x5062('0x74'),'createdAt')[_0x5062('0x73')](_0x5062('0x74'),_0x5062('0x59'))[_0x5062('0x76')](_0x5062('0x77'))[_0x5062('0x3d')](_0x5062('0x81'))[_0x5062('0x3d')]('ListId\x20=\x20?',_0x1a9adc[_0x5062('0x79')][_0x5062('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x5062('0x75')]();_0x104722['push'](db[_0x5062('0x89')][_0x5062('0x33')](_0x53b70c));}return BPromise[_0x5062('0x83')](_0x104722);}})[_0x5062('0x24')](function(){return _0x36ca22;})[_0x5062('0x24')](respondWithResult(_0xf26037,null))[_0x5062('0x49')](handleError(_0xf26037,null));};exports['removeBlackLists']=function(_0x1f62c8,_0x28cb49,_0x495e82){return db[_0x5062('0x47')]['find']({'where':{'id':_0x1f62c8['params']['id']}})[_0x5062('0x24')](handleEntityNotFound(_0x28cb49,null))[_0x5062('0x24')](function(_0x3d1758){if(_0x3d1758){return _0x3d1758[_0x5062('0x8a')](_0x1f62c8['query']['ids']);}})[_0x5062('0x24')](function(_0x5a6ba9){if(_0x5a6ba9){return db[_0x5062('0x63')][_0x5062('0x25')]({'where':{'ListId':_0x1f62c8[_0x5062('0x33')][_0x5062('0x67')],'CampaignId':_0x1f62c8[_0x5062('0x4a')]['id']}})['then'](function(){return _0x5a6ba9;});}})[_0x5062('0x24')](respondWithStatusCode(_0x28cb49,null))['catch'](handleError(_0x28cb49,null));}; \ No newline at end of file +var _0x4297=['UserProfileResource','destroy','error','stack','send','index','Campaign','rawAttributes','fieldName','key','model','map','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','role','getHoppers','findOne','CmHopper','order','sort','CampaignId','options','findAll','getHopperHistories','nolimit','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','select','field','NOW()','scheduledAt','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','ListId','push','all','CmList','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','update','then','get','IvrCampaigns'];(function(_0x3ec670,_0x3f50e5){var _0x159886=function(_0x329e16){while(--_0x329e16){_0x3ec670['push'](_0x3ec670['shift']());}};_0x159886(++_0x3f50e5);}(_0x4297,0xe2));var _0x7429=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x4297[_0x176329];return _0x31997c;};'use strict';var pdf=require(_0x7429('0x0'));var emlformat=require(_0x7429('0x1'));var rimraf=require(_0x7429('0x2'));var zipdir=require(_0x7429('0x3'));var jsonpatch=require(_0x7429('0x4'));var rp=require(_0x7429('0x5'));var moment=require(_0x7429('0x6'));var BPromise=require(_0x7429('0x7'));var Mustache=require('mustache');var util=require(_0x7429('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x7429('0x9'));var ejs=require(_0x7429('0xa'));var fs=require('fs');var _=require(_0x7429('0xb'));var squel=require(_0x7429('0xc'));var crypto=require(_0x7429('0xd'));var jsforce=require(_0x7429('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7429('0x9'));var querystring=require('querystring');var Papa=require(_0x7429('0xf'));var Redis=require(_0x7429('0x10'));var authService=require(_0x7429('0x11'));var qs=require(_0x7429('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7429('0x13'))(_0x7429('0x14'));var utils=require('../../config/utils');var config=require(_0x7429('0x15'));var db=require(_0x7429('0x16'))['db'];function respondWithStatusCode(_0x4738cc,_0x1c596c){_0x1c596c=_0x1c596c||0xcc;return function(_0x1cea0c){if(_0x1cea0c){return _0x4738cc[_0x7429('0x17')](_0x1c596c);}return _0x4738cc['status'](_0x1c596c)[_0x7429('0x18')]();};}function respondWithResult(_0x3b5af6,_0x3d0a67){_0x3d0a67=_0x3d0a67||0xc8;return function(_0x47635a){if(_0x47635a){return _0x3b5af6['status'](_0x3d0a67)[_0x7429('0x19')](_0x47635a);}};}function respondWithFilteredResult(_0x26afce,_0x257af9){return function(_0x4a014b){if(_0x4a014b){var _0x52d54c=_0x4a014b[_0x7429('0x1a')],_0x504993=_0x257af9[_0x7429('0x1b')],_0x2635ad=_0x257af9['offset']+_0x257af9[_0x7429('0x1c')],_0x445f01;if(_0x2635ad>=_0x52d54c){_0x2635ad=_0x52d54c;_0x445f01=0xc8;}else{_0x445f01=0xce;}_0x26afce[_0x7429('0x1d')](_0x445f01);return _0x26afce[_0x7429('0x1e')]('Content-Range',_0x504993+'-'+_0x2635ad+'/'+_0x52d54c)[_0x7429('0x19')](_0x4a014b);}return null;};}function patchUpdates(_0x25429e){return function(_0x2a204f){try{jsonpatch[_0x7429('0x1f')](_0x2a204f,_0x25429e,!![]);}catch(_0x4e6f14){return BPromise['reject'](_0x4e6f14);}return _0x2a204f['save']();};}function saveUpdates(_0x12f493,_0x249c9f){return function(_0x145f95){if(_0x145f95){return _0x145f95[_0x7429('0x20')](_0x12f493)[_0x7429('0x21')](function(_0x18d996){return _0x18d996;});}return null;};}function removeEntity(_0x5719f3,_0x21cb93){return function(_0x2ea036){if(_0x2ea036){return _0x2ea036['destroy']()[_0x7429('0x21')](function(){var _0x97ffca=_0x2ea036[_0x7429('0x22')]({'plain':!![]});var _0x216dbd=_0x7429('0x23');return db[_0x7429('0x24')][_0x7429('0x25')]({'where':{'type':_0x216dbd,'resourceId':_0x97ffca['id']}})[_0x7429('0x21')](function(){return _0x2ea036;});})[_0x7429('0x21')](function(){_0x5719f3[_0x7429('0x1d')](0xcc)[_0x7429('0x18')]();});}};}function handleEntityNotFound(_0x2665ca,_0x1d531b){return function(_0x428c6e){if(!_0x428c6e){_0x2665ca['sendStatus'](0x194);}return _0x428c6e;};}function handleError(_0x19088b,_0x29b644){_0x29b644=_0x29b644||0x1f4;return function(_0x17cff8){logger[_0x7429('0x26')](_0x17cff8[_0x7429('0x27')]);if(_0x17cff8['name']){delete _0x17cff8['name'];}_0x19088b[_0x7429('0x1d')](_0x29b644)[_0x7429('0x28')](_0x17cff8);};}exports[_0x7429('0x29')]=function(_0x5267b3,_0x19ff6f){var _0xc3d1aa={},_0xed0d44={},_0x571700={'count':0x0,'rows':[]};var _0x3d3fb1=_['map'](db[_0x7429('0x2a')][_0x7429('0x2b')],function(_0x31bd51){return{'name':_0x31bd51[_0x7429('0x2c')],'type':_0x31bd51['type'][_0x7429('0x2d')]};});_0xed0d44[_0x7429('0x2e')]=_[_0x7429('0x2f')](_0x3d3fb1,_0x7429('0x30'));_0xed0d44['query']=_[_0x7429('0x31')](_0x5267b3[_0x7429('0x32')]);_0xed0d44[_0x7429('0x33')]=_[_0x7429('0x34')](_0xed0d44[_0x7429('0x2e')],_0xed0d44['query']);_0xc3d1aa['attributes']=_[_0x7429('0x34')](_0xed0d44[_0x7429('0x2e')],qs['fields'](_0x5267b3['query'][_0x7429('0x35')]));_0xc3d1aa['attributes']=_0xc3d1aa[_0x7429('0x36')][_0x7429('0x37')]?_0xc3d1aa[_0x7429('0x36')]:_0xed0d44['model'];if(!_0x5267b3[_0x7429('0x32')][_0x7429('0x38')]('nolimit')){_0xc3d1aa[_0x7429('0x1c')]=qs[_0x7429('0x1c')](_0x5267b3[_0x7429('0x32')]['limit']);_0xc3d1aa[_0x7429('0x1b')]=qs[_0x7429('0x1b')](_0x5267b3[_0x7429('0x32')][_0x7429('0x1b')]);}_0xc3d1aa['order']=qs['sort'](_0x5267b3[_0x7429('0x32')]['sort']);_0xc3d1aa[_0x7429('0x39')]=qs['filters'](_[_0x7429('0x3a')](_0x5267b3[_0x7429('0x32')],_0xed0d44[_0x7429('0x33')]),_0x3d3fb1);if(_0x5267b3[_0x7429('0x32')][_0x7429('0x3b')]){_0xc3d1aa[_0x7429('0x39')]=_[_0x7429('0x3c')](_0xc3d1aa[_0x7429('0x39')],{'$or':_[_0x7429('0x2f')](_0x3d3fb1,function(_0x2d38c3){if(_0x2d38c3[_0x7429('0x3d')]!==_0x7429('0x3e')){var _0x43e644={};_0x43e644[_0x2d38c3[_0x7429('0x30')]]={'$like':'%'+_0x5267b3[_0x7429('0x32')][_0x7429('0x3b')]+'%'};return _0x43e644;}})});}_0xc3d1aa=_[_0x7429('0x3c')]({},_0xc3d1aa,_0x5267b3['options']);var _0x337dc4={'where':_0xc3d1aa['where']};return db['Campaign'][_0x7429('0x1a')](_0x337dc4)[_0x7429('0x21')](function(_0x797808){_0x571700[_0x7429('0x1a')]=_0x797808;if(_0x5267b3[_0x7429('0x32')][_0x7429('0x3f')]){_0xc3d1aa[_0x7429('0x40')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0xc3d1aa);})[_0x7429('0x21')](function(_0x189877){_0x571700[_0x7429('0x41')]=_0x189877;return _0x571700;})['then'](respondWithFilteredResult(_0x19ff6f,_0xc3d1aa))[_0x7429('0x42')](handleError(_0x19ff6f,null));};exports[_0x7429('0x43')]=function(_0x6d7b73,_0x4ab76c){var _0x17b8f9={'raw':![],'where':{'id':_0x6d7b73['params']['id']}},_0x48989e={};_0x48989e[_0x7429('0x2e')]=_[_0x7429('0x31')](db[_0x7429('0x2a')]['rawAttributes']);_0x48989e[_0x7429('0x32')]=_[_0x7429('0x31')](_0x6d7b73['query']);_0x48989e[_0x7429('0x33')]=_[_0x7429('0x34')](_0x48989e[_0x7429('0x2e')],_0x48989e['query']);_0x17b8f9[_0x7429('0x36')]=_['intersection'](_0x48989e['model'],qs[_0x7429('0x35')](_0x6d7b73[_0x7429('0x32')][_0x7429('0x35')]));_0x17b8f9[_0x7429('0x36')]=_0x17b8f9[_0x7429('0x36')][_0x7429('0x37')]?_0x17b8f9['attributes']:_0x48989e[_0x7429('0x2e')];if(_0x6d7b73[_0x7429('0x32')][_0x7429('0x3f')]){_0x17b8f9[_0x7429('0x40')]=[{'all':!![]}];}_0x17b8f9=_[_0x7429('0x3c')]({},_0x17b8f9,_0x6d7b73['options']);return db['Campaign'][_0x7429('0x44')](_0x17b8f9)['then'](handleEntityNotFound(_0x4ab76c,null))['then'](respondWithResult(_0x4ab76c,null))[_0x7429('0x42')](handleError(_0x4ab76c,null));};exports[_0x7429('0x45')]=function(_0x1adff6,_0x3f1765){return db[_0x7429('0x2a')][_0x7429('0x45')](_0x1adff6[_0x7429('0x46')],{})[_0x7429('0x21')](function(_0x79869e){var _0x3f8ba2=_0x1adff6['user'][_0x7429('0x22')]({'plain':!![]});if(!_0x3f8ba2)throw new Error(_0x7429('0x47'));if(_0x3f8ba2['role']===_0x7429('0x48')){var _0xca7c25=_0x79869e[_0x7429('0x22')]({'plain':!![]});var _0x4ebeca=_0x7429('0x23');return db[_0x7429('0x49')][_0x7429('0x44')]({'where':{'name':_0x4ebeca,'userProfileId':_0x3f8ba2[_0x7429('0x4a')]},'raw':!![]})[_0x7429('0x21')](function(_0x41d57f){if(_0x41d57f&&_0x41d57f[_0x7429('0x4b')]===0x0){return db[_0x7429('0x24')][_0x7429('0x45')]({'name':_0xca7c25[_0x7429('0x30')],'resourceId':_0xca7c25['id'],'type':_0x41d57f[_0x7429('0x30')],'sectionId':_0x41d57f['id']},{})['then'](function(){return _0x79869e;});}else{return _0x79869e;}})[_0x7429('0x42')](function(_0x337bb8){logger['error'](_0x7429('0x4c'),_0x337bb8);throw _0x337bb8;});}return _0x79869e;})[_0x7429('0x21')](respondWithResult(_0x3f1765,0xc9))[_0x7429('0x42')](handleError(_0x3f1765,null));};exports['clone']=function(_0x53f490,_0x288383){var _0x25b17b={'where':{'id':_0x53f490[_0x7429('0x4d')]['id']}},_0x545c80={};_0x545c80[_0x7429('0x2e')]=_[_0x7429('0x31')](db[_0x7429('0x2a')][_0x7429('0x2b')]);_0x25b17b[_0x7429('0x36')]=_[_0x7429('0x34')](_0x545c80['model'],qs['fields'](_0x53f490['query']['fields']));_0x25b17b[_0x7429('0x36')]=_0x25b17b[_0x7429('0x36')][_0x7429('0x37')]?_0x25b17b['attributes']:_0x545c80['model'];if(_0x53f490[_0x7429('0x32')]['includeAll']){_0x25b17b[_0x7429('0x40')]=[{'all':!![]}];}_0x25b17b=_[_0x7429('0x3c')]({},_0x25b17b,_0x53f490['options']);return db[_0x7429('0x2a')][_0x7429('0x44')](_0x25b17b)[_0x7429('0x21')](handleEntityNotFound(_0x288383,null))['then'](function(_0x35c71a){if(_0x35c71a){var _0x1439f5=_0x35c71a[_0x7429('0x22')]({'plain':!![]});_0x1439f5=qs[_0x7429('0x4e')](_0x1439f5,['id',_0x7429('0x4f'),_0x7429('0x50')]);_0x53f490[_0x7429('0x46')]=_['omit'](_0x53f490[_0x7429('0x46')],['id','createdAt','updatedAt']);return db['Campaign'][_0x7429('0x45')](_[_0x7429('0x3c')](_0x1439f5,_0x53f490[_0x7429('0x46')]),{'include':_0x53f490[_0x7429('0x32')][_0x7429('0x3f')]?[{'all':!![]}]:undefined})[_0x7429('0x21')](function(_0xf26c16){var _0x45cdc4=_0x53f490[_0x7429('0x48')][_0x7429('0x22')]({'plain':!![]});if(!_0x45cdc4)throw new Error(_0x7429('0x47'));if(_0x45cdc4[_0x7429('0x51')]===_0x7429('0x48')){var _0xcd53dc=_0xf26c16['get']({'plain':!![]});var _0x4d470c=_0x7429('0x23');return db[_0x7429('0x49')]['find']({'where':{'name':_0x4d470c,'userProfileId':_0x45cdc4[_0x7429('0x4a')]},'raw':!![]})[_0x7429('0x21')](function(_0x303b2d){if(_0x303b2d&&_0x303b2d[_0x7429('0x4b')]===0x0){return db['UserProfileResource'][_0x7429('0x45')]({'name':_0xcd53dc[_0x7429('0x30')],'resourceId':_0xcd53dc['id'],'type':_0x303b2d[_0x7429('0x30')],'sectionId':_0x303b2d['id']},{})['then'](function(){return _0xf26c16;});}else{return _0xf26c16;}})['catch'](function(_0x34d177){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34d177);throw _0x34d177;});}return _0xf26c16;});}})[_0x7429('0x21')](respondWithResult(_0x288383,0xc9))[_0x7429('0x42')](handleError(_0x288383,null));};exports[_0x7429('0x20')]=function(_0x9bf10f,_0x3ddccb){if(_0x9bf10f[_0x7429('0x46')]['id']){delete _0x9bf10f[_0x7429('0x46')]['id'];}return db[_0x7429('0x2a')][_0x7429('0x44')]({'where':{'id':_0x9bf10f[_0x7429('0x4d')]['id']}})[_0x7429('0x21')](handleEntityNotFound(_0x3ddccb,null))[_0x7429('0x21')](saveUpdates(_0x9bf10f['body'],null))[_0x7429('0x21')](respondWithResult(_0x3ddccb,null))[_0x7429('0x42')](handleError(_0x3ddccb,null));};exports[_0x7429('0x25')]=function(_0x478ff8,_0x10f918){return db[_0x7429('0x2a')][_0x7429('0x44')]({'where':{'id':_0x478ff8[_0x7429('0x4d')]['id']}})['then'](handleEntityNotFound(_0x10f918,null))[_0x7429('0x21')](removeEntity(_0x10f918,null))['catch'](handleError(_0x10f918,null));};exports[_0x7429('0x52')]=function(_0x36680d,_0x2c9924,_0x6f93c9){var _0xc1cf4c={'raw':!![],'where':{}};var _0x2c9da3={};var _0x5d1b0d={'count':0x0,'rows':[]};return db[_0x7429('0x2a')][_0x7429('0x53')]({'where':{'id':_0x36680d['params']['id']}})['then'](handleEntityNotFound(_0x2c9924,null))['then'](function(_0x2880f9){if(_0x2880f9){_0x2c9da3[_0x7429('0x2e')]=_['keys'](db[_0x7429('0x54')]['rawAttributes']);_0x2c9da3[_0x7429('0x32')]=_[_0x7429('0x31')](_0x36680d[_0x7429('0x32')]);_0x2c9da3[_0x7429('0x33')]=_['intersection'](_0x2c9da3['model'],_0x2c9da3[_0x7429('0x32')]);_0xc1cf4c[_0x7429('0x36')]=_[_0x7429('0x34')](_0x2c9da3['model'],qs[_0x7429('0x35')](_0x36680d[_0x7429('0x32')][_0x7429('0x35')]));_0xc1cf4c[_0x7429('0x36')]=_0xc1cf4c[_0x7429('0x36')][_0x7429('0x37')]?_0xc1cf4c[_0x7429('0x36')]:_0x2c9da3[_0x7429('0x2e')];if(!_0x36680d['query']['hasOwnProperty']('nolimit')){_0xc1cf4c['limit']=qs['limit'](_0x36680d[_0x7429('0x32')][_0x7429('0x1c')]);_0xc1cf4c[_0x7429('0x1b')]=qs['offset'](_0x36680d[_0x7429('0x32')][_0x7429('0x1b')]);}_0xc1cf4c[_0x7429('0x55')]=qs['sort'](_0x36680d[_0x7429('0x32')][_0x7429('0x56')]);_0xc1cf4c[_0x7429('0x39')]=qs[_0x7429('0x33')](_[_0x7429('0x3a')](_0x36680d[_0x7429('0x32')],_0x2c9da3[_0x7429('0x33')]));_0xc1cf4c[_0x7429('0x39')][_0x7429('0x57')]=_0x2880f9['id'];if(_0x36680d[_0x7429('0x32')][_0x7429('0x3b')]){_0xc1cf4c[_0x7429('0x39')]=_[_0x7429('0x3c')](_0xc1cf4c[_0x7429('0x39')],{'$or':_[_0x7429('0x2f')](_0xc1cf4c[_0x7429('0x36')],function(_0x2524f9){var _0x4f845b={};_0x4f845b[_0x2524f9]={'$like':'%'+_0x36680d[_0x7429('0x32')][_0x7429('0x3b')]+'%'};return _0x4f845b;})});}_0xc1cf4c=_['merge']({},_0xc1cf4c,_0x36680d[_0x7429('0x58')]);return db[_0x7429('0x54')][_0x7429('0x1a')]({'where':_0xc1cf4c[_0x7429('0x39')]})[_0x7429('0x21')](function(_0x2c8739){_0x5d1b0d[_0x7429('0x1a')]=_0x2c8739;if(_0x36680d[_0x7429('0x32')][_0x7429('0x3f')]){_0xc1cf4c['include']=[{'all':!![]}];}return db[_0x7429('0x54')][_0x7429('0x59')](_0xc1cf4c);})[_0x7429('0x21')](function(_0xc28aac){_0x5d1b0d[_0x7429('0x41')]=_0xc28aac;return _0x5d1b0d;});}})['then'](respondWithFilteredResult(_0x2c9924,_0xc1cf4c))[_0x7429('0x42')](handleError(_0x2c9924,null));};exports[_0x7429('0x5a')]=function(_0x3dfaa5,_0x2cdb6f,_0x3c1974){var _0x452f2b={'raw':!![],'where':{}};var _0x2d2cbf={};var _0x2fd13c={'count':0x0,'rows':[]};return db[_0x7429('0x2a')][_0x7429('0x53')]({'where':{'id':_0x3dfaa5[_0x7429('0x4d')]['id']}})[_0x7429('0x21')](handleEntityNotFound(_0x2cdb6f,null))[_0x7429('0x21')](function(_0x42b77f){if(_0x42b77f){_0x2d2cbf[_0x7429('0x2e')]=_[_0x7429('0x31')](db['CmHopperHistory'][_0x7429('0x2b')]);_0x2d2cbf[_0x7429('0x32')]=_[_0x7429('0x31')](_0x3dfaa5[_0x7429('0x32')]);_0x2d2cbf[_0x7429('0x33')]=_['intersection'](_0x2d2cbf[_0x7429('0x2e')],_0x2d2cbf['query']);_0x452f2b[_0x7429('0x36')]=_[_0x7429('0x34')](_0x2d2cbf[_0x7429('0x2e')],qs[_0x7429('0x35')](_0x3dfaa5['query']['fields']));_0x452f2b[_0x7429('0x36')]=_0x452f2b['attributes'][_0x7429('0x37')]?_0x452f2b[_0x7429('0x36')]:_0x2d2cbf[_0x7429('0x2e')];if(!_0x3dfaa5['query']['hasOwnProperty'](_0x7429('0x5b'))){_0x452f2b[_0x7429('0x1c')]=qs[_0x7429('0x1c')](_0x3dfaa5[_0x7429('0x32')]['limit']);_0x452f2b[_0x7429('0x1b')]=qs[_0x7429('0x1b')](_0x3dfaa5[_0x7429('0x32')][_0x7429('0x1b')]);}_0x452f2b[_0x7429('0x55')]=qs[_0x7429('0x56')](_0x3dfaa5['query'][_0x7429('0x56')]);_0x452f2b['where']=qs[_0x7429('0x33')](_[_0x7429('0x3a')](_0x3dfaa5['query'],_0x2d2cbf[_0x7429('0x33')]));_0x452f2b[_0x7429('0x39')][_0x7429('0x57')]=_0x42b77f['id'];if(_0x3dfaa5[_0x7429('0x32')]['filter']){_0x452f2b[_0x7429('0x39')]=_[_0x7429('0x3c')](_0x452f2b[_0x7429('0x39')],{'$or':_[_0x7429('0x2f')](_0x452f2b['attributes'],function(_0x5a8754){var _0x11dfca={};_0x11dfca[_0x5a8754]={'$like':'%'+_0x3dfaa5['query'][_0x7429('0x3b')]+'%'};return _0x11dfca;})});}_0x452f2b=_[_0x7429('0x3c')]({},_0x452f2b,_0x3dfaa5['options']);return db[_0x7429('0x5c')]['count']({'where':_0x452f2b[_0x7429('0x39')]})['then'](function(_0x4118f5){_0x2fd13c[_0x7429('0x1a')]=_0x4118f5;if(_0x3dfaa5[_0x7429('0x32')]['includeAll']){_0x452f2b[_0x7429('0x40')]=[{'all':!![]}];}return db[_0x7429('0x5c')][_0x7429('0x59')](_0x452f2b);})[_0x7429('0x21')](function(_0x169e85){_0x2fd13c[_0x7429('0x41')]=_0x169e85;return _0x2fd13c;});}})['then'](respondWithFilteredResult(_0x2cdb6f,_0x452f2b))[_0x7429('0x42')](handleError(_0x2cdb6f,null));};exports[_0x7429('0x5d')]=function(_0x59a08c,_0x5a6752,_0x1c1bba){var _0x4fc0e6={'raw':!![],'where':{}};var _0x463380={};var _0x1eb012={'count':0x0,'rows':[]};return db[_0x7429('0x2a')][_0x7429('0x53')]({'where':{'id':_0x59a08c[_0x7429('0x4d')]['id']}})[_0x7429('0x21')](handleEntityNotFound(_0x5a6752,null))[_0x7429('0x21')](function(_0x195c94){if(_0x195c94){_0x463380['model']=_['keys'](db[_0x7429('0x5e')][_0x7429('0x2b')]);_0x463380[_0x7429('0x32')]=_[_0x7429('0x31')](_0x59a08c[_0x7429('0x32')]);_0x463380[_0x7429('0x33')]=_[_0x7429('0x34')](_0x463380[_0x7429('0x2e')],_0x463380[_0x7429('0x32')]);_0x4fc0e6[_0x7429('0x36')]=_[_0x7429('0x34')](_0x463380[_0x7429('0x2e')],qs[_0x7429('0x35')](_0x59a08c[_0x7429('0x32')][_0x7429('0x35')]));_0x4fc0e6['attributes']=_0x4fc0e6['attributes'][_0x7429('0x37')]?_0x4fc0e6[_0x7429('0x36')]:_0x463380[_0x7429('0x2e')];if(!_0x59a08c['query'][_0x7429('0x38')]('nolimit')){_0x4fc0e6['limit']=qs[_0x7429('0x1c')](_0x59a08c['query'][_0x7429('0x1c')]);_0x4fc0e6['offset']=qs['offset'](_0x59a08c[_0x7429('0x32')][_0x7429('0x1b')]);}_0x4fc0e6[_0x7429('0x55')]=qs['sort'](_0x59a08c[_0x7429('0x32')]['sort']);_0x4fc0e6[_0x7429('0x39')]=qs['filters'](_[_0x7429('0x3a')](_0x59a08c['query'],_0x463380[_0x7429('0x33')]));_0x4fc0e6[_0x7429('0x39')][_0x7429('0x57')]=_0x195c94['id'];if(_0x59a08c['query'][_0x7429('0x3b')]){_0x4fc0e6['where']=_['merge'](_0x4fc0e6[_0x7429('0x39')],{'$or':_['map'](_0x4fc0e6['attributes'],function(_0x2413a0){var _0x578875={};_0x578875[_0x2413a0]={'$like':'%'+_0x59a08c['query']['filter']+'%'};return _0x578875;})});}_0x4fc0e6=_[_0x7429('0x3c')]({},_0x4fc0e6,_0x59a08c[_0x7429('0x58')]);return db[_0x7429('0x5e')]['count']({'where':_0x4fc0e6[_0x7429('0x39')]})['then'](function(_0x17bb05){_0x1eb012[_0x7429('0x1a')]=_0x17bb05;if(_0x59a08c[_0x7429('0x32')]['includeAll']){_0x4fc0e6[_0x7429('0x40')]=[{'all':!![]}];}return db[_0x7429('0x5e')]['findAll'](_0x4fc0e6);})[_0x7429('0x21')](function(_0xe85db7){_0x1eb012[_0x7429('0x41')]=_0xe85db7;return _0x1eb012;});}})['then'](respondWithFilteredResult(_0x5a6752,_0x4fc0e6))[_0x7429('0x42')](handleError(_0x5a6752,null));};exports[_0x7429('0x5f')]=function(_0x4323d7,_0x4d376f,_0x2d2193){var _0x58e96a={'raw':!![],'where':{}};var _0xec5dd9={};var _0x2b441c={'count':0x0,'rows':[]};return db['Campaign'][_0x7429('0x53')]({'where':{'id':_0x4323d7[_0x7429('0x4d')]['id']}})[_0x7429('0x21')](handleEntityNotFound(_0x4d376f,null))['then'](function(_0x450a16){if(_0x450a16){_0xec5dd9[_0x7429('0x2e')]=_[_0x7429('0x31')](db[_0x7429('0x60')][_0x7429('0x2b')]);_0xec5dd9['query']=_[_0x7429('0x31')](_0x4323d7['query']);_0xec5dd9['filters']=_[_0x7429('0x34')](_0xec5dd9[_0x7429('0x2e')],_0xec5dd9[_0x7429('0x32')]);_0x58e96a[_0x7429('0x36')]=_[_0x7429('0x34')](_0xec5dd9[_0x7429('0x2e')],qs[_0x7429('0x35')](_0x4323d7[_0x7429('0x32')][_0x7429('0x35')]));_0x58e96a[_0x7429('0x36')]=_0x58e96a[_0x7429('0x36')]['length']?_0x58e96a[_0x7429('0x36')]:_0xec5dd9[_0x7429('0x2e')];if(!_0x4323d7[_0x7429('0x32')]['hasOwnProperty']('nolimit')){_0x58e96a['limit']=qs[_0x7429('0x1c')](_0x4323d7[_0x7429('0x32')][_0x7429('0x1c')]);_0x58e96a[_0x7429('0x1b')]=qs[_0x7429('0x1b')](_0x4323d7[_0x7429('0x32')][_0x7429('0x1b')]);}_0x58e96a[_0x7429('0x55')]=qs[_0x7429('0x56')](_0x4323d7[_0x7429('0x32')][_0x7429('0x56')]);_0x58e96a[_0x7429('0x39')]=qs[_0x7429('0x33')](_[_0x7429('0x3a')](_0x4323d7[_0x7429('0x32')],_0xec5dd9[_0x7429('0x33')]));_0x58e96a['where']['CampaignId']=_0x450a16['id'];if(_0x4323d7[_0x7429('0x32')][_0x7429('0x3b')]){_0x58e96a[_0x7429('0x39')]=_['merge'](_0x58e96a[_0x7429('0x39')],{'$or':_[_0x7429('0x2f')](_0x58e96a[_0x7429('0x36')],function(_0x495f1d){var _0x435f6a={};_0x435f6a[_0x495f1d]={'$like':'%'+_0x4323d7[_0x7429('0x32')][_0x7429('0x3b')]+'%'};return _0x435f6a;})});}_0x58e96a=_[_0x7429('0x3c')]({},_0x58e96a,_0x4323d7[_0x7429('0x58')]);return db[_0x7429('0x60')][_0x7429('0x1a')]({'where':_0x58e96a[_0x7429('0x39')]})[_0x7429('0x21')](function(_0x115827){_0x2b441c[_0x7429('0x1a')]=_0x115827;if(_0x4323d7[_0x7429('0x32')][_0x7429('0x3f')]){_0x58e96a['include']=[{'all':!![]}];}return db[_0x7429('0x60')][_0x7429('0x59')](_0x58e96a);})[_0x7429('0x21')](function(_0x23e129){_0x2b441c['rows']=_0x23e129;return _0x2b441c;});}})[_0x7429('0x21')](respondWithFilteredResult(_0x4d376f,_0x58e96a))['catch'](handleError(_0x4d376f,null));};exports['getLists']=function(_0x1c878b,_0x5cc346,_0x5619b6){var _0x4222d5={};var _0xd83b05={};var _0x55a4a6;var _0x195e85;return db['Campaign'][_0x7429('0x53')]({'where':{'id':_0x1c878b['params']['id']}})[_0x7429('0x21')](handleEntityNotFound(_0x5cc346,null))[_0x7429('0x21')](function(_0x1a9d71){if(_0x1a9d71){_0x55a4a6=_0x1a9d71;_0xd83b05[_0x7429('0x2e')]=_['keys'](db['CmList'][_0x7429('0x2b')]);_0xd83b05[_0x7429('0x32')]=_[_0x7429('0x31')](_0x1c878b[_0x7429('0x32')]);_0xd83b05[_0x7429('0x33')]=_[_0x7429('0x34')](_0xd83b05[_0x7429('0x2e')],_0xd83b05[_0x7429('0x32')]);_0x4222d5[_0x7429('0x36')]=_[_0x7429('0x34')](_0xd83b05[_0x7429('0x2e')],qs['fields'](_0x1c878b[_0x7429('0x32')][_0x7429('0x35')]));_0x4222d5[_0x7429('0x36')]=_0x4222d5['attributes'][_0x7429('0x37')]?_0x4222d5[_0x7429('0x36')]:_0xd83b05['model'];_0x4222d5[_0x7429('0x55')]=qs[_0x7429('0x56')](_0x1c878b[_0x7429('0x32')][_0x7429('0x56')]);_0x4222d5[_0x7429('0x39')]=qs[_0x7429('0x33')](_[_0x7429('0x3a')](_0x1c878b['query'],_0xd83b05[_0x7429('0x33')]));if(_0x1c878b[_0x7429('0x32')][_0x7429('0x3b')]){_0x4222d5[_0x7429('0x39')]=_['merge'](_0x4222d5[_0x7429('0x39')],{'$or':_[_0x7429('0x2f')](_0x4222d5[_0x7429('0x36')],function(_0x3376d9){var _0x123d8b={};_0x123d8b[_0x3376d9]={'$like':'%'+_0x1c878b[_0x7429('0x32')]['filter']+'%'};return _0x123d8b;})});}_0x4222d5=_[_0x7429('0x3c')]({},_0x4222d5,_0x1c878b['options']);return _0x55a4a6[_0x7429('0x61')](_0x4222d5);}})[_0x7429('0x21')](function(_0xf9e7f6){if(_0xf9e7f6){_0x195e85=_0xf9e7f6[_0x7429('0x37')];if(!_0x1c878b[_0x7429('0x32')][_0x7429('0x38')](_0x7429('0x5b'))){_0x4222d5['limit']=qs[_0x7429('0x1c')](_0x1c878b['query'][_0x7429('0x1c')]);_0x4222d5['offset']=qs[_0x7429('0x1b')](_0x1c878b[_0x7429('0x32')][_0x7429('0x1b')]);}return _0x55a4a6[_0x7429('0x61')](_0x4222d5);}})[_0x7429('0x21')](function(_0x445ee2){if(_0x445ee2){return _0x445ee2?{'count':_0x195e85,'rows':_0x445ee2}:null;}})[_0x7429('0x21')](respondWithResult(_0x5cc346,null))[_0x7429('0x42')](handleError(_0x5cc346,null));};exports[_0x7429('0x62')]=function(_0x15b10a,_0x494e54,_0x78a2d2){var _0x54cc84,_0x4c76b3;return db[_0x7429('0x2a')][_0x7429('0x44')]({'where':{'id':_0x15b10a[_0x7429('0x4d')]['id']}})[_0x7429('0x21')](handleEntityNotFound(_0x494e54,null))[_0x7429('0x21')](function(_0x2cb1ed){if(_0x2cb1ed){_0x4c76b3=_0x2cb1ed;return _0x2cb1ed['addLists'](_0x15b10a[_0x7429('0x46')][_0x7429('0x63')],_[_0x7429('0x4e')](_0x15b10a[_0x7429('0x46')],[_0x7429('0x63'),'id'])||{});}return null;})[_0x7429('0x64')](function(_0x1a7fed){var _0x370fcc;_0x54cc84=_0x1a7fed||[];var _0x45e338=[];if(_0x1a7fed){for(var _0x1b85a9=0x0;_0x1b85a9<_0x1a7fed['length'];_0x1b85a9+=0x1){var _0x46f9a3=_0x1a7fed[_0x1b85a9]['get']({'plain':!![]});_0x4c76b3[_0x7429('0x65')]=_0x15b10a['body'][_0x7429('0x65')]?_0x15b10a[_0x7429('0x46')]['dialCheckDuplicateType']:_0x4c76b3[_0x7429('0x65')];switch(_0x4c76b3[_0x7429('0x65')]){case _0x7429('0x66'):_0x370fcc=squel[_0x7429('0x67')]()[_0x7429('0x68')](_0x7429('0x69'))['fromQuery']([_0x7429('0x6a'),'scheduledAt',_0x7429('0x6b'),'ListId','CampaignId',_0x7429('0x4f'),_0x7429('0x50')],squel[_0x7429('0x6c')]()[_0x7429('0x6d')](_0x7429('0x6a'),_0x7429('0x6a'))['field'](_0x7429('0x6e'),_0x7429('0x6f'))[_0x7429('0x6d')]('id',_0x7429('0x6b'))['field'](_0x46f9a3[_0x7429('0x70')][_0x7429('0x71')](),'ListId')['field'](_0x15b10a['params']['id'][_0x7429('0x71')](),_0x7429('0x57'))[_0x7429('0x6d')]('NOW()',_0x7429('0x4f'))[_0x7429('0x6d')]('NOW()',_0x7429('0x50'))['from']('cm_contacts')['where'](_0x7429('0x72'))[_0x7429('0x39')](_0x7429('0x73'),_0x46f9a3[_0x7429('0x70')][_0x7429('0x71')]())[_0x7429('0x39')](_0x7429('0x74'))[_0x7429('0x39')](_0x7429('0x75'),squel[_0x7429('0x6c')]()[_0x7429('0x6d')]('COALESCE(calleridnum,\x27\x27)')[_0x7429('0x76')]('cm_hopper_final')[_0x7429('0x39')]('CampaignId\x20=\x20?',_0x15b10a[_0x7429('0x4d')]['id'][_0x7429('0x71')]()))[_0x7429('0x39')](_0x7429('0x75'),squel[_0x7429('0x6c')]()[_0x7429('0x6d')](_0x7429('0x77'))[_0x7429('0x76')]('cm_hopper')[_0x7429('0x39')](_0x7429('0x78'),_0x15b10a[_0x7429('0x4d')]['id'][_0x7429('0x71')]())))[_0x7429('0x71')]();break;case _0x7429('0x79'):_0x370fcc=squel[_0x7429('0x67')]()['into'](_0x7429('0x69'))[_0x7429('0x7a')]([_0x7429('0x6a'),_0x7429('0x6f'),'ContactId','ListId',_0x7429('0x57'),_0x7429('0x4f'),_0x7429('0x50')],squel[_0x7429('0x6c')]()['field'](_0x7429('0x6a'),_0x7429('0x6a'))[_0x7429('0x6d')](_0x7429('0x6e'),_0x7429('0x6f'))[_0x7429('0x6d')]('id',_0x7429('0x6b'))[_0x7429('0x6d')](_0x46f9a3[_0x7429('0x70')][_0x7429('0x71')](),_0x7429('0x7b'))[_0x7429('0x6d')](_0x15b10a[_0x7429('0x4d')]['id'][_0x7429('0x71')](),_0x7429('0x57'))['field']('NOW()',_0x7429('0x4f'))[_0x7429('0x6d')](_0x7429('0x6e'),_0x7429('0x50'))['from']('cm_contacts')[_0x7429('0x39')]('deletedAt\x20IS\x20NULL')['where'](_0x7429('0x73'),_0x46f9a3[_0x7429('0x70')][_0x7429('0x71')]())[_0x7429('0x39')](_0x7429('0x74'))[_0x7429('0x39')](_0x7429('0x75'),squel[_0x7429('0x6c')]()[_0x7429('0x6d')](_0x7429('0x77'))['from']('cm_hopper')[_0x7429('0x39')]('CampaignId\x20=\x20?',_0x15b10a[_0x7429('0x4d')]['id'][_0x7429('0x71')]())))[_0x7429('0x71')]();break;default:_0x370fcc=squel[_0x7429('0x67')]()['into'](_0x7429('0x69'))[_0x7429('0x7a')]([_0x7429('0x6a'),_0x7429('0x6f'),_0x7429('0x6b'),'ListId',_0x7429('0x57'),_0x7429('0x4f'),_0x7429('0x50')],squel[_0x7429('0x6c')]()['field'](_0x7429('0x6a'),'phone')[_0x7429('0x6d')](_0x7429('0x6e'),_0x7429('0x6f'))[_0x7429('0x6d')]('id',_0x7429('0x6b'))[_0x7429('0x6d')](_0x46f9a3['CmListId'][_0x7429('0x71')](),_0x7429('0x7b'))[_0x7429('0x6d')](_0x15b10a[_0x7429('0x4d')]['id'][_0x7429('0x71')](),'CampaignId')[_0x7429('0x6d')](_0x7429('0x6e'),_0x7429('0x4f'))[_0x7429('0x6d')](_0x7429('0x6e'),_0x7429('0x50'))[_0x7429('0x76')]('cm_contacts')[_0x7429('0x39')](_0x7429('0x72'))[_0x7429('0x39')]('ListId\x20=\x20?',_0x46f9a3[_0x7429('0x70')][_0x7429('0x71')]())[_0x7429('0x39')](_0x7429('0x74')))[_0x7429('0x71')]();}_0x45e338[_0x7429('0x7c')](db['sequelize']['query'](_0x370fcc));}return BPromise[_0x7429('0x7d')](_0x45e338);}})[_0x7429('0x21')](function(){return _0x54cc84;})['then'](respondWithResult(_0x494e54,null))['catch'](handleError(_0x494e54,null));};exports['removeLists']=function(_0x5052be,_0x7a56f3,_0xa46f20){return db[_0x7429('0x2a')][_0x7429('0x44')]({'where':{'id':_0x5052be['params']['id']}})[_0x7429('0x21')](handleEntityNotFound(_0x7a56f3,null))['then'](function(_0x2b873c){if(_0x2b873c){return _0x2b873c['removeLists'](_0x5052be[_0x7429('0x32')][_0x7429('0x63')]);}})[_0x7429('0x21')](function(_0x4a87fe){if(_0x4a87fe){return db[_0x7429('0x54')][_0x7429('0x25')]({'where':{'ListId':_0x5052be[_0x7429('0x32')][_0x7429('0x63')],'CampaignId':_0x5052be[_0x7429('0x4d')]['id']}})[_0x7429('0x21')](function(){return _0x4a87fe;});}})[_0x7429('0x21')](respondWithStatusCode(_0x7a56f3,null))[_0x7429('0x42')](handleError(_0x7a56f3,null));};exports['getBlackLists']=function(_0x16fa59,_0x379685,_0x54605f){var _0x5d0b4b={'raw':!![],'where':{}};var _0x334845={};var _0x46ce88={'count':0x0,'rows':[]};return db[_0x7429('0x2a')][_0x7429('0x53')]({'where':{'id':_0x16fa59[_0x7429('0x4d')]['id']}})[_0x7429('0x21')](handleEntityNotFound(_0x379685,null))['then'](function(_0x478227){if(_0x478227){_0x334845[_0x7429('0x2e')]=_[_0x7429('0x31')](db[_0x7429('0x7e')][_0x7429('0x2b')]);_0x334845['query']=_[_0x7429('0x31')](_0x16fa59['query']);_0x334845[_0x7429('0x33')]=_['intersection'](_0x334845[_0x7429('0x2e')],_0x334845[_0x7429('0x32')]);_0x5d0b4b[_0x7429('0x36')]=_['intersection'](_0x334845[_0x7429('0x2e')],qs[_0x7429('0x35')](_0x16fa59[_0x7429('0x32')]['fields']));_0x5d0b4b['attributes']=_0x5d0b4b[_0x7429('0x36')]['length']?_0x5d0b4b['attributes']:_0x334845['model'];if(!_0x16fa59[_0x7429('0x32')][_0x7429('0x38')](_0x7429('0x5b'))){_0x5d0b4b[_0x7429('0x1c')]=qs[_0x7429('0x1c')](_0x16fa59['query'][_0x7429('0x1c')]);_0x5d0b4b[_0x7429('0x1b')]=qs['offset'](_0x16fa59[_0x7429('0x32')]['offset']);}_0x5d0b4b['order']=qs[_0x7429('0x56')](_0x16fa59[_0x7429('0x32')]['sort']);_0x5d0b4b[_0x7429('0x39')]=qs['filters'](_[_0x7429('0x3a')](_0x16fa59['query'],_0x334845[_0x7429('0x33')]));_0x5d0b4b['where']['CampaignId']=_0x478227['id'];if(_0x16fa59['query']['filter']){_0x5d0b4b[_0x7429('0x39')]=_['merge'](_0x5d0b4b[_0x7429('0x39')],{'$or':_['map'](_0x5d0b4b[_0x7429('0x36')],function(_0x29d074){var _0x42a079={};_0x42a079[_0x29d074]={'$like':'%'+_0x16fa59['query'][_0x7429('0x3b')]+'%'};return _0x42a079;})});}_0x5d0b4b=_['merge']({},_0x5d0b4b,_0x16fa59[_0x7429('0x58')]);return db[_0x7429('0x7e')]['count']({'where':_0x5d0b4b[_0x7429('0x39')]})['then'](function(_0x9fea3f){_0x46ce88[_0x7429('0x1a')]=_0x9fea3f;if(_0x16fa59[_0x7429('0x32')]['includeAll']){_0x5d0b4b[_0x7429('0x40')]=[{'all':!![]}];}return db['CmList'][_0x7429('0x59')](_0x5d0b4b);})['then'](function(_0x30c7cc){_0x46ce88[_0x7429('0x41')]=_0x30c7cc;return _0x46ce88;});}})['then'](respondWithFilteredResult(_0x379685,_0x5d0b4b))[_0x7429('0x42')](handleError(_0x379685,null));};exports[_0x7429('0x7f')]=function(_0x533051,_0x3d103d,_0x20494b){var _0x372bff,_0x339635;return db[_0x7429('0x2a')][_0x7429('0x44')]({'where':{'id':_0x533051[_0x7429('0x4d')]['id']}})[_0x7429('0x21')](handleEntityNotFound(_0x3d103d,null))[_0x7429('0x21')](function(_0x35b646){if(_0x35b646){_0x339635=_0x35b646;return _0x35b646[_0x7429('0x7f')](_0x533051[_0x7429('0x46')][_0x7429('0x63')],_[_0x7429('0x4e')](_0x533051[_0x7429('0x46')],[_0x7429('0x63'),'id'])||{});}return null;})[_0x7429('0x64')](function(_0x5ca611){var _0x53679a;_0x372bff=_0x5ca611||[];var _0x1a716b=[];if(_0x5ca611){for(var _0x28bb04=0x0;_0x28bb04<_0x5ca611['length'];_0x28bb04+=0x1){var _0x507383=_0x5ca611[_0x28bb04][_0x7429('0x22')]({'plain':!![]});_0x53679a=squel['insert']()[_0x7429('0x68')](_0x7429('0x80'))['fromQuery'](['phone',_0x7429('0x6b'),'ListId',_0x7429('0x57'),_0x7429('0x4f'),_0x7429('0x50')],squel[_0x7429('0x6c')]()[_0x7429('0x6d')](_0x7429('0x6a'),_0x7429('0x6a'))[_0x7429('0x6d')]('id',_0x7429('0x6b'))['field'](_0x507383[_0x7429('0x70')][_0x7429('0x71')](),'ListId')[_0x7429('0x6d')](_0x533051[_0x7429('0x4d')]['id'][_0x7429('0x71')](),_0x7429('0x57'))[_0x7429('0x6d')](_0x7429('0x6e'),_0x7429('0x4f'))[_0x7429('0x6d')]('NOW()',_0x7429('0x50'))[_0x7429('0x76')]('cm_contacts')[_0x7429('0x39')]('deletedAt\x20IS\x20NULL')[_0x7429('0x39')](_0x7429('0x73'),_0x507383[_0x7429('0x70')][_0x7429('0x71')]())['where'](_0x7429('0x74')))[_0x7429('0x71')]();_0x1a716b[_0x7429('0x7c')](db[_0x7429('0x81')][_0x7429('0x32')](_0x53679a));}return BPromise[_0x7429('0x7d')](_0x1a716b);}})[_0x7429('0x21')](function(){return _0x372bff;})['then'](respondWithResult(_0x3d103d,null))[_0x7429('0x42')](handleError(_0x3d103d,null));};exports[_0x7429('0x82')]=function(_0x58fb1d,_0x2bb3e2,_0x1cd0d5){return db[_0x7429('0x2a')]['find']({'where':{'id':_0x58fb1d['params']['id']}})['then'](handleEntityNotFound(_0x2bb3e2,null))['then'](function(_0x5c4b18){if(_0x5c4b18){return _0x5c4b18[_0x7429('0x82')](_0x58fb1d[_0x7429('0x32')][_0x7429('0x63')]);}})[_0x7429('0x21')](function(_0x2a7711){if(_0x2a7711){return db['CmHopperBlack'][_0x7429('0x25')]({'where':{'ListId':_0x58fb1d[_0x7429('0x32')][_0x7429('0x63')],'CampaignId':_0x58fb1d[_0x7429('0x4d')]['id']}})[_0x7429('0x21')](function(){return _0x2a7711;});}})['then'](respondWithStatusCode(_0x2bb3e2,null))[_0x7429('0x42')](handleError(_0x2bb3e2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index ddcc29c..b1b5f89 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0xb10b,0x12a));var _0xbb10=function(_0x28e7e1,_0x45f235){_0x28e7e1=_0x28e7e1-0x0;var _0x1d8a9e=_0xb10b[_0x28e7e1];return _0x1d8a9e;};'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')]('Campaign',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x1e7701,_0x13fd0f){var _0x3ab707=function(_0x3c5242){while(--_0x3c5242){_0x1e7701['push'](_0x1e7701['shift']());}};_0x3ab707(++_0x13fd0f);}(_0xb10b,0x12a));var _0xbb10=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0xb10b[_0x119705];return _0x2affc2;};'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')]('Campaign',attributes,{'tableName':_0xbb10('0xb'),'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 bc42480..4ece89d 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 _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x336892,_0x9346f4){var _0x46f2f0=function(_0x4b77b4){while(--_0x4b77b4){_0x336892['push'](_0x336892['shift']());}};_0x46f2f0(++_0x9346f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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['GetCampaign']=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')]));});});}; \ 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(_0x4cbe98,_0x576f7b){var _0x49c755=function(_0x1e0487){while(--_0x1e0487){_0x4cbe98['push'](_0x4cbe98['shift']());}};_0x49c755(++_0x576f7b);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 25c1617..337be8a 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 _0x231d=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','clone','addLists','/:id/blacklists','update','destroy','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0x231d,0x78));var _0xd231=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x231d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xd231('0x0'));var util=require(_0xd231('0x1'));var path=require(_0xd231('0x2'));var timeout=require(_0xd231('0x3'));var express=require(_0xd231('0x4'));var router=express[_0xd231('0x5')]();var auth=require(_0xd231('0x6'));var interaction=require(_0xd231('0x7'));var config=require(_0xd231('0x8'));var controller=require(_0xd231('0x9'));router[_0xd231('0xa')]('/',auth['isAuthenticated'](),controller[_0xd231('0xb')]);router[_0xd231('0xa')](_0xd231('0xc'),auth[_0xd231('0xd')](),controller[_0xd231('0xe')]);router[_0xd231('0xa')](_0xd231('0xf'),auth[_0xd231('0xd')](),controller[_0xd231('0x10')]);router[_0xd231('0xa')](_0xd231('0x11'),auth['isAuthenticated'](),controller[_0xd231('0x12')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xd231('0x13')]);router[_0xd231('0xa')](_0xd231('0x14'),auth[_0xd231('0xd')](),controller[_0xd231('0x15')]);router[_0xd231('0xa')](_0xd231('0x16'),auth[_0xd231('0xd')](),controller[_0xd231('0x17')]);router['get']('/:id/blacklists',auth[_0xd231('0xd')](),controller[_0xd231('0x18')]);router[_0xd231('0x19')]('/',auth[_0xd231('0xd')](),controller['create']);router[_0xd231('0x19')]('/:id/clone',auth[_0xd231('0xd')](),controller[_0xd231('0x1a')]);router[_0xd231('0x19')]('/:id/lists',auth[_0xd231('0xd')](),controller[_0xd231('0x1b')]);router['post'](_0xd231('0x1c'),auth[_0xd231('0xd')](),controller['addBlackLists']);router['put'](_0xd231('0xc'),auth['isAuthenticated'](),controller[_0xd231('0x1d')]);router['delete'](_0xd231('0xc'),auth['isAuthenticated'](),controller[_0xd231('0x1e')]);router[_0xd231('0x1f')](_0xd231('0x16'),auth['isAuthenticated'](),controller[_0xd231('0x20')]);router['delete'](_0xd231('0x1c'),auth[_0xd231('0xd')](),controller[_0xd231('0x21')]);module[_0xd231('0x22')]=router; \ No newline at end of file +var _0x000d=['Router','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','put','/:id','destroy','delete','exports','multer','express'];(function(_0xd6a763,_0x563229){var _0x4bf8ca=function(_0x213e83){while(--_0x213e83){_0xd6a763['push'](_0xd6a763['shift']());}};_0x4bf8ca(++_0x563229);}(_0x000d,0x1d2));var _0xd000=function(_0x358775,_0xe07091){_0x358775=_0x358775-0x0;var _0x6d0c46=_0x000d[_0x358775];return _0x6d0c46;};'use strict';var multer=require(_0xd000('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd000('0x1'));var router=express[_0xd000('0x2')]();var auth=require(_0xd000('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd000('0x4'));var controller=require(_0xd000('0x5'));router[_0xd000('0x6')]('/',auth[_0xd000('0x7')](),controller['index']);router[_0xd000('0x6')]('/:id',auth[_0xd000('0x7')](),controller['show']);router['get'](_0xd000('0x8'),auth[_0xd000('0x7')](),controller['getHoppers']);router['get'](_0xd000('0x9'),auth[_0xd000('0x7')](),controller[_0xd000('0xa')]);router[_0xd000('0x6')](_0xd000('0xb'),auth['isAuthenticated'](),controller[_0xd000('0xc')]);router['get'](_0xd000('0xd'),auth['isAuthenticated'](),controller[_0xd000('0xe')]);router[_0xd000('0x6')](_0xd000('0xf'),auth['isAuthenticated'](),controller[_0xd000('0x10')]);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0xd000('0x11')]);router[_0xd000('0x12')]('/',auth['isAuthenticated'](),controller[_0xd000('0x13')]);router[_0xd000('0x12')](_0xd000('0x14'),auth[_0xd000('0x7')](),controller['clone']);router['post'](_0xd000('0xf'),auth[_0xd000('0x7')](),controller['addLists']);router['post']('/:id/blacklists',auth[_0xd000('0x7')](),controller['addBlackLists']);router[_0xd000('0x15')](_0xd000('0x16'),auth[_0xd000('0x7')](),controller['update']);router['delete'](_0xd000('0x16'),auth[_0xd000('0x7')](),controller[_0xd000('0x17')]);router[_0xd000('0x18')](_0xd000('0xf'),auth[_0xd000('0x7')](),controller['removeLists']);router[_0xd000('0x18')]('/:id/blacklists',auth[_0xd000('0x7')](),controller['removeBlackLists']);module[_0xd000('0x19')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index db37bb5..9c1322e 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 _0x0759=['VIRTUAL','key','exports','STRING','TEXT'];(function(_0x3d5909,_0x17417b){var _0x52d088=function(_0x3fa3fb){while(--_0x3fa3fb){_0x3d5909['push'](_0x3d5909['shift']());}};_0x52d088(++_0x17417b);}(_0x0759,0x129));var _0x9075=function(_0x32ccfa,_0x15d7d8){_0x32ccfa=_0x32ccfa-0x0;var _0x200aee=_0x0759[_0x32ccfa];return _0x200aee;};'use strict';var Sequelize=require('sequelize');module[_0x9075('0x0')]={'key':{'type':Sequelize[_0x9075('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x9075('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9075('0x1')]},'name':{'type':Sequelize[_0x9075('0x3')],'get':function(){return this['getDataValue'](_0x9075('0x4'));}}}; \ No newline at end of file +var _0xc608=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc608,0x1b8));var _0x8c60=function(_0x5eb2fa,_0x1dedf0){_0x5eb2fa=_0x5eb2fa-0x0;var _0x48b892=_0xc608[_0x5eb2fa];return _0x48b892;};'use strict';var Sequelize=require(_0x8c60('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x8c60('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index dcd72f3..994fb30 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 _0x92ea=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','includeAll','findAll','catch','show','params','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache'];(function(_0x498581,_0x1f06d5){var _0x48fff6=function(_0x44bf66){while(--_0x44bf66){_0x498581['push'](_0x498581['shift']());}};_0x48fff6(++_0x1f06d5);}(_0x92ea,0xa2));var _0xa92e=function(_0x40b457,_0x3e178f){_0x40b457=_0x40b457-0x0;var _0x199b0d=_0x92ea[_0x40b457];return _0x199b0d;};'use strict';var pdf=require(_0xa92e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa92e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa92e('0x2'));var rp=require(_0xa92e('0x3'));var moment=require(_0xa92e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa92e('0x5'));var util=require(_0xa92e('0x6'));var path=require('path');var sox=require(_0xa92e('0x7'));var csv=require(_0xa92e('0x8'));var ejs=require(_0xa92e('0x9'));var fs=require('fs');var _=require(_0xa92e('0xa'));var squel=require(_0xa92e('0xb'));var crypto=require(_0xa92e('0xc'));var jsforce=require(_0xa92e('0xd'));var deskjs=require(_0xa92e('0xe'));var toCsv=require(_0xa92e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa92e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa92e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa92e('0x11'));var logger=require(_0xa92e('0x12'))(_0xa92e('0x13'));var utils=require('../../config/utils');var config=require(_0xa92e('0x14'));var db=require(_0xa92e('0x15'))['db'];function respondWithStatusCode(_0x11f5ba,_0x563259){_0x563259=_0x563259||0xcc;return function(_0x3c4595){if(_0x3c4595){return _0x11f5ba[_0xa92e('0x16')](_0x563259);}return _0x11f5ba[_0xa92e('0x17')](_0x563259)[_0xa92e('0x18')]();};}function respondWithResult(_0x4463e4,_0xe6512){_0xe6512=_0xe6512||0xc8;return function(_0x348e26){if(_0x348e26){return _0x4463e4[_0xa92e('0x17')](_0xe6512)['json'](_0x348e26);}};}function respondWithFilteredResult(_0x2a518b,_0x53ba5d){return function(_0x45ec26){if(_0x45ec26){var _0x10d7fc=_0x45ec26[_0xa92e('0x19')],_0x506e1c=_0x53ba5d[_0xa92e('0x1a')],_0x4921be=_0x53ba5d['offset']+_0x53ba5d[_0xa92e('0x1b')],_0x5095f1;if(_0x4921be>=_0x10d7fc){_0x4921be=_0x10d7fc;_0x5095f1=0xc8;}else{_0x5095f1=0xce;}_0x2a518b[_0xa92e('0x17')](_0x5095f1);return _0x2a518b[_0xa92e('0x1c')]('Content-Range',_0x506e1c+'-'+_0x4921be+'/'+_0x10d7fc)['json'](_0x45ec26);}return null;};}function patchUpdates(_0x4bd588){return function(_0x2e2f7f){try{jsonpatch[_0xa92e('0x1d')](_0x2e2f7f,_0x4bd588,!![]);}catch(_0x4efc7b){return BPromise['reject'](_0x4efc7b);}return _0x2e2f7f[_0xa92e('0x1e')]();};}function saveUpdates(_0xb47c53,_0x18f1c4){return function(_0x1f3edd){if(_0x1f3edd){return _0x1f3edd[_0xa92e('0x1f')](_0xb47c53)[_0xa92e('0x20')](function(_0x140d76){return _0x140d76;});}return null;};}function removeEntity(_0x1d0c82,_0x1e49ac){return function(_0x4df310){if(_0x4df310){return _0x4df310[_0xa92e('0x21')]()['then'](function(){var _0x235d4f=_0x4df310[_0xa92e('0x22')]({'plain':!![]});var _0x3a891b=_0xa92e('0x23');return db[_0xa92e('0x24')][_0xa92e('0x21')]({'where':{'type':_0x3a891b,'resourceId':_0x235d4f['id']}})[_0xa92e('0x20')](function(){return _0x4df310;});})[_0xa92e('0x20')](function(){_0x1d0c82['status'](0xcc)[_0xa92e('0x18')]();});}};}function handleEntityNotFound(_0x54864d,_0x8b6802){return function(_0x2de8b7){if(!_0x2de8b7){_0x54864d[_0xa92e('0x16')](0x194);}return _0x2de8b7;};}function handleError(_0x5c748a,_0x50a59b){_0x50a59b=_0x50a59b||0x1f4;return function(_0x2aa661){logger[_0xa92e('0x25')](_0x2aa661[_0xa92e('0x26')]);if(_0x2aa661[_0xa92e('0x27')]){delete _0x2aa661[_0xa92e('0x27')];}_0x5c748a['status'](_0x50a59b)[_0xa92e('0x28')](_0x2aa661);};}exports[_0xa92e('0x29')]=function(_0x216e1b,_0x11cc0d){var _0x5b707b={},_0x3083e2={},_0x279e67={'count':0x0,'rows':[]};var _0x1e642b=_[_0xa92e('0x2a')](db[_0xa92e('0x2b')][_0xa92e('0x2c')],function(_0x4cb087){return{'name':_0x4cb087[_0xa92e('0x2d')],'type':_0x4cb087[_0xa92e('0x2e')][_0xa92e('0x2f')]};});_0x3083e2[_0xa92e('0x30')]=_[_0xa92e('0x2a')](_0x1e642b,_0xa92e('0x27'));_0x3083e2[_0xa92e('0x31')]=_[_0xa92e('0x32')](_0x216e1b['query']);_0x3083e2[_0xa92e('0x33')]=_[_0xa92e('0x34')](_0x3083e2[_0xa92e('0x30')],_0x3083e2[_0xa92e('0x31')]);_0x5b707b[_0xa92e('0x35')]=_[_0xa92e('0x34')](_0x3083e2[_0xa92e('0x30')],qs[_0xa92e('0x36')](_0x216e1b['query']['fields']));_0x5b707b[_0xa92e('0x35')]=_0x5b707b[_0xa92e('0x35')][_0xa92e('0x37')]?_0x5b707b[_0xa92e('0x35')]:_0x3083e2[_0xa92e('0x30')];if(!_0x216e1b['query']['hasOwnProperty']('nolimit')){_0x5b707b[_0xa92e('0x1b')]=qs[_0xa92e('0x1b')](_0x216e1b[_0xa92e('0x31')][_0xa92e('0x1b')]);_0x5b707b[_0xa92e('0x1a')]=qs[_0xa92e('0x1a')](_0x216e1b['query'][_0xa92e('0x1a')]);}_0x5b707b[_0xa92e('0x38')]=qs[_0xa92e('0x39')](_0x216e1b[_0xa92e('0x31')][_0xa92e('0x39')]);_0x5b707b[_0xa92e('0x3a')]=qs[_0xa92e('0x33')](_[_0xa92e('0x3b')](_0x216e1b[_0xa92e('0x31')],_0x3083e2[_0xa92e('0x33')]),_0x1e642b);if(_0x216e1b['query'][_0xa92e('0x3c')]){_0x5b707b[_0xa92e('0x3a')]=_[_0xa92e('0x3d')](_0x5b707b['where'],{'$or':_[_0xa92e('0x2a')](_0x1e642b,function(_0x5749ac){if(_0x5749ac['type']!=='VIRTUAL'){var _0x163199={};_0x163199[_0x5749ac[_0xa92e('0x27')]]={'$like':'%'+_0x216e1b[_0xa92e('0x31')][_0xa92e('0x3c')]+'%'};return _0x163199;}})});}_0x5b707b=_['merge']({},_0x5b707b,_0x216e1b['options']);var _0x28ee57={'where':_0x5b707b[_0xa92e('0x3a')]};return db['CannedAnswer'][_0xa92e('0x19')](_0x28ee57)[_0xa92e('0x20')](function(_0x46b868){_0x279e67[_0xa92e('0x19')]=_0x46b868;if(_0x216e1b[_0xa92e('0x31')][_0xa92e('0x3e')]){_0x5b707b['include']=[{'all':!![]}];}return db[_0xa92e('0x2b')][_0xa92e('0x3f')](_0x5b707b);})[_0xa92e('0x20')](function(_0x6d9537){_0x279e67['rows']=_0x6d9537;return _0x279e67;})[_0xa92e('0x20')](respondWithFilteredResult(_0x11cc0d,_0x5b707b))[_0xa92e('0x40')](handleError(_0x11cc0d,null));};exports[_0xa92e('0x41')]=function(_0x19fce9,_0x5d5919){var _0xe4b8bc={'raw':!![],'where':{'id':_0x19fce9[_0xa92e('0x42')]['id']}},_0x1cce54={};_0x1cce54[_0xa92e('0x30')]=_['keys'](db['CannedAnswer'][_0xa92e('0x2c')]);_0x1cce54['query']=_['keys'](_0x19fce9[_0xa92e('0x31')]);_0x1cce54[_0xa92e('0x33')]=_[_0xa92e('0x34')](_0x1cce54[_0xa92e('0x30')],_0x1cce54['query']);_0xe4b8bc['attributes']=_[_0xa92e('0x34')](_0x1cce54[_0xa92e('0x30')],qs[_0xa92e('0x36')](_0x19fce9[_0xa92e('0x31')][_0xa92e('0x36')]));_0xe4b8bc[_0xa92e('0x35')]=_0xe4b8bc['attributes']['length']?_0xe4b8bc['attributes']:_0x1cce54['model'];if(_0x19fce9[_0xa92e('0x31')][_0xa92e('0x3e')]){_0xe4b8bc['include']=[{'all':!![]}];}_0xe4b8bc=_[_0xa92e('0x3d')]({},_0xe4b8bc,_0x19fce9[_0xa92e('0x43')]);return db[_0xa92e('0x2b')]['find'](_0xe4b8bc)[_0xa92e('0x20')](handleEntityNotFound(_0x5d5919,null))[_0xa92e('0x20')](respondWithResult(_0x5d5919,null))[_0xa92e('0x40')](handleError(_0x5d5919,null));};exports[_0xa92e('0x1f')]=function(_0x22d69a,_0x2b0cb1){if(_0x22d69a[_0xa92e('0x44')]['id']){delete _0x22d69a[_0xa92e('0x44')]['id'];}return db[_0xa92e('0x2b')]['find']({'where':{'id':_0x22d69a[_0xa92e('0x42')]['id']}})[_0xa92e('0x20')](handleEntityNotFound(_0x2b0cb1,null))[_0xa92e('0x20')](saveUpdates(_0x22d69a[_0xa92e('0x44')],null))[_0xa92e('0x20')](respondWithResult(_0x2b0cb1,null))[_0xa92e('0x40')](handleError(_0x2b0cb1,null));};exports[_0xa92e('0x21')]=function(_0x594794,_0x389a74){return db['CannedAnswer'][_0xa92e('0x45')]({'where':{'id':_0x594794[_0xa92e('0x42')]['id']}})[_0xa92e('0x20')](handleEntityNotFound(_0x389a74,null))['then'](removeEntity(_0x389a74,null))['catch'](handleError(_0x389a74,null));};exports[_0xa92e('0x46')]=function(_0x2b5fce,_0x14bcac){var _0x16de06={'key':_0x2b5fce[_0xa92e('0x44')]['key']};if(_0x2b5fce[_0xa92e('0x44')][_0xa92e('0x47')]){_0x16de06['MailAccountId']=_0x2b5fce['body'][_0xa92e('0x47')];}else if(_0x2b5fce[_0xa92e('0x44')][_0xa92e('0x48')]){_0x16de06[_0xa92e('0x48')]=_0x2b5fce['body'][_0xa92e('0x48')];}else if(_0x2b5fce[_0xa92e('0x44')][_0xa92e('0x49')]){_0x16de06[_0xa92e('0x49')]=_0x2b5fce['body'][_0xa92e('0x49')];}else if(_0x2b5fce['body'][_0xa92e('0x4a')]){_0x16de06[_0xa92e('0x4a')]=_0x2b5fce[_0xa92e('0x44')]['ChatWebsiteId'];}return db[_0xa92e('0x2b')]['find']({'where':_0x16de06})[_0xa92e('0x20')](function(_0x121126){if(_0x121126){throw new db[(_0xa92e('0x4b'))][(_0xa92e('0x4c'))](_0xa92e('0x4d'));}return db[_0xa92e('0x2b')][_0xa92e('0x46')](_0x2b5fce['body']);})['then'](function(_0x360364){var _0x1bdf92=_0x2b5fce[_0xa92e('0x4e')][_0xa92e('0x22')]({'plain':!![]});if(!_0x1bdf92)throw new Error(_0xa92e('0x4f'));if(_0x1bdf92[_0xa92e('0x50')]===_0xa92e('0x4e')){var _0x4b396b=_0x360364[_0xa92e('0x22')]({'plain':!![]});return db['UserProfileSection'][_0xa92e('0x45')]({'where':{'name':_0xa92e('0x23'),'userProfileId':_0x1bdf92[_0xa92e('0x51')]},'raw':!![]})['then'](function(_0xe925f7){if(_0xe925f7&&_0xe925f7[_0xa92e('0x52')]===0x0){return db[_0xa92e('0x24')][_0xa92e('0x46')]({'name':_0x4b396b[_0xa92e('0x27')],'resourceId':_0x4b396b['id'],'type':_0xe925f7[_0xa92e('0x27')],'sectionId':_0xe925f7['id']},{})[_0xa92e('0x20')](function(){return _0x360364;});}else{return _0x360364;}})[_0xa92e('0x40')](function(_0x108f52){logger[_0xa92e('0x25')](_0xa92e('0x53'),_0x108f52);throw _0x108f52;});}return _0x360364;})[_0xa92e('0x20')](respondWithResult(_0x14bcac,0xc9))[_0xa92e('0x40')](handleError(_0x14bcac,null));}; \ No newline at end of file +var _0xbe5b=['Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','CannedAnswer','include','findAll','rows','params','rawAttributes','intersection','includeAll','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','count','offset','set'];(function(_0x1a7c50,_0x148bd2){var _0x2170ad=function(_0x21c57d){while(--_0x21c57d){_0x1a7c50['push'](_0x1a7c50['shift']());}};_0x2170ad(++_0x148bd2);}(_0xbe5b,0x151));var _0xbbe5=function(_0x2592b0,_0x633884){_0x2592b0=_0x2592b0-0x0;var _0x268ed0=_0xbe5b[_0x2592b0];return _0x268ed0;};'use strict';var pdf=require(_0xbbe5('0x0'));var emlformat=require(_0xbbe5('0x1'));var rimraf=require(_0xbbe5('0x2'));var zipdir=require(_0xbbe5('0x3'));var jsonpatch=require(_0xbbe5('0x4'));var rp=require(_0xbbe5('0x5'));var moment=require(_0xbbe5('0x6'));var BPromise=require(_0xbbe5('0x7'));var Mustache=require(_0xbbe5('0x8'));var util=require(_0xbbe5('0x9'));var path=require(_0xbbe5('0xa'));var sox=require(_0xbbe5('0xb'));var csv=require(_0xbbe5('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbbe5('0xd'));var squel=require(_0xbbe5('0xe'));var crypto=require('crypto');var jsforce=require(_0xbbe5('0xf'));var deskjs=require(_0xbbe5('0x10'));var toCsv=require(_0xbbe5('0xc'));var querystring=require(_0xbbe5('0x11'));var Papa=require(_0xbbe5('0x12'));var Redis=require(_0xbbe5('0x13'));var authService=require(_0xbbe5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbbe5('0x15'));var hardwareService=require(_0xbbe5('0x16'));var logger=require(_0xbbe5('0x17'))(_0xbbe5('0x18'));var utils=require(_0xbbe5('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e9e38,_0x4bf0f0){_0x4bf0f0=_0x4bf0f0||0xcc;return function(_0x14d788){if(_0x14d788){return _0x2e9e38[_0xbbe5('0x1a')](_0x4bf0f0);}return _0x2e9e38[_0xbbe5('0x1b')](_0x4bf0f0)['end']();};}function respondWithResult(_0x410f39,_0x373de5){_0x373de5=_0x373de5||0xc8;return function(_0x270aad){if(_0x270aad){return _0x410f39[_0xbbe5('0x1b')](_0x373de5)['json'](_0x270aad);}};}function respondWithFilteredResult(_0x420c2d,_0x4db33b){return function(_0x37ee76){if(_0x37ee76){var _0x1032b7=_0x37ee76[_0xbbe5('0x1c')],_0x54c16b=_0x4db33b['offset'],_0x29ebc0=_0x4db33b[_0xbbe5('0x1d')]+_0x4db33b['limit'],_0x1370a9;if(_0x29ebc0>=_0x1032b7){_0x29ebc0=_0x1032b7;_0x1370a9=0xc8;}else{_0x1370a9=0xce;}_0x420c2d[_0xbbe5('0x1b')](_0x1370a9);return _0x420c2d[_0xbbe5('0x1e')](_0xbbe5('0x1f'),_0x54c16b+'-'+_0x29ebc0+'/'+_0x1032b7)[_0xbbe5('0x20')](_0x37ee76);}return null;};}function patchUpdates(_0x1d56be){return function(_0x4f6ebf){try{jsonpatch[_0xbbe5('0x21')](_0x4f6ebf,_0x1d56be,!![]);}catch(_0x43fdda){return BPromise[_0xbbe5('0x22')](_0x43fdda);}return _0x4f6ebf['save']();};}function saveUpdates(_0x493ea0,_0x53f883){return function(_0x5d5973){if(_0x5d5973){return _0x5d5973[_0xbbe5('0x23')](_0x493ea0)[_0xbbe5('0x24')](function(_0x2194ae){return _0x2194ae;});}return null;};}function removeEntity(_0x2a8729,_0x4d7541){return function(_0x45fc6d){if(_0x45fc6d){return _0x45fc6d[_0xbbe5('0x25')]()['then'](function(){var _0x1ea5df=_0x45fc6d[_0xbbe5('0x26')]({'plain':!![]});var _0x3d0426='CannedAnswers';return db[_0xbbe5('0x27')][_0xbbe5('0x25')]({'where':{'type':_0x3d0426,'resourceId':_0x1ea5df['id']}})['then'](function(){return _0x45fc6d;});})[_0xbbe5('0x24')](function(){_0x2a8729[_0xbbe5('0x1b')](0xcc)[_0xbbe5('0x28')]();});}};}function handleEntityNotFound(_0x518655,_0x162d1a){return function(_0x17101a){if(!_0x17101a){_0x518655['sendStatus'](0x194);}return _0x17101a;};}function handleError(_0x29a6ba,_0x31c0cc){_0x31c0cc=_0x31c0cc||0x1f4;return function(_0x3818c3){logger[_0xbbe5('0x29')](_0x3818c3[_0xbbe5('0x2a')]);if(_0x3818c3['name']){delete _0x3818c3[_0xbbe5('0x2b')];}_0x29a6ba['status'](_0x31c0cc)[_0xbbe5('0x2c')](_0x3818c3);};}exports[_0xbbe5('0x2d')]=function(_0xaa9123,_0x234182){var _0x1455e2={},_0x4c0f30={},_0x2ada64={'count':0x0,'rows':[]};var _0x2e010a=_[_0xbbe5('0x2e')](db['CannedAnswer']['rawAttributes'],function(_0x44e3e7){return{'name':_0x44e3e7['fieldName'],'type':_0x44e3e7[_0xbbe5('0x2f')][_0xbbe5('0x30')]};});_0x4c0f30[_0xbbe5('0x31')]=_[_0xbbe5('0x2e')](_0x2e010a,_0xbbe5('0x2b'));_0x4c0f30[_0xbbe5('0x32')]=_[_0xbbe5('0x33')](_0xaa9123[_0xbbe5('0x32')]);_0x4c0f30[_0xbbe5('0x34')]=_['intersection'](_0x4c0f30[_0xbbe5('0x31')],_0x4c0f30['query']);_0x1455e2[_0xbbe5('0x35')]=_['intersection'](_0x4c0f30['model'],qs['fields'](_0xaa9123[_0xbbe5('0x32')][_0xbbe5('0x36')]));_0x1455e2['attributes']=_0x1455e2[_0xbbe5('0x35')][_0xbbe5('0x37')]?_0x1455e2[_0xbbe5('0x35')]:_0x4c0f30[_0xbbe5('0x31')];if(!_0xaa9123['query'][_0xbbe5('0x38')](_0xbbe5('0x39'))){_0x1455e2[_0xbbe5('0x3a')]=qs[_0xbbe5('0x3a')](_0xaa9123['query'][_0xbbe5('0x3a')]);_0x1455e2['offset']=qs[_0xbbe5('0x1d')](_0xaa9123[_0xbbe5('0x32')][_0xbbe5('0x1d')]);}_0x1455e2[_0xbbe5('0x3b')]=qs[_0xbbe5('0x3c')](_0xaa9123['query'][_0xbbe5('0x3c')]);_0x1455e2[_0xbbe5('0x3d')]=qs[_0xbbe5('0x34')](_['pick'](_0xaa9123[_0xbbe5('0x32')],_0x4c0f30[_0xbbe5('0x34')]),_0x2e010a);if(_0xaa9123['query'][_0xbbe5('0x3e')]){_0x1455e2[_0xbbe5('0x3d')]=_[_0xbbe5('0x3f')](_0x1455e2[_0xbbe5('0x3d')],{'$or':_[_0xbbe5('0x2e')](_0x2e010a,function(_0x3bc049){if(_0x3bc049['type']!==_0xbbe5('0x40')){var _0x3b4590={};_0x3b4590[_0x3bc049['name']]={'$like':'%'+_0xaa9123[_0xbbe5('0x32')]['filter']+'%'};return _0x3b4590;}})});}_0x1455e2=_[_0xbbe5('0x3f')]({},_0x1455e2,_0xaa9123[_0xbbe5('0x41')]);var _0x5b45ff={'where':_0x1455e2[_0xbbe5('0x3d')]};return db[_0xbbe5('0x42')][_0xbbe5('0x1c')](_0x5b45ff)[_0xbbe5('0x24')](function(_0x265108){_0x2ada64[_0xbbe5('0x1c')]=_0x265108;if(_0xaa9123[_0xbbe5('0x32')]['includeAll']){_0x1455e2[_0xbbe5('0x43')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbbe5('0x44')](_0x1455e2);})['then'](function(_0x543f57){_0x2ada64[_0xbbe5('0x45')]=_0x543f57;return _0x2ada64;})[_0xbbe5('0x24')](respondWithFilteredResult(_0x234182,_0x1455e2))['catch'](handleError(_0x234182,null));};exports['show']=function(_0x2f5664,_0xdd9bd){var _0x3d7068={'raw':!![],'where':{'id':_0x2f5664[_0xbbe5('0x46')]['id']}},_0x3b78ae={};_0x3b78ae['model']=_['keys'](db['CannedAnswer'][_0xbbe5('0x47')]);_0x3b78ae[_0xbbe5('0x32')]=_[_0xbbe5('0x33')](_0x2f5664['query']);_0x3b78ae['filters']=_[_0xbbe5('0x48')](_0x3b78ae['model'],_0x3b78ae[_0xbbe5('0x32')]);_0x3d7068['attributes']=_['intersection'](_0x3b78ae['model'],qs[_0xbbe5('0x36')](_0x2f5664[_0xbbe5('0x32')][_0xbbe5('0x36')]));_0x3d7068[_0xbbe5('0x35')]=_0x3d7068[_0xbbe5('0x35')][_0xbbe5('0x37')]?_0x3d7068['attributes']:_0x3b78ae[_0xbbe5('0x31')];if(_0x2f5664[_0xbbe5('0x32')][_0xbbe5('0x49')]){_0x3d7068[_0xbbe5('0x43')]=[{'all':!![]}];}_0x3d7068=_[_0xbbe5('0x3f')]({},_0x3d7068,_0x2f5664['options']);return db[_0xbbe5('0x42')][_0xbbe5('0x4a')](_0x3d7068)[_0xbbe5('0x24')](handleEntityNotFound(_0xdd9bd,null))[_0xbbe5('0x24')](respondWithResult(_0xdd9bd,null))[_0xbbe5('0x4b')](handleError(_0xdd9bd,null));};exports[_0xbbe5('0x23')]=function(_0x8ed020,_0x482cdf){if(_0x8ed020['body']['id']){delete _0x8ed020[_0xbbe5('0x4c')]['id'];}return db[_0xbbe5('0x42')][_0xbbe5('0x4a')]({'where':{'id':_0x8ed020[_0xbbe5('0x46')]['id']}})['then'](handleEntityNotFound(_0x482cdf,null))[_0xbbe5('0x24')](saveUpdates(_0x8ed020[_0xbbe5('0x4c')],null))['then'](respondWithResult(_0x482cdf,null))[_0xbbe5('0x4b')](handleError(_0x482cdf,null));};exports[_0xbbe5('0x25')]=function(_0x4945a7,_0x5d5ef5){return db[_0xbbe5('0x42')]['find']({'where':{'id':_0x4945a7['params']['id']}})['then'](handleEntityNotFound(_0x5d5ef5,null))['then'](removeEntity(_0x5d5ef5,null))['catch'](handleError(_0x5d5ef5,null));};exports[_0xbbe5('0x4d')]=function(_0x213446,_0x5a02b5){var _0x29846f={'key':_0x213446['body'][_0xbbe5('0x30')]};if(_0x213446[_0xbbe5('0x4c')]['MailAccountId']){_0x29846f[_0xbbe5('0x4e')]=_0x213446['body'][_0xbbe5('0x4e')];}else if(_0x213446[_0xbbe5('0x4c')][_0xbbe5('0x4f')]){_0x29846f['SmsAccountId']=_0x213446[_0xbbe5('0x4c')][_0xbbe5('0x4f')];}else if(_0x213446[_0xbbe5('0x4c')][_0xbbe5('0x50')]){_0x29846f[_0xbbe5('0x50')]=_0x213446[_0xbbe5('0x4c')]['OpenchannelAccountId'];}else if(_0x213446['body']['ChatWebsiteId']){_0x29846f[_0xbbe5('0x51')]=_0x213446['body'][_0xbbe5('0x51')];}return db[_0xbbe5('0x42')][_0xbbe5('0x4a')]({'where':_0x29846f})[_0xbbe5('0x24')](function(_0x1b05ba){if(_0x1b05ba){throw new db[(_0xbbe5('0x52'))][(_0xbbe5('0x53'))](_0xbbe5('0x54'));}return db['CannedAnswer'][_0xbbe5('0x4d')](_0x213446[_0xbbe5('0x4c')]);})[_0xbbe5('0x24')](function(_0x5f1ef9){var _0x1b1bc0=_0x213446[_0xbbe5('0x55')][_0xbbe5('0x26')]({'plain':!![]});if(!_0x1b1bc0)throw new Error(_0xbbe5('0x56'));if(_0x1b1bc0[_0xbbe5('0x57')]===_0xbbe5('0x55')){var _0x38e45b=_0x5f1ef9[_0xbbe5('0x26')]({'plain':!![]});return db[_0xbbe5('0x58')][_0xbbe5('0x4a')]({'where':{'name':_0xbbe5('0x59'),'userProfileId':_0x1b1bc0[_0xbbe5('0x5a')]},'raw':!![]})[_0xbbe5('0x24')](function(_0x15d753){if(_0x15d753&&_0x15d753[_0xbbe5('0x5b')]===0x0){return db[_0xbbe5('0x27')][_0xbbe5('0x4d')]({'name':_0x38e45b[_0xbbe5('0x2b')],'resourceId':_0x38e45b['id'],'type':_0x15d753['name'],'sectionId':_0x15d753['id']},{})[_0xbbe5('0x24')](function(){return _0x5f1ef9;});}else{return _0x5f1ef9;}})[_0xbbe5('0x4b')](function(_0x9eaa83){logger[_0xbbe5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9eaa83);throw _0x9eaa83;});}return _0x5f1ef9;})[_0xbbe5('0x24')](respondWithResult(_0x5a02b5,0xc9))['catch'](handleError(_0x5a02b5,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 22ea303..6124b5a 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 _0x2e88=['util','../../config/logger','api','moment','bluebird','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x146f3a,_0x373e03){var _0x4ebd8a=function(_0x2b4ea9){while(--_0x2b4ea9){_0x146f3a['push'](_0x146f3a['shift']());}};_0x4ebd8a(++_0x373e03);}(_0x2e88,0x95));var _0x82e8=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x2e88[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x82e8('0x0'));var util=require(_0x82e8('0x1'));var logger=require(_0x82e8('0x2'))(_0x82e8('0x3'));var moment=require(_0x82e8('0x4'));var BPromise=require(_0x82e8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82e8('0x6'));var rimraf=require(_0x82e8('0x7'));var config=require('../../config/environment');var attributes=require(_0x82e8('0x8'));module[_0x82e8('0x9')]=function(_0x4e909a,_0x3162d1){return _0x4e909a[_0x82e8('0xa')](_0x82e8('0xb'),attributes,{'tableName':_0x82e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x82e8('0xd'),'collate':_0x82e8('0xe')});}; \ No newline at end of file +var _0x26d1=['api','moment','bluebird','rimraf','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x530bae,_0x34babc){var _0x40c385=function(_0x2dfc23){while(--_0x2dfc23){_0x530bae['push'](_0x530bae['shift']());}};_0x40c385(++_0x34babc);}(_0x26d1,0x8e));var _0x126d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x26d1[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x126d('0x0'));var util=require('util');var logger=require(_0x126d('0x1'))(_0x126d('0x2'));var moment=require(_0x126d('0x3'));var BPromise=require(_0x126d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x126d('0x5'));var config=require('../../config/environment');var attributes=require(_0x126d('0x6'));module[_0x126d('0x7')]=function(_0x442e04,_0x449ed0){return _0x442e04[_0x126d('0x8')]('CannedAnswer',attributes,{'tableName':_0x126d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x126d('0xa'),'collate':_0x126d('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 8340d1e..4d1f807 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 _0xaab6=['CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','CannedAnswer,\x20%s,\x20%s','debug'];(function(_0x516e09,_0x509ae7){var _0x16cab3=function(_0x458b72){while(--_0x458b72){_0x516e09['push'](_0x516e09['shift']());}};_0x16cab3(++_0x509ae7);}(_0xaab6,0x125));var _0x6aab=function(_0x38cb58,_0x203de5){_0x38cb58=_0x38cb58-0x0;var _0x57fc2a=_0xaab6[_0x38cb58];return _0x57fc2a;};'use strict';var _=require(_0x6aab('0x0'));var util=require(_0x6aab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6aab('0x2'));var fs=require('fs');var Redis=require(_0x6aab('0x3'));var db=require(_0x6aab('0x4'))['db'];var utils=require(_0x6aab('0x5'));var logger=require(_0x6aab('0x6'))('rpc');var config=require(_0x6aab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6aab('0x8')][_0x6aab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2120eb,_0x3108aa,_0x58db13){return new BPromise(function(_0x1101f5,_0x2d1c4e){return client['request'](_0x2120eb,_0x58db13)['then'](function(_0x57e9fc){logger[_0x6aab('0xa')](_0x6aab('0xb'),_0x3108aa,'request\x20sent');logger[_0x6aab('0xc')](_0x6aab('0xd'),_0x3108aa,_0x6aab('0xe'),JSON[_0x6aab('0xf')](_0x57e9fc));if(_0x57e9fc['error']){if(_0x57e9fc[_0x6aab('0x10')]['code']===0x1f4){logger[_0x6aab('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x3108aa,_0x57e9fc[_0x6aab('0x10')][_0x6aab('0x11')]);return _0x2d1c4e(_0x57e9fc[_0x6aab('0x10')][_0x6aab('0x11')]);}logger[_0x6aab('0x10')](_0x6aab('0xb'),_0x3108aa,_0x57e9fc[_0x6aab('0x10')][_0x6aab('0x11')]);return _0x1101f5(_0x57e9fc[_0x6aab('0x10')][_0x6aab('0x11')]);}else{logger['info'](_0x6aab('0xb'),_0x3108aa,_0x6aab('0xe'));_0x1101f5(_0x57e9fc['result'][_0x6aab('0x11')]);}})['catch'](function(_0x27e652){logger['error'](_0x6aab('0xb'),_0x3108aa,_0x27e652);_0x2d1c4e(_0x27e652);});});} \ No newline at end of file +var _0x8286=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird'];(function(_0x4c0de7,_0x569db4){var _0x4acbb8=function(_0x35b844){while(--_0x35b844){_0x4c0de7['push'](_0x4c0de7['shift']());}};_0x4acbb8(++_0x569db4);}(_0x8286,0xc2));var _0x6828=function(_0x45d51b,_0x5593bc){_0x45d51b=_0x45d51b-0x0;var _0x5026f8=_0x8286[_0x45d51b];return _0x5026f8;};'use strict';var _=require(_0x6828('0x0'));var util=require(_0x6828('0x1'));var moment=require(_0x6828('0x2'));var BPromise=require(_0x6828('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6828('0x4'));var db=require(_0x6828('0x5'))['db'];var utils=require(_0x6828('0x6'));var logger=require(_0x6828('0x7'))(_0x6828('0x8'));var config=require(_0x6828('0x9'));var jayson=require(_0x6828('0xa'));var client=jayson[_0x6828('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26725e,_0x589804,_0x337b6c){return new BPromise(function(_0x48fadd,_0x257b71){return client[_0x6828('0xc')](_0x26725e,_0x337b6c)[_0x6828('0xd')](function(_0x5d3110){logger[_0x6828('0xe')](_0x6828('0xf'),_0x589804,'request\x20sent');logger[_0x6828('0x10')](_0x6828('0x11'),_0x589804,_0x6828('0x12'),JSON['stringify'](_0x5d3110));if(_0x5d3110[_0x6828('0x13')]){if(_0x5d3110[_0x6828('0x13')][_0x6828('0x14')]===0x1f4){logger[_0x6828('0x13')](_0x6828('0xf'),_0x589804,_0x5d3110[_0x6828('0x13')]['message']);return _0x257b71(_0x5d3110[_0x6828('0x13')][_0x6828('0x15')]);}logger[_0x6828('0x13')](_0x6828('0xf'),_0x589804,_0x5d3110[_0x6828('0x13')][_0x6828('0x15')]);return _0x48fadd(_0x5d3110[_0x6828('0x13')][_0x6828('0x15')]);}else{logger['info']('CannedAnswer,\x20%s,\x20%s',_0x589804,_0x6828('0x12'));_0x48fadd(_0x5d3110['result'][_0x6828('0x15')]);}})['catch'](function(_0x1b8956){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x589804,_0x1b8956);_0x257b71(_0x1b8956);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index ba6c6f3..a9b9e3d 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 _0x4128=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','show','post','create','put','/:id','delete'];(function(_0x571fad,_0xa41ecb){var _0x45fa03=function(_0x3f89c3){while(--_0x3f89c3){_0x571fad['push'](_0x571fad['shift']());}};_0x45fa03(++_0xa41ecb);}(_0x4128,0x80));var _0x8412=function(_0x57c280,_0x48bdf5){_0x57c280=_0x57c280-0x0;var _0x20ea49=_0x4128[_0x57c280];return _0x20ea49;};'use strict';var multer=require('multer');var util=require(_0x8412('0x0'));var path=require(_0x8412('0x1'));var timeout=require('connect-timeout');var express=require(_0x8412('0x2'));var router=express[_0x8412('0x3')]();var auth=require(_0x8412('0x4'));var interaction=require(_0x8412('0x5'));var config=require(_0x8412('0x6'));var controller=require(_0x8412('0x7'));router[_0x8412('0x8')]('/',auth[_0x8412('0x9')](),controller['index']);router[_0x8412('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8412('0xa')]);router[_0x8412('0xb')]('/',auth['isAuthenticated'](),controller[_0x8412('0xc')]);router[_0x8412('0xd')](_0x8412('0xe'),auth[_0x8412('0x9')](),controller['update']);router[_0x8412('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8412('0x10')]);module[_0x8412('0x11')]=router; \ No newline at end of file +var _0x051e=['get','isAuthenticated','index','create','put','delete','/:id','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller'];(function(_0x3614e1,_0x32fa38){var _0x357310=function(_0x17a0f3){while(--_0x17a0f3){_0x3614e1['push'](_0x3614e1['shift']());}};_0x357310(++_0x32fa38);}(_0x051e,0xb8));var _0xe051=function(_0x544561,_0x3f006d){_0x544561=_0x544561-0x0;var _0x1ffd67=_0x051e[_0x544561];return _0x1ffd67;};'use strict';var multer=require(_0xe051('0x0'));var util=require('util');var path=require(_0xe051('0x1'));var timeout=require(_0xe051('0x2'));var express=require(_0xe051('0x3'));var router=express[_0xe051('0x4')]();var auth=require(_0xe051('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe051('0x6'));var controller=require(_0xe051('0x7'));router[_0xe051('0x8')]('/',auth[_0xe051('0x9')](),controller[_0xe051('0xa')]);router[_0xe051('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe051('0x9')](),controller[_0xe051('0xb')]);router[_0xe051('0xc')]('/:id',auth[_0xe051('0x9')](),controller['update']);router[_0xe051('0xd')](_0xe051('0xe'),auth[_0xe051('0x9')](),controller['destroy']);module[_0xe051('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index bf0d973..f66a682 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 _0x7e02=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x537293,_0x449f77){var _0x560e66=function(_0x5a9386){while(--_0x5a9386){_0x537293['push'](_0x537293['shift']());}};_0x560e66(++_0x449f77);}(_0x7e02,0x1b7));var _0x27e0=function(_0x197043,_0x3ebf47){_0x197043=_0x197043-0x0;var _0x233e33=_0x7e02[_0x197043];return _0x233e33;};'use strict';var Sequelize=require(_0x27e0('0x0'));module[_0x27e0('0x1')]={'calldate':{'type':Sequelize[_0x27e0('0x2')],'allowNull':![],'defaultValue':_0x27e0('0x3')},'clid':{'type':Sequelize[_0x27e0('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x27e0('0x4')]},'dcontext':{'type':Sequelize[_0x27e0('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x27e0('0x4')]},'lastapp':{'type':Sequelize[_0x27e0('0x4')]},'lastdata':{'type':Sequelize[_0x27e0('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x27e0('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x27e0('0x4')]},'amaflags':{'type':Sequelize[_0x27e0('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x27e0('0x4')]},'userfield':{'type':Sequelize[_0x27e0('0x4')]},'uniqueid':{'type':Sequelize[_0x27e0('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x27e0('0x4')]},'peeraccount':{'type':Sequelize[_0x27e0('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x27e0('0x4')]}}; \ No newline at end of file +var _0x6899=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x513a3c,_0xf6029d){var _0x1d7f50=function(_0x5d0c8b){while(--_0x5d0c8b){_0x513a3c['push'](_0x513a3c['shift']());}};_0x1d7f50(++_0xf6029d);}(_0x6899,0x1ab));var _0x9689=function(_0x203acc,_0x4338dc){_0x203acc=_0x203acc-0x0;var _0x133dc7=_0x6899[_0x203acc];return _0x133dc7;};'use strict';var Sequelize=require('sequelize');module[_0x9689('0x0')]={'calldate':{'type':Sequelize[_0x9689('0x1')],'allowNull':![],'defaultValue':_0x9689('0x2')},'clid':{'type':Sequelize[_0x9689('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x9689('0x3')]},'dcontext':{'type':Sequelize[_0x9689('0x3')]},'channel':{'type':Sequelize[_0x9689('0x3')]},'dstchannel':{'type':Sequelize[_0x9689('0x3')]},'lastapp':{'type':Sequelize[_0x9689('0x3')]},'lastdata':{'type':Sequelize[_0x9689('0x3')]},'duration':{'type':Sequelize[_0x9689('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9689('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9689('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9689('0x3')]},'userfield':{'type':Sequelize[_0x9689('0x3')]},'uniqueid':{'type':Sequelize[_0x9689('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x9689('0x3')]},'peeraccount':{'type':Sequelize[_0x9689('0x3')]},'type':{'type':Sequelize[_0x9689('0x3')]},'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 93ded04..46ecd0e 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 _0x1ebe=['keys','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','name','Cdr','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x49e9cc,_0xd2239){var _0x3a1c4c=function(_0x24aa73){while(--_0x24aa73){_0x49e9cc['push'](_0x49e9cc['shift']());}};_0x3a1c4c(++_0xd2239);}(_0x1ebe,0x12c));var _0xe1eb=function(_0x1907f3,_0x4bda55){_0x1907f3=_0x1907f3-0x0;var _0x1fcc14=_0x1ebe[_0x1907f3];return _0x1fcc14;};'use strict';var pdf=require(_0xe1eb('0x0'));var emlformat=require(_0xe1eb('0x1'));var rimraf=require(_0xe1eb('0x2'));var zipdir=require(_0xe1eb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1eb('0x4'));var moment=require(_0xe1eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe1eb('0x6'));var util=require(_0xe1eb('0x7'));var path=require(_0xe1eb('0x8'));var sox=require(_0xe1eb('0x9'));var csv=require(_0xe1eb('0xa'));var ejs=require(_0xe1eb('0xb'));var fs=require('fs');var _=require(_0xe1eb('0xc'));var squel=require(_0xe1eb('0xd'));var crypto=require(_0xe1eb('0xe'));var jsforce=require(_0xe1eb('0xf'));var deskjs=require(_0xe1eb('0x10'));var toCsv=require(_0xe1eb('0xa'));var querystring=require(_0xe1eb('0x11'));var Papa=require(_0xe1eb('0x12'));var Redis=require('ioredis');var authService=require(_0xe1eb('0x13'));var qs=require(_0xe1eb('0x14'));var as=require(_0xe1eb('0x15'));var hardwareService=require(_0xe1eb('0x16'));var logger=require(_0xe1eb('0x17'))('api');var utils=require(_0xe1eb('0x18'));var config=require('../../config/environment');var db=require(_0xe1eb('0x19'))['db'];function respondWithStatusCode(_0x1f30bb,_0x3fd20b){_0x3fd20b=_0x3fd20b||0xcc;return function(_0x56e12a){if(_0x56e12a){return _0x1f30bb['sendStatus'](_0x3fd20b);}return _0x1f30bb[_0xe1eb('0x1a')](_0x3fd20b)[_0xe1eb('0x1b')]();};}function respondWithResult(_0x33d9b5,_0x5498a6){_0x5498a6=_0x5498a6||0xc8;return function(_0x532e96){if(_0x532e96){return _0x33d9b5[_0xe1eb('0x1a')](_0x5498a6)[_0xe1eb('0x1c')](_0x532e96);}};}function respondWithFilteredResult(_0x459abe,_0x383489){return function(_0x2a5558){if(_0x2a5558){var _0x1ca8e7=_0x2a5558[_0xe1eb('0x1d')],_0x5c08f2=_0x383489[_0xe1eb('0x1e')],_0x473eaf=_0x383489[_0xe1eb('0x1e')]+_0x383489['limit'],_0x2a7005;if(_0x473eaf>=_0x1ca8e7){_0x473eaf=_0x1ca8e7;_0x2a7005=0xc8;}else{_0x2a7005=0xce;}_0x459abe[_0xe1eb('0x1a')](_0x2a7005);return _0x459abe['set'](_0xe1eb('0x1f'),_0x5c08f2+'-'+_0x473eaf+'/'+_0x1ca8e7)[_0xe1eb('0x1c')](_0x2a5558);}return null;};}function patchUpdates(_0x5b2546){return function(_0x4572ee){try{jsonpatch[_0xe1eb('0x20')](_0x4572ee,_0x5b2546,!![]);}catch(_0x34af40){return BPromise[_0xe1eb('0x21')](_0x34af40);}return _0x4572ee[_0xe1eb('0x22')]();};}function saveUpdates(_0x253384,_0x38081){return function(_0x2d51e0){if(_0x2d51e0){return _0x2d51e0[_0xe1eb('0x23')](_0x253384)[_0xe1eb('0x24')](function(_0x228746){return _0x228746;});}return null;};}function removeEntity(_0x356ce8,_0x13ff2c){return function(_0x3a4a5c){if(_0x3a4a5c){return _0x3a4a5c['destroy']()[_0xe1eb('0x24')](function(){_0x356ce8[_0xe1eb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c9bb1,_0x538015){return function(_0x255935){if(!_0x255935){_0x2c9bb1[_0xe1eb('0x25')](0x194);}return _0x255935;};}function handleError(_0x338679,_0x4f91e4){_0x4f91e4=_0x4f91e4||0x1f4;return function(_0x1bb1b2){logger[_0xe1eb('0x26')](_0x1bb1b2['stack']);if(_0x1bb1b2[_0xe1eb('0x27')]){delete _0x1bb1b2[_0xe1eb('0x27')];}_0x338679[_0xe1eb('0x1a')](_0x4f91e4)['send'](_0x1bb1b2);};}exports['index']=function(_0x5574e8,_0x1e5315){var _0xdea203={},_0x11c139={},_0x23bef={'count':0x0,'rows':[]};var _0x40df6a=_['map'](db[_0xe1eb('0x28')][_0xe1eb('0x29')],function(_0x5f12df){return{'name':_0x5f12df[_0xe1eb('0x2a')],'type':_0x5f12df[_0xe1eb('0x2b')][_0xe1eb('0x2c')]};});_0x11c139[_0xe1eb('0x2d')]=_[_0xe1eb('0x2e')](_0x40df6a,_0xe1eb('0x27'));_0x11c139[_0xe1eb('0x2f')]=_['keys'](_0x5574e8['query']);_0x11c139[_0xe1eb('0x30')]=_[_0xe1eb('0x31')](_0x11c139[_0xe1eb('0x2d')],_0x11c139[_0xe1eb('0x2f')]);_0xdea203[_0xe1eb('0x32')]=_[_0xe1eb('0x31')](_0x11c139[_0xe1eb('0x2d')],qs['fields'](_0x5574e8[_0xe1eb('0x2f')][_0xe1eb('0x33')]));_0xdea203[_0xe1eb('0x32')]=_0xdea203[_0xe1eb('0x32')][_0xe1eb('0x34')]?_0xdea203[_0xe1eb('0x32')]:_0x11c139[_0xe1eb('0x2d')];if(!_0x5574e8[_0xe1eb('0x2f')][_0xe1eb('0x35')](_0xe1eb('0x36'))){_0xdea203[_0xe1eb('0x37')]=qs[_0xe1eb('0x37')](_0x5574e8[_0xe1eb('0x2f')][_0xe1eb('0x37')]);_0xdea203[_0xe1eb('0x1e')]=qs[_0xe1eb('0x1e')](_0x5574e8[_0xe1eb('0x2f')]['offset']);}_0xdea203['order']=qs[_0xe1eb('0x38')](_0x5574e8[_0xe1eb('0x2f')][_0xe1eb('0x38')]);_0xdea203[_0xe1eb('0x39')]=qs[_0xe1eb('0x30')](_[_0xe1eb('0x3a')](_0x5574e8[_0xe1eb('0x2f')],_0x11c139['filters']),_0x40df6a);if(_0x5574e8['query'][_0xe1eb('0x3b')]){_0xdea203[_0xe1eb('0x39')]=_[_0xe1eb('0x3c')](_0xdea203[_0xe1eb('0x39')],{'$or':_[_0xe1eb('0x2e')](_0x40df6a,function(_0x2d00a8){if(_0x2d00a8[_0xe1eb('0x2b')]!==_0xe1eb('0x3d')){var _0x2d889a={};_0x2d889a[_0x2d00a8[_0xe1eb('0x27')]]={'$like':'%'+_0x5574e8['query']['filter']+'%'};return _0x2d889a;}})});}_0xdea203=_[_0xe1eb('0x3c')]({},_0xdea203,_0x5574e8[_0xe1eb('0x3e')]);var _0x310e7e={'where':_0xdea203[_0xe1eb('0x39')]};return db[_0xe1eb('0x28')][_0xe1eb('0x1d')](_0x310e7e)[_0xe1eb('0x24')](function(_0x182792){_0x23bef[_0xe1eb('0x1d')]=_0x182792;if(_0x5574e8[_0xe1eb('0x2f')][_0xe1eb('0x3f')]){_0xdea203[_0xe1eb('0x40')]=[{'all':!![]}];}return db[_0xe1eb('0x28')][_0xe1eb('0x41')](_0xdea203);})[_0xe1eb('0x24')](function(_0x23e89d){_0x23bef[_0xe1eb('0x42')]=_0x23e89d;return _0x23bef;})[_0xe1eb('0x24')](respondWithFilteredResult(_0x1e5315,_0xdea203))[_0xe1eb('0x43')](handleError(_0x1e5315,null));};exports[_0xe1eb('0x44')]=function(_0x945dbb,_0x558caf){var _0x4500a2={'raw':!![],'where':{'id':_0x945dbb[_0xe1eb('0x45')]['id']}},_0x412168={};_0x412168[_0xe1eb('0x2d')]=_['keys'](db[_0xe1eb('0x28')][_0xe1eb('0x29')]);_0x412168['query']=_[_0xe1eb('0x46')](_0x945dbb['query']);_0x412168[_0xe1eb('0x30')]=_[_0xe1eb('0x31')](_0x412168[_0xe1eb('0x2d')],_0x412168[_0xe1eb('0x2f')]);_0x4500a2['attributes']=_[_0xe1eb('0x31')](_0x412168[_0xe1eb('0x2d')],qs[_0xe1eb('0x33')](_0x945dbb[_0xe1eb('0x2f')][_0xe1eb('0x33')]));_0x4500a2['attributes']=_0x4500a2[_0xe1eb('0x32')]['length']?_0x4500a2[_0xe1eb('0x32')]:_0x412168[_0xe1eb('0x2d')];if(_0x945dbb[_0xe1eb('0x2f')][_0xe1eb('0x3f')]){_0x4500a2[_0xe1eb('0x40')]=[{'all':!![]}];}_0x4500a2=_[_0xe1eb('0x3c')]({},_0x4500a2,_0x945dbb[_0xe1eb('0x3e')]);return db[_0xe1eb('0x28')]['find'](_0x4500a2)[_0xe1eb('0x24')](handleEntityNotFound(_0x558caf,null))[_0xe1eb('0x24')](respondWithResult(_0x558caf,null))[_0xe1eb('0x43')](handleError(_0x558caf,null));};exports[_0xe1eb('0x47')]=function(_0x1a90b4,_0x2782a0){return db[_0xe1eb('0x28')][_0xe1eb('0x47')](_0x1a90b4[_0xe1eb('0x48')],{})[_0xe1eb('0x24')](respondWithResult(_0x2782a0,0xc9))['catch'](handleError(_0x2782a0,null));};exports[_0xe1eb('0x23')]=function(_0x22f9d4,_0x4cf143){if(_0x22f9d4[_0xe1eb('0x48')]['id']){delete _0x22f9d4['body']['id'];}return db['Cdr'][_0xe1eb('0x49')]({'where':{'id':_0x22f9d4[_0xe1eb('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cf143,null))['then'](saveUpdates(_0x22f9d4['body'],null))['then'](respondWithResult(_0x4cf143,null))[_0xe1eb('0x43')](handleError(_0x4cf143,null));};exports['destroy']=function(_0x4bb891,_0x4108f2){return db[_0xe1eb('0x28')][_0xe1eb('0x49')]({'where':{'id':_0x4bb891['params']['id']}})['then'](handleEntityNotFound(_0x4108f2,null))['then'](removeEntity(_0x4108f2,null))[_0xe1eb('0x43')](handleError(_0x4108f2,null));};exports['describe']=function(_0x13e0e3,_0x45a0d5){return db['Cdr']['describe']()[_0xe1eb('0x24')](respondWithResult(_0x45a0d5,null))[_0xe1eb('0x43')](handleError(_0x45a0d5,null));}; \ No newline at end of file +var _0x6000=['bluebird','mustache','path','lodash','squel','crypto','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','sendStatus','json','count','offset','limit','status','set','Content-Range','reject','then','destroy','end','error','stack','send','index','Cdr','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x18ad14,_0x4a4127){var _0x511e6e=function(_0x57c889){while(--_0x57c889){_0x18ad14['push'](_0x18ad14['shift']());}};_0x511e6e(++_0x4a4127);}(_0x6000,0xd7));var _0x0600=function(_0x50d401,_0x49c3ba){_0x50d401=_0x50d401-0x0;var _0xc462ed=_0x6000[_0x50d401];return _0xc462ed;};'use strict';var pdf=require(_0x0600('0x0'));var emlformat=require(_0x0600('0x1'));var rimraf=require(_0x0600('0x2'));var zipdir=require(_0x0600('0x3'));var jsonpatch=require(_0x0600('0x4'));var rp=require(_0x0600('0x5'));var moment=require(_0x0600('0x6'));var BPromise=require(_0x0600('0x7'));var Mustache=require(_0x0600('0x8'));var util=require('util');var path=require(_0x0600('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0600('0xa'));var squel=require(_0x0600('0xb'));var crypto=require(_0x0600('0xc'));var jsforce=require(_0x0600('0xd'));var deskjs=require(_0x0600('0xe'));var toCsv=require(_0x0600('0xf'));var querystring=require(_0x0600('0x10'));var Papa=require(_0x0600('0x11'));var Redis=require('ioredis');var authService=require(_0x0600('0x12'));var qs=require(_0x0600('0x13'));var as=require(_0x0600('0x14'));var hardwareService=require(_0x0600('0x15'));var logger=require(_0x0600('0x16'))('api');var utils=require(_0x0600('0x17'));var config=require(_0x0600('0x18'));var db=require(_0x0600('0x19'))['db'];function respondWithStatusCode(_0x3b1f1f,_0x1147db){_0x1147db=_0x1147db||0xcc;return function(_0xbdf8c1){if(_0xbdf8c1){return _0x3b1f1f[_0x0600('0x1a')](_0x1147db);}return _0x3b1f1f['status'](_0x1147db)['end']();};}function respondWithResult(_0x448a1a,_0x27811c){_0x27811c=_0x27811c||0xc8;return function(_0x14d7fd){if(_0x14d7fd){return _0x448a1a['status'](_0x27811c)[_0x0600('0x1b')](_0x14d7fd);}};}function respondWithFilteredResult(_0x536247,_0x4b4961){return function(_0x429874){if(_0x429874){var _0x42b1f2=_0x429874[_0x0600('0x1c')],_0x368165=_0x4b4961[_0x0600('0x1d')],_0x40d82d=_0x4b4961[_0x0600('0x1d')]+_0x4b4961[_0x0600('0x1e')],_0x3b23c9;if(_0x40d82d>=_0x42b1f2){_0x40d82d=_0x42b1f2;_0x3b23c9=0xc8;}else{_0x3b23c9=0xce;}_0x536247[_0x0600('0x1f')](_0x3b23c9);return _0x536247[_0x0600('0x20')](_0x0600('0x21'),_0x368165+'-'+_0x40d82d+'/'+_0x42b1f2)[_0x0600('0x1b')](_0x429874);}return null;};}function patchUpdates(_0x2ef193){return function(_0x1ebac6){try{jsonpatch['apply'](_0x1ebac6,_0x2ef193,!![]);}catch(_0x5e3323){return BPromise[_0x0600('0x22')](_0x5e3323);}return _0x1ebac6['save']();};}function saveUpdates(_0x56a5a9,_0x16352e){return function(_0x534bca){if(_0x534bca){return _0x534bca['update'](_0x56a5a9)[_0x0600('0x23')](function(_0x58f7a4){return _0x58f7a4;});}return null;};}function removeEntity(_0x126448,_0x50ceaf){return function(_0x3e7b87){if(_0x3e7b87){return _0x3e7b87[_0x0600('0x24')]()[_0x0600('0x23')](function(){_0x126448[_0x0600('0x1f')](0xcc)[_0x0600('0x25')]();});}};}function handleEntityNotFound(_0x40d3f0,_0x189a56){return function(_0x5ef3e6){if(!_0x5ef3e6){_0x40d3f0[_0x0600('0x1a')](0x194);}return _0x5ef3e6;};}function handleError(_0x31e6cc,_0x544c9c){_0x544c9c=_0x544c9c||0x1f4;return function(_0xd1fa91){logger[_0x0600('0x26')](_0xd1fa91[_0x0600('0x27')]);if(_0xd1fa91['name']){delete _0xd1fa91['name'];}_0x31e6cc[_0x0600('0x1f')](_0x544c9c)[_0x0600('0x28')](_0xd1fa91);};}exports[_0x0600('0x29')]=function(_0x5b1886,_0x3a3c39){var _0x378361={},_0x62a29c={},_0xbe1af8={'count':0x0,'rows':[]};var _0x191185=_['map'](db[_0x0600('0x2a')][_0x0600('0x2b')],function(_0xb9d968){return{'name':_0xb9d968[_0x0600('0x2c')],'type':_0xb9d968['type'][_0x0600('0x2d')]};});_0x62a29c[_0x0600('0x2e')]=_[_0x0600('0x2f')](_0x191185,_0x0600('0x30'));_0x62a29c[_0x0600('0x31')]=_[_0x0600('0x32')](_0x5b1886[_0x0600('0x31')]);_0x62a29c[_0x0600('0x33')]=_[_0x0600('0x34')](_0x62a29c[_0x0600('0x2e')],_0x62a29c[_0x0600('0x31')]);_0x378361[_0x0600('0x35')]=_[_0x0600('0x34')](_0x62a29c[_0x0600('0x2e')],qs['fields'](_0x5b1886['query'][_0x0600('0x36')]));_0x378361[_0x0600('0x35')]=_0x378361[_0x0600('0x35')][_0x0600('0x37')]?_0x378361['attributes']:_0x62a29c[_0x0600('0x2e')];if(!_0x5b1886[_0x0600('0x31')]['hasOwnProperty'](_0x0600('0x38'))){_0x378361[_0x0600('0x1e')]=qs[_0x0600('0x1e')](_0x5b1886['query'][_0x0600('0x1e')]);_0x378361['offset']=qs[_0x0600('0x1d')](_0x5b1886['query'][_0x0600('0x1d')]);}_0x378361['order']=qs['sort'](_0x5b1886[_0x0600('0x31')]['sort']);_0x378361[_0x0600('0x39')]=qs[_0x0600('0x33')](_[_0x0600('0x3a')](_0x5b1886[_0x0600('0x31')],_0x62a29c[_0x0600('0x33')]),_0x191185);if(_0x5b1886[_0x0600('0x31')][_0x0600('0x3b')]){_0x378361[_0x0600('0x39')]=_[_0x0600('0x3c')](_0x378361['where'],{'$or':_[_0x0600('0x2f')](_0x191185,function(_0x22fd82){if(_0x22fd82[_0x0600('0x3d')]!==_0x0600('0x3e')){var _0x496f33={};_0x496f33[_0x22fd82[_0x0600('0x30')]]={'$like':'%'+_0x5b1886[_0x0600('0x31')][_0x0600('0x3b')]+'%'};return _0x496f33;}})});}_0x378361=_[_0x0600('0x3c')]({},_0x378361,_0x5b1886[_0x0600('0x3f')]);var _0x2b89bd={'where':_0x378361[_0x0600('0x39')]};return db[_0x0600('0x2a')][_0x0600('0x1c')](_0x2b89bd)[_0x0600('0x23')](function(_0x2d179b){_0xbe1af8[_0x0600('0x1c')]=_0x2d179b;if(_0x5b1886[_0x0600('0x31')]['includeAll']){_0x378361['include']=[{'all':!![]}];}return db[_0x0600('0x2a')][_0x0600('0x40')](_0x378361);})[_0x0600('0x23')](function(_0x5dd571){_0xbe1af8[_0x0600('0x41')]=_0x5dd571;return _0xbe1af8;})['then'](respondWithFilteredResult(_0x3a3c39,_0x378361))[_0x0600('0x42')](handleError(_0x3a3c39,null));};exports[_0x0600('0x43')]=function(_0x289cfd,_0x479a61){var _0x4c3e4f={'raw':!![],'where':{'id':_0x289cfd[_0x0600('0x44')]['id']}},_0x32fe70={};_0x32fe70[_0x0600('0x2e')]=_[_0x0600('0x32')](db['Cdr'][_0x0600('0x2b')]);_0x32fe70[_0x0600('0x31')]=_[_0x0600('0x32')](_0x289cfd[_0x0600('0x31')]);_0x32fe70['filters']=_[_0x0600('0x34')](_0x32fe70[_0x0600('0x2e')],_0x32fe70[_0x0600('0x31')]);_0x4c3e4f[_0x0600('0x35')]=_[_0x0600('0x34')](_0x32fe70[_0x0600('0x2e')],qs[_0x0600('0x36')](_0x289cfd[_0x0600('0x31')][_0x0600('0x36')]));_0x4c3e4f['attributes']=_0x4c3e4f['attributes'][_0x0600('0x37')]?_0x4c3e4f[_0x0600('0x35')]:_0x32fe70[_0x0600('0x2e')];if(_0x289cfd[_0x0600('0x31')][_0x0600('0x45')]){_0x4c3e4f[_0x0600('0x46')]=[{'all':!![]}];}_0x4c3e4f=_[_0x0600('0x3c')]({},_0x4c3e4f,_0x289cfd['options']);return db[_0x0600('0x2a')][_0x0600('0x47')](_0x4c3e4f)[_0x0600('0x23')](handleEntityNotFound(_0x479a61,null))[_0x0600('0x23')](respondWithResult(_0x479a61,null))['catch'](handleError(_0x479a61,null));};exports[_0x0600('0x48')]=function(_0x20edfb,_0x26fd37){return db['Cdr']['create'](_0x20edfb[_0x0600('0x49')],{})['then'](respondWithResult(_0x26fd37,0xc9))['catch'](handleError(_0x26fd37,null));};exports['update']=function(_0x16e2ef,_0x181fc9){if(_0x16e2ef[_0x0600('0x49')]['id']){delete _0x16e2ef[_0x0600('0x49')]['id'];}return db[_0x0600('0x2a')][_0x0600('0x47')]({'where':{'id':_0x16e2ef['params']['id']}})[_0x0600('0x23')](handleEntityNotFound(_0x181fc9,null))[_0x0600('0x23')](saveUpdates(_0x16e2ef[_0x0600('0x49')],null))[_0x0600('0x23')](respondWithResult(_0x181fc9,null))[_0x0600('0x42')](handleError(_0x181fc9,null));};exports[_0x0600('0x24')]=function(_0x43f1f1,_0x33e253){return db[_0x0600('0x2a')][_0x0600('0x47')]({'where':{'id':_0x43f1f1['params']['id']}})['then'](handleEntityNotFound(_0x33e253,null))['then'](removeEntity(_0x33e253,null))['catch'](handleError(_0x33e253,null));};exports['describe']=function(_0x20bd31,_0x53deca){return db['Cdr']['describe']()[_0x0600('0x23')](respondWithResult(_0x53deca,null))[_0x0600('0x42')](handleError(_0x53deca,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index cbe645b..20b2a0f 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 _0x8687=['../../config/logger','moment','bluebird','path','../../config/environment','./cdr.attributes','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util'];(function(_0xba6134,_0x5281e3){var _0xbce6c2=function(_0x2841bc){while(--_0x2841bc){_0xba6134['push'](_0xba6134['shift']());}};_0xbce6c2(++_0x5281e3);}(_0x8687,0x1b1));var _0x7868=function(_0x5680ff,_0x39e7ff){_0x5680ff=_0x5680ff-0x0;var _0x91592a=_0x8687[_0x5680ff];return _0x91592a;};'use strict';var _=require(_0x7868('0x0'));var util=require(_0x7868('0x1'));var logger=require(_0x7868('0x2'))('api');var moment=require(_0x7868('0x3'));var BPromise=require(_0x7868('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7868('0x5'));var rimraf=require('rimraf');var config=require(_0x7868('0x6'));var attributes=require(_0x7868('0x7'));module['exports']=function(_0x1bccf6,_0x1b2149){return _0x1bccf6['define']('Cdr',attributes,{'tableName':_0x7868('0x8'),'paranoid':![],'indexes':[{'name':_0x7868('0x9'),'fields':[_0x7868('0x9')]},{'name':_0x7868('0xa'),'fields':[_0x7868('0xa')]},{'name':_0x7868('0xb'),'fields':[_0x7868('0xb')]},{'name':_0x7868('0xc'),'fields':[_0x7868('0xc')]},{'name':_0x7868('0xd'),'fields':['src']},{'name':'uniqueid','fields':[_0x7868('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x92af=['disposition','dst','src','uniqueid','lodash','util','api','moment','request-promise','path','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','calldate'];(function(_0x2b27a5,_0x2110d8){var _0x11d9cb=function(_0x4d6142){while(--_0x4d6142){_0x2b27a5['push'](_0x2b27a5['shift']());}};_0x11d9cb(++_0x2110d8);}(_0x92af,0x1cf));var _0xf92a=function(_0x46be5f,_0x160ce5){_0x46be5f=_0x46be5f-0x0;var _0x54ef83=_0x92af[_0x46be5f];return _0x54ef83;};'use strict';var _=require(_0xf92a('0x0'));var util=require(_0xf92a('0x1'));var logger=require('../../config/logger')(_0xf92a('0x2'));var moment=require(_0xf92a('0x3'));var BPromise=require('bluebird');var rp=require(_0xf92a('0x4'));var fs=require('fs');var path=require(_0xf92a('0x5'));var rimraf=require('rimraf');var config=require(_0xf92a('0x6'));var attributes=require(_0xf92a('0x7'));module[_0xf92a('0x8')]=function(_0x246dd7,_0x255e1d){return _0x246dd7[_0xf92a('0x9')](_0xf92a('0xa'),attributes,{'tableName':_0xf92a('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':['accountcode']},{'name':_0xf92a('0xc'),'fields':[_0xf92a('0xc')]},{'name':_0xf92a('0xd'),'fields':[_0xf92a('0xd')]},{'name':_0xf92a('0xe'),'fields':[_0xf92a('0xe')]},{'name':'src','fields':[_0xf92a('0xf')]},{'name':_0xf92a('0x10'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index dfcbbb8..8fae1f7 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 _0x0dd2=['code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0x0dd2,0x8f));var _0x20dd=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0x0dd2[_0x2a8c21];return _0x5f3061;};'use strict';var _=require(_0x20dd('0x0'));var util=require('util');var moment=require(_0x20dd('0x1'));var BPromise=require(_0x20dd('0x2'));var rs=require(_0x20dd('0x3'));var fs=require('fs');var Redis=require(_0x20dd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20dd('0x5'));var logger=require(_0x20dd('0x6'))('rpc');var config=require(_0x20dd('0x7'));var jayson=require(_0x20dd('0x8'));var client=jayson[_0x20dd('0x9')][_0x20dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fe98e,_0xdb16b2,_0x49aa93){return new BPromise(function(_0x1ab814,_0x1a6ac4){return client['request'](_0x2fe98e,_0x49aa93)[_0x20dd('0xb')](function(_0x2267df){logger['info'](_0x20dd('0xc'),_0xdb16b2,_0x20dd('0xd'));logger[_0x20dd('0xe')](_0x20dd('0xf'),_0xdb16b2,_0x20dd('0xd'),JSON[_0x20dd('0x10')](_0x2267df));if(_0x2267df[_0x20dd('0x11')]){if(_0x2267df[_0x20dd('0x11')][_0x20dd('0x12')]===0x1f4){logger[_0x20dd('0x11')](_0x20dd('0xc'),_0xdb16b2,_0x2267df[_0x20dd('0x11')][_0x20dd('0x13')]);return _0x1a6ac4(_0x2267df['error']['message']);}logger['error'](_0x20dd('0xc'),_0xdb16b2,_0x2267df[_0x20dd('0x11')][_0x20dd('0x13')]);return _0x1ab814(_0x2267df[_0x20dd('0x11')][_0x20dd('0x13')]);}else{logger[_0x20dd('0x14')](_0x20dd('0xc'),_0xdb16b2,_0x20dd('0xd'));_0x1ab814(_0x2267df[_0x20dd('0x15')][_0x20dd('0x13')]);}})[_0x20dd('0x16')](function(_0x552761){logger[_0x20dd('0x11')](_0x20dd('0xc'),_0xdb16b2,_0x552761);_0x1a6ac4(_0x552761);});});} \ No newline at end of file +var _0xe379=['Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','request\x20sent','stringify','error','code'];(function(_0x4d5cc5,_0x3d3e80){var _0x5492bf=function(_0xf620eb){while(--_0xf620eb){_0x4d5cc5['push'](_0x4d5cc5['shift']());}};_0x5492bf(++_0x3d3e80);}(_0xe379,0x1bc));var _0x9e37=function(_0x7bd5d6,_0x335a31){_0x7bd5d6=_0x7bd5d6-0x0;var _0x4838e8=_0xe379[_0x7bd5d6];return _0x4838e8;};'use strict';var _=require(_0x9e37('0x0'));var util=require(_0x9e37('0x1'));var moment=require('moment');var BPromise=require(_0x9e37('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e37('0x3'));var db=require(_0x9e37('0x4'))['db'];var utils=require(_0x9e37('0x5'));var logger=require(_0x9e37('0x6'))(_0x9e37('0x7'));var config=require(_0x9e37('0x8'));var jayson=require(_0x9e37('0x9'));var client=jayson['client'][_0x9e37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3100d8,_0x353d5b,_0x4c0ace){return new BPromise(function(_0x1940e1,_0x208be2){return client[_0x9e37('0xb')](_0x3100d8,_0x4c0ace)['then'](function(_0x446ff9){logger[_0x9e37('0xc')]('Cdr,\x20%s,\x20%s',_0x353d5b,'request\x20sent');logger[_0x9e37('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x353d5b,_0x9e37('0xe'),JSON[_0x9e37('0xf')](_0x446ff9));if(_0x446ff9['error']){if(_0x446ff9[_0x9e37('0x10')][_0x9e37('0x11')]===0x1f4){logger['error'](_0x9e37('0x12'),_0x353d5b,_0x446ff9['error'][_0x9e37('0x13')]);return _0x208be2(_0x446ff9[_0x9e37('0x10')]['message']);}logger[_0x9e37('0x10')](_0x9e37('0x12'),_0x353d5b,_0x446ff9[_0x9e37('0x10')][_0x9e37('0x13')]);return _0x1940e1(_0x446ff9[_0x9e37('0x10')][_0x9e37('0x13')]);}else{logger['info'](_0x9e37('0x12'),_0x353d5b,_0x9e37('0xe'));_0x1940e1(_0x446ff9[_0x9e37('0x14')][_0x9e37('0x13')]);}})[_0x9e37('0x15')](function(_0x3123bb){logger['error'](_0x9e37('0x12'),_0x353d5b,_0x3123bb);_0x208be2(_0x3123bb);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 1c9fb3a..79f31dd 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 _0x6dd1=['./cdr.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x6dd1,0x109));var _0x16dd=function(_0x4546a6,_0x16e1cb){_0x4546a6=_0x4546a6-0x0;var _0x4e0db8=_0x6dd1[_0x4546a6];return _0x4e0db8;};'use strict';var multer=require(_0x16dd('0x0'));var util=require(_0x16dd('0x1'));var path=require(_0x16dd('0x2'));var timeout=require('connect-timeout');var express=require(_0x16dd('0x3'));var router=express[_0x16dd('0x4')]();var auth=require(_0x16dd('0x5'));var interaction=require(_0x16dd('0x6'));var config=require(_0x16dd('0x7'));var controller=require(_0x16dd('0x8'));router[_0x16dd('0x9')]('/',auth[_0x16dd('0xa')](),controller['index']);router['get'](_0x16dd('0xb'),auth[_0x16dd('0xa')](),controller['describe']);router[_0x16dd('0x9')](_0x16dd('0xc'),auth[_0x16dd('0xa')](),controller[_0x16dd('0xd')]);router[_0x16dd('0xe')]('/',auth[_0x16dd('0xa')](),controller[_0x16dd('0xf')]);router[_0x16dd('0x10')]('/:id',auth[_0x16dd('0xa')](),controller[_0x16dd('0x11')]);router[_0x16dd('0x12')](_0x16dd('0xc'),auth[_0x16dd('0xa')](),controller[_0x16dd('0x13')]);module[_0x16dd('0x14')]=router; \ No newline at end of file +var _0x817e=['../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','index','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x218def,_0x5e5a97){var _0x1b710b=function(_0x496b60){while(--_0x496b60){_0x218def['push'](_0x218def['shift']());}};_0x1b710b(++_0x5e5a97);}(_0x817e,0x13e));var _0xe817=function(_0x42dbb5,_0x79db41){_0x42dbb5=_0x42dbb5-0x0;var _0x4158a3=_0x817e[_0x42dbb5];return _0x4158a3;};'use strict';var multer=require(_0xe817('0x0'));var util=require(_0xe817('0x1'));var path=require(_0xe817('0x2'));var timeout=require('connect-timeout');var express=require(_0xe817('0x3'));var router=express[_0xe817('0x4')]();var auth=require(_0xe817('0x5'));var interaction=require(_0xe817('0x6'));var config=require('../../config/environment');var controller=require(_0xe817('0x7'));router[_0xe817('0x8')]('/',auth[_0xe817('0x9')](),controller[_0xe817('0xa')]);router['get']('/describe',auth[_0xe817('0x9')](),controller[_0xe817('0xb')]);router[_0xe817('0x8')](_0xe817('0xc'),auth[_0xe817('0x9')](),controller['show']);router[_0xe817('0xd')]('/',auth[_0xe817('0x9')](),controller[_0xe817('0xe')]);router[_0xe817('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe817('0x10')](_0xe817('0xc'),auth[_0xe817('0x9')](),controller[_0xe817('0x11')]);module[_0xe817('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index cf3b3ac..834a84e 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 _0xf10d=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0xf0254e,_0x1a61fc){var _0x1a6953=function(_0x369243){while(--_0x369243){_0xf0254e['push'](_0xf0254e['shift']());}};_0x1a6953(++_0x1a61fc);}(_0xf10d,0xec));var _0xdf10=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xf10d[_0x2d61b2];return _0x12df89;};'use strict';var Sequelize=require('sequelize');module[_0xdf10('0x0')]={'priority':{'type':Sequelize[_0xdf10('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdf10('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdf10('0x3')]()},'description':{'type':Sequelize[_0xdf10('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdf10('0x4')}}; \ No newline at end of file +var _0xf4db=['STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x9fbe0,_0x4b6bf5){var _0x1c8d7e=function(_0xbbcac4){while(--_0xbbcac4){_0x9fbe0['push'](_0x9fbe0['shift']());}};_0x1c8d7e(++_0x4b6bf5);}(_0xf4db,0xa3));var _0xbf4d=function(_0x1c72b8,_0x104b7e){_0x1c72b8=_0x1c72b8-0x0;var _0x191114=_0xf4db[_0x1c72b8];return _0x191114;};'use strict';var Sequelize=require(_0xbf4d('0x0'));module[_0xbf4d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbf4d('0x2')],'allowNull':![],'defaultValue':_0xbf4d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbf4d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbf4d('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 16ad824..8ebda7e 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 _0x656f=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','params','model','keys','ChatApplication','query','filters','intersection','fields','attributes','include','merge','options','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','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','../../mysqldb','sendStatus','status','count'];(function(_0xb98825,_0x554182){var _0x451d90=function(_0x1e2b76){while(--_0x1e2b76){_0xb98825['push'](_0xb98825['shift']());}};_0x451d90(++_0x554182);}(_0x656f,0x17b));var _0xf656=function(_0x22bf45,_0x5d3a41){_0x22bf45=_0x22bf45-0x0;var _0x244d4a=_0x656f[_0x22bf45];return _0x244d4a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf656('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf656('0x1'));var jsonpatch=require(_0xf656('0x2'));var rp=require(_0xf656('0x3'));var moment=require(_0xf656('0x4'));var BPromise=require(_0xf656('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf656('0x6'));var csv=require('to-csv');var ejs=require(_0xf656('0x7'));var fs=require('fs');var _=require(_0xf656('0x8'));var squel=require(_0xf656('0x9'));var crypto=require(_0xf656('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf656('0xb'));var toCsv=require(_0xf656('0xc'));var querystring=require(_0xf656('0xd'));var Papa=require(_0xf656('0xe'));var Redis=require(_0xf656('0xf'));var authService=require(_0xf656('0x10'));var qs=require(_0xf656('0x11'));var as=require(_0xf656('0x12'));var hardwareService=require(_0xf656('0x13'));var logger=require('../../config/logger')(_0xf656('0x14'));var utils=require(_0xf656('0x15'));var config=require(_0xf656('0x16'));var db=require(_0xf656('0x17'))['db'];function respondWithStatusCode(_0x338057,_0x5dad8b){_0x5dad8b=_0x5dad8b||0xcc;return function(_0x46ec68){if(_0x46ec68){return _0x338057[_0xf656('0x18')](_0x5dad8b);}return _0x338057[_0xf656('0x19')](_0x5dad8b)['end']();};}function respondWithResult(_0x540b6f,_0x1a128f){_0x1a128f=_0x1a128f||0xc8;return function(_0x3b6f24){if(_0x3b6f24){return _0x540b6f[_0xf656('0x19')](_0x1a128f)['json'](_0x3b6f24);}};}function respondWithFilteredResult(_0xbe917e,_0x9a5bf1){return function(_0x4d105b){if(_0x4d105b){var _0x183f10=_0x4d105b[_0xf656('0x1a')],_0x3b8aec=_0x9a5bf1[_0xf656('0x1b')],_0x4aa1de=_0x9a5bf1[_0xf656('0x1b')]+_0x9a5bf1[_0xf656('0x1c')],_0x3a218b;if(_0x4aa1de>=_0x183f10){_0x4aa1de=_0x183f10;_0x3a218b=0xc8;}else{_0x3a218b=0xce;}_0xbe917e['status'](_0x3a218b);return _0xbe917e[_0xf656('0x1d')](_0xf656('0x1e'),_0x3b8aec+'-'+_0x4aa1de+'/'+_0x183f10)['json'](_0x4d105b);}return null;};}function patchUpdates(_0x499061){return function(_0x124c3f){try{jsonpatch[_0xf656('0x1f')](_0x124c3f,_0x499061,!![]);}catch(_0x26af19){return BPromise[_0xf656('0x20')](_0x26af19);}return _0x124c3f[_0xf656('0x21')]();};}function saveUpdates(_0x305b22,_0x4d46dd){return function(_0x2349a3){if(_0x2349a3){return _0x2349a3[_0xf656('0x22')](_0x305b22)[_0xf656('0x23')](function(_0xe4d6d4){return _0xe4d6d4;});}return null;};}function removeEntity(_0x6f1f6,_0xa004ee){return function(_0x7eb607){if(_0x7eb607){return _0x7eb607[_0xf656('0x24')]()['then'](function(){_0x6f1f6[_0xf656('0x19')](0xcc)[_0xf656('0x25')]();});}};}function handleEntityNotFound(_0x2535ae,_0x3b44dc){return function(_0x29e139){if(!_0x29e139){_0x2535ae['sendStatus'](0x194);}return _0x29e139;};}function handleError(_0x2130e4,_0xafedcc){_0xafedcc=_0xafedcc||0x1f4;return function(_0x1ce9ea){logger[_0xf656('0x26')](_0x1ce9ea[_0xf656('0x27')]);if(_0x1ce9ea[_0xf656('0x28')]){delete _0x1ce9ea[_0xf656('0x28')];}_0x2130e4[_0xf656('0x19')](_0xafedcc)[_0xf656('0x29')](_0x1ce9ea);};}exports[_0xf656('0x2a')]=function(_0x30b8a9,_0x163b60){var _0x5eace5={'raw':!![],'where':{'id':_0x30b8a9[_0xf656('0x2b')]['id']}},_0x523400={};_0x523400[_0xf656('0x2c')]=_[_0xf656('0x2d')](db[_0xf656('0x2e')]['rawAttributes']);_0x523400[_0xf656('0x2f')]=_['keys'](_0x30b8a9[_0xf656('0x2f')]);_0x523400[_0xf656('0x30')]=_[_0xf656('0x31')](_0x523400[_0xf656('0x2c')],_0x523400['query']);_0x5eace5['attributes']=_[_0xf656('0x31')](_0x523400[_0xf656('0x2c')],qs['fields'](_0x30b8a9[_0xf656('0x2f')][_0xf656('0x32')]));_0x5eace5[_0xf656('0x33')]=_0x5eace5['attributes']['length']?_0x5eace5[_0xf656('0x33')]:_0x523400[_0xf656('0x2c')];if(_0x30b8a9[_0xf656('0x2f')]['includeAll']){_0x5eace5[_0xf656('0x34')]=[{'all':!![]}];}_0x5eace5=_[_0xf656('0x35')]({},_0x5eace5,_0x30b8a9[_0xf656('0x36')]);return db['ChatApplication'][_0xf656('0x37')](_0x5eace5)['then'](handleEntityNotFound(_0x163b60,null))[_0xf656('0x23')](respondWithResult(_0x163b60,null))[_0xf656('0x38')](handleError(_0x163b60,null));};exports[_0xf656('0x22')]=function(_0x591231,_0x46d1fd){if(_0x591231['body']['id']){delete _0x591231[_0xf656('0x39')]['id'];}return db[_0xf656('0x2e')][_0xf656('0x37')]({'where':{'id':_0x591231[_0xf656('0x2b')]['id']}})[_0xf656('0x23')](handleEntityNotFound(_0x46d1fd,null))[_0xf656('0x23')](saveUpdates(_0x591231[_0xf656('0x39')],null))[_0xf656('0x23')](respondWithResult(_0x46d1fd,null))['catch'](handleError(_0x46d1fd,null));};exports[_0xf656('0x24')]=function(_0x4aae69,_0xfb1311){return db[_0xf656('0x2e')][_0xf656('0x37')]({'where':{'id':_0x4aae69['params']['id']}})[_0xf656('0x23')](handleEntityNotFound(_0xfb1311,null))['then'](removeEntity(_0xfb1311,null))[_0xf656('0x38')](handleError(_0xfb1311,null));}; \ No newline at end of file +var _0x8b4e=['query','filters','intersection','model','attributes','fields','length','include','merge','options','ChatApplication','find','catch','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','end','status','count','offset','limit','set','json','apply','save','update','then','destroy','sendStatus','error','stack','name','params','keys','rawAttributes'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0x8b4e,0xe2));var _0xe8b4=function(_0x1a6ab5,_0x4f26a6){_0x1a6ab5=_0x1a6ab5-0x0;var _0x145f68=_0x8b4e[_0x1a6ab5];return _0x145f68;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe8b4('0x0'));var zipdir=require(_0xe8b4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8b4('0x2'));var moment=require(_0xe8b4('0x3'));var BPromise=require(_0xe8b4('0x4'));var Mustache=require(_0xe8b4('0x5'));var util=require(_0xe8b4('0x6'));var path=require('path');var sox=require(_0xe8b4('0x7'));var csv=require('to-csv');var ejs=require(_0xe8b4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe8b4('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe8b4('0xa'));var querystring=require(_0xe8b4('0xb'));var Papa=require(_0xe8b4('0xc'));var Redis=require(_0xe8b4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe8b4('0xe'));var as=require(_0xe8b4('0xf'));var hardwareService=require(_0xe8b4('0x10'));var logger=require(_0xe8b4('0x11'))('api');var utils=require(_0xe8b4('0x12'));var config=require(_0xe8b4('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28ace0,_0x78d106){_0x78d106=_0x78d106||0xcc;return function(_0x9e65ee){if(_0x9e65ee){return _0x28ace0['sendStatus'](_0x78d106);}return _0x28ace0['status'](_0x78d106)[_0xe8b4('0x14')]();};}function respondWithResult(_0x45f903,_0x751daa){_0x751daa=_0x751daa||0xc8;return function(_0x218b36){if(_0x218b36){return _0x45f903[_0xe8b4('0x15')](_0x751daa)['json'](_0x218b36);}};}function respondWithFilteredResult(_0x3851aa,_0x20b81a){return function(_0x509cbd){if(_0x509cbd){var _0x4757bc=_0x509cbd[_0xe8b4('0x16')],_0x375ef6=_0x20b81a[_0xe8b4('0x17')],_0x434596=_0x20b81a[_0xe8b4('0x17')]+_0x20b81a[_0xe8b4('0x18')],_0x1626c8;if(_0x434596>=_0x4757bc){_0x434596=_0x4757bc;_0x1626c8=0xc8;}else{_0x1626c8=0xce;}_0x3851aa[_0xe8b4('0x15')](_0x1626c8);return _0x3851aa[_0xe8b4('0x19')]('Content-Range',_0x375ef6+'-'+_0x434596+'/'+_0x4757bc)[_0xe8b4('0x1a')](_0x509cbd);}return null;};}function patchUpdates(_0x3e4729){return function(_0x376760){try{jsonpatch[_0xe8b4('0x1b')](_0x376760,_0x3e4729,!![]);}catch(_0x1421cf){return BPromise['reject'](_0x1421cf);}return _0x376760[_0xe8b4('0x1c')]();};}function saveUpdates(_0x344a2b,_0x58f76c){return function(_0x3f5fa4){if(_0x3f5fa4){return _0x3f5fa4[_0xe8b4('0x1d')](_0x344a2b)[_0xe8b4('0x1e')](function(_0x5d18ba){return _0x5d18ba;});}return null;};}function removeEntity(_0x11d671,_0x2a865b){return function(_0x153b51){if(_0x153b51){return _0x153b51[_0xe8b4('0x1f')]()['then'](function(){_0x11d671[_0xe8b4('0x15')](0xcc)[_0xe8b4('0x14')]();});}};}function handleEntityNotFound(_0x55da4c,_0x284d4c){return function(_0x22d35a){if(!_0x22d35a){_0x55da4c[_0xe8b4('0x20')](0x194);}return _0x22d35a;};}function handleError(_0x82484,_0x52c611){_0x52c611=_0x52c611||0x1f4;return function(_0x22dcdd){logger[_0xe8b4('0x21')](_0x22dcdd[_0xe8b4('0x22')]);if(_0x22dcdd[_0xe8b4('0x23')]){delete _0x22dcdd[_0xe8b4('0x23')];}_0x82484[_0xe8b4('0x15')](_0x52c611)['send'](_0x22dcdd);};}exports['show']=function(_0x431d5c,_0x1cb7c7){var _0x2adf3c={'raw':!![],'where':{'id':_0x431d5c[_0xe8b4('0x24')]['id']}},_0x5b6ad7={};_0x5b6ad7['model']=_[_0xe8b4('0x25')](db['ChatApplication'][_0xe8b4('0x26')]);_0x5b6ad7[_0xe8b4('0x27')]=_['keys'](_0x431d5c[_0xe8b4('0x27')]);_0x5b6ad7[_0xe8b4('0x28')]=_[_0xe8b4('0x29')](_0x5b6ad7[_0xe8b4('0x2a')],_0x5b6ad7[_0xe8b4('0x27')]);_0x2adf3c[_0xe8b4('0x2b')]=_[_0xe8b4('0x29')](_0x5b6ad7[_0xe8b4('0x2a')],qs['fields'](_0x431d5c[_0xe8b4('0x27')][_0xe8b4('0x2c')]));_0x2adf3c[_0xe8b4('0x2b')]=_0x2adf3c[_0xe8b4('0x2b')][_0xe8b4('0x2d')]?_0x2adf3c['attributes']:_0x5b6ad7[_0xe8b4('0x2a')];if(_0x431d5c[_0xe8b4('0x27')]['includeAll']){_0x2adf3c[_0xe8b4('0x2e')]=[{'all':!![]}];}_0x2adf3c=_[_0xe8b4('0x2f')]({},_0x2adf3c,_0x431d5c[_0xe8b4('0x30')]);return db[_0xe8b4('0x31')][_0xe8b4('0x32')](_0x2adf3c)[_0xe8b4('0x1e')](handleEntityNotFound(_0x1cb7c7,null))[_0xe8b4('0x1e')](respondWithResult(_0x1cb7c7,null))[_0xe8b4('0x33')](handleError(_0x1cb7c7,null));};exports[_0xe8b4('0x1d')]=function(_0x1e38e6,_0x59adf0){if(_0x1e38e6[_0xe8b4('0x34')]['id']){delete _0x1e38e6[_0xe8b4('0x34')]['id'];}return db[_0xe8b4('0x31')][_0xe8b4('0x32')]({'where':{'id':_0x1e38e6[_0xe8b4('0x24')]['id']}})['then'](handleEntityNotFound(_0x59adf0,null))[_0xe8b4('0x1e')](saveUpdates(_0x1e38e6[_0xe8b4('0x34')],null))['then'](respondWithResult(_0x59adf0,null))[_0xe8b4('0x33')](handleError(_0x59adf0,null));};exports[_0xe8b4('0x1f')]=function(_0x87a72,_0x4e7ab0){return db[_0xe8b4('0x31')][_0xe8b4('0x32')]({'where':{'id':_0x87a72[_0xe8b4('0x24')]['id']}})[_0xe8b4('0x1e')](handleEntityNotFound(_0x4e7ab0,null))['then'](removeEntity(_0x4e7ab0,null))[_0xe8b4('0x33')](handleError(_0x4e7ab0,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5af407e..9c6a995 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 _0xf8fa=['bluebird','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','util','../../config/logger'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0xf8fa,0x152));var _0xaf8f=function(_0x2fc026,_0xdc4f7a){_0x2fc026=_0x2fc026-0x0;var _0x34d056=_0xf8fa[_0x2fc026];return _0x34d056;};'use strict';var _=require('lodash');var util=require(_0xaf8f('0x0'));var logger=require(_0xaf8f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xaf8f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaf8f('0x3'));var config=require(_0xaf8f('0x4'));var attributes=require(_0xaf8f('0x5'));module[_0xaf8f('0x6')]=function(_0x3aa969,_0x41aa35){return _0x3aa969[_0xaf8f('0x7')](_0xaf8f('0x8'),attributes,{'tableName':_0xaf8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x97d9=['../../config/environment','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x97d9,0x18c));var _0x997d=function(_0xbc6e05,_0x524e9c){_0xbc6e05=_0xbc6e05-0x0;var _0x6c0552=_0x97d9[_0xbc6e05];return _0x6c0552;};'use strict';var _=require(_0x997d('0x0'));var util=require(_0x997d('0x1'));var logger=require(_0x997d('0x2'))(_0x997d('0x3'));var moment=require(_0x997d('0x4'));var BPromise=require(_0x997d('0x5'));var rp=require(_0x997d('0x6'));var fs=require('fs');var path=require(_0x997d('0x7'));var rimraf=require(_0x997d('0x8'));var config=require(_0x997d('0x9'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0xb65aee,_0x2a6994){return _0xb65aee[_0x997d('0xa')](_0x997d('0xb'),attributes,{'tableName':_0x997d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x997d('0xd'),'collate':_0x997d('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 4cd9e42..7995f48 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 _0x0f7c=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x1cbc43,_0x5d0f5d){var _0x3d0913=function(_0x36708f){while(--_0x36708f){_0x1cbc43['push'](_0x1cbc43['shift']());}};_0x3d0913(++_0x5d0f5d);}(_0x0f7c,0x131));var _0xc0f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0f7c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc0f7('0x0'));var util=require(_0xc0f7('0x1'));var moment=require(_0xc0f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0f7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0f7('0x4'));var logger=require(_0xc0f7('0x5'))(_0xc0f7('0x6'));var config=require(_0xc0f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc0f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6904d2,_0x49df94,_0x403cd7){return new BPromise(function(_0xb716e7,_0x45e480){return client['request'](_0x6904d2,_0x403cd7)[_0xc0f7('0x9')](function(_0x1f968c){logger[_0xc0f7('0xa')](_0xc0f7('0xb'),_0x49df94,_0xc0f7('0xc'));logger[_0xc0f7('0xd')](_0xc0f7('0xe'),_0x49df94,_0xc0f7('0xc'),JSON[_0xc0f7('0xf')](_0x1f968c));if(_0x1f968c['error']){if(_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x11')]===0x1f4){logger[_0xc0f7('0x10')]('ChatApplication,\x20%s,\x20%s',_0x49df94,_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0x45e480(_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);}logger['error'](_0xc0f7('0xb'),_0x49df94,_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0xb716e7(_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);}else{logger[_0xc0f7('0xa')](_0xc0f7('0xb'),_0x49df94,_0xc0f7('0xc'));_0xb716e7(_0x1f968c[_0xc0f7('0x13')]['message']);}})[_0xc0f7('0x14')](function(_0x71dfde){logger[_0xc0f7('0x10')](_0xc0f7('0xb'),_0x49df94,_0x71dfde);_0x45e480(_0x71dfde);});});} \ No newline at end of file +var _0x6b73=['rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x13a8ba,_0x4231a9){var _0x97ddba=function(_0x3f09f3){while(--_0x3f09f3){_0x13a8ba['push'](_0x13a8ba['shift']());}};_0x97ddba(++_0x4231a9);}(_0x6b73,0x12e));var _0x36b7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6b73[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x36b7('0x0'));var BPromise=require(_0x36b7('0x1'));var rs=require(_0x36b7('0x2'));var fs=require('fs');var Redis=require(_0x36b7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x36b7('0x4'));var logger=require(_0x36b7('0x5'))(_0x36b7('0x6'));var config=require(_0x36b7('0x7'));var jayson=require(_0x36b7('0x8'));var client=jayson[_0x36b7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd7bf8b,_0x143251,_0x208ae2){return new BPromise(function(_0x4d3c7c,_0x48b937){return client[_0x36b7('0xa')](_0xd7bf8b,_0x208ae2)[_0x36b7('0xb')](function(_0x39ce6a){logger[_0x36b7('0xc')](_0x36b7('0xd'),_0x143251,_0x36b7('0xe'));logger[_0x36b7('0xf')](_0x36b7('0x10'),_0x143251,'request\x20sent',JSON[_0x36b7('0x11')](_0x39ce6a));if(_0x39ce6a[_0x36b7('0x12')]){if(_0x39ce6a['error']['code']===0x1f4){logger[_0x36b7('0x12')]('ChatApplication,\x20%s,\x20%s',_0x143251,_0x39ce6a[_0x36b7('0x12')]['message']);return _0x48b937(_0x39ce6a[_0x36b7('0x12')][_0x36b7('0x13')]);}logger[_0x36b7('0x12')](_0x36b7('0xd'),_0x143251,_0x39ce6a[_0x36b7('0x12')]['message']);return _0x4d3c7c(_0x39ce6a[_0x36b7('0x12')]['message']);}else{logger[_0x36b7('0xc')]('ChatApplication,\x20%s,\x20%s',_0x143251,_0x36b7('0xe'));_0x4d3c7c(_0x39ce6a[_0x36b7('0x14')][_0x36b7('0x13')]);}})[_0x36b7('0x15')](function(_0x9cd51e){logger[_0x36b7('0x12')](_0x36b7('0xd'),_0x143251,_0x9cd51e);_0x48b937(_0x9cd51e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a85b252..2be4ed4 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 _0xfe72=['update','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','/:id'];(function(_0x47680e,_0x1f2270){var _0x35f749=function(_0x5a9df4){while(--_0x5a9df4){_0x47680e['push'](_0x47680e['shift']());}};_0x35f749(++_0x1f2270);}(_0xfe72,0x16a));var _0x2fe7=function(_0x34e9d1,_0x2ca32a){_0x34e9d1=_0x34e9d1-0x0;var _0x33c49e=_0xfe72[_0x34e9d1];return _0x33c49e;};'use strict';var multer=require(_0x2fe7('0x0'));var util=require(_0x2fe7('0x1'));var path=require(_0x2fe7('0x2'));var timeout=require(_0x2fe7('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2fe7('0x4'));var interaction=require(_0x2fe7('0x5'));var config=require(_0x2fe7('0x6'));var controller=require(_0x2fe7('0x7'));router[_0x2fe7('0x8')]('/:id',auth[_0x2fe7('0x9')](),controller[_0x2fe7('0xa')]);router[_0x2fe7('0xb')](_0x2fe7('0xc'),auth[_0x2fe7('0x9')](),controller[_0x2fe7('0xd')]);router['delete'](_0x2fe7('0xc'),auth[_0x2fe7('0x9')](),controller['destroy']);module[_0x2fe7('0xe')]=router; \ No newline at end of file +var _0x9660=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','isAuthenticated','delete','destroy'];(function(_0xe0d8d8,_0x5e3377){var _0x4f63eb=function(_0x5c1150){while(--_0x5c1150){_0xe0d8d8['push'](_0xe0d8d8['shift']());}};_0x4f63eb(++_0x5e3377);}(_0x9660,0x180));var _0x0966=function(_0x48d7e7,_0x306cba){_0x48d7e7=_0x48d7e7-0x0;var _0xdc62a5=_0x9660[_0x48d7e7];return _0xdc62a5;};'use strict';var multer=require(_0x0966('0x0'));var util=require(_0x0966('0x1'));var path=require(_0x0966('0x2'));var timeout=require(_0x0966('0x3'));var express=require(_0x0966('0x4'));var router=express[_0x0966('0x5')]();var auth=require(_0x0966('0x6'));var interaction=require(_0x0966('0x7'));var config=require(_0x0966('0x8'));var controller=require(_0x0966('0x9'));router[_0x0966('0xa')](_0x0966('0xb'),auth['isAuthenticated'](),controller[_0x0966('0xc')]);router['put'](_0x0966('0xb'),auth[_0x0966('0xd')](),controller['update']);router[_0x0966('0xe')]('/:id',auth[_0x0966('0xd')](),controller[_0x0966('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 84400cd..f191866 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 _0x4fe8=['BOOLEAN','sequelize'];(function(_0x43f084,_0xb48804){var _0x2a6dde=function(_0x1fab7f){while(--_0x1fab7f){_0x43f084['push'](_0x43f084['shift']());}};_0x2a6dde(++_0xb48804);}(_0x4fe8,0x187));var _0x84fe=function(_0x2d775a,_0x478687){_0x2d775a=_0x2d775a-0x0;var _0x26ae53=_0x4fe8[_0x2d775a];return _0x26ae53;};'use strict';var Sequelize=require(_0x84fe('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x84fe('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe375=['sequelize','exports','STRING'];(function(_0x1031ab,_0x11a0e6){var _0x15ba29=function(_0x363709){while(--_0x363709){_0x1031ab['push'](_0x1031ab['shift']());}};_0x15ba29(++_0x11a0e6);}(_0xe375,0x84));var _0x5e37=function(_0x1303c1,_0x2ac364){_0x1303c1=_0x1303c1-0x0;var _0x490846=_0xe375[_0x1303c1];return _0x490846;};'use strict';var Sequelize=require(_0x5e37('0x0'));module[_0x5e37('0x1')]={'name':{'type':Sequelize[_0x5e37('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5e37('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 3c2d371..3bf6120 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 _0xd80e=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','intersection','find','create','body','update','describe','ChatInternalMessage','user','addMembers','ids','getMembers','findOne','User','nolimit','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','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','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','offset','limit','Content-Range','reject','save','end','stack','name','send','index','ChatGroup','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xd80e,0x1c4));var _0xed80=function(_0x509827,_0x145dd8){_0x509827=_0x509827-0x0;var _0x336e6c=_0xd80e[_0x509827];return _0x336e6c;};'use strict';var pdf=require(_0xed80('0x0'));var emlformat=require(_0xed80('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xed80('0x2'));var jsonpatch=require(_0xed80('0x3'));var rp=require(_0xed80('0x4'));var moment=require('moment');var BPromise=require(_0xed80('0x5'));var Mustache=require(_0xed80('0x6'));var util=require(_0xed80('0x7'));var path=require('path');var sox=require(_0xed80('0x8'));var csv=require(_0xed80('0x9'));var ejs=require(_0xed80('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xed80('0xb'));var crypto=require(_0xed80('0xc'));var jsforce=require(_0xed80('0xd'));var deskjs=require(_0xed80('0xe'));var toCsv=require(_0xed80('0x9'));var querystring=require(_0xed80('0xf'));var Papa=require(_0xed80('0x10'));var Redis=require('ioredis');var authService=require(_0xed80('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xed80('0x12'));var hardwareService=require(_0xed80('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xed80('0x14'));var db=require(_0xed80('0x15'))['db'];config['redis']=_['defaults'](config[_0xed80('0x16')],{'host':_0xed80('0x17'),'port':0x18eb});var socket=require(_0xed80('0x18'))(new Redis(config['redis']));require(_0xed80('0x19'))[_0xed80('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xed80('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0xf87d67,_0x1b8d87,_0x4d7c99){if(_0x4d7c99){var _0x3e6db2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e6db2[_0xed80('0x1c')](_0x1b8d87)){return _0xf87d67;}else{throw new db[(_0xed80('0x1d'))]['ValidationError'](_0xed80('0x1e'));}}else{return _0xf87d67;}}function respondWithRpcPromise(_0x55a7fe,_0x4ce8f9,_0x441fef,_0x499a08){return new BPromise(function(_0xfcddf3,_0x29b72a){var _0x48a1ad=_0x499a08||client;return _0x48a1ad[_0xed80('0x1f')](_0x55a7fe,_0x441fef)[_0xed80('0x20')](function(_0x503f6f){logger['info'](_0xed80('0x21'),_0x4ce8f9,_0xed80('0x22'));logger[_0xed80('0x23')](_0xed80('0x24'),_0x4ce8f9,'request\x20sent',JSON[_0xed80('0x25')](_0x503f6f));if(_0x503f6f[_0xed80('0x26')]){if(_0x503f6f['error'][_0xed80('0x27')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4ce8f9,_0x503f6f[_0xed80('0x26')][_0xed80('0x28')]);return _0x29b72a(_0x503f6f['error'][_0xed80('0x28')]);}logger[_0xed80('0x26')](_0xed80('0x21'),_0x4ce8f9,_0x503f6f[_0xed80('0x26')][_0xed80('0x28')]);return _0xfcddf3(_0x503f6f[_0xed80('0x26')][_0xed80('0x28')]);}else{logger[_0xed80('0x29')](_0xed80('0x21'),_0x4ce8f9,_0xed80('0x22'));_0xfcddf3(_0x503f6f[_0xed80('0x2a')][_0xed80('0x28')]);}})[_0xed80('0x2b')](function(_0x4d19ff){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4ce8f9,_0x4d19ff);_0x29b72a(_0x4d19ff);});});}function respondWithStatusCode(_0x1bc04f,_0x108886){_0x108886=_0x108886||0xcc;return function(_0x4d1a96){if(_0x4d1a96){return _0x1bc04f[_0xed80('0x2c')](_0x108886);}return _0x1bc04f[_0xed80('0x2d')](_0x108886)['end']();};}function respondWithResult(_0x4118a5,_0x1f85af){_0x1f85af=_0x1f85af||0xc8;return function(_0x4022f8){if(_0x4022f8){return _0x4118a5[_0xed80('0x2d')](_0x1f85af)['json'](_0x4022f8);}};}function respondWithFilteredResult(_0x286286,_0x138573){return function(_0x518c09){if(_0x518c09){var _0x108d83=_0x518c09['count'],_0x4502b0=_0x138573['offset'],_0x41d70=_0x138573[_0xed80('0x2e')]+_0x138573[_0xed80('0x2f')],_0x1cadc8;if(_0x41d70>=_0x108d83){_0x41d70=_0x108d83;_0x1cadc8=0xc8;}else{_0x1cadc8=0xce;}_0x286286[_0xed80('0x2d')](_0x1cadc8);return _0x286286['set'](_0xed80('0x30'),_0x4502b0+'-'+_0x41d70+'/'+_0x108d83)['json'](_0x518c09);}return null;};}function patchUpdates(_0x4d391b){return function(_0x1c560b){try{jsonpatch['apply'](_0x1c560b,_0x4d391b,!![]);}catch(_0x51ee86){return BPromise[_0xed80('0x31')](_0x51ee86);}return _0x1c560b[_0xed80('0x32')]();};}function saveUpdates(_0x354f0c,_0x27cf41){return function(_0x2f7aac){if(_0x2f7aac){return _0x2f7aac['update'](_0x354f0c)[_0xed80('0x20')](function(_0x5887c3){return _0x5887c3;});}return null;};}function removeEntity(_0x2c0cc2,_0x5a206c){return function(_0x215f15){if(_0x215f15){return _0x215f15['destroy']()['then'](function(){_0x2c0cc2[_0xed80('0x2d')](0xcc)[_0xed80('0x33')]();});}};}function handleEntityNotFound(_0x43bfa7,_0x3f73dc){return function(_0x1b3ef2){if(!_0x1b3ef2){_0x43bfa7[_0xed80('0x2c')](0x194);}return _0x1b3ef2;};}function handleError(_0xad8ba7,_0x5a74e6){_0x5a74e6=_0x5a74e6||0x1f4;return function(_0x76232){logger[_0xed80('0x26')](_0x76232[_0xed80('0x34')]);if(_0x76232[_0xed80('0x35')]){delete _0x76232['name'];}_0xad8ba7[_0xed80('0x2d')](_0x5a74e6)[_0xed80('0x36')](_0x76232);};}exports[_0xed80('0x37')]=function(_0x16de3c,_0x3069eb){var _0x3a7074={},_0x1a77dc={},_0x342410={'count':0x0,'rows':[]};var _0x4eda48=_['map'](db[_0xed80('0x38')][_0xed80('0x39')],function(_0x5e154c){return{'name':_0x5e154c['fieldName'],'type':_0x5e154c[_0xed80('0x3a')][_0xed80('0x3b')]};});_0x1a77dc[_0xed80('0x3c')]=_[_0xed80('0x3d')](_0x4eda48,_0xed80('0x35'));_0x1a77dc[_0xed80('0x3e')]=_[_0xed80('0x3f')](_0x16de3c[_0xed80('0x3e')]);_0x1a77dc[_0xed80('0x40')]=_['intersection'](_0x1a77dc[_0xed80('0x3c')],_0x1a77dc[_0xed80('0x3e')]);_0x3a7074[_0xed80('0x41')]=_['intersection'](_0x1a77dc['model'],qs[_0xed80('0x42')](_0x16de3c[_0xed80('0x3e')][_0xed80('0x42')]));_0x3a7074[_0xed80('0x41')]=_0x3a7074['attributes'][_0xed80('0x43')]?_0x3a7074[_0xed80('0x41')]:_0x1a77dc[_0xed80('0x3c')];if(!_0x16de3c['query'][_0xed80('0x44')]('nolimit')){_0x3a7074[_0xed80('0x2f')]=qs['limit'](_0x16de3c[_0xed80('0x3e')][_0xed80('0x2f')]);_0x3a7074[_0xed80('0x2e')]=qs[_0xed80('0x2e')](_0x16de3c[_0xed80('0x3e')][_0xed80('0x2e')]);}_0x3a7074[_0xed80('0x45')]=qs[_0xed80('0x46')](_0x16de3c['query']['sort']);_0x3a7074[_0xed80('0x47')]=qs[_0xed80('0x40')](_[_0xed80('0x48')](_0x16de3c[_0xed80('0x3e')],_0x1a77dc[_0xed80('0x40')]),_0x4eda48);if(_0x16de3c[_0xed80('0x3e')][_0xed80('0x49')]){_0x3a7074['where']=_[_0xed80('0x4a')](_0x3a7074['where'],{'$or':_[_0xed80('0x3d')](_0x4eda48,function(_0xa4fe75){if(_0xa4fe75[_0xed80('0x3a')]!==_0xed80('0x4b')){var _0x24d496={};_0x24d496[_0xa4fe75[_0xed80('0x35')]]={'$like':'%'+_0x16de3c[_0xed80('0x3e')][_0xed80('0x49')]+'%'};return _0x24d496;}})});}_0x3a7074=_[_0xed80('0x4a')]({},_0x3a7074,_0x16de3c[_0xed80('0x4c')]);var _0x2811e0={'where':_0x3a7074[_0xed80('0x47')]};return db['ChatGroup'][_0xed80('0x4d')](_0x2811e0)['then'](function(_0x5fd5af){_0x342410[_0xed80('0x4d')]=_0x5fd5af;if(_0x16de3c[_0xed80('0x3e')][_0xed80('0x4e')]){_0x3a7074[_0xed80('0x4f')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x3a7074);})[_0xed80('0x20')](function(_0x7e631a){_0x342410[_0xed80('0x50')]=_0x7e631a;return _0x342410;})[_0xed80('0x20')](respondWithFilteredResult(_0x3069eb,_0x3a7074))[_0xed80('0x2b')](handleError(_0x3069eb,null));};exports[_0xed80('0x51')]=function(_0x8689a7,_0x5aecad){var _0xa097b2={'raw':!![],'where':{'id':_0x8689a7[_0xed80('0x52')]['id']}},_0x55184a={};_0x55184a[_0xed80('0x3c')]=_[_0xed80('0x3f')](db[_0xed80('0x38')][_0xed80('0x39')]);_0x55184a[_0xed80('0x3e')]=_[_0xed80('0x3f')](_0x8689a7['query']);_0x55184a['filters']=_[_0xed80('0x53')](_0x55184a['model'],_0x55184a[_0xed80('0x3e')]);_0xa097b2[_0xed80('0x41')]=_[_0xed80('0x53')](_0x55184a[_0xed80('0x3c')],qs[_0xed80('0x42')](_0x8689a7[_0xed80('0x3e')]['fields']));_0xa097b2['attributes']=_0xa097b2['attributes']['length']?_0xa097b2['attributes']:_0x55184a[_0xed80('0x3c')];if(_0x8689a7[_0xed80('0x3e')][_0xed80('0x4e')]){_0xa097b2[_0xed80('0x4f')]=[{'all':!![]}];}_0xa097b2=_['merge']({},_0xa097b2,_0x8689a7[_0xed80('0x4c')]);return db[_0xed80('0x38')][_0xed80('0x54')](_0xa097b2)[_0xed80('0x20')](handleEntityNotFound(_0x5aecad,null))[_0xed80('0x20')](respondWithResult(_0x5aecad,null))[_0xed80('0x2b')](handleError(_0x5aecad,null));};exports[_0xed80('0x55')]=function(_0x38acc0,_0x547f5b){return db[_0xed80('0x38')][_0xed80('0x55')](_0x38acc0[_0xed80('0x56')],{})[_0xed80('0x20')](respondWithResult(_0x547f5b,0xc9))[_0xed80('0x2b')](handleError(_0x547f5b,null));};exports[_0xed80('0x57')]=function(_0x94ba12,_0x21409b){if(_0x94ba12['body']['id']){delete _0x94ba12[_0xed80('0x56')]['id'];}return db[_0xed80('0x38')][_0xed80('0x54')]({'where':{'id':_0x94ba12[_0xed80('0x52')]['id']}})[_0xed80('0x20')](handleEntityNotFound(_0x21409b,null))[_0xed80('0x20')](saveUpdates(_0x94ba12[_0xed80('0x56')],null))['then'](respondWithResult(_0x21409b,null))['catch'](handleError(_0x21409b,null));};exports['destroy']=function(_0x64f112,_0x4b8f3b){return db['ChatGroup']['find']({'where':{'id':_0x64f112['params']['id']}})[_0xed80('0x20')](handleEntityNotFound(_0x4b8f3b,null))[_0xed80('0x20')](removeEntity(_0x4b8f3b,null))[_0xed80('0x2b')](handleError(_0x4b8f3b,null));};exports[_0xed80('0x58')]=function(_0x49a038,_0x5d4e82){return db[_0xed80('0x38')][_0xed80('0x58')]()['then'](respondWithResult(_0x5d4e82,null))[_0xed80('0x2b')](handleError(_0x5d4e82,null));};exports['getUnread']=function(_0x1f3e2d,_0xb3517,_0x38bf30){return db[_0xed80('0x59')][_0xed80('0x4d')]({'where':{'ChatGroupId':_0x1f3e2d[_0xed80('0x52')]['id'],'ToId':_0x1f3e2d[_0xed80('0x5a')]['id'],'read':![]}})['then'](function(_0x27f3af){return{'id':_['toInteger'](_0x1f3e2d[_0xed80('0x52')]['id']),'count':_0x27f3af};})[_0xed80('0x20')](respondWithResult(_0xb3517,null))['catch'](handleError(_0xb3517,null));};exports[_0xed80('0x5b')]=function(_0x345d3f,_0xeb77ca,_0xfbb014){return db[_0xed80('0x38')][_0xed80('0x54')]({'where':{'id':_0x345d3f[_0xed80('0x52')]['id']}})[_0xed80('0x20')](handleEntityNotFound(_0xeb77ca,null))['then'](function(_0x5b5cac){if(_0x5b5cac){return _0x5b5cac[_0xed80('0x5b')](_0x345d3f[_0xed80('0x56')][_0xed80('0x5c')],_['omit'](_0x345d3f[_0xed80('0x56')],[_0xed80('0x5c'),'id'])||{});}})['then'](respondWithResult(_0xeb77ca,null))[_0xed80('0x2b')](handleError(_0xeb77ca,null));};exports[_0xed80('0x5d')]=function(_0xbee581,_0x16505c,_0x4491c0){var _0x2a693f={};var _0x36611b={};var _0x34f285;var _0x4c31a1;return db[_0xed80('0x38')][_0xed80('0x5e')]({'where':{'id':_0xbee581[_0xed80('0x52')]['id']}})['then'](handleEntityNotFound(_0x16505c,null))[_0xed80('0x20')](function(_0xd2c8ad){if(_0xd2c8ad){_0x34f285=_0xd2c8ad;_0x36611b[_0xed80('0x3c')]=_['keys'](db[_0xed80('0x5f')][_0xed80('0x39')]);_0x36611b[_0xed80('0x3e')]=_[_0xed80('0x3f')](_0xbee581[_0xed80('0x3e')]);_0x36611b[_0xed80('0x40')]=_[_0xed80('0x53')](_0x36611b[_0xed80('0x3c')],_0x36611b[_0xed80('0x3e')]);_0x2a693f[_0xed80('0x41')]=_[_0xed80('0x53')](_0x36611b['model'],qs['fields'](_0xbee581[_0xed80('0x3e')][_0xed80('0x42')]));_0x2a693f[_0xed80('0x41')]=_0x2a693f[_0xed80('0x41')][_0xed80('0x43')]?_0x2a693f[_0xed80('0x41')]:_0x36611b[_0xed80('0x3c')];_0x2a693f[_0xed80('0x45')]=qs[_0xed80('0x46')](_0xbee581[_0xed80('0x3e')][_0xed80('0x46')]);_0x2a693f[_0xed80('0x47')]=qs[_0xed80('0x40')](_['pick'](_0xbee581['query'],_0x36611b[_0xed80('0x40')]));if(_0xbee581[_0xed80('0x3e')]['filter']){_0x2a693f[_0xed80('0x47')]=_[_0xed80('0x4a')](_0x2a693f[_0xed80('0x47')],{'$or':_[_0xed80('0x3d')](_0x2a693f[_0xed80('0x41')],function(_0x2f1b63){var _0x7d8a67={};_0x7d8a67[_0x2f1b63]={'$like':'%'+_0xbee581[_0xed80('0x3e')][_0xed80('0x49')]+'%'};return _0x7d8a67;})});}_0x2a693f=_[_0xed80('0x4a')]({},_0x2a693f,_0xbee581['options']);return _0x34f285[_0xed80('0x5d')](_0x2a693f);}})[_0xed80('0x20')](function(_0x81723f){if(_0x81723f){_0x4c31a1=_0x81723f['length'];if(!_0xbee581[_0xed80('0x3e')]['hasOwnProperty'](_0xed80('0x60'))){_0x2a693f[_0xed80('0x2f')]=qs['limit'](_0xbee581[_0xed80('0x3e')]['limit']);_0x2a693f[_0xed80('0x2e')]=qs[_0xed80('0x2e')](_0xbee581[_0xed80('0x3e')][_0xed80('0x2e')]);}return _0x34f285[_0xed80('0x5d')](_0x2a693f);}})['then'](function(_0x1c8fe1){if(_0x1c8fe1){return _0x1c8fe1?{'count':_0x4c31a1,'rows':_0x1c8fe1}:null;}})[_0xed80('0x20')](respondWithResult(_0x16505c,null))[_0xed80('0x2b')](handleError(_0x16505c,null));};exports['removeMembers']=function(_0x530592,_0x10fba2,_0x4a43c3){return db[_0xed80('0x38')]['find']({'where':{'id':_0x530592['params']['id']}})[_0xed80('0x20')](handleEntityNotFound(_0x10fba2,null))[_0xed80('0x20')](function(_0x1877df){if(_0x1877df){return _0x1877df['removeMembers'](_0x530592[_0xed80('0x3e')][_0xed80('0x5c')]);}})[_0xed80('0x20')](respondWithStatusCode(_0x10fba2,null))[_0xed80('0x2b')](handleError(_0x10fba2,null));};exports[_0xed80('0x61')]=function(_0x193b39,_0x4d739d,_0x31c0ab){if(_0x193b39['body']['id']){delete _0x193b39['body']['id'];}return db[_0xed80('0x38')]['find']({'where':{'id':_0x193b39[_0xed80('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d739d,null))[_0xed80('0x20')](function(_0x53d71f){if(_0x53d71f){_0x193b39[_0xed80('0x56')][_0xed80('0x62')]=_0x53d71f['id'];return db['ChatInternalMessage'][_0xed80('0x55')](_0x193b39[_0xed80('0x56')]);}})[_0xed80('0x20')](respondWithResult(_0x4d739d,null))[_0xed80('0x2b')](handleError(_0x4d739d,null));};exports[_0xed80('0x63')]=function(_0x46a40f,_0x2da904,_0x156692){var _0xbd0503={};var _0x236f26={};var _0x565a09;var _0x3cd5a1;return db['ChatGroup'][_0xed80('0x5e')]({'where':{'id':_0x46a40f[_0xed80('0x52')]['id']}})[_0xed80('0x20')](handleEntityNotFound(_0x2da904,null))[_0xed80('0x20')](function(_0x4ab846){if(_0x4ab846){_0x565a09=_0x4ab846;_0x236f26['model']=_[_0xed80('0x3f')](db[_0xed80('0x59')]['rawAttributes']);_0x236f26[_0xed80('0x3e')]=_[_0xed80('0x3f')](_0x46a40f[_0xed80('0x3e')]);_0x236f26['filters']=_[_0xed80('0x53')](_0x236f26['model'],_0x236f26[_0xed80('0x3e')]);_0xbd0503['attributes']=_[_0xed80('0x53')](_0x236f26['model'],qs[_0xed80('0x42')](_0x46a40f['query']['fields']));_0xbd0503['attributes']=_0xbd0503['attributes'][_0xed80('0x43')]?_0xbd0503['attributes']:_0x236f26[_0xed80('0x3c')];_0xbd0503[_0xed80('0x45')]=qs[_0xed80('0x46')](_0x46a40f[_0xed80('0x3e')][_0xed80('0x46')]);_0xbd0503[_0xed80('0x47')]=qs[_0xed80('0x40')](_[_0xed80('0x48')](_0x46a40f['query'],_0x236f26[_0xed80('0x40')]));if(_0x46a40f[_0xed80('0x3e')][_0xed80('0x49')]){_0xbd0503['where']=_[_0xed80('0x4a')](_0xbd0503[_0xed80('0x47')],{'$or':_[_0xed80('0x3d')](_0xbd0503['attributes'],function(_0x18c6c4){var _0x14930f={};_0x14930f[_0x18c6c4]={'$like':'%'+_0x46a40f[_0xed80('0x3e')][_0xed80('0x49')]+'%'};return _0x14930f;})});}if(_0x46a40f[_0xed80('0x3e')][_0xed80('0x64')]){var _0x31d329=_0x46a40f['query'][_0xed80('0x64')][_0xed80('0x65')](',');var _0x5535f5={};_0x5535f5[_0x31d329[0x0]]={'$gte':moment(_0x31d329[0x1])[_0xed80('0x66')](_0xed80('0x67'))};_0xbd0503[_0xed80('0x47')]=_[_0xed80('0x4a')](_0xbd0503[_0xed80('0x47')],_0x5535f5);}_0xbd0503=_[_0xed80('0x4a')]({},_0xbd0503,_0x46a40f[_0xed80('0x4c')]);return _0x565a09[_0xed80('0x63')](_0xbd0503);}})[_0xed80('0x20')](function(_0x8e3ba3){if(_0x8e3ba3){_0x3cd5a1=_0x8e3ba3[_0xed80('0x43')];if(!_0x46a40f['query'][_0xed80('0x44')](_0xed80('0x60'))){_0xbd0503['limit']=qs['limit'](_0x46a40f['query'][_0xed80('0x2f')]);_0xbd0503[_0xed80('0x2e')]=qs[_0xed80('0x2e')](_0x46a40f[_0xed80('0x3e')][_0xed80('0x2e')]);}return _0x565a09[_0xed80('0x63')](_0xbd0503);}})[_0xed80('0x20')](function(_0x26c59e){if(_0x26c59e){return _0x26c59e?{'count':_0x3cd5a1,'rows':_0x26c59e}:null;}})['then'](respondWithResult(_0x2da904,null))[_0xed80('0x2b')](handleError(_0x2da904,null));}; \ No newline at end of file +var _0x5184=['./chatGroup.socket','register','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','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','status','count','offset','limit','json','apply','reject','update','stack','name','send','index','map','ChatGroup','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','destroy','describe','ChatInternalMessage','user','addMembers','ids','getMembers','findOne','User','order','filter','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0x5184,0x194));var _0x4518=function(_0x70b29e,_0x5b330a){_0x70b29e=_0x70b29e-0x0;var _0x41e725=_0x5184[_0x70b29e];return _0x41e725;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4518('0x0'));var rimraf=require(_0x4518('0x1'));var zipdir=require(_0x4518('0x2'));var jsonpatch=require(_0x4518('0x3'));var rp=require(_0x4518('0x4'));var moment=require(_0x4518('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4518('0x6'));var util=require(_0x4518('0x7'));var path=require(_0x4518('0x8'));var sox=require(_0x4518('0x9'));var csv=require(_0x4518('0xa'));var ejs=require(_0x4518('0xb'));var fs=require('fs');var _=require(_0x4518('0xc'));var squel=require(_0x4518('0xd'));var crypto=require(_0x4518('0xe'));var jsforce=require(_0x4518('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4518('0xa'));var querystring=require(_0x4518('0x10'));var Papa=require(_0x4518('0x11'));var Redis=require(_0x4518('0x12'));var authService=require(_0x4518('0x13'));var qs=require(_0x4518('0x14'));var as=require(_0x4518('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4518('0x16'));var utils=require(_0x4518('0x17'));var config=require('../../config/environment');var db=require(_0x4518('0x18'))['db'];config[_0x4518('0x19')]=_[_0x4518('0x1a')](config[_0x4518('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4518('0x1b'))(new Redis(config[_0x4518('0x19')]));require(_0x4518('0x1c'))[_0x4518('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4518('0x1e')][_0x4518('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x1a6e6e,_0x42327f,_0x10fa49){if(_0x10fa49){var _0x4d0cd6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d0cd6['test'](_0x42327f)){return _0x1a6e6e;}else{throw new db[(_0x4518('0x20'))][(_0x4518('0x21'))](_0x4518('0x22'));}}else{return _0x1a6e6e;}}function respondWithRpcPromise(_0x341935,_0x1279ab,_0xd10ba6,_0x49266c){return new BPromise(function(_0x29ea45,_0x41783d){var _0x20dee9=_0x49266c||client;return _0x20dee9[_0x4518('0x23')](_0x341935,_0xd10ba6)[_0x4518('0x24')](function(_0x56c98e){logger['info'](_0x4518('0x25'),_0x1279ab,'request\x20sent');logger['debug'](_0x4518('0x26'),_0x1279ab,_0x4518('0x27'),JSON[_0x4518('0x28')](_0x56c98e));if(_0x56c98e[_0x4518('0x29')]){if(_0x56c98e[_0x4518('0x29')][_0x4518('0x2a')]===0x1f4){logger[_0x4518('0x29')](_0x4518('0x25'),_0x1279ab,_0x56c98e[_0x4518('0x29')][_0x4518('0x2b')]);return _0x41783d(_0x56c98e[_0x4518('0x29')][_0x4518('0x2b')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x1279ab,_0x56c98e[_0x4518('0x29')][_0x4518('0x2b')]);return _0x29ea45(_0x56c98e['error'][_0x4518('0x2b')]);}else{logger[_0x4518('0x2c')](_0x4518('0x25'),_0x1279ab,_0x4518('0x27'));_0x29ea45(_0x56c98e[_0x4518('0x2d')][_0x4518('0x2b')]);}})[_0x4518('0x2e')](function(_0xb29083){logger[_0x4518('0x29')](_0x4518('0x25'),_0x1279ab,_0xb29083);_0x41783d(_0xb29083);});});}function respondWithStatusCode(_0x3e4826,_0x114d98){_0x114d98=_0x114d98||0xcc;return function(_0xcfd177){if(_0xcfd177){return _0x3e4826[_0x4518('0x2f')](_0x114d98);}return _0x3e4826['status'](_0x114d98)[_0x4518('0x30')]();};}function respondWithResult(_0x197a84,_0x4b2db5){_0x4b2db5=_0x4b2db5||0xc8;return function(_0x208ca0){if(_0x208ca0){return _0x197a84[_0x4518('0x31')](_0x4b2db5)['json'](_0x208ca0);}};}function respondWithFilteredResult(_0x32b5a8,_0x2cb6e){return function(_0x24e739){if(_0x24e739){var _0xc09402=_0x24e739[_0x4518('0x32')],_0x195ead=_0x2cb6e[_0x4518('0x33')],_0x2ef95a=_0x2cb6e['offset']+_0x2cb6e[_0x4518('0x34')],_0x296c00;if(_0x2ef95a>=_0xc09402){_0x2ef95a=_0xc09402;_0x296c00=0xc8;}else{_0x296c00=0xce;}_0x32b5a8['status'](_0x296c00);return _0x32b5a8['set']('Content-Range',_0x195ead+'-'+_0x2ef95a+'/'+_0xc09402)[_0x4518('0x35')](_0x24e739);}return null;};}function patchUpdates(_0x4c4f2a){return function(_0x1447b0){try{jsonpatch[_0x4518('0x36')](_0x1447b0,_0x4c4f2a,!![]);}catch(_0x10b9ad){return BPromise[_0x4518('0x37')](_0x10b9ad);}return _0x1447b0['save']();};}function saveUpdates(_0x928f31,_0x41d5b3){return function(_0x47303e){if(_0x47303e){return _0x47303e[_0x4518('0x38')](_0x928f31)[_0x4518('0x24')](function(_0x289f84){return _0x289f84;});}return null;};}function removeEntity(_0x16897f,_0x4cec9d){return function(_0x5a12c1){if(_0x5a12c1){return _0x5a12c1['destroy']()[_0x4518('0x24')](function(){_0x16897f[_0x4518('0x31')](0xcc)[_0x4518('0x30')]();});}};}function handleEntityNotFound(_0x4a92bb,_0x38d279){return function(_0x57bc8f){if(!_0x57bc8f){_0x4a92bb[_0x4518('0x2f')](0x194);}return _0x57bc8f;};}function handleError(_0xa425d6,_0x5bda46){_0x5bda46=_0x5bda46||0x1f4;return function(_0x3ef455){logger['error'](_0x3ef455[_0x4518('0x39')]);if(_0x3ef455[_0x4518('0x3a')]){delete _0x3ef455[_0x4518('0x3a')];}_0xa425d6[_0x4518('0x31')](_0x5bda46)[_0x4518('0x3b')](_0x3ef455);};}exports[_0x4518('0x3c')]=function(_0xb19d83,_0x40da10){var _0x3c0de9={},_0x3c9461={},_0x497811={'count':0x0,'rows':[]};var _0x59ce56=_[_0x4518('0x3d')](db[_0x4518('0x3e')][_0x4518('0x3f')],function(_0x1937ff){return{'name':_0x1937ff['fieldName'],'type':_0x1937ff[_0x4518('0x40')]['key']};});_0x3c9461['model']=_[_0x4518('0x3d')](_0x59ce56,_0x4518('0x3a'));_0x3c9461[_0x4518('0x41')]=_[_0x4518('0x42')](_0xb19d83[_0x4518('0x41')]);_0x3c9461[_0x4518('0x43')]=_[_0x4518('0x44')](_0x3c9461[_0x4518('0x45')],_0x3c9461[_0x4518('0x41')]);_0x3c0de9[_0x4518('0x46')]=_[_0x4518('0x44')](_0x3c9461[_0x4518('0x45')],qs[_0x4518('0x47')](_0xb19d83[_0x4518('0x41')][_0x4518('0x47')]));_0x3c0de9[_0x4518('0x46')]=_0x3c0de9[_0x4518('0x46')][_0x4518('0x48')]?_0x3c0de9[_0x4518('0x46')]:_0x3c9461[_0x4518('0x45')];if(!_0xb19d83['query']['hasOwnProperty'](_0x4518('0x49'))){_0x3c0de9[_0x4518('0x34')]=qs[_0x4518('0x34')](_0xb19d83[_0x4518('0x41')][_0x4518('0x34')]);_0x3c0de9['offset']=qs[_0x4518('0x33')](_0xb19d83['query'][_0x4518('0x33')]);}_0x3c0de9['order']=qs['sort'](_0xb19d83[_0x4518('0x41')][_0x4518('0x4a')]);_0x3c0de9[_0x4518('0x4b')]=qs[_0x4518('0x43')](_[_0x4518('0x4c')](_0xb19d83[_0x4518('0x41')],_0x3c9461['filters']),_0x59ce56);if(_0xb19d83[_0x4518('0x41')]['filter']){_0x3c0de9['where']=_[_0x4518('0x4d')](_0x3c0de9[_0x4518('0x4b')],{'$or':_[_0x4518('0x3d')](_0x59ce56,function(_0x483202){if(_0x483202[_0x4518('0x40')]!==_0x4518('0x4e')){var _0x5119c8={};_0x5119c8[_0x483202[_0x4518('0x3a')]]={'$like':'%'+_0xb19d83['query']['filter']+'%'};return _0x5119c8;}})});}_0x3c0de9=_[_0x4518('0x4d')]({},_0x3c0de9,_0xb19d83[_0x4518('0x4f')]);var _0x1dacac={'where':_0x3c0de9[_0x4518('0x4b')]};return db[_0x4518('0x3e')][_0x4518('0x32')](_0x1dacac)['then'](function(_0x2278b2){_0x497811['count']=_0x2278b2;if(_0xb19d83[_0x4518('0x41')][_0x4518('0x50')]){_0x3c0de9[_0x4518('0x51')]=[{'all':!![]}];}return db[_0x4518('0x3e')]['findAll'](_0x3c0de9);})[_0x4518('0x24')](function(_0x4addf2){_0x497811[_0x4518('0x52')]=_0x4addf2;return _0x497811;})['then'](respondWithFilteredResult(_0x40da10,_0x3c0de9))['catch'](handleError(_0x40da10,null));};exports[_0x4518('0x53')]=function(_0x38b646,_0x1b8209){var _0x7f1514={'raw':!![],'where':{'id':_0x38b646[_0x4518('0x54')]['id']}},_0x1bd955={};_0x1bd955[_0x4518('0x45')]=_[_0x4518('0x42')](db[_0x4518('0x3e')][_0x4518('0x3f')]);_0x1bd955[_0x4518('0x41')]=_[_0x4518('0x42')](_0x38b646[_0x4518('0x41')]);_0x1bd955[_0x4518('0x43')]=_[_0x4518('0x44')](_0x1bd955[_0x4518('0x45')],_0x1bd955[_0x4518('0x41')]);_0x7f1514[_0x4518('0x46')]=_[_0x4518('0x44')](_0x1bd955[_0x4518('0x45')],qs['fields'](_0x38b646['query']['fields']));_0x7f1514[_0x4518('0x46')]=_0x7f1514[_0x4518('0x46')][_0x4518('0x48')]?_0x7f1514[_0x4518('0x46')]:_0x1bd955[_0x4518('0x45')];if(_0x38b646[_0x4518('0x41')][_0x4518('0x50')]){_0x7f1514['include']=[{'all':!![]}];}_0x7f1514=_['merge']({},_0x7f1514,_0x38b646['options']);return db['ChatGroup'][_0x4518('0x55')](_0x7f1514)['then'](handleEntityNotFound(_0x1b8209,null))['then'](respondWithResult(_0x1b8209,null))['catch'](handleError(_0x1b8209,null));};exports[_0x4518('0x56')]=function(_0x284bcc,_0x6f77d){return db[_0x4518('0x3e')][_0x4518('0x56')](_0x284bcc['body'],{})['then'](respondWithResult(_0x6f77d,0xc9))[_0x4518('0x2e')](handleError(_0x6f77d,null));};exports[_0x4518('0x38')]=function(_0x5ecd93,_0x485d25){if(_0x5ecd93[_0x4518('0x57')]['id']){delete _0x5ecd93['body']['id'];}return db[_0x4518('0x3e')][_0x4518('0x55')]({'where':{'id':_0x5ecd93[_0x4518('0x54')]['id']}})['then'](handleEntityNotFound(_0x485d25,null))[_0x4518('0x24')](saveUpdates(_0x5ecd93['body'],null))[_0x4518('0x24')](respondWithResult(_0x485d25,null))[_0x4518('0x2e')](handleError(_0x485d25,null));};exports[_0x4518('0x58')]=function(_0x1ddeb8,_0x4b123e){return db[_0x4518('0x3e')][_0x4518('0x55')]({'where':{'id':_0x1ddeb8[_0x4518('0x54')]['id']}})[_0x4518('0x24')](handleEntityNotFound(_0x4b123e,null))['then'](removeEntity(_0x4b123e,null))[_0x4518('0x2e')](handleError(_0x4b123e,null));};exports['describe']=function(_0x96a6bf,_0x102ee){return db[_0x4518('0x3e')][_0x4518('0x59')]()[_0x4518('0x24')](respondWithResult(_0x102ee,null))[_0x4518('0x2e')](handleError(_0x102ee,null));};exports['getUnread']=function(_0x2f0de6,_0x5864e1,_0x5123d4){return db[_0x4518('0x5a')]['count']({'where':{'ChatGroupId':_0x2f0de6[_0x4518('0x54')]['id'],'ToId':_0x2f0de6[_0x4518('0x5b')]['id'],'read':![]}})[_0x4518('0x24')](function(_0x2b6ab9){return{'id':_['toInteger'](_0x2f0de6[_0x4518('0x54')]['id']),'count':_0x2b6ab9};})[_0x4518('0x24')](respondWithResult(_0x5864e1,null))[_0x4518('0x2e')](handleError(_0x5864e1,null));};exports['addMembers']=function(_0x2baa7c,_0x2e11c5,_0x41fdfe){return db[_0x4518('0x3e')][_0x4518('0x55')]({'where':{'id':_0x2baa7c['params']['id']}})[_0x4518('0x24')](handleEntityNotFound(_0x2e11c5,null))[_0x4518('0x24')](function(_0x1b38af){if(_0x1b38af){return _0x1b38af[_0x4518('0x5c')](_0x2baa7c[_0x4518('0x57')][_0x4518('0x5d')],_['omit'](_0x2baa7c[_0x4518('0x57')],['ids','id'])||{});}})[_0x4518('0x24')](respondWithResult(_0x2e11c5,null))[_0x4518('0x2e')](handleError(_0x2e11c5,null));};exports[_0x4518('0x5e')]=function(_0x4945d8,_0x5f4432,_0x27a8f8){var _0x1a78a2={};var _0x31abe1={};var _0x586df0;var _0x2d5a72;return db[_0x4518('0x3e')][_0x4518('0x5f')]({'where':{'id':_0x4945d8[_0x4518('0x54')]['id']}})[_0x4518('0x24')](handleEntityNotFound(_0x5f4432,null))[_0x4518('0x24')](function(_0x437d28){if(_0x437d28){_0x586df0=_0x437d28;_0x31abe1['model']=_['keys'](db[_0x4518('0x60')][_0x4518('0x3f')]);_0x31abe1[_0x4518('0x41')]=_[_0x4518('0x42')](_0x4945d8['query']);_0x31abe1['filters']=_[_0x4518('0x44')](_0x31abe1[_0x4518('0x45')],_0x31abe1[_0x4518('0x41')]);_0x1a78a2['attributes']=_[_0x4518('0x44')](_0x31abe1['model'],qs['fields'](_0x4945d8[_0x4518('0x41')][_0x4518('0x47')]));_0x1a78a2[_0x4518('0x46')]=_0x1a78a2[_0x4518('0x46')][_0x4518('0x48')]?_0x1a78a2[_0x4518('0x46')]:_0x31abe1[_0x4518('0x45')];_0x1a78a2[_0x4518('0x61')]=qs['sort'](_0x4945d8[_0x4518('0x41')][_0x4518('0x4a')]);_0x1a78a2[_0x4518('0x4b')]=qs['filters'](_[_0x4518('0x4c')](_0x4945d8[_0x4518('0x41')],_0x31abe1[_0x4518('0x43')]));if(_0x4945d8[_0x4518('0x41')]['filter']){_0x1a78a2['where']=_[_0x4518('0x4d')](_0x1a78a2['where'],{'$or':_[_0x4518('0x3d')](_0x1a78a2[_0x4518('0x46')],function(_0x12090d){var _0x1c83ea={};_0x1c83ea[_0x12090d]={'$like':'%'+_0x4945d8['query'][_0x4518('0x62')]+'%'};return _0x1c83ea;})});}_0x1a78a2=_['merge']({},_0x1a78a2,_0x4945d8[_0x4518('0x4f')]);return _0x586df0['getMembers'](_0x1a78a2);}})[_0x4518('0x24')](function(_0x3113b2){if(_0x3113b2){_0x2d5a72=_0x3113b2[_0x4518('0x48')];if(!_0x4945d8['query'][_0x4518('0x63')]('nolimit')){_0x1a78a2[_0x4518('0x34')]=qs['limit'](_0x4945d8['query'][_0x4518('0x34')]);_0x1a78a2[_0x4518('0x33')]=qs[_0x4518('0x33')](_0x4945d8[_0x4518('0x41')][_0x4518('0x33')]);}return _0x586df0[_0x4518('0x5e')](_0x1a78a2);}})[_0x4518('0x24')](function(_0x27998c){if(_0x27998c){return _0x27998c?{'count':_0x2d5a72,'rows':_0x27998c}:null;}})[_0x4518('0x24')](respondWithResult(_0x5f4432,null))[_0x4518('0x2e')](handleError(_0x5f4432,null));};exports[_0x4518('0x64')]=function(_0x258acb,_0x3c190f,_0x275f29){return db['ChatGroup'][_0x4518('0x55')]({'where':{'id':_0x258acb[_0x4518('0x54')]['id']}})[_0x4518('0x24')](handleEntityNotFound(_0x3c190f,null))[_0x4518('0x24')](function(_0x5d5e79){if(_0x5d5e79){return _0x5d5e79['removeMembers'](_0x258acb[_0x4518('0x41')]['ids']);}})[_0x4518('0x24')](respondWithStatusCode(_0x3c190f,null))['catch'](handleError(_0x3c190f,null));};exports[_0x4518('0x65')]=function(_0x2f3024,_0x2fc720,_0x469d39){if(_0x2f3024['body']['id']){delete _0x2f3024[_0x4518('0x57')]['id'];}return db[_0x4518('0x3e')]['find']({'where':{'id':_0x2f3024[_0x4518('0x54')]['id']}})[_0x4518('0x24')](handleEntityNotFound(_0x2fc720,null))[_0x4518('0x24')](function(_0x11baca){if(_0x11baca){_0x2f3024[_0x4518('0x57')][_0x4518('0x66')]=_0x11baca['id'];return db['ChatInternalMessage']['create'](_0x2f3024[_0x4518('0x57')]);}})['then'](respondWithResult(_0x2fc720,null))[_0x4518('0x2e')](handleError(_0x2fc720,null));};exports[_0x4518('0x67')]=function(_0x2ea565,_0x139cea,_0x2f0820){var _0x22e801={};var _0x35c496={};var _0xdac129;var _0x1f073a;return db[_0x4518('0x3e')][_0x4518('0x5f')]({'where':{'id':_0x2ea565['params']['id']}})[_0x4518('0x24')](handleEntityNotFound(_0x139cea,null))[_0x4518('0x24')](function(_0x28f3ef){if(_0x28f3ef){_0xdac129=_0x28f3ef;_0x35c496[_0x4518('0x45')]=_[_0x4518('0x42')](db[_0x4518('0x5a')][_0x4518('0x3f')]);_0x35c496['query']=_[_0x4518('0x42')](_0x2ea565[_0x4518('0x41')]);_0x35c496[_0x4518('0x43')]=_[_0x4518('0x44')](_0x35c496[_0x4518('0x45')],_0x35c496[_0x4518('0x41')]);_0x22e801[_0x4518('0x46')]=_[_0x4518('0x44')](_0x35c496[_0x4518('0x45')],qs[_0x4518('0x47')](_0x2ea565[_0x4518('0x41')][_0x4518('0x47')]));_0x22e801[_0x4518('0x46')]=_0x22e801[_0x4518('0x46')][_0x4518('0x48')]?_0x22e801['attributes']:_0x35c496[_0x4518('0x45')];_0x22e801['order']=qs[_0x4518('0x4a')](_0x2ea565[_0x4518('0x41')][_0x4518('0x4a')]);_0x22e801[_0x4518('0x4b')]=qs[_0x4518('0x43')](_[_0x4518('0x4c')](_0x2ea565['query'],_0x35c496['filters']));if(_0x2ea565[_0x4518('0x41')]['filter']){_0x22e801[_0x4518('0x4b')]=_['merge'](_0x22e801[_0x4518('0x4b')],{'$or':_[_0x4518('0x3d')](_0x22e801['attributes'],function(_0x2667fe){var _0x4810a7={};_0x4810a7[_0x2667fe]={'$like':'%'+_0x2ea565[_0x4518('0x41')][_0x4518('0x62')]+'%'};return _0x4810a7;})});}if(_0x2ea565[_0x4518('0x41')][_0x4518('0x68')]){var _0xba269b=_0x2ea565[_0x4518('0x41')][_0x4518('0x68')][_0x4518('0x69')](',');var _0x43e3ef={};_0x43e3ef[_0xba269b[0x0]]={'$gte':moment(_0xba269b[0x1])[_0x4518('0x6a')](_0x4518('0x6b'))};_0x22e801[_0x4518('0x4b')]=_[_0x4518('0x4d')](_0x22e801[_0x4518('0x4b')],_0x43e3ef);}_0x22e801=_[_0x4518('0x4d')]({},_0x22e801,_0x2ea565[_0x4518('0x4f')]);return _0xdac129[_0x4518('0x67')](_0x22e801);}})[_0x4518('0x24')](function(_0x499bfb){if(_0x499bfb){_0x1f073a=_0x499bfb[_0x4518('0x48')];if(!_0x2ea565[_0x4518('0x41')][_0x4518('0x63')](_0x4518('0x49'))){_0x22e801[_0x4518('0x34')]=qs[_0x4518('0x34')](_0x2ea565[_0x4518('0x41')][_0x4518('0x34')]);_0x22e801[_0x4518('0x33')]=qs[_0x4518('0x33')](_0x2ea565[_0x4518('0x41')]['offset']);}return _0xdac129[_0x4518('0x67')](_0x22e801);}})[_0x4518('0x24')](function(_0x41dd41){if(_0x41dd41){return _0x41dd41?{'count':_0x1f073a,'rows':_0x41dd41}:null;}})['then'](respondWithResult(_0x139cea,null))[_0x4518('0x2e')](handleError(_0x139cea,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 1cf2d5a..ec9d79f 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 _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x371a18,_0x50ae4c){var _0x59dfb4=function(_0x117c5c){while(--_0x117c5c){_0x371a18['push'](_0x371a18['shift']());}};_0x59dfb4(++_0x50ae4c);}(_0xdb28,0x106));var _0x8db2=function(_0x352e06,_0x211be4){_0x352e06=_0x352e06-0x0;var _0x2a0652=_0xdb28[_0x352e06];return _0x2a0652;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xadb5,0xad));var _0x5adb=function(_0x2825e2,_0x4e21e7){_0x2825e2=_0x2825e2-0x0;var _0x3887f5=_0xadb5[_0x2825e2];return _0x3887f5;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 1a765bd..0d2284e 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 _0x1751=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4ebdb8,_0x4a2ff9){var _0x3e74a4=function(_0x579898){while(--_0x579898){_0x4ebdb8['push'](_0x4ebdb8['shift']());}};_0x3e74a4(++_0x4a2ff9);}(_0x1751,0x76));var _0x1175=function(_0x1a8067,_0x1197c6){_0x1a8067=_0x1a8067-0x0;var _0x1345a2=_0x1751[_0x1a8067];return _0x1345a2;};'use strict';var _=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var logger=require(_0x1175('0x2'))(_0x1175('0x3'));var moment=require('moment');var BPromise=require(_0x1175('0x4'));var rp=require(_0x1175('0x5'));var fs=require('fs');var path=require(_0x1175('0x6'));var rimraf=require(_0x1175('0x7'));var config=require(_0x1175('0x8'));var attributes=require(_0x1175('0x9'));module[_0x1175('0xa')]=function(_0x171756,_0x3f99ca){return _0x171756[_0x1175('0xb')](_0x1175('0xc'),attributes,{'tableName':_0x1175('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x236d=['lodash','util','api','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd236('0x0'));var util=require(_0xd236('0x1'));var logger=require('../../config/logger')(_0xd236('0x2'));var moment=require('moment');var BPromise=require(_0xd236('0x3'));var rp=require(_0xd236('0x4'));var fs=require('fs');var path=require(_0xd236('0x5'));var rimraf=require(_0xd236('0x6'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xd236('0x7')]=function(_0x29a67c,_0x75d84c){return _0x29a67c[_0xd236('0x8')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index c346ef6..caeb402 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 _0xcc8d=['register','request','info','ChatGroup,\x20%s,\x20%s','debug','stringify','error','request\x20sent','message','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./chatGroup.socket'];(function(_0x21403d,_0x5aad4d){var _0xde481f=function(_0x297aff){while(--_0x297aff){_0x21403d['push'](_0x21403d['shift']());}};_0xde481f(++_0x5aad4d);}(_0xcc8d,0xe5));var _0xdcc8=function(_0x591db7,_0x150445){_0x591db7=_0x591db7-0x0;var _0x4ad760=_0xcc8d[_0x591db7];return _0x4ad760;};'use strict';var _=require(_0xdcc8('0x0'));var util=require('util');var moment=require(_0xdcc8('0x1'));var BPromise=require('bluebird');var rs=require(_0xdcc8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcc8('0x3'))['db'];var utils=require(_0xdcc8('0x4'));var logger=require(_0xdcc8('0x5'))(_0xdcc8('0x6'));var config=require(_0xdcc8('0x7'));var jayson=require(_0xdcc8('0x8'));var client=jayson[_0xdcc8('0x9')]['http']({'port':0x232a});config[_0xdcc8('0xa')]=_[_0xdcc8('0xb')](config[_0xdcc8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdcc8('0xc'))[_0xdcc8('0xd')](socket);function respondWithRpcPromise(_0x52f616,_0x5c3813,_0x436bc6){return new BPromise(function(_0x8a4e9f,_0x25be24){return client[_0xdcc8('0xe')](_0x52f616,_0x436bc6)['then'](function(_0x18c750){logger[_0xdcc8('0xf')](_0xdcc8('0x10'),_0x5c3813,'request\x20sent');logger[_0xdcc8('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5c3813,'request\x20sent',JSON[_0xdcc8('0x12')](_0x18c750));if(_0x18c750[_0xdcc8('0x13')]){if(_0x18c750[_0xdcc8('0x13')]['code']===0x1f4){logger[_0xdcc8('0x13')](_0xdcc8('0x10'),_0x5c3813,_0x18c750[_0xdcc8('0x13')]['message']);return _0x25be24(_0x18c750[_0xdcc8('0x13')]['message']);}logger['error'](_0xdcc8('0x10'),_0x5c3813,_0x18c750[_0xdcc8('0x13')]['message']);return _0x8a4e9f(_0x18c750[_0xdcc8('0x13')]['message']);}else{logger['info'](_0xdcc8('0x10'),_0x5c3813,_0xdcc8('0x14'));_0x8a4e9f(_0x18c750['result'][_0xdcc8('0x15')]);}})['catch'](function(_0x3f6045){logger[_0xdcc8('0x13')]('ChatGroup,\x20%s,\x20%s',_0x5c3813,_0x3f6045);_0x25be24(_0x3f6045);});});} \ No newline at end of file +var _0x6d32=['socket.io-emitter','./chatGroup.socket','register','then','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','ChatGroup,\x20%s,\x20%s','lodash','util','moment','randomstring','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x59a3aa,_0x155b2b){var _0x3f64f9=function(_0x160398){while(--_0x160398){_0x59a3aa['push'](_0x59a3aa['shift']());}};_0x3f64f9(++_0x155b2b);}(_0x6d32,0x107));var _0x26d3=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x6d32[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x26d3('0x0'));var util=require(_0x26d3('0x1'));var moment=require(_0x26d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x26d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x26d3('0x4'));var config=require(_0x26d3('0x5'));var jayson=require(_0x26d3('0x6'));var client=jayson[_0x26d3('0x7')][_0x26d3('0x8')]({'port':0x232a});config['redis']=_[_0x26d3('0x9')](config[_0x26d3('0xa')],{'host':_0x26d3('0xb'),'port':0x18eb});var socket=require(_0x26d3('0xc'))(new Redis(config[_0x26d3('0xa')]));require(_0x26d3('0xd'))[_0x26d3('0xe')](socket);function respondWithRpcPromise(_0x308e93,_0x4e1ba4,_0x5efafa){return new BPromise(function(_0x3a5eb0,_0x3376db){return client['request'](_0x308e93,_0x5efafa)[_0x26d3('0xf')](function(_0x1d9576){logger['info']('ChatGroup,\x20%s,\x20%s',_0x4e1ba4,'request\x20sent');logger[_0x26d3('0x10')](_0x26d3('0x11'),_0x4e1ba4,_0x26d3('0x12'),JSON[_0x26d3('0x13')](_0x1d9576));if(_0x1d9576[_0x26d3('0x14')]){if(_0x1d9576[_0x26d3('0x14')][_0x26d3('0x15')]===0x1f4){logger[_0x26d3('0x14')]('ChatGroup,\x20%s,\x20%s',_0x4e1ba4,_0x1d9576['error'][_0x26d3('0x16')]);return _0x3376db(_0x1d9576[_0x26d3('0x14')]['message']);}logger[_0x26d3('0x14')]('ChatGroup,\x20%s,\x20%s',_0x4e1ba4,_0x1d9576[_0x26d3('0x14')][_0x26d3('0x16')]);return _0x3a5eb0(_0x1d9576[_0x26d3('0x14')][_0x26d3('0x16')]);}else{logger[_0x26d3('0x17')](_0x26d3('0x18'),_0x4e1ba4,_0x26d3('0x12'));_0x3a5eb0(_0x1d9576['result'][_0x26d3('0x16')]);}})['catch'](function(_0x2e02cd){logger[_0x26d3('0x14')](_0x26d3('0x18'),_0x4e1ba4,_0x2e02cd);_0x3376db(_0x2e02cd);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6afbaef..a7575f2 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 _0xafcc=['removeListener','register','length','save','remove','update','emit'];(function(_0x9464a8,_0x1dc07a){var _0x15d2cc=function(_0x22d218){while(--_0x22d218){_0x9464a8['push'](_0x9464a8['shift']());}};_0x15d2cc(++_0x1dc07a);}(_0xafcc,0xf1));var _0xcafc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafcc[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xcafc('0x0'),_0xcafc('0x1'),_0xcafc('0x2')];function createListener(_0x14533b,_0x5f0be7){return function(_0x57cbbe){_0x5f0be7[_0xcafc('0x3')](_0x14533b,_0x57cbbe);};}function removeListener(_0x4b43f2,_0x3e582f){return function(){ChatGroupEvents[_0xcafc('0x4')](_0x4b43f2,_0x3e582f);};}exports[_0xcafc('0x5')]=function(_0x5b7f27){for(var _0x3d9b5d=0x0,_0x1abae3=events[_0xcafc('0x6')];_0x3d9b5d<_0x1abae3;_0x3d9b5d++){var _0x32cde9=events[_0x3d9b5d];var _0x14c0a9=createListener('chatGroup:'+_0x32cde9,_0x5b7f27);ChatGroupEvents['on'](_0x32cde9,_0x14c0a9);}}; \ No newline at end of file +var _0x546c=['removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x481ff7,_0x2b6ebb){var _0x1c1573=function(_0x4933fe){while(--_0x4933fe){_0x481ff7['push'](_0x481ff7['shift']());}};_0x1c1573(++_0x2b6ebb);}(_0x546c,0x82));var _0xc546=function(_0x20166d,_0x5674bd){_0x20166d=_0x20166d-0x0;var _0x5792a8=_0x546c[_0x20166d];return _0x5792a8;};'use strict';var ChatGroupEvents=require(_0xc546('0x0'));var events=[_0xc546('0x1'),_0xc546('0x2'),_0xc546('0x3')];function createListener(_0x5ba328,_0x308310){return function(_0x2c3f7a){_0x308310[_0xc546('0x4')](_0x5ba328,_0x2c3f7a);};}function removeListener(_0xd1685a,_0xfdb5b1){return function(){ChatGroupEvents[_0xc546('0x5')](_0xd1685a,_0xfdb5b1);};}exports[_0xc546('0x6')]=function(_0x76d95b){for(var _0x548f4c=0x0,_0x82e0fb=events[_0xc546('0x7')];_0x548f4c<_0x82e0fb;_0x548f4c++){var _0x5acebe=events[_0x548f4c];var _0x501270=createListener(_0xc546('0x8')+_0x5acebe,_0x76d95b);ChatGroupEvents['on'](_0x5acebe,_0x501270);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9904286..c24b014 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 _0x3463=['create','addMembers','post','addMessage','put','/:id','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages'];(function(_0x445e9d,_0x653aaf){var _0x2a9360=function(_0x326689){while(--_0x326689){_0x445e9d['push'](_0x445e9d['shift']());}};_0x2a9360(++_0x653aaf);}(_0x3463,0x184));var _0x3346=function(_0x52d303,_0x26f460){_0x52d303=_0x52d303-0x0;var _0x42d1c6=_0x3463[_0x52d303];return _0x42d1c6;};'use strict';var multer=require('multer');var util=require(_0x3346('0x0'));var path=require(_0x3346('0x1'));var timeout=require(_0x3346('0x2'));var express=require(_0x3346('0x3'));var router=express['Router']();var auth=require(_0x3346('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3346('0x5'));var controller=require(_0x3346('0x6'));router['get']('/',auth[_0x3346('0x7')](),controller[_0x3346('0x8')]);router[_0x3346('0x9')](_0x3346('0xa'),auth[_0x3346('0x7')](),controller['describe']);router[_0x3346('0x9')]('/:id',auth[_0x3346('0x7')](),controller[_0x3346('0xb')]);router['get']('/:id/unread',auth[_0x3346('0x7')](),controller[_0x3346('0xc')]);router[_0x3346('0x9')](_0x3346('0xd'),auth[_0x3346('0x7')](),controller[_0x3346('0xe')]);router[_0x3346('0x9')](_0x3346('0xf'),auth['isAuthenticated'](),controller[_0x3346('0x10')]);router['post']('/',auth[_0x3346('0x7')](),controller[_0x3346('0x11')]);router['post']('/:id/members',auth['isAuthenticated'](),controller[_0x3346('0x12')]);router[_0x3346('0x13')](_0x3346('0xf'),auth[_0x3346('0x7')](),controller[_0x3346('0x14')]);router[_0x3346('0x15')](_0x3346('0x16'),auth[_0x3346('0x7')](),controller['update']);router[_0x3346('0x17')]('/:id',auth[_0x3346('0x7')](),controller[_0x3346('0x18')]);router[_0x3346('0x17')](_0x3346('0xd'),auth['isAuthenticated'](),controller[_0x3346('0x19')]);module[_0x3346('0x1a')]=router; \ No newline at end of file +var _0xf486=['destroy','removeMembers','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMessage','put','update','delete'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xf486,0x1bc));var _0x6f48=function(_0x2ec6fa,_0x190e5a){_0x2ec6fa=_0x2ec6fa-0x0;var _0x20cef1=_0xf486[_0x2ec6fa];return _0x20cef1;};'use strict';var multer=require(_0x6f48('0x0'));var util=require(_0x6f48('0x1'));var path=require('path');var timeout=require(_0x6f48('0x2'));var express=require(_0x6f48('0x3'));var router=express[_0x6f48('0x4')]();var auth=require(_0x6f48('0x5'));var interaction=require(_0x6f48('0x6'));var config=require(_0x6f48('0x7'));var controller=require('./chatGroup.controller');router[_0x6f48('0x8')]('/',auth[_0x6f48('0x9')](),controller[_0x6f48('0xa')]);router['get'](_0x6f48('0xb'),auth[_0x6f48('0x9')](),controller['describe']);router[_0x6f48('0x8')](_0x6f48('0xc'),auth[_0x6f48('0x9')](),controller[_0x6f48('0xd')]);router[_0x6f48('0x8')]('/:id/unread',auth['isAuthenticated'](),controller[_0x6f48('0xe')]);router[_0x6f48('0x8')](_0x6f48('0xf'),auth[_0x6f48('0x9')](),controller[_0x6f48('0x10')]);router[_0x6f48('0x8')](_0x6f48('0x11'),auth[_0x6f48('0x9')](),controller[_0x6f48('0x12')]);router['post']('/',auth[_0x6f48('0x9')](),controller['create']);router[_0x6f48('0x13')]('/:id/members',auth[_0x6f48('0x9')](),controller['addMembers']);router[_0x6f48('0x13')](_0x6f48('0x11'),auth['isAuthenticated'](),controller[_0x6f48('0x14')]);router[_0x6f48('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x6f48('0x16')]);router[_0x6f48('0x17')](_0x6f48('0xc'),auth[_0x6f48('0x9')](),controller[_0x6f48('0x18')]);router[_0x6f48('0x17')]('/:id/members',auth[_0x6f48('0x9')](),controller[_0x6f48('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 455e428..196ab0e 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 _0xf74e=['DATE','exports','INTEGER','ENUM','thumb','star','TEXT','STRING','long'];(function(_0x5b39e3,_0x5b49f3){var _0xe11877=function(_0x3f7ebd){while(--_0x3f7ebd){_0x5b39e3['push'](_0x5b39e3['shift']());}};_0xe11877(++_0x5b49f3);}(_0xf74e,0xf4));var _0xef74=function(_0xafb36e,_0x538cf1){_0xafb36e=_0xafb36e-0x0;var _0x2623e3=_0xf74e[_0xafb36e];return _0x2623e3;};'use strict';var Sequelize=require('sequelize');module[_0xef74('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xef74('0x1')]},'ratingType':{'type':Sequelize[_0xef74('0x2')]('star',_0xef74('0x3')),'defaultValue':_0xef74('0x4')},'ratingMessage':{'type':Sequelize[_0xef74('0x5')]},'pathTranscript':{'type':Sequelize[_0xef74('0x5')]},'mailTranscript':{'type':Sequelize[_0xef74('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xef74('0x6')]},'note':{'type':Sequelize[_0xef74('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xef74('0x6')]},'osName':{'type':Sequelize[_0xef74('0x6')]},'osVersion':{'type':Sequelize[_0xef74('0x6')]},'deviceModel':{'type':Sequelize[_0xef74('0x6')]},'deviceVendor':{'type':Sequelize[_0xef74('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xef74('0x6')]},'formData':{'type':Sequelize[_0xef74('0x5')](_0xef74('0x7'))},'read1stAt':{'type':Sequelize[_0xef74('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xef74('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xef74('0x6')]},'customerPort':{'type':Sequelize[_0xef74('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xef74('0x5')]}}; \ No newline at end of file +var _0x5621=['BOOLEAN','INTEGER','ENUM','thumb','TEXT','DATE','STRING','long','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5621,0x131));var _0x1562=function(_0x55d109,_0x484df9){_0x55d109=_0x55d109-0x0;var _0x40a177=_0x5621[_0x55d109];return _0x40a177;};'use strict';var Sequelize=require(_0x1562('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1562('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1562('0x2')]},'ratingType':{'type':Sequelize[_0x1562('0x3')]('star',_0x1562('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1562('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1562('0x6')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1562('0x7')]},'browserName':{'type':Sequelize[_0x1562('0x7')]},'browserVersion':{'type':Sequelize[_0x1562('0x7')]},'osName':{'type':Sequelize[_0x1562('0x7')]},'osVersion':{'type':Sequelize[_0x1562('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x1562('0x7')]},'deviceType':{'type':Sequelize[_0x1562('0x7')]},'referer':{'type':Sequelize[_0x1562('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x1562('0x5')](_0x1562('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1562('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1562('0x7')]},'customerPort':{'type':Sequelize[_0x1562('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x1562('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 16ec0c9..060b809 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 _0x583c=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','Sequelize','ValidationError','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','map','fullname','TagIds','Tags','split','ChatInteraction','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','value','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','type','body','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','show','params','includeAll','create','describe','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','attachmentDownload','findOne','Unauthorized','Attachment','attachId','download','join','root','server/files/attachments/','basename','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','agentAlias','customer','%s%d','Visitor','agentIdentifier','website_alias','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','getMyMessages','addTags','omit','emit','removeTags','server','files','attachments','firstName','lastName','ChatWebsite','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','\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','Owner','N.A.','closedAt','osName','referer','customerIp','customerPort','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','.pdf','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs'];(function(_0x18be2c,_0x551207){var _0x6e56d3=function(_0x10df15){while(--_0x10df15){_0x18be2c['push'](_0x18be2c['shift']());}};_0x6e56d3(++_0x551207);}(_0x583c,0x12b));var _0xc583=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0x583c[_0x39106e];return _0x892aec;};'use strict';var pdf=require(_0xc583('0x0'));var emlformat=require(_0xc583('0x1'));var rimraf=require(_0xc583('0x2'));var zipdir=require(_0xc583('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc583('0x4'));var moment=require(_0xc583('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc583('0x6'));var path=require(_0xc583('0x7'));var sox=require('sox');var csv=require(_0xc583('0x8'));var ejs=require(_0xc583('0x9'));var fs=require('fs');var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var db=require('../../mysqldb')['db'];config[_0xc583('0x17')]=_[_0xc583('0x18')](config[_0xc583('0x17')],{'host':_0xc583('0x19'),'port':0x18eb});var socket=require(_0xc583('0x1a'))(new Redis(config[_0xc583('0x17')]));require(_0xc583('0x1b'))[_0xc583('0x1c')](socket);var jayson=require(_0xc583('0x1d'));var client=jayson['client'][_0xc583('0x1e')]({'port':0x232b});var client9004=jayson['client'][_0xc583('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x299fa1,_0x510090,_0x263552){if(_0x263552){var _0x311ad5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x311ad5['test'](_0x510090)){return _0x299fa1;}else{throw new db[(_0xc583('0x1f'))][(_0xc583('0x20'))]('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 _0x299fa1;}}function respondWithRpcPromise(_0x21cf22,_0x8a2d84,_0x12aac2,_0x36e0fd){return new BPromise(function(_0x5433ec,_0x3dd3cc){var _0x48a65a=_0x36e0fd||client;return _0x48a65a[_0xc583('0x21')](_0x21cf22,_0x12aac2)[_0xc583('0x22')](function(_0xfd9a60){logger[_0xc583('0x23')](_0xc583('0x24'),_0x8a2d84,_0xc583('0x25'));logger[_0xc583('0x26')](_0xc583('0x27'),_0x8a2d84,_0xc583('0x25'),JSON[_0xc583('0x28')](_0xfd9a60));if(_0xfd9a60[_0xc583('0x29')]){if(_0xfd9a60[_0xc583('0x29')][_0xc583('0x2a')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x8a2d84,_0xfd9a60[_0xc583('0x29')][_0xc583('0x2b')]);return _0x3dd3cc(_0xfd9a60[_0xc583('0x29')]['message']);}logger[_0xc583('0x29')](_0xc583('0x24'),_0x8a2d84,_0xfd9a60[_0xc583('0x29')][_0xc583('0x2b')]);return _0x5433ec(_0xfd9a60[_0xc583('0x29')]['message']);}else{logger['info'](_0xc583('0x24'),_0x8a2d84,'request\x20sent');_0x5433ec(_0xfd9a60[_0xc583('0x2c')][_0xc583('0x2b')]);}})[_0xc583('0x2d')](function(_0x1e7809){logger[_0xc583('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x8a2d84,_0x1e7809);_0x3dd3cc(_0x1e7809);});});}function respondWithStatusCode(_0x2dafb4,_0x44f76a){_0x44f76a=_0x44f76a||0xcc;return function(_0x4adde3){if(_0x4adde3){return _0x2dafb4[_0xc583('0x2e')](_0x44f76a);}return _0x2dafb4['status'](_0x44f76a)[_0xc583('0x2f')]();};}function respondWithResult(_0x8d4ecb,_0x1c80b1){_0x1c80b1=_0x1c80b1||0xc8;return function(_0x3ed083){if(_0x3ed083){return _0x8d4ecb[_0xc583('0x30')](_0x1c80b1)[_0xc583('0x31')](_0x3ed083);}};}function respondWithFilteredResult(_0x113b39,_0x4a87b5){return function(_0x529dbe){if(_0x529dbe){var _0x390bc3=_0x529dbe[_0xc583('0x32')],_0x23f3a4=_0x4a87b5['offset'],_0xcbf1f1=_0x4a87b5[_0xc583('0x33')]+_0x4a87b5['limit'],_0x1dd665;if(_0xcbf1f1>=_0x390bc3){_0xcbf1f1=_0x390bc3;_0x1dd665=0xc8;}else{_0x1dd665=0xce;}_0x113b39['status'](_0x1dd665);return _0x113b39[_0xc583('0x34')](_0xc583('0x35'),_0x23f3a4+'-'+_0xcbf1f1+'/'+_0x390bc3)[_0xc583('0x31')](_0x529dbe);}return null;};}function patchUpdates(_0x595ae1){return function(_0x430fe6){try{jsonpatch['apply'](_0x430fe6,_0x595ae1,!![]);}catch(_0x3e41c0){return BPromise[_0xc583('0x36')](_0x3e41c0);}return _0x430fe6[_0xc583('0x37')]();};}function saveUpdates(_0x48f00b,_0x18b097){return function(_0x55bdca){if(_0x55bdca){return _0x55bdca[_0xc583('0x38')](_0x48f00b)[_0xc583('0x22')](function(_0x473072){return _0x473072;});}return null;};}function removeEntity(_0x18a288,_0x3bd1fd){return function(_0x4d7add){if(_0x4d7add){return _0x4d7add[_0xc583('0x39')]()['then'](function(){_0x18a288[_0xc583('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e96fc,_0x3a562c){return function(_0x7d89d0){if(!_0x7d89d0){_0x2e96fc[_0xc583('0x2e')](0x194);}return _0x7d89d0;};}function handleError(_0xa44825,_0x41b466){_0x41b466=_0x41b466||0x1f4;return function(_0x54200c){logger['error'](_0x54200c[_0xc583('0x3a')]);if(_0x54200c[_0xc583('0x3b')]){delete _0x54200c['name'];}_0xa44825[_0xc583('0x30')](_0x41b466)[_0xc583('0x3c')](_0x54200c);};}function getInteractionUsers(_0x22de5a,_0xb9b427){return new BPromise(function(_0x37b8c7,_0x388a85){try{if(_0xb9b427[_0x22de5a['id']]){_0x22de5a['Users']=_[_0xc583('0x3d')](_0xb9b427[_0x22de5a['id']],function(_0x595351){return{'id':_0x595351['id'],'fullname':_0x595351[_0xc583('0x3e')]};});}}catch(_0x22cc57){_0x388a85(_0x22cc57);}_0x37b8c7(_0x22de5a);});}function getInteractionTags(_0x39bed4,_0x502b6d){return new BPromise(function(_0x51ef91,_0x518c90){try{if(_0x39bed4[_0xc583('0x3f')]){_0x39bed4[_0xc583('0x40')]=[];_0x39bed4[_0xc583('0x3f')][_0xc583('0x41')](',')['forEach'](function(_0x374196){_0x39bed4[_0xc583('0x40')]['push'](_0x502b6d[_0x374196]);});}delete _0x39bed4['TagIds'];}catch(_0x1ea5da){_0x518c90(_0x1ea5da);}_0x51ef91(_0x39bed4);});}function updateChatInteraction(_0x5ad3d8,_0x254592,_0x1ec6f9){return new BPromise(function(_0xe73752,_0x40b888){return getInteractionUsers(_0x5ad3d8,_0x1ec6f9)['then'](function(_0x44c22f){return getInteractionTags(_0x44c22f,_0x254592);})[_0xc583('0x22')](function(_0x39c5ab){_0xe73752(_0x39c5ab);})[_0xc583('0x2d')](function(_0x2c1c22){_0x40b888(_0x2c1c22);});});}exports['index']=function(_0x3ffeb7,_0x5f5a97){var _0x4b78df={},_0x2f97a4={},_0x21e231={'count':0x0,'rows':[]};var _0x5788c7=_['map'](db[_0xc583('0x42')][_0xc583('0x43')],function(_0x7d1b29){return{'name':_0x7d1b29[_0xc583('0x44')],'type':_0x7d1b29['type'][_0xc583('0x45')]};});_0x2f97a4['model']=_[_0xc583('0x3d')](_0x5788c7,'name');_0x2f97a4[_0xc583('0x46')]=_[_0xc583('0x47')](_0x3ffeb7[_0xc583('0x46')]);_0x2f97a4[_0xc583('0x48')]=_[_0xc583('0x49')](_0x2f97a4['model'],_0x2f97a4[_0xc583('0x46')]);_0x4b78df[_0xc583('0x4a')]=_[_0xc583('0x49')](_0x2f97a4['model'],qs['fields'](_0x3ffeb7['query'][_0xc583('0x4b')]));_0x4b78df['attributes']=_0x4b78df[_0xc583('0x4a')][_0xc583('0x4c')]?_0x4b78df[_0xc583('0x4a')]:_0x2f97a4[_0xc583('0x4d')];if(!_0x3ffeb7[_0xc583('0x46')][_0xc583('0x4e')](_0xc583('0x4f'))){_0x4b78df[_0xc583('0x50')]=qs[_0xc583('0x50')](_0x3ffeb7[_0xc583('0x46')][_0xc583('0x50')]);_0x4b78df['offset']=qs[_0xc583('0x33')](_0x3ffeb7[_0xc583('0x46')][_0xc583('0x33')]);}_0x4b78df[_0xc583('0x51')]=qs['sort'](_0x3ffeb7[_0xc583('0x46')][_0xc583('0x52')]);_0x4b78df[_0xc583('0x53')]=qs[_0xc583('0x48')](_[_0xc583('0x54')](_0x3ffeb7[_0xc583('0x46')],_0x2f97a4[_0xc583('0x48')]),_0x5788c7);var _0x12291c=[];var _0x32512b=squel['select']()[_0xc583('0x55')]('id')[_0xc583('0x55')](_0xc583('0x3b'))[_0xc583('0x55')](_0xc583('0x56'))[_0xc583('0x57')](_0xc583('0x58'));var _0x465c71=squel[_0xc583('0x59')]()[_0xc583('0x55')](_0xc583('0x5a'))[_0xc583('0x55')](_0xc583('0x5b'))['field'](_0xc583('0x5c'))[_0xc583('0x57')](_0xc583('0x5d'),'ui')[_0xc583('0x5e')](_0xc583('0x5f'),'u',_0xc583('0x60'));var _0x24351f=squel[_0xc583('0x59')]()[_0xc583('0x57')]('chat_interactions','i')[_0xc583('0x5e')](_0xc583('0x61'),'c',_0xc583('0x62'))['left_join']('users','o',_0xc583('0x63'))['left_join'](_0xc583('0x64'),'a',_0xc583('0x65'))['left_join']('chat_messages','me',_0xc583('0x66'))[_0xc583('0x5e')](_0xc583('0x67'),'it',_0xc583('0x68'))[_0xc583('0x5e')](_0xc583('0x58'),'t',_0xc583('0x69'));var _0x43b438=squel['expr']();var _0x1d41df=[];var _0x9bbf43=squel[_0xc583('0x6a')]();var _0x1c4921;if(_0x3ffeb7['query'][_0xc583('0x6b')]){_0x1c4921=as[_0xc583('0x6c')](_0x3ffeb7['query']['search']);var _0x12b114=_0x1c4921['sqlOperator'];for(var _0x30b1e0=0x0;_0x30b1e0<_0x1c4921[_0xc583('0x6d')][_0xc583('0x4c')];_0x30b1e0++){var _0x5ea011=_0x1c4921['conditions'][_0x30b1e0];var _0x1ea579='i';var _0x3a5033=_[_0xc583('0x6e')](_0x5788c7,[_0xc583('0x3b'),_0x5ea011['field']]);if(!_0x3a5033){switch(_0x5ea011[_0xc583('0x55')]){case _0xc583('0x6f'):if(_0x5ea011['value']==0x1){_0x24351f['having']('`'+_0x5ea011[_0xc583('0x55')]+'`\x20=\x200');}else{_0x24351f['having']('`'+_0x5ea011[_0xc583('0x55')]+_0xc583('0x70'));}break;case _0xc583('0x71'):if(_0x5ea011[_0xc583('0x72')]===_0xc583('0x73')){if(_0x5ea011['value']['split']('\x20')[_0xc583('0x4c')]>0x1){_0x43b438[_0x12b114](_0xc583('0x74'),qs['getFullTextValue'](_0x5ea011['value']),null);}else{var _0x1cfb34='%'+_0x5ea011['value']+'%';_0x43b438[_0x12b114](_0xc583('0x75'),_0x1cfb34,_0x1cfb34,_0x1cfb34);}}else{_0x3a5033=_[_0xc583('0x6e')](_0x5788c7,['name',_0xc583('0x76')]);_0x5ea011['field']=_0xc583('0x76');_0x54e331=as[_0xc583('0x77')](_0x1ea579,_0x3a5033['type'],_0x5ea011);_0x43b438[_0x12b114](_0x54e331[_0xc583('0x78')],_0x54e331[_0xc583('0x79')][_0xc583('0x7a')],_0x54e331[_0xc583('0x79')][_0xc583('0x2f')]);}break;case _0xc583('0x7b'):var _0x37613c=_0x5ea011[_0xc583('0x79')]['split'](',')['map'](function(_0x4d0f8b){return Number(_0x4d0f8b);});_0x37613c[_0xc583('0x7c')](function(_0x4d498b){_0x9bbf43['or'](_0xc583('0x7d'),'%,'+_0x4d498b+',%');});_0x1d41df=_[_0xc583('0x7e')](_0x1d41df,_0x37613c);break;case _0xc583('0x7f'):if(_0x5ea011[_0xc583('0x72')]===_0xc583('0x73')){_0x43b438[_0x12b114](_0xc583('0x80'),'%'+_0x5ea011[_0xc583('0x79')]+'%',null);}else{_0x3a5033=_[_0xc583('0x6e')](_0x5788c7,['name',_0xc583('0x81')]);_0x5ea011[_0xc583('0x55')]=_0xc583('0x81');_0x54e331=as[_0xc583('0x77')](_0x1ea579,_0x3a5033[_0xc583('0x82')],_0x5ea011);_0x43b438[_0x12b114](_0x54e331[_0xc583('0x78')],_0x54e331['value'][_0xc583('0x7a')],_0x54e331[_0xc583('0x79')][_0xc583('0x2f')]);}break;case _0xc583('0x83'):_0x54e331=as[_0xc583('0x77')]('me',null,_0x5ea011);_0x43b438[_0x12b114](_0x54e331[_0xc583('0x78')],_0x54e331['value'][_0xc583('0x7a')],_0x54e331[_0xc583('0x79')][_0xc583('0x2f')]);break;}}else{var _0x54e331=as[_0xc583('0x77')](_0x1ea579,_0x3a5033['type'],_0x5ea011);_0x43b438[_0x12b114](_0x54e331[_0xc583('0x78')],_0x54e331[_0xc583('0x79')][_0xc583('0x7a')],_0x54e331[_0xc583('0x79')][_0xc583('0x2f')]);}}}else{var _0x89f9af=_(_0x3ffeb7[_0xc583('0x46')])['keys']()['map'](function(_0x5e979d){return _['some'](_0x5788c7,[_0xc583('0x3b'),_0x5e979d])?_0x5e979d:undefined;})[_0xc583('0x84')]()[_0xc583('0x79')]();if(!_[_0xc583('0x85')](_0x89f9af)){_0x89f9af[_0xc583('0x7c')](function(_0xbb22fa){if(_0xbb22fa===_0xc583('0x86')){_0x24351f[_0xc583('0x53')](_0xc583('0x87'),[][_0xc583('0x88')](_0x3ffeb7['query'][_0xbb22fa]));}else if(_0xbb22fa===_0xc583('0x89')){var _0xc82dd5=JSON['parse'](_0x3ffeb7['query'][_0xbb22fa])['$gte'];var _0x118682=JSON[_0xc583('0x8a')](_0x3ffeb7[_0xc583('0x46')][_0xbb22fa])[_0xc583('0x8b')];_0x24351f[_0xc583('0x53')](_0xc583('0x8c'),_0xc82dd5,_0x118682);}else{if(_0x3ffeb7[_0xc583('0x46')][_0xbb22fa]===_0xc583('0x8d')){_0x24351f[_0xc583('0x53')]('i.'+_0xbb22fa+'\x20IS\x20NULL');}else{_0x24351f[_0xc583('0x53')]('i.'+_0xbb22fa+_0xc583('0x8e'),_0x3ffeb7['query'][_0xbb22fa]);}}});}if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x8f')]){if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x8f')]==0x1){_0x24351f[_0xc583('0x90')]('`unreadMessages`\x20=\x200');}else{_0x24351f[_0xc583('0x90')](_0xc583('0x91'));}}if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x92')]){_0x1d41df=_['isArray'](_0x3ffeb7['query']['tag'])?_0x3ffeb7[_0xc583('0x46')]['tag']:new Array(_0x3ffeb7['query']['tag']);_0x1d41df[_0xc583('0x7c')](function(_0x3e8319){_0x9bbf43['or'](_0xc583('0x7d'),'%,'+_0x3e8319+',%');});}if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x93')]){var _0x5150b4=_0x3ffeb7[_0xc583('0x46')][_0xc583('0x93')][_0xc583('0x94')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xc583('0x95'));if(qs[_0xc583('0x96')](_0x5150b4)){_0x43b438['or']('i.id\x20LIKE\x20?',_0x5150b4+'%');}else{_0x43b438['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc583('0x97')](_0x5150b4))['or'](_0xc583('0x98'),_0x5150b4+'%');}}}_0x24351f[_0xc583('0x53')](_0x43b438);_0x24351f[_0xc583('0x99')](_0xc583('0x9a'));var _0x10651c={'type':db[_0xc583('0x1f')][_0xc583('0x9b')]['SELECT'],'raw':!![]};var _0x288c4e=_0x24351f[_0xc583('0x9c')]();_0x288c4e[_0xc583('0x55')](_0xc583('0x9a'));_0x288c4e[_0xc583('0x55')](_0xc583('0x9d'),_0xc583('0x6f'));if(_0x4b78df[_0xc583('0x51')]){_0x4b78df[_0xc583('0x51')][_0xc583('0x7c')](function(_0x562bb6){_0x24351f[_0xc583('0x51')]('i.'+_0x562bb6[0x0],_0x562bb6[0x1]===_0xc583('0x9e')?![]:!![]);});}if(!_[_0xc583('0x85')](_0x1d41df)){_0x24351f[_0xc583('0x90')](_0x9bbf43);_0x288c4e[_0xc583('0x53')](_0xc583('0x9f'),_0x1d41df);}BPromise[_0xc583('0xa0')]()[_0xc583('0x22')](function(){if(!_0x1c4921){if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x86')]||_0x3ffeb7[_0xc583('0x46')][_0xc583('0xa1')])return;_0x288c4e[_0xc583('0x53')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x24351f['where'](_0xc583('0xa2'));return;}return _0x3ffeb7[_0xc583('0xa3')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x194989){if(_[_0xc583('0x85')](_0x194989)){_0x288c4e['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x24351f[_0xc583('0x53')](_0xc583('0xa4'));}else{_0x288c4e[_0xc583('0x53')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x194989,'id'));_0x24351f[_0xc583('0x53')](_0xc583('0x87'),_[_0xc583('0x3d')](_0x194989,'id'));}});})['then'](function(){db[_0xc583('0xa5')][_0xc583('0x46')](_0x288c4e['toString'](),_0x10651c)[_0xc583('0x22')](function(_0x1649ad){_0x21e231[_0xc583('0x32')]=_0x1649ad[_0xc583('0x4c')];if(_0x21e231[_0xc583('0x32')]===0x0)return[];return db[_0xc583('0xa5')][_0xc583('0x46')](_0x32512b['toString'](),_0x10651c)['then'](function(_0x5dd5c7){_0x12291c=_[_0xc583('0xa6')](_0x5dd5c7,'id');_0x10651c=_[_0xc583('0xa7')](_0x10651c,{'model':db[_0xc583('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x4b')]){_0x4b78df[_0xc583('0x4a')][_0xc583('0x7c')](function(_0x6a7877){_0x24351f['field']('i.'+_0x6a7877);});}else{_0x24351f[_0xc583('0x55')](_0xc583('0x9d'),_0xc583('0x6f'));_0x24351f[_0xc583('0x55')]('a.key','Account.key');_0x24351f['field'](_0xc583('0xa8'),_0xc583('0xa9'));_0x24351f[_0xc583('0x55')](_0xc583('0xaa'));_0x24351f[_0xc583('0x55')](_0xc583('0xab'),'Contact.firstName');_0x24351f['field'](_0xc583('0xac'),_0xc583('0xad'));_0x24351f['field'](_0xc583('0xae'),_0xc583('0xaf'));_0x24351f[_0xc583('0x55')](_0xc583('0xb0'),_0xc583('0xb1'));_0x24351f[_0xc583('0x55')]('c.mobile',_0xc583('0xb2'));_0x24351f[_0xc583('0x55')](_0xc583('0xb3'),_0xc583('0xb4'));_0x24351f[_0xc583('0x55')](_0xc583('0xb5'),_0xc583('0xb6'));_0x24351f[_0xc583('0x55')](_0xc583('0xb7'),_0xc583('0xb8'));_0x24351f['field'](_0xc583('0xb9'),_0xc583('0x3f'));}if(_0x4b78df[_0xc583('0x50')])_0x24351f['limit'](_0x4b78df[_0xc583('0x50')]);if(_0x4b78df['offset'])_0x24351f[_0xc583('0x33')](_0x4b78df[_0xc583('0x33')]);return db[_0xc583('0xa5')][_0xc583('0x46')](_0x24351f[_0xc583('0xba')](),_0x10651c);})[_0xc583('0x22')](function(_0x15e2b6){_0x465c71['where'](_0xc583('0xbb'),_['map'](_0x15e2b6,'id'));return db[_0xc583('0xa5')]['query'](_0x465c71[_0xc583('0xba')](),_0x10651c)[_0xc583('0x22')](function(_0x1d17c2){var _0x25d16e=_[_0xc583('0xbc')](_0x1d17c2,_0xc583('0xbd'));var _0x16273a=[];_0x15e2b6[_0xc583('0x7c')](function(_0x53f66a){_0x16273a[_0xc583('0xbe')](updateChatInteraction(_0x53f66a,_0x12291c,_0x25d16e));});return BPromise[_0xc583('0xbf')](_0x16273a);});});})[_0xc583('0x22')](function(_0x3ae684){_0x21e231[_0xc583('0xc0')]=_0x3ae684;return _0x21e231;})['then'](respondWithFilteredResult(_0x5f5a97,_0x4b78df));})[_0xc583('0x2d')](handleError(_0x5f5a97,null));};exports[_0xc583('0xc1')]=function(_0x1b246e,_0x5adde2){var _0x4d892c={'raw':![],'where':{'id':_0x1b246e[_0xc583('0xc2')]['id']}},_0xbbdcc4={};_0xbbdcc4[_0xc583('0x4d')]=_[_0xc583('0x47')](db[_0xc583('0x42')][_0xc583('0x43')]);_0xbbdcc4['query']=_[_0xc583('0x47')](_0x1b246e[_0xc583('0x46')]);_0xbbdcc4[_0xc583('0x48')]=_[_0xc583('0x49')](_0xbbdcc4[_0xc583('0x4d')],_0xbbdcc4['query']);_0x4d892c[_0xc583('0x4a')]=_['intersection'](_0xbbdcc4[_0xc583('0x4d')],qs['fields'](_0x1b246e[_0xc583('0x46')][_0xc583('0x4b')]));_0x4d892c['attributes']=_0x4d892c['attributes'][_0xc583('0x4c')]?_0x4d892c[_0xc583('0x4a')]:_0xbbdcc4[_0xc583('0x4d')];if(_0x1b246e[_0xc583('0x46')][_0xc583('0xc3')]){_0x4d892c['include']=[{'all':!![]}];}_0x4d892c=_[_0xc583('0xa7')]({},_0x4d892c,_0x1b246e['options']);return db[_0xc583('0x42')][_0xc583('0x6e')](_0x4d892c)[_0xc583('0x22')](handleEntityNotFound(_0x5adde2,null))[_0xc583('0x22')](respondWithResult(_0x5adde2,null))['catch'](handleError(_0x5adde2,null));};exports['create']=function(_0x54f43b,_0x1cbdea){return db[_0xc583('0x42')][_0xc583('0xc4')](_0x54f43b['body'],{})[_0xc583('0x22')](respondWithResult(_0x1cbdea,0xc9))[_0xc583('0x2d')](handleError(_0x1cbdea,null));};exports['update']=function(_0x392a65,_0x584454){if(_0x392a65[_0xc583('0x83')]['id']){delete _0x392a65[_0xc583('0x83')]['id'];}return db[_0xc583('0x42')][_0xc583('0x6e')]({'where':{'id':_0x392a65['params']['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x584454,null))[_0xc583('0x22')](saveUpdates(_0x392a65[_0xc583('0x83')],null))['then'](respondWithResult(_0x584454,null))['catch'](handleError(_0x584454,null));};exports['destroy']=function(_0xa87e9d,_0x3eac6f){return db['ChatInteraction'][_0xc583('0x6e')]({'where':{'id':_0xa87e9d[_0xc583('0xc2')]['id']}})['then'](handleEntityNotFound(_0x3eac6f,null))['then'](removeEntity(_0x3eac6f,null))[_0xc583('0x2d')](handleError(_0x3eac6f,null));};exports['describe']=function(_0x790cd1,_0x3e1c5e){return db[_0xc583('0x42')][_0xc583('0xc5')]()[_0xc583('0x22')](respondWithResult(_0x3e1c5e,null))[_0xc583('0x2d')](handleError(_0x3e1c5e,null));};exports['createVidaooSession']=function(_0x3bcbce,_0x1628f4){var _0x45a609=_0x3bcbce[_0xc583('0xc2')]['id'];var _0x3fa08e;var _0x2a3ef9;var _0x4d24e7;return db[_0xc583('0x42')]['findOne']({'where':{'id':_0x45a609}})[_0xc583('0x22')](function(_0x146b9c){_0x3fa08e=_0x146b9c;return db['ChatWebsite']['findOne']({'where':{'id':_0x146b9c[_0xc583('0x86')]},'attributes':['id','vidaooApiKey','vidaooEscalation'],'raw':!![]});})[_0xc583('0x22')](function(_0x5490f5){if(_0x5490f5&&_0x5490f5[_0xc583('0xc6')]&&_0x5490f5[_0xc583('0xc7')]){_0x2a3ef9=_0x5490f5;var _0x18d8b5={'rejectUnauthorized':![],'method':_0xc583('0xc8'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x5490f5[_0xc583('0xc6')]},'body':{'name':_0xc583('0xc9')+_0x45a609},'redirect':_0xc583('0xca'),'json':!![]};return rp(_0x18d8b5);}else{throw new db[(_0xc583('0x1f'))][(_0xc583('0x20'))](_0xc583('0xcb'));}})[_0xc583('0x22')](function(_0x63eee8){_0x4d24e7=_0x63eee8;if(_0x4d24e7['id']){var _0x2d0297={'body':_0x4d24e7[_0xc583('0xcc')],'ChatWebsiteId':_0x2a3ef9['id'],'ChatInteractionId':_0x3fa08e['id'],'direction':_0xc583('0xcd'),'UserId':_0x3bcbce[_0xc583('0xa3')]['id']};return db[_0xc583('0xce')]['create'](_0x2d0297,{});}else{throw new db[(_0xc583('0x1f'))][(_0xc583('0x20'))](_0xc583('0xcf'));}})[_0xc583('0x22')](function(){return _0x3fa08e[_0xc583('0xd0')]({'vidaooSessionId':_0x4d24e7['id']});})[_0xc583('0x22')](respondWithResult(_0x1628f4,null))[_0xc583('0x2d')](handleError(_0x1628f4,null));};exports[_0xc583('0xd1')]=function(_0x5f5b7a,_0x2324f8){if(_0x5f5b7a[_0xc583('0x83')]['id']){delete _0x5f5b7a['body']['id'];}return db['ChatInteraction'][_0xc583('0x6e')]({'where':{'id':_0x5f5b7a[_0xc583('0xc2')]['id']}})['then'](handleEntityNotFound(_0x2324f8,null))[_0xc583('0x22')](saveUpdates(_0x5f5b7a['body'],null))[_0xc583('0x22')](respondWithResult(_0x2324f8,null))[_0xc583('0x2d')](handleError(_0x2324f8,null));};exports[_0xc583('0xd2')]=function(_0x42f4ec,_0x314072,_0x112652){if(_0x42f4ec[_0xc583('0x83')]['id']){delete _0x42f4ec['body']['id'];}return db['ChatInteraction'][_0xc583('0x6e')]({'where':{'id':_0x42f4ec['params']['id']}})[_0xc583('0x22')](function(_0x5dfbd5){if(!_0x5dfbd5){logger[_0xc583('0x29')](_0xc583('0xd3'),'abandon',0x194,_0xc583('0xd4'));_0x314072[_0xc583('0x2e')](0x194);}else{if(_0x5dfbd5[_0xc583('0x81')]){throw new db[(_0xc583('0x1f'))]['ValidationError'](_0xc583('0xd5'));}}return _0x5dfbd5;})[_0xc583('0x22')](function(_0x38a4d0){if(_0x38a4d0){return _0x38a4d0['update']({'closed':_0x42f4ec[_0xc583('0x83')][_0xc583('0xd6')],'disposition':_0x42f4ec[_0xc583('0x83')][_0xc583('0xd7')]})[_0xc583('0x22')](function(_0x5db6a2){return _0x5db6a2;});}})[_0xc583('0x22')](function(_0x178eef){return respondWithRpcPromise('AbandonInteraction',_0xc583('0xd2'),_0x42f4ec['body'],client9004);})[_0xc583('0x22')](respondWithResult(_0x314072,null))[_0xc583('0x2d')](handleError(_0x314072,null));};exports[_0xc583('0xd8')]=function(_0xe45a4a,_0x91cb84,_0x46aa62){_0xe45a4a[_0xc583('0x83')][_0xc583('0x3b')]=_0xe45a4a[_0xc583('0xd9')][_0xc583('0xda')];_0xe45a4a[_0xc583('0x83')]['basename']=_0xe45a4a[_0xc583('0xd9')][_0xc583('0xdb')];_0xe45a4a[_0xc583('0x83')][_0xc583('0x82')]=_0xe45a4a[_0xc583('0xd9')][_0xc583('0xdc')];return db['Attachment'][_0xc583('0xc4')](_0xe45a4a[_0xc583('0x83')])[_0xc583('0x22')](respondWithResult(_0x91cb84,0xc9))[_0xc583('0x2d')](handleError(_0x91cb84,null));};exports[_0xc583('0xdd')]=function(_0x1f61e2,_0x291f47,_0x405709){return db[_0xc583('0x42')][_0xc583('0xde')]({'where':{'id':_0x1f61e2[_0xc583('0xc2')]['id']},'raw':!![]})[_0xc583('0x22')](handleEntityNotFound(_0x291f47,null))[_0xc583('0x22')](function(_0x4824c5){if(_0x4824c5){if(_0x4824c5[_0xc583('0xd6')]){return _0x291f47[_0xc583('0x30')](0x193)[_0xc583('0x31')]({'status':0x193,'message':_0xc583('0xdf')});}return db[_0xc583('0xe0')][_0xc583('0xde')]({'where':{'id':_0x1f61e2['query'][_0xc583('0xe1')]},'raw':!![]})['then'](handleEntityNotFound(_0x291f47,null));}})['then'](function(_0x52482e){if(_0x52482e){return _0x291f47[_0xc583('0xe2')](path[_0xc583('0xe3')](config[_0xc583('0xe4')],_0xc583('0xe5'),_0x52482e[_0xc583('0xe6')]));}})['catch'](handleError(_0x291f47,null));};exports['close']=function(_0x50f9d6,_0x1aa8a2){var _0x18a2cd=null;var _0x2785c5=null;var _0x774d90=null;var _0x486cd1=null;if(_0x50f9d6[_0xc583('0x83')]['id']){delete _0x50f9d6['body']['id'];}if(_0x50f9d6[_0xc583('0x83')]['mailTranscript']){_0x486cd1=path[_0xc583('0xe3')](config[_0xc583('0xe4')],_0xc583('0xe7'),util[_0xc583('0xe8')](_0xc583('0xe9'),Date[_0xc583('0xea')]()));_0x50f9d6[_0xc583('0x83')][_0xc583('0xeb')]=_0x486cd1;}return db[_0xc583('0x42')][_0xc583('0x6e')]({'where':{'id':_0x50f9d6[_0xc583('0xc2')]['id']},'include':[{'model':db[_0xc583('0xce')],'as':_0xc583('0xec'),'include':[{'model':db[_0xc583('0x7f')],'as':_0xc583('0x7f')}]}]})[_0xc583('0x22')](handleEntityNotFound(_0x1aa8a2,null))[_0xc583('0x22')](saveUpdates(_0x50f9d6[_0xc583('0x83')],null))[_0xc583('0x22')](function(_0x564fc0){if(_0x564fc0){_0x18a2cd=_0x564fc0;return db['ChatWebsite'][_0xc583('0x6e')]({'where':{'id':_0x18a2cd[_0xc583('0x86')]}});}})[_0xc583('0x22')](function(_0x23759e){if(_0x23759e){_0x774d90=_0x23759e;return db[_0xc583('0xed')]['find']({'where':{'id':_0x18a2cd[_0xc583('0x76')]}});}})['then'](function(_0x8d44b7){if(_0x8d44b7){_0x2785c5=_0x8d44b7;if(_0x486cd1){var _0x1b4ac0=null;for(var _0x107927=0x1;_0x107927<_0x18a2cd[_0xc583('0xec')][_0xc583('0x4c')];++_0x107927){_0x1b4ac0=_0x18a2cd[_0xc583('0xec')][_0x107927];var _0x2b720c=_0x1b4ac0[_0xc583('0x81')]?util[_0xc583('0xe8')]('%s%d',_0x774d90[_0xc583('0xee')],_0x1b4ac0[_0xc583('0x81')]):'System';var _0x36975e=_0x50f9d6[_0xc583('0x83')][_0xc583('0xef')]||util['format'](_0xc583('0xf0'),_0xc583('0xf1'),_0x1b4ac0[_0xc583('0x76')]);switch(_0x774d90[_0xc583('0xf2')]){case _0xc583('0xf3'):_0x2b720c=_0x1b4ac0[_0xc583('0x81')]?util[_0xc583('0xe8')]('%s%d',_0x774d90[_0xc583('0xee')],_0x1b4ac0[_0xc583('0x81')]):_0xc583('0xf4');break;case'agent_alias':_0x2b720c=_0x1b4ac0['UserId']?_0x1b4ac0['User'][_0xc583('0xf5')]||_0x1b4ac0[_0xc583('0x7f')]['fullname']:_0xc583('0xf4');break;case _0xc583('0xf6'):_0x2b720c=_0x1b4ac0[_0xc583('0x81')]?_0x1b4ac0[_0xc583('0x7f')][_0xc583('0x3e')]:_0xc583('0xf4');break;default:_0x2b720c=_0x1b4ac0[_0xc583('0x81')]?util[_0xc583('0xe8')](_0xc583('0xf0'),_0x774d90[_0xc583('0xee')],_0x1b4ac0['UserId']):_0xc583('0xf4');}var _0x5b8197=util[_0xc583('0xe8')](_0xc583('0xf7'),moment(_0x1b4ac0[_0xc583('0x89')])[_0xc583('0xe8')](_0xc583('0xf8')),_0x1b4ac0[_0xc583('0xf9')]==='in'?_0x36975e:_0x2b720c,_0x1b4ac0[_0xc583('0x83')]);if(!_0x1b4ac0[_0xc583('0xfa')]){fs[_0xc583('0xfb')](_0x486cd1,_0x5b8197);}}return db[_0xc583('0xfc')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc583('0xfd'),'raw':!![]}]});}}})['then'](function(_0x45270a){if(_0x45270a&&_0x45270a[_0xc583('0xfd')]&&_0x50f9d6[_0xc583('0x83')]){var _0x44266a={'tls':{'rejectUnauthorized':![]}};if(_0x45270a['Smtp'][_0xc583('0xfe')]){_0x44266a[_0xc583('0xfe')]=_0x45270a['Smtp']['service'];}else{_0x44266a[_0xc583('0xff')]=_0x45270a[_0xc583('0xfd')][_0xc583('0xff')];_0x44266a['port']=_0x45270a['Smtp'][_0xc583('0x100')];_0x44266a['secure']=_0x45270a[_0xc583('0xfd')][_0xc583('0x101')];}if(_0x45270a[_0xc583('0xfd')]['authentication']){_0x44266a[_0xc583('0x102')]={'user':_0x45270a['Smtp']['user'],'pass':_0x45270a[_0xc583('0xfd')][_0xc583('0x103')]};}return respondWithRpcPromise(_0xc583('0x104'),_0xc583('0x105'),{'account':_0x44266a,'message':{'from':util[_0xc583('0xe8')](_0xc583('0x106'),_0x45270a[_0xc583('0x3b')],_0x45270a[_0xc583('0x107')]||_0x45270a[_0xc583('0xfd')][_0xc583('0xa3')]),'to':_0x50f9d6[_0xc583('0x83')][_0xc583('0x108')],'subject':_0xc583('0x109'),'text':util[_0xc583('0xe8')](_0xc583('0x10a'),_0x50f9d6['body'][_0xc583('0x108')]),'attachments':[{'path':_0x486cd1}]}})[_0xc583('0x22')](function(){return _0x18a2cd;})[_0xc583('0x2d')](function(_0x267c96){console[_0xc583('0x29')](_0x267c96);});}else{return _0x18a2cd;}})[_0xc583('0x22')](respondWithStatusCode(_0x1aa8a2,0xc8))[_0xc583('0x2d')](handleError(_0x1aa8a2,null));};exports[_0xc583('0x10b')]=function(_0xa21d7a,_0x3308a8,_0x270a3e){return db[_0xc583('0xce')][_0xc583('0x6e')]({'where':{'id':_0xa21d7a[_0xc583('0xc2')]['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x3308a8,null))['then'](function(_0x31784f){if(_0x31784f){return _0x31784f[_0xc583('0x10b')](_0xa21d7a[_0xc583('0x83')][_0xc583('0x10c')],_['omit'](_0xa21d7a[_0xc583('0x83')],[_0xc583('0x10c'),'id'])||{});}})[_0xc583('0x22')](respondWithResult(_0x3308a8,null))['catch'](handleError(_0x3308a8,null));};exports['getMessages']=function(_0x4b37b8,_0x3f30fd,_0x15ea31){var _0x2772c7={'raw':![],'where':{}};var _0x52bed1={};var _0x1d9782={'count':0x0,'rows':[]};return db[_0xc583('0x42')][_0xc583('0xde')]({'where':{'id':_0x4b37b8['params']['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x3f30fd,null))['then'](function(_0x50ff62){if(_0x50ff62){_0x52bed1[_0xc583('0x4d')]=_[_0xc583('0x47')](db[_0xc583('0xce')][_0xc583('0x43')]);_0x52bed1[_0xc583('0x46')]=_['keys'](_0x4b37b8['query']);_0x52bed1[_0xc583('0x48')]=_[_0xc583('0x49')](_0x52bed1[_0xc583('0x4d')],_0x52bed1['query']);_0x2772c7[_0xc583('0x4a')]=_[_0xc583('0x49')](_0x52bed1[_0xc583('0x4d')],qs['fields'](_0x4b37b8[_0xc583('0x46')][_0xc583('0x4b')]));_0x2772c7[_0xc583('0x4a')]=_0x2772c7[_0xc583('0x4a')][_0xc583('0x4c')]?_0x2772c7[_0xc583('0x4a')]:_0x52bed1['model'];if(!_0x4b37b8[_0xc583('0x46')]['hasOwnProperty'](_0xc583('0x4f'))){_0x2772c7['limit']=qs[_0xc583('0x50')](_0x4b37b8[_0xc583('0x46')][_0xc583('0x50')]);_0x2772c7[_0xc583('0x33')]=qs[_0xc583('0x33')](_0x4b37b8[_0xc583('0x46')][_0xc583('0x33')]);}_0x2772c7[_0xc583('0x51')]=qs[_0xc583('0x52')](_0x4b37b8[_0xc583('0x46')][_0xc583('0x52')]);_0x2772c7[_0xc583('0x53')]=qs[_0xc583('0x48')](_[_0xc583('0x54')](_0x4b37b8[_0xc583('0x46')],_0x52bed1[_0xc583('0x48')]));_0x2772c7[_0xc583('0x53')]['ChatInteractionId']=_0x50ff62['id'];if(_0x4b37b8[_0xc583('0x46')][_0xc583('0x93')]){_0x2772c7[_0xc583('0x53')]=_['merge'](_0x2772c7[_0xc583('0x53')],{'$or':_['map'](_0x2772c7[_0xc583('0x4a')],function(_0x2095f4){var _0x509ee5={};_0x509ee5[_0x2095f4]={'$like':'%'+_0x4b37b8[_0xc583('0x46')][_0xc583('0x93')]+'%'};return _0x509ee5;})});}if(_0x4b37b8[_0xc583('0x46')]['$gte']){var _0xcacf5e=_0x4b37b8[_0xc583('0x46')]['$gte']['split'](',');var _0x183571={};_0x183571[_0xcacf5e[0x0]]={'$gte':moment(_0xcacf5e[0x1])[_0xc583('0xe8')](_0xc583('0x10d'))};_0x2772c7[_0xc583('0x53')]=_['merge'](_0x2772c7['where'],_0x183571);}_0x2772c7=_['merge']({},_0x2772c7,_0x4b37b8[_0xc583('0x10e')]);return db[_0xc583('0xce')][_0xc583('0x32')]({'where':_0x2772c7[_0xc583('0x53')]})[_0xc583('0x22')](function(_0x9dad79){_0x1d9782[_0xc583('0x32')]=_0x9dad79;if(_0x4b37b8[_0xc583('0x46')][_0xc583('0xc3')]){_0x2772c7[_0xc583('0x10f')]=[{'all':!![]}];}return db[_0xc583('0xce')][_0xc583('0x110')](_0x2772c7);})[_0xc583('0x22')](function(_0x26cdcd){_0x1d9782[_0xc583('0xc0')]=_0x26cdcd;return _0x1d9782;});}})[_0xc583('0x22')](respondWithFilteredResult(_0x3f30fd,_0x2772c7))[_0xc583('0x2d')](handleError(_0x3f30fd,null));};exports[_0xc583('0x111')]=function(_0x272a27,_0x4d6f30,_0x132293){var _0x2f31ae={'where':{}},_0x5388f8={},_0x3b7fa2={'count':0x0,'rows':[]};return db[_0xc583('0x42')]['findOne']({'where':{'id':_0x272a27[_0xc583('0xc2')]['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x4d6f30,null))[_0xc583('0x22')](function(_0x41764a){if(_0x41764a){_0x5388f8[_0xc583('0x4d')]=_[_0xc583('0x47')](db['ChatMessage'][_0xc583('0x43')]);_0x5388f8['query']=_[_0xc583('0x47')](_0x272a27[_0xc583('0x46')]);_0x5388f8[_0xc583('0x48')]=_[_0xc583('0x49')](_0x5388f8['model'],_0x5388f8['query']);_0x2f31ae[_0xc583('0x4a')]=_[_0xc583('0x49')](_0x5388f8['model'],qs[_0xc583('0x4b')](_0x272a27[_0xc583('0x46')][_0xc583('0x4b')]));_0x2f31ae['attributes']=_0x2f31ae[_0xc583('0x4a')][_0xc583('0x4c')]?_0x2f31ae[_0xc583('0x4a')]:_0x5388f8[_0xc583('0x4d')];if(!_0x272a27[_0xc583('0x46')][_0xc583('0x4e')](_0xc583('0x4f'))){_0x2f31ae['limit']=qs['limit'](_0x272a27[_0xc583('0x46')]['limit']);_0x2f31ae['offset']=qs[_0xc583('0x33')](_0x272a27[_0xc583('0x46')][_0xc583('0x33')]);}_0x2f31ae[_0xc583('0x51')]=qs[_0xc583('0x52')](_0x272a27[_0xc583('0x46')][_0xc583('0x52')]);_0x2f31ae[_0xc583('0x53')]=qs[_0xc583('0x48')](_[_0xc583('0x54')](_0x272a27['query'],_0x5388f8[_0xc583('0x48')]));_0x2f31ae[_0xc583('0x53')][_0xc583('0xbd')]=_0x41764a['id'];if(_0x272a27['query']['filter']){_0x2f31ae['where']=_[_0xc583('0xa7')](_0x2f31ae[_0xc583('0x53')],{'$or':_[_0xc583('0x3d')](_0x2f31ae[_0xc583('0x4a')],function(_0x421975){var _0x45f26d={};_0x45f26d[_0x421975]={'$like':'%'+_0x272a27[_0xc583('0x46')][_0xc583('0x93')]+'%'};return _0x45f26d;})});}_0x2f31ae[_0xc583('0x53')][_0xc583('0xfa')]=![];if(_0x272a27[_0xc583('0x46')]['id']){_0x2f31ae['where']['id']={'$gt':_0x272a27[_0xc583('0x46')]['id']};}_0x2f31ae=_[_0xc583('0xa7')]({},_0x2f31ae,_0x272a27[_0xc583('0x10e')]);return db[_0xc583('0xce')][_0xc583('0x32')]({'where':_0x2f31ae[_0xc583('0x53')]})[_0xc583('0x22')](function(_0x8c2492){_0x3b7fa2['count']=_0x8c2492;_0x2f31ae[_0xc583('0x10f')]=[];if(_0x272a27[_0xc583('0x46')]['includeAgent']){_0x2f31ae[_0xc583('0x10f')][_0xc583('0xbe')]({'model':db[_0xc583('0x7f')],'as':_0xc583('0x7f'),'attributes':['id',_0xc583('0x3e'),_0xc583('0xf5')]});}if(_0x272a27[_0xc583('0x46')][_0xc583('0xc3')]){_0x2f31ae[_0xc583('0x10f')]=[{'all':!![]}];}return db[_0xc583('0xce')][_0xc583('0x110')](_0x2f31ae);})[_0xc583('0x22')](function(_0x3f169f){_0x3b7fa2[_0xc583('0xc0')]=_0x3f169f;return _0x3b7fa2;});}})[_0xc583('0x22')](respondWithFilteredResult(_0x4d6f30,_0x2f31ae))[_0xc583('0x2d')](handleError(_0x4d6f30,null));};exports[_0xc583('0x112')]=function(_0x46e785,_0x1175a2,_0x585e36){return db['ChatInteraction'][_0xc583('0x6e')]({'where':{'id':_0x46e785['params']['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x1175a2,null))[_0xc583('0x22')](function(_0x442dc0){if(_0x442dc0){return _0x442dc0['setTags'](_0x46e785[_0xc583('0x83')][_0xc583('0x10c')],_[_0xc583('0x113')](_0x46e785[_0xc583('0x83')],[_0xc583('0x10c'),'id'])||{})['spread'](function(){return db['Tag'][_0xc583('0x110')]({'attributes':['id',_0xc583('0x3b'),_0xc583('0x56')],'where':{'id':_0x46e785[_0xc583('0x83')][_0xc583('0x10c')]}});})[_0xc583('0x22')](function(_0x334244){socket[_0xc583('0x114')]('chatInteractionTags:save',{'id':Number(_0x46e785['params']['id']),'tags':_0x334244||[]});return{'id':Number(_0x46e785[_0xc583('0xc2')]['id']),'tags':_0x334244||[]};});}})[_0xc583('0x22')](respondWithResult(_0x1175a2,null))[_0xc583('0x2d')](handleError(_0x1175a2,null));};exports[_0xc583('0x115')]=function(_0x34403a,_0x54867b,_0xa0ef23){return db['ChatInteraction'][_0xc583('0x6e')]({'where':{'id':_0x34403a[_0xc583('0xc2')]['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x54867b,null))['then'](function(_0x383d35){if(_0x383d35){return _0x383d35[_0xc583('0x115')](_0x34403a[_0xc583('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x54867b,null))[_0xc583('0x2d')](handleError(_0x54867b,null));};exports[_0xc583('0xe2')]=function(_0x5b466a,_0x47b0a3){var _0x1a6e7f=moment()['unix']()[_0xc583('0xba')]();var _0x583837=path[_0xc583('0xe3')](config[_0xc583('0xe4')],_0xc583('0x116'),_0xc583('0x117'),'tmp');var _0x3da50a=path['join'](config[_0xc583('0xe4')],_0xc583('0x116'),_0xc583('0x117'),_0xc583('0x118'));var _0x1990b0=path[_0xc583('0xe3')](_0x583837,_0x1a6e7f);var _0x558aea=util[_0xc583('0xe8')]('transcript-%d-%s.zip',_0x5b466a[_0xc583('0xc2')]['id'],_0x1a6e7f);var _0x3244be=path[_0xc583('0xe3')](_0x583837,_0x558aea);var _0x4a8088=[];_0x4a8088[_0xc583('0xbe')]({'model':db[_0xc583('0x7f')],'as':_0xc583('0x7f'),'attributes':['id',_0xc583('0x3e')],'raw':!![]});_0x4a8088[_0xc583('0xbe')]({'model':db[_0xc583('0xed')],'as':_0xc583('0x71'),'attributes':['id',_0xc583('0x119'),_0xc583('0x11a')],'raw':!![]});if(_0x5b466a[_0xc583('0x46')]['attachments']){_0x4a8088['push']({'model':db[_0xc583('0xe0')],'as':'Attachment','raw':!![]});}var _0x12217c=[{'model':db[_0xc583('0xce')],'as':_0xc583('0xec'),'attributes':['id',_0xc583('0x83'),'createdAt',_0xc583('0xf9'),_0xc583('0xfa'),_0xc583('0x8f')],'include':_0x4a8088}];_0x12217c['push']({'model':db[_0xc583('0x11b')],'as':_0xc583('0x11c'),'attributes':['id',_0xc583('0x3b')]});_0x12217c[_0xc583('0xbe')]({'model':db[_0xc583('0x7f')],'as':'Owner','attributes':['id',_0xc583('0x3e')]});return db['ChatInteraction']['find']({'where':{'id':_0x5b466a[_0xc583('0xc2')]['id']},'include':_0x12217c})[_0xc583('0x22')](handleEntityNotFound(_0x47b0a3,null))[_0xc583('0x22')](function(_0x29e600){if(_0x29e600){var _0x221112=_0x29e600[_0xc583('0x11d')]({'plain':!![]});fs[_0xc583('0x11e')](_0x1990b0);var _0x3786fd={'format':'A4','border':'10px','header':{'height':_0xc583('0x11f'),'contents':{'first':_0xc583('0x120')}},'footer':{'height':_0xc583('0x121'),'contents':{'default':util['format'](_0xc583('0x122'),util[_0xc583('0xe8')](_0xc583('0x123'),'Chat',_0x221112['id']),moment()[_0xc583('0xe8')]('YYYY-MM-DD')[_0xc583('0xba')]())}}};var _0x29a8c3={'channel':_0xc583('0x124'),'account':_0x221112['Account'][_0xc583('0x3b')],'agent':_0x221112['Owner']?_0x221112[_0xc583('0x125')][_0xc583('0x3e')]:_0xc583('0x126'),'createdAt':moment(_0x221112['createdAt'])[_0xc583('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc583('0xba')](),'closedAt':_0x221112['closed']?moment(_0x221112[_0xc583('0x127')])[_0xc583('0xe8')](_0xc583('0x10d'))['toString']():'','disposition':_0x221112[_0xc583('0xd7')],'chatInfo':{'browser':_0x221112['browserName'],'os':_0x221112[_0xc583('0x128')],'referer':_0x221112[_0xc583('0x129')],'customerIp':_0x221112[_0xc583('0x12a')],'customerPort':_0x221112[_0xc583('0x12b')]?_0x221112[_0xc583('0x12b')]:'N.A.'},'messages':_(_0x221112['Messages'])['tail']()[_0xc583('0x93')]({'secret':![]})[_0xc583('0x3d')](function(_0x27271a){if(_0x27271a[_0xc583('0xe0')]){var _0x5805ca=path['join'](_0x3da50a,_0x27271a[_0xc583('0xe0')][_0xc583('0xe6')]);if(fs['existsSync'](_0x5805ca)){fs[_0xc583('0x12c')](_0x5805ca)[_0xc583('0x12d')](fs[_0xc583('0x12e')](path[_0xc583('0xe3')](_0x1990b0,_0x27271a[_0xc583('0xe0')][_0xc583('0xe6')])));}}return{'date':moment(_0x27271a[_0xc583('0x89')])[_0xc583('0xe8')](_0xc583('0x10d'))['toString'](),'sender':_0x27271a['direction']===_0xc583('0xcd')?_0x27271a[_0xc583('0x7f')]?_0x27271a[_0xc583('0x7f')]['fullname']:_0xc583('0xf4'):_0x27271a['Contact']['firstName']+(_0x27271a[_0xc583('0x71')][_0xc583('0x11a')]?'\x20'+_0x27271a[_0xc583('0x71')][_0xc583('0x11a')]:''),'body':_0x27271a[_0xc583('0xe0')]?_0x27271a[_0xc583('0xe0')][_0xc583('0xe6')]:_0x27271a[_0xc583('0x83')],'direction':_0x27271a[_0xc583('0xf9')]===_0xc583('0xcd')?'A':'C','secret':_0x27271a[_0xc583('0xfa')],'read':_0x27271a[_0xc583('0x8f')],'attachment':_0x27271a[_0xc583('0xe0')]};})[_0xc583('0x79')]()};return ejs[_0xc583('0x12f')](path[_0xc583('0xe3')](config['root'],_0xc583('0x116'),_0xc583('0x130'),_0xc583('0x131')),{'interaction':_0x29a8c3})['then'](function(_0x14caf3){return new BPromise(function(_0x32f385,_0x41045d){pdf[_0xc583('0xc4')](_0x14caf3,_0x3786fd)[_0xc583('0x132')](path['join'](_0x1990b0,'transcript-'+_0x221112['id']+'-'+_0x1a6e7f+_0xc583('0x133')),function(_0x335b28,_0x1bddee){if(_0x335b28)return _0x41045d(_0x335b28);_0x32f385(_0x1bddee);});});})[_0xc583('0x22')](function(){return new BPromise(function(_0x258b10,_0x3fc755){zipdir(_0x1990b0,{'saveTo':_0x3244be},function(_0x4a900c,_0x2ba67d){if(_0x4a900c)return _0x3fc755(_0x4a900c);return _0x258b10(_0x2ba67d);});})[_0xc583('0x22')](function(){return new BPromise(function(_0x291a9a,_0x685f68){rimraf(_0x1990b0,function(_0x38dc1c){if(_0x38dc1c)_0x685f68(_0x38dc1c);return _0x291a9a();});});})[_0xc583('0x22')](function(){return _0x47b0a3['download'](_0x3244be,_0x558aea,function(_0x197e0f){if(_0x197e0f){console['log']('err',_0x197e0f);}else{fs[_0xc583('0x134')](_0x3244be);}});});});}else{return _0x47b0a3[_0xc583('0x2e')](0xc8);}})['catch'](handleError(_0x47b0a3,null));}; \ No newline at end of file +var _0x583c=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','Sequelize','ValidationError','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','map','fullname','TagIds','Tags','split','ChatInteraction','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','value','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','type','body','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','show','params','includeAll','create','describe','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','attachmentDownload','findOne','Unauthorized','Attachment','attachId','download','join','root','server/files/attachments/','basename','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','agentAlias','customer','%s%d','Visitor','agentIdentifier','website_alias','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','getMyMessages','addTags','omit','emit','removeTags','server','files','attachments','firstName','lastName','ChatWebsite','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','\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','Owner','N.A.','closedAt','osName','referer','customerIp','customerPort','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','.pdf','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs'];(function(_0x3c7667,_0x53ed22){var _0x17f69c=function(_0x5d93b3){while(--_0x5d93b3){_0x3c7667['push'](_0x3c7667['shift']());}};_0x17f69c(++_0x53ed22);}(_0x583c,0x12b));var _0xc583=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x583c[_0x36c5b0];return _0xf19333;};'use strict';var pdf=require(_0xc583('0x0'));var emlformat=require(_0xc583('0x1'));var rimraf=require(_0xc583('0x2'));var zipdir=require(_0xc583('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc583('0x4'));var moment=require(_0xc583('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc583('0x6'));var path=require(_0xc583('0x7'));var sox=require('sox');var csv=require(_0xc583('0x8'));var ejs=require(_0xc583('0x9'));var fs=require('fs');var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var db=require('../../mysqldb')['db'];config[_0xc583('0x17')]=_[_0xc583('0x18')](config[_0xc583('0x17')],{'host':_0xc583('0x19'),'port':0x18eb});var socket=require(_0xc583('0x1a'))(new Redis(config[_0xc583('0x17')]));require(_0xc583('0x1b'))[_0xc583('0x1c')](socket);var jayson=require(_0xc583('0x1d'));var client=jayson['client'][_0xc583('0x1e')]({'port':0x232b});var client9004=jayson['client'][_0xc583('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x299fa1,_0x510090,_0x263552){if(_0x263552){var _0x311ad5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x311ad5['test'](_0x510090)){return _0x299fa1;}else{throw new db[(_0xc583('0x1f'))][(_0xc583('0x20'))]('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 _0x299fa1;}}function respondWithRpcPromise(_0x21cf22,_0x8a2d84,_0x12aac2,_0x36e0fd){return new BPromise(function(_0x5433ec,_0x3dd3cc){var _0x48a65a=_0x36e0fd||client;return _0x48a65a[_0xc583('0x21')](_0x21cf22,_0x12aac2)[_0xc583('0x22')](function(_0xfd9a60){logger[_0xc583('0x23')](_0xc583('0x24'),_0x8a2d84,_0xc583('0x25'));logger[_0xc583('0x26')](_0xc583('0x27'),_0x8a2d84,_0xc583('0x25'),JSON[_0xc583('0x28')](_0xfd9a60));if(_0xfd9a60[_0xc583('0x29')]){if(_0xfd9a60[_0xc583('0x29')][_0xc583('0x2a')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x8a2d84,_0xfd9a60[_0xc583('0x29')][_0xc583('0x2b')]);return _0x3dd3cc(_0xfd9a60[_0xc583('0x29')]['message']);}logger[_0xc583('0x29')](_0xc583('0x24'),_0x8a2d84,_0xfd9a60[_0xc583('0x29')][_0xc583('0x2b')]);return _0x5433ec(_0xfd9a60[_0xc583('0x29')]['message']);}else{logger['info'](_0xc583('0x24'),_0x8a2d84,'request\x20sent');_0x5433ec(_0xfd9a60[_0xc583('0x2c')][_0xc583('0x2b')]);}})[_0xc583('0x2d')](function(_0x1e7809){logger[_0xc583('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x8a2d84,_0x1e7809);_0x3dd3cc(_0x1e7809);});});}function respondWithStatusCode(_0x2dafb4,_0x44f76a){_0x44f76a=_0x44f76a||0xcc;return function(_0x4adde3){if(_0x4adde3){return _0x2dafb4[_0xc583('0x2e')](_0x44f76a);}return _0x2dafb4['status'](_0x44f76a)[_0xc583('0x2f')]();};}function respondWithResult(_0x8d4ecb,_0x1c80b1){_0x1c80b1=_0x1c80b1||0xc8;return function(_0x3ed083){if(_0x3ed083){return _0x8d4ecb[_0xc583('0x30')](_0x1c80b1)[_0xc583('0x31')](_0x3ed083);}};}function respondWithFilteredResult(_0x113b39,_0x4a87b5){return function(_0x529dbe){if(_0x529dbe){var _0x390bc3=_0x529dbe[_0xc583('0x32')],_0x23f3a4=_0x4a87b5['offset'],_0xcbf1f1=_0x4a87b5[_0xc583('0x33')]+_0x4a87b5['limit'],_0x1dd665;if(_0xcbf1f1>=_0x390bc3){_0xcbf1f1=_0x390bc3;_0x1dd665=0xc8;}else{_0x1dd665=0xce;}_0x113b39['status'](_0x1dd665);return _0x113b39[_0xc583('0x34')](_0xc583('0x35'),_0x23f3a4+'-'+_0xcbf1f1+'/'+_0x390bc3)[_0xc583('0x31')](_0x529dbe);}return null;};}function patchUpdates(_0x595ae1){return function(_0x430fe6){try{jsonpatch['apply'](_0x430fe6,_0x595ae1,!![]);}catch(_0x3e41c0){return BPromise[_0xc583('0x36')](_0x3e41c0);}return _0x430fe6[_0xc583('0x37')]();};}function saveUpdates(_0x48f00b,_0x18b097){return function(_0x55bdca){if(_0x55bdca){return _0x55bdca[_0xc583('0x38')](_0x48f00b)[_0xc583('0x22')](function(_0x473072){return _0x473072;});}return null;};}function removeEntity(_0x18a288,_0x3bd1fd){return function(_0x4d7add){if(_0x4d7add){return _0x4d7add[_0xc583('0x39')]()['then'](function(){_0x18a288[_0xc583('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e96fc,_0x3a562c){return function(_0x7d89d0){if(!_0x7d89d0){_0x2e96fc[_0xc583('0x2e')](0x194);}return _0x7d89d0;};}function handleError(_0xa44825,_0x41b466){_0x41b466=_0x41b466||0x1f4;return function(_0x54200c){logger['error'](_0x54200c[_0xc583('0x3a')]);if(_0x54200c[_0xc583('0x3b')]){delete _0x54200c['name'];}_0xa44825[_0xc583('0x30')](_0x41b466)[_0xc583('0x3c')](_0x54200c);};}function getInteractionUsers(_0x22de5a,_0xb9b427){return new BPromise(function(_0x37b8c7,_0x388a85){try{if(_0xb9b427[_0x22de5a['id']]){_0x22de5a['Users']=_[_0xc583('0x3d')](_0xb9b427[_0x22de5a['id']],function(_0x595351){return{'id':_0x595351['id'],'fullname':_0x595351[_0xc583('0x3e')]};});}}catch(_0x22cc57){_0x388a85(_0x22cc57);}_0x37b8c7(_0x22de5a);});}function getInteractionTags(_0x39bed4,_0x502b6d){return new BPromise(function(_0x51ef91,_0x518c90){try{if(_0x39bed4[_0xc583('0x3f')]){_0x39bed4[_0xc583('0x40')]=[];_0x39bed4[_0xc583('0x3f')][_0xc583('0x41')](',')['forEach'](function(_0x374196){_0x39bed4[_0xc583('0x40')]['push'](_0x502b6d[_0x374196]);});}delete _0x39bed4['TagIds'];}catch(_0x1ea5da){_0x518c90(_0x1ea5da);}_0x51ef91(_0x39bed4);});}function updateChatInteraction(_0x5ad3d8,_0x254592,_0x1ec6f9){return new BPromise(function(_0xe73752,_0x40b888){return getInteractionUsers(_0x5ad3d8,_0x1ec6f9)['then'](function(_0x44c22f){return getInteractionTags(_0x44c22f,_0x254592);})[_0xc583('0x22')](function(_0x39c5ab){_0xe73752(_0x39c5ab);})[_0xc583('0x2d')](function(_0x2c1c22){_0x40b888(_0x2c1c22);});});}exports['index']=function(_0x3ffeb7,_0x5f5a97){var _0x4b78df={},_0x2f97a4={},_0x21e231={'count':0x0,'rows':[]};var _0x5788c7=_['map'](db[_0xc583('0x42')][_0xc583('0x43')],function(_0x7d1b29){return{'name':_0x7d1b29[_0xc583('0x44')],'type':_0x7d1b29['type'][_0xc583('0x45')]};});_0x2f97a4['model']=_[_0xc583('0x3d')](_0x5788c7,'name');_0x2f97a4[_0xc583('0x46')]=_[_0xc583('0x47')](_0x3ffeb7[_0xc583('0x46')]);_0x2f97a4[_0xc583('0x48')]=_[_0xc583('0x49')](_0x2f97a4['model'],_0x2f97a4[_0xc583('0x46')]);_0x4b78df[_0xc583('0x4a')]=_[_0xc583('0x49')](_0x2f97a4['model'],qs['fields'](_0x3ffeb7['query'][_0xc583('0x4b')]));_0x4b78df['attributes']=_0x4b78df[_0xc583('0x4a')][_0xc583('0x4c')]?_0x4b78df[_0xc583('0x4a')]:_0x2f97a4[_0xc583('0x4d')];if(!_0x3ffeb7[_0xc583('0x46')][_0xc583('0x4e')](_0xc583('0x4f'))){_0x4b78df[_0xc583('0x50')]=qs[_0xc583('0x50')](_0x3ffeb7[_0xc583('0x46')][_0xc583('0x50')]);_0x4b78df['offset']=qs[_0xc583('0x33')](_0x3ffeb7[_0xc583('0x46')][_0xc583('0x33')]);}_0x4b78df[_0xc583('0x51')]=qs['sort'](_0x3ffeb7[_0xc583('0x46')][_0xc583('0x52')]);_0x4b78df[_0xc583('0x53')]=qs[_0xc583('0x48')](_[_0xc583('0x54')](_0x3ffeb7[_0xc583('0x46')],_0x2f97a4[_0xc583('0x48')]),_0x5788c7);var _0x12291c=[];var _0x32512b=squel['select']()[_0xc583('0x55')]('id')[_0xc583('0x55')](_0xc583('0x3b'))[_0xc583('0x55')](_0xc583('0x56'))[_0xc583('0x57')](_0xc583('0x58'));var _0x465c71=squel[_0xc583('0x59')]()[_0xc583('0x55')](_0xc583('0x5a'))[_0xc583('0x55')](_0xc583('0x5b'))['field'](_0xc583('0x5c'))[_0xc583('0x57')](_0xc583('0x5d'),'ui')[_0xc583('0x5e')](_0xc583('0x5f'),'u',_0xc583('0x60'));var _0x24351f=squel[_0xc583('0x59')]()[_0xc583('0x57')]('chat_interactions','i')[_0xc583('0x5e')](_0xc583('0x61'),'c',_0xc583('0x62'))['left_join']('users','o',_0xc583('0x63'))['left_join'](_0xc583('0x64'),'a',_0xc583('0x65'))['left_join']('chat_messages','me',_0xc583('0x66'))[_0xc583('0x5e')](_0xc583('0x67'),'it',_0xc583('0x68'))[_0xc583('0x5e')](_0xc583('0x58'),'t',_0xc583('0x69'));var _0x43b438=squel['expr']();var _0x1d41df=[];var _0x9bbf43=squel[_0xc583('0x6a')]();var _0x1c4921;if(_0x3ffeb7['query'][_0xc583('0x6b')]){_0x1c4921=as[_0xc583('0x6c')](_0x3ffeb7['query']['search']);var _0x12b114=_0x1c4921['sqlOperator'];for(var _0x30b1e0=0x0;_0x30b1e0<_0x1c4921[_0xc583('0x6d')][_0xc583('0x4c')];_0x30b1e0++){var _0x5ea011=_0x1c4921['conditions'][_0x30b1e0];var _0x1ea579='i';var _0x3a5033=_[_0xc583('0x6e')](_0x5788c7,[_0xc583('0x3b'),_0x5ea011['field']]);if(!_0x3a5033){switch(_0x5ea011[_0xc583('0x55')]){case _0xc583('0x6f'):if(_0x5ea011['value']==0x1){_0x24351f['having']('`'+_0x5ea011[_0xc583('0x55')]+'`\x20=\x200');}else{_0x24351f['having']('`'+_0x5ea011[_0xc583('0x55')]+_0xc583('0x70'));}break;case _0xc583('0x71'):if(_0x5ea011[_0xc583('0x72')]===_0xc583('0x73')){if(_0x5ea011['value']['split']('\x20')[_0xc583('0x4c')]>0x1){_0x43b438[_0x12b114](_0xc583('0x74'),qs['getFullTextValue'](_0x5ea011['value']),null);}else{var _0x1cfb34='%'+_0x5ea011['value']+'%';_0x43b438[_0x12b114](_0xc583('0x75'),_0x1cfb34,_0x1cfb34,_0x1cfb34);}}else{_0x3a5033=_[_0xc583('0x6e')](_0x5788c7,['name',_0xc583('0x76')]);_0x5ea011['field']=_0xc583('0x76');_0x54e331=as[_0xc583('0x77')](_0x1ea579,_0x3a5033['type'],_0x5ea011);_0x43b438[_0x12b114](_0x54e331[_0xc583('0x78')],_0x54e331[_0xc583('0x79')][_0xc583('0x7a')],_0x54e331[_0xc583('0x79')][_0xc583('0x2f')]);}break;case _0xc583('0x7b'):var _0x37613c=_0x5ea011[_0xc583('0x79')]['split'](',')['map'](function(_0x4d0f8b){return Number(_0x4d0f8b);});_0x37613c[_0xc583('0x7c')](function(_0x4d498b){_0x9bbf43['or'](_0xc583('0x7d'),'%,'+_0x4d498b+',%');});_0x1d41df=_[_0xc583('0x7e')](_0x1d41df,_0x37613c);break;case _0xc583('0x7f'):if(_0x5ea011[_0xc583('0x72')]===_0xc583('0x73')){_0x43b438[_0x12b114](_0xc583('0x80'),'%'+_0x5ea011[_0xc583('0x79')]+'%',null);}else{_0x3a5033=_[_0xc583('0x6e')](_0x5788c7,['name',_0xc583('0x81')]);_0x5ea011[_0xc583('0x55')]=_0xc583('0x81');_0x54e331=as[_0xc583('0x77')](_0x1ea579,_0x3a5033[_0xc583('0x82')],_0x5ea011);_0x43b438[_0x12b114](_0x54e331[_0xc583('0x78')],_0x54e331['value'][_0xc583('0x7a')],_0x54e331[_0xc583('0x79')][_0xc583('0x2f')]);}break;case _0xc583('0x83'):_0x54e331=as[_0xc583('0x77')]('me',null,_0x5ea011);_0x43b438[_0x12b114](_0x54e331[_0xc583('0x78')],_0x54e331['value'][_0xc583('0x7a')],_0x54e331[_0xc583('0x79')][_0xc583('0x2f')]);break;}}else{var _0x54e331=as[_0xc583('0x77')](_0x1ea579,_0x3a5033['type'],_0x5ea011);_0x43b438[_0x12b114](_0x54e331[_0xc583('0x78')],_0x54e331[_0xc583('0x79')][_0xc583('0x7a')],_0x54e331[_0xc583('0x79')][_0xc583('0x2f')]);}}}else{var _0x89f9af=_(_0x3ffeb7[_0xc583('0x46')])['keys']()['map'](function(_0x5e979d){return _['some'](_0x5788c7,[_0xc583('0x3b'),_0x5e979d])?_0x5e979d:undefined;})[_0xc583('0x84')]()[_0xc583('0x79')]();if(!_[_0xc583('0x85')](_0x89f9af)){_0x89f9af[_0xc583('0x7c')](function(_0xbb22fa){if(_0xbb22fa===_0xc583('0x86')){_0x24351f[_0xc583('0x53')](_0xc583('0x87'),[][_0xc583('0x88')](_0x3ffeb7['query'][_0xbb22fa]));}else if(_0xbb22fa===_0xc583('0x89')){var _0xc82dd5=JSON['parse'](_0x3ffeb7['query'][_0xbb22fa])['$gte'];var _0x118682=JSON[_0xc583('0x8a')](_0x3ffeb7[_0xc583('0x46')][_0xbb22fa])[_0xc583('0x8b')];_0x24351f[_0xc583('0x53')](_0xc583('0x8c'),_0xc82dd5,_0x118682);}else{if(_0x3ffeb7[_0xc583('0x46')][_0xbb22fa]===_0xc583('0x8d')){_0x24351f[_0xc583('0x53')]('i.'+_0xbb22fa+'\x20IS\x20NULL');}else{_0x24351f[_0xc583('0x53')]('i.'+_0xbb22fa+_0xc583('0x8e'),_0x3ffeb7['query'][_0xbb22fa]);}}});}if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x8f')]){if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x8f')]==0x1){_0x24351f[_0xc583('0x90')]('`unreadMessages`\x20=\x200');}else{_0x24351f[_0xc583('0x90')](_0xc583('0x91'));}}if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x92')]){_0x1d41df=_['isArray'](_0x3ffeb7['query']['tag'])?_0x3ffeb7[_0xc583('0x46')]['tag']:new Array(_0x3ffeb7['query']['tag']);_0x1d41df[_0xc583('0x7c')](function(_0x3e8319){_0x9bbf43['or'](_0xc583('0x7d'),'%,'+_0x3e8319+',%');});}if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x93')]){var _0x5150b4=_0x3ffeb7[_0xc583('0x46')][_0xc583('0x93')][_0xc583('0x94')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xc583('0x95'));if(qs[_0xc583('0x96')](_0x5150b4)){_0x43b438['or']('i.id\x20LIKE\x20?',_0x5150b4+'%');}else{_0x43b438['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc583('0x97')](_0x5150b4))['or'](_0xc583('0x98'),_0x5150b4+'%');}}}_0x24351f[_0xc583('0x53')](_0x43b438);_0x24351f[_0xc583('0x99')](_0xc583('0x9a'));var _0x10651c={'type':db[_0xc583('0x1f')][_0xc583('0x9b')]['SELECT'],'raw':!![]};var _0x288c4e=_0x24351f[_0xc583('0x9c')]();_0x288c4e[_0xc583('0x55')](_0xc583('0x9a'));_0x288c4e[_0xc583('0x55')](_0xc583('0x9d'),_0xc583('0x6f'));if(_0x4b78df[_0xc583('0x51')]){_0x4b78df[_0xc583('0x51')][_0xc583('0x7c')](function(_0x562bb6){_0x24351f[_0xc583('0x51')]('i.'+_0x562bb6[0x0],_0x562bb6[0x1]===_0xc583('0x9e')?![]:!![]);});}if(!_[_0xc583('0x85')](_0x1d41df)){_0x24351f[_0xc583('0x90')](_0x9bbf43);_0x288c4e[_0xc583('0x53')](_0xc583('0x9f'),_0x1d41df);}BPromise[_0xc583('0xa0')]()[_0xc583('0x22')](function(){if(!_0x1c4921){if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x86')]||_0x3ffeb7[_0xc583('0x46')][_0xc583('0xa1')])return;_0x288c4e[_0xc583('0x53')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x24351f['where'](_0xc583('0xa2'));return;}return _0x3ffeb7[_0xc583('0xa3')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x194989){if(_[_0xc583('0x85')](_0x194989)){_0x288c4e['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x24351f[_0xc583('0x53')](_0xc583('0xa4'));}else{_0x288c4e[_0xc583('0x53')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x194989,'id'));_0x24351f[_0xc583('0x53')](_0xc583('0x87'),_[_0xc583('0x3d')](_0x194989,'id'));}});})['then'](function(){db[_0xc583('0xa5')][_0xc583('0x46')](_0x288c4e['toString'](),_0x10651c)[_0xc583('0x22')](function(_0x1649ad){_0x21e231[_0xc583('0x32')]=_0x1649ad[_0xc583('0x4c')];if(_0x21e231[_0xc583('0x32')]===0x0)return[];return db[_0xc583('0xa5')][_0xc583('0x46')](_0x32512b['toString'](),_0x10651c)['then'](function(_0x5dd5c7){_0x12291c=_[_0xc583('0xa6')](_0x5dd5c7,'id');_0x10651c=_[_0xc583('0xa7')](_0x10651c,{'model':db[_0xc583('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ffeb7[_0xc583('0x46')][_0xc583('0x4b')]){_0x4b78df[_0xc583('0x4a')][_0xc583('0x7c')](function(_0x6a7877){_0x24351f['field']('i.'+_0x6a7877);});}else{_0x24351f[_0xc583('0x55')](_0xc583('0x9d'),_0xc583('0x6f'));_0x24351f[_0xc583('0x55')]('a.key','Account.key');_0x24351f['field'](_0xc583('0xa8'),_0xc583('0xa9'));_0x24351f[_0xc583('0x55')](_0xc583('0xaa'));_0x24351f[_0xc583('0x55')](_0xc583('0xab'),'Contact.firstName');_0x24351f['field'](_0xc583('0xac'),_0xc583('0xad'));_0x24351f['field'](_0xc583('0xae'),_0xc583('0xaf'));_0x24351f[_0xc583('0x55')](_0xc583('0xb0'),_0xc583('0xb1'));_0x24351f[_0xc583('0x55')]('c.mobile',_0xc583('0xb2'));_0x24351f[_0xc583('0x55')](_0xc583('0xb3'),_0xc583('0xb4'));_0x24351f[_0xc583('0x55')](_0xc583('0xb5'),_0xc583('0xb6'));_0x24351f[_0xc583('0x55')](_0xc583('0xb7'),_0xc583('0xb8'));_0x24351f['field'](_0xc583('0xb9'),_0xc583('0x3f'));}if(_0x4b78df[_0xc583('0x50')])_0x24351f['limit'](_0x4b78df[_0xc583('0x50')]);if(_0x4b78df['offset'])_0x24351f[_0xc583('0x33')](_0x4b78df[_0xc583('0x33')]);return db[_0xc583('0xa5')][_0xc583('0x46')](_0x24351f[_0xc583('0xba')](),_0x10651c);})[_0xc583('0x22')](function(_0x15e2b6){_0x465c71['where'](_0xc583('0xbb'),_['map'](_0x15e2b6,'id'));return db[_0xc583('0xa5')]['query'](_0x465c71[_0xc583('0xba')](),_0x10651c)[_0xc583('0x22')](function(_0x1d17c2){var _0x25d16e=_[_0xc583('0xbc')](_0x1d17c2,_0xc583('0xbd'));var _0x16273a=[];_0x15e2b6[_0xc583('0x7c')](function(_0x53f66a){_0x16273a[_0xc583('0xbe')](updateChatInteraction(_0x53f66a,_0x12291c,_0x25d16e));});return BPromise[_0xc583('0xbf')](_0x16273a);});});})[_0xc583('0x22')](function(_0x3ae684){_0x21e231[_0xc583('0xc0')]=_0x3ae684;return _0x21e231;})['then'](respondWithFilteredResult(_0x5f5a97,_0x4b78df));})[_0xc583('0x2d')](handleError(_0x5f5a97,null));};exports[_0xc583('0xc1')]=function(_0x1b246e,_0x5adde2){var _0x4d892c={'raw':![],'where':{'id':_0x1b246e[_0xc583('0xc2')]['id']}},_0xbbdcc4={};_0xbbdcc4[_0xc583('0x4d')]=_[_0xc583('0x47')](db[_0xc583('0x42')][_0xc583('0x43')]);_0xbbdcc4['query']=_[_0xc583('0x47')](_0x1b246e[_0xc583('0x46')]);_0xbbdcc4[_0xc583('0x48')]=_[_0xc583('0x49')](_0xbbdcc4[_0xc583('0x4d')],_0xbbdcc4['query']);_0x4d892c[_0xc583('0x4a')]=_['intersection'](_0xbbdcc4[_0xc583('0x4d')],qs['fields'](_0x1b246e[_0xc583('0x46')][_0xc583('0x4b')]));_0x4d892c['attributes']=_0x4d892c['attributes'][_0xc583('0x4c')]?_0x4d892c[_0xc583('0x4a')]:_0xbbdcc4[_0xc583('0x4d')];if(_0x1b246e[_0xc583('0x46')][_0xc583('0xc3')]){_0x4d892c['include']=[{'all':!![]}];}_0x4d892c=_[_0xc583('0xa7')]({},_0x4d892c,_0x1b246e['options']);return db[_0xc583('0x42')][_0xc583('0x6e')](_0x4d892c)[_0xc583('0x22')](handleEntityNotFound(_0x5adde2,null))[_0xc583('0x22')](respondWithResult(_0x5adde2,null))['catch'](handleError(_0x5adde2,null));};exports['create']=function(_0x54f43b,_0x1cbdea){return db[_0xc583('0x42')][_0xc583('0xc4')](_0x54f43b['body'],{})[_0xc583('0x22')](respondWithResult(_0x1cbdea,0xc9))[_0xc583('0x2d')](handleError(_0x1cbdea,null));};exports['update']=function(_0x392a65,_0x584454){if(_0x392a65[_0xc583('0x83')]['id']){delete _0x392a65[_0xc583('0x83')]['id'];}return db[_0xc583('0x42')][_0xc583('0x6e')]({'where':{'id':_0x392a65['params']['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x584454,null))[_0xc583('0x22')](saveUpdates(_0x392a65[_0xc583('0x83')],null))['then'](respondWithResult(_0x584454,null))['catch'](handleError(_0x584454,null));};exports['destroy']=function(_0xa87e9d,_0x3eac6f){return db['ChatInteraction'][_0xc583('0x6e')]({'where':{'id':_0xa87e9d[_0xc583('0xc2')]['id']}})['then'](handleEntityNotFound(_0x3eac6f,null))['then'](removeEntity(_0x3eac6f,null))[_0xc583('0x2d')](handleError(_0x3eac6f,null));};exports['describe']=function(_0x790cd1,_0x3e1c5e){return db[_0xc583('0x42')][_0xc583('0xc5')]()[_0xc583('0x22')](respondWithResult(_0x3e1c5e,null))[_0xc583('0x2d')](handleError(_0x3e1c5e,null));};exports['createVidaooSession']=function(_0x3bcbce,_0x1628f4){var _0x45a609=_0x3bcbce[_0xc583('0xc2')]['id'];var _0x3fa08e;var _0x2a3ef9;var _0x4d24e7;return db[_0xc583('0x42')]['findOne']({'where':{'id':_0x45a609}})[_0xc583('0x22')](function(_0x146b9c){_0x3fa08e=_0x146b9c;return db['ChatWebsite']['findOne']({'where':{'id':_0x146b9c[_0xc583('0x86')]},'attributes':['id','vidaooApiKey','vidaooEscalation'],'raw':!![]});})[_0xc583('0x22')](function(_0x5490f5){if(_0x5490f5&&_0x5490f5[_0xc583('0xc6')]&&_0x5490f5[_0xc583('0xc7')]){_0x2a3ef9=_0x5490f5;var _0x18d8b5={'rejectUnauthorized':![],'method':_0xc583('0xc8'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x5490f5[_0xc583('0xc6')]},'body':{'name':_0xc583('0xc9')+_0x45a609},'redirect':_0xc583('0xca'),'json':!![]};return rp(_0x18d8b5);}else{throw new db[(_0xc583('0x1f'))][(_0xc583('0x20'))](_0xc583('0xcb'));}})[_0xc583('0x22')](function(_0x63eee8){_0x4d24e7=_0x63eee8;if(_0x4d24e7['id']){var _0x2d0297={'body':_0x4d24e7[_0xc583('0xcc')],'ChatWebsiteId':_0x2a3ef9['id'],'ChatInteractionId':_0x3fa08e['id'],'direction':_0xc583('0xcd'),'UserId':_0x3bcbce[_0xc583('0xa3')]['id']};return db[_0xc583('0xce')]['create'](_0x2d0297,{});}else{throw new db[(_0xc583('0x1f'))][(_0xc583('0x20'))](_0xc583('0xcf'));}})[_0xc583('0x22')](function(){return _0x3fa08e[_0xc583('0xd0')]({'vidaooSessionId':_0x4d24e7['id']});})[_0xc583('0x22')](respondWithResult(_0x1628f4,null))[_0xc583('0x2d')](handleError(_0x1628f4,null));};exports[_0xc583('0xd1')]=function(_0x5f5b7a,_0x2324f8){if(_0x5f5b7a[_0xc583('0x83')]['id']){delete _0x5f5b7a['body']['id'];}return db['ChatInteraction'][_0xc583('0x6e')]({'where':{'id':_0x5f5b7a[_0xc583('0xc2')]['id']}})['then'](handleEntityNotFound(_0x2324f8,null))[_0xc583('0x22')](saveUpdates(_0x5f5b7a['body'],null))[_0xc583('0x22')](respondWithResult(_0x2324f8,null))[_0xc583('0x2d')](handleError(_0x2324f8,null));};exports[_0xc583('0xd2')]=function(_0x42f4ec,_0x314072,_0x112652){if(_0x42f4ec[_0xc583('0x83')]['id']){delete _0x42f4ec['body']['id'];}return db['ChatInteraction'][_0xc583('0x6e')]({'where':{'id':_0x42f4ec['params']['id']}})[_0xc583('0x22')](function(_0x5dfbd5){if(!_0x5dfbd5){logger[_0xc583('0x29')](_0xc583('0xd3'),'abandon',0x194,_0xc583('0xd4'));_0x314072[_0xc583('0x2e')](0x194);}else{if(_0x5dfbd5[_0xc583('0x81')]){throw new db[(_0xc583('0x1f'))]['ValidationError'](_0xc583('0xd5'));}}return _0x5dfbd5;})[_0xc583('0x22')](function(_0x38a4d0){if(_0x38a4d0){return _0x38a4d0['update']({'closed':_0x42f4ec[_0xc583('0x83')][_0xc583('0xd6')],'disposition':_0x42f4ec[_0xc583('0x83')][_0xc583('0xd7')]})[_0xc583('0x22')](function(_0x5db6a2){return _0x5db6a2;});}})[_0xc583('0x22')](function(_0x178eef){return respondWithRpcPromise('AbandonInteraction',_0xc583('0xd2'),_0x42f4ec['body'],client9004);})[_0xc583('0x22')](respondWithResult(_0x314072,null))[_0xc583('0x2d')](handleError(_0x314072,null));};exports[_0xc583('0xd8')]=function(_0xe45a4a,_0x91cb84,_0x46aa62){_0xe45a4a[_0xc583('0x83')][_0xc583('0x3b')]=_0xe45a4a[_0xc583('0xd9')][_0xc583('0xda')];_0xe45a4a[_0xc583('0x83')]['basename']=_0xe45a4a[_0xc583('0xd9')][_0xc583('0xdb')];_0xe45a4a[_0xc583('0x83')][_0xc583('0x82')]=_0xe45a4a[_0xc583('0xd9')][_0xc583('0xdc')];return db['Attachment'][_0xc583('0xc4')](_0xe45a4a[_0xc583('0x83')])[_0xc583('0x22')](respondWithResult(_0x91cb84,0xc9))[_0xc583('0x2d')](handleError(_0x91cb84,null));};exports[_0xc583('0xdd')]=function(_0x1f61e2,_0x291f47,_0x405709){return db[_0xc583('0x42')][_0xc583('0xde')]({'where':{'id':_0x1f61e2[_0xc583('0xc2')]['id']},'raw':!![]})[_0xc583('0x22')](handleEntityNotFound(_0x291f47,null))[_0xc583('0x22')](function(_0x4824c5){if(_0x4824c5){if(_0x4824c5[_0xc583('0xd6')]){return _0x291f47[_0xc583('0x30')](0x193)[_0xc583('0x31')]({'status':0x193,'message':_0xc583('0xdf')});}return db[_0xc583('0xe0')][_0xc583('0xde')]({'where':{'id':_0x1f61e2['query'][_0xc583('0xe1')]},'raw':!![]})['then'](handleEntityNotFound(_0x291f47,null));}})['then'](function(_0x52482e){if(_0x52482e){return _0x291f47[_0xc583('0xe2')](path[_0xc583('0xe3')](config[_0xc583('0xe4')],_0xc583('0xe5'),_0x52482e[_0xc583('0xe6')]));}})['catch'](handleError(_0x291f47,null));};exports['close']=function(_0x50f9d6,_0x1aa8a2){var _0x18a2cd=null;var _0x2785c5=null;var _0x774d90=null;var _0x486cd1=null;if(_0x50f9d6[_0xc583('0x83')]['id']){delete _0x50f9d6['body']['id'];}if(_0x50f9d6[_0xc583('0x83')]['mailTranscript']){_0x486cd1=path[_0xc583('0xe3')](config[_0xc583('0xe4')],_0xc583('0xe7'),util[_0xc583('0xe8')](_0xc583('0xe9'),Date[_0xc583('0xea')]()));_0x50f9d6[_0xc583('0x83')][_0xc583('0xeb')]=_0x486cd1;}return db[_0xc583('0x42')][_0xc583('0x6e')]({'where':{'id':_0x50f9d6[_0xc583('0xc2')]['id']},'include':[{'model':db[_0xc583('0xce')],'as':_0xc583('0xec'),'include':[{'model':db[_0xc583('0x7f')],'as':_0xc583('0x7f')}]}]})[_0xc583('0x22')](handleEntityNotFound(_0x1aa8a2,null))[_0xc583('0x22')](saveUpdates(_0x50f9d6[_0xc583('0x83')],null))[_0xc583('0x22')](function(_0x564fc0){if(_0x564fc0){_0x18a2cd=_0x564fc0;return db['ChatWebsite'][_0xc583('0x6e')]({'where':{'id':_0x18a2cd[_0xc583('0x86')]}});}})[_0xc583('0x22')](function(_0x23759e){if(_0x23759e){_0x774d90=_0x23759e;return db[_0xc583('0xed')]['find']({'where':{'id':_0x18a2cd[_0xc583('0x76')]}});}})['then'](function(_0x8d44b7){if(_0x8d44b7){_0x2785c5=_0x8d44b7;if(_0x486cd1){var _0x1b4ac0=null;for(var _0x107927=0x1;_0x107927<_0x18a2cd[_0xc583('0xec')][_0xc583('0x4c')];++_0x107927){_0x1b4ac0=_0x18a2cd[_0xc583('0xec')][_0x107927];var _0x2b720c=_0x1b4ac0[_0xc583('0x81')]?util[_0xc583('0xe8')]('%s%d',_0x774d90[_0xc583('0xee')],_0x1b4ac0[_0xc583('0x81')]):'System';var _0x36975e=_0x50f9d6[_0xc583('0x83')][_0xc583('0xef')]||util['format'](_0xc583('0xf0'),_0xc583('0xf1'),_0x1b4ac0[_0xc583('0x76')]);switch(_0x774d90[_0xc583('0xf2')]){case _0xc583('0xf3'):_0x2b720c=_0x1b4ac0[_0xc583('0x81')]?util[_0xc583('0xe8')]('%s%d',_0x774d90[_0xc583('0xee')],_0x1b4ac0[_0xc583('0x81')]):_0xc583('0xf4');break;case'agent_alias':_0x2b720c=_0x1b4ac0['UserId']?_0x1b4ac0['User'][_0xc583('0xf5')]||_0x1b4ac0[_0xc583('0x7f')]['fullname']:_0xc583('0xf4');break;case _0xc583('0xf6'):_0x2b720c=_0x1b4ac0[_0xc583('0x81')]?_0x1b4ac0[_0xc583('0x7f')][_0xc583('0x3e')]:_0xc583('0xf4');break;default:_0x2b720c=_0x1b4ac0[_0xc583('0x81')]?util[_0xc583('0xe8')](_0xc583('0xf0'),_0x774d90[_0xc583('0xee')],_0x1b4ac0['UserId']):_0xc583('0xf4');}var _0x5b8197=util[_0xc583('0xe8')](_0xc583('0xf7'),moment(_0x1b4ac0[_0xc583('0x89')])[_0xc583('0xe8')](_0xc583('0xf8')),_0x1b4ac0[_0xc583('0xf9')]==='in'?_0x36975e:_0x2b720c,_0x1b4ac0[_0xc583('0x83')]);if(!_0x1b4ac0[_0xc583('0xfa')]){fs[_0xc583('0xfb')](_0x486cd1,_0x5b8197);}}return db[_0xc583('0xfc')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc583('0xfd'),'raw':!![]}]});}}})['then'](function(_0x45270a){if(_0x45270a&&_0x45270a[_0xc583('0xfd')]&&_0x50f9d6[_0xc583('0x83')]){var _0x44266a={'tls':{'rejectUnauthorized':![]}};if(_0x45270a['Smtp'][_0xc583('0xfe')]){_0x44266a[_0xc583('0xfe')]=_0x45270a['Smtp']['service'];}else{_0x44266a[_0xc583('0xff')]=_0x45270a[_0xc583('0xfd')][_0xc583('0xff')];_0x44266a['port']=_0x45270a['Smtp'][_0xc583('0x100')];_0x44266a['secure']=_0x45270a[_0xc583('0xfd')][_0xc583('0x101')];}if(_0x45270a[_0xc583('0xfd')]['authentication']){_0x44266a[_0xc583('0x102')]={'user':_0x45270a['Smtp']['user'],'pass':_0x45270a[_0xc583('0xfd')][_0xc583('0x103')]};}return respondWithRpcPromise(_0xc583('0x104'),_0xc583('0x105'),{'account':_0x44266a,'message':{'from':util[_0xc583('0xe8')](_0xc583('0x106'),_0x45270a[_0xc583('0x3b')],_0x45270a[_0xc583('0x107')]||_0x45270a[_0xc583('0xfd')][_0xc583('0xa3')]),'to':_0x50f9d6[_0xc583('0x83')][_0xc583('0x108')],'subject':_0xc583('0x109'),'text':util[_0xc583('0xe8')](_0xc583('0x10a'),_0x50f9d6['body'][_0xc583('0x108')]),'attachments':[{'path':_0x486cd1}]}})[_0xc583('0x22')](function(){return _0x18a2cd;})[_0xc583('0x2d')](function(_0x267c96){console[_0xc583('0x29')](_0x267c96);});}else{return _0x18a2cd;}})[_0xc583('0x22')](respondWithStatusCode(_0x1aa8a2,0xc8))[_0xc583('0x2d')](handleError(_0x1aa8a2,null));};exports[_0xc583('0x10b')]=function(_0xa21d7a,_0x3308a8,_0x270a3e){return db[_0xc583('0xce')][_0xc583('0x6e')]({'where':{'id':_0xa21d7a[_0xc583('0xc2')]['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x3308a8,null))['then'](function(_0x31784f){if(_0x31784f){return _0x31784f[_0xc583('0x10b')](_0xa21d7a[_0xc583('0x83')][_0xc583('0x10c')],_['omit'](_0xa21d7a[_0xc583('0x83')],[_0xc583('0x10c'),'id'])||{});}})[_0xc583('0x22')](respondWithResult(_0x3308a8,null))['catch'](handleError(_0x3308a8,null));};exports['getMessages']=function(_0x4b37b8,_0x3f30fd,_0x15ea31){var _0x2772c7={'raw':![],'where':{}};var _0x52bed1={};var _0x1d9782={'count':0x0,'rows':[]};return db[_0xc583('0x42')][_0xc583('0xde')]({'where':{'id':_0x4b37b8['params']['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x3f30fd,null))['then'](function(_0x50ff62){if(_0x50ff62){_0x52bed1[_0xc583('0x4d')]=_[_0xc583('0x47')](db[_0xc583('0xce')][_0xc583('0x43')]);_0x52bed1[_0xc583('0x46')]=_['keys'](_0x4b37b8['query']);_0x52bed1[_0xc583('0x48')]=_[_0xc583('0x49')](_0x52bed1[_0xc583('0x4d')],_0x52bed1['query']);_0x2772c7[_0xc583('0x4a')]=_[_0xc583('0x49')](_0x52bed1[_0xc583('0x4d')],qs['fields'](_0x4b37b8[_0xc583('0x46')][_0xc583('0x4b')]));_0x2772c7[_0xc583('0x4a')]=_0x2772c7[_0xc583('0x4a')][_0xc583('0x4c')]?_0x2772c7[_0xc583('0x4a')]:_0x52bed1['model'];if(!_0x4b37b8[_0xc583('0x46')]['hasOwnProperty'](_0xc583('0x4f'))){_0x2772c7['limit']=qs[_0xc583('0x50')](_0x4b37b8[_0xc583('0x46')][_0xc583('0x50')]);_0x2772c7[_0xc583('0x33')]=qs[_0xc583('0x33')](_0x4b37b8[_0xc583('0x46')][_0xc583('0x33')]);}_0x2772c7[_0xc583('0x51')]=qs[_0xc583('0x52')](_0x4b37b8[_0xc583('0x46')][_0xc583('0x52')]);_0x2772c7[_0xc583('0x53')]=qs[_0xc583('0x48')](_[_0xc583('0x54')](_0x4b37b8[_0xc583('0x46')],_0x52bed1[_0xc583('0x48')]));_0x2772c7[_0xc583('0x53')]['ChatInteractionId']=_0x50ff62['id'];if(_0x4b37b8[_0xc583('0x46')][_0xc583('0x93')]){_0x2772c7[_0xc583('0x53')]=_['merge'](_0x2772c7[_0xc583('0x53')],{'$or':_['map'](_0x2772c7[_0xc583('0x4a')],function(_0x2095f4){var _0x509ee5={};_0x509ee5[_0x2095f4]={'$like':'%'+_0x4b37b8[_0xc583('0x46')][_0xc583('0x93')]+'%'};return _0x509ee5;})});}if(_0x4b37b8[_0xc583('0x46')]['$gte']){var _0xcacf5e=_0x4b37b8[_0xc583('0x46')]['$gte']['split'](',');var _0x183571={};_0x183571[_0xcacf5e[0x0]]={'$gte':moment(_0xcacf5e[0x1])[_0xc583('0xe8')](_0xc583('0x10d'))};_0x2772c7[_0xc583('0x53')]=_['merge'](_0x2772c7['where'],_0x183571);}_0x2772c7=_['merge']({},_0x2772c7,_0x4b37b8[_0xc583('0x10e')]);return db[_0xc583('0xce')][_0xc583('0x32')]({'where':_0x2772c7[_0xc583('0x53')]})[_0xc583('0x22')](function(_0x9dad79){_0x1d9782[_0xc583('0x32')]=_0x9dad79;if(_0x4b37b8[_0xc583('0x46')][_0xc583('0xc3')]){_0x2772c7[_0xc583('0x10f')]=[{'all':!![]}];}return db[_0xc583('0xce')][_0xc583('0x110')](_0x2772c7);})[_0xc583('0x22')](function(_0x26cdcd){_0x1d9782[_0xc583('0xc0')]=_0x26cdcd;return _0x1d9782;});}})[_0xc583('0x22')](respondWithFilteredResult(_0x3f30fd,_0x2772c7))[_0xc583('0x2d')](handleError(_0x3f30fd,null));};exports[_0xc583('0x111')]=function(_0x272a27,_0x4d6f30,_0x132293){var _0x2f31ae={'where':{}},_0x5388f8={},_0x3b7fa2={'count':0x0,'rows':[]};return db[_0xc583('0x42')]['findOne']({'where':{'id':_0x272a27[_0xc583('0xc2')]['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x4d6f30,null))[_0xc583('0x22')](function(_0x41764a){if(_0x41764a){_0x5388f8[_0xc583('0x4d')]=_[_0xc583('0x47')](db['ChatMessage'][_0xc583('0x43')]);_0x5388f8['query']=_[_0xc583('0x47')](_0x272a27[_0xc583('0x46')]);_0x5388f8[_0xc583('0x48')]=_[_0xc583('0x49')](_0x5388f8['model'],_0x5388f8['query']);_0x2f31ae[_0xc583('0x4a')]=_[_0xc583('0x49')](_0x5388f8['model'],qs[_0xc583('0x4b')](_0x272a27[_0xc583('0x46')][_0xc583('0x4b')]));_0x2f31ae['attributes']=_0x2f31ae[_0xc583('0x4a')][_0xc583('0x4c')]?_0x2f31ae[_0xc583('0x4a')]:_0x5388f8[_0xc583('0x4d')];if(!_0x272a27[_0xc583('0x46')][_0xc583('0x4e')](_0xc583('0x4f'))){_0x2f31ae['limit']=qs['limit'](_0x272a27[_0xc583('0x46')]['limit']);_0x2f31ae['offset']=qs[_0xc583('0x33')](_0x272a27[_0xc583('0x46')][_0xc583('0x33')]);}_0x2f31ae[_0xc583('0x51')]=qs[_0xc583('0x52')](_0x272a27[_0xc583('0x46')][_0xc583('0x52')]);_0x2f31ae[_0xc583('0x53')]=qs[_0xc583('0x48')](_[_0xc583('0x54')](_0x272a27['query'],_0x5388f8[_0xc583('0x48')]));_0x2f31ae[_0xc583('0x53')][_0xc583('0xbd')]=_0x41764a['id'];if(_0x272a27['query']['filter']){_0x2f31ae['where']=_[_0xc583('0xa7')](_0x2f31ae[_0xc583('0x53')],{'$or':_[_0xc583('0x3d')](_0x2f31ae[_0xc583('0x4a')],function(_0x421975){var _0x45f26d={};_0x45f26d[_0x421975]={'$like':'%'+_0x272a27[_0xc583('0x46')][_0xc583('0x93')]+'%'};return _0x45f26d;})});}_0x2f31ae[_0xc583('0x53')][_0xc583('0xfa')]=![];if(_0x272a27[_0xc583('0x46')]['id']){_0x2f31ae['where']['id']={'$gt':_0x272a27[_0xc583('0x46')]['id']};}_0x2f31ae=_[_0xc583('0xa7')]({},_0x2f31ae,_0x272a27[_0xc583('0x10e')]);return db[_0xc583('0xce')][_0xc583('0x32')]({'where':_0x2f31ae[_0xc583('0x53')]})[_0xc583('0x22')](function(_0x8c2492){_0x3b7fa2['count']=_0x8c2492;_0x2f31ae[_0xc583('0x10f')]=[];if(_0x272a27[_0xc583('0x46')]['includeAgent']){_0x2f31ae[_0xc583('0x10f')][_0xc583('0xbe')]({'model':db[_0xc583('0x7f')],'as':_0xc583('0x7f'),'attributes':['id',_0xc583('0x3e'),_0xc583('0xf5')]});}if(_0x272a27[_0xc583('0x46')][_0xc583('0xc3')]){_0x2f31ae[_0xc583('0x10f')]=[{'all':!![]}];}return db[_0xc583('0xce')][_0xc583('0x110')](_0x2f31ae);})[_0xc583('0x22')](function(_0x3f169f){_0x3b7fa2[_0xc583('0xc0')]=_0x3f169f;return _0x3b7fa2;});}})[_0xc583('0x22')](respondWithFilteredResult(_0x4d6f30,_0x2f31ae))[_0xc583('0x2d')](handleError(_0x4d6f30,null));};exports[_0xc583('0x112')]=function(_0x46e785,_0x1175a2,_0x585e36){return db['ChatInteraction'][_0xc583('0x6e')]({'where':{'id':_0x46e785['params']['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x1175a2,null))[_0xc583('0x22')](function(_0x442dc0){if(_0x442dc0){return _0x442dc0['setTags'](_0x46e785[_0xc583('0x83')][_0xc583('0x10c')],_[_0xc583('0x113')](_0x46e785[_0xc583('0x83')],[_0xc583('0x10c'),'id'])||{})['spread'](function(){return db['Tag'][_0xc583('0x110')]({'attributes':['id',_0xc583('0x3b'),_0xc583('0x56')],'where':{'id':_0x46e785[_0xc583('0x83')][_0xc583('0x10c')]}});})[_0xc583('0x22')](function(_0x334244){socket[_0xc583('0x114')]('chatInteractionTags:save',{'id':Number(_0x46e785['params']['id']),'tags':_0x334244||[]});return{'id':Number(_0x46e785[_0xc583('0xc2')]['id']),'tags':_0x334244||[]};});}})[_0xc583('0x22')](respondWithResult(_0x1175a2,null))[_0xc583('0x2d')](handleError(_0x1175a2,null));};exports[_0xc583('0x115')]=function(_0x34403a,_0x54867b,_0xa0ef23){return db['ChatInteraction'][_0xc583('0x6e')]({'where':{'id':_0x34403a[_0xc583('0xc2')]['id']}})[_0xc583('0x22')](handleEntityNotFound(_0x54867b,null))['then'](function(_0x383d35){if(_0x383d35){return _0x383d35[_0xc583('0x115')](_0x34403a[_0xc583('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x54867b,null))[_0xc583('0x2d')](handleError(_0x54867b,null));};exports[_0xc583('0xe2')]=function(_0x5b466a,_0x47b0a3){var _0x1a6e7f=moment()['unix']()[_0xc583('0xba')]();var _0x583837=path[_0xc583('0xe3')](config[_0xc583('0xe4')],_0xc583('0x116'),_0xc583('0x117'),'tmp');var _0x3da50a=path['join'](config[_0xc583('0xe4')],_0xc583('0x116'),_0xc583('0x117'),_0xc583('0x118'));var _0x1990b0=path[_0xc583('0xe3')](_0x583837,_0x1a6e7f);var _0x558aea=util[_0xc583('0xe8')]('transcript-%d-%s.zip',_0x5b466a[_0xc583('0xc2')]['id'],_0x1a6e7f);var _0x3244be=path[_0xc583('0xe3')](_0x583837,_0x558aea);var _0x4a8088=[];_0x4a8088[_0xc583('0xbe')]({'model':db[_0xc583('0x7f')],'as':_0xc583('0x7f'),'attributes':['id',_0xc583('0x3e')],'raw':!![]});_0x4a8088[_0xc583('0xbe')]({'model':db[_0xc583('0xed')],'as':_0xc583('0x71'),'attributes':['id',_0xc583('0x119'),_0xc583('0x11a')],'raw':!![]});if(_0x5b466a[_0xc583('0x46')]['attachments']){_0x4a8088['push']({'model':db[_0xc583('0xe0')],'as':'Attachment','raw':!![]});}var _0x12217c=[{'model':db[_0xc583('0xce')],'as':_0xc583('0xec'),'attributes':['id',_0xc583('0x83'),'createdAt',_0xc583('0xf9'),_0xc583('0xfa'),_0xc583('0x8f')],'include':_0x4a8088}];_0x12217c['push']({'model':db[_0xc583('0x11b')],'as':_0xc583('0x11c'),'attributes':['id',_0xc583('0x3b')]});_0x12217c[_0xc583('0xbe')]({'model':db[_0xc583('0x7f')],'as':'Owner','attributes':['id',_0xc583('0x3e')]});return db['ChatInteraction']['find']({'where':{'id':_0x5b466a[_0xc583('0xc2')]['id']},'include':_0x12217c})[_0xc583('0x22')](handleEntityNotFound(_0x47b0a3,null))[_0xc583('0x22')](function(_0x29e600){if(_0x29e600){var _0x221112=_0x29e600[_0xc583('0x11d')]({'plain':!![]});fs[_0xc583('0x11e')](_0x1990b0);var _0x3786fd={'format':'A4','border':'10px','header':{'height':_0xc583('0x11f'),'contents':{'first':_0xc583('0x120')}},'footer':{'height':_0xc583('0x121'),'contents':{'default':util['format'](_0xc583('0x122'),util[_0xc583('0xe8')](_0xc583('0x123'),'Chat',_0x221112['id']),moment()[_0xc583('0xe8')]('YYYY-MM-DD')[_0xc583('0xba')]())}}};var _0x29a8c3={'channel':_0xc583('0x124'),'account':_0x221112['Account'][_0xc583('0x3b')],'agent':_0x221112['Owner']?_0x221112[_0xc583('0x125')][_0xc583('0x3e')]:_0xc583('0x126'),'createdAt':moment(_0x221112['createdAt'])[_0xc583('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc583('0xba')](),'closedAt':_0x221112['closed']?moment(_0x221112[_0xc583('0x127')])[_0xc583('0xe8')](_0xc583('0x10d'))['toString']():'','disposition':_0x221112[_0xc583('0xd7')],'chatInfo':{'browser':_0x221112['browserName'],'os':_0x221112[_0xc583('0x128')],'referer':_0x221112[_0xc583('0x129')],'customerIp':_0x221112[_0xc583('0x12a')],'customerPort':_0x221112[_0xc583('0x12b')]?_0x221112[_0xc583('0x12b')]:'N.A.'},'messages':_(_0x221112['Messages'])['tail']()[_0xc583('0x93')]({'secret':![]})[_0xc583('0x3d')](function(_0x27271a){if(_0x27271a[_0xc583('0xe0')]){var _0x5805ca=path['join'](_0x3da50a,_0x27271a[_0xc583('0xe0')][_0xc583('0xe6')]);if(fs['existsSync'](_0x5805ca)){fs[_0xc583('0x12c')](_0x5805ca)[_0xc583('0x12d')](fs[_0xc583('0x12e')](path[_0xc583('0xe3')](_0x1990b0,_0x27271a[_0xc583('0xe0')][_0xc583('0xe6')])));}}return{'date':moment(_0x27271a[_0xc583('0x89')])[_0xc583('0xe8')](_0xc583('0x10d'))['toString'](),'sender':_0x27271a['direction']===_0xc583('0xcd')?_0x27271a[_0xc583('0x7f')]?_0x27271a[_0xc583('0x7f')]['fullname']:_0xc583('0xf4'):_0x27271a['Contact']['firstName']+(_0x27271a[_0xc583('0x71')][_0xc583('0x11a')]?'\x20'+_0x27271a[_0xc583('0x71')][_0xc583('0x11a')]:''),'body':_0x27271a[_0xc583('0xe0')]?_0x27271a[_0xc583('0xe0')][_0xc583('0xe6')]:_0x27271a[_0xc583('0x83')],'direction':_0x27271a[_0xc583('0xf9')]===_0xc583('0xcd')?'A':'C','secret':_0x27271a[_0xc583('0xfa')],'read':_0x27271a[_0xc583('0x8f')],'attachment':_0x27271a[_0xc583('0xe0')]};})[_0xc583('0x79')]()};return ejs[_0xc583('0x12f')](path[_0xc583('0xe3')](config['root'],_0xc583('0x116'),_0xc583('0x130'),_0xc583('0x131')),{'interaction':_0x29a8c3})['then'](function(_0x14caf3){return new BPromise(function(_0x32f385,_0x41045d){pdf[_0xc583('0xc4')](_0x14caf3,_0x3786fd)[_0xc583('0x132')](path['join'](_0x1990b0,'transcript-'+_0x221112['id']+'-'+_0x1a6e7f+_0xc583('0x133')),function(_0x335b28,_0x1bddee){if(_0x335b28)return _0x41045d(_0x335b28);_0x32f385(_0x1bddee);});});})[_0xc583('0x22')](function(){return new BPromise(function(_0x258b10,_0x3fc755){zipdir(_0x1990b0,{'saveTo':_0x3244be},function(_0x4a900c,_0x2ba67d){if(_0x4a900c)return _0x3fc755(_0x4a900c);return _0x258b10(_0x2ba67d);});})[_0xc583('0x22')](function(){return new BPromise(function(_0x291a9a,_0x685f68){rimraf(_0x1990b0,function(_0x38dc1c){if(_0x38dc1c)_0x685f68(_0x38dc1c);return _0x291a9a();});});})[_0xc583('0x22')](function(){return _0x47b0a3['download'](_0x3244be,_0x558aea,function(_0x197e0f){if(_0x197e0f){console['log']('err',_0x197e0f);}else{fs[_0xc583('0x134')](_0x3244be);}});});});}else{return _0x47b0a3[_0xc583('0x2e')](0xc8);}})['catch'](handleError(_0x47b0a3,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index f7f4a42..0fef766 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 _0x65f6=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','getUsers','then','Users','map','findAll'];(function(_0xc5a3c1,_0x1cb35f){var _0x1dbc0c=function(_0x559e94){while(--_0x559e94){_0xc5a3c1['push'](_0xc5a3c1['shift']());}};_0x1dbc0c(++_0x1cb35f);}(_0x65f6,0x170));var _0x665f=function(_0x44a522,_0x1312bb){_0x44a522=_0x44a522-0x0;var _0x61ecc1=_0x65f6[_0x44a522];return _0x61ecc1;};'use strict';var EventEmitter=require(_0x665f('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x665f('0x1')];var ChatMessage=require(_0x665f('0x2'))['db'][_0x665f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x665f('0x4')](0x0);var events={'afterCreate':_0x665f('0x5'),'afterUpdate':_0x665f('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4279d8){return function(_0x51904d,_0x173eaf,_0x174997){_0x51904d[_0x665f('0x7')]({'attributes':['id'],'raw':!![]})[_0x665f('0x8')](function(_0x3ce1bf){_0x51904d['setDataValue'](_0x665f('0x9'),_0x3ce1bf[_0x665f('0xa')](function(_0x3b3373){return{'id':_0x3b3373['id']};}));return ChatMessage[_0x665f('0xb')]({'where':{'ChatInteractionId':_0x51904d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x665f('0x8')](function(_0x3d30cb){_0x51904d['setDataValue'](_0x665f('0xc'),_0x3d30cb[_0x665f('0xd')]);ChatInteractionEvents[_0x665f('0xe')](_0x4279d8+':'+_0x51904d['id'],_0x51904d);ChatInteractionEvents[_0x665f('0xe')](_0x4279d8,_0x51904d);_0x174997(null);})[_0x665f('0xf')](_0x174997(null));};}for(var e in events){if(events[_0x665f('0x10')](e)){var event=events[e];ChatInteraction[_0x665f('0x11')](e,emitEvent(event));}}module[_0x665f('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0xa7f8=['setDataValue','map','findAll','length','emit','catch','exports','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','getUsers','then'];(function(_0x54f859,_0x59d463){var _0x17a08b=function(_0x3f8e49){while(--_0x3f8e49){_0x54f859['push'](_0x54f859['shift']());}};_0x17a08b(++_0x59d463);}(_0xa7f8,0x160));var _0x8a7f=function(_0x570c8a,_0x4a11cc){_0x570c8a=_0x570c8a-0x0;var _0x25dc12=_0xa7f8[_0x570c8a];return _0x25dc12;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x8a7f('0x0'))['db'][_0x8a7f('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x8a7f('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a7f('0x3'),'afterUpdate':_0x8a7f('0x4'),'afterDestroy':_0x8a7f('0x5')};function emitEvent(_0x47a7d5){return function(_0x35fd45,_0x21ae45,_0x3bbc21){_0x35fd45[_0x8a7f('0x6')]({'attributes':['id'],'raw':!![]})[_0x8a7f('0x7')](function(_0x4ce596){_0x35fd45[_0x8a7f('0x8')]('Users',_0x4ce596[_0x8a7f('0x9')](function(_0xebb4cd){return{'id':_0xebb4cd['id']};}));return ChatMessage[_0x8a7f('0xa')]({'where':{'ChatInteractionId':_0x35fd45['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x367975){_0x35fd45['setDataValue']('unreadMessages',_0x367975[_0x8a7f('0xb')]);ChatInteractionEvents[_0x8a7f('0xc')](_0x47a7d5+':'+_0x35fd45['id'],_0x35fd45);ChatInteractionEvents['emit'](_0x47a7d5,_0x35fd45);_0x3bbc21(null);})[_0x8a7f('0xd')](_0x3bbc21(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x8a7f('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 942daa1..e1f684b 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 _0x5040=['define','ChatInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xedde59,_0x50d9b1){var _0x4db279=function(_0xa24719){while(--_0xa24719){_0xedde59['push'](_0xedde59['shift']());}};_0x4db279(++_0x50d9b1);}(_0x5040,0xbd));var _0x0504=function(_0x47ad99,_0x44b6a3){_0x47ad99=_0x47ad99-0x0;var _0xebd3e9=_0x5040[_0x47ad99];return _0xebd3e9;};'use strict';var _=require(_0x0504('0x0'));var util=require(_0x0504('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0504('0x2'));var rp=require(_0x0504('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0504('0x4'));var config=require(_0x0504('0x5'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x242363,_0x3ee168){return _0x242363[_0x0504('0x6')](_0x0504('0x7'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28ddc5,_0x1dc93f,_0x568ba1){if(_0x28ddc5['changed'](_0x0504('0x8'))){_0x28ddc5['closedAt']=moment()[_0x0504('0x9')](_0x0504('0xa'));}_0x568ba1(null,_0x28ddc5);}},'charset':_0x0504('0xb'),'collate':_0x0504('0xc')});}; \ No newline at end of file +var _0x2619=['ChatInteraction','chat_interactions','changed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x29924d,_0x587d18){var _0x358358=function(_0x309ad0){while(--_0x309ad0){_0x29924d['push'](_0x29924d['shift']());}};_0x358358(++_0x587d18);}(_0x2619,0x1db));var _0x9261=function(_0x4735cd,_0x385053){_0x4735cd=_0x4735cd-0x0;var _0x5463cf=_0x2619[_0x4735cd];return _0x5463cf;};'use strict';var _=require(_0x9261('0x0'));var util=require(_0x9261('0x1'));var logger=require(_0x9261('0x2'))(_0x9261('0x3'));var moment=require(_0x9261('0x4'));var BPromise=require(_0x9261('0x5'));var rp=require(_0x9261('0x6'));var fs=require('fs');var path=require(_0x9261('0x7'));var rimraf=require(_0x9261('0x8'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x9261('0x9')]=function(_0x4b1af3,_0x2ecb7f){return _0x4b1af3[_0x9261('0xa')](_0x9261('0xb'),attributes,{'tableName':_0x9261('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3862de,_0x582a49,_0x262dfb){if(_0x3862de[_0x9261('0xd')]('closed')){_0x3862de[_0x9261('0xe')]=moment()[_0x9261('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x262dfb(null,_0x3862de);}},'charset':_0x9261('0x10'),'collate':_0x9261('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 0eb3381..fb50949 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 _0x17ce=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','debug','catch','AddTagsToChatInteraction','find','addTags','ids','AddTags','lodash','moment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x17ce,0x154));var _0xe17c=function(_0x25e49f,_0x27681a){_0x25e49f=_0x25e49f-0x0;var _0x1a649e=_0x17ce[_0x25e49f];return _0x1a649e;};'use strict';var _=require(_0xe17c('0x0'));var util=require('util');var moment=require(_0xe17c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe17c('0x2'));var fs=require('fs');var Redis=require(_0xe17c('0x3'));var db=require(_0xe17c('0x4'))['db'];var utils=require(_0xe17c('0x5'));var logger=require(_0xe17c('0x6'))(_0xe17c('0x7'));var config=require(_0xe17c('0x8'));var jayson=require(_0xe17c('0x9'));var client=jayson[_0xe17c('0xa')]['http']({'port':0x232a});config[_0xe17c('0xb')]=_[_0xe17c('0xc')](config['redis'],{'host':_0xe17c('0xd'),'port':0x18eb});var socket=require(_0xe17c('0xe'))(new Redis(config[_0xe17c('0xb')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x22104f,_0x2091cb,_0x482e17){return new BPromise(function(_0x57105c,_0xe34e4e){return client['request'](_0x22104f,_0x482e17)[_0xe17c('0xf')](function(_0x43b9d8){logger[_0xe17c('0x10')](_0xe17c('0x11'),_0x2091cb,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2091cb,_0xe17c('0x12'),JSON[_0xe17c('0x13')](_0x43b9d8));if(_0x43b9d8[_0xe17c('0x14')]){if(_0x43b9d8[_0xe17c('0x14')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2091cb,_0x43b9d8[_0xe17c('0x14')][_0xe17c('0x15')]);return _0xe34e4e(_0x43b9d8[_0xe17c('0x14')][_0xe17c('0x15')]);}logger['error'](_0xe17c('0x11'),_0x2091cb,_0x43b9d8[_0xe17c('0x14')]['message']);return _0x57105c(_0x43b9d8[_0xe17c('0x14')][_0xe17c('0x15')]);}else{logger[_0xe17c('0x10')](_0xe17c('0x11'),_0x2091cb,_0xe17c('0x12'));_0x57105c(_0x43b9d8[_0xe17c('0x16')][_0xe17c('0x15')]);}})['catch'](function(_0x7dd8b7){logger[_0xe17c('0x14')](_0xe17c('0x11'),_0x2091cb,_0x7dd8b7);_0xe34e4e(_0x7dd8b7);});});}exports[_0xe17c('0x17')]=function(_0x132f5f){var _0x27a61f=this;return new Promise(function(_0x50512d,_0x3d0d59){return db[_0xe17c('0x18')][_0xe17c('0x19')](_0x132f5f[_0xe17c('0x1a')],{'raw':_0x132f5f[_0xe17c('0x1b')]?_0x132f5f[_0xe17c('0x1b')][_0xe17c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x132f5f[_0xe17c('0x1b')]?_0x132f5f[_0xe17c('0x1b')][_0xe17c('0x1d')]||null:null,'attributes':_0x132f5f[_0xe17c('0x1b')]?_0x132f5f['options'][_0xe17c('0x1e')]||null:null,'limit':_0x132f5f[_0xe17c('0x1b')]?_0x132f5f[_0xe17c('0x1b')]['limit']||null:null})[_0xe17c('0xf')](function(_0x1d46b6){logger['info'](_0xe17c('0x17'),_0x132f5f);logger[_0xe17c('0x1f')](_0xe17c('0x17'),_0x132f5f,JSON[_0xe17c('0x13')](_0x1d46b6));_0x50512d(_0x1d46b6);})[_0xe17c('0x20')](function(_0x34fe93){logger[_0xe17c('0x14')](_0xe17c('0x17'),_0x34fe93[_0xe17c('0x15')],_0x132f5f);_0x3d0d59(_0x27a61f[_0xe17c('0x14')](0x1f4,_0x34fe93[_0xe17c('0x15')]));});});};exports[_0xe17c('0x21')]=function(_0x300c7b){return new Promise(function(_0x5c8fe1,_0x3126ca){return db['ChatInteraction'][_0xe17c('0x22')]({'where':_0x300c7b[_0xe17c('0x1b')]?_0x300c7b[_0xe17c('0x1b')]['where']||null:null})[_0xe17c('0xf')](function(_0x21006b){if(_0x21006b){return _0x21006b[_0xe17c('0x23')](_0x300c7b[_0xe17c('0x1a')]['ids'],_['omit'](_0x300c7b[_0xe17c('0x1a')],[_0xe17c('0x24'),'id'])||{});}})['spread'](function(_0x37d852){logger[_0xe17c('0x10')](_0xe17c('0x25'),_0x300c7b);logger[_0xe17c('0x1f')](_0xe17c('0x25'),_0x300c7b,JSON['stringify'](_0x37d852));_0x5c8fe1(_0x37d852);})[_0xe17c('0x20')](function(_0x3cae85){logger[_0xe17c('0x14')](_0xe17c('0x25'),_0x3cae85[_0xe17c('0x15')],_0x300c7b);_0x3126ca(_this[_0xe17c('0x14')](0x1f4,_0x3cae85[_0xe17c('0x15')]));});});}; \ No newline at end of file +var _0xbee1=['ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','update','body','options','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','where','addTags'];(function(_0x158a34,_0x1b6a75){var _0x441524=function(_0x1ad53a){while(--_0x1ad53a){_0x158a34['push'](_0x158a34['shift']());}};_0x441524(++_0x1b6a75);}(_0xbee1,0x11c));var _0x1bee=function(_0x5a1352,_0x42edb2){_0x5a1352=_0x5a1352-0x0;var _0x1b1061=_0xbee1[_0x5a1352];return _0x1b1061;};'use strict';var _=require('lodash');var util=require(_0x1bee('0x0'));var moment=require(_0x1bee('0x1'));var BPromise=require(_0x1bee('0x2'));var rs=require(_0x1bee('0x3'));var fs=require('fs');var Redis=require(_0x1bee('0x4'));var db=require(_0x1bee('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1bee('0x6'));var client=jayson[_0x1bee('0x7')]['http']({'port':0x232a});config[_0x1bee('0x8')]=_[_0x1bee('0x9')](config['redis'],{'host':_0x1bee('0xa'),'port':0x18eb});var socket=require(_0x1bee('0xb'))(new Redis(config[_0x1bee('0x8')]));require(_0x1bee('0xc'))[_0x1bee('0xd')](socket);function respondWithRpcPromise(_0x1da7a5,_0x300bc9,_0x2b4830){return new BPromise(function(_0x36af1a,_0x40d3e3){return client[_0x1bee('0xe')](_0x1da7a5,_0x2b4830)[_0x1bee('0xf')](function(_0x174827){logger[_0x1bee('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x300bc9,'request\x20sent');logger[_0x1bee('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x300bc9,_0x1bee('0x12'),JSON[_0x1bee('0x13')](_0x174827));if(_0x174827[_0x1bee('0x14')]){if(_0x174827[_0x1bee('0x14')][_0x1bee('0x15')]===0x1f4){logger[_0x1bee('0x14')](_0x1bee('0x16'),_0x300bc9,_0x174827[_0x1bee('0x14')]['message']);return _0x40d3e3(_0x174827[_0x1bee('0x14')]['message']);}logger[_0x1bee('0x14')](_0x1bee('0x16'),_0x300bc9,_0x174827[_0x1bee('0x14')][_0x1bee('0x17')]);return _0x36af1a(_0x174827[_0x1bee('0x14')][_0x1bee('0x17')]);}else{logger[_0x1bee('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x300bc9,_0x1bee('0x12'));_0x36af1a(_0x174827[_0x1bee('0x18')][_0x1bee('0x17')]);}})[_0x1bee('0x19')](function(_0x251915){logger[_0x1bee('0x14')](_0x1bee('0x16'),_0x300bc9,_0x251915);_0x40d3e3(_0x251915);});});}exports['UpdateChatInteraction']=function(_0x62b38f){var _0x4ce3ac=this;return new Promise(function(_0x4e6a83,_0x1ba045){return db['ChatInteraction'][_0x1bee('0x1a')](_0x62b38f[_0x1bee('0x1b')],{'raw':_0x62b38f['options']?_0x62b38f[_0x1bee('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x62b38f[_0x1bee('0x1c')]?_0x62b38f['options']['where']||null:null,'attributes':_0x62b38f[_0x1bee('0x1c')]?_0x62b38f[_0x1bee('0x1c')][_0x1bee('0x1d')]||null:null,'limit':_0x62b38f[_0x1bee('0x1c')]?_0x62b38f[_0x1bee('0x1c')][_0x1bee('0x1e')]||null:null})[_0x1bee('0xf')](function(_0x1104b6){logger[_0x1bee('0x10')](_0x1bee('0x1f'),_0x62b38f);logger[_0x1bee('0x11')](_0x1bee('0x1f'),_0x62b38f,JSON['stringify'](_0x1104b6));_0x4e6a83(_0x1104b6);})['catch'](function(_0x1e98da){logger[_0x1bee('0x14')](_0x1bee('0x1f'),_0x1e98da[_0x1bee('0x17')],_0x62b38f);_0x1ba045(_0x4ce3ac[_0x1bee('0x14')](0x1f4,_0x1e98da[_0x1bee('0x17')]));});});};exports[_0x1bee('0x20')]=function(_0xccc061){return new Promise(function(_0x2f6892,_0x1cea2f){return db['ChatInteraction'][_0x1bee('0x21')]({'where':_0xccc061['options']?_0xccc061[_0x1bee('0x1c')][_0x1bee('0x22')]||null:null})[_0x1bee('0xf')](function(_0x34363f){if(_0x34363f){return _0x34363f[_0x1bee('0x23')](_0xccc061[_0x1bee('0x1b')][_0x1bee('0x24')],_[_0x1bee('0x25')](_0xccc061[_0x1bee('0x1b')],[_0x1bee('0x24'),'id'])||{});}})[_0x1bee('0x26')](function(_0x151a35){logger[_0x1bee('0x10')](_0x1bee('0x27'),_0xccc061);logger[_0x1bee('0x11')](_0x1bee('0x27'),_0xccc061,JSON['stringify'](_0x151a35));_0x2f6892(_0x151a35);})[_0x1bee('0x19')](function(_0x384de8){logger['error']('AddTags',_0x384de8[_0x1bee('0x17')],_0xccc061);_0x1cea2f(_this[_0x1bee('0x14')](0x1f4,_0x384de8['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1eb2e9c..c043d21 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 _0x03f8=['update','emit','removeListener','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x565757,_0x433f97){var _0x71f8b9=function(_0x31571b){while(--_0x31571b){_0x565757['push'](_0x565757['shift']());}};_0x71f8b9(++_0x433f97);}(_0x03f8,0xf5));var _0x803f=function(_0xe455e7,_0x29fb65){_0xe455e7=_0xe455e7-0x0;var _0xfc683e=_0x03f8[_0xe455e7];return _0xfc683e;};'use strict';var ChatInteractionEvents=require(_0x803f('0x0'));var events=[_0x803f('0x1'),_0x803f('0x2'),_0x803f('0x3')];function createListener(_0x4f35fd,_0x1b881f){return function(_0x2a53d7){_0x1b881f[_0x803f('0x4')](_0x4f35fd,_0x2a53d7);};}function removeListener(_0x5d98ab,_0x21b024){return function(){ChatInteractionEvents[_0x803f('0x5')](_0x5d98ab,_0x21b024);};}exports['register']=function(_0x12cf24){for(var _0x161288=0x0,_0x3537bb=events[_0x803f('0x6')];_0x161288<_0x3537bb;_0x161288++){var _0xe83801=events[_0x161288];var _0x5f6b7e=createListener(_0x803f('0x7')+_0xe83801,_0x12cf24);ChatInteractionEvents['on'](_0xe83801,_0x5f6b7e);}}; \ No newline at end of file +var _0x8c63=['./chatInteraction.events','save','remove','update','emit','register','length','chatInteraction:'];(function(_0x874f81,_0xe20ffd){var _0x2ea7ba=function(_0xb88898){while(--_0xb88898){_0x874f81['push'](_0x874f81['shift']());}};_0x2ea7ba(++_0xe20ffd);}(_0x8c63,0x180));var _0x38c6=function(_0x25737e,_0x49c8ab){_0x25737e=_0x25737e-0x0;var _0x51b928=_0x8c63[_0x25737e];return _0x51b928;};'use strict';var ChatInteractionEvents=require(_0x38c6('0x0'));var events=[_0x38c6('0x1'),_0x38c6('0x2'),_0x38c6('0x3')];function createListener(_0x59347a,_0x68c329){return function(_0x5d0d78){_0x68c329[_0x38c6('0x4')](_0x59347a,_0x5d0d78);};}function removeListener(_0x40815d,_0x34a1b2){return function(){ChatInteractionEvents['removeListener'](_0x40815d,_0x34a1b2);};}exports[_0x38c6('0x5')]=function(_0xfa640a){for(var _0x2b9ad3=0x0,_0x33fea8=events[_0x38c6('0x6')];_0x2b9ad3<_0x33fea8;_0x2b9ad3++){var _0x17d430=events[_0x2b9ad3];var _0x5208df=createListener(_0x38c6('0x7')+_0x17d430,_0xfa640a);ChatInteractionEvents['on'](_0x17d430,_0x5208df);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 039cae6..399c94a 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 _0x7708=['tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout','../../config/environment','./chatInteraction.controller','isAuthenticated','get','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','format','%s-%s','replace','/:id/attachment_upload','single','file','addMessage'];(function(_0x62557c,_0x2beae0){var _0x26f89b=function(_0x39b9e9){while(--_0x39b9e9){_0x62557c['push'](_0x62557c['shift']());}};_0x26f89b(++_0x2beae0);}(_0x7708,0x188));var _0x8770=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0x7708[_0x427352];return _0x23e0e6;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8770('0x3'));var controller=require(_0x8770('0x4'));router['get']('/',auth[_0x8770('0x5')](),controller['index']);router[_0x8770('0x6')](_0x8770('0x7'),auth[_0x8770('0x5')](),controller[_0x8770('0x8')]);router[_0x8770('0x6')](_0x8770('0x9'),auth[_0x8770('0xa')](),controller['show']);router[_0x8770('0x6')](_0x8770('0xb'),auth[_0x8770('0xa')](),controller['attachmentDownload']);router[_0x8770('0x6')](_0x8770('0xc'),auth[_0x8770('0x5')](),controller[_0x8770('0xd')]);router['get'](_0x8770('0xe'),auth[_0x8770('0xa')](),controller[_0x8770('0xf')]);router['get'](_0x8770('0x10'),auth[_0x8770('0x5')](),controller[_0x8770('0x11')]);router[_0x8770('0x12')]('/',auth[_0x8770('0x5')](),controller[_0x8770('0x13')]);router[_0x8770('0x12')](_0x8770('0x14'),auth['isAuthenticated'](),controller[_0x8770('0x15')]);var upload=multer({'storage':multer[_0x8770('0x16')]({'destination':function(_0x5dd4e7,_0x2f7918,_0x52254f){_0x52254f(null,path[_0x8770('0x17')](config['root'],'server/files/attachments/'));},'filename':function(_0x50ff57,_0x155e83,_0x3b459a){_0x3b459a(null,util[_0x8770('0x18')](_0x8770('0x19'),Date['now'](),_0x155e83['originalname'][_0x8770('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8770('0x12')](_0x8770('0x1b'),upload[_0x8770('0x1c')](_0x8770('0x1d')),controller['attachmentUpload']);router[_0x8770('0x12')](_0x8770('0xc'),auth[_0x8770('0xa')](),controller[_0x8770('0x1e')]);router['post']('/:id/tags',auth[_0x8770('0x5')](),interaction[_0x8770('0x1f')](_0x8770('0x20'),_0x8770('0x21')),controller[_0x8770('0x22')]);router[_0x8770('0x23')]('/:id',auth[_0x8770('0x5')](),interaction[_0x8770('0x1f')](_0x8770('0x20'),_0x8770('0x24')),controller['update']);router[_0x8770('0x23')]('/:id/custom_update',controller[_0x8770('0x25')]);router[_0x8770('0x23')](_0x8770('0x26'),auth[_0x8770('0xa')](),controller[_0x8770('0x27')]);router[_0x8770('0x23')](_0x8770('0x28'),controller[_0x8770('0x29')]);router[_0x8770('0x2a')](_0x8770('0x9'),auth['isAuthenticated'](),interaction[_0x8770('0x1f')](_0x8770('0x20'),_0x8770('0x2b')),controller[_0x8770('0x2c')]);router[_0x8770('0x2a')](_0x8770('0x2d'),auth['isAuthenticated'](),controller['removeTags']);module[_0x8770('0x2e')]=router; \ No newline at end of file +var _0x83e1=['chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','connect-timeout','Router','../../config/environment','./chatInteraction.controller','get','/describe','isAuthenticated','/:id','isChatInteractionAuthorized','/:id/attachment_download','getMessages','/:id/my_messages','getMyMessages','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','attachmentUpload','/:id/tags'];(function(_0x2eb15c,_0x21c769){var _0x523ed4=function(_0x1e816b){while(--_0x1e816b){_0x2eb15c['push'](_0x2eb15c['shift']());}};_0x523ed4(++_0x21c769);}(_0x83e1,0x1ad));var _0x183e=function(_0x34f7c2,_0x264892){_0x34f7c2=_0x34f7c2-0x0;var _0x206ea2=_0x83e1[_0x34f7c2];return _0x206ea2;};'use strict';var multer=require(_0x183e('0x0'));var util=require(_0x183e('0x1'));var path=require('path');var timeout=require(_0x183e('0x2'));var express=require('express');var router=express[_0x183e('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x183e('0x4'));var controller=require(_0x183e('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x183e('0x6')](_0x183e('0x7'),auth[_0x183e('0x8')](),controller['describe']);router[_0x183e('0x6')](_0x183e('0x9'),auth[_0x183e('0xa')](),controller['show']);router[_0x183e('0x6')](_0x183e('0xb'),auth[_0x183e('0xa')](),controller['attachmentDownload']);router[_0x183e('0x6')]('/:id/messages',auth[_0x183e('0x8')](),controller[_0x183e('0xc')]);router[_0x183e('0x6')](_0x183e('0xd'),auth[_0x183e('0xa')](),controller[_0x183e('0xe')]);router[_0x183e('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x183e('0xf')]('/',auth[_0x183e('0x8')](),controller[_0x183e('0x10')]);router['post'](_0x183e('0x11'),auth[_0x183e('0x8')](),controller[_0x183e('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8f4af8,_0x35badd,_0x3faadf){_0x3faadf(null,path[_0x183e('0x13')](config[_0x183e('0x14')],_0x183e('0x15')));},'filename':function(_0x42fdf0,_0x271d11,_0x56df78){_0x56df78(null,util[_0x183e('0x16')](_0x183e('0x17'),Date[_0x183e('0x18')](),_0x271d11[_0x183e('0x19')][_0x183e('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x183e('0xf')]('/:id/attachment_upload',upload[_0x183e('0x1b')](_0x183e('0x1c')),controller[_0x183e('0x1d')]);router[_0x183e('0xf')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0x183e('0x1e'),auth['isAuthenticated'](),interaction['tracked'](_0x183e('0x1f'),_0x183e('0x20')),controller[_0x183e('0x21')]);router[_0x183e('0x22')](_0x183e('0x9'),auth['isAuthenticated'](),interaction[_0x183e('0x23')]('chat',_0x183e('0x24')),controller[_0x183e('0x25')]);router[_0x183e('0x22')](_0x183e('0x26'),controller['customUpdate']);router['put'](_0x183e('0x27'),auth[_0x183e('0xa')](),controller['abandon']);router['put'](_0x183e('0x28'),controller[_0x183e('0x29')]);router[_0x183e('0x2a')]('/:id',auth[_0x183e('0x8')](),interaction[_0x183e('0x23')](_0x183e('0x1f'),_0x183e('0x2b')),controller[_0x183e('0x2c')]);router[_0x183e('0x2a')](_0x183e('0x1e'),auth[_0x183e('0x8')](),controller['removeTags']);module[_0x183e('0x2d')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 5c59896..d1842ca 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 _0xda2d=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x4deefb,_0x33f98f){var _0x50d9cb=function(_0x3cb37f){while(--_0x3cb37f){_0x4deefb['push'](_0x4deefb['shift']());}};_0x50d9cb(++_0x33f98f);}(_0xda2d,0x102));var _0xdda2=function(_0x1adb3a,_0x508c05){_0x1adb3a=_0x1adb3a-0x0;var _0x1d836d=_0xda2d[_0x1adb3a];return _0x1d836d;};'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 +var _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0xe72721,_0x1307f8){var _0x3b15c0=function(_0x31c3c4){while(--_0x31c3c4){_0xe72721['push'](_0xe72721['shift']());}};_0x3b15c0(++_0x1307f8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 69203b4..43b6814 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 _0x35dd=['read','all','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','ChatInternalMessage','findAll','catch','show','params','length','find','create','body','describe','get','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','messages','FromId','ToId'];(function(_0x13f144,_0x2e439b){var _0x15d228=function(_0x5d3a42){while(--_0x5d3a42){_0x13f144['push'](_0x13f144['shift']());}};_0x15d228(++_0x2e439b);}(_0x35dd,0x1b6));var _0xd35d=function(_0x213de5,_0x3bdb5e){_0x213de5=_0x213de5-0x0;var _0x175a33=_0x35dd[_0x213de5];return _0x175a33;};'use strict';var pdf=require(_0xd35d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd35d('0x1'));var zipdir=require(_0xd35d('0x2'));var jsonpatch=require(_0xd35d('0x3'));var rp=require(_0xd35d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd35d('0x5'));var util=require(_0xd35d('0x6'));var path=require(_0xd35d('0x7'));var sox=require(_0xd35d('0x8'));var csv=require(_0xd35d('0x9'));var ejs=require(_0xd35d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd35d('0xb'));var crypto=require(_0xd35d('0xc'));var jsforce=require(_0xd35d('0xd'));var deskjs=require(_0xd35d('0xe'));var toCsv=require(_0xd35d('0x9'));var querystring=require(_0xd35d('0xf'));var Papa=require(_0xd35d('0x10'));var Redis=require(_0xd35d('0x11'));var authService=require(_0xd35d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd35d('0x13'));var logger=require(_0xd35d('0x14'))(_0xd35d('0x15'));var utils=require(_0xd35d('0x16'));var config=require(_0xd35d('0x17'));var db=require(_0xd35d('0x18'))['db'];config['redis']=_[_0xd35d('0x19')](config[_0xd35d('0x1a')],{'host':_0xd35d('0x1b'),'port':0x18eb});var socket=require(_0xd35d('0x1c'))(new Redis(config[_0xd35d('0x1a')]));require('./chatInternalMessage.socket')[_0xd35d('0x1d')](socket);function respondWithStatusCode(_0x5c3982,_0x3c006a){_0x3c006a=_0x3c006a||0xcc;return function(_0x1dc75d){if(_0x1dc75d){return _0x5c3982[_0xd35d('0x1e')](_0x3c006a);}return _0x5c3982[_0xd35d('0x1f')](_0x3c006a)[_0xd35d('0x20')]();};}function respondWithResult(_0x8dafb7,_0x42be4c){_0x42be4c=_0x42be4c||0xc8;return function(_0x34d38e){if(_0x34d38e){return _0x8dafb7[_0xd35d('0x1f')](_0x42be4c)[_0xd35d('0x21')](_0x34d38e);}};}function respondWithFilteredResult(_0x122d0f,_0xc5eba7){return function(_0x3f6b01){if(_0x3f6b01){var _0x245f6f=_0x3f6b01[_0xd35d('0x22')],_0x13fd18=_0xc5eba7[_0xd35d('0x23')],_0x192aa2=_0xc5eba7[_0xd35d('0x23')]+_0xc5eba7[_0xd35d('0x24')],_0x56b071;if(_0x192aa2>=_0x245f6f){_0x192aa2=_0x245f6f;_0x56b071=0xc8;}else{_0x56b071=0xce;}_0x122d0f[_0xd35d('0x1f')](_0x56b071);return _0x122d0f[_0xd35d('0x25')](_0xd35d('0x26'),_0x13fd18+'-'+_0x192aa2+'/'+_0x245f6f)[_0xd35d('0x21')](_0x3f6b01);}return null;};}function patchUpdates(_0xf75fb1){return function(_0x36bb7f){try{jsonpatch['apply'](_0x36bb7f,_0xf75fb1,!![]);}catch(_0xba9407){return BPromise[_0xd35d('0x27')](_0xba9407);}return _0x36bb7f['save']();};}function saveUpdates(_0x4506be,_0x13efc9){return function(_0x2c67d3){if(_0x2c67d3){return _0x2c67d3[_0xd35d('0x28')](_0x4506be)[_0xd35d('0x29')](function(_0x194599){return _0x194599;});}return null;};}function removeEntity(_0xad2304,_0x35bf35){return function(_0x3362b9){if(_0x3362b9){return _0x3362b9[_0xd35d('0x2a')]()[_0xd35d('0x29')](function(){_0xad2304[_0xd35d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e1ba,_0x442781){return function(_0x1bdfa6){if(!_0x1bdfa6){_0x59e1ba[_0xd35d('0x1e')](0x194);}return _0x1bdfa6;};}function handleError(_0x326156,_0x27eb2c){_0x27eb2c=_0x27eb2c||0x1f4;return function(_0x25e1c4){logger[_0xd35d('0x2b')](_0x25e1c4['stack']);if(_0x25e1c4['name']){delete _0x25e1c4[_0xd35d('0x2c')];}_0x326156['status'](_0x27eb2c)['send'](_0x25e1c4);};}exports['index']=function(_0x1893dc,_0x4e0562){var _0x2063d3={},_0x2662a0={},_0x5d34e0={'count':0x0,'rows':[]};var _0x4c1ee0=_[_0xd35d('0x2d')](db['ChatInternalMessage'][_0xd35d('0x2e')],function(_0x1cb806){return{'name':_0x1cb806['fieldName'],'type':_0x1cb806[_0xd35d('0x2f')][_0xd35d('0x30')]};});_0x2662a0[_0xd35d('0x31')]=_[_0xd35d('0x2d')](_0x4c1ee0,_0xd35d('0x2c'));_0x2662a0[_0xd35d('0x32')]=_[_0xd35d('0x33')](_0x1893dc[_0xd35d('0x32')]);_0x2662a0[_0xd35d('0x34')]=_[_0xd35d('0x35')](_0x2662a0[_0xd35d('0x31')],_0x2662a0[_0xd35d('0x32')]);_0x2063d3[_0xd35d('0x36')]=_[_0xd35d('0x35')](_0x2662a0[_0xd35d('0x31')],qs[_0xd35d('0x37')](_0x1893dc[_0xd35d('0x32')][_0xd35d('0x37')]));_0x2063d3[_0xd35d('0x36')]=_0x2063d3[_0xd35d('0x36')]['length']?_0x2063d3[_0xd35d('0x36')]:_0x2662a0[_0xd35d('0x31')];if(!_0x1893dc[_0xd35d('0x32')][_0xd35d('0x38')]('nolimit')){_0x2063d3[_0xd35d('0x24')]=qs[_0xd35d('0x24')](_0x1893dc[_0xd35d('0x32')][_0xd35d('0x24')]);_0x2063d3[_0xd35d('0x23')]=qs[_0xd35d('0x23')](_0x1893dc[_0xd35d('0x32')][_0xd35d('0x23')]);}_0x2063d3['order']=qs[_0xd35d('0x39')](_0x1893dc[_0xd35d('0x32')][_0xd35d('0x39')]);_0x2063d3['where']=qs[_0xd35d('0x34')](_[_0xd35d('0x3a')](_0x1893dc[_0xd35d('0x32')],_0x2662a0[_0xd35d('0x34')]),_0x4c1ee0);if(_0x1893dc['query'][_0xd35d('0x3b')]){_0x2063d3[_0xd35d('0x3c')]=_[_0xd35d('0x3d')](_0x2063d3[_0xd35d('0x3c')],{'$or':_[_0xd35d('0x2d')](_0x4c1ee0,function(_0x6d0919){if(_0x6d0919[_0xd35d('0x2f')]!==_0xd35d('0x3e')){var _0x551fe5={};_0x551fe5[_0x6d0919[_0xd35d('0x2c')]]={'$like':'%'+_0x1893dc[_0xd35d('0x32')][_0xd35d('0x3b')]+'%'};return _0x551fe5;}})});}_0x2063d3=_[_0xd35d('0x3d')]({},_0x2063d3,_0x1893dc[_0xd35d('0x3f')]);var _0x4d6c37={'where':_0x2063d3[_0xd35d('0x3c')]};return db['ChatInternalMessage'][_0xd35d('0x22')](_0x4d6c37)['then'](function(_0x420b5a){_0x5d34e0['count']=_0x420b5a;if(_0x1893dc['query'][_0xd35d('0x40')]){_0x2063d3[_0xd35d('0x41')]=[{'all':!![]}];}return db[_0xd35d('0x42')][_0xd35d('0x43')](_0x2063d3);})[_0xd35d('0x29')](function(_0x38cbe4){_0x5d34e0['rows']=_0x38cbe4;return _0x5d34e0;})[_0xd35d('0x29')](respondWithFilteredResult(_0x4e0562,_0x2063d3))[_0xd35d('0x44')](handleError(_0x4e0562,null));};exports[_0xd35d('0x45')]=function(_0x5552fa,_0x4f99b4){var _0x29125d={'raw':!![],'where':{'id':_0x5552fa[_0xd35d('0x46')]['id']}},_0x404fd2={};_0x404fd2[_0xd35d('0x31')]=_['keys'](db[_0xd35d('0x42')][_0xd35d('0x2e')]);_0x404fd2['query']=_[_0xd35d('0x33')](_0x5552fa[_0xd35d('0x32')]);_0x404fd2[_0xd35d('0x34')]=_[_0xd35d('0x35')](_0x404fd2['model'],_0x404fd2['query']);_0x29125d['attributes']=_[_0xd35d('0x35')](_0x404fd2['model'],qs[_0xd35d('0x37')](_0x5552fa[_0xd35d('0x32')][_0xd35d('0x37')]));_0x29125d['attributes']=_0x29125d[_0xd35d('0x36')][_0xd35d('0x47')]?_0x29125d[_0xd35d('0x36')]:_0x404fd2[_0xd35d('0x31')];if(_0x5552fa[_0xd35d('0x32')][_0xd35d('0x40')]){_0x29125d[_0xd35d('0x41')]=[{'all':!![]}];}_0x29125d=_[_0xd35d('0x3d')]({},_0x29125d,_0x5552fa[_0xd35d('0x3f')]);return db[_0xd35d('0x42')][_0xd35d('0x48')](_0x29125d)['then'](handleEntityNotFound(_0x4f99b4,null))['then'](respondWithResult(_0x4f99b4,null))[_0xd35d('0x44')](handleError(_0x4f99b4,null));};exports[_0xd35d('0x49')]=function(_0x5e9216,_0x76ed66){return db[_0xd35d('0x42')][_0xd35d('0x49')](_0x5e9216[_0xd35d('0x4a')],{})[_0xd35d('0x29')](respondWithResult(_0x76ed66,0xc9))[_0xd35d('0x44')](handleError(_0x76ed66,null));};exports['update']=function(_0x534ee1,_0x4a1201){if(_0x534ee1[_0xd35d('0x4a')]['id']){delete _0x534ee1['body']['id'];}return db[_0xd35d('0x42')][_0xd35d('0x48')]({'where':{'id':_0x534ee1[_0xd35d('0x46')]['id']}})[_0xd35d('0x29')](handleEntityNotFound(_0x4a1201,null))[_0xd35d('0x29')](saveUpdates(_0x534ee1[_0xd35d('0x4a')],null))[_0xd35d('0x29')](respondWithResult(_0x4a1201,null))[_0xd35d('0x44')](handleError(_0x4a1201,null));};exports[_0xd35d('0x2a')]=function(_0x13f53d,_0x401ff6){return db[_0xd35d('0x42')]['find']({'where':{'id':_0x13f53d['params']['id']}})['then'](handleEntityNotFound(_0x401ff6,null))[_0xd35d('0x29')](removeEntity(_0x401ff6,null))['catch'](handleError(_0x401ff6,null));};exports[_0xd35d('0x4b')]=function(_0x3d6bd6,_0x49f7fe){return db[_0xd35d('0x42')]['describe']()[_0xd35d('0x29')](respondWithResult(_0x49f7fe,null))[_0xd35d('0x44')](handleError(_0x49f7fe,null));};function wrapUser(_0x1776ca){return function(_0x9fbc5a){var _0x231dfd=_0x1776ca[_0xd35d('0x4c')]({'plain':!![]});_0x231dfd['messages']=[];if(_0x9fbc5a){_0x231dfd[_0xd35d('0x4d')]=_0x9fbc5a[_0xd35d('0x4e')];_0x231dfd['lastMessage']=_0x9fbc5a;}else{_0x231dfd[_0xd35d('0x4d')]=moment(0x0)[_0xd35d('0x4f')](_0xd35d('0x50'));_0x231dfd[_0xd35d('0x51')]={};}return _0x231dfd;};}exports[_0xd35d('0x52')]=function(_0x3282f7,_0x1547fd,_0x461e65){var _0x55cd15=[];return db[_0xd35d('0x53')][_0xd35d('0x43')]({'where':{'role':[_0xd35d('0x54'),_0xd35d('0x55'),_0xd35d('0x56')]},'attributes':['id',_0xd35d('0x57'),_0xd35d('0x2c'),_0xd35d('0x58'),_0xd35d('0x59'),_0xd35d('0x5a'),_0xd35d('0x5b'),_0xd35d('0x5c'),_0xd35d('0x5d'),_0xd35d('0x5e')],'order':qs['sort']('-online'),'include':[{'model':db[_0xd35d('0x5f')],'as':'VoiceQueues','attributes':['id','name',_0xd35d('0x2f')],'through':{'attributes':[]}}]})[_0xd35d('0x29')](function(_0x389164){if(_0x389164){var _0x1dc0f9=_0x3282f7[_0xd35d('0x56')][_0xd35d('0x4c')]({'plain':!![]});if(!_0x1dc0f9)throw new Error(_0xd35d('0x60'));if(_0x1dc0f9[_0xd35d('0x58')]===_0xd35d('0x56')){return db[_0xd35d('0x61')][_0xd35d('0x48')]({'where':{'name':_0xd35d('0x62'),'userProfileId':_0x1dc0f9[_0xd35d('0x63')]},'raw':!![]})[_0xd35d('0x29')](function(_0x363ac7){if(_0x363ac7){if(_0x363ac7[_0xd35d('0x64')]===0x0){return db[_0xd35d('0x65')][_0xd35d('0x43')]({'where':{'sectionId':_0x363ac7['id']},'raw':!![]})[_0xd35d('0x29')](function(_0x40fef5){var _0x49f887=[];if(_[_0xd35d('0x66')](_0x40fef5)){_0x49f887=_[_0xd35d('0x3b')](_0x389164,function(_0x21ca25){if(_0x21ca25[_0xd35d('0x58')]!==_0xd35d('0x54')){return _0x21ca25;}});return _0x49f887;}else{for(var _0x1840fb=0x0;_0x1840fb<_0x389164[_0xd35d('0x47')];_0x1840fb++){var _0x596c01=_0x389164[_0x1840fb];if(_0x596c01['role']===_0xd35d('0x54')){var _0x3c43d5=_[_0xd35d('0x48')](_0x40fef5,function(_0x913f9d){return _0x913f9d['resourceId']===_0x596c01['id'];});if(_0x3c43d5)_0x49f887[_0xd35d('0x67')](_0x596c01);}else{_0x49f887[_0xd35d('0x67')](_0x596c01);}}return _0x49f887;}});}else{return _0x389164;}}else{var _0x4c9d18=_[_0xd35d('0x3b')](_0x389164,function(_0x5e4e9b){if(_0x5e4e9b[_0xd35d('0x58')]!=='agent'){return _0x5e4e9b;}});return _0x4c9d18;}});}else{return _0x389164;}}})[_0xd35d('0x29')](function(_0x35b51c){var _0x50d207=[];if(_0x35b51c){_0x55cd15=_0x35b51c;for(var _0x223d76=0x0;_0x223d76<_0x35b51c[_0xd35d('0x47')];_0x223d76+=0x1){_0x55cd15[_0x223d76][_0xd35d('0x68')]=[];_0x50d207[_0xd35d('0x67')](db[_0xd35d('0x42')]['find']({'where':{'FromId':[_0x3282f7['user']['id'],_0x35b51c[_0x223d76]['id']],'ToId':[_0x3282f7[_0xd35d('0x56')]['id'],_0x35b51c[_0x223d76]['id']],'ChatGroupId':null},'attributes':['id',_0xd35d('0x4e'),_0xd35d('0x69'),_0xd35d('0x6a'),_0xd35d('0x6b'),'body'],'order':qs[_0xd35d('0x39')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd35d('0x29')](wrapUser(_0x35b51c[_0x223d76])));}return BPromise[_0xd35d('0x6c')](_0x50d207);}return[];})[_0xd35d('0x29')](function(_0x201cdd){return{'rows':_0x201cdd,'count':_0x201cdd[_0xd35d('0x47')]};})['then'](respondWithResult(_0x1547fd,null))['catch'](handleError(_0x1547fd,null));}; \ No newline at end of file +var _0xa732=['body','describe','get','messages','lastMessage','lastMessageAt','getUsers','User','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','Agents','userProfileId','filter','resourceId','push','createdAt','FromId','-createdAt','all','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','count','offset','limit','set','apply','then','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create'];(function(_0x559b4f,_0x40492e){var _0xc7d95c=function(_0x3775fb){while(--_0x3775fb){_0x559b4f['push'](_0x559b4f['shift']());}};_0xc7d95c(++_0x40492e);}(_0xa732,0x87));var _0x2a73=function(_0x4f65d8,_0x905afa){_0x4f65d8=_0x4f65d8-0x0;var _0x3222bc=_0xa732[_0x4f65d8];return _0x3222bc;};'use strict';var pdf=require(_0x2a73('0x0'));var emlformat=require(_0x2a73('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2a73('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a73('0x3'));var moment=require(_0x2a73('0x4'));var BPromise=require(_0x2a73('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2a73('0x6'));var csv=require(_0x2a73('0x7'));var ejs=require(_0x2a73('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2a73('0x9'));var crypto=require(_0x2a73('0xa'));var jsforce=require(_0x2a73('0xb'));var deskjs=require(_0x2a73('0xc'));var toCsv=require(_0x2a73('0x7'));var querystring=require(_0x2a73('0xd'));var Papa=require(_0x2a73('0xe'));var Redis=require(_0x2a73('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2a73('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a73('0x11'))(_0x2a73('0x12'));var utils=require(_0x2a73('0x13'));var config=require(_0x2a73('0x14'));var db=require(_0x2a73('0x15'))['db'];config[_0x2a73('0x16')]=_[_0x2a73('0x17')](config[_0x2a73('0x16')],{'host':_0x2a73('0x18'),'port':0x18eb});var socket=require(_0x2a73('0x19'))(new Redis(config[_0x2a73('0x16')]));require(_0x2a73('0x1a'))[_0x2a73('0x1b')](socket);function respondWithStatusCode(_0x4597a1,_0x299f80){_0x299f80=_0x299f80||0xcc;return function(_0x1c0942){if(_0x1c0942){return _0x4597a1['sendStatus'](_0x299f80);}return _0x4597a1[_0x2a73('0x1c')](_0x299f80)[_0x2a73('0x1d')]();};}function respondWithResult(_0x42034e,_0x2b8471){_0x2b8471=_0x2b8471||0xc8;return function(_0x547af3){if(_0x547af3){return _0x42034e['status'](_0x2b8471)[_0x2a73('0x1e')](_0x547af3);}};}function respondWithFilteredResult(_0x171a61,_0x1ff028){return function(_0x2003d5){if(_0x2003d5){var _0x589aa8=_0x2003d5[_0x2a73('0x1f')],_0x158fcb=_0x1ff028[_0x2a73('0x20')],_0x271fd1=_0x1ff028[_0x2a73('0x20')]+_0x1ff028[_0x2a73('0x21')],_0x2f934b;if(_0x271fd1>=_0x589aa8){_0x271fd1=_0x589aa8;_0x2f934b=0xc8;}else{_0x2f934b=0xce;}_0x171a61[_0x2a73('0x1c')](_0x2f934b);return _0x171a61[_0x2a73('0x22')]('Content-Range',_0x158fcb+'-'+_0x271fd1+'/'+_0x589aa8)['json'](_0x2003d5);}return null;};}function patchUpdates(_0x1625d9){return function(_0x51af1b){try{jsonpatch[_0x2a73('0x23')](_0x51af1b,_0x1625d9,!![]);}catch(_0x6783d3){return BPromise['reject'](_0x6783d3);}return _0x51af1b['save']();};}function saveUpdates(_0x2fce93,_0x36bf6f){return function(_0x4e79e5){if(_0x4e79e5){return _0x4e79e5['update'](_0x2fce93)[_0x2a73('0x24')](function(_0x409c1d){return _0x409c1d;});}return null;};}function removeEntity(_0x14eed7,_0x1522ac){return function(_0x14fb4b){if(_0x14fb4b){return _0x14fb4b['destroy']()['then'](function(){_0x14eed7[_0x2a73('0x1c')](0xcc)[_0x2a73('0x1d')]();});}};}function handleEntityNotFound(_0x51ebfb,_0xf177d7){return function(_0xb08de5){if(!_0xb08de5){_0x51ebfb[_0x2a73('0x25')](0x194);}return _0xb08de5;};}function handleError(_0x2a0cf0,_0x1ede7e){_0x1ede7e=_0x1ede7e||0x1f4;return function(_0x39da28){logger[_0x2a73('0x26')](_0x39da28[_0x2a73('0x27')]);if(_0x39da28[_0x2a73('0x28')]){delete _0x39da28[_0x2a73('0x28')];}_0x2a0cf0[_0x2a73('0x1c')](_0x1ede7e)[_0x2a73('0x29')](_0x39da28);};}exports[_0x2a73('0x2a')]=function(_0x1e2379,_0x451509){var _0x66a5a2={},_0xf64208={},_0x4ef9af={'count':0x0,'rows':[]};var _0x584fcd=_[_0x2a73('0x2b')](db[_0x2a73('0x2c')][_0x2a73('0x2d')],function(_0x4ae40e){return{'name':_0x4ae40e[_0x2a73('0x2e')],'type':_0x4ae40e[_0x2a73('0x2f')][_0x2a73('0x30')]};});_0xf64208[_0x2a73('0x31')]=_[_0x2a73('0x2b')](_0x584fcd,_0x2a73('0x28'));_0xf64208['query']=_[_0x2a73('0x32')](_0x1e2379[_0x2a73('0x33')]);_0xf64208[_0x2a73('0x34')]=_[_0x2a73('0x35')](_0xf64208[_0x2a73('0x31')],_0xf64208[_0x2a73('0x33')]);_0x66a5a2[_0x2a73('0x36')]=_[_0x2a73('0x35')](_0xf64208[_0x2a73('0x31')],qs['fields'](_0x1e2379[_0x2a73('0x33')][_0x2a73('0x37')]));_0x66a5a2[_0x2a73('0x36')]=_0x66a5a2[_0x2a73('0x36')][_0x2a73('0x38')]?_0x66a5a2[_0x2a73('0x36')]:_0xf64208[_0x2a73('0x31')];if(!_0x1e2379['query']['hasOwnProperty']('nolimit')){_0x66a5a2[_0x2a73('0x21')]=qs['limit'](_0x1e2379['query'][_0x2a73('0x21')]);_0x66a5a2[_0x2a73('0x20')]=qs[_0x2a73('0x20')](_0x1e2379[_0x2a73('0x33')][_0x2a73('0x20')]);}_0x66a5a2['order']=qs[_0x2a73('0x39')](_0x1e2379[_0x2a73('0x33')]['sort']);_0x66a5a2[_0x2a73('0x3a')]=qs[_0x2a73('0x34')](_[_0x2a73('0x3b')](_0x1e2379[_0x2a73('0x33')],_0xf64208[_0x2a73('0x34')]),_0x584fcd);if(_0x1e2379[_0x2a73('0x33')]['filter']){_0x66a5a2[_0x2a73('0x3a')]=_[_0x2a73('0x3c')](_0x66a5a2[_0x2a73('0x3a')],{'$or':_['map'](_0x584fcd,function(_0x359434){if(_0x359434[_0x2a73('0x2f')]!==_0x2a73('0x3d')){var _0x1a8a4e={};_0x1a8a4e[_0x359434[_0x2a73('0x28')]]={'$like':'%'+_0x1e2379[_0x2a73('0x33')]['filter']+'%'};return _0x1a8a4e;}})});}_0x66a5a2=_[_0x2a73('0x3c')]({},_0x66a5a2,_0x1e2379[_0x2a73('0x3e')]);var _0x350422={'where':_0x66a5a2[_0x2a73('0x3a')]};return db[_0x2a73('0x2c')][_0x2a73('0x1f')](_0x350422)[_0x2a73('0x24')](function(_0x3edc1d){_0x4ef9af[_0x2a73('0x1f')]=_0x3edc1d;if(_0x1e2379[_0x2a73('0x33')][_0x2a73('0x3f')]){_0x66a5a2[_0x2a73('0x40')]=[{'all':!![]}];}return db[_0x2a73('0x2c')][_0x2a73('0x41')](_0x66a5a2);})[_0x2a73('0x24')](function(_0x46b9e4){_0x4ef9af[_0x2a73('0x42')]=_0x46b9e4;return _0x4ef9af;})[_0x2a73('0x24')](respondWithFilteredResult(_0x451509,_0x66a5a2))[_0x2a73('0x43')](handleError(_0x451509,null));};exports[_0x2a73('0x44')]=function(_0x526f1a,_0x543b77){var _0x309bcf={'raw':!![],'where':{'id':_0x526f1a[_0x2a73('0x45')]['id']}},_0x33af12={};_0x33af12['model']=_[_0x2a73('0x32')](db[_0x2a73('0x2c')]['rawAttributes']);_0x33af12[_0x2a73('0x33')]=_[_0x2a73('0x32')](_0x526f1a[_0x2a73('0x33')]);_0x33af12[_0x2a73('0x34')]=_[_0x2a73('0x35')](_0x33af12[_0x2a73('0x31')],_0x33af12[_0x2a73('0x33')]);_0x309bcf[_0x2a73('0x36')]=_['intersection'](_0x33af12[_0x2a73('0x31')],qs[_0x2a73('0x37')](_0x526f1a[_0x2a73('0x33')][_0x2a73('0x37')]));_0x309bcf[_0x2a73('0x36')]=_0x309bcf[_0x2a73('0x36')][_0x2a73('0x38')]?_0x309bcf[_0x2a73('0x36')]:_0x33af12[_0x2a73('0x31')];if(_0x526f1a[_0x2a73('0x33')][_0x2a73('0x3f')]){_0x309bcf[_0x2a73('0x40')]=[{'all':!![]}];}_0x309bcf=_[_0x2a73('0x3c')]({},_0x309bcf,_0x526f1a[_0x2a73('0x3e')]);return db[_0x2a73('0x2c')]['find'](_0x309bcf)[_0x2a73('0x24')](handleEntityNotFound(_0x543b77,null))['then'](respondWithResult(_0x543b77,null))[_0x2a73('0x43')](handleError(_0x543b77,null));};exports[_0x2a73('0x46')]=function(_0x1e7f92,_0x48a7f9){return db['ChatInternalMessage'][_0x2a73('0x46')](_0x1e7f92[_0x2a73('0x47')],{})[_0x2a73('0x24')](respondWithResult(_0x48a7f9,0xc9))[_0x2a73('0x43')](handleError(_0x48a7f9,null));};exports['update']=function(_0x52c10d,_0x628de0){if(_0x52c10d[_0x2a73('0x47')]['id']){delete _0x52c10d[_0x2a73('0x47')]['id'];}return db[_0x2a73('0x2c')]['find']({'where':{'id':_0x52c10d['params']['id']}})[_0x2a73('0x24')](handleEntityNotFound(_0x628de0,null))[_0x2a73('0x24')](saveUpdates(_0x52c10d[_0x2a73('0x47')],null))[_0x2a73('0x24')](respondWithResult(_0x628de0,null))['catch'](handleError(_0x628de0,null));};exports['destroy']=function(_0x3d209a,_0x2ff0d2){return db[_0x2a73('0x2c')]['find']({'where':{'id':_0x3d209a[_0x2a73('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ff0d2,null))[_0x2a73('0x24')](removeEntity(_0x2ff0d2,null))[_0x2a73('0x43')](handleError(_0x2ff0d2,null));};exports[_0x2a73('0x48')]=function(_0x58cec9,_0x1bfcf9){return db[_0x2a73('0x2c')][_0x2a73('0x48')]()[_0x2a73('0x24')](respondWithResult(_0x1bfcf9,null))[_0x2a73('0x43')](handleError(_0x1bfcf9,null));};function wrapUser(_0x124680){return function(_0x14ae4c){var _0x805175=_0x124680[_0x2a73('0x49')]({'plain':!![]});_0x805175[_0x2a73('0x4a')]=[];if(_0x14ae4c){_0x805175['lastMessageAt']=_0x14ae4c['createdAt'];_0x805175[_0x2a73('0x4b')]=_0x14ae4c;}else{_0x805175[_0x2a73('0x4c')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x805175['lastMessage']={};}return _0x805175;};}exports[_0x2a73('0x4d')]=function(_0x4949ab,_0x5ea110,_0x126d4b){var _0x5dd098=[];return db[_0x2a73('0x4e')][_0x2a73('0x41')]({'where':{'role':[_0x2a73('0x4f'),_0x2a73('0x50'),_0x2a73('0x51')]},'attributes':['id',_0x2a73('0x52'),'name',_0x2a73('0x53'),_0x2a73('0x54'),'internal',_0x2a73('0x55'),_0x2a73('0x56'),_0x2a73('0x57'),_0x2a73('0x58')],'order':qs[_0x2a73('0x39')](_0x2a73('0x59')),'include':[{'model':db['VoiceQueue'],'as':_0x2a73('0x5a'),'attributes':['id',_0x2a73('0x28'),_0x2a73('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0xe45bc7){if(_0xe45bc7){var _0x4fd0c5=_0x4949ab[_0x2a73('0x51')]['get']({'plain':!![]});if(!_0x4fd0c5)throw new Error(_0x2a73('0x5b'));if(_0x4fd0c5[_0x2a73('0x53')]===_0x2a73('0x51')){return db[_0x2a73('0x5c')][_0x2a73('0x5d')]({'where':{'name':_0x2a73('0x5e'),'userProfileId':_0x4fd0c5[_0x2a73('0x5f')]},'raw':!![]})[_0x2a73('0x24')](function(_0x2801c2){if(_0x2801c2){if(_0x2801c2['autoAssociation']===0x0){return db['UserProfileResource'][_0x2a73('0x41')]({'where':{'sectionId':_0x2801c2['id']},'raw':!![]})[_0x2a73('0x24')](function(_0xbd7b45){var _0x236f20=[];if(_['isEmpty'](_0xbd7b45)){_0x236f20=_[_0x2a73('0x60')](_0xe45bc7,function(_0x5368e3){if(_0x5368e3[_0x2a73('0x53')]!==_0x2a73('0x4f')){return _0x5368e3;}});return _0x236f20;}else{for(var _0x4e8738=0x0;_0x4e8738<_0xe45bc7[_0x2a73('0x38')];_0x4e8738++){var _0x4f7f1f=_0xe45bc7[_0x4e8738];if(_0x4f7f1f['role']==='agent'){var _0x517d6f=_[_0x2a73('0x5d')](_0xbd7b45,function(_0x285888){return _0x285888[_0x2a73('0x61')]===_0x4f7f1f['id'];});if(_0x517d6f)_0x236f20[_0x2a73('0x62')](_0x4f7f1f);}else{_0x236f20[_0x2a73('0x62')](_0x4f7f1f);}}return _0x236f20;}});}else{return _0xe45bc7;}}else{var _0x572db1=_[_0x2a73('0x60')](_0xe45bc7,function(_0x37a17e){if(_0x37a17e[_0x2a73('0x53')]!==_0x2a73('0x4f')){return _0x37a17e;}});return _0x572db1;}});}else{return _0xe45bc7;}}})[_0x2a73('0x24')](function(_0x369573){var _0x40db55=[];if(_0x369573){_0x5dd098=_0x369573;for(var _0x1bbf22=0x0;_0x1bbf22<_0x369573[_0x2a73('0x38')];_0x1bbf22+=0x1){_0x5dd098[_0x1bbf22][_0x2a73('0x4a')]=[];_0x40db55['push'](db[_0x2a73('0x2c')][_0x2a73('0x5d')]({'where':{'FromId':[_0x4949ab[_0x2a73('0x51')]['id'],_0x369573[_0x1bbf22]['id']],'ToId':[_0x4949ab[_0x2a73('0x51')]['id'],_0x369573[_0x1bbf22]['id']],'ChatGroupId':null},'attributes':['id',_0x2a73('0x63'),_0x2a73('0x64'),'ToId','read','body'],'order':qs['sort'](_0x2a73('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2a73('0x24')](wrapUser(_0x369573[_0x1bbf22])));}return BPromise[_0x2a73('0x66')](_0x40db55);}return[];})[_0x2a73('0x24')](function(_0x37a60d){return{'rows':_0x37a60d,'count':_0x37a60d['length']};})['then'](respondWithResult(_0x5ea110,null))['catch'](handleError(_0x5ea110,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index fcfe46d..499c785 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 _0xa87e=['hook','exports','events','../../mysqldb','ChatInternalMessage','save','update','remove','emit'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xa87e,0x185));var _0xea87=function(_0x469628,_0x5da725){_0x469628=_0x469628-0x0;var _0x62c76d=_0xa87e[_0x469628];return _0x62c76d;};'use strict';var EventEmitter=require(_0xea87('0x0'));var ChatInternalMessage=require(_0xea87('0x1'))['db'][_0xea87('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea87('0x3'),'afterUpdate':_0xea87('0x4'),'afterDestroy':_0xea87('0x5')};function emitEvent(_0x55c317){return function(_0x28fe92,_0x3c1913,_0x42ca61){ChatInternalMessageEvents[_0xea87('0x6')](_0x55c317+':'+_0x28fe92['id'],_0x28fe92);ChatInternalMessageEvents[_0xea87('0x6')](_0x55c317,_0x28fe92);_0x42ca61(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xea87('0x7')](e,emitEvent(event));}}module[_0xea87('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xeed7=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','ChatInternalMessage'];(function(_0x416f4e,_0x46a4b1){var _0x230028=function(_0x5a17ea){while(--_0x5a17ea){_0x416f4e['push'](_0x416f4e['shift']());}};_0x230028(++_0x46a4b1);}(_0xeed7,0xdf));var _0x7eed=function(_0x16934f,_0x29c3e9){_0x16934f=_0x16934f-0x0;var _0x5ec4b6=_0xeed7[_0x16934f];return _0x5ec4b6;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x7eed('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x7eed('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7eed('0x2'),'afterDestroy':_0x7eed('0x3')};function emitEvent(_0x1c3dc9){return function(_0x207e4b,_0x4d9a25,_0x115c36){ChatInternalMessageEvents[_0x7eed('0x4')](_0x1c3dc9+':'+_0x207e4b['id'],_0x207e4b);ChatInternalMessageEvents['emit'](_0x1c3dc9,_0x207e4b);_0x115c36(null);};}for(var e in events){if(events[_0x7eed('0x5')](e)){var event=events[e];ChatInternalMessage[_0x7eed('0x6')](e,emitEvent(event));}}module[_0x7eed('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f43f869..2bfcba4 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 _0x27e4=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x363643,_0x33f7af){var _0x48b910=function(_0x1da513){while(--_0x1da513){_0x363643['push'](_0x363643['shift']());}};_0x48b910(++_0x33f7af);}(_0x27e4,0x153));var _0x427e=function(_0x79d46c,_0x289444){_0x79d46c=_0x79d46c-0x0;var _0x3f9f4b=_0x27e4[_0x79d46c];return _0x3f9f4b;};'use strict';var _=require(_0x427e('0x0'));var util=require(_0x427e('0x1'));var logger=require('../../config/logger')(_0x427e('0x2'));var moment=require('moment');var BPromise=require(_0x427e('0x3'));var rp=require(_0x427e('0x4'));var fs=require('fs');var path=require(_0x427e('0x5'));var rimraf=require(_0x427e('0x6'));var config=require(_0x427e('0x7'));var attributes=require(_0x427e('0x8'));module['exports']=function(_0x4f032a,_0x289e5b){return _0x4f032a['define'](_0x427e('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x427e('0xa'),'collate':_0x427e('0xb')});}; \ No newline at end of file +var _0x8e82=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x517300,_0x289043){var _0xf21a8c=function(_0x5bcb30){while(--_0x5bcb30){_0x517300['push'](_0x517300['shift']());}};_0xf21a8c(++_0x289043);}(_0x8e82,0x138));var _0x28e8=function(_0x460b6f,_0x31b26b){_0x460b6f=_0x460b6f-0x0;var _0x1e94a4=_0x8e82[_0x460b6f];return _0x1e94a4;};'use strict';var _=require('lodash');var util=require(_0x28e8('0x0'));var logger=require(_0x28e8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x28e8('0x2'));var rp=require(_0x28e8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28e8('0x4'));var config=require(_0x28e8('0x5'));var attributes=require('./chatInternalMessage.attributes');module[_0x28e8('0x6')]=function(_0x54098a,_0x2b4170){return _0x54098a[_0x28e8('0x7')](_0x28e8('0x8'),attributes,{'tableName':_0x28e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x28e8('0xa'),'collate':_0x28e8('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 5694f68..26bd715 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 _0xd11f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x1c8228,_0x15fa1c){var _0x121041=function(_0x3a71c1){while(--_0x3a71c1){_0x1c8228['push'](_0x1c8228['shift']());}};_0x121041(++_0x15fa1c);}(_0xd11f,0xa4));var _0xfd11=function(_0x2ef8c1,_0x2f72f4){_0x2ef8c1=_0x2ef8c1-0x0;var _0x288305=_0xd11f[_0x2ef8c1];return _0x288305;};'use strict';var _=require(_0xfd11('0x0'));var util=require(_0xfd11('0x1'));var moment=require(_0xfd11('0x2'));var BPromise=require(_0xfd11('0x3'));var rs=require(_0xfd11('0x4'));var fs=require('fs');var Redis=require(_0xfd11('0x5'));var db=require(_0xfd11('0x6'))['db'];var utils=require(_0xfd11('0x7'));var logger=require(_0xfd11('0x8'))('rpc');var config=require(_0xfd11('0x9'));var jayson=require(_0xfd11('0xa'));var client=jayson[_0xfd11('0xb')][_0xfd11('0xc')]({'port':0x232a});config[_0xfd11('0xd')]=_[_0xfd11('0xe')](config['redis'],{'host':_0xfd11('0xf'),'port':0x18eb});var socket=require(_0xfd11('0x10'))(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x197797,_0x3754cf,_0x41a9f9){return new BPromise(function(_0x4d9567,_0x431b21){return client[_0xfd11('0x11')](_0x197797,_0x41a9f9)['then'](function(_0x53de22){logger[_0xfd11('0x12')](_0xfd11('0x13'),_0x3754cf,'request\x20sent');logger[_0xfd11('0x14')](_0xfd11('0x15'),_0x3754cf,'request\x20sent',JSON[_0xfd11('0x16')](_0x53de22));if(_0x53de22[_0xfd11('0x17')]){if(_0x53de22[_0xfd11('0x17')]['code']===0x1f4){logger[_0xfd11('0x17')](_0xfd11('0x13'),_0x3754cf,_0x53de22[_0xfd11('0x17')][_0xfd11('0x18')]);return _0x431b21(_0x53de22[_0xfd11('0x17')]['message']);}logger[_0xfd11('0x17')](_0xfd11('0x13'),_0x3754cf,_0x53de22[_0xfd11('0x17')]['message']);return _0x4d9567(_0x53de22[_0xfd11('0x17')][_0xfd11('0x18')]);}else{logger[_0xfd11('0x12')](_0xfd11('0x13'),_0x3754cf,_0xfd11('0x19'));_0x4d9567(_0x53de22[_0xfd11('0x1a')][_0xfd11('0x18')]);}})[_0xfd11('0x1b')](function(_0x445457){logger[_0xfd11('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x3754cf,_0x445457);_0x431b21(_0x445457);});});} \ No newline at end of file +var _0x200b=['error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x200b,0x130));var _0xb200=function(_0x4db899,_0x171096){_0x4db899=_0x4db899-0x0;var _0x50b063=_0x200b[_0x4db899];return _0x50b063;};'use strict';var _=require(_0xb200('0x0'));var util=require(_0xb200('0x1'));var moment=require(_0xb200('0x2'));var BPromise=require(_0xb200('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb200('0x4'));var db=require(_0xb200('0x5'))['db'];var utils=require(_0xb200('0x6'));var logger=require(_0xb200('0x7'))('rpc');var config=require(_0xb200('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb200('0x9')]['http']({'port':0x232a});config[_0xb200('0xa')]=_[_0xb200('0xb')](config[_0xb200('0xa')],{'host':_0xb200('0xc'),'port':0x18eb});var socket=require(_0xb200('0xd'))(new Redis(config[_0xb200('0xa')]));require(_0xb200('0xe'))[_0xb200('0xf')](socket);function respondWithRpcPromise(_0x5110ac,_0x1ed597,_0x3cf740){return new BPromise(function(_0x2bb34b,_0xb987bf){return client[_0xb200('0x10')](_0x5110ac,_0x3cf740)[_0xb200('0x11')](function(_0x30d761){logger[_0xb200('0x12')](_0xb200('0x13'),_0x1ed597,_0xb200('0x14'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1ed597,_0xb200('0x14'),JSON['stringify'](_0x30d761));if(_0x30d761[_0xb200('0x15')]){if(_0x30d761[_0xb200('0x15')][_0xb200('0x16')]===0x1f4){logger[_0xb200('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x1ed597,_0x30d761[_0xb200('0x15')][_0xb200('0x17')]);return _0xb987bf(_0x30d761[_0xb200('0x15')][_0xb200('0x17')]);}logger['error'](_0xb200('0x13'),_0x1ed597,_0x30d761[_0xb200('0x15')][_0xb200('0x17')]);return _0x2bb34b(_0x30d761[_0xb200('0x15')][_0xb200('0x17')]);}else{logger[_0xb200('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x1ed597,_0xb200('0x14'));_0x2bb34b(_0x30d761['result']['message']);}})[_0xb200('0x18')](function(_0x5cbe5c){logger[_0xb200('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x1ed597,_0x5cbe5c);_0xb987bf(_0x5cbe5c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 851f88c..4cd40b1 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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x4c2fad,_0x1eb609){_0x4c2fad=_0x4c2fad-0x0;var _0x1a4825=_0x0eaa[_0x4c2fad];return _0x1a4825;};'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 _0x4fdb=['removeListener','length','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x427bc1,_0x46698c){var _0x293edc=function(_0x86f7f7){while(--_0x86f7f7){_0x427bc1['push'](_0x427bc1['shift']());}};_0x293edc(++_0x46698c);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x13d2c6,_0x153b0d){_0x13d2c6=_0x13d2c6-0x0;var _0x2cc37b=_0x4fdb[_0x13d2c6];return _0x2cc37b;};'use strict';var ChatInternalMessageEvents=require(_0xb4fd('0x0'));var events=[_0xb4fd('0x1'),_0xb4fd('0x2'),_0xb4fd('0x3')];function createListener(_0x3b399e,_0xafe34b){return function(_0x260a35){_0xafe34b[_0xb4fd('0x4')](_0x3b399e,_0x260a35);};}function removeListener(_0x1c0b08,_0x5b73bb){return function(){ChatInternalMessageEvents[_0xb4fd('0x5')](_0x1c0b08,_0x5b73bb);};}exports['register']=function(_0x14052b){for(var _0x5d8b39=0x0,_0x53273f=events[_0xb4fd('0x6')];_0x5d8b39<_0x53273f;_0x5d8b39++){var _0x3af8e3=events[_0x5d8b39];var _0x1151b5=createListener('chatInternalMessage:'+_0x3af8e3,_0x14052b);ChatInternalMessageEvents['on'](_0x3af8e3,_0x1151b5);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 89bd955..3952617 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 _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x3ea9c4,_0x6891a4){var _0x36e3da=function(_0x3a2502){while(--_0x3a2502){_0x3ea9c4['push'](_0x3ea9c4['shift']());}};_0x36e3da(++_0x6891a4);}(_0xe706,0xa3));var _0x6e70=function(_0x209cc0,_0x59bb37){_0x209cc0=_0x209cc0-0x0;var _0x3c5029=_0xe706[_0x209cc0];return _0x3c5029;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['put']('/:id',controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);module[_0x6e70('0x17')]=router; \ No newline at end of file +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(_0x11d2c3,_0xf37ded){var _0x350ae1=function(_0xc6f67c){while(--_0xc6f67c){_0x11d2c3['push'](_0x11d2c3['shift']());}};_0x350ae1(++_0xf37ded);}(_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 diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 99c2fe2..9df10cf 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 _0xfa7b=['sequelize','TEXT','medium','BOOLEAN','DATE'];(function(_0x3b2e0a,_0x49a3f9){var _0x4a84bd=function(_0x3aa487){while(--_0x3aa487){_0x3b2e0a['push'](_0x3b2e0a['shift']());}};_0x4a84bd(++_0x49a3f9);}(_0xfa7b,0x15e));var _0xbfa7=function(_0x34264f,_0x203e13){_0x34264f=_0x34264f-0x0;var _0xeb8135=_0xfa7b[_0x34264f];return _0xeb8135;};'use strict';var Sequelize=require(_0xbfa7('0x0'));module['exports']={'body':{'type':Sequelize[_0xbfa7('0x1')](_0xbfa7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbfa7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfa7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xbfa7('0x4')]}}; \ No newline at end of file +var _0x42df=['BOOLEAN','out','DATE','exports','TEXT','medium'];(function(_0x5cc81b,_0x178c2b){var _0x20a130=function(_0x4242b3){while(--_0x4242b3){_0x5cc81b['push'](_0x5cc81b['shift']());}};_0x20a130(++_0x178c2b);}(_0x42df,0x1dd));var _0xf42d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x42df[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module[_0xf42d('0x0')]={'body':{'type':Sequelize[_0xf42d('0x1')](_0xf42d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf42d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf42d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf42d('0x4')),'defaultValue':_0xf42d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf42d('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 419895b..f605560 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 _0x435b=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','localhost','register','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','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','map','ChatMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','include','findAll','show','params','fields','find','create','body','update','../../config/logger','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','EventManager','parse','formData','agent','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0xca1091,_0x539dbf){var _0xd3019c=function(_0xd629e0){while(--_0xd629e0){_0xca1091['push'](_0xca1091['shift']());}};_0xd3019c(++_0x539dbf);}(_0x435b,0x15a));var _0xb435=function(_0x257742,_0x65f38a){_0x257742=_0x257742-0x0;var _0x57583a=_0x435b[_0x257742];return _0x57583a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb435('0x0'));var zipdir=require(_0xb435('0x1'));var jsonpatch=require(_0xb435('0x2'));var rp=require(_0xb435('0x3'));var moment=require(_0xb435('0x4'));var BPromise=require(_0xb435('0x5'));var Mustache=require('mustache');var util=require(_0xb435('0x6'));var path=require(_0xb435('0x7'));var sox=require(_0xb435('0x8'));var csv=require(_0xb435('0x9'));var ejs=require(_0xb435('0xa'));var fs=require('fs');var _=require(_0xb435('0xb'));var squel=require(_0xb435('0xc'));var crypto=require(_0xb435('0xd'));var jsforce=require(_0xb435('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb435('0x9'));var querystring=require(_0xb435('0xf'));var Papa=require(_0xb435('0x10'));var Redis=require(_0xb435('0x11'));var authService=require(_0xb435('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb435('0x13'));var hardwareService=require(_0xb435('0x14'));var logger=require('../../config/logger')(_0xb435('0x15'));var utils=require(_0xb435('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb435('0x17')]=_['defaults'](config[_0xb435('0x17')],{'host':_0xb435('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')[_0xb435('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb435('0x1a')][_0xb435('0x1b')]({'port':0x232c});var client9002=jayson[_0xb435('0x1a')][_0xb435('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5423d1,_0x6b0c28,_0x376c77){if(_0x376c77){var _0x234c30=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x234c30[_0xb435('0x1c')](_0x6b0c28)){return _0x5423d1;}else{throw new db[(_0xb435('0x1d'))][(_0xb435('0x1e'))](_0xb435('0x1f'));}}else{return _0x5423d1;}}function respondWithRpcPromise(_0x5ca572,_0x4836d5,_0x5505af,_0x4b2d5c){return new BPromise(function(_0x47a521,_0x1ffa00){var _0x5f095d=_0x4b2d5c||client;return _0x5f095d[_0xb435('0x20')](_0x5ca572,_0x5505af)[_0xb435('0x21')](function(_0x57d95b){logger['info'](_0xb435('0x22'),_0x4836d5,_0xb435('0x23'));logger[_0xb435('0x24')](_0xb435('0x25'),_0x4836d5,_0xb435('0x23'),JSON[_0xb435('0x26')](_0x57d95b));if(_0x57d95b['error']){if(_0x57d95b[_0xb435('0x27')][_0xb435('0x28')]===0x1f4){logger[_0xb435('0x27')]('ChatMessage,\x20%s,\x20%s',_0x4836d5,_0x57d95b[_0xb435('0x27')][_0xb435('0x29')]);return _0x1ffa00(_0x57d95b[_0xb435('0x27')]['message']);}logger[_0xb435('0x27')]('ChatMessage,\x20%s,\x20%s',_0x4836d5,_0x57d95b[_0xb435('0x27')][_0xb435('0x29')]);return _0x47a521(_0x57d95b[_0xb435('0x27')][_0xb435('0x29')]);}else{logger[_0xb435('0x2a')](_0xb435('0x22'),_0x4836d5,'request\x20sent');_0x47a521(_0x57d95b[_0xb435('0x2b')][_0xb435('0x29')]);}})[_0xb435('0x2c')](function(_0x2ee704){logger['error'](_0xb435('0x22'),_0x4836d5,_0x2ee704);_0x1ffa00(_0x2ee704);});});}function respondWithStatusCode(_0x1b022d,_0x44040b){_0x44040b=_0x44040b||0xcc;return function(_0x28272a){if(_0x28272a){return _0x1b022d[_0xb435('0x2d')](_0x44040b);}return _0x1b022d[_0xb435('0x2e')](_0x44040b)[_0xb435('0x2f')]();};}function respondWithResult(_0x41be87,_0x1a1090){_0x1a1090=_0x1a1090||0xc8;return function(_0x2c8766){if(_0x2c8766){return _0x41be87['status'](_0x1a1090)[_0xb435('0x30')](_0x2c8766);}};}function respondWithFilteredResult(_0x50b51b,_0x3b75d5){return function(_0x5ad3d1){if(_0x5ad3d1){var _0x3525e5=_0x5ad3d1[_0xb435('0x31')],_0x44321f=_0x3b75d5[_0xb435('0x32')],_0x38243b=_0x3b75d5[_0xb435('0x32')]+_0x3b75d5[_0xb435('0x33')],_0x18d5ad;if(_0x38243b>=_0x3525e5){_0x38243b=_0x3525e5;_0x18d5ad=0xc8;}else{_0x18d5ad=0xce;}_0x50b51b[_0xb435('0x2e')](_0x18d5ad);return _0x50b51b[_0xb435('0x34')](_0xb435('0x35'),_0x44321f+'-'+_0x38243b+'/'+_0x3525e5)['json'](_0x5ad3d1);}return null;};}function patchUpdates(_0x5a5d04){return function(_0x52716f){try{jsonpatch['apply'](_0x52716f,_0x5a5d04,!![]);}catch(_0x363b1e){return BPromise[_0xb435('0x36')](_0x363b1e);}return _0x52716f[_0xb435('0x37')]();};}function saveUpdates(_0x1a7fbd,_0x48e3af){return function(_0x50d98){if(_0x50d98){return _0x50d98['update'](_0x1a7fbd)[_0xb435('0x21')](function(_0x529d1e){return _0x529d1e;});}return null;};}function removeEntity(_0xad957d,_0xd8c93a){return function(_0x1c84f2){if(_0x1c84f2){return _0x1c84f2[_0xb435('0x38')]()[_0xb435('0x21')](function(){_0xad957d[_0xb435('0x2e')](0xcc)[_0xb435('0x2f')]();});}};}function handleEntityNotFound(_0x51e5eb,_0xb9138){return function(_0x194dae){if(!_0x194dae){_0x51e5eb[_0xb435('0x2d')](0x194);}return _0x194dae;};}function handleError(_0x5331cc,_0xb1bf24){_0xb1bf24=_0xb1bf24||0x1f4;return function(_0x276ba9){logger[_0xb435('0x27')](_0x276ba9[_0xb435('0x39')]);if(_0x276ba9[_0xb435('0x3a')]){delete _0x276ba9['name'];}_0x5331cc[_0xb435('0x2e')](_0xb1bf24)['send'](_0x276ba9);};}exports['index']=function(_0x493591,_0x2015d4){var _0x5106ce={},_0x3dd594={},_0x5e38f2={'count':0x0,'rows':[]};var _0x24094f=_[_0xb435('0x3b')](db[_0xb435('0x3c')][_0xb435('0x3d')],function(_0x149f14){return{'name':_0x149f14[_0xb435('0x3e')],'type':_0x149f14[_0xb435('0x3f')]['key']};});_0x3dd594[_0xb435('0x40')]=_['map'](_0x24094f,'name');_0x3dd594[_0xb435('0x41')]=_[_0xb435('0x42')](_0x493591['query']);_0x3dd594[_0xb435('0x43')]=_[_0xb435('0x44')](_0x3dd594[_0xb435('0x40')],_0x3dd594[_0xb435('0x41')]);_0x5106ce['attributes']=_[_0xb435('0x44')](_0x3dd594[_0xb435('0x40')],qs['fields'](_0x493591[_0xb435('0x41')]['fields']));_0x5106ce[_0xb435('0x45')]=_0x5106ce[_0xb435('0x45')][_0xb435('0x46')]?_0x5106ce[_0xb435('0x45')]:_0x3dd594[_0xb435('0x40')];if(!_0x493591[_0xb435('0x41')][_0xb435('0x47')](_0xb435('0x48'))){_0x5106ce[_0xb435('0x33')]=qs[_0xb435('0x33')](_0x493591['query'][_0xb435('0x33')]);_0x5106ce[_0xb435('0x32')]=qs[_0xb435('0x32')](_0x493591[_0xb435('0x41')]['offset']);}_0x5106ce[_0xb435('0x49')]=qs[_0xb435('0x4a')](_0x493591[_0xb435('0x41')][_0xb435('0x4a')]);_0x5106ce[_0xb435('0x4b')]=qs[_0xb435('0x43')](_['pick'](_0x493591['query'],_0x3dd594[_0xb435('0x43')]),_0x24094f);if(_0x493591['query']['filter']){_0x5106ce[_0xb435('0x4b')]=_[_0xb435('0x4c')](_0x5106ce[_0xb435('0x4b')],{'$or':_[_0xb435('0x3b')](_0x24094f,function(_0xfcdcc6){if(_0xfcdcc6[_0xb435('0x3f')]!=='VIRTUAL'){var _0x5944a9={};_0x5944a9[_0xfcdcc6[_0xb435('0x3a')]]={'$like':'%'+_0x493591[_0xb435('0x41')][_0xb435('0x4d')]+'%'};return _0x5944a9;}})});}_0x5106ce=_['merge']({},_0x5106ce,_0x493591[_0xb435('0x4e')]);var _0xe45e64={'where':_0x5106ce['where']};return db[_0xb435('0x3c')][_0xb435('0x31')](_0xe45e64)[_0xb435('0x21')](function(_0x107b79){_0x5e38f2['count']=_0x107b79;if(_0x493591[_0xb435('0x41')]['includeAll']){_0x5106ce[_0xb435('0x4f')]=[{'all':!![]}];}return db[_0xb435('0x3c')][_0xb435('0x50')](_0x5106ce);})['then'](function(_0x2d8fab){_0x5e38f2['rows']=_0x2d8fab;return _0x5e38f2;})[_0xb435('0x21')](respondWithFilteredResult(_0x2015d4,_0x5106ce))[_0xb435('0x2c')](handleError(_0x2015d4,null));};exports[_0xb435('0x51')]=function(_0x5dc4b7,_0x3efb7d){var _0x56f68a={'raw':!![],'where':{'id':_0x5dc4b7[_0xb435('0x52')]['id']}},_0x13c229={};_0x13c229['model']=_[_0xb435('0x42')](db['ChatMessage'][_0xb435('0x3d')]);_0x13c229[_0xb435('0x41')]=_[_0xb435('0x42')](_0x5dc4b7[_0xb435('0x41')]);_0x13c229[_0xb435('0x43')]=_[_0xb435('0x44')](_0x13c229[_0xb435('0x40')],_0x13c229[_0xb435('0x41')]);_0x56f68a[_0xb435('0x45')]=_['intersection'](_0x13c229[_0xb435('0x40')],qs[_0xb435('0x53')](_0x5dc4b7[_0xb435('0x41')][_0xb435('0x53')]));_0x56f68a[_0xb435('0x45')]=_0x56f68a[_0xb435('0x45')][_0xb435('0x46')]?_0x56f68a[_0xb435('0x45')]:_0x13c229[_0xb435('0x40')];if(_0x5dc4b7[_0xb435('0x41')]['includeAll']){_0x56f68a[_0xb435('0x4f')]=[{'all':!![]}];}_0x56f68a=_[_0xb435('0x4c')]({},_0x56f68a,_0x5dc4b7[_0xb435('0x4e')]);return db[_0xb435('0x3c')][_0xb435('0x54')](_0x56f68a)['then'](handleEntityNotFound(_0x3efb7d,null))[_0xb435('0x21')](respondWithResult(_0x3efb7d,null))[_0xb435('0x2c')](handleError(_0x3efb7d,null));};exports[_0xb435('0x55')]=function(_0x1298aa,_0x131a5f){return db[_0xb435('0x3c')][_0xb435('0x55')](_0x1298aa[_0xb435('0x56')],{})[_0xb435('0x21')](respondWithResult(_0x131a5f,0xc9))[_0xb435('0x2c')](handleError(_0x131a5f,null));};exports[_0xb435('0x57')]=function(_0x16da65,_0x2aa774){if(_0x16da65[_0xb435('0x56')]['id']){delete _0x16da65[_0xb435('0x56')]['id'];}return db[_0xb435('0x3c')][_0xb435('0x54')]({'where':{'id':_0x16da65[_0xb435('0x52')]['id']}})['then'](handleEntityNotFound(_0x2aa774,null))['then'](saveUpdates(_0x16da65[_0xb435('0x56')],null))['then'](respondWithResult(_0x2aa774,null))[_0xb435('0x2c')](handleError(_0x2aa774,null));};exports[_0xb435('0x38')]=function(_0x34a0d1,_0x3c41bb){return db[_0xb435('0x3c')][_0xb435('0x54')]({'where':{'id':_0x34a0d1[_0xb435('0x52')]['id']}})[_0xb435('0x21')](handleEntityNotFound(_0x3c41bb,null))[_0xb435('0x21')](removeEntity(_0x3c41bb,null))[_0xb435('0x2c')](handleError(_0x3c41bb,null));};exports['describe']=function(_0x439fa8,_0x52d80a){return db[_0xb435('0x3c')]['describe']()[_0xb435('0x21')](respondWithResult(_0x52d80a,null))['catch'](handleError(_0x52d80a,null));};var interaction_log=require(_0xb435('0x58'))(_0xb435('0x59'));exports[_0xb435('0x5a')]=function(_0x100fdd,_0x53e5ab,_0x3180af){var _0x3a5809={'channel':_0xb435('0x5b')};if(_0x100fdd[_0xb435('0x56')]['id']){delete _0x100fdd[_0xb435('0x56')]['id'];}_0x100fdd[_0xb435('0x56')][_0xb435('0x5c')]=!![];_0x100fdd[_0xb435('0x56')][_0xb435('0x5d')]=moment()[_0xb435('0x5e')](_0xb435('0x5f'));_0x100fdd[_0xb435('0x56')]['UserId']=_0x100fdd[_0xb435('0x56')][_0xb435('0x60')]||_0x100fdd[_0xb435('0x61')]['id'];return db[_0xb435('0x3c')]['find']({'where':{'id':_0x100fdd[_0xb435('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xb435('0x62')],'as':_0xb435('0x63')}]})[_0xb435('0x21')](handleEntityNotFound(_0x53e5ab,null))['then'](saveUpdates(_0x100fdd[_0xb435('0x56')],null))['then'](function(_0xb9a20c){if(_0xb9a20c){_0x3a5809['message']=_0xb9a20c[_0xb435('0x64')]({'plain':!![]});return db[_0xb435('0x65')][_0xb435('0x54')]({'where':{'id':_0xb9a20c[_0xb435('0x66')]}});}return null;})[_0xb435('0x21')](handleEntityNotFound(_0x53e5ab,null))[_0xb435('0x21')](function(_0x29a31b){if(_0x29a31b){return _0x29a31b['update']({'UserId':_0x100fdd[_0xb435('0x56')]['UserId'],'read1stAt':_[_0xb435('0x67')](_0x29a31b[_0xb435('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x371d8c){if(_0x371d8c){_0x3a5809[_0xb435('0x69')]=_0x371d8c[_0xb435('0x64')]({'plain':!![]});interaction_log['info'](_0xb435('0x6a'),_0x100fdd[_0xb435('0x61')]['id'],_0x100fdd[_0xb435('0x61')]['name'],_0x100fdd[_0xb435('0x61')][_0xb435('0x6b')],_0x3a5809[_0xb435('0x69')]['id'],_0x100fdd['body']?JSON[_0xb435('0x26')](_0x100fdd[_0xb435('0x56')]):_0xb435('0x6c'));return respondWithRpcPromise(_0xb435('0x6d'),_0xb435('0x6e'),_0x3a5809);}return null;})['then'](function(_0x166b42){if(_0x166b42){if(_0x100fdd[_0xb435('0x56')]['manual']){_0x3a5809[_0xb435('0x29')][_0xb435('0x6f')]=util[_0xb435('0x5e')](_0xb435('0x70'),_0x100fdd[_0xb435('0x61')][_0xb435('0x3a')]);_0x3a5809['message'][_0xb435('0x71')]=_0x3a5809[_0xb435('0x71')];_0x3a5809[_0xb435('0x29')]['event']=_0xb435('0x5a');return respondWithRpcPromise(_0xb435('0x72'),_0xb435('0x72'),{'event':'acceptmessage','message':_[_0xb435('0x4c')](_0x3a5809[_0xb435('0x29')],JSON[_0xb435('0x73')](_0x3a5809[_0xb435('0x69')][_0xb435('0x74')]))},client9002)['then'](function(){return _0x3a5809;});}return _0x3a5809;}return null;})['then'](respondWithResult(_0x53e5ab,null))[_0xb435('0x2c')](handleError(_0x53e5ab,null));};var interaction_log=require(_0xb435('0x58'))(_0xb435('0x59'));exports[_0xb435('0x36')]=function(_0x2fef16,_0x13337a,_0x460f44){var _0x5cf2ba={'agent':{},'channel':'chat'};if(_0x2fef16[_0xb435('0x56')]['id']){delete _0x2fef16[_0xb435('0x56')]['id'];}_0x2fef16[_0xb435('0x56')][_0xb435('0x60')]=_0x2fef16[_0xb435('0x56')][_0xb435('0x60')]||_0x2fef16[_0xb435('0x61')]['id'];_0x5cf2ba[_0xb435('0x75')]['id']=_0x2fef16[_0xb435('0x56')]['UserId'];return db[_0xb435('0x3c')][_0xb435('0x54')]({'where':{'id':_0x2fef16[_0xb435('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x13337a,null))[_0xb435('0x21')](function(_0x210d5d){if(_0x210d5d){_0x5cf2ba[_0xb435('0x29')]=_0x210d5d[_0xb435('0x64')]({'plain':!![]});return db[_0xb435('0x65')]['find']({'where':{'id':_0x210d5d[_0xb435('0x66')]}});}return null;})[_0xb435('0x21')](handleEntityNotFound(_0x13337a,null))[_0xb435('0x21')](function(_0x42e837){if(_0x42e837){_0x5cf2ba[_0xb435('0x69')]=_0x42e837[_0xb435('0x64')]({'plain':!![]});interaction_log[_0xb435('0x2a')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2fef16['user']['id'],_0x2fef16[_0xb435('0x61')][_0xb435('0x3a')],_0x2fef16[_0xb435('0x61')][_0xb435('0x6b')],_0x5cf2ba['interaction']['id'],_0x2fef16[_0xb435('0x56')]?JSON[_0xb435('0x26')](_0x2fef16[_0xb435('0x56')]):_0xb435('0x6c'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5cf2ba);}return null;})[_0xb435('0x21')](function(_0x3bf5c0){if(_0x3bf5c0){_0x3bf5c0[_0xb435('0x29')][_0xb435('0x6f')]=util['format'](_0xb435('0x70'),_0x2fef16[_0xb435('0x61')]['name']);_0x3bf5c0[_0xb435('0x29')][_0xb435('0x71')]=_0x5cf2ba['channel'];_0x3bf5c0[_0xb435('0x29')]['event']=_0xb435('0x36');respondWithRpcPromise(_0xb435('0x72'),_0xb435('0x72'),{'event':'rejectmessage','message':_0x3bf5c0['message']},client9002);return _0x5cf2ba;}return null;})[_0xb435('0x21')](respondWithResult(_0x13337a,null))[_0xb435('0x2c')](handleError(_0x13337a,null));}; \ No newline at end of file +var _0x8915=['chat-interactions','agent','RejectMessage','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','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','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','params','options','find','create','body','catch','update','describe','../../config/logger','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','role','null','acceptMessage','interface','channel','event','EventManager','acceptmessage','parse'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x8915,0x82));var _0x5891=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x8915[_0xbf8ebe];return _0x1e25e8;};'use strict';var pdf=require(_0x5891('0x0'));var emlformat=require(_0x5891('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5891('0x2'));var jsonpatch=require(_0x5891('0x3'));var rp=require(_0x5891('0x4'));var moment=require('moment');var BPromise=require(_0x5891('0x5'));var Mustache=require(_0x5891('0x6'));var util=require(_0x5891('0x7'));var path=require(_0x5891('0x8'));var sox=require(_0x5891('0x9'));var csv=require(_0x5891('0xa'));var ejs=require(_0x5891('0xb'));var fs=require('fs');var _=require(_0x5891('0xc'));var squel=require(_0x5891('0xd'));var crypto=require(_0x5891('0xe'));var jsforce=require(_0x5891('0xf'));var deskjs=require(_0x5891('0x10'));var toCsv=require(_0x5891('0xa'));var querystring=require('querystring');var Papa=require(_0x5891('0x11'));var Redis=require(_0x5891('0x12'));var authService=require(_0x5891('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5891('0x14'));var hardwareService=require(_0x5891('0x15'));var logger=require('../../config/logger')(_0x5891('0x16'));var utils=require(_0x5891('0x17'));var config=require(_0x5891('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5891('0x19')](config[_0x5891('0x1a')],{'host':_0x5891('0x1b'),'port':0x18eb});var socket=require(_0x5891('0x1c'))(new Redis(config[_0x5891('0x1a')]));require(_0x5891('0x1d'))[_0x5891('0x1e')](socket);var jayson=require(_0x5891('0x1f'));var client=jayson[_0x5891('0x20')][_0x5891('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x5891('0x21')]({'port':0x232a});function checkPasswordPattern(_0x136f95,_0x4792e1,_0x4d00ac){if(_0x4d00ac){var _0x284419=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x284419[_0x5891('0x22')](_0x4792e1)){return _0x136f95;}else{throw new db['Sequelize']['ValidationError'](_0x5891('0x23'));}}else{return _0x136f95;}}function respondWithRpcPromise(_0x275ccf,_0x260691,_0x47d327,_0x2568ee){return new BPromise(function(_0x13b16b,_0x1cbb44){var _0x2561d5=_0x2568ee||client;return _0x2561d5[_0x5891('0x24')](_0x275ccf,_0x47d327)[_0x5891('0x25')](function(_0x1f1b5d){logger['info'](_0x5891('0x26'),_0x260691,_0x5891('0x27'));logger[_0x5891('0x28')](_0x5891('0x29'),_0x260691,_0x5891('0x27'),JSON[_0x5891('0x2a')](_0x1f1b5d));if(_0x1f1b5d[_0x5891('0x2b')]){if(_0x1f1b5d['error'][_0x5891('0x2c')]===0x1f4){logger['error'](_0x5891('0x26'),_0x260691,_0x1f1b5d[_0x5891('0x2b')]['message']);return _0x1cbb44(_0x1f1b5d[_0x5891('0x2b')][_0x5891('0x2d')]);}logger[_0x5891('0x2b')]('ChatMessage,\x20%s,\x20%s',_0x260691,_0x1f1b5d[_0x5891('0x2b')][_0x5891('0x2d')]);return _0x13b16b(_0x1f1b5d[_0x5891('0x2b')]['message']);}else{logger[_0x5891('0x2e')](_0x5891('0x26'),_0x260691,_0x5891('0x27'));_0x13b16b(_0x1f1b5d['result'][_0x5891('0x2d')]);}})['catch'](function(_0x266c5f){logger['error'](_0x5891('0x26'),_0x260691,_0x266c5f);_0x1cbb44(_0x266c5f);});});}function respondWithStatusCode(_0x22601b,_0x4b95ec){_0x4b95ec=_0x4b95ec||0xcc;return function(_0x975a29){if(_0x975a29){return _0x22601b['sendStatus'](_0x4b95ec);}return _0x22601b[_0x5891('0x2f')](_0x4b95ec)[_0x5891('0x30')]();};}function respondWithResult(_0x4ec83b,_0x251c52){_0x251c52=_0x251c52||0xc8;return function(_0x1d1c4a){if(_0x1d1c4a){return _0x4ec83b[_0x5891('0x2f')](_0x251c52)[_0x5891('0x31')](_0x1d1c4a);}};}function respondWithFilteredResult(_0x2b791b,_0x82437d){return function(_0x36b6a1){if(_0x36b6a1){var _0x5e883b=_0x36b6a1[_0x5891('0x32')],_0x5dd374=_0x82437d[_0x5891('0x33')],_0x295a35=_0x82437d['offset']+_0x82437d['limit'],_0x487ab6;if(_0x295a35>=_0x5e883b){_0x295a35=_0x5e883b;_0x487ab6=0xc8;}else{_0x487ab6=0xce;}_0x2b791b[_0x5891('0x2f')](_0x487ab6);return _0x2b791b[_0x5891('0x34')](_0x5891('0x35'),_0x5dd374+'-'+_0x295a35+'/'+_0x5e883b)[_0x5891('0x31')](_0x36b6a1);}return null;};}function patchUpdates(_0x12d3ad){return function(_0x3da86b){try{jsonpatch[_0x5891('0x36')](_0x3da86b,_0x12d3ad,!![]);}catch(_0x370882){return BPromise[_0x5891('0x37')](_0x370882);}return _0x3da86b[_0x5891('0x38')]();};}function saveUpdates(_0x240950,_0x4c4c85){return function(_0x5db7cd){if(_0x5db7cd){return _0x5db7cd['update'](_0x240950)[_0x5891('0x25')](function(_0x4e64d6){return _0x4e64d6;});}return null;};}function removeEntity(_0x42e399,_0x349081){return function(_0x6c95b9){if(_0x6c95b9){return _0x6c95b9[_0x5891('0x39')]()[_0x5891('0x25')](function(){_0x42e399[_0x5891('0x2f')](0xcc)[_0x5891('0x30')]();});}};}function handleEntityNotFound(_0x31ad98,_0x3c7cf7){return function(_0x30dd7b){if(!_0x30dd7b){_0x31ad98['sendStatus'](0x194);}return _0x30dd7b;};}function handleError(_0x514e01,_0x5519cc){_0x5519cc=_0x5519cc||0x1f4;return function(_0x2b3183){logger['error'](_0x2b3183[_0x5891('0x3a')]);if(_0x2b3183['name']){delete _0x2b3183[_0x5891('0x3b')];}_0x514e01[_0x5891('0x2f')](_0x5519cc)[_0x5891('0x3c')](_0x2b3183);};}exports[_0x5891('0x3d')]=function(_0x599def,_0x387744){var _0x4cc7cd={},_0x3ae0c0={},_0x19d543={'count':0x0,'rows':[]};var _0x376021=_[_0x5891('0x3e')](db[_0x5891('0x3f')][_0x5891('0x40')],function(_0x1c8f93){return{'name':_0x1c8f93['fieldName'],'type':_0x1c8f93[_0x5891('0x41')][_0x5891('0x42')]};});_0x3ae0c0[_0x5891('0x43')]=_[_0x5891('0x3e')](_0x376021,_0x5891('0x3b'));_0x3ae0c0[_0x5891('0x44')]=_[_0x5891('0x45')](_0x599def[_0x5891('0x44')]);_0x3ae0c0[_0x5891('0x46')]=_[_0x5891('0x47')](_0x3ae0c0[_0x5891('0x43')],_0x3ae0c0[_0x5891('0x44')]);_0x4cc7cd['attributes']=_[_0x5891('0x47')](_0x3ae0c0[_0x5891('0x43')],qs['fields'](_0x599def[_0x5891('0x44')][_0x5891('0x48')]));_0x4cc7cd['attributes']=_0x4cc7cd[_0x5891('0x49')][_0x5891('0x4a')]?_0x4cc7cd[_0x5891('0x49')]:_0x3ae0c0[_0x5891('0x43')];if(!_0x599def[_0x5891('0x44')][_0x5891('0x4b')]('nolimit')){_0x4cc7cd[_0x5891('0x4c')]=qs[_0x5891('0x4c')](_0x599def[_0x5891('0x44')][_0x5891('0x4c')]);_0x4cc7cd[_0x5891('0x33')]=qs[_0x5891('0x33')](_0x599def[_0x5891('0x44')]['offset']);}_0x4cc7cd['order']=qs[_0x5891('0x4d')](_0x599def[_0x5891('0x44')][_0x5891('0x4d')]);_0x4cc7cd['where']=qs[_0x5891('0x46')](_[_0x5891('0x4e')](_0x599def[_0x5891('0x44')],_0x3ae0c0[_0x5891('0x46')]),_0x376021);if(_0x599def['query'][_0x5891('0x4f')]){_0x4cc7cd[_0x5891('0x50')]=_[_0x5891('0x51')](_0x4cc7cd['where'],{'$or':_['map'](_0x376021,function(_0x2b10dc){if(_0x2b10dc[_0x5891('0x41')]!==_0x5891('0x52')){var _0xbdaf57={};_0xbdaf57[_0x2b10dc['name']]={'$like':'%'+_0x599def['query']['filter']+'%'};return _0xbdaf57;}})});}_0x4cc7cd=_[_0x5891('0x51')]({},_0x4cc7cd,_0x599def['options']);var _0x4bf951={'where':_0x4cc7cd[_0x5891('0x50')]};return db['ChatMessage'][_0x5891('0x32')](_0x4bf951)[_0x5891('0x25')](function(_0x33ecb7){_0x19d543[_0x5891('0x32')]=_0x33ecb7;if(_0x599def['query'][_0x5891('0x53')]){_0x4cc7cd[_0x5891('0x54')]=[{'all':!![]}];}return db[_0x5891('0x3f')][_0x5891('0x55')](_0x4cc7cd);})['then'](function(_0x4ce59b){_0x19d543['rows']=_0x4ce59b;return _0x19d543;})['then'](respondWithFilteredResult(_0x387744,_0x4cc7cd))['catch'](handleError(_0x387744,null));};exports['show']=function(_0x2ecdb0,_0x3867c4){var _0x16a139={'raw':!![],'where':{'id':_0x2ecdb0[_0x5891('0x56')]['id']}},_0x73373d={};_0x73373d['model']=_[_0x5891('0x45')](db['ChatMessage']['rawAttributes']);_0x73373d[_0x5891('0x44')]=_[_0x5891('0x45')](_0x2ecdb0[_0x5891('0x44')]);_0x73373d[_0x5891('0x46')]=_[_0x5891('0x47')](_0x73373d['model'],_0x73373d[_0x5891('0x44')]);_0x16a139[_0x5891('0x49')]=_[_0x5891('0x47')](_0x73373d[_0x5891('0x43')],qs[_0x5891('0x48')](_0x2ecdb0[_0x5891('0x44')][_0x5891('0x48')]));_0x16a139[_0x5891('0x49')]=_0x16a139[_0x5891('0x49')][_0x5891('0x4a')]?_0x16a139[_0x5891('0x49')]:_0x73373d[_0x5891('0x43')];if(_0x2ecdb0[_0x5891('0x44')][_0x5891('0x53')]){_0x16a139['include']=[{'all':!![]}];}_0x16a139=_['merge']({},_0x16a139,_0x2ecdb0[_0x5891('0x57')]);return db[_0x5891('0x3f')][_0x5891('0x58')](_0x16a139)[_0x5891('0x25')](handleEntityNotFound(_0x3867c4,null))[_0x5891('0x25')](respondWithResult(_0x3867c4,null))['catch'](handleError(_0x3867c4,null));};exports[_0x5891('0x59')]=function(_0x337e5d,_0x174029){return db[_0x5891('0x3f')][_0x5891('0x59')](_0x337e5d[_0x5891('0x5a')],{})['then'](respondWithResult(_0x174029,0xc9))[_0x5891('0x5b')](handleError(_0x174029,null));};exports[_0x5891('0x5c')]=function(_0x24fb1f,_0x49f626){if(_0x24fb1f['body']['id']){delete _0x24fb1f[_0x5891('0x5a')]['id'];}return db[_0x5891('0x3f')][_0x5891('0x58')]({'where':{'id':_0x24fb1f[_0x5891('0x56')]['id']}})[_0x5891('0x25')](handleEntityNotFound(_0x49f626,null))[_0x5891('0x25')](saveUpdates(_0x24fb1f[_0x5891('0x5a')],null))[_0x5891('0x25')](respondWithResult(_0x49f626,null))[_0x5891('0x5b')](handleError(_0x49f626,null));};exports[_0x5891('0x39')]=function(_0xa0731b,_0x503390){return db[_0x5891('0x3f')][_0x5891('0x58')]({'where':{'id':_0xa0731b[_0x5891('0x56')]['id']}})[_0x5891('0x25')](handleEntityNotFound(_0x503390,null))[_0x5891('0x25')](removeEntity(_0x503390,null))[_0x5891('0x5b')](handleError(_0x503390,null));};exports[_0x5891('0x5d')]=function(_0x5ccd2e,_0x9746fb){return db[_0x5891('0x3f')][_0x5891('0x5d')]()['then'](respondWithResult(_0x9746fb,null))['catch'](handleError(_0x9746fb,null));};var interaction_log=require(_0x5891('0x5e'))('chat-interactions');exports[_0x5891('0x5f')]=function(_0x2c91bb,_0x5e18be,_0x4cb718){var _0x2be079={'channel':_0x5891('0x60')};if(_0x2c91bb[_0x5891('0x5a')]['id']){delete _0x2c91bb[_0x5891('0x5a')]['id'];}_0x2c91bb[_0x5891('0x5a')][_0x5891('0x61')]=!![];_0x2c91bb['body']['readAt']=moment()[_0x5891('0x62')](_0x5891('0x63'));_0x2c91bb[_0x5891('0x5a')][_0x5891('0x64')]=_0x2c91bb['body'][_0x5891('0x64')]||_0x2c91bb[_0x5891('0x65')]['id'];return db[_0x5891('0x3f')][_0x5891('0x58')]({'where':{'id':_0x2c91bb[_0x5891('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x5891('0x66')],'as':_0x5891('0x67')}]})[_0x5891('0x25')](handleEntityNotFound(_0x5e18be,null))[_0x5891('0x25')](saveUpdates(_0x2c91bb[_0x5891('0x5a')],null))[_0x5891('0x25')](function(_0x3062ff){if(_0x3062ff){_0x2be079[_0x5891('0x2d')]=_0x3062ff[_0x5891('0x68')]({'plain':!![]});return db[_0x5891('0x69')][_0x5891('0x58')]({'where':{'id':_0x3062ff[_0x5891('0x6a')]}});}return null;})[_0x5891('0x25')](handleEntityNotFound(_0x5e18be,null))[_0x5891('0x25')](function(_0x251736){if(_0x251736){return _0x251736[_0x5891('0x5c')]({'UserId':_0x2c91bb[_0x5891('0x5a')][_0x5891('0x64')],'read1stAt':_['isNil'](_0x251736[_0x5891('0x6b')])?moment()[_0x5891('0x62')](_0x5891('0x63')):undefined});}return null;})[_0x5891('0x25')](function(_0x303c61){if(_0x303c61){_0x2be079[_0x5891('0x6c')]=_0x303c61[_0x5891('0x68')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c91bb[_0x5891('0x65')]['id'],_0x2c91bb['user']['name'],_0x2c91bb[_0x5891('0x65')][_0x5891('0x6d')],_0x2be079[_0x5891('0x6c')]['id'],_0x2c91bb[_0x5891('0x5a')]?JSON[_0x5891('0x2a')](_0x2c91bb[_0x5891('0x5a')]):_0x5891('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x5891('0x6f'),_0x2be079);}return null;})['then'](function(_0x355c7a){if(_0x355c7a){if(_0x2c91bb[_0x5891('0x5a')]['manual']){_0x2be079[_0x5891('0x2d')][_0x5891('0x70')]=util[_0x5891('0x62')]('SIP/%s',_0x2c91bb[_0x5891('0x65')]['name']);_0x2be079[_0x5891('0x2d')][_0x5891('0x71')]=_0x2be079[_0x5891('0x71')];_0x2be079[_0x5891('0x2d')][_0x5891('0x72')]=_0x5891('0x5f');return respondWithRpcPromise(_0x5891('0x73'),'EventManager',{'event':_0x5891('0x74'),'message':_[_0x5891('0x51')](_0x2be079[_0x5891('0x2d')],JSON[_0x5891('0x75')](_0x2be079[_0x5891('0x6c')]['formData']))},client9002)[_0x5891('0x25')](function(){return _0x2be079;});}return _0x2be079;}return null;})[_0x5891('0x25')](respondWithResult(_0x5e18be,null))[_0x5891('0x5b')](handleError(_0x5e18be,null));};var interaction_log=require(_0x5891('0x5e'))(_0x5891('0x76'));exports[_0x5891('0x37')]=function(_0xeaa311,_0x1cb67b,_0x36aa77){var _0x3f7b34={'agent':{},'channel':'chat'};if(_0xeaa311['body']['id']){delete _0xeaa311[_0x5891('0x5a')]['id'];}_0xeaa311[_0x5891('0x5a')][_0x5891('0x64')]=_0xeaa311['body'][_0x5891('0x64')]||_0xeaa311[_0x5891('0x65')]['id'];_0x3f7b34[_0x5891('0x77')]['id']=_0xeaa311[_0x5891('0x5a')]['UserId'];return db[_0x5891('0x3f')]['find']({'where':{'id':_0xeaa311['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1cb67b,null))[_0x5891('0x25')](function(_0x41f6cb){if(_0x41f6cb){_0x3f7b34[_0x5891('0x2d')]=_0x41f6cb[_0x5891('0x68')]({'plain':!![]});return db[_0x5891('0x69')][_0x5891('0x58')]({'where':{'id':_0x41f6cb['ChatInteractionId']}});}return null;})[_0x5891('0x25')](handleEntityNotFound(_0x1cb67b,null))[_0x5891('0x25')](function(_0x4289fe){if(_0x4289fe){_0x3f7b34[_0x5891('0x6c')]=_0x4289fe[_0x5891('0x68')]({'plain':!![]});interaction_log[_0x5891('0x2e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xeaa311['user']['id'],_0xeaa311[_0x5891('0x65')]['name'],_0xeaa311['user'][_0x5891('0x6d')],_0x3f7b34[_0x5891('0x6c')]['id'],_0xeaa311[_0x5891('0x5a')]?JSON['stringify'](_0xeaa311[_0x5891('0x5a')]):_0x5891('0x6e'));return respondWithRpcPromise(_0x5891('0x78'),_0x5891('0x79'),_0x3f7b34);}return null;})[_0x5891('0x25')](function(_0x463482){if(_0x463482){_0x463482[_0x5891('0x2d')][_0x5891('0x70')]=util[_0x5891('0x62')](_0x5891('0x7a'),_0xeaa311[_0x5891('0x65')][_0x5891('0x3b')]);_0x463482[_0x5891('0x2d')][_0x5891('0x71')]=_0x3f7b34[_0x5891('0x71')];_0x463482[_0x5891('0x2d')][_0x5891('0x72')]=_0x5891('0x37');respondWithRpcPromise(_0x5891('0x73'),_0x5891('0x73'),{'event':_0x5891('0x7b'),'message':_0x463482[_0x5891('0x2d')]},client9002);return _0x3f7b34;}return null;})[_0x5891('0x25')](respondWithResult(_0x1cb67b,null))[_0x5891('0x5b')](handleError(_0x1cb67b,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5ac9a42..d49b47b 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 _0x2eb6=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x45aac6,_0x13dafe){var _0x535760=function(_0x3dfb4d){while(--_0x3dfb4d){_0x45aac6['push'](_0x45aac6['shift']());}};_0x535760(++_0x13dafe);}(_0x2eb6,0x16d));var _0x62eb=function(_0x52b6ec,_0x22c21f){_0x52b6ec=_0x52b6ec-0x0;var _0x4efe59=_0x2eb6[_0x52b6ec];return _0x4efe59;};'use strict';var EventEmitter=require(_0x62eb('0x0'));var ChatMessage=require(_0x62eb('0x1'))['db'][_0x62eb('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x62eb('0x3')](0x0);var events={'afterCreate':_0x62eb('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1307ec){return function(_0x34ea67,_0x3ede35,_0x57f090){ChatMessageEvents[_0x62eb('0x5')](_0x1307ec+':'+_0x34ea67['id'],_0x34ea67);ChatMessageEvents[_0x62eb('0x5')](_0x1307ec,_0x34ea67);_0x57f090(null);};}for(var e in events){if(events[_0x62eb('0x6')](e)){var event=events[e];ChatMessage[_0x62eb('0x7')](e,emitEvent(event));}}module[_0x62eb('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xe9b1=['ChatMessage','save','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0xe9b1,0xa0));var _0x1e9b=function(_0x43e97d,_0x56a06b){_0x43e97d=_0x43e97d-0x0;var _0x424cd9=_0xe9b1[_0x43e97d];return _0x424cd9;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x1e9b('0x0'))['db'][_0x1e9b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e9b('0x2'),'afterUpdate':'update','afterDestroy':_0x1e9b('0x3')};function emitEvent(_0x3e5c0b){return function(_0x3fabef,_0x5b6813,_0x534bf5){ChatMessageEvents[_0x1e9b('0x4')](_0x3e5c0b+':'+_0x3fabef['id'],_0x3fabef);ChatMessageEvents[_0x1e9b('0x4')](_0x3e5c0b,_0x3fabef);_0x534bf5(null);};}for(var e in events){if(events[_0x1e9b('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x1e9b('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index cada6f6..fbf9e0d 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 _0xaa4e=['exports','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes'];(function(_0x3736f1,_0x1d0421){var _0x584168=function(_0x35709a){while(--_0x35709a){_0x3736f1['push'](_0x3736f1['shift']());}};_0x584168(++_0x1d0421);}(_0xaa4e,0x8d));var _0xeaa4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa4e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeaa4('0x0'));var util=require(_0xeaa4('0x1'));var logger=require(_0xeaa4('0x2'))(_0xeaa4('0x3'));var moment=require('moment');var BPromise=require(_0xeaa4('0x4'));var rp=require(_0xeaa4('0x5'));var fs=require('fs');var path=require(_0xeaa4('0x6'));var rimraf=require('rimraf');var config=require(_0xeaa4('0x7'));var attributes=require(_0xeaa4('0x8'));module[_0xeaa4('0x9')]=function(_0x1da911,_0x237dcf){return _0x1da911['define'](_0xeaa4('0xa'),attributes,{'tableName':_0xeaa4('0xb'),'paranoid':![],'indexes':[{'name':_0xeaa4('0xc'),'fields':['body'],'type':_0xeaa4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34bf32,_0x4e05f0,_0x1568b3){var _0x5d7ae7=_0x1da911[_0xeaa4('0xe')];var _0x312c3d=_0x34bf32[_0xeaa4('0xf')]({'plain':!![]});if(_0x312c3d[_0xeaa4('0x10')][_0xeaa4('0x11')]()==='in'||_0x312c3d[_0xeaa4('0x10')][_0xeaa4('0x11')]()===_0xeaa4('0x12')&&!_0x312c3d[_0xeaa4('0x13')]&&!_[_0xeaa4('0x14')](_0x312c3d['UserId'])){_0x5d7ae7[_0xeaa4('0x15')][_0xeaa4('0x16')]({'where':{'id':_0x312c3d['ChatInteractionId']}})[_0xeaa4('0x17')](function(_0x33e001){if(_0x33e001){_0x33e001[_0xeaa4('0x18')]({'lastMsgAt':_0x312c3d[_0xeaa4('0x19')],'lastMsgDirection':_0x312c3d[_0xeaa4('0x10')]['toLowerCase']()});}})[_0xeaa4('0x1a')](function(_0x4f7249){console[_0xeaa4('0x1b')](_0x4f7249);});}_0x1568b3();}},'charset':_0xeaa4('0x1c'),'collate':_0xeaa4('0x1d')});}; \ No newline at end of file +var _0x0953=['../../config/environment','exports','ChatMessage','chat_messages','body','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0953,0xa6));var _0x3095=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x0953[_0xadde88];return _0x3b8eb6;};'use strict';var _=require('lodash');var util=require(_0x3095('0x0'));var logger=require(_0x3095('0x1'))(_0x3095('0x2'));var moment=require(_0x3095('0x3'));var BPromise=require(_0x3095('0x4'));var rp=require(_0x3095('0x5'));var fs=require('fs');var path=require(_0x3095('0x6'));var rimraf=require(_0x3095('0x7'));var config=require(_0x3095('0x8'));var attributes=require('./chatMessage.attributes');module[_0x3095('0x9')]=function(_0x1d00ad,_0xb88803){return _0x1d00ad['define'](_0x3095('0xa'),attributes,{'tableName':_0x3095('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x3095('0xc')],'type':_0x3095('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x449941,_0x5cac0a,_0x26d29e){var _0x138d2a=_0x1d00ad['models'];var _0x5a7567=_0x449941[_0x3095('0xe')]({'plain':!![]});if(_0x5a7567['direction'][_0x3095('0xf')]()==='in'||_0x5a7567[_0x3095('0x10')][_0x3095('0xf')]()===_0x3095('0x11')&&!_0x5a7567[_0x3095('0x12')]&&!_[_0x3095('0x13')](_0x5a7567[_0x3095('0x14')])){_0x138d2a[_0x3095('0x15')][_0x3095('0x16')]({'where':{'id':_0x5a7567['ChatInteractionId']}})[_0x3095('0x17')](function(_0x2e2736){if(_0x2e2736){_0x2e2736[_0x3095('0x18')]({'lastMsgAt':_0x5a7567['createdAt'],'lastMsgDirection':_0x5a7567[_0x3095('0x10')][_0x3095('0xf')]()});}})[_0x3095('0x19')](function(_0x7269ce){console[_0x3095('0x1a')](_0x7269ce);});}_0x26d29e();}},'charset':_0x3095('0x1b'),'collate':_0x3095('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9ee1560..320edbe 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 _0x52b5=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','error','message','result','ChatMessage','body','options','raw','CreateChatMessage','stringify','catch','util','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x52b5,0xe6));var _0x552b=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0x52b5[_0x515283];return _0x38f836;};'use strict';var _=require('lodash');var util=require(_0x552b('0x0'));var moment=require('moment');var BPromise=require(_0x552b('0x1'));var rs=require(_0x552b('0x2'));var fs=require('fs');var Redis=require(_0x552b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x552b('0x4'));var logger=require(_0x552b('0x5'))(_0x552b('0x6'));var config=require(_0x552b('0x7'));var jayson=require(_0x552b('0x8'));var client=jayson['client'][_0x552b('0x9')]({'port':0x232a});config[_0x552b('0xa')]=_['defaults'](config[_0x552b('0xa')],{'host':_0x552b('0xb'),'port':0x18eb});var socket=require(_0x552b('0xc'))(new Redis(config[_0x552b('0xa')]));require('./chatMessage.socket')[_0x552b('0xd')](socket);function respondWithRpcPromise(_0x3dc6f0,_0x41eb80,_0x429346){return new BPromise(function(_0x55a31c,_0xba6665){return client['request'](_0x3dc6f0,_0x429346)[_0x552b('0xe')](function(_0x1c52b6){logger[_0x552b('0xf')](_0x552b('0x10'),_0x41eb80,'request\x20sent');logger[_0x552b('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x41eb80,_0x552b('0x12'),JSON['stringify'](_0x1c52b6));if(_0x1c52b6[_0x552b('0x13')]){if(_0x1c52b6[_0x552b('0x13')]['code']===0x1f4){logger['error'](_0x552b('0x10'),_0x41eb80,_0x1c52b6[_0x552b('0x13')][_0x552b('0x14')]);return _0xba6665(_0x1c52b6[_0x552b('0x13')][_0x552b('0x14')]);}logger['error'](_0x552b('0x10'),_0x41eb80,_0x1c52b6[_0x552b('0x13')][_0x552b('0x14')]);return _0x55a31c(_0x1c52b6[_0x552b('0x13')][_0x552b('0x14')]);}else{logger[_0x552b('0xf')](_0x552b('0x10'),_0x41eb80,_0x552b('0x12'));_0x55a31c(_0x1c52b6[_0x552b('0x15')][_0x552b('0x14')]);}})['catch'](function(_0x3993cc){logger['error'](_0x552b('0x10'),_0x41eb80,_0x3993cc);_0xba6665(_0x3993cc);});});}exports['CreateChatMessage']=function(_0x5e5299){var _0x1649e4=this;return new Promise(function(_0x3d3235,_0x103e49){return db[_0x552b('0x16')]['create'](_0x5e5299[_0x552b('0x17')],{'raw':_0x5e5299['options']?_0x5e5299[_0x552b('0x18')][_0x552b('0x19')]===undefined?!![]:![]:!![]})[_0x552b('0xe')](function(_0x363d92){logger[_0x552b('0xf')](_0x552b('0x1a'),_0x5e5299);logger[_0x552b('0x11')](_0x552b('0x1a'),_0x5e5299,JSON[_0x552b('0x1b')](_0x363d92));_0x3d3235(_0x363d92);})[_0x552b('0x1c')](function(_0x3584df){logger[_0x552b('0x13')]('CreateChatMessage',_0x3584df[_0x552b('0x14')],_0x5e5299);_0x103e49(_0x1649e4['error'](0x1f4,_0x3584df['message']));});});}; \ No newline at end of file +var _0xf333=['request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','ChatMessage','create','body','raw','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket'];(function(_0x255a1a,_0x20732e){var _0x15520e=function(_0x17ecec){while(--_0x17ecec){_0x255a1a['push'](_0x255a1a['shift']());}};_0x15520e(++_0x20732e);}(_0xf333,0x1aa));var _0x3f33=function(_0x47007f,_0x308aa8){_0x47007f=_0x47007f-0x0;var _0x35a754=_0xf333[_0x47007f];return _0x35a754;};'use strict';var _=require(_0x3f33('0x0'));var util=require('util');var moment=require(_0x3f33('0x1'));var BPromise=require(_0x3f33('0x2'));var rs=require(_0x3f33('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f33('0x4'))['db'];var utils=require(_0x3f33('0x5'));var logger=require(_0x3f33('0x6'))('rpc');var config=require(_0x3f33('0x7'));var jayson=require(_0x3f33('0x8'));var client=jayson[_0x3f33('0x9')][_0x3f33('0xa')]({'port':0x232a});config[_0x3f33('0xb')]=_[_0x3f33('0xc')](config[_0x3f33('0xb')],{'host':_0x3f33('0xd'),'port':0x18eb});var socket=require(_0x3f33('0xe'))(new Redis(config['redis']));require(_0x3f33('0xf'))['register'](socket);function respondWithRpcPromise(_0x54a0bd,_0x11e10a,_0xfed22c){return new BPromise(function(_0x4f85da,_0x344f38){return client[_0x3f33('0x10')](_0x54a0bd,_0xfed22c)[_0x3f33('0x11')](function(_0x201736){logger[_0x3f33('0x12')](_0x3f33('0x13'),_0x11e10a,_0x3f33('0x14'));logger[_0x3f33('0x15')](_0x3f33('0x16'),_0x11e10a,_0x3f33('0x14'),JSON[_0x3f33('0x17')](_0x201736));if(_0x201736[_0x3f33('0x18')]){if(_0x201736[_0x3f33('0x18')][_0x3f33('0x19')]===0x1f4){logger['error'](_0x3f33('0x13'),_0x11e10a,_0x201736[_0x3f33('0x18')][_0x3f33('0x1a')]);return _0x344f38(_0x201736[_0x3f33('0x18')][_0x3f33('0x1a')]);}logger[_0x3f33('0x18')]('ChatMessage,\x20%s,\x20%s',_0x11e10a,_0x201736[_0x3f33('0x18')][_0x3f33('0x1a')]);return _0x4f85da(_0x201736[_0x3f33('0x18')][_0x3f33('0x1a')]);}else{logger['info'](_0x3f33('0x13'),_0x11e10a,_0x3f33('0x14'));_0x4f85da(_0x201736[_0x3f33('0x1b')][_0x3f33('0x1a')]);}})['catch'](function(_0x6db675){logger[_0x3f33('0x18')](_0x3f33('0x13'),_0x11e10a,_0x6db675);_0x344f38(_0x6db675);});});}exports[_0x3f33('0x1c')]=function(_0x1ec6fa){var _0x1cdc18=this;return new Promise(function(_0x1c9227,_0x46098e){return db[_0x3f33('0x1d')][_0x3f33('0x1e')](_0x1ec6fa[_0x3f33('0x1f')],{'raw':_0x1ec6fa['options']?_0x1ec6fa['options'][_0x3f33('0x20')]===undefined?!![]:![]:!![]})[_0x3f33('0x11')](function(_0x4be0b7){logger['info'](_0x3f33('0x1c'),_0x1ec6fa);logger[_0x3f33('0x15')](_0x3f33('0x1c'),_0x1ec6fa,JSON[_0x3f33('0x17')](_0x4be0b7));_0x1c9227(_0x4be0b7);})[_0x3f33('0x21')](function(_0x56d280){logger['error'](_0x3f33('0x1c'),_0x56d280[_0x3f33('0x1a')],_0x1ec6fa);_0x46098e(_0x1cdc18[_0x3f33('0x18')](0x1f4,_0x56d280['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 00bd4b9..898a306 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 _0x4c60=['chatMessage:','./chatMessage.events','save','remove','update','removeListener','register','length'];(function(_0x4b54ec,_0x12ce1d){var _0x24416c=function(_0x2d69f8){while(--_0x2d69f8){_0x4b54ec['push'](_0x4b54ec['shift']());}};_0x24416c(++_0x12ce1d);}(_0x4c60,0xc1));var _0x04c6=function(_0x5d04e5,_0x4af72e){_0x5d04e5=_0x5d04e5-0x0;var _0x3bdc1a=_0x4c60[_0x5d04e5];return _0x3bdc1a;};'use strict';var ChatMessageEvents=require(_0x04c6('0x0'));var events=[_0x04c6('0x1'),_0x04c6('0x2'),_0x04c6('0x3')];function createListener(_0x5ba768,_0x2a1d36){return function(_0x5d9fa3){_0x2a1d36['emit'](_0x5ba768,_0x5d9fa3);};}function removeListener(_0x4ad4f1,_0x53ca7a){return function(){ChatMessageEvents[_0x04c6('0x4')](_0x4ad4f1,_0x53ca7a);};}exports[_0x04c6('0x5')]=function(_0x2054da){for(var _0x12bd5d=0x0,_0x2b9041=events[_0x04c6('0x6')];_0x12bd5d<_0x2b9041;_0x12bd5d++){var _0x8f9b13=events[_0x12bd5d];var _0x530a48=createListener(_0x04c6('0x7')+_0x8f9b13,_0x2054da);ChatMessageEvents['on'](_0x8f9b13,_0x530a48);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','chatMessage:','./chatMessage.events','update'];(function(_0x37b9a1,_0x43fbd1){var _0x4fe63d=function(_0x23083f){while(--_0x23083f){_0x37b9a1['push'](_0x37b9a1['shift']());}};_0x4fe63d(++_0x43fbd1);}(_0x0295,0x1f0));var _0x5029=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x0295[_0x15dbca];return _0x326533;};'use strict';var ChatMessageEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){ChatMessageEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);ChatMessageEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 1f998f1..7c65694 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 _0x74aa=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','chat','put','update','/:id/accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x2c7780,_0x100f4a){var _0x580bc8=function(_0x3d435c){while(--_0x3d435c){_0x2c7780['push'](_0x2c7780['shift']());}};_0x580bc8(++_0x100f4a);}(_0x74aa,0x18b));var _0xa74a=function(_0x2ecfd0,_0x44948c){_0x2ecfd0=_0x2ecfd0-0x0;var _0x10c4fc=_0x74aa[_0x2ecfd0];return _0x10c4fc;};'use strict';var multer=require('multer');var util=require(_0xa74a('0x0'));var path=require(_0xa74a('0x1'));var timeout=require(_0xa74a('0x2'));var express=require(_0xa74a('0x3'));var router=express[_0xa74a('0x4')]();var auth=require(_0xa74a('0x5'));var interaction=require(_0xa74a('0x6'));var config=require(_0xa74a('0x7'));var controller=require(_0xa74a('0x8'));router[_0xa74a('0x9')]('/',auth[_0xa74a('0xa')](),controller[_0xa74a('0xb')]);router[_0xa74a('0x9')](_0xa74a('0xc'),auth[_0xa74a('0xa')](),controller[_0xa74a('0xd')]);router[_0xa74a('0x9')](_0xa74a('0xe'),auth[_0xa74a('0xa')](),controller[_0xa74a('0xf')]);router['post']('/',auth[_0xa74a('0xa')](),interaction[_0xa74a('0x10')](_0xa74a('0x11'),'chatmessage:create'),controller['create']);router[_0xa74a('0x12')](_0xa74a('0xe'),controller[_0xa74a('0x13')]);router['put'](_0xa74a('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0xa74a('0x12')](_0xa74a('0x15'),auth[_0xa74a('0xa')](),controller['reject']);router[_0xa74a('0x16')]('/:id',auth[_0xa74a('0xa')](),controller[_0xa74a('0x17')]);module[_0xa74a('0x18')]=router; \ No newline at end of file +var _0x68ee=['/:id/accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put'];(function(_0x113805,_0x4a4013){var _0x4b1b4b=function(_0x57ec92){while(--_0x57ec92){_0x113805['push'](_0x113805['shift']());}};_0x4b1b4b(++_0x4a4013);}(_0x68ee,0x13e));var _0xe68e=function(_0x5dfb3e,_0x241b5b){_0x5dfb3e=_0x5dfb3e-0x0;var _0x3f8a7b=_0x68ee[_0x5dfb3e];return _0x3f8a7b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe68e('0x0'));var timeout=require(_0xe68e('0x1'));var express=require('express');var router=express[_0xe68e('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe68e('0x3'));var config=require(_0xe68e('0x4'));var controller=require('./chatMessage.controller');router[_0xe68e('0x5')]('/',auth[_0xe68e('0x6')](),controller[_0xe68e('0x7')]);router[_0xe68e('0x5')](_0xe68e('0x8'),auth[_0xe68e('0x6')](),controller[_0xe68e('0x9')]);router[_0xe68e('0x5')](_0xe68e('0xa'),auth['isAuthenticated'](),controller[_0xe68e('0xb')]);router[_0xe68e('0xc')]('/',auth[_0xe68e('0x6')](),interaction[_0xe68e('0xd')](_0xe68e('0xe'),_0xe68e('0xf')),controller[_0xe68e('0x10')]);router[_0xe68e('0x11')]('/:id',controller['update']);router[_0xe68e('0x11')](_0xe68e('0x12'),auth[_0xe68e('0x6')](),controller['accept']);router[_0xe68e('0x11')](_0xe68e('0x13'),auth[_0xe68e('0x6')](),controller[_0xe68e('0x14')]);router[_0xe68e('0x15')](_0xe68e('0xa'),auth['isAuthenticated'](),controller[_0xe68e('0x16')]);module[_0xe68e('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index a156f1c..12e3503 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 _0x4c54=['sequelize','exports','medium'];(function(_0x60cfa1,_0x411cdf){var _0x2be6bb=function(_0x3ff769){while(--_0x3ff769){_0x60cfa1['push'](_0x60cfa1['shift']());}};_0x2be6bb(++_0x411cdf);}(_0x4c54,0x1e0));var _0x44c5=function(_0x4dc5d3,_0x2f1811){_0x4dc5d3=_0x4dc5d3-0x0;var _0x559c10=_0x4c54[_0x4dc5d3];return _0x559c10;};'use strict';var Sequelize=require(_0x44c5('0x0'));module[_0x44c5('0x1')]={'body':{'type':Sequelize['TEXT'](_0x44c5('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xc428=['exports','medium'];(function(_0x223dbe,_0x3d3502){var _0x8bbb59=function(_0x490923){while(--_0x490923){_0x223dbe['push'](_0x223dbe['shift']());}};_0x8bbb59(++_0x3d3502);}(_0xc428,0xf0));var _0x8c42=function(_0xf60719,_0x2f4e16){_0xf60719=_0xf60719-0x0;var _0x3d8beb=_0xc428[_0xf60719];return _0x3d8beb;};'use strict';var Sequelize=require('sequelize');module[_0x8c42('0x0')]={'body':{'type':Sequelize['TEXT'](_0x8c42('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 6e72372..83500c6 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 _0x4745=['api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','error','name','send','map','ChatOfflineMessage','key','model','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','query','order','sort','where','filter','type','merge','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x4745,0x1e7));var _0x5474=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x4745[_0x5783f4];return _0x28e380;};'use strict';var pdf=require(_0x5474('0x0'));var emlformat=require(_0x5474('0x1'));var rimraf=require(_0x5474('0x2'));var zipdir=require(_0x5474('0x3'));var jsonpatch=require(_0x5474('0x4'));var rp=require(_0x5474('0x5'));var moment=require(_0x5474('0x6'));var BPromise=require(_0x5474('0x7'));var Mustache=require(_0x5474('0x8'));var util=require(_0x5474('0x9'));var path=require(_0x5474('0xa'));var sox=require(_0x5474('0xb'));var csv=require('to-csv');var ejs=require(_0x5474('0xc'));var fs=require('fs');var _=require(_0x5474('0xd'));var squel=require('squel');var crypto=require(_0x5474('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5474('0xf'));var toCsv=require(_0x5474('0x10'));var querystring=require('querystring');var Papa=require(_0x5474('0x11'));var Redis=require(_0x5474('0x12'));var authService=require(_0x5474('0x13'));var qs=require(_0x5474('0x14'));var as=require(_0x5474('0x15'));var hardwareService=require(_0x5474('0x16'));var logger=require(_0x5474('0x17'))(_0x5474('0x18'));var utils=require('../../config/utils');var config=require(_0x5474('0x19'));var db=require(_0x5474('0x1a'))['db'];function respondWithStatusCode(_0xdc4c23,_0x12cd7f){_0x12cd7f=_0x12cd7f||0xcc;return function(_0x10eac7){if(_0x10eac7){return _0xdc4c23[_0x5474('0x1b')](_0x12cd7f);}return _0xdc4c23[_0x5474('0x1c')](_0x12cd7f)[_0x5474('0x1d')]();};}function respondWithResult(_0x25262c,_0x4a8db0){_0x4a8db0=_0x4a8db0||0xc8;return function(_0xb828fe){if(_0xb828fe){return _0x25262c[_0x5474('0x1c')](_0x4a8db0)[_0x5474('0x1e')](_0xb828fe);}};}function respondWithFilteredResult(_0x1790eb,_0x5a6353){return function(_0x540e31){if(_0x540e31){var _0x50b949=_0x540e31[_0x5474('0x1f')],_0x50eb42=_0x5a6353['offset'],_0x32f0e4=_0x5a6353[_0x5474('0x20')]+_0x5a6353[_0x5474('0x21')],_0x172bcb;if(_0x32f0e4>=_0x50b949){_0x32f0e4=_0x50b949;_0x172bcb=0xc8;}else{_0x172bcb=0xce;}_0x1790eb['status'](_0x172bcb);return _0x1790eb[_0x5474('0x22')](_0x5474('0x23'),_0x50eb42+'-'+_0x32f0e4+'/'+_0x50b949)[_0x5474('0x1e')](_0x540e31);}return null;};}function patchUpdates(_0x469d62){return function(_0x327684){try{jsonpatch['apply'](_0x327684,_0x469d62,!![]);}catch(_0x207b5f){return BPromise['reject'](_0x207b5f);}return _0x327684[_0x5474('0x24')]();};}function saveUpdates(_0x178e5c,_0x50d3a1){return function(_0x504826){if(_0x504826){return _0x504826['update'](_0x178e5c)[_0x5474('0x25')](function(_0x2c7593){return _0x2c7593;});}return null;};}function removeEntity(_0x475374,_0x401dd8){return function(_0x36b389){if(_0x36b389){return _0x36b389[_0x5474('0x26')]()[_0x5474('0x25')](function(){_0x475374[_0x5474('0x1c')](0xcc)[_0x5474('0x1d')]();});}};}function handleEntityNotFound(_0x9c80cc,_0x542d1f){return function(_0x5f065d){if(!_0x5f065d){_0x9c80cc[_0x5474('0x1b')](0x194);}return _0x5f065d;};}function handleError(_0x266465,_0x40151a){_0x40151a=_0x40151a||0x1f4;return function(_0x4b40e0){logger[_0x5474('0x27')](_0x4b40e0['stack']);if(_0x4b40e0[_0x5474('0x28')]){delete _0x4b40e0[_0x5474('0x28')];}_0x266465['status'](_0x40151a)[_0x5474('0x29')](_0x4b40e0);};}exports['index']=function(_0x385f91,_0x5efa8d){var _0xe9dcbf={},_0x1384e4={},_0x2a8730={'count':0x0,'rows':[]};var _0x5865fe=_[_0x5474('0x2a')](db[_0x5474('0x2b')]['rawAttributes'],function(_0x57731b){return{'name':_0x57731b['fieldName'],'type':_0x57731b['type'][_0x5474('0x2c')]};});_0x1384e4[_0x5474('0x2d')]=_['map'](_0x5865fe,_0x5474('0x28'));_0x1384e4['query']=_[_0x5474('0x2e')](_0x385f91['query']);_0x1384e4[_0x5474('0x2f')]=_['intersection'](_0x1384e4[_0x5474('0x2d')],_0x1384e4['query']);_0xe9dcbf[_0x5474('0x30')]=_[_0x5474('0x31')](_0x1384e4[_0x5474('0x2d')],qs[_0x5474('0x32')](_0x385f91['query']['fields']));_0xe9dcbf[_0x5474('0x30')]=_0xe9dcbf[_0x5474('0x30')][_0x5474('0x33')]?_0xe9dcbf[_0x5474('0x30')]:_0x1384e4['model'];if(!_0x385f91['query'][_0x5474('0x34')](_0x5474('0x35'))){_0xe9dcbf['limit']=qs[_0x5474('0x21')](_0x385f91[_0x5474('0x36')][_0x5474('0x21')]);_0xe9dcbf[_0x5474('0x20')]=qs['offset'](_0x385f91[_0x5474('0x36')][_0x5474('0x20')]);}_0xe9dcbf[_0x5474('0x37')]=qs['sort'](_0x385f91[_0x5474('0x36')][_0x5474('0x38')]);_0xe9dcbf[_0x5474('0x39')]=qs[_0x5474('0x2f')](_['pick'](_0x385f91['query'],_0x1384e4[_0x5474('0x2f')]),_0x5865fe);if(_0x385f91[_0x5474('0x36')][_0x5474('0x3a')]){_0xe9dcbf[_0x5474('0x39')]=_['merge'](_0xe9dcbf[_0x5474('0x39')],{'$or':_[_0x5474('0x2a')](_0x5865fe,function(_0x13b56b){if(_0x13b56b[_0x5474('0x3b')]!=='VIRTUAL'){var _0x5b1b70={};_0x5b1b70[_0x13b56b['name']]={'$like':'%'+_0x385f91[_0x5474('0x36')]['filter']+'%'};return _0x5b1b70;}})});}_0xe9dcbf=_[_0x5474('0x3c')]({},_0xe9dcbf,_0x385f91[_0x5474('0x3d')]);var _0x4491eb={'where':_0xe9dcbf[_0x5474('0x39')]};return db[_0x5474('0x2b')][_0x5474('0x1f')](_0x4491eb)[_0x5474('0x25')](function(_0x1adfa5){_0x2a8730[_0x5474('0x1f')]=_0x1adfa5;if(_0x385f91['query'][_0x5474('0x3e')]){_0xe9dcbf[_0x5474('0x3f')]=[{'all':!![]}];}return db[_0x5474('0x2b')][_0x5474('0x40')](_0xe9dcbf);})['then'](function(_0x158172){_0x2a8730['rows']=_0x158172;return _0x2a8730;})[_0x5474('0x25')](respondWithFilteredResult(_0x5efa8d,_0xe9dcbf))[_0x5474('0x41')](handleError(_0x5efa8d,null));};exports['show']=function(_0x1f64fb,_0x2df4e8){var _0x5690a0={'raw':!![],'where':{'id':_0x1f64fb[_0x5474('0x42')]['id']}},_0x2d4b11={};_0x2d4b11['model']=_[_0x5474('0x2e')](db['ChatOfflineMessage'][_0x5474('0x43')]);_0x2d4b11[_0x5474('0x36')]=_['keys'](_0x1f64fb[_0x5474('0x36')]);_0x2d4b11[_0x5474('0x2f')]=_[_0x5474('0x31')](_0x2d4b11['model'],_0x2d4b11[_0x5474('0x36')]);_0x5690a0[_0x5474('0x30')]=_[_0x5474('0x31')](_0x2d4b11[_0x5474('0x2d')],qs['fields'](_0x1f64fb['query'][_0x5474('0x32')]));_0x5690a0['attributes']=_0x5690a0[_0x5474('0x30')][_0x5474('0x33')]?_0x5690a0['attributes']:_0x2d4b11[_0x5474('0x2d')];if(_0x1f64fb[_0x5474('0x36')]['includeAll']){_0x5690a0[_0x5474('0x3f')]=[{'all':!![]}];}_0x5690a0=_[_0x5474('0x3c')]({},_0x5690a0,_0x1f64fb['options']);return db['ChatOfflineMessage'][_0x5474('0x44')](_0x5690a0)[_0x5474('0x25')](handleEntityNotFound(_0x2df4e8,null))['then'](respondWithResult(_0x2df4e8,null))[_0x5474('0x41')](handleError(_0x2df4e8,null));};exports[_0x5474('0x45')]=function(_0x14f4d3,_0x46bde7){return db['ChatOfflineMessage'][_0x5474('0x45')](_0x14f4d3[_0x5474('0x46')],{})['then'](respondWithResult(_0x46bde7,0xc9))[_0x5474('0x41')](handleError(_0x46bde7,null));};exports[_0x5474('0x47')]=function(_0x3c59bb,_0x3a64de){if(_0x3c59bb[_0x5474('0x46')]['id']){delete _0x3c59bb[_0x5474('0x46')]['id'];}return db[_0x5474('0x2b')][_0x5474('0x44')]({'where':{'id':_0x3c59bb[_0x5474('0x42')]['id']}})[_0x5474('0x25')](handleEntityNotFound(_0x3a64de,null))[_0x5474('0x25')](saveUpdates(_0x3c59bb[_0x5474('0x46')],null))['then'](respondWithResult(_0x3a64de,null))[_0x5474('0x41')](handleError(_0x3a64de,null));};exports[_0x5474('0x26')]=function(_0x3d3444,_0x2163ce){return db['ChatOfflineMessage'][_0x5474('0x44')]({'where':{'id':_0x3d3444[_0x5474('0x42')]['id']}})[_0x5474('0x25')](handleEntityNotFound(_0x2163ce,null))[_0x5474('0x25')](removeEntity(_0x2163ce,null))[_0x5474('0x41')](handleError(_0x2163ce,null));};exports[_0x5474('0x48')]=function(_0x1edb7b,_0x364b3b){return db[_0x5474('0x2b')][_0x5474('0x48')]()[_0x5474('0x25')](respondWithResult(_0x364b3b,null))[_0x5474('0x41')](handleError(_0x364b3b,null));}; \ No newline at end of file +var _0xe14b=['findAll','rows','catch','find','create','body','params','destroy','describe','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','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x3a0472,_0x2df1ba){var _0x441e52=function(_0x20e31d){while(--_0x20e31d){_0x3a0472['push'](_0x3a0472['shift']());}};_0x441e52(++_0x2df1ba);}(_0xe14b,0x93));var _0xbe14=function(_0x3dfea3,_0x5ddc8f){_0x3dfea3=_0x3dfea3-0x0;var _0x814726=_0xe14b[_0x3dfea3];return _0x814726;};'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'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0xbe14('0x3c')](_0x169369);})[_0xbe14('0x20')](function(_0x3463c4){_0x16f884[_0xbe14('0x3d')]=_0x3463c4;return _0x16f884;})[_0xbe14('0x20')](respondWithFilteredResult(_0x391556,_0x169369))[_0xbe14('0x3e')](handleError(_0x391556,null));};exports['show']=function(_0xb0f143,_0x1974a4){var _0x1220c9={'raw':!![],'where':{'id':_0xb0f143['params']['id']}},_0x36263c={};_0x36263c['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x25')][_0xbe14('0x26')]);_0x36263c['query']=_['keys'](_0xb0f143[_0xbe14('0x2c')]);_0x36263c['filters']=_['intersection'](_0x36263c[_0xbe14('0x2a')],_0x36263c[_0xbe14('0x2c')]);_0x1220c9[_0xbe14('0x30')]=_['intersection'](_0x36263c['model'],qs['fields'](_0xb0f143[_0xbe14('0x2c')][_0xbe14('0x31')]));_0x1220c9[_0xbe14('0x30')]=_0x1220c9['attributes'][_0xbe14('0x32')]?_0x1220c9[_0xbe14('0x30')]:_0x36263c[_0xbe14('0x2a')];if(_0xb0f143[_0xbe14('0x2c')]['includeAll']){_0x1220c9['include']=[{'all':!![]}];}_0x1220c9=_[_0xbe14('0x37')]({},_0x1220c9,_0xb0f143[_0xbe14('0x39')]);return db[_0xbe14('0x25')][_0xbe14('0x3f')](_0x1220c9)[_0xbe14('0x20')](handleEntityNotFound(_0x1974a4,null))['then'](respondWithResult(_0x1974a4,null))['catch'](handleError(_0x1974a4,null));};exports[_0xbe14('0x40')]=function(_0x2a3623,_0x238c60){return db[_0xbe14('0x25')]['create'](_0x2a3623[_0xbe14('0x41')],{})[_0xbe14('0x20')](respondWithResult(_0x238c60,0xc9))['catch'](handleError(_0x238c60,null));};exports[_0xbe14('0x1f')]=function(_0x2a35e5,_0x2d6ee8){if(_0x2a35e5[_0xbe14('0x41')]['id']){delete _0x2a35e5['body']['id'];}return db['ChatOfflineMessage'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));};exports[_0xbe14('0x44')]=function(_0x494c32,_0x3a221b){return db[_0xbe14('0x25')][_0xbe14('0x44')]()[_0xbe14('0x20')](respondWithResult(_0x3a221b,null))[_0xbe14('0x3e')](handleError(_0x3a221b,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 8973bbf..e07b255 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 _0x3df6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','util','../../config/logger','api'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3df6,0x165));var _0x63df=function(_0x1cb73b,_0x28b0a9){_0x1cb73b=_0x1cb73b-0x0;var _0x763578=_0x3df6[_0x1cb73b];return _0x763578;};'use strict';var _=require('lodash');var util=require(_0x63df('0x0'));var logger=require(_0x63df('0x1'))(_0x63df('0x2'));var moment=require(_0x63df('0x3'));var BPromise=require(_0x63df('0x4'));var rp=require(_0x63df('0x5'));var fs=require('fs');var path=require(_0x63df('0x6'));var rimraf=require(_0x63df('0x7'));var config=require(_0x63df('0x8'));var attributes=require(_0x63df('0x9'));module[_0x63df('0xa')]=function(_0x1bdae5,_0x4b7a35){return _0x1bdae5['define'](_0x63df('0xb'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x948d=['rimraf','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path'];(function(_0x3ce904,_0x117015){var _0x154e67=function(_0x5c8705){while(--_0x5c8705){_0x3ce904['push'](_0x3ce904['shift']());}};_0x154e67(++_0x117015);}(_0x948d,0x125));var _0xd948=function(_0x13a5c8,_0x1b0aca){_0x13a5c8=_0x13a5c8-0x0;var _0x531acd=_0x948d[_0x13a5c8];return _0x531acd;};'use strict';var _=require(_0xd948('0x0'));var util=require(_0xd948('0x1'));var logger=require(_0xd948('0x2'))(_0xd948('0x3'));var moment=require(_0xd948('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd948('0x5'));var rimraf=require(_0xd948('0x6'));var config=require('../../config/environment');var attributes=require(_0xd948('0x7'));module['exports']=function(_0x517de5,_0x5af1b4){return _0x517de5[_0xd948('0x8')](_0xd948('0x9'),attributes,{'tableName':_0xd948('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd948('0xb'),'collate':_0xd948('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 687d1cc..473b21b 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 _0x4d25=['then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x32f657,_0x3bcd12){var _0x2dd60e=function(_0xcb6863){while(--_0xcb6863){_0x32f657['push'](_0x32f657['shift']());}};_0x2dd60e(++_0x3bcd12);}(_0x4d25,0x182));var _0x54d2=function(_0x270a02,_0x223adb){_0x270a02=_0x270a02-0x0;var _0x3cd07b=_0x4d25[_0x270a02];return _0x3cd07b;};'use strict';var _=require(_0x54d2('0x0'));var util=require(_0x54d2('0x1'));var moment=require(_0x54d2('0x2'));var BPromise=require(_0x54d2('0x3'));var rs=require(_0x54d2('0x4'));var fs=require('fs');var Redis=require(_0x54d2('0x5'));var db=require(_0x54d2('0x6'))['db'];var utils=require(_0x54d2('0x7'));var logger=require(_0x54d2('0x8'))(_0x54d2('0x9'));var config=require(_0x54d2('0xa'));var jayson=require(_0x54d2('0xb'));var client=jayson[_0x54d2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35bf89,_0x42d96e,_0x1ae1f0){return new BPromise(function(_0x308916,_0x5e0334){return client[_0x54d2('0xd')](_0x35bf89,_0x1ae1f0)[_0x54d2('0xe')](function(_0x1daa3f){logger[_0x54d2('0xf')](_0x54d2('0x10'),_0x42d96e,'request\x20sent');logger['debug'](_0x54d2('0x11'),_0x42d96e,_0x54d2('0x12'),JSON[_0x54d2('0x13')](_0x1daa3f));if(_0x1daa3f['error']){if(_0x1daa3f['error'][_0x54d2('0x14')]===0x1f4){logger[_0x54d2('0x15')](_0x54d2('0x10'),_0x42d96e,_0x1daa3f['error']['message']);return _0x5e0334(_0x1daa3f[_0x54d2('0x15')]['message']);}logger[_0x54d2('0x15')]('ChatOfflineMessage,\x20%s,\x20%s',_0x42d96e,_0x1daa3f[_0x54d2('0x15')][_0x54d2('0x16')]);return _0x308916(_0x1daa3f[_0x54d2('0x15')][_0x54d2('0x16')]);}else{logger['info'](_0x54d2('0x10'),_0x42d96e,_0x54d2('0x12'));_0x308916(_0x1daa3f[_0x54d2('0x17')][_0x54d2('0x16')]);}})[_0x54d2('0x18')](function(_0xdec44d){logger['error'](_0x54d2('0x10'),_0x42d96e,_0xdec44d);_0x5e0334(_0xdec44d);});});} \ No newline at end of file +var _0x7401=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','util','randomstring'];(function(_0x2c41f9,_0x550191){var _0x5f3d76=function(_0x19ff0c){while(--_0x19ff0c){_0x2c41f9['push'](_0x2c41f9['shift']());}};_0x5f3d76(++_0x550191);}(_0x7401,0x139));var _0x1740=function(_0x5453c2,_0x51e0eb){_0x5453c2=_0x5453c2-0x0;var _0x191dc2=_0x7401[_0x5453c2];return _0x191dc2;};'use strict';var _=require('lodash');var util=require(_0x1740('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1740('0x1'));var fs=require('fs');var Redis=require(_0x1740('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1740('0x3'));var logger=require('../../config/logger')(_0x1740('0x4'));var config=require(_0x1740('0x5'));var jayson=require(_0x1740('0x6'));var client=jayson[_0x1740('0x7')][_0x1740('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d2fd8,_0x546efb,_0x5bd1a5){return new BPromise(function(_0x263f39,_0x398983){return client[_0x1740('0x9')](_0x3d2fd8,_0x5bd1a5)[_0x1740('0xa')](function(_0x200edf){logger['info'](_0x1740('0xb'),_0x546efb,'request\x20sent');logger[_0x1740('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x546efb,_0x1740('0xd'),JSON[_0x1740('0xe')](_0x200edf));if(_0x200edf['error']){if(_0x200edf[_0x1740('0xf')][_0x1740('0x10')]===0x1f4){logger['error'](_0x1740('0xb'),_0x546efb,_0x200edf[_0x1740('0xf')][_0x1740('0x11')]);return _0x398983(_0x200edf['error'][_0x1740('0x11')]);}logger[_0x1740('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x546efb,_0x200edf['error'][_0x1740('0x11')]);return _0x263f39(_0x200edf[_0x1740('0xf')][_0x1740('0x11')]);}else{logger[_0x1740('0x12')](_0x1740('0xb'),_0x546efb,'request\x20sent');_0x263f39(_0x200edf[_0x1740('0x13')][_0x1740('0x11')]);}})[_0x1740('0x14')](function(_0x252e54){logger['error'](_0x1740('0xb'),_0x546efb,_0x252e54);_0x398983(_0x252e54);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 54837a2..75282e2 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 _0xcae9=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','/:id','show','post','create','delete','destroy','exports'];(function(_0x22a682,_0x2394b0){var _0xb7f3a2=function(_0x1b59eb){while(--_0x1b59eb){_0x22a682['push'](_0x22a682['shift']());}};_0xb7f3a2(++_0x2394b0);}(_0xcae9,0x1b5));var _0x9cae=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xcae9[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x9cae('0x0'));var util=require(_0x9cae('0x1'));var path=require(_0x9cae('0x2'));var timeout=require('connect-timeout');var express=require(_0x9cae('0x3'));var router=express[_0x9cae('0x4')]();var auth=require(_0x9cae('0x5'));var interaction=require(_0x9cae('0x6'));var config=require(_0x9cae('0x7'));var controller=require(_0x9cae('0x8'));router['get']('/',auth[_0x9cae('0x9')](),controller['index']);router[_0x9cae('0xa')](_0x9cae('0xb'),auth[_0x9cae('0x9')](),controller['describe']);router[_0x9cae('0xa')](_0x9cae('0xc'),auth[_0x9cae('0x9')](),controller[_0x9cae('0xd')]);router[_0x9cae('0xe')]('/',auth['isAuthenticated'](),controller[_0x9cae('0xf')]);router['put']('/:id',auth[_0x9cae('0x9')](),controller['update']);router[_0x9cae('0x10')](_0x9cae('0xc'),auth[_0x9cae('0x9')](),controller[_0x9cae('0x11')]);module[_0x9cae('0x12')]=router; \ No newline at end of file +var _0xa136=['./chatOfflineMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x2e5e63,_0x25a5ea){var _0x5aa70a=function(_0x321b15){while(--_0x321b15){_0x2e5e63['push'](_0x2e5e63['shift']());}};_0x5aa70a(++_0x25a5ea);}(_0xa136,0x9a));var _0x6a13=function(_0x1afedc,_0x17ee2f){_0x1afedc=_0x1afedc-0x0;var _0x3520db=_0xa136[_0x1afedc];return _0x3520db;};'use strict';var multer=require(_0x6a13('0x0'));var util=require(_0x6a13('0x1'));var path=require(_0x6a13('0x2'));var timeout=require(_0x6a13('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6a13('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6a13('0x5'));var controller=require(_0x6a13('0x6'));router['get']('/',auth[_0x6a13('0x7')](),controller[_0x6a13('0x8')]);router['get'](_0x6a13('0x9'),auth[_0x6a13('0x7')](),controller[_0x6a13('0xa')]);router[_0x6a13('0xb')](_0x6a13('0xc'),auth[_0x6a13('0x7')](),controller[_0x6a13('0xd')]);router[_0x6a13('0xe')]('/',auth['isAuthenticated'](),controller[_0x6a13('0xf')]);router['put']('/:id',auth[_0x6a13('0x7')](),controller[_0x6a13('0x10')]);router[_0x6a13('0x11')]('/:id',auth[_0x6a13('0x7')](),controller[_0x6a13('0x12')]);module[_0x6a13('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 2b5e050..d179f80 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 _0xc9d7=['exports','STRING','ENUM','mouseOver','timeout','sequelize'];(function(_0x4737b9,_0xda6545){var _0x22a941=function(_0x1d8d2c){while(--_0x1d8d2c){_0x4737b9['push'](_0x4737b9['shift']());}};_0x22a941(++_0xda6545);}(_0xc9d7,0x1af));var _0x7c9d=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xc9d7[_0x291d3f];return _0x242080;};'use strict';var Sequelize=require(_0x7c9d('0x0'));module[_0x7c9d('0x1')]={'name':{'type':Sequelize[_0x7c9d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7c9d('0x3')](_0x7c9d('0x4'),_0x7c9d('0x5')),'defaultValue':_0x7c9d('0x4')},'selector':{'type':Sequelize[_0x7c9d('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbbac=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x14b9de,_0x59d7a6){var _0x3406b9=function(_0x27a000){while(--_0x27a000){_0x14b9de['push'](_0x14b9de['shift']());}};_0x3406b9(++_0x59d7a6);}(_0xbbac,0x193));var _0xcbba=function(_0x27ffad,_0x5959ad){_0x27ffad=_0x27ffad-0x0;var _0x537d8d=_0xbbac[_0x27ffad];return _0x537d8d;};'use strict';var Sequelize=require(_0xcbba('0x0'));module[_0xcbba('0x1')]={'name':{'type':Sequelize[_0xcbba('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcbba('0x3')](_0xcbba('0x4'),_0xcbba('0x5')),'defaultValue':_0xcbba('0x4')},'selector':{'type':Sequelize[_0xcbba('0x2')]},'timeout':{'type':Sequelize[_0xcbba('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 0c5cf08..36e70f4 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(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 _0x70e0=['mustache','path','to-csv','crypto','jsforce','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','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','options','catch','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x1e9856,_0x422149){var _0xb2055a=function(_0x3f4f21){while(--_0x3f4f21){_0x1e9856['push'](_0x1e9856['shift']());}};_0xb2055a(++_0x422149);}(_0x70e0,0x17b));var _0x070e=function(_0x2620a9,_0x2b085c){_0x2620a9=_0x2620a9-0x0;var _0x4f5bf4=_0x70e0[_0x2620a9];return _0x4f5bf4;};'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={'raw':!![],'where':{'id':_0x1743cc[_0x070e('0x26')]['id']}},_0x374c54={};_0x374c54[_0x070e('0x27')]=_[_0x070e('0x28')](db[_0x070e('0x29')][_0x070e('0x2a')]);_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x28')](_0x1743cc['query']);_0x374c54[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],_0x374c54['query']);_0x497f58['attributes']=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],qs[_0x070e('0x2e')](_0x1743cc['query'][_0x070e('0x2e')]));_0x497f58[_0x070e('0x2f')]=_0x497f58[_0x070e('0x2f')][_0x070e('0x30')]?_0x497f58['attributes']:_0x374c54['model'];if(_0x1743cc['query']['includeAll']){_0x497f58[_0x070e('0x31')]=[{'all':!![]}];}_0x497f58=_['merge']({},_0x497f58,_0x1743cc[_0x070e('0x32')]);return db[_0x070e('0x29')]['find'](_0x497f58)['then'](handleEntityNotFound(_0x4763c6,null))[_0x070e('0x20')](respondWithResult(_0x4763c6,null))[_0x070e('0x33')](handleError(_0x4763c6,null));};exports['create']=function(_0x546a16,_0x41ade4){return db[_0x070e('0x29')][_0x070e('0x34')](_0x546a16[_0x070e('0x35')],{})[_0x070e('0x20')](respondWithResult(_0x41ade4,0xc9))['catch'](handleError(_0x41ade4,null));};exports['update']=function(_0x24d17d,_0x3011c4){if(_0x24d17d[_0x070e('0x35')]['id']){delete _0x24d17d[_0x070e('0x35')]['id'];}return db[_0x070e('0x29')]['find']({'where':{'id':_0x24d17d[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x3011c4,null))['then'](saveUpdates(_0x24d17d[_0x070e('0x35')],null))[_0x070e('0x20')](respondWithResult(_0x3011c4,null))['catch'](handleError(_0x3011c4,null));};exports['destroy']=function(_0x5ddbe9,_0x363bff){return db[_0x070e('0x29')][_0x070e('0x36')]({'where':{'id':_0x5ddbe9[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x363bff,null))['then'](removeEntity(_0x363bff,null))[_0x070e('0x33')](handleError(_0x363bff,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0f02fbc..3a9b2b6 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 _0x3fa5=['define','ChatProactiveAction','chat_proactive_actions','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x3fa5,0xfd));var _0x53fa=function(_0x392ff0,_0x20a5f9){_0x392ff0=_0x392ff0-0x0;var _0x54e13a=_0x3fa5[_0x392ff0];return _0x54e13a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x53fa('0x0'))(_0x53fa('0x1'));var moment=require(_0x53fa('0x2'));var BPromise=require('bluebird');var rp=require(_0x53fa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53fa('0x4'));var config=require(_0x53fa('0x5'));var attributes=require(_0x53fa('0x6'));module['exports']=function(_0x579811,_0x4413d5){return _0x579811[_0x53fa('0x7')](_0x53fa('0x8'),attributes,{'tableName':_0x53fa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ac6=['./chatProactiveAction.attributes','exports','define','chat_proactive_actions','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x283434,_0x42ec32){var _0x176042=function(_0x214096){while(--_0x214096){_0x283434['push'](_0x283434['shift']());}};_0x176042(++_0x42ec32);}(_0x4ac6,0x1b2));var _0x64ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4ac6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x64ac('0x0'));var BPromise=require(_0x64ac('0x1'));var rp=require(_0x64ac('0x2'));var fs=require('fs');var path=require(_0x64ac('0x3'));var rimraf=require(_0x64ac('0x4'));var config=require(_0x64ac('0x5'));var attributes=require(_0x64ac('0x6'));module[_0x64ac('0x7')]=function(_0x309189,_0x349fcf){return _0x309189[_0x64ac('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x64ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index f52a91c..a8155e2 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 _0x12a5=['client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x31ed6c,_0x376750){var _0xb5ca62=function(_0x4eb5f2){while(--_0x4eb5f2){_0x31ed6c['push'](_0x31ed6c['shift']());}};_0xb5ca62(++_0x376750);}(_0x12a5,0x6f));var _0x512a=function(_0x313e77,_0x137b9f){_0x313e77=_0x313e77-0x0;var _0x1adb33=_0x12a5[_0x313e77];return _0x1adb33;};'use strict';var _=require(_0x512a('0x0'));var util=require(_0x512a('0x1'));var moment=require(_0x512a('0x2'));var BPromise=require(_0x512a('0x3'));var rs=require(_0x512a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x512a('0x5'));var logger=require(_0x512a('0x6'))('rpc');var config=require(_0x512a('0x7'));var jayson=require(_0x512a('0x8'));var client=jayson[_0x512a('0x9')][_0x512a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d9b1d,_0x135e08,_0x49a242){return new BPromise(function(_0x221e66,_0x517293){return client[_0x512a('0xb')](_0x2d9b1d,_0x49a242)[_0x512a('0xc')](function(_0x4eac6b){logger['info'](_0x512a('0xd'),_0x135e08,'request\x20sent');logger[_0x512a('0xe')](_0x512a('0xf'),_0x135e08,_0x512a('0x10'),JSON[_0x512a('0x11')](_0x4eac6b));if(_0x4eac6b[_0x512a('0x12')]){if(_0x4eac6b[_0x512a('0x12')][_0x512a('0x13')]===0x1f4){logger[_0x512a('0x12')](_0x512a('0xd'),_0x135e08,_0x4eac6b[_0x512a('0x12')][_0x512a('0x14')]);return _0x517293(_0x4eac6b['error']['message']);}logger[_0x512a('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x135e08,_0x4eac6b[_0x512a('0x12')][_0x512a('0x14')]);return _0x221e66(_0x4eac6b['error'][_0x512a('0x14')]);}else{logger[_0x512a('0x15')](_0x512a('0xd'),_0x135e08,_0x512a('0x10'));_0x221e66(_0x4eac6b[_0x512a('0x16')][_0x512a('0x14')]);}})[_0x512a('0x17')](function(_0x17a9d9){logger[_0x512a('0x12')](_0x512a('0xd'),_0x135e08,_0x17a9d9);_0x517293(_0x17a9d9);});});} \ No newline at end of file +var _0xddbc=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2ce667,_0x1bf6f7){var _0xf43dcd=function(_0x520c01){while(--_0x520c01){_0x2ce667['push'](_0x2ce667['shift']());}};_0xf43dcd(++_0x1bf6f7);}(_0xddbc,0xf2));var _0xcddb=function(_0x1218e9,_0x2c8ea4){_0x1218e9=_0x1218e9-0x0;var _0x54bb2e=_0xddbc[_0x1218e9];return _0x54bb2e;};'use strict';var _=require(_0xcddb('0x0'));var util=require(_0xcddb('0x1'));var moment=require(_0xcddb('0x2'));var BPromise=require(_0xcddb('0x3'));var rs=require(_0xcddb('0x4'));var fs=require('fs');var Redis=require(_0xcddb('0x5'));var db=require(_0xcddb('0x6'))['db'];var utils=require(_0xcddb('0x7'));var logger=require('../../config/logger')(_0xcddb('0x8'));var config=require(_0xcddb('0x9'));var jayson=require(_0xcddb('0xa'));var client=jayson[_0xcddb('0xb')][_0xcddb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ba1a9,_0x3ee837,_0x35e014){return new BPromise(function(_0xfb9aa3,_0x2bf5fc){return client[_0xcddb('0xd')](_0x2ba1a9,_0x35e014)[_0xcddb('0xe')](function(_0x3ab574){logger[_0xcddb('0xf')](_0xcddb('0x10'),_0x3ee837,'request\x20sent');logger[_0xcddb('0x11')](_0xcddb('0x12'),_0x3ee837,_0xcddb('0x13'),JSON['stringify'](_0x3ab574));if(_0x3ab574['error']){if(_0x3ab574[_0xcddb('0x14')][_0xcddb('0x15')]===0x1f4){logger['error'](_0xcddb('0x10'),_0x3ee837,_0x3ab574[_0xcddb('0x14')]['message']);return _0x2bf5fc(_0x3ab574[_0xcddb('0x14')][_0xcddb('0x16')]);}logger[_0xcddb('0x14')](_0xcddb('0x10'),_0x3ee837,_0x3ab574[_0xcddb('0x14')][_0xcddb('0x16')]);return _0xfb9aa3(_0x3ab574[_0xcddb('0x14')][_0xcddb('0x16')]);}else{logger[_0xcddb('0xf')](_0xcddb('0x10'),_0x3ee837,_0xcddb('0x13'));_0xfb9aa3(_0x3ab574['result'][_0xcddb('0x16')]);}})[_0xcddb('0x17')](function(_0x727f60){logger['error'](_0xcddb('0x10'),_0x3ee837,_0x727f60);_0x2bf5fc(_0x727f60);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 0ba257f..f28d9d9 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 _0x4c6c=['isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatProactiveAction.controller','/:id'];(function(_0x35a33c,_0x7975e){var _0x3b238d=function(_0x337552){while(--_0x337552){_0x35a33c['push'](_0x35a33c['shift']());}};_0x3b238d(++_0x7975e);}(_0x4c6c,0xb7));var _0xc4c6=function(_0x35ce3b,_0xa1b23d){_0x35ce3b=_0x35ce3b-0x0;var _0x5498ff=_0x4c6c[_0x35ce3b];return _0x5498ff;};'use strict';var multer=require(_0xc4c6('0x0'));var util=require(_0xc4c6('0x1'));var path=require(_0xc4c6('0x2'));var timeout=require(_0xc4c6('0x3'));var express=require(_0xc4c6('0x4'));var router=express[_0xc4c6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc4c6('0x6'));var config=require('../../config/environment');var controller=require(_0xc4c6('0x7'));router['get'](_0xc4c6('0x8'),auth[_0xc4c6('0x9')](),controller['show']);router[_0xc4c6('0xa')]('/',auth['isAuthenticated'](),controller[_0xc4c6('0xb')]);router[_0xc4c6('0xc')](_0xc4c6('0x8'),auth[_0xc4c6('0x9')](),controller['update']);router[_0xc4c6('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc4c6('0xe')]);module[_0xc4c6('0xf')]=router; \ No newline at end of file +var _0x46b9=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x336adb,_0x1c3608){var _0x5be7f5=function(_0x8cb90b){while(--_0x8cb90b){_0x336adb['push'](_0x336adb['shift']());}};_0x5be7f5(++_0x1c3608);}(_0x46b9,0x13e));var _0x946b=function(_0x2cbe24,_0x223538){_0x2cbe24=_0x2cbe24-0x0;var _0x9fab38=_0x46b9[_0x2cbe24];return _0x9fab38;};'use strict';var multer=require(_0x946b('0x0'));var util=require(_0x946b('0x1'));var path=require('path');var timeout=require(_0x946b('0x2'));var express=require(_0x946b('0x3'));var router=express[_0x946b('0x4')]();var auth=require(_0x946b('0x5'));var interaction=require(_0x946b('0x6'));var config=require(_0x946b('0x7'));var controller=require('./chatProactiveAction.controller');router[_0x946b('0x8')](_0x946b('0x9'),auth[_0x946b('0xa')](),controller['show']);router[_0x946b('0xb')]('/',auth[_0x946b('0xa')](),controller[_0x946b('0xc')]);router[_0x946b('0xd')](_0x946b('0x9'),auth[_0x946b('0xa')](),controller['update']);router[_0x946b('0xe')](_0x946b('0x9'),auth[_0x946b('0xa')](),controller[_0x946b('0xf')]);module[_0x946b('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 8b0e571..182009b 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 _0xc8c4=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc8c4,0x141));var _0x4c8c=function(_0x567703,_0x4b1cfa){_0x567703=_0x567703-0x0;var _0x1cd94a=_0xc8c4[_0x567703];return _0x1cd94a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4c8c('0x0')],'unique':_0x4c8c('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4c8c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4c8c('0x3')](_0x4c8c('0x4'),_0x4c8c('0x5'),_0x4c8c('0x6'))}}; \ No newline at end of file +var _0x8f78=['sequelize','exports','name','STRING','ENUM','beepall','roundrobin'];(function(_0x156a4d,_0x2d89eb){var _0x1b94b9=function(_0x2c14bc){while(--_0x2c14bc){_0x156a4d['push'](_0x156a4d['shift']());}};_0x1b94b9(++_0x2d89eb);}(_0x8f78,0xb6));var _0x88f7=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8f78[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x88f7('0x0'));module[_0x88f7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x88f7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x88f7('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x88f7('0x4')]('rrmemory',_0x88f7('0x5'),_0x88f7('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 97e3cfb..098dc07 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 _0x43b1=['tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatQueue.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','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','pick','merge','VIRTUAL','filter','options','ChatQueue','count','include','params','keys','includeAll','find','create','user','role','ChatQueues','autoAssociation','body','describe','getMembers','findOne','rawAttributes','length','order','ChatQueueId','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','userChatQueue:save','removeTeams','field'];(function(_0xaa2791,_0x468419){var _0x569690=function(_0x31a04c){while(--_0x31a04c){_0xaa2791['push'](_0xaa2791['shift']());}};_0x569690(++_0x468419);}(_0x43b1,0x155));var _0x143b=function(_0xbc6a31,_0x1dd0ce){_0xbc6a31=_0xbc6a31-0x0;var _0x3e5ea0=_0x43b1[_0xbc6a31];return _0x3e5ea0;};'use strict';var pdf=require(_0x143b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x143b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x143b('0x2'));var rp=require('request-promise');var moment=require(_0x143b('0x3'));var BPromise=require(_0x143b('0x4'));var Mustache=require(_0x143b('0x5'));var util=require(_0x143b('0x6'));var path=require(_0x143b('0x7'));var sox=require(_0x143b('0x8'));var csv=require(_0x143b('0x9'));var ejs=require(_0x143b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x143b('0xb'));var crypto=require(_0x143b('0xc'));var jsforce=require(_0x143b('0xd'));var deskjs=require(_0x143b('0xe'));var toCsv=require(_0x143b('0x9'));var querystring=require(_0x143b('0xf'));var Papa=require(_0x143b('0x10'));var Redis=require('ioredis');var authService=require(_0x143b('0x11'));var qs=require(_0x143b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x143b('0x13'));var logger=require(_0x143b('0x14'))(_0x143b('0x15'));var utils=require(_0x143b('0x16'));var config=require(_0x143b('0x17'));var db=require(_0x143b('0x18'))['db'];config['redis']=_[_0x143b('0x19')](config[_0x143b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x143b('0x1b'))(new Redis(config[_0x143b('0x1a')]));require(_0x143b('0x1c'))['register'](socket);var jayson=require(_0x143b('0x1d'));var client=jayson[_0x143b('0x1e')][_0x143b('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x106a07,_0x18680b,_0x4b4f45){if(_0x4b4f45){var _0x599d14=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x599d14[_0x143b('0x20')](_0x18680b)){return _0x106a07;}else{throw new db[(_0x143b('0x21'))][(_0x143b('0x22'))](_0x143b('0x23'));}}else{return _0x106a07;}}function respondWithRpcPromise(_0x392931,_0x12aa96,_0x12b789,_0xcbfb77){return new BPromise(function(_0x6869d1,_0x2abff2){var _0x5d02e1=_0xcbfb77||client;return _0x5d02e1[_0x143b('0x24')](_0x392931,_0x12b789)['then'](function(_0x5433b1){logger[_0x143b('0x25')](_0x143b('0x26'),_0x12aa96,_0x143b('0x27'));logger[_0x143b('0x28')](_0x143b('0x29'),_0x12aa96,'request\x20sent',JSON[_0x143b('0x2a')](_0x5433b1));if(_0x5433b1[_0x143b('0x2b')]){if(_0x5433b1['error'][_0x143b('0x2c')]===0x1f4){logger[_0x143b('0x2b')]('ChatQueue,\x20%s,\x20%s',_0x12aa96,_0x5433b1['error'][_0x143b('0x2d')]);return _0x2abff2(_0x5433b1[_0x143b('0x2b')][_0x143b('0x2d')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x12aa96,_0x5433b1[_0x143b('0x2b')][_0x143b('0x2d')]);return _0x6869d1(_0x5433b1[_0x143b('0x2b')][_0x143b('0x2d')]);}else{logger[_0x143b('0x25')](_0x143b('0x26'),_0x12aa96,_0x143b('0x27'));_0x6869d1(_0x5433b1[_0x143b('0x2e')][_0x143b('0x2d')]);}})[_0x143b('0x2f')](function(_0x3baa0e){logger[_0x143b('0x2b')](_0x143b('0x26'),_0x12aa96,_0x3baa0e);_0x2abff2(_0x3baa0e);});});}function respondWithStatusCode(_0x9b4f81,_0x5c9182){_0x5c9182=_0x5c9182||0xcc;return function(_0x360c43){if(_0x360c43){return _0x9b4f81[_0x143b('0x30')](_0x5c9182);}return _0x9b4f81[_0x143b('0x31')](_0x5c9182)[_0x143b('0x32')]();};}function respondWithResult(_0x3c4de6,_0x3600bf){_0x3600bf=_0x3600bf||0xc8;return function(_0x4c160a){if(_0x4c160a){return _0x3c4de6[_0x143b('0x31')](_0x3600bf)['json'](_0x4c160a);}};}function respondWithFilteredResult(_0x479a48,_0x3509c2){return function(_0x526aab){if(_0x526aab){var _0x1a68dd=_0x526aab['count'],_0x53a233=_0x3509c2['offset'],_0x4af8db=_0x3509c2['offset']+_0x3509c2[_0x143b('0x33')],_0x1bfef5;if(_0x4af8db>=_0x1a68dd){_0x4af8db=_0x1a68dd;_0x1bfef5=0xc8;}else{_0x1bfef5=0xce;}_0x479a48[_0x143b('0x31')](_0x1bfef5);return _0x479a48[_0x143b('0x34')](_0x143b('0x35'),_0x53a233+'-'+_0x4af8db+'/'+_0x1a68dd)[_0x143b('0x36')](_0x526aab);}return null;};}function patchUpdates(_0x54bdfd){return function(_0x29a341){try{jsonpatch[_0x143b('0x37')](_0x29a341,_0x54bdfd,!![]);}catch(_0x3b2fbe){return BPromise[_0x143b('0x38')](_0x3b2fbe);}return _0x29a341[_0x143b('0x39')]();};}function saveUpdates(_0x5dcb34,_0x5e5a5b){return function(_0x1728e2){if(_0x1728e2){return _0x1728e2[_0x143b('0x3a')](_0x5dcb34)[_0x143b('0x3b')](function(_0x3958e8){return _0x3958e8;});}return null;};}function removeEntity(_0x2f4ce4,_0x214f58){return function(_0x538664){if(_0x538664){return _0x538664[_0x143b('0x3c')]()['then'](function(){var _0x5f42eb=_0x538664[_0x143b('0x3d')]({'plain':!![]});var _0x40ea9a='ChatQueues';return db[_0x143b('0x3e')]['destroy']({'where':{'type':_0x40ea9a,'resourceId':_0x5f42eb['id']}})[_0x143b('0x3b')](function(){return _0x538664;});})[_0x143b('0x3b')](function(){_0x2f4ce4[_0x143b('0x31')](0xcc)[_0x143b('0x32')]();});}};}function handleEntityNotFound(_0x3bc679,_0x153b6d){return function(_0x5a7f33){if(!_0x5a7f33){_0x3bc679['sendStatus'](0x194);}return _0x5a7f33;};}function handleError(_0x5b5d05,_0x141e6d){_0x141e6d=_0x141e6d||0x1f4;return function(_0x2f7a2a){logger['error'](_0x2f7a2a[_0x143b('0x3f')]);if(_0x2f7a2a['name']){delete _0x2f7a2a[_0x143b('0x40')];}_0x5b5d05['status'](_0x141e6d)[_0x143b('0x41')](_0x2f7a2a);};}exports['index']=function(_0x6f95e0,_0x1737dd){var _0x4fba26={},_0x3d3388={},_0x5d7293={'count':0x0,'rows':[]};var _0x1ecbb2=_['map'](db['ChatQueue']['rawAttributes'],function(_0x214f35){return{'name':_0x214f35[_0x143b('0x42')],'type':_0x214f35[_0x143b('0x43')][_0x143b('0x44')]};});_0x3d3388[_0x143b('0x45')]=_[_0x143b('0x46')](_0x1ecbb2,_0x143b('0x40'));_0x3d3388[_0x143b('0x47')]=_['keys'](_0x6f95e0[_0x143b('0x47')]);_0x3d3388[_0x143b('0x48')]=_[_0x143b('0x49')](_0x3d3388[_0x143b('0x45')],_0x3d3388[_0x143b('0x47')]);_0x4fba26[_0x143b('0x4a')]=_['intersection'](_0x3d3388[_0x143b('0x45')],qs['fields'](_0x6f95e0['query'][_0x143b('0x4b')]));_0x4fba26[_0x143b('0x4a')]=_0x4fba26[_0x143b('0x4a')]['length']?_0x4fba26[_0x143b('0x4a')]:_0x3d3388[_0x143b('0x45')];if(!_0x6f95e0['query'][_0x143b('0x4c')](_0x143b('0x4d'))){_0x4fba26[_0x143b('0x33')]=qs[_0x143b('0x33')](_0x6f95e0['query'][_0x143b('0x33')]);_0x4fba26['offset']=qs['offset'](_0x6f95e0[_0x143b('0x47')][_0x143b('0x4e')]);}_0x4fba26['order']=qs[_0x143b('0x4f')](_0x6f95e0[_0x143b('0x47')][_0x143b('0x4f')]);_0x4fba26[_0x143b('0x50')]=qs[_0x143b('0x48')](_[_0x143b('0x51')](_0x6f95e0[_0x143b('0x47')],_0x3d3388[_0x143b('0x48')]),_0x1ecbb2);if(_0x6f95e0[_0x143b('0x47')]['filter']){_0x4fba26[_0x143b('0x50')]=_[_0x143b('0x52')](_0x4fba26[_0x143b('0x50')],{'$or':_[_0x143b('0x46')](_0x1ecbb2,function(_0x3a479d){if(_0x3a479d['type']!==_0x143b('0x53')){var _0x199efc={};_0x199efc[_0x3a479d[_0x143b('0x40')]]={'$like':'%'+_0x6f95e0[_0x143b('0x47')][_0x143b('0x54')]+'%'};return _0x199efc;}})});}_0x4fba26=_['merge']({},_0x4fba26,_0x6f95e0[_0x143b('0x55')]);var _0x5b6a5c={'where':_0x4fba26[_0x143b('0x50')]};return db[_0x143b('0x56')][_0x143b('0x57')](_0x5b6a5c)[_0x143b('0x3b')](function(_0x515421){_0x5d7293[_0x143b('0x57')]=_0x515421;if(_0x6f95e0[_0x143b('0x47')]['includeAll']){_0x4fba26[_0x143b('0x58')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x4fba26);})['then'](function(_0x46705e){_0x5d7293['rows']=_0x46705e;return _0x5d7293;})[_0x143b('0x3b')](respondWithFilteredResult(_0x1737dd,_0x4fba26))[_0x143b('0x2f')](handleError(_0x1737dd,null));};exports['show']=function(_0x386fdc,_0x57c930){var _0x1ce4f6={'raw':!![],'where':{'id':_0x386fdc[_0x143b('0x59')]['id']}},_0x5a6233={};_0x5a6233[_0x143b('0x45')]=_[_0x143b('0x5a')](db[_0x143b('0x56')]['rawAttributes']);_0x5a6233[_0x143b('0x47')]=_[_0x143b('0x5a')](_0x386fdc[_0x143b('0x47')]);_0x5a6233['filters']=_[_0x143b('0x49')](_0x5a6233['model'],_0x5a6233[_0x143b('0x47')]);_0x1ce4f6[_0x143b('0x4a')]=_[_0x143b('0x49')](_0x5a6233[_0x143b('0x45')],qs[_0x143b('0x4b')](_0x386fdc['query']['fields']));_0x1ce4f6[_0x143b('0x4a')]=_0x1ce4f6['attributes']['length']?_0x1ce4f6[_0x143b('0x4a')]:_0x5a6233[_0x143b('0x45')];if(_0x386fdc[_0x143b('0x47')][_0x143b('0x5b')]){_0x1ce4f6[_0x143b('0x58')]=[{'all':!![]}];}_0x1ce4f6=_[_0x143b('0x52')]({},_0x1ce4f6,_0x386fdc[_0x143b('0x55')]);return db[_0x143b('0x56')][_0x143b('0x5c')](_0x1ce4f6)[_0x143b('0x3b')](handleEntityNotFound(_0x57c930,null))[_0x143b('0x3b')](respondWithResult(_0x57c930,null))[_0x143b('0x2f')](handleError(_0x57c930,null));};exports[_0x143b('0x5d')]=function(_0x5aeb5a,_0x4e8690){return db['ChatQueue'][_0x143b('0x5d')](_0x5aeb5a['body'],{})[_0x143b('0x3b')](function(_0x123ddf){var _0x3c3ffc=_0x5aeb5a[_0x143b('0x5e')][_0x143b('0x3d')]({'plain':!![]});if(!_0x3c3ffc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c3ffc[_0x143b('0x5f')]===_0x143b('0x5e')){var _0x13a1cd=_0x123ddf[_0x143b('0x3d')]({'plain':!![]});var _0x273cfa=_0x143b('0x60');return db['UserProfileSection']['find']({'where':{'name':_0x273cfa,'userProfileId':_0x3c3ffc['userProfileId']},'raw':!![]})['then'](function(_0x3219d0){if(_0x3219d0&&_0x3219d0[_0x143b('0x61')]===0x0){return db[_0x143b('0x3e')][_0x143b('0x5d')]({'name':_0x13a1cd[_0x143b('0x40')],'resourceId':_0x13a1cd['id'],'type':_0x3219d0['name'],'sectionId':_0x3219d0['id']},{})[_0x143b('0x3b')](function(){return _0x123ddf;});}else{return _0x123ddf;}})[_0x143b('0x2f')](function(_0x2c4436){logger[_0x143b('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c4436);throw _0x2c4436;});}return _0x123ddf;})['then'](respondWithResult(_0x4e8690,0xc9))['catch'](handleError(_0x4e8690,null));};exports['update']=function(_0x2ae08e,_0x3dcf28){if(_0x2ae08e[_0x143b('0x62')]['id']){delete _0x2ae08e[_0x143b('0x62')]['id'];}return db[_0x143b('0x56')][_0x143b('0x5c')]({'where':{'id':_0x2ae08e[_0x143b('0x59')]['id']}})[_0x143b('0x3b')](handleEntityNotFound(_0x3dcf28,null))['then'](saveUpdates(_0x2ae08e[_0x143b('0x62')],null))[_0x143b('0x3b')](respondWithResult(_0x3dcf28,null))[_0x143b('0x2f')](handleError(_0x3dcf28,null));};exports['destroy']=function(_0x4ddfe1,_0x17fa77){return db[_0x143b('0x56')][_0x143b('0x5c')]({'where':{'id':_0x4ddfe1[_0x143b('0x59')]['id']}})['then'](handleEntityNotFound(_0x17fa77,null))[_0x143b('0x3b')](removeEntity(_0x17fa77,null))[_0x143b('0x2f')](handleError(_0x17fa77,null));};exports['describe']=function(_0x147794,_0x11215e){return db['ChatQueue'][_0x143b('0x63')]()[_0x143b('0x3b')](respondWithResult(_0x11215e,null))[_0x143b('0x2f')](handleError(_0x11215e,null));};exports[_0x143b('0x64')]=function(_0x33eae1,_0xddff3c,_0x5957a4){var _0x34ec5e={'raw':!![],'where':{}},_0x18dc07={},_0x395cf7;return db[_0x143b('0x56')][_0x143b('0x65')]({'where':{'id':_0x33eae1['params']['id']}})['then'](handleEntityNotFound(_0xddff3c,null))[_0x143b('0x3b')](function(_0x1ba975){if(_0x1ba975){_0x395cf7=_0x1ba975[_0x143b('0x3d')]({'plain':!![]});_0x18dc07[_0x143b('0x45')]=_[_0x143b('0x5a')](db['UserChatQueue'][_0x143b('0x66')]);_0x18dc07[_0x143b('0x47')]=_[_0x143b('0x5a')](_0x33eae1[_0x143b('0x47')]);_0x18dc07['filters']=_[_0x143b('0x49')](_0x18dc07[_0x143b('0x45')],_0x18dc07[_0x143b('0x47')]);_0x34ec5e[_0x143b('0x4a')]=_['intersection'](_0x18dc07[_0x143b('0x45')],qs[_0x143b('0x4b')](_0x33eae1['query'][_0x143b('0x4b')]));_0x34ec5e[_0x143b('0x4a')]=_0x34ec5e[_0x143b('0x4a')][_0x143b('0x67')]?_0x34ec5e[_0x143b('0x4a')]:_0x18dc07['model'];if(!_0x33eae1[_0x143b('0x47')][_0x143b('0x4c')](_0x143b('0x4d'))){_0x34ec5e['limit']=qs[_0x143b('0x33')](_0x33eae1['query'][_0x143b('0x33')]);_0x34ec5e['offset']=qs[_0x143b('0x4e')](_0x33eae1[_0x143b('0x47')][_0x143b('0x4e')]);}_0x34ec5e[_0x143b('0x68')]=qs[_0x143b('0x4f')](_0x33eae1[_0x143b('0x47')]['sort']);_0x34ec5e['where']=qs[_0x143b('0x48')](_[_0x143b('0x51')](_0x33eae1['query'],_0x18dc07[_0x143b('0x48')]));_0x34ec5e[_0x143b('0x50')][_0x143b('0x69')]=_0x1ba975['id'];if(_0x33eae1[_0x143b('0x47')]['filter']){_0x34ec5e[_0x143b('0x50')]=_[_0x143b('0x52')](_0x34ec5e[_0x143b('0x50')],{'$or':_['map'](_0x34ec5e[_0x143b('0x4a')],function(_0x585ae9){var _0xa6556e={};_0xa6556e[_0x585ae9]={'$like':'%'+_0x33eae1['query'][_0x143b('0x54')]+'%'};return _0xa6556e;})});}_0x34ec5e=_[_0x143b('0x52')]({},_0x34ec5e,_0x33eae1['options']);return db[_0x143b('0x6a')][_0x143b('0x6b')](_0x34ec5e);}})['then'](function(_0x5c6c46){if(_0x5c6c46){return db[_0x143b('0x6c')][_0x143b('0x6d')]({'where':{'id':_['map'](_0x5c6c46,_0x143b('0x6e')),'role':_0x143b('0x6f')},'attributes':['id',_0x143b('0x40'),_0x143b('0x70'),_0x143b('0x71'),_0x143b('0x72')]});}})['then'](function(_0x47dc69){if(_0x47dc69){return{'count':_0x47dc69[_0x143b('0x57')],'rows':_[_0x143b('0x46')](_0x47dc69[_0x143b('0x73')],function(_0x46ec77){return{'membername':_0x46ec77[_0x143b('0x40')],'UserId':_0x46ec77['id'],'queue_name':_0x395cf7[_0x143b('0x40')],'ChatQueueId':_0x395cf7['id'],'interface':util[_0x143b('0x74')]('%s/%s',_0x143b('0x75'),_0x46ec77['name']),'penalty':0x0,'paused':_0x46ec77['chatPause'],'createdAt':_0x46ec77[_0x143b('0x72')],'updatedAt':_0x46ec77[_0x143b('0x71')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x143b('0x3b')](respondWithFilteredResult(_0xddff3c,_0x34ec5e))[_0x143b('0x2f')](handleError(_0xddff3c,null));};exports[_0x143b('0x76')]=function(_0x202e7a,_0x52e49e,_0x41cabb){var _0x4df430={};var _0x4e908d={};var _0x1bcc8c;var _0x3c666e;return db[_0x143b('0x56')]['findOne']({'where':{'id':_0x202e7a[_0x143b('0x59')]['id']}})[_0x143b('0x3b')](handleEntityNotFound(_0x52e49e,null))[_0x143b('0x3b')](function(_0x5f2506){if(_0x5f2506){_0x1bcc8c=_0x5f2506;_0x4e908d['model']=_[_0x143b('0x5a')](db[_0x143b('0x77')]['rawAttributes']);_0x4e908d[_0x143b('0x47')]=_[_0x143b('0x5a')](_0x202e7a['query']);_0x4e908d[_0x143b('0x48')]=_[_0x143b('0x49')](_0x4e908d[_0x143b('0x45')],_0x4e908d['query']);_0x4df430[_0x143b('0x4a')]=_['intersection'](_0x4e908d[_0x143b('0x45')],qs[_0x143b('0x4b')](_0x202e7a['query'][_0x143b('0x4b')]));_0x4df430[_0x143b('0x4a')]=_0x4df430[_0x143b('0x4a')]['length']?_0x4df430[_0x143b('0x4a')]:_0x4e908d['model'];_0x4df430['order']=qs[_0x143b('0x4f')](_0x202e7a['query']['sort']);_0x4df430[_0x143b('0x50')]=qs['filters'](_[_0x143b('0x51')](_0x202e7a['query'],_0x4e908d[_0x143b('0x48')]));if(_0x202e7a['query'][_0x143b('0x54')]){_0x4df430[_0x143b('0x50')]=_['merge'](_0x4df430[_0x143b('0x50')],{'$or':_[_0x143b('0x46')](_0x4df430[_0x143b('0x4a')],function(_0x1bc89e){var _0xacaa64={};_0xacaa64[_0x1bc89e]={'$like':'%'+_0x202e7a['query']['filter']+'%'};return _0xacaa64;})});}_0x4df430=_[_0x143b('0x52')]({},_0x4df430,_0x202e7a[_0x143b('0x55')]);return _0x1bcc8c[_0x143b('0x76')](_0x4df430);}})[_0x143b('0x3b')](function(_0x9f9872){if(_0x9f9872){_0x3c666e=_0x9f9872[_0x143b('0x67')];if(!_0x202e7a[_0x143b('0x47')][_0x143b('0x4c')](_0x143b('0x4d'))){_0x4df430[_0x143b('0x33')]=qs[_0x143b('0x33')](_0x202e7a[_0x143b('0x47')][_0x143b('0x33')]);_0x4df430[_0x143b('0x4e')]=qs['offset'](_0x202e7a[_0x143b('0x47')][_0x143b('0x4e')]);}return _0x1bcc8c[_0x143b('0x76')](_0x4df430);}})[_0x143b('0x3b')](function(_0x24a1cc){if(_0x24a1cc){return _0x24a1cc?{'count':_0x3c666e,'rows':_0x24a1cc}:null;}})[_0x143b('0x3b')](respondWithResult(_0x52e49e,null))[_0x143b('0x2f')](handleError(_0x52e49e,null));};exports[_0x143b('0x78')]=function(_0x96fae9,_0x11ed93,_0x497fee){var _0x500c81=_0x96fae9[_0x143b('0x62')][_0x143b('0x79')];return db['Team'][_0x143b('0x6b')]({'where':{'id':_0x500c81},'attributes':['id'],'include':[{'model':db[_0x143b('0x6c')],'as':_0x143b('0x7a'),'attributes':['id',_0x143b('0x40'),_0x143b('0x7b'),_0x143b('0x7c'),_0x143b('0x7d')],'raw':!![]}]})[_0x143b('0x3b')](function(_0x49b297){if(_0x49b297){var _0x43d355=_['flatMap'](_0x49b297,function(_0xd876d0){var _0x56d414=_0xd876d0[_0x143b('0x3d')]({'plain':!![]});return _0x56d414[_0x143b('0x7a')];});return db[_0x143b('0x56')][_0x143b('0x5c')]({'where':{'id':_0x96fae9[_0x143b('0x59')]['id']}})['then'](function(_0x2db893){return db[_0x143b('0x7e')][_0x143b('0x7f')](function(_0x3a16c9){return _0x2db893['addTeams'](_0x500c81,{'transaction':_0x3a16c9})[_0x143b('0x3b')](function(){return BPromise['each'](_0x43d355,function(_0x4854d7){return db[_0x143b('0x6a')][_0x143b('0x80')]({'where':{'UserId':_0x4854d7['id'],'ChatQueueId':_0x96fae9[_0x143b('0x59')]['id']},'transaction':_0x3a16c9});});})['then'](function(){_0x43d355[_0x143b('0x81')](function(_0x5afd73){socket['emit'](_0x143b('0x82'),{'UserId':_0x5afd73['id'],'ChatQueueId':_0x2db893['id']});});});});});}})[_0x143b('0x3b')](respondWithStatusCode(_0x11ed93,null))['catch'](handleError(_0x11ed93,null));};exports[_0x143b('0x83')]=function(_0x5f51d4,_0xb6169e,_0x2a6322){return db[_0x143b('0x77')][_0x143b('0x6b')]({'where':{'id':_0x5f51d4['query'][_0x143b('0x79')]},'attributes':['id'],'include':[{'model':db[_0x143b('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x143b('0x3b')](handleEntityNotFound(_0xb6169e,null))['then'](function(_0x4c2afa){var _0x3e650c=_[_0x143b('0x46')](_0x4c2afa,'id');var _0x33b6df=[];var _0x5d96d7=[];var _0x5918d4=squel['select']();_0x5918d4[_0x143b('0x84')](_0x143b('0x85'))['from'](_0x143b('0x86'),'tq')[_0x143b('0x87')](_0x143b('0x88'),'ut',_0x143b('0x89'))[_0x143b('0x50')]('ChatQueueId\x20=\x20?',_0x5f51d4[_0x143b('0x59')]['id']);for(var _0x5a1b6c=0x0;_0x5a1b6c<_0x4c2afa[_0x143b('0x67')];_0x5a1b6c+=0x1){let _0x5d4bf3=_0x4c2afa[_0x5a1b6c];for(var _0x480904=0x0;_0x480904<_0x5d4bf3['Agents'][_0x143b('0x67')];_0x480904+=0x1){let _0x5254e3=_0x5d4bf3[_0x143b('0x7a')][_0x480904];var _0x362d05=_0x5918d4['clone']();_0x362d05[_0x143b('0x50')](_0x143b('0x8a'),_0x5254e3['id']);_0x5d96d7[_0x143b('0x8b')](db[_0x143b('0x7e')]['query'](_0x362d05[_0x143b('0x8c')](),{'type':db['sequelize'][_0x143b('0x8d')][_0x143b('0x8e')]})[_0x143b('0x3b')](function(_0x253696){if(_0x253696['length']===0x1){return _0x5254e3['id'];}else{var _0x462c39=_[_0x143b('0x8f')](_[_0x143b('0x46')](_0x253696,_0x143b('0x90')),function(_0x19c125){return _[_0x143b('0x91')](_0x3e650c,_0x19c125);});if(_0x462c39){return _0x5254e3['id'];}}}));}}return BPromise[_0x143b('0x92')](_0x5d96d7)[_0x143b('0x3b')](function(_0x2aae02){_0x33b6df=_(_0x33b6df)['union'](_0x2aae02)[_0x143b('0x93')]()[_0x143b('0x94')]();return db[_0x143b('0x56')][_0x143b('0x5c')]({'where':{'id':_0x5f51d4['params']['id']}})[_0x143b('0x3b')](function(_0x1e1e6c){return db[_0x143b('0x7e')][_0x143b('0x7f')](function(_0x5ef51e){return _0x1e1e6c[_0x143b('0x83')](_0x5f51d4[_0x143b('0x47')][_0x143b('0x79')],{'transaction':_0x5ef51e})[_0x143b('0x3b')](function(){if(!_[_0x143b('0x95')](_0x33b6df)){return _0x1e1e6c[_0x143b('0x96')](_0x33b6df,{'transaction':_0x5ef51e});}})['then'](function(){_0x33b6df[_0x143b('0x81')](function(_0x22b252){socket[_0x143b('0x97')](_0x143b('0x98'),{'UserId':_0x22b252,'ChatQueueId':_0x1e1e6c['id']});});});});});});})['then'](respondWithStatusCode(_0xb6169e,null))[_0x143b('0x2f')](handleError(_0xb6169e,null));};exports['addAgents']=function(_0x2a8aeb,_0x548f0a,_0x222ce4){return db['ChatQueue'][_0x143b('0x5c')]({'where':{'id':_0x2a8aeb[_0x143b('0x59')]['id']}})[_0x143b('0x3b')](handleEntityNotFound(_0x548f0a,null))[_0x143b('0x3b')](function(_0x24c4d2){if(_0x24c4d2){return _0x24c4d2[_0x143b('0x99')](_0x2a8aeb['body'][_0x143b('0x79')],_[_0x143b('0x9a')](_0x2a8aeb[_0x143b('0x62')],[_0x143b('0x79'),'id'])||{})[_0x143b('0x9b')](function(_0x523617){for(var _0x313a5f=0x0;_0x313a5f<_0x2a8aeb[_0x143b('0x62')][_0x143b('0x79')][_0x143b('0x67')];_0x313a5f+=0x1){socket[_0x143b('0x97')]('userChatQueue:save',{'UserId':_0x2a8aeb[_0x143b('0x62')][_0x143b('0x79')][_0x313a5f],'ChatQueueId':_0x2a8aeb[_0x143b('0x59')]['id']});}return _0x523617;});}})['then'](respondWithResult(_0x548f0a,null))[_0x143b('0x2f')](handleError(_0x548f0a,null));};exports[_0x143b('0x96')]=function(_0x26c6b2,_0x103f6b,_0x514474){return db[_0x143b('0x56')][_0x143b('0x5c')]({'where':{'id':_0x26c6b2[_0x143b('0x59')]['id']}})[_0x143b('0x3b')](handleEntityNotFound(_0x103f6b,null))['then'](function(_0x1f61ee){if(_0x1f61ee){return _0x1f61ee['removeAgents'](_0x26c6b2[_0x143b('0x47')][_0x143b('0x79')])[_0x143b('0x3b')](function(){if(_[_0x143b('0x9c')](_0x26c6b2['query'][_0x143b('0x79')])){for(var _0x340f99=0x0;_0x340f99<_0x26c6b2[_0x143b('0x47')][_0x143b('0x79')][_0x143b('0x67')];_0x340f99+=0x1){socket['emit'](_0x143b('0x98'),{'UserId':Number(_0x26c6b2['query']['ids'][_0x340f99]),'ChatQueueId':Number(_0x26c6b2[_0x143b('0x59')]['id'])});}}else{socket[_0x143b('0x97')](_0x143b('0x98'),{'UserId':Number(_0x26c6b2['query'][_0x143b('0x79')]),'ChatQueueId':Number(_0x26c6b2['params']['id'])});}});}})[_0x143b('0x3b')](respondWithStatusCode(_0x103f6b,null))[_0x143b('0x2f')](handleError(_0x103f6b,null));};exports[_0x143b('0x9d')]=function(_0x422c93,_0x30b1da,_0x4bbe2e){var _0x129ec6={};var _0x31fe0e={};var _0x79fc8d;var _0x3d637f;return db[_0x143b('0x56')][_0x143b('0x65')]({'where':{'id':_0x422c93[_0x143b('0x59')]['id']}})['then'](handleEntityNotFound(_0x30b1da,null))['then'](function(_0x3f403a){if(_0x3f403a){_0x79fc8d=_0x3f403a;_0x31fe0e[_0x143b('0x45')]=_[_0x143b('0x5a')](db[_0x143b('0x6c')]['rawAttributes']);_0x31fe0e[_0x143b('0x47')]=_['keys'](_0x422c93['query']);_0x31fe0e[_0x143b('0x48')]=_[_0x143b('0x49')](_0x31fe0e[_0x143b('0x45')],_0x31fe0e['query']);_0x129ec6[_0x143b('0x4a')]=_['intersection'](_0x31fe0e[_0x143b('0x45')],qs['fields'](_0x422c93['query'][_0x143b('0x4b')]));_0x129ec6[_0x143b('0x4a')]=_0x129ec6[_0x143b('0x4a')][_0x143b('0x67')]?_0x129ec6[_0x143b('0x4a')]:_0x31fe0e[_0x143b('0x45')];_0x129ec6[_0x143b('0x68')]=qs[_0x143b('0x4f')](_0x422c93['query'][_0x143b('0x4f')]);_0x129ec6[_0x143b('0x50')]=qs[_0x143b('0x48')](_[_0x143b('0x51')](_0x422c93[_0x143b('0x47')],_0x31fe0e[_0x143b('0x48')]));if(_0x422c93[_0x143b('0x47')][_0x143b('0x54')]){_0x129ec6[_0x143b('0x50')]=_[_0x143b('0x52')](_0x129ec6[_0x143b('0x50')],{'$or':_[_0x143b('0x46')](_0x129ec6[_0x143b('0x4a')],function(_0x3f4110){var _0x2303b9={};_0x2303b9[_0x3f4110]={'$like':'%'+_0x422c93[_0x143b('0x47')]['filter']+'%'};return _0x2303b9;})});}_0x129ec6=_[_0x143b('0x52')]({},_0x129ec6,_0x422c93[_0x143b('0x55')]);return _0x79fc8d[_0x143b('0x9d')](_0x129ec6);}})['then'](function(_0x3741f6){if(_0x3741f6){_0x3d637f=_0x3741f6[_0x143b('0x67')];if(!_0x422c93['query']['hasOwnProperty']('nolimit')){_0x129ec6[_0x143b('0x33')]=qs[_0x143b('0x33')](_0x422c93['query'][_0x143b('0x33')]);_0x129ec6[_0x143b('0x4e')]=qs[_0x143b('0x4e')](_0x422c93[_0x143b('0x47')]['offset']);}return _0x79fc8d[_0x143b('0x9d')](_0x129ec6);}})[_0x143b('0x3b')](function(_0xae0a4f){if(_0xae0a4f){return _0xae0a4f?{'count':_0x3d637f,'rows':_0xae0a4f}:null;}})[_0x143b('0x3b')](respondWithResult(_0x30b1da,null))[_0x143b('0x2f')](handleError(_0x30b1da,null));}; \ No newline at end of file +var _0x646d=['ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','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','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','socket.io-emitter','./chatQueue.socket','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~!@#$%^&-_=+[{]}.','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','index','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','ChatQueue','includeAll','findAll','catch','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','options','User','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams'];(function(_0x386d0d,_0x23562c){var _0x2ad901=function(_0x36a5aa){while(--_0x36a5aa){_0x386d0d['push'](_0x386d0d['shift']());}};_0x2ad901(++_0x23562c);}(_0x646d,0xbd));var _0xd646=function(_0x36c962,_0x147dfb){_0x36c962=_0x36c962-0x0;var _0x58a4c4=_0x646d[_0x36c962];return _0x58a4c4;};'use strict';var pdf=require(_0xd646('0x0'));var emlformat=require(_0xd646('0x1'));var rimraf=require(_0xd646('0x2'));var zipdir=require(_0xd646('0x3'));var jsonpatch=require(_0xd646('0x4'));var rp=require(_0xd646('0x5'));var moment=require('moment');var BPromise=require(_0xd646('0x6'));var Mustache=require(_0xd646('0x7'));var util=require(_0xd646('0x8'));var path=require(_0xd646('0x9'));var sox=require(_0xd646('0xa'));var csv=require(_0xd646('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd646('0xc'));var squel=require(_0xd646('0xd'));var crypto=require('crypto');var jsforce=require(_0xd646('0xe'));var deskjs=require(_0xd646('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd646('0x10'));var Papa=require('papaparse');var Redis=require(_0xd646('0x11'));var authService=require(_0xd646('0x12'));var qs=require(_0xd646('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd646('0x14'))('api');var utils=require(_0xd646('0x15'));var config=require('../../config/environment');var db=require(_0xd646('0x16'))['db'];config[_0xd646('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd646('0x18'))(new Redis(config[_0xd646('0x17')]));require(_0xd646('0x19'))['register'](socket);var jayson=require(_0xd646('0x1a'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1fe07f,_0x3b4591,_0x5655f0){if(_0x5655f0){var _0x35dcb8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35dcb8['test'](_0x3b4591)){return _0x1fe07f;}else{throw new db[(_0xd646('0x1b'))][(_0xd646('0x1c'))](_0xd646('0x1d'));}}else{return _0x1fe07f;}}function respondWithRpcPromise(_0x14cf3d,_0x476830,_0x4a0df0,_0x21a9a0){return new BPromise(function(_0x256606,_0x596334){var _0x3f9bc3=_0x21a9a0||client;return _0x3f9bc3[_0xd646('0x1e')](_0x14cf3d,_0x4a0df0)[_0xd646('0x1f')](function(_0x191f95){logger['info'](_0xd646('0x20'),_0x476830,_0xd646('0x21'));logger[_0xd646('0x22')](_0xd646('0x23'),_0x476830,_0xd646('0x21'),JSON[_0xd646('0x24')](_0x191f95));if(_0x191f95['error']){if(_0x191f95['error'][_0xd646('0x25')]===0x1f4){logger[_0xd646('0x26')](_0xd646('0x20'),_0x476830,_0x191f95[_0xd646('0x26')]['message']);return _0x596334(_0x191f95[_0xd646('0x26')][_0xd646('0x27')]);}logger[_0xd646('0x26')](_0xd646('0x20'),_0x476830,_0x191f95[_0xd646('0x26')][_0xd646('0x27')]);return _0x256606(_0x191f95['error'][_0xd646('0x27')]);}else{logger[_0xd646('0x28')](_0xd646('0x20'),_0x476830,_0xd646('0x21'));_0x256606(_0x191f95[_0xd646('0x29')][_0xd646('0x27')]);}})['catch'](function(_0x34f3b1){logger[_0xd646('0x26')](_0xd646('0x20'),_0x476830,_0x34f3b1);_0x596334(_0x34f3b1);});});}function respondWithStatusCode(_0x16aadc,_0x39d2b4){_0x39d2b4=_0x39d2b4||0xcc;return function(_0x59d37a){if(_0x59d37a){return _0x16aadc[_0xd646('0x2a')](_0x39d2b4);}return _0x16aadc[_0xd646('0x2b')](_0x39d2b4)['end']();};}function respondWithResult(_0x9e6278,_0x53ae00){_0x53ae00=_0x53ae00||0xc8;return function(_0x2dfcdb){if(_0x2dfcdb){return _0x9e6278['status'](_0x53ae00)[_0xd646('0x2c')](_0x2dfcdb);}};}function respondWithFilteredResult(_0x2d0081,_0x3aa9c7){return function(_0x59cd43){if(_0x59cd43){var _0x21a282=_0x59cd43[_0xd646('0x2d')],_0x1c6b2d=_0x3aa9c7[_0xd646('0x2e')],_0x3b005f=_0x3aa9c7[_0xd646('0x2e')]+_0x3aa9c7[_0xd646('0x2f')],_0x4c3b54;if(_0x3b005f>=_0x21a282){_0x3b005f=_0x21a282;_0x4c3b54=0xc8;}else{_0x4c3b54=0xce;}_0x2d0081[_0xd646('0x2b')](_0x4c3b54);return _0x2d0081['set'](_0xd646('0x30'),_0x1c6b2d+'-'+_0x3b005f+'/'+_0x21a282)[_0xd646('0x2c')](_0x59cd43);}return null;};}function patchUpdates(_0x1d2a6c){return function(_0x5d8da8){try{jsonpatch[_0xd646('0x31')](_0x5d8da8,_0x1d2a6c,!![]);}catch(_0x5980f4){return BPromise[_0xd646('0x32')](_0x5980f4);}return _0x5d8da8[_0xd646('0x33')]();};}function saveUpdates(_0x2f7fe3,_0x15ec89){return function(_0x6ca5b2){if(_0x6ca5b2){return _0x6ca5b2[_0xd646('0x34')](_0x2f7fe3)[_0xd646('0x1f')](function(_0x15e48b){return _0x15e48b;});}return null;};}function removeEntity(_0x34f1f2,_0x4beb43){return function(_0x3545af){if(_0x3545af){return _0x3545af[_0xd646('0x35')]()[_0xd646('0x1f')](function(){var _0x39febb=_0x3545af['get']({'plain':!![]});var _0x5b643f='ChatQueues';return db[_0xd646('0x36')]['destroy']({'where':{'type':_0x5b643f,'resourceId':_0x39febb['id']}})[_0xd646('0x1f')](function(){return _0x3545af;});})[_0xd646('0x1f')](function(){_0x34f1f2[_0xd646('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ffcaf,_0x2e1b09){return function(_0x683e47){if(!_0x683e47){_0x2ffcaf[_0xd646('0x2a')](0x194);}return _0x683e47;};}function handleError(_0xbb5232,_0x5560f6){_0x5560f6=_0x5560f6||0x1f4;return function(_0x436e11){logger[_0xd646('0x26')](_0x436e11[_0xd646('0x37')]);if(_0x436e11['name']){delete _0x436e11[_0xd646('0x38')];}_0xbb5232[_0xd646('0x2b')](_0x5560f6)[_0xd646('0x39')](_0x436e11);};}exports[_0xd646('0x3a')]=function(_0x9384d,_0x4096ec){var _0x1293f8={},_0x19bcf8={},_0x27d321={'count':0x0,'rows':[]};var _0x3b8670=_['map'](db['ChatQueue'][_0xd646('0x3b')],function(_0x586f2a){return{'name':_0x586f2a['fieldName'],'type':_0x586f2a[_0xd646('0x3c')]['key']};});_0x19bcf8[_0xd646('0x3d')]=_[_0xd646('0x3e')](_0x3b8670,'name');_0x19bcf8['query']=_[_0xd646('0x3f')](_0x9384d[_0xd646('0x40')]);_0x19bcf8[_0xd646('0x41')]=_[_0xd646('0x42')](_0x19bcf8[_0xd646('0x3d')],_0x19bcf8['query']);_0x1293f8['attributes']=_[_0xd646('0x42')](_0x19bcf8[_0xd646('0x3d')],qs[_0xd646('0x43')](_0x9384d[_0xd646('0x40')]['fields']));_0x1293f8[_0xd646('0x44')]=_0x1293f8[_0xd646('0x44')]['length']?_0x1293f8[_0xd646('0x44')]:_0x19bcf8[_0xd646('0x3d')];if(!_0x9384d['query'][_0xd646('0x45')](_0xd646('0x46'))){_0x1293f8['limit']=qs['limit'](_0x9384d[_0xd646('0x40')][_0xd646('0x2f')]);_0x1293f8[_0xd646('0x2e')]=qs['offset'](_0x9384d['query']['offset']);}_0x1293f8[_0xd646('0x47')]=qs[_0xd646('0x48')](_0x9384d[_0xd646('0x40')]['sort']);_0x1293f8[_0xd646('0x49')]=qs[_0xd646('0x41')](_[_0xd646('0x4a')](_0x9384d[_0xd646('0x40')],_0x19bcf8[_0xd646('0x41')]),_0x3b8670);if(_0x9384d[_0xd646('0x40')][_0xd646('0x4b')]){_0x1293f8[_0xd646('0x49')]=_['merge'](_0x1293f8[_0xd646('0x49')],{'$or':_[_0xd646('0x3e')](_0x3b8670,function(_0xd5fcc3){if(_0xd5fcc3[_0xd646('0x3c')]!==_0xd646('0x4c')){var _0x256479={};_0x256479[_0xd5fcc3[_0xd646('0x38')]]={'$like':'%'+_0x9384d['query'][_0xd646('0x4b')]+'%'};return _0x256479;}})});}_0x1293f8=_[_0xd646('0x4d')]({},_0x1293f8,_0x9384d['options']);var _0x47b18a={'where':_0x1293f8[_0xd646('0x49')]};return db[_0xd646('0x4e')][_0xd646('0x2d')](_0x47b18a)['then'](function(_0x1d22be){_0x27d321['count']=_0x1d22be;if(_0x9384d['query'][_0xd646('0x4f')]){_0x1293f8['include']=[{'all':!![]}];}return db[_0xd646('0x4e')][_0xd646('0x50')](_0x1293f8);})[_0xd646('0x1f')](function(_0x511b82){_0x27d321['rows']=_0x511b82;return _0x27d321;})[_0xd646('0x1f')](respondWithFilteredResult(_0x4096ec,_0x1293f8))[_0xd646('0x51')](handleError(_0x4096ec,null));};exports['show']=function(_0x3a6b45,_0x3309d8){var _0x5e7af6={'raw':!![],'where':{'id':_0x3a6b45['params']['id']}},_0x5f1c79={};_0x5f1c79['model']=_[_0xd646('0x3f')](db[_0xd646('0x4e')]['rawAttributes']);_0x5f1c79[_0xd646('0x40')]=_['keys'](_0x3a6b45[_0xd646('0x40')]);_0x5f1c79[_0xd646('0x41')]=_[_0xd646('0x42')](_0x5f1c79['model'],_0x5f1c79[_0xd646('0x40')]);_0x5e7af6[_0xd646('0x44')]=_[_0xd646('0x42')](_0x5f1c79['model'],qs[_0xd646('0x43')](_0x3a6b45[_0xd646('0x40')][_0xd646('0x43')]));_0x5e7af6['attributes']=_0x5e7af6['attributes'][_0xd646('0x52')]?_0x5e7af6[_0xd646('0x44')]:_0x5f1c79[_0xd646('0x3d')];if(_0x3a6b45['query'][_0xd646('0x4f')]){_0x5e7af6['include']=[{'all':!![]}];}_0x5e7af6=_[_0xd646('0x4d')]({},_0x5e7af6,_0x3a6b45['options']);return db[_0xd646('0x4e')][_0xd646('0x53')](_0x5e7af6)[_0xd646('0x1f')](handleEntityNotFound(_0x3309d8,null))[_0xd646('0x1f')](respondWithResult(_0x3309d8,null))['catch'](handleError(_0x3309d8,null));};exports[_0xd646('0x54')]=function(_0x14b14c,_0x231cfd){return db[_0xd646('0x4e')]['create'](_0x14b14c[_0xd646('0x55')],{})[_0xd646('0x1f')](function(_0x5d4da5){var _0x194ffd=_0x14b14c[_0xd646('0x56')][_0xd646('0x57')]({'plain':!![]});if(!_0x194ffd)throw new Error(_0xd646('0x58'));if(_0x194ffd[_0xd646('0x59')]===_0xd646('0x56')){var _0xe750d9=_0x5d4da5['get']({'plain':!![]});var _0x2560bf=_0xd646('0x5a');return db[_0xd646('0x5b')][_0xd646('0x53')]({'where':{'name':_0x2560bf,'userProfileId':_0x194ffd[_0xd646('0x5c')]},'raw':!![]})[_0xd646('0x1f')](function(_0x118663){if(_0x118663&&_0x118663[_0xd646('0x5d')]===0x0){return db[_0xd646('0x36')][_0xd646('0x54')]({'name':_0xe750d9['name'],'resourceId':_0xe750d9['id'],'type':_0x118663[_0xd646('0x38')],'sectionId':_0x118663['id']},{})[_0xd646('0x1f')](function(){return _0x5d4da5;});}else{return _0x5d4da5;}})[_0xd646('0x51')](function(_0x4fa12d){logger[_0xd646('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fa12d);throw _0x4fa12d;});}return _0x5d4da5;})['then'](respondWithResult(_0x231cfd,0xc9))[_0xd646('0x51')](handleError(_0x231cfd,null));};exports[_0xd646('0x34')]=function(_0x40eac5,_0x52b9c0){if(_0x40eac5[_0xd646('0x55')]['id']){delete _0x40eac5[_0xd646('0x55')]['id'];}return db[_0xd646('0x4e')][_0xd646('0x53')]({'where':{'id':_0x40eac5['params']['id']}})[_0xd646('0x1f')](handleEntityNotFound(_0x52b9c0,null))[_0xd646('0x1f')](saveUpdates(_0x40eac5[_0xd646('0x55')],null))[_0xd646('0x1f')](respondWithResult(_0x52b9c0,null))[_0xd646('0x51')](handleError(_0x52b9c0,null));};exports[_0xd646('0x35')]=function(_0x548b17,_0x4d83e7){return db[_0xd646('0x4e')][_0xd646('0x53')]({'where':{'id':_0x548b17[_0xd646('0x5e')]['id']}})[_0xd646('0x1f')](handleEntityNotFound(_0x4d83e7,null))[_0xd646('0x1f')](removeEntity(_0x4d83e7,null))[_0xd646('0x51')](handleError(_0x4d83e7,null));};exports[_0xd646('0x5f')]=function(_0x3cb783,_0x199158){return db['ChatQueue']['describe']()['then'](respondWithResult(_0x199158,null))[_0xd646('0x51')](handleError(_0x199158,null));};exports[_0xd646('0x60')]=function(_0x33b4f2,_0x6f6fa,_0xced4cd){var _0x14c7eb={'raw':!![],'where':{}},_0x175739={},_0x2acf6b;return db['ChatQueue'][_0xd646('0x61')]({'where':{'id':_0x33b4f2[_0xd646('0x5e')]['id']}})[_0xd646('0x1f')](handleEntityNotFound(_0x6f6fa,null))[_0xd646('0x1f')](function(_0x3b7f20){if(_0x3b7f20){_0x2acf6b=_0x3b7f20[_0xd646('0x57')]({'plain':!![]});_0x175739['model']=_[_0xd646('0x3f')](db[_0xd646('0x62')][_0xd646('0x3b')]);_0x175739[_0xd646('0x40')]=_[_0xd646('0x3f')](_0x33b4f2[_0xd646('0x40')]);_0x175739[_0xd646('0x41')]=_['intersection'](_0x175739[_0xd646('0x3d')],_0x175739[_0xd646('0x40')]);_0x14c7eb[_0xd646('0x44')]=_[_0xd646('0x42')](_0x175739[_0xd646('0x3d')],qs[_0xd646('0x43')](_0x33b4f2['query'][_0xd646('0x43')]));_0x14c7eb[_0xd646('0x44')]=_0x14c7eb[_0xd646('0x44')][_0xd646('0x52')]?_0x14c7eb['attributes']:_0x175739[_0xd646('0x3d')];if(!_0x33b4f2[_0xd646('0x40')][_0xd646('0x45')](_0xd646('0x46'))){_0x14c7eb[_0xd646('0x2f')]=qs[_0xd646('0x2f')](_0x33b4f2[_0xd646('0x40')][_0xd646('0x2f')]);_0x14c7eb[_0xd646('0x2e')]=qs[_0xd646('0x2e')](_0x33b4f2[_0xd646('0x40')][_0xd646('0x2e')]);}_0x14c7eb[_0xd646('0x47')]=qs[_0xd646('0x48')](_0x33b4f2['query'][_0xd646('0x48')]);_0x14c7eb[_0xd646('0x49')]=qs['filters'](_[_0xd646('0x4a')](_0x33b4f2[_0xd646('0x40')],_0x175739[_0xd646('0x41')]));_0x14c7eb[_0xd646('0x49')][_0xd646('0x63')]=_0x3b7f20['id'];if(_0x33b4f2[_0xd646('0x40')][_0xd646('0x4b')]){_0x14c7eb[_0xd646('0x49')]=_['merge'](_0x14c7eb[_0xd646('0x49')],{'$or':_['map'](_0x14c7eb[_0xd646('0x44')],function(_0x43a4de){var _0x3213fa={};_0x3213fa[_0x43a4de]={'$like':'%'+_0x33b4f2[_0xd646('0x40')][_0xd646('0x4b')]+'%'};return _0x3213fa;})});}_0x14c7eb=_['merge']({},_0x14c7eb,_0x33b4f2[_0xd646('0x64')]);return db[_0xd646('0x62')][_0xd646('0x50')](_0x14c7eb);}})[_0xd646('0x1f')](function(_0x2dbef8){if(_0x2dbef8){return db[_0xd646('0x65')]['findAndCountAll']({'where':{'id':_[_0xd646('0x3e')](_0x2dbef8,_0xd646('0x66')),'role':'agent'},'attributes':['id',_0xd646('0x38'),_0xd646('0x67'),_0xd646('0x68'),_0xd646('0x69')]});}})[_0xd646('0x1f')](function(_0x184b2f){if(_0x184b2f){return{'count':_0x184b2f['count'],'rows':_[_0xd646('0x3e')](_0x184b2f['rows'],function(_0x6911b){return{'membername':_0x6911b[_0xd646('0x38')],'UserId':_0x6911b['id'],'queue_name':_0x2acf6b['name'],'ChatQueueId':_0x2acf6b['id'],'interface':util[_0xd646('0x6a')](_0xd646('0x6b'),_0xd646('0x6c'),_0x6911b[_0xd646('0x38')]),'penalty':0x0,'paused':_0x6911b[_0xd646('0x67')],'createdAt':_0x6911b[_0xd646('0x69')],'updatedAt':_0x6911b[_0xd646('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x6f6fa,_0x14c7eb))[_0xd646('0x51')](handleError(_0x6f6fa,null));};exports[_0xd646('0x6d')]=function(_0x402119,_0x359326,_0x46d822){var _0x16064a={};var _0x5eaa50={};var _0x405227;var _0x500f69;return db[_0xd646('0x4e')][_0xd646('0x61')]({'where':{'id':_0x402119['params']['id']}})[_0xd646('0x1f')](handleEntityNotFound(_0x359326,null))[_0xd646('0x1f')](function(_0x5a23e1){if(_0x5a23e1){_0x405227=_0x5a23e1;_0x5eaa50[_0xd646('0x3d')]=_[_0xd646('0x3f')](db['Team'][_0xd646('0x3b')]);_0x5eaa50['query']=_['keys'](_0x402119[_0xd646('0x40')]);_0x5eaa50['filters']=_[_0xd646('0x42')](_0x5eaa50[_0xd646('0x3d')],_0x5eaa50[_0xd646('0x40')]);_0x16064a[_0xd646('0x44')]=_[_0xd646('0x42')](_0x5eaa50[_0xd646('0x3d')],qs[_0xd646('0x43')](_0x402119['query'][_0xd646('0x43')]));_0x16064a['attributes']=_0x16064a[_0xd646('0x44')][_0xd646('0x52')]?_0x16064a[_0xd646('0x44')]:_0x5eaa50['model'];_0x16064a[_0xd646('0x47')]=qs[_0xd646('0x48')](_0x402119[_0xd646('0x40')][_0xd646('0x48')]);_0x16064a[_0xd646('0x49')]=qs['filters'](_['pick'](_0x402119[_0xd646('0x40')],_0x5eaa50['filters']));if(_0x402119['query'][_0xd646('0x4b')]){_0x16064a[_0xd646('0x49')]=_['merge'](_0x16064a[_0xd646('0x49')],{'$or':_[_0xd646('0x3e')](_0x16064a['attributes'],function(_0x34b2d6){var _0x1e0108={};_0x1e0108[_0x34b2d6]={'$like':'%'+_0x402119[_0xd646('0x40')][_0xd646('0x4b')]+'%'};return _0x1e0108;})});}_0x16064a=_[_0xd646('0x4d')]({},_0x16064a,_0x402119[_0xd646('0x64')]);return _0x405227[_0xd646('0x6d')](_0x16064a);}})[_0xd646('0x1f')](function(_0x5eb8aa){if(_0x5eb8aa){_0x500f69=_0x5eb8aa['length'];if(!_0x402119[_0xd646('0x40')]['hasOwnProperty'](_0xd646('0x46'))){_0x16064a[_0xd646('0x2f')]=qs[_0xd646('0x2f')](_0x402119[_0xd646('0x40')][_0xd646('0x2f')]);_0x16064a['offset']=qs[_0xd646('0x2e')](_0x402119['query']['offset']);}return _0x405227['getTeams'](_0x16064a);}})['then'](function(_0x5c82ee){if(_0x5c82ee){return _0x5c82ee?{'count':_0x500f69,'rows':_0x5c82ee}:null;}})[_0xd646('0x1f')](respondWithResult(_0x359326,null))['catch'](handleError(_0x359326,null));};exports[_0xd646('0x6e')]=function(_0x27d128,_0x1f9449,_0x414a0f){var _0x5ae727=_0x27d128['body'][_0xd646('0x6f')];return db[_0xd646('0x70')][_0xd646('0x50')]({'where':{'id':_0x5ae727},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd646('0x71'),'attributes':['id',_0xd646('0x38'),_0xd646('0x72'),_0xd646('0x73'),_0xd646('0x74')],'raw':!![]}]})[_0xd646('0x1f')](function(_0x435f91){if(_0x435f91){var _0x6e8d91=_[_0xd646('0x75')](_0x435f91,function(_0x1ab405){var _0x2420e4=_0x1ab405[_0xd646('0x57')]({'plain':!![]});return _0x2420e4['Agents'];});return db[_0xd646('0x4e')][_0xd646('0x53')]({'where':{'id':_0x27d128['params']['id']}})['then'](function(_0x3898f8){return db[_0xd646('0x76')][_0xd646('0x77')](function(_0x54522d){return _0x3898f8[_0xd646('0x6e')](_0x5ae727,{'transaction':_0x54522d})[_0xd646('0x1f')](function(){return BPromise['each'](_0x6e8d91,function(_0x1ba4d3){return db['UserChatQueue'][_0xd646('0x78')]({'where':{'UserId':_0x1ba4d3['id'],'ChatQueueId':_0x27d128[_0xd646('0x5e')]['id']},'transaction':_0x54522d});});})['then'](function(){_0x6e8d91['forEach'](function(_0x5b77ce){socket[_0xd646('0x79')]('userChatQueue:save',{'UserId':_0x5b77ce['id'],'ChatQueueId':_0x3898f8['id']});});});});});}})[_0xd646('0x1f')](respondWithStatusCode(_0x1f9449,null))[_0xd646('0x51')](handleError(_0x1f9449,null));};exports[_0xd646('0x7a')]=function(_0xe6958,_0x22c732,_0x98b9df){return db['Team'][_0xd646('0x50')]({'where':{'id':_0xe6958[_0xd646('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd646('0x65')],'as':_0xd646('0x71'),'attributes':['id'],'raw':!![]}]})[_0xd646('0x1f')](handleEntityNotFound(_0x22c732,null))[_0xd646('0x1f')](function(_0x281d24){var _0x25bd42=_[_0xd646('0x3e')](_0x281d24,'id');var _0x415b10=[];var _0x2c853b=[];var _0x40a6bc=squel[_0xd646('0x7b')]();_0x40a6bc['field'](_0xd646('0x7c'))[_0xd646('0x7d')](_0xd646('0x7e'),'tq')[_0xd646('0x7f')](_0xd646('0x80'),'ut',_0xd646('0x81'))['where'](_0xd646('0x82'),_0xe6958['params']['id']);for(var _0x717730=0x0;_0x717730<_0x281d24[_0xd646('0x52')];_0x717730+=0x1){let _0x3b08ba=_0x281d24[_0x717730];for(var _0x4cf7d7=0x0;_0x4cf7d7<_0x3b08ba[_0xd646('0x71')]['length'];_0x4cf7d7+=0x1){let _0x350fb0=_0x3b08ba[_0xd646('0x71')][_0x4cf7d7];var _0x265fe3=_0x40a6bc['clone']();_0x265fe3['where'](_0xd646('0x83'),_0x350fb0['id']);_0x2c853b[_0xd646('0x84')](db[_0xd646('0x76')][_0xd646('0x40')](_0x265fe3[_0xd646('0x85')](),{'type':db[_0xd646('0x76')][_0xd646('0x86')]['SELECT']})['then'](function(_0x274fc4){if(_0x274fc4['length']===0x1){return _0x350fb0['id'];}else{var _0x2adae5=_['every'](_[_0xd646('0x3e')](_0x274fc4,'TeamId'),function(_0x5e212f){return _[_0xd646('0x87')](_0x25bd42,_0x5e212f);});if(_0x2adae5){return _0x350fb0['id'];}}}));}}return BPromise[_0xd646('0x88')](_0x2c853b)[_0xd646('0x1f')](function(_0x3615b3){_0x415b10=_(_0x415b10)[_0xd646('0x89')](_0x3615b3)[_0xd646('0x8a')]()[_0xd646('0x8b')]();return db['ChatQueue'][_0xd646('0x53')]({'where':{'id':_0xe6958['params']['id']}})['then'](function(_0x35a199){return db[_0xd646('0x76')][_0xd646('0x77')](function(_0x18984a){return _0x35a199[_0xd646('0x7a')](_0xe6958[_0xd646('0x40')]['ids'],{'transaction':_0x18984a})['then'](function(){if(!_[_0xd646('0x8c')](_0x415b10)){return _0x35a199[_0xd646('0x8d')](_0x415b10,{'transaction':_0x18984a});}})[_0xd646('0x1f')](function(){_0x415b10[_0xd646('0x8e')](function(_0xe8ea8b){socket[_0xd646('0x79')](_0xd646('0x8f'),{'UserId':_0xe8ea8b,'ChatQueueId':_0x35a199['id']});});});});});});})['then'](respondWithStatusCode(_0x22c732,null))[_0xd646('0x51')](handleError(_0x22c732,null));};exports['addAgents']=function(_0xe35705,_0x27ff81,_0x52d304){return db['ChatQueue'][_0xd646('0x53')]({'where':{'id':_0xe35705[_0xd646('0x5e')]['id']}})[_0xd646('0x1f')](handleEntityNotFound(_0x27ff81,null))[_0xd646('0x1f')](function(_0x4ab1ed){if(_0x4ab1ed){return _0x4ab1ed[_0xd646('0x90')](_0xe35705[_0xd646('0x55')]['ids'],_[_0xd646('0x91')](_0xe35705['body'],['ids','id'])||{})[_0xd646('0x92')](function(_0x516747){for(var _0x229289=0x0;_0x229289<_0xe35705[_0xd646('0x55')][_0xd646('0x6f')][_0xd646('0x52')];_0x229289+=0x1){socket[_0xd646('0x79')](_0xd646('0x93'),{'UserId':_0xe35705['body'][_0xd646('0x6f')][_0x229289],'ChatQueueId':_0xe35705['params']['id']});}return _0x516747;});}})[_0xd646('0x1f')](respondWithResult(_0x27ff81,null))[_0xd646('0x51')](handleError(_0x27ff81,null));};exports[_0xd646('0x8d')]=function(_0xc0b291,_0x1f2829,_0x5de0cc){return db['ChatQueue'][_0xd646('0x53')]({'where':{'id':_0xc0b291[_0xd646('0x5e')]['id']}})[_0xd646('0x1f')](handleEntityNotFound(_0x1f2829,null))[_0xd646('0x1f')](function(_0xd308e2){if(_0xd308e2){return _0xd308e2[_0xd646('0x8d')](_0xc0b291[_0xd646('0x40')][_0xd646('0x6f')])['then'](function(){if(_[_0xd646('0x94')](_0xc0b291['query']['ids'])){for(var _0x11aabf=0x0;_0x11aabf<_0xc0b291[_0xd646('0x40')][_0xd646('0x6f')]['length'];_0x11aabf+=0x1){socket[_0xd646('0x79')](_0xd646('0x8f'),{'UserId':Number(_0xc0b291[_0xd646('0x40')][_0xd646('0x6f')][_0x11aabf]),'ChatQueueId':Number(_0xc0b291['params']['id'])});}}else{socket['emit'](_0xd646('0x8f'),{'UserId':Number(_0xc0b291['query'][_0xd646('0x6f')]),'ChatQueueId':Number(_0xc0b291['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1f2829,null))[_0xd646('0x51')](handleError(_0x1f2829,null));};exports[_0xd646('0x95')]=function(_0x3e3ad0,_0xf87a33,_0x20858b){var _0x4139ac={};var _0x1e4291={};var _0x5b0766;var _0x557ae6;return db[_0xd646('0x4e')][_0xd646('0x61')]({'where':{'id':_0x3e3ad0[_0xd646('0x5e')]['id']}})[_0xd646('0x1f')](handleEntityNotFound(_0xf87a33,null))[_0xd646('0x1f')](function(_0x5e9149){if(_0x5e9149){_0x5b0766=_0x5e9149;_0x1e4291[_0xd646('0x3d')]=_[_0xd646('0x3f')](db['User'][_0xd646('0x3b')]);_0x1e4291[_0xd646('0x40')]=_[_0xd646('0x3f')](_0x3e3ad0[_0xd646('0x40')]);_0x1e4291['filters']=_[_0xd646('0x42')](_0x1e4291[_0xd646('0x3d')],_0x1e4291[_0xd646('0x40')]);_0x4139ac[_0xd646('0x44')]=_[_0xd646('0x42')](_0x1e4291[_0xd646('0x3d')],qs[_0xd646('0x43')](_0x3e3ad0[_0xd646('0x40')][_0xd646('0x43')]));_0x4139ac[_0xd646('0x44')]=_0x4139ac[_0xd646('0x44')][_0xd646('0x52')]?_0x4139ac['attributes']:_0x1e4291[_0xd646('0x3d')];_0x4139ac['order']=qs[_0xd646('0x48')](_0x3e3ad0[_0xd646('0x40')][_0xd646('0x48')]);_0x4139ac[_0xd646('0x49')]=qs[_0xd646('0x41')](_[_0xd646('0x4a')](_0x3e3ad0[_0xd646('0x40')],_0x1e4291[_0xd646('0x41')]));if(_0x3e3ad0['query'][_0xd646('0x4b')]){_0x4139ac['where']=_[_0xd646('0x4d')](_0x4139ac[_0xd646('0x49')],{'$or':_[_0xd646('0x3e')](_0x4139ac['attributes'],function(_0x4066c5){var _0x31978e={};_0x31978e[_0x4066c5]={'$like':'%'+_0x3e3ad0['query']['filter']+'%'};return _0x31978e;})});}_0x4139ac=_['merge']({},_0x4139ac,_0x3e3ad0[_0xd646('0x64')]);return _0x5b0766[_0xd646('0x95')](_0x4139ac);}})[_0xd646('0x1f')](function(_0x1cdf66){if(_0x1cdf66){_0x557ae6=_0x1cdf66[_0xd646('0x52')];if(!_0x3e3ad0['query'][_0xd646('0x45')](_0xd646('0x46'))){_0x4139ac[_0xd646('0x2f')]=qs[_0xd646('0x2f')](_0x3e3ad0[_0xd646('0x40')][_0xd646('0x2f')]);_0x4139ac[_0xd646('0x2e')]=qs['offset'](_0x3e3ad0[_0xd646('0x40')][_0xd646('0x2e')]);}return _0x5b0766['getAgents'](_0x4139ac);}})[_0xd646('0x1f')](function(_0x5cf100){if(_0x5cf100){return _0x5cf100?{'count':_0x557ae6,'rows':_0x5cf100}:null;}})[_0xd646('0x1f')](respondWithResult(_0xf87a33,null))[_0xd646('0x51')](handleError(_0xf87a33,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f3fd9ac..0b2c4b6 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(_0x5c3223,_0x52c819){var _0x54ac69=function(_0x12d440){while(--_0x12d440){_0x5c3223['push'](_0x5c3223['shift']());}};_0x54ac69(++_0x52c819);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5ade3b,_0x5210f3){_0x5ade3b=_0x5ade3b-0x0;var _0x4c61ea=_0x5f2f[_0x5ade3b];return _0x4c61ea;};'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 _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3d235c,_0xa18dd1){var _0x56ae19=function(_0x13e842){while(--_0x13e842){_0x3d235c['push'](_0x3d235c['shift']());}};_0x56ae19(++_0xa18dd1);}(_0x0b0e,0x187));var _0xe0b0=function(_0xffd1b5,_0x1ede18){_0xffd1b5=_0xffd1b5-0x0;var _0x3176d6=_0x0b0e[_0xffd1b5];return _0x3176d6;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index de2bb73..446a069 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 _0xa8dd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_queues','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8dd,0x11e));var _0xda8d=function(_0x4330ec,_0x3f4522){_0x4330ec=_0x4330ec-0x0;var _0x5aa853=_0xa8dd[_0x4330ec];return _0x5aa853;};'use strict';var _=require('lodash');var util=require(_0xda8d('0x0'));var logger=require(_0xda8d('0x1'))(_0xda8d('0x2'));var moment=require(_0xda8d('0x3'));var BPromise=require(_0xda8d('0x4'));var rp=require(_0xda8d('0x5'));var fs=require('fs');var path=require(_0xda8d('0x6'));var rimraf=require(_0xda8d('0x7'));var config=require(_0xda8d('0x8'));var attributes=require('./chatQueue.attributes');module[_0xda8d('0x9')]=function(_0x263ce1,_0x2eddc5){return _0x263ce1[_0xda8d('0xa')]('ChatQueue',attributes,{'tableName':_0xda8d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd40=['path','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5c4d74,_0x1c4c05){var _0xd2ccf7=function(_0x170cfc){while(--_0x170cfc){_0x5c4d74['push'](_0x5c4d74['shift']());}};_0xd2ccf7(++_0x1c4c05);}(_0xfd40,0x14a));var _0x0fd4=function(_0x1ed48c,_0x423b70){_0x1ed48c=_0x1ed48c-0x0;var _0xd0a6cc=_0xfd40[_0x1ed48c];return _0xd0a6cc;};'use strict';var _=require(_0x0fd4('0x0'));var util=require(_0x0fd4('0x1'));var logger=require('../../config/logger')(_0x0fd4('0x2'));var moment=require(_0x0fd4('0x3'));var BPromise=require(_0x0fd4('0x4'));var rp=require(_0x0fd4('0x5'));var fs=require('fs');var path=require(_0x0fd4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0fd4('0x7'));module[_0x0fd4('0x8')]=function(_0x9f8a37,_0x333a92){return _0x9f8a37[_0x0fd4('0x9')](_0x0fd4('0xa'),attributes,{'tableName':_0x0fd4('0xb'),'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 6d7342f..1466ecb 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 _0xb0ca=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueue','findAll','options','where','limit','include','model','attributes','map','GetChatQueue','ShowChatQueue','find','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xb0ca,0x1b2));var _0xab0c=function(_0x3261ed,_0x1f06ad){_0x3261ed=_0x3261ed-0x0;var _0xbea3c3=_0xb0ca[_0x3261ed];return _0xbea3c3;};'use strict';var _=require('lodash');var util=require(_0xab0c('0x0'));var moment=require('moment');var BPromise=require(_0xab0c('0x1'));var rs=require(_0xab0c('0x2'));var fs=require('fs');var Redis=require(_0xab0c('0x3'));var db=require(_0xab0c('0x4'))['db'];var utils=require(_0xab0c('0x5'));var logger=require(_0xab0c('0x6'))(_0xab0c('0x7'));var config=require('../../config/environment');var jayson=require(_0xab0c('0x8'));var client=jayson[_0xab0c('0x9')][_0xab0c('0xa')]({'port':0x232a});config[_0xab0c('0xb')]=_[_0xab0c('0xc')](config[_0xab0c('0xb')],{'host':_0xab0c('0xd'),'port':0x18eb});var socket=require(_0xab0c('0xe'))(new Redis(config[_0xab0c('0xb')]));require('./chatQueue.socket')[_0xab0c('0xf')](socket);function respondWithRpcPromise(_0x15db71,_0x52df38,_0xb79b41){return new BPromise(function(_0x17bff7,_0x11a4ae){return client['request'](_0x15db71,_0xb79b41)[_0xab0c('0x10')](function(_0x53a944){logger[_0xab0c('0x11')](_0xab0c('0x12'),_0x52df38,_0xab0c('0x13'));logger[_0xab0c('0x14')](_0xab0c('0x15'),_0x52df38,_0xab0c('0x13'),JSON[_0xab0c('0x16')](_0x53a944));if(_0x53a944[_0xab0c('0x17')]){if(_0x53a944[_0xab0c('0x17')][_0xab0c('0x18')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x52df38,_0x53a944[_0xab0c('0x17')][_0xab0c('0x19')]);return _0x11a4ae(_0x53a944[_0xab0c('0x17')][_0xab0c('0x19')]);}logger[_0xab0c('0x17')](_0xab0c('0x12'),_0x52df38,_0x53a944[_0xab0c('0x17')][_0xab0c('0x19')]);return _0x17bff7(_0x53a944[_0xab0c('0x17')][_0xab0c('0x19')]);}else{logger[_0xab0c('0x11')](_0xab0c('0x12'),_0x52df38,_0xab0c('0x13'));_0x17bff7(_0x53a944[_0xab0c('0x1a')][_0xab0c('0x19')]);}})[_0xab0c('0x1b')](function(_0x44c6f4){logger[_0xab0c('0x17')](_0xab0c('0x12'),_0x52df38,_0x44c6f4);_0x11a4ae(_0x44c6f4);});});}exports['GetChatQueue']=function(_0x29b873){var _0x4ad10e=this;return new Promise(function(_0x36794d,_0x870902){return db[_0xab0c('0x1c')][_0xab0c('0x1d')]({'raw':_0x29b873[_0xab0c('0x1e')]?_0x29b873[_0xab0c('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x29b873[_0xab0c('0x1e')]?_0x29b873[_0xab0c('0x1e')][_0xab0c('0x1f')]||null:null,'attributes':_0x29b873['options']?_0x29b873[_0xab0c('0x1e')]['attributes']||null:null,'limit':_0x29b873[_0xab0c('0x1e')]?_0x29b873[_0xab0c('0x1e')][_0xab0c('0x20')]||null:null,'include':_0x29b873['options']?_0x29b873[_0xab0c('0x1e')][_0xab0c('0x21')]?_['map'](_0x29b873[_0xab0c('0x1e')][_0xab0c('0x21')],function(_0xfe7099){return{'model':db[_0xfe7099[_0xab0c('0x22')]],'as':_0xfe7099['as'],'attributes':_0xfe7099[_0xab0c('0x23')],'include':_0xfe7099[_0xab0c('0x21')]?_[_0xab0c('0x24')](_0xfe7099[_0xab0c('0x21')],function(_0x3ce281){return{'model':db[_0x3ce281[_0xab0c('0x22')]],'as':_0x3ce281['as'],'attributes':_0x3ce281[_0xab0c('0x23')],'include':_0x3ce281[_0xab0c('0x21')]?_[_0xab0c('0x24')](_0x3ce281['include'],function(_0x70f07f){return{'model':db[_0x70f07f[_0xab0c('0x22')]],'as':_0x70f07f['as'],'attributes':_0x70f07f[_0xab0c('0x23')]};}):[]};}):[]};}):[]:[]})[_0xab0c('0x10')](function(_0x47a239){logger['info']('GetChatQueue',_0x29b873);logger['debug'](_0xab0c('0x25'),_0x29b873,JSON[_0xab0c('0x16')](_0x47a239));_0x36794d(_0x47a239);})[_0xab0c('0x1b')](function(_0x3e6b6e){logger[_0xab0c('0x17')]('GetChatQueue',_0x3e6b6e['message'],_0x29b873);_0x870902(_0x4ad10e[_0xab0c('0x17')](0x1f4,_0x3e6b6e[_0xab0c('0x19')]));});});};exports[_0xab0c('0x26')]=function(_0xe36cea){var _0x2bccdb=this;return new Promise(function(_0x577c31,_0x582536){return db['ChatQueue'][_0xab0c('0x27')]({'raw':_0xe36cea[_0xab0c('0x1e')]?_0xe36cea[_0xab0c('0x1e')][_0xab0c('0x28')]===undefined?!![]:![]:!![],'where':_0xe36cea[_0xab0c('0x1e')]?_0xe36cea[_0xab0c('0x1e')][_0xab0c('0x1f')]||null:null,'attributes':_0xe36cea[_0xab0c('0x1e')]?_0xe36cea[_0xab0c('0x1e')][_0xab0c('0x23')]||null:null,'include':_0xe36cea[_0xab0c('0x1e')]?_0xe36cea[_0xab0c('0x1e')][_0xab0c('0x21')]?_['map'](_0xe36cea[_0xab0c('0x1e')][_0xab0c('0x21')],function(_0x366ade){return{'model':db[_0x366ade[_0xab0c('0x22')]],'as':_0x366ade['as'],'attributes':_0x366ade[_0xab0c('0x23')],'include':_0x366ade['include']?_['map'](_0x366ade['include'],function(_0x4c5f21){return{'model':db[_0x4c5f21[_0xab0c('0x22')]],'as':_0x4c5f21['as'],'attributes':_0x4c5f21['attributes'],'include':_0x4c5f21['include']?_[_0xab0c('0x24')](_0x4c5f21[_0xab0c('0x21')],function(_0xd1a5fb){return{'model':db[_0xd1a5fb[_0xab0c('0x22')]],'as':_0xd1a5fb['as'],'attributes':_0xd1a5fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xab0c('0x10')](function(_0x16048c){logger[_0xab0c('0x11')](_0xab0c('0x26'),_0xe36cea);logger['debug'](_0xab0c('0x26'),_0xe36cea,JSON[_0xab0c('0x16')](_0x16048c));_0x577c31(_0x16048c);})[_0xab0c('0x1b')](function(_0x2dbd55){logger[_0xab0c('0x17')](_0xab0c('0x26'),_0x2dbd55[_0xab0c('0x19')],_0xe36cea);_0x582536(_0x2bccdb['error'](0x1f4,_0x2dbd55[_0xab0c('0x19')]));});});}; \ No newline at end of file +var _0x4639=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','socket.io-emitter','redis','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','ChatQueue','find','lodash','bluebird','randomstring'];(function(_0x3ddd84,_0x2cbf16){var _0xfac0a2=function(_0x1dad7b){while(--_0x1dad7b){_0x3ddd84['push'](_0x3ddd84['shift']());}};_0xfac0a2(++_0x2cbf16);}(_0x4639,0x115));var _0x9463=function(_0x1f4f14,_0x570d4b){_0x1f4f14=_0x1f4f14-0x0;var _0x3135b1=_0x4639[_0x1f4f14];return _0x3135b1;};'use strict';var _=require(_0x9463('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9463('0x1'));var rs=require(_0x9463('0x2'));var fs=require('fs');var Redis=require(_0x9463('0x3'));var db=require(_0x9463('0x4'))['db'];var utils=require(_0x9463('0x5'));var logger=require(_0x9463('0x6'))(_0x9463('0x7'));var config=require('../../config/environment');var jayson=require(_0x9463('0x8'));var client=jayson[_0x9463('0x9')]['http']({'port':0x232a});config['redis']=_[_0x9463('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9463('0xb'))(new Redis(config[_0x9463('0xc')]));require(_0x9463('0xd'))['register'](socket);function respondWithRpcPromise(_0x224353,_0x1f77d0,_0x30370b){return new BPromise(function(_0x183ece,_0x35b98c){return client[_0x9463('0xe')](_0x224353,_0x30370b)[_0x9463('0xf')](function(_0x363ca5){logger[_0x9463('0x10')](_0x9463('0x11'),_0x1f77d0,_0x9463('0x12'));logger[_0x9463('0x13')](_0x9463('0x14'),_0x1f77d0,_0x9463('0x12'),JSON[_0x9463('0x15')](_0x363ca5));if(_0x363ca5[_0x9463('0x16')]){if(_0x363ca5[_0x9463('0x16')][_0x9463('0x17')]===0x1f4){logger[_0x9463('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1f77d0,_0x363ca5[_0x9463('0x16')]['message']);return _0x35b98c(_0x363ca5[_0x9463('0x16')][_0x9463('0x18')]);}logger[_0x9463('0x16')](_0x9463('0x11'),_0x1f77d0,_0x363ca5[_0x9463('0x16')]['message']);return _0x183ece(_0x363ca5[_0x9463('0x16')][_0x9463('0x18')]);}else{logger[_0x9463('0x10')]('ChatQueue,\x20%s,\x20%s',_0x1f77d0,'request\x20sent');_0x183ece(_0x363ca5[_0x9463('0x19')][_0x9463('0x18')]);}})[_0x9463('0x1a')](function(_0x3ba487){logger[_0x9463('0x16')](_0x9463('0x11'),_0x1f77d0,_0x3ba487);_0x35b98c(_0x3ba487);});});}exports[_0x9463('0x1b')]=function(_0x77df85){var _0xf2289=this;return new Promise(function(_0x39608b,_0x3d26e4){return db['ChatQueue'][_0x9463('0x1c')]({'raw':_0x77df85[_0x9463('0x1d')]?_0x77df85[_0x9463('0x1d')][_0x9463('0x1e')]===undefined?!![]:![]:!![],'where':_0x77df85['options']?_0x77df85[_0x9463('0x1d')][_0x9463('0x1f')]||null:null,'attributes':_0x77df85[_0x9463('0x1d')]?_0x77df85[_0x9463('0x1d')][_0x9463('0x20')]||null:null,'limit':_0x77df85[_0x9463('0x1d')]?_0x77df85[_0x9463('0x1d')][_0x9463('0x21')]||null:null,'include':_0x77df85[_0x9463('0x1d')]?_0x77df85[_0x9463('0x1d')][_0x9463('0x22')]?_[_0x9463('0x23')](_0x77df85[_0x9463('0x1d')][_0x9463('0x22')],function(_0x62286d){return{'model':db[_0x62286d[_0x9463('0x24')]],'as':_0x62286d['as'],'attributes':_0x62286d[_0x9463('0x20')],'include':_0x62286d[_0x9463('0x22')]?_['map'](_0x62286d[_0x9463('0x22')],function(_0x1293fa){return{'model':db[_0x1293fa[_0x9463('0x24')]],'as':_0x1293fa['as'],'attributes':_0x1293fa[_0x9463('0x20')],'include':_0x1293fa[_0x9463('0x22')]?_['map'](_0x1293fa[_0x9463('0x22')],function(_0x508128){return{'model':db[_0x508128[_0x9463('0x24')]],'as':_0x508128['as'],'attributes':_0x508128[_0x9463('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9463('0xf')](function(_0xb39a03){logger[_0x9463('0x10')](_0x9463('0x1b'),_0x77df85);logger[_0x9463('0x13')]('GetChatQueue',_0x77df85,JSON['stringify'](_0xb39a03));_0x39608b(_0xb39a03);})[_0x9463('0x1a')](function(_0x23a13f){logger[_0x9463('0x16')]('GetChatQueue',_0x23a13f[_0x9463('0x18')],_0x77df85);_0x3d26e4(_0xf2289[_0x9463('0x16')](0x1f4,_0x23a13f[_0x9463('0x18')]));});});};exports[_0x9463('0x25')]=function(_0x230611){var _0x1b8c59=this;return new Promise(function(_0x2aa7f3,_0x2f5422){return db[_0x9463('0x26')][_0x9463('0x27')]({'raw':_0x230611[_0x9463('0x1d')]?_0x230611[_0x9463('0x1d')][_0x9463('0x1e')]===undefined?!![]:![]:!![],'where':_0x230611[_0x9463('0x1d')]?_0x230611[_0x9463('0x1d')][_0x9463('0x1f')]||null:null,'attributes':_0x230611[_0x9463('0x1d')]?_0x230611[_0x9463('0x1d')][_0x9463('0x20')]||null:null,'include':_0x230611[_0x9463('0x1d')]?_0x230611[_0x9463('0x1d')]['include']?_['map'](_0x230611['options'][_0x9463('0x22')],function(_0xd9a798){return{'model':db[_0xd9a798[_0x9463('0x24')]],'as':_0xd9a798['as'],'attributes':_0xd9a798[_0x9463('0x20')],'include':_0xd9a798[_0x9463('0x22')]?_[_0x9463('0x23')](_0xd9a798[_0x9463('0x22')],function(_0x474360){return{'model':db[_0x474360[_0x9463('0x24')]],'as':_0x474360['as'],'attributes':_0x474360[_0x9463('0x20')],'include':_0x474360[_0x9463('0x22')]?_[_0x9463('0x23')](_0x474360[_0x9463('0x22')],function(_0x4bb877){return{'model':db[_0x4bb877[_0x9463('0x24')]],'as':_0x4bb877['as'],'attributes':_0x4bb877['attributes']};}):[]};}):[]};}):[]:[]})[_0x9463('0xf')](function(_0x493148){logger[_0x9463('0x10')](_0x9463('0x25'),_0x230611);logger[_0x9463('0x13')](_0x9463('0x25'),_0x230611,JSON[_0x9463('0x15')](_0x493148));_0x2aa7f3(_0x493148);})[_0x9463('0x1a')](function(_0x520582){logger[_0x9463('0x16')](_0x9463('0x25'),_0x520582[_0x9463('0x18')],_0x230611);_0x2f5422(_0x1b8c59[_0x9463('0x16')](0x1f4,_0x520582[_0x9463('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 5ffc352..60980c4 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x28ad8b,_0x47975a){var _0x30d0b9=function(_0xa859a5){while(--_0xa859a5){_0x28ad8b['push'](_0x28ad8b['shift']());}};_0x30d0b9(++_0x47975a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x42817d,_0x17482f){_0x42817d=_0x42817d-0x0;var _0x2edeb1=_0x5f2f[_0x42817d];return _0x2edeb1;};'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 +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x2d5805,_0x21954e){var _0x1cae4f=function(_0x53ff24){while(--_0x53ff24){_0x2d5805['push'](_0x2d5805['shift']());}};_0x1cae4f(++_0x21954e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1230b9,_0xc27ede){_0x1230b9=_0x1230b9-0x0;var _0x34ebec=_0x5f2f[_0x1230b9];return _0x34ebec;};'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 e5d53a8..3e773c6 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 _0x99a1=['getTeams','/:id/users','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','/describe','describe','/:id','isAuthenticated','show','getMembers','/:id/teams'];(function(_0x3f2375,_0x592da7){var _0x540804=function(_0x3890cb){while(--_0x3890cb){_0x3f2375['push'](_0x3f2375['shift']());}};_0x540804(++_0x592da7);}(_0x99a1,0xd0));var _0x199a=function(_0x530f66,_0xc43240){_0x530f66=_0x530f66-0x0;var _0x3c576d=_0x99a1[_0x530f66];return _0x3c576d;};'use strict';var multer=require('multer');var util=require(_0x199a('0x0'));var path=require(_0x199a('0x1'));var timeout=require(_0x199a('0x2'));var express=require(_0x199a('0x3'));var router=express[_0x199a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x199a('0x5'));var config=require(_0x199a('0x6'));var controller=require(_0x199a('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x199a('0x8')](_0x199a('0x9'),auth['isAuthenticated'](),controller[_0x199a('0xa')]);router[_0x199a('0x8')](_0x199a('0xb'),auth[_0x199a('0xc')](),controller[_0x199a('0xd')]);router[_0x199a('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x199a('0xe')]);router['get'](_0x199a('0xf'),auth[_0x199a('0xc')](),controller[_0x199a('0x10')]);router[_0x199a('0x8')](_0x199a('0x11'),auth[_0x199a('0xc')](),controller['getAgents']);router[_0x199a('0x12')]('/',auth[_0x199a('0xc')](),controller['create']);router[_0x199a('0x12')]('/:id/teams',auth[_0x199a('0xc')](),controller[_0x199a('0x13')]);router[_0x199a('0x12')](_0x199a('0x11'),auth['isAuthenticated'](),controller[_0x199a('0x14')]);router[_0x199a('0x15')]('/:id',auth[_0x199a('0xc')](),controller[_0x199a('0x16')]);router[_0x199a('0x17')](_0x199a('0xb'),auth[_0x199a('0xc')](),controller[_0x199a('0x18')]);router[_0x199a('0x17')](_0x199a('0xf'),auth['isAuthenticated'](),controller[_0x199a('0x19')]);router[_0x199a('0x17')](_0x199a('0x11'),auth[_0x199a('0xc')](),controller[_0x199a('0x1a')]);module[_0x199a('0x1b')]=router; \ No newline at end of file +var _0x08ea=['create','post','addTeams','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','index','/describe','isAuthenticated','describe','get','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x11e5a5,_0x5803b2){var _0x22bb8d=function(_0x597537){while(--_0x597537){_0x11e5a5['push'](_0x11e5a5['shift']());}};_0x22bb8d(++_0x5803b2);}(_0x08ea,0x8c));var _0xa08e=function(_0x681764,_0x2a4cd9){_0x681764=_0x681764-0x0;var _0x19885f=_0x08ea[_0x681764];return _0x19885f;};'use strict';var multer=require(_0xa08e('0x0'));var util=require('util');var path=require(_0xa08e('0x1'));var timeout=require(_0xa08e('0x2'));var express=require(_0xa08e('0x3'));var router=express[_0xa08e('0x4')]();var auth=require(_0xa08e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa08e('0x6'));var controller=require(_0xa08e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa08e('0x8')]);router['get'](_0xa08e('0x9'),auth[_0xa08e('0xa')](),controller[_0xa08e('0xb')]);router[_0xa08e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xa08e('0xd')]);router['get'](_0xa08e('0xe'),auth[_0xa08e('0xa')](),controller[_0xa08e('0xf')]);router[_0xa08e('0xc')](_0xa08e('0x10'),auth[_0xa08e('0xa')](),controller[_0xa08e('0x11')]);router[_0xa08e('0xc')](_0xa08e('0x12'),auth[_0xa08e('0xa')](),controller[_0xa08e('0x13')]);router['post']('/',auth[_0xa08e('0xa')](),controller[_0xa08e('0x14')]);router[_0xa08e('0x15')](_0xa08e('0x10'),auth[_0xa08e('0xa')](),controller[_0xa08e('0x16')]);router[_0xa08e('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xa08e('0x17')]);router[_0xa08e('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xa08e('0x19')]);router[_0xa08e('0x1a')](_0xa08e('0x1b'),auth[_0xa08e('0xa')](),controller[_0xa08e('0x1c')]);router[_0xa08e('0x1a')](_0xa08e('0x10'),auth[_0xa08e('0xa')](),controller[_0xa08e('0x1d')]);router[_0xa08e('0x1a')](_0xa08e('0x12'),auth[_0xa08e('0xa')](),controller[_0xa08e('0x1e')]);module[_0xa08e('0x1f')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 540661f..e660178 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 _0xe59e=['STRING','DATE'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe59e,0xd4));var _0xee59=function(_0x1c6208,_0x3e79a2){_0x1c6208=_0x1c6208-0x0;var _0xe996a3=_0xe59e[_0x1c6208];return _0xe996a3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xee59('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xee59('0x0')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xee59('0x1')]},'acceptAt':{'type':Sequelize[_0xee59('0x1')]},'exitAt':{'type':Sequelize[_0xee59('0x1')]},'reason':{'type':Sequelize[_0xee59('0x0')]}}; \ No newline at end of file +var _0x5140=['moment','exports','STRING','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5140,0x174));var _0x0514=function(_0x38eec9,_0x3548aa){_0x38eec9=_0x38eec9-0x0;var _0x3691bc=_0x5140[_0x38eec9];return _0x3691bc;};'use strict';var moment=require(_0x0514('0x0'));var Sequelize=require('sequelize');module[_0x0514('0x1')]={'uniqueid':{'type':Sequelize[_0x0514('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0514('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0514('0x3')]},'acceptAt':{'type':Sequelize[_0x0514('0x3')]},'exitAt':{'type':Sequelize[_0x0514('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 24cb3c9..d80508b 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 _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(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb7e7[_0x3ea913];return _0x2b4f28;};'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 +var _0x757a=['count','findAll','rows','catch','params','keys','includeAll','include','create','body','find','describe','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','end','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','map','VIRTUAL','options','ChatQueueReport'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x757a,0xde));var _0xa757=function(_0x583bb9,_0x1b8950){_0x583bb9=_0x583bb9-0x0;var _0x9d82b6=_0x757a[_0x583bb9];return _0x9d82b6;};'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'];function respondWithStatusCode(_0x56acfb,_0x4db68e){_0x4db68e=_0x4db68e||0xcc;return function(_0x421040){if(_0x421040){return _0x56acfb['sendStatus'](_0x4db68e);}return _0x56acfb['status'](_0x4db68e)[_0xa757('0x16')]();};}function respondWithResult(_0x513b1f,_0x481508){_0x481508=_0x481508||0xc8;return function(_0x32112b){if(_0x32112b){return _0x513b1f[_0xa757('0x17')](_0x481508)[_0xa757('0x18')](_0x32112b);}};}function respondWithFilteredResult(_0x4a0c38,_0x86abd){return function(_0x31cfd2){if(_0x31cfd2){var _0xf12b68=_0x31cfd2['count'],_0x2f7947=_0x86abd[_0xa757('0x19')],_0x185011=_0x86abd[_0xa757('0x19')]+_0x86abd[_0xa757('0x1a')],_0x3df1f9;if(_0x185011>=_0xf12b68){_0x185011=_0xf12b68;_0x3df1f9=0xc8;}else{_0x3df1f9=0xce;}_0x4a0c38['status'](_0x3df1f9);return _0x4a0c38['set'](_0xa757('0x1b'),_0x2f7947+'-'+_0x185011+'/'+_0xf12b68)[_0xa757('0x18')](_0x31cfd2);}return null;};}function patchUpdates(_0x1bd14c){return function(_0x340599){try{jsonpatch[_0xa757('0x1c')](_0x340599,_0x1bd14c,!![]);}catch(_0xe2d567){return BPromise['reject'](_0xe2d567);}return _0x340599[_0xa757('0x1d')]();};}function saveUpdates(_0x4fec52,_0x32c2a1){return function(_0x167640){if(_0x167640){return _0x167640[_0xa757('0x1e')](_0x4fec52)[_0xa757('0x1f')](function(_0x4d598c){return _0x4d598c;});}return null;};}function removeEntity(_0x5638c7,_0x40ec48){return function(_0x2159cf){if(_0x2159cf){return _0x2159cf[_0xa757('0x20')]()[_0xa757('0x1f')](function(){_0x5638c7[_0xa757('0x17')](0xcc)[_0xa757('0x16')]();});}};}function handleEntityNotFound(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(!_0x2bf276){_0x2ca10d['sendStatus'](0x194);}return _0x2bf276;};}function handleError(_0x3707c1,_0x59e9d4){_0x59e9d4=_0x59e9d4||0x1f4;return function(_0x422e9e){logger['error'](_0x422e9e[_0xa757('0x21')]);if(_0x422e9e[_0xa757('0x22')]){delete _0x422e9e[_0xa757('0x22')];}_0x3707c1['status'](_0x59e9d4)[_0xa757('0x23')](_0x422e9e);};}exports[_0xa757('0x24')]=function(_0x471e84,_0x3bf7f3){var _0x5b4779={},_0x449a7d={},_0x54263b={'count':0x0,'rows':[]};var _0x5a5664=_['map'](db['ChatQueueReport'][_0xa757('0x25')],function(_0x596ae2){return{'name':_0x596ae2[_0xa757('0x26')],'type':_0x596ae2[_0xa757('0x27')]['key']};});_0x449a7d[_0xa757('0x28')]=_['map'](_0x5a5664,_0xa757('0x22'));_0x449a7d[_0xa757('0x29')]=_['keys'](_0x471e84[_0xa757('0x29')]);_0x449a7d['filters']=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],_0x449a7d[_0xa757('0x29')]);_0x5b4779[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x471e84[_0xa757('0x29')][_0xa757('0x2c')]));_0x5b4779[_0xa757('0x2b')]=_0x5b4779[_0xa757('0x2b')][_0xa757('0x2d')]?_0x5b4779[_0xa757('0x2b')]:_0x449a7d[_0xa757('0x28')];if(!_0x471e84[_0xa757('0x29')][_0xa757('0x2e')](_0xa757('0x2f'))){_0x5b4779[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x471e84[_0xa757('0x29')][_0xa757('0x1a')]);_0x5b4779[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x471e84[_0xa757('0x29')]['offset']);}_0x5b4779[_0xa757('0x30')]=qs[_0xa757('0x31')](_0x471e84[_0xa757('0x29')][_0xa757('0x31')]);_0x5b4779[_0xa757('0x32')]=qs['filters'](_[_0xa757('0x33')](_0x471e84[_0xa757('0x29')],_0x449a7d[_0xa757('0x34')]),_0x5a5664);if(_0x471e84[_0xa757('0x29')][_0xa757('0x35')]){_0x5b4779[_0xa757('0x32')]=_['merge'](_0x5b4779[_0xa757('0x32')],{'$or':_[_0xa757('0x36')](_0x5a5664,function(_0x2cade7){if(_0x2cade7[_0xa757('0x27')]!==_0xa757('0x37')){var _0x111cfe={};_0x111cfe[_0x2cade7[_0xa757('0x22')]]={'$like':'%'+_0x471e84[_0xa757('0x29')][_0xa757('0x35')]+'%'};return _0x111cfe;}})});}_0x5b4779=_['merge']({},_0x5b4779,_0x471e84[_0xa757('0x38')]);var _0x34fba8={'where':_0x5b4779[_0xa757('0x32')]};return db[_0xa757('0x39')][_0xa757('0x3a')](_0x34fba8)[_0xa757('0x1f')](function(_0x501e26){_0x54263b[_0xa757('0x3a')]=_0x501e26;if(_0x471e84[_0xa757('0x29')]['includeAll']){_0x5b4779['include']=[{'all':!![]}];}return db[_0xa757('0x39')][_0xa757('0x3b')](_0x5b4779);})['then'](function(_0x51c3d1){_0x54263b[_0xa757('0x3c')]=_0x51c3d1;return _0x54263b;})[_0xa757('0x1f')](respondWithFilteredResult(_0x3bf7f3,_0x5b4779))[_0xa757('0x3d')](handleError(_0x3bf7f3,null));};exports['show']=function(_0x830dc4,_0x13a8f4){var _0x26802c={'raw':!![],'where':{'id':_0x830dc4[_0xa757('0x3e')]['id']}},_0x1ba399={};_0x1ba399['model']=_[_0xa757('0x3f')](db['ChatQueueReport']['rawAttributes']);_0x1ba399[_0xa757('0x29')]=_[_0xa757('0x3f')](_0x830dc4[_0xa757('0x29')]);_0x1ba399[_0xa757('0x34')]=_[_0xa757('0x2a')](_0x1ba399['model'],_0x1ba399['query']);_0x26802c[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x1ba399[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x830dc4[_0xa757('0x29')][_0xa757('0x2c')]));_0x26802c['attributes']=_0x26802c[_0xa757('0x2b')][_0xa757('0x2d')]?_0x26802c['attributes']:_0x1ba399[_0xa757('0x28')];if(_0x830dc4['query'][_0xa757('0x40')]){_0x26802c[_0xa757('0x41')]=[{'all':!![]}];}_0x26802c=_['merge']({},_0x26802c,_0x830dc4[_0xa757('0x38')]);return db[_0xa757('0x39')]['find'](_0x26802c)[_0xa757('0x1f')](handleEntityNotFound(_0x13a8f4,null))[_0xa757('0x1f')](respondWithResult(_0x13a8f4,null))[_0xa757('0x3d')](handleError(_0x13a8f4,null));};exports[_0xa757('0x42')]=function(_0x543b5b,_0x199dc9){return db[_0xa757('0x39')][_0xa757('0x42')](_0x543b5b[_0xa757('0x43')],{})['then'](respondWithResult(_0x199dc9,0xc9))[_0xa757('0x3d')](handleError(_0x199dc9,null));};exports['update']=function(_0x50c131,_0x2acf88){if(_0x50c131[_0xa757('0x43')]['id']){delete _0x50c131[_0xa757('0x43')]['id'];}return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x50c131['params']['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x2acf88,null))[_0xa757('0x1f')](saveUpdates(_0x50c131[_0xa757('0x43')],null))[_0xa757('0x1f')](respondWithResult(_0x2acf88,null))[_0xa757('0x3d')](handleError(_0x2acf88,null));};exports[_0xa757('0x20')]=function(_0x57bf73,_0x505cd){return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x57bf73[_0xa757('0x3e')]['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x505cd,null))[_0xa757('0x1f')](removeEntity(_0x505cd,null))[_0xa757('0x3d')](handleError(_0x505cd,null));};exports[_0xa757('0x45')]=function(_0x15bad7,_0x2c5b3c){return db[_0xa757('0x39')][_0xa757('0x45')]()[_0xa757('0x1f')](respondWithResult(_0x2c5b3c,null))[_0xa757('0x3d')](handleError(_0x2c5b3c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b36a7df..d7dcd05 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 _0x99ed=['bluebird','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash','util'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x99ed,0xa3));var _0xd99e=function(_0x3c3a4d,_0x309438){_0x3c3a4d=_0x3c3a4d-0x0;var _0x251598=_0x99ed[_0x3c3a4d];return _0x251598;};'use strict';var _=require(_0xd99e('0x0'));var util=require(_0xd99e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd99e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd99e('0x3'));var rimraf=require(_0xd99e('0x4'));var config=require(_0xd99e('0x5'));var attributes=require(_0xd99e('0x6'));module[_0xd99e('0x7')]=function(_0xde7d4c,_0x225b08){return _0xde7d4c[_0xd99e('0x8')]('ChatQueueReport',attributes,{'tableName':_0xd99e('0x9'),'paranoid':![],'indexes':[{'name':_0xd99e('0xa'),'fields':[_0xd99e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6455=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash'];(function(_0x26507b,_0x50d393){var _0x4f907f=function(_0x13a657){while(--_0x13a657){_0x26507b['push'](_0x26507b['shift']());}};_0x4f907f(++_0x50d393);}(_0x6455,0x137));var _0x5645=function(_0x45cbd2,_0x206f65){_0x45cbd2=_0x45cbd2-0x0;var _0x354b65=_0x6455[_0x45cbd2];return _0x354b65;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5645('0x3'));var fs=require('fs');var path=require(_0x5645('0x4'));var rimraf=require(_0x5645('0x5'));var config=require(_0x5645('0x6'));var attributes=require('./chatQueueReport.attributes');module[_0x5645('0x7')]=function(_0x25b9d6,_0x1d2305){return _0x25b9d6[_0x5645('0x8')](_0x5645('0x9'),attributes,{'tableName':_0x5645('0xa'),'paranoid':![],'indexes':[{'name':_0x5645('0xb'),'fields':[_0x5645('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index da9df1a..d13119a 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 _0x15da=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','debug','UpdateChatQueueReport','where','limit','util'];(function(_0x351705,_0x3a916d){var _0xf1e79c=function(_0xa2e7fc){while(--_0xa2e7fc){_0x351705['push'](_0x351705['shift']());}};_0xf1e79c(++_0x3a916d);}(_0x15da,0xd8));var _0xa15d=function(_0xa72e3a,_0x4d3bd1){_0xa72e3a=_0xa72e3a-0x0;var _0x41cff3=_0x15da[_0xa72e3a];return _0x41cff3;};'use strict';var _=require('lodash');var util=require(_0xa15d('0x0'));var moment=require(_0xa15d('0x1'));var BPromise=require(_0xa15d('0x2'));var rs=require(_0xa15d('0x3'));var fs=require('fs');var Redis=require(_0xa15d('0x4'));var db=require(_0xa15d('0x5'))['db'];var utils=require(_0xa15d('0x6'));var logger=require(_0xa15d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa15d('0x8'));var client=jayson[_0xa15d('0x9')][_0xa15d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ce297,_0x1cbcc3,_0x2a0e82){return new BPromise(function(_0x3d6d10,_0x5dc97f){return client['request'](_0x1ce297,_0x2a0e82)[_0xa15d('0xb')](function(_0x42ff2e){logger[_0xa15d('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x1cbcc3,_0xa15d('0xd'));logger['debug'](_0xa15d('0xe'),_0x1cbcc3,_0xa15d('0xd'),JSON[_0xa15d('0xf')](_0x42ff2e));if(_0x42ff2e[_0xa15d('0x10')]){if(_0x42ff2e['error']['code']===0x1f4){logger[_0xa15d('0x10')](_0xa15d('0x11'),_0x1cbcc3,_0x42ff2e[_0xa15d('0x10')]['message']);return _0x5dc97f(_0x42ff2e[_0xa15d('0x10')][_0xa15d('0x12')]);}logger['error'](_0xa15d('0x11'),_0x1cbcc3,_0x42ff2e[_0xa15d('0x10')][_0xa15d('0x12')]);return _0x3d6d10(_0x42ff2e[_0xa15d('0x10')]['message']);}else{logger[_0xa15d('0xc')](_0xa15d('0x11'),_0x1cbcc3,_0xa15d('0xd'));_0x3d6d10(_0x42ff2e[_0xa15d('0x13')][_0xa15d('0x12')]);}})[_0xa15d('0x14')](function(_0x44cabd){logger[_0xa15d('0x10')](_0xa15d('0x11'),_0x1cbcc3,_0x44cabd);_0x5dc97f(_0x44cabd);});});}exports['CreateChatQueueReport']=function(_0xd2a3f9){var _0x45b3bf=this;return new Promise(function(_0x40b199,_0x333eb3){return db[_0xa15d('0x15')][_0xa15d('0x16')](_0xd2a3f9[_0xa15d('0x17')],{'raw':_0xd2a3f9[_0xa15d('0x18')]?_0xd2a3f9[_0xa15d('0x18')][_0xa15d('0x19')]===undefined?!![]:![]:!![]})[_0xa15d('0xb')](function(_0x47929a){logger[_0xa15d('0xc')](_0xa15d('0x1a'),_0xd2a3f9);logger[_0xa15d('0x1b')](_0xa15d('0x1a'),_0xd2a3f9,JSON[_0xa15d('0xf')](_0x47929a));_0x40b199(_0x47929a);})[_0xa15d('0x14')](function(_0x4e8d4c){logger[_0xa15d('0x10')]('CreateChatQueueReport',_0x4e8d4c[_0xa15d('0x12')],_0xd2a3f9);_0x333eb3(_0x45b3bf[_0xa15d('0x10')](0x1f4,_0x4e8d4c[_0xa15d('0x12')]));});});};exports[_0xa15d('0x1c')]=function(_0x540dad){var _0x48d008=this;return new Promise(function(_0xda6b7d,_0x3af16f){return db[_0xa15d('0x15')]['update'](_0x540dad[_0xa15d('0x17')],{'raw':_0x540dad[_0xa15d('0x18')]?_0x540dad['options'][_0xa15d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540dad[_0xa15d('0x18')]?_0x540dad[_0xa15d('0x18')][_0xa15d('0x1d')]||null:null,'attributes':_0x540dad[_0xa15d('0x18')]?_0x540dad[_0xa15d('0x18')]['attributes']||null:null,'limit':_0x540dad[_0xa15d('0x18')]?_0x540dad[_0xa15d('0x18')][_0xa15d('0x1e')]||null:null})[_0xa15d('0xb')](function(_0x5079ab){logger[_0xa15d('0xc')](_0xa15d('0x1c'),_0x540dad);logger['debug'](_0xa15d('0x1c'),_0x540dad,JSON['stringify'](_0x5079ab));_0xda6b7d(_0x5079ab);})[_0xa15d('0x14')](function(_0x3df8fb){logger[_0xa15d('0x10')](_0xa15d('0x1c'),_0x3df8fb[_0xa15d('0x12')],_0x540dad);_0x3af16f(_0x48d008[_0xa15d('0x10')](0x1f4,_0x3df8fb[_0xa15d('0x12')]));});});}; \ No newline at end of file +var _0xb19e=['limit','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','debug','UpdateChatQueueReport','update','raw','where','attributes'];(function(_0x507962,_0x2e50db){var _0x3d4660=function(_0x110332){while(--_0x110332){_0x507962['push'](_0x507962['shift']());}};_0x3d4660(++_0x2e50db);}(_0xb19e,0x187));var _0xeb19=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xb19e[_0x29d2d2];return _0x3f6476;};'use strict';var _=require(_0xeb19('0x0'));var util=require(_0xeb19('0x1'));var moment=require(_0xeb19('0x2'));var BPromise=require(_0xeb19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb19('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb19('0x5'))('rpc');var config=require(_0xeb19('0x6'));var jayson=require(_0xeb19('0x7'));var client=jayson[_0xeb19('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x508507,_0x3a65bb,_0x5ec428){return new BPromise(function(_0x2ea12c,_0x5bd778){return client[_0xeb19('0x9')](_0x508507,_0x5ec428)[_0xeb19('0xa')](function(_0x41efa1){logger[_0xeb19('0xb')](_0xeb19('0xc'),_0x3a65bb,'request\x20sent');logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x3a65bb,_0xeb19('0xd'),JSON[_0xeb19('0xe')](_0x41efa1));if(_0x41efa1[_0xeb19('0xf')]){if(_0x41efa1[_0xeb19('0xf')]['code']===0x1f4){logger[_0xeb19('0xf')](_0xeb19('0xc'),_0x3a65bb,_0x41efa1[_0xeb19('0xf')][_0xeb19('0x10')]);return _0x5bd778(_0x41efa1[_0xeb19('0xf')][_0xeb19('0x10')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3a65bb,_0x41efa1[_0xeb19('0xf')][_0xeb19('0x10')]);return _0x2ea12c(_0x41efa1[_0xeb19('0xf')][_0xeb19('0x10')]);}else{logger[_0xeb19('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x3a65bb,_0xeb19('0xd'));_0x2ea12c(_0x41efa1['result'][_0xeb19('0x10')]);}})[_0xeb19('0x11')](function(_0x57a9bb){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3a65bb,_0x57a9bb);_0x5bd778(_0x57a9bb);});});}exports[_0xeb19('0x12')]=function(_0x1eb305){var _0x2ab088=this;return new Promise(function(_0x27ab78,_0x16f703){return db[_0xeb19('0x13')][_0xeb19('0x14')](_0x1eb305[_0xeb19('0x15')],{'raw':_0x1eb305[_0xeb19('0x16')]?_0x1eb305[_0xeb19('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xeb19('0xa')](function(_0x1290b3){logger[_0xeb19('0xb')](_0xeb19('0x12'),_0x1eb305);logger[_0xeb19('0x17')](_0xeb19('0x12'),_0x1eb305,JSON[_0xeb19('0xe')](_0x1290b3));_0x27ab78(_0x1290b3);})[_0xeb19('0x11')](function(_0x170010){logger[_0xeb19('0xf')](_0xeb19('0x12'),_0x170010['message'],_0x1eb305);_0x16f703(_0x2ab088[_0xeb19('0xf')](0x1f4,_0x170010[_0xeb19('0x10')]));});});};exports[_0xeb19('0x18')]=function(_0x8ea878){var _0x4a0d40=this;return new Promise(function(_0x239456,_0x269438){return db['ChatQueueReport'][_0xeb19('0x19')](_0x8ea878[_0xeb19('0x15')],{'raw':_0x8ea878[_0xeb19('0x16')]?_0x8ea878['options'][_0xeb19('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8ea878['options']?_0x8ea878['options'][_0xeb19('0x1b')]||null:null,'attributes':_0x8ea878['options']?_0x8ea878[_0xeb19('0x16')][_0xeb19('0x1c')]||null:null,'limit':_0x8ea878[_0xeb19('0x16')]?_0x8ea878[_0xeb19('0x16')][_0xeb19('0x1d')]||null:null})[_0xeb19('0xa')](function(_0x33f114){logger['info'](_0xeb19('0x18'),_0x8ea878);logger['debug'](_0xeb19('0x18'),_0x8ea878,JSON[_0xeb19('0xe')](_0x33f114));_0x239456(_0x33f114);})[_0xeb19('0x11')](function(_0x2dce16){logger[_0xeb19('0xf')]('UpdateChatQueueReport',_0x2dce16[_0xeb19('0x10')],_0x8ea878);_0x269438(_0x4a0d40[_0xeb19('0xf')](0x1f4,_0x2dce16[_0xeb19('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d336760..9a6ca5b 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 _0xb0e5=['path','express','../../components/auth/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x537dd7,_0x39dc6b){var _0x36ab74=function(_0x486e72){while(--_0x486e72){_0x537dd7['push'](_0x537dd7['shift']());}};_0x36ab74(++_0x39dc6b);}(_0xb0e5,0x71));var _0x5b0e=function(_0x4e7162,_0x318933){_0x4e7162=_0x4e7162-0x0;var _0x26030f=_0xb0e5[_0x4e7162];return _0x26030f;};'use strict';var multer=require('multer');var util=require(_0x5b0e('0x0'));var path=require(_0x5b0e('0x1'));var timeout=require('connect-timeout');var express=require(_0x5b0e('0x2'));var router=express['Router']();var auth=require(_0x5b0e('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b0e('0x4'));router[_0x5b0e('0x5')]('/',auth[_0x5b0e('0x6')](),controller[_0x5b0e('0x7')]);router[_0x5b0e('0x5')](_0x5b0e('0x8'),auth[_0x5b0e('0x6')](),controller[_0x5b0e('0x9')]);router[_0x5b0e('0x5')](_0x5b0e('0xa'),auth[_0x5b0e('0x6')](),controller[_0x5b0e('0xb')]);router[_0x5b0e('0xc')]('/',auth[_0x5b0e('0x6')](),controller[_0x5b0e('0xd')]);router[_0x5b0e('0xe')](_0x5b0e('0xa'),auth[_0x5b0e('0x6')](),controller[_0x5b0e('0xf')]);router[_0x5b0e('0x10')]('/:id',auth[_0x5b0e('0x6')](),controller[_0x5b0e('0x11')]);module[_0x5b0e('0x12')]=router; \ No newline at end of file +var _0xda40=['update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x33e613,_0x2e55f0){var _0x421c4b=function(_0x414491){while(--_0x414491){_0x33e613['push'](_0x33e613['shift']());}};_0x421c4b(++_0x2e55f0);}(_0xda40,0xbf));var _0x0da4=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0xda40[_0x146837];return _0x3d7e60;};'use strict';var multer=require(_0x0da4('0x0'));var util=require('util');var path=require(_0x0da4('0x1'));var timeout=require('connect-timeout');var express=require(_0x0da4('0x2'));var router=express['Router']();var auth=require(_0x0da4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0da4('0x4'));var controller=require('./chatQueueReport.controller');router[_0x0da4('0x5')]('/',auth[_0x0da4('0x6')](),controller[_0x0da4('0x7')]);router[_0x0da4('0x5')]('/describe',auth[_0x0da4('0x6')](),controller[_0x0da4('0x8')]);router[_0x0da4('0x5')](_0x0da4('0x9'),auth[_0x0da4('0x6')](),controller[_0x0da4('0xa')]);router[_0x0da4('0xb')]('/',auth[_0x0da4('0x6')](),controller[_0x0da4('0xc')]);router['put'](_0x0da4('0x9'),auth[_0x0da4('0x6')](),controller[_0x0da4('0xd')]);router[_0x0da4('0xe')](_0x0da4('0x9'),auth[_0x0da4('0x6')](),controller[_0x0da4('0xf')]);module[_0x0da4('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index e15e0c8..4f0efca 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 _0x647b=['DATE','NOW','moment','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x5e2ca6,_0x17a84b){var _0x2f03df=function(_0x31210d){while(--_0x31210d){_0x5e2ca6['push'](_0x5e2ca6['shift']());}};_0x2f03df(++_0x17a84b);}(_0x647b,0xac));var _0xb647=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x647b[_0x18ab2a];return _0x16dcee;};'use strict';var moment=require(_0xb647('0x0'));var Sequelize=require(_0xb647('0x1'));module[_0xb647('0x2')]={'uniqueid':{'type':Sequelize[_0xb647('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb647('0x4')](_0xb647('0x5'),_0xb647('0x6'),_0xb647('0x7')),'allowNull':![],'defaultValue':_0xb647('0x7')},'transferredAt':{'type':Sequelize[_0xb647('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xb647('0x9')]}}; \ No newline at end of file +var _0x3728=['queue','DATE','moment','sequelize','exports','STRING','ENUM','agent'];(function(_0x2f63e4,_0x44499a){var _0x1fe1ce=function(_0x3cc862){while(--_0x3cc862){_0x2f63e4['push'](_0x2f63e4['shift']());}};_0x1fe1ce(++_0x44499a);}(_0x3728,0x82));var _0x8372=function(_0x3c8476,_0x5c0b5d){_0x3c8476=_0x3c8476-0x0;var _0x1eab91=_0x3728[_0x3c8476];return _0x1eab91;};'use strict';var moment=require(_0x8372('0x0'));var Sequelize=require(_0x8372('0x1'));module[_0x8372('0x2')]={'uniqueid':{'type':Sequelize[_0x8372('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8372('0x4')]('account',_0x8372('0x5'),_0x8372('0x6')),'allowNull':![],'defaultValue':_0x8372('0x6')},'transferredAt':{'type':Sequelize[_0x8372('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 74b62d4..d10424d 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 _0x9d89=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','count','offset','set','apply','reject','destroy','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','then','includeAll','include','catch','params','keys','length','find','create','body','update','describe','eml-format'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x9d89,0x1d4));var _0x99d8=function(_0x5f0785,_0x58495b){_0x5f0785=_0x5f0785-0x0;var _0xa46050=_0x9d89[_0x5f0785];return _0xa46050;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x99d8('0x0'));var rimraf=require(_0x99d8('0x1'));var zipdir=require(_0x99d8('0x2'));var jsonpatch=require(_0x99d8('0x3'));var rp=require('request-promise');var moment=require(_0x99d8('0x4'));var BPromise=require(_0x99d8('0x5'));var Mustache=require(_0x99d8('0x6'));var util=require(_0x99d8('0x7'));var path=require('path');var sox=require(_0x99d8('0x8'));var csv=require(_0x99d8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x99d8('0xa'));var squel=require(_0x99d8('0xb'));var crypto=require(_0x99d8('0xc'));var jsforce=require(_0x99d8('0xd'));var deskjs=require(_0x99d8('0xe'));var toCsv=require(_0x99d8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99d8('0xf'));var authService=require(_0x99d8('0x10'));var qs=require(_0x99d8('0x11'));var as=require(_0x99d8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x99d8('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x99d8('0x14'))['db'];function respondWithStatusCode(_0x217bff,_0x2dc63d){_0x2dc63d=_0x2dc63d||0xcc;return function(_0x25070a){if(_0x25070a){return _0x217bff[_0x99d8('0x15')](_0x2dc63d);}return _0x217bff[_0x99d8('0x16')](_0x2dc63d)[_0x99d8('0x17')]();};}function respondWithResult(_0x259ace,_0x1c8695){_0x1c8695=_0x1c8695||0xc8;return function(_0x279533){if(_0x279533){return _0x259ace[_0x99d8('0x16')](_0x1c8695)['json'](_0x279533);}};}function respondWithFilteredResult(_0x14967c,_0x3c8799){return function(_0x2ce595){if(_0x2ce595){var _0x3fe294=_0x2ce595[_0x99d8('0x18')],_0x51e892=_0x3c8799[_0x99d8('0x19')],_0x25eee0=_0x3c8799['offset']+_0x3c8799['limit'],_0x470979;if(_0x25eee0>=_0x3fe294){_0x25eee0=_0x3fe294;_0x470979=0xc8;}else{_0x470979=0xce;}_0x14967c[_0x99d8('0x16')](_0x470979);return _0x14967c[_0x99d8('0x1a')]('Content-Range',_0x51e892+'-'+_0x25eee0+'/'+_0x3fe294)['json'](_0x2ce595);}return null;};}function patchUpdates(_0x13e72e){return function(_0x34be3f){try{jsonpatch[_0x99d8('0x1b')](_0x34be3f,_0x13e72e,!![]);}catch(_0x187a13){return BPromise[_0x99d8('0x1c')](_0x187a13);}return _0x34be3f['save']();};}function saveUpdates(_0xbde9b7,_0x3d88e7){return function(_0x2c7412){if(_0x2c7412){return _0x2c7412['update'](_0xbde9b7)['then'](function(_0x1c2521){return _0x1c2521;});}return null;};}function removeEntity(_0x503798,_0x419a98){return function(_0x4457ba){if(_0x4457ba){return _0x4457ba[_0x99d8('0x1d')]()['then'](function(){_0x503798[_0x99d8('0x16')](0xcc)[_0x99d8('0x17')]();});}};}function handleEntityNotFound(_0x4d62ca,_0x34f112){return function(_0x4bbdcb){if(!_0x4bbdcb){_0x4d62ca[_0x99d8('0x15')](0x194);}return _0x4bbdcb;};}function handleError(_0x157681,_0x14b4a6){_0x14b4a6=_0x14b4a6||0x1f4;return function(_0x37f901){logger[_0x99d8('0x1e')](_0x37f901['stack']);if(_0x37f901[_0x99d8('0x1f')]){delete _0x37f901['name'];}_0x157681[_0x99d8('0x16')](_0x14b4a6)[_0x99d8('0x20')](_0x37f901);};}exports[_0x99d8('0x21')]=function(_0x37e956,_0x28f09a){var _0x4b2a4a={},_0x2d9c6c={},_0x3be06a={'count':0x0,'rows':[]};var _0x405003=_[_0x99d8('0x22')](db[_0x99d8('0x23')][_0x99d8('0x24')],function(_0x5c71ae){return{'name':_0x5c71ae[_0x99d8('0x25')],'type':_0x5c71ae[_0x99d8('0x26')][_0x99d8('0x27')]};});_0x2d9c6c[_0x99d8('0x28')]=_['map'](_0x405003,'name');_0x2d9c6c['query']=_['keys'](_0x37e956[_0x99d8('0x29')]);_0x2d9c6c[_0x99d8('0x2a')]=_['intersection'](_0x2d9c6c[_0x99d8('0x28')],_0x2d9c6c[_0x99d8('0x29')]);_0x4b2a4a[_0x99d8('0x2b')]=_[_0x99d8('0x2c')](_0x2d9c6c['model'],qs[_0x99d8('0x2d')](_0x37e956[_0x99d8('0x29')][_0x99d8('0x2d')]));_0x4b2a4a[_0x99d8('0x2b')]=_0x4b2a4a[_0x99d8('0x2b')]['length']?_0x4b2a4a[_0x99d8('0x2b')]:_0x2d9c6c[_0x99d8('0x28')];if(!_0x37e956[_0x99d8('0x29')]['hasOwnProperty'](_0x99d8('0x2e'))){_0x4b2a4a[_0x99d8('0x2f')]=qs['limit'](_0x37e956['query'][_0x99d8('0x2f')]);_0x4b2a4a[_0x99d8('0x19')]=qs['offset'](_0x37e956[_0x99d8('0x29')]['offset']);}_0x4b2a4a[_0x99d8('0x30')]=qs[_0x99d8('0x31')](_0x37e956['query'][_0x99d8('0x31')]);_0x4b2a4a[_0x99d8('0x32')]=qs[_0x99d8('0x2a')](_['pick'](_0x37e956['query'],_0x2d9c6c[_0x99d8('0x2a')]),_0x405003);if(_0x37e956['query'][_0x99d8('0x33')]){_0x4b2a4a[_0x99d8('0x32')]=_['merge'](_0x4b2a4a[_0x99d8('0x32')],{'$or':_[_0x99d8('0x22')](_0x405003,function(_0x3b6e93){if(_0x3b6e93[_0x99d8('0x26')]!==_0x99d8('0x34')){var _0x3a4fad={};_0x3a4fad[_0x3b6e93[_0x99d8('0x1f')]]={'$like':'%'+_0x37e956['query']['filter']+'%'};return _0x3a4fad;}})});}_0x4b2a4a=_[_0x99d8('0x35')]({},_0x4b2a4a,_0x37e956[_0x99d8('0x36')]);var _0x22becb={'where':_0x4b2a4a['where']};return db[_0x99d8('0x23')]['count'](_0x22becb)[_0x99d8('0x37')](function(_0x567f82){_0x3be06a[_0x99d8('0x18')]=_0x567f82;if(_0x37e956['query'][_0x99d8('0x38')]){_0x4b2a4a[_0x99d8('0x39')]=[{'all':!![]}];}return db[_0x99d8('0x23')]['findAll'](_0x4b2a4a);})[_0x99d8('0x37')](function(_0xeacc86){_0x3be06a['rows']=_0xeacc86;return _0x3be06a;})[_0x99d8('0x37')](respondWithFilteredResult(_0x28f09a,_0x4b2a4a))[_0x99d8('0x3a')](handleError(_0x28f09a,null));};exports['show']=function(_0x5aa341,_0x365f4b){var _0x2a45f4={'raw':!![],'where':{'id':_0x5aa341[_0x99d8('0x3b')]['id']}},_0x52883d={};_0x52883d['model']=_[_0x99d8('0x3c')](db[_0x99d8('0x23')][_0x99d8('0x24')]);_0x52883d[_0x99d8('0x29')]=_[_0x99d8('0x3c')](_0x5aa341[_0x99d8('0x29')]);_0x52883d['filters']=_[_0x99d8('0x2c')](_0x52883d[_0x99d8('0x28')],_0x52883d[_0x99d8('0x29')]);_0x2a45f4[_0x99d8('0x2b')]=_['intersection'](_0x52883d['model'],qs['fields'](_0x5aa341['query']['fields']));_0x2a45f4[_0x99d8('0x2b')]=_0x2a45f4[_0x99d8('0x2b')][_0x99d8('0x3d')]?_0x2a45f4[_0x99d8('0x2b')]:_0x52883d[_0x99d8('0x28')];if(_0x5aa341[_0x99d8('0x29')]['includeAll']){_0x2a45f4[_0x99d8('0x39')]=[{'all':!![]}];}_0x2a45f4=_[_0x99d8('0x35')]({},_0x2a45f4,_0x5aa341[_0x99d8('0x36')]);return db['ChatTransferReport'][_0x99d8('0x3e')](_0x2a45f4)[_0x99d8('0x37')](handleEntityNotFound(_0x365f4b,null))[_0x99d8('0x37')](respondWithResult(_0x365f4b,null))[_0x99d8('0x3a')](handleError(_0x365f4b,null));};exports[_0x99d8('0x3f')]=function(_0x1d5cf7,_0x516dd3){return db[_0x99d8('0x23')]['create'](_0x1d5cf7[_0x99d8('0x40')],{})[_0x99d8('0x37')](respondWithResult(_0x516dd3,0xc9))['catch'](handleError(_0x516dd3,null));};exports[_0x99d8('0x41')]=function(_0x5e789f,_0x34836a){if(_0x5e789f[_0x99d8('0x40')]['id']){delete _0x5e789f[_0x99d8('0x40')]['id'];}return db['ChatTransferReport'][_0x99d8('0x3e')]({'where':{'id':_0x5e789f[_0x99d8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x34836a,null))[_0x99d8('0x37')](saveUpdates(_0x5e789f[_0x99d8('0x40')],null))['then'](respondWithResult(_0x34836a,null))['catch'](handleError(_0x34836a,null));};exports[_0x99d8('0x1d')]=function(_0x1d0a33,_0x2d0877){return db[_0x99d8('0x23')][_0x99d8('0x3e')]({'where':{'id':_0x1d0a33[_0x99d8('0x3b')]['id']}})[_0x99d8('0x37')](handleEntityNotFound(_0x2d0877,null))[_0x99d8('0x37')](removeEntity(_0x2d0877,null))[_0x99d8('0x3a')](handleError(_0x2d0877,null));};exports[_0x99d8('0x42')]=function(_0x40416b,_0xf51b05){return db[_0x99d8('0x23')]['describe']()[_0x99d8('0x37')](respondWithResult(_0xf51b05,null))['catch'](handleError(_0xf51b05,null));}; \ No newline at end of file +var _0xc568=['send','index','ChatTransferReport','rawAttributes','model','map','query','keys','filters','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','intersection','length','include','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','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','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc568,0x102));var _0x8c56=function(_0x1634bf,_0xda08a7){_0x1634bf=_0x1634bf-0x0;var _0x32643d=_0xc568[_0x1634bf];return _0x32643d;};'use strict';var pdf=require(_0x8c56('0x0'));var emlformat=require(_0x8c56('0x1'));var rimraf=require(_0x8c56('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c56('0x3'));var rp=require(_0x8c56('0x4'));var moment=require(_0x8c56('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8c56('0x6'));var path=require(_0x8c56('0x7'));var sox=require(_0x8c56('0x8'));var csv=require(_0x8c56('0x9'));var ejs=require(_0x8c56('0xa'));var fs=require('fs');var _=require(_0x8c56('0xb'));var squel=require(_0x8c56('0xc'));var crypto=require(_0x8c56('0xd'));var jsforce=require(_0x8c56('0xe'));var deskjs=require(_0x8c56('0xf'));var toCsv=require(_0x8c56('0x9'));var querystring=require(_0x8c56('0x10'));var Papa=require(_0x8c56('0x11'));var Redis=require(_0x8c56('0x12'));var authService=require(_0x8c56('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8c56('0x14'));var hardwareService=require(_0x8c56('0x15'));var logger=require(_0x8c56('0x16'))(_0x8c56('0x17'));var utils=require(_0x8c56('0x18'));var config=require(_0x8c56('0x19'));var db=require(_0x8c56('0x1a'))['db'];function respondWithStatusCode(_0x544f39,_0x2d8b12){_0x2d8b12=_0x2d8b12||0xcc;return function(_0xecb376){if(_0xecb376){return _0x544f39[_0x8c56('0x1b')](_0x2d8b12);}return _0x544f39[_0x8c56('0x1c')](_0x2d8b12)[_0x8c56('0x1d')]();};}function respondWithResult(_0x33734c,_0x23c9b7){_0x23c9b7=_0x23c9b7||0xc8;return function(_0x1458ba){if(_0x1458ba){return _0x33734c['status'](_0x23c9b7)[_0x8c56('0x1e')](_0x1458ba);}};}function respondWithFilteredResult(_0x2bd643,_0x172064){return function(_0x4fdf1a){if(_0x4fdf1a){var _0x547f9d=_0x4fdf1a[_0x8c56('0x1f')],_0x35d0ad=_0x172064[_0x8c56('0x20')],_0x5c4e9b=_0x172064[_0x8c56('0x20')]+_0x172064['limit'],_0x3a65fd;if(_0x5c4e9b>=_0x547f9d){_0x5c4e9b=_0x547f9d;_0x3a65fd=0xc8;}else{_0x3a65fd=0xce;}_0x2bd643[_0x8c56('0x1c')](_0x3a65fd);return _0x2bd643[_0x8c56('0x21')](_0x8c56('0x22'),_0x35d0ad+'-'+_0x5c4e9b+'/'+_0x547f9d)[_0x8c56('0x1e')](_0x4fdf1a);}return null;};}function patchUpdates(_0x1ae4a3){return function(_0xa7eeb5){try{jsonpatch[_0x8c56('0x23')](_0xa7eeb5,_0x1ae4a3,!![]);}catch(_0x34ae3f){return BPromise[_0x8c56('0x24')](_0x34ae3f);}return _0xa7eeb5[_0x8c56('0x25')]();};}function saveUpdates(_0x32822d,_0x1d2de6){return function(_0x2f4dfe){if(_0x2f4dfe){return _0x2f4dfe['update'](_0x32822d)[_0x8c56('0x26')](function(_0xb2927c){return _0xb2927c;});}return null;};}function removeEntity(_0x1b93bf,_0x585e0e){return function(_0x4e8dae){if(_0x4e8dae){return _0x4e8dae[_0x8c56('0x27')]()[_0x8c56('0x26')](function(){_0x1b93bf[_0x8c56('0x1c')](0xcc)[_0x8c56('0x1d')]();});}};}function handleEntityNotFound(_0x3284c3,_0x34911e){return function(_0x2d9ff1){if(!_0x2d9ff1){_0x3284c3[_0x8c56('0x1b')](0x194);}return _0x2d9ff1;};}function handleError(_0x9c3240,_0x18aefb){_0x18aefb=_0x18aefb||0x1f4;return function(_0x345848){logger[_0x8c56('0x28')](_0x345848['stack']);if(_0x345848[_0x8c56('0x29')]){delete _0x345848[_0x8c56('0x29')];}_0x9c3240['status'](_0x18aefb)[_0x8c56('0x2a')](_0x345848);};}exports[_0x8c56('0x2b')]=function(_0x44fe35,_0x4a77ba){var _0x4b886c={},_0x5223d7={},_0x749d4a={'count':0x0,'rows':[]};var _0x1d69d6=_['map'](db[_0x8c56('0x2c')][_0x8c56('0x2d')],function(_0x56698d){return{'name':_0x56698d['fieldName'],'type':_0x56698d['type']['key']};});_0x5223d7[_0x8c56('0x2e')]=_[_0x8c56('0x2f')](_0x1d69d6,_0x8c56('0x29'));_0x5223d7[_0x8c56('0x30')]=_[_0x8c56('0x31')](_0x44fe35[_0x8c56('0x30')]);_0x5223d7[_0x8c56('0x32')]=_['intersection'](_0x5223d7[_0x8c56('0x2e')],_0x5223d7['query']);_0x4b886c[_0x8c56('0x33')]=_['intersection'](_0x5223d7[_0x8c56('0x2e')],qs[_0x8c56('0x34')](_0x44fe35[_0x8c56('0x30')][_0x8c56('0x34')]));_0x4b886c[_0x8c56('0x33')]=_0x4b886c[_0x8c56('0x33')]['length']?_0x4b886c[_0x8c56('0x33')]:_0x5223d7[_0x8c56('0x2e')];if(!_0x44fe35[_0x8c56('0x30')][_0x8c56('0x35')]('nolimit')){_0x4b886c[_0x8c56('0x36')]=qs[_0x8c56('0x36')](_0x44fe35['query'][_0x8c56('0x36')]);_0x4b886c[_0x8c56('0x20')]=qs[_0x8c56('0x20')](_0x44fe35[_0x8c56('0x30')][_0x8c56('0x20')]);}_0x4b886c[_0x8c56('0x37')]=qs[_0x8c56('0x38')](_0x44fe35[_0x8c56('0x30')][_0x8c56('0x38')]);_0x4b886c[_0x8c56('0x39')]=qs['filters'](_['pick'](_0x44fe35['query'],_0x5223d7['filters']),_0x1d69d6);if(_0x44fe35[_0x8c56('0x30')][_0x8c56('0x3a')]){_0x4b886c[_0x8c56('0x39')]=_['merge'](_0x4b886c[_0x8c56('0x39')],{'$or':_[_0x8c56('0x2f')](_0x1d69d6,function(_0x31dfdd){if(_0x31dfdd['type']!==_0x8c56('0x3b')){var _0xb01378={};_0xb01378[_0x31dfdd['name']]={'$like':'%'+_0x44fe35[_0x8c56('0x30')][_0x8c56('0x3a')]+'%'};return _0xb01378;}})});}_0x4b886c=_[_0x8c56('0x3c')]({},_0x4b886c,_0x44fe35['options']);var _0xe934af={'where':_0x4b886c[_0x8c56('0x39')]};return db[_0x8c56('0x2c')][_0x8c56('0x1f')](_0xe934af)[_0x8c56('0x26')](function(_0x2f4077){_0x749d4a[_0x8c56('0x1f')]=_0x2f4077;if(_0x44fe35[_0x8c56('0x30')][_0x8c56('0x3d')]){_0x4b886c['include']=[{'all':!![]}];}return db[_0x8c56('0x2c')][_0x8c56('0x3e')](_0x4b886c);})['then'](function(_0x3f447d){_0x749d4a[_0x8c56('0x3f')]=_0x3f447d;return _0x749d4a;})['then'](respondWithFilteredResult(_0x4a77ba,_0x4b886c))['catch'](handleError(_0x4a77ba,null));};exports[_0x8c56('0x40')]=function(_0x2bd240,_0x20b09f){var _0x49b485={'raw':!![],'where':{'id':_0x2bd240[_0x8c56('0x41')]['id']}},_0x45cd54={};_0x45cd54['model']=_[_0x8c56('0x31')](db[_0x8c56('0x2c')][_0x8c56('0x2d')]);_0x45cd54[_0x8c56('0x30')]=_['keys'](_0x2bd240[_0x8c56('0x30')]);_0x45cd54[_0x8c56('0x32')]=_[_0x8c56('0x42')](_0x45cd54['model'],_0x45cd54[_0x8c56('0x30')]);_0x49b485[_0x8c56('0x33')]=_[_0x8c56('0x42')](_0x45cd54[_0x8c56('0x2e')],qs[_0x8c56('0x34')](_0x2bd240[_0x8c56('0x30')]['fields']));_0x49b485[_0x8c56('0x33')]=_0x49b485[_0x8c56('0x33')][_0x8c56('0x43')]?_0x49b485[_0x8c56('0x33')]:_0x45cd54['model'];if(_0x2bd240[_0x8c56('0x30')][_0x8c56('0x3d')]){_0x49b485[_0x8c56('0x44')]=[{'all':!![]}];}_0x49b485=_[_0x8c56('0x3c')]({},_0x49b485,_0x2bd240[_0x8c56('0x45')]);return db[_0x8c56('0x2c')][_0x8c56('0x46')](_0x49b485)[_0x8c56('0x26')](handleEntityNotFound(_0x20b09f,null))[_0x8c56('0x26')](respondWithResult(_0x20b09f,null))[_0x8c56('0x47')](handleError(_0x20b09f,null));};exports[_0x8c56('0x48')]=function(_0x48c12f,_0x2c6bb0){return db['ChatTransferReport'][_0x8c56('0x48')](_0x48c12f[_0x8c56('0x49')],{})[_0x8c56('0x26')](respondWithResult(_0x2c6bb0,0xc9))['catch'](handleError(_0x2c6bb0,null));};exports['update']=function(_0x4ea86a,_0x31333a){if(_0x4ea86a[_0x8c56('0x49')]['id']){delete _0x4ea86a['body']['id'];}return db[_0x8c56('0x2c')][_0x8c56('0x46')]({'where':{'id':_0x4ea86a[_0x8c56('0x41')]['id']}})[_0x8c56('0x26')](handleEntityNotFound(_0x31333a,null))[_0x8c56('0x26')](saveUpdates(_0x4ea86a[_0x8c56('0x49')],null))['then'](respondWithResult(_0x31333a,null))[_0x8c56('0x47')](handleError(_0x31333a,null));};exports[_0x8c56('0x27')]=function(_0x388c52,_0x1fd504){return db[_0x8c56('0x2c')][_0x8c56('0x46')]({'where':{'id':_0x388c52[_0x8c56('0x41')]['id']}})[_0x8c56('0x26')](handleEntityNotFound(_0x1fd504,null))[_0x8c56('0x26')](removeEntity(_0x1fd504,null))[_0x8c56('0x47')](handleError(_0x1fd504,null));};exports[_0x8c56('0x4a')]=function(_0x202fa7,_0x33670c){return db[_0x8c56('0x2c')]['describe']()[_0x8c56('0x26')](respondWithResult(_0x33670c,null))[_0x8c56('0x47')](handleError(_0x33670c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 90ad686..7a0a3b2 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 _0xa41a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','report_chat_transfer','uniqueid','lodash'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xa41a,0x6b));var _0xaa41=function(_0x4a715b,_0x5df303){_0x4a715b=_0x4a715b-0x0;var _0x36a3c2=_0xa41a[_0x4a715b];return _0x36a3c2;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('ChatTransferReport',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[{'name':_0xaa41('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['../../config/logger','api','moment','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x3e74,0x175));var _0x43e7=function(_0x325c39,_0x253dfa){_0x325c39=_0x325c39-0x0;var _0x3622ac=_0x3e74[_0x325c39];return _0x3622ac;};'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('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d0eb2eb..ec82fa5 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 _0x8ea9=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','ChatTransferReport,\x20%s,\x20%s'];(function(_0x5ddb67,_0x3beaac){var _0xc01a30=function(_0x5d6291){while(--_0x5d6291){_0x5ddb67['push'](_0x5ddb67['shift']());}};_0xc01a30(++_0x3beaac);}(_0x8ea9,0x112));var _0x98ea=function(_0x1c5876,_0x19aa5c){_0x1c5876=_0x1c5876-0x0;var _0x2b3068=_0x8ea9[_0x1c5876];return _0x2b3068;};'use strict';var _=require(_0x98ea('0x0'));var util=require(_0x98ea('0x1'));var moment=require(_0x98ea('0x2'));var BPromise=require(_0x98ea('0x3'));var rs=require(_0x98ea('0x4'));var fs=require('fs');var Redis=require(_0x98ea('0x5'));var db=require(_0x98ea('0x6'))['db'];var utils=require(_0x98ea('0x7'));var logger=require(_0x98ea('0x8'))(_0x98ea('0x9'));var config=require(_0x98ea('0xa'));var jayson=require(_0x98ea('0xb'));var client=jayson[_0x98ea('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16ef9f,_0x234cf5,_0x3f8761){return new BPromise(function(_0x2f9026,_0x4fa0fc){return client['request'](_0x16ef9f,_0x3f8761)['then'](function(_0x2f2f79){logger['info'](_0x98ea('0xd'),_0x234cf5,'request\x20sent');logger[_0x98ea('0xe')](_0x98ea('0xf'),_0x234cf5,_0x98ea('0x10'),JSON[_0x98ea('0x11')](_0x2f2f79));if(_0x2f2f79[_0x98ea('0x12')]){if(_0x2f2f79[_0x98ea('0x12')][_0x98ea('0x13')]===0x1f4){logger[_0x98ea('0x12')](_0x98ea('0xd'),_0x234cf5,_0x2f2f79[_0x98ea('0x12')]['message']);return _0x4fa0fc(_0x2f2f79[_0x98ea('0x12')]['message']);}logger['error'](_0x98ea('0xd'),_0x234cf5,_0x2f2f79[_0x98ea('0x12')][_0x98ea('0x14')]);return _0x2f9026(_0x2f2f79[_0x98ea('0x12')][_0x98ea('0x14')]);}else{logger[_0x98ea('0x15')](_0x98ea('0xd'),_0x234cf5,_0x98ea('0x10'));_0x2f9026(_0x2f2f79[_0x98ea('0x16')][_0x98ea('0x14')]);}})[_0x98ea('0x17')](function(_0x8eb702){logger['error'](_0x98ea('0xd'),_0x234cf5,_0x8eb702);_0x4fa0fc(_0x8eb702);});});} \ No newline at end of file +var _0x9dc0=['error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4bdf85,_0x1d57e6){var _0x285104=function(_0x30a2db){while(--_0x30a2db){_0x4bdf85['push'](_0x4bdf85['shift']());}};_0x285104(++_0x1d57e6);}(_0x9dc0,0x155));var _0x09dc=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0x9dc0[_0x1f1e31];return _0x229b56;};'use strict';var _=require(_0x09dc('0x0'));var util=require(_0x09dc('0x1'));var moment=require(_0x09dc('0x2'));var BPromise=require(_0x09dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09dc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x09dc('0x5'));var logger=require('../../config/logger')(_0x09dc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x09dc('0x7')][_0x09dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4488a0,_0x1ca1fd,_0x4d7621){return new BPromise(function(_0x2c5987,_0x4bbd54){return client[_0x09dc('0x9')](_0x4488a0,_0x4d7621)[_0x09dc('0xa')](function(_0x81b7af){logger['info'](_0x09dc('0xb'),_0x1ca1fd,'request\x20sent');logger[_0x09dc('0xc')](_0x09dc('0xd'),_0x1ca1fd,_0x09dc('0xe'),JSON[_0x09dc('0xf')](_0x81b7af));if(_0x81b7af[_0x09dc('0x10')]){if(_0x81b7af[_0x09dc('0x10')][_0x09dc('0x11')]===0x1f4){logger[_0x09dc('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x1ca1fd,_0x81b7af[_0x09dc('0x10')][_0x09dc('0x12')]);return _0x4bbd54(_0x81b7af[_0x09dc('0x10')][_0x09dc('0x12')]);}logger[_0x09dc('0x10')](_0x09dc('0xb'),_0x1ca1fd,_0x81b7af[_0x09dc('0x10')][_0x09dc('0x12')]);return _0x2c5987(_0x81b7af[_0x09dc('0x10')][_0x09dc('0x12')]);}else{logger[_0x09dc('0x13')](_0x09dc('0xb'),_0x1ca1fd,_0x09dc('0xe'));_0x2c5987(_0x81b7af[_0x09dc('0x14')][_0x09dc('0x12')]);}})['catch'](function(_0x4bf0d0){logger['error'](_0x09dc('0xb'),_0x1ca1fd,_0x4bf0d0);_0x4bbd54(_0x4bf0d0);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index a9b43d4..acac53e 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 _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e3d0a,_0x4745dd){_0x3e3d0a=_0x3e3d0a-0x0;var _0x3fc765=_0xb10b[_0x3e3d0a];return _0x3fc765;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 1c2d7fa..c79ee59 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 _0xf350=['alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','address','email','Agent','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','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:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right'];(function(_0x12d034,_0x430f51){var _0x39d6e5=function(_0x579248){while(--_0x579248){_0x12d034['push'](_0x12d034['shift']());}};_0x39d6e5(++_0x430f51);}(_0xf350,0x105));var _0x0f35=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf350[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0f35('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x0f35('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x0f35('0x1')],'allowNull':![],'unique':_0x0f35('0x2')},'description':{'type':Sequelize[_0x0f35('0x1')]},'mapKey':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x3')},'mapKeyOffline':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0f35('0x4')},'customerAlias':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0f35('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0f35('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0f35('0x5')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0f35('0x1')]},'animation':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0f35('0x7')](_0x0f35('0x8'),_0x0f35('0x9')),'defaultValue':_0x0f35('0x8')},'header_online':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x0f35('0xb')},'offline_chat_button':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x0f35('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0f35('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x0f35('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x10')},'noteTitle':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x11')},'placeholderMessage':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x12')},'closingMessage':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x13')},'closingMessageButton':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x14')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x0f35('0x15')},'conditionAgreement':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x16')},'ratingType':{'type':Sequelize[_0x0f35('0x7')](_0x0f35('0x17'),_0x0f35('0x18')),'defaultValue':_0x0f35('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x0f35('0x5')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0f35('0xd')],'defaultValue':function(){return JSON[_0x0f35('0x19')]({'items':[{'type':_0x0f35('0x1a'),'variable':null,'config':{'placeholder':_0x0f35('0x1b'),'type':'text','required':!![]},'props':{'title':_0x0f35('0x1b'),'helpText':''}},{'type':_0x0f35('0x1a'),'props':{'title':_0x0f35('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0f35('0x1c')]('onlineForm')?JSON[_0x0f35('0x1d')](this[_0x0f35('0x1c')](_0x0f35('0x1e'))):{};},'set':function(_0x494140){return this[_0x0f35('0x1f')](_0x0f35('0x1e'),JSON[_0x0f35('0x19')](_0x494140));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x0f35('0x1a'),'props':{'title':_0x0f35('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0f35('0x3')},'variable':null},{'type':_0x0f35('0x20'),'config':{'placeholder':_0x0f35('0x21')},'props':{'title':_0x0f35('0x21'),'helpText':_0x0f35('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x0f35('0x1c')](_0x0f35('0x23'))?JSON['parse'](this[_0x0f35('0x1c')](_0x0f35('0x23'))):{};},'set':function(_0x5cdf8){return this['setDataValue'](_0x0f35('0x23'),JSON[_0x0f35('0x19')](_0x5cdf8));}},'token':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':function(){return rs[_0x0f35('0x24')]();}},'autoclose':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0f35('0x1')]},'forwardOffline':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0f35('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0f35('0x25')},'waitingMessage':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x0f35('0x27')},'offlineMessageBody':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0f35('0x29')},'skipUnmanaged':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x15')},'sendUnmanaged':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0f35('0xd')]},'showAgentAvatar':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0f35('0x1')]},'notificationTemplate':{'type':Sequelize[_0x0f35('0xd')],'defaultValue':function(){return _0x0f35('0x2a');}},'notificationSound':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x0f35('0x2c')},'verticalAlignment':{'type':Sequelize[_0x0f35('0x5')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x0f35('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x0f35('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0f35('0x5')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0f35('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0f35('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0f35('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':_0x0f35('0x2f')},'systemAvatar':{'type':Sequelize[_0x0f35('0xd')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0f35('0x5')],'comment':_0x0f35('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':![],'comment':_0x0f35('0x31'),'set':function(_0x24ed44){if(!_0x24ed44)this[_0x0f35('0x1f')](_0x0f35('0x32'),null);this['setDataValue']('mandatoryDisposition',_0x24ed44);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0f35('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xe4d6=['thumb','star','input','name','text','parse','onlineForm','setDataValue','stringify','textarea','Comments','getDataValue','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM'];(function(_0x2b25c8,_0x482bae){var _0x46f4b2=function(_0x19e133){while(--_0x19e133){_0x2b25c8['push'](_0x2b25c8['shift']());}};_0x46f4b2(++_0x482bae);}(_0xe4d6,0xd7));var _0x6e4d=function(_0x2fd211,_0x216ed3){_0x2fd211=_0x2fd211-0x0;var _0x5d07ee=_0xe4d6[_0x2fd211];return _0x5d07ee;};'use strict';var Sequelize=require(_0x6e4d('0x0'));var rs=require(_0x6e4d('0x1'));module[_0x6e4d('0x2')]={'name':{'type':Sequelize[_0x6e4d('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6e4d('0x4')},'description':{'type':Sequelize[_0x6e4d('0x3')]},'mapKey':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x6e4d('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0x6')},'customerAlias':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6e4d('0x3')],'allowNull':![],'defaultValue':_0x6e4d('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6e4d('0x3')],'allowNull':![],'defaultValue':_0x6e4d('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6e4d('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x6e4d('0xb'),_0x6e4d('0xc')),'defaultValue':_0x6e4d('0xb')},'header_online':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x6e4d('0xd')},'offline_chat_button':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0xe')},'header_offline':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0xf')},'download_transcript':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6e4d('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6e4d('0x11')]},'closingQuestion':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e4d('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e4d('0x15')},'closingMessageButton':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0xe')},'skipMessageButton':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0x17')},'ratingType':{'type':Sequelize[_0x6e4d('0x18')]('star',_0x6e4d('0x19')),'defaultValue':_0x6e4d('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x6e4d('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6e4d('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x6e4d('0x1b'),'variable':null,'config':{'placeholder':_0x6e4d('0x1c'),'type':_0x6e4d('0x1d'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x6e4d('0x1b'),'props':{'title':_0x6e4d('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6e4d('0x5'),'type':_0x6e4d('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x6e4d('0x1e')](this['getDataValue'](_0x6e4d('0x1f'))):{};},'set':function(_0x2e2eed){return this[_0x6e4d('0x20')]('onlineForm',JSON[_0x6e4d('0x21')](_0x2e2eed));}},'offlineForm':{'type':Sequelize[_0x6e4d('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x6e4d('0x5'),'type':_0x6e4d('0x5')},'variable':null},{'type':_0x6e4d('0x22'),'config':{'placeholder':_0x6e4d('0x23')},'props':{'title':_0x6e4d('0x23'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x6e4d('0x24')](_0x6e4d('0x25'))?JSON[_0x6e4d('0x1e')](this[_0x6e4d('0x24')](_0x6e4d('0x25'))):{};},'set':function(_0x5e271e){return this['setDataValue'](_0x6e4d('0x25'),JSON['stringify'](_0x5e271e));}},'token':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':function(){return rs[_0x6e4d('0x26')]();}},'autoclose':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6e4d('0x3')]},'forwardOffline':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6e4d('0x3')]},'waitingTitle':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0x27')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x6e4d('0x28')},'offlineMessageBody':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e4d('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0x16')},'sendUnmanaged':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6e4d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6e4d('0x11')],'defaultValue':function(){return _0x6e4d('0x2b');}},'notificationSound':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x6e4d('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e4d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x6e4d('0x3')]},'customerAvatar':{'type':Sequelize[_0x6e4d('0x11')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6e4d('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6e4d('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e4d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e4d('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e4d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6e4d('0x3')],'defaultValue':_0x6e4d('0x2d')},'systemAvatar':{'type':Sequelize[_0x6e4d('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6e4d('0x2e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x8b047d){if(!_0x8b047d)this[_0x6e4d('0x20')]('mandatoryDispositionPauseId',null);this[_0x6e4d('0x20')](_0x6e4d('0x2f'),_0x8b047d);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'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 363d695..2039b4b 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 _0xb361=['server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','sitepic','join','server/files/images/logos/','download','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','headers','first','x-forwarded-for','split','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','ContactId','interaction','firstName','created','autoclose','push','close','unmanaged','ChatMessage','UserId','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','Start','notify','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','addInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','utf8','x-real-ip','connection','replace','alignment','verticalAlignment','addApplications','sequelize','transaction','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','Sequelize','ValidationError','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','count','offset','set','Content-Range','json','save','then','destroy','ChatWebsites','UserProfileResource','end','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','include','findAll','show','params','mandatoryDispositionPause','keys','length','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addLogo','file','addAvatar','agentAvatar','addCustomerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','root'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0xb361,0x1c2));var _0x1b36=function(_0x8c95e8,_0x4e195d){_0x8c95e8=_0x8c95e8-0x0;var _0x8c1e0b=_0xb361[_0x8c95e8];return _0x8c1e0b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b36('0x0'));var rimraf=require(_0x1b36('0x1'));var zipdir=require(_0x1b36('0x2'));var jsonpatch=require(_0x1b36('0x3'));var rp=require('request-promise');var moment=require(_0x1b36('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b36('0x5'));var path=require(_0x1b36('0x6'));var sox=require(_0x1b36('0x7'));var csv=require(_0x1b36('0x8'));var ejs=require(_0x1b36('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1b36('0xa'));var crypto=require(_0x1b36('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1b36('0xc'));var toCsv=require(_0x1b36('0x8'));var querystring=require(_0x1b36('0xd'));var Papa=require(_0x1b36('0xe'));var Redis=require(_0x1b36('0xf'));var authService=require(_0x1b36('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b36('0x11'));var logger=require('../../config/logger')(_0x1b36('0x12'));var utils=require(_0x1b36('0x13'));var config=require('../../config/environment');var db=require(_0x1b36('0x14'))['db'];config[_0x1b36('0x15')]=_[_0x1b36('0x16')](config[_0x1b36('0x15')],{'host':_0x1b36('0x17'),'port':0x18eb});var socket=require(_0x1b36('0x18'))(new Redis(config[_0x1b36('0x15')]));require('./chatWebsite.socket')[_0x1b36('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1b36('0x1a')][_0x1b36('0x1b')]({'port':0x232c});var client9002=jayson[_0x1b36('0x1a')][_0x1b36('0x1b')]({'port':0x232a});var client9003=jayson[_0x1b36('0x1a')][_0x1b36('0x1b')]({'port':0x232b});function checkPasswordPattern(_0x480b3c,_0x2e290d,_0x3cdcc0){if(_0x3cdcc0){var _0x7df18c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7df18c['test'](_0x2e290d)){return _0x480b3c;}else{throw new db[(_0x1b36('0x1c'))][(_0x1b36('0x1d'))]('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 _0x480b3c;}}function respondWithRpcPromise(_0x12b414,_0x484d8f,_0x252544,_0x5d36a6){return new BPromise(function(_0x50e954,_0xa2ca88){var _0x3068ed=_0x5d36a6||client;return _0x3068ed[_0x1b36('0x1e')](_0x12b414,_0x252544)['then'](function(_0x3241cf){logger[_0x1b36('0x1f')](_0x1b36('0x20'),_0x484d8f,_0x1b36('0x21'));logger[_0x1b36('0x22')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x484d8f,_0x1b36('0x21'),JSON[_0x1b36('0x23')](_0x3241cf));if(_0x3241cf[_0x1b36('0x24')]){if(_0x3241cf['error']['code']===0x1f4){logger['error'](_0x1b36('0x20'),_0x484d8f,_0x3241cf['error'][_0x1b36('0x25')]);return _0xa2ca88(_0x3241cf['error']['message']);}logger[_0x1b36('0x24')](_0x1b36('0x20'),_0x484d8f,_0x3241cf[_0x1b36('0x24')]['message']);return _0x50e954(_0x3241cf[_0x1b36('0x24')][_0x1b36('0x25')]);}else{logger[_0x1b36('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x484d8f,_0x1b36('0x21'));_0x50e954(_0x3241cf[_0x1b36('0x26')][_0x1b36('0x25')]);}})[_0x1b36('0x27')](function(_0x250c51){logger[_0x1b36('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x484d8f,_0x250c51);_0xa2ca88(_0x250c51);});});}function respondWithStatusCode(_0x21c794,_0x5111d1){_0x5111d1=_0x5111d1||0xcc;return function(_0x16b56c){if(_0x16b56c){return _0x21c794[_0x1b36('0x28')](_0x5111d1);}return _0x21c794[_0x1b36('0x29')](_0x5111d1)['end']();};}function respondWithResult(_0x2c11b8,_0x1d4496){_0x1d4496=_0x1d4496||0xc8;return function(_0x50760c){if(_0x50760c){return _0x2c11b8[_0x1b36('0x29')](_0x1d4496)['json'](_0x50760c);}};}function respondWithFilteredResult(_0x32646,_0x2fd461){return function(_0x872957){if(_0x872957){var _0x35d503=_0x872957[_0x1b36('0x2a')],_0x13ea63=_0x2fd461[_0x1b36('0x2b')],_0x2df3a1=_0x2fd461[_0x1b36('0x2b')]+_0x2fd461['limit'],_0x2db3b2;if(_0x2df3a1>=_0x35d503){_0x2df3a1=_0x35d503;_0x2db3b2=0xc8;}else{_0x2db3b2=0xce;}_0x32646[_0x1b36('0x29')](_0x2db3b2);return _0x32646[_0x1b36('0x2c')](_0x1b36('0x2d'),_0x13ea63+'-'+_0x2df3a1+'/'+_0x35d503)[_0x1b36('0x2e')](_0x872957);}return null;};}function patchUpdates(_0x3b6339){return function(_0x30ea90){try{jsonpatch['apply'](_0x30ea90,_0x3b6339,!![]);}catch(_0x460a28){return BPromise['reject'](_0x460a28);}return _0x30ea90[_0x1b36('0x2f')]();};}function saveUpdates(_0x4e2043,_0x396f9b){return function(_0x3f9bda){if(_0x3f9bda){return _0x3f9bda['update'](_0x4e2043)[_0x1b36('0x30')](function(_0x1657dc){return _0x1657dc;});}return null;};}function removeEntity(_0x4b0b1e,_0x4446bf){return function(_0xd4f2fb){if(_0xd4f2fb){return _0xd4f2fb[_0x1b36('0x31')]()[_0x1b36('0x30')](function(){var _0x191944=_0xd4f2fb['get']({'plain':!![]});var _0x31d083=_0x1b36('0x32');return db[_0x1b36('0x33')][_0x1b36('0x31')]({'where':{'type':_0x31d083,'resourceId':_0x191944['id']}})[_0x1b36('0x30')](function(){return _0xd4f2fb;});})[_0x1b36('0x30')](function(){_0x4b0b1e[_0x1b36('0x29')](0xcc)[_0x1b36('0x34')]();});}};}function handleEntityNotFound(_0x5ca54a,_0x3860c1){return function(_0x2402af){if(!_0x2402af){_0x5ca54a['sendStatus'](0x194);}return _0x2402af;};}function handleError(_0x21b1a0,_0x48c0cf){_0x48c0cf=_0x48c0cf||0x1f4;return function(_0x1731c0){logger[_0x1b36('0x24')](_0x1731c0['stack']);if(_0x1731c0[_0x1b36('0x35')]){delete _0x1731c0[_0x1b36('0x35')];}_0x21b1a0[_0x1b36('0x29')](_0x48c0cf)[_0x1b36('0x36')](_0x1731c0);};}exports[_0x1b36('0x37')]=function(_0x4f0d7e,_0x83020d){var _0x169160={'include':[{'model':db[_0x1b36('0x38')],'as':'mandatoryDispositionPause'}]},_0x362fe0={},_0x8ca7a7={'count':0x0,'rows':[]};var _0x255ffe=_[_0x1b36('0x39')](db[_0x1b36('0x3a')][_0x1b36('0x3b')],function(_0x3a369a){return{'name':_0x3a369a[_0x1b36('0x3c')],'type':_0x3a369a[_0x1b36('0x3d')][_0x1b36('0x3e')]};});_0x362fe0[_0x1b36('0x3f')]=_[_0x1b36('0x39')](_0x255ffe,_0x1b36('0x35'));_0x362fe0[_0x1b36('0x40')]=_['keys'](_0x4f0d7e['query']);_0x362fe0[_0x1b36('0x41')]=_['intersection'](_0x362fe0['model'],_0x362fe0[_0x1b36('0x40')]);_0x169160[_0x1b36('0x42')]=_[_0x1b36('0x43')](_0x362fe0[_0x1b36('0x3f')],qs[_0x1b36('0x44')](_0x4f0d7e[_0x1b36('0x40')][_0x1b36('0x44')]));_0x169160[_0x1b36('0x42')]=_0x169160[_0x1b36('0x42')]['length']?_0x169160[_0x1b36('0x42')]:_0x362fe0[_0x1b36('0x3f')];if(!_0x4f0d7e[_0x1b36('0x40')][_0x1b36('0x45')](_0x1b36('0x46'))){_0x169160['limit']=qs[_0x1b36('0x47')](_0x4f0d7e[_0x1b36('0x40')][_0x1b36('0x47')]);_0x169160[_0x1b36('0x2b')]=qs[_0x1b36('0x2b')](_0x4f0d7e['query'][_0x1b36('0x2b')]);}_0x169160[_0x1b36('0x48')]=qs[_0x1b36('0x49')](_0x4f0d7e[_0x1b36('0x40')][_0x1b36('0x49')]);_0x169160['where']=qs[_0x1b36('0x41')](_[_0x1b36('0x4a')](_0x4f0d7e[_0x1b36('0x40')],_0x362fe0['filters']),_0x255ffe);if(_0x4f0d7e[_0x1b36('0x40')]['filter']){_0x169160[_0x1b36('0x4b')]=_[_0x1b36('0x4c')](_0x169160[_0x1b36('0x4b')],{'$or':_['map'](_0x255ffe,function(_0x2c9f15){if(_0x2c9f15[_0x1b36('0x3d')]!==_0x1b36('0x4d')){var _0x29c977={};_0x29c977[_0x2c9f15['name']]={'$like':'%'+_0x4f0d7e[_0x1b36('0x40')][_0x1b36('0x4e')]+'%'};return _0x29c977;}})});}_0x169160=_[_0x1b36('0x4c')]({},_0x169160,_0x4f0d7e['options']);var _0x32db54={'where':_0x169160['where']};return db[_0x1b36('0x3a')][_0x1b36('0x2a')](_0x32db54)[_0x1b36('0x30')](function(_0xcc98c3){_0x8ca7a7[_0x1b36('0x2a')]=_0xcc98c3;if(_0x4f0d7e[_0x1b36('0x40')]['includeAll']){_0x169160[_0x1b36('0x4f')]=[{'all':!![]}];}return db['ChatWebsite'][_0x1b36('0x50')](_0x169160);})[_0x1b36('0x30')](function(_0xff78fa){_0x8ca7a7['rows']=_0xff78fa;return _0x8ca7a7;})[_0x1b36('0x30')](respondWithFilteredResult(_0x83020d,_0x169160))[_0x1b36('0x27')](handleError(_0x83020d,null));};exports[_0x1b36('0x51')]=function(_0x11ae17,_0x5f03fd){var _0x4358ee={'raw':![],'where':{'id':_0x11ae17[_0x1b36('0x52')]['id']},'include':[{'model':db[_0x1b36('0x38')],'as':_0x1b36('0x53')}]},_0x2976d5={};_0x2976d5[_0x1b36('0x3f')]=_[_0x1b36('0x54')](db[_0x1b36('0x3a')][_0x1b36('0x3b')]);_0x2976d5[_0x1b36('0x40')]=_[_0x1b36('0x54')](_0x11ae17['query']);_0x2976d5[_0x1b36('0x41')]=_[_0x1b36('0x43')](_0x2976d5['model'],_0x2976d5[_0x1b36('0x40')]);_0x4358ee['attributes']=_[_0x1b36('0x43')](_0x2976d5['model'],qs['fields'](_0x11ae17[_0x1b36('0x40')][_0x1b36('0x44')]));_0x4358ee[_0x1b36('0x42')]=_0x4358ee[_0x1b36('0x42')][_0x1b36('0x55')]?_0x4358ee['attributes']:_0x2976d5['model'];if(_0x11ae17[_0x1b36('0x40')][_0x1b36('0x56')]){_0x4358ee[_0x1b36('0x4f')]=[{'all':!![]}];}_0x4358ee=_['merge']({},_0x4358ee,_0x11ae17[_0x1b36('0x57')]);return db[_0x1b36('0x3a')][_0x1b36('0x58')](_0x4358ee)[_0x1b36('0x30')](handleEntityNotFound(_0x5f03fd,null))[_0x1b36('0x30')](respondWithResult(_0x5f03fd,null))['catch'](handleError(_0x5f03fd,null));};exports[_0x1b36('0x59')]=function(_0x3a239,_0x32274c){return db[_0x1b36('0x3a')][_0x1b36('0x59')](_0x3a239[_0x1b36('0x5a')],{})[_0x1b36('0x30')](function(_0x414e19){var _0x358e85=_0x3a239[_0x1b36('0x5b')][_0x1b36('0x5c')]({'plain':!![]});if(!_0x358e85)throw new Error(_0x1b36('0x5d'));if(_0x358e85[_0x1b36('0x5e')]==='user'){var _0x517c89=_0x414e19['get']({'plain':!![]});var _0x869399=_0x1b36('0x32');return db[_0x1b36('0x5f')]['find']({'where':{'name':_0x869399,'userProfileId':_0x358e85['userProfileId']},'raw':!![]})[_0x1b36('0x30')](function(_0x4b992a){if(_0x4b992a&&_0x4b992a[_0x1b36('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x517c89[_0x1b36('0x35')],'resourceId':_0x517c89['id'],'type':_0x4b992a[_0x1b36('0x35')],'sectionId':_0x4b992a['id']},{})[_0x1b36('0x30')](function(){return _0x414e19;});}else{return _0x414e19;}})[_0x1b36('0x27')](function(_0x651dfb){logger[_0x1b36('0x24')](_0x1b36('0x61'),_0x651dfb);throw _0x651dfb;});}return _0x414e19;})[_0x1b36('0x30')](respondWithResult(_0x32274c,0xc9))[_0x1b36('0x27')](handleError(_0x32274c,null));};exports[_0x1b36('0x62')]=function(_0x5cb609,_0x222009){if(_0x5cb609[_0x1b36('0x5a')]['id']){delete _0x5cb609[_0x1b36('0x5a')]['id'];}return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0x5cb609[_0x1b36('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x1b36('0x53')}]})[_0x1b36('0x30')](handleEntityNotFound(_0x222009,null))[_0x1b36('0x30')](saveUpdates(_0x5cb609[_0x1b36('0x5a')],null))[_0x1b36('0x30')](respondWithResult(_0x222009,null))[_0x1b36('0x27')](handleError(_0x222009,null));};exports[_0x1b36('0x31')]=function(_0x11ca41,_0x22fc57){return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0x11ca41[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x22fc57,null))[_0x1b36('0x30')](removeEntity(_0x22fc57,null))[_0x1b36('0x27')](handleError(_0x22fc57,null));};exports['describe']=function(_0x40ed8e,_0x1311ff){return db[_0x1b36('0x3a')][_0x1b36('0x63')]()['then'](respondWithResult(_0x1311ff,null))[_0x1b36('0x27')](handleError(_0x1311ff,null));};exports[_0x1b36('0x64')]=function(_0x5713b7,_0x44fbea,_0xb985ec){if(_0x5713b7[_0x1b36('0x5a')]['id']){delete _0x5713b7['body']['id'];}return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0x5713b7[_0x1b36('0x52')]['id']}})['then'](handleEntityNotFound(_0x44fbea,null))[_0x1b36('0x30')](function(_0x1ecb04){if(_0x1ecb04){_0x5713b7[_0x1b36('0x5a')][_0x1b36('0x65')]=_0x1ecb04['id'];return db[_0x1b36('0x66')][_0x1b36('0x59')](_0x5713b7['body']);}})[_0x1b36('0x30')](respondWithResult(_0x44fbea,null))[_0x1b36('0x27')](handleError(_0x44fbea,null));};exports[_0x1b36('0x67')]=function(_0x45189e,_0x4e2b7a,_0xcdd5f){var _0x4d3d41={'raw':![],'where':{}};var _0x362f9b={};var _0x3308d8={'count':0x0,'rows':[]};return db[_0x1b36('0x3a')]['findOne']({'where':{'id':_0x45189e['params']['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x4e2b7a,null))[_0x1b36('0x30')](function(_0x197154){if(_0x197154){_0x362f9b[_0x1b36('0x3f')]=_[_0x1b36('0x54')](db[_0x1b36('0x66')][_0x1b36('0x3b')]);_0x362f9b[_0x1b36('0x40')]=_[_0x1b36('0x54')](_0x45189e['query']);_0x362f9b[_0x1b36('0x41')]=_[_0x1b36('0x43')](_0x362f9b['model'],_0x362f9b[_0x1b36('0x40')]);_0x4d3d41['attributes']=_[_0x1b36('0x43')](_0x362f9b[_0x1b36('0x3f')],qs['fields'](_0x45189e['query'][_0x1b36('0x44')]));_0x4d3d41['attributes']=_0x4d3d41[_0x1b36('0x42')][_0x1b36('0x55')]?_0x4d3d41[_0x1b36('0x42')]:_0x362f9b['model'];if(!_0x45189e[_0x1b36('0x40')][_0x1b36('0x45')](_0x1b36('0x46'))){_0x4d3d41['limit']=qs[_0x1b36('0x47')](_0x45189e['query']['limit']);_0x4d3d41[_0x1b36('0x2b')]=qs['offset'](_0x45189e[_0x1b36('0x40')][_0x1b36('0x2b')]);}_0x4d3d41['order']=qs['sort'](_0x45189e['query'][_0x1b36('0x49')]);_0x4d3d41[_0x1b36('0x4b')]=qs['filters'](_[_0x1b36('0x4a')](_0x45189e['query'],_0x362f9b[_0x1b36('0x41')]));_0x4d3d41[_0x1b36('0x4b')]['ChatWebsiteId']=_0x197154['id'];if(_0x45189e['query'][_0x1b36('0x4e')]){_0x4d3d41[_0x1b36('0x4b')]=_[_0x1b36('0x4c')](_0x4d3d41['where'],{'$or':_[_0x1b36('0x39')](_0x4d3d41['attributes'],function(_0x1a616e){var _0x3b6906={};_0x3b6906[_0x1a616e]={'$like':'%'+_0x45189e['query']['filter']+'%'};return _0x3b6906;})});}_0x4d3d41=_[_0x1b36('0x4c')]({},_0x4d3d41,_0x45189e[_0x1b36('0x57')]);return db[_0x1b36('0x66')][_0x1b36('0x2a')]({'where':_0x4d3d41['where']})[_0x1b36('0x30')](function(_0x212a56){_0x3308d8[_0x1b36('0x2a')]=_0x212a56;if(_0x45189e[_0x1b36('0x40')]['includeAll']){_0x4d3d41[_0x1b36('0x4f')]=[{'all':!![]}];}return db[_0x1b36('0x66')][_0x1b36('0x50')](_0x4d3d41);})[_0x1b36('0x30')](function(_0x5d1ba8){_0x3308d8[_0x1b36('0x68')]=_0x5d1ba8;return _0x3308d8;});}})['then'](respondWithFilteredResult(_0x4e2b7a,_0x4d3d41))[_0x1b36('0x27')](handleError(_0x4e2b7a,null));};exports['removeDispositions']=function(_0x4bb2a5,_0x3d2896,_0xe75df){return db['ChatWebsite'][_0x1b36('0x58')]({'where':{'id':_0x4bb2a5[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x3d2896,null))[_0x1b36('0x30')](function(_0x1aa4bc){if(_0x1aa4bc){return _0x1aa4bc[_0x1b36('0x69')](_0x4bb2a5[_0x1b36('0x40')][_0x1b36('0x6a')]);}})[_0x1b36('0x30')](respondWithStatusCode(_0x3d2896,null))[_0x1b36('0x27')](handleError(_0x3d2896,null));};exports[_0x1b36('0x6b')]=function(_0x827fcf,_0x1af400,_0x1f21e6){if(_0x827fcf['body']['id']){delete _0x827fcf['body']['id'];}return db[_0x1b36('0x3a')]['find']({'where':{'id':_0x827fcf[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x1af400,null))[_0x1b36('0x30')](function(_0x56f26d){if(_0x56f26d){_0x827fcf[_0x1b36('0x5a')][_0x1b36('0x65')]=_0x56f26d['id'];return db['CannedAnswer']['create'](_0x827fcf[_0x1b36('0x5a')]);}})[_0x1b36('0x30')](respondWithResult(_0x1af400,null))[_0x1b36('0x27')](handleError(_0x1af400,null));};exports[_0x1b36('0x6c')]=function(_0x4c60de,_0x12ad71,_0xcd4527){var _0x59aceb={'raw':![],'where':{}};var _0x3f88c9={};var _0x2cb41e={'count':0x0,'rows':[]};return db[_0x1b36('0x3a')][_0x1b36('0x6d')]({'where':{'id':_0x4c60de['params']['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x12ad71,null))[_0x1b36('0x30')](function(_0x2a71a0){if(_0x2a71a0){_0x3f88c9[_0x1b36('0x3f')]=_[_0x1b36('0x54')](db['CannedAnswer'][_0x1b36('0x3b')]);_0x3f88c9[_0x1b36('0x40')]=_[_0x1b36('0x54')](_0x4c60de['query']);_0x3f88c9['filters']=_['intersection'](_0x3f88c9[_0x1b36('0x3f')],_0x3f88c9[_0x1b36('0x40')]);_0x59aceb[_0x1b36('0x42')]=_[_0x1b36('0x43')](_0x3f88c9[_0x1b36('0x3f')],qs[_0x1b36('0x44')](_0x4c60de[_0x1b36('0x40')][_0x1b36('0x44')]));_0x59aceb['attributes']=_0x59aceb[_0x1b36('0x42')][_0x1b36('0x55')]?_0x59aceb[_0x1b36('0x42')]:_0x3f88c9[_0x1b36('0x3f')];if(!_0x4c60de[_0x1b36('0x40')][_0x1b36('0x45')]('nolimit')){_0x59aceb[_0x1b36('0x47')]=qs[_0x1b36('0x47')](_0x4c60de[_0x1b36('0x40')][_0x1b36('0x47')]);_0x59aceb[_0x1b36('0x2b')]=qs[_0x1b36('0x2b')](_0x4c60de[_0x1b36('0x40')][_0x1b36('0x2b')]);}_0x59aceb[_0x1b36('0x48')]=qs[_0x1b36('0x49')](_0x4c60de[_0x1b36('0x40')][_0x1b36('0x49')]);_0x59aceb[_0x1b36('0x4b')]=qs[_0x1b36('0x41')](_[_0x1b36('0x4a')](_0x4c60de['query'],_0x3f88c9[_0x1b36('0x41')]));_0x59aceb[_0x1b36('0x4b')]['ChatWebsiteId']=_0x2a71a0['id'];if(_0x4c60de[_0x1b36('0x40')][_0x1b36('0x4e')]){_0x59aceb['where']=_['merge'](_0x59aceb[_0x1b36('0x4b')],{'$or':_[_0x1b36('0x39')](_0x59aceb['attributes'],function(_0x16f664){var _0x2dc670={};_0x2dc670[_0x16f664]={'$like':'%'+_0x4c60de[_0x1b36('0x40')][_0x1b36('0x4e')]+'%'};return _0x2dc670;})});}_0x59aceb=_['merge']({},_0x59aceb,_0x4c60de[_0x1b36('0x57')]);return db[_0x1b36('0x6e')]['count']({'where':_0x59aceb[_0x1b36('0x4b')]})[_0x1b36('0x30')](function(_0x6f0373){_0x2cb41e['count']=_0x6f0373;if(_0x4c60de[_0x1b36('0x40')]['includeAll']){_0x59aceb[_0x1b36('0x4f')]=[{'all':!![]}];}return db[_0x1b36('0x6e')][_0x1b36('0x50')](_0x59aceb);})['then'](function(_0x3a1d47){_0x2cb41e[_0x1b36('0x68')]=_0x3a1d47;return _0x2cb41e;});}})['then'](respondWithFilteredResult(_0x12ad71,_0x59aceb))['catch'](handleError(_0x12ad71,null));};exports[_0x1b36('0x6f')]=function(_0x434402,_0x48a9ae,_0x6f3cfc){return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0x434402[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x48a9ae,null))[_0x1b36('0x30')](function(_0x2f4d31){if(_0x2f4d31){return _0x2f4d31[_0x1b36('0x6f')](_0x434402[_0x1b36('0x40')]['ids']);}})[_0x1b36('0x30')](respondWithStatusCode(_0x48a9ae,null))[_0x1b36('0x27')](handleError(_0x48a9ae,null));};exports[_0x1b36('0x70')]=function(_0x422eeb,_0x1ee704,_0x34f14f){_0x422eeb[_0x1b36('0x5a')]['sitepic']=_0x422eeb[_0x1b36('0x71')]['filename'];return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0x422eeb[_0x1b36('0x52')]['id']}})['then'](handleEntityNotFound(_0x1ee704,null))[_0x1b36('0x30')](saveUpdates(_0x422eeb[_0x1b36('0x5a')],null))['then'](respondWithResult(_0x1ee704,null))[_0x1b36('0x27')](handleError(_0x1ee704,null));};exports[_0x1b36('0x72')]=function(_0x44ad80,_0x2fb628,_0x381b8c){_0x44ad80[_0x1b36('0x5a')][_0x1b36('0x73')]=_0x44ad80[_0x1b36('0x71')]['filename'];return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0x44ad80[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x2fb628,null))[_0x1b36('0x30')](saveUpdates(_0x44ad80['body'],null))[_0x1b36('0x30')](respondWithResult(_0x2fb628,null))['catch'](handleError(_0x2fb628,null));};exports[_0x1b36('0x74')]=function(_0xfa6de9,_0x415180,_0x350778){_0xfa6de9[_0x1b36('0x5a')]['customerAvatar']=_0xfa6de9[_0x1b36('0x71')][_0x1b36('0x75')];return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0xfa6de9[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x415180,null))[_0x1b36('0x30')](saveUpdates(_0xfa6de9[_0x1b36('0x5a')],null))[_0x1b36('0x30')](respondWithResult(_0x415180,null))[_0x1b36('0x27')](handleError(_0x415180,null));};exports[_0x1b36('0x76')]=function(_0x466371,_0x5121d5,_0x20ab89){_0x466371[_0x1b36('0x5a')][_0x1b36('0x77')]=_0x466371[_0x1b36('0x71')][_0x1b36('0x75')];return db[_0x1b36('0x3a')]['find']({'where':{'id':_0x466371[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x5121d5,null))[_0x1b36('0x30')](saveUpdates(_0x466371[_0x1b36('0x5a')],null))[_0x1b36('0x30')](respondWithResult(_0x5121d5,null))['catch'](handleError(_0x5121d5,null));};exports[_0x1b36('0x78')]=function(_0x88de81,_0x45ea8b,_0x123bff){var _0x845db9=path['join'](config[_0x1b36('0x79')],_0x1b36('0x7a'));var _0x4b7324={'where':{'id':_0x88de81[_0x1b36('0x52')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x35cbdb=![];return require(_0x1b36('0x7b'))[_0x1b36('0x7c')]()[_0x1b36('0x30')](function(_0x36dff4){if(_0x36dff4){_0x35cbdb=_0x36dff4[_0x1b36('0x7d')];}})[_0x1b36('0x30')](function(){return db['ChatWebsite'][_0x1b36('0x58')](_0x4b7324);})[_0x1b36('0x30')](handleEntityNotFound(_0x45ea8b,null))[_0x1b36('0x30')](function(_0x54a1fa){if(_0x54a1fa){if(!_[_0x1b36('0x7e')](_0x54a1fa[_0x1b36('0x7f')])){if(fs['existsSync'](path[_0x1b36('0x80')](config[_0x1b36('0x79')],_0x1b36('0x81'),_0x54a1fa['sitepic']))&&_0x35cbdb){_0x845db9=path[_0x1b36('0x80')](config[_0x1b36('0x79')],_0x1b36('0x81'),_0x54a1fa[_0x1b36('0x7f')]);}}return _0x45ea8b[_0x1b36('0x82')](_0x845db9);}})[_0x1b36('0x27')](handleError(_0x45ea8b,null));};exports['getAvatar']=function(_0x456557,_0x25ed60,_0x5aa874){var _0x393218=path[_0x1b36('0x80')](config[_0x1b36('0x79')],'server/files/images/avatars/default_avatar.png');var _0x16b026={'where':{'id':_0x456557[_0x1b36('0x52')]['id']},'attributes':['id',_0x1b36('0x73')],'raw':!![]};return db[_0x1b36('0x3a')]['find'](_0x16b026)[_0x1b36('0x30')](handleEntityNotFound(_0x25ed60,null))[_0x1b36('0x30')](function(_0x583541){if(_0x583541){if(!_[_0x1b36('0x7e')](_0x583541[_0x1b36('0x73')])){if(fs[_0x1b36('0x83')](path[_0x1b36('0x80')](config[_0x1b36('0x79')],_0x1b36('0x84'),_0x583541[_0x1b36('0x73')]))){_0x393218=path[_0x1b36('0x80')](config[_0x1b36('0x79')],_0x1b36('0x84'),_0x583541[_0x1b36('0x73')]);}}return _0x25ed60[_0x1b36('0x82')](_0x393218);}})[_0x1b36('0x27')](handleError(_0x25ed60,null));};exports[_0x1b36('0x85')]=function(_0xe1eda1,_0x2b24f1,_0x12d5eb){var _0x149e56=path[_0x1b36('0x80')](config[_0x1b36('0x79')],_0x1b36('0x86'));var _0x38cdf9={'where':{'id':_0xe1eda1[_0x1b36('0x52')]['id']},'attributes':['id','customerAvatar',_0x1b36('0x87')],'raw':!![]};return db[_0x1b36('0x3a')]['find'](_0x38cdf9)[_0x1b36('0x30')](handleEntityNotFound(_0x2b24f1,null))['then'](function(_0x586e1a){if(_0x586e1a){if(!_[_0x1b36('0x7e')](_0x586e1a[_0x1b36('0x88')])){if(fs[_0x1b36('0x83')](path[_0x1b36('0x80')](config[_0x1b36('0x79')],_0x1b36('0x84'),_0x586e1a[_0x1b36('0x88')]))&&_0x586e1a[_0x1b36('0x87')]){_0x149e56=path[_0x1b36('0x80')](config['root'],_0x1b36('0x84'),_0x586e1a[_0x1b36('0x88')]);}}return _0x2b24f1['download'](_0x149e56);}})[_0x1b36('0x27')](handleError(_0x2b24f1,null));};exports[_0x1b36('0x89')]=function(_0x37eee7,_0xbe2a93,_0x2c7327){var _0x3fbac1=path[_0x1b36('0x80')](config['root'],_0x1b36('0x8a'));var _0x2de932={'where':{'id':_0x37eee7['params']['id']},'attributes':['id',_0x1b36('0x77')],'raw':!![]};return db[_0x1b36('0x3a')][_0x1b36('0x58')](_0x2de932)[_0x1b36('0x30')](handleEntityNotFound(_0xbe2a93,null))['then'](function(_0x4f4c28){if(_0x4f4c28){if(!_[_0x1b36('0x7e')](_0x4f4c28['systemAvatar'])){if(fs['existsSync'](path[_0x1b36('0x80')](config[_0x1b36('0x79')],_0x1b36('0x84'),_0x4f4c28[_0x1b36('0x77')]))){_0x3fbac1=path[_0x1b36('0x80')](config[_0x1b36('0x79')],_0x1b36('0x84'),_0x4f4c28[_0x1b36('0x77')]);}}return _0xbe2a93[_0x1b36('0x82')](_0x3fbac1);}})['catch'](handleError(_0xbe2a93,null));};exports['notify']=function(_0x4ccd48,_0x3dfd69,_0x4f8f28){var _0x56497f=require(_0x1b36('0x8b'));var _0x44aa72=new _0x56497f();var _0x16a0a0=_0x44aa72[_0x1b36('0x8c')](_0x4ccd48['headers'][_0x1b36('0x8d')])[_0x1b36('0x8e')]();var _0x3f1412={'body':_0x4ccd48[_0x1b36('0x5a')],'channel':_0x1b36('0x8f')};var _0x3eb60b=[];var _0x2ec1da=[];var _0x2c0e82={};var _0x345b9c=![];return db[_0x1b36('0x90')][_0x1b36('0x63')]()[_0x1b36('0x30')](function(_0x1f8bba){if(!_0x1f8bba){throw new db['Sequelize'][(_0x1b36('0x1d'))](_0x1b36('0x91'));}_0x3eb60b=_[_0x1b36('0x92')](_[_0x1b36('0x54')](_0x1f8bba),[_0x1b36('0x93'),_0x1b36('0x94')]);_0x2ec1da=_[_0x1b36('0x92')](_[_0x1b36('0x54')](_0x1f8bba),[_0x1b36('0x93'),_0x1b36('0x94'),_0x1b36('0x95'),_0x1b36('0x96')]);if(_0x4ccd48[_0x1b36('0x5a')]['id']){delete _0x4ccd48[_0x1b36('0x5a')]['id'];}if(_[_0x1b36('0x7e')](_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0x97')])){throw new db[(_0x1b36('0x1c'))][(_0x1b36('0x1d'))]('from\x20is\x20mandatory');}if(_[_0x1b36('0x7e')](_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0x5a')])||_0x4ccd48[_0x1b36('0x5a')]['body']===''){throw new db[(_0x1b36('0x1c'))]['ValidationError'](_0x1b36('0x98'));}if(_[_0x1b36('0x7e')](_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0x99')])){throw new db[(_0x1b36('0x1c'))][(_0x1b36('0x1d'))](_0x1b36('0x9a')+_0x2ec1da);}if(!_['includes'](_0x2ec1da,_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0x99')])){throw new db['Sequelize'][(_0x1b36('0x1d'))](_0x1b36('0x9b')+_0x2ec1da);}_0x2c0e82[_0x4ccd48['body']['mapKey']]=_0x4ccd48[_0x1b36('0x5a')]['from'];})[_0x1b36('0x30')](function(){return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0x4ccd48[_0x1b36('0x52')]['id']},'include':[{'model':db[_0x1b36('0x9c')],'as':_0x1b36('0x9d'),'include':[{'model':db[_0x1b36('0x90')],'as':_0x1b36('0x9e'),'where':_0x2c0e82,'limit':0x1,'order':[[_0x1b36('0x94'),_0x1b36('0x9f')]]}]},{'model':db[_0x1b36('0xa0')],'as':_0x1b36('0xa1')}]});})['then'](handleEntityNotFound(_0x3dfd69,null))[_0x1b36('0x30')](function(_0x1dbcb1){if(_0x1dbcb1&&_0x1dbcb1[_0x1b36('0x9d')]){_0x3f1412[_0x1b36('0xa2')]=_0x1dbcb1;_0x3f1412[_0x1b36('0xa3')]=_0x1dbcb1['Applications'];_0x3f1412[_0x1b36('0xa4')]=_0x1dbcb1[_0x1b36('0x9d')];_0x3f1412[_0x1b36('0xa3')]=_[_0x1b36('0xa5')](_0x3f1412[_0x1b36('0xa3')],[_0x1b36('0xa6')],[_0x1b36('0xa7')]);if(_0x3f1412[_0x1b36('0xa2')][_0x1b36('0xa1')]){delete _0x3f1412[_0x1b36('0xa2')][_0x1b36('0xa1')];}if(_0x3f1412['account']['List']&&_0x3f1412[_0x1b36('0xa2')]['List'][_0x1b36('0x9e')][_0x1b36('0x55')]){return _0x3f1412['account'][_0x1b36('0x9d')][_0x1b36('0x9e')][0x0];}var _0x5da049=_[_0x1b36('0x16')](_0x4ccd48[_0x1b36('0x5a')],{'firstName':_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0x97')],'ListId':_0x1dbcb1[_0x1b36('0x96')]});_0x5da049[_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0x99')]]=_0x4ccd48['body'][_0x1b36('0x97')];return db[_0x1b36('0x90')][_0x1b36('0x59')](_0x5da049,{'fields':_0x3eb60b,'raw':!![]});}})[_0x1b36('0x30')](handleEntityNotFound(_0x3dfd69,null))[_0x1b36('0x30')](function(_0x2e78fa){_0x3f1412[_0x1b36('0xa8')]=_0x2e78fa;var _0x5b515f=_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0xa9')];if(_0x4ccd48['headers'][_0x1b36('0xaa')]){_0x5b515f=_0x4ccd48[_0x1b36('0xab')]['cf-connecting-ip'];}else if(_0x4ccd48['headers']['x-forwarded-for']){_0x5b515f=_[_0x1b36('0xac')](_0x4ccd48[_0x1b36('0xab')][_0x1b36('0xad')][_0x1b36('0xae')](','));}if(_0x2e78fa){var _0x23b0f7={'ContactId':_0x2e78fa['id'],'ChatWebsiteId':_0x4ccd48[_0x1b36('0x52')]['id'],'from':(_0x2e78fa['firstName']||'')+'\x20'+(_0x2e78fa[_0x1b36('0xaf')]||''),'customerIp':_0x5b515f,'customerPort':_0x4ccd48[_0x1b36('0xab')][_0x1b36('0xb0')]?_0x4ccd48[_0x1b36('0xab')][_0x1b36('0xb0')]:null,'referer':_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0xb1')],'browserName':_0x16a0a0[_0x1b36('0xb2')][_0x1b36('0x35')]&&_0x16a0a0['browser'][_0x1b36('0xb3')]?util[_0x1b36('0xb4')]('%s\x20%s',_0x16a0a0[_0x1b36('0xb2')][_0x1b36('0x35')],_0x16a0a0[_0x1b36('0xb2')][_0x1b36('0xb3')]):_0x1b36('0xb5'),'browserVersion':_0x16a0a0[_0x1b36('0xb2')][_0x1b36('0xb3')]||_0x1b36('0xb5'),'osName':util[_0x1b36('0xb4')](_0x1b36('0xb6'),_0x16a0a0['os'][_0x1b36('0x35')],_0x16a0a0['os']['version']),'osVersion':_0x16a0a0['os'][_0x1b36('0xb3')],'deviceModel':_0x16a0a0[_0x1b36('0xb7')]['model']&&_0x16a0a0[_0x1b36('0xb7')][_0x1b36('0xb8')]?util['format'](_0x1b36('0xb9'),_0x16a0a0['device']['model'],_0x16a0a0[_0x1b36('0xb7')][_0x1b36('0xb8')],_0x16a0a0[_0x1b36('0xb7')]['type']):null,'deviceVendor':_0x16a0a0[_0x1b36('0xb7')][_0x1b36('0xb8')],'deviceType':_0x16a0a0['device'][_0x1b36('0x3d')],'formData':JSON['stringify'](_0x4ccd48[_0x1b36('0x5a')])};var _0x10a293={'ChatWebsiteId':_0x4ccd48[_0x1b36('0x52')]['id'],'closed':![]};if(_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0xba')]){_0x10a293[_0x1b36('0xba')]=_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0xba')];return db[_0x1b36('0xbb')][_0x1b36('0x58')]({'where':_0x10a293})[_0x1b36('0x30')](function(_0x27f6e7){if(_0x27f6e7){return[_0x27f6e7,![]];}_0x23b0f7['threadId']=_0x4ccd48[_0x1b36('0x5a')]['threadId'];_0x23b0f7['externalUrl']=_0x4ccd48[_0x1b36('0x5a')]['externalUrl'];return db[_0x1b36('0xbb')][_0x1b36('0x59')](_0x23b0f7)[_0x1b36('0x30')](function(_0x3d2972){return[_0x3d2972,!![]];});});}_0x10a293[_0x1b36('0xbc')]=_0x2e78fa['id'];if(_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0xbd')]&&_0x4ccd48[_0x1b36('0x5a')]['interaction']['id']){_0x10a293['id']=_0x4ccd48[_0x1b36('0x5a')][_0x1b36('0xbd')]['id'];return db[_0x1b36('0xbb')][_0x1b36('0x58')]({'where':_0x10a293})[_0x1b36('0x30')](function(_0x2f41df){if(_0x2f41df){return[_0x2f41df,![]];}return db[_0x1b36('0xbb')][_0x1b36('0x59')](_0x23b0f7)['then'](function(_0x3c4615){return[_0x3c4615,!![]];});});}return db['ChatInteraction'][_0x1b36('0x59')](_0x23b0f7)[_0x1b36('0x30')](function(_0xdd29c){return[_0xdd29c,!![]];});}})['spread'](function(_0x57a39d,_0x511413){if(_0x57a39d){_0x345b9c=_0x511413;if(!_0x511413){var _0xb7b31={'from':(_0x3f1412['contact'][_0x1b36('0xbe')]||'')+'\x20'+(_0x3f1412[_0x1b36('0xa8')][_0x1b36('0xaf')]||'')};if(_0x4ccd48['body'][_0x1b36('0xba')]&&_0x4ccd48[_0x1b36('0x5a')]['messageId']&&_0x4ccd48['body'][_0x1b36('0xba')]!=_0x4ccd48[_0x1b36('0x5a')]['messageId']){_0xb7b31[_0x1b36('0xba')]=_0x4ccd48['body']['messageId'];}return _0x57a39d['update'](_0xb7b31);}else{return _0x57a39d;}}})['then'](function(_0x3e3b8d){_0x3f1412[_0x1b36('0xbd')]=_0x3e3b8d['get']({'plain':!![]});_0x3f1412['interaction']['created']=_0x345b9c;if(_0x3f1412[_0x1b36('0xbd')][_0x1b36('0xbf')]){if(_0x3f1412[_0x1b36('0xa2')][_0x1b36('0xc0')]){_0x3f1412['applications'][_0x1b36('0xc1')]({'id':0x0,'priority':_0x3f1412[_0x1b36('0xa3')][_0x1b36('0x55')]+0x1,'app':_0x1b36('0xc2'),'appdata':_0x1b36('0xc3'),'interval':'*,*,*,*'});}}return db[_0x1b36('0xc4')][_0x1b36('0x59')]({'body':_0x4ccd48[_0x1b36('0x5a')]['body'],'ChatWebsiteId':_0x4ccd48[_0x1b36('0x52')]['id'],'ChatInteractionId':_0x3e3b8d['id'],'direction':'in','ContactId':_0x3f1412['contact']['id'],'AttachmentId':_0x4ccd48[_0x1b36('0x5a')]['AttachmentId']});})[_0x1b36('0x30')](function(_0x396566){_0x3f1412[_0x1b36('0x25')]=_0x396566;if(_0x3f1412['interaction'][_0x1b36('0xc5')]){return db['User'][_0x1b36('0x58')]({'attributes':['id','name'],'where':{'id':_0x3f1412[_0x1b36('0xbd')][_0x1b36('0xc5')]}})[_0x1b36('0x30')](function(_0x11673f){if(_0x11673f){_0x3f1412[_0x1b36('0xa3')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1b36('0xc6'),'appdata':_0x11673f['name']+','+(_0x3f1412[_0x1b36('0xa2')][_0x1b36('0xc7')]||0xa),'interval':_0x1b36('0xc8')});_0x3f1412[_0x1b36('0xc9')]=!![];}return respondWithRpcPromise('Start',_0x1b36('0xca'),_0x3f1412);});}return respondWithRpcPromise(_0x1b36('0xcb'),_0x1b36('0xca'),_0x3f1412);})[_0x1b36('0x30')](function(_0x1ebd50){respondWithRpcPromise('EventManager','EventManager',{'event':_0x1b36('0xcc'),'message':_0x1ebd50},client9002);return _0x1ebd50;})['then'](respondWithResult(_0x3dfd69,null))[_0x1b36('0x27')](handleError(_0x3dfd69,null));};exports[_0x1b36('0xcd')]=function(_0x1a1566,_0x2c9f28,_0x3076c9){var _0x5b3210,_0x15206a,_0x62214d;var _0x593d4d=[];var _0x5e0fa4=[];var _0x4fa1a3={};return db[_0x1b36('0x90')][_0x1b36('0x63')]()[_0x1b36('0x30')](function(_0x11446f){if(!_0x11446f){throw new db[(_0x1b36('0x1c'))][(_0x1b36('0x1d'))](_0x1b36('0x91'));}_0x5e0fa4=_[_0x1b36('0x92')](_[_0x1b36('0x54')](_0x11446f),[_0x1b36('0x93'),_0x1b36('0x94')]);_0x593d4d=_[_0x1b36('0x92')](_[_0x1b36('0x54')](_0x11446f),[_0x1b36('0x93'),'updatedAt','CompanyId',_0x1b36('0x96')]);if(_0x1a1566[_0x1b36('0x5a')]['id']){delete _0x1a1566[_0x1b36('0x5a')]['id'];}if(_[_0x1b36('0x7e')](_0x1a1566[_0x1b36('0x5a')][_0x1b36('0x97')])){throw _0x2c9f28[_0x1b36('0x29')](0x1f4)[_0x1b36('0x36')](new db[(_0x1b36('0x1c'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x1b36('0x7e')](_0x1a1566[_0x1b36('0x5a')][_0x1b36('0x5a')])||_0x1a1566[_0x1b36('0x5a')][_0x1b36('0x5a')]===''){throw _0x2c9f28[_0x1b36('0x29')](0x1f4)[_0x1b36('0x36')](new db[(_0x1b36('0x1c'))][(_0x1b36('0x1d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x1b36('0x7e')](_0x1a1566[_0x1b36('0x5a')][_0x1b36('0xce')])){throw _0x2c9f28[_0x1b36('0x29')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x1b36('0xcf')+_0x593d4d));}if(!_[_0x1b36('0xd0')](_0x593d4d,_0x1a1566[_0x1b36('0x5a')]['mapKeyOffline'])){throw _0x2c9f28[_0x1b36('0x29')](0x1f4)[_0x1b36('0x36')](new db[(_0x1b36('0x1c'))][(_0x1b36('0x1d'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x593d4d));}_0x4fa1a3[_0x1a1566[_0x1b36('0x5a')][_0x1b36('0xce')]]=_0x1a1566[_0x1b36('0x5a')][_0x1b36('0x97')];})[_0x1b36('0x30')](function(){return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0x1a1566['params']['id']},'include':[{'model':db['CmList'],'as':'List'}]});})[_0x1b36('0x30')](handleEntityNotFound(_0x2c9f28,null))[_0x1b36('0x30')](function(_0x28708a){if(_0x28708a&&_0x28708a[_0x1b36('0x9d')]){_0x15206a=_0x28708a;var _0x391933=_[_0x1b36('0x16')](_0x1a1566[_0x1b36('0x5a')],{'firstName':_0x1a1566[_0x1b36('0x5a')][_0x1b36('0x97')],'phone':_0x1a1566[_0x1b36('0x5a')][_0x1b36('0x97')],'ListId':_0x28708a[_0x1b36('0x96')]});_0x391933[_0x1a1566[_0x1b36('0x5a')]['mapKeyOffline']]=_0x1a1566[_0x1b36('0x5a')][_0x1b36('0x97')];return db['CmContact'][_0x1b36('0xd1')]({'where':_0x4fa1a3,'defaults':_0x391933});}})[_0x1b36('0xd2')](function(_0x1b101f){if(_0x1b101f){_0x62214d=_0x1b101f;var _0x1f91f4=fs['readFileSync'](path[_0x1b36('0x80')](config[_0x1b36('0x79')],_0x1b36('0xd3')),'utf8');var _0x1dd085=ejs[_0x1b36('0xd4')](_0x1f91f4,{'body':_[_0x1b36('0xd5')](_0x1a1566[_0x1b36('0x5a')][_0x1b36('0x5a')]),'bodyTitle':_0x15206a[_0x1b36('0xd6')]});return db[_0x1b36('0xd7')][_0x1b36('0x59')]({'body':_0x1dd085,'ContactId':_0x1b101f['id'],'ChatWebsiteId':_0x15206a['id']});}})[_0x1b36('0x30')](function(_0x27bb17){if(_0x27bb17){_0x5b3210=_0x27bb17;return db['MailAccount'][_0x1b36('0x6d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1b36('0xd8'),'raw':!![]}]});}})[_0x1b36('0x30')](function(_0x1564bc){if(_0x1564bc&&_0x1564bc[_0x1b36('0xd8')]&&_0x15206a[_0x1b36('0xd9')]){var _0x30840a={'tls':{'rejectUnauthorized':![]}};if(_0x1564bc[_0x1b36('0xd8')]['service']){_0x30840a[_0x1b36('0xda')]=_0x1564bc[_0x1b36('0xd8')]['service'];}else{_0x30840a[_0x1b36('0xdb')]=_0x1564bc[_0x1b36('0xd8')][_0x1b36('0xdb')];_0x30840a['port']=_0x1564bc[_0x1b36('0xd8')][_0x1b36('0xdc')];_0x30840a[_0x1b36('0xdd')]=_0x1564bc['Smtp']['secure'];}if(_0x1564bc['Smtp'][_0x1b36('0xde')]){_0x30840a[_0x1b36('0xdf')]={'user':_0x1564bc[_0x1b36('0xd8')]['user'],'pass':_0x1564bc[_0x1b36('0xd8')][_0x1b36('0xe0')]};}return respondWithRpcPromise('SendMail',_0x1b36('0xe1'),{'account':_0x30840a,'message':{'from':util[_0x1b36('0xb4')](_0x1b36('0xe2'),_0x1564bc['name'],_0x1564bc['email']||_0x1564bc['Smtp'][_0x1b36('0x5b')]),'to':_0x15206a['forwardOfflineAddress'],'subject':_0x15206a[_0x1b36('0xe3')],'text':_0x5b3210[_0x1b36('0x5a')]}},client9003)['then'](function(){return _0x5b3210;})[_0x1b36('0x27')](function(_0x24b6c7){console[_0x1b36('0x24')](_0x24b6c7);});}})[_0x1b36('0x30')](function(){if(_0x5b3210){return _0x5b3210;}})[_0x1b36('0x30')](respondWithResult(_0x2c9f28,null))[_0x1b36('0x27')](handleError(_0x2c9f28,null));};exports[_0x1b36('0xe4')]=function(_0x4bcff5,_0xde34c7,_0x2e1893){return db['ChatInteraction'][_0x1b36('0x58')]({'where':{'id':_0x4bcff5['params']['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0xde34c7,null))[_0x1b36('0x30')](function(_0x2243ec){if(_0x2243ec){return _0x2243ec[_0x1b36('0xe4')](_0x4bcff5[_0x1b36('0x5a')][_0x1b36('0x6a')],_[_0x1b36('0xe5')](_0x4bcff5['body'],['ids','id'])||{});}})[_0x1b36('0x30')](respondWithResult(_0xde34c7,null))[_0x1b36('0x27')](handleError(_0xde34c7,null));};exports[_0x1b36('0xe6')]=function(_0x2d44b7,_0x1bbb95,_0x17a974){var _0x2b676d={'raw':![],'where':{}};var _0x4970a5={};var _0x1f34e6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1b36('0x6d')]({'where':{'id':_0x2d44b7[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x1bbb95,null))[_0x1b36('0x30')](function(_0x2456fe){if(_0x2456fe){_0x4970a5[_0x1b36('0x3f')]=_[_0x1b36('0x54')](db['ChatInteraction'][_0x1b36('0x3b')]);_0x4970a5[_0x1b36('0x40')]=_[_0x1b36('0x54')](_0x2d44b7[_0x1b36('0x40')]);_0x4970a5['filters']=_[_0x1b36('0x43')](_0x4970a5[_0x1b36('0x3f')],_0x4970a5[_0x1b36('0x40')]);_0x2b676d[_0x1b36('0x42')]=_['intersection'](_0x4970a5[_0x1b36('0x3f')],qs[_0x1b36('0x44')](_0x2d44b7['query'][_0x1b36('0x44')]));_0x2b676d['attributes']=_0x2b676d[_0x1b36('0x42')][_0x1b36('0x55')]?_0x2b676d[_0x1b36('0x42')]:_0x4970a5[_0x1b36('0x3f')];if(!_0x2d44b7[_0x1b36('0x40')][_0x1b36('0x45')]('nolimit')){_0x2b676d[_0x1b36('0x47')]=qs[_0x1b36('0x47')](_0x2d44b7[_0x1b36('0x40')][_0x1b36('0x47')]);_0x2b676d['offset']=qs['offset'](_0x2d44b7['query'][_0x1b36('0x2b')]);}_0x2b676d['order']=qs[_0x1b36('0x49')](_0x2d44b7[_0x1b36('0x40')][_0x1b36('0x49')]);_0x2b676d[_0x1b36('0x4b')]=qs[_0x1b36('0x41')](_['pick'](_0x2d44b7[_0x1b36('0x40')],_0x4970a5['filters']));_0x2b676d['where']['ChatWebsiteId']=_0x2456fe['id'];if(_0x2d44b7[_0x1b36('0x40')][_0x1b36('0x4e')]){_0x2b676d[_0x1b36('0x4b')]=_['merge'](_0x2b676d['where'],{'$or':_['map'](_0x2b676d[_0x1b36('0x42')],function(_0x4c379b){var _0x192644={};_0x192644[_0x4c379b]={'$like':'%'+_0x2d44b7[_0x1b36('0x40')][_0x1b36('0x4e')]+'%'};return _0x192644;})});}_0x2b676d=_[_0x1b36('0x4c')]({},_0x2b676d,_0x2d44b7[_0x1b36('0x57')]);return db[_0x1b36('0xbb')]['count']({'where':_0x2b676d['where']})[_0x1b36('0x30')](function(_0x4233d9){_0x1f34e6[_0x1b36('0x2a')]=_0x4233d9;if(_0x2d44b7['query']['includeAll']){_0x2b676d[_0x1b36('0x4f')]=[{'model':db[_0x1b36('0x90')],'as':'Contact','required':![]},{'model':db[_0x1b36('0xe7')],'as':_0x1b36('0xe8'),'attributes':[_0x1b36('0x35'),_0x1b36('0xe9'),_0x1b36('0xea')],'required':![]},{'model':db[_0x1b36('0xeb')],'as':_0x1b36('0xec'),'attributes':['id',_0x1b36('0x35'),_0x1b36('0xed')],'where':_0x2d44b7[_0x1b36('0x40')][_0x1b36('0xee')]?{'id':_0x2d44b7[_0x1b36('0x40')][_0x1b36('0xee')]}:undefined,'required':_0x2d44b7[_0x1b36('0x40')][_0x1b36('0xee')]?!![]:![]}];}return db['ChatInteraction'][_0x1b36('0x50')](_0x2b676d);})[_0x1b36('0x30')](function(_0x480c32){_0x1f34e6['rows']=_0x480c32;return _0x1f34e6;});}})[_0x1b36('0x30')](respondWithFilteredResult(_0x1bbb95,_0x2b676d))[_0x1b36('0x27')](handleError(_0x1bbb95,null));};function iftimePromise(_0x5a0925,_0x36cafb){return respondWithRpcPromise(_0x1b36('0xef'),_0x1b36('0xf0'),{'command':_0x36cafb[_0x1b36('0xf1')]?util[_0x1b36('0xb4')](_0x1b36('0xf2'),_0x5a0925[_0x1b36('0xf3')],_0x36cafb[_0x1b36('0xf1')]):util[_0x1b36('0xb4')]('iftime\x20%s',_0x5a0925[_0x1b36('0xf3')])},client9002)[_0x1b36('0x30')](function(_0x4ec356){var _0x389d30=_0x4ec356&&_0x4ec356[_0x1b36('0xf4')](_0x1b36('0xf5'))>=0x0?!![]:![];logger['info'](_0x1b36('0xf6'),_0x36cafb['id'],_0x5a0925['id'],_0x5a0925[_0x1b36('0xf3')],_0x389d30?_0x1b36('0xf7'):_0x1b36('0xf8'),_0x36cafb[_0x1b36('0xf1')]?_0x36cafb[_0x1b36('0xf1')]:_0x1b36('0xf9'));return _0x389d30;})['catch'](function(_0x2c1576){logger[_0x1b36('0x24')](_0x1b36('0xf6'),_0x36cafb['id'],_0x5a0925['id'],_0x5a0925[_0x1b36('0xf3')],util['inspect'](_0x2c1576,{'showHidden':![],'depth':null}),_0x36cafb[_0x1b36('0xf1')]?_0x36cafb['timezone']:_0x1b36('0xf9'));return![];});}exports[_0x1b36('0xf0')]=function(_0x4e7f62,_0x11641d,_0x557ddd){var _0x235106=0x0;var _0xfa1e63=0x0;var _0x30b9aa=![];var _0x4c8019;var _0x252952;return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0x4e7f62[_0x1b36('0x52')]['id']},'include':[{'model':db['Interval'],'as':_0x1b36('0xfa'),'include':[{'model':db[_0x1b36('0xfa')],'as':'Intervals','attributes':['id',_0x1b36('0xf3')],'raw':!![]}]}]})[_0x1b36('0x30')](handleEntityNotFound(_0x11641d,null))[_0x1b36('0x30')](function(_0x3c12b9){if(_0x3c12b9){_0x4c8019=_0x3c12b9;return _0x3c12b9['getProactiveActions']({'raw':!![]});}})[_0x1b36('0x30')](function(_0x4c83c6){if(_0x4c8019){if(_0x4c83c6){_0x252952=_0x4c83c6;}}return require(_0x1b36('0x7b'))[_0x1b36('0x7c')]();})['then'](function(_0x4c2059){if(_0x4c2059){_0xfa1e63=_0x4c2059[_0x1b36('0xfb')];_0x30b9aa=_0x4c2059[_0x1b36('0x7d')];}})[_0x1b36('0x30')](function(){return db[_0x1b36('0xbb')]['count']({'where':{'closed':![]}});})[_0x1b36('0x30')](function(_0x4aba2e){_0x235106=_0x4aba2e;if(_0xfa1e63&&_0x4aba2e>_0xfa1e63){return db[_0x1b36('0xfc')][_0x1b36('0x6d')]({'where':{'id':0x1}})[_0x1b36('0x30')](function(_0x17f24d){if(_0x17f24d){_0x17f24d[_0x1b36('0xfd')](_0x1b36('0xfe'));}});}})['then'](function(){if(_0x4c8019['Interval']&&_0x4c8019[_0x1b36('0xfa')][_0x1b36('0xff')]){var _0x35b383=[];for(var _0x165299=0x0;_0x165299<_0x4c8019[_0x1b36('0xfa')][_0x1b36('0xff')][_0x1b36('0x55')];_0x165299++){var _0x247e58=_0x4c8019['Interval'][_0x1b36('0xff')][_0x165299][_0x1b36('0x5c')]({'plain':!![]});_0x35b383[_0x1b36('0xc1')](iftimePromise(_0x247e58,_0x4c8019));}return BPromise[_0x1b36('0x100')](_0x35b383)[_0x1b36('0x30')](function(_0x53022a){return _[_0x1b36('0x101')](_0x53022a);});}else{return!![];}})['then'](function(_0x31af19){var _0x70b4f9=fs['readFileSync'](path['join'](config[_0x1b36('0x79')],'server/files/chat/iframe.js'),_0x1b36('0x102'));var _0x339b41={'remote':_0x4c8019['remote'],'query':querystring['stringify'](_['merge'](_0x4c8019[_0x1b36('0x5c')]({'plain':!![]}),{'customerIp':_0x4e7f62[_0x1b36('0xab')][_0x1b36('0xad')]||_0x4e7f62['headers'][_0x1b36('0x103')]||_0x4e7f62[_0x1b36('0x104')]['remoteAddress']||_0x4e7f62['ip'],'referer':_0x4e7f62[_0x1b36('0xab')][_0x1b36('0xb1')],'openedInteractions':_0x235106,'maxInteractions':_0xfa1e63,'virtual':_0x30b9aa['virtual'],'online':_0x31af19,'custom':_0x30b9aa}))[_0x1b36('0x105')](/'/g,'\x5c\x27')};_0x11641d[_0x1b36('0x36')](ejs[_0x1b36('0xd4')](Mustache[_0x1b36('0xd4')](_0x70b4f9,_0x339b41),{'proactiveActions':_0x252952,'alignment':_0x4c8019[_0x1b36('0x106')],'verticalAlignment':_0x4c8019[_0x1b36('0x107')],'div_color':_0x4c8019[_0x1b36('0xed')],'text_color':_0x4c8019['textColor']}));})[_0x1b36('0x27')](handleError(_0x11641d,null));};exports[_0x1b36('0x108')]=function(_0x16067c,_0xa8dcea,_0x1cc8dc){return db[_0x1b36('0x3a')][_0x1b36('0x6d')]({'where':{'id':_0x16067c['params']['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0xa8dcea,null))['then'](function(_0x10f554){if(_0x10f554){return db[_0x1b36('0x109')][_0x1b36('0x10a')](function(_0x9746b5){return db['ChatApplication'][_0x1b36('0x31')]({'where':{'ChatWebsiteId':_0x16067c['params']['id']},'transaction':_0x9746b5})[_0x1b36('0x30')](function(_0x3d3627){var _0x59647d=_[_0x1b36('0x39')](_0x16067c[_0x1b36('0x5a')],function(_0x27e6b4){_0x27e6b4[_0x1b36('0x65')]=_0x16067c[_0x1b36('0x52')]['id'];return _0x27e6b4;});return db['ChatApplication'][_0x1b36('0x10b')](_0x59647d,{'transaction':_0x9746b5});});})[_0x1b36('0x30')](function(){return db[_0x1b36('0xa0')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x16067c[_0x1b36('0x52')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0xa8dcea,null))['catch'](handleError(_0xa8dcea,null));};exports['getApplications']=function(_0x31f10b,_0x2b1aca,_0x3f4d19){var _0x303946={};var _0x4954b9={};var _0x2bafb4;var _0x5c2ee1;return db[_0x1b36('0x3a')][_0x1b36('0x6d')]({'where':{'id':_0x31f10b[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x2b1aca,null))[_0x1b36('0x30')](function(_0x438e56){if(_0x438e56){_0x2bafb4=_0x438e56;_0x4954b9[_0x1b36('0x3f')]=_[_0x1b36('0x54')](db[_0x1b36('0xa0')][_0x1b36('0x3b')]);_0x4954b9['query']=_[_0x1b36('0x54')](_0x31f10b[_0x1b36('0x40')]);_0x4954b9['filters']=_[_0x1b36('0x43')](_0x4954b9[_0x1b36('0x3f')],_0x4954b9[_0x1b36('0x40')]);_0x303946[_0x1b36('0x42')]=_[_0x1b36('0x43')](_0x4954b9[_0x1b36('0x3f')],qs[_0x1b36('0x44')](_0x31f10b[_0x1b36('0x40')]['fields']));_0x303946[_0x1b36('0x42')]=_0x303946[_0x1b36('0x42')]['length']?_0x303946['attributes']:_0x4954b9[_0x1b36('0x3f')];_0x303946[_0x1b36('0x48')]=qs['sort'](_0x31f10b[_0x1b36('0x40')][_0x1b36('0x49')]);_0x303946['where']=qs[_0x1b36('0x41')](_[_0x1b36('0x4a')](_0x31f10b[_0x1b36('0x40')],_0x4954b9['filters']));if(_0x31f10b[_0x1b36('0x40')]['filter']){_0x303946['where']=_[_0x1b36('0x4c')](_0x303946[_0x1b36('0x4b')],{'$or':_[_0x1b36('0x39')](_0x303946['attributes'],function(_0x32d277){var _0x5c851d={};_0x5c851d[_0x32d277]={'$like':'%'+_0x31f10b[_0x1b36('0x40')][_0x1b36('0x4e')]+'%'};return _0x5c851d;})});}_0x303946=_[_0x1b36('0x4c')]({},_0x303946,_0x31f10b[_0x1b36('0x57')]);return _0x2bafb4[_0x1b36('0x10c')](_0x303946);}})['then'](function(_0x26f8cc){if(_0x26f8cc){_0x5c2ee1=_0x26f8cc[_0x1b36('0x55')];if(!_0x31f10b[_0x1b36('0x40')][_0x1b36('0x45')](_0x1b36('0x46'))){_0x303946[_0x1b36('0x47')]=qs[_0x1b36('0x47')](_0x31f10b['query'][_0x1b36('0x47')]);_0x303946['offset']=qs[_0x1b36('0x2b')](_0x31f10b[_0x1b36('0x40')]['offset']);}return _0x2bafb4[_0x1b36('0x10c')](_0x303946);}})[_0x1b36('0x30')](function(_0x46e0ee){if(_0x46e0ee){return _0x46e0ee?{'count':_0x5c2ee1,'rows':_0x46e0ee}:null;}})[_0x1b36('0x30')](respondWithResult(_0x2b1aca,null))[_0x1b36('0x27')](handleError(_0x2b1aca,null));};exports[_0x1b36('0x10d')]=function(_0x912030,_0x3cc071,_0x4bcbed){return db[_0x1b36('0x10e')]['find']({'where':{'id':_0x912030['params']['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x3cc071,null))[_0x1b36('0x30')](function(_0x259eff){if(_0x259eff){return _0x259eff[_0x1b36('0x10d')](_0x912030['body'][_0x1b36('0x6a')],_['omit'](_0x912030[_0x1b36('0x5a')],['ids','id'])||{});}})[_0x1b36('0x30')](respondWithResult(_0x3cc071,null))[_0x1b36('0x27')](handleError(_0x3cc071,null));};exports[_0x1b36('0x10f')]=function(_0xf940b1,_0x26b3b2,_0x1189bd){var _0x25b3ec={};var _0x252213={};var _0x388081;var _0x19e68d;return db[_0x1b36('0x3a')][_0x1b36('0x6d')]({'where':{'id':_0xf940b1[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x26b3b2,null))[_0x1b36('0x30')](function(_0x9a1ab3){if(_0x9a1ab3){_0x388081=_0x9a1ab3;_0x252213[_0x1b36('0x3f')]=_[_0x1b36('0x54')](db[_0x1b36('0x110')][_0x1b36('0x3b')]);_0x252213['query']=_[_0x1b36('0x54')](_0xf940b1[_0x1b36('0x40')]);_0x252213[_0x1b36('0x41')]=_['intersection'](_0x252213['model'],_0x252213[_0x1b36('0x40')]);_0x25b3ec[_0x1b36('0x42')]=_[_0x1b36('0x43')](_0x252213[_0x1b36('0x3f')],qs[_0x1b36('0x44')](_0xf940b1[_0x1b36('0x40')][_0x1b36('0x44')]));_0x25b3ec['attributes']=_0x25b3ec[_0x1b36('0x42')][_0x1b36('0x55')]?_0x25b3ec[_0x1b36('0x42')]:_0x252213[_0x1b36('0x3f')];_0x25b3ec[_0x1b36('0x48')]=qs[_0x1b36('0x49')](_0xf940b1['query'][_0x1b36('0x49')]);_0x25b3ec[_0x1b36('0x4b')]=qs['filters'](_[_0x1b36('0x4a')](_0xf940b1[_0x1b36('0x40')],_0x252213[_0x1b36('0x41')]));if(_0xf940b1['query'][_0x1b36('0x4e')]){_0x25b3ec[_0x1b36('0x4b')]=_[_0x1b36('0x4c')](_0x25b3ec[_0x1b36('0x4b')],{'$or':_[_0x1b36('0x39')](_0x25b3ec[_0x1b36('0x42')],function(_0x4bca56){var _0x152082={};_0x152082[_0x4bca56]={'$like':'%'+_0xf940b1[_0x1b36('0x40')][_0x1b36('0x4e')]+'%'};return _0x152082;})});}_0x25b3ec=_[_0x1b36('0x4c')]({},_0x25b3ec,_0xf940b1[_0x1b36('0x57')]);return _0x388081['getProactiveActions'](_0x25b3ec);}})[_0x1b36('0x30')](function(_0x451fd9){if(_0x451fd9){_0x19e68d=_0x451fd9[_0x1b36('0x55')];if(!_0xf940b1[_0x1b36('0x40')][_0x1b36('0x45')](_0x1b36('0x46'))){_0x25b3ec[_0x1b36('0x47')]=qs[_0x1b36('0x47')](_0xf940b1[_0x1b36('0x40')][_0x1b36('0x47')]);_0x25b3ec[_0x1b36('0x2b')]=qs[_0x1b36('0x2b')](_0xf940b1[_0x1b36('0x40')][_0x1b36('0x2b')]);}return _0x388081['getProactiveActions'](_0x25b3ec);}})[_0x1b36('0x30')](function(_0x3e8265){if(_0x3e8265){return _0x3e8265?{'count':_0x19e68d,'rows':_0x3e8265}:null;}})['then'](respondWithResult(_0x26b3b2,null))['catch'](handleError(_0x26b3b2,null));};exports['getFields']=function(_0x10448c,_0x42d3f0,_0x52d03d){var _0x5ea3ea=_0x10448c[_0x1b36('0x40')][_0x1b36('0x111')]===_0x1b36('0x112')?_0x1b36('0x113'):_0x1b36('0x114');return db[_0x1b36('0x3a')]['find']({'attributes':['id',_0x5ea3ea],'where':{'id':_0x10448c[_0x1b36('0x52')]['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x42d3f0,null))[_0x1b36('0x30')](function(_0x36800d){if(_0x36800d){var _0x213e24=_0x36800d[_0x5ea3ea];var _0x617afa=_0x213e24&&_0x213e24[_0x1b36('0x115')]?_0x213e24[_0x1b36('0x115')]:[];_0x42d3f0[_0x1b36('0x36')]({'fromKey':_[_0x1b36('0x7e')](_0x213e24[_0x1b36('0x116')])?undefined:_0x213e24[_0x1b36('0x116')],'count':_0x617afa[_0x1b36('0x55')],'rows':_0x617afa});}})['catch'](handleError(_0x42d3f0,null));};exports[_0x1b36('0x117')]=function(_0x52a024,_0x3fc1dd,_0x23f6e9){var _0xda570d={'raw':![],'where':{}};var _0x2905d4={};var _0x501662={'count':0x0,'rows':[]};return db[_0x1b36('0x3a')]['findOne']({'where':{'id':_0x52a024['params']['id']}})['then'](handleEntityNotFound(_0x3fc1dd,null))[_0x1b36('0x30')](function(_0x126c36){if(_0x126c36){_0x2905d4[_0x1b36('0x3f')]=_[_0x1b36('0x54')](db[_0x1b36('0xd7')][_0x1b36('0x3b')]);_0x2905d4[_0x1b36('0x40')]=_[_0x1b36('0x54')](_0x52a024['query']);_0x2905d4['filters']=_[_0x1b36('0x43')](_0x2905d4[_0x1b36('0x3f')],_0x2905d4['query']);_0xda570d[_0x1b36('0x42')]=_[_0x1b36('0x43')](_0x2905d4['model'],qs['fields'](_0x52a024[_0x1b36('0x40')][_0x1b36('0x44')]));_0xda570d['attributes']=_0xda570d[_0x1b36('0x42')][_0x1b36('0x55')]?_0xda570d['attributes']:_0x2905d4[_0x1b36('0x3f')];if(!_0x52a024[_0x1b36('0x40')]['hasOwnProperty'](_0x1b36('0x46'))){_0xda570d[_0x1b36('0x47')]=qs[_0x1b36('0x47')](_0x52a024[_0x1b36('0x40')][_0x1b36('0x47')]);_0xda570d['offset']=qs[_0x1b36('0x2b')](_0x52a024['query'][_0x1b36('0x2b')]);}_0xda570d[_0x1b36('0x48')]=qs[_0x1b36('0x49')](_0x52a024[_0x1b36('0x40')][_0x1b36('0x49')]);_0xda570d[_0x1b36('0x4b')]=qs[_0x1b36('0x41')](_['pick'](_0x52a024['query'],_0x2905d4[_0x1b36('0x41')]));_0xda570d[_0x1b36('0x4b')][_0x1b36('0x65')]=_0x126c36['id'];if(_0x52a024[_0x1b36('0x40')][_0x1b36('0x4e')]){_0xda570d[_0x1b36('0x4b')]=_[_0x1b36('0x4c')](_0xda570d[_0x1b36('0x4b')],{'$or':_[_0x1b36('0x39')](_0xda570d['attributes'],function(_0x4f718e){var _0x3dfd83={};_0x3dfd83[_0x4f718e]={'$like':'%'+_0x52a024[_0x1b36('0x40')][_0x1b36('0x4e')]+'%'};return _0x3dfd83;})});}_0xda570d=_[_0x1b36('0x4c')]({},_0xda570d,_0x52a024[_0x1b36('0x57')]);return db[_0x1b36('0xd7')][_0x1b36('0x2a')]({'where':_0xda570d[_0x1b36('0x4b')]})[_0x1b36('0x30')](function(_0x4152f5){_0x501662[_0x1b36('0x2a')]=_0x4152f5;if(_0x52a024[_0x1b36('0x40')]['includeAll']){_0xda570d['include']=[{'all':!![]}];}else{_0xda570d[_0x1b36('0x4f')]=[{'model':db[_0x1b36('0x90')],'as':_0x1b36('0x118'),'required':![]}];}return db[_0x1b36('0xd7')][_0x1b36('0x50')](_0xda570d);})['then'](function(_0x48febf){_0x501662[_0x1b36('0x68')]=_0x48febf;return _0x501662;});}})[_0x1b36('0x30')](respondWithFilteredResult(_0x3fc1dd,_0xda570d))['catch'](handleError(_0x3fc1dd,null));};exports[_0x1b36('0x119')]=function(_0x20cdb0,_0x351451,_0x125a4a){return db[_0x1b36('0x3a')][_0x1b36('0x58')]({'where':{'id':_0x20cdb0['params']['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x351451,null))[_0x1b36('0x30')](function(_0x44e4e6){if(_0x44e4e6){return _0x44e4e6[_0x1b36('0x119')](_0x20cdb0[_0x1b36('0x5a')][_0x1b36('0x6a')],_[_0x1b36('0xe5')](_0x20cdb0[_0x1b36('0x5a')],[_0x1b36('0x6a'),'id'])||{})[_0x1b36('0xd2')](function(_0x261b12){for(var _0x2bd1c2=0x0;_0x2bd1c2<_0x20cdb0[_0x1b36('0x5a')][_0x1b36('0x6a')][_0x1b36('0x55')];_0x2bd1c2+=0x1){socket[_0x1b36('0x11a')]('userChatWebsite:save',{'UserId':_0x20cdb0['body']['ids'][_0x2bd1c2],'ChatWebsiteId':_0x20cdb0['params']['id']});}return _0x261b12;});}})[_0x1b36('0x30')](respondWithResult(_0x351451,null))[_0x1b36('0x27')](handleError(_0x351451,null));};exports[_0x1b36('0x11b')]=function(_0xe34c4c,_0x2ae89c,_0x33a151){return db[_0x1b36('0x3a')]['find']({'where':{'id':_0xe34c4c['params']['id']}})[_0x1b36('0x30')](handleEntityNotFound(_0x2ae89c,null))[_0x1b36('0x30')](function(_0x1fbb74){if(_0x1fbb74){return _0x1fbb74[_0x1b36('0x11b')](_0xe34c4c[_0x1b36('0x40')][_0x1b36('0x6a')])[_0x1b36('0x30')](function(){if(_[_0x1b36('0x11c')](_0xe34c4c['query'][_0x1b36('0x6a')])){for(var _0x4a26c6=0x0;_0x4a26c6<_0xe34c4c[_0x1b36('0x40')]['ids'][_0x1b36('0x55')];_0x4a26c6+=0x1){socket[_0x1b36('0x11a')]('userChatWebsite:remove',{'UserId':Number(_0xe34c4c[_0x1b36('0x40')][_0x1b36('0x6a')][_0x4a26c6]),'ChatWebsiteId':Number(_0xe34c4c[_0x1b36('0x52')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0xe34c4c[_0x1b36('0x40')][_0x1b36('0x6a')]),'ChatWebsiteId':Number(_0xe34c4c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2ae89c,null))['catch'](handleError(_0x2ae89c,null));};exports[_0x1b36('0x11d')]=function(_0x322cc1,_0xa2f3f,_0x5eaa76){var _0x2141af={};var _0x576a3c={};var _0x26b609;var _0x517436;return db[_0x1b36('0x3a')]['findOne']({'where':{'id':_0x322cc1[_0x1b36('0x52')]['id']}})['then'](handleEntityNotFound(_0xa2f3f,null))[_0x1b36('0x30')](function(_0x10ef62){if(_0x10ef62){_0x26b609=_0x10ef62;_0x576a3c[_0x1b36('0x3f')]=_[_0x1b36('0x54')](db[_0x1b36('0xe7')]['rawAttributes']);_0x576a3c[_0x1b36('0x40')]=_['keys'](_0x322cc1['query']);_0x576a3c[_0x1b36('0x41')]=_[_0x1b36('0x43')](_0x576a3c[_0x1b36('0x3f')],_0x576a3c['query']);_0x2141af[_0x1b36('0x42')]=_[_0x1b36('0x43')](_0x576a3c['model'],qs[_0x1b36('0x44')](_0x322cc1[_0x1b36('0x40')][_0x1b36('0x44')]));_0x2141af[_0x1b36('0x42')]=_0x2141af[_0x1b36('0x42')][_0x1b36('0x55')]?_0x2141af[_0x1b36('0x42')]:_0x576a3c[_0x1b36('0x3f')];_0x2141af[_0x1b36('0x48')]=qs[_0x1b36('0x49')](_0x322cc1[_0x1b36('0x40')]['sort']);_0x2141af['where']=qs['filters'](_[_0x1b36('0x4a')](_0x322cc1[_0x1b36('0x40')],_0x576a3c[_0x1b36('0x41')]));if(_0x322cc1[_0x1b36('0x40')][_0x1b36('0x4e')]){_0x2141af[_0x1b36('0x4b')]=_[_0x1b36('0x4c')](_0x2141af['where'],{'$or':_['map'](_0x2141af[_0x1b36('0x42')],function(_0x28f371){var _0x321d3e={};_0x321d3e[_0x28f371]={'$like':'%'+_0x322cc1['query'][_0x1b36('0x4e')]+'%'};return _0x321d3e;})});}_0x2141af=_[_0x1b36('0x4c')]({},_0x2141af,_0x322cc1['options']);return _0x26b609[_0x1b36('0x11d')](_0x2141af);}})[_0x1b36('0x30')](function(_0x3ffd46){if(_0x3ffd46){_0x517436=_0x3ffd46[_0x1b36('0x55')];if(!_0x322cc1[_0x1b36('0x40')]['hasOwnProperty'](_0x1b36('0x46'))){_0x2141af[_0x1b36('0x47')]=qs['limit'](_0x322cc1['query']['limit']);_0x2141af['offset']=qs[_0x1b36('0x2b')](_0x322cc1['query'][_0x1b36('0x2b')]);}return _0x26b609[_0x1b36('0x11d')](_0x2141af);}})[_0x1b36('0x30')](function(_0x3f0bd7){if(_0x3f0bd7){return _0x3f0bd7?{'count':_0x517436,'rows':_0x3f0bd7}:null;}})['then'](respondWithResult(_0xa2f3f,null))['catch'](handleError(_0xa2f3f,null));}; \ No newline at end of file +var _0x2c3f=['fields','query','nolimit','order','sort','pick','where','map','VIRTUAL','filter','ChatWebsite','show','params','mandatoryDispositionPause','keys','length','includeAll','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','findAll','rows','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','root','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','CmContact','difference','createdAt','updatedAt','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','priority','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','forcedOwnership','startRouting','Start','EventManager','from\x20is\x20mandatory','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','options','Contact','Owner','fullname','internal','Tag','Tags','tag','iftime\x20%s,%s','interval','timezone','indexOf','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','getLicense','increment','all','some','readFileSync','server/files/chat/iframe.js','x-real-ip','connection','virtual','verticalAlignment','color','textColor','addApplications','transaction','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','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','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','ChatWebsites','UserProfileResource','sendStatus','stack','name','Pause','rawAttributes','fieldName','type','key','model','filters','intersection','attributes'];(function(_0x3e1ce3,_0x2666ef){var _0x240cf0=function(_0x1456e0){while(--_0x1456e0){_0x3e1ce3['push'](_0x3e1ce3['shift']());}};_0x240cf0(++_0x2666ef);}(_0x2c3f,0xd6));var _0xf2c3=function(_0x24ff40,_0x4618ca){_0x24ff40=_0x24ff40-0x0;var _0x50ac0b=_0x2c3f[_0x24ff40];return _0x50ac0b;};'use strict';var pdf=require(_0xf2c3('0x0'));var emlformat=require(_0xf2c3('0x1'));var rimraf=require(_0xf2c3('0x2'));var zipdir=require(_0xf2c3('0x3'));var jsonpatch=require(_0xf2c3('0x4'));var rp=require(_0xf2c3('0x5'));var moment=require(_0xf2c3('0x6'));var BPromise=require(_0xf2c3('0x7'));var Mustache=require(_0xf2c3('0x8'));var util=require(_0xf2c3('0x9'));var path=require(_0xf2c3('0xa'));var sox=require(_0xf2c3('0xb'));var csv=require(_0xf2c3('0xc'));var ejs=require(_0xf2c3('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf2c3('0xe'));var jsforce=require(_0xf2c3('0xf'));var deskjs=require(_0xf2c3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf2c3('0x11'));var Papa=require('papaparse');var Redis=require(_0xf2c3('0x12'));var authService=require(_0xf2c3('0x13'));var qs=require(_0xf2c3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2c3('0x15'));var logger=require(_0xf2c3('0x16'))(_0xf2c3('0x17'));var utils=require('../../config/utils');var config=require(_0xf2c3('0x18'));var db=require('../../mysqldb')['db'];config[_0xf2c3('0x19')]=_[_0xf2c3('0x1a')](config[_0xf2c3('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf2c3('0x1b'))(new Redis(config[_0xf2c3('0x19')]));require(_0xf2c3('0x1c'))[_0xf2c3('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xf2c3('0x1e')][_0xf2c3('0x1f')]({'port':0x232a});var client9003=jayson[_0xf2c3('0x1e')][_0xf2c3('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x1c51ef,_0x4e76d8,_0x2ba448){if(_0x2ba448){var _0x3f24fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f24fd[_0xf2c3('0x20')](_0x4e76d8)){return _0x1c51ef;}else{throw new db[(_0xf2c3('0x21'))][(_0xf2c3('0x22'))](_0xf2c3('0x23'));}}else{return _0x1c51ef;}}function respondWithRpcPromise(_0xd6da7b,_0x15f4a3,_0x2a0822,_0x82aba3){return new BPromise(function(_0xaf33a8,_0xb6e671){var _0x10e570=_0x82aba3||client;return _0x10e570[_0xf2c3('0x24')](_0xd6da7b,_0x2a0822)[_0xf2c3('0x25')](function(_0x983cf6){logger[_0xf2c3('0x26')](_0xf2c3('0x27'),_0x15f4a3,_0xf2c3('0x28'));logger[_0xf2c3('0x29')](_0xf2c3('0x2a'),_0x15f4a3,_0xf2c3('0x28'),JSON['stringify'](_0x983cf6));if(_0x983cf6['error']){if(_0x983cf6[_0xf2c3('0x2b')][_0xf2c3('0x2c')]===0x1f4){logger[_0xf2c3('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0x15f4a3,_0x983cf6[_0xf2c3('0x2b')][_0xf2c3('0x2d')]);return _0xb6e671(_0x983cf6[_0xf2c3('0x2b')][_0xf2c3('0x2d')]);}logger['error'](_0xf2c3('0x27'),_0x15f4a3,_0x983cf6[_0xf2c3('0x2b')][_0xf2c3('0x2d')]);return _0xaf33a8(_0x983cf6[_0xf2c3('0x2b')]['message']);}else{logger['info'](_0xf2c3('0x27'),_0x15f4a3,_0xf2c3('0x28'));_0xaf33a8(_0x983cf6[_0xf2c3('0x2e')][_0xf2c3('0x2d')]);}})[_0xf2c3('0x2f')](function(_0x370dc4){logger[_0xf2c3('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0x15f4a3,_0x370dc4);_0xb6e671(_0x370dc4);});});}function respondWithStatusCode(_0x13dc68,_0x5abc86){_0x5abc86=_0x5abc86||0xcc;return function(_0x1173b0){if(_0x1173b0){return _0x13dc68['sendStatus'](_0x5abc86);}return _0x13dc68[_0xf2c3('0x30')](_0x5abc86)[_0xf2c3('0x31')]();};}function respondWithResult(_0x14cdc0,_0xc1e695){_0xc1e695=_0xc1e695||0xc8;return function(_0x359100){if(_0x359100){return _0x14cdc0[_0xf2c3('0x30')](_0xc1e695)[_0xf2c3('0x32')](_0x359100);}};}function respondWithFilteredResult(_0x4853aa,_0x26b28d){return function(_0xa54229){if(_0xa54229){var _0x307912=_0xa54229[_0xf2c3('0x33')],_0x16ee16=_0x26b28d[_0xf2c3('0x34')],_0x1e90d2=_0x26b28d[_0xf2c3('0x34')]+_0x26b28d[_0xf2c3('0x35')],_0x40ff90;if(_0x1e90d2>=_0x307912){_0x1e90d2=_0x307912;_0x40ff90=0xc8;}else{_0x40ff90=0xce;}_0x4853aa[_0xf2c3('0x30')](_0x40ff90);return _0x4853aa[_0xf2c3('0x36')](_0xf2c3('0x37'),_0x16ee16+'-'+_0x1e90d2+'/'+_0x307912)[_0xf2c3('0x32')](_0xa54229);}return null;};}function patchUpdates(_0x1c1e8d){return function(_0x18f96d){try{jsonpatch[_0xf2c3('0x38')](_0x18f96d,_0x1c1e8d,!![]);}catch(_0x1ed7b3){return BPromise[_0xf2c3('0x39')](_0x1ed7b3);}return _0x18f96d[_0xf2c3('0x3a')]();};}function saveUpdates(_0x3914a0,_0x441fe9){return function(_0x162b38){if(_0x162b38){return _0x162b38[_0xf2c3('0x3b')](_0x3914a0)[_0xf2c3('0x25')](function(_0x3558c5){return _0x3558c5;});}return null;};}function removeEntity(_0x35cf39,_0x407967){return function(_0x47bf05){if(_0x47bf05){return _0x47bf05[_0xf2c3('0x3c')]()[_0xf2c3('0x25')](function(){var _0x220886=_0x47bf05['get']({'plain':!![]});var _0x115e02=_0xf2c3('0x3d');return db[_0xf2c3('0x3e')][_0xf2c3('0x3c')]({'where':{'type':_0x115e02,'resourceId':_0x220886['id']}})[_0xf2c3('0x25')](function(){return _0x47bf05;});})[_0xf2c3('0x25')](function(){_0x35cf39[_0xf2c3('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ca666,_0x34f65d){return function(_0x314039){if(!_0x314039){_0x5ca666[_0xf2c3('0x3f')](0x194);}return _0x314039;};}function handleError(_0xcdca56,_0x5c4590){_0x5c4590=_0x5c4590||0x1f4;return function(_0x5c89dc){logger[_0xf2c3('0x2b')](_0x5c89dc[_0xf2c3('0x40')]);if(_0x5c89dc[_0xf2c3('0x41')]){delete _0x5c89dc[_0xf2c3('0x41')];}_0xcdca56[_0xf2c3('0x30')](_0x5c4590)['send'](_0x5c89dc);};}exports['index']=function(_0x5e7fb1,_0x45f501){var _0x2f4f66={'include':[{'model':db[_0xf2c3('0x42')],'as':'mandatoryDispositionPause'}]},_0x150514={},_0x954e3a={'count':0x0,'rows':[]};var _0x59f462=_['map'](db['ChatWebsite'][_0xf2c3('0x43')],function(_0x82c70c){return{'name':_0x82c70c[_0xf2c3('0x44')],'type':_0x82c70c[_0xf2c3('0x45')][_0xf2c3('0x46')]};});_0x150514[_0xf2c3('0x47')]=_['map'](_0x59f462,_0xf2c3('0x41'));_0x150514['query']=_['keys'](_0x5e7fb1['query']);_0x150514[_0xf2c3('0x48')]=_[_0xf2c3('0x49')](_0x150514[_0xf2c3('0x47')],_0x150514['query']);_0x2f4f66[_0xf2c3('0x4a')]=_['intersection'](_0x150514[_0xf2c3('0x47')],qs[_0xf2c3('0x4b')](_0x5e7fb1[_0xf2c3('0x4c')][_0xf2c3('0x4b')]));_0x2f4f66[_0xf2c3('0x4a')]=_0x2f4f66[_0xf2c3('0x4a')]['length']?_0x2f4f66[_0xf2c3('0x4a')]:_0x150514[_0xf2c3('0x47')];if(!_0x5e7fb1['query']['hasOwnProperty'](_0xf2c3('0x4d'))){_0x2f4f66[_0xf2c3('0x35')]=qs[_0xf2c3('0x35')](_0x5e7fb1[_0xf2c3('0x4c')][_0xf2c3('0x35')]);_0x2f4f66[_0xf2c3('0x34')]=qs['offset'](_0x5e7fb1[_0xf2c3('0x4c')][_0xf2c3('0x34')]);}_0x2f4f66[_0xf2c3('0x4e')]=qs[_0xf2c3('0x4f')](_0x5e7fb1['query'][_0xf2c3('0x4f')]);_0x2f4f66['where']=qs[_0xf2c3('0x48')](_[_0xf2c3('0x50')](_0x5e7fb1[_0xf2c3('0x4c')],_0x150514[_0xf2c3('0x48')]),_0x59f462);if(_0x5e7fb1[_0xf2c3('0x4c')]['filter']){_0x2f4f66[_0xf2c3('0x51')]=_['merge'](_0x2f4f66[_0xf2c3('0x51')],{'$or':_[_0xf2c3('0x52')](_0x59f462,function(_0x4a01ea){if(_0x4a01ea['type']!==_0xf2c3('0x53')){var _0x63811b={};_0x63811b[_0x4a01ea[_0xf2c3('0x41')]]={'$like':'%'+_0x5e7fb1[_0xf2c3('0x4c')][_0xf2c3('0x54')]+'%'};return _0x63811b;}})});}_0x2f4f66=_['merge']({},_0x2f4f66,_0x5e7fb1['options']);var _0x286b2f={'where':_0x2f4f66['where']};return db[_0xf2c3('0x55')][_0xf2c3('0x33')](_0x286b2f)[_0xf2c3('0x25')](function(_0x12eab1){_0x954e3a['count']=_0x12eab1;if(_0x5e7fb1[_0xf2c3('0x4c')]['includeAll']){_0x2f4f66['include']=[{'all':!![]}];}return db[_0xf2c3('0x55')]['findAll'](_0x2f4f66);})[_0xf2c3('0x25')](function(_0x971545){_0x954e3a['rows']=_0x971545;return _0x954e3a;})[_0xf2c3('0x25')](respondWithFilteredResult(_0x45f501,_0x2f4f66))[_0xf2c3('0x2f')](handleError(_0x45f501,null));};exports[_0xf2c3('0x56')]=function(_0x376c8b,_0x1cc70b){var _0x4577b8={'raw':![],'where':{'id':_0x376c8b[_0xf2c3('0x57')]['id']},'include':[{'model':db[_0xf2c3('0x42')],'as':_0xf2c3('0x58')}]},_0x2ca6f3={};_0x2ca6f3[_0xf2c3('0x47')]=_['keys'](db[_0xf2c3('0x55')][_0xf2c3('0x43')]);_0x2ca6f3[_0xf2c3('0x4c')]=_[_0xf2c3('0x59')](_0x376c8b[_0xf2c3('0x4c')]);_0x2ca6f3[_0xf2c3('0x48')]=_[_0xf2c3('0x49')](_0x2ca6f3['model'],_0x2ca6f3[_0xf2c3('0x4c')]);_0x4577b8[_0xf2c3('0x4a')]=_[_0xf2c3('0x49')](_0x2ca6f3[_0xf2c3('0x47')],qs[_0xf2c3('0x4b')](_0x376c8b[_0xf2c3('0x4c')]['fields']));_0x4577b8[_0xf2c3('0x4a')]=_0x4577b8[_0xf2c3('0x4a')][_0xf2c3('0x5a')]?_0x4577b8[_0xf2c3('0x4a')]:_0x2ca6f3[_0xf2c3('0x47')];if(_0x376c8b[_0xf2c3('0x4c')][_0xf2c3('0x5b')]){_0x4577b8[_0xf2c3('0x5c')]=[{'all':!![]}];}_0x4577b8=_[_0xf2c3('0x5d')]({},_0x4577b8,_0x376c8b['options']);return db[_0xf2c3('0x55')][_0xf2c3('0x5e')](_0x4577b8)[_0xf2c3('0x25')](handleEntityNotFound(_0x1cc70b,null))[_0xf2c3('0x25')](respondWithResult(_0x1cc70b,null))[_0xf2c3('0x2f')](handleError(_0x1cc70b,null));};exports[_0xf2c3('0x5f')]=function(_0x4549d6,_0x3763b6){return db[_0xf2c3('0x55')]['create'](_0x4549d6[_0xf2c3('0x60')],{})['then'](function(_0x39987d){var _0x37e8a5=_0x4549d6[_0xf2c3('0x61')]['get']({'plain':!![]});if(!_0x37e8a5)throw new Error(_0xf2c3('0x62'));if(_0x37e8a5[_0xf2c3('0x63')]==='user'){var _0x2615d9=_0x39987d[_0xf2c3('0x64')]({'plain':!![]});var _0x77171f='ChatWebsites';return db['UserProfileSection'][_0xf2c3('0x5e')]({'where':{'name':_0x77171f,'userProfileId':_0x37e8a5['userProfileId']},'raw':!![]})[_0xf2c3('0x25')](function(_0x3e6012){if(_0x3e6012&&_0x3e6012[_0xf2c3('0x65')]===0x0){return db[_0xf2c3('0x3e')][_0xf2c3('0x5f')]({'name':_0x2615d9[_0xf2c3('0x41')],'resourceId':_0x2615d9['id'],'type':_0x3e6012[_0xf2c3('0x41')],'sectionId':_0x3e6012['id']},{})['then'](function(){return _0x39987d;});}else{return _0x39987d;}})[_0xf2c3('0x2f')](function(_0x52f1c2){logger[_0xf2c3('0x2b')](_0xf2c3('0x66'),_0x52f1c2);throw _0x52f1c2;});}return _0x39987d;})[_0xf2c3('0x25')](respondWithResult(_0x3763b6,0xc9))[_0xf2c3('0x2f')](handleError(_0x3763b6,null));};exports[_0xf2c3('0x3b')]=function(_0x5ad064,_0x27a1b7){if(_0x5ad064[_0xf2c3('0x60')]['id']){delete _0x5ad064[_0xf2c3('0x60')]['id'];}return db['ChatWebsite'][_0xf2c3('0x5e')]({'where':{'id':_0x5ad064[_0xf2c3('0x57')]['id']},'include':[{'model':db[_0xf2c3('0x42')],'as':'mandatoryDispositionPause'}]})[_0xf2c3('0x25')](handleEntityNotFound(_0x27a1b7,null))['then'](saveUpdates(_0x5ad064['body'],null))[_0xf2c3('0x25')](respondWithResult(_0x27a1b7,null))[_0xf2c3('0x2f')](handleError(_0x27a1b7,null));};exports[_0xf2c3('0x3c')]=function(_0x307e7e,_0x51ae5f){return db['ChatWebsite'][_0xf2c3('0x5e')]({'where':{'id':_0x307e7e[_0xf2c3('0x57')]['id']}})['then'](handleEntityNotFound(_0x51ae5f,null))['then'](removeEntity(_0x51ae5f,null))['catch'](handleError(_0x51ae5f,null));};exports['describe']=function(_0x2863a5,_0x33942e){return db[_0xf2c3('0x55')][_0xf2c3('0x67')]()[_0xf2c3('0x25')](respondWithResult(_0x33942e,null))[_0xf2c3('0x2f')](handleError(_0x33942e,null));};exports[_0xf2c3('0x68')]=function(_0x361baa,_0x46f81b,_0xea5def){if(_0x361baa[_0xf2c3('0x60')]['id']){delete _0x361baa[_0xf2c3('0x60')]['id'];}return db[_0xf2c3('0x55')][_0xf2c3('0x5e')]({'where':{'id':_0x361baa[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x46f81b,null))[_0xf2c3('0x25')](function(_0x4a329d){if(_0x4a329d){_0x361baa[_0xf2c3('0x60')][_0xf2c3('0x69')]=_0x4a329d['id'];return db[_0xf2c3('0x6a')][_0xf2c3('0x5f')](_0x361baa[_0xf2c3('0x60')]);}})['then'](respondWithResult(_0x46f81b,null))[_0xf2c3('0x2f')](handleError(_0x46f81b,null));};exports[_0xf2c3('0x6b')]=function(_0x5c2856,_0x302caa,_0x13b38d){var _0x651df1={'raw':![],'where':{}};var _0x1eee51={};var _0x288a38={'count':0x0,'rows':[]};return db[_0xf2c3('0x55')][_0xf2c3('0x6c')]({'where':{'id':_0x5c2856[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x302caa,null))[_0xf2c3('0x25')](function(_0x328c1f){if(_0x328c1f){_0x1eee51[_0xf2c3('0x47')]=_[_0xf2c3('0x59')](db['Disposition']['rawAttributes']);_0x1eee51[_0xf2c3('0x4c')]=_[_0xf2c3('0x59')](_0x5c2856[_0xf2c3('0x4c')]);_0x1eee51['filters']=_['intersection'](_0x1eee51[_0xf2c3('0x47')],_0x1eee51['query']);_0x651df1[_0xf2c3('0x4a')]=_[_0xf2c3('0x49')](_0x1eee51[_0xf2c3('0x47')],qs[_0xf2c3('0x4b')](_0x5c2856[_0xf2c3('0x4c')][_0xf2c3('0x4b')]));_0x651df1['attributes']=_0x651df1['attributes'][_0xf2c3('0x5a')]?_0x651df1[_0xf2c3('0x4a')]:_0x1eee51[_0xf2c3('0x47')];if(!_0x5c2856[_0xf2c3('0x4c')][_0xf2c3('0x6d')](_0xf2c3('0x4d'))){_0x651df1[_0xf2c3('0x35')]=qs['limit'](_0x5c2856[_0xf2c3('0x4c')][_0xf2c3('0x35')]);_0x651df1[_0xf2c3('0x34')]=qs[_0xf2c3('0x34')](_0x5c2856[_0xf2c3('0x4c')][_0xf2c3('0x34')]);}_0x651df1['order']=qs['sort'](_0x5c2856[_0xf2c3('0x4c')][_0xf2c3('0x4f')]);_0x651df1[_0xf2c3('0x51')]=qs['filters'](_['pick'](_0x5c2856[_0xf2c3('0x4c')],_0x1eee51[_0xf2c3('0x48')]));_0x651df1[_0xf2c3('0x51')]['ChatWebsiteId']=_0x328c1f['id'];if(_0x5c2856['query']['filter']){_0x651df1[_0xf2c3('0x51')]=_['merge'](_0x651df1[_0xf2c3('0x51')],{'$or':_[_0xf2c3('0x52')](_0x651df1[_0xf2c3('0x4a')],function(_0x587027){var _0x20a6ee={};_0x20a6ee[_0x587027]={'$like':'%'+_0x5c2856[_0xf2c3('0x4c')][_0xf2c3('0x54')]+'%'};return _0x20a6ee;})});}_0x651df1=_[_0xf2c3('0x5d')]({},_0x651df1,_0x5c2856['options']);return db['Disposition']['count']({'where':_0x651df1['where']})['then'](function(_0x452f84){_0x288a38[_0xf2c3('0x33')]=_0x452f84;if(_0x5c2856[_0xf2c3('0x4c')][_0xf2c3('0x5b')]){_0x651df1[_0xf2c3('0x5c')]=[{'all':!![]}];}return db[_0xf2c3('0x6a')]['findAll'](_0x651df1);})[_0xf2c3('0x25')](function(_0x56e89c){_0x288a38['rows']=_0x56e89c;return _0x288a38;});}})[_0xf2c3('0x25')](respondWithFilteredResult(_0x302caa,_0x651df1))[_0xf2c3('0x2f')](handleError(_0x302caa,null));};exports[_0xf2c3('0x6e')]=function(_0x1850db,_0x5115dc,_0x55f98e){return db[_0xf2c3('0x55')][_0xf2c3('0x5e')]({'where':{'id':_0x1850db[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x5115dc,null))[_0xf2c3('0x25')](function(_0x113253){if(_0x113253){return _0x113253[_0xf2c3('0x6e')](_0x1850db['query'][_0xf2c3('0x6f')]);}})[_0xf2c3('0x25')](respondWithStatusCode(_0x5115dc,null))[_0xf2c3('0x2f')](handleError(_0x5115dc,null));};exports[_0xf2c3('0x70')]=function(_0x595864,_0x2a7b3a,_0x4dc024){if(_0x595864[_0xf2c3('0x60')]['id']){delete _0x595864[_0xf2c3('0x60')]['id'];}return db[_0xf2c3('0x55')]['find']({'where':{'id':_0x595864[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x2a7b3a,null))[_0xf2c3('0x25')](function(_0x249935){if(_0x249935){_0x595864['body'][_0xf2c3('0x69')]=_0x249935['id'];return db['CannedAnswer'][_0xf2c3('0x5f')](_0x595864[_0xf2c3('0x60')]);}})[_0xf2c3('0x25')](respondWithResult(_0x2a7b3a,null))[_0xf2c3('0x2f')](handleError(_0x2a7b3a,null));};exports[_0xf2c3('0x71')]=function(_0x10daab,_0x5e55d6,_0x762ea5){var _0x4d3334={'raw':![],'where':{}};var _0x437069={};var _0x4e0eba={'count':0x0,'rows':[]};return db[_0xf2c3('0x55')]['findOne']({'where':{'id':_0x10daab['params']['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x5e55d6,null))['then'](function(_0x5b9fe4){if(_0x5b9fe4){_0x437069['model']=_['keys'](db['CannedAnswer'][_0xf2c3('0x43')]);_0x437069[_0xf2c3('0x4c')]=_['keys'](_0x10daab[_0xf2c3('0x4c')]);_0x437069[_0xf2c3('0x48')]=_['intersection'](_0x437069[_0xf2c3('0x47')],_0x437069[_0xf2c3('0x4c')]);_0x4d3334[_0xf2c3('0x4a')]=_[_0xf2c3('0x49')](_0x437069[_0xf2c3('0x47')],qs[_0xf2c3('0x4b')](_0x10daab[_0xf2c3('0x4c')][_0xf2c3('0x4b')]));_0x4d3334[_0xf2c3('0x4a')]=_0x4d3334[_0xf2c3('0x4a')][_0xf2c3('0x5a')]?_0x4d3334[_0xf2c3('0x4a')]:_0x437069[_0xf2c3('0x47')];if(!_0x10daab[_0xf2c3('0x4c')][_0xf2c3('0x6d')](_0xf2c3('0x4d'))){_0x4d3334[_0xf2c3('0x35')]=qs[_0xf2c3('0x35')](_0x10daab['query'][_0xf2c3('0x35')]);_0x4d3334[_0xf2c3('0x34')]=qs['offset'](_0x10daab[_0xf2c3('0x4c')][_0xf2c3('0x34')]);}_0x4d3334[_0xf2c3('0x4e')]=qs[_0xf2c3('0x4f')](_0x10daab[_0xf2c3('0x4c')][_0xf2c3('0x4f')]);_0x4d3334[_0xf2c3('0x51')]=qs[_0xf2c3('0x48')](_[_0xf2c3('0x50')](_0x10daab[_0xf2c3('0x4c')],_0x437069[_0xf2c3('0x48')]));_0x4d3334[_0xf2c3('0x51')][_0xf2c3('0x69')]=_0x5b9fe4['id'];if(_0x10daab[_0xf2c3('0x4c')][_0xf2c3('0x54')]){_0x4d3334[_0xf2c3('0x51')]=_[_0xf2c3('0x5d')](_0x4d3334[_0xf2c3('0x51')],{'$or':_[_0xf2c3('0x52')](_0x4d3334[_0xf2c3('0x4a')],function(_0x1c14ff){var _0x2b516d={};_0x2b516d[_0x1c14ff]={'$like':'%'+_0x10daab['query'][_0xf2c3('0x54')]+'%'};return _0x2b516d;})});}_0x4d3334=_[_0xf2c3('0x5d')]({},_0x4d3334,_0x10daab['options']);return db[_0xf2c3('0x72')][_0xf2c3('0x33')]({'where':_0x4d3334['where']})[_0xf2c3('0x25')](function(_0x2b39aa){_0x4e0eba['count']=_0x2b39aa;if(_0x10daab[_0xf2c3('0x4c')][_0xf2c3('0x5b')]){_0x4d3334[_0xf2c3('0x5c')]=[{'all':!![]}];}return db[_0xf2c3('0x72')][_0xf2c3('0x73')](_0x4d3334);})[_0xf2c3('0x25')](function(_0x146281){_0x4e0eba[_0xf2c3('0x74')]=_0x146281;return _0x4e0eba;});}})['then'](respondWithFilteredResult(_0x5e55d6,_0x4d3334))[_0xf2c3('0x2f')](handleError(_0x5e55d6,null));};exports[_0xf2c3('0x75')]=function(_0x3e8257,_0x2d3ad1,_0x2240b7){return db['ChatWebsite'][_0xf2c3('0x5e')]({'where':{'id':_0x3e8257[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x2d3ad1,null))[_0xf2c3('0x25')](function(_0x1775e4){if(_0x1775e4){return _0x1775e4[_0xf2c3('0x75')](_0x3e8257[_0xf2c3('0x4c')][_0xf2c3('0x6f')]);}})[_0xf2c3('0x25')](respondWithStatusCode(_0x2d3ad1,null))['catch'](handleError(_0x2d3ad1,null));};exports[_0xf2c3('0x76')]=function(_0x3d8c7f,_0x49ce19,_0x2ebf1c){_0x3d8c7f[_0xf2c3('0x60')][_0xf2c3('0x77')]=_0x3d8c7f[_0xf2c3('0x78')][_0xf2c3('0x79')];return db[_0xf2c3('0x55')]['find']({'where':{'id':_0x3d8c7f[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x49ce19,null))[_0xf2c3('0x25')](saveUpdates(_0x3d8c7f[_0xf2c3('0x60')],null))[_0xf2c3('0x25')](respondWithResult(_0x49ce19,null))[_0xf2c3('0x2f')](handleError(_0x49ce19,null));};exports[_0xf2c3('0x7a')]=function(_0x968cc9,_0x20a95e,_0x3c4af6){_0x968cc9[_0xf2c3('0x60')][_0xf2c3('0x7b')]=_0x968cc9['file'][_0xf2c3('0x79')];return db['ChatWebsite']['find']({'where':{'id':_0x968cc9[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x20a95e,null))['then'](saveUpdates(_0x968cc9[_0xf2c3('0x60')],null))['then'](respondWithResult(_0x20a95e,null))[_0xf2c3('0x2f')](handleError(_0x20a95e,null));};exports[_0xf2c3('0x7c')]=function(_0x3cd7a0,_0x43e356,_0x4fe647){_0x3cd7a0[_0xf2c3('0x60')][_0xf2c3('0x7d')]=_0x3cd7a0[_0xf2c3('0x78')][_0xf2c3('0x79')];return db[_0xf2c3('0x55')][_0xf2c3('0x5e')]({'where':{'id':_0x3cd7a0[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x43e356,null))['then'](saveUpdates(_0x3cd7a0[_0xf2c3('0x60')],null))[_0xf2c3('0x25')](respondWithResult(_0x43e356,null))[_0xf2c3('0x2f')](handleError(_0x43e356,null));};exports[_0xf2c3('0x7e')]=function(_0x45e99a,_0x542ef5,_0x6b0348){_0x45e99a[_0xf2c3('0x60')][_0xf2c3('0x7f')]=_0x45e99a['file'][_0xf2c3('0x79')];return db[_0xf2c3('0x55')]['find']({'where':{'id':_0x45e99a[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x542ef5,null))[_0xf2c3('0x25')](saveUpdates(_0x45e99a[_0xf2c3('0x60')],null))[_0xf2c3('0x25')](respondWithResult(_0x542ef5,null))['catch'](handleError(_0x542ef5,null));};exports['getLogo']=function(_0x4947ca,_0x3b5bee,_0x96463d){var _0x148033=path[_0xf2c3('0x80')](config['root'],_0xf2c3('0x81'));var _0x402b92={'where':{'id':_0x4947ca[_0xf2c3('0x57')]['id']},'attributes':['id',_0xf2c3('0x77')],'raw':!![]};var _0x53ea2d=![];return require(_0xf2c3('0x82'))['getLicense']()[_0xf2c3('0x25')](function(_0xb33248){if(_0xb33248){_0x53ea2d=_0xb33248[_0xf2c3('0x83')];}})[_0xf2c3('0x25')](function(){return db[_0xf2c3('0x55')][_0xf2c3('0x5e')](_0x402b92);})['then'](handleEntityNotFound(_0x3b5bee,null))[_0xf2c3('0x25')](function(_0x266587){if(_0x266587){if(!_[_0xf2c3('0x84')](_0x266587[_0xf2c3('0x77')])){if(fs[_0xf2c3('0x85')](path[_0xf2c3('0x80')](config[_0xf2c3('0x86')],'server/files/images/logos/',_0x266587[_0xf2c3('0x77')]))&&_0x53ea2d){_0x148033=path['join'](config[_0xf2c3('0x86')],'server/files/images/logos/',_0x266587[_0xf2c3('0x77')]);}}return _0x3b5bee[_0xf2c3('0x87')](_0x148033);}})[_0xf2c3('0x2f')](handleError(_0x3b5bee,null));};exports[_0xf2c3('0x88')]=function(_0x239440,_0x58acec,_0x114a52){var _0x17752c=path[_0xf2c3('0x80')](config[_0xf2c3('0x86')],_0xf2c3('0x89'));var _0x56f493={'where':{'id':_0x239440['params']['id']},'attributes':['id',_0xf2c3('0x7b')],'raw':!![]};return db['ChatWebsite']['find'](_0x56f493)['then'](handleEntityNotFound(_0x58acec,null))[_0xf2c3('0x25')](function(_0xd4a0b8){if(_0xd4a0b8){if(!_['isNil'](_0xd4a0b8['agentAvatar'])){if(fs[_0xf2c3('0x85')](path[_0xf2c3('0x80')](config[_0xf2c3('0x86')],_0xf2c3('0x8a'),_0xd4a0b8[_0xf2c3('0x7b')]))){_0x17752c=path[_0xf2c3('0x80')](config[_0xf2c3('0x86')],_0xf2c3('0x8a'),_0xd4a0b8[_0xf2c3('0x7b')]);}}return _0x58acec[_0xf2c3('0x87')](_0x17752c);}})['catch'](handleError(_0x58acec,null));};exports[_0xf2c3('0x8b')]=function(_0x1e4337,_0x76ec35,_0x4f30fc){var _0x1c6905=path[_0xf2c3('0x80')](config[_0xf2c3('0x86')],_0xf2c3('0x8c'));var _0xb5302e={'where':{'id':_0x1e4337[_0xf2c3('0x57')]['id']},'attributes':['id',_0xf2c3('0x7d'),_0xf2c3('0x8d')],'raw':!![]};return db['ChatWebsite']['find'](_0xb5302e)['then'](handleEntityNotFound(_0x76ec35,null))['then'](function(_0xbe9b0d){if(_0xbe9b0d){if(!_[_0xf2c3('0x84')](_0xbe9b0d[_0xf2c3('0x7d')])){if(fs[_0xf2c3('0x85')](path[_0xf2c3('0x80')](config[_0xf2c3('0x86')],_0xf2c3('0x8a'),_0xbe9b0d[_0xf2c3('0x7d')]))&&_0xbe9b0d['showCustomerAvatar']){_0x1c6905=path[_0xf2c3('0x80')](config['root'],'server/files/images/avatars/',_0xbe9b0d[_0xf2c3('0x7d')]);}}return _0x76ec35[_0xf2c3('0x87')](_0x1c6905);}})[_0xf2c3('0x2f')](handleError(_0x76ec35,null));};exports[_0xf2c3('0x8e')]=function(_0x31faee,_0x44db94,_0x24357a){var _0x59ea7c=path[_0xf2c3('0x80')](config[_0xf2c3('0x86')],_0xf2c3('0x8f'));var _0x8db678={'where':{'id':_0x31faee[_0xf2c3('0x57')]['id']},'attributes':['id',_0xf2c3('0x7f')],'raw':!![]};return db[_0xf2c3('0x55')]['find'](_0x8db678)[_0xf2c3('0x25')](handleEntityNotFound(_0x44db94,null))[_0xf2c3('0x25')](function(_0x47c435){if(_0x47c435){if(!_['isNil'](_0x47c435[_0xf2c3('0x7f')])){if(fs[_0xf2c3('0x85')](path[_0xf2c3('0x80')](config[_0xf2c3('0x86')],_0xf2c3('0x8a'),_0x47c435[_0xf2c3('0x7f')]))){_0x59ea7c=path[_0xf2c3('0x80')](config[_0xf2c3('0x86')],_0xf2c3('0x8a'),_0x47c435[_0xf2c3('0x7f')]);}}return _0x44db94[_0xf2c3('0x87')](_0x59ea7c);}})[_0xf2c3('0x2f')](handleError(_0x44db94,null));};exports[_0xf2c3('0x90')]=function(_0x556319,_0x51b8e7,_0x186f41){var _0x3ae592=require(_0xf2c3('0x91'));var _0x17098e=new _0x3ae592();var _0x358e39=_0x17098e['setUA'](_0x556319[_0xf2c3('0x92')][_0xf2c3('0x93')])[_0xf2c3('0x94')]();var _0x2e4efc={'body':_0x556319[_0xf2c3('0x60')],'channel':'chat'};var _0x1ad3a9=[];var _0x287bc9=[];var _0x2401a8={};var _0x14d5f0=![];return db[_0xf2c3('0x95')][_0xf2c3('0x67')]()[_0xf2c3('0x25')](function(_0x288576){if(!_0x288576){throw new db[(_0xf2c3('0x21'))][(_0xf2c3('0x22'))]('no\x20available\x20attributes');}_0x1ad3a9=_[_0xf2c3('0x96')](_[_0xf2c3('0x59')](_0x288576),['createdAt','updatedAt']);_0x287bc9=_['difference'](_[_0xf2c3('0x59')](_0x288576),[_0xf2c3('0x97'),_0xf2c3('0x98'),'CompanyId',_0xf2c3('0x99')]);if(_0x556319['body']['id']){delete _0x556319[_0xf2c3('0x60')]['id'];}if(_[_0xf2c3('0x84')](_0x556319['body'][_0xf2c3('0x9a')])){throw new db[(_0xf2c3('0x21'))][(_0xf2c3('0x22'))]('from\x20is\x20mandatory');}if(_[_0xf2c3('0x84')](_0x556319[_0xf2c3('0x60')][_0xf2c3('0x60')])||_0x556319[_0xf2c3('0x60')]['body']===''){throw new db[(_0xf2c3('0x21'))]['ValidationError'](_0xf2c3('0x9b'));}if(_[_0xf2c3('0x84')](_0x556319['body'][_0xf2c3('0x9c')])){throw new db[(_0xf2c3('0x21'))][(_0xf2c3('0x22'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x287bc9);}if(!_[_0xf2c3('0x9d')](_0x287bc9,_0x556319[_0xf2c3('0x60')][_0xf2c3('0x9c')])){throw new db[(_0xf2c3('0x21'))][(_0xf2c3('0x22'))](_0xf2c3('0x9e')+_0x287bc9);}_0x2401a8[_0x556319[_0xf2c3('0x60')]['mapKey']]=_0x556319[_0xf2c3('0x60')][_0xf2c3('0x9a')];})[_0xf2c3('0x25')](function(){return db['ChatWebsite'][_0xf2c3('0x5e')]({'where':{'id':_0x556319[_0xf2c3('0x57')]['id']},'include':[{'model':db[_0xf2c3('0x9f')],'as':_0xf2c3('0xa0'),'include':[{'model':db[_0xf2c3('0x95')],'as':_0xf2c3('0xa1'),'where':_0x2401a8,'limit':0x1,'order':[[_0xf2c3('0x98'),_0xf2c3('0xa2')]]}]},{'model':db[_0xf2c3('0xa3')],'as':_0xf2c3('0xa4')}]});})[_0xf2c3('0x25')](handleEntityNotFound(_0x51b8e7,null))[_0xf2c3('0x25')](function(_0x1107db){if(_0x1107db&&_0x1107db[_0xf2c3('0xa0')]){_0x2e4efc[_0xf2c3('0xa5')]=_0x1107db;_0x2e4efc[_0xf2c3('0xa6')]=_0x1107db[_0xf2c3('0xa4')];_0x2e4efc[_0xf2c3('0xa7')]=_0x1107db[_0xf2c3('0xa0')];_0x2e4efc[_0xf2c3('0xa6')]=_['orderBy'](_0x2e4efc['applications'],[_0xf2c3('0xa8')],['asc']);if(_0x2e4efc['account'][_0xf2c3('0xa4')]){delete _0x2e4efc[_0xf2c3('0xa5')]['Applications'];}if(_0x2e4efc[_0xf2c3('0xa5')][_0xf2c3('0xa0')]&&_0x2e4efc['account']['List']['Contacts'][_0xf2c3('0x5a')]){return _0x2e4efc[_0xf2c3('0xa5')][_0xf2c3('0xa0')][_0xf2c3('0xa1')][0x0];}var _0x5a0a6f=_[_0xf2c3('0x1a')](_0x556319[_0xf2c3('0x60')],{'firstName':_0x556319[_0xf2c3('0x60')]['from'],'ListId':_0x1107db[_0xf2c3('0x99')]});_0x5a0a6f[_0x556319['body'][_0xf2c3('0x9c')]]=_0x556319[_0xf2c3('0x60')][_0xf2c3('0x9a')];return db[_0xf2c3('0x95')]['create'](_0x5a0a6f,{'fields':_0x1ad3a9,'raw':!![]});}})[_0xf2c3('0x25')](handleEntityNotFound(_0x51b8e7,null))[_0xf2c3('0x25')](function(_0x5c8551){_0x2e4efc['contact']=_0x5c8551;var _0x40a1dd=_0x556319[_0xf2c3('0x60')][_0xf2c3('0xa9')];if(_0x556319['headers'][_0xf2c3('0xaa')]){_0x40a1dd=_0x556319[_0xf2c3('0x92')][_0xf2c3('0xaa')];}else if(_0x556319['headers'][_0xf2c3('0xab')]){_0x40a1dd=_[_0xf2c3('0xac')](_0x556319[_0xf2c3('0x92')][_0xf2c3('0xab')][_0xf2c3('0xad')](','));}if(_0x5c8551){var _0x549603={'ContactId':_0x5c8551['id'],'ChatWebsiteId':_0x556319[_0xf2c3('0x57')]['id'],'from':(_0x5c8551[_0xf2c3('0xae')]||'')+'\x20'+(_0x5c8551['lastName']||''),'customerIp':_0x40a1dd,'customerPort':_0x556319[_0xf2c3('0x92')][_0xf2c3('0xaf')]?_0x556319[_0xf2c3('0x92')]['x-real-port']:null,'referer':_0x556319['body'][_0xf2c3('0xb0')],'browserName':_0x358e39[_0xf2c3('0xb1')][_0xf2c3('0x41')]&&_0x358e39[_0xf2c3('0xb1')][_0xf2c3('0xb2')]?util['format'](_0xf2c3('0xb3'),_0x358e39[_0xf2c3('0xb1')][_0xf2c3('0x41')],_0x358e39[_0xf2c3('0xb1')]['version']):'unknown','browserVersion':_0x358e39[_0xf2c3('0xb1')]['version']||_0xf2c3('0xb4'),'osName':util[_0xf2c3('0xb5')]('%s\x20%s',_0x358e39['os']['name'],_0x358e39['os'][_0xf2c3('0xb2')]),'osVersion':_0x358e39['os']['version'],'deviceModel':_0x358e39[_0xf2c3('0xb6')][_0xf2c3('0x47')]&&_0x358e39[_0xf2c3('0xb6')][_0xf2c3('0xb7')]?util[_0xf2c3('0xb5')](_0xf2c3('0xb8'),_0x358e39[_0xf2c3('0xb6')][_0xf2c3('0x47')],_0x358e39[_0xf2c3('0xb6')][_0xf2c3('0xb7')],_0x358e39[_0xf2c3('0xb6')][_0xf2c3('0x45')]):null,'deviceVendor':_0x358e39[_0xf2c3('0xb6')][_0xf2c3('0xb7')],'deviceType':_0x358e39['device']['type'],'formData':JSON['stringify'](_0x556319['body'])};var _0x42bb52={'ChatWebsiteId':_0x556319[_0xf2c3('0x57')]['id'],'closed':![]};if(_0x556319[_0xf2c3('0x60')][_0xf2c3('0xb9')]){_0x42bb52[_0xf2c3('0xb9')]=_0x556319[_0xf2c3('0x60')]['threadId'];return db[_0xf2c3('0xba')][_0xf2c3('0x5e')]({'where':_0x42bb52})[_0xf2c3('0x25')](function(_0x39c2ac){if(_0x39c2ac){return[_0x39c2ac,![]];}_0x549603[_0xf2c3('0xb9')]=_0x556319[_0xf2c3('0x60')]['threadId'];_0x549603[_0xf2c3('0xbb')]=_0x556319[_0xf2c3('0x60')]['externalUrl'];return db[_0xf2c3('0xba')][_0xf2c3('0x5f')](_0x549603)['then'](function(_0x50679d){return[_0x50679d,!![]];});});}_0x42bb52[_0xf2c3('0xbc')]=_0x5c8551['id'];if(_0x556319['body']['interaction']&&_0x556319[_0xf2c3('0x60')]['interaction']['id']){_0x42bb52['id']=_0x556319[_0xf2c3('0x60')]['interaction']['id'];return db['ChatInteraction']['find']({'where':_0x42bb52})['then'](function(_0x4caef2){if(_0x4caef2){return[_0x4caef2,![]];}return db[_0xf2c3('0xba')][_0xf2c3('0x5f')](_0x549603)[_0xf2c3('0x25')](function(_0x40838f){return[_0x40838f,!![]];});});}return db['ChatInteraction'][_0xf2c3('0x5f')](_0x549603)['then'](function(_0x1a31ba){return[_0x1a31ba,!![]];});}})[_0xf2c3('0xbd')](function(_0x71fcc2,_0x198660){if(_0x71fcc2){_0x14d5f0=_0x198660;if(!_0x198660){var _0x57c0d0={'from':(_0x2e4efc[_0xf2c3('0xbe')][_0xf2c3('0xae')]||'')+'\x20'+(_0x2e4efc[_0xf2c3('0xbe')][_0xf2c3('0xbf')]||'')};if(_0x556319['body'][_0xf2c3('0xb9')]&&_0x556319[_0xf2c3('0x60')][_0xf2c3('0xc0')]&&_0x556319[_0xf2c3('0x60')]['threadId']!=_0x556319[_0xf2c3('0x60')]['messageId']){_0x57c0d0[_0xf2c3('0xb9')]=_0x556319[_0xf2c3('0x60')][_0xf2c3('0xc0')];}return _0x71fcc2[_0xf2c3('0x3b')](_0x57c0d0);}else{return _0x71fcc2;}}})[_0xf2c3('0x25')](function(_0xf0285d){_0x2e4efc[_0xf2c3('0xc1')]=_0xf0285d[_0xf2c3('0x64')]({'plain':!![]});_0x2e4efc[_0xf2c3('0xc1')]['created']=_0x14d5f0;if(_0x2e4efc[_0xf2c3('0xc1')][_0xf2c3('0xc2')]){if(_0x2e4efc['account'][_0xf2c3('0xc3')]){_0x2e4efc[_0xf2c3('0xa6')][_0xf2c3('0xc4')]({'id':0x0,'priority':_0x2e4efc['applications']['length']+0x1,'app':_0xf2c3('0xc5'),'appdata':_0xf2c3('0xc6'),'interval':_0xf2c3('0xc7')});}}return db[_0xf2c3('0xc8')]['create']({'body':_0x556319[_0xf2c3('0x60')][_0xf2c3('0x60')],'ChatWebsiteId':_0x556319[_0xf2c3('0x57')]['id'],'ChatInteractionId':_0xf0285d['id'],'direction':'in','ContactId':_0x2e4efc[_0xf2c3('0xbe')]['id'],'AttachmentId':_0x556319[_0xf2c3('0x60')]['AttachmentId']});})['then'](function(_0x28041b){_0x2e4efc[_0xf2c3('0x2d')]=_0x28041b;if(_0x2e4efc[_0xf2c3('0xc1')][_0xf2c3('0xc9')]){return db[_0xf2c3('0xca')][_0xf2c3('0x5e')]({'attributes':['id','name'],'where':{'id':_0x2e4efc[_0xf2c3('0xc1')][_0xf2c3('0xc9')]}})[_0xf2c3('0x25')](function(_0x4241e8){if(_0x4241e8){_0x2e4efc[_0xf2c3('0xa6')][_0xf2c3('0xcb')]({'id':0x0,'priority':0x0,'app':_0xf2c3('0xcc'),'appdata':_0x4241e8[_0xf2c3('0x41')]+','+(_0x2e4efc['account']['waitForTheAssignedAgent']||0xa),'interval':_0xf2c3('0xc7')});_0x2e4efc[_0xf2c3('0xcd')]=!![];}return respondWithRpcPromise('Start',_0xf2c3('0xce'),_0x2e4efc);});}return respondWithRpcPromise(_0xf2c3('0xcf'),_0xf2c3('0xce'),_0x2e4efc);})['then'](function(_0x37113f){respondWithRpcPromise(_0xf2c3('0xd0'),_0xf2c3('0xd0'),{'event':_0xf2c3('0x90'),'message':_0x37113f},client9002);return _0x37113f;})['then'](respondWithResult(_0x51b8e7,null))[_0xf2c3('0x2f')](handleError(_0x51b8e7,null));};exports['offline']=function(_0x41146a,_0x36df3c,_0x2b4f21){var _0x352125,_0x1e9394,_0x43ac2b;var _0x34f76d=[];var _0x84b324=[];var _0x824411={};return db['CmContact']['describe']()['then'](function(_0x5e73fa){if(!_0x5e73fa){throw new db['Sequelize'][(_0xf2c3('0x22'))]('no\x20available\x20attributes');}_0x84b324=_[_0xf2c3('0x96')](_[_0xf2c3('0x59')](_0x5e73fa),[_0xf2c3('0x97'),'updatedAt']);_0x34f76d=_[_0xf2c3('0x96')](_[_0xf2c3('0x59')](_0x5e73fa),[_0xf2c3('0x97'),'updatedAt','CompanyId',_0xf2c3('0x99')]);if(_0x41146a[_0xf2c3('0x60')]['id']){delete _0x41146a[_0xf2c3('0x60')]['id'];}if(_[_0xf2c3('0x84')](_0x41146a[_0xf2c3('0x60')][_0xf2c3('0x9a')])){throw _0x36df3c[_0xf2c3('0x30')](0x1f4)['send'](new db[(_0xf2c3('0x21'))][(_0xf2c3('0x22'))](_0xf2c3('0xd1')));}if(_[_0xf2c3('0x84')](_0x41146a[_0xf2c3('0x60')]['body'])||_0x41146a[_0xf2c3('0x60')]['body']===''){throw _0x36df3c['status'](0x1f4)[_0xf2c3('0xd2')](new db[(_0xf2c3('0x21'))]['ValidationError'](_0xf2c3('0x9b')));}if(_[_0xf2c3('0x84')](_0x41146a[_0xf2c3('0x60')][_0xf2c3('0xd3')])){throw _0x36df3c['status'](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0xf2c3('0xd4')+_0x34f76d));}if(!_[_0xf2c3('0x9d')](_0x34f76d,_0x41146a[_0xf2c3('0x60')][_0xf2c3('0xd3')])){throw _0x36df3c['status'](0x1f4)['send'](new db[(_0xf2c3('0x21'))][(_0xf2c3('0x22'))](_0xf2c3('0xd5')+_0x34f76d));}_0x824411[_0x41146a[_0xf2c3('0x60')][_0xf2c3('0xd3')]]=_0x41146a[_0xf2c3('0x60')][_0xf2c3('0x9a')];})['then'](function(){return db[_0xf2c3('0x55')]['find']({'where':{'id':_0x41146a[_0xf2c3('0x57')]['id']},'include':[{'model':db[_0xf2c3('0x9f')],'as':'List'}]});})['then'](handleEntityNotFound(_0x36df3c,null))[_0xf2c3('0x25')](function(_0x185106){if(_0x185106&&_0x185106[_0xf2c3('0xa0')]){_0x1e9394=_0x185106;var _0x42d385=_['defaults'](_0x41146a[_0xf2c3('0x60')],{'firstName':_0x41146a[_0xf2c3('0x60')]['from'],'phone':_0x41146a[_0xf2c3('0x60')][_0xf2c3('0x9a')],'ListId':_0x185106[_0xf2c3('0x99')]});_0x42d385[_0x41146a['body'][_0xf2c3('0xd3')]]=_0x41146a['body']['from'];return db[_0xf2c3('0x95')][_0xf2c3('0xd6')]({'where':_0x824411,'defaults':_0x42d385});}})['spread'](function(_0x215b8b){if(_0x215b8b){_0x43ac2b=_0x215b8b;var _0x20e34b=fs['readFileSync'](path[_0xf2c3('0x80')](config[_0xf2c3('0x86')],_0xf2c3('0xd7')),_0xf2c3('0xd8'));var _0x2ac100=ejs[_0xf2c3('0xd9')](_0x20e34b,{'body':_[_0xf2c3('0xda')](_0x41146a[_0xf2c3('0x60')][_0xf2c3('0x60')]),'bodyTitle':_0x1e9394['offlineMessageBody']});return db[_0xf2c3('0xdb')]['create']({'body':_0x2ac100,'ContactId':_0x215b8b['id'],'ChatWebsiteId':_0x1e9394['id']});}})[_0xf2c3('0x25')](function(_0x28016a){if(_0x28016a){_0x352125=_0x28016a;return db[_0xf2c3('0xdc')][_0xf2c3('0x6c')]({'where':{'service':!![]},'include':[{'model':db[_0xf2c3('0xdd')],'as':'Smtp','raw':!![]}]});}})[_0xf2c3('0x25')](function(_0xd80354){if(_0xd80354&&_0xd80354[_0xf2c3('0xde')]&&_0x1e9394['forwardOfflineAddress']){var _0x1b6828={'tls':{'rejectUnauthorized':![]}};if(_0xd80354[_0xf2c3('0xde')][_0xf2c3('0xdf')]){_0x1b6828[_0xf2c3('0xdf')]=_0xd80354['Smtp']['service'];}else{_0x1b6828[_0xf2c3('0xe0')]=_0xd80354[_0xf2c3('0xde')][_0xf2c3('0xe0')];_0x1b6828[_0xf2c3('0xe1')]=_0xd80354[_0xf2c3('0xde')][_0xf2c3('0xe1')];_0x1b6828[_0xf2c3('0xe2')]=_0xd80354['Smtp'][_0xf2c3('0xe2')];}if(_0xd80354['Smtp'][_0xf2c3('0xe3')]){_0x1b6828['auth']={'user':_0xd80354[_0xf2c3('0xde')][_0xf2c3('0x61')],'pass':_0xd80354[_0xf2c3('0xde')][_0xf2c3('0xe4')]};}return respondWithRpcPromise(_0xf2c3('0xe5'),_0xf2c3('0xe6'),{'account':_0x1b6828,'message':{'from':util['format'](_0xf2c3('0xe7'),_0xd80354['name'],_0xd80354[_0xf2c3('0xe8')]||_0xd80354[_0xf2c3('0xde')][_0xf2c3('0x61')]),'to':_0x1e9394[_0xf2c3('0xe9')],'subject':_0x1e9394[_0xf2c3('0xea')],'text':_0x352125[_0xf2c3('0x60')]}},client9003)[_0xf2c3('0x25')](function(){return _0x352125;})[_0xf2c3('0x2f')](function(_0x50ea25){console[_0xf2c3('0x2b')](_0x50ea25);});}})[_0xf2c3('0x25')](function(){if(_0x352125){return _0x352125;}})[_0xf2c3('0x25')](respondWithResult(_0x36df3c,null))[_0xf2c3('0x2f')](handleError(_0x36df3c,null));};exports[_0xf2c3('0xeb')]=function(_0x15f722,_0x3e3b5d,_0xf563cc){return db[_0xf2c3('0xba')][_0xf2c3('0x5e')]({'where':{'id':_0x15f722[_0xf2c3('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e3b5d,null))[_0xf2c3('0x25')](function(_0x78566){if(_0x78566){return _0x78566[_0xf2c3('0xeb')](_0x15f722['body'][_0xf2c3('0x6f')],_[_0xf2c3('0xec')](_0x15f722[_0xf2c3('0x60')],[_0xf2c3('0x6f'),'id'])||{});}})[_0xf2c3('0x25')](respondWithResult(_0x3e3b5d,null))[_0xf2c3('0x2f')](handleError(_0x3e3b5d,null));};exports[_0xf2c3('0xed')]=function(_0x3b9545,_0x21459e,_0x3cc4db){var _0x44875e={'raw':![],'where':{}};var _0x56ae3c={};var _0x546620={'count':0x0,'rows':[]};return db[_0xf2c3('0x55')][_0xf2c3('0x6c')]({'where':{'id':_0x3b9545[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x21459e,null))[_0xf2c3('0x25')](function(_0x55bc3c){if(_0x55bc3c){_0x56ae3c[_0xf2c3('0x47')]=_[_0xf2c3('0x59')](db['ChatInteraction'][_0xf2c3('0x43')]);_0x56ae3c[_0xf2c3('0x4c')]=_[_0xf2c3('0x59')](_0x3b9545[_0xf2c3('0x4c')]);_0x56ae3c[_0xf2c3('0x48')]=_[_0xf2c3('0x49')](_0x56ae3c[_0xf2c3('0x47')],_0x56ae3c[_0xf2c3('0x4c')]);_0x44875e[_0xf2c3('0x4a')]=_['intersection'](_0x56ae3c[_0xf2c3('0x47')],qs[_0xf2c3('0x4b')](_0x3b9545[_0xf2c3('0x4c')]['fields']));_0x44875e['attributes']=_0x44875e[_0xf2c3('0x4a')][_0xf2c3('0x5a')]?_0x44875e[_0xf2c3('0x4a')]:_0x56ae3c['model'];if(!_0x3b9545[_0xf2c3('0x4c')][_0xf2c3('0x6d')]('nolimit')){_0x44875e[_0xf2c3('0x35')]=qs['limit'](_0x3b9545[_0xf2c3('0x4c')]['limit']);_0x44875e[_0xf2c3('0x34')]=qs[_0xf2c3('0x34')](_0x3b9545[_0xf2c3('0x4c')]['offset']);}_0x44875e[_0xf2c3('0x4e')]=qs[_0xf2c3('0x4f')](_0x3b9545[_0xf2c3('0x4c')][_0xf2c3('0x4f')]);_0x44875e[_0xf2c3('0x51')]=qs[_0xf2c3('0x48')](_['pick'](_0x3b9545[_0xf2c3('0x4c')],_0x56ae3c[_0xf2c3('0x48')]));_0x44875e[_0xf2c3('0x51')][_0xf2c3('0x69')]=_0x55bc3c['id'];if(_0x3b9545['query'][_0xf2c3('0x54')]){_0x44875e['where']=_[_0xf2c3('0x5d')](_0x44875e[_0xf2c3('0x51')],{'$or':_[_0xf2c3('0x52')](_0x44875e[_0xf2c3('0x4a')],function(_0x8e4e39){var _0x57ce63={};_0x57ce63[_0x8e4e39]={'$like':'%'+_0x3b9545[_0xf2c3('0x4c')][_0xf2c3('0x54')]+'%'};return _0x57ce63;})});}_0x44875e=_[_0xf2c3('0x5d')]({},_0x44875e,_0x3b9545[_0xf2c3('0xee')]);return db[_0xf2c3('0xba')][_0xf2c3('0x33')]({'where':_0x44875e[_0xf2c3('0x51')]})['then'](function(_0x29f243){_0x546620[_0xf2c3('0x33')]=_0x29f243;if(_0x3b9545[_0xf2c3('0x4c')][_0xf2c3('0x5b')]){_0x44875e[_0xf2c3('0x5c')]=[{'model':db[_0xf2c3('0x95')],'as':_0xf2c3('0xef'),'required':![]},{'model':db[_0xf2c3('0xca')],'as':_0xf2c3('0xf0'),'attributes':[_0xf2c3('0x41'),_0xf2c3('0xf1'),_0xf2c3('0xf2')],'required':![]},{'model':db[_0xf2c3('0xf3')],'as':_0xf2c3('0xf4'),'attributes':['id',_0xf2c3('0x41'),'color'],'where':_0x3b9545[_0xf2c3('0x4c')][_0xf2c3('0xf5')]?{'id':_0x3b9545['query']['tag']}:undefined,'required':_0x3b9545['query'][_0xf2c3('0xf5')]?!![]:![]}];}return db['ChatInteraction'][_0xf2c3('0x73')](_0x44875e);})['then'](function(_0x2564ec){_0x546620['rows']=_0x2564ec;return _0x546620;});}})['then'](respondWithFilteredResult(_0x21459e,_0x44875e))[_0xf2c3('0x2f')](handleError(_0x21459e,null));};function iftimePromise(_0x4c6dd3,_0x28f482){return respondWithRpcPromise('Command','getSnippet',{'command':_0x28f482['timezone']?util[_0xf2c3('0xb5')](_0xf2c3('0xf6'),_0x4c6dd3[_0xf2c3('0xf7')],_0x28f482[_0xf2c3('0xf8')]):util['format']('iftime\x20%s',_0x4c6dd3[_0xf2c3('0xf7')])},client9002)[_0xf2c3('0x25')](function(_0x4d70ff){var _0xfc08b7=_0x4d70ff&&_0x4d70ff[_0xf2c3('0xf9')]('true')>=0x0?!![]:![];logger[_0xf2c3('0x26')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x28f482['id'],_0x4c6dd3['id'],_0x4c6dd3[_0xf2c3('0xf7')],_0xfc08b7?_0xf2c3('0xfa'):_0xf2c3('0xfb'),_0x28f482['timezone']?_0x28f482[_0xf2c3('0xf8')]:_0xf2c3('0xfc'));return _0xfc08b7;})[_0xf2c3('0x2f')](function(_0xad52af){logger[_0xf2c3('0x2b')](_0xf2c3('0xfd'),_0x28f482['id'],_0x4c6dd3['id'],_0x4c6dd3[_0xf2c3('0xf7')],util[_0xf2c3('0xfe')](_0xad52af,{'showHidden':![],'depth':null}),_0x28f482[_0xf2c3('0xf8')]?_0x28f482['timezone']:_0xf2c3('0xfc'));return![];});}exports['getSnippet']=function(_0x2531e4,_0xde9bc0,_0x4038c6){var _0x45ef87=0x0;var _0x512ca6=0x0;var _0x2fbb99=![];var _0x2082c6;var _0x4bdc7e;return db['ChatWebsite']['find']({'where':{'id':_0x2531e4['params']['id']},'include':[{'model':db[_0xf2c3('0xff')],'as':'Interval','include':[{'model':db['Interval'],'as':_0xf2c3('0x100'),'attributes':['id',_0xf2c3('0xf7')],'raw':!![]}]}]})[_0xf2c3('0x25')](handleEntityNotFound(_0xde9bc0,null))[_0xf2c3('0x25')](function(_0x174f69){if(_0x174f69){_0x2082c6=_0x174f69;return _0x174f69[_0xf2c3('0x101')]({'raw':!![]});}})[_0xf2c3('0x25')](function(_0x124e51){if(_0x2082c6){if(_0x124e51){_0x4bdc7e=_0x124e51;}}return require(_0xf2c3('0x82'))[_0xf2c3('0x102')]();})[_0xf2c3('0x25')](function(_0x19214e){if(_0x19214e){_0x512ca6=_0x19214e['virtual'];_0x2fbb99=_0x19214e[_0xf2c3('0x83')];}})['then'](function(){return db[_0xf2c3('0xba')]['count']({'where':{'closed':![]}});})['then'](function(_0x55774b){_0x45ef87=_0x55774b;if(_0x512ca6&&_0x55774b>_0x512ca6){return db['License']['findOne']({'where':{'id':0x1}})[_0xf2c3('0x25')](function(_0x443c23){if(_0x443c23){_0x443c23[_0xf2c3('0x103')]('chatLicenseExceeded');}});}})[_0xf2c3('0x25')](function(){if(_0x2082c6['Interval']&&_0x2082c6[_0xf2c3('0xff')][_0xf2c3('0x100')]){var _0x62b4da=[];for(var _0x46e58d=0x0;_0x46e58d<_0x2082c6[_0xf2c3('0xff')][_0xf2c3('0x100')][_0xf2c3('0x5a')];_0x46e58d++){var _0x4c6bf1=_0x2082c6[_0xf2c3('0xff')][_0xf2c3('0x100')][_0x46e58d]['get']({'plain':!![]});_0x62b4da[_0xf2c3('0xc4')](iftimePromise(_0x4c6bf1,_0x2082c6));}return BPromise[_0xf2c3('0x104')](_0x62b4da)['then'](function(_0x3a05f5){return _[_0xf2c3('0x105')](_0x3a05f5);});}else{return!![];}})[_0xf2c3('0x25')](function(_0x314d1b){var _0xc1657a=fs[_0xf2c3('0x106')](path[_0xf2c3('0x80')](config['root'],_0xf2c3('0x107')),_0xf2c3('0xd8'));var _0x4dcbc5={'remote':_0x2082c6['remote'],'query':querystring['stringify'](_['merge'](_0x2082c6['get']({'plain':!![]}),{'customerIp':_0x2531e4[_0xf2c3('0x92')][_0xf2c3('0xab')]||_0x2531e4['headers'][_0xf2c3('0x108')]||_0x2531e4[_0xf2c3('0x109')]['remoteAddress']||_0x2531e4['ip'],'referer':_0x2531e4[_0xf2c3('0x92')]['referer'],'openedInteractions':_0x45ef87,'maxInteractions':_0x512ca6,'virtual':_0x2fbb99[_0xf2c3('0x10a')],'online':_0x314d1b,'custom':_0x2fbb99}))['replace'](/'/g,'\x5c\x27')};_0xde9bc0[_0xf2c3('0xd2')](ejs[_0xf2c3('0xd9')](Mustache[_0xf2c3('0xd9')](_0xc1657a,_0x4dcbc5),{'proactiveActions':_0x4bdc7e,'alignment':_0x2082c6['alignment'],'verticalAlignment':_0x2082c6[_0xf2c3('0x10b')],'div_color':_0x2082c6[_0xf2c3('0x10c')],'text_color':_0x2082c6[_0xf2c3('0x10d')]}));})[_0xf2c3('0x2f')](handleError(_0xde9bc0,null));};exports[_0xf2c3('0x10e')]=function(_0x64ee05,_0x3af48b,_0x694648){return db['ChatWebsite'][_0xf2c3('0x6c')]({'where':{'id':_0x64ee05[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x3af48b,null))[_0xf2c3('0x25')](function(_0x529677){if(_0x529677){return db['sequelize'][_0xf2c3('0x10f')](function(_0x5f5a20){return db[_0xf2c3('0xa3')]['destroy']({'where':{'ChatWebsiteId':_0x64ee05['params']['id']},'transaction':_0x5f5a20})[_0xf2c3('0x25')](function(_0x5532c2){var _0x80ef14=_[_0xf2c3('0x52')](_0x64ee05[_0xf2c3('0x60')],function(_0x19a655){_0x19a655[_0xf2c3('0x69')]=_0x64ee05[_0xf2c3('0x57')]['id'];return _0x19a655;});return db['ChatApplication'][_0xf2c3('0x110')](_0x80ef14,{'transaction':_0x5f5a20});});})[_0xf2c3('0x25')](function(){return db[_0xf2c3('0xa3')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x64ee05['params']['id']},'order':_0xf2c3('0xa8')});});}})[_0xf2c3('0x25')](respondWithResult(_0x3af48b,null))[_0xf2c3('0x2f')](handleError(_0x3af48b,null));};exports[_0xf2c3('0x111')]=function(_0x4742be,_0x7b0a15,_0x1e5054){var _0x5320dc={};var _0x1ff58e={};var _0xb70d44;var _0x268562;return db['ChatWebsite'][_0xf2c3('0x6c')]({'where':{'id':_0x4742be[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x7b0a15,null))[_0xf2c3('0x25')](function(_0xd1123c){if(_0xd1123c){_0xb70d44=_0xd1123c;_0x1ff58e[_0xf2c3('0x47')]=_[_0xf2c3('0x59')](db[_0xf2c3('0xa3')][_0xf2c3('0x43')]);_0x1ff58e['query']=_[_0xf2c3('0x59')](_0x4742be[_0xf2c3('0x4c')]);_0x1ff58e['filters']=_[_0xf2c3('0x49')](_0x1ff58e['model'],_0x1ff58e['query']);_0x5320dc[_0xf2c3('0x4a')]=_['intersection'](_0x1ff58e[_0xf2c3('0x47')],qs['fields'](_0x4742be[_0xf2c3('0x4c')][_0xf2c3('0x4b')]));_0x5320dc[_0xf2c3('0x4a')]=_0x5320dc[_0xf2c3('0x4a')][_0xf2c3('0x5a')]?_0x5320dc[_0xf2c3('0x4a')]:_0x1ff58e[_0xf2c3('0x47')];_0x5320dc[_0xf2c3('0x4e')]=qs[_0xf2c3('0x4f')](_0x4742be[_0xf2c3('0x4c')][_0xf2c3('0x4f')]);_0x5320dc[_0xf2c3('0x51')]=qs['filters'](_[_0xf2c3('0x50')](_0x4742be[_0xf2c3('0x4c')],_0x1ff58e[_0xf2c3('0x48')]));if(_0x4742be[_0xf2c3('0x4c')]['filter']){_0x5320dc['where']=_[_0xf2c3('0x5d')](_0x5320dc['where'],{'$or':_[_0xf2c3('0x52')](_0x5320dc[_0xf2c3('0x4a')],function(_0x2e5dbc){var _0x33cb47={};_0x33cb47[_0x2e5dbc]={'$like':'%'+_0x4742be['query'][_0xf2c3('0x54')]+'%'};return _0x33cb47;})});}_0x5320dc=_[_0xf2c3('0x5d')]({},_0x5320dc,_0x4742be[_0xf2c3('0xee')]);return _0xb70d44[_0xf2c3('0x111')](_0x5320dc);}})[_0xf2c3('0x25')](function(_0x2af4c4){if(_0x2af4c4){_0x268562=_0x2af4c4[_0xf2c3('0x5a')];if(!_0x4742be[_0xf2c3('0x4c')]['hasOwnProperty'](_0xf2c3('0x4d'))){_0x5320dc['limit']=qs[_0xf2c3('0x35')](_0x4742be[_0xf2c3('0x4c')][_0xf2c3('0x35')]);_0x5320dc['offset']=qs[_0xf2c3('0x34')](_0x4742be[_0xf2c3('0x4c')]['offset']);}return _0xb70d44['getApplications'](_0x5320dc);}})['then'](function(_0x51a605){if(_0x51a605){return _0x51a605?{'count':_0x268562,'rows':_0x51a605}:null;}})[_0xf2c3('0x25')](respondWithResult(_0x7b0a15,null))['catch'](handleError(_0x7b0a15,null));};exports[_0xf2c3('0x112')]=function(_0x1c8257,_0x3101c1,_0x2125ce){return db[_0xf2c3('0x113')][_0xf2c3('0x5e')]({'where':{'id':_0x1c8257['params']['id']}})['then'](handleEntityNotFound(_0x3101c1,null))[_0xf2c3('0x25')](function(_0x36c59c){if(_0x36c59c){return _0x36c59c[_0xf2c3('0x112')](_0x1c8257[_0xf2c3('0x60')][_0xf2c3('0x6f')],_[_0xf2c3('0xec')](_0x1c8257['body'],[_0xf2c3('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x3101c1,null))[_0xf2c3('0x2f')](handleError(_0x3101c1,null));};exports[_0xf2c3('0x101')]=function(_0x40a274,_0x2471d2,_0x4b8054){var _0x254c7e={};var _0x1e4f59={};var _0x37dcea;var _0x9bf07e;return db[_0xf2c3('0x55')][_0xf2c3('0x6c')]({'where':{'id':_0x40a274[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x2471d2,null))['then'](function(_0x3ee7bc){if(_0x3ee7bc){_0x37dcea=_0x3ee7bc;_0x1e4f59[_0xf2c3('0x47')]=_['keys'](db[_0xf2c3('0x114')][_0xf2c3('0x43')]);_0x1e4f59['query']=_['keys'](_0x40a274[_0xf2c3('0x4c')]);_0x1e4f59[_0xf2c3('0x48')]=_['intersection'](_0x1e4f59[_0xf2c3('0x47')],_0x1e4f59[_0xf2c3('0x4c')]);_0x254c7e[_0xf2c3('0x4a')]=_['intersection'](_0x1e4f59['model'],qs[_0xf2c3('0x4b')](_0x40a274[_0xf2c3('0x4c')][_0xf2c3('0x4b')]));_0x254c7e[_0xf2c3('0x4a')]=_0x254c7e[_0xf2c3('0x4a')][_0xf2c3('0x5a')]?_0x254c7e[_0xf2c3('0x4a')]:_0x1e4f59[_0xf2c3('0x47')];_0x254c7e[_0xf2c3('0x4e')]=qs['sort'](_0x40a274['query'][_0xf2c3('0x4f')]);_0x254c7e[_0xf2c3('0x51')]=qs['filters'](_[_0xf2c3('0x50')](_0x40a274[_0xf2c3('0x4c')],_0x1e4f59['filters']));if(_0x40a274[_0xf2c3('0x4c')][_0xf2c3('0x54')]){_0x254c7e['where']=_['merge'](_0x254c7e[_0xf2c3('0x51')],{'$or':_['map'](_0x254c7e[_0xf2c3('0x4a')],function(_0x4dfc64){var _0x1c900b={};_0x1c900b[_0x4dfc64]={'$like':'%'+_0x40a274[_0xf2c3('0x4c')][_0xf2c3('0x54')]+'%'};return _0x1c900b;})});}_0x254c7e=_[_0xf2c3('0x5d')]({},_0x254c7e,_0x40a274['options']);return _0x37dcea['getProactiveActions'](_0x254c7e);}})[_0xf2c3('0x25')](function(_0x502b26){if(_0x502b26){_0x9bf07e=_0x502b26[_0xf2c3('0x5a')];if(!_0x40a274[_0xf2c3('0x4c')][_0xf2c3('0x6d')](_0xf2c3('0x4d'))){_0x254c7e[_0xf2c3('0x35')]=qs[_0xf2c3('0x35')](_0x40a274[_0xf2c3('0x4c')][_0xf2c3('0x35')]);_0x254c7e['offset']=qs[_0xf2c3('0x34')](_0x40a274['query']['offset']);}return _0x37dcea[_0xf2c3('0x101')](_0x254c7e);}})[_0xf2c3('0x25')](function(_0x48b02b){if(_0x48b02b){return _0x48b02b?{'count':_0x9bf07e,'rows':_0x48b02b}:null;}})[_0xf2c3('0x25')](respondWithResult(_0x2471d2,null))[_0xf2c3('0x2f')](handleError(_0x2471d2,null));};exports[_0xf2c3('0x115')]=function(_0x40b4d5,_0x3fa8f1,_0x398b82){var _0x2c559a=_0x40b4d5['query'][_0xf2c3('0x116')]==='false'?_0xf2c3('0x117'):_0xf2c3('0x118');return db[_0xf2c3('0x55')][_0xf2c3('0x5e')]({'attributes':['id',_0x2c559a],'where':{'id':_0x40b4d5[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x3fa8f1,null))[_0xf2c3('0x25')](function(_0x1d7b92){if(_0x1d7b92){var _0x15d249=_0x1d7b92[_0x2c559a];var _0x450b36=_0x15d249&&_0x15d249[_0xf2c3('0x119')]?_0x15d249['items']:[];_0x3fa8f1[_0xf2c3('0xd2')]({'fromKey':_[_0xf2c3('0x84')](_0x15d249[_0xf2c3('0x11a')])?undefined:_0x15d249[_0xf2c3('0x11a')],'count':_0x450b36[_0xf2c3('0x5a')],'rows':_0x450b36});}})['catch'](handleError(_0x3fa8f1,null));};exports[_0xf2c3('0x11b')]=function(_0x2e5ac7,_0x51e897,_0x1d6498){var _0x259165={'raw':![],'where':{}};var _0x1a8f65={};var _0x5c4e07={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xf2c3('0x6c')]({'where':{'id':_0x2e5ac7['params']['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x51e897,null))[_0xf2c3('0x25')](function(_0x84ed3f){if(_0x84ed3f){_0x1a8f65[_0xf2c3('0x47')]=_[_0xf2c3('0x59')](db[_0xf2c3('0xdb')][_0xf2c3('0x43')]);_0x1a8f65[_0xf2c3('0x4c')]=_[_0xf2c3('0x59')](_0x2e5ac7[_0xf2c3('0x4c')]);_0x1a8f65[_0xf2c3('0x48')]=_['intersection'](_0x1a8f65[_0xf2c3('0x47')],_0x1a8f65[_0xf2c3('0x4c')]);_0x259165['attributes']=_['intersection'](_0x1a8f65['model'],qs['fields'](_0x2e5ac7[_0xf2c3('0x4c')][_0xf2c3('0x4b')]));_0x259165[_0xf2c3('0x4a')]=_0x259165['attributes'][_0xf2c3('0x5a')]?_0x259165['attributes']:_0x1a8f65[_0xf2c3('0x47')];if(!_0x2e5ac7[_0xf2c3('0x4c')]['hasOwnProperty'](_0xf2c3('0x4d'))){_0x259165[_0xf2c3('0x35')]=qs[_0xf2c3('0x35')](_0x2e5ac7[_0xf2c3('0x4c')][_0xf2c3('0x35')]);_0x259165[_0xf2c3('0x34')]=qs['offset'](_0x2e5ac7['query'][_0xf2c3('0x34')]);}_0x259165[_0xf2c3('0x4e')]=qs[_0xf2c3('0x4f')](_0x2e5ac7[_0xf2c3('0x4c')]['sort']);_0x259165[_0xf2c3('0x51')]=qs[_0xf2c3('0x48')](_[_0xf2c3('0x50')](_0x2e5ac7[_0xf2c3('0x4c')],_0x1a8f65['filters']));_0x259165[_0xf2c3('0x51')][_0xf2c3('0x69')]=_0x84ed3f['id'];if(_0x2e5ac7[_0xf2c3('0x4c')][_0xf2c3('0x54')]){_0x259165[_0xf2c3('0x51')]=_['merge'](_0x259165[_0xf2c3('0x51')],{'$or':_['map'](_0x259165[_0xf2c3('0x4a')],function(_0x275fc8){var _0x36fffd={};_0x36fffd[_0x275fc8]={'$like':'%'+_0x2e5ac7['query'][_0xf2c3('0x54')]+'%'};return _0x36fffd;})});}_0x259165=_[_0xf2c3('0x5d')]({},_0x259165,_0x2e5ac7['options']);return db[_0xf2c3('0xdb')]['count']({'where':_0x259165[_0xf2c3('0x51')]})[_0xf2c3('0x25')](function(_0x31086a){_0x5c4e07[_0xf2c3('0x33')]=_0x31086a;if(_0x2e5ac7[_0xf2c3('0x4c')][_0xf2c3('0x5b')]){_0x259165['include']=[{'all':!![]}];}else{_0x259165[_0xf2c3('0x5c')]=[{'model':db[_0xf2c3('0x95')],'as':_0xf2c3('0xef'),'required':![]}];}return db[_0xf2c3('0xdb')]['findAll'](_0x259165);})[_0xf2c3('0x25')](function(_0x2576eb){_0x5c4e07[_0xf2c3('0x74')]=_0x2576eb;return _0x5c4e07;});}})[_0xf2c3('0x25')](respondWithFilteredResult(_0x51e897,_0x259165))[_0xf2c3('0x2f')](handleError(_0x51e897,null));};exports['addAgents']=function(_0x219771,_0x24463f,_0x32c456){return db[_0xf2c3('0x55')]['find']({'where':{'id':_0x219771['params']['id']}})['then'](handleEntityNotFound(_0x24463f,null))[_0xf2c3('0x25')](function(_0x47603b){if(_0x47603b){return _0x47603b['addAgents'](_0x219771[_0xf2c3('0x60')][_0xf2c3('0x6f')],_['omit'](_0x219771[_0xf2c3('0x60')],[_0xf2c3('0x6f'),'id'])||{})[_0xf2c3('0xbd')](function(_0x44bb4b){for(var _0x5cfbc9=0x0;_0x5cfbc9<_0x219771[_0xf2c3('0x60')][_0xf2c3('0x6f')][_0xf2c3('0x5a')];_0x5cfbc9+=0x1){socket[_0xf2c3('0x11c')]('userChatWebsite:save',{'UserId':_0x219771['body'][_0xf2c3('0x6f')][_0x5cfbc9],'ChatWebsiteId':_0x219771[_0xf2c3('0x57')]['id']});}return _0x44bb4b;});}})[_0xf2c3('0x25')](respondWithResult(_0x24463f,null))['catch'](handleError(_0x24463f,null));};exports[_0xf2c3('0x11d')]=function(_0x59d90b,_0x4b6835,_0x28a50a){return db[_0xf2c3('0x55')]['find']({'where':{'id':_0x59d90b[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x4b6835,null))['then'](function(_0x2a1908){if(_0x2a1908){return _0x2a1908[_0xf2c3('0x11d')](_0x59d90b[_0xf2c3('0x4c')][_0xf2c3('0x6f')])[_0xf2c3('0x25')](function(){if(_[_0xf2c3('0x11e')](_0x59d90b[_0xf2c3('0x4c')][_0xf2c3('0x6f')])){for(var _0x221fda=0x0;_0x221fda<_0x59d90b[_0xf2c3('0x4c')][_0xf2c3('0x6f')][_0xf2c3('0x5a')];_0x221fda+=0x1){socket[_0xf2c3('0x11c')](_0xf2c3('0x11f'),{'UserId':Number(_0x59d90b[_0xf2c3('0x4c')][_0xf2c3('0x6f')][_0x221fda]),'ChatWebsiteId':Number(_0x59d90b['params']['id'])});}}else{socket[_0xf2c3('0x11c')](_0xf2c3('0x11f'),{'UserId':Number(_0x59d90b[_0xf2c3('0x4c')][_0xf2c3('0x6f')]),'ChatWebsiteId':Number(_0x59d90b[_0xf2c3('0x57')]['id'])});}});}})[_0xf2c3('0x25')](respondWithStatusCode(_0x4b6835,null))[_0xf2c3('0x2f')](handleError(_0x4b6835,null));};exports[_0xf2c3('0x120')]=function(_0x54b4da,_0x13c70f,_0x115608){var _0x10c1ba={};var _0x195959={};var _0x5880db;var _0x18d832;return db['ChatWebsite'][_0xf2c3('0x6c')]({'where':{'id':_0x54b4da[_0xf2c3('0x57')]['id']}})[_0xf2c3('0x25')](handleEntityNotFound(_0x13c70f,null))['then'](function(_0x25c7a1){if(_0x25c7a1){_0x5880db=_0x25c7a1;_0x195959[_0xf2c3('0x47')]=_[_0xf2c3('0x59')](db[_0xf2c3('0xca')][_0xf2c3('0x43')]);_0x195959['query']=_['keys'](_0x54b4da[_0xf2c3('0x4c')]);_0x195959['filters']=_['intersection'](_0x195959['model'],_0x195959[_0xf2c3('0x4c')]);_0x10c1ba['attributes']=_[_0xf2c3('0x49')](_0x195959['model'],qs['fields'](_0x54b4da[_0xf2c3('0x4c')][_0xf2c3('0x4b')]));_0x10c1ba[_0xf2c3('0x4a')]=_0x10c1ba[_0xf2c3('0x4a')][_0xf2c3('0x5a')]?_0x10c1ba[_0xf2c3('0x4a')]:_0x195959['model'];_0x10c1ba[_0xf2c3('0x4e')]=qs[_0xf2c3('0x4f')](_0x54b4da[_0xf2c3('0x4c')][_0xf2c3('0x4f')]);_0x10c1ba[_0xf2c3('0x51')]=qs[_0xf2c3('0x48')](_[_0xf2c3('0x50')](_0x54b4da[_0xf2c3('0x4c')],_0x195959[_0xf2c3('0x48')]));if(_0x54b4da[_0xf2c3('0x4c')][_0xf2c3('0x54')]){_0x10c1ba['where']=_['merge'](_0x10c1ba[_0xf2c3('0x51')],{'$or':_[_0xf2c3('0x52')](_0x10c1ba[_0xf2c3('0x4a')],function(_0x1b193d){var _0x103455={};_0x103455[_0x1b193d]={'$like':'%'+_0x54b4da['query'][_0xf2c3('0x54')]+'%'};return _0x103455;})});}_0x10c1ba=_['merge']({},_0x10c1ba,_0x54b4da[_0xf2c3('0xee')]);return _0x5880db['getAgents'](_0x10c1ba);}})[_0xf2c3('0x25')](function(_0x5a7288){if(_0x5a7288){_0x18d832=_0x5a7288[_0xf2c3('0x5a')];if(!_0x54b4da[_0xf2c3('0x4c')]['hasOwnProperty']('nolimit')){_0x10c1ba[_0xf2c3('0x35')]=qs['limit'](_0x54b4da[_0xf2c3('0x4c')][_0xf2c3('0x35')]);_0x10c1ba[_0xf2c3('0x34')]=qs['offset'](_0x54b4da[_0xf2c3('0x4c')][_0xf2c3('0x34')]);}return _0x5880db['getAgents'](_0x10c1ba);}})[_0xf2c3('0x25')](function(_0x524229){if(_0x524229){return _0x524229?{'count':_0x18d832,'rows':_0x524229}:null;}})[_0xf2c3('0x25')](respondWithResult(_0x13c70f,null))[_0xf2c3('0x2f')](handleError(_0x13c70f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 4668f07..73d4bf7 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 _0xa991=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xa991,0x143));var _0x1a99=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xa991[_0x51020b];return _0x371e47;};'use strict';var EventEmitter=require(_0x1a99('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x1a99('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1a99('0x2')](0x0);var events={'afterCreate':_0x1a99('0x3'),'afterUpdate':_0x1a99('0x4'),'afterDestroy':_0x1a99('0x5')};function emitEvent(_0x577db5){return function(_0x46c8c4,_0x1fe48a,_0x118756){ChatWebsiteEvents[_0x1a99('0x6')](_0x577db5+':'+_0x46c8c4['id'],_0x46c8c4);ChatWebsiteEvents[_0x1a99('0x6')](_0x577db5,_0x46c8c4);_0x118756(null);};}for(var e in events){if(events[_0x1a99('0x7')](e)){var event=events[e];ChatWebsite[_0x1a99('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x15ab=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4718d0,_0x382e6f){var _0x5885cf=function(_0x1f097e){while(--_0x1f097e){_0x4718d0['push'](_0x4718d0['shift']());}};_0x5885cf(++_0x382e6f);}(_0x15ab,0xda));var _0xb15a=function(_0x356ce7,_0x207503){_0x356ce7=_0x356ce7-0x0;var _0x1c6386=_0x15ab[_0x356ce7];return _0x1c6386;};'use strict';var EventEmitter=require(_0xb15a('0x0'));var ChatWebsite=require(_0xb15a('0x1'))['db'][_0xb15a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb15a('0x3')](0x0);var events={'afterCreate':_0xb15a('0x4'),'afterUpdate':_0xb15a('0x5'),'afterDestroy':_0xb15a('0x6')};function emitEvent(_0x245475){return function(_0x3d3d97,_0x5bae8d,_0x1a3760){ChatWebsiteEvents[_0xb15a('0x7')](_0x245475+':'+_0x3d3d97['id'],_0x3d3d97);ChatWebsiteEvents['emit'](_0x245475,_0x3d3d97);_0x1a3760(null);};}for(var e in events){if(events[_0xb15a('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xb15a('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 532637a..4407704 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 _0x4a81=['../../config/logger','api','request-promise','rimraf','../../config/environment','define','chat_websites','lodash','util'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x4a81,0x1b7));var _0x14a8=function(_0x1f145d,_0x5ae31){_0x1f145d=_0x1f145d-0x0;var _0x15fbfc=_0x4a81[_0x1f145d];return _0x15fbfc;};'use strict';var _=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var logger=require(_0x14a8('0x2'))(_0x14a8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14a8('0x5'));var config=require(_0x14a8('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x2cd6d2,_0x4aa19e){return _0x2cd6d2[_0x14a8('0x7')]('ChatWebsite',attributes,{'tableName':_0x14a8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c02=['./chatWebsite.attributes','exports','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xe3f2a,_0x525bfe){var _0x53a069=function(_0x171cd0){while(--_0x171cd0){_0xe3f2a['push'](_0xe3f2a['shift']());}};_0x53a069(++_0x525bfe);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var logger=require(_0x20c0('0x1'))('api');var moment=require(_0x20c0('0x2'));var BPromise=require(_0x20c0('0x3'));var rp=require(_0x20c0('0x4'));var fs=require('fs');var path=require(_0x20c0('0x5'));var rimraf=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var attributes=require(_0x20c0('0x8'));module[_0x20c0('0x9')]=function(_0x13312d,_0xd25ee8){return _0x13312d['define']('ChatWebsite',attributes,{'tableName':'chat_websites','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 342755f..a3f86bc 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 _0x8952=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','then','info','request\x20sent','debug','stringify','code','error','message','ChatWebsite,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x8952,0x17e));var _0x2895=function(_0x369950,_0x40a21c){_0x369950=_0x369950-0x0;var _0x4c3d0e=_0x8952[_0x369950];return _0x4c3d0e;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2895('0xb')],{'host':_0x2895('0xc'),'port':0x18eb});var socket=require(_0x2895('0xd'))(new Redis(config[_0x2895('0xb')]));require(_0x2895('0xe'))['register'](socket);function respondWithRpcPromise(_0x14fb67,_0x5f2632,_0x428772){return new BPromise(function(_0x5af454,_0x5e66fc){return client['request'](_0x14fb67,_0x428772)[_0x2895('0xf')](function(_0x1829a2){logger[_0x2895('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'));logger[_0x2895('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'),JSON[_0x2895('0x13')](_0x1829a2));if(_0x1829a2['error']){if(_0x1829a2['error'][_0x2895('0x14')]===0x1f4){logger[_0x2895('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5e66fc(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}logger[_0x2895('0x15')](_0x2895('0x17'),_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5af454(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}else{logger[_0x2895('0x10')](_0x2895('0x17'),_0x5f2632,_0x2895('0x11'));_0x5af454(_0x1829a2[_0x2895('0x18')][_0x2895('0x16')]);}})[_0x2895('0x19')](function(_0x2fe8fe){logger[_0x2895('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x5f2632,_0x2fe8fe);_0x5e66fc(_0x2fe8fe);});});} \ No newline at end of file +var _0x4975=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4975,0x86));var _0x5497=function(_0x29d9ab,_0x41d036){_0x29d9ab=_0x29d9ab-0x0;var _0x273663=_0x4975[_0x29d9ab];return _0x273663;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});config['redis']=_[_0x5497('0xc')](config[_0x5497('0xd')],{'host':_0x5497('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5497('0xd')]));require('./chatWebsite.socket')[_0x5497('0xf')](socket);function respondWithRpcPromise(_0x29c93f,_0x2ec5a4,_0x32a8a2){return new BPromise(function(_0x131627,_0x425288){return client[_0x5497('0x10')](_0x29c93f,_0x32a8a2)[_0x5497('0x11')](function(_0x50d716){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2ec5a4,_0x5497('0x12'));logger[_0x5497('0x13')](_0x5497('0x14'),_0x2ec5a4,_0x5497('0x12'),JSON[_0x5497('0x15')](_0x50d716));if(_0x50d716[_0x5497('0x16')]){if(_0x50d716[_0x5497('0x16')][_0x5497('0x17')]===0x1f4){logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0x50d716['error'][_0x5497('0x19')]);return _0x425288(_0x50d716['error'][_0x5497('0x19')]);}logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0x50d716[_0x5497('0x16')][_0x5497('0x19')]);return _0x131627(_0x50d716[_0x5497('0x16')][_0x5497('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2ec5a4,_0x5497('0x12'));_0x131627(_0x50d716[_0x5497('0x1a')][_0x5497('0x19')]);}})['catch'](function(_0xbf1ba7){logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0xbf1ba7);_0x425288(_0xbf1ba7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index af684f4..c43cecb 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 _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x3c3b27,_0x343d00){var _0x14173c=function(_0x2458f7){while(--_0x2458f7){_0x3c3b27['push'](_0x3c3b27['shift']());}};_0x14173c(++_0x343d00);}(_0x7a54,0x106));var _0x47a5=function(_0x5e847e,_0x5ce3f2){_0x5e847e=_0x5e847e-0x0;var _0x7a3862=_0x7a54[_0x5e847e];return _0x7a3862;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x507458,_0x1096bf){var _0x5f43ad=function(_0x36cfb1){while(--_0x36cfb1){_0x507458['push'](_0x507458['shift']());}};_0x5f43ad(++_0x1096bf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3a65de,_0x245483){_0x3a65de=_0x3a65de-0x0;var _0x311a88=_0x5f2f[_0x3a65de];return _0x311a88;};'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 diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 897d27e..a9cec86 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 _0x1a6c=['/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','create','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','addAvatar','/:id/customer_avatar','addCustomerAvatar','server/files/images/avatars/','/:id/system_avatar','/:id/notify','notify','offline','addApplications','/:id/users','addAgents','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0x1a6c,0xeb));var _0xc1a6=function(_0x5237df,_0x54a1b2){_0x5237df=_0x5237df-0x0;var _0xe8cd5c=_0x1a6c[_0x5237df];return _0xe8cd5c;};'use strict';var multer=require(_0xc1a6('0x0'));var util=require(_0xc1a6('0x1'));var path=require(_0xc1a6('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1a6('0x3'));var router=express[_0xc1a6('0x4')]();var auth=require(_0xc1a6('0x5'));var interaction=require(_0xc1a6('0x6'));var config=require(_0xc1a6('0x7'));var controller=require(_0xc1a6('0x8'));router['get']('/',auth[_0xc1a6('0x9')](),controller[_0xc1a6('0xa')]);router[_0xc1a6('0xb')](_0xc1a6('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xc1a6('0x9')](),controller[_0xc1a6('0xd')]);router[_0xc1a6('0xb')](_0xc1a6('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xc1a6('0xb')](_0xc1a6('0xf'),auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x10')]);router[_0xc1a6('0xb')](_0xc1a6('0x11'),controller[_0xc1a6('0x12')]);router['get'](_0xc1a6('0x13'),controller[_0xc1a6('0x14')]);router[_0xc1a6('0xb')]('/:id/customer_avatar',controller[_0xc1a6('0x15')]);router[_0xc1a6('0xb')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0xc1a6('0xb')](_0xc1a6('0x16'),auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x17')]);router[_0xc1a6('0xb')](_0xc1a6('0x18'),controller[_0xc1a6('0x19')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xc1a6('0x1a')]);router[_0xc1a6('0xb')](_0xc1a6('0x1b'),auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x1c')]);router[_0xc1a6('0xb')](_0xc1a6('0x1d'),controller[_0xc1a6('0x1e')]);router[_0xc1a6('0xb')](_0xc1a6('0x1f'),auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x20')]);router[_0xc1a6('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x21')]);router[_0xc1a6('0x22')](_0xc1a6('0xe'),auth['isAuthenticated'](),controller[_0xc1a6('0x23')]);router['post'](_0xc1a6('0xf'),auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x24')]);var upload=multer({'storage':multer[_0xc1a6('0x25')]({'destination':function(_0x5b76bb,_0x31aefa,_0x534dc3){_0x534dc3(null,path[_0xc1a6('0x26')](config[_0xc1a6('0x27')],_0xc1a6('0x28')));},'filename':function(_0x1bec92,_0x6ef69a,_0x5d252a){_0x5d252a(null,util[_0xc1a6('0x29')](_0xc1a6('0x2a'),Date[_0xc1a6('0x2b')](),_0x6ef69a[_0xc1a6('0x2c')]));}})});router[_0xc1a6('0x22')](_0xc1a6('0x11'),upload[_0xc1a6('0x2d')](_0xc1a6('0x2e')),controller[_0xc1a6('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb893b3,_0xdf1671,_0x3ebae7){_0x3ebae7(null,path[_0xc1a6('0x26')](config[_0xc1a6('0x27')],'server/files/images/avatars/'));},'filename':function(_0x186389,_0xfad3af,_0xb4145b){_0xb4145b(null,util[_0xc1a6('0x29')]('%s-%s',Date[_0xc1a6('0x2b')](),_0xfad3af[_0xc1a6('0x2c')]));}})});router[_0xc1a6('0x22')]('/:id/avatar',upload[_0xc1a6('0x2d')](_0xc1a6('0x2e')),controller[_0xc1a6('0x30')]);var upload=multer({'storage':multer[_0xc1a6('0x25')]({'destination':function(_0x3ea9ac,_0x451fd3,_0xa5bcae){_0xa5bcae(null,path['join'](config[_0xc1a6('0x27')],'server/files/images/avatars/'));},'filename':function(_0x28e17a,_0x2198aa,_0x1a7670){_0x1a7670(null,util[_0xc1a6('0x29')]('%s-%s',Date[_0xc1a6('0x2b')](),_0x2198aa['originalname']));}})});router[_0xc1a6('0x22')](_0xc1a6('0x31'),upload[_0xc1a6('0x2d')]('file'),controller[_0xc1a6('0x32')]);var upload=multer({'storage':multer[_0xc1a6('0x25')]({'destination':function(_0x2a6595,_0x3d5588,_0x37ac85){_0x37ac85(null,path[_0xc1a6('0x26')](config[_0xc1a6('0x27')],_0xc1a6('0x33')));},'filename':function(_0x1d9ea7,_0x5e09d0,_0x350fc2){_0x350fc2(null,util[_0xc1a6('0x29')]('%s-%s',Date[_0xc1a6('0x2b')](),_0x5e09d0[_0xc1a6('0x2c')]));}})});router[_0xc1a6('0x22')](_0xc1a6('0x34'),upload[_0xc1a6('0x2d')](_0xc1a6('0x2e')),controller['addSystemAvatar']);router[_0xc1a6('0x22')](_0xc1a6('0x35'),controller[_0xc1a6('0x36')]);router[_0xc1a6('0x22')]('/:id/offline',controller[_0xc1a6('0x37')]);router[_0xc1a6('0x22')](_0xc1a6('0x16'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xc1a6('0x22')]('/:id/applications',auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x38')]);router[_0xc1a6('0x22')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xc1a6('0x22')](_0xc1a6('0x39'),auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x3a')]);router['put']('/:id',auth[_0xc1a6('0x9')](),controller['update']);router[_0xc1a6('0x3b')](_0xc1a6('0x3c'),auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x3d')]);router[_0xc1a6('0x3b')](_0xc1a6('0xe'),auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x3e')]);router['delete'](_0xc1a6('0xf'),auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x3f')]);router[_0xc1a6('0x3b')](_0xc1a6('0x39'),auth[_0xc1a6('0x9')](),controller[_0xc1a6('0x40')]);module[_0xc1a6('0x41')]=router; \ No newline at end of file +var _0xe7fc=['getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','addLogo','diskStorage','server/files/images/avatars/','now','originalname','single','file','addAvatar','addCustomerAvatar','/:id/notify','/:id/offline','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','index','get','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar'];(function(_0x2226c1,_0x2bed75){var _0x178716=function(_0x54bb7e){while(--_0x54bb7e){_0x2226c1['push'](_0x2226c1['shift']());}};_0x178716(++_0x2bed75);}(_0xe7fc,0xb3));var _0xce7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe7fc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce7f('0x0'));var util=require(_0xce7f('0x1'));var path=require(_0xce7f('0x2'));var timeout=require('connect-timeout');var express=require(_0xce7f('0x3'));var router=express['Router']();var auth=require(_0xce7f('0x4'));var interaction=require(_0xce7f('0x5'));var config=require(_0xce7f('0x6'));var controller=require(_0xce7f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xce7f('0x8')]);router[_0xce7f('0x9')]('/describe',auth[_0xce7f('0xa')](),controller['describe']);router[_0xce7f('0x9')](_0xce7f('0xb'),auth[_0xce7f('0xa')](),controller[_0xce7f('0xc')]);router[_0xce7f('0x9')](_0xce7f('0xd'),auth[_0xce7f('0xa')](),controller['getDispositions']);router[_0xce7f('0x9')](_0xce7f('0xe'),auth[_0xce7f('0xa')](),controller['getAnswers']);router[_0xce7f('0x9')](_0xce7f('0xf'),controller[_0xce7f('0x10')]);router[_0xce7f('0x9')](_0xce7f('0x11'),controller[_0xce7f('0x12')]);router['get'](_0xce7f('0x13'),controller[_0xce7f('0x14')]);router[_0xce7f('0x9')](_0xce7f('0x15'),controller['getSystemAvatar']);router[_0xce7f('0x9')]('/:id/interactions',auth[_0xce7f('0xa')](),controller[_0xce7f('0x16')]);router[_0xce7f('0x9')](_0xce7f('0x17'),controller[_0xce7f('0x18')]);router[_0xce7f('0x9')]('/:id/applications',auth[_0xce7f('0xa')](),controller[_0xce7f('0x19')]);router['get'](_0xce7f('0x1a'),auth[_0xce7f('0xa')](),controller[_0xce7f('0x1b')]);router['get'](_0xce7f('0x1c'),controller[_0xce7f('0x1d')]);router[_0xce7f('0x9')](_0xce7f('0x1e'),auth[_0xce7f('0xa')](),controller[_0xce7f('0x1f')]);router[_0xce7f('0x9')](_0xce7f('0x20'),auth[_0xce7f('0xa')](),controller[_0xce7f('0x21')]);router[_0xce7f('0x22')]('/',auth[_0xce7f('0xa')](),controller[_0xce7f('0x23')]);router[_0xce7f('0x22')](_0xce7f('0xd'),auth[_0xce7f('0xa')](),controller[_0xce7f('0x24')]);router[_0xce7f('0x22')](_0xce7f('0xe'),auth[_0xce7f('0xa')](),controller[_0xce7f('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8f24f3,_0x526ed4,_0x3ea2b2){_0x3ea2b2(null,path[_0xce7f('0x26')](config[_0xce7f('0x27')],_0xce7f('0x28')));},'filename':function(_0x13789b,_0x276204,_0x54c6d5){_0x54c6d5(null,util[_0xce7f('0x29')](_0xce7f('0x2a'),Date['now'](),_0x276204['originalname']));}})});router[_0xce7f('0x22')](_0xce7f('0xf'),upload['single']('file'),controller[_0xce7f('0x2b')]);var upload=multer({'storage':multer[_0xce7f('0x2c')]({'destination':function(_0x9684ff,_0xe5fd43,_0x30ad1f){_0x30ad1f(null,path[_0xce7f('0x26')](config[_0xce7f('0x27')],_0xce7f('0x2d')));},'filename':function(_0x32b6aa,_0x353724,_0x5d1e80){_0x5d1e80(null,util[_0xce7f('0x29')](_0xce7f('0x2a'),Date[_0xce7f('0x2e')](),_0x353724[_0xce7f('0x2f')]));}})});router[_0xce7f('0x22')](_0xce7f('0x11'),upload[_0xce7f('0x30')](_0xce7f('0x31')),controller[_0xce7f('0x32')]);var upload=multer({'storage':multer[_0xce7f('0x2c')]({'destination':function(_0x4a34ed,_0x5ef751,_0x529aa4){_0x529aa4(null,path['join'](config[_0xce7f('0x27')],_0xce7f('0x2d')));},'filename':function(_0x38cba0,_0x4333ac,_0x1d3231){_0x1d3231(null,util[_0xce7f('0x29')]('%s-%s',Date[_0xce7f('0x2e')](),_0x4333ac[_0xce7f('0x2f')]));}})});router[_0xce7f('0x22')](_0xce7f('0x13'),upload[_0xce7f('0x30')]('file'),controller[_0xce7f('0x33')]);var upload=multer({'storage':multer[_0xce7f('0x2c')]({'destination':function(_0xa366fd,_0x910f87,_0x366fb7){_0x366fb7(null,path[_0xce7f('0x26')](config[_0xce7f('0x27')],'server/files/images/avatars/'));},'filename':function(_0x57b093,_0x43b5c4,_0x5cdd8a){_0x5cdd8a(null,util[_0xce7f('0x29')](_0xce7f('0x2a'),Date[_0xce7f('0x2e')](),_0x43b5c4['originalname']));}})});router['post'](_0xce7f('0x15'),upload[_0xce7f('0x30')](_0xce7f('0x31')),controller['addSystemAvatar']);router[_0xce7f('0x22')](_0xce7f('0x34'),controller['notify']);router[_0xce7f('0x22')](_0xce7f('0x35'),controller[_0xce7f('0x36')]);router['post'](_0xce7f('0x37'),auth['isAuthenticated'](),controller[_0xce7f('0x38')]);router[_0xce7f('0x22')]('/:id/applications',auth[_0xce7f('0xa')](),controller[_0xce7f('0x39')]);router[_0xce7f('0x22')](_0xce7f('0x1a'),auth[_0xce7f('0xa')](),controller[_0xce7f('0x3a')]);router[_0xce7f('0x22')](_0xce7f('0x20'),auth[_0xce7f('0xa')](),controller[_0xce7f('0x3b')]);router[_0xce7f('0x3c')](_0xce7f('0xb'),auth[_0xce7f('0xa')](),controller[_0xce7f('0x3d')]);router['delete'](_0xce7f('0xb'),auth[_0xce7f('0xa')](),controller[_0xce7f('0x3e')]);router[_0xce7f('0x3f')](_0xce7f('0xd'),auth[_0xce7f('0xa')](),controller[_0xce7f('0x40')]);router[_0xce7f('0x3f')]('/:id/canned_answers',auth[_0xce7f('0xa')](),controller[_0xce7f('0x41')]);router[_0xce7f('0x3f')](_0xce7f('0x20'),auth[_0xce7f('0xa')](),controller['removeAgents']);module[_0xce7f('0x42')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5bad0ee..c466821 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 _0xf603=['ENUM','AmazonAWS','Google','STRING','sequelize','exports'];(function(_0x3c19c7,_0x2180e3){var _0x47b01a=function(_0x122724){while(--_0x122724){_0x3c19c7['push'](_0x3c19c7['shift']());}};_0x47b01a(++_0x2180e3);}(_0xf603,0x124));var _0x3f60=function(_0x38a80f,_0x3bd80d){_0x38a80f=_0x38a80f-0x0;var _0x50f5c2=_0xf603[_0x38a80f];return _0x50f5c2;};'use strict';var Sequelize=require(_0x3f60('0x0'));module[_0x3f60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3f60('0x2')](_0x3f60('0x3'),_0x3f60('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3f60('0x5')]},'data2':{'type':Sequelize[_0x3f60('0x5')]}}; \ No newline at end of file +var _0x9432=['ENUM','AmazonAWS','STRING','sequelize','exports'];(function(_0x1cabce,_0x3cc4aa){var _0x487c9f=function(_0x43b2fd){while(--_0x43b2fd){_0x1cabce['push'](_0x1cabce['shift']());}};_0x487c9f(++_0x3cc4aa);}(_0x9432,0x1e3));var _0x2943=function(_0x1df442,_0x3aeb06){_0x1df442=_0x1df442-0x0;var _0x3aee92=_0x9432[_0x1df442];return _0x3aee92;};'use strict';var Sequelize=require(_0x2943('0x0'));module[_0x2943('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x2943('0x2')](_0x2943('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x2943('0x4')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 0490f42..c211e0c 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 _0xb3bb=['filter','options','includeAll','findAll','catch','params','rawAttributes','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','index','map','CloudProvider','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filters','merge','type','VIRTUAL'];(function(_0xb06354,_0x464d11){var _0x44da6c=function(_0x1c900f){while(--_0x1c900f){_0xb06354['push'](_0xb06354['shift']());}};_0x44da6c(++_0x464d11);}(_0xb3bb,0x95));var _0xbb3b=function(_0x37171d,_0x52cd92){_0x37171d=_0x37171d-0x0;var _0x14faab=_0xb3bb[_0x37171d];return _0x14faab;};'use strict';var pdf=require(_0xbb3b('0x0'));var emlformat=require(_0xbb3b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb3b('0x2'));var jsonpatch=require(_0xbb3b('0x3'));var rp=require(_0xbb3b('0x4'));var moment=require(_0xbb3b('0x5'));var BPromise=require(_0xbb3b('0x6'));var Mustache=require(_0xbb3b('0x7'));var util=require('util');var path=require(_0xbb3b('0x8'));var sox=require(_0xbb3b('0x9'));var csv=require(_0xbb3b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbb3b('0xb'));var squel=require(_0xbb3b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbb3b('0xd'));var toCsv=require(_0xbb3b('0xa'));var querystring=require(_0xbb3b('0xe'));var Papa=require(_0xbb3b('0xf'));var Redis=require(_0xbb3b('0x10'));var authService=require(_0xbb3b('0x11'));var qs=require(_0xbb3b('0x12'));var as=require(_0xbb3b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb3b('0x14'))('api');var utils=require(_0xbb3b('0x15'));var config=require(_0xbb3b('0x16'));var db=require(_0xbb3b('0x17'))['db'];function respondWithStatusCode(_0x4c5758,_0x471b98){_0x471b98=_0x471b98||0xcc;return function(_0x40f4e5){if(_0x40f4e5){return _0x4c5758[_0xbb3b('0x18')](_0x471b98);}return _0x4c5758['status'](_0x471b98)['end']();};}function respondWithResult(_0x3106dd,_0x437078){_0x437078=_0x437078||0xc8;return function(_0x15a71f){if(_0x15a71f){return _0x3106dd[_0xbb3b('0x19')](_0x437078)['json'](_0x15a71f);}};}function respondWithFilteredResult(_0x21569d,_0x5f0f5e){return function(_0x468446){if(_0x468446){var _0x21f91a=_0x468446[_0xbb3b('0x1a')],_0x5e314c=_0x5f0f5e[_0xbb3b('0x1b')],_0x134935=_0x5f0f5e[_0xbb3b('0x1b')]+_0x5f0f5e['limit'],_0x5b3502;if(_0x134935>=_0x21f91a){_0x134935=_0x21f91a;_0x5b3502=0xc8;}else{_0x5b3502=0xce;}_0x21569d[_0xbb3b('0x19')](_0x5b3502);return _0x21569d['set'](_0xbb3b('0x1c'),_0x5e314c+'-'+_0x134935+'/'+_0x21f91a)[_0xbb3b('0x1d')](_0x468446);}return null;};}function patchUpdates(_0x2fc181){return function(_0x16789b){try{jsonpatch[_0xbb3b('0x1e')](_0x16789b,_0x2fc181,!![]);}catch(_0x5c396a){return BPromise[_0xbb3b('0x1f')](_0x5c396a);}return _0x16789b[_0xbb3b('0x20')]();};}function saveUpdates(_0x3d91fe,_0x50a823){return function(_0x54e6cd){if(_0x54e6cd){return _0x54e6cd[_0xbb3b('0x21')](_0x3d91fe)[_0xbb3b('0x22')](function(_0x34da46){return _0x34da46;});}return null;};}function removeEntity(_0x1f0ad5,_0x5e342c){return function(_0x16416f){if(_0x16416f){return _0x16416f[_0xbb3b('0x23')]()[_0xbb3b('0x22')](function(){_0x1f0ad5[_0xbb3b('0x19')](0xcc)[_0xbb3b('0x24')]();});}};}function handleEntityNotFound(_0x348187,_0x1edc5a){return function(_0xb69f8e){if(!_0xb69f8e){_0x348187[_0xbb3b('0x18')](0x194);}return _0xb69f8e;};}function handleError(_0x532748,_0x3da334){_0x3da334=_0x3da334||0x1f4;return function(_0xb36690){logger['error'](_0xb36690[_0xbb3b('0x25')]);if(_0xb36690[_0xbb3b('0x26')]){delete _0xb36690[_0xbb3b('0x26')];}_0x532748['status'](_0x3da334)['send'](_0xb36690);};}exports[_0xbb3b('0x27')]=function(_0x44ffb0,_0x9365fe){var _0xaef28d={},_0x123705={},_0x3e7b5f={'count':0x0,'rows':[]};var _0x15a458=_[_0xbb3b('0x28')](db[_0xbb3b('0x29')]['rawAttributes'],function(_0x735a09){return{'name':_0x735a09[_0xbb3b('0x2a')],'type':_0x735a09['type']['key']};});_0x123705[_0xbb3b('0x2b')]=_[_0xbb3b('0x28')](_0x15a458,_0xbb3b('0x26'));_0x123705[_0xbb3b('0x2c')]=_[_0xbb3b('0x2d')](_0x44ffb0[_0xbb3b('0x2c')]);_0x123705['filters']=_[_0xbb3b('0x2e')](_0x123705[_0xbb3b('0x2b')],_0x123705['query']);_0xaef28d[_0xbb3b('0x2f')]=_[_0xbb3b('0x2e')](_0x123705[_0xbb3b('0x2b')],qs[_0xbb3b('0x30')](_0x44ffb0[_0xbb3b('0x2c')]['fields']));_0xaef28d[_0xbb3b('0x2f')]=_0xaef28d[_0xbb3b('0x2f')]['length']?_0xaef28d[_0xbb3b('0x2f')]:_0x123705[_0xbb3b('0x2b')];if(!_0x44ffb0[_0xbb3b('0x2c')][_0xbb3b('0x31')]('nolimit')){_0xaef28d[_0xbb3b('0x32')]=qs[_0xbb3b('0x32')](_0x44ffb0[_0xbb3b('0x2c')]['limit']);_0xaef28d[_0xbb3b('0x1b')]=qs[_0xbb3b('0x1b')](_0x44ffb0['query']['offset']);}_0xaef28d['order']=qs['sort'](_0x44ffb0[_0xbb3b('0x2c')][_0xbb3b('0x33')]);_0xaef28d[_0xbb3b('0x34')]=qs['filters'](_[_0xbb3b('0x35')](_0x44ffb0[_0xbb3b('0x2c')],_0x123705[_0xbb3b('0x36')]),_0x15a458);if(_0x44ffb0[_0xbb3b('0x2c')]['filter']){_0xaef28d[_0xbb3b('0x34')]=_[_0xbb3b('0x37')](_0xaef28d['where'],{'$or':_[_0xbb3b('0x28')](_0x15a458,function(_0x3d3ae1){if(_0x3d3ae1[_0xbb3b('0x38')]!==_0xbb3b('0x39')){var _0x234c23={};_0x234c23[_0x3d3ae1['name']]={'$like':'%'+_0x44ffb0[_0xbb3b('0x2c')][_0xbb3b('0x3a')]+'%'};return _0x234c23;}})});}_0xaef28d=_[_0xbb3b('0x37')]({},_0xaef28d,_0x44ffb0[_0xbb3b('0x3b')]);var _0x3a1612={'where':_0xaef28d['where']};return db[_0xbb3b('0x29')][_0xbb3b('0x1a')](_0x3a1612)[_0xbb3b('0x22')](function(_0x4b931b){_0x3e7b5f['count']=_0x4b931b;if(_0x44ffb0[_0xbb3b('0x2c')][_0xbb3b('0x3c')]){_0xaef28d['include']=[{'all':!![]}];}return db[_0xbb3b('0x29')][_0xbb3b('0x3d')](_0xaef28d);})['then'](function(_0x390698){_0x3e7b5f['rows']=_0x390698;return _0x3e7b5f;})['then'](respondWithFilteredResult(_0x9365fe,_0xaef28d))[_0xbb3b('0x3e')](handleError(_0x9365fe,null));};exports['show']=function(_0x473304,_0x31c7de){var _0x2082d0={'raw':!![],'where':{'id':_0x473304[_0xbb3b('0x3f')]['id']}},_0x370971={};_0x370971['model']=_[_0xbb3b('0x2d')](db['CloudProvider'][_0xbb3b('0x40')]);_0x370971['query']=_['keys'](_0x473304['query']);_0x370971['filters']=_['intersection'](_0x370971['model'],_0x370971['query']);_0x2082d0[_0xbb3b('0x2f')]=_[_0xbb3b('0x2e')](_0x370971[_0xbb3b('0x2b')],qs['fields'](_0x473304[_0xbb3b('0x2c')]['fields']));_0x2082d0[_0xbb3b('0x2f')]=_0x2082d0[_0xbb3b('0x2f')]['length']?_0x2082d0['attributes']:_0x370971[_0xbb3b('0x2b')];if(_0x473304[_0xbb3b('0x2c')][_0xbb3b('0x3c')]){_0x2082d0[_0xbb3b('0x41')]=[{'all':!![]}];}_0x2082d0=_['merge']({},_0x2082d0,_0x473304[_0xbb3b('0x3b')]);return db[_0xbb3b('0x29')][_0xbb3b('0x42')](_0x2082d0)[_0xbb3b('0x22')](handleEntityNotFound(_0x31c7de,null))[_0xbb3b('0x22')](respondWithResult(_0x31c7de,null))[_0xbb3b('0x3e')](handleError(_0x31c7de,null));};exports[_0xbb3b('0x43')]=function(_0x21f20d,_0x1120f3){return db['CloudProvider']['create'](_0x21f20d[_0xbb3b('0x44')],{})[_0xbb3b('0x22')](respondWithResult(_0x1120f3,0xc9))[_0xbb3b('0x3e')](handleError(_0x1120f3,null));};exports[_0xbb3b('0x21')]=function(_0x13ae60,_0x695936){if(_0x13ae60[_0xbb3b('0x44')]['id']){delete _0x13ae60['body']['id'];}return db[_0xbb3b('0x29')][_0xbb3b('0x42')]({'where':{'id':_0x13ae60['params']['id']}})[_0xbb3b('0x22')](handleEntityNotFound(_0x695936,null))[_0xbb3b('0x22')](saveUpdates(_0x13ae60['body'],null))['then'](respondWithResult(_0x695936,null))['catch'](handleError(_0x695936,null));};exports[_0xbb3b('0x23')]=function(_0x78079a,_0x4c3328){return db[_0xbb3b('0x29')][_0xbb3b('0x42')]({'where':{'id':_0x78079a[_0xbb3b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4c3328,null))[_0xbb3b('0x22')](removeEntity(_0x4c3328,null))['catch'](handleError(_0x4c3328,null));}; \ No newline at end of file +var _0x2d89=['pick','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','findAll','catch','find','create','update','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','then','stack','name','send','index','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where'];(function(_0x2d386f,_0x20bf59){var _0x39dd59=function(_0x37c1ce){while(--_0x37c1ce){_0x2d386f['push'](_0x2d386f['shift']());}};_0x39dd59(++_0x20bf59);}(_0x2d89,0x1d6));var _0x92d8=function(_0x48a792,_0x5726d0){_0x48a792=_0x48a792-0x0;var _0x5c8f72=_0x2d89[_0x48a792];return _0x5c8f72;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x92d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92d8('0x1'));var jsonpatch=require(_0x92d8('0x2'));var rp=require(_0x92d8('0x3'));var moment=require(_0x92d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x92d8('0x5'));var util=require(_0x92d8('0x6'));var path=require('path');var sox=require(_0x92d8('0x7'));var csv=require(_0x92d8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x92d8('0x9'));var jsforce=require(_0x92d8('0xa'));var deskjs=require(_0x92d8('0xb'));var toCsv=require(_0x92d8('0x8'));var querystring=require(_0x92d8('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x92d8('0xd'));var qs=require(_0x92d8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x92d8('0xf'));var utils=require(_0x92d8('0x10'));var config=require(_0x92d8('0x11'));var db=require(_0x92d8('0x12'))['db'];function respondWithStatusCode(_0x3ffc47,_0x5a787c){_0x5a787c=_0x5a787c||0xcc;return function(_0x24ae70){if(_0x24ae70){return _0x3ffc47[_0x92d8('0x13')](_0x5a787c);}return _0x3ffc47['status'](_0x5a787c)[_0x92d8('0x14')]();};}function respondWithResult(_0x5e28d9,_0x13da04){_0x13da04=_0x13da04||0xc8;return function(_0x1fb484){if(_0x1fb484){return _0x5e28d9[_0x92d8('0x15')](_0x13da04)[_0x92d8('0x16')](_0x1fb484);}};}function respondWithFilteredResult(_0xa140a0,_0x554b53){return function(_0xe3746d){if(_0xe3746d){var _0x256b98=_0xe3746d[_0x92d8('0x17')],_0x3b862e=_0x554b53[_0x92d8('0x18')],_0x1fbe3a=_0x554b53[_0x92d8('0x18')]+_0x554b53[_0x92d8('0x19')],_0x3523d9;if(_0x1fbe3a>=_0x256b98){_0x1fbe3a=_0x256b98;_0x3523d9=0xc8;}else{_0x3523d9=0xce;}_0xa140a0[_0x92d8('0x15')](_0x3523d9);return _0xa140a0[_0x92d8('0x1a')]('Content-Range',_0x3b862e+'-'+_0x1fbe3a+'/'+_0x256b98)[_0x92d8('0x16')](_0xe3746d);}return null;};}function patchUpdates(_0x4cafcc){return function(_0x2a588d){try{jsonpatch[_0x92d8('0x1b')](_0x2a588d,_0x4cafcc,!![]);}catch(_0x1de987){return BPromise[_0x92d8('0x1c')](_0x1de987);}return _0x2a588d[_0x92d8('0x1d')]();};}function saveUpdates(_0x4ee379,_0x27638a){return function(_0x1efde9){if(_0x1efde9){return _0x1efde9['update'](_0x4ee379)[_0x92d8('0x1e')](function(_0x3d23d8){return _0x3d23d8;});}return null;};}function removeEntity(_0x4446d7,_0xb5f5fa){return function(_0xc007da){if(_0xc007da){return _0xc007da['destroy']()[_0x92d8('0x1e')](function(){_0x4446d7['status'](0xcc)[_0x92d8('0x14')]();});}};}function handleEntityNotFound(_0x493e6b,_0x44c797){return function(_0x5929c7){if(!_0x5929c7){_0x493e6b[_0x92d8('0x13')](0x194);}return _0x5929c7;};}function handleError(_0x22a6f5,_0x543a2f){_0x543a2f=_0x543a2f||0x1f4;return function(_0x2c5e7a){logger['error'](_0x2c5e7a[_0x92d8('0x1f')]);if(_0x2c5e7a['name']){delete _0x2c5e7a[_0x92d8('0x20')];}_0x22a6f5[_0x92d8('0x15')](_0x543a2f)[_0x92d8('0x21')](_0x2c5e7a);};}exports[_0x92d8('0x22')]=function(_0x566c23,_0x52e11c){var _0x71fdcf={},_0x1ae663={},_0x5d4dbe={'count':0x0,'rows':[]};var _0x263a2f=_['map'](db['CloudProvider'][_0x92d8('0x23')],function(_0x210cc0){return{'name':_0x210cc0[_0x92d8('0x24')],'type':_0x210cc0[_0x92d8('0x25')]['key']};});_0x1ae663['model']=_['map'](_0x263a2f,'name');_0x1ae663['query']=_[_0x92d8('0x26')](_0x566c23[_0x92d8('0x27')]);_0x1ae663[_0x92d8('0x28')]=_[_0x92d8('0x29')](_0x1ae663['model'],_0x1ae663['query']);_0x71fdcf[_0x92d8('0x2a')]=_['intersection'](_0x1ae663[_0x92d8('0x2b')],qs[_0x92d8('0x2c')](_0x566c23['query'][_0x92d8('0x2c')]));_0x71fdcf['attributes']=_0x71fdcf[_0x92d8('0x2a')][_0x92d8('0x2d')]?_0x71fdcf['attributes']:_0x1ae663['model'];if(!_0x566c23['query'][_0x92d8('0x2e')]('nolimit')){_0x71fdcf[_0x92d8('0x19')]=qs[_0x92d8('0x19')](_0x566c23[_0x92d8('0x27')]['limit']);_0x71fdcf['offset']=qs[_0x92d8('0x18')](_0x566c23['query'][_0x92d8('0x18')]);}_0x71fdcf[_0x92d8('0x2f')]=qs[_0x92d8('0x30')](_0x566c23[_0x92d8('0x27')][_0x92d8('0x30')]);_0x71fdcf[_0x92d8('0x31')]=qs[_0x92d8('0x28')](_[_0x92d8('0x32')](_0x566c23['query'],_0x1ae663[_0x92d8('0x28')]),_0x263a2f);if(_0x566c23[_0x92d8('0x27')][_0x92d8('0x33')]){_0x71fdcf['where']=_[_0x92d8('0x34')](_0x71fdcf['where'],{'$or':_['map'](_0x263a2f,function(_0xe683bd){if(_0xe683bd['type']!==_0x92d8('0x35')){var _0x5d0a10={};_0x5d0a10[_0xe683bd[_0x92d8('0x20')]]={'$like':'%'+_0x566c23[_0x92d8('0x27')][_0x92d8('0x33')]+'%'};return _0x5d0a10;}})});}_0x71fdcf=_[_0x92d8('0x34')]({},_0x71fdcf,_0x566c23[_0x92d8('0x36')]);var _0x333749={'where':_0x71fdcf[_0x92d8('0x31')]};return db[_0x92d8('0x37')][_0x92d8('0x17')](_0x333749)[_0x92d8('0x1e')](function(_0x2a8214){_0x5d4dbe[_0x92d8('0x17')]=_0x2a8214;if(_0x566c23[_0x92d8('0x27')][_0x92d8('0x38')]){_0x71fdcf[_0x92d8('0x39')]=[{'all':!![]}];}return db[_0x92d8('0x37')][_0x92d8('0x3a')](_0x71fdcf);})[_0x92d8('0x1e')](function(_0x4d9b1a){_0x5d4dbe['rows']=_0x4d9b1a;return _0x5d4dbe;})[_0x92d8('0x1e')](respondWithFilteredResult(_0x52e11c,_0x71fdcf))[_0x92d8('0x3b')](handleError(_0x52e11c,null));};exports['show']=function(_0x26cd80,_0x3d39ed){var _0x41f1f4={'raw':!![],'where':{'id':_0x26cd80['params']['id']}},_0x40eba7={};_0x40eba7['model']=_[_0x92d8('0x26')](db['CloudProvider'][_0x92d8('0x23')]);_0x40eba7['query']=_[_0x92d8('0x26')](_0x26cd80[_0x92d8('0x27')]);_0x40eba7[_0x92d8('0x28')]=_[_0x92d8('0x29')](_0x40eba7['model'],_0x40eba7[_0x92d8('0x27')]);_0x41f1f4[_0x92d8('0x2a')]=_['intersection'](_0x40eba7[_0x92d8('0x2b')],qs['fields'](_0x26cd80[_0x92d8('0x27')][_0x92d8('0x2c')]));_0x41f1f4[_0x92d8('0x2a')]=_0x41f1f4[_0x92d8('0x2a')][_0x92d8('0x2d')]?_0x41f1f4[_0x92d8('0x2a')]:_0x40eba7['model'];if(_0x26cd80[_0x92d8('0x27')][_0x92d8('0x38')]){_0x41f1f4[_0x92d8('0x39')]=[{'all':!![]}];}_0x41f1f4=_[_0x92d8('0x34')]({},_0x41f1f4,_0x26cd80[_0x92d8('0x36')]);return db[_0x92d8('0x37')][_0x92d8('0x3c')](_0x41f1f4)[_0x92d8('0x1e')](handleEntityNotFound(_0x3d39ed,null))[_0x92d8('0x1e')](respondWithResult(_0x3d39ed,null))[_0x92d8('0x3b')](handleError(_0x3d39ed,null));};exports[_0x92d8('0x3d')]=function(_0x1465ee,_0x168eec){return db['CloudProvider'][_0x92d8('0x3d')](_0x1465ee['body'],{})['then'](respondWithResult(_0x168eec,0xc9))['catch'](handleError(_0x168eec,null));};exports[_0x92d8('0x3e')]=function(_0xa4cf46,_0x1cf086){if(_0xa4cf46['body']['id']){delete _0xa4cf46[_0x92d8('0x3f')]['id'];}return db['CloudProvider'][_0x92d8('0x3c')]({'where':{'id':_0xa4cf46['params']['id']}})[_0x92d8('0x1e')](handleEntityNotFound(_0x1cf086,null))['then'](saveUpdates(_0xa4cf46['body'],null))[_0x92d8('0x1e')](respondWithResult(_0x1cf086,null))[_0x92d8('0x3b')](handleError(_0x1cf086,null));};exports['destroy']=function(_0x2ed4c4,_0xcf48f5){return db[_0x92d8('0x37')][_0x92d8('0x3c')]({'where':{'id':_0x2ed4c4[_0x92d8('0x40')]['id']}})[_0x92d8('0x1e')](handleEntityNotFound(_0xcf48f5,null))[_0x92d8('0x1e')](removeEntity(_0xcf48f5,null))[_0x92d8('0x3b')](handleError(_0xcf48f5,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 85e312e..e20432e 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 _0xf49b=['exports','define','CloudProvider','cloud_providers','lodash','api','moment','bluebird','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x5742c4,_0x5d94fc){var _0x3eecc9=function(_0x1a8a56){while(--_0x1a8a56){_0x5742c4['push'](_0x5742c4['shift']());}};_0x3eecc9(++_0x5d94fc);}(_0xf49b,0x9e));var _0xbf49=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf49b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbf49('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbf49('0x1'));var moment=require(_0xbf49('0x2'));var BPromise=require(_0xbf49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf49('0x4'));var config=require(_0xbf49('0x5'));var attributes=require(_0xbf49('0x6'));module[_0xbf49('0x7')]=function(_0x4576c3,_0x2d7529){return _0x4576c3[_0xbf49('0x8')](_0xbf49('0x9'),attributes,{'tableName':_0xbf49('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05a1=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','CloudProvider','cloud_providers','lodash'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x05a1,0xa4));var _0x105a=function(_0xa5d427,_0x45bae6){_0xa5d427=_0xa5d427-0x0;var _0x44fdc4=_0x05a1[_0xa5d427];return _0x44fdc4;};'use strict';var _=require(_0x105a('0x0'));var util=require(_0x105a('0x1'));var logger=require('../../config/logger')(_0x105a('0x2'));var moment=require(_0x105a('0x3'));var BPromise=require(_0x105a('0x4'));var rp=require(_0x105a('0x5'));var fs=require('fs');var path=require(_0x105a('0x6'));var rimraf=require(_0x105a('0x7'));var config=require(_0x105a('0x8'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x4eb39b,_0x4b3b80){return _0x4eb39b['define'](_0x105a('0x9'),attributes,{'tableName':_0x105a('0xa'),'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 d08f9af..ef53720 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 _0xa1be=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa1be,0x158));var _0xea1b=function(_0x3d5976,_0x1e4c7c){_0x3d5976=_0x3d5976-0x0;var _0x29df50=_0xa1be[_0x3d5976];return _0x29df50;};'use strict';var _=require(_0xea1b('0x0'));var util=require(_0xea1b('0x1'));var moment=require(_0xea1b('0x2'));var BPromise=require(_0xea1b('0x3'));var rs=require(_0xea1b('0x4'));var fs=require('fs');var Redis=require(_0xea1b('0x5'));var db=require(_0xea1b('0x6'))['db'];var utils=require(_0xea1b('0x7'));var logger=require(_0xea1b('0x8'))(_0xea1b('0x9'));var config=require(_0xea1b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xea1b('0xb')][_0xea1b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc992ef,_0x1e2000,_0x2673ac){return new BPromise(function(_0x2f9ea1,_0x4590a8){return client[_0xea1b('0xd')](_0xc992ef,_0x2673ac)[_0xea1b('0xe')](function(_0x30fac8){logger[_0xea1b('0xf')](_0xea1b('0x10'),_0x1e2000,_0xea1b('0x11'));logger[_0xea1b('0x12')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1e2000,_0xea1b('0x11'),JSON['stringify'](_0x30fac8));if(_0x30fac8[_0xea1b('0x13')]){if(_0x30fac8[_0xea1b('0x13')][_0xea1b('0x14')]===0x1f4){logger[_0xea1b('0x13')](_0xea1b('0x10'),_0x1e2000,_0x30fac8['error'][_0xea1b('0x15')]);return _0x4590a8(_0x30fac8[_0xea1b('0x13')][_0xea1b('0x15')]);}logger[_0xea1b('0x13')](_0xea1b('0x10'),_0x1e2000,_0x30fac8['error'][_0xea1b('0x15')]);return _0x2f9ea1(_0x30fac8[_0xea1b('0x13')][_0xea1b('0x15')]);}else{logger[_0xea1b('0xf')]('CloudProvider,\x20%s,\x20%s',_0x1e2000,_0xea1b('0x11'));_0x2f9ea1(_0x30fac8[_0xea1b('0x16')][_0xea1b('0x15')]);}})[_0xea1b('0x17')](function(_0x3f5dca){logger[_0xea1b('0x13')](_0xea1b('0x10'),_0x1e2000,_0x3f5dca);_0x4590a8(_0x3f5dca);});});} \ No newline at end of file +var _0xc571=['request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc571,0x7b));var _0x1c57=function(_0x6287b6,_0x5682e7){_0x6287b6=_0x6287b6-0x0;var _0x5d6be4=_0xc571[_0x6287b6];return _0x5d6be4;};'use strict';var _=require(_0x1c57('0x0'));var util=require(_0x1c57('0x1'));var moment=require(_0x1c57('0x2'));var BPromise=require(_0x1c57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c57('0x4'));var db=require(_0x1c57('0x5'))['db'];var utils=require(_0x1c57('0x6'));var logger=require('../../config/logger')(_0x1c57('0x7'));var config=require('../../config/environment');var jayson=require(_0x1c57('0x8'));var client=jayson[_0x1c57('0x9')][_0x1c57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439211,_0x14d8c5,_0x33a51e){return new BPromise(function(_0x4533f6,_0x20242e){return client[_0x1c57('0xb')](_0x439211,_0x33a51e)[_0x1c57('0xc')](function(_0x258836){logger[_0x1c57('0xd')](_0x1c57('0xe'),_0x14d8c5,_0x1c57('0xf'));logger[_0x1c57('0x10')](_0x1c57('0x11'),_0x14d8c5,_0x1c57('0xf'),JSON[_0x1c57('0x12')](_0x258836));if(_0x258836[_0x1c57('0x13')]){if(_0x258836[_0x1c57('0x13')][_0x1c57('0x14')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x14d8c5,_0x258836['error'][_0x1c57('0x15')]);return _0x20242e(_0x258836[_0x1c57('0x13')][_0x1c57('0x15')]);}logger[_0x1c57('0x13')](_0x1c57('0xe'),_0x14d8c5,_0x258836[_0x1c57('0x13')]['message']);return _0x4533f6(_0x258836[_0x1c57('0x13')]['message']);}else{logger[_0x1c57('0xd')](_0x1c57('0xe'),_0x14d8c5,'request\x20sent');_0x4533f6(_0x258836['result'][_0x1c57('0x15')]);}})[_0x1c57('0x16')](function(_0x4dee10){logger['error']('CloudProvider,\x20%s,\x20%s',_0x14d8c5,_0x4dee10);_0x20242e(_0x4dee10);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index bbb3c89..c8dbfe8 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 _0xb086=['index','get','show','create','put','/:id','update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x484d46,_0x573649){var _0x5482ba=function(_0x408482){while(--_0x408482){_0x484d46['push'](_0x484d46['shift']());}};_0x5482ba(++_0x573649);}(_0xb086,0x80));var _0x6b08=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb086[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x6b08('0x0'));var util=require(_0x6b08('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b08('0x2'));var router=express[_0x6b08('0x3')]();var auth=require(_0x6b08('0x4'));var interaction=require(_0x6b08('0x5'));var config=require(_0x6b08('0x6'));var controller=require('./cloudProvider.controller');router['get']('/',auth[_0x6b08('0x7')](),controller[_0x6b08('0x8')]);router[_0x6b08('0x9')]('/:id',auth[_0x6b08('0x7')](),controller[_0x6b08('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6b08('0xb')]);router[_0x6b08('0xc')](_0x6b08('0xd'),auth[_0x6b08('0x7')](),controller[_0x6b08('0xe')]);router[_0x6b08('0xf')](_0x6b08('0xd'),auth[_0x6b08('0x7')](),controller[_0x6b08('0x10')]);module['exports']=router; \ No newline at end of file +var _0x878c=['delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','./cloudProvider.controller','index','get','/:id','show','isAuthenticated','create','put','update'];(function(_0x1d8819,_0x3d45dc){var _0x2122c4=function(_0x51a361){while(--_0x51a361){_0x1d8819['push'](_0x1d8819['shift']());}};_0x2122c4(++_0x3d45dc);}(_0x878c,0x134));var _0xc878=function(_0x918732,_0x1abae3){_0x918732=_0x918732-0x0;var _0x246a9a=_0x878c[_0x918732];return _0x246a9a;};'use strict';var multer=require(_0xc878('0x0'));var util=require(_0xc878('0x1'));var path=require('path');var timeout=require(_0xc878('0x2'));var express=require(_0xc878('0x3'));var router=express[_0xc878('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc878('0x5'));var config=require('../../config/environment');var controller=require(_0xc878('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc878('0x7')]);router[_0xc878('0x8')](_0xc878('0x9'),auth['isAuthenticated'](),controller[_0xc878('0xa')]);router['post']('/',auth[_0xc878('0xb')](),controller[_0xc878('0xc')]);router[_0xc878('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc878('0xe')]);router[_0xc878('0xf')](_0xc878('0x9'),auth[_0xc878('0xb')](),controller[_0xc878('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 71e45d9..5dccb21 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 _0x81d4=['STRING','name','sequelize','exports'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x81d4,0xa2));var _0x481d=function(_0x1b3ef4,_0x1e581a){_0x1b3ef4=_0x1b3ef4-0x0;var _0x59f974=_0x81d4[_0x1b3ef4];return _0x59f974;};'use strict';var Sequelize=require(_0x481d('0x0'));module[_0x481d('0x1')]={'name':{'type':Sequelize[_0x481d('0x2')],'unique':_0x481d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x481d('0x2')]},'website':{'type':Sequelize[_0x481d('0x2')]},'phone':{'type':Sequelize[_0x481d('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x481d('0x2')]},'postalCode':{'type':Sequelize[_0x481d('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x481d('0x2')]},'email':{'type':Sequelize[_0x481d('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x481d('0x2')]},'sStreet':{'type':Sequelize[_0x481d('0x2')]},'sPostalCode':{'type':Sequelize[_0x481d('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x481d('0x2')]},'description':{'type':Sequelize[_0x481d('0x2')]}}; \ No newline at end of file +var _0x6530=['exports','STRING','sequelize'];(function(_0x51de1d,_0x2d15d7){var _0x38705c=function(_0x16e924){while(--_0x16e924){_0x51de1d['push'](_0x51de1d['shift']());}};_0x38705c(++_0x2d15d7);}(_0x6530,0x1d3));var _0x0653=function(_0x9d0c16,_0x228248){_0x9d0c16=_0x9d0c16-0x0;var _0x2b48cf=_0x6530[_0x9d0c16];return _0x2b48cf;};'use strict';var Sequelize=require(_0x0653('0x0'));module[_0x0653('0x1')]={'name':{'type':Sequelize[_0x0653('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0653('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x0653('0x2')]},'phone':{'type':Sequelize[_0x0653('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0653('0x2')]},'street':{'type':Sequelize[_0x0653('0x2')]},'postalCode':{'type':Sequelize[_0x0653('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0653('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0653('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x0653('0x2')]},'sCity':{'type':Sequelize[_0x0653('0x2')]},'sCountry':{'type':Sequelize[_0x0653('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 77ac570..58b644a 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 _0x183b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','map','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','user','role','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','omit','sort','getContacts','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x59de2a,_0x264f62){var _0x1d18d2=function(_0x5c1a5a){while(--_0x5c1a5a){_0x59de2a['push'](_0x59de2a['shift']());}};_0x1d18d2(++_0x264f62);}(_0x183b,0xf5));var _0xb183=function(_0x13ebc2,_0x45c866){_0x13ebc2=_0x13ebc2-0x0;var _0x7335af=_0x183b[_0x13ebc2];return _0x7335af;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb183('0x0'));var rimraf=require(_0xb183('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb183('0x2'));var moment=require(_0xb183('0x3'));var BPromise=require(_0xb183('0x4'));var Mustache=require(_0xb183('0x5'));var util=require('util');var path=require(_0xb183('0x6'));var sox=require('sox');var csv=require(_0xb183('0x7'));var ejs=require(_0xb183('0x8'));var fs=require('fs');var _=require(_0xb183('0x9'));var squel=require(_0xb183('0xa'));var crypto=require(_0xb183('0xb'));var jsforce=require(_0xb183('0xc'));var deskjs=require(_0xb183('0xd'));var toCsv=require(_0xb183('0x7'));var querystring=require(_0xb183('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb183('0xf'));var qs=require(_0xb183('0x10'));var as=require(_0xb183('0x11'));var hardwareService=require(_0xb183('0x12'));var logger=require(_0xb183('0x13'))(_0xb183('0x14'));var utils=require('../../config/utils');var config=require(_0xb183('0x15'));var db=require(_0xb183('0x16'))['db'];function respondWithStatusCode(_0x452e26,_0x531a97){_0x531a97=_0x531a97||0xcc;return function(_0x46b168){if(_0x46b168){return _0x452e26[_0xb183('0x17')](_0x531a97);}return _0x452e26[_0xb183('0x18')](_0x531a97)[_0xb183('0x19')]();};}function respondWithResult(_0x2acf47,_0x4ad380){_0x4ad380=_0x4ad380||0xc8;return function(_0x126b5d){if(_0x126b5d){return _0x2acf47['status'](_0x4ad380)['json'](_0x126b5d);}};}function respondWithFilteredResult(_0x196f9e,_0x2f281e){return function(_0x411a0c){if(_0x411a0c){var _0x3ef580=_0x411a0c[_0xb183('0x1a')],_0x34be2d=_0x2f281e['offset'],_0x279d50=_0x2f281e[_0xb183('0x1b')]+_0x2f281e['limit'],_0x29d8d2;if(_0x279d50>=_0x3ef580){_0x279d50=_0x3ef580;_0x29d8d2=0xc8;}else{_0x29d8d2=0xce;}_0x196f9e['status'](_0x29d8d2);return _0x196f9e[_0xb183('0x1c')](_0xb183('0x1d'),_0x34be2d+'-'+_0x279d50+'/'+_0x3ef580)[_0xb183('0x1e')](_0x411a0c);}return null;};}function patchUpdates(_0x5c2f41){return function(_0x19d764){try{jsonpatch[_0xb183('0x1f')](_0x19d764,_0x5c2f41,!![]);}catch(_0x57cd28){return BPromise[_0xb183('0x20')](_0x57cd28);}return _0x19d764[_0xb183('0x21')]();};}function saveUpdates(_0x531109,_0x29a1f1){return function(_0x352d19){if(_0x352d19){return _0x352d19[_0xb183('0x22')](_0x531109)[_0xb183('0x23')](function(_0x9c047f){return _0x9c047f;});}return null;};}function removeEntity(_0x3cdfa2,_0x5974b5){return function(_0xa7e6f3){if(_0xa7e6f3){return _0xa7e6f3[_0xb183('0x24')]()['then'](function(){var _0x13ced5=_0xa7e6f3[_0xb183('0x25')]({'plain':!![]});var _0x443017='Companies';return db[_0xb183('0x26')]['destroy']({'where':{'type':_0x443017,'resourceId':_0x13ced5['id']}})['then'](function(){return _0xa7e6f3;});})['then'](function(){_0x3cdfa2[_0xb183('0x18')](0xcc)[_0xb183('0x19')]();});}};}function handleEntityNotFound(_0x3fe8d7,_0x4d0634){return function(_0x5ddf0c){if(!_0x5ddf0c){_0x3fe8d7[_0xb183('0x17')](0x194);}return _0x5ddf0c;};}function handleError(_0x43273b,_0x5ee604){_0x5ee604=_0x5ee604||0x1f4;return function(_0x29857f){logger[_0xb183('0x27')](_0x29857f[_0xb183('0x28')]);if(_0x29857f[_0xb183('0x29')]){delete _0x29857f[_0xb183('0x29')];}_0x43273b[_0xb183('0x18')](_0x5ee604)[_0xb183('0x2a')](_0x29857f);};}exports[_0xb183('0x2b')]=function(_0x2abf95,_0x5afda4){var _0x5c6d79={},_0x5bcf22={},_0x5a7358={'count':0x0,'rows':[]};return db['CmCompany'][_0xb183('0x2c')]()['then'](function(_0x2db6ee){_0x5bcf22[_0xb183('0x2d')]=_[_0xb183('0x2e')](_0x2db6ee);_0x5bcf22[_0xb183('0x2f')]=_['keys'](_0x2abf95[_0xb183('0x2f')]);_0x5bcf22[_0xb183('0x30')]=_[_0xb183('0x31')](_0x5bcf22['model'],_0x5bcf22['query']);_0x5c6d79[_0xb183('0x32')]=_[_0xb183('0x31')](_0x5bcf22[_0xb183('0x2d')],qs[_0xb183('0x33')](_0x2abf95['query'][_0xb183('0x33')]));_0x5c6d79['attributes']=_0x5c6d79['attributes']['length']?_0x5c6d79[_0xb183('0x32')]:_0x5bcf22['model'];if(!_0x2abf95[_0xb183('0x2f')][_0xb183('0x34')](_0xb183('0x35'))){_0x5c6d79[_0xb183('0x36')]=qs[_0xb183('0x36')](_0x2abf95['query'][_0xb183('0x36')]);_0x5c6d79[_0xb183('0x1b')]=qs[_0xb183('0x1b')](_0x2abf95[_0xb183('0x2f')][_0xb183('0x1b')]);}_0x5c6d79[_0xb183('0x37')]=qs['sort'](_0x2abf95[_0xb183('0x2f')]['sort']);_0x5c6d79[_0xb183('0x38')]=qs[_0xb183('0x30')](_[_0xb183('0x39')](_0x2abf95['query'],_0x5bcf22[_0xb183('0x30')]),_0x2db6ee);if(_0x2abf95['query'][_0xb183('0x3a')]){_0x5c6d79[_0xb183('0x38')]=_[_0xb183('0x3b')](_0x5c6d79[_0xb183('0x38')],{'$or':_[_0xb183('0x3c')](_0x5c6d79[_0xb183('0x32')],function(_0x15db18){var _0x575e03={};_0x575e03[_0x15db18]={'$like':'%'+_0x2abf95[_0xb183('0x2f')][_0xb183('0x3a')]+'%'};return _0x575e03;})});}_0x5c6d79=_[_0xb183('0x3b')]({},_0x5c6d79,_0x2abf95['options']);var _0x68d23d={'where':_0x5c6d79['where']};return db[_0xb183('0x3d')][_0xb183('0x1a')](_0x68d23d)[_0xb183('0x23')](function(_0x1fee01){_0x5a7358[_0xb183('0x1a')]=_0x1fee01;if(_0x2abf95['query'][_0xb183('0x3e')]){_0x5c6d79[_0xb183('0x3f')]=[{'all':!![]}];}return db['CmCompany'][_0xb183('0x40')](_0x5c6d79);})[_0xb183('0x23')](function(_0x3683b3){_0x5a7358[_0xb183('0x41')]=_0x3683b3;return _0x5a7358;})[_0xb183('0x23')](respondWithFilteredResult(_0x5afda4,_0x5c6d79))[_0xb183('0x42')](handleError(_0x5afda4,null));})['catch'](handleError(_0x5afda4,null));};exports[_0xb183('0x43')]=function(_0x5e9cb8,_0x1c3c73){var _0x56ad7d={'raw':![],'where':{'id':_0x5e9cb8[_0xb183('0x44')]['id']}},_0x37e533={};_0x37e533[_0xb183('0x2d')]=_['keys'](db[_0xb183('0x3d')][_0xb183('0x45')]);_0x37e533[_0xb183('0x2f')]=_[_0xb183('0x2e')](_0x5e9cb8[_0xb183('0x2f')]);_0x37e533[_0xb183('0x30')]=_[_0xb183('0x31')](_0x37e533['model'],_0x37e533[_0xb183('0x2f')]);_0x56ad7d[_0xb183('0x32')]=_['intersection'](_0x37e533['model'],qs[_0xb183('0x33')](_0x5e9cb8[_0xb183('0x2f')][_0xb183('0x33')]));_0x56ad7d[_0xb183('0x32')]=_0x56ad7d[_0xb183('0x32')][_0xb183('0x46')]?_0x56ad7d[_0xb183('0x32')]:_0x37e533[_0xb183('0x2d')];if(_0x5e9cb8[_0xb183('0x2f')][_0xb183('0x3e')]){_0x56ad7d[_0xb183('0x3f')]=[{'all':!![]}];}_0x56ad7d=_[_0xb183('0x3b')]({},_0x56ad7d,_0x5e9cb8[_0xb183('0x47')]);return db['CmCompany'][_0xb183('0x48')](_0x56ad7d)[_0xb183('0x23')](handleEntityNotFound(_0x1c3c73,null))[_0xb183('0x23')](respondWithResult(_0x1c3c73,null))['catch'](handleError(_0x1c3c73,null));};exports[_0xb183('0x49')]=function(_0x3b28d4,_0x42b797){return db[_0xb183('0x3d')][_0xb183('0x49')](_0x3b28d4['body'],{})[_0xb183('0x23')](function(_0x4549f3){var _0x5af262=_0x3b28d4[_0xb183('0x4a')]['get']({'plain':!![]});if(!_0x5af262)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5af262[_0xb183('0x4b')]===_0xb183('0x4a')){var _0xb85648=_0x4549f3[_0xb183('0x25')]({'plain':!![]});var _0x3df907=_0xb183('0x4c');return db[_0xb183('0x4d')]['find']({'where':{'name':_0x3df907,'userProfileId':_0x5af262[_0xb183('0x4e')]},'raw':!![]})[_0xb183('0x23')](function(_0x2ad8eb){if(_0x2ad8eb&&_0x2ad8eb['autoAssociation']===0x0){return db[_0xb183('0x26')][_0xb183('0x49')]({'name':_0xb85648[_0xb183('0x29')],'resourceId':_0xb85648['id'],'type':_0x2ad8eb[_0xb183('0x29')],'sectionId':_0x2ad8eb['id']},{})['then'](function(){return _0x4549f3;});}else{return _0x4549f3;}})[_0xb183('0x42')](function(_0x5b8758){logger['error'](_0xb183('0x4f'),_0x5b8758);throw _0x5b8758;});}return _0x4549f3;})[_0xb183('0x23')](respondWithResult(_0x42b797,0xc9))[_0xb183('0x42')](handleError(_0x42b797,null));};exports[_0xb183('0x22')]=function(_0x566204,_0x126c0b){if(_0x566204[_0xb183('0x50')]['id']){delete _0x566204[_0xb183('0x50')]['id'];}return db[_0xb183('0x3d')][_0xb183('0x48')]({'where':{'id':_0x566204[_0xb183('0x44')]['id']}})[_0xb183('0x23')](handleEntityNotFound(_0x126c0b,null))['then'](saveUpdates(_0x566204['body'],null))[_0xb183('0x23')](respondWithResult(_0x126c0b,null))[_0xb183('0x42')](handleError(_0x126c0b,null));};exports[_0xb183('0x24')]=function(_0x20a76e,_0xf43766){return db[_0xb183('0x3d')]['find']({'where':{'id':_0x20a76e['params']['id']}})[_0xb183('0x23')](handleEntityNotFound(_0xf43766,null))[_0xb183('0x23')](removeEntity(_0xf43766,null))['catch'](handleError(_0xf43766,null));};exports['describe']=function(_0x4f4ec8,_0x1bc3b2){return db[_0xb183('0x3d')][_0xb183('0x2c')]()[_0xb183('0x23')](respondWithResult(_0x1bc3b2,null))[_0xb183('0x42')](handleError(_0x1bc3b2,null));};exports[_0xb183('0x51')]=function(_0x4852d6,_0x511a48,_0x2cb343){return db[_0xb183('0x52')][_0xb183('0x48')]({'where':{'id':_0x4852d6[_0xb183('0x44')]['id']}})[_0xb183('0x23')](handleEntityNotFound(_0x511a48,null))[_0xb183('0x23')](function(_0x1e54c8){if(_0x1e54c8){return _0x1e54c8[_0xb183('0x51')](_0x4852d6[_0xb183('0x50')][_0xb183('0x53')],_[_0xb183('0x54')](_0x4852d6[_0xb183('0x50')],['ids','id'])||{});}})[_0xb183('0x23')](respondWithResult(_0x511a48,null))[_0xb183('0x42')](handleError(_0x511a48,null));};exports['getContacts']=function(_0x2af312,_0x3e6174,_0x5d7954){var _0x4000bd={};var _0x492cde={};var _0x2500c0;var _0x306c66;return db[_0xb183('0x3d')]['findOne']({'where':{'id':_0x2af312[_0xb183('0x44')]['id']}})[_0xb183('0x23')](handleEntityNotFound(_0x3e6174,null))[_0xb183('0x23')](function(_0x20ff25){if(_0x20ff25){_0x2500c0=_0x20ff25;_0x492cde[_0xb183('0x2d')]=_[_0xb183('0x2e')](db['CmContact']['rawAttributes']);_0x492cde[_0xb183('0x2f')]=_[_0xb183('0x2e')](_0x2af312[_0xb183('0x2f')]);_0x492cde[_0xb183('0x30')]=_[_0xb183('0x31')](_0x492cde[_0xb183('0x2d')],_0x492cde[_0xb183('0x2f')]);_0x4000bd[_0xb183('0x32')]=_[_0xb183('0x31')](_0x492cde[_0xb183('0x2d')],qs['fields'](_0x2af312[_0xb183('0x2f')][_0xb183('0x33')]));_0x4000bd[_0xb183('0x32')]=_0x4000bd[_0xb183('0x32')][_0xb183('0x46')]?_0x4000bd[_0xb183('0x32')]:_0x492cde[_0xb183('0x2d')];_0x4000bd[_0xb183('0x37')]=qs['sort'](_0x2af312[_0xb183('0x2f')][_0xb183('0x55')]);_0x4000bd[_0xb183('0x38')]=qs['filters'](_[_0xb183('0x39')](_0x2af312[_0xb183('0x2f')],_0x492cde[_0xb183('0x30')]));if(_0x2af312[_0xb183('0x2f')][_0xb183('0x3a')]){_0x4000bd[_0xb183('0x38')]=_[_0xb183('0x3b')](_0x4000bd['where'],{'$or':_[_0xb183('0x3c')](_0x4000bd['attributes'],function(_0x4ef9f4){var _0x5b77c7={};_0x5b77c7[_0x4ef9f4]={'$like':'%'+_0x2af312[_0xb183('0x2f')][_0xb183('0x3a')]+'%'};return _0x5b77c7;})});}_0x4000bd=_[_0xb183('0x3b')]({},_0x4000bd,_0x2af312[_0xb183('0x47')]);return _0x2500c0[_0xb183('0x56')](_0x4000bd);}})[_0xb183('0x23')](function(_0x5a41cf){if(_0x5a41cf){_0x306c66=_0x5a41cf[_0xb183('0x46')];if(!_0x2af312['query'][_0xb183('0x34')](_0xb183('0x35'))){_0x4000bd[_0xb183('0x36')]=qs[_0xb183('0x36')](_0x2af312[_0xb183('0x2f')][_0xb183('0x36')]);_0x4000bd[_0xb183('0x1b')]=qs[_0xb183('0x1b')](_0x2af312[_0xb183('0x2f')]['offset']);}return _0x2500c0['getContacts'](_0x4000bd);}})[_0xb183('0x23')](function(_0x3fd6a7){if(_0x3fd6a7){return _0x3fd6a7?{'count':_0x306c66,'rows':_0x3fd6a7}:null;}})[_0xb183('0x23')](respondWithResult(_0x3e6174,null))['catch'](handleError(_0x3e6174,null));}; \ No newline at end of file +var _0x6e52=['reject','save','update','then','destroy','get','Companies','sendStatus','name','index','CmCompany','describe','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','map','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','getContacts','findOne','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','count','offset','limit','set','apply'];(function(_0x8252ef,_0x4ba7bd){var _0x4e4a3e=function(_0x348115){while(--_0x348115){_0x8252ef['push'](_0x8252ef['shift']());}};_0x4e4a3e(++_0x4ba7bd);}(_0x6e52,0x12d));var _0x26e5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e52[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x26e5('0x0'));var emlformat=require(_0x26e5('0x1'));var rimraf=require(_0x26e5('0x2'));var zipdir=require(_0x26e5('0x3'));var jsonpatch=require(_0x26e5('0x4'));var rp=require(_0x26e5('0x5'));var moment=require(_0x26e5('0x6'));var BPromise=require(_0x26e5('0x7'));var Mustache=require(_0x26e5('0x8'));var util=require('util');var path=require(_0x26e5('0x9'));var sox=require(_0x26e5('0xa'));var csv=require(_0x26e5('0xb'));var ejs=require(_0x26e5('0xc'));var fs=require('fs');var _=require(_0x26e5('0xd'));var squel=require(_0x26e5('0xe'));var crypto=require(_0x26e5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x26e5('0x10'));var toCsv=require(_0x26e5('0xb'));var querystring=require('querystring');var Papa=require(_0x26e5('0x11'));var Redis=require(_0x26e5('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x26e5('0x13'));var hardwareService=require(_0x26e5('0x14'));var logger=require('../../config/logger')(_0x26e5('0x15'));var utils=require(_0x26e5('0x16'));var config=require(_0x26e5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47865c,_0x2a982a){_0x2a982a=_0x2a982a||0xcc;return function(_0x5df7c3){if(_0x5df7c3){return _0x47865c['sendStatus'](_0x2a982a);}return _0x47865c[_0x26e5('0x18')](_0x2a982a)[_0x26e5('0x19')]();};}function respondWithResult(_0xffe88a,_0x1da88c){_0x1da88c=_0x1da88c||0xc8;return function(_0x16043b){if(_0x16043b){return _0xffe88a[_0x26e5('0x18')](_0x1da88c)['json'](_0x16043b);}};}function respondWithFilteredResult(_0x50671c,_0x15a9b9){return function(_0x3cfb25){if(_0x3cfb25){var _0x4eca2a=_0x3cfb25[_0x26e5('0x1a')],_0x5df654=_0x15a9b9[_0x26e5('0x1b')],_0x5c95bf=_0x15a9b9[_0x26e5('0x1b')]+_0x15a9b9[_0x26e5('0x1c')],_0x23eafc;if(_0x5c95bf>=_0x4eca2a){_0x5c95bf=_0x4eca2a;_0x23eafc=0xc8;}else{_0x23eafc=0xce;}_0x50671c[_0x26e5('0x18')](_0x23eafc);return _0x50671c[_0x26e5('0x1d')]('Content-Range',_0x5df654+'-'+_0x5c95bf+'/'+_0x4eca2a)['json'](_0x3cfb25);}return null;};}function patchUpdates(_0x39ec47){return function(_0x1d7964){try{jsonpatch[_0x26e5('0x1e')](_0x1d7964,_0x39ec47,!![]);}catch(_0x194715){return BPromise[_0x26e5('0x1f')](_0x194715);}return _0x1d7964[_0x26e5('0x20')]();};}function saveUpdates(_0x3c5d1c,_0x104f60){return function(_0x16cc84){if(_0x16cc84){return _0x16cc84[_0x26e5('0x21')](_0x3c5d1c)[_0x26e5('0x22')](function(_0x3f26ae){return _0x3f26ae;});}return null;};}function removeEntity(_0x44579e,_0x297fd9){return function(_0x22959a){if(_0x22959a){return _0x22959a[_0x26e5('0x23')]()[_0x26e5('0x22')](function(){var _0x46b12a=_0x22959a[_0x26e5('0x24')]({'plain':!![]});var _0x2e2bae=_0x26e5('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e2bae,'resourceId':_0x46b12a['id']}})['then'](function(){return _0x22959a;});})[_0x26e5('0x22')](function(){_0x44579e['status'](0xcc)[_0x26e5('0x19')]();});}};}function handleEntityNotFound(_0x5047ca,_0x23c7ff){return function(_0x5475c3){if(!_0x5475c3){_0x5047ca[_0x26e5('0x26')](0x194);}return _0x5475c3;};}function handleError(_0x1ee391,_0x352cc4){_0x352cc4=_0x352cc4||0x1f4;return function(_0x13d848){logger['error'](_0x13d848['stack']);if(_0x13d848[_0x26e5('0x27')]){delete _0x13d848['name'];}_0x1ee391[_0x26e5('0x18')](_0x352cc4)['send'](_0x13d848);};}exports[_0x26e5('0x28')]=function(_0x261b36,_0x2505bd){var _0x39df69={},_0x330962={},_0x1dd034={'count':0x0,'rows':[]};return db[_0x26e5('0x29')][_0x26e5('0x2a')]()[_0x26e5('0x22')](function(_0x905dc2){_0x330962['model']=_[_0x26e5('0x2b')](_0x905dc2);_0x330962[_0x26e5('0x2c')]=_[_0x26e5('0x2b')](_0x261b36[_0x26e5('0x2c')]);_0x330962['filters']=_[_0x26e5('0x2d')](_0x330962[_0x26e5('0x2e')],_0x330962[_0x26e5('0x2c')]);_0x39df69[_0x26e5('0x2f')]=_['intersection'](_0x330962[_0x26e5('0x2e')],qs[_0x26e5('0x30')](_0x261b36[_0x26e5('0x2c')][_0x26e5('0x30')]));_0x39df69['attributes']=_0x39df69[_0x26e5('0x2f')][_0x26e5('0x31')]?_0x39df69[_0x26e5('0x2f')]:_0x330962['model'];if(!_0x261b36['query'][_0x26e5('0x32')](_0x26e5('0x33'))){_0x39df69[_0x26e5('0x1c')]=qs[_0x26e5('0x1c')](_0x261b36['query']['limit']);_0x39df69[_0x26e5('0x1b')]=qs[_0x26e5('0x1b')](_0x261b36['query']['offset']);}_0x39df69['order']=qs[_0x26e5('0x34')](_0x261b36[_0x26e5('0x2c')]['sort']);_0x39df69['where']=qs[_0x26e5('0x35')](_[_0x26e5('0x36')](_0x261b36['query'],_0x330962['filters']),_0x905dc2);if(_0x261b36[_0x26e5('0x2c')][_0x26e5('0x37')]){_0x39df69[_0x26e5('0x38')]=_[_0x26e5('0x39')](_0x39df69['where'],{'$or':_[_0x26e5('0x3a')](_0x39df69['attributes'],function(_0x46bc6c){var _0x30f7a7={};_0x30f7a7[_0x46bc6c]={'$like':'%'+_0x261b36[_0x26e5('0x2c')][_0x26e5('0x37')]+'%'};return _0x30f7a7;})});}_0x39df69=_[_0x26e5('0x39')]({},_0x39df69,_0x261b36['options']);var _0xf382d8={'where':_0x39df69[_0x26e5('0x38')]};return db['CmCompany'][_0x26e5('0x1a')](_0xf382d8)[_0x26e5('0x22')](function(_0x1ba8ee){_0x1dd034[_0x26e5('0x1a')]=_0x1ba8ee;if(_0x261b36['query'][_0x26e5('0x3b')]){_0x39df69[_0x26e5('0x3c')]=[{'all':!![]}];}return db[_0x26e5('0x29')][_0x26e5('0x3d')](_0x39df69);})[_0x26e5('0x22')](function(_0x37172a){_0x1dd034[_0x26e5('0x3e')]=_0x37172a;return _0x1dd034;})[_0x26e5('0x22')](respondWithFilteredResult(_0x2505bd,_0x39df69))[_0x26e5('0x3f')](handleError(_0x2505bd,null));})['catch'](handleError(_0x2505bd,null));};exports[_0x26e5('0x40')]=function(_0x2a4fbe,_0x29b6a6){var _0x4826a0={'raw':![],'where':{'id':_0x2a4fbe[_0x26e5('0x41')]['id']}},_0x19fa41={};_0x19fa41['model']=_[_0x26e5('0x2b')](db[_0x26e5('0x29')][_0x26e5('0x42')]);_0x19fa41[_0x26e5('0x2c')]=_['keys'](_0x2a4fbe['query']);_0x19fa41[_0x26e5('0x35')]=_[_0x26e5('0x2d')](_0x19fa41['model'],_0x19fa41[_0x26e5('0x2c')]);_0x4826a0['attributes']=_[_0x26e5('0x2d')](_0x19fa41[_0x26e5('0x2e')],qs[_0x26e5('0x30')](_0x2a4fbe['query']['fields']));_0x4826a0[_0x26e5('0x2f')]=_0x4826a0[_0x26e5('0x2f')][_0x26e5('0x31')]?_0x4826a0['attributes']:_0x19fa41[_0x26e5('0x2e')];if(_0x2a4fbe[_0x26e5('0x2c')][_0x26e5('0x3b')]){_0x4826a0['include']=[{'all':!![]}];}_0x4826a0=_[_0x26e5('0x39')]({},_0x4826a0,_0x2a4fbe[_0x26e5('0x43')]);return db[_0x26e5('0x29')][_0x26e5('0x44')](_0x4826a0)['then'](handleEntityNotFound(_0x29b6a6,null))[_0x26e5('0x22')](respondWithResult(_0x29b6a6,null))[_0x26e5('0x3f')](handleError(_0x29b6a6,null));};exports['create']=function(_0x339070,_0x208dc8){return db[_0x26e5('0x29')]['create'](_0x339070[_0x26e5('0x45')],{})[_0x26e5('0x22')](function(_0x1cf0b9){var _0x30ee3a=_0x339070[_0x26e5('0x46')][_0x26e5('0x24')]({'plain':!![]});if(!_0x30ee3a)throw new Error(_0x26e5('0x47'));if(_0x30ee3a[_0x26e5('0x48')]===_0x26e5('0x46')){var _0x181b6d=_0x1cf0b9[_0x26e5('0x24')]({'plain':!![]});var _0x4abd86='Companies';return db[_0x26e5('0x49')][_0x26e5('0x44')]({'where':{'name':_0x4abd86,'userProfileId':_0x30ee3a['userProfileId']},'raw':!![]})[_0x26e5('0x22')](function(_0x2b5c8e){if(_0x2b5c8e&&_0x2b5c8e[_0x26e5('0x4a')]===0x0){return db['UserProfileResource'][_0x26e5('0x4b')]({'name':_0x181b6d[_0x26e5('0x27')],'resourceId':_0x181b6d['id'],'type':_0x2b5c8e[_0x26e5('0x27')],'sectionId':_0x2b5c8e['id']},{})[_0x26e5('0x22')](function(){return _0x1cf0b9;});}else{return _0x1cf0b9;}})[_0x26e5('0x3f')](function(_0x24647d){logger['error'](_0x26e5('0x4c'),_0x24647d);throw _0x24647d;});}return _0x1cf0b9;})[_0x26e5('0x22')](respondWithResult(_0x208dc8,0xc9))[_0x26e5('0x3f')](handleError(_0x208dc8,null));};exports[_0x26e5('0x21')]=function(_0x392900,_0x4a0eb1){if(_0x392900[_0x26e5('0x45')]['id']){delete _0x392900[_0x26e5('0x45')]['id'];}return db[_0x26e5('0x29')][_0x26e5('0x44')]({'where':{'id':_0x392900[_0x26e5('0x41')]['id']}})[_0x26e5('0x22')](handleEntityNotFound(_0x4a0eb1,null))[_0x26e5('0x22')](saveUpdates(_0x392900['body'],null))[_0x26e5('0x22')](respondWithResult(_0x4a0eb1,null))[_0x26e5('0x3f')](handleError(_0x4a0eb1,null));};exports[_0x26e5('0x23')]=function(_0x693ff8,_0x2cedb0){return db[_0x26e5('0x29')]['find']({'where':{'id':_0x693ff8['params']['id']}})[_0x26e5('0x22')](handleEntityNotFound(_0x2cedb0,null))['then'](removeEntity(_0x2cedb0,null))['catch'](handleError(_0x2cedb0,null));};exports['describe']=function(_0x342f10,_0x377837){return db[_0x26e5('0x29')][_0x26e5('0x2a')]()[_0x26e5('0x22')](respondWithResult(_0x377837,null))['catch'](handleError(_0x377837,null));};exports[_0x26e5('0x4d')]=function(_0x24e44b,_0xf124e4,_0x3df72a){return db[_0x26e5('0x4e')]['find']({'where':{'id':_0x24e44b[_0x26e5('0x41')]['id']}})[_0x26e5('0x22')](handleEntityNotFound(_0xf124e4,null))[_0x26e5('0x22')](function(_0x5bfcc8){if(_0x5bfcc8){return _0x5bfcc8[_0x26e5('0x4d')](_0x24e44b[_0x26e5('0x45')][_0x26e5('0x4f')],_['omit'](_0x24e44b['body'],[_0x26e5('0x4f'),'id'])||{});}})[_0x26e5('0x22')](respondWithResult(_0xf124e4,null))['catch'](handleError(_0xf124e4,null));};exports[_0x26e5('0x50')]=function(_0x564dea,_0x27be3e,_0x11c188){var _0x53e581={};var _0x4608a9={};var _0x551997;var _0x266e35;return db[_0x26e5('0x29')][_0x26e5('0x51')]({'where':{'id':_0x564dea[_0x26e5('0x41')]['id']}})[_0x26e5('0x22')](handleEntityNotFound(_0x27be3e,null))[_0x26e5('0x22')](function(_0x22ddfd){if(_0x22ddfd){_0x551997=_0x22ddfd;_0x4608a9[_0x26e5('0x2e')]=_[_0x26e5('0x2b')](db[_0x26e5('0x4e')]['rawAttributes']);_0x4608a9[_0x26e5('0x2c')]=_[_0x26e5('0x2b')](_0x564dea[_0x26e5('0x2c')]);_0x4608a9[_0x26e5('0x35')]=_[_0x26e5('0x2d')](_0x4608a9[_0x26e5('0x2e')],_0x4608a9[_0x26e5('0x2c')]);_0x53e581[_0x26e5('0x2f')]=_[_0x26e5('0x2d')](_0x4608a9[_0x26e5('0x2e')],qs[_0x26e5('0x30')](_0x564dea[_0x26e5('0x2c')][_0x26e5('0x30')]));_0x53e581[_0x26e5('0x2f')]=_0x53e581['attributes']['length']?_0x53e581[_0x26e5('0x2f')]:_0x4608a9[_0x26e5('0x2e')];_0x53e581[_0x26e5('0x52')]=qs[_0x26e5('0x34')](_0x564dea['query']['sort']);_0x53e581[_0x26e5('0x38')]=qs[_0x26e5('0x35')](_[_0x26e5('0x36')](_0x564dea[_0x26e5('0x2c')],_0x4608a9['filters']));if(_0x564dea[_0x26e5('0x2c')][_0x26e5('0x37')]){_0x53e581[_0x26e5('0x38')]=_[_0x26e5('0x39')](_0x53e581['where'],{'$or':_[_0x26e5('0x3a')](_0x53e581[_0x26e5('0x2f')],function(_0x1970ca){var _0x30b793={};_0x30b793[_0x1970ca]={'$like':'%'+_0x564dea[_0x26e5('0x2c')]['filter']+'%'};return _0x30b793;})});}_0x53e581=_[_0x26e5('0x39')]({},_0x53e581,_0x564dea['options']);return _0x551997['getContacts'](_0x53e581);}})[_0x26e5('0x22')](function(_0x9d2156){if(_0x9d2156){_0x266e35=_0x9d2156[_0x26e5('0x31')];if(!_0x564dea['query'][_0x26e5('0x32')](_0x26e5('0x33'))){_0x53e581[_0x26e5('0x1c')]=qs[_0x26e5('0x1c')](_0x564dea[_0x26e5('0x2c')][_0x26e5('0x1c')]);_0x53e581[_0x26e5('0x1b')]=qs[_0x26e5('0x1b')](_0x564dea['query'][_0x26e5('0x1b')]);}return _0x551997['getContacts'](_0x53e581);}})[_0x26e5('0x22')](function(_0x49d10f){if(_0x49d10f){return _0x49d10f?{'count':_0x266e35,'rows':_0x49d10f}:null;}})[_0x26e5('0x22')](respondWithResult(_0x27be3e,null))[_0x26e5('0x3f')](handleError(_0x27be3e,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 5ef4498..7bdee17 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 _0x9d21=['rimraf','./cmCompany.attributes','define','CmCompany','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9d21,0x1d0));var _0x19d2=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x9d21[_0x2d2ca2];return _0x48489d;};'use strict';var _=require(_0x19d2('0x0'));var util=require(_0x19d2('0x1'));var logger=require(_0x19d2('0x2'))('api');var moment=require(_0x19d2('0x3'));var BPromise=require(_0x19d2('0x4'));var rp=require(_0x19d2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19d2('0x6'));var config=require('../../config/environment');var attributes=require(_0x19d2('0x7'));module['exports']=function(_0x2abb81,_0x85b7a9){return _0x2abb81[_0x19d2('0x8')](_0x19d2('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c29=['request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','lodash','../../config/logger','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5c29,0x9d));var _0x95c2=function(_0x4a7ecc,_0x210e7b){_0x4a7ecc=_0x4a7ecc-0x0;var _0x337026=_0x5c29[_0x4a7ecc];return _0x337026;};'use strict';var _=require(_0x95c2('0x0'));var util=require('util');var logger=require(_0x95c2('0x1'))('api');var moment=require(_0x95c2('0x2'));var BPromise=require('bluebird');var rp=require(_0x95c2('0x3'));var fs=require('fs');var path=require(_0x95c2('0x4'));var rimraf=require(_0x95c2('0x5'));var config=require(_0x95c2('0x6'));var attributes=require(_0x95c2('0x7'));module[_0x95c2('0x8')]=function(_0xa43a0f,_0x1b7c82){return _0xa43a0f[_0x95c2('0x9')]('CmCompany',attributes,{'tableName':'cm_companies','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 fefc770..6ad14d1 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 _0x53b1=['../../mysqldb','../../config/utils','../../config/logger','client','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCompany,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x53b1,0xa3));var _0x153b=function(_0xaac590,_0x17fb75){_0xaac590=_0xaac590-0x0;var _0xd3039b=_0x53b1[_0xaac590];return _0xd3039b;};'use strict';var _=require(_0x153b('0x0'));var util=require(_0x153b('0x1'));var moment=require('moment');var BPromise=require(_0x153b('0x2'));var rs=require(_0x153b('0x3'));var fs=require('fs');var Redis=require(_0x153b('0x4'));var db=require(_0x153b('0x5'))['db'];var utils=require(_0x153b('0x6'));var logger=require(_0x153b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x153b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x248aae,_0x5343cf,_0x4c29b1){return new BPromise(function(_0x194802,_0x5c19cc){return client['request'](_0x248aae,_0x4c29b1)[_0x153b('0x9')](function(_0x1e838c){logger[_0x153b('0xa')]('CmCompany,\x20%s,\x20%s',_0x5343cf,_0x153b('0xb'));logger[_0x153b('0xc')](_0x153b('0xd'),_0x5343cf,_0x153b('0xb'),JSON[_0x153b('0xe')](_0x1e838c));if(_0x1e838c['error']){if(_0x1e838c[_0x153b('0xf')][_0x153b('0x10')]===0x1f4){logger[_0x153b('0xf')]('CmCompany,\x20%s,\x20%s',_0x5343cf,_0x1e838c['error']['message']);return _0x5c19cc(_0x1e838c['error'][_0x153b('0x11')]);}logger[_0x153b('0xf')](_0x153b('0x12'),_0x5343cf,_0x1e838c[_0x153b('0xf')][_0x153b('0x11')]);return _0x194802(_0x1e838c[_0x153b('0xf')][_0x153b('0x11')]);}else{logger['info'](_0x153b('0x12'),_0x5343cf,_0x153b('0xb'));_0x194802(_0x1e838c[_0x153b('0x13')][_0x153b('0x11')]);}})[_0x153b('0x14')](function(_0xd60967){logger[_0x153b('0xf')](_0x153b('0x12'),_0x5343cf,_0xd60967);_0x5c19cc(_0xd60967);});});} \ No newline at end of file +var _0x9ab4=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmCompany,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5e785b,_0x54fee3){var _0x4aa134=function(_0x59c079){while(--_0x59c079){_0x5e785b['push'](_0x5e785b['shift']());}};_0x4aa134(++_0x54fee3);}(_0x9ab4,0x1a7));var _0x49ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ab4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x49ab('0x0'));var util=require(_0x49ab('0x1'));var moment=require(_0x49ab('0x2'));var BPromise=require(_0x49ab('0x3'));var rs=require(_0x49ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49ab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x49ab('0x6'))(_0x49ab('0x7'));var config=require(_0x49ab('0x8'));var jayson=require(_0x49ab('0x9'));var client=jayson[_0x49ab('0xa')][_0x49ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf809f5,_0x4adef8,_0x494587){return new BPromise(function(_0x221551,_0x1f88ec){return client['request'](_0xf809f5,_0x494587)[_0x49ab('0xc')](function(_0x3a8476){logger['info'](_0x49ab('0xd'),_0x4adef8,_0x49ab('0xe'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x4adef8,_0x49ab('0xe'),JSON[_0x49ab('0xf')](_0x3a8476));if(_0x3a8476[_0x49ab('0x10')]){if(_0x3a8476[_0x49ab('0x10')][_0x49ab('0x11')]===0x1f4){logger[_0x49ab('0x10')](_0x49ab('0xd'),_0x4adef8,_0x3a8476[_0x49ab('0x10')]['message']);return _0x1f88ec(_0x3a8476['error'][_0x49ab('0x12')]);}logger[_0x49ab('0x10')](_0x49ab('0xd'),_0x4adef8,_0x3a8476['error']['message']);return _0x221551(_0x3a8476[_0x49ab('0x10')][_0x49ab('0x12')]);}else{logger[_0x49ab('0x13')](_0x49ab('0xd'),_0x4adef8,_0x49ab('0xe'));_0x221551(_0x3a8476[_0x49ab('0x14')][_0x49ab('0x12')]);}})[_0x49ab('0x15')](function(_0x36dc09){logger[_0x49ab('0x10')](_0x49ab('0xd'),_0x4adef8,_0x36dc09);_0x1f88ec(_0x36dc09);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index bac2b96..7ef112d 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmCompany.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0xe'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0xedd9=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','util'];(function(_0x28517a,_0x2061e6){var _0xe0b7ba=function(_0x4593bd){while(--_0x4593bd){_0x28517a['push'](_0x28517a['shift']());}};_0xe0b7ba(++_0x2061e6);}(_0xedd9,0xfc));var _0x9edd=function(_0x1f938f,_0x51c241){_0x1f938f=_0x1f938f-0x0;var _0x5d701f=_0xedd9[_0x1f938f];return _0x5d701f;};'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('./cmCompany.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['get'](_0x9edd('0xd'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0xf')]('/:id/contacts',auth[_0x9edd('0x9')](),controller[_0x9edd('0x11')]);router[_0x9edd('0x12')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x13')]);router[_0x9edd('0x14')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0x15')]);module[_0x9edd('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 057bad1..f1a1ee9 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 _0x9779=['INTEGER','UNSIGNED','DATE','lodash','exports','STRING','TEXT'];(function(_0x334b0d,_0x33f2f1){var _0x5bbe11=function(_0x1413f0){while(--_0x1413f0){_0x334b0d['push'](_0x334b0d['shift']());}};_0x5bbe11(++_0x33f2f1);}(_0x9779,0x1ed));var _0x9977=function(_0x28c7c0,_0x3d8b68){_0x28c7c0=_0x28c7c0-0x0;var _0x13a553=_0x9779[_0x28c7c0];return _0x13a553;};'use strict';var _=require(_0x9977('0x0'));var Sequelize=require('sequelize');module[_0x9977('0x1')]={'firstName':{'type':Sequelize[_0x9977('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x9977('0x2')]},'street':{'type':Sequelize[_0x9977('0x2')]},'postalCode':{'type':Sequelize[_0x9977('0x2')]},'city':{'type':Sequelize[_0x9977('0x2')]},'country':{'type':Sequelize[_0x9977('0x2')]},'dateOfBirth':{'type':Sequelize[_0x9977('0x2')]},'description':{'type':Sequelize[_0x9977('0x3')]},'phone':{'type':Sequelize[_0x9977('0x2')]},'mobile':{'type':Sequelize[_0x9977('0x2')]},'fax':{'type':Sequelize[_0x9977('0x2')]},'email':{'type':Sequelize[_0x9977('0x2')]},'url':{'type':Sequelize[_0x9977('0x2')]},'facebook':{'type':Sequelize[_0x9977('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x9977('0x2')]},'teams':{'type':Sequelize[_0x9977('0x2')]},'viber':{'type':Sequelize[_0x9977('0x2')]},'line':{'type':Sequelize[_0x9977('0x2')]},'wechat':{'type':Sequelize[_0x9977('0x2')]},'telegram':{'type':Sequelize[_0x9977('0x2')]},'UserId':{'type':Sequelize[_0x9977('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9977('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9977('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x9977('0x2')]},'utcOffset':{'type':Sequelize[_0x9977('0x4')]}}; \ No newline at end of file +var _0xd4ba=['TEXT','INTEGER','DATE','NOW','lodash','exports','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd4ba,0x131));var _0xad4b=function(_0x2049b1,_0x11fd0c){_0x2049b1=_0x2049b1-0x0;var _0x59b710=_0xd4ba[_0x2049b1];return _0x59b710;};'use strict';var _=require(_0xad4b('0x0'));var Sequelize=require('sequelize');module[_0xad4b('0x1')]={'firstName':{'type':Sequelize[_0xad4b('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xad4b('0x2')]},'street':{'type':Sequelize[_0xad4b('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xad4b('0x2')]},'country':{'type':Sequelize[_0xad4b('0x2')]},'dateOfBirth':{'type':Sequelize[_0xad4b('0x2')]},'description':{'type':Sequelize[_0xad4b('0x3')]},'phone':{'type':Sequelize[_0xad4b('0x2')]},'mobile':{'type':Sequelize[_0xad4b('0x2')]},'fax':{'type':Sequelize[_0xad4b('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xad4b('0x2')]},'fb_data':{'type':Sequelize[_0xad4b('0x2')]},'twitter':{'type':Sequelize[_0xad4b('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xad4b('0x2')]},'viber':{'type':Sequelize[_0xad4b('0x2')]},'line':{'type':Sequelize[_0xad4b('0x2')]},'wechat':{'type':Sequelize[_0xad4b('0x2')]},'telegram':{'type':Sequelize[_0xad4b('0x2')]},'UserId':{'type':Sequelize[_0xad4b('0x4')]},'priority':{'type':Sequelize[_0xad4b('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xad4b('0x5')],'defaultValue':Sequelize[_0xad4b('0x6')]},'dialTimezone':{'type':Sequelize[_0xad4b('0x2')]},'utcOffset':{'type':Sequelize[_0xad4b('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index dabece3..7e4a376 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 _0x44ef=['order','having','t.id\x20IN\x20?','resolve','some','User','user','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','c.firstName','c.phone','c.mobile','c.fax','c.email','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','catch','describe','startsWith','displayName','custom','columnName','body','findAll','get','mergeWith','tags','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','join','bulkCreate','each','duplicates','findOrCreate','spread','error','show','$and','format','cf_%d','params','omit','pickBy','table','id\x20=\x20?','toParam','phone','getTags','findOne','rawAttributes','pick','options','setTags','ids','ContactId','includeAll','rows','getHopperHistories','CmHopperHistory','include','getJscriptySessions','JscriptySessionReport','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','CompanyId','json','pid','upload','createReadStream','agent','binding','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','redis','localhost','./cmContact.socket','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','then','destroy','name','send','CmContact','keys','length','cf_','push','CmCustomField','all','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','select','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','conditions','find','Tag','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','and','uc.UserId\x20=\x20?','value','dateOfBirth','fieldType','datetime','buildExpression','type','text','end','filter','isNil','Contact','isEmpty','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x44ef,0x160));var _0xf44e=function(_0x4acee5,_0x2ffcc1){_0x4acee5=_0x4acee5-0x0;var _0x266997=_0x44ef[_0x4acee5];return _0x266997;};'use strict';var pdf=require(_0xf44e('0x0'));var emlformat=require(_0xf44e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf44e('0x2'));var jsonpatch=require(_0xf44e('0x3'));var rp=require('request-promise');var moment=require(_0xf44e('0x4'));var BPromise=require(_0xf44e('0x5'));var Mustache=require(_0xf44e('0x6'));var util=require('util');var path=require(_0xf44e('0x7'));var sox=require(_0xf44e('0x8'));var csv=require(_0xf44e('0x9'));var ejs=require(_0xf44e('0xa'));var fs=require('fs');var _=require(_0xf44e('0xb'));var squel=require(_0xf44e('0xc'));var crypto=require(_0xf44e('0xd'));var jsforce=require(_0xf44e('0xe'));var deskjs=require(_0xf44e('0xf'));var toCsv=require(_0xf44e('0x9'));var querystring=require(_0xf44e('0x10'));var Papa=require(_0xf44e('0x11'));var Redis=require(_0xf44e('0x12'));var authService=require(_0xf44e('0x13'));var qs=require(_0xf44e('0x14'));var as=require(_0xf44e('0x15'));var hardwareService=require(_0xf44e('0x16'));var logger=require(_0xf44e('0x17'))(_0xf44e('0x18'));var utils=require(_0xf44e('0x19'));var config=require(_0xf44e('0x1a'));var db=require(_0xf44e('0x1b'))['db'];config[_0xf44e('0x1c')]=_['defaults'](config['redis'],{'host':_0xf44e('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf44e('0x1c')]));require(_0xf44e('0x1e'))['register'](socket);function respondWithStatusCode(_0x47b7ff,_0xe47053){_0xe47053=_0xe47053||0xcc;return function(_0x533de3){if(_0x533de3){return _0x47b7ff[_0xf44e('0x1f')](_0xe47053);}return _0x47b7ff['status'](_0xe47053)['end']();};}function respondWithResult(_0x40f4e3,_0x4bd7ae){_0x4bd7ae=_0x4bd7ae||0xc8;return function(_0x3a45b4){if(_0x3a45b4){return _0x40f4e3[_0xf44e('0x20')](_0x4bd7ae)['json'](_0x3a45b4);}};}function respondWithFilteredResult(_0x17b2eb,_0xe965f){return function(_0x186eef){if(_0x186eef){var _0x54bc60=_0x186eef[_0xf44e('0x21')],_0x5cd8e3=_0xe965f[_0xf44e('0x22')],_0x5341c7=_0xe965f[_0xf44e('0x22')]+_0xe965f[_0xf44e('0x23')],_0x2c3917;if(_0x5341c7>=_0x54bc60){_0x5341c7=_0x54bc60;_0x2c3917=0xc8;}else{_0x2c3917=0xce;}_0x17b2eb['status'](_0x2c3917);return _0x17b2eb[_0xf44e('0x24')](_0xf44e('0x25'),_0x5cd8e3+'-'+_0x5341c7+'/'+_0x54bc60)['json'](_0x186eef);}return null;};}function patchUpdates(_0x432289){return function(_0x7986df){try{jsonpatch[_0xf44e('0x26')](_0x7986df,_0x432289,!![]);}catch(_0x1090a0){return BPromise[_0xf44e('0x27')](_0x1090a0);}return _0x7986df['save']();};}function saveUpdates(_0xabf0b2,_0x7f85e){return function(_0x47ebe9){if(_0x47ebe9){return _0x47ebe9['update'](_0xabf0b2)[_0xf44e('0x28')](function(_0x3cee8a){return _0x3cee8a;});}return null;};}function removeEntity(_0x2ef46e,_0x1d7dab){return function(_0xd7e639){if(_0xd7e639){return _0xd7e639[_0xf44e('0x29')]()[_0xf44e('0x28')](function(){_0x2ef46e[_0xf44e('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33e615,_0x49fd39){return function(_0x299fbf){if(!_0x299fbf){_0x33e615['sendStatus'](0x194);}return _0x299fbf;};}function handleError(_0x5ebd64,_0x5a62ef){_0x5a62ef=_0x5a62ef||0x1f4;return function(_0x6ae284){logger['error'](_0x6ae284['stack']);if(_0x6ae284[_0xf44e('0x2a')]){delete _0x6ae284[_0xf44e('0x2a')];}_0x5ebd64[_0xf44e('0x20')](_0x5a62ef)[_0xf44e('0x2b')](_0x6ae284);};}exports['index']=function(_0x1d2505,_0x28fab4){var _0x416c29={},_0x43b345={},_0x99530b={'count':0x0,'rows':[]};return db[_0xf44e('0x2c')]['describe']()[_0xf44e('0x28')](function(_0x4c34e1){var _0xa4c808=[];for(var _0x171ffa=0x0;_0x171ffa0x1){_0x366805['or'](_0xf44e('0x66'),qs['getFullTextValue'](_0x448559),null);}else{if(qs[_0xf44e('0x67')](_0x448559)){_0x366805['or'](_0xf44e('0x68'),_0x448559+'%');_0x366805['or'](_0xf44e('0x69'),_0x448559+'%');_0x366805['or'](_0xf44e('0x6a'),_0x448559+'%');_0x366805['or']('c.fax\x20LIKE\x20?',_0x448559+'%');}else if(qs['isEmail'](_0x448559)){_0x366805['or'](_0xf44e('0x6b'),_0x448559+'%');}else{_0x366805['or']('c.firstName\x20LIKE\x20?','%'+_0x448559+'%');_0x366805['or'](_0xf44e('0x6c'),'%'+_0x448559+'%');_0x366805['or'](_0xf44e('0x6b'),'%'+_0x448559+'%');}}}}_0x16f4ab[_0xf44e('0x3c')](_0x366805);_0x16f4ab[_0xf44e('0x6d')](_0xf44e('0x6e'));var _0x1ae5ac={'type':db[_0xf44e('0x6f')][_0xf44e('0x70')][_0xf44e('0x71')],'raw':!![]};var _0x5d7799=_0x16f4ab['clone']()[_0xf44e('0x3e')]('c.id');if(_0x416c29[_0xf44e('0x72')]){_0x416c29[_0xf44e('0x72')][_0xf44e('0x50')](function(_0x24ac58){_0x16f4ab[_0xf44e('0x72')]('c.'+_0x24ac58[0x0],_0x24ac58[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0xf4fcbd)){_0x16f4ab[_0xf44e('0x73')](_0x55a683);_0x5d7799[_0xf44e('0x3c')](_0xf44e('0x74'),_0xf4fcbd);}BPromise[_0xf44e('0x75')]()['then'](function(){if(_0x63c3bf&&!_[_0xf44e('0x76')](_0x63c3bf[_0xf44e('0x4c')],[_0xf44e('0x3e'),_0xf44e('0x77')])){return _0x1d2505[_0xf44e('0x78')][_0xf44e('0x79')]({'attributes':['id'],'raw':!![]})[_0xf44e('0x28')](function(_0xb7bc9b){if(_[_0xf44e('0x5f')](_0xb7bc9b)){_0x5d7799[_0xf44e('0x3c')](_0xf44e('0x7a'));_0x16f4ab[_0xf44e('0x3c')](_0xf44e('0x7a'));}else{_0x5d7799['where'](_0xf44e('0x7b'),_[_0xf44e('0x4f')](_0xb7bc9b,'id'));_0x16f4ab['where'](_0xf44e('0x7b'),_['map'](_0xb7bc9b,'id'));}});}else{return;}})[_0xf44e('0x28')](function(){db[_0xf44e('0x7c')][_0xf44e('0x34')](_0x5d7799['toString'](),_0x1ae5ac)[_0xf44e('0x28')](function(_0x5407f8){_0x99530b[_0xf44e('0x21')]=_0x5407f8[_0xf44e('0x2e')];if(_0x99530b[_0xf44e('0x21')]===0x0)return[];return db['sequelize'][_0xf44e('0x34')](_0x7b1658[_0xf44e('0x7d')](),_0x1ae5ac);})[_0xf44e('0x28')](function(_0x5790cb){_0x3466b4=_[_0xf44e('0x7e')](_0x5790cb,'id');_0x1ae5ac=_[_0xf44e('0x7f')](_0x1ae5ac,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1d2505[_0xf44e('0x34')][_0xf44e('0x37')]){_0x416c29[_0xf44e('0x38')][_0xf44e('0x50')](function(_0x46553c){_0x16f4ab[_0xf44e('0x3e')]('c.'+_0x46553c);});}else{_0x16f4ab[_0xf44e('0x3e')]('c.id');_0x16f4ab[_0xf44e('0x3e')](_0xf44e('0x80'));_0x16f4ab[_0xf44e('0x3e')]('c.lastName');_0x16f4ab['field'](_0xf44e('0x81'));_0x16f4ab[_0xf44e('0x3e')](_0xf44e('0x82'));_0x16f4ab['field'](_0xf44e('0x83'));_0x16f4ab['field'](_0xf44e('0x84'));_0x16f4ab[_0xf44e('0x3e')]('c.ListId');_0x16f4ab[_0xf44e('0x3e')]('c.deletedAt');_0x16f4ab['field'](_0xf44e('0x85'),'TagIds');}if(_0x416c29[_0xf44e('0x23')])_0x16f4ab[_0xf44e('0x23')](_0x416c29[_0xf44e('0x23')]);if(_0x416c29[_0xf44e('0x22')])_0x16f4ab['offset'](_0x416c29[_0xf44e('0x22')]);return db[_0xf44e('0x7c')][_0xf44e('0x34')](_0x16f4ab[_0xf44e('0x7d')](),_0x1ae5ac);})[_0xf44e('0x28')](function(_0x221cf6){_0x221cf6[_0xf44e('0x50')](function(_0x3aeae9){if(_0x3aeae9[_0xf44e('0x86')]){_0x3aeae9['Tags']=[];_0x3aeae9[_0xf44e('0x86')]['split'](',')[_0xf44e('0x50')](function(_0x3444ff){_0x3aeae9['Tags'][_0xf44e('0x30')](_0x3466b4[_0x3444ff]);});}delete _0x3aeae9['TagIds'];});_0x99530b['rows']=_0x221cf6;return _0x99530b;})[_0xf44e('0x28')](respondWithFilteredResult(_0x28fab4,_0x416c29));});})[_0xf44e('0x87')](handleError(_0x28fab4,null));};exports[_0xf44e('0x29')]=function(_0x2768c2,_0x2427ac){return db['CmContact']['find']({'where':{'id':_0x2768c2['params']['id']}})[_0xf44e('0x28')](handleEntityNotFound(_0x2427ac,null))['then'](removeEntity(_0x2427ac,null))['catch'](handleError(_0x2427ac,null));};exports[_0xf44e('0x88')]=function(_0x1f3eac,_0x4b0771){return db['CmContact'][_0xf44e('0x88')]()['then'](function(_0x16b822){delete _0x16b822['tags'];for(var _0x3282c9=0x0;_0x3282c9=_0xe5452e){_0x4e5433=_0xe5452e;_0xdc8c6e=0xc8;}else{_0xdc8c6e=0xce;}_0x251b22[_0xd24b('0x1b')](_0xdc8c6e);return _0x251b22[_0xd24b('0x1f')]('Content-Range',_0x1ac514+'-'+_0x4e5433+'/'+_0xe5452e)[_0xd24b('0x1c')](_0x1d9f93);}return null;};}function patchUpdates(_0x5e42d6){return function(_0x5d3d46){try{jsonpatch['apply'](_0x5d3d46,_0x5e42d6,!![]);}catch(_0x153010){return BPromise[_0xd24b('0x20')](_0x153010);}return _0x5d3d46[_0xd24b('0x21')]();};}function saveUpdates(_0x17335b,_0x4ff6f5){return function(_0x168df8){if(_0x168df8){return _0x168df8[_0xd24b('0x22')](_0x17335b)['then'](function(_0x2d599c){return _0x2d599c;});}return null;};}function removeEntity(_0x27f37c,_0xe6f87d){return function(_0x535c3e){if(_0x535c3e){return _0x535c3e[_0xd24b('0x23')]()[_0xd24b('0x24')](function(){_0x27f37c[_0xd24b('0x1b')](0xcc)[_0xd24b('0x1a')]();});}};}function handleEntityNotFound(_0x3cdfd8,_0x5925de){return function(_0x4baf07){if(!_0x4baf07){_0x3cdfd8['sendStatus'](0x194);}return _0x4baf07;};}function handleError(_0x239590,_0x13222c){_0x13222c=_0x13222c||0x1f4;return function(_0x3ecbed){logger[_0xd24b('0x25')](_0x3ecbed[_0xd24b('0x26')]);if(_0x3ecbed[_0xd24b('0x27')]){delete _0x3ecbed['name'];}_0x239590[_0xd24b('0x1b')](_0x13222c)[_0xd24b('0x28')](_0x3ecbed);};}exports[_0xd24b('0x29')]=function(_0x251f97,_0x2d0aa2){var _0x12f78e={},_0x37c0e3={},_0x388152={'count':0x0,'rows':[]};return db[_0xd24b('0x2a')][_0xd24b('0x2b')]()[_0xd24b('0x24')](function(_0xc08afa){var _0x171e6a=[];for(var _0x15c471=0x0;_0x15c4710x1){_0x5473ad['or'](_0xd24b('0x68'),qs[_0xd24b('0x69')](_0x345fcc),null);}else{if(qs[_0xd24b('0x6a')](_0x345fcc)){_0x5473ad['or'](_0xd24b('0x6b'),_0x345fcc+'%');_0x5473ad['or'](_0xd24b('0x6c'),_0x345fcc+'%');_0x5473ad['or']('c.mobile\x20LIKE\x20?',_0x345fcc+'%');_0x5473ad['or']('c.fax\x20LIKE\x20?',_0x345fcc+'%');}else if(qs[_0xd24b('0x6d')](_0x345fcc)){_0x5473ad['or']('c.email\x20LIKE\x20?',_0x345fcc+'%');}else{_0x5473ad['or'](_0xd24b('0x6e'),'%'+_0x345fcc+'%');_0x5473ad['or'](_0xd24b('0x6f'),'%'+_0x345fcc+'%');_0x5473ad['or'](_0xd24b('0x70'),'%'+_0x345fcc+'%');}}}}_0x5cd0d0[_0xd24b('0x3f')](_0x5473ad);_0x5cd0d0[_0xd24b('0x71')](_0xd24b('0x72'));var _0x302775={'type':db[_0xd24b('0x73')][_0xd24b('0x74')][_0xd24b('0x75')],'raw':!![]};var _0x53ada1=_0x5cd0d0[_0xd24b('0x76')]()[_0xd24b('0x42')](_0xd24b('0x72'));if(_0x12f78e[_0xd24b('0x3d')]){_0x12f78e['order']['forEach'](function(_0x33dd49){_0x5cd0d0['order']('c.'+_0x33dd49[0x0],_0x33dd49[0x1]===_0xd24b('0x77')?![]:!![]);});}if(!_['isEmpty'](_0x3cc94a)){_0x5cd0d0[_0xd24b('0x78')](_0x248eb9);_0x53ada1[_0xd24b('0x3f')](_0xd24b('0x79'),_0x3cc94a);}BPromise[_0xd24b('0x7a')]()['then'](function(){if(_0x84f59e&&!_[_0xd24b('0x7b')](_0x84f59e['conditions'],[_0xd24b('0x42'),_0xd24b('0x56')])){return _0x251f97['user'][_0xd24b('0x7c')]({'attributes':['id'],'raw':!![]})[_0xd24b('0x24')](function(_0x4c43b9){if(_[_0xd24b('0x60')](_0x4c43b9)){_0x53ada1[_0xd24b('0x3f')](_0xd24b('0x7d'));_0x5cd0d0[_0xd24b('0x3f')](_0xd24b('0x7d'));}else{_0x53ada1[_0xd24b('0x3f')](_0xd24b('0x61'),_[_0xd24b('0x53')](_0x4c43b9,'id'));_0x5cd0d0['where'](_0xd24b('0x61'),_[_0xd24b('0x53')](_0x4c43b9,'id'));}});}else{return;}})[_0xd24b('0x24')](function(){db[_0xd24b('0x7e')]['query'](_0x53ada1[_0xd24b('0x7f')](),_0x302775)['then'](function(_0x2ecae3){_0x388152[_0xd24b('0x1d')]=_0x2ecae3['length'];if(_0x388152[_0xd24b('0x1d')]===0x0)return[];return db[_0xd24b('0x7e')]['query'](_0x5ef9ab[_0xd24b('0x7f')](),_0x302775);})[_0xd24b('0x24')](function(_0x4d4d16){_0x15cdb3=_['keyBy'](_0x4d4d16,'id');_0x302775=_['merge'](_0x302775,{'model':db[_0xd24b('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x251f97['query'][_0xd24b('0x39')]){_0x12f78e[_0xd24b('0x38')][_0xd24b('0x54')](function(_0x560a1f){_0x5cd0d0['field']('c.'+_0x560a1f);});}else{_0x5cd0d0[_0xd24b('0x42')](_0xd24b('0x72'));_0x5cd0d0[_0xd24b('0x42')](_0xd24b('0x80'));_0x5cd0d0['field']('c.lastName');_0x5cd0d0['field'](_0xd24b('0x81'));_0x5cd0d0[_0xd24b('0x42')](_0xd24b('0x82'));_0x5cd0d0[_0xd24b('0x42')](_0xd24b('0x83'));_0x5cd0d0[_0xd24b('0x42')](_0xd24b('0x84'));_0x5cd0d0[_0xd24b('0x42')](_0xd24b('0x85'));_0x5cd0d0['field'](_0xd24b('0x86'));_0x5cd0d0[_0xd24b('0x42')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd24b('0x87'));}if(_0x12f78e[_0xd24b('0x3c')])_0x5cd0d0[_0xd24b('0x3c')](_0x12f78e[_0xd24b('0x3c')]);if(_0x12f78e['offset'])_0x5cd0d0[_0xd24b('0x1e')](_0x12f78e['offset']);return db[_0xd24b('0x7e')][_0xd24b('0x35')](_0x5cd0d0[_0xd24b('0x7f')](),_0x302775);})[_0xd24b('0x24')](function(_0x3260c3){_0x3260c3[_0xd24b('0x54')](function(_0x303676){if(_0x303676['TagIds']){_0x303676[_0xd24b('0x88')]=[];_0x303676['TagIds'][_0xd24b('0x52')](',')['forEach'](function(_0x503abf){_0x303676['Tags'][_0xd24b('0x89')](_0x15cdb3[_0x503abf]);});}delete _0x303676[_0xd24b('0x87')];});_0x388152[_0xd24b('0x8a')]=_0x3260c3;return _0x388152;})[_0xd24b('0x24')](respondWithFilteredResult(_0x2d0aa2,_0x12f78e));});})[_0xd24b('0x8b')](handleError(_0x2d0aa2,null));};exports[_0xd24b('0x23')]=function(_0xc99c2c,_0x278c7d){return db[_0xd24b('0x2a')][_0xd24b('0x4f')]({'where':{'id':_0xc99c2c[_0xd24b('0x8c')]['id']}})['then'](handleEntityNotFound(_0x278c7d,null))[_0xd24b('0x24')](removeEntity(_0x278c7d,null))[_0xd24b('0x8b')](handleError(_0x278c7d,null));};exports['describe']=function(_0x1d7cbd,_0x58dbe1){return db[_0xd24b('0x2a')][_0xd24b('0x2b')]()[_0xd24b('0x24')](function(_0x15082f){delete _0x15082f[_0xd24b('0x8d')];for(var _0x386b62=0x0;_0x386b62{}\s\\|]/g,'-');_0x1e8a48(null,util['format'](_0x8b13('0x1f'),path[_0x8b13('0x20')](_0x559442['originalname'],path[_0x8b13('0x21')](_0x559442[_0x8b13('0x1e')])),Date[_0x8b13('0x22')](),path[_0x8b13('0x21')](_0x559442[_0x8b13('0x1e')])));}})});router['post'](_0x8b13('0x23'),upload[_0x8b13('0x24')]('file'),controller[_0x8b13('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x420772,_0x325d68,_0x54786a){_0x54786a(null,path[_0x8b13('0x1b')](config[_0x8b13('0x1c')],'server/files/tmp'));},'filename':function(_0x134c5e,_0x14a739,_0x410122){_0x14a739[_0x8b13('0x1e')]=_0x14a739[_0x8b13('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x410122(null,util[_0x8b13('0x26')](_0x8b13('0x1f'),path[_0x8b13('0x20')](_0x14a739[_0x8b13('0x1e')],path[_0x8b13('0x21')](_0x14a739[_0x8b13('0x1e')])),Date['now'](),path[_0x8b13('0x21')](_0x14a739[_0x8b13('0x1e')])));}})});router[_0x8b13('0x16')](_0x8b13('0x27'),upload[_0x8b13('0x24')](_0x8b13('0x28')),controller[_0x8b13('0x29')]);router[_0x8b13('0x16')](_0x8b13('0x2a'),auth['isAuthenticated'](),controller[_0x8b13('0x2b')]);router[_0x8b13('0x2c')](_0x8b13('0x2d'),auth[_0x8b13('0xb')](),controller['update']);router['delete'](_0x8b13('0x2d'),auth['isAuthenticated'](),controller['destroy']);module[_0x8b13('0x2e')]=router; \ No newline at end of file +var _0x9c5a=['/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','/:id/tags','setTags','diskStorage','join','root','server/files/tmp','originalname','%s-%s%s','basename','extname','now','/csv','file','uploadCsv','replace','format','/upload','single','/upload/:id','import','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmContact.controller','isAuthenticated','get','/describe','/:id','show','getTags','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x52de9b,_0x19df61){var _0x1ad0c7=function(_0x26a38c){while(--_0x26a38c){_0x52de9b['push'](_0x52de9b['shift']());}};_0x1ad0c7(++_0x19df61);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x107e90,_0x12961e){_0x107e90=_0x107e90-0x0;var _0xbb8365=_0x9c5a[_0x107e90];return _0xbb8365;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var auth=require(_0xa9c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9c5('0x6'));var controller=require(_0xa9c5('0x7'));router['get']('/',auth[_0xa9c5('0x8')](),controller['index']);router[_0xa9c5('0x9')](_0xa9c5('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa9c5('0x9')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0x9')]('/:id/tags',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0xd')]);router['get']('/:id/hoppers',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0xe')]);router[_0xa9c5('0x9')](_0xa9c5('0xf'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x10')]);router[_0xa9c5('0x9')](_0xa9c5('0x11'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x12')]);router['get'](_0xa9c5('0x13'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x14')]);router[_0xa9c5('0x15')](_0xa9c5('0x16'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x17')]);router[_0xa9c5('0x15')]('/',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x18')]);router['post'](_0xa9c5('0x19'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x1a')]);router['post'](_0xa9c5('0x1b'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x1c')]);var upload=multer({'storage':multer[_0xa9c5('0x1d')]({'destination':function(_0x452a9b,_0x349f27,_0x3b8d4d){_0x3b8d4d(null,path[_0xa9c5('0x1e')](config[_0xa9c5('0x1f')],_0xa9c5('0x20')));},'filename':function(_0x113c8f,_0x2d95f8,_0x54f8b9){_0x2d95f8[_0xa9c5('0x21')]=_0x2d95f8[_0xa9c5('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x54f8b9(null,util['format'](_0xa9c5('0x22'),path[_0xa9c5('0x23')](_0x2d95f8[_0xa9c5('0x21')],path[_0xa9c5('0x24')](_0x2d95f8[_0xa9c5('0x21')])),Date[_0xa9c5('0x25')](),path['extname'](_0x2d95f8['originalname'])));}})});router[_0xa9c5('0x15')](_0xa9c5('0x26'),upload['single'](_0xa9c5('0x27')),controller[_0xa9c5('0x28')]);var upload=multer({'storage':multer[_0xa9c5('0x1d')]({'destination':function(_0x32fc7d,_0x4cbba1,_0x40f08b){_0x40f08b(null,path[_0xa9c5('0x1e')](config['root'],'server/files/tmp'));},'filename':function(_0x242771,_0x4cd5e6,_0x1762ac){_0x4cd5e6[_0xa9c5('0x21')]=_0x4cd5e6['originalname'][_0xa9c5('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1762ac(null,util[_0xa9c5('0x2a')]('%s-%s%s',path[_0xa9c5('0x23')](_0x4cd5e6[_0xa9c5('0x21')],path[_0xa9c5('0x24')](_0x4cd5e6[_0xa9c5('0x21')])),Date[_0xa9c5('0x25')](),path['extname'](_0x4cd5e6[_0xa9c5('0x21')])));}})});router['post'](_0xa9c5('0x2b'),upload[_0xa9c5('0x2c')](_0xa9c5('0x27')),controller['upload']);router[_0xa9c5('0x15')](_0xa9c5('0x2d'),auth['isAuthenticated'](),controller[_0xa9c5('0x2e')]);router[_0xa9c5('0x2f')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x30')]);router[_0xa9c5('0x31')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0x32')]);module[_0xa9c5('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 98b1b57..3121fe5 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 _0x812d=['STRING','PHONE','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x812d,0x6e));var _0xd812=function(_0x1d0195,_0x3bf133){_0x1d0195=_0x1d0195-0x0;var _0x3ccc06=_0x812d[_0x1d0195];return _0x3ccc06;};'use strict';var Sequelize=require('sequelize');module[_0xd812('0x0')]={'CmContactId':{'type':Sequelize[_0xd812('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xd812('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xd812('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xd812('0x2')],'defaultValue':_0xd812('0x3')},'OrderBy':{'type':Sequelize[_0xd812('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xbf4e=['INTEGER','STRING','sequelize','exports'];(function(_0x443d97,_0x3c25f5){var _0x36667b=function(_0x452d9f){while(--_0x452d9f){_0x443d97['push'](_0x443d97['shift']());}};_0x36667b(++_0x3c25f5);}(_0xbf4e,0x172));var _0xebf4=function(_0x61b32e,_0x58f7f7){_0x61b32e=_0x61b32e-0x0;var _0x325f88=_0xbf4e[_0x61b32e];return _0x325f88;};'use strict';var Sequelize=require(_0xebf4('0x0'));module[_0xebf4('0x1')]={'CmContactId':{'type':Sequelize[_0xebf4('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xebf4('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xebf4('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xebf4('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xebf4('0x2')],'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 2929897..1875769 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 _0x12e0=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','limit','set','reject','save','update','destroy','get','CmContactHasItems','UserProfileResource','then','error','stack','name','send','index','map','CmContactHasItem','fieldName','key','model','query','attributes','length','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','fields','find','create'];(function(_0x4bbe4f,_0x5013e3){var _0x4292d1=function(_0xba4361){while(--_0xba4361){_0x4bbe4f['push'](_0x4bbe4f['shift']());}};_0x4292d1(++_0x5013e3);}(_0x12e0,0xa7));var _0x012e=function(_0x2d1cf6,_0x3864fe){_0x2d1cf6=_0x2d1cf6-0x0;var _0x3d4d16=_0x12e0[_0x2d1cf6];return _0x3d4d16;};'use strict';var pdf=require(_0x012e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x012e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x012e('0x2'));var moment=require(_0x012e('0x3'));var BPromise=require(_0x012e('0x4'));var Mustache=require(_0x012e('0x5'));var util=require(_0x012e('0x6'));var path=require('path');var sox=require(_0x012e('0x7'));var csv=require(_0x012e('0x8'));var ejs=require(_0x012e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x012e('0xa'));var jsforce=require(_0x012e('0xb'));var deskjs=require(_0x012e('0xc'));var toCsv=require(_0x012e('0x8'));var querystring=require('querystring');var Papa=require(_0x012e('0xd'));var Redis=require(_0x012e('0xe'));var authService=require(_0x012e('0xf'));var qs=require(_0x012e('0x10'));var as=require(_0x012e('0x11'));var hardwareService=require(_0x012e('0x12'));var logger=require(_0x012e('0x13'))(_0x012e('0x14'));var utils=require(_0x012e('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37fb30,_0x589ec5){_0x589ec5=_0x589ec5||0xcc;return function(_0x4d7af7){if(_0x4d7af7){return _0x37fb30['sendStatus'](_0x589ec5);}return _0x37fb30[_0x012e('0x16')](_0x589ec5)[_0x012e('0x17')]();};}function respondWithResult(_0x2f1632,_0x2b4b5f){_0x2b4b5f=_0x2b4b5f||0xc8;return function(_0x5a5d7c){if(_0x5a5d7c){return _0x2f1632[_0x012e('0x16')](_0x2b4b5f)[_0x012e('0x18')](_0x5a5d7c);}};}function respondWithFilteredResult(_0x325d72,_0x1fcfa2){return function(_0x3ecf9c){if(_0x3ecf9c){var _0x4a1948=_0x3ecf9c['count'],_0x14fdc5=_0x1fcfa2[_0x012e('0x19')],_0x182359=_0x1fcfa2[_0x012e('0x19')]+_0x1fcfa2[_0x012e('0x1a')],_0x9492dd;if(_0x182359>=_0x4a1948){_0x182359=_0x4a1948;_0x9492dd=0xc8;}else{_0x9492dd=0xce;}_0x325d72[_0x012e('0x16')](_0x9492dd);return _0x325d72[_0x012e('0x1b')]('Content-Range',_0x14fdc5+'-'+_0x182359+'/'+_0x4a1948)[_0x012e('0x18')](_0x3ecf9c);}return null;};}function patchUpdates(_0x589b79){return function(_0x344ee0){try{jsonpatch['apply'](_0x344ee0,_0x589b79,!![]);}catch(_0x3a641f){return BPromise[_0x012e('0x1c')](_0x3a641f);}return _0x344ee0[_0x012e('0x1d')]();};}function saveUpdates(_0x12f330,_0x419d4b){return function(_0x22120c){if(_0x22120c){return _0x22120c[_0x012e('0x1e')](_0x12f330)['then'](function(_0x18c0b5){return _0x18c0b5;});}return null;};}function removeEntity(_0x2ff04e,_0x2771c3){return function(_0x81bdc3){if(_0x81bdc3){return _0x81bdc3[_0x012e('0x1f')]()['then'](function(){var _0x470c05=_0x81bdc3[_0x012e('0x20')]({'plain':!![]});var _0x4098f2=_0x012e('0x21');return db[_0x012e('0x22')][_0x012e('0x1f')]({'where':{'type':_0x4098f2,'resourceId':_0x470c05['id']}})[_0x012e('0x23')](function(){return _0x81bdc3;});})['then'](function(){_0x2ff04e[_0x012e('0x16')](0xcc)[_0x012e('0x17')]();});}};}function handleEntityNotFound(_0x29ff03,_0x15cf1f){return function(_0x449e9b){if(!_0x449e9b){_0x29ff03['sendStatus'](0x194);}return _0x449e9b;};}function handleError(_0x50404a,_0x38b50b){_0x38b50b=_0x38b50b||0x1f4;return function(_0xd1f20c){logger[_0x012e('0x24')](_0xd1f20c[_0x012e('0x25')]);if(_0xd1f20c[_0x012e('0x26')]){delete _0xd1f20c['name'];}_0x50404a['status'](_0x38b50b)[_0x012e('0x27')](_0xd1f20c);};}exports[_0x012e('0x28')]=function(_0x56cb3e,_0x38910e){var _0x2884bf={},_0x2c05af={},_0x30927c={'count':0x0,'rows':[]};var _0x20f5d9=_[_0x012e('0x29')](db[_0x012e('0x2a')]['rawAttributes'],function(_0x2f78dc){return{'name':_0x2f78dc[_0x012e('0x2b')],'type':_0x2f78dc['type'][_0x012e('0x2c')]};});_0x2c05af[_0x012e('0x2d')]=_[_0x012e('0x29')](_0x20f5d9,_0x012e('0x26'));_0x2c05af[_0x012e('0x2e')]=_['keys'](_0x56cb3e[_0x012e('0x2e')]);_0x2c05af['filters']=_['intersection'](_0x2c05af['model'],_0x2c05af[_0x012e('0x2e')]);_0x2884bf[_0x012e('0x2f')]=_['intersection'](_0x2c05af['model'],qs['fields'](_0x56cb3e[_0x012e('0x2e')]['fields']));_0x2884bf[_0x012e('0x2f')]=_0x2884bf[_0x012e('0x2f')][_0x012e('0x30')]?_0x2884bf[_0x012e('0x2f')]:_0x2c05af[_0x012e('0x2d')];if(!_0x56cb3e[_0x012e('0x2e')]['hasOwnProperty'](_0x012e('0x31'))){_0x2884bf['limit']=qs['limit'](_0x56cb3e[_0x012e('0x2e')]['limit']);_0x2884bf[_0x012e('0x19')]=qs[_0x012e('0x19')](_0x56cb3e[_0x012e('0x2e')]['offset']);}_0x2884bf['order']=qs[_0x012e('0x32')](_0x56cb3e[_0x012e('0x2e')]['sort']);_0x2884bf[_0x012e('0x33')]=qs[_0x012e('0x34')](_[_0x012e('0x35')](_0x56cb3e[_0x012e('0x2e')],_0x2c05af[_0x012e('0x34')]),_0x20f5d9);if(_0x56cb3e[_0x012e('0x2e')][_0x012e('0x36')]){_0x2884bf[_0x012e('0x33')]=_[_0x012e('0x37')](_0x2884bf[_0x012e('0x33')],{'$or':_['map'](_0x20f5d9,function(_0x4c3343){if(_0x4c3343[_0x012e('0x38')]!==_0x012e('0x39')){var _0xe69ae4={};_0xe69ae4[_0x4c3343['name']]={'$like':'%'+_0x56cb3e[_0x012e('0x2e')][_0x012e('0x36')]+'%'};return _0xe69ae4;}})});}_0x2884bf=_['merge']({},_0x2884bf,_0x56cb3e[_0x012e('0x3a')]);var _0x2fbfdd={'where':_0x2884bf[_0x012e('0x33')]};return db[_0x012e('0x2a')]['count'](_0x2fbfdd)['then'](function(_0x3e228e){_0x30927c[_0x012e('0x3b')]=_0x3e228e;if(_0x56cb3e['query'][_0x012e('0x3c')]){_0x2884bf[_0x012e('0x3d')]=[{'all':!![]}];}return db[_0x012e('0x2a')][_0x012e('0x3e')](_0x2884bf);})[_0x012e('0x23')](function(_0x46a84){_0x30927c[_0x012e('0x3f')]=_0x46a84;return _0x30927c;})['then'](respondWithFilteredResult(_0x38910e,_0x2884bf))[_0x012e('0x40')](handleError(_0x38910e,null));};exports[_0x012e('0x41')]=function(_0x405c59,_0x577977){var _0x16d7f4={'raw':!![],'where':{'id':_0x405c59[_0x012e('0x42')]['id']}},_0x182463={};_0x182463[_0x012e('0x2d')]=_[_0x012e('0x43')](db[_0x012e('0x2a')][_0x012e('0x44')]);_0x182463['query']=_[_0x012e('0x43')](_0x405c59['query']);_0x182463['filters']=_[_0x012e('0x45')](_0x182463['model'],_0x182463[_0x012e('0x2e')]);_0x16d7f4[_0x012e('0x2f')]=_[_0x012e('0x45')](_0x182463[_0x012e('0x2d')],qs[_0x012e('0x46')](_0x405c59[_0x012e('0x2e')]['fields']));_0x16d7f4['attributes']=_0x16d7f4['attributes']['length']?_0x16d7f4[_0x012e('0x2f')]:_0x182463[_0x012e('0x2d')];if(_0x405c59[_0x012e('0x2e')]['includeAll']){_0x16d7f4[_0x012e('0x3d')]=[{'all':!![]}];}_0x16d7f4=_['merge']({},_0x16d7f4,_0x405c59['options']);return db[_0x012e('0x2a')][_0x012e('0x47')](_0x16d7f4)[_0x012e('0x23')](handleEntityNotFound(_0x577977,null))[_0x012e('0x23')](respondWithResult(_0x577977,null))[_0x012e('0x40')](handleError(_0x577977,null));};exports[_0x012e('0x48')]=function(_0x466070,_0x4586c6){return db[_0x012e('0x2a')][_0x012e('0x48')](_0x466070[_0x012e('0x49')],{})['then'](function(_0x22640b){var _0x4f78ac=_0x466070[_0x012e('0x4a')][_0x012e('0x20')]({'plain':!![]});if(!_0x4f78ac)throw new Error(_0x012e('0x4b'));if(_0x4f78ac[_0x012e('0x4c')]===_0x012e('0x4a')){var _0x3389e2=_0x22640b['get']({'plain':!![]});var _0x49940c='CmContactHasItems';return db[_0x012e('0x4d')][_0x012e('0x47')]({'where':{'name':_0x49940c,'userProfileId':_0x4f78ac[_0x012e('0x4e')]},'raw':!![]})['then'](function(_0x1ded91){if(_0x1ded91&&_0x1ded91[_0x012e('0x4f')]===0x0){return db[_0x012e('0x22')]['create']({'name':_0x3389e2['name'],'resourceId':_0x3389e2['id'],'type':_0x1ded91[_0x012e('0x26')],'sectionId':_0x1ded91['id']},{})['then'](function(){return _0x22640b;});}else{return _0x22640b;}})['catch'](function(_0x4add51){logger[_0x012e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4add51);throw _0x4add51;});}return _0x22640b;})[_0x012e('0x23')](respondWithResult(_0x4586c6,0xc9))[_0x012e('0x40')](handleError(_0x4586c6,null));};exports[_0x012e('0x1e')]=function(_0x587931,_0x313a44){if(_0x587931[_0x012e('0x49')]['id']){delete _0x587931[_0x012e('0x49')]['id'];}return db[_0x012e('0x2a')]['find']({'where':{'id':_0x587931[_0x012e('0x42')]['id']}})[_0x012e('0x23')](handleEntityNotFound(_0x313a44,null))['then'](saveUpdates(_0x587931[_0x012e('0x49')],null))[_0x012e('0x23')](respondWithResult(_0x313a44,null))[_0x012e('0x40')](handleError(_0x313a44,null));};exports[_0x012e('0x1f')]=function(_0x3a0f17,_0x5ad515){return db['CmContactHasItem']['find']({'where':{'id':_0x3a0f17[_0x012e('0x42')]['id']}})[_0x012e('0x23')](handleEntityNotFound(_0x5ad515,null))['then'](removeEntity(_0x5ad515,null))[_0x012e('0x40')](handleError(_0x5ad515,null));}; \ No newline at end of file +var _0x1ff6=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','get','CmContactHasItems','error','stack','send','map','CmContactHasItem','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','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','update','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x4e83fb,_0x55dae0){var _0xff9a0d=function(_0x1d0595){while(--_0x1d0595){_0x4e83fb['push'](_0x4e83fb['shift']());}};_0xff9a0d(++_0x55dae0);}(_0x1ff6,0x1aa));var _0x61ff=function(_0x521dd7,_0x56d270){_0x521dd7=_0x521dd7-0x0;var _0x11c3bf=_0x1ff6[_0x521dd7];return _0x11c3bf;};'use strict';var pdf=require(_0x61ff('0x0'));var emlformat=require(_0x61ff('0x1'));var rimraf=require(_0x61ff('0x2'));var zipdir=require(_0x61ff('0x3'));var jsonpatch=require(_0x61ff('0x4'));var rp=require(_0x61ff('0x5'));var moment=require(_0x61ff('0x6'));var BPromise=require(_0x61ff('0x7'));var Mustache=require(_0x61ff('0x8'));var util=require(_0x61ff('0x9'));var path=require(_0x61ff('0xa'));var sox=require('sox');var csv=require(_0x61ff('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x61ff('0xc'));var squel=require(_0x61ff('0xd'));var crypto=require('crypto');var jsforce=require(_0x61ff('0xe'));var deskjs=require(_0x61ff('0xf'));var toCsv=require(_0x61ff('0xb'));var querystring=require(_0x61ff('0x10'));var Papa=require(_0x61ff('0x11'));var Redis=require(_0x61ff('0x12'));var authService=require(_0x61ff('0x13'));var qs=require(_0x61ff('0x14'));var as=require(_0x61ff('0x15'));var hardwareService=require(_0x61ff('0x16'));var logger=require(_0x61ff('0x17'))(_0x61ff('0x18'));var utils=require(_0x61ff('0x19'));var config=require(_0x61ff('0x1a'));var db=require(_0x61ff('0x1b'))['db'];function respondWithStatusCode(_0x3a87c9,_0x5a91f6){_0x5a91f6=_0x5a91f6||0xcc;return function(_0x4b07fb){if(_0x4b07fb){return _0x3a87c9[_0x61ff('0x1c')](_0x5a91f6);}return _0x3a87c9[_0x61ff('0x1d')](_0x5a91f6)[_0x61ff('0x1e')]();};}function respondWithResult(_0x34ae9e,_0x2e1685){_0x2e1685=_0x2e1685||0xc8;return function(_0x4653da){if(_0x4653da){return _0x34ae9e[_0x61ff('0x1d')](_0x2e1685)[_0x61ff('0x1f')](_0x4653da);}};}function respondWithFilteredResult(_0x5283d5,_0x561f5b){return function(_0x5a768a){if(_0x5a768a){var _0x201d70=_0x5a768a['count'],_0x3fab8a=_0x561f5b[_0x61ff('0x20')],_0x552a68=_0x561f5b[_0x61ff('0x20')]+_0x561f5b[_0x61ff('0x21')],_0x3303ef;if(_0x552a68>=_0x201d70){_0x552a68=_0x201d70;_0x3303ef=0xc8;}else{_0x3303ef=0xce;}_0x5283d5[_0x61ff('0x1d')](_0x3303ef);return _0x5283d5[_0x61ff('0x22')](_0x61ff('0x23'),_0x3fab8a+'-'+_0x552a68+'/'+_0x201d70)['json'](_0x5a768a);}return null;};}function patchUpdates(_0x2665b7){return function(_0x39fefc){try{jsonpatch['apply'](_0x39fefc,_0x2665b7,!![]);}catch(_0x377943){return BPromise[_0x61ff('0x24')](_0x377943);}return _0x39fefc[_0x61ff('0x25')]();};}function saveUpdates(_0x15e9b7,_0x31217f){return function(_0x59700a){if(_0x59700a){return _0x59700a['update'](_0x15e9b7)[_0x61ff('0x26')](function(_0xa83dfa){return _0xa83dfa;});}return null;};}function removeEntity(_0xc90ffe,_0x5d5bd7){return function(_0x47310a){if(_0x47310a){return _0x47310a[_0x61ff('0x27')]()['then'](function(){var _0x1dd845=_0x47310a[_0x61ff('0x28')]({'plain':!![]});var _0xcea299=_0x61ff('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0xcea299,'resourceId':_0x1dd845['id']}})[_0x61ff('0x26')](function(){return _0x47310a;});})[_0x61ff('0x26')](function(){_0xc90ffe[_0x61ff('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f1c28,_0x56c742){return function(_0x15f07e){if(!_0x15f07e){_0x3f1c28[_0x61ff('0x1c')](0x194);}return _0x15f07e;};}function handleError(_0x57f8bf,_0x4d9f89){_0x4d9f89=_0x4d9f89||0x1f4;return function(_0x127868){logger[_0x61ff('0x2a')](_0x127868[_0x61ff('0x2b')]);if(_0x127868['name']){delete _0x127868['name'];}_0x57f8bf[_0x61ff('0x1d')](_0x4d9f89)[_0x61ff('0x2c')](_0x127868);};}exports['index']=function(_0x3a9e03,_0x33367f){var _0x5a9dfe={},_0x26189a={},_0x2bd3de={'count':0x0,'rows':[]};var _0x2e5453=_[_0x61ff('0x2d')](db[_0x61ff('0x2e')][_0x61ff('0x2f')],function(_0x2665b6){return{'name':_0x2665b6[_0x61ff('0x30')],'type':_0x2665b6[_0x61ff('0x31')]['key']};});_0x26189a[_0x61ff('0x32')]=_[_0x61ff('0x2d')](_0x2e5453,_0x61ff('0x33'));_0x26189a[_0x61ff('0x34')]=_[_0x61ff('0x35')](_0x3a9e03['query']);_0x26189a[_0x61ff('0x36')]=_['intersection'](_0x26189a[_0x61ff('0x32')],_0x26189a[_0x61ff('0x34')]);_0x5a9dfe[_0x61ff('0x37')]=_[_0x61ff('0x38')](_0x26189a[_0x61ff('0x32')],qs['fields'](_0x3a9e03[_0x61ff('0x34')][_0x61ff('0x39')]));_0x5a9dfe[_0x61ff('0x37')]=_0x5a9dfe[_0x61ff('0x37')][_0x61ff('0x3a')]?_0x5a9dfe[_0x61ff('0x37')]:_0x26189a[_0x61ff('0x32')];if(!_0x3a9e03['query']['hasOwnProperty']('nolimit')){_0x5a9dfe[_0x61ff('0x21')]=qs[_0x61ff('0x21')](_0x3a9e03[_0x61ff('0x34')]['limit']);_0x5a9dfe[_0x61ff('0x20')]=qs['offset'](_0x3a9e03[_0x61ff('0x34')][_0x61ff('0x20')]);}_0x5a9dfe['order']=qs[_0x61ff('0x3b')](_0x3a9e03[_0x61ff('0x34')]['sort']);_0x5a9dfe[_0x61ff('0x3c')]=qs[_0x61ff('0x36')](_[_0x61ff('0x3d')](_0x3a9e03['query'],_0x26189a[_0x61ff('0x36')]),_0x2e5453);if(_0x3a9e03[_0x61ff('0x34')][_0x61ff('0x3e')]){_0x5a9dfe['where']=_[_0x61ff('0x3f')](_0x5a9dfe[_0x61ff('0x3c')],{'$or':_[_0x61ff('0x2d')](_0x2e5453,function(_0x331f62){if(_0x331f62[_0x61ff('0x31')]!==_0x61ff('0x40')){var _0x442cf6={};_0x442cf6[_0x331f62[_0x61ff('0x33')]]={'$like':'%'+_0x3a9e03[_0x61ff('0x34')][_0x61ff('0x3e')]+'%'};return _0x442cf6;}})});}_0x5a9dfe=_['merge']({},_0x5a9dfe,_0x3a9e03[_0x61ff('0x41')]);var _0x189e6d={'where':_0x5a9dfe[_0x61ff('0x3c')]};return db['CmContactHasItem'][_0x61ff('0x42')](_0x189e6d)['then'](function(_0x92db5a){_0x2bd3de[_0x61ff('0x42')]=_0x92db5a;if(_0x3a9e03['query'][_0x61ff('0x43')]){_0x5a9dfe[_0x61ff('0x44')]=[{'all':!![]}];}return db[_0x61ff('0x2e')][_0x61ff('0x45')](_0x5a9dfe);})[_0x61ff('0x26')](function(_0x4542ec){_0x2bd3de[_0x61ff('0x46')]=_0x4542ec;return _0x2bd3de;})[_0x61ff('0x26')](respondWithFilteredResult(_0x33367f,_0x5a9dfe))['catch'](handleError(_0x33367f,null));};exports[_0x61ff('0x47')]=function(_0x1a5b93,_0x23d18f){var _0x18e668={'raw':!![],'where':{'id':_0x1a5b93[_0x61ff('0x48')]['id']}},_0x527e3f={};_0x527e3f[_0x61ff('0x32')]=_[_0x61ff('0x35')](db[_0x61ff('0x2e')][_0x61ff('0x2f')]);_0x527e3f[_0x61ff('0x34')]=_[_0x61ff('0x35')](_0x1a5b93[_0x61ff('0x34')]);_0x527e3f[_0x61ff('0x36')]=_['intersection'](_0x527e3f['model'],_0x527e3f[_0x61ff('0x34')]);_0x18e668[_0x61ff('0x37')]=_[_0x61ff('0x38')](_0x527e3f[_0x61ff('0x32')],qs[_0x61ff('0x39')](_0x1a5b93[_0x61ff('0x34')][_0x61ff('0x39')]));_0x18e668['attributes']=_0x18e668[_0x61ff('0x37')][_0x61ff('0x3a')]?_0x18e668[_0x61ff('0x37')]:_0x527e3f['model'];if(_0x1a5b93['query'][_0x61ff('0x43')]){_0x18e668['include']=[{'all':!![]}];}_0x18e668=_[_0x61ff('0x3f')]({},_0x18e668,_0x1a5b93[_0x61ff('0x41')]);return db[_0x61ff('0x2e')][_0x61ff('0x49')](_0x18e668)[_0x61ff('0x26')](handleEntityNotFound(_0x23d18f,null))[_0x61ff('0x26')](respondWithResult(_0x23d18f,null))[_0x61ff('0x4a')](handleError(_0x23d18f,null));};exports[_0x61ff('0x4b')]=function(_0x572055,_0x47a25c){return db[_0x61ff('0x2e')][_0x61ff('0x4b')](_0x572055[_0x61ff('0x4c')],{})[_0x61ff('0x26')](function(_0x5406dc){var _0x449d47=_0x572055[_0x61ff('0x4d')][_0x61ff('0x28')]({'plain':!![]});if(!_0x449d47)throw new Error(_0x61ff('0x4e'));if(_0x449d47[_0x61ff('0x4f')]===_0x61ff('0x4d')){var _0x564186=_0x5406dc[_0x61ff('0x28')]({'plain':!![]});var _0x1f40c4=_0x61ff('0x29');return db[_0x61ff('0x50')][_0x61ff('0x49')]({'where':{'name':_0x1f40c4,'userProfileId':_0x449d47[_0x61ff('0x51')]},'raw':!![]})[_0x61ff('0x26')](function(_0x18feb8){if(_0x18feb8&&_0x18feb8[_0x61ff('0x52')]===0x0){return db[_0x61ff('0x53')][_0x61ff('0x4b')]({'name':_0x564186[_0x61ff('0x33')],'resourceId':_0x564186['id'],'type':_0x18feb8['name'],'sectionId':_0x18feb8['id']},{})[_0x61ff('0x26')](function(){return _0x5406dc;});}else{return _0x5406dc;}})['catch'](function(_0x415527){logger['error'](_0x61ff('0x54'),_0x415527);throw _0x415527;});}return _0x5406dc;})[_0x61ff('0x26')](respondWithResult(_0x47a25c,0xc9))[_0x61ff('0x4a')](handleError(_0x47a25c,null));};exports[_0x61ff('0x55')]=function(_0x28d5de,_0x39f36d){if(_0x28d5de[_0x61ff('0x4c')]['id']){delete _0x28d5de[_0x61ff('0x4c')]['id'];}return db[_0x61ff('0x2e')][_0x61ff('0x49')]({'where':{'id':_0x28d5de[_0x61ff('0x48')]['id']}})[_0x61ff('0x26')](handleEntityNotFound(_0x39f36d,null))[_0x61ff('0x26')](saveUpdates(_0x28d5de['body'],null))[_0x61ff('0x26')](respondWithResult(_0x39f36d,null))['catch'](handleError(_0x39f36d,null));};exports[_0x61ff('0x27')]=function(_0x22cb64,_0x4b8ebe){return db[_0x61ff('0x2e')][_0x61ff('0x49')]({'where':{'id':_0x22cb64[_0x61ff('0x48')]['id']}})[_0x61ff('0x26')](handleEntityNotFound(_0x4b8ebe,null))[_0x61ff('0x26')](removeEntity(_0x4b8ebe,null))['catch'](handleError(_0x4b8ebe,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index d2799d7..e6cf704 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items'];(function(_0x4fafc1,_0x8a9163){var _0x4611b9=function(_0x4da252){while(--_0x4da252){_0x4fafc1['push'](_0x4fafc1['shift']());}};_0x4611b9(++_0x8a9163);}(_0x1261,0x144));var _0x1126=function(_0x41b872,_0x4c4ef9){_0x41b872=_0x41b872-0x0;var _0x439768=_0x1261[_0x41b872];return _0x439768;};'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')]('CmContactHasItem',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84e7=['./cmContactHasItem.attributes','exports','define','cm_contact_has_items','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x84e7,0x122));var _0x784e=function(_0x1b5d4d,_0x3dcf70){_0x1b5d4d=_0x1b5d4d-0x0;var _0x4f87f2=_0x84e7[_0x1b5d4d];return _0x4f87f2;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('api');var moment=require(_0x784e('0x2'));var BPromise=require(_0x784e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x784e('0x4'));var rimraf=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var attributes=require(_0x784e('0x7'));module[_0x784e('0x8')]=function(_0x133296,_0x48ed22){return _0x133296[_0x784e('0x9')]('CmContactHasItem',attributes,{'tableName':_0x784e('0xa'),'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 46ccc1e..3a4f6e5 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 _0x91a6=['http','request','then','info','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x41bfe1,_0x2ffc83){var _0x30e883=function(_0x308ec1){while(--_0x308ec1){_0x41bfe1['push'](_0x41bfe1['shift']());}};_0x30e883(++_0x2ffc83);}(_0x91a6,0x12d));var _0x691a=function(_0x856187,_0x2418db){_0x856187=_0x856187-0x0;var _0x443e70=_0x91a6[_0x856187];return _0x443e70;};'use strict';var _=require(_0x691a('0x0'));var util=require(_0x691a('0x1'));var moment=require(_0x691a('0x2'));var BPromise=require(_0x691a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x691a('0x4'));var db=require(_0x691a('0x5'))['db'];var utils=require(_0x691a('0x6'));var logger=require(_0x691a('0x7'))(_0x691a('0x8'));var config=require('../../config/environment');var jayson=require(_0x691a('0x9'));var client=jayson[_0x691a('0xa')][_0x691a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45e12c,_0x28bb61,_0x1aec86){return new BPromise(function(_0x395efc,_0x5c7bfd){return client[_0x691a('0xc')](_0x45e12c,_0x1aec86)[_0x691a('0xd')](function(_0x5d03fe){logger[_0x691a('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x28bb61,'request\x20sent');logger[_0x691a('0xf')](_0x691a('0x10'),_0x28bb61,_0x691a('0x11'),JSON[_0x691a('0x12')](_0x5d03fe));if(_0x5d03fe[_0x691a('0x13')]){if(_0x5d03fe[_0x691a('0x13')][_0x691a('0x14')]===0x1f4){logger['error'](_0x691a('0x15'),_0x28bb61,_0x5d03fe[_0x691a('0x13')]['message']);return _0x5c7bfd(_0x5d03fe['error'][_0x691a('0x16')]);}logger['error'](_0x691a('0x15'),_0x28bb61,_0x5d03fe[_0x691a('0x13')][_0x691a('0x16')]);return _0x395efc(_0x5d03fe[_0x691a('0x13')][_0x691a('0x16')]);}else{logger['info'](_0x691a('0x15'),_0x28bb61,_0x691a('0x11'));_0x395efc(_0x5d03fe['result']['message']);}})[_0x691a('0x17')](function(_0x19929f){logger[_0x691a('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x28bb61,_0x19929f);_0x5c7bfd(_0x19929f);});});} \ No newline at end of file +var _0x14c7=['request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','CmContactHasItem,\x20%s,\x20%s','message'];(function(_0x2bf752,_0xfcadf9){var _0x2ae7a9=function(_0x308b83){while(--_0x308b83){_0x2bf752['push'](_0x2bf752['shift']());}};_0x2ae7a9(++_0xfcadf9);}(_0x14c7,0x1d0));var _0x714c=function(_0xf5c6c0,_0x53cfba){_0xf5c6c0=_0xf5c6c0-0x0;var _0x3cfa76=_0x14c7[_0xf5c6c0];return _0x3cfa76;};'use strict';var _=require(_0x714c('0x0'));var util=require(_0x714c('0x1'));var moment=require(_0x714c('0x2'));var BPromise=require('bluebird');var rs=require(_0x714c('0x3'));var fs=require('fs');var Redis=require(_0x714c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x714c('0x5'));var logger=require(_0x714c('0x6'))(_0x714c('0x7'));var config=require(_0x714c('0x8'));var jayson=require(_0x714c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56650a,_0x32561e,_0x3ad60d){return new BPromise(function(_0x135373,_0x4596d0){return client[_0x714c('0xa')](_0x56650a,_0x3ad60d)[_0x714c('0xb')](function(_0x405dc7){logger[_0x714c('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x32561e,'request\x20sent');logger[_0x714c('0xd')](_0x714c('0xe'),_0x32561e,'request\x20sent',JSON[_0x714c('0xf')](_0x405dc7));if(_0x405dc7[_0x714c('0x10')]){if(_0x405dc7['error']['code']===0x1f4){logger[_0x714c('0x10')](_0x714c('0x11'),_0x32561e,_0x405dc7[_0x714c('0x10')][_0x714c('0x12')]);return _0x4596d0(_0x405dc7[_0x714c('0x10')][_0x714c('0x12')]);}logger['error'](_0x714c('0x11'),_0x32561e,_0x405dc7[_0x714c('0x10')][_0x714c('0x12')]);return _0x135373(_0x405dc7[_0x714c('0x10')][_0x714c('0x12')]);}else{logger[_0x714c('0xc')](_0x714c('0x11'),_0x32561e,_0x714c('0x13'));_0x135373(_0x405dc7[_0x714c('0x14')][_0x714c('0x12')]);}})['catch'](function(_0x59294b){logger[_0x714c('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x32561e,_0x59294b);_0x4596d0(_0x59294b);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 1b27af4..9c65871 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 _0x02fa=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0x02fa,0x1d0));var _0xa02f=function(_0x1c700f,_0x3f7e95){_0x1c700f=_0x1c700f-0x0;var _0x5d5d0a=_0x02fa[_0x1c700f];return _0x5d5d0a;};'use strict';var multer=require(_0xa02f('0x0'));var util=require(_0xa02f('0x1'));var path=require(_0xa02f('0x2'));var timeout=require(_0xa02f('0x3'));var express=require(_0xa02f('0x4'));var router=express[_0xa02f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa02f('0x6'));var config=require(_0xa02f('0x7'));var controller=require(_0xa02f('0x8'));router[_0xa02f('0x9')]('/',auth['isAuthenticated'](),controller[_0xa02f('0xa')]);router[_0xa02f('0x9')](_0xa02f('0xb'),auth[_0xa02f('0xc')](),controller[_0xa02f('0xd')]);router[_0xa02f('0xe')]('/',auth[_0xa02f('0xc')](),controller[_0xa02f('0xf')]);router[_0xa02f('0x10')](_0xa02f('0xb'),auth['isAuthenticated'](),controller[_0xa02f('0x11')]);router[_0xa02f('0x12')](_0xa02f('0xb'),auth[_0xa02f('0xc')](),controller['destroy']);module[_0xa02f('0x13')]=router; \ No newline at end of file +var _0x289e=['create','put','/:id','isAuthenticated','update','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x289e,0xbb));var _0xe289=function(_0x133c35,_0x2226ae){_0x133c35=_0x133c35-0x0;var _0x1e93fa=_0x289e[_0x133c35];return _0x1e93fa;};'use strict';var multer=require('multer');var util=require(_0xe289('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe289('0x1'));var router=express[_0xe289('0x2')]();var auth=require(_0xe289('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe289('0x4'));var controller=require(_0xe289('0x5'));router[_0xe289('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe289('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xe289('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe289('0x8')]);router[_0xe289('0x9')](_0xe289('0xa'),auth[_0xe289('0xb')](),controller[_0xe289('0xc')]);router['delete'](_0xe289('0xa'),auth[_0xe289('0xb')](),controller[_0xe289('0xd')]);module[_0xe289('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 86be15a..0d9786d 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 _0x904c=['INTEGER','STRING','sequelize','exports'];(function(_0x100f6d,_0x36cce0){var _0x5eaa30=function(_0x3151a3){while(--_0x3151a3){_0x100f6d['push'](_0x100f6d['shift']());}};_0x5eaa30(++_0x36cce0);}(_0x904c,0x1f2));var _0xc904=function(_0x21ced1,_0xe3239a){_0x21ced1=_0x21ced1-0x0;var _0x4b06c4=_0x904c[_0x21ced1];return _0x4b06c4;};'use strict';var Sequelize=require(_0xc904('0x0'));module[_0xc904('0x1')]={'CmContactId':{'type':Sequelize[_0xc904('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xc904('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x1aa8=['STRING','sequelize','exports','INTEGER'];(function(_0x4c9116,_0x86f7b4){var _0x117ef0=function(_0x242e0c){while(--_0x242e0c){_0x4c9116['push'](_0x4c9116['shift']());}};_0x117ef0(++_0x86f7b4);}(_0x1aa8,0x109));var _0x81aa=function(_0x4c55bd,_0x161998){_0x4c55bd=_0x4c55bd-0x0;var _0x535043=_0x1aa8[_0x4c55bd];return _0x535043;};'use strict';var Sequelize=require(_0x81aa('0x0'));module[_0x81aa('0x1')]={'CmContactId':{'type':Sequelize[_0x81aa('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x81aa('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 a813b1d..d6e3215 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 _0xa729=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','CmContactHasPhone','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','merge','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa729,0x129));var _0x9a72=function(_0x1bc42b,_0x5f38c0){_0x1bc42b=_0x1bc42b-0x0;var _0x193af5=_0xa729[_0x1bc42b];return _0x193af5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9a72('0x0'));var rimraf=require(_0x9a72('0x1'));var zipdir=require(_0x9a72('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9a72('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9a72('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x9a72('0x5'));var ejs=require(_0x9a72('0x6'));var fs=require('fs');var _=require(_0x9a72('0x7'));var squel=require(_0x9a72('0x8'));var crypto=require(_0x9a72('0x9'));var jsforce=require(_0x9a72('0xa'));var deskjs=require(_0x9a72('0xb'));var toCsv=require(_0x9a72('0x5'));var querystring=require(_0x9a72('0xc'));var Papa=require(_0x9a72('0xd'));var Redis=require(_0x9a72('0xe'));var authService=require(_0x9a72('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a72('0x10'));var logger=require(_0x9a72('0x11'))(_0x9a72('0x12'));var utils=require(_0x9a72('0x13'));var config=require(_0x9a72('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b275b,_0x17e6da){_0x17e6da=_0x17e6da||0xcc;return function(_0x469c4e){if(_0x469c4e){return _0x5b275b[_0x9a72('0x15')](_0x17e6da);}return _0x5b275b[_0x9a72('0x16')](_0x17e6da)[_0x9a72('0x17')]();};}function respondWithResult(_0xfa7ef8,_0x292c80){_0x292c80=_0x292c80||0xc8;return function(_0x387692){if(_0x387692){return _0xfa7ef8[_0x9a72('0x16')](_0x292c80)[_0x9a72('0x18')](_0x387692);}};}function respondWithFilteredResult(_0x18b873,_0x24d913){return function(_0x163b2e){if(_0x163b2e){var _0x5ba9d6=_0x163b2e['count'],_0x7e5c36=_0x24d913[_0x9a72('0x19')],_0x59b1b3=_0x24d913['offset']+_0x24d913[_0x9a72('0x1a')],_0x50d117;if(_0x59b1b3>=_0x5ba9d6){_0x59b1b3=_0x5ba9d6;_0x50d117=0xc8;}else{_0x50d117=0xce;}_0x18b873[_0x9a72('0x16')](_0x50d117);return _0x18b873[_0x9a72('0x1b')]('Content-Range',_0x7e5c36+'-'+_0x59b1b3+'/'+_0x5ba9d6)[_0x9a72('0x18')](_0x163b2e);}return null;};}function patchUpdates(_0x152dab){return function(_0x5988ba){try{jsonpatch[_0x9a72('0x1c')](_0x5988ba,_0x152dab,!![]);}catch(_0x31aa47){return BPromise[_0x9a72('0x1d')](_0x31aa47);}return _0x5988ba[_0x9a72('0x1e')]();};}function saveUpdates(_0xff1222,_0x1026b1){return function(_0x3e6d59){if(_0x3e6d59){return _0x3e6d59[_0x9a72('0x1f')](_0xff1222)[_0x9a72('0x20')](function(_0x106b92){return _0x106b92;});}return null;};}function removeEntity(_0x35c03b,_0x1566e4){return function(_0x3b886d){if(_0x3b886d){return _0x3b886d[_0x9a72('0x21')]()[_0x9a72('0x20')](function(){var _0x12296f=_0x3b886d[_0x9a72('0x22')]({'plain':!![]});var _0x3b6fb2='CmContactHasPhones';return db[_0x9a72('0x23')][_0x9a72('0x21')]({'where':{'type':_0x3b6fb2,'resourceId':_0x12296f['id']}})['then'](function(){return _0x3b886d;});})[_0x9a72('0x20')](function(){_0x35c03b[_0x9a72('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b3821,_0x34da08){return function(_0x3e4611){if(!_0x3e4611){_0x4b3821[_0x9a72('0x15')](0x194);}return _0x3e4611;};}function handleError(_0x735955,_0x222436){_0x222436=_0x222436||0x1f4;return function(_0x319bb8){logger[_0x9a72('0x24')](_0x319bb8['stack']);if(_0x319bb8['name']){delete _0x319bb8[_0x9a72('0x25')];}_0x735955[_0x9a72('0x16')](_0x222436)['send'](_0x319bb8);};}exports[_0x9a72('0x26')]=function(_0x3a5b92,_0x321494){var _0x17c17a={},_0x20a6b8={},_0x31f617={'count':0x0,'rows':[]};var _0x1a9b54=_[_0x9a72('0x27')](db[_0x9a72('0x28')]['rawAttributes'],function(_0x12434b){return{'name':_0x12434b['fieldName'],'type':_0x12434b[_0x9a72('0x29')][_0x9a72('0x2a')]};});_0x20a6b8[_0x9a72('0x2b')]=_['map'](_0x1a9b54,_0x9a72('0x25'));_0x20a6b8[_0x9a72('0x2c')]=_[_0x9a72('0x2d')](_0x3a5b92['query']);_0x20a6b8['filters']=_[_0x9a72('0x2e')](_0x20a6b8[_0x9a72('0x2b')],_0x20a6b8[_0x9a72('0x2c')]);_0x17c17a[_0x9a72('0x2f')]=_['intersection'](_0x20a6b8[_0x9a72('0x2b')],qs[_0x9a72('0x30')](_0x3a5b92[_0x9a72('0x2c')][_0x9a72('0x30')]));_0x17c17a['attributes']=_0x17c17a[_0x9a72('0x2f')][_0x9a72('0x31')]?_0x17c17a[_0x9a72('0x2f')]:_0x20a6b8[_0x9a72('0x2b')];if(!_0x3a5b92[_0x9a72('0x2c')][_0x9a72('0x32')](_0x9a72('0x33'))){_0x17c17a[_0x9a72('0x1a')]=qs[_0x9a72('0x1a')](_0x3a5b92['query'][_0x9a72('0x1a')]);_0x17c17a[_0x9a72('0x19')]=qs['offset'](_0x3a5b92['query'][_0x9a72('0x19')]);}_0x17c17a[_0x9a72('0x34')]=qs[_0x9a72('0x35')](_0x3a5b92['query'][_0x9a72('0x35')]);_0x17c17a[_0x9a72('0x36')]=qs['filters'](_[_0x9a72('0x37')](_0x3a5b92[_0x9a72('0x2c')],_0x20a6b8[_0x9a72('0x38')]),_0x1a9b54);if(_0x3a5b92['query'][_0x9a72('0x39')]){_0x17c17a[_0x9a72('0x36')]=_['merge'](_0x17c17a[_0x9a72('0x36')],{'$or':_['map'](_0x1a9b54,function(_0x8b6f27){if(_0x8b6f27['type']!==_0x9a72('0x3a')){var _0x506a35={};_0x506a35[_0x8b6f27[_0x9a72('0x25')]]={'$like':'%'+_0x3a5b92['query'][_0x9a72('0x39')]+'%'};return _0x506a35;}})});}_0x17c17a=_['merge']({},_0x17c17a,_0x3a5b92[_0x9a72('0x3b')]);var _0x1c1da8={'where':_0x17c17a[_0x9a72('0x36')]};return db['CmContactHasPhone']['count'](_0x1c1da8)[_0x9a72('0x20')](function(_0x3d140c){_0x31f617['count']=_0x3d140c;if(_0x3a5b92['query']['includeAll']){_0x17c17a[_0x9a72('0x3c')]=[{'all':!![]}];}return db[_0x9a72('0x28')][_0x9a72('0x3d')](_0x17c17a);})['then'](function(_0x27ce34){_0x31f617[_0x9a72('0x3e')]=_0x27ce34;return _0x31f617;})[_0x9a72('0x20')](respondWithFilteredResult(_0x321494,_0x17c17a))[_0x9a72('0x3f')](handleError(_0x321494,null));};exports[_0x9a72('0x40')]=function(_0x5cc7fd,_0x4eedcd){var _0x203d01={'raw':!![],'where':{'id':_0x5cc7fd[_0x9a72('0x41')]['id']}},_0xc72048={};_0xc72048[_0x9a72('0x2b')]=_[_0x9a72('0x2d')](db['CmContactHasPhone']['rawAttributes']);_0xc72048[_0x9a72('0x2c')]=_[_0x9a72('0x2d')](_0x5cc7fd[_0x9a72('0x2c')]);_0xc72048[_0x9a72('0x38')]=_[_0x9a72('0x2e')](_0xc72048['model'],_0xc72048[_0x9a72('0x2c')]);_0x203d01[_0x9a72('0x2f')]=_[_0x9a72('0x2e')](_0xc72048[_0x9a72('0x2b')],qs[_0x9a72('0x30')](_0x5cc7fd[_0x9a72('0x2c')][_0x9a72('0x30')]));_0x203d01[_0x9a72('0x2f')]=_0x203d01[_0x9a72('0x2f')][_0x9a72('0x31')]?_0x203d01['attributes']:_0xc72048[_0x9a72('0x2b')];if(_0x5cc7fd[_0x9a72('0x2c')][_0x9a72('0x42')]){_0x203d01[_0x9a72('0x3c')]=[{'all':!![]}];}_0x203d01=_[_0x9a72('0x43')]({},_0x203d01,_0x5cc7fd[_0x9a72('0x3b')]);return db['CmContactHasPhone'][_0x9a72('0x44')](_0x203d01)[_0x9a72('0x20')](handleEntityNotFound(_0x4eedcd,null))[_0x9a72('0x20')](respondWithResult(_0x4eedcd,null))[_0x9a72('0x3f')](handleError(_0x4eedcd,null));};exports['create']=function(_0x9e8b0f,_0x36113d){return db[_0x9a72('0x28')]['create'](_0x9e8b0f[_0x9a72('0x45')],{})[_0x9a72('0x20')](function(_0x2ece98){var _0x43d3ea=_0x9e8b0f[_0x9a72('0x46')][_0x9a72('0x22')]({'plain':!![]});if(!_0x43d3ea)throw new Error(_0x9a72('0x47'));if(_0x43d3ea[_0x9a72('0x48')]===_0x9a72('0x46')){var _0x1a2c26=_0x2ece98['get']({'plain':!![]});var _0xb1724e='CmContactHasPhones';return db[_0x9a72('0x49')][_0x9a72('0x44')]({'where':{'name':_0xb1724e,'userProfileId':_0x43d3ea['userProfileId']},'raw':!![]})[_0x9a72('0x20')](function(_0x411f4e){if(_0x411f4e&&_0x411f4e[_0x9a72('0x4a')]===0x0){return db['UserProfileResource'][_0x9a72('0x4b')]({'name':_0x1a2c26[_0x9a72('0x25')],'resourceId':_0x1a2c26['id'],'type':_0x411f4e['name'],'sectionId':_0x411f4e['id']},{})['then'](function(){return _0x2ece98;});}else{return _0x2ece98;}})[_0x9a72('0x3f')](function(_0xaed9a4){logger[_0x9a72('0x24')](_0x9a72('0x4c'),_0xaed9a4);throw _0xaed9a4;});}return _0x2ece98;})['then'](respondWithResult(_0x36113d,0xc9))['catch'](handleError(_0x36113d,null));};exports[_0x9a72('0x1f')]=function(_0x563c67,_0x2d541e){if(_0x563c67[_0x9a72('0x45')]['id']){delete _0x563c67['body']['id'];}return db[_0x9a72('0x28')][_0x9a72('0x44')]({'where':{'id':_0x563c67[_0x9a72('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d541e,null))[_0x9a72('0x20')](saveUpdates(_0x563c67[_0x9a72('0x45')],null))[_0x9a72('0x20')](respondWithResult(_0x2d541e,null))[_0x9a72('0x3f')](handleError(_0x2d541e,null));};exports['destroy']=function(_0xa95314,_0x109cfc){return db[_0x9a72('0x28')]['find']({'where':{'id':_0xa95314[_0x9a72('0x41')]['id']}})[_0x9a72('0x20')](handleEntityNotFound(_0x109cfc,null))[_0x9a72('0x20')](removeEntity(_0x109cfc,null))[_0x9a72('0x3f')](handleError(_0x109cfc,null));}; \ No newline at end of file +var _0x3dbe=['desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','CmContactHasPhones','UserProfileResource','then','error','stack','name','send','index','map','CmContactHasPhone','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','keys','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','squel','jsforce'];(function(_0x2d24e2,_0x38c3af){var _0x330f61=function(_0x15c233){while(--_0x15c233){_0x2d24e2['push'](_0x2d24e2['shift']());}};_0x330f61(++_0x38c3af);}(_0x3dbe,0x1c4));var _0xe3db=function(_0x34fa0f,_0x4e3226){_0x34fa0f=_0x34fa0f-0x0;var _0x40f50f=_0x3dbe[_0x34fa0f];return _0x40f50f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe3db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3db('0x1'));var jsonpatch=require(_0xe3db('0x2'));var rp=require('request-promise');var moment=require(_0xe3db('0x3'));var BPromise=require(_0xe3db('0x4'));var Mustache=require(_0xe3db('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe3db('0x6'));var ejs=require(_0xe3db('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe3db('0x8'));var crypto=require('crypto');var jsforce=require(_0xe3db('0x9'));var deskjs=require(_0xe3db('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe3db('0xb'));var Papa=require('papaparse');var Redis=require(_0xe3db('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe3db('0xd'));var as=require(_0xe3db('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3db('0xf'))(_0xe3db('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5934cf,_0x5a9cae){_0x5a9cae=_0x5a9cae||0xcc;return function(_0x46d37d){if(_0x46d37d){return _0x5934cf['sendStatus'](_0x5a9cae);}return _0x5934cf[_0xe3db('0x11')](_0x5a9cae)[_0xe3db('0x12')]();};}function respondWithResult(_0x4acfc9,_0x1d0055){_0x1d0055=_0x1d0055||0xc8;return function(_0x9bf5e4){if(_0x9bf5e4){return _0x4acfc9[_0xe3db('0x11')](_0x1d0055)[_0xe3db('0x13')](_0x9bf5e4);}};}function respondWithFilteredResult(_0x5e524c,_0x4f0c54){return function(_0x15e5d5){if(_0x15e5d5){var _0x1fd6d1=_0x15e5d5[_0xe3db('0x14')],_0x14f77d=_0x4f0c54[_0xe3db('0x15')],_0x4f4178=_0x4f0c54['offset']+_0x4f0c54[_0xe3db('0x16')],_0x211d03;if(_0x4f4178>=_0x1fd6d1){_0x4f4178=_0x1fd6d1;_0x211d03=0xc8;}else{_0x211d03=0xce;}_0x5e524c[_0xe3db('0x11')](_0x211d03);return _0x5e524c[_0xe3db('0x17')](_0xe3db('0x18'),_0x14f77d+'-'+_0x4f4178+'/'+_0x1fd6d1)['json'](_0x15e5d5);}return null;};}function patchUpdates(_0x4d6f3e){return function(_0x430708){try{jsonpatch[_0xe3db('0x19')](_0x430708,_0x4d6f3e,!![]);}catch(_0x2b826c){return BPromise[_0xe3db('0x1a')](_0x2b826c);}return _0x430708[_0xe3db('0x1b')]();};}function saveUpdates(_0x1e2ce0,_0x3a279){return function(_0x2b7d1c){if(_0x2b7d1c){return _0x2b7d1c[_0xe3db('0x1c')](_0x1e2ce0)['then'](function(_0x4a5b9e){return _0x4a5b9e;});}return null;};}function removeEntity(_0x5c45b2,_0x5297c4){return function(_0x396416){if(_0x396416){return _0x396416[_0xe3db('0x1d')]()['then'](function(){var _0x581b99=_0x396416[_0xe3db('0x1e')]({'plain':!![]});var _0x9a6bea=_0xe3db('0x1f');return db[_0xe3db('0x20')][_0xe3db('0x1d')]({'where':{'type':_0x9a6bea,'resourceId':_0x581b99['id']}})['then'](function(){return _0x396416;});})[_0xe3db('0x21')](function(){_0x5c45b2['status'](0xcc)[_0xe3db('0x12')]();});}};}function handleEntityNotFound(_0x34ffe3,_0x1bdd85){return function(_0x3d6a70){if(!_0x3d6a70){_0x34ffe3['sendStatus'](0x194);}return _0x3d6a70;};}function handleError(_0xcfef41,_0x19a768){_0x19a768=_0x19a768||0x1f4;return function(_0x2928cd){logger[_0xe3db('0x22')](_0x2928cd[_0xe3db('0x23')]);if(_0x2928cd[_0xe3db('0x24')]){delete _0x2928cd['name'];}_0xcfef41[_0xe3db('0x11')](_0x19a768)[_0xe3db('0x25')](_0x2928cd);};}exports[_0xe3db('0x26')]=function(_0x531ae2,_0x3b9c93){var _0x5f08bd={},_0x12b5aa={},_0x3d7dd3={'count':0x0,'rows':[]};var _0x3369b3=_[_0xe3db('0x27')](db[_0xe3db('0x28')][_0xe3db('0x29')],function(_0x10797e){return{'name':_0x10797e[_0xe3db('0x2a')],'type':_0x10797e[_0xe3db('0x2b')][_0xe3db('0x2c')]};});_0x12b5aa[_0xe3db('0x2d')]=_[_0xe3db('0x27')](_0x3369b3,_0xe3db('0x24'));_0x12b5aa[_0xe3db('0x2e')]=_['keys'](_0x531ae2[_0xe3db('0x2e')]);_0x12b5aa['filters']=_['intersection'](_0x12b5aa['model'],_0x12b5aa[_0xe3db('0x2e')]);_0x5f08bd[_0xe3db('0x2f')]=_['intersection'](_0x12b5aa[_0xe3db('0x2d')],qs[_0xe3db('0x30')](_0x531ae2[_0xe3db('0x2e')][_0xe3db('0x30')]));_0x5f08bd['attributes']=_0x5f08bd[_0xe3db('0x2f')][_0xe3db('0x31')]?_0x5f08bd[_0xe3db('0x2f')]:_0x12b5aa[_0xe3db('0x2d')];if(!_0x531ae2[_0xe3db('0x2e')][_0xe3db('0x32')](_0xe3db('0x33'))){_0x5f08bd[_0xe3db('0x16')]=qs[_0xe3db('0x16')](_0x531ae2['query'][_0xe3db('0x16')]);_0x5f08bd[_0xe3db('0x15')]=qs[_0xe3db('0x15')](_0x531ae2[_0xe3db('0x2e')][_0xe3db('0x15')]);}_0x5f08bd['order']=qs[_0xe3db('0x34')](_0x531ae2[_0xe3db('0x2e')][_0xe3db('0x34')]);_0x5f08bd[_0xe3db('0x35')]=qs['filters'](_[_0xe3db('0x36')](_0x531ae2['query'],_0x12b5aa[_0xe3db('0x37')]),_0x3369b3);if(_0x531ae2[_0xe3db('0x2e')][_0xe3db('0x38')]){_0x5f08bd[_0xe3db('0x35')]=_['merge'](_0x5f08bd[_0xe3db('0x35')],{'$or':_[_0xe3db('0x27')](_0x3369b3,function(_0x50c713){if(_0x50c713[_0xe3db('0x2b')]!==_0xe3db('0x39')){var _0x3e698d={};_0x3e698d[_0x50c713[_0xe3db('0x24')]]={'$like':'%'+_0x531ae2[_0xe3db('0x2e')]['filter']+'%'};return _0x3e698d;}})});}_0x5f08bd=_[_0xe3db('0x3a')]({},_0x5f08bd,_0x531ae2[_0xe3db('0x3b')]);var _0x471808={'where':_0x5f08bd[_0xe3db('0x35')]};return db[_0xe3db('0x28')]['count'](_0x471808)[_0xe3db('0x21')](function(_0x261cac){_0x3d7dd3[_0xe3db('0x14')]=_0x261cac;if(_0x531ae2[_0xe3db('0x2e')]['includeAll']){_0x5f08bd[_0xe3db('0x3c')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0xe3db('0x3d')](_0x5f08bd);})[_0xe3db('0x21')](function(_0x3acfaa){_0x3d7dd3[_0xe3db('0x3e')]=_0x3acfaa;return _0x3d7dd3;})[_0xe3db('0x21')](respondWithFilteredResult(_0x3b9c93,_0x5f08bd))[_0xe3db('0x3f')](handleError(_0x3b9c93,null));};exports[_0xe3db('0x40')]=function(_0x31737d,_0x28fd62){var _0x3d432f={'raw':!![],'where':{'id':_0x31737d['params']['id']}},_0x1b9cd8={};_0x1b9cd8['model']=_[_0xe3db('0x41')](db[_0xe3db('0x28')]['rawAttributes']);_0x1b9cd8[_0xe3db('0x2e')]=_[_0xe3db('0x41')](_0x31737d[_0xe3db('0x2e')]);_0x1b9cd8[_0xe3db('0x37')]=_[_0xe3db('0x42')](_0x1b9cd8[_0xe3db('0x2d')],_0x1b9cd8[_0xe3db('0x2e')]);_0x3d432f[_0xe3db('0x2f')]=_['intersection'](_0x1b9cd8['model'],qs[_0xe3db('0x30')](_0x31737d[_0xe3db('0x2e')]['fields']));_0x3d432f[_0xe3db('0x2f')]=_0x3d432f['attributes'][_0xe3db('0x31')]?_0x3d432f[_0xe3db('0x2f')]:_0x1b9cd8[_0xe3db('0x2d')];if(_0x31737d[_0xe3db('0x2e')][_0xe3db('0x43')]){_0x3d432f[_0xe3db('0x3c')]=[{'all':!![]}];}_0x3d432f=_['merge']({},_0x3d432f,_0x31737d[_0xe3db('0x3b')]);return db[_0xe3db('0x28')][_0xe3db('0x44')](_0x3d432f)['then'](handleEntityNotFound(_0x28fd62,null))[_0xe3db('0x21')](respondWithResult(_0x28fd62,null))[_0xe3db('0x3f')](handleError(_0x28fd62,null));};exports[_0xe3db('0x45')]=function(_0x466389,_0x12cffe){return db[_0xe3db('0x28')][_0xe3db('0x45')](_0x466389[_0xe3db('0x46')],{})[_0xe3db('0x21')](function(_0x1554fc){var _0x19e878=_0x466389[_0xe3db('0x47')][_0xe3db('0x1e')]({'plain':!![]});if(!_0x19e878)throw new Error(_0xe3db('0x48'));if(_0x19e878[_0xe3db('0x49')]==='user'){var _0x350f4f=_0x1554fc['get']({'plain':!![]});var _0x381c9c=_0xe3db('0x1f');return db[_0xe3db('0x4a')][_0xe3db('0x44')]({'where':{'name':_0x381c9c,'userProfileId':_0x19e878[_0xe3db('0x4b')]},'raw':!![]})[_0xe3db('0x21')](function(_0x25cb4d){if(_0x25cb4d&&_0x25cb4d['autoAssociation']===0x0){return db[_0xe3db('0x20')][_0xe3db('0x45')]({'name':_0x350f4f['name'],'resourceId':_0x350f4f['id'],'type':_0x25cb4d['name'],'sectionId':_0x25cb4d['id']},{})[_0xe3db('0x21')](function(){return _0x1554fc;});}else{return _0x1554fc;}})[_0xe3db('0x3f')](function(_0x45a9cd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45a9cd);throw _0x45a9cd;});}return _0x1554fc;})['then'](respondWithResult(_0x12cffe,0xc9))[_0xe3db('0x3f')](handleError(_0x12cffe,null));};exports[_0xe3db('0x1c')]=function(_0x4746b2,_0x378584){if(_0x4746b2[_0xe3db('0x46')]['id']){delete _0x4746b2[_0xe3db('0x46')]['id'];}return db['CmContactHasPhone'][_0xe3db('0x44')]({'where':{'id':_0x4746b2['params']['id']}})[_0xe3db('0x21')](handleEntityNotFound(_0x378584,null))[_0xe3db('0x21')](saveUpdates(_0x4746b2[_0xe3db('0x46')],null))['then'](respondWithResult(_0x378584,null))['catch'](handleError(_0x378584,null));};exports[_0xe3db('0x1d')]=function(_0x5b84ec,_0xe237b9){return db[_0xe3db('0x28')][_0xe3db('0x44')]({'where':{'id':_0x5b84ec[_0xe3db('0x4c')]['id']}})[_0xe3db('0x21')](handleEntityNotFound(_0xe237b9,null))[_0xe3db('0x21')](removeEntity(_0xe237b9,null))[_0xe3db('0x3f')](handleError(_0xe237b9,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index e7fb1d6..d279a6e 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 _0xc3b5=['define','CmContactHasPhone','cm_contact_has_phones','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x118a4d,_0x4f8a9b){_0x118a4d=_0x118a4d-0x0;var _0x1db339=_0xc3b5[_0x118a4d];return _0x1db339;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c3b('0x0'))(_0x5c3b('0x1'));var moment=require(_0x5c3b('0x2'));var BPromise=require(_0x5c3b('0x3'));var rp=require(_0x5c3b('0x4'));var fs=require('fs');var path=require(_0x5c3b('0x5'));var rimraf=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var attributes=require('./cmContactHasPhone.attributes');module[_0x5c3b('0x8')]=function(_0x6b8a1e,_0x56345e){return _0x6b8a1e[_0x5c3b('0x9')](_0x5c3b('0xa'),attributes,{'tableName':_0x5c3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a16=['exports','cm_contact_has_phones','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./cmContactHasPhone.attributes'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x3a16,0x192));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x63a1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x63a1('0x1'));var moment=require(_0x63a1('0x2'));var BPromise=require(_0x63a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x63a1('0x4'));var rimraf=require(_0x63a1('0x5'));var config=require(_0x63a1('0x6'));var attributes=require(_0x63a1('0x7'));module[_0x63a1('0x8')]=function(_0x392dce,_0x14a8eb){return _0x392dce['define']('CmContactHasPhone',attributes,{'tableName':_0x63a1('0x9'),'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 e16f09b..dfbb416 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 _0xf96b=['../../config/environment','jayson/promise','client','request','then','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ba5e4,_0x52418e){var _0x2e4feb=function(_0x33ae9a){while(--_0x33ae9a){_0x3ba5e4['push'](_0x3ba5e4['shift']());}};_0x2e4feb(++_0x52418e);}(_0xf96b,0x109));var _0xbf96=function(_0x5d337c,_0x59ffc9){_0x5d337c=_0x5d337c-0x0;var _0x55be38=_0xf96b[_0x5d337c];return _0x55be38;};'use strict';var _=require(_0xbf96('0x0'));var util=require(_0xbf96('0x1'));var moment=require(_0xbf96('0x2'));var BPromise=require(_0xbf96('0x3'));var rs=require(_0xbf96('0x4'));var fs=require('fs');var Redis=require(_0xbf96('0x5'));var db=require(_0xbf96('0x6'))['db'];var utils=require(_0xbf96('0x7'));var logger=require(_0xbf96('0x8'))(_0xbf96('0x9'));var config=require(_0xbf96('0xa'));var jayson=require(_0xbf96('0xb'));var client=jayson[_0xbf96('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8271,_0x9270ca,_0x260da0){return new BPromise(function(_0x88b9fa,_0x56d77d){return client[_0xbf96('0xd')](_0x3e8271,_0x260da0)[_0xbf96('0xe')](function(_0x1ffe6b){logger[_0xbf96('0xf')](_0xbf96('0x10'),_0x9270ca,_0xbf96('0x11'));logger[_0xbf96('0x12')](_0xbf96('0x13'),_0x9270ca,'request\x20sent',JSON[_0xbf96('0x14')](_0x1ffe6b));if(_0x1ffe6b[_0xbf96('0x15')]){if(_0x1ffe6b['error'][_0xbf96('0x16')]===0x1f4){logger[_0xbf96('0x15')](_0xbf96('0x10'),_0x9270ca,_0x1ffe6b['error'][_0xbf96('0x17')]);return _0x56d77d(_0x1ffe6b[_0xbf96('0x15')][_0xbf96('0x17')]);}logger[_0xbf96('0x15')](_0xbf96('0x10'),_0x9270ca,_0x1ffe6b[_0xbf96('0x15')]['message']);return _0x88b9fa(_0x1ffe6b[_0xbf96('0x15')][_0xbf96('0x17')]);}else{logger[_0xbf96('0xf')](_0xbf96('0x10'),_0x9270ca,_0xbf96('0x11'));_0x88b9fa(_0x1ffe6b[_0xbf96('0x18')][_0xbf96('0x17')]);}})['catch'](function(_0x3296a7){logger['error'](_0xbf96('0x10'),_0x9270ca,_0x3296a7);_0x56d77d(_0x3296a7);});});} \ No newline at end of file +var _0xa378=['code','CmContactHasPhone,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xa378,0x8e));var _0x8a37=function(_0x221ee7,_0x4721c5){_0x221ee7=_0x221ee7-0x0;var _0x3ffb93=_0xa378[_0x221ee7];return _0x3ffb93;};'use strict';var _=require('lodash');var util=require(_0x8a37('0x0'));var moment=require(_0x8a37('0x1'));var BPromise=require(_0x8a37('0x2'));var rs=require(_0x8a37('0x3'));var fs=require('fs');var Redis=require(_0x8a37('0x4'));var db=require(_0x8a37('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a37('0x6'))(_0x8a37('0x7'));var config=require(_0x8a37('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8a37('0x9')][_0x8a37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b4d88,_0x371ae3,_0x49d389){return new BPromise(function(_0x4f47d1,_0xc0e2a7){return client[_0x8a37('0xb')](_0x1b4d88,_0x49d389)[_0x8a37('0xc')](function(_0x3ea9ef){logger[_0x8a37('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x371ae3,'request\x20sent');logger[_0x8a37('0xe')](_0x8a37('0xf'),_0x371ae3,_0x8a37('0x10'),JSON[_0x8a37('0x11')](_0x3ea9ef));if(_0x3ea9ef[_0x8a37('0x12')]){if(_0x3ea9ef[_0x8a37('0x12')][_0x8a37('0x13')]===0x1f4){logger[_0x8a37('0x12')](_0x8a37('0x14'),_0x371ae3,_0x3ea9ef[_0x8a37('0x12')][_0x8a37('0x15')]);return _0xc0e2a7(_0x3ea9ef[_0x8a37('0x12')][_0x8a37('0x15')]);}logger[_0x8a37('0x12')](_0x8a37('0x14'),_0x371ae3,_0x3ea9ef[_0x8a37('0x12')][_0x8a37('0x15')]);return _0x4f47d1(_0x3ea9ef[_0x8a37('0x12')][_0x8a37('0x15')]);}else{logger[_0x8a37('0xd')](_0x8a37('0x14'),_0x371ae3,'request\x20sent');_0x4f47d1(_0x3ea9ef['result'][_0x8a37('0x15')]);}})[_0x8a37('0x16')](function(_0x1bb938){logger[_0x8a37('0x12')](_0x8a37('0x14'),_0x371ae3,_0x1bb938);_0xc0e2a7(_0x1bb938);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index f3f74eb..0ffc2cb 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 _0x2024=['delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x2024,0x192));var _0x4202=function(_0xbca48f,_0xaaf54a){_0xbca48f=_0xbca48f-0x0;var _0x454a43=_0x2024[_0xbca48f];return _0x454a43;};'use strict';var multer=require(_0x4202('0x0'));var util=require(_0x4202('0x1'));var path=require(_0x4202('0x2'));var timeout=require(_0x4202('0x3'));var express=require('express');var router=express[_0x4202('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4202('0x5'));var config=require(_0x4202('0x6'));var controller=require(_0x4202('0x7'));router[_0x4202('0x8')]('/',auth[_0x4202('0x9')](),controller[_0x4202('0xa')]);router[_0x4202('0x8')](_0x4202('0xb'),auth[_0x4202('0x9')](),controller[_0x4202('0xc')]);router[_0x4202('0xd')]('/',auth[_0x4202('0x9')](),controller['create']);router['put'](_0x4202('0xb'),auth[_0x4202('0x9')](),controller['update']);router[_0x4202('0xe')](_0x4202('0xb'),auth[_0x4202('0x9')](),controller['destroy']);module[_0x4202('0xf')]=router; \ No newline at end of file +var _0x2831=['/:id','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','show','create','put'];(function(_0x38a96e,_0x15a25e){var _0x4ef457=function(_0x393a1e){while(--_0x393a1e){_0x38a96e['push'](_0x38a96e['shift']());}};_0x4ef457(++_0x15a25e);}(_0x2831,0x123));var _0x1283=function(_0xbfe61c,_0x13b08a){_0xbfe61c=_0xbfe61c-0x0;var _0x52922e=_0x2831[_0xbfe61c];return _0x52922e;};'use strict';var multer=require('multer');var util=require(_0x1283('0x0'));var path=require(_0x1283('0x1'));var timeout=require(_0x1283('0x2'));var express=require(_0x1283('0x3'));var router=express[_0x1283('0x4')]();var auth=require(_0x1283('0x5'));var interaction=require(_0x1283('0x6'));var config=require(_0x1283('0x7'));var controller=require(_0x1283('0x8'));router[_0x1283('0x9')]('/',auth[_0x1283('0xa')](),controller[_0x1283('0xb')]);router[_0x1283('0x9')]('/:id',auth[_0x1283('0xa')](),controller[_0x1283('0xc')]);router['post']('/',auth[_0x1283('0xa')](),controller[_0x1283('0xd')]);router[_0x1283('0xe')](_0x1283('0xf'),auth[_0x1283('0xa')](),controller[_0x1283('0x10')]);router['delete'](_0x1283('0xf'),auth[_0x1283('0xa')](),controller['destroy']);module[_0x1283('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 2676346..e661b38 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 _0x877f=['parse','values','isArray','stringify','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','type','select'];(function(_0x444f6a,_0x37dc05){var _0xa8059d=function(_0x2db79d){while(--_0x2db79d){_0x444f6a['push'](_0x444f6a['shift']());}};_0xa8059d(++_0x37dc05);}(_0x877f,0x9a));var _0xf877=function(_0x27f649,_0x5f518c){_0x27f649=_0x27f649-0x0;var _0x2c9e85=_0x877f[_0x27f649];return _0x2c9e85;};'use strict';var Sequelize=require(_0xf877('0x0'));var _=require('lodash');module[_0xf877('0x1')]={'name':{'type':Sequelize[_0xf877('0x2')],'get':function(_0x21dda2){return this[_0xf877('0x3')](_0xf877('0x4'));}},'alias':{'type':Sequelize[_0xf877('0x5')],'allowNull':![],'set':function(_0x999ed7){this[_0xf877('0x6')](_0xf877('0x4'),_0x999ed7?_0x999ed7:this[_0xf877('0x3')](_0xf877('0x7')));}},'type':{'type':Sequelize[_0xf877('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf877('0x8')]('long'),'get':function(){if(this[_0xf877('0x3')](_0xf877('0x9'))===_0xf877('0xa')){return JSON[_0xf877('0xb')](this[_0xf877('0x3')](_0xf877('0xc')));}else{return this[_0xf877('0x3')](_0xf877('0xc'));}},'set':function(_0x57bdba){if(Array[_0xf877('0xd')](_0x57bdba)){this[_0xf877('0x6')]('values',JSON[_0xf877('0xe')](_0x57bdba));}else{this[_0xf877('0x6')](_0xf877('0xc'),_0x57bdba);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1c89=['values','stringify','BOOLEAN','sequelize','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse'];(function(_0x414032,_0x49f061){var _0x16da4d=function(_0x3a0b15){while(--_0x3a0b15){_0x414032['push'](_0x414032['shift']());}};_0x16da4d(++_0x49f061);}(_0x1c89,0x1df));var _0x91c8=function(_0x5dc0de,_0x25bba4){_0x5dc0de=_0x5dc0de-0x0;var _0x54ba0e=_0x1c89[_0x5dc0de];return _0x54ba0e;};'use strict';var Sequelize=require(_0x91c8('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x91c8('0x1')],'get':function(_0x5b4254){return this[_0x91c8('0x2')](_0x91c8('0x3'));}},'alias':{'type':Sequelize[_0x91c8('0x4')],'allowNull':![],'set':function(_0x4c5dfb){this[_0x91c8('0x5')](_0x91c8('0x3'),_0x4c5dfb?_0x4c5dfb:this['getDataValue'](_0x91c8('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x91c8('0x7')](_0x91c8('0x8')),'get':function(){if(this[_0x91c8('0x2')]('type')===_0x91c8('0x9')){return JSON[_0x91c8('0xa')](this[_0x91c8('0x2')](_0x91c8('0xb')));}else{return this[_0x91c8('0x2')](_0x91c8('0xb'));}},'set':function(_0x286562){if(Array['isArray'](_0x286562)){this[_0x91c8('0x5')](_0x91c8('0xb'),JSON[_0x91c8('0xc')](_0x286562));}else{this['setDataValue']('values',_0x286562);}}},'required':{'type':Sequelize[_0x91c8('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 80d6b7a..6e7bee1 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 _0x30cd=['show','rawAttributes','fields','includeAll','find','body','params','create','sequelize','transaction','Sequelize','number','INTEGER','BOOLEAN','queryInterface','format','cf_%d','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','CmCustomField','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch'];(function(_0x4cce3e,_0x4a1349){var _0x391e08=function(_0x4b6708){while(--_0x4b6708){_0x4cce3e['push'](_0x4cce3e['shift']());}};_0x391e08(++_0x4a1349);}(_0x30cd,0x66));var _0xd30c=function(_0x2f0ec8,_0x2049da){_0x2f0ec8=_0x2f0ec8-0x0;var _0x4d0694=_0x30cd[_0x2f0ec8];return _0x4d0694;};'use strict';var pdf=require(_0xd30c('0x0'));var emlformat=require(_0xd30c('0x1'));var rimraf=require(_0xd30c('0x2'));var zipdir=require(_0xd30c('0x3'));var jsonpatch=require(_0xd30c('0x4'));var rp=require('request-promise');var moment=require(_0xd30c('0x5'));var BPromise=require(_0xd30c('0x6'));var Mustache=require(_0xd30c('0x7'));var util=require(_0xd30c('0x8'));var path=require('path');var sox=require(_0xd30c('0x9'));var csv=require(_0xd30c('0xa'));var ejs=require(_0xd30c('0xb'));var fs=require('fs');var _=require(_0xd30c('0xc'));var squel=require(_0xd30c('0xd'));var crypto=require(_0xd30c('0xe'));var jsforce=require(_0xd30c('0xf'));var deskjs=require(_0xd30c('0x10'));var toCsv=require(_0xd30c('0xa'));var querystring=require(_0xd30c('0x11'));var Papa=require(_0xd30c('0x12'));var Redis=require(_0xd30c('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd30c('0x14'));var hardwareService=require(_0xd30c('0x15'));var logger=require(_0xd30c('0x16'))(_0xd30c('0x17'));var utils=require(_0xd30c('0x18'));var config=require('../../config/environment');var db=require(_0xd30c('0x19'))['db'];function respondWithStatusCode(_0x7b8e6,_0x2cfe08){_0x2cfe08=_0x2cfe08||0xcc;return function(_0x33989f){if(_0x33989f){return _0x7b8e6['sendStatus'](_0x2cfe08);}return _0x7b8e6['status'](_0x2cfe08)[_0xd30c('0x1a')]();};}function respondWithResult(_0x42bcb1,_0x1b8ee6){_0x1b8ee6=_0x1b8ee6||0xc8;return function(_0x18f1bd){if(_0x18f1bd){return _0x42bcb1[_0xd30c('0x1b')](_0x1b8ee6)[_0xd30c('0x1c')](_0x18f1bd);}};}function respondWithFilteredResult(_0x3b4d8e,_0x3fb01d){return function(_0x5cc320){if(_0x5cc320){var _0x53a3bd=_0x5cc320[_0xd30c('0x1d')],_0x423b12=_0x3fb01d[_0xd30c('0x1e')],_0x2634cc=_0x3fb01d[_0xd30c('0x1e')]+_0x3fb01d[_0xd30c('0x1f')],_0x2099bd;if(_0x2634cc>=_0x53a3bd){_0x2634cc=_0x53a3bd;_0x2099bd=0xc8;}else{_0x2099bd=0xce;}_0x3b4d8e['status'](_0x2099bd);return _0x3b4d8e['set'](_0xd30c('0x20'),_0x423b12+'-'+_0x2634cc+'/'+_0x53a3bd)[_0xd30c('0x1c')](_0x5cc320);}return null;};}function patchUpdates(_0x5f2ec8){return function(_0x36edba){try{jsonpatch[_0xd30c('0x21')](_0x36edba,_0x5f2ec8,!![]);}catch(_0x3d2d8a){return BPromise[_0xd30c('0x22')](_0x3d2d8a);}return _0x36edba[_0xd30c('0x23')]();};}function saveUpdates(_0x21df6f,_0x33a01b){return function(_0xadfd10){if(_0xadfd10){return _0xadfd10[_0xd30c('0x24')](_0x21df6f)['then'](function(_0x4a657b){return _0x4a657b;});}return null;};}function removeEntity(_0x1850b1,_0x2b8925){return function(_0xe71865){if(_0xe71865){return _0xe71865[_0xd30c('0x25')]()[_0xd30c('0x26')](function(){_0x1850b1['status'](0xcc)[_0xd30c('0x1a')]();});}};}function handleEntityNotFound(_0x510075,_0x365dd6){return function(_0x19dbdf){if(!_0x19dbdf){_0x510075[_0xd30c('0x27')](0x194);}return _0x19dbdf;};}function handleError(_0x3a8ea2,_0x2d7630){_0x2d7630=_0x2d7630||0x1f4;return function(_0x5ee252){logger[_0xd30c('0x28')](_0x5ee252[_0xd30c('0x29')]);if(_0x5ee252[_0xd30c('0x2a')]){delete _0x5ee252['name'];}_0x3a8ea2['status'](_0x2d7630)[_0xd30c('0x2b')](_0x5ee252);};}exports['index']=function(_0x1927bc,_0x41edce){var _0x524f39={},_0x432902={},_0x422edd={'count':0x0,'rows':[]};var _0x4b8078=_[_0xd30c('0x2c')](db[_0xd30c('0x2d')]['rawAttributes'],function(_0x122713){return{'name':_0x122713[_0xd30c('0x2e')],'type':_0x122713[_0xd30c('0x2f')][_0xd30c('0x30')]};});_0x432902[_0xd30c('0x31')]=_['differenceBy'](_[_0xd30c('0x2c')](_0x4b8078,_0xd30c('0x2a')),[_0xd30c('0x2a')]);_0x432902[_0xd30c('0x32')]=_[_0xd30c('0x33')](_0x1927bc['query']);_0x432902[_0xd30c('0x34')]=_[_0xd30c('0x35')](_0x432902[_0xd30c('0x31')],_0x432902[_0xd30c('0x32')]);_0x524f39[_0xd30c('0x36')]=_[_0xd30c('0x35')](_0x432902['model'],qs['fields'](_0x1927bc['query']['fields']));_0x524f39[_0xd30c('0x36')]=_0x524f39['attributes'][_0xd30c('0x37')]?_0x524f39[_0xd30c('0x36')]:_0x432902[_0xd30c('0x31')];if(!_0x1927bc[_0xd30c('0x32')][_0xd30c('0x38')](_0xd30c('0x39'))){_0x524f39['limit']=qs[_0xd30c('0x1f')](_0x1927bc[_0xd30c('0x32')][_0xd30c('0x1f')]);_0x524f39['offset']=qs['offset'](_0x1927bc[_0xd30c('0x32')][_0xd30c('0x1e')]);}_0x524f39['order']=qs['sort'](_0x1927bc[_0xd30c('0x32')][_0xd30c('0x3a')]);_0x524f39[_0xd30c('0x3b')]=qs[_0xd30c('0x34')](_['pick'](_0x1927bc[_0xd30c('0x32')],_0x432902['filters']),_0x4b8078);if(_0x1927bc['query'][_0xd30c('0x3c')]){_0x524f39[_0xd30c('0x3b')]=_['merge'](_0x524f39[_0xd30c('0x3b')],{'$or':_[_0xd30c('0x2c')](_0x4b8078,function(_0x58b893){if(_0x58b893[_0xd30c('0x2f')]!==_0xd30c('0x3d')){var _0x1b14a2={};_0x1b14a2[_0x58b893[_0xd30c('0x2a')]]={'$like':'%'+_0x1927bc['query'][_0xd30c('0x3c')]+'%'};return _0x1b14a2;}})});}_0x524f39=_[_0xd30c('0x3e')]({},_0x524f39,_0x1927bc[_0xd30c('0x3f')]);var _0x3977f3={'where':_0x524f39[_0xd30c('0x3b')]};return db[_0xd30c('0x2d')]['count'](_0x3977f3)[_0xd30c('0x26')](function(_0x34c040){_0x422edd['count']=_0x34c040;if(_0x1927bc['query']['includeAll']){_0x524f39[_0xd30c('0x40')]=[{'all':!![]}];}return db[_0xd30c('0x2d')][_0xd30c('0x41')](_0x524f39);})['then'](function(_0x1316ff){_0x422edd[_0xd30c('0x42')]=_0x1316ff;return _0x422edd;})['then'](respondWithFilteredResult(_0x41edce,_0x524f39))[_0xd30c('0x43')](handleError(_0x41edce,null));};exports[_0xd30c('0x44')]=function(_0x1ecd7f,_0x493715){var _0x11ad36={'raw':!![],'where':{'id':_0x1ecd7f['params']['id']}},_0x5022c1={};_0x5022c1[_0xd30c('0x31')]=_[_0xd30c('0x33')](db[_0xd30c('0x2d')][_0xd30c('0x45')]);_0x5022c1[_0xd30c('0x32')]=_[_0xd30c('0x33')](_0x1ecd7f[_0xd30c('0x32')]);_0x5022c1['filters']=_[_0xd30c('0x35')](_0x5022c1[_0xd30c('0x31')],_0x5022c1['query']);_0x11ad36[_0xd30c('0x36')]=_['intersection'](_0x5022c1[_0xd30c('0x31')],qs[_0xd30c('0x46')](_0x1ecd7f[_0xd30c('0x32')][_0xd30c('0x46')]));_0x11ad36['attributes']=_0x11ad36[_0xd30c('0x36')][_0xd30c('0x37')]?_0x11ad36[_0xd30c('0x36')]:_0x5022c1[_0xd30c('0x31')];if(_0x1ecd7f[_0xd30c('0x32')][_0xd30c('0x47')]){_0x11ad36[_0xd30c('0x40')]=[{'all':!![]}];}_0x11ad36=_[_0xd30c('0x3e')]({},_0x11ad36,_0x1ecd7f[_0xd30c('0x3f')]);return db['CmCustomField'][_0xd30c('0x48')](_0x11ad36)[_0xd30c('0x26')](handleEntityNotFound(_0x493715,null))[_0xd30c('0x26')](respondWithResult(_0x493715,null))[_0xd30c('0x43')](handleError(_0x493715,null));};exports['update']=function(_0x5b8900,_0x1e2146){if(_0x5b8900[_0xd30c('0x49')]['id']){delete _0x5b8900['body']['id'];}return db[_0xd30c('0x2d')][_0xd30c('0x48')]({'where':{'id':_0x5b8900['params']['id']}})['then'](handleEntityNotFound(_0x1e2146,null))[_0xd30c('0x26')](saveUpdates(_0x5b8900[_0xd30c('0x49')],null))[_0xd30c('0x26')](respondWithResult(_0x1e2146,null))['catch'](handleError(_0x1e2146,null));};exports[_0xd30c('0x25')]=function(_0x2a6328,_0x496fe9){return db['CmCustomField'][_0xd30c('0x48')]({'where':{'id':_0x2a6328[_0xd30c('0x4a')]['id']}})[_0xd30c('0x26')](handleEntityNotFound(_0x496fe9,null))[_0xd30c('0x26')](removeEntity(_0x496fe9,null))[_0xd30c('0x43')](handleError(_0x496fe9,null));};exports[_0xd30c('0x4b')]=function(_0x224afa,_0x48944f){var _0x2d88c2;return db[_0xd30c('0x4c')][_0xd30c('0x4d')](function(_0x15884c){return db['CmCustomField'][_0xd30c('0x4b')](_0x224afa[_0xd30c('0x49')],{'transaction':_0x15884c})[_0xd30c('0x26')](function(_0x235596){_0x2d88c2=_0x235596;var _0x5e5d4e={'type':db[_0xd30c('0x4e')]['TEXT'],'transaction':_0x15884c};switch(_0x224afa[_0xd30c('0x49')]['type']){case'text':_0x5e5d4e[_0xd30c('0x2f')]=db[_0xd30c('0x4e')]['TEXT'];break;case _0xd30c('0x4f'):_0x5e5d4e[_0xd30c('0x2f')]=db[_0xd30c('0x4e')][_0xd30c('0x50')];break;case'switch':_0x5e5d4e[_0xd30c('0x2f')]=db[_0xd30c('0x4e')][_0xd30c('0x51')];_0x5e5d4e['defaultValue']=![];break;default:}return db['sequelize'][_0xd30c('0x52')]['addColumn']('cm_contacts',util[_0xd30c('0x53')](_0xd30c('0x54'),_0x2d88c2['id']),_0x5e5d4e);})[_0xd30c('0x26')](function(){return _0x2d88c2;});})[_0xd30c('0x26')](respondWithResult(_0x48944f,0xc9))[_0xd30c('0x43')](handleError(_0x48944f,null));}; \ No newline at end of file +var _0xc72a=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','body','destroy','find','create','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','send','index','CmCustomField','rawAttributes','type','key','name','query','keys','filters','intersection','model','fields','attributes'];(function(_0x53f862,_0x5a76c3){var _0x2e8b3a=function(_0x5cb648){while(--_0x5cb648){_0x53f862['push'](_0x53f862['shift']());}};_0x2e8b3a(++_0x5a76c3);}(_0xc72a,0x188));var _0xac72=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0xc72a[_0x2136d5];return _0x3bee2e;};'use strict';var pdf=require(_0xac72('0x0'));var emlformat=require(_0xac72('0x1'));var rimraf=require(_0xac72('0x2'));var zipdir=require(_0xac72('0x3'));var jsonpatch=require(_0xac72('0x4'));var rp=require(_0xac72('0x5'));var moment=require(_0xac72('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac72('0x7'));var path=require('path');var sox=require(_0xac72('0x8'));var csv=require(_0xac72('0x9'));var ejs=require(_0xac72('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xac72('0xb'));var crypto=require('crypto');var jsforce=require(_0xac72('0xc'));var deskjs=require(_0xac72('0xd'));var toCsv=require('to-csv');var querystring=require(_0xac72('0xe'));var Papa=require(_0xac72('0xf'));var Redis=require(_0xac72('0x10'));var authService=require(_0xac72('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xac72('0x12'));var hardwareService=require(_0xac72('0x13'));var logger=require(_0xac72('0x14'))('api');var utils=require(_0xac72('0x15'));var config=require(_0xac72('0x16'));var db=require(_0xac72('0x17'))['db'];function respondWithStatusCode(_0x314a5a,_0xf6427a){_0xf6427a=_0xf6427a||0xcc;return function(_0x4fb7bf){if(_0x4fb7bf){return _0x314a5a[_0xac72('0x18')](_0xf6427a);}return _0x314a5a[_0xac72('0x19')](_0xf6427a)[_0xac72('0x1a')]();};}function respondWithResult(_0xf7214c,_0xaf148){_0xaf148=_0xaf148||0xc8;return function(_0x40186a){if(_0x40186a){return _0xf7214c['status'](_0xaf148)[_0xac72('0x1b')](_0x40186a);}};}function respondWithFilteredResult(_0x30d0d5,_0x143e75){return function(_0x2ed884){if(_0x2ed884){var _0x4c08b1=_0x2ed884[_0xac72('0x1c')],_0x20addc=_0x143e75[_0xac72('0x1d')],_0x2e30c7=_0x143e75[_0xac72('0x1d')]+_0x143e75[_0xac72('0x1e')],_0x382eb9;if(_0x2e30c7>=_0x4c08b1){_0x2e30c7=_0x4c08b1;_0x382eb9=0xc8;}else{_0x382eb9=0xce;}_0x30d0d5['status'](_0x382eb9);return _0x30d0d5[_0xac72('0x1f')](_0xac72('0x20'),_0x20addc+'-'+_0x2e30c7+'/'+_0x4c08b1)[_0xac72('0x1b')](_0x2ed884);}return null;};}function patchUpdates(_0x3bb841){return function(_0x12d9c8){try{jsonpatch[_0xac72('0x21')](_0x12d9c8,_0x3bb841,!![]);}catch(_0x4b16a8){return BPromise[_0xac72('0x22')](_0x4b16a8);}return _0x12d9c8['save']();};}function saveUpdates(_0xf2c64c,_0x33c821){return function(_0x4cdf25){if(_0x4cdf25){return _0x4cdf25[_0xac72('0x23')](_0xf2c64c)['then'](function(_0x17f52a){return _0x17f52a;});}return null;};}function removeEntity(_0x264366,_0x16ed97){return function(_0x4258b7){if(_0x4258b7){return _0x4258b7['destroy']()[_0xac72('0x24')](function(){_0x264366[_0xac72('0x19')](0xcc)[_0xac72('0x1a')]();});}};}function handleEntityNotFound(_0x16f249,_0x2e1fb4){return function(_0x41d038){if(!_0x41d038){_0x16f249[_0xac72('0x18')](0x194);}return _0x41d038;};}function handleError(_0x43ffe5,_0x51d2f8){_0x51d2f8=_0x51d2f8||0x1f4;return function(_0x1444c5){logger[_0xac72('0x25')](_0x1444c5[_0xac72('0x26')]);if(_0x1444c5['name']){delete _0x1444c5['name'];}_0x43ffe5[_0xac72('0x19')](_0x51d2f8)[_0xac72('0x27')](_0x1444c5);};}exports[_0xac72('0x28')]=function(_0xec7229,_0x4dd86e){var _0x772278={},_0x55cbe5={},_0x537efd={'count':0x0,'rows':[]};var _0x172baa=_['map'](db[_0xac72('0x29')][_0xac72('0x2a')],function(_0x3a39d1){return{'name':_0x3a39d1['fieldName'],'type':_0x3a39d1[_0xac72('0x2b')][_0xac72('0x2c')]};});_0x55cbe5['model']=_['differenceBy'](_['map'](_0x172baa,_0xac72('0x2d')),['name']);_0x55cbe5[_0xac72('0x2e')]=_[_0xac72('0x2f')](_0xec7229['query']);_0x55cbe5[_0xac72('0x30')]=_[_0xac72('0x31')](_0x55cbe5[_0xac72('0x32')],_0x55cbe5[_0xac72('0x2e')]);_0x772278['attributes']=_[_0xac72('0x31')](_0x55cbe5[_0xac72('0x32')],qs[_0xac72('0x33')](_0xec7229[_0xac72('0x2e')][_0xac72('0x33')]));_0x772278[_0xac72('0x34')]=_0x772278[_0xac72('0x34')][_0xac72('0x35')]?_0x772278[_0xac72('0x34')]:_0x55cbe5['model'];if(!_0xec7229[_0xac72('0x2e')][_0xac72('0x36')](_0xac72('0x37'))){_0x772278[_0xac72('0x1e')]=qs[_0xac72('0x1e')](_0xec7229[_0xac72('0x2e')][_0xac72('0x1e')]);_0x772278[_0xac72('0x1d')]=qs[_0xac72('0x1d')](_0xec7229[_0xac72('0x2e')]['offset']);}_0x772278[_0xac72('0x38')]=qs[_0xac72('0x39')](_0xec7229[_0xac72('0x2e')][_0xac72('0x39')]);_0x772278[_0xac72('0x3a')]=qs[_0xac72('0x30')](_[_0xac72('0x3b')](_0xec7229[_0xac72('0x2e')],_0x55cbe5[_0xac72('0x30')]),_0x172baa);if(_0xec7229['query'][_0xac72('0x3c')]){_0x772278['where']=_[_0xac72('0x3d')](_0x772278[_0xac72('0x3a')],{'$or':_['map'](_0x172baa,function(_0x3e26c4){if(_0x3e26c4[_0xac72('0x2b')]!==_0xac72('0x3e')){var _0x2913e0={};_0x2913e0[_0x3e26c4[_0xac72('0x2d')]]={'$like':'%'+_0xec7229['query']['filter']+'%'};return _0x2913e0;}})});}_0x772278=_[_0xac72('0x3d')]({},_0x772278,_0xec7229[_0xac72('0x3f')]);var _0x2fc954={'where':_0x772278['where']};return db[_0xac72('0x29')][_0xac72('0x1c')](_0x2fc954)[_0xac72('0x24')](function(_0x290c22){_0x537efd[_0xac72('0x1c')]=_0x290c22;if(_0xec7229[_0xac72('0x2e')]['includeAll']){_0x772278[_0xac72('0x40')]=[{'all':!![]}];}return db[_0xac72('0x29')][_0xac72('0x41')](_0x772278);})[_0xac72('0x24')](function(_0x2a2a6e){_0x537efd[_0xac72('0x42')]=_0x2a2a6e;return _0x537efd;})[_0xac72('0x24')](respondWithFilteredResult(_0x4dd86e,_0x772278))[_0xac72('0x43')](handleError(_0x4dd86e,null));};exports[_0xac72('0x44')]=function(_0x46f556,_0x1e95d1){var _0x1a4c6={'raw':!![],'where':{'id':_0x46f556[_0xac72('0x45')]['id']}},_0x173f9c={};_0x173f9c[_0xac72('0x32')]=_[_0xac72('0x2f')](db[_0xac72('0x29')][_0xac72('0x2a')]);_0x173f9c['query']=_[_0xac72('0x2f')](_0x46f556['query']);_0x173f9c[_0xac72('0x30')]=_[_0xac72('0x31')](_0x173f9c['model'],_0x173f9c['query']);_0x1a4c6['attributes']=_[_0xac72('0x31')](_0x173f9c['model'],qs['fields'](_0x46f556[_0xac72('0x2e')][_0xac72('0x33')]));_0x1a4c6[_0xac72('0x34')]=_0x1a4c6['attributes'][_0xac72('0x35')]?_0x1a4c6[_0xac72('0x34')]:_0x173f9c[_0xac72('0x32')];if(_0x46f556[_0xac72('0x2e')][_0xac72('0x46')]){_0x1a4c6['include']=[{'all':!![]}];}_0x1a4c6=_['merge']({},_0x1a4c6,_0x46f556[_0xac72('0x3f')]);return db[_0xac72('0x29')]['find'](_0x1a4c6)[_0xac72('0x24')](handleEntityNotFound(_0x1e95d1,null))[_0xac72('0x24')](respondWithResult(_0x1e95d1,null))[_0xac72('0x43')](handleError(_0x1e95d1,null));};exports[_0xac72('0x23')]=function(_0xf221ff,_0x1ecccf){if(_0xf221ff['body']['id']){delete _0xf221ff[_0xac72('0x47')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0xf221ff[_0xac72('0x45')]['id']}})[_0xac72('0x24')](handleEntityNotFound(_0x1ecccf,null))[_0xac72('0x24')](saveUpdates(_0xf221ff[_0xac72('0x47')],null))[_0xac72('0x24')](respondWithResult(_0x1ecccf,null))['catch'](handleError(_0x1ecccf,null));};exports[_0xac72('0x48')]=function(_0x2c0796,_0x6a3e23){return db['CmCustomField'][_0xac72('0x49')]({'where':{'id':_0x2c0796[_0xac72('0x45')]['id']}})['then'](handleEntityNotFound(_0x6a3e23,null))[_0xac72('0x24')](removeEntity(_0x6a3e23,null))['catch'](handleError(_0x6a3e23,null));};exports[_0xac72('0x4a')]=function(_0x4ef0ed,_0x2983d7){var _0xa9bf68;return db['sequelize'][_0xac72('0x4b')](function(_0x29e21e){return db['CmCustomField']['create'](_0x4ef0ed['body'],{'transaction':_0x29e21e})[_0xac72('0x24')](function(_0x520218){_0xa9bf68=_0x520218;var _0x1f38d3={'type':db[_0xac72('0x4c')][_0xac72('0x4d')],'transaction':_0x29e21e};switch(_0x4ef0ed[_0xac72('0x47')][_0xac72('0x2b')]){case'text':_0x1f38d3[_0xac72('0x2b')]=db[_0xac72('0x4c')]['TEXT'];break;case _0xac72('0x4e'):_0x1f38d3[_0xac72('0x2b')]=db['Sequelize'][_0xac72('0x4f')];break;case _0xac72('0x50'):_0x1f38d3[_0xac72('0x2b')]=db[_0xac72('0x4c')][_0xac72('0x51')];_0x1f38d3[_0xac72('0x52')]=![];break;default:}return db[_0xac72('0x53')][_0xac72('0x54')][_0xac72('0x55')](_0xac72('0x56'),util[_0xac72('0x57')](_0xac72('0x58'),_0xa9bf68['id']),_0x1f38d3);})[_0xac72('0x24')](function(){return _0xa9bf68;});})[_0xac72('0x24')](respondWithResult(_0x2983d7,0xc9))[_0xac72('0x43')](handleError(_0x2983d7,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8b27da5..8544630 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 _0x9ccd=['cm_custom_fields','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x14d7fc,_0x5de317){var _0x4e8842=function(_0xdf0b37){while(--_0xdf0b37){_0x14d7fc['push'](_0x14d7fc['shift']());}};_0x4e8842(++_0x5de317);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var logger=require(_0xd9cc('0x1'))(_0xd9cc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd9cc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9cc('0x4'));var config=require(_0xd9cc('0x5'));var attributes=require(_0xd9cc('0x6'));module[_0xd9cc('0x7')]=function(_0x126f77,_0x113744){return _0x126f77[_0xd9cc('0x8')](_0xd9cc('0x9'),attributes,{'tableName':_0xd9cc('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb299=['request-promise','path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x325654,_0x4e6fe1){var _0x994fc7=function(_0x3a0d47){while(--_0x3a0d47){_0x325654['push'](_0x325654['shift']());}};_0x994fc7(++_0x4e6fe1);}(_0xb299,0x19b));var _0x9b29=function(_0x3fb5be,_0x3d8dac){_0x3fb5be=_0x3fb5be-0x0;var _0x3735f1=_0xb299[_0x3fb5be];return _0x3735f1;};'use strict';var _=require(_0x9b29('0x0'));var util=require('util');var logger=require(_0x9b29('0x1'))(_0x9b29('0x2'));var moment=require(_0x9b29('0x3'));var BPromise=require(_0x9b29('0x4'));var rp=require(_0x9b29('0x5'));var fs=require('fs');var path=require(_0x9b29('0x6'));var rimraf=require(_0x9b29('0x7'));var config=require('../../config/environment');var attributes=require(_0x9b29('0x8'));module[_0x9b29('0x9')]=function(_0x4da7ce,_0x321436){return _0x4da7ce[_0x9b29('0xa')](_0x9b29('0xb'),attributes,{'tableName':_0x9b29('0xc'),'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 75a73b2..7bb08d8 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2d53cd,_0x5cb506){var _0x9e4e30=function(_0x58e5fa){while(--_0x58e5fa){_0x2d53cd['push'](_0x2d53cd['shift']());}};_0x9e4e30(++_0x5cb506);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1b4f92,_0xb56718){_0x1b4f92=_0x1b4f92-0x0;var _0x3850c2=_0xb43b[_0x1b4f92];return _0x3850c2;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('CmCustomField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('CmCustomField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('CmCustomField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','catch','util'];(function(_0x10ad0e,_0x511c19){var _0x5eecd4=function(_0x62af1){while(--_0x62af1){_0x10ad0e['push'](_0x10ad0e['shift']());}};_0x5eecd4(++_0x511c19);}(_0xedd9,0xfc));var _0x9edd=function(_0x1e5a4c,_0x4edd68){_0x1e5a4c=_0x1e5a4c-0x0;var _0xfafa5e=_0xedd9[_0x1e5a4c];return _0xfafa5e;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('CmCustomField,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2b6950f..e590b1a 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 _0xa711=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id','show','post','create','put','delete','isAuthenticated','destroy','multer','path','connect-timeout'];(function(_0x26b3ff,_0x52875f){var _0x2e629b=function(_0x42fbf9){while(--_0x42fbf9){_0x26b3ff['push'](_0x26b3ff['shift']());}};_0x2e629b(++_0x52875f);}(_0xa711,0xce));var _0x1a71=function(_0xfdc000,_0x678841){_0xfdc000=_0xfdc000-0x0;var _0x15a615=_0xa711[_0xfdc000];return _0x15a615;};'use strict';var multer=require(_0x1a71('0x0'));var util=require('util');var path=require(_0x1a71('0x1'));var timeout=require(_0x1a71('0x2'));var express=require(_0x1a71('0x3'));var router=express[_0x1a71('0x4')]();var auth=require(_0x1a71('0x5'));var interaction=require(_0x1a71('0x6'));var config=require(_0x1a71('0x7'));var controller=require(_0x1a71('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1a71('0x9')]);router[_0x1a71('0xa')](_0x1a71('0xb'),auth['isAuthenticated'](),controller[_0x1a71('0xc')]);router[_0x1a71('0xd')]('/',auth['isAuthenticated'](),controller[_0x1a71('0xe')]);router[_0x1a71('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1a71('0x10')](_0x1a71('0xb'),auth[_0x1a71('0x11')](),controller[_0x1a71('0x12')]);module['exports']=router; \ No newline at end of file +var _0x180d=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x180d,0x10f));var _0xd180=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x180d[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0xd180('0x0'));var util=require(_0xd180('0x1'));var path=require(_0xd180('0x2'));var timeout=require('connect-timeout');var express=require(_0xd180('0x3'));var router=express[_0xd180('0x4')]();var auth=require(_0xd180('0x5'));var interaction=require(_0xd180('0x6'));var config=require('../../config/environment');var controller=require(_0xd180('0x7'));router[_0xd180('0x8')]('/',auth[_0xd180('0x9')](),controller[_0xd180('0xa')]);router[_0xd180('0x8')](_0xd180('0xb'),auth[_0xd180('0x9')](),controller[_0xd180('0xc')]);router[_0xd180('0xd')]('/',auth[_0xd180('0x9')](),controller[_0xd180('0xe')]);router[_0xd180('0xf')](_0xd180('0xb'),auth[_0xd180('0x9')](),controller['update']);router['delete'](_0xd180('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd180('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index a39763e..f76de3f 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 _0x5fab=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x4e3d0d,_0x4b55c2){var _0x19bbbb=function(_0x4a8892){while(--_0x4a8892){_0x4e3d0d['push'](_0x4e3d0d['shift']());}};_0x19bbbb(++_0x4b55c2);}(_0x5fab,0x177));var _0xb5fa=function(_0x1c391b,_0x331dc5){_0x1c391b=_0x1c391b-0x0;var _0x3da0c1=_0x5fab[_0x1c391b];return _0x3da0c1;};'use strict';var moment=require(_0xb5fa('0x0'));var Sequelize=require(_0xb5fa('0x1'));module['exports']={'phone':{'type':Sequelize[_0xb5fa('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb5fa('0x4')],'defaultValue':moment()[_0xb5fa('0x5')](_0xb5fa('0x6'))},'countbusyretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb5fa('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb5fa('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb5fa('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb5fa('0x7')],'unique':_0xb5fa('0x9')},'UserId':{'type':Sequelize[_0xb5fa('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xb5fa('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb5fa('0x2')]}}; \ No newline at end of file +var _0x0295=['moment','STRING','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','DATE','contactListQueue'];(function(_0x4c68ce,_0x42ad78){var _0x224d31=function(_0x516c62){while(--_0x516c62){_0x4c68ce['push'](_0x4c68ce['shift']());}};_0x224d31(++_0x42ad78);}(_0x0295,0x1f0));var _0x5029=function(_0x11b8ae,_0x485fa8){_0x11b8ae=_0x11b8ae-0x0;var _0x35a448=_0x0295[_0x11b8ae];return _0x35a448;};'use strict';var moment=require(_0x5029('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x5029('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x5029('0x2')](_0x5029('0x3'))},'countbusyretry':{'type':Sequelize[_0x5029('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5029('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5029('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5029('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5029('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5029('0x6')]},'priority':{'type':Sequelize[_0x5029('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x5029('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x5029('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x5029('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x5029('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x5029('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5029('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5029('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5029('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5029('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 192e650..bcd7062 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 _0x60c2=['$notIn','$like','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','body','update','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','create','end','getPreview','getVoiceQueues','dialOrderByScheduledAt','transaction','direction','prev','hopperIds','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','findOne','scheduledat','LOCK','Contact','CmCompany','Company','List','VoiceQueue','Queue','dialActive','getOpenContacts','outbound','preview','length','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','ejs','lodash','squel','to-csv','querystring','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','CmHopper','rawAttributes','fieldName','key','model','map','query','keys','intersection','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween'];(function(_0x695aef,_0x4eaa3f){var _0x5289d4=function(_0x1d1426){while(--_0x1d1426){_0x695aef['push'](_0x695aef['shift']());}};_0x5289d4(++_0x4eaa3f);}(_0x60c2,0x18f));var _0x260c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x60c2[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x260c('0x0'));var emlformat=require(_0x260c('0x1'));var rimraf=require(_0x260c('0x2'));var zipdir=require(_0x260c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x260c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x260c('0x5'));var util=require(_0x260c('0x6'));var path=require(_0x260c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x260c('0x8'));var fs=require('fs');var _=require(_0x260c('0x9'));var squel=require(_0x260c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x260c('0xb'));var querystring=require(_0x260c('0xc'));var Papa=require('papaparse');var Redis=require(_0x260c('0xd'));var shared=require(_0x260c('0xe'));var authService=require(_0x260c('0xf'));var qs=require(_0x260c('0x10'));var as=require(_0x260c('0x11'));var hardwareService=require(_0x260c('0x12'));var logger=require(_0x260c('0x13'))(_0x260c('0x14'));var utils=require('../../config/utils');var config=require(_0x260c('0xe'));var db=require(_0x260c('0x15'))['db'];function respondWithStatusCode(_0x59e234,_0x3d55e7){_0x3d55e7=_0x3d55e7||0xcc;return function(_0x87eecf){if(_0x87eecf){return _0x59e234[_0x260c('0x16')](_0x3d55e7);}return _0x59e234['status'](_0x3d55e7)['end']();};}function respondWithResult(_0x4b2bf2,_0xe3fdd8){_0xe3fdd8=_0xe3fdd8||0xc8;return function(_0x3ca6c0){if(_0x3ca6c0){return _0x4b2bf2[_0x260c('0x17')](_0xe3fdd8)[_0x260c('0x18')](_0x3ca6c0);}};}function respondWithFilteredResult(_0x22b2ab,_0x47f1e7){return function(_0x1630b6){if(_0x1630b6){var _0x2b5bf3=_0x1630b6[_0x260c('0x19')],_0x2f482d=_0x47f1e7[_0x260c('0x1a')],_0x4fb4ad=_0x47f1e7[_0x260c('0x1a')]+_0x47f1e7[_0x260c('0x1b')],_0x10e7e0;if(_0x4fb4ad>=_0x2b5bf3){_0x4fb4ad=_0x2b5bf3;_0x10e7e0=0xc8;}else{_0x10e7e0=0xce;}_0x22b2ab[_0x260c('0x17')](_0x10e7e0);return _0x22b2ab[_0x260c('0x1c')](_0x260c('0x1d'),_0x2f482d+'-'+_0x4fb4ad+'/'+_0x2b5bf3)[_0x260c('0x18')](_0x1630b6);}return null;};}function patchUpdates(_0x445a2f){return function(_0x137e22){try{jsonpatch[_0x260c('0x1e')](_0x137e22,_0x445a2f,!![]);}catch(_0x34c03a){return BPromise[_0x260c('0x1f')](_0x34c03a);}return _0x137e22[_0x260c('0x20')]();};}function saveUpdates(_0x1a3231,_0x51fe8f){return function(_0x50d473){if(_0x50d473){return _0x50d473['update'](_0x1a3231)[_0x260c('0x21')](function(_0x3f86c7){return _0x3f86c7;});}return null;};}function removeEntity(_0x24cde5,_0x29ac73){return function(_0x213419){if(_0x213419){return _0x213419['destroy']()[_0x260c('0x21')](function(){_0x24cde5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xad6761,_0x126e68){return function(_0x4d60a9){if(!_0x4d60a9){_0xad6761['sendStatus'](0x194);}return _0x4d60a9;};}function handleError(_0x31ac22,_0x48f3a0){_0x48f3a0=_0x48f3a0||0x1f4;return function(_0x27d691){logger[_0x260c('0x22')](_0x27d691[_0x260c('0x23')]);if(_0x27d691[_0x260c('0x24')]){delete _0x27d691[_0x260c('0x24')];}_0x31ac22['status'](_0x48f3a0)[_0x260c('0x25')](_0x27d691);};}exports[_0x260c('0x26')]=function(_0x153f1f,_0x290f45){var _0x2ad90a={},_0xfd5ae0={},_0x36f843={'count':0x0,'rows':[]};var _0x56e43c=_['map'](db[_0x260c('0x27')][_0x260c('0x28')],function(_0x5e2f4f){return{'name':_0x5e2f4f[_0x260c('0x29')],'type':_0x5e2f4f['type'][_0x260c('0x2a')]};});_0xfd5ae0[_0x260c('0x2b')]=_[_0x260c('0x2c')](_0x56e43c,'name');_0xfd5ae0[_0x260c('0x2d')]=_[_0x260c('0x2e')](_0x153f1f[_0x260c('0x2d')]);_0xfd5ae0['filters']=_[_0x260c('0x2f')](_0xfd5ae0[_0x260c('0x2b')],_0xfd5ae0[_0x260c('0x2d')]);_0xfd5ae0[_0x260c('0x30')]=_['concat'](_0xfd5ae0[_0x260c('0x30')],[_0x260c('0x31'),_0x260c('0x32'),_0x260c('0x33'),_0x260c('0x34'),_0x260c('0x35'),_0x260c('0x36'),_0x260c('0x37'),_0x260c('0x38'),_0x260c('0x39'),_0x260c('0x3a'),_0x260c('0x3b'),'$in',_0x260c('0x3c'),_0x260c('0x3d'),'$notLike','$iLike',_0x260c('0x3e'),_0x260c('0x3d'),_0x260c('0x3f'),_0x260c('0x40'),_0x260c('0x41'),_0x260c('0x42')]);_0x2ad90a[_0x260c('0x43')]=_[_0x260c('0x2f')](_0xfd5ae0[_0x260c('0x2b')],qs[_0x260c('0x44')](_0x153f1f[_0x260c('0x2d')][_0x260c('0x44')]));_0x2ad90a[_0x260c('0x43')]=_0x2ad90a[_0x260c('0x43')]['length']?_0x2ad90a[_0x260c('0x43')]:_0xfd5ae0[_0x260c('0x2b')];if(!_0x153f1f['query'][_0x260c('0x45')](_0x260c('0x46'))){_0x2ad90a[_0x260c('0x1b')]=qs['limit'](_0x153f1f[_0x260c('0x2d')]['limit']);_0x2ad90a[_0x260c('0x1a')]=qs['offset'](_0x153f1f[_0x260c('0x2d')]['offset']);}_0x2ad90a['order']=qs[_0x260c('0x47')](_0x153f1f[_0x260c('0x2d')][_0x260c('0x47')]);_0x2ad90a[_0x260c('0x48')]=qs[_0x260c('0x30')](_[_0x260c('0x49')](_0x153f1f[_0x260c('0x2d')],_0xfd5ae0[_0x260c('0x30')]),_0x56e43c);if(_0x153f1f[_0x260c('0x2d')][_0x260c('0x4a')]){_0x2ad90a['where']=_[_0x260c('0x4b')](_0x2ad90a[_0x260c('0x48')],{'$or':_[_0x260c('0x2c')](_0x56e43c,function(_0x14b242){if(_0x14b242[_0x260c('0x4c')]!==_0x260c('0x4d')){var _0x30ccf0={};_0x30ccf0[_0x14b242[_0x260c('0x24')]]={'$like':'%'+_0x153f1f[_0x260c('0x2d')][_0x260c('0x4a')]+'%'};return _0x30ccf0;}})});}_0x2ad90a=_['merge']({},_0x2ad90a,_0x153f1f['options']);var _0x44df4b={'where':_0x2ad90a[_0x260c('0x48')]};return db['CmHopper'][_0x260c('0x19')](_0x44df4b)['then'](function(_0xbd4b7d){_0x36f843['count']=_0xbd4b7d;if(_0x153f1f[_0x260c('0x2d')]['includeAll']){_0x2ad90a[_0x260c('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x260c('0x4f')](_0x2ad90a);})[_0x260c('0x21')](function(_0x551261){_0x36f843[_0x260c('0x50')]=_0x551261;return _0x36f843;})[_0x260c('0x21')](respondWithFilteredResult(_0x290f45,_0x2ad90a))[_0x260c('0x51')](handleError(_0x290f45,null));};exports[_0x260c('0x52')]=function(_0x4eacb1,_0x411204){var _0x36e633={'raw':!![],'where':{'id':_0x4eacb1[_0x260c('0x53')]['id']}},_0x50eacc={};_0x50eacc[_0x260c('0x2b')]=_['keys'](db['CmHopper'][_0x260c('0x28')]);_0x50eacc[_0x260c('0x2d')]=_[_0x260c('0x2e')](_0x4eacb1['query']);_0x50eacc['filters']=_[_0x260c('0x2f')](_0x50eacc[_0x260c('0x2b')],_0x50eacc[_0x260c('0x2d')]);_0x36e633[_0x260c('0x43')]=_[_0x260c('0x2f')](_0x50eacc[_0x260c('0x2b')],qs['fields'](_0x4eacb1[_0x260c('0x2d')][_0x260c('0x44')]));_0x36e633[_0x260c('0x43')]=_0x36e633[_0x260c('0x43')]['length']?_0x36e633['attributes']:_0x50eacc[_0x260c('0x2b')];if(_0x4eacb1[_0x260c('0x2d')][_0x260c('0x54')]){_0x36e633[_0x260c('0x4e')]=[{'all':!![]}];}_0x36e633=_['merge']({},_0x36e633,_0x4eacb1[_0x260c('0x55')]);return db[_0x260c('0x27')][_0x260c('0x56')](_0x36e633)['then'](handleEntityNotFound(_0x411204,null))[_0x260c('0x21')](respondWithResult(_0x411204,null))[_0x260c('0x51')](handleError(_0x411204,null));};exports['create']=function(_0x16effd,_0x3272a2){return db[_0x260c('0x27')]['create'](_0x16effd[_0x260c('0x57')],{})[_0x260c('0x21')](respondWithResult(_0x3272a2,0xc9))['catch'](handleError(_0x3272a2,null));};exports[_0x260c('0x58')]=function(_0xf29d10,_0x5a10e1){if(_0xf29d10[_0x260c('0x57')]['id']){delete _0xf29d10[_0x260c('0x57')]['id'];}return db[_0x260c('0x27')][_0x260c('0x56')]({'where':{'id':_0xf29d10[_0x260c('0x53')]['id']}})[_0x260c('0x21')](handleEntityNotFound(_0x5a10e1,null))[_0x260c('0x21')](saveUpdates(_0xf29d10[_0x260c('0x57')],null))[_0x260c('0x21')](respondWithResult(_0x5a10e1,null))[_0x260c('0x51')](handleError(_0x5a10e1,null));};exports[_0x260c('0x59')]=function(_0x4f1025,_0x311630){return db[_0x260c('0x27')]['describe']()[_0x260c('0x21')](respondWithResult(_0x311630,null))[_0x260c('0x51')](handleError(_0x311630,null));};exports[_0x260c('0x5a')]=function(_0x490139,_0x5bfcc6){var _0x2e904d;return db[_0x260c('0x27')]['find']({'where':{'id':_0x490139[_0x260c('0x53')]['id']}})['then'](handleEntityNotFound(_0x5bfcc6,null))[_0x260c('0x21')](function(_0x9cc117){if(_0x9cc117){return _0x9cc117[_0x260c('0x5a')]()[_0x260c('0x21')](function(_0x505119){return _0x505119;});}})[_0x260c('0x21')](function(_0xb72430){_0x2e904d=_0xb72430;if(_0xb72430){if(_0xb72430[_0x260c('0x5b')]||_0xb72430[_0x260c('0x5c')]){return db[_0xb72430[_0x260c('0x5b')]?'VoiceQueue':_0x260c('0x5d')][_0x260c('0x56')]({'where':{'id':_0xb72430['VoiceQueueId']?_0xb72430[_0x260c('0x5b')]:_0xb72430['CampaignId']},'attributes':['id',_0x260c('0x24')],'raw':!![]});}}})[_0x260c('0x21')](function(_0x589305){var _0x325a32={};if(_0x589305){_['merge'](_0x325a32,_[_0x260c('0x5e')](_0x2e904d[_0x260c('0x5f')],[_0x260c('0x60'),_0x260c('0x61'),'id']));_0x325a32[_0x260c('0x62')]=0x15;_0x325a32[_0x260c('0x63')]=_0x260c('0x64');_0x325a32[_0x260c('0x65')]=_0x589305[_0x260c('0x24')];_0x325a32[_0x260c('0x66')]=_0x490139['user'][_0x260c('0x24')];_0x325a32[_0x260c('0x67')]=_0x490139[_0x260c('0x68')]['id'];_0x325a32[_0x260c('0x64')]=!![];_0x325a32[_0x260c('0x69')]=moment()[_0x260c('0x6a')](_0x260c('0x6b'));_0x325a32['calleridnum']=_0x2e904d[_0x260c('0x6c')];_0x325a32['campaigntype']=_0x2e904d[_0x260c('0x5b')]?'queue':'ivr';return db[_0x260c('0x6d')][_0x260c('0x56')]({'where':{'id':_0x325a32[_0x260c('0x6e')]},'attributes':['firstName',_0x260c('0x6f')]})[_0x260c('0x21')](function(_0x4d6281){if(!_['isNil'](_0x5bfcc6)&&!_[_0x260c('0x70')](_0x4d6281[_0x260c('0x71')])){_0x325a32[_0x260c('0x72')]=_0x4d6281[_0x260c('0x71')];if(!_['isNil'](_0x4d6281[_0x260c('0x6f')])){_0x325a32[_0x260c('0x72')]+='\x20'+_0x4d6281[_0x260c('0x6f')];}}})[_0x260c('0x73')](function(){return db['CmHopperFinal'][_0x260c('0x74')](_0x325a32);});}})[_0x260c('0x21')](function(){return _0x5bfcc6['status'](0xcc)[_0x260c('0x75')]();})[_0x260c('0x51')](handleError(_0x5bfcc6,null));};exports[_0x260c('0x76')]=function(_0x1291aa,_0x576935,_0x2c89a9){var _0x2defc1=[];return db[_0x260c('0x6d')]['describe']()['then'](function(_0x57c7af){_0x2defc1=_[_0x260c('0x2e')](_0x57c7af);return _0x1291aa[_0x260c('0x68')][_0x260c('0x77')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x260c('0x78')],'raw':!![]});})[_0x260c('0x21')](function(_0x4fc039){if(_0x4fc039&&_0x4fc039['length']){return db['sequelize'][_0x260c('0x79')](function(_0x1ac7be){var _0x158593={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x260c('0x6a')](_0x260c('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x4fc039,'id')},'$or':[{'UserId':null},{'UserId':_0x1291aa[_0x260c('0x68')]['id']}]};var _0x4ca728=[];if(_0x1291aa[_0x260c('0x57')]['direction']&&_0x1291aa[_0x260c('0x57')][_0x260c('0x7a')]===_0x260c('0x7b')){if(!_['isEmpty'](_0x1291aa[_0x260c('0x57')]['hopperIds'])){_0x158593['id']={'$in':_0x1291aa[_0x260c('0x57')][_0x260c('0x7c')]};}_0x4ca728=[['priority','ASC'],['scheduledAt',_0x4fc039[0x0][_0x260c('0x78')]===_0x260c('0x7d')?_0x260c('0x7e'):_0x260c('0x7d')],db[_0x260c('0x7f')][_0x260c('0x80')](_0x260c('0x81')),['id',_0x260c('0x7e')]];}else{if(!_['isEmpty'](_0x1291aa[_0x260c('0x57')]['hopperIds'])){_0x158593['id']={'$notIn':_0x1291aa['body'][_0x260c('0x7c')]};}_0x4ca728=[[_0x260c('0x82'),_0x260c('0x7e')],['scheduledAt',_0x4fc039[0x0][_0x260c('0x78')]],db[_0x260c('0x7f')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x260c('0x7d')]];}return db[_0x260c('0x27')][_0x260c('0x83')]({'attributes':['id',_0x260c('0x84')],'where':_0x158593,'order':_0x4ca728,'transaction':_0x1ac7be,'lock':_0x1ac7be[_0x260c('0x85')]['UPDATE'],'include':[{'model':db[_0x260c('0x6d')],'as':_0x260c('0x86'),'attributes':_0x2defc1,'include':[{'model':db[_0x260c('0x87')],'as':_0x260c('0x88'),'attributes':['id',_0x260c('0x24')]}]},{'model':db['CmList'],'as':_0x260c('0x89'),'attributes':['id',_0x260c('0x24')]},{'model':db[_0x260c('0x8a')],'as':_0x260c('0x8b'),'attributes':['id',_0x260c('0x24'),_0x260c('0x8c')]}]})[_0x260c('0x21')](function(_0x4780fe){if(_0x4780fe){return _0x4780fe[_0x260c('0x58')]({'UserId':_0x1291aa[_0x260c('0x68')]['id']},{'transaction':_0x1ac7be});}});});}})['then'](handleEntityNotFound(_0x576935,null))[_0x260c('0x21')](respondWithResult(_0x576935,null))[_0x260c('0x51')](handleError(_0x576935,null));};exports[_0x260c('0x8d')]=function(_0x192d2e,_0x2dcf35,_0x44393c){return _0x192d2e[_0x260c('0x68')][_0x260c('0x77')]({'where':{'type':_0x260c('0x8e'),'dialActive':!![],'dialMethod':_0x260c('0x8f')},'attributes':['id'],'raw':!![]})['then'](function(_0x258d69){if(_0x258d69&&_0x258d69[_0x260c('0x90')]){return db[_0x260c('0x27')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x260c('0x2c')](_0x258d69,'id')},'$or':[{'UserId':null},{'UserId':_0x192d2e[_0x260c('0x68')]['id']}]}});}return 0x0;})[_0x260c('0x21')](function(_0x3034d2){if(!_['isNil'](_0x3034d2)&&_[_0x260c('0x91')](_0x3034d2)){return _0x2dcf35['status'](0xc8)[_0x260c('0x18')]({'contacts':_0x3034d2});}else{logger[_0x260c('0x22')](_0x260c('0x92'),_0x260c('0x8d'),0x194,_0x260c('0x93'));_0x2dcf35[_0x260c('0x16')](0x194);}})[_0x260c('0x51')](handleError(_0x2dcf35,null));};exports[_0x260c('0x94')]=function(_0x21f9a3,_0x5b7dbe,_0x1c7854){var _0x5df2d6=shared[_0x260c('0x95')];var _0x3ff4a4=[];_['map'](_0x5df2d6,function(_0x3f551e){_0x3ff4a4[_0x260c('0x96')]({'id':_0x3f551e[_0x260c('0x24')],'name':_0x3f551e[_0x260c('0x24')],'utcOffset':_0x3f551e[_0x260c('0x97')]});});return _0x5b7dbe[_0x260c('0x17')](0xc8)[_0x260c('0x18')]({'tz':_0x3ff4a4});};exports[_0x260c('0x98')]=function(_0x2364a2,_0x3d580b,_0x130130){var _0x3026ec=shared['timezones'];var _0x2810c4={};if(!_['isNil'](_0x3026ec[_0x2364a2['body']['id']]))_0x2810c4=_0x3026ec[_0x2364a2[_0x260c('0x57')]['id']];return _0x3d580b[_0x260c('0x17')](0xc8)[_0x260c('0x18')](_0x2810c4);}; \ No newline at end of file +var _0xa185=['set','Content-Range','reject','update','then','destroy','error','stack','name','status','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','VoiceQueueId','Campaign','CampaignId','omit','dataValues','createdAt','statedesc','campaign','membername','UserId','user','deletedat','calleridnum','phone','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','outbound','preview','dialOrderByScheduledAt','sequelize','format','direction','prev','isEmpty','hopperIds','priority','scheduledAt','DESC','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','getVoiceQueues','YYYY-MM-DD\x20HH:mm:ss','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','html-pdf','eml-format','zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit'];(function(_0x2992d4,_0x524b98){var _0x3a6052=function(_0x520900){while(--_0x520900){_0x2992d4['push'](_0x2992d4['shift']());}};_0x3a6052(++_0x524b98);}(_0xa185,0x78));var _0x5a18=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa185[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x5a18('0x0'));var emlformat=require(_0x5a18('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5a18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5a18('0x3'));var util=require(_0x5a18('0x4'));var path=require(_0x5a18('0x5'));var sox=require(_0x5a18('0x6'));var csv=require(_0x5a18('0x7'));var ejs=require(_0x5a18('0x8'));var fs=require('fs');var _=require(_0x5a18('0x9'));var squel=require(_0x5a18('0xa'));var crypto=require('crypto');var jsforce=require(_0x5a18('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5a18('0x7'));var querystring=require(_0x5a18('0xc'));var Papa=require(_0x5a18('0xd'));var Redis=require(_0x5a18('0xe'));var shared=require('../../config/environment');var authService=require(_0x5a18('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a18('0x10'));var logger=require(_0x5a18('0x11'))(_0x5a18('0x12'));var utils=require(_0x5a18('0x13'));var config=require(_0x5a18('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d96c3,_0x2af205){_0x2af205=_0x2af205||0xcc;return function(_0x4caa77){if(_0x4caa77){return _0x3d96c3[_0x5a18('0x15')](_0x2af205);}return _0x3d96c3['status'](_0x2af205)[_0x5a18('0x16')]();};}function respondWithResult(_0x5dfb8d,_0x2de610){_0x2de610=_0x2de610||0xc8;return function(_0x2c3b54){if(_0x2c3b54){return _0x5dfb8d['status'](_0x2de610)[_0x5a18('0x17')](_0x2c3b54);}};}function respondWithFilteredResult(_0x1a71a2,_0x11c056){return function(_0x523d34){if(_0x523d34){var _0x2bf751=_0x523d34[_0x5a18('0x18')],_0x3505da=_0x11c056['offset'],_0x417e43=_0x11c056[_0x5a18('0x19')]+_0x11c056[_0x5a18('0x1a')],_0x7cb8b3;if(_0x417e43>=_0x2bf751){_0x417e43=_0x2bf751;_0x7cb8b3=0xc8;}else{_0x7cb8b3=0xce;}_0x1a71a2['status'](_0x7cb8b3);return _0x1a71a2[_0x5a18('0x1b')](_0x5a18('0x1c'),_0x3505da+'-'+_0x417e43+'/'+_0x2bf751)[_0x5a18('0x17')](_0x523d34);}return null;};}function patchUpdates(_0x2d07c7){return function(_0x465e48){try{jsonpatch['apply'](_0x465e48,_0x2d07c7,!![]);}catch(_0x43c58d){return BPromise[_0x5a18('0x1d')](_0x43c58d);}return _0x465e48['save']();};}function saveUpdates(_0x1537ea,_0x56cc0a){return function(_0xe35414){if(_0xe35414){return _0xe35414[_0x5a18('0x1e')](_0x1537ea)[_0x5a18('0x1f')](function(_0x2752f6){return _0x2752f6;});}return null;};}function removeEntity(_0x49e7a1,_0x5dc1ff){return function(_0x550498){if(_0x550498){return _0x550498[_0x5a18('0x20')]()[_0x5a18('0x1f')](function(){_0x49e7a1['status'](0xcc)[_0x5a18('0x16')]();});}};}function handleEntityNotFound(_0x3d188d,_0x472933){return function(_0x345f71){if(!_0x345f71){_0x3d188d['sendStatus'](0x194);}return _0x345f71;};}function handleError(_0x458fe2,_0x1ac83f){_0x1ac83f=_0x1ac83f||0x1f4;return function(_0x4f9cf4){logger[_0x5a18('0x21')](_0x4f9cf4[_0x5a18('0x22')]);if(_0x4f9cf4[_0x5a18('0x23')]){delete _0x4f9cf4['name'];}_0x458fe2[_0x5a18('0x24')](_0x1ac83f)[_0x5a18('0x25')](_0x4f9cf4);};}exports[_0x5a18('0x26')]=function(_0x47f1b3,_0x4b372a){var _0x18fb86={},_0x1cf0cd={},_0x1de9fd={'count':0x0,'rows':[]};var _0x3b8444=_[_0x5a18('0x27')](db['CmHopper']['rawAttributes'],function(_0x3701a3){return{'name':_0x3701a3[_0x5a18('0x28')],'type':_0x3701a3[_0x5a18('0x29')][_0x5a18('0x2a')]};});_0x1cf0cd[_0x5a18('0x2b')]=_['map'](_0x3b8444,_0x5a18('0x23'));_0x1cf0cd[_0x5a18('0x2c')]=_[_0x5a18('0x2d')](_0x47f1b3[_0x5a18('0x2c')]);_0x1cf0cd[_0x5a18('0x2e')]=_[_0x5a18('0x2f')](_0x1cf0cd['model'],_0x1cf0cd[_0x5a18('0x2c')]);_0x1cf0cd[_0x5a18('0x2e')]=_[_0x5a18('0x30')](_0x1cf0cd['filters'],[_0x5a18('0x31'),_0x5a18('0x32'),'$gt',_0x5a18('0x33'),_0x5a18('0x34'),_0x5a18('0x35'),_0x5a18('0x36'),_0x5a18('0x37'),'$not',_0x5a18('0x38'),_0x5a18('0x39'),_0x5a18('0x3a'),'$notIn',_0x5a18('0x3b'),_0x5a18('0x3c'),_0x5a18('0x3d'),_0x5a18('0x3e'),_0x5a18('0x3b'),_0x5a18('0x3f'),_0x5a18('0x40'),'$contained',_0x5a18('0x41')]);_0x18fb86[_0x5a18('0x42')]=_['intersection'](_0x1cf0cd[_0x5a18('0x2b')],qs['fields'](_0x47f1b3[_0x5a18('0x2c')][_0x5a18('0x43')]));_0x18fb86['attributes']=_0x18fb86[_0x5a18('0x42')][_0x5a18('0x44')]?_0x18fb86[_0x5a18('0x42')]:_0x1cf0cd[_0x5a18('0x2b')];if(!_0x47f1b3[_0x5a18('0x2c')][_0x5a18('0x45')](_0x5a18('0x46'))){_0x18fb86[_0x5a18('0x1a')]=qs[_0x5a18('0x1a')](_0x47f1b3[_0x5a18('0x2c')][_0x5a18('0x1a')]);_0x18fb86['offset']=qs['offset'](_0x47f1b3['query']['offset']);}_0x18fb86[_0x5a18('0x47')]=qs[_0x5a18('0x48')](_0x47f1b3['query'][_0x5a18('0x48')]);_0x18fb86[_0x5a18('0x49')]=qs[_0x5a18('0x2e')](_['pick'](_0x47f1b3['query'],_0x1cf0cd['filters']),_0x3b8444);if(_0x47f1b3[_0x5a18('0x2c')][_0x5a18('0x4a')]){_0x18fb86[_0x5a18('0x49')]=_[_0x5a18('0x4b')](_0x18fb86[_0x5a18('0x49')],{'$or':_[_0x5a18('0x27')](_0x3b8444,function(_0x5a49a5){if(_0x5a49a5['type']!=='VIRTUAL'){var _0x1e5c3e={};_0x1e5c3e[_0x5a49a5[_0x5a18('0x23')]]={'$like':'%'+_0x47f1b3[_0x5a18('0x2c')]['filter']+'%'};return _0x1e5c3e;}})});}_0x18fb86=_['merge']({},_0x18fb86,_0x47f1b3[_0x5a18('0x4c')]);var _0x5c9cb9={'where':_0x18fb86['where']};return db[_0x5a18('0x4d')][_0x5a18('0x18')](_0x5c9cb9)[_0x5a18('0x1f')](function(_0x3871f8){_0x1de9fd[_0x5a18('0x18')]=_0x3871f8;if(_0x47f1b3[_0x5a18('0x2c')][_0x5a18('0x4e')]){_0x18fb86[_0x5a18('0x4f')]=[{'all':!![]}];}return db['CmHopper'][_0x5a18('0x50')](_0x18fb86);})['then'](function(_0x41211d){_0x1de9fd[_0x5a18('0x51')]=_0x41211d;return _0x1de9fd;})[_0x5a18('0x1f')](respondWithFilteredResult(_0x4b372a,_0x18fb86))[_0x5a18('0x52')](handleError(_0x4b372a,null));};exports[_0x5a18('0x53')]=function(_0x248dbb,_0x4ff546){var _0x2684c2={'raw':!![],'where':{'id':_0x248dbb[_0x5a18('0x54')]['id']}},_0x35140f={};_0x35140f[_0x5a18('0x2b')]=_[_0x5a18('0x2d')](db[_0x5a18('0x4d')][_0x5a18('0x55')]);_0x35140f[_0x5a18('0x2c')]=_[_0x5a18('0x2d')](_0x248dbb[_0x5a18('0x2c')]);_0x35140f[_0x5a18('0x2e')]=_[_0x5a18('0x2f')](_0x35140f['model'],_0x35140f[_0x5a18('0x2c')]);_0x2684c2[_0x5a18('0x42')]=_[_0x5a18('0x2f')](_0x35140f[_0x5a18('0x2b')],qs[_0x5a18('0x43')](_0x248dbb[_0x5a18('0x2c')]['fields']));_0x2684c2[_0x5a18('0x42')]=_0x2684c2['attributes'][_0x5a18('0x44')]?_0x2684c2[_0x5a18('0x42')]:_0x35140f[_0x5a18('0x2b')];if(_0x248dbb[_0x5a18('0x2c')][_0x5a18('0x4e')]){_0x2684c2[_0x5a18('0x4f')]=[{'all':!![]}];}_0x2684c2=_[_0x5a18('0x4b')]({},_0x2684c2,_0x248dbb['options']);return db[_0x5a18('0x4d')][_0x5a18('0x56')](_0x2684c2)[_0x5a18('0x1f')](handleEntityNotFound(_0x4ff546,null))['then'](respondWithResult(_0x4ff546,null))[_0x5a18('0x52')](handleError(_0x4ff546,null));};exports[_0x5a18('0x57')]=function(_0x4135b1,_0x2fb37d){return db[_0x5a18('0x4d')]['create'](_0x4135b1[_0x5a18('0x58')],{})[_0x5a18('0x1f')](respondWithResult(_0x2fb37d,0xc9))['catch'](handleError(_0x2fb37d,null));};exports[_0x5a18('0x1e')]=function(_0x5d4110,_0x14dde9){if(_0x5d4110[_0x5a18('0x58')]['id']){delete _0x5d4110[_0x5a18('0x58')]['id'];}return db[_0x5a18('0x4d')][_0x5a18('0x56')]({'where':{'id':_0x5d4110[_0x5a18('0x54')]['id']}})[_0x5a18('0x1f')](handleEntityNotFound(_0x14dde9,null))[_0x5a18('0x1f')](saveUpdates(_0x5d4110[_0x5a18('0x58')],null))[_0x5a18('0x1f')](respondWithResult(_0x14dde9,null))[_0x5a18('0x52')](handleError(_0x14dde9,null));};exports[_0x5a18('0x59')]=function(_0x119ee6,_0x372e36){return db[_0x5a18('0x4d')][_0x5a18('0x59')]()[_0x5a18('0x1f')](respondWithResult(_0x372e36,null))[_0x5a18('0x52')](handleError(_0x372e36,null));};exports[_0x5a18('0x20')]=function(_0x4db1e3,_0x31c285){var _0x411849;return db[_0x5a18('0x4d')][_0x5a18('0x56')]({'where':{'id':_0x4db1e3['params']['id']}})[_0x5a18('0x1f')](handleEntityNotFound(_0x31c285,null))[_0x5a18('0x1f')](function(_0x383d33){if(_0x383d33){return _0x383d33[_0x5a18('0x20')]()['then'](function(_0x3e030c){return _0x3e030c;});}})[_0x5a18('0x1f')](function(_0x5d35e1){_0x411849=_0x5d35e1;if(_0x5d35e1){if(_0x5d35e1[_0x5a18('0x5a')]||_0x5d35e1['CampaignId']){return db[_0x5d35e1[_0x5a18('0x5a')]?'VoiceQueue':_0x5a18('0x5b')][_0x5a18('0x56')]({'where':{'id':_0x5d35e1['VoiceQueueId']?_0x5d35e1['VoiceQueueId']:_0x5d35e1[_0x5a18('0x5c')]},'attributes':['id',_0x5a18('0x23')],'raw':!![]});}}})[_0x5a18('0x1f')](function(_0x1dd427){var _0x50debe={};if(_0x1dd427){_[_0x5a18('0x4b')](_0x50debe,_[_0x5a18('0x5d')](_0x411849[_0x5a18('0x5e')],[_0x5a18('0x5f'),'updatedAt','id']));_0x50debe['state']=0x15;_0x50debe[_0x5a18('0x60')]='deleted';_0x50debe[_0x5a18('0x61')]=_0x1dd427[_0x5a18('0x23')];_0x50debe[_0x5a18('0x62')]=_0x4db1e3['user'][_0x5a18('0x23')];_0x50debe[_0x5a18('0x63')]=_0x4db1e3[_0x5a18('0x64')]['id'];_0x50debe['deleted']=!![];_0x50debe[_0x5a18('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x50debe[_0x5a18('0x66')]=_0x411849[_0x5a18('0x67')];_0x50debe[_0x5a18('0x68')]=_0x411849[_0x5a18('0x5a')]?_0x5a18('0x69'):_0x5a18('0x6a');return db[_0x5a18('0x6b')][_0x5a18('0x56')]({'where':{'id':_0x50debe['ContactId']},'attributes':[_0x5a18('0x6c'),_0x5a18('0x6d')]})['then'](function(_0x59be33){if(!_['isNil'](_0x31c285)&&!_['isNil'](_0x59be33[_0x5a18('0x6c')])){_0x50debe['calleridname']=_0x59be33[_0x5a18('0x6c')];if(!_[_0x5a18('0x6e')](_0x59be33[_0x5a18('0x6d')])){_0x50debe[_0x5a18('0x6f')]+='\x20'+_0x59be33['lastName'];}}})[_0x5a18('0x70')](function(){return db[_0x5a18('0x71')][_0x5a18('0x57')](_0x50debe);});}})[_0x5a18('0x1f')](function(){return _0x31c285[_0x5a18('0x24')](0xcc)['end']();})[_0x5a18('0x52')](handleError(_0x31c285,null));};exports[_0x5a18('0x72')]=function(_0x2e2deb,_0x566d21,_0x1d446f){var _0x5e0af2=[];return db['CmContact'][_0x5a18('0x59')]()['then'](function(_0x3ce8f8){_0x5e0af2=_['keys'](_0x3ce8f8);return _0x2e2deb['user']['getVoiceQueues']({'where':{'type':_0x5a18('0x73'),'dialActive':!![],'dialMethod':_0x5a18('0x74')},'attributes':['id',_0x5a18('0x75')],'raw':!![]});})['then'](function(_0x58df71){if(_0x58df71&&_0x58df71['length']){return db[_0x5a18('0x76')]['transaction'](function(_0x5077f6){var _0x2278fa={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5a18('0x77')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x58df71,'id')},'$or':[{'UserId':null},{'UserId':_0x2e2deb[_0x5a18('0x64')]['id']}]};var _0x4c8f23=[];if(_0x2e2deb[_0x5a18('0x58')][_0x5a18('0x78')]&&_0x2e2deb['body'][_0x5a18('0x78')]===_0x5a18('0x79')){if(!_[_0x5a18('0x7a')](_0x2e2deb[_0x5a18('0x58')][_0x5a18('0x7b')])){_0x2278fa['id']={'$in':_0x2e2deb['body']['hopperIds']};}_0x4c8f23=[[_0x5a18('0x7c'),'ASC'],[_0x5a18('0x7d'),_0x58df71[0x0]['dialOrderByScheduledAt']==='ASC'?_0x5a18('0x7e'):_0x5a18('0x7f')],db[_0x5a18('0x76')]['literal'](_0x5a18('0x80')),['id',_0x5a18('0x7e')]];}else{if(!_[_0x5a18('0x7a')](_0x2e2deb['body']['hopperIds'])){_0x2278fa['id']={'$notIn':_0x2e2deb[_0x5a18('0x58')][_0x5a18('0x7b')]};}_0x4c8f23=[[_0x5a18('0x7c'),_0x5a18('0x7e')],[_0x5a18('0x7d'),_0x58df71[0x0][_0x5a18('0x75')]],db[_0x5a18('0x76')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x5a18('0x7f')]];}return db[_0x5a18('0x4d')][_0x5a18('0x81')]({'attributes':['id','scheduledat'],'where':_0x2278fa,'order':_0x4c8f23,'transaction':_0x5077f6,'lock':_0x5077f6[_0x5a18('0x82')][_0x5a18('0x83')],'include':[{'model':db[_0x5a18('0x6b')],'as':_0x5a18('0x84'),'attributes':_0x5e0af2,'include':[{'model':db[_0x5a18('0x85')],'as':'Company','attributes':['id',_0x5a18('0x23')]}]},{'model':db[_0x5a18('0x86')],'as':_0x5a18('0x87'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x5a18('0x88'),'attributes':['id',_0x5a18('0x23'),'dialActive']}]})[_0x5a18('0x1f')](function(_0x47c97e){if(_0x47c97e){return _0x47c97e[_0x5a18('0x1e')]({'UserId':_0x2e2deb['user']['id']},{'transaction':_0x5077f6});}});});}})[_0x5a18('0x1f')](handleEntityNotFound(_0x566d21,null))['then'](respondWithResult(_0x566d21,null))[_0x5a18('0x52')](handleError(_0x566d21,null));};exports['getOpenContacts']=function(_0x3e7303,_0x20d384,_0x1a7e45){return _0x3e7303[_0x5a18('0x64')][_0x5a18('0x89')]({'where':{'type':_0x5a18('0x73'),'dialActive':!![],'dialMethod':_0x5a18('0x74')},'attributes':['id'],'raw':!![]})['then'](function(_0x465e03){if(_0x465e03&&_0x465e03[_0x5a18('0x44')]){return db[_0x5a18('0x4d')][_0x5a18('0x18')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5a18('0x77')](_0x5a18('0x8a'))},'VoiceQueueId':{'$in':_[_0x5a18('0x27')](_0x465e03,'id')},'$or':[{'UserId':null},{'UserId':_0x3e7303[_0x5a18('0x64')]['id']}]}});}return 0x0;})['then'](function(_0x29bd09){if(!_[_0x5a18('0x6e')](_0x29bd09)&&_[_0x5a18('0x8b')](_0x29bd09)){return _0x20d384[_0x5a18('0x24')](0xc8)[_0x5a18('0x17')]({'contacts':_0x29bd09});}else{logger['error'](_0x5a18('0x8c'),'getOpenContacts',0x194,_0x5a18('0x8d'));_0x20d384[_0x5a18('0x15')](0x194);}})[_0x5a18('0x52')](handleError(_0x20d384,null));};exports[_0x5a18('0x8e')]=function(_0x3867fc,_0xe4fd7d,_0x1021f7){var _0xda2b01=shared[_0x5a18('0x8f')];var _0x58744a=[];_[_0x5a18('0x27')](_0xda2b01,function(_0x158516){_0x58744a[_0x5a18('0x90')]({'id':_0x158516[_0x5a18('0x23')],'name':_0x158516[_0x5a18('0x23')],'utcOffset':_0x158516[_0x5a18('0x91')]});});return _0xe4fd7d['status'](0xc8)['json']({'tz':_0x58744a});};exports[_0x5a18('0x92')]=function(_0x5d8f68,_0x3b7a7f,_0x4e7408){var _0xe4f790=shared[_0x5a18('0x8f')];var _0x1dbc08={};if(!_[_0x5a18('0x6e')](_0xe4f790[_0x5d8f68[_0x5a18('0x58')]['id']]))_0x1dbc08=_0xe4f790[_0x5d8f68[_0x5a18('0x58')]['id']];return _0x3b7a7f[_0x5a18('0x24')](0xc8)[_0x5a18('0x17')](_0x1dbc08);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index cc83057..1320c6c 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 _0xc5c0=['./cmHopper.attributes','exports','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0xc5c0,0xa0));var _0x0c5c=function(_0x245144,_0x1ed4d2){_0x245144=_0x245144-0x0;var _0x592903=_0xc5c0[_0x245144];return _0x592903;};'use strict';var _=require(_0x0c5c('0x0'));var util=require(_0x0c5c('0x1'));var logger=require(_0x0c5c('0x2'))('api');var moment=require(_0x0c5c('0x3'));var BPromise=require(_0x0c5c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c5c('0x5'));var rimraf=require(_0x0c5c('0x6'));var config=require(_0x0c5c('0x7'));var attributes=require(_0x0c5c('0x8'));module[_0x0c5c('0x9')]=function(_0x50dab0,_0x17e6be){return _0x50dab0['define'](_0x0c5c('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x0c5c('0xb'),'fields':[_0x0c5c('0xb')]},{'name':_0x0c5c('0xc'),'fields':[_0x0c5c('0xc')]},{'name':'priority','fields':[_0x0c5c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5075=['../../config/logger','api','moment','bluebird','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util'];(function(_0x54d9af,_0x3808f7){var _0xd4bb86=function(_0xf3f8ac){while(--_0xf3f8ac){_0x54d9af['push'](_0x54d9af['shift']());}};_0xd4bb86(++_0x3808f7);}(_0x5075,0x94));var _0x5507=function(_0x50a864,_0x3303e2){_0x50a864=_0x50a864-0x0;var _0x2fb82f=_0x5075[_0x50a864];return _0x2fb82f;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var BPromise=require(_0x5507('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5507('0x6'));var config=require('../../config/environment');var attributes=require(_0x5507('0x7'));module[_0x5507('0x8')]=function(_0x29eebd,_0x422024){return _0x29eebd[_0x5507('0x9')](_0x5507('0xa'),attributes,{'tableName':_0x5507('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5507('0xc')]},{'name':_0x5507('0xd'),'fields':[_0x5507('0xd')]},{'name':_0x5507('0xe'),'fields':[_0x5507('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 6b3c3a8..b229da8 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 _0x074a=['raw','then','stringify','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','describe','sequelize','order','LOCK','Contact','keys','User','name','voicePause','length','includes','UserId','push','all','GetContactDialer','transaction','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','log','req\x20value','phone\x20value','phone','findOne','dialTimezone','DESC','getcontactbyohone','getContactByPhone','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','message','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','ShowCmHopper','find'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x074a,0x175));var _0xa074=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x074a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa074('0x0'));var util=require(_0xa074('0x1'));var moment=require(_0xa074('0x2'));var BPromise=require(_0xa074('0x3'));var rs=require(_0xa074('0x4'));var fs=require('fs');var Redis=require(_0xa074('0x5'));var db=require(_0xa074('0x6'))['db'];var utils=require(_0xa074('0x7'));var logger=require(_0xa074('0x8'))('rpc');var config=require(_0xa074('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa074('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d8385,_0x34d052,_0x331338){return new BPromise(function(_0x1993be,_0x410cba){return client[_0xa074('0xb')](_0x5d8385,_0x331338)['then'](function(_0x1b9225){logger[_0xa074('0xc')](_0xa074('0xd'),_0x34d052,_0xa074('0xe'));logger[_0xa074('0xf')](_0xa074('0x10'),_0x34d052,'request\x20sent',JSON['stringify'](_0x1b9225));if(_0x1b9225[_0xa074('0x11')]){if(_0x1b9225['error']['code']===0x1f4){logger[_0xa074('0x11')](_0xa074('0xd'),_0x34d052,_0x1b9225[_0xa074('0x11')][_0xa074('0x12')]);return _0x410cba(_0x1b9225['error'][_0xa074('0x12')]);}logger[_0xa074('0x11')](_0xa074('0xd'),_0x34d052,_0x1b9225['error'][_0xa074('0x12')]);return _0x1993be(_0x1b9225[_0xa074('0x11')][_0xa074('0x12')]);}else{logger['info'](_0xa074('0xd'),_0x34d052,_0xa074('0xe'));_0x1993be(_0x1b9225['result'][_0xa074('0x12')]);}})[_0xa074('0x13')](function(_0x13475e){logger['error'](_0xa074('0xd'),_0x34d052,_0x13475e);_0x410cba(_0x13475e);});});}exports[_0xa074('0x14')]=function(_0x540f77){var _0x13641a=this;return new Promise(function(_0x237e2b,_0x12abd9){return db[_0xa074('0x15')][_0xa074('0x16')]({'raw':_0x540f77[_0xa074('0x17')]?_0x540f77[_0xa074('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x540f77[_0xa074('0x17')]?_0x540f77['options'][_0xa074('0x18')]||null:null,'attributes':_0x540f77[_0xa074('0x17')]?_0x540f77[_0xa074('0x17')][_0xa074('0x19')]||null:null,'limit':_0x540f77[_0xa074('0x17')]?_0x540f77[_0xa074('0x17')][_0xa074('0x1a')]||null:null,'include':_0x540f77[_0xa074('0x17')]?_0x540f77[_0xa074('0x17')]['include']?_['map'](_0x540f77[_0xa074('0x17')][_0xa074('0x1b')],function(_0x248f56){return{'model':db[_0x248f56['model']],'as':_0x248f56['as'],'attributes':_0x248f56['attributes'],'include':_0x248f56[_0xa074('0x1b')]?_[_0xa074('0x1c')](_0x248f56[_0xa074('0x1b')],function(_0x1f1089){return{'model':db[_0x1f1089[_0xa074('0x1d')]],'as':_0x1f1089['as'],'attributes':_0x1f1089[_0xa074('0x19')],'include':_0x1f1089[_0xa074('0x1b')]?_['map'](_0x1f1089['include'],function(_0x48105a){return{'model':db[_0x48105a['model']],'as':_0x48105a['as'],'attributes':_0x48105a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xc3bed5){logger[_0xa074('0xc')](_0xa074('0x14'),_0x540f77);logger[_0xa074('0xf')]('GetCmHopper',_0x540f77,JSON['stringify'](_0xc3bed5));_0x237e2b(_0xc3bed5);})[_0xa074('0x13')](function(_0x3f856c){logger['error'](_0xa074('0x14'),_0x3f856c['message'],_0x540f77);_0x12abd9(_0x13641a[_0xa074('0x11')](0x1f4,_0x3f856c[_0xa074('0x12')]));});});};exports[_0xa074('0x1e')]=function(_0xae3d93){var _0x2a4a16=this;return new Promise(function(_0x2d111a,_0x2a77f4){return db['CmHopper'][_0xa074('0x1f')]({'raw':_0xae3d93['options']?_0xae3d93[_0xa074('0x17')][_0xa074('0x20')]===undefined?!![]:![]:!![],'where':_0xae3d93[_0xa074('0x17')]?_0xae3d93['options'][_0xa074('0x18')]||null:null,'attributes':_0xae3d93[_0xa074('0x17')]?_0xae3d93[_0xa074('0x17')][_0xa074('0x19')]||null:null,'include':_0xae3d93[_0xa074('0x17')]?_0xae3d93[_0xa074('0x17')][_0xa074('0x1b')]?_[_0xa074('0x1c')](_0xae3d93['options'][_0xa074('0x1b')],function(_0x4c327e){return{'model':db[_0x4c327e[_0xa074('0x1d')]],'as':_0x4c327e['as'],'attributes':_0x4c327e[_0xa074('0x19')],'include':_0x4c327e[_0xa074('0x1b')]?_[_0xa074('0x1c')](_0x4c327e[_0xa074('0x1b')],function(_0x37bf5d){return{'model':db[_0x37bf5d[_0xa074('0x1d')]],'as':_0x37bf5d['as'],'attributes':_0x37bf5d[_0xa074('0x19')],'include':_0x37bf5d['include']?_['map'](_0x37bf5d['include'],function(_0x1663cf){return{'model':db[_0x1663cf[_0xa074('0x1d')]],'as':_0x1663cf['as'],'attributes':_0x1663cf[_0xa074('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa074('0x21')](function(_0x4e39dc){logger['info'](_0xa074('0x1e'),_0xae3d93);logger['debug'](_0xa074('0x1e'),_0xae3d93,JSON[_0xa074('0x22')](_0x4e39dc));_0x2d111a(_0x4e39dc);})['catch'](function(_0x3fecd0){logger['error']('ShowCmHopper',_0x3fecd0['message'],_0xae3d93);_0x2a77f4(_0x2a4a16[_0xa074('0x11')](0x1f4,_0x3fecd0[_0xa074('0x12')]));});});};exports['CreateCmHopper']=function(_0x3b0288){var _0x36bd33=this;return new Promise(function(_0x4ba475,_0xe84c11){return db[_0xa074('0x15')][_0xa074('0x23')](_0x3b0288[_0xa074('0x24')],{'raw':_0x3b0288[_0xa074('0x17')]?_0x3b0288[_0xa074('0x17')][_0xa074('0x20')]===undefined?!![]:![]:!![]})[_0xa074('0x21')](function(_0x2c6545){logger[_0xa074('0xc')](_0xa074('0x25'),_0x3b0288);logger['debug']('CreateCmHopper',_0x3b0288,JSON['stringify'](_0x2c6545));_0x4ba475(_0x2c6545);})['catch'](function(_0x5f4b64){logger[_0xa074('0x11')](_0xa074('0x25'),_0x5f4b64[_0xa074('0x12')],_0x3b0288);_0xe84c11(_0x36bd33[_0xa074('0x11')](0x1f4,_0x5f4b64['message']));});});};exports[_0xa074('0x26')]=function(_0x372882){var _0x261b37=this;return new Promise(function(_0x49d879,_0xe47f75){return db['CmHopper'][_0xa074('0x27')](_0x372882[_0xa074('0x24')],{'raw':_0x372882[_0xa074('0x17')]?_0x372882['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x372882[_0xa074('0x17')]?_0x372882['options'][_0xa074('0x18')]||null:null,'attributes':_0x372882[_0xa074('0x17')]?_0x372882[_0xa074('0x17')][_0xa074('0x19')]||null:null,'limit':_0x372882[_0xa074('0x17')]?_0x372882[_0xa074('0x17')][_0xa074('0x1a')]||null:null})[_0xa074('0x21')](function(_0x4582b3){logger[_0xa074('0xc')](_0xa074('0x26'),_0x372882);logger[_0xa074('0xf')](_0xa074('0x26'),_0x372882,JSON[_0xa074('0x22')](_0x4582b3));_0x49d879(_0x4582b3);})[_0xa074('0x13')](function(_0x2a4020){logger['error'](_0xa074('0x26'),_0x2a4020[_0xa074('0x12')],_0x372882);_0xe47f75(_0x261b37[_0xa074('0x11')](0x1f4,_0x2a4020[_0xa074('0x12')]));});});};exports[_0xa074('0x28')]=function(_0x223714){var _0x20ac57=this;return new Promise(function(_0x461f07,_0x1945e0){return db[_0xa074('0x15')][_0xa074('0x29')]({'where':_0x223714['options']?_0x223714[_0xa074('0x17')][_0xa074('0x18')]||null:null})[_0xa074('0x21')](function(_0x475105){logger[_0xa074('0xc')](_0xa074('0x28'),_0x223714);logger['debug'](_0xa074('0x28'),_0x223714,JSON[_0xa074('0x22')](_0x475105));_0x461f07(_0x475105);})['catch'](function(_0x164244){logger[_0xa074('0x11')](_0xa074('0x28'),_0x164244[_0xa074('0x12')],_0x223714);_0x1945e0(_0x20ac57[_0xa074('0x11')](0x1f4,_0x164244[_0xa074('0x12')]));});});};exports['GetContactDialer']=function(_0x14a81f){var _0x5d09ef=this;return new Promise(function(_0x5dd7a9,_0x58cfcb){return db[_0xa074('0x2a')][_0xa074('0x2b')]()[_0xa074('0x21')](function(_0x3d92da){return db[_0xa074('0x2c')]['transaction'](function(_0x303042){return db[_0xa074('0x15')]['findAll']({'where':_0x14a81f['options']?_0x14a81f[_0xa074('0x17')][_0xa074('0x18')]||null:null,'attributes':_0x14a81f[_0xa074('0x17')]?_0x14a81f[_0xa074('0x17')]['attributes']||null:null,'limit':_0x14a81f[_0xa074('0x17')]?_0x14a81f[_0xa074('0x17')]['limit']||null:null,'order':_0x14a81f[_0xa074('0x17')]?_0x14a81f[_0xa074('0x17')][_0xa074('0x2d')]||null:null,'transaction':_0x303042,'lock':_0x303042[_0xa074('0x2e')]['UPDATE'],'include':[{'model':db[_0xa074('0x2a')],'as':_0xa074('0x2f'),'attributes':_[_0xa074('0x30')](_0x3d92da)},{'model':db[_0xa074('0x31')],'as':'Agent','attributes':['id',_0xa074('0x32'),_0xa074('0x33')]}]})[_0xa074('0x21')](function(_0x23a2a0){var _0x4c1cbd=[];var _0x383c60=[];for(var _0x1b97ba=0x0;_0x1b97ba<_0x23a2a0[_0xa074('0x34')];_0x1b97ba+=0x1){if(!_0x383c60[_0xa074('0x35')](_0x23a2a0[_0x1b97ba][_0xa074('0x36')])){_0x383c60['push'](_0x23a2a0[_0x1b97ba]['UserId']);_0x4c1cbd[_0xa074('0x37')](_0x23a2a0[_0x1b97ba][_0xa074('0x27')](_0x14a81f[_0xa074('0x24')],{'transaction':_0x303042}));}}return BPromise[_0xa074('0x38')](_0x4c1cbd);});})[_0xa074('0x21')](function(_0x2a8c04){logger[_0xa074('0xc')]('GetContactDialer',_0x14a81f);logger[_0xa074('0xf')](_0xa074('0x39'),_0x14a81f,JSON['stringify'](_0x2a8c04));_0x5dd7a9(_0x2a8c04);})[_0xa074('0x13')](function(_0x2755d7){logger[_0xa074('0x11')]('GetContactDialer',_0x2755d7['message'],_0x14a81f);_0x58cfcb(_0x5d09ef[_0xa074('0x11')](0x1f4,_0x2755d7['message']));});});});};exports['MoveContactManagedDialer']=function(_0x116d2e){var _0x1b8b34=this;return new Promise(function(_0x5a2d7d,_0x5d71fe){return db[_0xa074('0x2c')][_0xa074('0x3a')](function(_0x325b0a){return db['CmHopperFinal']['create'](_0x116d2e[_0xa074('0x24')],{'raw':_0x116d2e['options']?_0x116d2e[_0xa074('0x17')][_0xa074('0x20')]===undefined?!![]:![]:!![],'transaction':_0x325b0a})[_0xa074('0x21')](function(){return db[_0xa074('0x15')][_0xa074('0x29')]({'where':_0x116d2e['options']?_0x116d2e[_0xa074('0x17')]['where']||null:null,'transaction':_0x325b0a});});})['then'](function(_0x15c2a2){logger[_0xa074('0xc')](_0xa074('0x3b'),_0x116d2e);logger[_0xa074('0xf')]('MoveContactManagedDialer',_0x116d2e,JSON[_0xa074('0x22')](_0x15c2a2));_0x5a2d7d(_0x15c2a2);})[_0xa074('0x13')](function(_0x7e343c){logger[_0xa074('0x11')](_0xa074('0x3b'),_0x7e343c['message'],_0x116d2e);_0x5d71fe(_0x1b8b34['error'](0x1f4,_0x7e343c[_0xa074('0x12')]));});});};exports[_0xa074('0x3c')]=function(_0x2867e2){var _0x965010=this;return new Promise(function(_0x29bed0,_0x36a068){return db[_0xa074('0x15')][_0xa074('0x16')]({'raw':_0x2867e2[_0xa074('0x17')]?_0x2867e2[_0xa074('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2867e2[_0xa074('0x17')]?_0x2867e2[_0xa074('0x17')][_0xa074('0x18')]||null:null,'attributes':[[db[_0xa074('0x2c')]['fn'](_0xa074('0x3d'),db['sequelize']['fn']('IF',db[_0xa074('0x2c')][_0xa074('0x3e')](_0xa074('0x3f')+util[_0xa074('0x40')]('\x22%s\x22',moment()[_0xa074('0x40')](_0xa074('0x41')))+_0xa074('0x42')))),_0xa074('0x43')]]})[_0xa074('0x21')](function(_0x154195){logger[_0xa074('0xc')]('CountReScheduled',_0x2867e2);logger[_0xa074('0xf')](_0xa074('0x3c'),_0x2867e2,JSON[_0xa074('0x22')](_0x154195));_0x29bed0(_0x154195);})[_0xa074('0x13')](function(_0x5e5b73){logger[_0xa074('0x11')](_0xa074('0x3c'),_0x5e5b73[_0xa074('0x12')],_0x2867e2);_0x36a068(_0x965010[_0xa074('0x11')](0x1f4,_0x5e5b73['message']));});});};exports[_0xa074('0x44')]=function(_0x47c0c2){var _0x24dffb=this;return new Promise(function(_0x29b437,_0x2ebdd7){return db[_0xa074('0x2a')][_0xa074('0x2b')]()['then'](function(_0x2aa47d){return db[_0xa074('0x2c')][_0xa074('0x3a')](function(_0x3e0003){return db[_0xa074('0x15')][_0xa074('0x16')]({'where':_0x47c0c2[_0xa074('0x17')]?_0x47c0c2[_0xa074('0x17')][_0xa074('0x18')]||null:null,'attributes':_0x47c0c2[_0xa074('0x17')]?_0x47c0c2[_0xa074('0x17')]['attributes']||null:null,'limit':0x1,'order':_0x47c0c2[_0xa074('0x17')]?_0x47c0c2['options'][_0xa074('0x2d')]||null:null,'group':db[_0xa074('0x15')][_0xa074('0x36')],'transaction':_0x3e0003,'lock':_0x3e0003['LOCK'][_0xa074('0x45')],'include':_0x47c0c2['options']?_0x47c0c2['options']['include']?_['map'](_0x47c0c2[_0xa074('0x17')][_0xa074('0x1b')],function(_0x864a09){return{'model':db[_0x864a09[_0xa074('0x1d')]],'as':_0x864a09['as'],'attributes':_0x864a09[_0xa074('0x19')],'include':_0x864a09['include']?_[_0xa074('0x1c')](_0x864a09[_0xa074('0x1b')],function(_0x4968fa){return{'model':db[_0x4968fa['model']],'as':_0x4968fa['as'],'attributes':_0x4968fa[_0xa074('0x19')],'include':_0x4968fa[_0xa074('0x1b')]?_[_0xa074('0x1c')](_0x4968fa[_0xa074('0x1b')],function(_0x834ac9){return{'model':db[_0x834ac9['model']],'as':_0x834ac9['as'],'attributes':_0x834ac9['attributes']};}):[]};}):[]};}):[]:[]})[_0xa074('0x21')](function(_0x33a49e){var _0x1b28f3=[];for(var _0x260543=0x0;_0x260543<_0x33a49e[_0xa074('0x34')];_0x260543+=0x1){_0x1b28f3['push'](_0x33a49e[_0x260543][_0xa074('0x27')](_0x47c0c2['body'],{'transaction':_0x3e0003}));}return BPromise[_0xa074('0x38')](_0x1b28f3);});})[_0xa074('0x21')](function(_0x5e9693){logger[_0xa074('0xc')](_0xa074('0x44'),_0x47c0c2);logger[_0xa074('0xf')](_0xa074('0x44'),_0x47c0c2,JSON[_0xa074('0x22')](_0x5e9693));_0x29b437(_0x5e9693);})[_0xa074('0x13')](function(_0x448eb4){logger[_0xa074('0x11')](_0xa074('0x44'),_0x448eb4['message'],_0x47c0c2);_0x2ebdd7(_0x24dffb['error'](0x1f4,_0x448eb4['message']));});});});};exports[_0xa074('0x46')]=function(_0x31cb4f){var _0x517f05=this;return new Promise(function(_0x21ff5c,_0x50ae9a){db[_0xa074('0x2a')][_0xa074('0x2b')]()[_0xa074('0x21')](function(_0x2005e5){return db[_0xa074('0x15')][_0xa074('0x16')]({'raw':_0x31cb4f['options']?_0x31cb4f['options'][_0xa074('0x20')]===undefined?!![]:![]:!![],'where':_0x31cb4f[_0xa074('0x17')]?_0x31cb4f[_0xa074('0x17')][_0xa074('0x18')]||null:null,'attributes':_0x31cb4f['options']?_0x31cb4f[_0xa074('0x17')]['attributes']||null:null,'limit':_0x31cb4f[_0xa074('0x17')]?_0x31cb4f[_0xa074('0x17')][_0xa074('0x1a')]||null:null,'include':_0x31cb4f['options']?_0x31cb4f['options'][_0xa074('0x1b')]?_[_0xa074('0x1c')](_0x31cb4f[_0xa074('0x17')]['include'],function(_0x19a1fb){return{'model':db[_0x19a1fb[_0xa074('0x1d')]],'as':_0x19a1fb['as'],'attributes':_0x19a1fb['as']===_0xa074('0x2f')?_['keys'](_0x2005e5):_0x19a1fb[_0xa074('0x19')],'include':_0x19a1fb[_0xa074('0x1b')]?_[_0xa074('0x1c')](_0x19a1fb[_0xa074('0x1b')],function(_0x24b2ae){return{'model':db[_0x24b2ae[_0xa074('0x1d')]],'as':_0x24b2ae['as'],'attributes':_0x24b2ae[_0xa074('0x19')],'include':_0x24b2ae[_0xa074('0x1b')]?_[_0xa074('0x1c')](_0x24b2ae[_0xa074('0x1b')],function(_0x52b042){return{'model':db[_0x52b042[_0xa074('0x1d')]],'as':_0x52b042['as'],'attributes':_0x52b042[_0xa074('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa074('0x21')](function(_0x2c929b){logger[_0xa074('0xc')](_0xa074('0x14'),_0x31cb4f);logger['debug'](_0xa074('0x14'),_0x31cb4f,JSON[_0xa074('0x22')](_0x2c929b));_0x21ff5c(_0x2c929b);})[_0xa074('0x13')](function(_0x371cc8){logger[_0xa074('0x11')](_0xa074('0x14'),_0x371cc8[_0xa074('0x12')],_0x31cb4f);_0x50ae9a(_0x517f05[_0xa074('0x11')](0x1f4,_0x371cc8[_0xa074('0x12')]));});});});};exports[_0xa074('0x47')]=function(_0x195086){console[_0xa074('0x48')](_0xa074('0x49'),_0x195086);console['log'](_0xa074('0x4a'),_0x195086[_0xa074('0x17')]['where'][_0xa074('0x4b')]);_this=this;return new Promise(function(_0x3ad60d,_0x287e72){return db[_0xa074('0x2a')][_0xa074('0x4c')]({'raw':!![],'where':{'phone':_0x195086[_0xa074('0x17')]['where'][_0xa074('0x4b')]},'attributes':['id',_0xa074('0x4d')],'order':[['id',_0xa074('0x4e')]]})['then'](function(_0xec34fe){console[_0xa074('0x48')](_0xa074('0x4f'),_0xec34fe);logger['info'](_0xa074('0x50'),_0x195086);logger['debug'](_0xa074('0x50'),_0x195086,JSON['stringify'](_0xec34fe));_0x3ad60d(_0xec34fe);})[_0xa074('0x13')](function(_0x5b2372){logger[_0xa074('0x11')]('getContactByPhone',_0x5b2372['message'],_0x195086);_0x287e72(_this[_0xa074('0x11')](0x1f4,_0x5b2372['message']));});});}; \ No newline at end of file +var _0x7d37=['log','req\x20value','phone\x20value','phone','findOne','getcontactbyohone','getContactByPhone','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','transaction','LOCK','UPDATE','Contact','User','Agent','voicePause','length','includes','UserId','update','sequelize','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','order','push','all','GetCmHopperPreview','describe','keys','GetContactByPhone'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x7d37,0x1db));var _0x77d3=function(_0x184759,_0x869683){_0x184759=_0x184759-0x0;var _0x455498=_0x7d37[_0x184759];return _0x455498;};'use strict';var _=require(_0x77d3('0x0'));var util=require(_0x77d3('0x1'));var moment=require(_0x77d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x77d3('0x3'));var fs=require('fs');var Redis=require(_0x77d3('0x4'));var db=require(_0x77d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77d3('0x6'))(_0x77d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x77d3('0x8'));var client=jayson['client'][_0x77d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x519c6e,_0x40235d,_0x373da8){return new BPromise(function(_0x5c0108,_0x555390){return client[_0x77d3('0xa')](_0x519c6e,_0x373da8)[_0x77d3('0xb')](function(_0x506caa){logger[_0x77d3('0xc')]('CmHopper,\x20%s,\x20%s',_0x40235d,_0x77d3('0xd'));logger['debug'](_0x77d3('0xe'),_0x40235d,'request\x20sent',JSON[_0x77d3('0xf')](_0x506caa));if(_0x506caa[_0x77d3('0x10')]){if(_0x506caa[_0x77d3('0x10')][_0x77d3('0x11')]===0x1f4){logger[_0x77d3('0x10')](_0x77d3('0x12'),_0x40235d,_0x506caa[_0x77d3('0x10')][_0x77d3('0x13')]);return _0x555390(_0x506caa[_0x77d3('0x10')]['message']);}logger[_0x77d3('0x10')]('CmHopper,\x20%s,\x20%s',_0x40235d,_0x506caa['error']['message']);return _0x5c0108(_0x506caa[_0x77d3('0x10')][_0x77d3('0x13')]);}else{logger[_0x77d3('0xc')](_0x77d3('0x12'),_0x40235d,_0x77d3('0xd'));_0x5c0108(_0x506caa['result'][_0x77d3('0x13')]);}})[_0x77d3('0x14')](function(_0x5e92d8){logger['error'](_0x77d3('0x12'),_0x40235d,_0x5e92d8);_0x555390(_0x5e92d8);});});}exports[_0x77d3('0x15')]=function(_0x60173f){var _0x4500a2=this;return new Promise(function(_0x144656,_0x1378a5){return db[_0x77d3('0x16')][_0x77d3('0x17')]({'raw':_0x60173f[_0x77d3('0x18')]?_0x60173f[_0x77d3('0x18')][_0x77d3('0x19')]===undefined?!![]:![]:!![],'where':_0x60173f[_0x77d3('0x18')]?_0x60173f[_0x77d3('0x18')][_0x77d3('0x1a')]||null:null,'attributes':_0x60173f[_0x77d3('0x18')]?_0x60173f[_0x77d3('0x18')][_0x77d3('0x1b')]||null:null,'limit':_0x60173f[_0x77d3('0x18')]?_0x60173f['options'][_0x77d3('0x1c')]||null:null,'include':_0x60173f[_0x77d3('0x18')]?_0x60173f[_0x77d3('0x18')][_0x77d3('0x1d')]?_[_0x77d3('0x1e')](_0x60173f[_0x77d3('0x18')][_0x77d3('0x1d')],function(_0x17e9f9){return{'model':db[_0x17e9f9[_0x77d3('0x1f')]],'as':_0x17e9f9['as'],'attributes':_0x17e9f9['attributes'],'include':_0x17e9f9[_0x77d3('0x1d')]?_['map'](_0x17e9f9[_0x77d3('0x1d')],function(_0x443aa6){return{'model':db[_0x443aa6[_0x77d3('0x1f')]],'as':_0x443aa6['as'],'attributes':_0x443aa6[_0x77d3('0x1b')],'include':_0x443aa6[_0x77d3('0x1d')]?_[_0x77d3('0x1e')](_0x443aa6['include'],function(_0x17c6c6){return{'model':db[_0x17c6c6[_0x77d3('0x1f')]],'as':_0x17c6c6['as'],'attributes':_0x17c6c6[_0x77d3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x77d3('0xb')](function(_0x451c1a){logger[_0x77d3('0xc')](_0x77d3('0x15'),_0x60173f);logger[_0x77d3('0x20')](_0x77d3('0x15'),_0x60173f,JSON[_0x77d3('0xf')](_0x451c1a));_0x144656(_0x451c1a);})['catch'](function(_0x3add49){logger[_0x77d3('0x10')]('GetCmHopper',_0x3add49[_0x77d3('0x13')],_0x60173f);_0x1378a5(_0x4500a2[_0x77d3('0x10')](0x1f4,_0x3add49['message']));});});};exports['ShowCmHopper']=function(_0x2f4542){var _0x582575=this;return new Promise(function(_0xb9ebbb,_0x14e933){return db[_0x77d3('0x16')]['find']({'raw':_0x2f4542['options']?_0x2f4542['options'][_0x77d3('0x19')]===undefined?!![]:![]:!![],'where':_0x2f4542[_0x77d3('0x18')]?_0x2f4542[_0x77d3('0x18')][_0x77d3('0x1a')]||null:null,'attributes':_0x2f4542[_0x77d3('0x18')]?_0x2f4542[_0x77d3('0x18')][_0x77d3('0x1b')]||null:null,'include':_0x2f4542[_0x77d3('0x18')]?_0x2f4542['options']['include']?_[_0x77d3('0x1e')](_0x2f4542[_0x77d3('0x18')]['include'],function(_0x5e7a57){return{'model':db[_0x5e7a57['model']],'as':_0x5e7a57['as'],'attributes':_0x5e7a57[_0x77d3('0x1b')],'include':_0x5e7a57[_0x77d3('0x1d')]?_[_0x77d3('0x1e')](_0x5e7a57[_0x77d3('0x1d')],function(_0x453956){return{'model':db[_0x453956['model']],'as':_0x453956['as'],'attributes':_0x453956['attributes'],'include':_0x453956[_0x77d3('0x1d')]?_[_0x77d3('0x1e')](_0x453956[_0x77d3('0x1d')],function(_0x248534){return{'model':db[_0x248534[_0x77d3('0x1f')]],'as':_0x248534['as'],'attributes':_0x248534[_0x77d3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x77d3('0xb')](function(_0x1bd366){logger[_0x77d3('0xc')](_0x77d3('0x21'),_0x2f4542);logger['debug']('ShowCmHopper',_0x2f4542,JSON[_0x77d3('0xf')](_0x1bd366));_0xb9ebbb(_0x1bd366);})['catch'](function(_0xd34464){logger['error'](_0x77d3('0x21'),_0xd34464['message'],_0x2f4542);_0x14e933(_0x582575[_0x77d3('0x10')](0x1f4,_0xd34464[_0x77d3('0x13')]));});});};exports['CreateCmHopper']=function(_0x443b6b){var _0x4580ee=this;return new Promise(function(_0x519e80,_0x163fa5){return db[_0x77d3('0x16')][_0x77d3('0x22')](_0x443b6b[_0x77d3('0x23')],{'raw':_0x443b6b[_0x77d3('0x18')]?_0x443b6b[_0x77d3('0x18')][_0x77d3('0x19')]===undefined?!![]:![]:!![]})[_0x77d3('0xb')](function(_0x5a12e4){logger[_0x77d3('0xc')](_0x77d3('0x24'),_0x443b6b);logger[_0x77d3('0x20')](_0x77d3('0x24'),_0x443b6b,JSON[_0x77d3('0xf')](_0x5a12e4));_0x519e80(_0x5a12e4);})[_0x77d3('0x14')](function(_0x2986ca){logger[_0x77d3('0x10')](_0x77d3('0x24'),_0x2986ca[_0x77d3('0x13')],_0x443b6b);_0x163fa5(_0x4580ee[_0x77d3('0x10')](0x1f4,_0x2986ca[_0x77d3('0x13')]));});});};exports[_0x77d3('0x25')]=function(_0x23f72e){var _0x553215=this;return new Promise(function(_0x316441,_0x37ea08){return db[_0x77d3('0x16')]['update'](_0x23f72e['body'],{'raw':_0x23f72e['options']?_0x23f72e[_0x77d3('0x18')][_0x77d3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23f72e[_0x77d3('0x18')]?_0x23f72e[_0x77d3('0x18')][_0x77d3('0x1a')]||null:null,'attributes':_0x23f72e[_0x77d3('0x18')]?_0x23f72e['options']['attributes']||null:null,'limit':_0x23f72e[_0x77d3('0x18')]?_0x23f72e[_0x77d3('0x18')][_0x77d3('0x1c')]||null:null})['then'](function(_0x4ef56b){logger[_0x77d3('0xc')](_0x77d3('0x25'),_0x23f72e);logger['debug'](_0x77d3('0x25'),_0x23f72e,JSON['stringify'](_0x4ef56b));_0x316441(_0x4ef56b);})['catch'](function(_0x209dee){logger[_0x77d3('0x10')](_0x77d3('0x25'),_0x209dee[_0x77d3('0x13')],_0x23f72e);_0x37ea08(_0x553215[_0x77d3('0x10')](0x1f4,_0x209dee[_0x77d3('0x13')]));});});};exports[_0x77d3('0x26')]=function(_0xe38d91){var _0x5795c3=this;return new Promise(function(_0x3a08d7,_0x42148b){return db[_0x77d3('0x16')][_0x77d3('0x27')]({'where':_0xe38d91[_0x77d3('0x18')]?_0xe38d91[_0x77d3('0x18')][_0x77d3('0x1a')]||null:null})[_0x77d3('0xb')](function(_0x3ee816){logger[_0x77d3('0xc')]('DestroyCmHopper',_0xe38d91);logger[_0x77d3('0x20')](_0x77d3('0x26'),_0xe38d91,JSON['stringify'](_0x3ee816));_0x3a08d7(_0x3ee816);})['catch'](function(_0x5c2dd6){logger[_0x77d3('0x10')]('DestroyCmHopper',_0x5c2dd6[_0x77d3('0x13')],_0xe38d91);_0x42148b(_0x5795c3[_0x77d3('0x10')](0x1f4,_0x5c2dd6[_0x77d3('0x13')]));});});};exports[_0x77d3('0x28')]=function(_0x33ae34){var _0x53abac=this;return new Promise(function(_0x1b8917,_0x514688){return db[_0x77d3('0x29')]['describe']()['then'](function(_0x3d5def){return db['sequelize'][_0x77d3('0x2a')](function(_0x204d5b){return db['CmHopper'][_0x77d3('0x17')]({'where':_0x33ae34[_0x77d3('0x18')]?_0x33ae34[_0x77d3('0x18')][_0x77d3('0x1a')]||null:null,'attributes':_0x33ae34[_0x77d3('0x18')]?_0x33ae34[_0x77d3('0x18')][_0x77d3('0x1b')]||null:null,'limit':_0x33ae34[_0x77d3('0x18')]?_0x33ae34[_0x77d3('0x18')][_0x77d3('0x1c')]||null:null,'order':_0x33ae34['options']?_0x33ae34[_0x77d3('0x18')]['order']||null:null,'transaction':_0x204d5b,'lock':_0x204d5b[_0x77d3('0x2b')][_0x77d3('0x2c')],'include':[{'model':db['CmContact'],'as':_0x77d3('0x2d'),'attributes':_['keys'](_0x3d5def)},{'model':db[_0x77d3('0x2e')],'as':_0x77d3('0x2f'),'attributes':['id','name',_0x77d3('0x30')]}]})['then'](function(_0x47717d){var _0x1be357=[];var _0x54e798=[];for(var _0x2deccb=0x0;_0x2deccb<_0x47717d[_0x77d3('0x31')];_0x2deccb+=0x1){if(!_0x54e798[_0x77d3('0x32')](_0x47717d[_0x2deccb][_0x77d3('0x33')])){_0x54e798['push'](_0x47717d[_0x2deccb][_0x77d3('0x33')]);_0x1be357['push'](_0x47717d[_0x2deccb][_0x77d3('0x34')](_0x33ae34['body'],{'transaction':_0x204d5b}));}}return BPromise['all'](_0x1be357);});})[_0x77d3('0xb')](function(_0x5906b7){logger[_0x77d3('0xc')](_0x77d3('0x28'),_0x33ae34);logger[_0x77d3('0x20')](_0x77d3('0x28'),_0x33ae34,JSON[_0x77d3('0xf')](_0x5906b7));_0x1b8917(_0x5906b7);})[_0x77d3('0x14')](function(_0x4d194c){logger[_0x77d3('0x10')](_0x77d3('0x28'),_0x4d194c[_0x77d3('0x13')],_0x33ae34);_0x514688(_0x53abac['error'](0x1f4,_0x4d194c[_0x77d3('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x36282f){var _0x28c099=this;return new Promise(function(_0xf358a9,_0x1357b7){return db[_0x77d3('0x35')][_0x77d3('0x2a')](function(_0x5ac0ec){return db[_0x77d3('0x36')][_0x77d3('0x22')](_0x36282f['body'],{'raw':_0x36282f[_0x77d3('0x18')]?_0x36282f[_0x77d3('0x18')][_0x77d3('0x19')]===undefined?!![]:![]:!![],'transaction':_0x5ac0ec})[_0x77d3('0xb')](function(){return db[_0x77d3('0x16')][_0x77d3('0x27')]({'where':_0x36282f[_0x77d3('0x18')]?_0x36282f[_0x77d3('0x18')][_0x77d3('0x1a')]||null:null,'transaction':_0x5ac0ec});});})[_0x77d3('0xb')](function(_0x49509d){logger[_0x77d3('0xc')]('MoveContactManagedDialer',_0x36282f);logger['debug']('MoveContactManagedDialer',_0x36282f,JSON[_0x77d3('0xf')](_0x49509d));_0xf358a9(_0x49509d);})[_0x77d3('0x14')](function(_0x51ec05){logger[_0x77d3('0x10')](_0x77d3('0x37'),_0x51ec05[_0x77d3('0x13')],_0x36282f);_0x1357b7(_0x28c099[_0x77d3('0x10')](0x1f4,_0x51ec05[_0x77d3('0x13')]));});});};exports[_0x77d3('0x38')]=function(_0x353147){var _0x334927=this;return new Promise(function(_0x2c2dc0,_0x4fa657){return db[_0x77d3('0x16')]['findAll']({'raw':_0x353147[_0x77d3('0x18')]?_0x353147[_0x77d3('0x18')][_0x77d3('0x19')]===undefined?!![]:![]:!![],'where':_0x353147[_0x77d3('0x18')]?_0x353147['options'][_0x77d3('0x1a')]||null:null,'attributes':[[db[_0x77d3('0x35')]['fn'](_0x77d3('0x39'),db['sequelize']['fn']('IF',db[_0x77d3('0x35')]['literal'](_0x77d3('0x3a')+util[_0x77d3('0x3b')](_0x77d3('0x3c'),moment()['format'](_0x77d3('0x3d')))+_0x77d3('0x3e')))),'contactsRescheduled']]})[_0x77d3('0xb')](function(_0x4a240d){logger[_0x77d3('0xc')](_0x77d3('0x38'),_0x353147);logger[_0x77d3('0x20')](_0x77d3('0x38'),_0x353147,JSON[_0x77d3('0xf')](_0x4a240d));_0x2c2dc0(_0x4a240d);})[_0x77d3('0x14')](function(_0x18d806){logger[_0x77d3('0x10')]('CountReScheduled',_0x18d806[_0x77d3('0x13')],_0x353147);_0x4fa657(_0x334927[_0x77d3('0x10')](0x1f4,_0x18d806[_0x77d3('0x13')]));});});};exports[_0x77d3('0x3f')]=function(_0x5205ce){var _0x233274=this;return new Promise(function(_0x4cc3ab,_0x3dfa5f){return db[_0x77d3('0x29')]['describe']()[_0x77d3('0xb')](function(_0x17098b){return db[_0x77d3('0x35')][_0x77d3('0x2a')](function(_0x5f5a05){return db['CmHopper'][_0x77d3('0x17')]({'where':_0x5205ce[_0x77d3('0x18')]?_0x5205ce[_0x77d3('0x18')]['where']||null:null,'attributes':_0x5205ce[_0x77d3('0x18')]?_0x5205ce['options'][_0x77d3('0x1b')]||null:null,'limit':0x1,'order':_0x5205ce[_0x77d3('0x18')]?_0x5205ce[_0x77d3('0x18')][_0x77d3('0x40')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5f5a05,'lock':_0x5f5a05[_0x77d3('0x2b')][_0x77d3('0x2c')],'include':_0x5205ce[_0x77d3('0x18')]?_0x5205ce[_0x77d3('0x18')][_0x77d3('0x1d')]?_['map'](_0x5205ce['options'][_0x77d3('0x1d')],function(_0x307726){return{'model':db[_0x307726[_0x77d3('0x1f')]],'as':_0x307726['as'],'attributes':_0x307726[_0x77d3('0x1b')],'include':_0x307726[_0x77d3('0x1d')]?_[_0x77d3('0x1e')](_0x307726[_0x77d3('0x1d')],function(_0x29a0fa){return{'model':db[_0x29a0fa[_0x77d3('0x1f')]],'as':_0x29a0fa['as'],'attributes':_0x29a0fa['attributes'],'include':_0x29a0fa['include']?_[_0x77d3('0x1e')](_0x29a0fa['include'],function(_0x475fd1){return{'model':db[_0x475fd1[_0x77d3('0x1f')]],'as':_0x475fd1['as'],'attributes':_0x475fd1[_0x77d3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x77d3('0xb')](function(_0x8d6bec){var _0x42bdaa=[];for(var _0xa9fcc4=0x0;_0xa9fcc4<_0x8d6bec[_0x77d3('0x31')];_0xa9fcc4+=0x1){_0x42bdaa[_0x77d3('0x41')](_0x8d6bec[_0xa9fcc4][_0x77d3('0x34')](_0x5205ce['body'],{'transaction':_0x5f5a05}));}return BPromise[_0x77d3('0x42')](_0x42bdaa);});})[_0x77d3('0xb')](function(_0x1ad4d7){logger['info']('GetContactRecallMe',_0x5205ce);logger[_0x77d3('0x20')](_0x77d3('0x3f'),_0x5205ce,JSON[_0x77d3('0xf')](_0x1ad4d7));_0x4cc3ab(_0x1ad4d7);})['catch'](function(_0xe13fff){logger['error']('GetContactRecallMe',_0xe13fff[_0x77d3('0x13')],_0x5205ce);_0x3dfa5f(_0x233274[_0x77d3('0x10')](0x1f4,_0xe13fff[_0x77d3('0x13')]));});});});};exports[_0x77d3('0x43')]=function(_0x706e71){var _0x2e42a9=this;return new Promise(function(_0x333deb,_0x444e39){db[_0x77d3('0x29')][_0x77d3('0x44')]()[_0x77d3('0xb')](function(_0x2afce7){return db[_0x77d3('0x16')][_0x77d3('0x17')]({'raw':_0x706e71['options']?_0x706e71[_0x77d3('0x18')][_0x77d3('0x19')]===undefined?!![]:![]:!![],'where':_0x706e71[_0x77d3('0x18')]?_0x706e71['options'][_0x77d3('0x1a')]||null:null,'attributes':_0x706e71[_0x77d3('0x18')]?_0x706e71[_0x77d3('0x18')][_0x77d3('0x1b')]||null:null,'limit':_0x706e71[_0x77d3('0x18')]?_0x706e71[_0x77d3('0x18')][_0x77d3('0x1c')]||null:null,'include':_0x706e71['options']?_0x706e71[_0x77d3('0x18')][_0x77d3('0x1d')]?_['map'](_0x706e71[_0x77d3('0x18')]['include'],function(_0x17041b){return{'model':db[_0x17041b['model']],'as':_0x17041b['as'],'attributes':_0x17041b['as']===_0x77d3('0x2d')?_[_0x77d3('0x45')](_0x2afce7):_0x17041b[_0x77d3('0x1b')],'include':_0x17041b[_0x77d3('0x1d')]?_[_0x77d3('0x1e')](_0x17041b[_0x77d3('0x1d')],function(_0xca6905){return{'model':db[_0xca6905[_0x77d3('0x1f')]],'as':_0xca6905['as'],'attributes':_0xca6905[_0x77d3('0x1b')],'include':_0xca6905['include']?_['map'](_0xca6905[_0x77d3('0x1d')],function(_0x3a2cea){return{'model':db[_0x3a2cea[_0x77d3('0x1f')]],'as':_0x3a2cea['as'],'attributes':_0x3a2cea[_0x77d3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x259893){logger[_0x77d3('0xc')](_0x77d3('0x15'),_0x706e71);logger[_0x77d3('0x20')](_0x77d3('0x15'),_0x706e71,JSON[_0x77d3('0xf')](_0x259893));_0x333deb(_0x259893);})[_0x77d3('0x14')](function(_0x7a963f){logger[_0x77d3('0x10')](_0x77d3('0x15'),_0x7a963f[_0x77d3('0x13')],_0x706e71);_0x444e39(_0x2e42a9[_0x77d3('0x10')](0x1f4,_0x7a963f['message']));});});});};exports[_0x77d3('0x46')]=function(_0x16030d){console[_0x77d3('0x47')](_0x77d3('0x48'),_0x16030d);console['log'](_0x77d3('0x49'),_0x16030d['options'][_0x77d3('0x1a')][_0x77d3('0x4a')]);_this=this;return new Promise(function(_0x19453c,_0x10b769){return db[_0x77d3('0x29')][_0x77d3('0x4b')]({'raw':!![],'where':{'phone':_0x16030d[_0x77d3('0x18')][_0x77d3('0x1a')][_0x77d3('0x4a')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x77d3('0xb')](function(_0x1d0f90){console['log'](_0x77d3('0x4c'),_0x1d0f90);logger['info']('getContactByPhone',_0x16030d);logger[_0x77d3('0x20')]('getContactByPhone',_0x16030d,JSON[_0x77d3('0xf')](_0x1d0f90));_0x19453c(_0x1d0f90);})[_0x77d3('0x14')](function(_0x5ce533){logger['error'](_0x77d3('0x4d'),_0x5ce533[_0x77d3('0x13')],_0x16030d);_0x10b769(_this[_0x77d3('0x10')](0x1f4,_0x5ce533['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 18b7332..d3f3658 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 _0x2eb2=['/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','post','/preview','getPreview','/timezone','getTimezone','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2eb2[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0x9')](_0x22eb('0xc'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0x9')](_0x22eb('0xe'),auth['isAuthenticated'](),controller[_0x22eb('0xf')]);router['get']('/:id',auth[_0x22eb('0x7')](),controller['show']);router[_0x22eb('0x10')]('/',auth[_0x22eb('0x7')](),controller['create']);router['post'](_0x22eb('0x11'),auth[_0x22eb('0x7')](),controller[_0x22eb('0x12')]);router[_0x22eb('0x10')](_0x22eb('0x13'),auth['isAuthenticated'](),controller[_0x22eb('0x14')]);router['put'](_0x22eb('0x15'),auth['isAuthenticated'](),controller[_0x22eb('0x16')]);router[_0x22eb('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x22eb('0x18')]=router; \ No newline at end of file +var _0x3e74=['isAuthenticated','index','describe','/opencontacts','getTimezones','post','/preview','getPreview','getTimezone','put','update','delete','/:id','multer','path','connect-timeout','express','../../components/interaction/service','./cmHopper.controller','get'];(function(_0x449cc7,_0x126558){var _0x3ae2a2=function(_0x325946){while(--_0x325946){_0x449cc7['push'](_0x449cc7['shift']());}};_0x3ae2a2(++_0x126558);}(_0x3e74,0x175));var _0x43e7=function(_0x90cba8,_0x9167f5){_0x90cba8=_0x90cba8-0x0;var _0x38c716=_0x3e74[_0x90cba8];return _0x38c716;};'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['getOpenContacts']);router[_0x43e7('0x6')]('/timezones',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x7')](),controller['create']);router[_0x43e7('0xc')](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller[_0x43e7('0xe')]);router['post']('/timezone',auth[_0x43e7('0x7')](),controller[_0x43e7('0xf')]);router[_0x43e7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')](_0x43e7('0x13'),auth[_0x43e7('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 5bf1e07..b433454 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 _0xf056=['STRING','moment','sequelize','exports','INTEGER'];(function(_0x2073da,_0x94a8c3){var _0x551f56=function(_0x43047e){while(--_0x43047e){_0x2073da['push'](_0x2073da['shift']());}};_0x551f56(++_0x94a8c3);}(_0xf056,0x1c8));var _0x6f05=function(_0x4ee634,_0x3c4e6b){_0x4ee634=_0x4ee634-0x0;var _0x55189a=_0xf056[_0x4ee634];return _0x55189a;};'use strict';var moment=require(_0x6f05('0x0'));var Sequelize=require(_0x6f05('0x1'));module[_0x6f05('0x2')]={'CmHopperId':{'type':Sequelize[_0x6f05('0x3')]},'phone':{'type':Sequelize[_0x6f05('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6f05('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x6f05('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f05('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6f05('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6f05('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6f05('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6f05('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6f05('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6f05('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xce05=['moment','sequelize','exports','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x41449e,_0x437b3f){var _0x48f063=function(_0x112f38){while(--_0x112f38){_0x41449e['push'](_0x41449e['shift']());}};_0x48f063(++_0x437b3f);}(_0xce05,0xe0));var _0x5ce0=function(_0x288c5f,_0x49d366){_0x288c5f=_0x288c5f-0x0;var _0x3d8eea=_0xce05[_0x288c5f];return _0x3d8eea;};'use strict';var moment=require(_0x5ce0('0x0'));var Sequelize=require(_0x5ce0('0x1'));module[_0x5ce0('0x2')]={'CmHopperId':{'type':Sequelize[_0x5ce0('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x5ce0('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x5ce0('0x4')],'defaultValue':moment()[_0x5ce0('0x5')](_0x5ce0('0x6'))},'countbusyretry':{'type':Sequelize[_0x5ce0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5ce0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5ce0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 16143d5..afdc7d6 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 _0x8af4=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','CmHopperAdditionalPhones','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0x8af4,0xe9));var _0x48af=function(_0x493b70,_0x168e73){_0x493b70=_0x493b70-0x0;var _0x4c2355=_0x8af4[_0x493b70];return _0x4c2355;};'use strict';var pdf=require(_0x48af('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x48af('0x1'));var zipdir=require(_0x48af('0x2'));var jsonpatch=require(_0x48af('0x3'));var rp=require('request-promise');var moment=require(_0x48af('0x4'));var BPromise=require(_0x48af('0x5'));var Mustache=require(_0x48af('0x6'));var util=require(_0x48af('0x7'));var path=require(_0x48af('0x8'));var sox=require(_0x48af('0x9'));var csv=require(_0x48af('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x48af('0xb'));var crypto=require('crypto');var jsforce=require(_0x48af('0xc'));var deskjs=require(_0x48af('0xd'));var toCsv=require(_0x48af('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x48af('0xe'));var authService=require(_0x48af('0xf'));var qs=require(_0x48af('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48af('0x11'));var logger=require(_0x48af('0x12'))(_0x48af('0x13'));var utils=require(_0x48af('0x14'));var config=require(_0x48af('0x15'));var db=require(_0x48af('0x16'))['db'];function respondWithStatusCode(_0x53f77f,_0x176e3e){_0x176e3e=_0x176e3e||0xcc;return function(_0x450334){if(_0x450334){return _0x53f77f[_0x48af('0x17')](_0x176e3e);}return _0x53f77f[_0x48af('0x18')](_0x176e3e)[_0x48af('0x19')]();};}function respondWithResult(_0x30c124,_0x1042ff){_0x1042ff=_0x1042ff||0xc8;return function(_0x333c5e){if(_0x333c5e){return _0x30c124[_0x48af('0x18')](_0x1042ff)[_0x48af('0x1a')](_0x333c5e);}};}function respondWithFilteredResult(_0x674ec4,_0xd508d8){return function(_0x9c030f){if(_0x9c030f){var _0x4561f1=_0x9c030f[_0x48af('0x1b')],_0x1db611=_0xd508d8[_0x48af('0x1c')],_0x45a3c8=_0xd508d8[_0x48af('0x1c')]+_0xd508d8[_0x48af('0x1d')],_0x331c78;if(_0x45a3c8>=_0x4561f1){_0x45a3c8=_0x4561f1;_0x331c78=0xc8;}else{_0x331c78=0xce;}_0x674ec4[_0x48af('0x18')](_0x331c78);return _0x674ec4[_0x48af('0x1e')](_0x48af('0x1f'),_0x1db611+'-'+_0x45a3c8+'/'+_0x4561f1)[_0x48af('0x1a')](_0x9c030f);}return null;};}function patchUpdates(_0x5c32f6){return function(_0x153d4a){try{jsonpatch['apply'](_0x153d4a,_0x5c32f6,!![]);}catch(_0x29a8aa){return BPromise[_0x48af('0x20')](_0x29a8aa);}return _0x153d4a[_0x48af('0x21')]();};}function saveUpdates(_0x47cf86,_0x1728bd){return function(_0x2b7396){if(_0x2b7396){return _0x2b7396[_0x48af('0x22')](_0x47cf86)[_0x48af('0x23')](function(_0x5b369b){return _0x5b369b;});}return null;};}function removeEntity(_0x3208fa,_0x54d1f7){return function(_0x264f48){if(_0x264f48){return _0x264f48['destroy']()['then'](function(){var _0x50466d=_0x264f48['get']({'plain':!![]});var _0x42a446=_0x48af('0x24');return db['UserProfileResource'][_0x48af('0x25')]({'where':{'type':_0x42a446,'resourceId':_0x50466d['id']}})['then'](function(){return _0x264f48;});})['then'](function(){_0x3208fa[_0x48af('0x18')](0xcc)[_0x48af('0x19')]();});}};}function handleEntityNotFound(_0x8bc62e,_0x48ee6d){return function(_0x446524){if(!_0x446524){_0x8bc62e[_0x48af('0x17')](0x194);}return _0x446524;};}function handleError(_0x5dac88,_0x251c64){_0x251c64=_0x251c64||0x1f4;return function(_0x653694){logger[_0x48af('0x26')](_0x653694[_0x48af('0x27')]);if(_0x653694[_0x48af('0x28')]){delete _0x653694['name'];}_0x5dac88[_0x48af('0x18')](_0x251c64)[_0x48af('0x29')](_0x653694);};}exports[_0x48af('0x2a')]=function(_0x9a49c3,_0x10718b){var _0x140cc9={},_0x388f91={},_0x31a378={'count':0x0,'rows':[]};var _0x59d692=_[_0x48af('0x2b')](db[_0x48af('0x2c')]['rawAttributes'],function(_0x3ef8a4){return{'name':_0x3ef8a4['fieldName'],'type':_0x3ef8a4[_0x48af('0x2d')][_0x48af('0x2e')]};});_0x388f91[_0x48af('0x2f')]=_[_0x48af('0x2b')](_0x59d692,_0x48af('0x28'));_0x388f91['query']=_[_0x48af('0x30')](_0x9a49c3[_0x48af('0x31')]);_0x388f91[_0x48af('0x32')]=_['intersection'](_0x388f91['model'],_0x388f91[_0x48af('0x31')]);_0x140cc9['attributes']=_['intersection'](_0x388f91[_0x48af('0x2f')],qs[_0x48af('0x33')](_0x9a49c3[_0x48af('0x31')]['fields']));_0x140cc9[_0x48af('0x34')]=_0x140cc9['attributes'][_0x48af('0x35')]?_0x140cc9['attributes']:_0x388f91[_0x48af('0x2f')];if(!_0x9a49c3[_0x48af('0x31')][_0x48af('0x36')](_0x48af('0x37'))){_0x140cc9[_0x48af('0x1d')]=qs['limit'](_0x9a49c3[_0x48af('0x31')]['limit']);_0x140cc9[_0x48af('0x1c')]=qs[_0x48af('0x1c')](_0x9a49c3[_0x48af('0x31')][_0x48af('0x1c')]);}_0x140cc9[_0x48af('0x38')]=qs[_0x48af('0x39')](_0x9a49c3['query'][_0x48af('0x39')]);_0x140cc9[_0x48af('0x3a')]=qs[_0x48af('0x32')](_[_0x48af('0x3b')](_0x9a49c3[_0x48af('0x31')],_0x388f91[_0x48af('0x32')]),_0x59d692);if(_0x9a49c3[_0x48af('0x31')][_0x48af('0x3c')]){_0x140cc9[_0x48af('0x3a')]=_['merge'](_0x140cc9[_0x48af('0x3a')],{'$or':_[_0x48af('0x2b')](_0x59d692,function(_0x534abb){if(_0x534abb['type']!==_0x48af('0x3d')){var _0x11afe4={};_0x11afe4[_0x534abb[_0x48af('0x28')]]={'$like':'%'+_0x9a49c3[_0x48af('0x31')][_0x48af('0x3c')]+'%'};return _0x11afe4;}})});}_0x140cc9=_[_0x48af('0x3e')]({},_0x140cc9,_0x9a49c3[_0x48af('0x3f')]);var _0x2cdbb5={'where':_0x140cc9[_0x48af('0x3a')]};return db['CmHopperAdditionalPhone'][_0x48af('0x1b')](_0x2cdbb5)['then'](function(_0x1e6134){_0x31a378[_0x48af('0x1b')]=_0x1e6134;if(_0x9a49c3[_0x48af('0x31')]['includeAll']){_0x140cc9[_0x48af('0x40')]=[{'all':!![]}];}return db[_0x48af('0x2c')][_0x48af('0x41')](_0x140cc9);})[_0x48af('0x23')](function(_0x14de8c){_0x31a378[_0x48af('0x42')]=_0x14de8c;return _0x31a378;})[_0x48af('0x23')](respondWithFilteredResult(_0x10718b,_0x140cc9))[_0x48af('0x43')](handleError(_0x10718b,null));};exports[_0x48af('0x44')]=function(_0x5795b6,_0x5d0f45){var _0x585c0b={'raw':!![],'where':{'id':_0x5795b6[_0x48af('0x45')]['id']}},_0x558763={};_0x558763[_0x48af('0x2f')]=_[_0x48af('0x30')](db[_0x48af('0x2c')][_0x48af('0x46')]);_0x558763[_0x48af('0x31')]=_[_0x48af('0x30')](_0x5795b6[_0x48af('0x31')]);_0x558763[_0x48af('0x32')]=_[_0x48af('0x47')](_0x558763[_0x48af('0x2f')],_0x558763[_0x48af('0x31')]);_0x585c0b['attributes']=_[_0x48af('0x47')](_0x558763['model'],qs[_0x48af('0x33')](_0x5795b6[_0x48af('0x31')][_0x48af('0x33')]));_0x585c0b[_0x48af('0x34')]=_0x585c0b[_0x48af('0x34')][_0x48af('0x35')]?_0x585c0b[_0x48af('0x34')]:_0x558763['model'];if(_0x5795b6[_0x48af('0x31')][_0x48af('0x48')]){_0x585c0b[_0x48af('0x40')]=[{'all':!![]}];}_0x585c0b=_[_0x48af('0x3e')]({},_0x585c0b,_0x5795b6[_0x48af('0x3f')]);return db[_0x48af('0x2c')][_0x48af('0x49')](_0x585c0b)['then'](handleEntityNotFound(_0x5d0f45,null))[_0x48af('0x23')](respondWithResult(_0x5d0f45,null))[_0x48af('0x43')](handleError(_0x5d0f45,null));};exports['create']=function(_0x4065df,_0x15eece){return db['CmHopperAdditionalPhone'][_0x48af('0x4a')](_0x4065df['body'],{})[_0x48af('0x23')](function(_0x146a74){var _0x1b6b2c=_0x4065df[_0x48af('0x4b')][_0x48af('0x4c')]({'plain':!![]});if(!_0x1b6b2c)throw new Error(_0x48af('0x4d'));if(_0x1b6b2c[_0x48af('0x4e')]===_0x48af('0x4b')){var _0x3dc3b0=_0x146a74['get']({'plain':!![]});var _0x1471a4=_0x48af('0x24');return db[_0x48af('0x4f')][_0x48af('0x49')]({'where':{'name':_0x1471a4,'userProfileId':_0x1b6b2c[_0x48af('0x50')]},'raw':!![]})[_0x48af('0x23')](function(_0x20a58d){if(_0x20a58d&&_0x20a58d[_0x48af('0x51')]===0x0){return db[_0x48af('0x52')][_0x48af('0x4a')]({'name':_0x3dc3b0['name'],'resourceId':_0x3dc3b0['id'],'type':_0x20a58d[_0x48af('0x28')],'sectionId':_0x20a58d['id']},{})['then'](function(){return _0x146a74;});}else{return _0x146a74;}})['catch'](function(_0x46ca28){logger['error'](_0x48af('0x53'),_0x46ca28);throw _0x46ca28;});}return _0x146a74;})['then'](respondWithResult(_0x15eece,0xc9))[_0x48af('0x43')](handleError(_0x15eece,null));};exports['update']=function(_0x2f077e,_0x549bbd){if(_0x2f077e[_0x48af('0x54')]['id']){delete _0x2f077e[_0x48af('0x54')]['id'];}return db['CmHopperAdditionalPhone'][_0x48af('0x49')]({'where':{'id':_0x2f077e[_0x48af('0x45')]['id']}})['then'](handleEntityNotFound(_0x549bbd,null))[_0x48af('0x23')](saveUpdates(_0x2f077e['body'],null))[_0x48af('0x23')](respondWithResult(_0x549bbd,null))[_0x48af('0x43')](handleError(_0x549bbd,null));};exports[_0x48af('0x25')]=function(_0x5a7be0,_0x3df90d){return db[_0x48af('0x2c')][_0x48af('0x49')]({'where':{'id':_0x5a7be0[_0x48af('0x45')]['id']}})[_0x48af('0x23')](handleEntityNotFound(_0x3df90d,null))['then'](removeEntity(_0x3df90d,null))[_0x48af('0x43')](handleError(_0x3df90d,null));}; \ No newline at end of file +var _0x1730=['error','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x1730,0x1b0));var _0x0173=function(_0x12c1bd,_0x506035){_0x12c1bd=_0x12c1bd-0x0;var _0x2f6e16=_0x1730[_0x12c1bd];return _0x2f6e16;};'use strict';var pdf=require(_0x0173('0x0'));var emlformat=require(_0x0173('0x1'));var rimraf=require(_0x0173('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0173('0x3'));var moment=require(_0x0173('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0173('0x5'));var path=require(_0x0173('0x6'));var sox=require(_0x0173('0x7'));var csv=require(_0x0173('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0173('0x9'));var squel=require(_0x0173('0xa'));var crypto=require(_0x0173('0xb'));var jsforce=require(_0x0173('0xc'));var deskjs=require(_0x0173('0xd'));var toCsv=require(_0x0173('0x8'));var querystring=require(_0x0173('0xe'));var Papa=require(_0x0173('0xf'));var Redis=require(_0x0173('0x10'));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(_0x0173('0x11'))(_0x0173('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0173('0x13'))['db'];function respondWithStatusCode(_0x2a9945,_0x1bbaaf){_0x1bbaaf=_0x1bbaaf||0xcc;return function(_0x546de6){if(_0x546de6){return _0x2a9945[_0x0173('0x14')](_0x1bbaaf);}return _0x2a9945[_0x0173('0x15')](_0x1bbaaf)[_0x0173('0x16')]();};}function respondWithResult(_0x3d8d58,_0x394010){_0x394010=_0x394010||0xc8;return function(_0x2946f5){if(_0x2946f5){return _0x3d8d58[_0x0173('0x15')](_0x394010)[_0x0173('0x17')](_0x2946f5);}};}function respondWithFilteredResult(_0x47c788,_0x1a83b1){return function(_0x36eb17){if(_0x36eb17){var _0x299148=_0x36eb17[_0x0173('0x18')],_0x4ecd04=_0x1a83b1['offset'],_0x3a8103=_0x1a83b1[_0x0173('0x19')]+_0x1a83b1[_0x0173('0x1a')],_0x2b849d;if(_0x3a8103>=_0x299148){_0x3a8103=_0x299148;_0x2b849d=0xc8;}else{_0x2b849d=0xce;}_0x47c788[_0x0173('0x15')](_0x2b849d);return _0x47c788[_0x0173('0x1b')]('Content-Range',_0x4ecd04+'-'+_0x3a8103+'/'+_0x299148)['json'](_0x36eb17);}return null;};}function patchUpdates(_0xfb035b){return function(_0x1b882b){try{jsonpatch[_0x0173('0x1c')](_0x1b882b,_0xfb035b,!![]);}catch(_0x2882d9){return BPromise[_0x0173('0x1d')](_0x2882d9);}return _0x1b882b['save']();};}function saveUpdates(_0x142807,_0x2acf78){return function(_0x114bd0){if(_0x114bd0){return _0x114bd0[_0x0173('0x1e')](_0x142807)['then'](function(_0x553feb){return _0x553feb;});}return null;};}function removeEntity(_0x1a46bf,_0x13864d){return function(_0x5c2871){if(_0x5c2871){return _0x5c2871[_0x0173('0x1f')]()[_0x0173('0x20')](function(){var _0x5a798f=_0x5c2871[_0x0173('0x21')]({'plain':!![]});var _0x4ca754=_0x0173('0x22');return db[_0x0173('0x23')][_0x0173('0x1f')]({'where':{'type':_0x4ca754,'resourceId':_0x5a798f['id']}})[_0x0173('0x20')](function(){return _0x5c2871;});})[_0x0173('0x20')](function(){_0x1a46bf[_0x0173('0x15')](0xcc)[_0x0173('0x16')]();});}};}function handleEntityNotFound(_0x2f57e2,_0x4475b9){return function(_0x49d1f4){if(!_0x49d1f4){_0x2f57e2['sendStatus'](0x194);}return _0x49d1f4;};}function handleError(_0x11e584,_0x12a7a7){_0x12a7a7=_0x12a7a7||0x1f4;return function(_0x3c363f){logger[_0x0173('0x24')](_0x3c363f['stack']);if(_0x3c363f[_0x0173('0x25')]){delete _0x3c363f[_0x0173('0x25')];}_0x11e584[_0x0173('0x15')](_0x12a7a7)[_0x0173('0x26')](_0x3c363f);};}exports[_0x0173('0x27')]=function(_0x38f337,_0x1c478c){var _0x2aadaa={},_0x830f22={},_0x2a6816={'count':0x0,'rows':[]};var _0x5d505c=_[_0x0173('0x28')](db[_0x0173('0x29')][_0x0173('0x2a')],function(_0x59228a){return{'name':_0x59228a[_0x0173('0x2b')],'type':_0x59228a['type'][_0x0173('0x2c')]};});_0x830f22[_0x0173('0x2d')]=_[_0x0173('0x28')](_0x5d505c,_0x0173('0x25'));_0x830f22['query']=_[_0x0173('0x2e')](_0x38f337[_0x0173('0x2f')]);_0x830f22[_0x0173('0x30')]=_[_0x0173('0x31')](_0x830f22[_0x0173('0x2d')],_0x830f22['query']);_0x2aadaa['attributes']=_[_0x0173('0x31')](_0x830f22[_0x0173('0x2d')],qs['fields'](_0x38f337[_0x0173('0x2f')][_0x0173('0x32')]));_0x2aadaa['attributes']=_0x2aadaa[_0x0173('0x33')][_0x0173('0x34')]?_0x2aadaa['attributes']:_0x830f22['model'];if(!_0x38f337[_0x0173('0x2f')][_0x0173('0x35')](_0x0173('0x36'))){_0x2aadaa[_0x0173('0x1a')]=qs['limit'](_0x38f337['query'][_0x0173('0x1a')]);_0x2aadaa[_0x0173('0x19')]=qs[_0x0173('0x19')](_0x38f337[_0x0173('0x2f')][_0x0173('0x19')]);}_0x2aadaa[_0x0173('0x37')]=qs[_0x0173('0x38')](_0x38f337[_0x0173('0x2f')]['sort']);_0x2aadaa['where']=qs[_0x0173('0x30')](_[_0x0173('0x39')](_0x38f337[_0x0173('0x2f')],_0x830f22[_0x0173('0x30')]),_0x5d505c);if(_0x38f337[_0x0173('0x2f')][_0x0173('0x3a')]){_0x2aadaa[_0x0173('0x3b')]=_[_0x0173('0x3c')](_0x2aadaa[_0x0173('0x3b')],{'$or':_[_0x0173('0x28')](_0x5d505c,function(_0x1cdb5d){if(_0x1cdb5d[_0x0173('0x3d')]!==_0x0173('0x3e')){var _0x36eb79={};_0x36eb79[_0x1cdb5d[_0x0173('0x25')]]={'$like':'%'+_0x38f337[_0x0173('0x2f')]['filter']+'%'};return _0x36eb79;}})});}_0x2aadaa=_[_0x0173('0x3c')]({},_0x2aadaa,_0x38f337[_0x0173('0x3f')]);var _0x21d0bc={'where':_0x2aadaa[_0x0173('0x3b')]};return db[_0x0173('0x29')][_0x0173('0x18')](_0x21d0bc)['then'](function(_0x61793){_0x2a6816[_0x0173('0x18')]=_0x61793;if(_0x38f337['query'][_0x0173('0x40')]){_0x2aadaa[_0x0173('0x41')]=[{'all':!![]}];}return db[_0x0173('0x29')][_0x0173('0x42')](_0x2aadaa);})[_0x0173('0x20')](function(_0x49abc8){_0x2a6816[_0x0173('0x43')]=_0x49abc8;return _0x2a6816;})[_0x0173('0x20')](respondWithFilteredResult(_0x1c478c,_0x2aadaa))[_0x0173('0x44')](handleError(_0x1c478c,null));};exports[_0x0173('0x45')]=function(_0x3b07a6,_0x576d99){var _0x3eb5d4={'raw':!![],'where':{'id':_0x3b07a6['params']['id']}},_0x5ba326={};_0x5ba326[_0x0173('0x2d')]=_['keys'](db[_0x0173('0x29')]['rawAttributes']);_0x5ba326['query']=_['keys'](_0x3b07a6[_0x0173('0x2f')]);_0x5ba326[_0x0173('0x30')]=_[_0x0173('0x31')](_0x5ba326[_0x0173('0x2d')],_0x5ba326[_0x0173('0x2f')]);_0x3eb5d4[_0x0173('0x33')]=_[_0x0173('0x31')](_0x5ba326[_0x0173('0x2d')],qs['fields'](_0x3b07a6['query'][_0x0173('0x32')]));_0x3eb5d4[_0x0173('0x33')]=_0x3eb5d4[_0x0173('0x33')]['length']?_0x3eb5d4[_0x0173('0x33')]:_0x5ba326[_0x0173('0x2d')];if(_0x3b07a6[_0x0173('0x2f')][_0x0173('0x40')]){_0x3eb5d4['include']=[{'all':!![]}];}_0x3eb5d4=_['merge']({},_0x3eb5d4,_0x3b07a6[_0x0173('0x3f')]);return db[_0x0173('0x29')][_0x0173('0x46')](_0x3eb5d4)[_0x0173('0x20')](handleEntityNotFound(_0x576d99,null))[_0x0173('0x20')](respondWithResult(_0x576d99,null))[_0x0173('0x44')](handleError(_0x576d99,null));};exports[_0x0173('0x47')]=function(_0x33e587,_0x4fea06){return db[_0x0173('0x29')][_0x0173('0x47')](_0x33e587['body'],{})[_0x0173('0x20')](function(_0xdd3dca){var _0x234f64=_0x33e587[_0x0173('0x48')][_0x0173('0x21')]({'plain':!![]});if(!_0x234f64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x234f64['role']===_0x0173('0x48')){var _0x53af5d=_0xdd3dca['get']({'plain':!![]});var _0x19dca6=_0x0173('0x22');return db[_0x0173('0x49')]['find']({'where':{'name':_0x19dca6,'userProfileId':_0x234f64['userProfileId']},'raw':!![]})[_0x0173('0x20')](function(_0x31b471){if(_0x31b471&&_0x31b471[_0x0173('0x4a')]===0x0){return db['UserProfileResource'][_0x0173('0x47')]({'name':_0x53af5d[_0x0173('0x25')],'resourceId':_0x53af5d['id'],'type':_0x31b471[_0x0173('0x25')],'sectionId':_0x31b471['id']},{})[_0x0173('0x20')](function(){return _0xdd3dca;});}else{return _0xdd3dca;}})[_0x0173('0x44')](function(_0x4af1ce){logger['error'](_0x0173('0x4b'),_0x4af1ce);throw _0x4af1ce;});}return _0xdd3dca;})['then'](respondWithResult(_0x4fea06,0xc9))['catch'](handleError(_0x4fea06,null));};exports[_0x0173('0x1e')]=function(_0x125f16,_0x494b57){if(_0x125f16[_0x0173('0x4c')]['id']){delete _0x125f16[_0x0173('0x4c')]['id'];}return db[_0x0173('0x29')][_0x0173('0x46')]({'where':{'id':_0x125f16[_0x0173('0x4d')]['id']}})['then'](handleEntityNotFound(_0x494b57,null))[_0x0173('0x20')](saveUpdates(_0x125f16[_0x0173('0x4c')],null))[_0x0173('0x20')](respondWithResult(_0x494b57,null))['catch'](handleError(_0x494b57,null));};exports[_0x0173('0x1f')]=function(_0x55033b,_0x2729aa){return db[_0x0173('0x29')][_0x0173('0x46')]({'where':{'id':_0x55033b['params']['id']}})[_0x0173('0x20')](handleEntityNotFound(_0x2729aa,null))[_0x0173('0x20')](removeEntity(_0x2729aa,null))[_0x0173('0x44')](handleError(_0x2729aa,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f3e063e..c858f42 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 _0x400d=['define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x4acb7a,_0x31c109){var _0x385fa5=function(_0x929870){while(--_0x929870){_0x4acb7a['push'](_0x4acb7a['shift']());}};_0x385fa5(++_0x31c109);}(_0x400d,0x184));var _0xd400=function(_0x19bf9c,_0xa5ef2){_0x19bf9c=_0x19bf9c-0x0;var _0x2fd6a6=_0x400d[_0x19bf9c];return _0x2fd6a6;};'use strict';var _=require(_0xd400('0x0'));var util=require('util');var logger=require(_0xd400('0x1'))(_0xd400('0x2'));var moment=require(_0xd400('0x3'));var BPromise=require('bluebird');var rp=require(_0xd400('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd400('0x5'));var config=require(_0xd400('0x6'));var attributes=require(_0xd400('0x7'));module['exports']=function(_0x24af88,_0x2251ec){return _0x24af88[_0xd400('0x8')](_0xd400('0x9'),attributes,{'tableName':_0xd400('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f9f=['define','CmHopperAdditionalPhone','../../config/logger','api','bluebird','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x4d08d8,_0x30ae54){var _0x33e8db=function(_0x292904){while(--_0x292904){_0x4d08d8['push'](_0x4d08d8['shift']());}};_0x33e8db(++_0x30ae54);}(_0x9f9f,0x92));var _0xf9f9=function(_0x19b9e3,_0x4b2f2f){_0x19b9e3=_0x19b9e3-0x0;var _0x4d8b8d=_0x9f9f[_0x19b9e3];return _0x4d8b8d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf9f9('0x0'))(_0xf9f9('0x1'));var moment=require('moment');var BPromise=require(_0xf9f9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf9f9('0x3'));var config=require(_0xf9f9('0x4'));var attributes=require(_0xf9f9('0x5'));module['exports']=function(_0x43b0d0,_0x4fcedd){return _0x43b0d0[_0xf9f9('0x6')](_0xf9f9('0x7'),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 5a016db..9a1d487 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 _0x20f2=['CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','ASC','countcongestionretry','VerifyAdditionalPhones','SwapAdditionalPhones','ContactId','duration','waitTime','scheduledat','add','minutes','phone','isNil','createdAt','updatedAt','hopperToAdd','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20f2,0x9c));var _0x220f=function(_0x11b9b5,_0x2a35e7){_0x11b9b5=_0x11b9b5-0x0;var _0x41ebcd=_0x20f2[_0x11b9b5];return _0x41ebcd;};'use strict';var _=require(_0x220f('0x0'));var util=require(_0x220f('0x1'));var moment=require(_0x220f('0x2'));var BPromise=require('bluebird');var rs=require(_0x220f('0x3'));var fs=require('fs');var Redis=require(_0x220f('0x4'));var db=require(_0x220f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x220f('0x6'))('rpc');var config=require(_0x220f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x220f('0x8')][_0x220f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26799,_0x8a4b81,_0x45badc){return new BPromise(function(_0x5061a4,_0xf2fb87){return client['request'](_0x26799,_0x45badc)[_0x220f('0xa')](function(_0x53f76e){logger[_0x220f('0xb')](_0x220f('0xc'),_0x8a4b81,_0x220f('0xd'));logger[_0x220f('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x8a4b81,_0x220f('0xd'),JSON[_0x220f('0xf')](_0x53f76e));if(_0x53f76e[_0x220f('0x10')]){if(_0x53f76e[_0x220f('0x10')][_0x220f('0x11')]===0x1f4){logger[_0x220f('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x8a4b81,_0x53f76e['error'][_0x220f('0x12')]);return _0xf2fb87(_0x53f76e[_0x220f('0x10')][_0x220f('0x12')]);}logger[_0x220f('0x10')](_0x220f('0xc'),_0x8a4b81,_0x53f76e[_0x220f('0x10')][_0x220f('0x12')]);return _0x5061a4(_0x53f76e['error'][_0x220f('0x12')]);}else{logger['info'](_0x220f('0xc'),_0x8a4b81,_0x220f('0xd'));_0x5061a4(_0x53f76e[_0x220f('0x13')][_0x220f('0x12')]);}})[_0x220f('0x14')](function(_0x15652f){logger[_0x220f('0x10')](_0x220f('0xc'),_0x8a4b81,_0x15652f);_0xf2fb87(_0x15652f);});});}exports['VerifyAdditionalPhones']=function(_0x19ac7e){var _0x5d967c=this;return new Promise(function(_0x13e19c,_0x137d6d){return db[_0x220f('0x15')][_0x220f('0x16')]({'raw':!![],'where':{'ContactId':_0x19ac7e[_0x220f('0x17')]['ContactId'],'ListId':_0x19ac7e['body'][_0x220f('0x18')],'VoiceQueueId':_0x19ac7e[_0x220f('0x17')][_0x220f('0x19')]===undefined?null:_0x19ac7e[_0x220f('0x17')]['VoiceQueueId'],'CampaignId':_0x19ac7e[_0x220f('0x17')][_0x220f('0x1a')]===undefined?null:_0x19ac7e[_0x220f('0x17')][_0x220f('0x1a')]}})[_0x220f('0xa')](function(_0x30e9c8){if(_0x30e9c8!=null){return db[_0x220f('0x1b')][_0x220f('0x16')]({'raw':!![],'where':{'CmHopperId':_0x30e9c8['id'],'OrderBy':{'$gt':_0x30e9c8[_0x220f('0x1c')]}},'order':[['OrderBy','ASC']]})[_0x220f('0xa')](function(_0x32e49c){var _0x526823=0x0;if(_0x32e49c){if(_0x32e49c[_0x220f('0x1d')]+_0x32e49c['countcongestionretry']+_0x32e49c[_0x220f('0x1e')]+_0x32e49c[_0x220f('0x1f')]+_0x32e49c[_0x220f('0x20')]+_0x32e49c[_0x220f('0x21')]+_0x32e49c[_0x220f('0x22')]+_0x32e49c[_0x220f('0x23')]<_0x19ac7e[_0x220f('0x24')]['dialGlobalMaxRetry'])_0x526823=0x1;_0x13e19c({'additional':_0x526823});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x30e9c8['id']},'order':[[_0x220f('0x1c'),_0x220f('0x25')]]})[_0x220f('0xa')](function(_0x2815fb){var _0x5aa9e0=0x0;if(_0x2815fb){if(_0x2815fb[_0x220f('0x1d')]+_0x2815fb[_0x220f('0x26')]+_0x2815fb[_0x220f('0x1e')]+_0x2815fb[_0x220f('0x1f')]+_0x2815fb[_0x220f('0x20')]+_0x2815fb[_0x220f('0x21')]+_0x2815fb[_0x220f('0x22')]+_0x2815fb[_0x220f('0x23')]<_0x19ac7e[_0x220f('0x24')]['dialGlobalMaxRetry'])_0x5aa9e0=0x1;_0x13e19c({'additional':_0x5aa9e0});}else{_0x13e19c({'additional':0x0});}})[_0x220f('0x14')](function(_0x1e95c9){logger[_0x220f('0x10')]('VerifyAdditionalPhones',_0x1e95c9[_0x220f('0x12')],_0x19ac7e);_0x137d6d(_0x5d967c[_0x220f('0x10')](0x1f4,_0x1e95c9[_0x220f('0x12')]));});}})[_0x220f('0x14')](function(_0x5b038d){logger[_0x220f('0x10')](_0x220f('0x27'),_0x5b038d[_0x220f('0x12')],_0x19ac7e);_0x137d6d(_0x5d967c['error'](0x1f4,_0x5b038d[_0x220f('0x12')]));});}else _0x13e19c({'additional':0x0});});});};exports[_0x220f('0x28')]=function(_0x3a707d){var _0x1db525=this;return new Promise(function(_0xa62917,_0x5a542d){return db[_0x220f('0x15')][_0x220f('0x16')]({'raw':!![],'where':{'ContactId':_0x3a707d[_0x220f('0x17')][_0x220f('0x29')],'ListId':_0x3a707d[_0x220f('0x17')][_0x220f('0x18')],'VoiceQueueId':_0x3a707d[_0x220f('0x17')][_0x220f('0x19')]===undefined?null:_0x3a707d[_0x220f('0x17')][_0x220f('0x19')],'CampaignId':_0x3a707d[_0x220f('0x17')][_0x220f('0x1a')]===undefined?null:_0x3a707d[_0x220f('0x17')][_0x220f('0x1a')]}})[_0x220f('0xa')](function(_0x275bf3){if(_0x275bf3!=null){return db[_0x220f('0x1b')][_0x220f('0x16')]({'raw':!![],'where':{'CmHopperId':_0x275bf3['id'],'OrderBy':{'$gt':_0x275bf3['OrderBy']}},'order':[['OrderBy','ASC']]})[_0x220f('0xa')](function(_0x40676d){if(_0x40676d)return activateAdditionalPhone(_0x275bf3,_0x3a707d[_0x220f('0x17')],_0x40676d,_0x3a707d[_0x220f('0x2a')],_0x3a707d['waitTime'])[_0x220f('0xa')](function(_0x17030f){_0xa62917(_0x17030f);});else{return db[_0x220f('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x275bf3['id']},'order':[['OrderBy','ASC']]})[_0x220f('0xa')](function(_0x4bdcef){if(_0x4bdcef)return activateAdditionalPhone(_0x275bf3,_0x3a707d[_0x220f('0x17')],_0x4bdcef,_0x3a707d['duration'],_0x3a707d[_0x220f('0x2b')])[_0x220f('0xa')](function(_0x1b81ad){_0xa62917(_0x1b81ad);});else{_0xa62917({'id':_0x275bf3['id'],'phone':''});}})[_0x220f('0x14')](function(_0x318843){logger[_0x220f('0x10')](_0x220f('0x27'),_0x318843[_0x220f('0x12')],_0x3a707d);_0x5a542d(_0x1db525[_0x220f('0x10')](0x1f4,_0x318843[_0x220f('0x12')]));});}})[_0x220f('0x14')](function(_0x1dded8){logger[_0x220f('0x10')]('VerifyAdditionalPhones',_0x1dded8[_0x220f('0x12')],_0x3a707d);_0x5a542d(_0x1db525[_0x220f('0x10')](0x1f4,_0x1dded8['message']));});}else _0xa62917(0x1);});});};function activateAdditionalPhone(_0x22cde8,_0x42d7de,_0x1f9da0,_0x4ab504,_0x26c691){return new Promise(function(_0x5758bf,_0x47274b){logger[_0x220f('0xb')]('VerifyAdditionalPhones',_0x1f9da0);var _0x4f24aa;if(moment()>moment(_0x1f9da0[_0x220f('0x2c')])){_0x4f24aa=moment()[_0x220f('0x2d')](_0x26c691||0x3,_0x220f('0x2e'));}else{if(_0x1f9da0[_0x220f('0x1c')]==0x0){_0x4f24aa=moment(_0x1f9da0['scheduledat']);}else{_0x4f24aa=moment()['add'](_0x26c691||0x3,_0x220f('0x2e'));}}var _0x47672d={'phone':_0x22cde8[_0x220f('0x2f')],'active':0x0,'OrderBy':_[_0x220f('0x30')](_0x22cde8['OrderBy'])?0x0:_0x22cde8[_0x220f('0x1c')],'scheduledat':moment()[_0x220f('0x2d')](_0x4ab504||0x1,'minutes'),'countbusyretry':_0x42d7de['countbusyretry'],'countcongestionretry':_0x42d7de[_0x220f('0x26')],'countnoanswerretry':_0x42d7de['countnoanswerretry'],'countnosuchnumberretry':_0x42d7de[_0x220f('0x1f')],'countdropretry':_0x42d7de[_0x220f('0x20')],'countabandonedretry':_0x42d7de['countabandonedretry'],'countmachineretry':_0x42d7de[_0x220f('0x22')],'countagentrejectretry':_0x42d7de[_0x220f('0x23')],'createdAt':_0x42d7de[_0x220f('0x31')],'updatedAt':_0x42d7de['updatedAt']};var _0x297d27={'CmHopperId':_0x22cde8['id'],'phone':_0x1f9da0[_0x220f('0x2f')],'active':0x0,'OrderBy':_[_0x220f('0x30')](_0x1f9da0[_0x220f('0x1c')])?0x0:_0x1f9da0[_0x220f('0x1c')],'scheduledat':_0x4f24aa,'countbusyretry':_0x1f9da0[_0x220f('0x1d')],'countcongestionretry':_0x1f9da0[_0x220f('0x26')],'countnoanswerretry':_0x1f9da0[_0x220f('0x1e')],'countnosuchnumberretry':_0x42d7de[_0x220f('0x1f')],'countdropretry':_0x42d7de[_0x220f('0x20')],'countabandonedretry':_0x42d7de[_0x220f('0x21')],'countmachineretry':_0x42d7de['countmachineretry'],'countagentrejectretry':_0x42d7de['countagentrejectretry'],'createdAt':_0x1f9da0[_0x220f('0x31')],'updatedAt':_0x1f9da0[_0x220f('0x32')]};logger[_0x220f('0xb')](_0x220f('0x33'),_0x47672d);logger[_0x220f('0xb')]('additionalToHop',_0x297d27);return db['sequelize'][_0x220f('0x34')](function(_0x5e6f63){return db[_0x220f('0x1b')][_0x220f('0x35')](_0x47672d,{'where':{'id':_0x1f9da0['id']}},{'transaction':_0x5e6f63})[_0x220f('0xa')](function(){return db[_0x220f('0x15')][_0x220f('0x35')](_0x297d27,{'where':{'id':_0x22cde8['id']}},{'transaction':_0x5e6f63});});})[_0x220f('0xa')](function(_0x3c4e5e){_0x5758bf({'id':_0x22cde8['id'],'phone':_0x1f9da0[_0x220f('0x2f')]});})[_0x220f('0x14')](function(_0xf85c95){logger[_0x220f('0x10')](_0x220f('0x27'),_0xf85c95['message'],req);_0x47274b(_this['error'](0x1f4,_0xf85c95['message']));});});}exports[_0x220f('0x36')]=function(_0x332cc6){var _0x8f45ba=this;return new Promise(function(_0x4ab917,_0x33f02c){return db['CmHopper'][_0x220f('0x35')](_0x332cc6['body'][_0x220f('0x37')],{'where':{'id':_0x332cc6['body']['id']}})[_0x220f('0xa')](function(_0xe4828b){_0x4ab917(_0xe4828b);})['catch'](function(_0x98145a){logger[_0x220f('0x10')](_0x220f('0x36'),_0x98145a[_0x220f('0x12')],_0x332cc6);_0x33f02c(_0x8f45ba[_0x220f('0x10')](0x1f4,_0x98145a[_0x220f('0x12')]));});});}; \ No newline at end of file +var _0x340f=['stringify','error','code','message','result','catch','VerifyAdditionalPhones','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','then','countbusyretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','entity','ASC','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','ContactId','waitTime','duration','scheduledat','add','minutes','phone','countcongestionretry','createdAt','updatedAt','isNil','hopperToAdd','additionalToHop','sequelize','transaction','update','CmHopper','field','IncrementPreviewCounters','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s'];(function(_0x166658,_0x4f8c11){var _0x2d4711=function(_0x31f7e5){while(--_0x31f7e5){_0x166658['push'](_0x166658['shift']());}};_0x2d4711(++_0x4f8c11);}(_0x340f,0x194));var _0xf340=function(_0xbb8f7a,_0x121227){_0xbb8f7a=_0xbb8f7a-0x0;var _0x2f845e=_0x340f[_0xbb8f7a];return _0x2f845e;};'use strict';var _=require(_0xf340('0x0'));var util=require('util');var moment=require(_0xf340('0x1'));var BPromise=require('bluebird');var rs=require(_0xf340('0x2'));var fs=require('fs');var Redis=require(_0xf340('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf340('0x4'))(_0xf340('0x5'));var config=require(_0xf340('0x6'));var jayson=require(_0xf340('0x7'));var client=jayson[_0xf340('0x8')][_0xf340('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x334b5c,_0x407cc4,_0x1941ac){return new BPromise(function(_0x4ed288,_0x4cf5c7){return client[_0xf340('0xa')](_0x334b5c,_0x1941ac)['then'](function(_0xc4dee3){logger[_0xf340('0xb')](_0xf340('0xc'),_0x407cc4,_0xf340('0xd'));logger[_0xf340('0xe')](_0xf340('0xf'),_0x407cc4,_0xf340('0xd'),JSON[_0xf340('0x10')](_0xc4dee3));if(_0xc4dee3['error']){if(_0xc4dee3[_0xf340('0x11')][_0xf340('0x12')]===0x1f4){logger['error'](_0xf340('0xc'),_0x407cc4,_0xc4dee3[_0xf340('0x11')][_0xf340('0x13')]);return _0x4cf5c7(_0xc4dee3[_0xf340('0x11')][_0xf340('0x13')]);}logger[_0xf340('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x407cc4,_0xc4dee3['error'][_0xf340('0x13')]);return _0x4ed288(_0xc4dee3[_0xf340('0x11')][_0xf340('0x13')]);}else{logger[_0xf340('0xb')](_0xf340('0xc'),_0x407cc4,'request\x20sent');_0x4ed288(_0xc4dee3[_0xf340('0x14')][_0xf340('0x13')]);}})[_0xf340('0x15')](function(_0x4d5f15){logger[_0xf340('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x407cc4,_0x4d5f15);_0x4cf5c7(_0x4d5f15);});});}exports[_0xf340('0x16')]=function(_0x2780b1){var _0x16c131=this;return new Promise(function(_0x316820,_0x4ce5d4){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x2780b1[_0xf340('0x17')]['ContactId'],'ListId':_0x2780b1[_0xf340('0x17')][_0xf340('0x18')],'VoiceQueueId':_0x2780b1[_0xf340('0x17')][_0xf340('0x19')]===undefined?null:_0x2780b1[_0xf340('0x17')]['VoiceQueueId'],'CampaignId':_0x2780b1[_0xf340('0x17')][_0xf340('0x1a')]===undefined?null:_0x2780b1[_0xf340('0x17')]['CampaignId']}})['then'](function(_0xb8393f){if(_0xb8393f!=null){return db[_0xf340('0x1b')][_0xf340('0x1c')]({'raw':!![],'where':{'CmHopperId':_0xb8393f['id'],'OrderBy':{'$gt':_0xb8393f[_0xf340('0x1d')]}},'order':[['OrderBy','ASC']]})[_0xf340('0x1e')](function(_0x5628e8){var _0x2adb73=0x0;if(_0x5628e8){if(_0x5628e8[_0xf340('0x1f')]+_0x5628e8['countcongestionretry']+_0x5628e8[_0xf340('0x20')]+_0x5628e8[_0xf340('0x21')]+_0x5628e8['countdropretry']+_0x5628e8['countabandonedretry']+_0x5628e8[_0xf340('0x22')]+_0x5628e8['countagentrejectretry']<_0x2780b1[_0xf340('0x23')]['dialGlobalMaxRetry'])_0x2adb73=0x1;_0x316820({'additional':_0x2adb73});}else{return db['CmHopperAdditionalPhone'][_0xf340('0x1c')]({'raw':!![],'where':{'CmHopperId':_0xb8393f['id']},'order':[[_0xf340('0x1d'),_0xf340('0x24')]]})[_0xf340('0x1e')](function(_0x4eb0d9){var _0x6025e1=0x0;if(_0x4eb0d9){if(_0x4eb0d9[_0xf340('0x1f')]+_0x4eb0d9['countcongestionretry']+_0x4eb0d9[_0xf340('0x20')]+_0x4eb0d9[_0xf340('0x21')]+_0x4eb0d9[_0xf340('0x25')]+_0x4eb0d9[_0xf340('0x26')]+_0x4eb0d9[_0xf340('0x22')]+_0x4eb0d9[_0xf340('0x27')]<_0x2780b1[_0xf340('0x23')][_0xf340('0x28')])_0x6025e1=0x1;_0x316820({'additional':_0x6025e1});}else{_0x316820({'additional':0x0});}})[_0xf340('0x15')](function(_0x125a4f){logger[_0xf340('0x11')]('VerifyAdditionalPhones',_0x125a4f[_0xf340('0x13')],_0x2780b1);_0x4ce5d4(_0x16c131[_0xf340('0x11')](0x1f4,_0x125a4f[_0xf340('0x13')]));});}})[_0xf340('0x15')](function(_0x40ef9a){logger[_0xf340('0x11')](_0xf340('0x16'),_0x40ef9a['message'],_0x2780b1);_0x4ce5d4(_0x16c131[_0xf340('0x11')](0x1f4,_0x40ef9a[_0xf340('0x13')]));});}else _0x316820({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x3a2bd3){var _0x30a857=this;return new Promise(function(_0x285dff,_0x4492e1){return db['CmHopper'][_0xf340('0x1c')]({'raw':!![],'where':{'ContactId':_0x3a2bd3[_0xf340('0x17')][_0xf340('0x29')],'ListId':_0x3a2bd3[_0xf340('0x17')][_0xf340('0x18')],'VoiceQueueId':_0x3a2bd3[_0xf340('0x17')][_0xf340('0x19')]===undefined?null:_0x3a2bd3[_0xf340('0x17')]['VoiceQueueId'],'CampaignId':_0x3a2bd3['body'][_0xf340('0x1a')]===undefined?null:_0x3a2bd3['body'][_0xf340('0x1a')]}})[_0xf340('0x1e')](function(_0x328e48){if(_0x328e48!=null){return db[_0xf340('0x1b')][_0xf340('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x328e48['id'],'OrderBy':{'$gt':_0x328e48[_0xf340('0x1d')]}},'order':[[_0xf340('0x1d'),_0xf340('0x24')]]})[_0xf340('0x1e')](function(_0x521139){if(_0x521139)return activateAdditionalPhone(_0x328e48,_0x3a2bd3[_0xf340('0x17')],_0x521139,_0x3a2bd3['duration'],_0x3a2bd3[_0xf340('0x2a')])[_0xf340('0x1e')](function(_0x56f16b){_0x285dff(_0x56f16b);});else{return db[_0xf340('0x1b')][_0xf340('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x328e48['id']},'order':[[_0xf340('0x1d'),_0xf340('0x24')]]})[_0xf340('0x1e')](function(_0x1007ce){if(_0x1007ce)return activateAdditionalPhone(_0x328e48,_0x3a2bd3[_0xf340('0x17')],_0x1007ce,_0x3a2bd3[_0xf340('0x2b')],_0x3a2bd3[_0xf340('0x2a')])[_0xf340('0x1e')](function(_0xbe40a6){_0x285dff(_0xbe40a6);});else{_0x285dff({'id':_0x328e48['id'],'phone':''});}})[_0xf340('0x15')](function(_0x4febdf){logger['error'](_0xf340('0x16'),_0x4febdf[_0xf340('0x13')],_0x3a2bd3);_0x4492e1(_0x30a857['error'](0x1f4,_0x4febdf[_0xf340('0x13')]));});}})[_0xf340('0x15')](function(_0x24ba52){logger[_0xf340('0x11')]('VerifyAdditionalPhones',_0x24ba52[_0xf340('0x13')],_0x3a2bd3);_0x4492e1(_0x30a857[_0xf340('0x11')](0x1f4,_0x24ba52[_0xf340('0x13')]));});}else _0x285dff(0x1);});});};function activateAdditionalPhone(_0x53505d,_0x398ac0,_0x12c9e3,_0x3ca323,_0xf3bb15){return new Promise(function(_0x20f3b5,_0x236f73){logger['info'](_0xf340('0x16'),_0x12c9e3);var _0x4957f2;if(moment()>moment(_0x12c9e3[_0xf340('0x2c')])){_0x4957f2=moment()[_0xf340('0x2d')](_0xf3bb15||0x3,_0xf340('0x2e'));}else{if(_0x12c9e3[_0xf340('0x1d')]==0x0){_0x4957f2=moment(_0x12c9e3[_0xf340('0x2c')]);}else{_0x4957f2=moment()[_0xf340('0x2d')](_0xf3bb15||0x3,'minutes');}}var _0x5f4f5b={'phone':_0x53505d[_0xf340('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x53505d[_0xf340('0x1d')])?0x0:_0x53505d[_0xf340('0x1d')],'scheduledat':moment()[_0xf340('0x2d')](_0x3ca323||0x1,'minutes'),'countbusyretry':_0x398ac0[_0xf340('0x1f')],'countcongestionretry':_0x398ac0[_0xf340('0x30')],'countnoanswerretry':_0x398ac0[_0xf340('0x20')],'countnosuchnumberretry':_0x398ac0[_0xf340('0x21')],'countdropretry':_0x398ac0[_0xf340('0x25')],'countabandonedretry':_0x398ac0[_0xf340('0x26')],'countmachineretry':_0x398ac0['countmachineretry'],'countagentrejectretry':_0x398ac0[_0xf340('0x27')],'createdAt':_0x398ac0[_0xf340('0x31')],'updatedAt':_0x398ac0[_0xf340('0x32')]};var _0x2929b3={'CmHopperId':_0x53505d['id'],'phone':_0x12c9e3['phone'],'active':0x0,'OrderBy':_[_0xf340('0x33')](_0x12c9e3['OrderBy'])?0x0:_0x12c9e3[_0xf340('0x1d')],'scheduledat':_0x4957f2,'countbusyretry':_0x12c9e3[_0xf340('0x1f')],'countcongestionretry':_0x12c9e3[_0xf340('0x30')],'countnoanswerretry':_0x12c9e3[_0xf340('0x20')],'countnosuchnumberretry':_0x398ac0[_0xf340('0x21')],'countdropretry':_0x398ac0[_0xf340('0x25')],'countabandonedretry':_0x398ac0[_0xf340('0x26')],'countmachineretry':_0x398ac0[_0xf340('0x22')],'countagentrejectretry':_0x398ac0['countagentrejectretry'],'createdAt':_0x12c9e3[_0xf340('0x31')],'updatedAt':_0x12c9e3[_0xf340('0x32')]};logger[_0xf340('0xb')](_0xf340('0x34'),_0x5f4f5b);logger[_0xf340('0xb')](_0xf340('0x35'),_0x2929b3);return db[_0xf340('0x36')][_0xf340('0x37')](function(_0x17f236){return db[_0xf340('0x1b')][_0xf340('0x38')](_0x5f4f5b,{'where':{'id':_0x12c9e3['id']}},{'transaction':_0x17f236})[_0xf340('0x1e')](function(){return db[_0xf340('0x39')][_0xf340('0x38')](_0x2929b3,{'where':{'id':_0x53505d['id']}},{'transaction':_0x17f236});});})[_0xf340('0x1e')](function(_0x376bee){_0x20f3b5({'id':_0x53505d['id'],'phone':_0x12c9e3['phone']});})[_0xf340('0x15')](function(_0x2b9d8e){logger[_0xf340('0x11')]('VerifyAdditionalPhones',_0x2b9d8e[_0xf340('0x13')],req);_0x236f73(_this[_0xf340('0x11')](0x1f4,_0x2b9d8e[_0xf340('0x13')]));});});}exports['IncrementPreviewCounters']=function(_0x57ec33){var _0x11c8cf=this;return new Promise(function(_0x5c8d5f,_0xa11a7a){return db[_0xf340('0x39')][_0xf340('0x38')](_0x57ec33[_0xf340('0x17')][_0xf340('0x3a')],{'where':{'id':_0x57ec33['body']['id']}})['then'](function(_0x2de5a9){_0x5c8d5f(_0x2de5a9);})[_0xf340('0x15')](function(_0x13efdf){logger[_0xf340('0x11')](_0xf340('0x3b'),_0x13efdf[_0xf340('0x13')],_0x57ec33);_0xa11a7a(_0x11c8cf[_0xf340('0x11')](0x1f4,_0x13efdf[_0xf340('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b3cde7d..804a2ac 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 _0x02a4=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','put'];(function(_0x1c0134,_0x5528c0){var _0x420558=function(_0x313e7d){while(--_0x313e7d){_0x1c0134['push'](_0x1c0134['shift']());}};_0x420558(++_0x5528c0);}(_0x02a4,0x146));var _0x402a=function(_0x56f781,_0x590d7a){_0x56f781=_0x56f781-0x0;var _0xb708bf=_0x02a4[_0x56f781];return _0xb708bf;};'use strict';var multer=require(_0x402a('0x0'));var util=require(_0x402a('0x1'));var path=require(_0x402a('0x2'));var timeout=require(_0x402a('0x3'));var express=require(_0x402a('0x4'));var router=express[_0x402a('0x5')]();var auth=require(_0x402a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x402a('0x7'));var controller=require(_0x402a('0x8'));router['get']('/',auth[_0x402a('0x9')](),controller[_0x402a('0xa')]);router[_0x402a('0xb')](_0x402a('0xc'),auth[_0x402a('0x9')](),controller[_0x402a('0xd')]);router[_0x402a('0xe')]('/',auth[_0x402a('0x9')](),controller['create']);router[_0x402a('0xf')]('/:id',auth[_0x402a('0x9')](),controller['update']);router[_0x402a('0x10')](_0x402a('0xc'),auth[_0x402a('0x9')](),controller['destroy']);module[_0x402a('0x11')]=router; \ No newline at end of file +var _0x1883=['index','get','show','post','put','/:id','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x93821d,_0x49e4d0){var _0x5a98ef=function(_0x15d0d0){while(--_0x15d0d0){_0x93821d['push'](_0x93821d['shift']());}};_0x5a98ef(++_0x49e4d0);}(_0x1883,0x1e8));var _0x3188=function(_0x1e44ac,_0x34b757){_0x1e44ac=_0x1e44ac-0x0;var _0x454c8f=_0x1883[_0x1e44ac];return _0x454c8f;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3188('0x3')]();var auth=require(_0x3188('0x4'));var interaction=require(_0x3188('0x5'));var config=require(_0x3188('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0x3188('0x7')](),controller[_0x3188('0x8')]);router[_0x3188('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3188('0xa')]);router[_0x3188('0xb')]('/',auth[_0x3188('0x7')](),controller['create']);router[_0x3188('0xc')](_0x3188('0xd'),auth[_0x3188('0x7')](),controller['update']);router[_0x3188('0xe')](_0x3188('0xd'),auth[_0x3188('0x7')](),controller['destroy']);module[_0x3188('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 9ee6c3f..74ffea7 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 _0x0f43=['contactListQueue','moment','sequelize','exports','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0f43,0xf1));var _0x30f4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0f43[_0x413feb];return _0x40ee88;};'use strict';var moment=require(_0x30f4('0x0'));var Sequelize=require(_0x30f4('0x1'));module[_0x30f4('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x30f4('0x3')],'unique':_0x30f4('0x4')},'VoiceQueueId':{'type':Sequelize[_0x30f4('0x3')],'unique':_0x30f4('0x4')}}; \ No newline at end of file +var _0x0d1d=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x409023,_0x2315c4){var _0x23e0e6=function(_0x5b4fae){while(--_0x5b4fae){_0x409023['push'](_0x409023['shift']());}};_0x23e0e6(++_0x2315c4);}(_0x0d1d,0x1c2));var _0xd0d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0d1d[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xd0d1('0x0'));var Sequelize=require(_0xd0d1('0x1'));module[_0xd0d1('0x2')]={'phone':{'type':Sequelize[_0xd0d1('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd0d1('0x4')],'unique':_0xd0d1('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xd0d1('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b336605..9fd5714 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(_0x5cd436,_0x33e380){var _0x1e63af=function(_0x43bee3){while(--_0x43bee3){_0x5cd436['push'](_0x5cd436['shift']());}};_0x1e63af(++_0x33e380);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x188feb,_0x523a2a){var _0x4687a5=function(_0x21bdeb){while(--_0x21bdeb){_0x188feb['push'](_0x188feb['shift']());}};_0x4687a5(++_0x523a2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 513afd4..99aa207 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 _0x70e0=['cm_hopper_black','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes'];(function(_0xe924a5,_0x1bf7f2){var _0x5e464f=function(_0x4fbeb5){while(--_0x4fbeb5){_0xe924a5['push'](_0xe924a5['shift']());}};_0x5e464f(++_0x1bf7f2);}(_0x70e0,0x17b));var _0x070e=function(_0x2536fb,_0xe3f3d0){_0x2536fb=_0x2536fb-0x0;var _0x3994e8=_0x70e0[_0x2536fb];return _0x3994e8;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('CmHopperBlack',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','../../config/logger','api'];(function(_0x2c8d34,_0x3cb468){var _0x4920d9=function(_0x44e2ae){while(--_0x44e2ae){_0x2c8d34['push'](_0x2c8d34['shift']());}};_0x4920d9(++_0x3cb468);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'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 3b510b2..d3d3885 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 _0x8821=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','include','map','model','then','UpdateCmHopperBlack','update','body','limit','debug','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34170b,_0x3b9cd9){var _0x176483=function(_0xe81c94){while(--_0xe81c94){_0x34170b['push'](_0x34170b['shift']());}};_0x176483(++_0x3b9cd9);}(_0x8821,0x115));var _0x1882=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0x8821[_0x400b43];return _0x3c330f;};'use strict';var _=require(_0x1882('0x0'));var util=require('util');var moment=require(_0x1882('0x1'));var BPromise=require(_0x1882('0x2'));var rs=require(_0x1882('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1882('0x4'));var logger=require(_0x1882('0x5'))(_0x1882('0x6'));var config=require(_0x1882('0x7'));var jayson=require(_0x1882('0x8'));var client=jayson[_0x1882('0x9')][_0x1882('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x145495,_0x350bba,_0x51a1bb){return new BPromise(function(_0x1e4e6c,_0x57f52d){return client['request'](_0x145495,_0x51a1bb)['then'](function(_0x407a34){logger[_0x1882('0xb')](_0x1882('0xc'),_0x350bba,_0x1882('0xd'));logger['debug'](_0x1882('0xe'),_0x350bba,'request\x20sent',JSON[_0x1882('0xf')](_0x407a34));if(_0x407a34[_0x1882('0x10')]){if(_0x407a34[_0x1882('0x10')]['code']===0x1f4){logger['error'](_0x1882('0xc'),_0x350bba,_0x407a34[_0x1882('0x10')][_0x1882('0x11')]);return _0x57f52d(_0x407a34[_0x1882('0x10')][_0x1882('0x11')]);}logger[_0x1882('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x350bba,_0x407a34[_0x1882('0x10')][_0x1882('0x11')]);return _0x1e4e6c(_0x407a34['error'][_0x1882('0x11')]);}else{logger[_0x1882('0xb')](_0x1882('0xc'),_0x350bba,_0x1882('0xd'));_0x1e4e6c(_0x407a34['result'][_0x1882('0x11')]);}})[_0x1882('0x12')](function(_0x1c4d9c){logger[_0x1882('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x350bba,_0x1c4d9c);_0x57f52d(_0x1c4d9c);});});}exports[_0x1882('0x13')]=function(_0x59f655){var _0x35c7bf=this;return new Promise(function(_0x15b22f,_0x106da0){return db[_0x1882('0x14')]['findAll']({'raw':_0x59f655[_0x1882('0x15')]?_0x59f655[_0x1882('0x15')][_0x1882('0x16')]===undefined?!![]:![]:!![],'where':_0x59f655[_0x1882('0x15')]?_0x59f655['options'][_0x1882('0x17')]||null:null,'attributes':_0x59f655[_0x1882('0x15')]?_0x59f655['options'][_0x1882('0x18')]||null:null,'limit':_0x59f655[_0x1882('0x15')]?_0x59f655[_0x1882('0x15')]['limit']||null:null,'include':_0x59f655['options']?_0x59f655['options'][_0x1882('0x19')]?_[_0x1882('0x1a')](_0x59f655[_0x1882('0x15')][_0x1882('0x19')],function(_0x105dbd){return{'model':db[_0x105dbd[_0x1882('0x1b')]],'as':_0x105dbd['as'],'attributes':_0x105dbd[_0x1882('0x18')],'include':_0x105dbd[_0x1882('0x19')]?_[_0x1882('0x1a')](_0x105dbd['include'],function(_0x349cde){return{'model':db[_0x349cde[_0x1882('0x1b')]],'as':_0x349cde['as'],'attributes':_0x349cde['attributes'],'include':_0x349cde[_0x1882('0x19')]?_[_0x1882('0x1a')](_0x349cde[_0x1882('0x19')],function(_0x5f574a){return{'model':db[_0x5f574a[_0x1882('0x1b')]],'as':_0x5f574a['as'],'attributes':_0x5f574a[_0x1882('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1882('0x1c')](function(_0x50a58d){logger['info'](_0x1882('0x13'),_0x59f655);logger['debug'](_0x1882('0x13'),_0x59f655,JSON[_0x1882('0xf')](_0x50a58d));_0x15b22f(_0x50a58d);})[_0x1882('0x12')](function(_0x8f7e02){logger[_0x1882('0x10')](_0x1882('0x13'),_0x8f7e02['message'],_0x59f655);_0x106da0(_0x35c7bf[_0x1882('0x10')](0x1f4,_0x8f7e02['message']));});});};exports[_0x1882('0x1d')]=function(_0x2ed195){var _0x2e1ecf=this;return new Promise(function(_0x5c9e0d,_0xe3f84e){return db[_0x1882('0x14')][_0x1882('0x1e')](_0x2ed195[_0x1882('0x1f')],{'raw':_0x2ed195[_0x1882('0x15')]?_0x2ed195[_0x1882('0x15')][_0x1882('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ed195[_0x1882('0x15')]?_0x2ed195['options'][_0x1882('0x17')]||null:null,'attributes':_0x2ed195[_0x1882('0x15')]?_0x2ed195[_0x1882('0x15')][_0x1882('0x18')]||null:null,'limit':_0x2ed195[_0x1882('0x15')]?_0x2ed195[_0x1882('0x15')][_0x1882('0x20')]||null:null})[_0x1882('0x1c')](function(_0x2a522f){logger[_0x1882('0xb')](_0x1882('0x1d'),_0x2ed195);logger[_0x1882('0x21')](_0x1882('0x1d'),_0x2ed195,JSON['stringify'](_0x2a522f));_0x5c9e0d(_0x2a522f);})['catch'](function(_0x33eaab){logger[_0x1882('0x10')](_0x1882('0x1d'),_0x33eaab['message'],_0x2ed195);_0xe3f84e(_0x2e1ecf[_0x1882('0x10')](0x1f4,_0x33eaab[_0x1882('0x11')]));});});};exports[_0x1882('0x22')]=function(_0x24f840){var _0xe7c35b=this;return new Promise(function(_0x1967f5,_0x1998ce){return db[_0x1882('0x14')][_0x1882('0x23')]({'where':_0x24f840[_0x1882('0x15')]?_0x24f840['options'][_0x1882('0x17')]||null:null})[_0x1882('0x1c')](function(_0x4f2dc8){logger['info']('DestroyCmHopperBlack',_0x24f840);logger['debug'](_0x1882('0x22'),_0x24f840,JSON[_0x1882('0xf')](_0x4f2dc8));_0x1967f5(_0x4f2dc8);})['catch'](function(_0xf267b2){logger[_0x1882('0x10')](_0x1882('0x22'),_0xf267b2[_0x1882('0x11')],_0x24f840);_0x1998ce(_0xe7c35b[_0x1882('0x10')](0x1f4,_0xf267b2[_0x1882('0x11')]));});});}; \ No newline at end of file +var _0xb088=['findAll','options','raw','where','attributes','include','model','map','GetCmHopperBlack','debug','catch','UpdateCmHopperBlack','CmHopperBlack','update','limit','DestroyCmHopperBlack','destroy','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb088,0x19d));var _0x8b08=function(_0x1d44d4,_0x8a3f5b){_0x1d44d4=_0x1d44d4-0x0;var _0x28ea7c=_0xb088[_0x1d44d4];return _0x28ea7c;};'use strict';var _=require(_0x8b08('0x0'));var util=require(_0x8b08('0x1'));var moment=require(_0x8b08('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b08('0x3'));var db=require(_0x8b08('0x4'))['db'];var utils=require(_0x8b08('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8b08('0x6'));var jayson=require(_0x8b08('0x7'));var client=jayson['client'][_0x8b08('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a7648,_0x1ef192,_0x17532d){return new BPromise(function(_0x41746a,_0x5a1d89){return client['request'](_0x4a7648,_0x17532d)[_0x8b08('0x9')](function(_0x3cb164){logger[_0x8b08('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x1ef192,_0x8b08('0xb'));logger['debug'](_0x8b08('0xc'),_0x1ef192,_0x8b08('0xb'),JSON[_0x8b08('0xd')](_0x3cb164));if(_0x3cb164[_0x8b08('0xe')]){if(_0x3cb164[_0x8b08('0xe')][_0x8b08('0xf')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x1ef192,_0x3cb164['error'][_0x8b08('0x10')]);return _0x5a1d89(_0x3cb164[_0x8b08('0xe')][_0x8b08('0x10')]);}logger['error'](_0x8b08('0x11'),_0x1ef192,_0x3cb164['error'][_0x8b08('0x10')]);return _0x41746a(_0x3cb164[_0x8b08('0xe')][_0x8b08('0x10')]);}else{logger[_0x8b08('0xa')](_0x8b08('0x11'),_0x1ef192,_0x8b08('0xb'));_0x41746a(_0x3cb164[_0x8b08('0x12')][_0x8b08('0x10')]);}})['catch'](function(_0x414c27){logger[_0x8b08('0xe')](_0x8b08('0x11'),_0x1ef192,_0x414c27);_0x5a1d89(_0x414c27);});});}exports['GetCmHopperBlack']=function(_0x283c5c){var _0x7eb64a=this;return new Promise(function(_0x317cec,_0x27edc7){return db['CmHopperBlack'][_0x8b08('0x13')]({'raw':_0x283c5c[_0x8b08('0x14')]?_0x283c5c[_0x8b08('0x14')][_0x8b08('0x15')]===undefined?!![]:![]:!![],'where':_0x283c5c[_0x8b08('0x14')]?_0x283c5c[_0x8b08('0x14')][_0x8b08('0x16')]||null:null,'attributes':_0x283c5c[_0x8b08('0x14')]?_0x283c5c[_0x8b08('0x14')][_0x8b08('0x17')]||null:null,'limit':_0x283c5c[_0x8b08('0x14')]?_0x283c5c[_0x8b08('0x14')]['limit']||null:null,'include':_0x283c5c[_0x8b08('0x14')]?_0x283c5c[_0x8b08('0x14')][_0x8b08('0x18')]?_['map'](_0x283c5c['options'][_0x8b08('0x18')],function(_0x34c66e){return{'model':db[_0x34c66e[_0x8b08('0x19')]],'as':_0x34c66e['as'],'attributes':_0x34c66e[_0x8b08('0x17')],'include':_0x34c66e['include']?_[_0x8b08('0x1a')](_0x34c66e[_0x8b08('0x18')],function(_0x4fb393){return{'model':db[_0x4fb393[_0x8b08('0x19')]],'as':_0x4fb393['as'],'attributes':_0x4fb393[_0x8b08('0x17')],'include':_0x4fb393['include']?_['map'](_0x4fb393[_0x8b08('0x18')],function(_0xd667){return{'model':db[_0xd667[_0x8b08('0x19')]],'as':_0xd667['as'],'attributes':_0xd667[_0x8b08('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8b08('0x9')](function(_0x1b10ec){logger['info'](_0x8b08('0x1b'),_0x283c5c);logger[_0x8b08('0x1c')](_0x8b08('0x1b'),_0x283c5c,JSON[_0x8b08('0xd')](_0x1b10ec));_0x317cec(_0x1b10ec);})[_0x8b08('0x1d')](function(_0x3c8bc6){logger[_0x8b08('0xe')](_0x8b08('0x1b'),_0x3c8bc6['message'],_0x283c5c);_0x27edc7(_0x7eb64a[_0x8b08('0xe')](0x1f4,_0x3c8bc6[_0x8b08('0x10')]));});});};exports[_0x8b08('0x1e')]=function(_0x59d3e2){var _0x252baa=this;return new Promise(function(_0x38f154,_0x377176){return db[_0x8b08('0x1f')][_0x8b08('0x20')](_0x59d3e2['body'],{'raw':_0x59d3e2[_0x8b08('0x14')]?_0x59d3e2[_0x8b08('0x14')][_0x8b08('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d3e2[_0x8b08('0x14')]?_0x59d3e2['options'][_0x8b08('0x16')]||null:null,'attributes':_0x59d3e2[_0x8b08('0x14')]?_0x59d3e2[_0x8b08('0x14')][_0x8b08('0x17')]||null:null,'limit':_0x59d3e2[_0x8b08('0x14')]?_0x59d3e2[_0x8b08('0x14')][_0x8b08('0x21')]||null:null})[_0x8b08('0x9')](function(_0x3d3eaf){logger[_0x8b08('0xa')](_0x8b08('0x1e'),_0x59d3e2);logger[_0x8b08('0x1c')](_0x8b08('0x1e'),_0x59d3e2,JSON[_0x8b08('0xd')](_0x3d3eaf));_0x38f154(_0x3d3eaf);})[_0x8b08('0x1d')](function(_0x2a2f20){logger[_0x8b08('0xe')]('UpdateCmHopperBlack',_0x2a2f20[_0x8b08('0x10')],_0x59d3e2);_0x377176(_0x252baa[_0x8b08('0xe')](0x1f4,_0x2a2f20[_0x8b08('0x10')]));});});};exports[_0x8b08('0x22')]=function(_0x3571ba){var _0x211f67=this;return new Promise(function(_0x55383c,_0x3b7247){return db['CmHopperBlack'][_0x8b08('0x23')]({'where':_0x3571ba[_0x8b08('0x14')]?_0x3571ba['options'][_0x8b08('0x16')]||null:null})['then'](function(_0x55c500){logger[_0x8b08('0xa')]('DestroyCmHopperBlack',_0x3571ba);logger['debug'](_0x8b08('0x22'),_0x3571ba,JSON['stringify'](_0x55c500));_0x55383c(_0x55c500);})[_0x8b08('0x1d')](function(_0x377158){logger['error'](_0x8b08('0x22'),_0x377158[_0x8b08('0x10')],_0x3571ba);_0x3b7247(_0x211f67['error'](0x1f4,_0x377158['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5984219..2825c74 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 _0x5fd1=['/:id','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe'];(function(_0x41dd75,_0x4707ef){var _0x2c492b=function(_0x2f58fb){while(--_0x2f58fb){_0x41dd75['push'](_0x41dd75['shift']());}};_0x2c492b(++_0x4707ef);}(_0x5fd1,0x155));var _0x15fd=function(_0x3449d7,_0x2796e8){_0x3449d7=_0x3449d7-0x0;var _0x2b6a01=_0x5fd1[_0x3449d7];return _0x2b6a01;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x15fd('0x4'));var config=require(_0x15fd('0x5'));var controller=require(_0x15fd('0x6'));router['get']('/',auth[_0x15fd('0x7')](),controller[_0x15fd('0x8')]);router[_0x15fd('0x9')](_0x15fd('0xa'),auth[_0x15fd('0x7')](),controller['describe']);router[_0x15fd('0x9')](_0x15fd('0xb'),auth[_0x15fd('0x7')](),controller['show']);router[_0x15fd('0xc')]('/:id',auth[_0x15fd('0x7')](),controller[_0x15fd('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xe')]);module[_0x15fd('0xf')]=router; \ No newline at end of file +var _0x5fd1=['/:id','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe'];(function(_0x567a35,_0x2773d){var _0x489d53=function(_0x3c5c4e){while(--_0x3c5c4e){_0x567a35['push'](_0x567a35['shift']());}};_0x489d53(++_0x2773d);}(_0x5fd1,0x155));var _0x15fd=function(_0x40e114,_0x278b52){_0x40e114=_0x40e114-0x0;var _0x2e9542=_0x5fd1[_0x40e114];return _0x2e9542;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x15fd('0x4'));var config=require(_0x15fd('0x5'));var controller=require(_0x15fd('0x6'));router['get']('/',auth[_0x15fd('0x7')](),controller[_0x15fd('0x8')]);router[_0x15fd('0x9')](_0x15fd('0xa'),auth[_0x15fd('0x7')](),controller['describe']);router[_0x15fd('0x9')](_0x15fd('0xb'),auth[_0x15fd('0x7')](),controller['show']);router[_0x15fd('0xc')]('/:id',auth[_0x15fd('0x7')](),controller[_0x15fd('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xe')]);module[_0x15fd('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index eac975e..5e7716c 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 _0xd01a=['exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','diff','dispositionat','BOOLEAN','moment'];(function(_0x1f58a9,_0x5ded2a){var _0x3d11b3=function(_0x5ddc6b){while(--_0x5ddc6b){_0x1f58a9['push'](_0x1f58a9['shift']());}};_0x3d11b3(++_0x5ded2a);}(_0xd01a,0xa4));var _0xad01=function(_0x169bda,_0x58d36f){_0x169bda=_0x169bda-0x0;var _0x3c6701=_0xd01a[_0x169bda];return _0x3c6701;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xad01('0x0'));module[_0xad01('0x1')]={'state':{'type':Sequelize[_0xad01('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xad01('0x3')]},'scheduledat':{'type':Sequelize[_0xad01('0x4')]},'countbusyretry':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xad01('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xad01('0x3')]},'originatecalleridname':{'type':Sequelize[_0xad01('0x3')]},'calleridnum':{'type':Sequelize[_0xad01('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xad01('0x4')]},'responsetime':{'type':Sequelize[_0xad01('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xad01('0x4')]},'endtime':{'type':Sequelize[_0xad01('0x4')]},'ringtime':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xad01('0x3')]},'membername':{'type':Sequelize[_0xad01('0x3')]},'reason':{'type':Sequelize[_0xad01('0x3')]},'disposition':{'type':Sequelize[_0xad01('0x3')]},'dispositionat':{'type':Sequelize[_0xad01('0x4')],'set':function(_0x3b1b30){var _0x2ba0c1=this[_0xad01('0x5')]('endtime');if(_0x2ba0c1&&_0x3b1b30){this[_0xad01('0x6')](_0xad01('0x7'),moment(_0x3b1b30)[_0xad01('0x8')](moment(_0x2ba0c1),'seconds'));}return this['setDataValue'](_0xad01('0x9'),_0x3b1b30);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xad01('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xad01('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xad01('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xad01('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xad01('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xad01('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xad01('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xad01('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xad01('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa6da=['exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xa6da,0x11c));var _0xaa6d=function(_0x5cd8d8,_0x4bfba4){_0x5cd8d8=_0x5cd8d8-0x0;var _0x47b62e=_0xa6da[_0x5cd8d8];return _0x47b62e;};'use strict';var Sequelize=require(_0xaa6d('0x0'));var moment=require(_0xaa6d('0x1'));module[_0xaa6d('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xaa6d('0x3')]},'scheduledat':{'type':Sequelize[_0xaa6d('0x4')]},'countbusyretry':{'type':Sequelize[_0xaa6d('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xaa6d('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xaa6d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xaa6d('0x3')]},'originatecalleridname':{'type':Sequelize[_0xaa6d('0x3')]},'calleridnum':{'type':Sequelize[_0xaa6d('0x3')]},'calleridname':{'type':Sequelize[_0xaa6d('0x3')]},'starttime':{'type':Sequelize[_0xaa6d('0x4')]},'responsetime':{'type':Sequelize[_0xaa6d('0x4')]},'answertime':{'type':Sequelize[_0xaa6d('0x4')]},'droptime':{'type':Sequelize[_0xaa6d('0x4')]},'endtime':{'type':Sequelize[_0xaa6d('0x4')]},'ringtime':{'type':Sequelize[_0xaa6d('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xaa6d('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xaa6d('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xaa6d('0x3')]},'campaign':{'type':Sequelize[_0xaa6d('0x3')]},'campaigntype':{'type':Sequelize[_0xaa6d('0x3')]},'membername':{'type':Sequelize[_0xaa6d('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xaa6d('0x4')],'set':function(_0x4063f2){var _0x4e48e1=this[_0xaa6d('0x6')](_0xaa6d('0x7'));if(_0x4e48e1&&_0x4063f2){this[_0xaa6d('0x8')](_0xaa6d('0x9'),moment(_0x4063f2)[_0xaa6d('0xa')](moment(_0x4e48e1),'seconds'));}return this['setDataValue'](_0xaa6d('0xb'),_0x4063f2);}},'amd':{'type':Sequelize[_0xaa6d('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xaa6d('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xaa6d('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xaa6d('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xaa6d('0x4')]},'callback':{'type':Sequelize[_0xaa6d('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xaa6d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xaa6d('0x4')]},'deleted':{'type':Sequelize[_0xaa6d('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xaa6d('0x4')]},'recallme':{'type':Sequelize[_0xaa6d('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xaa6d('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xaa6d('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xaa6d('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xaa6d('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xaa6d('0x5')],'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 7b34c93..160030e 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 _0x6b1b=['squel','jsforce','querystring','ioredis','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','apply','reject','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','rows','show','params','keys','length','find','describe','catch','update','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','NOW()','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','phone','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(calleridnum)','CampaignId','createdAt','CampaignId\x20=\x20?','calleridnum','checkContactHopper','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x336e69,_0x5bdb2e){var _0x11392a=function(_0x41032b){while(--_0x41032b){_0x336e69['push'](_0x336e69['shift']());}};_0x11392a(++_0x5bdb2e);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x6b1b[_0x934425];return _0x31d596;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb6b1('0x0'));var rimraf=require(_0xb6b1('0x1'));var zipdir=require(_0xb6b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6b1('0x3'));var moment=require(_0xb6b1('0x4'));var BPromise=require(_0xb6b1('0x5'));var Mustache=require(_0xb6b1('0x6'));var util=require(_0xb6b1('0x7'));var path=require(_0xb6b1('0x8'));var sox=require(_0xb6b1('0x9'));var csv=require(_0xb6b1('0xa'));var ejs=require(_0xb6b1('0xb'));var fs=require('fs');var _=require(_0xb6b1('0xc'));var squel=require(_0xb6b1('0xd'));var crypto=require('crypto');var jsforce=require(_0xb6b1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb6b1('0xf'));var Papa=require('papaparse');var Redis=require(_0xb6b1('0x10'));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(_0xb6b1('0x11'))(_0xb6b1('0x12'));var utils=require('../../config/utils');var config=require(_0xb6b1('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c5837,_0x406dce){_0x406dce=_0x406dce||0xcc;return function(_0x2e5256){if(_0x2e5256){return _0x5c5837[_0xb6b1('0x14')](_0x406dce);}return _0x5c5837[_0xb6b1('0x15')](_0x406dce)[_0xb6b1('0x16')]();};}function respondWithResult(_0x18f6b5,_0x360fc7){_0x360fc7=_0x360fc7||0xc8;return function(_0x429d0d){if(_0x429d0d){return _0x18f6b5[_0xb6b1('0x15')](_0x360fc7)[_0xb6b1('0x17')](_0x429d0d);}};}function respondWithFilteredResult(_0x2629db,_0x14fef6){return function(_0x4f770a){if(_0x4f770a){var _0x57572a=_0x4f770a[_0xb6b1('0x18')],_0x513207=_0x14fef6[_0xb6b1('0x19')],_0x51f25f=_0x14fef6[_0xb6b1('0x19')]+_0x14fef6[_0xb6b1('0x1a')],_0xee229d;if(_0x51f25f>=_0x57572a){_0x51f25f=_0x57572a;_0xee229d=0xc8;}else{_0xee229d=0xce;}_0x2629db[_0xb6b1('0x15')](_0xee229d);return _0x2629db['set']('Content-Range',_0x513207+'-'+_0x51f25f+'/'+_0x57572a)[_0xb6b1('0x17')](_0x4f770a);}return null;};}function patchUpdates(_0x15456d){return function(_0x16d969){try{jsonpatch[_0xb6b1('0x1b')](_0x16d969,_0x15456d,!![]);}catch(_0x45d9e6){return BPromise[_0xb6b1('0x1c')](_0x45d9e6);}return _0x16d969['save']();};}function saveUpdates(_0x4e132a,_0x43312e){return function(_0x1067ea){if(_0x1067ea){return _0x1067ea['update'](_0x4e132a)['then'](function(_0xfc247a){return _0xfc247a;});}return null;};}function removeEntity(_0x5c8529,_0x509c55){return function(_0x232157){if(_0x232157){return _0x232157[_0xb6b1('0x1d')]()[_0xb6b1('0x1e')](function(){_0x5c8529[_0xb6b1('0x15')](0xcc)[_0xb6b1('0x16')]();});}};}function handleEntityNotFound(_0x3d0864,_0x1eb1b2){return function(_0x3b1ff7){if(!_0x3b1ff7){_0x3d0864[_0xb6b1('0x14')](0x194);}return _0x3b1ff7;};}function handleError(_0x20066f,_0x5069cd){_0x5069cd=_0x5069cd||0x1f4;return function(_0x214cd0){logger['error'](_0x214cd0[_0xb6b1('0x1f')]);if(_0x214cd0['name']){delete _0x214cd0[_0xb6b1('0x20')];}_0x20066f['status'](_0x5069cd)[_0xb6b1('0x21')](_0x214cd0);};}exports[_0xb6b1('0x22')]=function(_0xac4256,_0x178401){var _0x13e841={},_0x188627={},_0x3e0915={'count':0x0,'rows':[]};var _0xd3c6da=_[_0xb6b1('0x23')](db['CmHopperFinal'][_0xb6b1('0x24')],function(_0x548f3f){return{'name':_0x548f3f[_0xb6b1('0x25')],'type':_0x548f3f[_0xb6b1('0x26')][_0xb6b1('0x27')]};});_0x188627[_0xb6b1('0x28')]=_[_0xb6b1('0x23')](_0xd3c6da,_0xb6b1('0x20'));_0x188627[_0xb6b1('0x29')]=_['keys'](_0xac4256[_0xb6b1('0x29')]);_0x188627[_0xb6b1('0x2a')]=_[_0xb6b1('0x2b')](_0x188627['model'],_0x188627[_0xb6b1('0x29')]);_0x13e841[_0xb6b1('0x2c')]=_['intersection'](_0x188627[_0xb6b1('0x28')],qs[_0xb6b1('0x2d')](_0xac4256[_0xb6b1('0x29')][_0xb6b1('0x2d')]));_0x13e841[_0xb6b1('0x2c')]=_0x13e841[_0xb6b1('0x2c')]['length']?_0x13e841[_0xb6b1('0x2c')]:_0x188627[_0xb6b1('0x28')];if(!_0xac4256['query'][_0xb6b1('0x2e')]('nolimit')){_0x13e841[_0xb6b1('0x1a')]=qs[_0xb6b1('0x1a')](_0xac4256[_0xb6b1('0x29')][_0xb6b1('0x1a')]);_0x13e841[_0xb6b1('0x19')]=qs[_0xb6b1('0x19')](_0xac4256['query'][_0xb6b1('0x19')]);}_0x13e841[_0xb6b1('0x2f')]=qs[_0xb6b1('0x30')](_0xac4256[_0xb6b1('0x29')]['sort']);_0x13e841['where']=qs['filters'](_[_0xb6b1('0x31')](_0xac4256[_0xb6b1('0x29')],_0x188627[_0xb6b1('0x2a')]),_0xd3c6da);if(_0xac4256[_0xb6b1('0x29')][_0xb6b1('0x32')]){_0x13e841[_0xb6b1('0x33')]=_[_0xb6b1('0x34')](_0x13e841[_0xb6b1('0x33')],{'$or':_[_0xb6b1('0x23')](_0xd3c6da,function(_0x25d6a2){if(_0x25d6a2[_0xb6b1('0x26')]!==_0xb6b1('0x35')){var _0x5b8a57={};_0x5b8a57[_0x25d6a2[_0xb6b1('0x20')]]={'$like':'%'+_0xac4256[_0xb6b1('0x29')][_0xb6b1('0x32')]+'%'};return _0x5b8a57;}})});}_0x13e841=_[_0xb6b1('0x34')]({},_0x13e841,_0xac4256[_0xb6b1('0x36')]);var _0x1dc258={'where':_0x13e841[_0xb6b1('0x33')]};return db[_0xb6b1('0x37')][_0xb6b1('0x18')](_0x1dc258)[_0xb6b1('0x1e')](function(_0x44a61a){_0x3e0915['count']=_0x44a61a;if(_0xac4256[_0xb6b1('0x29')][_0xb6b1('0x38')]){_0x13e841[_0xb6b1('0x39')]=[{'all':!![]}];}return db[_0xb6b1('0x37')][_0xb6b1('0x3a')](_0x13e841);})[_0xb6b1('0x1e')](function(_0x27808b){_0x3e0915[_0xb6b1('0x3b')]=_0x27808b;return _0x3e0915;})['then'](respondWithFilteredResult(_0x178401,_0x13e841))['catch'](handleError(_0x178401,null));};exports[_0xb6b1('0x3c')]=function(_0x19853f,_0x1f43fe){var _0x541eb5={'raw':!![],'where':{'id':_0x19853f[_0xb6b1('0x3d')]['id']}},_0x8d1ba8={};_0x8d1ba8[_0xb6b1('0x28')]=_[_0xb6b1('0x3e')](db[_0xb6b1('0x37')][_0xb6b1('0x24')]);_0x8d1ba8[_0xb6b1('0x29')]=_[_0xb6b1('0x3e')](_0x19853f['query']);_0x8d1ba8[_0xb6b1('0x2a')]=_['intersection'](_0x8d1ba8[_0xb6b1('0x28')],_0x8d1ba8[_0xb6b1('0x29')]);_0x541eb5[_0xb6b1('0x2c')]=_[_0xb6b1('0x2b')](_0x8d1ba8[_0xb6b1('0x28')],qs[_0xb6b1('0x2d')](_0x19853f['query'][_0xb6b1('0x2d')]));_0x541eb5[_0xb6b1('0x2c')]=_0x541eb5['attributes'][_0xb6b1('0x3f')]?_0x541eb5['attributes']:_0x8d1ba8[_0xb6b1('0x28')];if(_0x19853f[_0xb6b1('0x29')][_0xb6b1('0x38')]){_0x541eb5[_0xb6b1('0x39')]=[{'all':!![]}];}_0x541eb5=_[_0xb6b1('0x34')]({},_0x541eb5,_0x19853f[_0xb6b1('0x36')]);return db[_0xb6b1('0x37')][_0xb6b1('0x40')](_0x541eb5)[_0xb6b1('0x1e')](handleEntityNotFound(_0x1f43fe,null))['then'](respondWithResult(_0x1f43fe,null))['catch'](handleError(_0x1f43fe,null));};exports[_0xb6b1('0x41')]=function(_0x2c00fb,_0x5959ca){return db[_0xb6b1('0x37')][_0xb6b1('0x41')]()[_0xb6b1('0x1e')](respondWithResult(_0x5959ca,null))[_0xb6b1('0x42')](handleError(_0x5959ca,null));};exports[_0xb6b1('0x43')]=function(_0x505a80,_0x28f353){if(_0x505a80[_0xb6b1('0x44')][_0xb6b1('0x45')]){delete _0x505a80[_0xb6b1('0x44')]['uniqueid'];}return db['CmHopperFinal'][_0xb6b1('0x40')]({'where':{'uniqueid':_0x505a80['params']['id']}})[_0xb6b1('0x1e')](handleEntityNotFound(_0x28f353,null))[_0xb6b1('0x1e')](saveUpdates(_0x505a80['body'],null))[_0xb6b1('0x1e')](respondWithResult(_0x28f353,null))['catch'](handleError(_0x28f353,null));};exports[_0xb6b1('0x46')]=function(_0x7d4763,_0xbd7cec,_0x1b41bb){return db[_0xb6b1('0x37')][_0xb6b1('0x3a')]({'raw':![],'where':{'VoiceQueueId':_0x7d4763[_0xb6b1('0x3d')]['id']},'attributes':[[db[_0xb6b1('0x47')]['fn'](_0xb6b1('0x48'),db[_0xb6b1('0x47')]['fn']('IF',db['sequelize'][_0xb6b1('0x49')](_0xb6b1('0x4a')))),_0xb6b1('0x4b')],[db[_0xb6b1('0x47')]['fn'](_0xb6b1('0x48'),db[_0xb6b1('0x47')]['fn']('IF',db[_0xb6b1('0x47')][_0xb6b1('0x49')](_0xb6b1('0x4c')))),'noAnswerContacts'],[db[_0xb6b1('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb6b1('0x47')][_0xb6b1('0x49')]('`state`\x20=\x205,\x201,\x20null'))),_0xb6b1('0x4d')],[db[_0xb6b1('0x47')]['fn'](_0xb6b1('0x48'),db['sequelize']['fn']('IF',db[_0xb6b1('0x47')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xb6b1('0x4e')],[db[_0xb6b1('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xb6b1('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db['sequelize']['fn'](_0xb6b1('0x48'),db[_0xb6b1('0x47')]['fn']('IF',db[_0xb6b1('0x47')][_0xb6b1('0x49')](_0xb6b1('0x4f')))),_0xb6b1('0x50')],[db['sequelize']['fn'](_0xb6b1('0x48'),db[_0xb6b1('0x47')]['fn']('IF',db['sequelize']['literal'](_0xb6b1('0x51')))),_0xb6b1('0x52')],[db['sequelize']['fn']('COUNT',db[_0xb6b1('0x47')]['fn']('IF',db['sequelize'][_0xb6b1('0x49')](_0xb6b1('0x53')))),'answeringMachine']]})[_0xb6b1('0x1e')](handleEntityNotFound(_0xbd7cec,null))[_0xb6b1('0x1e')](respondWithResult(_0xbd7cec,null))[_0xb6b1('0x42')](handleError(_0xbd7cec,null));};exports[_0xb6b1('0x54')]=function(_0x1fb86b,_0x1296f6,_0x29839d){return db[_0xb6b1('0x37')][_0xb6b1('0x3a')]({'raw':![],'where':{'CampaignId':_0x1fb86b[_0xb6b1('0x3d')]['id']},'attributes':[[db['sequelize']['fn'](_0xb6b1('0x48'),db[_0xb6b1('0x47')]['fn']('IF',db[_0xb6b1('0x47')][_0xb6b1('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0xb6b1('0x4b')],[db[_0xb6b1('0x47')]['fn'](_0xb6b1('0x48'),db[_0xb6b1('0x47')]['fn']('IF',db[_0xb6b1('0x47')][_0xb6b1('0x49')](_0xb6b1('0x4c')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xb6b1('0x48'),db['sequelize']['fn']('IF',db[_0xb6b1('0x47')][_0xb6b1('0x49')](_0xb6b1('0x55')))),'busyContacts'],[db[_0xb6b1('0x47')]['fn'](_0xb6b1('0x48'),db[_0xb6b1('0x47')]['fn']('IF',db[_0xb6b1('0x47')][_0xb6b1('0x49')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0xb6b1('0x47')]['fn'](_0xb6b1('0x48'),db[_0xb6b1('0x47')]['fn']('IF',db[_0xb6b1('0x47')][_0xb6b1('0x49')](_0xb6b1('0x56')))),_0xb6b1('0x57')],[db[_0xb6b1('0x47')]['fn'](_0xb6b1('0x48'),db[_0xb6b1('0x47')]['fn']('IF',db[_0xb6b1('0x47')][_0xb6b1('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb6b1('0x50')],[db['sequelize']['fn'](_0xb6b1('0x48'),db[_0xb6b1('0x47')]['fn']('IF',db[_0xb6b1('0x47')]['literal'](_0xb6b1('0x51')))),'reCallContacts'],[db['sequelize']['fn'](_0xb6b1('0x48'),db['sequelize']['fn']('IF',db[_0xb6b1('0x47')][_0xb6b1('0x49')]('`state`\x20=\x2019,\x201,\x20null'))),_0xb6b1('0x58')]]})['then'](handleEntityNotFound(_0x1296f6,null))[_0xb6b1('0x1e')](respondWithResult(_0x1296f6,null))[_0xb6b1('0x42')](handleError(_0x1296f6,null));};exports[_0xb6b1('0x59')]=function(_0x53a85e,_0x309982,_0x4ef26a){return db[_0xb6b1('0x5a')][_0xb6b1('0x40')]({'where':{'id':_0x53a85e[_0xb6b1('0x3d')]['id']}})[_0xb6b1('0x1e')](handleEntityNotFound(_0x309982,null))['then'](function(_0x3b1036){var _0x410fe6;if(_0x3b1036){_0x410fe6=squel[_0xb6b1('0x5b')]()[_0xb6b1('0x5c')](_0xb6b1('0x5d'))[_0xb6b1('0x5e')](['phone',_0xb6b1('0x5f'),_0xb6b1('0x60'),_0xb6b1('0x61'),_0xb6b1('0x62'),'createdAt',_0xb6b1('0x63')],squel[_0xb6b1('0x64')]()['field']('ANY_VALUE(calleridnum)','phone')['field'](_0xb6b1('0x65'),_0xb6b1('0x5f'))[_0xb6b1('0x66')](_0xb6b1('0x67'),_0xb6b1('0x60'))[_0xb6b1('0x66')](_0xb6b1('0x68'),'ListId')[_0xb6b1('0x66')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0xb6b1('0x66')](_0xb6b1('0x65'),'createdAt')[_0xb6b1('0x66')](_0xb6b1('0x65'),_0xb6b1('0x63'))[_0xb6b1('0x69')](_0xb6b1('0x6a'))['where'](_0xb6b1('0x6b'),_0x53a85e[_0xb6b1('0x3d')]['id']['toString']())['where'](_0xb6b1('0x6c'),_0x53a85e[_0xb6b1('0x44')][_0xb6b1('0x6d')][_0xb6b1('0x6e')]())[_0xb6b1('0x33')](_0xb6b1('0x6f'))[_0xb6b1('0x33')](_0xb6b1('0x70'),squel[_0xb6b1('0x64')]()['field'](_0xb6b1('0x71'))['from'](_0xb6b1('0x5d'))[_0xb6b1('0x33')](_0xb6b1('0x6b'),_0x53a85e['params']['id'][_0xb6b1('0x6e')]()))[_0xb6b1('0x33')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb6b1('0x64')]()[_0xb6b1('0x66')]('calleridnum')[_0xb6b1('0x69')]('cm_hopper_final')[_0xb6b1('0x33')]('VoiceQueueId\x20=\x20?',_0x53a85e[_0xb6b1('0x3d')]['id'][_0xb6b1('0x6e')]())[_0xb6b1('0x33')](_0xb6b1('0x72')))[_0xb6b1('0x73')]('ContactId'))[_0xb6b1('0x6e')]();return db[_0xb6b1('0x47')][_0xb6b1('0x29')](_0x410fe6);}return[];})[_0xb6b1('0x1e')](respondWithResult(_0x309982,null))[_0xb6b1('0x42')](handleError(_0x309982,null));};exports[_0xb6b1('0x74')]=function(_0x19415a,_0x1936d4,_0x8e1139){return db[_0xb6b1('0x75')][_0xb6b1('0x40')]({'where':{'id':_0x19415a[_0xb6b1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1936d4,null))[_0xb6b1('0x1e')](function(_0x385fd7){var _0x5446ef;if(_0x385fd7){_0x5446ef=squel[_0xb6b1('0x5b')]()[_0xb6b1('0x5c')]('cm_hopper')[_0xb6b1('0x5e')](['phone',_0xb6b1('0x5f'),'ContactId',_0xb6b1('0x61'),'CampaignId','createdAt',_0xb6b1('0x63')],squel[_0xb6b1('0x64')]()['field'](_0xb6b1('0x76'),_0xb6b1('0x71'))[_0xb6b1('0x66')](_0xb6b1('0x65'),_0xb6b1('0x5f'))[_0xb6b1('0x66')](_0xb6b1('0x67'),_0xb6b1('0x60'))[_0xb6b1('0x66')](_0xb6b1('0x68'),_0xb6b1('0x61'))[_0xb6b1('0x66')]('ANY_VALUE(CampaignId)',_0xb6b1('0x77'))[_0xb6b1('0x66')](_0xb6b1('0x65'),_0xb6b1('0x78'))['field'](_0xb6b1('0x65'),_0xb6b1('0x63'))[_0xb6b1('0x69')](_0xb6b1('0x6a'))[_0xb6b1('0x33')](_0xb6b1('0x79'),_0x19415a['params']['id'][_0xb6b1('0x6e')]())[_0xb6b1('0x33')](_0xb6b1('0x6c'),_0x19415a[_0xb6b1('0x44')][_0xb6b1('0x6d')][_0xb6b1('0x6e')]())[_0xb6b1('0x33')](_0xb6b1('0x6f'))[_0xb6b1('0x33')](_0xb6b1('0x70'),squel[_0xb6b1('0x64')]()[_0xb6b1('0x66')]('phone')[_0xb6b1('0x69')](_0xb6b1('0x5d'))[_0xb6b1('0x33')](_0xb6b1('0x79'),_0x19415a[_0xb6b1('0x3d')]['id'][_0xb6b1('0x6e')]()))[_0xb6b1('0x33')](_0xb6b1('0x70'),squel['select']()[_0xb6b1('0x66')](_0xb6b1('0x7a'))[_0xb6b1('0x69')]('cm_hopper_final')[_0xb6b1('0x33')]('CampaignId\x20=\x20?',_0x19415a['params']['id'][_0xb6b1('0x6e')]())[_0xb6b1('0x33')](_0xb6b1('0x72')))[_0xb6b1('0x73')](_0xb6b1('0x60')))[_0xb6b1('0x6e')]();return db['sequelize'][_0xb6b1('0x29')](_0x5446ef);}return[];})[_0xb6b1('0x1e')](respondWithResult(_0x1936d4,null))[_0xb6b1('0x42')](handleError(_0x1936d4,null));};exports[_0xb6b1('0x7b')]=function(_0x5712df,_0x4ea394,_0xdeaa28){return db['CmHopper'][_0xb6b1('0x7c')]({'where':{'VoiceQueueId':_0x5712df['body'][_0xb6b1('0x62')],'CampaignId':_0x5712df['body']['CampaignId'],'ContactId':_0x5712df[_0xb6b1('0x44')][_0xb6b1('0x60')]}})[_0xb6b1('0x1e')](handleEntityNotFound(_0x4ea394,null))[_0xb6b1('0x1e')](function(_0x3929e1){if(_0x3929e1){return _0x3929e1;}return null;})['then'](respondWithResult(_0x4ea394,null))[_0xb6b1('0x42')](handleError(_0x4ea394,null));}; \ No newline at end of file +var _0x2b47=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','CmHopperFinal','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','keys','include','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','find','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','cm_hopper','calleridnum','toString','state\x20=\x204','group','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0xa20971,_0x1bf32c){var _0x4f4271=function(_0x299c14){while(--_0x299c14){_0xa20971['push'](_0xa20971['shift']());}};_0x4f4271(++_0x1bf32c);}(_0x2b47,0x177));var _0x72b4=function(_0x4a484f,_0x2c2892){_0x4a484f=_0x4a484f-0x0;var _0x59f974=_0x2b47[_0x4a484f];return _0x59f974;};'use strict';var pdf=require(_0x72b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x72b4('0x1'));var zipdir=require(_0x72b4('0x2'));var jsonpatch=require(_0x72b4('0x3'));var rp=require('request-promise');var moment=require(_0x72b4('0x4'));var BPromise=require(_0x72b4('0x5'));var Mustache=require(_0x72b4('0x6'));var util=require(_0x72b4('0x7'));var path=require(_0x72b4('0x8'));var sox=require(_0x72b4('0x9'));var csv=require('to-csv');var ejs=require(_0x72b4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x72b4('0xb'));var crypto=require(_0x72b4('0xc'));var jsforce=require(_0x72b4('0xd'));var deskjs=require(_0x72b4('0xe'));var toCsv=require(_0x72b4('0xf'));var querystring=require(_0x72b4('0x10'));var Papa=require(_0x72b4('0x11'));var Redis=require(_0x72b4('0x12'));var authService=require(_0x72b4('0x13'));var qs=require(_0x72b4('0x14'));var as=require(_0x72b4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72b4('0x16'))(_0x72b4('0x17'));var utils=require(_0x72b4('0x18'));var config=require(_0x72b4('0x19'));var db=require(_0x72b4('0x1a'))['db'];function respondWithStatusCode(_0x2b80f0,_0x19435a){_0x19435a=_0x19435a||0xcc;return function(_0x25cbed){if(_0x25cbed){return _0x2b80f0[_0x72b4('0x1b')](_0x19435a);}return _0x2b80f0[_0x72b4('0x1c')](_0x19435a)[_0x72b4('0x1d')]();};}function respondWithResult(_0x5bafa2,_0x3ae95d){_0x3ae95d=_0x3ae95d||0xc8;return function(_0x2d0b4f){if(_0x2d0b4f){return _0x5bafa2[_0x72b4('0x1c')](_0x3ae95d)[_0x72b4('0x1e')](_0x2d0b4f);}};}function respondWithFilteredResult(_0x5cd685,_0x5c6303){return function(_0x3eff87){if(_0x3eff87){var _0x5c7c36=_0x3eff87[_0x72b4('0x1f')],_0x21ff7d=_0x5c6303[_0x72b4('0x20')],_0x2d4fd0=_0x5c6303[_0x72b4('0x20')]+_0x5c6303[_0x72b4('0x21')],_0x5ac4fc;if(_0x2d4fd0>=_0x5c7c36){_0x2d4fd0=_0x5c7c36;_0x5ac4fc=0xc8;}else{_0x5ac4fc=0xce;}_0x5cd685[_0x72b4('0x1c')](_0x5ac4fc);return _0x5cd685[_0x72b4('0x22')](_0x72b4('0x23'),_0x21ff7d+'-'+_0x2d4fd0+'/'+_0x5c7c36)[_0x72b4('0x1e')](_0x3eff87);}return null;};}function patchUpdates(_0x1a1543){return function(_0x53c344){try{jsonpatch[_0x72b4('0x24')](_0x53c344,_0x1a1543,!![]);}catch(_0x52f908){return BPromise[_0x72b4('0x25')](_0x52f908);}return _0x53c344[_0x72b4('0x26')]();};}function saveUpdates(_0x518fda,_0x13d8d1){return function(_0xc74320){if(_0xc74320){return _0xc74320['update'](_0x518fda)[_0x72b4('0x27')](function(_0x563ddf){return _0x563ddf;});}return null;};}function removeEntity(_0x1f6547,_0x5dce4d){return function(_0x567592){if(_0x567592){return _0x567592[_0x72b4('0x28')]()['then'](function(){_0x1f6547[_0x72b4('0x1c')](0xcc)[_0x72b4('0x1d')]();});}};}function handleEntityNotFound(_0x1da2a5,_0x4f4ce8){return function(_0x3a21d6){if(!_0x3a21d6){_0x1da2a5[_0x72b4('0x1b')](0x194);}return _0x3a21d6;};}function handleError(_0x355d21,_0x48f8e0){_0x48f8e0=_0x48f8e0||0x1f4;return function(_0x2a29d8){logger[_0x72b4('0x29')](_0x2a29d8[_0x72b4('0x2a')]);if(_0x2a29d8[_0x72b4('0x2b')]){delete _0x2a29d8[_0x72b4('0x2b')];}_0x355d21[_0x72b4('0x1c')](_0x48f8e0)[_0x72b4('0x2c')](_0x2a29d8);};}exports['index']=function(_0x3743c8,_0x5d0d20){var _0x32c0ab={},_0x20bcb0={},_0x3489bc={'count':0x0,'rows':[]};var _0x464a4d=_[_0x72b4('0x2d')](db[_0x72b4('0x2e')]['rawAttributes'],function(_0x3a5a55){return{'name':_0x3a5a55[_0x72b4('0x2f')],'type':_0x3a5a55[_0x72b4('0x30')][_0x72b4('0x31')]};});_0x20bcb0[_0x72b4('0x32')]=_[_0x72b4('0x2d')](_0x464a4d,_0x72b4('0x2b'));_0x20bcb0[_0x72b4('0x33')]=_['keys'](_0x3743c8[_0x72b4('0x33')]);_0x20bcb0[_0x72b4('0x34')]=_['intersection'](_0x20bcb0[_0x72b4('0x32')],_0x20bcb0[_0x72b4('0x33')]);_0x32c0ab[_0x72b4('0x35')]=_[_0x72b4('0x36')](_0x20bcb0[_0x72b4('0x32')],qs[_0x72b4('0x37')](_0x3743c8[_0x72b4('0x33')][_0x72b4('0x37')]));_0x32c0ab[_0x72b4('0x35')]=_0x32c0ab[_0x72b4('0x35')][_0x72b4('0x38')]?_0x32c0ab[_0x72b4('0x35')]:_0x20bcb0[_0x72b4('0x32')];if(!_0x3743c8[_0x72b4('0x33')][_0x72b4('0x39')](_0x72b4('0x3a'))){_0x32c0ab['limit']=qs['limit'](_0x3743c8[_0x72b4('0x33')]['limit']);_0x32c0ab[_0x72b4('0x20')]=qs['offset'](_0x3743c8[_0x72b4('0x33')][_0x72b4('0x20')]);}_0x32c0ab[_0x72b4('0x3b')]=qs[_0x72b4('0x3c')](_0x3743c8['query'][_0x72b4('0x3c')]);_0x32c0ab[_0x72b4('0x3d')]=qs[_0x72b4('0x34')](_[_0x72b4('0x3e')](_0x3743c8[_0x72b4('0x33')],_0x20bcb0[_0x72b4('0x34')]),_0x464a4d);if(_0x3743c8[_0x72b4('0x33')][_0x72b4('0x3f')]){_0x32c0ab[_0x72b4('0x3d')]=_['merge'](_0x32c0ab['where'],{'$or':_[_0x72b4('0x2d')](_0x464a4d,function(_0x55a6ab){if(_0x55a6ab['type']!==_0x72b4('0x40')){var _0x5edb79={};_0x5edb79[_0x55a6ab[_0x72b4('0x2b')]]={'$like':'%'+_0x3743c8[_0x72b4('0x33')][_0x72b4('0x3f')]+'%'};return _0x5edb79;}})});}_0x32c0ab=_[_0x72b4('0x41')]({},_0x32c0ab,_0x3743c8[_0x72b4('0x42')]);var _0x5b61e2={'where':_0x32c0ab[_0x72b4('0x3d')]};return db[_0x72b4('0x2e')][_0x72b4('0x1f')](_0x5b61e2)[_0x72b4('0x27')](function(_0xc0e19){_0x3489bc[_0x72b4('0x1f')]=_0xc0e19;if(_0x3743c8[_0x72b4('0x33')][_0x72b4('0x43')]){_0x32c0ab['include']=[{'all':!![]}];}return db[_0x72b4('0x2e')][_0x72b4('0x44')](_0x32c0ab);})['then'](function(_0x466f42){_0x3489bc[_0x72b4('0x45')]=_0x466f42;return _0x3489bc;})[_0x72b4('0x27')](respondWithFilteredResult(_0x5d0d20,_0x32c0ab))[_0x72b4('0x46')](handleError(_0x5d0d20,null));};exports['show']=function(_0x1b8152,_0x982a27){var _0x46d043={'raw':!![],'where':{'id':_0x1b8152[_0x72b4('0x47')]['id']}},_0x1c02ee={};_0x1c02ee['model']=_['keys'](db[_0x72b4('0x2e')][_0x72b4('0x48')]);_0x1c02ee['query']=_[_0x72b4('0x49')](_0x1b8152['query']);_0x1c02ee[_0x72b4('0x34')]=_['intersection'](_0x1c02ee['model'],_0x1c02ee[_0x72b4('0x33')]);_0x46d043[_0x72b4('0x35')]=_['intersection'](_0x1c02ee[_0x72b4('0x32')],qs[_0x72b4('0x37')](_0x1b8152['query'][_0x72b4('0x37')]));_0x46d043[_0x72b4('0x35')]=_0x46d043[_0x72b4('0x35')][_0x72b4('0x38')]?_0x46d043[_0x72b4('0x35')]:_0x1c02ee['model'];if(_0x1b8152['query'][_0x72b4('0x43')]){_0x46d043[_0x72b4('0x4a')]=[{'all':!![]}];}_0x46d043=_[_0x72b4('0x41')]({},_0x46d043,_0x1b8152[_0x72b4('0x42')]);return db[_0x72b4('0x2e')]['find'](_0x46d043)['then'](handleEntityNotFound(_0x982a27,null))[_0x72b4('0x27')](respondWithResult(_0x982a27,null))[_0x72b4('0x46')](handleError(_0x982a27,null));};exports[_0x72b4('0x4b')]=function(_0x28a465,_0x4caeba){return db[_0x72b4('0x2e')][_0x72b4('0x4b')]()[_0x72b4('0x27')](respondWithResult(_0x4caeba,null))[_0x72b4('0x46')](handleError(_0x4caeba,null));};exports['update']=function(_0x12069b,_0x43869d){if(_0x12069b[_0x72b4('0x4c')]['uniqueid']){delete _0x12069b[_0x72b4('0x4c')][_0x72b4('0x4d')];}return db[_0x72b4('0x2e')]['find']({'where':{'uniqueid':_0x12069b['params']['id']}})[_0x72b4('0x27')](handleEntityNotFound(_0x43869d,null))[_0x72b4('0x27')](saveUpdates(_0x12069b['body'],null))[_0x72b4('0x27')](respondWithResult(_0x43869d,null))[_0x72b4('0x46')](handleError(_0x43869d,null));};exports[_0x72b4('0x4e')]=function(_0x31f717,_0xd6edfe,_0x515bcf){return db[_0x72b4('0x2e')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x31f717[_0x72b4('0x47')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x72b4('0x4f')]['fn']('IF',db['sequelize'][_0x72b4('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0x72b4('0x51')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x53')))),'noAnswerContacts'],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db['sequelize']['fn']('IF',db[_0x72b4('0x4f')]['literal'](_0x72b4('0x54')))),_0x72b4('0x55')],[db['sequelize']['fn']('COUNT',db[_0x72b4('0x4f')]['fn']('IF',db['sequelize'][_0x72b4('0x50')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db['sequelize']['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x56')))),_0x72b4('0x57')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x58')))),'abandonedContacts'],[db['sequelize']['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db['sequelize'][_0x72b4('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0x72b4('0x59')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')]('`state`\x20=\x2019,\x201,\x20null'))),_0x72b4('0x5a')]]})[_0x72b4('0x27')](handleEntityNotFound(_0xd6edfe,null))[_0x72b4('0x27')](respondWithResult(_0xd6edfe,null))[_0x72b4('0x46')](handleError(_0xd6edfe,null));};exports[_0x72b4('0x5b')]=function(_0x291bc3,_0x1a4346,_0x126e09){return db[_0x72b4('0x2e')][_0x72b4('0x44')]({'raw':![],'where':{'CampaignId':_0x291bc3[_0x72b4('0x47')]['id']},'attributes':[[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db['sequelize']['fn']('IF',db[_0x72b4('0x4f')]['literal'](_0x72b4('0x5c')))),'noSuchContacts'],[db['sequelize']['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db['sequelize'][_0x72b4('0x50')](_0x72b4('0x53')))),_0x72b4('0x5d')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x54')))),_0x72b4('0x55')],[db['sequelize']['fn']('COUNT',db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x5e')))),_0x72b4('0x5f')],[db[_0x72b4('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x72b4('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x72b4('0x57')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x72b4('0x60')],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x61')))),'reCallContacts'],[db[_0x72b4('0x4f')]['fn'](_0x72b4('0x52'),db[_0x72b4('0x4f')]['fn']('IF',db[_0x72b4('0x4f')][_0x72b4('0x50')](_0x72b4('0x62')))),'answeringMachine']]})[_0x72b4('0x27')](handleEntityNotFound(_0x1a4346,null))[_0x72b4('0x27')](respondWithResult(_0x1a4346,null))['catch'](handleError(_0x1a4346,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xe693d3,_0x3dccba,_0x2dbf1b){return db['VoiceQueue'][_0x72b4('0x63')]({'where':{'id':_0xe693d3[_0x72b4('0x47')]['id']}})[_0x72b4('0x27')](handleEntityNotFound(_0x3dccba,null))[_0x72b4('0x27')](function(_0x1dd69a){var _0x4a2fc5;if(_0x1dd69a){_0x4a2fc5=squel[_0x72b4('0x64')]()[_0x72b4('0x65')]('cm_hopper')[_0x72b4('0x66')]([_0x72b4('0x67'),_0x72b4('0x68'),_0x72b4('0x69'),_0x72b4('0x6a'),_0x72b4('0x6b'),_0x72b4('0x6c'),_0x72b4('0x6d')],squel['select']()[_0x72b4('0x6e')](_0x72b4('0x6f'),'phone')[_0x72b4('0x6e')](_0x72b4('0x70'),'scheduledAt')[_0x72b4('0x6e')](_0x72b4('0x71'),_0x72b4('0x69'))[_0x72b4('0x6e')]('ANY_VALUE(ListId)',_0x72b4('0x6a'))[_0x72b4('0x6e')](_0x72b4('0x72'),'VoiceQueueId')['field'](_0x72b4('0x70'),_0x72b4('0x6c'))[_0x72b4('0x6e')](_0x72b4('0x70'),_0x72b4('0x6d'))['from'](_0x72b4('0x73'))[_0x72b4('0x3d')](_0x72b4('0x74'),_0xe693d3[_0x72b4('0x47')]['id']['toString']())[_0x72b4('0x3d')](_0x72b4('0x75'),_0xe693d3[_0x72b4('0x4c')][_0x72b4('0x76')]['toString']())[_0x72b4('0x3d')](_0x72b4('0x77'))['where'](_0x72b4('0x78'),squel[_0x72b4('0x79')]()['field'](_0x72b4('0x67'))[_0x72b4('0x7a')](_0x72b4('0x7b'))[_0x72b4('0x3d')](_0x72b4('0x74'),_0xe693d3[_0x72b4('0x47')]['id']['toString']()))['where'](_0x72b4('0x78'),squel['select']()[_0x72b4('0x6e')](_0x72b4('0x7c'))[_0x72b4('0x7a')](_0x72b4('0x73'))[_0x72b4('0x3d')]('VoiceQueueId\x20=\x20?',_0xe693d3[_0x72b4('0x47')]['id'][_0x72b4('0x7d')]())[_0x72b4('0x3d')](_0x72b4('0x7e')))[_0x72b4('0x7f')]('ContactId'))[_0x72b4('0x7d')]();return db[_0x72b4('0x4f')][_0x72b4('0x33')](_0x4a2fc5);}return[];})[_0x72b4('0x27')](respondWithResult(_0x3dccba,null))[_0x72b4('0x46')](handleError(_0x3dccba,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x402e78,_0x35463d,_0x20462b){return db['Campaign'][_0x72b4('0x63')]({'where':{'id':_0x402e78[_0x72b4('0x47')]['id']}})[_0x72b4('0x27')](handleEntityNotFound(_0x35463d,null))[_0x72b4('0x27')](function(_0x2c08b4){var _0x4045d3;if(_0x2c08b4){_0x4045d3=squel[_0x72b4('0x64')]()[_0x72b4('0x65')](_0x72b4('0x7b'))[_0x72b4('0x66')](['phone',_0x72b4('0x68'),_0x72b4('0x69'),_0x72b4('0x6a'),'CampaignId','createdAt',_0x72b4('0x6d')],squel[_0x72b4('0x79')]()['field'](_0x72b4('0x6f'),_0x72b4('0x67'))['field']('NOW()',_0x72b4('0x68'))[_0x72b4('0x6e')](_0x72b4('0x71'),'ContactId')[_0x72b4('0x6e')](_0x72b4('0x80'),_0x72b4('0x6a'))[_0x72b4('0x6e')](_0x72b4('0x81'),_0x72b4('0x82'))[_0x72b4('0x6e')](_0x72b4('0x70'),'createdAt')['field'](_0x72b4('0x70'),_0x72b4('0x6d'))[_0x72b4('0x7a')](_0x72b4('0x73'))['where'](_0x72b4('0x83'),_0x402e78[_0x72b4('0x47')]['id'][_0x72b4('0x7d')]())[_0x72b4('0x3d')](_0x72b4('0x75'),_0x402e78[_0x72b4('0x4c')][_0x72b4('0x76')][_0x72b4('0x7d')]())[_0x72b4('0x3d')](_0x72b4('0x77'))[_0x72b4('0x3d')](_0x72b4('0x78'),squel['select']()[_0x72b4('0x6e')](_0x72b4('0x67'))[_0x72b4('0x7a')](_0x72b4('0x7b'))[_0x72b4('0x3d')](_0x72b4('0x83'),_0x402e78['params']['id'][_0x72b4('0x7d')]()))[_0x72b4('0x3d')](_0x72b4('0x78'),squel['select']()[_0x72b4('0x6e')](_0x72b4('0x7c'))['from'](_0x72b4('0x73'))['where'](_0x72b4('0x83'),_0x402e78[_0x72b4('0x47')]['id'][_0x72b4('0x7d')]())[_0x72b4('0x3d')](_0x72b4('0x7e')))['group'](_0x72b4('0x69')))['toString']();return db[_0x72b4('0x4f')][_0x72b4('0x33')](_0x4045d3);}return[];})['then'](respondWithResult(_0x35463d,null))[_0x72b4('0x46')](handleError(_0x35463d,null));};exports[_0x72b4('0x84')]=function(_0x487ab6,_0x690a0f,_0x424eb9){return db[_0x72b4('0x85')][_0x72b4('0x86')]({'where':{'VoiceQueueId':_0x487ab6[_0x72b4('0x4c')][_0x72b4('0x6b')],'CampaignId':_0x487ab6[_0x72b4('0x4c')][_0x72b4('0x82')],'ContactId':_0x487ab6['body'][_0x72b4('0x69')]}})[_0x72b4('0x27')](handleEntityNotFound(_0x690a0f,null))[_0x72b4('0x27')](function(_0x4dd867){if(_0x4dd867){return _0x4dd867;}return null;})['then'](respondWithResult(_0x690a0f,null))[_0x72b4('0x46')](handleError(_0x690a0f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index c23ff86..6149ea3 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 _0x7dc2=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','../../config/logger','api','moment','bluebird','path','rimraf','./cmHopperFinal.attributes'];(function(_0xd5219c,_0x57e31c){var _0x3ea9a=function(_0x4cb47a){while(--_0x4cb47a){_0xd5219c['push'](_0xd5219c['shift']());}};_0x3ea9a(++_0x57e31c);}(_0x7dc2,0x19d));var _0x27dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dc2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x27dc('0x0'))(_0x27dc('0x1'));var moment=require(_0x27dc('0x2'));var BPromise=require(_0x27dc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27dc('0x4'));var rimraf=require(_0x27dc('0x5'));var config=require('../../config/environment');var attributes=require(_0x27dc('0x6'));module[_0x27dc('0x7')]=function(_0x5a442a,_0x29eaac){return _0x5a442a['define'](_0x27dc('0x8'),attributes,{'tableName':_0x27dc('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x27dc('0xa')]},{'name':_0x27dc('0xb'),'fields':[_0x27dc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc041=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','bluebird'];(function(_0x347fdf,_0x39e2b8){var _0x2a53b7=function(_0x3d40ff){while(--_0x3d40ff){_0x347fdf['push'](_0x347fdf['shift']());}};_0x2a53b7(++_0x39e2b8);}(_0xc041,0x1ea));var _0x1c04=function(_0x93d86c,_0x54e7ee){_0x93d86c=_0x93d86c-0x0;var _0x58e497=_0xc041[_0x93d86c];return _0x58e497;};'use strict';var _=require(_0x1c04('0x0'));var util=require(_0x1c04('0x1'));var logger=require('../../config/logger')(_0x1c04('0x2'));var moment=require('moment');var BPromise=require(_0x1c04('0x3'));var rp=require(_0x1c04('0x4'));var fs=require('fs');var path=require(_0x1c04('0x5'));var rimraf=require(_0x1c04('0x6'));var config=require(_0x1c04('0x7'));var attributes=require(_0x1c04('0x8'));module['exports']=function(_0x2a7bb2,_0x5acee0){return _0x2a7bb2['define'](_0x1c04('0x9'),attributes,{'tableName':_0x1c04('0xa'),'paranoid':![],'indexes':[{'name':_0x1c04('0xb'),'fields':[_0x1c04('0xb')]},{'name':_0x1c04('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index b5c4193..34f663f 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 _0x8b3b=['CmHopperFinal,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','options','raw','then','CreateCmHopperFinal','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x8b3b,0x6e));var _0xb8b3=function(_0x1fde53,_0x4e8b6c){_0x1fde53=_0x1fde53-0x0;var _0x987cce=_0x8b3b[_0x1fde53];return _0x987cce;};'use strict';var _=require('lodash');var util=require(_0xb8b3('0x0'));var moment=require('moment');var BPromise=require(_0xb8b3('0x1'));var rs=require(_0xb8b3('0x2'));var fs=require('fs');var Redis=require(_0xb8b3('0x3'));var db=require(_0xb8b3('0x4'))['db'];var utils=require(_0xb8b3('0x5'));var logger=require(_0xb8b3('0x6'))(_0xb8b3('0x7'));var config=require(_0xb8b3('0x8'));var jayson=require(_0xb8b3('0x9'));var client=jayson['client'][_0xb8b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1be041,_0x1528ef,_0x5366e4){return new BPromise(function(_0x5ade72,_0x198e83){return client[_0xb8b3('0xb')](_0x1be041,_0x5366e4)['then'](function(_0x5ca7fb){logger['info'](_0xb8b3('0xc'),_0x1528ef,_0xb8b3('0xd'));logger[_0xb8b3('0xe')](_0xb8b3('0xf'),_0x1528ef,_0xb8b3('0xd'),JSON['stringify'](_0x5ca7fb));if(_0x5ca7fb[_0xb8b3('0x10')]){if(_0x5ca7fb[_0xb8b3('0x10')]['code']===0x1f4){logger[_0xb8b3('0x10')](_0xb8b3('0xc'),_0x1528ef,_0x5ca7fb[_0xb8b3('0x10')][_0xb8b3('0x11')]);return _0x198e83(_0x5ca7fb[_0xb8b3('0x10')][_0xb8b3('0x11')]);}logger['error'](_0xb8b3('0xc'),_0x1528ef,_0x5ca7fb[_0xb8b3('0x10')][_0xb8b3('0x11')]);return _0x5ade72(_0x5ca7fb[_0xb8b3('0x10')][_0xb8b3('0x11')]);}else{logger[_0xb8b3('0x12')](_0xb8b3('0xc'),_0x1528ef,_0xb8b3('0xd'));_0x5ade72(_0x5ca7fb[_0xb8b3('0x13')][_0xb8b3('0x11')]);}})[_0xb8b3('0x14')](function(_0x432be5){logger[_0xb8b3('0x10')](_0xb8b3('0xc'),_0x1528ef,_0x432be5);_0x198e83(_0x432be5);});});}exports['CreateCmHopperFinal']=function(_0x53d5c2){var _0x57e588=this;return new Promise(function(_0x4f7638,_0x474aea){return db['CmHopperFinal']['create'](_0x53d5c2['body'],{'raw':_0x53d5c2[_0xb8b3('0x15')]?_0x53d5c2['options'][_0xb8b3('0x16')]===undefined?!![]:![]:!![]})[_0xb8b3('0x17')](function(_0x201039){logger[_0xb8b3('0x12')]('CreateCmHopperFinal',_0x53d5c2);logger[_0xb8b3('0xe')]('CreateCmHopperFinal',_0x53d5c2,JSON['stringify'](_0x201039));_0x4f7638(_0x201039);})[_0xb8b3('0x14')](function(_0x4836a2){logger[_0xb8b3('0x10')](_0xb8b3('0x18'),_0x4836a2[_0xb8b3('0x11')],_0x53d5c2);_0x474aea(_0x57e588[_0xb8b3('0x10')](0x1f4,_0x4836a2[_0xb8b3('0x11')]));});});}; \ No newline at end of file +var _0x9c2b=['CmHopperFinal,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','options','raw','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info'];(function(_0x495a2c,_0x47dca7){var _0x4163d4=function(_0x1a17ba){while(--_0x1a17ba){_0x495a2c['push'](_0x495a2c['shift']());}};_0x4163d4(++_0x47dca7);}(_0x9c2b,0x1a5));var _0xb9c2=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9c2b[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0xb9c2('0x0'));var moment=require('moment');var BPromise=require(_0xb9c2('0x1'));var rs=require(_0xb9c2('0x2'));var fs=require('fs');var Redis=require(_0xb9c2('0x3'));var db=require(_0xb9c2('0x4'))['db'];var utils=require(_0xb9c2('0x5'));var logger=require(_0xb9c2('0x6'))('rpc');var config=require(_0xb9c2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9c2('0x8')][_0xb9c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a2c2e,_0x2830ec,_0x156740){return new BPromise(function(_0x25d7a7,_0x4011bb){return client['request'](_0x4a2c2e,_0x156740)['then'](function(_0x3d9c98){logger[_0xb9c2('0xa')](_0xb9c2('0xb'),_0x2830ec,'request\x20sent');logger[_0xb9c2('0xc')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x2830ec,_0xb9c2('0xd'),JSON[_0xb9c2('0xe')](_0x3d9c98));if(_0x3d9c98['error']){if(_0x3d9c98[_0xb9c2('0xf')]['code']===0x1f4){logger[_0xb9c2('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0x2830ec,_0x3d9c98['error'][_0xb9c2('0x10')]);return _0x4011bb(_0x3d9c98[_0xb9c2('0xf')][_0xb9c2('0x10')]);}logger[_0xb9c2('0xf')](_0xb9c2('0xb'),_0x2830ec,_0x3d9c98['error']['message']);return _0x25d7a7(_0x3d9c98['error'][_0xb9c2('0x10')]);}else{logger['info']('CmHopperFinal,\x20%s,\x20%s',_0x2830ec,_0xb9c2('0xd'));_0x25d7a7(_0x3d9c98[_0xb9c2('0x11')][_0xb9c2('0x10')]);}})[_0xb9c2('0x12')](function(_0x1aaaee){logger[_0xb9c2('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0x2830ec,_0x1aaaee);_0x4011bb(_0x1aaaee);});});}exports[_0xb9c2('0x13')]=function(_0x3b4115){var _0x5e5aff=this;return new Promise(function(_0x4e67dd,_0x1f50ea){return db[_0xb9c2('0x14')]['create'](_0x3b4115['body'],{'raw':_0x3b4115[_0xb9c2('0x15')]?_0x3b4115['options'][_0xb9c2('0x16')]===undefined?!![]:![]:!![]})[_0xb9c2('0x17')](function(_0x13ae65){logger[_0xb9c2('0xa')](_0xb9c2('0x13'),_0x3b4115);logger[_0xb9c2('0xc')](_0xb9c2('0x13'),_0x3b4115,JSON['stringify'](_0x13ae65));_0x4e67dd(_0x13ae65);})['catch'](function(_0x18745c){logger[_0xb9c2('0xf')](_0xb9c2('0x13'),_0x18745c['message'],_0x3b4115);_0x1f50ea(_0x5e5aff['error'](0x1f4,_0x18745c[_0xb9c2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index cd309f6..6a1c84e 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 _0x813f=['describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','/describe','isAuthenticated'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x813f,0x109));var _0xf813=function(_0x2c5581,_0x1b6304){_0x2c5581=_0x2c5581-0x0;var _0x5c21b8=_0x813f[_0x2c5581];return _0x5c21b8;};'use strict';var multer=require(_0xf813('0x0'));var util=require(_0xf813('0x1'));var path=require(_0xf813('0x2'));var timeout=require(_0xf813('0x3'));var express=require('express');var router=express[_0xf813('0x4')]();var auth=require(_0xf813('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf813('0x6'));var controller=require(_0xf813('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf813('0x8')](_0xf813('0x9'),auth[_0xf813('0xa')](),controller[_0xf813('0xb')]);router[_0xf813('0x8')](_0xf813('0xc'),auth[_0xf813('0xa')](),controller[_0xf813('0xd')]);router['get'](_0xf813('0xe'),auth[_0xf813('0xa')](),controller[_0xf813('0xf')]);router[_0xf813('0x8')]('/campaign/countAttributes/:id',auth[_0xf813('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xf813('0x10'),auth[_0xf813('0xa')](),controller[_0xf813('0x11')]);router[_0xf813('0x12')]('/voice/campaign/moveContacts/:id',auth[_0xf813('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xf813('0x13'),auth[_0xf813('0xa')](),controller[_0xf813('0x14')]);router[_0xf813('0x15')]('/:id',auth[_0xf813('0xa')](),controller['update']);module[_0xf813('0x16')]=router; \ No newline at end of file +var _0x55e8=['moveContactsIvrCampaignHopperFinal','checkContactHopper','put','multer','util','connect-timeout','Router','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id'];(function(_0x31d7ca,_0x4984b5){var _0xd03b29=function(_0x332b4e){while(--_0x332b4e){_0x31d7ca['push'](_0x31d7ca['shift']());}};_0xd03b29(++_0x4984b5);}(_0x55e8,0x17d));var _0x855e=function(_0x344796,_0x4cc579){_0x344796=_0x344796-0x0;var _0x187bb5=_0x55e8[_0x344796];return _0x187bb5;};'use strict';var multer=require(_0x855e('0x0'));var util=require(_0x855e('0x1'));var path=require('path');var timeout=require(_0x855e('0x2'));var express=require('express');var router=express[_0x855e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x855e('0x4'));var config=require('../../config/environment');var controller=require(_0x855e('0x5'));router[_0x855e('0x6')]('/',auth[_0x855e('0x7')](),controller[_0x855e('0x8')]);router[_0x855e('0x6')](_0x855e('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x855e('0x6')](_0x855e('0xa'),auth[_0x855e('0x7')](),controller['show']);router[_0x855e('0x6')](_0x855e('0xb'),auth[_0x855e('0x7')](),controller[_0x855e('0xc')]);router[_0x855e('0x6')](_0x855e('0xd'),auth[_0x855e('0x7')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x855e('0xe')](_0x855e('0xf'),auth[_0x855e('0x7')](),controller[_0x855e('0x10')]);router['post'](_0x855e('0x11'),auth[_0x855e('0x7')](),controller[_0x855e('0x12')]);router[_0x855e('0xe')]('/checkContactHopper',auth[_0x855e('0x7')](),controller[_0x855e('0x13')]);router[_0x855e('0x14')](_0x855e('0xa'),auth[_0x855e('0x7')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b05f9f3..7571da2 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 _0x2164=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x54a154,_0x1e6a06){var _0x25d7ca=function(_0x14aa1b){while(--_0x14aa1b){_0x54a154['push'](_0x54a154['shift']());}};_0x25d7ca(++_0x1e6a06);}(_0x2164,0x197));var _0x4216=function(_0x162080,_0xb26805){_0x162080=_0x162080-0x0;var _0x4db3d0=_0x2164[_0x162080];return _0x4db3d0;};'use strict';var Sequelize=require(_0x4216('0x0'));module['exports']={'state':{'type':Sequelize[_0x4216('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4216('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4216('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x4216('0x2')]},'originatecalleridname':{'type':Sequelize[_0x4216('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4216('0x2')]},'starttime':{'type':Sequelize[_0x4216('0x3')]},'responsetime':{'type':Sequelize[_0x4216('0x3')]},'answertime':{'type':Sequelize[_0x4216('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4216('0x3')]},'ringtime':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4216('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x4216('0x2')]},'membername':{'type':Sequelize[_0x4216('0x2')]},'reason':{'type':Sequelize[_0x4216('0x2')]},'amd':{'type':Sequelize[_0x4216('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4216('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x4216('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4216('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4216('0x3')]},'recallme':{'type':Sequelize[_0x4216('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4216('0x3')]},'edited':{'type':Sequelize[_0x4216('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4216('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4216('0x2')]}}; \ No newline at end of file +var _0x47a4=['BOOLEAN','INTEGER','STRING','DATE'];(function(_0x1c979d,_0x2cb004){var _0x4ad89c=function(_0xb5e234){while(--_0xb5e234){_0x1c979d['push'](_0x1c979d['shift']());}};_0x4ad89c(++_0x2cb004);}(_0x47a4,0x9d));var _0x447a=function(_0x1a6d40,_0x190810){_0x1a6d40=_0x1a6d40-0x0;var _0x348477=_0x47a4[_0x1a6d40];return _0x348477;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x447a('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x447a('0x1')]},'scheduledat':{'type':Sequelize[_0x447a('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x447a('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x447a('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x447a('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x447a('0x1')]},'calleridnum':{'type':Sequelize[_0x447a('0x1')]},'calleridname':{'type':Sequelize[_0x447a('0x1')]},'starttime':{'type':Sequelize[_0x447a('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x447a('0x2')]},'droptime':{'type':Sequelize[_0x447a('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x447a('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x447a('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x447a('0x1')]},'campaign':{'type':Sequelize[_0x447a('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x447a('0x1')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x447a('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x447a('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x447a('0x2')]},'recallme':{'type':Sequelize[_0x447a('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x447a('0x2')]},'edited':{'type':Sequelize[_0x447a('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x447a('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x447a('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x447a('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x447a('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x447a('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 755d6f6..0f0024c 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 _0xbc34=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','reject','save','update','then','error','stack','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','includeAll','find','create','describe','body','uniqueid','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x8c7980,_0x5088af){var _0xdbd55=function(_0x11bd8e){while(--_0x11bd8e){_0x8c7980['push'](_0x8c7980['shift']());}};_0xdbd55(++_0x5088af);}(_0xbc34,0x116));var _0x4bc3=function(_0x475703,_0x189bdf){_0x475703=_0x475703-0x0;var _0x32e41f=_0xbc34[_0x475703];return _0x32e41f;};'use strict';var pdf=require(_0x4bc3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4bc3('0x1'));var zipdir=require(_0x4bc3('0x2'));var jsonpatch=require(_0x4bc3('0x3'));var rp=require(_0x4bc3('0x4'));var moment=require(_0x4bc3('0x5'));var BPromise=require(_0x4bc3('0x6'));var Mustache=require('mustache');var util=require(_0x4bc3('0x7'));var path=require('path');var sox=require(_0x4bc3('0x8'));var csv=require(_0x4bc3('0x9'));var ejs=require(_0x4bc3('0xa'));var fs=require('fs');var _=require(_0x4bc3('0xb'));var squel=require(_0x4bc3('0xc'));var crypto=require(_0x4bc3('0xd'));var jsforce=require(_0x4bc3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4bc3('0x9'));var querystring=require(_0x4bc3('0xf'));var Papa=require('papaparse');var Redis=require(_0x4bc3('0x10'));var authService=require(_0x4bc3('0x11'));var qs=require(_0x4bc3('0x12'));var as=require(_0x4bc3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bc3('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4bc3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bc583,_0x2f61b5){_0x2f61b5=_0x2f61b5||0xcc;return function(_0x4c49c0){if(_0x4c49c0){return _0x5bc583[_0x4bc3('0x16')](_0x2f61b5);}return _0x5bc583[_0x4bc3('0x17')](_0x2f61b5)[_0x4bc3('0x18')]();};}function respondWithResult(_0x4cf839,_0x4c8b68){_0x4c8b68=_0x4c8b68||0xc8;return function(_0x1ef111){if(_0x1ef111){return _0x4cf839[_0x4bc3('0x17')](_0x4c8b68)['json'](_0x1ef111);}};}function respondWithFilteredResult(_0x56f7eb,_0x4ad515){return function(_0x199295){if(_0x199295){var _0x3cfa14=_0x199295[_0x4bc3('0x19')],_0x27609b=_0x4ad515[_0x4bc3('0x1a')],_0x145d59=_0x4ad515['offset']+_0x4ad515['limit'],_0x153843;if(_0x145d59>=_0x3cfa14){_0x145d59=_0x3cfa14;_0x153843=0xc8;}else{_0x153843=0xce;}_0x56f7eb[_0x4bc3('0x17')](_0x153843);return _0x56f7eb[_0x4bc3('0x1b')](_0x4bc3('0x1c'),_0x27609b+'-'+_0x145d59+'/'+_0x3cfa14)['json'](_0x199295);}return null;};}function patchUpdates(_0x251175){return function(_0x13d351){try{jsonpatch['apply'](_0x13d351,_0x251175,!![]);}catch(_0x36afba){return BPromise[_0x4bc3('0x1d')](_0x36afba);}return _0x13d351[_0x4bc3('0x1e')]();};}function saveUpdates(_0xf2fad8,_0x2620b1){return function(_0x5c03e){if(_0x5c03e){return _0x5c03e[_0x4bc3('0x1f')](_0xf2fad8)[_0x4bc3('0x20')](function(_0x2c9f3f){return _0x2c9f3f;});}return null;};}function removeEntity(_0x328284,_0x5ac47b){return function(_0x4b33f7){if(_0x4b33f7){return _0x4b33f7['destroy']()[_0x4bc3('0x20')](function(){_0x328284[_0x4bc3('0x17')](0xcc)[_0x4bc3('0x18')]();});}};}function handleEntityNotFound(_0x3ef299,_0x333916){return function(_0x1f0671){if(!_0x1f0671){_0x3ef299[_0x4bc3('0x16')](0x194);}return _0x1f0671;};}function handleError(_0x38f82c,_0x3f72fe){_0x3f72fe=_0x3f72fe||0x1f4;return function(_0x1fa6d9){logger[_0x4bc3('0x21')](_0x1fa6d9[_0x4bc3('0x22')]);if(_0x1fa6d9['name']){delete _0x1fa6d9['name'];}_0x38f82c[_0x4bc3('0x17')](_0x3f72fe)[_0x4bc3('0x23')](_0x1fa6d9);};}exports[_0x4bc3('0x24')]=function(_0x392e00,_0x1ce219){var _0x454ff7={},_0x5786df={},_0x56922d={'count':0x0,'rows':[]};var _0x1c5c26=_['map'](db[_0x4bc3('0x25')][_0x4bc3('0x26')],function(_0x130f9a){return{'name':_0x130f9a[_0x4bc3('0x27')],'type':_0x130f9a[_0x4bc3('0x28')][_0x4bc3('0x29')]};});_0x5786df[_0x4bc3('0x2a')]=_[_0x4bc3('0x2b')](_0x1c5c26,_0x4bc3('0x2c'));_0x5786df[_0x4bc3('0x2d')]=_[_0x4bc3('0x2e')](_0x392e00[_0x4bc3('0x2d')]);_0x5786df[_0x4bc3('0x2f')]=_[_0x4bc3('0x30')](_0x5786df[_0x4bc3('0x2a')],_0x5786df[_0x4bc3('0x2d')]);_0x454ff7[_0x4bc3('0x31')]=_[_0x4bc3('0x30')](_0x5786df[_0x4bc3('0x2a')],qs[_0x4bc3('0x32')](_0x392e00['query']['fields']));_0x454ff7[_0x4bc3('0x31')]=_0x454ff7[_0x4bc3('0x31')][_0x4bc3('0x33')]?_0x454ff7[_0x4bc3('0x31')]:_0x5786df[_0x4bc3('0x2a')];if(!_0x392e00[_0x4bc3('0x2d')][_0x4bc3('0x34')](_0x4bc3('0x35'))){_0x454ff7[_0x4bc3('0x36')]=qs[_0x4bc3('0x36')](_0x392e00['query'][_0x4bc3('0x36')]);_0x454ff7[_0x4bc3('0x1a')]=qs['offset'](_0x392e00[_0x4bc3('0x2d')][_0x4bc3('0x1a')]);}_0x454ff7[_0x4bc3('0x37')]=qs['sort'](_0x392e00[_0x4bc3('0x2d')][_0x4bc3('0x38')]);_0x454ff7[_0x4bc3('0x39')]=qs[_0x4bc3('0x2f')](_[_0x4bc3('0x3a')](_0x392e00[_0x4bc3('0x2d')],_0x5786df['filters']),_0x1c5c26);if(_0x392e00[_0x4bc3('0x2d')]['filter']){_0x454ff7[_0x4bc3('0x39')]=_[_0x4bc3('0x3b')](_0x454ff7[_0x4bc3('0x39')],{'$or':_[_0x4bc3('0x2b')](_0x1c5c26,function(_0x32e1bf){if(_0x32e1bf[_0x4bc3('0x28')]!==_0x4bc3('0x3c')){var _0x50dc59={};_0x50dc59[_0x32e1bf[_0x4bc3('0x2c')]]={'$like':'%'+_0x392e00[_0x4bc3('0x2d')][_0x4bc3('0x3d')]+'%'};return _0x50dc59;}})});}_0x454ff7=_[_0x4bc3('0x3b')]({},_0x454ff7,_0x392e00[_0x4bc3('0x3e')]);var _0x46fb42={'where':_0x454ff7[_0x4bc3('0x39')]};return db['CmHopperHistory'][_0x4bc3('0x19')](_0x46fb42)[_0x4bc3('0x20')](function(_0x36980a){_0x56922d[_0x4bc3('0x19')]=_0x36980a;if(_0x392e00['query']['includeAll']){_0x454ff7[_0x4bc3('0x3f')]=[{'all':!![]}];}return db[_0x4bc3('0x25')][_0x4bc3('0x40')](_0x454ff7);})['then'](function(_0x528239){_0x56922d[_0x4bc3('0x41')]=_0x528239;return _0x56922d;})[_0x4bc3('0x20')](respondWithFilteredResult(_0x1ce219,_0x454ff7))[_0x4bc3('0x42')](handleError(_0x1ce219,null));};exports['show']=function(_0x4b52c0,_0x24cc4e){var _0x50e8ce={'raw':!![],'where':{'id':_0x4b52c0[_0x4bc3('0x43')]['id']}},_0x43bcb8={};_0x43bcb8[_0x4bc3('0x2a')]=_[_0x4bc3('0x2e')](db['CmHopperHistory'][_0x4bc3('0x26')]);_0x43bcb8[_0x4bc3('0x2d')]=_[_0x4bc3('0x2e')](_0x4b52c0['query']);_0x43bcb8['filters']=_[_0x4bc3('0x30')](_0x43bcb8[_0x4bc3('0x2a')],_0x43bcb8[_0x4bc3('0x2d')]);_0x50e8ce[_0x4bc3('0x31')]=_[_0x4bc3('0x30')](_0x43bcb8[_0x4bc3('0x2a')],qs['fields'](_0x4b52c0[_0x4bc3('0x2d')][_0x4bc3('0x32')]));_0x50e8ce[_0x4bc3('0x31')]=_0x50e8ce['attributes'][_0x4bc3('0x33')]?_0x50e8ce[_0x4bc3('0x31')]:_0x43bcb8['model'];if(_0x4b52c0['query'][_0x4bc3('0x44')]){_0x50e8ce['include']=[{'all':!![]}];}_0x50e8ce=_[_0x4bc3('0x3b')]({},_0x50e8ce,_0x4b52c0['options']);return db[_0x4bc3('0x25')][_0x4bc3('0x45')](_0x50e8ce)['then'](handleEntityNotFound(_0x24cc4e,null))['then'](respondWithResult(_0x24cc4e,null))[_0x4bc3('0x42')](handleError(_0x24cc4e,null));};exports[_0x4bc3('0x46')]=function(_0x1fbee2,_0x4efd10){return db['CmHopperHistory'][_0x4bc3('0x46')](_0x1fbee2['body'],{})[_0x4bc3('0x20')](respondWithResult(_0x4efd10,0xc9))['catch'](handleError(_0x4efd10,null));};exports[_0x4bc3('0x47')]=function(_0xe7f062,_0x2ba6c7){return db[_0x4bc3('0x25')]['describe']()[_0x4bc3('0x20')](respondWithResult(_0x2ba6c7,null))[_0x4bc3('0x42')](handleError(_0x2ba6c7,null));};exports[_0x4bc3('0x1f')]=function(_0x3e5472,_0x6d1c59){if(_0x3e5472[_0x4bc3('0x48')][_0x4bc3('0x49')]){delete _0x3e5472[_0x4bc3('0x48')][_0x4bc3('0x49')];}return db[_0x4bc3('0x25')][_0x4bc3('0x45')]({'where':{'uniqueid':_0x3e5472[_0x4bc3('0x43')]['id']}})[_0x4bc3('0x20')](handleEntityNotFound(_0x6d1c59,null))['then'](saveUpdates(_0x3e5472[_0x4bc3('0x48')],null))['then'](respondWithResult(_0x6d1c59,null))[_0x4bc3('0x42')](handleError(_0x6d1c59,null));}; \ No newline at end of file +var _0x1007=['set','Content-Range','reject','save','update','end','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','then','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','describe','uniqueid','eml-format','zip-dir','moment','bluebird','util','path','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','json','count','offset','limit'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0x1007,0xc1));var _0x7100=function(_0x5d5951,_0x3b0a0c){_0x5d5951=_0x5d5951-0x0;var _0x5c4e51=_0x1007[_0x5d5951];return _0x5c4e51;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7100('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7100('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7100('0x2'));var BPromise=require(_0x7100('0x3'));var Mustache=require('mustache');var util=require(_0x7100('0x4'));var path=require(_0x7100('0x5'));var sox=require('sox');var csv=require(_0x7100('0x6'));var ejs=require(_0x7100('0x7'));var fs=require('fs');var _=require(_0x7100('0x8'));var squel=require(_0x7100('0x9'));var crypto=require(_0x7100('0xa'));var jsforce=require(_0x7100('0xb'));var deskjs=require(_0x7100('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7100('0xd'));var Papa=require(_0x7100('0xe'));var Redis=require('ioredis');var authService=require(_0x7100('0xf'));var qs=require(_0x7100('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7100('0x11'));var logger=require(_0x7100('0x12'))(_0x7100('0x13'));var utils=require(_0x7100('0x14'));var config=require(_0x7100('0x15'));var db=require(_0x7100('0x16'))['db'];function respondWithStatusCode(_0x416e21,_0x56eedc){_0x56eedc=_0x56eedc||0xcc;return function(_0x2dd9bd){if(_0x2dd9bd){return _0x416e21[_0x7100('0x17')](_0x56eedc);}return _0x416e21[_0x7100('0x18')](_0x56eedc)['end']();};}function respondWithResult(_0x161007,_0xefba3c){_0xefba3c=_0xefba3c||0xc8;return function(_0x4bfdfc){if(_0x4bfdfc){return _0x161007[_0x7100('0x18')](_0xefba3c)[_0x7100('0x19')](_0x4bfdfc);}};}function respondWithFilteredResult(_0x266c46,_0x6953e3){return function(_0x44059){if(_0x44059){var _0x122e6=_0x44059[_0x7100('0x1a')],_0x2caa5f=_0x6953e3[_0x7100('0x1b')],_0x3a269a=_0x6953e3['offset']+_0x6953e3[_0x7100('0x1c')],_0x39ab93;if(_0x3a269a>=_0x122e6){_0x3a269a=_0x122e6;_0x39ab93=0xc8;}else{_0x39ab93=0xce;}_0x266c46[_0x7100('0x18')](_0x39ab93);return _0x266c46[_0x7100('0x1d')](_0x7100('0x1e'),_0x2caa5f+'-'+_0x3a269a+'/'+_0x122e6)[_0x7100('0x19')](_0x44059);}return null;};}function patchUpdates(_0x1be06b){return function(_0x360067){try{jsonpatch['apply'](_0x360067,_0x1be06b,!![]);}catch(_0xe549f2){return BPromise[_0x7100('0x1f')](_0xe549f2);}return _0x360067[_0x7100('0x20')]();};}function saveUpdates(_0x47bf42,_0x2cef25){return function(_0x5b2e86){if(_0x5b2e86){return _0x5b2e86[_0x7100('0x21')](_0x47bf42)['then'](function(_0x1d32a0){return _0x1d32a0;});}return null;};}function removeEntity(_0x502656,_0x537bd4){return function(_0x27a6c2){if(_0x27a6c2){return _0x27a6c2['destroy']()['then'](function(){_0x502656[_0x7100('0x18')](0xcc)[_0x7100('0x22')]();});}};}function handleEntityNotFound(_0x2bac43,_0x106b93){return function(_0x44a266){if(!_0x44a266){_0x2bac43['sendStatus'](0x194);}return _0x44a266;};}function handleError(_0x3afc0d,_0xa565b3){_0xa565b3=_0xa565b3||0x1f4;return function(_0x2eb293){logger[_0x7100('0x23')](_0x2eb293[_0x7100('0x24')]);if(_0x2eb293[_0x7100('0x25')]){delete _0x2eb293[_0x7100('0x25')];}_0x3afc0d[_0x7100('0x18')](_0xa565b3)['send'](_0x2eb293);};}exports[_0x7100('0x26')]=function(_0x3de830,_0x2ff9e7){var _0x56210a={},_0x2a4dcb={},_0x2650d0={'count':0x0,'rows':[]};var _0x595de5=_[_0x7100('0x27')](db[_0x7100('0x28')][_0x7100('0x29')],function(_0x5b02fb){return{'name':_0x5b02fb[_0x7100('0x2a')],'type':_0x5b02fb[_0x7100('0x2b')][_0x7100('0x2c')]};});_0x2a4dcb[_0x7100('0x2d')]=_['map'](_0x595de5,_0x7100('0x25'));_0x2a4dcb[_0x7100('0x2e')]=_[_0x7100('0x2f')](_0x3de830['query']);_0x2a4dcb['filters']=_[_0x7100('0x30')](_0x2a4dcb['model'],_0x2a4dcb[_0x7100('0x2e')]);_0x56210a[_0x7100('0x31')]=_[_0x7100('0x30')](_0x2a4dcb[_0x7100('0x2d')],qs['fields'](_0x3de830[_0x7100('0x2e')][_0x7100('0x32')]));_0x56210a[_0x7100('0x31')]=_0x56210a[_0x7100('0x31')]['length']?_0x56210a['attributes']:_0x2a4dcb[_0x7100('0x2d')];if(!_0x3de830[_0x7100('0x2e')][_0x7100('0x33')]('nolimit')){_0x56210a[_0x7100('0x1c')]=qs[_0x7100('0x1c')](_0x3de830[_0x7100('0x2e')][_0x7100('0x1c')]);_0x56210a[_0x7100('0x1b')]=qs['offset'](_0x3de830[_0x7100('0x2e')][_0x7100('0x1b')]);}_0x56210a[_0x7100('0x34')]=qs[_0x7100('0x35')](_0x3de830[_0x7100('0x2e')]['sort']);_0x56210a['where']=qs[_0x7100('0x36')](_['pick'](_0x3de830[_0x7100('0x2e')],_0x2a4dcb[_0x7100('0x36')]),_0x595de5);if(_0x3de830[_0x7100('0x2e')][_0x7100('0x37')]){_0x56210a[_0x7100('0x38')]=_[_0x7100('0x39')](_0x56210a[_0x7100('0x38')],{'$or':_[_0x7100('0x27')](_0x595de5,function(_0x5439ab){if(_0x5439ab['type']!==_0x7100('0x3a')){var _0x169f3f={};_0x169f3f[_0x5439ab[_0x7100('0x25')]]={'$like':'%'+_0x3de830[_0x7100('0x2e')][_0x7100('0x37')]+'%'};return _0x169f3f;}})});}_0x56210a=_[_0x7100('0x39')]({},_0x56210a,_0x3de830[_0x7100('0x3b')]);var _0xebe411={'where':_0x56210a[_0x7100('0x38')]};return db[_0x7100('0x28')][_0x7100('0x1a')](_0xebe411)[_0x7100('0x3c')](function(_0x384d77){_0x2650d0[_0x7100('0x1a')]=_0x384d77;if(_0x3de830[_0x7100('0x2e')]['includeAll']){_0x56210a[_0x7100('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7100('0x3e')](_0x56210a);})['then'](function(_0xa2524b){_0x2650d0[_0x7100('0x3f')]=_0xa2524b;return _0x2650d0;})[_0x7100('0x3c')](respondWithFilteredResult(_0x2ff9e7,_0x56210a))['catch'](handleError(_0x2ff9e7,null));};exports[_0x7100('0x40')]=function(_0x440481,_0x1f16a9){var _0x4370ef={'raw':!![],'where':{'id':_0x440481[_0x7100('0x41')]['id']}},_0x5b6ab2={};_0x5b6ab2[_0x7100('0x2d')]=_[_0x7100('0x2f')](db[_0x7100('0x28')]['rawAttributes']);_0x5b6ab2[_0x7100('0x2e')]=_[_0x7100('0x2f')](_0x440481[_0x7100('0x2e')]);_0x5b6ab2[_0x7100('0x36')]=_[_0x7100('0x30')](_0x5b6ab2['model'],_0x5b6ab2[_0x7100('0x2e')]);_0x4370ef['attributes']=_[_0x7100('0x30')](_0x5b6ab2[_0x7100('0x2d')],qs[_0x7100('0x32')](_0x440481[_0x7100('0x2e')][_0x7100('0x32')]));_0x4370ef['attributes']=_0x4370ef[_0x7100('0x31')][_0x7100('0x42')]?_0x4370ef[_0x7100('0x31')]:_0x5b6ab2[_0x7100('0x2d')];if(_0x440481[_0x7100('0x2e')][_0x7100('0x43')]){_0x4370ef[_0x7100('0x3d')]=[{'all':!![]}];}_0x4370ef=_[_0x7100('0x39')]({},_0x4370ef,_0x440481['options']);return db[_0x7100('0x28')][_0x7100('0x44')](_0x4370ef)[_0x7100('0x3c')](handleEntityNotFound(_0x1f16a9,null))[_0x7100('0x3c')](respondWithResult(_0x1f16a9,null))[_0x7100('0x45')](handleError(_0x1f16a9,null));};exports[_0x7100('0x46')]=function(_0x3c4442,_0x403eb3){return db[_0x7100('0x28')][_0x7100('0x46')](_0x3c4442[_0x7100('0x47')],{})[_0x7100('0x3c')](respondWithResult(_0x403eb3,0xc9))[_0x7100('0x45')](handleError(_0x403eb3,null));};exports['describe']=function(_0x4a02e8,_0x4748be){return db[_0x7100('0x28')][_0x7100('0x48')]()[_0x7100('0x3c')](respondWithResult(_0x4748be,null))[_0x7100('0x45')](handleError(_0x4748be,null));};exports[_0x7100('0x21')]=function(_0x4b6abb,_0x53932d){if(_0x4b6abb[_0x7100('0x47')][_0x7100('0x49')]){delete _0x4b6abb[_0x7100('0x47')]['uniqueid'];}return db['CmHopperHistory'][_0x7100('0x44')]({'where':{'uniqueid':_0x4b6abb[_0x7100('0x41')]['id']}})[_0x7100('0x3c')](handleEntityNotFound(_0x53932d,null))['then'](saveUpdates(_0x4b6abb[_0x7100('0x47')],null))['then'](respondWithResult(_0x53932d,null))[_0x7100('0x45')](handleError(_0x53932d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e663d60..7943ac0 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 _0xe0e8=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0xf1c51,_0xc31d7d){var _0x36acf6=function(_0xd1c4a4){while(--_0xd1c4a4){_0xf1c51['push'](_0xf1c51['shift']());}};_0x36acf6(++_0xc31d7d);}(_0xe0e8,0xe9));var _0x8e0e=function(_0x3df248,_0x3fb9cc){_0x3df248=_0x3df248-0x0;var _0x3509c5=_0xe0e8[_0x3df248];return _0x3509c5;};'use strict';var _=require(_0x8e0e('0x0'));var util=require('util');var logger=require(_0x8e0e('0x1'))('api');var moment=require(_0x8e0e('0x2'));var BPromise=require(_0x8e0e('0x3'));var rp=require(_0x8e0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e0e('0x5'));var config=require(_0x8e0e('0x6'));var attributes=require(_0x8e0e('0x7'));module[_0x8e0e('0x8')]=function(_0x449b27,_0x221f0b){return _0x449b27[_0x8e0e('0x9')]('CmHopperHistory',attributes,{'tableName':_0x8e0e('0xa'),'paranoid':![],'indexes':[{'name':_0x8e0e('0xb'),'fields':[_0x8e0e('0xb')]},{'name':_0x8e0e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x203f=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x1c03c9,_0xe76eae){var _0x46b403=function(_0xe28728){while(--_0xe28728){_0x1c03c9['push'](_0x1c03c9['shift']());}};_0x46b403(++_0xe76eae);}(_0x203f,0x187));var _0xf203=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x203f[_0x3bef2c];return _0x331503;};'use strict';var _=require(_0xf203('0x0'));var util=require(_0xf203('0x1'));var logger=require(_0xf203('0x2'))(_0xf203('0x3'));var moment=require(_0xf203('0x4'));var BPromise=require(_0xf203('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf203('0x6'));var rimraf=require('rimraf');var config=require(_0xf203('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xf203('0x8')]=function(_0x213525,_0x240cf9){return _0x213525[_0xf203('0x9')](_0xf203('0xa'),attributes,{'tableName':_0xf203('0xb'),'paranoid':![],'indexes':[{'name':_0xf203('0xc'),'fields':[_0xf203('0xc')]},{'name':'uniqueid','fields':[_0xf203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 8786dbf..6950c03 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 _0xb688=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','predictiveIntervalAnsweredCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x484609,_0x209f3c){var _0x464eac=function(_0x177e7b){while(--_0x177e7b){_0x484609['push'](_0x484609['shift']());}};_0x464eac(++_0x209f3c);}(_0xb688,0xcf));var _0x8b68=function(_0x5c595a,_0x582302){_0x5c595a=_0x5c595a-0x0;var _0x17d798=_0xb688[_0x5c595a];return _0x17d798;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var moment=require(_0x8b68('0x1'));var BPromise=require(_0x8b68('0x2'));var rs=require(_0x8b68('0x3'));var fs=require('fs');var Redis=require(_0x8b68('0x4'));var db=require(_0x8b68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var config=require(_0x8b68('0x8'));var jayson=require(_0x8b68('0x9'));var client=jayson['client'][_0x8b68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ee56,_0x37677d,_0x2bbffd){return new BPromise(function(_0x130892,_0xa5571b){return client[_0x8b68('0xb')](_0x57ee56,_0x2bbffd)[_0x8b68('0xc')](function(_0x261753){logger[_0x8b68('0xd')](_0x8b68('0xe'),_0x37677d,_0x8b68('0xf'));logger[_0x8b68('0x10')](_0x8b68('0x11'),_0x37677d,_0x8b68('0xf'),JSON['stringify'](_0x261753));if(_0x261753[_0x8b68('0x12')]){if(_0x261753[_0x8b68('0x12')][_0x8b68('0x13')]===0x1f4){logger[_0x8b68('0x12')](_0x8b68('0xe'),_0x37677d,_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);return _0xa5571b(_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);}logger['error'](_0x8b68('0xe'),_0x37677d,_0x261753['error']['message']);return _0x130892(_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);}else{logger[_0x8b68('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x37677d,'request\x20sent');_0x130892(_0x261753[_0x8b68('0x15')]['message']);}})[_0x8b68('0x16')](function(_0xb44923){logger[_0x8b68('0x12')](_0x8b68('0xe'),_0x37677d,_0xb44923);_0xa5571b(_0xb44923);});});}exports['CreateCmHopperHistory']=function(_0xd17693){var _0x203dd4=this;return new Promise(function(_0x4a68c7,_0x42b3bd){return db[_0x8b68('0x17')][_0x8b68('0x18')](_0xd17693[_0x8b68('0x19')],{'raw':_0xd17693[_0x8b68('0x1a')]?_0xd17693['options'][_0x8b68('0x1b')]===undefined?!![]:![]:!![]})[_0x8b68('0xc')](function(_0x59e9b1){logger[_0x8b68('0xd')](_0x8b68('0x1c'),_0xd17693);logger[_0x8b68('0x10')]('CreateCmHopperHistory',_0xd17693,JSON['stringify'](_0x59e9b1));_0x4a68c7(_0x59e9b1);})[_0x8b68('0x16')](function(_0x59cb26){logger[_0x8b68('0x12')](_0x8b68('0x1c'),_0x59cb26[_0x8b68('0x14')],_0xd17693);_0x42b3bd(_0x203dd4[_0x8b68('0x12')](0x1f4,_0x59cb26[_0x8b68('0x14')]));});});};exports[_0x8b68('0x1d')]=function(_0x59bb8a){var _0x1a6fe8=this;return new Promise(function(_0x46e827,_0x4ca77d){return db[_0x8b68('0x17')][_0x8b68('0x1e')]({'raw':_0x59bb8a[_0x8b68('0x1a')]?_0x59bb8a['options']['raw']===undefined?!![]:![]:!![],'where':_0x59bb8a['options']?_0x59bb8a[_0x8b68('0x1a')][_0x8b68('0x1f')]||null:null,'attributes':[[db[_0x8b68('0x20')]['fn']('COUNT',db[_0x8b68('0x20')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x8b68('0x20')]['fn']('COUNT',db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x8b68('0x21')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x8b68('0x20')]['fn']('COUNT',db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')]['literal'](_0x8b68('0x25')))),_0x8b68('0x26')],[db[_0x8b68('0x20')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x27')))),_0x8b68('0x28')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x29'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x2a')))),_0x8b68('0x2b')]]})[_0x8b68('0xc')](function(_0x232fa9){logger[_0x8b68('0xd')](_0x8b68('0x1d'),_0x59bb8a);logger[_0x8b68('0x10')](_0x8b68('0x1d'),_0x59bb8a,JSON[_0x8b68('0x2c')](_0x232fa9));_0x46e827(_0x232fa9);})[_0x8b68('0x16')](function(_0x18dfae){logger[_0x8b68('0x12')](_0x8b68('0x1d'),_0x18dfae['message'],_0x59bb8a);_0x4ca77d(_0x1a6fe8['error'](0x1f4,_0x18dfae[_0x8b68('0x14')]));});});};exports[_0x8b68('0x2d')]=function(_0x23554d){var _0xb9b5b1=this;return new Promise(function(_0xf2154f,_0xce486c){return db[_0x8b68('0x17')][_0x8b68('0x1e')]({'raw':_0x23554d['options']?_0x23554d[_0x8b68('0x1a')][_0x8b68('0x1b')]===undefined?!![]:![]:!![],'where':_0x23554d[_0x8b68('0x1a')]?_0x23554d[_0x8b68('0x1a')][_0x8b68('0x1f')]||null:null,'attributes':[[_0x8b68('0x2e'),_0x8b68('0x2f')],[db[_0x8b68('0x20')]['fn']('COUNT',db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x30')))),_0x8b68('0x31')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')]('`state`\x20=\x203,\x201,\x20null'))),_0x8b68('0x32')],[db[_0x8b68('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x8b68('0x33')))),_0x8b68('0x34')],[db['sequelize']['fn'](_0x8b68('0x22'),db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')]('`state`\x20=\x205,\x201,\x20null'))),_0x8b68('0x35')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x36')))),_0x8b68('0x37')],[db['sequelize']['fn'](_0x8b68('0x22'),db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8b68('0x38')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db['sequelize'][_0x8b68('0x23')](_0x8b68('0x39')))),_0x8b68('0x3a')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x3b')))),_0x8b68('0x3c')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x3d')))),'outboundBlacklistCallsDay'],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db['sequelize']['fn']('IF',db[_0x8b68('0x20')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x8b68('0x3e')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0x8b68('0x3f')],[db[_0x8b68('0x20')]['fn']('COUNT',db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')]['literal'](_0x8b68('0x40')))),_0x8b68('0x3e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x41')))),_0x8b68('0x42')]],'group':['campaign']})['then'](function(_0x4492fd){logger[_0x8b68('0xd')](_0x8b68('0x2d'),_0x23554d);logger['debug'](_0x8b68('0x2d'),_0x23554d,JSON[_0x8b68('0x2c')](_0x4492fd));_0xf2154f(_0x4492fd);})[_0x8b68('0x16')](function(_0x4dda69){logger[_0x8b68('0x12')]('GetVoiceQueueHopperHistory',_0x4dda69[_0x8b68('0x14')],_0x23554d);_0xce486c(_0xb9b5b1[_0x8b68('0x12')](0x1f4,_0x4dda69['message']));});});};exports[_0x8b68('0x43')]=function(_0x25842e){var _0x6ac18=this;return new Promise(function(_0xcd88b4,_0x8cc614){return db['CmHopperHistory'][_0x8b68('0x1e')]({'raw':_0x25842e[_0x8b68('0x1a')]?_0x25842e[_0x8b68('0x1a')][_0x8b68('0x1b')]===undefined?!![]:![]:!![],'where':_0x25842e[_0x8b68('0x1a')]?_0x25842e[_0x8b68('0x1a')][_0x8b68('0x1f')]||null:null,'attributes':[[_0x8b68('0x2e'),'name'],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')][_0x8b68('0x44')]('id')),_0x8b68('0x45')],[db[_0x8b68('0x20')]['fn'](_0x8b68('0x22'),db[_0x8b68('0x20')]['fn']('IF',db[_0x8b68('0x20')][_0x8b68('0x23')](_0x8b68('0x33')))),_0x8b68('0x46')]],'group':[_0x8b68('0x2e')]})[_0x8b68('0xc')](function(_0x28e7aa){logger[_0x8b68('0xd')](_0x8b68('0x43'),_0x25842e);logger[_0x8b68('0x10')](_0x8b68('0x43'),_0x25842e,JSON[_0x8b68('0x2c')](_0x28e7aa));_0xcd88b4(_0x28e7aa);})['catch'](function(_0xaac776){logger['error']('GetCampaignHopperHistory',_0xaac776[_0x8b68('0x14')],_0x25842e);_0x8cc614(_0x6ac18['error'](0x1f4,_0xaac776[_0x8b68('0x14')]));});});}; \ No newline at end of file +var _0x34b7=['stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','outboundReCallsDay','name','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x34b7,0x196));var _0x734b=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x34b7[_0x581960];return _0x4ee892;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')](_0x5edbe9[_0x734b('0x18')],{'raw':_0x5edbe9[_0x734b('0x19')]?_0x5edbe9[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x67eed){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x67eed));_0x56a95c(_0x67eed);})['catch'](function(_0x1e4dcc){logger[_0x734b('0xf')]('CreateCmHopperHistory',_0x1e4dcc[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1e4dcc[_0x734b('0x12')]));});});};exports[_0x734b('0x1c')]=function(_0x46d432){var _0x26d118=this;return new Promise(function(_0x26eccf,_0x104fff){return db[_0x734b('0x16')][_0x734b('0x1d')]({'raw':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x46d432['options']?_0x46d432['options'][_0x734b('0x1e')]||null:null,'attributes':[[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')][_0x734b('0x20')]('id')),_0x734b('0x21')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x23')))),_0x734b('0x24')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x26')))),_0x734b('0x27')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x28')))),_0x734b('0x29')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x2a'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x2b')))),_0x734b('0x2c')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x2a'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x2d')))),'predictiveIntervalAvgTalktime']]})[_0x734b('0x1b')](function(_0x5e2444){logger[_0x734b('0xa')](_0x734b('0x1c'),_0x46d432);logger[_0x734b('0xc')](_0x734b('0x1c'),_0x46d432,JSON[_0x734b('0xe')](_0x5e2444));_0x26eccf(_0x5e2444);})[_0x734b('0x14')](function(_0x55bd2e){logger['error'](_0x734b('0x1c'),_0x55bd2e['message'],_0x46d432);_0x104fff(_0x26d118[_0x734b('0xf')](0x1f4,_0x55bd2e['message']));});});};exports[_0x734b('0x2e')]=function(_0x4b30eb){var _0x1875f1=this;return new Promise(function(_0x5ea4a0,_0x37d891){return db[_0x734b('0x16')][_0x734b('0x1d')]({'raw':_0x4b30eb[_0x734b('0x19')]?_0x4b30eb[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b30eb[_0x734b('0x19')]?_0x4b30eb['options'][_0x734b('0x1e')]||null:null,'attributes':[[_0x734b('0x2f'),'name'],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x30')))),_0x734b('0x31')],[db['sequelize']['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x32')))),_0x734b('0x33')],[db[_0x734b('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x734b('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x734b('0x34')],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x35')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x36')))),'outboundCongestionCallsDay'],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x734b('0x37')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x734b('0x38')],[db['sequelize']['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x39')))),_0x734b('0x3a')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x3b')))),_0x734b('0x3c')],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0x734b('0x3d')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x3e')))),'outboundRejectCallsDay'],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x3f')))),_0x734b('0x40')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2020,\x201,\x20null'))),_0x734b('0x41')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x734b('0x42')]],'group':[_0x734b('0x2f')]})[_0x734b('0x1b')](function(_0xe605be){logger['info'](_0x734b('0x2e'),_0x4b30eb);logger[_0x734b('0xc')](_0x734b('0x2e'),_0x4b30eb,JSON[_0x734b('0xe')](_0xe605be));_0x5ea4a0(_0xe605be);})['catch'](function(_0x27f0ff){logger['error'](_0x734b('0x2e'),_0x27f0ff[_0x734b('0x12')],_0x4b30eb);_0x37d891(_0x1875f1[_0x734b('0xf')](0x1f4,_0x27f0ff[_0x734b('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x2b9da7){var _0x1af382=this;return new Promise(function(_0x5b9adc,_0x541e70){return db[_0x734b('0x16')]['findAll']({'raw':_0x2b9da7[_0x734b('0x19')]?_0x2b9da7[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b9da7['options']?_0x2b9da7[_0x734b('0x19')]['where']||null:null,'attributes':[[_0x734b('0x2f'),_0x734b('0x43')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db['sequelize'][_0x734b('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0x734b('0x44')]],'group':[_0x734b('0x2f')]})[_0x734b('0x1b')](function(_0x257a87){logger['info'](_0x734b('0x45'),_0x2b9da7);logger['debug'](_0x734b('0x45'),_0x2b9da7,JSON[_0x734b('0xe')](_0x257a87));_0x5b9adc(_0x257a87);})[_0x734b('0x14')](function(_0x4dbff2){logger[_0x734b('0xf')](_0x734b('0x45'),_0x4dbff2[_0x734b('0x12')],_0x2b9da7);_0x541e70(_0x1af382[_0x734b('0xf')](0x1f4,_0x4dbff2[_0x734b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0929d75..8a1a4b2 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 _0x86bc=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','show','create','put','/:id','multer'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x86bc,0x19f));var _0xc86b=function(_0x3f2cfe,_0x16fd1c){_0x3f2cfe=_0x3f2cfe-0x0;var _0x36c4ae=_0x86bc[_0x3f2cfe];return _0x36c4ae;};'use strict';var multer=require(_0xc86b('0x0'));var util=require('util');var path=require(_0xc86b('0x1'));var timeout=require(_0xc86b('0x2'));var express=require('express');var router=express[_0xc86b('0x3')]();var auth=require(_0xc86b('0x4'));var interaction=require(_0xc86b('0x5'));var config=require(_0xc86b('0x6'));var controller=require(_0xc86b('0x7'));router[_0xc86b('0x8')]('/',auth[_0xc86b('0x9')](),controller['index']);router['get'](_0xc86b('0xa'),auth['isAuthenticated'](),controller[_0xc86b('0xb')]);router[_0xc86b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc86b('0xc')]);router['post']('/',auth[_0xc86b('0x9')](),controller[_0xc86b('0xd')]);router[_0xc86b('0xe')](_0xc86b('0xf'),auth[_0xc86b('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x3ee3=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','post','put','/:id','update','multer'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3ee3,0xa4));var _0x33ee=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3ee3[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x33ee('0x0'));var util=require(_0x33ee('0x1'));var path=require(_0x33ee('0x2'));var timeout=require(_0x33ee('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x33ee('0x4'));var config=require(_0x33ee('0x5'));var controller=require(_0x33ee('0x6'));router[_0x33ee('0x7')]('/',auth[_0x33ee('0x8')](),controller['index']);router['get'](_0x33ee('0x9'),auth[_0x33ee('0x8')](),controller[_0x33ee('0xa')]);router['get']('/:id',auth[_0x33ee('0x8')](),controller['show']);router[_0x33ee('0xb')]('/',auth[_0x33ee('0x8')](),controller['create']);router[_0x33ee('0xc')](_0x33ee('0xd'),auth[_0x33ee('0x8')](),controller[_0x33ee('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index aed1473..397d4e1 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 _0xea20=['STRING','name','sequelize'];(function(_0x1d2ee3,_0x6d212a){var _0x5b801f=function(_0x80312e){while(--_0x80312e){_0x1d2ee3['push'](_0x1d2ee3['shift']());}};_0x5b801f(++_0x6d212a);}(_0xea20,0x152));var _0x0ea2=function(_0x5f15aa,_0x247a80){_0x5f15aa=_0x5f15aa-0x0;var _0x230d52=_0xea20[_0x5f15aa];return _0x230d52;};'use strict';var Sequelize=require(_0x0ea2('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ea2('0x1')],'unique':_0x0ea2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0ea2('0x1')]},'dialPrefix':{'type':Sequelize[_0x0ea2('0x1')]}}; \ No newline at end of file +var _0xd251=['exports','STRING','sequelize'];(function(_0x1f71ca,_0x48c0a2){var _0x34929f=function(_0x7bb693){while(--_0x7bb693){_0x1f71ca['push'](_0x1f71ca['shift']());}};_0x34929f(++_0x48c0a2);}(_0xd251,0x101));var _0x1d25=function(_0x548126,_0xfd7183){_0x548126=_0x548126-0x0;var _0x1af746=_0xd251[_0x548126];return _0x1af746;};'use strict';var Sequelize=require(_0x1d25('0x0'));module[_0x1d25('0x1')]={'name':{'type':Sequelize[_0x1d25('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x1d25('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index c7c64ff..2a47e5c 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 _0x1ff7=['setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','end','status','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','name','send','index','CmList','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','tags','isArray','each','CmContact','omit','success','dataValues','errors','push','getContacts','CmCustomField','CustomFields','concat','cf_%d','nolimit','order','raw','getContactsCsv','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv'];(function(_0x291086,_0x5b7274){var _0xe42533=function(_0x573f4a){while(--_0x573f4a){_0x291086['push'](_0x291086['shift']());}};_0xe42533(++_0x5b7274);}(_0x1ff7,0xb1));var _0x71ff=function(_0x2395f3,_0x4d9e56){_0x2395f3=_0x2395f3-0x0;var _0x43bcfe=_0x1ff7[_0x2395f3];return _0x43bcfe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x71ff('0x0'));var rimraf=require(_0x71ff('0x1'));var zipdir=require(_0x71ff('0x2'));var jsonpatch=require(_0x71ff('0x3'));var rp=require(_0x71ff('0x4'));var moment=require(_0x71ff('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x71ff('0x6'));var path=require(_0x71ff('0x7'));var sox=require('sox');var csv=require(_0x71ff('0x8'));var ejs=require(_0x71ff('0x9'));var fs=require('fs');var _=require(_0x71ff('0xa'));var squel=require(_0x71ff('0xb'));var crypto=require('crypto');var jsforce=require(_0x71ff('0xc'));var deskjs=require(_0x71ff('0xd'));var toCsv=require(_0x71ff('0x8'));var querystring=require('querystring');var Papa=require(_0x71ff('0xe'));var Redis=require('ioredis');var authService=require(_0x71ff('0xf'));var qs=require(_0x71ff('0x10'));var as=require(_0x71ff('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x71ff('0x12'));var utils=require(_0x71ff('0x13'));var config=require(_0x71ff('0x14'));var db=require('../../mysqldb')['db'];config[_0x71ff('0x15')]=_[_0x71ff('0x16')](config[_0x71ff('0x15')],{'host':_0x71ff('0x17'),'port':0x18eb});var socket=require(_0x71ff('0x18'))(new Redis(config[_0x71ff('0x15')]));require(_0x71ff('0x19'))[_0x71ff('0x1a')](socket);function respondWithStatusCode(_0x5ac732,_0x47505a){_0x47505a=_0x47505a||0xcc;return function(_0x5d32bf){if(_0x5d32bf){return _0x5ac732['sendStatus'](_0x47505a);}return _0x5ac732['status'](_0x47505a)[_0x71ff('0x1b')]();};}function respondWithResult(_0x38b4e3,_0x5531db){_0x5531db=_0x5531db||0xc8;return function(_0x3f0fbc){if(_0x3f0fbc){return _0x38b4e3[_0x71ff('0x1c')](_0x5531db)['json'](_0x3f0fbc);}};}function respondWithFilteredResult(_0x5e4be9,_0x8a4b7d){return function(_0x4b1ba4){if(_0x4b1ba4){var _0x32d499=_0x4b1ba4[_0x71ff('0x1d')],_0x3e179c=_0x8a4b7d[_0x71ff('0x1e')],_0x55b2c8=_0x8a4b7d[_0x71ff('0x1e')]+_0x8a4b7d[_0x71ff('0x1f')],_0xa71b20;if(_0x55b2c8>=_0x32d499){_0x55b2c8=_0x32d499;_0xa71b20=0xc8;}else{_0xa71b20=0xce;}_0x5e4be9[_0x71ff('0x1c')](_0xa71b20);return _0x5e4be9['set'](_0x71ff('0x20'),_0x3e179c+'-'+_0x55b2c8+'/'+_0x32d499)[_0x71ff('0x21')](_0x4b1ba4);}return null;};}function patchUpdates(_0x2be71d){return function(_0x21c839){try{jsonpatch[_0x71ff('0x22')](_0x21c839,_0x2be71d,!![]);}catch(_0x3b867c){return BPromise['reject'](_0x3b867c);}return _0x21c839[_0x71ff('0x23')]();};}function saveUpdates(_0x477245,_0xbd093e){return function(_0x355e44){if(_0x355e44){return _0x355e44[_0x71ff('0x24')](_0x477245)[_0x71ff('0x25')](function(_0x4adc12){return _0x4adc12;});}return null;};}function removeEntity(_0x2cecd3,_0x4cbd82){return function(_0x531a66){if(_0x531a66){return _0x531a66[_0x71ff('0x26')]()[_0x71ff('0x25')](function(){var _0x3bb80d=_0x531a66[_0x71ff('0x27')]({'plain':!![]});var _0x54a821=_0x71ff('0x28');return db[_0x71ff('0x29')][_0x71ff('0x26')]({'where':{'type':_0x54a821,'resourceId':_0x3bb80d['id']}})[_0x71ff('0x25')](function(){return _0x531a66;});})['then'](function(){_0x2cecd3[_0x71ff('0x1c')](0xcc)[_0x71ff('0x1b')]();});}};}function handleEntityNotFound(_0x184301,_0x33ef88){return function(_0x44841e){if(!_0x44841e){_0x184301[_0x71ff('0x2a')](0x194);}return _0x44841e;};}function handleError(_0x5e64f3,_0x5acb70){_0x5acb70=_0x5acb70||0x1f4;return function(_0x4b05d8){logger[_0x71ff('0x2b')](_0x4b05d8['stack']);if(_0x4b05d8[_0x71ff('0x2c')]){delete _0x4b05d8[_0x71ff('0x2c')];}_0x5e64f3[_0x71ff('0x1c')](_0x5acb70)[_0x71ff('0x2d')](_0x4b05d8);};}exports[_0x71ff('0x2e')]=function(_0x5229b6,_0x562f08){var _0x4bdb75={},_0x10d6d3={},_0x1d8a92={'count':0x0,'rows':[]};var _0x3332be=_['map'](db[_0x71ff('0x2f')]['rawAttributes'],function(_0x16cac6){return{'name':_0x16cac6['fieldName'],'type':_0x16cac6[_0x71ff('0x30')][_0x71ff('0x31')]};});_0x10d6d3[_0x71ff('0x32')]=_[_0x71ff('0x33')](_0x3332be,'name');_0x10d6d3['query']=_['keys'](_0x5229b6[_0x71ff('0x34')]);_0x10d6d3[_0x71ff('0x35')]=_[_0x71ff('0x36')](_0x10d6d3['model'],_0x10d6d3[_0x71ff('0x34')]);_0x4bdb75['attributes']=_[_0x71ff('0x36')](_0x10d6d3['model'],qs[_0x71ff('0x37')](_0x5229b6[_0x71ff('0x34')][_0x71ff('0x37')]));_0x4bdb75[_0x71ff('0x38')]=_0x4bdb75[_0x71ff('0x38')][_0x71ff('0x39')]?_0x4bdb75[_0x71ff('0x38')]:_0x10d6d3[_0x71ff('0x32')];if(!_0x5229b6[_0x71ff('0x34')][_0x71ff('0x3a')]('nolimit')){_0x4bdb75['limit']=qs[_0x71ff('0x1f')](_0x5229b6[_0x71ff('0x34')]['limit']);_0x4bdb75[_0x71ff('0x1e')]=qs[_0x71ff('0x1e')](_0x5229b6['query'][_0x71ff('0x1e')]);}_0x4bdb75['order']=qs[_0x71ff('0x3b')](_0x5229b6[_0x71ff('0x34')][_0x71ff('0x3b')]);_0x4bdb75['where']=qs['filters'](_[_0x71ff('0x3c')](_0x5229b6[_0x71ff('0x34')],_0x10d6d3[_0x71ff('0x35')]),_0x3332be);if(_0x5229b6['query'][_0x71ff('0x3d')]){_0x4bdb75[_0x71ff('0x3e')]=_[_0x71ff('0x3f')](_0x4bdb75[_0x71ff('0x3e')],{'$or':_['map'](_0x3332be,function(_0x4fc589){if(_0x4fc589[_0x71ff('0x30')]!==_0x71ff('0x40')){var _0x2353c7={};_0x2353c7[_0x4fc589['name']]={'$like':'%'+_0x5229b6[_0x71ff('0x34')]['filter']+'%'};return _0x2353c7;}})});}_0x4bdb75=_['merge']({},_0x4bdb75,_0x5229b6[_0x71ff('0x41')]);var _0x2d6e58={'where':_0x4bdb75[_0x71ff('0x3e')]};return db[_0x71ff('0x2f')][_0x71ff('0x1d')](_0x2d6e58)[_0x71ff('0x25')](function(_0x3dcb8e){_0x1d8a92[_0x71ff('0x1d')]=_0x3dcb8e;if(_0x5229b6['query']['includeAll']){_0x4bdb75[_0x71ff('0x42')]=[{'all':!![]}];}return db[_0x71ff('0x2f')][_0x71ff('0x43')](_0x4bdb75);})[_0x71ff('0x25')](function(_0x3bb0cf){_0x1d8a92[_0x71ff('0x44')]=_0x3bb0cf;return _0x1d8a92;})['then'](respondWithFilteredResult(_0x562f08,_0x4bdb75))[_0x71ff('0x45')](handleError(_0x562f08,null));};exports[_0x71ff('0x46')]=function(_0x14f721,_0x573ce3){var _0x43da76={'raw':![],'where':{'id':_0x14f721[_0x71ff('0x47')]['id']}},_0x486c12={};_0x486c12[_0x71ff('0x32')]=_[_0x71ff('0x48')](db[_0x71ff('0x2f')][_0x71ff('0x49')]);_0x486c12[_0x71ff('0x34')]=_['keys'](_0x14f721['query']);_0x486c12[_0x71ff('0x35')]=_[_0x71ff('0x36')](_0x486c12[_0x71ff('0x32')],_0x486c12[_0x71ff('0x34')]);_0x43da76[_0x71ff('0x38')]=_[_0x71ff('0x36')](_0x486c12['model'],qs[_0x71ff('0x37')](_0x14f721[_0x71ff('0x34')][_0x71ff('0x37')]));_0x43da76['attributes']=_0x43da76[_0x71ff('0x38')][_0x71ff('0x39')]?_0x43da76['attributes']:_0x486c12[_0x71ff('0x32')];if(_0x14f721['query'][_0x71ff('0x4a')]){_0x43da76[_0x71ff('0x42')]=[{'all':!![]}];}_0x43da76=_[_0x71ff('0x3f')]({},_0x43da76,_0x14f721[_0x71ff('0x41')]);return db['CmList'][_0x71ff('0x4b')](_0x43da76)[_0x71ff('0x25')](handleEntityNotFound(_0x573ce3,null))[_0x71ff('0x25')](respondWithResult(_0x573ce3,null))[_0x71ff('0x45')](handleError(_0x573ce3,null));};exports[_0x71ff('0x4c')]=function(_0x3a5bfe,_0x488923){return db[_0x71ff('0x2f')]['create'](_0x3a5bfe['body'],{})[_0x71ff('0x25')](function(_0x35b39a){var _0x5a0887=_0x3a5bfe[_0x71ff('0x4d')]['get']({'plain':!![]});if(!_0x5a0887)throw new Error(_0x71ff('0x4e'));if(_0x5a0887[_0x71ff('0x4f')]==='user'){var _0x332596=_0x35b39a[_0x71ff('0x27')]({'plain':!![]});var _0x257879='Lists';return db['UserProfileSection'][_0x71ff('0x4b')]({'where':{'name':_0x257879,'userProfileId':_0x5a0887[_0x71ff('0x50')]},'raw':!![]})['then'](function(_0x324ffb){if(_0x324ffb&&_0x324ffb[_0x71ff('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x332596['name'],'resourceId':_0x332596['id'],'type':_0x324ffb['name'],'sectionId':_0x324ffb['id']},{})[_0x71ff('0x25')](function(){return _0x35b39a;});}else{return _0x35b39a;}})[_0x71ff('0x45')](function(_0x524baf){logger[_0x71ff('0x2b')](_0x71ff('0x52'),_0x524baf);throw _0x524baf;});}return _0x35b39a;})[_0x71ff('0x25')](respondWithResult(_0x488923,0xc9))[_0x71ff('0x45')](handleError(_0x488923,null));};exports[_0x71ff('0x24')]=function(_0x5d36e2,_0x16cb0b){if(_0x5d36e2[_0x71ff('0x53')]['id']){delete _0x5d36e2[_0x71ff('0x53')]['id'];}return db[_0x71ff('0x2f')][_0x71ff('0x4b')]({'where':{'id':_0x5d36e2[_0x71ff('0x47')]['id']}})[_0x71ff('0x25')](handleEntityNotFound(_0x16cb0b,null))[_0x71ff('0x25')](saveUpdates(_0x5d36e2[_0x71ff('0x53')],null))['then'](respondWithResult(_0x16cb0b,null))[_0x71ff('0x45')](handleError(_0x16cb0b,null));};exports['destroy']=function(_0x1b394e,_0x27e20a){return db['CmList'][_0x71ff('0x4b')]({'where':{'id':_0x1b394e['params']['id']}})[_0x71ff('0x25')](handleEntityNotFound(_0x27e20a,null))[_0x71ff('0x25')](removeEntity(_0x27e20a,null))[_0x71ff('0x45')](handleError(_0x27e20a,null));};exports[_0x71ff('0x54')]=function(_0x71341e,_0x1af93d){return db[_0x71ff('0x2f')][_0x71ff('0x54')]()['then'](respondWithResult(_0x1af93d,null))[_0x71ff('0x45')](handleError(_0x1af93d,null));};exports['addDisposition']=function(_0x52df6c,_0xd4bab0,_0x57eb0f){if(_0x52df6c['body']['id']){delete _0x52df6c[_0x71ff('0x53')]['id'];}return db[_0x71ff('0x2f')][_0x71ff('0x4b')]({'where':{'id':_0x52df6c[_0x71ff('0x47')]['id']}})[_0x71ff('0x25')](handleEntityNotFound(_0xd4bab0,null))['then'](function(_0x344de7){if(_0x344de7){_0x52df6c[_0x71ff('0x53')][_0x71ff('0x55')]=_0x344de7['id'];return db['Disposition'][_0x71ff('0x4c')](_0x52df6c['body']);}})[_0x71ff('0x25')](respondWithResult(_0xd4bab0,null))['catch'](handleError(_0xd4bab0,null));};exports[_0x71ff('0x56')]=function(_0x4e7427,_0x3a7f84,_0x13dd44){var _0x403a07={'raw':![],'where':{}};var _0x18cfdf={};var _0x397fa5={'count':0x0,'rows':[]};return db['CmList'][_0x71ff('0x57')]({'where':{'id':_0x4e7427[_0x71ff('0x47')]['id']}})[_0x71ff('0x25')](handleEntityNotFound(_0x3a7f84,null))[_0x71ff('0x25')](function(_0x30c4de){if(_0x30c4de){_0x18cfdf[_0x71ff('0x32')]=_['keys'](db[_0x71ff('0x58')][_0x71ff('0x49')]);_0x18cfdf[_0x71ff('0x34')]=_[_0x71ff('0x48')](_0x4e7427[_0x71ff('0x34')]);_0x18cfdf['filters']=_[_0x71ff('0x36')](_0x18cfdf[_0x71ff('0x32')],_0x18cfdf[_0x71ff('0x34')]);_0x403a07[_0x71ff('0x38')]=_[_0x71ff('0x36')](_0x18cfdf[_0x71ff('0x32')],qs[_0x71ff('0x37')](_0x4e7427['query'][_0x71ff('0x37')]));_0x403a07['attributes']=_0x403a07['attributes'][_0x71ff('0x39')]?_0x403a07[_0x71ff('0x38')]:_0x18cfdf[_0x71ff('0x32')];if(!_0x4e7427[_0x71ff('0x34')][_0x71ff('0x3a')]('nolimit')){_0x403a07[_0x71ff('0x1f')]=qs['limit'](_0x4e7427[_0x71ff('0x34')][_0x71ff('0x1f')]);_0x403a07[_0x71ff('0x1e')]=qs[_0x71ff('0x1e')](_0x4e7427[_0x71ff('0x34')][_0x71ff('0x1e')]);}_0x403a07['order']=qs[_0x71ff('0x3b')](_0x4e7427[_0x71ff('0x34')]['sort']);_0x403a07[_0x71ff('0x3e')]=qs['filters'](_[_0x71ff('0x3c')](_0x4e7427[_0x71ff('0x34')],_0x18cfdf['filters']));_0x403a07['where'][_0x71ff('0x55')]=_0x30c4de['id'];if(_0x4e7427[_0x71ff('0x34')]['filter']){_0x403a07[_0x71ff('0x3e')]=_['merge'](_0x403a07['where'],{'$or':_[_0x71ff('0x33')](_0x403a07['attributes'],function(_0x3734e3){var _0x291455={};_0x291455[_0x3734e3]={'$like':'%'+_0x4e7427['query'][_0x71ff('0x3d')]+'%'};return _0x291455;})});}_0x403a07=_[_0x71ff('0x3f')]({},_0x403a07,_0x4e7427[_0x71ff('0x41')]);return db[_0x71ff('0x58')][_0x71ff('0x1d')]({'where':_0x403a07[_0x71ff('0x3e')]})[_0x71ff('0x25')](function(_0x12c323){_0x397fa5[_0x71ff('0x1d')]=_0x12c323;if(_0x4e7427[_0x71ff('0x34')]['includeAll']){_0x403a07['include']=[{'all':!![]}];}return db[_0x71ff('0x58')][_0x71ff('0x43')](_0x403a07);})[_0x71ff('0x25')](function(_0x4d971a){_0x397fa5[_0x71ff('0x44')]=_0x4d971a;return _0x397fa5;});}})[_0x71ff('0x25')](respondWithFilteredResult(_0x3a7f84,_0x403a07))[_0x71ff('0x45')](handleError(_0x3a7f84,null));};exports[_0x71ff('0x59')]=function(_0x5f5233,_0x19f16e,_0x2d129f){return db[_0x71ff('0x2f')][_0x71ff('0x4b')]({'where':{'id':_0x5f5233[_0x71ff('0x47')]['id']}})[_0x71ff('0x25')](handleEntityNotFound(_0x19f16e,null))[_0x71ff('0x25')](function(_0x2bd1a1){if(_0x2bd1a1){return _0x2bd1a1['removeDispositions'](_0x5f5233['query'][_0x71ff('0x5a')]);}})['then'](respondWithStatusCode(_0x19f16e,null))['catch'](handleError(_0x19f16e,null));};exports[_0x71ff('0x5b')]=function(_0x2a9299,_0x48c917,_0x5652bc){return db['CmList']['find']({'where':{'id':_0x2a9299['params']['id']}})[_0x71ff('0x25')](handleEntityNotFound(_0x48c917,null))[_0x71ff('0x25')](function(_0x57287b){if(_0x57287b){var _0x13c0f3=[];var _0x3feb76={'success':[],'errors':[]};return db['CmContact'][_0x71ff('0x54')]()['then'](function(_0x22822a){if(_0x2a9299['body'][_0x71ff('0x5c')]&&_['isArray'](_0x2a9299[_0x71ff('0x53')][_0x71ff('0x5c')])){if(_0x2a9299[_0x71ff('0x53')][_0x71ff('0x5c')][_0x71ff('0x39')]){_0x2a9299[_0x71ff('0x53')]['tags']=_0x2a9299[_0x71ff('0x53')]['tags']['join'](';')+';';}else{_0x2a9299[_0x71ff('0x53')][_0x71ff('0x5c')]=null;}}else{_0x2a9299[_0x71ff('0x53')][_0x71ff('0x5c')]=null;}if(_0x2a9299[_0x71ff('0x53')]&&_[_0x71ff('0x5d')](_0x2a9299[_0x71ff('0x53')])){for(var _0xba695d=0x0;_0xba695d<_0x2a9299['body'][_0x71ff('0x39')];_0xba695d+=0x1){_0x2a9299['body'][_0xba695d][_0x71ff('0x55')]=_0x2a9299[_0x71ff('0x47')]['id'];_0x13c0f3['push'](_0x2a9299['body'][_0xba695d]);}return BPromise[_0x71ff('0x5e')](_0x13c0f3,function(_0x5cfaeb){return db[_0x71ff('0x5f')][_0x71ff('0x4c')](_[_0x71ff('0x60')](_0x5cfaeb,[_0x71ff('0x5a'),'id'])||{},{'fields':_['keys'](_0x22822a),'raw':!![]})[_0x71ff('0x25')](function(_0xac050e){_0x3feb76[_0x71ff('0x61')]['push'](_0xac050e[_0x71ff('0x62')]);})[_0x71ff('0x45')](function(_0x24edb4){_0x3feb76[_0x71ff('0x63')][_0x71ff('0x64')]({'data':_0x5cfaeb,'error':_0x24edb4['message']});});})[_0x71ff('0x25')](function(_0x1a9798){return _0x3feb76;})[_0x71ff('0x45')](function(_0x189afc){return _0x189afc;});}else{_0x48c917[_0x71ff('0x1c')](0x190)[_0x71ff('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x48c917,null))[_0x71ff('0x45')](handleError(_0x48c917,null));};exports[_0x71ff('0x65')]=function(_0x15c7b5,_0x372e72,_0x3fc419){var _0x3f5ae1;return db['CmList'][_0x71ff('0x4b')]({'where':{'id':_0x15c7b5[_0x71ff('0x47')]['id']},'include':[{'model':db[_0x71ff('0x66')],'as':_0x71ff('0x67')}]})['then'](handleEntityNotFound(_0x372e72,null))['then'](function(_0x41fce3){if(_0x41fce3){_0x3f5ae1=_0x41fce3;return db['CmContact'][_0x71ff('0x49')];}})['then'](function(_0x40e4aa){if(_0x40e4aa){var _0x546aa6={};var _0x3ff165={};_0x3ff165[_0x71ff('0x32')]=_[_0x71ff('0x68')](_[_0x71ff('0x48')](_0x40e4aa),_[_0x71ff('0x33')](_0x3f5ae1[_0x71ff('0x67')],function(_0x48c539){return util['format'](_0x71ff('0x69'),_0x48c539['id']);}));_0x3ff165[_0x71ff('0x34')]=_[_0x71ff('0x48')](_0x15c7b5[_0x71ff('0x34')]);_0x3ff165[_0x71ff('0x35')]=_['intersection'](_0x3ff165['model'],_0x3ff165['query']);_0x546aa6[_0x71ff('0x38')]=_[_0x71ff('0x36')](_0x3ff165[_0x71ff('0x32')],qs[_0x71ff('0x37')](_0x15c7b5[_0x71ff('0x34')][_0x71ff('0x37')]));_0x546aa6[_0x71ff('0x38')]=_0x546aa6[_0x71ff('0x38')]['length']?_0x546aa6['attributes']:_0x3ff165[_0x71ff('0x32')];if(!_0x15c7b5['query']['hasOwnProperty'](_0x71ff('0x6a'))){_0x546aa6[_0x71ff('0x1f')]=qs[_0x71ff('0x1f')](_0x15c7b5['query'][_0x71ff('0x1f')]);_0x546aa6[_0x71ff('0x1e')]=qs[_0x71ff('0x1e')](_0x15c7b5[_0x71ff('0x34')][_0x71ff('0x1e')]);}_0x546aa6[_0x71ff('0x6b')]=qs['sort'](_0x15c7b5['query'][_0x71ff('0x3b')]);_0x546aa6[_0x71ff('0x3e')]=qs['filters'](_[_0x71ff('0x3c')](_0x15c7b5[_0x71ff('0x34')],_0x3ff165[_0x71ff('0x35')]));_0x546aa6[_0x71ff('0x6c')]=!![];if(_0x15c7b5[_0x71ff('0x34')][_0x71ff('0x3d')]){_0x546aa6[_0x71ff('0x3e')]=_[_0x71ff('0x3f')](_0x546aa6['where'],{'$or':_[_0x71ff('0x33')](_0x546aa6[_0x71ff('0x38')],function(_0x520540){var _0x5bf46a={};_0x5bf46a[_0x520540]={'$like':'%'+_0x15c7b5['query'][_0x71ff('0x3d')]+'%'};return _0x5bf46a;})});}_0x546aa6=_[_0x71ff('0x3f')]({},_0x546aa6,_0x15c7b5[_0x71ff('0x41')]);return _0x3f5ae1[_0x71ff('0x65')](_0x546aa6);}})[_0x71ff('0x25')](respondWithResult(_0x372e72,null))[_0x71ff('0x45')](handleError(_0x372e72,null));};exports[_0x71ff('0x6d')]=function(_0x300718,_0x41c11b,_0x4a883c){var _0x54a7cc;return db['CmList'][_0x71ff('0x4b')]({'where':{'id':_0x300718[_0x71ff('0x47')]['id']},'include':[{'model':db[_0x71ff('0x66')],'as':_0x71ff('0x67')}]})[_0x71ff('0x25')](handleEntityNotFound(_0x41c11b,null))['then'](function(_0x39ee1a){if(_0x39ee1a){_0x54a7cc=_0x39ee1a;return db['CmContact']['rawAttributes'];}})[_0x71ff('0x25')](function(_0x24e279){if(_0x24e279){var _0x46271c={};var _0x2c27bb={};_0x2c27bb['model']=_['concat'](_[_0x71ff('0x48')](_0x24e279),_[_0x71ff('0x33')](_0x54a7cc[_0x71ff('0x67')],function(_0x49217c){return util[_0x71ff('0x6e')](_0x71ff('0x69'),_0x49217c['id']);}));_0x2c27bb[_0x71ff('0x34')]=_[_0x71ff('0x48')](_0x300718[_0x71ff('0x34')]);_0x2c27bb[_0x71ff('0x35')]=_['intersection'](_0x2c27bb[_0x71ff('0x32')],_0x2c27bb[_0x71ff('0x34')]);_0x46271c[_0x71ff('0x38')]=_[_0x71ff('0x36')](_0x2c27bb[_0x71ff('0x32')],qs['fields'](_0x300718[_0x71ff('0x34')]['fields']));_0x46271c['attributes']=_0x46271c['attributes'][_0x71ff('0x39')]?_0x46271c['attributes']:_0x2c27bb[_0x71ff('0x32')];if(!_0x300718[_0x71ff('0x34')]['hasOwnProperty'](_0x71ff('0x6a'))){_0x46271c[_0x71ff('0x1f')]=qs[_0x71ff('0x1f')](_0x300718[_0x71ff('0x34')][_0x71ff('0x1f')]);_0x46271c[_0x71ff('0x1e')]=qs[_0x71ff('0x1e')](_0x300718[_0x71ff('0x34')][_0x71ff('0x1e')]);}_0x46271c[_0x71ff('0x6b')]=qs[_0x71ff('0x3b')](_0x300718[_0x71ff('0x34')][_0x71ff('0x3b')]);_0x46271c['where']=qs[_0x71ff('0x35')](_[_0x71ff('0x3c')](_0x300718[_0x71ff('0x34')],_0x2c27bb[_0x71ff('0x35')]));_0x46271c['raw']=!![];if(_0x300718[_0x71ff('0x34')][_0x71ff('0x3d')]){_0x46271c['where']=_['merge'](_0x46271c[_0x71ff('0x3e')],{'$or':_['map'](_0x46271c[_0x71ff('0x38')],function(_0x264639){var _0x5d70e3={};_0x5d70e3[_0x264639]={'$like':'%'+_0x300718['query'][_0x71ff('0x3d')]+'%'};return _0x5d70e3;})});}_0x46271c=_['merge']({},_0x46271c,_0x300718[_0x71ff('0x41')]);return _0x54a7cc['getContacts'](_0x46271c);}})[_0x71ff('0x25')](function(_0x781ad7){if(!_[_0x71ff('0x6f')](_0x781ad7)){var _0x13fffa=toCsv(_0x781ad7);var _0x1356ef=Date[_0x71ff('0x70')]();fs[_0x71ff('0x71')](util[_0x71ff('0x6e')](_0x71ff('0x72'),_0x54a7cc['id'],_0x1356ef),_0x13fffa);_0x41c11b[_0x71ff('0x73')](_0x71ff('0x74'),_0x71ff('0x75')+util[_0x71ff('0x6e')](_0x71ff('0x76'),_0x54a7cc['id'],_0x1356ef));_0x41c11b[_0x71ff('0x73')](_0x71ff('0x77'),_0x71ff('0x78'));return _0x41c11b[_0x71ff('0x79')](util[_0x71ff('0x6e')](_0x71ff('0x72'),_0x54a7cc['id'],_0x1356ef));}else{return _0x41c11b['sendStatus'](0xcc);}})[_0x71ff('0x45')](handleError(_0x41c11b,null));};exports[_0x71ff('0x7a')]=function(_0x42c62c,_0x3955a3,_0x5e5eb3){var _0xc1d2d3;delete _0x42c62c[_0x71ff('0x53')]['id'];return db[_0x71ff('0x2f')][_0x71ff('0x57')]({'where':{'id':_0x42c62c[_0x71ff('0x47')]['id']}})[_0x71ff('0x25')](handleEntityNotFound(_0x3955a3,null))['then'](function(_0x37f638){if(_0x37f638){return db[_0x71ff('0x7b')][_0x71ff('0x7c')](function(_0x4c50b1){return db['CmCustomField'][_0x71ff('0x4c')](_0x42c62c[_0x71ff('0x53')],{'transaction':_0x4c50b1})[_0x71ff('0x25')](function(_0x5e50b8){_0xc1d2d3=_0x5e50b8;return _0x37f638[_0x71ff('0x7d')](_0x5e50b8,{'transaction':_0x4c50b1});})[_0x71ff('0x25')](function(){var _0x17cee7={'type':db['Sequelize'][_0x71ff('0x7e')],'transaction':_0x4c50b1};switch(_0x42c62c[_0x71ff('0x53')][_0x71ff('0x30')]){case _0x71ff('0x7f'):_0x17cee7[_0x71ff('0x30')]=db[_0x71ff('0x80')][_0x71ff('0x7e')];break;case _0x71ff('0x81'):_0x17cee7[_0x71ff('0x30')]=db[_0x71ff('0x80')][_0x71ff('0x82')];break;case _0x71ff('0x83'):_0x17cee7[_0x71ff('0x30')]=db['Sequelize']['BOOLEAN'];_0x17cee7[_0x71ff('0x84')]=![];break;default:}return db[_0x71ff('0x7b')][_0x71ff('0x85')][_0x71ff('0x86')](_0x71ff('0x87'),util[_0x71ff('0x6e')](_0x71ff('0x88'),_0xc1d2d3['id']),_0x17cee7);})[_0x71ff('0x25')](function(){return _0xc1d2d3;});});}})[_0x71ff('0x25')](respondWithResult(_0x3955a3,null))[_0x71ff('0x45')](handleError(_0x3955a3,null));};exports[_0x71ff('0x89')]=function(_0x8a6d10,_0x3235e4,_0x161273){var _0x3b2711={};var _0x1fc8c2={};var _0x376a66;var _0x8a997b;return db[_0x71ff('0x2f')]['findOne']({'where':{'id':_0x8a6d10[_0x71ff('0x47')]['id']}})[_0x71ff('0x25')](handleEntityNotFound(_0x3235e4,null))['then'](function(_0x138af6){if(_0x138af6){_0x376a66=_0x138af6;_0x1fc8c2[_0x71ff('0x32')]=_[_0x71ff('0x48')](db[_0x71ff('0x66')]['rawAttributes']);_0x1fc8c2[_0x71ff('0x34')]=_[_0x71ff('0x48')](_0x8a6d10[_0x71ff('0x34')]);_0x1fc8c2['filters']=_['intersection'](_0x1fc8c2[_0x71ff('0x32')],_0x1fc8c2[_0x71ff('0x34')]);_0x3b2711[_0x71ff('0x38')]=_[_0x71ff('0x36')](_0x1fc8c2[_0x71ff('0x32')],qs['fields'](_0x8a6d10[_0x71ff('0x34')][_0x71ff('0x37')]));_0x3b2711[_0x71ff('0x38')]=_0x3b2711[_0x71ff('0x38')][_0x71ff('0x39')]?_0x3b2711[_0x71ff('0x38')]:_0x1fc8c2[_0x71ff('0x32')];_0x3b2711['order']=qs[_0x71ff('0x3b')](_0x8a6d10[_0x71ff('0x34')]['sort']);_0x3b2711['where']=qs[_0x71ff('0x35')](_['pick'](_0x8a6d10[_0x71ff('0x34')],_0x1fc8c2[_0x71ff('0x35')]));_0x3b2711[_0x71ff('0x3e')]=_[_0x71ff('0x3f')](_0x3b2711[_0x71ff('0x3e')],{'$or':[{'ListId':_0x138af6['id']},{'ListId':null}]});if(_0x8a6d10[_0x71ff('0x34')]['filter']){_0x3b2711['where']=_[_0x71ff('0x3f')](_0x3b2711[_0x71ff('0x3e')],{'$or':_[_0x71ff('0x33')](_0x3b2711['attributes'],function(_0x893e48){var _0x7dcac9={};_0x7dcac9[_0x893e48]={'$like':'%'+_0x8a6d10[_0x71ff('0x34')][_0x71ff('0x3d')]+'%'};return _0x7dcac9;})});}_0x3b2711=_[_0x71ff('0x3f')]({},_0x3b2711,_0x8a6d10['options']);return db[_0x71ff('0x66')][_0x71ff('0x8a')](_0x3b2711);}})[_0x71ff('0x25')](respondWithResult(_0x3235e4,null))[_0x71ff('0x45')](handleError(_0x3235e4,null));};exports['addAgents']=function(_0x353472,_0x2b6e9d,_0x12c8a1){return db[_0x71ff('0x2f')][_0x71ff('0x4b')]({'where':{'id':_0x353472['params']['id']}})['then'](handleEntityNotFound(_0x2b6e9d,null))[_0x71ff('0x25')](function(_0x1b244f){if(_0x1b244f){return _0x1b244f[_0x71ff('0x8b')](_0x353472[_0x71ff('0x53')][_0x71ff('0x5a')],_[_0x71ff('0x60')](_0x353472[_0x71ff('0x53')],[_0x71ff('0x5a'),'id'])||{})[_0x71ff('0x8c')](function(_0x4f4ca7){for(var _0xa2ed14=0x0;_0xa2ed14<_0x353472[_0x71ff('0x53')][_0x71ff('0x5a')]['length'];_0xa2ed14+=0x1){socket['emit'](_0x71ff('0x8d'),{'UserId':_0x353472[_0x71ff('0x53')][_0x71ff('0x5a')][_0xa2ed14],'CmListId':_0x353472[_0x71ff('0x47')]['id']});}return _0x4f4ca7;});}})[_0x71ff('0x25')](respondWithResult(_0x2b6e9d,null))['catch'](handleError(_0x2b6e9d,null));};exports['removeAgents']=function(_0x53726f,_0x2773b5,_0x45c92e){return db[_0x71ff('0x2f')][_0x71ff('0x4b')]({'where':{'id':_0x53726f['params']['id']}})['then'](handleEntityNotFound(_0x2773b5,null))[_0x71ff('0x25')](function(_0xb2cb64){if(_0xb2cb64){return _0xb2cb64[_0x71ff('0x8e')](_0x53726f[_0x71ff('0x34')]['ids'])[_0x71ff('0x25')](function(){if(_['isArray'](_0x53726f[_0x71ff('0x34')][_0x71ff('0x5a')])){for(var _0xe6ae78=0x0;_0xe6ae78<_0x53726f[_0x71ff('0x34')][_0x71ff('0x5a')][_0x71ff('0x39')];_0xe6ae78+=0x1){socket[_0x71ff('0x8f')](_0x71ff('0x90'),{'UserId':Number(_0x53726f[_0x71ff('0x34')][_0x71ff('0x5a')][_0xe6ae78]),'CmListId':Number(_0x53726f[_0x71ff('0x47')]['id'])});}}else{socket['emit'](_0x71ff('0x90'),{'UserId':Number(_0x53726f[_0x71ff('0x34')][_0x71ff('0x5a')]),'CmListId':Number(_0x53726f[_0x71ff('0x47')]['id'])});}});}})[_0x71ff('0x25')](respondWithStatusCode(_0x2773b5,null))[_0x71ff('0x45')](handleError(_0x2773b5,null));};exports['getAgents']=function(_0x3d16f1,_0x2213cb,_0x2862b0){var _0x59454f={};var _0x5a67d6={};var _0x4e7184;var _0x3bb73c;return db['CmList'][_0x71ff('0x57')]({'where':{'id':_0x3d16f1[_0x71ff('0x47')]['id']}})[_0x71ff('0x25')](handleEntityNotFound(_0x2213cb,null))[_0x71ff('0x25')](function(_0x2360da){if(_0x2360da){_0x4e7184=_0x2360da;_0x5a67d6[_0x71ff('0x32')]=_[_0x71ff('0x48')](db['User'][_0x71ff('0x49')]);_0x5a67d6[_0x71ff('0x34')]=_['keys'](_0x3d16f1[_0x71ff('0x34')]);_0x5a67d6[_0x71ff('0x35')]=_[_0x71ff('0x36')](_0x5a67d6['model'],_0x5a67d6[_0x71ff('0x34')]);_0x59454f[_0x71ff('0x38')]=_[_0x71ff('0x36')](_0x5a67d6[_0x71ff('0x32')],qs[_0x71ff('0x37')](_0x3d16f1[_0x71ff('0x34')][_0x71ff('0x37')]));_0x59454f[_0x71ff('0x38')]=_0x59454f['attributes']['length']?_0x59454f[_0x71ff('0x38')]:_0x5a67d6['model'];_0x59454f[_0x71ff('0x6b')]=qs[_0x71ff('0x3b')](_0x3d16f1['query']['sort']);_0x59454f[_0x71ff('0x3e')]=qs[_0x71ff('0x35')](_[_0x71ff('0x3c')](_0x3d16f1[_0x71ff('0x34')],_0x5a67d6['filters']));if(_0x3d16f1[_0x71ff('0x34')][_0x71ff('0x3d')]){_0x59454f['where']=_[_0x71ff('0x3f')](_0x59454f[_0x71ff('0x3e')],{'$or':_[_0x71ff('0x33')](_0x59454f[_0x71ff('0x38')],function(_0x3b557b){var _0x517639={};_0x517639[_0x3b557b]={'$like':'%'+_0x3d16f1[_0x71ff('0x34')][_0x71ff('0x3d')]+'%'};return _0x517639;})});}_0x59454f=_[_0x71ff('0x3f')]({},_0x59454f,_0x3d16f1[_0x71ff('0x41')]);return _0x4e7184['getAgents'](_0x59454f);}})[_0x71ff('0x25')](function(_0x456a0c){if(_0x456a0c){_0x3bb73c=_0x456a0c[_0x71ff('0x39')];if(!_0x3d16f1['query']['hasOwnProperty']('nolimit')){_0x59454f[_0x71ff('0x1f')]=qs['limit'](_0x3d16f1['query'][_0x71ff('0x1f')]);_0x59454f[_0x71ff('0x1e')]=qs[_0x71ff('0x1e')](_0x3d16f1[_0x71ff('0x34')][_0x71ff('0x1e')]);}return _0x4e7184[_0x71ff('0x91')](_0x59454f);}})[_0x71ff('0x25')](function(_0x22991f){if(_0x22991f){return _0x22991f?{'count':_0x3bb73c,'rows':_0x22991f}:null;}})[_0x71ff('0x25')](respondWithResult(_0x2213cb,null))[_0x71ff('0x45')](handleError(_0x2213cb,null));}; \ No newline at end of file +var _0x7fb2=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','redis','defaults','localhost','register','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','end','stack','name','index','CmList','rawAttributes','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find','create','body','role','user','Lists','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','tags','isArray','join','push','each','omit','success','dataValues','errors','message','CmCustomField','CmContact','CustomFields','format','cf_%d','raw','getContactsCsv','concat','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','sendStatus','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','addAgents','spread','userCmList:save','removeAgents','userCmList:remove','emit','getAgents','User','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7fb2,0x80));var _0x27fb=function(_0x549906,_0x32bab6){_0x549906=_0x549906-0x0;var _0xe1abef=_0x7fb2[_0x549906];return _0xe1abef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x27fb('0x0'));var rimraf=require(_0x27fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27fb('0x2'));var rp=require('request-promise');var moment=require(_0x27fb('0x3'));var BPromise=require(_0x27fb('0x4'));var Mustache=require(_0x27fb('0x5'));var util=require(_0x27fb('0x6'));var path=require(_0x27fb('0x7'));var sox=require(_0x27fb('0x8'));var csv=require(_0x27fb('0x9'));var ejs=require(_0x27fb('0xa'));var fs=require('fs');var _=require(_0x27fb('0xb'));var squel=require('squel');var crypto=require(_0x27fb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x27fb('0xd'));var toCsv=require(_0x27fb('0x9'));var querystring=require(_0x27fb('0xe'));var Papa=require('papaparse');var Redis=require(_0x27fb('0xf'));var authService=require(_0x27fb('0x10'));var qs=require(_0x27fb('0x11'));var as=require(_0x27fb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x27fb('0x13'));var config=require(_0x27fb('0x14'));var db=require('../../mysqldb')['db'];config[_0x27fb('0x15')]=_[_0x27fb('0x16')](config[_0x27fb('0x15')],{'host':_0x27fb('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x27fb('0x18')](socket);function respondWithStatusCode(_0x5b1867,_0x14e89e){_0x14e89e=_0x14e89e||0xcc;return function(_0x153012){if(_0x153012){return _0x5b1867['sendStatus'](_0x14e89e);}return _0x5b1867['status'](_0x14e89e)['end']();};}function respondWithResult(_0x465ddc,_0x35b083){_0x35b083=_0x35b083||0xc8;return function(_0x284560){if(_0x284560){return _0x465ddc[_0x27fb('0x19')](_0x35b083)['json'](_0x284560);}};}function respondWithFilteredResult(_0x192f5d,_0x242686){return function(_0x3777b2){if(_0x3777b2){var _0x526b33=_0x3777b2['count'],_0x3fc689=_0x242686[_0x27fb('0x1a')],_0x4aa286=_0x242686[_0x27fb('0x1a')]+_0x242686[_0x27fb('0x1b')],_0xc33b3a;if(_0x4aa286>=_0x526b33){_0x4aa286=_0x526b33;_0xc33b3a=0xc8;}else{_0xc33b3a=0xce;}_0x192f5d['status'](_0xc33b3a);return _0x192f5d[_0x27fb('0x1c')](_0x27fb('0x1d'),_0x3fc689+'-'+_0x4aa286+'/'+_0x526b33)[_0x27fb('0x1e')](_0x3777b2);}return null;};}function patchUpdates(_0x3decf3){return function(_0x42de90){try{jsonpatch[_0x27fb('0x1f')](_0x42de90,_0x3decf3,!![]);}catch(_0xa29edc){return BPromise[_0x27fb('0x20')](_0xa29edc);}return _0x42de90[_0x27fb('0x21')]();};}function saveUpdates(_0x59d1ba,_0xb74625){return function(_0x29bb23){if(_0x29bb23){return _0x29bb23[_0x27fb('0x22')](_0x59d1ba)['then'](function(_0x3ebf8d){return _0x3ebf8d;});}return null;};}function removeEntity(_0x5c8ab3,_0x4698f8){return function(_0x32de8c){if(_0x32de8c){return _0x32de8c[_0x27fb('0x23')]()[_0x27fb('0x24')](function(){var _0x1831cd=_0x32de8c[_0x27fb('0x25')]({'plain':!![]});var _0x1e3f4e='Lists';return db['UserProfileResource'][_0x27fb('0x23')]({'where':{'type':_0x1e3f4e,'resourceId':_0x1831cd['id']}})[_0x27fb('0x24')](function(){return _0x32de8c;});})[_0x27fb('0x24')](function(){_0x5c8ab3[_0x27fb('0x19')](0xcc)[_0x27fb('0x26')]();});}};}function handleEntityNotFound(_0x28f3f0,_0x536ccc){return function(_0x515bfb){if(!_0x515bfb){_0x28f3f0['sendStatus'](0x194);}return _0x515bfb;};}function handleError(_0x15da27,_0x46de70){_0x46de70=_0x46de70||0x1f4;return function(_0x4fadb3){logger['error'](_0x4fadb3[_0x27fb('0x27')]);if(_0x4fadb3[_0x27fb('0x28')]){delete _0x4fadb3[_0x27fb('0x28')];}_0x15da27[_0x27fb('0x19')](_0x46de70)['send'](_0x4fadb3);};}exports[_0x27fb('0x29')]=function(_0x548195,_0x398e14){var _0x2b5f1a={},_0x37b683={},_0x54611f={'count':0x0,'rows':[]};var _0x467b68=_['map'](db[_0x27fb('0x2a')][_0x27fb('0x2b')],function(_0x1489e5){return{'name':_0x1489e5['fieldName'],'type':_0x1489e5[_0x27fb('0x2c')]['key']};});_0x37b683['model']=_[_0x27fb('0x2d')](_0x467b68,_0x27fb('0x28'));_0x37b683[_0x27fb('0x2e')]=_[_0x27fb('0x2f')](_0x548195[_0x27fb('0x2e')]);_0x37b683[_0x27fb('0x30')]=_[_0x27fb('0x31')](_0x37b683[_0x27fb('0x32')],_0x37b683[_0x27fb('0x2e')]);_0x2b5f1a['attributes']=_[_0x27fb('0x31')](_0x37b683[_0x27fb('0x32')],qs[_0x27fb('0x33')](_0x548195[_0x27fb('0x2e')][_0x27fb('0x33')]));_0x2b5f1a['attributes']=_0x2b5f1a[_0x27fb('0x34')][_0x27fb('0x35')]?_0x2b5f1a[_0x27fb('0x34')]:_0x37b683['model'];if(!_0x548195[_0x27fb('0x2e')][_0x27fb('0x36')]('nolimit')){_0x2b5f1a['limit']=qs[_0x27fb('0x1b')](_0x548195[_0x27fb('0x2e')]['limit']);_0x2b5f1a[_0x27fb('0x1a')]=qs[_0x27fb('0x1a')](_0x548195[_0x27fb('0x2e')][_0x27fb('0x1a')]);}_0x2b5f1a[_0x27fb('0x37')]=qs[_0x27fb('0x38')](_0x548195[_0x27fb('0x2e')][_0x27fb('0x38')]);_0x2b5f1a[_0x27fb('0x39')]=qs[_0x27fb('0x30')](_[_0x27fb('0x3a')](_0x548195[_0x27fb('0x2e')],_0x37b683['filters']),_0x467b68);if(_0x548195['query']['filter']){_0x2b5f1a[_0x27fb('0x39')]=_[_0x27fb('0x3b')](_0x2b5f1a[_0x27fb('0x39')],{'$or':_[_0x27fb('0x2d')](_0x467b68,function(_0x644fb9){if(_0x644fb9[_0x27fb('0x2c')]!==_0x27fb('0x3c')){var _0x17cf8a={};_0x17cf8a[_0x644fb9[_0x27fb('0x28')]]={'$like':'%'+_0x548195[_0x27fb('0x2e')][_0x27fb('0x3d')]+'%'};return _0x17cf8a;}})});}_0x2b5f1a=_['merge']({},_0x2b5f1a,_0x548195[_0x27fb('0x3e')]);var _0x455145={'where':_0x2b5f1a[_0x27fb('0x39')]};return db[_0x27fb('0x2a')][_0x27fb('0x3f')](_0x455145)[_0x27fb('0x24')](function(_0x3efc38){_0x54611f[_0x27fb('0x3f')]=_0x3efc38;if(_0x548195[_0x27fb('0x2e')][_0x27fb('0x40')]){_0x2b5f1a[_0x27fb('0x41')]=[{'all':!![]}];}return db[_0x27fb('0x2a')][_0x27fb('0x42')](_0x2b5f1a);})[_0x27fb('0x24')](function(_0x187bcc){_0x54611f[_0x27fb('0x43')]=_0x187bcc;return _0x54611f;})[_0x27fb('0x24')](respondWithFilteredResult(_0x398e14,_0x2b5f1a))['catch'](handleError(_0x398e14,null));};exports[_0x27fb('0x44')]=function(_0x4f9c89,_0x243203){var _0x15b670={'raw':![],'where':{'id':_0x4f9c89[_0x27fb('0x45')]['id']}},_0x916a97={};_0x916a97['model']=_[_0x27fb('0x2f')](db[_0x27fb('0x2a')]['rawAttributes']);_0x916a97[_0x27fb('0x2e')]=_['keys'](_0x4f9c89[_0x27fb('0x2e')]);_0x916a97[_0x27fb('0x30')]=_[_0x27fb('0x31')](_0x916a97['model'],_0x916a97[_0x27fb('0x2e')]);_0x15b670[_0x27fb('0x34')]=_[_0x27fb('0x31')](_0x916a97['model'],qs['fields'](_0x4f9c89['query'][_0x27fb('0x33')]));_0x15b670[_0x27fb('0x34')]=_0x15b670[_0x27fb('0x34')]['length']?_0x15b670[_0x27fb('0x34')]:_0x916a97['model'];if(_0x4f9c89[_0x27fb('0x2e')]['includeAll']){_0x15b670['include']=[{'all':!![]}];}_0x15b670=_['merge']({},_0x15b670,_0x4f9c89['options']);return db[_0x27fb('0x2a')][_0x27fb('0x46')](_0x15b670)[_0x27fb('0x24')](handleEntityNotFound(_0x243203,null))[_0x27fb('0x24')](respondWithResult(_0x243203,null))['catch'](handleError(_0x243203,null));};exports[_0x27fb('0x47')]=function(_0x4e33bd,_0x3797e3){return db[_0x27fb('0x2a')][_0x27fb('0x47')](_0x4e33bd[_0x27fb('0x48')],{})['then'](function(_0x55272a){var _0x686b57=_0x4e33bd['user'][_0x27fb('0x25')]({'plain':!![]});if(!_0x686b57)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x686b57[_0x27fb('0x49')]===_0x27fb('0x4a')){var _0x102b9a=_0x55272a[_0x27fb('0x25')]({'plain':!![]});var _0x23e05c=_0x27fb('0x4b');return db[_0x27fb('0x4c')]['find']({'where':{'name':_0x23e05c,'userProfileId':_0x686b57[_0x27fb('0x4d')]},'raw':!![]})['then'](function(_0xdd6f68){if(_0xdd6f68&&_0xdd6f68[_0x27fb('0x4e')]===0x0){return db[_0x27fb('0x4f')][_0x27fb('0x47')]({'name':_0x102b9a[_0x27fb('0x28')],'resourceId':_0x102b9a['id'],'type':_0xdd6f68[_0x27fb('0x28')],'sectionId':_0xdd6f68['id']},{})[_0x27fb('0x24')](function(){return _0x55272a;});}else{return _0x55272a;}})[_0x27fb('0x50')](function(_0x4e25a6){logger[_0x27fb('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e25a6);throw _0x4e25a6;});}return _0x55272a;})[_0x27fb('0x24')](respondWithResult(_0x3797e3,0xc9))[_0x27fb('0x50')](handleError(_0x3797e3,null));};exports[_0x27fb('0x22')]=function(_0x1c7291,_0x1e5f67){if(_0x1c7291[_0x27fb('0x48')]['id']){delete _0x1c7291[_0x27fb('0x48')]['id'];}return db[_0x27fb('0x2a')][_0x27fb('0x46')]({'where':{'id':_0x1c7291[_0x27fb('0x45')]['id']}})[_0x27fb('0x24')](handleEntityNotFound(_0x1e5f67,null))[_0x27fb('0x24')](saveUpdates(_0x1c7291[_0x27fb('0x48')],null))[_0x27fb('0x24')](respondWithResult(_0x1e5f67,null))[_0x27fb('0x50')](handleError(_0x1e5f67,null));};exports[_0x27fb('0x23')]=function(_0x46e53a,_0x21471f){return db[_0x27fb('0x2a')][_0x27fb('0x46')]({'where':{'id':_0x46e53a[_0x27fb('0x45')]['id']}})[_0x27fb('0x24')](handleEntityNotFound(_0x21471f,null))['then'](removeEntity(_0x21471f,null))[_0x27fb('0x50')](handleError(_0x21471f,null));};exports['describe']=function(_0x1e5420,_0x1194a7){return db[_0x27fb('0x2a')][_0x27fb('0x52')]()['then'](respondWithResult(_0x1194a7,null))[_0x27fb('0x50')](handleError(_0x1194a7,null));};exports[_0x27fb('0x53')]=function(_0x3191fd,_0x550b38,_0x22961f){if(_0x3191fd[_0x27fb('0x48')]['id']){delete _0x3191fd[_0x27fb('0x48')]['id'];}return db[_0x27fb('0x2a')]['find']({'where':{'id':_0x3191fd[_0x27fb('0x45')]['id']}})[_0x27fb('0x24')](handleEntityNotFound(_0x550b38,null))['then'](function(_0x2e4a6e){if(_0x2e4a6e){_0x3191fd[_0x27fb('0x48')][_0x27fb('0x54')]=_0x2e4a6e['id'];return db[_0x27fb('0x55')][_0x27fb('0x47')](_0x3191fd[_0x27fb('0x48')]);}})[_0x27fb('0x24')](respondWithResult(_0x550b38,null))[_0x27fb('0x50')](handleError(_0x550b38,null));};exports[_0x27fb('0x56')]=function(_0x10d562,_0x4e86e7,_0x14851a){var _0x16da95={'raw':![],'where':{}};var _0x289ca6={};var _0x580c40={'count':0x0,'rows':[]};return db[_0x27fb('0x2a')][_0x27fb('0x57')]({'where':{'id':_0x10d562[_0x27fb('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e86e7,null))[_0x27fb('0x24')](function(_0x42bcf7){if(_0x42bcf7){_0x289ca6['model']=_['keys'](db[_0x27fb('0x55')][_0x27fb('0x2b')]);_0x289ca6[_0x27fb('0x2e')]=_['keys'](_0x10d562[_0x27fb('0x2e')]);_0x289ca6[_0x27fb('0x30')]=_[_0x27fb('0x31')](_0x289ca6[_0x27fb('0x32')],_0x289ca6[_0x27fb('0x2e')]);_0x16da95[_0x27fb('0x34')]=_['intersection'](_0x289ca6[_0x27fb('0x32')],qs[_0x27fb('0x33')](_0x10d562[_0x27fb('0x2e')][_0x27fb('0x33')]));_0x16da95[_0x27fb('0x34')]=_0x16da95[_0x27fb('0x34')][_0x27fb('0x35')]?_0x16da95[_0x27fb('0x34')]:_0x289ca6['model'];if(!_0x10d562['query'][_0x27fb('0x36')](_0x27fb('0x58'))){_0x16da95[_0x27fb('0x1b')]=qs[_0x27fb('0x1b')](_0x10d562[_0x27fb('0x2e')]['limit']);_0x16da95['offset']=qs[_0x27fb('0x1a')](_0x10d562[_0x27fb('0x2e')][_0x27fb('0x1a')]);}_0x16da95[_0x27fb('0x37')]=qs[_0x27fb('0x38')](_0x10d562[_0x27fb('0x2e')][_0x27fb('0x38')]);_0x16da95[_0x27fb('0x39')]=qs[_0x27fb('0x30')](_[_0x27fb('0x3a')](_0x10d562[_0x27fb('0x2e')],_0x289ca6[_0x27fb('0x30')]));_0x16da95['where'][_0x27fb('0x54')]=_0x42bcf7['id'];if(_0x10d562['query'][_0x27fb('0x3d')]){_0x16da95[_0x27fb('0x39')]=_['merge'](_0x16da95[_0x27fb('0x39')],{'$or':_['map'](_0x16da95[_0x27fb('0x34')],function(_0x19d3b0){var _0x456dc7={};_0x456dc7[_0x19d3b0]={'$like':'%'+_0x10d562[_0x27fb('0x2e')][_0x27fb('0x3d')]+'%'};return _0x456dc7;})});}_0x16da95=_[_0x27fb('0x3b')]({},_0x16da95,_0x10d562[_0x27fb('0x3e')]);return db[_0x27fb('0x55')][_0x27fb('0x3f')]({'where':_0x16da95['where']})['then'](function(_0x4e2ef1){_0x580c40['count']=_0x4e2ef1;if(_0x10d562['query'][_0x27fb('0x40')]){_0x16da95[_0x27fb('0x41')]=[{'all':!![]}];}return db[_0x27fb('0x55')][_0x27fb('0x42')](_0x16da95);})[_0x27fb('0x24')](function(_0x1128e2){_0x580c40['rows']=_0x1128e2;return _0x580c40;});}})['then'](respondWithFilteredResult(_0x4e86e7,_0x16da95))[_0x27fb('0x50')](handleError(_0x4e86e7,null));};exports['removeDispositions']=function(_0xa29712,_0x3c5f0e,_0x2a1563){return db[_0x27fb('0x2a')]['find']({'where':{'id':_0xa29712['params']['id']}})[_0x27fb('0x24')](handleEntityNotFound(_0x3c5f0e,null))[_0x27fb('0x24')](function(_0x24dfde){if(_0x24dfde){return _0x24dfde[_0x27fb('0x59')](_0xa29712[_0x27fb('0x2e')][_0x27fb('0x5a')]);}})[_0x27fb('0x24')](respondWithStatusCode(_0x3c5f0e,null))['catch'](handleError(_0x3c5f0e,null));};exports['addContacts']=function(_0x2ae1fa,_0x385b2c,_0x29ba81){return db[_0x27fb('0x2a')]['find']({'where':{'id':_0x2ae1fa['params']['id']}})[_0x27fb('0x24')](handleEntityNotFound(_0x385b2c,null))[_0x27fb('0x24')](function(_0x659dcb){if(_0x659dcb){var _0x103430=[];var _0x3e83bb={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x27fb('0x24')](function(_0x1650e8){if(_0x2ae1fa[_0x27fb('0x48')][_0x27fb('0x5b')]&&_[_0x27fb('0x5c')](_0x2ae1fa[_0x27fb('0x48')][_0x27fb('0x5b')])){if(_0x2ae1fa['body'][_0x27fb('0x5b')][_0x27fb('0x35')]){_0x2ae1fa[_0x27fb('0x48')][_0x27fb('0x5b')]=_0x2ae1fa['body'][_0x27fb('0x5b')][_0x27fb('0x5d')](';')+';';}else{_0x2ae1fa[_0x27fb('0x48')][_0x27fb('0x5b')]=null;}}else{_0x2ae1fa['body'][_0x27fb('0x5b')]=null;}if(_0x2ae1fa[_0x27fb('0x48')]&&_[_0x27fb('0x5c')](_0x2ae1fa['body'])){for(var _0x3b73b3=0x0;_0x3b73b3<_0x2ae1fa[_0x27fb('0x48')][_0x27fb('0x35')];_0x3b73b3+=0x1){_0x2ae1fa['body'][_0x3b73b3][_0x27fb('0x54')]=_0x2ae1fa['params']['id'];_0x103430[_0x27fb('0x5e')](_0x2ae1fa['body'][_0x3b73b3]);}return BPromise[_0x27fb('0x5f')](_0x103430,function(_0x39f071){return db['CmContact'][_0x27fb('0x47')](_[_0x27fb('0x60')](_0x39f071,[_0x27fb('0x5a'),'id'])||{},{'fields':_[_0x27fb('0x2f')](_0x1650e8),'raw':!![]})['then'](function(_0x14891d){_0x3e83bb[_0x27fb('0x61')][_0x27fb('0x5e')](_0x14891d[_0x27fb('0x62')]);})[_0x27fb('0x50')](function(_0x4d8ca7){_0x3e83bb[_0x27fb('0x63')][_0x27fb('0x5e')]({'data':_0x39f071,'error':_0x4d8ca7[_0x27fb('0x64')]});});})['then'](function(_0x22b075){return _0x3e83bb;})[_0x27fb('0x50')](function(_0x453bdb){return _0x453bdb;});}else{_0x385b2c[_0x27fb('0x19')](0x190)[_0x27fb('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x27fb('0x24')](respondWithResult(_0x385b2c,null))['catch'](handleError(_0x385b2c,null));};exports['getContacts']=function(_0x48a97b,_0x118a57,_0x368b4a){var _0x2e6e03;return db[_0x27fb('0x2a')][_0x27fb('0x46')]({'where':{'id':_0x48a97b[_0x27fb('0x45')]['id']},'include':[{'model':db[_0x27fb('0x65')],'as':'CustomFields'}]})[_0x27fb('0x24')](handleEntityNotFound(_0x118a57,null))[_0x27fb('0x24')](function(_0xa663b8){if(_0xa663b8){_0x2e6e03=_0xa663b8;return db[_0x27fb('0x66')][_0x27fb('0x2b')];}})[_0x27fb('0x24')](function(_0x3c186b){if(_0x3c186b){var _0x4c186d={};var _0x1ad706={};_0x1ad706[_0x27fb('0x32')]=_['concat'](_[_0x27fb('0x2f')](_0x3c186b),_[_0x27fb('0x2d')](_0x2e6e03[_0x27fb('0x67')],function(_0x85dbb8){return util[_0x27fb('0x68')](_0x27fb('0x69'),_0x85dbb8['id']);}));_0x1ad706[_0x27fb('0x2e')]=_[_0x27fb('0x2f')](_0x48a97b[_0x27fb('0x2e')]);_0x1ad706[_0x27fb('0x30')]=_['intersection'](_0x1ad706[_0x27fb('0x32')],_0x1ad706['query']);_0x4c186d[_0x27fb('0x34')]=_[_0x27fb('0x31')](_0x1ad706['model'],qs[_0x27fb('0x33')](_0x48a97b[_0x27fb('0x2e')][_0x27fb('0x33')]));_0x4c186d[_0x27fb('0x34')]=_0x4c186d[_0x27fb('0x34')][_0x27fb('0x35')]?_0x4c186d[_0x27fb('0x34')]:_0x1ad706[_0x27fb('0x32')];if(!_0x48a97b[_0x27fb('0x2e')][_0x27fb('0x36')]('nolimit')){_0x4c186d['limit']=qs[_0x27fb('0x1b')](_0x48a97b[_0x27fb('0x2e')][_0x27fb('0x1b')]);_0x4c186d['offset']=qs[_0x27fb('0x1a')](_0x48a97b['query'][_0x27fb('0x1a')]);}_0x4c186d[_0x27fb('0x37')]=qs[_0x27fb('0x38')](_0x48a97b[_0x27fb('0x2e')]['sort']);_0x4c186d[_0x27fb('0x39')]=qs[_0x27fb('0x30')](_['pick'](_0x48a97b['query'],_0x1ad706[_0x27fb('0x30')]));_0x4c186d[_0x27fb('0x6a')]=!![];if(_0x48a97b[_0x27fb('0x2e')][_0x27fb('0x3d')]){_0x4c186d['where']=_[_0x27fb('0x3b')](_0x4c186d['where'],{'$or':_['map'](_0x4c186d['attributes'],function(_0x5d2026){var _0x2d7bba={};_0x2d7bba[_0x5d2026]={'$like':'%'+_0x48a97b[_0x27fb('0x2e')][_0x27fb('0x3d')]+'%'};return _0x2d7bba;})});}_0x4c186d=_['merge']({},_0x4c186d,_0x48a97b[_0x27fb('0x3e')]);return _0x2e6e03['getContacts'](_0x4c186d);}})[_0x27fb('0x24')](respondWithResult(_0x118a57,null))['catch'](handleError(_0x118a57,null));};exports[_0x27fb('0x6b')]=function(_0x211d29,_0x2bb207,_0x1b4805){var _0x2d2c35;return db[_0x27fb('0x2a')][_0x27fb('0x46')]({'where':{'id':_0x211d29[_0x27fb('0x45')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x27fb('0x67')}]})[_0x27fb('0x24')](handleEntityNotFound(_0x2bb207,null))[_0x27fb('0x24')](function(_0xa87dc){if(_0xa87dc){_0x2d2c35=_0xa87dc;return db[_0x27fb('0x66')][_0x27fb('0x2b')];}})[_0x27fb('0x24')](function(_0x2b1b79){if(_0x2b1b79){var _0xa9616={};var _0x2af021={};_0x2af021[_0x27fb('0x32')]=_[_0x27fb('0x6c')](_[_0x27fb('0x2f')](_0x2b1b79),_[_0x27fb('0x2d')](_0x2d2c35['CustomFields'],function(_0x254d2f){return util[_0x27fb('0x68')](_0x27fb('0x69'),_0x254d2f['id']);}));_0x2af021[_0x27fb('0x2e')]=_['keys'](_0x211d29['query']);_0x2af021['filters']=_[_0x27fb('0x31')](_0x2af021[_0x27fb('0x32')],_0x2af021[_0x27fb('0x2e')]);_0xa9616['attributes']=_[_0x27fb('0x31')](_0x2af021[_0x27fb('0x32')],qs['fields'](_0x211d29[_0x27fb('0x2e')][_0x27fb('0x33')]));_0xa9616[_0x27fb('0x34')]=_0xa9616[_0x27fb('0x34')][_0x27fb('0x35')]?_0xa9616[_0x27fb('0x34')]:_0x2af021[_0x27fb('0x32')];if(!_0x211d29[_0x27fb('0x2e')][_0x27fb('0x36')]('nolimit')){_0xa9616[_0x27fb('0x1b')]=qs[_0x27fb('0x1b')](_0x211d29[_0x27fb('0x2e')][_0x27fb('0x1b')]);_0xa9616['offset']=qs[_0x27fb('0x1a')](_0x211d29[_0x27fb('0x2e')]['offset']);}_0xa9616[_0x27fb('0x37')]=qs[_0x27fb('0x38')](_0x211d29[_0x27fb('0x2e')][_0x27fb('0x38')]);_0xa9616[_0x27fb('0x39')]=qs['filters'](_[_0x27fb('0x3a')](_0x211d29['query'],_0x2af021[_0x27fb('0x30')]));_0xa9616['raw']=!![];if(_0x211d29[_0x27fb('0x2e')]['filter']){_0xa9616[_0x27fb('0x39')]=_[_0x27fb('0x3b')](_0xa9616[_0x27fb('0x39')],{'$or':_[_0x27fb('0x2d')](_0xa9616[_0x27fb('0x34')],function(_0x5068bf){var _0x4f0636={};_0x4f0636[_0x5068bf]={'$like':'%'+_0x211d29[_0x27fb('0x2e')][_0x27fb('0x3d')]+'%'};return _0x4f0636;})});}_0xa9616=_['merge']({},_0xa9616,_0x211d29['options']);return _0x2d2c35['getContacts'](_0xa9616);}})['then'](function(_0x134ce4){if(!_[_0x27fb('0x6d')](_0x134ce4)){var _0x480681=toCsv(_0x134ce4);var _0x17576a=Date[_0x27fb('0x6e')]();fs[_0x27fb('0x6f')](util[_0x27fb('0x68')](_0x27fb('0x70'),_0x2d2c35['id'],_0x17576a),_0x480681);_0x2bb207['setHeader'](_0x27fb('0x71'),_0x27fb('0x72')+util[_0x27fb('0x68')](_0x27fb('0x73'),_0x2d2c35['id'],_0x17576a));_0x2bb207[_0x27fb('0x74')](_0x27fb('0x75'),_0x27fb('0x76'));return _0x2bb207[_0x27fb('0x77')](util[_0x27fb('0x68')](_0x27fb('0x70'),_0x2d2c35['id'],_0x17576a));}else{return _0x2bb207[_0x27fb('0x78')](0xcc);}})['catch'](handleError(_0x2bb207,null));};exports[_0x27fb('0x79')]=function(_0x56656f,_0x240a27,_0x5bc396){var _0x541802;delete _0x56656f['body']['id'];return db[_0x27fb('0x2a')][_0x27fb('0x57')]({'where':{'id':_0x56656f[_0x27fb('0x45')]['id']}})['then'](handleEntityNotFound(_0x240a27,null))[_0x27fb('0x24')](function(_0x549d9d){if(_0x549d9d){return db[_0x27fb('0x7a')][_0x27fb('0x7b')](function(_0x382312){return db[_0x27fb('0x65')][_0x27fb('0x47')](_0x56656f[_0x27fb('0x48')],{'transaction':_0x382312})[_0x27fb('0x24')](function(_0x541e20){_0x541802=_0x541e20;return _0x549d9d[_0x27fb('0x7c')](_0x541e20,{'transaction':_0x382312});})[_0x27fb('0x24')](function(){var _0x40db20={'type':db[_0x27fb('0x7d')][_0x27fb('0x7e')],'transaction':_0x382312};switch(_0x56656f[_0x27fb('0x48')][_0x27fb('0x2c')]){case _0x27fb('0x7f'):_0x40db20[_0x27fb('0x2c')]=db[_0x27fb('0x7d')][_0x27fb('0x7e')];break;case _0x27fb('0x80'):_0x40db20[_0x27fb('0x2c')]=db[_0x27fb('0x7d')]['INTEGER'];break;case _0x27fb('0x81'):_0x40db20[_0x27fb('0x2c')]=db[_0x27fb('0x7d')][_0x27fb('0x82')];_0x40db20[_0x27fb('0x83')]=![];break;default:}return db[_0x27fb('0x7a')][_0x27fb('0x84')][_0x27fb('0x85')](_0x27fb('0x86'),util[_0x27fb('0x68')]('cf_%s',_0x541802['id']),_0x40db20);})[_0x27fb('0x24')](function(){return _0x541802;});});}})[_0x27fb('0x24')](respondWithResult(_0x240a27,null))[_0x27fb('0x50')](handleError(_0x240a27,null));};exports['getCustomFields']=function(_0x49b8a3,_0x4b7843,_0x3847af){var _0x3faea2={};var _0x3dad98={};var _0x54bca6;var _0xc74920;return db[_0x27fb('0x2a')][_0x27fb('0x57')]({'where':{'id':_0x49b8a3[_0x27fb('0x45')]['id']}})[_0x27fb('0x24')](handleEntityNotFound(_0x4b7843,null))[_0x27fb('0x24')](function(_0x594e63){if(_0x594e63){_0x54bca6=_0x594e63;_0x3dad98[_0x27fb('0x32')]=_[_0x27fb('0x2f')](db[_0x27fb('0x65')][_0x27fb('0x2b')]);_0x3dad98[_0x27fb('0x2e')]=_[_0x27fb('0x2f')](_0x49b8a3[_0x27fb('0x2e')]);_0x3dad98[_0x27fb('0x30')]=_[_0x27fb('0x31')](_0x3dad98['model'],_0x3dad98[_0x27fb('0x2e')]);_0x3faea2['attributes']=_[_0x27fb('0x31')](_0x3dad98[_0x27fb('0x32')],qs[_0x27fb('0x33')](_0x49b8a3[_0x27fb('0x2e')][_0x27fb('0x33')]));_0x3faea2[_0x27fb('0x34')]=_0x3faea2[_0x27fb('0x34')]['length']?_0x3faea2[_0x27fb('0x34')]:_0x3dad98['model'];_0x3faea2[_0x27fb('0x37')]=qs['sort'](_0x49b8a3[_0x27fb('0x2e')][_0x27fb('0x38')]);_0x3faea2[_0x27fb('0x39')]=qs['filters'](_['pick'](_0x49b8a3[_0x27fb('0x2e')],_0x3dad98['filters']));_0x3faea2[_0x27fb('0x39')]=_['merge'](_0x3faea2['where'],{'$or':[{'ListId':_0x594e63['id']},{'ListId':null}]});if(_0x49b8a3[_0x27fb('0x2e')][_0x27fb('0x3d')]){_0x3faea2[_0x27fb('0x39')]=_['merge'](_0x3faea2[_0x27fb('0x39')],{'$or':_[_0x27fb('0x2d')](_0x3faea2[_0x27fb('0x34')],function(_0x43f1ad){var _0x54703d={};_0x54703d[_0x43f1ad]={'$like':'%'+_0x49b8a3[_0x27fb('0x2e')]['filter']+'%'};return _0x54703d;})});}_0x3faea2=_[_0x27fb('0x3b')]({},_0x3faea2,_0x49b8a3[_0x27fb('0x3e')]);return db[_0x27fb('0x65')]['findAndCountAll'](_0x3faea2);}})[_0x27fb('0x24')](respondWithResult(_0x4b7843,null))['catch'](handleError(_0x4b7843,null));};exports[_0x27fb('0x87')]=function(_0x31a4b8,_0x2ba0e4,_0x248441){return db[_0x27fb('0x2a')]['find']({'where':{'id':_0x31a4b8['params']['id']}})[_0x27fb('0x24')](handleEntityNotFound(_0x2ba0e4,null))['then'](function(_0x2297da){if(_0x2297da){return _0x2297da[_0x27fb('0x87')](_0x31a4b8[_0x27fb('0x48')]['ids'],_[_0x27fb('0x60')](_0x31a4b8[_0x27fb('0x48')],[_0x27fb('0x5a'),'id'])||{})[_0x27fb('0x88')](function(_0x47fba0){for(var _0x7922fb=0x0;_0x7922fb<_0x31a4b8[_0x27fb('0x48')]['ids'][_0x27fb('0x35')];_0x7922fb+=0x1){socket['emit'](_0x27fb('0x89'),{'UserId':_0x31a4b8[_0x27fb('0x48')][_0x27fb('0x5a')][_0x7922fb],'CmListId':_0x31a4b8[_0x27fb('0x45')]['id']});}return _0x47fba0;});}})[_0x27fb('0x24')](respondWithResult(_0x2ba0e4,null))[_0x27fb('0x50')](handleError(_0x2ba0e4,null));};exports['removeAgents']=function(_0x1e2532,_0x513477,_0x424e66){return db[_0x27fb('0x2a')][_0x27fb('0x46')]({'where':{'id':_0x1e2532[_0x27fb('0x45')]['id']}})['then'](handleEntityNotFound(_0x513477,null))[_0x27fb('0x24')](function(_0x126bf5){if(_0x126bf5){return _0x126bf5[_0x27fb('0x8a')](_0x1e2532[_0x27fb('0x2e')][_0x27fb('0x5a')])['then'](function(){if(_[_0x27fb('0x5c')](_0x1e2532['query']['ids'])){for(var _0x428aea=0x0;_0x428aea<_0x1e2532['query'][_0x27fb('0x5a')][_0x27fb('0x35')];_0x428aea+=0x1){socket['emit'](_0x27fb('0x8b'),{'UserId':Number(_0x1e2532[_0x27fb('0x2e')][_0x27fb('0x5a')][_0x428aea]),'CmListId':Number(_0x1e2532[_0x27fb('0x45')]['id'])});}}else{socket[_0x27fb('0x8c')](_0x27fb('0x8b'),{'UserId':Number(_0x1e2532[_0x27fb('0x2e')][_0x27fb('0x5a')]),'CmListId':Number(_0x1e2532[_0x27fb('0x45')]['id'])});}});}})[_0x27fb('0x24')](respondWithStatusCode(_0x513477,null))[_0x27fb('0x50')](handleError(_0x513477,null));};exports[_0x27fb('0x8d')]=function(_0x1b0318,_0x22db57,_0x21e64a){var _0x5b944b={};var _0x419241={};var _0xc53df1;var _0x49a54e;return db[_0x27fb('0x2a')]['findOne']({'where':{'id':_0x1b0318[_0x27fb('0x45')]['id']}})['then'](handleEntityNotFound(_0x22db57,null))['then'](function(_0x16d6ed){if(_0x16d6ed){_0xc53df1=_0x16d6ed;_0x419241[_0x27fb('0x32')]=_[_0x27fb('0x2f')](db[_0x27fb('0x8e')][_0x27fb('0x2b')]);_0x419241['query']=_[_0x27fb('0x2f')](_0x1b0318[_0x27fb('0x2e')]);_0x419241['filters']=_['intersection'](_0x419241['model'],_0x419241[_0x27fb('0x2e')]);_0x5b944b[_0x27fb('0x34')]=_[_0x27fb('0x31')](_0x419241[_0x27fb('0x32')],qs[_0x27fb('0x33')](_0x1b0318[_0x27fb('0x2e')][_0x27fb('0x33')]));_0x5b944b[_0x27fb('0x34')]=_0x5b944b[_0x27fb('0x34')][_0x27fb('0x35')]?_0x5b944b['attributes']:_0x419241[_0x27fb('0x32')];_0x5b944b[_0x27fb('0x37')]=qs[_0x27fb('0x38')](_0x1b0318[_0x27fb('0x2e')][_0x27fb('0x38')]);_0x5b944b[_0x27fb('0x39')]=qs['filters'](_['pick'](_0x1b0318[_0x27fb('0x2e')],_0x419241[_0x27fb('0x30')]));if(_0x1b0318['query'][_0x27fb('0x3d')]){_0x5b944b[_0x27fb('0x39')]=_[_0x27fb('0x3b')](_0x5b944b[_0x27fb('0x39')],{'$or':_['map'](_0x5b944b[_0x27fb('0x34')],function(_0x202982){var _0x56f103={};_0x56f103[_0x202982]={'$like':'%'+_0x1b0318['query']['filter']+'%'};return _0x56f103;})});}_0x5b944b=_[_0x27fb('0x3b')]({},_0x5b944b,_0x1b0318[_0x27fb('0x3e')]);return _0xc53df1[_0x27fb('0x8d')](_0x5b944b);}})[_0x27fb('0x24')](function(_0x59a0ca){if(_0x59a0ca){_0x49a54e=_0x59a0ca['length'];if(!_0x1b0318[_0x27fb('0x2e')][_0x27fb('0x36')](_0x27fb('0x58'))){_0x5b944b[_0x27fb('0x1b')]=qs[_0x27fb('0x1b')](_0x1b0318[_0x27fb('0x2e')]['limit']);_0x5b944b[_0x27fb('0x1a')]=qs[_0x27fb('0x1a')](_0x1b0318['query'][_0x27fb('0x1a')]);}return _0xc53df1['getAgents'](_0x5b944b);}})[_0x27fb('0x24')](function(_0x5c6267){if(_0x5c6267){return _0x5c6267?{'count':_0x49a54e,'rows':_0x5c6267}:null;}})[_0x27fb('0x24')](respondWithResult(_0x22db57,null))[_0x27fb('0x50')](handleError(_0x22db57,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1e91eb5..a7be154 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 _0x61f7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList','save','update','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x61f7,0x11c));var _0x761f=function(_0x40d541,_0x353bc9){_0x40d541=_0x40d541-0x0;var _0x897b57=_0x61f7[_0x40d541];return _0x897b57;};'use strict';var EventEmitter=require(_0x761f('0x0'));var CmList=require(_0x761f('0x1'))['db'][_0x761f('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x761f('0x3'),'afterUpdate':_0x761f('0x4'),'afterDestroy':_0x761f('0x5')};function emitEvent(_0x1587a2){return function(_0xf494b0,_0x30b89b,_0x31b1a0){CmListEvents[_0x761f('0x6')](_0x1587a2+':'+_0xf494b0['id'],_0xf494b0);CmListEvents[_0x761f('0x6')](_0x1587a2,_0xf494b0);_0x31b1a0(null);};}for(var e in events){if(events[_0x761f('0x7')](e)){var event=events[e];CmList[_0x761f('0x8')](e,emitEvent(event));}}module[_0x761f('0x9')]=CmListEvents; \ No newline at end of file +var _0xcb26=['setMaxListeners','remove','emit','hook','exports','../../mysqldb'];(function(_0x5a60b4,_0x31ef03){var _0x152d54=function(_0xbba35b){while(--_0xbba35b){_0x5a60b4['push'](_0x5a60b4['shift']());}};_0x152d54(++_0x31ef03);}(_0xcb26,0x83));var _0x6cb2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb26[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var CmList=require(_0x6cb2('0x0'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x6cb2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6cb2('0x2')};function emitEvent(_0x475fb3){return function(_0x496eaf,_0x399220,_0x32a5bd){CmListEvents[_0x6cb2('0x3')](_0x475fb3+':'+_0x496eaf['id'],_0x496eaf);CmListEvents[_0x6cb2('0x3')](_0x475fb3,_0x496eaf);_0x32a5bd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x6cb2('0x4')](e,emitEvent(event));}}module[_0x6cb2('0x5')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a90d655..bb089d8 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 _0x5cc9=['exports','define','cm_lists','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./cmList.attributes'];(function(_0xaad33,_0x34a032){var _0x4847f3=function(_0x256af9){while(--_0x256af9){_0xaad33['push'](_0xaad33['shift']());}};_0x4847f3(++_0x34a032);}(_0x5cc9,0x13b));var _0x95cc=function(_0xa763e4,_0x4fcd7a){_0xa763e4=_0xa763e4-0x0;var _0x4e75c8=_0x5cc9[_0xa763e4];return _0x4e75c8;};'use strict';var _=require(_0x95cc('0x0'));var util=require(_0x95cc('0x1'));var logger=require(_0x95cc('0x2'))(_0x95cc('0x3'));var moment=require(_0x95cc('0x4'));var BPromise=require(_0x95cc('0x5'));var rp=require(_0x95cc('0x6'));var fs=require('fs');var path=require(_0x95cc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x95cc('0x8'));module[_0x95cc('0x9')]=function(_0x387fca,_0x15ac49){return _0x387fca[_0x95cc('0xa')]('CmList',attributes,{'tableName':_0x95cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2afa=['request-promise','rimraf','../../config/environment','./cmList.attributes','cm_lists','lodash','../../config/logger','api','bluebird'];(function(_0x529ffe,_0x52d358){var _0x239f6f=function(_0x3402a8){while(--_0x3402a8){_0x529ffe['push'](_0x529ffe['shift']());}};_0x239f6f(++_0x52d358);}(_0x2afa,0x11c));var _0xa2af=function(_0x30cc4c,_0x390707){_0x30cc4c=_0x30cc4c-0x0;var _0x376927=_0x2afa[_0x30cc4c];return _0x376927;};'use strict';var _=require(_0xa2af('0x0'));var util=require('util');var logger=require(_0xa2af('0x1'))(_0xa2af('0x2'));var moment=require('moment');var BPromise=require(_0xa2af('0x3'));var rp=require(_0xa2af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa2af('0x5'));var config=require(_0xa2af('0x6'));var attributes=require(_0xa2af('0x7'));module['exports']=function(_0x4dbf17,_0x3c98ed){return _0x4dbf17['define']('CmList',attributes,{'tableName':_0xa2af('0x8'),'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 482e9dc..bf49b66 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 _0xfc8c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','debug','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xfc8c,0x6b));var _0xcfc8=function(_0xdd9f41,_0x23cdfa){_0xdd9f41=_0xdd9f41-0x0;var _0xa6425c=_0xfc8c[_0xdd9f41];return _0xa6425c;};'use strict';var _=require(_0xcfc8('0x0'));var util=require(_0xcfc8('0x1'));var moment=require(_0xcfc8('0x2'));var BPromise=require(_0xcfc8('0x3'));var rs=require(_0xcfc8('0x4'));var fs=require('fs');var Redis=require(_0xcfc8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfc8('0x6'));var logger=require(_0xcfc8('0x7'))(_0xcfc8('0x8'));var config=require(_0xcfc8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfc8('0xa')]({'port':0x232a});config['redis']=_[_0xcfc8('0xb')](config[_0xcfc8('0xc')],{'host':_0xcfc8('0xd'),'port':0x18eb});var socket=require(_0xcfc8('0xe'))(new Redis(config[_0xcfc8('0xc')]));require(_0xcfc8('0xf'))[_0xcfc8('0x10')](socket);function respondWithRpcPromise(_0x17f0e9,_0x3a4156,_0x273d){return new BPromise(function(_0x5c7d50,_0x43c32c){return client[_0xcfc8('0x11')](_0x17f0e9,_0x273d)['then'](function(_0x1d120c){logger[_0xcfc8('0x12')]('CmList,\x20%s,\x20%s',_0x3a4156,_0xcfc8('0x13'));logger[_0xcfc8('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x3a4156,_0xcfc8('0x13'),JSON[_0xcfc8('0x15')](_0x1d120c));if(_0x1d120c[_0xcfc8('0x16')]){if(_0x1d120c[_0xcfc8('0x16')][_0xcfc8('0x17')]===0x1f4){logger[_0xcfc8('0x16')](_0xcfc8('0x18'),_0x3a4156,_0x1d120c['error'][_0xcfc8('0x19')]);return _0x43c32c(_0x1d120c[_0xcfc8('0x16')]['message']);}logger[_0xcfc8('0x16')](_0xcfc8('0x18'),_0x3a4156,_0x1d120c[_0xcfc8('0x16')][_0xcfc8('0x19')]);return _0x5c7d50(_0x1d120c[_0xcfc8('0x16')]['message']);}else{logger['info']('CmList,\x20%s,\x20%s',_0x3a4156,_0xcfc8('0x13'));_0x5c7d50(_0x1d120c[_0xcfc8('0x1a')][_0xcfc8('0x19')]);}})[_0xcfc8('0x1b')](function(_0x3ea9e5){logger[_0xcfc8('0x16')](_0xcfc8('0x18'),_0x3a4156,_0x3ea9e5);_0x43c32c(_0x3ea9e5);});});} \ No newline at end of file +var _0x5064=['then','CmList,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request'];(function(_0x45df01,_0x2ca3eb){var _0x2b93cc=function(_0xc104da){while(--_0xc104da){_0x45df01['push'](_0x45df01['shift']());}};_0x2b93cc(++_0x2ca3eb);}(_0x5064,0xbe));var _0x4506=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5064[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4506('0x0'));var util=require(_0x4506('0x1'));var moment=require(_0x4506('0x2'));var BPromise=require(_0x4506('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4506('0x4'));var db=require(_0x4506('0x5'))['db'];var utils=require(_0x4506('0x6'));var logger=require(_0x4506('0x7'))(_0x4506('0x8'));var config=require(_0x4506('0x9'));var jayson=require(_0x4506('0xa'));var client=jayson[_0x4506('0xb')][_0x4506('0xc')]({'port':0x232a});config[_0x4506('0xd')]=_['defaults'](config[_0x4506('0xd')],{'host':_0x4506('0xe'),'port':0x18eb});var socket=require(_0x4506('0xf'))(new Redis(config[_0x4506('0xd')]));require('./cmList.socket')[_0x4506('0x10')](socket);function respondWithRpcPromise(_0x257c48,_0x46fb5c,_0x16dc43){return new BPromise(function(_0x40ec48,_0x53c293){return client[_0x4506('0x11')](_0x257c48,_0x16dc43)[_0x4506('0x12')](function(_0x1b3fd9){logger['info'](_0x4506('0x13'),_0x46fb5c,'request\x20sent');logger[_0x4506('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x46fb5c,_0x4506('0x15'),JSON['stringify'](_0x1b3fd9));if(_0x1b3fd9[_0x4506('0x16')]){if(_0x1b3fd9['error'][_0x4506('0x17')]===0x1f4){logger[_0x4506('0x16')](_0x4506('0x13'),_0x46fb5c,_0x1b3fd9[_0x4506('0x16')][_0x4506('0x18')]);return _0x53c293(_0x1b3fd9[_0x4506('0x16')][_0x4506('0x18')]);}logger[_0x4506('0x16')](_0x4506('0x13'),_0x46fb5c,_0x1b3fd9['error']['message']);return _0x40ec48(_0x1b3fd9[_0x4506('0x16')]['message']);}else{logger[_0x4506('0x19')]('CmList,\x20%s,\x20%s',_0x46fb5c,_0x4506('0x15'));_0x40ec48(_0x1b3fd9['result'][_0x4506('0x18')]);}})['catch'](function(_0x4c52b3){logger[_0x4506('0x16')](_0x4506('0x13'),_0x46fb5c,_0x4c52b3);_0x53c293(_0x4c52b3);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 44cba41..a2c8643 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 _0x36b2=['save','remove','register','length','cmList:','./cmList.events'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x36b2,0x6b));var _0x236b=function(_0x25baf0,_0x4d945b){_0x25baf0=_0x25baf0-0x0;var _0xe0f91a=_0x36b2[_0x25baf0];return _0xe0f91a;};'use strict';var CmListEvents=require(_0x236b('0x0'));var events=[_0x236b('0x1'),_0x236b('0x2'),'update'];function createListener(_0x17977e,_0x2aa6b5){return function(_0x45d0d4){_0x2aa6b5['emit'](_0x17977e,_0x45d0d4);};}function removeListener(_0x1dc22b,_0x1a135b){return function(){CmListEvents['removeListener'](_0x1dc22b,_0x1a135b);};}exports[_0x236b('0x3')]=function(_0x27c095){for(var _0x37867a=0x0,_0x9e1345=events[_0x236b('0x4')];_0x37867a<_0x9e1345;_0x37867a++){var _0x2ff02e=events[_0x37867a];var _0x52b043=createListener(_0x236b('0x5')+_0x2ff02e,_0x27c095);CmListEvents['on'](_0x2ff02e,_0x52b043);}}; \ No newline at end of file +var _0x0048=['removeListener','length','cmList:','save','remove','emit'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x0048,0x129));var _0x8004=function(_0x46066f,_0x23105c){_0x46066f=_0x46066f-0x0;var _0x411977=_0x0048[_0x46066f];return _0x411977;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x8004('0x0'),_0x8004('0x1'),'update'];function createListener(_0x387444,_0x38c924){return function(_0x5ba96a){_0x38c924[_0x8004('0x2')](_0x387444,_0x5ba96a);};}function removeListener(_0x360fff,_0x14cc27){return function(){CmListEvents[_0x8004('0x3')](_0x360fff,_0x14cc27);};}exports['register']=function(_0x532337){for(var _0x3aaed7=0x0,_0x38871a=events[_0x8004('0x4')];_0x3aaed7<_0x38871a;_0x3aaed7++){var _0x59218a=events[_0x3aaed7];var _0x3c7e57=createListener(_0x8004('0x5')+_0x59218a,_0x532337);CmListEvents['on'](_0x59218a,_0x3c7e57);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 67e9fc8..117eb83 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 _0xaa90=['show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','./cmList.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x404604,_0x1d2a24){var _0x51f897=function(_0x3eee27){while(--_0x3eee27){_0x404604['push'](_0x404604['shift']());}};_0x51f897(++_0x1d2a24);}(_0xaa90,0xce));var _0x0aa9=function(_0x3d68e4,_0x39c820){_0x3d68e4=_0x3d68e4-0x0;var _0x3f4f5d=_0xaa90[_0x3d68e4];return _0x3f4f5d;};'use strict';var multer=require(_0x0aa9('0x0'));var util=require('util');var path=require(_0x0aa9('0x1'));var timeout=require(_0x0aa9('0x2'));var express=require('express');var router=express[_0x0aa9('0x3')]();var auth=require(_0x0aa9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0aa9('0x5'));router[_0x0aa9('0x6')]('/',auth[_0x0aa9('0x7')](),controller[_0x0aa9('0x8')]);router[_0x0aa9('0x6')]('/describe',auth[_0x0aa9('0x7')](),controller[_0x0aa9('0x9')]);router[_0x0aa9('0x6')](_0x0aa9('0xa'),auth['isAuthenticated'](),controller[_0x0aa9('0xb')]);router['get'](_0x0aa9('0xc'),auth[_0x0aa9('0x7')](),controller['getDispositions']);router[_0x0aa9('0x6')](_0x0aa9('0xd'),auth[_0x0aa9('0x7')](),controller[_0x0aa9('0xe')]);router[_0x0aa9('0x6')](_0x0aa9('0xf'),auth[_0x0aa9('0x7')](),controller['getContactsCsv']);router['get'](_0x0aa9('0x10'),auth[_0x0aa9('0x7')](),controller[_0x0aa9('0x11')]);router[_0x0aa9('0x6')](_0x0aa9('0x12'),auth[_0x0aa9('0x7')](),controller[_0x0aa9('0x13')]);router[_0x0aa9('0x14')]('/',auth['isAuthenticated'](),controller[_0x0aa9('0x15')]);router[_0x0aa9('0x14')](_0x0aa9('0xc'),auth['isAuthenticated'](),controller[_0x0aa9('0x16')]);router[_0x0aa9('0x14')](_0x0aa9('0xd'),auth[_0x0aa9('0x7')](),controller[_0x0aa9('0x17')]);router['post']('/:id/fields',auth['isAuthenticated'](),controller[_0x0aa9('0x18')]);router[_0x0aa9('0x14')](_0x0aa9('0x12'),auth[_0x0aa9('0x7')](),controller[_0x0aa9('0x19')]);router['put'](_0x0aa9('0xa'),auth[_0x0aa9('0x7')](),controller[_0x0aa9('0x1a')]);router[_0x0aa9('0x1b')](_0x0aa9('0xa'),auth[_0x0aa9('0x7')](),controller[_0x0aa9('0x1c')]);router[_0x0aa9('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x0aa9('0x1b')](_0x0aa9('0x12'),auth[_0x0aa9('0x7')](),controller[_0x0aa9('0x1d')]);module[_0x0aa9('0x1e')]=router; \ No newline at end of file +var _0xbad4=['/:id/dispositions','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','index','get','/describe','isAuthenticated','describe','/:id','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','getAgents','post'];(function(_0x16bb15,_0x42a6da){var _0x49f8c5=function(_0x1d7957){while(--_0x1d7957){_0x16bb15['push'](_0x16bb15['shift']());}};_0x49f8c5(++_0x42a6da);}(_0xbad4,0x175));var _0x4bad=function(_0x50fff0,_0x588fa8){_0x50fff0=_0x50fff0-0x0;var _0x2d792f=_0xbad4[_0x50fff0];return _0x2d792f;};'use strict';var multer=require(_0x4bad('0x0'));var util=require(_0x4bad('0x1'));var path=require(_0x4bad('0x2'));var timeout=require(_0x4bad('0x3'));var express=require(_0x4bad('0x4'));var router=express[_0x4bad('0x5')]();var auth=require(_0x4bad('0x6'));var interaction=require(_0x4bad('0x7'));var config=require(_0x4bad('0x8'));var controller=require(_0x4bad('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4bad('0xa')]);router[_0x4bad('0xb')](_0x4bad('0xc'),auth[_0x4bad('0xd')](),controller[_0x4bad('0xe')]);router[_0x4bad('0xb')](_0x4bad('0xf'),auth[_0x4bad('0xd')](),controller['show']);router[_0x4bad('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4bad('0x10')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x4bad('0x11')]);router[_0x4bad('0xb')](_0x4bad('0x12'),auth[_0x4bad('0xd')](),controller[_0x4bad('0x13')]);router[_0x4bad('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4bad('0x14')]);router['get']('/:id/users',auth[_0x4bad('0xd')](),controller[_0x4bad('0x15')]);router[_0x4bad('0x16')]('/',auth[_0x4bad('0xd')](),controller['create']);router[_0x4bad('0x16')](_0x4bad('0x17'),auth[_0x4bad('0xd')](),controller[_0x4bad('0x18')]);router[_0x4bad('0x16')]('/:id/contacts',auth[_0x4bad('0xd')](),controller[_0x4bad('0x19')]);router[_0x4bad('0x16')](_0x4bad('0x1a'),auth[_0x4bad('0xd')](),controller[_0x4bad('0x1b')]);router[_0x4bad('0x16')]('/:id/users',auth[_0x4bad('0xd')](),controller[_0x4bad('0x1c')]);router[_0x4bad('0x1d')]('/:id',auth[_0x4bad('0xd')](),controller[_0x4bad('0x1e')]);router['delete'](_0x4bad('0xf'),auth[_0x4bad('0xd')](),controller[_0x4bad('0x1f')]);router[_0x4bad('0x20')](_0x4bad('0x17'),auth['isAuthenticated'](),controller[_0x4bad('0x21')]);router[_0x4bad('0x20')]('/:id/users',auth[_0x4bad('0xd')](),controller[_0x4bad('0x22')]);module[_0x4bad('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 8927029..781a9c9 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 _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x1af9a5,_0x2f954d){var _0x1d1dac=function(_0x5afc27){while(--_0x5afc27){_0x1af9a5['push'](_0x1af9a5['shift']());}};_0x1d1dac(++_0x2f954d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x3582f0,_0x270a70){var _0x444e47=function(_0x10cc4b){while(--_0x10cc4b){_0x3582f0['push'](_0x3582f0['shift']());}};_0x444e47(++_0x270a70);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('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 48e4346..06078e3 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 _0xf3b1=['find','params','catch','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','save','then','destroy','error','stack','name','send','update','body','Condition'];(function(_0x38dcfe,_0x1b9f72){var _0x1964d8=function(_0x7225a2){while(--_0x7225a2){_0x38dcfe['push'](_0x38dcfe['shift']());}};_0x1964d8(++_0x1b9f72);}(_0xf3b1,0x1b1));var _0x1f3b=function(_0x14b201,_0x1f9e39){_0x14b201=_0x14b201-0x0;var _0x84949c=_0xf3b1[_0x14b201];return _0x84949c;};'use strict';var pdf=require(_0x1f3b('0x0'));var emlformat=require(_0x1f3b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1f3b('0x2'));var jsonpatch=require(_0x1f3b('0x3'));var rp=require('request-promise');var moment=require(_0x1f3b('0x4'));var BPromise=require(_0x1f3b('0x5'));var Mustache=require(_0x1f3b('0x6'));var util=require('util');var path=require(_0x1f3b('0x7'));var sox=require(_0x1f3b('0x8'));var csv=require('to-csv');var ejs=require(_0x1f3b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1f3b('0xa'));var crypto=require('crypto');var jsforce=require(_0x1f3b('0xb'));var deskjs=require(_0x1f3b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1f3b('0xd'));var Papa=require('papaparse');var Redis=require(_0x1f3b('0xe'));var authService=require(_0x1f3b('0xf'));var qs=require(_0x1f3b('0x10'));var as=require(_0x1f3b('0x11'));var hardwareService=require(_0x1f3b('0x12'));var logger=require('../../config/logger')(_0x1f3b('0x13'));var utils=require('../../config/utils');var config=require(_0x1f3b('0x14'));var db=require(_0x1f3b('0x15'))['db'];function respondWithStatusCode(_0x4db1cd,_0x1c1058){_0x1c1058=_0x1c1058||0xcc;return function(_0x7aed35){if(_0x7aed35){return _0x4db1cd[_0x1f3b('0x16')](_0x1c1058);}return _0x4db1cd[_0x1f3b('0x17')](_0x1c1058)[_0x1f3b('0x18')]();};}function respondWithResult(_0x52b869,_0x4a25ea){_0x4a25ea=_0x4a25ea||0xc8;return function(_0x38fc33){if(_0x38fc33){return _0x52b869[_0x1f3b('0x17')](_0x4a25ea)[_0x1f3b('0x19')](_0x38fc33);}};}function respondWithFilteredResult(_0x53b530,_0x3b5a4f){return function(_0x5ca321){if(_0x5ca321){var _0x2ea6c3=_0x5ca321[_0x1f3b('0x1a')],_0x1c6e92=_0x3b5a4f['offset'],_0x5b0386=_0x3b5a4f[_0x1f3b('0x1b')]+_0x3b5a4f['limit'],_0x3f28ce;if(_0x5b0386>=_0x2ea6c3){_0x5b0386=_0x2ea6c3;_0x3f28ce=0xc8;}else{_0x3f28ce=0xce;}_0x53b530[_0x1f3b('0x17')](_0x3f28ce);return _0x53b530[_0x1f3b('0x1c')]('Content-Range',_0x1c6e92+'-'+_0x5b0386+'/'+_0x2ea6c3)[_0x1f3b('0x19')](_0x5ca321);}return null;};}function patchUpdates(_0x55feb5){return function(_0x1ac28c){try{jsonpatch[_0x1f3b('0x1d')](_0x1ac28c,_0x55feb5,!![]);}catch(_0x2a27df){return BPromise['reject'](_0x2a27df);}return _0x1ac28c[_0x1f3b('0x1e')]();};}function saveUpdates(_0x54df4f,_0x5bf4e0){return function(_0x1314a){if(_0x1314a){return _0x1314a['update'](_0x54df4f)[_0x1f3b('0x1f')](function(_0x5bd8e8){return _0x5bd8e8;});}return null;};}function removeEntity(_0x2fc74d,_0x29dc9e){return function(_0x53a657){if(_0x53a657){return _0x53a657[_0x1f3b('0x20')]()[_0x1f3b('0x1f')](function(){_0x2fc74d[_0x1f3b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x585384,_0x280063){return function(_0x469f21){if(!_0x469f21){_0x585384[_0x1f3b('0x16')](0x194);}return _0x469f21;};}function handleError(_0x4ef439,_0x26aefa){_0x26aefa=_0x26aefa||0x1f4;return function(_0x4abf8c){logger[_0x1f3b('0x21')](_0x4abf8c[_0x1f3b('0x22')]);if(_0x4abf8c[_0x1f3b('0x23')]){delete _0x4abf8c[_0x1f3b('0x23')];}_0x4ef439['status'](_0x26aefa)[_0x1f3b('0x24')](_0x4abf8c);};}exports[_0x1f3b('0x25')]=function(_0x4b398b,_0x5f5b46){if(_0x4b398b[_0x1f3b('0x26')]['id']){delete _0x4b398b[_0x1f3b('0x26')]['id'];}return db[_0x1f3b('0x27')][_0x1f3b('0x28')]({'where':{'id':_0x4b398b[_0x1f3b('0x29')]['id']}})[_0x1f3b('0x1f')](handleEntityNotFound(_0x5f5b46,null))[_0x1f3b('0x1f')](saveUpdates(_0x4b398b[_0x1f3b('0x26')],null))[_0x1f3b('0x1f')](respondWithResult(_0x5f5b46,null))[_0x1f3b('0x2a')](handleError(_0x5f5b46,null));};exports['destroy']=function(_0x27e83e,_0x52bed3){return db['Condition'][_0x1f3b('0x28')]({'where':{'id':_0x27e83e[_0x1f3b('0x29')]['id']}})[_0x1f3b('0x1f')](handleEntityNotFound(_0x52bed3,null))['then'](removeEntity(_0x52bed3,null))[_0x1f3b('0x2a')](handleError(_0x52bed3,null));}; \ No newline at end of file +var _0x9f7c=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','Condition','find','params','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x45b4f9,_0x176dd9){var _0x54024c=function(_0x4d2918){while(--_0x4d2918){_0x45b4f9['push'](_0x45b4f9['shift']());}};_0x54024c(++_0x176dd9);}(_0x9f7c,0x113));var _0xc9f7=function(_0x2ba4c6,_0x71a3d3){_0x2ba4c6=_0x2ba4c6-0x0;var _0x156fd2=_0x9f7c[_0x2ba4c6];return _0x156fd2;};'use strict';var pdf=require(_0xc9f7('0x0'));var emlformat=require(_0xc9f7('0x1'));var rimraf=require(_0xc9f7('0x2'));var zipdir=require(_0xc9f7('0x3'));var jsonpatch=require(_0xc9f7('0x4'));var rp=require(_0xc9f7('0x5'));var moment=require(_0xc9f7('0x6'));var BPromise=require(_0xc9f7('0x7'));var Mustache=require(_0xc9f7('0x8'));var util=require(_0xc9f7('0x9'));var path=require(_0xc9f7('0xa'));var sox=require(_0xc9f7('0xb'));var csv=require(_0xc9f7('0xc'));var ejs=require(_0xc9f7('0xd'));var fs=require('fs');var _=require(_0xc9f7('0xe'));var squel=require(_0xc9f7('0xf'));var crypto=require(_0xc9f7('0x10'));var jsforce=require(_0xc9f7('0x11'));var deskjs=require(_0xc9f7('0x12'));var toCsv=require(_0xc9f7('0xc'));var querystring=require(_0xc9f7('0x13'));var Papa=require('papaparse');var Redis=require(_0xc9f7('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc9f7('0x15'));var as=require(_0xc9f7('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc9f7('0x17'));var utils=require(_0xc9f7('0x18'));var config=require('../../config/environment');var db=require(_0xc9f7('0x19'))['db'];function respondWithStatusCode(_0xdd7255,_0x322ce9){_0x322ce9=_0x322ce9||0xcc;return function(_0x3a6447){if(_0x3a6447){return _0xdd7255[_0xc9f7('0x1a')](_0x322ce9);}return _0xdd7255['status'](_0x322ce9)[_0xc9f7('0x1b')]();};}function respondWithResult(_0x31cec5,_0x5282af){_0x5282af=_0x5282af||0xc8;return function(_0x17e09e){if(_0x17e09e){return _0x31cec5[_0xc9f7('0x1c')](_0x5282af)[_0xc9f7('0x1d')](_0x17e09e);}};}function respondWithFilteredResult(_0x238cc2,_0x5e7ddd){return function(_0xb88ecb){if(_0xb88ecb){var _0x2a67a1=_0xb88ecb['count'],_0xaabd16=_0x5e7ddd[_0xc9f7('0x1e')],_0x11f5a3=_0x5e7ddd[_0xc9f7('0x1e')]+_0x5e7ddd['limit'],_0x5e5a7b;if(_0x11f5a3>=_0x2a67a1){_0x11f5a3=_0x2a67a1;_0x5e5a7b=0xc8;}else{_0x5e5a7b=0xce;}_0x238cc2[_0xc9f7('0x1c')](_0x5e5a7b);return _0x238cc2[_0xc9f7('0x1f')](_0xc9f7('0x20'),_0xaabd16+'-'+_0x11f5a3+'/'+_0x2a67a1)['json'](_0xb88ecb);}return null;};}function patchUpdates(_0xab634d){return function(_0x29b1c1){try{jsonpatch[_0xc9f7('0x21')](_0x29b1c1,_0xab634d,!![]);}catch(_0x3986f0){return BPromise[_0xc9f7('0x22')](_0x3986f0);}return _0x29b1c1[_0xc9f7('0x23')]();};}function saveUpdates(_0x3ba5c2,_0x1d53c9){return function(_0x99cdb4){if(_0x99cdb4){return _0x99cdb4[_0xc9f7('0x24')](_0x3ba5c2)['then'](function(_0xb0cd76){return _0xb0cd76;});}return null;};}function removeEntity(_0x5b7b9d,_0x5aaa22){return function(_0x2368e9){if(_0x2368e9){return _0x2368e9[_0xc9f7('0x25')]()[_0xc9f7('0x26')](function(){_0x5b7b9d[_0xc9f7('0x1c')](0xcc)[_0xc9f7('0x1b')]();});}};}function handleEntityNotFound(_0x475946,_0x50c7e7){return function(_0x3d5358){if(!_0x3d5358){_0x475946[_0xc9f7('0x1a')](0x194);}return _0x3d5358;};}function handleError(_0xfed49,_0x557709){_0x557709=_0x557709||0x1f4;return function(_0x5cac17){logger[_0xc9f7('0x27')](_0x5cac17[_0xc9f7('0x28')]);if(_0x5cac17[_0xc9f7('0x29')]){delete _0x5cac17['name'];}_0xfed49[_0xc9f7('0x1c')](_0x557709)['send'](_0x5cac17);};}exports[_0xc9f7('0x24')]=function(_0x561f22,_0x280b10){if(_0x561f22['body']['id']){delete _0x561f22['body']['id'];}return db[_0xc9f7('0x2a')][_0xc9f7('0x2b')]({'where':{'id':_0x561f22[_0xc9f7('0x2c')]['id']}})[_0xc9f7('0x26')](handleEntityNotFound(_0x280b10,null))[_0xc9f7('0x26')](saveUpdates(_0x561f22[_0xc9f7('0x2d')],null))[_0xc9f7('0x26')](respondWithResult(_0x280b10,null))[_0xc9f7('0x2e')](handleError(_0x280b10,null));};exports[_0xc9f7('0x25')]=function(_0x5c6aad,_0xb15c7f){return db['Condition'][_0xc9f7('0x2b')]({'where':{'id':_0x5c6aad[_0xc9f7('0x2c')]['id']}})[_0xc9f7('0x26')](handleEntityNotFound(_0xb15c7f,null))['then'](removeEntity(_0xb15c7f,null))[_0xc9f7('0x2e')](handleError(_0xb15c7f,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 2882dcb..972db82 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 _0x7c74=['request-promise','path','rimraf','../../config/environment','exports','Condition','tools_conditions','util','moment','bluebird'];(function(_0x4e346a,_0x1ba060){var _0x12ac3a=function(_0xbf09f5){while(--_0xbf09f5){_0x4e346a['push'](_0x4e346a['shift']());}};_0x12ac3a(++_0x1ba060);}(_0x7c74,0x165));var _0x47c7=function(_0x54f322,_0x24a660){_0x54f322=_0x54f322-0x0;var _0xb0a1d5=_0x7c74[_0x54f322];return _0xb0a1d5;};'use strict';var _=require('lodash');var util=require(_0x47c7('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x47c7('0x1'));var BPromise=require(_0x47c7('0x2'));var rp=require(_0x47c7('0x3'));var fs=require('fs');var path=require(_0x47c7('0x4'));var rimraf=require(_0x47c7('0x5'));var config=require(_0x47c7('0x6'));var attributes=require('./condition.attributes');module[_0x47c7('0x7')]=function(_0x145dd3,_0x25365b){return _0x145dd3['define'](_0x47c7('0x8'),attributes,{'tableName':_0x47c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe796=['api','request-promise','path','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash','../../config/logger'];(function(_0x308ab5,_0x1985e7){var _0x118574=function(_0x428075){while(--_0x428075){_0x308ab5['push'](_0x308ab5['shift']());}};_0x118574(++_0x1985e7);}(_0xe796,0x77));var _0x6e79=function(_0x354380,_0x4b957f){_0x354380=_0x354380-0x0;var _0x4fa485=_0xe796[_0x354380];return _0x4fa485;};'use strict';var _=require(_0x6e79('0x0'));var util=require('util');var logger=require(_0x6e79('0x1'))(_0x6e79('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6e79('0x3'));var fs=require('fs');var path=require(_0x6e79('0x4'));var rimraf=require(_0x6e79('0x5'));var config=require('../../config/environment');var attributes=require(_0x6e79('0x6'));module[_0x6e79('0x7')]=function(_0xb5ed7c,_0x55a8ab){return _0xb5ed7c[_0x6e79('0x8')](_0x6e79('0x9'),attributes,{'tableName':_0x6e79('0xa'),'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 67dc3d2..57d275e 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 _0x9fe3=['stringify','error','Condition,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9fe3,0x12b));var _0x39fe=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x9fe3[_0x413727];return _0x5f46d7;};'use strict';var _=require(_0x39fe('0x0'));var util=require('util');var moment=require(_0x39fe('0x1'));var BPromise=require(_0x39fe('0x2'));var rs=require(_0x39fe('0x3'));var fs=require('fs');var Redis=require(_0x39fe('0x4'));var db=require(_0x39fe('0x5'))['db'];var utils=require(_0x39fe('0x6'));var logger=require(_0x39fe('0x7'))(_0x39fe('0x8'));var config=require(_0x39fe('0x9'));var jayson=require(_0x39fe('0xa'));var client=jayson[_0x39fe('0xb')][_0x39fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x427ce9,_0x4adc8b,_0x298335){return new BPromise(function(_0x517a32,_0xb9745a){return client[_0x39fe('0xd')](_0x427ce9,_0x298335)['then'](function(_0x4f2685){logger['info']('Condition,\x20%s,\x20%s',_0x4adc8b,_0x39fe('0xe'));logger['debug'](_0x39fe('0xf'),_0x4adc8b,_0x39fe('0xe'),JSON[_0x39fe('0x10')](_0x4f2685));if(_0x4f2685['error']){if(_0x4f2685['error']['code']===0x1f4){logger[_0x39fe('0x11')](_0x39fe('0x12'),_0x4adc8b,_0x4f2685[_0x39fe('0x11')][_0x39fe('0x13')]);return _0xb9745a(_0x4f2685[_0x39fe('0x11')][_0x39fe('0x13')]);}logger[_0x39fe('0x11')](_0x39fe('0x12'),_0x4adc8b,_0x4f2685['error'][_0x39fe('0x13')]);return _0x517a32(_0x4f2685['error']['message']);}else{logger['info']('Condition,\x20%s,\x20%s',_0x4adc8b,_0x39fe('0xe'));_0x517a32(_0x4f2685[_0x39fe('0x14')]['message']);}})['catch'](function(_0xf9888a){logger[_0x39fe('0x11')]('Condition,\x20%s,\x20%s',_0x4adc8b,_0xf9888a);_0xb9745a(_0xf9888a);});});} \ No newline at end of file +var _0x484a=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x484a,0x108));var _0xa484=function(_0x13c8a7,_0x1a6946){_0x13c8a7=_0x13c8a7-0x0;var _0x5e2e39=_0x484a[_0x13c8a7];return _0x5e2e39;};'use strict';var _=require(_0xa484('0x0'));var util=require(_0xa484('0x1'));var moment=require(_0xa484('0x2'));var BPromise=require('bluebird');var rs=require(_0xa484('0x3'));var fs=require('fs');var Redis=require(_0xa484('0x4'));var db=require(_0xa484('0x5'))['db'];var utils=require(_0xa484('0x6'));var logger=require(_0xa484('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa484('0x8'));var client=jayson[_0xa484('0x9')][_0xa484('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x459545,_0x4b7399,_0x166787){return new BPromise(function(_0x47e550,_0x19ea37){return client[_0xa484('0xb')](_0x459545,_0x166787)[_0xa484('0xc')](function(_0x4f41b8){logger[_0xa484('0xd')](_0xa484('0xe'),_0x4b7399,_0xa484('0xf'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x4b7399,_0xa484('0xf'),JSON[_0xa484('0x10')](_0x4f41b8));if(_0x4f41b8[_0xa484('0x11')]){if(_0x4f41b8['error'][_0xa484('0x12')]===0x1f4){logger[_0xa484('0x11')](_0xa484('0xe'),_0x4b7399,_0x4f41b8[_0xa484('0x11')][_0xa484('0x13')]);return _0x19ea37(_0x4f41b8[_0xa484('0x11')][_0xa484('0x13')]);}logger['error']('Condition,\x20%s,\x20%s',_0x4b7399,_0x4f41b8[_0xa484('0x11')][_0xa484('0x13')]);return _0x47e550(_0x4f41b8[_0xa484('0x11')][_0xa484('0x13')]);}else{logger[_0xa484('0xd')](_0xa484('0xe'),_0x4b7399,'request\x20sent');_0x47e550(_0x4f41b8[_0xa484('0x14')][_0xa484('0x13')]);}})[_0xa484('0x15')](function(_0x61b222){logger['error'](_0xa484('0xe'),_0x4b7399,_0x61b222);_0x19ea37(_0x61b222);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 5fc6300..85c016f 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 _0x3fe3=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x3fe71b,_0x291d3f){var _0x546ccf=function(_0x116255){while(--_0x116255){_0x3fe71b['push'](_0x3fe71b['shift']());}};_0x546ccf(++_0x291d3f);}(_0x3fe3,0x1f0));var _0x33fe=function(_0x34c3bb,_0x3e7d16){_0x34c3bb=_0x34c3bb-0x0;var _0x1fbac4=_0x3fe3[_0x34c3bb];return _0x1fbac4;};'use strict';var multer=require(_0x33fe('0x0'));var util=require('util');var path=require(_0x33fe('0x1'));var timeout=require(_0x33fe('0x2'));var express=require(_0x33fe('0x3'));var router=express[_0x33fe('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x33fe('0x5'));var config=require(_0x33fe('0x6'));var controller=require(_0x33fe('0x7'));router[_0x33fe('0x8')](_0x33fe('0x9'),auth['isAuthenticated'](),controller[_0x33fe('0xa')]);router[_0x33fe('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x33fe('0xc')]);module[_0x33fe('0xd')]=router; \ No newline at end of file +var _0xd7f3=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','delete','isAuthenticated','destroy'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xd7f3,0xe1));var _0x3d7f=function(_0x32af46,_0xb38e36){_0x32af46=_0x32af46-0x0;var _0x5a5520=_0xd7f3[_0x32af46];return _0x5a5520;};'use strict';var multer=require(_0x3d7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3d7f('0x1'));var express=require(_0x3d7f('0x2'));var router=express[_0x3d7f('0x3')]();var auth=require(_0x3d7f('0x4'));var interaction=require(_0x3d7f('0x5'));var config=require(_0x3d7f('0x6'));var controller=require(_0x3d7f('0x7'));router[_0x3d7f('0x8')](_0x3d7f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3d7f('0xa')](_0x3d7f('0x9'),auth[_0x3d7f('0xb')](),controller[_0x3d7f('0xc')]);module[_0x3d7f('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 2617d97..f577fcb 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 _0x9957=['exports','STRING','name','sequelize'];(function(_0x3aaae4,_0x5f3e6b){var _0x903d58=function(_0x9d8f8b){while(--_0x9d8f8b){_0x3aaae4['push'](_0x3aaae4['shift']());}};_0x903d58(++_0x5f3e6b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![],'unique':_0x7995('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7995('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x6fc4=['exports','INTEGER','sequelize'];(function(_0x52a376,_0x4e5d7b){var _0x3529c0=function(_0x192c6f){while(--_0x192c6f){_0x52a376['push'](_0x52a376['shift']());}};_0x3529c0(++_0x4e5d7b);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x459879,_0x16b25d){_0x459879=_0x459879-0x0;var _0xa84228=_0x6fc4[_0x459879];return _0xa84228;};'use strict';var Sequelize=require(_0x46fc('0x0'));module[_0x46fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x46fc('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index d6d2d5f..6256091 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 _0x00bb=['limit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','ContactItemTypes','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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','get','UserProfileResource','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1bbf32,_0x3b785a){var _0x1a58ae=function(_0x597a3d){while(--_0x597a3d){_0x1bbf32['push'](_0x1bbf32['shift']());}};_0x1a58ae(++_0x3b785a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x00bb[_0x550d12];return _0x12103d;};'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(){var _0x51b841=_0x4df284[_0xb00b('0x1f')]({'plain':!![]});var _0x2896d1='ContactItemTypes';return db[_0xb00b('0x20')][_0xb00b('0x1e')]({'where':{'type':_0x2896d1,'resourceId':_0x51b841['id']}})['then'](function(){return _0x4df284;});})[_0xb00b('0x1d')](function(){_0x56c189[_0xb00b('0x15')](0xcc)[_0xb00b('0x16')]();});}};}function handleEntityNotFound(_0x8caadf,_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x8caadf[_0xb00b('0x14')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x21')](_0x4a635e[_0xb00b('0x22')]);if(_0x4a635e[_0xb00b('0x23')]){delete _0x4a635e[_0xb00b('0x23')];}_0x490380[_0xb00b('0x15')](_0x550587)[_0xb00b('0x24')](_0x4a635e);};}exports[_0xb00b('0x25')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={},_0x450129={},_0x348165={'count':0x0,'rows':[]};var _0x5424ca=_['map'](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x16fbd5){return{'name':_0x16fbd5[_0xb00b('0x28')],'type':_0x16fbd5[_0xb00b('0x29')][_0xb00b('0x2a')]};});_0x450129[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x5424ca,_0xb00b('0x23'));_0x450129['query']=_[_0xb00b('0x2d')](_0x4a8d2b[_0xb00b('0x2e')]);_0x450129['filters']=_[_0xb00b('0x2f')](_0x450129[_0xb00b('0x2b')],_0x450129['query']);_0x503c9c[_0xb00b('0x30')]=_['intersection'](_0x450129[_0xb00b('0x2b')],qs[_0xb00b('0x31')](_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x31')]));_0x503c9c[_0xb00b('0x30')]=_0x503c9c[_0xb00b('0x30')][_0xb00b('0x32')]?_0x503c9c['attributes']:_0x450129['model'];if(!_0x4a8d2b['query'][_0xb00b('0x33')](_0xb00b('0x34'))){_0x503c9c[_0xb00b('0x35')]=qs[_0xb00b('0x35')](_0x4a8d2b['query'][_0xb00b('0x35')]);_0x503c9c[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x19')]);}_0x503c9c[_0xb00b('0x36')]=qs[_0xb00b('0x37')](_0x4a8d2b[_0xb00b('0x2e')]['sort']);_0x503c9c['where']=qs[_0xb00b('0x38')](_['pick'](_0x4a8d2b[_0xb00b('0x2e')],_0x450129[_0xb00b('0x38')]),_0x5424ca);if(_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x39')]){_0x503c9c[_0xb00b('0x3a')]=_[_0xb00b('0x3b')](_0x503c9c[_0xb00b('0x3a')],{'$or':_['map'](_0x5424ca,function(_0x35f1ca){if(_0x35f1ca[_0xb00b('0x29')]!==_0xb00b('0x3c')){var _0xd9c03f={};_0xd9c03f[_0x35f1ca[_0xb00b('0x23')]]={'$like':'%'+_0x4a8d2b[_0xb00b('0x2e')]['filter']+'%'};return _0xd9c03f;}})});}_0x503c9c=_[_0xb00b('0x3b')]({},_0x503c9c,_0x4a8d2b[_0xb00b('0x3d')]);var _0x4801e7={'where':_0x503c9c[_0xb00b('0x3a')]};return db[_0xb00b('0x26')][_0xb00b('0x18')](_0x4801e7)[_0xb00b('0x1d')](function(_0x2954e8){_0x348165['count']=_0x2954e8;if(_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x3e')]){_0x503c9c[_0xb00b('0x3f')]=[{'all':!![]}];}return db[_0xb00b('0x26')]['findAll'](_0x503c9c);})['then'](function(_0x43f834){_0x348165[_0xb00b('0x40')]=_0x43f834;return _0x348165;})[_0xb00b('0x1d')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x41')](handleError(_0x22c22d,null));};exports[_0xb00b('0x42')]=function(_0x26f17b,_0x275664){var _0x493841={'raw':!![],'where':{'id':_0x26f17b[_0xb00b('0x43')]['id']}},_0x36200d={};_0x36200d[_0xb00b('0x2b')]=_[_0xb00b('0x2d')](db[_0xb00b('0x26')][_0xb00b('0x27')]);_0x36200d[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x26f17b[_0xb00b('0x2e')]);_0x36200d[_0xb00b('0x38')]=_[_0xb00b('0x2f')](_0x36200d[_0xb00b('0x2b')],_0x36200d['query']);_0x493841[_0xb00b('0x30')]=_[_0xb00b('0x2f')](_0x36200d[_0xb00b('0x2b')],qs[_0xb00b('0x31')](_0x26f17b[_0xb00b('0x2e')][_0xb00b('0x31')]));_0x493841[_0xb00b('0x30')]=_0x493841[_0xb00b('0x30')][_0xb00b('0x32')]?_0x493841[_0xb00b('0x30')]:_0x36200d[_0xb00b('0x2b')];if(_0x26f17b[_0xb00b('0x2e')]['includeAll']){_0x493841['include']=[{'all':!![]}];}_0x493841=_['merge']({},_0x493841,_0x26f17b[_0xb00b('0x3d')]);return db[_0xb00b('0x26')]['find'](_0x493841)[_0xb00b('0x1d')](handleEntityNotFound(_0x275664,null))[_0xb00b('0x1d')](respondWithResult(_0x275664,null))[_0xb00b('0x41')](handleError(_0x275664,null));};exports[_0xb00b('0x44')]=function(_0x4b62b3,_0x58e9cb){return db[_0xb00b('0x26')][_0xb00b('0x44')](_0x4b62b3['body'],{})['then'](function(_0x154759){var _0x3a205d=_0x4b62b3['user'][_0xb00b('0x1f')]({'plain':!![]});if(!_0x3a205d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a205d['role']==='user'){var _0x465d90=_0x154759['get']({'plain':!![]});var _0x1f7b86=_0xb00b('0x45');return db[_0xb00b('0x46')][_0xb00b('0x47')]({'where':{'name':_0x1f7b86,'userProfileId':_0x3a205d[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x1d')](function(_0x4846c9){if(_0x4846c9&&_0x4846c9['autoAssociation']===0x0){return db[_0xb00b('0x20')][_0xb00b('0x44')]({'name':_0x465d90['name'],'resourceId':_0x465d90['id'],'type':_0x4846c9[_0xb00b('0x23')],'sectionId':_0x4846c9['id']},{})[_0xb00b('0x1d')](function(){return _0x154759;});}else{return _0x154759;}})['catch'](function(_0x15dcbf){logger[_0xb00b('0x21')](_0xb00b('0x49'),_0x15dcbf);throw _0x15dcbf;});}return _0x154759;})['then'](respondWithResult(_0x58e9cb,0xc9))['catch'](handleError(_0x58e9cb,null));};exports[_0xb00b('0x1c')]=function(_0x398deb,_0x12737d){if(_0x398deb[_0xb00b('0x4a')]['id']){delete _0x398deb['body']['id'];}return db[_0xb00b('0x26')][_0xb00b('0x47')]({'where':{'id':_0x398deb['params']['id']}})['then'](handleEntityNotFound(_0x12737d,null))[_0xb00b('0x1d')](saveUpdates(_0x398deb['body'],null))[_0xb00b('0x1d')](respondWithResult(_0x12737d,null))[_0xb00b('0x41')](handleError(_0x12737d,null));};exports[_0xb00b('0x1e')]=function(_0x222459,_0x450ce7){return db[_0xb00b('0x26')]['find']({'where':{'id':_0x222459[_0xb00b('0x43')]['id']}})['then'](handleEntityNotFound(_0x450ce7,null))[_0xb00b('0x1d')](removeEntity(_0x450ce7,null))[_0xb00b('0x41')](handleError(_0x450ce7,null));}; \ No newline at end of file +var _0x00bb=['limit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','ContactItemTypes','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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','get','UserProfileResource','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5442d1,_0x193d0e){var _0x2f0eaf=function(_0x51a79){while(--_0x51a79){_0x5442d1['push'](_0x5442d1['shift']());}};_0x2f0eaf(++_0x193d0e);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var 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(){var _0x51b841=_0x4df284[_0xb00b('0x1f')]({'plain':!![]});var _0x2896d1='ContactItemTypes';return db[_0xb00b('0x20')][_0xb00b('0x1e')]({'where':{'type':_0x2896d1,'resourceId':_0x51b841['id']}})['then'](function(){return _0x4df284;});})[_0xb00b('0x1d')](function(){_0x56c189[_0xb00b('0x15')](0xcc)[_0xb00b('0x16')]();});}};}function handleEntityNotFound(_0x8caadf,_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x8caadf[_0xb00b('0x14')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x21')](_0x4a635e[_0xb00b('0x22')]);if(_0x4a635e[_0xb00b('0x23')]){delete _0x4a635e[_0xb00b('0x23')];}_0x490380[_0xb00b('0x15')](_0x550587)[_0xb00b('0x24')](_0x4a635e);};}exports[_0xb00b('0x25')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={},_0x450129={},_0x348165={'count':0x0,'rows':[]};var _0x5424ca=_['map'](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x16fbd5){return{'name':_0x16fbd5[_0xb00b('0x28')],'type':_0x16fbd5[_0xb00b('0x29')][_0xb00b('0x2a')]};});_0x450129[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x5424ca,_0xb00b('0x23'));_0x450129['query']=_[_0xb00b('0x2d')](_0x4a8d2b[_0xb00b('0x2e')]);_0x450129['filters']=_[_0xb00b('0x2f')](_0x450129[_0xb00b('0x2b')],_0x450129['query']);_0x503c9c[_0xb00b('0x30')]=_['intersection'](_0x450129[_0xb00b('0x2b')],qs[_0xb00b('0x31')](_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x31')]));_0x503c9c[_0xb00b('0x30')]=_0x503c9c[_0xb00b('0x30')][_0xb00b('0x32')]?_0x503c9c['attributes']:_0x450129['model'];if(!_0x4a8d2b['query'][_0xb00b('0x33')](_0xb00b('0x34'))){_0x503c9c[_0xb00b('0x35')]=qs[_0xb00b('0x35')](_0x4a8d2b['query'][_0xb00b('0x35')]);_0x503c9c[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x19')]);}_0x503c9c[_0xb00b('0x36')]=qs[_0xb00b('0x37')](_0x4a8d2b[_0xb00b('0x2e')]['sort']);_0x503c9c['where']=qs[_0xb00b('0x38')](_['pick'](_0x4a8d2b[_0xb00b('0x2e')],_0x450129[_0xb00b('0x38')]),_0x5424ca);if(_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x39')]){_0x503c9c[_0xb00b('0x3a')]=_[_0xb00b('0x3b')](_0x503c9c[_0xb00b('0x3a')],{'$or':_['map'](_0x5424ca,function(_0x35f1ca){if(_0x35f1ca[_0xb00b('0x29')]!==_0xb00b('0x3c')){var _0xd9c03f={};_0xd9c03f[_0x35f1ca[_0xb00b('0x23')]]={'$like':'%'+_0x4a8d2b[_0xb00b('0x2e')]['filter']+'%'};return _0xd9c03f;}})});}_0x503c9c=_[_0xb00b('0x3b')]({},_0x503c9c,_0x4a8d2b[_0xb00b('0x3d')]);var _0x4801e7={'where':_0x503c9c[_0xb00b('0x3a')]};return db[_0xb00b('0x26')][_0xb00b('0x18')](_0x4801e7)[_0xb00b('0x1d')](function(_0x2954e8){_0x348165['count']=_0x2954e8;if(_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x3e')]){_0x503c9c[_0xb00b('0x3f')]=[{'all':!![]}];}return db[_0xb00b('0x26')]['findAll'](_0x503c9c);})['then'](function(_0x43f834){_0x348165[_0xb00b('0x40')]=_0x43f834;return _0x348165;})[_0xb00b('0x1d')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x41')](handleError(_0x22c22d,null));};exports[_0xb00b('0x42')]=function(_0x26f17b,_0x275664){var _0x493841={'raw':!![],'where':{'id':_0x26f17b[_0xb00b('0x43')]['id']}},_0x36200d={};_0x36200d[_0xb00b('0x2b')]=_[_0xb00b('0x2d')](db[_0xb00b('0x26')][_0xb00b('0x27')]);_0x36200d[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x26f17b[_0xb00b('0x2e')]);_0x36200d[_0xb00b('0x38')]=_[_0xb00b('0x2f')](_0x36200d[_0xb00b('0x2b')],_0x36200d['query']);_0x493841[_0xb00b('0x30')]=_[_0xb00b('0x2f')](_0x36200d[_0xb00b('0x2b')],qs[_0xb00b('0x31')](_0x26f17b[_0xb00b('0x2e')][_0xb00b('0x31')]));_0x493841[_0xb00b('0x30')]=_0x493841[_0xb00b('0x30')][_0xb00b('0x32')]?_0x493841[_0xb00b('0x30')]:_0x36200d[_0xb00b('0x2b')];if(_0x26f17b[_0xb00b('0x2e')]['includeAll']){_0x493841['include']=[{'all':!![]}];}_0x493841=_['merge']({},_0x493841,_0x26f17b[_0xb00b('0x3d')]);return db[_0xb00b('0x26')]['find'](_0x493841)[_0xb00b('0x1d')](handleEntityNotFound(_0x275664,null))[_0xb00b('0x1d')](respondWithResult(_0x275664,null))[_0xb00b('0x41')](handleError(_0x275664,null));};exports[_0xb00b('0x44')]=function(_0x4b62b3,_0x58e9cb){return db[_0xb00b('0x26')][_0xb00b('0x44')](_0x4b62b3['body'],{})['then'](function(_0x154759){var _0x3a205d=_0x4b62b3['user'][_0xb00b('0x1f')]({'plain':!![]});if(!_0x3a205d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a205d['role']==='user'){var _0x465d90=_0x154759['get']({'plain':!![]});var _0x1f7b86=_0xb00b('0x45');return db[_0xb00b('0x46')][_0xb00b('0x47')]({'where':{'name':_0x1f7b86,'userProfileId':_0x3a205d[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x1d')](function(_0x4846c9){if(_0x4846c9&&_0x4846c9['autoAssociation']===0x0){return db[_0xb00b('0x20')][_0xb00b('0x44')]({'name':_0x465d90['name'],'resourceId':_0x465d90['id'],'type':_0x4846c9[_0xb00b('0x23')],'sectionId':_0x4846c9['id']},{})[_0xb00b('0x1d')](function(){return _0x154759;});}else{return _0x154759;}})['catch'](function(_0x15dcbf){logger[_0xb00b('0x21')](_0xb00b('0x49'),_0x15dcbf);throw _0x15dcbf;});}return _0x154759;})['then'](respondWithResult(_0x58e9cb,0xc9))['catch'](handleError(_0x58e9cb,null));};exports[_0xb00b('0x1c')]=function(_0x398deb,_0x12737d){if(_0x398deb[_0xb00b('0x4a')]['id']){delete _0x398deb['body']['id'];}return db[_0xb00b('0x26')][_0xb00b('0x47')]({'where':{'id':_0x398deb['params']['id']}})['then'](handleEntityNotFound(_0x12737d,null))[_0xb00b('0x1d')](saveUpdates(_0x398deb['body'],null))[_0xb00b('0x1d')](respondWithResult(_0x12737d,null))[_0xb00b('0x41')](handleError(_0x12737d,null));};exports[_0xb00b('0x1e')]=function(_0x222459,_0x450ce7){return db[_0xb00b('0x26')]['find']({'where':{'id':_0x222459[_0xb00b('0x43')]['id']}})['then'](handleEntityNotFound(_0x450ce7,null))[_0xb00b('0x1d')](removeEntity(_0x450ce7,null))[_0xb00b('0x41')](handleError(_0x450ce7,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 9099d65..fee6a4a 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 _0x9206=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','ContactItemType','tools_contact_item_types'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9206,0x176));var _0x6920=function(_0x2a396b,_0x2918d7){_0x2a396b=_0x2a396b-0x0;var _0x2c0250=_0x9206[_0x2a396b];return _0x2c0250;};'use strict';var _=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var logger=require(_0x6920('0x2'))(_0x6920('0x3'));var moment=require(_0x6920('0x4'));var BPromise=require(_0x6920('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6920('0x6'));var config=require(_0x6920('0x7'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x41c8c4,_0x4d67d7){return _0x41c8c4[_0x6920('0x8')](_0x6920('0x9'),attributes,{'tableName':_0x6920('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8838=['./contactItemType.attributes','exports','define','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x129e3f,_0x5d44cd){var _0x268ffc=function(_0x288a2a){while(--_0x288a2a){_0x129e3f['push'](_0x129e3f['shift']());}};_0x268ffc(++_0x5d44cd);}(_0x8838,0x90));var _0x8883=function(_0x44d5d5,_0x11fc03){_0x44d5d5=_0x44d5d5-0x0;var _0x4af8bd=_0x8838[_0x44d5d5];return _0x4af8bd;};'use strict';var _=require(_0x8883('0x0'));var util=require(_0x8883('0x1'));var logger=require(_0x8883('0x2'))(_0x8883('0x3'));var moment=require(_0x8883('0x4'));var BPromise=require(_0x8883('0x5'));var rp=require(_0x8883('0x6'));var fs=require('fs');var path=require(_0x8883('0x7'));var rimraf=require(_0x8883('0x8'));var config=require(_0x8883('0x9'));var attributes=require(_0x8883('0xa'));module[_0x8883('0xb')]=function(_0x5c894f,_0x5061d6){return _0x5c894f[_0x8883('0xc')]('ContactItemType',attributes,{'tableName':_0x8883('0xd'),'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 4322809..d395cd8 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 _0x0bb5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x483a78,_0x33de1f){var _0x263d88=function(_0xa8b8ec){while(--_0xa8b8ec){_0x483a78['push'](_0x483a78['shift']());}};_0x263d88(++_0x33de1f);}(_0x0bb5,0x148));var _0x50bb=function(_0x2f17c4,_0x31ddd6){_0x2f17c4=_0x2f17c4-0x0;var _0xdfca7c=_0x0bb5[_0x2f17c4];return _0xdfca7c;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});} \ No newline at end of file +var _0x35aa=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','ContactItemType,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x13ece1,_0x430821){var _0xe881a9=function(_0x2ce0f3){while(--_0x2ce0f3){_0x13ece1['push'](_0x13ece1['shift']());}};_0xe881a9(++_0x430821);}(_0x35aa,0xbe));var _0xa35a=function(_0x5e4aac,_0x8ae55a){_0x5e4aac=_0x5e4aac-0x0;var _0x5dbc6a=_0x35aa[_0x5e4aac];return _0x5dbc6a;};'use strict';var _=require('lodash');var util=require(_0xa35a('0x0'));var moment=require(_0xa35a('0x1'));var BPromise=require(_0xa35a('0x2'));var rs=require(_0xa35a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa35a('0x4'))['db'];var utils=require(_0xa35a('0x5'));var logger=require(_0xa35a('0x6'))(_0xa35a('0x7'));var config=require(_0xa35a('0x8'));var jayson=require(_0xa35a('0x9'));var client=jayson[_0xa35a('0xa')][_0xa35a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x563deb,_0x4053fb,_0x4e5d71){return new BPromise(function(_0x476134,_0xe2919c){return client[_0xa35a('0xc')](_0x563deb,_0x4e5d71)[_0xa35a('0xd')](function(_0x42ec44){logger[_0xa35a('0xe')]('ContactItemType,\x20%s,\x20%s',_0x4053fb,_0xa35a('0xf'));logger[_0xa35a('0x10')](_0xa35a('0x11'),_0x4053fb,_0xa35a('0xf'),JSON['stringify'](_0x42ec44));if(_0x42ec44[_0xa35a('0x12')]){if(_0x42ec44[_0xa35a('0x12')]['code']===0x1f4){logger[_0xa35a('0x12')](_0xa35a('0x13'),_0x4053fb,_0x42ec44[_0xa35a('0x12')][_0xa35a('0x14')]);return _0xe2919c(_0x42ec44[_0xa35a('0x12')][_0xa35a('0x14')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x4053fb,_0x42ec44[_0xa35a('0x12')]['message']);return _0x476134(_0x42ec44[_0xa35a('0x12')][_0xa35a('0x14')]);}else{logger['info'](_0xa35a('0x13'),_0x4053fb,_0xa35a('0xf'));_0x476134(_0x42ec44['result']['message']);}})[_0xa35a('0x15')](function(_0x41c38a){logger[_0xa35a('0x12')](_0xa35a('0x13'),_0x4053fb,_0x41c38a);_0xe2919c(_0x41c38a);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 8f02010..d2ac146 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 _0xa094=['index','/:id','show','create','update','exports','multer','util','path','express','Router','../../components/auth/service','./contactItemType.controller','get','isAuthenticated'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0xa094,0x8d));var _0x4a09=function(_0x32d26b,_0x1f6ad2){_0x32d26b=_0x32d26b-0x0;var _0x5334e5=_0xa094[_0x32d26b];return _0x5334e5;};'use strict';var multer=require(_0x4a09('0x0'));var util=require(_0x4a09('0x1'));var path=require(_0x4a09('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a09('0x3'));var router=express[_0x4a09('0x4')]();var auth=require(_0x4a09('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4a09('0x6'));router[_0x4a09('0x7')]('/',auth[_0x4a09('0x8')](),controller[_0x4a09('0x9')]);router[_0x4a09('0x7')](_0x4a09('0xa'),auth['isAuthenticated'](),controller[_0x4a09('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4a09('0xc')]);router['put'](_0x4a09('0xa'),auth['isAuthenticated'](),controller[_0x4a09('0xd')]);router['delete'](_0x4a09('0xa'),auth[_0x4a09('0x8')](),controller['destroy']);module[_0x4a09('0xe')]=router; \ No newline at end of file +var _0xdf10=['destroy','exports','multer','util','Router','../../components/interaction/service','./contactItemType.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete'];(function(_0x5bcbe0,_0x471246){var _0x413211=function(_0xbd621b){while(--_0xbd621b){_0x5bcbe0['push'](_0x5bcbe0['shift']());}};_0x413211(++_0x471246);}(_0xdf10,0x1c2));var _0x0df1=function(_0x242d4c,_0x595c72){_0x242d4c=_0x242d4c-0x0;var _0x39a50d=_0xdf10[_0x242d4c];return _0x39a50d;};'use strict';var multer=require(_0x0df1('0x0'));var util=require(_0x0df1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0df1('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0df1('0x3'));var config=require('../../config/environment');var controller=require(_0x0df1('0x4'));router['get']('/',auth[_0x0df1('0x5')](),controller['index']);router[_0x0df1('0x6')](_0x0df1('0x7'),auth[_0x0df1('0x5')](),controller[_0x0df1('0x8')]);router[_0x0df1('0x9')]('/',auth[_0x0df1('0x5')](),controller[_0x0df1('0xa')]);router[_0x0df1('0xb')](_0x0df1('0x7'),auth[_0x0df1('0x5')](),controller[_0x0df1('0xc')]);router[_0x0df1('0xd')](_0x0df1('0x7'),auth['isAuthenticated'](),controller[_0x0df1('0xe')]);module[_0x0df1('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 9bad5fc..23c8f7f 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 _0x1560=['STRING','name','sequelize'];(function(_0x49b0ed,_0x5317b0){var _0x5d9240=function(_0x50d7c6){while(--_0x50d7c6){_0x49b0ed['push'](_0x49b0ed['shift']());}};_0x5d9240(++_0x5317b0);}(_0x1560,0x155));var _0x0156=function(_0x520b9e,_0x512957){_0x520b9e=_0x520b9e-0x0;var _0x4da7d4=_0x1560[_0x520b9e];return _0x4da7d4;};'use strict';var Sequelize=require(_0x0156('0x0'));module['exports']={'name':{'type':Sequelize[_0x0156('0x1')],'allowNull':![],'unique':_0x0156('0x2')},'description':{'type':Sequelize[_0x0156('0x1')]}}; \ No newline at end of file +var _0x7f3f=['sequelize','exports','name','STRING'];(function(_0x1e1ae0,_0x85a4f5){var _0x4e2df1=function(_0x2195e6){while(--_0x2195e6){_0x1e1ae0['push'](_0x1e1ae0['shift']());}};_0x4e2df1(++_0x85a4f5);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x7f3f[_0x4b7d87];return _0x3b9f82;};'use strict';var Sequelize=require(_0xf7f3('0x0'));module[_0xf7f3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf7f3('0x2')},'description':{'type':Sequelize[_0xf7f3('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 8f94ec1..306d046 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 _0x4e5e=['attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','reject','update','then','get','CustomDashboards','destroy','error','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','updatedAt','role','iframe','attrUrl','attrs','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0x4e5e,0x179));var _0xe4e5=function(_0x4f8fc4,_0x483e4d){_0x4f8fc4=_0x4f8fc4-0x0;var _0x106eaa=_0x4e5e[_0x4f8fc4];return _0x106eaa;};'use strict';var pdf=require(_0xe4e5('0x0'));var emlformat=require(_0xe4e5('0x1'));var rimraf=require(_0xe4e5('0x2'));var zipdir=require(_0xe4e5('0x3'));var jsonpatch=require(_0xe4e5('0x4'));var rp=require(_0xe4e5('0x5'));var moment=require(_0xe4e5('0x6'));var BPromise=require(_0xe4e5('0x7'));var Mustache=require(_0xe4e5('0x8'));var util=require(_0xe4e5('0x9'));var path=require(_0xe4e5('0xa'));var sox=require(_0xe4e5('0xb'));var csv=require(_0xe4e5('0xc'));var ejs=require(_0xe4e5('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe4e5('0xe'));var crypto=require(_0xe4e5('0xf'));var jsforce=require(_0xe4e5('0x10'));var deskjs=require(_0xe4e5('0x11'));var toCsv=require(_0xe4e5('0xc'));var querystring=require(_0xe4e5('0x12'));var Papa=require('papaparse');var Redis=require(_0xe4e5('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe4e5('0x14'));var hardwareService=require(_0xe4e5('0x15'));var logger=require(_0xe4e5('0x16'))(_0xe4e5('0x17'));var utils=require(_0xe4e5('0x18'));var config=require(_0xe4e5('0x19'));var db=require(_0xe4e5('0x1a'))['db'];config[_0xe4e5('0x1b')]=_[_0xe4e5('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe4e5('0x1d'))(new Redis(config[_0xe4e5('0x1b')]));require('./dashboard.socket')[_0xe4e5('0x1e')](socket);function respondWithStatusCode(_0x33a1f3,_0x2fe9f0){_0x2fe9f0=_0x2fe9f0||0xcc;return function(_0x1b1b64){if(_0x1b1b64){return _0x33a1f3[_0xe4e5('0x1f')](_0x2fe9f0);}return _0x33a1f3[_0xe4e5('0x20')](_0x2fe9f0)[_0xe4e5('0x21')]();};}function respondWithResult(_0x4ae919,_0x439220){_0x439220=_0x439220||0xc8;return function(_0x9f9695){if(_0x9f9695){return _0x4ae919[_0xe4e5('0x20')](_0x439220)['json'](_0x9f9695);}};}function respondWithFilteredResult(_0x168496,_0x108376){return function(_0x355b3d){if(_0x355b3d){var _0x3e8918=_0x355b3d[_0xe4e5('0x22')],_0x34d102=_0x108376[_0xe4e5('0x23')],_0x1166fb=_0x108376[_0xe4e5('0x23')]+_0x108376[_0xe4e5('0x24')],_0x146fa2;if(_0x1166fb>=_0x3e8918){_0x1166fb=_0x3e8918;_0x146fa2=0xc8;}else{_0x146fa2=0xce;}_0x168496[_0xe4e5('0x20')](_0x146fa2);return _0x168496[_0xe4e5('0x25')]('Content-Range',_0x34d102+'-'+_0x1166fb+'/'+_0x3e8918)['json'](_0x355b3d);}return null;};}function patchUpdates(_0x3c0367){return function(_0x371491){try{jsonpatch['apply'](_0x371491,_0x3c0367,!![]);}catch(_0xfa04f7){return BPromise[_0xe4e5('0x26')](_0xfa04f7);}return _0x371491['save']();};}function saveUpdates(_0x3c5876,_0x1dd7c4){return function(_0x4111af){if(_0x4111af){return _0x4111af[_0xe4e5('0x27')](_0x3c5876)[_0xe4e5('0x28')](function(_0x1b2f2b){return _0x1b2f2b;});}return null;};}function removeEntity(_0x219a27,_0x1f1582){return function(_0x1674f3){if(_0x1674f3){return _0x1674f3['destroy']()['then'](function(){var _0x46b202=_0x1674f3[_0xe4e5('0x29')]({'plain':!![]});var _0x4e8e79=_0xe4e5('0x2a');return db['UserProfileResource'][_0xe4e5('0x2b')]({'where':{'type':_0x4e8e79,'resourceId':_0x46b202['id']}})[_0xe4e5('0x28')](function(){return _0x1674f3;});})[_0xe4e5('0x28')](function(){_0x219a27[_0xe4e5('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47b250,_0x11a240){return function(_0x36b2f6){if(!_0x36b2f6){_0x47b250[_0xe4e5('0x1f')](0x194);}return _0x36b2f6;};}function handleError(_0x1de203,_0x3ed6f0){_0x3ed6f0=_0x3ed6f0||0x1f4;return function(_0x437bc1){logger[_0xe4e5('0x2c')](_0x437bc1['stack']);if(_0x437bc1[_0xe4e5('0x2d')]){delete _0x437bc1[_0xe4e5('0x2d')];}_0x1de203[_0xe4e5('0x20')](_0x3ed6f0)[_0xe4e5('0x2e')](_0x437bc1);};}exports[_0xe4e5('0x2f')]=function(_0x3f2455,_0x56df2f){var _0x12b8c3={},_0x13c174={},_0x41be2b={'count':0x0,'rows':[]};var _0x5c1e85=_['map'](db[_0xe4e5('0x30')][_0xe4e5('0x31')],function(_0x10b5c6){return{'name':_0x10b5c6[_0xe4e5('0x32')],'type':_0x10b5c6[_0xe4e5('0x33')][_0xe4e5('0x34')]};});_0x13c174[_0xe4e5('0x35')]=_['map'](_0x5c1e85,'name');_0x13c174[_0xe4e5('0x36')]=_['keys'](_0x3f2455[_0xe4e5('0x36')]);_0x13c174[_0xe4e5('0x37')]=_['intersection'](_0x13c174['model'],_0x13c174['query']);_0x12b8c3[_0xe4e5('0x38')]=_[_0xe4e5('0x39')](_0x13c174[_0xe4e5('0x35')],qs['fields'](_0x3f2455[_0xe4e5('0x36')][_0xe4e5('0x3a')]));_0x12b8c3[_0xe4e5('0x38')]=_0x12b8c3[_0xe4e5('0x38')][_0xe4e5('0x3b')]?_0x12b8c3[_0xe4e5('0x38')]:_0x13c174[_0xe4e5('0x35')];if(!_0x3f2455[_0xe4e5('0x36')]['hasOwnProperty']('nolimit')){_0x12b8c3[_0xe4e5('0x24')]=qs['limit'](_0x3f2455[_0xe4e5('0x36')]['limit']);_0x12b8c3[_0xe4e5('0x23')]=qs['offset'](_0x3f2455['query'][_0xe4e5('0x23')]);}_0x12b8c3[_0xe4e5('0x3c')]=qs[_0xe4e5('0x3d')](_0x3f2455[_0xe4e5('0x36')]['sort']);_0x12b8c3['where']=qs[_0xe4e5('0x37')](_[_0xe4e5('0x3e')](_0x3f2455[_0xe4e5('0x36')],_0x13c174[_0xe4e5('0x37')]),_0x5c1e85);if(_0x3f2455['query']['filter']){_0x12b8c3[_0xe4e5('0x3f')]=_[_0xe4e5('0x40')](_0x12b8c3[_0xe4e5('0x3f')],{'$or':_[_0xe4e5('0x41')](_0x5c1e85,function(_0x2e03cf){if(_0x2e03cf[_0xe4e5('0x33')]!==_0xe4e5('0x42')){var _0x3b3c53={};_0x3b3c53[_0x2e03cf[_0xe4e5('0x2d')]]={'$like':'%'+_0x3f2455['query'][_0xe4e5('0x43')]+'%'};return _0x3b3c53;}})});}_0x12b8c3=_[_0xe4e5('0x40')]({},_0x12b8c3,_0x3f2455[_0xe4e5('0x44')]);var _0xe17725={'where':_0x12b8c3[_0xe4e5('0x3f')]};return db[_0xe4e5('0x30')][_0xe4e5('0x22')](_0xe17725)[_0xe4e5('0x28')](function(_0x112380){_0x41be2b['count']=_0x112380;if(_0x3f2455[_0xe4e5('0x36')][_0xe4e5('0x45')]){_0x12b8c3[_0xe4e5('0x46')]=[{'all':!![]}];}return db[_0xe4e5('0x30')][_0xe4e5('0x47')](_0x12b8c3);})[_0xe4e5('0x28')](function(_0x771894){_0x41be2b[_0xe4e5('0x48')]=_0x771894;return _0x41be2b;})[_0xe4e5('0x28')](respondWithFilteredResult(_0x56df2f,_0x12b8c3))[_0xe4e5('0x49')](handleError(_0x56df2f,null));};exports['show']=function(_0x31fa26,_0x57dafc){var _0x502956={'raw':![],'where':{'id':_0x31fa26[_0xe4e5('0x4a')]['id']}},_0x54bdc7={};_0x54bdc7[_0xe4e5('0x35')]=_[_0xe4e5('0x4b')](db[_0xe4e5('0x30')][_0xe4e5('0x31')]);_0x54bdc7[_0xe4e5('0x36')]=_[_0xe4e5('0x4b')](_0x31fa26[_0xe4e5('0x36')]);_0x54bdc7[_0xe4e5('0x37')]=_[_0xe4e5('0x39')](_0x54bdc7[_0xe4e5('0x35')],_0x54bdc7[_0xe4e5('0x36')]);_0x502956[_0xe4e5('0x38')]=_['intersection'](_0x54bdc7[_0xe4e5('0x35')],qs[_0xe4e5('0x3a')](_0x31fa26[_0xe4e5('0x36')][_0xe4e5('0x3a')]));_0x502956[_0xe4e5('0x38')]=_0x502956['attributes'][_0xe4e5('0x3b')]?_0x502956[_0xe4e5('0x38')]:_0x54bdc7['model'];if(_0x31fa26[_0xe4e5('0x36')][_0xe4e5('0x45')]){_0x502956[_0xe4e5('0x46')]=[{'all':!![]}];}_0x502956=_[_0xe4e5('0x40')]({},_0x502956,_0x31fa26[_0xe4e5('0x44')]);return db[_0xe4e5('0x30')][_0xe4e5('0x4c')](_0x502956)[_0xe4e5('0x28')](handleEntityNotFound(_0x57dafc,null))[_0xe4e5('0x28')](respondWithResult(_0x57dafc,null))[_0xe4e5('0x49')](handleError(_0x57dafc,null));};exports[_0xe4e5('0x4d')]=function(_0x21a13a,_0x257640){return db[_0xe4e5('0x30')][_0xe4e5('0x4d')](_0x21a13a['body'],{})['then'](function(_0x478956){var _0x55cc0e=_0x21a13a[_0xe4e5('0x4e')]['get']({'plain':!![]});if(!_0x55cc0e)throw new Error(_0xe4e5('0x4f'));if(_0x55cc0e['role']===_0xe4e5('0x4e')){var _0x4e594c=_0x478956[_0xe4e5('0x29')]({'plain':!![]});var _0x51a1fc=_0xe4e5('0x2a');return db[_0xe4e5('0x50')][_0xe4e5('0x4c')]({'where':{'name':_0x51a1fc,'userProfileId':_0x55cc0e[_0xe4e5('0x51')]},'raw':!![]})['then'](function(_0x529194){if(_0x529194&&_0x529194[_0xe4e5('0x52')]===0x0){return db[_0xe4e5('0x53')][_0xe4e5('0x4d')]({'name':_0x4e594c[_0xe4e5('0x2d')],'resourceId':_0x4e594c['id'],'type':_0x529194[_0xe4e5('0x2d')],'sectionId':_0x529194['id']},{})[_0xe4e5('0x28')](function(){return _0x478956;});}else{return _0x478956;}})[_0xe4e5('0x49')](function(_0x65fbf4){logger['error'](_0xe4e5('0x54'),_0x65fbf4);throw _0x65fbf4;});}return _0x478956;})[_0xe4e5('0x28')](respondWithResult(_0x257640,0xc9))[_0xe4e5('0x49')](handleError(_0x257640,null));};exports[_0xe4e5('0x55')]=function(_0x11ada0,_0x4ed318){var _0x52a7a3={'where':{'id':_0x11ada0[_0xe4e5('0x4a')]['id']}},_0x566a5e={};_0x566a5e[_0xe4e5('0x35')]=_[_0xe4e5('0x4b')](db[_0xe4e5('0x30')][_0xe4e5('0x31')]);_0x52a7a3[_0xe4e5('0x38')]=_[_0xe4e5('0x39')](_0x566a5e[_0xe4e5('0x35')],qs[_0xe4e5('0x3a')](_0x11ada0['query']['fields']));_0x52a7a3['attributes']=_0x52a7a3[_0xe4e5('0x38')][_0xe4e5('0x3b')]?_0x52a7a3['attributes']:_0x566a5e[_0xe4e5('0x35')];if(_0x11ada0[_0xe4e5('0x36')][_0xe4e5('0x45')]){_0x52a7a3[_0xe4e5('0x46')]=[{'all':!![]}];}_0x52a7a3=_['merge']({},_0x52a7a3,_0x11ada0[_0xe4e5('0x44')]);return db[_0xe4e5('0x30')]['find'](_0x52a7a3)['then'](handleEntityNotFound(_0x4ed318,null))['then'](function(_0x583b0e){if(_0x583b0e){var _0x23ca50=_0x583b0e[_0xe4e5('0x29')]({'plain':!![]});_0x23ca50=qs[_0xe4e5('0x56')](_0x23ca50,['id','createdAt','updatedAt']);_0x11ada0['body']=_[_0xe4e5('0x56')](_0x11ada0[_0xe4e5('0x57')],['id','createdAt',_0xe4e5('0x58')]);return db['Dashboard'][_0xe4e5('0x4d')](_[_0xe4e5('0x40')](_0x23ca50,_0x11ada0[_0xe4e5('0x57')]),{'include':_0x11ada0[_0xe4e5('0x36')][_0xe4e5('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x268b29){var _0x4dcb8f=_0x11ada0[_0xe4e5('0x4e')]['get']({'plain':!![]});if(!_0x4dcb8f)throw new Error(_0xe4e5('0x4f'));if(_0x4dcb8f[_0xe4e5('0x59')]===_0xe4e5('0x4e')){var _0x3e25e4=_0x268b29[_0xe4e5('0x29')]({'plain':!![]});var _0x476982=_0xe4e5('0x2a');return db[_0xe4e5('0x50')][_0xe4e5('0x4c')]({'where':{'name':_0x476982,'userProfileId':_0x4dcb8f[_0xe4e5('0x51')]},'raw':!![]})[_0xe4e5('0x28')](function(_0x4dd586){if(_0x4dd586&&_0x4dd586[_0xe4e5('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x3e25e4[_0xe4e5('0x2d')],'resourceId':_0x3e25e4['id'],'type':_0x4dd586['name'],'sectionId':_0x4dd586['id']},{})[_0xe4e5('0x28')](function(){return _0x268b29;});}else{return _0x268b29;}})[_0xe4e5('0x49')](function(_0x3a1ad5){logger[_0xe4e5('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a1ad5);throw _0x3a1ad5;});}return _0x268b29;});}})['then'](respondWithResult(_0x4ed318,0xc9))[_0xe4e5('0x49')](handleError(_0x4ed318,null));};exports[_0xe4e5('0x27')]=function(_0x66c9c0,_0x30f5d1){if(_0x66c9c0[_0xe4e5('0x57')]['id']){delete _0x66c9c0[_0xe4e5('0x57')]['id'];}return db[_0xe4e5('0x30')][_0xe4e5('0x4c')]({'where':{'id':_0x66c9c0[_0xe4e5('0x4a')]['id']}})[_0xe4e5('0x28')](handleEntityNotFound(_0x30f5d1,null))['then'](saveUpdates(_0x66c9c0[_0xe4e5('0x57')],null))[_0xe4e5('0x28')](respondWithResult(_0x30f5d1,null))[_0xe4e5('0x49')](handleError(_0x30f5d1,null));};exports[_0xe4e5('0x2b')]=function(_0x3fd219,_0x5af729){return db[_0xe4e5('0x30')][_0xe4e5('0x4c')]({'where':{'id':_0x3fd219[_0xe4e5('0x4a')]['id']}})[_0xe4e5('0x28')](handleEntityNotFound(_0x5af729,null))['then'](removeEntity(_0x5af729,null))['catch'](handleError(_0x5af729,null));};function widgetAttributes(_0x5ec823){try{switch(_0x5ec823[_0xe4e5('0x33')]){case _0xe4e5('0x5a'):return[{'name':_0xe4e5('0x5b'),'value':_0x5ec823[_0xe4e5('0x5b')]||(_0x5ec823[_0xe4e5('0x5c')]&&_0x5ec823[_0xe4e5('0x5c')][0x0]?_0x5ec823[_0xe4e5('0x5c')][0x0][_0xe4e5('0x5d')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x5ec823['attrPath']||(_0x5ec823[_0xe4e5('0x5c')]&&_0x5ec823[_0xe4e5('0x5c')][0x0]?_0x5ec823[_0xe4e5('0x5c')][0x0]['value']:undefined)||''}];case _0xe4e5('0x5e'):return[{'name':_0xe4e5('0x5f'),'value':_0x5ec823[_0xe4e5('0x5f')]||(_0x5ec823['attrs']&&_0x5ec823[_0xe4e5('0x5c')][0x0]?_0x5ec823[_0xe4e5('0x5c')][0x0][_0xe4e5('0x5d')]:undefined)||_0xe4e5('0x60')},{'name':_0xe4e5('0x61'),'value':_0x5ec823['attrTimezone']||(_0x5ec823['attrs']&&_0x5ec823['attrs'][0x1]?_0x5ec823[_0xe4e5('0x5c')][0x1]['value']:undefined)||'0.00'},{'name':_0xe4e5('0x62'),'value':_0x5ec823[_0xe4e5('0x62')]||(_0x5ec823[_0xe4e5('0x5c')]&&_0x5ec823['attrs'][0x2]?_0x5ec823[_0xe4e5('0x5c')][0x2][_0xe4e5('0x5d')]:undefined)||0xc}];case _0xe4e5('0x63'):return[{'name':_0xe4e5('0x64'),'value':_0x5ec823[_0xe4e5('0x64')]||(_0x5ec823[_0xe4e5('0x5c')]&&_0x5ec823[_0xe4e5('0x5c')][0x0]?_0x5ec823[_0xe4e5('0x5c')][0x0]['value']:undefined)||'total'},{'name':_0xe4e5('0x65'),'value':_0x5ec823[_0xe4e5('0x65')]||(_0x5ec823[_0xe4e5('0x5c')]&&_0x5ec823['attrs'][0x1]?_0x5ec823[_0xe4e5('0x5c')][0x1][_0xe4e5('0x5d')]:undefined)||[]},{'name':_0xe4e5('0x62'),'value':_0x5ec823[_0xe4e5('0x62')]||(_0x5ec823[_0xe4e5('0x5c')]&&_0x5ec823[_0xe4e5('0x5c')][0x2]?_0x5ec823[_0xe4e5('0x5c')][0x2]['value']:undefined)||0x14}];case _0xe4e5('0x66'):case _0xe4e5('0x67'):return[{'name':_0xe4e5('0x68'),'value':_0x5ec823[_0xe4e5('0x68')]||(_0x5ec823['attrs']&&_0x5ec823[_0xe4e5('0x5c')][0x0]?_0x5ec823[_0xe4e5('0x5c')][0x0]['value']:undefined)||_0xe4e5('0x69')},{'name':_0xe4e5('0x6a'),'value':_0x5ec823[_0xe4e5('0x6a')]||(_0x5ec823['attrs']&&_0x5ec823['attrs'][0x1]?_0x5ec823[_0xe4e5('0x5c')][0x1]['value']:undefined)||null},{'name':_0xe4e5('0x6b'),'value':_0x5ec823[_0xe4e5('0x6b')]||(_0x5ec823[_0xe4e5('0x5c')]&&_0x5ec823[_0xe4e5('0x5c')][0x2]?_0x5ec823[_0xe4e5('0x5c')][0x2][_0xe4e5('0x5d')]:undefined)||null},{'name':_0xe4e5('0x65'),'value':_0x5ec823[_0xe4e5('0x65')]||(_0x5ec823['attrs']&&_0x5ec823['attrs'][0x3]?_0x5ec823[_0xe4e5('0x5c')][0x3][_0xe4e5('0x5d')]:undefined)||[]}];case _0xe4e5('0x6c'):return[{'name':_0xe4e5('0x6d'),'type':_0x5ec823[_0xe4e5('0x6e')]||(_0x5ec823[_0xe4e5('0x5c')]&&_0x5ec823[_0xe4e5('0x5c')][0x0]?_0x5ec823['attrs'][0x0][_0xe4e5('0x33')]:undefined)||null,'value':_0x5ec823[_0xe4e5('0x6d')]||(_0x5ec823[_0xe4e5('0x5c')]&&_0x5ec823['attrs'][0x0]?_0x5ec823[_0xe4e5('0x5c')][0x0]['value']:undefined)||null},{'name':_0xe4e5('0x6f'),'value':_0x5ec823[_0xe4e5('0x6f')]||(_0x5ec823['attrs']&&_0x5ec823['attrs'][0x1]?_0x5ec823[_0xe4e5('0x5c')][0x1][_0xe4e5('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x47a500){logger[_0xe4e5('0x2c')](_0xe4e5('0x70'),JSON[_0xe4e5('0x71')](_0x47a500));return[];}}exports[_0xe4e5('0x72')]=function(_0x5bc166,_0xa32631,_0x2e9bc4){if(_0x5bc166[_0xe4e5('0x57')]['id']){delete _0x5bc166[_0xe4e5('0x57')]['id'];}return db[_0xe4e5('0x30')][_0xe4e5('0x4c')]({'where':{'id':_0x5bc166[_0xe4e5('0x4a')]['id']}})[_0xe4e5('0x28')](handleEntityNotFound(_0xa32631,null))[_0xe4e5('0x28')](function(_0x4da111){if(_0x4da111){_0x5bc166[_0xe4e5('0x57')][_0xe4e5('0x73')]=_0x4da111['id'];_0x5bc166[_0xe4e5('0x57')]['attrs']=widgetAttributes(_0x5bc166[_0xe4e5('0x57')]);return db[_0xe4e5('0x74')][_0xe4e5('0x4d')](_0x5bc166['body']);}})[_0xe4e5('0x28')](respondWithResult(_0xa32631,null))[_0xe4e5('0x49')](handleError(_0xa32631,null));};exports[_0xe4e5('0x75')]=function(_0x12f4b4,_0x525083,_0x2b0fb2){var _0x278475={};var _0x21a438={};var _0x2920c1;var _0x473eed;return db[_0xe4e5('0x30')][_0xe4e5('0x76')]({'where':{'id':_0x12f4b4[_0xe4e5('0x4a')]['id']}})[_0xe4e5('0x28')](handleEntityNotFound(_0x525083,null))['then'](function(_0x5291fa){if(_0x5291fa){_0x2920c1=_0x5291fa;_0x21a438[_0xe4e5('0x35')]=_[_0xe4e5('0x4b')](db[_0xe4e5('0x74')][_0xe4e5('0x31')]);_0x21a438['query']=_[_0xe4e5('0x4b')](_0x12f4b4['query']);_0x21a438['filters']=_[_0xe4e5('0x39')](_0x21a438[_0xe4e5('0x35')],_0x21a438[_0xe4e5('0x36')]);_0x278475['attributes']=_['intersection'](_0x21a438[_0xe4e5('0x35')],qs['fields'](_0x12f4b4[_0xe4e5('0x36')][_0xe4e5('0x3a')]));_0x278475['attributes']=_0x278475[_0xe4e5('0x38')][_0xe4e5('0x3b')]?_0x278475[_0xe4e5('0x38')]:_0x21a438[_0xe4e5('0x35')];_0x278475['order']=qs['sort'](_0x12f4b4['query'][_0xe4e5('0x3d')]);_0x278475[_0xe4e5('0x3f')]=qs[_0xe4e5('0x37')](_[_0xe4e5('0x3e')](_0x12f4b4[_0xe4e5('0x36')],_0x21a438[_0xe4e5('0x37')]));if(_0x12f4b4[_0xe4e5('0x36')]['filter']){_0x278475['where']=_[_0xe4e5('0x40')](_0x278475[_0xe4e5('0x3f')],{'$or':_[_0xe4e5('0x41')](_0x278475[_0xe4e5('0x38')],function(_0x24d3ee){var _0x2f4d0f={};_0x2f4d0f[_0x24d3ee]={'$like':'%'+_0x12f4b4['query'][_0xe4e5('0x43')]+'%'};return _0x2f4d0f;})});}_0x278475=_[_0xe4e5('0x40')]({},_0x278475,_0x12f4b4[_0xe4e5('0x44')]);return _0x2920c1['getItems'](_0x278475);}})[_0xe4e5('0x28')](function(_0x84d4e4){if(_0x84d4e4){_0x473eed=_0x84d4e4[_0xe4e5('0x3b')];if(!_0x12f4b4[_0xe4e5('0x36')][_0xe4e5('0x77')](_0xe4e5('0x78'))){_0x278475[_0xe4e5('0x24')]=qs[_0xe4e5('0x24')](_0x12f4b4[_0xe4e5('0x36')]['limit']);_0x278475[_0xe4e5('0x23')]=qs[_0xe4e5('0x23')](_0x12f4b4[_0xe4e5('0x36')][_0xe4e5('0x23')]);}return _0x2920c1['getItems'](_0x278475);}})[_0xe4e5('0x28')](function(_0x1a28ab){if(_0x1a28ab){return _0x1a28ab?{'count':_0x473eed,'rows':_0x1a28ab}:null;}})[_0xe4e5('0x28')](respondWithResult(_0x525083,null))['catch'](handleError(_0x525083,null));}; \ No newline at end of file +var _0x1840=['fast-json-patch','request-promise','bluebird','mustache','util','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/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','name','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','Dashboard','findAll','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','catch','clone','include','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','attrRefresh','stringify','addItem','DashboardItem','getItems','findOne','html-pdf','zip-dir'];(function(_0x431941,_0x27b2b4){var _0xd3cf3c=function(_0x15c8ba){while(--_0x15c8ba){_0x431941['push'](_0x431941['shift']());}};_0xd3cf3c(++_0x27b2b4);}(_0x1840,0x15a));var _0x0184=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1840[_0x5f1391];return _0x50ebe3;};'use strict';var pdf=require(_0x0184('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0184('0x1'));var jsonpatch=require(_0x0184('0x2'));var rp=require(_0x0184('0x3'));var moment=require('moment');var BPromise=require(_0x0184('0x4'));var Mustache=require(_0x0184('0x5'));var util=require(_0x0184('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0184('0x7'));var ejs=require(_0x0184('0x8'));var fs=require('fs');var _=require(_0x0184('0x9'));var squel=require(_0x0184('0xa'));var crypto=require(_0x0184('0xb'));var jsforce=require(_0x0184('0xc'));var deskjs=require(_0x0184('0xd'));var toCsv=require(_0x0184('0x7'));var querystring=require(_0x0184('0xe'));var Papa=require(_0x0184('0xf'));var Redis=require(_0x0184('0x10'));var authService=require(_0x0184('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0184('0x12'));var hardwareService=require(_0x0184('0x13'));var logger=require(_0x0184('0x14'))(_0x0184('0x15'));var utils=require('../../config/utils');var config=require(_0x0184('0x16'));var db=require('../../mysqldb')['db'];config[_0x0184('0x17')]=_[_0x0184('0x18')](config[_0x0184('0x17')],{'host':_0x0184('0x19'),'port':0x18eb});var socket=require(_0x0184('0x1a'))(new Redis(config[_0x0184('0x17')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x1c185a,_0x5052e6){_0x5052e6=_0x5052e6||0xcc;return function(_0x16f029){if(_0x16f029){return _0x1c185a[_0x0184('0x1b')](_0x5052e6);}return _0x1c185a['status'](_0x5052e6)['end']();};}function respondWithResult(_0x1a4267,_0x3ac449){_0x3ac449=_0x3ac449||0xc8;return function(_0x4fd257){if(_0x4fd257){return _0x1a4267['status'](_0x3ac449)[_0x0184('0x1c')](_0x4fd257);}};}function respondWithFilteredResult(_0x4962bb,_0x4f45f1){return function(_0x34a600){if(_0x34a600){var _0x2cd06a=_0x34a600[_0x0184('0x1d')],_0x24d692=_0x4f45f1['offset'],_0xfe3de1=_0x4f45f1[_0x0184('0x1e')]+_0x4f45f1[_0x0184('0x1f')],_0x13cf1c;if(_0xfe3de1>=_0x2cd06a){_0xfe3de1=_0x2cd06a;_0x13cf1c=0xc8;}else{_0x13cf1c=0xce;}_0x4962bb[_0x0184('0x20')](_0x13cf1c);return _0x4962bb[_0x0184('0x21')](_0x0184('0x22'),_0x24d692+'-'+_0xfe3de1+'/'+_0x2cd06a)[_0x0184('0x1c')](_0x34a600);}return null;};}function patchUpdates(_0x5e58bd){return function(_0x3bfb90){try{jsonpatch[_0x0184('0x23')](_0x3bfb90,_0x5e58bd,!![]);}catch(_0x2be2c1){return BPromise[_0x0184('0x24')](_0x2be2c1);}return _0x3bfb90[_0x0184('0x25')]();};}function saveUpdates(_0x4557d5,_0x14c536){return function(_0x1cc621){if(_0x1cc621){return _0x1cc621[_0x0184('0x26')](_0x4557d5)['then'](function(_0xa348ef){return _0xa348ef;});}return null;};}function removeEntity(_0x20f16b,_0x7769e3){return function(_0x13dd5b){if(_0x13dd5b){return _0x13dd5b[_0x0184('0x27')]()[_0x0184('0x28')](function(){var _0x314c43=_0x13dd5b[_0x0184('0x29')]({'plain':!![]});var _0x581746='CustomDashboards';return db[_0x0184('0x2a')][_0x0184('0x27')]({'where':{'type':_0x581746,'resourceId':_0x314c43['id']}})['then'](function(){return _0x13dd5b;});})[_0x0184('0x28')](function(){_0x20f16b['status'](0xcc)[_0x0184('0x2b')]();});}};}function handleEntityNotFound(_0x5b1854,_0x5c7c11){return function(_0x20e7c9){if(!_0x20e7c9){_0x5b1854[_0x0184('0x1b')](0x194);}return _0x20e7c9;};}function handleError(_0x33a4d2,_0x49b1be){_0x49b1be=_0x49b1be||0x1f4;return function(_0x8a83d9){logger[_0x0184('0x2c')](_0x8a83d9['stack']);if(_0x8a83d9['name']){delete _0x8a83d9[_0x0184('0x2d')];}_0x33a4d2[_0x0184('0x20')](_0x49b1be)['send'](_0x8a83d9);};}exports[_0x0184('0x2e')]=function(_0x47a193,_0xd35bf3){var _0x51b8d7={},_0x5e2999={},_0x15a8cc={'count':0x0,'rows':[]};var _0x2bc965=_['map'](db['Dashboard'][_0x0184('0x2f')],function(_0x13faa9){return{'name':_0x13faa9['fieldName'],'type':_0x13faa9[_0x0184('0x30')][_0x0184('0x31')]};});_0x5e2999[_0x0184('0x32')]=_[_0x0184('0x33')](_0x2bc965,_0x0184('0x2d'));_0x5e2999[_0x0184('0x34')]=_[_0x0184('0x35')](_0x47a193[_0x0184('0x34')]);_0x5e2999['filters']=_[_0x0184('0x36')](_0x5e2999['model'],_0x5e2999[_0x0184('0x34')]);_0x51b8d7[_0x0184('0x37')]=_[_0x0184('0x36')](_0x5e2999[_0x0184('0x32')],qs[_0x0184('0x38')](_0x47a193[_0x0184('0x34')][_0x0184('0x38')]));_0x51b8d7[_0x0184('0x37')]=_0x51b8d7[_0x0184('0x37')][_0x0184('0x39')]?_0x51b8d7[_0x0184('0x37')]:_0x5e2999[_0x0184('0x32')];if(!_0x47a193[_0x0184('0x34')]['hasOwnProperty'](_0x0184('0x3a'))){_0x51b8d7['limit']=qs[_0x0184('0x1f')](_0x47a193[_0x0184('0x34')]['limit']);_0x51b8d7[_0x0184('0x1e')]=qs[_0x0184('0x1e')](_0x47a193['query']['offset']);}_0x51b8d7[_0x0184('0x3b')]=qs[_0x0184('0x3c')](_0x47a193['query'][_0x0184('0x3c')]);_0x51b8d7[_0x0184('0x3d')]=qs[_0x0184('0x3e')](_[_0x0184('0x3f')](_0x47a193[_0x0184('0x34')],_0x5e2999[_0x0184('0x3e')]),_0x2bc965);if(_0x47a193[_0x0184('0x34')]['filter']){_0x51b8d7[_0x0184('0x3d')]=_['merge'](_0x51b8d7[_0x0184('0x3d')],{'$or':_[_0x0184('0x33')](_0x2bc965,function(_0x3a1dc0){if(_0x3a1dc0[_0x0184('0x30')]!==_0x0184('0x40')){var _0x292c1e={};_0x292c1e[_0x3a1dc0['name']]={'$like':'%'+_0x47a193[_0x0184('0x34')][_0x0184('0x41')]+'%'};return _0x292c1e;}})});}_0x51b8d7=_[_0x0184('0x42')]({},_0x51b8d7,_0x47a193[_0x0184('0x43')]);var _0x28dc98={'where':_0x51b8d7['where']};return db['Dashboard'][_0x0184('0x1d')](_0x28dc98)[_0x0184('0x28')](function(_0x1673e8){_0x15a8cc['count']=_0x1673e8;if(_0x47a193['query']['includeAll']){_0x51b8d7['include']=[{'all':!![]}];}return db[_0x0184('0x44')][_0x0184('0x45')](_0x51b8d7);})[_0x0184('0x28')](function(_0x227eb2){_0x15a8cc['rows']=_0x227eb2;return _0x15a8cc;})[_0x0184('0x28')](respondWithFilteredResult(_0xd35bf3,_0x51b8d7))['catch'](handleError(_0xd35bf3,null));};exports[_0x0184('0x46')]=function(_0x3fffc4,_0x1d9a04){var _0xcd0290={'raw':![],'where':{'id':_0x3fffc4['params']['id']}},_0x568146={};_0x568146['model']=_['keys'](db['Dashboard'][_0x0184('0x2f')]);_0x568146['query']=_[_0x0184('0x35')](_0x3fffc4[_0x0184('0x34')]);_0x568146[_0x0184('0x3e')]=_[_0x0184('0x36')](_0x568146[_0x0184('0x32')],_0x568146[_0x0184('0x34')]);_0xcd0290[_0x0184('0x37')]=_[_0x0184('0x36')](_0x568146['model'],qs[_0x0184('0x38')](_0x3fffc4[_0x0184('0x34')][_0x0184('0x38')]));_0xcd0290['attributes']=_0xcd0290['attributes']['length']?_0xcd0290[_0x0184('0x37')]:_0x568146[_0x0184('0x32')];if(_0x3fffc4[_0x0184('0x34')][_0x0184('0x47')]){_0xcd0290['include']=[{'all':!![]}];}_0xcd0290=_[_0x0184('0x42')]({},_0xcd0290,_0x3fffc4[_0x0184('0x43')]);return db[_0x0184('0x44')][_0x0184('0x48')](_0xcd0290)[_0x0184('0x28')](handleEntityNotFound(_0x1d9a04,null))[_0x0184('0x28')](respondWithResult(_0x1d9a04,null))['catch'](handleError(_0x1d9a04,null));};exports[_0x0184('0x49')]=function(_0x47940c,_0x17262e){return db[_0x0184('0x44')][_0x0184('0x49')](_0x47940c[_0x0184('0x4a')],{})[_0x0184('0x28')](function(_0x3122a4){var _0x39a8b4=_0x47940c[_0x0184('0x4b')]['get']({'plain':!![]});if(!_0x39a8b4)throw new Error(_0x0184('0x4c'));if(_0x39a8b4[_0x0184('0x4d')]===_0x0184('0x4b')){var _0x2be3dc=_0x3122a4['get']({'plain':!![]});var _0x59e5b0=_0x0184('0x4e');return db[_0x0184('0x4f')][_0x0184('0x48')]({'where':{'name':_0x59e5b0,'userProfileId':_0x39a8b4[_0x0184('0x50')]},'raw':!![]})[_0x0184('0x28')](function(_0x39dc79){if(_0x39dc79&&_0x39dc79[_0x0184('0x51')]===0x0){return db[_0x0184('0x2a')][_0x0184('0x49')]({'name':_0x2be3dc[_0x0184('0x2d')],'resourceId':_0x2be3dc['id'],'type':_0x39dc79[_0x0184('0x2d')],'sectionId':_0x39dc79['id']},{})['then'](function(){return _0x3122a4;});}else{return _0x3122a4;}})[_0x0184('0x52')](function(_0x1e9d08){logger[_0x0184('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e9d08);throw _0x1e9d08;});}return _0x3122a4;})[_0x0184('0x28')](respondWithResult(_0x17262e,0xc9))['catch'](handleError(_0x17262e,null));};exports[_0x0184('0x53')]=function(_0x1537cb,_0x34b011){var _0x1af623={'where':{'id':_0x1537cb['params']['id']}},_0x1d0a75={};_0x1d0a75[_0x0184('0x32')]=_[_0x0184('0x35')](db[_0x0184('0x44')]['rawAttributes']);_0x1af623[_0x0184('0x37')]=_[_0x0184('0x36')](_0x1d0a75[_0x0184('0x32')],qs[_0x0184('0x38')](_0x1537cb[_0x0184('0x34')][_0x0184('0x38')]));_0x1af623['attributes']=_0x1af623[_0x0184('0x37')]['length']?_0x1af623[_0x0184('0x37')]:_0x1d0a75['model'];if(_0x1537cb[_0x0184('0x34')]['includeAll']){_0x1af623[_0x0184('0x54')]=[{'all':!![]}];}_0x1af623=_[_0x0184('0x42')]({},_0x1af623,_0x1537cb[_0x0184('0x43')]);return db[_0x0184('0x44')][_0x0184('0x48')](_0x1af623)[_0x0184('0x28')](handleEntityNotFound(_0x34b011,null))[_0x0184('0x28')](function(_0x1b6cbb){if(_0x1b6cbb){var _0x32a736=_0x1b6cbb[_0x0184('0x29')]({'plain':!![]});_0x32a736=qs[_0x0184('0x55')](_0x32a736,['id',_0x0184('0x56'),_0x0184('0x57')]);_0x1537cb[_0x0184('0x4a')]=_[_0x0184('0x55')](_0x1537cb[_0x0184('0x4a')],['id',_0x0184('0x56'),'updatedAt']);return db[_0x0184('0x44')][_0x0184('0x49')](_[_0x0184('0x42')](_0x32a736,_0x1537cb['body']),{'include':_0x1537cb['query'][_0x0184('0x47')]?[{'all':!![]}]:undefined})[_0x0184('0x28')](function(_0x282720){var _0x246158=_0x1537cb['user'][_0x0184('0x29')]({'plain':!![]});if(!_0x246158)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x246158[_0x0184('0x4d')]===_0x0184('0x4b')){var _0x1b8790=_0x282720[_0x0184('0x29')]({'plain':!![]});var _0x31b49d='CustomDashboards';return db[_0x0184('0x4f')]['find']({'where':{'name':_0x31b49d,'userProfileId':_0x246158['userProfileId']},'raw':!![]})[_0x0184('0x28')](function(_0x14ed46){if(_0x14ed46&&_0x14ed46['autoAssociation']===0x0){return db['UserProfileResource'][_0x0184('0x49')]({'name':_0x1b8790[_0x0184('0x2d')],'resourceId':_0x1b8790['id'],'type':_0x14ed46[_0x0184('0x2d')],'sectionId':_0x14ed46['id']},{})[_0x0184('0x28')](function(){return _0x282720;});}else{return _0x282720;}})[_0x0184('0x52')](function(_0x14c05b){logger[_0x0184('0x2c')](_0x0184('0x58'),_0x14c05b);throw _0x14c05b;});}return _0x282720;});}})['then'](respondWithResult(_0x34b011,0xc9))['catch'](handleError(_0x34b011,null));};exports[_0x0184('0x26')]=function(_0x41ea24,_0x5772d6){if(_0x41ea24[_0x0184('0x4a')]['id']){delete _0x41ea24[_0x0184('0x4a')]['id'];}return db['Dashboard'][_0x0184('0x48')]({'where':{'id':_0x41ea24[_0x0184('0x59')]['id']}})['then'](handleEntityNotFound(_0x5772d6,null))['then'](saveUpdates(_0x41ea24[_0x0184('0x4a')],null))['then'](respondWithResult(_0x5772d6,null))[_0x0184('0x52')](handleError(_0x5772d6,null));};exports[_0x0184('0x27')]=function(_0xd0322f,_0x4a08ae){return db[_0x0184('0x44')][_0x0184('0x48')]({'where':{'id':_0xd0322f[_0x0184('0x59')]['id']}})['then'](handleEntityNotFound(_0x4a08ae,null))['then'](removeEntity(_0x4a08ae,null))['catch'](handleError(_0x4a08ae,null));};function widgetAttributes(_0x35925d){try{switch(_0x35925d[_0x0184('0x30')]){case'iframe':return[{'name':_0x0184('0x5a'),'value':_0x35925d['attrUrl']||(_0x35925d[_0x0184('0x5b')]&&_0x35925d[_0x0184('0x5b')][0x0]?_0x35925d[_0x0184('0x5b')][0x0][_0x0184('0x5c')]:undefined)||_0x0184('0x5d')}];case _0x0184('0x5e'):return[{'name':_0x0184('0x5f'),'value':_0x35925d[_0x0184('0x5f')]||(_0x35925d[_0x0184('0x5b')]&&_0x35925d[_0x0184('0x5b')][0x0]?_0x35925d['attrs'][0x0][_0x0184('0x5c')]:undefined)||''}];case _0x0184('0x60'):return[{'name':'attrHourFormat','value':_0x35925d[_0x0184('0x61')]||(_0x35925d[_0x0184('0x5b')]&&_0x35925d[_0x0184('0x5b')][0x0]?_0x35925d[_0x0184('0x5b')][0x0][_0x0184('0x5c')]:undefined)||_0x0184('0x62')},{'name':_0x0184('0x63'),'value':_0x35925d[_0x0184('0x63')]||(_0x35925d[_0x0184('0x5b')]&&_0x35925d[_0x0184('0x5b')][0x1]?_0x35925d[_0x0184('0x5b')][0x1][_0x0184('0x5c')]:undefined)||'0.00'},{'name':_0x0184('0x64'),'value':_0x35925d[_0x0184('0x64')]||(_0x35925d[_0x0184('0x5b')]&&_0x35925d['attrs'][0x2]?_0x35925d[_0x0184('0x5b')][0x2][_0x0184('0x5c')]:undefined)||0xc}];case'counter':return[{'name':_0x0184('0x65'),'value':_0x35925d[_0x0184('0x65')]||(_0x35925d[_0x0184('0x5b')]&&_0x35925d[_0x0184('0x5b')][0x0]?_0x35925d[_0x0184('0x5b')][0x0][_0x0184('0x5c')]:undefined)||_0x0184('0x66')},{'name':_0x0184('0x67'),'value':_0x35925d['attrVoiceQueues']||(_0x35925d[_0x0184('0x5b')]&&_0x35925d['attrs'][0x1]?_0x35925d['attrs'][0x1]['value']:undefined)||[]},{'name':_0x0184('0x64'),'value':_0x35925d['attrFontSize']||(_0x35925d[_0x0184('0x5b')]&&_0x35925d['attrs'][0x2]?_0x35925d[_0x0184('0x5b')][0x2][_0x0184('0x5c')]:undefined)||0x14}];case _0x0184('0x68'):case _0x0184('0x69'):return[{'name':'attrSerie1','value':_0x35925d[_0x0184('0x6a')]||(_0x35925d[_0x0184('0x5b')]&&_0x35925d[_0x0184('0x5b')][0x0]?_0x35925d[_0x0184('0x5b')][0x0][_0x0184('0x5c')]:undefined)||_0x0184('0x66')},{'name':'attrSerie2','value':_0x35925d['attrSerie2']||(_0x35925d[_0x0184('0x5b')]&&_0x35925d['attrs'][0x1]?_0x35925d[_0x0184('0x5b')][0x1][_0x0184('0x5c')]:undefined)||null},{'name':'attrSerie3','value':_0x35925d[_0x0184('0x6b')]||(_0x35925d[_0x0184('0x5b')]&&_0x35925d['attrs'][0x2]?_0x35925d[_0x0184('0x5b')][0x2][_0x0184('0x5c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x35925d[_0x0184('0x67')]||(_0x35925d['attrs']&&_0x35925d[_0x0184('0x5b')][0x3]?_0x35925d[_0x0184('0x5b')][0x3][_0x0184('0x5c')]:undefined)||[]}];case _0x0184('0x6c'):return[{'name':_0x0184('0x6d'),'type':_0x35925d['reportType']||(_0x35925d[_0x0184('0x5b')]&&_0x35925d[_0x0184('0x5b')][0x0]?_0x35925d[_0x0184('0x5b')][0x0][_0x0184('0x30')]:undefined)||null,'value':_0x35925d[_0x0184('0x6d')]||(_0x35925d['attrs']&&_0x35925d[_0x0184('0x5b')][0x0]?_0x35925d['attrs'][0x0][_0x0184('0x5c')]:undefined)||null},{'name':_0x0184('0x6e'),'value':_0x35925d[_0x0184('0x6e')]||(_0x35925d[_0x0184('0x5b')]&&_0x35925d[_0x0184('0x5b')][0x1]?_0x35925d['attrs'][0x1][_0x0184('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x2bc80c){logger[_0x0184('0x2c')]('widgetAttributes:\x20%s',JSON[_0x0184('0x6f')](_0x2bc80c));return[];}}exports[_0x0184('0x70')]=function(_0x563cd4,_0x432072,_0x2c4579){if(_0x563cd4[_0x0184('0x4a')]['id']){delete _0x563cd4['body']['id'];}return db[_0x0184('0x44')][_0x0184('0x48')]({'where':{'id':_0x563cd4[_0x0184('0x59')]['id']}})[_0x0184('0x28')](handleEntityNotFound(_0x432072,null))['then'](function(_0x1d9faa){if(_0x1d9faa){_0x563cd4[_0x0184('0x4a')]['DashboardId']=_0x1d9faa['id'];_0x563cd4['body'][_0x0184('0x5b')]=widgetAttributes(_0x563cd4[_0x0184('0x4a')]);return db[_0x0184('0x71')][_0x0184('0x49')](_0x563cd4['body']);}})[_0x0184('0x28')](respondWithResult(_0x432072,null))[_0x0184('0x52')](handleError(_0x432072,null));};exports[_0x0184('0x72')]=function(_0x14687c,_0x2714e3,_0x2f94f3){var _0xcc6923={};var _0x507747={};var _0x20fb9d;var _0x431e83;return db[_0x0184('0x44')][_0x0184('0x73')]({'where':{'id':_0x14687c['params']['id']}})['then'](handleEntityNotFound(_0x2714e3,null))[_0x0184('0x28')](function(_0x4a3cf4){if(_0x4a3cf4){_0x20fb9d=_0x4a3cf4;_0x507747['model']=_['keys'](db[_0x0184('0x71')][_0x0184('0x2f')]);_0x507747[_0x0184('0x34')]=_[_0x0184('0x35')](_0x14687c[_0x0184('0x34')]);_0x507747['filters']=_['intersection'](_0x507747['model'],_0x507747[_0x0184('0x34')]);_0xcc6923[_0x0184('0x37')]=_[_0x0184('0x36')](_0x507747[_0x0184('0x32')],qs[_0x0184('0x38')](_0x14687c[_0x0184('0x34')][_0x0184('0x38')]));_0xcc6923[_0x0184('0x37')]=_0xcc6923[_0x0184('0x37')][_0x0184('0x39')]?_0xcc6923[_0x0184('0x37')]:_0x507747[_0x0184('0x32')];_0xcc6923[_0x0184('0x3b')]=qs['sort'](_0x14687c['query'][_0x0184('0x3c')]);_0xcc6923[_0x0184('0x3d')]=qs['filters'](_['pick'](_0x14687c[_0x0184('0x34')],_0x507747['filters']));if(_0x14687c[_0x0184('0x34')][_0x0184('0x41')]){_0xcc6923[_0x0184('0x3d')]=_[_0x0184('0x42')](_0xcc6923[_0x0184('0x3d')],{'$or':_[_0x0184('0x33')](_0xcc6923[_0x0184('0x37')],function(_0x5d7fa7){var _0x124d31={};_0x124d31[_0x5d7fa7]={'$like':'%'+_0x14687c[_0x0184('0x34')]['filter']+'%'};return _0x124d31;})});}_0xcc6923=_[_0x0184('0x42')]({},_0xcc6923,_0x14687c[_0x0184('0x43')]);return _0x20fb9d[_0x0184('0x72')](_0xcc6923);}})[_0x0184('0x28')](function(_0x4e276b){if(_0x4e276b){_0x431e83=_0x4e276b['length'];if(!_0x14687c[_0x0184('0x34')]['hasOwnProperty'](_0x0184('0x3a'))){_0xcc6923[_0x0184('0x1f')]=qs['limit'](_0x14687c['query'][_0x0184('0x1f')]);_0xcc6923[_0x0184('0x1e')]=qs[_0x0184('0x1e')](_0x14687c[_0x0184('0x34')][_0x0184('0x1e')]);}return _0x20fb9d[_0x0184('0x72')](_0xcc6923);}})[_0x0184('0x28')](function(_0xd81298){if(_0xd81298){return _0xd81298?{'count':_0x431e83,'rows':_0xd81298}:null;}})['then'](respondWithResult(_0x2714e3,null))[_0x0184('0x52')](handleError(_0x2714e3,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1c76274..728c942 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 _0xa91f=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x4f1999,_0x1fa4ce){var _0x22323f=function(_0x380f8d){while(--_0x380f8d){_0x4f1999['push'](_0x4f1999['shift']());}};_0x22323f(++_0x1fa4ce);}(_0xa91f,0x128));var _0xfa91=function(_0x128c7e,_0xcbdf6a){_0x128c7e=_0x128c7e-0x0;var _0x28681c=_0xa91f[_0x128c7e];return _0x28681c;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xfa91('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xfa91('0x1')](0x0);var events={'afterCreate':_0xfa91('0x2'),'afterUpdate':'update','afterDestroy':_0xfa91('0x3')};function emitEvent(_0x2cfd70){return function(_0x4f060b,_0x3de506,_0x433b44){DashboardEvents[_0xfa91('0x4')](_0x2cfd70+':'+_0x4f060b['id'],_0x4f060b);DashboardEvents[_0xfa91('0x4')](_0x2cfd70,_0x4f060b);_0x433b44(null);};}for(var e in events){if(events[_0xfa91('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xfa91('0x6')]=DashboardEvents; \ No newline at end of file +var _0xa765=['exports','../../mysqldb','Dashboard','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x415ff1,_0x909513){var _0x503443=function(_0x28c70c){while(--_0x28c70c){_0x415ff1['push'](_0x415ff1['shift']());}};_0x503443(++_0x909513);}(_0xa765,0x169));var _0x5a76=function(_0x2536dc,_0x3a1eaa){_0x2536dc=_0x2536dc-0x0;var _0x533d30=_0xa765[_0x2536dc];return _0x533d30;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x5a76('0x0'))['db'][_0x5a76('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5a76('0x2')](0x0);var events={'afterCreate':_0x5a76('0x3'),'afterUpdate':_0x5a76('0x4'),'afterDestroy':'remove'};function emitEvent(_0x41573d){return function(_0x1eb471,_0xe1585c,_0x1ea681){DashboardEvents[_0x5a76('0x5')](_0x41573d+':'+_0x1eb471['id'],_0x1eb471);DashboardEvents[_0x5a76('0x5')](_0x41573d,_0x1eb471);_0x1ea681(null);};}for(var e in events){if(events[_0x5a76('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x5a76('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 b711169..e9ecb32 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 _0x496a=['moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','api'];(function(_0x2d46b0,_0x2e28d1){var _0x34910b=function(_0xa90418){while(--_0xa90418){_0x2d46b0['push'](_0x2d46b0['shift']());}};_0x34910b(++_0x2e28d1);}(_0x496a,0x8c));var _0xa496=function(_0x38d93c,_0x379b1b){_0x38d93c=_0x38d93c-0x0;var _0x2d3449=_0x496a[_0x38d93c];return _0x2d3449;};'use strict';var _=require(_0xa496('0x0'));var util=require(_0xa496('0x1'));var logger=require('../../config/logger')(_0xa496('0x2'));var moment=require(_0xa496('0x3'));var BPromise=require(_0xa496('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa496('0x5'));var rimraf=require(_0xa496('0x6'));var config=require(_0xa496('0x7'));var attributes=require(_0xa496('0x8'));module[_0xa496('0x9')]=function(_0x5afd18,_0x25312a){return _0x5afd18[_0xa496('0xa')](_0xa496('0xb'),attributes,{'tableName':_0xa496('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85c1=['Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x85c1,0x152));var _0x185c=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x85c1[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x185c('0x0'));var util=require(_0x185c('0x1'));var logger=require(_0x185c('0x2'))('api');var moment=require(_0x185c('0x3'));var BPromise=require(_0x185c('0x4'));var rp=require(_0x185c('0x5'));var fs=require('fs');var path=require(_0x185c('0x6'));var rimraf=require(_0x185c('0x7'));var config=require(_0x185c('0x8'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x49bc06,_0x2b26b7){return _0x49bc06[_0x185c('0x9')](_0x185c('0xa'),attributes,{'tableName':_0x185c('0xb'),'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 72a396a..75998bd 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 _0x563f=['code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error'];(function(_0x256a80,_0xfbf882){var _0x931887=function(_0x155ecb){while(--_0x155ecb){_0x256a80['push'](_0x256a80['shift']());}};_0x931887(++_0xfbf882);}(_0x563f,0x1cf));var _0xf563=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x563f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf563('0x0'));var BPromise=require(_0xf563('0x1'));var rs=require(_0xf563('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf563('0x3'))['db'];var utils=require(_0xf563('0x4'));var logger=require(_0xf563('0x5'))(_0xf563('0x6'));var config=require(_0xf563('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf563('0x8')][_0xf563('0x9')]({'port':0x232a});config[_0xf563('0xa')]=_[_0xf563('0xb')](config[_0xf563('0xa')],{'host':_0xf563('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf563('0xa')]));require(_0xf563('0xd'))[_0xf563('0xe')](socket);function respondWithRpcPromise(_0x2ee5de,_0x5bf566,_0x5d4792){return new BPromise(function(_0x433926,_0x85e697){return client[_0xf563('0xf')](_0x2ee5de,_0x5d4792)[_0xf563('0x10')](function(_0x11ecbb){logger[_0xf563('0x11')](_0xf563('0x12'),_0x5bf566,_0xf563('0x13'));logger[_0xf563('0x14')](_0xf563('0x15'),_0x5bf566,_0xf563('0x13'),JSON['stringify'](_0x11ecbb));if(_0x11ecbb['error']){if(_0x11ecbb[_0xf563('0x16')][_0xf563('0x17')]===0x1f4){logger['error'](_0xf563('0x12'),_0x5bf566,_0x11ecbb[_0xf563('0x16')][_0xf563('0x18')]);return _0x85e697(_0x11ecbb[_0xf563('0x16')][_0xf563('0x18')]);}logger[_0xf563('0x16')](_0xf563('0x12'),_0x5bf566,_0x11ecbb['error']['message']);return _0x433926(_0x11ecbb[_0xf563('0x16')][_0xf563('0x18')]);}else{logger[_0xf563('0x11')]('Dashboard,\x20%s,\x20%s',_0x5bf566,_0xf563('0x13'));_0x433926(_0x11ecbb[_0xf563('0x19')][_0xf563('0x18')]);}})[_0xf563('0x1a')](function(_0x21ce0e){logger['error']('Dashboard,\x20%s,\x20%s',_0x5bf566,_0x21ce0e);_0x85e697(_0x21ce0e);});});} \ No newline at end of file +var _0xf8ca=['../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','randomstring','../../mysqldb'];(function(_0x1adf76,_0x828c70){var _0x3ca9ec=function(_0x1aeb0e){while(--_0x1aeb0e){_0x1adf76['push'](_0x1adf76['shift']());}};_0x3ca9ec(++_0x828c70);}(_0xf8ca,0x173));var _0xaf8c=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xf8ca[_0x20589d];return _0x422de9;};'use strict';var _=require(_0xaf8c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaf8c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf8c('0x2'))['db'];var utils=require(_0xaf8c('0x3'));var logger=require('../../config/logger')(_0xaf8c('0x4'));var config=require('../../config/environment');var jayson=require(_0xaf8c('0x5'));var client=jayson[_0xaf8c('0x6')]['http']({'port':0x232a});config[_0xaf8c('0x7')]=_[_0xaf8c('0x8')](config[_0xaf8c('0x7')],{'host':_0xaf8c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf8c('0x7')]));require('./dashboard.socket')[_0xaf8c('0xa')](socket);function respondWithRpcPromise(_0x45f5b4,_0x57dbae,_0x40ff8a){return new BPromise(function(_0x3d8a57,_0x3cdf07){return client[_0xaf8c('0xb')](_0x45f5b4,_0x40ff8a)[_0xaf8c('0xc')](function(_0x43849b){logger[_0xaf8c('0xd')](_0xaf8c('0xe'),_0x57dbae,_0xaf8c('0xf'));logger[_0xaf8c('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x57dbae,_0xaf8c('0xf'),JSON[_0xaf8c('0x11')](_0x43849b));if(_0x43849b[_0xaf8c('0x12')]){if(_0x43849b['error']['code']===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x57dbae,_0x43849b[_0xaf8c('0x12')][_0xaf8c('0x13')]);return _0x3cdf07(_0x43849b[_0xaf8c('0x12')]['message']);}logger[_0xaf8c('0x12')](_0xaf8c('0xe'),_0x57dbae,_0x43849b['error']['message']);return _0x3d8a57(_0x43849b[_0xaf8c('0x12')]['message']);}else{logger[_0xaf8c('0xd')](_0xaf8c('0xe'),_0x57dbae,_0xaf8c('0xf'));_0x3d8a57(_0x43849b[_0xaf8c('0x14')][_0xaf8c('0x13')]);}})[_0xaf8c('0x15')](function(_0x38503f){logger[_0xaf8c('0x12')](_0xaf8c('0xe'),_0x57dbae,_0x38503f);_0x3cdf07(_0x38503f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index fbea4b1..1b02b72 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 _0x2416=['dashboard:','./dashboard.events','save','remove','emit','length'];(function(_0x3ccc20,_0x1ea690){var _0x4fbb0d=function(_0x5d4d9a){while(--_0x5d4d9a){_0x3ccc20['push'](_0x3ccc20['shift']());}};_0x4fbb0d(++_0x1ea690);}(_0x2416,0xf1));var _0x6241=function(_0x41e3b3,_0x2fcd48){_0x41e3b3=_0x41e3b3-0x0;var _0x39f664=_0x2416[_0x41e3b3];return _0x39f664;};'use strict';var DashboardEvents=require(_0x6241('0x0'));var events=[_0x6241('0x1'),_0x6241('0x2'),'update'];function createListener(_0x5e4b32,_0x2bff71){return function(_0x19923f){_0x2bff71[_0x6241('0x3')](_0x5e4b32,_0x19923f);};}function removeListener(_0x318e36,_0x4699bf){return function(){DashboardEvents['removeListener'](_0x318e36,_0x4699bf);};}exports['register']=function(_0x711f59){for(var _0x308f36=0x0,_0x528263=events[_0x6241('0x4')];_0x308f36<_0x528263;_0x308f36++){var _0x41e60d=events[_0x308f36];var _0x56f0d6=createListener(_0x6241('0x5')+_0x41e60d,_0x711f59);DashboardEvents['on'](_0x41e60d,_0x56f0d6);}}; \ No newline at end of file +var _0x039a=['emit','register','dashboard:','./dashboard.events','remove','update'];(function(_0xfaf5f,_0x27737a){var _0x2adfe4=function(_0x191307){while(--_0x191307){_0xfaf5f['push'](_0xfaf5f['shift']());}};_0x2adfe4(++_0x27737a);}(_0x039a,0xbd));var _0xa039=function(_0x7a84f2,_0x1e1e67){_0x7a84f2=_0x7a84f2-0x0;var _0x2822f0=_0x039a[_0x7a84f2];return _0x2822f0;};'use strict';var DashboardEvents=require(_0xa039('0x0'));var events=['save',_0xa039('0x1'),_0xa039('0x2')];function createListener(_0x161fa1,_0x46e2ff){return function(_0x1912fb){_0x46e2ff[_0xa039('0x3')](_0x161fa1,_0x1912fb);};}function removeListener(_0x4ab4fb,_0x1e4021){return function(){DashboardEvents['removeListener'](_0x4ab4fb,_0x1e4021);};}exports[_0xa039('0x4')]=function(_0x30c3d9){for(var _0x13fe55=0x0,_0xd3e50c=events['length'];_0x13fe55<_0xd3e50c;_0x13fe55++){var _0x23566f=events[_0x13fe55];var _0x3fc5cf=createListener(_0xa039('0x5')+_0x23566f,_0x30c3d9);DashboardEvents['on'](_0x23566f,_0x3fc5cf);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b5462f1..f3ac724 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 _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x253bea,_0x32f64c){var _0x20c1fd=function(_0x3df492){while(--_0x3df492){_0x253bea['push'](_0x253bea['shift']());}};_0x20c1fd(++_0x32f64c);}(_0x70e0,0x17b));var _0x070e=function(_0xc851c2,_0x4d3e7b){_0xc851c2=_0xc851c2-0x0;var _0x52fb66=_0x70e0[_0xc851c2];return _0x52fb66;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x3fbcb8,_0x2d576d){var _0x5dbcb8=function(_0x299917){while(--_0x299917){_0x3fbcb8['push'](_0x3fbcb8['shift']());}};_0x5dbcb8(++_0x2d576d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index cd7bb31..ede9442 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 _0xdc2c=['setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','lodash','STRING','long','parse','getDataValue','attrs'];(function(_0x431f26,_0x414bb4){var _0x27a623=function(_0x3b1e88){while(--_0x3b1e88){_0x431f26['push'](_0x431f26['shift']());}};_0x27a623(++_0x414bb4);}(_0xdc2c,0xd0));var _0xcdc2=function(_0x11fc92,_0x4b1a76){_0x11fc92=_0x11fc92-0x0;var _0xc7373f=_0xdc2c[_0x11fc92];return _0xc7373f;};'use strict';var Sequelize=require(_0xcdc2('0x0'));var squel=require(_0xcdc2('0x1'));var _=require(_0xcdc2('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xcdc2('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xcdc2('0x4')),'get':function(){try{return JSON[_0xcdc2('0x5')](this[_0xcdc2('0x6')](_0xcdc2('0x7')));}catch(_0x1eff6a){return[];}},'set':function(_0x53ffe4){try{this[_0xcdc2('0x8')](_0xcdc2('0x7'),JSON[_0xcdc2('0x9')](_0x53ffe4));}catch(_0x39366f){this[_0xcdc2('0x8')](_0xcdc2('0x7'),JSON[_0xcdc2('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xcdc2('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xcdc2('0x3')],'allowNull':![],'defaultValue':_0xcdc2('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5479=['setDataValue','stringify','INTEGER','STRING','#2196f3','sequelize','squel','exports','TEXT','parse','getDataValue','attrs'];(function(_0x4e09e6,_0x19d4bb){var _0x2cf1d2=function(_0x1c1be9){while(--_0x1c1be9){_0x4e09e6['push'](_0x4e09e6['shift']());}};_0x2cf1d2(++_0x19d4bb);}(_0x5479,0x1f1));var _0x9547=function(_0x22a49b,_0x5050a9){_0x22a49b=_0x22a49b-0x0;var _0x164f34=_0x5479[_0x22a49b];return _0x164f34;};'use strict';var Sequelize=require(_0x9547('0x0'));var squel=require(_0x9547('0x1'));var _=require('lodash');module[_0x9547('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9547('0x3')]('long'),'get':function(){try{return JSON[_0x9547('0x4')](this[_0x9547('0x5')](_0x9547('0x6')));}catch(_0x347d14){return[];}},'set':function(_0x48dcbf){try{this[_0x9547('0x7')]('attrs',JSON[_0x9547('0x8')](_0x48dcbf));}catch(_0x901c65){this['setDataValue'](_0x9547('0x6'),JSON[_0x9547('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x9547('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9547('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9547('0x9')]},'background':{'type':Sequelize[_0x9547('0xa')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9547('0xa')],'allowNull':![],'defaultValue':_0x9547('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 00b1467..638e5db 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 _0x8ee8=['0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./dashboardItem.socket','status','end','json','count','offset','limit','apply','reject','save','destroy','sendStatus','error','name','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','then','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x8ee8,0x1c2));var _0x88ee=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x8ee8[_0x2d91c6];return _0x3a8d19;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x88ee('0x0'));var zipdir=require(_0x88ee('0x1'));var jsonpatch=require(_0x88ee('0x2'));var rp=require(_0x88ee('0x3'));var moment=require(_0x88ee('0x4'));var BPromise=require(_0x88ee('0x5'));var Mustache=require(_0x88ee('0x6'));var util=require('util');var path=require('path');var sox=require(_0x88ee('0x7'));var csv=require(_0x88ee('0x8'));var ejs=require(_0x88ee('0x9'));var fs=require('fs');var _=require(_0x88ee('0xa'));var squel=require('squel');var crypto=require(_0x88ee('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x88ee('0xc'));var toCsv=require(_0x88ee('0x8'));var querystring=require(_0x88ee('0xd'));var Papa=require(_0x88ee('0xe'));var Redis=require(_0x88ee('0xf'));var authService=require(_0x88ee('0x10'));var qs=require(_0x88ee('0x11'));var as=require(_0x88ee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88ee('0x13'))('api');var utils=require(_0x88ee('0x14'));var config=require(_0x88ee('0x15'));var db=require(_0x88ee('0x16'))['db'];config[_0x88ee('0x17')]=_[_0x88ee('0x18')](config[_0x88ee('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x88ee('0x19'))['register'](socket);function respondWithStatusCode(_0x3bc76b,_0x29ef49){_0x29ef49=_0x29ef49||0xcc;return function(_0x231f0f){if(_0x231f0f){return _0x3bc76b['sendStatus'](_0x29ef49);}return _0x3bc76b[_0x88ee('0x1a')](_0x29ef49)[_0x88ee('0x1b')]();};}function respondWithResult(_0x6e74ad,_0x3eea9a){_0x3eea9a=_0x3eea9a||0xc8;return function(_0x5ecc6f){if(_0x5ecc6f){return _0x6e74ad['status'](_0x3eea9a)[_0x88ee('0x1c')](_0x5ecc6f);}};}function respondWithFilteredResult(_0x598287,_0x4b2abb){return function(_0x38e58f){if(_0x38e58f){var _0x4ab4cc=_0x38e58f[_0x88ee('0x1d')],_0x2381b4=_0x4b2abb[_0x88ee('0x1e')],_0xe605df=_0x4b2abb[_0x88ee('0x1e')]+_0x4b2abb[_0x88ee('0x1f')],_0x17f45a;if(_0xe605df>=_0x4ab4cc){_0xe605df=_0x4ab4cc;_0x17f45a=0xc8;}else{_0x17f45a=0xce;}_0x598287[_0x88ee('0x1a')](_0x17f45a);return _0x598287['set']('Content-Range',_0x2381b4+'-'+_0xe605df+'/'+_0x4ab4cc)[_0x88ee('0x1c')](_0x38e58f);}return null;};}function patchUpdates(_0xd884d3){return function(_0x3cb7d0){try{jsonpatch[_0x88ee('0x20')](_0x3cb7d0,_0xd884d3,!![]);}catch(_0xdb5c59){return BPromise[_0x88ee('0x21')](_0xdb5c59);}return _0x3cb7d0[_0x88ee('0x22')]();};}function saveUpdates(_0x6c13d8,_0x458288){return function(_0x506f0a){if(_0x506f0a){return _0x506f0a['update'](_0x6c13d8)['then'](function(_0x1262ff){return _0x1262ff;});}return null;};}function removeEntity(_0x1d1fbc,_0x28299a){return function(_0x384eda){if(_0x384eda){return _0x384eda[_0x88ee('0x23')]()['then'](function(){_0x1d1fbc[_0x88ee('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d89ba,_0x5b0622){return function(_0x3d75f0){if(!_0x3d75f0){_0x4d89ba[_0x88ee('0x24')](0x194);}return _0x3d75f0;};}function handleError(_0x381beb,_0x8295d2){_0x8295d2=_0x8295d2||0x1f4;return function(_0x1ae8b8){logger[_0x88ee('0x25')](_0x1ae8b8['stack']);if(_0x1ae8b8['name']){delete _0x1ae8b8[_0x88ee('0x26')];}_0x381beb[_0x88ee('0x1a')](_0x8295d2)['send'](_0x1ae8b8);};}exports['show']=function(_0x590a9f,_0x16bafa){var _0x303ac7={'raw':![],'where':{'id':_0x590a9f[_0x88ee('0x27')]['id']}},_0x39cf50={};_0x39cf50[_0x88ee('0x28')]=_[_0x88ee('0x29')](db[_0x88ee('0x2a')][_0x88ee('0x2b')]);_0x39cf50[_0x88ee('0x2c')]=_[_0x88ee('0x29')](_0x590a9f[_0x88ee('0x2c')]);_0x39cf50[_0x88ee('0x2d')]=_[_0x88ee('0x2e')](_0x39cf50['model'],_0x39cf50['query']);_0x303ac7['attributes']=_[_0x88ee('0x2e')](_0x39cf50[_0x88ee('0x28')],qs[_0x88ee('0x2f')](_0x590a9f['query']['fields']));_0x303ac7[_0x88ee('0x30')]=_0x303ac7[_0x88ee('0x30')]['length']?_0x303ac7[_0x88ee('0x30')]:_0x39cf50['model'];if(_0x590a9f['query'][_0x88ee('0x31')]){_0x303ac7[_0x88ee('0x32')]=[{'all':!![]}];}_0x303ac7=_[_0x88ee('0x33')]({},_0x303ac7,_0x590a9f[_0x88ee('0x34')]);return db[_0x88ee('0x2a')][_0x88ee('0x35')](_0x303ac7)[_0x88ee('0x36')](handleEntityNotFound(_0x16bafa,null))[_0x88ee('0x36')](respondWithResult(_0x16bafa,null))[_0x88ee('0x37')](handleError(_0x16bafa,null));};exports[_0x88ee('0x23')]=function(_0x4dda76,_0x1f9c24){return db[_0x88ee('0x2a')][_0x88ee('0x35')]({'where':{'id':_0x4dda76['params']['id']}})[_0x88ee('0x36')](handleEntityNotFound(_0x1f9c24,null))['then'](removeEntity(_0x1f9c24,null))[_0x88ee('0x37')](handleError(_0x1f9c24,null));};function widgetAttributes(_0x5567da){try{switch(_0x5567da[_0x88ee('0x38')]){case _0x88ee('0x39'):return[{'name':'attrUrl','value':_0x5567da[_0x88ee('0x3a')]||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da['attrs'][0x0]?_0x5567da[_0x88ee('0x3b')][0x0][_0x88ee('0x3c')]:undefined)||'https://'}];case _0x88ee('0x3d'):return[{'name':_0x88ee('0x3e'),'value':_0x5567da[_0x88ee('0x3e')]||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da[_0x88ee('0x3b')][0x0]?_0x5567da[_0x88ee('0x3b')][0x0][_0x88ee('0x3c')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x5567da[_0x88ee('0x3f')]||(_0x5567da['attrs']&&_0x5567da[_0x88ee('0x3b')][0x0]?_0x5567da[_0x88ee('0x3b')][0x0][_0x88ee('0x3c')]:undefined)||_0x88ee('0x40')},{'name':_0x88ee('0x41'),'value':_0x5567da[_0x88ee('0x41')]||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da[_0x88ee('0x3b')][0x1]?_0x5567da[_0x88ee('0x3b')][0x1][_0x88ee('0x3c')]:undefined)||_0x88ee('0x42')},{'name':_0x88ee('0x43'),'value':_0x5567da[_0x88ee('0x43')]||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da[_0x88ee('0x3b')][0x2]?_0x5567da[_0x88ee('0x3b')][0x2][_0x88ee('0x3c')]:undefined)||0xc}];case _0x88ee('0x44'):return[{'name':'attrMetric','value':_0x5567da[_0x88ee('0x45')]||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da['attrs'][0x0]?_0x5567da[_0x88ee('0x3b')][0x0][_0x88ee('0x3c')]:undefined)||_0x88ee('0x46')},{'name':_0x88ee('0x47'),'value':_0x5567da[_0x88ee('0x47')]||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da[_0x88ee('0x3b')][0x1]?_0x5567da[_0x88ee('0x3b')][0x1]['value']:undefined)||[]},{'name':_0x88ee('0x43'),'value':_0x5567da[_0x88ee('0x43')]||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da[_0x88ee('0x3b')][0x2]?_0x5567da[_0x88ee('0x3b')][0x2]['value']:undefined)||0x14}];case _0x88ee('0x48'):case _0x88ee('0x49'):return[{'name':_0x88ee('0x4a'),'value':_0x5567da['attrSerie1']||(_0x5567da['attrs']&&_0x5567da['attrs'][0x0]?_0x5567da[_0x88ee('0x3b')][0x0][_0x88ee('0x3c')]:undefined)||_0x88ee('0x46')},{'name':_0x88ee('0x4b'),'value':_0x5567da['attrSerie2']||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da[_0x88ee('0x3b')][0x1]?_0x5567da[_0x88ee('0x3b')][0x1][_0x88ee('0x3c')]:undefined)||null},{'name':_0x88ee('0x4c'),'value':_0x5567da[_0x88ee('0x4c')]||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da[_0x88ee('0x3b')][0x2]?_0x5567da[_0x88ee('0x3b')][0x2][_0x88ee('0x3c')]:undefined)||null},{'name':_0x88ee('0x47'),'value':_0x5567da['attrVoiceQueues']||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da[_0x88ee('0x3b')][0x3]?_0x5567da[_0x88ee('0x3b')][0x3]['value']:undefined)||[]}];case _0x88ee('0x4d'):return[{'name':'attrReport','type':_0x5567da[_0x88ee('0x4e')]||(_0x5567da['attrs']&&_0x5567da[_0x88ee('0x3b')][0x0]?_0x5567da['attrs'][0x0][_0x88ee('0x38')]:undefined)||null,'value':_0x5567da[_0x88ee('0x4f')]||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da[_0x88ee('0x3b')][0x0]?_0x5567da[_0x88ee('0x3b')][0x0][_0x88ee('0x3c')]:undefined)||null},{'name':_0x88ee('0x50'),'value':_0x5567da[_0x88ee('0x50')]||(_0x5567da[_0x88ee('0x3b')]&&_0x5567da[_0x88ee('0x3b')][0x1]?_0x5567da[_0x88ee('0x3b')][0x1][_0x88ee('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x360bf4){logger[_0x88ee('0x25')](_0x88ee('0x51'),JSON[_0x88ee('0x52')](_0x360bf4));return[];}}exports[_0x88ee('0x53')]=function(_0x463f08,_0x353e11){if(_0x463f08[_0x88ee('0x54')]){_0x463f08[_0x88ee('0x54')][_0x88ee('0x3b')]=widgetAttributes(_0x463f08[_0x88ee('0x54')]);}return db['DashboardItem'][_0x88ee('0x53')](_0x463f08[_0x88ee('0x54')],{})[_0x88ee('0x36')](respondWithResult(_0x353e11,0xc9))[_0x88ee('0x37')](handleError(_0x353e11,null));};exports[_0x88ee('0x55')]=function(_0x2df035,_0x382a7c){if(_0x2df035[_0x88ee('0x54')]['id']){delete _0x2df035[_0x88ee('0x54')]['id'];}_0x2df035['body'][_0x88ee('0x3b')]=widgetAttributes(_0x2df035[_0x88ee('0x54')]);return db[_0x88ee('0x2a')][_0x88ee('0x35')]({'where':{'id':_0x2df035[_0x88ee('0x27')]['id']}})[_0x88ee('0x36')](handleEntityNotFound(_0x382a7c,null))['then'](saveUpdates(_0x2df035[_0x88ee('0x54')],null))[_0x88ee('0x36')](respondWithResult(_0x382a7c,null))[_0x88ee('0x37')](handleError(_0x382a7c,null));}; \ No newline at end of file +var _0x4515=['attrVoiceQueues','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','offset','limit','set','json','apply','reject','update','destroy','then','error','name','send','params','model','keys','DashboardItem','rawAttributes','filters','intersection','query','attributes','fields','length','include','options','find','catch','type','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric'];(function(_0x28e7a2,_0x50b664){var _0x40b1a9=function(_0x2fb44a){while(--_0x2fb44a){_0x28e7a2['push'](_0x28e7a2['shift']());}};_0x40b1a9(++_0x50b664);}(_0x4515,0x19b));var _0x5451=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4515[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5451('0x0'));var rimraf=require(_0x5451('0x1'));var zipdir=require(_0x5451('0x2'));var jsonpatch=require(_0x5451('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5451('0x4'));var util=require(_0x5451('0x5'));var path=require(_0x5451('0x6'));var sox=require(_0x5451('0x7'));var csv=require(_0x5451('0x8'));var ejs=require(_0x5451('0x9'));var fs=require('fs');var _=require(_0x5451('0xa'));var squel=require(_0x5451('0xb'));var crypto=require(_0x5451('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5451('0x8'));var querystring=require('querystring');var Papa=require(_0x5451('0xd'));var Redis=require(_0x5451('0xe'));var authService=require(_0x5451('0xf'));var qs=require(_0x5451('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5451('0x11'))('api');var utils=require(_0x5451('0x12'));var config=require(_0x5451('0x13'));var db=require('../../mysqldb')['db'];config[_0x5451('0x14')]=_[_0x5451('0x15')](config[_0x5451('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x5451('0x16'))(new Redis(config[_0x5451('0x14')]));require(_0x5451('0x17'))[_0x5451('0x18')](socket);function respondWithStatusCode(_0xfb51c1,_0x54320e){_0x54320e=_0x54320e||0xcc;return function(_0x18deb6){if(_0x18deb6){return _0xfb51c1[_0x5451('0x19')](_0x54320e);}return _0xfb51c1['status'](_0x54320e)[_0x5451('0x1a')]();};}function respondWithResult(_0x3283f3,_0x3ee679){_0x3ee679=_0x3ee679||0xc8;return function(_0xcaeede){if(_0xcaeede){return _0x3283f3[_0x5451('0x1b')](_0x3ee679)['json'](_0xcaeede);}};}function respondWithFilteredResult(_0x4b0283,_0x19e0e0){return function(_0x4fa83b){if(_0x4fa83b){var _0x171b75=_0x4fa83b['count'],_0x484720=_0x19e0e0[_0x5451('0x1c')],_0x344906=_0x19e0e0[_0x5451('0x1c')]+_0x19e0e0[_0x5451('0x1d')],_0x1a0628;if(_0x344906>=_0x171b75){_0x344906=_0x171b75;_0x1a0628=0xc8;}else{_0x1a0628=0xce;}_0x4b0283[_0x5451('0x1b')](_0x1a0628);return _0x4b0283[_0x5451('0x1e')]('Content-Range',_0x484720+'-'+_0x344906+'/'+_0x171b75)[_0x5451('0x1f')](_0x4fa83b);}return null;};}function patchUpdates(_0x51b2a6){return function(_0x3daa90){try{jsonpatch[_0x5451('0x20')](_0x3daa90,_0x51b2a6,!![]);}catch(_0xd17453){return BPromise[_0x5451('0x21')](_0xd17453);}return _0x3daa90['save']();};}function saveUpdates(_0x14bf5c,_0x51ba92){return function(_0x4f2121){if(_0x4f2121){return _0x4f2121[_0x5451('0x22')](_0x14bf5c)['then'](function(_0x3ee749){return _0x3ee749;});}return null;};}function removeEntity(_0x3c2cf9,_0x37e01e){return function(_0x5c3896){if(_0x5c3896){return _0x5c3896[_0x5451('0x23')]()[_0x5451('0x24')](function(){_0x3c2cf9[_0x5451('0x1b')](0xcc)[_0x5451('0x1a')]();});}};}function handleEntityNotFound(_0x244b3a,_0x100718){return function(_0x9edd0b){if(!_0x9edd0b){_0x244b3a['sendStatus'](0x194);}return _0x9edd0b;};}function handleError(_0x253cf5,_0x185b48){_0x185b48=_0x185b48||0x1f4;return function(_0x418e5e){logger[_0x5451('0x25')](_0x418e5e['stack']);if(_0x418e5e['name']){delete _0x418e5e[_0x5451('0x26')];}_0x253cf5[_0x5451('0x1b')](_0x185b48)[_0x5451('0x27')](_0x418e5e);};}exports['show']=function(_0x858a43,_0x48ceed){var _0x3bc157={'raw':![],'where':{'id':_0x858a43[_0x5451('0x28')]['id']}},_0x23bb7a={};_0x23bb7a[_0x5451('0x29')]=_[_0x5451('0x2a')](db[_0x5451('0x2b')][_0x5451('0x2c')]);_0x23bb7a['query']=_[_0x5451('0x2a')](_0x858a43['query']);_0x23bb7a[_0x5451('0x2d')]=_[_0x5451('0x2e')](_0x23bb7a[_0x5451('0x29')],_0x23bb7a[_0x5451('0x2f')]);_0x3bc157[_0x5451('0x30')]=_['intersection'](_0x23bb7a[_0x5451('0x29')],qs[_0x5451('0x31')](_0x858a43[_0x5451('0x2f')][_0x5451('0x31')]));_0x3bc157[_0x5451('0x30')]=_0x3bc157[_0x5451('0x30')][_0x5451('0x32')]?_0x3bc157[_0x5451('0x30')]:_0x23bb7a[_0x5451('0x29')];if(_0x858a43['query']['includeAll']){_0x3bc157[_0x5451('0x33')]=[{'all':!![]}];}_0x3bc157=_['merge']({},_0x3bc157,_0x858a43[_0x5451('0x34')]);return db[_0x5451('0x2b')][_0x5451('0x35')](_0x3bc157)['then'](handleEntityNotFound(_0x48ceed,null))[_0x5451('0x24')](respondWithResult(_0x48ceed,null))[_0x5451('0x36')](handleError(_0x48ceed,null));};exports[_0x5451('0x23')]=function(_0xabe724,_0x1da969){return db['DashboardItem'][_0x5451('0x35')]({'where':{'id':_0xabe724['params']['id']}})[_0x5451('0x24')](handleEntityNotFound(_0x1da969,null))[_0x5451('0x24')](removeEntity(_0x1da969,null))[_0x5451('0x36')](handleError(_0x1da969,null));};function widgetAttributes(_0x5a56d7){try{switch(_0x5a56d7[_0x5451('0x37')]){case'iframe':return[{'name':_0x5451('0x38'),'value':_0x5a56d7[_0x5451('0x38')]||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7[_0x5451('0x39')][0x0]?_0x5a56d7[_0x5451('0x39')][0x0]['value']:undefined)||_0x5451('0x3a')}];case'custom':return[{'name':_0x5451('0x3b'),'value':_0x5a56d7[_0x5451('0x3b')]||(_0x5a56d7['attrs']&&_0x5a56d7[_0x5451('0x39')][0x0]?_0x5a56d7['attrs'][0x0][_0x5451('0x3c')]:undefined)||''}];case _0x5451('0x3d'):return[{'name':'attrHourFormat','value':_0x5a56d7[_0x5451('0x3e')]||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7['attrs'][0x0]?_0x5a56d7[_0x5451('0x39')][0x0][_0x5451('0x3c')]:undefined)||_0x5451('0x3f')},{'name':_0x5451('0x40'),'value':_0x5a56d7['attrTimezone']||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7[_0x5451('0x39')][0x1]?_0x5a56d7['attrs'][0x1]['value']:undefined)||_0x5451('0x41')},{'name':'attrFontSize','value':_0x5a56d7[_0x5451('0x42')]||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7[_0x5451('0x39')][0x2]?_0x5a56d7['attrs'][0x2][_0x5451('0x3c')]:undefined)||0xc}];case _0x5451('0x43'):return[{'name':_0x5451('0x44'),'value':_0x5a56d7['attrMetric']||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7['attrs'][0x0]?_0x5a56d7['attrs'][0x0][_0x5451('0x3c')]:undefined)||'total'},{'name':_0x5451('0x45'),'value':_0x5a56d7[_0x5451('0x45')]||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7[_0x5451('0x39')][0x1]?_0x5a56d7['attrs'][0x1]['value']:undefined)||[]},{'name':_0x5451('0x42'),'value':_0x5a56d7[_0x5451('0x42')]||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7[_0x5451('0x39')][0x2]?_0x5a56d7['attrs'][0x2][_0x5451('0x3c')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x5451('0x46'),'value':_0x5a56d7[_0x5451('0x46')]||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7[_0x5451('0x39')][0x0]?_0x5a56d7['attrs'][0x0]['value']:undefined)||_0x5451('0x47')},{'name':_0x5451('0x48'),'value':_0x5a56d7[_0x5451('0x48')]||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7[_0x5451('0x39')][0x1]?_0x5a56d7[_0x5451('0x39')][0x1][_0x5451('0x3c')]:undefined)||null},{'name':'attrSerie3','value':_0x5a56d7[_0x5451('0x49')]||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7[_0x5451('0x39')][0x2]?_0x5a56d7[_0x5451('0x39')][0x2]['value']:undefined)||null},{'name':_0x5451('0x45'),'value':_0x5a56d7['attrVoiceQueues']||(_0x5a56d7['attrs']&&_0x5a56d7[_0x5451('0x39')][0x3]?_0x5a56d7['attrs'][0x3][_0x5451('0x3c')]:undefined)||[]}];case _0x5451('0x4a'):return[{'name':_0x5451('0x4b'),'type':_0x5a56d7[_0x5451('0x4c')]||(_0x5a56d7['attrs']&&_0x5a56d7['attrs'][0x0]?_0x5a56d7[_0x5451('0x39')][0x0][_0x5451('0x37')]:undefined)||null,'value':_0x5a56d7[_0x5451('0x4b')]||(_0x5a56d7[_0x5451('0x39')]&&_0x5a56d7['attrs'][0x0]?_0x5a56d7[_0x5451('0x39')][0x0]['value']:undefined)||null},{'name':_0x5451('0x4d'),'value':_0x5a56d7[_0x5451('0x4d')]||(_0x5a56d7['attrs']&&_0x5a56d7[_0x5451('0x39')][0x1]?_0x5a56d7[_0x5451('0x39')][0x1][_0x5451('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0xcda955){logger[_0x5451('0x25')]('widgetAttributes:\x20%s',JSON['stringify'](_0xcda955));return[];}}exports[_0x5451('0x4e')]=function(_0x1a6e08,_0x499af0){if(_0x1a6e08[_0x5451('0x4f')]){_0x1a6e08[_0x5451('0x4f')]['attrs']=widgetAttributes(_0x1a6e08[_0x5451('0x4f')]);}return db[_0x5451('0x2b')]['create'](_0x1a6e08[_0x5451('0x4f')],{})[_0x5451('0x24')](respondWithResult(_0x499af0,0xc9))[_0x5451('0x36')](handleError(_0x499af0,null));};exports['update']=function(_0x31dfdc,_0x5ce9e5){if(_0x31dfdc['body']['id']){delete _0x31dfdc[_0x5451('0x4f')]['id'];}_0x31dfdc['body']['attrs']=widgetAttributes(_0x31dfdc['body']);return db['DashboardItem'][_0x5451('0x35')]({'where':{'id':_0x31dfdc[_0x5451('0x28')]['id']}})[_0x5451('0x24')](handleEntityNotFound(_0x5ce9e5,null))[_0x5451('0x24')](saveUpdates(_0x31dfdc[_0x5451('0x4f')],null))[_0x5451('0x24')](respondWithResult(_0x5ce9e5,null))['catch'](handleError(_0x5ce9e5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 71f8d0f..4f10001 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 _0x1b69=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xf2cf5e,_0x143d47){var _0x39e0ed=function(_0x3ce9aa){while(--_0x3ce9aa){_0xf2cf5e['push'](_0xf2cf5e['shift']());}};_0x39e0ed(++_0x143d47);}(_0x1b69,0x1d0));var _0x91b6=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x1b69[_0x565c49];return _0x20ca34;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x91b6('0x0')](0x0);var events={'afterCreate':_0x91b6('0x1'),'afterUpdate':_0x91b6('0x2'),'afterDestroy':_0x91b6('0x3')};function emitEvent(_0x5900a9){return function(_0x120ecb,_0x4627f7,_0x106194){DashboardItemEvents[_0x91b6('0x4')](_0x5900a9+':'+_0x120ecb['id'],_0x120ecb);DashboardItemEvents[_0x91b6('0x4')](_0x5900a9,_0x120ecb);_0x106194(null);};}for(var e in events){if(events[_0x91b6('0x5')](e)){var event=events[e];DashboardItem[_0x91b6('0x6')](e,emitEvent(event));}}module[_0x91b6('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xf595=['DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1eabd5,_0x2f5dd8){var _0x2f4de8=function(_0x1c36fd){while(--_0x1c36fd){_0x1eabd5['push'](_0x1eabd5['shift']());}};_0x2f4de8(++_0x2f5dd8);}(_0xf595,0x8e));var _0x5f59=function(_0x2e2abe,_0x18c09d){_0x2e2abe=_0x2e2abe-0x0;var _0x54d614=_0xf595[_0x2e2abe];return _0x54d614;};'use strict';var EventEmitter=require(_0x5f59('0x0'));var DashboardItem=require(_0x5f59('0x1'))['db'][_0x5f59('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5f59('0x3')](0x0);var events={'afterCreate':_0x5f59('0x4'),'afterUpdate':'update','afterDestroy':_0x5f59('0x5')};function emitEvent(_0x1d2e2f){return function(_0x4f60af,_0x5152e5,_0x570e6a){DashboardItemEvents[_0x5f59('0x6')](_0x1d2e2f+':'+_0x4f60af['id'],_0x4f60af);DashboardItemEvents[_0x5f59('0x6')](_0x1d2e2f,_0x4f60af);_0x570e6a(null);};}for(var e in events){if(events[_0x5f59('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x5f59('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index dcab6e5..a7ea458 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 _0x704c=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define','DashboardItem'];(function(_0x2b599a,_0x21b5a0){var _0x21dd43=function(_0x8a602f){while(--_0x8a602f){_0x2b599a['push'](_0x2b599a['shift']());}};_0x21dd43(++_0x21b5a0);}(_0x704c,0xfe));var _0xc704=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0x704c[_0x4b26b5];return _0x4dec71;};'use strict';var _=require(_0xc704('0x0'));var util=require(_0xc704('0x1'));var logger=require(_0xc704('0x2'))('api');var moment=require(_0xc704('0x3'));var BPromise=require(_0xc704('0x4'));var rp=require(_0xc704('0x5'));var fs=require('fs');var path=require(_0xc704('0x6'));var rimraf=require('rimraf');var config=require(_0xc704('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x48a8b4,_0x27bbda){return _0x48a8b4[_0xc704('0x8')](_0xc704('0x9'),attributes,{'tableName':_0xc704('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0fc=['moment','bluebird','path','rimraf','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api'];(function(_0xa028da,_0x218c8f){var _0x50ad7f=function(_0x363c52){while(--_0x363c52){_0xa028da['push'](_0xa028da['shift']());}};_0x50ad7f(++_0x218c8f);}(_0xe0fc,0x8c));var _0xce0f=function(_0x207061,_0xe38cda){_0x207061=_0x207061-0x0;var _0x4a2833=_0xe0fc[_0x207061];return _0x4a2833;};'use strict';var _=require(_0xce0f('0x0'));var util=require('util');var logger=require(_0xce0f('0x1'))(_0xce0f('0x2'));var moment=require(_0xce0f('0x3'));var BPromise=require(_0xce0f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce0f('0x5'));var rimraf=require(_0xce0f('0x6'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0xce0f('0x7')]=function(_0x20bcd4,_0x2e9c65){return _0x20bcd4[_0xce0f('0x8')](_0xce0f('0x9'),attributes,{'tableName':_0xce0f('0xa'),'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 3eb02e0..506c80f 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 _0x5469=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5469,0x1b4));var _0x9546=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0x5469[_0x2ef44b];return _0x2405b9;};'use strict';var _=require(_0x9546('0x0'));var util=require(_0x9546('0x1'));var moment=require(_0x9546('0x2'));var BPromise=require(_0x9546('0x3'));var rs=require(_0x9546('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9546('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9546('0x6'))(_0x9546('0x7'));var config=require(_0x9546('0x8'));var jayson=require(_0x9546('0x9'));var client=jayson[_0x9546('0xa')][_0x9546('0xb')]({'port':0x232a});config['redis']=_[_0x9546('0xc')](config[_0x9546('0xd')],{'host':_0x9546('0xe'),'port':0x18eb});var socket=require(_0x9546('0xf'))(new Redis(config[_0x9546('0xd')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x147d20,_0x3f3f82,_0x44fa1b){return new BPromise(function(_0xea2186,_0x4c633c){return client[_0x9546('0x10')](_0x147d20,_0x44fa1b)[_0x9546('0x11')](function(_0x3aa667){logger[_0x9546('0x12')](_0x9546('0x13'),_0x3f3f82,'request\x20sent');logger[_0x9546('0x14')](_0x9546('0x15'),_0x3f3f82,_0x9546('0x16'),JSON[_0x9546('0x17')](_0x3aa667));if(_0x3aa667['error']){if(_0x3aa667[_0x9546('0x18')][_0x9546('0x19')]===0x1f4){logger['error'](_0x9546('0x13'),_0x3f3f82,_0x3aa667[_0x9546('0x18')][_0x9546('0x1a')]);return _0x4c633c(_0x3aa667['error'][_0x9546('0x1a')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x3f3f82,_0x3aa667[_0x9546('0x18')][_0x9546('0x1a')]);return _0xea2186(_0x3aa667[_0x9546('0x18')][_0x9546('0x1a')]);}else{logger['info'](_0x9546('0x13'),_0x3f3f82,_0x9546('0x16'));_0xea2186(_0x3aa667[_0x9546('0x1b')]['message']);}})[_0x9546('0x1c')](function(_0x47639c){logger[_0x9546('0x18')](_0x9546('0x13'),_0x3f3f82,_0x47639c);_0x4c633c(_0x47639c);});});} \ No newline at end of file +var _0xb3c7=['socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xb3c7,0x1ce));var _0x7b3c=function(_0x5e88b5,_0x48a6af){_0x5e88b5=_0x5e88b5-0x0;var _0x4f705b=_0xb3c7[_0x5e88b5];return _0x4f705b;};'use strict';var _=require(_0x7b3c('0x0'));var util=require('util');var moment=require(_0x7b3c('0x1'));var BPromise=require(_0x7b3c('0x2'));var rs=require(_0x7b3c('0x3'));var fs=require('fs');var Redis=require(_0x7b3c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b3c('0x5'));var logger=require(_0x7b3c('0x6'))(_0x7b3c('0x7'));var config=require(_0x7b3c('0x8'));var jayson=require(_0x7b3c('0x9'));var client=jayson[_0x7b3c('0xa')][_0x7b3c('0xb')]({'port':0x232a});config['redis']=_[_0x7b3c('0xc')](config[_0x7b3c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b3c('0xe'))(new Redis(config['redis']));require(_0x7b3c('0xf'))[_0x7b3c('0x10')](socket);function respondWithRpcPromise(_0x1e3f27,_0x17bc2a,_0x19886c){return new BPromise(function(_0x21ef9c,_0x2cd00d){return client[_0x7b3c('0x11')](_0x1e3f27,_0x19886c)[_0x7b3c('0x12')](function(_0x31fd86){logger[_0x7b3c('0x13')](_0x7b3c('0x14'),_0x17bc2a,_0x7b3c('0x15'));logger[_0x7b3c('0x16')](_0x7b3c('0x17'),_0x17bc2a,_0x7b3c('0x15'),JSON['stringify'](_0x31fd86));if(_0x31fd86['error']){if(_0x31fd86[_0x7b3c('0x18')]['code']===0x1f4){logger[_0x7b3c('0x18')](_0x7b3c('0x14'),_0x17bc2a,_0x31fd86[_0x7b3c('0x18')][_0x7b3c('0x19')]);return _0x2cd00d(_0x31fd86[_0x7b3c('0x18')][_0x7b3c('0x19')]);}logger[_0x7b3c('0x18')](_0x7b3c('0x14'),_0x17bc2a,_0x31fd86[_0x7b3c('0x18')][_0x7b3c('0x19')]);return _0x21ef9c(_0x31fd86[_0x7b3c('0x18')][_0x7b3c('0x19')]);}else{logger[_0x7b3c('0x13')](_0x7b3c('0x14'),_0x17bc2a,_0x7b3c('0x15'));_0x21ef9c(_0x31fd86[_0x7b3c('0x1a')][_0x7b3c('0x19')]);}})[_0x7b3c('0x1b')](function(_0x3a8db3){logger['error'](_0x7b3c('0x14'),_0x17bc2a,_0x3a8db3);_0x2cd00d(_0x3a8db3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index dd02367..b5c027b 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 _0xb3fd=['save','update','emit','removeListener','length','dashboardItem:'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xb3fd,0x18c));var _0xdb3f=function(_0x2f3381,_0x2efde6){_0x2f3381=_0x2f3381-0x0;var _0x230734=_0xb3fd[_0x2f3381];return _0x230734;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xdb3f('0x0'),'remove',_0xdb3f('0x1')];function createListener(_0x564057,_0xb5efc3){return function(_0x1e7ff8){_0xb5efc3[_0xdb3f('0x2')](_0x564057,_0x1e7ff8);};}function removeListener(_0x2e28b2,_0x377851){return function(){DashboardItemEvents[_0xdb3f('0x3')](_0x2e28b2,_0x377851);};}exports['register']=function(_0x1b08ce){for(var _0x5aa10d=0x0,_0x2c7af5=events[_0xdb3f('0x4')];_0x5aa10d<_0x2c7af5;_0x5aa10d++){var _0x2acd0d=events[_0x5aa10d];var _0x344a20=createListener(_0xdb3f('0x5')+_0x2acd0d,_0x1b08ce);DashboardItemEvents['on'](_0x2acd0d,_0x344a20);}}; \ No newline at end of file +var _0x82ca=['save','remove','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x14e78b,_0x396cb6){var _0x4d46ec=function(_0xf31200){while(--_0xf31200){_0x14e78b['push'](_0x14e78b['shift']());}};_0x4d46ec(++_0x396cb6);}(_0x82ca,0x167));var _0xa82c=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x82ca[_0x1dd532];return _0x3732aa;};'use strict';var DashboardItemEvents=require(_0xa82c('0x0'));var events=[_0xa82c('0x1'),_0xa82c('0x2'),'update'];function createListener(_0x3ec90f,_0x15f5e2){return function(_0x3cc784){_0x15f5e2['emit'](_0x3ec90f,_0x3cc784);};}function removeListener(_0x1733fa,_0x28837d){return function(){DashboardItemEvents['removeListener'](_0x1733fa,_0x28837d);};}exports[_0xa82c('0x3')]=function(_0x2dd368){for(var _0x16b4ef=0x0,_0x571de6=events[_0xa82c('0x4')];_0x16b4ef<_0x571de6;_0x16b4ef++){var _0x12d5b0=events[_0x16b4ef];var _0x4256b8=createListener(_0xa82c('0x5')+_0x12d5b0,_0x2dd368);DashboardItemEvents['on'](_0x12d5b0,_0x4256b8);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index eb51066..d5cc801 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 _0xc4aa=['connect-timeout','express','Router','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x22d63e,_0x57831c){var _0x8a8bbe=function(_0x3b9307){while(--_0x3b9307){_0x22d63e['push'](_0x22d63e['shift']());}};_0x8a8bbe(++_0x57831c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'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')](_0xac4a('0x8'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0xb')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xc')]);router['put']('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router[_0xac4a('0xe')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);module[_0xac4a('0x10')]=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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1c6856,_0x8786ba){_0x1c6856=_0x1c6856-0x0;var _0x310ca5=_0x7fbe[_0x1c6856];return _0x310ca5;};'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 f51eece..d344ff0 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 _0x5a4b=['exports'];(function(_0x35b115,_0x1e9563){var _0x2e13e9=function(_0x5d829b){while(--_0x5d829b){_0x35b115['push'](_0x35b115['shift']());}};_0x2e13e9(++_0x1e9563);}(_0x5a4b,0x17c));var _0xb5a4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5a4b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0xb5a4('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xfc14=['exports','STRING','sequelize'];(function(_0x3a6fb0,_0x48f8ba){var _0x521cc5=function(_0x4c2818){while(--_0x4c2818){_0x3a6fb0['push'](_0x3a6fb0['shift']());}};_0x521cc5(++_0x48f8ba);}(_0xfc14,0x15e));var _0x4fc1=function(_0x57a2ec,_0x3abfe4){_0x57a2ec=_0x57a2ec-0x0;var _0x272e8f=_0xfc14[_0x57a2ec];return _0x272e8f;};'use strict';var Sequelize=require(_0x4fc1('0x0'));module[_0x4fc1('0x1')]={'name':{'type':Sequelize[_0x4fc1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 54fbced..79efe72 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 _0xfe36=['params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','map','Disposition','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','options','create','body','user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0xfe36,0x1e8));var _0x6fe3=function(_0x3feb0b,_0xfa9d){_0x3feb0b=_0x3feb0b-0x0;var _0x2bfe95=_0xfe36[_0x3feb0b];return _0x2bfe95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6fe3('0x0'));var rimraf=require(_0x6fe3('0x1'));var zipdir=require(_0x6fe3('0x2'));var jsonpatch=require(_0x6fe3('0x3'));var rp=require(_0x6fe3('0x4'));var moment=require(_0x6fe3('0x5'));var BPromise=require(_0x6fe3('0x6'));var Mustache=require(_0x6fe3('0x7'));var util=require(_0x6fe3('0x8'));var path=require(_0x6fe3('0x9'));var sox=require(_0x6fe3('0xa'));var csv=require(_0x6fe3('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6fe3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6fe3('0xd'));var deskjs=require(_0x6fe3('0xe'));var toCsv=require(_0x6fe3('0xb'));var querystring=require('querystring');var Papa=require(_0x6fe3('0xf'));var Redis=require('ioredis');var authService=require(_0x6fe3('0x10'));var qs=require(_0x6fe3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fe3('0x12'));var logger=require(_0x6fe3('0x13'))(_0x6fe3('0x14'));var utils=require(_0x6fe3('0x15'));var config=require(_0x6fe3('0x16'));var db=require(_0x6fe3('0x17'))['db'];function respondWithStatusCode(_0x1da324,_0x4f8083){_0x4f8083=_0x4f8083||0xcc;return function(_0x169e18){if(_0x169e18){return _0x1da324['sendStatus'](_0x4f8083);}return _0x1da324[_0x6fe3('0x18')](_0x4f8083)[_0x6fe3('0x19')]();};}function respondWithResult(_0x1b0a13,_0x589213){_0x589213=_0x589213||0xc8;return function(_0xc66624){if(_0xc66624){return _0x1b0a13[_0x6fe3('0x18')](_0x589213)['json'](_0xc66624);}};}function respondWithFilteredResult(_0x2dd310,_0x28289a){return function(_0xb0c12f){if(_0xb0c12f){var _0x45f8d7=_0xb0c12f[_0x6fe3('0x1a')],_0x46a9d5=_0x28289a[_0x6fe3('0x1b')],_0x562462=_0x28289a['offset']+_0x28289a['limit'],_0x2665ac;if(_0x562462>=_0x45f8d7){_0x562462=_0x45f8d7;_0x2665ac=0xc8;}else{_0x2665ac=0xce;}_0x2dd310['status'](_0x2665ac);return _0x2dd310[_0x6fe3('0x1c')]('Content-Range',_0x46a9d5+'-'+_0x562462+'/'+_0x45f8d7)['json'](_0xb0c12f);}return null;};}function patchUpdates(_0x4b02b4){return function(_0x274b38){try{jsonpatch[_0x6fe3('0x1d')](_0x274b38,_0x4b02b4,!![]);}catch(_0x3f3123){return BPromise[_0x6fe3('0x1e')](_0x3f3123);}return _0x274b38[_0x6fe3('0x1f')]();};}function saveUpdates(_0x413737,_0x40b45e){return function(_0x5f3ada){if(_0x5f3ada){return _0x5f3ada[_0x6fe3('0x20')](_0x413737)[_0x6fe3('0x21')](function(_0xbc9001){return _0xbc9001;});}return null;};}function removeEntity(_0x55583c,_0xe39865){return function(_0x2213fd){if(_0x2213fd){return _0x2213fd[_0x6fe3('0x22')]()['then'](function(){var _0x1da4c2=_0x2213fd[_0x6fe3('0x23')]({'plain':!![]});var _0x5c6508='Dispositions';return db[_0x6fe3('0x24')]['destroy']({'where':{'type':_0x5c6508,'resourceId':_0x1da4c2['id']}})[_0x6fe3('0x21')](function(){return _0x2213fd;});})['then'](function(){_0x55583c[_0x6fe3('0x18')](0xcc)[_0x6fe3('0x19')]();});}};}function handleEntityNotFound(_0x17f3d4,_0xb3bca1){return function(_0x1f62a5){if(!_0x1f62a5){_0x17f3d4[_0x6fe3('0x25')](0x194);}return _0x1f62a5;};}function handleError(_0x5cebd0,_0x2d8aeb){_0x2d8aeb=_0x2d8aeb||0x1f4;return function(_0x55fb0b){logger[_0x6fe3('0x26')](_0x55fb0b['stack']);if(_0x55fb0b[_0x6fe3('0x27')]){delete _0x55fb0b[_0x6fe3('0x27')];}_0x5cebd0[_0x6fe3('0x18')](_0x2d8aeb)[_0x6fe3('0x28')](_0x55fb0b);};}exports[_0x6fe3('0x29')]=function(_0x34fa36,_0x2a34cb){var _0x1551a8={},_0x2a9fb2={},_0x1fd59a={'count':0x0,'rows':[]};var _0x40a117=_[_0x6fe3('0x2a')](db[_0x6fe3('0x2b')][_0x6fe3('0x2c')],function(_0x5f4999){return{'name':_0x5f4999['fieldName'],'type':_0x5f4999[_0x6fe3('0x2d')][_0x6fe3('0x2e')]};});_0x2a9fb2[_0x6fe3('0x2f')]=_[_0x6fe3('0x2a')](_0x40a117,_0x6fe3('0x27'));_0x2a9fb2[_0x6fe3('0x30')]=_[_0x6fe3('0x31')](_0x34fa36[_0x6fe3('0x30')]);_0x2a9fb2[_0x6fe3('0x32')]=_[_0x6fe3('0x33')](_0x2a9fb2['model'],_0x2a9fb2[_0x6fe3('0x30')]);_0x1551a8[_0x6fe3('0x34')]=_[_0x6fe3('0x33')](_0x2a9fb2[_0x6fe3('0x2f')],qs['fields'](_0x34fa36[_0x6fe3('0x30')][_0x6fe3('0x35')]));_0x1551a8[_0x6fe3('0x34')]=_0x1551a8[_0x6fe3('0x34')][_0x6fe3('0x36')]?_0x1551a8[_0x6fe3('0x34')]:_0x2a9fb2[_0x6fe3('0x2f')];if(!_0x34fa36[_0x6fe3('0x30')][_0x6fe3('0x37')](_0x6fe3('0x38'))){_0x1551a8[_0x6fe3('0x39')]=qs[_0x6fe3('0x39')](_0x34fa36[_0x6fe3('0x30')][_0x6fe3('0x39')]);_0x1551a8[_0x6fe3('0x1b')]=qs[_0x6fe3('0x1b')](_0x34fa36[_0x6fe3('0x30')][_0x6fe3('0x1b')]);}_0x1551a8[_0x6fe3('0x3a')]=qs[_0x6fe3('0x3b')](_0x34fa36[_0x6fe3('0x30')][_0x6fe3('0x3b')]);_0x1551a8['where']=qs['filters'](_['pick'](_0x34fa36[_0x6fe3('0x30')],_0x2a9fb2['filters']),_0x40a117);if(_0x34fa36[_0x6fe3('0x30')]['filter']){_0x1551a8['where']=_[_0x6fe3('0x3c')](_0x1551a8[_0x6fe3('0x3d')],{'$or':_['map'](_0x40a117,function(_0x5e508b){if(_0x5e508b[_0x6fe3('0x2d')]!==_0x6fe3('0x3e')){var _0x1533aa={};_0x1533aa[_0x5e508b[_0x6fe3('0x27')]]={'$like':'%'+_0x34fa36[_0x6fe3('0x30')][_0x6fe3('0x3f')]+'%'};return _0x1533aa;}})});}_0x1551a8=_[_0x6fe3('0x3c')]({},_0x1551a8,_0x34fa36['options']);var _0x26659e={'where':_0x1551a8[_0x6fe3('0x3d')]};return db['Disposition'][_0x6fe3('0x1a')](_0x26659e)['then'](function(_0x2ee271){_0x1fd59a[_0x6fe3('0x1a')]=_0x2ee271;if(_0x34fa36[_0x6fe3('0x30')][_0x6fe3('0x40')]){_0x1551a8[_0x6fe3('0x41')]=[{'all':!![]}];}return db[_0x6fe3('0x2b')][_0x6fe3('0x42')](_0x1551a8);})['then'](function(_0x4a0fe9){_0x1fd59a[_0x6fe3('0x43')]=_0x4a0fe9;return _0x1fd59a;})[_0x6fe3('0x21')](respondWithFilteredResult(_0x2a34cb,_0x1551a8))[_0x6fe3('0x44')](handleError(_0x2a34cb,null));};exports[_0x6fe3('0x45')]=function(_0x3d3387,_0x1bc8f6){var _0xa7a4c={'raw':!![],'where':{'id':_0x3d3387['params']['id']}},_0x143b44={};_0x143b44[_0x6fe3('0x2f')]=_['keys'](db[_0x6fe3('0x2b')][_0x6fe3('0x2c')]);_0x143b44[_0x6fe3('0x30')]=_[_0x6fe3('0x31')](_0x3d3387['query']);_0x143b44[_0x6fe3('0x32')]=_[_0x6fe3('0x33')](_0x143b44[_0x6fe3('0x2f')],_0x143b44[_0x6fe3('0x30')]);_0xa7a4c[_0x6fe3('0x34')]=_['intersection'](_0x143b44['model'],qs[_0x6fe3('0x35')](_0x3d3387[_0x6fe3('0x30')][_0x6fe3('0x35')]));_0xa7a4c[_0x6fe3('0x34')]=_0xa7a4c[_0x6fe3('0x34')][_0x6fe3('0x36')]?_0xa7a4c[_0x6fe3('0x34')]:_0x143b44[_0x6fe3('0x2f')];if(_0x3d3387[_0x6fe3('0x30')][_0x6fe3('0x40')]){_0xa7a4c[_0x6fe3('0x41')]=[{'all':!![]}];}_0xa7a4c=_[_0x6fe3('0x3c')]({},_0xa7a4c,_0x3d3387[_0x6fe3('0x46')]);return db[_0x6fe3('0x2b')]['find'](_0xa7a4c)['then'](handleEntityNotFound(_0x1bc8f6,null))[_0x6fe3('0x21')](respondWithResult(_0x1bc8f6,null))[_0x6fe3('0x44')](handleError(_0x1bc8f6,null));};exports['create']=function(_0x3c6be8,_0x4841e8){return db['Disposition'][_0x6fe3('0x47')](_0x3c6be8[_0x6fe3('0x48')],{})['then'](function(_0x4c9dc8){var _0x128cc1=_0x3c6be8[_0x6fe3('0x49')][_0x6fe3('0x23')]({'plain':!![]});if(!_0x128cc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x128cc1[_0x6fe3('0x4a')]===_0x6fe3('0x49')){var _0x3a4430=_0x4c9dc8[_0x6fe3('0x23')]({'plain':!![]});var _0x49856e=_0x6fe3('0x4b');return db[_0x6fe3('0x4c')]['find']({'where':{'name':_0x49856e,'userProfileId':_0x128cc1[_0x6fe3('0x4d')]},'raw':!![]})[_0x6fe3('0x21')](function(_0x2365fe){if(_0x2365fe&&_0x2365fe[_0x6fe3('0x4e')]===0x0){return db[_0x6fe3('0x24')][_0x6fe3('0x47')]({'name':_0x3a4430['name'],'resourceId':_0x3a4430['id'],'type':_0x2365fe['name'],'sectionId':_0x2365fe['id']},{})[_0x6fe3('0x21')](function(){return _0x4c9dc8;});}else{return _0x4c9dc8;}})['catch'](function(_0x438701){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x438701);throw _0x438701;});}return _0x4c9dc8;})[_0x6fe3('0x21')](respondWithResult(_0x4841e8,0xc9))[_0x6fe3('0x44')](handleError(_0x4841e8,null));};exports[_0x6fe3('0x20')]=function(_0x396337,_0x14cd3b){if(_0x396337[_0x6fe3('0x48')]['id']){delete _0x396337[_0x6fe3('0x48')]['id'];}return db['Disposition']['find']({'where':{'id':_0x396337[_0x6fe3('0x4f')]['id']}})[_0x6fe3('0x21')](handleEntityNotFound(_0x14cd3b,null))[_0x6fe3('0x21')](saveUpdates(_0x396337[_0x6fe3('0x48')],null))[_0x6fe3('0x21')](respondWithResult(_0x14cd3b,null))[_0x6fe3('0x44')](handleError(_0x14cd3b,null));};exports['destroy']=function(_0xc50d9a,_0x29aa11){return db[_0x6fe3('0x2b')][_0x6fe3('0x50')]({'where':{'id':_0xc50d9a[_0x6fe3('0x4f')]['id']}})[_0x6fe3('0x21')](handleEntityNotFound(_0x29aa11,null))[_0x6fe3('0x21')](removeEntity(_0x29aa11,null))[_0x6fe3('0x44')](handleError(_0x29aa11,null));}; \ No newline at end of file +var _0xac33=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','Dispositions','destroy','error','name','map','Disposition','rawAttributes','fieldName','key','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','count','includeAll','include','findAll','catch','show','params','keys','intersection','length','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','jsforce','papaparse','ioredis'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xac33,0x125));var _0x3ac3=function(_0x51aebe,_0x2c154a){_0x51aebe=_0x51aebe-0x0;var _0x31b43d=_0xac33[_0x51aebe];return _0x31b43d;};'use strict';var pdf=require(_0x3ac3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3ac3('0x1'));var zipdir=require(_0x3ac3('0x2'));var jsonpatch=require(_0x3ac3('0x3'));var rp=require(_0x3ac3('0x4'));var moment=require(_0x3ac3('0x5'));var BPromise=require(_0x3ac3('0x6'));var Mustache=require('mustache');var util=require(_0x3ac3('0x7'));var path=require(_0x3ac3('0x8'));var sox=require(_0x3ac3('0x9'));var csv=require(_0x3ac3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3ac3('0xb'));var crypto=require('crypto');var jsforce=require(_0x3ac3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3ac3('0xa'));var querystring=require('querystring');var Papa=require(_0x3ac3('0xd'));var Redis=require(_0x3ac3('0xe'));var authService=require(_0x3ac3('0xf'));var qs=require(_0x3ac3('0x10'));var as=require(_0x3ac3('0x11'));var hardwareService=require(_0x3ac3('0x12'));var logger=require('../../config/logger')(_0x3ac3('0x13'));var utils=require('../../config/utils');var config=require(_0x3ac3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57da47,_0x1a8e2e){_0x1a8e2e=_0x1a8e2e||0xcc;return function(_0xa5468){if(_0xa5468){return _0x57da47[_0x3ac3('0x15')](_0x1a8e2e);}return _0x57da47['status'](_0x1a8e2e)[_0x3ac3('0x16')]();};}function respondWithResult(_0x539834,_0x5c7df0){_0x5c7df0=_0x5c7df0||0xc8;return function(_0x26f263){if(_0x26f263){return _0x539834[_0x3ac3('0x17')](_0x5c7df0)['json'](_0x26f263);}};}function respondWithFilteredResult(_0x44dd73,_0x4bf0f0){return function(_0x58bb3f){if(_0x58bb3f){var _0x8a152=_0x58bb3f['count'],_0x505592=_0x4bf0f0['offset'],_0x247202=_0x4bf0f0[_0x3ac3('0x18')]+_0x4bf0f0[_0x3ac3('0x19')],_0x2d5c63;if(_0x247202>=_0x8a152){_0x247202=_0x8a152;_0x2d5c63=0xc8;}else{_0x2d5c63=0xce;}_0x44dd73[_0x3ac3('0x17')](_0x2d5c63);return _0x44dd73[_0x3ac3('0x1a')](_0x3ac3('0x1b'),_0x505592+'-'+_0x247202+'/'+_0x8a152)[_0x3ac3('0x1c')](_0x58bb3f);}return null;};}function patchUpdates(_0x406fb6){return function(_0x30fd8d){try{jsonpatch[_0x3ac3('0x1d')](_0x30fd8d,_0x406fb6,!![]);}catch(_0x1423e2){return BPromise[_0x3ac3('0x1e')](_0x1423e2);}return _0x30fd8d[_0x3ac3('0x1f')]();};}function saveUpdates(_0x234066,_0xad3e87){return function(_0x25068b){if(_0x25068b){return _0x25068b[_0x3ac3('0x20')](_0x234066)[_0x3ac3('0x21')](function(_0x5fea7b){return _0x5fea7b;});}return null;};}function removeEntity(_0x4a83e1,_0x1befb6){return function(_0x417ab1){if(_0x417ab1){return _0x417ab1['destroy']()[_0x3ac3('0x21')](function(){var _0x5a395f=_0x417ab1['get']({'plain':!![]});var _0x4d91bf=_0x3ac3('0x22');return db['UserProfileResource'][_0x3ac3('0x23')]({'where':{'type':_0x4d91bf,'resourceId':_0x5a395f['id']}})[_0x3ac3('0x21')](function(){return _0x417ab1;});})[_0x3ac3('0x21')](function(){_0x4a83e1[_0x3ac3('0x17')](0xcc)[_0x3ac3('0x16')]();});}};}function handleEntityNotFound(_0x269508,_0x170b0f){return function(_0x750faf){if(!_0x750faf){_0x269508[_0x3ac3('0x15')](0x194);}return _0x750faf;};}function handleError(_0x3b42e1,_0x445f52){_0x445f52=_0x445f52||0x1f4;return function(_0x4ea66d){logger[_0x3ac3('0x24')](_0x4ea66d['stack']);if(_0x4ea66d['name']){delete _0x4ea66d[_0x3ac3('0x25')];}_0x3b42e1['status'](_0x445f52)['send'](_0x4ea66d);};}exports['index']=function(_0x37281d,_0x45a9a1){var _0x18ea07={},_0x27bcb9={},_0x4c19e8={'count':0x0,'rows':[]};var _0x3ba4fb=_[_0x3ac3('0x26')](db[_0x3ac3('0x27')][_0x3ac3('0x28')],function(_0x51cf91){return{'name':_0x51cf91[_0x3ac3('0x29')],'type':_0x51cf91['type'][_0x3ac3('0x2a')]};});_0x27bcb9['model']=_[_0x3ac3('0x26')](_0x3ba4fb,_0x3ac3('0x25'));_0x27bcb9[_0x3ac3('0x2b')]=_['keys'](_0x37281d['query']);_0x27bcb9[_0x3ac3('0x2c')]=_['intersection'](_0x27bcb9[_0x3ac3('0x2d')],_0x27bcb9['query']);_0x18ea07[_0x3ac3('0x2e')]=_['intersection'](_0x27bcb9['model'],qs[_0x3ac3('0x2f')](_0x37281d['query'][_0x3ac3('0x2f')]));_0x18ea07[_0x3ac3('0x2e')]=_0x18ea07[_0x3ac3('0x2e')]['length']?_0x18ea07[_0x3ac3('0x2e')]:_0x27bcb9[_0x3ac3('0x2d')];if(!_0x37281d[_0x3ac3('0x2b')][_0x3ac3('0x30')](_0x3ac3('0x31'))){_0x18ea07['limit']=qs[_0x3ac3('0x19')](_0x37281d[_0x3ac3('0x2b')][_0x3ac3('0x19')]);_0x18ea07[_0x3ac3('0x18')]=qs[_0x3ac3('0x18')](_0x37281d['query'][_0x3ac3('0x18')]);}_0x18ea07[_0x3ac3('0x32')]=qs[_0x3ac3('0x33')](_0x37281d[_0x3ac3('0x2b')][_0x3ac3('0x33')]);_0x18ea07[_0x3ac3('0x34')]=qs[_0x3ac3('0x2c')](_['pick'](_0x37281d[_0x3ac3('0x2b')],_0x27bcb9['filters']),_0x3ba4fb);if(_0x37281d['query'][_0x3ac3('0x35')]){_0x18ea07[_0x3ac3('0x34')]=_['merge'](_0x18ea07['where'],{'$or':_[_0x3ac3('0x26')](_0x3ba4fb,function(_0x3d50ff){if(_0x3d50ff[_0x3ac3('0x36')]!=='VIRTUAL'){var _0x46dc2d={};_0x46dc2d[_0x3d50ff[_0x3ac3('0x25')]]={'$like':'%'+_0x37281d[_0x3ac3('0x2b')]['filter']+'%'};return _0x46dc2d;}})});}_0x18ea07=_[_0x3ac3('0x37')]({},_0x18ea07,_0x37281d[_0x3ac3('0x38')]);var _0x413453={'where':_0x18ea07[_0x3ac3('0x34')]};return db['Disposition'][_0x3ac3('0x39')](_0x413453)['then'](function(_0x10f170){_0x4c19e8[_0x3ac3('0x39')]=_0x10f170;if(_0x37281d[_0x3ac3('0x2b')][_0x3ac3('0x3a')]){_0x18ea07[_0x3ac3('0x3b')]=[{'all':!![]}];}return db[_0x3ac3('0x27')][_0x3ac3('0x3c')](_0x18ea07);})[_0x3ac3('0x21')](function(_0x391030){_0x4c19e8['rows']=_0x391030;return _0x4c19e8;})['then'](respondWithFilteredResult(_0x45a9a1,_0x18ea07))[_0x3ac3('0x3d')](handleError(_0x45a9a1,null));};exports[_0x3ac3('0x3e')]=function(_0xc4ff0b,_0x33daf6){var _0x21eb5e={'raw':!![],'where':{'id':_0xc4ff0b[_0x3ac3('0x3f')]['id']}},_0x9d012={};_0x9d012[_0x3ac3('0x2d')]=_['keys'](db[_0x3ac3('0x27')][_0x3ac3('0x28')]);_0x9d012[_0x3ac3('0x2b')]=_[_0x3ac3('0x40')](_0xc4ff0b['query']);_0x9d012[_0x3ac3('0x2c')]=_[_0x3ac3('0x41')](_0x9d012[_0x3ac3('0x2d')],_0x9d012[_0x3ac3('0x2b')]);_0x21eb5e[_0x3ac3('0x2e')]=_[_0x3ac3('0x41')](_0x9d012[_0x3ac3('0x2d')],qs[_0x3ac3('0x2f')](_0xc4ff0b[_0x3ac3('0x2b')][_0x3ac3('0x2f')]));_0x21eb5e[_0x3ac3('0x2e')]=_0x21eb5e[_0x3ac3('0x2e')][_0x3ac3('0x42')]?_0x21eb5e['attributes']:_0x9d012[_0x3ac3('0x2d')];if(_0xc4ff0b[_0x3ac3('0x2b')]['includeAll']){_0x21eb5e['include']=[{'all':!![]}];}_0x21eb5e=_[_0x3ac3('0x37')]({},_0x21eb5e,_0xc4ff0b['options']);return db[_0x3ac3('0x27')]['find'](_0x21eb5e)[_0x3ac3('0x21')](handleEntityNotFound(_0x33daf6,null))[_0x3ac3('0x21')](respondWithResult(_0x33daf6,null))[_0x3ac3('0x3d')](handleError(_0x33daf6,null));};exports[_0x3ac3('0x43')]=function(_0x27d29d,_0x3a12f2){return db[_0x3ac3('0x27')][_0x3ac3('0x43')](_0x27d29d['body'],{})[_0x3ac3('0x21')](function(_0x170a1e){var _0x339bb3=_0x27d29d['user'][_0x3ac3('0x44')]({'plain':!![]});if(!_0x339bb3)throw new Error(_0x3ac3('0x45'));if(_0x339bb3[_0x3ac3('0x46')]==='user'){var _0x4f7a29=_0x170a1e[_0x3ac3('0x44')]({'plain':!![]});var _0x47bad9='Dispositions';return db[_0x3ac3('0x47')][_0x3ac3('0x48')]({'where':{'name':_0x47bad9,'userProfileId':_0x339bb3['userProfileId']},'raw':!![]})['then'](function(_0x9ff83e){if(_0x9ff83e&&_0x9ff83e[_0x3ac3('0x49')]===0x0){return db[_0x3ac3('0x4a')][_0x3ac3('0x43')]({'name':_0x4f7a29['name'],'resourceId':_0x4f7a29['id'],'type':_0x9ff83e['name'],'sectionId':_0x9ff83e['id']},{})[_0x3ac3('0x21')](function(){return _0x170a1e;});}else{return _0x170a1e;}})[_0x3ac3('0x3d')](function(_0x4ec163){logger[_0x3ac3('0x24')](_0x3ac3('0x4b'),_0x4ec163);throw _0x4ec163;});}return _0x170a1e;})['then'](respondWithResult(_0x3a12f2,0xc9))[_0x3ac3('0x3d')](handleError(_0x3a12f2,null));};exports[_0x3ac3('0x20')]=function(_0x300fea,_0x28274e){if(_0x300fea[_0x3ac3('0x4c')]['id']){delete _0x300fea[_0x3ac3('0x4c')]['id'];}return db[_0x3ac3('0x27')]['find']({'where':{'id':_0x300fea[_0x3ac3('0x3f')]['id']}})[_0x3ac3('0x21')](handleEntityNotFound(_0x28274e,null))['then'](saveUpdates(_0x300fea[_0x3ac3('0x4c')],null))['then'](respondWithResult(_0x28274e,null))[_0x3ac3('0x3d')](handleError(_0x28274e,null));};exports['destroy']=function(_0x5e5fe0,_0x10c08e){return db['Disposition']['find']({'where':{'id':_0x5e5fe0[_0x3ac3('0x3f')]['id']}})[_0x3ac3('0x21')](handleEntityNotFound(_0x10c08e,null))['then'](removeEntity(_0x10c08e,null))[_0x3ac3('0x3d')](handleError(_0x10c08e,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 719adc6..431bf5f 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 _0xf6fe=['name_mail','MailAccountId','name_sms','name','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Disposition','name_voice','ListId','name_chat'];(function(_0x3c53c7,_0x32a47e){var _0x51b671=function(_0x48069d){while(--_0x48069d){_0x3c53c7['push'](_0x3c53c7['shift']());}};_0x51b671(++_0x32a47e);}(_0xf6fe,0x169));var _0xef6f=function(_0x19af6b,_0x5b2017){_0x19af6b=_0x19af6b-0x0;var _0x2915aa=_0xf6fe[_0x19af6b];return _0x2915aa;};'use strict';var _=require(_0xef6f('0x0'));var util=require('util');var logger=require(_0xef6f('0x1'))(_0xef6f('0x2'));var moment=require(_0xef6f('0x3'));var BPromise=require(_0xef6f('0x4'));var rp=require(_0xef6f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef6f('0x6'));var config=require(_0xef6f('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x4d75b4,_0x3e651d){return _0x4d75b4[_0xef6f('0x8')](_0xef6f('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xef6f('0xa'),'fields':['name',_0xef6f('0xb')]},{'unique':!![],'name':_0xef6f('0xc'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xef6f('0xd'),'fields':['name',_0xef6f('0xe')]},{'unique':!![],'name':_0xef6f('0xf'),'fields':[_0xef6f('0x10'),'SmsAccountId']},{'unique':!![],'name':_0xef6f('0x11'),'fields':['name',_0xef6f('0x12')]},{'unique':!![],'name':_0xef6f('0x13'),'fields':[_0xef6f('0x10'),'OpenchannelAccountId']},{'unique':!![],'name':_0xef6f('0x14'),'fields':[_0xef6f('0x10'),_0xef6f('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x175c=['moment','request-promise','rimraf','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x175c,0xb2));var _0xc175=function(_0x4bbf02,_0x29f4fe){_0x4bbf02=_0x4bbf02-0x0;var _0x50f4eb=_0x175c[_0x4bbf02];return _0x50f4eb;};'use strict';var _=require(_0xc175('0x0'));var util=require(_0xc175('0x1'));var logger=require(_0xc175('0x2'))(_0xc175('0x3'));var moment=require(_0xc175('0x4'));var BPromise=require('bluebird');var rp=require(_0xc175('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc175('0x6'));var config=require('../../config/environment');var attributes=require(_0xc175('0x7'));module[_0xc175('0x8')]=function(_0x30ca77,_0x10959f){return _0x30ca77[_0xc175('0x9')]('Disposition',attributes,{'tableName':_0xc175('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc175('0xb'),'fields':[_0xc175('0xc'),_0xc175('0xd')]},{'unique':!![],'name':_0xc175('0xe'),'fields':[_0xc175('0xc'),_0xc175('0xf')]},{'unique':!![],'name':_0xc175('0x10'),'fields':[_0xc175('0xc'),_0xc175('0x11')]},{'unique':!![],'name':_0xc175('0x12'),'fields':['name',_0xc175('0x13')]},{'unique':!![],'name':_0xc175('0x14'),'fields':[_0xc175('0xc'),_0xc175('0x15')]},{'unique':!![],'name':_0xc175('0x16'),'fields':['name',_0xc175('0x17')]},{'unique':!![],'name':_0xc175('0x18'),'fields':[_0xc175('0xc'),_0xc175('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index dfecb4b..6e82f37 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 _0x8d05=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x26b10d,_0x20660d){var _0x11db94=function(_0x5d641b){while(--_0x5d641b){_0x26b10d['push'](_0x26b10d['shift']());}};_0x11db94(++_0x20660d);}(_0x8d05,0x17f));var _0x58d0=function(_0x120ec1,_0x7e8808){_0x120ec1=_0x120ec1-0x0;var _0x4f4a56=_0x8d05[_0x120ec1];return _0x4f4a56;};'use strict';var _=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var moment=require(_0x58d0('0x2'));var BPromise=require(_0x58d0('0x3'));var rs=require(_0x58d0('0x4'));var fs=require('fs');var Redis=require(_0x58d0('0x5'));var db=require(_0x58d0('0x6'))['db'];var utils=require(_0x58d0('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x58d0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x58d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42484f,_0xee5090,_0x3fc24f){return new BPromise(function(_0x2da3b9,_0x3ef7d6){return client['request'](_0x42484f,_0x3fc24f)['then'](function(_0x80adbb){logger[_0x58d0('0xa')](_0x58d0('0xb'),_0xee5090,'request\x20sent');logger[_0x58d0('0xc')](_0x58d0('0xd'),_0xee5090,_0x58d0('0xe'),JSON[_0x58d0('0xf')](_0x80adbb));if(_0x80adbb[_0x58d0('0x10')]){if(_0x80adbb['error'][_0x58d0('0x11')]===0x1f4){logger[_0x58d0('0x10')](_0x58d0('0xb'),_0xee5090,_0x80adbb[_0x58d0('0x10')]['message']);return _0x3ef7d6(_0x80adbb[_0x58d0('0x10')]['message']);}logger[_0x58d0('0x10')](_0x58d0('0xb'),_0xee5090,_0x80adbb['error'][_0x58d0('0x12')]);return _0x2da3b9(_0x80adbb[_0x58d0('0x10')]['message']);}else{logger[_0x58d0('0xa')](_0x58d0('0xb'),_0xee5090,_0x58d0('0xe'));_0x2da3b9(_0x80adbb['result'][_0x58d0('0x12')]);}})[_0x58d0('0x13')](function(_0x2c5f91){logger[_0x58d0('0x10')](_0x58d0('0xb'),_0xee5090,_0x2c5f91);_0x3ef7d6(_0x2c5f91);});});} \ No newline at end of file +var _0xc78c=['info','Disposition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then'];(function(_0x8ae7dc,_0x328c03){var _0x173d09=function(_0x23a6d3){while(--_0x23a6d3){_0x8ae7dc['push'](_0x8ae7dc['shift']());}};_0x173d09(++_0x328c03);}(_0xc78c,0x1ab));var _0xcc78=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc78c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xcc78('0x0'));var util=require(_0xcc78('0x1'));var moment=require('moment');var BPromise=require(_0xcc78('0x2'));var rs=require(_0xcc78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc78('0x4'))['db'];var utils=require(_0xcc78('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcc78('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcc78('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b5072,_0x536e50,_0x247ecd){return new BPromise(function(_0x1d1e80,_0x12c011){return client[_0xcc78('0x8')](_0x2b5072,_0x247ecd)[_0xcc78('0x9')](function(_0xd47069){logger[_0xcc78('0xa')](_0xcc78('0xb'),_0x536e50,_0xcc78('0xc'));logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x536e50,_0xcc78('0xc'),JSON[_0xcc78('0xd')](_0xd47069));if(_0xd47069[_0xcc78('0xe')]){if(_0xd47069[_0xcc78('0xe')][_0xcc78('0xf')]===0x1f4){logger[_0xcc78('0xe')](_0xcc78('0xb'),_0x536e50,_0xd47069['error'][_0xcc78('0x10')]);return _0x12c011(_0xd47069[_0xcc78('0xe')][_0xcc78('0x10')]);}logger[_0xcc78('0xe')](_0xcc78('0xb'),_0x536e50,_0xd47069[_0xcc78('0xe')]['message']);return _0x1d1e80(_0xd47069['error'][_0xcc78('0x10')]);}else{logger['info'](_0xcc78('0xb'),_0x536e50,_0xcc78('0xc'));_0x1d1e80(_0xd47069[_0xcc78('0x11')][_0xcc78('0x10')]);}})[_0xcc78('0x12')](function(_0x41dd78){logger[_0xcc78('0xe')](_0xcc78('0xb'),_0x536e50,_0x41dd78);_0x12c011(_0x41dd78);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 6bc0be1..f5b0ee4 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 _0xdf92=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x33e242,_0x5f5b3c){var _0x14f8b0=function(_0x4cb481){while(--_0x4cb481){_0x33e242['push'](_0x33e242['shift']());}};_0x14f8b0(++_0x5f5b3c);}(_0xdf92,0x10c));var _0x2df9=function(_0x32c2e7,_0x751335){_0x32c2e7=_0x32c2e7-0x0;var _0x1f3c90=_0xdf92[_0x32c2e7];return _0x1f3c90;};'use strict';var multer=require(_0x2df9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2df9('0x1'));var express=require(_0x2df9('0x2'));var router=express[_0x2df9('0x3')]();var auth=require(_0x2df9('0x4'));var interaction=require(_0x2df9('0x5'));var config=require(_0x2df9('0x6'));var controller=require(_0x2df9('0x7'));router[_0x2df9('0x8')]('/',auth[_0x2df9('0x9')](),controller[_0x2df9('0xa')]);router['get'](_0x2df9('0xb'),auth[_0x2df9('0x9')](),controller[_0x2df9('0xc')]);router[_0x2df9('0xd')]('/',auth[_0x2df9('0x9')](),controller['create']);router[_0x2df9('0xe')](_0x2df9('0xb'),auth[_0x2df9('0x9')](),controller[_0x2df9('0xf')]);router[_0x2df9('0x10')](_0x2df9('0xb'),auth[_0x2df9('0x9')](),controller[_0x2df9('0x11')]);module[_0x2df9('0x12')]=router; \ No newline at end of file +var _0x1aab=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy'];(function(_0x318c66,_0x5f5263){var _0x340af5=function(_0x3b22d0){while(--_0x3b22d0){_0x318c66['push'](_0x318c66['shift']());}};_0x340af5(++_0x5f5263);}(_0x1aab,0x122));var _0xb1aa=function(_0x56b029,_0x20c6f4){_0x56b029=_0x56b029-0x0;var _0x15dd11=_0x1aab[_0x56b029];return _0x15dd11;};'use strict';var multer=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var path=require(_0xb1aa('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1aa('0x3'));var router=express['Router']();var auth=require(_0xb1aa('0x4'));var interaction=require(_0xb1aa('0x5'));var config=require(_0xb1aa('0x6'));var controller=require(_0xb1aa('0x7'));router[_0xb1aa('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb1aa('0x8')](_0xb1aa('0x9'),auth[_0xb1aa('0xa')](),controller[_0xb1aa('0xb')]);router[_0xb1aa('0xc')]('/',auth[_0xb1aa('0xa')](),controller[_0xb1aa('0xd')]);router['put'](_0xb1aa('0x9'),auth[_0xb1aa('0xa')](),controller['update']);router[_0xb1aa('0xe')](_0xb1aa('0x9'),auth[_0xb1aa('0xa')](),controller[_0xb1aa('0xf')]);module[_0xb1aa('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 52acca6..e258165 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 _0x5359=['yes','localstationid','2400','4800','7200','14400','12000','v17,v27,v29','INTEGER','KHOMP','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','setDataValue','exports','STRING','ENUM'];(function(_0x5157c5,_0x491c23){var _0x222f93=function(_0x2f45e1){while(--_0x2f45e1){_0x5157c5['push'](_0x5157c5['shift']());}};_0x222f93(++_0x491c23);}(_0x5359,0x140));var _0x9535=function(_0xa12dfd,_0x16b481){_0xa12dfd=_0xa12dfd-0x0;var _0x345dba=_0x5359[_0xa12dfd];return _0x345dba;};'use strict';var Sequelize=require('sequelize');module[_0x9535('0x0')]={'name':{'type':Sequelize[_0x9535('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9535('0x1')]},'ecm':{'type':Sequelize[_0x9535('0x2')](_0x9535('0x3'),'no'),'defaultValue':_0x9535('0x3')},'headerinfo':{'type':Sequelize[_0x9535('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x9535('0x4')},'minrate':{'type':Sequelize[_0x9535('0x2')](_0x9535('0x5'),_0x9535('0x6'),_0x9535('0x7'),'9600','12000',_0x9535('0x8')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x9535('0x2')]('2400',_0x9535('0x6'),_0x9535('0x7'),'9600',_0x9535('0x9'),_0x9535('0x8')),'defaultValue':_0x9535('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x9535('0xa')},'gateway':{'type':Sequelize[_0x9535('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[_0x9535('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX','DADHI',_0x9535('0xc')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x9535('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9535('0xd')],'defaultValue':function(){return _0x9535('0xe');}},'notificationSound':{'type':Sequelize[_0x9535('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9535('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9535('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9535('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9535('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x9535('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9535('0x11'),'set':function(_0x4911c0){if(!_0x4911c0)this[_0x9535('0x12')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x4911c0);}}}; \ No newline at end of file +var _0xfddd=['4800','7200','12000','14400','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400'];(function(_0x452c43,_0x44f5c8){var _0x25a8de=function(_0x2837ae){while(--_0x2837ae){_0x452c43['push'](_0x452c43['shift']());}};_0x25a8de(++_0x44f5c8);}(_0xfddd,0x14a));var _0xdfdd=function(_0x405a2c,_0x49f67c){_0x405a2c=_0x405a2c-0x0;var _0x51408e=_0xfddd[_0x405a2c];return _0x51408e;};'use strict';var Sequelize=require(_0xdfdd('0x0'));module['exports']={'name':{'type':Sequelize[_0xdfdd('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdfdd('0x1')]},'ecm':{'type':Sequelize[_0xdfdd('0x2')]('yes','no'),'defaultValue':_0xdfdd('0x3')},'headerinfo':{'type':Sequelize[_0xdfdd('0x1')],'defaultValue':_0xdfdd('0x4')},'localstationid':{'type':Sequelize[_0xdfdd('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xdfdd('0x2')](_0xdfdd('0x5'),_0xdfdd('0x6'),_0xdfdd('0x7'),'9600',_0xdfdd('0x8'),_0xdfdd('0x9')),'defaultValue':_0xdfdd('0x6')},'maxrate':{'type':Sequelize[_0xdfdd('0x2')]('2400',_0xdfdd('0x6'),_0xdfdd('0x7'),_0xdfdd('0xa'),_0xdfdd('0x8'),_0xdfdd('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xdfdd('0xb')},'gateway':{'type':Sequelize[_0xdfdd('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xdfdd('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xdfdd('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xdfdd('0xd'),_0xdfdd('0xe'),_0xdfdd('0xf'),_0xdfdd('0x10')),'defaultValue':_0xdfdd('0xd')},'key':{'type':Sequelize[_0xdfdd('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdfdd('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdfdd('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdfdd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdfdd('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdfdd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdfdd('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdfdd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdfdd('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xdfdd('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xdfdd('0x12')],'defaultValue':![],'comment':_0xdfdd('0x14'),'set':function(_0x495f88){if(!_0x495f88)this[_0xdfdd('0x15')](_0xdfdd('0x16'),null);this[_0xdfdd('0x15')](_0xdfdd('0x17'),_0x495f88);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 52a43a3..7853748 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 _0xf071=['CannedAnswer','length','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','rawAttributes','CmContact','Contact','User','fullname','internal','color','tag','addApplications','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','Wait','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','List','Contacts','DESC','attachments','join','server/files/attachments','basename','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','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','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','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','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','FaxAccounts','destroy','end','stack','name','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','rows','show','include','find','create','body','role','user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','FaxAccountId','Disposition','findOne','order','sort','findAll','removeDispositions','ids','addAnswer','getAnswers'];(function(_0x36f04d,_0x5694f9){var _0x2ad739=function(_0x20f91d){while(--_0x20f91d){_0x36f04d['push'](_0x36f04d['shift']());}};_0x2ad739(++_0x5694f9);}(_0xf071,0x117));var _0x1f07=function(_0x8897be,_0x17803f){_0x8897be=_0x8897be-0x0;var _0x33684a=_0xf071[_0x8897be];return _0x33684a;};'use strict';var pdf=require(_0x1f07('0x0'));var emlformat=require(_0x1f07('0x1'));var rimraf=require(_0x1f07('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f07('0x3'));var rp=require('request-promise');var moment=require(_0x1f07('0x4'));var BPromise=require(_0x1f07('0x5'));var Mustache=require(_0x1f07('0x6'));var util=require(_0x1f07('0x7'));var path=require(_0x1f07('0x8'));var sox=require('sox');var csv=require(_0x1f07('0x9'));var ejs=require(_0x1f07('0xa'));var fs=require('fs');var _=require(_0x1f07('0xb'));var squel=require(_0x1f07('0xc'));var crypto=require(_0x1f07('0xd'));var jsforce=require(_0x1f07('0xe'));var deskjs=require(_0x1f07('0xf'));var toCsv=require(_0x1f07('0x9'));var querystring=require('querystring');var Papa=require(_0x1f07('0x10'));var Redis=require(_0x1f07('0x11'));var authService=require(_0x1f07('0x12'));var qs=require(_0x1f07('0x13'));var as=require(_0x1f07('0x14'));var hardwareService=require(_0x1f07('0x15'));var logger=require(_0x1f07('0x16'))('api');var utils=require(_0x1f07('0x17'));var config=require(_0x1f07('0x18'));var db=require(_0x1f07('0x19'))['db'];config[_0x1f07('0x1a')]=_[_0x1f07('0x1b')](config['redis'],{'host':_0x1f07('0x1c'),'port':0x18eb});var socket=require(_0x1f07('0x1d'))(new Redis(config[_0x1f07('0x1a')]));require('./faxAccount.socket')[_0x1f07('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1f07('0x1f')][_0x1f07('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x1f07('0x20')]({'port':0x232a});function checkPasswordPattern(_0x21e71c,_0x3d1798,_0x1eb667){if(_0x1eb667){var _0x3b9ad7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b9ad7[_0x1f07('0x21')](_0x3d1798)){return _0x21e71c;}else{throw new db[(_0x1f07('0x22'))][(_0x1f07('0x23'))](_0x1f07('0x24'));}}else{return _0x21e71c;}}function respondWithRpcPromise(_0x506051,_0x27512f,_0x33d9b2,_0x21bc16){return new BPromise(function(_0x5d256b,_0x49d7bf){var _0x49316b=_0x21bc16||client;return _0x49316b[_0x1f07('0x25')](_0x506051,_0x33d9b2)[_0x1f07('0x26')](function(_0x220c71){logger[_0x1f07('0x27')](_0x1f07('0x28'),_0x27512f,_0x1f07('0x29'));logger[_0x1f07('0x2a')](_0x1f07('0x2b'),_0x27512f,_0x1f07('0x29'),JSON[_0x1f07('0x2c')](_0x220c71));if(_0x220c71[_0x1f07('0x2d')]){if(_0x220c71[_0x1f07('0x2d')][_0x1f07('0x2e')]===0x1f4){logger[_0x1f07('0x2d')](_0x1f07('0x28'),_0x27512f,_0x220c71['error'][_0x1f07('0x2f')]);return _0x49d7bf(_0x220c71[_0x1f07('0x2d')][_0x1f07('0x2f')]);}logger[_0x1f07('0x2d')]('FaxAccount,\x20%s,\x20%s',_0x27512f,_0x220c71[_0x1f07('0x2d')]['message']);return _0x5d256b(_0x220c71['error'][_0x1f07('0x2f')]);}else{logger[_0x1f07('0x27')](_0x1f07('0x28'),_0x27512f,_0x1f07('0x29'));_0x5d256b(_0x220c71[_0x1f07('0x30')][_0x1f07('0x2f')]);}})[_0x1f07('0x31')](function(_0x5e3594){logger[_0x1f07('0x2d')]('FaxAccount,\x20%s,\x20%s',_0x27512f,_0x5e3594);_0x49d7bf(_0x5e3594);});});}function respondWithStatusCode(_0x571ec0,_0x4dc560){_0x4dc560=_0x4dc560||0xcc;return function(_0x26bebe){if(_0x26bebe){return _0x571ec0[_0x1f07('0x32')](_0x4dc560);}return _0x571ec0['status'](_0x4dc560)['end']();};}function respondWithResult(_0x16cdec,_0xd7e673){_0xd7e673=_0xd7e673||0xc8;return function(_0x1eb39){if(_0x1eb39){return _0x16cdec[_0x1f07('0x33')](_0xd7e673)[_0x1f07('0x34')](_0x1eb39);}};}function respondWithFilteredResult(_0x39b912,_0x107c82){return function(_0x276e04){if(_0x276e04){var _0x4c7152=_0x276e04[_0x1f07('0x35')],_0x1ab665=_0x107c82[_0x1f07('0x36')],_0x404a02=_0x107c82[_0x1f07('0x36')]+_0x107c82[_0x1f07('0x37')],_0x2e6122;if(_0x404a02>=_0x4c7152){_0x404a02=_0x4c7152;_0x2e6122=0xc8;}else{_0x2e6122=0xce;}_0x39b912[_0x1f07('0x33')](_0x2e6122);return _0x39b912[_0x1f07('0x38')](_0x1f07('0x39'),_0x1ab665+'-'+_0x404a02+'/'+_0x4c7152)[_0x1f07('0x34')](_0x276e04);}return null;};}function patchUpdates(_0x37c8b6){return function(_0x1705ce){try{jsonpatch[_0x1f07('0x3a')](_0x1705ce,_0x37c8b6,!![]);}catch(_0x2a30c9){return BPromise['reject'](_0x2a30c9);}return _0x1705ce['save']();};}function saveUpdates(_0x5c99c2,_0x2c6d85){return function(_0xf478e){if(_0xf478e){return _0xf478e['update'](_0x5c99c2)[_0x1f07('0x26')](function(_0x340a64){return _0x340a64;});}return null;};}function removeEntity(_0x5512ee,_0x1ac5b4){return function(_0x3b42f1){if(_0x3b42f1){return _0x3b42f1['destroy']()[_0x1f07('0x26')](function(){var _0x8d9eea=_0x3b42f1['get']({'plain':!![]});var _0x4e51c6=_0x1f07('0x3b');return db['UserProfileResource'][_0x1f07('0x3c')]({'where':{'type':_0x4e51c6,'resourceId':_0x8d9eea['id']}})[_0x1f07('0x26')](function(){return _0x3b42f1;});})[_0x1f07('0x26')](function(){_0x5512ee['status'](0xcc)[_0x1f07('0x3d')]();});}};}function handleEntityNotFound(_0x4cdf85,_0x4fb558){return function(_0x5ac358){if(!_0x5ac358){_0x4cdf85[_0x1f07('0x32')](0x194);}return _0x5ac358;};}function handleError(_0x4671e6,_0x3a6b14){_0x3a6b14=_0x3a6b14||0x1f4;return function(_0x258de3){logger[_0x1f07('0x2d')](_0x258de3[_0x1f07('0x3e')]);if(_0x258de3[_0x1f07('0x3f')]){delete _0x258de3[_0x1f07('0x3f')];}_0x4671e6[_0x1f07('0x33')](_0x3a6b14)['send'](_0x258de3);};}exports['index']=function(_0x5862a4,_0x276760){var _0x58e49d={'include':[{'model':db[_0x1f07('0x40')],'as':_0x1f07('0x41')}]},_0x3ff2c6={},_0x32407c={'count':0x0,'rows':[]};var _0x59488d=_[_0x1f07('0x42')](db[_0x1f07('0x43')]['rawAttributes'],function(_0x3a2ea6){return{'name':_0x3a2ea6[_0x1f07('0x44')],'type':_0x3a2ea6[_0x1f07('0x45')][_0x1f07('0x46')]};});_0x3ff2c6[_0x1f07('0x47')]=_[_0x1f07('0x42')](_0x59488d,_0x1f07('0x3f'));_0x3ff2c6['query']=_[_0x1f07('0x48')](_0x5862a4[_0x1f07('0x49')]);_0x3ff2c6[_0x1f07('0x4a')]=_[_0x1f07('0x4b')](_0x3ff2c6[_0x1f07('0x47')],_0x3ff2c6['query']);_0x58e49d[_0x1f07('0x4c')]=_[_0x1f07('0x4b')](_0x3ff2c6[_0x1f07('0x47')],qs[_0x1f07('0x4d')](_0x5862a4[_0x1f07('0x49')][_0x1f07('0x4d')]));_0x58e49d[_0x1f07('0x4c')]=_0x58e49d[_0x1f07('0x4c')]['length']?_0x58e49d['attributes']:_0x3ff2c6[_0x1f07('0x47')];if(!_0x5862a4[_0x1f07('0x49')][_0x1f07('0x4e')](_0x1f07('0x4f'))){_0x58e49d['limit']=qs[_0x1f07('0x37')](_0x5862a4[_0x1f07('0x49')]['limit']);_0x58e49d[_0x1f07('0x36')]=qs[_0x1f07('0x36')](_0x5862a4['query'][_0x1f07('0x36')]);}_0x58e49d['order']=qs['sort'](_0x5862a4[_0x1f07('0x49')]['sort']);_0x58e49d[_0x1f07('0x50')]=qs['filters'](_[_0x1f07('0x51')](_0x5862a4[_0x1f07('0x49')],_0x3ff2c6[_0x1f07('0x4a')]),_0x59488d);if(_0x5862a4[_0x1f07('0x49')][_0x1f07('0x52')]){_0x58e49d[_0x1f07('0x50')]=_['merge'](_0x58e49d[_0x1f07('0x50')],{'$or':_['map'](_0x59488d,function(_0x26e44a){if(_0x26e44a['type']!=='VIRTUAL'){var _0x22ffb7={};_0x22ffb7[_0x26e44a['name']]={'$like':'%'+_0x5862a4[_0x1f07('0x49')][_0x1f07('0x52')]+'%'};return _0x22ffb7;}})});}_0x58e49d=_[_0x1f07('0x53')]({},_0x58e49d,_0x5862a4[_0x1f07('0x54')]);var _0x42286c={'where':_0x58e49d[_0x1f07('0x50')]};return db[_0x1f07('0x43')][_0x1f07('0x35')](_0x42286c)[_0x1f07('0x26')](function(_0x41bf1c){_0x32407c[_0x1f07('0x35')]=_0x41bf1c;if(_0x5862a4[_0x1f07('0x49')][_0x1f07('0x55')]){_0x58e49d['include']=[{'all':!![]}];}return db[_0x1f07('0x43')]['findAll'](_0x58e49d);})[_0x1f07('0x26')](function(_0x2831ec){_0x32407c[_0x1f07('0x56')]=_0x2831ec;return _0x32407c;})[_0x1f07('0x26')](respondWithFilteredResult(_0x276760,_0x58e49d))[_0x1f07('0x31')](handleError(_0x276760,null));};exports[_0x1f07('0x57')]=function(_0x28d373,_0x1bc2c9){var _0x8a9fe5={'raw':![],'where':{'id':_0x28d373['params']['id']},'include':[{'model':db[_0x1f07('0x40')],'as':_0x1f07('0x41')}]},_0x53c5db={};_0x53c5db['model']=_[_0x1f07('0x48')](db[_0x1f07('0x43')]['rawAttributes']);_0x53c5db['query']=_['keys'](_0x28d373[_0x1f07('0x49')]);_0x53c5db['filters']=_[_0x1f07('0x4b')](_0x53c5db['model'],_0x53c5db['query']);_0x8a9fe5[_0x1f07('0x4c')]=_[_0x1f07('0x4b')](_0x53c5db[_0x1f07('0x47')],qs['fields'](_0x28d373[_0x1f07('0x49')][_0x1f07('0x4d')]));_0x8a9fe5[_0x1f07('0x4c')]=_0x8a9fe5[_0x1f07('0x4c')]['length']?_0x8a9fe5['attributes']:_0x53c5db['model'];if(_0x28d373[_0x1f07('0x49')][_0x1f07('0x55')]){_0x8a9fe5[_0x1f07('0x58')]=[{'all':!![]}];}_0x8a9fe5=_[_0x1f07('0x53')]({},_0x8a9fe5,_0x28d373['options']);return db[_0x1f07('0x43')][_0x1f07('0x59')](_0x8a9fe5)[_0x1f07('0x26')](handleEntityNotFound(_0x1bc2c9,null))['then'](respondWithResult(_0x1bc2c9,null))[_0x1f07('0x31')](handleError(_0x1bc2c9,null));};exports[_0x1f07('0x5a')]=function(_0x51d657,_0xdfb8a1){return db['FaxAccount']['create'](_0x51d657[_0x1f07('0x5b')],{})[_0x1f07('0x26')](function(_0x16c8b3){var _0x363fe2=_0x51d657['user']['get']({'plain':!![]});if(!_0x363fe2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x363fe2[_0x1f07('0x5c')]===_0x1f07('0x5d')){var _0x154681=_0x16c8b3[_0x1f07('0x5e')]({'plain':!![]});var _0x5ebeac=_0x1f07('0x3b');return db[_0x1f07('0x5f')]['find']({'where':{'name':_0x5ebeac,'userProfileId':_0x363fe2['userProfileId']},'raw':!![]})[_0x1f07('0x26')](function(_0x329956){if(_0x329956&&_0x329956[_0x1f07('0x60')]===0x0){return db[_0x1f07('0x61')][_0x1f07('0x5a')]({'name':_0x154681[_0x1f07('0x3f')],'resourceId':_0x154681['id'],'type':_0x329956['name'],'sectionId':_0x329956['id']},{})['then'](function(){return _0x16c8b3;});}else{return _0x16c8b3;}})[_0x1f07('0x31')](function(_0x3a0eef){logger[_0x1f07('0x2d')](_0x1f07('0x62'),_0x3a0eef);throw _0x3a0eef;});}return _0x16c8b3;})[_0x1f07('0x26')](respondWithResult(_0xdfb8a1,0xc9))[_0x1f07('0x31')](handleError(_0xdfb8a1,null));};exports[_0x1f07('0x63')]=function(_0x2b7599,_0x19305c){if(_0x2b7599[_0x1f07('0x5b')]['id']){delete _0x2b7599['body']['id'];}return db[_0x1f07('0x43')][_0x1f07('0x59')]({'where':{'id':_0x2b7599[_0x1f07('0x64')]['id']},'include':[{'model':db[_0x1f07('0x40')],'as':_0x1f07('0x41')}]})[_0x1f07('0x26')](handleEntityNotFound(_0x19305c,null))[_0x1f07('0x26')](saveUpdates(_0x2b7599[_0x1f07('0x5b')],null))[_0x1f07('0x26')](respondWithResult(_0x19305c,null))[_0x1f07('0x31')](handleError(_0x19305c,null));};exports['destroy']=function(_0x8b933b,_0x4c5d05){return db['FaxAccount'][_0x1f07('0x59')]({'where':{'id':_0x8b933b[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x4c5d05,null))[_0x1f07('0x26')](removeEntity(_0x4c5d05,null))[_0x1f07('0x31')](handleError(_0x4c5d05,null));};exports[_0x1f07('0x65')]=function(_0x49e7fd,_0x251ddd){return db[_0x1f07('0x43')]['describe']()[_0x1f07('0x26')](respondWithResult(_0x251ddd,null))[_0x1f07('0x31')](handleError(_0x251ddd,null));};exports[_0x1f07('0x66')]=function(_0x3cf721,_0x51e634,_0x199b4e){if(_0x3cf721[_0x1f07('0x5b')]['id']){delete _0x3cf721[_0x1f07('0x5b')]['id'];}return db[_0x1f07('0x43')]['find']({'where':{'id':_0x3cf721[_0x1f07('0x64')]['id']}})['then'](handleEntityNotFound(_0x51e634,null))['then'](function(_0x5017f4){if(_0x5017f4){_0x3cf721[_0x1f07('0x5b')][_0x1f07('0x67')]=_0x5017f4['id'];return db[_0x1f07('0x68')][_0x1f07('0x5a')](_0x3cf721[_0x1f07('0x5b')]);}})['then'](respondWithResult(_0x51e634,null))[_0x1f07('0x31')](handleError(_0x51e634,null));};exports['getDispositions']=function(_0x12740c,_0xdcb70c,_0x177305){var _0x2c33eb={'raw':![],'where':{}};var _0x41742d={};var _0x441bdb={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1f07('0x69')]({'where':{'id':_0x12740c[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0xdcb70c,null))['then'](function(_0x3b1766){if(_0x3b1766){_0x41742d[_0x1f07('0x47')]=_[_0x1f07('0x48')](db[_0x1f07('0x68')]['rawAttributes']);_0x41742d['query']=_['keys'](_0x12740c[_0x1f07('0x49')]);_0x41742d['filters']=_[_0x1f07('0x4b')](_0x41742d['model'],_0x41742d['query']);_0x2c33eb[_0x1f07('0x4c')]=_[_0x1f07('0x4b')](_0x41742d[_0x1f07('0x47')],qs[_0x1f07('0x4d')](_0x12740c['query'][_0x1f07('0x4d')]));_0x2c33eb['attributes']=_0x2c33eb[_0x1f07('0x4c')]['length']?_0x2c33eb[_0x1f07('0x4c')]:_0x41742d[_0x1f07('0x47')];if(!_0x12740c[_0x1f07('0x49')][_0x1f07('0x4e')]('nolimit')){_0x2c33eb[_0x1f07('0x37')]=qs['limit'](_0x12740c[_0x1f07('0x49')][_0x1f07('0x37')]);_0x2c33eb['offset']=qs[_0x1f07('0x36')](_0x12740c[_0x1f07('0x49')][_0x1f07('0x36')]);}_0x2c33eb[_0x1f07('0x6a')]=qs[_0x1f07('0x6b')](_0x12740c['query'][_0x1f07('0x6b')]);_0x2c33eb[_0x1f07('0x50')]=qs[_0x1f07('0x4a')](_[_0x1f07('0x51')](_0x12740c[_0x1f07('0x49')],_0x41742d['filters']));_0x2c33eb['where'][_0x1f07('0x67')]=_0x3b1766['id'];if(_0x12740c[_0x1f07('0x49')][_0x1f07('0x52')]){_0x2c33eb[_0x1f07('0x50')]=_[_0x1f07('0x53')](_0x2c33eb[_0x1f07('0x50')],{'$or':_[_0x1f07('0x42')](_0x2c33eb[_0x1f07('0x4c')],function(_0x57b69f){var _0x4abba5={};_0x4abba5[_0x57b69f]={'$like':'%'+_0x12740c[_0x1f07('0x49')]['filter']+'%'};return _0x4abba5;})});}_0x2c33eb=_[_0x1f07('0x53')]({},_0x2c33eb,_0x12740c[_0x1f07('0x54')]);return db[_0x1f07('0x68')][_0x1f07('0x35')]({'where':_0x2c33eb[_0x1f07('0x50')]})[_0x1f07('0x26')](function(_0x5a0f59){_0x441bdb[_0x1f07('0x35')]=_0x5a0f59;if(_0x12740c[_0x1f07('0x49')]['includeAll']){_0x2c33eb[_0x1f07('0x58')]=[{'all':!![]}];}return db[_0x1f07('0x68')][_0x1f07('0x6c')](_0x2c33eb);})[_0x1f07('0x26')](function(_0x15a51b){_0x441bdb[_0x1f07('0x56')]=_0x15a51b;return _0x441bdb;});}})[_0x1f07('0x26')](respondWithFilteredResult(_0xdcb70c,_0x2c33eb))['catch'](handleError(_0xdcb70c,null));};exports[_0x1f07('0x6d')]=function(_0x49a544,_0xe466b3,_0xaea92f){return db[_0x1f07('0x43')][_0x1f07('0x59')]({'where':{'id':_0x49a544[_0x1f07('0x64')]['id']}})['then'](handleEntityNotFound(_0xe466b3,null))['then'](function(_0x368f57){if(_0x368f57){return _0x368f57[_0x1f07('0x6d')](_0x49a544[_0x1f07('0x49')][_0x1f07('0x6e')]);}})[_0x1f07('0x26')](respondWithStatusCode(_0xe466b3,null))[_0x1f07('0x31')](handleError(_0xe466b3,null));};exports[_0x1f07('0x6f')]=function(_0x184b4d,_0x46a4fa,_0x1f7d0c){if(_0x184b4d[_0x1f07('0x5b')]['id']){delete _0x184b4d[_0x1f07('0x5b')]['id'];}return db[_0x1f07('0x43')][_0x1f07('0x59')]({'where':{'id':_0x184b4d['params']['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x46a4fa,null))[_0x1f07('0x26')](function(_0x2d54fe){if(_0x2d54fe){_0x184b4d['body'][_0x1f07('0x67')]=_0x2d54fe['id'];return db['CannedAnswer'][_0x1f07('0x5a')](_0x184b4d[_0x1f07('0x5b')]);}})['then'](respondWithResult(_0x46a4fa,null))[_0x1f07('0x31')](handleError(_0x46a4fa,null));};exports[_0x1f07('0x70')]=function(_0x4cad64,_0x43674e,_0x449da7){var _0x739855={'raw':![],'where':{}};var _0x3dcd47={};var _0x5f5837={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4cad64[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x43674e,null))[_0x1f07('0x26')](function(_0x1da940){if(_0x1da940){_0x3dcd47[_0x1f07('0x47')]=_[_0x1f07('0x48')](db[_0x1f07('0x71')]['rawAttributes']);_0x3dcd47[_0x1f07('0x49')]=_[_0x1f07('0x48')](_0x4cad64['query']);_0x3dcd47[_0x1f07('0x4a')]=_[_0x1f07('0x4b')](_0x3dcd47['model'],_0x3dcd47['query']);_0x739855[_0x1f07('0x4c')]=_[_0x1f07('0x4b')](_0x3dcd47[_0x1f07('0x47')],qs[_0x1f07('0x4d')](_0x4cad64['query'][_0x1f07('0x4d')]));_0x739855[_0x1f07('0x4c')]=_0x739855[_0x1f07('0x4c')][_0x1f07('0x72')]?_0x739855[_0x1f07('0x4c')]:_0x3dcd47[_0x1f07('0x47')];if(!_0x4cad64[_0x1f07('0x49')][_0x1f07('0x4e')]('nolimit')){_0x739855[_0x1f07('0x37')]=qs[_0x1f07('0x37')](_0x4cad64[_0x1f07('0x49')][_0x1f07('0x37')]);_0x739855['offset']=qs['offset'](_0x4cad64[_0x1f07('0x49')]['offset']);}_0x739855[_0x1f07('0x6a')]=qs[_0x1f07('0x6b')](_0x4cad64[_0x1f07('0x49')]['sort']);_0x739855['where']=qs[_0x1f07('0x4a')](_[_0x1f07('0x51')](_0x4cad64['query'],_0x3dcd47[_0x1f07('0x4a')]));_0x739855[_0x1f07('0x50')][_0x1f07('0x67')]=_0x1da940['id'];if(_0x4cad64['query']['filter']){_0x739855[_0x1f07('0x50')]=_[_0x1f07('0x53')](_0x739855[_0x1f07('0x50')],{'$or':_[_0x1f07('0x42')](_0x739855['attributes'],function(_0x201b88){var _0xe4afcb={};_0xe4afcb[_0x201b88]={'$like':'%'+_0x4cad64[_0x1f07('0x49')]['filter']+'%'};return _0xe4afcb;})});}_0x739855=_[_0x1f07('0x53')]({},_0x739855,_0x4cad64[_0x1f07('0x54')]);return db[_0x1f07('0x71')][_0x1f07('0x35')]({'where':_0x739855[_0x1f07('0x50')]})['then'](function(_0x3423cb){_0x5f5837['count']=_0x3423cb;if(_0x4cad64[_0x1f07('0x49')][_0x1f07('0x55')]){_0x739855[_0x1f07('0x58')]=[{'all':!![]}];}return db[_0x1f07('0x71')][_0x1f07('0x6c')](_0x739855);})[_0x1f07('0x26')](function(_0x5acb44){_0x5f5837[_0x1f07('0x56')]=_0x5acb44;return _0x5f5837;});}})[_0x1f07('0x26')](respondWithFilteredResult(_0x43674e,_0x739855))[_0x1f07('0x31')](handleError(_0x43674e,null));};exports[_0x1f07('0x73')]=function(_0x1de185,_0x1622c4,_0x36d4da){return db[_0x1f07('0x43')]['find']({'where':{'id':_0x1de185[_0x1f07('0x64')]['id']}})['then'](handleEntityNotFound(_0x1622c4,null))[_0x1f07('0x26')](function(_0x54dda5){if(_0x54dda5){return _0x54dda5[_0x1f07('0x73')](_0x1de185[_0x1f07('0x49')][_0x1f07('0x6e')]);}})[_0x1f07('0x26')](respondWithStatusCode(_0x1622c4,null))[_0x1f07('0x31')](handleError(_0x1622c4,null));};exports[_0x1f07('0x74')]=function(_0x312805,_0x5b215d,_0x5ee1a4){return db[_0x1f07('0x75')]['find']({'where':{'id':_0x312805[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x5b215d,null))[_0x1f07('0x26')](function(_0x3f7b51){if(_0x3f7b51){return _0x3f7b51[_0x1f07('0x74')](_0x312805[_0x1f07('0x5b')][_0x1f07('0x6e')],_[_0x1f07('0x76')](_0x312805['body'],[_0x1f07('0x6e'),'id'])||{});}})[_0x1f07('0x26')](respondWithResult(_0x5b215d,null))[_0x1f07('0x31')](handleError(_0x5b215d,null));};exports[_0x1f07('0x77')]=function(_0x2cfead,_0x56cd96,_0x1a9f64){var _0x50d592={'raw':![],'where':{}};var _0x2f909e={};var _0x11133f={'count':0x0,'rows':[]};return db[_0x1f07('0x43')]['findOne']({'where':{'id':_0x2cfead[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x56cd96,null))[_0x1f07('0x26')](function(_0x42aee1){if(_0x42aee1){_0x2f909e[_0x1f07('0x47')]=_[_0x1f07('0x48')](db[_0x1f07('0x75')][_0x1f07('0x78')]);_0x2f909e[_0x1f07('0x49')]=_[_0x1f07('0x48')](_0x2cfead[_0x1f07('0x49')]);_0x2f909e[_0x1f07('0x4a')]=_[_0x1f07('0x4b')](_0x2f909e[_0x1f07('0x47')],_0x2f909e[_0x1f07('0x49')]);_0x50d592[_0x1f07('0x4c')]=_['intersection'](_0x2f909e[_0x1f07('0x47')],qs['fields'](_0x2cfead[_0x1f07('0x49')][_0x1f07('0x4d')]));_0x50d592[_0x1f07('0x4c')]=_0x50d592[_0x1f07('0x4c')][_0x1f07('0x72')]?_0x50d592[_0x1f07('0x4c')]:_0x2f909e[_0x1f07('0x47')];if(!_0x2cfead[_0x1f07('0x49')][_0x1f07('0x4e')]('nolimit')){_0x50d592['limit']=qs[_0x1f07('0x37')](_0x2cfead[_0x1f07('0x49')]['limit']);_0x50d592['offset']=qs[_0x1f07('0x36')](_0x2cfead['query'][_0x1f07('0x36')]);}_0x50d592[_0x1f07('0x6a')]=qs['sort'](_0x2cfead[_0x1f07('0x49')][_0x1f07('0x6b')]);_0x50d592[_0x1f07('0x50')]=qs[_0x1f07('0x4a')](_['pick'](_0x2cfead[_0x1f07('0x49')],_0x2f909e['filters']));_0x50d592[_0x1f07('0x50')]['FaxAccountId']=_0x42aee1['id'];if(_0x2cfead[_0x1f07('0x49')][_0x1f07('0x52')]){_0x50d592[_0x1f07('0x50')]=_[_0x1f07('0x53')](_0x50d592['where'],{'$or':_[_0x1f07('0x42')](_0x50d592[_0x1f07('0x4c')],function(_0x20176c){var _0x2030d8={};_0x2030d8[_0x20176c]={'$like':'%'+_0x2cfead[_0x1f07('0x49')][_0x1f07('0x52')]+'%'};return _0x2030d8;})});}_0x50d592=_['merge']({},_0x50d592,_0x2cfead[_0x1f07('0x54')]);return db[_0x1f07('0x75')][_0x1f07('0x35')]({'where':_0x50d592[_0x1f07('0x50')]})[_0x1f07('0x26')](function(_0x2e2ba7){_0x11133f[_0x1f07('0x35')]=_0x2e2ba7;if(_0x2cfead['query']['includeAll']){_0x50d592[_0x1f07('0x58')]=[{'model':db[_0x1f07('0x79')],'as':_0x1f07('0x7a'),'required':![]},{'model':db[_0x1f07('0x7b')],'as':'Owner','attributes':[_0x1f07('0x3f'),_0x1f07('0x7c'),_0x1f07('0x7d')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x1f07('0x3f'),_0x1f07('0x7e')],'where':_0x2cfead[_0x1f07('0x49')][_0x1f07('0x7f')]?{'id':_0x2cfead['query'][_0x1f07('0x7f')]}:undefined,'required':_0x2cfead[_0x1f07('0x49')][_0x1f07('0x7f')]?!![]:![]}];}return db[_0x1f07('0x75')][_0x1f07('0x6c')](_0x50d592);})[_0x1f07('0x26')](function(_0x4221cb){_0x11133f['rows']=_0x4221cb;return _0x11133f;});}})[_0x1f07('0x26')](respondWithFilteredResult(_0x56cd96,_0x50d592))[_0x1f07('0x31')](handleError(_0x56cd96,null));};exports[_0x1f07('0x80')]=function(_0x220830,_0x59d2d1,_0x40a175){return db[_0x1f07('0x43')][_0x1f07('0x69')]({'where':{'id':_0x220830[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x59d2d1,null))[_0x1f07('0x26')](function(_0x291687){if(_0x291687){return db['sequelize'][_0x1f07('0x81')](function(_0x32432c){return db[_0x1f07('0x82')][_0x1f07('0x3c')]({'where':{'FaxAccountId':_0x220830['params']['id']},'transaction':_0x32432c})[_0x1f07('0x26')](function(_0x150fd7){var _0x5bf6d0=_[_0x1f07('0x42')](_0x220830[_0x1f07('0x5b')],function(_0x491735){_0x491735['FaxAccountId']=_0x220830[_0x1f07('0x64')]['id'];return _0x491735;});return db[_0x1f07('0x82')][_0x1f07('0x83')](_0x5bf6d0,{'transaction':_0x32432c});});})[_0x1f07('0x26')](function(){return db[_0x1f07('0x82')]['findAndCountAll']({'where':{'FaxAccountId':_0x220830[_0x1f07('0x64')]['id']},'order':_0x1f07('0x84')});});}})[_0x1f07('0x26')](respondWithResult(_0x59d2d1,null))[_0x1f07('0x31')](handleError(_0x59d2d1,null));};exports[_0x1f07('0x85')]=function(_0x2a1092,_0x295b88,_0x526237){var _0x5dab13={};var _0x1e21a6={};var _0x3cc5fd;var _0x93ab93;return db[_0x1f07('0x43')][_0x1f07('0x69')]({'where':{'id':_0x2a1092[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x295b88,null))[_0x1f07('0x26')](function(_0x505a9f){if(_0x505a9f){_0x3cc5fd=_0x505a9f;_0x1e21a6[_0x1f07('0x47')]=_[_0x1f07('0x48')](db[_0x1f07('0x82')][_0x1f07('0x78')]);_0x1e21a6[_0x1f07('0x49')]=_[_0x1f07('0x48')](_0x2a1092[_0x1f07('0x49')]);_0x1e21a6[_0x1f07('0x4a')]=_[_0x1f07('0x4b')](_0x1e21a6[_0x1f07('0x47')],_0x1e21a6['query']);_0x5dab13[_0x1f07('0x4c')]=_[_0x1f07('0x4b')](_0x1e21a6[_0x1f07('0x47')],qs['fields'](_0x2a1092[_0x1f07('0x49')][_0x1f07('0x4d')]));_0x5dab13[_0x1f07('0x4c')]=_0x5dab13[_0x1f07('0x4c')]['length']?_0x5dab13[_0x1f07('0x4c')]:_0x1e21a6[_0x1f07('0x47')];_0x5dab13[_0x1f07('0x6a')]=qs[_0x1f07('0x6b')](_0x2a1092[_0x1f07('0x49')][_0x1f07('0x6b')]);_0x5dab13['where']=qs[_0x1f07('0x4a')](_[_0x1f07('0x51')](_0x2a1092[_0x1f07('0x49')],_0x1e21a6[_0x1f07('0x4a')]));if(_0x2a1092['query'][_0x1f07('0x52')]){_0x5dab13[_0x1f07('0x50')]=_[_0x1f07('0x53')](_0x5dab13[_0x1f07('0x50')],{'$or':_[_0x1f07('0x42')](_0x5dab13['attributes'],function(_0x3fef0a){var _0x30db20={};_0x30db20[_0x3fef0a]={'$like':'%'+_0x2a1092[_0x1f07('0x49')]['filter']+'%'};return _0x30db20;})});}_0x5dab13=_[_0x1f07('0x53')]({},_0x5dab13,_0x2a1092[_0x1f07('0x54')]);return _0x3cc5fd['getApplications'](_0x5dab13);}})[_0x1f07('0x26')](function(_0x56c5df){if(_0x56c5df){_0x93ab93=_0x56c5df[_0x1f07('0x72')];if(!_0x2a1092['query']['hasOwnProperty'](_0x1f07('0x4f'))){_0x5dab13['limit']=qs['limit'](_0x2a1092[_0x1f07('0x49')][_0x1f07('0x37')]);_0x5dab13[_0x1f07('0x36')]=qs[_0x1f07('0x36')](_0x2a1092[_0x1f07('0x49')][_0x1f07('0x36')]);}return _0x3cc5fd[_0x1f07('0x85')](_0x5dab13);}})[_0x1f07('0x26')](function(_0x5179a4){if(_0x5179a4){return _0x5179a4?{'count':_0x93ab93,'rows':_0x5179a4}:null;}})[_0x1f07('0x26')](respondWithResult(_0x295b88,null))[_0x1f07('0x31')](handleError(_0x295b88,null));};function Extension(_0x319e99,_0x5d5a70,_0x2d1772,_0x1a3e9a){this[_0x1f07('0x86')]=_0x1f07('0x87');this[_0x1f07('0x88')]=_0x319e99[_0x1f07('0x89')];this[_0x1f07('0x8a')]=_0x1a3e9a;this[_0x1f07('0x45')]=_0x1f07('0x8b');this[_0x1f07('0x8c')]='Fax\x20Extension';this['FaxAccountId']=_0x319e99['id'];this['priority']=_0x5d5a70;this['appdata']=_0x2d1772;}function createExtensionsReciveFax(_0xb8f7eb){var _0x424f3d=0x1;var _0x151d96=[];_0x151d96[_0x1f07('0x8d')](new Extension(_0xb8f7eb,_0x424f3d,'',_0x1f07('0x8e')));_0x424f3d+=0x1;_0x151d96['push'](new Extension(_0xb8f7eb,_0x424f3d,_0x1f07('0x8f'),_0x1f07('0x90')));_0x424f3d+=0x1;for(var _0x3e5d22 in _0xb8f7eb){if(_0xb8f7eb['hasOwnProperty'](_0x3e5d22)&&(_0x3e5d22==='ecm'||_0x3e5d22===_0x1f07('0x89')||_0x3e5d22===_0x1f07('0x91')||_0x3e5d22===_0x1f07('0x92')||_0x3e5d22===_0x1f07('0x93')||_0x3e5d22==='maxrate'||_0x3e5d22===_0x1f07('0x94')||_0x3e5d22===_0x1f07('0x95')||_0x3e5d22===_0x1f07('0x96'))){_0x151d96[_0x1f07('0x8d')](new Extension(_0xb8f7eb,_0x424f3d,'FAXOPT('+_0x3e5d22+')='+_0xb8f7eb[_0x3e5d22],_0x1f07('0x90')));_0x424f3d+=0x1;}}_0x151d96[_0x1f07('0x8d')](new Extension(_0xb8f7eb,_0x424f3d,'6',_0x1f07('0x97')));_0x424f3d+=0x1;_0x151d96[_0x1f07('0x8d')](new Extension(_0xb8f7eb,_0x424f3d,'/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',_0x1f07('0x98')));_0x424f3d=0x0;return _0x151d96;}exports[_0x1f07('0x99')]=function(_0x14a10f,_0x5a7e31,_0x397ec7){var _0x5c323c;return db[_0x1f07('0x9a')][_0x1f07('0x81')](function(_0x195851){return db['FaxAccount'][_0x1f07('0x5a')](_0x14a10f[_0x1f07('0x5b')],{'transaction':_0x195851})['then'](function(_0x868d5d){_0x5c323c=_0x868d5d[_0x1f07('0x5e')]({'plain':!![]});return db[_0x1f07('0x9b')][_0x1f07('0x83')](createExtensionsReciveFax(_0x5c323c),{'transaction':_0x195851});});})[_0x1f07('0x26')](function(){return _0x5c323c;})['then'](respondWithResult(_0x5a7e31,null))[_0x1f07('0x31')](handleError(_0x5a7e31,null));};exports[_0x1f07('0x9c')]=function(_0x5e02a7,_0x3c73b2,_0x582792){var _0x2cb170;return db[_0x1f07('0x9a')][_0x1f07('0x81')](function(_0x52df75){return db[_0x1f07('0x43')]['update'](_0x5e02a7['body'],{'where':{'id':_0x5e02a7[_0x1f07('0x5b')]['id']},'transaction':_0x52df75})[_0x1f07('0x26')](function(_0x2e5891){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x5e02a7[_0x1f07('0x5b')]['id']},'transaction':_0x52df75})['then'](function(_0x95e8f2){return db[_0x1f07('0x9b')][_0x1f07('0x83')](createExtensionsReciveFax(_['omit'](_0x5e02a7['body'],[_0x1f07('0x9d'),_0x1f07('0x46'),_0x1f07('0x9e'),'updatedAt',_0x1f07('0x9f'),_0x1f07('0xa0')])),{'transaction':_0x52df75});});});})[_0x1f07('0x26')](function(){return db[_0x1f07('0x43')][_0x1f07('0xa1')](_0x5e02a7[_0x1f07('0x5b')]['id']);})['then'](respondWithResult(_0x3c73b2,null))[_0x1f07('0x31')](handleError(_0x3c73b2,null));};exports[_0x1f07('0xa2')]=function(_0x4824e4,_0x51bf64,_0x367490){var _0xbd0519={'raw':!![],'where':{}};var _0x4e6da8={};var _0x170393={'count':0x0,'rows':[]};return db[_0x1f07('0x43')][_0x1f07('0x69')]({'where':{'id':_0x4824e4[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x51bf64,null))[_0x1f07('0x26')](function(_0x3b5803){if(_0x3b5803){_0x4e6da8['model']=_['keys'](db[_0x1f07('0xa3')][_0x1f07('0x78')]);_0x4e6da8['query']=_[_0x1f07('0x48')](_0x4824e4['query']);_0x4e6da8[_0x1f07('0x4a')]=_[_0x1f07('0x4b')](_0x4e6da8[_0x1f07('0x47')],_0x4e6da8[_0x1f07('0x49')]);_0xbd0519['attributes']=_[_0x1f07('0x4b')](_0x4e6da8['model'],qs[_0x1f07('0x4d')](_0x4824e4[_0x1f07('0x49')]['fields']));_0xbd0519[_0x1f07('0x4c')]=_0xbd0519[_0x1f07('0x4c')][_0x1f07('0x72')]?_0xbd0519[_0x1f07('0x4c')]:_0x4e6da8[_0x1f07('0x47')];if(!_0x4824e4['query'][_0x1f07('0x4e')](_0x1f07('0x4f'))){_0xbd0519[_0x1f07('0x37')]=qs[_0x1f07('0x37')](_0x4824e4[_0x1f07('0x49')][_0x1f07('0x37')]);_0xbd0519[_0x1f07('0x36')]=qs[_0x1f07('0x36')](_0x4824e4[_0x1f07('0x49')][_0x1f07('0x36')]);}_0xbd0519[_0x1f07('0x6a')]=qs[_0x1f07('0x6b')](_0x4824e4['query'][_0x1f07('0x6b')]);_0xbd0519[_0x1f07('0x50')]=qs[_0x1f07('0x4a')](_[_0x1f07('0x51')](_0x4824e4['query'],_0x4e6da8[_0x1f07('0x4a')]));_0xbd0519[_0x1f07('0x50')][_0x1f07('0x67')]=_0x3b5803['id'];if(_0x4824e4['query'][_0x1f07('0x52')]){_0xbd0519[_0x1f07('0x50')]=_[_0x1f07('0x53')](_0xbd0519[_0x1f07('0x50')],{'$or':_[_0x1f07('0x42')](_0xbd0519[_0x1f07('0x4c')],function(_0x1354b3){var _0x5bb7a4={};_0x5bb7a4[_0x1354b3]={'$like':'%'+_0x4824e4[_0x1f07('0x49')][_0x1f07('0x52')]+'%'};return _0x5bb7a4;})});}if(_0x4824e4['query']['$gte']){var _0x1c002f=_0x4824e4[_0x1f07('0x49')][_0x1f07('0xa4')][_0x1f07('0xa5')](',');var _0x37229f={};_0x37229f[_0x1c002f[0x0]]={'$gte':moment(_0x1c002f[0x1])[_0x1f07('0xa6')](_0x1f07('0xa7'))};_0xbd0519[_0x1f07('0x50')]=_[_0x1f07('0x53')](_0xbd0519['where'],_0x37229f);}_0xbd0519=_[_0x1f07('0x53')]({},_0xbd0519,_0x4824e4[_0x1f07('0x54')]);return db[_0x1f07('0xa3')][_0x1f07('0x35')]({'where':_0xbd0519[_0x1f07('0x50')]})[_0x1f07('0x26')](function(_0x52d1e7){_0x170393[_0x1f07('0x35')]=_0x52d1e7;if(_0x4824e4[_0x1f07('0x49')][_0x1f07('0x55')]){_0xbd0519[_0x1f07('0x58')]=[{'all':!![]}];}return db[_0x1f07('0xa3')][_0x1f07('0x6c')](_0xbd0519);})[_0x1f07('0x26')](function(_0x5c555b){_0x170393[_0x1f07('0x56')]=_0x5c555b;return _0x170393;});}})[_0x1f07('0x26')](respondWithFilteredResult(_0x51bf64,_0xbd0519))[_0x1f07('0x31')](handleError(_0x51bf64,null));};exports[_0x1f07('0xa8')]=function(_0x59219c,_0x4889e3,_0x34ff90){var _0x403a5d,_0x1e3d8e={},_0xc4af7e;if(_0x59219c[_0x1f07('0x5b')]['to']){_0xc4af7e=_0x59219c[_0x1f07('0x5b')]['to'][0x0];}return db[_0x1f07('0x43')][_0x1f07('0x59')]({'where':{'id':_0x59219c[_0x1f07('0x64')]['id']},'include':[{'model':db['CmList'],'as':_0x1f07('0xa9'),'include':[{'model':db[_0x1f07('0x79')],'as':_0x1f07('0xaa'),'where':{'fax':_0xc4af7e},'limit':0x1,'order':[['updatedAt',_0x1f07('0xab')]]}]}]})[_0x1f07('0x26')](handleEntityNotFound(_0x4889e3,null))['then'](function(_0x1e746a){_0x403a5d=_0x1e746a;if(_0x59219c['body'][_0x1f07('0xac')]&&_0x59219c['body'][_0x1f07('0xac')][_0x1f07('0x72')]){for(var _0x4e1f6b=0x0;_0x4e1f6b<_0x59219c[_0x1f07('0x5b')][_0x1f07('0xac')][_0x1f07('0x72')];_0x4e1f6b+=0x1){_0x59219c[_0x1f07('0x5b')]['attachments'][_0x4e1f6b]={'filename':_0x59219c['body'][_0x1f07('0xac')][_0x4e1f6b][_0x1f07('0x3f')],'id':_0x59219c[_0x1f07('0x5b')]['attachments'][_0x4e1f6b]['id'],'path':path[_0x1f07('0xad')](config['root'],_0x1f07('0xae'),_0x59219c[_0x1f07('0x5b')][_0x1f07('0xac')][_0x4e1f6b][_0x1f07('0xaf')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x59219c['params']['id'])?undefined:_0x59219c[_0x1f07('0x64')]['id'],'path':_['isNil'](_0x59219c[_0x1f07('0x5b')]['attachments'][0x0][_0x1f07('0x8')])?undefined:_0x59219c[_0x1f07('0x5b')][_0x1f07('0xac')][0x0][_0x1f07('0x8')],'fax':_[_0x1f07('0xb0')](_0x59219c[_0x1f07('0x5b')]['to'][0x0])?undefined:_0x59219c[_0x1f07('0x5b')]['to'][0x0]},client9002);})[_0x1f07('0x26')](function(){if(_0x403a5d){if(_[_0x1f07('0xb0')](_0x59219c[_0x1f07('0x5b')][_0x1f07('0xb1')])){_0x59219c['body'][_0x1f07('0xb1')]=util[_0x1f07('0xa6')]('\x22%s\x22\x20<%s>',_0x403a5d[_0x1f07('0x3f')],_0x403a5d[_0x1f07('0xb2')]);}if(_0x403a5d[_0x1f07('0xa9')]){if(_0x403a5d[_0x1f07('0xa9')][_0x1f07('0xaa')][_0x1f07('0x72')]){return _0x403a5d[_0x1f07('0xa9')][_0x1f07('0xaa')][0x0];}else{return db[_0x1f07('0x79')][_0x1f07('0x5a')](_['defaults'](_0x59219c[_0x1f07('0x5b')],{'firstName':_0x59219c[_0x1f07('0x5b')]['to'][0x0],'phone':_0x59219c[_0x1f07('0x5b')]['to'][0x0],'fax':_0x59219c['body']['to'][0x0],'ListId':_0x403a5d[_0x1f07('0xa0')]}));}}else{throw new Error(_0x1f07('0xb3'));}}else{throw new Error(_0x1f07('0xb4'));}})['then'](function(_0x439260){if(_0x439260){return db[_0x1f07('0x75')][_0x1f07('0x59')]({'where':{'ContactId':_0x439260['id'],'closed':![],'FaxAccountId':_0x403a5d['id']}})['then'](function(_0xa40d9){if(_0xa40d9){return[_0xa40d9,![]];}return db[_0x1f07('0x75')][_0x1f07('0x5a')]({'UserId':_0x59219c['user']['id'],'ContactId':_0x439260['id'],'FaxAccountId':_0x403a5d['id'],'fax':_0x59219c[_0x1f07('0x5b')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x59219c[_0x1f07('0x5b')],{'read':![],'body':_0x59219c[_0x1f07('0x5b')]['attachments'][0x0][_0x1f07('0xb5')],'FaxAccountId':_0x403a5d['id'],'UserId':_0x59219c[_0x1f07('0x5d')]['id'],'ContactId':_0x439260['id'],'AttachmentId':_0x59219c[_0x1f07('0x5b')][_0x1f07('0xac')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x1f07('0xb6')}]})[_0x1f07('0x26')](function(_0x4a31cb){return[_0x4a31cb,!![]];});});}else{throw new Error(_0x1f07('0xb7'));}})['spread'](function(_0x585de7,_0x58f305){if(_0x58f305){return _0x585de7;}return db[_0x1f07('0xa3')][_0x1f07('0x5a')]({'direction':_0x1f07('0xb8'),'read':![],'body':_0x59219c[_0x1f07('0x5b')][_0x1f07('0xac')][0x0]['filename'],'FaxAccountId':_0x403a5d['id'],'FaxInteractionId':_0x585de7['id'],'UserId':_0x59219c[_0x1f07('0x5d')]['id'],'ContactId':_0x585de7[_0x1f07('0xb9')],'AttachmentId':_0x59219c[_0x1f07('0x5b')]['attachments'][0x0]['id']})['then'](function(_0x561130){_0x585de7[_0x1f07('0xba')][_0x1f07('0xb6')]=[];_0x585de7['dataValues'][_0x1f07('0xb6')][_0x1f07('0x8d')](_0x561130[_0x1f07('0xba')]);return _0x585de7;});})[_0x1f07('0x26')](function(_0x252adc){respondWithRpcPromise(_0x1f07('0xbb'),'SendFax',{'FaxAccountId':_[_0x1f07('0xb0')](_0x59219c[_0x1f07('0x64')]['id'])?undefined:_0x59219c[_0x1f07('0x64')]['id'],'path':_[_0x1f07('0xb0')](_0x59219c[_0x1f07('0x5b')][_0x1f07('0xac')][0x0][_0x1f07('0x8')])?undefined:_0x59219c[_0x1f07('0x5b')][_0x1f07('0xac')][0x0][_0x1f07('0x8')],'fax':_[_0x1f07('0xb0')](_0x59219c[_0x1f07('0x5b')]['to'][0x0])?undefined:_0x59219c[_0x1f07('0x5b')]['to'][0x0],'AttachmentId':_0x59219c[_0x1f07('0x5b')][_0x1f07('0xac')][0x0]['id']},client9002)[_0x1f07('0x26')](function(_0x55e138){logger['info']('SendFaxRpc,\x20%s',_0x55e138);})['catch'](function(_0x542eb4){logger[_0x1f07('0x27')]('SendFaxRpc,\x20%s',_0x542eb4);});return _0x252adc;})[_0x1f07('0x26')](respondWithResult(_0x4889e3,null))[_0x1f07('0x31')](handleError(_0x4889e3,null));};exports['addAgents']=function(_0xd5f7c6,_0xd928be,_0x37d911){return db[_0x1f07('0x43')][_0x1f07('0x59')]({'where':{'id':_0xd5f7c6[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0xd928be,null))[_0x1f07('0x26')](function(_0x175beb){if(_0x175beb){return _0x175beb[_0x1f07('0xbc')](_0xd5f7c6[_0x1f07('0x5b')][_0x1f07('0x6e')],_[_0x1f07('0x76')](_0xd5f7c6[_0x1f07('0x5b')],[_0x1f07('0x6e'),'id'])||{})[_0x1f07('0xbd')](function(_0xa7d955){for(var _0x4fbd97=0x0;_0x4fbd97<_0xd5f7c6['body']['ids']['length'];_0x4fbd97+=0x1){socket[_0x1f07('0xbe')](_0x1f07('0xbf'),{'UserId':_0xd5f7c6[_0x1f07('0x5b')][_0x1f07('0x6e')][_0x4fbd97],'FaxAccountId':_0xd5f7c6[_0x1f07('0x64')]['id']});}return _0xa7d955;});}})[_0x1f07('0x26')](respondWithResult(_0xd928be,null))[_0x1f07('0x31')](handleError(_0xd928be,null));};exports[_0x1f07('0xc0')]=function(_0x3b07ee,_0x4a7a6b,_0xcc80ce){return db[_0x1f07('0x43')][_0x1f07('0x59')]({'where':{'id':_0x3b07ee[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x4a7a6b,null))[_0x1f07('0x26')](function(_0x3cba6a){if(_0x3cba6a){return _0x3cba6a[_0x1f07('0xc0')](_0x3b07ee[_0x1f07('0x49')][_0x1f07('0x6e')])['then'](function(){if(_[_0x1f07('0xc1')](_0x3b07ee[_0x1f07('0x49')][_0x1f07('0x6e')])){for(var _0x7ad49c=0x0;_0x7ad49c<_0x3b07ee[_0x1f07('0x49')]['ids'][_0x1f07('0x72')];_0x7ad49c+=0x1){socket['emit'](_0x1f07('0xc2'),{'UserId':Number(_0x3b07ee[_0x1f07('0x49')][_0x1f07('0x6e')][_0x7ad49c]),'FaxAccountId':Number(_0x3b07ee['params']['id'])});}}else{socket[_0x1f07('0xbe')](_0x1f07('0xc2'),{'UserId':Number(_0x3b07ee[_0x1f07('0x49')][_0x1f07('0x6e')]),'FaxAccountId':Number(_0x3b07ee[_0x1f07('0x64')]['id'])});}});}})[_0x1f07('0x26')](respondWithStatusCode(_0x4a7a6b,null))[_0x1f07('0x31')](handleError(_0x4a7a6b,null));};exports[_0x1f07('0xc3')]=function(_0x4fc091,_0x451237,_0x4be2fb){var _0x5eecf7={};var _0x1399cf={};var _0x51c108;var _0x5942ac;return db[_0x1f07('0x43')][_0x1f07('0x69')]({'where':{'id':_0x4fc091[_0x1f07('0x64')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x451237,null))[_0x1f07('0x26')](function(_0x49e77b){if(_0x49e77b){_0x51c108=_0x49e77b;_0x1399cf[_0x1f07('0x47')]=_[_0x1f07('0x48')](db[_0x1f07('0x7b')][_0x1f07('0x78')]);_0x1399cf[_0x1f07('0x49')]=_['keys'](_0x4fc091[_0x1f07('0x49')]);_0x1399cf[_0x1f07('0x4a')]=_[_0x1f07('0x4b')](_0x1399cf['model'],_0x1399cf[_0x1f07('0x49')]);_0x5eecf7['attributes']=_[_0x1f07('0x4b')](_0x1399cf[_0x1f07('0x47')],qs[_0x1f07('0x4d')](_0x4fc091[_0x1f07('0x49')]['fields']));_0x5eecf7[_0x1f07('0x4c')]=_0x5eecf7[_0x1f07('0x4c')][_0x1f07('0x72')]?_0x5eecf7[_0x1f07('0x4c')]:_0x1399cf[_0x1f07('0x47')];_0x5eecf7[_0x1f07('0x6a')]=qs[_0x1f07('0x6b')](_0x4fc091[_0x1f07('0x49')][_0x1f07('0x6b')]);_0x5eecf7[_0x1f07('0x50')]=qs['filters'](_[_0x1f07('0x51')](_0x4fc091[_0x1f07('0x49')],_0x1399cf['filters']));if(_0x4fc091[_0x1f07('0x49')][_0x1f07('0x52')]){_0x5eecf7['where']=_[_0x1f07('0x53')](_0x5eecf7[_0x1f07('0x50')],{'$or':_[_0x1f07('0x42')](_0x5eecf7[_0x1f07('0x4c')],function(_0x8cda61){var _0xf7bec3={};_0xf7bec3[_0x8cda61]={'$like':'%'+_0x4fc091['query'][_0x1f07('0x52')]+'%'};return _0xf7bec3;})});}_0x5eecf7=_['merge']({},_0x5eecf7,_0x4fc091[_0x1f07('0x54')]);return _0x51c108['getAgents'](_0x5eecf7);}})[_0x1f07('0x26')](function(_0x4c97a1){if(_0x4c97a1){_0x5942ac=_0x4c97a1['length'];if(!_0x4fc091[_0x1f07('0x49')][_0x1f07('0x4e')](_0x1f07('0x4f'))){_0x5eecf7[_0x1f07('0x37')]=qs[_0x1f07('0x37')](_0x4fc091[_0x1f07('0x49')][_0x1f07('0x37')]);_0x5eecf7[_0x1f07('0x36')]=qs[_0x1f07('0x36')](_0x4fc091[_0x1f07('0x49')]['offset']);}return _0x51c108['getAgents'](_0x5eecf7);}})['then'](function(_0x2377ef){if(_0x2377ef){return _0x2377ef?{'count':_0x5942ac,'rows':_0x2377ef}:null;}})['then'](respondWithResult(_0x451237,null))[_0x1f07('0x31')](handleError(_0x451237,null));}; \ No newline at end of file +var _0xe536=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.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~!@#$%^&-_=+[{]}.','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','limit','set','reject','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','offset','order','sort','where','filter','merge','options','FaxAccount','include','findAll','params','Pause','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','rawAttributes','FaxAccountId','rows','removeDispositions','ids','getAnswers','CannedAnswer','pick','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','hasOwnProperty','CmContact','Contact','User','color','tag','addApplications','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','sequelize','transaction','VoiceExtension','bulkCreate','tech','TrunkId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','updatedAt','attachments','join','CheckAfterSend','isNil','from','fax','Contacts','List','ListId','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','emit','removeAgents','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x330018,_0x3c933e){var _0x3dc0f8=function(_0x18fd33){while(--_0x18fd33){_0x330018['push'](_0x330018['shift']());}};_0x3dc0f8(++_0x3c933e);}(_0xe536,0xb5));var _0x6e53=function(_0x299f5c,_0x5738dd){_0x299f5c=_0x299f5c-0x0;var _0x5da026=_0xe536[_0x299f5c];return _0x5da026;};'use strict';var pdf=require(_0x6e53('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6e53('0x1'));var zipdir=require(_0x6e53('0x2'));var jsonpatch=require(_0x6e53('0x3'));var rp=require(_0x6e53('0x4'));var moment=require(_0x6e53('0x5'));var BPromise=require(_0x6e53('0x6'));var Mustache=require(_0x6e53('0x7'));var util=require('util');var path=require(_0x6e53('0x8'));var sox=require(_0x6e53('0x9'));var csv=require(_0x6e53('0xa'));var ejs=require(_0x6e53('0xb'));var fs=require('fs');var _=require(_0x6e53('0xc'));var squel=require(_0x6e53('0xd'));var crypto=require(_0x6e53('0xe'));var jsforce=require(_0x6e53('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6e53('0xa'));var querystring=require(_0x6e53('0x10'));var Papa=require('papaparse');var Redis=require(_0x6e53('0x11'));var authService=require(_0x6e53('0x12'));var qs=require(_0x6e53('0x13'));var as=require(_0x6e53('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e53('0x15'))(_0x6e53('0x16'));var utils=require('../../config/utils');var config=require(_0x6e53('0x17'));var db=require(_0x6e53('0x18'))['db'];config[_0x6e53('0x19')]=_[_0x6e53('0x1a')](config[_0x6e53('0x19')],{'host':_0x6e53('0x1b'),'port':0x18eb});var socket=require(_0x6e53('0x1c'))(new Redis(config[_0x6e53('0x19')]));require(_0x6e53('0x1d'))[_0x6e53('0x1e')](socket);var jayson=require(_0x6e53('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x6e53('0x20')][_0x6e53('0x21')]({'port':0x232a});function checkPasswordPattern(_0x915a11,_0x4f2c11,_0x58c717){if(_0x58c717){var _0x169d59=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x169d59[_0x6e53('0x22')](_0x4f2c11)){return _0x915a11;}else{throw new db[(_0x6e53('0x23'))][(_0x6e53('0x24'))](_0x6e53('0x25'));}}else{return _0x915a11;}}function respondWithRpcPromise(_0x48bfbb,_0x11dc95,_0x1d64b9,_0x191a9a){return new BPromise(function(_0x169872,_0x4ea8f9){var _0x5583eb=_0x191a9a||client;return _0x5583eb['request'](_0x48bfbb,_0x1d64b9)[_0x6e53('0x26')](function(_0x3a7f26){logger[_0x6e53('0x27')](_0x6e53('0x28'),_0x11dc95,_0x6e53('0x29'));logger[_0x6e53('0x2a')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x11dc95,'request\x20sent',JSON[_0x6e53('0x2b')](_0x3a7f26));if(_0x3a7f26[_0x6e53('0x2c')]){if(_0x3a7f26['error']['code']===0x1f4){logger[_0x6e53('0x2c')](_0x6e53('0x28'),_0x11dc95,_0x3a7f26[_0x6e53('0x2c')][_0x6e53('0x2d')]);return _0x4ea8f9(_0x3a7f26[_0x6e53('0x2c')][_0x6e53('0x2d')]);}logger[_0x6e53('0x2c')](_0x6e53('0x28'),_0x11dc95,_0x3a7f26['error'][_0x6e53('0x2d')]);return _0x169872(_0x3a7f26[_0x6e53('0x2c')][_0x6e53('0x2d')]);}else{logger[_0x6e53('0x27')](_0x6e53('0x28'),_0x11dc95,_0x6e53('0x29'));_0x169872(_0x3a7f26[_0x6e53('0x2e')]['message']);}})[_0x6e53('0x2f')](function(_0x304deb){logger[_0x6e53('0x2c')](_0x6e53('0x28'),_0x11dc95,_0x304deb);_0x4ea8f9(_0x304deb);});});}function respondWithStatusCode(_0x4268e3,_0x3b1f9b){_0x3b1f9b=_0x3b1f9b||0xcc;return function(_0x218414){if(_0x218414){return _0x4268e3[_0x6e53('0x30')](_0x3b1f9b);}return _0x4268e3[_0x6e53('0x31')](_0x3b1f9b)[_0x6e53('0x32')]();};}function respondWithResult(_0x1eddd7,_0x215eb4){_0x215eb4=_0x215eb4||0xc8;return function(_0x343521){if(_0x343521){return _0x1eddd7['status'](_0x215eb4)[_0x6e53('0x33')](_0x343521);}};}function respondWithFilteredResult(_0x206d09,_0x4abaf2){return function(_0x3f4e1f){if(_0x3f4e1f){var _0x2cfc13=_0x3f4e1f[_0x6e53('0x34')],_0x27661d=_0x4abaf2['offset'],_0x503df8=_0x4abaf2['offset']+_0x4abaf2[_0x6e53('0x35')],_0x190eff;if(_0x503df8>=_0x2cfc13){_0x503df8=_0x2cfc13;_0x190eff=0xc8;}else{_0x190eff=0xce;}_0x206d09['status'](_0x190eff);return _0x206d09[_0x6e53('0x36')]('Content-Range',_0x27661d+'-'+_0x503df8+'/'+_0x2cfc13)[_0x6e53('0x33')](_0x3f4e1f);}return null;};}function patchUpdates(_0x30d5a3){return function(_0x4d7039){try{jsonpatch['apply'](_0x4d7039,_0x30d5a3,!![]);}catch(_0x51aaf5){return BPromise[_0x6e53('0x37')](_0x51aaf5);}return _0x4d7039['save']();};}function saveUpdates(_0x5a0256,_0x16d244){return function(_0x2723db){if(_0x2723db){return _0x2723db[_0x6e53('0x38')](_0x5a0256)[_0x6e53('0x26')](function(_0x4ffc31){return _0x4ffc31;});}return null;};}function removeEntity(_0x4e5161,_0x19bfd5){return function(_0x41ccdd){if(_0x41ccdd){return _0x41ccdd[_0x6e53('0x39')]()[_0x6e53('0x26')](function(){var _0x55484d=_0x41ccdd[_0x6e53('0x3a')]({'plain':!![]});var _0xeab5e4=_0x6e53('0x3b');return db[_0x6e53('0x3c')][_0x6e53('0x39')]({'where':{'type':_0xeab5e4,'resourceId':_0x55484d['id']}})['then'](function(){return _0x41ccdd;});})[_0x6e53('0x26')](function(){_0x4e5161[_0x6e53('0x31')](0xcc)[_0x6e53('0x32')]();});}};}function handleEntityNotFound(_0x227166,_0x1bfc42){return function(_0x315946){if(!_0x315946){_0x227166[_0x6e53('0x30')](0x194);}return _0x315946;};}function handleError(_0x133566,_0x281e8e){_0x281e8e=_0x281e8e||0x1f4;return function(_0x2fdf48){logger[_0x6e53('0x2c')](_0x2fdf48[_0x6e53('0x3d')]);if(_0x2fdf48[_0x6e53('0x3e')]){delete _0x2fdf48[_0x6e53('0x3e')];}_0x133566['status'](_0x281e8e)['send'](_0x2fdf48);};}exports[_0x6e53('0x3f')]=function(_0x2888e5,_0x195f90){var _0x481af7={'include':[{'model':db['Pause'],'as':_0x6e53('0x40')}]},_0x4aa4f5={},_0x5282ba={'count':0x0,'rows':[]};var _0xde2c74=_[_0x6e53('0x41')](db['FaxAccount']['rawAttributes'],function(_0x8e02bd){return{'name':_0x8e02bd[_0x6e53('0x42')],'type':_0x8e02bd[_0x6e53('0x43')][_0x6e53('0x44')]};});_0x4aa4f5['model']=_[_0x6e53('0x41')](_0xde2c74,_0x6e53('0x3e'));_0x4aa4f5[_0x6e53('0x45')]=_[_0x6e53('0x46')](_0x2888e5['query']);_0x4aa4f5[_0x6e53('0x47')]=_[_0x6e53('0x48')](_0x4aa4f5['model'],_0x4aa4f5[_0x6e53('0x45')]);_0x481af7[_0x6e53('0x49')]=_['intersection'](_0x4aa4f5[_0x6e53('0x4a')],qs[_0x6e53('0x4b')](_0x2888e5[_0x6e53('0x45')][_0x6e53('0x4b')]));_0x481af7[_0x6e53('0x49')]=_0x481af7[_0x6e53('0x49')][_0x6e53('0x4c')]?_0x481af7['attributes']:_0x4aa4f5[_0x6e53('0x4a')];if(!_0x2888e5[_0x6e53('0x45')]['hasOwnProperty'](_0x6e53('0x4d'))){_0x481af7[_0x6e53('0x35')]=qs[_0x6e53('0x35')](_0x2888e5[_0x6e53('0x45')][_0x6e53('0x35')]);_0x481af7[_0x6e53('0x4e')]=qs[_0x6e53('0x4e')](_0x2888e5[_0x6e53('0x45')]['offset']);}_0x481af7[_0x6e53('0x4f')]=qs['sort'](_0x2888e5['query'][_0x6e53('0x50')]);_0x481af7[_0x6e53('0x51')]=qs['filters'](_['pick'](_0x2888e5[_0x6e53('0x45')],_0x4aa4f5[_0x6e53('0x47')]),_0xde2c74);if(_0x2888e5[_0x6e53('0x45')][_0x6e53('0x52')]){_0x481af7[_0x6e53('0x51')]=_[_0x6e53('0x53')](_0x481af7[_0x6e53('0x51')],{'$or':_[_0x6e53('0x41')](_0xde2c74,function(_0x159488){if(_0x159488[_0x6e53('0x43')]!=='VIRTUAL'){var _0x239dab={};_0x239dab[_0x159488[_0x6e53('0x3e')]]={'$like':'%'+_0x2888e5[_0x6e53('0x45')]['filter']+'%'};return _0x239dab;}})});}_0x481af7=_[_0x6e53('0x53')]({},_0x481af7,_0x2888e5[_0x6e53('0x54')]);var _0x2c2876={'where':_0x481af7[_0x6e53('0x51')]};return db[_0x6e53('0x55')][_0x6e53('0x34')](_0x2c2876)[_0x6e53('0x26')](function(_0x3d827b){_0x5282ba[_0x6e53('0x34')]=_0x3d827b;if(_0x2888e5[_0x6e53('0x45')]['includeAll']){_0x481af7[_0x6e53('0x56')]=[{'all':!![]}];}return db[_0x6e53('0x55')][_0x6e53('0x57')](_0x481af7);})[_0x6e53('0x26')](function(_0x247bb1){_0x5282ba['rows']=_0x247bb1;return _0x5282ba;})[_0x6e53('0x26')](respondWithFilteredResult(_0x195f90,_0x481af7))['catch'](handleError(_0x195f90,null));};exports['show']=function(_0x4c2cc1,_0x32a542){var _0x3e4085={'raw':![],'where':{'id':_0x4c2cc1[_0x6e53('0x58')]['id']},'include':[{'model':db[_0x6e53('0x59')],'as':_0x6e53('0x40')}]},_0x4009bb={};_0x4009bb['model']=_['keys'](db['FaxAccount']['rawAttributes']);_0x4009bb[_0x6e53('0x45')]=_[_0x6e53('0x46')](_0x4c2cc1[_0x6e53('0x45')]);_0x4009bb[_0x6e53('0x47')]=_[_0x6e53('0x48')](_0x4009bb[_0x6e53('0x4a')],_0x4009bb[_0x6e53('0x45')]);_0x3e4085[_0x6e53('0x49')]=_['intersection'](_0x4009bb['model'],qs['fields'](_0x4c2cc1[_0x6e53('0x45')]['fields']));_0x3e4085['attributes']=_0x3e4085[_0x6e53('0x49')][_0x6e53('0x4c')]?_0x3e4085[_0x6e53('0x49')]:_0x4009bb[_0x6e53('0x4a')];if(_0x4c2cc1[_0x6e53('0x45')][_0x6e53('0x5a')]){_0x3e4085['include']=[{'all':!![]}];}_0x3e4085=_['merge']({},_0x3e4085,_0x4c2cc1[_0x6e53('0x54')]);return db[_0x6e53('0x55')]['find'](_0x3e4085)[_0x6e53('0x26')](handleEntityNotFound(_0x32a542,null))[_0x6e53('0x26')](respondWithResult(_0x32a542,null))['catch'](handleError(_0x32a542,null));};exports['create']=function(_0x3ea727,_0x4059dd){return db[_0x6e53('0x55')][_0x6e53('0x5b')](_0x3ea727[_0x6e53('0x5c')],{})[_0x6e53('0x26')](function(_0x1cb07b){var _0x43c2dd=_0x3ea727[_0x6e53('0x5d')][_0x6e53('0x3a')]({'plain':!![]});if(!_0x43c2dd)throw new Error(_0x6e53('0x5e'));if(_0x43c2dd[_0x6e53('0x5f')]===_0x6e53('0x5d')){var _0xd797e7=_0x1cb07b[_0x6e53('0x3a')]({'plain':!![]});var _0x2522b8=_0x6e53('0x3b');return db[_0x6e53('0x60')][_0x6e53('0x61')]({'where':{'name':_0x2522b8,'userProfileId':_0x43c2dd[_0x6e53('0x62')]},'raw':!![]})[_0x6e53('0x26')](function(_0x53d2e2){if(_0x53d2e2&&_0x53d2e2[_0x6e53('0x63')]===0x0){return db[_0x6e53('0x3c')][_0x6e53('0x5b')]({'name':_0xd797e7[_0x6e53('0x3e')],'resourceId':_0xd797e7['id'],'type':_0x53d2e2[_0x6e53('0x3e')],'sectionId':_0x53d2e2['id']},{})['then'](function(){return _0x1cb07b;});}else{return _0x1cb07b;}})[_0x6e53('0x2f')](function(_0xaa36fc){logger[_0x6e53('0x2c')](_0x6e53('0x64'),_0xaa36fc);throw _0xaa36fc;});}return _0x1cb07b;})[_0x6e53('0x26')](respondWithResult(_0x4059dd,0xc9))[_0x6e53('0x2f')](handleError(_0x4059dd,null));};exports['update']=function(_0x421913,_0x476e7d){if(_0x421913[_0x6e53('0x5c')]['id']){delete _0x421913[_0x6e53('0x5c')]['id'];}return db[_0x6e53('0x55')][_0x6e53('0x61')]({'where':{'id':_0x421913[_0x6e53('0x58')]['id']},'include':[{'model':db[_0x6e53('0x59')],'as':_0x6e53('0x40')}]})[_0x6e53('0x26')](handleEntityNotFound(_0x476e7d,null))[_0x6e53('0x26')](saveUpdates(_0x421913[_0x6e53('0x5c')],null))[_0x6e53('0x26')](respondWithResult(_0x476e7d,null))[_0x6e53('0x2f')](handleError(_0x476e7d,null));};exports[_0x6e53('0x39')]=function(_0x554775,_0xdd2dea){return db[_0x6e53('0x55')][_0x6e53('0x61')]({'where':{'id':_0x554775[_0x6e53('0x58')]['id']}})[_0x6e53('0x26')](handleEntityNotFound(_0xdd2dea,null))['then'](removeEntity(_0xdd2dea,null))[_0x6e53('0x2f')](handleError(_0xdd2dea,null));};exports[_0x6e53('0x65')]=function(_0x3a5f5a,_0x967e74){return db[_0x6e53('0x55')][_0x6e53('0x65')]()[_0x6e53('0x26')](respondWithResult(_0x967e74,null))[_0x6e53('0x2f')](handleError(_0x967e74,null));};exports['addDisposition']=function(_0x87fe46,_0x4b3c94,_0x53ae7e){if(_0x87fe46['body']['id']){delete _0x87fe46[_0x6e53('0x5c')]['id'];}return db['FaxAccount'][_0x6e53('0x61')]({'where':{'id':_0x87fe46[_0x6e53('0x58')]['id']}})['then'](handleEntityNotFound(_0x4b3c94,null))[_0x6e53('0x26')](function(_0x2ff649){if(_0x2ff649){_0x87fe46[_0x6e53('0x5c')]['FaxAccountId']=_0x2ff649['id'];return db[_0x6e53('0x66')][_0x6e53('0x5b')](_0x87fe46[_0x6e53('0x5c')]);}})['then'](respondWithResult(_0x4b3c94,null))[_0x6e53('0x2f')](handleError(_0x4b3c94,null));};exports[_0x6e53('0x67')]=function(_0x90b82a,_0x4af79e,_0x3a417f){var _0x1ecc71={'raw':![],'where':{}};var _0x4795a8={};var _0x2c844d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6e53('0x68')]({'where':{'id':_0x90b82a['params']['id']}})[_0x6e53('0x26')](handleEntityNotFound(_0x4af79e,null))[_0x6e53('0x26')](function(_0x4cb7a9){if(_0x4cb7a9){_0x4795a8[_0x6e53('0x4a')]=_[_0x6e53('0x46')](db[_0x6e53('0x66')][_0x6e53('0x69')]);_0x4795a8['query']=_[_0x6e53('0x46')](_0x90b82a[_0x6e53('0x45')]);_0x4795a8[_0x6e53('0x47')]=_[_0x6e53('0x48')](_0x4795a8[_0x6e53('0x4a')],_0x4795a8[_0x6e53('0x45')]);_0x1ecc71[_0x6e53('0x49')]=_[_0x6e53('0x48')](_0x4795a8[_0x6e53('0x4a')],qs[_0x6e53('0x4b')](_0x90b82a[_0x6e53('0x45')]['fields']));_0x1ecc71[_0x6e53('0x49')]=_0x1ecc71[_0x6e53('0x49')][_0x6e53('0x4c')]?_0x1ecc71[_0x6e53('0x49')]:_0x4795a8[_0x6e53('0x4a')];if(!_0x90b82a[_0x6e53('0x45')]['hasOwnProperty'](_0x6e53('0x4d'))){_0x1ecc71[_0x6e53('0x35')]=qs[_0x6e53('0x35')](_0x90b82a[_0x6e53('0x45')][_0x6e53('0x35')]);_0x1ecc71['offset']=qs['offset'](_0x90b82a[_0x6e53('0x45')][_0x6e53('0x4e')]);}_0x1ecc71[_0x6e53('0x4f')]=qs['sort'](_0x90b82a[_0x6e53('0x45')][_0x6e53('0x50')]);_0x1ecc71[_0x6e53('0x51')]=qs[_0x6e53('0x47')](_['pick'](_0x90b82a[_0x6e53('0x45')],_0x4795a8[_0x6e53('0x47')]));_0x1ecc71[_0x6e53('0x51')][_0x6e53('0x6a')]=_0x4cb7a9['id'];if(_0x90b82a['query'][_0x6e53('0x52')]){_0x1ecc71[_0x6e53('0x51')]=_[_0x6e53('0x53')](_0x1ecc71['where'],{'$or':_['map'](_0x1ecc71[_0x6e53('0x49')],function(_0x1b9b00){var _0x8a9340={};_0x8a9340[_0x1b9b00]={'$like':'%'+_0x90b82a['query'][_0x6e53('0x52')]+'%'};return _0x8a9340;})});}_0x1ecc71=_['merge']({},_0x1ecc71,_0x90b82a[_0x6e53('0x54')]);return db['Disposition'][_0x6e53('0x34')]({'where':_0x1ecc71['where']})[_0x6e53('0x26')](function(_0x1c30db){_0x2c844d[_0x6e53('0x34')]=_0x1c30db;if(_0x90b82a['query'][_0x6e53('0x5a')]){_0x1ecc71[_0x6e53('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x6e53('0x57')](_0x1ecc71);})[_0x6e53('0x26')](function(_0x4c8b77){_0x2c844d[_0x6e53('0x6b')]=_0x4c8b77;return _0x2c844d;});}})[_0x6e53('0x26')](respondWithFilteredResult(_0x4af79e,_0x1ecc71))['catch'](handleError(_0x4af79e,null));};exports[_0x6e53('0x6c')]=function(_0x285070,_0x45d435,_0x31f35e){return db['FaxAccount'][_0x6e53('0x61')]({'where':{'id':_0x285070[_0x6e53('0x58')]['id']}})['then'](handleEntityNotFound(_0x45d435,null))[_0x6e53('0x26')](function(_0xa34855){if(_0xa34855){return _0xa34855[_0x6e53('0x6c')](_0x285070['query'][_0x6e53('0x6d')]);}})[_0x6e53('0x26')](respondWithStatusCode(_0x45d435,null))[_0x6e53('0x2f')](handleError(_0x45d435,null));};exports['addAnswer']=function(_0x486e3c,_0xd4f19,_0x4ae932){if(_0x486e3c[_0x6e53('0x5c')]['id']){delete _0x486e3c[_0x6e53('0x5c')]['id'];}return db[_0x6e53('0x55')]['find']({'where':{'id':_0x486e3c[_0x6e53('0x58')]['id']}})[_0x6e53('0x26')](handleEntityNotFound(_0xd4f19,null))[_0x6e53('0x26')](function(_0x45970e){if(_0x45970e){_0x486e3c[_0x6e53('0x5c')][_0x6e53('0x6a')]=_0x45970e['id'];return db['CannedAnswer'][_0x6e53('0x5b')](_0x486e3c[_0x6e53('0x5c')]);}})['then'](respondWithResult(_0xd4f19,null))['catch'](handleError(_0xd4f19,null));};exports[_0x6e53('0x6e')]=function(_0x17bb05,_0x381e68,_0x4ad79a){var _0x3efd75={'raw':![],'where':{}};var _0x1bedd9={};var _0x2b18d={'count':0x0,'rows':[]};return db[_0x6e53('0x55')][_0x6e53('0x68')]({'where':{'id':_0x17bb05['params']['id']}})[_0x6e53('0x26')](handleEntityNotFound(_0x381e68,null))[_0x6e53('0x26')](function(_0x4bb4ab){if(_0x4bb4ab){_0x1bedd9[_0x6e53('0x4a')]=_[_0x6e53('0x46')](db[_0x6e53('0x6f')][_0x6e53('0x69')]);_0x1bedd9[_0x6e53('0x45')]=_[_0x6e53('0x46')](_0x17bb05[_0x6e53('0x45')]);_0x1bedd9[_0x6e53('0x47')]=_[_0x6e53('0x48')](_0x1bedd9['model'],_0x1bedd9[_0x6e53('0x45')]);_0x3efd75[_0x6e53('0x49')]=_[_0x6e53('0x48')](_0x1bedd9[_0x6e53('0x4a')],qs['fields'](_0x17bb05[_0x6e53('0x45')]['fields']));_0x3efd75[_0x6e53('0x49')]=_0x3efd75['attributes'][_0x6e53('0x4c')]?_0x3efd75[_0x6e53('0x49')]:_0x1bedd9[_0x6e53('0x4a')];if(!_0x17bb05[_0x6e53('0x45')]['hasOwnProperty']('nolimit')){_0x3efd75[_0x6e53('0x35')]=qs[_0x6e53('0x35')](_0x17bb05[_0x6e53('0x45')]['limit']);_0x3efd75['offset']=qs[_0x6e53('0x4e')](_0x17bb05['query'][_0x6e53('0x4e')]);}_0x3efd75[_0x6e53('0x4f')]=qs[_0x6e53('0x50')](_0x17bb05[_0x6e53('0x45')][_0x6e53('0x50')]);_0x3efd75[_0x6e53('0x51')]=qs[_0x6e53('0x47')](_[_0x6e53('0x70')](_0x17bb05['query'],_0x1bedd9[_0x6e53('0x47')]));_0x3efd75[_0x6e53('0x51')][_0x6e53('0x6a')]=_0x4bb4ab['id'];if(_0x17bb05['query']['filter']){_0x3efd75['where']=_['merge'](_0x3efd75['where'],{'$or':_[_0x6e53('0x41')](_0x3efd75['attributes'],function(_0x534eb0){var _0x12d709={};_0x12d709[_0x534eb0]={'$like':'%'+_0x17bb05[_0x6e53('0x45')][_0x6e53('0x52')]+'%'};return _0x12d709;})});}_0x3efd75=_[_0x6e53('0x53')]({},_0x3efd75,_0x17bb05[_0x6e53('0x54')]);return db[_0x6e53('0x6f')]['count']({'where':_0x3efd75[_0x6e53('0x51')]})[_0x6e53('0x26')](function(_0x3c2c1e){_0x2b18d[_0x6e53('0x34')]=_0x3c2c1e;if(_0x17bb05['query'][_0x6e53('0x5a')]){_0x3efd75[_0x6e53('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6e53('0x57')](_0x3efd75);})[_0x6e53('0x26')](function(_0x339394){_0x2b18d[_0x6e53('0x6b')]=_0x339394;return _0x2b18d;});}})['then'](respondWithFilteredResult(_0x381e68,_0x3efd75))[_0x6e53('0x2f')](handleError(_0x381e68,null));};exports[_0x6e53('0x71')]=function(_0x365973,_0x176bd2,_0x3a9838){return db[_0x6e53('0x55')][_0x6e53('0x61')]({'where':{'id':_0x365973['params']['id']}})[_0x6e53('0x26')](handleEntityNotFound(_0x176bd2,null))[_0x6e53('0x26')](function(_0x218ee4){if(_0x218ee4){return _0x218ee4['removeAnswers'](_0x365973[_0x6e53('0x45')][_0x6e53('0x6d')]);}})['then'](respondWithStatusCode(_0x176bd2,null))[_0x6e53('0x2f')](handleError(_0x176bd2,null));};exports[_0x6e53('0x72')]=function(_0x3de06a,_0x3043d2,_0x12844a){return db[_0x6e53('0x73')]['find']({'where':{'id':_0x3de06a[_0x6e53('0x58')]['id']}})[_0x6e53('0x26')](handleEntityNotFound(_0x3043d2,null))[_0x6e53('0x26')](function(_0x4ae3e0){if(_0x4ae3e0){return _0x4ae3e0[_0x6e53('0x72')](_0x3de06a[_0x6e53('0x5c')]['ids'],_[_0x6e53('0x74')](_0x3de06a[_0x6e53('0x5c')],['ids','id'])||{});}})[_0x6e53('0x26')](respondWithResult(_0x3043d2,null))[_0x6e53('0x2f')](handleError(_0x3043d2,null));};exports[_0x6e53('0x75')]=function(_0x2a5cf6,_0x53526f,_0x16ba4d){var _0x543f50={'raw':![],'where':{}};var _0x1c9dcc={};var _0x1f6b34={'count':0x0,'rows':[]};return db[_0x6e53('0x55')][_0x6e53('0x68')]({'where':{'id':_0x2a5cf6['params']['id']}})['then'](handleEntityNotFound(_0x53526f,null))[_0x6e53('0x26')](function(_0xae1723){if(_0xae1723){_0x1c9dcc[_0x6e53('0x4a')]=_[_0x6e53('0x46')](db[_0x6e53('0x73')][_0x6e53('0x69')]);_0x1c9dcc[_0x6e53('0x45')]=_[_0x6e53('0x46')](_0x2a5cf6['query']);_0x1c9dcc[_0x6e53('0x47')]=_[_0x6e53('0x48')](_0x1c9dcc[_0x6e53('0x4a')],_0x1c9dcc[_0x6e53('0x45')]);_0x543f50['attributes']=_[_0x6e53('0x48')](_0x1c9dcc[_0x6e53('0x4a')],qs[_0x6e53('0x4b')](_0x2a5cf6[_0x6e53('0x45')]['fields']));_0x543f50[_0x6e53('0x49')]=_0x543f50[_0x6e53('0x49')][_0x6e53('0x4c')]?_0x543f50['attributes']:_0x1c9dcc[_0x6e53('0x4a')];if(!_0x2a5cf6[_0x6e53('0x45')][_0x6e53('0x76')](_0x6e53('0x4d'))){_0x543f50[_0x6e53('0x35')]=qs[_0x6e53('0x35')](_0x2a5cf6[_0x6e53('0x45')][_0x6e53('0x35')]);_0x543f50['offset']=qs[_0x6e53('0x4e')](_0x2a5cf6[_0x6e53('0x45')][_0x6e53('0x4e')]);}_0x543f50[_0x6e53('0x4f')]=qs[_0x6e53('0x50')](_0x2a5cf6['query'][_0x6e53('0x50')]);_0x543f50[_0x6e53('0x51')]=qs[_0x6e53('0x47')](_[_0x6e53('0x70')](_0x2a5cf6['query'],_0x1c9dcc['filters']));_0x543f50[_0x6e53('0x51')][_0x6e53('0x6a')]=_0xae1723['id'];if(_0x2a5cf6[_0x6e53('0x45')][_0x6e53('0x52')]){_0x543f50[_0x6e53('0x51')]=_[_0x6e53('0x53')](_0x543f50[_0x6e53('0x51')],{'$or':_['map'](_0x543f50['attributes'],function(_0x1afe41){var _0x3c845f={};_0x3c845f[_0x1afe41]={'$like':'%'+_0x2a5cf6['query'][_0x6e53('0x52')]+'%'};return _0x3c845f;})});}_0x543f50=_['merge']({},_0x543f50,_0x2a5cf6[_0x6e53('0x54')]);return db[_0x6e53('0x73')]['count']({'where':_0x543f50[_0x6e53('0x51')]})['then'](function(_0xdf2c68){_0x1f6b34[_0x6e53('0x34')]=_0xdf2c68;if(_0x2a5cf6[_0x6e53('0x45')][_0x6e53('0x5a')]){_0x543f50[_0x6e53('0x56')]=[{'model':db[_0x6e53('0x77')],'as':_0x6e53('0x78'),'required':![]},{'model':db[_0x6e53('0x79')],'as':'Owner','attributes':[_0x6e53('0x3e'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x6e53('0x3e'),_0x6e53('0x7a')],'where':_0x2a5cf6[_0x6e53('0x45')][_0x6e53('0x7b')]?{'id':_0x2a5cf6[_0x6e53('0x45')][_0x6e53('0x7b')]}:undefined,'required':_0x2a5cf6[_0x6e53('0x45')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x6e53('0x57')](_0x543f50);})[_0x6e53('0x26')](function(_0x1b7742){_0x1f6b34[_0x6e53('0x6b')]=_0x1b7742;return _0x1f6b34;});}})[_0x6e53('0x26')](respondWithFilteredResult(_0x53526f,_0x543f50))[_0x6e53('0x2f')](handleError(_0x53526f,null));};exports[_0x6e53('0x7c')]=function(_0x1d770f,_0x4644a1,_0x34dbc0){return db['FaxAccount'][_0x6e53('0x68')]({'where':{'id':_0x1d770f[_0x6e53('0x58')]['id']}})['then'](handleEntityNotFound(_0x4644a1,null))[_0x6e53('0x26')](function(_0x50688d){if(_0x50688d){return db['sequelize']['transaction'](function(_0x12846d){return db['FaxApplication'][_0x6e53('0x39')]({'where':{'FaxAccountId':_0x1d770f[_0x6e53('0x58')]['id']},'transaction':_0x12846d})[_0x6e53('0x26')](function(_0x16478d){var _0x368779=_['map'](_0x1d770f[_0x6e53('0x5c')],function(_0x571e1b){_0x571e1b[_0x6e53('0x6a')]=_0x1d770f[_0x6e53('0x58')]['id'];return _0x571e1b;});return db[_0x6e53('0x7d')]['bulkCreate'](_0x368779,{'transaction':_0x12846d});});})[_0x6e53('0x26')](function(){return db[_0x6e53('0x7d')][_0x6e53('0x7e')]({'where':{'FaxAccountId':_0x1d770f['params']['id']},'order':_0x6e53('0x7f')});});}})[_0x6e53('0x26')](respondWithResult(_0x4644a1,null))[_0x6e53('0x2f')](handleError(_0x4644a1,null));};exports[_0x6e53('0x80')]=function(_0x11385b,_0x474a25,_0x54fbe5){var _0x252acc={};var _0x5b6313={};var _0x3ae666;var _0x1dcbe5;return db['FaxAccount'][_0x6e53('0x68')]({'where':{'id':_0x11385b[_0x6e53('0x58')]['id']}})[_0x6e53('0x26')](handleEntityNotFound(_0x474a25,null))['then'](function(_0xf77b02){if(_0xf77b02){_0x3ae666=_0xf77b02;_0x5b6313[_0x6e53('0x4a')]=_[_0x6e53('0x46')](db[_0x6e53('0x7d')]['rawAttributes']);_0x5b6313[_0x6e53('0x45')]=_[_0x6e53('0x46')](_0x11385b[_0x6e53('0x45')]);_0x5b6313['filters']=_[_0x6e53('0x48')](_0x5b6313[_0x6e53('0x4a')],_0x5b6313[_0x6e53('0x45')]);_0x252acc[_0x6e53('0x49')]=_['intersection'](_0x5b6313[_0x6e53('0x4a')],qs[_0x6e53('0x4b')](_0x11385b[_0x6e53('0x45')][_0x6e53('0x4b')]));_0x252acc[_0x6e53('0x49')]=_0x252acc[_0x6e53('0x49')][_0x6e53('0x4c')]?_0x252acc[_0x6e53('0x49')]:_0x5b6313['model'];_0x252acc[_0x6e53('0x4f')]=qs[_0x6e53('0x50')](_0x11385b[_0x6e53('0x45')]['sort']);_0x252acc[_0x6e53('0x51')]=qs[_0x6e53('0x47')](_[_0x6e53('0x70')](_0x11385b['query'],_0x5b6313[_0x6e53('0x47')]));if(_0x11385b[_0x6e53('0x45')]['filter']){_0x252acc[_0x6e53('0x51')]=_[_0x6e53('0x53')](_0x252acc[_0x6e53('0x51')],{'$or':_[_0x6e53('0x41')](_0x252acc[_0x6e53('0x49')],function(_0x37aaa1){var _0x270707={};_0x270707[_0x37aaa1]={'$like':'%'+_0x11385b[_0x6e53('0x45')][_0x6e53('0x52')]+'%'};return _0x270707;})});}_0x252acc=_[_0x6e53('0x53')]({},_0x252acc,_0x11385b[_0x6e53('0x54')]);return _0x3ae666[_0x6e53('0x80')](_0x252acc);}})['then'](function(_0x5c5b07){if(_0x5c5b07){_0x1dcbe5=_0x5c5b07[_0x6e53('0x4c')];if(!_0x11385b['query'][_0x6e53('0x76')](_0x6e53('0x4d'))){_0x252acc[_0x6e53('0x35')]=qs[_0x6e53('0x35')](_0x11385b[_0x6e53('0x45')][_0x6e53('0x35')]);_0x252acc[_0x6e53('0x4e')]=qs[_0x6e53('0x4e')](_0x11385b[_0x6e53('0x45')]['offset']);}return _0x3ae666['getApplications'](_0x252acc);}})['then'](function(_0x569f60){if(_0x569f60){return _0x569f60?{'count':_0x1dcbe5,'rows':_0x569f60}:null;}})[_0x6e53('0x26')](respondWithResult(_0x474a25,null))[_0x6e53('0x2f')](handleError(_0x474a25,null));};function Extension(_0x267e6f,_0x42476b,_0x3dcbc9,_0x4b164f){this[_0x6e53('0x81')]=_0x6e53('0x82');this[_0x6e53('0x83')]=_0x267e6f[_0x6e53('0x84')];this[_0x6e53('0x85')]=_0x4b164f;this[_0x6e53('0x43')]='system';this['description']=_0x6e53('0x86');this[_0x6e53('0x6a')]=_0x267e6f['id'];this[_0x6e53('0x7f')]=_0x42476b;this[_0x6e53('0x87')]=_0x3dcbc9;}function createExtensionsReciveFax(_0x1c4dd6){var _0x4678ba=0x1;var _0x1a28cf=[];_0x1a28cf[_0x6e53('0x88')](new Extension(_0x1c4dd6,_0x4678ba,'','Answer'));_0x4678ba+=0x1;_0x1a28cf[_0x6e53('0x88')](new Extension(_0x1c4dd6,_0x4678ba,_0x6e53('0x89'),_0x6e53('0x8a')));_0x4678ba+=0x1;for(var _0xd1826a in _0x1c4dd6){if(_0x1c4dd6[_0x6e53('0x76')](_0xd1826a)&&(_0xd1826a===_0x6e53('0x8b')||_0xd1826a===_0x6e53('0x84')||_0xd1826a===_0x6e53('0x8c')||_0xd1826a===_0x6e53('0x8d')||_0xd1826a===_0x6e53('0x8e')||_0xd1826a===_0x6e53('0x8f')||_0xd1826a==='minrate'||_0xd1826a===_0x6e53('0x90')||_0xd1826a===_0x6e53('0x91'))){_0x1a28cf[_0x6e53('0x88')](new Extension(_0x1c4dd6,_0x4678ba,_0x6e53('0x92')+_0xd1826a+')='+_0x1c4dd6[_0xd1826a],'Set'));_0x4678ba+=0x1;}}_0x1a28cf[_0x6e53('0x88')](new Extension(_0x1c4dd6,_0x4678ba,'6',_0x6e53('0x93')));_0x4678ba+=0x1;_0x1a28cf[_0x6e53('0x88')](new Extension(_0x1c4dd6,_0x4678ba,'/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',_0x6e53('0x94')));_0x4678ba=0x0;return _0x1a28cf;}exports['addAccountApplications']=function(_0x1d2bca,_0x3368b8,_0x380d5a){var _0x4e3d33;return db[_0x6e53('0x95')][_0x6e53('0x96')](function(_0x5ae152){return db['FaxAccount'][_0x6e53('0x5b')](_0x1d2bca[_0x6e53('0x5c')],{'transaction':_0x5ae152})[_0x6e53('0x26')](function(_0x16cf6a){_0x4e3d33=_0x16cf6a[_0x6e53('0x3a')]({'plain':!![]});return db[_0x6e53('0x97')][_0x6e53('0x98')](createExtensionsReciveFax(_0x4e3d33),{'transaction':_0x5ae152});});})['then'](function(){return _0x4e3d33;})[_0x6e53('0x26')](respondWithResult(_0x3368b8,null))[_0x6e53('0x2f')](handleError(_0x3368b8,null));};exports['updateAccountApplications']=function(_0x4c2594,_0x296c75,_0x5caf33){var _0x247b75;return db[_0x6e53('0x95')][_0x6e53('0x96')](function(_0xdd7588){return db[_0x6e53('0x55')][_0x6e53('0x38')](_0x4c2594[_0x6e53('0x5c')],{'where':{'id':_0x4c2594[_0x6e53('0x5c')]['id']},'transaction':_0xdd7588})[_0x6e53('0x26')](function(_0x4a90d3){return db[_0x6e53('0x97')][_0x6e53('0x39')]({'where':{'FaxAccountId':_0x4c2594[_0x6e53('0x5c')]['id']},'transaction':_0xdd7588})[_0x6e53('0x26')](function(_0xbeedbd){return db['VoiceExtension'][_0x6e53('0x98')](createExtensionsReciveFax(_['omit'](_0x4c2594[_0x6e53('0x5c')],[_0x6e53('0x99'),_0x6e53('0x44'),'createdAt','updatedAt',_0x6e53('0x9a'),'ListId'])),{'transaction':_0xdd7588});});});})[_0x6e53('0x26')](function(){return db[_0x6e53('0x55')]['findById'](_0x4c2594[_0x6e53('0x5c')]['id']);})[_0x6e53('0x26')](respondWithResult(_0x296c75,null))[_0x6e53('0x2f')](handleError(_0x296c75,null));};exports[_0x6e53('0x9b')]=function(_0xdd6820,_0x3d3e71,_0x5e6ef5){var _0x473669={'raw':!![],'where':{}};var _0xd70b9b={};var _0x4e19d6={'count':0x0,'rows':[]};return db[_0x6e53('0x55')]['findOne']({'where':{'id':_0xdd6820[_0x6e53('0x58')]['id']}})[_0x6e53('0x26')](handleEntityNotFound(_0x3d3e71,null))[_0x6e53('0x26')](function(_0x1d4e04){if(_0x1d4e04){_0xd70b9b[_0x6e53('0x4a')]=_[_0x6e53('0x46')](db['FaxMessage'][_0x6e53('0x69')]);_0xd70b9b[_0x6e53('0x45')]=_[_0x6e53('0x46')](_0xdd6820[_0x6e53('0x45')]);_0xd70b9b['filters']=_['intersection'](_0xd70b9b[_0x6e53('0x4a')],_0xd70b9b[_0x6e53('0x45')]);_0x473669[_0x6e53('0x49')]=_[_0x6e53('0x48')](_0xd70b9b[_0x6e53('0x4a')],qs['fields'](_0xdd6820['query'][_0x6e53('0x4b')]));_0x473669[_0x6e53('0x49')]=_0x473669[_0x6e53('0x49')][_0x6e53('0x4c')]?_0x473669['attributes']:_0xd70b9b[_0x6e53('0x4a')];if(!_0xdd6820['query'][_0x6e53('0x76')](_0x6e53('0x4d'))){_0x473669[_0x6e53('0x35')]=qs['limit'](_0xdd6820[_0x6e53('0x45')]['limit']);_0x473669[_0x6e53('0x4e')]=qs[_0x6e53('0x4e')](_0xdd6820['query'][_0x6e53('0x4e')]);}_0x473669['order']=qs[_0x6e53('0x50')](_0xdd6820[_0x6e53('0x45')][_0x6e53('0x50')]);_0x473669['where']=qs[_0x6e53('0x47')](_[_0x6e53('0x70')](_0xdd6820[_0x6e53('0x45')],_0xd70b9b[_0x6e53('0x47')]));_0x473669[_0x6e53('0x51')][_0x6e53('0x6a')]=_0x1d4e04['id'];if(_0xdd6820[_0x6e53('0x45')]['filter']){_0x473669[_0x6e53('0x51')]=_[_0x6e53('0x53')](_0x473669[_0x6e53('0x51')],{'$or':_[_0x6e53('0x41')](_0x473669[_0x6e53('0x49')],function(_0x566e6c){var _0x3f1a49={};_0x3f1a49[_0x566e6c]={'$like':'%'+_0xdd6820[_0x6e53('0x45')][_0x6e53('0x52')]+'%'};return _0x3f1a49;})});}if(_0xdd6820[_0x6e53('0x45')]['$gte']){var _0x1bec15=_0xdd6820[_0x6e53('0x45')][_0x6e53('0x9c')][_0x6e53('0x9d')](',');var _0x4b45e1={};_0x4b45e1[_0x1bec15[0x0]]={'$gte':moment(_0x1bec15[0x1])['format'](_0x6e53('0x9e'))};_0x473669[_0x6e53('0x51')]=_[_0x6e53('0x53')](_0x473669['where'],_0x4b45e1);}_0x473669=_[_0x6e53('0x53')]({},_0x473669,_0xdd6820[_0x6e53('0x54')]);return db[_0x6e53('0x9f')][_0x6e53('0x34')]({'where':_0x473669[_0x6e53('0x51')]})[_0x6e53('0x26')](function(_0x5f3cc7){_0x4e19d6[_0x6e53('0x34')]=_0x5f3cc7;if(_0xdd6820[_0x6e53('0x45')][_0x6e53('0x5a')]){_0x473669[_0x6e53('0x56')]=[{'all':!![]}];}return db[_0x6e53('0x9f')][_0x6e53('0x57')](_0x473669);})[_0x6e53('0x26')](function(_0x2e258c){_0x4e19d6[_0x6e53('0x6b')]=_0x2e258c;return _0x4e19d6;});}})[_0x6e53('0x26')](respondWithFilteredResult(_0x3d3e71,_0x473669))['catch'](handleError(_0x3d3e71,null));};exports['send']=function(_0x30175d,_0x32c482,_0x59f9ee){var _0x69342b,_0x1fef48={},_0x42d9b8;if(_0x30175d[_0x6e53('0x5c')]['to']){_0x42d9b8=_0x30175d[_0x6e53('0x5c')]['to'][0x0];}return db[_0x6e53('0x55')][_0x6e53('0x61')]({'where':{'id':_0x30175d[_0x6e53('0x58')]['id']},'include':[{'model':db[_0x6e53('0xa0')],'as':'List','include':[{'model':db[_0x6e53('0x77')],'as':'Contacts','where':{'fax':_0x42d9b8},'limit':0x1,'order':[[_0x6e53('0xa1'),'DESC']]}]}]})[_0x6e53('0x26')](handleEntityNotFound(_0x32c482,null))[_0x6e53('0x26')](function(_0xd43640){_0x69342b=_0xd43640;if(_0x30175d[_0x6e53('0x5c')]['attachments']&&_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa2')][_0x6e53('0x4c')]){for(var _0x3ecfcb=0x0;_0x3ecfcb<_0x30175d[_0x6e53('0x5c')]['attachments']['length'];_0x3ecfcb+=0x1){_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa2')][_0x3ecfcb]={'filename':_0x30175d[_0x6e53('0x5c')]['attachments'][_0x3ecfcb]['name'],'id':_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa2')][_0x3ecfcb]['id'],'path':path[_0x6e53('0xa3')](config['root'],'server/files/attachments',_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa2')][_0x3ecfcb]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x6e53('0xa4'),{'FaxAccountId':_[_0x6e53('0xa5')](_0x30175d['params']['id'])?undefined:_0x30175d[_0x6e53('0x58')]['id'],'path':_[_0x6e53('0xa5')](_0x30175d['body']['attachments'][0x0][_0x6e53('0x8')])?undefined:_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa2')][0x0]['path'],'fax':_['isNil'](_0x30175d[_0x6e53('0x5c')]['to'][0x0])?undefined:_0x30175d[_0x6e53('0x5c')]['to'][0x0]},client9002);})['then'](function(){if(_0x69342b){if(_[_0x6e53('0xa5')](_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa6')])){_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa6')]=util['format']('\x22%s\x22\x20<%s>',_0x69342b[_0x6e53('0x3e')],_0x69342b[_0x6e53('0xa7')]);}if(_0x69342b['List']){if(_0x69342b['List'][_0x6e53('0xa8')][_0x6e53('0x4c')]){return _0x69342b[_0x6e53('0xa9')][_0x6e53('0xa8')][0x0];}else{return db[_0x6e53('0x77')][_0x6e53('0x5b')](_[_0x6e53('0x1a')](_0x30175d[_0x6e53('0x5c')],{'firstName':_0x30175d[_0x6e53('0x5c')]['to'][0x0],'phone':_0x30175d['body']['to'][0x0],'fax':_0x30175d[_0x6e53('0x5c')]['to'][0x0],'ListId':_0x69342b[_0x6e53('0xaa')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x6e53('0xab'));}})['then'](function(_0x41cc33){if(_0x41cc33){return db[_0x6e53('0x73')][_0x6e53('0x61')]({'where':{'ContactId':_0x41cc33['id'],'closed':![],'FaxAccountId':_0x69342b['id']}})[_0x6e53('0x26')](function(_0x128d12){if(_0x128d12){return[_0x128d12,![]];}return db[_0x6e53('0x73')][_0x6e53('0x5b')]({'UserId':_0x30175d['user']['id'],'ContactId':_0x41cc33['id'],'FaxAccountId':_0x69342b['id'],'fax':_0x30175d[_0x6e53('0x5c')]['to'][0x0],'firstMsgDirection':_0x6e53('0xac'),'Messages':[_[_0x6e53('0x53')](_0x30175d[_0x6e53('0x5c')],{'read':![],'body':_0x30175d[_0x6e53('0x5c')]['attachments'][0x0][_0x6e53('0xad')],'FaxAccountId':_0x69342b['id'],'UserId':_0x30175d[_0x6e53('0x5d')]['id'],'ContactId':_0x41cc33['id'],'AttachmentId':_0x30175d['body'][_0x6e53('0xa2')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x6e53('0xae')}]})['then'](function(_0x3e7157){return[_0x3e7157,!![]];});});}else{throw new Error(_0x6e53('0xaf'));}})[_0x6e53('0xb0')](function(_0x1e969e,_0x28c3f7){if(_0x28c3f7){return _0x1e969e;}return db[_0x6e53('0x9f')][_0x6e53('0x5b')]({'direction':_0x6e53('0xac'),'read':![],'body':_0x30175d[_0x6e53('0x5c')]['attachments'][0x0][_0x6e53('0xad')],'FaxAccountId':_0x69342b['id'],'FaxInteractionId':_0x1e969e['id'],'UserId':_0x30175d[_0x6e53('0x5d')]['id'],'ContactId':_0x1e969e[_0x6e53('0xb1')],'AttachmentId':_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa2')][0x0]['id']})[_0x6e53('0x26')](function(_0x33a48b){_0x1e969e[_0x6e53('0xb2')][_0x6e53('0xae')]=[];_0x1e969e[_0x6e53('0xb2')][_0x6e53('0xae')]['push'](_0x33a48b[_0x6e53('0xb2')]);return _0x1e969e;});})[_0x6e53('0x26')](function(_0x2b3a5c){respondWithRpcPromise('SendFax',_0x6e53('0xb3'),{'FaxAccountId':_[_0x6e53('0xa5')](_0x30175d['params']['id'])?undefined:_0x30175d['params']['id'],'path':_[_0x6e53('0xa5')](_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa2')][0x0]['path'])?undefined:_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa2')][0x0][_0x6e53('0x8')],'fax':_[_0x6e53('0xa5')](_0x30175d['body']['to'][0x0])?undefined:_0x30175d[_0x6e53('0x5c')]['to'][0x0],'AttachmentId':_0x30175d[_0x6e53('0x5c')][_0x6e53('0xa2')][0x0]['id']},client9002)[_0x6e53('0x26')](function(_0x5ddc77){logger[_0x6e53('0x27')](_0x6e53('0xb4'),_0x5ddc77);})[_0x6e53('0x2f')](function(_0x1e437b){logger[_0x6e53('0x27')](_0x6e53('0xb4'),_0x1e437b);});return _0x2b3a5c;})[_0x6e53('0x26')](respondWithResult(_0x32c482,null))[_0x6e53('0x2f')](handleError(_0x32c482,null));};exports['addAgents']=function(_0x37d062,_0xde26d3,_0x576c35){return db[_0x6e53('0x55')][_0x6e53('0x61')]({'where':{'id':_0x37d062['params']['id']}})['then'](handleEntityNotFound(_0xde26d3,null))[_0x6e53('0x26')](function(_0x1e7bcb){if(_0x1e7bcb){return _0x1e7bcb['addAgents'](_0x37d062[_0x6e53('0x5c')]['ids'],_['omit'](_0x37d062[_0x6e53('0x5c')],[_0x6e53('0x6d'),'id'])||{})['spread'](function(_0x287a3c){for(var _0x2b10a4=0x0;_0x2b10a4<_0x37d062['body'][_0x6e53('0x6d')][_0x6e53('0x4c')];_0x2b10a4+=0x1){socket[_0x6e53('0xb5')]('userFaxAccount:save',{'UserId':_0x37d062[_0x6e53('0x5c')][_0x6e53('0x6d')][_0x2b10a4],'FaxAccountId':_0x37d062[_0x6e53('0x58')]['id']});}return _0x287a3c;});}})[_0x6e53('0x26')](respondWithResult(_0xde26d3,null))[_0x6e53('0x2f')](handleError(_0xde26d3,null));};exports[_0x6e53('0xb6')]=function(_0x205b64,_0x215154,_0x3cf868){return db[_0x6e53('0x55')]['find']({'where':{'id':_0x205b64[_0x6e53('0x58')]['id']}})['then'](handleEntityNotFound(_0x215154,null))[_0x6e53('0x26')](function(_0x29494c){if(_0x29494c){return _0x29494c[_0x6e53('0xb6')](_0x205b64['query'][_0x6e53('0x6d')])[_0x6e53('0x26')](function(){if(_['isArray'](_0x205b64[_0x6e53('0x45')][_0x6e53('0x6d')])){for(var _0x3b720d=0x0;_0x3b720d<_0x205b64['query'][_0x6e53('0x6d')]['length'];_0x3b720d+=0x1){socket[_0x6e53('0xb5')](_0x6e53('0xb7'),{'UserId':Number(_0x205b64[_0x6e53('0x45')][_0x6e53('0x6d')][_0x3b720d]),'FaxAccountId':Number(_0x205b64['params']['id'])});}}else{socket[_0x6e53('0xb5')](_0x6e53('0xb7'),{'UserId':Number(_0x205b64['query']['ids']),'FaxAccountId':Number(_0x205b64['params']['id'])});}});}})['then'](respondWithStatusCode(_0x215154,null))['catch'](handleError(_0x215154,null));};exports['getAgents']=function(_0x171de9,_0xb365cf,_0x2f5872){var _0xc537a={};var _0x535d96={};var _0x534723;var _0x1b6cef;return db['FaxAccount'][_0x6e53('0x68')]({'where':{'id':_0x171de9[_0x6e53('0x58')]['id']}})[_0x6e53('0x26')](handleEntityNotFound(_0xb365cf,null))[_0x6e53('0x26')](function(_0x51df25){if(_0x51df25){_0x534723=_0x51df25;_0x535d96[_0x6e53('0x4a')]=_['keys'](db[_0x6e53('0x79')][_0x6e53('0x69')]);_0x535d96[_0x6e53('0x45')]=_[_0x6e53('0x46')](_0x171de9['query']);_0x535d96['filters']=_[_0x6e53('0x48')](_0x535d96[_0x6e53('0x4a')],_0x535d96[_0x6e53('0x45')]);_0xc537a[_0x6e53('0x49')]=_[_0x6e53('0x48')](_0x535d96[_0x6e53('0x4a')],qs['fields'](_0x171de9[_0x6e53('0x45')][_0x6e53('0x4b')]));_0xc537a[_0x6e53('0x49')]=_0xc537a['attributes'][_0x6e53('0x4c')]?_0xc537a[_0x6e53('0x49')]:_0x535d96[_0x6e53('0x4a')];_0xc537a[_0x6e53('0x4f')]=qs['sort'](_0x171de9[_0x6e53('0x45')][_0x6e53('0x50')]);_0xc537a['where']=qs[_0x6e53('0x47')](_[_0x6e53('0x70')](_0x171de9[_0x6e53('0x45')],_0x535d96[_0x6e53('0x47')]));if(_0x171de9['query'][_0x6e53('0x52')]){_0xc537a[_0x6e53('0x51')]=_[_0x6e53('0x53')](_0xc537a[_0x6e53('0x51')],{'$or':_[_0x6e53('0x41')](_0xc537a['attributes'],function(_0x2ffb68){var _0x254143={};_0x254143[_0x2ffb68]={'$like':'%'+_0x171de9[_0x6e53('0x45')][_0x6e53('0x52')]+'%'};return _0x254143;})});}_0xc537a=_['merge']({},_0xc537a,_0x171de9[_0x6e53('0x54')]);return _0x534723[_0x6e53('0xb8')](_0xc537a);}})[_0x6e53('0x26')](function(_0x27f76e){if(_0x27f76e){_0x1b6cef=_0x27f76e[_0x6e53('0x4c')];if(!_0x171de9['query'][_0x6e53('0x76')]('nolimit')){_0xc537a[_0x6e53('0x35')]=qs[_0x6e53('0x35')](_0x171de9[_0x6e53('0x45')]['limit']);_0xc537a[_0x6e53('0x4e')]=qs[_0x6e53('0x4e')](_0x171de9['query'][_0x6e53('0x4e')]);}return _0x534723[_0x6e53('0xb8')](_0xc537a);}})[_0x6e53('0x26')](function(_0x46e5b2){if(_0x46e5b2){return _0x46e5b2?{'count':_0x1b6cef,'rows':_0x46e5b2}:null;}})[_0x6e53('0x26')](respondWithResult(_0xb365cf,null))[_0x6e53('0x2f')](handleError(_0xb365cf,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b98d753..5d34ca3 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 _0xdee4=['FaxAccount','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4e90c9,_0x5335c4){var _0x15aef7=function(_0x240724){while(--_0x240724){_0x4e90c9['push'](_0x4e90c9['shift']());}};_0x15aef7(++_0x5335c4);}(_0xdee4,0x136));var _0x4dee=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0xdee4[_0xa388a2];return _0x7ce7f6;};'use strict';var EventEmitter=require(_0x4dee('0x0'));var FaxAccount=require(_0x4dee('0x1'))['db'][_0x4dee('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4dee('0x3'),'afterUpdate':'update','afterDestroy':_0x4dee('0x4')};function emitEvent(_0x58e39d){return function(_0x30806e,_0x38e912,_0x302c35){FaxAccountEvents[_0x4dee('0x5')](_0x58e39d+':'+_0x30806e['id'],_0x30806e);FaxAccountEvents[_0x4dee('0x5')](_0x58e39d,_0x30806e);_0x302c35(null);};}for(var e in events){if(events[_0x4dee('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x4dee('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x4d57=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x245a7d,_0x253c2f){var _0x24789d=function(_0x189e60){while(--_0x189e60){_0x245a7d['push'](_0x245a7d['shift']());}};_0x24789d(++_0x253c2f);}(_0x4d57,0x10f));var _0x74d5=function(_0x5d76a5,_0x1a2f29){_0x5d76a5=_0x5d76a5-0x0;var _0x4b0e54=_0x4d57[_0x5d76a5];return _0x4b0e54;};'use strict';var EventEmitter=require(_0x74d5('0x0'));var FaxAccount=require(_0x74d5('0x1'))['db'][_0x74d5('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x74d5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x74d5('0x4'),'afterDestroy':_0x74d5('0x5')};function emitEvent(_0x22714f){return function(_0x37ae1f,_0x1b573f,_0x5542c7){FaxAccountEvents[_0x74d5('0x6')](_0x22714f+':'+_0x37ae1f['id'],_0x37ae1f);FaxAccountEvents[_0x74d5('0x6')](_0x22714f,_0x37ae1f);_0x5542c7(null);};}for(var e in events){if(events[_0x74d5('0x7')](e)){var event=events[e];FaxAccount[_0x74d5('0x8')](e,emitEvent(event));}}module[_0x74d5('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index b25e08e..59ac730 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 _0x64a1=['./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x64a1,0x93));var _0x164a=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x64a1[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x164a('0x0'));var util=require('util');var logger=require(_0x164a('0x1'))('api');var moment=require(_0x164a('0x2'));var BPromise=require(_0x164a('0x3'));var rp=require(_0x164a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x164a('0x5'));var config=require(_0x164a('0x6'));var attributes=require(_0x164a('0x7'));module['exports']=function(_0x368134,_0x2e60ad){return _0x368134[_0x164a('0x8')](_0x164a('0x9'),attributes,{'tableName':_0x164a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4a8=['moment','path','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','util','../../config/logger','api'];(function(_0x419234,_0x1c7ffa){var _0x1d94fb=function(_0x4ca8a9){while(--_0x4ca8a9){_0x419234['push'](_0x419234['shift']());}};_0x1d94fb(++_0x1c7ffa);}(_0xe4a8,0xb1));var _0x8e4a=function(_0x3d35a2,_0x1240da){_0x3d35a2=_0x3d35a2-0x0;var _0x539ed2=_0xe4a8[_0x3d35a2];return _0x539ed2;};'use strict';var _=require('lodash');var util=require(_0x8e4a('0x0'));var logger=require(_0x8e4a('0x1'))(_0x8e4a('0x2'));var moment=require(_0x8e4a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e4a('0x4'));var rimraf=require('rimraf');var config=require(_0x8e4a('0x5'));var attributes=require(_0x8e4a('0x6'));module['exports']=function(_0x920490,_0x88ecc8){return _0x920490[_0x8e4a('0x7')](_0x8e4a('0x8'),attributes,{'tableName':_0x8e4a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 623e3b4..2fe92e5 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 _0x4737=['register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','include','model','attributes','map','debug','NotifyFaxAccount','body','fax','CmContact','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','DESC','FaxApplication','List','get','account','applications','orderBy','priority','asc','Applications','length','create','contact','find','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','created','interaction','FaxMessage','ContactId','UserId','unshift','name','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket'];(function(_0x534fa7,_0x25acc8){var _0xfced13=function(_0x340da0){while(--_0x340da0){_0x534fa7['push'](_0x534fa7['shift']());}};_0xfced13(++_0x25acc8);}(_0x4737,0x141));var _0x7473=function(_0x3cfc2f,_0x9b607e){_0x3cfc2f=_0x3cfc2f-0x0;var _0x301bc3=_0x4737[_0x3cfc2f];return _0x301bc3;};'use strict';var _=require(_0x7473('0x0'));var util=require(_0x7473('0x1'));var moment=require(_0x7473('0x2'));var BPromise=require(_0x7473('0x3'));var rs=require(_0x7473('0x4'));var fs=require('fs');var Redis=require(_0x7473('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7473('0x6'))('rpc');var config=require(_0x7473('0x7'));var jayson=require(_0x7473('0x8'));var client=jayson[_0x7473('0x9')]['http']({'port':0x232c});config[_0x7473('0xa')]=_[_0x7473('0xb')](config['redis'],{'host':_0x7473('0xc'),'port':0x18eb});var socket=require(_0x7473('0xd'))(new Redis(config[_0x7473('0xa')]));require(_0x7473('0xe'))[_0x7473('0xf')](socket);function respondWithRpcPromise(_0x40dbd4,_0x4f996d,_0x52f315){return new BPromise(function(_0x11fb0a,_0x54afcf){return client['request'](_0x40dbd4,_0x52f315)[_0x7473('0x10')](function(_0x1c4683){logger[_0x7473('0x11')](_0x7473('0x12'),_0x4f996d,_0x7473('0x13'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4f996d,_0x7473('0x13'),JSON[_0x7473('0x14')](_0x1c4683));if(_0x1c4683[_0x7473('0x15')]){if(_0x1c4683[_0x7473('0x15')][_0x7473('0x16')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x4f996d,_0x1c4683['error']['message']);return _0x54afcf(_0x1c4683[_0x7473('0x15')]['message']);}logger[_0x7473('0x15')](_0x7473('0x12'),_0x4f996d,_0x1c4683[_0x7473('0x15')]['message']);return _0x11fb0a(_0x1c4683[_0x7473('0x15')][_0x7473('0x17')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4f996d,_0x7473('0x13'));_0x11fb0a(_0x1c4683[_0x7473('0x18')]['message']);}})[_0x7473('0x19')](function(_0x48cc91){logger[_0x7473('0x15')]('FaxAccount,\x20%s,\x20%s',_0x4f996d,_0x48cc91);_0x54afcf(_0x48cc91);});});}exports[_0x7473('0x1a')]=function(_0x55b369){var _0x30bede=this;return new Promise(function(_0x42f94a,_0x1bbca2){return db[_0x7473('0x1b')]['findAll']({'raw':_0x55b369[_0x7473('0x1c')]?_0x55b369[_0x7473('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x55b369[_0x7473('0x1c')]?_0x55b369[_0x7473('0x1c')]['where']||null:null,'attributes':_0x55b369[_0x7473('0x1c')]?_0x55b369[_0x7473('0x1c')]['attributes']||null:null,'limit':_0x55b369[_0x7473('0x1c')]?_0x55b369['options']['limit']||null:null,'include':_0x55b369[_0x7473('0x1c')]?_0x55b369['options'][_0x7473('0x1d')]?_['map'](_0x55b369[_0x7473('0x1c')]['include'],function(_0x52dcf2){return{'model':db[_0x52dcf2[_0x7473('0x1e')]],'as':_0x52dcf2['as'],'attributes':_0x52dcf2[_0x7473('0x1f')],'include':_0x52dcf2['include']?_[_0x7473('0x20')](_0x52dcf2['include'],function(_0x4c7151){return{'model':db[_0x4c7151[_0x7473('0x1e')]],'as':_0x4c7151['as'],'attributes':_0x4c7151[_0x7473('0x1f')],'include':_0x4c7151[_0x7473('0x1d')]?_['map'](_0x4c7151[_0x7473('0x1d')],function(_0x55c46b){return{'model':db[_0x55c46b[_0x7473('0x1e')]],'as':_0x55c46b['as'],'attributes':_0x55c46b['attributes']};}):[]};}):[]};}):[]:[]})[_0x7473('0x10')](function(_0x32a8f7){logger['info'](_0x7473('0x1a'),_0x55b369);logger[_0x7473('0x21')](_0x7473('0x1a'),_0x55b369,JSON[_0x7473('0x14')](_0x32a8f7));_0x42f94a(_0x32a8f7);})['catch'](function(_0x55bfc2){logger[_0x7473('0x15')]('GetFaxAccount',_0x55bfc2[_0x7473('0x17')],_0x55b369);_0x1bbca2(_0x30bede[_0x7473('0x15')](0x1f4,_0x55bfc2[_0x7473('0x17')]));});});};exports[_0x7473('0x22')]=function(_0x2bd524,_0x3b8e57,_0x5033c8){var _0x340543=this;return new Promise(function(_0x13320e,_0x1bb9b4){var _0x3fc8c5={'body':_0x2bd524[_0x7473('0x23')],'channel':_0x7473('0x24')};var _0x31dde1=[];var _0x5cd8ca=[];var _0x2472e6={};return db[_0x7473('0x25')]['describe']()[_0x7473('0x10')](function(_0x49fa0c){if(!_0x49fa0c){throw new db['Sequelize'][(_0x7473('0x26'))](_0x7473('0x27'));}_0x31dde1=_[_0x7473('0x28')](_[_0x7473('0x29')](_0x49fa0c),[_0x7473('0x2a'),_0x7473('0x2b')]);_0x5cd8ca=_['difference'](_['keys'](_0x49fa0c),[_0x7473('0x2a'),'updatedAt','CompanyId',_0x7473('0x2c')]);if(_0x2bd524[_0x7473('0x23')]['id']){delete _0x2bd524[_0x7473('0x23')]['id'];}if(_['isNil'](_0x2bd524[_0x7473('0x23')][_0x7473('0x2d')])){throw new db[(_0x7473('0x2e'))][(_0x7473('0x26'))](_0x7473('0x2f'));}if(_[_0x7473('0x30')](_0x2bd524[_0x7473('0x23')][_0x7473('0x23')])||_0x2bd524[_0x7473('0x23')][_0x7473('0x23')]===''){throw new db[(_0x7473('0x2e'))][(_0x7473('0x26'))](_0x7473('0x31'));}if(_[_0x7473('0x30')](_0x2bd524[_0x7473('0x23')]['mapKey'])){throw new db['Sequelize'][(_0x7473('0x26'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cd8ca);}if(!_[_0x7473('0x32')](_0x5cd8ca,_0x2bd524['body']['mapKey'])){throw new db[(_0x7473('0x2e'))][(_0x7473('0x26'))](_0x7473('0x33')+_0x5cd8ca);}_0x2472e6[_0x2bd524[_0x7473('0x23')][_0x7473('0x34')]]=_0x2bd524['body'][_0x7473('0x2d')];})['then'](function(){return db[_0x7473('0x1b')]['find']({'where':{'id':_0x2bd524['account']['id']},'include':[{'model':db[_0x7473('0x35')],'as':'List','include':[{'model':db['CmContact'],'as':_0x7473('0x36'),'where':_0x2472e6,'limit':0x1,'order':[[_0x7473('0x2b'),_0x7473('0x37')]]}]},{'model':db[_0x7473('0x38')],'as':'Applications'}]});})[_0x7473('0x10')](function(_0xdc512e){if(_0xdc512e&&_0xdc512e[_0x7473('0x39')]){var _0x1bdb41=_0xdc512e[_0x7473('0x3a')]({'plain':!![]});_0x3fc8c5[_0x7473('0x3b')]=_0x1bdb41;_0x3fc8c5[_0x7473('0x3c')]=_0x1bdb41['Applications'];_0x3fc8c5['list']=_0x1bdb41['List'];_0x3fc8c5[_0x7473('0x3c')]=_[_0x7473('0x3d')](_0x3fc8c5['applications'],[_0x7473('0x3e')],[_0x7473('0x3f')]);if(_0x3fc8c5[_0x7473('0x3b')][_0x7473('0x40')]){delete _0x3fc8c5[_0x7473('0x3b')][_0x7473('0x40')];}if(_0x3fc8c5['account']['List']&&_0x3fc8c5[_0x7473('0x3b')][_0x7473('0x39')][_0x7473('0x36')][_0x7473('0x41')]){return _0x3fc8c5[_0x7473('0x3b')][_0x7473('0x39')][_0x7473('0x36')][0x0];}var _0x5536d9=_[_0x7473('0xb')](_0x2bd524[_0x7473('0x23')],{'firstName':_0x2bd524[_0x7473('0x23')][_0x7473('0x2d')],'ListId':_0x1bdb41[_0x7473('0x2c')]});_0x5536d9[_0x2bd524['body']['mapKey']]=_0x2bd524['body'][_0x7473('0x2d')];return db[_0x7473('0x25')][_0x7473('0x42')](_0x5536d9,{'fields':_0x31dde1,'raw':!![]});}})[_0x7473('0x10')](function(_0x35aa94){_0x3fc8c5[_0x7473('0x43')]=_0x35aa94;if(_0x35aa94){var _0x537de3={'ContactId':_0x35aa94['id'],'FaxAccountId':_0x2bd524[_0x7473('0x3b')]['id'],'fax':_0x35aa94[_0x7473('0x24')]};return db['FaxInteraction'][_0x7473('0x44')]({'where':{'ContactId':_0x35aa94['id'],'closed':![],'FaxAccountId':_0x2bd524[_0x7473('0x3b')]['id']}})[_0x7473('0x10')](function(_0xe9729b){if(_0xe9729b){return[_0xe9729b,![]];}return db[_0x7473('0x45')][_0x7473('0x42')](_0x537de3)['then'](function(_0xd0cfe5){return[_0xd0cfe5,!![]];});});}else{throw new Error(_0x7473('0x46'));}})[_0x7473('0x47')](function(_0x1c5f27,_0x46108d){var _0x3f02f7=_0x1c5f27[_0x7473('0x3a')]({'plain':!![]});if(_0x46108d){if(_0x3fc8c5[_0x7473('0x3b')][_0x7473('0x48')]){_0x3fc8c5[_0x7473('0x3c')][_0x7473('0x49')]({'id':0x0,'priority':_0x3fc8c5[_0x7473('0x3c')][_0x7473('0x41')]+0x1,'app':_0x7473('0x4a'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x3f02f7['created']=!![];}else{_0x3f02f7[_0x7473('0x4b')]=![];}_0x3fc8c5[_0x7473('0x4c')]=_0x3f02f7;return db[_0x7473('0x4d')]['create']({'body':_0x2bd524[_0x7473('0x23')][_0x7473('0x23')],'FaxAccountId':_0x2bd524[_0x7473('0x3b')]['id'],'FaxInteractionId':_0x1c5f27['id'],'direction':'in','ContactId':_0x1c5f27[_0x7473('0x4e')],'AttachmentId':_0x2bd524[_0x7473('0x23')]['AttachmentId']});})[_0x7473('0x10')](function(_0x2be257){_0x3fc8c5['message']=_0x2be257;if(_0x3fc8c5[_0x7473('0x4c')][_0x7473('0x4f')]){return db['User'][_0x7473('0x44')]({'attributes':['id','name'],'where':{'id':_0x3fc8c5[_0x7473('0x4c')][_0x7473('0x4f')]}})[_0x7473('0x10')](function(_0xa6fc27){if(_0xa6fc27){_0x3fc8c5[_0x7473('0x3c')][_0x7473('0x50')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xa6fc27[_0x7473('0x51')]+','+(_0x3fc8c5['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7473('0x52'),_0x7473('0x53'),_0x3fc8c5);});}return respondWithRpcPromise(_0x7473('0x52'),_0x7473('0x53'),_0x3fc8c5);})['then'](function(_0x185b3a){_0x13320e(_0x185b3a);})[_0x7473('0x19')](function(_0x389463){_0x1bb9b4(_0x340543[_0x7473('0x15')](0x1f4,_0x389463[_0x7473('0x17')]));});});}; \ No newline at end of file +var _0x76d5=['defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','User','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x10450c,_0x1d874e){var _0x56b43d=function(_0x18ecf2){while(--_0x18ecf2){_0x10450c['push'](_0x10450c['shift']());}};_0x56b43d(++_0x1d874e);}(_0x76d5,0x108));var _0x576d=function(_0x52c48a,_0x3fba71){_0x52c48a=_0x52c48a-0x0;var _0x38556e=_0x76d5[_0x52c48a];return _0x38556e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x576d('0x0'));var BPromise=require(_0x576d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x576d('0x2'));var logger=require(_0x576d('0x3'))(_0x576d('0x4'));var config=require('../../config/environment');var jayson=require(_0x576d('0x5'));var client=jayson[_0x576d('0x6')][_0x576d('0x7')]({'port':0x232c});config[_0x576d('0x8')]=_[_0x576d('0x9')](config['redis'],{'host':_0x576d('0xa'),'port':0x18eb});var socket=require(_0x576d('0xb'))(new Redis(config[_0x576d('0x8')]));require(_0x576d('0xc'))[_0x576d('0xd')](socket);function respondWithRpcPromise(_0x268014,_0x7434ed,_0x2d969b){return new BPromise(function(_0x3feab2,_0x49982f){return client['request'](_0x268014,_0x2d969b)[_0x576d('0xe')](function(_0x2db045){logger[_0x576d('0xf')]('FaxAccount,\x20%s,\x20%s',_0x7434ed,_0x576d('0x10'));logger[_0x576d('0x11')](_0x576d('0x12'),_0x7434ed,_0x576d('0x10'),JSON[_0x576d('0x13')](_0x2db045));if(_0x2db045[_0x576d('0x14')]){if(_0x2db045[_0x576d('0x14')][_0x576d('0x15')]===0x1f4){logger[_0x576d('0x14')](_0x576d('0x16'),_0x7434ed,_0x2db045[_0x576d('0x14')][_0x576d('0x17')]);return _0x49982f(_0x2db045[_0x576d('0x14')][_0x576d('0x17')]);}logger[_0x576d('0x14')](_0x576d('0x16'),_0x7434ed,_0x2db045['error']['message']);return _0x3feab2(_0x2db045[_0x576d('0x14')][_0x576d('0x17')]);}else{logger[_0x576d('0xf')](_0x576d('0x16'),_0x7434ed,_0x576d('0x10'));_0x3feab2(_0x2db045[_0x576d('0x18')]['message']);}})['catch'](function(_0x1fe214){logger['error'](_0x576d('0x16'),_0x7434ed,_0x1fe214);_0x49982f(_0x1fe214);});});}exports['GetFaxAccount']=function(_0x59c481){var _0x452066=this;return new Promise(function(_0x584443,_0x2f74ca){return db['FaxAccount'][_0x576d('0x19')]({'raw':_0x59c481[_0x576d('0x1a')]?_0x59c481['options'][_0x576d('0x1b')]===undefined?!![]:![]:!![],'where':_0x59c481[_0x576d('0x1a')]?_0x59c481[_0x576d('0x1a')][_0x576d('0x1c')]||null:null,'attributes':_0x59c481['options']?_0x59c481[_0x576d('0x1a')][_0x576d('0x1d')]||null:null,'limit':_0x59c481[_0x576d('0x1a')]?_0x59c481[_0x576d('0x1a')][_0x576d('0x1e')]||null:null,'include':_0x59c481['options']?_0x59c481['options'][_0x576d('0x1f')]?_[_0x576d('0x20')](_0x59c481[_0x576d('0x1a')][_0x576d('0x1f')],function(_0x3442d4){return{'model':db[_0x3442d4[_0x576d('0x21')]],'as':_0x3442d4['as'],'attributes':_0x3442d4[_0x576d('0x1d')],'include':_0x3442d4[_0x576d('0x1f')]?_[_0x576d('0x20')](_0x3442d4[_0x576d('0x1f')],function(_0x56a295){return{'model':db[_0x56a295[_0x576d('0x21')]],'as':_0x56a295['as'],'attributes':_0x56a295[_0x576d('0x1d')],'include':_0x56a295[_0x576d('0x1f')]?_[_0x576d('0x20')](_0x56a295[_0x576d('0x1f')],function(_0x29b5ef){return{'model':db[_0x29b5ef[_0x576d('0x21')]],'as':_0x29b5ef['as'],'attributes':_0x29b5ef[_0x576d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x297bf0){logger[_0x576d('0xf')](_0x576d('0x22'),_0x59c481);logger[_0x576d('0x11')](_0x576d('0x22'),_0x59c481,JSON[_0x576d('0x13')](_0x297bf0));_0x584443(_0x297bf0);})['catch'](function(_0x26ab7a){logger[_0x576d('0x14')](_0x576d('0x22'),_0x26ab7a[_0x576d('0x17')],_0x59c481);_0x2f74ca(_0x452066[_0x576d('0x14')](0x1f4,_0x26ab7a['message']));});});};exports['NotifyFaxAccount']=function(_0x201b79,_0x4077aa,_0x30e348){var _0x47a56=this;return new Promise(function(_0x92dcba,_0x1cd630){var _0x4923f1={'body':_0x201b79[_0x576d('0x23')],'channel':_0x576d('0x24')};var _0x5b0236=[];var _0x5da92f=[];var _0x5021a3={};return db[_0x576d('0x25')][_0x576d('0x26')]()[_0x576d('0xe')](function(_0x2083d4){if(!_0x2083d4){throw new db['Sequelize'][(_0x576d('0x27'))](_0x576d('0x28'));}_0x5b0236=_[_0x576d('0x29')](_[_0x576d('0x2a')](_0x2083d4),[_0x576d('0x2b'),_0x576d('0x2c')]);_0x5da92f=_['difference'](_[_0x576d('0x2a')](_0x2083d4),[_0x576d('0x2b'),'updatedAt',_0x576d('0x2d'),_0x576d('0x2e')]);if(_0x201b79['body']['id']){delete _0x201b79[_0x576d('0x23')]['id'];}if(_[_0x576d('0x2f')](_0x201b79[_0x576d('0x23')][_0x576d('0x30')])){throw new db[(_0x576d('0x31'))]['ValidationError'](_0x576d('0x32'));}if(_['isNil'](_0x201b79[_0x576d('0x23')][_0x576d('0x23')])||_0x201b79[_0x576d('0x23')][_0x576d('0x23')]===''){throw new db[(_0x576d('0x31'))][(_0x576d('0x27'))](_0x576d('0x33'));}if(_[_0x576d('0x2f')](_0x201b79[_0x576d('0x23')][_0x576d('0x34')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5da92f);}if(!_['includes'](_0x5da92f,_0x201b79[_0x576d('0x23')][_0x576d('0x34')])){throw new db['Sequelize'][(_0x576d('0x27'))](_0x576d('0x35')+_0x5da92f);}_0x5021a3[_0x201b79[_0x576d('0x23')]['mapKey']]=_0x201b79[_0x576d('0x23')][_0x576d('0x30')];})['then'](function(){return db[_0x576d('0x36')][_0x576d('0x37')]({'where':{'id':_0x201b79[_0x576d('0x38')]['id']},'include':[{'model':db[_0x576d('0x39')],'as':_0x576d('0x3a'),'include':[{'model':db[_0x576d('0x25')],'as':_0x576d('0x3b'),'where':_0x5021a3,'limit':0x1,'order':[['updatedAt',_0x576d('0x3c')]]}]},{'model':db[_0x576d('0x3d')],'as':_0x576d('0x3e')}]});})[_0x576d('0xe')](function(_0x40e43b){if(_0x40e43b&&_0x40e43b[_0x576d('0x3a')]){var _0x26eb69=_0x40e43b[_0x576d('0x3f')]({'plain':!![]});_0x4923f1[_0x576d('0x38')]=_0x26eb69;_0x4923f1['applications']=_0x26eb69[_0x576d('0x3e')];_0x4923f1[_0x576d('0x40')]=_0x26eb69['List'];_0x4923f1[_0x576d('0x41')]=_[_0x576d('0x42')](_0x4923f1['applications'],[_0x576d('0x43')],[_0x576d('0x44')]);if(_0x4923f1['account'][_0x576d('0x3e')]){delete _0x4923f1['account'][_0x576d('0x3e')];}if(_0x4923f1[_0x576d('0x38')]['List']&&_0x4923f1['account'][_0x576d('0x3a')]['Contacts'][_0x576d('0x45')]){return _0x4923f1[_0x576d('0x38')][_0x576d('0x3a')]['Contacts'][0x0];}var _0x1dfd94=_[_0x576d('0x9')](_0x201b79[_0x576d('0x23')],{'firstName':_0x201b79[_0x576d('0x23')]['from'],'ListId':_0x26eb69[_0x576d('0x2e')]});_0x1dfd94[_0x201b79[_0x576d('0x23')]['mapKey']]=_0x201b79[_0x576d('0x23')][_0x576d('0x30')];return db[_0x576d('0x25')][_0x576d('0x46')](_0x1dfd94,{'fields':_0x5b0236,'raw':!![]});}})[_0x576d('0xe')](function(_0x230313){_0x4923f1[_0x576d('0x47')]=_0x230313;if(_0x230313){var _0x515f0b={'ContactId':_0x230313['id'],'FaxAccountId':_0x201b79['account']['id'],'fax':_0x230313[_0x576d('0x24')]};return db[_0x576d('0x48')][_0x576d('0x37')]({'where':{'ContactId':_0x230313['id'],'closed':![],'FaxAccountId':_0x201b79[_0x576d('0x38')]['id']}})['then'](function(_0x2dcee2){if(_0x2dcee2){return[_0x2dcee2,![]];}return db[_0x576d('0x48')][_0x576d('0x46')](_0x515f0b)[_0x576d('0xe')](function(_0x2754b0){return[_0x2754b0,!![]];});});}else{throw new Error(_0x576d('0x49'));}})[_0x576d('0x4a')](function(_0x59998a,_0xe16e47){var _0x3f50dd=_0x59998a[_0x576d('0x3f')]({'plain':!![]});if(_0xe16e47){if(_0x4923f1[_0x576d('0x38')][_0x576d('0x4b')]){_0x4923f1[_0x576d('0x41')][_0x576d('0x4c')]({'id':0x0,'priority':_0x4923f1[_0x576d('0x41')][_0x576d('0x45')]+0x1,'app':_0x576d('0x4d'),'appdata':_0x576d('0x4e'),'interval':_0x576d('0x4f')});}_0x3f50dd[_0x576d('0x50')]=!![];}else{_0x3f50dd[_0x576d('0x50')]=![];}_0x4923f1[_0x576d('0x51')]=_0x3f50dd;return db[_0x576d('0x52')]['create']({'body':_0x201b79[_0x576d('0x23')]['body'],'FaxAccountId':_0x201b79[_0x576d('0x38')]['id'],'FaxInteractionId':_0x59998a['id'],'direction':'in','ContactId':_0x59998a['ContactId'],'AttachmentId':_0x201b79[_0x576d('0x23')]['AttachmentId']});})[_0x576d('0xe')](function(_0x2662b2){_0x4923f1[_0x576d('0x17')]=_0x2662b2;if(_0x4923f1['interaction']['UserId']){return db[_0x576d('0x53')][_0x576d('0x37')]({'attributes':['id','name'],'where':{'id':_0x4923f1[_0x576d('0x51')][_0x576d('0x54')]}})[_0x576d('0xe')](function(_0xd6387b){if(_0xd6387b){_0x4923f1[_0x576d('0x41')][_0x576d('0x55')]({'id':0x0,'priority':0x0,'app':_0x576d('0x56'),'appdata':_0xd6387b[_0x576d('0x57')]+','+(_0x4923f1[_0x576d('0x38')][_0x576d('0x58')]||0xa),'interval':_0x576d('0x4f')});}return respondWithRpcPromise(_0x576d('0x59'),_0x576d('0x5a'),_0x4923f1);});}return respondWithRpcPromise('Start',_0x576d('0x5a'),_0x4923f1);})[_0x576d('0xe')](function(_0x2d2a09){_0x92dcba(_0x2d2a09);})['catch'](function(_0x5a716f){_0x1cd630(_0x47a56[_0x576d('0x14')](0x1f4,_0x5a716f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index de68f8f..0904b77 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 _0x5fdc=['save','remove','update','emit','removeListener','register','faxAccount:','./faxAccount.events'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x5fdc,0x127));var _0xc5fd=function(_0x5a7188,_0x238ed6){_0x5a7188=_0x5a7188-0x0;var _0x139fc4=_0x5fdc[_0x5a7188];return _0x139fc4;};'use strict';var FaxAccountEvents=require(_0xc5fd('0x0'));var events=[_0xc5fd('0x1'),_0xc5fd('0x2'),_0xc5fd('0x3')];function createListener(_0x36e895,_0x341db9){return function(_0x3be451){_0x341db9[_0xc5fd('0x4')](_0x36e895,_0x3be451);};}function removeListener(_0xfdf928,_0x1b6205){return function(){FaxAccountEvents[_0xc5fd('0x5')](_0xfdf928,_0x1b6205);};}exports[_0xc5fd('0x6')]=function(_0x44722b){for(var _0x216902=0x0,_0x15ffe7=events['length'];_0x216902<_0x15ffe7;_0x216902++){var _0x5d86e5=events[_0x216902];var _0x493389=createListener(_0xc5fd('0x7')+_0x5d86e5,_0x44722b);FaxAccountEvents['on'](_0x5d86e5,_0x493389);}}; \ No newline at end of file +var _0x9536=['length','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x9536,0x179));var _0x6953=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x9536[_0x33032e];return _0x13316b;};'use strict';var FaxAccountEvents=require(_0x6953('0x0'));var events=[_0x6953('0x1'),_0x6953('0x2'),_0x6953('0x3')];function createListener(_0x4d218f,_0xc3e4dd){return function(_0x53b172){_0xc3e4dd[_0x6953('0x4')](_0x4d218f,_0x53b172);};}function removeListener(_0x3c32c7,_0x1dee7c){return function(){FaxAccountEvents[_0x6953('0x5')](_0x3c32c7,_0x1dee7c);};}exports[_0x6953('0x6')]=function(_0x494ac2){for(var _0x2b273e=0x0,_0x2bb026=events[_0x6953('0x7')];_0x2b273e<_0x2bb026;_0x2b273e++){var _0x3e1aff=events[_0x2b273e];var _0x1c8225=createListener('faxAccount:'+_0x3e1aff,_0x494ac2);FaxAccountEvents['on'](_0x3e1aff,_0x1c8225);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index dc67a46..d36a7b2 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 _0x13fd=['describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','create','post','/:id/canned_answers','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','/:id','destroy','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','/describe'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x13fd,0x11f));var _0xd13f=function(_0x7207fb,_0x2a1588){_0x7207fb=_0x7207fb-0x0;var _0x502a6f=_0x13fd[_0x7207fb];return _0x502a6f;};'use strict';var multer=require('multer');var util=require(_0xd13f('0x0'));var path=require(_0xd13f('0x1'));var timeout=require(_0xd13f('0x2'));var express=require('express');var router=express[_0xd13f('0x3')]();var auth=require(_0xd13f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd13f('0x5'));router[_0xd13f('0x6')]('/',auth[_0xd13f('0x7')](),controller['index']);router[_0xd13f('0x6')](_0xd13f('0x8'),auth[_0xd13f('0x7')](),controller[_0xd13f('0x9')]);router['get']('/:id',auth[_0xd13f('0x7')](),controller[_0xd13f('0xa')]);router[_0xd13f('0x6')](_0xd13f('0xb'),auth[_0xd13f('0x7')](),controller[_0xd13f('0xc')]);router['get']('/:id/canned_answers',auth[_0xd13f('0x7')](),controller[_0xd13f('0xd')]);router['get'](_0xd13f('0xe'),auth[_0xd13f('0x7')](),controller[_0xd13f('0xf')]);router['get'](_0xd13f('0x10'),auth['isAuthenticated'](),controller[_0xd13f('0x11')]);router[_0xd13f('0x6')](_0xd13f('0x12'),auth[_0xd13f('0x7')](),controller['getMessages']);router[_0xd13f('0x6')](_0xd13f('0x13'),auth[_0xd13f('0x7')](),controller[_0xd13f('0x14')]);router['post']('/',auth[_0xd13f('0x7')](),controller[_0xd13f('0x15')]);router['post']('/:id/dispositions',auth[_0xd13f('0x7')](),controller['addDisposition']);router[_0xd13f('0x16')](_0xd13f('0x17'),auth[_0xd13f('0x7')](),controller['addAnswer']);router[_0xd13f('0x16')](_0xd13f('0xe'),auth[_0xd13f('0x7')](),controller[_0xd13f('0x18')]);router['post'](_0xd13f('0x10'),auth[_0xd13f('0x7')](),controller[_0xd13f('0x19')]);router['post'](_0xd13f('0x1a'),auth[_0xd13f('0x7')](),controller[_0xd13f('0x1b')]);router[_0xd13f('0x16')](_0xd13f('0x1c'),auth['isAuthenticated'](),controller[_0xd13f('0x1d')]);router[_0xd13f('0x16')](_0xd13f('0x1e'),auth[_0xd13f('0x7')](),controller['send']);router['post'](_0xd13f('0x13'),auth[_0xd13f('0x7')](),controller['addAgents']);router['put'](_0xd13f('0x1f'),auth[_0xd13f('0x7')](),controller['update']);router['delete'](_0xd13f('0x1f'),auth[_0xd13f('0x7')](),controller[_0xd13f('0x20')]);router[_0xd13f('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xd13f('0x17'),auth[_0xd13f('0x7')](),controller[_0xd13f('0x22')]);router['delete'](_0xd13f('0x13'),auth['isAuthenticated'](),controller[_0xd13f('0x23')]);module[_0xd13f('0x24')]=router; \ No newline at end of file +var _0x5047=['send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','addDisposition','addInteraction','addAccountApplications','/updateaccountapplications','updateAccountApplications'];(function(_0x59dcf0,_0x24b766){var _0x257ac6=function(_0xd10b2e){while(--_0xd10b2e){_0x59dcf0['push'](_0x59dcf0['shift']());}};_0x257ac6(++_0x24b766);}(_0x5047,0x107));var _0x7504=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x5047[_0xabfec4];return _0x7bafa2;};'use strict';var multer=require(_0x7504('0x0'));var util=require(_0x7504('0x1'));var path=require('path');var timeout=require(_0x7504('0x2'));var express=require(_0x7504('0x3'));var router=express[_0x7504('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7504('0x5'));var config=require(_0x7504('0x6'));var controller=require(_0x7504('0x7'));router[_0x7504('0x8')]('/',auth[_0x7504('0x9')](),controller['index']);router['get'](_0x7504('0xa'),auth['isAuthenticated'](),controller[_0x7504('0xb')]);router[_0x7504('0x8')](_0x7504('0xc'),auth[_0x7504('0x9')](),controller[_0x7504('0xd')]);router[_0x7504('0x8')](_0x7504('0xe'),auth[_0x7504('0x9')](),controller[_0x7504('0xf')]);router[_0x7504('0x8')](_0x7504('0x10'),auth['isAuthenticated'](),controller[_0x7504('0x11')]);router[_0x7504('0x8')]('/:id/interactions',auth[_0x7504('0x9')](),controller[_0x7504('0x12')]);router[_0x7504('0x8')](_0x7504('0x13'),auth[_0x7504('0x9')](),controller[_0x7504('0x14')]);router[_0x7504('0x8')](_0x7504('0x15'),auth[_0x7504('0x9')](),controller[_0x7504('0x16')]);router[_0x7504('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x7504('0x17')]);router[_0x7504('0x18')]('/',auth[_0x7504('0x9')](),controller[_0x7504('0x19')]);router[_0x7504('0x18')](_0x7504('0xe'),auth[_0x7504('0x9')](),controller[_0x7504('0x1a')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x7504('0x18')]('/:id/interactions',auth[_0x7504('0x9')](),controller[_0x7504('0x1b')]);router['post'](_0x7504('0x13'),auth[_0x7504('0x9')](),controller['addApplications']);router[_0x7504('0x18')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0x7504('0x1c')]);router['post'](_0x7504('0x1d'),auth[_0x7504('0x9')](),controller[_0x7504('0x1e')]);router['post']('/:id/send',auth[_0x7504('0x9')](),controller[_0x7504('0x1f')]);router[_0x7504('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x7504('0x20')]);router[_0x7504('0x21')]('/:id',auth[_0x7504('0x9')](),controller[_0x7504('0x22')]);router[_0x7504('0x23')](_0x7504('0xc'),auth[_0x7504('0x9')](),controller[_0x7504('0x24')]);router[_0x7504('0x23')](_0x7504('0xe'),auth['isAuthenticated'](),controller[_0x7504('0x25')]);router[_0x7504('0x23')](_0x7504('0x10'),auth[_0x7504('0x9')](),controller[_0x7504('0x26')]);router[_0x7504('0x23')](_0x7504('0x27'),auth[_0x7504('0x9')](),controller[_0x7504('0x28')]);module[_0x7504('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 91805b4..c108d59 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 _0xf9ae=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x2b4c49,_0x5a3e8a){var _0x18b246=function(_0x1d4c2f){while(--_0x1d4c2f){_0x2b4c49['push'](_0x2b4c49['shift']());}};_0x18b246(++_0x5a3e8a);}(_0xf9ae,0x85));var _0xef9a=function(_0x2b0e98,_0x4cd5d3){_0x2b0e98=_0x2b0e98-0x0;var _0x1a213b=_0xf9ae[_0x2b0e98];return _0x1a213b;};'use strict';var Sequelize=require(_0xef9a('0x0'));module[_0xef9a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xef9a('0x2')],'allowNull':![],'defaultValue':_0xef9a('0x3')},'appdata':{'type':Sequelize[_0xef9a('0x4')]()},'description':{'type':Sequelize[_0xef9a('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xef9a('0x5')}}; \ No newline at end of file +var _0x3c54=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x3c54,0x14d));var _0x43c5=function(_0x232e68,_0x2cb287){_0x232e68=_0x232e68-0x0;var _0x11697f=_0x3c54[_0x232e68];return _0x11697f;};'use strict';var Sequelize=require(_0x43c5('0x0'));module[_0x43c5('0x1')]={'priority':{'type':Sequelize[_0x43c5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x43c5('0x3')],'allowNull':![],'defaultValue':_0x43c5('0x4')},'appdata':{'type':Sequelize[_0x43c5('0x5')]()},'description':{'type':Sequelize[_0x43c5('0x3')]},'interval':{'type':Sequelize[_0x43c5('0x3')],'defaultValue':_0x43c5('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index efd0b85..bab5f2b 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 _0xabce=['offset','limit','status','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','options','FaxApplication','find','catch','create','body','params','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','sendStatus','end','json','count'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_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'];function respondWithStatusCode(_0x435ea7,_0x3fd0b5){_0x3fd0b5=_0x3fd0b5||0xcc;return function(_0x36a92e){if(_0x36a92e){return _0x435ea7[_0xeabc('0x19')](_0x3fd0b5);}return _0x435ea7['status'](_0x3fd0b5)[_0xeabc('0x1a')]();};}function respondWithResult(_0x1319f3,_0x3251c6){_0x3251c6=_0x3251c6||0xc8;return function(_0x55f0de){if(_0x55f0de){return _0x1319f3['status'](_0x3251c6)[_0xeabc('0x1b')](_0x55f0de);}};}function respondWithFilteredResult(_0x3ae954,_0x326bac){return function(_0x53d5cb){if(_0x53d5cb){var _0xf913d7=_0x53d5cb[_0xeabc('0x1c')],_0x638976=_0x326bac['offset'],_0x49f2d8=_0x326bac[_0xeabc('0x1d')]+_0x326bac[_0xeabc('0x1e')],_0x53fe28;if(_0x49f2d8>=_0xf913d7){_0x49f2d8=_0xf913d7;_0x53fe28=0xc8;}else{_0x53fe28=0xce;}_0x3ae954[_0xeabc('0x1f')](_0x53fe28);return _0x3ae954[_0xeabc('0x20')](_0xeabc('0x21'),_0x638976+'-'+_0x49f2d8+'/'+_0xf913d7)[_0xeabc('0x1b')](_0x53d5cb);}return null;};}function patchUpdates(_0x384be5){return function(_0x5e30ee){try{jsonpatch['apply'](_0x5e30ee,_0x384be5,!![]);}catch(_0x1253e4){return BPromise['reject'](_0x1253e4);}return _0x5e30ee[_0xeabc('0x22')]();};}function saveUpdates(_0x16530c,_0x502947){return function(_0x28063a){if(_0x28063a){return _0x28063a[_0xeabc('0x23')](_0x16530c)[_0xeabc('0x24')](function(_0x184e60){return _0x184e60;});}return null;};}function removeEntity(_0x3c9611,_0x4e99a4){return function(_0xecdbf){if(_0xecdbf){return _0xecdbf[_0xeabc('0x25')]()[_0xeabc('0x24')](function(){_0x3c9611['status'](0xcc)[_0xeabc('0x1a')]();});}};}function handleEntityNotFound(_0x3854d2,_0x214953){return function(_0x319119){if(!_0x319119){_0x3854d2['sendStatus'](0x194);}return _0x319119;};}function handleError(_0x109e1d,_0x480440){_0x480440=_0x480440||0x1f4;return function(_0x27dbaf){logger['error'](_0x27dbaf[_0xeabc('0x26')]);if(_0x27dbaf[_0xeabc('0x27')]){delete _0x27dbaf[_0xeabc('0x27')];}_0x109e1d[_0xeabc('0x1f')](_0x480440)[_0xeabc('0x28')](_0x27dbaf);};}exports[_0xeabc('0x29')]=function(_0x131722,_0x4c2693){var _0x5b2934={},_0x459c8a={},_0x5bf8f2={'count':0x0,'rows':[]};var _0x3c1b5b=_[_0xeabc('0x2a')](db['FaxApplication'][_0xeabc('0x2b')],function(_0x38572d){return{'name':_0x38572d[_0xeabc('0x2c')],'type':_0x38572d[_0xeabc('0x2d')][_0xeabc('0x2e')]};});_0x459c8a[_0xeabc('0x2f')]=_[_0xeabc('0x2a')](_0x3c1b5b,_0xeabc('0x27'));_0x459c8a[_0xeabc('0x30')]=_['keys'](_0x131722[_0xeabc('0x30')]);_0x459c8a['filters']=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],_0x459c8a[_0xeabc('0x30')]);_0x5b2934[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x131722['query'][_0xeabc('0x33')]));_0x5b2934[_0xeabc('0x32')]=_0x5b2934[_0xeabc('0x32')]['length']?_0x5b2934[_0xeabc('0x32')]:_0x459c8a[_0xeabc('0x2f')];if(!_0x131722[_0xeabc('0x30')]['hasOwnProperty'](_0xeabc('0x34'))){_0x5b2934[_0xeabc('0x1e')]=qs[_0xeabc('0x1e')](_0x131722['query'][_0xeabc('0x1e')]);_0x5b2934[_0xeabc('0x1d')]=qs['offset'](_0x131722['query'][_0xeabc('0x1d')]);}_0x5b2934[_0xeabc('0x35')]=qs['sort'](_0x131722[_0xeabc('0x30')][_0xeabc('0x36')]);_0x5b2934[_0xeabc('0x37')]=qs[_0xeabc('0x38')](_[_0xeabc('0x39')](_0x131722['query'],_0x459c8a[_0xeabc('0x38')]),_0x3c1b5b);if(_0x131722['query'][_0xeabc('0x3a')]){_0x5b2934[_0xeabc('0x37')]=_[_0xeabc('0x3b')](_0x5b2934['where'],{'$or':_['map'](_0x3c1b5b,function(_0x452580){if(_0x452580['type']!==_0xeabc('0x3c')){var _0x4ebd64={};_0x4ebd64[_0x452580['name']]={'$like':'%'+_0x131722['query']['filter']+'%'};return _0x4ebd64;}})});}_0x5b2934=_[_0xeabc('0x3b')]({},_0x5b2934,_0x131722['options']);var _0x257fe8={'where':_0x5b2934[_0xeabc('0x37')]};return db['FaxApplication'][_0xeabc('0x1c')](_0x257fe8)['then'](function(_0x3d48f4){_0x5bf8f2['count']=_0x3d48f4;if(_0x131722[_0xeabc('0x30')][_0xeabc('0x3d')]){_0x5b2934[_0xeabc('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x5b2934);})['then'](function(_0x46056c){_0x5bf8f2[_0xeabc('0x3f')]=_0x46056c;return _0x5bf8f2;})[_0xeabc('0x24')](respondWithFilteredResult(_0x4c2693,_0x5b2934))['catch'](handleError(_0x4c2693,null));};exports['show']=function(_0x5cd62e,_0x1680e8){var _0x5e9cb3={'raw':!![],'where':{'id':_0x5cd62e['params']['id']}},_0xc6af4d={};_0xc6af4d[_0xeabc('0x2f')]=_['keys'](db['FaxApplication']['rawAttributes']);_0xc6af4d[_0xeabc('0x30')]=_[_0xeabc('0x40')](_0x5cd62e[_0xeabc('0x30')]);_0xc6af4d[_0xeabc('0x38')]=_['intersection'](_0xc6af4d[_0xeabc('0x2f')],_0xc6af4d['query']);_0x5e9cb3[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0xc6af4d[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x5cd62e[_0xeabc('0x30')]['fields']));_0x5e9cb3['attributes']=_0x5e9cb3[_0xeabc('0x32')]['length']?_0x5e9cb3[_0xeabc('0x32')]:_0xc6af4d[_0xeabc('0x2f')];if(_0x5cd62e['query'][_0xeabc('0x3d')]){_0x5e9cb3[_0xeabc('0x3e')]=[{'all':!![]}];}_0x5e9cb3=_[_0xeabc('0x3b')]({},_0x5e9cb3,_0x5cd62e[_0xeabc('0x41')]);return db[_0xeabc('0x42')][_0xeabc('0x43')](_0x5e9cb3)[_0xeabc('0x24')](handleEntityNotFound(_0x1680e8,null))['then'](respondWithResult(_0x1680e8,null))[_0xeabc('0x44')](handleError(_0x1680e8,null));};exports[_0xeabc('0x45')]=function(_0x2e7a5e,_0x1b41c8){return db[_0xeabc('0x42')][_0xeabc('0x45')](_0x2e7a5e[_0xeabc('0x46')],{})[_0xeabc('0x24')](respondWithResult(_0x1b41c8,0xc9))[_0xeabc('0x44')](handleError(_0x1b41c8,null));};exports[_0xeabc('0x23')]=function(_0x5689fc,_0x38356c){if(_0x5689fc[_0xeabc('0x46')]['id']){delete _0x5689fc[_0xeabc('0x46')]['id'];}return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x5689fc[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x38356c,null))['then'](saveUpdates(_0x5689fc[_0xeabc('0x46')],null))[_0xeabc('0x24')](respondWithResult(_0x38356c,null))[_0xeabc('0x44')](handleError(_0x38356c,null));};exports[_0xeabc('0x25')]=function(_0x47440e,_0x58e2c1){return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x47440e[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x58e2c1,null))['then'](removeEntity(_0x58e2c1,null))[_0xeabc('0x44')](handleError(_0x58e2c1,null));}; \ No newline at end of file +var _0x326f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','type','filter','options','FaxApplication','include','rows','catch','show','params','includeAll','create','body','update','find','html-pdf'];(function(_0xf50cd6,_0x59bb73){var _0x3bebdb=function(_0x169455){while(--_0x169455){_0xf50cd6['push'](_0xf50cd6['shift']());}};_0x3bebdb(++_0x59bb73);}(_0x326f,0xd1));var _0xf326=function(_0x28e564,_0x2cf9d2){_0x28e564=_0x28e564-0x0;var _0x8da328=_0x326f[_0x28e564];return _0x8da328;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var db=require(_0xf326('0x16'))['db'];function respondWithStatusCode(_0x518ab5,_0x3162f9){_0x3162f9=_0x3162f9||0xcc;return function(_0x9ed463){if(_0x9ed463){return _0x518ab5['sendStatus'](_0x3162f9);}return _0x518ab5[_0xf326('0x17')](_0x3162f9)[_0xf326('0x18')]();};}function respondWithResult(_0x3504eb,_0x17a098){_0x17a098=_0x17a098||0xc8;return function(_0x5c8483){if(_0x5c8483){return _0x3504eb[_0xf326('0x17')](_0x17a098)['json'](_0x5c8483);}};}function respondWithFilteredResult(_0x54bd1a,_0xdf21d9){return function(_0x11f6d2){if(_0x11f6d2){var _0x1f2e5a=_0x11f6d2[_0xf326('0x19')],_0xa63d1a=_0xdf21d9[_0xf326('0x1a')],_0x292f4b=_0xdf21d9['offset']+_0xdf21d9[_0xf326('0x1b')],_0x287a2a;if(_0x292f4b>=_0x1f2e5a){_0x292f4b=_0x1f2e5a;_0x287a2a=0xc8;}else{_0x287a2a=0xce;}_0x54bd1a[_0xf326('0x17')](_0x287a2a);return _0x54bd1a[_0xf326('0x1c')](_0xf326('0x1d'),_0xa63d1a+'-'+_0x292f4b+'/'+_0x1f2e5a)[_0xf326('0x1e')](_0x11f6d2);}return null;};}function patchUpdates(_0x311af0){return function(_0x4d3d41){try{jsonpatch['apply'](_0x4d3d41,_0x311af0,!![]);}catch(_0x56ad41){return BPromise[_0xf326('0x1f')](_0x56ad41);}return _0x4d3d41[_0xf326('0x20')]();};}function saveUpdates(_0x484cbe,_0x4cabce){return function(_0x128c68){if(_0x128c68){return _0x128c68['update'](_0x484cbe)['then'](function(_0x448b92){return _0x448b92;});}return null;};}function removeEntity(_0x18ead3,_0x549b46){return function(_0x5aa184){if(_0x5aa184){return _0x5aa184[_0xf326('0x21')]()[_0xf326('0x22')](function(){_0x18ead3['status'](0xcc)[_0xf326('0x18')]();});}};}function handleEntityNotFound(_0x1b9039,_0x43c53e){return function(_0x295752){if(!_0x295752){_0x1b9039[_0xf326('0x23')](0x194);}return _0x295752;};}function handleError(_0x2049ec,_0x5ce532){_0x5ce532=_0x5ce532||0x1f4;return function(_0x55b9f4){logger['error'](_0x55b9f4[_0xf326('0x24')]);if(_0x55b9f4[_0xf326('0x25')]){delete _0x55b9f4[_0xf326('0x25')];}_0x2049ec[_0xf326('0x17')](_0x5ce532)[_0xf326('0x26')](_0x55b9f4);};}exports[_0xf326('0x27')]=function(_0x5217d4,_0x201d28){var _0xa3c0b={},_0x212d5d={},_0x581531={'count':0x0,'rows':[]};var _0x1617d2=_['map'](db['FaxApplication'][_0xf326('0x28')],function(_0x1ae23a){return{'name':_0x1ae23a[_0xf326('0x29')],'type':_0x1ae23a['type'][_0xf326('0x2a')]};});_0x212d5d[_0xf326('0x2b')]=_['map'](_0x1617d2,_0xf326('0x25'));_0x212d5d[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x5217d4[_0xf326('0x2c')]);_0x212d5d[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x212d5d[_0xf326('0x2b')],_0x212d5d[_0xf326('0x2c')]);_0xa3c0b[_0xf326('0x30')]=_[_0xf326('0x2f')](_0x212d5d['model'],qs[_0xf326('0x31')](_0x5217d4[_0xf326('0x2c')][_0xf326('0x31')]));_0xa3c0b['attributes']=_0xa3c0b[_0xf326('0x30')][_0xf326('0x32')]?_0xa3c0b[_0xf326('0x30')]:_0x212d5d['model'];if(!_0x5217d4['query'][_0xf326('0x33')](_0xf326('0x34'))){_0xa3c0b[_0xf326('0x1b')]=qs[_0xf326('0x1b')](_0x5217d4[_0xf326('0x2c')][_0xf326('0x1b')]);_0xa3c0b[_0xf326('0x1a')]=qs[_0xf326('0x1a')](_0x5217d4['query'][_0xf326('0x1a')]);}_0xa3c0b[_0xf326('0x35')]=qs['sort'](_0x5217d4[_0xf326('0x2c')]['sort']);_0xa3c0b[_0xf326('0x36')]=qs['filters'](_['pick'](_0x5217d4[_0xf326('0x2c')],_0x212d5d['filters']),_0x1617d2);if(_0x5217d4[_0xf326('0x2c')]['filter']){_0xa3c0b[_0xf326('0x36')]=_[_0xf326('0x37')](_0xa3c0b[_0xf326('0x36')],{'$or':_['map'](_0x1617d2,function(_0x3dcc7e){if(_0x3dcc7e[_0xf326('0x38')]!=='VIRTUAL'){var _0x13932b={};_0x13932b[_0x3dcc7e[_0xf326('0x25')]]={'$like':'%'+_0x5217d4[_0xf326('0x2c')][_0xf326('0x39')]+'%'};return _0x13932b;}})});}_0xa3c0b=_['merge']({},_0xa3c0b,_0x5217d4[_0xf326('0x3a')]);var _0xb1ef35={'where':_0xa3c0b[_0xf326('0x36')]};return db[_0xf326('0x3b')][_0xf326('0x19')](_0xb1ef35)['then'](function(_0x3e830d){_0x581531[_0xf326('0x19')]=_0x3e830d;if(_0x5217d4['query']['includeAll']){_0xa3c0b[_0xf326('0x3c')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0xa3c0b);})[_0xf326('0x22')](function(_0x5d6ae2){_0x581531[_0xf326('0x3d')]=_0x5d6ae2;return _0x581531;})[_0xf326('0x22')](respondWithFilteredResult(_0x201d28,_0xa3c0b))[_0xf326('0x3e')](handleError(_0x201d28,null));};exports[_0xf326('0x3f')]=function(_0x49112d,_0x9dda89){var _0x45d344={'raw':!![],'where':{'id':_0x49112d[_0xf326('0x40')]['id']}},_0x347e7b={};_0x347e7b[_0xf326('0x2b')]=_[_0xf326('0x2d')](db[_0xf326('0x3b')][_0xf326('0x28')]);_0x347e7b[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x49112d[_0xf326('0x2c')]);_0x347e7b[_0xf326('0x2e')]=_['intersection'](_0x347e7b[_0xf326('0x2b')],_0x347e7b[_0xf326('0x2c')]);_0x45d344[_0xf326('0x30')]=_[_0xf326('0x2f')](_0x347e7b[_0xf326('0x2b')],qs[_0xf326('0x31')](_0x49112d['query'][_0xf326('0x31')]));_0x45d344[_0xf326('0x30')]=_0x45d344['attributes'][_0xf326('0x32')]?_0x45d344[_0xf326('0x30')]:_0x347e7b[_0xf326('0x2b')];if(_0x49112d[_0xf326('0x2c')][_0xf326('0x41')]){_0x45d344['include']=[{'all':!![]}];}_0x45d344=_['merge']({},_0x45d344,_0x49112d[_0xf326('0x3a')]);return db[_0xf326('0x3b')]['find'](_0x45d344)['then'](handleEntityNotFound(_0x9dda89,null))[_0xf326('0x22')](respondWithResult(_0x9dda89,null))[_0xf326('0x3e')](handleError(_0x9dda89,null));};exports[_0xf326('0x42')]=function(_0x5b3705,_0x301e65){return db[_0xf326('0x3b')][_0xf326('0x42')](_0x5b3705[_0xf326('0x43')],{})[_0xf326('0x22')](respondWithResult(_0x301e65,0xc9))[_0xf326('0x3e')](handleError(_0x301e65,null));};exports[_0xf326('0x44')]=function(_0x3b90dc,_0x3df9a8){if(_0x3b90dc[_0xf326('0x43')]['id']){delete _0x3b90dc[_0xf326('0x43')]['id'];}return db[_0xf326('0x3b')][_0xf326('0x45')]({'where':{'id':_0x3b90dc[_0xf326('0x40')]['id']}})[_0xf326('0x22')](handleEntityNotFound(_0x3df9a8,null))['then'](saveUpdates(_0x3b90dc[_0xf326('0x43')],null))[_0xf326('0x22')](respondWithResult(_0x3df9a8,null))[_0xf326('0x3e')](handleError(_0x3df9a8,null));};exports[_0xf326('0x21')]=function(_0x5f1829,_0x10f437){return db[_0xf326('0x3b')][_0xf326('0x45')]({'where':{'id':_0x5f1829[_0xf326('0x40')]['id']}})['then'](handleEntityNotFound(_0x10f437,null))[_0xf326('0x22')](removeEntity(_0x10f437,null))[_0xf326('0x3e')](handleError(_0x10f437,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 21791b8..d30ac8a 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 _0x3ff6=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x3ff6,0x71));var _0x63ff=function(_0x56996a,_0x117d1c){_0x56996a=_0x56996a-0x0;var _0x440c8f=_0x3ff6[_0x56996a];return _0x440c8f;};'use strict';var _=require('lodash');var util=require(_0x63ff('0x0'));var logger=require(_0x63ff('0x1'))('api');var moment=require(_0x63ff('0x2'));var BPromise=require('bluebird');var rp=require(_0x63ff('0x3'));var fs=require('fs');var path=require(_0x63ff('0x4'));var rimraf=require(_0x63ff('0x5'));var config=require(_0x63ff('0x6'));var attributes=require(_0x63ff('0x7'));module[_0x63ff('0x8')]=function(_0x2d45ff,_0x160911){return _0x2d45ff[_0x63ff('0x9')](_0x63ff('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x63ff('0xb'),'collate':_0x63ff('0xc')});}; \ No newline at end of file +var _0xdb4d=['exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x133e8d,_0x4648f1){var _0x10ce55=function(_0x13e8bd){while(--_0x13e8bd){_0x133e8d['push'](_0x133e8d['shift']());}};_0x10ce55(++_0x4648f1);}(_0xdb4d,0x164));var _0xddb4=function(_0x2c5d6f,_0x490f3e){_0x2c5d6f=_0x2c5d6f-0x0;var _0x54d956=_0xdb4d[_0x2c5d6f];return _0x54d956;};'use strict';var _=require(_0xddb4('0x0'));var util=require(_0xddb4('0x1'));var logger=require(_0xddb4('0x2'))(_0xddb4('0x3'));var moment=require('moment');var BPromise=require(_0xddb4('0x4'));var rp=require(_0xddb4('0x5'));var fs=require('fs');var path=require(_0xddb4('0x6'));var rimraf=require(_0xddb4('0x7'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0xddb4('0x8')]=function(_0x2e84c3,_0x50df9c){return _0x2e84c3[_0xddb4('0x9')]('FaxApplication',attributes,{'tableName':_0xddb4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xddb4('0xb'),'collate':_0xddb4('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 278a0d1..10eaf9b 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 _0x8e51=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','update','body','options','raw','attributes','limit','info','UpdateFaxApplication','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8e51,0x159));var _0x18e5=function(_0x53a20e,_0x2f842f){_0x53a20e=_0x53a20e-0x0;var _0x2ba141=_0x8e51[_0x53a20e];return _0x2ba141;};'use strict';var _=require(_0x18e5('0x0'));var util=require(_0x18e5('0x1'));var moment=require(_0x18e5('0x2'));var BPromise=require(_0x18e5('0x3'));var rs=require(_0x18e5('0x4'));var fs=require('fs');var Redis=require(_0x18e5('0x5'));var db=require(_0x18e5('0x6'))['db'];var utils=require(_0x18e5('0x7'));var logger=require(_0x18e5('0x8'))('rpc');var config=require(_0x18e5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x18e5('0xa')][_0x18e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55ccd9,_0x37502b,_0x1b4477){return new BPromise(function(_0x556be0,_0x4914e3){return client[_0x18e5('0xc')](_0x55ccd9,_0x1b4477)[_0x18e5('0xd')](function(_0x31a37c){logger['info']('FaxApplication,\x20%s,\x20%s',_0x37502b,'request\x20sent');logger['debug'](_0x18e5('0xe'),_0x37502b,'request\x20sent',JSON[_0x18e5('0xf')](_0x31a37c));if(_0x31a37c['error']){if(_0x31a37c[_0x18e5('0x10')][_0x18e5('0x11')]===0x1f4){logger['error'](_0x18e5('0x12'),_0x37502b,_0x31a37c[_0x18e5('0x10')][_0x18e5('0x13')]);return _0x4914e3(_0x31a37c[_0x18e5('0x10')][_0x18e5('0x13')]);}logger[_0x18e5('0x10')](_0x18e5('0x12'),_0x37502b,_0x31a37c[_0x18e5('0x10')][_0x18e5('0x13')]);return _0x556be0(_0x31a37c[_0x18e5('0x10')][_0x18e5('0x13')]);}else{logger['info'](_0x18e5('0x12'),_0x37502b,'request\x20sent');_0x556be0(_0x31a37c[_0x18e5('0x14')][_0x18e5('0x13')]);}})[_0x18e5('0x15')](function(_0x3f8a0f){logger['error']('FaxApplication,\x20%s,\x20%s',_0x37502b,_0x3f8a0f);_0x4914e3(_0x3f8a0f);});});}exports['UpdateFaxApplication']=function(_0x3e7057){var _0xfb9cf8=this;return new Promise(function(_0x4cd1ae,_0x333a10){return db[_0x18e5('0x16')][_0x18e5('0x17')](_0x3e7057[_0x18e5('0x18')],{'raw':_0x3e7057[_0x18e5('0x19')]?_0x3e7057[_0x18e5('0x19')][_0x18e5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e7057[_0x18e5('0x19')]?_0x3e7057['options']['where']||null:null,'attributes':_0x3e7057[_0x18e5('0x19')]?_0x3e7057[_0x18e5('0x19')][_0x18e5('0x1b')]||null:null,'limit':_0x3e7057['options']?_0x3e7057['options'][_0x18e5('0x1c')]||null:null})[_0x18e5('0xd')](function(_0x4e37f7){logger[_0x18e5('0x1d')](_0x18e5('0x1e'),_0x3e7057);logger[_0x18e5('0x1f')]('UpdateFaxApplication',_0x3e7057,JSON[_0x18e5('0xf')](_0x4e37f7));_0x4cd1ae(_0x4e37f7);})[_0x18e5('0x15')](function(_0x3d5f16){logger[_0x18e5('0x10')]('UpdateFaxApplication',_0x3d5f16[_0x18e5('0x13')],_0x3e7057);_0x333a10(_0xfb9cf8['error'](0x1f4,_0x3d5f16[_0x18e5('0x13')]));});});}; \ No newline at end of file +var _0x1546=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','UpdateFaxApplication','update','body','options','raw','where','limit','util','moment','bluebird'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0x1546,0xba));var _0x6154=function(_0x11dcdd,_0xd66b7f){_0x11dcdd=_0x11dcdd-0x0;var _0x5c2f35=_0x1546[_0x11dcdd];return _0x5c2f35;};'use strict';var _=require('lodash');var util=require(_0x6154('0x0'));var moment=require(_0x6154('0x1'));var BPromise=require(_0x6154('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6154('0x3'));var db=require(_0x6154('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6154('0x5'));var config=require(_0x6154('0x6'));var jayson=require(_0x6154('0x7'));var client=jayson[_0x6154('0x8')][_0x6154('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd54a5f,_0x9567f8,_0x5959d5){return new BPromise(function(_0x3a2a10,_0x3a9d14){return client[_0x6154('0xa')](_0xd54a5f,_0x5959d5)[_0x6154('0xb')](function(_0x18560b){logger[_0x6154('0xc')](_0x6154('0xd'),_0x9567f8,_0x6154('0xe'));logger[_0x6154('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x9567f8,_0x6154('0xe'),JSON[_0x6154('0x10')](_0x18560b));if(_0x18560b[_0x6154('0x11')]){if(_0x18560b[_0x6154('0x11')]['code']===0x1f4){logger['error'](_0x6154('0xd'),_0x9567f8,_0x18560b[_0x6154('0x11')][_0x6154('0x12')]);return _0x3a9d14(_0x18560b[_0x6154('0x11')][_0x6154('0x12')]);}logger[_0x6154('0x11')](_0x6154('0xd'),_0x9567f8,_0x18560b['error'][_0x6154('0x12')]);return _0x3a2a10(_0x18560b[_0x6154('0x11')]['message']);}else{logger[_0x6154('0xc')](_0x6154('0xd'),_0x9567f8,'request\x20sent');_0x3a2a10(_0x18560b['result']['message']);}})[_0x6154('0x13')](function(_0x5e9438){logger[_0x6154('0x11')](_0x6154('0xd'),_0x9567f8,_0x5e9438);_0x3a9d14(_0x5e9438);});});}exports[_0x6154('0x14')]=function(_0x419e2a){var _0x151cbc=this;return new Promise(function(_0x476889,_0x33be7c){return db['FaxApplication'][_0x6154('0x15')](_0x419e2a[_0x6154('0x16')],{'raw':_0x419e2a['options']?_0x419e2a[_0x6154('0x17')][_0x6154('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x419e2a[_0x6154('0x17')]?_0x419e2a[_0x6154('0x17')][_0x6154('0x19')]||null:null,'attributes':_0x419e2a['options']?_0x419e2a['options']['attributes']||null:null,'limit':_0x419e2a[_0x6154('0x17')]?_0x419e2a[_0x6154('0x17')][_0x6154('0x1a')]||null:null})[_0x6154('0xb')](function(_0x526262){logger[_0x6154('0xc')](_0x6154('0x14'),_0x419e2a);logger['debug'](_0x6154('0x14'),_0x419e2a,JSON[_0x6154('0x10')](_0x526262));_0x476889(_0x526262);})[_0x6154('0x13')](function(_0x362215){logger[_0x6154('0x11')](_0x6154('0x14'),_0x362215[_0x6154('0x12')],_0x419e2a);_0x33be7c(_0x151cbc[_0x6154('0x11')](0x1f4,_0x362215[_0x6154('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index cb36414..a3c64fa 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 _0x5fc3=['post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','get','isAuthenticated','/:id','show'];(function(_0x1cf8ea,_0x1c0c7c){var _0x3d441a=function(_0x10fc9a){while(--_0x10fc9a){_0x1cf8ea['push'](_0x1cf8ea['shift']());}};_0x3d441a(++_0x1c0c7c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0x5fc3[_0x156a0d];return _0x98a9ba;};'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 +var _0xeda8=['isAuthenticated','index','/:id','show','post','create','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x2f0ceb,_0x5bb410){var _0x3a6347=function(_0x59e032){while(--_0x59e032){_0x2f0ceb['push'](_0x2f0ceb['shift']());}};_0x3a6347(++_0x5bb410);}(_0xeda8,0x104));var _0x8eda=function(_0x3856a6,_0x2c760c){_0x3856a6=_0x3856a6-0x0;var _0x1299ca=_0xeda8[_0x3856a6];return _0x1299ca;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var auth=require(_0x8eda('0x5'));var interaction=require(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var controller=require(_0x8eda('0x8'));router[_0x8eda('0x9')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xb')]);router[_0x8eda('0x9')](_0x8eda('0xc'),auth['isAuthenticated'](),controller[_0x8eda('0xd')]);router[_0x8eda('0xe')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8eda('0x10')](_0x8eda('0xc'),auth[_0x8eda('0xa')](),controller['destroy']);module[_0x8eda('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 a7eed09..8e8fc80 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 _0xe2ab=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x2bcff5,_0x2ec4fd){var _0x1d989f=function(_0x548998){while(--_0x548998){_0x2bcff5['push'](_0x2bcff5['shift']());}};_0x1d989f(++_0x2ec4fd);}(_0xe2ab,0x1bb));var _0xbe2a=function(_0x5065b3,_0x144265){_0x5065b3=_0x5065b3-0x0;var _0x426b97=_0xe2ab[_0x5065b3];return _0x426b97;};'use strict';var Sequelize=require(_0xbe2a('0x0'));module[_0xbe2a('0x1')]={'closed':{'type':Sequelize[_0xbe2a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbe2a('0x3')]},'disposition':{'type':Sequelize[_0xbe2a('0x4')]},'note':{'type':Sequelize[_0xbe2a('0x4')]},'read1stAt':{'type':Sequelize[_0xbe2a('0x3')]},'fax':{'type':Sequelize[_0xbe2a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xbe2a('0x5')]('in',_0xbe2a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbe2a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xbe2a('0x5')]('in',_0xbe2a('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa11b=['out','ENUM','exports','BOOLEAN','DATE','STRING'];(function(_0x16a641,_0x3349b6){var _0x21f9cd=function(_0x1a732f){while(--_0x1a732f){_0x16a641['push'](_0x16a641['shift']());}};_0x21f9cd(++_0x3349b6);}(_0xa11b,0x92));var _0xba11=function(_0x18f7fa,_0xe64c9){_0x18f7fa=_0x18f7fa-0x0;var _0x14c598=_0xa11b[_0x18f7fa];return _0x14c598;};'use strict';var Sequelize=require('sequelize');module[_0xba11('0x0')]={'closed':{'type':Sequelize[_0xba11('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xba11('0x2')]},'disposition':{'type':Sequelize[_0xba11('0x3')]},'note':{'type':Sequelize[_0xba11('0x3')]},'read1stAt':{'type':Sequelize[_0xba11('0x2')]},'fax':{'type':Sequelize[_0xba11('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xba11('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xba11('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xba11('0x5')]('in',_0xba11('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 079af1d..b49f460 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 _0xa596=['expr','parseSearch','search','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','$gte','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','params','fields','includeAll','include','merge','options','FaxInteraction','find','create','update','destroy','describe','addMessage','FaxMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','basename','createReadStream','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','tools_tags','u.id','u.fullname','from','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId'];(function(_0x456a01,_0x221b75){var _0x591772=function(_0x29174c){while(--_0x29174c){_0x456a01['push'](_0x456a01['shift']());}};_0x591772(++_0x221b75);}(_0xa596,0x7b));var _0x6a59=function(_0x1db289,_0x423595){_0x1db289=_0x1db289-0x0;var _0x434e21=_0xa596[_0x1db289];return _0x434e21;};'use strict';var pdf=require(_0x6a59('0x0'));var emlformat=require(_0x6a59('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6a59('0x2'));var jsonpatch=require(_0x6a59('0x3'));var rp=require(_0x6a59('0x4'));var moment=require(_0x6a59('0x5'));var BPromise=require(_0x6a59('0x6'));var Mustache=require(_0x6a59('0x7'));var util=require(_0x6a59('0x8'));var path=require(_0x6a59('0x9'));var sox=require('sox');var csv=require(_0x6a59('0xa'));var ejs=require(_0x6a59('0xb'));var fs=require('fs');var _=require(_0x6a59('0xc'));var squel=require(_0x6a59('0xd'));var crypto=require(_0x6a59('0xe'));var jsforce=require(_0x6a59('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6a59('0xa'));var querystring=require('querystring');var Papa=require(_0x6a59('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6a59('0x11'));var as=require(_0x6a59('0x12'));var hardwareService=require(_0x6a59('0x13'));var logger=require('../../config/logger')(_0x6a59('0x14'));var utils=require(_0x6a59('0x15'));var config=require('../../config/environment');var db=require(_0x6a59('0x16'))['db'];config['redis']=_[_0x6a59('0x17')](config[_0x6a59('0x18')],{'host':_0x6a59('0x19'),'port':0x18eb});var socket=require(_0x6a59('0x1a'))(new Redis(config[_0x6a59('0x18')]));require(_0x6a59('0x1b'))[_0x6a59('0x1c')](socket);function respondWithStatusCode(_0xb2fd50,_0x3f8e6a){_0x3f8e6a=_0x3f8e6a||0xcc;return function(_0x2c450f){if(_0x2c450f){return _0xb2fd50[_0x6a59('0x1d')](_0x3f8e6a);}return _0xb2fd50['status'](_0x3f8e6a)[_0x6a59('0x1e')]();};}function respondWithResult(_0x1ec768,_0x416613){_0x416613=_0x416613||0xc8;return function(_0x2cd31a){if(_0x2cd31a){return _0x1ec768[_0x6a59('0x1f')](_0x416613)[_0x6a59('0x20')](_0x2cd31a);}};}function respondWithFilteredResult(_0x5a28f0,_0x344ed4){return function(_0xab9a1){if(_0xab9a1){var _0x3cb568=_0xab9a1[_0x6a59('0x21')],_0x45b286=_0x344ed4[_0x6a59('0x22')],_0x209319=_0x344ed4[_0x6a59('0x22')]+_0x344ed4[_0x6a59('0x23')],_0x2b15b0;if(_0x209319>=_0x3cb568){_0x209319=_0x3cb568;_0x2b15b0=0xc8;}else{_0x2b15b0=0xce;}_0x5a28f0[_0x6a59('0x1f')](_0x2b15b0);return _0x5a28f0[_0x6a59('0x24')](_0x6a59('0x25'),_0x45b286+'-'+_0x209319+'/'+_0x3cb568)[_0x6a59('0x20')](_0xab9a1);}return null;};}function patchUpdates(_0x477cdb){return function(_0x2ae2ce){try{jsonpatch[_0x6a59('0x26')](_0x2ae2ce,_0x477cdb,!![]);}catch(_0x545ce0){return BPromise[_0x6a59('0x27')](_0x545ce0);}return _0x2ae2ce[_0x6a59('0x28')]();};}function saveUpdates(_0xe2573f,_0x4764e7){return function(_0x5d7e84){if(_0x5d7e84){return _0x5d7e84['update'](_0xe2573f)[_0x6a59('0x29')](function(_0x3e683e){return _0x3e683e;});}return null;};}function removeEntity(_0x2b04a5,_0x3d3bdc){return function(_0x56dab5){if(_0x56dab5){return _0x56dab5['destroy']()[_0x6a59('0x29')](function(){_0x2b04a5[_0x6a59('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x287c49,_0x5ee827){return function(_0x342292){if(!_0x342292){_0x287c49[_0x6a59('0x1d')](0x194);}return _0x342292;};}function handleError(_0x5855bc,_0x4174ee){_0x4174ee=_0x4174ee||0x1f4;return function(_0x4ae7dc){logger[_0x6a59('0x2a')](_0x4ae7dc[_0x6a59('0x2b')]);if(_0x4ae7dc['name']){delete _0x4ae7dc[_0x6a59('0x2c')];}_0x5855bc['status'](_0x4174ee)[_0x6a59('0x2d')](_0x4ae7dc);};}function getInteractionUsers(_0x1eb305,_0x205b4d){return new BPromise(function(_0x294e8a,_0x359335){try{if(_0x205b4d[_0x1eb305['id']]){_0x1eb305[_0x6a59('0x2e')]=_['map'](_0x205b4d[_0x1eb305['id']],function(_0x5c6b80){return{'id':_0x5c6b80['id'],'fullname':_0x5c6b80[_0x6a59('0x2f')]};});}}catch(_0x37f63f){_0x359335(_0x37f63f);}_0x294e8a(_0x1eb305);});}function getInteractionTags(_0x563675,_0x1c7016){return new BPromise(function(_0x4ced19,_0x3f0a4f){try{if(_0x563675[_0x6a59('0x30')]){_0x563675[_0x6a59('0x31')]=[];_0x563675['TagIds'][_0x6a59('0x32')](',')[_0x6a59('0x33')](function(_0x41455){_0x563675['Tags'][_0x6a59('0x34')](_0x1c7016[_0x41455]);});}delete _0x563675[_0x6a59('0x30')];}catch(_0x517700){_0x3f0a4f(_0x517700);}_0x4ced19(_0x563675);});}function updateFaxInteraction(_0x3b8c8f,_0x54023e,_0x1f1024){return new BPromise(function(_0x39e2d1,_0x489cc9){return getInteractionUsers(_0x3b8c8f,_0x1f1024)[_0x6a59('0x29')](function(_0x2af776){return getInteractionTags(_0x2af776,_0x54023e);})['then'](function(_0x4beeaf){_0x39e2d1(_0x4beeaf);})['catch'](function(_0x595f72){_0x489cc9(_0x595f72);});});}exports['index']=function(_0x3f711e,_0x218355){var _0x16f497={},_0x5d2a12={},_0x476237={'count':0x0,'rows':[]};var _0x24cf48=_['map'](db['FaxInteraction'][_0x6a59('0x35')],function(_0x507d9f){return{'name':_0x507d9f[_0x6a59('0x36')],'type':_0x507d9f[_0x6a59('0x37')][_0x6a59('0x38')]};});_0x5d2a12[_0x6a59('0x39')]=_[_0x6a59('0x3a')](_0x24cf48,_0x6a59('0x2c'));_0x5d2a12[_0x6a59('0x3b')]=_[_0x6a59('0x3c')](_0x3f711e[_0x6a59('0x3b')]);_0x5d2a12[_0x6a59('0x3d')]=_[_0x6a59('0x3e')](_0x5d2a12[_0x6a59('0x39')],_0x5d2a12[_0x6a59('0x3b')]);_0x16f497[_0x6a59('0x3f')]=_[_0x6a59('0x3e')](_0x5d2a12[_0x6a59('0x39')],qs['fields'](_0x3f711e[_0x6a59('0x3b')]['fields']));_0x16f497[_0x6a59('0x3f')]=_0x16f497[_0x6a59('0x3f')][_0x6a59('0x40')]?_0x16f497[_0x6a59('0x3f')]:_0x5d2a12[_0x6a59('0x39')];if(!_0x3f711e[_0x6a59('0x3b')][_0x6a59('0x41')](_0x6a59('0x42'))){_0x16f497[_0x6a59('0x23')]=qs['limit'](_0x3f711e[_0x6a59('0x3b')][_0x6a59('0x23')]);_0x16f497[_0x6a59('0x22')]=qs['offset'](_0x3f711e['query'][_0x6a59('0x22')]);}_0x16f497[_0x6a59('0x43')]=qs[_0x6a59('0x44')](_0x3f711e['query'][_0x6a59('0x44')]);_0x16f497[_0x6a59('0x45')]=qs[_0x6a59('0x3d')](_['pick'](_0x3f711e['query'],_0x5d2a12[_0x6a59('0x3d')]),_0x24cf48);var _0x124c5d=[];var _0x3f4396=squel[_0x6a59('0x46')]()[_0x6a59('0x47')]('id')[_0x6a59('0x47')]('name')['field'](_0x6a59('0x48'))['from'](_0x6a59('0x49'));var _0x1c3855=squel['select']()[_0x6a59('0x47')](_0x6a59('0x4a'))[_0x6a59('0x47')](_0x6a59('0x4b'))[_0x6a59('0x47')]('ui.FaxInteractionId')[_0x6a59('0x4c')]('user_has_fax_interactions','ui')['left_join']('users','u',_0x6a59('0x4d'));var _0x3f1123=squel[_0x6a59('0x46')]()['from'](_0x6a59('0x4e'),'i')[_0x6a59('0x4f')](_0x6a59('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x6a59('0x51'))['left_join'](_0x6a59('0x52'),'a',_0x6a59('0x53'))['left_join']('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0x6a59('0x4f')](_0x6a59('0x54'),'it',_0x6a59('0x55'))[_0x6a59('0x4f')](_0x6a59('0x49'),'t',_0x6a59('0x56'));var _0x2052e7=squel['expr']();var _0x3c0dc7=[];var _0xc24a7d=squel[_0x6a59('0x57')]();var _0x119d90;if(_0x3f711e[_0x6a59('0x3b')]['search']){_0x119d90=as[_0x6a59('0x58')](_0x3f711e[_0x6a59('0x3b')][_0x6a59('0x59')]);var _0x21c32c=_0x119d90[_0x6a59('0x5a')];for(var _0x45f9c0=0x0;_0x45f9c0<_0x119d90['conditions'][_0x6a59('0x40')];_0x45f9c0++){var _0x49e279=_0x119d90[_0x6a59('0x5b')][_0x45f9c0];var _0x1742b4='i';var _0xd207e7=_['find'](_0x24cf48,['name',_0x49e279['field']]);if(!_0xd207e7){switch(_0x49e279[_0x6a59('0x47')]){case _0x6a59('0x5c'):if(_0x49e279['value']==0x1){_0x3f1123[_0x6a59('0x5d')]('`'+_0x49e279[_0x6a59('0x47')]+_0x6a59('0x5e'));}else{_0x3f1123[_0x6a59('0x5d')]('`'+_0x49e279['field']+'`\x20>\x200');}break;case _0x6a59('0x5f'):if(_0x49e279[_0x6a59('0x60')]===_0x6a59('0x61')){if(_0x49e279[_0x6a59('0x62')][_0x6a59('0x32')]('\x20')['length']>0x1){_0x2052e7[_0x21c32c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6a59('0x63')](_0x49e279[_0x6a59('0x62')]),null);}else{var _0x30c7a3='%'+_0x49e279['value']+'%';_0x2052e7[_0x21c32c](_0x6a59('0x64'),_0x30c7a3,_0x30c7a3,_0x30c7a3);}}else{_0xd207e7=_['find'](_0x24cf48,[_0x6a59('0x2c'),_0x6a59('0x65')]);_0x49e279['field']=_0x6a59('0x65');_0x116883=as[_0x6a59('0x66')](_0x1742b4,_0xd207e7[_0x6a59('0x37')],_0x49e279);_0x2052e7[_0x21c32c](_0x116883[_0x6a59('0x67')],_0x116883['value'][_0x6a59('0x68')],_0x116883[_0x6a59('0x62')][_0x6a59('0x1e')]);}break;case _0x6a59('0x69'):var _0x1d691e=_0x49e279[_0x6a59('0x62')]['split'](',')[_0x6a59('0x3a')](function(_0x1e0cc1){return Number(_0x1e0cc1);});_0x1d691e[_0x6a59('0x33')](function(_0x153c2f){_0xc24a7d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x153c2f+',%');});_0x3c0dc7=_[_0x6a59('0x6a')](_0x3c0dc7,_0x1d691e);break;case _0x6a59('0x6b'):if(_0x49e279['operator']===_0x6a59('0x61')){_0x2052e7[_0x21c32c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x49e279[_0x6a59('0x62')]+'%',null);}else{_0xd207e7=_['find'](_0x24cf48,[_0x6a59('0x2c'),_0x6a59('0x6c')]);_0x49e279[_0x6a59('0x47')]=_0x6a59('0x6c');_0x116883=as[_0x6a59('0x66')](_0x1742b4,_0xd207e7[_0x6a59('0x37')],_0x49e279);_0x2052e7[_0x21c32c](_0x116883[_0x6a59('0x67')],_0x116883[_0x6a59('0x62')][_0x6a59('0x68')],_0x116883[_0x6a59('0x62')][_0x6a59('0x1e')]);}break;case _0x6a59('0x6d'):_0x116883=as[_0x6a59('0x66')]('me',null,_0x49e279);_0x2052e7[_0x21c32c](_0x116883['text'],_0x116883[_0x6a59('0x62')]['start'],_0x116883['value'][_0x6a59('0x1e')]);break;}}else{var _0x116883=as['buildExpression'](_0x1742b4,_0xd207e7['type'],_0x49e279);_0x2052e7[_0x21c32c](_0x116883['text'],_0x116883[_0x6a59('0x62')]['start'],_0x116883[_0x6a59('0x62')][_0x6a59('0x1e')]);}}}else{var _0x316844=_(_0x3f711e[_0x6a59('0x3b')])[_0x6a59('0x3c')]()[_0x6a59('0x3a')](function(_0x4c1ce4){return _[_0x6a59('0x6e')](_0x24cf48,[_0x6a59('0x2c'),_0x4c1ce4])?_0x4c1ce4:undefined;})[_0x6a59('0x6f')]()[_0x6a59('0x62')]();if(!_[_0x6a59('0x70')](_0x316844)){_0x316844['forEach'](function(_0x3e3be6){if(_0x3e3be6===_0x6a59('0x71')){_0x3f1123[_0x6a59('0x45')](_0x6a59('0x72'),[][_0x6a59('0x73')](_0x3f711e[_0x6a59('0x3b')][_0x3e3be6]));}else if(_0x3e3be6==='createdAt'){var _0x2e6637=JSON['parse'](_0x3f711e['query'][_0x3e3be6])[_0x6a59('0x74')];var _0x154870=JSON[_0x6a59('0x75')](_0x3f711e['query'][_0x3e3be6])[_0x6a59('0x76')];_0x3f1123[_0x6a59('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2e6637,_0x154870);}else{if(_0x3f711e[_0x6a59('0x3b')][_0x3e3be6]===_0x6a59('0x77')){_0x3f1123['where']('i.'+_0x3e3be6+_0x6a59('0x78'));}else{_0x3f1123[_0x6a59('0x45')]('i.'+_0x3e3be6+'\x20=\x20?',_0x3f711e[_0x6a59('0x3b')][_0x3e3be6]);}}});}if(_0x3f711e['query'][_0x6a59('0x79')]){if(_0x3f711e[_0x6a59('0x3b')][_0x6a59('0x79')]==0x1){_0x3f1123[_0x6a59('0x5d')](_0x6a59('0x7a'));}else{_0x3f1123['having']('`unreadMessages`\x20>\x200');}}if(_0x3f711e[_0x6a59('0x3b')][_0x6a59('0x7b')]){_0x3c0dc7=_['isArray'](_0x3f711e['query'][_0x6a59('0x7b')])?_0x3f711e['query']['tag']:new Array(_0x3f711e['query'][_0x6a59('0x7b')]);_0x3c0dc7[_0x6a59('0x33')](function(_0x47aa04){_0xc24a7d['or'](_0x6a59('0x7c'),'%,'+_0x47aa04+',%');});}if(_0x3f711e[_0x6a59('0x3b')][_0x6a59('0x7d')]){var _0x4c602a=_0x3f711e[_0x6a59('0x3b')][_0x6a59('0x7d')][_0x6a59('0x7e')]('\x5c','\x5c\x5c')[_0x6a59('0x7e')]('\x27\x27',_0x6a59('0x7f'));if(qs[_0x6a59('0x80')](_0x4c602a)){_0x2052e7['or'](_0x6a59('0x81'),_0x4c602a+'%')['or']('i.fax\x20LIKE\x20?',_0x4c602a+'%');}_0x2052e7['or'](_0x6a59('0x82'),_0x4c602a+'%');}}_0x3f1123[_0x6a59('0x45')](_0x2052e7);_0x3f1123[_0x6a59('0x83')](_0x6a59('0x84'));var _0x183dd1={'type':db[_0x6a59('0x85')][_0x6a59('0x86')]['SELECT'],'raw':!![]};var _0x52bd1e=_0x3f1123[_0x6a59('0x87')]();_0x52bd1e[_0x6a59('0x47')](_0x6a59('0x84'));_0x52bd1e[_0x6a59('0x47')](_0x6a59('0x88'),_0x6a59('0x5c'));if(_0x16f497['order']){_0x16f497[_0x6a59('0x43')]['forEach'](function(_0x2c087){_0x3f1123[_0x6a59('0x43')]('i.'+_0x2c087[0x0],_0x2c087[0x1]===_0x6a59('0x89')?![]:!![]);});}if(!_[_0x6a59('0x70')](_0x3c0dc7)){_0x3f1123[_0x6a59('0x5d')](_0xc24a7d);_0x52bd1e[_0x6a59('0x45')](_0x6a59('0x8a'),_0x3c0dc7);}BPromise['resolve']()[_0x6a59('0x29')](function(){if(!_0x119d90){if(_0x3f711e[_0x6a59('0x3b')][_0x6a59('0x71')]||_0x3f711e[_0x6a59('0x3b')][_0x6a59('0x8b')])return;_0x52bd1e['where'](_0x6a59('0x8c'));_0x3f1123[_0x6a59('0x45')](_0x6a59('0x8c'));return;}return _0x3f711e[_0x6a59('0x8d')][_0x6a59('0x8e')]({'attributes':['id'],'raw':!![]})[_0x6a59('0x29')](function(_0x2041fd){if(_[_0x6a59('0x70')](_0x2041fd)){_0x52bd1e['where'](_0x6a59('0x8f'));_0x3f1123[_0x6a59('0x45')](_0x6a59('0x8f'));}else{_0x52bd1e[_0x6a59('0x45')]('i.FaxAccountId\x20IN\x20?',_[_0x6a59('0x3a')](_0x2041fd,'id'));_0x3f1123['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x2041fd,'id'));}});})['then'](function(){db[_0x6a59('0x90')]['query'](_0x52bd1e[_0x6a59('0x91')](),_0x183dd1)[_0x6a59('0x29')](function(_0x323357){_0x476237[_0x6a59('0x21')]=_0x323357[_0x6a59('0x40')];if(_0x476237[_0x6a59('0x21')]===0x0)return[];return db[_0x6a59('0x90')][_0x6a59('0x3b')](_0x3f4396[_0x6a59('0x91')](),_0x183dd1)[_0x6a59('0x29')](function(_0x498daa){_0x124c5d=_['keyBy'](_0x498daa,'id');_0x183dd1=_['merge'](_0x183dd1,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f711e[_0x6a59('0x3b')]['fields']){_0x16f497[_0x6a59('0x3f')]['forEach'](function(_0x58b12d){_0x3f1123[_0x6a59('0x47')]('i.'+_0x58b12d);});}else{_0x3f1123[_0x6a59('0x47')](_0x6a59('0x88'),_0x6a59('0x5c'));_0x3f1123[_0x6a59('0x47')](_0x6a59('0x92'),'Account.key');_0x3f1123[_0x6a59('0x47')](_0x6a59('0x93'),_0x6a59('0x94'));_0x3f1123[_0x6a59('0x47')](_0x6a59('0x95'));_0x3f1123['field']('c.firstName',_0x6a59('0x96'));_0x3f1123[_0x6a59('0x47')](_0x6a59('0x97'),'Contact.lastName');_0x3f1123['field'](_0x6a59('0x98'),_0x6a59('0x99'));_0x3f1123[_0x6a59('0x47')](_0x6a59('0x9a'),_0x6a59('0x9b'));_0x3f1123[_0x6a59('0x47')](_0x6a59('0x9c'),_0x6a59('0x9d'));_0x3f1123[_0x6a59('0x47')]('c.fax',_0x6a59('0x9e'));_0x3f1123[_0x6a59('0x47')](_0x6a59('0x9f'),_0x6a59('0xa0'));_0x3f1123['field'](_0x6a59('0xa1'),'Owner.internal');_0x3f1123[_0x6a59('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x16f497[_0x6a59('0x23')])_0x3f1123[_0x6a59('0x23')](_0x16f497[_0x6a59('0x23')]);if(_0x16f497[_0x6a59('0x22')])_0x3f1123[_0x6a59('0x22')](_0x16f497[_0x6a59('0x22')]);return db[_0x6a59('0x90')][_0x6a59('0x3b')](_0x3f1123['toString'](),_0x183dd1);})[_0x6a59('0x29')](function(_0x337a1f){_0x1c3855[_0x6a59('0x45')](_0x6a59('0xa2'),_[_0x6a59('0x3a')](_0x337a1f,'id'));return db[_0x6a59('0x90')][_0x6a59('0x3b')](_0x1c3855[_0x6a59('0x91')](),_0x183dd1)[_0x6a59('0x29')](function(_0x1559c7){var _0x36e278=_[_0x6a59('0xa3')](_0x1559c7,_0x6a59('0xa4'));var _0x571b33=[];_0x337a1f[_0x6a59('0x33')](function(_0x106b18){_0x571b33[_0x6a59('0x34')](updateFaxInteraction(_0x106b18,_0x124c5d,_0x36e278));});return BPromise[_0x6a59('0xa5')](_0x571b33);});});})[_0x6a59('0x29')](function(_0x1392c9){_0x476237[_0x6a59('0xa6')]=_0x1392c9;return _0x476237;})[_0x6a59('0x29')](respondWithFilteredResult(_0x218355,_0x16f497));})[_0x6a59('0xa7')](handleError(_0x218355,null));};exports['show']=function(_0x1bb060,_0x3f149f){var _0x60809a={'raw':![],'where':{'id':_0x1bb060[_0x6a59('0xa8')]['id']}},_0x1d84df={};_0x1d84df[_0x6a59('0x39')]=_[_0x6a59('0x3c')](db['FaxInteraction'][_0x6a59('0x35')]);_0x1d84df[_0x6a59('0x3b')]=_[_0x6a59('0x3c')](_0x1bb060['query']);_0x1d84df['filters']=_['intersection'](_0x1d84df[_0x6a59('0x39')],_0x1d84df[_0x6a59('0x3b')]);_0x60809a[_0x6a59('0x3f')]=_['intersection'](_0x1d84df[_0x6a59('0x39')],qs['fields'](_0x1bb060[_0x6a59('0x3b')][_0x6a59('0xa9')]));_0x60809a['attributes']=_0x60809a[_0x6a59('0x3f')][_0x6a59('0x40')]?_0x60809a[_0x6a59('0x3f')]:_0x1d84df[_0x6a59('0x39')];if(_0x1bb060[_0x6a59('0x3b')][_0x6a59('0xaa')]){_0x60809a[_0x6a59('0xab')]=[{'all':!![]}];}_0x60809a=_[_0x6a59('0xac')]({},_0x60809a,_0x1bb060[_0x6a59('0xad')]);return db[_0x6a59('0xae')][_0x6a59('0xaf')](_0x60809a)['then'](handleEntityNotFound(_0x3f149f,null))[_0x6a59('0x29')](respondWithResult(_0x3f149f,null))[_0x6a59('0xa7')](handleError(_0x3f149f,null));};exports['create']=function(_0x4b95e0,_0x333170){return db['FaxInteraction'][_0x6a59('0xb0')](_0x4b95e0[_0x6a59('0x6d')],{})[_0x6a59('0x29')](respondWithResult(_0x333170,0xc9))['catch'](handleError(_0x333170,null));};exports[_0x6a59('0xb1')]=function(_0x270bd9,_0x2a8fed){if(_0x270bd9[_0x6a59('0x6d')]['id']){delete _0x270bd9[_0x6a59('0x6d')]['id'];}return db['FaxInteraction'][_0x6a59('0xaf')]({'where':{'id':_0x270bd9[_0x6a59('0xa8')]['id']}})[_0x6a59('0x29')](handleEntityNotFound(_0x2a8fed,null))[_0x6a59('0x29')](saveUpdates(_0x270bd9[_0x6a59('0x6d')],null))['then'](respondWithResult(_0x2a8fed,null))['catch'](handleError(_0x2a8fed,null));};exports[_0x6a59('0xb2')]=function(_0x483858,_0x3e065a){return db[_0x6a59('0xae')][_0x6a59('0xaf')]({'where':{'id':_0x483858[_0x6a59('0xa8')]['id']}})['then'](handleEntityNotFound(_0x3e065a,null))['then'](removeEntity(_0x3e065a,null))['catch'](handleError(_0x3e065a,null));};exports[_0x6a59('0xb3')]=function(_0x27909f,_0x57b25d){return db[_0x6a59('0xae')]['describe']()[_0x6a59('0x29')](respondWithResult(_0x57b25d,null))[_0x6a59('0xa7')](handleError(_0x57b25d,null));};exports[_0x6a59('0xb4')]=function(_0x498556,_0x4ad481,_0x3f878c){return db[_0x6a59('0xb5')][_0x6a59('0xaf')]({'where':{'id':_0x498556[_0x6a59('0xa8')]['id']}})[_0x6a59('0x29')](handleEntityNotFound(_0x4ad481,null))[_0x6a59('0x29')](function(_0x54c1ee){if(_0x54c1ee){return _0x54c1ee[_0x6a59('0xb4')](_0x498556['body'][_0x6a59('0xb6')],_['omit'](_0x498556[_0x6a59('0x6d')],[_0x6a59('0xb6'),'id'])||{});}})[_0x6a59('0x29')](respondWithResult(_0x4ad481,null))[_0x6a59('0xa7')](handleError(_0x4ad481,null));};exports[_0x6a59('0xb7')]=function(_0x3e51e9,_0x3d099a,_0x4986b9){var _0x5c2159={'raw':![],'where':{}};var _0x2d37f2={};var _0x1041f7={'count':0x0,'rows':[]};return db[_0x6a59('0xae')]['findOne']({'where':{'id':_0x3e51e9['params']['id']}})[_0x6a59('0x29')](handleEntityNotFound(_0x3d099a,null))[_0x6a59('0x29')](function(_0x2093c7){if(_0x2093c7){_0x2d37f2[_0x6a59('0x39')]=_[_0x6a59('0x3c')](db[_0x6a59('0xb5')][_0x6a59('0x35')]);_0x2d37f2[_0x6a59('0x3b')]=_[_0x6a59('0x3c')](_0x3e51e9['query']);_0x2d37f2[_0x6a59('0x3d')]=_[_0x6a59('0x3e')](_0x2d37f2[_0x6a59('0x39')],_0x2d37f2[_0x6a59('0x3b')]);_0x5c2159[_0x6a59('0x3f')]=_['intersection'](_0x2d37f2[_0x6a59('0x39')],qs[_0x6a59('0xa9')](_0x3e51e9[_0x6a59('0x3b')][_0x6a59('0xa9')]));_0x5c2159[_0x6a59('0x3f')]=_0x5c2159[_0x6a59('0x3f')][_0x6a59('0x40')]?_0x5c2159[_0x6a59('0x3f')]:_0x2d37f2[_0x6a59('0x39')];if(!_0x3e51e9['query'][_0x6a59('0x41')](_0x6a59('0x42'))){_0x5c2159['limit']=qs['limit'](_0x3e51e9[_0x6a59('0x3b')][_0x6a59('0x23')]);_0x5c2159['offset']=qs[_0x6a59('0x22')](_0x3e51e9[_0x6a59('0x3b')]['offset']);}_0x5c2159['order']=qs[_0x6a59('0x44')](_0x3e51e9['query'][_0x6a59('0x44')]);_0x5c2159[_0x6a59('0x45')]=qs[_0x6a59('0x3d')](_['pick'](_0x3e51e9[_0x6a59('0x3b')],_0x2d37f2[_0x6a59('0x3d')]));_0x5c2159['where'][_0x6a59('0xa4')]=_0x2093c7['id'];if(_0x3e51e9[_0x6a59('0x3b')][_0x6a59('0x7d')]){_0x5c2159[_0x6a59('0x45')]=_[_0x6a59('0xac')](_0x5c2159[_0x6a59('0x45')],{'$or':_['map'](_0x5c2159['attributes'],function(_0x2ef083){var _0x42b298={};_0x42b298[_0x2ef083]={'$like':'%'+_0x3e51e9['query'][_0x6a59('0x7d')]+'%'};return _0x42b298;})});}if(_0x3e51e9[_0x6a59('0x3b')][_0x6a59('0x74')]){var _0x37da5f=_0x3e51e9[_0x6a59('0x3b')][_0x6a59('0x74')][_0x6a59('0x32')](',');var _0x361088={};_0x361088[_0x37da5f[0x0]]={'$gte':moment(_0x37da5f[0x1])['format'](_0x6a59('0xb8'))};_0x5c2159[_0x6a59('0x45')]=_[_0x6a59('0xac')](_0x5c2159['where'],_0x361088);}_0x5c2159=_[_0x6a59('0xac')]({},_0x5c2159,_0x3e51e9[_0x6a59('0xad')]);return db['FaxMessage'][_0x6a59('0x21')]({'where':_0x5c2159[_0x6a59('0x45')]})[_0x6a59('0x29')](function(_0x59d107){_0x1041f7['count']=_0x59d107;if(_0x3e51e9[_0x6a59('0x3b')][_0x6a59('0xaa')]){_0x5c2159['include']=[{'all':!![]}];}return db[_0x6a59('0xb5')][_0x6a59('0xb9')](_0x5c2159);})['then'](function(_0x31f3d7){_0x1041f7[_0x6a59('0xa6')]=_0x31f3d7;return _0x1041f7;});}})[_0x6a59('0x29')](respondWithFilteredResult(_0x3d099a,_0x5c2159))[_0x6a59('0xa7')](handleError(_0x3d099a,null));};exports[_0x6a59('0xba')]=function(_0x44df7e,_0x3bc9cc,_0x9a15e8){return db['FaxInteraction'][_0x6a59('0xaf')]({'where':{'id':_0x44df7e['params']['id']}})[_0x6a59('0x29')](handleEntityNotFound(_0x3bc9cc,null))['then'](function(_0x5f346c){if(_0x5f346c){return _0x5f346c['setTags'](_0x44df7e[_0x6a59('0x6d')][_0x6a59('0xb6')],_['omit'](_0x44df7e[_0x6a59('0x6d')],['ids','id'])||{})[_0x6a59('0xbb')](function(){return db[_0x6a59('0x69')][_0x6a59('0xb9')]({'attributes':['id',_0x6a59('0x2c'),_0x6a59('0x48')],'where':{'id':_0x44df7e['body'][_0x6a59('0xb6')]}});})[_0x6a59('0x29')](function(_0x3f1873){socket[_0x6a59('0xbc')](_0x6a59('0xbd'),{'id':Number(_0x44df7e[_0x6a59('0xa8')]['id']),'tags':_0x3f1873||[]});return{'id':Number(_0x44df7e[_0x6a59('0xa8')]['id']),'tags':_0x3f1873||[]};});}})['then'](respondWithResult(_0x3bc9cc,null))[_0x6a59('0xa7')](handleError(_0x3bc9cc,null));};exports[_0x6a59('0xbe')]=function(_0x4fc9c1,_0x11b5ab,_0x566799){return db['FaxInteraction'][_0x6a59('0xaf')]({'where':{'id':_0x4fc9c1[_0x6a59('0xa8')]['id']}})['then'](handleEntityNotFound(_0x11b5ab,null))[_0x6a59('0x29')](function(_0x52b9dd){if(_0x52b9dd){return _0x52b9dd['removeTags'](_0x4fc9c1[_0x6a59('0x3b')][_0x6a59('0xb6')]);}})[_0x6a59('0x29')](respondWithStatusCode(_0x11b5ab,null))['catch'](handleError(_0x11b5ab,null));};exports[_0x6a59('0xbf')]=function(_0x497e73,_0x30f1d6){var _0x57d792=moment()[_0x6a59('0xc0')]()[_0x6a59('0x91')]();var _0x14815b=path['join'](config[_0x6a59('0xc1')],_0x6a59('0xc2'),_0x6a59('0xc3'),_0x6a59('0xc4'));var _0x4e2ec7=path[_0x6a59('0xc5')](config[_0x6a59('0xc1')],_0x6a59('0xc2'),'files',_0x6a59('0xc6'));var _0x351d4a=path[_0x6a59('0xc5')](_0x14815b,_0x57d792);var _0x1f6636=util[_0x6a59('0xc7')](_0x6a59('0xc8'),_0x497e73[_0x6a59('0xa8')]['id'],_0x57d792);var _0x359377=path['join'](_0x14815b,_0x1f6636);var _0x14f566=[];_0x14f566[_0x6a59('0x34')]({'model':db[_0x6a59('0xc9')],'as':_0x6a59('0xc9'),'raw':!![]});var _0x49ac46=[{'model':db[_0x6a59('0xb5')],'as':'Messages','attributes':['id',_0x6a59('0x6d'),_0x6a59('0xca')],'include':_0x14f566}];return db[_0x6a59('0xae')]['find']({'where':{'id':_0x497e73[_0x6a59('0xa8')]['id']},'include':_0x49ac46})[_0x6a59('0x29')](handleEntityNotFound(_0x30f1d6,null))[_0x6a59('0x29')](function(_0x2c9176){if(_0x2c9176&&_0x2c9176[_0x6a59('0xcb')]){var _0x980961=_0x2c9176[_0x6a59('0xcc')]({'plain':!![]});fs[_0x6a59('0xcd')](_0x351d4a);for(var _0x486582=0x0;_0x486582<_0x980961[_0x6a59('0xcb')][_0x6a59('0x40')];_0x486582++){var _0x2030e5=_0x980961[_0x6a59('0xcb')][_0x486582][_0x6a59('0xc9')];if(_0x2030e5){var _0x387fa4=path[_0x6a59('0xc5')](_0x4e2ec7,_0x2030e5[_0x6a59('0xce')]);if(fs['existsSync'](_0x387fa4)){fs[_0x6a59('0xcf')](_0x387fa4)['pipe'](fs['createWriteStream'](path[_0x6a59('0xc5')](_0x351d4a,_0x2030e5['basename'])));}}}return BPromise['resolve']()[_0x6a59('0x29')](function(){return new BPromise(function(_0x795ba2,_0x21f2d3){zipdir(_0x351d4a,{'saveTo':_0x359377},function(_0xc7458f,_0x229ae0){if(_0xc7458f)return _0x21f2d3(_0xc7458f);return _0x795ba2(_0x229ae0);});})[_0x6a59('0x29')](function(){return new BPromise(function(_0x338ac6,_0x24ec4d){rimraf(_0x351d4a,function(_0x23d1d7){if(_0x23d1d7)_0x24ec4d(_0x23d1d7);return _0x338ac6();});});})['then'](function(){return _0x30f1d6[_0x6a59('0xbf')](_0x359377,_0x1f6636,function(_0x1d209d){if(_0x1d209d){console[_0x6a59('0xd0')](_0x6a59('0xd1'),_0x1d209d);}else{fs['unlinkSync'](_0x359377);}});});});}else{return _0x30f1d6[_0x6a59('0x1d')](0xc8);}})[_0x6a59('0xa7')](handleError(_0x30f1d6,null));}; \ No newline at end of file +var _0x29b1=['order','sort','where','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','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','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','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','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','\x27\x27\x27\x27','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','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','isEmpty','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','rows','params','model','options','create','destroy','describe','addMessage','ids','omit','findOne','FaxMessage','nolimit','pick','format','includeAll','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','download','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','Users','map','fullname','Tags','TagIds','forEach','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x35f2c7,_0x1f8cf2){var _0x1a5369=function(_0x4fee24){while(--_0x4fee24){_0x35f2c7['push'](_0x35f2c7['shift']());}};_0x1a5369(++_0x1f8cf2);}(_0x29b1,0x16d));var _0x129b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x29b1[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0x129b('0x0'));var emlformat=require(_0x129b('0x1'));var rimraf=require(_0x129b('0x2'));var zipdir=require(_0x129b('0x3'));var jsonpatch=require(_0x129b('0x4'));var rp=require('request-promise');var moment=require(_0x129b('0x5'));var BPromise=require(_0x129b('0x6'));var Mustache=require(_0x129b('0x7'));var util=require(_0x129b('0x8'));var path=require(_0x129b('0x9'));var sox=require(_0x129b('0xa'));var csv=require(_0x129b('0xb'));var ejs=require(_0x129b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x129b('0xd'));var crypto=require('crypto');var jsforce=require(_0x129b('0xe'));var deskjs=require(_0x129b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x129b('0x10'));var Papa=require(_0x129b('0x11'));var Redis=require('ioredis');var authService=require(_0x129b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x129b('0x13'));var hardwareService=require(_0x129b('0x14'));var logger=require(_0x129b('0x15'))('api');var utils=require(_0x129b('0x16'));var config=require(_0x129b('0x17'));var db=require(_0x129b('0x18'))['db'];config[_0x129b('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x129b('0x1a'))(new Redis(config['redis']));require(_0x129b('0x1b'))[_0x129b('0x1c')](socket);function respondWithStatusCode(_0x17255b,_0x52137c){_0x52137c=_0x52137c||0xcc;return function(_0x41b681){if(_0x41b681){return _0x17255b['sendStatus'](_0x52137c);}return _0x17255b[_0x129b('0x1d')](_0x52137c)[_0x129b('0x1e')]();};}function respondWithResult(_0x17fff2,_0x50d62b){_0x50d62b=_0x50d62b||0xc8;return function(_0x46a6a4){if(_0x46a6a4){return _0x17fff2[_0x129b('0x1d')](_0x50d62b)[_0x129b('0x1f')](_0x46a6a4);}};}function respondWithFilteredResult(_0x2ba58c,_0x30785a){return function(_0x123acc){if(_0x123acc){var _0x135b42=_0x123acc[_0x129b('0x20')],_0x169d4c=_0x30785a[_0x129b('0x21')],_0x299bb5=_0x30785a['offset']+_0x30785a[_0x129b('0x22')],_0xecba14;if(_0x299bb5>=_0x135b42){_0x299bb5=_0x135b42;_0xecba14=0xc8;}else{_0xecba14=0xce;}_0x2ba58c[_0x129b('0x1d')](_0xecba14);return _0x2ba58c[_0x129b('0x23')](_0x129b('0x24'),_0x169d4c+'-'+_0x299bb5+'/'+_0x135b42)[_0x129b('0x1f')](_0x123acc);}return null;};}function patchUpdates(_0x252a69){return function(_0x35bfad){try{jsonpatch[_0x129b('0x25')](_0x35bfad,_0x252a69,!![]);}catch(_0x362c7e){return BPromise[_0x129b('0x26')](_0x362c7e);}return _0x35bfad[_0x129b('0x27')]();};}function saveUpdates(_0x19b23b,_0x491624){return function(_0x29c2e1){if(_0x29c2e1){return _0x29c2e1[_0x129b('0x28')](_0x19b23b)[_0x129b('0x29')](function(_0x1206c9){return _0x1206c9;});}return null;};}function removeEntity(_0x4d4b76,_0x4fedcd){return function(_0x31bccc){if(_0x31bccc){return _0x31bccc['destroy']()[_0x129b('0x29')](function(){_0x4d4b76[_0x129b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5922fe,_0x38788f){return function(_0x1c6d9f){if(!_0x1c6d9f){_0x5922fe[_0x129b('0x2a')](0x194);}return _0x1c6d9f;};}function handleError(_0x10288e,_0x45e6be){_0x45e6be=_0x45e6be||0x1f4;return function(_0x181cde){logger[_0x129b('0x2b')](_0x181cde[_0x129b('0x2c')]);if(_0x181cde['name']){delete _0x181cde[_0x129b('0x2d')];}_0x10288e[_0x129b('0x1d')](_0x45e6be)['send'](_0x181cde);};}function getInteractionUsers(_0x3a852a,_0x519053){return new BPromise(function(_0x4179e1,_0x4d1017){try{if(_0x519053[_0x3a852a['id']]){_0x3a852a[_0x129b('0x2e')]=_[_0x129b('0x2f')](_0x519053[_0x3a852a['id']],function(_0x24eb29){return{'id':_0x24eb29['id'],'fullname':_0x24eb29[_0x129b('0x30')]};});}}catch(_0x917382){_0x4d1017(_0x917382);}_0x4179e1(_0x3a852a);});}function getInteractionTags(_0x1aed6e,_0x296461){return new BPromise(function(_0x2906ef,_0x371e89){try{if(_0x1aed6e['TagIds']){_0x1aed6e[_0x129b('0x31')]=[];_0x1aed6e[_0x129b('0x32')]['split'](',')[_0x129b('0x33')](function(_0x1b0ab7){_0x1aed6e[_0x129b('0x31')]['push'](_0x296461[_0x1b0ab7]);});}delete _0x1aed6e[_0x129b('0x32')];}catch(_0xf2d43){_0x371e89(_0xf2d43);}_0x2906ef(_0x1aed6e);});}function updateFaxInteraction(_0x5c813a,_0x5a1229,_0x2e3b88){return new BPromise(function(_0x4bec4a,_0x333b32){return getInteractionUsers(_0x5c813a,_0x2e3b88)['then'](function(_0x15b01c){return getInteractionTags(_0x15b01c,_0x5a1229);})[_0x129b('0x29')](function(_0x5ba68d){_0x4bec4a(_0x5ba68d);})[_0x129b('0x34')](function(_0x141d8f){_0x333b32(_0x141d8f);});});}exports[_0x129b('0x35')]=function(_0x5bd0f6,_0x1c0e80){var _0x1d0b95={},_0x235d47={},_0x30ff4a={'count':0x0,'rows':[]};var _0x5a6c3e=_['map'](db[_0x129b('0x36')][_0x129b('0x37')],function(_0x52e037){return{'name':_0x52e037[_0x129b('0x38')],'type':_0x52e037[_0x129b('0x39')][_0x129b('0x3a')]};});_0x235d47['model']=_['map'](_0x5a6c3e,_0x129b('0x2d'));_0x235d47[_0x129b('0x3b')]=_[_0x129b('0x3c')](_0x5bd0f6['query']);_0x235d47[_0x129b('0x3d')]=_[_0x129b('0x3e')](_0x235d47['model'],_0x235d47[_0x129b('0x3b')]);_0x1d0b95[_0x129b('0x3f')]=_['intersection'](_0x235d47['model'],qs[_0x129b('0x40')](_0x5bd0f6[_0x129b('0x3b')][_0x129b('0x40')]));_0x1d0b95[_0x129b('0x3f')]=_0x1d0b95[_0x129b('0x3f')][_0x129b('0x41')]?_0x1d0b95[_0x129b('0x3f')]:_0x235d47['model'];if(!_0x5bd0f6['query'][_0x129b('0x42')]('nolimit')){_0x1d0b95[_0x129b('0x22')]=qs[_0x129b('0x22')](_0x5bd0f6[_0x129b('0x3b')][_0x129b('0x22')]);_0x1d0b95[_0x129b('0x21')]=qs[_0x129b('0x21')](_0x5bd0f6['query']['offset']);}_0x1d0b95[_0x129b('0x43')]=qs['sort'](_0x5bd0f6[_0x129b('0x3b')][_0x129b('0x44')]);_0x1d0b95[_0x129b('0x45')]=qs[_0x129b('0x3d')](_['pick'](_0x5bd0f6['query'],_0x235d47['filters']),_0x5a6c3e);var _0x40f8ab=[];var _0x4bbd59=squel[_0x129b('0x46')]()['field']('id')[_0x129b('0x47')]('name')[_0x129b('0x47')](_0x129b('0x48'))[_0x129b('0x49')](_0x129b('0x4a'));var _0x3b901a=squel[_0x129b('0x46')]()['field']('u.id')['field'](_0x129b('0x4b'))[_0x129b('0x47')](_0x129b('0x4c'))['from']('user_has_fax_interactions','ui')[_0x129b('0x4d')](_0x129b('0x4e'),'u',_0x129b('0x4f'));var _0x403d6b=squel[_0x129b('0x46')]()[_0x129b('0x49')]('fax_interactions','i')[_0x129b('0x4d')](_0x129b('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x129b('0x4d')](_0x129b('0x4e'),'o',_0x129b('0x51'))[_0x129b('0x4d')](_0x129b('0x52'),'a',_0x129b('0x53'))[_0x129b('0x4d')](_0x129b('0x54'),'me',_0x129b('0x55'))[_0x129b('0x4d')](_0x129b('0x56'),'it',_0x129b('0x57'))[_0x129b('0x4d')](_0x129b('0x4a'),'t',_0x129b('0x58'));var _0x2c2f02=squel[_0x129b('0x59')]();var _0x38bd1a=[];var _0x15d42e=squel[_0x129b('0x59')]();var _0x4872fc;if(_0x5bd0f6[_0x129b('0x3b')][_0x129b('0x5a')]){_0x4872fc=as[_0x129b('0x5b')](_0x5bd0f6[_0x129b('0x3b')]['search']);var _0x59919a=_0x4872fc[_0x129b('0x5c')];for(var _0x1f27ff=0x0;_0x1f27ff<_0x4872fc[_0x129b('0x5d')]['length'];_0x1f27ff++){var _0x484c50=_0x4872fc[_0x129b('0x5d')][_0x1f27ff];var _0x2c8b9c='i';var _0x59e7ed=_[_0x129b('0x5e')](_0x5a6c3e,[_0x129b('0x2d'),_0x484c50[_0x129b('0x47')]]);if(!_0x59e7ed){switch(_0x484c50['field']){case _0x129b('0x5f'):if(_0x484c50[_0x129b('0x60')]==0x1){_0x403d6b[_0x129b('0x61')]('`'+_0x484c50[_0x129b('0x47')]+'`\x20=\x200');}else{_0x403d6b['having']('`'+_0x484c50[_0x129b('0x47')]+_0x129b('0x62'));}break;case _0x129b('0x63'):if(_0x484c50[_0x129b('0x64')]===_0x129b('0x65')){if(_0x484c50['value'][_0x129b('0x66')]('\x20')[_0x129b('0x41')]>0x1){_0x2c2f02[_0x59919a](_0x129b('0x67'),qs[_0x129b('0x68')](_0x484c50[_0x129b('0x60')]),null);}else{var _0x1fb041='%'+_0x484c50[_0x129b('0x60')]+'%';_0x2c2f02[_0x59919a](_0x129b('0x69'),_0x1fb041,_0x1fb041,_0x1fb041);}}else{_0x59e7ed=_[_0x129b('0x5e')](_0x5a6c3e,[_0x129b('0x2d'),_0x129b('0x6a')]);_0x484c50[_0x129b('0x47')]=_0x129b('0x6a');_0x3a7df3=as[_0x129b('0x6b')](_0x2c8b9c,_0x59e7ed[_0x129b('0x39')],_0x484c50);_0x2c2f02[_0x59919a](_0x3a7df3[_0x129b('0x6c')],_0x3a7df3[_0x129b('0x60')]['start'],_0x3a7df3[_0x129b('0x60')][_0x129b('0x1e')]);}break;case _0x129b('0x6d'):var _0x1ef11a=_0x484c50[_0x129b('0x60')][_0x129b('0x66')](',')[_0x129b('0x2f')](function(_0x10f4a5){return Number(_0x10f4a5);});_0x1ef11a['forEach'](function(_0x2ad88c){_0x15d42e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2ad88c+',%');});_0x38bd1a=_[_0x129b('0x6e')](_0x38bd1a,_0x1ef11a);break;case'User':if(_0x484c50['operator']==='$substring'){_0x2c2f02[_0x59919a](_0x129b('0x6f'),'%'+_0x484c50['value']+'%',null);}else{_0x59e7ed=_[_0x129b('0x5e')](_0x5a6c3e,[_0x129b('0x2d'),_0x129b('0x70')]);_0x484c50[_0x129b('0x47')]=_0x129b('0x70');_0x3a7df3=as[_0x129b('0x6b')](_0x2c8b9c,_0x59e7ed[_0x129b('0x39')],_0x484c50);_0x2c2f02[_0x59919a](_0x3a7df3[_0x129b('0x6c')],_0x3a7df3[_0x129b('0x60')][_0x129b('0x71')],_0x3a7df3['value'][_0x129b('0x1e')]);}break;case _0x129b('0x72'):_0x3a7df3=as[_0x129b('0x6b')]('me',null,_0x484c50);_0x2c2f02[_0x59919a](_0x3a7df3['text'],_0x3a7df3['value'][_0x129b('0x71')],_0x3a7df3[_0x129b('0x60')][_0x129b('0x1e')]);break;}}else{var _0x3a7df3=as[_0x129b('0x6b')](_0x2c8b9c,_0x59e7ed[_0x129b('0x39')],_0x484c50);_0x2c2f02[_0x59919a](_0x3a7df3['text'],_0x3a7df3[_0x129b('0x60')][_0x129b('0x71')],_0x3a7df3[_0x129b('0x60')][_0x129b('0x1e')]);}}}else{var _0x58f7b3=_(_0x5bd0f6[_0x129b('0x3b')])[_0x129b('0x3c')]()[_0x129b('0x2f')](function(_0x3c0e16){return _[_0x129b('0x73')](_0x5a6c3e,[_0x129b('0x2d'),_0x3c0e16])?_0x3c0e16:undefined;})['compact']()[_0x129b('0x60')]();if(!_['isEmpty'](_0x58f7b3)){_0x58f7b3[_0x129b('0x33')](function(_0x579722){if(_0x579722===_0x129b('0x74')){_0x403d6b[_0x129b('0x45')](_0x129b('0x75'),[]['concat'](_0x5bd0f6[_0x129b('0x3b')][_0x579722]));}else if(_0x579722===_0x129b('0x76')){var _0x9283c4=JSON['parse'](_0x5bd0f6['query'][_0x579722])[_0x129b('0x77')];var _0x2a263f=JSON['parse'](_0x5bd0f6[_0x129b('0x3b')][_0x579722])[_0x129b('0x78')];_0x403d6b[_0x129b('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x9283c4,_0x2a263f);}else{if(_0x5bd0f6[_0x129b('0x3b')][_0x579722]===_0x129b('0x79')){_0x403d6b[_0x129b('0x45')]('i.'+_0x579722+'\x20IS\x20NULL');}else{_0x403d6b[_0x129b('0x45')]('i.'+_0x579722+_0x129b('0x7a'),_0x5bd0f6[_0x129b('0x3b')][_0x579722]);}}});}if(_0x5bd0f6[_0x129b('0x3b')][_0x129b('0x7b')]){if(_0x5bd0f6['query'][_0x129b('0x7b')]==0x1){_0x403d6b['having'](_0x129b('0x7c'));}else{_0x403d6b['having'](_0x129b('0x7d'));}}if(_0x5bd0f6[_0x129b('0x3b')][_0x129b('0x7e')]){_0x38bd1a=_[_0x129b('0x7f')](_0x5bd0f6['query']['tag'])?_0x5bd0f6['query'][_0x129b('0x7e')]:new Array(_0x5bd0f6[_0x129b('0x3b')][_0x129b('0x7e')]);_0x38bd1a['forEach'](function(_0x391165){_0x15d42e['or'](_0x129b('0x80'),'%,'+_0x391165+',%');});}if(_0x5bd0f6[_0x129b('0x3b')][_0x129b('0x81')]){var _0x3f18cd=_0x5bd0f6[_0x129b('0x3b')][_0x129b('0x81')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x129b('0x82'));if(qs[_0x129b('0x83')](_0x3f18cd)){_0x2c2f02['or']('i.id\x20LIKE\x20?',_0x3f18cd+'%')['or'](_0x129b('0x84'),_0x3f18cd+'%');}_0x2c2f02['or'](_0x129b('0x85'),_0x3f18cd+'%');}}_0x403d6b[_0x129b('0x45')](_0x2c2f02);_0x403d6b[_0x129b('0x86')](_0x129b('0x87'));var _0x39af9f={'type':db[_0x129b('0x88')][_0x129b('0x89')]['SELECT'],'raw':!![]};var _0x5789a2=_0x403d6b[_0x129b('0x8a')]();_0x5789a2['field'](_0x129b('0x87'));_0x5789a2['field'](_0x129b('0x8b'),_0x129b('0x5f'));if(_0x1d0b95[_0x129b('0x43')]){_0x1d0b95[_0x129b('0x43')][_0x129b('0x33')](function(_0x3b2bf8){_0x403d6b[_0x129b('0x43')]('i.'+_0x3b2bf8[0x0],_0x3b2bf8[0x1]===_0x129b('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x38bd1a)){_0x403d6b[_0x129b('0x61')](_0x15d42e);_0x5789a2[_0x129b('0x45')](_0x129b('0x8d'),_0x38bd1a);}BPromise[_0x129b('0x8e')]()[_0x129b('0x29')](function(){if(!_0x4872fc){if(_0x5bd0f6['query']['FaxAccountId']||_0x5bd0f6['query'][_0x129b('0x8f')])return;_0x5789a2[_0x129b('0x45')](_0x129b('0x90'));_0x403d6b[_0x129b('0x45')](_0x129b('0x90'));return;}return _0x5bd0f6[_0x129b('0x91')][_0x129b('0x92')]({'attributes':['id'],'raw':!![]})[_0x129b('0x29')](function(_0x4042ca){if(_[_0x129b('0x93')](_0x4042ca)){_0x5789a2[_0x129b('0x45')](_0x129b('0x94'));_0x403d6b['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x5789a2[_0x129b('0x45')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x4042ca,'id'));_0x403d6b['where'](_0x129b('0x75'),_[_0x129b('0x2f')](_0x4042ca,'id'));}});})['then'](function(){db[_0x129b('0x95')][_0x129b('0x3b')](_0x5789a2[_0x129b('0x96')](),_0x39af9f)[_0x129b('0x29')](function(_0x407202){_0x30ff4a[_0x129b('0x20')]=_0x407202[_0x129b('0x41')];if(_0x30ff4a[_0x129b('0x20')]===0x0)return[];return db[_0x129b('0x95')]['query'](_0x4bbd59[_0x129b('0x96')](),_0x39af9f)[_0x129b('0x29')](function(_0x549cbe){_0x40f8ab=_[_0x129b('0x97')](_0x549cbe,'id');_0x39af9f=_[_0x129b('0x98')](_0x39af9f,{'model':db[_0x129b('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5bd0f6[_0x129b('0x3b')][_0x129b('0x40')]){_0x1d0b95[_0x129b('0x3f')]['forEach'](function(_0x2c2908){_0x403d6b[_0x129b('0x47')]('i.'+_0x2c2908);});}else{_0x403d6b[_0x129b('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x129b('0x5f'));_0x403d6b['field'](_0x129b('0x99'),_0x129b('0x9a'));_0x403d6b[_0x129b('0x47')](_0x129b('0x9b'),'Account.mandatoryDisposition');_0x403d6b[_0x129b('0x47')](_0x129b('0x9c'));_0x403d6b[_0x129b('0x47')](_0x129b('0x9d'),_0x129b('0x9e'));_0x403d6b[_0x129b('0x47')](_0x129b('0x9f'),_0x129b('0xa0'));_0x403d6b['field'](_0x129b('0xa1'),'Contact.email');_0x403d6b[_0x129b('0x47')](_0x129b('0xa2'),'Contact.phone');_0x403d6b[_0x129b('0x47')](_0x129b('0xa3'),_0x129b('0xa4'));_0x403d6b[_0x129b('0x47')](_0x129b('0xa5'),_0x129b('0xa6'));_0x403d6b[_0x129b('0x47')](_0x129b('0xa7'),_0x129b('0xa8'));_0x403d6b[_0x129b('0x47')](_0x129b('0xa9'),_0x129b('0xaa'));_0x403d6b[_0x129b('0x47')](_0x129b('0xab'),_0x129b('0x32'));}if(_0x1d0b95[_0x129b('0x22')])_0x403d6b[_0x129b('0x22')](_0x1d0b95[_0x129b('0x22')]);if(_0x1d0b95['offset'])_0x403d6b[_0x129b('0x21')](_0x1d0b95['offset']);return db['sequelize'][_0x129b('0x3b')](_0x403d6b[_0x129b('0x96')](),_0x39af9f);})[_0x129b('0x29')](function(_0xecf1dd){_0x3b901a[_0x129b('0x45')](_0x129b('0xac'),_[_0x129b('0x2f')](_0xecf1dd,'id'));return db[_0x129b('0x95')][_0x129b('0x3b')](_0x3b901a['toString'](),_0x39af9f)[_0x129b('0x29')](function(_0xb1db3a){var _0x5babd8=_[_0x129b('0xad')](_0xb1db3a,_0x129b('0xae'));var _0x8aab38=[];_0xecf1dd[_0x129b('0x33')](function(_0x2afd6d){_0x8aab38[_0x129b('0xaf')](updateFaxInteraction(_0x2afd6d,_0x40f8ab,_0x5babd8));});return BPromise['all'](_0x8aab38);});});})['then'](function(_0x31fdc1){_0x30ff4a[_0x129b('0xb0')]=_0x31fdc1;return _0x30ff4a;})[_0x129b('0x29')](respondWithFilteredResult(_0x1c0e80,_0x1d0b95));})['catch'](handleError(_0x1c0e80,null));};exports['show']=function(_0x539104,_0x37e6a6){var _0x5ef869={'raw':![],'where':{'id':_0x539104[_0x129b('0xb1')]['id']}},_0x152fe2={};_0x152fe2[_0x129b('0xb2')]=_[_0x129b('0x3c')](db[_0x129b('0x36')][_0x129b('0x37')]);_0x152fe2['query']=_[_0x129b('0x3c')](_0x539104[_0x129b('0x3b')]);_0x152fe2[_0x129b('0x3d')]=_[_0x129b('0x3e')](_0x152fe2[_0x129b('0xb2')],_0x152fe2[_0x129b('0x3b')]);_0x5ef869['attributes']=_['intersection'](_0x152fe2[_0x129b('0xb2')],qs['fields'](_0x539104[_0x129b('0x3b')]['fields']));_0x5ef869[_0x129b('0x3f')]=_0x5ef869[_0x129b('0x3f')][_0x129b('0x41')]?_0x5ef869[_0x129b('0x3f')]:_0x152fe2[_0x129b('0xb2')];if(_0x539104[_0x129b('0x3b')]['includeAll']){_0x5ef869['include']=[{'all':!![]}];}_0x5ef869=_[_0x129b('0x98')]({},_0x5ef869,_0x539104[_0x129b('0xb3')]);return db[_0x129b('0x36')][_0x129b('0x5e')](_0x5ef869)[_0x129b('0x29')](handleEntityNotFound(_0x37e6a6,null))[_0x129b('0x29')](respondWithResult(_0x37e6a6,null))[_0x129b('0x34')](handleError(_0x37e6a6,null));};exports[_0x129b('0xb4')]=function(_0x26aa35,_0x2fc4d9){return db['FaxInteraction'][_0x129b('0xb4')](_0x26aa35[_0x129b('0x72')],{})[_0x129b('0x29')](respondWithResult(_0x2fc4d9,0xc9))[_0x129b('0x34')](handleError(_0x2fc4d9,null));};exports['update']=function(_0x57e6e0,_0x17ef6d){if(_0x57e6e0['body']['id']){delete _0x57e6e0[_0x129b('0x72')]['id'];}return db[_0x129b('0x36')][_0x129b('0x5e')]({'where':{'id':_0x57e6e0['params']['id']}})[_0x129b('0x29')](handleEntityNotFound(_0x17ef6d,null))['then'](saveUpdates(_0x57e6e0[_0x129b('0x72')],null))[_0x129b('0x29')](respondWithResult(_0x17ef6d,null))[_0x129b('0x34')](handleError(_0x17ef6d,null));};exports[_0x129b('0xb5')]=function(_0x332af3,_0x5a1665){return db[_0x129b('0x36')][_0x129b('0x5e')]({'where':{'id':_0x332af3[_0x129b('0xb1')]['id']}})[_0x129b('0x29')](handleEntityNotFound(_0x5a1665,null))['then'](removeEntity(_0x5a1665,null))[_0x129b('0x34')](handleError(_0x5a1665,null));};exports['describe']=function(_0x1cf707,_0x4544a8){return db[_0x129b('0x36')][_0x129b('0xb6')]()[_0x129b('0x29')](respondWithResult(_0x4544a8,null))[_0x129b('0x34')](handleError(_0x4544a8,null));};exports[_0x129b('0xb7')]=function(_0x183aa5,_0x34b095,_0x40c87a){return db['FaxMessage'][_0x129b('0x5e')]({'where':{'id':_0x183aa5[_0x129b('0xb1')]['id']}})[_0x129b('0x29')](handleEntityNotFound(_0x34b095,null))[_0x129b('0x29')](function(_0x71b33b){if(_0x71b33b){return _0x71b33b[_0x129b('0xb7')](_0x183aa5[_0x129b('0x72')][_0x129b('0xb8')],_[_0x129b('0xb9')](_0x183aa5[_0x129b('0x72')],['ids','id'])||{});}})[_0x129b('0x29')](respondWithResult(_0x34b095,null))['catch'](handleError(_0x34b095,null));};exports['getMessages']=function(_0x20f5dc,_0x912fae,_0x2b99ac){var _0x2670f6={'raw':![],'where':{}};var _0x14281b={};var _0x2a02d1={'count':0x0,'rows':[]};return db[_0x129b('0x36')][_0x129b('0xba')]({'where':{'id':_0x20f5dc[_0x129b('0xb1')]['id']}})[_0x129b('0x29')](handleEntityNotFound(_0x912fae,null))[_0x129b('0x29')](function(_0x14ab62){if(_0x14ab62){_0x14281b[_0x129b('0xb2')]=_[_0x129b('0x3c')](db[_0x129b('0xbb')]['rawAttributes']);_0x14281b[_0x129b('0x3b')]=_['keys'](_0x20f5dc['query']);_0x14281b[_0x129b('0x3d')]=_[_0x129b('0x3e')](_0x14281b[_0x129b('0xb2')],_0x14281b[_0x129b('0x3b')]);_0x2670f6['attributes']=_[_0x129b('0x3e')](_0x14281b[_0x129b('0xb2')],qs['fields'](_0x20f5dc[_0x129b('0x3b')]['fields']));_0x2670f6['attributes']=_0x2670f6[_0x129b('0x3f')][_0x129b('0x41')]?_0x2670f6['attributes']:_0x14281b[_0x129b('0xb2')];if(!_0x20f5dc[_0x129b('0x3b')][_0x129b('0x42')](_0x129b('0xbc'))){_0x2670f6[_0x129b('0x22')]=qs[_0x129b('0x22')](_0x20f5dc['query']['limit']);_0x2670f6[_0x129b('0x21')]=qs[_0x129b('0x21')](_0x20f5dc['query'][_0x129b('0x21')]);}_0x2670f6['order']=qs[_0x129b('0x44')](_0x20f5dc[_0x129b('0x3b')][_0x129b('0x44')]);_0x2670f6[_0x129b('0x45')]=qs[_0x129b('0x3d')](_[_0x129b('0xbd')](_0x20f5dc[_0x129b('0x3b')],_0x14281b[_0x129b('0x3d')]));_0x2670f6[_0x129b('0x45')][_0x129b('0xae')]=_0x14ab62['id'];if(_0x20f5dc[_0x129b('0x3b')][_0x129b('0x81')]){_0x2670f6[_0x129b('0x45')]=_[_0x129b('0x98')](_0x2670f6['where'],{'$or':_[_0x129b('0x2f')](_0x2670f6[_0x129b('0x3f')],function(_0x1e01c5){var _0x3591e5={};_0x3591e5[_0x1e01c5]={'$like':'%'+_0x20f5dc[_0x129b('0x3b')][_0x129b('0x81')]+'%'};return _0x3591e5;})});}if(_0x20f5dc[_0x129b('0x3b')][_0x129b('0x77')]){var _0x31304d=_0x20f5dc[_0x129b('0x3b')][_0x129b('0x77')]['split'](',');var _0x42a85e={};_0x42a85e[_0x31304d[0x0]]={'$gte':moment(_0x31304d[0x1])[_0x129b('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2670f6['where']=_[_0x129b('0x98')](_0x2670f6[_0x129b('0x45')],_0x42a85e);}_0x2670f6=_[_0x129b('0x98')]({},_0x2670f6,_0x20f5dc['options']);return db['FaxMessage'][_0x129b('0x20')]({'where':_0x2670f6['where']})[_0x129b('0x29')](function(_0x4a7212){_0x2a02d1[_0x129b('0x20')]=_0x4a7212;if(_0x20f5dc[_0x129b('0x3b')][_0x129b('0xbf')]){_0x2670f6['include']=[{'all':!![]}];}return db[_0x129b('0xbb')]['findAll'](_0x2670f6);})[_0x129b('0x29')](function(_0x4b6de3){_0x2a02d1['rows']=_0x4b6de3;return _0x2a02d1;});}})['then'](respondWithFilteredResult(_0x912fae,_0x2670f6))['catch'](handleError(_0x912fae,null));};exports['addTags']=function(_0x41d49e,_0x5f16b,_0x5351f6){return db[_0x129b('0x36')]['find']({'where':{'id':_0x41d49e[_0x129b('0xb1')]['id']}})[_0x129b('0x29')](handleEntityNotFound(_0x5f16b,null))[_0x129b('0x29')](function(_0x3df772){if(_0x3df772){return _0x3df772[_0x129b('0xc0')](_0x41d49e[_0x129b('0x72')][_0x129b('0xb8')],_[_0x129b('0xb9')](_0x41d49e[_0x129b('0x72')],[_0x129b('0xb8'),'id'])||{})[_0x129b('0xc1')](function(){return db['Tag'][_0x129b('0xc2')]({'attributes':['id',_0x129b('0x2d'),_0x129b('0x48')],'where':{'id':_0x41d49e[_0x129b('0x72')][_0x129b('0xb8')]}});})[_0x129b('0x29')](function(_0x2f61f1){socket[_0x129b('0xc3')](_0x129b('0xc4'),{'id':Number(_0x41d49e[_0x129b('0xb1')]['id']),'tags':_0x2f61f1||[]});return{'id':Number(_0x41d49e[_0x129b('0xb1')]['id']),'tags':_0x2f61f1||[]};});}})[_0x129b('0x29')](respondWithResult(_0x5f16b,null))[_0x129b('0x34')](handleError(_0x5f16b,null));};exports[_0x129b('0xc5')]=function(_0x4e11f1,_0x4917a4,_0x4f9168){return db[_0x129b('0x36')][_0x129b('0x5e')]({'where':{'id':_0x4e11f1[_0x129b('0xb1')]['id']}})[_0x129b('0x29')](handleEntityNotFound(_0x4917a4,null))['then'](function(_0x3e081a){if(_0x3e081a){return _0x3e081a[_0x129b('0xc5')](_0x4e11f1[_0x129b('0x3b')][_0x129b('0xb8')]);}})['then'](respondWithStatusCode(_0x4917a4,null))[_0x129b('0x34')](handleError(_0x4917a4,null));};exports[_0x129b('0xc6')]=function(_0x2351e5,_0x1eec59){var _0x496df1=moment()['unix']()['toString']();var _0x3e5033=path[_0x129b('0xc7')](config[_0x129b('0xc8')],_0x129b('0xc9'),'files',_0x129b('0xca'));var _0x11304d=path[_0x129b('0xc7')](config[_0x129b('0xc8')],_0x129b('0xc9'),_0x129b('0xcb'),_0x129b('0xcc'));var _0x4a8a4f=path[_0x129b('0xc7')](_0x3e5033,_0x496df1);var _0x55ece7=util['format'](_0x129b('0xcd'),_0x2351e5['params']['id'],_0x496df1);var _0x23074c=path[_0x129b('0xc7')](_0x3e5033,_0x55ece7);var _0x524c84=[];_0x524c84[_0x129b('0xaf')]({'model':db[_0x129b('0xce')],'as':_0x129b('0xce'),'raw':!![]});var _0x1a0695=[{'model':db[_0x129b('0xbb')],'as':_0x129b('0xcf'),'attributes':['id','body',_0x129b('0x76')],'include':_0x524c84}];return db['FaxInteraction'][_0x129b('0x5e')]({'where':{'id':_0x2351e5[_0x129b('0xb1')]['id']},'include':_0x1a0695})[_0x129b('0x29')](handleEntityNotFound(_0x1eec59,null))['then'](function(_0x407892){if(_0x407892&&_0x407892[_0x129b('0xcf')]){var _0x5ab83c=_0x407892[_0x129b('0xd0')]({'plain':!![]});fs[_0x129b('0xd1')](_0x4a8a4f);for(var _0x827cf4=0x0;_0x827cf4<_0x5ab83c[_0x129b('0xcf')][_0x129b('0x41')];_0x827cf4++){var _0x11ed5e=_0x5ab83c[_0x129b('0xcf')][_0x827cf4][_0x129b('0xce')];if(_0x11ed5e){var _0x1476dc=path[_0x129b('0xc7')](_0x11304d,_0x11ed5e[_0x129b('0xd2')]);if(fs['existsSync'](_0x1476dc)){fs[_0x129b('0xd3')](_0x1476dc)[_0x129b('0xd4')](fs[_0x129b('0xd5')](path[_0x129b('0xc7')](_0x4a8a4f,_0x11ed5e['basename'])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x12b4b7,_0x4c1035){zipdir(_0x4a8a4f,{'saveTo':_0x23074c},function(_0x1eda62,_0x495fa7){if(_0x1eda62)return _0x4c1035(_0x1eda62);return _0x12b4b7(_0x495fa7);});})[_0x129b('0x29')](function(){return new BPromise(function(_0x189b66,_0x3aa0c3){rimraf(_0x4a8a4f,function(_0x2f963b){if(_0x2f963b)_0x3aa0c3(_0x2f963b);return _0x189b66();});});})[_0x129b('0x29')](function(){return _0x1eec59['download'](_0x23074c,_0x55ece7,function(_0x2a5609){if(_0x2a5609){console[_0x129b('0xd6')]('err',_0x2a5609);}else{fs[_0x129b('0xd7')](_0x23074c);}});});});}else{return _0x1eec59['sendStatus'](0xc8);}})[_0x129b('0x34')](handleError(_0x1eec59,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index fc95cc8..d1775cf 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 _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x4e16f7,_0xb4da1b){var _0x5a05ee=function(_0x26f683){while(--_0x26f683){_0x4e16f7['push'](_0x4e16f7['shift']());}};_0x5a05ee(++_0xb4da1b);}(_0x7a54,0x106));var _0x47a5=function(_0x8a5c85,_0x30409a){_0x8a5c85=_0x8a5c85-0x0;var _0x35e863=_0x7a54[_0x8a5c85];return _0x35e863;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x38a3bb,_0x232557){var _0x5a519d=function(_0x182a8c){while(--_0x182a8c){_0x38a3bb['push'](_0x38a3bb['shift']());}};_0x5a519d(++_0x232557);}(_0x814b,0x1a2));var _0xb814=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x814b[_0x4b7895];return _0x264180;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index fe4a194..44d6b44 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 _0xedd9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','FaxInteraction','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x19b0de,_0x1d33dd){var _0x3ab179=function(_0x3846e7){while(--_0x3846e7){_0x19b0de['push'](_0x19b0de['shift']());}};_0x3ab179(++_0x1d33dd);}(_0xedd9,0xfc));var _0x9edd=function(_0xb17696,_0xbf3738){_0xb17696=_0xb17696-0x0;var _0x80b44e=_0xedd9[_0xb17696];return _0x80b44e;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x172522,_0x190185,_0x1355be){if(_0x172522[_0x9edd('0xb')]('closed')){_0x172522[_0x9edd('0xc')]=moment()['format'](_0x9edd('0xd'));}_0x1355be(null,_0x172522);}}});}; \ No newline at end of file +var _0xa9e0=['define','FaxInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x50d7cc,_0x59b2a2){var _0x1852ff=function(_0x58e021){while(--_0x58e021){_0x50d7cc['push'](_0x50d7cc['shift']());}};_0x1852ff(++_0x59b2a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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':'fax_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/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 0e3c879..3ff482b 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 _0x55a9=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','FaxInteraction','body','options','raw','where','limit','UpdateFaxInteraction','stringify','addTags','ids','omit','spread','AddTags','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x55a9,0x16c));var _0x955a=function(_0x1b7e74,_0x5e9672){_0x1b7e74=_0x1b7e74-0x0;var _0x21fd02=_0x55a9[_0x1b7e74];return _0x21fd02;};'use strict';var _=require(_0x955a('0x0'));var util=require('util');var moment=require(_0x955a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x955a('0x2'))['db'];var utils=require(_0x955a('0x3'));var logger=require(_0x955a('0x4'))('rpc');var config=require(_0x955a('0x5'));var jayson=require(_0x955a('0x6'));var client=jayson[_0x955a('0x7')][_0x955a('0x8')]({'port':0x232a});config[_0x955a('0x9')]=_[_0x955a('0xa')](config['redis'],{'host':_0x955a('0xb'),'port':0x18eb});var socket=require(_0x955a('0xc'))(new Redis(config[_0x955a('0x9')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x405a00,_0x4f5d06,_0x1a24b3){return new BPromise(function(_0x29c997,_0x20aeaa){return client[_0x955a('0xd')](_0x405a00,_0x1a24b3)[_0x955a('0xe')](function(_0x5d9916){logger[_0x955a('0xf')](_0x955a('0x10'),_0x4f5d06,'request\x20sent');logger[_0x955a('0x11')](_0x955a('0x12'),_0x4f5d06,_0x955a('0x13'),JSON['stringify'](_0x5d9916));if(_0x5d9916[_0x955a('0x14')]){if(_0x5d9916[_0x955a('0x14')][_0x955a('0x15')]===0x1f4){logger[_0x955a('0x14')](_0x955a('0x10'),_0x4f5d06,_0x5d9916[_0x955a('0x14')][_0x955a('0x16')]);return _0x20aeaa(_0x5d9916[_0x955a('0x14')][_0x955a('0x16')]);}logger[_0x955a('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x4f5d06,_0x5d9916[_0x955a('0x14')][_0x955a('0x16')]);return _0x29c997(_0x5d9916[_0x955a('0x14')][_0x955a('0x16')]);}else{logger[_0x955a('0xf')](_0x955a('0x10'),_0x4f5d06,'request\x20sent');_0x29c997(_0x5d9916['result']['message']);}})[_0x955a('0x17')](function(_0x34ddc0){logger[_0x955a('0x14')](_0x955a('0x10'),_0x4f5d06,_0x34ddc0);_0x20aeaa(_0x34ddc0);});});}exports['UpdateFaxInteraction']=function(_0x4300e1){var _0xc528e9=this;return new Promise(function(_0x56f2e8,_0x1ea3d7){return db[_0x955a('0x18')]['update'](_0x4300e1[_0x955a('0x19')],{'raw':_0x4300e1[_0x955a('0x1a')]?_0x4300e1[_0x955a('0x1a')][_0x955a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4300e1['options']?_0x4300e1[_0x955a('0x1a')][_0x955a('0x1c')]||null:null,'attributes':_0x4300e1[_0x955a('0x1a')]?_0x4300e1[_0x955a('0x1a')]['attributes']||null:null,'limit':_0x4300e1['options']?_0x4300e1[_0x955a('0x1a')][_0x955a('0x1d')]||null:null})[_0x955a('0xe')](function(_0x5c1f14){logger['info']('UpdateFaxInteraction',_0x4300e1);logger['debug'](_0x955a('0x1e'),_0x4300e1,JSON[_0x955a('0x1f')](_0x5c1f14));_0x56f2e8(_0x5c1f14);})[_0x955a('0x17')](function(_0x1f4758){logger[_0x955a('0x14')](_0x955a('0x1e'),_0x1f4758['message'],_0x4300e1);_0x1ea3d7(_0xc528e9['error'](0x1f4,_0x1f4758[_0x955a('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x4cc9aa){return new Promise(function(_0x98844b,_0x589780){return db[_0x955a('0x18')]['find']({'where':_0x4cc9aa[_0x955a('0x1a')]?_0x4cc9aa['options'][_0x955a('0x1c')]||null:null})['then'](function(_0x3f2831){if(_0x3f2831){return _0x3f2831[_0x955a('0x20')](_0x4cc9aa[_0x955a('0x19')][_0x955a('0x21')],_[_0x955a('0x22')](_0x4cc9aa[_0x955a('0x19')],['ids','id'])||{});}})[_0x955a('0x23')](function(_0x4ea78b){logger[_0x955a('0xf')](_0x955a('0x24'),_0x4cc9aa);logger[_0x955a('0x11')]('AddTags',_0x4cc9aa,JSON[_0x955a('0x1f')](_0x4ea78b));_0x98844b(_0x4ea78b);})[_0x955a('0x17')](function(_0x39ce5c){logger['error'](_0x955a('0x24'),_0x39ce5c['message'],_0x4cc9aa);_0x589780(_this[_0x955a('0x14')](0x1f4,_0x39ce5c[_0x955a('0x16')]));});});}; \ No newline at end of file +var _0x9b17=['register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x5cf55b,_0x4c3b75){var _0x59917b=function(_0x135f28){while(--_0x135f28){_0x5cf55b['push'](_0x5cf55b['shift']());}};_0x59917b(++_0x4c3b75);}(_0x9b17,0xc2));var _0x79b1=function(_0x56d1b7,_0x1d88f5){_0x56d1b7=_0x56d1b7-0x0;var _0x184d91=_0x9b17[_0x56d1b7];return _0x184d91;};'use strict';var _=require(_0x79b1('0x0'));var util=require(_0x79b1('0x1'));var moment=require('moment');var BPromise=require(_0x79b1('0x2'));var rs=require(_0x79b1('0x3'));var fs=require('fs');var Redis=require(_0x79b1('0x4'));var db=require(_0x79b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x79b1('0x6'))(_0x79b1('0x7'));var config=require(_0x79b1('0x8'));var jayson=require(_0x79b1('0x9'));var client=jayson['client'][_0x79b1('0xa')]({'port':0x232a});config['redis']=_[_0x79b1('0xb')](config[_0x79b1('0xc')],{'host':_0x79b1('0xd'),'port':0x18eb});var socket=require(_0x79b1('0xe'))(new Redis(config[_0x79b1('0xc')]));require(_0x79b1('0xf'))[_0x79b1('0x10')](socket);function respondWithRpcPromise(_0x4d45b0,_0xa7682b,_0x5c9e65){return new BPromise(function(_0xdf1237,_0x1b03c7){return client[_0x79b1('0x11')](_0x4d45b0,_0x5c9e65)[_0x79b1('0x12')](function(_0x126558){logger[_0x79b1('0x13')](_0x79b1('0x14'),_0xa7682b,_0x79b1('0x15'));logger[_0x79b1('0x16')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0xa7682b,_0x79b1('0x15'),JSON['stringify'](_0x126558));if(_0x126558[_0x79b1('0x17')]){if(_0x126558[_0x79b1('0x17')]['code']===0x1f4){logger[_0x79b1('0x17')](_0x79b1('0x14'),_0xa7682b,_0x126558['error']['message']);return _0x1b03c7(_0x126558['error'][_0x79b1('0x18')]);}logger[_0x79b1('0x17')](_0x79b1('0x14'),_0xa7682b,_0x126558[_0x79b1('0x17')][_0x79b1('0x18')]);return _0xdf1237(_0x126558[_0x79b1('0x17')]['message']);}else{logger[_0x79b1('0x13')](_0x79b1('0x14'),_0xa7682b,'request\x20sent');_0xdf1237(_0x126558['result'][_0x79b1('0x18')]);}})[_0x79b1('0x19')](function(_0x1d7d3b){logger['error'](_0x79b1('0x14'),_0xa7682b,_0x1d7d3b);_0x1b03c7(_0x1d7d3b);});});}exports[_0x79b1('0x1a')]=function(_0x182359){var _0xcb2107=this;return new Promise(function(_0x512722,_0x50984b){return db[_0x79b1('0x1b')][_0x79b1('0x1c')](_0x182359['body'],{'raw':_0x182359[_0x79b1('0x1d')]?_0x182359[_0x79b1('0x1d')][_0x79b1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x182359[_0x79b1('0x1d')]?_0x182359[_0x79b1('0x1d')][_0x79b1('0x1f')]||null:null,'attributes':_0x182359[_0x79b1('0x1d')]?_0x182359[_0x79b1('0x1d')][_0x79b1('0x20')]||null:null,'limit':_0x182359[_0x79b1('0x1d')]?_0x182359['options'][_0x79b1('0x21')]||null:null})[_0x79b1('0x12')](function(_0x48b2f4){logger[_0x79b1('0x13')](_0x79b1('0x1a'),_0x182359);logger[_0x79b1('0x16')]('UpdateFaxInteraction',_0x182359,JSON[_0x79b1('0x22')](_0x48b2f4));_0x512722(_0x48b2f4);})[_0x79b1('0x19')](function(_0x63136b){logger[_0x79b1('0x17')](_0x79b1('0x1a'),_0x63136b[_0x79b1('0x18')],_0x182359);_0x50984b(_0xcb2107[_0x79b1('0x17')](0x1f4,_0x63136b[_0x79b1('0x18')]));});});};exports[_0x79b1('0x23')]=function(_0x55f7fc){return new Promise(function(_0x4da92d,_0xbcba70){return db[_0x79b1('0x1b')][_0x79b1('0x24')]({'where':_0x55f7fc[_0x79b1('0x1d')]?_0x55f7fc[_0x79b1('0x1d')][_0x79b1('0x1f')]||null:null})[_0x79b1('0x12')](function(_0x478ee2){if(_0x478ee2){return _0x478ee2[_0x79b1('0x25')](_0x55f7fc['body'][_0x79b1('0x26')],_[_0x79b1('0x27')](_0x55f7fc['body'],[_0x79b1('0x26'),'id'])||{});}})[_0x79b1('0x28')](function(_0x15b883){logger[_0x79b1('0x13')](_0x79b1('0x29'),_0x55f7fc);logger[_0x79b1('0x16')]('AddTags',_0x55f7fc,JSON[_0x79b1('0x22')](_0x15b883));_0x4da92d(_0x15b883);})[_0x79b1('0x19')](function(_0x257122){logger[_0x79b1('0x17')](_0x79b1('0x29'),_0x257122[_0x79b1('0x18')],_0x55f7fc);_0xbcba70(_this[_0x79b1('0x17')](0x1f4,_0x257122[_0x79b1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index ac0372b..d1937c3 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 _0x0b79=['update','removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x52d8b9,_0xe54454){var _0x126b5b=function(_0x43d8c8){while(--_0x43d8c8){_0x52d8b9['push'](_0x52d8b9['shift']());}};_0x126b5b(++_0xe54454);}(_0x0b79,0xad));var _0x90b7=function(_0x510fa7,_0x5e0274){_0x510fa7=_0x510fa7-0x0;var _0x158165=_0x0b79[_0x510fa7];return _0x158165;};'use strict';var FaxInteractionEvents=require(_0x90b7('0x0'));var events=[_0x90b7('0x1'),_0x90b7('0x2'),_0x90b7('0x3')];function createListener(_0x4ce995,_0x40bb7a){return function(_0x2e65e1){_0x40bb7a['emit'](_0x4ce995,_0x2e65e1);};}function removeListener(_0xd3671f,_0x4cd6c5){return function(){FaxInteractionEvents[_0x90b7('0x4')](_0xd3671f,_0x4cd6c5);};}exports[_0x90b7('0x5')]=function(_0x1fba94){for(var _0x3a8902=0x0,_0x5191fa=events[_0x90b7('0x6')];_0x3a8902<_0x5191fa;_0x3a8902++){var _0x5c8d2a=events[_0x3a8902];var _0x41981b=createListener(_0x90b7('0x7')+_0x5c8d2a,_0x1fba94);FaxInteractionEvents['on'](_0x5c8d2a,_0x41981b);}}; \ No newline at end of file +var _0xa6a7=['emit','faxInteraction:','save','remove','update'];(function(_0x455daa,_0x1f4085){var _0x21eae7=function(_0x20f9a0){while(--_0x20f9a0){_0x455daa['push'](_0x455daa['shift']());}};_0x21eae7(++_0x1f4085);}(_0xa6a7,0x1ce));var _0x7a6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa6a7[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x7a6a('0x0'),_0x7a6a('0x1'),_0x7a6a('0x2')];function createListener(_0x3c071b,_0x508260){return function(_0x919d22){_0x508260[_0x7a6a('0x3')](_0x3c071b,_0x919d22);};}function removeListener(_0x220cb5,_0x3880f3){return function(){FaxInteractionEvents['removeListener'](_0x220cb5,_0x3880f3);};}exports['register']=function(_0x25f22b){for(var _0x2605f7=0x0,_0x4cbf95=events['length'];_0x2605f7<_0x4cbf95;_0x2605f7++){var _0x264c90=events[_0x2605f7];var _0x3ca017=createListener(_0x7a6a('0x4')+_0x264c90,_0x25f22b);FaxInteractionEvents['on'](_0x264c90,_0x3ca017);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index be01893..f7bab4f 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 _0x073d=['tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMessages','download','post','/:id/messages','addMessage','/:id/tags'];(function(_0x377df4,_0x531097){var _0x3f139f=function(_0x3d426f){while(--_0x3d426f){_0x377df4['push'](_0x377df4['shift']());}};_0x3f139f(++_0x531097);}(_0x073d,0x103));var _0xd073=function(_0x4ea44b,_0x546b89){_0x4ea44b=_0x4ea44b-0x0;var _0x418cc9=_0x073d[_0x4ea44b];return _0x418cc9;};'use strict';var multer=require(_0xd073('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd073('0x1'));var express=require(_0xd073('0x2'));var router=express[_0xd073('0x3')]();var auth=require(_0xd073('0x4'));var interaction=require(_0xd073('0x5'));var config=require('../../config/environment');var controller=require(_0xd073('0x6'));router['get']('/',auth[_0xd073('0x7')](),controller[_0xd073('0x8')]);router[_0xd073('0x9')](_0xd073('0xa'),auth[_0xd073('0x7')](),controller[_0xd073('0xb')]);router[_0xd073('0x9')](_0xd073('0xc'),auth[_0xd073('0x7')](),controller[_0xd073('0xd')]);router['get']('/:id/messages',auth[_0xd073('0x7')](),controller[_0xd073('0xe')]);router[_0xd073('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xd073('0xf')]);router[_0xd073('0x10')]('/',auth[_0xd073('0x7')](),controller['create']);router['post'](_0xd073('0x11'),auth[_0xd073('0x7')](),controller[_0xd073('0x12')]);router[_0xd073('0x10')](_0xd073('0x13'),auth[_0xd073('0x7')](),interaction[_0xd073('0x14')](_0xd073('0x15'),_0xd073('0x16')),controller[_0xd073('0x17')]);router[_0xd073('0x18')](_0xd073('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xd073('0x15'),'faxinteraction:update'),controller[_0xd073('0x19')]);router[_0xd073('0x1a')](_0xd073('0xc'),auth[_0xd073('0x7')](),interaction['tracked'](_0xd073('0x15'),_0xd073('0x1b')),controller[_0xd073('0x1c')]);router[_0xd073('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd073('0x1d')]);module[_0xd073('0x1e')]=router; \ No newline at end of file +var _0x86a8=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','update','delete','faxinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x294b6,_0x2907ae){var _0x38bb97=function(_0x5aaa76){while(--_0x5aaa76){_0x294b6['push'](_0x294b6['shift']());}};_0x38bb97(++_0x2907ae);}(_0x86a8,0x1ae));var _0x886a=function(_0xa380d8,_0x306ca2){_0xa380d8=_0xa380d8-0x0;var _0x5b3ade=_0x86a8[_0xa380d8];return _0x5b3ade;};'use strict';var multer=require(_0x886a('0x0'));var util=require(_0x886a('0x1'));var path=require(_0x886a('0x2'));var timeout=require(_0x886a('0x3'));var express=require(_0x886a('0x4'));var router=express[_0x886a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x886a('0x6'));var config=require(_0x886a('0x7'));var controller=require('./faxInteraction.controller');router[_0x886a('0x8')]('/',auth[_0x886a('0x9')](),controller['index']);router[_0x886a('0x8')]('/describe',auth[_0x886a('0x9')](),controller['describe']);router[_0x886a('0x8')](_0x886a('0xa'),auth[_0x886a('0x9')](),controller[_0x886a('0xb')]);router[_0x886a('0x8')](_0x886a('0xc'),auth[_0x886a('0x9')](),controller[_0x886a('0xd')]);router[_0x886a('0x8')](_0x886a('0xe'),auth['isAuthenticated'](),controller[_0x886a('0xf')]);router[_0x886a('0x10')]('/',auth[_0x886a('0x9')](),controller[_0x886a('0x11')]);router['post'](_0x886a('0xc'),auth[_0x886a('0x9')](),controller[_0x886a('0x12')]);router[_0x886a('0x10')](_0x886a('0x13'),auth[_0x886a('0x9')](),interaction[_0x886a('0x14')](_0x886a('0x15'),_0x886a('0x16')),controller[_0x886a('0x17')]);router['put'](_0x886a('0xa'),auth[_0x886a('0x9')](),interaction[_0x886a('0x14')](_0x886a('0x15'),'faxinteraction:update'),controller[_0x886a('0x18')]);router[_0x886a('0x19')]('/:id',auth[_0x886a('0x9')](),interaction[_0x886a('0x14')]('fax',_0x886a('0x1a')),controller[_0x886a('0x1b')]);router[_0x886a('0x19')](_0x886a('0x13'),auth[_0x886a('0x9')](),controller['removeTags']);module[_0x886a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 866c524..efd5dd5 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 _0xd633=['exports','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x4d56f7,_0x2ece2e){var _0x168945=function(_0x4b2b32){while(--_0x4b2b32){_0x4d56f7['push'](_0x4d56f7['shift']());}};_0x168945(++_0x2ece2e);}(_0xd633,0x96));var _0x3d63=function(_0x201bae,_0x24c602){_0x201bae=_0x201bae-0x0;var _0x5dd069=_0xd633[_0x201bae];return _0x5dd069;};'use strict';var Sequelize=require('sequelize');module[_0x3d63('0x0')]={'body':{'type':Sequelize[_0x3d63('0x1')](_0x3d63('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3d63('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3d63('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x3d63('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x3d63('0x5')]}}; \ No newline at end of file +var _0x091d=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x5d508d,_0x517349){var _0x41c8ae=function(_0x2b87cc){while(--_0x2b87cc){_0x5d508d['push'](_0x5d508d['shift']());}};_0x41c8ae(++_0x517349);}(_0x091d,0x77));var _0xd091=function(_0x2f2cbc,_0x2a8b5e){_0x2f2cbc=_0x2f2cbc-0x0;var _0x6c3238=_0x091d[_0x2f2cbc];return _0x6c3238;};'use strict';var Sequelize=require(_0xd091('0x0'));module['exports']={'body':{'type':Sequelize[_0xd091('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd091('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd091('0x3')]('in',_0xd091('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xd091('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 639b2e0..4073909 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 _0xfb3e=['Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','fieldName','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','describe','../../config/logger','fax-interactions','accept','fax','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','/var/opt/motion2/server/files/attachments/%s','basename','root','server','files','attachments','download','join','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.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~!@#$%^&-_=+[{]}.','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','count','offset'];(function(_0x4ed1dd,_0x2c5d4a){var _0x593018=function(_0xfba1e4){while(--_0xfba1e4){_0x4ed1dd['push'](_0x4ed1dd['shift']());}};_0x593018(++_0x2c5d4a);}(_0xfb3e,0x167));var _0xefb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb3e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xefb3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xefb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xefb3('0x2'));var rp=require(_0xefb3('0x3'));var moment=require(_0xefb3('0x4'));var BPromise=require(_0xefb3('0x5'));var Mustache=require(_0xefb3('0x6'));var util=require(_0xefb3('0x7'));var path=require(_0xefb3('0x8'));var sox=require('sox');var csv=require(_0xefb3('0x9'));var ejs=require(_0xefb3('0xa'));var fs=require('fs');var _=require(_0xefb3('0xb'));var squel=require(_0xefb3('0xc'));var crypto=require(_0xefb3('0xd'));var jsforce=require(_0xefb3('0xe'));var deskjs=require(_0xefb3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xefb3('0x10'));var Papa=require(_0xefb3('0x11'));var Redis=require(_0xefb3('0x12'));var authService=require(_0xefb3('0x13'));var qs=require(_0xefb3('0x14'));var as=require(_0xefb3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xefb3('0x16'));var config=require(_0xefb3('0x17'));var db=require(_0xefb3('0x18'))['db'];config[_0xefb3('0x19')]=_[_0xefb3('0x1a')](config[_0xefb3('0x19')],{'host':_0xefb3('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xefb3('0x19')]));require(_0xefb3('0x1c'))[_0xefb3('0x1d')](socket);var jayson=require(_0xefb3('0x1e'));var client=jayson[_0xefb3('0x1f')][_0xefb3('0x20')]({'port':0x232c});var client9002=jayson[_0xefb3('0x1f')][_0xefb3('0x20')]({'port':0x232a});function checkPasswordPattern(_0x54988c,_0x14e7bb,_0x1eab10){if(_0x1eab10){var _0x38baa2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38baa2['test'](_0x14e7bb)){return _0x54988c;}else{throw new db[(_0xefb3('0x21'))][(_0xefb3('0x22'))](_0xefb3('0x23'));}}else{return _0x54988c;}}function respondWithRpcPromise(_0x130a01,_0x370c90,_0x2a423f,_0x12e293){return new BPromise(function(_0x37b7d3,_0x26552b){var _0x126de8=_0x12e293||client;return _0x126de8[_0xefb3('0x24')](_0x130a01,_0x2a423f)[_0xefb3('0x25')](function(_0x22767a){logger[_0xefb3('0x26')](_0xefb3('0x27'),_0x370c90,_0xefb3('0x28'));logger[_0xefb3('0x29')](_0xefb3('0x2a'),_0x370c90,_0xefb3('0x28'),JSON[_0xefb3('0x2b')](_0x22767a));if(_0x22767a[_0xefb3('0x2c')]){if(_0x22767a['error']['code']===0x1f4){logger[_0xefb3('0x2c')](_0xefb3('0x27'),_0x370c90,_0x22767a['error'][_0xefb3('0x2d')]);return _0x26552b(_0x22767a[_0xefb3('0x2c')][_0xefb3('0x2d')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x370c90,_0x22767a['error'][_0xefb3('0x2d')]);return _0x37b7d3(_0x22767a['error']['message']);}else{logger['info'](_0xefb3('0x27'),_0x370c90,_0xefb3('0x28'));_0x37b7d3(_0x22767a[_0xefb3('0x2e')][_0xefb3('0x2d')]);}})['catch'](function(_0xa15e11){logger['error']('FaxMessage,\x20%s,\x20%s',_0x370c90,_0xa15e11);_0x26552b(_0xa15e11);});});}function respondWithStatusCode(_0x168b32,_0x213d12){_0x213d12=_0x213d12||0xcc;return function(_0x4a2abd){if(_0x4a2abd){return _0x168b32[_0xefb3('0x2f')](_0x213d12);}return _0x168b32[_0xefb3('0x30')](_0x213d12)[_0xefb3('0x31')]();};}function respondWithResult(_0x38f844,_0x3cd7ce){_0x3cd7ce=_0x3cd7ce||0xc8;return function(_0x54b27d){if(_0x54b27d){return _0x38f844[_0xefb3('0x30')](_0x3cd7ce)['json'](_0x54b27d);}};}function respondWithFilteredResult(_0x1c0c18,_0x35b3dc){return function(_0x14a9a3){if(_0x14a9a3){var _0xf350fe=_0x14a9a3[_0xefb3('0x32')],_0x2a3458=_0x35b3dc[_0xefb3('0x33')],_0x159a0b=_0x35b3dc[_0xefb3('0x33')]+_0x35b3dc['limit'],_0x49f2c4;if(_0x159a0b>=_0xf350fe){_0x159a0b=_0xf350fe;_0x49f2c4=0xc8;}else{_0x49f2c4=0xce;}_0x1c0c18[_0xefb3('0x30')](_0x49f2c4);return _0x1c0c18['set'](_0xefb3('0x34'),_0x2a3458+'-'+_0x159a0b+'/'+_0xf350fe)[_0xefb3('0x35')](_0x14a9a3);}return null;};}function patchUpdates(_0x2978ad){return function(_0x3f7ae2){try{jsonpatch['apply'](_0x3f7ae2,_0x2978ad,!![]);}catch(_0x3f529e){return BPromise[_0xefb3('0x36')](_0x3f529e);}return _0x3f7ae2[_0xefb3('0x37')]();};}function saveUpdates(_0x325ce1,_0xbb1ec2){return function(_0x1765bc){if(_0x1765bc){return _0x1765bc[_0xefb3('0x38')](_0x325ce1)[_0xefb3('0x25')](function(_0x5e1829){return _0x5e1829;});}return null;};}function removeEntity(_0x217bdc,_0x585fbf){return function(_0xde4b40){if(_0xde4b40){return _0xde4b40[_0xefb3('0x39')]()[_0xefb3('0x25')](function(){_0x217bdc[_0xefb3('0x30')](0xcc)[_0xefb3('0x31')]();});}};}function handleEntityNotFound(_0x5828ef,_0x2dca30){return function(_0x154f16){if(!_0x154f16){_0x5828ef[_0xefb3('0x2f')](0x194);}return _0x154f16;};}function handleError(_0x12caeb,_0x219e70){_0x219e70=_0x219e70||0x1f4;return function(_0x2381ba){logger[_0xefb3('0x2c')](_0x2381ba[_0xefb3('0x3a')]);if(_0x2381ba[_0xefb3('0x3b')]){delete _0x2381ba['name'];}_0x12caeb[_0xefb3('0x30')](_0x219e70)[_0xefb3('0x3c')](_0x2381ba);};}exports[_0xefb3('0x3d')]=function(_0xc46829,_0x1f74da){var _0x594ead={},_0xbfc820={},_0x2e39a7={'count':0x0,'rows':[]};var _0x165fed=_[_0xefb3('0x3e')](db[_0xefb3('0x3f')]['rawAttributes'],function(_0x5b8c6a){return{'name':_0x5b8c6a[_0xefb3('0x40')],'type':_0x5b8c6a['type']['key']};});_0xbfc820[_0xefb3('0x41')]=_[_0xefb3('0x3e')](_0x165fed,'name');_0xbfc820['query']=_[_0xefb3('0x42')](_0xc46829['query']);_0xbfc820['filters']=_[_0xefb3('0x43')](_0xbfc820[_0xefb3('0x41')],_0xbfc820[_0xefb3('0x44')]);_0x594ead[_0xefb3('0x45')]=_[_0xefb3('0x43')](_0xbfc820[_0xefb3('0x41')],qs[_0xefb3('0x46')](_0xc46829['query'][_0xefb3('0x46')]));_0x594ead['attributes']=_0x594ead[_0xefb3('0x45')][_0xefb3('0x47')]?_0x594ead[_0xefb3('0x45')]:_0xbfc820[_0xefb3('0x41')];if(!_0xc46829[_0xefb3('0x44')][_0xefb3('0x48')](_0xefb3('0x49'))){_0x594ead[_0xefb3('0x4a')]=qs[_0xefb3('0x4a')](_0xc46829['query'][_0xefb3('0x4a')]);_0x594ead['offset']=qs[_0xefb3('0x33')](_0xc46829[_0xefb3('0x44')][_0xefb3('0x33')]);}_0x594ead['order']=qs[_0xefb3('0x4b')](_0xc46829[_0xefb3('0x44')][_0xefb3('0x4b')]);_0x594ead[_0xefb3('0x4c')]=qs[_0xefb3('0x4d')](_[_0xefb3('0x4e')](_0xc46829[_0xefb3('0x44')],_0xbfc820[_0xefb3('0x4d')]),_0x165fed);if(_0xc46829[_0xefb3('0x44')][_0xefb3('0x4f')]){_0x594ead[_0xefb3('0x4c')]=_[_0xefb3('0x50')](_0x594ead['where'],{'$or':_[_0xefb3('0x3e')](_0x165fed,function(_0x1d7466){if(_0x1d7466['type']!=='VIRTUAL'){var _0x2256dd={};_0x2256dd[_0x1d7466['name']]={'$like':'%'+_0xc46829[_0xefb3('0x44')][_0xefb3('0x4f')]+'%'};return _0x2256dd;}})});}_0x594ead=_[_0xefb3('0x50')]({},_0x594ead,_0xc46829['options']);var _0x4a4534={'where':_0x594ead[_0xefb3('0x4c')]};return db[_0xefb3('0x3f')][_0xefb3('0x32')](_0x4a4534)['then'](function(_0x28a025){_0x2e39a7[_0xefb3('0x32')]=_0x28a025;if(_0xc46829[_0xefb3('0x44')][_0xefb3('0x51')]){_0x594ead[_0xefb3('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0xefb3('0x53')](_0x594ead);})[_0xefb3('0x25')](function(_0x202ed6){_0x2e39a7[_0xefb3('0x54')]=_0x202ed6;return _0x2e39a7;})['then'](respondWithFilteredResult(_0x1f74da,_0x594ead))[_0xefb3('0x55')](handleError(_0x1f74da,null));};exports[_0xefb3('0x56')]=function(_0x303e1f,_0x2efb86){var _0x19374f={'raw':!![],'where':{'id':_0x303e1f[_0xefb3('0x57')]['id']}},_0x1a597e={};_0x1a597e[_0xefb3('0x41')]=_[_0xefb3('0x42')](db[_0xefb3('0x3f')]['rawAttributes']);_0x1a597e[_0xefb3('0x44')]=_[_0xefb3('0x42')](_0x303e1f[_0xefb3('0x44')]);_0x1a597e[_0xefb3('0x4d')]=_['intersection'](_0x1a597e['model'],_0x1a597e[_0xefb3('0x44')]);_0x19374f[_0xefb3('0x45')]=_[_0xefb3('0x43')](_0x1a597e[_0xefb3('0x41')],qs[_0xefb3('0x46')](_0x303e1f[_0xefb3('0x44')][_0xefb3('0x46')]));_0x19374f[_0xefb3('0x45')]=_0x19374f[_0xefb3('0x45')][_0xefb3('0x47')]?_0x19374f[_0xefb3('0x45')]:_0x1a597e[_0xefb3('0x41')];if(_0x303e1f[_0xefb3('0x44')]['includeAll']){_0x19374f['include']=[{'all':!![]}];}_0x19374f=_[_0xefb3('0x50')]({},_0x19374f,_0x303e1f[_0xefb3('0x58')]);return db['FaxMessage'][_0xefb3('0x59')](_0x19374f)[_0xefb3('0x25')](handleEntityNotFound(_0x2efb86,null))[_0xefb3('0x25')](respondWithResult(_0x2efb86,null))[_0xefb3('0x55')](handleError(_0x2efb86,null));};exports[_0xefb3('0x38')]=function(_0xee0b62,_0x480f8a){if(_0xee0b62[_0xefb3('0x5a')]['id']){delete _0xee0b62[_0xefb3('0x5a')]['id'];}return db[_0xefb3('0x3f')][_0xefb3('0x59')]({'where':{'id':_0xee0b62[_0xefb3('0x57')]['id']}})[_0xefb3('0x25')](handleEntityNotFound(_0x480f8a,null))[_0xefb3('0x25')](saveUpdates(_0xee0b62['body'],null))[_0xefb3('0x25')](respondWithResult(_0x480f8a,null))[_0xefb3('0x55')](handleError(_0x480f8a,null));};exports['destroy']=function(_0x359aca,_0x167faa){return db[_0xefb3('0x3f')]['find']({'where':{'id':_0x359aca['params']['id']}})['then'](handleEntityNotFound(_0x167faa,null))[_0xefb3('0x25')](removeEntity(_0x167faa,null))[_0xefb3('0x55')](handleError(_0x167faa,null));};exports['describe']=function(_0x14d042,_0x14ee1b){return db[_0xefb3('0x3f')][_0xefb3('0x5b')]()[_0xefb3('0x25')](respondWithResult(_0x14ee1b,null))[_0xefb3('0x55')](handleError(_0x14ee1b,null));};var interaction_log=require(_0xefb3('0x5c'))(_0xefb3('0x5d'));exports[_0xefb3('0x5e')]=function(_0x10c10b,_0x37b169,_0x460888){var _0xe3961f={'channel':_0xefb3('0x5f')};if(_0x10c10b['body']['id']){delete _0x10c10b[_0xefb3('0x5a')]['id'];}_0x10c10b[_0xefb3('0x5a')]['read']=!![];_0x10c10b[_0xefb3('0x5a')]['readAt']=moment()['format'](_0xefb3('0x60'));_0x10c10b[_0xefb3('0x5a')][_0xefb3('0x61')]=_0x10c10b[_0xefb3('0x5a')][_0xefb3('0x61')]||_0x10c10b['user']['id'];return db[_0xefb3('0x3f')][_0xefb3('0x59')]({'where':{'id':_0x10c10b['params']['id'],'UserId':null},'include':[{'model':db[_0xefb3('0x62')],'as':_0xefb3('0x63')}]})[_0xefb3('0x25')](handleEntityNotFound(_0x37b169,null))[_0xefb3('0x25')](saveUpdates(_0x10c10b[_0xefb3('0x5a')],null))[_0xefb3('0x25')](function(_0x2693a4){if(_0x2693a4){_0xe3961f[_0xefb3('0x2d')]=_0x2693a4[_0xefb3('0x64')]({'plain':!![]});return db['FaxInteraction'][_0xefb3('0x59')]({'where':{'id':_0x2693a4['FaxInteractionId']}});}return null;})[_0xefb3('0x25')](handleEntityNotFound(_0x37b169,null))[_0xefb3('0x25')](function(_0x1d5a82){if(_0x1d5a82){return _0x1d5a82[_0xefb3('0x38')]({'UserId':_0x10c10b[_0xefb3('0x5a')]['UserId'],'read1stAt':_[_0xefb3('0x65')](_0x1d5a82[_0xefb3('0x66')])?moment()[_0xefb3('0x67')](_0xefb3('0x60')):undefined});}return null;})[_0xefb3('0x25')](function(_0x17607b){if(_0x17607b){_0xe3961f[_0xefb3('0x68')]=_0x17607b[_0xefb3('0x64')]({'plain':!![]});interaction_log['info'](_0xefb3('0x69'),_0x10c10b['user']['id'],_0x10c10b['user'][_0xefb3('0x3b')],_0x10c10b[_0xefb3('0x6a')][_0xefb3('0x6b')],_0xe3961f['interaction']['id'],_0x10c10b[_0xefb3('0x5a')]?JSON['stringify'](_0x10c10b[_0xefb3('0x5a')]):'null');return respondWithRpcPromise(_0xefb3('0x6c'),_0xefb3('0x6d'),_0xe3961f);}return null;})[_0xefb3('0x25')](function(_0x40f9d9){if(_0x40f9d9){if(_0x10c10b['body'][_0xefb3('0x6e')]){_0xe3961f[_0xefb3('0x2d')][_0xefb3('0x6f')]=util['format'](_0xefb3('0x70'),_0x10c10b[_0xefb3('0x6a')][_0xefb3('0x3b')]);_0xe3961f[_0xefb3('0x2d')][_0xefb3('0x71')]=_0xe3961f[_0xefb3('0x71')];_0xe3961f[_0xefb3('0x2d')][_0xefb3('0x72')]=_0xefb3('0x5e');return respondWithRpcPromise(_0xefb3('0x73'),_0xefb3('0x73'),{'event':_0xefb3('0x74'),'message':_0xe3961f[_0xefb3('0x2d')]},client9002)['then'](function(){return _0xe3961f;});}return _0xe3961f;}return null;})[_0xefb3('0x25')](respondWithResult(_0x37b169,null))[_0xefb3('0x55')](handleError(_0x37b169,null));};var interaction_log=require(_0xefb3('0x5c'))('fax-interactions');exports['reject']=function(_0x5edeff,_0xf846ec,_0x846164){var _0xb25d9b={'agent':{},'channel':'fax'};if(_0x5edeff[_0xefb3('0x5a')]['id']){delete _0x5edeff[_0xefb3('0x5a')]['id'];}_0x5edeff[_0xefb3('0x5a')][_0xefb3('0x61')]=_0x5edeff['body'][_0xefb3('0x61')]||_0x5edeff[_0xefb3('0x6a')]['id'];_0xb25d9b[_0xefb3('0x75')]['id']=_0x5edeff[_0xefb3('0x5a')][_0xefb3('0x61')];return db[_0xefb3('0x3f')]['find']({'where':{'id':_0x5edeff[_0xefb3('0x57')]['id'],'UserId':null}})[_0xefb3('0x25')](handleEntityNotFound(_0xf846ec,null))[_0xefb3('0x25')](function(_0x3de176){if(_0x3de176){_0xb25d9b[_0xefb3('0x2d')]=_0x3de176[_0xefb3('0x64')]({'plain':!![]});return db['FaxInteraction'][_0xefb3('0x59')]({'where':{'id':_0x3de176[_0xefb3('0x76')]}});}return null;})[_0xefb3('0x25')](handleEntityNotFound(_0xf846ec,null))[_0xefb3('0x25')](function(_0x231df4){if(_0x231df4){_0xb25d9b[_0xefb3('0x68')]=_0x231df4[_0xefb3('0x64')]({'plain':!![]});interaction_log[_0xefb3('0x26')](_0xefb3('0x77'),_0x5edeff[_0xefb3('0x6a')]['id'],_0x5edeff[_0xefb3('0x6a')][_0xefb3('0x3b')],_0x5edeff[_0xefb3('0x6a')][_0xefb3('0x6b')],_0xb25d9b[_0xefb3('0x68')]['id'],_0x5edeff['body']?JSON['stringify'](_0x5edeff[_0xefb3('0x5a')]):_0xefb3('0x78'));return respondWithRpcPromise(_0xefb3('0x79'),_0xefb3('0x7a'),_0xb25d9b);}return null;})[_0xefb3('0x25')](function(_0x22f307){if(_0x22f307){_0x22f307[_0xefb3('0x2d')][_0xefb3('0x6f')]=util[_0xefb3('0x67')](_0xefb3('0x70'),_0x5edeff['user'][_0xefb3('0x3b')]);_0x22f307[_0xefb3('0x2d')][_0xefb3('0x71')]=_0xb25d9b[_0xefb3('0x71')];_0x22f307[_0xefb3('0x2d')]['event']=_0xefb3('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0xefb3('0x7b'),'message':_0x22f307[_0xefb3('0x2d')]},client9002);return _0xb25d9b;}return null;})['then'](respondWithResult(_0xf846ec,null))[_0xefb3('0x55')](handleError(_0xf846ec,null));};exports[_0xefb3('0x7c')]=function(_0x177622,_0x4502e6){var _0x5980d6;return db[_0xefb3('0x3f')][_0xefb3('0x7c')](_0x177622[_0xefb3('0x5a')],{})['then'](function(_0x1d3711){_0x5980d6=_0x1d3711;return db['CmContact'][_0xefb3('0x7d')]({'where':{'id':_0x5980d6[_0xefb3('0x7e')]}});})['then'](function(_0x4b9a38){if(_[_0xefb3('0x65')](_0x4b9a38)){return;}else{_0x5980d6[_0xefb3('0x5f')]=_0x4b9a38[_0xefb3('0x5f')];return db[_0xefb3('0x7f')][_0xefb3('0x7d')]({'where':{'id':_0x5980d6[_0xefb3('0x80')]}});}})[_0xefb3('0x25')](function(_0x2e6133){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xefb3('0x65')](_0x177622[_0xefb3('0x5a')])?undefined:_0x177622[_0xefb3('0x5a')]['FaxAccountId'],'path':_[_0xefb3('0x65')](_0x2e6133)?undefined:util[_0xefb3('0x67')](_0xefb3('0x81'),_0x2e6133[_0xefb3('0x82')]),'fax':_[_0xefb3('0x65')](_0x5980d6[_0xefb3('0x5f')])?undefined:_0x5980d6['fax'],'AttachmentId':_0x5980d6['AttachmentId']},client9002);})[_0xefb3('0x25')](respondWithResult(_0x4502e6,0xc9))['catch'](handleError(_0x4502e6,null));};exports['download']=function(_0x2a22d9,_0x5140f4){var _0x4f56a2=path['join'](config[_0xefb3('0x83')],_0xefb3('0x84'),_0xefb3('0x85'),_0xefb3('0x86'));return db[_0xefb3('0x3f')][_0xefb3('0x59')]({'where':{'id':_0x2a22d9['params']['id']},'include':[{'model':db['Attachment'],'as':_0xefb3('0x7f')}]})[_0xefb3('0x25')](handleEntityNotFound(_0x5140f4,null))['then'](function(_0x575a26){if(_0x575a26){return _0x5140f4[_0xefb3('0x87')](path[_0xefb3('0x88')](_0x4f56a2,_0x575a26[_0xefb3('0x7f')][_0xefb3('0x82')]));}})['catch'](handleError(_0x5140f4,null));}; \ No newline at end of file +var _0xe861=['jayson/promise','client','http','Sequelize','ValidationError','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','FaxMessage','includeAll','findAll','rows','catch','rawAttributes','include','find','body','params','describe','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','FaxInteraction','FaxInteractionId','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','manual','interface','channel','event','accept','EventManager','acceptmessage','fax-interactions','reject','agent','RejectMessage','rejectMessage','SIP/%s','create','findOne','ContactId','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','join','root','server','attachments','download','basename','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe861,0x1f3));var _0x1e86=function(_0x17d000,_0x104e8e){_0x17d000=_0x17d000-0x0;var _0x4d5cc9=_0xe861[_0x17d000];return _0x4d5cc9;};'use strict';var pdf=require(_0x1e86('0x0'));var emlformat=require(_0x1e86('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e86('0x2'));var jsonpatch=require(_0x1e86('0x3'));var rp=require(_0x1e86('0x4'));var moment=require(_0x1e86('0x5'));var BPromise=require(_0x1e86('0x6'));var Mustache=require(_0x1e86('0x7'));var util=require(_0x1e86('0x8'));var path=require(_0x1e86('0x9'));var sox=require('sox');var csv=require(_0x1e86('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1e86('0xb'));var squel=require(_0x1e86('0xc'));var crypto=require('crypto');var jsforce=require(_0x1e86('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1e86('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1e86('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1e86('0xf'));var hardwareService=require(_0x1e86('0x10'));var logger=require(_0x1e86('0x11'))('api');var utils=require(_0x1e86('0x12'));var config=require('../../config/environment');var db=require(_0x1e86('0x13'))['db'];config[_0x1e86('0x14')]=_[_0x1e86('0x15')](config[_0x1e86('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e86('0x16'))(new Redis(config[_0x1e86('0x14')]));require(_0x1e86('0x17'))[_0x1e86('0x18')](socket);var jayson=require(_0x1e86('0x19'));var client=jayson[_0x1e86('0x1a')][_0x1e86('0x1b')]({'port':0x232c});var client9002=jayson[_0x1e86('0x1a')][_0x1e86('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3f8aa5,_0x25e9fa,_0x2c96fe){if(_0x2c96fe){var _0x7bc1e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7bc1e8['test'](_0x25e9fa)){return _0x3f8aa5;}else{throw new db[(_0x1e86('0x1c'))][(_0x1e86('0x1d'))]('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 _0x3f8aa5;}}function respondWithRpcPromise(_0x32de7f,_0x227eb9,_0x51dea4,_0x507574){return new BPromise(function(_0x50e827,_0x161819){var _0x433ec4=_0x507574||client;return _0x433ec4[_0x1e86('0x1e')](_0x32de7f,_0x51dea4)['then'](function(_0x55b263){logger[_0x1e86('0x1f')](_0x1e86('0x20'),_0x227eb9,_0x1e86('0x21'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x227eb9,_0x1e86('0x21'),JSON[_0x1e86('0x22')](_0x55b263));if(_0x55b263[_0x1e86('0x23')]){if(_0x55b263[_0x1e86('0x23')]['code']===0x1f4){logger['error'](_0x1e86('0x20'),_0x227eb9,_0x55b263[_0x1e86('0x23')]['message']);return _0x161819(_0x55b263['error'][_0x1e86('0x24')]);}logger[_0x1e86('0x23')](_0x1e86('0x20'),_0x227eb9,_0x55b263[_0x1e86('0x23')][_0x1e86('0x24')]);return _0x50e827(_0x55b263[_0x1e86('0x23')][_0x1e86('0x24')]);}else{logger[_0x1e86('0x1f')](_0x1e86('0x20'),_0x227eb9,_0x1e86('0x21'));_0x50e827(_0x55b263[_0x1e86('0x25')][_0x1e86('0x24')]);}})['catch'](function(_0x2475c3){logger['error'](_0x1e86('0x20'),_0x227eb9,_0x2475c3);_0x161819(_0x2475c3);});});}function respondWithStatusCode(_0x3e7574,_0x540f81){_0x540f81=_0x540f81||0xcc;return function(_0x436ff6){if(_0x436ff6){return _0x3e7574[_0x1e86('0x26')](_0x540f81);}return _0x3e7574['status'](_0x540f81)['end']();};}function respondWithResult(_0x16b1ee,_0x1da9c4){_0x1da9c4=_0x1da9c4||0xc8;return function(_0x32ec70){if(_0x32ec70){return _0x16b1ee[_0x1e86('0x27')](_0x1da9c4)[_0x1e86('0x28')](_0x32ec70);}};}function respondWithFilteredResult(_0x2de231,_0x54dcc5){return function(_0x31745d){if(_0x31745d){var _0x3b4b1b=_0x31745d[_0x1e86('0x29')],_0x56bcc3=_0x54dcc5[_0x1e86('0x2a')],_0x1103bf=_0x54dcc5['offset']+_0x54dcc5[_0x1e86('0x2b')],_0x17645e;if(_0x1103bf>=_0x3b4b1b){_0x1103bf=_0x3b4b1b;_0x17645e=0xc8;}else{_0x17645e=0xce;}_0x2de231[_0x1e86('0x27')](_0x17645e);return _0x2de231[_0x1e86('0x2c')](_0x1e86('0x2d'),_0x56bcc3+'-'+_0x1103bf+'/'+_0x3b4b1b)['json'](_0x31745d);}return null;};}function patchUpdates(_0x9329c7){return function(_0x3d6627){try{jsonpatch[_0x1e86('0x2e')](_0x3d6627,_0x9329c7,!![]);}catch(_0x1a4dc1){return BPromise['reject'](_0x1a4dc1);}return _0x3d6627[_0x1e86('0x2f')]();};}function saveUpdates(_0x3d62bc,_0x2558c8){return function(_0x1c299d){if(_0x1c299d){return _0x1c299d[_0x1e86('0x30')](_0x3d62bc)[_0x1e86('0x31')](function(_0x5afb15){return _0x5afb15;});}return null;};}function removeEntity(_0x469560,_0xc9384a){return function(_0x1c3be0){if(_0x1c3be0){return _0x1c3be0[_0x1e86('0x32')]()[_0x1e86('0x31')](function(){_0x469560[_0x1e86('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e87ca,_0x55c575){return function(_0x420f66){if(!_0x420f66){_0x5e87ca[_0x1e86('0x26')](0x194);}return _0x420f66;};}function handleError(_0x307bb0,_0x2f4565){_0x2f4565=_0x2f4565||0x1f4;return function(_0x269130){logger['error'](_0x269130['stack']);if(_0x269130[_0x1e86('0x33')]){delete _0x269130[_0x1e86('0x33')];}_0x307bb0[_0x1e86('0x27')](_0x2f4565)[_0x1e86('0x34')](_0x269130);};}exports[_0x1e86('0x35')]=function(_0x13265a,_0x463b12){var _0x5c23b9={},_0x1126ee={},_0x4c04be={'count':0x0,'rows':[]};var _0x5a0a99=_['map'](db['FaxMessage']['rawAttributes'],function(_0x422b9f){return{'name':_0x422b9f[_0x1e86('0x36')],'type':_0x422b9f[_0x1e86('0x37')][_0x1e86('0x38')]};});_0x1126ee[_0x1e86('0x39')]=_[_0x1e86('0x3a')](_0x5a0a99,_0x1e86('0x33'));_0x1126ee['query']=_[_0x1e86('0x3b')](_0x13265a[_0x1e86('0x3c')]);_0x1126ee['filters']=_['intersection'](_0x1126ee[_0x1e86('0x39')],_0x1126ee['query']);_0x5c23b9[_0x1e86('0x3d')]=_[_0x1e86('0x3e')](_0x1126ee[_0x1e86('0x39')],qs[_0x1e86('0x3f')](_0x13265a['query'][_0x1e86('0x3f')]));_0x5c23b9[_0x1e86('0x3d')]=_0x5c23b9[_0x1e86('0x3d')][_0x1e86('0x40')]?_0x5c23b9[_0x1e86('0x3d')]:_0x1126ee[_0x1e86('0x39')];if(!_0x13265a['query'][_0x1e86('0x41')]('nolimit')){_0x5c23b9['limit']=qs[_0x1e86('0x2b')](_0x13265a[_0x1e86('0x3c')][_0x1e86('0x2b')]);_0x5c23b9[_0x1e86('0x2a')]=qs[_0x1e86('0x2a')](_0x13265a[_0x1e86('0x3c')][_0x1e86('0x2a')]);}_0x5c23b9[_0x1e86('0x42')]=qs[_0x1e86('0x43')](_0x13265a[_0x1e86('0x3c')]['sort']);_0x5c23b9[_0x1e86('0x44')]=qs[_0x1e86('0x45')](_[_0x1e86('0x46')](_0x13265a['query'],_0x1126ee['filters']),_0x5a0a99);if(_0x13265a[_0x1e86('0x3c')]['filter']){_0x5c23b9['where']=_['merge'](_0x5c23b9[_0x1e86('0x44')],{'$or':_['map'](_0x5a0a99,function(_0x5c9b21){if(_0x5c9b21[_0x1e86('0x37')]!==_0x1e86('0x47')){var _0xd6e2a7={};_0xd6e2a7[_0x5c9b21['name']]={'$like':'%'+_0x13265a[_0x1e86('0x3c')][_0x1e86('0x48')]+'%'};return _0xd6e2a7;}})});}_0x5c23b9=_[_0x1e86('0x49')]({},_0x5c23b9,_0x13265a[_0x1e86('0x4a')]);var _0x3855a2={'where':_0x5c23b9[_0x1e86('0x44')]};return db[_0x1e86('0x4b')][_0x1e86('0x29')](_0x3855a2)[_0x1e86('0x31')](function(_0x3d2ba7){_0x4c04be['count']=_0x3d2ba7;if(_0x13265a[_0x1e86('0x3c')][_0x1e86('0x4c')]){_0x5c23b9['include']=[{'all':!![]}];}return db[_0x1e86('0x4b')][_0x1e86('0x4d')](_0x5c23b9);})[_0x1e86('0x31')](function(_0x50b029){_0x4c04be[_0x1e86('0x4e')]=_0x50b029;return _0x4c04be;})[_0x1e86('0x31')](respondWithFilteredResult(_0x463b12,_0x5c23b9))[_0x1e86('0x4f')](handleError(_0x463b12,null));};exports['show']=function(_0x235bbe,_0x1d79d4){var _0x242d3c={'raw':!![],'where':{'id':_0x235bbe['params']['id']}},_0xc3beac={};_0xc3beac['model']=_['keys'](db[_0x1e86('0x4b')][_0x1e86('0x50')]);_0xc3beac[_0x1e86('0x3c')]=_[_0x1e86('0x3b')](_0x235bbe['query']);_0xc3beac[_0x1e86('0x45')]=_['intersection'](_0xc3beac[_0x1e86('0x39')],_0xc3beac[_0x1e86('0x3c')]);_0x242d3c['attributes']=_[_0x1e86('0x3e')](_0xc3beac[_0x1e86('0x39')],qs[_0x1e86('0x3f')](_0x235bbe[_0x1e86('0x3c')][_0x1e86('0x3f')]));_0x242d3c['attributes']=_0x242d3c[_0x1e86('0x3d')][_0x1e86('0x40')]?_0x242d3c[_0x1e86('0x3d')]:_0xc3beac[_0x1e86('0x39')];if(_0x235bbe['query'][_0x1e86('0x4c')]){_0x242d3c[_0x1e86('0x51')]=[{'all':!![]}];}_0x242d3c=_[_0x1e86('0x49')]({},_0x242d3c,_0x235bbe[_0x1e86('0x4a')]);return db[_0x1e86('0x4b')][_0x1e86('0x52')](_0x242d3c)[_0x1e86('0x31')](handleEntityNotFound(_0x1d79d4,null))[_0x1e86('0x31')](respondWithResult(_0x1d79d4,null))['catch'](handleError(_0x1d79d4,null));};exports[_0x1e86('0x30')]=function(_0x1162ca,_0x51cb95){if(_0x1162ca[_0x1e86('0x53')]['id']){delete _0x1162ca['body']['id'];}return db[_0x1e86('0x4b')][_0x1e86('0x52')]({'where':{'id':_0x1162ca[_0x1e86('0x54')]['id']}})[_0x1e86('0x31')](handleEntityNotFound(_0x51cb95,null))[_0x1e86('0x31')](saveUpdates(_0x1162ca[_0x1e86('0x53')],null))[_0x1e86('0x31')](respondWithResult(_0x51cb95,null))[_0x1e86('0x4f')](handleError(_0x51cb95,null));};exports[_0x1e86('0x32')]=function(_0x215c69,_0xf13028){return db['FaxMessage'][_0x1e86('0x52')]({'where':{'id':_0x215c69[_0x1e86('0x54')]['id']}})[_0x1e86('0x31')](handleEntityNotFound(_0xf13028,null))['then'](removeEntity(_0xf13028,null))[_0x1e86('0x4f')](handleError(_0xf13028,null));};exports['describe']=function(_0x582b68,_0x4cf7c7){return db[_0x1e86('0x4b')][_0x1e86('0x55')]()['then'](respondWithResult(_0x4cf7c7,null))['catch'](handleError(_0x4cf7c7,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['accept']=function(_0x2fc25a,_0x95601a,_0x2ef2a2){var _0x51b22f={'channel':_0x1e86('0x56')};if(_0x2fc25a[_0x1e86('0x53')]['id']){delete _0x2fc25a[_0x1e86('0x53')]['id'];}_0x2fc25a[_0x1e86('0x53')][_0x1e86('0x57')]=!![];_0x2fc25a[_0x1e86('0x53')][_0x1e86('0x58')]=moment()[_0x1e86('0x59')](_0x1e86('0x5a'));_0x2fc25a[_0x1e86('0x53')][_0x1e86('0x5b')]=_0x2fc25a[_0x1e86('0x53')][_0x1e86('0x5b')]||_0x2fc25a[_0x1e86('0x5c')]['id'];return db[_0x1e86('0x4b')][_0x1e86('0x52')]({'where':{'id':_0x2fc25a[_0x1e86('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x1e86('0x5d')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x95601a,null))[_0x1e86('0x31')](saveUpdates(_0x2fc25a['body'],null))[_0x1e86('0x31')](function(_0x439b64){if(_0x439b64){_0x51b22f[_0x1e86('0x24')]=_0x439b64['get']({'plain':!![]});return db[_0x1e86('0x5e')]['find']({'where':{'id':_0x439b64[_0x1e86('0x5f')]}});}return null;})[_0x1e86('0x31')](handleEntityNotFound(_0x95601a,null))[_0x1e86('0x31')](function(_0xa3061d){if(_0xa3061d){return _0xa3061d[_0x1e86('0x30')]({'UserId':_0x2fc25a[_0x1e86('0x53')][_0x1e86('0x5b')],'read1stAt':_['isNil'](_0xa3061d[_0x1e86('0x60')])?moment()[_0x1e86('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x511e9b){if(_0x511e9b){_0x51b22f['interaction']=_0x511e9b[_0x1e86('0x61')]({'plain':!![]});interaction_log['info'](_0x1e86('0x62'),_0x2fc25a[_0x1e86('0x5c')]['id'],_0x2fc25a[_0x1e86('0x5c')][_0x1e86('0x33')],_0x2fc25a[_0x1e86('0x5c')][_0x1e86('0x63')],_0x51b22f[_0x1e86('0x64')]['id'],_0x2fc25a[_0x1e86('0x53')]?JSON[_0x1e86('0x22')](_0x2fc25a[_0x1e86('0x53')]):_0x1e86('0x65'));return respondWithRpcPromise('AcceptMessage',_0x1e86('0x66'),_0x51b22f);}return null;})[_0x1e86('0x31')](function(_0x2a5575){if(_0x2a5575){if(_0x2fc25a[_0x1e86('0x53')][_0x1e86('0x67')]){_0x51b22f[_0x1e86('0x24')][_0x1e86('0x68')]=util[_0x1e86('0x59')]('SIP/%s',_0x2fc25a[_0x1e86('0x5c')][_0x1e86('0x33')]);_0x51b22f[_0x1e86('0x24')][_0x1e86('0x69')]=_0x51b22f['channel'];_0x51b22f[_0x1e86('0x24')][_0x1e86('0x6a')]=_0x1e86('0x6b');return respondWithRpcPromise(_0x1e86('0x6c'),_0x1e86('0x6c'),{'event':_0x1e86('0x6d'),'message':_0x51b22f[_0x1e86('0x24')]},client9002)[_0x1e86('0x31')](function(){return _0x51b22f;});}return _0x51b22f;}return null;})['then'](respondWithResult(_0x95601a,null))[_0x1e86('0x4f')](handleError(_0x95601a,null));};var interaction_log=require('../../config/logger')(_0x1e86('0x6e'));exports[_0x1e86('0x6f')]=function(_0x22e94f,_0x396f27,_0xaee588){var _0x342956={'agent':{},'channel':_0x1e86('0x56')};if(_0x22e94f[_0x1e86('0x53')]['id']){delete _0x22e94f[_0x1e86('0x53')]['id'];}_0x22e94f[_0x1e86('0x53')][_0x1e86('0x5b')]=_0x22e94f[_0x1e86('0x53')][_0x1e86('0x5b')]||_0x22e94f['user']['id'];_0x342956[_0x1e86('0x70')]['id']=_0x22e94f['body']['UserId'];return db['FaxMessage'][_0x1e86('0x52')]({'where':{'id':_0x22e94f['params']['id'],'UserId':null}})[_0x1e86('0x31')](handleEntityNotFound(_0x396f27,null))[_0x1e86('0x31')](function(_0x1b1d0c){if(_0x1b1d0c){_0x342956[_0x1e86('0x24')]=_0x1b1d0c[_0x1e86('0x61')]({'plain':!![]});return db[_0x1e86('0x5e')][_0x1e86('0x52')]({'where':{'id':_0x1b1d0c[_0x1e86('0x5f')]}});}return null;})[_0x1e86('0x31')](handleEntityNotFound(_0x396f27,null))['then'](function(_0x53af97){if(_0x53af97){_0x342956[_0x1e86('0x64')]=_0x53af97[_0x1e86('0x61')]({'plain':!![]});interaction_log[_0x1e86('0x1f')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22e94f[_0x1e86('0x5c')]['id'],_0x22e94f[_0x1e86('0x5c')][_0x1e86('0x33')],_0x22e94f['user'][_0x1e86('0x63')],_0x342956['interaction']['id'],_0x22e94f[_0x1e86('0x53')]?JSON[_0x1e86('0x22')](_0x22e94f[_0x1e86('0x53')]):_0x1e86('0x65'));return respondWithRpcPromise(_0x1e86('0x71'),_0x1e86('0x72'),_0x342956);}return null;})[_0x1e86('0x31')](function(_0x18e522){if(_0x18e522){_0x18e522[_0x1e86('0x24')][_0x1e86('0x68')]=util[_0x1e86('0x59')](_0x1e86('0x73'),_0x22e94f['user'][_0x1e86('0x33')]);_0x18e522[_0x1e86('0x24')][_0x1e86('0x69')]=_0x342956['channel'];_0x18e522[_0x1e86('0x24')]['event']=_0x1e86('0x6f');respondWithRpcPromise('EventManager',_0x1e86('0x6c'),{'event':'rejectmessage','message':_0x18e522[_0x1e86('0x24')]},client9002);return _0x342956;}return null;})[_0x1e86('0x31')](respondWithResult(_0x396f27,null))[_0x1e86('0x4f')](handleError(_0x396f27,null));};exports['create']=function(_0x2e84d2,_0x359320){var _0x4ae3ae;return db[_0x1e86('0x4b')][_0x1e86('0x74')](_0x2e84d2['body'],{})[_0x1e86('0x31')](function(_0x28242f){_0x4ae3ae=_0x28242f;return db[_0x1e86('0x5d')][_0x1e86('0x75')]({'where':{'id':_0x4ae3ae[_0x1e86('0x76')]}});})[_0x1e86('0x31')](function(_0x5ea923){if(_[_0x1e86('0x77')](_0x5ea923)){return;}else{_0x4ae3ae[_0x1e86('0x56')]=_0x5ea923[_0x1e86('0x56')];return db[_0x1e86('0x78')][_0x1e86('0x75')]({'where':{'id':_0x4ae3ae[_0x1e86('0x79')]}});}})['then'](function(_0x324973){return respondWithRpcPromise('SendFax',_0x1e86('0x7a'),{'FaxAccountId':_[_0x1e86('0x77')](_0x2e84d2['body'])?undefined:_0x2e84d2[_0x1e86('0x53')][_0x1e86('0x7b')],'path':_['isNil'](_0x324973)?undefined:util['format'](_0x1e86('0x7c'),_0x324973['basename']),'fax':_[_0x1e86('0x77')](_0x4ae3ae[_0x1e86('0x56')])?undefined:_0x4ae3ae[_0x1e86('0x56')],'AttachmentId':_0x4ae3ae[_0x1e86('0x79')]},client9002);})[_0x1e86('0x31')](respondWithResult(_0x359320,0xc9))[_0x1e86('0x4f')](handleError(_0x359320,null));};exports['download']=function(_0x12e975,_0x28d88b){var _0x578660=path[_0x1e86('0x7d')](config[_0x1e86('0x7e')],_0x1e86('0x7f'),'files',_0x1e86('0x80'));return db[_0x1e86('0x4b')]['find']({'where':{'id':_0x12e975[_0x1e86('0x54')]['id']},'include':[{'model':db[_0x1e86('0x78')],'as':_0x1e86('0x78')}]})[_0x1e86('0x31')](handleEntityNotFound(_0x28d88b,null))[_0x1e86('0x31')](function(_0x261fd8){if(_0x261fd8){return _0x28d88b[_0x1e86('0x81')](path[_0x1e86('0x7d')](_0x578660,_0x261fd8[_0x1e86('0x78')][_0x1e86('0x82')]));}})['catch'](handleError(_0x28d88b,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index dccabb6..409e602 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 _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x1519a9,_0x2a210e){_0x1519a9=_0x1519a9-0x0;var _0x16604e=_0x3e74[_0x1519a9];return _0x16604e;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x2131f2,_0x2a190c){var _0x5a9475=function(_0x19dc3a){while(--_0x19dc3a){_0x2131f2['push'](_0x2131f2['shift']());}};_0x5a9475(++_0x2a190c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e992145..a01e925 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 _0xb50e=['FULLTEXT','models','toLowerCase','direction','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','define','body'];(function(_0x1a2a4c,_0x177909){var _0x4e0d5b=function(_0x132e1b){while(--_0x132e1b){_0x1a2a4c['push'](_0x1a2a4c['shift']());}};_0x4e0d5b(++_0x177909);}(_0xb50e,0xb5));var _0xeb50=function(_0x4ef8bc,_0x5eb00d){_0x4ef8bc=_0x4ef8bc-0x0;var _0x5d4d56=_0xb50e[_0x4ef8bc];return _0x5d4d56;};'use strict';var _=require('lodash');var util=require(_0xeb50('0x0'));var logger=require(_0xeb50('0x1'))(_0xeb50('0x2'));var moment=require(_0xeb50('0x3'));var BPromise=require(_0xeb50('0x4'));var rp=require(_0xeb50('0x5'));var fs=require('fs');var path=require(_0xeb50('0x6'));var rimraf=require(_0xeb50('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb50('0x8'));module['exports']=function(_0x44ba26,_0x394077){return _0x44ba26[_0xeb50('0x9')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xeb50('0xa')],'type':_0xeb50('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f429c,_0x95b494,_0x2597f3){var _0x5b9965=_0x44ba26[_0xeb50('0xc')];var _0x50a1a9=_0x5f429c['get']({'plain':!![]});if(_0x50a1a9['direction'][_0xeb50('0xd')]()==='in'||_0x50a1a9[_0xeb50('0xe')][_0xeb50('0xd')]()===_0xeb50('0xf')&&!_0x50a1a9['secret']&&!_[_0xeb50('0x10')](_0x50a1a9[_0xeb50('0x11')])){_0x5b9965[_0xeb50('0x12')][_0xeb50('0x13')]({'where':{'id':_0x50a1a9[_0xeb50('0x14')]}})[_0xeb50('0x15')](function(_0x914922){if(_0x914922){_0x914922['update']({'lastMsgAt':_0x50a1a9[_0xeb50('0x16')],'lastMsgDirection':_0x50a1a9[_0xeb50('0xe')][_0xeb50('0xd')]()});}})[_0xeb50('0x17')](function(_0x5a33ed){console['error'](_0x5a33ed);});}_0x2597f3();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6657=['bluebird','path','rimraf','define','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','FaxInteractionId','then','createdAt','catch','util','../../config/logger','api','moment'];(function(_0x4a921d,_0x519aa8){var _0x470ebb=function(_0x33ce6c){while(--_0x33ce6c){_0x4a921d['push'](_0x4a921d['shift']());}};_0x470ebb(++_0x519aa8);}(_0x6657,0x164));var _0x7665=function(_0x15182d,_0x1f4cfc){_0x15182d=_0x15182d-0x0;var _0x255b75=_0x6657[_0x15182d];return _0x255b75;};'use strict';var _=require('lodash');var util=require(_0x7665('0x0'));var logger=require(_0x7665('0x1'))(_0x7665('0x2'));var moment=require(_0x7665('0x3'));var BPromise=require(_0x7665('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7665('0x5'));var rimraf=require(_0x7665('0x6'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0x1cbb6a,_0x3f8866){return _0x1cbb6a[_0x7665('0x7')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x7665('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c0d7b,_0x460996,_0x4bf427){var _0x3675e4=_0x1cbb6a[_0x7665('0x9')];var _0x2ab362=_0x1c0d7b[_0x7665('0xa')]({'plain':!![]});if(_0x2ab362['direction'][_0x7665('0xb')]()==='in'||_0x2ab362[_0x7665('0xc')][_0x7665('0xb')]()===_0x7665('0xd')&&!_0x2ab362[_0x7665('0xe')]&&!_['isNil'](_0x2ab362[_0x7665('0xf')])){_0x3675e4['FaxInteraction']['findOne']({'where':{'id':_0x2ab362[_0x7665('0x10')]}})[_0x7665('0x11')](function(_0x466353){if(_0x466353){_0x466353['update']({'lastMsgAt':_0x2ab362[_0x7665('0x12')],'lastMsgDirection':_0x2ab362[_0x7665('0xc')]['toLowerCase']()});}})[_0x7665('0x13')](function(_0x5bcba5){console['error'](_0x5bcba5);});}_0x4bf427();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 01111e2..fb7eb56 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 _0x077f=['FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0xa5da45,_0x1616d2){var _0x25cc70=function(_0x41e4af){while(--_0x41e4af){_0xa5da45['push'](_0xa5da45['shift']());}};_0x25cc70(++_0x1616d2);}(_0x077f,0x64));var _0xf077=function(_0x53bf49,_0x14f488){_0x53bf49=_0x53bf49-0x0;var _0x349b21=_0x077f[_0x53bf49];return _0x349b21;};'use strict';var _=require(_0xf077('0x0'));var util=require(_0xf077('0x1'));var moment=require('moment');var BPromise=require(_0xf077('0x2'));var rs=require(_0xf077('0x3'));var fs=require('fs');var Redis=require(_0xf077('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf077('0x5'));var logger=require(_0xf077('0x6'))(_0xf077('0x7'));var config=require(_0xf077('0x8'));var jayson=require(_0xf077('0x9'));var client=jayson[_0xf077('0xa')][_0xf077('0xb')]({'port':0x232a});config[_0xf077('0xc')]=_[_0xf077('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf077('0xe'))(new Redis(config[_0xf077('0xc')]));require(_0xf077('0xf'))[_0xf077('0x10')](socket);function respondWithRpcPromise(_0x3e1b87,_0x3e98dc,_0x6546e6){return new BPromise(function(_0x3b0f7e,_0x33659c){return client[_0xf077('0x11')](_0x3e1b87,_0x6546e6)[_0xf077('0x12')](function(_0x4ce6cf){logger[_0xf077('0x13')](_0xf077('0x14'),_0x3e98dc,'request\x20sent');logger[_0xf077('0x15')](_0xf077('0x16'),_0x3e98dc,_0xf077('0x17'),JSON[_0xf077('0x18')](_0x4ce6cf));if(_0x4ce6cf[_0xf077('0x19')]){if(_0x4ce6cf[_0xf077('0x19')][_0xf077('0x1a')]===0x1f4){logger[_0xf077('0x19')](_0xf077('0x14'),_0x3e98dc,_0x4ce6cf[_0xf077('0x19')][_0xf077('0x1b')]);return _0x33659c(_0x4ce6cf[_0xf077('0x19')][_0xf077('0x1b')]);}logger[_0xf077('0x19')]('FaxMessage,\x20%s,\x20%s',_0x3e98dc,_0x4ce6cf[_0xf077('0x19')]['message']);return _0x3b0f7e(_0x4ce6cf[_0xf077('0x19')]['message']);}else{logger[_0xf077('0x13')]('FaxMessage,\x20%s,\x20%s',_0x3e98dc,_0xf077('0x17'));_0x3b0f7e(_0x4ce6cf[_0xf077('0x1c')]['message']);}})[_0xf077('0x1d')](function(_0x59d838){logger[_0xf077('0x19')](_0xf077('0x14'),_0x3e98dc,_0x59d838);_0x33659c(_0x59d838);});});}exports[_0xf077('0x1e')]=function(_0x1b9a22){var _0x55b1d6=this;return new Promise(function(_0x36f488,_0x3cfecd){return db[_0xf077('0x1f')][_0xf077('0x20')](_0x1b9a22[_0xf077('0x21')],{'raw':_0x1b9a22[_0xf077('0x22')]?_0x1b9a22[_0xf077('0x22')][_0xf077('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0xd389d4){logger[_0xf077('0x13')](_0xf077('0x1e'),_0x1b9a22);logger[_0xf077('0x15')](_0xf077('0x1e'),_0x1b9a22,JSON[_0xf077('0x18')](_0xd389d4));_0x36f488(_0xd389d4);})[_0xf077('0x1d')](function(_0x187afc){logger[_0xf077('0x19')](_0xf077('0x1e'),_0x187afc['message'],_0x1b9a22);_0x3cfecd(_0x55b1d6['error'](0x1f4,_0x187afc[_0xf077('0x1b')]));});});};exports[_0xf077('0x24')]=function(_0xb68b2){var _0x1ec7dd=this;return new Promise(function(_0x56fe0a,_0x78c64c){return db[_0xf077('0x1f')][_0xf077('0x25')](_0xb68b2[_0xf077('0x21')],{'raw':_0xb68b2['options']?_0xb68b2['options'][_0xf077('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb68b2['options']?_0xb68b2[_0xf077('0x22')][_0xf077('0x26')]||null:null,'attributes':_0xb68b2['options']?_0xb68b2[_0xf077('0x22')]['attributes']||null:null,'limit':_0xb68b2[_0xf077('0x22')]?_0xb68b2['options'][_0xf077('0x27')]||null:null})['then'](function(_0x4e144d){logger['info']('UpdateFaxMessage',_0xb68b2);logger['debug'](_0xf077('0x24'),_0xb68b2,JSON[_0xf077('0x18')](_0x4e144d));_0x56fe0a(_0x4e144d);})[_0xf077('0x1d')](function(_0x26d21b){logger['error'](_0xf077('0x24'),_0x26d21b[_0xf077('0x1b')],_0xb68b2);_0x78c64c(_0x1ec7dd[_0xf077('0x19')](0x1f4,_0x26d21b[_0xf077('0x1b')]));});});}; \ No newline at end of file +var _0xd596=['where','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','UpdateFaxMessage','update'];(function(_0x5974d3,_0x286c95){var _0x4bd6f8=function(_0xc27f84){while(--_0xc27f84){_0x5974d3['push'](_0x5974d3['shift']());}};_0x4bd6f8(++_0x286c95);}(_0xd596,0x199));var _0x6d59=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xd596[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require(_0x6d59('0x0'));var util=require(_0x6d59('0x1'));var moment=require('moment');var BPromise=require(_0x6d59('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d59('0x3'));var db=require(_0x6d59('0x4'))['db'];var utils=require(_0x6d59('0x5'));var logger=require(_0x6d59('0x6'))(_0x6d59('0x7'));var config=require(_0x6d59('0x8'));var jayson=require(_0x6d59('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x6d59('0xa')]=_[_0x6d59('0xb')](config[_0x6d59('0xa')],{'host':_0x6d59('0xc'),'port':0x18eb});var socket=require(_0x6d59('0xd'))(new Redis(config[_0x6d59('0xa')]));require(_0x6d59('0xe'))[_0x6d59('0xf')](socket);function respondWithRpcPromise(_0x1c0570,_0x54d123,_0x3d4ee9){return new BPromise(function(_0x128ca3,_0x2bccdc){return client['request'](_0x1c0570,_0x3d4ee9)[_0x6d59('0x10')](function(_0x29c859){logger['info'](_0x6d59('0x11'),_0x54d123,_0x6d59('0x12'));logger[_0x6d59('0x13')](_0x6d59('0x14'),_0x54d123,_0x6d59('0x12'),JSON[_0x6d59('0x15')](_0x29c859));if(_0x29c859[_0x6d59('0x16')]){if(_0x29c859[_0x6d59('0x16')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x54d123,_0x29c859[_0x6d59('0x16')]['message']);return _0x2bccdc(_0x29c859[_0x6d59('0x16')][_0x6d59('0x17')]);}logger[_0x6d59('0x16')](_0x6d59('0x11'),_0x54d123,_0x29c859[_0x6d59('0x16')]['message']);return _0x128ca3(_0x29c859['error'][_0x6d59('0x17')]);}else{logger[_0x6d59('0x18')](_0x6d59('0x11'),_0x54d123,'request\x20sent');_0x128ca3(_0x29c859[_0x6d59('0x19')][_0x6d59('0x17')]);}})['catch'](function(_0x337e85){logger[_0x6d59('0x16')]('FaxMessage,\x20%s,\x20%s',_0x54d123,_0x337e85);_0x2bccdc(_0x337e85);});});}exports[_0x6d59('0x1a')]=function(_0x1b0648){var _0x2652ca=this;return new Promise(function(_0x216a83,_0x31b237){return db[_0x6d59('0x1b')][_0x6d59('0x1c')](_0x1b0648[_0x6d59('0x1d')],{'raw':_0x1b0648[_0x6d59('0x1e')]?_0x1b0648[_0x6d59('0x1e')][_0x6d59('0x1f')]===undefined?!![]:![]:!![]})[_0x6d59('0x10')](function(_0x34db7d){logger['info'](_0x6d59('0x1a'),_0x1b0648);logger[_0x6d59('0x13')](_0x6d59('0x1a'),_0x1b0648,JSON['stringify'](_0x34db7d));_0x216a83(_0x34db7d);})[_0x6d59('0x20')](function(_0xb5e377){logger['error'](_0x6d59('0x1a'),_0xb5e377[_0x6d59('0x17')],_0x1b0648);_0x31b237(_0x2652ca[_0x6d59('0x16')](0x1f4,_0xb5e377['message']));});});};exports[_0x6d59('0x21')]=function(_0x19d683){var _0x2a0fc1=this;return new Promise(function(_0x1bac13,_0x1d1ec7){return db[_0x6d59('0x1b')][_0x6d59('0x22')](_0x19d683['body'],{'raw':_0x19d683[_0x6d59('0x1e')]?_0x19d683[_0x6d59('0x1e')][_0x6d59('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d683[_0x6d59('0x1e')]?_0x19d683[_0x6d59('0x1e')][_0x6d59('0x23')]||null:null,'attributes':_0x19d683['options']?_0x19d683[_0x6d59('0x1e')]['attributes']||null:null,'limit':_0x19d683[_0x6d59('0x1e')]?_0x19d683[_0x6d59('0x1e')][_0x6d59('0x24')]||null:null})[_0x6d59('0x10')](function(_0x4b3b65){logger[_0x6d59('0x18')](_0x6d59('0x21'),_0x19d683);logger['debug'](_0x6d59('0x21'),_0x19d683,JSON['stringify'](_0x4b3b65));_0x1bac13(_0x4b3b65);})[_0x6d59('0x20')](function(_0x4ec179){logger['error']('UpdateFaxMessage',_0x4ec179[_0x6d59('0x17')],_0x19d683);_0x1d1ec7(_0x2a0fc1['error'](0x1f4,_0x4ec179['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 6e947bb..23cab17 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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 11c503d..20f576c 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 _0x9d1f=['multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxMessage.controller','get','index','isAuthenticated','describe','show','download','post','fax','faxmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x4b946d,_0x104c6e){var _0x5dab4a=function(_0x1b3c8b){while(--_0x1b3c8b){_0x4b946d['push'](_0x4b946d['shift']());}};_0x5dab4a(++_0x104c6e);}(_0x9d1f,0x1a9));var _0xf9d1=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x9d1f[_0x109371];return _0x4fd858;};'use strict';var multer=require(_0xf9d1('0x0'));var util=require('util');var path=require(_0xf9d1('0x1'));var timeout=require(_0xf9d1('0x2'));var express=require(_0xf9d1('0x3'));var router=express['Router']();var auth=require(_0xf9d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf9d1('0x5'));var controller=require(_0xf9d1('0x6'));router[_0xf9d1('0x7')]('/',auth['isAuthenticated'](),controller[_0xf9d1('0x8')]);router[_0xf9d1('0x7')]('/describe',auth[_0xf9d1('0x9')](),controller[_0xf9d1('0xa')]);router[_0xf9d1('0x7')]('/:id',auth[_0xf9d1('0x9')](),controller[_0xf9d1('0xb')]);router[_0xf9d1('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xf9d1('0xc')]);router[_0xf9d1('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xf9d1('0xe'),_0xf9d1('0xf')),controller[_0xf9d1('0x10')]);router[_0xf9d1('0x11')]('/:id',auth[_0xf9d1('0x9')](),controller['update']);router[_0xf9d1('0x11')](_0xf9d1('0x12'),auth['isAuthenticated'](),controller[_0xf9d1('0x13')]);router[_0xf9d1('0x11')](_0xf9d1('0x14'),auth[_0xf9d1('0x9')](),controller[_0xf9d1('0x15')]);router[_0xf9d1('0x16')]('/:id',auth[_0xf9d1('0x9')](),controller[_0xf9d1('0x17')]);module[_0xf9d1('0x18')]=router; \ No newline at end of file +var _0x3fb7=['isAuthenticated','/:id','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x445d29,_0x4e0f15){var _0x18ea65=function(_0x586d82){while(--_0x586d82){_0x445d29['push'](_0x445d29['shift']());}};_0x18ea65(++_0x4e0f15);}(_0x3fb7,0x187));var _0x73fb=function(_0x495c8a,_0x338ed2){_0x495c8a=_0x495c8a-0x0;var _0x40703f=_0x3fb7[_0x495c8a];return _0x40703f;};'use strict';var multer=require(_0x73fb('0x0'));var util=require(_0x73fb('0x1'));var path=require(_0x73fb('0x2'));var timeout=require(_0x73fb('0x3'));var express=require('express');var router=express[_0x73fb('0x4')]();var auth=require(_0x73fb('0x5'));var interaction=require(_0x73fb('0x6'));var config=require(_0x73fb('0x7'));var controller=require('./faxMessage.controller');router[_0x73fb('0x8')]('/',auth[_0x73fb('0x9')](),controller['index']);router[_0x73fb('0x8')]('/describe',auth[_0x73fb('0x9')](),controller['describe']);router['get'](_0x73fb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x73fb('0x8')](_0x73fb('0xb'),auth[_0x73fb('0x9')](),controller['download']);router[_0x73fb('0xc')]('/',auth[_0x73fb('0x9')](),interaction[_0x73fb('0xd')](_0x73fb('0xe'),_0x73fb('0xf')),controller[_0x73fb('0x10')]);router[_0x73fb('0x11')](_0x73fb('0xa'),auth[_0x73fb('0x9')](),controller[_0x73fb('0x12')]);router['put'](_0x73fb('0x13'),auth[_0x73fb('0x9')](),controller['accept']);router[_0x73fb('0x11')](_0x73fb('0x14'),auth[_0x73fb('0x9')](),controller[_0x73fb('0x15')]);router[_0x73fb('0x16')](_0x73fb('0xa'),auth[_0x73fb('0x9')](),controller[_0x73fb('0x17')]);module[_0x73fb('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 4d388c4..6c0c42d 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 _0xe80c=['beepall','roundrobin','exports','STRING','name','INTEGER','rrmemory'];(function(_0x4f122a,_0x571bea){var _0x15d8fb=function(_0x771644){while(--_0x771644){_0x4f122a['push'](_0x4f122a['shift']());}};_0x15d8fb(++_0x571bea);}(_0xe80c,0x1c2));var _0xce80=function(_0x76cf90,_0x44b965){_0x76cf90=_0x76cf90-0x0;var _0x255635=_0xe80c[_0x76cf90];return _0x255635;};'use strict';var Sequelize=require('sequelize');module[_0xce80('0x0')]={'name':{'type':Sequelize[_0xce80('0x1')],'unique':_0xce80('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xce80('0x1')]},'timeout':{'type':Sequelize[_0xce80('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xce80('0x4'),_0xce80('0x5'),_0xce80('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xce80('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd93a=['beepall','roundrobin','exports','STRING','name','INTEGER','rrmemory'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0xd93a,0xa3));var _0xad93=function(_0x27972b,_0x1bfa25){_0x27972b=_0x27972b-0x0;var _0x3e1db9=_0xd93a[_0x27972b];return _0x3e1db9;};'use strict';var Sequelize=require('sequelize');module[_0xad93('0x0')]={'name':{'type':Sequelize[_0xad93('0x1')],'unique':_0xad93('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xad93('0x1')]},'timeout':{'type':Sequelize[_0xad93('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xad93('0x4'),_0xad93('0x5'),_0xad93('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xad93('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index e4905a0..0296ad7 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 _0xcabe=['sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','UserProfileResource','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','user','get','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','pick','FaxQueueId','User','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','user_has_teams','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','union','compact','value','removeAgents','userFaxQueue:remove','omit','isArray','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcabe,0x1ef));var _0xecab=function(_0xf24cc3,_0x2b58f5){_0xf24cc3=_0xf24cc3-0x0;var _0x5a65a3=_0xcabe[_0xf24cc3];return _0x5a65a3;};'use strict';var pdf=require(_0xecab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xecab('0x1'));var zipdir=require(_0xecab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecab('0x3'));var moment=require(_0xecab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xecab('0x5'));var util=require(_0xecab('0x6'));var path=require(_0xecab('0x7'));var sox=require('sox');var csv=require(_0xecab('0x8'));var ejs=require(_0xecab('0x9'));var fs=require('fs');var _=require(_0xecab('0xa'));var squel=require(_0xecab('0xb'));var crypto=require(_0xecab('0xc'));var jsforce=require(_0xecab('0xd'));var deskjs=require(_0xecab('0xe'));var toCsv=require(_0xecab('0x8'));var querystring=require(_0xecab('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecab('0x10'));var qs=require(_0xecab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecab('0x12'));var logger=require(_0xecab('0x13'))(_0xecab('0x14'));var utils=require(_0xecab('0x15'));var config=require(_0xecab('0x16'));var db=require(_0xecab('0x17'))['db'];config['redis']=_[_0xecab('0x18')](config[_0xecab('0x19')],{'host':_0xecab('0x1a'),'port':0x18eb});var socket=require(_0xecab('0x1b'))(new Redis(config[_0xecab('0x19')]));require(_0xecab('0x1c'))['register'](socket);function respondWithStatusCode(_0x1a9aab,_0x56a614){_0x56a614=_0x56a614||0xcc;return function(_0x4bfc49){if(_0x4bfc49){return _0x1a9aab[_0xecab('0x1d')](_0x56a614);}return _0x1a9aab[_0xecab('0x1e')](_0x56a614)[_0xecab('0x1f')]();};}function respondWithResult(_0x1c019f,_0x5bdb81){_0x5bdb81=_0x5bdb81||0xc8;return function(_0x35feb8){if(_0x35feb8){return _0x1c019f[_0xecab('0x1e')](_0x5bdb81)[_0xecab('0x20')](_0x35feb8);}};}function respondWithFilteredResult(_0x46e838,_0x2d4bc0){return function(_0x55280a){if(_0x55280a){var _0x267bf6=_0x55280a[_0xecab('0x21')],_0x447f3d=_0x2d4bc0[_0xecab('0x22')],_0x5e7e5e=_0x2d4bc0[_0xecab('0x22')]+_0x2d4bc0[_0xecab('0x23')],_0x16ab54;if(_0x5e7e5e>=_0x267bf6){_0x5e7e5e=_0x267bf6;_0x16ab54=0xc8;}else{_0x16ab54=0xce;}_0x46e838[_0xecab('0x1e')](_0x16ab54);return _0x46e838['set'](_0xecab('0x24'),_0x447f3d+'-'+_0x5e7e5e+'/'+_0x267bf6)[_0xecab('0x20')](_0x55280a);}return null;};}function patchUpdates(_0x1fdd1d){return function(_0x50eb82){try{jsonpatch[_0xecab('0x25')](_0x50eb82,_0x1fdd1d,!![]);}catch(_0x54138e){return BPromise[_0xecab('0x26')](_0x54138e);}return _0x50eb82['save']();};}function saveUpdates(_0x184dbc,_0x94d9c2){return function(_0xe61b4f){if(_0xe61b4f){return _0xe61b4f[_0xecab('0x27')](_0x184dbc)[_0xecab('0x28')](function(_0x18405d){return _0x18405d;});}return null;};}function removeEntity(_0x44ba86,_0x2991a3){return function(_0x3c701e){if(_0x3c701e){return _0x3c701e[_0xecab('0x29')]()[_0xecab('0x28')](function(){var _0x270946=_0x3c701e['get']({'plain':!![]});var _0x1fcc46='FaxQueues';return db[_0xecab('0x2a')][_0xecab('0x29')]({'where':{'type':_0x1fcc46,'resourceId':_0x270946['id']}})['then'](function(){return _0x3c701e;});})[_0xecab('0x28')](function(){_0x44ba86['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6a57,_0xe97566){return function(_0x974659){if(!_0x974659){_0x2d6a57[_0xecab('0x1d')](0x194);}return _0x974659;};}function handleError(_0x34ded8,_0x30ca35){_0x30ca35=_0x30ca35||0x1f4;return function(_0x36c1c1){logger['error'](_0x36c1c1['stack']);if(_0x36c1c1[_0xecab('0x2b')]){delete _0x36c1c1[_0xecab('0x2b')];}_0x34ded8[_0xecab('0x1e')](_0x30ca35)[_0xecab('0x2c')](_0x36c1c1);};}exports[_0xecab('0x2d')]=function(_0x2e47fd,_0x51d4b9){var _0x5501e9={},_0x26e545={},_0x1ecb85={'count':0x0,'rows':[]};var _0x1cdc69=_[_0xecab('0x2e')](db[_0xecab('0x2f')][_0xecab('0x30')],function(_0x32955f){return{'name':_0x32955f[_0xecab('0x31')],'type':_0x32955f[_0xecab('0x32')]['key']};});_0x26e545['model']=_['map'](_0x1cdc69,'name');_0x26e545['query']=_[_0xecab('0x33')](_0x2e47fd[_0xecab('0x34')]);_0x26e545[_0xecab('0x35')]=_[_0xecab('0x36')](_0x26e545[_0xecab('0x37')],_0x26e545[_0xecab('0x34')]);_0x5501e9[_0xecab('0x38')]=_[_0xecab('0x36')](_0x26e545[_0xecab('0x37')],qs[_0xecab('0x39')](_0x2e47fd['query'][_0xecab('0x39')]));_0x5501e9['attributes']=_0x5501e9['attributes'][_0xecab('0x3a')]?_0x5501e9['attributes']:_0x26e545[_0xecab('0x37')];if(!_0x2e47fd[_0xecab('0x34')]['hasOwnProperty'](_0xecab('0x3b'))){_0x5501e9[_0xecab('0x23')]=qs[_0xecab('0x23')](_0x2e47fd[_0xecab('0x34')]['limit']);_0x5501e9[_0xecab('0x22')]=qs[_0xecab('0x22')](_0x2e47fd[_0xecab('0x34')]['offset']);}_0x5501e9[_0xecab('0x3c')]=qs[_0xecab('0x3d')](_0x2e47fd['query'][_0xecab('0x3d')]);_0x5501e9[_0xecab('0x3e')]=qs[_0xecab('0x35')](_['pick'](_0x2e47fd['query'],_0x26e545['filters']),_0x1cdc69);if(_0x2e47fd[_0xecab('0x34')][_0xecab('0x3f')]){_0x5501e9[_0xecab('0x3e')]=_[_0xecab('0x40')](_0x5501e9[_0xecab('0x3e')],{'$or':_[_0xecab('0x2e')](_0x1cdc69,function(_0x10c291){if(_0x10c291[_0xecab('0x32')]!=='VIRTUAL'){var _0x978283={};_0x978283[_0x10c291['name']]={'$like':'%'+_0x2e47fd['query']['filter']+'%'};return _0x978283;}})});}_0x5501e9=_['merge']({},_0x5501e9,_0x2e47fd[_0xecab('0x41')]);var _0x25b340={'where':_0x5501e9['where']};return db[_0xecab('0x2f')][_0xecab('0x21')](_0x25b340)[_0xecab('0x28')](function(_0x131544){_0x1ecb85[_0xecab('0x21')]=_0x131544;if(_0x2e47fd[_0xecab('0x34')][_0xecab('0x42')]){_0x5501e9[_0xecab('0x43')]=[{'all':!![]}];}return db['FaxQueue'][_0xecab('0x44')](_0x5501e9);})[_0xecab('0x28')](function(_0x2665b6){_0x1ecb85[_0xecab('0x45')]=_0x2665b6;return _0x1ecb85;})[_0xecab('0x28')](respondWithFilteredResult(_0x51d4b9,_0x5501e9))[_0xecab('0x46')](handleError(_0x51d4b9,null));};exports['show']=function(_0x4847c3,_0x295669){var _0x3b8ad7={'raw':!![],'where':{'id':_0x4847c3['params']['id']}},_0x5a5128={};_0x5a5128[_0xecab('0x37')]=_[_0xecab('0x33')](db[_0xecab('0x2f')]['rawAttributes']);_0x5a5128[_0xecab('0x34')]=_[_0xecab('0x33')](_0x4847c3[_0xecab('0x34')]);_0x5a5128['filters']=_[_0xecab('0x36')](_0x5a5128[_0xecab('0x37')],_0x5a5128[_0xecab('0x34')]);_0x3b8ad7['attributes']=_[_0xecab('0x36')](_0x5a5128[_0xecab('0x37')],qs[_0xecab('0x39')](_0x4847c3[_0xecab('0x34')][_0xecab('0x39')]));_0x3b8ad7[_0xecab('0x38')]=_0x3b8ad7[_0xecab('0x38')][_0xecab('0x3a')]?_0x3b8ad7['attributes']:_0x5a5128[_0xecab('0x37')];if(_0x4847c3[_0xecab('0x34')][_0xecab('0x42')]){_0x3b8ad7[_0xecab('0x43')]=[{'all':!![]}];}_0x3b8ad7=_['merge']({},_0x3b8ad7,_0x4847c3['options']);return db['FaxQueue'][_0xecab('0x47')](_0x3b8ad7)[_0xecab('0x28')](handleEntityNotFound(_0x295669,null))[_0xecab('0x28')](respondWithResult(_0x295669,null))[_0xecab('0x46')](handleError(_0x295669,null));};exports[_0xecab('0x48')]=function(_0x3868c3,_0x5823c6){return db[_0xecab('0x2f')][_0xecab('0x48')](_0x3868c3[_0xecab('0x49')],{})[_0xecab('0x28')](function(_0x119c50){var _0x23b223=_0x3868c3[_0xecab('0x4a')][_0xecab('0x4b')]({'plain':!![]});if(!_0x23b223)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23b223[_0xecab('0x4c')]===_0xecab('0x4a')){var _0x3d117c=_0x119c50[_0xecab('0x4b')]({'plain':!![]});var _0x4dc11b=_0xecab('0x4d');return db[_0xecab('0x4e')][_0xecab('0x47')]({'where':{'name':_0x4dc11b,'userProfileId':_0x23b223[_0xecab('0x4f')]},'raw':!![]})['then'](function(_0x2d752b){if(_0x2d752b&&_0x2d752b[_0xecab('0x50')]===0x0){return db[_0xecab('0x2a')][_0xecab('0x48')]({'name':_0x3d117c['name'],'resourceId':_0x3d117c['id'],'type':_0x2d752b[_0xecab('0x2b')],'sectionId':_0x2d752b['id']},{})[_0xecab('0x28')](function(){return _0x119c50;});}else{return _0x119c50;}})[_0xecab('0x46')](function(_0x4f103f){logger['error'](_0xecab('0x51'),_0x4f103f);throw _0x4f103f;});}return _0x119c50;})['then'](respondWithResult(_0x5823c6,0xc9))['catch'](handleError(_0x5823c6,null));};exports[_0xecab('0x27')]=function(_0xdced53,_0x138eca){if(_0xdced53[_0xecab('0x49')]['id']){delete _0xdced53[_0xecab('0x49')]['id'];}return db[_0xecab('0x2f')][_0xecab('0x47')]({'where':{'id':_0xdced53['params']['id']}})[_0xecab('0x28')](handleEntityNotFound(_0x138eca,null))[_0xecab('0x28')](saveUpdates(_0xdced53[_0xecab('0x49')],null))['then'](respondWithResult(_0x138eca,null))[_0xecab('0x46')](handleError(_0x138eca,null));};exports[_0xecab('0x29')]=function(_0x1603b2,_0x28d250){return db[_0xecab('0x2f')][_0xecab('0x47')]({'where':{'id':_0x1603b2[_0xecab('0x52')]['id']}})[_0xecab('0x28')](handleEntityNotFound(_0x28d250,null))[_0xecab('0x28')](removeEntity(_0x28d250,null))[_0xecab('0x46')](handleError(_0x28d250,null));};exports['describe']=function(_0x1649c2,_0x32dda6){return db[_0xecab('0x2f')]['describe']()[_0xecab('0x28')](respondWithResult(_0x32dda6,null))[_0xecab('0x46')](handleError(_0x32dda6,null));};exports[_0xecab('0x53')]=function(_0x331552,_0x3f0e47,_0x22e826){var _0x43c0e4={'raw':!![],'where':{}},_0x265888={},_0x46fb14;return db[_0xecab('0x2f')][_0xecab('0x54')]({'where':{'id':_0x331552[_0xecab('0x52')]['id']}})['then'](handleEntityNotFound(_0x3f0e47,null))[_0xecab('0x28')](function(_0x8c07fe){if(_0x8c07fe){_0x46fb14=_0x8c07fe[_0xecab('0x4b')]({'plain':!![]});_0x265888['model']=_[_0xecab('0x33')](db['UserFaxQueue'][_0xecab('0x30')]);_0x265888[_0xecab('0x34')]=_[_0xecab('0x33')](_0x331552[_0xecab('0x34')]);_0x265888[_0xecab('0x35')]=_[_0xecab('0x36')](_0x265888[_0xecab('0x37')],_0x265888[_0xecab('0x34')]);_0x43c0e4[_0xecab('0x38')]=_[_0xecab('0x36')](_0x265888[_0xecab('0x37')],qs[_0xecab('0x39')](_0x331552[_0xecab('0x34')][_0xecab('0x39')]));_0x43c0e4[_0xecab('0x38')]=_0x43c0e4[_0xecab('0x38')][_0xecab('0x3a')]?_0x43c0e4[_0xecab('0x38')]:_0x265888[_0xecab('0x37')];if(!_0x331552['query']['hasOwnProperty'](_0xecab('0x3b'))){_0x43c0e4[_0xecab('0x23')]=qs[_0xecab('0x23')](_0x331552[_0xecab('0x34')]['limit']);_0x43c0e4['offset']=qs[_0xecab('0x22')](_0x331552[_0xecab('0x34')][_0xecab('0x22')]);}_0x43c0e4['order']=qs['sort'](_0x331552[_0xecab('0x34')][_0xecab('0x3d')]);_0x43c0e4[_0xecab('0x3e')]=qs['filters'](_[_0xecab('0x55')](_0x331552[_0xecab('0x34')],_0x265888[_0xecab('0x35')]));_0x43c0e4[_0xecab('0x3e')][_0xecab('0x56')]=_0x8c07fe['id'];if(_0x331552['query'][_0xecab('0x3f')]){_0x43c0e4[_0xecab('0x3e')]=_[_0xecab('0x40')](_0x43c0e4['where'],{'$or':_['map'](_0x43c0e4[_0xecab('0x38')],function(_0x5e07c2){var _0x33cabe={};_0x33cabe[_0x5e07c2]={'$like':'%'+_0x331552[_0xecab('0x34')]['filter']+'%'};return _0x33cabe;})});}_0x43c0e4=_[_0xecab('0x40')]({},_0x43c0e4,_0x331552[_0xecab('0x41')]);return db['UserFaxQueue'][_0xecab('0x44')](_0x43c0e4);}})[_0xecab('0x28')](function(_0x8acedd){if(_0x8acedd){return db[_0xecab('0x57')]['findAndCountAll']({'where':{'id':_[_0xecab('0x2e')](_0x8acedd,_0xecab('0x58')),'role':_0xecab('0x59')},'attributes':['id','name',_0xecab('0x5a'),_0xecab('0x5b'),_0xecab('0x5c')]});}})[_0xecab('0x28')](function(_0x25f354){if(_0x25f354){return{'count':_0x25f354[_0xecab('0x21')],'rows':_[_0xecab('0x2e')](_0x25f354[_0xecab('0x45')],function(_0x30ccf4){return{'membername':_0x30ccf4[_0xecab('0x2b')],'UserId':_0x30ccf4['id'],'queue_name':_0x46fb14[_0xecab('0x2b')],'FaxQueueId':_0x46fb14['id'],'interface':util[_0xecab('0x5d')](_0xecab('0x5e'),_0xecab('0x5f'),_0x30ccf4[_0xecab('0x2b')]),'penalty':0x0,'paused':_0x30ccf4[_0xecab('0x5a')],'createdAt':_0x30ccf4[_0xecab('0x5c')],'updatedAt':_0x30ccf4[_0xecab('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xecab('0x28')](respondWithFilteredResult(_0x3f0e47,_0x43c0e4))[_0xecab('0x46')](handleError(_0x3f0e47,null));};exports[_0xecab('0x60')]=function(_0x3055ff,_0x50cece,_0x2b9d49){var _0x1e3ba7={};var _0x136b18={};var _0x4f922c;var _0x13a800;return db['FaxQueue'][_0xecab('0x54')]({'where':{'id':_0x3055ff['params']['id']}})[_0xecab('0x28')](handleEntityNotFound(_0x50cece,null))[_0xecab('0x28')](function(_0x1cd418){if(_0x1cd418){_0x4f922c=_0x1cd418;_0x136b18[_0xecab('0x37')]=_[_0xecab('0x33')](db[_0xecab('0x61')][_0xecab('0x30')]);_0x136b18[_0xecab('0x34')]=_[_0xecab('0x33')](_0x3055ff[_0xecab('0x34')]);_0x136b18[_0xecab('0x35')]=_[_0xecab('0x36')](_0x136b18['model'],_0x136b18['query']);_0x1e3ba7[_0xecab('0x38')]=_[_0xecab('0x36')](_0x136b18[_0xecab('0x37')],qs[_0xecab('0x39')](_0x3055ff[_0xecab('0x34')][_0xecab('0x39')]));_0x1e3ba7[_0xecab('0x38')]=_0x1e3ba7[_0xecab('0x38')]['length']?_0x1e3ba7[_0xecab('0x38')]:_0x136b18[_0xecab('0x37')];_0x1e3ba7[_0xecab('0x3c')]=qs[_0xecab('0x3d')](_0x3055ff[_0xecab('0x34')][_0xecab('0x3d')]);_0x1e3ba7['where']=qs[_0xecab('0x35')](_['pick'](_0x3055ff[_0xecab('0x34')],_0x136b18[_0xecab('0x35')]));if(_0x3055ff[_0xecab('0x34')][_0xecab('0x3f')]){_0x1e3ba7[_0xecab('0x3e')]=_[_0xecab('0x40')](_0x1e3ba7['where'],{'$or':_['map'](_0x1e3ba7[_0xecab('0x38')],function(_0x22eddd){var _0x4361db={};_0x4361db[_0x22eddd]={'$like':'%'+_0x3055ff[_0xecab('0x34')][_0xecab('0x3f')]+'%'};return _0x4361db;})});}_0x1e3ba7=_[_0xecab('0x40')]({},_0x1e3ba7,_0x3055ff[_0xecab('0x41')]);return _0x4f922c['getTeams'](_0x1e3ba7);}})[_0xecab('0x28')](function(_0x19ae25){if(_0x19ae25){_0x13a800=_0x19ae25[_0xecab('0x3a')];if(!_0x3055ff[_0xecab('0x34')][_0xecab('0x62')]('nolimit')){_0x1e3ba7[_0xecab('0x23')]=qs[_0xecab('0x23')](_0x3055ff[_0xecab('0x34')][_0xecab('0x23')]);_0x1e3ba7['offset']=qs[_0xecab('0x22')](_0x3055ff[_0xecab('0x34')]['offset']);}return _0x4f922c[_0xecab('0x60')](_0x1e3ba7);}})[_0xecab('0x28')](function(_0x8271bf){if(_0x8271bf){return _0x8271bf?{'count':_0x13a800,'rows':_0x8271bf}:null;}})[_0xecab('0x28')](respondWithResult(_0x50cece,null))[_0xecab('0x46')](handleError(_0x50cece,null));};exports[_0xecab('0x63')]=function(_0x4d074b,_0x2239be,_0x24a8fc){var _0x19b84a=_0x4d074b[_0xecab('0x49')][_0xecab('0x64')];return db[_0xecab('0x61')]['findAll']({'where':{'id':_0x19b84a},'attributes':['id'],'include':[{'model':db[_0xecab('0x57')],'as':_0xecab('0x65'),'attributes':['id',_0xecab('0x2b'),_0xecab('0x66'),_0xecab('0x67'),_0xecab('0x68')],'raw':!![]}]})[_0xecab('0x28')](function(_0xb9628c){if(_0xb9628c){var _0x3c9220=_['flatMap'](_0xb9628c,function(_0x3b0ceb){var _0x5c01c9=_0x3b0ceb['get']({'plain':!![]});return _0x5c01c9[_0xecab('0x65')];});return db[_0xecab('0x2f')]['find']({'where':{'id':_0x4d074b[_0xecab('0x52')]['id']}})['then'](function(_0x22af08){return db['sequelize'][_0xecab('0x69')](function(_0x198281){return _0x22af08[_0xecab('0x63')](_0x19b84a,{'transaction':_0x198281})[_0xecab('0x28')](function(){return BPromise['each'](_0x3c9220,function(_0x25d50a){return db['UserFaxQueue'][_0xecab('0x6a')]({'where':{'UserId':_0x25d50a['id'],'FaxQueueId':_0x4d074b[_0xecab('0x52')]['id']},'transaction':_0x198281});});})[_0xecab('0x28')](function(){_0x3c9220[_0xecab('0x6b')](function(_0xde881b){socket[_0xecab('0x6c')](_0xecab('0x6d'),{'UserId':_0xde881b['id'],'FaxQueueId':_0x22af08['id']});});});});});}})[_0xecab('0x28')](respondWithStatusCode(_0x2239be,null))[_0xecab('0x46')](handleError(_0x2239be,null));};exports[_0xecab('0x6e')]=function(_0x49f548,_0x47894e,_0x919505){return db['Team'][_0xecab('0x44')]({'where':{'id':_0x49f548[_0xecab('0x34')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xecab('0x65'),'attributes':['id'],'raw':!![]}]})[_0xecab('0x28')](handleEntityNotFound(_0x47894e,null))[_0xecab('0x28')](function(_0xb6abe6){var _0x3b2a3e=_['map'](_0xb6abe6,'id');var _0x334a8b=[];var _0x1c1a82=[];var _0x3f3ac9=squel[_0xecab('0x6f')]();_0x3f3ac9['field'](_0xecab('0x70'))[_0xecab('0x71')](_0xecab('0x72'),'tq')['join'](_0xecab('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xecab('0x3e')]('FaxQueueId\x20=\x20?',_0x49f548[_0xecab('0x52')]['id']);for(var _0xa9787b=0x0;_0xa9787b<_0xb6abe6[_0xecab('0x3a')];_0xa9787b+=0x1){let _0x16df54=_0xb6abe6[_0xa9787b];for(var _0xfe30c1=0x0;_0xfe30c1<_0x16df54['Agents'][_0xecab('0x3a')];_0xfe30c1+=0x1){let _0x416fea=_0x16df54['Agents'][_0xfe30c1];var _0x7c2e71=_0x3f3ac9[_0xecab('0x74')]();_0x7c2e71['where'](_0xecab('0x75'),_0x416fea['id']);_0x1c1a82['push'](db[_0xecab('0x76')][_0xecab('0x34')](_0x7c2e71['toString'](),{'type':db[_0xecab('0x76')][_0xecab('0x77')][_0xecab('0x78')]})[_0xecab('0x28')](function(_0x5711d5){if(_0x5711d5['length']===0x1){return _0x416fea['id'];}else{var _0x2ae99a=_[_0xecab('0x79')](_[_0xecab('0x2e')](_0x5711d5,_0xecab('0x7a')),function(_0x36f417){return _['includes'](_0x3b2a3e,_0x36f417);});if(_0x2ae99a){return _0x416fea['id'];}}}));}}return BPromise['all'](_0x1c1a82)['then'](function(_0x56cb0e){_0x334a8b=_(_0x334a8b)[_0xecab('0x7b')](_0x56cb0e)[_0xecab('0x7c')]()[_0xecab('0x7d')]();return db[_0xecab('0x2f')][_0xecab('0x47')]({'where':{'id':_0x49f548['params']['id']}})['then'](function(_0x2337a9){return db['sequelize']['transaction'](function(_0x2f7d84){return _0x2337a9['removeTeams'](_0x49f548[_0xecab('0x34')][_0xecab('0x64')],{'transaction':_0x2f7d84})[_0xecab('0x28')](function(){if(!_['isEmpty'](_0x334a8b)){return _0x2337a9[_0xecab('0x7e')](_0x334a8b,{'transaction':_0x2f7d84});}})[_0xecab('0x28')](function(){_0x334a8b[_0xecab('0x6b')](function(_0x1f0fdd){socket[_0xecab('0x6c')](_0xecab('0x7f'),{'UserId':_0x1f0fdd,'FaxQueueId':_0x2337a9['id']});});});});});});})[_0xecab('0x28')](respondWithStatusCode(_0x47894e,null))['catch'](handleError(_0x47894e,null));};exports['addAgents']=function(_0x48117c,_0x3669a1,_0x1fa1c1){return db['FaxQueue'][_0xecab('0x47')]({'where':{'id':_0x48117c['params']['id']}})['then'](handleEntityNotFound(_0x3669a1,null))[_0xecab('0x28')](function(_0x5c08f8){if(_0x5c08f8){return _0x5c08f8['addAgents'](_0x48117c['body']['ids'],_[_0xecab('0x80')](_0x48117c['body'],[_0xecab('0x64'),'id'])||{})['spread'](function(_0x13052f){for(var _0x1c6b89=0x0;_0x1c6b89<_0x48117c[_0xecab('0x49')][_0xecab('0x64')][_0xecab('0x3a')];_0x1c6b89+=0x1){socket['emit'](_0xecab('0x6d'),{'UserId':_0x48117c[_0xecab('0x49')][_0xecab('0x64')][_0x1c6b89],'FaxQueueId':_0x48117c[_0xecab('0x52')]['id']});}return _0x13052f;});}})[_0xecab('0x28')](respondWithResult(_0x3669a1,null))['catch'](handleError(_0x3669a1,null));};exports[_0xecab('0x7e')]=function(_0x177297,_0x180d71,_0x58d9be){return db['FaxQueue']['find']({'where':{'id':_0x177297[_0xecab('0x52')]['id']}})[_0xecab('0x28')](handleEntityNotFound(_0x180d71,null))['then'](function(_0x455ecd){if(_0x455ecd){return _0x455ecd[_0xecab('0x7e')](_0x177297[_0xecab('0x34')][_0xecab('0x64')])['then'](function(){if(_[_0xecab('0x81')](_0x177297[_0xecab('0x34')][_0xecab('0x64')])){for(var _0x45be5b=0x0;_0x45be5b<_0x177297['query'][_0xecab('0x64')][_0xecab('0x3a')];_0x45be5b+=0x1){socket['emit'](_0xecab('0x7f'),{'UserId':Number(_0x177297[_0xecab('0x34')]['ids'][_0x45be5b]),'FaxQueueId':Number(_0x177297[_0xecab('0x52')]['id'])});}}else{socket[_0xecab('0x6c')](_0xecab('0x7f'),{'UserId':Number(_0x177297[_0xecab('0x34')][_0xecab('0x64')]),'FaxQueueId':Number(_0x177297[_0xecab('0x52')]['id'])});}});}})[_0xecab('0x28')](respondWithStatusCode(_0x180d71,null))[_0xecab('0x46')](handleError(_0x180d71,null));};exports['getAgents']=function(_0x385bcb,_0x169cf2,_0x3b6520){var _0x51deff={};var _0x104b47={};var _0x14dd63;var _0x5cab5d;return db[_0xecab('0x2f')][_0xecab('0x54')]({'where':{'id':_0x385bcb[_0xecab('0x52')]['id']}})[_0xecab('0x28')](handleEntityNotFound(_0x169cf2,null))[_0xecab('0x28')](function(_0x35062c){if(_0x35062c){_0x14dd63=_0x35062c;_0x104b47[_0xecab('0x37')]=_[_0xecab('0x33')](db[_0xecab('0x57')][_0xecab('0x30')]);_0x104b47[_0xecab('0x34')]=_[_0xecab('0x33')](_0x385bcb[_0xecab('0x34')]);_0x104b47['filters']=_[_0xecab('0x36')](_0x104b47[_0xecab('0x37')],_0x104b47['query']);_0x51deff[_0xecab('0x38')]=_[_0xecab('0x36')](_0x104b47[_0xecab('0x37')],qs['fields'](_0x385bcb[_0xecab('0x34')][_0xecab('0x39')]));_0x51deff[_0xecab('0x38')]=_0x51deff['attributes'][_0xecab('0x3a')]?_0x51deff[_0xecab('0x38')]:_0x104b47[_0xecab('0x37')];_0x51deff[_0xecab('0x3c')]=qs['sort'](_0x385bcb[_0xecab('0x34')][_0xecab('0x3d')]);_0x51deff[_0xecab('0x3e')]=qs['filters'](_[_0xecab('0x55')](_0x385bcb[_0xecab('0x34')],_0x104b47[_0xecab('0x35')]));if(_0x385bcb['query'][_0xecab('0x3f')]){_0x51deff[_0xecab('0x3e')]=_['merge'](_0x51deff['where'],{'$or':_[_0xecab('0x2e')](_0x51deff[_0xecab('0x38')],function(_0x3174c8){var _0x32537b={};_0x32537b[_0x3174c8]={'$like':'%'+_0x385bcb[_0xecab('0x34')][_0xecab('0x3f')]+'%'};return _0x32537b;})});}_0x51deff=_['merge']({},_0x51deff,_0x385bcb[_0xecab('0x41')]);return _0x14dd63['getAgents'](_0x51deff);}})[_0xecab('0x28')](function(_0x10c0c8){if(_0x10c0c8){_0x5cab5d=_0x10c0c8[_0xecab('0x3a')];if(!_0x385bcb[_0xecab('0x34')][_0xecab('0x62')](_0xecab('0x3b'))){_0x51deff[_0xecab('0x23')]=qs[_0xecab('0x23')](_0x385bcb[_0xecab('0x34')][_0xecab('0x23')]);_0x51deff[_0xecab('0x22')]=qs[_0xecab('0x22')](_0x385bcb['query'][_0xecab('0x22')]);}return _0x14dd63[_0xecab('0x82')](_0x51deff);}})[_0xecab('0x28')](function(_0x3481b6){if(_0x3481b6){return _0x3481b6?{'count':_0x5cab5d,'rows':_0x3481b6}:null;}})[_0xecab('0x28')](respondWithResult(_0x169cf2,null))[_0xecab('0x46')](handleError(_0x169cf2,null));}; \ No newline at end of file +var _0x58a4=['userProfileId','autoAssociation','params','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','addTeams','ids','Team','online','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','sendStatus','status','end','json','offset','set','apply','reject','save','update','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','FaxQueue','count','includeAll','findAll','rows','show','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection'];(function(_0x68be45,_0x2adf77){var _0x17715f=function(_0xa9a71e){while(--_0xa9a71e){_0x68be45['push'](_0x68be45['shift']());}};_0x17715f(++_0x2adf77);}(_0x58a4,0xbf));var _0x458a=function(_0x1ff92d,_0x3bfdeb){_0x1ff92d=_0x1ff92d-0x0;var _0x129a98=_0x58a4[_0x1ff92d];return _0x129a98;};'use strict';var pdf=require(_0x458a('0x0'));var emlformat=require(_0x458a('0x1'));var rimraf=require(_0x458a('0x2'));var zipdir=require(_0x458a('0x3'));var jsonpatch=require(_0x458a('0x4'));var rp=require(_0x458a('0x5'));var moment=require(_0x458a('0x6'));var BPromise=require(_0x458a('0x7'));var Mustache=require(_0x458a('0x8'));var util=require(_0x458a('0x9'));var path=require(_0x458a('0xa'));var sox=require(_0x458a('0xb'));var csv=require(_0x458a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var db=require(_0x458a('0x18'))['db'];config[_0x458a('0x19')]=_[_0x458a('0x1a')](config[_0x458a('0x19')],{'host':_0x458a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x458a('0x1c'))['register'](socket);function respondWithStatusCode(_0x2c7528,_0x44f683){_0x44f683=_0x44f683||0xcc;return function(_0x10133b){if(_0x10133b){return _0x2c7528[_0x458a('0x1d')](_0x44f683);}return _0x2c7528[_0x458a('0x1e')](_0x44f683)[_0x458a('0x1f')]();};}function respondWithResult(_0x507b0f,_0x4b26be){_0x4b26be=_0x4b26be||0xc8;return function(_0x5c7993){if(_0x5c7993){return _0x507b0f[_0x458a('0x1e')](_0x4b26be)[_0x458a('0x20')](_0x5c7993);}};}function respondWithFilteredResult(_0x3558b9,_0x5c5b41){return function(_0x310569){if(_0x310569){var _0x260c87=_0x310569['count'],_0x18504d=_0x5c5b41['offset'],_0x392986=_0x5c5b41[_0x458a('0x21')]+_0x5c5b41['limit'],_0xa91473;if(_0x392986>=_0x260c87){_0x392986=_0x260c87;_0xa91473=0xc8;}else{_0xa91473=0xce;}_0x3558b9[_0x458a('0x1e')](_0xa91473);return _0x3558b9[_0x458a('0x22')]('Content-Range',_0x18504d+'-'+_0x392986+'/'+_0x260c87)[_0x458a('0x20')](_0x310569);}return null;};}function patchUpdates(_0x55a588){return function(_0x200213){try{jsonpatch[_0x458a('0x23')](_0x200213,_0x55a588,!![]);}catch(_0x59f44c){return BPromise[_0x458a('0x24')](_0x59f44c);}return _0x200213[_0x458a('0x25')]();};}function saveUpdates(_0x5a2bcb,_0xa6b8ff){return function(_0x5ad95a){if(_0x5ad95a){return _0x5ad95a[_0x458a('0x26')](_0x5a2bcb)['then'](function(_0x4080fc){return _0x4080fc;});}return null;};}function removeEntity(_0x5dfc6c,_0x36b08e){return function(_0x911eaf){if(_0x911eaf){return _0x911eaf[_0x458a('0x27')]()[_0x458a('0x28')](function(){var _0x339b95=_0x911eaf[_0x458a('0x29')]({'plain':!![]});var _0x340375=_0x458a('0x2a');return db[_0x458a('0x2b')][_0x458a('0x27')]({'where':{'type':_0x340375,'resourceId':_0x339b95['id']}})[_0x458a('0x28')](function(){return _0x911eaf;});})[_0x458a('0x28')](function(){_0x5dfc6c[_0x458a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb94bd9,_0x112fa6){return function(_0x5f3ac0){if(!_0x5f3ac0){_0xb94bd9['sendStatus'](0x194);}return _0x5f3ac0;};}function handleError(_0x41b23d,_0x596fe2){_0x596fe2=_0x596fe2||0x1f4;return function(_0x33c5d8){logger[_0x458a('0x2c')](_0x33c5d8[_0x458a('0x2d')]);if(_0x33c5d8['name']){delete _0x33c5d8[_0x458a('0x2e')];}_0x41b23d[_0x458a('0x1e')](_0x596fe2)[_0x458a('0x2f')](_0x33c5d8);};}exports['index']=function(_0x47e20d,_0x18c890){var _0x4cf059={},_0x185f1c={},_0x56e0b9={'count':0x0,'rows':[]};var _0x2e0b0c=_[_0x458a('0x30')](db['FaxQueue'][_0x458a('0x31')],function(_0x269f53){return{'name':_0x269f53[_0x458a('0x32')],'type':_0x269f53['type'][_0x458a('0x33')]};});_0x185f1c[_0x458a('0x34')]=_[_0x458a('0x30')](_0x2e0b0c,_0x458a('0x2e'));_0x185f1c[_0x458a('0x35')]=_['keys'](_0x47e20d[_0x458a('0x35')]);_0x185f1c[_0x458a('0x36')]=_[_0x458a('0x37')](_0x185f1c[_0x458a('0x34')],_0x185f1c[_0x458a('0x35')]);_0x4cf059[_0x458a('0x38')]=_['intersection'](_0x185f1c[_0x458a('0x34')],qs[_0x458a('0x39')](_0x47e20d[_0x458a('0x35')][_0x458a('0x39')]));_0x4cf059[_0x458a('0x38')]=_0x4cf059[_0x458a('0x38')][_0x458a('0x3a')]?_0x4cf059[_0x458a('0x38')]:_0x185f1c[_0x458a('0x34')];if(!_0x47e20d['query'][_0x458a('0x3b')](_0x458a('0x3c'))){_0x4cf059[_0x458a('0x3d')]=qs[_0x458a('0x3d')](_0x47e20d[_0x458a('0x35')][_0x458a('0x3d')]);_0x4cf059[_0x458a('0x21')]=qs[_0x458a('0x21')](_0x47e20d[_0x458a('0x35')][_0x458a('0x21')]);}_0x4cf059[_0x458a('0x3e')]=qs[_0x458a('0x3f')](_0x47e20d[_0x458a('0x35')][_0x458a('0x3f')]);_0x4cf059[_0x458a('0x40')]=qs['filters'](_[_0x458a('0x41')](_0x47e20d[_0x458a('0x35')],_0x185f1c[_0x458a('0x36')]),_0x2e0b0c);if(_0x47e20d[_0x458a('0x35')][_0x458a('0x42')]){_0x4cf059[_0x458a('0x40')]=_[_0x458a('0x43')](_0x4cf059[_0x458a('0x40')],{'$or':_[_0x458a('0x30')](_0x2e0b0c,function(_0x44c5ba){if(_0x44c5ba[_0x458a('0x44')]!=='VIRTUAL'){var _0x95c42c={};_0x95c42c[_0x44c5ba[_0x458a('0x2e')]]={'$like':'%'+_0x47e20d['query'][_0x458a('0x42')]+'%'};return _0x95c42c;}})});}_0x4cf059=_[_0x458a('0x43')]({},_0x4cf059,_0x47e20d[_0x458a('0x45')]);var _0x5663b5={'where':_0x4cf059[_0x458a('0x40')]};return db[_0x458a('0x46')][_0x458a('0x47')](_0x5663b5)[_0x458a('0x28')](function(_0xbcd632){_0x56e0b9[_0x458a('0x47')]=_0xbcd632;if(_0x47e20d[_0x458a('0x35')][_0x458a('0x48')]){_0x4cf059['include']=[{'all':!![]}];}return db[_0x458a('0x46')][_0x458a('0x49')](_0x4cf059);})[_0x458a('0x28')](function(_0x5180ae){_0x56e0b9[_0x458a('0x4a')]=_0x5180ae;return _0x56e0b9;})[_0x458a('0x28')](respondWithFilteredResult(_0x18c890,_0x4cf059))['catch'](handleError(_0x18c890,null));};exports[_0x458a('0x4b')]=function(_0x124f64,_0x2be08f){var _0x36c391={'raw':!![],'where':{'id':_0x124f64['params']['id']}},_0xf5d4f3={};_0xf5d4f3['model']=_[_0x458a('0x4c')](db[_0x458a('0x46')][_0x458a('0x31')]);_0xf5d4f3[_0x458a('0x35')]=_['keys'](_0x124f64[_0x458a('0x35')]);_0xf5d4f3[_0x458a('0x36')]=_['intersection'](_0xf5d4f3[_0x458a('0x34')],_0xf5d4f3['query']);_0x36c391[_0x458a('0x38')]=_[_0x458a('0x37')](_0xf5d4f3[_0x458a('0x34')],qs['fields'](_0x124f64[_0x458a('0x35')][_0x458a('0x39')]));_0x36c391[_0x458a('0x38')]=_0x36c391['attributes']['length']?_0x36c391[_0x458a('0x38')]:_0xf5d4f3[_0x458a('0x34')];if(_0x124f64[_0x458a('0x35')]['includeAll']){_0x36c391['include']=[{'all':!![]}];}_0x36c391=_[_0x458a('0x43')]({},_0x36c391,_0x124f64[_0x458a('0x45')]);return db[_0x458a('0x46')][_0x458a('0x4d')](_0x36c391)[_0x458a('0x28')](handleEntityNotFound(_0x2be08f,null))[_0x458a('0x28')](respondWithResult(_0x2be08f,null))[_0x458a('0x4e')](handleError(_0x2be08f,null));};exports[_0x458a('0x4f')]=function(_0xb22232,_0x213f86){return db[_0x458a('0x46')][_0x458a('0x4f')](_0xb22232[_0x458a('0x50')],{})[_0x458a('0x28')](function(_0x1ddc39){var _0x25b44c=_0xb22232['user'][_0x458a('0x29')]({'plain':!![]});if(!_0x25b44c)throw new Error(_0x458a('0x51'));if(_0x25b44c[_0x458a('0x52')]===_0x458a('0x53')){var _0x44670a=_0x1ddc39['get']({'plain':!![]});var _0x4b5093='FaxQueues';return db[_0x458a('0x54')]['find']({'where':{'name':_0x4b5093,'userProfileId':_0x25b44c[_0x458a('0x55')]},'raw':!![]})[_0x458a('0x28')](function(_0x2a35a9){if(_0x2a35a9&&_0x2a35a9[_0x458a('0x56')]===0x0){return db[_0x458a('0x2b')]['create']({'name':_0x44670a['name'],'resourceId':_0x44670a['id'],'type':_0x2a35a9[_0x458a('0x2e')],'sectionId':_0x2a35a9['id']},{})[_0x458a('0x28')](function(){return _0x1ddc39;});}else{return _0x1ddc39;}})[_0x458a('0x4e')](function(_0x8ff0dd){logger[_0x458a('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8ff0dd);throw _0x8ff0dd;});}return _0x1ddc39;})[_0x458a('0x28')](respondWithResult(_0x213f86,0xc9))['catch'](handleError(_0x213f86,null));};exports[_0x458a('0x26')]=function(_0x5b428c,_0x3ea8f0){if(_0x5b428c['body']['id']){delete _0x5b428c['body']['id'];}return db['FaxQueue'][_0x458a('0x4d')]({'where':{'id':_0x5b428c[_0x458a('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ea8f0,null))[_0x458a('0x28')](saveUpdates(_0x5b428c[_0x458a('0x50')],null))[_0x458a('0x28')](respondWithResult(_0x3ea8f0,null))['catch'](handleError(_0x3ea8f0,null));};exports[_0x458a('0x27')]=function(_0x212de5,_0x217a97){return db[_0x458a('0x46')][_0x458a('0x4d')]({'where':{'id':_0x212de5[_0x458a('0x57')]['id']}})['then'](handleEntityNotFound(_0x217a97,null))[_0x458a('0x28')](removeEntity(_0x217a97,null))[_0x458a('0x4e')](handleError(_0x217a97,null));};exports[_0x458a('0x58')]=function(_0x39e5b5,_0x3ab86a){return db[_0x458a('0x46')][_0x458a('0x58')]()[_0x458a('0x28')](respondWithResult(_0x3ab86a,null))['catch'](handleError(_0x3ab86a,null));};exports[_0x458a('0x59')]=function(_0x4abe93,_0x1f93ad,_0x2921ba){var _0x222aa4={'raw':!![],'where':{}},_0x42b748={},_0x4da240;return db['FaxQueue'][_0x458a('0x5a')]({'where':{'id':_0x4abe93[_0x458a('0x57')]['id']}})[_0x458a('0x28')](handleEntityNotFound(_0x1f93ad,null))[_0x458a('0x28')](function(_0x1beef7){if(_0x1beef7){_0x4da240=_0x1beef7[_0x458a('0x29')]({'plain':!![]});_0x42b748['model']=_[_0x458a('0x4c')](db[_0x458a('0x5b')]['rawAttributes']);_0x42b748[_0x458a('0x35')]=_['keys'](_0x4abe93[_0x458a('0x35')]);_0x42b748[_0x458a('0x36')]=_[_0x458a('0x37')](_0x42b748[_0x458a('0x34')],_0x42b748[_0x458a('0x35')]);_0x222aa4[_0x458a('0x38')]=_[_0x458a('0x37')](_0x42b748[_0x458a('0x34')],qs['fields'](_0x4abe93[_0x458a('0x35')][_0x458a('0x39')]));_0x222aa4['attributes']=_0x222aa4[_0x458a('0x38')][_0x458a('0x3a')]?_0x222aa4['attributes']:_0x42b748[_0x458a('0x34')];if(!_0x4abe93[_0x458a('0x35')]['hasOwnProperty'](_0x458a('0x3c'))){_0x222aa4[_0x458a('0x3d')]=qs['limit'](_0x4abe93[_0x458a('0x35')][_0x458a('0x3d')]);_0x222aa4[_0x458a('0x21')]=qs[_0x458a('0x21')](_0x4abe93[_0x458a('0x35')][_0x458a('0x21')]);}_0x222aa4[_0x458a('0x3e')]=qs[_0x458a('0x3f')](_0x4abe93['query'][_0x458a('0x3f')]);_0x222aa4[_0x458a('0x40')]=qs[_0x458a('0x36')](_[_0x458a('0x41')](_0x4abe93[_0x458a('0x35')],_0x42b748[_0x458a('0x36')]));_0x222aa4[_0x458a('0x40')][_0x458a('0x5c')]=_0x1beef7['id'];if(_0x4abe93[_0x458a('0x35')][_0x458a('0x42')]){_0x222aa4['where']=_[_0x458a('0x43')](_0x222aa4['where'],{'$or':_[_0x458a('0x30')](_0x222aa4[_0x458a('0x38')],function(_0x3bd686){var _0x2bc158={};_0x2bc158[_0x3bd686]={'$like':'%'+_0x4abe93[_0x458a('0x35')][_0x458a('0x42')]+'%'};return _0x2bc158;})});}_0x222aa4=_[_0x458a('0x43')]({},_0x222aa4,_0x4abe93[_0x458a('0x45')]);return db[_0x458a('0x5b')][_0x458a('0x49')](_0x222aa4);}})[_0x458a('0x28')](function(_0x448cbc){if(_0x448cbc){return db[_0x458a('0x5d')][_0x458a('0x5e')]({'where':{'id':_[_0x458a('0x30')](_0x448cbc,_0x458a('0x5f')),'role':'agent'},'attributes':['id',_0x458a('0x2e'),'faxPause',_0x458a('0x60'),_0x458a('0x61')]});}})['then'](function(_0xdfc430){if(_0xdfc430){return{'count':_0xdfc430[_0x458a('0x47')],'rows':_[_0x458a('0x30')](_0xdfc430['rows'],function(_0x3cf58c){return{'membername':_0x3cf58c[_0x458a('0x2e')],'UserId':_0x3cf58c['id'],'queue_name':_0x4da240[_0x458a('0x2e')],'FaxQueueId':_0x4da240['id'],'interface':util[_0x458a('0x62')](_0x458a('0x63'),_0x458a('0x64'),_0x3cf58c['name']),'penalty':0x0,'paused':_0x3cf58c[_0x458a('0x65')],'createdAt':_0x3cf58c['createdAt'],'updatedAt':_0x3cf58c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x458a('0x28')](respondWithFilteredResult(_0x1f93ad,_0x222aa4))[_0x458a('0x4e')](handleError(_0x1f93ad,null));};exports[_0x458a('0x66')]=function(_0x5e01af,_0xaf6262,_0x434d04){var _0x42eae7={};var _0x5aee0d={};var _0x3d30e2;var _0x32b33d;return db[_0x458a('0x46')][_0x458a('0x5a')]({'where':{'id':_0x5e01af[_0x458a('0x57')]['id']}})[_0x458a('0x28')](handleEntityNotFound(_0xaf6262,null))['then'](function(_0x580c4b){if(_0x580c4b){_0x3d30e2=_0x580c4b;_0x5aee0d['model']=_[_0x458a('0x4c')](db['Team'][_0x458a('0x31')]);_0x5aee0d[_0x458a('0x35')]=_[_0x458a('0x4c')](_0x5e01af[_0x458a('0x35')]);_0x5aee0d[_0x458a('0x36')]=_[_0x458a('0x37')](_0x5aee0d[_0x458a('0x34')],_0x5aee0d['query']);_0x42eae7[_0x458a('0x38')]=_[_0x458a('0x37')](_0x5aee0d['model'],qs[_0x458a('0x39')](_0x5e01af['query'][_0x458a('0x39')]));_0x42eae7['attributes']=_0x42eae7[_0x458a('0x38')][_0x458a('0x3a')]?_0x42eae7[_0x458a('0x38')]:_0x5aee0d[_0x458a('0x34')];_0x42eae7['order']=qs[_0x458a('0x3f')](_0x5e01af[_0x458a('0x35')][_0x458a('0x3f')]);_0x42eae7[_0x458a('0x40')]=qs[_0x458a('0x36')](_[_0x458a('0x41')](_0x5e01af[_0x458a('0x35')],_0x5aee0d[_0x458a('0x36')]));if(_0x5e01af['query'][_0x458a('0x42')]){_0x42eae7[_0x458a('0x40')]=_[_0x458a('0x43')](_0x42eae7[_0x458a('0x40')],{'$or':_['map'](_0x42eae7[_0x458a('0x38')],function(_0x45569b){var _0x579352={};_0x579352[_0x45569b]={'$like':'%'+_0x5e01af[_0x458a('0x35')][_0x458a('0x42')]+'%'};return _0x579352;})});}_0x42eae7=_[_0x458a('0x43')]({},_0x42eae7,_0x5e01af[_0x458a('0x45')]);return _0x3d30e2[_0x458a('0x66')](_0x42eae7);}})['then'](function(_0x34d7a6){if(_0x34d7a6){_0x32b33d=_0x34d7a6[_0x458a('0x3a')];if(!_0x5e01af[_0x458a('0x35')][_0x458a('0x3b')](_0x458a('0x3c'))){_0x42eae7[_0x458a('0x3d')]=qs[_0x458a('0x3d')](_0x5e01af['query'][_0x458a('0x3d')]);_0x42eae7['offset']=qs[_0x458a('0x21')](_0x5e01af[_0x458a('0x35')][_0x458a('0x21')]);}return _0x3d30e2['getTeams'](_0x42eae7);}})[_0x458a('0x28')](function(_0x5a1da2){if(_0x5a1da2){return _0x5a1da2?{'count':_0x32b33d,'rows':_0x5a1da2}:null;}})['then'](respondWithResult(_0xaf6262,null))[_0x458a('0x4e')](handleError(_0xaf6262,null));};exports[_0x458a('0x67')]=function(_0x5464a5,_0x480e71,_0xfc43fc){var _0x1d16c7=_0x5464a5[_0x458a('0x50')][_0x458a('0x68')];return db[_0x458a('0x69')]['findAll']({'where':{'id':_0x1d16c7},'attributes':['id'],'include':[{'model':db[_0x458a('0x5d')],'as':'Agents','attributes':['id',_0x458a('0x2e'),_0x458a('0x6a'),_0x458a('0x6b'),'interface'],'raw':!![]}]})[_0x458a('0x28')](function(_0x358267){if(_0x358267){var _0x4fa39a=_[_0x458a('0x6c')](_0x358267,function(_0x5bf72f){var _0x2c11c8=_0x5bf72f[_0x458a('0x29')]({'plain':!![]});return _0x2c11c8[_0x458a('0x6d')];});return db[_0x458a('0x46')]['find']({'where':{'id':_0x5464a5[_0x458a('0x57')]['id']}})['then'](function(_0x4a97c4){return db[_0x458a('0x6e')][_0x458a('0x6f')](function(_0x28c3e5){return _0x4a97c4[_0x458a('0x67')](_0x1d16c7,{'transaction':_0x28c3e5})[_0x458a('0x28')](function(){return BPromise[_0x458a('0x70')](_0x4fa39a,function(_0x577c45){return db[_0x458a('0x5b')][_0x458a('0x71')]({'where':{'UserId':_0x577c45['id'],'FaxQueueId':_0x5464a5[_0x458a('0x57')]['id']},'transaction':_0x28c3e5});});})[_0x458a('0x28')](function(){_0x4fa39a[_0x458a('0x72')](function(_0x1bff6a){socket['emit'](_0x458a('0x73'),{'UserId':_0x1bff6a['id'],'FaxQueueId':_0x4a97c4['id']});});});});});}})[_0x458a('0x28')](respondWithStatusCode(_0x480e71,null))[_0x458a('0x4e')](handleError(_0x480e71,null));};exports['removeTeams']=function(_0x2903c2,_0x42d2a2,_0x34f513){return db['Team']['findAll']({'where':{'id':_0x2903c2[_0x458a('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x42d2a2,null))['then'](function(_0x3f14bf){var _0x5274df=_[_0x458a('0x30')](_0x3f14bf,'id');var _0x457186=[];var _0x2adefe=[];var _0xfcb712=squel[_0x458a('0x74')]();_0xfcb712[_0x458a('0x75')]('tq.TeamId')[_0x458a('0x76')]('team_has_fax_queues','tq')[_0x458a('0x77')]('user_has_teams','ut',_0x458a('0x78'))[_0x458a('0x40')]('FaxQueueId\x20=\x20?',_0x2903c2['params']['id']);for(var _0x4f29d3=0x0;_0x4f29d3<_0x3f14bf[_0x458a('0x3a')];_0x4f29d3+=0x1){let _0x384c46=_0x3f14bf[_0x4f29d3];for(var _0x21d8a9=0x0;_0x21d8a9<_0x384c46[_0x458a('0x6d')][_0x458a('0x3a')];_0x21d8a9+=0x1){let _0x502c02=_0x384c46[_0x458a('0x6d')][_0x21d8a9];var _0x41e32f=_0xfcb712[_0x458a('0x79')]();_0x41e32f[_0x458a('0x40')](_0x458a('0x7a'),_0x502c02['id']);_0x2adefe[_0x458a('0x7b')](db[_0x458a('0x6e')][_0x458a('0x35')](_0x41e32f['toString'](),{'type':db[_0x458a('0x6e')][_0x458a('0x7c')][_0x458a('0x7d')]})[_0x458a('0x28')](function(_0xff15ec){if(_0xff15ec[_0x458a('0x3a')]===0x1){return _0x502c02['id'];}else{var _0x11b3b1=_['every'](_['map'](_0xff15ec,'TeamId'),function(_0x53a93e){return _[_0x458a('0x7e')](_0x5274df,_0x53a93e);});if(_0x11b3b1){return _0x502c02['id'];}}}));}}return BPromise[_0x458a('0x7f')](_0x2adefe)[_0x458a('0x28')](function(_0xc6b04a){_0x457186=_(_0x457186)['union'](_0xc6b04a)[_0x458a('0x80')]()[_0x458a('0x81')]();return db[_0x458a('0x46')][_0x458a('0x4d')]({'where':{'id':_0x2903c2['params']['id']}})['then'](function(_0x18a29b){return db[_0x458a('0x6e')][_0x458a('0x6f')](function(_0x27dbee){return _0x18a29b['removeTeams'](_0x2903c2[_0x458a('0x35')][_0x458a('0x68')],{'transaction':_0x27dbee})[_0x458a('0x28')](function(){if(!_[_0x458a('0x82')](_0x457186)){return _0x18a29b[_0x458a('0x83')](_0x457186,{'transaction':_0x27dbee});}})[_0x458a('0x28')](function(){_0x457186[_0x458a('0x72')](function(_0xd05241){socket[_0x458a('0x84')](_0x458a('0x85'),{'UserId':_0xd05241,'FaxQueueId':_0x18a29b['id']});});});});});});})['then'](respondWithStatusCode(_0x42d2a2,null))['catch'](handleError(_0x42d2a2,null));};exports[_0x458a('0x86')]=function(_0x365b25,_0x39715f,_0x331f5f){return db[_0x458a('0x46')][_0x458a('0x4d')]({'where':{'id':_0x365b25[_0x458a('0x57')]['id']}})['then'](handleEntityNotFound(_0x39715f,null))[_0x458a('0x28')](function(_0x5aa440){if(_0x5aa440){return _0x5aa440[_0x458a('0x86')](_0x365b25[_0x458a('0x50')][_0x458a('0x68')],_['omit'](_0x365b25['body'],[_0x458a('0x68'),'id'])||{})[_0x458a('0x87')](function(_0x241c72){for(var _0x46ee2=0x0;_0x46ee2<_0x365b25[_0x458a('0x50')]['ids'][_0x458a('0x3a')];_0x46ee2+=0x1){socket[_0x458a('0x84')](_0x458a('0x73'),{'UserId':_0x365b25[_0x458a('0x50')][_0x458a('0x68')][_0x46ee2],'FaxQueueId':_0x365b25[_0x458a('0x57')]['id']});}return _0x241c72;});}})[_0x458a('0x28')](respondWithResult(_0x39715f,null))[_0x458a('0x4e')](handleError(_0x39715f,null));};exports[_0x458a('0x83')]=function(_0x52b844,_0x3051d2,_0x543b46){return db[_0x458a('0x46')][_0x458a('0x4d')]({'where':{'id':_0x52b844[_0x458a('0x57')]['id']}})['then'](handleEntityNotFound(_0x3051d2,null))['then'](function(_0x3b7147){if(_0x3b7147){return _0x3b7147['removeAgents'](_0x52b844[_0x458a('0x35')]['ids'])[_0x458a('0x28')](function(){if(_[_0x458a('0x88')](_0x52b844[_0x458a('0x35')]['ids'])){for(var _0x1469d0=0x0;_0x1469d0<_0x52b844[_0x458a('0x35')]['ids'][_0x458a('0x3a')];_0x1469d0+=0x1){socket['emit'](_0x458a('0x85'),{'UserId':Number(_0x52b844[_0x458a('0x35')][_0x458a('0x68')][_0x1469d0]),'FaxQueueId':Number(_0x52b844['params']['id'])});}}else{socket[_0x458a('0x84')](_0x458a('0x85'),{'UserId':Number(_0x52b844[_0x458a('0x35')][_0x458a('0x68')]),'FaxQueueId':Number(_0x52b844[_0x458a('0x57')]['id'])});}});}})[_0x458a('0x28')](respondWithStatusCode(_0x3051d2,null))['catch'](handleError(_0x3051d2,null));};exports[_0x458a('0x89')]=function(_0x396f51,_0x57cd4b,_0x13db18){var _0x187bc8={};var _0x197858={};var _0x48622f;var _0x83eeac;return db[_0x458a('0x46')][_0x458a('0x5a')]({'where':{'id':_0x396f51['params']['id']}})[_0x458a('0x28')](handleEntityNotFound(_0x57cd4b,null))[_0x458a('0x28')](function(_0x16bfbe){if(_0x16bfbe){_0x48622f=_0x16bfbe;_0x197858[_0x458a('0x34')]=_[_0x458a('0x4c')](db[_0x458a('0x5d')][_0x458a('0x31')]);_0x197858[_0x458a('0x35')]=_['keys'](_0x396f51[_0x458a('0x35')]);_0x197858['filters']=_['intersection'](_0x197858[_0x458a('0x34')],_0x197858[_0x458a('0x35')]);_0x187bc8['attributes']=_[_0x458a('0x37')](_0x197858['model'],qs[_0x458a('0x39')](_0x396f51['query'][_0x458a('0x39')]));_0x187bc8[_0x458a('0x38')]=_0x187bc8[_0x458a('0x38')][_0x458a('0x3a')]?_0x187bc8['attributes']:_0x197858[_0x458a('0x34')];_0x187bc8[_0x458a('0x3e')]=qs[_0x458a('0x3f')](_0x396f51['query'][_0x458a('0x3f')]);_0x187bc8[_0x458a('0x40')]=qs[_0x458a('0x36')](_[_0x458a('0x41')](_0x396f51['query'],_0x197858[_0x458a('0x36')]));if(_0x396f51['query']['filter']){_0x187bc8['where']=_[_0x458a('0x43')](_0x187bc8[_0x458a('0x40')],{'$or':_['map'](_0x187bc8[_0x458a('0x38')],function(_0x49297c){var _0x2545eb={};_0x2545eb[_0x49297c]={'$like':'%'+_0x396f51['query'][_0x458a('0x42')]+'%'};return _0x2545eb;})});}_0x187bc8=_['merge']({},_0x187bc8,_0x396f51[_0x458a('0x45')]);return _0x48622f[_0x458a('0x89')](_0x187bc8);}})[_0x458a('0x28')](function(_0x150ae8){if(_0x150ae8){_0x83eeac=_0x150ae8[_0x458a('0x3a')];if(!_0x396f51[_0x458a('0x35')][_0x458a('0x3b')]('nolimit')){_0x187bc8[_0x458a('0x3d')]=qs[_0x458a('0x3d')](_0x396f51[_0x458a('0x35')]['limit']);_0x187bc8['offset']=qs[_0x458a('0x21')](_0x396f51[_0x458a('0x35')][_0x458a('0x21')]);}return _0x48622f[_0x458a('0x89')](_0x187bc8);}})[_0x458a('0x28')](function(_0x4856b4){if(_0x4856b4){return _0x4856b4?{'count':_0x83eeac,'rows':_0x4856b4}:null;}})[_0x458a('0x28')](respondWithResult(_0x57cd4b,null))[_0x458a('0x4e')](handleError(_0x57cd4b,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e141807..2738f21 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 _0xdbf8=['hook','exports','events','FaxQueue','setMaxListeners','update','remove','emit'];(function(_0x27fdc6,_0x191b73){var _0xcccb0e=function(_0x5603fa){while(--_0x5603fa){_0x27fdc6['push'](_0x27fdc6['shift']());}};_0xcccb0e(++_0x191b73);}(_0xdbf8,0x162));var _0x8dbf=function(_0x33c7b5,_0x3f207d){_0x33c7b5=_0x33c7b5-0x0;var _0x5d7127=_0xdbf8[_0x33c7b5];return _0x5d7127;};'use strict';var EventEmitter=require(_0x8dbf('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x8dbf('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8dbf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8dbf('0x3'),'afterDestroy':_0x8dbf('0x4')};function emitEvent(_0x5d19f2){return function(_0x44db10,_0x4873de,_0x1b97ca){FaxQueueEvents['emit'](_0x5d19f2+':'+_0x44db10['id'],_0x44db10);FaxQueueEvents[_0x8dbf('0x5')](_0x5d19f2,_0x44db10);_0x1b97ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x8dbf('0x6')](e,emitEvent(event));}}module[_0x8dbf('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xdc71=['exports','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x39ccd2,_0x21d13f){var _0x705c8e=function(_0x28ba01){while(--_0x28ba01){_0x39ccd2['push'](_0x39ccd2['shift']());}};_0x705c8e(++_0x21d13f);}(_0xdc71,0xb5));var _0x1dc7=function(_0x4977e8,_0x33dead){_0x4977e8=_0x4977e8-0x0;var _0x4fdc8f=_0xdc71[_0x4977e8];return _0x4fdc8f;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x1dc7('0x0'))['db'][_0x1dc7('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1dc7('0x2')](0x0);var events={'afterCreate':_0x1dc7('0x3'),'afterUpdate':_0x1dc7('0x4'),'afterDestroy':_0x1dc7('0x5')};function emitEvent(_0x4f00cd){return function(_0x49b1bc,_0x31326c,_0xf388d2){FaxQueueEvents[_0x1dc7('0x6')](_0x4f00cd+':'+_0x49b1bc['id'],_0x49b1bc);FaxQueueEvents[_0x1dc7('0x6')](_0x4f00cd,_0x49b1bc);_0xf388d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x1dc7('0x7')](e,emitEvent(event));}}module[_0x1dc7('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index f738cd1..4298d3e 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 _0xe8c2=['exports','define','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0xe8c2,0x1d7));var _0x2e8c=function(_0x3b5640,_0x3ec34e){_0x3b5640=_0x3b5640-0x0;var _0x1a6ecd=_0xe8c2[_0x3b5640];return _0x1a6ecd;};'use strict';var _=require(_0x2e8c('0x0'));var util=require(_0x2e8c('0x1'));var logger=require(_0x2e8c('0x2'))(_0x2e8c('0x3'));var moment=require(_0x2e8c('0x4'));var BPromise=require(_0x2e8c('0x5'));var rp=require(_0x2e8c('0x6'));var fs=require('fs');var path=require(_0x2e8c('0x7'));var rimraf=require(_0x2e8c('0x8'));var config=require('../../config/environment');var attributes=require(_0x2e8c('0x9'));module[_0x2e8c('0xa')]=function(_0x43d933,_0x122bd2){return _0x43d933[_0x2e8c('0xb')](_0x2e8c('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e74=['define','FaxQueue','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports'];(function(_0x29077c,_0x51e78c){var _0x936b02=function(_0x235174){while(--_0x235174){_0x29077c['push'](_0x29077c['shift']());}};_0x936b02(++_0x51e78c);}(_0x1e74,0x86));var _0x41e7=function(_0x213947,_0x13d60d){_0x213947=_0x213947-0x0;var _0x4f70d8=_0x1e74[_0x213947];return _0x4f70d8;};'use strict';var _=require(_0x41e7('0x0'));var util=require(_0x41e7('0x1'));var logger=require(_0x41e7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x41e7('0x3'));var rp=require(_0x41e7('0x4'));var fs=require('fs');var path=require(_0x41e7('0x5'));var rimraf=require(_0x41e7('0x6'));var config=require('../../config/environment');var attributes=require(_0x41e7('0x7'));module[_0x41e7('0x8')]=function(_0x18412a,_0x347c20){return _0x18412a[_0x41e7('0x9')](_0x41e7('0xa'),attributes,{'tableName':'fax_queues','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 49835d4..6931ab4 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 _0x076b=['request\x20sent','debug','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowFaxQueue','FaxQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info'];(function(_0xa990b7,_0x26c527){var _0x52c99c=function(_0xf94328){while(--_0xf94328){_0xa990b7['push'](_0xa990b7['shift']());}};_0x52c99c(++_0x26c527);}(_0x076b,0xb6));var _0xb076=function(_0x77eb0b,_0x2c2414){_0x77eb0b=_0x77eb0b-0x0;var _0x3d8316=_0x076b[_0x77eb0b];return _0x3d8316;};'use strict';var _=require(_0xb076('0x0'));var util=require(_0xb076('0x1'));var moment=require('moment');var BPromise=require(_0xb076('0x2'));var rs=require(_0xb076('0x3'));var fs=require('fs');var Redis=require(_0xb076('0x4'));var db=require(_0xb076('0x5'))['db'];var utils=require(_0xb076('0x6'));var logger=require('../../config/logger')(_0xb076('0x7'));var config=require('../../config/environment');var jayson=require(_0xb076('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xb076('0x9')]=_[_0xb076('0xa')](config[_0xb076('0x9')],{'host':_0xb076('0xb'),'port':0x18eb});var socket=require(_0xb076('0xc'))(new Redis(config[_0xb076('0x9')]));require(_0xb076('0xd'))[_0xb076('0xe')](socket);function respondWithRpcPromise(_0x3a660d,_0x391ecd,_0x1dbaa2){return new BPromise(function(_0x17fd27,_0x2890de){return client[_0xb076('0xf')](_0x3a660d,_0x1dbaa2)[_0xb076('0x10')](function(_0x400c23){logger[_0xb076('0x11')]('FaxQueue,\x20%s,\x20%s',_0x391ecd,_0xb076('0x12'));logger[_0xb076('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x391ecd,_0xb076('0x12'),JSON['stringify'](_0x400c23));if(_0x400c23[_0xb076('0x14')]){if(_0x400c23[_0xb076('0x14')][_0xb076('0x15')]===0x1f4){logger[_0xb076('0x14')](_0xb076('0x16'),_0x391ecd,_0x400c23[_0xb076('0x14')][_0xb076('0x17')]);return _0x2890de(_0x400c23[_0xb076('0x14')][_0xb076('0x17')]);}logger[_0xb076('0x14')](_0xb076('0x16'),_0x391ecd,_0x400c23[_0xb076('0x14')]['message']);return _0x17fd27(_0x400c23['error'][_0xb076('0x17')]);}else{logger[_0xb076('0x11')]('FaxQueue,\x20%s,\x20%s',_0x391ecd,'request\x20sent');_0x17fd27(_0x400c23[_0xb076('0x18')]['message']);}})[_0xb076('0x19')](function(_0x197465){logger[_0xb076('0x14')](_0xb076('0x16'),_0x391ecd,_0x197465);_0x2890de(_0x197465);});});}exports[_0xb076('0x1a')]=function(_0xbc1e78){var _0x2731ce=this;return new Promise(function(_0xbcd73b,_0x3cc812){return db['FaxQueue'][_0xb076('0x1b')]({'raw':_0xbc1e78[_0xb076('0x1c')]?_0xbc1e78[_0xb076('0x1c')][_0xb076('0x1d')]===undefined?!![]:![]:!![],'where':_0xbc1e78['options']?_0xbc1e78[_0xb076('0x1c')][_0xb076('0x1e')]||null:null,'attributes':_0xbc1e78[_0xb076('0x1c')]?_0xbc1e78[_0xb076('0x1c')][_0xb076('0x1f')]||null:null,'limit':_0xbc1e78[_0xb076('0x1c')]?_0xbc1e78['options'][_0xb076('0x20')]||null:null,'include':_0xbc1e78['options']?_0xbc1e78[_0xb076('0x1c')][_0xb076('0x21')]?_['map'](_0xbc1e78['options'][_0xb076('0x21')],function(_0x487022){return{'model':db[_0x487022[_0xb076('0x22')]],'as':_0x487022['as'],'attributes':_0x487022['attributes'],'include':_0x487022[_0xb076('0x21')]?_['map'](_0x487022[_0xb076('0x21')],function(_0x59e96b){return{'model':db[_0x59e96b[_0xb076('0x22')]],'as':_0x59e96b['as'],'attributes':_0x59e96b[_0xb076('0x1f')],'include':_0x59e96b['include']?_[_0xb076('0x23')](_0x59e96b[_0xb076('0x21')],function(_0x56bd5d){return{'model':db[_0x56bd5d['model']],'as':_0x56bd5d['as'],'attributes':_0x56bd5d[_0xb076('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x338fb6){logger[_0xb076('0x11')](_0xb076('0x1a'),_0xbc1e78);logger['debug']('GetFaxQueue',_0xbc1e78,JSON[_0xb076('0x24')](_0x338fb6));_0xbcd73b(_0x338fb6);})[_0xb076('0x19')](function(_0x2b7ec3){logger[_0xb076('0x14')](_0xb076('0x1a'),_0x2b7ec3[_0xb076('0x17')],_0xbc1e78);_0x3cc812(_0x2731ce[_0xb076('0x14')](0x1f4,_0x2b7ec3[_0xb076('0x17')]));});});};exports[_0xb076('0x25')]=function(_0x2caa8b){var _0x434a7e=this;return new Promise(function(_0x3ed725,_0x16f14f){return db[_0xb076('0x26')][_0xb076('0x27')]({'raw':_0x2caa8b['options']?_0x2caa8b['options'][_0xb076('0x1d')]===undefined?!![]:![]:!![],'where':_0x2caa8b[_0xb076('0x1c')]?_0x2caa8b[_0xb076('0x1c')][_0xb076('0x1e')]||null:null,'attributes':_0x2caa8b[_0xb076('0x1c')]?_0x2caa8b[_0xb076('0x1c')][_0xb076('0x1f')]||null:null,'include':_0x2caa8b[_0xb076('0x1c')]?_0x2caa8b['options'][_0xb076('0x21')]?_['map'](_0x2caa8b['options'][_0xb076('0x21')],function(_0x18df0c){return{'model':db[_0x18df0c[_0xb076('0x22')]],'as':_0x18df0c['as'],'attributes':_0x18df0c[_0xb076('0x1f')],'include':_0x18df0c[_0xb076('0x21')]?_['map'](_0x18df0c[_0xb076('0x21')],function(_0x3113a7){return{'model':db[_0x3113a7[_0xb076('0x22')]],'as':_0x3113a7['as'],'attributes':_0x3113a7['attributes'],'include':_0x3113a7[_0xb076('0x21')]?_[_0xb076('0x23')](_0x3113a7[_0xb076('0x21')],function(_0x1b0ebd){return{'model':db[_0x1b0ebd[_0xb076('0x22')]],'as':_0x1b0ebd['as'],'attributes':_0x1b0ebd[_0xb076('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb076('0x10')](function(_0x55c307){logger[_0xb076('0x11')](_0xb076('0x25'),_0x2caa8b);logger[_0xb076('0x13')](_0xb076('0x25'),_0x2caa8b,JSON[_0xb076('0x24')](_0x55c307));_0x3ed725(_0x55c307);})[_0xb076('0x19')](function(_0x2cdb2f){logger['error']('ShowFaxQueue',_0x2cdb2f[_0xb076('0x17')],_0x2caa8b);_0x16f14f(_0x434a7e[_0xb076('0x14')](0x1f4,_0x2cdb2f[_0xb076('0x17')]));});});}; \ No newline at end of file +var _0xd0e5=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','map','model','ShowFaxQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','redis','request'];(function(_0x5e6450,_0x112765){var _0x34071=function(_0x251048){while(--_0x251048){_0x5e6450['push'](_0x5e6450['shift']());}};_0x34071(++_0x112765);}(_0xd0e5,0xa2));var _0x5d0e=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0xd0e5[_0x34eb31];return _0x254994;};'use strict';var _=require(_0x5d0e('0x0'));var util=require(_0x5d0e('0x1'));var moment=require('moment');var BPromise=require(_0x5d0e('0x2'));var rs=require(_0x5d0e('0x3'));var fs=require('fs');var Redis=require(_0x5d0e('0x4'));var db=require(_0x5d0e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d0e('0x6'))(_0x5d0e('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d0e('0x8'));var client=jayson[_0x5d0e('0x9')]['http']({'port':0x232a});config['redis']=_[_0x5d0e('0xa')](config[_0x5d0e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1cf513,_0x4bd514,_0x331aac){return new BPromise(function(_0x29f185,_0x491eee){return client[_0x5d0e('0xc')](_0x1cf513,_0x331aac)[_0x5d0e('0xd')](function(_0x3d3587){logger[_0x5d0e('0xe')](_0x5d0e('0xf'),_0x4bd514,_0x5d0e('0x10'));logger[_0x5d0e('0x11')](_0x5d0e('0x12'),_0x4bd514,'request\x20sent',JSON[_0x5d0e('0x13')](_0x3d3587));if(_0x3d3587[_0x5d0e('0x14')]){if(_0x3d3587[_0x5d0e('0x14')]['code']===0x1f4){logger[_0x5d0e('0x14')]('FaxQueue,\x20%s,\x20%s',_0x4bd514,_0x3d3587[_0x5d0e('0x14')]['message']);return _0x491eee(_0x3d3587[_0x5d0e('0x14')][_0x5d0e('0x15')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x4bd514,_0x3d3587[_0x5d0e('0x14')][_0x5d0e('0x15')]);return _0x29f185(_0x3d3587[_0x5d0e('0x14')][_0x5d0e('0x15')]);}else{logger[_0x5d0e('0xe')](_0x5d0e('0xf'),_0x4bd514,_0x5d0e('0x10'));_0x29f185(_0x3d3587['result'][_0x5d0e('0x15')]);}})[_0x5d0e('0x16')](function(_0x2225dd){logger[_0x5d0e('0x14')](_0x5d0e('0xf'),_0x4bd514,_0x2225dd);_0x491eee(_0x2225dd);});});}exports[_0x5d0e('0x17')]=function(_0x2b41c1){var _0x1f3e0c=this;return new Promise(function(_0x3fa149,_0x4d0653){return db[_0x5d0e('0x18')][_0x5d0e('0x19')]({'raw':_0x2b41c1[_0x5d0e('0x1a')]?_0x2b41c1[_0x5d0e('0x1a')][_0x5d0e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b41c1[_0x5d0e('0x1a')]?_0x2b41c1[_0x5d0e('0x1a')][_0x5d0e('0x1c')]||null:null,'attributes':_0x2b41c1[_0x5d0e('0x1a')]?_0x2b41c1[_0x5d0e('0x1a')][_0x5d0e('0x1d')]||null:null,'limit':_0x2b41c1[_0x5d0e('0x1a')]?_0x2b41c1[_0x5d0e('0x1a')]['limit']||null:null,'include':_0x2b41c1[_0x5d0e('0x1a')]?_0x2b41c1[_0x5d0e('0x1a')][_0x5d0e('0x1e')]?_[_0x5d0e('0x1f')](_0x2b41c1['options'][_0x5d0e('0x1e')],function(_0x25c4fd){return{'model':db[_0x25c4fd['model']],'as':_0x25c4fd['as'],'attributes':_0x25c4fd[_0x5d0e('0x1d')],'include':_0x25c4fd[_0x5d0e('0x1e')]?_['map'](_0x25c4fd['include'],function(_0x2b2c40){return{'model':db[_0x2b2c40[_0x5d0e('0x20')]],'as':_0x2b2c40['as'],'attributes':_0x2b2c40['attributes'],'include':_0x2b2c40['include']?_[_0x5d0e('0x1f')](_0x2b2c40[_0x5d0e('0x1e')],function(_0x30d9e4){return{'model':db[_0x30d9e4[_0x5d0e('0x20')]],'as':_0x30d9e4['as'],'attributes':_0x30d9e4[_0x5d0e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5d0e('0xd')](function(_0x173101){logger['info'](_0x5d0e('0x17'),_0x2b41c1);logger[_0x5d0e('0x11')](_0x5d0e('0x17'),_0x2b41c1,JSON['stringify'](_0x173101));_0x3fa149(_0x173101);})[_0x5d0e('0x16')](function(_0x265b31){logger['error'](_0x5d0e('0x17'),_0x265b31[_0x5d0e('0x15')],_0x2b41c1);_0x4d0653(_0x1f3e0c['error'](0x1f4,_0x265b31['message']));});});};exports[_0x5d0e('0x21')]=function(_0x2ac7f4){var _0x5297af=this;return new Promise(function(_0x13ff1d,_0x2d24f2){return db['FaxQueue'][_0x5d0e('0x22')]({'raw':_0x2ac7f4[_0x5d0e('0x1a')]?_0x2ac7f4[_0x5d0e('0x1a')][_0x5d0e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ac7f4[_0x5d0e('0x1a')]?_0x2ac7f4[_0x5d0e('0x1a')]['where']||null:null,'attributes':_0x2ac7f4[_0x5d0e('0x1a')]?_0x2ac7f4['options'][_0x5d0e('0x1d')]||null:null,'include':_0x2ac7f4[_0x5d0e('0x1a')]?_0x2ac7f4[_0x5d0e('0x1a')]['include']?_[_0x5d0e('0x1f')](_0x2ac7f4[_0x5d0e('0x1a')][_0x5d0e('0x1e')],function(_0x10ceaf){return{'model':db[_0x10ceaf['model']],'as':_0x10ceaf['as'],'attributes':_0x10ceaf[_0x5d0e('0x1d')],'include':_0x10ceaf['include']?_['map'](_0x10ceaf[_0x5d0e('0x1e')],function(_0x14508e){return{'model':db[_0x14508e[_0x5d0e('0x20')]],'as':_0x14508e['as'],'attributes':_0x14508e['attributes'],'include':_0x14508e[_0x5d0e('0x1e')]?_[_0x5d0e('0x1f')](_0x14508e[_0x5d0e('0x1e')],function(_0x539c49){return{'model':db[_0x539c49[_0x5d0e('0x20')]],'as':_0x539c49['as'],'attributes':_0x539c49[_0x5d0e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5d0e('0xd')](function(_0x4dd169){logger['info'](_0x5d0e('0x21'),_0x2ac7f4);logger[_0x5d0e('0x11')]('ShowFaxQueue',_0x2ac7f4,JSON[_0x5d0e('0x13')](_0x4dd169));_0x13ff1d(_0x4dd169);})['catch'](function(_0x1d05be){logger[_0x5d0e('0x14')](_0x5d0e('0x21'),_0x1d05be[_0x5d0e('0x15')],_0x2ac7f4);_0x2d24f2(_0x5297af[_0x5d0e('0x14')](0x1f4,_0x1d05be[_0x5d0e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index fbe1d0f..a5d878f 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 _0x5a20=['length','faxQueue:','save','remove','update','emit','removeListener','register'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0x5a20,0xea));var _0x05a2=function(_0x29b778,_0x620b7b){_0x29b778=_0x29b778-0x0;var _0x561839=_0x5a20[_0x29b778];return _0x561839;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x05a2('0x0'),_0x05a2('0x1'),_0x05a2('0x2')];function createListener(_0x326dfe,_0x56afda){return function(_0x411f97){_0x56afda[_0x05a2('0x3')](_0x326dfe,_0x411f97);};}function removeListener(_0x13b082,_0x1786fc){return function(){FaxQueueEvents[_0x05a2('0x4')](_0x13b082,_0x1786fc);};}exports[_0x05a2('0x5')]=function(_0x2dd9d0){for(var _0x29be91=0x0,_0x38b5e1=events[_0x05a2('0x6')];_0x29be91<_0x38b5e1;_0x29be91++){var _0x49041b=events[_0x29be91];var _0x4356d2=createListener(_0x05a2('0x7')+_0x49041b,_0x2dd9d0);FaxQueueEvents['on'](_0x49041b,_0x4356d2);}}; \ No newline at end of file +var _0x0ff0=['./faxQueue.events','emit','removeListener','register','length','faxQueue:'];(function(_0x2bdb3d,_0x358bf7){var _0x27a292=function(_0x9d9458){while(--_0x9d9458){_0x2bdb3d['push'](_0x2bdb3d['shift']());}};_0x27a292(++_0x358bf7);}(_0x0ff0,0x1e0));var _0x00ff=function(_0x48ecb1,_0x530dc8){_0x48ecb1=_0x48ecb1-0x0;var _0x5ccb53=_0x0ff0[_0x48ecb1];return _0x5ccb53;};'use strict';var FaxQueueEvents=require(_0x00ff('0x0'));var events=['save','remove','update'];function createListener(_0x5495ba,_0x5572f3){return function(_0x2e5cf7){_0x5572f3[_0x00ff('0x1')](_0x5495ba,_0x2e5cf7);};}function removeListener(_0x1b922a,_0x169936){return function(){FaxQueueEvents[_0x00ff('0x2')](_0x1b922a,_0x169936);};}exports[_0x00ff('0x3')]=function(_0x683970){for(var _0x20b402=0x0,_0x26978f=events[_0x00ff('0x4')];_0x20b402<_0x26978f;_0x20b402++){var _0x2f574f=events[_0x20b402];var _0x13a1df=createListener(_0x00ff('0x5')+_0x2f574f,_0x683970);FaxQueueEvents['on'](_0x2f574f,_0x13a1df);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index d324a77..72ca507 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 _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x2fd69d,_0xeb1037){var _0x5d5ef3=function(_0xa9ea9e){while(--_0xa9ea9e){_0x2fd69d['push'](_0x2fd69d['shift']());}};_0x5d5ef3(++_0xeb1037);}(_0x0b0e,0x187));var _0xe0b0=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0x0b0e[_0x200827];return _0x120047;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x50a448,_0x3d1a4d){_0x50a448=_0x50a448-0x0;var _0x5da8c6=_0x0b0e[_0x50a448];return _0x5da8c6;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);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 3de9377..2d4e9fb 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 _0xa009=['sequelize','exports','DATE','STRING'];(function(_0x1c757c,_0xc1ee20){var _0x19cba6=function(_0x2b7339){while(--_0x2b7339){_0x1c757c['push'](_0x1c757c['shift']());}};_0x19cba6(++_0xc1ee20);}(_0xa009,0xa8));var _0x9a00=function(_0x4a05a2,_0x46f343){_0x4a05a2=_0x4a05a2-0x0;var _0x557e0b=_0xa009[_0x4a05a2];return _0x557e0b;};'use strict';var moment=require('moment');var Sequelize=require(_0x9a00('0x0'));module[_0x9a00('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9a00('0x2')]},'leaveAt':{'type':Sequelize[_0x9a00('0x2')]},'acceptAt':{'type':Sequelize[_0x9a00('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9a00('0x3')]}}; \ No newline at end of file +var _0xdd06=['sequelize','exports','STRING','DATE','moment'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xdd06,0xdb));var _0x6dd0=function(_0x2608cc,_0x550602){_0x2608cc=_0x2608cc-0x0;var _0x671ece=_0xdd06[_0x2608cc];return _0x671ece;};'use strict';var moment=require(_0x6dd0('0x0'));var Sequelize=require(_0x6dd0('0x1'));module[_0x6dd0('0x2')]={'uniqueid':{'type':Sequelize[_0x6dd0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6dd0('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6dd0('0x4')]},'exitAt':{'type':Sequelize[_0x6dd0('0x4')]},'reason':{'type':Sequelize[_0x6dd0('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index aff6a49..c3480bb 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 _0x5abb=['intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','FaxQueueReport','fieldName','key','query','filters'];(function(_0x3a8b41,_0x122312){var _0x19cb35=function(_0x133570){while(--_0x133570){_0x3a8b41['push'](_0x3a8b41['shift']());}};_0x19cb35(++_0x122312);}(_0x5abb,0x169));var _0xb5ab=function(_0x422dce,_0xeab4b1){_0x422dce=_0x422dce-0x0;var _0x44f692=_0x5abb[_0x422dce];return _0x44f692;};'use strict';var pdf=require(_0xb5ab('0x0'));var emlformat=require(_0xb5ab('0x1'));var rimraf=require(_0xb5ab('0x2'));var zipdir=require(_0xb5ab('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5ab('0x4'));var moment=require(_0xb5ab('0x5'));var BPromise=require(_0xb5ab('0x6'));var Mustache=require('mustache');var util=require(_0xb5ab('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb5ab('0x8'));var ejs=require(_0xb5ab('0x9'));var fs=require('fs');var _=require(_0xb5ab('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb5ab('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb5ab('0xb'));var qs=require(_0xb5ab('0xc'));var as=require(_0xb5ab('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5ab('0xe'))('api');var utils=require(_0xb5ab('0xf'));var config=require(_0xb5ab('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ea924,_0x23ff2f){_0x23ff2f=_0x23ff2f||0xcc;return function(_0x1d4d5e){if(_0x1d4d5e){return _0x4ea924[_0xb5ab('0x11')](_0x23ff2f);}return _0x4ea924[_0xb5ab('0x12')](_0x23ff2f)[_0xb5ab('0x13')]();};}function respondWithResult(_0x1ae79b,_0x38cfa5){_0x38cfa5=_0x38cfa5||0xc8;return function(_0x4bfe87){if(_0x4bfe87){return _0x1ae79b[_0xb5ab('0x12')](_0x38cfa5)[_0xb5ab('0x14')](_0x4bfe87);}};}function respondWithFilteredResult(_0x5aa63b,_0x346bac){return function(_0x439d6a){if(_0x439d6a){var _0x34a996=_0x439d6a[_0xb5ab('0x15')],_0x46ef2e=_0x346bac[_0xb5ab('0x16')],_0x360ed5=_0x346bac[_0xb5ab('0x16')]+_0x346bac[_0xb5ab('0x17')],_0x4d6155;if(_0x360ed5>=_0x34a996){_0x360ed5=_0x34a996;_0x4d6155=0xc8;}else{_0x4d6155=0xce;}_0x5aa63b[_0xb5ab('0x12')](_0x4d6155);return _0x5aa63b[_0xb5ab('0x18')](_0xb5ab('0x19'),_0x46ef2e+'-'+_0x360ed5+'/'+_0x34a996)[_0xb5ab('0x14')](_0x439d6a);}return null;};}function patchUpdates(_0x38f6d7){return function(_0x5c1d94){try{jsonpatch[_0xb5ab('0x1a')](_0x5c1d94,_0x38f6d7,!![]);}catch(_0x91f663){return BPromise[_0xb5ab('0x1b')](_0x91f663);}return _0x5c1d94['save']();};}function saveUpdates(_0x2fb402,_0x3afbb2){return function(_0x99b8e5){if(_0x99b8e5){return _0x99b8e5['update'](_0x2fb402)[_0xb5ab('0x1c')](function(_0x240937){return _0x240937;});}return null;};}function removeEntity(_0x101198,_0x303020){return function(_0x3ef09c){if(_0x3ef09c){return _0x3ef09c[_0xb5ab('0x1d')]()['then'](function(){_0x101198[_0xb5ab('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113ef,_0xbb0789){return function(_0x2508c1){if(!_0x2508c1){_0x113ef['sendStatus'](0x194);}return _0x2508c1;};}function handleError(_0x561653,_0x301062){_0x301062=_0x301062||0x1f4;return function(_0x5044ea){logger[_0xb5ab('0x1e')](_0x5044ea[_0xb5ab('0x1f')]);if(_0x5044ea[_0xb5ab('0x20')]){delete _0x5044ea['name'];}_0x561653[_0xb5ab('0x12')](_0x301062)[_0xb5ab('0x21')](_0x5044ea);};}exports[_0xb5ab('0x22')]=function(_0x4fce66,_0x4357cd){var _0x4d7335={},_0x268657={},_0x24c0f6={'count':0x0,'rows':[]};var _0x2fa1ba=_[_0xb5ab('0x23')](db[_0xb5ab('0x24')]['rawAttributes'],function(_0x16fd7c){return{'name':_0x16fd7c[_0xb5ab('0x25')],'type':_0x16fd7c['type'][_0xb5ab('0x26')]};});_0x268657['model']=_[_0xb5ab('0x23')](_0x2fa1ba,_0xb5ab('0x20'));_0x268657[_0xb5ab('0x27')]=_['keys'](_0x4fce66[_0xb5ab('0x27')]);_0x268657[_0xb5ab('0x28')]=_[_0xb5ab('0x29')](_0x268657[_0xb5ab('0x2a')],_0x268657[_0xb5ab('0x27')]);_0x4d7335[_0xb5ab('0x2b')]=_['intersection'](_0x268657['model'],qs[_0xb5ab('0x2c')](_0x4fce66[_0xb5ab('0x27')][_0xb5ab('0x2c')]));_0x4d7335[_0xb5ab('0x2b')]=_0x4d7335['attributes'][_0xb5ab('0x2d')]?_0x4d7335[_0xb5ab('0x2b')]:_0x268657[_0xb5ab('0x2a')];if(!_0x4fce66[_0xb5ab('0x27')][_0xb5ab('0x2e')]('nolimit')){_0x4d7335['limit']=qs[_0xb5ab('0x17')](_0x4fce66['query']['limit']);_0x4d7335[_0xb5ab('0x16')]=qs[_0xb5ab('0x16')](_0x4fce66[_0xb5ab('0x27')]['offset']);}_0x4d7335['order']=qs['sort'](_0x4fce66[_0xb5ab('0x27')][_0xb5ab('0x2f')]);_0x4d7335[_0xb5ab('0x30')]=qs[_0xb5ab('0x28')](_[_0xb5ab('0x31')](_0x4fce66['query'],_0x268657[_0xb5ab('0x28')]),_0x2fa1ba);if(_0x4fce66[_0xb5ab('0x27')][_0xb5ab('0x32')]){_0x4d7335[_0xb5ab('0x30')]=_[_0xb5ab('0x33')](_0x4d7335['where'],{'$or':_[_0xb5ab('0x23')](_0x2fa1ba,function(_0x43a84b){if(_0x43a84b[_0xb5ab('0x34')]!==_0xb5ab('0x35')){var _0xba9417={};_0xba9417[_0x43a84b[_0xb5ab('0x20')]]={'$like':'%'+_0x4fce66[_0xb5ab('0x27')]['filter']+'%'};return _0xba9417;}})});}_0x4d7335=_[_0xb5ab('0x33')]({},_0x4d7335,_0x4fce66[_0xb5ab('0x36')]);var _0x173982={'where':_0x4d7335[_0xb5ab('0x30')]};return db[_0xb5ab('0x24')]['count'](_0x173982)[_0xb5ab('0x1c')](function(_0x53f1f6){_0x24c0f6['count']=_0x53f1f6;if(_0x4fce66[_0xb5ab('0x27')][_0xb5ab('0x37')]){_0x4d7335[_0xb5ab('0x38')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xb5ab('0x39')](_0x4d7335);})[_0xb5ab('0x1c')](function(_0x3b9814){_0x24c0f6[_0xb5ab('0x3a')]=_0x3b9814;return _0x24c0f6;})[_0xb5ab('0x1c')](respondWithFilteredResult(_0x4357cd,_0x4d7335))[_0xb5ab('0x3b')](handleError(_0x4357cd,null));};exports[_0xb5ab('0x3c')]=function(_0x3524a8,_0x293a7c){var _0x22690f={'raw':!![],'where':{'id':_0x3524a8[_0xb5ab('0x3d')]['id']}},_0x54a5e7={};_0x54a5e7[_0xb5ab('0x2a')]=_[_0xb5ab('0x3e')](db['FaxQueueReport']['rawAttributes']);_0x54a5e7[_0xb5ab('0x27')]=_[_0xb5ab('0x3e')](_0x3524a8[_0xb5ab('0x27')]);_0x54a5e7[_0xb5ab('0x28')]=_[_0xb5ab('0x29')](_0x54a5e7[_0xb5ab('0x2a')],_0x54a5e7['query']);_0x22690f[_0xb5ab('0x2b')]=_[_0xb5ab('0x29')](_0x54a5e7[_0xb5ab('0x2a')],qs['fields'](_0x3524a8[_0xb5ab('0x27')][_0xb5ab('0x2c')]));_0x22690f[_0xb5ab('0x2b')]=_0x22690f[_0xb5ab('0x2b')]['length']?_0x22690f[_0xb5ab('0x2b')]:_0x54a5e7['model'];if(_0x3524a8[_0xb5ab('0x27')]['includeAll']){_0x22690f[_0xb5ab('0x38')]=[{'all':!![]}];}_0x22690f=_[_0xb5ab('0x33')]({},_0x22690f,_0x3524a8[_0xb5ab('0x36')]);return db[_0xb5ab('0x24')][_0xb5ab('0x3f')](_0x22690f)[_0xb5ab('0x1c')](handleEntityNotFound(_0x293a7c,null))[_0xb5ab('0x1c')](respondWithResult(_0x293a7c,null))[_0xb5ab('0x3b')](handleError(_0x293a7c,null));};exports['create']=function(_0xb00c0d,_0x4482fd){return db[_0xb5ab('0x24')]['create'](_0xb00c0d[_0xb5ab('0x40')],{})[_0xb5ab('0x1c')](respondWithResult(_0x4482fd,0xc9))[_0xb5ab('0x3b')](handleError(_0x4482fd,null));};exports[_0xb5ab('0x41')]=function(_0x3d639a,_0x170493){if(_0x3d639a['body']['id']){delete _0x3d639a[_0xb5ab('0x40')]['id'];}return db[_0xb5ab('0x24')]['find']({'where':{'id':_0x3d639a['params']['id']}})[_0xb5ab('0x1c')](handleEntityNotFound(_0x170493,null))[_0xb5ab('0x1c')](saveUpdates(_0x3d639a[_0xb5ab('0x40')],null))[_0xb5ab('0x1c')](respondWithResult(_0x170493,null))[_0xb5ab('0x3b')](handleError(_0x170493,null));};exports[_0xb5ab('0x1d')]=function(_0x44b0ae,_0x35b23e){return db[_0xb5ab('0x24')][_0xb5ab('0x3f')]({'where':{'id':_0x44b0ae[_0xb5ab('0x3d')]['id']}})[_0xb5ab('0x1c')](handleEntityNotFound(_0x35b23e,null))[_0xb5ab('0x1c')](removeEntity(_0x35b23e,null))['catch'](handleError(_0x35b23e,null));};exports[_0xb5ab('0x42')]=function(_0x3f50c7,_0x3204a3){return db[_0xb5ab('0x24')][_0xb5ab('0x42')]()['then'](respondWithResult(_0x3204a3,null))[_0xb5ab('0x3b')](handleError(_0x3204a3,null));}; \ No newline at end of file +var _0x69ed=['type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','FaxQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','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','reject','save','then','destroy','error','stack','name','send','index','fieldName'];(function(_0x47a1eb,_0x55dd48){var _0x101947=function(_0x5d7511){while(--_0x5d7511){_0x47a1eb['push'](_0x47a1eb['shift']());}};_0x101947(++_0x55dd48);}(_0x69ed,0x155));var _0xd69e=function(_0x4c9d81,_0x31d369){_0x4c9d81=_0x4c9d81-0x0;var _0x19900f=_0x69ed[_0x4c9d81];return _0x19900f;};'use strict';var pdf=require(_0xd69e('0x0'));var emlformat=require(_0xd69e('0x1'));var rimraf=require(_0xd69e('0x2'));var zipdir=require(_0xd69e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd69e('0x4'));var moment=require(_0xd69e('0x5'));var BPromise=require(_0xd69e('0x6'));var Mustache=require('mustache');var util=require(_0xd69e('0x7'));var path=require('path');var sox=require(_0xd69e('0x8'));var csv=require('to-csv');var ejs=require(_0xd69e('0x9'));var fs=require('fs');var _=require(_0xd69e('0xa'));var squel=require('squel');var crypto=require(_0xd69e('0xb'));var jsforce=require(_0xd69e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd69e('0xd'));var querystring=require(_0xd69e('0xe'));var Papa=require(_0xd69e('0xf'));var Redis=require(_0xd69e('0x10'));var authService=require(_0xd69e('0x11'));var qs=require(_0xd69e('0x12'));var as=require(_0xd69e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd69e('0x14'))(_0xd69e('0x15'));var utils=require(_0xd69e('0x16'));var config=require(_0xd69e('0x17'));var db=require(_0xd69e('0x18'))['db'];function respondWithStatusCode(_0x21aaea,_0x448bed){_0x448bed=_0x448bed||0xcc;return function(_0x19fa11){if(_0x19fa11){return _0x21aaea[_0xd69e('0x19')](_0x448bed);}return _0x21aaea[_0xd69e('0x1a')](_0x448bed)[_0xd69e('0x1b')]();};}function respondWithResult(_0x30af9a,_0x39260d){_0x39260d=_0x39260d||0xc8;return function(_0x3fc9d8){if(_0x3fc9d8){return _0x30af9a[_0xd69e('0x1a')](_0x39260d)[_0xd69e('0x1c')](_0x3fc9d8);}};}function respondWithFilteredResult(_0x2bd720,_0x115a92){return function(_0x4c4379){if(_0x4c4379){var _0x4434d4=_0x4c4379[_0xd69e('0x1d')],_0x1e4370=_0x115a92[_0xd69e('0x1e')],_0x36bfe2=_0x115a92['offset']+_0x115a92[_0xd69e('0x1f')],_0x3c49b8;if(_0x36bfe2>=_0x4434d4){_0x36bfe2=_0x4434d4;_0x3c49b8=0xc8;}else{_0x3c49b8=0xce;}_0x2bd720[_0xd69e('0x1a')](_0x3c49b8);return _0x2bd720[_0xd69e('0x20')](_0xd69e('0x21'),_0x1e4370+'-'+_0x36bfe2+'/'+_0x4434d4)[_0xd69e('0x1c')](_0x4c4379);}return null;};}function patchUpdates(_0x13c2b1){return function(_0x9b4164){try{jsonpatch['apply'](_0x9b4164,_0x13c2b1,!![]);}catch(_0x10c31a){return BPromise[_0xd69e('0x22')](_0x10c31a);}return _0x9b4164[_0xd69e('0x23')]();};}function saveUpdates(_0x18d1e8,_0x48876c){return function(_0x12c165){if(_0x12c165){return _0x12c165['update'](_0x18d1e8)[_0xd69e('0x24')](function(_0x2c1744){return _0x2c1744;});}return null;};}function removeEntity(_0x1802d6,_0x31b2f3){return function(_0x5b2a6a){if(_0x5b2a6a){return _0x5b2a6a[_0xd69e('0x25')]()['then'](function(){_0x1802d6[_0xd69e('0x1a')](0xcc)[_0xd69e('0x1b')]();});}};}function handleEntityNotFound(_0x50b1ac,_0x458d52){return function(_0x39603d){if(!_0x39603d){_0x50b1ac[_0xd69e('0x19')](0x194);}return _0x39603d;};}function handleError(_0x18a1d9,_0x401893){_0x401893=_0x401893||0x1f4;return function(_0x4189a0){logger[_0xd69e('0x26')](_0x4189a0[_0xd69e('0x27')]);if(_0x4189a0[_0xd69e('0x28')]){delete _0x4189a0[_0xd69e('0x28')];}_0x18a1d9[_0xd69e('0x1a')](_0x401893)[_0xd69e('0x29')](_0x4189a0);};}exports[_0xd69e('0x2a')]=function(_0xbc714,_0x1664ef){var _0x4e86c6={},_0x4e9b82={},_0x52c8fd={'count':0x0,'rows':[]};var _0x135c80=_['map'](db['FaxQueueReport']['rawAttributes'],function(_0x403da6){return{'name':_0x403da6[_0xd69e('0x2b')],'type':_0x403da6[_0xd69e('0x2c')][_0xd69e('0x2d')]};});_0x4e9b82[_0xd69e('0x2e')]=_[_0xd69e('0x2f')](_0x135c80,_0xd69e('0x28'));_0x4e9b82[_0xd69e('0x30')]=_[_0xd69e('0x31')](_0xbc714[_0xd69e('0x30')]);_0x4e9b82['filters']=_[_0xd69e('0x32')](_0x4e9b82[_0xd69e('0x2e')],_0x4e9b82['query']);_0x4e86c6[_0xd69e('0x33')]=_[_0xd69e('0x32')](_0x4e9b82['model'],qs[_0xd69e('0x34')](_0xbc714['query'][_0xd69e('0x34')]));_0x4e86c6['attributes']=_0x4e86c6[_0xd69e('0x33')][_0xd69e('0x35')]?_0x4e86c6[_0xd69e('0x33')]:_0x4e9b82[_0xd69e('0x2e')];if(!_0xbc714[_0xd69e('0x30')][_0xd69e('0x36')](_0xd69e('0x37'))){_0x4e86c6[_0xd69e('0x1f')]=qs[_0xd69e('0x1f')](_0xbc714[_0xd69e('0x30')]['limit']);_0x4e86c6['offset']=qs[_0xd69e('0x1e')](_0xbc714[_0xd69e('0x30')]['offset']);}_0x4e86c6[_0xd69e('0x38')]=qs[_0xd69e('0x39')](_0xbc714['query'][_0xd69e('0x39')]);_0x4e86c6[_0xd69e('0x3a')]=qs[_0xd69e('0x3b')](_[_0xd69e('0x3c')](_0xbc714[_0xd69e('0x30')],_0x4e9b82['filters']),_0x135c80);if(_0xbc714[_0xd69e('0x30')]['filter']){_0x4e86c6[_0xd69e('0x3a')]=_[_0xd69e('0x3d')](_0x4e86c6[_0xd69e('0x3a')],{'$or':_[_0xd69e('0x2f')](_0x135c80,function(_0x21c8c9){if(_0x21c8c9[_0xd69e('0x2c')]!=='VIRTUAL'){var _0x2885fa={};_0x2885fa[_0x21c8c9[_0xd69e('0x28')]]={'$like':'%'+_0xbc714['query'][_0xd69e('0x3e')]+'%'};return _0x2885fa;}})});}_0x4e86c6=_['merge']({},_0x4e86c6,_0xbc714['options']);var _0x20f562={'where':_0x4e86c6['where']};return db[_0xd69e('0x3f')][_0xd69e('0x1d')](_0x20f562)['then'](function(_0x2ba75f){_0x52c8fd[_0xd69e('0x1d')]=_0x2ba75f;if(_0xbc714[_0xd69e('0x30')][_0xd69e('0x40')]){_0x4e86c6[_0xd69e('0x41')]=[{'all':!![]}];}return db[_0xd69e('0x3f')][_0xd69e('0x42')](_0x4e86c6);})[_0xd69e('0x24')](function(_0x27f07f){_0x52c8fd[_0xd69e('0x43')]=_0x27f07f;return _0x52c8fd;})['then'](respondWithFilteredResult(_0x1664ef,_0x4e86c6))[_0xd69e('0x44')](handleError(_0x1664ef,null));};exports[_0xd69e('0x45')]=function(_0x1c4bbd,_0x556c6d){var _0x12b557={'raw':!![],'where':{'id':_0x1c4bbd[_0xd69e('0x46')]['id']}},_0x23b74b={};_0x23b74b[_0xd69e('0x2e')]=_[_0xd69e('0x31')](db[_0xd69e('0x3f')][_0xd69e('0x47')]);_0x23b74b['query']=_[_0xd69e('0x31')](_0x1c4bbd['query']);_0x23b74b[_0xd69e('0x3b')]=_['intersection'](_0x23b74b[_0xd69e('0x2e')],_0x23b74b[_0xd69e('0x30')]);_0x12b557[_0xd69e('0x33')]=_[_0xd69e('0x32')](_0x23b74b[_0xd69e('0x2e')],qs[_0xd69e('0x34')](_0x1c4bbd['query'][_0xd69e('0x34')]));_0x12b557['attributes']=_0x12b557[_0xd69e('0x33')]['length']?_0x12b557[_0xd69e('0x33')]:_0x23b74b[_0xd69e('0x2e')];if(_0x1c4bbd[_0xd69e('0x30')][_0xd69e('0x40')]){_0x12b557[_0xd69e('0x41')]=[{'all':!![]}];}_0x12b557=_[_0xd69e('0x3d')]({},_0x12b557,_0x1c4bbd['options']);return db[_0xd69e('0x3f')][_0xd69e('0x48')](_0x12b557)[_0xd69e('0x24')](handleEntityNotFound(_0x556c6d,null))[_0xd69e('0x24')](respondWithResult(_0x556c6d,null))[_0xd69e('0x44')](handleError(_0x556c6d,null));};exports['create']=function(_0x1284d3,_0xcb5304){return db[_0xd69e('0x3f')][_0xd69e('0x49')](_0x1284d3[_0xd69e('0x4a')],{})[_0xd69e('0x24')](respondWithResult(_0xcb5304,0xc9))['catch'](handleError(_0xcb5304,null));};exports[_0xd69e('0x4b')]=function(_0x5755bd,_0x513d85){if(_0x5755bd['body']['id']){delete _0x5755bd[_0xd69e('0x4a')]['id'];}return db['FaxQueueReport'][_0xd69e('0x48')]({'where':{'id':_0x5755bd['params']['id']}})[_0xd69e('0x24')](handleEntityNotFound(_0x513d85,null))['then'](saveUpdates(_0x5755bd[_0xd69e('0x4a')],null))['then'](respondWithResult(_0x513d85,null))[_0xd69e('0x44')](handleError(_0x513d85,null));};exports[_0xd69e('0x25')]=function(_0x53e4fe,_0x42a8bc){return db[_0xd69e('0x3f')][_0xd69e('0x48')]({'where':{'id':_0x53e4fe['params']['id']}})['then'](handleEntityNotFound(_0x42a8bc,null))['then'](removeEntity(_0x42a8bc,null))['catch'](handleError(_0x42a8bc,null));};exports['describe']=function(_0x372728,_0x216e6a){return db[_0xd69e('0x3f')][_0xd69e('0x4c')]()['then'](respondWithResult(_0x216e6a,null))[_0xd69e('0x44')](handleError(_0x216e6a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1ff3516..dccca6d 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 _0x80e0=['request-promise','path','rimraf','./faxQueueReport.attributes','exports','report_fax_queue','uniqueid','../../config/logger','api','moment'];(function(_0xda1f34,_0x9ef612){var _0x349f84=function(_0x1484a3){while(--_0x1484a3){_0xda1f34['push'](_0xda1f34['shift']());}};_0x349f84(++_0x9ef612);}(_0x80e0,0x9d));var _0x080e=function(_0x2b3a6b,_0x3cd8e7){_0x2b3a6b=_0x2b3a6b-0x0;var _0x3bd7ba=_0x80e0[_0x2b3a6b];return _0x3bd7ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x080e('0x0'))(_0x080e('0x1'));var moment=require(_0x080e('0x2'));var BPromise=require('bluebird');var rp=require(_0x080e('0x3'));var fs=require('fs');var path=require(_0x080e('0x4'));var rimraf=require(_0x080e('0x5'));var config=require('../../config/environment');var attributes=require(_0x080e('0x6'));module[_0x080e('0x7')]=function(_0x307481,_0x52548f){return _0x307481['define']('FaxQueueReport',attributes,{'tableName':_0x080e('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x080e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa32b=['./faxQueueReport.attributes','exports','FaxQueueReport','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x5cd51d,_0x20d4fa){var _0x444608=function(_0x32a9dc){while(--_0x32a9dc){_0x5cd51d['push'](_0x5cd51d['shift']());}};_0x444608(++_0x20d4fa);}(_0xa32b,0x68));var _0xba32=function(_0x33c090,_0x184b69){_0x33c090=_0x33c090-0x0;var _0x4081df=_0xa32b[_0x33c090];return _0x4081df;};'use strict';var _=require(_0xba32('0x0'));var util=require('util');var logger=require(_0xba32('0x1'))('api');var moment=require('moment');var BPromise=require(_0xba32('0x2'));var rp=require(_0xba32('0x3'));var fs=require('fs');var path=require(_0xba32('0x4'));var rimraf=require('rimraf');var config=require(_0xba32('0x5'));var attributes=require(_0xba32('0x6'));module[_0xba32('0x7')]=function(_0x312fe7,_0x31dc74){return _0x312fe7['define'](_0xba32('0x8'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xba32('0x9'),'fields':[_0xba32('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b59b48d..4515d58 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 _0x3f81=['message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','stringify','UpdateFaxQueueReport','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x23347e,_0x350e6c){var _0x24efed=function(_0x3ea5e2){while(--_0x3ea5e2){_0x23347e['push'](_0x23347e['shift']());}};_0x24efed(++_0x350e6c);}(_0x3f81,0x158));var _0x13f8=function(_0x36d8b2,_0x2b8810){_0x36d8b2=_0x36d8b2-0x0;var _0x43684b=_0x3f81[_0x36d8b2];return _0x43684b;};'use strict';var _=require(_0x13f8('0x0'));var util=require(_0x13f8('0x1'));var moment=require(_0x13f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x13f8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13f8('0x4'))['db'];var utils=require(_0x13f8('0x5'));var logger=require(_0x13f8('0x6'))(_0x13f8('0x7'));var config=require(_0x13f8('0x8'));var jayson=require(_0x13f8('0x9'));var client=jayson[_0x13f8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcf2f,_0x3750ab,_0x59f5d6){return new BPromise(function(_0x566169,_0xd8ec8c){return client[_0x13f8('0xb')](_0x4fcf2f,_0x59f5d6)['then'](function(_0x3c5a52){logger[_0x13f8('0xc')](_0x13f8('0xd'),_0x3750ab,_0x13f8('0xe'));logger[_0x13f8('0xf')](_0x13f8('0x10'),_0x3750ab,_0x13f8('0xe'),JSON['stringify'](_0x3c5a52));if(_0x3c5a52[_0x13f8('0x11')]){if(_0x3c5a52[_0x13f8('0x11')][_0x13f8('0x12')]===0x1f4){logger[_0x13f8('0x11')](_0x13f8('0xd'),_0x3750ab,_0x3c5a52[_0x13f8('0x11')]['message']);return _0xd8ec8c(_0x3c5a52[_0x13f8('0x11')][_0x13f8('0x13')]);}logger['error'](_0x13f8('0xd'),_0x3750ab,_0x3c5a52[_0x13f8('0x11')][_0x13f8('0x13')]);return _0x566169(_0x3c5a52[_0x13f8('0x11')][_0x13f8('0x13')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x3750ab,_0x13f8('0xe'));_0x566169(_0x3c5a52[_0x13f8('0x14')][_0x13f8('0x13')]);}})[_0x13f8('0x15')](function(_0x2e54b2){logger[_0x13f8('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x3750ab,_0x2e54b2);_0xd8ec8c(_0x2e54b2);});});}exports[_0x13f8('0x16')]=function(_0x323533){var _0x1997cc=this;return new Promise(function(_0x5366e0,_0x5091e8){return db[_0x13f8('0x17')][_0x13f8('0x18')](_0x323533[_0x13f8('0x19')],{'raw':_0x323533[_0x13f8('0x1a')]?_0x323533[_0x13f8('0x1a')][_0x13f8('0x1b')]===undefined?!![]:![]:!![]})[_0x13f8('0x1c')](function(_0x2d989a){logger[_0x13f8('0xc')]('CreateFaxQueueReport',_0x323533);logger[_0x13f8('0xf')]('CreateFaxQueueReport',_0x323533,JSON[_0x13f8('0x1d')](_0x2d989a));_0x5366e0(_0x2d989a);})['catch'](function(_0x199b26){logger[_0x13f8('0x11')](_0x13f8('0x16'),_0x199b26[_0x13f8('0x13')],_0x323533);_0x5091e8(_0x1997cc[_0x13f8('0x11')](0x1f4,_0x199b26[_0x13f8('0x13')]));});});};exports[_0x13f8('0x1e')]=function(_0x2597f4){var _0x101759=this;return new Promise(function(_0x288f49,_0x4219cb){return db['FaxQueueReport']['update'](_0x2597f4[_0x13f8('0x19')],{'raw':_0x2597f4[_0x13f8('0x1a')]?_0x2597f4[_0x13f8('0x1a')][_0x13f8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2597f4[_0x13f8('0x1a')]?_0x2597f4['options']['where']||null:null,'attributes':_0x2597f4[_0x13f8('0x1a')]?_0x2597f4[_0x13f8('0x1a')][_0x13f8('0x1f')]||null:null,'limit':_0x2597f4[_0x13f8('0x1a')]?_0x2597f4['options'][_0x13f8('0x20')]||null:null})[_0x13f8('0x1c')](function(_0x2de30f){logger[_0x13f8('0xc')](_0x13f8('0x1e'),_0x2597f4);logger[_0x13f8('0xf')](_0x13f8('0x1e'),_0x2597f4,JSON[_0x13f8('0x1d')](_0x2de30f));_0x288f49(_0x2de30f);})[_0x13f8('0x15')](function(_0x404299){logger[_0x13f8('0x11')](_0x13f8('0x1e'),_0x404299[_0x13f8('0x13')],_0x2597f4);_0x4219cb(_0x101759[_0x13f8('0x11')](0x1f4,_0x404299[_0x13f8('0x13')]));});});}; \ No newline at end of file +var _0x048d=['FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','stringify','UpdateFaxQueueReport','update','where','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b2766,_0x49f4be){var _0x365e8b=function(_0x149117){while(--_0x149117){_0x4b2766['push'](_0x4b2766['shift']());}};_0x365e8b(++_0x49f4be);}(_0x048d,0x185));var _0xd048=function(_0x412b69,_0x19e9b7){_0x412b69=_0x412b69-0x0;var _0x2edc60=_0x048d[_0x412b69];return _0x2edc60;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd048('0x0'));var rs=require(_0xd048('0x1'));var fs=require('fs');var Redis=require(_0xd048('0x2'));var db=require(_0xd048('0x3'))['db'];var utils=require(_0xd048('0x4'));var logger=require(_0xd048('0x5'))('rpc');var config=require(_0xd048('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd048('0x7')][_0xd048('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50e568,_0x292955,_0x4cdd8b){return new BPromise(function(_0x2f4591,_0x3a6d85){return client[_0xd048('0x9')](_0x50e568,_0x4cdd8b)['then'](function(_0x44dace){logger[_0xd048('0xa')](_0xd048('0xb'),_0x292955,_0xd048('0xc'));logger[_0xd048('0xd')](_0xd048('0xe'),_0x292955,_0xd048('0xc'),JSON['stringify'](_0x44dace));if(_0x44dace[_0xd048('0xf')]){if(_0x44dace['error'][_0xd048('0x10')]===0x1f4){logger[_0xd048('0xf')](_0xd048('0xb'),_0x292955,_0x44dace[_0xd048('0xf')][_0xd048('0x11')]);return _0x3a6d85(_0x44dace[_0xd048('0xf')][_0xd048('0x11')]);}logger[_0xd048('0xf')](_0xd048('0xb'),_0x292955,_0x44dace[_0xd048('0xf')]['message']);return _0x2f4591(_0x44dace[_0xd048('0xf')]['message']);}else{logger[_0xd048('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x292955,_0xd048('0xc'));_0x2f4591(_0x44dace[_0xd048('0x12')][_0xd048('0x11')]);}})[_0xd048('0x13')](function(_0xc44b40){logger[_0xd048('0xf')](_0xd048('0xb'),_0x292955,_0xc44b40);_0x3a6d85(_0xc44b40);});});}exports[_0xd048('0x14')]=function(_0x47177e){var _0x5b72fb=this;return new Promise(function(_0x5b5e7d,_0x2944ce){return db[_0xd048('0x15')][_0xd048('0x16')](_0x47177e[_0xd048('0x17')],{'raw':_0x47177e[_0xd048('0x18')]?_0x47177e[_0xd048('0x18')][_0xd048('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xb5d62){logger[_0xd048('0xa')](_0xd048('0x14'),_0x47177e);logger['debug'](_0xd048('0x14'),_0x47177e,JSON[_0xd048('0x1a')](_0xb5d62));_0x5b5e7d(_0xb5d62);})[_0xd048('0x13')](function(_0x40ddee){logger[_0xd048('0xf')](_0xd048('0x14'),_0x40ddee[_0xd048('0x11')],_0x47177e);_0x2944ce(_0x5b72fb[_0xd048('0xf')](0x1f4,_0x40ddee[_0xd048('0x11')]));});});};exports[_0xd048('0x1b')]=function(_0x2edf15){var _0x52ce94=this;return new Promise(function(_0x2a0c86,_0x2a4d7b){return db[_0xd048('0x15')][_0xd048('0x1c')](_0x2edf15['body'],{'raw':_0x2edf15[_0xd048('0x18')]?_0x2edf15['options'][_0xd048('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2edf15[_0xd048('0x18')]?_0x2edf15[_0xd048('0x18')][_0xd048('0x1d')]||null:null,'attributes':_0x2edf15[_0xd048('0x18')]?_0x2edf15[_0xd048('0x18')]['attributes']||null:null,'limit':_0x2edf15[_0xd048('0x18')]?_0x2edf15[_0xd048('0x18')][_0xd048('0x1e')]||null:null})['then'](function(_0x28c715){logger[_0xd048('0xa')](_0xd048('0x1b'),_0x2edf15);logger[_0xd048('0xd')]('UpdateFaxQueueReport',_0x2edf15,JSON[_0xd048('0x1a')](_0x28c715));_0x2a0c86(_0x28c715);})[_0xd048('0x13')](function(_0x5bf2f6){logger[_0xd048('0xf')](_0xd048('0x1b'),_0x5bf2f6[_0xd048('0x11')],_0x2edf15);_0x2a4d7b(_0x52ce94['error'](0x1f4,_0x5bf2f6[_0xd048('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 20342ff..279f9b4 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 _0xe4c0=['index','/describe','describe','/:id','show','create','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x2c0ef9,_0x519ca1){var _0x4b946e=function(_0x1084df){while(--_0x1084df){_0x2c0ef9['push'](_0x2c0ef9['shift']());}};_0x4b946e(++_0x519ca1);}(_0xe4c0,0xc5));var _0x0e4c=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xe4c0[_0x478c8a];return _0x3b6b3e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0e4c('0x0'));var express=require(_0x0e4c('0x1'));var router=express[_0x0e4c('0x2')]();var auth=require(_0x0e4c('0x3'));var interaction=require(_0x0e4c('0x4'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x0e4c('0x5')]('/',auth[_0x0e4c('0x6')](),controller[_0x0e4c('0x7')]);router[_0x0e4c('0x5')](_0x0e4c('0x8'),auth['isAuthenticated'](),controller[_0x0e4c('0x9')]);router['get'](_0x0e4c('0xa'),auth['isAuthenticated'](),controller[_0x0e4c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e4c('0xc')]);router['put'](_0x0e4c('0xa'),auth[_0x0e4c('0x6')](),controller[_0x0e4c('0xd')]);router[_0x0e4c('0xe')](_0x0e4c('0xa'),auth[_0x0e4c('0x6')](),controller[_0x0e4c('0xf')]);module[_0x0e4c('0x10')]=router; \ No newline at end of file +var _0xd723=['path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0xd723,0xfb));var _0x3d72=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd723[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0x3d72('0x0'));var util=require('util');var path=require(_0x3d72('0x1'));var timeout=require('connect-timeout');var express=require(_0x3d72('0x2'));var router=express[_0x3d72('0x3')]();var auth=require(_0x3d72('0x4'));var interaction=require(_0x3d72('0x5'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x3d72('0x6')]('/',auth[_0x3d72('0x7')](),controller['index']);router[_0x3d72('0x6')](_0x3d72('0x8'),auth['isAuthenticated'](),controller[_0x3d72('0x9')]);router[_0x3d72('0x6')](_0x3d72('0xa'),auth[_0x3d72('0x7')](),controller[_0x3d72('0xb')]);router[_0x3d72('0xc')]('/',auth[_0x3d72('0x7')](),controller['create']);router[_0x3d72('0xd')](_0x3d72('0xa'),auth[_0x3d72('0x7')](),controller[_0x3d72('0xe')]);router[_0x3d72('0xf')]('/:id',auth[_0x3d72('0x7')](),controller[_0x3d72('0x10')]);module[_0x3d72('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 6c2ddc3..96f8d09 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 _0x56ca=['DATE','exports','STRING','ENUM','account','agent','queue'];(function(_0x390556,_0x5b64bd){var _0x11868e=function(_0x51bf69){while(--_0x51bf69){_0x390556['push'](_0x390556['shift']());}};_0x11868e(++_0x5b64bd);}(_0x56ca,0x1f2));var _0xa56c=function(_0xddeebf,_0x51610b){_0xddeebf=_0xddeebf-0x0;var _0x4b9104=_0x56ca[_0xddeebf];return _0x4b9104;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xa56c('0x0')]={'uniqueid':{'type':Sequelize[_0xa56c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa56c('0x2')](_0xa56c('0x3'),_0xa56c('0x4'),'queue'),'allowNull':![],'defaultValue':_0xa56c('0x5')},'transferredAt':{'type':Sequelize[_0xa56c('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x2527=['ENUM','account','agent','queue','DATE','NOW','sequelize','exports','STRING'];(function(_0x20ea89,_0x1bfce6){var _0x1f06a8=function(_0xc541ce){while(--_0xc541ce){_0x20ea89['push'](_0x20ea89['shift']());}};_0x1f06a8(++_0x1bfce6);}(_0x2527,0x126));var _0x7252=function(_0x5df5c2,_0x4017fb){_0x5df5c2=_0x5df5c2-0x0;var _0x47e51e=_0x2527[_0x5df5c2];return _0x47e51e;};'use strict';var moment=require('moment');var Sequelize=require(_0x7252('0x0'));module[_0x7252('0x1')]={'uniqueid':{'type':Sequelize[_0x7252('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7252('0x3')](_0x7252('0x4'),_0x7252('0x5'),_0x7252('0x6')),'allowNull':![],'defaultValue':_0x7252('0x6')},'transferredAt':{'type':Sequelize[_0x7252('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x7252('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 354d592..0b483cb 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 _0xdb28=['Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','set'];(function(_0xee7143,_0x1719ac){var _0x22f461=function(_0x1798fe){while(--_0x1798fe){_0xee7143['push'](_0xee7143['shift']());}};_0x22f461(++_0x1719ac);}(_0xdb28,0x106));var _0x8db2=function(_0x5bfc11,_0x573588){_0x5bfc11=_0x5bfc11-0x0;var _0x130f55=_0xdb28[_0x5bfc11];return _0x130f55;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var db=require(_0x8db2('0x17'))['db'];function respondWithStatusCode(_0x1349f6,_0x204f49){_0x204f49=_0x204f49||0xcc;return function(_0x37d017){if(_0x37d017){return _0x1349f6['sendStatus'](_0x204f49);}return _0x1349f6['status'](_0x204f49)[_0x8db2('0x18')]();};}function respondWithResult(_0x15e87c,_0x350d61){_0x350d61=_0x350d61||0xc8;return function(_0x1d6a15){if(_0x1d6a15){return _0x15e87c[_0x8db2('0x19')](_0x350d61)[_0x8db2('0x1a')](_0x1d6a15);}};}function respondWithFilteredResult(_0x2f177a,_0x3c96a7){return function(_0x131252){if(_0x131252){var _0x16c8c2=_0x131252['count'],_0x5489a9=_0x3c96a7[_0x8db2('0x1b')],_0x13b0f5=_0x3c96a7[_0x8db2('0x1b')]+_0x3c96a7[_0x8db2('0x1c')],_0x24da1b;if(_0x13b0f5>=_0x16c8c2){_0x13b0f5=_0x16c8c2;_0x24da1b=0xc8;}else{_0x24da1b=0xce;}_0x2f177a[_0x8db2('0x19')](_0x24da1b);return _0x2f177a[_0x8db2('0x1d')](_0x8db2('0x1e'),_0x5489a9+'-'+_0x13b0f5+'/'+_0x16c8c2)['json'](_0x131252);}return null;};}function patchUpdates(_0x5df464){return function(_0x77789){try{jsonpatch[_0x8db2('0x1f')](_0x77789,_0x5df464,!![]);}catch(_0x1310d3){return BPromise[_0x8db2('0x20')](_0x1310d3);}return _0x77789['save']();};}function saveUpdates(_0x431d60,_0x36a9ff){return function(_0x260940){if(_0x260940){return _0x260940[_0x8db2('0x21')](_0x431d60)[_0x8db2('0x22')](function(_0x597260){return _0x597260;});}return null;};}function removeEntity(_0x124467,_0x3e30e6){return function(_0x18f69c){if(_0x18f69c){return _0x18f69c[_0x8db2('0x23')]()[_0x8db2('0x22')](function(){_0x124467[_0x8db2('0x19')](0xcc)[_0x8db2('0x18')]();});}};}function handleEntityNotFound(_0x5c6614,_0x256202){return function(_0x4f6516){if(!_0x4f6516){_0x5c6614['sendStatus'](0x194);}return _0x4f6516;};}function handleError(_0x52a9ca,_0x4d923c){_0x4d923c=_0x4d923c||0x1f4;return function(_0xec8cd2){logger[_0x8db2('0x24')](_0xec8cd2[_0x8db2('0x25')]);if(_0xec8cd2[_0x8db2('0x26')]){delete _0xec8cd2[_0x8db2('0x26')];}_0x52a9ca[_0x8db2('0x19')](_0x4d923c)['send'](_0xec8cd2);};}exports[_0x8db2('0x27')]=function(_0x372311,_0x430dd5){var _0x8b7cec={},_0x483aee={},_0x2e0691={'count':0x0,'rows':[]};var _0x11f398=_[_0x8db2('0x28')](db[_0x8db2('0x29')][_0x8db2('0x2a')],function(_0x21bae5){return{'name':_0x21bae5[_0x8db2('0x2b')],'type':_0x21bae5[_0x8db2('0x2c')][_0x8db2('0x2d')]};});_0x483aee['model']=_[_0x8db2('0x28')](_0x11f398,'name');_0x483aee['query']=_[_0x8db2('0x2e')](_0x372311[_0x8db2('0x2f')]);_0x483aee[_0x8db2('0x30')]=_['intersection'](_0x483aee[_0x8db2('0x31')],_0x483aee['query']);_0x8b7cec[_0x8db2('0x32')]=_[_0x8db2('0x33')](_0x483aee[_0x8db2('0x31')],qs['fields'](_0x372311['query'][_0x8db2('0x34')]));_0x8b7cec[_0x8db2('0x32')]=_0x8b7cec['attributes']['length']?_0x8b7cec[_0x8db2('0x32')]:_0x483aee[_0x8db2('0x31')];if(!_0x372311[_0x8db2('0x2f')][_0x8db2('0x35')](_0x8db2('0x36'))){_0x8b7cec[_0x8db2('0x1c')]=qs[_0x8db2('0x1c')](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1c')]);_0x8b7cec[_0x8db2('0x1b')]=qs['offset'](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1b')]);}_0x8b7cec['order']=qs[_0x8db2('0x37')](_0x372311[_0x8db2('0x2f')]['sort']);_0x8b7cec['where']=qs[_0x8db2('0x30')](_['pick'](_0x372311[_0x8db2('0x2f')],_0x483aee[_0x8db2('0x30')]),_0x11f398);if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]){_0x8b7cec['where']=_[_0x8db2('0x39')](_0x8b7cec['where'],{'$or':_[_0x8db2('0x28')](_0x11f398,function(_0xd550ae){if(_0xd550ae[_0x8db2('0x2c')]!==_0x8db2('0x3a')){var _0x50e88a={};_0x50e88a[_0xd550ae['name']]={'$like':'%'+_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]+'%'};return _0x50e88a;}})});}_0x8b7cec=_['merge']({},_0x8b7cec,_0x372311[_0x8db2('0x3b')]);var _0x24bcfe={'where':_0x8b7cec[_0x8db2('0x3c')]};return db['FaxTransferReport'][_0x8db2('0x3d')](_0x24bcfe)[_0x8db2('0x22')](function(_0x953349){_0x2e0691[_0x8db2('0x3d')]=_0x953349;if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x3e')]){_0x8b7cec[_0x8db2('0x3f')]=[{'all':!![]}];}return db[_0x8db2('0x29')][_0x8db2('0x40')](_0x8b7cec);})[_0x8db2('0x22')](function(_0x21cf7c){_0x2e0691[_0x8db2('0x41')]=_0x21cf7c;return _0x2e0691;})[_0x8db2('0x22')](respondWithFilteredResult(_0x430dd5,_0x8b7cec))['catch'](handleError(_0x430dd5,null));};exports[_0x8db2('0x42')]=function(_0x2b2472,_0x5e0382){var _0x49a7ae={'raw':!![],'where':{'id':_0x2b2472['params']['id']}},_0x249c73={};_0x249c73[_0x8db2('0x31')]=_[_0x8db2('0x2e')](db[_0x8db2('0x29')][_0x8db2('0x2a')]);_0x249c73[_0x8db2('0x2f')]=_[_0x8db2('0x2e')](_0x2b2472[_0x8db2('0x2f')]);_0x249c73['filters']=_[_0x8db2('0x33')](_0x249c73[_0x8db2('0x31')],_0x249c73[_0x8db2('0x2f')]);_0x49a7ae[_0x8db2('0x32')]=_['intersection'](_0x249c73[_0x8db2('0x31')],qs[_0x8db2('0x34')](_0x2b2472[_0x8db2('0x2f')][_0x8db2('0x34')]));_0x49a7ae['attributes']=_0x49a7ae[_0x8db2('0x32')]['length']?_0x49a7ae[_0x8db2('0x32')]:_0x249c73[_0x8db2('0x31')];if(_0x2b2472[_0x8db2('0x2f')]['includeAll']){_0x49a7ae['include']=[{'all':!![]}];}_0x49a7ae=_[_0x8db2('0x39')]({},_0x49a7ae,_0x2b2472['options']);return db[_0x8db2('0x29')][_0x8db2('0x43')](_0x49a7ae)[_0x8db2('0x22')](handleEntityNotFound(_0x5e0382,null))[_0x8db2('0x22')](respondWithResult(_0x5e0382,null))[_0x8db2('0x44')](handleError(_0x5e0382,null));};exports[_0x8db2('0x45')]=function(_0x4355e2,_0xab6bdd){return db[_0x8db2('0x29')][_0x8db2('0x45')](_0x4355e2[_0x8db2('0x46')],{})[_0x8db2('0x22')](respondWithResult(_0xab6bdd,0xc9))['catch'](handleError(_0xab6bdd,null));};exports[_0x8db2('0x21')]=function(_0x2ada52,_0xdbba64){if(_0x2ada52[_0x8db2('0x46')]['id']){delete _0x2ada52['body']['id'];}return db['FaxTransferReport'][_0x8db2('0x43')]({'where':{'id':_0x2ada52[_0x8db2('0x47')]['id']}})[_0x8db2('0x22')](handleEntityNotFound(_0xdbba64,null))['then'](saveUpdates(_0x2ada52['body'],null))['then'](respondWithResult(_0xdbba64,null))[_0x8db2('0x44')](handleError(_0xdbba64,null));};exports[_0x8db2('0x23')]=function(_0x55c7dd,_0x383fa1){return db[_0x8db2('0x29')][_0x8db2('0x43')]({'where':{'id':_0x55c7dd[_0x8db2('0x47')]['id']}})['then'](handleEntityNotFound(_0x383fa1,null))['then'](removeEntity(_0x383fa1,null))[_0x8db2('0x44')](handleError(_0x383fa1,null));};exports[_0x8db2('0x48')]=function(_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x29')][_0x8db2('0x48')]()[_0x8db2('0x22')](respondWithResult(_0x2f0bd0,null))[_0x8db2('0x44')](handleError(_0x2f0bd0,null));}; \ No newline at end of file +var _0x5f66=['show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x3e2aec,_0x92d747){var _0x25f10c=function(_0x5549fc){while(--_0x5549fc){_0x3e2aec['push'](_0x3e2aec['shift']());}};_0x25f10c(++_0x92d747);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]),_0x325cb4);if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['FaxTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));};exports[_0x65f6('0x43')]=function(_0x49ba5a,_0x22d745){return db[_0x65f6('0x26')]['describe']()[_0x65f6('0x1f')](respondWithResult(_0x22d745,null))['catch'](handleError(_0x22d745,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 433b2eb..b489592 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 _0x2e3a=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2e3a,0x145));var _0xa2e3=function(_0x259153,_0x4ff2aa){_0x259153=_0x259153-0x0;var _0x4dfa06=_0x2e3a[_0x259153];return _0x4dfa06;};'use strict';var _=require(_0xa2e3('0x0'));var util=require('util');var logger=require(_0xa2e3('0x1'))('api');var moment=require(_0xa2e3('0x2'));var BPromise=require(_0xa2e3('0x3'));var rp=require(_0xa2e3('0x4'));var fs=require('fs');var path=require(_0xa2e3('0x5'));var rimraf=require(_0xa2e3('0x6'));var config=require(_0xa2e3('0x7'));var attributes=require(_0xa2e3('0x8'));module[_0xa2e3('0x9')]=function(_0x43226f,_0x2237f1){return _0x43226f[_0xa2e3('0xa')](_0xa2e3('0xb'),attributes,{'tableName':_0xa2e3('0xc'),'paranoid':![],'indexes':[{'name':_0xa2e3('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x959e=['report_fax_transfer','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport'];(function(_0x442950,_0x3ec430){var _0x163dac=function(_0x85021){while(--_0x85021){_0x442950['push'](_0x442950['shift']());}};_0x163dac(++_0x3ec430);}(_0x959e,0x1e2));var _0xe959=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x959e[_0x30abff];return _0x4c571e;};'use strict';var _=require(_0xe959('0x0'));var util=require(_0xe959('0x1'));var logger=require(_0xe959('0x2'))('api');var moment=require(_0xe959('0x3'));var BPromise=require(_0xe959('0x4'));var rp=require(_0xe959('0x5'));var fs=require('fs');var path=require(_0xe959('0x6'));var rimraf=require(_0xe959('0x7'));var config=require(_0xe959('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0xe959('0x9')]=function(_0x595e3f,_0x29a59a){return _0x595e3f[_0xe959('0xa')](_0xe959('0xb'),attributes,{'tableName':_0xe959('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index e76d7cb..06daf89 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 _0xd309=['FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','FaxTransferReport,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x32c5bc,_0x2afe0c){var _0x8c5cf6=function(_0xc89ba8){while(--_0xc89ba8){_0x32c5bc['push'](_0x32c5bc['shift']());}};_0x8c5cf6(++_0x2afe0c);}(_0xd309,0x75));var _0x9d30=function(_0x35f513,_0xec7d83){_0x35f513=_0x35f513-0x0;var _0x195766=_0xd309[_0x35f513];return _0x195766;};'use strict';var _=require(_0x9d30('0x0'));var util=require(_0x9d30('0x1'));var moment=require('moment');var BPromise=require(_0x9d30('0x2'));var rs=require(_0x9d30('0x3'));var fs=require('fs');var Redis=require(_0x9d30('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d30('0x5'));var logger=require(_0x9d30('0x6'))('rpc');var config=require(_0x9d30('0x7'));var jayson=require(_0x9d30('0x8'));var client=jayson[_0x9d30('0x9')][_0x9d30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x569543,_0x2ef59a,_0x2c3088){return new BPromise(function(_0x1976d1,_0x454b84){return client[_0x9d30('0xb')](_0x569543,_0x2c3088)[_0x9d30('0xc')](function(_0x54c5ad){logger[_0x9d30('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x2ef59a,'request\x20sent');logger[_0x9d30('0xe')](_0x9d30('0xf'),_0x2ef59a,'request\x20sent',JSON['stringify'](_0x54c5ad));if(_0x54c5ad[_0x9d30('0x10')]){if(_0x54c5ad['error']['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x2ef59a,_0x54c5ad[_0x9d30('0x10')][_0x9d30('0x11')]);return _0x454b84(_0x54c5ad[_0x9d30('0x10')]['message']);}logger[_0x9d30('0x10')](_0x9d30('0x12'),_0x2ef59a,_0x54c5ad[_0x9d30('0x10')][_0x9d30('0x11')]);return _0x1976d1(_0x54c5ad[_0x9d30('0x10')][_0x9d30('0x11')]);}else{logger[_0x9d30('0xd')](_0x9d30('0x12'),_0x2ef59a,_0x9d30('0x13'));_0x1976d1(_0x54c5ad[_0x9d30('0x14')][_0x9d30('0x11')]);}})[_0x9d30('0x15')](function(_0x58d1c5){logger[_0x9d30('0x10')](_0x9d30('0x12'),_0x2ef59a,_0x58d1c5);_0x454b84(_0x58d1c5);});});} \ No newline at end of file +var _0xc9f9=['../../config/logger','rpc','../../config/environment','http','request','then','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x557400,_0x67f942){var _0x2c7cac=function(_0x4e4f76){while(--_0x4e4f76){_0x557400['push'](_0x557400['shift']());}};_0x2c7cac(++_0x67f942);}(_0xc9f9,0x103));var _0x9c9f=function(_0x29c988,_0x215e5e){_0x29c988=_0x29c988-0x0;var _0x2434b6=_0xc9f9[_0x29c988];return _0x2434b6;};'use strict';var _=require('lodash');var util=require(_0x9c9f('0x0'));var moment=require(_0x9c9f('0x1'));var BPromise=require('bluebird');var rs=require(_0x9c9f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c9f('0x3'))['db'];var utils=require(_0x9c9f('0x4'));var logger=require(_0x9c9f('0x5'))(_0x9c9f('0x6'));var config=require(_0x9c9f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9c9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33b946,_0x27b823,_0x4619e0){return new BPromise(function(_0x16bf4c,_0x35d478){return client[_0x9c9f('0x9')](_0x33b946,_0x4619e0)[_0x9c9f('0xa')](function(_0x566e95){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x27b823,'request\x20sent');logger[_0x9c9f('0xb')](_0x9c9f('0xc'),_0x27b823,_0x9c9f('0xd'),JSON[_0x9c9f('0xe')](_0x566e95));if(_0x566e95[_0x9c9f('0xf')]){if(_0x566e95[_0x9c9f('0xf')][_0x9c9f('0x10')]===0x1f4){logger['error'](_0x9c9f('0x11'),_0x27b823,_0x566e95[_0x9c9f('0xf')][_0x9c9f('0x12')]);return _0x35d478(_0x566e95['error'][_0x9c9f('0x12')]);}logger[_0x9c9f('0xf')](_0x9c9f('0x11'),_0x27b823,_0x566e95[_0x9c9f('0xf')][_0x9c9f('0x12')]);return _0x16bf4c(_0x566e95[_0x9c9f('0xf')][_0x9c9f('0x12')]);}else{logger[_0x9c9f('0x13')](_0x9c9f('0x11'),_0x27b823,_0x9c9f('0xd'));_0x16bf4c(_0x566e95[_0x9c9f('0x14')][_0x9c9f('0x12')]);}})[_0x9c9f('0x15')](function(_0x722694){logger['error'](_0x9c9f('0x11'),_0x27b823,_0x722694);_0x35d478(_0x722694);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e46d875..f8676ff 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 _0x6b6f=['../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b6f,0x12a));var _0xf6b6=function(_0x3a10bb,_0x5706e8){_0x3a10bb=_0x3a10bb-0x0;var _0x2ebe30=_0x6b6f[_0x3a10bb];return _0x2ebe30;};'use strict';var multer=require(_0xf6b6('0x0'));var util=require(_0xf6b6('0x1'));var path=require(_0xf6b6('0x2'));var timeout=require(_0xf6b6('0x3'));var express=require(_0xf6b6('0x4'));var router=express['Router']();var auth=require(_0xf6b6('0x5'));var interaction=require(_0xf6b6('0x6'));var config=require('../../config/environment');var controller=require(_0xf6b6('0x7'));router[_0xf6b6('0x8')]('/',auth[_0xf6b6('0x9')](),controller[_0xf6b6('0xa')]);router[_0xf6b6('0x8')](_0xf6b6('0xb'),auth['isAuthenticated'](),controller[_0xf6b6('0xc')]);router[_0xf6b6('0x8')](_0xf6b6('0xd'),auth['isAuthenticated'](),controller[_0xf6b6('0xe')]);router[_0xf6b6('0xf')]('/',auth[_0xf6b6('0x9')](),controller['create']);router[_0xf6b6('0x10')](_0xf6b6('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xf6b6('0x11')](_0xf6b6('0xd'),auth[_0xf6b6('0x9')](),controller['destroy']);module[_0xf6b6('0x12')]=router; \ No newline at end of file +var _0xdb0a=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x8f688d,_0x3a6287){var _0x38a2e6=function(_0x495b0f){while(--_0x495b0f){_0x8f688d['push'](_0x8f688d['shift']());}};_0x38a2e6(++_0x3a6287);}(_0xdb0a,0xb9));var _0xadb0=function(_0x2ee877,_0x34bfca){_0x2ee877=_0x2ee877-0x0;var _0x59e86e=_0xdb0a[_0x2ee877];return _0x59e86e;};'use strict';var multer=require(_0xadb0('0x0'));var util=require(_0xadb0('0x1'));var path=require(_0xadb0('0x2'));var timeout=require(_0xadb0('0x3'));var express=require(_0xadb0('0x4'));var router=express[_0xadb0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xadb0('0x6'));var config=require(_0xadb0('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xadb0('0x8')](),controller['index']);router[_0xadb0('0x9')](_0xadb0('0xa'),auth[_0xadb0('0x8')](),controller[_0xadb0('0xb')]);router[_0xadb0('0x9')](_0xadb0('0xc'),auth[_0xadb0('0x8')](),controller[_0xadb0('0xd')]);router[_0xadb0('0xe')]('/',auth[_0xadb0('0x8')](),controller[_0xadb0('0xf')]);router[_0xadb0('0x10')](_0xadb0('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xadb0('0x11')](_0xadb0('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xadb0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 9e85604..ee0e715 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 _0x1af3=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x588932,_0x1ae423){var _0x307e46=function(_0x35771f){while(--_0x35771f){_0x588932['push'](_0x588932['shift']());}};_0x307e46(++_0x1ae423);}(_0x1af3,0x1ca));var _0x31af=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x1af3[_0x2e4cbf];return _0x52840f;};'use strict';var multer=require(_0x31af('0x0'));var util=require(_0x31af('0x1'));var path=require(_0x31af('0x2'));var timeout=require(_0x31af('0x3'));var express=require(_0x31af('0x4'));var router=express[_0x31af('0x5')]();var auth=require(_0x31af('0x6'));var interaction=require(_0x31af('0x7'));var config=require(_0x31af('0x8'));var controller=require(_0x31af('0x9'));router['get']('/',auth[_0x31af('0xa')](),controller[_0x31af('0xb')]);router[_0x31af('0xc')](_0x31af('0xd'),auth['isAuthenticated'](),controller[_0x31af('0xe')]);router[_0x31af('0xc')](_0x31af('0xf'),auth['isAuthenticated'](),controller[_0x31af('0x10')]);router[_0x31af('0xc')](_0x31af('0x11'),auth[_0x31af('0xa')](),controller[_0x31af('0x12')]);router[_0x31af('0x13')]('/',auth[_0x31af('0xa')](),controller[_0x31af('0x14')]);router['post'](_0x31af('0xf'),auth[_0x31af('0xa')](),controller[_0x31af('0x15')]);router[_0x31af('0x16')](_0x31af('0xd'),auth['isAuthenticated'](),controller[_0x31af('0x17')]);router[_0x31af('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x31af('0x19')]);module[_0x31af('0x1a')]=router; \ No newline at end of file +var _0x5577=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x5577,0x1b4));var _0x7557=function(_0x195c12,_0xd9f818){_0x195c12=_0x195c12-0x0;var _0x559c25=_0x5577[_0x195c12];return _0x559c25;};'use strict';var multer=require(_0x7557('0x0'));var util=require('util');var path=require(_0x7557('0x1'));var timeout=require(_0x7557('0x2'));var express=require('express');var router=express[_0x7557('0x3')]();var auth=require(_0x7557('0x4'));var interaction=require(_0x7557('0x5'));var config=require(_0x7557('0x6'));var controller=require(_0x7557('0x7'));router[_0x7557('0x8')]('/',auth['isAuthenticated'](),controller[_0x7557('0x9')]);router[_0x7557('0x8')](_0x7557('0xa'),auth[_0x7557('0xb')](),controller[_0x7557('0xc')]);router[_0x7557('0x8')](_0x7557('0xd'),auth[_0x7557('0xb')](),controller[_0x7557('0xe')]);router[_0x7557('0x8')](_0x7557('0xf'),auth[_0x7557('0xb')](),controller[_0x7557('0x10')]);router[_0x7557('0x11')]('/',auth[_0x7557('0xb')](),controller['create']);router['post'](_0x7557('0xd'),auth[_0x7557('0xb')](),controller[_0x7557('0x12')]);router[_0x7557('0x13')](_0x7557('0xa'),auth[_0x7557('0xb')](),controller[_0x7557('0x14')]);router[_0x7557('0x15')](_0x7557('0xa'),auth[_0x7557('0xb')](),controller['destroy']);module[_0x7557('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 72c6370..08f5315 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 _0xef52=['sequelize','exports','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x25545f,_0x6f9bab){var _0x18856d=function(_0x299117){while(--_0x299117){_0x25545f['push'](_0x25545f['shift']());}};_0x18856d(++_0x6f9bab);}(_0xef52,0x126));var _0x2ef5=function(_0x1d5458,_0x3acf09){_0x1d5458=_0x1d5458-0x0;var _0x9bf6f=_0xef52[_0x1d5458];return _0x9bf6f;};'use strict';var Sequelize=require(_0x2ef5('0x0'));module[_0x2ef5('0x1')]={'name':{'type':Sequelize[_0x2ef5('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2ef5('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x2ef5('0x3')),'defaultValue':_0x2ef5('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x2ef5('0x2')]},'token':{'type':Sequelize[_0x2ef5('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2ef5('0x4')](_0x2ef5('0x5'),_0x2ef5('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x21c1=['newTab','exports','STRING','ENUM','integrationTab'];(function(_0x1232ec,_0x2df4b1){var _0x4483b4=function(_0x39bfff){while(--_0x39bfff){_0x1232ec['push'](_0x1232ec['shift']());}};_0x4483b4(++_0x2df4b1);}(_0x21c1,0x1c3));var _0x121c=function(_0x4d4ef8,_0x4c9d05){_0x4d4ef8=_0x4d4ef8-0x0;var _0x1137a3=_0x21c1[_0x4d4ef8];return _0x1137a3;};'use strict';var Sequelize=require('sequelize');module[_0x121c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x121c('0x1')]},'username':{'type':Sequelize[_0x121c('0x1')]},'remoteUri':{'type':Sequelize[_0x121c('0x1')]},'authType':{'type':Sequelize[_0x121c('0x2')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x121c('0x1')]},'consumerSecret':{'type':Sequelize[_0x121c('0x1')]},'token':{'type':Sequelize[_0x121c('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x121c('0x1')]},'type':{'type':Sequelize[_0x121c('0x2')](_0x121c('0x3'),_0x121c('0x4')),'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 6528852..642816c 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 _0x4474=['Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','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~!@#$%^&-_=+[{]}.','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','DeskAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','rawAttributes','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','DeskField','getFields','priority','remoteUri','authType','username','consumerSecret','token','tokenSecret','GET','format','application/json','basic','headers','Authorization'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4474,0x8b));var _0x4447=function(_0x371f33,_0x278a69){_0x371f33=_0x371f33-0x0;var _0x246c96=_0x4474[_0x371f33];return _0x246c96;};'use strict';var pdf=require(_0x4447('0x0'));var emlformat=require(_0x4447('0x1'));var rimraf=require(_0x4447('0x2'));var zipdir=require(_0x4447('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4447('0x4'));var moment=require('moment');var BPromise=require(_0x4447('0x5'));var Mustache=require(_0x4447('0x6'));var util=require(_0x4447('0x7'));var path=require(_0x4447('0x8'));var sox=require(_0x4447('0x9'));var csv=require('to-csv');var ejs=require(_0x4447('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4447('0xb'));var jsforce=require(_0x4447('0xc'));var deskjs=require(_0x4447('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4447('0xe'));var Papa=require(_0x4447('0xf'));var Redis=require('ioredis');var authService=require(_0x4447('0x10'));var qs=require(_0x4447('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4447('0x12'));var logger=require(_0x4447('0x13'))(_0x4447('0x14'));var utils=require(_0x4447('0x15'));var config=require(_0x4447('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x4447('0x17'));var client=jayson[_0x4447('0x18')][_0x4447('0x19')]({'port':0x232a});function checkPasswordPattern(_0x139e0d,_0x489a64,_0x19ceb7){if(_0x19ceb7){var _0x365b24=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x365b24[_0x4447('0x1a')](_0x489a64)){return _0x139e0d;}else{throw new db[(_0x4447('0x1b'))]['ValidationError'](_0x4447('0x1c'));}}else{return _0x139e0d;}}function respondWithRpcPromise(_0xa23cfb,_0x409e9a,_0x1f1d10,_0x30cf84){return new BPromise(function(_0x1eeb82,_0x572b05){var _0x4ff95b=_0x30cf84||client;return _0x4ff95b[_0x4447('0x1d')](_0xa23cfb,_0x1f1d10)[_0x4447('0x1e')](function(_0x14ffb0){logger['info'](_0x4447('0x1f'),_0x409e9a,_0x4447('0x20'));logger[_0x4447('0x21')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x409e9a,'request\x20sent',JSON[_0x4447('0x22')](_0x14ffb0));if(_0x14ffb0[_0x4447('0x23')]){if(_0x14ffb0['error'][_0x4447('0x24')]===0x1f4){logger[_0x4447('0x23')](_0x4447('0x1f'),_0x409e9a,_0x14ffb0[_0x4447('0x23')]['message']);return _0x572b05(_0x14ffb0[_0x4447('0x23')]['message']);}logger[_0x4447('0x23')]('DeskAccount,\x20%s,\x20%s',_0x409e9a,_0x14ffb0['error'][_0x4447('0x25')]);return _0x1eeb82(_0x14ffb0[_0x4447('0x23')][_0x4447('0x25')]);}else{logger[_0x4447('0x26')]('DeskAccount,\x20%s,\x20%s',_0x409e9a,_0x4447('0x20'));_0x1eeb82(_0x14ffb0[_0x4447('0x27')][_0x4447('0x25')]);}})[_0x4447('0x28')](function(_0x33b35c){logger['error']('DeskAccount,\x20%s,\x20%s',_0x409e9a,_0x33b35c);_0x572b05(_0x33b35c);});});}function respondWithStatusCode(_0x389a1e,_0x213a10){_0x213a10=_0x213a10||0xcc;return function(_0x320b0b){if(_0x320b0b){return _0x389a1e[_0x4447('0x29')](_0x213a10);}return _0x389a1e['status'](_0x213a10)[_0x4447('0x2a')]();};}function respondWithResult(_0x489b95,_0x162540){_0x162540=_0x162540||0xc8;return function(_0x145a7e){if(_0x145a7e){return _0x489b95[_0x4447('0x2b')](_0x162540)[_0x4447('0x2c')](_0x145a7e);}};}function respondWithFilteredResult(_0x32ed13,_0x9731b4){return function(_0x421351){if(_0x421351){var _0x20866e=_0x421351['count'],_0x5e2e2b=_0x9731b4[_0x4447('0x2d')],_0x16da61=_0x9731b4[_0x4447('0x2d')]+_0x9731b4[_0x4447('0x2e')],_0x4767f4;if(_0x16da61>=_0x20866e){_0x16da61=_0x20866e;_0x4767f4=0xc8;}else{_0x4767f4=0xce;}_0x32ed13[_0x4447('0x2b')](_0x4767f4);return _0x32ed13[_0x4447('0x2f')](_0x4447('0x30'),_0x5e2e2b+'-'+_0x16da61+'/'+_0x20866e)['json'](_0x421351);}return null;};}function patchUpdates(_0x3636dd){return function(_0x4369e0){try{jsonpatch[_0x4447('0x31')](_0x4369e0,_0x3636dd,!![]);}catch(_0x3f72a1){return BPromise[_0x4447('0x32')](_0x3f72a1);}return _0x4369e0[_0x4447('0x33')]();};}function saveUpdates(_0x3ae99d,_0x3e2aff){return function(_0x257481){if(_0x257481){return _0x257481[_0x4447('0x34')](_0x3ae99d)[_0x4447('0x1e')](function(_0x10c4ed){return _0x10c4ed;});}return null;};}function removeEntity(_0x13afe1,_0x2e5d6a){return function(_0x3b9e8f){if(_0x3b9e8f){return _0x3b9e8f[_0x4447('0x35')]()['then'](function(){_0x13afe1[_0x4447('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10ad03,_0x28660c){return function(_0x2fca38){if(!_0x2fca38){_0x10ad03['sendStatus'](0x194);}return _0x2fca38;};}function handleError(_0x2f9b52,_0x3bbe7){_0x3bbe7=_0x3bbe7||0x1f4;return function(_0xa4904){logger[_0x4447('0x23')](_0xa4904[_0x4447('0x36')]);if(_0xa4904[_0x4447('0x37')]){delete _0xa4904['name'];}_0x2f9b52[_0x4447('0x2b')](_0x3bbe7)[_0x4447('0x38')](_0xa4904);};}exports['index']=function(_0x47f186,_0x3af59b){var _0x4fe11a={},_0x459912={},_0x44eb97={'count':0x0,'rows':[]};var _0x220f50=_[_0x4447('0x39')](db[_0x4447('0x3a')]['rawAttributes'],function(_0x5aafed){return{'name':_0x5aafed[_0x4447('0x3b')],'type':_0x5aafed[_0x4447('0x3c')][_0x4447('0x3d')]};});_0x459912[_0x4447('0x3e')]=_[_0x4447('0x39')](_0x220f50,_0x4447('0x37'));_0x459912['query']=_[_0x4447('0x3f')](_0x47f186[_0x4447('0x40')]);_0x459912[_0x4447('0x41')]=_[_0x4447('0x42')](_0x459912[_0x4447('0x3e')],_0x459912[_0x4447('0x40')]);_0x4fe11a[_0x4447('0x43')]=_['intersection'](_0x459912[_0x4447('0x3e')],qs[_0x4447('0x44')](_0x47f186[_0x4447('0x40')][_0x4447('0x44')]));_0x4fe11a['attributes']=_0x4fe11a['attributes'][_0x4447('0x45')]?_0x4fe11a[_0x4447('0x43')]:_0x459912[_0x4447('0x3e')];if(!_0x47f186[_0x4447('0x40')]['hasOwnProperty'](_0x4447('0x46'))){_0x4fe11a['limit']=qs[_0x4447('0x2e')](_0x47f186[_0x4447('0x40')][_0x4447('0x2e')]);_0x4fe11a['offset']=qs[_0x4447('0x2d')](_0x47f186[_0x4447('0x40')][_0x4447('0x2d')]);}_0x4fe11a[_0x4447('0x47')]=qs[_0x4447('0x48')](_0x47f186[_0x4447('0x40')][_0x4447('0x48')]);_0x4fe11a[_0x4447('0x49')]=qs['filters'](_[_0x4447('0x4a')](_0x47f186[_0x4447('0x40')],_0x459912[_0x4447('0x41')]),_0x220f50);if(_0x47f186[_0x4447('0x40')][_0x4447('0x4b')]){_0x4fe11a[_0x4447('0x49')]=_['merge'](_0x4fe11a[_0x4447('0x49')],{'$or':_['map'](_0x220f50,function(_0x37042c){if(_0x37042c['type']!==_0x4447('0x4c')){var _0x408382={};_0x408382[_0x37042c[_0x4447('0x37')]]={'$like':'%'+_0x47f186['query']['filter']+'%'};return _0x408382;}})});}_0x4fe11a=_[_0x4447('0x4d')]({},_0x4fe11a,_0x47f186[_0x4447('0x4e')]);var _0x285377={'where':_0x4fe11a[_0x4447('0x49')]};return db[_0x4447('0x3a')][_0x4447('0x4f')](_0x285377)['then'](function(_0x492a2d){_0x44eb97[_0x4447('0x4f')]=_0x492a2d;if(_0x47f186['query'][_0x4447('0x50')]){_0x4fe11a[_0x4447('0x51')]=[{'all':!![]}];}return db[_0x4447('0x3a')][_0x4447('0x52')](_0x4fe11a);})[_0x4447('0x1e')](function(_0x26ccd4){_0x44eb97[_0x4447('0x53')]=_0x26ccd4;return _0x44eb97;})[_0x4447('0x1e')](respondWithFilteredResult(_0x3af59b,_0x4fe11a))[_0x4447('0x28')](handleError(_0x3af59b,null));};exports[_0x4447('0x54')]=function(_0xdd39f5,_0xdba79f){var _0x27a30f={'raw':![],'where':{'id':_0xdd39f5[_0x4447('0x55')]['id']}},_0x575a49={};_0x575a49[_0x4447('0x3e')]=_[_0x4447('0x3f')](db[_0x4447('0x3a')]['rawAttributes']);_0x575a49[_0x4447('0x40')]=_['keys'](_0xdd39f5[_0x4447('0x40')]);_0x575a49[_0x4447('0x41')]=_['intersection'](_0x575a49[_0x4447('0x3e')],_0x575a49['query']);_0x27a30f[_0x4447('0x43')]=_[_0x4447('0x42')](_0x575a49['model'],qs[_0x4447('0x44')](_0xdd39f5[_0x4447('0x40')][_0x4447('0x44')]));_0x27a30f['attributes']=_0x27a30f['attributes'][_0x4447('0x45')]?_0x27a30f[_0x4447('0x43')]:_0x575a49[_0x4447('0x3e')];if(_0xdd39f5[_0x4447('0x40')][_0x4447('0x50')]){_0x27a30f['include']=[{'all':!![]}];}_0x27a30f=_[_0x4447('0x4d')]({},_0x27a30f,_0xdd39f5[_0x4447('0x4e')]);return db[_0x4447('0x3a')][_0x4447('0x56')](_0x27a30f)[_0x4447('0x1e')](handleEntityNotFound(_0xdba79f,null))['then'](respondWithResult(_0xdba79f,null))[_0x4447('0x28')](handleError(_0xdba79f,null));};exports[_0x4447('0x57')]=function(_0x68f876,_0x4c10ed){return db[_0x4447('0x3a')][_0x4447('0x57')](_0x68f876[_0x4447('0x58')],{})[_0x4447('0x1e')](respondWithResult(_0x4c10ed,0xc9))[_0x4447('0x28')](handleError(_0x4c10ed,null));};exports[_0x4447('0x34')]=function(_0x5c0d24,_0x1679db){if(_0x5c0d24['body']['id']){delete _0x5c0d24[_0x4447('0x58')]['id'];}return db['DeskAccount'][_0x4447('0x56')]({'where':{'id':_0x5c0d24[_0x4447('0x55')]['id']}})['then'](handleEntityNotFound(_0x1679db,null))[_0x4447('0x1e')](saveUpdates(_0x5c0d24[_0x4447('0x58')],null))[_0x4447('0x1e')](respondWithResult(_0x1679db,null))['catch'](handleError(_0x1679db,null));};exports['destroy']=function(_0x1b822d,_0x11907d){return db[_0x4447('0x3a')][_0x4447('0x56')]({'where':{'id':_0x1b822d['params']['id']}})['then'](handleEntityNotFound(_0x11907d,null))[_0x4447('0x1e')](removeEntity(_0x11907d,null))[_0x4447('0x28')](handleError(_0x11907d,null));};exports[_0x4447('0x59')]=function(_0x1b06a9,_0x1bf9db,_0x90f8d3){var _0x1d15b1={};var _0x472eae={};var _0xf29da5;var _0x579ab2;return db['DeskAccount'][_0x4447('0x5a')]({'where':{'id':_0x1b06a9[_0x4447('0x55')]['id']}})[_0x4447('0x1e')](handleEntityNotFound(_0x1bf9db,null))[_0x4447('0x1e')](function(_0x3cd23e){if(_0x3cd23e){_0xf29da5=_0x3cd23e;_0x472eae['model']=_['keys'](db[_0x4447('0x5b')][_0x4447('0x5c')]);_0x472eae[_0x4447('0x40')]=_[_0x4447('0x3f')](_0x1b06a9[_0x4447('0x40')]);_0x472eae['filters']=_[_0x4447('0x42')](_0x472eae[_0x4447('0x3e')],_0x472eae[_0x4447('0x40')]);_0x1d15b1[_0x4447('0x43')]=_[_0x4447('0x42')](_0x472eae['model'],qs[_0x4447('0x44')](_0x1b06a9[_0x4447('0x40')][_0x4447('0x44')]));_0x1d15b1[_0x4447('0x43')]=_0x1d15b1['attributes'][_0x4447('0x45')]?_0x1d15b1[_0x4447('0x43')]:_0x472eae[_0x4447('0x3e')];_0x1d15b1[_0x4447('0x47')]=qs[_0x4447('0x48')](_0x1b06a9[_0x4447('0x40')]['sort']);_0x1d15b1[_0x4447('0x49')]=qs['filters'](_['pick'](_0x1b06a9['query'],_0x472eae[_0x4447('0x41')]));if(_0x1b06a9[_0x4447('0x40')]['filter']){_0x1d15b1[_0x4447('0x49')]=_[_0x4447('0x4d')](_0x1d15b1[_0x4447('0x49')],{'$or':_[_0x4447('0x39')](_0x1d15b1[_0x4447('0x43')],function(_0x3a8a3b){var _0xa2398e={};_0xa2398e[_0x3a8a3b]={'$like':'%'+_0x1b06a9[_0x4447('0x40')][_0x4447('0x4b')]+'%'};return _0xa2398e;})});}_0x1d15b1=_[_0x4447('0x4d')]({},_0x1d15b1,_0x1b06a9[_0x4447('0x4e')]);return _0xf29da5[_0x4447('0x59')](_0x1d15b1);}})['then'](function(_0x174eeb){if(_0x174eeb){_0x579ab2=_0x174eeb[_0x4447('0x45')];if(!_0x1b06a9[_0x4447('0x40')][_0x4447('0x5d')]('nolimit')){_0x1d15b1[_0x4447('0x2e')]=qs[_0x4447('0x2e')](_0x1b06a9[_0x4447('0x40')][_0x4447('0x2e')]);_0x1d15b1[_0x4447('0x2d')]=qs[_0x4447('0x2d')](_0x1b06a9[_0x4447('0x40')][_0x4447('0x2d')]);}return _0xf29da5[_0x4447('0x59')](_0x1d15b1);}})[_0x4447('0x1e')](function(_0x39454c){if(_0x39454c){return _0x39454c?{'count':_0x579ab2,'rows':_0x39454c}:null;}})[_0x4447('0x1e')](respondWithResult(_0x1bf9db,null))[_0x4447('0x28')](handleError(_0x1bf9db,null));};exports[_0x4447('0x5e')]=function(_0x110198,_0x26a53f,_0x50791c){if(_0x110198[_0x4447('0x58')]['id']){delete _0x110198[_0x4447('0x58')]['id'];}return db[_0x4447('0x3a')]['findOne']({'where':{'id':_0x110198[_0x4447('0x55')]['id']}})['then'](handleEntityNotFound(_0x26a53f,null))[_0x4447('0x1e')](function(_0x44ce64){if(_0x44ce64){_0x110198[_0x4447('0x58')][_0x4447('0x5f')]=_0x44ce64['id'];_0x110198[_0x4447('0x58')][_0x4447('0x60')]=integrations[_0x4447('0x61')](_0x110198['body']['channel'],_0x110198['body'][_0x4447('0x3c')]);_0x110198[_0x4447('0x58')][_0x4447('0x62')]=integrations['getDescriptions'](_0x110198[_0x4447('0x58')][_0x4447('0x63')],_0x110198[_0x4447('0x58')][_0x4447('0x3c')]);return db[_0x4447('0x5b')][_0x4447('0x57')](_0x110198['body'],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x4447('0x64')],'as':'Descriptions'}]});}return null;})[_0x4447('0x1e')](respondWithResult(_0x26a53f,null))['catch'](handleError(_0x26a53f,null));};exports[_0x4447('0x65')]=function(_0x5a7cc2,_0x41cad3,_0x43fb8c){var _0x29bb03=[{'name':_0x4447('0x66'),'label':_0x4447('0x66'),'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 _0x594cc9='';return db['DeskAccount'][_0x4447('0x5a')]({'where':{'id':_0x5a7cc2[_0x4447('0x55')]['id']},'attributes':['id',_0x4447('0x67'),_0x4447('0x68'),_0x4447('0x69'),'password','consumerKey',_0x4447('0x6a'),_0x4447('0x6b'),_0x4447('0x6c')]})['then'](handleEntityNotFound(_0x41cad3,null))[_0x4447('0x1e')](function(_0x5c9045){if(_0x5c9045){_0x594cc9=_0x5c9045[_0x4447('0x67')];var _0x375152=_0x594cc9['slice'](-0x1);if(_0x375152==='/'){_0x594cc9=_0x594cc9['substring'](0x0,_0x594cc9['lastIndexOf'](_0x375152));}var _0x41d00d={'method':_0x4447('0x6d'),'uri':util[_0x4447('0x6e')]('%s/custom_fields',_0x594cc9),'headers':{'Content-Type':_0x4447('0x6f'),'Accept':_0x4447('0x6f')},'json':!![]};if(_0x5c9045[_0x4447('0x68')]===_0x4447('0x70')){_0x41d00d[_0x4447('0x71')][_0x4447('0x72')]=util[_0x4447('0x6e')](_0x4447('0x73'),new Buffer(util[_0x4447('0x6e')](_0x4447('0x74'),_0x5c9045['username'],_0x5c9045[_0x4447('0x75')]))[_0x4447('0x76')](_0x4447('0x77')));}return rp(_0x41d00d)[_0x4447('0x1e')](function(_0x367089){return _0x29bb03[_0x4447('0x78')](_[_0x4447('0x39')](_0x367089[_0x4447('0x79')][_0x4447('0x7a')],function(_0x214ea2){return{'id':_0x214ea2[_0x4447('0x37')],'name':_0x214ea2['name'],'type':_0x214ea2[_0x4447('0x3c')],'active':_0x214ea2[_0x4447('0x7b')],'label':_0x214ea2[_0x4447('0x7c')],'custom':!![]};}));});}})[_0x4447('0x1e')](function(_0x23b081){return{'count':_0x23b081['length'],'rows':_0x23b081};})['then'](respondWithResult(_0x41cad3,null))[_0x4447('0x28')](function(_0x5af81d){var _0x5d53e5=_0x5a7cc2[_0x4447('0x40')][_0x4447('0x1a')]?0x1f4:_0x5af81d['statusCode']||0x1f4;logger[_0x4447('0x23')](_0x4447('0x7d'),_0x4447('0x65'),_0x5d53e5,JSON['stringify'](_0x5af81d));delete _0x5af81d['name'];if(_0x5d53e5===0x191){_0x5d53e5=0x190;}_0x41cad3[_0x4447('0x2b')](_0x5d53e5)[_0x4447('0x38')](_0x5a7cc2[_0x4447('0x40')][_0x4447('0x1a')]?{'message':_0x4447('0x7e'),'statusCode':_0x5af81d['statusCode']}:_0x5af81d);});}; \ No newline at end of file +var _0x417d=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../components/integrations/configuration','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','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','fieldName','type','key','query','keys','intersection','model','fields','attributes','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','DeskAccount','findAll','show','params','rawAttributes','length','includeAll','include','create','body','find','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','password','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','username','_embedded','entries','active','label','statusCode','stringify','Wrong\x20credentials','html-pdf','eml-format'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x417d,0x7c));var _0xd417=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x417d[_0xf71120];return _0xbe2fd3;};'use strict';var pdf=require(_0xd417('0x0'));var emlformat=require(_0xd417('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd417('0x2'));var jsonpatch=require(_0xd417('0x3'));var rp=require(_0xd417('0x4'));var moment=require(_0xd417('0x5'));var BPromise=require(_0xd417('0x6'));var Mustache=require(_0xd417('0x7'));var util=require('util');var path=require(_0xd417('0x8'));var sox=require(_0xd417('0x9'));var csv=require(_0xd417('0xa'));var ejs=require(_0xd417('0xb'));var fs=require('fs');var _=require(_0xd417('0xc'));var squel=require(_0xd417('0xd'));var crypto=require(_0xd417('0xe'));var jsforce=require(_0xd417('0xf'));var deskjs=require(_0xd417('0x10'));var toCsv=require(_0xd417('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd417('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd417('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd417('0x13'))(_0xd417('0x14'));var utils=require(_0xd417('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xd417('0x16'));var jayson=require(_0xd417('0x17'));var client=jayson[_0xd417('0x18')][_0xd417('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3b5975,_0x48b6c0,_0x1c04b3){if(_0x1c04b3){var _0x5cd2dc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5cd2dc[_0xd417('0x1a')](_0x48b6c0)){return _0x3b5975;}else{throw new db['Sequelize'][(_0xd417('0x1b'))](_0xd417('0x1c'));}}else{return _0x3b5975;}}function respondWithRpcPromise(_0x26f4bd,_0x412902,_0x168251,_0x4aac43){return new BPromise(function(_0x4b3420,_0x33a588){var _0x4f76e9=_0x4aac43||client;return _0x4f76e9[_0xd417('0x1d')](_0x26f4bd,_0x168251)[_0xd417('0x1e')](function(_0x5ff5e6){logger[_0xd417('0x1f')](_0xd417('0x20'),_0x412902,_0xd417('0x21'));logger[_0xd417('0x22')](_0xd417('0x23'),_0x412902,_0xd417('0x21'),JSON['stringify'](_0x5ff5e6));if(_0x5ff5e6[_0xd417('0x24')]){if(_0x5ff5e6[_0xd417('0x24')][_0xd417('0x25')]===0x1f4){logger[_0xd417('0x24')](_0xd417('0x20'),_0x412902,_0x5ff5e6[_0xd417('0x24')][_0xd417('0x26')]);return _0x33a588(_0x5ff5e6[_0xd417('0x24')]['message']);}logger[_0xd417('0x24')]('DeskAccount,\x20%s,\x20%s',_0x412902,_0x5ff5e6[_0xd417('0x24')][_0xd417('0x26')]);return _0x4b3420(_0x5ff5e6[_0xd417('0x24')][_0xd417('0x26')]);}else{logger[_0xd417('0x1f')]('DeskAccount,\x20%s,\x20%s',_0x412902,_0xd417('0x21'));_0x4b3420(_0x5ff5e6[_0xd417('0x27')][_0xd417('0x26')]);}})[_0xd417('0x28')](function(_0x2e07c0){logger[_0xd417('0x24')](_0xd417('0x20'),_0x412902,_0x2e07c0);_0x33a588(_0x2e07c0);});});}function respondWithStatusCode(_0x3add74,_0xdca672){_0xdca672=_0xdca672||0xcc;return function(_0x4d8afe){if(_0x4d8afe){return _0x3add74[_0xd417('0x29')](_0xdca672);}return _0x3add74['status'](_0xdca672)[_0xd417('0x2a')]();};}function respondWithResult(_0x43f510,_0x56a290){_0x56a290=_0x56a290||0xc8;return function(_0x26b09c){if(_0x26b09c){return _0x43f510[_0xd417('0x2b')](_0x56a290)[_0xd417('0x2c')](_0x26b09c);}};}function respondWithFilteredResult(_0x61184e,_0x43a3aa){return function(_0x3a9c1b){if(_0x3a9c1b){var _0x5f40b0=_0x3a9c1b[_0xd417('0x2d')],_0x123e9b=_0x43a3aa['offset'],_0x5712ac=_0x43a3aa[_0xd417('0x2e')]+_0x43a3aa['limit'],_0x5c2ddf;if(_0x5712ac>=_0x5f40b0){_0x5712ac=_0x5f40b0;_0x5c2ddf=0xc8;}else{_0x5c2ddf=0xce;}_0x61184e[_0xd417('0x2b')](_0x5c2ddf);return _0x61184e[_0xd417('0x2f')](_0xd417('0x30'),_0x123e9b+'-'+_0x5712ac+'/'+_0x5f40b0)[_0xd417('0x2c')](_0x3a9c1b);}return null;};}function patchUpdates(_0x3836ce){return function(_0x32ac13){try{jsonpatch[_0xd417('0x31')](_0x32ac13,_0x3836ce,!![]);}catch(_0x1f9158){return BPromise[_0xd417('0x32')](_0x1f9158);}return _0x32ac13[_0xd417('0x33')]();};}function saveUpdates(_0x5a192e,_0x34b53d){return function(_0x176bb5){if(_0x176bb5){return _0x176bb5[_0xd417('0x34')](_0x5a192e)['then'](function(_0x253117){return _0x253117;});}return null;};}function removeEntity(_0x359382,_0x28f311){return function(_0x1ca035){if(_0x1ca035){return _0x1ca035[_0xd417('0x35')]()[_0xd417('0x1e')](function(){_0x359382[_0xd417('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52e83c,_0x7d831){return function(_0x2d0121){if(!_0x2d0121){_0x52e83c['sendStatus'](0x194);}return _0x2d0121;};}function handleError(_0x5ccdd9,_0x4705ad){_0x4705ad=_0x4705ad||0x1f4;return function(_0x1e30d5){logger[_0xd417('0x24')](_0x1e30d5[_0xd417('0x36')]);if(_0x1e30d5[_0xd417('0x37')]){delete _0x1e30d5[_0xd417('0x37')];}_0x5ccdd9[_0xd417('0x2b')](_0x4705ad)[_0xd417('0x38')](_0x1e30d5);};}exports['index']=function(_0x2becd1,_0x4072d0){var _0x4577ea={},_0x33a3b7={},_0x39b6f4={'count':0x0,'rows':[]};var _0x3994cf=_[_0xd417('0x39')](db['DeskAccount']['rawAttributes'],function(_0x491e46){return{'name':_0x491e46[_0xd417('0x3a')],'type':_0x491e46[_0xd417('0x3b')][_0xd417('0x3c')]};});_0x33a3b7['model']=_[_0xd417('0x39')](_0x3994cf,_0xd417('0x37'));_0x33a3b7[_0xd417('0x3d')]=_[_0xd417('0x3e')](_0x2becd1[_0xd417('0x3d')]);_0x33a3b7['filters']=_[_0xd417('0x3f')](_0x33a3b7[_0xd417('0x40')],_0x33a3b7[_0xd417('0x3d')]);_0x4577ea['attributes']=_[_0xd417('0x3f')](_0x33a3b7[_0xd417('0x40')],qs[_0xd417('0x41')](_0x2becd1[_0xd417('0x3d')][_0xd417('0x41')]));_0x4577ea['attributes']=_0x4577ea['attributes']['length']?_0x4577ea[_0xd417('0x42')]:_0x33a3b7[_0xd417('0x40')];if(!_0x2becd1['query']['hasOwnProperty']('nolimit')){_0x4577ea[_0xd417('0x43')]=qs[_0xd417('0x43')](_0x2becd1[_0xd417('0x3d')]['limit']);_0x4577ea[_0xd417('0x2e')]=qs[_0xd417('0x2e')](_0x2becd1[_0xd417('0x3d')][_0xd417('0x2e')]);}_0x4577ea[_0xd417('0x44')]=qs[_0xd417('0x45')](_0x2becd1[_0xd417('0x3d')][_0xd417('0x45')]);_0x4577ea[_0xd417('0x46')]=qs[_0xd417('0x47')](_[_0xd417('0x48')](_0x2becd1[_0xd417('0x3d')],_0x33a3b7[_0xd417('0x47')]),_0x3994cf);if(_0x2becd1[_0xd417('0x3d')]['filter']){_0x4577ea[_0xd417('0x46')]=_[_0xd417('0x49')](_0x4577ea[_0xd417('0x46')],{'$or':_[_0xd417('0x39')](_0x3994cf,function(_0x3ae363){if(_0x3ae363['type']!==_0xd417('0x4a')){var _0x3302a0={};_0x3302a0[_0x3ae363[_0xd417('0x37')]]={'$like':'%'+_0x2becd1['query'][_0xd417('0x4b')]+'%'};return _0x3302a0;}})});}_0x4577ea=_[_0xd417('0x49')]({},_0x4577ea,_0x2becd1[_0xd417('0x4c')]);var _0x8c26a3={'where':_0x4577ea[_0xd417('0x46')]};return db[_0xd417('0x4d')][_0xd417('0x2d')](_0x8c26a3)[_0xd417('0x1e')](function(_0x1df541){_0x39b6f4[_0xd417('0x2d')]=_0x1df541;if(_0x2becd1[_0xd417('0x3d')]['includeAll']){_0x4577ea['include']=[{'all':!![]}];}return db[_0xd417('0x4d')][_0xd417('0x4e')](_0x4577ea);})[_0xd417('0x1e')](function(_0x17d023){_0x39b6f4['rows']=_0x17d023;return _0x39b6f4;})[_0xd417('0x1e')](respondWithFilteredResult(_0x4072d0,_0x4577ea))[_0xd417('0x28')](handleError(_0x4072d0,null));};exports[_0xd417('0x4f')]=function(_0x24d6f7,_0x973aab){var _0x91ca76={'raw':![],'where':{'id':_0x24d6f7[_0xd417('0x50')]['id']}},_0x4a304c={};_0x4a304c[_0xd417('0x40')]=_[_0xd417('0x3e')](db[_0xd417('0x4d')][_0xd417('0x51')]);_0x4a304c[_0xd417('0x3d')]=_[_0xd417('0x3e')](_0x24d6f7['query']);_0x4a304c[_0xd417('0x47')]=_[_0xd417('0x3f')](_0x4a304c['model'],_0x4a304c[_0xd417('0x3d')]);_0x91ca76['attributes']=_['intersection'](_0x4a304c[_0xd417('0x40')],qs[_0xd417('0x41')](_0x24d6f7[_0xd417('0x3d')][_0xd417('0x41')]));_0x91ca76[_0xd417('0x42')]=_0x91ca76[_0xd417('0x42')][_0xd417('0x52')]?_0x91ca76[_0xd417('0x42')]:_0x4a304c[_0xd417('0x40')];if(_0x24d6f7[_0xd417('0x3d')][_0xd417('0x53')]){_0x91ca76[_0xd417('0x54')]=[{'all':!![]}];}_0x91ca76=_[_0xd417('0x49')]({},_0x91ca76,_0x24d6f7['options']);return db[_0xd417('0x4d')]['find'](_0x91ca76)[_0xd417('0x1e')](handleEntityNotFound(_0x973aab,null))[_0xd417('0x1e')](respondWithResult(_0x973aab,null))[_0xd417('0x28')](handleError(_0x973aab,null));};exports[_0xd417('0x55')]=function(_0x5af3af,_0x4ad8ab){return db[_0xd417('0x4d')][_0xd417('0x55')](_0x5af3af[_0xd417('0x56')],{})[_0xd417('0x1e')](respondWithResult(_0x4ad8ab,0xc9))[_0xd417('0x28')](handleError(_0x4ad8ab,null));};exports['update']=function(_0x329c0d,_0x3ad6d3){if(_0x329c0d['body']['id']){delete _0x329c0d[_0xd417('0x56')]['id'];}return db['DeskAccount'][_0xd417('0x57')]({'where':{'id':_0x329c0d[_0xd417('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ad6d3,null))[_0xd417('0x1e')](saveUpdates(_0x329c0d[_0xd417('0x56')],null))[_0xd417('0x1e')](respondWithResult(_0x3ad6d3,null))['catch'](handleError(_0x3ad6d3,null));};exports[_0xd417('0x35')]=function(_0x46f629,_0x2fb3eb){return db[_0xd417('0x4d')][_0xd417('0x57')]({'where':{'id':_0x46f629[_0xd417('0x50')]['id']}})[_0xd417('0x1e')](handleEntityNotFound(_0x2fb3eb,null))[_0xd417('0x1e')](removeEntity(_0x2fb3eb,null))['catch'](handleError(_0x2fb3eb,null));};exports[_0xd417('0x58')]=function(_0x407499,_0x8c5507,_0x119fb5){var _0x564286={};var _0x1cfeaa={};var _0x16d81c;var _0x2923d3;return db[_0xd417('0x4d')][_0xd417('0x59')]({'where':{'id':_0x407499['params']['id']}})[_0xd417('0x1e')](handleEntityNotFound(_0x8c5507,null))['then'](function(_0x5ab255){if(_0x5ab255){_0x16d81c=_0x5ab255;_0x1cfeaa['model']=_[_0xd417('0x3e')](db[_0xd417('0x5a')][_0xd417('0x51')]);_0x1cfeaa[_0xd417('0x3d')]=_[_0xd417('0x3e')](_0x407499[_0xd417('0x3d')]);_0x1cfeaa['filters']=_[_0xd417('0x3f')](_0x1cfeaa[_0xd417('0x40')],_0x1cfeaa[_0xd417('0x3d')]);_0x564286[_0xd417('0x42')]=_[_0xd417('0x3f')](_0x1cfeaa[_0xd417('0x40')],qs['fields'](_0x407499['query'][_0xd417('0x41')]));_0x564286[_0xd417('0x42')]=_0x564286['attributes'][_0xd417('0x52')]?_0x564286[_0xd417('0x42')]:_0x1cfeaa['model'];_0x564286[_0xd417('0x44')]=qs[_0xd417('0x45')](_0x407499[_0xd417('0x3d')]['sort']);_0x564286[_0xd417('0x46')]=qs[_0xd417('0x47')](_[_0xd417('0x48')](_0x407499[_0xd417('0x3d')],_0x1cfeaa['filters']));if(_0x407499[_0xd417('0x3d')][_0xd417('0x4b')]){_0x564286['where']=_[_0xd417('0x49')](_0x564286[_0xd417('0x46')],{'$or':_[_0xd417('0x39')](_0x564286[_0xd417('0x42')],function(_0x1f97dc){var _0x35e107={};_0x35e107[_0x1f97dc]={'$like':'%'+_0x407499[_0xd417('0x3d')][_0xd417('0x4b')]+'%'};return _0x35e107;})});}_0x564286=_['merge']({},_0x564286,_0x407499[_0xd417('0x4c')]);return _0x16d81c[_0xd417('0x58')](_0x564286);}})[_0xd417('0x1e')](function(_0x169c15){if(_0x169c15){_0x2923d3=_0x169c15[_0xd417('0x52')];if(!_0x407499['query'][_0xd417('0x5b')](_0xd417('0x5c'))){_0x564286['limit']=qs[_0xd417('0x43')](_0x407499[_0xd417('0x3d')][_0xd417('0x43')]);_0x564286['offset']=qs['offset'](_0x407499[_0xd417('0x3d')][_0xd417('0x2e')]);}return _0x16d81c[_0xd417('0x58')](_0x564286);}})[_0xd417('0x1e')](function(_0xd0e3b){if(_0xd0e3b){return _0xd0e3b?{'count':_0x2923d3,'rows':_0xd0e3b}:null;}})[_0xd417('0x1e')](respondWithResult(_0x8c5507,null))[_0xd417('0x28')](handleError(_0x8c5507,null));};exports[_0xd417('0x5d')]=function(_0x321214,_0x2ce212,_0x2d4441){if(_0x321214[_0xd417('0x56')]['id']){delete _0x321214[_0xd417('0x56')]['id'];}return db[_0xd417('0x4d')][_0xd417('0x59')]({'where':{'id':_0x321214[_0xd417('0x50')]['id']}})[_0xd417('0x1e')](handleEntityNotFound(_0x2ce212,null))[_0xd417('0x1e')](function(_0x48b238){if(_0x48b238){_0x321214[_0xd417('0x56')][_0xd417('0x5e')]=_0x48b238['id'];_0x321214[_0xd417('0x56')]['Subjects']=integrations[_0xd417('0x5f')](_0x321214[_0xd417('0x56')][_0xd417('0x60')],_0x321214[_0xd417('0x56')][_0xd417('0x3b')]);_0x321214[_0xd417('0x56')][_0xd417('0x61')]=integrations[_0xd417('0x62')](_0x321214[_0xd417('0x56')][_0xd417('0x60')],_0x321214[_0xd417('0x56')][_0xd417('0x3b')]);return db['DeskConfiguration'][_0xd417('0x55')](_0x321214[_0xd417('0x56')],{'include':[{'model':db[_0xd417('0x63')],'as':_0xd417('0x64')},{'model':db['DeskField'],'as':_0xd417('0x61')}]});}return null;})[_0xd417('0x1e')](respondWithResult(_0x2ce212,null))['catch'](handleError(_0x2ce212,null));};exports[_0xd417('0x65')]=function(_0x58e13a,_0x2d88cc,_0x56fefa){var _0x316bfa=[{'name':_0xd417('0x66'),'label':_0xd417('0x66'),'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 _0x6e54c5='';return db[_0xd417('0x4d')][_0xd417('0x59')]({'where':{'id':_0x58e13a[_0xd417('0x50')]['id']},'attributes':['id',_0xd417('0x67'),'authType','username',_0xd417('0x68'),_0xd417('0x69'),_0xd417('0x6a'),'token',_0xd417('0x6b')]})[_0xd417('0x1e')](handleEntityNotFound(_0x2d88cc,null))[_0xd417('0x1e')](function(_0x462912){if(_0x462912){_0x6e54c5=_0x462912[_0xd417('0x67')];var _0x2335a2=_0x6e54c5[_0xd417('0x6c')](-0x1);if(_0x2335a2==='/'){_0x6e54c5=_0x6e54c5[_0xd417('0x6d')](0x0,_0x6e54c5[_0xd417('0x6e')](_0x2335a2));}var _0xfbfe63={'method':'GET','uri':util[_0xd417('0x6f')](_0xd417('0x70'),_0x6e54c5),'headers':{'Content-Type':_0xd417('0x71'),'Accept':_0xd417('0x71')},'json':!![]};if(_0x462912['authType']===_0xd417('0x72')){_0xfbfe63[_0xd417('0x73')][_0xd417('0x74')]=util[_0xd417('0x6f')]('Basic\x20%s',new Buffer(util[_0xd417('0x6f')](_0xd417('0x75'),_0x462912[_0xd417('0x76')],_0x462912['password']))['toString']('base64'));}return rp(_0xfbfe63)[_0xd417('0x1e')](function(_0x55fc0f){return _0x316bfa['concat'](_[_0xd417('0x39')](_0x55fc0f[_0xd417('0x77')][_0xd417('0x78')],function(_0x2adf1e){return{'id':_0x2adf1e[_0xd417('0x37')],'name':_0x2adf1e['name'],'type':_0x2adf1e[_0xd417('0x3b')],'active':_0x2adf1e[_0xd417('0x79')],'label':_0x2adf1e[_0xd417('0x7a')],'custom':!![]};}));});}})['then'](function(_0x333e38){return{'count':_0x333e38[_0xd417('0x52')],'rows':_0x333e38};})[_0xd417('0x1e')](respondWithResult(_0x2d88cc,null))[_0xd417('0x28')](function(_0x498ed6){var _0x468339=_0x58e13a[_0xd417('0x3d')][_0xd417('0x1a')]?0x1f4:_0x498ed6[_0xd417('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xd417('0x65'),_0x468339,JSON[_0xd417('0x7c')](_0x498ed6));delete _0x498ed6[_0xd417('0x37')];if(_0x468339===0x191){_0x468339=0x190;}_0x2d88cc[_0xd417('0x2b')](_0x468339)[_0xd417('0x38')](_0x58e13a['query'][_0xd417('0x1a')]?{'message':_0xd417('0x7d'),'statusCode':_0x498ed6['statusCode']}:_0x498ed6);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index cbdd192..3c8d6eb 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 _0x17f5=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x39d5b5,_0x534ec9){var _0x19ade3=function(_0x5611ea){while(--_0x5611ea){_0x39d5b5['push'](_0x39d5b5['shift']());}};_0x19ade3(++_0x534ec9);}(_0x17f5,0xaf));var _0x517f=function(_0x20f1ec,_0x1ab353){_0x20f1ec=_0x20f1ec-0x0;var _0x1565f6=_0x17f5[_0x20f1ec];return _0x1565f6;};'use strict';var _=require(_0x517f('0x0'));var util=require(_0x517f('0x1'));var logger=require(_0x517f('0x2'))(_0x517f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x517f('0x4'));var fs=require('fs');var path=require(_0x517f('0x5'));var rimraf=require(_0x517f('0x6'));var config=require(_0x517f('0x7'));var attributes=require(_0x517f('0x8'));var integrations=require(_0x517f('0x9'));module[_0x517f('0xa')]=function(_0x541389,_0x25bca2){return _0x541389[_0x517f('0xb')](_0x517f('0xc'),attributes,{'tableName':_0x517f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58fa=['lodash','../../config/logger','api','moment','bluebird','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x58fa,0x134));var _0xa58f=function(_0x5230bf,_0x3ef407){_0x5230bf=_0x5230bf-0x0;var _0x3d1189=_0x58fa[_0x5230bf];return _0x3d1189;};'use strict';var _=require(_0xa58f('0x0'));var util=require('util');var logger=require(_0xa58f('0x1'))(_0xa58f('0x2'));var moment=require(_0xa58f('0x3'));var BPromise=require(_0xa58f('0x4'));var rp=require(_0xa58f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa58f('0x6'));var integrations=require(_0xa58f('0x7'));module['exports']=function(_0xfaf56,_0x49e2ad){return _0xfaf56[_0xa58f('0x8')](_0xa58f('0x9'),attributes,{'tableName':_0xa58f('0xa'),'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 1cf7a5d..d0289bf 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 _0xa079=['map','model','GetDeskAccount','ShowDeskAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','DeskAccount','findAll','options','where','attributes','limit','include'];(function(_0x49c46e,_0x4c7335){var _0x2cfb73=function(_0xe00313){while(--_0xe00313){_0x49c46e['push'](_0x49c46e['shift']());}};_0x2cfb73(++_0x4c7335);}(_0xa079,0x12e));var _0x9a07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa079[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a07('0x0'));var util=require('util');var moment=require(_0x9a07('0x1'));var BPromise=require(_0x9a07('0x2'));var rs=require(_0x9a07('0x3'));var fs=require('fs');var Redis=require(_0x9a07('0x4'));var db=require(_0x9a07('0x5'))['db'];var utils=require(_0x9a07('0x6'));var logger=require('../../config/logger')(_0x9a07('0x7'));var config=require('../../config/environment');var jayson=require(_0x9a07('0x8'));var client=jayson[_0x9a07('0x9')][_0x9a07('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cc4a8,_0x220f04,_0x348b0d){return new BPromise(function(_0x740098,_0x4ecf29){return client[_0x9a07('0xb')](_0x3cc4a8,_0x348b0d)[_0x9a07('0xc')](function(_0x4aa2aa){logger['info'](_0x9a07('0xd'),_0x220f04,_0x9a07('0xe'));logger[_0x9a07('0xf')](_0x9a07('0x10'),_0x220f04,_0x9a07('0xe'),JSON[_0x9a07('0x11')](_0x4aa2aa));if(_0x4aa2aa['error']){if(_0x4aa2aa[_0x9a07('0x12')][_0x9a07('0x13')]===0x1f4){logger[_0x9a07('0x12')](_0x9a07('0xd'),_0x220f04,_0x4aa2aa['error'][_0x9a07('0x14')]);return _0x4ecf29(_0x4aa2aa[_0x9a07('0x12')]['message']);}logger[_0x9a07('0x12')]('DeskAccount,\x20%s,\x20%s',_0x220f04,_0x4aa2aa[_0x9a07('0x12')][_0x9a07('0x14')]);return _0x740098(_0x4aa2aa[_0x9a07('0x12')]['message']);}else{logger[_0x9a07('0x15')](_0x9a07('0xd'),_0x220f04,_0x9a07('0xe'));_0x740098(_0x4aa2aa[_0x9a07('0x16')][_0x9a07('0x14')]);}})[_0x9a07('0x17')](function(_0x4b26d1){logger[_0x9a07('0x12')](_0x9a07('0xd'),_0x220f04,_0x4b26d1);_0x4ecf29(_0x4b26d1);});});}exports['GetDeskAccount']=function(_0x6fc6ba){var _0x8680e1=this;return new Promise(function(_0x4804bf,_0x1b3b96){return db[_0x9a07('0x18')][_0x9a07('0x19')]({'raw':_0x6fc6ba[_0x9a07('0x1a')]?_0x6fc6ba['options']['raw']===undefined?!![]:![]:!![],'where':_0x6fc6ba[_0x9a07('0x1a')]?_0x6fc6ba['options'][_0x9a07('0x1b')]||null:null,'attributes':_0x6fc6ba[_0x9a07('0x1a')]?_0x6fc6ba[_0x9a07('0x1a')][_0x9a07('0x1c')]||null:null,'limit':_0x6fc6ba[_0x9a07('0x1a')]?_0x6fc6ba[_0x9a07('0x1a')][_0x9a07('0x1d')]||null:null,'include':_0x6fc6ba[_0x9a07('0x1a')]?_0x6fc6ba[_0x9a07('0x1a')][_0x9a07('0x1e')]?_[_0x9a07('0x1f')](_0x6fc6ba['options'][_0x9a07('0x1e')],function(_0x34e805){return{'model':db[_0x34e805[_0x9a07('0x20')]],'as':_0x34e805['as'],'attributes':_0x34e805[_0x9a07('0x1c')],'include':_0x34e805['include']?_[_0x9a07('0x1f')](_0x34e805[_0x9a07('0x1e')],function(_0x535ab7){return{'model':db[_0x535ab7[_0x9a07('0x20')]],'as':_0x535ab7['as'],'attributes':_0x535ab7[_0x9a07('0x1c')],'include':_0x535ab7[_0x9a07('0x1e')]?_[_0x9a07('0x1f')](_0x535ab7[_0x9a07('0x1e')],function(_0x224e4d){return{'model':db[_0x224e4d['model']],'as':_0x224e4d['as'],'attributes':_0x224e4d[_0x9a07('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25b7d0){logger[_0x9a07('0x15')](_0x9a07('0x21'),_0x6fc6ba);logger[_0x9a07('0xf')](_0x9a07('0x21'),_0x6fc6ba,JSON[_0x9a07('0x11')](_0x25b7d0));_0x4804bf(_0x25b7d0);})[_0x9a07('0x17')](function(_0x335e30){logger['error'](_0x9a07('0x21'),_0x335e30[_0x9a07('0x14')],_0x6fc6ba);_0x1b3b96(_0x8680e1[_0x9a07('0x12')](0x1f4,_0x335e30[_0x9a07('0x14')]));});});};exports[_0x9a07('0x22')]=function(_0x49b4f0){var _0x567f17=this;return new Promise(function(_0x103a1d,_0x937049){return db[_0x9a07('0x18')][_0x9a07('0x23')]({'raw':_0x49b4f0[_0x9a07('0x1a')]?_0x49b4f0[_0x9a07('0x1a')][_0x9a07('0x24')]===undefined?!![]:![]:!![],'where':_0x49b4f0[_0x9a07('0x1a')]?_0x49b4f0[_0x9a07('0x1a')][_0x9a07('0x1b')]||null:null,'attributes':_0x49b4f0[_0x9a07('0x1a')]?_0x49b4f0[_0x9a07('0x1a')][_0x9a07('0x1c')]||null:null,'include':_0x49b4f0[_0x9a07('0x1a')]?_0x49b4f0[_0x9a07('0x1a')][_0x9a07('0x1e')]?_[_0x9a07('0x1f')](_0x49b4f0[_0x9a07('0x1a')][_0x9a07('0x1e')],function(_0x2b8de8){return{'model':db[_0x2b8de8['model']],'as':_0x2b8de8['as'],'attributes':_0x2b8de8[_0x9a07('0x1c')],'include':_0x2b8de8[_0x9a07('0x1e')]?_[_0x9a07('0x1f')](_0x2b8de8[_0x9a07('0x1e')],function(_0x10bf5a){return{'model':db[_0x10bf5a[_0x9a07('0x20')]],'as':_0x10bf5a['as'],'attributes':_0x10bf5a['attributes'],'include':_0x10bf5a[_0x9a07('0x1e')]?_[_0x9a07('0x1f')](_0x10bf5a[_0x9a07('0x1e')],function(_0x1a3e0e){return{'model':db[_0x1a3e0e[_0x9a07('0x20')]],'as':_0x1a3e0e['as'],'attributes':_0x1a3e0e[_0x9a07('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a8284){logger[_0x9a07('0x15')](_0x9a07('0x22'),_0x49b4f0);logger[_0x9a07('0xf')](_0x9a07('0x22'),_0x49b4f0,JSON['stringify'](_0x4a8284));_0x103a1d(_0x4a8284);})[_0x9a07('0x17')](function(_0x20a4af){logger[_0x9a07('0x12')](_0x9a07('0x22'),_0x20a4af[_0x9a07('0x14')],_0x49b4f0);_0x937049(_0x567f17[_0x9a07('0x12')](0x1f4,_0x20a4af['message']));});});}; \ No newline at end of file +var _0x35a3=['limit','map','include','model','debug','ShowDeskAccount','find','stringify','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetDeskAccount','DeskAccount','options','where','attributes'];(function(_0x23b6f9,_0x3941a1){var _0x3102c6=function(_0x50b6c2){while(--_0x50b6c2){_0x23b6f9['push'](_0x23b6f9['shift']());}};_0x3102c6(++_0x3941a1);}(_0x35a3,0x1d0));var _0x335a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x35a3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x335a('0x0'));var util=require(_0x335a('0x1'));var moment=require(_0x335a('0x2'));var BPromise=require('bluebird');var rs=require(_0x335a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x335a('0x4'))['db'];var utils=require(_0x335a('0x5'));var logger=require(_0x335a('0x6'))(_0x335a('0x7'));var config=require(_0x335a('0x8'));var jayson=require(_0x335a('0x9'));var client=jayson[_0x335a('0xa')][_0x335a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b93f9,_0x24b015,_0x11794c){return new BPromise(function(_0x5d4e7a,_0x39524e){return client[_0x335a('0xc')](_0x2b93f9,_0x11794c)[_0x335a('0xd')](function(_0x2118e3){logger[_0x335a('0xe')](_0x335a('0xf'),_0x24b015,_0x335a('0x10'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x24b015,_0x335a('0x10'),JSON['stringify'](_0x2118e3));if(_0x2118e3[_0x335a('0x11')]){if(_0x2118e3[_0x335a('0x11')][_0x335a('0x12')]===0x1f4){logger[_0x335a('0x11')](_0x335a('0xf'),_0x24b015,_0x2118e3['error'][_0x335a('0x13')]);return _0x39524e(_0x2118e3['error'][_0x335a('0x13')]);}logger['error'](_0x335a('0xf'),_0x24b015,_0x2118e3[_0x335a('0x11')][_0x335a('0x13')]);return _0x5d4e7a(_0x2118e3['error'][_0x335a('0x13')]);}else{logger[_0x335a('0xe')]('DeskAccount,\x20%s,\x20%s',_0x24b015,'request\x20sent');_0x5d4e7a(_0x2118e3[_0x335a('0x14')][_0x335a('0x13')]);}})['catch'](function(_0x23bc49){logger[_0x335a('0x11')](_0x335a('0xf'),_0x24b015,_0x23bc49);_0x39524e(_0x23bc49);});});}exports[_0x335a('0x15')]=function(_0x570723){var _0x29ce13=this;return new Promise(function(_0x2df0d3,_0x4adf8c){return db[_0x335a('0x16')]['findAll']({'raw':_0x570723[_0x335a('0x17')]?_0x570723['options']['raw']===undefined?!![]:![]:!![],'where':_0x570723[_0x335a('0x17')]?_0x570723[_0x335a('0x17')][_0x335a('0x18')]||null:null,'attributes':_0x570723[_0x335a('0x17')]?_0x570723[_0x335a('0x17')][_0x335a('0x19')]||null:null,'limit':_0x570723[_0x335a('0x17')]?_0x570723[_0x335a('0x17')][_0x335a('0x1a')]||null:null,'include':_0x570723['options']?_0x570723[_0x335a('0x17')]['include']?_[_0x335a('0x1b')](_0x570723[_0x335a('0x17')][_0x335a('0x1c')],function(_0x38fe54){return{'model':db[_0x38fe54[_0x335a('0x1d')]],'as':_0x38fe54['as'],'attributes':_0x38fe54[_0x335a('0x19')],'include':_0x38fe54[_0x335a('0x1c')]?_[_0x335a('0x1b')](_0x38fe54[_0x335a('0x1c')],function(_0x110f03){return{'model':db[_0x110f03['model']],'as':_0x110f03['as'],'attributes':_0x110f03[_0x335a('0x19')],'include':_0x110f03['include']?_[_0x335a('0x1b')](_0x110f03[_0x335a('0x1c')],function(_0x344953){return{'model':db[_0x344953[_0x335a('0x1d')]],'as':_0x344953['as'],'attributes':_0x344953[_0x335a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x335a('0xd')](function(_0x4ad270){logger['info'](_0x335a('0x15'),_0x570723);logger[_0x335a('0x1e')]('GetDeskAccount',_0x570723,JSON['stringify'](_0x4ad270));_0x2df0d3(_0x4ad270);})['catch'](function(_0x17cf48){logger[_0x335a('0x11')](_0x335a('0x15'),_0x17cf48[_0x335a('0x13')],_0x570723);_0x4adf8c(_0x29ce13[_0x335a('0x11')](0x1f4,_0x17cf48[_0x335a('0x13')]));});});};exports[_0x335a('0x1f')]=function(_0x5add17){var _0x581e5d=this;return new Promise(function(_0x42d5ab,_0x949b58){return db[_0x335a('0x16')][_0x335a('0x20')]({'raw':_0x5add17[_0x335a('0x17')]?_0x5add17[_0x335a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5add17[_0x335a('0x17')]?_0x5add17[_0x335a('0x17')][_0x335a('0x18')]||null:null,'attributes':_0x5add17[_0x335a('0x17')]?_0x5add17['options'][_0x335a('0x19')]||null:null,'include':_0x5add17[_0x335a('0x17')]?_0x5add17[_0x335a('0x17')][_0x335a('0x1c')]?_[_0x335a('0x1b')](_0x5add17[_0x335a('0x17')][_0x335a('0x1c')],function(_0x3d3221){return{'model':db[_0x3d3221[_0x335a('0x1d')]],'as':_0x3d3221['as'],'attributes':_0x3d3221[_0x335a('0x19')],'include':_0x3d3221['include']?_[_0x335a('0x1b')](_0x3d3221['include'],function(_0xbe4590){return{'model':db[_0xbe4590[_0x335a('0x1d')]],'as':_0xbe4590['as'],'attributes':_0xbe4590[_0x335a('0x19')],'include':_0xbe4590[_0x335a('0x1c')]?_[_0x335a('0x1b')](_0xbe4590[_0x335a('0x1c')],function(_0x2d7533){return{'model':db[_0x2d7533[_0x335a('0x1d')]],'as':_0x2d7533['as'],'attributes':_0x2d7533[_0x335a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x335a('0xd')](function(_0x340b2c){logger[_0x335a('0xe')](_0x335a('0x1f'),_0x5add17);logger[_0x335a('0x1e')](_0x335a('0x1f'),_0x5add17,JSON[_0x335a('0x21')](_0x340b2c));_0x42d5ab(_0x340b2c);})[_0x335a('0x22')](function(_0x153954){logger[_0x335a('0x11')]('ShowDeskAccount',_0x153954[_0x335a('0x13')],_0x5add17);_0x949b58(_0x581e5d['error'](0x1f4,_0x153954[_0x335a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a0668bf..eb1b569 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 _0x66c7=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','destroy','exports','multer','util'];(function(_0x28bd08,_0x2d71cf){var _0xf60d64=function(_0x2dc4e0){while(--_0x2dc4e0){_0x28bd08['push'](_0x28bd08['shift']());}};_0xf60d64(++_0x2d71cf);}(_0x66c7,0x15c));var _0x766c=function(_0x581a78,_0x4bb5c2){_0x581a78=_0x581a78-0x0;var _0x12d5d2=_0x66c7[_0x581a78];return _0x12d5d2;};'use strict';var multer=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var path=require(_0x766c('0x2'));var timeout=require('connect-timeout');var express=require(_0x766c('0x3'));var router=express[_0x766c('0x4')]();var auth=require(_0x766c('0x5'));var interaction=require(_0x766c('0x6'));var config=require(_0x766c('0x7'));var controller=require(_0x766c('0x8'));router['get']('/',auth[_0x766c('0x9')](),controller[_0x766c('0xa')]);router[_0x766c('0xb')](_0x766c('0xc'),auth[_0x766c('0x9')](),controller[_0x766c('0xd')]);router[_0x766c('0xb')](_0x766c('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x766c('0xb')](_0x766c('0xf'),auth[_0x766c('0x9')](),controller['getSubjects']);router[_0x766c('0xb')]('/:id/descriptions',auth[_0x766c('0x9')](),controller[_0x766c('0x10')]);router[_0x766c('0xb')](_0x766c('0x11'),auth[_0x766c('0x9')](),controller[_0x766c('0x12')]);router[_0x766c('0x13')]('/',auth[_0x766c('0x9')](),controller[_0x766c('0x14')]);router[_0x766c('0x13')](_0x766c('0x11'),auth[_0x766c('0x9')](),controller[_0x766c('0x15')]);router[_0x766c('0x16')](_0x766c('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x766c('0xc'),auth[_0x766c('0x9')](),controller[_0x766c('0x17')]);module[_0x766c('0x18')]=router; \ No newline at end of file +var _0xceef=['getTags','post','create','update','delete','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags'];(function(_0x35911e,_0x424988){var _0x254042=function(_0x4b19fd){while(--_0x4b19fd){_0x35911e['push'](_0x35911e['shift']());}};_0x254042(++_0x424988);}(_0xceef,0xf6));var _0xfcee=function(_0x304e0e,_0x2654a3){_0x304e0e=_0x304e0e-0x0;var _0x4449c8=_0xceef[_0x304e0e];return _0x4449c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfcee('0x0'));var timeout=require(_0xfcee('0x1'));var express=require('express');var router=express[_0xfcee('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfcee('0x3'));var config=require(_0xfcee('0x4'));var controller=require('./intDeskConfiguration.controller');router[_0xfcee('0x5')]('/',auth[_0xfcee('0x6')](),controller['index']);router['get'](_0xfcee('0x7'),auth[_0xfcee('0x6')](),controller[_0xfcee('0x8')]);router['get']('/:id/fields',auth[_0xfcee('0x6')](),controller[_0xfcee('0x9')]);router[_0xfcee('0x5')](_0xfcee('0xa'),auth[_0xfcee('0x6')](),controller[_0xfcee('0xb')]);router[_0xfcee('0x5')]('/:id/descriptions',auth[_0xfcee('0x6')](),controller[_0xfcee('0xc')]);router[_0xfcee('0x5')](_0xfcee('0xd'),auth[_0xfcee('0x6')](),controller[_0xfcee('0xe')]);router[_0xfcee('0xf')]('/',auth[_0xfcee('0x6')](),controller[_0xfcee('0x10')]);router['post'](_0xfcee('0xd'),auth[_0xfcee('0x6')](),controller['setTags']);router['put'](_0xfcee('0x7'),auth[_0xfcee('0x6')](),controller[_0xfcee('0x11')]);router[_0xfcee('0x12')](_0xfcee('0x7'),auth[_0xfcee('0x6')](),controller['destroy']);module[_0xfcee('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 2b1559a..ffbe84a 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 _0x983e=['sequelize','STRING'];(function(_0x401479,_0x5665f7){var _0x3f6457=function(_0x1c0b46){while(--_0x1c0b46){_0x401479['push'](_0x401479['shift']());}};_0x3f6457(++_0x5665f7);}(_0x983e,0x12e));var _0xe983=function(_0x3e7ecb,_0xad6ea1){_0x3e7ecb=_0x3e7ecb-0x0;var _0x34b2ed=_0x983e[_0x3e7ecb];return _0x34b2ed;};'use strict';var Sequelize=require(_0xe983('0x0'));module['exports']={'name':{'type':Sequelize[_0xe983('0x1')]},'description':{'type':Sequelize[_0xe983('0x1')]}}; \ No newline at end of file +var _0xa27c=['exports','STRING','sequelize'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0xa27c,0x7a));var _0xca27=function(_0x2ace47,_0x131d93){_0x2ace47=_0x2ace47-0x0;var _0x101a32=_0xa27c[_0x2ace47];return _0x101a32;};'use strict';var Sequelize=require(_0xca27('0x0'));module[_0xca27('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xca27('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ed183e1..2425bbd 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 _0x4ab0=['VIRTUAL','includeAll','include','findAll','show','options','create','body','params','find','getFields','DeskField','getSubjects','getDescriptions','getTags','findOne','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','catch','sendStatus','status','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','merge'];(function(_0xee9b22,_0x515b58){var _0x4b638e=function(_0x2d19bd){while(--_0x2d19bd){_0xee9b22['push'](_0xee9b22['shift']());}};_0x4b638e(++_0x515b58);}(_0x4ab0,0xd5));var _0x04ab=function(_0x3854e3,_0x4f0659){_0x3854e3=_0x3854e3-0x0;var _0x43ef42=_0x4ab0[_0x3854e3];return _0x43ef42;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x04ab('0x0'));var rimraf=require(_0x04ab('0x1'));var zipdir=require(_0x04ab('0x2'));var jsonpatch=require(_0x04ab('0x3'));var rp=require(_0x04ab('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x04ab('0x5'));var util=require(_0x04ab('0x6'));var path=require('path');var sox=require(_0x04ab('0x7'));var csv=require(_0x04ab('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x04ab('0x9'));var squel=require(_0x04ab('0xa'));var crypto=require(_0x04ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04ab('0xc'));var toCsv=require(_0x04ab('0x8'));var querystring=require(_0x04ab('0xd'));var Papa=require(_0x04ab('0xe'));var Redis=require('ioredis');var authService=require(_0x04ab('0xf'));var qs=require(_0x04ab('0x10'));var as=require(_0x04ab('0x11'));var hardwareService=require(_0x04ab('0x12'));var logger=require('../../config/logger')(_0x04ab('0x13'));var utils=require(_0x04ab('0x14'));var config=require(_0x04ab('0x15'));var db=require(_0x04ab('0x16'))['db'];var jayson=require(_0x04ab('0x17'));var client=jayson[_0x04ab('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x710503,_0x491b3f,_0xbb763d){if(_0xbb763d){var _0xef8710=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xef8710[_0x04ab('0x19')](_0x491b3f)){return _0x710503;}else{throw new db[(_0x04ab('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 _0x710503;}}function respondWithRpcPromise(_0x58aef3,_0x103ca8,_0x3cee44,_0x149fd2){return new BPromise(function(_0x2b10b0,_0x16d633){var _0x3e9a05=_0x149fd2||client;return _0x3e9a05[_0x04ab('0x1b')](_0x58aef3,_0x3cee44)[_0x04ab('0x1c')](function(_0x1f3251){logger[_0x04ab('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x103ca8,_0x04ab('0x1e'));logger[_0x04ab('0x1f')](_0x04ab('0x20'),_0x103ca8,_0x04ab('0x1e'),JSON[_0x04ab('0x21')](_0x1f3251));if(_0x1f3251[_0x04ab('0x22')]){if(_0x1f3251[_0x04ab('0x22')][_0x04ab('0x23')]===0x1f4){logger[_0x04ab('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x103ca8,_0x1f3251[_0x04ab('0x22')]['message']);return _0x16d633(_0x1f3251[_0x04ab('0x22')][_0x04ab('0x24')]);}logger[_0x04ab('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x103ca8,_0x1f3251[_0x04ab('0x22')][_0x04ab('0x24')]);return _0x2b10b0(_0x1f3251[_0x04ab('0x22')]['message']);}else{logger['info'](_0x04ab('0x25'),_0x103ca8,_0x04ab('0x1e'));_0x2b10b0(_0x1f3251['result']['message']);}})[_0x04ab('0x26')](function(_0x4692c4){logger[_0x04ab('0x22')](_0x04ab('0x25'),_0x103ca8,_0x4692c4);_0x16d633(_0x4692c4);});});}function respondWithStatusCode(_0x26bb81,_0xa3838a){_0xa3838a=_0xa3838a||0xcc;return function(_0x21d9b7){if(_0x21d9b7){return _0x26bb81[_0x04ab('0x27')](_0xa3838a);}return _0x26bb81[_0x04ab('0x28')](_0xa3838a)['end']();};}function respondWithResult(_0x86bf80,_0x3343d0){_0x3343d0=_0x3343d0||0xc8;return function(_0x115fa6){if(_0x115fa6){return _0x86bf80[_0x04ab('0x28')](_0x3343d0)['json'](_0x115fa6);}};}function respondWithFilteredResult(_0x530a1c,_0x2a498b){return function(_0x5397cd){if(_0x5397cd){var _0x404eae=_0x5397cd[_0x04ab('0x29')],_0x30db64=_0x2a498b['offset'],_0x2e069d=_0x2a498b['offset']+_0x2a498b[_0x04ab('0x2a')],_0x3c25fb;if(_0x2e069d>=_0x404eae){_0x2e069d=_0x404eae;_0x3c25fb=0xc8;}else{_0x3c25fb=0xce;}_0x530a1c[_0x04ab('0x28')](_0x3c25fb);return _0x530a1c[_0x04ab('0x2b')](_0x04ab('0x2c'),_0x30db64+'-'+_0x2e069d+'/'+_0x404eae)[_0x04ab('0x2d')](_0x5397cd);}return null;};}function patchUpdates(_0x459e8c){return function(_0x1c3dca){try{jsonpatch[_0x04ab('0x2e')](_0x1c3dca,_0x459e8c,!![]);}catch(_0x1b8a9a){return BPromise[_0x04ab('0x2f')](_0x1b8a9a);}return _0x1c3dca[_0x04ab('0x30')]();};}function saveUpdates(_0x28bfca,_0x2f978d){return function(_0x48b7a3){if(_0x48b7a3){return _0x48b7a3[_0x04ab('0x31')](_0x28bfca)[_0x04ab('0x1c')](function(_0x5798ca){return _0x5798ca;});}return null;};}function removeEntity(_0x2dafe8,_0x148c76){return function(_0x5dbdfd){if(_0x5dbdfd){return _0x5dbdfd[_0x04ab('0x32')]()[_0x04ab('0x1c')](function(){_0x2dafe8['status'](0xcc)[_0x04ab('0x33')]();});}};}function handleEntityNotFound(_0x3e1750,_0x42202f){return function(_0x3b61d0){if(!_0x3b61d0){_0x3e1750[_0x04ab('0x27')](0x194);}return _0x3b61d0;};}function handleError(_0x15963a,_0x538cf7){_0x538cf7=_0x538cf7||0x1f4;return function(_0x2dab83){logger[_0x04ab('0x22')](_0x2dab83[_0x04ab('0x34')]);if(_0x2dab83['name']){delete _0x2dab83[_0x04ab('0x35')];}_0x15963a['status'](_0x538cf7)['send'](_0x2dab83);};}exports[_0x04ab('0x36')]=function(_0x3b7b51,_0x5569ba){var _0x40995c={},_0x487093={},_0x3c66a8={'count':0x0,'rows':[]};var _0x22a60d=_[_0x04ab('0x37')](db[_0x04ab('0x38')][_0x04ab('0x39')],function(_0x4018fa){return{'name':_0x4018fa[_0x04ab('0x3a')],'type':_0x4018fa[_0x04ab('0x3b')][_0x04ab('0x3c')]};});_0x487093[_0x04ab('0x3d')]=_[_0x04ab('0x37')](_0x22a60d,_0x04ab('0x35'));_0x487093['query']=_[_0x04ab('0x3e')](_0x3b7b51[_0x04ab('0x3f')]);_0x487093['filters']=_['intersection'](_0x487093[_0x04ab('0x3d')],_0x487093[_0x04ab('0x3f')]);_0x40995c[_0x04ab('0x40')]=_[_0x04ab('0x41')](_0x487093['model'],qs[_0x04ab('0x42')](_0x3b7b51[_0x04ab('0x3f')][_0x04ab('0x42')]));_0x40995c[_0x04ab('0x40')]=_0x40995c['attributes'][_0x04ab('0x43')]?_0x40995c[_0x04ab('0x40')]:_0x487093[_0x04ab('0x3d')];if(!_0x3b7b51[_0x04ab('0x3f')][_0x04ab('0x44')](_0x04ab('0x45'))){_0x40995c[_0x04ab('0x2a')]=qs[_0x04ab('0x2a')](_0x3b7b51['query']['limit']);_0x40995c[_0x04ab('0x46')]=qs[_0x04ab('0x46')](_0x3b7b51[_0x04ab('0x3f')][_0x04ab('0x46')]);}_0x40995c[_0x04ab('0x47')]=qs['sort'](_0x3b7b51[_0x04ab('0x3f')][_0x04ab('0x48')]);_0x40995c[_0x04ab('0x49')]=qs['filters'](_[_0x04ab('0x4a')](_0x3b7b51[_0x04ab('0x3f')],_0x487093[_0x04ab('0x4b')]),_0x22a60d);if(_0x3b7b51[_0x04ab('0x3f')][_0x04ab('0x4c')]){_0x40995c[_0x04ab('0x49')]=_[_0x04ab('0x4d')](_0x40995c[_0x04ab('0x49')],{'$or':_[_0x04ab('0x37')](_0x22a60d,function(_0x183464){if(_0x183464['type']!==_0x04ab('0x4e')){var _0xaac4e3={};_0xaac4e3[_0x183464[_0x04ab('0x35')]]={'$like':'%'+_0x3b7b51[_0x04ab('0x3f')][_0x04ab('0x4c')]+'%'};return _0xaac4e3;}})});}_0x40995c=_[_0x04ab('0x4d')]({},_0x40995c,_0x3b7b51['options']);var _0x272689={'where':_0x40995c[_0x04ab('0x49')]};return db[_0x04ab('0x38')][_0x04ab('0x29')](_0x272689)['then'](function(_0x19c4ee){_0x3c66a8[_0x04ab('0x29')]=_0x19c4ee;if(_0x3b7b51[_0x04ab('0x3f')][_0x04ab('0x4f')]){_0x40995c[_0x04ab('0x50')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x04ab('0x51')](_0x40995c);})[_0x04ab('0x1c')](function(_0x551f94){_0x3c66a8['rows']=_0x551f94;return _0x3c66a8;})[_0x04ab('0x1c')](respondWithFilteredResult(_0x5569ba,_0x40995c))[_0x04ab('0x26')](handleError(_0x5569ba,null));};exports[_0x04ab('0x52')]=function(_0x109355,_0x1c4aa2){var _0x3a9056={'raw':![],'where':{'id':_0x109355['params']['id']}},_0xae46c7={};_0xae46c7[_0x04ab('0x3d')]=_[_0x04ab('0x3e')](db[_0x04ab('0x38')]['rawAttributes']);_0xae46c7[_0x04ab('0x3f')]=_[_0x04ab('0x3e')](_0x109355['query']);_0xae46c7[_0x04ab('0x4b')]=_['intersection'](_0xae46c7[_0x04ab('0x3d')],_0xae46c7['query']);_0x3a9056[_0x04ab('0x40')]=_['intersection'](_0xae46c7['model'],qs[_0x04ab('0x42')](_0x109355[_0x04ab('0x3f')][_0x04ab('0x42')]));_0x3a9056['attributes']=_0x3a9056['attributes'][_0x04ab('0x43')]?_0x3a9056[_0x04ab('0x40')]:_0xae46c7[_0x04ab('0x3d')];if(_0x109355['query'][_0x04ab('0x4f')]){_0x3a9056['include']=[{'all':!![]}];}_0x3a9056=_[_0x04ab('0x4d')]({},_0x3a9056,_0x109355[_0x04ab('0x53')]);return db[_0x04ab('0x38')]['find'](_0x3a9056)[_0x04ab('0x1c')](handleEntityNotFound(_0x1c4aa2,null))[_0x04ab('0x1c')](respondWithResult(_0x1c4aa2,null))[_0x04ab('0x26')](handleError(_0x1c4aa2,null));};exports[_0x04ab('0x54')]=function(_0x3297fe,_0x122611){return db[_0x04ab('0x38')][_0x04ab('0x54')](_0x3297fe[_0x04ab('0x55')],{})[_0x04ab('0x1c')](respondWithResult(_0x122611,0xc9))[_0x04ab('0x26')](handleError(_0x122611,null));};exports['update']=function(_0x3ecf57,_0x5e9bb9){if(_0x3ecf57[_0x04ab('0x55')]['id']){delete _0x3ecf57[_0x04ab('0x55')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x3ecf57[_0x04ab('0x56')]['id']}})[_0x04ab('0x1c')](handleEntityNotFound(_0x5e9bb9,null))[_0x04ab('0x1c')](saveUpdates(_0x3ecf57[_0x04ab('0x55')],null))[_0x04ab('0x1c')](respondWithResult(_0x5e9bb9,null))[_0x04ab('0x26')](handleError(_0x5e9bb9,null));};exports[_0x04ab('0x32')]=function(_0x466119,_0x405780){return db['DeskConfiguration'][_0x04ab('0x57')]({'where':{'id':_0x466119[_0x04ab('0x56')]['id']}})[_0x04ab('0x1c')](handleEntityNotFound(_0x405780,null))['then'](removeEntity(_0x405780,null))[_0x04ab('0x26')](handleError(_0x405780,null));};exports[_0x04ab('0x58')]=function(_0x2b0ba1,_0x4c9f03,_0x2d60c8){var _0x22d3be={};var _0x14810f={};var _0x1837d2;var _0x59ddca;return db[_0x04ab('0x38')]['findOne']({'where':{'id':_0x2b0ba1[_0x04ab('0x56')]['id']}})[_0x04ab('0x1c')](handleEntityNotFound(_0x4c9f03,null))['then'](function(_0x3245b2){if(_0x3245b2){_0x1837d2=_0x3245b2;_0x14810f['model']=_[_0x04ab('0x3e')](db[_0x04ab('0x59')][_0x04ab('0x39')]);_0x14810f[_0x04ab('0x3f')]=_['keys'](_0x2b0ba1[_0x04ab('0x3f')]);_0x14810f[_0x04ab('0x4b')]=_[_0x04ab('0x41')](_0x14810f[_0x04ab('0x3d')],_0x14810f[_0x04ab('0x3f')]);_0x22d3be[_0x04ab('0x40')]=_[_0x04ab('0x41')](_0x14810f[_0x04ab('0x3d')],qs[_0x04ab('0x42')](_0x2b0ba1[_0x04ab('0x3f')][_0x04ab('0x42')]));_0x22d3be[_0x04ab('0x40')]=_0x22d3be[_0x04ab('0x40')][_0x04ab('0x43')]?_0x22d3be[_0x04ab('0x40')]:_0x14810f[_0x04ab('0x3d')];_0x22d3be[_0x04ab('0x47')]=qs[_0x04ab('0x48')](_0x2b0ba1[_0x04ab('0x3f')][_0x04ab('0x48')]);_0x22d3be[_0x04ab('0x49')]=qs[_0x04ab('0x4b')](_['pick'](_0x2b0ba1[_0x04ab('0x3f')],_0x14810f['filters']));if(_0x2b0ba1[_0x04ab('0x3f')][_0x04ab('0x4c')]){_0x22d3be[_0x04ab('0x49')]=_['merge'](_0x22d3be[_0x04ab('0x49')],{'$or':_[_0x04ab('0x37')](_0x22d3be[_0x04ab('0x40')],function(_0x4a24a4){var _0x2f5be4={};_0x2f5be4[_0x4a24a4]={'$like':'%'+_0x2b0ba1[_0x04ab('0x3f')][_0x04ab('0x4c')]+'%'};return _0x2f5be4;})});}_0x22d3be=_['merge']({},_0x22d3be,_0x2b0ba1[_0x04ab('0x53')]);return _0x1837d2[_0x04ab('0x58')](_0x22d3be);}})['then'](function(_0xd1cc67){if(_0xd1cc67){_0x59ddca=_0xd1cc67['length'];if(!_0x2b0ba1['query'][_0x04ab('0x44')](_0x04ab('0x45'))){_0x22d3be[_0x04ab('0x2a')]=qs[_0x04ab('0x2a')](_0x2b0ba1[_0x04ab('0x3f')][_0x04ab('0x2a')]);_0x22d3be[_0x04ab('0x46')]=qs['offset'](_0x2b0ba1['query'][_0x04ab('0x46')]);}return _0x1837d2[_0x04ab('0x58')](_0x22d3be);}})[_0x04ab('0x1c')](function(_0x484a13){if(_0x484a13){return _0x484a13?{'count':_0x59ddca,'rows':_0x484a13}:null;}})[_0x04ab('0x1c')](respondWithResult(_0x4c9f03,null))[_0x04ab('0x26')](handleError(_0x4c9f03,null));};exports[_0x04ab('0x5a')]=function(_0x262303,_0x4bd06c,_0x2f097c){var _0x4d8eb9={};var _0x1205b0={};var _0x2c9a50;var _0x1d31c1;return db[_0x04ab('0x38')]['findOne']({'where':{'id':_0x262303[_0x04ab('0x56')]['id']}})[_0x04ab('0x1c')](handleEntityNotFound(_0x4bd06c,null))[_0x04ab('0x1c')](function(_0x1e62b2){if(_0x1e62b2){_0x2c9a50=_0x1e62b2;_0x1205b0['model']=_[_0x04ab('0x3e')](db['DeskField'][_0x04ab('0x39')]);_0x1205b0[_0x04ab('0x3f')]=_['keys'](_0x262303[_0x04ab('0x3f')]);_0x1205b0['filters']=_[_0x04ab('0x41')](_0x1205b0[_0x04ab('0x3d')],_0x1205b0['query']);_0x4d8eb9[_0x04ab('0x40')]=_[_0x04ab('0x41')](_0x1205b0[_0x04ab('0x3d')],qs[_0x04ab('0x42')](_0x262303['query'][_0x04ab('0x42')]));_0x4d8eb9['attributes']=_0x4d8eb9[_0x04ab('0x40')][_0x04ab('0x43')]?_0x4d8eb9['attributes']:_0x1205b0['model'];_0x4d8eb9[_0x04ab('0x47')]=qs[_0x04ab('0x48')](_0x262303['query'][_0x04ab('0x48')]);_0x4d8eb9[_0x04ab('0x49')]=qs[_0x04ab('0x4b')](_['pick'](_0x262303[_0x04ab('0x3f')],_0x1205b0[_0x04ab('0x4b')]));if(_0x262303[_0x04ab('0x3f')]['filter']){_0x4d8eb9[_0x04ab('0x49')]=_[_0x04ab('0x4d')](_0x4d8eb9[_0x04ab('0x49')],{'$or':_[_0x04ab('0x37')](_0x4d8eb9[_0x04ab('0x40')],function(_0x3fae43){var _0x2acd05={};_0x2acd05[_0x3fae43]={'$like':'%'+_0x262303['query'][_0x04ab('0x4c')]+'%'};return _0x2acd05;})});}_0x4d8eb9=_[_0x04ab('0x4d')]({},_0x4d8eb9,_0x262303['options']);return _0x2c9a50[_0x04ab('0x5a')](_0x4d8eb9);}})[_0x04ab('0x1c')](function(_0x595e73){if(_0x595e73){_0x1d31c1=_0x595e73[_0x04ab('0x43')];if(!_0x262303[_0x04ab('0x3f')][_0x04ab('0x44')]('nolimit')){_0x4d8eb9['limit']=qs[_0x04ab('0x2a')](_0x262303['query'][_0x04ab('0x2a')]);_0x4d8eb9[_0x04ab('0x46')]=qs[_0x04ab('0x46')](_0x262303['query'][_0x04ab('0x46')]);}return _0x2c9a50['getSubjects'](_0x4d8eb9);}})[_0x04ab('0x1c')](function(_0x31879a){if(_0x31879a){return _0x31879a?{'count':_0x1d31c1,'rows':_0x31879a}:null;}})['then'](respondWithResult(_0x4bd06c,null))[_0x04ab('0x26')](handleError(_0x4bd06c,null));};exports['getDescriptions']=function(_0x3d97d3,_0x1e1ace,_0x11cb01){var _0x584916={};var _0x1d7e8b={};var _0x1459bd;var _0x23e03b;return db[_0x04ab('0x38')]['findOne']({'where':{'id':_0x3d97d3[_0x04ab('0x56')]['id']}})[_0x04ab('0x1c')](handleEntityNotFound(_0x1e1ace,null))[_0x04ab('0x1c')](function(_0x1e900c){if(_0x1e900c){_0x1459bd=_0x1e900c;_0x1d7e8b[_0x04ab('0x3d')]=_['keys'](db['DeskField']['rawAttributes']);_0x1d7e8b[_0x04ab('0x3f')]=_[_0x04ab('0x3e')](_0x3d97d3[_0x04ab('0x3f')]);_0x1d7e8b['filters']=_[_0x04ab('0x41')](_0x1d7e8b[_0x04ab('0x3d')],_0x1d7e8b[_0x04ab('0x3f')]);_0x584916['attributes']=_[_0x04ab('0x41')](_0x1d7e8b['model'],qs['fields'](_0x3d97d3[_0x04ab('0x3f')][_0x04ab('0x42')]));_0x584916[_0x04ab('0x40')]=_0x584916[_0x04ab('0x40')]['length']?_0x584916[_0x04ab('0x40')]:_0x1d7e8b[_0x04ab('0x3d')];_0x584916[_0x04ab('0x47')]=qs[_0x04ab('0x48')](_0x3d97d3[_0x04ab('0x3f')][_0x04ab('0x48')]);_0x584916[_0x04ab('0x49')]=qs[_0x04ab('0x4b')](_[_0x04ab('0x4a')](_0x3d97d3[_0x04ab('0x3f')],_0x1d7e8b[_0x04ab('0x4b')]));if(_0x3d97d3[_0x04ab('0x3f')][_0x04ab('0x4c')]){_0x584916[_0x04ab('0x49')]=_[_0x04ab('0x4d')](_0x584916[_0x04ab('0x49')],{'$or':_[_0x04ab('0x37')](_0x584916[_0x04ab('0x40')],function(_0x5b82a9){var _0xfc85c0={};_0xfc85c0[_0x5b82a9]={'$like':'%'+_0x3d97d3[_0x04ab('0x3f')][_0x04ab('0x4c')]+'%'};return _0xfc85c0;})});}_0x584916=_[_0x04ab('0x4d')]({},_0x584916,_0x3d97d3[_0x04ab('0x53')]);return _0x1459bd['getDescriptions'](_0x584916);}})[_0x04ab('0x1c')](function(_0x585a94){if(_0x585a94){_0x23e03b=_0x585a94[_0x04ab('0x43')];if(!_0x3d97d3[_0x04ab('0x3f')][_0x04ab('0x44')]('nolimit')){_0x584916[_0x04ab('0x2a')]=qs['limit'](_0x3d97d3['query'][_0x04ab('0x2a')]);_0x584916[_0x04ab('0x46')]=qs['offset'](_0x3d97d3[_0x04ab('0x3f')]['offset']);}return _0x1459bd[_0x04ab('0x5b')](_0x584916);}})[_0x04ab('0x1c')](function(_0x1629cc){if(_0x1629cc){return _0x1629cc?{'count':_0x23e03b,'rows':_0x1629cc}:null;}})['then'](respondWithResult(_0x1e1ace,null))['catch'](handleError(_0x1e1ace,null));};exports[_0x04ab('0x5c')]=function(_0x5f148a,_0x591a87,_0x6f3d21){var _0x4bac52={};var _0xb355b={};var _0x4426f7;var _0x1f3957;return db[_0x04ab('0x38')][_0x04ab('0x5d')]({'where':{'id':_0x5f148a[_0x04ab('0x56')]['id']}})[_0x04ab('0x1c')](handleEntityNotFound(_0x591a87,null))[_0x04ab('0x1c')](function(_0x3aab7b){if(_0x3aab7b){_0x4426f7=_0x3aab7b;_0xb355b[_0x04ab('0x3d')]=_[_0x04ab('0x3e')](db[_0x04ab('0x5e')][_0x04ab('0x39')]);_0xb355b[_0x04ab('0x3f')]=_[_0x04ab('0x3e')](_0x5f148a[_0x04ab('0x3f')]);_0xb355b[_0x04ab('0x4b')]=_['intersection'](_0xb355b[_0x04ab('0x3d')],_0xb355b[_0x04ab('0x3f')]);_0x4bac52[_0x04ab('0x40')]=_[_0x04ab('0x41')](_0xb355b[_0x04ab('0x3d')],qs[_0x04ab('0x42')](_0x5f148a['query'][_0x04ab('0x42')]));_0x4bac52[_0x04ab('0x40')]=_0x4bac52[_0x04ab('0x40')][_0x04ab('0x43')]?_0x4bac52['attributes']:_0xb355b[_0x04ab('0x3d')];_0x4bac52['order']=qs[_0x04ab('0x48')](_0x5f148a[_0x04ab('0x3f')][_0x04ab('0x48')]);_0x4bac52['where']=qs[_0x04ab('0x4b')](_[_0x04ab('0x4a')](_0x5f148a[_0x04ab('0x3f')],_0xb355b[_0x04ab('0x4b')]));if(_0x5f148a[_0x04ab('0x3f')][_0x04ab('0x4c')]){_0x4bac52[_0x04ab('0x49')]=_[_0x04ab('0x4d')](_0x4bac52[_0x04ab('0x49')],{'$or':_[_0x04ab('0x37')](_0x4bac52['attributes'],function(_0x54a61e){var _0x14fcde={};_0x14fcde[_0x54a61e]={'$like':'%'+_0x5f148a[_0x04ab('0x3f')][_0x04ab('0x4c')]+'%'};return _0x14fcde;})});}_0x4bac52=_[_0x04ab('0x4d')]({},_0x4bac52,_0x5f148a[_0x04ab('0x53')]);return _0x4426f7[_0x04ab('0x5c')](_0x4bac52);}})[_0x04ab('0x1c')](function(_0x47f073){if(_0x47f073){_0x1f3957=_0x47f073['length'];if(!_0x5f148a[_0x04ab('0x3f')][_0x04ab('0x44')]('nolimit')){_0x4bac52['limit']=qs[_0x04ab('0x2a')](_0x5f148a[_0x04ab('0x3f')][_0x04ab('0x2a')]);_0x4bac52[_0x04ab('0x46')]=qs[_0x04ab('0x46')](_0x5f148a[_0x04ab('0x3f')][_0x04ab('0x46')]);}return _0x4426f7['getTags'](_0x4bac52);}})[_0x04ab('0x1c')](function(_0x571ce0){if(_0x571ce0){return _0x571ce0?{'count':_0x1f3957,'rows':_0x571ce0}:null;}})[_0x04ab('0x1c')](respondWithResult(_0x591a87,null))[_0x04ab('0x26')](handleError(_0x591a87,null));};exports[_0x04ab('0x5f')]=function(_0x52f7b2,_0x3cb5fa,_0x5b8d79){if(_0x52f7b2[_0x04ab('0x55')]['id']){delete _0x52f7b2[_0x04ab('0x55')]['id'];}return db[_0x04ab('0x38')]['findOne']({'where':{'id':_0x52f7b2[_0x04ab('0x56')]['id']}})['then'](handleEntityNotFound(_0x3cb5fa,null))[_0x04ab('0x1c')](function(_0x2b2220){if(_0x2b2220){return _0x2b2220[_0x04ab('0x5f')](_0x52f7b2[_0x04ab('0x55')][_0x04ab('0x60')]||[]);}return null;})['then'](respondWithResult(_0x3cb5fa,null))[_0x04ab('0x26')](handleError(_0x3cb5fa,null));}; \ No newline at end of file +var _0xbe45=['destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','DeskConfiguration','count','includeAll','include','findAll','rows','params','find','create','body','getFields','findOne','DeskField','pick','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../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','request\x20sent','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','Content-Range','reject','save','update'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xbe45,0xf0));var _0x5be4=function(_0x268bc6,_0x39cc42){_0x268bc6=_0x268bc6-0x0;var _0x5e923e=_0xbe45[_0x268bc6];return _0x5e923e;};'use strict';var pdf=require(_0x5be4('0x0'));var emlformat=require(_0x5be4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5be4('0x2'));var jsonpatch=require(_0x5be4('0x3'));var rp=require(_0x5be4('0x4'));var moment=require(_0x5be4('0x5'));var BPromise=require(_0x5be4('0x6'));var Mustache=require(_0x5be4('0x7'));var util=require('util');var path=require(_0x5be4('0x8'));var sox=require(_0x5be4('0x9'));var csv=require(_0x5be4('0xa'));var ejs=require(_0x5be4('0xb'));var fs=require('fs');var _=require(_0x5be4('0xc'));var squel=require(_0x5be4('0xd'));var crypto=require(_0x5be4('0xe'));var jsforce=require(_0x5be4('0xf'));var deskjs=require(_0x5be4('0x10'));var toCsv=require(_0x5be4('0xa'));var querystring=require(_0x5be4('0x11'));var Papa=require(_0x5be4('0x12'));var Redis=require(_0x5be4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5be4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5be4('0x15'))('api');var utils=require(_0x5be4('0x16'));var config=require(_0x5be4('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5be4('0x18'));var client=jayson[_0x5be4('0x19')][_0x5be4('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5c6615,_0x349610,_0x4a84c5){if(_0x4a84c5){var _0x246d2e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x246d2e[_0x5be4('0x1b')](_0x349610)){return _0x5c6615;}else{throw new db[(_0x5be4('0x1c'))][(_0x5be4('0x1d'))](_0x5be4('0x1e'));}}else{return _0x5c6615;}}function respondWithRpcPromise(_0x3b3dd1,_0x3980fc,_0x5ebe65,_0x3e830e){return new BPromise(function(_0x8466a7,_0x1d7db7){var _0x11e581=_0x3e830e||client;return _0x11e581[_0x5be4('0x1f')](_0x3b3dd1,_0x5ebe65)[_0x5be4('0x20')](function(_0x94f434){logger[_0x5be4('0x21')]('DeskConfiguration,\x20%s,\x20%s',_0x3980fc,_0x5be4('0x22'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3980fc,_0x5be4('0x22'),JSON[_0x5be4('0x23')](_0x94f434));if(_0x94f434['error']){if(_0x94f434[_0x5be4('0x24')][_0x5be4('0x25')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3980fc,_0x94f434[_0x5be4('0x24')][_0x5be4('0x26')]);return _0x1d7db7(_0x94f434['error']['message']);}logger[_0x5be4('0x24')](_0x5be4('0x27'),_0x3980fc,_0x94f434[_0x5be4('0x24')][_0x5be4('0x26')]);return _0x8466a7(_0x94f434[_0x5be4('0x24')]['message']);}else{logger[_0x5be4('0x21')]('DeskConfiguration,\x20%s,\x20%s',_0x3980fc,_0x5be4('0x22'));_0x8466a7(_0x94f434[_0x5be4('0x28')]['message']);}})[_0x5be4('0x29')](function(_0x2ed4b6){logger['error'](_0x5be4('0x27'),_0x3980fc,_0x2ed4b6);_0x1d7db7(_0x2ed4b6);});});}function respondWithStatusCode(_0x2b2e2c,_0x353a65){_0x353a65=_0x353a65||0xcc;return function(_0x39cf54){if(_0x39cf54){return _0x2b2e2c[_0x5be4('0x2a')](_0x353a65);}return _0x2b2e2c[_0x5be4('0x2b')](_0x353a65)[_0x5be4('0x2c')]();};}function respondWithResult(_0x5b49ea,_0x50e5be){_0x50e5be=_0x50e5be||0xc8;return function(_0x51584f){if(_0x51584f){return _0x5b49ea[_0x5be4('0x2b')](_0x50e5be)[_0x5be4('0x2d')](_0x51584f);}};}function respondWithFilteredResult(_0x5c489e,_0xd88995){return function(_0x15dec0){if(_0x15dec0){var _0x3bd842=_0x15dec0['count'],_0x412ef6=_0xd88995[_0x5be4('0x2e')],_0x16f3bf=_0xd88995[_0x5be4('0x2e')]+_0xd88995['limit'],_0x1e0485;if(_0x16f3bf>=_0x3bd842){_0x16f3bf=_0x3bd842;_0x1e0485=0xc8;}else{_0x1e0485=0xce;}_0x5c489e[_0x5be4('0x2b')](_0x1e0485);return _0x5c489e['set'](_0x5be4('0x2f'),_0x412ef6+'-'+_0x16f3bf+'/'+_0x3bd842)[_0x5be4('0x2d')](_0x15dec0);}return null;};}function patchUpdates(_0x47ecca){return function(_0x33aacb){try{jsonpatch['apply'](_0x33aacb,_0x47ecca,!![]);}catch(_0x50d906){return BPromise[_0x5be4('0x30')](_0x50d906);}return _0x33aacb[_0x5be4('0x31')]();};}function saveUpdates(_0x6e2def,_0x307a3f){return function(_0x3bf96d){if(_0x3bf96d){return _0x3bf96d[_0x5be4('0x32')](_0x6e2def)[_0x5be4('0x20')](function(_0x3fd82f){return _0x3fd82f;});}return null;};}function removeEntity(_0x1fc0bd,_0x3cb75f){return function(_0x24ebf3){if(_0x24ebf3){return _0x24ebf3[_0x5be4('0x33')]()['then'](function(){_0x1fc0bd['status'](0xcc)[_0x5be4('0x2c')]();});}};}function handleEntityNotFound(_0x154d66,_0xba5a1e){return function(_0x2af6c3){if(!_0x2af6c3){_0x154d66['sendStatus'](0x194);}return _0x2af6c3;};}function handleError(_0x2645ce,_0x4ae580){_0x4ae580=_0x4ae580||0x1f4;return function(_0x262550){logger['error'](_0x262550[_0x5be4('0x34')]);if(_0x262550[_0x5be4('0x35')]){delete _0x262550['name'];}_0x2645ce['status'](_0x4ae580)[_0x5be4('0x36')](_0x262550);};}exports['index']=function(_0x48b24a,_0x1b1ee9){var _0x1681ed={},_0x277d36={},_0x55253d={'count':0x0,'rows':[]};var _0x3dc4f9=_[_0x5be4('0x37')](db['DeskConfiguration'][_0x5be4('0x38')],function(_0x46953c){return{'name':_0x46953c[_0x5be4('0x39')],'type':_0x46953c[_0x5be4('0x3a')]['key']};});_0x277d36[_0x5be4('0x3b')]=_[_0x5be4('0x37')](_0x3dc4f9,_0x5be4('0x35'));_0x277d36[_0x5be4('0x3c')]=_[_0x5be4('0x3d')](_0x48b24a[_0x5be4('0x3c')]);_0x277d36[_0x5be4('0x3e')]=_[_0x5be4('0x3f')](_0x277d36['model'],_0x277d36[_0x5be4('0x3c')]);_0x1681ed[_0x5be4('0x40')]=_[_0x5be4('0x3f')](_0x277d36[_0x5be4('0x3b')],qs[_0x5be4('0x41')](_0x48b24a['query'][_0x5be4('0x41')]));_0x1681ed[_0x5be4('0x40')]=_0x1681ed['attributes'][_0x5be4('0x42')]?_0x1681ed[_0x5be4('0x40')]:_0x277d36['model'];if(!_0x48b24a[_0x5be4('0x3c')][_0x5be4('0x43')](_0x5be4('0x44'))){_0x1681ed[_0x5be4('0x45')]=qs[_0x5be4('0x45')](_0x48b24a[_0x5be4('0x3c')][_0x5be4('0x45')]);_0x1681ed[_0x5be4('0x2e')]=qs[_0x5be4('0x2e')](_0x48b24a['query'][_0x5be4('0x2e')]);}_0x1681ed['order']=qs[_0x5be4('0x46')](_0x48b24a[_0x5be4('0x3c')]['sort']);_0x1681ed[_0x5be4('0x47')]=qs['filters'](_['pick'](_0x48b24a[_0x5be4('0x3c')],_0x277d36[_0x5be4('0x3e')]),_0x3dc4f9);if(_0x48b24a[_0x5be4('0x3c')][_0x5be4('0x48')]){_0x1681ed[_0x5be4('0x47')]=_[_0x5be4('0x49')](_0x1681ed[_0x5be4('0x47')],{'$or':_['map'](_0x3dc4f9,function(_0x3ff2a0){if(_0x3ff2a0['type']!==_0x5be4('0x4a')){var _0x518ad5={};_0x518ad5[_0x3ff2a0[_0x5be4('0x35')]]={'$like':'%'+_0x48b24a[_0x5be4('0x3c')]['filter']+'%'};return _0x518ad5;}})});}_0x1681ed=_[_0x5be4('0x49')]({},_0x1681ed,_0x48b24a[_0x5be4('0x4b')]);var _0x1b2171={'where':_0x1681ed['where']};return db[_0x5be4('0x4c')][_0x5be4('0x4d')](_0x1b2171)['then'](function(_0x3b5fc6){_0x55253d['count']=_0x3b5fc6;if(_0x48b24a['query'][_0x5be4('0x4e')]){_0x1681ed[_0x5be4('0x4f')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x5be4('0x50')](_0x1681ed);})['then'](function(_0x5411bf){_0x55253d[_0x5be4('0x51')]=_0x5411bf;return _0x55253d;})[_0x5be4('0x20')](respondWithFilteredResult(_0x1b1ee9,_0x1681ed))[_0x5be4('0x29')](handleError(_0x1b1ee9,null));};exports['show']=function(_0x5a8de6,_0x378ae7){var _0x2fb7cd={'raw':![],'where':{'id':_0x5a8de6[_0x5be4('0x52')]['id']}},_0x117a92={};_0x117a92['model']=_[_0x5be4('0x3d')](db[_0x5be4('0x4c')]['rawAttributes']);_0x117a92[_0x5be4('0x3c')]=_[_0x5be4('0x3d')](_0x5a8de6[_0x5be4('0x3c')]);_0x117a92['filters']=_[_0x5be4('0x3f')](_0x117a92[_0x5be4('0x3b')],_0x117a92[_0x5be4('0x3c')]);_0x2fb7cd[_0x5be4('0x40')]=_[_0x5be4('0x3f')](_0x117a92[_0x5be4('0x3b')],qs[_0x5be4('0x41')](_0x5a8de6[_0x5be4('0x3c')][_0x5be4('0x41')]));_0x2fb7cd[_0x5be4('0x40')]=_0x2fb7cd['attributes'][_0x5be4('0x42')]?_0x2fb7cd['attributes']:_0x117a92[_0x5be4('0x3b')];if(_0x5a8de6[_0x5be4('0x3c')][_0x5be4('0x4e')]){_0x2fb7cd[_0x5be4('0x4f')]=[{'all':!![]}];}_0x2fb7cd=_[_0x5be4('0x49')]({},_0x2fb7cd,_0x5a8de6[_0x5be4('0x4b')]);return db[_0x5be4('0x4c')][_0x5be4('0x53')](_0x2fb7cd)[_0x5be4('0x20')](handleEntityNotFound(_0x378ae7,null))[_0x5be4('0x20')](respondWithResult(_0x378ae7,null))[_0x5be4('0x29')](handleError(_0x378ae7,null));};exports['create']=function(_0x4367fa,_0x1031ea){return db[_0x5be4('0x4c')][_0x5be4('0x54')](_0x4367fa[_0x5be4('0x55')],{})['then'](respondWithResult(_0x1031ea,0xc9))[_0x5be4('0x29')](handleError(_0x1031ea,null));};exports[_0x5be4('0x32')]=function(_0xf454e6,_0x446e59){if(_0xf454e6[_0x5be4('0x55')]['id']){delete _0xf454e6[_0x5be4('0x55')]['id'];}return db[_0x5be4('0x4c')]['find']({'where':{'id':_0xf454e6[_0x5be4('0x52')]['id']}})['then'](handleEntityNotFound(_0x446e59,null))[_0x5be4('0x20')](saveUpdates(_0xf454e6[_0x5be4('0x55')],null))['then'](respondWithResult(_0x446e59,null))[_0x5be4('0x29')](handleError(_0x446e59,null));};exports[_0x5be4('0x33')]=function(_0x3c3ebb,_0xb12df){return db[_0x5be4('0x4c')][_0x5be4('0x53')]({'where':{'id':_0x3c3ebb[_0x5be4('0x52')]['id']}})[_0x5be4('0x20')](handleEntityNotFound(_0xb12df,null))['then'](removeEntity(_0xb12df,null))['catch'](handleError(_0xb12df,null));};exports[_0x5be4('0x56')]=function(_0x4812cf,_0x212f5d,_0x562e1d){var _0x27c570={};var _0x2a5b4f={};var _0x688cc2;var _0x2f94d6;return db[_0x5be4('0x4c')][_0x5be4('0x57')]({'where':{'id':_0x4812cf[_0x5be4('0x52')]['id']}})['then'](handleEntityNotFound(_0x212f5d,null))[_0x5be4('0x20')](function(_0x356e4d){if(_0x356e4d){_0x688cc2=_0x356e4d;_0x2a5b4f['model']=_[_0x5be4('0x3d')](db[_0x5be4('0x58')][_0x5be4('0x38')]);_0x2a5b4f[_0x5be4('0x3c')]=_[_0x5be4('0x3d')](_0x4812cf['query']);_0x2a5b4f[_0x5be4('0x3e')]=_[_0x5be4('0x3f')](_0x2a5b4f[_0x5be4('0x3b')],_0x2a5b4f[_0x5be4('0x3c')]);_0x27c570[_0x5be4('0x40')]=_['intersection'](_0x2a5b4f[_0x5be4('0x3b')],qs['fields'](_0x4812cf[_0x5be4('0x3c')][_0x5be4('0x41')]));_0x27c570[_0x5be4('0x40')]=_0x27c570['attributes'][_0x5be4('0x42')]?_0x27c570[_0x5be4('0x40')]:_0x2a5b4f['model'];_0x27c570['order']=qs[_0x5be4('0x46')](_0x4812cf[_0x5be4('0x3c')]['sort']);_0x27c570[_0x5be4('0x47')]=qs[_0x5be4('0x3e')](_[_0x5be4('0x59')](_0x4812cf[_0x5be4('0x3c')],_0x2a5b4f[_0x5be4('0x3e')]));if(_0x4812cf[_0x5be4('0x3c')][_0x5be4('0x48')]){_0x27c570[_0x5be4('0x47')]=_[_0x5be4('0x49')](_0x27c570[_0x5be4('0x47')],{'$or':_[_0x5be4('0x37')](_0x27c570[_0x5be4('0x40')],function(_0x5a7d62){var _0x1a9443={};_0x1a9443[_0x5a7d62]={'$like':'%'+_0x4812cf[_0x5be4('0x3c')][_0x5be4('0x48')]+'%'};return _0x1a9443;})});}_0x27c570=_[_0x5be4('0x49')]({},_0x27c570,_0x4812cf[_0x5be4('0x4b')]);return _0x688cc2[_0x5be4('0x56')](_0x27c570);}})[_0x5be4('0x20')](function(_0x1011d2){if(_0x1011d2){_0x2f94d6=_0x1011d2[_0x5be4('0x42')];if(!_0x4812cf[_0x5be4('0x3c')][_0x5be4('0x43')]('nolimit')){_0x27c570['limit']=qs[_0x5be4('0x45')](_0x4812cf[_0x5be4('0x3c')][_0x5be4('0x45')]);_0x27c570['offset']=qs['offset'](_0x4812cf[_0x5be4('0x3c')][_0x5be4('0x2e')]);}return _0x688cc2[_0x5be4('0x56')](_0x27c570);}})[_0x5be4('0x20')](function(_0x346d5a){if(_0x346d5a){return _0x346d5a?{'count':_0x2f94d6,'rows':_0x346d5a}:null;}})[_0x5be4('0x20')](respondWithResult(_0x212f5d,null))[_0x5be4('0x29')](handleError(_0x212f5d,null));};exports['getSubjects']=function(_0x21f887,_0x349b46,_0x4a04d1){var _0x3df075={};var _0x578b9c={};var _0x4526c9;var _0x565869;return db['DeskConfiguration']['findOne']({'where':{'id':_0x21f887[_0x5be4('0x52')]['id']}})[_0x5be4('0x20')](handleEntityNotFound(_0x349b46,null))[_0x5be4('0x20')](function(_0xc77b29){if(_0xc77b29){_0x4526c9=_0xc77b29;_0x578b9c['model']=_['keys'](db['DeskField']['rawAttributes']);_0x578b9c['query']=_[_0x5be4('0x3d')](_0x21f887[_0x5be4('0x3c')]);_0x578b9c['filters']=_['intersection'](_0x578b9c[_0x5be4('0x3b')],_0x578b9c[_0x5be4('0x3c')]);_0x3df075[_0x5be4('0x40')]=_[_0x5be4('0x3f')](_0x578b9c[_0x5be4('0x3b')],qs[_0x5be4('0x41')](_0x21f887[_0x5be4('0x3c')][_0x5be4('0x41')]));_0x3df075['attributes']=_0x3df075[_0x5be4('0x40')][_0x5be4('0x42')]?_0x3df075['attributes']:_0x578b9c['model'];_0x3df075[_0x5be4('0x5a')]=qs[_0x5be4('0x46')](_0x21f887['query'][_0x5be4('0x46')]);_0x3df075[_0x5be4('0x47')]=qs[_0x5be4('0x3e')](_[_0x5be4('0x59')](_0x21f887[_0x5be4('0x3c')],_0x578b9c[_0x5be4('0x3e')]));if(_0x21f887[_0x5be4('0x3c')][_0x5be4('0x48')]){_0x3df075[_0x5be4('0x47')]=_['merge'](_0x3df075[_0x5be4('0x47')],{'$or':_[_0x5be4('0x37')](_0x3df075[_0x5be4('0x40')],function(_0x213904){var _0x2ee96c={};_0x2ee96c[_0x213904]={'$like':'%'+_0x21f887['query']['filter']+'%'};return _0x2ee96c;})});}_0x3df075=_[_0x5be4('0x49')]({},_0x3df075,_0x21f887[_0x5be4('0x4b')]);return _0x4526c9[_0x5be4('0x5b')](_0x3df075);}})[_0x5be4('0x20')](function(_0x3c3515){if(_0x3c3515){_0x565869=_0x3c3515[_0x5be4('0x42')];if(!_0x21f887[_0x5be4('0x3c')][_0x5be4('0x43')]('nolimit')){_0x3df075[_0x5be4('0x45')]=qs[_0x5be4('0x45')](_0x21f887[_0x5be4('0x3c')][_0x5be4('0x45')]);_0x3df075[_0x5be4('0x2e')]=qs[_0x5be4('0x2e')](_0x21f887[_0x5be4('0x3c')]['offset']);}return _0x4526c9['getSubjects'](_0x3df075);}})[_0x5be4('0x20')](function(_0x180a69){if(_0x180a69){return _0x180a69?{'count':_0x565869,'rows':_0x180a69}:null;}})[_0x5be4('0x20')](respondWithResult(_0x349b46,null))[_0x5be4('0x29')](handleError(_0x349b46,null));};exports[_0x5be4('0x5c')]=function(_0x416b22,_0x2833d8,_0x2645c8){var _0x4e9aa9={};var _0x105b63={};var _0xa525d;var _0x5d579b;return db['DeskConfiguration'][_0x5be4('0x57')]({'where':{'id':_0x416b22['params']['id']}})['then'](handleEntityNotFound(_0x2833d8,null))['then'](function(_0x41fd91){if(_0x41fd91){_0xa525d=_0x41fd91;_0x105b63[_0x5be4('0x3b')]=_[_0x5be4('0x3d')](db[_0x5be4('0x58')][_0x5be4('0x38')]);_0x105b63['query']=_[_0x5be4('0x3d')](_0x416b22[_0x5be4('0x3c')]);_0x105b63[_0x5be4('0x3e')]=_['intersection'](_0x105b63[_0x5be4('0x3b')],_0x105b63[_0x5be4('0x3c')]);_0x4e9aa9['attributes']=_[_0x5be4('0x3f')](_0x105b63[_0x5be4('0x3b')],qs[_0x5be4('0x41')](_0x416b22[_0x5be4('0x3c')][_0x5be4('0x41')]));_0x4e9aa9[_0x5be4('0x40')]=_0x4e9aa9[_0x5be4('0x40')][_0x5be4('0x42')]?_0x4e9aa9[_0x5be4('0x40')]:_0x105b63['model'];_0x4e9aa9[_0x5be4('0x5a')]=qs[_0x5be4('0x46')](_0x416b22[_0x5be4('0x3c')][_0x5be4('0x46')]);_0x4e9aa9[_0x5be4('0x47')]=qs[_0x5be4('0x3e')](_[_0x5be4('0x59')](_0x416b22[_0x5be4('0x3c')],_0x105b63[_0x5be4('0x3e')]));if(_0x416b22[_0x5be4('0x3c')][_0x5be4('0x48')]){_0x4e9aa9[_0x5be4('0x47')]=_[_0x5be4('0x49')](_0x4e9aa9[_0x5be4('0x47')],{'$or':_[_0x5be4('0x37')](_0x4e9aa9[_0x5be4('0x40')],function(_0x526e03){var _0x4adfb0={};_0x4adfb0[_0x526e03]={'$like':'%'+_0x416b22[_0x5be4('0x3c')][_0x5be4('0x48')]+'%'};return _0x4adfb0;})});}_0x4e9aa9=_[_0x5be4('0x49')]({},_0x4e9aa9,_0x416b22[_0x5be4('0x4b')]);return _0xa525d[_0x5be4('0x5c')](_0x4e9aa9);}})[_0x5be4('0x20')](function(_0x112221){if(_0x112221){_0x5d579b=_0x112221[_0x5be4('0x42')];if(!_0x416b22[_0x5be4('0x3c')][_0x5be4('0x43')](_0x5be4('0x44'))){_0x4e9aa9[_0x5be4('0x45')]=qs[_0x5be4('0x45')](_0x416b22[_0x5be4('0x3c')]['limit']);_0x4e9aa9['offset']=qs[_0x5be4('0x2e')](_0x416b22[_0x5be4('0x3c')][_0x5be4('0x2e')]);}return _0xa525d['getDescriptions'](_0x4e9aa9);}})[_0x5be4('0x20')](function(_0x2fb12c){if(_0x2fb12c){return _0x2fb12c?{'count':_0x5d579b,'rows':_0x2fb12c}:null;}})['then'](respondWithResult(_0x2833d8,null))[_0x5be4('0x29')](handleError(_0x2833d8,null));};exports[_0x5be4('0x5d')]=function(_0x4144ef,_0x3f94ba,_0x2179ae){var _0x214dc7={};var _0x12db5f={};var _0x4ed3e4;var _0x15b875;return db[_0x5be4('0x4c')][_0x5be4('0x57')]({'where':{'id':_0x4144ef[_0x5be4('0x52')]['id']}})[_0x5be4('0x20')](handleEntityNotFound(_0x3f94ba,null))['then'](function(_0x4f5f32){if(_0x4f5f32){_0x4ed3e4=_0x4f5f32;_0x12db5f['model']=_['keys'](db[_0x5be4('0x5e')][_0x5be4('0x38')]);_0x12db5f[_0x5be4('0x3c')]=_['keys'](_0x4144ef['query']);_0x12db5f['filters']=_[_0x5be4('0x3f')](_0x12db5f[_0x5be4('0x3b')],_0x12db5f[_0x5be4('0x3c')]);_0x214dc7[_0x5be4('0x40')]=_[_0x5be4('0x3f')](_0x12db5f[_0x5be4('0x3b')],qs[_0x5be4('0x41')](_0x4144ef[_0x5be4('0x3c')][_0x5be4('0x41')]));_0x214dc7[_0x5be4('0x40')]=_0x214dc7[_0x5be4('0x40')][_0x5be4('0x42')]?_0x214dc7[_0x5be4('0x40')]:_0x12db5f[_0x5be4('0x3b')];_0x214dc7[_0x5be4('0x5a')]=qs[_0x5be4('0x46')](_0x4144ef['query']['sort']);_0x214dc7['where']=qs[_0x5be4('0x3e')](_[_0x5be4('0x59')](_0x4144ef[_0x5be4('0x3c')],_0x12db5f[_0x5be4('0x3e')]));if(_0x4144ef[_0x5be4('0x3c')]['filter']){_0x214dc7['where']=_['merge'](_0x214dc7[_0x5be4('0x47')],{'$or':_['map'](_0x214dc7['attributes'],function(_0x588ff7){var _0x209a67={};_0x209a67[_0x588ff7]={'$like':'%'+_0x4144ef[_0x5be4('0x3c')][_0x5be4('0x48')]+'%'};return _0x209a67;})});}_0x214dc7=_[_0x5be4('0x49')]({},_0x214dc7,_0x4144ef[_0x5be4('0x4b')]);return _0x4ed3e4[_0x5be4('0x5d')](_0x214dc7);}})[_0x5be4('0x20')](function(_0x480f74){if(_0x480f74){_0x15b875=_0x480f74[_0x5be4('0x42')];if(!_0x4144ef[_0x5be4('0x3c')][_0x5be4('0x43')](_0x5be4('0x44'))){_0x214dc7['limit']=qs[_0x5be4('0x45')](_0x4144ef[_0x5be4('0x3c')][_0x5be4('0x45')]);_0x214dc7[_0x5be4('0x2e')]=qs[_0x5be4('0x2e')](_0x4144ef[_0x5be4('0x3c')][_0x5be4('0x2e')]);}return _0x4ed3e4['getTags'](_0x214dc7);}})[_0x5be4('0x20')](function(_0x23a34c){if(_0x23a34c){return _0x23a34c?{'count':_0x15b875,'rows':_0x23a34c}:null;}})['then'](respondWithResult(_0x3f94ba,null))[_0x5be4('0x29')](handleError(_0x3f94ba,null));};exports[_0x5be4('0x5f')]=function(_0x5d909d,_0x1760f9,_0x1ba2ce){if(_0x5d909d['body']['id']){delete _0x5d909d[_0x5be4('0x55')]['id'];}return db[_0x5be4('0x4c')][_0x5be4('0x57')]({'where':{'id':_0x5d909d['params']['id']}})[_0x5be4('0x20')](handleEntityNotFound(_0x1760f9,null))[_0x5be4('0x20')](function(_0x41322c){if(_0x41322c){return _0x41322c[_0x5be4('0x5f')](_0x5d909d['body'][_0x5be4('0x60')]||[]);}return null;})[_0x5be4('0x20')](respondWithResult(_0x1760f9,null))['catch'](handleError(_0x1760f9,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 74848a2..f4c4eb7 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 _0xdd48=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations','api'];(function(_0x4b2125,_0x31462d){var _0x1a6fc3=function(_0x218c03){while(--_0x218c03){_0x4b2125['push'](_0x4b2125['shift']());}};_0x1a6fc3(++_0x31462d);}(_0xdd48,0x16a));var _0x8dd4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xdd48[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8dd4('0x0'));var moment=require(_0x8dd4('0x1'));var BPromise=require(_0x8dd4('0x2'));var rp=require(_0x8dd4('0x3'));var fs=require('fs');var path=require(_0x8dd4('0x4'));var rimraf=require(_0x8dd4('0x5'));var config=require(_0x8dd4('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x8dd4('0x7')]=function(_0x3aca5e,_0x2ed0c8){return _0x3aca5e[_0x8dd4('0x8')](_0x8dd4('0x9'),attributes,{'tableName':_0x8dd4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92b0=['bluebird','request-promise','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment'];(function(_0x9ae292,_0x130cef){var _0xadefdd=function(_0x4506a0){while(--_0x4506a0){_0x9ae292['push'](_0x9ae292['shift']());}};_0xadefdd(++_0x130cef);}(_0x92b0,0x128));var _0x092b=function(_0x2d1ce5,_0x231ca1){_0x2d1ce5=_0x2d1ce5-0x0;var _0x4d3365=_0x92b0[_0x2d1ce5];return _0x4d3365;};'use strict';var _=require(_0x092b('0x0'));var util=require(_0x092b('0x1'));var logger=require(_0x092b('0x2'))('api');var moment=require(_0x092b('0x3'));var BPromise=require(_0x092b('0x4'));var rp=require(_0x092b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x092b('0x6'));var config=require('../../config/environment');var attributes=require(_0x092b('0x7'));module[_0x092b('0x8')]=function(_0x4f7cf6,_0x8be119){return _0x4f7cf6[_0x092b('0x9')](_0x092b('0xa'),attributes,{'tableName':_0x092b('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 5488119..2e6dd87 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 _0xa477=['client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x117c43,_0x54b6be){var _0x5e4f90=function(_0x490ac7){while(--_0x490ac7){_0x117c43['push'](_0x117c43['shift']());}};_0x5e4f90(++_0x54b6be);}(_0xa477,0xe6));var _0x7a47=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa477[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});} \ No newline at end of file +var _0x342e=['result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x444a5d,_0x3b2af5){var _0x6827e4=function(_0x36c337){while(--_0x36c337){_0x444a5d['push'](_0x444a5d['shift']());}};_0x6827e4(++_0x3b2af5);}(_0x342e,0xde));var _0xe342=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x342e[_0x3f4dd9];return _0x31c54a;};'use strict';var _=require(_0xe342('0x0'));var util=require(_0xe342('0x1'));var moment=require(_0xe342('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe342('0x3'));var db=require(_0xe342('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe342('0x5'));var config=require(_0xe342('0x6'));var jayson=require(_0xe342('0x7'));var client=jayson[_0xe342('0x8')][_0xe342('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e643a,_0x57895b,_0x3457ac){return new BPromise(function(_0x36bb18,_0x54868d){return client['request'](_0x5e643a,_0x3457ac)[_0xe342('0xa')](function(_0x2b2e82){logger[_0xe342('0xb')](_0xe342('0xc'),_0x57895b,_0xe342('0xd'));logger[_0xe342('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x57895b,_0xe342('0xd'),JSON[_0xe342('0xf')](_0x2b2e82));if(_0x2b2e82[_0xe342('0x10')]){if(_0x2b2e82[_0xe342('0x10')]['code']===0x1f4){logger[_0xe342('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x57895b,_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);return _0x54868d(_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);}logger['error'](_0xe342('0xc'),_0x57895b,_0x2b2e82[_0xe342('0x10')]['message']);return _0x36bb18(_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);}else{logger[_0xe342('0xb')](_0xe342('0xc'),_0x57895b,_0xe342('0xd'));_0x36bb18(_0x2b2e82[_0xe342('0x12')][_0xe342('0x11')]);}})[_0xe342('0x13')](function(_0x190a90){logger[_0xe342('0x10')](_0xe342('0xc'),_0x57895b,_0x190a90);_0x54868d(_0x190a90);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 9727df9..92abc46 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 _0x88c4=['show','post','create','put','update','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x88c4,0x16f));var _0x488c=function(_0x3238ea,_0x91809d){_0x3238ea=_0x3238ea-0x0;var _0x4aaac2=_0x88c4[_0x3238ea];return _0x4aaac2;};'use strict';var multer=require(_0x488c('0x0'));var util=require(_0x488c('0x1'));var path=require('path');var timeout=require(_0x488c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x488c('0x3'));var interaction=require(_0x488c('0x4'));var config=require(_0x488c('0x5'));var controller=require(_0x488c('0x6'));router[_0x488c('0x7')]('/',auth[_0x488c('0x8')](),controller[_0x488c('0x9')]);router[_0x488c('0x7')](_0x488c('0xa'),auth[_0x488c('0x8')](),controller[_0x488c('0xb')]);router[_0x488c('0xc')]('/',auth[_0x488c('0x8')](),controller[_0x488c('0xd')]);router[_0x488c('0xe')](_0x488c('0xa'),auth[_0x488c('0x8')](),controller[_0x488c('0xf')]);router[_0x488c('0x10')](_0x488c('0xa'),auth['isAuthenticated'](),controller[_0x488c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5cc0=['Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','index','get','isAuthenticated','show','put','/:id','update','delete','exports','util','path','express'];(function(_0x304cf1,_0x18c0ea){var _0x3a0075=function(_0x551db2){while(--_0x551db2){_0x304cf1['push'](_0x304cf1['shift']());}};_0x3a0075(++_0x18c0ea);}(_0x5cc0,0x17d));var _0x05cc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5cc0[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x05cc('0x0'));var path=require(_0x05cc('0x1'));var timeout=require('connect-timeout');var express=require(_0x05cc('0x2'));var router=express[_0x05cc('0x3')]();var auth=require(_0x05cc('0x4'));var interaction=require(_0x05cc('0x5'));var config=require('../../config/environment');var controller=require(_0x05cc('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x05cc('0x7')]);router[_0x05cc('0x8')]('/:id',auth[_0x05cc('0x9')](),controller[_0x05cc('0xa')]);router['post']('/',auth[_0x05cc('0x9')](),controller['create']);router[_0x05cc('0xb')](_0x05cc('0xc'),auth[_0x05cc('0x9')](),controller[_0x05cc('0xd')]);router[_0x05cc('0xe')](_0x05cc('0xc'),auth[_0x05cc('0x9')](),controller['destroy']);module[_0x05cc('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 506c412..25d5969 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 _0x945d=['exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x945d,0x188));var _0xd945=function(_0x403dd4,_0x469869){_0x403dd4=_0x403dd4-0x0;var _0x25e6f9=_0x945d[_0x403dd4];return _0x25e6f9;};'use strict';var Sequelize=require('sequelize');module[_0xd945('0x0')]={'type':{'type':Sequelize['ENUM'](_0xd945('0x1'),_0xd945('0x2'),_0xd945('0x3'),_0xd945('0x4')),'defaultValue':_0xd945('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd945('0x5')]},'keyType':{'type':Sequelize[_0xd945('0x6')]('string','variable',_0xd945('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd945('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd945('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3bc0=['sequelize','exports','string','variable','keyValue','STRING','ENUM','customVariable'];(function(_0x456660,_0x4e2958){var _0x3410d9=function(_0x2066b0){while(--_0x2066b0){_0x456660['push'](_0x456660['shift']());}};_0x3410d9(++_0x4e2958);}(_0x3bc0,0x1c0));var _0x03bc=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x3bc0[_0x4e7d25];return _0x526fe6;};'use strict';var Sequelize=require(_0x03bc('0x0'));module[_0x03bc('0x1')]={'type':{'type':Sequelize['ENUM'](_0x03bc('0x2'),_0x03bc('0x3'),'customVariable',_0x03bc('0x4')),'defaultValue':_0x03bc('0x2')},'content':{'type':Sequelize[_0x03bc('0x5')]},'key':{'type':Sequelize[_0x03bc('0x5')]},'keyType':{'type':Sequelize[_0x03bc('0x6')](_0x03bc('0x2'),'variable',_0x03bc('0x7'))},'keyContent':{'type':Sequelize[_0x03bc('0x5')]},'idField':{'type':Sequelize[_0x03bc('0x5')]},'nameField':{'type':Sequelize[_0x03bc('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x03bc('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index fdaec36..87a15d4 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 _0x5032=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','DeskField','includeAll','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type'];(function(_0x48c784,_0x52b6fc){var _0x4634d9=function(_0x5c4f16){while(--_0x5c4f16){_0x48c784['push'](_0x48c784['shift']());}};_0x4634d9(++_0x52b6fc);}(_0x5032,0x1b7));var _0x2503=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5032[_0x1ac595];return _0x455fff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2503('0x0'));var rimraf=require(_0x2503('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2503('0x2'));var rp=require(_0x2503('0x3'));var moment=require(_0x2503('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2503('0x5'));var util=require(_0x2503('0x6'));var path=require('path');var sox=require(_0x2503('0x7'));var csv=require(_0x2503('0x8'));var ejs=require(_0x2503('0x9'));var fs=require('fs');var _=require(_0x2503('0xa'));var squel=require(_0x2503('0xb'));var crypto=require(_0x2503('0xc'));var jsforce=require(_0x2503('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2503('0x8'));var querystring=require(_0x2503('0xe'));var Papa=require(_0x2503('0xf'));var Redis=require(_0x2503('0x10'));var authService=require(_0x2503('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2503('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2503('0x13'))(_0x2503('0x14'));var utils=require(_0x2503('0x15'));var config=require(_0x2503('0x16'));var db=require(_0x2503('0x17'))['db'];function respondWithStatusCode(_0x1f1041,_0xe00b7f){_0xe00b7f=_0xe00b7f||0xcc;return function(_0x5d84b0){if(_0x5d84b0){return _0x1f1041['sendStatus'](_0xe00b7f);}return _0x1f1041[_0x2503('0x18')](_0xe00b7f)['end']();};}function respondWithResult(_0x4f8511,_0x581079){_0x581079=_0x581079||0xc8;return function(_0x559f31){if(_0x559f31){return _0x4f8511[_0x2503('0x18')](_0x581079)['json'](_0x559f31);}};}function respondWithFilteredResult(_0x25d78c,_0x1dd2ea){return function(_0x53b244){if(_0x53b244){var _0x5fb8e0=_0x53b244[_0x2503('0x19')],_0x56fd32=_0x1dd2ea[_0x2503('0x1a')],_0xbce711=_0x1dd2ea[_0x2503('0x1a')]+_0x1dd2ea[_0x2503('0x1b')],_0x9ada07;if(_0xbce711>=_0x5fb8e0){_0xbce711=_0x5fb8e0;_0x9ada07=0xc8;}else{_0x9ada07=0xce;}_0x25d78c[_0x2503('0x18')](_0x9ada07);return _0x25d78c[_0x2503('0x1c')]('Content-Range',_0x56fd32+'-'+_0xbce711+'/'+_0x5fb8e0)[_0x2503('0x1d')](_0x53b244);}return null;};}function patchUpdates(_0xf307e0){return function(_0x51f074){try{jsonpatch[_0x2503('0x1e')](_0x51f074,_0xf307e0,!![]);}catch(_0x286909){return BPromise['reject'](_0x286909);}return _0x51f074[_0x2503('0x1f')]();};}function saveUpdates(_0x402d78,_0x5c637f){return function(_0xbab8fb){if(_0xbab8fb){return _0xbab8fb[_0x2503('0x20')](_0x402d78)[_0x2503('0x21')](function(_0x227a59){return _0x227a59;});}return null;};}function removeEntity(_0xb4f4da,_0x79ce19){return function(_0x423e22){if(_0x423e22){return _0x423e22[_0x2503('0x22')]()['then'](function(){_0xb4f4da[_0x2503('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48a25e,_0x209e6b){return function(_0x4a34f0){if(!_0x4a34f0){_0x48a25e[_0x2503('0x23')](0x194);}return _0x4a34f0;};}function handleError(_0x4de9b7,_0x504791){_0x504791=_0x504791||0x1f4;return function(_0x4ce7b6){logger[_0x2503('0x24')](_0x4ce7b6[_0x2503('0x25')]);if(_0x4ce7b6[_0x2503('0x26')]){delete _0x4ce7b6['name'];}_0x4de9b7[_0x2503('0x18')](_0x504791)[_0x2503('0x27')](_0x4ce7b6);};}exports['index']=function(_0x53ce9d,_0x1d824d){var _0xcd8ada={},_0x4c445f={},_0x254fa5={'count':0x0,'rows':[]};var _0x1d2db0=_[_0x2503('0x28')](db['DeskField'][_0x2503('0x29')],function(_0x47ccf6){return{'name':_0x47ccf6[_0x2503('0x2a')],'type':_0x47ccf6[_0x2503('0x2b')][_0x2503('0x2c')]};});_0x4c445f[_0x2503('0x2d')]=_[_0x2503('0x28')](_0x1d2db0,_0x2503('0x26'));_0x4c445f[_0x2503('0x2e')]=_[_0x2503('0x2f')](_0x53ce9d[_0x2503('0x2e')]);_0x4c445f[_0x2503('0x30')]=_[_0x2503('0x31')](_0x4c445f[_0x2503('0x2d')],_0x4c445f['query']);_0xcd8ada[_0x2503('0x32')]=_[_0x2503('0x31')](_0x4c445f['model'],qs[_0x2503('0x33')](_0x53ce9d[_0x2503('0x2e')][_0x2503('0x33')]));_0xcd8ada[_0x2503('0x32')]=_0xcd8ada[_0x2503('0x32')][_0x2503('0x34')]?_0xcd8ada['attributes']:_0x4c445f[_0x2503('0x2d')];if(!_0x53ce9d['query'][_0x2503('0x35')](_0x2503('0x36'))){_0xcd8ada[_0x2503('0x1b')]=qs[_0x2503('0x1b')](_0x53ce9d[_0x2503('0x2e')]['limit']);_0xcd8ada[_0x2503('0x1a')]=qs[_0x2503('0x1a')](_0x53ce9d[_0x2503('0x2e')]['offset']);}_0xcd8ada['order']=qs[_0x2503('0x37')](_0x53ce9d[_0x2503('0x2e')][_0x2503('0x37')]);_0xcd8ada[_0x2503('0x38')]=qs['filters'](_['pick'](_0x53ce9d[_0x2503('0x2e')],_0x4c445f['filters']),_0x1d2db0);if(_0x53ce9d[_0x2503('0x2e')][_0x2503('0x39')]){_0xcd8ada[_0x2503('0x38')]=_[_0x2503('0x3a')](_0xcd8ada[_0x2503('0x38')],{'$or':_[_0x2503('0x28')](_0x1d2db0,function(_0x498249){if(_0x498249[_0x2503('0x2b')]!==_0x2503('0x3b')){var _0xfa000f={};_0xfa000f[_0x498249[_0x2503('0x26')]]={'$like':'%'+_0x53ce9d[_0x2503('0x2e')][_0x2503('0x39')]+'%'};return _0xfa000f;}})});}_0xcd8ada=_[_0x2503('0x3a')]({},_0xcd8ada,_0x53ce9d['options']);var _0x390502={'where':_0xcd8ada[_0x2503('0x38')]};return db[_0x2503('0x3c')][_0x2503('0x19')](_0x390502)[_0x2503('0x21')](function(_0x406fc5){_0x254fa5['count']=_0x406fc5;if(_0x53ce9d[_0x2503('0x2e')][_0x2503('0x3d')]){_0xcd8ada['include']=[{'all':!![]}];}return db[_0x2503('0x3c')]['findAll'](_0xcd8ada);})['then'](function(_0x35ce2b){_0x254fa5['rows']=_0x35ce2b;return _0x254fa5;})[_0x2503('0x21')](respondWithFilteredResult(_0x1d824d,_0xcd8ada))[_0x2503('0x3e')](handleError(_0x1d824d,null));};exports[_0x2503('0x3f')]=function(_0x391eea,_0x268d10){var _0x230a68={'raw':!![],'where':{'id':_0x391eea[_0x2503('0x40')]['id']}},_0x4a666e={};_0x4a666e[_0x2503('0x2d')]=_[_0x2503('0x2f')](db[_0x2503('0x3c')]['rawAttributes']);_0x4a666e[_0x2503('0x2e')]=_[_0x2503('0x2f')](_0x391eea[_0x2503('0x2e')]);_0x4a666e[_0x2503('0x30')]=_[_0x2503('0x31')](_0x4a666e[_0x2503('0x2d')],_0x4a666e[_0x2503('0x2e')]);_0x230a68[_0x2503('0x32')]=_['intersection'](_0x4a666e[_0x2503('0x2d')],qs[_0x2503('0x33')](_0x391eea[_0x2503('0x2e')][_0x2503('0x33')]));_0x230a68[_0x2503('0x32')]=_0x230a68[_0x2503('0x32')][_0x2503('0x34')]?_0x230a68['attributes']:_0x4a666e[_0x2503('0x2d')];if(_0x391eea[_0x2503('0x2e')][_0x2503('0x3d')]){_0x230a68[_0x2503('0x41')]=[{'all':!![]}];}_0x230a68=_[_0x2503('0x3a')]({},_0x230a68,_0x391eea['options']);return db[_0x2503('0x3c')][_0x2503('0x42')](_0x230a68)[_0x2503('0x21')](handleEntityNotFound(_0x268d10,null))[_0x2503('0x21')](respondWithResult(_0x268d10,null))[_0x2503('0x3e')](handleError(_0x268d10,null));};exports[_0x2503('0x43')]=function(_0x243b31,_0x2cf3ba){return db[_0x2503('0x3c')][_0x2503('0x43')](_0x243b31[_0x2503('0x44')],{})[_0x2503('0x21')](respondWithResult(_0x2cf3ba,0xc9))['catch'](handleError(_0x2cf3ba,null));};exports[_0x2503('0x20')]=function(_0x426b20,_0x1d4960){if(_0x426b20[_0x2503('0x44')]['id']){delete _0x426b20[_0x2503('0x44')]['id'];}return db['DeskField'][_0x2503('0x42')]({'where':{'id':_0x426b20[_0x2503('0x40')]['id']}})[_0x2503('0x21')](handleEntityNotFound(_0x1d4960,null))[_0x2503('0x21')](saveUpdates(_0x426b20[_0x2503('0x44')],null))['then'](respondWithResult(_0x1d4960,null))[_0x2503('0x3e')](handleError(_0x1d4960,null));};exports['destroy']=function(_0x455ede,_0x1586cc){return db[_0x2503('0x3c')][_0x2503('0x42')]({'where':{'id':_0x455ede[_0x2503('0x40')]['id']}})['then'](handleEntityNotFound(_0x1586cc,null))[_0x2503('0x21')](removeEntity(_0x1586cc,null))[_0x2503('0x3e')](handleError(_0x1586cc,null));}; \ No newline at end of file +var _0x3327=['sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','DeskField','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x3327,0x7a));var _0x7332=function(_0x77cf1f,_0x34e1e5){_0x77cf1f=_0x77cf1f-0x0;var _0x2ef0bf=_0x3327[_0x77cf1f];return _0x2ef0bf;};'use strict';var pdf=require(_0x7332('0x0'));var emlformat=require(_0x7332('0x1'));var rimraf=require(_0x7332('0x2'));var zipdir=require(_0x7332('0x3'));var jsonpatch=require(_0x7332('0x4'));var rp=require('request-promise');var moment=require(_0x7332('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7332('0x6'));var path=require(_0x7332('0x7'));var sox=require(_0x7332('0x8'));var csv=require('to-csv');var ejs=require(_0x7332('0x9'));var fs=require('fs');var _=require(_0x7332('0xa'));var squel=require(_0x7332('0xb'));var crypto=require(_0x7332('0xc'));var jsforce=require(_0x7332('0xd'));var deskjs=require(_0x7332('0xe'));var toCsv=require(_0x7332('0xf'));var querystring=require(_0x7332('0x10'));var Papa=require(_0x7332('0x11'));var Redis=require(_0x7332('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7332('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7332('0x14'));var logger=require(_0x7332('0x15'))(_0x7332('0x16'));var utils=require(_0x7332('0x17'));var config=require(_0x7332('0x18'));var db=require(_0x7332('0x19'))['db'];function respondWithStatusCode(_0x101f88,_0x3ad4ec){_0x3ad4ec=_0x3ad4ec||0xcc;return function(_0x5e87d1){if(_0x5e87d1){return _0x101f88[_0x7332('0x1a')](_0x3ad4ec);}return _0x101f88[_0x7332('0x1b')](_0x3ad4ec)['end']();};}function respondWithResult(_0xb51015,_0x241c71){_0x241c71=_0x241c71||0xc8;return function(_0x1d9af0){if(_0x1d9af0){return _0xb51015[_0x7332('0x1b')](_0x241c71)[_0x7332('0x1c')](_0x1d9af0);}};}function respondWithFilteredResult(_0x6133b3,_0x4491f6){return function(_0xe547df){if(_0xe547df){var _0x3887c5=_0xe547df[_0x7332('0x1d')],_0x295058=_0x4491f6[_0x7332('0x1e')],_0x5a3201=_0x4491f6['offset']+_0x4491f6[_0x7332('0x1f')],_0x112b41;if(_0x5a3201>=_0x3887c5){_0x5a3201=_0x3887c5;_0x112b41=0xc8;}else{_0x112b41=0xce;}_0x6133b3[_0x7332('0x1b')](_0x112b41);return _0x6133b3[_0x7332('0x20')](_0x7332('0x21'),_0x295058+'-'+_0x5a3201+'/'+_0x3887c5)['json'](_0xe547df);}return null;};}function patchUpdates(_0x23c71b){return function(_0x234f99){try{jsonpatch[_0x7332('0x22')](_0x234f99,_0x23c71b,!![]);}catch(_0x58ba3f){return BPromise[_0x7332('0x23')](_0x58ba3f);}return _0x234f99[_0x7332('0x24')]();};}function saveUpdates(_0xd74d75,_0x3512a2){return function(_0x5667ed){if(_0x5667ed){return _0x5667ed[_0x7332('0x25')](_0xd74d75)['then'](function(_0x1e8ad1){return _0x1e8ad1;});}return null;};}function removeEntity(_0x31aff5,_0x4a76b7){return function(_0xe3e3ea){if(_0xe3e3ea){return _0xe3e3ea[_0x7332('0x26')]()[_0x7332('0x27')](function(){_0x31aff5[_0x7332('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126461,_0x35d99e){return function(_0x4703cc){if(!_0x4703cc){_0x126461[_0x7332('0x1a')](0x194);}return _0x4703cc;};}function handleError(_0x31b90f,_0x4f7b76){_0x4f7b76=_0x4f7b76||0x1f4;return function(_0x5b66c1){logger[_0x7332('0x28')](_0x5b66c1['stack']);if(_0x5b66c1['name']){delete _0x5b66c1[_0x7332('0x29')];}_0x31b90f[_0x7332('0x1b')](_0x4f7b76)[_0x7332('0x2a')](_0x5b66c1);};}exports[_0x7332('0x2b')]=function(_0x39460c,_0x3a797f){var _0x2ef4d7={},_0x51dafe={},_0x470bb0={'count':0x0,'rows':[]};var _0xd2a5bb=_[_0x7332('0x2c')](db[_0x7332('0x2d')][_0x7332('0x2e')],function(_0x22b973){return{'name':_0x22b973['fieldName'],'type':_0x22b973[_0x7332('0x2f')][_0x7332('0x30')]};});_0x51dafe[_0x7332('0x31')]=_[_0x7332('0x2c')](_0xd2a5bb,_0x7332('0x29'));_0x51dafe['query']=_[_0x7332('0x32')](_0x39460c[_0x7332('0x33')]);_0x51dafe['filters']=_[_0x7332('0x34')](_0x51dafe['model'],_0x51dafe[_0x7332('0x33')]);_0x2ef4d7[_0x7332('0x35')]=_[_0x7332('0x34')](_0x51dafe[_0x7332('0x31')],qs[_0x7332('0x36')](_0x39460c[_0x7332('0x33')]['fields']));_0x2ef4d7[_0x7332('0x35')]=_0x2ef4d7[_0x7332('0x35')][_0x7332('0x37')]?_0x2ef4d7[_0x7332('0x35')]:_0x51dafe['model'];if(!_0x39460c[_0x7332('0x33')][_0x7332('0x38')]('nolimit')){_0x2ef4d7[_0x7332('0x1f')]=qs['limit'](_0x39460c['query'][_0x7332('0x1f')]);_0x2ef4d7[_0x7332('0x1e')]=qs[_0x7332('0x1e')](_0x39460c[_0x7332('0x33')][_0x7332('0x1e')]);}_0x2ef4d7[_0x7332('0x39')]=qs[_0x7332('0x3a')](_0x39460c[_0x7332('0x33')][_0x7332('0x3a')]);_0x2ef4d7[_0x7332('0x3b')]=qs[_0x7332('0x3c')](_[_0x7332('0x3d')](_0x39460c[_0x7332('0x33')],_0x51dafe[_0x7332('0x3c')]),_0xd2a5bb);if(_0x39460c[_0x7332('0x33')][_0x7332('0x3e')]){_0x2ef4d7['where']=_['merge'](_0x2ef4d7[_0x7332('0x3b')],{'$or':_[_0x7332('0x2c')](_0xd2a5bb,function(_0x3e32f2){if(_0x3e32f2['type']!=='VIRTUAL'){var _0x514ca1={};_0x514ca1[_0x3e32f2[_0x7332('0x29')]]={'$like':'%'+_0x39460c[_0x7332('0x33')][_0x7332('0x3e')]+'%'};return _0x514ca1;}})});}_0x2ef4d7=_['merge']({},_0x2ef4d7,_0x39460c[_0x7332('0x3f')]);var _0x100808={'where':_0x2ef4d7[_0x7332('0x3b')]};return db[_0x7332('0x2d')][_0x7332('0x1d')](_0x100808)['then'](function(_0x3d1446){_0x470bb0[_0x7332('0x1d')]=_0x3d1446;if(_0x39460c[_0x7332('0x33')][_0x7332('0x40')]){_0x2ef4d7[_0x7332('0x41')]=[{'all':!![]}];}return db[_0x7332('0x2d')][_0x7332('0x42')](_0x2ef4d7);})[_0x7332('0x27')](function(_0x3c722f){_0x470bb0[_0x7332('0x43')]=_0x3c722f;return _0x470bb0;})['then'](respondWithFilteredResult(_0x3a797f,_0x2ef4d7))[_0x7332('0x44')](handleError(_0x3a797f,null));};exports[_0x7332('0x45')]=function(_0x1544de,_0x580b1c){var _0xea395b={'raw':!![],'where':{'id':_0x1544de[_0x7332('0x46')]['id']}},_0xd6c12b={};_0xd6c12b[_0x7332('0x31')]=_['keys'](db[_0x7332('0x2d')]['rawAttributes']);_0xd6c12b['query']=_[_0x7332('0x32')](_0x1544de['query']);_0xd6c12b[_0x7332('0x3c')]=_[_0x7332('0x34')](_0xd6c12b['model'],_0xd6c12b[_0x7332('0x33')]);_0xea395b[_0x7332('0x35')]=_[_0x7332('0x34')](_0xd6c12b['model'],qs['fields'](_0x1544de['query'][_0x7332('0x36')]));_0xea395b[_0x7332('0x35')]=_0xea395b[_0x7332('0x35')][_0x7332('0x37')]?_0xea395b[_0x7332('0x35')]:_0xd6c12b[_0x7332('0x31')];if(_0x1544de[_0x7332('0x33')]['includeAll']){_0xea395b[_0x7332('0x41')]=[{'all':!![]}];}_0xea395b=_['merge']({},_0xea395b,_0x1544de[_0x7332('0x3f')]);return db[_0x7332('0x2d')][_0x7332('0x47')](_0xea395b)[_0x7332('0x27')](handleEntityNotFound(_0x580b1c,null))['then'](respondWithResult(_0x580b1c,null))[_0x7332('0x44')](handleError(_0x580b1c,null));};exports['create']=function(_0x440536,_0x476a84){return db[_0x7332('0x2d')][_0x7332('0x48')](_0x440536['body'],{})[_0x7332('0x27')](respondWithResult(_0x476a84,0xc9))[_0x7332('0x44')](handleError(_0x476a84,null));};exports[_0x7332('0x25')]=function(_0x388ac2,_0x439d2d){if(_0x388ac2[_0x7332('0x49')]['id']){delete _0x388ac2['body']['id'];}return db[_0x7332('0x2d')]['find']({'where':{'id':_0x388ac2[_0x7332('0x46')]['id']}})['then'](handleEntityNotFound(_0x439d2d,null))[_0x7332('0x27')](saveUpdates(_0x388ac2[_0x7332('0x49')],null))[_0x7332('0x27')](respondWithResult(_0x439d2d,null))[_0x7332('0x44')](handleError(_0x439d2d,null));};exports[_0x7332('0x26')]=function(_0xccd078,_0x21c45d){return db[_0x7332('0x2d')][_0x7332('0x47')]({'where':{'id':_0xccd078['params']['id']}})[_0x7332('0x27')](handleEntityNotFound(_0x21c45d,null))[_0x7332('0x27')](removeEntity(_0x21c45d,null))[_0x7332('0x44')](handleError(_0x21c45d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 3f2f263..36a8364 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 _0x6487=['./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e1387,_0x2fd52a){var _0xda65a6=function(_0x59d3f5){while(--_0x59d3f5){_0x2e1387['push'](_0x2e1387['shift']());}};_0xda65a6(++_0x2fd52a);}(_0x6487,0x1ab));var _0x7648=function(_0x45c1a9,_0x15905f){_0x45c1a9=_0x45c1a9-0x0;var _0x3575fb=_0x6487[_0x45c1a9];return _0x3575fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7648('0x0'))(_0x7648('0x1'));var moment=require(_0x7648('0x2'));var BPromise=require(_0x7648('0x3'));var rp=require(_0x7648('0x4'));var fs=require('fs');var path=require(_0x7648('0x5'));var rimraf=require(_0x7648('0x6'));var config=require('../../config/environment');var attributes=require(_0x7648('0x7'));module[_0x7648('0x8')]=function(_0x5c8878,_0x1f9604){return _0x5c8878[_0x7648('0x9')](_0x7648('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x7648('0xb'),'fields':[_0x7648('0xc'),_0x7648('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc15f=['desk_unique_index','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','DeskField','int_desk_fields'];(function(_0x210d57,_0x280153){var _0x32a96a=function(_0xbc7a8a){while(--_0xbc7a8a){_0x210d57['push'](_0x210d57['shift']());}};_0x32a96a(++_0x280153);}(_0xc15f,0x113));var _0xfc15=function(_0x121d9e,_0x11b966){_0x121d9e=_0x121d9e-0x0;var _0x5df466=_0xc15f[_0x121d9e];return _0x5df466;};'use strict';var _=require(_0xfc15('0x0'));var util=require(_0xfc15('0x1'));var logger=require('../../config/logger')(_0xfc15('0x2'));var moment=require('moment');var BPromise=require(_0xfc15('0x3'));var rp=require(_0xfc15('0x4'));var fs=require('fs');var path=require(_0xfc15('0x5'));var rimraf=require(_0xfc15('0x6'));var config=require(_0xfc15('0x7'));var attributes=require('./intDeskField.attributes');module[_0xfc15('0x8')]=function(_0x469df3,_0x338e23){return _0x469df3['define'](_0xfc15('0x9'),attributes,{'tableName':_0xfc15('0xa'),'paranoid':![],'indexes':[{'name':_0xfc15('0xb'),'fields':['idField',_0xfc15('0xc')],'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 a3d1c9c..1a83002 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 _0xe60d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xe60d,0x15e));var _0xde60=function(_0x3334f3,_0x499459){_0x3334f3=_0x3334f3-0x0;var _0x65728b=_0xe60d[_0x3334f3];return _0x65728b;};'use strict';var _=require(_0xde60('0x0'));var util=require(_0xde60('0x1'));var moment=require(_0xde60('0x2'));var BPromise=require(_0xde60('0x3'));var rs=require(_0xde60('0x4'));var fs=require('fs');var Redis=require(_0xde60('0x5'));var db=require(_0xde60('0x6'))['db'];var utils=require(_0xde60('0x7'));var logger=require('../../config/logger')(_0xde60('0x8'));var config=require(_0xde60('0x9'));var jayson=require(_0xde60('0xa'));var client=jayson[_0xde60('0xb')][_0xde60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1207f9,_0x1413cd,_0x32ec36){return new BPromise(function(_0x6c262c,_0xd57521){return client[_0xde60('0xd')](_0x1207f9,_0x32ec36)['then'](function(_0x7136c6){logger[_0xde60('0xe')](_0xde60('0xf'),_0x1413cd,'request\x20sent');logger[_0xde60('0x10')](_0xde60('0x11'),_0x1413cd,_0xde60('0x12'),JSON[_0xde60('0x13')](_0x7136c6));if(_0x7136c6[_0xde60('0x14')]){if(_0x7136c6[_0xde60('0x14')][_0xde60('0x15')]===0x1f4){logger[_0xde60('0x14')](_0xde60('0xf'),_0x1413cd,_0x7136c6[_0xde60('0x14')][_0xde60('0x16')]);return _0xd57521(_0x7136c6[_0xde60('0x14')]['message']);}logger[_0xde60('0x14')](_0xde60('0xf'),_0x1413cd,_0x7136c6['error'][_0xde60('0x16')]);return _0x6c262c(_0x7136c6[_0xde60('0x14')][_0xde60('0x16')]);}else{logger[_0xde60('0xe')](_0xde60('0xf'),_0x1413cd,_0xde60('0x12'));_0x6c262c(_0x7136c6[_0xde60('0x17')][_0xde60('0x16')]);}})[_0xde60('0x18')](function(_0x4f463a){logger[_0xde60('0x14')](_0xde60('0xf'),_0x1413cd,_0x4f463a);_0xd57521(_0x4f463a);});});} \ No newline at end of file +var _0xe290=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f2b69,_0x32d77c){var _0x403a95=function(_0x1a2fe3){while(--_0x1a2fe3){_0x1f2b69['push'](_0x1f2b69['shift']());}};_0x403a95(++_0x32d77c);}(_0xe290,0x10a));var _0x0e29=function(_0x527dc5,_0x1de7e7){_0x527dc5=_0x527dc5-0x0;var _0x216de9=_0xe290[_0x527dc5];return _0x216de9;};'use strict';var _=require('lodash');var util=require(_0x0e29('0x0'));var moment=require(_0x0e29('0x1'));var BPromise=require(_0x0e29('0x2'));var rs=require(_0x0e29('0x3'));var fs=require('fs');var Redis=require(_0x0e29('0x4'));var db=require(_0x0e29('0x5'))['db'];var utils=require(_0x0e29('0x6'));var logger=require(_0x0e29('0x7'))(_0x0e29('0x8'));var config=require('../../config/environment');var jayson=require(_0x0e29('0x9'));var client=jayson[_0x0e29('0xa')][_0x0e29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18c7d1,_0x62c112,_0x20c89b){return new BPromise(function(_0x49cb82,_0x191655){return client['request'](_0x18c7d1,_0x20c89b)['then'](function(_0x1d92dc){logger[_0x0e29('0xc')](_0x0e29('0xd'),_0x62c112,_0x0e29('0xe'));logger[_0x0e29('0xf')](_0x0e29('0x10'),_0x62c112,'request\x20sent',JSON[_0x0e29('0x11')](_0x1d92dc));if(_0x1d92dc['error']){if(_0x1d92dc[_0x0e29('0x12')][_0x0e29('0x13')]===0x1f4){logger[_0x0e29('0x12')](_0x0e29('0xd'),_0x62c112,_0x1d92dc[_0x0e29('0x12')]['message']);return _0x191655(_0x1d92dc[_0x0e29('0x12')][_0x0e29('0x14')]);}logger['error'](_0x0e29('0xd'),_0x62c112,_0x1d92dc['error'][_0x0e29('0x14')]);return _0x49cb82(_0x1d92dc['error'][_0x0e29('0x14')]);}else{logger[_0x0e29('0xc')](_0x0e29('0xd'),_0x62c112,_0x0e29('0xe'));_0x49cb82(_0x1d92dc[_0x0e29('0x15')][_0x0e29('0x14')]);}})['catch'](function(_0x44dc40){logger[_0x0e29('0x12')](_0x0e29('0xd'),_0x62c112,_0x44dc40);_0x191655(_0x44dc40);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 5eafb91..5150561 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 _0x5bb5=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x13926c,_0x42a62e){var _0x3bb434=function(_0x50af59){while(--_0x50af59){_0x13926c['push'](_0x13926c['shift']());}};_0x3bb434(++_0x42a62e);}(_0x5bb5,0x103));var _0x55bb=function(_0x514350,_0x5beac8){_0x514350=_0x514350-0x0;var _0x1c89d7=_0x5bb5[_0x514350];return _0x1c89d7;};'use strict';var multer=require(_0x55bb('0x0'));var util=require(_0x55bb('0x1'));var path=require(_0x55bb('0x2'));var timeout=require(_0x55bb('0x3'));var express=require(_0x55bb('0x4'));var router=express['Router']();var auth=require(_0x55bb('0x5'));var interaction=require(_0x55bb('0x6'));var config=require(_0x55bb('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x55bb('0x8')]('/',auth[_0x55bb('0x9')](),controller[_0x55bb('0xa')]);router[_0x55bb('0x8')](_0x55bb('0xb'),auth[_0x55bb('0x9')](),controller[_0x55bb('0xc')]);router[_0x55bb('0x8')](_0x55bb('0xd'),auth[_0x55bb('0x9')](),controller[_0x55bb('0xe')]);router['get'](_0x55bb('0xf'),auth['isAuthenticated'](),controller[_0x55bb('0x10')]);router[_0x55bb('0x11')]('/',auth[_0x55bb('0x9')](),controller[_0x55bb('0x12')]);router[_0x55bb('0x11')](_0x55bb('0xd'),auth[_0x55bb('0x9')](),controller[_0x55bb('0x13')]);router[_0x55bb('0x14')]('/:id',auth[_0x55bb('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x73a0=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','create','post','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xbec504,_0x223b6c){var _0x511fdb=function(_0x24d887){while(--_0x24d887){_0xbec504['push'](_0xbec504['shift']());}};_0x511fdb(++_0x223b6c);}(_0x73a0,0xca));var _0x073a=function(_0x165931,_0x255e9d){_0x165931=_0x165931-0x0;var _0x581f92=_0x73a0[_0x165931];return _0x581f92;};'use strict';var multer=require(_0x073a('0x0'));var util=require(_0x073a('0x1'));var path=require(_0x073a('0x2'));var timeout=require(_0x073a('0x3'));var express=require('express');var router=express[_0x073a('0x4')]();var auth=require(_0x073a('0x5'));var interaction=require(_0x073a('0x6'));var config=require(_0x073a('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x073a('0x8')]('/',auth[_0x073a('0x9')](),controller[_0x073a('0xa')]);router[_0x073a('0x8')](_0x073a('0xb'),auth[_0x073a('0x9')](),controller[_0x073a('0xc')]);router[_0x073a('0x8')](_0x073a('0xd'),auth[_0x073a('0x9')](),controller['getConfigurations']);router[_0x073a('0x8')]('/:id/fields',auth[_0x073a('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x073a('0xe')]);router[_0x073a('0xf')](_0x073a('0xd'),auth[_0x073a('0x9')](),controller['addConfiguration']);router[_0x073a('0x10')](_0x073a('0xb'),auth[_0x073a('0x9')](),controller['update']);router[_0x073a('0x11')]('/:id',auth[_0x073a('0x9')](),controller[_0x073a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d45b186..9b657b2 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 _0x1bdd=['STRING'];(function(_0x2c26a0,_0x2b9577){var _0x3e26d2=function(_0xcd6fc5){while(--_0xcd6fc5){_0x2c26a0['push'](_0x2c26a0['shift']());}};_0x3e26d2(++_0x2b9577);}(_0x1bdd,0x166));var _0xd1bd=function(_0x35ed0c,_0x474766){_0x35ed0c=_0x35ed0c-0x0;var _0x40a02c=_0x1bdd[_0x35ed0c];return _0x40a02c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd1bd('0x0')]},'password':{'type':Sequelize[_0xd1bd('0x0')]},'remoteUri':{'type':Sequelize[_0xd1bd('0x0')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd1bd('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd1bd('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcea9=['STRING','sequelize','exports'];(function(_0x472573,_0xa37628){var _0x3982e6=function(_0x2aeb57){while(--_0x2aeb57){_0x472573['push'](_0x472573['shift']());}};_0x3982e6(++_0xa37628);}(_0xcea9,0x97));var _0x9cea=function(_0x4e50f4,_0x3b3fd6){_0x4e50f4=_0x4e50f4-0x0;var _0x566cc0=_0xcea9[_0x4e50f4];return _0x566cc0;};'use strict';var Sequelize=require(_0x9cea('0x0'));module[_0x9cea('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9cea('0x2')]},'password':{'type':Sequelize[_0x9cea('0x2')]},'remoteUri':{'type':Sequelize[_0x9cea('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9cea('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9cea('0x2')]},'description':{'type':Sequelize[_0x9cea('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c28670a..9cd8dc1 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 _0x2daf=['Dynamics365Field','Descriptions','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','concat','username','password','remoteUri','tenantId','clientSecret','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','GET','Bearer\x20','4.0','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','substring','PicklistAttributeMetadata','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','LogicalName','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','request','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','json','count','offset','set','Content-Range','reject','save','update','then','stack','name','status','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','order','AccountId','Subjects','getSubjects','channel','getDescriptions'];(function(_0x55a529,_0x49a10a){var _0x188595=function(_0x3c8e61){while(--_0x3c8e61){_0x55a529['push'](_0x55a529['shift']());}};_0x188595(++_0x49a10a);}(_0x2daf,0x78));var _0xf2da=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x2daf[_0x43f881];return _0x365c14;};'use strict';var pdf=require(_0xf2da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf2da('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2da('0x2'));var rp=require(_0xf2da('0x3'));var moment=require(_0xf2da('0x4'));var BPromise=require(_0xf2da('0x5'));var Mustache=require('mustache');var util=require(_0xf2da('0x6'));var path=require('path');var sox=require(_0xf2da('0x7'));var csv=require(_0xf2da('0x8'));var ejs=require(_0xf2da('0x9'));var fs=require('fs');var _=require(_0xf2da('0xa'));var squel=require('squel');var crypto=require(_0xf2da('0xb'));var jsforce=require(_0xf2da('0xc'));var deskjs=require(_0xf2da('0xd'));var toCsv=require(_0xf2da('0x8'));var querystring=require(_0xf2da('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf2da('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf2da('0x10'));var hardwareService=require(_0xf2da('0x11'));var logger=require(_0xf2da('0x12'))(_0xf2da('0x13'));var utils=require(_0xf2da('0x14'));var config=require(_0xf2da('0x15'));var db=require(_0xf2da('0x16'))['db'];var integrations=require(_0xf2da('0x17'));var jayson=require(_0xf2da('0x18'));var client=jayson['client'][_0xf2da('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4f16b9,_0x169a58,_0x2793ca){if(_0x2793ca){var _0x31ed08=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31ed08[_0xf2da('0x1a')](_0x169a58)){return _0x4f16b9;}else{throw new db[(_0xf2da('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 _0x4f16b9;}}function respondWithRpcPromise(_0x57bc6f,_0x5ae9fa,_0x152a30,_0x568ffc){return new BPromise(function(_0x5ee3e4,_0x4d53f2){var _0x5d733a=_0x568ffc||client;return _0x5d733a[_0xf2da('0x1c')](_0x57bc6f,_0x152a30)['then'](function(_0x25e79b){logger['info'](_0xf2da('0x1d'),_0x5ae9fa,_0xf2da('0x1e'));logger[_0xf2da('0x1f')](_0xf2da('0x20'),_0x5ae9fa,'request\x20sent',JSON[_0xf2da('0x21')](_0x25e79b));if(_0x25e79b[_0xf2da('0x22')]){if(_0x25e79b[_0xf2da('0x22')][_0xf2da('0x23')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5ae9fa,_0x25e79b[_0xf2da('0x22')][_0xf2da('0x24')]);return _0x4d53f2(_0x25e79b[_0xf2da('0x22')]['message']);}logger['error'](_0xf2da('0x1d'),_0x5ae9fa,_0x25e79b['error'][_0xf2da('0x24')]);return _0x5ee3e4(_0x25e79b[_0xf2da('0x22')][_0xf2da('0x24')]);}else{logger[_0xf2da('0x25')](_0xf2da('0x1d'),_0x5ae9fa,_0xf2da('0x1e'));_0x5ee3e4(_0x25e79b['result'][_0xf2da('0x24')]);}})[_0xf2da('0x26')](function(_0x16831){logger[_0xf2da('0x22')](_0xf2da('0x1d'),_0x5ae9fa,_0x16831);_0x4d53f2(_0x16831);});});}function respondWithStatusCode(_0x1d1c48,_0x24ffcd){_0x24ffcd=_0x24ffcd||0xcc;return function(_0x2c9e65){if(_0x2c9e65){return _0x1d1c48[_0xf2da('0x27')](_0x24ffcd);}return _0x1d1c48['status'](_0x24ffcd)[_0xf2da('0x28')]();};}function respondWithResult(_0x391f4b,_0x2fe6a4){_0x2fe6a4=_0x2fe6a4||0xc8;return function(_0x3e7cd5){if(_0x3e7cd5){return _0x391f4b['status'](_0x2fe6a4)[_0xf2da('0x29')](_0x3e7cd5);}};}function respondWithFilteredResult(_0x47a9f7,_0x309f8e){return function(_0xc5ff81){if(_0xc5ff81){var _0x5bb04f=_0xc5ff81[_0xf2da('0x2a')],_0x31ee78=_0x309f8e[_0xf2da('0x2b')],_0x1b33d7=_0x309f8e[_0xf2da('0x2b')]+_0x309f8e['limit'],_0x540447;if(_0x1b33d7>=_0x5bb04f){_0x1b33d7=_0x5bb04f;_0x540447=0xc8;}else{_0x540447=0xce;}_0x47a9f7['status'](_0x540447);return _0x47a9f7[_0xf2da('0x2c')](_0xf2da('0x2d'),_0x31ee78+'-'+_0x1b33d7+'/'+_0x5bb04f)[_0xf2da('0x29')](_0xc5ff81);}return null;};}function patchUpdates(_0x3cd482){return function(_0x5dd449){try{jsonpatch['apply'](_0x5dd449,_0x3cd482,!![]);}catch(_0x1c476e){return BPromise[_0xf2da('0x2e')](_0x1c476e);}return _0x5dd449[_0xf2da('0x2f')]();};}function saveUpdates(_0xc59045,_0x3b7d4d){return function(_0x44840c){if(_0x44840c){return _0x44840c[_0xf2da('0x30')](_0xc59045)[_0xf2da('0x31')](function(_0x495f98){return _0x495f98;});}return null;};}function removeEntity(_0x11c42c,_0x42c1b2){return function(_0x54c03a){if(_0x54c03a){return _0x54c03a['destroy']()[_0xf2da('0x31')](function(){_0x11c42c['status'](0xcc)[_0xf2da('0x28')]();});}};}function handleEntityNotFound(_0x1251db,_0x2c6ba5){return function(_0x3b9914){if(!_0x3b9914){_0x1251db[_0xf2da('0x27')](0x194);}return _0x3b9914;};}function handleError(_0x19ac3d,_0x4aacae){_0x4aacae=_0x4aacae||0x1f4;return function(_0x37e447){logger['error'](_0x37e447[_0xf2da('0x32')]);if(_0x37e447[_0xf2da('0x33')]){delete _0x37e447[_0xf2da('0x33')];}_0x19ac3d[_0xf2da('0x34')](_0x4aacae)[_0xf2da('0x35')](_0x37e447);};}exports['index']=function(_0x436686,_0x33f02f){var _0x2d3e07={},_0x457d4f={},_0x497314={'count':0x0,'rows':[]};var _0x80d43a=_[_0xf2da('0x36')](db[_0xf2da('0x37')][_0xf2da('0x38')],function(_0x400139){return{'name':_0x400139[_0xf2da('0x39')],'type':_0x400139[_0xf2da('0x3a')][_0xf2da('0x3b')]};});_0x457d4f['model']=_[_0xf2da('0x36')](_0x80d43a,'name');_0x457d4f[_0xf2da('0x3c')]=_[_0xf2da('0x3d')](_0x436686[_0xf2da('0x3c')]);_0x457d4f['filters']=_[_0xf2da('0x3e')](_0x457d4f[_0xf2da('0x3f')],_0x457d4f['query']);_0x2d3e07['attributes']=_[_0xf2da('0x3e')](_0x457d4f[_0xf2da('0x3f')],qs[_0xf2da('0x40')](_0x436686[_0xf2da('0x3c')][_0xf2da('0x40')]));_0x2d3e07[_0xf2da('0x41')]=_0x2d3e07['attributes'][_0xf2da('0x42')]?_0x2d3e07[_0xf2da('0x41')]:_0x457d4f['model'];if(!_0x436686[_0xf2da('0x3c')][_0xf2da('0x43')](_0xf2da('0x44'))){_0x2d3e07['limit']=qs[_0xf2da('0x45')](_0x436686['query'][_0xf2da('0x45')]);_0x2d3e07[_0xf2da('0x2b')]=qs[_0xf2da('0x2b')](_0x436686['query'][_0xf2da('0x2b')]);}_0x2d3e07['order']=qs[_0xf2da('0x46')](_0x436686['query'][_0xf2da('0x46')]);_0x2d3e07['where']=qs[_0xf2da('0x47')](_[_0xf2da('0x48')](_0x436686['query'],_0x457d4f[_0xf2da('0x47')]),_0x80d43a);if(_0x436686[_0xf2da('0x3c')][_0xf2da('0x49')]){_0x2d3e07[_0xf2da('0x4a')]=_[_0xf2da('0x4b')](_0x2d3e07['where'],{'$or':_[_0xf2da('0x36')](_0x80d43a,function(_0x4e1947){if(_0x4e1947[_0xf2da('0x3a')]!==_0xf2da('0x4c')){var _0x3b8454={};_0x3b8454[_0x4e1947[_0xf2da('0x33')]]={'$like':'%'+_0x436686[_0xf2da('0x3c')][_0xf2da('0x49')]+'%'};return _0x3b8454;}})});}_0x2d3e07=_['merge']({},_0x2d3e07,_0x436686[_0xf2da('0x4d')]);var _0x275bad={'where':_0x2d3e07[_0xf2da('0x4a')]};return db[_0xf2da('0x37')][_0xf2da('0x2a')](_0x275bad)[_0xf2da('0x31')](function(_0x5c88f6){_0x497314[_0xf2da('0x2a')]=_0x5c88f6;if(_0x436686[_0xf2da('0x3c')]['includeAll']){_0x2d3e07['include']=[{'all':!![]}];}return db[_0xf2da('0x37')][_0xf2da('0x4e')](_0x2d3e07);})[_0xf2da('0x31')](function(_0xebfb45){_0x497314[_0xf2da('0x4f')]=_0xebfb45;return _0x497314;})[_0xf2da('0x31')](respondWithFilteredResult(_0x33f02f,_0x2d3e07))['catch'](handleError(_0x33f02f,null));};exports[_0xf2da('0x50')]=function(_0x4ccc59,_0x29d9a4){var _0x3ed85d={'raw':![],'where':{'id':_0x4ccc59[_0xf2da('0x51')]['id']}},_0x4ee4d2={};_0x4ee4d2[_0xf2da('0x3f')]=_[_0xf2da('0x3d')](db[_0xf2da('0x37')]['rawAttributes']);_0x4ee4d2[_0xf2da('0x3c')]=_[_0xf2da('0x3d')](_0x4ccc59[_0xf2da('0x3c')]);_0x4ee4d2[_0xf2da('0x47')]=_[_0xf2da('0x3e')](_0x4ee4d2[_0xf2da('0x3f')],_0x4ee4d2[_0xf2da('0x3c')]);_0x3ed85d[_0xf2da('0x41')]=_['intersection'](_0x4ee4d2['model'],qs['fields'](_0x4ccc59[_0xf2da('0x3c')][_0xf2da('0x40')]));_0x3ed85d[_0xf2da('0x41')]=_0x3ed85d[_0xf2da('0x41')]['length']?_0x3ed85d[_0xf2da('0x41')]:_0x4ee4d2[_0xf2da('0x3f')];if(_0x4ccc59[_0xf2da('0x3c')][_0xf2da('0x52')]){_0x3ed85d[_0xf2da('0x53')]=[{'all':!![]}];}_0x3ed85d=_['merge']({},_0x3ed85d,_0x4ccc59[_0xf2da('0x4d')]);return db[_0xf2da('0x37')][_0xf2da('0x54')](_0x3ed85d)[_0xf2da('0x31')](handleEntityNotFound(_0x29d9a4,null))['then'](respondWithResult(_0x29d9a4,null))[_0xf2da('0x26')](handleError(_0x29d9a4,null));};exports[_0xf2da('0x55')]=function(_0x587fc4,_0x4a6698){return db[_0xf2da('0x37')][_0xf2da('0x55')](_0x587fc4[_0xf2da('0x56')],{})[_0xf2da('0x31')](respondWithResult(_0x4a6698,0xc9))[_0xf2da('0x26')](handleError(_0x4a6698,null));};exports[_0xf2da('0x30')]=function(_0x504434,_0x25ed73){if(_0x504434[_0xf2da('0x56')]['id']){delete _0x504434['body']['id'];}return db[_0xf2da('0x37')][_0xf2da('0x54')]({'where':{'id':_0x504434[_0xf2da('0x51')]['id']}})[_0xf2da('0x31')](handleEntityNotFound(_0x25ed73,null))['then'](saveUpdates(_0x504434[_0xf2da('0x56')],null))[_0xf2da('0x31')](respondWithResult(_0x25ed73,null))[_0xf2da('0x26')](handleError(_0x25ed73,null));};exports[_0xf2da('0x57')]=function(_0x50b778,_0x4ede0d){return db[_0xf2da('0x37')][_0xf2da('0x54')]({'where':{'id':_0x50b778['params']['id']}})['then'](handleEntityNotFound(_0x4ede0d,null))['then'](removeEntity(_0x4ede0d,null))[_0xf2da('0x26')](handleError(_0x4ede0d,null));};exports[_0xf2da('0x58')]=function(_0x19c692,_0x430046,_0x8148ce){var _0x310dff={};var _0x13d2f2={};var _0x531414;var _0x4c1496;return db['Dynamics365Account'][_0xf2da('0x59')]({'where':{'id':_0x19c692[_0xf2da('0x51')]['id']}})['then'](handleEntityNotFound(_0x430046,null))['then'](function(_0x4f7f96){if(_0x4f7f96){_0x531414=_0x4f7f96;_0x13d2f2[_0xf2da('0x3f')]=_[_0xf2da('0x3d')](db[_0xf2da('0x5a')][_0xf2da('0x38')]);_0x13d2f2['query']=_[_0xf2da('0x3d')](_0x19c692[_0xf2da('0x3c')]);_0x13d2f2['filters']=_['intersection'](_0x13d2f2[_0xf2da('0x3f')],_0x13d2f2[_0xf2da('0x3c')]);_0x310dff[_0xf2da('0x41')]=_[_0xf2da('0x3e')](_0x13d2f2['model'],qs[_0xf2da('0x40')](_0x19c692[_0xf2da('0x3c')][_0xf2da('0x40')]));_0x310dff[_0xf2da('0x41')]=_0x310dff[_0xf2da('0x41')][_0xf2da('0x42')]?_0x310dff['attributes']:_0x13d2f2['model'];_0x310dff[_0xf2da('0x5b')]=qs[_0xf2da('0x46')](_0x19c692[_0xf2da('0x3c')]['sort']);_0x310dff['where']=qs[_0xf2da('0x47')](_['pick'](_0x19c692[_0xf2da('0x3c')],_0x13d2f2['filters']));if(_0x19c692['query'][_0xf2da('0x49')]){_0x310dff[_0xf2da('0x4a')]=_[_0xf2da('0x4b')](_0x310dff[_0xf2da('0x4a')],{'$or':_[_0xf2da('0x36')](_0x310dff['attributes'],function(_0xde241e){var _0x35c73b={};_0x35c73b[_0xde241e]={'$like':'%'+_0x19c692['query'][_0xf2da('0x49')]+'%'};return _0x35c73b;})});}_0x310dff=_[_0xf2da('0x4b')]({},_0x310dff,_0x19c692['options']);return _0x531414[_0xf2da('0x58')](_0x310dff);}})[_0xf2da('0x31')](function(_0x3fe916){if(_0x3fe916){_0x4c1496=_0x3fe916[_0xf2da('0x42')];if(!_0x19c692[_0xf2da('0x3c')][_0xf2da('0x43')]('nolimit')){_0x310dff[_0xf2da('0x45')]=qs[_0xf2da('0x45')](_0x19c692[_0xf2da('0x3c')][_0xf2da('0x45')]);_0x310dff['offset']=qs[_0xf2da('0x2b')](_0x19c692[_0xf2da('0x3c')]['offset']);}return _0x531414[_0xf2da('0x58')](_0x310dff);}})[_0xf2da('0x31')](function(_0x31810b){if(_0x31810b){return _0x31810b?{'count':_0x4c1496,'rows':_0x31810b}:null;}})[_0xf2da('0x31')](respondWithResult(_0x430046,null))[_0xf2da('0x26')](handleError(_0x430046,null));};exports['addConfiguration']=function(_0x40aaf1,_0x2ea3ac,_0x3c5084){if(_0x40aaf1[_0xf2da('0x56')]['id']){delete _0x40aaf1[_0xf2da('0x56')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x40aaf1[_0xf2da('0x51')]['id']}})[_0xf2da('0x31')](handleEntityNotFound(_0x2ea3ac,null))['then'](function(_0x431003){if(_0x431003){_0x40aaf1[_0xf2da('0x56')][_0xf2da('0x5c')]=_0x431003['id'];_0x40aaf1[_0xf2da('0x56')][_0xf2da('0x5d')]=integrations[_0xf2da('0x5e')](_0x40aaf1[_0xf2da('0x56')][_0xf2da('0x5f')],_0x40aaf1[_0xf2da('0x56')][_0xf2da('0x3a')]);_0x40aaf1[_0xf2da('0x56')]['Descriptions']=integrations[_0xf2da('0x60')](_0x40aaf1[_0xf2da('0x56')][_0xf2da('0x5f')],_0x40aaf1[_0xf2da('0x56')][_0xf2da('0x3a')]);return db['Dynamics365Configuration']['create'](_0x40aaf1['body'],{'include':[{'model':db[_0xf2da('0x61')],'as':_0xf2da('0x5d')},{'model':db[_0xf2da('0x61')],'as':_0xf2da('0x62')}]});}return null;})['then'](respondWithResult(_0x2ea3ac,null))[_0xf2da('0x26')](handleError(_0x2ea3ac,null));};exports['getFields']=function(_0x16ff8f,_0x526db7,_0x26d2a2){var _0x431676=_0x16ff8f[_0xf2da('0x3c')][_0xf2da('0x63')];var _0x4686ad=_0x431676===_0xf2da('0x64')?_0xf2da('0x65'):_0xf2da('0x66');var _0x138189='';var _0x14adef='';var _0x5a246e='';var _0x3e957c='';var _0x25d4a8='';var _0x52c71c='';var _0x2d37fb='';var _0xdd8802='';var _0x23116f=['title',_0xf2da('0x67'),_0xf2da('0x68'),_0xf2da('0x69'),_0xf2da('0x6a'),_0xf2da('0x6b'),_0xf2da('0x6c'),_0xf2da('0x6d'),_0xf2da('0x6e'),_0xf2da('0x6f')];var _0x2a5aa3=[_0xf2da('0x70'),_0xf2da('0x71'),_0xf2da('0x72'),_0xf2da('0x73'),'contactidname',_0xf2da('0x74'),'contractdetailidname',_0xf2da('0x75'),_0xf2da('0x76'),_0xf2da('0x77'),'createdbyname',_0xf2da('0x78'),_0xf2da('0x79'),'createdonbehalfbyname',_0xf2da('0x7a'),_0xf2da('0x7b'),_0xf2da('0x7c'),_0xf2da('0x7d'),'emailaddress',_0xf2da('0x7e'),_0xf2da('0x7f'),_0xf2da('0x80'),'escalatedon',_0xf2da('0x81'),'firstresponsebykpiidname','followupby',_0xf2da('0x82'),_0xf2da('0x83'),_0xf2da('0x84'),_0xf2da('0x85'),_0xf2da('0x86'),_0xf2da('0x87'),_0xf2da('0x88'),_0xf2da('0x89'),_0xf2da('0x8a'),'modifiedon',_0xf2da('0x8b'),_0xf2da('0x8c'),_0xf2da('0x8d'),'msdyn_iotalertname','numberofchildincidents',_0xf2da('0x8e'),'overriddencreatedon',_0xf2da('0x8f'),_0xf2da('0x90'),_0xf2da('0x91'),_0xf2da('0x92'),'primarycontactidname',_0xf2da('0x93'),_0xf2da('0x94'),_0xf2da('0x95'),'productserialnumber',_0xf2da('0x96'),_0xf2da('0x97'),_0xf2da('0x98'),_0xf2da('0x99'),_0xf2da('0x9a'),_0xf2da('0x9b'),_0xf2da('0x9c'),'slaname','socialprofileidname',_0xf2da('0x9d'),'statuscode',_0xf2da('0x9e'),_0xf2da('0x9f'),_0xf2da('0xa0'),'transactioncurrencyidname',_0xf2da('0xa1'),'utcconversiontimezonecode','versionnumber'];var _0x1e837a=_0x23116f[_0xf2da('0xa2')](_0x2a5aa3);return db['Dynamics365Account'][_0xf2da('0x59')]({'where':{'id':_0x16ff8f[_0xf2da('0x51')]['id']},'attributes':['id',_0xf2da('0xa3'),_0xf2da('0xa4'),_0xf2da('0xa5'),_0xf2da('0xa6'),'clientId',_0xf2da('0xa7')]})[_0xf2da('0x31')](handleEntityNotFound(_0x526db7,null))[_0xf2da('0x31')](function(_0x138fdf){if(_0x138fdf){_0xdd8802=_0x138fdf['remoteUri'];var _0x21a8ae=_0xdd8802['slice'](-0x1);if(_0x21a8ae==='/'){_0xdd8802=_0xdd8802['substring'](0x0,_0xdd8802[_0xf2da('0xa8')](_0x21a8ae));}_0x2d37fb=util[_0xf2da('0xa9')](_0xf2da('0xaa'),_0xdd8802);var _0x125e06={'method':_0xf2da('0xab'),'uri':_0xf2da('0xac')+_0x138fdf[_0xf2da('0xa6')]+_0xf2da('0xad'),'form':{'client_id':_0x138fdf[_0xf2da('0xae')],'resource':_0xdd8802,'username':_0x138fdf[_0xf2da('0xa3')],'password':_0x138fdf[_0xf2da('0xa4')],'grant_type':'password','client_secret':_0x138fdf[_0xf2da('0xa7')]},'json':!![]};return rp(_0x125e06);}})[_0xf2da('0x31')](function(_0x50e1e1){_0x52c71c=_0x50e1e1[_0xf2da('0xaf')];var _0x53590c={'method':_0xf2da('0xb0'),'uri':encodeURI(_0x2d37fb+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4686ad+'\x27'),'headers':{'Authorization':_0xf2da('0xb1')+_0x52c71c,'If-None-Match':null,'OData-Version':_0xf2da('0xb2')},'json':!![]};return rp(_0x53590c);})[_0xf2da('0x31')](function(_0x3b6ab3){var _0x3ed8a1=_0x3b6ab3['value'][0x0];var _0x40c9a5=_0x3ed8a1[_0xf2da('0xb3')];var _0x1b2530={'method':_0xf2da('0xb0'),'uri':_0x2d37fb+'EntityDefinitions('+_0x40c9a5+_0xf2da('0xb4'),'headers':{'Authorization':_0xf2da('0xb1')+_0x52c71c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1b2530);})['then'](function(_0x1b9ca0){_0x138189=_0x1b9ca0;_0x14adef=_0x138189[_0xf2da('0xb5')];_0x14adef=_[_0xf2da('0xb6')](_0x14adef,function(_0x5a24e5){return!_0x1e837a[_0xf2da('0xb7')](_0x5a24e5['LogicalName']);});var _0x20d9fc=[];var _0x3c49f1=[];_0x14adef[_0xf2da('0xb8')](function(_0x391996){if(_0x391996[_0xf2da('0xb9')]){var _0xeec1f1=_0x391996['@odata.type'][_0xf2da('0xba')](_0x391996['@odata.type'][_0xf2da('0xa8')]('.')+0x1);if(_0xeec1f1===_0xf2da('0xbb')){_0x20d9fc['push'](getSelectList(_0x2d37fb,_0x431676,_0x3c49f1,_0x138189[_0xf2da('0xb3')],_0x391996[_0xf2da('0xb3')],_0x52c71c));}}});return Promise[_0xf2da('0xbc')](_0x20d9fc);})['then'](function(_0x53c8c7){_0x5a246e=_0x53c8c7[0x0];var _0x2c2e81=[];var _0x587966=[];_0x14adef[_0xf2da('0xb8')](function(_0x338e4d){if(!_[_0xf2da('0xbd')](_0x338e4d[_0xf2da('0xb9')])){var _0x5d6647=_0x338e4d[_0xf2da('0xb9')][_0xf2da('0xba')](_0x338e4d[_0xf2da('0xb9')]['lastIndexOf']('.')+0x1);if(_0x5d6647==='BooleanAttributeMetadata'){_0x2c2e81[_0xf2da('0xbe')](getBooleanList(_0x2d37fb,_0x431676,_0x587966,_0x138189[_0xf2da('0xb3')],_0x338e4d[_0xf2da('0xb3')],_0x52c71c));}}});return Promise[_0xf2da('0xbc')](_0x2c2e81);})[_0xf2da('0x31')](function(_0x4f39ec){_0x3e957c=_0x4f39ec[0x0];var _0x1280a6=[];var _0x4d30a8=[];_0x14adef[_0xf2da('0xb8')](function(_0x3b1f54){if(_0x3b1f54[_0xf2da('0xb9')]){var _0xd9e3c=_0x3b1f54[_0xf2da('0xb9')][_0xf2da('0xba')](_0x3b1f54[_0xf2da('0xb9')]['lastIndexOf']('.')+0x1);if(_0xd9e3c===_0xf2da('0xbf')||_0xd9e3c===_0xf2da('0xc0')||_0xd9e3c===_0xf2da('0xc1')||_0xd9e3c===_0xf2da('0xc2')||_0xd9e3c==='MemoAttributeMetadata'||_0xd9e3c===_0xf2da('0xc3')||_0xd9e3c===_0xf2da('0xc4')||_0xd9e3c===_0xf2da('0xc5')||_0xd9e3c===_0xf2da('0xc6')||_0xd9e3c===_0xf2da('0xc7')){_0x1280a6[_0xf2da('0xbe')](getInputList(_0x2d37fb,_0x431676,_0xd9e3c,_0x4d30a8,_0x138189[_0xf2da('0xb3')],_0x3b1f54[_0xf2da('0xb3')],_0x52c71c));}}});return Promise['all'](_0x1280a6);})[_0xf2da('0x31')](function(_0x1f75b3){_0x25d4a8=_0x1f75b3[0x0];var _0x571d1c=_0x5a246e[_0xf2da('0xa2')](_0x3e957c)[_0xf2da('0xa2')](_0x25d4a8);var _0x4f8497={'count':_0x571d1c[_0xf2da('0x42')],'rows':_0x571d1c};return _0x4f8497;})['then'](respondWithResult(_0x526db7,null))[_0xf2da('0x26')](function(_0x3a8278){var _0x2f34b4=_0x16ff8f[_0xf2da('0x3c')]['test']?0x1f4:_0x3a8278[_0xf2da('0xc8')]||0x1f4;logger[_0xf2da('0x22')](_0x3a8278[_0xf2da('0x32')]);delete _0x3a8278[_0xf2da('0x33')];if(_0x2f34b4===0x191){_0x2f34b4=0x190;}_0x526db7['status'](_0x2f34b4)[_0xf2da('0x35')](_0x16ff8f[_0xf2da('0x3c')][_0xf2da('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0x3a8278[_0xf2da('0xc8')]}:_0x3a8278);});};function getSelectList(_0x4e4e04,_0x2d4389,_0x171119,_0x1b23df,_0x5d03b6,_0x17c884){var _0x45339a={'method':'GET','uri':_0x4e4e04+_0xf2da('0xc9')+_0x1b23df+')/Attributes('+_0x5d03b6+_0xf2da('0xca')+_0xf2da('0xcb'),'headers':{'Authorization':_0xf2da('0xb1')+_0x17c884,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x45339a)[_0xf2da('0x31')](function(_0x3f3031){var _0x2bb1d8=[];var _0x36d52c=_0x3f3031[_0xf2da('0xcc')][_0xf2da('0xcd')];_0x36d52c[_0xf2da('0xb8')](function(_0x23cb40){_0x2bb1d8[_0xf2da('0xbe')]({'name':_0x23cb40['Label'][_0xf2da('0xce')][_0xf2da('0xcf')],'value':String(_0x23cb40[_0xf2da('0xd0')])});});var _0x440762={'id':_0x2d4389+'_'+_0x3f3031[_0xf2da('0xd1')],'name':_0x3f3031[_0xf2da('0xd2')][_0xf2da('0xce')][_0xf2da('0xcf')],'custom':![],'options':_0x2bb1d8};_0x171119['push'](_0x440762);return _0x171119;});}function getBooleanList(_0x2c481f,_0x399499,_0x307d72,_0x164faf,_0x10ffbe,_0x1e38b4){var _0x269120={'method':'GET','uri':_0x2c481f+_0xf2da('0xc9')+_0x164faf+_0xf2da('0xd3')+_0x10ffbe+_0xf2da('0xd4'),'headers':{'Authorization':_0xf2da('0xb1')+_0x1e38b4,'If-None-Match':null,'OData-Version':_0xf2da('0xb2')},'json':!![]};return rp(_0x269120)[_0xf2da('0x31')](function(_0x111e69){var _0x4df2d1=[];_0x4df2d1[_0xf2da('0xbe')]({'name':_0x111e69['OptionSet']['TrueOption'][_0xf2da('0xcf')][_0xf2da('0xce')]['Label'],'value':_0xf2da('0xd5')},{'name':_0x111e69[_0xf2da('0xcc')]['FalseOption']['Label'][_0xf2da('0xce')][_0xf2da('0xcf')],'value':_0xf2da('0xd6')});var _0x442276={'id':_0x399499+'_'+_0x111e69[_0xf2da('0xd1')],'name':_0x111e69[_0xf2da('0xd2')][_0xf2da('0xce')]['Label'],'custom':![],'options':_0x4df2d1};_0x307d72[_0xf2da('0xbe')](_0x442276);return _0x307d72;});}function getInputList(_0x3fa474,_0x414d03,_0x57d601,_0x1dc84d,_0x5ad88b,_0xe2789b,_0x43bf00){var _0x51e52f={'method':_0xf2da('0xb0'),'uri':_0x3fa474+_0xf2da('0xc9')+_0x5ad88b+_0xf2da('0xd3')+_0xe2789b+_0xf2da('0xd7')+_0x57d601+_0xf2da('0xd8'),'headers':{'Authorization':'Bearer\x20'+_0x43bf00,'If-None-Match':null,'OData-Version':_0xf2da('0xb2')},'json':!![]};return rp(_0x51e52f)[_0xf2da('0x31')](function(_0x5ee980){var _0x136403={'id':_0x414d03+'_'+_0x5ee980[_0xf2da('0xd1')],'name':_0x5ee980[_0xf2da('0xd2')][_0xf2da('0xce')]?_0x5ee980[_0xf2da('0xd2')][_0xf2da('0xce')][_0xf2da('0xcf')]:_0x5ee980[_0xf2da('0xd1')],'custom':![],'options':[]};_0x1dc84d[_0xf2da('0xbe')](_0x136403);return _0x1dc84d;});} \ No newline at end of file +var _0xa4a2=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','find','create','body','params','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidname','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slaname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','tenantId','clientId','remoteUri','slice','substring','%s/api/data/v9.0/','POST','/oauth2/token','password','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','Value','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','OptionSet','FalseOption','false','DisplayName','?$select=DisplayName,LogicalName','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../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~!@#$%^&-_=+[{]}.','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type'];(function(_0x382bfd,_0x16241d){var _0x102fc6=function(_0x1d64f6){while(--_0x1d64f6){_0x382bfd['push'](_0x382bfd['shift']());}};_0x102fc6(++_0x16241d);}(_0xa4a2,0x9c));var _0x2a4a=function(_0x62a53a,_0x3ffaf6){_0x62a53a=_0x62a53a-0x0;var _0xf05383=_0xa4a2[_0x62a53a];return _0xf05383;};'use strict';var pdf=require(_0x2a4a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2a4a('0x1'));var zipdir=require(_0x2a4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a4a('0x3'));var moment=require(_0x2a4a('0x4'));var BPromise=require(_0x2a4a('0x5'));var Mustache=require(_0x2a4a('0x6'));var util=require('util');var path=require(_0x2a4a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2a4a('0x8'));var fs=require('fs');var _=require(_0x2a4a('0x9'));var squel=require(_0x2a4a('0xa'));var crypto=require(_0x2a4a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2a4a('0xc'));var toCsv=require(_0x2a4a('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2a4a('0xe'));var authService=require(_0x2a4a('0xf'));var qs=require(_0x2a4a('0x10'));var as=require(_0x2a4a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a4a('0x12'))(_0x2a4a('0x13'));var utils=require(_0x2a4a('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x2a4a('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x2a4a('0x16')][_0x2a4a('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2aacf3,_0x50c781,_0x51d77a){if(_0x51d77a){var _0x58e560=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58e560[_0x2a4a('0x18')](_0x50c781)){return _0x2aacf3;}else{throw new db[(_0x2a4a('0x19'))]['ValidationError'](_0x2a4a('0x1a'));}}else{return _0x2aacf3;}}function respondWithRpcPromise(_0x2d8263,_0x2df115,_0x4eabb9,_0x26c028){return new BPromise(function(_0x5bc757,_0x5cd1b8){var _0x3af73f=_0x26c028||client;return _0x3af73f['request'](_0x2d8263,_0x4eabb9)['then'](function(_0x4b6429){logger[_0x2a4a('0x1b')](_0x2a4a('0x1c'),_0x2df115,_0x2a4a('0x1d'));logger[_0x2a4a('0x1e')](_0x2a4a('0x1f'),_0x2df115,_0x2a4a('0x1d'),JSON['stringify'](_0x4b6429));if(_0x4b6429[_0x2a4a('0x20')]){if(_0x4b6429[_0x2a4a('0x20')][_0x2a4a('0x21')]===0x1f4){logger[_0x2a4a('0x20')](_0x2a4a('0x1c'),_0x2df115,_0x4b6429[_0x2a4a('0x20')][_0x2a4a('0x22')]);return _0x5cd1b8(_0x4b6429[_0x2a4a('0x20')][_0x2a4a('0x22')]);}logger['error'](_0x2a4a('0x1c'),_0x2df115,_0x4b6429[_0x2a4a('0x20')]['message']);return _0x5bc757(_0x4b6429[_0x2a4a('0x20')]['message']);}else{logger[_0x2a4a('0x1b')](_0x2a4a('0x1c'),_0x2df115,_0x2a4a('0x1d'));_0x5bc757(_0x4b6429[_0x2a4a('0x23')]['message']);}})[_0x2a4a('0x24')](function(_0x4650df){logger['error'](_0x2a4a('0x1c'),_0x2df115,_0x4650df);_0x5cd1b8(_0x4650df);});});}function respondWithStatusCode(_0x2c4051,_0x4a9c58){_0x4a9c58=_0x4a9c58||0xcc;return function(_0x227157){if(_0x227157){return _0x2c4051[_0x2a4a('0x25')](_0x4a9c58);}return _0x2c4051['status'](_0x4a9c58)['end']();};}function respondWithResult(_0x50c97f,_0x521b99){_0x521b99=_0x521b99||0xc8;return function(_0x59c24e){if(_0x59c24e){return _0x50c97f[_0x2a4a('0x26')](_0x521b99)['json'](_0x59c24e);}};}function respondWithFilteredResult(_0x36820f,_0x20a02e){return function(_0x37c65a){if(_0x37c65a){var _0x3b2254=_0x37c65a['count'],_0x2ff087=_0x20a02e[_0x2a4a('0x27')],_0x248d80=_0x20a02e['offset']+_0x20a02e[_0x2a4a('0x28')],_0x4ae583;if(_0x248d80>=_0x3b2254){_0x248d80=_0x3b2254;_0x4ae583=0xc8;}else{_0x4ae583=0xce;}_0x36820f[_0x2a4a('0x26')](_0x4ae583);return _0x36820f[_0x2a4a('0x29')](_0x2a4a('0x2a'),_0x2ff087+'-'+_0x248d80+'/'+_0x3b2254)[_0x2a4a('0x2b')](_0x37c65a);}return null;};}function patchUpdates(_0x13df32){return function(_0x25098e){try{jsonpatch[_0x2a4a('0x2c')](_0x25098e,_0x13df32,!![]);}catch(_0x49f717){return BPromise[_0x2a4a('0x2d')](_0x49f717);}return _0x25098e[_0x2a4a('0x2e')]();};}function saveUpdates(_0x1a7856,_0xf8680c){return function(_0x11a0b1){if(_0x11a0b1){return _0x11a0b1[_0x2a4a('0x2f')](_0x1a7856)[_0x2a4a('0x30')](function(_0x43e59c){return _0x43e59c;});}return null;};}function removeEntity(_0x4151f1,_0x3a2980){return function(_0x558765){if(_0x558765){return _0x558765[_0x2a4a('0x31')]()[_0x2a4a('0x30')](function(){_0x4151f1['status'](0xcc)[_0x2a4a('0x32')]();});}};}function handleEntityNotFound(_0x2ca5e4,_0x8a8ee9){return function(_0x54ca27){if(!_0x54ca27){_0x2ca5e4[_0x2a4a('0x25')](0x194);}return _0x54ca27;};}function handleError(_0x3b68d5,_0x240c07){_0x240c07=_0x240c07||0x1f4;return function(_0x426e8b){logger[_0x2a4a('0x20')](_0x426e8b[_0x2a4a('0x33')]);if(_0x426e8b[_0x2a4a('0x34')]){delete _0x426e8b[_0x2a4a('0x34')];}_0x3b68d5[_0x2a4a('0x26')](_0x240c07)[_0x2a4a('0x35')](_0x426e8b);};}exports[_0x2a4a('0x36')]=function(_0x307d5b,_0x1a8aa8){var _0x4532ab={},_0xee1c3b={},_0x3b37d3={'count':0x0,'rows':[]};var _0x45e2d5=_[_0x2a4a('0x37')](db[_0x2a4a('0x38')][_0x2a4a('0x39')],function(_0x2a965d){return{'name':_0x2a965d[_0x2a4a('0x3a')],'type':_0x2a965d[_0x2a4a('0x3b')][_0x2a4a('0x3c')]};});_0xee1c3b[_0x2a4a('0x3d')]=_[_0x2a4a('0x37')](_0x45e2d5,'name');_0xee1c3b[_0x2a4a('0x3e')]=_[_0x2a4a('0x3f')](_0x307d5b[_0x2a4a('0x3e')]);_0xee1c3b[_0x2a4a('0x40')]=_[_0x2a4a('0x41')](_0xee1c3b[_0x2a4a('0x3d')],_0xee1c3b[_0x2a4a('0x3e')]);_0x4532ab['attributes']=_[_0x2a4a('0x41')](_0xee1c3b['model'],qs[_0x2a4a('0x42')](_0x307d5b['query'][_0x2a4a('0x42')]));_0x4532ab[_0x2a4a('0x43')]=_0x4532ab['attributes'][_0x2a4a('0x44')]?_0x4532ab['attributes']:_0xee1c3b['model'];if(!_0x307d5b['query'][_0x2a4a('0x45')](_0x2a4a('0x46'))){_0x4532ab[_0x2a4a('0x28')]=qs[_0x2a4a('0x28')](_0x307d5b['query']['limit']);_0x4532ab[_0x2a4a('0x27')]=qs['offset'](_0x307d5b[_0x2a4a('0x3e')]['offset']);}_0x4532ab[_0x2a4a('0x47')]=qs[_0x2a4a('0x48')](_0x307d5b['query'][_0x2a4a('0x48')]);_0x4532ab['where']=qs['filters'](_[_0x2a4a('0x49')](_0x307d5b['query'],_0xee1c3b[_0x2a4a('0x40')]),_0x45e2d5);if(_0x307d5b[_0x2a4a('0x3e')]['filter']){_0x4532ab[_0x2a4a('0x4a')]=_[_0x2a4a('0x4b')](_0x4532ab[_0x2a4a('0x4a')],{'$or':_[_0x2a4a('0x37')](_0x45e2d5,function(_0x5eefa1){if(_0x5eefa1[_0x2a4a('0x3b')]!==_0x2a4a('0x4c')){var _0x310e1c={};_0x310e1c[_0x5eefa1[_0x2a4a('0x34')]]={'$like':'%'+_0x307d5b[_0x2a4a('0x3e')][_0x2a4a('0x4d')]+'%'};return _0x310e1c;}})});}_0x4532ab=_['merge']({},_0x4532ab,_0x307d5b[_0x2a4a('0x4e')]);var _0x3db8a2={'where':_0x4532ab['where']};return db['Dynamics365Account'][_0x2a4a('0x4f')](_0x3db8a2)[_0x2a4a('0x30')](function(_0x305843){_0x3b37d3[_0x2a4a('0x4f')]=_0x305843;if(_0x307d5b[_0x2a4a('0x3e')][_0x2a4a('0x50')]){_0x4532ab[_0x2a4a('0x51')]=[{'all':!![]}];}return db[_0x2a4a('0x38')][_0x2a4a('0x52')](_0x4532ab);})[_0x2a4a('0x30')](function(_0x5bae9e){_0x3b37d3[_0x2a4a('0x53')]=_0x5bae9e;return _0x3b37d3;})['then'](respondWithFilteredResult(_0x1a8aa8,_0x4532ab))[_0x2a4a('0x24')](handleError(_0x1a8aa8,null));};exports[_0x2a4a('0x54')]=function(_0x574203,_0x21bfab){var _0x5b57fd={'raw':![],'where':{'id':_0x574203['params']['id']}},_0x402aa5={};_0x402aa5[_0x2a4a('0x3d')]=_[_0x2a4a('0x3f')](db['Dynamics365Account']['rawAttributes']);_0x402aa5[_0x2a4a('0x3e')]=_[_0x2a4a('0x3f')](_0x574203[_0x2a4a('0x3e')]);_0x402aa5['filters']=_[_0x2a4a('0x41')](_0x402aa5[_0x2a4a('0x3d')],_0x402aa5[_0x2a4a('0x3e')]);_0x5b57fd[_0x2a4a('0x43')]=_['intersection'](_0x402aa5['model'],qs[_0x2a4a('0x42')](_0x574203['query']['fields']));_0x5b57fd[_0x2a4a('0x43')]=_0x5b57fd['attributes']['length']?_0x5b57fd[_0x2a4a('0x43')]:_0x402aa5['model'];if(_0x574203[_0x2a4a('0x3e')][_0x2a4a('0x50')]){_0x5b57fd[_0x2a4a('0x51')]=[{'all':!![]}];}_0x5b57fd=_[_0x2a4a('0x4b')]({},_0x5b57fd,_0x574203['options']);return db[_0x2a4a('0x38')][_0x2a4a('0x55')](_0x5b57fd)[_0x2a4a('0x30')](handleEntityNotFound(_0x21bfab,null))[_0x2a4a('0x30')](respondWithResult(_0x21bfab,null))[_0x2a4a('0x24')](handleError(_0x21bfab,null));};exports[_0x2a4a('0x56')]=function(_0x32213f,_0x1f87ad){return db[_0x2a4a('0x38')][_0x2a4a('0x56')](_0x32213f[_0x2a4a('0x57')],{})[_0x2a4a('0x30')](respondWithResult(_0x1f87ad,0xc9))['catch'](handleError(_0x1f87ad,null));};exports[_0x2a4a('0x2f')]=function(_0x2c04f1,_0x48fb26){if(_0x2c04f1[_0x2a4a('0x57')]['id']){delete _0x2c04f1[_0x2a4a('0x57')]['id'];}return db[_0x2a4a('0x38')][_0x2a4a('0x55')]({'where':{'id':_0x2c04f1[_0x2a4a('0x58')]['id']}})[_0x2a4a('0x30')](handleEntityNotFound(_0x48fb26,null))[_0x2a4a('0x30')](saveUpdates(_0x2c04f1[_0x2a4a('0x57')],null))['then'](respondWithResult(_0x48fb26,null))['catch'](handleError(_0x48fb26,null));};exports[_0x2a4a('0x31')]=function(_0x17f97f,_0x50d9d6){return db['Dynamics365Account'][_0x2a4a('0x55')]({'where':{'id':_0x17f97f['params']['id']}})[_0x2a4a('0x30')](handleEntityNotFound(_0x50d9d6,null))[_0x2a4a('0x30')](removeEntity(_0x50d9d6,null))[_0x2a4a('0x24')](handleError(_0x50d9d6,null));};exports[_0x2a4a('0x59')]=function(_0x533b34,_0x1decdf,_0x198fbc){var _0x74ce64={};var _0x380df7={};var _0x412ab2;var _0x55f027;return db['Dynamics365Account'][_0x2a4a('0x5a')]({'where':{'id':_0x533b34[_0x2a4a('0x58')]['id']}})[_0x2a4a('0x30')](handleEntityNotFound(_0x1decdf,null))[_0x2a4a('0x30')](function(_0x297798){if(_0x297798){_0x412ab2=_0x297798;_0x380df7[_0x2a4a('0x3d')]=_[_0x2a4a('0x3f')](db['Dynamics365Configuration'][_0x2a4a('0x39')]);_0x380df7[_0x2a4a('0x3e')]=_[_0x2a4a('0x3f')](_0x533b34[_0x2a4a('0x3e')]);_0x380df7[_0x2a4a('0x40')]=_['intersection'](_0x380df7['model'],_0x380df7[_0x2a4a('0x3e')]);_0x74ce64[_0x2a4a('0x43')]=_[_0x2a4a('0x41')](_0x380df7[_0x2a4a('0x3d')],qs[_0x2a4a('0x42')](_0x533b34[_0x2a4a('0x3e')][_0x2a4a('0x42')]));_0x74ce64[_0x2a4a('0x43')]=_0x74ce64[_0x2a4a('0x43')][_0x2a4a('0x44')]?_0x74ce64[_0x2a4a('0x43')]:_0x380df7[_0x2a4a('0x3d')];_0x74ce64[_0x2a4a('0x47')]=qs['sort'](_0x533b34['query'][_0x2a4a('0x48')]);_0x74ce64['where']=qs['filters'](_[_0x2a4a('0x49')](_0x533b34[_0x2a4a('0x3e')],_0x380df7['filters']));if(_0x533b34[_0x2a4a('0x3e')][_0x2a4a('0x4d')]){_0x74ce64[_0x2a4a('0x4a')]=_['merge'](_0x74ce64['where'],{'$or':_['map'](_0x74ce64['attributes'],function(_0x496bdc){var _0x939654={};_0x939654[_0x496bdc]={'$like':'%'+_0x533b34[_0x2a4a('0x3e')][_0x2a4a('0x4d')]+'%'};return _0x939654;})});}_0x74ce64=_[_0x2a4a('0x4b')]({},_0x74ce64,_0x533b34[_0x2a4a('0x4e')]);return _0x412ab2[_0x2a4a('0x59')](_0x74ce64);}})[_0x2a4a('0x30')](function(_0x3d5b6b){if(_0x3d5b6b){_0x55f027=_0x3d5b6b[_0x2a4a('0x44')];if(!_0x533b34['query']['hasOwnProperty']('nolimit')){_0x74ce64[_0x2a4a('0x28')]=qs[_0x2a4a('0x28')](_0x533b34[_0x2a4a('0x3e')][_0x2a4a('0x28')]);_0x74ce64[_0x2a4a('0x27')]=qs[_0x2a4a('0x27')](_0x533b34[_0x2a4a('0x3e')][_0x2a4a('0x27')]);}return _0x412ab2['getConfigurations'](_0x74ce64);}})[_0x2a4a('0x30')](function(_0xdf5444){if(_0xdf5444){return _0xdf5444?{'count':_0x55f027,'rows':_0xdf5444}:null;}})[_0x2a4a('0x30')](respondWithResult(_0x1decdf,null))['catch'](handleError(_0x1decdf,null));};exports['addConfiguration']=function(_0x3fdf62,_0x3ea9e1,_0x510ba3){if(_0x3fdf62[_0x2a4a('0x57')]['id']){delete _0x3fdf62['body']['id'];}return db[_0x2a4a('0x38')][_0x2a4a('0x5a')]({'where':{'id':_0x3fdf62['params']['id']}})[_0x2a4a('0x30')](handleEntityNotFound(_0x3ea9e1,null))[_0x2a4a('0x30')](function(_0x61dbbe){if(_0x61dbbe){_0x3fdf62[_0x2a4a('0x57')][_0x2a4a('0x5b')]=_0x61dbbe['id'];_0x3fdf62[_0x2a4a('0x57')][_0x2a4a('0x5c')]=integrations[_0x2a4a('0x5d')](_0x3fdf62[_0x2a4a('0x57')][_0x2a4a('0x5e')],_0x3fdf62[_0x2a4a('0x57')][_0x2a4a('0x3b')]);_0x3fdf62[_0x2a4a('0x57')][_0x2a4a('0x5f')]=integrations[_0x2a4a('0x60')](_0x3fdf62[_0x2a4a('0x57')][_0x2a4a('0x5e')],_0x3fdf62[_0x2a4a('0x57')][_0x2a4a('0x3b')]);return db[_0x2a4a('0x61')][_0x2a4a('0x56')](_0x3fdf62[_0x2a4a('0x57')],{'include':[{'model':db['Dynamics365Field'],'as':_0x2a4a('0x5c')},{'model':db[_0x2a4a('0x62')],'as':_0x2a4a('0x5f')}]});}return null;})[_0x2a4a('0x30')](respondWithResult(_0x3ea9e1,null))[_0x2a4a('0x24')](handleError(_0x3ea9e1,null));};exports[_0x2a4a('0x63')]=function(_0x2e2241,_0x50d86e,_0x33c000){var _0x57cc4c=_0x2e2241[_0x2a4a('0x3e')][_0x2a4a('0x64')];var _0x4b5561=_0x57cc4c==='incident'?_0x2a4a('0x65'):_0x2a4a('0x66');var _0x34546f='';var _0x5578ee='';var _0x1978bf='';var _0x21f79d='';var _0x2d9d44='';var _0x4b7c6d='';var _0x449055='';var _0x3ef87c='';var _0x443e54=['title',_0x2a4a('0x67'),_0x2a4a('0x68'),_0x2a4a('0x69'),'caseorigincode',_0x2a4a('0x6a'),_0x2a4a('0x6b'),_0x2a4a('0x6c'),_0x2a4a('0x6d'),'phonecall_activity_parties'];var _0xadc73d=[_0x2a4a('0x6e'),'accountidyominame',_0x2a4a('0x6f'),_0x2a4a('0x70'),_0x2a4a('0x71'),'contactidyominame',_0x2a4a('0x72'),_0x2a4a('0x73'),_0x2a4a('0x74'),_0x2a4a('0x75'),_0x2a4a('0x76'),_0x2a4a('0x77'),'createdon','createdonbehalfbyname',_0x2a4a('0x78'),_0x2a4a('0x79'),_0x2a4a('0x7a'),_0x2a4a('0x7b'),_0x2a4a('0x7c'),_0x2a4a('0x7d'),'entityimage_timestamp',_0x2a4a('0x7e'),_0x2a4a('0x7f'),_0x2a4a('0x80'),_0x2a4a('0x81'),_0x2a4a('0x82'),'importsequencenumber',_0x2a4a('0x83'),_0x2a4a('0x84'),_0x2a4a('0x85'),_0x2a4a('0x86'),_0x2a4a('0x87'),_0x2a4a('0x88'),_0x2a4a('0x89'),_0x2a4a('0x8a'),_0x2a4a('0x8b'),'modifiedonbehalfbyname',_0x2a4a('0x8c'),_0x2a4a('0x8d'),_0x2a4a('0x8e'),_0x2a4a('0x8f'),_0x2a4a('0x90'),_0x2a4a('0x91'),_0x2a4a('0x92'),_0x2a4a('0x93'),'owneridyominame','parentcaseidname',_0x2a4a('0x94'),'primarycontactidyominame','prioritycodename',_0x2a4a('0x95'),_0x2a4a('0x96'),_0x2a4a('0x97'),'resolvebykpiidname',_0x2a4a('0x98'),'responsiblecontactidname',_0x2a4a('0x99'),_0x2a4a('0x9a'),'slainvokedidname',_0x2a4a('0x9b'),'socialprofileidname',_0x2a4a('0x9c'),_0x2a4a('0x9d'),_0x2a4a('0x9e'),_0x2a4a('0x9f'),'timezoneruleversionnumber',_0x2a4a('0xa0'),_0x2a4a('0xa1'),_0x2a4a('0xa2'),'versionnumber'];var _0x3cd12e=_0x443e54[_0x2a4a('0xa3')](_0xadc73d);return db[_0x2a4a('0x38')][_0x2a4a('0x5a')]({'where':{'id':_0x2e2241[_0x2a4a('0x58')]['id']},'attributes':['id',_0x2a4a('0xa4'),'password','remoteUri',_0x2a4a('0xa5'),_0x2a4a('0xa6'),'clientSecret']})[_0x2a4a('0x30')](handleEntityNotFound(_0x50d86e,null))[_0x2a4a('0x30')](function(_0x293790){if(_0x293790){_0x3ef87c=_0x293790[_0x2a4a('0xa7')];var _0x86a09=_0x3ef87c[_0x2a4a('0xa8')](-0x1);if(_0x86a09==='/'){_0x3ef87c=_0x3ef87c[_0x2a4a('0xa9')](0x0,_0x3ef87c['lastIndexOf'](_0x86a09));}_0x449055=util['format'](_0x2a4a('0xaa'),_0x3ef87c);var _0x9e5058={'method':_0x2a4a('0xab'),'uri':'https://login.microsoftonline.com/'+_0x293790[_0x2a4a('0xa5')]+_0x2a4a('0xac'),'form':{'client_id':_0x293790['clientId'],'resource':_0x3ef87c,'username':_0x293790[_0x2a4a('0xa4')],'password':_0x293790[_0x2a4a('0xad')],'grant_type':_0x2a4a('0xad'),'client_secret':_0x293790[_0x2a4a('0xae')]},'json':!![]};return rp(_0x9e5058);}})[_0x2a4a('0x30')](function(_0x241027){_0x4b7c6d=_0x241027[_0x2a4a('0xaf')];var _0x53cad3={'method':_0x2a4a('0xb0'),'uri':encodeURI(_0x449055+_0x2a4a('0xb1')+_0x4b5561+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4b7c6d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x53cad3);})['then'](function(_0x215e11){var _0x45c203=_0x215e11[_0x2a4a('0xb2')][0x0];var _0xc6d5cb=_0x45c203[_0x2a4a('0xb3')];var _0xf47f7c={'method':_0x2a4a('0xb0'),'uri':_0x449055+'EntityDefinitions('+_0xc6d5cb+_0x2a4a('0xb4'),'headers':{'Authorization':_0x2a4a('0xb5')+_0x4b7c6d,'If-None-Match':null,'OData-Version':_0x2a4a('0xb6')},'json':!![]};return rp(_0xf47f7c);})[_0x2a4a('0x30')](function(_0x2c9598){_0x34546f=_0x2c9598;_0x5578ee=_0x34546f[_0x2a4a('0xb7')];_0x5578ee=_[_0x2a4a('0xb8')](_0x5578ee,function(_0x274f69){return!_0x3cd12e[_0x2a4a('0xb9')](_0x274f69[_0x2a4a('0xba')]);});var _0x595c4f=[];var _0x31666f=[];_0x5578ee[_0x2a4a('0xbb')](function(_0x428498){if(_0x428498[_0x2a4a('0xbc')]){var _0x21e6f3=_0x428498[_0x2a4a('0xbc')][_0x2a4a('0xa9')](_0x428498['@odata.type'][_0x2a4a('0xbd')]('.')+0x1);if(_0x21e6f3===_0x2a4a('0xbe')){_0x595c4f['push'](getSelectList(_0x449055,_0x57cc4c,_0x31666f,_0x34546f[_0x2a4a('0xb3')],_0x428498[_0x2a4a('0xb3')],_0x4b7c6d));}}});return Promise[_0x2a4a('0xbf')](_0x595c4f);})['then'](function(_0x4252de){_0x1978bf=_0x4252de[0x0];var _0x316d84=[];var _0x5987f4=[];_0x5578ee[_0x2a4a('0xbb')](function(_0x480f37){if(!_[_0x2a4a('0xc0')](_0x480f37[_0x2a4a('0xbc')])){var _0x5be348=_0x480f37[_0x2a4a('0xbc')]['substring'](_0x480f37['@odata.type'][_0x2a4a('0xbd')]('.')+0x1);if(_0x5be348===_0x2a4a('0xc1')){_0x316d84[_0x2a4a('0xc2')](getBooleanList(_0x449055,_0x57cc4c,_0x5987f4,_0x34546f[_0x2a4a('0xb3')],_0x480f37[_0x2a4a('0xb3')],_0x4b7c6d));}}});return Promise[_0x2a4a('0xbf')](_0x316d84);})[_0x2a4a('0x30')](function(_0x16e276){_0x21f79d=_0x16e276[0x0];var _0x470166=[];var _0x57245e=[];_0x5578ee['forEach'](function(_0x39ec8f){if(_0x39ec8f[_0x2a4a('0xbc')]){var _0x57ece0=_0x39ec8f[_0x2a4a('0xbc')][_0x2a4a('0xa9')](_0x39ec8f[_0x2a4a('0xbc')][_0x2a4a('0xbd')]('.')+0x1);if(_0x57ece0==='StringAttributeMetadata'||_0x57ece0==='DoubleAttributeMetadata'||_0x57ece0==='BigIntAttributeMetadata'||_0x57ece0===_0x2a4a('0xc3')||_0x57ece0===_0x2a4a('0xc4')||_0x57ece0==='DateTimeAttributeMetadata'||_0x57ece0===_0x2a4a('0xc5')||_0x57ece0===_0x2a4a('0xc6')||_0x57ece0===_0x2a4a('0xc7')||_0x57ece0===_0x2a4a('0xc8')){_0x470166[_0x2a4a('0xc2')](getInputList(_0x449055,_0x57cc4c,_0x57ece0,_0x57245e,_0x34546f[_0x2a4a('0xb3')],_0x39ec8f['MetadataId'],_0x4b7c6d));}}});return Promise[_0x2a4a('0xbf')](_0x470166);})['then'](function(_0x561150){_0x2d9d44=_0x561150[0x0];var _0x5978c8=_0x1978bf[_0x2a4a('0xa3')](_0x21f79d)[_0x2a4a('0xa3')](_0x2d9d44);var _0x3732dd={'count':_0x5978c8[_0x2a4a('0x44')],'rows':_0x5978c8};return _0x3732dd;})[_0x2a4a('0x30')](respondWithResult(_0x50d86e,null))[_0x2a4a('0x24')](function(_0x384098){var _0x43d279=_0x2e2241['query'][_0x2a4a('0x18')]?0x1f4:_0x384098[_0x2a4a('0xc9')]||0x1f4;logger[_0x2a4a('0x20')](_0x384098[_0x2a4a('0x33')]);delete _0x384098[_0x2a4a('0x34')];if(_0x43d279===0x191){_0x43d279=0x190;}_0x50d86e['status'](_0x43d279)[_0x2a4a('0x35')](_0x2e2241[_0x2a4a('0x3e')][_0x2a4a('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x384098[_0x2a4a('0xc9')]}:_0x384098);});};function getSelectList(_0x21f261,_0x17279c,_0x483988,_0x250c15,_0x287bbc,_0x4ac26c){var _0x5e804e={'method':'GET','uri':_0x21f261+_0x2a4a('0xca')+_0x250c15+_0x2a4a('0xcb')+_0x287bbc+_0x2a4a('0xcc')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x2a4a('0xb5')+_0x4ac26c,'If-None-Match':null,'OData-Version':_0x2a4a('0xb6')},'json':!![]};return rp(_0x5e804e)[_0x2a4a('0x30')](function(_0x352f01){var _0x25f9cb=[];var _0x4b6205=_0x352f01['OptionSet'][_0x2a4a('0xcd')];_0x4b6205['forEach'](function(_0x236ef1){_0x25f9cb['push']({'name':_0x236ef1[_0x2a4a('0xce')]['UserLocalizedLabel']['Label'],'value':String(_0x236ef1[_0x2a4a('0xcf')])});});var _0x425c20={'id':_0x17279c+'_'+_0x352f01[_0x2a4a('0xba')],'name':_0x352f01['DisplayName'][_0x2a4a('0xd0')][_0x2a4a('0xce')],'custom':![],'options':_0x25f9cb};_0x483988['push'](_0x425c20);return _0x483988;});}function getBooleanList(_0x475120,_0x2f95aa,_0x5c8c10,_0xfbfaf1,_0x3629ee,_0x216d1b){var _0x215d87={'method':'GET','uri':_0x475120+_0x2a4a('0xca')+_0xfbfaf1+_0x2a4a('0xcb')+_0x3629ee+_0x2a4a('0xd1'),'headers':{'Authorization':'Bearer\x20'+_0x216d1b,'If-None-Match':null,'OData-Version':_0x2a4a('0xb6')},'json':!![]};return rp(_0x215d87)[_0x2a4a('0x30')](function(_0x21f42b){var _0x5a6748=[];_0x5a6748[_0x2a4a('0xc2')]({'name':_0x21f42b['OptionSet']['TrueOption'][_0x2a4a('0xce')]['UserLocalizedLabel']['Label'],'value':_0x2a4a('0xd2')},{'name':_0x21f42b[_0x2a4a('0xd3')][_0x2a4a('0xd4')][_0x2a4a('0xce')][_0x2a4a('0xd0')][_0x2a4a('0xce')],'value':_0x2a4a('0xd5')});var _0x5e9c8e={'id':_0x2f95aa+'_'+_0x21f42b[_0x2a4a('0xba')],'name':_0x21f42b[_0x2a4a('0xd6')]['UserLocalizedLabel'][_0x2a4a('0xce')],'custom':![],'options':_0x5a6748};_0x5c8c10[_0x2a4a('0xc2')](_0x5e9c8e);return _0x5c8c10;});}function getInputList(_0x26bd3b,_0x1946bd,_0x1a948a,_0x509fa3,_0x31e0fd,_0x5cc0a2,_0x54524e){var _0x5d9df2={'method':'GET','uri':_0x26bd3b+_0x2a4a('0xca')+_0x31e0fd+_0x2a4a('0xcb')+_0x5cc0a2+')/Microsoft.Dynamics.CRM.'+_0x1a948a+_0x2a4a('0xd7'),'headers':{'Authorization':_0x2a4a('0xb5')+_0x54524e,'If-None-Match':null,'OData-Version':_0x2a4a('0xb6')},'json':!![]};return rp(_0x5d9df2)[_0x2a4a('0x30')](function(_0x3e2f26){var _0xcccee4={'id':_0x1946bd+'_'+_0x3e2f26[_0x2a4a('0xba')],'name':_0x3e2f26[_0x2a4a('0xd6')]['UserLocalizedLabel']?_0x3e2f26[_0x2a4a('0xd6')][_0x2a4a('0xd0')][_0x2a4a('0xce')]:_0x3e2f26[_0x2a4a('0xba')],'custom':![],'options':[]};_0x509fa3[_0x2a4a('0xc2')](_0xcccee4);return _0x509fa3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 284e9f1..ebd29f0 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 _0xf347=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf347,0xef));var _0x7f34=function(_0xa1e659,_0xd4c7c3){_0xa1e659=_0xa1e659-0x0;var _0x5504b2=_0xf347[_0xa1e659];return _0x5504b2;};'use strict';var _=require(_0x7f34('0x0'));var util=require('util');var logger=require(_0x7f34('0x1'))(_0x7f34('0x2'));var moment=require('moment');var BPromise=require(_0x7f34('0x3'));var rp=require(_0x7f34('0x4'));var fs=require('fs');var path=require(_0x7f34('0x5'));var rimraf=require(_0x7f34('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x7f34('0x7'));module[_0x7f34('0x8')]=function(_0x534f97,_0xeda919){return _0x534f97[_0x7f34('0x9')](_0x7f34('0xa'),attributes,{'tableName':_0x7f34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa32=['api','moment','request-promise','path','../../components/integrations/configuration','exports','int_dynamics365_accounts','util','../../config/logger'];(function(_0x4c1ec2,_0x4f42b7){var _0x3f6f1c=function(_0xc82652){while(--_0xc82652){_0x4c1ec2['push'](_0x4c1ec2['shift']());}};_0x3f6f1c(++_0x4f42b7);}(_0xaa32,0xb2));var _0x2aa3=function(_0x52fe08,_0x529536){_0x52fe08=_0x52fe08-0x0;var _0x506424=_0xaa32[_0x52fe08];return _0x506424;};'use strict';var _=require('lodash');var util=require(_0x2aa3('0x0'));var logger=require(_0x2aa3('0x1'))(_0x2aa3('0x2'));var moment=require(_0x2aa3('0x3'));var BPromise=require('bluebird');var rp=require(_0x2aa3('0x4'));var fs=require('fs');var path=require(_0x2aa3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x2aa3('0x6'));module[_0x2aa3('0x7')]=function(_0x59c3bb,_0x574914){return _0x59c3bb['define']('Dynamics365Account',attributes,{'tableName':_0x2aa3('0x8'),'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 1c779e6..c7834c5 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 _0x2428=['result','GetDynamics365Account','Dynamics365Account','options','raw','attributes','include','map','model','stringify','catch','ShowDynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s','error','message'];(function(_0x3d4cce,_0x53cae9){var _0x83fbc=function(_0x59be6a){while(--_0x59be6a){_0x3d4cce['push'](_0x3d4cce['shift']());}};_0x83fbc(++_0x53cae9);}(_0x2428,0xd3));var _0x8242=function(_0x5ca163,_0x7f4404){_0x5ca163=_0x5ca163-0x0;var _0x555d55=_0x2428[_0x5ca163];return _0x555d55;};'use strict';var _=require('lodash');var util=require(_0x8242('0x0'));var moment=require(_0x8242('0x1'));var BPromise=require(_0x8242('0x2'));var rs=require(_0x8242('0x3'));var fs=require('fs');var Redis=require(_0x8242('0x4'));var db=require(_0x8242('0x5'))['db'];var utils=require(_0x8242('0x6'));var logger=require(_0x8242('0x7'))(_0x8242('0x8'));var config=require(_0x8242('0x9'));var jayson=require(_0x8242('0xa'));var client=jayson['client'][_0x8242('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11da5f,_0x3fb12e,_0x3712f3){return new BPromise(function(_0x1501e8,_0x4b9617){return client[_0x8242('0xc')](_0x11da5f,_0x3712f3)[_0x8242('0xd')](function(_0x12b115){logger[_0x8242('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x3fb12e,_0x8242('0xf'));logger[_0x8242('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x3fb12e,_0x8242('0xf'),JSON['stringify'](_0x12b115));if(_0x12b115['error']){if(_0x12b115['error']['code']===0x1f4){logger['error'](_0x8242('0x11'),_0x3fb12e,_0x12b115[_0x8242('0x12')]['message']);return _0x4b9617(_0x12b115['error'][_0x8242('0x13')]);}logger[_0x8242('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x3fb12e,_0x12b115[_0x8242('0x12')]['message']);return _0x1501e8(_0x12b115[_0x8242('0x12')][_0x8242('0x13')]);}else{logger[_0x8242('0xe')](_0x8242('0x11'),_0x3fb12e,_0x8242('0xf'));_0x1501e8(_0x12b115[_0x8242('0x14')][_0x8242('0x13')]);}})['catch'](function(_0x4ad29d){logger[_0x8242('0x12')](_0x8242('0x11'),_0x3fb12e,_0x4ad29d);_0x4b9617(_0x4ad29d);});});}exports[_0x8242('0x15')]=function(_0xad2711){var _0x12b745=this;return new Promise(function(_0x473f67,_0x2de515){return db[_0x8242('0x16')]['findAll']({'raw':_0xad2711[_0x8242('0x17')]?_0xad2711[_0x8242('0x17')][_0x8242('0x18')]===undefined?!![]:![]:!![],'where':_0xad2711[_0x8242('0x17')]?_0xad2711[_0x8242('0x17')]['where']||null:null,'attributes':_0xad2711[_0x8242('0x17')]?_0xad2711['options'][_0x8242('0x19')]||null:null,'limit':_0xad2711[_0x8242('0x17')]?_0xad2711['options']['limit']||null:null,'include':_0xad2711[_0x8242('0x17')]?_0xad2711[_0x8242('0x17')][_0x8242('0x1a')]?_[_0x8242('0x1b')](_0xad2711[_0x8242('0x17')][_0x8242('0x1a')],function(_0x35196f){return{'model':db[_0x35196f['model']],'as':_0x35196f['as'],'attributes':_0x35196f['attributes'],'include':_0x35196f['include']?_[_0x8242('0x1b')](_0x35196f[_0x8242('0x1a')],function(_0x4e3caa){return{'model':db[_0x4e3caa['model']],'as':_0x4e3caa['as'],'attributes':_0x4e3caa[_0x8242('0x19')],'include':_0x4e3caa[_0x8242('0x1a')]?_['map'](_0x4e3caa[_0x8242('0x1a')],function(_0x483632){return{'model':db[_0x483632[_0x8242('0x1c')]],'as':_0x483632['as'],'attributes':_0x483632['attributes']};}):[]};}):[]};}):[]:[]})[_0x8242('0xd')](function(_0x20f2b7){logger['info'](_0x8242('0x15'),_0xad2711);logger[_0x8242('0x10')](_0x8242('0x15'),_0xad2711,JSON[_0x8242('0x1d')](_0x20f2b7));_0x473f67(_0x20f2b7);})[_0x8242('0x1e')](function(_0x2766b0){logger[_0x8242('0x12')](_0x8242('0x15'),_0x2766b0[_0x8242('0x13')],_0xad2711);_0x2de515(_0x12b745[_0x8242('0x12')](0x1f4,_0x2766b0[_0x8242('0x13')]));});});};exports[_0x8242('0x1f')]=function(_0x44f2ca){var _0x163b1e=this;return new Promise(function(_0x358fd1,_0x22edf0){return db[_0x8242('0x16')][_0x8242('0x20')]({'raw':_0x44f2ca[_0x8242('0x17')]?_0x44f2ca[_0x8242('0x17')][_0x8242('0x18')]===undefined?!![]:![]:!![],'where':_0x44f2ca[_0x8242('0x17')]?_0x44f2ca[_0x8242('0x17')]['where']||null:null,'attributes':_0x44f2ca[_0x8242('0x17')]?_0x44f2ca[_0x8242('0x17')][_0x8242('0x19')]||null:null,'include':_0x44f2ca[_0x8242('0x17')]?_0x44f2ca[_0x8242('0x17')][_0x8242('0x1a')]?_[_0x8242('0x1b')](_0x44f2ca['options']['include'],function(_0x6e75ef){return{'model':db[_0x6e75ef['model']],'as':_0x6e75ef['as'],'attributes':_0x6e75ef[_0x8242('0x19')],'include':_0x6e75ef['include']?_[_0x8242('0x1b')](_0x6e75ef[_0x8242('0x1a')],function(_0x1176ed){return{'model':db[_0x1176ed[_0x8242('0x1c')]],'as':_0x1176ed['as'],'attributes':_0x1176ed[_0x8242('0x19')],'include':_0x1176ed[_0x8242('0x1a')]?_[_0x8242('0x1b')](_0x1176ed['include'],function(_0x56a069){return{'model':db[_0x56a069[_0x8242('0x1c')]],'as':_0x56a069['as'],'attributes':_0x56a069[_0x8242('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8242('0xd')](function(_0x59c54){logger['info'](_0x8242('0x1f'),_0x44f2ca);logger['debug'](_0x8242('0x1f'),_0x44f2ca,JSON[_0x8242('0x1d')](_0x59c54));_0x358fd1(_0x59c54);})[_0x8242('0x1e')](function(_0x5a8a75){logger['error'](_0x8242('0x1f'),_0x5a8a75[_0x8242('0x13')],_0x44f2ca);_0x22edf0(_0x163b1e['error'](0x1f4,_0x5a8a75[_0x8242('0x13')]));});});}; \ No newline at end of file +var _0xb491=['findAll','options','raw','where','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Dynamics365Account'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb491,0x18c));var _0x1b49=function(_0x575a38,_0x2e83d7){_0x575a38=_0x575a38-0x0;var _0x5a7bdd=_0xb491[_0x575a38];return _0x5a7bdd;};'use strict';var _=require(_0x1b49('0x0'));var util=require(_0x1b49('0x1'));var moment=require(_0x1b49('0x2'));var BPromise=require(_0x1b49('0x3'));var rs=require(_0x1b49('0x4'));var fs=require('fs');var Redis=require(_0x1b49('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b49('0x6'));var logger=require(_0x1b49('0x7'))('rpc');var config=require(_0x1b49('0x8'));var jayson=require(_0x1b49('0x9'));var client=jayson[_0x1b49('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x212aee,_0x537b53,_0x4636f4){return new BPromise(function(_0x3d5da7,_0x218fac){return client[_0x1b49('0xb')](_0x212aee,_0x4636f4)[_0x1b49('0xc')](function(_0x153ffc){logger[_0x1b49('0xd')](_0x1b49('0xe'),_0x537b53,_0x1b49('0xf'));logger[_0x1b49('0x10')](_0x1b49('0x11'),_0x537b53,_0x1b49('0xf'),JSON[_0x1b49('0x12')](_0x153ffc));if(_0x153ffc[_0x1b49('0x13')]){if(_0x153ffc['error']['code']===0x1f4){logger[_0x1b49('0x13')](_0x1b49('0xe'),_0x537b53,_0x153ffc[_0x1b49('0x13')][_0x1b49('0x14')]);return _0x218fac(_0x153ffc[_0x1b49('0x13')]['message']);}logger[_0x1b49('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x537b53,_0x153ffc[_0x1b49('0x13')][_0x1b49('0x14')]);return _0x3d5da7(_0x153ffc[_0x1b49('0x13')][_0x1b49('0x14')]);}else{logger['info'](_0x1b49('0xe'),_0x537b53,_0x1b49('0xf'));_0x3d5da7(_0x153ffc[_0x1b49('0x15')][_0x1b49('0x14')]);}})[_0x1b49('0x16')](function(_0x308e8e){logger[_0x1b49('0x13')](_0x1b49('0xe'),_0x537b53,_0x308e8e);_0x218fac(_0x308e8e);});});}exports['GetDynamics365Account']=function(_0x363678){var _0xe47400=this;return new Promise(function(_0x4b9dcd,_0x34282e){return db[_0x1b49('0x17')][_0x1b49('0x18')]({'raw':_0x363678[_0x1b49('0x19')]?_0x363678[_0x1b49('0x19')][_0x1b49('0x1a')]===undefined?!![]:![]:!![],'where':_0x363678[_0x1b49('0x19')]?_0x363678[_0x1b49('0x19')][_0x1b49('0x1b')]||null:null,'attributes':_0x363678[_0x1b49('0x19')]?_0x363678['options']['attributes']||null:null,'limit':_0x363678[_0x1b49('0x19')]?_0x363678[_0x1b49('0x19')][_0x1b49('0x1c')]||null:null,'include':_0x363678[_0x1b49('0x19')]?_0x363678['options'][_0x1b49('0x1d')]?_[_0x1b49('0x1e')](_0x363678['options'][_0x1b49('0x1d')],function(_0x187295){return{'model':db[_0x187295[_0x1b49('0x1f')]],'as':_0x187295['as'],'attributes':_0x187295['attributes'],'include':_0x187295[_0x1b49('0x1d')]?_[_0x1b49('0x1e')](_0x187295[_0x1b49('0x1d')],function(_0x4ab79e){return{'model':db[_0x4ab79e[_0x1b49('0x1f')]],'as':_0x4ab79e['as'],'attributes':_0x4ab79e['attributes'],'include':_0x4ab79e[_0x1b49('0x1d')]?_['map'](_0x4ab79e[_0x1b49('0x1d')],function(_0x469ab0){return{'model':db[_0x469ab0[_0x1b49('0x1f')]],'as':_0x469ab0['as'],'attributes':_0x469ab0['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b49('0xc')](function(_0x4953be){logger['info']('GetDynamics365Account',_0x363678);logger[_0x1b49('0x10')]('GetDynamics365Account',_0x363678,JSON[_0x1b49('0x12')](_0x4953be));_0x4b9dcd(_0x4953be);})[_0x1b49('0x16')](function(_0x512d61){logger[_0x1b49('0x13')](_0x1b49('0x20'),_0x512d61[_0x1b49('0x14')],_0x363678);_0x34282e(_0xe47400[_0x1b49('0x13')](0x1f4,_0x512d61[_0x1b49('0x14')]));});});};exports[_0x1b49('0x21')]=function(_0x2e87dc){var _0x59a859=this;return new Promise(function(_0x42f687,_0xdf5b8f){return db[_0x1b49('0x17')]['find']({'raw':_0x2e87dc['options']?_0x2e87dc[_0x1b49('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2e87dc[_0x1b49('0x19')]?_0x2e87dc['options'][_0x1b49('0x1b')]||null:null,'attributes':_0x2e87dc[_0x1b49('0x19')]?_0x2e87dc[_0x1b49('0x19')][_0x1b49('0x22')]||null:null,'include':_0x2e87dc['options']?_0x2e87dc[_0x1b49('0x19')][_0x1b49('0x1d')]?_[_0x1b49('0x1e')](_0x2e87dc[_0x1b49('0x19')][_0x1b49('0x1d')],function(_0x290a57){return{'model':db[_0x290a57[_0x1b49('0x1f')]],'as':_0x290a57['as'],'attributes':_0x290a57[_0x1b49('0x22')],'include':_0x290a57['include']?_[_0x1b49('0x1e')](_0x290a57['include'],function(_0xfd8a03){return{'model':db[_0xfd8a03[_0x1b49('0x1f')]],'as':_0xfd8a03['as'],'attributes':_0xfd8a03[_0x1b49('0x22')],'include':_0xfd8a03[_0x1b49('0x1d')]?_['map'](_0xfd8a03['include'],function(_0x4df19d){return{'model':db[_0x4df19d[_0x1b49('0x1f')]],'as':_0x4df19d['as'],'attributes':_0x4df19d[_0x1b49('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b44bc){logger[_0x1b49('0xd')](_0x1b49('0x21'),_0x2e87dc);logger[_0x1b49('0x10')](_0x1b49('0x21'),_0x2e87dc,JSON['stringify'](_0x1b44bc));_0x42f687(_0x1b44bc);})[_0x1b49('0x16')](function(_0x4bdc88){logger[_0x1b49('0x13')]('ShowDynamics365Account',_0x4bdc88[_0x1b49('0x14')],_0x2e87dc);_0xdf5b8f(_0x59a859['error'](0x1f4,_0x4bdc88[_0x1b49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 8d507a7..1caaf3f 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 _0x1d8a=['/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields'];(function(_0x1614d5,_0x2067c3){var _0x3cbf5b=function(_0x56f363){while(--_0x56f363){_0x1614d5['push'](_0x1614d5['shift']());}};_0x3cbf5b(++_0x2067c3);}(_0x1d8a,0xe9));var _0xa1d8=function(_0x419815,_0x370a6b){_0x419815=_0x419815-0x0;var _0x58d44b=_0x1d8a[_0x419815];return _0x58d44b;};'use strict';var multer=require(_0xa1d8('0x0'));var util=require(_0xa1d8('0x1'));var path=require(_0xa1d8('0x2'));var timeout=require(_0xa1d8('0x3'));var express=require(_0xa1d8('0x4'));var router=express[_0xa1d8('0x5')]();var auth=require(_0xa1d8('0x6'));var interaction=require(_0xa1d8('0x7'));var config=require(_0xa1d8('0x8'));var controller=require(_0xa1d8('0x9'));router['get']('/',auth[_0xa1d8('0xa')](),controller[_0xa1d8('0xb')]);router[_0xa1d8('0xc')](_0xa1d8('0xd'),auth[_0xa1d8('0xa')](),controller[_0xa1d8('0xe')]);router['get'](_0xa1d8('0xf'),auth[_0xa1d8('0xa')](),controller[_0xa1d8('0x10')]);router[_0xa1d8('0xc')]('/:id/subjects',auth[_0xa1d8('0xa')](),controller['getSubjects']);router[_0xa1d8('0xc')](_0xa1d8('0x11'),auth[_0xa1d8('0xa')](),controller[_0xa1d8('0x12')]);router[_0xa1d8('0x13')]('/',auth[_0xa1d8('0xa')](),controller['create']);router[_0xa1d8('0x14')](_0xa1d8('0xd'),auth['isAuthenticated'](),controller[_0xa1d8('0x15')]);router[_0xa1d8('0x16')](_0xa1d8('0xd'),auth[_0xa1d8('0xa')](),controller[_0xa1d8('0x17')]);module[_0xa1d8('0x18')]=router; \ No newline at end of file +var _0x9f33=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9f33,0xaf));var _0x39f3=function(_0x524bf9,_0x47462b){_0x524bf9=_0x524bf9-0x0;var _0x550148=_0x9f33[_0x524bf9];return _0x550148;};'use strict';var multer=require(_0x39f3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x39f3('0x1'));var express=require(_0x39f3('0x2'));var router=express[_0x39f3('0x3')]();var auth=require(_0x39f3('0x4'));var interaction=require(_0x39f3('0x5'));var config=require(_0x39f3('0x6'));var controller=require(_0x39f3('0x7'));router[_0x39f3('0x8')]('/',auth[_0x39f3('0x9')](),controller['index']);router[_0x39f3('0x8')](_0x39f3('0xa'),auth['isAuthenticated'](),controller[_0x39f3('0xb')]);router[_0x39f3('0x8')](_0x39f3('0xc'),auth[_0x39f3('0x9')](),controller['getFields']);router[_0x39f3('0x8')](_0x39f3('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x39f3('0xe'),auth[_0x39f3('0x9')](),controller[_0x39f3('0xf')]);router['post']('/',auth[_0x39f3('0x9')](),controller[_0x39f3('0x10')]);router[_0x39f3('0x11')](_0x39f3('0xa'),auth[_0x39f3('0x9')](),controller[_0x39f3('0x12')]);router[_0x39f3('0x13')](_0x39f3('0xa'),auth[_0x39f3('0x9')](),controller[_0x39f3('0x14')]);module[_0x39f3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 023b05c..86f34ce 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 _0x3b6f=['STRING','ENUM','phonecall','incident','sequelize','exports'];(function(_0x8c91b3,_0x1ad126){var _0x96803d=function(_0x4cebd9){while(--_0x4cebd9){_0x8c91b3['push'](_0x8c91b3['shift']());}};_0x96803d(++_0x1ad126);}(_0x3b6f,0x1f0));var _0xf3b6=function(_0x472d94,_0x3d405a){_0x472d94=_0x472d94-0x0;var _0x36d41d=_0x3b6f[_0x472d94];return _0x36d41d;};'use strict';var Sequelize=require(_0xf3b6('0x0'));module[_0xf3b6('0x1')]={'name':{'type':Sequelize[_0xf3b6('0x2')]},'description':{'type':Sequelize[_0xf3b6('0x2')]},'ticketType':{'type':Sequelize[_0xf3b6('0x3')]('incident',_0xf3b6('0x4')),'defaultValue':_0xf3b6('0x5')}}; \ No newline at end of file +var _0x9451=['STRING','ENUM','incident','sequelize','exports'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0x9451,0x12f));var _0x1945=function(_0x329c8f,_0x2ce78c){_0x329c8f=_0x329c8f-0x0;var _0x1644bd=_0x9451[_0x329c8f];return _0x1644bd;};'use strict';var Sequelize=require(_0x1945('0x0'));module[_0x1945('0x1')]={'name':{'type':Sequelize[_0x1945('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x1945('0x3')](_0x1945('0x4'),'phonecall'),'defaultValue':_0x1945('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8535d04..400dc3c 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 _0x8c01=['../../mysqldb','jayson/promise','http','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','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','status','end','json','offset','limit','set','Content-Range','apply','save','update','stack','name','index','map','Dynamics365Configuration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','count','includeAll','findAll','rows','params','length','include','body','find','Dynamics365Field','pick','options','hasOwnProperty','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0x8c01,0xed));var _0x18c0=function(_0x282e44,_0x4f0355){_0x282e44=_0x282e44-0x0;var _0x36c239=_0x8c01[_0x282e44];return _0x36c239;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x18c0('0x0'));var rimraf=require(_0x18c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x18c0('0x2'));var rp=require(_0x18c0('0x3'));var moment=require(_0x18c0('0x4'));var BPromise=require(_0x18c0('0x5'));var Mustache=require(_0x18c0('0x6'));var util=require(_0x18c0('0x7'));var path=require(_0x18c0('0x8'));var sox=require(_0x18c0('0x9'));var csv=require(_0x18c0('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x18c0('0xb'));var squel=require(_0x18c0('0xc'));var crypto=require(_0x18c0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x18c0('0xe'));var toCsv=require(_0x18c0('0xa'));var querystring=require(_0x18c0('0xf'));var Papa=require(_0x18c0('0x10'));var Redis=require('ioredis');var authService=require(_0x18c0('0x11'));var qs=require(_0x18c0('0x12'));var as=require(_0x18c0('0x13'));var hardwareService=require(_0x18c0('0x14'));var logger=require('../../config/logger')(_0x18c0('0x15'));var utils=require(_0x18c0('0x16'));var config=require(_0x18c0('0x17'));var db=require(_0x18c0('0x18'))['db'];var jayson=require(_0x18c0('0x19'));var client=jayson['client'][_0x18c0('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x56f08f,_0x17481b,_0x23f3d7){if(_0x23f3d7){var _0x1dbbed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1dbbed['test'](_0x17481b)){return _0x56f08f;}else{throw new db[(_0x18c0('0x1b'))]['ValidationError'](_0x18c0('0x1c'));}}else{return _0x56f08f;}}function respondWithRpcPromise(_0x227cd6,_0x4aa350,_0x305962,_0x4d45fc){return new BPromise(function(_0x980bc4,_0x5b1a1f){var _0x39264b=_0x4d45fc||client;return _0x39264b[_0x18c0('0x1d')](_0x227cd6,_0x305962)[_0x18c0('0x1e')](function(_0x2f5878){logger[_0x18c0('0x1f')](_0x18c0('0x20'),_0x4aa350,_0x18c0('0x21'));logger[_0x18c0('0x22')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4aa350,_0x18c0('0x21'),JSON['stringify'](_0x2f5878));if(_0x2f5878[_0x18c0('0x23')]){if(_0x2f5878['error']['code']===0x1f4){logger[_0x18c0('0x23')](_0x18c0('0x20'),_0x4aa350,_0x2f5878[_0x18c0('0x23')]['message']);return _0x5b1a1f(_0x2f5878['error']['message']);}logger[_0x18c0('0x23')](_0x18c0('0x20'),_0x4aa350,_0x2f5878[_0x18c0('0x23')][_0x18c0('0x24')]);return _0x980bc4(_0x2f5878[_0x18c0('0x23')][_0x18c0('0x24')]);}else{logger[_0x18c0('0x1f')](_0x18c0('0x20'),_0x4aa350,_0x18c0('0x21'));_0x980bc4(_0x2f5878['result']['message']);}})[_0x18c0('0x25')](function(_0x328292){logger['error'](_0x18c0('0x20'),_0x4aa350,_0x328292);_0x5b1a1f(_0x328292);});});}function respondWithStatusCode(_0x2d15fe,_0x1f2a4e){_0x1f2a4e=_0x1f2a4e||0xcc;return function(_0x4a1fef){if(_0x4a1fef){return _0x2d15fe['sendStatus'](_0x1f2a4e);}return _0x2d15fe[_0x18c0('0x26')](_0x1f2a4e)[_0x18c0('0x27')]();};}function respondWithResult(_0x104abb,_0x2ed991){_0x2ed991=_0x2ed991||0xc8;return function(_0x246cb5){if(_0x246cb5){return _0x104abb['status'](_0x2ed991)[_0x18c0('0x28')](_0x246cb5);}};}function respondWithFilteredResult(_0x2eabb,_0x4bc5e5){return function(_0x4fbaf4){if(_0x4fbaf4){var _0x173df6=_0x4fbaf4['count'],_0x7c9389=_0x4bc5e5[_0x18c0('0x29')],_0x32ce82=_0x4bc5e5['offset']+_0x4bc5e5[_0x18c0('0x2a')],_0x4e4ee8;if(_0x32ce82>=_0x173df6){_0x32ce82=_0x173df6;_0x4e4ee8=0xc8;}else{_0x4e4ee8=0xce;}_0x2eabb[_0x18c0('0x26')](_0x4e4ee8);return _0x2eabb[_0x18c0('0x2b')](_0x18c0('0x2c'),_0x7c9389+'-'+_0x32ce82+'/'+_0x173df6)['json'](_0x4fbaf4);}return null;};}function patchUpdates(_0x3da275){return function(_0x2e122f){try{jsonpatch[_0x18c0('0x2d')](_0x2e122f,_0x3da275,!![]);}catch(_0x11f9bf){return BPromise['reject'](_0x11f9bf);}return _0x2e122f[_0x18c0('0x2e')]();};}function saveUpdates(_0x4e633c,_0x31ca44){return function(_0x48b089){if(_0x48b089){return _0x48b089[_0x18c0('0x2f')](_0x4e633c)[_0x18c0('0x1e')](function(_0x1de428){return _0x1de428;});}return null;};}function removeEntity(_0x2e8886,_0x390c4c){return function(_0x5a773a){if(_0x5a773a){return _0x5a773a['destroy']()['then'](function(){_0x2e8886[_0x18c0('0x26')](0xcc)[_0x18c0('0x27')]();});}};}function handleEntityNotFound(_0x34017c,_0x3f2360){return function(_0x3c1bd2){if(!_0x3c1bd2){_0x34017c['sendStatus'](0x194);}return _0x3c1bd2;};}function handleError(_0x543739,_0x4d6372){_0x4d6372=_0x4d6372||0x1f4;return function(_0x1f867b){logger[_0x18c0('0x23')](_0x1f867b[_0x18c0('0x30')]);if(_0x1f867b[_0x18c0('0x31')]){delete _0x1f867b[_0x18c0('0x31')];}_0x543739[_0x18c0('0x26')](_0x4d6372)['send'](_0x1f867b);};}exports[_0x18c0('0x32')]=function(_0x238064,_0x92fa75){var _0x41898f={},_0x41ea67={},_0xcc6951={'count':0x0,'rows':[]};var _0x2b7491=_[_0x18c0('0x33')](db[_0x18c0('0x34')][_0x18c0('0x35')],function(_0x5c8ebc){return{'name':_0x5c8ebc['fieldName'],'type':_0x5c8ebc[_0x18c0('0x36')][_0x18c0('0x37')]};});_0x41ea67[_0x18c0('0x38')]=_[_0x18c0('0x33')](_0x2b7491,_0x18c0('0x31'));_0x41ea67['query']=_[_0x18c0('0x39')](_0x238064[_0x18c0('0x3a')]);_0x41ea67[_0x18c0('0x3b')]=_[_0x18c0('0x3c')](_0x41ea67[_0x18c0('0x38')],_0x41ea67[_0x18c0('0x3a')]);_0x41898f[_0x18c0('0x3d')]=_['intersection'](_0x41ea67[_0x18c0('0x38')],qs[_0x18c0('0x3e')](_0x238064[_0x18c0('0x3a')]['fields']));_0x41898f[_0x18c0('0x3d')]=_0x41898f[_0x18c0('0x3d')]['length']?_0x41898f[_0x18c0('0x3d')]:_0x41ea67['model'];if(!_0x238064['query']['hasOwnProperty'](_0x18c0('0x3f'))){_0x41898f[_0x18c0('0x2a')]=qs['limit'](_0x238064[_0x18c0('0x3a')][_0x18c0('0x2a')]);_0x41898f['offset']=qs[_0x18c0('0x29')](_0x238064['query'][_0x18c0('0x29')]);}_0x41898f[_0x18c0('0x40')]=qs[_0x18c0('0x41')](_0x238064[_0x18c0('0x3a')][_0x18c0('0x41')]);_0x41898f[_0x18c0('0x42')]=qs['filters'](_['pick'](_0x238064['query'],_0x41ea67[_0x18c0('0x3b')]),_0x2b7491);if(_0x238064['query']['filter']){_0x41898f['where']=_[_0x18c0('0x43')](_0x41898f[_0x18c0('0x42')],{'$or':_[_0x18c0('0x33')](_0x2b7491,function(_0x416d94){if(_0x416d94[_0x18c0('0x36')]!==_0x18c0('0x44')){var _0x246876={};_0x246876[_0x416d94['name']]={'$like':'%'+_0x238064[_0x18c0('0x3a')][_0x18c0('0x45')]+'%'};return _0x246876;}})});}_0x41898f=_['merge']({},_0x41898f,_0x238064['options']);var _0x2142fe={'where':_0x41898f[_0x18c0('0x42')]};return db[_0x18c0('0x34')][_0x18c0('0x46')](_0x2142fe)[_0x18c0('0x1e')](function(_0x46bd89){_0xcc6951[_0x18c0('0x46')]=_0x46bd89;if(_0x238064[_0x18c0('0x3a')][_0x18c0('0x47')]){_0x41898f['include']=[{'all':!![]}];}return db[_0x18c0('0x34')][_0x18c0('0x48')](_0x41898f);})['then'](function(_0x2bf6be){_0xcc6951[_0x18c0('0x49')]=_0x2bf6be;return _0xcc6951;})[_0x18c0('0x1e')](respondWithFilteredResult(_0x92fa75,_0x41898f))[_0x18c0('0x25')](handleError(_0x92fa75,null));};exports['show']=function(_0x15a7ed,_0x58ba22){var _0x2a97d0={'raw':![],'where':{'id':_0x15a7ed[_0x18c0('0x4a')]['id']}},_0x490c2f={};_0x490c2f[_0x18c0('0x38')]=_[_0x18c0('0x39')](db[_0x18c0('0x34')]['rawAttributes']);_0x490c2f[_0x18c0('0x3a')]=_[_0x18c0('0x39')](_0x15a7ed[_0x18c0('0x3a')]);_0x490c2f[_0x18c0('0x3b')]=_[_0x18c0('0x3c')](_0x490c2f['model'],_0x490c2f[_0x18c0('0x3a')]);_0x2a97d0['attributes']=_[_0x18c0('0x3c')](_0x490c2f[_0x18c0('0x38')],qs[_0x18c0('0x3e')](_0x15a7ed[_0x18c0('0x3a')][_0x18c0('0x3e')]));_0x2a97d0['attributes']=_0x2a97d0[_0x18c0('0x3d')][_0x18c0('0x4b')]?_0x2a97d0[_0x18c0('0x3d')]:_0x490c2f[_0x18c0('0x38')];if(_0x15a7ed[_0x18c0('0x3a')][_0x18c0('0x47')]){_0x2a97d0[_0x18c0('0x4c')]=[{'all':!![]}];}_0x2a97d0=_[_0x18c0('0x43')]({},_0x2a97d0,_0x15a7ed['options']);return db[_0x18c0('0x34')]['find'](_0x2a97d0)[_0x18c0('0x1e')](handleEntityNotFound(_0x58ba22,null))[_0x18c0('0x1e')](respondWithResult(_0x58ba22,null))[_0x18c0('0x25')](handleError(_0x58ba22,null));};exports['create']=function(_0x5adffb,_0xe67995){return db['Dynamics365Configuration']['create'](_0x5adffb[_0x18c0('0x4d')],{})[_0x18c0('0x1e')](respondWithResult(_0xe67995,0xc9))['catch'](handleError(_0xe67995,null));};exports['update']=function(_0x2bfbfb,_0xedb9ec){if(_0x2bfbfb[_0x18c0('0x4d')]['id']){delete _0x2bfbfb[_0x18c0('0x4d')]['id'];}return db[_0x18c0('0x34')][_0x18c0('0x4e')]({'where':{'id':_0x2bfbfb[_0x18c0('0x4a')]['id']}})[_0x18c0('0x1e')](handleEntityNotFound(_0xedb9ec,null))[_0x18c0('0x1e')](saveUpdates(_0x2bfbfb[_0x18c0('0x4d')],null))[_0x18c0('0x1e')](respondWithResult(_0xedb9ec,null))[_0x18c0('0x25')](handleError(_0xedb9ec,null));};exports['destroy']=function(_0x426fc1,_0x2aa185){return db[_0x18c0('0x34')][_0x18c0('0x4e')]({'where':{'id':_0x426fc1[_0x18c0('0x4a')]['id']}})[_0x18c0('0x1e')](handleEntityNotFound(_0x2aa185,null))[_0x18c0('0x1e')](removeEntity(_0x2aa185,null))[_0x18c0('0x25')](handleError(_0x2aa185,null));};exports['getFields']=function(_0x174c5d,_0x137269,_0x5cf5a2){var _0x57b569={};var _0x4d2045={};var _0xc2eb56;var _0x100818;return db[_0x18c0('0x34')]['findOne']({'where':{'id':_0x174c5d[_0x18c0('0x4a')]['id']}})[_0x18c0('0x1e')](handleEntityNotFound(_0x137269,null))['then'](function(_0xdde928){if(_0xdde928){_0xc2eb56=_0xdde928;_0x4d2045['model']=_[_0x18c0('0x39')](db[_0x18c0('0x4f')][_0x18c0('0x35')]);_0x4d2045['query']=_[_0x18c0('0x39')](_0x174c5d[_0x18c0('0x3a')]);_0x4d2045[_0x18c0('0x3b')]=_[_0x18c0('0x3c')](_0x4d2045[_0x18c0('0x38')],_0x4d2045['query']);_0x57b569[_0x18c0('0x3d')]=_[_0x18c0('0x3c')](_0x4d2045[_0x18c0('0x38')],qs[_0x18c0('0x3e')](_0x174c5d[_0x18c0('0x3a')][_0x18c0('0x3e')]));_0x57b569[_0x18c0('0x3d')]=_0x57b569[_0x18c0('0x3d')][_0x18c0('0x4b')]?_0x57b569[_0x18c0('0x3d')]:_0x4d2045[_0x18c0('0x38')];_0x57b569[_0x18c0('0x40')]=qs[_0x18c0('0x41')](_0x174c5d[_0x18c0('0x3a')][_0x18c0('0x41')]);_0x57b569[_0x18c0('0x42')]=qs[_0x18c0('0x3b')](_[_0x18c0('0x50')](_0x174c5d[_0x18c0('0x3a')],_0x4d2045[_0x18c0('0x3b')]));if(_0x174c5d[_0x18c0('0x3a')][_0x18c0('0x45')]){_0x57b569['where']=_[_0x18c0('0x43')](_0x57b569['where'],{'$or':_['map'](_0x57b569[_0x18c0('0x3d')],function(_0x546bd7){var _0x5b3777={};_0x5b3777[_0x546bd7]={'$like':'%'+_0x174c5d['query'][_0x18c0('0x45')]+'%'};return _0x5b3777;})});}_0x57b569=_[_0x18c0('0x43')]({},_0x57b569,_0x174c5d[_0x18c0('0x51')]);return _0xc2eb56['getFields'](_0x57b569);}})[_0x18c0('0x1e')](function(_0x18b5ad){if(_0x18b5ad){_0x100818=_0x18b5ad[_0x18c0('0x4b')];if(!_0x174c5d[_0x18c0('0x3a')][_0x18c0('0x52')](_0x18c0('0x3f'))){_0x57b569[_0x18c0('0x2a')]=qs[_0x18c0('0x2a')](_0x174c5d[_0x18c0('0x3a')][_0x18c0('0x2a')]);_0x57b569[_0x18c0('0x29')]=qs['offset'](_0x174c5d[_0x18c0('0x3a')]['offset']);}return _0xc2eb56[_0x18c0('0x53')](_0x57b569);}})[_0x18c0('0x1e')](function(_0x18c7ea){if(_0x18c7ea){return _0x18c7ea?{'count':_0x100818,'rows':_0x18c7ea}:null;}})[_0x18c0('0x1e')](respondWithResult(_0x137269,null))[_0x18c0('0x25')](handleError(_0x137269,null));};exports['getSubjects']=function(_0x4bd257,_0x280425,_0x3b74d3){var _0x5924ad={};var _0x2ba3dc={};var _0x10c062;var _0x21dcc0;return db[_0x18c0('0x34')]['findOne']({'where':{'id':_0x4bd257[_0x18c0('0x4a')]['id']}})[_0x18c0('0x1e')](handleEntityNotFound(_0x280425,null))[_0x18c0('0x1e')](function(_0x37d0e8){if(_0x37d0e8){_0x10c062=_0x37d0e8;_0x2ba3dc['model']=_[_0x18c0('0x39')](db[_0x18c0('0x4f')][_0x18c0('0x35')]);_0x2ba3dc[_0x18c0('0x3a')]=_[_0x18c0('0x39')](_0x4bd257[_0x18c0('0x3a')]);_0x2ba3dc[_0x18c0('0x3b')]=_[_0x18c0('0x3c')](_0x2ba3dc[_0x18c0('0x38')],_0x2ba3dc[_0x18c0('0x3a')]);_0x5924ad[_0x18c0('0x3d')]=_[_0x18c0('0x3c')](_0x2ba3dc['model'],qs[_0x18c0('0x3e')](_0x4bd257['query'][_0x18c0('0x3e')]));_0x5924ad[_0x18c0('0x3d')]=_0x5924ad[_0x18c0('0x3d')][_0x18c0('0x4b')]?_0x5924ad[_0x18c0('0x3d')]:_0x2ba3dc['model'];_0x5924ad[_0x18c0('0x40')]=qs[_0x18c0('0x41')](_0x4bd257[_0x18c0('0x3a')]['sort']);_0x5924ad['where']=qs[_0x18c0('0x3b')](_[_0x18c0('0x50')](_0x4bd257[_0x18c0('0x3a')],_0x2ba3dc[_0x18c0('0x3b')]));if(_0x4bd257['query']['filter']){_0x5924ad[_0x18c0('0x42')]=_[_0x18c0('0x43')](_0x5924ad[_0x18c0('0x42')],{'$or':_[_0x18c0('0x33')](_0x5924ad['attributes'],function(_0x50d539){var _0x5185d1={};_0x5185d1[_0x50d539]={'$like':'%'+_0x4bd257[_0x18c0('0x3a')][_0x18c0('0x45')]+'%'};return _0x5185d1;})});}_0x5924ad=_[_0x18c0('0x43')]({},_0x5924ad,_0x4bd257[_0x18c0('0x51')]);return _0x10c062[_0x18c0('0x54')](_0x5924ad);}})[_0x18c0('0x1e')](function(_0x45712f){if(_0x45712f){_0x21dcc0=_0x45712f[_0x18c0('0x4b')];if(!_0x4bd257[_0x18c0('0x3a')][_0x18c0('0x52')](_0x18c0('0x3f'))){_0x5924ad['limit']=qs[_0x18c0('0x2a')](_0x4bd257[_0x18c0('0x3a')][_0x18c0('0x2a')]);_0x5924ad[_0x18c0('0x29')]=qs[_0x18c0('0x29')](_0x4bd257[_0x18c0('0x3a')][_0x18c0('0x29')]);}return _0x10c062[_0x18c0('0x54')](_0x5924ad);}})[_0x18c0('0x1e')](function(_0x6b7122){if(_0x6b7122){return _0x6b7122?{'count':_0x21dcc0,'rows':_0x6b7122}:null;}})['then'](respondWithResult(_0x280425,null))[_0x18c0('0x25')](handleError(_0x280425,null));};exports['getDescriptions']=function(_0x38bac6,_0x195f7f,_0x3194f2){var _0x418c26={};var _0x5589de={};var _0x3d3f81;var _0x4b4834;return db[_0x18c0('0x34')][_0x18c0('0x55')]({'where':{'id':_0x38bac6['params']['id']}})[_0x18c0('0x1e')](handleEntityNotFound(_0x195f7f,null))[_0x18c0('0x1e')](function(_0x4a76a6){if(_0x4a76a6){_0x3d3f81=_0x4a76a6;_0x5589de[_0x18c0('0x38')]=_[_0x18c0('0x39')](db[_0x18c0('0x4f')][_0x18c0('0x35')]);_0x5589de[_0x18c0('0x3a')]=_[_0x18c0('0x39')](_0x38bac6[_0x18c0('0x3a')]);_0x5589de[_0x18c0('0x3b')]=_[_0x18c0('0x3c')](_0x5589de[_0x18c0('0x38')],_0x5589de[_0x18c0('0x3a')]);_0x418c26['attributes']=_[_0x18c0('0x3c')](_0x5589de[_0x18c0('0x38')],qs['fields'](_0x38bac6[_0x18c0('0x3a')][_0x18c0('0x3e')]));_0x418c26['attributes']=_0x418c26[_0x18c0('0x3d')]['length']?_0x418c26[_0x18c0('0x3d')]:_0x5589de[_0x18c0('0x38')];_0x418c26['order']=qs[_0x18c0('0x41')](_0x38bac6[_0x18c0('0x3a')][_0x18c0('0x41')]);_0x418c26[_0x18c0('0x42')]=qs[_0x18c0('0x3b')](_[_0x18c0('0x50')](_0x38bac6['query'],_0x5589de[_0x18c0('0x3b')]));if(_0x38bac6[_0x18c0('0x3a')][_0x18c0('0x45')]){_0x418c26[_0x18c0('0x42')]=_['merge'](_0x418c26['where'],{'$or':_[_0x18c0('0x33')](_0x418c26['attributes'],function(_0x38ff41){var _0xd08569={};_0xd08569[_0x38ff41]={'$like':'%'+_0x38bac6[_0x18c0('0x3a')][_0x18c0('0x45')]+'%'};return _0xd08569;})});}_0x418c26=_['merge']({},_0x418c26,_0x38bac6[_0x18c0('0x51')]);return _0x3d3f81['getDescriptions'](_0x418c26);}})[_0x18c0('0x1e')](function(_0x4867a2){if(_0x4867a2){_0x4b4834=_0x4867a2[_0x18c0('0x4b')];if(!_0x38bac6['query'][_0x18c0('0x52')]('nolimit')){_0x418c26['limit']=qs['limit'](_0x38bac6[_0x18c0('0x3a')]['limit']);_0x418c26[_0x18c0('0x29')]=qs[_0x18c0('0x29')](_0x38bac6['query']['offset']);}return _0x3d3f81[_0x18c0('0x56')](_0x418c26);}})['then'](function(_0x56516f){if(_0x56516f){return _0x56516f?{'count':_0x4b4834,'rows':_0x56516f}:null;}})[_0x18c0('0x1e')](respondWithResult(_0x195f7f,null))[_0x18c0('0x25')](handleError(_0x195f7f,null));}; \ No newline at end of file +var _0x1eb6=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../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','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x260a00,_0x2aa098){var _0x33a78b=function(_0x63f550){while(--_0x63f550){_0x260a00['push'](_0x260a00['shift']());}};_0x33a78b(++_0x2aa098);}(_0x1eb6,0xbe));var _0x61eb=function(_0xe5c685,_0x10057f){_0xe5c685=_0xe5c685-0x0;var _0xfb4c85=_0x1eb6[_0xe5c685];return _0xfb4c85;};'use strict';var pdf=require(_0x61eb('0x0'));var emlformat=require(_0x61eb('0x1'));var rimraf=require(_0x61eb('0x2'));var zipdir=require(_0x61eb('0x3'));var jsonpatch=require(_0x61eb('0x4'));var rp=require(_0x61eb('0x5'));var moment=require(_0x61eb('0x6'));var BPromise=require(_0x61eb('0x7'));var Mustache=require(_0x61eb('0x8'));var util=require(_0x61eb('0x9'));var path=require(_0x61eb('0xa'));var sox=require(_0x61eb('0xb'));var csv=require(_0x61eb('0xc'));var ejs=require(_0x61eb('0xd'));var fs=require('fs');var _=require(_0x61eb('0xe'));var squel=require(_0x61eb('0xf'));var crypto=require('crypto');var jsforce=require(_0x61eb('0x10'));var deskjs=require(_0x61eb('0x11'));var toCsv=require(_0x61eb('0xc'));var querystring=require(_0x61eb('0x12'));var Papa=require(_0x61eb('0x13'));var Redis=require('ioredis');var authService=require(_0x61eb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x61eb('0x15'));var hardwareService=require(_0x61eb('0x16'));var logger=require(_0x61eb('0x17'))('api');var utils=require(_0x61eb('0x18'));var config=require('../../config/environment');var db=require(_0x61eb('0x19'))['db'];var jayson=require(_0x61eb('0x1a'));var client=jayson[_0x61eb('0x1b')][_0x61eb('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x598503,_0x5add20,_0x95e6cf){if(_0x95e6cf){var _0x331bd7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x331bd7[_0x61eb('0x1d')](_0x5add20)){return _0x598503;}else{throw new db[(_0x61eb('0x1e'))][(_0x61eb('0x1f'))](_0x61eb('0x20'));}}else{return _0x598503;}}function respondWithRpcPromise(_0x60ffd7,_0x5ca957,_0x85da26,_0x5ae79c){return new BPromise(function(_0x864f0c,_0x30f663){var _0x4ff524=_0x5ae79c||client;return _0x4ff524[_0x61eb('0x21')](_0x60ffd7,_0x85da26)['then'](function(_0x4c49aa){logger[_0x61eb('0x22')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5ca957,_0x61eb('0x23'));logger[_0x61eb('0x24')](_0x61eb('0x25'),_0x5ca957,_0x61eb('0x23'),JSON[_0x61eb('0x26')](_0x4c49aa));if(_0x4c49aa[_0x61eb('0x27')]){if(_0x4c49aa[_0x61eb('0x27')]['code']===0x1f4){logger[_0x61eb('0x27')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5ca957,_0x4c49aa[_0x61eb('0x27')][_0x61eb('0x28')]);return _0x30f663(_0x4c49aa[_0x61eb('0x27')][_0x61eb('0x28')]);}logger[_0x61eb('0x27')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5ca957,_0x4c49aa['error'][_0x61eb('0x28')]);return _0x864f0c(_0x4c49aa[_0x61eb('0x27')][_0x61eb('0x28')]);}else{logger[_0x61eb('0x22')](_0x61eb('0x29'),_0x5ca957,_0x61eb('0x23'));_0x864f0c(_0x4c49aa[_0x61eb('0x2a')][_0x61eb('0x28')]);}})[_0x61eb('0x2b')](function(_0x18b3e2){logger[_0x61eb('0x27')](_0x61eb('0x29'),_0x5ca957,_0x18b3e2);_0x30f663(_0x18b3e2);});});}function respondWithStatusCode(_0x25d371,_0x28e1e0){_0x28e1e0=_0x28e1e0||0xcc;return function(_0x3af6c6){if(_0x3af6c6){return _0x25d371[_0x61eb('0x2c')](_0x28e1e0);}return _0x25d371[_0x61eb('0x2d')](_0x28e1e0)[_0x61eb('0x2e')]();};}function respondWithResult(_0x3da84e,_0xf56d5d){_0xf56d5d=_0xf56d5d||0xc8;return function(_0xb6ddc3){if(_0xb6ddc3){return _0x3da84e[_0x61eb('0x2d')](_0xf56d5d)['json'](_0xb6ddc3);}};}function respondWithFilteredResult(_0x4b3c4b,_0x5d6696){return function(_0x3e296b){if(_0x3e296b){var _0x5619d1=_0x3e296b[_0x61eb('0x2f')],_0x547bc6=_0x5d6696['offset'],_0x398be7=_0x5d6696[_0x61eb('0x30')]+_0x5d6696[_0x61eb('0x31')],_0x457607;if(_0x398be7>=_0x5619d1){_0x398be7=_0x5619d1;_0x457607=0xc8;}else{_0x457607=0xce;}_0x4b3c4b['status'](_0x457607);return _0x4b3c4b[_0x61eb('0x32')](_0x61eb('0x33'),_0x547bc6+'-'+_0x398be7+'/'+_0x5619d1)['json'](_0x3e296b);}return null;};}function patchUpdates(_0x34379b){return function(_0x42372c){try{jsonpatch[_0x61eb('0x34')](_0x42372c,_0x34379b,!![]);}catch(_0x4127d7){return BPromise[_0x61eb('0x35')](_0x4127d7);}return _0x42372c['save']();};}function saveUpdates(_0x32d8d3,_0x453403){return function(_0x3e8185){if(_0x3e8185){return _0x3e8185[_0x61eb('0x36')](_0x32d8d3)['then'](function(_0x13cfd8){return _0x13cfd8;});}return null;};}function removeEntity(_0x3a4d92,_0x5c8784){return function(_0x3f1393){if(_0x3f1393){return _0x3f1393[_0x61eb('0x37')]()[_0x61eb('0x38')](function(){_0x3a4d92[_0x61eb('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x407d50,_0x5788f0){return function(_0x592604){if(!_0x592604){_0x407d50[_0x61eb('0x2c')](0x194);}return _0x592604;};}function handleError(_0x939084,_0x10a3c4){_0x10a3c4=_0x10a3c4||0x1f4;return function(_0x116915){logger[_0x61eb('0x27')](_0x116915[_0x61eb('0x39')]);if(_0x116915[_0x61eb('0x3a')]){delete _0x116915[_0x61eb('0x3a')];}_0x939084['status'](_0x10a3c4)['send'](_0x116915);};}exports[_0x61eb('0x3b')]=function(_0x413c0e,_0x223237){var _0xbe771f={},_0x128aee={},_0x7c1407={'count':0x0,'rows':[]};var _0x544044=_[_0x61eb('0x3c')](db[_0x61eb('0x3d')][_0x61eb('0x3e')],function(_0x4360d0){return{'name':_0x4360d0[_0x61eb('0x3f')],'type':_0x4360d0[_0x61eb('0x40')]['key']};});_0x128aee['model']=_[_0x61eb('0x3c')](_0x544044,_0x61eb('0x3a'));_0x128aee['query']=_[_0x61eb('0x41')](_0x413c0e[_0x61eb('0x42')]);_0x128aee[_0x61eb('0x43')]=_[_0x61eb('0x44')](_0x128aee[_0x61eb('0x45')],_0x128aee['query']);_0xbe771f[_0x61eb('0x46')]=_[_0x61eb('0x44')](_0x128aee[_0x61eb('0x45')],qs['fields'](_0x413c0e[_0x61eb('0x42')]['fields']));_0xbe771f[_0x61eb('0x46')]=_0xbe771f[_0x61eb('0x46')][_0x61eb('0x47')]?_0xbe771f[_0x61eb('0x46')]:_0x128aee[_0x61eb('0x45')];if(!_0x413c0e[_0x61eb('0x42')][_0x61eb('0x48')](_0x61eb('0x49'))){_0xbe771f[_0x61eb('0x31')]=qs[_0x61eb('0x31')](_0x413c0e[_0x61eb('0x42')]['limit']);_0xbe771f[_0x61eb('0x30')]=qs[_0x61eb('0x30')](_0x413c0e[_0x61eb('0x42')]['offset']);}_0xbe771f[_0x61eb('0x4a')]=qs[_0x61eb('0x4b')](_0x413c0e[_0x61eb('0x42')][_0x61eb('0x4b')]);_0xbe771f[_0x61eb('0x4c')]=qs[_0x61eb('0x43')](_[_0x61eb('0x4d')](_0x413c0e[_0x61eb('0x42')],_0x128aee['filters']),_0x544044);if(_0x413c0e[_0x61eb('0x42')][_0x61eb('0x4e')]){_0xbe771f[_0x61eb('0x4c')]=_[_0x61eb('0x4f')](_0xbe771f['where'],{'$or':_[_0x61eb('0x3c')](_0x544044,function(_0x3ad987){if(_0x3ad987['type']!==_0x61eb('0x50')){var _0x3723c1={};_0x3723c1[_0x3ad987[_0x61eb('0x3a')]]={'$like':'%'+_0x413c0e[_0x61eb('0x42')]['filter']+'%'};return _0x3723c1;}})});}_0xbe771f=_[_0x61eb('0x4f')]({},_0xbe771f,_0x413c0e[_0x61eb('0x51')]);var _0x3fdf29={'where':_0xbe771f[_0x61eb('0x4c')]};return db[_0x61eb('0x3d')]['count'](_0x3fdf29)[_0x61eb('0x38')](function(_0x387975){_0x7c1407[_0x61eb('0x2f')]=_0x387975;if(_0x413c0e[_0x61eb('0x42')][_0x61eb('0x52')]){_0xbe771f[_0x61eb('0x53')]=[{'all':!![]}];}return db[_0x61eb('0x3d')][_0x61eb('0x54')](_0xbe771f);})['then'](function(_0x1f81cc){_0x7c1407[_0x61eb('0x55')]=_0x1f81cc;return _0x7c1407;})[_0x61eb('0x38')](respondWithFilteredResult(_0x223237,_0xbe771f))[_0x61eb('0x2b')](handleError(_0x223237,null));};exports[_0x61eb('0x56')]=function(_0x4aee96,_0x27b850){var _0x48d96e={'raw':![],'where':{'id':_0x4aee96[_0x61eb('0x57')]['id']}},_0x4b97ad={};_0x4b97ad[_0x61eb('0x45')]=_[_0x61eb('0x41')](db['Dynamics365Configuration'][_0x61eb('0x3e')]);_0x4b97ad[_0x61eb('0x42')]=_[_0x61eb('0x41')](_0x4aee96[_0x61eb('0x42')]);_0x4b97ad[_0x61eb('0x43')]=_['intersection'](_0x4b97ad['model'],_0x4b97ad[_0x61eb('0x42')]);_0x48d96e[_0x61eb('0x46')]=_[_0x61eb('0x44')](_0x4b97ad[_0x61eb('0x45')],qs[_0x61eb('0x58')](_0x4aee96[_0x61eb('0x42')]['fields']));_0x48d96e['attributes']=_0x48d96e[_0x61eb('0x46')][_0x61eb('0x47')]?_0x48d96e[_0x61eb('0x46')]:_0x4b97ad[_0x61eb('0x45')];if(_0x4aee96[_0x61eb('0x42')][_0x61eb('0x52')]){_0x48d96e[_0x61eb('0x53')]=[{'all':!![]}];}_0x48d96e=_[_0x61eb('0x4f')]({},_0x48d96e,_0x4aee96[_0x61eb('0x51')]);return db['Dynamics365Configuration'][_0x61eb('0x59')](_0x48d96e)[_0x61eb('0x38')](handleEntityNotFound(_0x27b850,null))[_0x61eb('0x38')](respondWithResult(_0x27b850,null))[_0x61eb('0x2b')](handleError(_0x27b850,null));};exports[_0x61eb('0x5a')]=function(_0x4f99c4,_0x412650){return db[_0x61eb('0x3d')][_0x61eb('0x5a')](_0x4f99c4['body'],{})[_0x61eb('0x38')](respondWithResult(_0x412650,0xc9))[_0x61eb('0x2b')](handleError(_0x412650,null));};exports[_0x61eb('0x36')]=function(_0x2846c4,_0x35917a){if(_0x2846c4[_0x61eb('0x5b')]['id']){delete _0x2846c4[_0x61eb('0x5b')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x2846c4['params']['id']}})[_0x61eb('0x38')](handleEntityNotFound(_0x35917a,null))[_0x61eb('0x38')](saveUpdates(_0x2846c4[_0x61eb('0x5b')],null))[_0x61eb('0x38')](respondWithResult(_0x35917a,null))[_0x61eb('0x2b')](handleError(_0x35917a,null));};exports[_0x61eb('0x37')]=function(_0x47f66a,_0x3ac257){return db[_0x61eb('0x3d')][_0x61eb('0x59')]({'where':{'id':_0x47f66a[_0x61eb('0x57')]['id']}})[_0x61eb('0x38')](handleEntityNotFound(_0x3ac257,null))[_0x61eb('0x38')](removeEntity(_0x3ac257,null))[_0x61eb('0x2b')](handleError(_0x3ac257,null));};exports[_0x61eb('0x5c')]=function(_0xdf437b,_0x790881,_0x551c37){var _0x359306={};var _0x4488fa={};var _0x34ce3e;var _0x55da0d;return db[_0x61eb('0x3d')][_0x61eb('0x5d')]({'where':{'id':_0xdf437b[_0x61eb('0x57')]['id']}})[_0x61eb('0x38')](handleEntityNotFound(_0x790881,null))[_0x61eb('0x38')](function(_0x2f9591){if(_0x2f9591){_0x34ce3e=_0x2f9591;_0x4488fa[_0x61eb('0x45')]=_[_0x61eb('0x41')](db[_0x61eb('0x5e')][_0x61eb('0x3e')]);_0x4488fa[_0x61eb('0x42')]=_['keys'](_0xdf437b[_0x61eb('0x42')]);_0x4488fa[_0x61eb('0x43')]=_['intersection'](_0x4488fa[_0x61eb('0x45')],_0x4488fa[_0x61eb('0x42')]);_0x359306['attributes']=_[_0x61eb('0x44')](_0x4488fa[_0x61eb('0x45')],qs[_0x61eb('0x58')](_0xdf437b[_0x61eb('0x42')]['fields']));_0x359306[_0x61eb('0x46')]=_0x359306[_0x61eb('0x46')][_0x61eb('0x47')]?_0x359306[_0x61eb('0x46')]:_0x4488fa[_0x61eb('0x45')];_0x359306[_0x61eb('0x4a')]=qs[_0x61eb('0x4b')](_0xdf437b['query'][_0x61eb('0x4b')]);_0x359306[_0x61eb('0x4c')]=qs[_0x61eb('0x43')](_['pick'](_0xdf437b[_0x61eb('0x42')],_0x4488fa[_0x61eb('0x43')]));if(_0xdf437b[_0x61eb('0x42')][_0x61eb('0x4e')]){_0x359306[_0x61eb('0x4c')]=_[_0x61eb('0x4f')](_0x359306[_0x61eb('0x4c')],{'$or':_['map'](_0x359306[_0x61eb('0x46')],function(_0x1a8e04){var _0x455c42={};_0x455c42[_0x1a8e04]={'$like':'%'+_0xdf437b['query'][_0x61eb('0x4e')]+'%'};return _0x455c42;})});}_0x359306=_[_0x61eb('0x4f')]({},_0x359306,_0xdf437b['options']);return _0x34ce3e['getFields'](_0x359306);}})['then'](function(_0x24a7a8){if(_0x24a7a8){_0x55da0d=_0x24a7a8[_0x61eb('0x47')];if(!_0xdf437b[_0x61eb('0x42')]['hasOwnProperty'](_0x61eb('0x49'))){_0x359306[_0x61eb('0x31')]=qs[_0x61eb('0x31')](_0xdf437b[_0x61eb('0x42')][_0x61eb('0x31')]);_0x359306[_0x61eb('0x30')]=qs[_0x61eb('0x30')](_0xdf437b[_0x61eb('0x42')]['offset']);}return _0x34ce3e['getFields'](_0x359306);}})[_0x61eb('0x38')](function(_0x36b1d2){if(_0x36b1d2){return _0x36b1d2?{'count':_0x55da0d,'rows':_0x36b1d2}:null;}})['then'](respondWithResult(_0x790881,null))[_0x61eb('0x2b')](handleError(_0x790881,null));};exports[_0x61eb('0x5f')]=function(_0xeadd10,_0xc93f3e,_0x58cba6){var _0x225ebd={};var _0x4a9947={};var _0x13226e;var _0x50c2aa;return db[_0x61eb('0x3d')][_0x61eb('0x5d')]({'where':{'id':_0xeadd10['params']['id']}})[_0x61eb('0x38')](handleEntityNotFound(_0xc93f3e,null))[_0x61eb('0x38')](function(_0x6782c){if(_0x6782c){_0x13226e=_0x6782c;_0x4a9947[_0x61eb('0x45')]=_[_0x61eb('0x41')](db[_0x61eb('0x5e')][_0x61eb('0x3e')]);_0x4a9947[_0x61eb('0x42')]=_[_0x61eb('0x41')](_0xeadd10[_0x61eb('0x42')]);_0x4a9947[_0x61eb('0x43')]=_[_0x61eb('0x44')](_0x4a9947[_0x61eb('0x45')],_0x4a9947['query']);_0x225ebd[_0x61eb('0x46')]=_[_0x61eb('0x44')](_0x4a9947[_0x61eb('0x45')],qs['fields'](_0xeadd10[_0x61eb('0x42')]['fields']));_0x225ebd[_0x61eb('0x46')]=_0x225ebd[_0x61eb('0x46')]['length']?_0x225ebd[_0x61eb('0x46')]:_0x4a9947['model'];_0x225ebd[_0x61eb('0x4a')]=qs[_0x61eb('0x4b')](_0xeadd10[_0x61eb('0x42')]['sort']);_0x225ebd['where']=qs[_0x61eb('0x43')](_[_0x61eb('0x4d')](_0xeadd10[_0x61eb('0x42')],_0x4a9947[_0x61eb('0x43')]));if(_0xeadd10[_0x61eb('0x42')][_0x61eb('0x4e')]){_0x225ebd[_0x61eb('0x4c')]=_[_0x61eb('0x4f')](_0x225ebd[_0x61eb('0x4c')],{'$or':_['map'](_0x225ebd[_0x61eb('0x46')],function(_0x28e561){var _0x1462a2={};_0x1462a2[_0x28e561]={'$like':'%'+_0xeadd10['query'][_0x61eb('0x4e')]+'%'};return _0x1462a2;})});}_0x225ebd=_['merge']({},_0x225ebd,_0xeadd10[_0x61eb('0x51')]);return _0x13226e[_0x61eb('0x5f')](_0x225ebd);}})['then'](function(_0x136965){if(_0x136965){_0x50c2aa=_0x136965[_0x61eb('0x47')];if(!_0xeadd10[_0x61eb('0x42')]['hasOwnProperty'](_0x61eb('0x49'))){_0x225ebd['limit']=qs[_0x61eb('0x31')](_0xeadd10[_0x61eb('0x42')][_0x61eb('0x31')]);_0x225ebd[_0x61eb('0x30')]=qs[_0x61eb('0x30')](_0xeadd10[_0x61eb('0x42')]['offset']);}return _0x13226e[_0x61eb('0x5f')](_0x225ebd);}})['then'](function(_0x79be45){if(_0x79be45){return _0x79be45?{'count':_0x50c2aa,'rows':_0x79be45}:null;}})[_0x61eb('0x38')](respondWithResult(_0xc93f3e,null))[_0x61eb('0x2b')](handleError(_0xc93f3e,null));};exports[_0x61eb('0x60')]=function(_0x5970d3,_0x3ed674,_0x52b49b){var _0x1320e4={};var _0x16f3bf={};var _0x217530;var _0x4b8a0b;return db[_0x61eb('0x3d')][_0x61eb('0x5d')]({'where':{'id':_0x5970d3[_0x61eb('0x57')]['id']}})[_0x61eb('0x38')](handleEntityNotFound(_0x3ed674,null))['then'](function(_0x572578){if(_0x572578){_0x217530=_0x572578;_0x16f3bf[_0x61eb('0x45')]=_[_0x61eb('0x41')](db[_0x61eb('0x5e')][_0x61eb('0x3e')]);_0x16f3bf[_0x61eb('0x42')]=_[_0x61eb('0x41')](_0x5970d3[_0x61eb('0x42')]);_0x16f3bf[_0x61eb('0x43')]=_['intersection'](_0x16f3bf[_0x61eb('0x45')],_0x16f3bf['query']);_0x1320e4['attributes']=_[_0x61eb('0x44')](_0x16f3bf[_0x61eb('0x45')],qs['fields'](_0x5970d3['query'][_0x61eb('0x58')]));_0x1320e4['attributes']=_0x1320e4[_0x61eb('0x46')][_0x61eb('0x47')]?_0x1320e4[_0x61eb('0x46')]:_0x16f3bf[_0x61eb('0x45')];_0x1320e4[_0x61eb('0x4a')]=qs['sort'](_0x5970d3[_0x61eb('0x42')][_0x61eb('0x4b')]);_0x1320e4[_0x61eb('0x4c')]=qs[_0x61eb('0x43')](_[_0x61eb('0x4d')](_0x5970d3['query'],_0x16f3bf[_0x61eb('0x43')]));if(_0x5970d3[_0x61eb('0x42')]['filter']){_0x1320e4[_0x61eb('0x4c')]=_[_0x61eb('0x4f')](_0x1320e4[_0x61eb('0x4c')],{'$or':_[_0x61eb('0x3c')](_0x1320e4[_0x61eb('0x46')],function(_0x3dc194){var _0x4f57c0={};_0x4f57c0[_0x3dc194]={'$like':'%'+_0x5970d3[_0x61eb('0x42')][_0x61eb('0x4e')]+'%'};return _0x4f57c0;})});}_0x1320e4=_[_0x61eb('0x4f')]({},_0x1320e4,_0x5970d3['options']);return _0x217530[_0x61eb('0x60')](_0x1320e4);}})[_0x61eb('0x38')](function(_0x3da0a1){if(_0x3da0a1){_0x4b8a0b=_0x3da0a1[_0x61eb('0x47')];if(!_0x5970d3[_0x61eb('0x42')]['hasOwnProperty'](_0x61eb('0x49'))){_0x1320e4[_0x61eb('0x31')]=qs[_0x61eb('0x31')](_0x5970d3['query']['limit']);_0x1320e4[_0x61eb('0x30')]=qs[_0x61eb('0x30')](_0x5970d3[_0x61eb('0x42')][_0x61eb('0x30')]);}return _0x217530[_0x61eb('0x60')](_0x1320e4);}})[_0x61eb('0x38')](function(_0x1206f8){if(_0x1206f8){return _0x1206f8?{'count':_0x4b8a0b,'rows':_0x1206f8}:null;}})[_0x61eb('0x38')](respondWithResult(_0x3ed674,null))[_0x61eb('0x2b')](handleError(_0x3ed674,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4276407..352e5dc 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 _0x04f4=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x40b8d9,_0x3e6be4){var _0x51d349=function(_0x4804ba){while(--_0x4804ba){_0x40b8d9['push'](_0x40b8d9['shift']());}};_0x51d349(++_0x3e6be4);}(_0x04f4,0xa2));var _0x404f=function(_0x1680bc,_0x301d5d){_0x1680bc=_0x1680bc-0x0;var _0xa31eaf=_0x04f4[_0x1680bc];return _0xa31eaf;};'use strict';var _=require(_0x404f('0x0'));var util=require('util');var logger=require(_0x404f('0x1'))(_0x404f('0x2'));var moment=require(_0x404f('0x3'));var BPromise=require(_0x404f('0x4'));var rp=require(_0x404f('0x5'));var fs=require('fs');var path=require(_0x404f('0x6'));var rimraf=require(_0x404f('0x7'));var config=require(_0x404f('0x8'));var attributes=require(_0x404f('0x9'));module[_0x404f('0xa')]=function(_0x447ebd,_0x43a582){return _0x447ebd[_0x404f('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x404f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6ed=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util'];(function(_0x3439ef,_0x198707){var _0x3c7937=function(_0xaf5100){while(--_0xaf5100){_0x3439ef['push'](_0x3439ef['shift']());}};_0x3c7937(++_0x198707);}(_0xa6ed,0xb4));var _0xda6e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa6ed[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xda6e('0x0'));var util=require(_0xda6e('0x1'));var logger=require(_0xda6e('0x2'))(_0xda6e('0x3'));var moment=require(_0xda6e('0x4'));var BPromise=require(_0xda6e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda6e('0x6'));var rimraf=require(_0xda6e('0x7'));var config=require(_0xda6e('0x8'));var attributes=require(_0xda6e('0x9'));module[_0xda6e('0xa')]=function(_0x29a1e7,_0x3815aa){return _0x29a1e7[_0xda6e('0xb')](_0xda6e('0xc'),attributes,{'tableName':_0xda6e('0xd'),'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 6a32426..5474fc3 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 _0xcd79=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xcd79,0x1d2));var _0x9cd7=function(_0x1bd9d5,_0x2520aa){_0x1bd9d5=_0x1bd9d5-0x0;var _0x5ad760=_0xcd79[_0x1bd9d5];return _0x5ad760;};'use strict';var _=require(_0x9cd7('0x0'));var util=require(_0x9cd7('0x1'));var moment=require(_0x9cd7('0x2'));var BPromise=require(_0x9cd7('0x3'));var rs=require(_0x9cd7('0x4'));var fs=require('fs');var Redis=require(_0x9cd7('0x5'));var db=require(_0x9cd7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9cd7('0x7'));var jayson=require(_0x9cd7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14f1b0,_0x2413d9,_0x3859ac){return new BPromise(function(_0x5896c8,_0x2cea2a){return client[_0x9cd7('0x9')](_0x14f1b0,_0x3859ac)['then'](function(_0x24a90a){logger[_0x9cd7('0xa')](_0x9cd7('0xb'),_0x2413d9,_0x9cd7('0xc'));logger[_0x9cd7('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2413d9,_0x9cd7('0xc'),JSON[_0x9cd7('0xe')](_0x24a90a));if(_0x24a90a[_0x9cd7('0xf')]){if(_0x24a90a[_0x9cd7('0xf')][_0x9cd7('0x10')]===0x1f4){logger['error'](_0x9cd7('0xb'),_0x2413d9,_0x24a90a[_0x9cd7('0xf')][_0x9cd7('0x11')]);return _0x2cea2a(_0x24a90a[_0x9cd7('0xf')][_0x9cd7('0x11')]);}logger[_0x9cd7('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2413d9,_0x24a90a['error'][_0x9cd7('0x11')]);return _0x5896c8(_0x24a90a[_0x9cd7('0xf')][_0x9cd7('0x11')]);}else{logger[_0x9cd7('0xa')](_0x9cd7('0xb'),_0x2413d9,_0x9cd7('0xc'));_0x5896c8(_0x24a90a[_0x9cd7('0x12')][_0x9cd7('0x11')]);}})[_0x9cd7('0x13')](function(_0x2862e1){logger[_0x9cd7('0xf')](_0x9cd7('0xb'),_0x2413d9,_0x2862e1);_0x2cea2a(_0x2862e1);});});} \ No newline at end of file +var _0xf291=['client','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x581960,_0x1232ff){var _0x4ee892=function(_0x2a920d){while(--_0x2a920d){_0x581960['push'](_0x581960['shift']());}};_0x4ee892(++_0x1232ff);}(_0xf291,0x1db));var _0x1f29=function(_0x5d7c9f,_0x278f87){_0x5d7c9f=_0x5d7c9f-0x0;var _0x260dc1=_0xf291[_0x5d7c9f];return _0x260dc1;};'use strict';var _=require(_0x1f29('0x0'));var util=require(_0x1f29('0x1'));var moment=require(_0x1f29('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f29('0x3'));var fs=require('fs');var Redis=require(_0x1f29('0x4'));var db=require(_0x1f29('0x5'))['db'];var utils=require(_0x1f29('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1f29('0x7'));var client=jayson[_0x1f29('0x8')][_0x1f29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x173ee6,_0x2b8cc4,_0x3e48ae){return new BPromise(function(_0x3d4ca1,_0x5665b2){return client[_0x1f29('0xa')](_0x173ee6,_0x3e48ae)['then'](function(_0x380a8a){logger['info'](_0x1f29('0xb'),_0x2b8cc4,_0x1f29('0xc'));logger[_0x1f29('0xd')](_0x1f29('0xe'),_0x2b8cc4,'request\x20sent',JSON[_0x1f29('0xf')](_0x380a8a));if(_0x380a8a[_0x1f29('0x10')]){if(_0x380a8a[_0x1f29('0x10')][_0x1f29('0x11')]===0x1f4){logger['error'](_0x1f29('0xb'),_0x2b8cc4,_0x380a8a['error'][_0x1f29('0x12')]);return _0x5665b2(_0x380a8a[_0x1f29('0x10')][_0x1f29('0x12')]);}logger[_0x1f29('0x10')](_0x1f29('0xb'),_0x2b8cc4,_0x380a8a[_0x1f29('0x10')][_0x1f29('0x12')]);return _0x3d4ca1(_0x380a8a['error']['message']);}else{logger[_0x1f29('0x13')](_0x1f29('0xb'),_0x2b8cc4,_0x1f29('0xc'));_0x3d4ca1(_0x380a8a[_0x1f29('0x14')][_0x1f29('0x12')]);}})['catch'](function(_0x11b0ab){logger[_0x1f29('0x10')](_0x1f29('0xb'),_0x2b8cc4,_0x11b0ab);_0x5665b2(_0x11b0ab);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 80d7bed..b0587ac 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 _0x422f=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','connect-timeout','express','../../components/auth/service'];(function(_0x21a8ba,_0x2b09e1){var _0x1da12a=function(_0xb9a7f0){while(--_0xb9a7f0){_0x21a8ba['push'](_0x21a8ba['shift']());}};_0x1da12a(++_0x2b09e1);}(_0x422f,0x1c7));var _0xf422=function(_0x2a656b,_0x7f9ccf){_0x2a656b=_0x2a656b-0x0;var _0x4d90ce=_0x422f[_0x2a656b];return _0x4d90ce;};'use strict';var multer=require('multer');var util=require(_0xf422('0x0'));var path=require('path');var timeout=require(_0xf422('0x1'));var express=require(_0xf422('0x2'));var router=express['Router']();var auth=require(_0xf422('0x3'));var interaction=require(_0xf422('0x4'));var config=require(_0xf422('0x5'));var controller=require(_0xf422('0x6'));router[_0xf422('0x7')]('/',auth[_0xf422('0x8')](),controller[_0xf422('0x9')]);router[_0xf422('0x7')](_0xf422('0xa'),auth['isAuthenticated'](),controller[_0xf422('0xb')]);router[_0xf422('0xc')]('/',auth[_0xf422('0x8')](),controller[_0xf422('0xd')]);router[_0xf422('0xe')]('/:id',auth[_0xf422('0x8')](),controller['update']);router['delete'](_0xf422('0xa'),auth[_0xf422('0x8')](),controller[_0xf422('0xf')]);module[_0xf422('0x10')]=router; \ No newline at end of file +var _0x55ea=['update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x5d253d,_0x3b7676){var _0x3dcfed=function(_0x26e5d3){while(--_0x26e5d3){_0x5d253d['push'](_0x5d253d['shift']());}};_0x3dcfed(++_0x3b7676);}(_0x55ea,0xc9));var _0xa55e=function(_0x3871bb,_0x151b7a){_0x3871bb=_0x3871bb-0x0;var _0x438be8=_0x55ea[_0x3871bb];return _0x438be8;};'use strict';var multer=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var path=require(_0xa55e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa55e('0x3'));var router=express[_0xa55e('0x4')]();var auth=require(_0xa55e('0x5'));var interaction=require(_0xa55e('0x6'));var config=require(_0xa55e('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xa55e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xa55e('0x9')](),controller[_0xa55e('0xa')]);router[_0xa55e('0xb')]('/',auth[_0xa55e('0x9')](),controller[_0xa55e('0xc')]);router[_0xa55e('0xd')](_0xa55e('0xe'),auth[_0xa55e('0x9')](),controller[_0xa55e('0xf')]);router['delete']('/:id',auth[_0xa55e('0x9')](),controller[_0xa55e('0x10')]);module[_0xa55e('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 415ae68..691db06 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 _0xe97d=['exports','ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN'];(function(_0x59fca3,_0x376dd3){var _0x1d4906=function(_0x254ae6){while(--_0x254ae6){_0x59fca3['push'](_0x59fca3['shift']());}};_0x1d4906(++_0x376dd3);}(_0xe97d,0x178));var _0xde97=function(_0x284538,_0x54e438){_0x284538=_0x284538-0x0;var _0x5becaf=_0xe97d[_0x284538];return _0x5becaf;};'use strict';var Sequelize=require('sequelize');module[_0xde97('0x0')]={'type':{'type':Sequelize[_0xde97('0x1')](_0xde97('0x2'),_0xde97('0x3'),'customVariable',_0xde97('0x4')),'defaultValue':_0xde97('0x2')},'content':{'type':Sequelize[_0xde97('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xde97('0x3'),_0xde97('0x6'))},'keyContent':{'type':Sequelize[_0xde97('0x5')]},'idField':{'type':Sequelize[_0xde97('0x5')]},'nameField':{'type':Sequelize[_0xde97('0x5')]},'customField':{'type':Sequelize[_0xde97('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x28c4=['variable','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x18f40e,_0x77e3b5){var _0x67793a=function(_0xc69d6c){while(--_0xc69d6c){_0x18f40e['push'](_0x18f40e['shift']());}};_0x67793a(++_0x77e3b5);}(_0x28c4,0x99));var _0x428c=function(_0x149055,_0x42bd96){_0x149055=_0x149055-0x0;var _0x2862bf=_0x28c4[_0x149055];return _0x2862bf;};'use strict';var Sequelize=require('sequelize');module[_0x428c('0x0')]={'type':{'type':Sequelize[_0x428c('0x1')](_0x428c('0x2'),_0x428c('0x3'),'customVariable','keyValue'),'defaultValue':_0x428c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x428c('0x1')]('string',_0x428c('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x428c('0x4')]},'idField':{'type':Sequelize[_0x428c('0x4')]},'nameField':{'type':Sequelize[_0x428c('0x4')]},'customField':{'type':Sequelize[_0x428c('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x428c('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 69dbe23..3750266 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 _0x9ffd=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','destroy','then','error','name','send','index','map','Dynamics365Field','rawAttributes','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','intersection','length','includeAll','options','create','body','update','find','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel'];(function(_0x12c34e,_0x39287a){var _0x244e88=function(_0x34507b){while(--_0x34507b){_0x12c34e['push'](_0x12c34e['shift']());}};_0x244e88(++_0x39287a);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x67ac,_0x6b77c){_0x67ac=_0x67ac-0x0;var _0x389922=_0x9ffd[_0x67ac];return _0x389922;};'use strict';var pdf=require(_0xd9ff('0x0'));var emlformat=require(_0xd9ff('0x1'));var rimraf=require(_0xd9ff('0x2'));var zipdir=require(_0xd9ff('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x4'));var moment=require(_0xd9ff('0x5'));var BPromise=require(_0xd9ff('0x6'));var Mustache=require(_0xd9ff('0x7'));var util=require(_0xd9ff('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd9ff('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd9ff('0xa'));var squel=require(_0xd9ff('0xb'));var crypto=require('crypto');var jsforce=require(_0xd9ff('0xc'));var deskjs=require(_0xd9ff('0xd'));var toCsv=require(_0xd9ff('0x9'));var querystring=require(_0xd9ff('0xe'));var Papa=require('papaparse');var Redis=require(_0xd9ff('0xf'));var authService=require(_0xd9ff('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd9ff('0x12'));var db=require(_0xd9ff('0x13'))['db'];function respondWithStatusCode(_0x40c45c,_0x2bb498){_0x2bb498=_0x2bb498||0xcc;return function(_0x28c488){if(_0x28c488){return _0x40c45c[_0xd9ff('0x14')](_0x2bb498);}return _0x40c45c[_0xd9ff('0x15')](_0x2bb498)[_0xd9ff('0x16')]();};}function respondWithResult(_0x15d5e5,_0x1912fb){_0x1912fb=_0x1912fb||0xc8;return function(_0x470802){if(_0x470802){return _0x15d5e5[_0xd9ff('0x15')](_0x1912fb)[_0xd9ff('0x17')](_0x470802);}};}function respondWithFilteredResult(_0x2b682b,_0x3865d7){return function(_0x40ae90){if(_0x40ae90){var _0xa44d2e=_0x40ae90['count'],_0x34b515=_0x3865d7[_0xd9ff('0x18')],_0x19661c=_0x3865d7[_0xd9ff('0x18')]+_0x3865d7[_0xd9ff('0x19')],_0x177341;if(_0x19661c>=_0xa44d2e){_0x19661c=_0xa44d2e;_0x177341=0xc8;}else{_0x177341=0xce;}_0x2b682b[_0xd9ff('0x15')](_0x177341);return _0x2b682b[_0xd9ff('0x1a')]('Content-Range',_0x34b515+'-'+_0x19661c+'/'+_0xa44d2e)[_0xd9ff('0x17')](_0x40ae90);}return null;};}function patchUpdates(_0x1d88f1){return function(_0x3ea39b){try{jsonpatch[_0xd9ff('0x1b')](_0x3ea39b,_0x1d88f1,!![]);}catch(_0x5ed648){return BPromise[_0xd9ff('0x1c')](_0x5ed648);}return _0x3ea39b[_0xd9ff('0x1d')]();};}function saveUpdates(_0x1db9c2,_0x3bd1a9){return function(_0x200fb9){if(_0x200fb9){return _0x200fb9['update'](_0x1db9c2)['then'](function(_0x488059){return _0x488059;});}return null;};}function removeEntity(_0x5381c0,_0x54f9da){return function(_0x510b79){if(_0x510b79){return _0x510b79[_0xd9ff('0x1e')]()[_0xd9ff('0x1f')](function(){_0x5381c0[_0xd9ff('0x15')](0xcc)[_0xd9ff('0x16')]();});}};}function handleEntityNotFound(_0x746dc4,_0x446d1b){return function(_0x496bf0){if(!_0x496bf0){_0x746dc4[_0xd9ff('0x14')](0x194);}return _0x496bf0;};}function handleError(_0x56293d,_0x5e556f){_0x5e556f=_0x5e556f||0x1f4;return function(_0x497ac4){logger[_0xd9ff('0x20')](_0x497ac4['stack']);if(_0x497ac4[_0xd9ff('0x21')]){delete _0x497ac4[_0xd9ff('0x21')];}_0x56293d[_0xd9ff('0x15')](_0x5e556f)[_0xd9ff('0x22')](_0x497ac4);};}exports[_0xd9ff('0x23')]=function(_0x37325f,_0x142850){var _0x34964b={},_0x5b5fd4={},_0x12ed6f={'count':0x0,'rows':[]};var _0x5c02ac=_[_0xd9ff('0x24')](db[_0xd9ff('0x25')][_0xd9ff('0x26')],function(_0x542394){return{'name':_0x542394['fieldName'],'type':_0x542394['type'][_0xd9ff('0x27')]};});_0x5b5fd4['model']=_['map'](_0x5c02ac,_0xd9ff('0x21'));_0x5b5fd4[_0xd9ff('0x28')]=_[_0xd9ff('0x29')](_0x37325f['query']);_0x5b5fd4[_0xd9ff('0x2a')]=_['intersection'](_0x5b5fd4[_0xd9ff('0x2b')],_0x5b5fd4[_0xd9ff('0x28')]);_0x34964b[_0xd9ff('0x2c')]=_['intersection'](_0x5b5fd4[_0xd9ff('0x2b')],qs[_0xd9ff('0x2d')](_0x37325f[_0xd9ff('0x28')][_0xd9ff('0x2d')]));_0x34964b['attributes']=_0x34964b[_0xd9ff('0x2c')]['length']?_0x34964b[_0xd9ff('0x2c')]:_0x5b5fd4[_0xd9ff('0x2b')];if(!_0x37325f['query'][_0xd9ff('0x2e')](_0xd9ff('0x2f'))){_0x34964b[_0xd9ff('0x19')]=qs[_0xd9ff('0x19')](_0x37325f['query'][_0xd9ff('0x19')]);_0x34964b[_0xd9ff('0x18')]=qs[_0xd9ff('0x18')](_0x37325f['query'][_0xd9ff('0x18')]);}_0x34964b[_0xd9ff('0x30')]=qs[_0xd9ff('0x31')](_0x37325f[_0xd9ff('0x28')][_0xd9ff('0x31')]);_0x34964b[_0xd9ff('0x32')]=qs[_0xd9ff('0x2a')](_[_0xd9ff('0x33')](_0x37325f[_0xd9ff('0x28')],_0x5b5fd4['filters']),_0x5c02ac);if(_0x37325f[_0xd9ff('0x28')][_0xd9ff('0x34')]){_0x34964b['where']=_[_0xd9ff('0x35')](_0x34964b[_0xd9ff('0x32')],{'$or':_[_0xd9ff('0x24')](_0x5c02ac,function(_0x60d989){if(_0x60d989['type']!==_0xd9ff('0x36')){var _0x17b4e0={};_0x17b4e0[_0x60d989['name']]={'$like':'%'+_0x37325f['query'][_0xd9ff('0x34')]+'%'};return _0x17b4e0;}})});}_0x34964b=_[_0xd9ff('0x35')]({},_0x34964b,_0x37325f['options']);var _0x5324ff={'where':_0x34964b[_0xd9ff('0x32')]};return db['Dynamics365Field'][_0xd9ff('0x37')](_0x5324ff)[_0xd9ff('0x1f')](function(_0x4f990c){_0x12ed6f[_0xd9ff('0x37')]=_0x4f990c;if(_0x37325f[_0xd9ff('0x28')]['includeAll']){_0x34964b[_0xd9ff('0x38')]=[{'all':!![]}];}return db[_0xd9ff('0x25')][_0xd9ff('0x39')](_0x34964b);})[_0xd9ff('0x1f')](function(_0x3f1f39){_0x12ed6f[_0xd9ff('0x3a')]=_0x3f1f39;return _0x12ed6f;})[_0xd9ff('0x1f')](respondWithFilteredResult(_0x142850,_0x34964b))[_0xd9ff('0x3b')](handleError(_0x142850,null));};exports['show']=function(_0x472034,_0x4eeaaa){var _0x3e7d1c={'raw':!![],'where':{'id':_0x472034['params']['id']}},_0x39edfe={};_0x39edfe[_0xd9ff('0x2b')]=_[_0xd9ff('0x29')](db[_0xd9ff('0x25')][_0xd9ff('0x26')]);_0x39edfe[_0xd9ff('0x28')]=_[_0xd9ff('0x29')](_0x472034[_0xd9ff('0x28')]);_0x39edfe[_0xd9ff('0x2a')]=_[_0xd9ff('0x3c')](_0x39edfe[_0xd9ff('0x2b')],_0x39edfe['query']);_0x3e7d1c[_0xd9ff('0x2c')]=_[_0xd9ff('0x3c')](_0x39edfe[_0xd9ff('0x2b')],qs[_0xd9ff('0x2d')](_0x472034[_0xd9ff('0x28')]['fields']));_0x3e7d1c[_0xd9ff('0x2c')]=_0x3e7d1c[_0xd9ff('0x2c')][_0xd9ff('0x3d')]?_0x3e7d1c[_0xd9ff('0x2c')]:_0x39edfe['model'];if(_0x472034[_0xd9ff('0x28')][_0xd9ff('0x3e')]){_0x3e7d1c['include']=[{'all':!![]}];}_0x3e7d1c=_[_0xd9ff('0x35')]({},_0x3e7d1c,_0x472034[_0xd9ff('0x3f')]);return db['Dynamics365Field']['find'](_0x3e7d1c)[_0xd9ff('0x1f')](handleEntityNotFound(_0x4eeaaa,null))['then'](respondWithResult(_0x4eeaaa,null))[_0xd9ff('0x3b')](handleError(_0x4eeaaa,null));};exports[_0xd9ff('0x40')]=function(_0x546f36,_0x2ed6c1){return db['Dynamics365Field'][_0xd9ff('0x40')](_0x546f36[_0xd9ff('0x41')],{})['then'](respondWithResult(_0x2ed6c1,0xc9))[_0xd9ff('0x3b')](handleError(_0x2ed6c1,null));};exports[_0xd9ff('0x42')]=function(_0x11dd75,_0x5a8e96){if(_0x11dd75[_0xd9ff('0x41')]['id']){delete _0x11dd75[_0xd9ff('0x41')]['id'];}return db[_0xd9ff('0x25')][_0xd9ff('0x43')]({'where':{'id':_0x11dd75[_0xd9ff('0x44')]['id']}})[_0xd9ff('0x1f')](handleEntityNotFound(_0x5a8e96,null))[_0xd9ff('0x1f')](saveUpdates(_0x11dd75[_0xd9ff('0x41')],null))[_0xd9ff('0x1f')](respondWithResult(_0x5a8e96,null))[_0xd9ff('0x3b')](handleError(_0x5a8e96,null));};exports[_0xd9ff('0x1e')]=function(_0x1f4cc5,_0x1463da){return db['Dynamics365Field'][_0xd9ff('0x43')]({'where':{'id':_0x1f4cc5[_0xd9ff('0x44')]['id']}})[_0xd9ff('0x1f')](handleEntityNotFound(_0x1463da,null))[_0xd9ff('0x1f')](removeEntity(_0x1463da,null))['catch'](handleError(_0x1463da,null));}; \ No newline at end of file +var _0xd9ea=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Dynamics365Field','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','rawAttributes','includeAll','include','create','body','params','destroy','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1d4544,_0x1722f5){var _0x3f464d=function(_0x38a201){while(--_0x38a201){_0x1d4544['push'](_0x1d4544['shift']());}};_0x3f464d(++_0x1722f5);}(_0xd9ea,0x1c6));var _0xad9e=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xd9ea[_0x3f4891];return _0x54f2d8;};'use strict';var pdf=require(_0xad9e('0x0'));var emlformat=require(_0xad9e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xad9e('0x2'));var jsonpatch=require(_0xad9e('0x3'));var rp=require(_0xad9e('0x4'));var moment=require(_0xad9e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xad9e('0x6'));var path=require(_0xad9e('0x7'));var sox=require(_0xad9e('0x8'));var csv=require('to-csv');var ejs=require(_0xad9e('0x9'));var fs=require('fs');var _=require(_0xad9e('0xa'));var squel=require(_0xad9e('0xb'));var crypto=require(_0xad9e('0xc'));var jsforce=require(_0xad9e('0xd'));var deskjs=require(_0xad9e('0xe'));var toCsv=require(_0xad9e('0xf'));var querystring=require(_0xad9e('0x10'));var Papa=require(_0xad9e('0x11'));var Redis=require(_0xad9e('0x12'));var authService=require(_0xad9e('0x13'));var qs=require(_0xad9e('0x14'));var as=require(_0xad9e('0x15'));var hardwareService=require(_0xad9e('0x16'));var logger=require(_0xad9e('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xad9e('0x18'));var db=require(_0xad9e('0x19'))['db'];function respondWithStatusCode(_0x384840,_0x59b0bf){_0x59b0bf=_0x59b0bf||0xcc;return function(_0x2b4871){if(_0x2b4871){return _0x384840[_0xad9e('0x1a')](_0x59b0bf);}return _0x384840[_0xad9e('0x1b')](_0x59b0bf)[_0xad9e('0x1c')]();};}function respondWithResult(_0x94684e,_0x2bc675){_0x2bc675=_0x2bc675||0xc8;return function(_0x1229a2){if(_0x1229a2){return _0x94684e['status'](_0x2bc675)[_0xad9e('0x1d')](_0x1229a2);}};}function respondWithFilteredResult(_0x3251ee,_0x57818e){return function(_0x4b2e62){if(_0x4b2e62){var _0x25759b=_0x4b2e62[_0xad9e('0x1e')],_0xd952ec=_0x57818e[_0xad9e('0x1f')],_0x21e04d=_0x57818e[_0xad9e('0x1f')]+_0x57818e['limit'],_0x9eca5e;if(_0x21e04d>=_0x25759b){_0x21e04d=_0x25759b;_0x9eca5e=0xc8;}else{_0x9eca5e=0xce;}_0x3251ee[_0xad9e('0x1b')](_0x9eca5e);return _0x3251ee[_0xad9e('0x20')](_0xad9e('0x21'),_0xd952ec+'-'+_0x21e04d+'/'+_0x25759b)[_0xad9e('0x1d')](_0x4b2e62);}return null;};}function patchUpdates(_0x42b98b){return function(_0x48bfa8){try{jsonpatch[_0xad9e('0x22')](_0x48bfa8,_0x42b98b,!![]);}catch(_0x6e9431){return BPromise['reject'](_0x6e9431);}return _0x48bfa8[_0xad9e('0x23')]();};}function saveUpdates(_0x2aaf5e,_0x3af29e){return function(_0x17dd42){if(_0x17dd42){return _0x17dd42[_0xad9e('0x24')](_0x2aaf5e)[_0xad9e('0x25')](function(_0x37ef45){return _0x37ef45;});}return null;};}function removeEntity(_0x5061c5,_0x383cbf){return function(_0x1ff2f7){if(_0x1ff2f7){return _0x1ff2f7['destroy']()[_0xad9e('0x25')](function(){_0x5061c5[_0xad9e('0x1b')](0xcc)[_0xad9e('0x1c')]();});}};}function handleEntityNotFound(_0x28c347,_0x359bb2){return function(_0x326c43){if(!_0x326c43){_0x28c347[_0xad9e('0x1a')](0x194);}return _0x326c43;};}function handleError(_0x2885e4,_0x18a1b9){_0x18a1b9=_0x18a1b9||0x1f4;return function(_0x22d50e){logger[_0xad9e('0x26')](_0x22d50e[_0xad9e('0x27')]);if(_0x22d50e[_0xad9e('0x28')]){delete _0x22d50e[_0xad9e('0x28')];}_0x2885e4[_0xad9e('0x1b')](_0x18a1b9)[_0xad9e('0x29')](_0x22d50e);};}exports[_0xad9e('0x2a')]=function(_0x8e5fba,_0x5d87e5){var _0x455f87={},_0x568597={},_0x1f74be={'count':0x0,'rows':[]};var _0x357e5e=_[_0xad9e('0x2b')](db[_0xad9e('0x2c')]['rawAttributes'],function(_0x2b26d9){return{'name':_0x2b26d9[_0xad9e('0x2d')],'type':_0x2b26d9[_0xad9e('0x2e')][_0xad9e('0x2f')]};});_0x568597[_0xad9e('0x30')]=_['map'](_0x357e5e,_0xad9e('0x28'));_0x568597[_0xad9e('0x31')]=_[_0xad9e('0x32')](_0x8e5fba[_0xad9e('0x31')]);_0x568597[_0xad9e('0x33')]=_['intersection'](_0x568597[_0xad9e('0x30')],_0x568597['query']);_0x455f87[_0xad9e('0x34')]=_[_0xad9e('0x35')](_0x568597[_0xad9e('0x30')],qs['fields'](_0x8e5fba['query'][_0xad9e('0x36')]));_0x455f87['attributes']=_0x455f87[_0xad9e('0x34')][_0xad9e('0x37')]?_0x455f87[_0xad9e('0x34')]:_0x568597[_0xad9e('0x30')];if(!_0x8e5fba[_0xad9e('0x31')][_0xad9e('0x38')](_0xad9e('0x39'))){_0x455f87['limit']=qs[_0xad9e('0x3a')](_0x8e5fba[_0xad9e('0x31')][_0xad9e('0x3a')]);_0x455f87[_0xad9e('0x1f')]=qs['offset'](_0x8e5fba['query']['offset']);}_0x455f87[_0xad9e('0x3b')]=qs[_0xad9e('0x3c')](_0x8e5fba[_0xad9e('0x31')][_0xad9e('0x3c')]);_0x455f87[_0xad9e('0x3d')]=qs[_0xad9e('0x33')](_[_0xad9e('0x3e')](_0x8e5fba['query'],_0x568597['filters']),_0x357e5e);if(_0x8e5fba[_0xad9e('0x31')][_0xad9e('0x3f')]){_0x455f87['where']=_['merge'](_0x455f87[_0xad9e('0x3d')],{'$or':_[_0xad9e('0x2b')](_0x357e5e,function(_0x23782e){if(_0x23782e['type']!==_0xad9e('0x40')){var _0x4c4cd6={};_0x4c4cd6[_0x23782e[_0xad9e('0x28')]]={'$like':'%'+_0x8e5fba['query'][_0xad9e('0x3f')]+'%'};return _0x4c4cd6;}})});}_0x455f87=_[_0xad9e('0x41')]({},_0x455f87,_0x8e5fba[_0xad9e('0x42')]);var _0x34ecee={'where':_0x455f87[_0xad9e('0x3d')]};return db[_0xad9e('0x2c')][_0xad9e('0x1e')](_0x34ecee)['then'](function(_0x42ec95){_0x1f74be[_0xad9e('0x1e')]=_0x42ec95;if(_0x8e5fba[_0xad9e('0x31')]['includeAll']){_0x455f87['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xad9e('0x43')](_0x455f87);})[_0xad9e('0x25')](function(_0x855fac){_0x1f74be[_0xad9e('0x44')]=_0x855fac;return _0x1f74be;})[_0xad9e('0x25')](respondWithFilteredResult(_0x5d87e5,_0x455f87))[_0xad9e('0x45')](handleError(_0x5d87e5,null));};exports[_0xad9e('0x46')]=function(_0x3efa8f,_0x360ea6){var _0x53dabb={'raw':!![],'where':{'id':_0x3efa8f['params']['id']}},_0x5484d7={};_0x5484d7[_0xad9e('0x30')]=_[_0xad9e('0x32')](db[_0xad9e('0x2c')][_0xad9e('0x47')]);_0x5484d7['query']=_[_0xad9e('0x32')](_0x3efa8f['query']);_0x5484d7['filters']=_[_0xad9e('0x35')](_0x5484d7['model'],_0x5484d7[_0xad9e('0x31')]);_0x53dabb[_0xad9e('0x34')]=_[_0xad9e('0x35')](_0x5484d7[_0xad9e('0x30')],qs[_0xad9e('0x36')](_0x3efa8f[_0xad9e('0x31')]['fields']));_0x53dabb[_0xad9e('0x34')]=_0x53dabb[_0xad9e('0x34')][_0xad9e('0x37')]?_0x53dabb[_0xad9e('0x34')]:_0x5484d7['model'];if(_0x3efa8f[_0xad9e('0x31')][_0xad9e('0x48')]){_0x53dabb[_0xad9e('0x49')]=[{'all':!![]}];}_0x53dabb=_[_0xad9e('0x41')]({},_0x53dabb,_0x3efa8f[_0xad9e('0x42')]);return db[_0xad9e('0x2c')]['find'](_0x53dabb)[_0xad9e('0x25')](handleEntityNotFound(_0x360ea6,null))[_0xad9e('0x25')](respondWithResult(_0x360ea6,null))[_0xad9e('0x45')](handleError(_0x360ea6,null));};exports[_0xad9e('0x4a')]=function(_0x59fcbd,_0x40c1f2){return db[_0xad9e('0x2c')][_0xad9e('0x4a')](_0x59fcbd[_0xad9e('0x4b')],{})[_0xad9e('0x25')](respondWithResult(_0x40c1f2,0xc9))[_0xad9e('0x45')](handleError(_0x40c1f2,null));};exports['update']=function(_0x4b73a2,_0x35bbd2){if(_0x4b73a2[_0xad9e('0x4b')]['id']){delete _0x4b73a2[_0xad9e('0x4b')]['id'];}return db[_0xad9e('0x2c')]['find']({'where':{'id':_0x4b73a2[_0xad9e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x35bbd2,null))[_0xad9e('0x25')](saveUpdates(_0x4b73a2[_0xad9e('0x4b')],null))['then'](respondWithResult(_0x35bbd2,null))['catch'](handleError(_0x35bbd2,null));};exports[_0xad9e('0x4d')]=function(_0x47f8a2,_0x3f14cf){return db[_0xad9e('0x2c')][_0xad9e('0x4e')]({'where':{'id':_0x47f8a2[_0xad9e('0x4c')]['id']}})[_0xad9e('0x25')](handleEntityNotFound(_0x3f14cf,null))[_0xad9e('0x25')](removeEntity(_0x3f14cf,null))[_0xad9e('0x45')](handleError(_0x3f14cf,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a6b8802..83e5278 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 _0xabe6=['int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0xabe6,0x6d));var _0x6abe=function(_0x119463,_0xb41dab){_0x119463=_0x119463-0x0;var _0x498ed6=_0xabe6[_0x119463];return _0x498ed6;};'use strict';var _=require(_0x6abe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6abe('0x1'));var moment=require(_0x6abe('0x2'));var BPromise=require(_0x6abe('0x3'));var rp=require(_0x6abe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6abe('0x5'));var config=require(_0x6abe('0x6'));var attributes=require(_0x6abe('0x7'));module[_0x6abe('0x8')]=function(_0x59b5c1,_0x3ec53f){return _0x59b5c1[_0x6abe('0x9')](_0x6abe('0xa'),attributes,{'tableName':_0x6abe('0xb'),'paranoid':![],'indexes':[{'name':_0x6abe('0xc'),'fields':[_0x6abe('0xd'),_0x6abe('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x169a=['bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','../../config/logger','api','moment'];(function(_0x5117d0,_0x2066b7){var _0x1ff076=function(_0x2113bd){while(--_0x2113bd){_0x5117d0['push'](_0x5117d0['shift']());}};_0x1ff076(++_0x2066b7);}(_0x169a,0x11c));var _0xa169=function(_0x47b41e,_0xe6572d){_0x47b41e=_0x47b41e-0x0;var _0x3ebcaa=_0x169a[_0x47b41e];return _0x3ebcaa;};'use strict';var _=require(_0xa169('0x0'));var util=require('util');var logger=require(_0xa169('0x1'))(_0xa169('0x2'));var moment=require(_0xa169('0x3'));var BPromise=require(_0xa169('0x4'));var rp=require(_0xa169('0x5'));var fs=require('fs');var path=require(_0xa169('0x6'));var rimraf=require(_0xa169('0x7'));var config=require(_0xa169('0x8'));var attributes=require(_0xa169('0x9'));module[_0xa169('0xa')]=function(_0x228b3b,_0x2e2355){return _0x228b3b[_0xa169('0xb')](_0xa169('0xc'),attributes,{'tableName':_0xa169('0xd'),'paranoid':![],'indexes':[{'name':_0xa169('0xe'),'fields':['idField',_0xa169('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 4155aa2..0902718 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 _0xdc59=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x36862d,_0x4f5d23){var _0x3aa4b9=function(_0x111477){while(--_0x111477){_0x36862d['push'](_0x36862d['shift']());}};_0x3aa4b9(++_0x4f5d23);}(_0xdc59,0x12c));var _0x9dc5=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xdc59[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var moment=require(_0x9dc5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc5('0x3'));var db=require(_0x9dc5('0x4'))['db'];var utils=require(_0x9dc5('0x5'));var logger=require(_0x9dc5('0x6'))(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var jayson=require(_0x9dc5('0x9'));var client=jayson[_0x9dc5('0xa')][_0x9dc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48beee,_0x42941b,_0x10b268){return new BPromise(function(_0x202a8a,_0x3729b6){return client[_0x9dc5('0xc')](_0x48beee,_0x10b268)[_0x9dc5('0xd')](function(_0x174835){logger[_0x9dc5('0xe')](_0x9dc5('0xf'),_0x42941b,_0x9dc5('0x10'));logger['debug'](_0x9dc5('0x11'),_0x42941b,_0x9dc5('0x10'),JSON[_0x9dc5('0x12')](_0x174835));if(_0x174835[_0x9dc5('0x13')]){if(_0x174835['error'][_0x9dc5('0x14')]===0x1f4){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835['error'][_0x9dc5('0x15')]);return _0x3729b6(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);return _0x202a8a(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}else{logger[_0x9dc5('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x42941b,_0x9dc5('0x10'));_0x202a8a(_0x174835['result'][_0x9dc5('0x15')]);}})[_0x9dc5('0x16')](function(_0x5a9ffb){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x5a9ffb);_0x3729b6(_0x5a9ffb);});});} \ No newline at end of file +var _0xc21e=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x2c523a,_0x5ac80f){var _0x3334ca=function(_0x48c686){while(--_0x48c686){_0x2c523a['push'](_0x2c523a['shift']());}};_0x3334ca(++_0x5ac80f);}(_0xc21e,0x1ca));var _0xec21=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc21e[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xec21('0x0'));var moment=require(_0xec21('0x1'));var BPromise=require(_0xec21('0x2'));var rs=require(_0xec21('0x3'));var fs=require('fs');var Redis=require(_0xec21('0x4'));var db=require(_0xec21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec21('0x6'))(_0xec21('0x7'));var config=require(_0xec21('0x8'));var jayson=require(_0xec21('0x9'));var client=jayson[_0xec21('0xa')][_0xec21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x406b66,_0x2f15e7,_0x51f6dc){return new BPromise(function(_0x2b1396,_0x3d74a2){return client[_0xec21('0xc')](_0x406b66,_0x51f6dc)[_0xec21('0xd')](function(_0x4d478){logger['info'](_0xec21('0xe'),_0x2f15e7,_0xec21('0xf'));logger[_0xec21('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x2f15e7,'request\x20sent',JSON[_0xec21('0x11')](_0x4d478));if(_0x4d478[_0xec21('0x12')]){if(_0x4d478['error'][_0xec21('0x13')]===0x1f4){logger[_0xec21('0x12')](_0xec21('0xe'),_0x2f15e7,_0x4d478[_0xec21('0x12')][_0xec21('0x14')]);return _0x3d74a2(_0x4d478['error'][_0xec21('0x14')]);}logger['error'](_0xec21('0xe'),_0x2f15e7,_0x4d478[_0xec21('0x12')][_0xec21('0x14')]);return _0x2b1396(_0x4d478['error'][_0xec21('0x14')]);}else{logger[_0xec21('0x15')](_0xec21('0xe'),_0x2f15e7,_0xec21('0xf'));_0x2b1396(_0x4d478[_0xec21('0x16')][_0xec21('0x14')]);}})[_0xec21('0x17')](function(_0x350a53){logger['error'](_0xec21('0xe'),_0x2f15e7,_0x350a53);_0x3d74a2(_0x350a53);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 0e67a86..6b9a5bd 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 _0x25e9=['post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields'];(function(_0x1760a7,_0x18c79b){var _0x384ac0=function(_0x21d5fa){while(--_0x21d5fa){_0x1760a7['push'](_0x1760a7['shift']());}};_0x384ac0(++_0x18c79b);}(_0x25e9,0x133));var _0x925e=function(_0xaf8280,_0x5c1176){_0xaf8280=_0xaf8280-0x0;var _0x1b92a5=_0x25e9[_0xaf8280];return _0x1b92a5;};'use strict';var multer=require(_0x925e('0x0'));var util=require(_0x925e('0x1'));var path=require(_0x925e('0x2'));var timeout=require('connect-timeout');var express=require(_0x925e('0x3'));var router=express[_0x925e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x925e('0x5'));var config=require(_0x925e('0x6'));var controller=require(_0x925e('0x7'));router[_0x925e('0x8')]('/',auth[_0x925e('0x9')](),controller[_0x925e('0xa')]);router[_0x925e('0x8')]('/:id',auth[_0x925e('0x9')](),controller[_0x925e('0xb')]);router[_0x925e('0x8')](_0x925e('0xc'),auth[_0x925e('0x9')](),controller['getConfigurations']);router['get'](_0x925e('0xd'),auth[_0x925e('0x9')](),controller[_0x925e('0xe')]);router[_0x925e('0xf')]('/',auth[_0x925e('0x9')](),controller[_0x925e('0x10')]);router[_0x925e('0xf')](_0x925e('0xc'),auth[_0x925e('0x9')](),controller[_0x925e('0x11')]);router[_0x925e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x925e('0x13')]);router[_0x925e('0x14')]('/:id',auth[_0x925e('0x9')](),controller[_0x925e('0x15')]);module[_0x925e('0x16')]=router; \ No newline at end of file +var _0x4c7e=['post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','getFields'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x4c7e,0x153));var _0xe4c7=function(_0x125c6b,_0x3396bd){_0x125c6b=_0x125c6b-0x0;var _0x49b36f=_0x4c7e[_0x125c6b];return _0x49b36f;};'use strict';var multer=require('multer');var util=require(_0xe4c7('0x0'));var path=require(_0xe4c7('0x1'));var timeout=require(_0xe4c7('0x2'));var express=require('express');var router=express[_0xe4c7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe4c7('0x4'));var config=require(_0xe4c7('0x5'));var controller=require(_0xe4c7('0x6'));router[_0xe4c7('0x7')]('/',auth[_0xe4c7('0x8')](),controller['index']);router[_0xe4c7('0x7')](_0xe4c7('0x9'),auth[_0xe4c7('0x8')](),controller[_0xe4c7('0xa')]);router[_0xe4c7('0x7')]('/:id/configurations',auth[_0xe4c7('0x8')](),controller[_0xe4c7('0xb')]);router[_0xe4c7('0x7')]('/:id/fields',auth[_0xe4c7('0x8')](),controller[_0xe4c7('0xc')]);router[_0xe4c7('0xd')]('/',auth['isAuthenticated'](),controller[_0xe4c7('0xe')]);router[_0xe4c7('0xd')](_0xe4c7('0xf'),auth['isAuthenticated'](),controller[_0xe4c7('0x10')]);router[_0xe4c7('0x11')](_0xe4c7('0x9'),auth['isAuthenticated'](),controller[_0xe4c7('0x12')]);router[_0xe4c7('0x13')]('/:id',auth[_0xe4c7('0x8')](),controller[_0xe4c7('0x14')]);module[_0xe4c7('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 0f38411..aa24b8e 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 _0x01d3=['username','remoteUri','sequelize','exports','STRING'];(function(_0x58b25d,_0x4a332e){var _0x45289e=function(_0x33c280){while(--_0x33c280){_0x58b25d['push'](_0x58b25d['shift']());}};_0x45289e(++_0x4a332e);}(_0x01d3,0xa2));var _0x301d=function(_0x5b8064,_0x18e7e2){_0x5b8064=_0x5b8064-0x0;var _0x111d62=_0x01d3[_0x5b8064];return _0x111d62;};'use strict';var Sequelize=require(_0x301d('0x0'));module[_0x301d('0x1')]={'name':{'type':Sequelize[_0x301d('0x2')]},'description':{'type':Sequelize[_0x301d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x301d('0x3')},'apiKey':{'type':Sequelize[_0x301d('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x301d('0x4')},'serverUrl':{'type':Sequelize[_0x301d('0x2')]}}; \ No newline at end of file +var _0x9a2a=['exports','STRING','remoteUri','sequelize'];(function(_0x12719b,_0xab3b77){var _0x4846d4=function(_0x1b96a3){while(--_0x1b96a3){_0x12719b['push'](_0x12719b['shift']());}};_0x4846d4(++_0xab3b77);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x29bcd1,_0x321aab){_0x29bcd1=_0x29bcd1-0x0;var _0xe7f9cb=_0x9a2a[_0x29bcd1];return _0xe7f9cb;};'use strict';var Sequelize=require(_0xa9a2('0x0'));module[_0xa9a2('0x1')]={'name':{'type':Sequelize[_0xa9a2('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0xa9a2('0x2')]},'remoteUri':{'type':Sequelize[_0xa9a2('0x2')],'unique':_0xa9a2('0x3')},'serverUrl':{'type':Sequelize[_0xa9a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 29acf89..4bee6a1 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 _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(_0x31a9bc,_0x144bc6){var _0x18caea=function(_0x33225e){while(--_0x33225e){_0x31a9bc['push'](_0x31a9bc['shift']());}};_0x18caea(++_0x144bc6);}(_0xabce,0x103));var _0xeabc=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xabce[_0x543084];return _0x306a57;};'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 +var _0xe14b=['apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','priority','group','ticket_type','company','includes','default','custom_text','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','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','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','show','params','include','find','create','body','update','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri'];(function(_0x2424cd,_0x3c838f){var _0x380ca8=function(_0x2bc0b6){while(--_0x2bc0b6){_0x2424cd['push'](_0x2424cd['shift']());}};_0x380ca8(++_0x3c838f);}(_0xe14b,0x93));var _0xbe14=function(_0x4b3559,_0x49f1af){_0x4b3559=_0x4b3559-0x0;var _0x40ee97=_0xe14b[_0x4b3559];return _0x40ee97;};'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 integrations=require(_0xbe14('0x15'));var jayson=require(_0xbe14('0x16'));var client=jayson[_0xbe14('0x17')][_0xbe14('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2850cb,_0x16893f,_0xa2cf72){if(_0xa2cf72){var _0x1e4826=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e4826[_0xbe14('0x19')](_0x16893f)){return _0x2850cb;}else{throw new db[(_0xbe14('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 _0x2850cb;}}function respondWithRpcPromise(_0x3f58f5,_0x3dc4a9,_0xf4ac9,_0x37ce4e){return new BPromise(function(_0x4e8f34,_0x21c789){var _0xe9c3ec=_0x37ce4e||client;return _0xe9c3ec[_0xbe14('0x1b')](_0x3f58f5,_0xf4ac9)[_0xbe14('0x1c')](function(_0x38f1ea){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');logger[_0xbe14('0x1f')](_0xbe14('0x20'),_0x3dc4a9,_0xbe14('0x21'),JSON[_0xbe14('0x22')](_0x38f1ea));if(_0x38f1ea[_0xbe14('0x23')]){if(_0x38f1ea[_0xbe14('0x23')]['code']===0x1f4){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')][_0xbe14('0x24')]);return _0x21c789(_0x38f1ea[_0xbe14('0x23')]['message']);}logger[_0xbe14('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')]['message']);return _0x4e8f34(_0x38f1ea[_0xbe14('0x23')]['message']);}else{logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');_0x4e8f34(_0x38f1ea[_0xbe14('0x25')]['message']);}})[_0xbe14('0x26')](function(_0x4851f8){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x4851f8);_0x21c789(_0x4851f8);});});}function respondWithStatusCode(_0x1ee9c1,_0x39cc81){_0x39cc81=_0x39cc81||0xcc;return function(_0x15ef02){if(_0x15ef02){return _0x1ee9c1[_0xbe14('0x27')](_0x39cc81);}return _0x1ee9c1['status'](_0x39cc81)[_0xbe14('0x28')]();};}function respondWithResult(_0x1ba46a,_0x391556){_0x391556=_0x391556||0xc8;return function(_0x169369){if(_0x169369){return _0x1ba46a['status'](_0x391556)[_0xbe14('0x29')](_0x169369);}};}function respondWithFilteredResult(_0x29fc64,_0x59bf34){return function(_0x3c3613){if(_0x3c3613){var _0x3b3e84=_0x3c3613[_0xbe14('0x2a')],_0x1c7cc7=_0x59bf34[_0xbe14('0x2b')],_0x19252f=_0x59bf34[_0xbe14('0x2b')]+_0x59bf34[_0xbe14('0x2c')],_0x34d648;if(_0x19252f>=_0x3b3e84){_0x19252f=_0x3b3e84;_0x34d648=0xc8;}else{_0x34d648=0xce;}_0x29fc64[_0xbe14('0x2d')](_0x34d648);return _0x29fc64[_0xbe14('0x2e')](_0xbe14('0x2f'),_0x1c7cc7+'-'+_0x19252f+'/'+_0x3b3e84)[_0xbe14('0x29')](_0x3c3613);}return null;};}function patchUpdates(_0x10ae36){return function(_0x223f7a){try{jsonpatch[_0xbe14('0x30')](_0x223f7a,_0x10ae36,!![]);}catch(_0x6ba36c){return BPromise[_0xbe14('0x31')](_0x6ba36c);}return _0x223f7a[_0xbe14('0x32')]();};}function saveUpdates(_0x14e7c4,_0x581e86){return function(_0x2e33e1){if(_0x2e33e1){return _0x2e33e1['update'](_0x14e7c4)['then'](function(_0x46c2d1){return _0x46c2d1;});}return null;};}function removeEntity(_0x4c1e7e,_0x243524){return function(_0x345b0){if(_0x345b0){return _0x345b0['destroy']()['then'](function(){_0x4c1e7e['status'](0xcc)[_0xbe14('0x28')]();});}};}function handleEntityNotFound(_0xa3d24,_0x5f27b6){return function(_0x46c570){if(!_0x46c570){_0xa3d24[_0xbe14('0x27')](0x194);}return _0x46c570;};}function handleError(_0x452635,_0x1aa849){_0x1aa849=_0x1aa849||0x1f4;return function(_0x29c23e){logger['error'](_0x29c23e['stack']);if(_0x29c23e[_0xbe14('0x33')]){delete _0x29c23e['name'];}_0x452635['status'](_0x1aa849)['send'](_0x29c23e);};}exports[_0xbe14('0x34')]=function(_0x393f6b,_0x2bb45){var _0x3dbacb={},_0x172e79={},_0x29356f={'count':0x0,'rows':[]};var _0xcdc50=_[_0xbe14('0x35')](db[_0xbe14('0x36')][_0xbe14('0x37')],function(_0x41652d){return{'name':_0x41652d[_0xbe14('0x38')],'type':_0x41652d['type']['key']};});_0x172e79[_0xbe14('0x39')]=_[_0xbe14('0x35')](_0xcdc50,_0xbe14('0x33'));_0x172e79['query']=_[_0xbe14('0x3a')](_0x393f6b[_0xbe14('0x3b')]);_0x172e79[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],_0x172e79[_0xbe14('0x3b')]);_0x3dbacb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],qs['fields'](_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x3dbacb[_0xbe14('0x3e')]=_0x3dbacb[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x3dbacb[_0xbe14('0x3e')]:_0x172e79['model'];if(!_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x3dbacb[_0xbe14('0x2c')]=qs['limit'](_0x393f6b['query'][_0xbe14('0x2c')]);_0x3dbacb[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x393f6b['query']['offset']);}_0x3dbacb[_0xbe14('0x43')]=qs['sort'](_0x393f6b['query'][_0xbe14('0x44')]);_0x3dbacb[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x393f6b['query'],_0x172e79['filters']),_0xcdc50);if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x3dbacb[_0xbe14('0x45')]=_['merge'](_0x3dbacb[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0xcdc50,function(_0x32f22e){if(_0x32f22e[_0xbe14('0x47')]!=='VIRTUAL'){var _0x4a1a4b={};_0x4a1a4b[_0x32f22e[_0xbe14('0x33')]]={'$like':'%'+_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0x4a1a4b;}})});}_0x3dbacb=_[_0xbe14('0x48')]({},_0x3dbacb,_0x393f6b[_0xbe14('0x49')]);var _0x4f2d95={'where':_0x3dbacb['where']};return db[_0xbe14('0x36')][_0xbe14('0x2a')](_0x4f2d95)[_0xbe14('0x1c')](function(_0x2a3b35){_0x29356f['count']=_0x2a3b35;if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x4a')]){_0x3dbacb['include']=[{'all':!![]}];}return db[_0xbe14('0x36')][_0xbe14('0x4b')](_0x3dbacb);})[_0xbe14('0x1c')](function(_0x36c20c){_0x29356f['rows']=_0x36c20c;return _0x29356f;})['then'](respondWithFilteredResult(_0x2bb45,_0x3dbacb))[_0xbe14('0x26')](handleError(_0x2bb45,null));};exports[_0xbe14('0x4c')]=function(_0x4a1a37,_0x5acf90){var _0xca8cdb={'raw':![],'where':{'id':_0x4a1a37[_0xbe14('0x4d')]['id']}},_0x5d3726={};_0x5d3726[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x36')][_0xbe14('0x37')]);_0x5d3726['query']=_[_0xbe14('0x3a')](_0x4a1a37[_0xbe14('0x3b')]);_0x5d3726[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],_0x5d3726['query']);_0xca8cdb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x4a1a37[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0xca8cdb['attributes']=_0xca8cdb['attributes'][_0xbe14('0x40')]?_0xca8cdb[_0xbe14('0x3e')]:_0x5d3726[_0xbe14('0x39')];if(_0x4a1a37['query']['includeAll']){_0xca8cdb[_0xbe14('0x4e')]=[{'all':!![]}];}_0xca8cdb=_[_0xbe14('0x48')]({},_0xca8cdb,_0x4a1a37['options']);return db[_0xbe14('0x36')][_0xbe14('0x4f')](_0xca8cdb)['then'](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x1c')](respondWithResult(_0x5acf90,null))['catch'](handleError(_0x5acf90,null));};exports[_0xbe14('0x50')]=function(_0x410c59,_0x12a9de){return db['FreshdeskAccount'][_0xbe14('0x50')](_0x410c59[_0xbe14('0x51')],{})['then'](respondWithResult(_0x12a9de,0xc9))[_0xbe14('0x26')](handleError(_0x12a9de,null));};exports[_0xbe14('0x52')]=function(_0x2210cc,_0x20c48d){if(_0x2210cc[_0xbe14('0x51')]['id']){delete _0x2210cc['body']['id'];}return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x2210cc[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x20c48d,null))[_0xbe14('0x1c')](saveUpdates(_0x2210cc[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x20c48d,null))['catch'](handleError(_0x20c48d,null));};exports[_0xbe14('0x53')]=function(_0x1b47a4,_0x941ee2){return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x1b47a4[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x941ee2,null))[_0xbe14('0x1c')](removeEntity(_0x941ee2,null))[_0xbe14('0x26')](handleError(_0x941ee2,null));};exports[_0xbe14('0x54')]=function(_0x358950,_0x4bccfc,_0x56bcd3){var _0x58dd79={};var _0x10c0bc={};var _0x1bfcbf;var _0x2f4e52;return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x358950[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x4bccfc,null))[_0xbe14('0x1c')](function(_0x31d015){if(_0x31d015){_0x1bfcbf=_0x31d015;_0x10c0bc[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x56')][_0xbe14('0x37')]);_0x10c0bc[_0xbe14('0x3b')]=_[_0xbe14('0x3a')](_0x358950[_0xbe14('0x3b')]);_0x10c0bc[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],_0x10c0bc[_0xbe14('0x3b')]);_0x58dd79['attributes']=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x58dd79[_0xbe14('0x3e')]=_0x58dd79[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x58dd79[_0xbe14('0x3e')]:_0x10c0bc[_0xbe14('0x39')];_0x58dd79['order']=qs[_0xbe14('0x44')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x44')]);_0x58dd79[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x358950[_0xbe14('0x3b')],_0x10c0bc[_0xbe14('0x3c')]));if(_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x58dd79[_0xbe14('0x45')]=_['merge'](_0x58dd79[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0x58dd79[_0xbe14('0x3e')],function(_0x29bb26){var _0xaebce8={};_0xaebce8[_0x29bb26]={'$like':'%'+_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0xaebce8;})});}_0x58dd79=_[_0xbe14('0x48')]({},_0x58dd79,_0x358950['options']);return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x2fdf5d){if(_0x2fdf5d){_0x2f4e52=_0x2fdf5d[_0xbe14('0x40')];if(!_0x358950[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x58dd79['limit']=qs['limit'](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2c')]);_0x58dd79[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2b')]);}return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x50e644){if(_0x50e644){return _0x50e644?{'count':_0x2f4e52,'rows':_0x50e644}:null;}})['then'](respondWithResult(_0x4bccfc,null))[_0xbe14('0x26')](handleError(_0x4bccfc,null));};exports[_0xbe14('0x57')]=function(_0x29aa52,_0x57729f,_0x76e91e){if(_0x29aa52[_0xbe14('0x51')]['id']){delete _0x29aa52[_0xbe14('0x51')]['id'];}return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x29aa52[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x57729f,null))['then'](function(_0x43b817){if(_0x43b817){_0x29aa52[_0xbe14('0x51')][_0xbe14('0x58')]=_0x43b817['id'];_0x29aa52[_0xbe14('0x51')][_0xbe14('0x59')]=integrations[_0xbe14('0x5a')](_0x29aa52[_0xbe14('0x51')]['channel'],_0x29aa52[_0xbe14('0x51')][_0xbe14('0x47')]);_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5b')]=integrations[_0xbe14('0x5c')](_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5d')],_0x29aa52[_0xbe14('0x51')]['type']);return db[_0xbe14('0x56')][_0xbe14('0x50')](_0x29aa52[_0xbe14('0x51')],{'include':[{'model':db[_0xbe14('0x5e')],'as':_0xbe14('0x59')},{'model':db[_0xbe14('0x5e')],'as':'Descriptions'}]});}return null;})[_0xbe14('0x1c')](respondWithResult(_0x57729f,null))[_0xbe14('0x26')](handleError(_0x57729f,null));};exports[_0xbe14('0x5f')]=function(_0x1b23a1,_0x508455,_0x7e9e5c){var _0x1578b6='';return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x1b23a1[_0xbe14('0x4d')]['id']},'attributes':['id',_0xbe14('0x60'),_0xbe14('0x61')]})['then'](handleEntityNotFound(_0x508455,null))[_0xbe14('0x1c')](function(_0x589197){if(_0x589197){_0x1578b6=_0x589197[_0xbe14('0x60')];var _0x5d85d3=_0x1578b6[_0xbe14('0x62')](-0x1);if(_0x5d85d3==='/'){_0x1578b6=_0x1578b6[_0xbe14('0x63')](0x0,_0x1578b6[_0xbe14('0x64')](_0x5d85d3));}return rp({'method':'GET','uri':util[_0xbe14('0x65')](_0xbe14('0x66'),_0x1578b6,_0xbe14('0x67')),'headers':{'Authorization':util['format'](_0xbe14('0x68'),new Buffer(util[_0xbe14('0x65')](_0xbe14('0x69'),_0x589197[_0xbe14('0x61')]))['toString'](_0xbe14('0x6a')))},'json':!![]});}})[_0xbe14('0x1c')](function(_0x34f90b){if(_0x34f90b){var _0x2b2e0e=[_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),'description',_0xbe14('0x2d'),_0xbe14('0x6e'),_0xbe14('0x6f'),'source',_0xbe14('0x70'),_0xbe14('0x6f'),_0xbe14('0x71')];_['remove'](_0x34f90b,function(_0xa53262){return _0x2b2e0e[_0xbe14('0x72')](_0xa53262['name'])||!_0xa53262[_0xbe14('0x73')]&&_0xa53262['type']!==_0xbe14('0x74')&&_0xa53262[_0xbe14('0x47')]!=='custom_dropdown';});return{'count':_0x34f90b['length'],'rows':_[_0xbe14('0x35')](_0x34f90b,function(_0x3db955){return{'id':_0x3db955[_0xbe14('0x33')],'name':_0x3db955['label'],'custom':!_0x3db955[_0xbe14('0x73')],'options':_0x3db955[_0xbe14('0x75')]?_[_0xbe14('0x35')](_0x3db955[_0xbe14('0x75')],function(_0x5ee624){return{'name':_['capitalize'](_0x5ee624),'value':_0x5ee624};}):[]};})};}})[_0xbe14('0x1c')](respondWithResult(_0x508455,null))[_0xbe14('0x26')](function(_0xc8d0f6){var _0x215d5b=_0x1b23a1[_0xbe14('0x3b')][_0xbe14('0x19')]?0x1f4:_0xc8d0f6[_0xbe14('0x76')]||0x1f4;logger['error'](_0xbe14('0x77'),'getFields',_0x215d5b,JSON[_0xbe14('0x22')](_0xc8d0f6));delete _0xc8d0f6[_0xbe14('0x33')];if(_0x215d5b===0x191){_0x215d5b=0x190;}_0x508455[_0xbe14('0x2d')](_0x215d5b)[_0xbe14('0x78')](_0x1b23a1['query'][_0xbe14('0x19')]?{'message':_0xbe14('0x79'),'statusCode':_0xc8d0f6[_0xbe14('0x76')]}:_0xc8d0f6);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index b712885..4fb2805 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 _0x59e1=['bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api'];(function(_0x35c2f6,_0x53ca58){var _0x435de7=function(_0x2c3c84){while(--_0x2c3c84){_0x35c2f6['push'](_0x35c2f6['shift']());}};_0x435de7(++_0x53ca58);}(_0x59e1,0x19d));var _0x159e=function(_0x5ab802,_0x46d738){_0x5ab802=_0x5ab802-0x0;var _0x154906=_0x59e1[_0x5ab802];return _0x154906;};'use strict';var _=require('lodash');var util=require(_0x159e('0x0'));var logger=require(_0x159e('0x1'))(_0x159e('0x2'));var moment=require('moment');var BPromise=require(_0x159e('0x3'));var rp=require(_0x159e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x159e('0x5'));var config=require(_0x159e('0x6'));var attributes=require(_0x159e('0x7'));var integrations=require(_0x159e('0x8'));module[_0x159e('0x9')]=function(_0x1e58bc,_0x310f11){return _0x1e58bc[_0x159e('0xa')](_0x159e('0xb'),attributes,{'tableName':_0x159e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe550=['exports','define','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0xe550,0x1be));var _0x0e55=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe550[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0e55('0x0'));var util=require('util');var logger=require(_0x0e55('0x1'))('api');var moment=require(_0x0e55('0x2'));var BPromise=require(_0x0e55('0x3'));var rp=require(_0x0e55('0x4'));var fs=require('fs');var path=require(_0x0e55('0x5'));var rimraf=require(_0x0e55('0x6'));var config=require(_0x0e55('0x7'));var attributes=require(_0x0e55('0x8'));var integrations=require(_0x0e55('0x9'));module[_0x0e55('0xa')]=function(_0x47827f,_0x4dacdb){return _0x47827f[_0x0e55('0xb')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 01d36da..267644c 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 _0x22b1=['include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','then','debug','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes'];(function(_0x504553,_0x433d09){var _0x56195a=function(_0x2e8b3c){while(--_0x2e8b3c){_0x504553['push'](_0x504553['shift']());}};_0x56195a(++_0x433d09);}(_0x22b1,0x143));var _0x122b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x22b1[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x122b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x122b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x122b('0x2'));var db=require(_0x122b('0x3'))['db'];var utils=require(_0x122b('0x4'));var logger=require(_0x122b('0x5'))(_0x122b('0x6'));var config=require(_0x122b('0x7'));var jayson=require(_0x122b('0x8'));var client=jayson[_0x122b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe2327e,_0x57962e,_0x530427){return new BPromise(function(_0x1b028b,_0x1a20b3){return client[_0x122b('0xa')](_0xe2327e,_0x530427)['then'](function(_0x3cb88c){logger[_0x122b('0xb')](_0x122b('0xc'),_0x57962e,'request\x20sent');logger['debug'](_0x122b('0xd'),_0x57962e,_0x122b('0xe'),JSON[_0x122b('0xf')](_0x3cb88c));if(_0x3cb88c[_0x122b('0x10')]){if(_0x3cb88c[_0x122b('0x10')][_0x122b('0x11')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x57962e,_0x3cb88c['error'][_0x122b('0x12')]);return _0x1a20b3(_0x3cb88c[_0x122b('0x10')]['message']);}logger[_0x122b('0x10')](_0x122b('0xc'),_0x57962e,_0x3cb88c['error'][_0x122b('0x12')]);return _0x1b028b(_0x3cb88c[_0x122b('0x10')][_0x122b('0x12')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x57962e,_0x122b('0xe'));_0x1b028b(_0x3cb88c[_0x122b('0x13')][_0x122b('0x12')]);}})[_0x122b('0x14')](function(_0x4e84e7){logger['error'](_0x122b('0xc'),_0x57962e,_0x4e84e7);_0x1a20b3(_0x4e84e7);});});}exports['GetFreshdeskAccount']=function(_0x277797){var _0x33406f=this;return new Promise(function(_0x1b0ece,_0x5a4b22){return db[_0x122b('0x15')][_0x122b('0x16')]({'raw':_0x277797[_0x122b('0x17')]?_0x277797[_0x122b('0x17')][_0x122b('0x18')]===undefined?!![]:![]:!![],'where':_0x277797[_0x122b('0x17')]?_0x277797[_0x122b('0x17')][_0x122b('0x19')]||null:null,'attributes':_0x277797['options']?_0x277797[_0x122b('0x17')][_0x122b('0x1a')]||null:null,'limit':_0x277797[_0x122b('0x17')]?_0x277797['options']['limit']||null:null,'include':_0x277797[_0x122b('0x17')]?_0x277797[_0x122b('0x17')][_0x122b('0x1b')]?_[_0x122b('0x1c')](_0x277797['options'][_0x122b('0x1b')],function(_0x509e55){return{'model':db[_0x509e55[_0x122b('0x1d')]],'as':_0x509e55['as'],'attributes':_0x509e55[_0x122b('0x1a')],'include':_0x509e55['include']?_[_0x122b('0x1c')](_0x509e55[_0x122b('0x1b')],function(_0x59d0cf){return{'model':db[_0x59d0cf[_0x122b('0x1d')]],'as':_0x59d0cf['as'],'attributes':_0x59d0cf[_0x122b('0x1a')],'include':_0x59d0cf[_0x122b('0x1b')]?_[_0x122b('0x1c')](_0x59d0cf[_0x122b('0x1b')],function(_0x5a606e){return{'model':db[_0x5a606e[_0x122b('0x1d')]],'as':_0x5a606e['as'],'attributes':_0x5a606e[_0x122b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39cafd){logger['info'](_0x122b('0x1e'),_0x277797);logger['debug']('GetFreshdeskAccount',_0x277797,JSON[_0x122b('0xf')](_0x39cafd));_0x1b0ece(_0x39cafd);})[_0x122b('0x14')](function(_0x3bae3a){logger[_0x122b('0x10')](_0x122b('0x1e'),_0x3bae3a[_0x122b('0x12')],_0x277797);_0x5a4b22(_0x33406f[_0x122b('0x10')](0x1f4,_0x3bae3a['message']));});});};exports[_0x122b('0x1f')]=function(_0x2943cc){var _0x1028ff=this;return new Promise(function(_0x50c59a,_0x1da858){return db[_0x122b('0x15')][_0x122b('0x20')]({'raw':_0x2943cc[_0x122b('0x17')]?_0x2943cc[_0x122b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2943cc['options']?_0x2943cc[_0x122b('0x17')][_0x122b('0x19')]||null:null,'attributes':_0x2943cc[_0x122b('0x17')]?_0x2943cc['options'][_0x122b('0x1a')]||null:null,'include':_0x2943cc['options']?_0x2943cc[_0x122b('0x17')]['include']?_['map'](_0x2943cc[_0x122b('0x17')][_0x122b('0x1b')],function(_0x4ea63b){return{'model':db[_0x4ea63b[_0x122b('0x1d')]],'as':_0x4ea63b['as'],'attributes':_0x4ea63b[_0x122b('0x1a')],'include':_0x4ea63b[_0x122b('0x1b')]?_[_0x122b('0x1c')](_0x4ea63b[_0x122b('0x1b')],function(_0xdfccdf){return{'model':db[_0xdfccdf[_0x122b('0x1d')]],'as':_0xdfccdf['as'],'attributes':_0xdfccdf[_0x122b('0x1a')],'include':_0xdfccdf[_0x122b('0x1b')]?_[_0x122b('0x1c')](_0xdfccdf[_0x122b('0x1b')],function(_0x5b8cd7){return{'model':db[_0x5b8cd7[_0x122b('0x1d')]],'as':_0x5b8cd7['as'],'attributes':_0x5b8cd7[_0x122b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x122b('0x21')](function(_0x28e396){logger[_0x122b('0xb')](_0x122b('0x1f'),_0x2943cc);logger[_0x122b('0x22')](_0x122b('0x1f'),_0x2943cc,JSON[_0x122b('0xf')](_0x28e396));_0x50c59a(_0x28e396);})[_0x122b('0x14')](function(_0x21fdf0){logger[_0x122b('0x10')](_0x122b('0x1f'),_0x21fdf0[_0x122b('0x12')],_0x2943cc);_0x1da858(_0x1028ff[_0x122b('0x10')](0x1f4,_0x21fdf0[_0x122b('0x12')]));});});}; \ No newline at end of file +var _0x94e7=['map','then','GetFreshdeskAccount','find','where','ShowFreshdeskAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','FreshdeskAccount','findAll','options','raw','attributes','include','model'];(function(_0x284c15,_0x1fde1d){var _0x13918d=function(_0x1ee748){while(--_0x1ee748){_0x284c15['push'](_0x284c15['shift']());}};_0x13918d(++_0x1fde1d);}(_0x94e7,0x1db));var _0x794e=function(_0x396dd5,_0x5b027f){_0x396dd5=_0x396dd5-0x0;var _0x5a0667=_0x94e7[_0x396dd5];return _0x5a0667;};'use strict';var _=require(_0x794e('0x0'));var util=require(_0x794e('0x1'));var moment=require(_0x794e('0x2'));var BPromise=require(_0x794e('0x3'));var rs=require(_0x794e('0x4'));var fs=require('fs');var Redis=require(_0x794e('0x5'));var db=require(_0x794e('0x6'))['db'];var utils=require(_0x794e('0x7'));var logger=require('../../config/logger')(_0x794e('0x8'));var config=require(_0x794e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x794e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12ae19,_0x22a1d9,_0x1cb65a){return new BPromise(function(_0x54942d,_0x9d27de){return client[_0x794e('0xb')](_0x12ae19,_0x1cb65a)['then'](function(_0x31fe0e){logger[_0x794e('0xc')](_0x794e('0xd'),_0x22a1d9,_0x794e('0xe'));logger[_0x794e('0xf')](_0x794e('0x10'),_0x22a1d9,_0x794e('0xe'),JSON[_0x794e('0x11')](_0x31fe0e));if(_0x31fe0e['error']){if(_0x31fe0e['error'][_0x794e('0x12')]===0x1f4){logger[_0x794e('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x22a1d9,_0x31fe0e[_0x794e('0x13')]['message']);return _0x9d27de(_0x31fe0e[_0x794e('0x13')]['message']);}logger[_0x794e('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x22a1d9,_0x31fe0e['error'][_0x794e('0x14')]);return _0x54942d(_0x31fe0e[_0x794e('0x13')]['message']);}else{logger['info'](_0x794e('0xd'),_0x22a1d9,_0x794e('0xe'));_0x54942d(_0x31fe0e[_0x794e('0x15')][_0x794e('0x14')]);}})['catch'](function(_0x4ff728){logger[_0x794e('0x13')](_0x794e('0xd'),_0x22a1d9,_0x4ff728);_0x9d27de(_0x4ff728);});});}exports['GetFreshdeskAccount']=function(_0x4a6752){var _0x2a02b6=this;return new Promise(function(_0x1257d3,_0x5c503b){return db[_0x794e('0x16')][_0x794e('0x17')]({'raw':_0x4a6752[_0x794e('0x18')]?_0x4a6752[_0x794e('0x18')][_0x794e('0x19')]===undefined?!![]:![]:!![],'where':_0x4a6752['options']?_0x4a6752[_0x794e('0x18')]['where']||null:null,'attributes':_0x4a6752['options']?_0x4a6752[_0x794e('0x18')][_0x794e('0x1a')]||null:null,'limit':_0x4a6752[_0x794e('0x18')]?_0x4a6752[_0x794e('0x18')]['limit']||null:null,'include':_0x4a6752[_0x794e('0x18')]?_0x4a6752[_0x794e('0x18')][_0x794e('0x1b')]?_['map'](_0x4a6752[_0x794e('0x18')]['include'],function(_0x30b5dd){return{'model':db[_0x30b5dd[_0x794e('0x1c')]],'as':_0x30b5dd['as'],'attributes':_0x30b5dd[_0x794e('0x1a')],'include':_0x30b5dd['include']?_[_0x794e('0x1d')](_0x30b5dd[_0x794e('0x1b')],function(_0x34519e){return{'model':db[_0x34519e[_0x794e('0x1c')]],'as':_0x34519e['as'],'attributes':_0x34519e[_0x794e('0x1a')],'include':_0x34519e[_0x794e('0x1b')]?_[_0x794e('0x1d')](_0x34519e[_0x794e('0x1b')],function(_0x2c6e26){return{'model':db[_0x2c6e26['model']],'as':_0x2c6e26['as'],'attributes':_0x2c6e26['attributes']};}):[]};}):[]};}):[]:[]})[_0x794e('0x1e')](function(_0x4408bc){logger[_0x794e('0xc')](_0x794e('0x1f'),_0x4a6752);logger[_0x794e('0xf')](_0x794e('0x1f'),_0x4a6752,JSON[_0x794e('0x11')](_0x4408bc));_0x1257d3(_0x4408bc);})['catch'](function(_0x1b7ca3){logger[_0x794e('0x13')]('GetFreshdeskAccount',_0x1b7ca3['message'],_0x4a6752);_0x5c503b(_0x2a02b6[_0x794e('0x13')](0x1f4,_0x1b7ca3[_0x794e('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x15bc9c){var _0x189979=this;return new Promise(function(_0x547828,_0x264db7){return db[_0x794e('0x16')][_0x794e('0x20')]({'raw':_0x15bc9c['options']?_0x15bc9c[_0x794e('0x18')][_0x794e('0x19')]===undefined?!![]:![]:!![],'where':_0x15bc9c[_0x794e('0x18')]?_0x15bc9c[_0x794e('0x18')][_0x794e('0x21')]||null:null,'attributes':_0x15bc9c[_0x794e('0x18')]?_0x15bc9c[_0x794e('0x18')][_0x794e('0x1a')]||null:null,'include':_0x15bc9c[_0x794e('0x18')]?_0x15bc9c[_0x794e('0x18')]['include']?_['map'](_0x15bc9c['options'][_0x794e('0x1b')],function(_0x670f1b){return{'model':db[_0x670f1b[_0x794e('0x1c')]],'as':_0x670f1b['as'],'attributes':_0x670f1b[_0x794e('0x1a')],'include':_0x670f1b[_0x794e('0x1b')]?_['map'](_0x670f1b[_0x794e('0x1b')],function(_0x1f5cfb){return{'model':db[_0x1f5cfb[_0x794e('0x1c')]],'as':_0x1f5cfb['as'],'attributes':_0x1f5cfb[_0x794e('0x1a')],'include':_0x1f5cfb[_0x794e('0x1b')]?_[_0x794e('0x1d')](_0x1f5cfb[_0x794e('0x1b')],function(_0x26479a){return{'model':db[_0x26479a[_0x794e('0x1c')]],'as':_0x26479a['as'],'attributes':_0x26479a[_0x794e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x794e('0x1e')](function(_0x51020f){logger[_0x794e('0xc')](_0x794e('0x22'),_0x15bc9c);logger[_0x794e('0xf')](_0x794e('0x22'),_0x15bc9c,JSON[_0x794e('0x11')](_0x51020f));_0x547828(_0x51020f);})[_0x794e('0x23')](function(_0x1f0253){logger['error'](_0x794e('0x22'),_0x1f0253['message'],_0x15bc9c);_0x264db7(_0x189979[_0x794e('0x13')](0x1f4,_0x1f0253['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f8f9b55..8819600 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 _0xdd0a=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update'];(function(_0x28dadc,_0x33a3dc){var _0x1b8496=function(_0x193426){while(--_0x193426){_0x28dadc['push'](_0x28dadc['shift']());}};_0x1b8496(++_0x33a3dc);}(_0xdd0a,0xf2));var _0xadd0=function(_0x43a1f0,_0x279e28){_0x43a1f0=_0x43a1f0-0x0;var _0x32f486=_0xdd0a[_0x43a1f0];return _0x32f486;};'use strict';var multer=require(_0xadd0('0x0'));var util=require('util');var path=require(_0xadd0('0x1'));var timeout=require(_0xadd0('0x2'));var express=require(_0xadd0('0x3'));var router=express[_0xadd0('0x4')]();var auth=require(_0xadd0('0x5'));var interaction=require(_0xadd0('0x6'));var config=require(_0xadd0('0x7'));var controller=require(_0xadd0('0x8'));router[_0xadd0('0x9')]('/',auth[_0xadd0('0xa')](),controller['index']);router[_0xadd0('0x9')](_0xadd0('0xb'),auth[_0xadd0('0xa')](),controller[_0xadd0('0xc')]);router[_0xadd0('0x9')]('/:id/fields',auth[_0xadd0('0xa')](),controller[_0xadd0('0xd')]);router['get']('/:id/subjects',auth[_0xadd0('0xa')](),controller['getSubjects']);router[_0xadd0('0x9')](_0xadd0('0xe'),auth[_0xadd0('0xa')](),controller[_0xadd0('0xf')]);router[_0xadd0('0x9')](_0xadd0('0x10'),auth['isAuthenticated'](),controller['getTags']);router[_0xadd0('0x11')]('/',auth[_0xadd0('0xa')](),controller[_0xadd0('0x12')]);router[_0xadd0('0x11')](_0xadd0('0x10'),auth['isAuthenticated'](),controller[_0xadd0('0x13')]);router[_0xadd0('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xadd0('0x15')]);router[_0xadd0('0x16')](_0xadd0('0xb'),auth[_0xadd0('0xa')](),controller[_0xadd0('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe6bf=['isAuthenticated','/:id/subjects','getSubjects','/:id/tags','create','post','setTags','update','exports','util','path','express','Router','../../components/interaction/service','index','get','/:id','show','/:id/fields'];(function(_0x5beb3e,_0x387c41){var _0x1ecf0b=function(_0x1820fb){while(--_0x1820fb){_0x5beb3e['push'](_0x5beb3e['shift']());}};_0x1ecf0b(++_0x387c41);}(_0xe6bf,0xa1));var _0xfe6b=function(_0x556081,_0x5c6fb4){_0x556081=_0x556081-0x0;var _0x5872bf=_0xe6bf[_0x556081];return _0x5872bf;};'use strict';var multer=require('multer');var util=require(_0xfe6b('0x0'));var path=require(_0xfe6b('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe6b('0x2'));var router=express[_0xfe6b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfe6b('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfe6b('0x5')]);router[_0xfe6b('0x6')](_0xfe6b('0x7'),auth['isAuthenticated'](),controller[_0xfe6b('0x8')]);router['get'](_0xfe6b('0x9'),auth[_0xfe6b('0xa')](),controller['getFields']);router[_0xfe6b('0x6')](_0xfe6b('0xb'),auth[_0xfe6b('0xa')](),controller[_0xfe6b('0xc')]);router[_0xfe6b('0x6')]('/:id/descriptions',auth[_0xfe6b('0xa')](),controller['getDescriptions']);router['get'](_0xfe6b('0xd'),auth[_0xfe6b('0xa')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0xfe6b('0xe')]);router[_0xfe6b('0xf')]('/:id/tags',auth[_0xfe6b('0xa')](),controller[_0xfe6b('0x10')]);router['put'](_0xfe6b('0x7'),auth[_0xfe6b('0xa')](),controller[_0xfe6b('0x11')]);router['delete'](_0xfe6b('0x7'),auth[_0xfe6b('0xa')](),controller['destroy']);module[_0xfe6b('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 1e56643..a688135 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 _0xc590=['STRING','exports'];(function(_0x5c24dc,_0x5b6042){var _0x16bb27=function(_0x3d8916){while(--_0x3d8916){_0x5c24dc['push'](_0x5c24dc['shift']());}};_0x16bb27(++_0x5b6042);}(_0xc590,0x111));var _0x0c59=function(_0x4def8f,_0x5d1ef0){_0x4def8f=_0x4def8f-0x0;var _0x5da9c8=_0xc590[_0x4def8f];return _0x5da9c8;};'use strict';var Sequelize=require('sequelize');module[_0x0c59('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0c59('0x1')]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 351ba8e..b1ad3ee 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 _0x64a1=['show','params','keys','rawAttributes','length','find','create','body','catch','getFields','getSubjects','findOne','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../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~!@#$%^&-_=+[{]}.','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','FreshdeskConfiguration','fieldName','type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows'];(function(_0x24fdc7,_0x13b25d){var _0x321a1f=function(_0x5b1571){while(--_0x5b1571){_0x24fdc7['push'](_0x24fdc7['shift']());}};_0x321a1f(++_0x13b25d);}(_0x64a1,0x13e));var _0x164a=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x64a1[_0x29d94e];return _0x106237;};'use strict';var pdf=require(_0x164a('0x0'));var emlformat=require(_0x164a('0x1'));var rimraf=require(_0x164a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x164a('0x3'));var moment=require(_0x164a('0x4'));var BPromise=require(_0x164a('0x5'));var Mustache=require('mustache');var util=require(_0x164a('0x6'));var path=require(_0x164a('0x7'));var sox=require(_0x164a('0x8'));var csv=require(_0x164a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x164a('0xa'));var squel=require(_0x164a('0xb'));var crypto=require(_0x164a('0xc'));var jsforce=require(_0x164a('0xd'));var deskjs=require(_0x164a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x164a('0xf'));var Papa=require(_0x164a('0x10'));var Redis=require('ioredis');var authService=require(_0x164a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x164a('0x12'))(_0x164a('0x13'));var utils=require('../../config/utils');var config=require(_0x164a('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x164a('0x15'));var client=jayson[_0x164a('0x16')][_0x164a('0x17')]({'port':0x232a});function checkPasswordPattern(_0x508a58,_0x64b9aa,_0x15b63e){if(_0x15b63e){var _0x40f214=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40f214[_0x164a('0x18')](_0x64b9aa)){return _0x508a58;}else{throw new db[(_0x164a('0x19'))][(_0x164a('0x1a'))](_0x164a('0x1b'));}}else{return _0x508a58;}}function respondWithRpcPromise(_0x263b3a,_0x28984f,_0x43fc19,_0x3bfc66){return new BPromise(function(_0xb44b99,_0x2e9883){var _0x16c705=_0x3bfc66||client;return _0x16c705['request'](_0x263b3a,_0x43fc19)[_0x164a('0x1c')](function(_0x1ba59d){logger[_0x164a('0x1d')](_0x164a('0x1e'),_0x28984f,'request\x20sent');logger[_0x164a('0x1f')](_0x164a('0x20'),_0x28984f,'request\x20sent',JSON[_0x164a('0x21')](_0x1ba59d));if(_0x1ba59d[_0x164a('0x22')]){if(_0x1ba59d[_0x164a('0x22')][_0x164a('0x23')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x28984f,_0x1ba59d['error'][_0x164a('0x24')]);return _0x2e9883(_0x1ba59d[_0x164a('0x22')][_0x164a('0x24')]);}logger[_0x164a('0x22')](_0x164a('0x1e'),_0x28984f,_0x1ba59d[_0x164a('0x22')][_0x164a('0x24')]);return _0xb44b99(_0x1ba59d[_0x164a('0x22')][_0x164a('0x24')]);}else{logger['info'](_0x164a('0x1e'),_0x28984f,_0x164a('0x25'));_0xb44b99(_0x1ba59d[_0x164a('0x26')]['message']);}})['catch'](function(_0x317d20){logger[_0x164a('0x22')](_0x164a('0x1e'),_0x28984f,_0x317d20);_0x2e9883(_0x317d20);});});}function respondWithStatusCode(_0x27a261,_0xbd1d59){_0xbd1d59=_0xbd1d59||0xcc;return function(_0x5d6a11){if(_0x5d6a11){return _0x27a261[_0x164a('0x27')](_0xbd1d59);}return _0x27a261[_0x164a('0x28')](_0xbd1d59)['end']();};}function respondWithResult(_0x6740e1,_0x5f1db3){_0x5f1db3=_0x5f1db3||0xc8;return function(_0x3a98ba){if(_0x3a98ba){return _0x6740e1[_0x164a('0x28')](_0x5f1db3)[_0x164a('0x29')](_0x3a98ba);}};}function respondWithFilteredResult(_0x1e089c,_0x1210ab){return function(_0x547b0c){if(_0x547b0c){var _0x2c964d=_0x547b0c['count'],_0x2ea402=_0x1210ab['offset'],_0x12d7d4=_0x1210ab[_0x164a('0x2a')]+_0x1210ab[_0x164a('0x2b')],_0x48533d;if(_0x12d7d4>=_0x2c964d){_0x12d7d4=_0x2c964d;_0x48533d=0xc8;}else{_0x48533d=0xce;}_0x1e089c['status'](_0x48533d);return _0x1e089c[_0x164a('0x2c')](_0x164a('0x2d'),_0x2ea402+'-'+_0x12d7d4+'/'+_0x2c964d)[_0x164a('0x29')](_0x547b0c);}return null;};}function patchUpdates(_0x2cdeea){return function(_0x37b06f){try{jsonpatch[_0x164a('0x2e')](_0x37b06f,_0x2cdeea,!![]);}catch(_0x5b8053){return BPromise[_0x164a('0x2f')](_0x5b8053);}return _0x37b06f[_0x164a('0x30')]();};}function saveUpdates(_0x497670,_0x1881e3){return function(_0x24f57a){if(_0x24f57a){return _0x24f57a[_0x164a('0x31')](_0x497670)[_0x164a('0x1c')](function(_0x2f1a29){return _0x2f1a29;});}return null;};}function removeEntity(_0x20c59c,_0x36358c){return function(_0x1be10d){if(_0x1be10d){return _0x1be10d[_0x164a('0x32')]()['then'](function(){_0x20c59c[_0x164a('0x28')](0xcc)[_0x164a('0x33')]();});}};}function handleEntityNotFound(_0x1743ec,_0x158e61){return function(_0x44b550){if(!_0x44b550){_0x1743ec['sendStatus'](0x194);}return _0x44b550;};}function handleError(_0x3e736b,_0x14138d){_0x14138d=_0x14138d||0x1f4;return function(_0x3b5f45){logger[_0x164a('0x22')](_0x3b5f45[_0x164a('0x34')]);if(_0x3b5f45[_0x164a('0x35')]){delete _0x3b5f45[_0x164a('0x35')];}_0x3e736b[_0x164a('0x28')](_0x14138d)[_0x164a('0x36')](_0x3b5f45);};}exports[_0x164a('0x37')]=function(_0x22bd38,_0x3193bb){var _0x413124={},_0x36e2d0={},_0x3f1fa5={'count':0x0,'rows':[]};var _0x3ae030=_['map'](db[_0x164a('0x38')]['rawAttributes'],function(_0x53f6df){return{'name':_0x53f6df[_0x164a('0x39')],'type':_0x53f6df[_0x164a('0x3a')][_0x164a('0x3b')]};});_0x36e2d0['model']=_[_0x164a('0x3c')](_0x3ae030,_0x164a('0x35'));_0x36e2d0[_0x164a('0x3d')]=_['keys'](_0x22bd38[_0x164a('0x3d')]);_0x36e2d0['filters']=_[_0x164a('0x3e')](_0x36e2d0[_0x164a('0x3f')],_0x36e2d0[_0x164a('0x3d')]);_0x413124[_0x164a('0x40')]=_[_0x164a('0x3e')](_0x36e2d0['model'],qs[_0x164a('0x41')](_0x22bd38[_0x164a('0x3d')][_0x164a('0x41')]));_0x413124[_0x164a('0x40')]=_0x413124[_0x164a('0x40')]['length']?_0x413124['attributes']:_0x36e2d0[_0x164a('0x3f')];if(!_0x22bd38['query'][_0x164a('0x42')](_0x164a('0x43'))){_0x413124[_0x164a('0x2b')]=qs[_0x164a('0x2b')](_0x22bd38[_0x164a('0x3d')][_0x164a('0x2b')]);_0x413124[_0x164a('0x2a')]=qs['offset'](_0x22bd38[_0x164a('0x3d')][_0x164a('0x2a')]);}_0x413124[_0x164a('0x44')]=qs['sort'](_0x22bd38[_0x164a('0x3d')][_0x164a('0x45')]);_0x413124[_0x164a('0x46')]=qs[_0x164a('0x47')](_[_0x164a('0x48')](_0x22bd38[_0x164a('0x3d')],_0x36e2d0['filters']),_0x3ae030);if(_0x22bd38['query'][_0x164a('0x49')]){_0x413124[_0x164a('0x46')]=_['merge'](_0x413124['where'],{'$or':_['map'](_0x3ae030,function(_0x13739d){if(_0x13739d[_0x164a('0x3a')]!==_0x164a('0x4a')){var _0x358331={};_0x358331[_0x13739d[_0x164a('0x35')]]={'$like':'%'+_0x22bd38['query'][_0x164a('0x49')]+'%'};return _0x358331;}})});}_0x413124=_[_0x164a('0x4b')]({},_0x413124,_0x22bd38[_0x164a('0x4c')]);var _0x5806ce={'where':_0x413124[_0x164a('0x46')]};return db[_0x164a('0x38')][_0x164a('0x4d')](_0x5806ce)['then'](function(_0x3bd819){_0x3f1fa5[_0x164a('0x4d')]=_0x3bd819;if(_0x22bd38[_0x164a('0x3d')][_0x164a('0x4e')]){_0x413124[_0x164a('0x4f')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x164a('0x50')](_0x413124);})[_0x164a('0x1c')](function(_0x450d75){_0x3f1fa5[_0x164a('0x51')]=_0x450d75;return _0x3f1fa5;})[_0x164a('0x1c')](respondWithFilteredResult(_0x3193bb,_0x413124))['catch'](handleError(_0x3193bb,null));};exports[_0x164a('0x52')]=function(_0x11a434,_0x1f7d22){var _0x33a582={'raw':![],'where':{'id':_0x11a434[_0x164a('0x53')]['id']}},_0x2dc2b3={};_0x2dc2b3[_0x164a('0x3f')]=_[_0x164a('0x54')](db[_0x164a('0x38')][_0x164a('0x55')]);_0x2dc2b3[_0x164a('0x3d')]=_[_0x164a('0x54')](_0x11a434[_0x164a('0x3d')]);_0x2dc2b3['filters']=_[_0x164a('0x3e')](_0x2dc2b3[_0x164a('0x3f')],_0x2dc2b3[_0x164a('0x3d')]);_0x33a582[_0x164a('0x40')]=_[_0x164a('0x3e')](_0x2dc2b3[_0x164a('0x3f')],qs['fields'](_0x11a434[_0x164a('0x3d')][_0x164a('0x41')]));_0x33a582[_0x164a('0x40')]=_0x33a582[_0x164a('0x40')][_0x164a('0x56')]?_0x33a582['attributes']:_0x2dc2b3[_0x164a('0x3f')];if(_0x11a434['query'][_0x164a('0x4e')]){_0x33a582['include']=[{'all':!![]}];}_0x33a582=_['merge']({},_0x33a582,_0x11a434[_0x164a('0x4c')]);return db[_0x164a('0x38')][_0x164a('0x57')](_0x33a582)[_0x164a('0x1c')](handleEntityNotFound(_0x1f7d22,null))[_0x164a('0x1c')](respondWithResult(_0x1f7d22,null))['catch'](handleError(_0x1f7d22,null));};exports[_0x164a('0x58')]=function(_0x23e276,_0x516d2c){return db[_0x164a('0x38')][_0x164a('0x58')](_0x23e276['body'],{})[_0x164a('0x1c')](respondWithResult(_0x516d2c,0xc9))['catch'](handleError(_0x516d2c,null));};exports[_0x164a('0x31')]=function(_0x5ef55f,_0x1fbc32){if(_0x5ef55f['body']['id']){delete _0x5ef55f[_0x164a('0x59')]['id'];}return db[_0x164a('0x38')][_0x164a('0x57')]({'where':{'id':_0x5ef55f[_0x164a('0x53')]['id']}})[_0x164a('0x1c')](handleEntityNotFound(_0x1fbc32,null))['then'](saveUpdates(_0x5ef55f[_0x164a('0x59')],null))[_0x164a('0x1c')](respondWithResult(_0x1fbc32,null))['catch'](handleError(_0x1fbc32,null));};exports[_0x164a('0x32')]=function(_0x4dff1f,_0x30ee39){return db[_0x164a('0x38')][_0x164a('0x57')]({'where':{'id':_0x4dff1f[_0x164a('0x53')]['id']}})[_0x164a('0x1c')](handleEntityNotFound(_0x30ee39,null))[_0x164a('0x1c')](removeEntity(_0x30ee39,null))[_0x164a('0x5a')](handleError(_0x30ee39,null));};exports[_0x164a('0x5b')]=function(_0x58c79e,_0x1468c1,_0x1530d5){var _0xfbb667={};var _0x6bd68={};var _0x5912b3;var _0x36d671;return db[_0x164a('0x38')]['findOne']({'where':{'id':_0x58c79e[_0x164a('0x53')]['id']}})[_0x164a('0x1c')](handleEntityNotFound(_0x1468c1,null))['then'](function(_0x230548){if(_0x230548){_0x5912b3=_0x230548;_0x6bd68[_0x164a('0x3f')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x6bd68[_0x164a('0x3d')]=_[_0x164a('0x54')](_0x58c79e[_0x164a('0x3d')]);_0x6bd68[_0x164a('0x47')]=_['intersection'](_0x6bd68[_0x164a('0x3f')],_0x6bd68[_0x164a('0x3d')]);_0xfbb667[_0x164a('0x40')]=_[_0x164a('0x3e')](_0x6bd68[_0x164a('0x3f')],qs[_0x164a('0x41')](_0x58c79e['query'][_0x164a('0x41')]));_0xfbb667[_0x164a('0x40')]=_0xfbb667[_0x164a('0x40')]['length']?_0xfbb667[_0x164a('0x40')]:_0x6bd68[_0x164a('0x3f')];_0xfbb667[_0x164a('0x44')]=qs['sort'](_0x58c79e[_0x164a('0x3d')][_0x164a('0x45')]);_0xfbb667[_0x164a('0x46')]=qs['filters'](_[_0x164a('0x48')](_0x58c79e[_0x164a('0x3d')],_0x6bd68[_0x164a('0x47')]));if(_0x58c79e[_0x164a('0x3d')][_0x164a('0x49')]){_0xfbb667[_0x164a('0x46')]=_[_0x164a('0x4b')](_0xfbb667[_0x164a('0x46')],{'$or':_[_0x164a('0x3c')](_0xfbb667[_0x164a('0x40')],function(_0x5e5e4a){var _0xf080c9={};_0xf080c9[_0x5e5e4a]={'$like':'%'+_0x58c79e['query'][_0x164a('0x49')]+'%'};return _0xf080c9;})});}_0xfbb667=_[_0x164a('0x4b')]({},_0xfbb667,_0x58c79e[_0x164a('0x4c')]);return _0x5912b3[_0x164a('0x5b')](_0xfbb667);}})[_0x164a('0x1c')](function(_0x232f88){if(_0x232f88){_0x36d671=_0x232f88[_0x164a('0x56')];if(!_0x58c79e[_0x164a('0x3d')][_0x164a('0x42')]('nolimit')){_0xfbb667['limit']=qs[_0x164a('0x2b')](_0x58c79e['query'][_0x164a('0x2b')]);_0xfbb667[_0x164a('0x2a')]=qs[_0x164a('0x2a')](_0x58c79e[_0x164a('0x3d')][_0x164a('0x2a')]);}return _0x5912b3[_0x164a('0x5b')](_0xfbb667);}})[_0x164a('0x1c')](function(_0x14f3ca){if(_0x14f3ca){return _0x14f3ca?{'count':_0x36d671,'rows':_0x14f3ca}:null;}})[_0x164a('0x1c')](respondWithResult(_0x1468c1,null))[_0x164a('0x5a')](handleError(_0x1468c1,null));};exports[_0x164a('0x5c')]=function(_0x4e419f,_0x4ef262,_0x55cb07){var _0x1ff688={};var _0x5f10bc={};var _0x40662;var _0x1c47f9;return db[_0x164a('0x38')][_0x164a('0x5d')]({'where':{'id':_0x4e419f['params']['id']}})[_0x164a('0x1c')](handleEntityNotFound(_0x4ef262,null))['then'](function(_0x149077){if(_0x149077){_0x40662=_0x149077;_0x5f10bc['model']=_[_0x164a('0x54')](db[_0x164a('0x5e')][_0x164a('0x55')]);_0x5f10bc[_0x164a('0x3d')]=_[_0x164a('0x54')](_0x4e419f['query']);_0x5f10bc[_0x164a('0x47')]=_[_0x164a('0x3e')](_0x5f10bc[_0x164a('0x3f')],_0x5f10bc[_0x164a('0x3d')]);_0x1ff688[_0x164a('0x40')]=_[_0x164a('0x3e')](_0x5f10bc['model'],qs['fields'](_0x4e419f['query'][_0x164a('0x41')]));_0x1ff688['attributes']=_0x1ff688['attributes'][_0x164a('0x56')]?_0x1ff688[_0x164a('0x40')]:_0x5f10bc[_0x164a('0x3f')];_0x1ff688[_0x164a('0x44')]=qs['sort'](_0x4e419f[_0x164a('0x3d')][_0x164a('0x45')]);_0x1ff688['where']=qs['filters'](_[_0x164a('0x48')](_0x4e419f[_0x164a('0x3d')],_0x5f10bc[_0x164a('0x47')]));if(_0x4e419f[_0x164a('0x3d')][_0x164a('0x49')]){_0x1ff688['where']=_[_0x164a('0x4b')](_0x1ff688['where'],{'$or':_[_0x164a('0x3c')](_0x1ff688['attributes'],function(_0x5f09a4){var _0x17f60d={};_0x17f60d[_0x5f09a4]={'$like':'%'+_0x4e419f['query']['filter']+'%'};return _0x17f60d;})});}_0x1ff688=_['merge']({},_0x1ff688,_0x4e419f[_0x164a('0x4c')]);return _0x40662[_0x164a('0x5c')](_0x1ff688);}})[_0x164a('0x1c')](function(_0x22c325){if(_0x22c325){_0x1c47f9=_0x22c325[_0x164a('0x56')];if(!_0x4e419f['query'][_0x164a('0x42')](_0x164a('0x43'))){_0x1ff688['limit']=qs[_0x164a('0x2b')](_0x4e419f['query'][_0x164a('0x2b')]);_0x1ff688['offset']=qs[_0x164a('0x2a')](_0x4e419f[_0x164a('0x3d')][_0x164a('0x2a')]);}return _0x40662[_0x164a('0x5c')](_0x1ff688);}})[_0x164a('0x1c')](function(_0x2a32ed){if(_0x2a32ed){return _0x2a32ed?{'count':_0x1c47f9,'rows':_0x2a32ed}:null;}})[_0x164a('0x1c')](respondWithResult(_0x4ef262,null))[_0x164a('0x5a')](handleError(_0x4ef262,null));};exports['getDescriptions']=function(_0x5f35b0,_0x2db767,_0x22e8d2){var _0x19bf82={};var _0x4aa1b9={};var _0x2c2389;var _0x9fb265;return db[_0x164a('0x38')][_0x164a('0x5d')]({'where':{'id':_0x5f35b0[_0x164a('0x53')]['id']}})['then'](handleEntityNotFound(_0x2db767,null))[_0x164a('0x1c')](function(_0x2caf95){if(_0x2caf95){_0x2c2389=_0x2caf95;_0x4aa1b9['model']=_[_0x164a('0x54')](db[_0x164a('0x5e')][_0x164a('0x55')]);_0x4aa1b9[_0x164a('0x3d')]=_[_0x164a('0x54')](_0x5f35b0['query']);_0x4aa1b9[_0x164a('0x47')]=_[_0x164a('0x3e')](_0x4aa1b9[_0x164a('0x3f')],_0x4aa1b9[_0x164a('0x3d')]);_0x19bf82[_0x164a('0x40')]=_['intersection'](_0x4aa1b9[_0x164a('0x3f')],qs['fields'](_0x5f35b0[_0x164a('0x3d')][_0x164a('0x41')]));_0x19bf82['attributes']=_0x19bf82[_0x164a('0x40')][_0x164a('0x56')]?_0x19bf82[_0x164a('0x40')]:_0x4aa1b9['model'];_0x19bf82[_0x164a('0x44')]=qs[_0x164a('0x45')](_0x5f35b0[_0x164a('0x3d')][_0x164a('0x45')]);_0x19bf82['where']=qs[_0x164a('0x47')](_[_0x164a('0x48')](_0x5f35b0[_0x164a('0x3d')],_0x4aa1b9[_0x164a('0x47')]));if(_0x5f35b0[_0x164a('0x3d')][_0x164a('0x49')]){_0x19bf82[_0x164a('0x46')]=_[_0x164a('0x4b')](_0x19bf82[_0x164a('0x46')],{'$or':_[_0x164a('0x3c')](_0x19bf82[_0x164a('0x40')],function(_0x2a337e){var _0x4d7696={};_0x4d7696[_0x2a337e]={'$like':'%'+_0x5f35b0[_0x164a('0x3d')][_0x164a('0x49')]+'%'};return _0x4d7696;})});}_0x19bf82=_['merge']({},_0x19bf82,_0x5f35b0[_0x164a('0x4c')]);return _0x2c2389[_0x164a('0x5f')](_0x19bf82);}})[_0x164a('0x1c')](function(_0x1e09c0){if(_0x1e09c0){_0x9fb265=_0x1e09c0['length'];if(!_0x5f35b0[_0x164a('0x3d')]['hasOwnProperty'](_0x164a('0x43'))){_0x19bf82[_0x164a('0x2b')]=qs[_0x164a('0x2b')](_0x5f35b0[_0x164a('0x3d')]['limit']);_0x19bf82[_0x164a('0x2a')]=qs['offset'](_0x5f35b0[_0x164a('0x3d')]['offset']);}return _0x2c2389[_0x164a('0x5f')](_0x19bf82);}})[_0x164a('0x1c')](function(_0x43dda5){if(_0x43dda5){return _0x43dda5?{'count':_0x9fb265,'rows':_0x43dda5}:null;}})[_0x164a('0x1c')](respondWithResult(_0x2db767,null))[_0x164a('0x5a')](handleError(_0x2db767,null));};exports[_0x164a('0x60')]=function(_0x5a3db5,_0x5b1be1,_0x456960){var _0x38d11c={};var _0x247d39={};var _0x32fedb;var _0xa958b9;return db[_0x164a('0x38')][_0x164a('0x5d')]({'where':{'id':_0x5a3db5[_0x164a('0x53')]['id']}})['then'](handleEntityNotFound(_0x5b1be1,null))[_0x164a('0x1c')](function(_0x488d98){if(_0x488d98){_0x32fedb=_0x488d98;_0x247d39['model']=_['keys'](db[_0x164a('0x61')][_0x164a('0x55')]);_0x247d39[_0x164a('0x3d')]=_[_0x164a('0x54')](_0x5a3db5[_0x164a('0x3d')]);_0x247d39[_0x164a('0x47')]=_[_0x164a('0x3e')](_0x247d39['model'],_0x247d39[_0x164a('0x3d')]);_0x38d11c[_0x164a('0x40')]=_[_0x164a('0x3e')](_0x247d39[_0x164a('0x3f')],qs[_0x164a('0x41')](_0x5a3db5[_0x164a('0x3d')][_0x164a('0x41')]));_0x38d11c[_0x164a('0x40')]=_0x38d11c[_0x164a('0x40')][_0x164a('0x56')]?_0x38d11c[_0x164a('0x40')]:_0x247d39[_0x164a('0x3f')];_0x38d11c[_0x164a('0x44')]=qs[_0x164a('0x45')](_0x5a3db5['query'][_0x164a('0x45')]);_0x38d11c['where']=qs[_0x164a('0x47')](_['pick'](_0x5a3db5[_0x164a('0x3d')],_0x247d39['filters']));if(_0x5a3db5['query']['filter']){_0x38d11c['where']=_[_0x164a('0x4b')](_0x38d11c[_0x164a('0x46')],{'$or':_['map'](_0x38d11c[_0x164a('0x40')],function(_0x424053){var _0x419359={};_0x419359[_0x424053]={'$like':'%'+_0x5a3db5['query']['filter']+'%'};return _0x419359;})});}_0x38d11c=_[_0x164a('0x4b')]({},_0x38d11c,_0x5a3db5[_0x164a('0x4c')]);return _0x32fedb[_0x164a('0x60')](_0x38d11c);}})[_0x164a('0x1c')](function(_0x7e0b4a){if(_0x7e0b4a){_0xa958b9=_0x7e0b4a['length'];if(!_0x5a3db5[_0x164a('0x3d')]['hasOwnProperty'](_0x164a('0x43'))){_0x38d11c['limit']=qs['limit'](_0x5a3db5['query']['limit']);_0x38d11c[_0x164a('0x2a')]=qs['offset'](_0x5a3db5[_0x164a('0x3d')][_0x164a('0x2a')]);}return _0x32fedb['getTags'](_0x38d11c);}})[_0x164a('0x1c')](function(_0x4a0c04){if(_0x4a0c04){return _0x4a0c04?{'count':_0xa958b9,'rows':_0x4a0c04}:null;}})['then'](respondWithResult(_0x5b1be1,null))[_0x164a('0x5a')](handleError(_0x5b1be1,null));};exports['setTags']=function(_0x257458,_0x585748,_0x10facb){if(_0x257458[_0x164a('0x59')]['id']){delete _0x257458[_0x164a('0x59')]['id'];}return db[_0x164a('0x38')][_0x164a('0x5d')]({'where':{'id':_0x257458['params']['id']}})['then'](handleEntityNotFound(_0x585748,null))[_0x164a('0x1c')](function(_0x43885d){if(_0x43885d){return _0x43885d[_0x164a('0x62')](_0x257458[_0x164a('0x59')][_0x164a('0x63')]||[]);}return null;})[_0x164a('0x1c')](respondWithResult(_0x585748,null))[_0x164a('0x5a')](handleError(_0x585748,null));}; \ No newline at end of file +var _0x3821=['json','apply','save','update','destroy','end','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','FreshdeskConfiguration','findAll','catch','show','params','length','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','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','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','count','offset','limit','set','Content-Range'];(function(_0x4be6f4,_0x385b23){var _0x3e9098=function(_0x17ff9a){while(--_0x17ff9a){_0x4be6f4['push'](_0x4be6f4['shift']());}};_0x3e9098(++_0x385b23);}(_0x3821,0xf7));var _0x1382=function(_0xdda583,_0x15d170){_0xdda583=_0xdda583-0x0;var _0x204e58=_0x3821[_0xdda583];return _0x204e58;};'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'];var jayson=require(_0x1382('0x19'));var client=jayson[_0x1382('0x1a')][_0x1382('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x518711,_0x4b2cb5,_0x3cb361){if(_0x3cb361){var _0x46f3bc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x46f3bc['test'](_0x4b2cb5)){return _0x518711;}else{throw new db[(_0x1382('0x1c'))]['ValidationError'](_0x1382('0x1d'));}}else{return _0x518711;}}function respondWithRpcPromise(_0x5dd57f,_0x21ffdd,_0x2ce952,_0x204418){return new BPromise(function(_0x21f436,_0x3d4201){var _0x84f01f=_0x204418||client;return _0x84f01f[_0x1382('0x1e')](_0x5dd57f,_0x2ce952)[_0x1382('0x1f')](function(_0x12b023){logger[_0x1382('0x20')](_0x1382('0x21'),_0x21ffdd,_0x1382('0x22'));logger['debug'](_0x1382('0x23'),_0x21ffdd,_0x1382('0x22'),JSON[_0x1382('0x24')](_0x12b023));if(_0x12b023[_0x1382('0x25')]){if(_0x12b023[_0x1382('0x25')]['code']===0x1f4){logger[_0x1382('0x25')](_0x1382('0x21'),_0x21ffdd,_0x12b023[_0x1382('0x25')][_0x1382('0x26')]);return _0x3d4201(_0x12b023[_0x1382('0x25')][_0x1382('0x26')]);}logger[_0x1382('0x25')](_0x1382('0x21'),_0x21ffdd,_0x12b023[_0x1382('0x25')][_0x1382('0x26')]);return _0x21f436(_0x12b023[_0x1382('0x25')][_0x1382('0x26')]);}else{logger[_0x1382('0x20')](_0x1382('0x21'),_0x21ffdd,_0x1382('0x22'));_0x21f436(_0x12b023[_0x1382('0x27')][_0x1382('0x26')]);}})['catch'](function(_0x4594c6){logger[_0x1382('0x25')](_0x1382('0x21'),_0x21ffdd,_0x4594c6);_0x3d4201(_0x4594c6);});});}function respondWithStatusCode(_0x5716f2,_0xc6bcc2){_0xc6bcc2=_0xc6bcc2||0xcc;return function(_0x39a3fe){if(_0x39a3fe){return _0x5716f2[_0x1382('0x28')](_0xc6bcc2);}return _0x5716f2[_0x1382('0x29')](_0xc6bcc2)['end']();};}function respondWithResult(_0x6cc975,_0x5564d6){_0x5564d6=_0x5564d6||0xc8;return function(_0x3a3998){if(_0x3a3998){return _0x6cc975[_0x1382('0x29')](_0x5564d6)['json'](_0x3a3998);}};}function respondWithFilteredResult(_0x5a5ee4,_0x3bfe14){return function(_0x203a43){if(_0x203a43){var _0x136310=_0x203a43[_0x1382('0x2a')],_0x7740c4=_0x3bfe14[_0x1382('0x2b')],_0x2cf6c8=_0x3bfe14[_0x1382('0x2b')]+_0x3bfe14[_0x1382('0x2c')],_0x253906;if(_0x2cf6c8>=_0x136310){_0x2cf6c8=_0x136310;_0x253906=0xc8;}else{_0x253906=0xce;}_0x5a5ee4[_0x1382('0x29')](_0x253906);return _0x5a5ee4[_0x1382('0x2d')](_0x1382('0x2e'),_0x7740c4+'-'+_0x2cf6c8+'/'+_0x136310)[_0x1382('0x2f')](_0x203a43);}return null;};}function patchUpdates(_0x145fe5){return function(_0xacbed8){try{jsonpatch[_0x1382('0x30')](_0xacbed8,_0x145fe5,!![]);}catch(_0x502020){return BPromise['reject'](_0x502020);}return _0xacbed8[_0x1382('0x31')]();};}function saveUpdates(_0x5e11db,_0x50fbfd){return function(_0x2f26cc){if(_0x2f26cc){return _0x2f26cc[_0x1382('0x32')](_0x5e11db)[_0x1382('0x1f')](function(_0x491ee1){return _0x491ee1;});}return null;};}function removeEntity(_0xa4c182,_0x216900){return function(_0x5f05db){if(_0x5f05db){return _0x5f05db[_0x1382('0x33')]()[_0x1382('0x1f')](function(){_0xa4c182[_0x1382('0x29')](0xcc)[_0x1382('0x34')]();});}};}function handleEntityNotFound(_0x193807,_0x48b0c4){return function(_0x1a90c6){if(!_0x1a90c6){_0x193807[_0x1382('0x28')](0x194);}return _0x1a90c6;};}function handleError(_0x31ebdd,_0x4d413c){_0x4d413c=_0x4d413c||0x1f4;return function(_0x59c242){logger[_0x1382('0x25')](_0x59c242[_0x1382('0x35')]);if(_0x59c242[_0x1382('0x36')]){delete _0x59c242[_0x1382('0x36')];}_0x31ebdd['status'](_0x4d413c)[_0x1382('0x37')](_0x59c242);};}exports['index']=function(_0x27a4a8,_0x31cec2){var _0x14b68c={},_0x68665c={},_0x47844c={'count':0x0,'rows':[]};var _0x2fdcdc=_[_0x1382('0x38')](db['FreshdeskConfiguration'][_0x1382('0x39')],function(_0x2c5285){return{'name':_0x2c5285[_0x1382('0x3a')],'type':_0x2c5285[_0x1382('0x3b')][_0x1382('0x3c')]};});_0x68665c[_0x1382('0x3d')]=_[_0x1382('0x38')](_0x2fdcdc,_0x1382('0x36'));_0x68665c[_0x1382('0x3e')]=_[_0x1382('0x3f')](_0x27a4a8[_0x1382('0x3e')]);_0x68665c[_0x1382('0x40')]=_['intersection'](_0x68665c[_0x1382('0x3d')],_0x68665c[_0x1382('0x3e')]);_0x14b68c[_0x1382('0x41')]=_[_0x1382('0x42')](_0x68665c[_0x1382('0x3d')],qs[_0x1382('0x43')](_0x27a4a8['query'][_0x1382('0x43')]));_0x14b68c[_0x1382('0x41')]=_0x14b68c['attributes']['length']?_0x14b68c[_0x1382('0x41')]:_0x68665c[_0x1382('0x3d')];if(!_0x27a4a8['query'][_0x1382('0x44')](_0x1382('0x45'))){_0x14b68c[_0x1382('0x2c')]=qs[_0x1382('0x2c')](_0x27a4a8['query'][_0x1382('0x2c')]);_0x14b68c[_0x1382('0x2b')]=qs[_0x1382('0x2b')](_0x27a4a8[_0x1382('0x3e')][_0x1382('0x2b')]);}_0x14b68c[_0x1382('0x46')]=qs[_0x1382('0x47')](_0x27a4a8['query'][_0x1382('0x47')]);_0x14b68c[_0x1382('0x48')]=qs[_0x1382('0x40')](_[_0x1382('0x49')](_0x27a4a8[_0x1382('0x3e')],_0x68665c[_0x1382('0x40')]),_0x2fdcdc);if(_0x27a4a8[_0x1382('0x3e')][_0x1382('0x4a')]){_0x14b68c[_0x1382('0x48')]=_['merge'](_0x14b68c[_0x1382('0x48')],{'$or':_['map'](_0x2fdcdc,function(_0x4ea779){if(_0x4ea779[_0x1382('0x3b')]!==_0x1382('0x4b')){var _0x11e364={};_0x11e364[_0x4ea779['name']]={'$like':'%'+_0x27a4a8['query'][_0x1382('0x4a')]+'%'};return _0x11e364;}})});}_0x14b68c=_[_0x1382('0x4c')]({},_0x14b68c,_0x27a4a8[_0x1382('0x4d')]);var _0x1cb125={'where':_0x14b68c[_0x1382('0x48')]};return db['FreshdeskConfiguration']['count'](_0x1cb125)['then'](function(_0x241257){_0x47844c['count']=_0x241257;if(_0x27a4a8[_0x1382('0x3e')][_0x1382('0x4e')]){_0x14b68c[_0x1382('0x4f')]=[{'all':!![]}];}return db[_0x1382('0x50')][_0x1382('0x51')](_0x14b68c);})['then'](function(_0xcd9ebe){_0x47844c['rows']=_0xcd9ebe;return _0x47844c;})['then'](respondWithFilteredResult(_0x31cec2,_0x14b68c))[_0x1382('0x52')](handleError(_0x31cec2,null));};exports[_0x1382('0x53')]=function(_0x4bdca9,_0x220a8){var _0x267b66={'raw':![],'where':{'id':_0x4bdca9[_0x1382('0x54')]['id']}},_0x57e761={};_0x57e761['model']=_[_0x1382('0x3f')](db[_0x1382('0x50')][_0x1382('0x39')]);_0x57e761[_0x1382('0x3e')]=_[_0x1382('0x3f')](_0x4bdca9[_0x1382('0x3e')]);_0x57e761[_0x1382('0x40')]=_[_0x1382('0x42')](_0x57e761[_0x1382('0x3d')],_0x57e761[_0x1382('0x3e')]);_0x267b66[_0x1382('0x41')]=_[_0x1382('0x42')](_0x57e761[_0x1382('0x3d')],qs[_0x1382('0x43')](_0x4bdca9['query'][_0x1382('0x43')]));_0x267b66['attributes']=_0x267b66[_0x1382('0x41')][_0x1382('0x55')]?_0x267b66[_0x1382('0x41')]:_0x57e761[_0x1382('0x3d')];if(_0x4bdca9[_0x1382('0x3e')][_0x1382('0x4e')]){_0x267b66[_0x1382('0x4f')]=[{'all':!![]}];}_0x267b66=_[_0x1382('0x4c')]({},_0x267b66,_0x4bdca9['options']);return db[_0x1382('0x50')][_0x1382('0x56')](_0x267b66)['then'](handleEntityNotFound(_0x220a8,null))[_0x1382('0x1f')](respondWithResult(_0x220a8,null))[_0x1382('0x52')](handleError(_0x220a8,null));};exports[_0x1382('0x57')]=function(_0x1e6487,_0x5212ff){return db[_0x1382('0x50')]['create'](_0x1e6487[_0x1382('0x58')],{})['then'](respondWithResult(_0x5212ff,0xc9))['catch'](handleError(_0x5212ff,null));};exports[_0x1382('0x32')]=function(_0x324a2f,_0x316a11){if(_0x324a2f[_0x1382('0x58')]['id']){delete _0x324a2f[_0x1382('0x58')]['id'];}return db['FreshdeskConfiguration'][_0x1382('0x56')]({'where':{'id':_0x324a2f[_0x1382('0x54')]['id']}})[_0x1382('0x1f')](handleEntityNotFound(_0x316a11,null))['then'](saveUpdates(_0x324a2f[_0x1382('0x58')],null))[_0x1382('0x1f')](respondWithResult(_0x316a11,null))[_0x1382('0x52')](handleError(_0x316a11,null));};exports['destroy']=function(_0x153c9c,_0x1268f5){return db[_0x1382('0x50')][_0x1382('0x56')]({'where':{'id':_0x153c9c['params']['id']}})[_0x1382('0x1f')](handleEntityNotFound(_0x1268f5,null))[_0x1382('0x1f')](removeEntity(_0x1268f5,null))['catch'](handleError(_0x1268f5,null));};exports[_0x1382('0x59')]=function(_0x5f46a2,_0x1aeab2,_0x111c32){var _0x292354={};var _0x215b7f={};var _0x43e779;var _0x3083ab;return db[_0x1382('0x50')][_0x1382('0x5a')]({'where':{'id':_0x5f46a2['params']['id']}})[_0x1382('0x1f')](handleEntityNotFound(_0x1aeab2,null))[_0x1382('0x1f')](function(_0x55e498){if(_0x55e498){_0x43e779=_0x55e498;_0x215b7f[_0x1382('0x3d')]=_['keys'](db[_0x1382('0x5b')]['rawAttributes']);_0x215b7f[_0x1382('0x3e')]=_['keys'](_0x5f46a2[_0x1382('0x3e')]);_0x215b7f[_0x1382('0x40')]=_[_0x1382('0x42')](_0x215b7f[_0x1382('0x3d')],_0x215b7f['query']);_0x292354[_0x1382('0x41')]=_['intersection'](_0x215b7f[_0x1382('0x3d')],qs['fields'](_0x5f46a2['query'][_0x1382('0x43')]));_0x292354[_0x1382('0x41')]=_0x292354[_0x1382('0x41')][_0x1382('0x55')]?_0x292354['attributes']:_0x215b7f['model'];_0x292354[_0x1382('0x46')]=qs[_0x1382('0x47')](_0x5f46a2[_0x1382('0x3e')][_0x1382('0x47')]);_0x292354[_0x1382('0x48')]=qs[_0x1382('0x40')](_[_0x1382('0x49')](_0x5f46a2[_0x1382('0x3e')],_0x215b7f[_0x1382('0x40')]));if(_0x5f46a2[_0x1382('0x3e')][_0x1382('0x4a')]){_0x292354[_0x1382('0x48')]=_[_0x1382('0x4c')](_0x292354[_0x1382('0x48')],{'$or':_[_0x1382('0x38')](_0x292354[_0x1382('0x41')],function(_0x2de8cb){var _0x14914d={};_0x14914d[_0x2de8cb]={'$like':'%'+_0x5f46a2[_0x1382('0x3e')]['filter']+'%'};return _0x14914d;})});}_0x292354=_[_0x1382('0x4c')]({},_0x292354,_0x5f46a2[_0x1382('0x4d')]);return _0x43e779['getFields'](_0x292354);}})['then'](function(_0x33f9bb){if(_0x33f9bb){_0x3083ab=_0x33f9bb['length'];if(!_0x5f46a2[_0x1382('0x3e')][_0x1382('0x44')](_0x1382('0x45'))){_0x292354[_0x1382('0x2c')]=qs['limit'](_0x5f46a2['query']['limit']);_0x292354['offset']=qs[_0x1382('0x2b')](_0x5f46a2['query'][_0x1382('0x2b')]);}return _0x43e779[_0x1382('0x59')](_0x292354);}})[_0x1382('0x1f')](function(_0x2103f2){if(_0x2103f2){return _0x2103f2?{'count':_0x3083ab,'rows':_0x2103f2}:null;}})[_0x1382('0x1f')](respondWithResult(_0x1aeab2,null))[_0x1382('0x52')](handleError(_0x1aeab2,null));};exports[_0x1382('0x5c')]=function(_0x5acc9e,_0x33f1f7,_0x412ff4){var _0x1b02d8={};var _0x17e00c={};var _0x16a7e5;var _0x564fc3;return db[_0x1382('0x50')]['findOne']({'where':{'id':_0x5acc9e['params']['id']}})[_0x1382('0x1f')](handleEntityNotFound(_0x33f1f7,null))[_0x1382('0x1f')](function(_0x2ef0fe){if(_0x2ef0fe){_0x16a7e5=_0x2ef0fe;_0x17e00c[_0x1382('0x3d')]=_[_0x1382('0x3f')](db[_0x1382('0x5b')]['rawAttributes']);_0x17e00c[_0x1382('0x3e')]=_[_0x1382('0x3f')](_0x5acc9e['query']);_0x17e00c[_0x1382('0x40')]=_[_0x1382('0x42')](_0x17e00c['model'],_0x17e00c[_0x1382('0x3e')]);_0x1b02d8[_0x1382('0x41')]=_[_0x1382('0x42')](_0x17e00c[_0x1382('0x3d')],qs[_0x1382('0x43')](_0x5acc9e[_0x1382('0x3e')][_0x1382('0x43')]));_0x1b02d8['attributes']=_0x1b02d8[_0x1382('0x41')]['length']?_0x1b02d8[_0x1382('0x41')]:_0x17e00c['model'];_0x1b02d8[_0x1382('0x46')]=qs[_0x1382('0x47')](_0x5acc9e[_0x1382('0x3e')][_0x1382('0x47')]);_0x1b02d8['where']=qs['filters'](_[_0x1382('0x49')](_0x5acc9e['query'],_0x17e00c[_0x1382('0x40')]));if(_0x5acc9e['query'][_0x1382('0x4a')]){_0x1b02d8[_0x1382('0x48')]=_[_0x1382('0x4c')](_0x1b02d8[_0x1382('0x48')],{'$or':_['map'](_0x1b02d8['attributes'],function(_0xb1cd50){var _0x1bf35f={};_0x1bf35f[_0xb1cd50]={'$like':'%'+_0x5acc9e[_0x1382('0x3e')][_0x1382('0x4a')]+'%'};return _0x1bf35f;})});}_0x1b02d8=_[_0x1382('0x4c')]({},_0x1b02d8,_0x5acc9e[_0x1382('0x4d')]);return _0x16a7e5[_0x1382('0x5c')](_0x1b02d8);}})[_0x1382('0x1f')](function(_0x25ac9f){if(_0x25ac9f){_0x564fc3=_0x25ac9f['length'];if(!_0x5acc9e[_0x1382('0x3e')][_0x1382('0x44')]('nolimit')){_0x1b02d8['limit']=qs[_0x1382('0x2c')](_0x5acc9e[_0x1382('0x3e')][_0x1382('0x2c')]);_0x1b02d8[_0x1382('0x2b')]=qs[_0x1382('0x2b')](_0x5acc9e['query'][_0x1382('0x2b')]);}return _0x16a7e5[_0x1382('0x5c')](_0x1b02d8);}})[_0x1382('0x1f')](function(_0x4c4942){if(_0x4c4942){return _0x4c4942?{'count':_0x564fc3,'rows':_0x4c4942}:null;}})[_0x1382('0x1f')](respondWithResult(_0x33f1f7,null))[_0x1382('0x52')](handleError(_0x33f1f7,null));};exports['getDescriptions']=function(_0x1630db,_0xe2ee95,_0x32df8a){var _0x1d42c9={};var _0x332d97={};var _0x321081;var _0xd24020;return db[_0x1382('0x50')][_0x1382('0x5a')]({'where':{'id':_0x1630db['params']['id']}})['then'](handleEntityNotFound(_0xe2ee95,null))[_0x1382('0x1f')](function(_0x3b72f3){if(_0x3b72f3){_0x321081=_0x3b72f3;_0x332d97[_0x1382('0x3d')]=_[_0x1382('0x3f')](db[_0x1382('0x5b')][_0x1382('0x39')]);_0x332d97[_0x1382('0x3e')]=_[_0x1382('0x3f')](_0x1630db[_0x1382('0x3e')]);_0x332d97['filters']=_[_0x1382('0x42')](_0x332d97[_0x1382('0x3d')],_0x332d97[_0x1382('0x3e')]);_0x1d42c9['attributes']=_[_0x1382('0x42')](_0x332d97[_0x1382('0x3d')],qs[_0x1382('0x43')](_0x1630db['query'][_0x1382('0x43')]));_0x1d42c9[_0x1382('0x41')]=_0x1d42c9[_0x1382('0x41')][_0x1382('0x55')]?_0x1d42c9['attributes']:_0x332d97[_0x1382('0x3d')];_0x1d42c9[_0x1382('0x46')]=qs[_0x1382('0x47')](_0x1630db['query'][_0x1382('0x47')]);_0x1d42c9['where']=qs['filters'](_[_0x1382('0x49')](_0x1630db[_0x1382('0x3e')],_0x332d97[_0x1382('0x40')]));if(_0x1630db['query'][_0x1382('0x4a')]){_0x1d42c9['where']=_['merge'](_0x1d42c9[_0x1382('0x48')],{'$or':_['map'](_0x1d42c9[_0x1382('0x41')],function(_0x42cc5c){var _0x30e3d2={};_0x30e3d2[_0x42cc5c]={'$like':'%'+_0x1630db['query']['filter']+'%'};return _0x30e3d2;})});}_0x1d42c9=_[_0x1382('0x4c')]({},_0x1d42c9,_0x1630db['options']);return _0x321081[_0x1382('0x5d')](_0x1d42c9);}})[_0x1382('0x1f')](function(_0xdedf86){if(_0xdedf86){_0xd24020=_0xdedf86[_0x1382('0x55')];if(!_0x1630db[_0x1382('0x3e')]['hasOwnProperty'](_0x1382('0x45'))){_0x1d42c9[_0x1382('0x2c')]=qs['limit'](_0x1630db[_0x1382('0x3e')][_0x1382('0x2c')]);_0x1d42c9['offset']=qs[_0x1382('0x2b')](_0x1630db['query'][_0x1382('0x2b')]);}return _0x321081[_0x1382('0x5d')](_0x1d42c9);}})[_0x1382('0x1f')](function(_0x47de0b){if(_0x47de0b){return _0x47de0b?{'count':_0xd24020,'rows':_0x47de0b}:null;}})['then'](respondWithResult(_0xe2ee95,null))['catch'](handleError(_0xe2ee95,null));};exports[_0x1382('0x5e')]=function(_0x3ea941,_0x36a458,_0x56a51f){var _0x1af7a6={};var _0x2e5e83={};var _0x5b4da8;var _0x4ef6f3;return db['FreshdeskConfiguration'][_0x1382('0x5a')]({'where':{'id':_0x3ea941[_0x1382('0x54')]['id']}})[_0x1382('0x1f')](handleEntityNotFound(_0x36a458,null))['then'](function(_0x55d2ff){if(_0x55d2ff){_0x5b4da8=_0x55d2ff;_0x2e5e83['model']=_[_0x1382('0x3f')](db[_0x1382('0x5f')][_0x1382('0x39')]);_0x2e5e83[_0x1382('0x3e')]=_['keys'](_0x3ea941[_0x1382('0x3e')]);_0x2e5e83[_0x1382('0x40')]=_[_0x1382('0x42')](_0x2e5e83['model'],_0x2e5e83[_0x1382('0x3e')]);_0x1af7a6[_0x1382('0x41')]=_['intersection'](_0x2e5e83['model'],qs[_0x1382('0x43')](_0x3ea941['query'][_0x1382('0x43')]));_0x1af7a6[_0x1382('0x41')]=_0x1af7a6['attributes']['length']?_0x1af7a6[_0x1382('0x41')]:_0x2e5e83[_0x1382('0x3d')];_0x1af7a6[_0x1382('0x46')]=qs[_0x1382('0x47')](_0x3ea941[_0x1382('0x3e')][_0x1382('0x47')]);_0x1af7a6[_0x1382('0x48')]=qs[_0x1382('0x40')](_[_0x1382('0x49')](_0x3ea941['query'],_0x2e5e83[_0x1382('0x40')]));if(_0x3ea941['query'][_0x1382('0x4a')]){_0x1af7a6[_0x1382('0x48')]=_['merge'](_0x1af7a6[_0x1382('0x48')],{'$or':_[_0x1382('0x38')](_0x1af7a6[_0x1382('0x41')],function(_0x28f87d){var _0x157b99={};_0x157b99[_0x28f87d]={'$like':'%'+_0x3ea941[_0x1382('0x3e')]['filter']+'%'};return _0x157b99;})});}_0x1af7a6=_[_0x1382('0x4c')]({},_0x1af7a6,_0x3ea941['options']);return _0x5b4da8[_0x1382('0x5e')](_0x1af7a6);}})['then'](function(_0x4f021b){if(_0x4f021b){_0x4ef6f3=_0x4f021b[_0x1382('0x55')];if(!_0x3ea941[_0x1382('0x3e')][_0x1382('0x44')]('nolimit')){_0x1af7a6['limit']=qs[_0x1382('0x2c')](_0x3ea941[_0x1382('0x3e')]['limit']);_0x1af7a6[_0x1382('0x2b')]=qs[_0x1382('0x2b')](_0x3ea941[_0x1382('0x3e')][_0x1382('0x2b')]);}return _0x5b4da8[_0x1382('0x5e')](_0x1af7a6);}})[_0x1382('0x1f')](function(_0x49ab8e){if(_0x49ab8e){return _0x49ab8e?{'count':_0x4ef6f3,'rows':_0x49ab8e}:null;}})['then'](respondWithResult(_0x36a458,null))[_0x1382('0x52')](handleError(_0x36a458,null));};exports['setTags']=function(_0x52d0e5,_0x44fe72,_0x3b0f19){if(_0x52d0e5[_0x1382('0x58')]['id']){delete _0x52d0e5[_0x1382('0x58')]['id'];}return db['FreshdeskConfiguration'][_0x1382('0x5a')]({'where':{'id':_0x52d0e5[_0x1382('0x54')]['id']}})['then'](handleEntityNotFound(_0x44fe72,null))[_0x1382('0x1f')](function(_0x50f85a){if(_0x50f85a){return _0x50f85a[_0x1382('0x60')](_0x52d0e5[_0x1382('0x58')][_0x1382('0x61')]||[]);}return null;})[_0x1382('0x1f')](respondWithResult(_0x44fe72,null))[_0x1382('0x52')](handleError(_0x44fe72,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index eceea9e..fb3d5b7 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x41b84c,_0xbeeff8){var _0x248c84=function(_0x36a845){while(--_0x36a845){_0x41b84c['push'](_0x41b84c['shift']());}};_0x248c84(++_0xbeeff8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x5fc3[_0x36bff5];return _0x80ade5;};'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 +var _0x1cb9=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x588d59,_0x362e0e){var _0x1b6c21=function(_0x403188){while(--_0x403188){_0x588d59['push'](_0x588d59['shift']());}};_0x1b6c21(++_0x362e0e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3fa88b,_0x23c82e){_0x3fa88b=_0x3fa88b-0x0;var _0x26c5fe=_0x1cb9[_0x3fa88b];return _0x26c5fe;};'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 diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index cd62e69..8aa78c4 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 _0x8d42=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1e90af,_0x4ba6ce){var _0x7f1a60=function(_0x5eaac3){while(--_0x5eaac3){_0x1e90af['push'](_0x1e90af['shift']());}};_0x7f1a60(++_0x4ba6ce);}(_0x8d42,0x184));var _0x28d4=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x8d42[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x28d4('0x0'));var util=require(_0x28d4('0x1'));var moment=require(_0x28d4('0x2'));var BPromise=require(_0x28d4('0x3'));var rs=require(_0x28d4('0x4'));var fs=require('fs');var Redis=require(_0x28d4('0x5'));var db=require(_0x28d4('0x6'))['db'];var utils=require(_0x28d4('0x7'));var logger=require(_0x28d4('0x8'))('rpc');var config=require(_0x28d4('0x9'));var jayson=require(_0x28d4('0xa'));var client=jayson[_0x28d4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8a02,_0x2ff748,_0x12c745){return new BPromise(function(_0x22c682,_0x6f65da){return client[_0x28d4('0xc')](_0x3f8a02,_0x12c745)[_0x28d4('0xd')](function(_0x2c7087){logger[_0x28d4('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2ff748,_0x28d4('0xf'));logger['debug'](_0x28d4('0x10'),_0x2ff748,_0x28d4('0xf'),JSON[_0x28d4('0x11')](_0x2c7087));if(_0x2c7087[_0x28d4('0x12')]){if(_0x2c7087[_0x28d4('0x12')]['code']===0x1f4){logger[_0x28d4('0x12')](_0x28d4('0x13'),_0x2ff748,_0x2c7087[_0x28d4('0x12')][_0x28d4('0x14')]);return _0x6f65da(_0x2c7087[_0x28d4('0x12')][_0x28d4('0x14')]);}logger[_0x28d4('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2ff748,_0x2c7087[_0x28d4('0x12')][_0x28d4('0x14')]);return _0x22c682(_0x2c7087[_0x28d4('0x12')][_0x28d4('0x14')]);}else{logger[_0x28d4('0xe')](_0x28d4('0x13'),_0x2ff748,_0x28d4('0xf'));_0x22c682(_0x2c7087['result'][_0x28d4('0x14')]);}})[_0x28d4('0x15')](function(_0x1d3a85){logger[_0x28d4('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2ff748,_0x1d3a85);_0x6f65da(_0x1d3a85);});});} \ No newline at end of file +var _0x60fe=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x30b037,_0x129997){var _0x41bd3e=function(_0x3f9bdd){while(--_0x3f9bdd){_0x30b037['push'](_0x30b037['shift']());}};_0x41bd3e(++_0x129997);}(_0x60fe,0x12e));var _0xe60f=function(_0x4a8b72,_0xb54e90){_0x4a8b72=_0x4a8b72-0x0;var _0x217237=_0x60fe[_0x4a8b72];return _0x217237;};'use strict';var _=require(_0xe60f('0x0'));var util=require('util');var moment=require(_0xe60f('0x1'));var BPromise=require('bluebird');var rs=require(_0xe60f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe60f('0x3'))['db'];var utils=require(_0xe60f('0x4'));var logger=require('../../config/logger')(_0xe60f('0x5'));var config=require(_0xe60f('0x6'));var jayson=require(_0xe60f('0x7'));var client=jayson[_0xe60f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1244c3,_0x58906d,_0x10507c){return new BPromise(function(_0x5de816,_0x1c1cc2){return client[_0xe60f('0x9')](_0x1244c3,_0x10507c)[_0xe60f('0xa')](function(_0x186864){logger[_0xe60f('0xb')](_0xe60f('0xc'),_0x58906d,'request\x20sent');logger[_0xe60f('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x58906d,_0xe60f('0xe'),JSON[_0xe60f('0xf')](_0x186864));if(_0x186864[_0xe60f('0x10')]){if(_0x186864['error'][_0xe60f('0x11')]===0x1f4){logger[_0xe60f('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x58906d,_0x186864[_0xe60f('0x10')][_0xe60f('0x12')]);return _0x1c1cc2(_0x186864[_0xe60f('0x10')][_0xe60f('0x12')]);}logger[_0xe60f('0x10')](_0xe60f('0xc'),_0x58906d,_0x186864[_0xe60f('0x10')][_0xe60f('0x12')]);return _0x5de816(_0x186864['error'][_0xe60f('0x12')]);}else{logger[_0xe60f('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x58906d,_0xe60f('0xe'));_0x5de816(_0x186864[_0xe60f('0x13')][_0xe60f('0x12')]);}})[_0xe60f('0x14')](function(_0x520fe8){logger[_0xe60f('0x10')](_0xe60f('0xc'),_0x58906d,_0x520fe8);_0x1c1cc2(_0x520fe8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 8104109..0eafcf1 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 _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xedd9,0xfc));var _0x9edd=function(_0xf2fadb,_0x43fb47){_0xf2fadb=_0xf2fadb-0x0;var _0x3d342a=_0xedd9[_0xf2fadb];return _0x3d342a;};'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('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x221f3f,_0x572f89){var _0x4cee7c=function(_0x474015){while(--_0x474015){_0x221f3f['push'](_0x221f3f['shift']());}};_0x4cee7c(++_0x572f89);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6d52451..f525470 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 _0xfb92=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x345c79,_0x10b704){var _0x26c652=function(_0x3879ad){while(--_0x3879ad){_0x345c79['push'](_0x345c79['shift']());}};_0x26c652(++_0x10b704);}(_0xfb92,0x1e3));var _0x2fb9=function(_0x88ea4e,_0x16b52a){_0x88ea4e=_0x88ea4e-0x0;var _0x91419e=_0xfb92[_0x88ea4e];return _0x91419e;};'use strict';var Sequelize=require(_0x2fb9('0x0'));module['exports']={'type':{'type':Sequelize[_0x2fb9('0x1')](_0x2fb9('0x2'),_0x2fb9('0x3'),_0x2fb9('0x4'),_0x2fb9('0x5')),'defaultValue':_0x2fb9('0x2')},'content':{'type':Sequelize[_0x2fb9('0x6')]},'key':{'type':Sequelize[_0x2fb9('0x6')]},'keyType':{'type':Sequelize[_0x2fb9('0x1')](_0x2fb9('0x2'),_0x2fb9('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2fb9('0x6')]},'customField':{'type':Sequelize[_0x2fb9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2fb9('0x6')]}}; \ No newline at end of file +var _0xe14d=['exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize'];(function(_0x5e1b4b,_0x3a51cb){var _0x52cbc6=function(_0x4dbdb4){while(--_0x4dbdb4){_0x5e1b4b['push'](_0x5e1b4b['shift']());}};_0x52cbc6(++_0x3a51cb);}(_0xe14d,0x1ee));var _0xde14=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xe14d[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'type':{'type':Sequelize[_0xde14('0x2')](_0xde14('0x3'),'variable',_0xde14('0x4'),_0xde14('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xde14('0x6')]},'key':{'type':Sequelize[_0xde14('0x6')]},'keyType':{'type':Sequelize[_0xde14('0x2')](_0xde14('0x3'),_0xde14('0x7'),_0xde14('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xde14('0x6')]},'customField':{'type':Sequelize[_0xde14('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde14('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 33c769b..75901ee 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 _0x24be=['query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','lodash','squel','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','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FreshdeskField','rawAttributes','key','map'];(function(_0x3ab980,_0x43f8b5){var _0x2aed95=function(_0x1d4de4){while(--_0x1d4de4){_0x3ab980['push'](_0x3ab980['shift']());}};_0x2aed95(++_0x43f8b5);}(_0x24be,0x14c));var _0xe24b=function(_0x5826a4,_0x2d6fcb){_0x5826a4=_0x5826a4-0x0;var _0xbe6092=_0x24be[_0x5826a4];return _0xbe6092;};'use strict';var pdf=require(_0xe24b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe24b('0x1'));var zipdir=require(_0xe24b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe24b('0x3'));var BPromise=require(_0xe24b('0x4'));var Mustache=require(_0xe24b('0x5'));var util=require(_0xe24b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe24b('0x7'));var fs=require('fs');var _=require(_0xe24b('0x8'));var squel=require(_0xe24b('0x9'));var crypto=require(_0xe24b('0xa'));var jsforce=require(_0xe24b('0xb'));var deskjs=require(_0xe24b('0xc'));var toCsv=require(_0xe24b('0xd'));var querystring=require(_0xe24b('0xe'));var Papa=require(_0xe24b('0xf'));var Redis=require(_0xe24b('0x10'));var authService=require(_0xe24b('0x11'));var qs=require(_0xe24b('0x12'));var as=require(_0xe24b('0x13'));var hardwareService=require(_0xe24b('0x14'));var logger=require(_0xe24b('0x15'))(_0xe24b('0x16'));var utils=require(_0xe24b('0x17'));var config=require(_0xe24b('0x18'));var db=require(_0xe24b('0x19'))['db'];function respondWithStatusCode(_0x57d6fc,_0x4bc6a9){_0x4bc6a9=_0x4bc6a9||0xcc;return function(_0x3a1da6){if(_0x3a1da6){return _0x57d6fc[_0xe24b('0x1a')](_0x4bc6a9);}return _0x57d6fc['status'](_0x4bc6a9)[_0xe24b('0x1b')]();};}function respondWithResult(_0x5bbe9e,_0x260712){_0x260712=_0x260712||0xc8;return function(_0xe35132){if(_0xe35132){return _0x5bbe9e[_0xe24b('0x1c')](_0x260712)[_0xe24b('0x1d')](_0xe35132);}};}function respondWithFilteredResult(_0x28f5b5,_0xa59b6d){return function(_0x174648){if(_0x174648){var _0x2c36e1=_0x174648['count'],_0x2ce1a7=_0xa59b6d[_0xe24b('0x1e')],_0x5c065d=_0xa59b6d['offset']+_0xa59b6d[_0xe24b('0x1f')],_0x3127ba;if(_0x5c065d>=_0x2c36e1){_0x5c065d=_0x2c36e1;_0x3127ba=0xc8;}else{_0x3127ba=0xce;}_0x28f5b5[_0xe24b('0x1c')](_0x3127ba);return _0x28f5b5[_0xe24b('0x20')](_0xe24b('0x21'),_0x2ce1a7+'-'+_0x5c065d+'/'+_0x2c36e1)[_0xe24b('0x1d')](_0x174648);}return null;};}function patchUpdates(_0x13a8ba){return function(_0x3eb7a5){try{jsonpatch[_0xe24b('0x22')](_0x3eb7a5,_0x13a8ba,!![]);}catch(_0x6cc8b7){return BPromise[_0xe24b('0x23')](_0x6cc8b7);}return _0x3eb7a5[_0xe24b('0x24')]();};}function saveUpdates(_0x510f2e,_0x1479d6){return function(_0x32bb7b){if(_0x32bb7b){return _0x32bb7b[_0xe24b('0x25')](_0x510f2e)[_0xe24b('0x26')](function(_0x130244){return _0x130244;});}return null;};}function removeEntity(_0x20866e,_0x2946fc){return function(_0x4c1763){if(_0x4c1763){return _0x4c1763[_0xe24b('0x27')]()[_0xe24b('0x26')](function(){_0x20866e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c907a,_0x506ef4){return function(_0x3046ef){if(!_0x3046ef){_0x4c907a[_0xe24b('0x1a')](0x194);}return _0x3046ef;};}function handleError(_0x7db912,_0x257c84){_0x257c84=_0x257c84||0x1f4;return function(_0x10f898){logger['error'](_0x10f898[_0xe24b('0x28')]);if(_0x10f898[_0xe24b('0x29')]){delete _0x10f898['name'];}_0x7db912[_0xe24b('0x1c')](_0x257c84)[_0xe24b('0x2a')](_0x10f898);};}exports[_0xe24b('0x2b')]=function(_0x2d5653,_0x4e1a5d){var _0x597a4b={},_0x4fb3da={},_0x49b001={'count':0x0,'rows':[]};var _0x16d25f=_['map'](db[_0xe24b('0x2c')][_0xe24b('0x2d')],function(_0x153865){return{'name':_0x153865['fieldName'],'type':_0x153865['type'][_0xe24b('0x2e')]};});_0x4fb3da['model']=_[_0xe24b('0x2f')](_0x16d25f,_0xe24b('0x29'));_0x4fb3da[_0xe24b('0x30')]=_[_0xe24b('0x31')](_0x2d5653[_0xe24b('0x30')]);_0x4fb3da[_0xe24b('0x32')]=_['intersection'](_0x4fb3da[_0xe24b('0x33')],_0x4fb3da['query']);_0x597a4b[_0xe24b('0x34')]=_[_0xe24b('0x35')](_0x4fb3da['model'],qs['fields'](_0x2d5653[_0xe24b('0x30')][_0xe24b('0x36')]));_0x597a4b[_0xe24b('0x34')]=_0x597a4b[_0xe24b('0x34')][_0xe24b('0x37')]?_0x597a4b[_0xe24b('0x34')]:_0x4fb3da['model'];if(!_0x2d5653[_0xe24b('0x30')]['hasOwnProperty'](_0xe24b('0x38'))){_0x597a4b[_0xe24b('0x1f')]=qs[_0xe24b('0x1f')](_0x2d5653['query'][_0xe24b('0x1f')]);_0x597a4b[_0xe24b('0x1e')]=qs[_0xe24b('0x1e')](_0x2d5653['query'][_0xe24b('0x1e')]);}_0x597a4b[_0xe24b('0x39')]=qs['sort'](_0x2d5653[_0xe24b('0x30')][_0xe24b('0x3a')]);_0x597a4b['where']=qs['filters'](_[_0xe24b('0x3b')](_0x2d5653[_0xe24b('0x30')],_0x4fb3da[_0xe24b('0x32')]),_0x16d25f);if(_0x2d5653[_0xe24b('0x30')][_0xe24b('0x3c')]){_0x597a4b[_0xe24b('0x3d')]=_[_0xe24b('0x3e')](_0x597a4b[_0xe24b('0x3d')],{'$or':_[_0xe24b('0x2f')](_0x16d25f,function(_0x6d7a19){if(_0x6d7a19[_0xe24b('0x3f')]!==_0xe24b('0x40')){var _0x5008da={};_0x5008da[_0x6d7a19[_0xe24b('0x29')]]={'$like':'%'+_0x2d5653[_0xe24b('0x30')][_0xe24b('0x3c')]+'%'};return _0x5008da;}})});}_0x597a4b=_['merge']({},_0x597a4b,_0x2d5653[_0xe24b('0x41')]);var _0xf70510={'where':_0x597a4b[_0xe24b('0x3d')]};return db[_0xe24b('0x2c')]['count'](_0xf70510)[_0xe24b('0x26')](function(_0x4031bb){_0x49b001[_0xe24b('0x42')]=_0x4031bb;if(_0x2d5653['query'][_0xe24b('0x43')]){_0x597a4b[_0xe24b('0x44')]=[{'all':!![]}];}return db['FreshdeskField'][_0xe24b('0x45')](_0x597a4b);})[_0xe24b('0x26')](function(_0x2faf6a){_0x49b001[_0xe24b('0x46')]=_0x2faf6a;return _0x49b001;})[_0xe24b('0x26')](respondWithFilteredResult(_0x4e1a5d,_0x597a4b))[_0xe24b('0x47')](handleError(_0x4e1a5d,null));};exports[_0xe24b('0x48')]=function(_0x146583,_0x125e97){var _0x5ca56a={'raw':!![],'where':{'id':_0x146583['params']['id']}},_0x4d9c41={};_0x4d9c41[_0xe24b('0x33')]=_['keys'](db[_0xe24b('0x2c')][_0xe24b('0x2d')]);_0x4d9c41[_0xe24b('0x30')]=_[_0xe24b('0x31')](_0x146583['query']);_0x4d9c41[_0xe24b('0x32')]=_['intersection'](_0x4d9c41[_0xe24b('0x33')],_0x4d9c41[_0xe24b('0x30')]);_0x5ca56a['attributes']=_[_0xe24b('0x35')](_0x4d9c41[_0xe24b('0x33')],qs['fields'](_0x146583[_0xe24b('0x30')][_0xe24b('0x36')]));_0x5ca56a[_0xe24b('0x34')]=_0x5ca56a[_0xe24b('0x34')][_0xe24b('0x37')]?_0x5ca56a[_0xe24b('0x34')]:_0x4d9c41['model'];if(_0x146583[_0xe24b('0x30')][_0xe24b('0x43')]){_0x5ca56a[_0xe24b('0x44')]=[{'all':!![]}];}_0x5ca56a=_[_0xe24b('0x3e')]({},_0x5ca56a,_0x146583[_0xe24b('0x41')]);return db['FreshdeskField'][_0xe24b('0x49')](_0x5ca56a)['then'](handleEntityNotFound(_0x125e97,null))[_0xe24b('0x26')](respondWithResult(_0x125e97,null))['catch'](handleError(_0x125e97,null));};exports['create']=function(_0x15e49b,_0x13c79f){return db['FreshdeskField'][_0xe24b('0x4a')](_0x15e49b['body'],{})['then'](respondWithResult(_0x13c79f,0xc9))[_0xe24b('0x47')](handleError(_0x13c79f,null));};exports[_0xe24b('0x25')]=function(_0x455490,_0x3ca3d8){if(_0x455490[_0xe24b('0x4b')]['id']){delete _0x455490['body']['id'];}return db['FreshdeskField'][_0xe24b('0x49')]({'where':{'id':_0x455490['params']['id']}})[_0xe24b('0x26')](handleEntityNotFound(_0x3ca3d8,null))[_0xe24b('0x26')](saveUpdates(_0x455490[_0xe24b('0x4b')],null))[_0xe24b('0x26')](respondWithResult(_0x3ca3d8,null))[_0xe24b('0x47')](handleError(_0x3ca3d8,null));};exports[_0xe24b('0x27')]=function(_0x24bf93,_0x3bead0){return db[_0xe24b('0x2c')]['find']({'where':{'id':_0x24bf93['params']['id']}})[_0xe24b('0x26')](handleEntityNotFound(_0x3bead0,null))[_0xe24b('0x26')](removeEntity(_0x3bead0,null))['catch'](handleError(_0x3bead0,null));}; \ No newline at end of file +var _0x042d=['body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','count','offset','limit','status','set','Content-Range','apply','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','find','catch','create','update'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0x042d,0x1e5));var _0xd042=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0x042d[_0x44afa4];return _0xcad289;};'use strict';var pdf=require(_0xd042('0x0'));var emlformat=require(_0xd042('0x1'));var rimraf=require(_0xd042('0x2'));var zipdir=require(_0xd042('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd042('0x4'));var moment=require('moment');var BPromise=require(_0xd042('0x5'));var Mustache=require(_0xd042('0x6'));var util=require(_0xd042('0x7'));var path=require(_0xd042('0x8'));var sox=require(_0xd042('0x9'));var csv=require(_0xd042('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd042('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd042('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd042('0xd'));var Papa=require(_0xd042('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd042('0xf'));var as=require(_0xd042('0x10'));var hardwareService=require(_0xd042('0x11'));var logger=require(_0xd042('0x12'))(_0xd042('0x13'));var utils=require('../../config/utils');var config=require(_0xd042('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x103600,_0x436f21){_0x436f21=_0x436f21||0xcc;return function(_0x4ab0de){if(_0x4ab0de){return _0x103600[_0xd042('0x15')](_0x436f21);}return _0x103600['status'](_0x436f21)[_0xd042('0x16')]();};}function respondWithResult(_0x5b0fa2,_0x5ac340){_0x5ac340=_0x5ac340||0xc8;return function(_0x21db22){if(_0x21db22){return _0x5b0fa2['status'](_0x5ac340)['json'](_0x21db22);}};}function respondWithFilteredResult(_0x4f64fb,_0x14c9f9){return function(_0x2b2d12){if(_0x2b2d12){var _0xabffc3=_0x2b2d12[_0xd042('0x17')],_0x3679eb=_0x14c9f9[_0xd042('0x18')],_0x3a4cbe=_0x14c9f9['offset']+_0x14c9f9[_0xd042('0x19')],_0x55f1c1;if(_0x3a4cbe>=_0xabffc3){_0x3a4cbe=_0xabffc3;_0x55f1c1=0xc8;}else{_0x55f1c1=0xce;}_0x4f64fb[_0xd042('0x1a')](_0x55f1c1);return _0x4f64fb[_0xd042('0x1b')](_0xd042('0x1c'),_0x3679eb+'-'+_0x3a4cbe+'/'+_0xabffc3)['json'](_0x2b2d12);}return null;};}function patchUpdates(_0x254dd7){return function(_0x5153ef){try{jsonpatch[_0xd042('0x1d')](_0x5153ef,_0x254dd7,!![]);}catch(_0x4225e7){return BPromise['reject'](_0x4225e7);}return _0x5153ef['save']();};}function saveUpdates(_0x20f6ce,_0x584e0f){return function(_0x28037d){if(_0x28037d){return _0x28037d['update'](_0x20f6ce)[_0xd042('0x1e')](function(_0x51be12){return _0x51be12;});}return null;};}function removeEntity(_0x3eeba3,_0x365172){return function(_0xd0d60d){if(_0xd0d60d){return _0xd0d60d['destroy']()[_0xd042('0x1e')](function(){_0x3eeba3[_0xd042('0x1a')](0xcc)[_0xd042('0x16')]();});}};}function handleEntityNotFound(_0x58bc6d,_0x2bbf19){return function(_0x54d269){if(!_0x54d269){_0x58bc6d[_0xd042('0x15')](0x194);}return _0x54d269;};}function handleError(_0x2611ea,_0x196b67){_0x196b67=_0x196b67||0x1f4;return function(_0x52fdd0){logger[_0xd042('0x1f')](_0x52fdd0[_0xd042('0x20')]);if(_0x52fdd0[_0xd042('0x21')]){delete _0x52fdd0[_0xd042('0x21')];}_0x2611ea[_0xd042('0x1a')](_0x196b67)[_0xd042('0x22')](_0x52fdd0);};}exports[_0xd042('0x23')]=function(_0x2d03dd,_0x27775f){var _0x12cbfa={},_0x196b3d={},_0x4fb087={'count':0x0,'rows':[]};var _0x3dbdc2=_[_0xd042('0x24')](db[_0xd042('0x25')][_0xd042('0x26')],function(_0x125632){return{'name':_0x125632[_0xd042('0x27')],'type':_0x125632['type'][_0xd042('0x28')]};});_0x196b3d[_0xd042('0x29')]=_[_0xd042('0x24')](_0x3dbdc2,_0xd042('0x21'));_0x196b3d[_0xd042('0x2a')]=_[_0xd042('0x2b')](_0x2d03dd[_0xd042('0x2a')]);_0x196b3d[_0xd042('0x2c')]=_[_0xd042('0x2d')](_0x196b3d[_0xd042('0x29')],_0x196b3d[_0xd042('0x2a')]);_0x12cbfa['attributes']=_[_0xd042('0x2d')](_0x196b3d[_0xd042('0x29')],qs[_0xd042('0x2e')](_0x2d03dd[_0xd042('0x2a')][_0xd042('0x2e')]));_0x12cbfa[_0xd042('0x2f')]=_0x12cbfa['attributes'][_0xd042('0x30')]?_0x12cbfa[_0xd042('0x2f')]:_0x196b3d[_0xd042('0x29')];if(!_0x2d03dd['query'][_0xd042('0x31')](_0xd042('0x32'))){_0x12cbfa['limit']=qs[_0xd042('0x19')](_0x2d03dd['query'][_0xd042('0x19')]);_0x12cbfa[_0xd042('0x18')]=qs[_0xd042('0x18')](_0x2d03dd[_0xd042('0x2a')][_0xd042('0x18')]);}_0x12cbfa[_0xd042('0x33')]=qs[_0xd042('0x34')](_0x2d03dd['query'][_0xd042('0x34')]);_0x12cbfa[_0xd042('0x35')]=qs[_0xd042('0x2c')](_[_0xd042('0x36')](_0x2d03dd[_0xd042('0x2a')],_0x196b3d[_0xd042('0x2c')]),_0x3dbdc2);if(_0x2d03dd[_0xd042('0x2a')][_0xd042('0x37')]){_0x12cbfa[_0xd042('0x35')]=_['merge'](_0x12cbfa[_0xd042('0x35')],{'$or':_[_0xd042('0x24')](_0x3dbdc2,function(_0x3f604e){if(_0x3f604e['type']!==_0xd042('0x38')){var _0x488f04={};_0x488f04[_0x3f604e[_0xd042('0x21')]]={'$like':'%'+_0x2d03dd['query'][_0xd042('0x37')]+'%'};return _0x488f04;}})});}_0x12cbfa=_[_0xd042('0x39')]({},_0x12cbfa,_0x2d03dd[_0xd042('0x3a')]);var _0x377958={'where':_0x12cbfa[_0xd042('0x35')]};return db[_0xd042('0x25')]['count'](_0x377958)[_0xd042('0x1e')](function(_0x2da574){_0x4fb087['count']=_0x2da574;if(_0x2d03dd[_0xd042('0x2a')][_0xd042('0x3b')]){_0x12cbfa[_0xd042('0x3c')]=[{'all':!![]}];}return db[_0xd042('0x25')]['findAll'](_0x12cbfa);})[_0xd042('0x1e')](function(_0x3a6680){_0x4fb087[_0xd042('0x3d')]=_0x3a6680;return _0x4fb087;})[_0xd042('0x1e')](respondWithFilteredResult(_0x27775f,_0x12cbfa))['catch'](handleError(_0x27775f,null));};exports[_0xd042('0x3e')]=function(_0x43ea75,_0x5bdbb9){var _0x42acbe={'raw':!![],'where':{'id':_0x43ea75['params']['id']}},_0x1236a0={};_0x1236a0[_0xd042('0x29')]=_[_0xd042('0x2b')](db[_0xd042('0x25')][_0xd042('0x26')]);_0x1236a0[_0xd042('0x2a')]=_[_0xd042('0x2b')](_0x43ea75[_0xd042('0x2a')]);_0x1236a0['filters']=_[_0xd042('0x2d')](_0x1236a0[_0xd042('0x29')],_0x1236a0[_0xd042('0x2a')]);_0x42acbe[_0xd042('0x2f')]=_[_0xd042('0x2d')](_0x1236a0[_0xd042('0x29')],qs[_0xd042('0x2e')](_0x43ea75[_0xd042('0x2a')][_0xd042('0x2e')]));_0x42acbe[_0xd042('0x2f')]=_0x42acbe[_0xd042('0x2f')][_0xd042('0x30')]?_0x42acbe[_0xd042('0x2f')]:_0x1236a0[_0xd042('0x29')];if(_0x43ea75[_0xd042('0x2a')]['includeAll']){_0x42acbe[_0xd042('0x3c')]=[{'all':!![]}];}_0x42acbe=_['merge']({},_0x42acbe,_0x43ea75['options']);return db[_0xd042('0x25')][_0xd042('0x3f')](_0x42acbe)['then'](handleEntityNotFound(_0x5bdbb9,null))[_0xd042('0x1e')](respondWithResult(_0x5bdbb9,null))[_0xd042('0x40')](handleError(_0x5bdbb9,null));};exports[_0xd042('0x41')]=function(_0x4bd60a,_0x5a0aad){return db[_0xd042('0x25')][_0xd042('0x41')](_0x4bd60a['body'],{})[_0xd042('0x1e')](respondWithResult(_0x5a0aad,0xc9))[_0xd042('0x40')](handleError(_0x5a0aad,null));};exports[_0xd042('0x42')]=function(_0x2f3069,_0x3b0750){if(_0x2f3069[_0xd042('0x43')]['id']){delete _0x2f3069[_0xd042('0x43')]['id'];}return db['FreshdeskField'][_0xd042('0x3f')]({'where':{'id':_0x2f3069[_0xd042('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b0750,null))['then'](saveUpdates(_0x2f3069['body'],null))[_0xd042('0x1e')](respondWithResult(_0x3b0750,null))[_0xd042('0x40')](handleError(_0x3b0750,null));};exports['destroy']=function(_0xc4004c,_0x23f286){return db['FreshdeskField'][_0xd042('0x3f')]({'where':{'id':_0xc4004c[_0xd042('0x44')]['id']}})[_0xd042('0x1e')](handleEntityNotFound(_0x23f286,null))['then'](removeEntity(_0x23f286,null))['catch'](handleError(_0x23f286,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 4d23048..c8a4f1c 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 _0xe7df=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x18d665,_0x2f65ab){var _0x4abe5c=function(_0x199e11){while(--_0x199e11){_0x18d665['push'](_0x18d665['shift']());}};_0x4abe5c(++_0x2f65ab);}(_0xe7df,0x98));var _0xfe7d=function(_0x1df24f,_0x3fef84){_0x1df24f=_0x1df24f-0x0;var _0x1fe835=_0xe7df[_0x1df24f];return _0x1fe835;};'use strict';var _=require(_0xfe7d('0x0'));var util=require(_0xfe7d('0x1'));var logger=require(_0xfe7d('0x2'))(_0xfe7d('0x3'));var moment=require(_0xfe7d('0x4'));var BPromise=require(_0xfe7d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe7d('0x6'));var rimraf=require(_0xfe7d('0x7'));var config=require('../../config/environment');var attributes=require(_0xfe7d('0x8'));module['exports']=function(_0x4e7f9d,_0x44fd2b){return _0x4e7f9d[_0xfe7d('0x9')](_0xfe7d('0xa'),attributes,{'tableName':_0xfe7d('0xb'),'paranoid':![],'indexes':[{'name':_0xfe7d('0xc'),'fields':[_0xfe7d('0xd'),_0xfe7d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7d0=['exports','define','int_freshdesk_fields','util','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0xb4f654,_0x33ce4b){var _0x521323=function(_0x531016){while(--_0x531016){_0xb4f654['push'](_0xb4f654['shift']());}};_0x521323(++_0x33ce4b);}(_0xf7d0,0x139));var _0x0f7d=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0xf7d0[_0xfd495c];return _0x561dd8;};'use strict';var _=require('lodash');var util=require(_0x0f7d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0f7d('0x1'));var BPromise=require(_0x0f7d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f7d('0x3'));var rimraf=require(_0x0f7d('0x4'));var config=require(_0x0f7d('0x5'));var attributes=require(_0x0f7d('0x6'));module[_0x0f7d('0x7')]=function(_0x1fa0ef,_0x1b6b19){return _0x1fa0ef[_0x0f7d('0x8')]('FreshdeskField',attributes,{'tableName':_0x0f7d('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField','FieldId'],'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 41ba86b..73a65f9 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(_0x598737,_0x53c409){var _0x13782d=function(_0x513ce0){while(--_0x513ce0){_0x598737['push'](_0x598737['shift']());}};_0x13782d(++_0x53c409);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e99bc,_0x3a0006){_0x1e99bc=_0x1e99bc-0x0;var _0x281232=_0xb10b[_0x1e99bc];return _0x281232;};'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 _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x272474,_0x38f721){_0x272474=_0x272474-0x0;var _0x5ccb3b=_0x7a54[_0x272474];return _0x5ccb3b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 699a642..2ef9c7b 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 _0x6060=['/:id/configurations','getConfigurations','getFields','create','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show'];(function(_0xc86b48,_0x212e1b){var _0x1741e9=function(_0xf15453){while(--_0xf15453){_0xc86b48['push'](_0xc86b48['shift']());}};_0x1741e9(++_0x212e1b);}(_0x6060,0x1bf));var _0x0606=function(_0x37026f,_0x2df88f){_0x37026f=_0x37026f-0x0;var _0x40cb74=_0x6060[_0x37026f];return _0x40cb74;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0606('0x0'));var timeout=require(_0x0606('0x1'));var express=require(_0x0606('0x2'));var router=express[_0x0606('0x3')]();var auth=require(_0x0606('0x4'));var interaction=require(_0x0606('0x5'));var config=require(_0x0606('0x6'));var controller=require(_0x0606('0x7'));router[_0x0606('0x8')]('/',auth['isAuthenticated'](),controller[_0x0606('0x9')]);router[_0x0606('0x8')](_0x0606('0xa'),auth[_0x0606('0xb')](),controller[_0x0606('0xc')]);router[_0x0606('0x8')](_0x0606('0xd'),auth['isAuthenticated'](),controller[_0x0606('0xe')]);router[_0x0606('0x8')]('/:id/fields',auth[_0x0606('0xb')](),controller[_0x0606('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0606('0x10')]);router[_0x0606('0x11')](_0x0606('0xd'),auth[_0x0606('0xb')](),controller['addConfiguration']);router[_0x0606('0x12')](_0x0606('0xa'),auth[_0x0606('0xb')](),controller[_0x0606('0x13')]);router[_0x0606('0x14')](_0x0606('0xa'),auth['isAuthenticated'](),controller[_0x0606('0x15')]);module[_0x0606('0x16')]=router; \ No newline at end of file +var _0x8e6b=['isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8e6b,0x147));var _0xb8e6=function(_0xfac751,_0x4faaba){_0xfac751=_0xfac751-0x0;var _0x7ed761=_0x8e6b[_0xfac751];return _0x7ed761;};'use strict';var multer=require(_0xb8e6('0x0'));var util=require(_0xb8e6('0x1'));var path=require('path');var timeout=require(_0xb8e6('0x2'));var express=require(_0xb8e6('0x3'));var router=express['Router']();var auth=require(_0xb8e6('0x4'));var interaction=require(_0xb8e6('0x5'));var config=require(_0xb8e6('0x6'));var controller=require(_0xb8e6('0x7'));router[_0xb8e6('0x8')]('/',auth[_0xb8e6('0x9')](),controller[_0xb8e6('0xa')]);router[_0xb8e6('0x8')](_0xb8e6('0xb'),auth[_0xb8e6('0x9')](),controller['show']);router[_0xb8e6('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb8e6('0xc')]);router[_0xb8e6('0x8')](_0xb8e6('0xd'),auth[_0xb8e6('0x9')](),controller[_0xb8e6('0xe')]);router[_0xb8e6('0xf')]('/',auth[_0xb8e6('0x9')](),controller[_0xb8e6('0x10')]);router[_0xb8e6('0xf')](_0xb8e6('0x11'),auth[_0xb8e6('0x9')](),controller[_0xb8e6('0x12')]);router[_0xb8e6('0x13')](_0xb8e6('0xb'),auth[_0xb8e6('0x9')](),controller[_0xb8e6('0x14')]);router[_0xb8e6('0x15')]('/:id',auth[_0xb8e6('0x9')](),controller[_0xb8e6('0x16')]);module[_0xb8e6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 55b9b34..096424e 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 _0xc891=['STRING','username','sequelize'];(function(_0x137c03,_0x5b0e26){var _0x762570=function(_0x452bc3){while(--_0x452bc3){_0x137c03['push'](_0x137c03['shift']());}};_0x762570(++_0x5b0e26);}(_0xc891,0x152));var _0x1c89=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xc891[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x1c89('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1c89('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x1c89('0x2')},'apiKey':{'type':Sequelize[_0x1c89('0x1')]},'remoteUri':{'type':Sequelize[_0x1c89('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x1c89('0x1')]}}; \ No newline at end of file +var _0x23db=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5cac79,_0x5f272d){var _0x4dba8c=function(_0x66543f){while(--_0x66543f){_0x5cac79['push'](_0x5cac79['shift']());}};_0x4dba8c(++_0x5f272d);}(_0x23db,0x141));var _0xb23d=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x23db[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0xb23d('0x0'));module[_0xb23d('0x1')]={'name':{'type':Sequelize[_0xb23d('0x2')]},'description':{'type':Sequelize[_0xb23d('0x2')]},'username':{'type':Sequelize[_0xb23d('0x2')],'unique':_0xb23d('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xb23d('0x4')},'serverUrl':{'type':Sequelize[_0xb23d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 51a1449..583445c 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 _0x38c7=['getConfigurations','FreshsalesConfiguration','sort','findOne','getSubjects','Descriptions','channel','Subjects','getFields','remoteUri','apiKey','substring','GET','format','/api/selector/owners','Token\x20token=','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','request-promise','moment','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','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\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','FreshsalesAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body'];(function(_0x4ead7d,_0xff4c17){var _0x312141=function(_0x53fe4c){while(--_0x53fe4c){_0x4ead7d['push'](_0x4ead7d['shift']());}};_0x312141(++_0xff4c17);}(_0x38c7,0x165));var _0x738c=function(_0x1ceee0,_0x527a5f){_0x1ceee0=_0x1ceee0-0x0;var _0x4a7ba5=_0x38c7[_0x1ceee0];return _0x4a7ba5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x738c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x738c('0x1'));var moment=require(_0x738c('0x2'));var BPromise=require(_0x738c('0x3'));var Mustache=require(_0x738c('0x4'));var util=require(_0x738c('0x5'));var path=require(_0x738c('0x6'));var sox=require(_0x738c('0x7'));var csv=require(_0x738c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x738c('0x9'));var squel=require(_0x738c('0xa'));var crypto=require('crypto');var jsforce=require(_0x738c('0xb'));var deskjs=require(_0x738c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x738c('0xd'));var Papa=require(_0x738c('0xe'));var Redis=require(_0x738c('0xf'));var authService=require(_0x738c('0x10'));var qs=require(_0x738c('0x11'));var as=require(_0x738c('0x12'));var hardwareService=require(_0x738c('0x13'));var logger=require(_0x738c('0x14'))(_0x738c('0x15'));var utils=require(_0x738c('0x16'));var config=require(_0x738c('0x17'));var db=require(_0x738c('0x18'))['db'];var integrations=require(_0x738c('0x19'));var jayson=require(_0x738c('0x1a'));var client=jayson[_0x738c('0x1b')][_0x738c('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2647a4,_0x6472b2,_0x2fe900){if(_0x2fe900){var _0x5e5cc4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e5cc4[_0x738c('0x1d')](_0x6472b2)){return _0x2647a4;}else{throw new db[(_0x738c('0x1e'))][(_0x738c('0x1f'))](_0x738c('0x20'));}}else{return _0x2647a4;}}function respondWithRpcPromise(_0x33492c,_0x35a94e,_0xf711f2,_0x4a2e73){return new BPromise(function(_0x252d12,_0x321c80){var _0x1400bb=_0x4a2e73||client;return _0x1400bb['request'](_0x33492c,_0xf711f2)['then'](function(_0xe8c121){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x35a94e,_0x738c('0x21'));logger[_0x738c('0x22')](_0x738c('0x23'),_0x35a94e,_0x738c('0x21'),JSON[_0x738c('0x24')](_0xe8c121));if(_0xe8c121[_0x738c('0x25')]){if(_0xe8c121['error'][_0x738c('0x26')]===0x1f4){logger[_0x738c('0x25')](_0x738c('0x27'),_0x35a94e,_0xe8c121['error'][_0x738c('0x28')]);return _0x321c80(_0xe8c121['error']['message']);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x35a94e,_0xe8c121[_0x738c('0x25')][_0x738c('0x28')]);return _0x252d12(_0xe8c121[_0x738c('0x25')][_0x738c('0x28')]);}else{logger[_0x738c('0x29')]('FreshsalesAccount,\x20%s,\x20%s',_0x35a94e,'request\x20sent');_0x252d12(_0xe8c121[_0x738c('0x2a')][_0x738c('0x28')]);}})['catch'](function(_0x617d88){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x35a94e,_0x617d88);_0x321c80(_0x617d88);});});}function respondWithStatusCode(_0x58b010,_0x26a797){_0x26a797=_0x26a797||0xcc;return function(_0x222302){if(_0x222302){return _0x58b010[_0x738c('0x2b')](_0x26a797);}return _0x58b010[_0x738c('0x2c')](_0x26a797)[_0x738c('0x2d')]();};}function respondWithResult(_0x266c95,_0x2c3e4d){_0x2c3e4d=_0x2c3e4d||0xc8;return function(_0x340514){if(_0x340514){return _0x266c95[_0x738c('0x2c')](_0x2c3e4d)['json'](_0x340514);}};}function respondWithFilteredResult(_0x4c3832,_0xadd58){return function(_0x3620e6){if(_0x3620e6){var _0x412241=_0x3620e6[_0x738c('0x2e')],_0x4469c3=_0xadd58[_0x738c('0x2f')],_0x15e7c8=_0xadd58[_0x738c('0x2f')]+_0xadd58['limit'],_0x4215db;if(_0x15e7c8>=_0x412241){_0x15e7c8=_0x412241;_0x4215db=0xc8;}else{_0x4215db=0xce;}_0x4c3832[_0x738c('0x2c')](_0x4215db);return _0x4c3832[_0x738c('0x30')](_0x738c('0x31'),_0x4469c3+'-'+_0x15e7c8+'/'+_0x412241)[_0x738c('0x32')](_0x3620e6);}return null;};}function patchUpdates(_0x412f4b){return function(_0x2d546c){try{jsonpatch['apply'](_0x2d546c,_0x412f4b,!![]);}catch(_0x31cb44){return BPromise[_0x738c('0x33')](_0x31cb44);}return _0x2d546c[_0x738c('0x34')]();};}function saveUpdates(_0x2251d6,_0x1e7d4f){return function(_0x4743ff){if(_0x4743ff){return _0x4743ff[_0x738c('0x35')](_0x2251d6)[_0x738c('0x36')](function(_0x56f523){return _0x56f523;});}return null;};}function removeEntity(_0x158998,_0x499886){return function(_0x5bc8c5){if(_0x5bc8c5){return _0x5bc8c5[_0x738c('0x37')]()['then'](function(){_0x158998['status'](0xcc)[_0x738c('0x2d')]();});}};}function handleEntityNotFound(_0x12fb68,_0x34d932){return function(_0x25b8a3){if(!_0x25b8a3){_0x12fb68[_0x738c('0x2b')](0x194);}return _0x25b8a3;};}function handleError(_0x32dc23,_0x412eed){_0x412eed=_0x412eed||0x1f4;return function(_0x5c095a){logger[_0x738c('0x25')](_0x5c095a[_0x738c('0x38')]);if(_0x5c095a[_0x738c('0x39')]){delete _0x5c095a[_0x738c('0x39')];}_0x32dc23[_0x738c('0x2c')](_0x412eed)[_0x738c('0x3a')](_0x5c095a);};}exports[_0x738c('0x3b')]=function(_0x480a29,_0x36c3b2){var _0x1b6b48={},_0xbb70e2={},_0x3157eb={'count':0x0,'rows':[]};var _0x3ee46a=_['map'](db[_0x738c('0x3c')][_0x738c('0x3d')],function(_0x3de8c2){return{'name':_0x3de8c2['fieldName'],'type':_0x3de8c2[_0x738c('0x3e')][_0x738c('0x3f')]};});_0xbb70e2[_0x738c('0x40')]=_[_0x738c('0x41')](_0x3ee46a,_0x738c('0x39'));_0xbb70e2[_0x738c('0x42')]=_[_0x738c('0x43')](_0x480a29[_0x738c('0x42')]);_0xbb70e2[_0x738c('0x44')]=_['intersection'](_0xbb70e2[_0x738c('0x40')],_0xbb70e2['query']);_0x1b6b48['attributes']=_[_0x738c('0x45')](_0xbb70e2[_0x738c('0x40')],qs[_0x738c('0x46')](_0x480a29[_0x738c('0x42')][_0x738c('0x46')]));_0x1b6b48['attributes']=_0x1b6b48['attributes']['length']?_0x1b6b48[_0x738c('0x47')]:_0xbb70e2['model'];if(!_0x480a29[_0x738c('0x42')][_0x738c('0x48')](_0x738c('0x49'))){_0x1b6b48[_0x738c('0x4a')]=qs['limit'](_0x480a29[_0x738c('0x42')][_0x738c('0x4a')]);_0x1b6b48[_0x738c('0x2f')]=qs[_0x738c('0x2f')](_0x480a29[_0x738c('0x42')][_0x738c('0x2f')]);}_0x1b6b48['order']=qs['sort'](_0x480a29[_0x738c('0x42')]['sort']);_0x1b6b48[_0x738c('0x4b')]=qs[_0x738c('0x44')](_[_0x738c('0x4c')](_0x480a29['query'],_0xbb70e2[_0x738c('0x44')]),_0x3ee46a);if(_0x480a29['query'][_0x738c('0x4d')]){_0x1b6b48[_0x738c('0x4b')]=_['merge'](_0x1b6b48[_0x738c('0x4b')],{'$or':_['map'](_0x3ee46a,function(_0x3bd397){if(_0x3bd397[_0x738c('0x3e')]!=='VIRTUAL'){var _0x22ed18={};_0x22ed18[_0x3bd397[_0x738c('0x39')]]={'$like':'%'+_0x480a29[_0x738c('0x42')][_0x738c('0x4d')]+'%'};return _0x22ed18;}})});}_0x1b6b48=_[_0x738c('0x4e')]({},_0x1b6b48,_0x480a29[_0x738c('0x4f')]);var _0x2053f4={'where':_0x1b6b48[_0x738c('0x4b')]};return db['FreshsalesAccount'][_0x738c('0x2e')](_0x2053f4)[_0x738c('0x36')](function(_0x150ee8){_0x3157eb[_0x738c('0x2e')]=_0x150ee8;if(_0x480a29[_0x738c('0x42')][_0x738c('0x50')]){_0x1b6b48[_0x738c('0x51')]=[{'all':!![]}];}return db[_0x738c('0x3c')][_0x738c('0x52')](_0x1b6b48);})[_0x738c('0x36')](function(_0x513926){_0x3157eb[_0x738c('0x53')]=_0x513926;return _0x3157eb;})['then'](respondWithFilteredResult(_0x36c3b2,_0x1b6b48))['catch'](handleError(_0x36c3b2,null));};exports[_0x738c('0x54')]=function(_0x3e31a0,_0x9e1939){var _0x253f9c={'raw':![],'where':{'id':_0x3e31a0[_0x738c('0x55')]['id']}},_0x198eeb={};_0x198eeb[_0x738c('0x40')]=_[_0x738c('0x43')](db[_0x738c('0x3c')][_0x738c('0x3d')]);_0x198eeb[_0x738c('0x42')]=_[_0x738c('0x43')](_0x3e31a0['query']);_0x198eeb['filters']=_[_0x738c('0x45')](_0x198eeb['model'],_0x198eeb[_0x738c('0x42')]);_0x253f9c[_0x738c('0x47')]=_[_0x738c('0x45')](_0x198eeb[_0x738c('0x40')],qs[_0x738c('0x46')](_0x3e31a0[_0x738c('0x42')][_0x738c('0x46')]));_0x253f9c[_0x738c('0x47')]=_0x253f9c[_0x738c('0x47')][_0x738c('0x56')]?_0x253f9c['attributes']:_0x198eeb[_0x738c('0x40')];if(_0x3e31a0[_0x738c('0x42')][_0x738c('0x50')]){_0x253f9c[_0x738c('0x51')]=[{'all':!![]}];}_0x253f9c=_[_0x738c('0x4e')]({},_0x253f9c,_0x3e31a0[_0x738c('0x4f')]);return db[_0x738c('0x3c')][_0x738c('0x57')](_0x253f9c)[_0x738c('0x36')](handleEntityNotFound(_0x9e1939,null))[_0x738c('0x36')](respondWithResult(_0x9e1939,null))[_0x738c('0x58')](handleError(_0x9e1939,null));};exports[_0x738c('0x59')]=function(_0x157a07,_0x531340){return db[_0x738c('0x3c')]['create'](_0x157a07[_0x738c('0x5a')],{})[_0x738c('0x36')](respondWithResult(_0x531340,0xc9))['catch'](handleError(_0x531340,null));};exports[_0x738c('0x35')]=function(_0x29dc04,_0x2c7566){if(_0x29dc04['body']['id']){delete _0x29dc04[_0x738c('0x5a')]['id'];}return db[_0x738c('0x3c')][_0x738c('0x57')]({'where':{'id':_0x29dc04[_0x738c('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c7566,null))[_0x738c('0x36')](saveUpdates(_0x29dc04[_0x738c('0x5a')],null))[_0x738c('0x36')](respondWithResult(_0x2c7566,null))[_0x738c('0x58')](handleError(_0x2c7566,null));};exports['destroy']=function(_0x31c784,_0x478abd){return db[_0x738c('0x3c')][_0x738c('0x57')]({'where':{'id':_0x31c784[_0x738c('0x55')]['id']}})[_0x738c('0x36')](handleEntityNotFound(_0x478abd,null))[_0x738c('0x36')](removeEntity(_0x478abd,null))[_0x738c('0x58')](handleError(_0x478abd,null));};exports[_0x738c('0x5b')]=function(_0x16a75c,_0x16ac49,_0x679974){var _0x413205={};var _0x24d6e5={};var _0x28b1c8;var _0x1365cf;return db[_0x738c('0x3c')]['findOne']({'where':{'id':_0x16a75c[_0x738c('0x55')]['id']}})[_0x738c('0x36')](handleEntityNotFound(_0x16ac49,null))[_0x738c('0x36')](function(_0x4e5175){if(_0x4e5175){_0x28b1c8=_0x4e5175;_0x24d6e5[_0x738c('0x40')]=_[_0x738c('0x43')](db[_0x738c('0x5c')]['rawAttributes']);_0x24d6e5[_0x738c('0x42')]=_[_0x738c('0x43')](_0x16a75c[_0x738c('0x42')]);_0x24d6e5[_0x738c('0x44')]=_[_0x738c('0x45')](_0x24d6e5[_0x738c('0x40')],_0x24d6e5['query']);_0x413205['attributes']=_[_0x738c('0x45')](_0x24d6e5[_0x738c('0x40')],qs[_0x738c('0x46')](_0x16a75c[_0x738c('0x42')][_0x738c('0x46')]));_0x413205[_0x738c('0x47')]=_0x413205['attributes']['length']?_0x413205[_0x738c('0x47')]:_0x24d6e5[_0x738c('0x40')];_0x413205['order']=qs['sort'](_0x16a75c[_0x738c('0x42')][_0x738c('0x5d')]);_0x413205[_0x738c('0x4b')]=qs[_0x738c('0x44')](_[_0x738c('0x4c')](_0x16a75c[_0x738c('0x42')],_0x24d6e5[_0x738c('0x44')]));if(_0x16a75c[_0x738c('0x42')][_0x738c('0x4d')]){_0x413205[_0x738c('0x4b')]=_[_0x738c('0x4e')](_0x413205[_0x738c('0x4b')],{'$or':_[_0x738c('0x41')](_0x413205['attributes'],function(_0x19c800){var _0xeb4851={};_0xeb4851[_0x19c800]={'$like':'%'+_0x16a75c[_0x738c('0x42')][_0x738c('0x4d')]+'%'};return _0xeb4851;})});}_0x413205=_[_0x738c('0x4e')]({},_0x413205,_0x16a75c[_0x738c('0x4f')]);return _0x28b1c8[_0x738c('0x5b')](_0x413205);}})[_0x738c('0x36')](function(_0x7c1834){if(_0x7c1834){_0x1365cf=_0x7c1834[_0x738c('0x56')];if(!_0x16a75c[_0x738c('0x42')][_0x738c('0x48')](_0x738c('0x49'))){_0x413205[_0x738c('0x4a')]=qs[_0x738c('0x4a')](_0x16a75c[_0x738c('0x42')][_0x738c('0x4a')]);_0x413205[_0x738c('0x2f')]=qs[_0x738c('0x2f')](_0x16a75c[_0x738c('0x42')][_0x738c('0x2f')]);}return _0x28b1c8['getConfigurations'](_0x413205);}})[_0x738c('0x36')](function(_0x86b78d){if(_0x86b78d){return _0x86b78d?{'count':_0x1365cf,'rows':_0x86b78d}:null;}})['then'](respondWithResult(_0x16ac49,null))[_0x738c('0x58')](handleError(_0x16ac49,null));};exports['addConfiguration']=function(_0x3cebc0,_0x106442,_0x53a20e){if(_0x3cebc0['body']['id']){delete _0x3cebc0[_0x738c('0x5a')]['id'];}return db[_0x738c('0x3c')][_0x738c('0x5e')]({'where':{'id':_0x3cebc0['params']['id']}})[_0x738c('0x36')](handleEntityNotFound(_0x106442,null))[_0x738c('0x36')](function(_0x103266){if(_0x103266){_0x3cebc0['body']['AccountId']=_0x103266['id'];_0x3cebc0[_0x738c('0x5a')]['Subjects']=integrations[_0x738c('0x5f')](_0x3cebc0[_0x738c('0x5a')]['channel'],_0x3cebc0['body'][_0x738c('0x3e')]);_0x3cebc0[_0x738c('0x5a')][_0x738c('0x60')]=integrations['getDescriptions'](_0x3cebc0[_0x738c('0x5a')][_0x738c('0x61')],_0x3cebc0[_0x738c('0x5a')][_0x738c('0x3e')]);return db['FreshsalesConfiguration'][_0x738c('0x59')](_0x3cebc0[_0x738c('0x5a')],{'include':[{'model':db['FreshsalesField'],'as':_0x738c('0x62')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x738c('0x36')](respondWithResult(_0x106442,null))[_0x738c('0x58')](handleError(_0x106442,null));};exports[_0x738c('0x63')]=function(_0x23f44c,_0x64ec66,_0x483d8e){var _0x11ab95='';var _0x90fe87='';return db[_0x738c('0x3c')][_0x738c('0x5e')]({'where':{'id':_0x23f44c['params']['id']},'attributes':['id','username',_0x738c('0x64'),_0x738c('0x65')]})['then'](handleEntityNotFound(_0x64ec66,null))[_0x738c('0x36')](function(_0x205893){if(_0x205893){_0x90fe87=_0x205893['username'];_0x11ab95=_0x205893[_0x738c('0x64')];var _0x49d157=_0x205893[_0x738c('0x64')]['slice'](-0x1);if(_0x49d157==='/'){_0x11ab95=_0x11ab95[_0x738c('0x66')](0x0,_0x11ab95['lastIndexOf'](_0x49d157));}return rp({'method':_0x738c('0x67'),'uri':util[_0x738c('0x68')]('%s%s',_0x11ab95,_0x738c('0x69')),'headers':{'Authorization':_0x738c('0x6a')+_0x205893['apiKey']},'json':!![]});}})[_0x738c('0x36')](function(_0x1cdb6e){if(_0x1cdb6e){var _0xf3b461=_0x1cdb6e[_0x738c('0x6b')];var _0x322172=![];var _0x5f29cf=null;for(_0x5f29cf=0x0;_0x5f29cf<_0xf3b461[_0x738c('0x56')];_0x5f29cf++){if(_0xf3b461[_0x5f29cf][_0x738c('0x6c')]===_0x90fe87){_0x322172=!![];}}if(_0x322172){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x738c('0x36')](respondWithResult(_0x64ec66,null))[_0x738c('0x58')](function(_0x5f31b1){var _0x231d18=_0x23f44c[_0x738c('0x42')][_0x738c('0x1d')]?0x1f4:_0x5f31b1[_0x738c('0x6d')]||0x1f4;logger[_0x738c('0x25')](_0x738c('0x6e'),'getFields',_0x231d18,JSON[_0x738c('0x24')](_0x5f31b1));delete _0x5f31b1[_0x738c('0x39')];if(_0x231d18===0x191){_0x231d18=0x190;}_0x64ec66[_0x738c('0x2c')](_0x231d18)[_0x738c('0x3a')](_0x23f44c[_0x738c('0x42')]['test']?{'message':_0x738c('0x6f'),'statusCode':_0x5f31b1[_0x738c('0x6d')]}:_0x5f31b1);});}; \ No newline at end of file +var _0x0ddf=['Subjects','getSubjects','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','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','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','status','json','offset','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','options','FreshsalesAccount','includeAll','findAll','rows','show','params','rawAttributes','include','merge','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId'];(function(_0x1f217d,_0x5bca41){var _0x60a5cc=function(_0x57a58b){while(--_0x57a58b){_0x1f217d['push'](_0x1f217d['shift']());}};_0x60a5cc(++_0x5bca41);}(_0x0ddf,0x1e1));var _0xf0dd=function(_0x39cc6b,_0x3ae477){_0x39cc6b=_0x39cc6b-0x0;var _0x425b94=_0x0ddf[_0x39cc6b];return _0x425b94;};'use strict';var pdf=require(_0xf0dd('0x0'));var emlformat=require(_0xf0dd('0x1'));var rimraf=require(_0xf0dd('0x2'));var zipdir=require(_0xf0dd('0x3'));var jsonpatch=require(_0xf0dd('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0dd('0x5'));var Mustache=require(_0xf0dd('0x6'));var util=require(_0xf0dd('0x7'));var path=require(_0xf0dd('0x8'));var sox=require(_0xf0dd('0x9'));var csv=require(_0xf0dd('0xa'));var ejs=require(_0xf0dd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0dd('0xc'));var crypto=require(_0xf0dd('0xd'));var jsforce=require(_0xf0dd('0xe'));var deskjs=require(_0xf0dd('0xf'));var toCsv=require(_0xf0dd('0xa'));var querystring=require(_0xf0dd('0x10'));var Papa=require(_0xf0dd('0x11'));var Redis=require(_0xf0dd('0x12'));var authService=require(_0xf0dd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf0dd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0dd('0x15'))('api');var utils=require(_0xf0dd('0x16'));var config=require(_0xf0dd('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf0dd('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xf0dd('0x19')][_0xf0dd('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x728665,_0x97c176,_0x1725ac){if(_0x1725ac){var _0x4d15ab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d15ab['test'](_0x97c176)){return _0x728665;}else{throw new db[(_0xf0dd('0x1b'))][(_0xf0dd('0x1c'))](_0xf0dd('0x1d'));}}else{return _0x728665;}}function respondWithRpcPromise(_0x10d875,_0x4df6dd,_0x73e2c9,_0x3e5d5b){return new BPromise(function(_0x47a60f,_0x34a16c){var _0x1907dc=_0x3e5d5b||client;return _0x1907dc[_0xf0dd('0x1e')](_0x10d875,_0x73e2c9)['then'](function(_0x30dc7d){logger['info'](_0xf0dd('0x1f'),_0x4df6dd,'request\x20sent');logger[_0xf0dd('0x20')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4df6dd,_0xf0dd('0x21'),JSON[_0xf0dd('0x22')](_0x30dc7d));if(_0x30dc7d[_0xf0dd('0x23')]){if(_0x30dc7d[_0xf0dd('0x23')][_0xf0dd('0x24')]===0x1f4){logger[_0xf0dd('0x23')](_0xf0dd('0x1f'),_0x4df6dd,_0x30dc7d['error'][_0xf0dd('0x25')]);return _0x34a16c(_0x30dc7d[_0xf0dd('0x23')][_0xf0dd('0x25')]);}logger[_0xf0dd('0x23')]('FreshsalesAccount,\x20%s,\x20%s',_0x4df6dd,_0x30dc7d[_0xf0dd('0x23')]['message']);return _0x47a60f(_0x30dc7d[_0xf0dd('0x23')][_0xf0dd('0x25')]);}else{logger[_0xf0dd('0x26')](_0xf0dd('0x1f'),_0x4df6dd,_0xf0dd('0x21'));_0x47a60f(_0x30dc7d[_0xf0dd('0x27')][_0xf0dd('0x25')]);}})[_0xf0dd('0x28')](function(_0x59fbc0){logger['error'](_0xf0dd('0x1f'),_0x4df6dd,_0x59fbc0);_0x34a16c(_0x59fbc0);});});}function respondWithStatusCode(_0xdf8eac,_0x5d2933){_0x5d2933=_0x5d2933||0xcc;return function(_0x598f15){if(_0x598f15){return _0xdf8eac['sendStatus'](_0x5d2933);}return _0xdf8eac[_0xf0dd('0x29')](_0x5d2933)['end']();};}function respondWithResult(_0x268c25,_0x24710b){_0x24710b=_0x24710b||0xc8;return function(_0x1b56c8){if(_0x1b56c8){return _0x268c25[_0xf0dd('0x29')](_0x24710b)[_0xf0dd('0x2a')](_0x1b56c8);}};}function respondWithFilteredResult(_0x2740bc,_0x20b47b){return function(_0x3b4ca0){if(_0x3b4ca0){var _0x4edeee=_0x3b4ca0['count'],_0x4889d0=_0x20b47b[_0xf0dd('0x2b')],_0x1a6972=_0x20b47b[_0xf0dd('0x2b')]+_0x20b47b['limit'],_0x57dc51;if(_0x1a6972>=_0x4edeee){_0x1a6972=_0x4edeee;_0x57dc51=0xc8;}else{_0x57dc51=0xce;}_0x2740bc[_0xf0dd('0x29')](_0x57dc51);return _0x2740bc['set']('Content-Range',_0x4889d0+'-'+_0x1a6972+'/'+_0x4edeee)[_0xf0dd('0x2a')](_0x3b4ca0);}return null;};}function patchUpdates(_0xcb907){return function(_0x25e33c){try{jsonpatch[_0xf0dd('0x2c')](_0x25e33c,_0xcb907,!![]);}catch(_0x2bcec1){return BPromise[_0xf0dd('0x2d')](_0x2bcec1);}return _0x25e33c[_0xf0dd('0x2e')]();};}function saveUpdates(_0x244738,_0x1d589c){return function(_0x49d157){if(_0x49d157){return _0x49d157[_0xf0dd('0x2f')](_0x244738)[_0xf0dd('0x30')](function(_0x1a908e){return _0x1a908e;});}return null;};}function removeEntity(_0x294c7a,_0xe9471){return function(_0x294e9e){if(_0x294e9e){return _0x294e9e[_0xf0dd('0x31')]()[_0xf0dd('0x30')](function(){_0x294c7a[_0xf0dd('0x29')](0xcc)[_0xf0dd('0x32')]();});}};}function handleEntityNotFound(_0x3b1d58,_0x1db536){return function(_0x8c3cea){if(!_0x8c3cea){_0x3b1d58[_0xf0dd('0x33')](0x194);}return _0x8c3cea;};}function handleError(_0x3efeeb,_0x208319){_0x208319=_0x208319||0x1f4;return function(_0x3141f2){logger[_0xf0dd('0x23')](_0x3141f2[_0xf0dd('0x34')]);if(_0x3141f2[_0xf0dd('0x35')]){delete _0x3141f2[_0xf0dd('0x35')];}_0x3efeeb[_0xf0dd('0x29')](_0x208319)[_0xf0dd('0x36')](_0x3141f2);};}exports[_0xf0dd('0x37')]=function(_0xa70d0e,_0x5aa350){var _0x33069f={},_0x5230af={},_0x50cb55={'count':0x0,'rows':[]};var _0x11b462=_[_0xf0dd('0x38')](db['FreshsalesAccount']['rawAttributes'],function(_0x41a8b5){return{'name':_0x41a8b5['fieldName'],'type':_0x41a8b5[_0xf0dd('0x39')][_0xf0dd('0x3a')]};});_0x5230af[_0xf0dd('0x3b')]=_[_0xf0dd('0x38')](_0x11b462,_0xf0dd('0x35'));_0x5230af[_0xf0dd('0x3c')]=_[_0xf0dd('0x3d')](_0xa70d0e[_0xf0dd('0x3c')]);_0x5230af[_0xf0dd('0x3e')]=_[_0xf0dd('0x3f')](_0x5230af['model'],_0x5230af[_0xf0dd('0x3c')]);_0x33069f[_0xf0dd('0x40')]=_[_0xf0dd('0x3f')](_0x5230af[_0xf0dd('0x3b')],qs[_0xf0dd('0x41')](_0xa70d0e['query']['fields']));_0x33069f[_0xf0dd('0x40')]=_0x33069f[_0xf0dd('0x40')][_0xf0dd('0x42')]?_0x33069f[_0xf0dd('0x40')]:_0x5230af['model'];if(!_0xa70d0e[_0xf0dd('0x3c')][_0xf0dd('0x43')]('nolimit')){_0x33069f['limit']=qs['limit'](_0xa70d0e[_0xf0dd('0x3c')][_0xf0dd('0x44')]);_0x33069f[_0xf0dd('0x2b')]=qs[_0xf0dd('0x2b')](_0xa70d0e[_0xf0dd('0x3c')][_0xf0dd('0x2b')]);}_0x33069f[_0xf0dd('0x45')]=qs[_0xf0dd('0x46')](_0xa70d0e[_0xf0dd('0x3c')]['sort']);_0x33069f[_0xf0dd('0x47')]=qs['filters'](_[_0xf0dd('0x48')](_0xa70d0e[_0xf0dd('0x3c')],_0x5230af['filters']),_0x11b462);if(_0xa70d0e[_0xf0dd('0x3c')][_0xf0dd('0x49')]){_0x33069f[_0xf0dd('0x47')]=_['merge'](_0x33069f[_0xf0dd('0x47')],{'$or':_[_0xf0dd('0x38')](_0x11b462,function(_0x198214){if(_0x198214[_0xf0dd('0x39')]!==_0xf0dd('0x4a')){var _0x381393={};_0x381393[_0x198214['name']]={'$like':'%'+_0xa70d0e['query'][_0xf0dd('0x49')]+'%'};return _0x381393;}})});}_0x33069f=_['merge']({},_0x33069f,_0xa70d0e[_0xf0dd('0x4b')]);var _0x4188c2={'where':_0x33069f[_0xf0dd('0x47')]};return db[_0xf0dd('0x4c')]['count'](_0x4188c2)[_0xf0dd('0x30')](function(_0x4121b0){_0x50cb55['count']=_0x4121b0;if(_0xa70d0e[_0xf0dd('0x3c')][_0xf0dd('0x4d')]){_0x33069f['include']=[{'all':!![]}];}return db[_0xf0dd('0x4c')][_0xf0dd('0x4e')](_0x33069f);})['then'](function(_0x3ef280){_0x50cb55[_0xf0dd('0x4f')]=_0x3ef280;return _0x50cb55;})['then'](respondWithFilteredResult(_0x5aa350,_0x33069f))['catch'](handleError(_0x5aa350,null));};exports[_0xf0dd('0x50')]=function(_0x211aad,_0x1b624f){var _0x27b881={'raw':![],'where':{'id':_0x211aad[_0xf0dd('0x51')]['id']}},_0x5d4aa9={};_0x5d4aa9[_0xf0dd('0x3b')]=_[_0xf0dd('0x3d')](db[_0xf0dd('0x4c')][_0xf0dd('0x52')]);_0x5d4aa9[_0xf0dd('0x3c')]=_['keys'](_0x211aad[_0xf0dd('0x3c')]);_0x5d4aa9[_0xf0dd('0x3e')]=_[_0xf0dd('0x3f')](_0x5d4aa9[_0xf0dd('0x3b')],_0x5d4aa9[_0xf0dd('0x3c')]);_0x27b881['attributes']=_[_0xf0dd('0x3f')](_0x5d4aa9[_0xf0dd('0x3b')],qs[_0xf0dd('0x41')](_0x211aad[_0xf0dd('0x3c')]['fields']));_0x27b881[_0xf0dd('0x40')]=_0x27b881[_0xf0dd('0x40')][_0xf0dd('0x42')]?_0x27b881[_0xf0dd('0x40')]:_0x5d4aa9[_0xf0dd('0x3b')];if(_0x211aad[_0xf0dd('0x3c')]['includeAll']){_0x27b881[_0xf0dd('0x53')]=[{'all':!![]}];}_0x27b881=_[_0xf0dd('0x54')]({},_0x27b881,_0x211aad['options']);return db[_0xf0dd('0x4c')][_0xf0dd('0x55')](_0x27b881)[_0xf0dd('0x30')](handleEntityNotFound(_0x1b624f,null))[_0xf0dd('0x30')](respondWithResult(_0x1b624f,null))[_0xf0dd('0x28')](handleError(_0x1b624f,null));};exports['create']=function(_0xf2076f,_0x59c195){return db[_0xf0dd('0x4c')][_0xf0dd('0x56')](_0xf2076f[_0xf0dd('0x57')],{})[_0xf0dd('0x30')](respondWithResult(_0x59c195,0xc9))[_0xf0dd('0x28')](handleError(_0x59c195,null));};exports[_0xf0dd('0x2f')]=function(_0x232baa,_0x896fbb){if(_0x232baa[_0xf0dd('0x57')]['id']){delete _0x232baa[_0xf0dd('0x57')]['id'];}return db[_0xf0dd('0x4c')]['find']({'where':{'id':_0x232baa[_0xf0dd('0x51')]['id']}})[_0xf0dd('0x30')](handleEntityNotFound(_0x896fbb,null))['then'](saveUpdates(_0x232baa[_0xf0dd('0x57')],null))['then'](respondWithResult(_0x896fbb,null))[_0xf0dd('0x28')](handleError(_0x896fbb,null));};exports[_0xf0dd('0x31')]=function(_0x2f6fbb,_0xb69fd5){return db['FreshsalesAccount'][_0xf0dd('0x55')]({'where':{'id':_0x2f6fbb[_0xf0dd('0x51')]['id']}})[_0xf0dd('0x30')](handleEntityNotFound(_0xb69fd5,null))[_0xf0dd('0x30')](removeEntity(_0xb69fd5,null))[_0xf0dd('0x28')](handleError(_0xb69fd5,null));};exports[_0xf0dd('0x58')]=function(_0xa15568,_0x204cca,_0x4e0c33){var _0x26b9f2={};var _0x9aba9b={};var _0x4685c6;var _0x5a4d8d;return db[_0xf0dd('0x4c')][_0xf0dd('0x59')]({'where':{'id':_0xa15568[_0xf0dd('0x51')]['id']}})[_0xf0dd('0x30')](handleEntityNotFound(_0x204cca,null))[_0xf0dd('0x30')](function(_0x131548){if(_0x131548){_0x4685c6=_0x131548;_0x9aba9b[_0xf0dd('0x3b')]=_[_0xf0dd('0x3d')](db[_0xf0dd('0x5a')][_0xf0dd('0x52')]);_0x9aba9b['query']=_[_0xf0dd('0x3d')](_0xa15568[_0xf0dd('0x3c')]);_0x9aba9b['filters']=_[_0xf0dd('0x3f')](_0x9aba9b['model'],_0x9aba9b[_0xf0dd('0x3c')]);_0x26b9f2[_0xf0dd('0x40')]=_[_0xf0dd('0x3f')](_0x9aba9b[_0xf0dd('0x3b')],qs[_0xf0dd('0x41')](_0xa15568['query'][_0xf0dd('0x41')]));_0x26b9f2['attributes']=_0x26b9f2[_0xf0dd('0x40')][_0xf0dd('0x42')]?_0x26b9f2[_0xf0dd('0x40')]:_0x9aba9b[_0xf0dd('0x3b')];_0x26b9f2[_0xf0dd('0x45')]=qs[_0xf0dd('0x46')](_0xa15568[_0xf0dd('0x3c')]['sort']);_0x26b9f2[_0xf0dd('0x47')]=qs[_0xf0dd('0x3e')](_[_0xf0dd('0x48')](_0xa15568[_0xf0dd('0x3c')],_0x9aba9b['filters']));if(_0xa15568[_0xf0dd('0x3c')][_0xf0dd('0x49')]){_0x26b9f2['where']=_[_0xf0dd('0x54')](_0x26b9f2[_0xf0dd('0x47')],{'$or':_[_0xf0dd('0x38')](_0x26b9f2[_0xf0dd('0x40')],function(_0x574f57){var _0x3252af={};_0x3252af[_0x574f57]={'$like':'%'+_0xa15568[_0xf0dd('0x3c')][_0xf0dd('0x49')]+'%'};return _0x3252af;})});}_0x26b9f2=_[_0xf0dd('0x54')]({},_0x26b9f2,_0xa15568[_0xf0dd('0x4b')]);return _0x4685c6['getConfigurations'](_0x26b9f2);}})[_0xf0dd('0x30')](function(_0x5ad01a){if(_0x5ad01a){_0x5a4d8d=_0x5ad01a[_0xf0dd('0x42')];if(!_0xa15568[_0xf0dd('0x3c')]['hasOwnProperty'](_0xf0dd('0x5b'))){_0x26b9f2['limit']=qs[_0xf0dd('0x44')](_0xa15568[_0xf0dd('0x3c')]['limit']);_0x26b9f2[_0xf0dd('0x2b')]=qs[_0xf0dd('0x2b')](_0xa15568[_0xf0dd('0x3c')][_0xf0dd('0x2b')]);}return _0x4685c6[_0xf0dd('0x58')](_0x26b9f2);}})[_0xf0dd('0x30')](function(_0x462b1d){if(_0x462b1d){return _0x462b1d?{'count':_0x5a4d8d,'rows':_0x462b1d}:null;}})[_0xf0dd('0x30')](respondWithResult(_0x204cca,null))[_0xf0dd('0x28')](handleError(_0x204cca,null));};exports[_0xf0dd('0x5c')]=function(_0x6d9143,_0x12f346,_0x113144){if(_0x6d9143[_0xf0dd('0x57')]['id']){delete _0x6d9143['body']['id'];}return db[_0xf0dd('0x4c')]['findOne']({'where':{'id':_0x6d9143[_0xf0dd('0x51')]['id']}})[_0xf0dd('0x30')](handleEntityNotFound(_0x12f346,null))[_0xf0dd('0x30')](function(_0xb6f818){if(_0xb6f818){_0x6d9143['body'][_0xf0dd('0x5d')]=_0xb6f818['id'];_0x6d9143[_0xf0dd('0x57')][_0xf0dd('0x5e')]=integrations[_0xf0dd('0x5f')](_0x6d9143['body']['channel'],_0x6d9143[_0xf0dd('0x57')][_0xf0dd('0x39')]);_0x6d9143[_0xf0dd('0x57')]['Descriptions']=integrations[_0xf0dd('0x60')](_0x6d9143[_0xf0dd('0x57')][_0xf0dd('0x61')],_0x6d9143['body']['type']);return db['FreshsalesConfiguration']['create'](_0x6d9143[_0xf0dd('0x57')],{'include':[{'model':db[_0xf0dd('0x62')],'as':_0xf0dd('0x5e')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0xf0dd('0x30')](respondWithResult(_0x12f346,null))[_0xf0dd('0x28')](handleError(_0x12f346,null));};exports[_0xf0dd('0x63')]=function(_0x573950,_0x1b6799,_0x5bfefc){var _0xb35797='';var _0x342a48='';return db[_0xf0dd('0x4c')]['findOne']({'where':{'id':_0x573950[_0xf0dd('0x51')]['id']},'attributes':['id',_0xf0dd('0x64'),_0xf0dd('0x65'),'apiKey']})[_0xf0dd('0x30')](handleEntityNotFound(_0x1b6799,null))[_0xf0dd('0x30')](function(_0x2a07d1){if(_0x2a07d1){_0x342a48=_0x2a07d1[_0xf0dd('0x64')];_0xb35797=_0x2a07d1[_0xf0dd('0x65')];var _0x8ab7e3=_0x2a07d1[_0xf0dd('0x65')][_0xf0dd('0x66')](-0x1);if(_0x8ab7e3==='/'){_0xb35797=_0xb35797[_0xf0dd('0x67')](0x0,_0xb35797[_0xf0dd('0x68')](_0x8ab7e3));}return rp({'method':'GET','uri':util[_0xf0dd('0x69')](_0xf0dd('0x6a'),_0xb35797,'/api/selector/owners'),'headers':{'Authorization':_0xf0dd('0x6b')+_0x2a07d1[_0xf0dd('0x6c')]},'json':!![]});}})[_0xf0dd('0x30')](function(_0x552c6c){if(_0x552c6c){var _0x1c5306=_0x552c6c[_0xf0dd('0x6d')];var _0x1ec62c=![];var _0x3abdb5=null;for(_0x3abdb5=0x0;_0x3abdb5<_0x1c5306[_0xf0dd('0x42')];_0x3abdb5++){if(_0x1c5306[_0x3abdb5][_0xf0dd('0x6e')]===_0x342a48){_0x1ec62c=!![];}}if(_0x1ec62c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf0dd('0x6f')});}}})[_0xf0dd('0x30')](respondWithResult(_0x1b6799,null))['catch'](function(_0x59acb2){var _0x379575=_0x573950[_0xf0dd('0x3c')][_0xf0dd('0x70')]?0x1f4:_0x59acb2[_0xf0dd('0x71')]||0x1f4;logger[_0xf0dd('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xf0dd('0x63'),_0x379575,JSON['stringify'](_0x59acb2));delete _0x59acb2[_0xf0dd('0x35')];if(_0x379575===0x191){_0x379575=0x190;}_0x1b6799[_0xf0dd('0x29')](_0x379575)['send'](_0x573950['query'][_0xf0dd('0x70')]?{'message':_0xf0dd('0x72'),'statusCode':_0x59acb2[_0xf0dd('0x71')]}:_0x59acb2);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 7bf54a2..9458543 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 _0x57d4=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','api','moment','bluebird','request-promise'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x57d4,0x78));var _0x457d=function(_0x1995d2,_0x239964){_0x1995d2=_0x1995d2-0x0;var _0x442aa0=_0x57d4[_0x1995d2];return _0x442aa0;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var logger=require('../../config/logger')(_0x457d('0x2'));var moment=require(_0x457d('0x3'));var BPromise=require(_0x457d('0x4'));var rp=require(_0x457d('0x5'));var fs=require('fs');var path=require(_0x457d('0x6'));var rimraf=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var attributes=require(_0x457d('0x9'));var integrations=require(_0x457d('0xa'));module[_0x457d('0xb')]=function(_0x3fd867,_0x5c6816){return _0x3fd867[_0x457d('0xc')](_0x457d('0xd'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0faf=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5ccc69,_0x347121){var _0x5391e4=function(_0x4d6534){while(--_0x4d6534){_0x5ccc69['push'](_0x5ccc69['shift']());}};_0x5391e4(++_0x347121);}(_0x0faf,0x132));var _0xf0fa=function(_0x4aa4af,_0x210cde){_0x4aa4af=_0x4aa4af-0x0;var _0x3bf44a=_0x0faf[_0x4aa4af];return _0x3bf44a;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var rp=require(_0xf0fa('0x5'));var fs=require('fs');var path=require(_0xf0fa('0x6'));var rimraf=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var attributes=require(_0xf0fa('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xf0fa('0xa')]=function(_0x44ffa0,_0x25b5c4){return _0x44ffa0[_0xf0fa('0xb')](_0xf0fa('0xc'),attributes,{'tableName':'int_freshsales_accounts','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 4054a1d..0715bd8 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 _0x676c=['then','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','FreshsalesAccount,\x20%s,\x20%s','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','model','map','info','stringify','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0x676c,0x198));var _0xc676=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x676c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc676('0x0'));var util=require(_0xc676('0x1'));var moment=require(_0xc676('0x2'));var BPromise=require('bluebird');var rs=require(_0xc676('0x3'));var fs=require('fs');var Redis=require(_0xc676('0x4'));var db=require(_0xc676('0x5'))['db'];var utils=require(_0xc676('0x6'));var logger=require(_0xc676('0x7'))(_0xc676('0x8'));var config=require('../../config/environment');var jayson=require(_0xc676('0x9'));var client=jayson[_0xc676('0xa')][_0xc676('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c7510,_0x36fa26,_0x4a71a8){return new BPromise(function(_0x26ad9c,_0x5e8ad4){return client['request'](_0x2c7510,_0x4a71a8)[_0xc676('0xc')](function(_0x27912c){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x36fa26,_0xc676('0xd'));logger[_0xc676('0xe')](_0xc676('0xf'),_0x36fa26,'request\x20sent',JSON['stringify'](_0x27912c));if(_0x27912c[_0xc676('0x10')]){if(_0x27912c[_0xc676('0x10')][_0xc676('0x11')]===0x1f4){logger[_0xc676('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x36fa26,_0x27912c[_0xc676('0x10')][_0xc676('0x12')]);return _0x5e8ad4(_0x27912c[_0xc676('0x10')][_0xc676('0x12')]);}logger[_0xc676('0x10')](_0xc676('0x13'),_0x36fa26,_0x27912c[_0xc676('0x10')]['message']);return _0x26ad9c(_0x27912c[_0xc676('0x10')]['message']);}else{logger['info'](_0xc676('0x13'),_0x36fa26,'request\x20sent');_0x26ad9c(_0x27912c['result']['message']);}})[_0xc676('0x14')](function(_0x4ee99d){logger[_0xc676('0x10')](_0xc676('0x13'),_0x36fa26,_0x4ee99d);_0x5e8ad4(_0x4ee99d);});});}exports[_0xc676('0x15')]=function(_0x3b3215){var _0x3f1f5d=this;return new Promise(function(_0x215ea6,_0x4f0269){return db[_0xc676('0x16')][_0xc676('0x17')]({'raw':_0x3b3215['options']?_0x3b3215[_0xc676('0x18')][_0xc676('0x19')]===undefined?!![]:![]:!![],'where':_0x3b3215[_0xc676('0x18')]?_0x3b3215[_0xc676('0x18')][_0xc676('0x1a')]||null:null,'attributes':_0x3b3215[_0xc676('0x18')]?_0x3b3215[_0xc676('0x18')][_0xc676('0x1b')]||null:null,'limit':_0x3b3215['options']?_0x3b3215['options']['limit']||null:null,'include':_0x3b3215[_0xc676('0x18')]?_0x3b3215['options'][_0xc676('0x1c')]?_['map'](_0x3b3215['options'][_0xc676('0x1c')],function(_0x575de4){return{'model':db[_0x575de4[_0xc676('0x1d')]],'as':_0x575de4['as'],'attributes':_0x575de4[_0xc676('0x1b')],'include':_0x575de4[_0xc676('0x1c')]?_[_0xc676('0x1e')](_0x575de4[_0xc676('0x1c')],function(_0x4ca666){return{'model':db[_0x4ca666[_0xc676('0x1d')]],'as':_0x4ca666['as'],'attributes':_0x4ca666[_0xc676('0x1b')],'include':_0x4ca666[_0xc676('0x1c')]?_['map'](_0x4ca666[_0xc676('0x1c')],function(_0x4b61aa){return{'model':db[_0x4b61aa[_0xc676('0x1d')]],'as':_0x4b61aa['as'],'attributes':_0x4b61aa[_0xc676('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x361f97){logger[_0xc676('0x1f')]('GetFreshsalesAccount',_0x3b3215);logger[_0xc676('0xe')](_0xc676('0x15'),_0x3b3215,JSON[_0xc676('0x20')](_0x361f97));_0x215ea6(_0x361f97);})['catch'](function(_0x278ccc){logger[_0xc676('0x10')](_0xc676('0x15'),_0x278ccc[_0xc676('0x12')],_0x3b3215);_0x4f0269(_0x3f1f5d[_0xc676('0x10')](0x1f4,_0x278ccc['message']));});});};exports[_0xc676('0x21')]=function(_0x19338b){var _0x3e1b89=this;return new Promise(function(_0x39d9a0,_0xed17d6){return db['FreshsalesAccount'][_0xc676('0x22')]({'raw':_0x19338b[_0xc676('0x18')]?_0x19338b[_0xc676('0x18')][_0xc676('0x19')]===undefined?!![]:![]:!![],'where':_0x19338b['options']?_0x19338b[_0xc676('0x18')][_0xc676('0x1a')]||null:null,'attributes':_0x19338b[_0xc676('0x18')]?_0x19338b[_0xc676('0x18')][_0xc676('0x1b')]||null:null,'include':_0x19338b[_0xc676('0x18')]?_0x19338b[_0xc676('0x18')][_0xc676('0x1c')]?_[_0xc676('0x1e')](_0x19338b['options']['include'],function(_0x4a29f6){return{'model':db[_0x4a29f6[_0xc676('0x1d')]],'as':_0x4a29f6['as'],'attributes':_0x4a29f6[_0xc676('0x1b')],'include':_0x4a29f6[_0xc676('0x1c')]?_[_0xc676('0x1e')](_0x4a29f6['include'],function(_0x3298f1){return{'model':db[_0x3298f1[_0xc676('0x1d')]],'as':_0x3298f1['as'],'attributes':_0x3298f1[_0xc676('0x1b')],'include':_0x3298f1[_0xc676('0x1c')]?_[_0xc676('0x1e')](_0x3298f1[_0xc676('0x1c')],function(_0x4efce8){return{'model':db[_0x4efce8['model']],'as':_0x4efce8['as'],'attributes':_0x4efce8[_0xc676('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14f703){logger[_0xc676('0x1f')](_0xc676('0x21'),_0x19338b);logger[_0xc676('0xe')]('ShowFreshsalesAccount',_0x19338b,JSON['stringify'](_0x14f703));_0x39d9a0(_0x14f703);})['catch'](function(_0x133489){logger[_0xc676('0x10')](_0xc676('0x21'),_0x133489[_0xc676('0x12')],_0x19338b);_0xed17d6(_0x3e1b89[_0xc676('0x10')](0x1f4,_0x133489[_0xc676('0x12')]));});});}; \ No newline at end of file +var _0x3014=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','ShowFreshsalesAccount','raw','lodash','util','bluebird','randomstring','../../config/utils'];(function(_0x4a75f9,_0x4fd6ff){var _0x48995b=function(_0x4b864b){while(--_0x4b864b){_0x4a75f9['push'](_0x4a75f9['shift']());}};_0x48995b(++_0x4fd6ff);}(_0x3014,0x1d7));var _0x4301=function(_0x8fd434,_0x5e6eae){_0x8fd434=_0x8fd434-0x0;var _0x18ad45=_0x3014[_0x8fd434];return _0x18ad45;};'use strict';var _=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var moment=require('moment');var BPromise=require(_0x4301('0x2'));var rs=require(_0x4301('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4301('0x4'));var logger=require(_0x4301('0x5'))(_0x4301('0x6'));var config=require(_0x4301('0x7'));var jayson=require(_0x4301('0x8'));var client=jayson[_0x4301('0x9')][_0x4301('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6e61,_0x5013c,_0x1dc855){return new BPromise(function(_0x337800,_0x4d5020){return client['request'](_0x3a6e61,_0x1dc855)[_0x4301('0xb')](function(_0x2d6581){logger['info'](_0x4301('0xc'),_0x5013c,_0x4301('0xd'));logger[_0x4301('0xe')](_0x4301('0xf'),_0x5013c,'request\x20sent',JSON[_0x4301('0x10')](_0x2d6581));if(_0x2d6581['error']){if(_0x2d6581[_0x4301('0x11')][_0x4301('0x12')]===0x1f4){logger[_0x4301('0x11')](_0x4301('0xc'),_0x5013c,_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);return _0x4d5020(_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);}logger[_0x4301('0x11')](_0x4301('0xc'),_0x5013c,_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);return _0x337800(_0x2d6581[_0x4301('0x11')]['message']);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5013c,_0x4301('0xd'));_0x337800(_0x2d6581[_0x4301('0x14')][_0x4301('0x13')]);}})[_0x4301('0x15')](function(_0x4da25c){logger['error'](_0x4301('0xc'),_0x5013c,_0x4da25c);_0x4d5020(_0x4da25c);});});}exports[_0x4301('0x16')]=function(_0x13b229){var _0x5cfa58=this;return new Promise(function(_0xa1cbea,_0x351815){return db[_0x4301('0x17')][_0x4301('0x18')]({'raw':_0x13b229[_0x4301('0x19')]?_0x13b229[_0x4301('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x13b229[_0x4301('0x19')]?_0x13b229[_0x4301('0x19')][_0x4301('0x1a')]||null:null,'attributes':_0x13b229['options']?_0x13b229[_0x4301('0x19')]['attributes']||null:null,'limit':_0x13b229[_0x4301('0x19')]?_0x13b229[_0x4301('0x19')][_0x4301('0x1b')]||null:null,'include':_0x13b229[_0x4301('0x19')]?_0x13b229['options'][_0x4301('0x1c')]?_[_0x4301('0x1d')](_0x13b229['options'][_0x4301('0x1c')],function(_0x5d47d1){return{'model':db[_0x5d47d1[_0x4301('0x1e')]],'as':_0x5d47d1['as'],'attributes':_0x5d47d1[_0x4301('0x1f')],'include':_0x5d47d1[_0x4301('0x1c')]?_[_0x4301('0x1d')](_0x5d47d1[_0x4301('0x1c')],function(_0x11fe82){return{'model':db[_0x11fe82[_0x4301('0x1e')]],'as':_0x11fe82['as'],'attributes':_0x11fe82[_0x4301('0x1f')],'include':_0x11fe82[_0x4301('0x1c')]?_[_0x4301('0x1d')](_0x11fe82[_0x4301('0x1c')],function(_0x4a60d7){return{'model':db[_0x4a60d7[_0x4301('0x1e')]],'as':_0x4a60d7['as'],'attributes':_0x4a60d7[_0x4301('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4301('0xb')](function(_0xe752f0){logger['info'](_0x4301('0x16'),_0x13b229);logger[_0x4301('0xe')](_0x4301('0x16'),_0x13b229,JSON['stringify'](_0xe752f0));_0xa1cbea(_0xe752f0);})[_0x4301('0x15')](function(_0x10a967){logger['error'](_0x4301('0x16'),_0x10a967['message'],_0x13b229);_0x351815(_0x5cfa58[_0x4301('0x11')](0x1f4,_0x10a967[_0x4301('0x13')]));});});};exports[_0x4301('0x20')]=function(_0xebb79b){var _0x4a6a55=this;return new Promise(function(_0x2b4abd,_0x4ee156){return db[_0x4301('0x17')]['find']({'raw':_0xebb79b['options']?_0xebb79b[_0x4301('0x19')][_0x4301('0x21')]===undefined?!![]:![]:!![],'where':_0xebb79b[_0x4301('0x19')]?_0xebb79b[_0x4301('0x19')][_0x4301('0x1a')]||null:null,'attributes':_0xebb79b[_0x4301('0x19')]?_0xebb79b[_0x4301('0x19')]['attributes']||null:null,'include':_0xebb79b[_0x4301('0x19')]?_0xebb79b[_0x4301('0x19')][_0x4301('0x1c')]?_['map'](_0xebb79b['options']['include'],function(_0x861809){return{'model':db[_0x861809[_0x4301('0x1e')]],'as':_0x861809['as'],'attributes':_0x861809[_0x4301('0x1f')],'include':_0x861809['include']?_['map'](_0x861809['include'],function(_0x3d35b6){return{'model':db[_0x3d35b6[_0x4301('0x1e')]],'as':_0x3d35b6['as'],'attributes':_0x3d35b6[_0x4301('0x1f')],'include':_0x3d35b6[_0x4301('0x1c')]?_[_0x4301('0x1d')](_0x3d35b6[_0x4301('0x1c')],function(_0x1c3aef){return{'model':db[_0x1c3aef[_0x4301('0x1e')]],'as':_0x1c3aef['as'],'attributes':_0x1c3aef[_0x4301('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4301('0xb')](function(_0x380e73){logger['info'](_0x4301('0x20'),_0xebb79b);logger[_0x4301('0xe')]('ShowFreshsalesAccount',_0xebb79b,JSON[_0x4301('0x10')](_0x380e73));_0x2b4abd(_0x380e73);})[_0x4301('0x15')](function(_0x5890e3){logger[_0x4301('0x11')](_0x4301('0x20'),_0x5890e3[_0x4301('0x13')],_0xebb79b);_0x4ee156(_0x4a6a55[_0x4301('0x11')](0x1f4,_0x5890e3[_0x4301('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 3d5b94d..5b4c5f4 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 _0x58a8=['show','/:id/subjects','getDescriptions','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','index','get','/:id','isAuthenticated'];(function(_0x2f8b6e,_0x46c867){var _0x457a1f=function(_0x402810){while(--_0x402810){_0x2f8b6e['push'](_0x2f8b6e['shift']());}};_0x457a1f(++_0x46c867);}(_0x58a8,0x7e));var _0x858a=function(_0x2d04a6,_0x5bbf0a){_0x2d04a6=_0x2d04a6-0x0;var _0x3cd00e=_0x58a8[_0x2d04a6];return _0x3cd00e;};'use strict';var multer=require(_0x858a('0x0'));var util=require('util');var path=require(_0x858a('0x1'));var timeout=require(_0x858a('0x2'));var express=require(_0x858a('0x3'));var router=express[_0x858a('0x4')]();var auth=require(_0x858a('0x5'));var interaction=require(_0x858a('0x6'));var config=require('../../config/environment');var controller=require(_0x858a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x858a('0x8')]);router[_0x858a('0x9')](_0x858a('0xa'),auth[_0x858a('0xb')](),controller[_0x858a('0xc')]);router[_0x858a('0x9')](_0x858a('0xd'),auth[_0x858a('0xb')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x858a('0xb')](),controller[_0x858a('0xe')]);router[_0x858a('0x9')](_0x858a('0xf'),auth[_0x858a('0xb')](),controller[_0x858a('0x10')]);router[_0x858a('0x11')]('/',auth[_0x858a('0xb')](),controller['create']);router[_0x858a('0x12')](_0x858a('0xa'),auth['isAuthenticated'](),controller[_0x858a('0x13')]);router[_0x858a('0x14')](_0x858a('0xa'),auth[_0x858a('0xb')](),controller[_0x858a('0x15')]);module[_0x858a('0x16')]=router; \ No newline at end of file +var _0xb87d=['../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x25ca55,_0x200623){var _0x782660=function(_0x3211ac){while(--_0x3211ac){_0x25ca55['push'](_0x25ca55['shift']());}};_0x782660(++_0x200623);}(_0xb87d,0x96));var _0xdb87=function(_0x55aea4,_0x3370b4){_0x55aea4=_0x55aea4-0x0;var _0x55083a=_0xb87d[_0x55aea4];return _0x55083a;};'use strict';var multer=require(_0xdb87('0x0'));var util=require('util');var path=require(_0xdb87('0x1'));var timeout=require(_0xdb87('0x2'));var express=require(_0xdb87('0x3'));var router=express['Router']();var auth=require(_0xdb87('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdb87('0x5'));var controller=require(_0xdb87('0x6'));router[_0xdb87('0x7')]('/',auth[_0xdb87('0x8')](),controller[_0xdb87('0x9')]);router[_0xdb87('0x7')](_0xdb87('0xa'),auth[_0xdb87('0x8')](),controller['show']);router[_0xdb87('0x7')]('/:id/subjects',auth[_0xdb87('0x8')](),controller[_0xdb87('0xb')]);router[_0xdb87('0x7')](_0xdb87('0xc'),auth[_0xdb87('0x8')](),controller[_0xdb87('0xd')]);router[_0xdb87('0x7')](_0xdb87('0xe'),auth[_0xdb87('0x8')](),controller[_0xdb87('0xf')]);router[_0xdb87('0x10')]('/',auth[_0xdb87('0x8')](),controller[_0xdb87('0x11')]);router[_0xdb87('0x12')](_0xdb87('0xa'),auth[_0xdb87('0x8')](),controller[_0xdb87('0x13')]);router[_0xdb87('0x14')](_0xdb87('0xa'),auth[_0xdb87('0x8')](),controller['destroy']);module[_0xdb87('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 85ae6c4..ba65026 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 _0x80ad=['STRING','exports'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0x80ad,0x165));var _0xd80a=function(_0x56d5ea,_0x530395){_0x56d5ea=_0x56d5ea-0x0;var _0x3080c=_0x80ad[_0x56d5ea];return _0x3080c;};'use strict';var Sequelize=require('sequelize');module[_0xd80a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd80a('0x1')]}}; \ No newline at end of file +var _0xdbba=['STRING','exports'];(function(_0x16803b,_0x8b0c06){var _0x2538ac=function(_0x1c82e4){while(--_0x1c82e4){_0x16803b['push'](_0x16803b['shift']());}};_0x2538ac(++_0x8b0c06);}(_0xdbba,0xf5));var _0xadbb=function(_0x376de6,_0x3d4ea7){_0x376de6=_0x376de6-0x0;var _0x6b4fd6=_0xdbba[_0x376de6];return _0x6b4fd6;};'use strict';var Sequelize=require('sequelize');module[_0xadbb('0x0')]={'name':{'type':Sequelize[_0xadbb('0x1')]},'description':{'type':Sequelize[_0xadbb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 7359037..e10fb41 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 _0x10f4=['offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','catch','create','body','getSubjects','findOne','getDescriptions','FreshsalesField','pick','getFields','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','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','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~!@#$%^&-_=+[{]}.','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','end','status','count'];(function(_0x4bfb87,_0x2ed356){var _0x2b4e25=function(_0x24469d){while(--_0x24469d){_0x4bfb87['push'](_0x4bfb87['shift']());}};_0x2b4e25(++_0x2ed356);}(_0x10f4,0x158));var _0x410f=function(_0x1dd69e,_0x417ebb){_0x1dd69e=_0x1dd69e-0x0;var _0x51e902=_0x10f4[_0x1dd69e];return _0x51e902;};'use strict';var pdf=require(_0x410f('0x0'));var emlformat=require(_0x410f('0x1'));var rimraf=require(_0x410f('0x2'));var zipdir=require(_0x410f('0x3'));var jsonpatch=require(_0x410f('0x4'));var rp=require(_0x410f('0x5'));var moment=require(_0x410f('0x6'));var BPromise=require(_0x410f('0x7'));var Mustache=require(_0x410f('0x8'));var util=require(_0x410f('0x9'));var path=require(_0x410f('0xa'));var sox=require(_0x410f('0xb'));var csv=require(_0x410f('0xc'));var ejs=require(_0x410f('0xd'));var fs=require('fs');var _=require(_0x410f('0xe'));var squel=require(_0x410f('0xf'));var crypto=require(_0x410f('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x410f('0x11'));var toCsv=require(_0x410f('0xc'));var querystring=require(_0x410f('0x12'));var Papa=require(_0x410f('0x13'));var Redis=require(_0x410f('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x410f('0x15'));var as=require(_0x410f('0x16'));var hardwareService=require(_0x410f('0x17'));var logger=require(_0x410f('0x18'))('api');var utils=require(_0x410f('0x19'));var config=require(_0x410f('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x410f('0x1b'));var client=jayson[_0x410f('0x1c')][_0x410f('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x5bc598,_0x42e300,_0x11084a){if(_0x11084a){var _0x25abb6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25abb6[_0x410f('0x1e')](_0x42e300)){return _0x5bc598;}else{throw new db['Sequelize'][(_0x410f('0x1f'))](_0x410f('0x20'));}}else{return _0x5bc598;}}function respondWithRpcPromise(_0x4b80b9,_0x4b9478,_0x3ae286,_0x585812){return new BPromise(function(_0x43db97,_0x177a86){var _0x460456=_0x585812||client;return _0x460456['request'](_0x4b80b9,_0x3ae286)[_0x410f('0x21')](function(_0x3a5736){logger['info'](_0x410f('0x22'),_0x4b9478,_0x410f('0x23'));logger[_0x410f('0x24')](_0x410f('0x25'),_0x4b9478,'request\x20sent',JSON[_0x410f('0x26')](_0x3a5736));if(_0x3a5736[_0x410f('0x27')]){if(_0x3a5736[_0x410f('0x27')][_0x410f('0x28')]===0x1f4){logger[_0x410f('0x27')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b9478,_0x3a5736[_0x410f('0x27')][_0x410f('0x29')]);return _0x177a86(_0x3a5736[_0x410f('0x27')][_0x410f('0x29')]);}logger[_0x410f('0x27')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b9478,_0x3a5736[_0x410f('0x27')][_0x410f('0x29')]);return _0x43db97(_0x3a5736['error'][_0x410f('0x29')]);}else{logger[_0x410f('0x2a')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b9478,_0x410f('0x23'));_0x43db97(_0x3a5736[_0x410f('0x2b')][_0x410f('0x29')]);}})['catch'](function(_0x3a4940){logger['error'](_0x410f('0x22'),_0x4b9478,_0x3a4940);_0x177a86(_0x3a4940);});});}function respondWithStatusCode(_0x2c11d6,_0x1b7824){_0x1b7824=_0x1b7824||0xcc;return function(_0x2d9e57){if(_0x2d9e57){return _0x2c11d6[_0x410f('0x2c')](_0x1b7824);}return _0x2c11d6['status'](_0x1b7824)[_0x410f('0x2d')]();};}function respondWithResult(_0x367a3d,_0x45696a){_0x45696a=_0x45696a||0xc8;return function(_0x16efec){if(_0x16efec){return _0x367a3d[_0x410f('0x2e')](_0x45696a)['json'](_0x16efec);}};}function respondWithFilteredResult(_0x44dd77,_0x734d3){return function(_0x344106){if(_0x344106){var _0xe3d160=_0x344106[_0x410f('0x2f')],_0xc5e130=_0x734d3[_0x410f('0x30')],_0x523f63=_0x734d3['offset']+_0x734d3['limit'],_0x4893fc;if(_0x523f63>=_0xe3d160){_0x523f63=_0xe3d160;_0x4893fc=0xc8;}else{_0x4893fc=0xce;}_0x44dd77[_0x410f('0x2e')](_0x4893fc);return _0x44dd77[_0x410f('0x31')](_0x410f('0x32'),_0xc5e130+'-'+_0x523f63+'/'+_0xe3d160)['json'](_0x344106);}return null;};}function patchUpdates(_0x1179ad){return function(_0x3b1570){try{jsonpatch['apply'](_0x3b1570,_0x1179ad,!![]);}catch(_0x5e46d9){return BPromise[_0x410f('0x33')](_0x5e46d9);}return _0x3b1570[_0x410f('0x34')]();};}function saveUpdates(_0x214070,_0x183f83){return function(_0x38a52e){if(_0x38a52e){return _0x38a52e[_0x410f('0x35')](_0x214070)[_0x410f('0x21')](function(_0x36ca76){return _0x36ca76;});}return null;};}function removeEntity(_0x25c059,_0x559e0e){return function(_0x74d57b){if(_0x74d57b){return _0x74d57b[_0x410f('0x36')]()[_0x410f('0x21')](function(){_0x25c059['status'](0xcc)[_0x410f('0x2d')]();});}};}function handleEntityNotFound(_0x39e595,_0x3127f7){return function(_0x3274e4){if(!_0x3274e4){_0x39e595[_0x410f('0x2c')](0x194);}return _0x3274e4;};}function handleError(_0x1159c8,_0x4e7802){_0x4e7802=_0x4e7802||0x1f4;return function(_0x1d8733){logger[_0x410f('0x27')](_0x1d8733[_0x410f('0x37')]);if(_0x1d8733[_0x410f('0x38')]){delete _0x1d8733[_0x410f('0x38')];}_0x1159c8['status'](_0x4e7802)[_0x410f('0x39')](_0x1d8733);};}exports[_0x410f('0x3a')]=function(_0x3d7c5b,_0x59715f){var _0x194325={},_0x2beff6={},_0x2fdd51={'count':0x0,'rows':[]};var _0x3b8ca4=_[_0x410f('0x3b')](db[_0x410f('0x3c')][_0x410f('0x3d')],function(_0x289f34){return{'name':_0x289f34[_0x410f('0x3e')],'type':_0x289f34[_0x410f('0x3f')][_0x410f('0x40')]};});_0x2beff6['model']=_[_0x410f('0x3b')](_0x3b8ca4,_0x410f('0x38'));_0x2beff6[_0x410f('0x41')]=_[_0x410f('0x42')](_0x3d7c5b[_0x410f('0x41')]);_0x2beff6[_0x410f('0x43')]=_['intersection'](_0x2beff6[_0x410f('0x44')],_0x2beff6[_0x410f('0x41')]);_0x194325[_0x410f('0x45')]=_[_0x410f('0x46')](_0x2beff6[_0x410f('0x44')],qs[_0x410f('0x47')](_0x3d7c5b[_0x410f('0x41')][_0x410f('0x47')]));_0x194325[_0x410f('0x45')]=_0x194325[_0x410f('0x45')][_0x410f('0x48')]?_0x194325[_0x410f('0x45')]:_0x2beff6[_0x410f('0x44')];if(!_0x3d7c5b[_0x410f('0x41')][_0x410f('0x49')](_0x410f('0x4a'))){_0x194325[_0x410f('0x4b')]=qs['limit'](_0x3d7c5b[_0x410f('0x41')][_0x410f('0x4b')]);_0x194325[_0x410f('0x30')]=qs[_0x410f('0x30')](_0x3d7c5b[_0x410f('0x41')][_0x410f('0x30')]);}_0x194325[_0x410f('0x4c')]=qs['sort'](_0x3d7c5b[_0x410f('0x41')][_0x410f('0x4d')]);_0x194325[_0x410f('0x4e')]=qs[_0x410f('0x43')](_['pick'](_0x3d7c5b[_0x410f('0x41')],_0x2beff6['filters']),_0x3b8ca4);if(_0x3d7c5b[_0x410f('0x41')][_0x410f('0x4f')]){_0x194325[_0x410f('0x4e')]=_[_0x410f('0x50')](_0x194325['where'],{'$or':_[_0x410f('0x3b')](_0x3b8ca4,function(_0x519a24){if(_0x519a24[_0x410f('0x3f')]!==_0x410f('0x51')){var _0x557132={};_0x557132[_0x519a24[_0x410f('0x38')]]={'$like':'%'+_0x3d7c5b[_0x410f('0x41')][_0x410f('0x4f')]+'%'};return _0x557132;}})});}_0x194325=_[_0x410f('0x50')]({},_0x194325,_0x3d7c5b[_0x410f('0x52')]);var _0x515dc3={'where':_0x194325[_0x410f('0x4e')]};return db['FreshsalesConfiguration'][_0x410f('0x2f')](_0x515dc3)[_0x410f('0x21')](function(_0x57add6){_0x2fdd51[_0x410f('0x2f')]=_0x57add6;if(_0x3d7c5b[_0x410f('0x41')][_0x410f('0x53')]){_0x194325['include']=[{'all':!![]}];}return db[_0x410f('0x3c')][_0x410f('0x54')](_0x194325);})[_0x410f('0x21')](function(_0x505e10){_0x2fdd51[_0x410f('0x55')]=_0x505e10;return _0x2fdd51;})[_0x410f('0x21')](respondWithFilteredResult(_0x59715f,_0x194325))['catch'](handleError(_0x59715f,null));};exports['show']=function(_0x232fbe,_0x3474b2){var _0x86344b={'raw':![],'where':{'id':_0x232fbe[_0x410f('0x56')]['id']}},_0x5798ae={};_0x5798ae['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x5798ae['query']=_['keys'](_0x232fbe['query']);_0x5798ae[_0x410f('0x43')]=_[_0x410f('0x46')](_0x5798ae[_0x410f('0x44')],_0x5798ae[_0x410f('0x41')]);_0x86344b[_0x410f('0x45')]=_[_0x410f('0x46')](_0x5798ae[_0x410f('0x44')],qs[_0x410f('0x47')](_0x232fbe['query'][_0x410f('0x47')]));_0x86344b['attributes']=_0x86344b[_0x410f('0x45')][_0x410f('0x48')]?_0x86344b['attributes']:_0x5798ae[_0x410f('0x44')];if(_0x232fbe[_0x410f('0x41')][_0x410f('0x53')]){_0x86344b[_0x410f('0x57')]=[{'all':!![]}];}_0x86344b=_[_0x410f('0x50')]({},_0x86344b,_0x232fbe['options']);return db[_0x410f('0x3c')][_0x410f('0x58')](_0x86344b)[_0x410f('0x21')](handleEntityNotFound(_0x3474b2,null))[_0x410f('0x21')](respondWithResult(_0x3474b2,null))[_0x410f('0x59')](handleError(_0x3474b2,null));};exports[_0x410f('0x5a')]=function(_0x55ca91,_0x12f175){return db[_0x410f('0x3c')][_0x410f('0x5a')](_0x55ca91[_0x410f('0x5b')],{})['then'](respondWithResult(_0x12f175,0xc9))[_0x410f('0x59')](handleError(_0x12f175,null));};exports[_0x410f('0x35')]=function(_0x3d561c,_0x5a33de){if(_0x3d561c[_0x410f('0x5b')]['id']){delete _0x3d561c[_0x410f('0x5b')]['id'];}return db[_0x410f('0x3c')][_0x410f('0x58')]({'where':{'id':_0x3d561c[_0x410f('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a33de,null))[_0x410f('0x21')](saveUpdates(_0x3d561c[_0x410f('0x5b')],null))[_0x410f('0x21')](respondWithResult(_0x5a33de,null))[_0x410f('0x59')](handleError(_0x5a33de,null));};exports[_0x410f('0x36')]=function(_0x1025b5,_0x17111a){return db[_0x410f('0x3c')]['find']({'where':{'id':_0x1025b5['params']['id']}})[_0x410f('0x21')](handleEntityNotFound(_0x17111a,null))['then'](removeEntity(_0x17111a,null))[_0x410f('0x59')](handleError(_0x17111a,null));};exports[_0x410f('0x5c')]=function(_0x1ed009,_0x2c612c,_0x3560ee){var _0x4505ae={};var _0x1faf09={};var _0x315cb6;var _0x74d28a;return db[_0x410f('0x3c')][_0x410f('0x5d')]({'where':{'id':_0x1ed009['params']['id']}})['then'](handleEntityNotFound(_0x2c612c,null))[_0x410f('0x21')](function(_0x78705d){if(_0x78705d){_0x315cb6=_0x78705d;_0x1faf09[_0x410f('0x44')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x1faf09[_0x410f('0x41')]=_[_0x410f('0x42')](_0x1ed009[_0x410f('0x41')]);_0x1faf09[_0x410f('0x43')]=_[_0x410f('0x46')](_0x1faf09[_0x410f('0x44')],_0x1faf09[_0x410f('0x41')]);_0x4505ae[_0x410f('0x45')]=_[_0x410f('0x46')](_0x1faf09[_0x410f('0x44')],qs[_0x410f('0x47')](_0x1ed009[_0x410f('0x41')][_0x410f('0x47')]));_0x4505ae[_0x410f('0x45')]=_0x4505ae['attributes']['length']?_0x4505ae[_0x410f('0x45')]:_0x1faf09[_0x410f('0x44')];_0x4505ae[_0x410f('0x4c')]=qs[_0x410f('0x4d')](_0x1ed009['query'][_0x410f('0x4d')]);_0x4505ae[_0x410f('0x4e')]=qs[_0x410f('0x43')](_['pick'](_0x1ed009[_0x410f('0x41')],_0x1faf09['filters']));if(_0x1ed009[_0x410f('0x41')][_0x410f('0x4f')]){_0x4505ae[_0x410f('0x4e')]=_[_0x410f('0x50')](_0x4505ae['where'],{'$or':_[_0x410f('0x3b')](_0x4505ae[_0x410f('0x45')],function(_0x26b3ea){var _0x4777f4={};_0x4777f4[_0x26b3ea]={'$like':'%'+_0x1ed009[_0x410f('0x41')]['filter']+'%'};return _0x4777f4;})});}_0x4505ae=_[_0x410f('0x50')]({},_0x4505ae,_0x1ed009['options']);return _0x315cb6['getSubjects'](_0x4505ae);}})[_0x410f('0x21')](function(_0x182320){if(_0x182320){_0x74d28a=_0x182320[_0x410f('0x48')];if(!_0x1ed009[_0x410f('0x41')]['hasOwnProperty']('nolimit')){_0x4505ae[_0x410f('0x4b')]=qs[_0x410f('0x4b')](_0x1ed009[_0x410f('0x41')][_0x410f('0x4b')]);_0x4505ae[_0x410f('0x30')]=qs['offset'](_0x1ed009[_0x410f('0x41')][_0x410f('0x30')]);}return _0x315cb6[_0x410f('0x5c')](_0x4505ae);}})['then'](function(_0x4af0e1){if(_0x4af0e1){return _0x4af0e1?{'count':_0x74d28a,'rows':_0x4af0e1}:null;}})[_0x410f('0x21')](respondWithResult(_0x2c612c,null))['catch'](handleError(_0x2c612c,null));};exports[_0x410f('0x5e')]=function(_0x2c4473,_0x27c091,_0x519012){var _0xa3ca1d={};var _0x5e08d4={};var _0x46abb8;var _0x203c8e;return db[_0x410f('0x3c')][_0x410f('0x5d')]({'where':{'id':_0x2c4473[_0x410f('0x56')]['id']}})[_0x410f('0x21')](handleEntityNotFound(_0x27c091,null))['then'](function(_0xf92bf1){if(_0xf92bf1){_0x46abb8=_0xf92bf1;_0x5e08d4[_0x410f('0x44')]=_[_0x410f('0x42')](db[_0x410f('0x5f')][_0x410f('0x3d')]);_0x5e08d4[_0x410f('0x41')]=_[_0x410f('0x42')](_0x2c4473[_0x410f('0x41')]);_0x5e08d4[_0x410f('0x43')]=_[_0x410f('0x46')](_0x5e08d4[_0x410f('0x44')],_0x5e08d4[_0x410f('0x41')]);_0xa3ca1d['attributes']=_[_0x410f('0x46')](_0x5e08d4[_0x410f('0x44')],qs['fields'](_0x2c4473[_0x410f('0x41')][_0x410f('0x47')]));_0xa3ca1d[_0x410f('0x45')]=_0xa3ca1d[_0x410f('0x45')]['length']?_0xa3ca1d['attributes']:_0x5e08d4[_0x410f('0x44')];_0xa3ca1d[_0x410f('0x4c')]=qs['sort'](_0x2c4473['query']['sort']);_0xa3ca1d[_0x410f('0x4e')]=qs[_0x410f('0x43')](_[_0x410f('0x60')](_0x2c4473[_0x410f('0x41')],_0x5e08d4[_0x410f('0x43')]));if(_0x2c4473['query']['filter']){_0xa3ca1d['where']=_['merge'](_0xa3ca1d[_0x410f('0x4e')],{'$or':_[_0x410f('0x3b')](_0xa3ca1d[_0x410f('0x45')],function(_0x7e1da5){var _0x4ca09a={};_0x4ca09a[_0x7e1da5]={'$like':'%'+_0x2c4473[_0x410f('0x41')][_0x410f('0x4f')]+'%'};return _0x4ca09a;})});}_0xa3ca1d=_[_0x410f('0x50')]({},_0xa3ca1d,_0x2c4473['options']);return _0x46abb8[_0x410f('0x5e')](_0xa3ca1d);}})[_0x410f('0x21')](function(_0x1a5b40){if(_0x1a5b40){_0x203c8e=_0x1a5b40['length'];if(!_0x2c4473['query'][_0x410f('0x49')]('nolimit')){_0xa3ca1d[_0x410f('0x4b')]=qs['limit'](_0x2c4473[_0x410f('0x41')]['limit']);_0xa3ca1d[_0x410f('0x30')]=qs['offset'](_0x2c4473[_0x410f('0x41')][_0x410f('0x30')]);}return _0x46abb8[_0x410f('0x5e')](_0xa3ca1d);}})['then'](function(_0x41a488){if(_0x41a488){return _0x41a488?{'count':_0x203c8e,'rows':_0x41a488}:null;}})[_0x410f('0x21')](respondWithResult(_0x27c091,null))[_0x410f('0x59')](handleError(_0x27c091,null));};exports[_0x410f('0x61')]=function(_0x30ace7,_0x5e13e8,_0x478241){var _0x78c0f4={};var _0x44617a={};var _0x4f68da;var _0x15ed38;return db[_0x410f('0x3c')]['findOne']({'where':{'id':_0x30ace7[_0x410f('0x56')]['id']}})[_0x410f('0x21')](handleEntityNotFound(_0x5e13e8,null))[_0x410f('0x21')](function(_0x201be8){if(_0x201be8){_0x4f68da=_0x201be8;_0x44617a['model']=_[_0x410f('0x42')](db['FreshsalesField'][_0x410f('0x3d')]);_0x44617a['query']=_[_0x410f('0x42')](_0x30ace7[_0x410f('0x41')]);_0x44617a[_0x410f('0x43')]=_[_0x410f('0x46')](_0x44617a[_0x410f('0x44')],_0x44617a['query']);_0x78c0f4[_0x410f('0x45')]=_[_0x410f('0x46')](_0x44617a[_0x410f('0x44')],qs[_0x410f('0x47')](_0x30ace7[_0x410f('0x41')]['fields']));_0x78c0f4['attributes']=_0x78c0f4[_0x410f('0x45')][_0x410f('0x48')]?_0x78c0f4[_0x410f('0x45')]:_0x44617a[_0x410f('0x44')];_0x78c0f4['order']=qs[_0x410f('0x4d')](_0x30ace7[_0x410f('0x41')][_0x410f('0x4d')]);_0x78c0f4[_0x410f('0x4e')]=qs[_0x410f('0x43')](_[_0x410f('0x60')](_0x30ace7['query'],_0x44617a['filters']));if(_0x30ace7[_0x410f('0x41')]['filter']){_0x78c0f4[_0x410f('0x4e')]=_['merge'](_0x78c0f4[_0x410f('0x4e')],{'$or':_[_0x410f('0x3b')](_0x78c0f4[_0x410f('0x45')],function(_0x1476b1){var _0x30e729={};_0x30e729[_0x1476b1]={'$like':'%'+_0x30ace7[_0x410f('0x41')][_0x410f('0x4f')]+'%'};return _0x30e729;})});}_0x78c0f4=_[_0x410f('0x50')]({},_0x78c0f4,_0x30ace7[_0x410f('0x52')]);return _0x4f68da[_0x410f('0x61')](_0x78c0f4);}})[_0x410f('0x21')](function(_0x5a8118){if(_0x5a8118){_0x15ed38=_0x5a8118[_0x410f('0x48')];if(!_0x30ace7[_0x410f('0x41')][_0x410f('0x49')](_0x410f('0x4a'))){_0x78c0f4[_0x410f('0x4b')]=qs[_0x410f('0x4b')](_0x30ace7['query'][_0x410f('0x4b')]);_0x78c0f4[_0x410f('0x30')]=qs['offset'](_0x30ace7['query'][_0x410f('0x30')]);}return _0x4f68da['getFields'](_0x78c0f4);}})[_0x410f('0x21')](function(_0x4b4dcd){if(_0x4b4dcd){return _0x4b4dcd?{'count':_0x15ed38,'rows':_0x4b4dcd}:null;}})[_0x410f('0x21')](respondWithResult(_0x5e13e8,null))[_0x410f('0x59')](handleError(_0x5e13e8,null));}; \ No newline at end of file +var _0x357c=['../../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','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','offset','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x46b092,_0x5410af){var _0x42c3f8=function(_0x1000c4){while(--_0x1000c4){_0x46b092['push'](_0x46b092['shift']());}};_0x42c3f8(++_0x5410af);}(_0x357c,0x1b1));var _0xc357=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x357c[_0x2706da];return _0x3ba87e;};'use strict';var pdf=require(_0xc357('0x0'));var emlformat=require(_0xc357('0x1'));var rimraf=require(_0xc357('0x2'));var zipdir=require(_0xc357('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc357('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc357('0x5'));var util=require(_0xc357('0x6'));var path=require(_0xc357('0x7'));var sox=require('sox');var csv=require(_0xc357('0x8'));var ejs=require(_0xc357('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc357('0xa'));var crypto=require(_0xc357('0xb'));var jsforce=require(_0xc357('0xc'));var deskjs=require(_0xc357('0xd'));var toCsv=require(_0xc357('0x8'));var querystring=require(_0xc357('0xe'));var Papa=require(_0xc357('0xf'));var Redis=require(_0xc357('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc357('0x11'));var as=require(_0xc357('0x12'));var hardwareService=require(_0xc357('0x13'));var logger=require('../../config/logger')(_0xc357('0x14'));var utils=require(_0xc357('0x15'));var config=require(_0xc357('0x16'));var db=require(_0xc357('0x17'))['db'];var jayson=require(_0xc357('0x18'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x9cd170,_0x26ab21,_0x242102){if(_0x242102){var _0x2d5477=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d5477[_0xc357('0x19')](_0x26ab21)){return _0x9cd170;}else{throw new db['Sequelize'][(_0xc357('0x1a'))](_0xc357('0x1b'));}}else{return _0x9cd170;}}function respondWithRpcPromise(_0x242b1f,_0x1019ca,_0x480d21,_0x47adbc){return new BPromise(function(_0x5177fa,_0x40bfb4){var _0x293251=_0x47adbc||client;return _0x293251['request'](_0x242b1f,_0x480d21)[_0xc357('0x1c')](function(_0x1026a9){logger[_0xc357('0x1d')](_0xc357('0x1e'),_0x1019ca,_0xc357('0x1f'));logger[_0xc357('0x20')](_0xc357('0x21'),_0x1019ca,_0xc357('0x1f'),JSON[_0xc357('0x22')](_0x1026a9));if(_0x1026a9[_0xc357('0x23')]){if(_0x1026a9[_0xc357('0x23')]['code']===0x1f4){logger[_0xc357('0x23')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1019ca,_0x1026a9[_0xc357('0x23')][_0xc357('0x24')]);return _0x40bfb4(_0x1026a9[_0xc357('0x23')]['message']);}logger[_0xc357('0x23')](_0xc357('0x1e'),_0x1019ca,_0x1026a9['error'][_0xc357('0x24')]);return _0x5177fa(_0x1026a9['error'][_0xc357('0x24')]);}else{logger[_0xc357('0x1d')](_0xc357('0x1e'),_0x1019ca,_0xc357('0x1f'));_0x5177fa(_0x1026a9['result'][_0xc357('0x24')]);}})[_0xc357('0x25')](function(_0x52ee58){logger[_0xc357('0x23')](_0xc357('0x1e'),_0x1019ca,_0x52ee58);_0x40bfb4(_0x52ee58);});});}function respondWithStatusCode(_0x5edfa8,_0x2b7f64){_0x2b7f64=_0x2b7f64||0xcc;return function(_0x1b8a82){if(_0x1b8a82){return _0x5edfa8['sendStatus'](_0x2b7f64);}return _0x5edfa8[_0xc357('0x26')](_0x2b7f64)[_0xc357('0x27')]();};}function respondWithResult(_0x31e26d,_0x544da5){_0x544da5=_0x544da5||0xc8;return function(_0x3b726d){if(_0x3b726d){return _0x31e26d[_0xc357('0x26')](_0x544da5)[_0xc357('0x28')](_0x3b726d);}};}function respondWithFilteredResult(_0x1ebb38,_0x3936ee){return function(_0x41da32){if(_0x41da32){var _0x13091d=_0x41da32['count'],_0x413fd4=_0x3936ee[_0xc357('0x29')],_0x4f40c6=_0x3936ee[_0xc357('0x29')]+_0x3936ee['limit'],_0x52c1f6;if(_0x4f40c6>=_0x13091d){_0x4f40c6=_0x13091d;_0x52c1f6=0xc8;}else{_0x52c1f6=0xce;}_0x1ebb38[_0xc357('0x26')](_0x52c1f6);return _0x1ebb38['set'](_0xc357('0x2a'),_0x413fd4+'-'+_0x4f40c6+'/'+_0x13091d)['json'](_0x41da32);}return null;};}function patchUpdates(_0x48f75d){return function(_0x179f66){try{jsonpatch['apply'](_0x179f66,_0x48f75d,!![]);}catch(_0x5966d8){return BPromise[_0xc357('0x2b')](_0x5966d8);}return _0x179f66[_0xc357('0x2c')]();};}function saveUpdates(_0x3307bf,_0x1416eb){return function(_0x4fdb12){if(_0x4fdb12){return _0x4fdb12[_0xc357('0x2d')](_0x3307bf)[_0xc357('0x1c')](function(_0xd5d87b){return _0xd5d87b;});}return null;};}function removeEntity(_0x2240d7,_0x9f85c0){return function(_0x3a03c3){if(_0x3a03c3){return _0x3a03c3[_0xc357('0x2e')]()[_0xc357('0x1c')](function(){_0x2240d7[_0xc357('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eebda,_0x1b9ac7){return function(_0x258de9){if(!_0x258de9){_0x4eebda[_0xc357('0x2f')](0x194);}return _0x258de9;};}function handleError(_0x4360cc,_0x15084e){_0x15084e=_0x15084e||0x1f4;return function(_0x42d997){logger[_0xc357('0x23')](_0x42d997[_0xc357('0x30')]);if(_0x42d997[_0xc357('0x31')]){delete _0x42d997[_0xc357('0x31')];}_0x4360cc[_0xc357('0x26')](_0x15084e)[_0xc357('0x32')](_0x42d997);};}exports[_0xc357('0x33')]=function(_0x2d7cfc,_0x3b7f9a){var _0x40b7f1={},_0x4832e1={},_0x582c5b={'count':0x0,'rows':[]};var _0x51017c=_[_0xc357('0x34')](db[_0xc357('0x35')][_0xc357('0x36')],function(_0x20e9b0){return{'name':_0x20e9b0['fieldName'],'type':_0x20e9b0['type'][_0xc357('0x37')]};});_0x4832e1[_0xc357('0x38')]=_[_0xc357('0x34')](_0x51017c,'name');_0x4832e1[_0xc357('0x39')]=_['keys'](_0x2d7cfc['query']);_0x4832e1['filters']=_[_0xc357('0x3a')](_0x4832e1[_0xc357('0x38')],_0x4832e1[_0xc357('0x39')]);_0x40b7f1[_0xc357('0x3b')]=_[_0xc357('0x3a')](_0x4832e1['model'],qs[_0xc357('0x3c')](_0x2d7cfc[_0xc357('0x39')][_0xc357('0x3c')]));_0x40b7f1[_0xc357('0x3b')]=_0x40b7f1['attributes'][_0xc357('0x3d')]?_0x40b7f1[_0xc357('0x3b')]:_0x4832e1[_0xc357('0x38')];if(!_0x2d7cfc[_0xc357('0x39')]['hasOwnProperty'](_0xc357('0x3e'))){_0x40b7f1[_0xc357('0x3f')]=qs['limit'](_0x2d7cfc[_0xc357('0x39')]['limit']);_0x40b7f1['offset']=qs[_0xc357('0x29')](_0x2d7cfc['query']['offset']);}_0x40b7f1[_0xc357('0x40')]=qs['sort'](_0x2d7cfc['query'][_0xc357('0x41')]);_0x40b7f1[_0xc357('0x42')]=qs[_0xc357('0x43')](_[_0xc357('0x44')](_0x2d7cfc[_0xc357('0x39')],_0x4832e1[_0xc357('0x43')]),_0x51017c);if(_0x2d7cfc[_0xc357('0x39')][_0xc357('0x45')]){_0x40b7f1['where']=_[_0xc357('0x46')](_0x40b7f1[_0xc357('0x42')],{'$or':_[_0xc357('0x34')](_0x51017c,function(_0x1c749e){if(_0x1c749e[_0xc357('0x47')]!==_0xc357('0x48')){var _0x33003d={};_0x33003d[_0x1c749e[_0xc357('0x31')]]={'$like':'%'+_0x2d7cfc['query'][_0xc357('0x45')]+'%'};return _0x33003d;}})});}_0x40b7f1=_[_0xc357('0x46')]({},_0x40b7f1,_0x2d7cfc[_0xc357('0x49')]);var _0x4fd596={'where':_0x40b7f1[_0xc357('0x42')]};return db[_0xc357('0x35')][_0xc357('0x4a')](_0x4fd596)['then'](function(_0x47c5fa){_0x582c5b['count']=_0x47c5fa;if(_0x2d7cfc[_0xc357('0x39')][_0xc357('0x4b')]){_0x40b7f1[_0xc357('0x4c')]=[{'all':!![]}];}return db[_0xc357('0x35')][_0xc357('0x4d')](_0x40b7f1);})[_0xc357('0x1c')](function(_0x5e0d84){_0x582c5b[_0xc357('0x4e')]=_0x5e0d84;return _0x582c5b;})[_0xc357('0x1c')](respondWithFilteredResult(_0x3b7f9a,_0x40b7f1))['catch'](handleError(_0x3b7f9a,null));};exports[_0xc357('0x4f')]=function(_0x23bc5a,_0x9632e){var _0x1e6163={'raw':![],'where':{'id':_0x23bc5a[_0xc357('0x50')]['id']}},_0x4dff7f={};_0x4dff7f[_0xc357('0x38')]=_[_0xc357('0x51')](db[_0xc357('0x35')]['rawAttributes']);_0x4dff7f[_0xc357('0x39')]=_[_0xc357('0x51')](_0x23bc5a[_0xc357('0x39')]);_0x4dff7f[_0xc357('0x43')]=_['intersection'](_0x4dff7f['model'],_0x4dff7f['query']);_0x1e6163['attributes']=_['intersection'](_0x4dff7f[_0xc357('0x38')],qs['fields'](_0x23bc5a['query'][_0xc357('0x3c')]));_0x1e6163[_0xc357('0x3b')]=_0x1e6163[_0xc357('0x3b')][_0xc357('0x3d')]?_0x1e6163['attributes']:_0x4dff7f[_0xc357('0x38')];if(_0x23bc5a[_0xc357('0x39')]['includeAll']){_0x1e6163[_0xc357('0x4c')]=[{'all':!![]}];}_0x1e6163=_[_0xc357('0x46')]({},_0x1e6163,_0x23bc5a[_0xc357('0x49')]);return db['FreshsalesConfiguration'][_0xc357('0x52')](_0x1e6163)[_0xc357('0x1c')](handleEntityNotFound(_0x9632e,null))[_0xc357('0x1c')](respondWithResult(_0x9632e,null))[_0xc357('0x25')](handleError(_0x9632e,null));};exports[_0xc357('0x53')]=function(_0x5a9b48,_0x185a18){return db[_0xc357('0x35')][_0xc357('0x53')](_0x5a9b48[_0xc357('0x54')],{})[_0xc357('0x1c')](respondWithResult(_0x185a18,0xc9))['catch'](handleError(_0x185a18,null));};exports[_0xc357('0x2d')]=function(_0x4320ec,_0x3ce096){if(_0x4320ec[_0xc357('0x54')]['id']){delete _0x4320ec[_0xc357('0x54')]['id'];}return db[_0xc357('0x35')][_0xc357('0x52')]({'where':{'id':_0x4320ec['params']['id']}})[_0xc357('0x1c')](handleEntityNotFound(_0x3ce096,null))['then'](saveUpdates(_0x4320ec[_0xc357('0x54')],null))[_0xc357('0x1c')](respondWithResult(_0x3ce096,null))[_0xc357('0x25')](handleError(_0x3ce096,null));};exports[_0xc357('0x2e')]=function(_0x50ca14,_0x266136){return db[_0xc357('0x35')]['find']({'where':{'id':_0x50ca14[_0xc357('0x50')]['id']}})[_0xc357('0x1c')](handleEntityNotFound(_0x266136,null))[_0xc357('0x1c')](removeEntity(_0x266136,null))[_0xc357('0x25')](handleError(_0x266136,null));};exports[_0xc357('0x55')]=function(_0x156f77,_0x37653a,_0x94c19a){var _0x21b65a={};var _0x1c690f={};var _0x29b7f9;var _0x58d1fc;return db[_0xc357('0x35')][_0xc357('0x56')]({'where':{'id':_0x156f77[_0xc357('0x50')]['id']}})['then'](handleEntityNotFound(_0x37653a,null))[_0xc357('0x1c')](function(_0x3816d0){if(_0x3816d0){_0x29b7f9=_0x3816d0;_0x1c690f['model']=_[_0xc357('0x51')](db[_0xc357('0x57')][_0xc357('0x36')]);_0x1c690f[_0xc357('0x39')]=_[_0xc357('0x51')](_0x156f77[_0xc357('0x39')]);_0x1c690f[_0xc357('0x43')]=_['intersection'](_0x1c690f[_0xc357('0x38')],_0x1c690f['query']);_0x21b65a[_0xc357('0x3b')]=_['intersection'](_0x1c690f[_0xc357('0x38')],qs[_0xc357('0x3c')](_0x156f77[_0xc357('0x39')][_0xc357('0x3c')]));_0x21b65a[_0xc357('0x3b')]=_0x21b65a[_0xc357('0x3b')][_0xc357('0x3d')]?_0x21b65a['attributes']:_0x1c690f[_0xc357('0x38')];_0x21b65a['order']=qs[_0xc357('0x41')](_0x156f77[_0xc357('0x39')]['sort']);_0x21b65a[_0xc357('0x42')]=qs[_0xc357('0x43')](_[_0xc357('0x44')](_0x156f77['query'],_0x1c690f[_0xc357('0x43')]));if(_0x156f77[_0xc357('0x39')][_0xc357('0x45')]){_0x21b65a[_0xc357('0x42')]=_['merge'](_0x21b65a['where'],{'$or':_[_0xc357('0x34')](_0x21b65a['attributes'],function(_0x6298fa){var _0x5c122d={};_0x5c122d[_0x6298fa]={'$like':'%'+_0x156f77['query']['filter']+'%'};return _0x5c122d;})});}_0x21b65a=_[_0xc357('0x46')]({},_0x21b65a,_0x156f77[_0xc357('0x49')]);return _0x29b7f9[_0xc357('0x55')](_0x21b65a);}})['then'](function(_0x3f3910){if(_0x3f3910){_0x58d1fc=_0x3f3910[_0xc357('0x3d')];if(!_0x156f77[_0xc357('0x39')][_0xc357('0x58')](_0xc357('0x3e'))){_0x21b65a[_0xc357('0x3f')]=qs[_0xc357('0x3f')](_0x156f77[_0xc357('0x39')][_0xc357('0x3f')]);_0x21b65a['offset']=qs[_0xc357('0x29')](_0x156f77[_0xc357('0x39')][_0xc357('0x29')]);}return _0x29b7f9[_0xc357('0x55')](_0x21b65a);}})['then'](function(_0x2de3e3){if(_0x2de3e3){return _0x2de3e3?{'count':_0x58d1fc,'rows':_0x2de3e3}:null;}})[_0xc357('0x1c')](respondWithResult(_0x37653a,null))[_0xc357('0x25')](handleError(_0x37653a,null));};exports['getDescriptions']=function(_0x30ce8b,_0x15d5ff,_0x4fbadd){var _0x1bb6ac={};var _0x15dd50={};var _0x3fbcdd;var _0x1a641a;return db[_0xc357('0x35')][_0xc357('0x56')]({'where':{'id':_0x30ce8b[_0xc357('0x50')]['id']}})['then'](handleEntityNotFound(_0x15d5ff,null))[_0xc357('0x1c')](function(_0x5524e6){if(_0x5524e6){_0x3fbcdd=_0x5524e6;_0x15dd50[_0xc357('0x38')]=_[_0xc357('0x51')](db['FreshsalesField'][_0xc357('0x36')]);_0x15dd50['query']=_[_0xc357('0x51')](_0x30ce8b[_0xc357('0x39')]);_0x15dd50[_0xc357('0x43')]=_[_0xc357('0x3a')](_0x15dd50[_0xc357('0x38')],_0x15dd50['query']);_0x1bb6ac[_0xc357('0x3b')]=_[_0xc357('0x3a')](_0x15dd50[_0xc357('0x38')],qs[_0xc357('0x3c')](_0x30ce8b[_0xc357('0x39')]['fields']));_0x1bb6ac[_0xc357('0x3b')]=_0x1bb6ac[_0xc357('0x3b')]['length']?_0x1bb6ac[_0xc357('0x3b')]:_0x15dd50[_0xc357('0x38')];_0x1bb6ac[_0xc357('0x40')]=qs[_0xc357('0x41')](_0x30ce8b[_0xc357('0x39')][_0xc357('0x41')]);_0x1bb6ac['where']=qs[_0xc357('0x43')](_[_0xc357('0x44')](_0x30ce8b[_0xc357('0x39')],_0x15dd50['filters']));if(_0x30ce8b[_0xc357('0x39')][_0xc357('0x45')]){_0x1bb6ac[_0xc357('0x42')]=_[_0xc357('0x46')](_0x1bb6ac[_0xc357('0x42')],{'$or':_['map'](_0x1bb6ac[_0xc357('0x3b')],function(_0x330590){var _0x539111={};_0x539111[_0x330590]={'$like':'%'+_0x30ce8b[_0xc357('0x39')][_0xc357('0x45')]+'%'};return _0x539111;})});}_0x1bb6ac=_[_0xc357('0x46')]({},_0x1bb6ac,_0x30ce8b[_0xc357('0x49')]);return _0x3fbcdd[_0xc357('0x59')](_0x1bb6ac);}})[_0xc357('0x1c')](function(_0x169af3){if(_0x169af3){_0x1a641a=_0x169af3['length'];if(!_0x30ce8b[_0xc357('0x39')][_0xc357('0x58')]('nolimit')){_0x1bb6ac[_0xc357('0x3f')]=qs['limit'](_0x30ce8b[_0xc357('0x39')][_0xc357('0x3f')]);_0x1bb6ac[_0xc357('0x29')]=qs[_0xc357('0x29')](_0x30ce8b['query'][_0xc357('0x29')]);}return _0x3fbcdd['getDescriptions'](_0x1bb6ac);}})[_0xc357('0x1c')](function(_0x148569){if(_0x148569){return _0x148569?{'count':_0x1a641a,'rows':_0x148569}:null;}})[_0xc357('0x1c')](respondWithResult(_0x15d5ff,null))[_0xc357('0x25')](handleError(_0x15d5ff,null));};exports['getFields']=function(_0x4627db,_0x3f4dc2,_0x3c676b){var _0x4b7e5e={};var _0x584691={};var _0x22b1c6;var _0x28d0bf;return db[_0xc357('0x35')][_0xc357('0x56')]({'where':{'id':_0x4627db[_0xc357('0x50')]['id']}})[_0xc357('0x1c')](handleEntityNotFound(_0x3f4dc2,null))[_0xc357('0x1c')](function(_0x1a60bb){if(_0x1a60bb){_0x22b1c6=_0x1a60bb;_0x584691['model']=_[_0xc357('0x51')](db[_0xc357('0x57')][_0xc357('0x36')]);_0x584691['query']=_[_0xc357('0x51')](_0x4627db[_0xc357('0x39')]);_0x584691['filters']=_[_0xc357('0x3a')](_0x584691[_0xc357('0x38')],_0x584691[_0xc357('0x39')]);_0x4b7e5e[_0xc357('0x3b')]=_[_0xc357('0x3a')](_0x584691[_0xc357('0x38')],qs['fields'](_0x4627db[_0xc357('0x39')][_0xc357('0x3c')]));_0x4b7e5e[_0xc357('0x3b')]=_0x4b7e5e[_0xc357('0x3b')][_0xc357('0x3d')]?_0x4b7e5e['attributes']:_0x584691['model'];_0x4b7e5e['order']=qs[_0xc357('0x41')](_0x4627db[_0xc357('0x39')][_0xc357('0x41')]);_0x4b7e5e[_0xc357('0x42')]=qs['filters'](_[_0xc357('0x44')](_0x4627db[_0xc357('0x39')],_0x584691[_0xc357('0x43')]));if(_0x4627db['query'][_0xc357('0x45')]){_0x4b7e5e['where']=_[_0xc357('0x46')](_0x4b7e5e[_0xc357('0x42')],{'$or':_[_0xc357('0x34')](_0x4b7e5e[_0xc357('0x3b')],function(_0x121d6f){var _0xe87268={};_0xe87268[_0x121d6f]={'$like':'%'+_0x4627db[_0xc357('0x39')][_0xc357('0x45')]+'%'};return _0xe87268;})});}_0x4b7e5e=_['merge']({},_0x4b7e5e,_0x4627db[_0xc357('0x49')]);return _0x22b1c6[_0xc357('0x5a')](_0x4b7e5e);}})['then'](function(_0x4ec51a){if(_0x4ec51a){_0x28d0bf=_0x4ec51a['length'];if(!_0x4627db[_0xc357('0x39')][_0xc357('0x58')](_0xc357('0x3e'))){_0x4b7e5e[_0xc357('0x3f')]=qs[_0xc357('0x3f')](_0x4627db[_0xc357('0x39')][_0xc357('0x3f')]);_0x4b7e5e[_0xc357('0x29')]=qs[_0xc357('0x29')](_0x4627db[_0xc357('0x39')][_0xc357('0x29')]);}return _0x22b1c6['getFields'](_0x4b7e5e);}})['then'](function(_0x5a09b4){if(_0x5a09b4){return _0x5a09b4?{'count':_0x28d0bf,'rows':_0x5a09b4}:null;}})[_0xc357('0x1c')](respondWithResult(_0x3f4dc2,null))[_0xc357('0x25')](handleError(_0x3f4dc2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c2a1d75..8738d94 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 _0xedb5=['api','bluebird','request-promise','path','rimraf','exports','lodash','util'];(function(_0x57cac3,_0x4817d0){var _0x4224a8=function(_0x32fd62){while(--_0x32fd62){_0x57cac3['push'](_0x57cac3['shift']());}};_0x4224a8(++_0x4817d0);}(_0xedb5,0xee));var _0x5edb=function(_0x2b2087,_0x53c90b){_0x2b2087=_0x2b2087-0x0;var _0x195657=_0xedb5[_0x2b2087];return _0x195657;};'use strict';var _=require(_0x5edb('0x0'));var util=require(_0x5edb('0x1'));var logger=require('../../config/logger')(_0x5edb('0x2'));var moment=require('moment');var BPromise=require(_0x5edb('0x3'));var rp=require(_0x5edb('0x4'));var fs=require('fs');var path=require(_0x5edb('0x5'));var rimraf=require(_0x5edb('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x5edb('0x7')]=function(_0x4bdbfa,_0x5358ad){return _0x4bdbfa['define']('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa415=['rimraf','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','path'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xa415,0x73));var _0x5a41=function(_0x4c2b30,_0x52ff82){_0x4c2b30=_0x4c2b30-0x0;var _0x4b3955=_0xa415[_0x4c2b30];return _0x4b3955;};'use strict';var _=require(_0x5a41('0x0'));var util=require(_0x5a41('0x1'));var logger=require('../../config/logger')(_0x5a41('0x2'));var moment=require(_0x5a41('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a41('0x4'));var rimraf=require(_0x5a41('0x5'));var config=require('../../config/environment');var attributes=require(_0x5a41('0x6'));module['exports']=function(_0x1adf1a,_0x519007){return _0x1adf1a[_0x5a41('0x7')](_0x5a41('0x8'),attributes,{'tableName':_0x5a41('0x9'),'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 f12a342..5146101 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 _0x0427=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3b45d7,_0xbc2848){var _0x4690e8=function(_0x209c3b){while(--_0x209c3b){_0x3b45d7['push'](_0x3b45d7['shift']());}};_0x4690e8(++_0xbc2848);}(_0x0427,0x137));var _0x7042=function(_0xda8ea8,_0x577f75){_0xda8ea8=_0xda8ea8-0x0;var _0xe7aa47=_0x0427[_0xda8ea8];return _0xe7aa47;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7042('0x0'));var BPromise=require(_0x7042('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7042('0x2'));var db=require(_0x7042('0x3'))['db'];var utils=require(_0x7042('0x4'));var logger=require(_0x7042('0x5'))(_0x7042('0x6'));var config=require(_0x7042('0x7'));var jayson=require(_0x7042('0x8'));var client=jayson['client'][_0x7042('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f24b5,_0x25c552,_0x346aa8){return new BPromise(function(_0x295b19,_0x978169){return client[_0x7042('0xa')](_0x2f24b5,_0x346aa8)[_0x7042('0xb')](function(_0x3bd534){logger['info'](_0x7042('0xc'),_0x25c552,'request\x20sent');logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x25c552,'request\x20sent',JSON[_0x7042('0xd')](_0x3bd534));if(_0x3bd534['error']){if(_0x3bd534[_0x7042('0xe')][_0x7042('0xf')]===0x1f4){logger[_0x7042('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x25c552,_0x3bd534['error'][_0x7042('0x10')]);return _0x978169(_0x3bd534[_0x7042('0xe')][_0x7042('0x10')]);}logger[_0x7042('0xe')](_0x7042('0xc'),_0x25c552,_0x3bd534[_0x7042('0xe')]['message']);return _0x295b19(_0x3bd534[_0x7042('0xe')][_0x7042('0x10')]);}else{logger[_0x7042('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x25c552,_0x7042('0x12'));_0x295b19(_0x3bd534[_0x7042('0x13')]['message']);}})[_0x7042('0x14')](function(_0x590edd){logger['error'](_0x7042('0xc'),_0x25c552,_0x590edd);_0x978169(_0x590edd);});});} \ No newline at end of file +var _0x3ce4=['../../config/environment','jayson/promise','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x148316,_0x6c9dc){var _0xdbe95d=function(_0x138a9f){while(--_0x138a9f){_0x148316['push'](_0x148316['shift']());}};_0xdbe95d(++_0x6c9dc);}(_0x3ce4,0xcb));var _0x43ce=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x3ce4[_0x1147ab];return _0x55cb5a;};'use strict';var _=require(_0x43ce('0x0'));var util=require('util');var moment=require(_0x43ce('0x1'));var BPromise=require('bluebird');var rs=require(_0x43ce('0x2'));var fs=require('fs');var Redis=require(_0x43ce('0x3'));var db=require(_0x43ce('0x4'))['db'];var utils=require(_0x43ce('0x5'));var logger=require(_0x43ce('0x6'))('rpc');var config=require(_0x43ce('0x7'));var jayson=require(_0x43ce('0x8'));var client=jayson['client'][_0x43ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51e29b,_0x1f93c9,_0x2fd0e2){return new BPromise(function(_0x189654,_0x20c136){return client['request'](_0x51e29b,_0x2fd0e2)[_0x43ce('0xa')](function(_0x13dbc6){logger[_0x43ce('0xb')](_0x43ce('0xc'),_0x1f93c9,_0x43ce('0xd'));logger[_0x43ce('0xe')](_0x43ce('0xf'),_0x1f93c9,_0x43ce('0xd'),JSON['stringify'](_0x13dbc6));if(_0x13dbc6[_0x43ce('0x10')]){if(_0x13dbc6['error'][_0x43ce('0x11')]===0x1f4){logger[_0x43ce('0x10')](_0x43ce('0xc'),_0x1f93c9,_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);return _0x20c136(_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);}logger['error'](_0x43ce('0xc'),_0x1f93c9,_0x13dbc6['error'][_0x43ce('0x12')]);return _0x189654(_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);}else{logger['info'](_0x43ce('0xc'),_0x1f93c9,_0x43ce('0xd'));_0x189654(_0x13dbc6[_0x43ce('0x13')][_0x43ce('0x12')]);}})[_0x43ce('0x14')](function(_0x34b84b){logger[_0x43ce('0x10')](_0x43ce('0xc'),_0x1f93c9,_0x34b84b);_0x20c136(_0x34b84b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 80a2ca4..a70b876 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 _0x4d40=['create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0x4d40,0x175));var _0x04d4=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x4d40[_0x5c4585];return _0x21dede;};'use strict';var multer=require(_0x04d4('0x0'));var util=require('util');var path=require(_0x04d4('0x1'));var timeout=require(_0x04d4('0x2'));var express=require(_0x04d4('0x3'));var router=express[_0x04d4('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x04d4('0x5'));var controller=require(_0x04d4('0x6'));router[_0x04d4('0x7')]('/',auth[_0x04d4('0x8')](),controller[_0x04d4('0x9')]);router['get'](_0x04d4('0xa'),auth[_0x04d4('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x04d4('0xb')]);router[_0x04d4('0xc')](_0x04d4('0xa'),auth[_0x04d4('0x8')](),controller[_0x04d4('0xd')]);router[_0x04d4('0xe')](_0x04d4('0xa'),auth['isAuthenticated'](),controller[_0x04d4('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4066=['delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','show','put','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4066,0xb3));var _0x6406=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4066[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x6406('0x0'));var util=require('util');var path=require(_0x6406('0x1'));var timeout=require(_0x6406('0x2'));var express=require('express');var router=express[_0x6406('0x3')]();var auth=require(_0x6406('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6406('0x5'));var controller=require(_0x6406('0x6'));router['get']('/',auth[_0x6406('0x7')](),controller[_0x6406('0x8')]);router[_0x6406('0x9')]('/:id',auth[_0x6406('0x7')](),controller[_0x6406('0xa')]);router['post']('/',auth[_0x6406('0x7')](),controller['create']);router[_0x6406('0xb')](_0x6406('0xc'),auth[_0x6406('0x7')](),controller['update']);router[_0x6406('0xd')](_0x6406('0xc'),auth['isAuthenticated'](),controller[_0x6406('0xe')]);module[_0x6406('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 6d5a5c4..e8406de 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 _0x82f4=['string','variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x41382c,_0xc3ffd1){var _0x4da35b=function(_0x5d56b8){while(--_0x5d56b8){_0x41382c['push'](_0x41382c['shift']());}};_0x4da35b(++_0xc3ffd1);}(_0x82f4,0xed));var _0x482f=function(_0x5cd054,_0x2d3b5d){_0x5cd054=_0x5cd054-0x0;var _0x5a9331=_0x82f4[_0x5cd054];return _0x5a9331;};'use strict';var Sequelize=require(_0x482f('0x0'));module[_0x482f('0x1')]={'type':{'type':Sequelize[_0x482f('0x2')](_0x482f('0x3'),_0x482f('0x4'),_0x482f('0x5'),'keyValue'),'defaultValue':_0x482f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x482f('0x2')]('string','variable',_0x482f('0x5'))},'keyContent':{'type':Sequelize[_0x482f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x482f('0x6')]},'customField':{'type':Sequelize[_0x482f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x482f('0x6')]}}; \ No newline at end of file +var _0x03fe=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x5ce233,_0x1313df){var _0xfdfd2e=function(_0x3dac4a){while(--_0x3dac4a){_0x5ce233['push'](_0x5ce233['shift']());}};_0xfdfd2e(++_0x1313df);}(_0x03fe,0x73));var _0xe03f=function(_0x585b8c,_0x4135bc){_0x585b8c=_0x585b8c-0x0;var _0x55b8b5=_0x03fe[_0x585b8c];return _0x55b8b5;};'use strict';var Sequelize=require(_0xe03f('0x0'));module[_0xe03f('0x1')]={'type':{'type':Sequelize[_0xe03f('0x2')](_0xe03f('0x3'),'variable',_0xe03f('0x4'),_0xe03f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe03f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xe03f('0x3'),_0xe03f('0x7'),_0xe03f('0x4'))},'keyContent':{'type':Sequelize[_0xe03f('0x6')]},'idField':{'type':Sequelize[_0xe03f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe03f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe03f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 2989464..60df120 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 _0x7ceb=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0x7ceb,0x81));var _0xb7ce=function(_0x14cd5f,_0x3d80b0){_0x14cd5f=_0x14cd5f-0x0;var _0x2c97a5=_0x7ceb[_0x14cd5f];return _0x2c97a5;};'use strict';var pdf=require(_0xb7ce('0x0'));var emlformat=require(_0xb7ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb7ce('0x2'));var jsonpatch=require(_0xb7ce('0x3'));var rp=require(_0xb7ce('0x4'));var moment=require(_0xb7ce('0x5'));var BPromise=require(_0xb7ce('0x6'));var Mustache=require(_0xb7ce('0x7'));var util=require(_0xb7ce('0x8'));var path=require('path');var sox=require(_0xb7ce('0x9'));var csv=require(_0xb7ce('0xa'));var ejs=require(_0xb7ce('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb7ce('0xc'));var crypto=require(_0xb7ce('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb7ce('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb7ce('0xf'));var Redis=require(_0xb7ce('0x10'));var authService=require(_0xb7ce('0x11'));var qs=require(_0xb7ce('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7ce('0x13'))(_0xb7ce('0x14'));var utils=require(_0xb7ce('0x15'));var config=require(_0xb7ce('0x16'));var db=require(_0xb7ce('0x17'))['db'];function respondWithStatusCode(_0x5105fc,_0x1bb841){_0x1bb841=_0x1bb841||0xcc;return function(_0x56c83f){if(_0x56c83f){return _0x5105fc['sendStatus'](_0x1bb841);}return _0x5105fc['status'](_0x1bb841)[_0xb7ce('0x18')]();};}function respondWithResult(_0x4f83e7,_0x4ef0c4){_0x4ef0c4=_0x4ef0c4||0xc8;return function(_0x308a31){if(_0x308a31){return _0x4f83e7[_0xb7ce('0x19')](_0x4ef0c4)[_0xb7ce('0x1a')](_0x308a31);}};}function respondWithFilteredResult(_0x294972,_0x144881){return function(_0x277d54){if(_0x277d54){var _0x3d86ee=_0x277d54[_0xb7ce('0x1b')],_0x5c05fd=_0x144881[_0xb7ce('0x1c')],_0x521ad0=_0x144881[_0xb7ce('0x1c')]+_0x144881[_0xb7ce('0x1d')],_0x456599;if(_0x521ad0>=_0x3d86ee){_0x521ad0=_0x3d86ee;_0x456599=0xc8;}else{_0x456599=0xce;}_0x294972['status'](_0x456599);return _0x294972[_0xb7ce('0x1e')](_0xb7ce('0x1f'),_0x5c05fd+'-'+_0x521ad0+'/'+_0x3d86ee)[_0xb7ce('0x1a')](_0x277d54);}return null;};}function patchUpdates(_0x20046b){return function(_0x3a94bb){try{jsonpatch[_0xb7ce('0x20')](_0x3a94bb,_0x20046b,!![]);}catch(_0x1d0522){return BPromise['reject'](_0x1d0522);}return _0x3a94bb[_0xb7ce('0x21')]();};}function saveUpdates(_0x374c40,_0x2a6040){return function(_0xe86080){if(_0xe86080){return _0xe86080[_0xb7ce('0x22')](_0x374c40)[_0xb7ce('0x23')](function(_0xeed27c){return _0xeed27c;});}return null;};}function removeEntity(_0x12040b,_0x21c0f0){return function(_0x27be4f){if(_0x27be4f){return _0x27be4f[_0xb7ce('0x24')]()['then'](function(){_0x12040b[_0xb7ce('0x19')](0xcc)[_0xb7ce('0x18')]();});}};}function handleEntityNotFound(_0x3bb0c9,_0x36317b){return function(_0x745cf8){if(!_0x745cf8){_0x3bb0c9[_0xb7ce('0x25')](0x194);}return _0x745cf8;};}function handleError(_0x1f0af3,_0x1a1fc9){_0x1a1fc9=_0x1a1fc9||0x1f4;return function(_0x3512f7){logger[_0xb7ce('0x26')](_0x3512f7[_0xb7ce('0x27')]);if(_0x3512f7['name']){delete _0x3512f7[_0xb7ce('0x28')];}_0x1f0af3[_0xb7ce('0x19')](_0x1a1fc9)['send'](_0x3512f7);};}exports[_0xb7ce('0x29')]=function(_0x166e5e,_0x4dcf87){var _0x530be1={},_0x10256f={},_0x2d6a60={'count':0x0,'rows':[]};var _0x15b06d=_[_0xb7ce('0x2a')](db[_0xb7ce('0x2b')][_0xb7ce('0x2c')],function(_0x24808b){return{'name':_0x24808b[_0xb7ce('0x2d')],'type':_0x24808b[_0xb7ce('0x2e')][_0xb7ce('0x2f')]};});_0x10256f[_0xb7ce('0x30')]=_[_0xb7ce('0x2a')](_0x15b06d,_0xb7ce('0x28'));_0x10256f['query']=_[_0xb7ce('0x31')](_0x166e5e['query']);_0x10256f[_0xb7ce('0x32')]=_['intersection'](_0x10256f[_0xb7ce('0x30')],_0x10256f[_0xb7ce('0x33')]);_0x530be1['attributes']=_[_0xb7ce('0x34')](_0x10256f[_0xb7ce('0x30')],qs[_0xb7ce('0x35')](_0x166e5e[_0xb7ce('0x33')][_0xb7ce('0x35')]));_0x530be1[_0xb7ce('0x36')]=_0x530be1['attributes'][_0xb7ce('0x37')]?_0x530be1[_0xb7ce('0x36')]:_0x10256f[_0xb7ce('0x30')];if(!_0x166e5e[_0xb7ce('0x33')][_0xb7ce('0x38')](_0xb7ce('0x39'))){_0x530be1['limit']=qs['limit'](_0x166e5e[_0xb7ce('0x33')][_0xb7ce('0x1d')]);_0x530be1[_0xb7ce('0x1c')]=qs[_0xb7ce('0x1c')](_0x166e5e[_0xb7ce('0x33')][_0xb7ce('0x1c')]);}_0x530be1[_0xb7ce('0x3a')]=qs[_0xb7ce('0x3b')](_0x166e5e[_0xb7ce('0x33')]['sort']);_0x530be1[_0xb7ce('0x3c')]=qs[_0xb7ce('0x32')](_[_0xb7ce('0x3d')](_0x166e5e[_0xb7ce('0x33')],_0x10256f['filters']),_0x15b06d);if(_0x166e5e[_0xb7ce('0x33')][_0xb7ce('0x3e')]){_0x530be1[_0xb7ce('0x3c')]=_[_0xb7ce('0x3f')](_0x530be1[_0xb7ce('0x3c')],{'$or':_[_0xb7ce('0x2a')](_0x15b06d,function(_0x30c0ad){if(_0x30c0ad[_0xb7ce('0x2e')]!==_0xb7ce('0x40')){var _0x4a6c78={};_0x4a6c78[_0x30c0ad['name']]={'$like':'%'+_0x166e5e[_0xb7ce('0x33')][_0xb7ce('0x3e')]+'%'};return _0x4a6c78;}})});}_0x530be1=_[_0xb7ce('0x3f')]({},_0x530be1,_0x166e5e[_0xb7ce('0x41')]);var _0x153798={'where':_0x530be1[_0xb7ce('0x3c')]};return db[_0xb7ce('0x2b')][_0xb7ce('0x1b')](_0x153798)[_0xb7ce('0x23')](function(_0x2a305d){_0x2d6a60[_0xb7ce('0x1b')]=_0x2a305d;if(_0x166e5e[_0xb7ce('0x33')][_0xb7ce('0x42')]){_0x530be1[_0xb7ce('0x43')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x530be1);})[_0xb7ce('0x23')](function(_0x5dc118){_0x2d6a60['rows']=_0x5dc118;return _0x2d6a60;})[_0xb7ce('0x23')](respondWithFilteredResult(_0x4dcf87,_0x530be1))[_0xb7ce('0x44')](handleError(_0x4dcf87,null));};exports['show']=function(_0x429e49,_0x4fd14a){var _0x3ffe2d={'raw':!![],'where':{'id':_0x429e49['params']['id']}},_0x195a7e={};_0x195a7e[_0xb7ce('0x30')]=_[_0xb7ce('0x31')](db[_0xb7ce('0x2b')]['rawAttributes']);_0x195a7e['query']=_[_0xb7ce('0x31')](_0x429e49[_0xb7ce('0x33')]);_0x195a7e['filters']=_[_0xb7ce('0x34')](_0x195a7e[_0xb7ce('0x30')],_0x195a7e[_0xb7ce('0x33')]);_0x3ffe2d['attributes']=_[_0xb7ce('0x34')](_0x195a7e['model'],qs[_0xb7ce('0x35')](_0x429e49[_0xb7ce('0x33')][_0xb7ce('0x35')]));_0x3ffe2d[_0xb7ce('0x36')]=_0x3ffe2d['attributes'][_0xb7ce('0x37')]?_0x3ffe2d['attributes']:_0x195a7e['model'];if(_0x429e49[_0xb7ce('0x33')][_0xb7ce('0x42')]){_0x3ffe2d[_0xb7ce('0x43')]=[{'all':!![]}];}_0x3ffe2d=_[_0xb7ce('0x3f')]({},_0x3ffe2d,_0x429e49[_0xb7ce('0x41')]);return db['FreshsalesField'][_0xb7ce('0x45')](_0x3ffe2d)['then'](handleEntityNotFound(_0x4fd14a,null))[_0xb7ce('0x23')](respondWithResult(_0x4fd14a,null))[_0xb7ce('0x44')](handleError(_0x4fd14a,null));};exports[_0xb7ce('0x46')]=function(_0x4f3b89,_0x5babe2){return db[_0xb7ce('0x2b')][_0xb7ce('0x46')](_0x4f3b89[_0xb7ce('0x47')],{})[_0xb7ce('0x23')](respondWithResult(_0x5babe2,0xc9))[_0xb7ce('0x44')](handleError(_0x5babe2,null));};exports[_0xb7ce('0x22')]=function(_0x2f11d0,_0x1be689){if(_0x2f11d0[_0xb7ce('0x47')]['id']){delete _0x2f11d0['body']['id'];}return db[_0xb7ce('0x2b')][_0xb7ce('0x45')]({'where':{'id':_0x2f11d0['params']['id']}})[_0xb7ce('0x23')](handleEntityNotFound(_0x1be689,null))['then'](saveUpdates(_0x2f11d0['body'],null))[_0xb7ce('0x23')](respondWithResult(_0x1be689,null))['catch'](handleError(_0x1be689,null));};exports[_0xb7ce('0x24')]=function(_0xf6cb13,_0x27408c){return db[_0xb7ce('0x2b')][_0xb7ce('0x45')]({'where':{'id':_0xf6cb13[_0xb7ce('0x48')]['id']}})['then'](handleEntityNotFound(_0x27408c,null))[_0xb7ce('0x23')](removeEntity(_0x27408c,null))['catch'](handleError(_0x27408c,null));}; \ No newline at end of file +var _0x44aa=['reject','save','update','then','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x44aa,0x188));var _0xa44a=function(_0x23ffd2,_0x5a1367){_0x23ffd2=_0x23ffd2-0x0;var _0x167a6f=_0x44aa[_0x23ffd2];return _0x167a6f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa44a('0x0'));var rimraf=require(_0xa44a('0x1'));var zipdir=require(_0xa44a('0x2'));var jsonpatch=require(_0xa44a('0x3'));var rp=require(_0xa44a('0x4'));var moment=require(_0xa44a('0x5'));var BPromise=require(_0xa44a('0x6'));var Mustache=require(_0xa44a('0x7'));var util=require(_0xa44a('0x8'));var path=require(_0xa44a('0x9'));var sox=require(_0xa44a('0xa'));var csv=require('to-csv');var ejs=require(_0xa44a('0xb'));var fs=require('fs');var _=require(_0xa44a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa44a('0xd'));var deskjs=require(_0xa44a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa44a('0xf'));var Papa=require(_0xa44a('0x10'));var Redis=require(_0xa44a('0x11'));var authService=require(_0xa44a('0x12'));var qs=require(_0xa44a('0x13'));var as=require(_0xa44a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa44a('0x15'));var utils=require(_0xa44a('0x16'));var config=require(_0xa44a('0x17'));var db=require(_0xa44a('0x18'))['db'];function respondWithStatusCode(_0x18734e,_0x50bd67){_0x50bd67=_0x50bd67||0xcc;return function(_0x394141){if(_0x394141){return _0x18734e[_0xa44a('0x19')](_0x50bd67);}return _0x18734e['status'](_0x50bd67)[_0xa44a('0x1a')]();};}function respondWithResult(_0x47a6e6,_0x1541b8){_0x1541b8=_0x1541b8||0xc8;return function(_0x33a9d8){if(_0x33a9d8){return _0x47a6e6[_0xa44a('0x1b')](_0x1541b8)[_0xa44a('0x1c')](_0x33a9d8);}};}function respondWithFilteredResult(_0x215d0a,_0x48562e){return function(_0x25d601){if(_0x25d601){var _0x17bbb4=_0x25d601[_0xa44a('0x1d')],_0x1d11ee=_0x48562e[_0xa44a('0x1e')],_0x282b30=_0x48562e[_0xa44a('0x1e')]+_0x48562e[_0xa44a('0x1f')],_0x12a726;if(_0x282b30>=_0x17bbb4){_0x282b30=_0x17bbb4;_0x12a726=0xc8;}else{_0x12a726=0xce;}_0x215d0a[_0xa44a('0x1b')](_0x12a726);return _0x215d0a['set'](_0xa44a('0x20'),_0x1d11ee+'-'+_0x282b30+'/'+_0x17bbb4)[_0xa44a('0x1c')](_0x25d601);}return null;};}function patchUpdates(_0x1592e0){return function(_0x232b1d){try{jsonpatch[_0xa44a('0x21')](_0x232b1d,_0x1592e0,!![]);}catch(_0x2c60f2){return BPromise[_0xa44a('0x22')](_0x2c60f2);}return _0x232b1d[_0xa44a('0x23')]();};}function saveUpdates(_0x25a9bd,_0xa24915){return function(_0x242db5){if(_0x242db5){return _0x242db5[_0xa44a('0x24')](_0x25a9bd)[_0xa44a('0x25')](function(_0x293a45){return _0x293a45;});}return null;};}function removeEntity(_0x224dd6,_0x42533a){return function(_0x3751dc){if(_0x3751dc){return _0x3751dc['destroy']()['then'](function(){_0x224dd6[_0xa44a('0x1b')](0xcc)[_0xa44a('0x1a')]();});}};}function handleEntityNotFound(_0x5eaf60,_0x5ab963){return function(_0x52df38){if(!_0x52df38){_0x5eaf60[_0xa44a('0x19')](0x194);}return _0x52df38;};}function handleError(_0x1ec217,_0x1a1829){_0x1a1829=_0x1a1829||0x1f4;return function(_0x190c54){logger['error'](_0x190c54[_0xa44a('0x26')]);if(_0x190c54[_0xa44a('0x27')]){delete _0x190c54[_0xa44a('0x27')];}_0x1ec217[_0xa44a('0x1b')](_0x1a1829)[_0xa44a('0x28')](_0x190c54);};}exports[_0xa44a('0x29')]=function(_0x3c307c,_0x192919){var _0x532704={},_0x1d799b={},_0x23fe7a={'count':0x0,'rows':[]};var _0x40be99=_['map'](db[_0xa44a('0x2a')][_0xa44a('0x2b')],function(_0x452abe){return{'name':_0x452abe[_0xa44a('0x2c')],'type':_0x452abe[_0xa44a('0x2d')][_0xa44a('0x2e')]};});_0x1d799b[_0xa44a('0x2f')]=_[_0xa44a('0x30')](_0x40be99,_0xa44a('0x27'));_0x1d799b[_0xa44a('0x31')]=_[_0xa44a('0x32')](_0x3c307c['query']);_0x1d799b[_0xa44a('0x33')]=_[_0xa44a('0x34')](_0x1d799b['model'],_0x1d799b[_0xa44a('0x31')]);_0x532704[_0xa44a('0x35')]=_[_0xa44a('0x34')](_0x1d799b[_0xa44a('0x2f')],qs['fields'](_0x3c307c[_0xa44a('0x31')][_0xa44a('0x36')]));_0x532704[_0xa44a('0x35')]=_0x532704[_0xa44a('0x35')][_0xa44a('0x37')]?_0x532704[_0xa44a('0x35')]:_0x1d799b['model'];if(!_0x3c307c[_0xa44a('0x31')]['hasOwnProperty']('nolimit')){_0x532704[_0xa44a('0x1f')]=qs[_0xa44a('0x1f')](_0x3c307c[_0xa44a('0x31')][_0xa44a('0x1f')]);_0x532704[_0xa44a('0x1e')]=qs[_0xa44a('0x1e')](_0x3c307c[_0xa44a('0x31')][_0xa44a('0x1e')]);}_0x532704[_0xa44a('0x38')]=qs[_0xa44a('0x39')](_0x3c307c[_0xa44a('0x31')][_0xa44a('0x39')]);_0x532704[_0xa44a('0x3a')]=qs[_0xa44a('0x33')](_['pick'](_0x3c307c[_0xa44a('0x31')],_0x1d799b[_0xa44a('0x33')]),_0x40be99);if(_0x3c307c[_0xa44a('0x31')][_0xa44a('0x3b')]){_0x532704[_0xa44a('0x3a')]=_[_0xa44a('0x3c')](_0x532704[_0xa44a('0x3a')],{'$or':_[_0xa44a('0x30')](_0x40be99,function(_0x1db9f9){if(_0x1db9f9['type']!==_0xa44a('0x3d')){var _0xaf9208={};_0xaf9208[_0x1db9f9[_0xa44a('0x27')]]={'$like':'%'+_0x3c307c['query'][_0xa44a('0x3b')]+'%'};return _0xaf9208;}})});}_0x532704=_[_0xa44a('0x3c')]({},_0x532704,_0x3c307c[_0xa44a('0x3e')]);var _0x32ac0f={'where':_0x532704[_0xa44a('0x3a')]};return db[_0xa44a('0x2a')][_0xa44a('0x1d')](_0x32ac0f)[_0xa44a('0x25')](function(_0x5a63fc){_0x23fe7a[_0xa44a('0x1d')]=_0x5a63fc;if(_0x3c307c[_0xa44a('0x31')][_0xa44a('0x3f')]){_0x532704['include']=[{'all':!![]}];}return db[_0xa44a('0x2a')]['findAll'](_0x532704);})['then'](function(_0x5ae83e){_0x23fe7a[_0xa44a('0x40')]=_0x5ae83e;return _0x23fe7a;})[_0xa44a('0x25')](respondWithFilteredResult(_0x192919,_0x532704))[_0xa44a('0x41')](handleError(_0x192919,null));};exports['show']=function(_0x2467be,_0x5a9bfe){var _0x270291={'raw':!![],'where':{'id':_0x2467be[_0xa44a('0x42')]['id']}},_0x8b9bb4={};_0x8b9bb4[_0xa44a('0x2f')]=_[_0xa44a('0x32')](db[_0xa44a('0x2a')]['rawAttributes']);_0x8b9bb4[_0xa44a('0x31')]=_['keys'](_0x2467be['query']);_0x8b9bb4[_0xa44a('0x33')]=_[_0xa44a('0x34')](_0x8b9bb4[_0xa44a('0x2f')],_0x8b9bb4[_0xa44a('0x31')]);_0x270291[_0xa44a('0x35')]=_[_0xa44a('0x34')](_0x8b9bb4[_0xa44a('0x2f')],qs[_0xa44a('0x36')](_0x2467be[_0xa44a('0x31')][_0xa44a('0x36')]));_0x270291[_0xa44a('0x35')]=_0x270291[_0xa44a('0x35')][_0xa44a('0x37')]?_0x270291[_0xa44a('0x35')]:_0x8b9bb4[_0xa44a('0x2f')];if(_0x2467be[_0xa44a('0x31')][_0xa44a('0x3f')]){_0x270291[_0xa44a('0x43')]=[{'all':!![]}];}_0x270291=_[_0xa44a('0x3c')]({},_0x270291,_0x2467be[_0xa44a('0x3e')]);return db[_0xa44a('0x2a')][_0xa44a('0x44')](_0x270291)['then'](handleEntityNotFound(_0x5a9bfe,null))[_0xa44a('0x25')](respondWithResult(_0x5a9bfe,null))[_0xa44a('0x41')](handleError(_0x5a9bfe,null));};exports['create']=function(_0x2e75fc,_0x2ddb91){return db['FreshsalesField'][_0xa44a('0x45')](_0x2e75fc[_0xa44a('0x46')],{})[_0xa44a('0x25')](respondWithResult(_0x2ddb91,0xc9))[_0xa44a('0x41')](handleError(_0x2ddb91,null));};exports[_0xa44a('0x24')]=function(_0x6bafe1,_0x4fa7d1){if(_0x6bafe1[_0xa44a('0x46')]['id']){delete _0x6bafe1[_0xa44a('0x46')]['id'];}return db['FreshsalesField'][_0xa44a('0x44')]({'where':{'id':_0x6bafe1[_0xa44a('0x42')]['id']}})[_0xa44a('0x25')](handleEntityNotFound(_0x4fa7d1,null))[_0xa44a('0x25')](saveUpdates(_0x6bafe1['body'],null))['then'](respondWithResult(_0x4fa7d1,null))[_0xa44a('0x41')](handleError(_0x4fa7d1,null));};exports['destroy']=function(_0x792506,_0x4cc981){return db[_0xa44a('0x2a')][_0xa44a('0x44')]({'where':{'id':_0x792506[_0xa44a('0x42')]['id']}})['then'](handleEntityNotFound(_0x4cc981,null))[_0xa44a('0x25')](removeEntity(_0x4cc981,null))[_0xa44a('0x41')](handleError(_0x4cc981,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7c7416f..0ff0d9f 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 _0x1ecd=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','moment','bluebird','request-promise','path'];(function(_0x2c4eac,_0x1ef29e){var _0x3ed661=function(_0x3c4e5a){while(--_0x3c4e5a){_0x2c4eac['push'](_0x2c4eac['shift']());}};_0x3ed661(++_0x1ef29e);}(_0x1ecd,0x126));var _0xd1ec=function(_0x4b1eda,_0x1ca265){_0x4b1eda=_0x4b1eda-0x0;var _0x520e6b=_0x1ecd[_0x4b1eda];return _0x520e6b;};'use strict';var _=require(_0xd1ec('0x0'));var util=require(_0xd1ec('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd1ec('0x2'));var BPromise=require(_0xd1ec('0x3'));var rp=require(_0xd1ec('0x4'));var fs=require('fs');var path=require(_0xd1ec('0x5'));var rimraf=require(_0xd1ec('0x6'));var config=require(_0xd1ec('0x7'));var attributes=require(_0xd1ec('0x8'));module[_0xd1ec('0x9')]=function(_0x535094,_0x3052ed){return _0x535094[_0xd1ec('0xa')](_0xd1ec('0xb'),attributes,{'tableName':_0xd1ec('0xc'),'paranoid':![],'indexes':[{'name':_0xd1ec('0xd'),'fields':[_0xd1ec('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d69=['exports','define','FieldId','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes'];(function(_0x175ed9,_0x4c4e86){var _0x386f03=function(_0x346ccd){while(--_0x346ccd){_0x175ed9['push'](_0x175ed9['shift']());}};_0x386f03(++_0x4c4e86);}(_0x3d69,0xd5));var _0x93d6=function(_0xd1197a,_0x2182a2){_0xd1197a=_0xd1197a-0x0;var _0x97c7bb=_0x3d69[_0xd1197a];return _0x97c7bb;};'use strict';var _=require(_0x93d6('0x0'));var util=require('util');var logger=require(_0x93d6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x93d6('0x2'));var rp=require(_0x93d6('0x3'));var fs=require('fs');var path=require(_0x93d6('0x4'));var rimraf=require(_0x93d6('0x5'));var config=require('../../config/environment');var attributes=require(_0x93d6('0x6'));module[_0x93d6('0x7')]=function(_0x51d441,_0x49f4a9){return _0x51d441[_0x93d6('0x8')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x93d6('0x9')],'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 1145bce..35d56ea 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 _0xf03e=['../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x382500,_0x43e04e){var _0x4aa842=function(_0x22c871){while(--_0x22c871){_0x382500['push'](_0x382500['shift']());}};_0x4aa842(++_0x43e04e);}(_0xf03e,0x129));var _0xef03=function(_0x181972,_0x3df406){_0x181972=_0x181972-0x0;var _0x3ac138=_0xf03e[_0x181972];return _0x3ac138;};'use strict';var _=require(_0xef03('0x0'));var util=require(_0xef03('0x1'));var moment=require(_0xef03('0x2'));var BPromise=require(_0xef03('0x3'));var rs=require(_0xef03('0x4'));var fs=require('fs');var Redis=require(_0xef03('0x5'));var db=require(_0xef03('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xef03('0x7'))(_0xef03('0x8'));var config=require('../../config/environment');var jayson=require(_0xef03('0x9'));var client=jayson['client'][_0xef03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26191c,_0x1e2010,_0x695598){return new BPromise(function(_0xd9c95d,_0x4fe7cb){return client[_0xef03('0xb')](_0x26191c,_0x695598)[_0xef03('0xc')](function(_0xeaa0e4){logger[_0xef03('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x1e2010,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1e2010,_0xef03('0xe'),JSON['stringify'](_0xeaa0e4));if(_0xeaa0e4[_0xef03('0xf')]){if(_0xeaa0e4['error']['code']===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x1e2010,_0xeaa0e4[_0xef03('0xf')][_0xef03('0x10')]);return _0x4fe7cb(_0xeaa0e4[_0xef03('0xf')][_0xef03('0x10')]);}logger[_0xef03('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x1e2010,_0xeaa0e4[_0xef03('0xf')]['message']);return _0xd9c95d(_0xeaa0e4[_0xef03('0xf')][_0xef03('0x10')]);}else{logger[_0xef03('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x1e2010,'request\x20sent');_0xd9c95d(_0xeaa0e4[_0xef03('0x11')]['message']);}})[_0xef03('0x12')](function(_0x34fc6a){logger[_0xef03('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x1e2010,_0x34fc6a);_0x4fe7cb(_0x34fc6a);});});} \ No newline at end of file +var _0xf9fa=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0xf9fa,0x1b6));var _0xaf9f=function(_0x2989cd,_0x288115){_0x2989cd=_0x2989cd-0x0;var _0x274a8c=_0xf9fa[_0x2989cd];return _0x274a8c;};'use strict';var _=require(_0xaf9f('0x0'));var util=require(_0xaf9f('0x1'));var moment=require(_0xaf9f('0x2'));var BPromise=require(_0xaf9f('0x3'));var rs=require(_0xaf9f('0x4'));var fs=require('fs');var Redis=require(_0xaf9f('0x5'));var db=require(_0xaf9f('0x6'))['db'];var utils=require(_0xaf9f('0x7'));var logger=require('../../config/logger')(_0xaf9f('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf9f('0x9'));var client=jayson[_0xaf9f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235929,_0x278885,_0x332d58){return new BPromise(function(_0x48b0c1,_0x52d695){return client[_0xaf9f('0xb')](_0x235929,_0x332d58)[_0xaf9f('0xc')](function(_0x560b46){logger[_0xaf9f('0xd')](_0xaf9f('0xe'),_0x278885,_0xaf9f('0xf'));logger[_0xaf9f('0x10')](_0xaf9f('0x11'),_0x278885,_0xaf9f('0xf'),JSON[_0xaf9f('0x12')](_0x560b46));if(_0x560b46[_0xaf9f('0x13')]){if(_0x560b46['error'][_0xaf9f('0x14')]===0x1f4){logger[_0xaf9f('0x13')](_0xaf9f('0xe'),_0x278885,_0x560b46['error'][_0xaf9f('0x15')]);return _0x52d695(_0x560b46['error'][_0xaf9f('0x15')]);}logger[_0xaf9f('0x13')](_0xaf9f('0xe'),_0x278885,_0x560b46[_0xaf9f('0x13')][_0xaf9f('0x15')]);return _0x48b0c1(_0x560b46[_0xaf9f('0x13')][_0xaf9f('0x15')]);}else{logger[_0xaf9f('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x278885,'request\x20sent');_0x48b0c1(_0x560b46[_0xaf9f('0x16')][_0xaf9f('0x15')]);}})['catch'](function(_0x364a29){logger[_0xaf9f('0x13')](_0xaf9f('0xe'),_0x278885,_0x364a29);_0x52d695(_0x364a29);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 6be5df0..3d3ba8e 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 _0x95d9=['/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x95d9,0x8d));var _0x995d=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x95d9[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0x995d('0x0'));var util=require(_0x995d('0x1'));var path=require(_0x995d('0x2'));var timeout=require(_0x995d('0x3'));var express=require(_0x995d('0x4'));var router=express['Router']();var auth=require(_0x995d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x995d('0x6'));router[_0x995d('0x7')]('/',auth[_0x995d('0x8')](),controller[_0x995d('0x9')]);router[_0x995d('0x7')](_0x995d('0xa'),auth[_0x995d('0x8')](),controller[_0x995d('0xb')]);router['get']('/:id/configurations',auth[_0x995d('0x8')](),controller[_0x995d('0xc')]);router[_0x995d('0x7')](_0x995d('0xd'),auth[_0x995d('0x8')](),controller[_0x995d('0xe')]);router[_0x995d('0xf')]('/',auth[_0x995d('0x8')](),controller['create']);router['post'](_0x995d('0x10'),auth['isAuthenticated'](),controller[_0x995d('0x11')]);router[_0x995d('0x12')](_0x995d('0xa'),auth[_0x995d('0x8')](),controller[_0x995d('0x13')]);router[_0x995d('0x14')]('/:id',auth[_0x995d('0x8')](),controller['destroy']);module[_0x995d('0x15')]=router; \ No newline at end of file +var _0x6bd9=['index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','../../config/environment','./intSalesforceAccount.controller','get'];(function(_0x3c3b57,_0x5c6241){var _0x630592=function(_0x527535){while(--_0x527535){_0x3c3b57['push'](_0x3c3b57['shift']());}};_0x630592(++_0x5c6241);}(_0x6bd9,0xd5));var _0x96bd=function(_0xb883c3,_0x2f880b){_0xb883c3=_0xb883c3-0x0;var _0x3ed8fb=_0x6bd9[_0xb883c3];return _0x3ed8fb;};'use strict';var multer=require(_0x96bd('0x0'));var util=require(_0x96bd('0x1'));var path=require('path');var timeout=require(_0x96bd('0x2'));var express=require(_0x96bd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96bd('0x4'));var controller=require(_0x96bd('0x5'));router[_0x96bd('0x6')]('/',auth['isAuthenticated'](),controller[_0x96bd('0x7')]);router['get'](_0x96bd('0x8'),auth[_0x96bd('0x9')](),controller[_0x96bd('0xa')]);router['get']('/:id/configurations',auth[_0x96bd('0x9')](),controller[_0x96bd('0xb')]);router[_0x96bd('0x6')](_0x96bd('0xc'),auth[_0x96bd('0x9')](),controller['getFields']);router[_0x96bd('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x96bd('0xd')](_0x96bd('0xe'),auth[_0x96bd('0x9')](),controller[_0x96bd('0xf')]);router[_0x96bd('0x10')](_0x96bd('0x8'),auth['isAuthenticated'](),controller[_0x96bd('0x11')]);router[_0x96bd('0x12')](_0x96bd('0x8'),auth[_0x96bd('0x9')](),controller['destroy']);module[_0x96bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 393f43e..e8719ca 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 _0x9957=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x23276e,_0x5c3144){var _0x40c600=function(_0x6f0b68){while(--_0x6f0b68){_0x23276e['push'](_0x23276e['shift']());}};_0x40c600(++_0x5c3144);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')]},'description':{'type':Sequelize[_0x7995('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x7995('0x3')},'remoteUri':{'type':Sequelize[_0x7995('0x2')]},'password':{'type':Sequelize[_0x7995('0x2')]},'clientId':{'type':Sequelize[_0x7995('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x7995('0x2')]},'serverUrl':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x4')](_0x7995('0x5'),_0x7995('0x6')),'defaultValue':_0x7995('0x5')}}; \ No newline at end of file +var _0x814b=['STRING','username','ENUM','newTab','integrationTab','sequelize','exports'];(function(_0x2a6d8c,_0x19c800){var _0x31a401=function(_0x2bd376){while(--_0x2bd376){_0x2a6d8c['push'](_0x2a6d8c['shift']());}};_0x31a401(++_0x19c800);}(_0x814b,0x1a2));var _0xb814=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x814b[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')]},'description':{'type':Sequelize[_0xb814('0x2')]},'username':{'type':Sequelize[_0xb814('0x2')],'unique':_0xb814('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb814('0x2')]},'clientId':{'type':Sequelize[_0xb814('0x2')]},'clientSecret':{'type':Sequelize[_0xb814('0x2')]},'securityToken':{'type':Sequelize[_0xb814('0x2')]},'serverUrl':{'type':Sequelize[_0xb814('0x2')]},'type':{'type':Sequelize[_0xb814('0x4')]('integrationTab',_0xb814('0x5')),'defaultValue':_0xb814('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c0f7e71..323196a 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 _0x0b5e=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../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','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','SalesforceAccount','keys','query','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','params','rawAttributes','includeAll','find','create','body','getConfigurations','order','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','Task','clientId','clientSecret','username','password','remoteUri','slice','substring','lastIndexOf','Connection','login','concat','securityToken','isNil','ticketType','CallDisposition','CallDurationInSeconds','CallType','Priority','Status','Type','Case','Origin','Reason','IsEscalated','SuppliedCompany','remove','custom','label','picklistValues','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch'];(function(_0x3474ab,_0x4dd8cd){var _0x182bf4=function(_0x35d515){while(--_0x35d515){_0x3474ab['push'](_0x3474ab['shift']());}};_0x182bf4(++_0x4dd8cd);}(_0x0b5e,0x10b));var _0xe0b5=function(_0x384f30,_0x547c8b){_0x384f30=_0x384f30-0x0;var _0x34e315=_0x0b5e[_0x384f30];return _0x34e315;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe0b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b5('0x1'));var jsonpatch=require(_0xe0b5('0x2'));var rp=require('request-promise');var moment=require(_0xe0b5('0x3'));var BPromise=require(_0xe0b5('0x4'));var Mustache=require(_0xe0b5('0x5'));var util=require('util');var path=require(_0xe0b5('0x6'));var sox=require(_0xe0b5('0x7'));var csv=require(_0xe0b5('0x8'));var ejs=require(_0xe0b5('0x9'));var fs=require('fs');var _=require(_0xe0b5('0xa'));var squel=require(_0xe0b5('0xb'));var crypto=require(_0xe0b5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe0b5('0xd'));var Papa=require(_0xe0b5('0xe'));var Redis=require(_0xe0b5('0xf'));var authService=require(_0xe0b5('0x10'));var qs=require(_0xe0b5('0x11'));var as=require(_0xe0b5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0b5('0x13'))(_0xe0b5('0x14'));var utils=require('../../config/utils');var config=require(_0xe0b5('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe0b5('0x16'));var jayson=require('jayson/promise');var client=jayson[_0xe0b5('0x17')][_0xe0b5('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4c9166,_0x57125b,_0x174269){if(_0x174269){var _0x4fc1dd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fc1dd[_0xe0b5('0x19')](_0x57125b)){return _0x4c9166;}else{throw new db[(_0xe0b5('0x1a'))][(_0xe0b5('0x1b'))](_0xe0b5('0x1c'));}}else{return _0x4c9166;}}function respondWithRpcPromise(_0x5ebe18,_0x450d57,_0x316106,_0x3ce8fc){return new BPromise(function(_0x4d56a9,_0x3df6d6){var _0x2803c4=_0x3ce8fc||client;return _0x2803c4[_0xe0b5('0x1d')](_0x5ebe18,_0x316106)[_0xe0b5('0x1e')](function(_0x342f81){logger[_0xe0b5('0x1f')](_0xe0b5('0x20'),_0x450d57,_0xe0b5('0x21'));logger['debug'](_0xe0b5('0x22'),_0x450d57,_0xe0b5('0x21'),JSON['stringify'](_0x342f81));if(_0x342f81[_0xe0b5('0x23')]){if(_0x342f81[_0xe0b5('0x23')]['code']===0x1f4){logger[_0xe0b5('0x23')](_0xe0b5('0x20'),_0x450d57,_0x342f81[_0xe0b5('0x23')][_0xe0b5('0x24')]);return _0x3df6d6(_0x342f81[_0xe0b5('0x23')][_0xe0b5('0x24')]);}logger[_0xe0b5('0x23')]('SalesforceAccount,\x20%s,\x20%s',_0x450d57,_0x342f81[_0xe0b5('0x23')]['message']);return _0x4d56a9(_0x342f81['error']['message']);}else{logger[_0xe0b5('0x1f')](_0xe0b5('0x20'),_0x450d57,_0xe0b5('0x21'));_0x4d56a9(_0x342f81[_0xe0b5('0x25')][_0xe0b5('0x24')]);}})[_0xe0b5('0x26')](function(_0x5591c4){logger[_0xe0b5('0x23')](_0xe0b5('0x20'),_0x450d57,_0x5591c4);_0x3df6d6(_0x5591c4);});});}function respondWithStatusCode(_0x1e0502,_0x4f6314){_0x4f6314=_0x4f6314||0xcc;return function(_0x389920){if(_0x389920){return _0x1e0502[_0xe0b5('0x27')](_0x4f6314);}return _0x1e0502[_0xe0b5('0x28')](_0x4f6314)[_0xe0b5('0x29')]();};}function respondWithResult(_0x4ecfef,_0x2a0727){_0x2a0727=_0x2a0727||0xc8;return function(_0xbf158f){if(_0xbf158f){return _0x4ecfef[_0xe0b5('0x28')](_0x2a0727)[_0xe0b5('0x2a')](_0xbf158f);}};}function respondWithFilteredResult(_0x57f79f,_0x55e98d){return function(_0x119f6c){if(_0x119f6c){var _0x479a93=_0x119f6c[_0xe0b5('0x2b')],_0x48a511=_0x55e98d[_0xe0b5('0x2c')],_0x31f8e1=_0x55e98d['offset']+_0x55e98d[_0xe0b5('0x2d')],_0x1d37af;if(_0x31f8e1>=_0x479a93){_0x31f8e1=_0x479a93;_0x1d37af=0xc8;}else{_0x1d37af=0xce;}_0x57f79f[_0xe0b5('0x28')](_0x1d37af);return _0x57f79f[_0xe0b5('0x2e')](_0xe0b5('0x2f'),_0x48a511+'-'+_0x31f8e1+'/'+_0x479a93)['json'](_0x119f6c);}return null;};}function patchUpdates(_0x4af106){return function(_0x510912){try{jsonpatch[_0xe0b5('0x30')](_0x510912,_0x4af106,!![]);}catch(_0x2c6896){return BPromise[_0xe0b5('0x31')](_0x2c6896);}return _0x510912['save']();};}function saveUpdates(_0x545e51,_0x6ec795){return function(_0x5c18c8){if(_0x5c18c8){return _0x5c18c8[_0xe0b5('0x32')](_0x545e51)['then'](function(_0x28b9fc){return _0x28b9fc;});}return null;};}function removeEntity(_0x216f06,_0x324844){return function(_0x24b3dd){if(_0x24b3dd){return _0x24b3dd[_0xe0b5('0x33')]()[_0xe0b5('0x1e')](function(){_0x216f06[_0xe0b5('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18df42,_0x4910e8){return function(_0x1c3509){if(!_0x1c3509){_0x18df42[_0xe0b5('0x27')](0x194);}return _0x1c3509;};}function handleError(_0x190ee1,_0x518c33){_0x518c33=_0x518c33||0x1f4;return function(_0x14703c){logger['error'](_0x14703c[_0xe0b5('0x34')]);if(_0x14703c[_0xe0b5('0x35')]){delete _0x14703c[_0xe0b5('0x35')];}_0x190ee1[_0xe0b5('0x28')](_0x518c33)[_0xe0b5('0x36')](_0x14703c);};}exports[_0xe0b5('0x37')]=function(_0xe1ee77,_0x40ecc1){var _0x597367={},_0x41b81c={},_0x43a7fb={'count':0x0,'rows':[]};var _0x58296e=_[_0xe0b5('0x38')](db[_0xe0b5('0x39')]['rawAttributes'],function(_0x3c312b){return{'name':_0x3c312b['fieldName'],'type':_0x3c312b['type']['key']};});_0x41b81c['model']=_['map'](_0x58296e,_0xe0b5('0x35'));_0x41b81c['query']=_[_0xe0b5('0x3a')](_0xe1ee77[_0xe0b5('0x3b')]);_0x41b81c[_0xe0b5('0x3c')]=_[_0xe0b5('0x3d')](_0x41b81c['model'],_0x41b81c[_0xe0b5('0x3b')]);_0x597367[_0xe0b5('0x3e')]=_[_0xe0b5('0x3d')](_0x41b81c[_0xe0b5('0x3f')],qs[_0xe0b5('0x40')](_0xe1ee77[_0xe0b5('0x3b')][_0xe0b5('0x40')]));_0x597367[_0xe0b5('0x3e')]=_0x597367[_0xe0b5('0x3e')][_0xe0b5('0x41')]?_0x597367[_0xe0b5('0x3e')]:_0x41b81c['model'];if(!_0xe1ee77['query']['hasOwnProperty'](_0xe0b5('0x42'))){_0x597367[_0xe0b5('0x2d')]=qs[_0xe0b5('0x2d')](_0xe1ee77[_0xe0b5('0x3b')][_0xe0b5('0x2d')]);_0x597367[_0xe0b5('0x2c')]=qs[_0xe0b5('0x2c')](_0xe1ee77[_0xe0b5('0x3b')]['offset']);}_0x597367['order']=qs[_0xe0b5('0x43')](_0xe1ee77[_0xe0b5('0x3b')][_0xe0b5('0x43')]);_0x597367[_0xe0b5('0x44')]=qs[_0xe0b5('0x3c')](_[_0xe0b5('0x45')](_0xe1ee77[_0xe0b5('0x3b')],_0x41b81c[_0xe0b5('0x3c')]),_0x58296e);if(_0xe1ee77[_0xe0b5('0x3b')]['filter']){_0x597367[_0xe0b5('0x44')]=_['merge'](_0x597367[_0xe0b5('0x44')],{'$or':_[_0xe0b5('0x38')](_0x58296e,function(_0x5f2975){if(_0x5f2975['type']!==_0xe0b5('0x46')){var _0x5b936d={};_0x5b936d[_0x5f2975[_0xe0b5('0x35')]]={'$like':'%'+_0xe1ee77[_0xe0b5('0x3b')][_0xe0b5('0x47')]+'%'};return _0x5b936d;}})});}_0x597367=_[_0xe0b5('0x48')]({},_0x597367,_0xe1ee77[_0xe0b5('0x49')]);var _0x4b5d75={'where':_0x597367[_0xe0b5('0x44')]};return db[_0xe0b5('0x39')][_0xe0b5('0x2b')](_0x4b5d75)[_0xe0b5('0x1e')](function(_0x3eb8ca){_0x43a7fb[_0xe0b5('0x2b')]=_0x3eb8ca;if(_0xe1ee77['query']['includeAll']){_0x597367[_0xe0b5('0x4a')]=[{'all':!![]}];}return db[_0xe0b5('0x39')][_0xe0b5('0x4b')](_0x597367);})[_0xe0b5('0x1e')](function(_0x1e58d5){_0x43a7fb[_0xe0b5('0x4c')]=_0x1e58d5;return _0x43a7fb;})['then'](respondWithFilteredResult(_0x40ecc1,_0x597367))[_0xe0b5('0x26')](handleError(_0x40ecc1,null));};exports['show']=function(_0x1fafce,_0x2e8997){var _0x4d1b26={'raw':![],'where':{'id':_0x1fafce[_0xe0b5('0x4d')]['id']}},_0x260a72={};_0x260a72['model']=_[_0xe0b5('0x3a')](db[_0xe0b5('0x39')][_0xe0b5('0x4e')]);_0x260a72[_0xe0b5('0x3b')]=_[_0xe0b5('0x3a')](_0x1fafce[_0xe0b5('0x3b')]);_0x260a72['filters']=_['intersection'](_0x260a72['model'],_0x260a72[_0xe0b5('0x3b')]);_0x4d1b26['attributes']=_['intersection'](_0x260a72[_0xe0b5('0x3f')],qs[_0xe0b5('0x40')](_0x1fafce['query'][_0xe0b5('0x40')]));_0x4d1b26[_0xe0b5('0x3e')]=_0x4d1b26[_0xe0b5('0x3e')][_0xe0b5('0x41')]?_0x4d1b26[_0xe0b5('0x3e')]:_0x260a72[_0xe0b5('0x3f')];if(_0x1fafce[_0xe0b5('0x3b')][_0xe0b5('0x4f')]){_0x4d1b26[_0xe0b5('0x4a')]=[{'all':!![]}];}_0x4d1b26=_[_0xe0b5('0x48')]({},_0x4d1b26,_0x1fafce[_0xe0b5('0x49')]);return db['SalesforceAccount'][_0xe0b5('0x50')](_0x4d1b26)[_0xe0b5('0x1e')](handleEntityNotFound(_0x2e8997,null))['then'](respondWithResult(_0x2e8997,null))[_0xe0b5('0x26')](handleError(_0x2e8997,null));};exports['create']=function(_0x15d7d4,_0x29eaa4){return db[_0xe0b5('0x39')][_0xe0b5('0x51')](_0x15d7d4['body'],{})[_0xe0b5('0x1e')](respondWithResult(_0x29eaa4,0xc9))[_0xe0b5('0x26')](handleError(_0x29eaa4,null));};exports[_0xe0b5('0x32')]=function(_0x5315b9,_0x310cba){if(_0x5315b9[_0xe0b5('0x52')]['id']){delete _0x5315b9[_0xe0b5('0x52')]['id'];}return db[_0xe0b5('0x39')][_0xe0b5('0x50')]({'where':{'id':_0x5315b9['params']['id']}})[_0xe0b5('0x1e')](handleEntityNotFound(_0x310cba,null))[_0xe0b5('0x1e')](saveUpdates(_0x5315b9[_0xe0b5('0x52')],null))[_0xe0b5('0x1e')](respondWithResult(_0x310cba,null))['catch'](handleError(_0x310cba,null));};exports[_0xe0b5('0x33')]=function(_0x76ed68,_0x100368){return db['SalesforceAccount']['find']({'where':{'id':_0x76ed68[_0xe0b5('0x4d')]['id']}})[_0xe0b5('0x1e')](handleEntityNotFound(_0x100368,null))[_0xe0b5('0x1e')](removeEntity(_0x100368,null))['catch'](handleError(_0x100368,null));};exports[_0xe0b5('0x53')]=function(_0x5db3fc,_0x412f58,_0x145604){var _0x4b318a={};var _0x14e901={};var _0x3ae4dc;var _0x1d5be1;return db[_0xe0b5('0x39')]['findOne']({'where':{'id':_0x5db3fc[_0xe0b5('0x4d')]['id']}})[_0xe0b5('0x1e')](handleEntityNotFound(_0x412f58,null))['then'](function(_0x12f93f){if(_0x12f93f){_0x3ae4dc=_0x12f93f;_0x14e901[_0xe0b5('0x3f')]=_[_0xe0b5('0x3a')](db['SalesforceConfiguration'][_0xe0b5('0x4e')]);_0x14e901[_0xe0b5('0x3b')]=_['keys'](_0x5db3fc[_0xe0b5('0x3b')]);_0x14e901[_0xe0b5('0x3c')]=_[_0xe0b5('0x3d')](_0x14e901[_0xe0b5('0x3f')],_0x14e901[_0xe0b5('0x3b')]);_0x4b318a[_0xe0b5('0x3e')]=_['intersection'](_0x14e901[_0xe0b5('0x3f')],qs[_0xe0b5('0x40')](_0x5db3fc[_0xe0b5('0x3b')][_0xe0b5('0x40')]));_0x4b318a[_0xe0b5('0x3e')]=_0x4b318a[_0xe0b5('0x3e')][_0xe0b5('0x41')]?_0x4b318a[_0xe0b5('0x3e')]:_0x14e901['model'];_0x4b318a[_0xe0b5('0x54')]=qs[_0xe0b5('0x43')](_0x5db3fc[_0xe0b5('0x3b')][_0xe0b5('0x43')]);_0x4b318a['where']=qs[_0xe0b5('0x3c')](_['pick'](_0x5db3fc[_0xe0b5('0x3b')],_0x14e901['filters']));if(_0x5db3fc[_0xe0b5('0x3b')][_0xe0b5('0x47')]){_0x4b318a[_0xe0b5('0x44')]=_[_0xe0b5('0x48')](_0x4b318a['where'],{'$or':_[_0xe0b5('0x38')](_0x4b318a['attributes'],function(_0x1626e9){var _0x56eb3c={};_0x56eb3c[_0x1626e9]={'$like':'%'+_0x5db3fc[_0xe0b5('0x3b')][_0xe0b5('0x47')]+'%'};return _0x56eb3c;})});}_0x4b318a=_[_0xe0b5('0x48')]({},_0x4b318a,_0x5db3fc['options']);return _0x3ae4dc['getConfigurations'](_0x4b318a);}})['then'](function(_0x5a1ce0){if(_0x5a1ce0){_0x1d5be1=_0x5a1ce0['length'];if(!_0x5db3fc[_0xe0b5('0x3b')][_0xe0b5('0x55')]('nolimit')){_0x4b318a[_0xe0b5('0x2d')]=qs[_0xe0b5('0x2d')](_0x5db3fc[_0xe0b5('0x3b')][_0xe0b5('0x2d')]);_0x4b318a['offset']=qs[_0xe0b5('0x2c')](_0x5db3fc[_0xe0b5('0x3b')][_0xe0b5('0x2c')]);}return _0x3ae4dc[_0xe0b5('0x53')](_0x4b318a);}})[_0xe0b5('0x1e')](function(_0x45398c){if(_0x45398c){return _0x45398c?{'count':_0x1d5be1,'rows':_0x45398c}:null;}})[_0xe0b5('0x1e')](respondWithResult(_0x412f58,null))[_0xe0b5('0x26')](handleError(_0x412f58,null));};exports[_0xe0b5('0x56')]=function(_0x3e8fce,_0x57210c,_0x11fbaa){if(_0x3e8fce['body']['id']){delete _0x3e8fce['body']['id'];}return db[_0xe0b5('0x39')][_0xe0b5('0x57')]({'where':{'id':_0x3e8fce['params']['id']}})[_0xe0b5('0x1e')](handleEntityNotFound(_0x57210c,null))[_0xe0b5('0x1e')](function(_0x1a3570){if(_0x1a3570){_0x3e8fce[_0xe0b5('0x52')][_0xe0b5('0x58')]=_0x1a3570['id'];_0x3e8fce[_0xe0b5('0x52')][_0xe0b5('0x59')]=integrations[_0xe0b5('0x5a')](_0x3e8fce[_0xe0b5('0x52')]['channel'],_0x3e8fce[_0xe0b5('0x52')][_0xe0b5('0x5b')]);_0x3e8fce[_0xe0b5('0x52')][_0xe0b5('0x5c')]=integrations[_0xe0b5('0x5d')](_0x3e8fce[_0xe0b5('0x52')]['channel'],_0x3e8fce[_0xe0b5('0x52')][_0xe0b5('0x5b')]);return db[_0xe0b5('0x5e')][_0xe0b5('0x51')](_0x3e8fce[_0xe0b5('0x52')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xe0b5('0x5f')],'as':_0xe0b5('0x5c')}]});}return null;})[_0xe0b5('0x1e')](respondWithResult(_0x57210c,null))[_0xe0b5('0x26')](handleError(_0x57210c,null));};exports['getFields']=function(_0x293f07,_0x59bc0f,_0xcec25){var _0x3aa943;var _0x2e6786='';var _0x3db9a7=_0xe0b5('0x60');return db[_0xe0b5('0x39')][_0xe0b5('0x57')]({'where':{'id':_0x293f07[_0xe0b5('0x4d')]['id']},'attributes':['id','remoteUri',_0xe0b5('0x61'),_0xe0b5('0x62'),_0xe0b5('0x63'),_0xe0b5('0x64'),'securityToken']})[_0xe0b5('0x1e')](handleEntityNotFound(_0x59bc0f,null))[_0xe0b5('0x1e')](function(_0x4e96ab){if(_0x4e96ab){_0x2e6786=_0x4e96ab[_0xe0b5('0x65')];var _0x3750ef=_0x2e6786[_0xe0b5('0x66')](-0x1);if(_0x3750ef==='/'){_0x2e6786=_0x2e6786[_0xe0b5('0x67')](0x0,_0x2e6786[_0xe0b5('0x68')](_0x3750ef));}_0x3aa943=new jsforce[(_0xe0b5('0x69'))]({'oauth2':{'loginUrl':_0x2e6786,'clientId':_0x4e96ab['clientId'],'clientSecret':_0x4e96ab['clientSecret']}});return _0x3aa943[_0xe0b5('0x6a')](_0x4e96ab['username'],_0x4e96ab[_0xe0b5('0x64')][_0xe0b5('0x6b')](_0x4e96ab[_0xe0b5('0x6c')]));}})['then'](function(_0x381dac){if(_0x381dac){if(!_[_0xe0b5('0x6d')](_0x293f07[_0xe0b5('0x3b')]['ticketType'])){_0x3db9a7=_0x293f07[_0xe0b5('0x3b')][_0xe0b5('0x6e')];}return _0x3aa943['sobject'](_0x3db9a7)['describe']();}})['then'](function(_0x42c6f4){var _0x5d92b7=[_0xe0b5('0x6f'),_0xe0b5('0x70'),'CallObject',_0xe0b5('0x71'),'IsArchived',_0xe0b5('0x72'),_0xe0b5('0x73'),_0xe0b5('0x74')];if(!_['isNil'](_0x293f07['query'][_0xe0b5('0x6e')])&&_0x293f07[_0xe0b5('0x3b')]['ticketType']===_0xe0b5('0x75')){_0x5d92b7=[_0xe0b5('0x74'),_0xe0b5('0x76'),_0xe0b5('0x77'),_0xe0b5('0x73'),_0xe0b5('0x72'),_0xe0b5('0x78'),'SuppliedName',_0xe0b5('0x79')];}if(_0x42c6f4){_[_0xe0b5('0x7a')](_0x42c6f4['fields'],function(_0x283a38){return _0x283a38[_0xe0b5('0x7b')]===![]&&!_0x5d92b7['includes'](_0x283a38[_0xe0b5('0x35')]);});return{'count':_0x42c6f4[_0xe0b5('0x40')][_0xe0b5('0x41')],'rows':_[_0xe0b5('0x38')](_0x42c6f4[_0xe0b5('0x40')],function(_0x188125){return{'id':_0x188125[_0xe0b5('0x35')],'name':_0x188125[_0xe0b5('0x7c')],'custom':_0x188125[_0xe0b5('0x7b')],'options':_0x188125[_0xe0b5('0x7d')]['length']>0x0?_[_0xe0b5('0x38')](_0x188125[_0xe0b5('0x7d')],function(_0x3aaf77){return{'name':_0x3aaf77[_0xe0b5('0x7c')],'value':_0x3aaf77['value']};}):_0x188125[_0xe0b5('0x5b')]==_0xe0b5('0x7e')?[{'name':_0xe0b5('0x7f'),'value':_0xe0b5('0x80')},{'name':_0xe0b5('0x81'),'value':_0xe0b5('0x82')}]:[]};})};}})[_0xe0b5('0x1e')](respondWithResult(_0x59bc0f,null))[_0xe0b5('0x26')](function(_0x498108){var _0x1b0796=_0x293f07[_0xe0b5('0x3b')][_0xe0b5('0x19')]?0x1f4:_0x498108[_0xe0b5('0x83')]||0x1f4;logger[_0xe0b5('0x23')](_0xe0b5('0x84'),'getFields',_0x1b0796,JSON[_0xe0b5('0x85')](_0x498108));delete _0x498108[_0xe0b5('0x35')];if(_0x1b0796===0x191){_0x1b0796=0x190;}_0x59bc0f['status'](_0x1b0796)[_0xe0b5('0x36')](_0x293f07[_0xe0b5('0x3b')][_0xe0b5('0x19')]?{'message':_0xe0b5('0x86'),'statusCode':_0x498108[_0xe0b5('0x83')]}:_0x498108);});}; \ No newline at end of file +var _0x53b9=['mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../components/integrations/configuration','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~!@#$%^&-_=+[{]}.','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','map','options','count','includeAll','include','rows','show','params','keys','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','login','concat','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','isNil','ticketType','Case','Reason','IsEscalated','custom','includes','label','picklistValues','value','boolean','True','true','False','false','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53b9,0x18c));var _0x953b=function(_0x496a3b,_0x471253){_0x496a3b=_0x496a3b-0x0;var _0xafe431=_0x53b9[_0x496a3b];return _0xafe431;};'use strict';var pdf=require(_0x953b('0x0'));var emlformat=require(_0x953b('0x1'));var rimraf=require(_0x953b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x953b('0x3'));var rp=require(_0x953b('0x4'));var moment=require(_0x953b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x953b('0x6'));var util=require(_0x953b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x953b('0x8'));var ejs=require(_0x953b('0x9'));var fs=require('fs');var _=require(_0x953b('0xa'));var squel=require(_0x953b('0xb'));var crypto=require(_0x953b('0xc'));var jsforce=require(_0x953b('0xd'));var deskjs=require(_0x953b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x953b('0xf'));var Papa=require(_0x953b('0x10'));var Redis=require(_0x953b('0x11'));var authService=require(_0x953b('0x12'));var qs=require(_0x953b('0x13'));var as=require(_0x953b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x953b('0x15'));var utils=require(_0x953b('0x16'));var config=require(_0x953b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x953b('0x18'));var jayson=require(_0x953b('0x19'));var client=jayson['client'][_0x953b('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2e8907,_0x481b3e,_0xc7ce77){if(_0xc7ce77){var _0x41ed37=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41ed37[_0x953b('0x1b')](_0x481b3e)){return _0x2e8907;}else{throw new db[(_0x953b('0x1c'))]['ValidationError'](_0x953b('0x1d'));}}else{return _0x2e8907;}}function respondWithRpcPromise(_0x36f806,_0xa9e5b2,_0x1ea440,_0x5325b6){return new BPromise(function(_0x165918,_0x5d4459){var _0x620e12=_0x5325b6||client;return _0x620e12[_0x953b('0x1e')](_0x36f806,_0x1ea440)[_0x953b('0x1f')](function(_0x3733d7){logger[_0x953b('0x20')](_0x953b('0x21'),_0xa9e5b2,_0x953b('0x22'));logger[_0x953b('0x23')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xa9e5b2,_0x953b('0x22'),JSON[_0x953b('0x24')](_0x3733d7));if(_0x3733d7['error']){if(_0x3733d7[_0x953b('0x25')][_0x953b('0x26')]===0x1f4){logger[_0x953b('0x25')](_0x953b('0x21'),_0xa9e5b2,_0x3733d7[_0x953b('0x25')][_0x953b('0x27')]);return _0x5d4459(_0x3733d7['error'][_0x953b('0x27')]);}logger['error'](_0x953b('0x21'),_0xa9e5b2,_0x3733d7[_0x953b('0x25')][_0x953b('0x27')]);return _0x165918(_0x3733d7[_0x953b('0x25')][_0x953b('0x27')]);}else{logger[_0x953b('0x20')](_0x953b('0x21'),_0xa9e5b2,_0x953b('0x22'));_0x165918(_0x3733d7['result'][_0x953b('0x27')]);}})[_0x953b('0x28')](function(_0x587bbe){logger['error'](_0x953b('0x21'),_0xa9e5b2,_0x587bbe);_0x5d4459(_0x587bbe);});});}function respondWithStatusCode(_0x44d692,_0x4215ef){_0x4215ef=_0x4215ef||0xcc;return function(_0x54a3f4){if(_0x54a3f4){return _0x44d692[_0x953b('0x29')](_0x4215ef);}return _0x44d692[_0x953b('0x2a')](_0x4215ef)[_0x953b('0x2b')]();};}function respondWithResult(_0x4133d3,_0x1fb88d){_0x1fb88d=_0x1fb88d||0xc8;return function(_0x509aa8){if(_0x509aa8){return _0x4133d3[_0x953b('0x2a')](_0x1fb88d)[_0x953b('0x2c')](_0x509aa8);}};}function respondWithFilteredResult(_0x196a0b,_0x5cb961){return function(_0x5a33f0){if(_0x5a33f0){var _0x49227b=_0x5a33f0['count'],_0x1e6ca0=_0x5cb961[_0x953b('0x2d')],_0x39a7e9=_0x5cb961[_0x953b('0x2d')]+_0x5cb961[_0x953b('0x2e')],_0x29bc19;if(_0x39a7e9>=_0x49227b){_0x39a7e9=_0x49227b;_0x29bc19=0xc8;}else{_0x29bc19=0xce;}_0x196a0b[_0x953b('0x2a')](_0x29bc19);return _0x196a0b[_0x953b('0x2f')](_0x953b('0x30'),_0x1e6ca0+'-'+_0x39a7e9+'/'+_0x49227b)[_0x953b('0x2c')](_0x5a33f0);}return null;};}function patchUpdates(_0x399130){return function(_0x238229){try{jsonpatch[_0x953b('0x31')](_0x238229,_0x399130,!![]);}catch(_0x35c484){return BPromise[_0x953b('0x32')](_0x35c484);}return _0x238229['save']();};}function saveUpdates(_0x41db6d,_0x18c5f4){return function(_0x894c7b){if(_0x894c7b){return _0x894c7b[_0x953b('0x33')](_0x41db6d)[_0x953b('0x1f')](function(_0x592c1b){return _0x592c1b;});}return null;};}function removeEntity(_0x1d3ba2,_0xdeb474){return function(_0x50d5ef){if(_0x50d5ef){return _0x50d5ef[_0x953b('0x34')]()[_0x953b('0x1f')](function(){_0x1d3ba2[_0x953b('0x2a')](0xcc)[_0x953b('0x2b')]();});}};}function handleEntityNotFound(_0x31463e,_0xe4a103){return function(_0x2a6c46){if(!_0x2a6c46){_0x31463e[_0x953b('0x29')](0x194);}return _0x2a6c46;};}function handleError(_0x4b5fb7,_0x24dcd2){_0x24dcd2=_0x24dcd2||0x1f4;return function(_0x1f0f4b){logger[_0x953b('0x25')](_0x1f0f4b[_0x953b('0x35')]);if(_0x1f0f4b[_0x953b('0x36')]){delete _0x1f0f4b[_0x953b('0x36')];}_0x4b5fb7[_0x953b('0x2a')](_0x24dcd2)[_0x953b('0x37')](_0x1f0f4b);};}exports[_0x953b('0x38')]=function(_0x2d5d03,_0x4eb20f){var _0x3c5e31={},_0x1895b9={},_0x4359e6={'count':0x0,'rows':[]};var _0x4276ea=_['map'](db[_0x953b('0x39')][_0x953b('0x3a')],function(_0x2c7bd){return{'name':_0x2c7bd[_0x953b('0x3b')],'type':_0x2c7bd[_0x953b('0x3c')]['key']};});_0x1895b9[_0x953b('0x3d')]=_['map'](_0x4276ea,_0x953b('0x36'));_0x1895b9['query']=_['keys'](_0x2d5d03[_0x953b('0x3e')]);_0x1895b9[_0x953b('0x3f')]=_[_0x953b('0x40')](_0x1895b9[_0x953b('0x3d')],_0x1895b9[_0x953b('0x3e')]);_0x3c5e31['attributes']=_[_0x953b('0x40')](_0x1895b9['model'],qs[_0x953b('0x41')](_0x2d5d03[_0x953b('0x3e')]['fields']));_0x3c5e31['attributes']=_0x3c5e31[_0x953b('0x42')]['length']?_0x3c5e31[_0x953b('0x42')]:_0x1895b9[_0x953b('0x3d')];if(!_0x2d5d03['query']['hasOwnProperty'](_0x953b('0x43'))){_0x3c5e31['limit']=qs[_0x953b('0x2e')](_0x2d5d03['query']['limit']);_0x3c5e31[_0x953b('0x2d')]=qs[_0x953b('0x2d')](_0x2d5d03['query']['offset']);}_0x3c5e31['order']=qs[_0x953b('0x44')](_0x2d5d03[_0x953b('0x3e')]['sort']);_0x3c5e31[_0x953b('0x45')]=qs[_0x953b('0x3f')](_['pick'](_0x2d5d03['query'],_0x1895b9[_0x953b('0x3f')]),_0x4276ea);if(_0x2d5d03['query'][_0x953b('0x46')]){_0x3c5e31[_0x953b('0x45')]=_[_0x953b('0x47')](_0x3c5e31[_0x953b('0x45')],{'$or':_[_0x953b('0x48')](_0x4276ea,function(_0x51c3fd){if(_0x51c3fd[_0x953b('0x3c')]!=='VIRTUAL'){var _0x41338f={};_0x41338f[_0x51c3fd['name']]={'$like':'%'+_0x2d5d03[_0x953b('0x3e')][_0x953b('0x46')]+'%'};return _0x41338f;}})});}_0x3c5e31=_[_0x953b('0x47')]({},_0x3c5e31,_0x2d5d03[_0x953b('0x49')]);var _0x3376ff={'where':_0x3c5e31[_0x953b('0x45')]};return db[_0x953b('0x39')][_0x953b('0x4a')](_0x3376ff)[_0x953b('0x1f')](function(_0x424fc3){_0x4359e6[_0x953b('0x4a')]=_0x424fc3;if(_0x2d5d03[_0x953b('0x3e')][_0x953b('0x4b')]){_0x3c5e31[_0x953b('0x4c')]=[{'all':!![]}];}return db[_0x953b('0x39')]['findAll'](_0x3c5e31);})[_0x953b('0x1f')](function(_0x2f631c){_0x4359e6[_0x953b('0x4d')]=_0x2f631c;return _0x4359e6;})['then'](respondWithFilteredResult(_0x4eb20f,_0x3c5e31))[_0x953b('0x28')](handleError(_0x4eb20f,null));};exports[_0x953b('0x4e')]=function(_0x5e9306,_0x5cf7a6){var _0x4cee4e={'raw':![],'where':{'id':_0x5e9306[_0x953b('0x4f')]['id']}},_0x41b11b={};_0x41b11b[_0x953b('0x3d')]=_[_0x953b('0x50')](db[_0x953b('0x39')][_0x953b('0x3a')]);_0x41b11b[_0x953b('0x3e')]=_['keys'](_0x5e9306[_0x953b('0x3e')]);_0x41b11b[_0x953b('0x3f')]=_[_0x953b('0x40')](_0x41b11b[_0x953b('0x3d')],_0x41b11b[_0x953b('0x3e')]);_0x4cee4e[_0x953b('0x42')]=_[_0x953b('0x40')](_0x41b11b[_0x953b('0x3d')],qs['fields'](_0x5e9306[_0x953b('0x3e')][_0x953b('0x41')]));_0x4cee4e['attributes']=_0x4cee4e[_0x953b('0x42')][_0x953b('0x51')]?_0x4cee4e[_0x953b('0x42')]:_0x41b11b[_0x953b('0x3d')];if(_0x5e9306['query']['includeAll']){_0x4cee4e[_0x953b('0x4c')]=[{'all':!![]}];}_0x4cee4e=_[_0x953b('0x47')]({},_0x4cee4e,_0x5e9306[_0x953b('0x49')]);return db[_0x953b('0x39')][_0x953b('0x52')](_0x4cee4e)['then'](handleEntityNotFound(_0x5cf7a6,null))[_0x953b('0x1f')](respondWithResult(_0x5cf7a6,null))[_0x953b('0x28')](handleError(_0x5cf7a6,null));};exports[_0x953b('0x53')]=function(_0x29adb9,_0x5d6efa){return db['SalesforceAccount'][_0x953b('0x53')](_0x29adb9[_0x953b('0x54')],{})[_0x953b('0x1f')](respondWithResult(_0x5d6efa,0xc9))[_0x953b('0x28')](handleError(_0x5d6efa,null));};exports[_0x953b('0x33')]=function(_0x5a7e3d,_0x5e33ca){if(_0x5a7e3d[_0x953b('0x54')]['id']){delete _0x5a7e3d['body']['id'];}return db[_0x953b('0x39')][_0x953b('0x52')]({'where':{'id':_0x5a7e3d[_0x953b('0x4f')]['id']}})[_0x953b('0x1f')](handleEntityNotFound(_0x5e33ca,null))[_0x953b('0x1f')](saveUpdates(_0x5a7e3d[_0x953b('0x54')],null))['then'](respondWithResult(_0x5e33ca,null))[_0x953b('0x28')](handleError(_0x5e33ca,null));};exports['destroy']=function(_0x2689af,_0x68845e){return db[_0x953b('0x39')]['find']({'where':{'id':_0x2689af[_0x953b('0x4f')]['id']}})[_0x953b('0x1f')](handleEntityNotFound(_0x68845e,null))[_0x953b('0x1f')](removeEntity(_0x68845e,null))[_0x953b('0x28')](handleError(_0x68845e,null));};exports[_0x953b('0x55')]=function(_0x177e82,_0x4a83e0,_0x34155c){var _0x24a5d6={};var _0xf6e193={};var _0x5b9e87;var _0xf8bca9;return db[_0x953b('0x39')][_0x953b('0x56')]({'where':{'id':_0x177e82[_0x953b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4a83e0,null))[_0x953b('0x1f')](function(_0x3ae24c){if(_0x3ae24c){_0x5b9e87=_0x3ae24c;_0xf6e193[_0x953b('0x3d')]=_['keys'](db[_0x953b('0x57')][_0x953b('0x3a')]);_0xf6e193['query']=_[_0x953b('0x50')](_0x177e82[_0x953b('0x3e')]);_0xf6e193[_0x953b('0x3f')]=_[_0x953b('0x40')](_0xf6e193[_0x953b('0x3d')],_0xf6e193['query']);_0x24a5d6[_0x953b('0x42')]=_[_0x953b('0x40')](_0xf6e193[_0x953b('0x3d')],qs[_0x953b('0x41')](_0x177e82[_0x953b('0x3e')][_0x953b('0x41')]));_0x24a5d6[_0x953b('0x42')]=_0x24a5d6[_0x953b('0x42')][_0x953b('0x51')]?_0x24a5d6[_0x953b('0x42')]:_0xf6e193[_0x953b('0x3d')];_0x24a5d6['order']=qs[_0x953b('0x44')](_0x177e82[_0x953b('0x3e')][_0x953b('0x44')]);_0x24a5d6[_0x953b('0x45')]=qs[_0x953b('0x3f')](_[_0x953b('0x58')](_0x177e82[_0x953b('0x3e')],_0xf6e193['filters']));if(_0x177e82[_0x953b('0x3e')][_0x953b('0x46')]){_0x24a5d6[_0x953b('0x45')]=_['merge'](_0x24a5d6[_0x953b('0x45')],{'$or':_[_0x953b('0x48')](_0x24a5d6['attributes'],function(_0x1944fe){var _0x1f088e={};_0x1f088e[_0x1944fe]={'$like':'%'+_0x177e82['query'][_0x953b('0x46')]+'%'};return _0x1f088e;})});}_0x24a5d6=_['merge']({},_0x24a5d6,_0x177e82[_0x953b('0x49')]);return _0x5b9e87[_0x953b('0x55')](_0x24a5d6);}})['then'](function(_0x5a6c00){if(_0x5a6c00){_0xf8bca9=_0x5a6c00[_0x953b('0x51')];if(!_0x177e82[_0x953b('0x3e')][_0x953b('0x59')](_0x953b('0x43'))){_0x24a5d6[_0x953b('0x2e')]=qs[_0x953b('0x2e')](_0x177e82[_0x953b('0x3e')][_0x953b('0x2e')]);_0x24a5d6['offset']=qs['offset'](_0x177e82[_0x953b('0x3e')][_0x953b('0x2d')]);}return _0x5b9e87[_0x953b('0x55')](_0x24a5d6);}})[_0x953b('0x1f')](function(_0x476377){if(_0x476377){return _0x476377?{'count':_0xf8bca9,'rows':_0x476377}:null;}})[_0x953b('0x1f')](respondWithResult(_0x4a83e0,null))[_0x953b('0x28')](handleError(_0x4a83e0,null));};exports[_0x953b('0x5a')]=function(_0x6307ed,_0x15995c,_0x27c75b){if(_0x6307ed[_0x953b('0x54')]['id']){delete _0x6307ed[_0x953b('0x54')]['id'];}return db[_0x953b('0x39')]['findOne']({'where':{'id':_0x6307ed['params']['id']}})['then'](handleEntityNotFound(_0x15995c,null))[_0x953b('0x1f')](function(_0x5b4cae){if(_0x5b4cae){_0x6307ed['body']['AccountId']=_0x5b4cae['id'];_0x6307ed[_0x953b('0x54')][_0x953b('0x5b')]=integrations[_0x953b('0x5c')](_0x6307ed[_0x953b('0x54')][_0x953b('0x5d')],_0x6307ed[_0x953b('0x54')][_0x953b('0x3c')]);_0x6307ed[_0x953b('0x54')][_0x953b('0x5e')]=integrations[_0x953b('0x5f')](_0x6307ed[_0x953b('0x54')][_0x953b('0x5d')],_0x6307ed['body'][_0x953b('0x3c')]);return db[_0x953b('0x57')][_0x953b('0x53')](_0x6307ed[_0x953b('0x54')],{'include':[{'model':db['SalesforceField'],'as':_0x953b('0x5b')},{'model':db[_0x953b('0x60')],'as':_0x953b('0x5e')}]});}return null;})[_0x953b('0x1f')](respondWithResult(_0x15995c,null))['catch'](handleError(_0x15995c,null));};exports['getFields']=function(_0x56c31b,_0x35a1ff,_0x415dd5){var _0x2c0f97;var _0x2272bd='';var _0x4146d6=_0x953b('0x61');return db['SalesforceAccount']['findOne']({'where':{'id':_0x56c31b['params']['id']},'attributes':['id',_0x953b('0x62'),_0x953b('0x63'),_0x953b('0x64'),_0x953b('0x65'),_0x953b('0x66'),_0x953b('0x67')]})[_0x953b('0x1f')](handleEntityNotFound(_0x35a1ff,null))[_0x953b('0x1f')](function(_0x5638e9){if(_0x5638e9){_0x2272bd=_0x5638e9[_0x953b('0x62')];var _0x3b295a=_0x2272bd['slice'](-0x1);if(_0x3b295a==='/'){_0x2272bd=_0x2272bd[_0x953b('0x68')](0x0,_0x2272bd[_0x953b('0x69')](_0x3b295a));}_0x2c0f97=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2272bd,'clientId':_0x5638e9['clientId'],'clientSecret':_0x5638e9[_0x953b('0x64')]}});return _0x2c0f97[_0x953b('0x6a')](_0x5638e9[_0x953b('0x65')],_0x5638e9['password'][_0x953b('0x6b')](_0x5638e9['securityToken']));}})['then'](function(_0x53a9b8){if(_0x53a9b8){if(!_['isNil'](_0x56c31b['query']['ticketType'])){_0x4146d6=_0x56c31b[_0x953b('0x3e')]['ticketType'];}return _0x2c0f97['sobject'](_0x4146d6)[_0x953b('0x6c')]();}})[_0x953b('0x1f')](function(_0x4ab8b1){var _0x40282f=[_0x953b('0x6d'),_0x953b('0x6e'),_0x953b('0x6f'),_0x953b('0x70'),_0x953b('0x71'),_0x953b('0x72'),_0x953b('0x73'),_0x953b('0x74')];if(!_[_0x953b('0x75')](_0x56c31b['query'][_0x953b('0x76')])&&_0x56c31b[_0x953b('0x3e')][_0x953b('0x76')]===_0x953b('0x77')){_0x40282f=[_0x953b('0x74'),'Origin',_0x953b('0x78'),_0x953b('0x73'),'Priority',_0x953b('0x79'),'SuppliedName','SuppliedCompany'];}if(_0x4ab8b1){_['remove'](_0x4ab8b1['fields'],function(_0x19edd6){return _0x19edd6[_0x953b('0x7a')]===![]&&!_0x40282f[_0x953b('0x7b')](_0x19edd6[_0x953b('0x36')]);});return{'count':_0x4ab8b1[_0x953b('0x41')][_0x953b('0x51')],'rows':_[_0x953b('0x48')](_0x4ab8b1[_0x953b('0x41')],function(_0x526920){return{'id':_0x526920['name'],'name':_0x526920[_0x953b('0x7c')],'custom':_0x526920[_0x953b('0x7a')],'options':_0x526920[_0x953b('0x7d')]['length']>0x0?_[_0x953b('0x48')](_0x526920[_0x953b('0x7d')],function(_0x44114a){return{'name':_0x44114a['label'],'value':_0x44114a[_0x953b('0x7e')]};}):_0x526920['type']==_0x953b('0x7f')?[{'name':_0x953b('0x80'),'value':_0x953b('0x81')},{'name':_0x953b('0x82'),'value':_0x953b('0x83')}]:[]};})};}})[_0x953b('0x1f')](respondWithResult(_0x35a1ff,null))[_0x953b('0x28')](function(_0x234426){var _0x5bef80=_0x56c31b['query']['test']?0x1f4:_0x234426[_0x953b('0x84')]||0x1f4;logger[_0x953b('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5bef80,JSON['stringify'](_0x234426));delete _0x234426[_0x953b('0x36')];if(_0x5bef80===0x191){_0x5bef80=0x190;}_0x35a1ff[_0x953b('0x2a')](_0x5bef80)[_0x953b('0x37')](_0x56c31b['query'][_0x953b('0x1b')]?{'message':_0x953b('0x85'),'statusCode':_0x234426[_0x953b('0x84')]}:_0x234426);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b694bcd..85c6d03 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 _0xc665=['path','rimraf','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3458f4,_0x1b9889){var _0x53ea55=function(_0x3b5b9e){while(--_0x3b5b9e){_0x3458f4['push'](_0x3458f4['shift']());}};_0x53ea55(++_0x1b9889);}(_0xc665,0xaf));var _0x5c66=function(_0x29d61d,_0x43ae85){_0x29d61d=_0x29d61d-0x0;var _0x50d092=_0xc665[_0x29d61d];return _0x50d092;};'use strict';var _=require(_0x5c66('0x0'));var util=require(_0x5c66('0x1'));var logger=require(_0x5c66('0x2'))(_0x5c66('0x3'));var moment=require(_0x5c66('0x4'));var BPromise=require(_0x5c66('0x5'));var rp=require(_0x5c66('0x6'));var fs=require('fs');var path=require(_0x5c66('0x7'));var rimraf=require(_0x5c66('0x8'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x5c66('0x9'));module[_0x5c66('0xa')]=function(_0x53ed80,_0xcd9c0a){return _0x53ed80['define'](_0x5c66('0xb'),attributes,{'tableName':_0x5c66('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x055e=['moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api'];(function(_0x1ae8a6,_0xf1a03c){var _0x55d641=function(_0x4d4fa2){while(--_0x4d4fa2){_0x1ae8a6['push'](_0x1ae8a6['shift']());}};_0x55d641(++_0xf1a03c);}(_0x055e,0xb3));var _0xe055=function(_0x3bfd67,_0x19f0f7){_0x3bfd67=_0x3bfd67-0x0;var _0xa5095e=_0x055e[_0x3bfd67];return _0xa5095e;};'use strict';var _=require('lodash');var util=require(_0xe055('0x0'));var logger=require(_0xe055('0x1'))(_0xe055('0x2'));var moment=require(_0xe055('0x3'));var BPromise=require('bluebird');var rp=require(_0xe055('0x4'));var fs=require('fs');var path=require(_0xe055('0x5'));var rimraf=require(_0xe055('0x6'));var config=require(_0xe055('0x7'));var attributes=require(_0xe055('0x8'));var integrations=require(_0xe055('0x9'));module['exports']=function(_0x51f69c,_0x14091a){return _0x51f69c[_0xe055('0xa')](_0xe055('0xb'),attributes,{'tableName':_0xe055('0xc'),'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 57ad69f..3d880de 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 _0xe205=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','include','map','model','attributes','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe205,0xa7));var _0x5e20=function(_0x34817b,_0x20294d){_0x34817b=_0x34817b-0x0;var _0x2beab2=_0xe205[_0x34817b];return _0x2beab2;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['findAll']({'raw':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706['options'][_0x5e20('0x1c')]||null:null,'attributes':_0x1cc706['options']?_0x1cc706['options']['attributes']||null:null,'limit':_0x1cc706['options']?_0x1cc706[_0x5e20('0x1a')]['limit']||null:null,'include':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')],function(_0x4c5732){return{'model':db[_0x4c5732[_0x5e20('0x1f')]],'as':_0x4c5732['as'],'attributes':_0x4c5732['attributes'],'include':_0x4c5732['include']?_[_0x5e20('0x1e')](_0x4c5732[_0x5e20('0x1d')],function(_0x2bae08){return{'model':db[_0x2bae08[_0x5e20('0x1f')]],'as':_0x2bae08['as'],'attributes':_0x2bae08[_0x5e20('0x20')],'include':_0x2bae08[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2bae08['include'],function(_0x3bf4f4){return{'model':db[_0x3bf4f4[_0x5e20('0x1f')]],'as':_0x3bf4f4['as'],'attributes':_0x3bf4f4[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5e20('0xe')](function(_0x4c799d){logger[_0x5e20('0xf')](_0x5e20('0x18'),_0x1cc706);logger[_0x5e20('0x12')](_0x5e20('0x18'),_0x1cc706,JSON[_0x5e20('0x13')](_0x4c799d));_0x4d3e4a(_0x4c799d);})[_0x5e20('0x17')](function(_0x5ec45b){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x5ec45b['message'],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x5ec45b[_0x5e20('0x16')]));});});};exports[_0x5e20('0x21')]=function(_0x4196a3){var _0x1548c8=this;return new Promise(function(_0x395a27,_0x4ff715){return db[_0x5e20('0x19')][_0x5e20('0x22')]({'raw':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1c')]||null:null,'attributes':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x20')]||null:null,'include':_0x4196a3['options']?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x4196a3['options'][_0x5e20('0x1d')],function(_0x2d397b){return{'model':db[_0x2d397b[_0x5e20('0x1f')]],'as':_0x2d397b['as'],'attributes':_0x2d397b[_0x5e20('0x20')],'include':_0x2d397b[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2d397b[_0x5e20('0x1d')],function(_0x173165){return{'model':db[_0x173165[_0x5e20('0x1f')]],'as':_0x173165['as'],'attributes':_0x173165[_0x5e20('0x20')],'include':_0x173165[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x173165[_0x5e20('0x1d')],function(_0x255b67){return{'model':db[_0x255b67['model']],'as':_0x255b67['as'],'attributes':_0x255b67[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549f01){logger[_0x5e20('0xf')](_0x5e20('0x21'),_0x4196a3);logger['debug'](_0x5e20('0x21'),_0x4196a3,JSON[_0x5e20('0x13')](_0x549f01));_0x395a27(_0x549f01);})['catch'](function(_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x21'),_0x3f3908[_0x5e20('0x16')],_0x4196a3);_0x4ff715(_0x1548c8[_0x5e20('0x14')](0x1f4,_0x3f3908[_0x5e20('0x16')]));});});}; \ No newline at end of file +var _0x9bde=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SalesforceAccount,\x20%s,\x20%s','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','map','include','model','ShowSalesforceAccount','find','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x2ccc6c,_0x5666fc){var _0x29632b=function(_0x1b910c){while(--_0x1b910c){_0x2ccc6c['push'](_0x2ccc6c['shift']());}};_0x29632b(++_0x5666fc);}(_0x9bde,0xe1));var _0xe9bd=function(_0x59dc3b,_0x13b432){_0x59dc3b=_0x59dc3b-0x0;var _0x10e9e9=_0x9bde[_0x59dc3b];return _0x10e9e9;};'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')]('SalesforceAccount,\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')]('SalesforceAccount,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('SalesforceAccount,\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')]('SalesforceAccount,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});}exports[_0xe9bd('0x16')]=function(_0x3bae08){var _0x34ba2b=this;return new Promise(function(_0x330733,_0x5cf674){return db[_0xe9bd('0x17')]['findAll']({'raw':_0x3bae08[_0xe9bd('0x18')]?_0x3bae08['options'][_0xe9bd('0x19')]===undefined?!![]:![]:!![],'where':_0x3bae08[_0xe9bd('0x18')]?_0x3bae08[_0xe9bd('0x18')][_0xe9bd('0x1a')]||null:null,'attributes':_0x3bae08[_0xe9bd('0x18')]?_0x3bae08[_0xe9bd('0x18')][_0xe9bd('0x1b')]||null:null,'limit':_0x3bae08['options']?_0x3bae08[_0xe9bd('0x18')][_0xe9bd('0x1c')]||null:null,'include':_0x3bae08['options']?_0x3bae08[_0xe9bd('0x18')]['include']?_[_0xe9bd('0x1d')](_0x3bae08[_0xe9bd('0x18')][_0xe9bd('0x1e')],function(_0xf02209){return{'model':db[_0xf02209['model']],'as':_0xf02209['as'],'attributes':_0xf02209[_0xe9bd('0x1b')],'include':_0xf02209[_0xe9bd('0x1e')]?_[_0xe9bd('0x1d')](_0xf02209[_0xe9bd('0x1e')],function(_0x2641be){return{'model':db[_0x2641be[_0xe9bd('0x1f')]],'as':_0x2641be['as'],'attributes':_0x2641be[_0xe9bd('0x1b')],'include':_0x2641be[_0xe9bd('0x1e')]?_[_0xe9bd('0x1d')](_0x2641be['include'],function(_0x3c211a){return{'model':db[_0x3c211a[_0xe9bd('0x1f')]],'as':_0x3c211a['as'],'attributes':_0x3c211a['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9bd('0xb')](function(_0xc25248){logger[_0xe9bd('0xc')](_0xe9bd('0x16'),_0x3bae08);logger[_0xe9bd('0xd')](_0xe9bd('0x16'),_0x3bae08,JSON['stringify'](_0xc25248));_0x330733(_0xc25248);})['catch'](function(_0x1de54c){logger['error'](_0xe9bd('0x16'),_0x1de54c[_0xe9bd('0x12')],_0x3bae08);_0x5cf674(_0x34ba2b[_0xe9bd('0x10')](0x1f4,_0x1de54c[_0xe9bd('0x12')]));});});};exports[_0xe9bd('0x20')]=function(_0x509e36){var _0x4b7bc2=this;return new Promise(function(_0x7f2c5,_0x3b6682){return db[_0xe9bd('0x17')][_0xe9bd('0x21')]({'raw':_0x509e36[_0xe9bd('0x18')]?_0x509e36[_0xe9bd('0x18')][_0xe9bd('0x19')]===undefined?!![]:![]:!![],'where':_0x509e36[_0xe9bd('0x18')]?_0x509e36[_0xe9bd('0x18')]['where']||null:null,'attributes':_0x509e36[_0xe9bd('0x18')]?_0x509e36[_0xe9bd('0x18')][_0xe9bd('0x1b')]||null:null,'include':_0x509e36['options']?_0x509e36['options'][_0xe9bd('0x1e')]?_[_0xe9bd('0x1d')](_0x509e36[_0xe9bd('0x18')][_0xe9bd('0x1e')],function(_0x1dda43){return{'model':db[_0x1dda43[_0xe9bd('0x1f')]],'as':_0x1dda43['as'],'attributes':_0x1dda43[_0xe9bd('0x1b')],'include':_0x1dda43[_0xe9bd('0x1e')]?_[_0xe9bd('0x1d')](_0x1dda43[_0xe9bd('0x1e')],function(_0x46576b){return{'model':db[_0x46576b[_0xe9bd('0x1f')]],'as':_0x46576b['as'],'attributes':_0x46576b[_0xe9bd('0x1b')],'include':_0x46576b[_0xe9bd('0x1e')]?_[_0xe9bd('0x1d')](_0x46576b[_0xe9bd('0x1e')],function(_0x264ba0){return{'model':db[_0x264ba0[_0xe9bd('0x1f')]],'as':_0x264ba0['as'],'attributes':_0x264ba0['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9bd('0xb')](function(_0x32e764){logger['info'](_0xe9bd('0x20'),_0x509e36);logger[_0xe9bd('0xd')]('ShowSalesforceAccount',_0x509e36,JSON['stringify'](_0x32e764));_0x7f2c5(_0x32e764);})[_0xe9bd('0x15')](function(_0xdf43b9){logger['error'](_0xe9bd('0x20'),_0xdf43b9[_0xe9bd('0x12')],_0x509e36);_0x3b6682(_0x4b7bc2[_0xe9bd('0x10')](0x1f4,_0xdf43b9['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index eb11bdd..126f466 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 _0x5e5b=['./intSalesforceConfiguration.controller','index','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5e5b,0x1a7));var _0xb5e5=function(_0xd03609,_0x512287){_0xd03609=_0xd03609-0x0;var _0x44f652=_0x5e5b[_0xd03609];return _0x44f652;};'use strict';var multer=require(_0xb5e5('0x0'));var util=require(_0xb5e5('0x1'));var path=require(_0xb5e5('0x2'));var timeout=require(_0xb5e5('0x3'));var express=require(_0xb5e5('0x4'));var router=express[_0xb5e5('0x5')]();var auth=require(_0xb5e5('0x6'));var interaction=require(_0xb5e5('0x7'));var config=require(_0xb5e5('0x8'));var controller=require(_0xb5e5('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb5e5('0xa')]);router[_0xb5e5('0xb')](_0xb5e5('0xc'),auth[_0xb5e5('0xd')](),controller['show']);router[_0xb5e5('0xb')](_0xb5e5('0xe'),auth['isAuthenticated'](),controller[_0xb5e5('0xf')]);router['get'](_0xb5e5('0x10'),auth['isAuthenticated'](),controller[_0xb5e5('0x11')]);router['get'](_0xb5e5('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xb5e5('0xd')](),controller[_0xb5e5('0x13')]);router[_0xb5e5('0x14')](_0xb5e5('0xc'),auth[_0xb5e5('0xd')](),controller['update']);router[_0xb5e5('0x15')](_0xb5e5('0xc'),auth[_0xb5e5('0xd')](),controller[_0xb5e5('0x16')]);module[_0xb5e5('0x17')]=router; \ No newline at end of file +var _0x0663=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','getFields'];(function(_0x1546d5,_0x37d591){var _0x1c75fd=function(_0x41b637){while(--_0x41b637){_0x1546d5['push'](_0x1546d5['shift']());}};_0x1c75fd(++_0x37d591);}(_0x0663,0x1eb));var _0x3066=function(_0x1be79d,_0x5e1297){_0x1be79d=_0x1be79d-0x0;var _0xdb530a=_0x0663[_0x1be79d];return _0xdb530a;};'use strict';var multer=require(_0x3066('0x0'));var util=require(_0x3066('0x1'));var path=require(_0x3066('0x2'));var timeout=require(_0x3066('0x3'));var express=require(_0x3066('0x4'));var router=express['Router']();var auth=require(_0x3066('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3066('0x6'));var controller=require(_0x3066('0x7'));router[_0x3066('0x8')]('/',auth[_0x3066('0x9')](),controller[_0x3066('0xa')]);router[_0x3066('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3066('0xb')]);router[_0x3066('0x8')]('/:id/fields',auth[_0x3066('0x9')](),controller[_0x3066('0xc')]);router[_0x3066('0x8')](_0x3066('0xd'),auth[_0x3066('0x9')](),controller[_0x3066('0xe')]);router[_0x3066('0x8')](_0x3066('0xf'),auth[_0x3066('0x9')](),controller[_0x3066('0x10')]);router['post']('/',auth[_0x3066('0x9')](),controller['create']);router['put'](_0x3066('0x11'),auth[_0x3066('0x9')](),controller[_0x3066('0x12')]);router[_0x3066('0x13')](_0x3066('0x11'),auth['isAuthenticated'](),controller[_0x3066('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 40cf5e1..62af7aa 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 _0x30a2=['sequelize','exports','STRING','ENUM','contact_lead','contact','lead','nothing'];(function(_0x5decec,_0x4e5761){var _0x35e1b4=function(_0x27066d){while(--_0x27066d){_0x5decec['push'](_0x5decec['shift']());}};_0x35e1b4(++_0x4e5761);}(_0x30a2,0x90));var _0x230a=function(_0x17ec16,_0x2436e3){_0x17ec16=_0x17ec16-0x0;var _0x1f59f5=_0x30a2[_0x17ec16];return _0x1f59f5;};'use strict';var Sequelize=require(_0x230a('0x0'));module[_0x230a('0x1')]={'name':{'type':Sequelize[_0x230a('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x230a('0x3')]('Task','Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x230a('0x3')](_0x230a('0x4'),_0x230a('0x5'),_0x230a('0x6')),'defaultValue':_0x230a('0x4')},'moduleCreate':{'type':Sequelize[_0x230a('0x3')](_0x230a('0x7'),_0x230a('0x5'),_0x230a('0x6')),'defaultValue':_0x230a('0x6')}}; \ No newline at end of file +var _0x27cf=['contact_lead','contact','lead','nothing','sequelize','STRING','ENUM','Task','Case'];(function(_0x48a518,_0xe7a6bd){var _0x5c7c2a=function(_0x27f631){while(--_0x27f631){_0x48a518['push'](_0x48a518['shift']());}};_0x5c7c2a(++_0xe7a6bd);}(_0x27cf,0x79));var _0xf27c=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x27cf[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0xf27c('0x0'));module['exports']={'name':{'type':Sequelize[_0xf27c('0x1')]},'description':{'type':Sequelize[_0xf27c('0x1')]},'ticketType':{'type':Sequelize[_0xf27c('0x2')](_0xf27c('0x3'),_0xf27c('0x4')),'defaultValue':_0xf27c('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xf27c('0x5'),_0xf27c('0x6'),_0xf27c('0x7')),'defaultValue':_0xf27c('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0xf27c('0x8'),_0xf27c('0x6'),'lead'),'defaultValue':_0xf27c('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 017504e..b6f50ce 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 _0xb098=['nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','params','length','includeAll','include','create','body','find','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','getDescriptions','options','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../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','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','count','limit','set','Content-Range','apply','reject','save','destroy','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb098,0x195));var _0x8b09=function(_0x3b03bd,_0x184afe){_0x3b03bd=_0x3b03bd-0x0;var _0x51697b=_0xb098[_0x3b03bd];return _0x51697b;};'use strict';var pdf=require(_0x8b09('0x0'));var emlformat=require(_0x8b09('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b09('0x2'));var rp=require(_0x8b09('0x3'));var moment=require(_0x8b09('0x4'));var BPromise=require(_0x8b09('0x5'));var Mustache=require(_0x8b09('0x6'));var util=require(_0x8b09('0x7'));var path=require(_0x8b09('0x8'));var sox=require(_0x8b09('0x9'));var csv=require('to-csv');var ejs=require(_0x8b09('0xa'));var fs=require('fs');var _=require(_0x8b09('0xb'));var squel=require(_0x8b09('0xc'));var crypto=require(_0x8b09('0xd'));var jsforce=require(_0x8b09('0xe'));var deskjs=require(_0x8b09('0xf'));var toCsv=require(_0x8b09('0x10'));var querystring=require(_0x8b09('0x11'));var Papa=require('papaparse');var Redis=require(_0x8b09('0x12'));var authService=require(_0x8b09('0x13'));var qs=require(_0x8b09('0x14'));var as=require(_0x8b09('0x15'));var hardwareService=require(_0x8b09('0x16'));var logger=require(_0x8b09('0x17'))('api');var utils=require(_0x8b09('0x18'));var config=require(_0x8b09('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8b09('0x1a'));var client=jayson[_0x8b09('0x1b')][_0x8b09('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x239383,_0x57b055,_0x1b1fda){if(_0x1b1fda){var _0x529d4a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x529d4a[_0x8b09('0x1d')](_0x57b055)){return _0x239383;}else{throw new db[(_0x8b09('0x1e'))][(_0x8b09('0x1f'))](_0x8b09('0x20'));}}else{return _0x239383;}}function respondWithRpcPromise(_0x42661c,_0x22d885,_0x13b626,_0x5b24bb){return new BPromise(function(_0x39c6a5,_0x1e64b4){var _0x579ef0=_0x5b24bb||client;return _0x579ef0[_0x8b09('0x21')](_0x42661c,_0x13b626)[_0x8b09('0x22')](function(_0x1b0408){logger[_0x8b09('0x23')](_0x8b09('0x24'),_0x22d885,_0x8b09('0x25'));logger['debug'](_0x8b09('0x26'),_0x22d885,'request\x20sent',JSON['stringify'](_0x1b0408));if(_0x1b0408[_0x8b09('0x27')]){if(_0x1b0408[_0x8b09('0x27')][_0x8b09('0x28')]===0x1f4){logger[_0x8b09('0x27')]('SalesforceConfiguration,\x20%s,\x20%s',_0x22d885,_0x1b0408[_0x8b09('0x27')][_0x8b09('0x29')]);return _0x1e64b4(_0x1b0408[_0x8b09('0x27')][_0x8b09('0x29')]);}logger[_0x8b09('0x27')](_0x8b09('0x24'),_0x22d885,_0x1b0408[_0x8b09('0x27')][_0x8b09('0x29')]);return _0x39c6a5(_0x1b0408[_0x8b09('0x27')]['message']);}else{logger[_0x8b09('0x23')](_0x8b09('0x24'),_0x22d885,_0x8b09('0x25'));_0x39c6a5(_0x1b0408[_0x8b09('0x2a')][_0x8b09('0x29')]);}})[_0x8b09('0x2b')](function(_0x3b7c9f){logger[_0x8b09('0x27')](_0x8b09('0x24'),_0x22d885,_0x3b7c9f);_0x1e64b4(_0x3b7c9f);});});}function respondWithStatusCode(_0x191ab2,_0x5b72fe){_0x5b72fe=_0x5b72fe||0xcc;return function(_0xcba0dd){if(_0xcba0dd){return _0x191ab2['sendStatus'](_0x5b72fe);}return _0x191ab2['status'](_0x5b72fe)[_0x8b09('0x2c')]();};}function respondWithResult(_0x577417,_0x1aa74d){_0x1aa74d=_0x1aa74d||0xc8;return function(_0x3f2062){if(_0x3f2062){return _0x577417[_0x8b09('0x2d')](_0x1aa74d)[_0x8b09('0x2e')](_0x3f2062);}};}function respondWithFilteredResult(_0x4b440d,_0x5a9559){return function(_0x5d6151){if(_0x5d6151){var _0x28b0f6=_0x5d6151[_0x8b09('0x2f')],_0x4da224=_0x5a9559['offset'],_0x4bcf25=_0x5a9559['offset']+_0x5a9559[_0x8b09('0x30')],_0x34b6be;if(_0x4bcf25>=_0x28b0f6){_0x4bcf25=_0x28b0f6;_0x34b6be=0xc8;}else{_0x34b6be=0xce;}_0x4b440d[_0x8b09('0x2d')](_0x34b6be);return _0x4b440d[_0x8b09('0x31')](_0x8b09('0x32'),_0x4da224+'-'+_0x4bcf25+'/'+_0x28b0f6)[_0x8b09('0x2e')](_0x5d6151);}return null;};}function patchUpdates(_0x15804d){return function(_0x26f766){try{jsonpatch[_0x8b09('0x33')](_0x26f766,_0x15804d,!![]);}catch(_0xf1df93){return BPromise[_0x8b09('0x34')](_0xf1df93);}return _0x26f766[_0x8b09('0x35')]();};}function saveUpdates(_0x216498,_0x589a4a){return function(_0x17364f){if(_0x17364f){return _0x17364f['update'](_0x216498)[_0x8b09('0x22')](function(_0x33f090){return _0x33f090;});}return null;};}function removeEntity(_0x44d524,_0x5e276d){return function(_0x1d20b0){if(_0x1d20b0){return _0x1d20b0[_0x8b09('0x36')]()['then'](function(){_0x44d524[_0x8b09('0x2d')](0xcc)[_0x8b09('0x2c')]();});}};}function handleEntityNotFound(_0x31a7c3,_0x7b6d78){return function(_0x4278a7){if(!_0x4278a7){_0x31a7c3['sendStatus'](0x194);}return _0x4278a7;};}function handleError(_0x14e67a,_0x38f8aa){_0x38f8aa=_0x38f8aa||0x1f4;return function(_0x282c41){logger[_0x8b09('0x27')](_0x282c41['stack']);if(_0x282c41[_0x8b09('0x37')]){delete _0x282c41[_0x8b09('0x37')];}_0x14e67a[_0x8b09('0x2d')](_0x38f8aa)[_0x8b09('0x38')](_0x282c41);};}exports[_0x8b09('0x39')]=function(_0x192e13,_0x308644){var _0x52f4b1={},_0x4a8733={},_0x4ab240={'count':0x0,'rows':[]};var _0x17b073=_[_0x8b09('0x3a')](db[_0x8b09('0x3b')][_0x8b09('0x3c')],function(_0x23f046){return{'name':_0x23f046[_0x8b09('0x3d')],'type':_0x23f046[_0x8b09('0x3e')]['key']};});_0x4a8733[_0x8b09('0x3f')]=_[_0x8b09('0x3a')](_0x17b073,'name');_0x4a8733[_0x8b09('0x40')]=_[_0x8b09('0x41')](_0x192e13[_0x8b09('0x40')]);_0x4a8733[_0x8b09('0x42')]=_[_0x8b09('0x43')](_0x4a8733[_0x8b09('0x3f')],_0x4a8733[_0x8b09('0x40')]);_0x52f4b1['attributes']=_['intersection'](_0x4a8733[_0x8b09('0x3f')],qs[_0x8b09('0x44')](_0x192e13[_0x8b09('0x40')][_0x8b09('0x44')]));_0x52f4b1[_0x8b09('0x45')]=_0x52f4b1[_0x8b09('0x45')]['length']?_0x52f4b1[_0x8b09('0x45')]:_0x4a8733['model'];if(!_0x192e13[_0x8b09('0x40')]['hasOwnProperty'](_0x8b09('0x46'))){_0x52f4b1['limit']=qs[_0x8b09('0x30')](_0x192e13[_0x8b09('0x40')]['limit']);_0x52f4b1[_0x8b09('0x47')]=qs['offset'](_0x192e13[_0x8b09('0x40')][_0x8b09('0x47')]);}_0x52f4b1[_0x8b09('0x48')]=qs[_0x8b09('0x49')](_0x192e13[_0x8b09('0x40')]['sort']);_0x52f4b1[_0x8b09('0x4a')]=qs['filters'](_[_0x8b09('0x4b')](_0x192e13['query'],_0x4a8733[_0x8b09('0x42')]),_0x17b073);if(_0x192e13[_0x8b09('0x40')][_0x8b09('0x4c')]){_0x52f4b1[_0x8b09('0x4a')]=_['merge'](_0x52f4b1[_0x8b09('0x4a')],{'$or':_[_0x8b09('0x3a')](_0x17b073,function(_0x4fe39f){if(_0x4fe39f[_0x8b09('0x3e')]!==_0x8b09('0x4d')){var _0x5d0cb5={};_0x5d0cb5[_0x4fe39f[_0x8b09('0x37')]]={'$like':'%'+_0x192e13[_0x8b09('0x40')][_0x8b09('0x4c')]+'%'};return _0x5d0cb5;}})});}_0x52f4b1=_[_0x8b09('0x4e')]({},_0x52f4b1,_0x192e13['options']);var _0xe63eee={'where':_0x52f4b1[_0x8b09('0x4a')]};return db['SalesforceConfiguration'][_0x8b09('0x2f')](_0xe63eee)[_0x8b09('0x22')](function(_0x57fc2f){_0x4ab240[_0x8b09('0x2f')]=_0x57fc2f;if(_0x192e13[_0x8b09('0x40')]['includeAll']){_0x52f4b1['include']=[{'all':!![]}];}return db[_0x8b09('0x3b')][_0x8b09('0x4f')](_0x52f4b1);})['then'](function(_0x28ca7a){_0x4ab240[_0x8b09('0x50')]=_0x28ca7a;return _0x4ab240;})[_0x8b09('0x22')](respondWithFilteredResult(_0x308644,_0x52f4b1))['catch'](handleError(_0x308644,null));};exports['show']=function(_0x16df26,_0x29b957){var _0x10259c={'raw':![],'where':{'id':_0x16df26[_0x8b09('0x51')]['id']}},_0x29fa4c={};_0x29fa4c[_0x8b09('0x3f')]=_['keys'](db[_0x8b09('0x3b')][_0x8b09('0x3c')]);_0x29fa4c['query']=_[_0x8b09('0x41')](_0x16df26[_0x8b09('0x40')]);_0x29fa4c[_0x8b09('0x42')]=_[_0x8b09('0x43')](_0x29fa4c[_0x8b09('0x3f')],_0x29fa4c[_0x8b09('0x40')]);_0x10259c[_0x8b09('0x45')]=_['intersection'](_0x29fa4c['model'],qs[_0x8b09('0x44')](_0x16df26[_0x8b09('0x40')][_0x8b09('0x44')]));_0x10259c['attributes']=_0x10259c[_0x8b09('0x45')][_0x8b09('0x52')]?_0x10259c[_0x8b09('0x45')]:_0x29fa4c[_0x8b09('0x3f')];if(_0x16df26[_0x8b09('0x40')][_0x8b09('0x53')]){_0x10259c[_0x8b09('0x54')]=[{'all':!![]}];}_0x10259c=_[_0x8b09('0x4e')]({},_0x10259c,_0x16df26['options']);return db[_0x8b09('0x3b')]['find'](_0x10259c)[_0x8b09('0x22')](handleEntityNotFound(_0x29b957,null))[_0x8b09('0x22')](respondWithResult(_0x29b957,null))['catch'](handleError(_0x29b957,null));};exports[_0x8b09('0x55')]=function(_0xf24473,_0x1f949d){return db[_0x8b09('0x3b')][_0x8b09('0x55')](_0xf24473['body'],{})[_0x8b09('0x22')](respondWithResult(_0x1f949d,0xc9))[_0x8b09('0x2b')](handleError(_0x1f949d,null));};exports['update']=function(_0x56838e,_0x42bd30){if(_0x56838e['body']['id']){delete _0x56838e[_0x8b09('0x56')]['id'];}return db[_0x8b09('0x3b')][_0x8b09('0x57')]({'where':{'id':_0x56838e['params']['id']}})[_0x8b09('0x22')](handleEntityNotFound(_0x42bd30,null))[_0x8b09('0x22')](saveUpdates(_0x56838e[_0x8b09('0x56')],null))[_0x8b09('0x22')](respondWithResult(_0x42bd30,null))['catch'](handleError(_0x42bd30,null));};exports[_0x8b09('0x36')]=function(_0x1cc4e9,_0x291cb7){return db['SalesforceConfiguration']['find']({'where':{'id':_0x1cc4e9[_0x8b09('0x51')]['id']}})[_0x8b09('0x22')](handleEntityNotFound(_0x291cb7,null))[_0x8b09('0x22')](removeEntity(_0x291cb7,null))[_0x8b09('0x2b')](handleError(_0x291cb7,null));};exports[_0x8b09('0x58')]=function(_0x2eccac,_0xa1975e,_0x11f3b8){var _0x5c2af2={};var _0x56486c={};var _0x2c16d3;var _0x8a1ac9;return db['SalesforceConfiguration'][_0x8b09('0x59')]({'where':{'id':_0x2eccac[_0x8b09('0x51')]['id']}})[_0x8b09('0x22')](handleEntityNotFound(_0xa1975e,null))[_0x8b09('0x22')](function(_0x54adb8){if(_0x54adb8){_0x2c16d3=_0x54adb8;_0x56486c['model']=_[_0x8b09('0x41')](db[_0x8b09('0x5a')]['rawAttributes']);_0x56486c[_0x8b09('0x40')]=_[_0x8b09('0x41')](_0x2eccac[_0x8b09('0x40')]);_0x56486c[_0x8b09('0x42')]=_['intersection'](_0x56486c[_0x8b09('0x3f')],_0x56486c[_0x8b09('0x40')]);_0x5c2af2[_0x8b09('0x45')]=_[_0x8b09('0x43')](_0x56486c[_0x8b09('0x3f')],qs['fields'](_0x2eccac['query'][_0x8b09('0x44')]));_0x5c2af2[_0x8b09('0x45')]=_0x5c2af2['attributes'][_0x8b09('0x52')]?_0x5c2af2[_0x8b09('0x45')]:_0x56486c[_0x8b09('0x3f')];_0x5c2af2[_0x8b09('0x48')]=qs[_0x8b09('0x49')](_0x2eccac[_0x8b09('0x40')][_0x8b09('0x49')]);_0x5c2af2[_0x8b09('0x4a')]=qs[_0x8b09('0x42')](_[_0x8b09('0x4b')](_0x2eccac[_0x8b09('0x40')],_0x56486c[_0x8b09('0x42')]));if(_0x2eccac[_0x8b09('0x40')][_0x8b09('0x4c')]){_0x5c2af2['where']=_[_0x8b09('0x4e')](_0x5c2af2[_0x8b09('0x4a')],{'$or':_['map'](_0x5c2af2[_0x8b09('0x45')],function(_0x50fd62){var _0x5c6ab4={};_0x5c6ab4[_0x50fd62]={'$like':'%'+_0x2eccac[_0x8b09('0x40')]['filter']+'%'};return _0x5c6ab4;})});}_0x5c2af2=_[_0x8b09('0x4e')]({},_0x5c2af2,_0x2eccac['options']);return _0x2c16d3[_0x8b09('0x58')](_0x5c2af2);}})[_0x8b09('0x22')](function(_0x261746){if(_0x261746){_0x8a1ac9=_0x261746[_0x8b09('0x52')];if(!_0x2eccac[_0x8b09('0x40')][_0x8b09('0x5b')](_0x8b09('0x46'))){_0x5c2af2[_0x8b09('0x30')]=qs['limit'](_0x2eccac[_0x8b09('0x40')][_0x8b09('0x30')]);_0x5c2af2[_0x8b09('0x47')]=qs[_0x8b09('0x47')](_0x2eccac[_0x8b09('0x40')][_0x8b09('0x47')]);}return _0x2c16d3[_0x8b09('0x58')](_0x5c2af2);}})['then'](function(_0x480228){if(_0x480228){return _0x480228?{'count':_0x8a1ac9,'rows':_0x480228}:null;}})[_0x8b09('0x22')](respondWithResult(_0xa1975e,null))[_0x8b09('0x2b')](handleError(_0xa1975e,null));};exports['getSubjects']=function(_0x3613f6,_0x21901e,_0x30fbb1){var _0x12a433={};var _0x2facea={};var _0x922fed;var _0x5bb979;return db['SalesforceConfiguration'][_0x8b09('0x59')]({'where':{'id':_0x3613f6[_0x8b09('0x51')]['id']}})['then'](handleEntityNotFound(_0x21901e,null))[_0x8b09('0x22')](function(_0x370ecb){if(_0x370ecb){_0x922fed=_0x370ecb;_0x2facea[_0x8b09('0x3f')]=_[_0x8b09('0x41')](db[_0x8b09('0x5a')][_0x8b09('0x3c')]);_0x2facea[_0x8b09('0x40')]=_[_0x8b09('0x41')](_0x3613f6['query']);_0x2facea[_0x8b09('0x42')]=_[_0x8b09('0x43')](_0x2facea['model'],_0x2facea[_0x8b09('0x40')]);_0x12a433[_0x8b09('0x45')]=_[_0x8b09('0x43')](_0x2facea[_0x8b09('0x3f')],qs[_0x8b09('0x44')](_0x3613f6[_0x8b09('0x40')][_0x8b09('0x44')]));_0x12a433['attributes']=_0x12a433[_0x8b09('0x45')][_0x8b09('0x52')]?_0x12a433[_0x8b09('0x45')]:_0x2facea[_0x8b09('0x3f')];_0x12a433[_0x8b09('0x48')]=qs[_0x8b09('0x49')](_0x3613f6['query']['sort']);_0x12a433['where']=qs[_0x8b09('0x42')](_[_0x8b09('0x4b')](_0x3613f6[_0x8b09('0x40')],_0x2facea[_0x8b09('0x42')]));if(_0x3613f6[_0x8b09('0x40')][_0x8b09('0x4c')]){_0x12a433['where']=_['merge'](_0x12a433['where'],{'$or':_[_0x8b09('0x3a')](_0x12a433[_0x8b09('0x45')],function(_0x420d8d){var _0x198efa={};_0x198efa[_0x420d8d]={'$like':'%'+_0x3613f6[_0x8b09('0x40')][_0x8b09('0x4c')]+'%'};return _0x198efa;})});}_0x12a433=_['merge']({},_0x12a433,_0x3613f6['options']);return _0x922fed[_0x8b09('0x5c')](_0x12a433);}})['then'](function(_0x272574){if(_0x272574){_0x5bb979=_0x272574['length'];if(!_0x3613f6[_0x8b09('0x40')][_0x8b09('0x5b')]('nolimit')){_0x12a433[_0x8b09('0x30')]=qs[_0x8b09('0x30')](_0x3613f6[_0x8b09('0x40')][_0x8b09('0x30')]);_0x12a433[_0x8b09('0x47')]=qs[_0x8b09('0x47')](_0x3613f6[_0x8b09('0x40')][_0x8b09('0x47')]);}return _0x922fed[_0x8b09('0x5c')](_0x12a433);}})[_0x8b09('0x22')](function(_0xdff93b){if(_0xdff93b){return _0xdff93b?{'count':_0x5bb979,'rows':_0xdff93b}:null;}})[_0x8b09('0x22')](respondWithResult(_0x21901e,null))[_0x8b09('0x2b')](handleError(_0x21901e,null));};exports[_0x8b09('0x5d')]=function(_0x829a15,_0x54b2fe,_0x569c92){var _0x5e94e8={};var _0x225be1={};var _0x2d4836;var _0x34b869;return db['SalesforceConfiguration'][_0x8b09('0x59')]({'where':{'id':_0x829a15[_0x8b09('0x51')]['id']}})[_0x8b09('0x22')](handleEntityNotFound(_0x54b2fe,null))[_0x8b09('0x22')](function(_0x55d7c4){if(_0x55d7c4){_0x2d4836=_0x55d7c4;_0x225be1[_0x8b09('0x3f')]=_[_0x8b09('0x41')](db[_0x8b09('0x5a')][_0x8b09('0x3c')]);_0x225be1[_0x8b09('0x40')]=_[_0x8b09('0x41')](_0x829a15[_0x8b09('0x40')]);_0x225be1[_0x8b09('0x42')]=_[_0x8b09('0x43')](_0x225be1[_0x8b09('0x3f')],_0x225be1[_0x8b09('0x40')]);_0x5e94e8['attributes']=_[_0x8b09('0x43')](_0x225be1['model'],qs[_0x8b09('0x44')](_0x829a15[_0x8b09('0x40')][_0x8b09('0x44')]));_0x5e94e8['attributes']=_0x5e94e8[_0x8b09('0x45')]['length']?_0x5e94e8[_0x8b09('0x45')]:_0x225be1[_0x8b09('0x3f')];_0x5e94e8[_0x8b09('0x48')]=qs['sort'](_0x829a15['query'][_0x8b09('0x49')]);_0x5e94e8['where']=qs['filters'](_[_0x8b09('0x4b')](_0x829a15[_0x8b09('0x40')],_0x225be1[_0x8b09('0x42')]));if(_0x829a15['query']['filter']){_0x5e94e8[_0x8b09('0x4a')]=_[_0x8b09('0x4e')](_0x5e94e8[_0x8b09('0x4a')],{'$or':_['map'](_0x5e94e8['attributes'],function(_0x13dce4){var _0x40c96c={};_0x40c96c[_0x13dce4]={'$like':'%'+_0x829a15[_0x8b09('0x40')][_0x8b09('0x4c')]+'%'};return _0x40c96c;})});}_0x5e94e8=_[_0x8b09('0x4e')]({},_0x5e94e8,_0x829a15[_0x8b09('0x5e')]);return _0x2d4836[_0x8b09('0x5d')](_0x5e94e8);}})[_0x8b09('0x22')](function(_0x4ba70c){if(_0x4ba70c){_0x34b869=_0x4ba70c[_0x8b09('0x52')];if(!_0x829a15[_0x8b09('0x40')][_0x8b09('0x5b')]('nolimit')){_0x5e94e8[_0x8b09('0x30')]=qs[_0x8b09('0x30')](_0x829a15['query']['limit']);_0x5e94e8[_0x8b09('0x47')]=qs['offset'](_0x829a15['query'][_0x8b09('0x47')]);}return _0x2d4836[_0x8b09('0x5d')](_0x5e94e8);}})['then'](function(_0x8fb0a5){if(_0x8fb0a5){return _0x8fb0a5?{'count':_0x34b869,'rows':_0x8fb0a5}:null;}})[_0x8b09('0x22')](respondWithResult(_0x54b2fe,null))['catch'](handleError(_0x54b2fe,null));}; \ No newline at end of file +var _0xfbdb=['stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','SalesforceConfiguration','findAll','show','params','filters','options','find','create','body','getFields','findOne','rawAttributes','pick','hasOwnProperty','SalesforceField','getSubjects','getDescriptions','html-pdf','rimraf','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','../../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','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x4c8244,_0x233d0c){var _0x771972=function(_0x44dd52){while(--_0x44dd52){_0x4c8244['push'](_0x4c8244['shift']());}};_0x771972(++_0x233d0c);}(_0xfbdb,0x1ba));var _0xbfbd=function(_0x487b9c,_0x57eca6){_0x487b9c=_0x487b9c-0x0;var _0x21acf7=_0xfbdb[_0x487b9c];return _0x21acf7;};'use strict';var pdf=require(_0xbfbd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbfbd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbfbd('0x2'));var rp=require(_0xbfbd('0x3'));var moment=require(_0xbfbd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbfbd('0x5'));var util=require(_0xbfbd('0x6'));var path=require(_0xbfbd('0x7'));var sox=require(_0xbfbd('0x8'));var csv=require(_0xbfbd('0x9'));var ejs=require(_0xbfbd('0xa'));var fs=require('fs');var _=require(_0xbfbd('0xb'));var squel=require(_0xbfbd('0xc'));var crypto=require(_0xbfbd('0xd'));var jsforce=require(_0xbfbd('0xe'));var deskjs=require(_0xbfbd('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbfbd('0x10'));var Papa=require(_0xbfbd('0x11'));var Redis=require(_0xbfbd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbfbd('0x13'));var as=require(_0xbfbd('0x14'));var hardwareService=require(_0xbfbd('0x15'));var logger=require(_0xbfbd('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xbfbd('0x17'));var db=require(_0xbfbd('0x18'))['db'];var jayson=require(_0xbfbd('0x19'));var client=jayson[_0xbfbd('0x1a')][_0xbfbd('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2ce0a8,_0x576b44,_0x53d59c){if(_0x53d59c){var _0x580240=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x580240[_0xbfbd('0x1c')](_0x576b44)){return _0x2ce0a8;}else{throw new db['Sequelize'][(_0xbfbd('0x1d'))](_0xbfbd('0x1e'));}}else{return _0x2ce0a8;}}function respondWithRpcPromise(_0x5c4512,_0x466e65,_0x91dccd,_0x3060ca){return new BPromise(function(_0x1ae3f7,_0x11dc6c){var _0x5854e9=_0x3060ca||client;return _0x5854e9[_0xbfbd('0x1f')](_0x5c4512,_0x91dccd)[_0xbfbd('0x20')](function(_0x4786b8){logger[_0xbfbd('0x21')](_0xbfbd('0x22'),_0x466e65,_0xbfbd('0x23'));logger[_0xbfbd('0x24')](_0xbfbd('0x25'),_0x466e65,_0xbfbd('0x23'),JSON[_0xbfbd('0x26')](_0x4786b8));if(_0x4786b8[_0xbfbd('0x27')]){if(_0x4786b8['error']['code']===0x1f4){logger['error'](_0xbfbd('0x22'),_0x466e65,_0x4786b8[_0xbfbd('0x27')][_0xbfbd('0x28')]);return _0x11dc6c(_0x4786b8['error'][_0xbfbd('0x28')]);}logger[_0xbfbd('0x27')](_0xbfbd('0x22'),_0x466e65,_0x4786b8[_0xbfbd('0x27')][_0xbfbd('0x28')]);return _0x1ae3f7(_0x4786b8[_0xbfbd('0x27')][_0xbfbd('0x28')]);}else{logger[_0xbfbd('0x21')](_0xbfbd('0x22'),_0x466e65,'request\x20sent');_0x1ae3f7(_0x4786b8[_0xbfbd('0x29')]['message']);}})[_0xbfbd('0x2a')](function(_0x21db3e){logger[_0xbfbd('0x27')](_0xbfbd('0x22'),_0x466e65,_0x21db3e);_0x11dc6c(_0x21db3e);});});}function respondWithStatusCode(_0x6fad3a,_0x1ca7f8){_0x1ca7f8=_0x1ca7f8||0xcc;return function(_0x1bbfc7){if(_0x1bbfc7){return _0x6fad3a[_0xbfbd('0x2b')](_0x1ca7f8);}return _0x6fad3a['status'](_0x1ca7f8)[_0xbfbd('0x2c')]();};}function respondWithResult(_0x22d039,_0x41bbdb){_0x41bbdb=_0x41bbdb||0xc8;return function(_0x213182){if(_0x213182){return _0x22d039['status'](_0x41bbdb)[_0xbfbd('0x2d')](_0x213182);}};}function respondWithFilteredResult(_0x4c9bc3,_0x3d4155){return function(_0x60b113){if(_0x60b113){var _0x5ad745=_0x60b113[_0xbfbd('0x2e')],_0x19ac8a=_0x3d4155[_0xbfbd('0x2f')],_0x154aa2=_0x3d4155['offset']+_0x3d4155[_0xbfbd('0x30')],_0x15571f;if(_0x154aa2>=_0x5ad745){_0x154aa2=_0x5ad745;_0x15571f=0xc8;}else{_0x15571f=0xce;}_0x4c9bc3[_0xbfbd('0x31')](_0x15571f);return _0x4c9bc3[_0xbfbd('0x32')](_0xbfbd('0x33'),_0x19ac8a+'-'+_0x154aa2+'/'+_0x5ad745)['json'](_0x60b113);}return null;};}function patchUpdates(_0x462335){return function(_0x7a3fd4){try{jsonpatch[_0xbfbd('0x34')](_0x7a3fd4,_0x462335,!![]);}catch(_0x540245){return BPromise[_0xbfbd('0x35')](_0x540245);}return _0x7a3fd4[_0xbfbd('0x36')]();};}function saveUpdates(_0x34989a,_0x1ee4a2){return function(_0x36944c){if(_0x36944c){return _0x36944c[_0xbfbd('0x37')](_0x34989a)[_0xbfbd('0x20')](function(_0x44aa5d){return _0x44aa5d;});}return null;};}function removeEntity(_0xfa16d4,_0x20cad0){return function(_0x191316){if(_0x191316){return _0x191316[_0xbfbd('0x38')]()[_0xbfbd('0x20')](function(){_0xfa16d4[_0xbfbd('0x31')](0xcc)[_0xbfbd('0x2c')]();});}};}function handleEntityNotFound(_0xe9c86,_0x270921){return function(_0x414aff){if(!_0x414aff){_0xe9c86[_0xbfbd('0x2b')](0x194);}return _0x414aff;};}function handleError(_0x3c0b0a,_0x21437){_0x21437=_0x21437||0x1f4;return function(_0x4ad8ae){logger[_0xbfbd('0x27')](_0x4ad8ae[_0xbfbd('0x39')]);if(_0x4ad8ae[_0xbfbd('0x3a')]){delete _0x4ad8ae[_0xbfbd('0x3a')];}_0x3c0b0a['status'](_0x21437)['send'](_0x4ad8ae);};}exports[_0xbfbd('0x3b')]=function(_0x5e106d,_0x4cd1f0){var _0x2d63e4={},_0x12730e={},_0x513692={'count':0x0,'rows':[]};var _0x30e703=_[_0xbfbd('0x3c')](db['SalesforceConfiguration']['rawAttributes'],function(_0xdddfd1){return{'name':_0xdddfd1['fieldName'],'type':_0xdddfd1['type'][_0xbfbd('0x3d')]};});_0x12730e[_0xbfbd('0x3e')]=_[_0xbfbd('0x3c')](_0x30e703,_0xbfbd('0x3a'));_0x12730e[_0xbfbd('0x3f')]=_[_0xbfbd('0x40')](_0x5e106d[_0xbfbd('0x3f')]);_0x12730e['filters']=_[_0xbfbd('0x41')](_0x12730e['model'],_0x12730e['query']);_0x2d63e4[_0xbfbd('0x42')]=_[_0xbfbd('0x41')](_0x12730e['model'],qs[_0xbfbd('0x43')](_0x5e106d[_0xbfbd('0x3f')][_0xbfbd('0x43')]));_0x2d63e4[_0xbfbd('0x42')]=_0x2d63e4[_0xbfbd('0x42')][_0xbfbd('0x44')]?_0x2d63e4[_0xbfbd('0x42')]:_0x12730e['model'];if(!_0x5e106d[_0xbfbd('0x3f')]['hasOwnProperty'](_0xbfbd('0x45'))){_0x2d63e4[_0xbfbd('0x30')]=qs[_0xbfbd('0x30')](_0x5e106d[_0xbfbd('0x3f')]['limit']);_0x2d63e4[_0xbfbd('0x2f')]=qs[_0xbfbd('0x2f')](_0x5e106d[_0xbfbd('0x3f')][_0xbfbd('0x2f')]);}_0x2d63e4[_0xbfbd('0x46')]=qs[_0xbfbd('0x47')](_0x5e106d['query']['sort']);_0x2d63e4[_0xbfbd('0x48')]=qs['filters'](_['pick'](_0x5e106d[_0xbfbd('0x3f')],_0x12730e['filters']),_0x30e703);if(_0x5e106d[_0xbfbd('0x3f')][_0xbfbd('0x49')]){_0x2d63e4['where']=_[_0xbfbd('0x4a')](_0x2d63e4['where'],{'$or':_[_0xbfbd('0x3c')](_0x30e703,function(_0x456127){if(_0x456127[_0xbfbd('0x4b')]!==_0xbfbd('0x4c')){var _0x41a9e4={};_0x41a9e4[_0x456127['name']]={'$like':'%'+_0x5e106d[_0xbfbd('0x3f')][_0xbfbd('0x49')]+'%'};return _0x41a9e4;}})});}_0x2d63e4=_[_0xbfbd('0x4a')]({},_0x2d63e4,_0x5e106d['options']);var _0x1ac183={'where':_0x2d63e4[_0xbfbd('0x48')]};return db['SalesforceConfiguration'][_0xbfbd('0x2e')](_0x1ac183)[_0xbfbd('0x20')](function(_0x7f8002){_0x513692[_0xbfbd('0x2e')]=_0x7f8002;if(_0x5e106d['query'][_0xbfbd('0x4d')]){_0x2d63e4[_0xbfbd('0x4e')]=[{'all':!![]}];}return db[_0xbfbd('0x4f')][_0xbfbd('0x50')](_0x2d63e4);})['then'](function(_0x16d07a){_0x513692['rows']=_0x16d07a;return _0x513692;})[_0xbfbd('0x20')](respondWithFilteredResult(_0x4cd1f0,_0x2d63e4))[_0xbfbd('0x2a')](handleError(_0x4cd1f0,null));};exports[_0xbfbd('0x51')]=function(_0x18f5ac,_0x145cff){var _0x462eef={'raw':![],'where':{'id':_0x18f5ac[_0xbfbd('0x52')]['id']}},_0x473fc4={};_0x473fc4[_0xbfbd('0x3e')]=_['keys'](db[_0xbfbd('0x4f')]['rawAttributes']);_0x473fc4[_0xbfbd('0x3f')]=_[_0xbfbd('0x40')](_0x18f5ac[_0xbfbd('0x3f')]);_0x473fc4[_0xbfbd('0x53')]=_['intersection'](_0x473fc4[_0xbfbd('0x3e')],_0x473fc4[_0xbfbd('0x3f')]);_0x462eef[_0xbfbd('0x42')]=_['intersection'](_0x473fc4[_0xbfbd('0x3e')],qs[_0xbfbd('0x43')](_0x18f5ac['query'][_0xbfbd('0x43')]));_0x462eef[_0xbfbd('0x42')]=_0x462eef[_0xbfbd('0x42')][_0xbfbd('0x44')]?_0x462eef['attributes']:_0x473fc4[_0xbfbd('0x3e')];if(_0x18f5ac[_0xbfbd('0x3f')][_0xbfbd('0x4d')]){_0x462eef[_0xbfbd('0x4e')]=[{'all':!![]}];}_0x462eef=_['merge']({},_0x462eef,_0x18f5ac[_0xbfbd('0x54')]);return db[_0xbfbd('0x4f')][_0xbfbd('0x55')](_0x462eef)[_0xbfbd('0x20')](handleEntityNotFound(_0x145cff,null))['then'](respondWithResult(_0x145cff,null))['catch'](handleError(_0x145cff,null));};exports[_0xbfbd('0x56')]=function(_0x256652,_0x664fcd){return db[_0xbfbd('0x4f')][_0xbfbd('0x56')](_0x256652[_0xbfbd('0x57')],{})[_0xbfbd('0x20')](respondWithResult(_0x664fcd,0xc9))[_0xbfbd('0x2a')](handleError(_0x664fcd,null));};exports[_0xbfbd('0x37')]=function(_0x4f60da,_0x30dfb0){if(_0x4f60da['body']['id']){delete _0x4f60da[_0xbfbd('0x57')]['id'];}return db[_0xbfbd('0x4f')]['find']({'where':{'id':_0x4f60da[_0xbfbd('0x52')]['id']}})[_0xbfbd('0x20')](handleEntityNotFound(_0x30dfb0,null))[_0xbfbd('0x20')](saveUpdates(_0x4f60da[_0xbfbd('0x57')],null))[_0xbfbd('0x20')](respondWithResult(_0x30dfb0,null))[_0xbfbd('0x2a')](handleError(_0x30dfb0,null));};exports[_0xbfbd('0x38')]=function(_0x4f6cec,_0x349287){return db[_0xbfbd('0x4f')][_0xbfbd('0x55')]({'where':{'id':_0x4f6cec[_0xbfbd('0x52')]['id']}})[_0xbfbd('0x20')](handleEntityNotFound(_0x349287,null))[_0xbfbd('0x20')](removeEntity(_0x349287,null))[_0xbfbd('0x2a')](handleError(_0x349287,null));};exports[_0xbfbd('0x58')]=function(_0x8fb02c,_0x2e539a,_0x5d6105){var _0x5405d1={};var _0x5b08e9={};var _0x537a95;var _0x15550b;return db[_0xbfbd('0x4f')][_0xbfbd('0x59')]({'where':{'id':_0x8fb02c[_0xbfbd('0x52')]['id']}})[_0xbfbd('0x20')](handleEntityNotFound(_0x2e539a,null))[_0xbfbd('0x20')](function(_0x2de5d1){if(_0x2de5d1){_0x537a95=_0x2de5d1;_0x5b08e9[_0xbfbd('0x3e')]=_[_0xbfbd('0x40')](db['SalesforceField'][_0xbfbd('0x5a')]);_0x5b08e9[_0xbfbd('0x3f')]=_[_0xbfbd('0x40')](_0x8fb02c[_0xbfbd('0x3f')]);_0x5b08e9[_0xbfbd('0x53')]=_[_0xbfbd('0x41')](_0x5b08e9[_0xbfbd('0x3e')],_0x5b08e9[_0xbfbd('0x3f')]);_0x5405d1[_0xbfbd('0x42')]=_[_0xbfbd('0x41')](_0x5b08e9['model'],qs[_0xbfbd('0x43')](_0x8fb02c[_0xbfbd('0x3f')][_0xbfbd('0x43')]));_0x5405d1[_0xbfbd('0x42')]=_0x5405d1[_0xbfbd('0x42')]['length']?_0x5405d1['attributes']:_0x5b08e9[_0xbfbd('0x3e')];_0x5405d1[_0xbfbd('0x46')]=qs[_0xbfbd('0x47')](_0x8fb02c[_0xbfbd('0x3f')]['sort']);_0x5405d1[_0xbfbd('0x48')]=qs[_0xbfbd('0x53')](_[_0xbfbd('0x5b')](_0x8fb02c['query'],_0x5b08e9[_0xbfbd('0x53')]));if(_0x8fb02c[_0xbfbd('0x3f')][_0xbfbd('0x49')]){_0x5405d1[_0xbfbd('0x48')]=_['merge'](_0x5405d1[_0xbfbd('0x48')],{'$or':_[_0xbfbd('0x3c')](_0x5405d1[_0xbfbd('0x42')],function(_0x2c18ea){var _0x253f23={};_0x253f23[_0x2c18ea]={'$like':'%'+_0x8fb02c[_0xbfbd('0x3f')][_0xbfbd('0x49')]+'%'};return _0x253f23;})});}_0x5405d1=_['merge']({},_0x5405d1,_0x8fb02c[_0xbfbd('0x54')]);return _0x537a95[_0xbfbd('0x58')](_0x5405d1);}})[_0xbfbd('0x20')](function(_0x333aa5){if(_0x333aa5){_0x15550b=_0x333aa5[_0xbfbd('0x44')];if(!_0x8fb02c[_0xbfbd('0x3f')][_0xbfbd('0x5c')](_0xbfbd('0x45'))){_0x5405d1['limit']=qs[_0xbfbd('0x30')](_0x8fb02c[_0xbfbd('0x3f')]['limit']);_0x5405d1['offset']=qs[_0xbfbd('0x2f')](_0x8fb02c[_0xbfbd('0x3f')]['offset']);}return _0x537a95[_0xbfbd('0x58')](_0x5405d1);}})[_0xbfbd('0x20')](function(_0x44380c){if(_0x44380c){return _0x44380c?{'count':_0x15550b,'rows':_0x44380c}:null;}})[_0xbfbd('0x20')](respondWithResult(_0x2e539a,null))['catch'](handleError(_0x2e539a,null));};exports['getSubjects']=function(_0x5ab3d1,_0x55508c,_0x1cea8a){var _0x2ab727={};var _0xb1ea48={};var _0x39c73b;var _0xdbcc3c;return db[_0xbfbd('0x4f')]['findOne']({'where':{'id':_0x5ab3d1['params']['id']}})['then'](handleEntityNotFound(_0x55508c,null))[_0xbfbd('0x20')](function(_0x46e80a){if(_0x46e80a){_0x39c73b=_0x46e80a;_0xb1ea48[_0xbfbd('0x3e')]=_['keys'](db[_0xbfbd('0x5d')][_0xbfbd('0x5a')]);_0xb1ea48['query']=_[_0xbfbd('0x40')](_0x5ab3d1[_0xbfbd('0x3f')]);_0xb1ea48[_0xbfbd('0x53')]=_[_0xbfbd('0x41')](_0xb1ea48[_0xbfbd('0x3e')],_0xb1ea48['query']);_0x2ab727[_0xbfbd('0x42')]=_[_0xbfbd('0x41')](_0xb1ea48['model'],qs[_0xbfbd('0x43')](_0x5ab3d1[_0xbfbd('0x3f')][_0xbfbd('0x43')]));_0x2ab727['attributes']=_0x2ab727['attributes'][_0xbfbd('0x44')]?_0x2ab727[_0xbfbd('0x42')]:_0xb1ea48['model'];_0x2ab727['order']=qs['sort'](_0x5ab3d1[_0xbfbd('0x3f')][_0xbfbd('0x47')]);_0x2ab727[_0xbfbd('0x48')]=qs['filters'](_[_0xbfbd('0x5b')](_0x5ab3d1[_0xbfbd('0x3f')],_0xb1ea48[_0xbfbd('0x53')]));if(_0x5ab3d1['query'][_0xbfbd('0x49')]){_0x2ab727[_0xbfbd('0x48')]=_[_0xbfbd('0x4a')](_0x2ab727[_0xbfbd('0x48')],{'$or':_[_0xbfbd('0x3c')](_0x2ab727['attributes'],function(_0xc63ebd){var _0x356e5c={};_0x356e5c[_0xc63ebd]={'$like':'%'+_0x5ab3d1[_0xbfbd('0x3f')][_0xbfbd('0x49')]+'%'};return _0x356e5c;})});}_0x2ab727=_[_0xbfbd('0x4a')]({},_0x2ab727,_0x5ab3d1['options']);return _0x39c73b[_0xbfbd('0x5e')](_0x2ab727);}})[_0xbfbd('0x20')](function(_0xe28a75){if(_0xe28a75){_0xdbcc3c=_0xe28a75[_0xbfbd('0x44')];if(!_0x5ab3d1['query'][_0xbfbd('0x5c')](_0xbfbd('0x45'))){_0x2ab727[_0xbfbd('0x30')]=qs['limit'](_0x5ab3d1[_0xbfbd('0x3f')][_0xbfbd('0x30')]);_0x2ab727[_0xbfbd('0x2f')]=qs['offset'](_0x5ab3d1['query']['offset']);}return _0x39c73b['getSubjects'](_0x2ab727);}})[_0xbfbd('0x20')](function(_0x5a479c){if(_0x5a479c){return _0x5a479c?{'count':_0xdbcc3c,'rows':_0x5a479c}:null;}})['then'](respondWithResult(_0x55508c,null))[_0xbfbd('0x2a')](handleError(_0x55508c,null));};exports['getDescriptions']=function(_0x92c919,_0x2a18ad,_0x502a1a){var _0x4b4c44={};var _0x49cb24={};var _0x446fc5;var _0x4ebcb3;return db['SalesforceConfiguration'][_0xbfbd('0x59')]({'where':{'id':_0x92c919[_0xbfbd('0x52')]['id']}})[_0xbfbd('0x20')](handleEntityNotFound(_0x2a18ad,null))['then'](function(_0x316eba){if(_0x316eba){_0x446fc5=_0x316eba;_0x49cb24[_0xbfbd('0x3e')]=_[_0xbfbd('0x40')](db[_0xbfbd('0x5d')][_0xbfbd('0x5a')]);_0x49cb24[_0xbfbd('0x3f')]=_[_0xbfbd('0x40')](_0x92c919[_0xbfbd('0x3f')]);_0x49cb24[_0xbfbd('0x53')]=_[_0xbfbd('0x41')](_0x49cb24['model'],_0x49cb24[_0xbfbd('0x3f')]);_0x4b4c44['attributes']=_['intersection'](_0x49cb24[_0xbfbd('0x3e')],qs[_0xbfbd('0x43')](_0x92c919[_0xbfbd('0x3f')][_0xbfbd('0x43')]));_0x4b4c44['attributes']=_0x4b4c44[_0xbfbd('0x42')][_0xbfbd('0x44')]?_0x4b4c44[_0xbfbd('0x42')]:_0x49cb24[_0xbfbd('0x3e')];_0x4b4c44[_0xbfbd('0x46')]=qs['sort'](_0x92c919['query'][_0xbfbd('0x47')]);_0x4b4c44[_0xbfbd('0x48')]=qs['filters'](_[_0xbfbd('0x5b')](_0x92c919['query'],_0x49cb24[_0xbfbd('0x53')]));if(_0x92c919[_0xbfbd('0x3f')][_0xbfbd('0x49')]){_0x4b4c44['where']=_[_0xbfbd('0x4a')](_0x4b4c44[_0xbfbd('0x48')],{'$or':_[_0xbfbd('0x3c')](_0x4b4c44[_0xbfbd('0x42')],function(_0x1eb844){var _0x3cbf29={};_0x3cbf29[_0x1eb844]={'$like':'%'+_0x92c919[_0xbfbd('0x3f')][_0xbfbd('0x49')]+'%'};return _0x3cbf29;})});}_0x4b4c44=_['merge']({},_0x4b4c44,_0x92c919[_0xbfbd('0x54')]);return _0x446fc5[_0xbfbd('0x5f')](_0x4b4c44);}})['then'](function(_0x43555e){if(_0x43555e){_0x4ebcb3=_0x43555e[_0xbfbd('0x44')];if(!_0x92c919[_0xbfbd('0x3f')][_0xbfbd('0x5c')]('nolimit')){_0x4b4c44[_0xbfbd('0x30')]=qs['limit'](_0x92c919[_0xbfbd('0x3f')][_0xbfbd('0x30')]);_0x4b4c44[_0xbfbd('0x2f')]=qs[_0xbfbd('0x2f')](_0x92c919[_0xbfbd('0x3f')][_0xbfbd('0x2f')]);}return _0x446fc5['getDescriptions'](_0x4b4c44);}})[_0xbfbd('0x20')](function(_0x3012eb){if(_0x3012eb){return _0x3012eb?{'count':_0x4ebcb3,'rows':_0x3012eb}:null;}})[_0xbfbd('0x20')](respondWithResult(_0x2a18ad,null))[_0xbfbd('0x2a')](handleError(_0x2a18ad,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index be64fe8..579b573 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 _0xca33=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0xca33,0xd8));var _0x3ca3=function(_0x3b5e5a,_0x377383){_0x3b5e5a=_0x3b5e5a-0x0;var _0x3b9104=_0xca33[_0x3b5e5a];return _0x3b9104;};'use strict';var _=require('lodash');var util=require(_0x3ca3('0x0'));var logger=require(_0x3ca3('0x1'))(_0x3ca3('0x2'));var moment=require(_0x3ca3('0x3'));var BPromise=require(_0x3ca3('0x4'));var rp=require(_0x3ca3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ca3('0x6'));var config=require(_0x3ca3('0x7'));var attributes=require(_0x3ca3('0x8'));module[_0x3ca3('0x9')]=function(_0x390537,_0x469251){return _0x390537[_0x3ca3('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x3ca3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfe4=['request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfe4,0x181));var _0x4cfe=function(_0x364f7e,_0x49cf4d){_0x364f7e=_0x364f7e-0x0;var _0x5e698b=_0xcfe4[_0x364f7e];return _0x5e698b;};'use strict';var _=require(_0x4cfe('0x0'));var util=require(_0x4cfe('0x1'));var logger=require('../../config/logger')(_0x4cfe('0x2'));var moment=require(_0x4cfe('0x3'));var BPromise=require(_0x4cfe('0x4'));var rp=require(_0x4cfe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cfe('0x6'));var config=require(_0x4cfe('0x7'));var attributes=require(_0x4cfe('0x8'));module[_0x4cfe('0x9')]=function(_0x16f281,_0x4b1ac7){return _0x16f281[_0x4cfe('0xa')](_0x4cfe('0xb'),attributes,{'tableName':_0x4cfe('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 2f99094..45cedd1 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 _0x1e7d=['../../config/logger','../../config/environment','jayson/promise','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x45d051,_0x42fe35){var _0x3875e3=function(_0x26c9a8){while(--_0x26c9a8){_0x45d051['push'](_0x45d051['shift']());}};_0x3875e3(++_0x42fe35);}(_0x1e7d,0x1f3));var _0xd1e7=function(_0x3f0bf1,_0x10dfe2){_0x3f0bf1=_0x3f0bf1-0x0;var _0x3ae7a4=_0x1e7d[_0x3f0bf1];return _0x3ae7a4;};'use strict';var _=require(_0xd1e7('0x0'));var util=require(_0xd1e7('0x1'));var moment=require(_0xd1e7('0x2'));var BPromise=require(_0xd1e7('0x3'));var rs=require(_0xd1e7('0x4'));var fs=require('fs');var Redis=require(_0xd1e7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1e7('0x6'));var logger=require(_0xd1e7('0x7'))('rpc');var config=require(_0xd1e7('0x8'));var jayson=require(_0xd1e7('0x9'));var client=jayson['client'][_0xd1e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58270b,_0x161732,_0x49208e){return new BPromise(function(_0x9e91bd,_0x10a814){return client[_0xd1e7('0xb')](_0x58270b,_0x49208e)[_0xd1e7('0xc')](function(_0xb1aad3){logger['info'](_0xd1e7('0xd'),_0x161732,_0xd1e7('0xe'));logger['debug'](_0xd1e7('0xf'),_0x161732,'request\x20sent',JSON[_0xd1e7('0x10')](_0xb1aad3));if(_0xb1aad3[_0xd1e7('0x11')]){if(_0xb1aad3[_0xd1e7('0x11')][_0xd1e7('0x12')]===0x1f4){logger[_0xd1e7('0x11')](_0xd1e7('0xd'),_0x161732,_0xb1aad3['error'][_0xd1e7('0x13')]);return _0x10a814(_0xb1aad3['error'][_0xd1e7('0x13')]);}logger[_0xd1e7('0x11')](_0xd1e7('0xd'),_0x161732,_0xb1aad3[_0xd1e7('0x11')][_0xd1e7('0x13')]);return _0x9e91bd(_0xb1aad3[_0xd1e7('0x11')]['message']);}else{logger['info'](_0xd1e7('0xd'),_0x161732,_0xd1e7('0xe'));_0x9e91bd(_0xb1aad3[_0xd1e7('0x14')][_0xd1e7('0x13')]);}})[_0xd1e7('0x15')](function(_0x43746b){logger[_0xd1e7('0x11')](_0xd1e7('0xd'),_0x161732,_0x43746b);_0x10a814(_0x43746b);});});} \ No newline at end of file +var _0x0f99=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f99,0x16d));var _0x90f9=function(_0x5d7097,_0x1d914a){_0x5d7097=_0x5d7097-0x0;var _0x38d86e=_0x0f99[_0x5d7097];return _0x38d86e;};'use strict';var _=require(_0x90f9('0x0'));var util=require(_0x90f9('0x1'));var moment=require(_0x90f9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90f9('0x3'))['db'];var utils=require(_0x90f9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x90f9('0x5'));var jayson=require(_0x90f9('0x6'));var client=jayson[_0x90f9('0x7')][_0x90f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x594d97,_0x448b56,_0x11a39c){return new BPromise(function(_0x2e0c15,_0x1af93c){return client[_0x90f9('0x9')](_0x594d97,_0x11a39c)[_0x90f9('0xa')](function(_0x44f109){logger[_0x90f9('0xb')](_0x90f9('0xc'),_0x448b56,'request\x20sent');logger[_0x90f9('0xd')](_0x90f9('0xe'),_0x448b56,'request\x20sent',JSON[_0x90f9('0xf')](_0x44f109));if(_0x44f109[_0x90f9('0x10')]){if(_0x44f109[_0x90f9('0x10')][_0x90f9('0x11')]===0x1f4){logger[_0x90f9('0x10')](_0x90f9('0xc'),_0x448b56,_0x44f109['error'][_0x90f9('0x12')]);return _0x1af93c(_0x44f109[_0x90f9('0x10')][_0x90f9('0x12')]);}logger[_0x90f9('0x10')](_0x90f9('0xc'),_0x448b56,_0x44f109['error'][_0x90f9('0x12')]);return _0x2e0c15(_0x44f109[_0x90f9('0x10')][_0x90f9('0x12')]);}else{logger[_0x90f9('0xb')](_0x90f9('0xc'),_0x448b56,_0x90f9('0x13'));_0x2e0c15(_0x44f109[_0x90f9('0x14')]['message']);}})['catch'](function(_0x402ff7){logger[_0x90f9('0x10')](_0x90f9('0xc'),_0x448b56,_0x402ff7);_0x1af93c(_0x402ff7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a0a9327..766d534 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 _0xda19=['post','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x8ee4e8,_0x192cf2){var _0x4b1ec4=function(_0xc3cfa5){while(--_0xc3cfa5){_0x8ee4e8['push'](_0x8ee4e8['shift']());}};_0x4b1ec4(++_0x192cf2);}(_0xda19,0xd5));var _0x9da1=function(_0x15a9b5,_0x56466b){_0x15a9b5=_0x15a9b5-0x0;var _0x5b81bf=_0xda19[_0x15a9b5];return _0x5b81bf;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var auth=require(_0x9da1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9da1('0x4'));var controller=require(_0x9da1('0x5'));router[_0x9da1('0x6')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x8')]);router[_0x9da1('0x6')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xa')]);router[_0x9da1('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9da1('0x9'),auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router[_0x9da1('0xd')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xe')]);module[_0x9da1('0xf')]=router; \ No newline at end of file +var _0x2eb2=['/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x4fed95,_0x3447b4){var _0x2ff081=function(_0x402ee1){while(--_0x402ee1){_0x4fed95['push'](_0x4fed95['shift']());}};_0x2ff081(++_0x3447b4);}(_0x2eb2,0x19f));var _0x22eb=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x2eb2[_0x28947d];return _0x12d2ee;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller['update']);router[_0x22eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 34f4560..9bc9473 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 _0x326b=['customVariable','keyValue','STRING','ENUM','sequelize','exports','string','variable'];(function(_0x504a44,_0x1a700e){var _0xfa522c=function(_0x250250){while(--_0x250250){_0x504a44['push'](_0x504a44['shift']());}};_0xfa522c(++_0x1a700e);}(_0x326b,0x1f4));var _0xb326=function(_0x335a62,_0xfafea4){_0x335a62=_0x335a62-0x0;var _0x249a9a=_0x326b[_0x335a62];return _0x249a9a;};'use strict';var Sequelize=require(_0xb326('0x0'));module[_0xb326('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb326('0x2'),_0xb326('0x3'),_0xb326('0x4'),_0xb326('0x5')),'defaultValue':_0xb326('0x2')},'content':{'type':Sequelize[_0xb326('0x6')]},'key':{'type':Sequelize[_0xb326('0x6')]},'keyType':{'type':Sequelize[_0xb326('0x7')]('string',_0xb326('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xb326('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xb326('0x6')]}}; \ No newline at end of file +var _0x6ced=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0xbd32a2,_0x4d476f){var _0x2f0649=function(_0x22ea69){while(--_0x22ea69){_0xbd32a2['push'](_0xbd32a2['shift']());}};_0x2f0649(++_0x4d476f);}(_0x6ced,0x1d5));var _0xd6ce=function(_0x25c910,_0xd51274){_0x25c910=_0x25c910-0x0;var _0x4f14dc=_0x6ced[_0x25c910];return _0x4f14dc;};'use strict';var Sequelize=require(_0xd6ce('0x0'));module[_0xd6ce('0x1')]={'type':{'type':Sequelize[_0xd6ce('0x2')](_0xd6ce('0x3'),'variable',_0xd6ce('0x4'),_0xd6ce('0x5')),'defaultValue':_0xd6ce('0x3')},'content':{'type':Sequelize[_0xd6ce('0x6')]},'key':{'type':Sequelize[_0xd6ce('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xd6ce('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xd6ce('0x6')]},'idField':{'type':Sequelize[_0xd6ce('0x6')]},'variableName':{'type':Sequelize[_0xd6ce('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 5b113ba..c1d74cf 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 _0xcdd5=['params','length','includeAll','options','create','body','destroy','find','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','update','then','end','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show'];(function(_0x28847e,_0x1b575c){var _0x13fed9=function(_0x52ef27){while(--_0x52ef27){_0x28847e['push'](_0x28847e['shift']());}};_0x13fed9(++_0x1b575c);}(_0xcdd5,0x1c4));var _0x5cdd=function(_0x5520af,_0x41002d){_0x5520af=_0x5520af-0x0;var _0x2e6299=_0xcdd5[_0x5520af];return _0x2e6299;};'use strict';var pdf=require(_0x5cdd('0x0'));var emlformat=require(_0x5cdd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5cdd('0x2'));var jsonpatch=require(_0x5cdd('0x3'));var rp=require('request-promise');var moment=require(_0x5cdd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5cdd('0x5'));var util=require(_0x5cdd('0x6'));var path=require(_0x5cdd('0x7'));var sox=require(_0x5cdd('0x8'));var csv=require(_0x5cdd('0x9'));var ejs=require(_0x5cdd('0xa'));var fs=require('fs');var _=require(_0x5cdd('0xb'));var squel=require('squel');var crypto=require(_0x5cdd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5cdd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5cdd('0xe'));var Papa=require(_0x5cdd('0xf'));var Redis=require(_0x5cdd('0x10'));var authService=require(_0x5cdd('0x11'));var qs=require(_0x5cdd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5cdd('0x13'));var logger=require(_0x5cdd('0x14'))(_0x5cdd('0x15'));var utils=require('../../config/utils');var config=require(_0x5cdd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38a5ab,_0x53ad7b){_0x53ad7b=_0x53ad7b||0xcc;return function(_0x1edc98){if(_0x1edc98){return _0x38a5ab[_0x5cdd('0x17')](_0x53ad7b);}return _0x38a5ab[_0x5cdd('0x18')](_0x53ad7b)['end']();};}function respondWithResult(_0x4ab56c,_0x437f39){_0x437f39=_0x437f39||0xc8;return function(_0x5478b2){if(_0x5478b2){return _0x4ab56c['status'](_0x437f39)['json'](_0x5478b2);}};}function respondWithFilteredResult(_0x5a93a9,_0x30473a){return function(_0xf2feeb){if(_0xf2feeb){var _0x5514f4=_0xf2feeb[_0x5cdd('0x19')],_0x371078=_0x30473a[_0x5cdd('0x1a')],_0x44833c=_0x30473a[_0x5cdd('0x1a')]+_0x30473a['limit'],_0x265eff;if(_0x44833c>=_0x5514f4){_0x44833c=_0x5514f4;_0x265eff=0xc8;}else{_0x265eff=0xce;}_0x5a93a9[_0x5cdd('0x18')](_0x265eff);return _0x5a93a9[_0x5cdd('0x1b')](_0x5cdd('0x1c'),_0x371078+'-'+_0x44833c+'/'+_0x5514f4)[_0x5cdd('0x1d')](_0xf2feeb);}return null;};}function patchUpdates(_0x4a342d){return function(_0x15ae12){try{jsonpatch[_0x5cdd('0x1e')](_0x15ae12,_0x4a342d,!![]);}catch(_0x29ef43){return BPromise[_0x5cdd('0x1f')](_0x29ef43);}return _0x15ae12['save']();};}function saveUpdates(_0x3d0d90,_0x2cc8fd){return function(_0x2fad3b){if(_0x2fad3b){return _0x2fad3b[_0x5cdd('0x20')](_0x3d0d90)[_0x5cdd('0x21')](function(_0x615bd4){return _0x615bd4;});}return null;};}function removeEntity(_0x53c86d,_0x583121){return function(_0x325b7e){if(_0x325b7e){return _0x325b7e['destroy']()[_0x5cdd('0x21')](function(){_0x53c86d[_0x5cdd('0x18')](0xcc)[_0x5cdd('0x22')]();});}};}function handleEntityNotFound(_0x2d247c,_0x49f4b9){return function(_0x44a9e8){if(!_0x44a9e8){_0x2d247c['sendStatus'](0x194);}return _0x44a9e8;};}function handleError(_0x54e1ff,_0x4c95b0){_0x4c95b0=_0x4c95b0||0x1f4;return function(_0x58b0fd){logger[_0x5cdd('0x23')](_0x58b0fd[_0x5cdd('0x24')]);if(_0x58b0fd['name']){delete _0x58b0fd[_0x5cdd('0x25')];}_0x54e1ff[_0x5cdd('0x18')](_0x4c95b0)[_0x5cdd('0x26')](_0x58b0fd);};}exports[_0x5cdd('0x27')]=function(_0x1086ab,_0x2bf256){var _0x195713={},_0x35bee6={},_0x553da6={'count':0x0,'rows':[]};var _0x54309e=_[_0x5cdd('0x28')](db[_0x5cdd('0x29')][_0x5cdd('0x2a')],function(_0xa74fb6){return{'name':_0xa74fb6['fieldName'],'type':_0xa74fb6[_0x5cdd('0x2b')][_0x5cdd('0x2c')]};});_0x35bee6[_0x5cdd('0x2d')]=_['map'](_0x54309e,_0x5cdd('0x25'));_0x35bee6[_0x5cdd('0x2e')]=_[_0x5cdd('0x2f')](_0x1086ab[_0x5cdd('0x2e')]);_0x35bee6[_0x5cdd('0x30')]=_[_0x5cdd('0x31')](_0x35bee6[_0x5cdd('0x2d')],_0x35bee6[_0x5cdd('0x2e')]);_0x195713[_0x5cdd('0x32')]=_['intersection'](_0x35bee6[_0x5cdd('0x2d')],qs[_0x5cdd('0x33')](_0x1086ab['query']['fields']));_0x195713['attributes']=_0x195713[_0x5cdd('0x32')]['length']?_0x195713['attributes']:_0x35bee6[_0x5cdd('0x2d')];if(!_0x1086ab[_0x5cdd('0x2e')][_0x5cdd('0x34')](_0x5cdd('0x35'))){_0x195713['limit']=qs[_0x5cdd('0x36')](_0x1086ab[_0x5cdd('0x2e')][_0x5cdd('0x36')]);_0x195713[_0x5cdd('0x1a')]=qs[_0x5cdd('0x1a')](_0x1086ab[_0x5cdd('0x2e')][_0x5cdd('0x1a')]);}_0x195713[_0x5cdd('0x37')]=qs[_0x5cdd('0x38')](_0x1086ab[_0x5cdd('0x2e')]['sort']);_0x195713[_0x5cdd('0x39')]=qs[_0x5cdd('0x30')](_[_0x5cdd('0x3a')](_0x1086ab[_0x5cdd('0x2e')],_0x35bee6['filters']),_0x54309e);if(_0x1086ab[_0x5cdd('0x2e')][_0x5cdd('0x3b')]){_0x195713[_0x5cdd('0x39')]=_[_0x5cdd('0x3c')](_0x195713[_0x5cdd('0x39')],{'$or':_[_0x5cdd('0x28')](_0x54309e,function(_0x3596c9){if(_0x3596c9[_0x5cdd('0x2b')]!==_0x5cdd('0x3d')){var _0x33f239={};_0x33f239[_0x3596c9[_0x5cdd('0x25')]]={'$like':'%'+_0x1086ab[_0x5cdd('0x2e')][_0x5cdd('0x3b')]+'%'};return _0x33f239;}})});}_0x195713=_[_0x5cdd('0x3c')]({},_0x195713,_0x1086ab['options']);var _0x451973={'where':_0x195713[_0x5cdd('0x39')]};return db[_0x5cdd('0x29')]['count'](_0x451973)[_0x5cdd('0x21')](function(_0x4d352b){_0x553da6[_0x5cdd('0x19')]=_0x4d352b;if(_0x1086ab[_0x5cdd('0x2e')]['includeAll']){_0x195713[_0x5cdd('0x3e')]=[{'all':!![]}];}return db['SalesforceField'][_0x5cdd('0x3f')](_0x195713);})['then'](function(_0x20a590){_0x553da6['rows']=_0x20a590;return _0x553da6;})[_0x5cdd('0x21')](respondWithFilteredResult(_0x2bf256,_0x195713))[_0x5cdd('0x40')](handleError(_0x2bf256,null));};exports[_0x5cdd('0x41')]=function(_0x104607,_0x3d0b07){var _0x510778={'raw':!![],'where':{'id':_0x104607[_0x5cdd('0x42')]['id']}},_0x59026f={};_0x59026f[_0x5cdd('0x2d')]=_['keys'](db[_0x5cdd('0x29')][_0x5cdd('0x2a')]);_0x59026f[_0x5cdd('0x2e')]=_[_0x5cdd('0x2f')](_0x104607[_0x5cdd('0x2e')]);_0x59026f['filters']=_[_0x5cdd('0x31')](_0x59026f[_0x5cdd('0x2d')],_0x59026f['query']);_0x510778[_0x5cdd('0x32')]=_['intersection'](_0x59026f[_0x5cdd('0x2d')],qs[_0x5cdd('0x33')](_0x104607[_0x5cdd('0x2e')][_0x5cdd('0x33')]));_0x510778[_0x5cdd('0x32')]=_0x510778[_0x5cdd('0x32')][_0x5cdd('0x43')]?_0x510778[_0x5cdd('0x32')]:_0x59026f['model'];if(_0x104607[_0x5cdd('0x2e')][_0x5cdd('0x44')]){_0x510778[_0x5cdd('0x3e')]=[{'all':!![]}];}_0x510778=_[_0x5cdd('0x3c')]({},_0x510778,_0x104607[_0x5cdd('0x45')]);return db[_0x5cdd('0x29')]['find'](_0x510778)['then'](handleEntityNotFound(_0x3d0b07,null))[_0x5cdd('0x21')](respondWithResult(_0x3d0b07,null))[_0x5cdd('0x40')](handleError(_0x3d0b07,null));};exports[_0x5cdd('0x46')]=function(_0x100ca1,_0x2d1fa6){return db[_0x5cdd('0x29')][_0x5cdd('0x46')](_0x100ca1['body'],{})[_0x5cdd('0x21')](respondWithResult(_0x2d1fa6,0xc9))[_0x5cdd('0x40')](handleError(_0x2d1fa6,null));};exports['update']=function(_0x75a040,_0x1966e3){if(_0x75a040[_0x5cdd('0x47')]['id']){delete _0x75a040[_0x5cdd('0x47')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x75a040[_0x5cdd('0x42')]['id']}})[_0x5cdd('0x21')](handleEntityNotFound(_0x1966e3,null))[_0x5cdd('0x21')](saveUpdates(_0x75a040['body'],null))[_0x5cdd('0x21')](respondWithResult(_0x1966e3,null))['catch'](handleError(_0x1966e3,null));};exports[_0x5cdd('0x48')]=function(_0x4ed0f7,_0x1dc5d7){return db['SalesforceField'][_0x5cdd('0x49')]({'where':{'id':_0x4ed0f7['params']['id']}})[_0x5cdd('0x21')](handleEntityNotFound(_0x1dc5d7,null))[_0x5cdd('0x21')](removeEntity(_0x1dc5d7,null))['catch'](handleError(_0x1dc5d7,null));}; \ No newline at end of file +var _0x4458=['moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','SalesforceField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x4458,0xdc));var _0x8445=function(_0x31b4b2,_0x5c679b){_0x31b4b2=_0x31b4b2-0x0;var _0x55fa7b=_0x4458[_0x31b4b2];return _0x55fa7b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8445('0x0'));var rimraf=require(_0x8445('0x1'));var zipdir=require(_0x8445('0x2'));var jsonpatch=require(_0x8445('0x3'));var rp=require(_0x8445('0x4'));var moment=require(_0x8445('0x5'));var BPromise=require(_0x8445('0x6'));var Mustache=require('mustache');var util=require(_0x8445('0x7'));var path=require(_0x8445('0x8'));var sox=require(_0x8445('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8445('0xa'));var squel=require(_0x8445('0xb'));var crypto=require(_0x8445('0xc'));var jsforce=require(_0x8445('0xd'));var deskjs=require(_0x8445('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8445('0xf'));var Papa=require(_0x8445('0x10'));var Redis=require(_0x8445('0x11'));var authService=require(_0x8445('0x12'));var qs=require(_0x8445('0x13'));var as=require(_0x8445('0x14'));var hardwareService=require(_0x8445('0x15'));var logger=require(_0x8445('0x16'))('api');var utils=require(_0x8445('0x17'));var config=require(_0x8445('0x18'));var db=require(_0x8445('0x19'))['db'];function respondWithStatusCode(_0x12aaef,_0x17d733){_0x17d733=_0x17d733||0xcc;return function(_0x266e27){if(_0x266e27){return _0x12aaef['sendStatus'](_0x17d733);}return _0x12aaef[_0x8445('0x1a')](_0x17d733)[_0x8445('0x1b')]();};}function respondWithResult(_0x478979,_0x60d955){_0x60d955=_0x60d955||0xc8;return function(_0x120303){if(_0x120303){return _0x478979[_0x8445('0x1a')](_0x60d955)[_0x8445('0x1c')](_0x120303);}};}function respondWithFilteredResult(_0x4578c7,_0x10b3de){return function(_0x1389ae){if(_0x1389ae){var _0x4bca7a=_0x1389ae[_0x8445('0x1d')],_0x4ff79a=_0x10b3de[_0x8445('0x1e')],_0x46a0c0=_0x10b3de[_0x8445('0x1e')]+_0x10b3de[_0x8445('0x1f')],_0x5fa761;if(_0x46a0c0>=_0x4bca7a){_0x46a0c0=_0x4bca7a;_0x5fa761=0xc8;}else{_0x5fa761=0xce;}_0x4578c7['status'](_0x5fa761);return _0x4578c7[_0x8445('0x20')]('Content-Range',_0x4ff79a+'-'+_0x46a0c0+'/'+_0x4bca7a)[_0x8445('0x1c')](_0x1389ae);}return null;};}function patchUpdates(_0x40efd3){return function(_0x2f4f09){try{jsonpatch[_0x8445('0x21')](_0x2f4f09,_0x40efd3,!![]);}catch(_0x18ef52){return BPromise[_0x8445('0x22')](_0x18ef52);}return _0x2f4f09[_0x8445('0x23')]();};}function saveUpdates(_0x3fa901,_0x2a9164){return function(_0x324d31){if(_0x324d31){return _0x324d31[_0x8445('0x24')](_0x3fa901)[_0x8445('0x25')](function(_0x49f269){return _0x49f269;});}return null;};}function removeEntity(_0x47d0ea,_0x1bba89){return function(_0x3ee7a3){if(_0x3ee7a3){return _0x3ee7a3[_0x8445('0x26')]()[_0x8445('0x25')](function(){_0x47d0ea['status'](0xcc)[_0x8445('0x1b')]();});}};}function handleEntityNotFound(_0x34997b,_0x3cffbb){return function(_0x4df301){if(!_0x4df301){_0x34997b[_0x8445('0x27')](0x194);}return _0x4df301;};}function handleError(_0x160c6a,_0x9146ff){_0x9146ff=_0x9146ff||0x1f4;return function(_0xb74739){logger[_0x8445('0x28')](_0xb74739[_0x8445('0x29')]);if(_0xb74739[_0x8445('0x2a')]){delete _0xb74739['name'];}_0x160c6a[_0x8445('0x1a')](_0x9146ff)[_0x8445('0x2b')](_0xb74739);};}exports['index']=function(_0x1c02f5,_0x7d3ffb){var _0x2e1b02={},_0x3e3618={},_0x202140={'count':0x0,'rows':[]};var _0x14987f=_['map'](db[_0x8445('0x2c')][_0x8445('0x2d')],function(_0x6d9865){return{'name':_0x6d9865[_0x8445('0x2e')],'type':_0x6d9865[_0x8445('0x2f')]['key']};});_0x3e3618[_0x8445('0x30')]=_[_0x8445('0x31')](_0x14987f,'name');_0x3e3618[_0x8445('0x32')]=_[_0x8445('0x33')](_0x1c02f5[_0x8445('0x32')]);_0x3e3618[_0x8445('0x34')]=_[_0x8445('0x35')](_0x3e3618[_0x8445('0x30')],_0x3e3618[_0x8445('0x32')]);_0x2e1b02[_0x8445('0x36')]=_['intersection'](_0x3e3618[_0x8445('0x30')],qs[_0x8445('0x37')](_0x1c02f5['query']['fields']));_0x2e1b02[_0x8445('0x36')]=_0x2e1b02[_0x8445('0x36')][_0x8445('0x38')]?_0x2e1b02[_0x8445('0x36')]:_0x3e3618[_0x8445('0x30')];if(!_0x1c02f5[_0x8445('0x32')][_0x8445('0x39')]('nolimit')){_0x2e1b02[_0x8445('0x1f')]=qs[_0x8445('0x1f')](_0x1c02f5[_0x8445('0x32')][_0x8445('0x1f')]);_0x2e1b02[_0x8445('0x1e')]=qs[_0x8445('0x1e')](_0x1c02f5['query']['offset']);}_0x2e1b02['order']=qs['sort'](_0x1c02f5['query'][_0x8445('0x3a')]);_0x2e1b02['where']=qs[_0x8445('0x34')](_[_0x8445('0x3b')](_0x1c02f5['query'],_0x3e3618['filters']),_0x14987f);if(_0x1c02f5[_0x8445('0x32')]['filter']){_0x2e1b02['where']=_['merge'](_0x2e1b02[_0x8445('0x3c')],{'$or':_['map'](_0x14987f,function(_0x1e3e0d){if(_0x1e3e0d[_0x8445('0x2f')]!==_0x8445('0x3d')){var _0x3e3c5d={};_0x3e3c5d[_0x1e3e0d['name']]={'$like':'%'+_0x1c02f5[_0x8445('0x32')][_0x8445('0x3e')]+'%'};return _0x3e3c5d;}})});}_0x2e1b02=_[_0x8445('0x3f')]({},_0x2e1b02,_0x1c02f5[_0x8445('0x40')]);var _0x137623={'where':_0x2e1b02['where']};return db['SalesforceField'][_0x8445('0x1d')](_0x137623)[_0x8445('0x25')](function(_0x5a374a){_0x202140['count']=_0x5a374a;if(_0x1c02f5[_0x8445('0x32')][_0x8445('0x41')]){_0x2e1b02[_0x8445('0x42')]=[{'all':!![]}];}return db['SalesforceField'][_0x8445('0x43')](_0x2e1b02);})[_0x8445('0x25')](function(_0x4a32ca){_0x202140[_0x8445('0x44')]=_0x4a32ca;return _0x202140;})['then'](respondWithFilteredResult(_0x7d3ffb,_0x2e1b02))['catch'](handleError(_0x7d3ffb,null));};exports[_0x8445('0x45')]=function(_0x5c43af,_0x42be3f){var _0x1b5d09={'raw':!![],'where':{'id':_0x5c43af[_0x8445('0x46')]['id']}},_0x511ee7={};_0x511ee7[_0x8445('0x30')]=_[_0x8445('0x33')](db[_0x8445('0x2c')][_0x8445('0x2d')]);_0x511ee7[_0x8445('0x32')]=_[_0x8445('0x33')](_0x5c43af[_0x8445('0x32')]);_0x511ee7[_0x8445('0x34')]=_[_0x8445('0x35')](_0x511ee7[_0x8445('0x30')],_0x511ee7[_0x8445('0x32')]);_0x1b5d09['attributes']=_[_0x8445('0x35')](_0x511ee7[_0x8445('0x30')],qs[_0x8445('0x37')](_0x5c43af['query']['fields']));_0x1b5d09[_0x8445('0x36')]=_0x1b5d09[_0x8445('0x36')]['length']?_0x1b5d09[_0x8445('0x36')]:_0x511ee7['model'];if(_0x5c43af[_0x8445('0x32')][_0x8445('0x41')]){_0x1b5d09[_0x8445('0x42')]=[{'all':!![]}];}_0x1b5d09=_[_0x8445('0x3f')]({},_0x1b5d09,_0x5c43af['options']);return db['SalesforceField'][_0x8445('0x47')](_0x1b5d09)[_0x8445('0x25')](handleEntityNotFound(_0x42be3f,null))[_0x8445('0x25')](respondWithResult(_0x42be3f,null))['catch'](handleError(_0x42be3f,null));};exports['create']=function(_0x51726e,_0x1dc102){return db[_0x8445('0x2c')][_0x8445('0x48')](_0x51726e[_0x8445('0x49')],{})[_0x8445('0x25')](respondWithResult(_0x1dc102,0xc9))[_0x8445('0x4a')](handleError(_0x1dc102,null));};exports[_0x8445('0x24')]=function(_0x8369b3,_0x4101b8){if(_0x8369b3[_0x8445('0x49')]['id']){delete _0x8369b3['body']['id'];}return db[_0x8445('0x2c')][_0x8445('0x47')]({'where':{'id':_0x8369b3[_0x8445('0x46')]['id']}})['then'](handleEntityNotFound(_0x4101b8,null))['then'](saveUpdates(_0x8369b3[_0x8445('0x49')],null))['then'](respondWithResult(_0x4101b8,null))[_0x8445('0x4a')](handleError(_0x4101b8,null));};exports[_0x8445('0x26')]=function(_0x231c41,_0xbae23d){return db[_0x8445('0x2c')][_0x8445('0x47')]({'where':{'id':_0x231c41[_0x8445('0x46')]['id']}})['then'](handleEntityNotFound(_0xbae23d,null))[_0x8445('0x25')](removeEntity(_0xbae23d,null))['catch'](handleError(_0xbae23d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 997b28c..a406dda 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 _0x3eb8=['./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x3eb8,0x1e7));var _0x83eb=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x3eb8[_0x616290];return _0x453879;};'use strict';var _=require(_0x83eb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x83eb('0x1'));var moment=require(_0x83eb('0x2'));var BPromise=require(_0x83eb('0x3'));var rp=require(_0x83eb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83eb('0x5'));var config=require(_0x83eb('0x6'));var attributes=require(_0x83eb('0x7'));module[_0x83eb('0x8')]=function(_0x4519a4,_0x44f4d5){return _0x4519a4['define'](_0x83eb('0x9'),attributes,{'tableName':_0x83eb('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x83eb('0xb'),_0x83eb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcedf=['api','path','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0xf24612,_0x288e25){var _0x3388ee=function(_0x97ed23){while(--_0x97ed23){_0xf24612['push'](_0xf24612['shift']());}};_0x3388ee(++_0x288e25);}(_0xcedf,0x8c));var _0xfced=function(_0x4ab7db,_0x3f7eb0){_0x4ab7db=_0x4ab7db-0x0;var _0x10a87c=_0xcedf[_0x4ab7db];return _0x10a87c;};'use strict';var _=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var logger=require(_0xfced('0x2'))(_0xfced('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfced('0x4'));var rimraf=require('rimraf');var config=require(_0xfced('0x5'));var attributes=require(_0xfced('0x6'));module[_0xfced('0x7')]=function(_0x5a8a87,_0x43768e){return _0x5a8a87['define'](_0xfced('0x8'),attributes,{'tableName':_0xfced('0x9'),'paranoid':![],'indexes':[{'name':_0xfced('0xa'),'fields':[_0xfced('0xb'),_0xfced('0xc')],'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 5f2fb54..8babb3f 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 _0xe706=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2d3449,_0xe447b9){var _0x472e2e=function(_0x195bd0){while(--_0x195bd0){_0x2d3449['push'](_0x2d3449['shift']());}};_0x472e2e(++_0xe447b9);}(_0xe706,0xa3));var _0x6e70=function(_0x101176,_0x1ad975){_0x101176=_0x101176-0x0;var _0x4ec27c=_0xe706[_0x101176];return _0x4ec27c;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x9bde=['code','message','SalesforceField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x19f32f,_0x3ee0b2){var _0xb28978=function(_0x1e18f2){while(--_0x1e18f2){_0x19f32f['push'](_0x19f32f['shift']());}};_0xb28978(++_0x3ee0b2);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5b8fa9,_0x2e335c){_0x5b8fa9=_0x5b8fa9-0x0;var _0x20a1d5=_0x9bde[_0x5b8fa9];return _0x20a1d5;};'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')]('SalesforceField,\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')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('SalesforceField,\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')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 24105a0..39d7551 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 _0xabe8=['getConfigurations','post','create','put','/:id','update','destroy','multer','util','path','express','Router','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations'];(function(_0x3f1ba9,_0x51ffb4){var _0x534b5c=function(_0xa9e2f7){while(--_0xa9e2f7){_0x3f1ba9['push'](_0x3f1ba9['shift']());}};_0x534b5c(++_0x51ffb4);}(_0xabe8,0x8c));var _0x8abe=function(_0x483592,_0x143c23){_0x483592=_0x483592-0x0;var _0x3b9fdc=_0xabe8[_0x483592];return _0x3b9fdc;};'use strict';var multer=require(_0x8abe('0x0'));var util=require(_0x8abe('0x1'));var path=require(_0x8abe('0x2'));var timeout=require('connect-timeout');var express=require(_0x8abe('0x3'));var router=express[_0x8abe('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8abe('0x5'));var config=require('../../config/environment');var controller=require(_0x8abe('0x6'));router[_0x8abe('0x7')]('/',auth[_0x8abe('0x8')](),controller[_0x8abe('0x9')]);router[_0x8abe('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8abe('0xa')]);router[_0x8abe('0x7')](_0x8abe('0xb'),auth[_0x8abe('0x8')](),controller[_0x8abe('0xc')]);router[_0x8abe('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x8abe('0xd')]('/',auth[_0x8abe('0x8')](),controller[_0x8abe('0xe')]);router[_0x8abe('0xd')](_0x8abe('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x8abe('0xf')](_0x8abe('0x10'),auth[_0x8abe('0x8')](),controller[_0x8abe('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8abe('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1928=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','create','post','/:id/configurations','put','update','delete','destroy','exports'];(function(_0x4256b3,_0x4cf9fd){var _0x3ccaa1=function(_0x447881){while(--_0x447881){_0x4256b3['push'](_0x4256b3['shift']());}};_0x3ccaa1(++_0x4cf9fd);}(_0x1928,0x138));var _0x8192=function(_0x3b8373,_0x5d40de){_0x3b8373=_0x3b8373-0x0;var _0x5df40c=_0x1928[_0x3b8373];return _0x5df40c;};'use strict';var multer=require(_0x8192('0x0'));var util=require(_0x8192('0x1'));var path=require(_0x8192('0x2'));var timeout=require('connect-timeout');var express=require(_0x8192('0x3'));var router=express[_0x8192('0x4')]();var auth=require(_0x8192('0x5'));var interaction=require(_0x8192('0x6'));var config=require(_0x8192('0x7'));var controller=require(_0x8192('0x8'));router[_0x8192('0x9')]('/',auth[_0x8192('0xa')](),controller[_0x8192('0xb')]);router[_0x8192('0x9')](_0x8192('0xc'),auth[_0x8192('0xa')](),controller[_0x8192('0xd')]);router[_0x8192('0x9')]('/:id/configurations',auth[_0x8192('0xa')](),controller['getConfigurations']);router[_0x8192('0x9')](_0x8192('0xe'),auth[_0x8192('0xa')](),controller[_0x8192('0xf')]);router['post']('/',auth[_0x8192('0xa')](),controller[_0x8192('0x10')]);router[_0x8192('0x11')](_0x8192('0x12'),auth[_0x8192('0xa')](),controller['addConfiguration']);router[_0x8192('0x13')](_0x8192('0xc'),auth[_0x8192('0xa')](),controller[_0x8192('0x14')]);router[_0x8192('0x15')](_0x8192('0xc'),auth[_0x8192('0xa')](),controller[_0x8192('0x16')]);module[_0x8192('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 2610581..efdfec0 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 _0x4874=['STRING','username','sequelize','exports'];(function(_0x362a9c,_0x434fd5){var _0x159079=function(_0x4e5a3c){while(--_0x4e5a3c){_0x362a9c['push'](_0x362a9c['shift']());}};_0x159079(++_0x434fd5);}(_0x4874,0x7a));var _0x4487=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x4874[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x4487('0x0'));module[_0x4487('0x1')]={'name':{'type':Sequelize[_0x4487('0x2')]},'description':{'type':Sequelize[_0x4487('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x4487('0x3')},'password':{'type':Sequelize[_0x4487('0x2')]},'email':{'type':Sequelize[_0x4487('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4487('0x2')]}}; \ No newline at end of file +var _0x2ed5=['sequelize','exports','STRING','username'];(function(_0x8fce91,_0x5ecbc4){var _0x821764=function(_0x444d1b){while(--_0x444d1b){_0x8fce91['push'](_0x8fce91['shift']());}};_0x821764(++_0x5ecbc4);}(_0x2ed5,0x110));var _0x52ed=function(_0x4db3f7,_0x2ce20a){_0x4db3f7=_0x4db3f7-0x0;var _0x48f720=_0x2ed5[_0x4db3f7];return _0x48f720;};'use strict';var Sequelize=require(_0x52ed('0x0'));module[_0x52ed('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x52ed('0x2')],'unique':_0x52ed('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x52ed('0x2')]},'remoteUri':{'type':Sequelize[_0x52ed('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x52ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 17978f7..8c59e99 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 _0xc788=['intersection','fields','attributes','length','limit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','destroy','getConfigurations','findOne','ServicenowConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','subcategory','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','close_notes','follow_up','parent_incident','sys_id','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','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','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','filters'];(function(_0x654f94,_0x36f849){var _0x11a2cf=function(_0x1e3983){while(--_0x1e3983){_0x654f94['push'](_0x654f94['shift']());}};_0x11a2cf(++_0x36f849);}(_0xc788,0x82));var _0x8c78=function(_0x170eb7,_0x1ac59b){_0x170eb7=_0x170eb7-0x0;var _0x4dfeac=_0xc788[_0x170eb7];return _0x4dfeac;};'use strict';var pdf=require(_0x8c78('0x0'));var emlformat=require(_0x8c78('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8c78('0x2'));var jsonpatch=require(_0x8c78('0x3'));var rp=require('request-promise');var moment=require(_0x8c78('0x4'));var BPromise=require(_0x8c78('0x5'));var Mustache=require(_0x8c78('0x6'));var util=require(_0x8c78('0x7'));var path=require(_0x8c78('0x8'));var sox=require(_0x8c78('0x9'));var csv=require(_0x8c78('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c78('0xb'));var squel=require(_0x8c78('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c78('0xd'));var deskjs=require(_0x8c78('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8c78('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8c78('0x10'));var qs=require(_0x8c78('0x11'));var as=require(_0x8c78('0x12'));var hardwareService=require(_0x8c78('0x13'));var logger=require(_0x8c78('0x14'))(_0x8c78('0x15'));var utils=require('../../config/utils');var config=require(_0x8c78('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8c78('0x17'));var client=jayson[_0x8c78('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x3142a7,_0x2b8cb6,_0x5ed393){if(_0x5ed393){var _0x4424ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4424ad['test'](_0x2b8cb6)){return _0x3142a7;}else{throw new db[(_0x8c78('0x19'))]['ValidationError'](_0x8c78('0x1a'));}}else{return _0x3142a7;}}function respondWithRpcPromise(_0x2c5e82,_0x54370c,_0x52b882,_0x129547){return new BPromise(function(_0x503908,_0xb723c0){var _0x5b4f9f=_0x129547||client;return _0x5b4f9f[_0x8c78('0x1b')](_0x2c5e82,_0x52b882)['then'](function(_0x48ecf9){logger[_0x8c78('0x1c')](_0x8c78('0x1d'),_0x54370c,_0x8c78('0x1e'));logger[_0x8c78('0x1f')](_0x8c78('0x20'),_0x54370c,_0x8c78('0x1e'),JSON[_0x8c78('0x21')](_0x48ecf9));if(_0x48ecf9['error']){if(_0x48ecf9[_0x8c78('0x22')][_0x8c78('0x23')]===0x1f4){logger[_0x8c78('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x54370c,_0x48ecf9[_0x8c78('0x22')][_0x8c78('0x24')]);return _0xb723c0(_0x48ecf9[_0x8c78('0x22')][_0x8c78('0x24')]);}logger[_0x8c78('0x22')](_0x8c78('0x1d'),_0x54370c,_0x48ecf9[_0x8c78('0x22')][_0x8c78('0x24')]);return _0x503908(_0x48ecf9[_0x8c78('0x22')][_0x8c78('0x24')]);}else{logger[_0x8c78('0x1c')](_0x8c78('0x1d'),_0x54370c,'request\x20sent');_0x503908(_0x48ecf9['result']['message']);}})[_0x8c78('0x25')](function(_0x3c8c2f){logger['error'](_0x8c78('0x1d'),_0x54370c,_0x3c8c2f);_0xb723c0(_0x3c8c2f);});});}function respondWithStatusCode(_0x3b4d9f,_0x2cbdfe){_0x2cbdfe=_0x2cbdfe||0xcc;return function(_0x1b2ec3){if(_0x1b2ec3){return _0x3b4d9f[_0x8c78('0x26')](_0x2cbdfe);}return _0x3b4d9f[_0x8c78('0x27')](_0x2cbdfe)[_0x8c78('0x28')]();};}function respondWithResult(_0x3b70bb,_0x1790a){_0x1790a=_0x1790a||0xc8;return function(_0x29f8e1){if(_0x29f8e1){return _0x3b70bb[_0x8c78('0x27')](_0x1790a)[_0x8c78('0x29')](_0x29f8e1);}};}function respondWithFilteredResult(_0x18a418,_0x555d07){return function(_0x5cd06e){if(_0x5cd06e){var _0x2ea89a=_0x5cd06e[_0x8c78('0x2a')],_0x209401=_0x555d07[_0x8c78('0x2b')],_0x2282e4=_0x555d07['offset']+_0x555d07['limit'],_0x3a8384;if(_0x2282e4>=_0x2ea89a){_0x2282e4=_0x2ea89a;_0x3a8384=0xc8;}else{_0x3a8384=0xce;}_0x18a418[_0x8c78('0x27')](_0x3a8384);return _0x18a418[_0x8c78('0x2c')](_0x8c78('0x2d'),_0x209401+'-'+_0x2282e4+'/'+_0x2ea89a)[_0x8c78('0x29')](_0x5cd06e);}return null;};}function patchUpdates(_0x459c13){return function(_0x207767){try{jsonpatch['apply'](_0x207767,_0x459c13,!![]);}catch(_0x18609f){return BPromise['reject'](_0x18609f);}return _0x207767[_0x8c78('0x2e')]();};}function saveUpdates(_0x5fa360,_0x17d318){return function(_0x413c9d){if(_0x413c9d){return _0x413c9d[_0x8c78('0x2f')](_0x5fa360)[_0x8c78('0x30')](function(_0x2635af){return _0x2635af;});}return null;};}function removeEntity(_0xc1731,_0x5ad1d1){return function(_0x3078a9){if(_0x3078a9){return _0x3078a9['destroy']()[_0x8c78('0x30')](function(){_0xc1731['status'](0xcc)[_0x8c78('0x28')]();});}};}function handleEntityNotFound(_0x2449c9,_0x14012c){return function(_0x334884){if(!_0x334884){_0x2449c9[_0x8c78('0x26')](0x194);}return _0x334884;};}function handleError(_0x3aaea7,_0x336373){_0x336373=_0x336373||0x1f4;return function(_0x125253){logger[_0x8c78('0x22')](_0x125253[_0x8c78('0x31')]);if(_0x125253[_0x8c78('0x32')]){delete _0x125253[_0x8c78('0x32')];}_0x3aaea7['status'](_0x336373)[_0x8c78('0x33')](_0x125253);};}exports[_0x8c78('0x34')]=function(_0x4fdc8c,_0x1889cd){var _0x37302d={},_0xdf6b45={},_0x437f59={'count':0x0,'rows':[]};var _0x16c72e=_[_0x8c78('0x35')](db[_0x8c78('0x36')][_0x8c78('0x37')],function(_0x40c9d9){return{'name':_0x40c9d9[_0x8c78('0x38')],'type':_0x40c9d9['type'][_0x8c78('0x39')]};});_0xdf6b45[_0x8c78('0x3a')]=_['map'](_0x16c72e,'name');_0xdf6b45[_0x8c78('0x3b')]=_['keys'](_0x4fdc8c['query']);_0xdf6b45[_0x8c78('0x3c')]=_[_0x8c78('0x3d')](_0xdf6b45[_0x8c78('0x3a')],_0xdf6b45[_0x8c78('0x3b')]);_0x37302d['attributes']=_[_0x8c78('0x3d')](_0xdf6b45[_0x8c78('0x3a')],qs[_0x8c78('0x3e')](_0x4fdc8c[_0x8c78('0x3b')][_0x8c78('0x3e')]));_0x37302d[_0x8c78('0x3f')]=_0x37302d['attributes'][_0x8c78('0x40')]?_0x37302d[_0x8c78('0x3f')]:_0xdf6b45[_0x8c78('0x3a')];if(!_0x4fdc8c[_0x8c78('0x3b')]['hasOwnProperty']('nolimit')){_0x37302d['limit']=qs[_0x8c78('0x41')](_0x4fdc8c['query'][_0x8c78('0x41')]);_0x37302d[_0x8c78('0x2b')]=qs[_0x8c78('0x2b')](_0x4fdc8c[_0x8c78('0x3b')]['offset']);}_0x37302d['order']=qs['sort'](_0x4fdc8c['query'][_0x8c78('0x42')]);_0x37302d[_0x8c78('0x43')]=qs[_0x8c78('0x3c')](_[_0x8c78('0x44')](_0x4fdc8c[_0x8c78('0x3b')],_0xdf6b45[_0x8c78('0x3c')]),_0x16c72e);if(_0x4fdc8c[_0x8c78('0x3b')][_0x8c78('0x45')]){_0x37302d[_0x8c78('0x43')]=_['merge'](_0x37302d[_0x8c78('0x43')],{'$or':_['map'](_0x16c72e,function(_0x1d2ae3){if(_0x1d2ae3[_0x8c78('0x46')]!==_0x8c78('0x47')){var _0x338d05={};_0x338d05[_0x1d2ae3[_0x8c78('0x32')]]={'$like':'%'+_0x4fdc8c[_0x8c78('0x3b')][_0x8c78('0x45')]+'%'};return _0x338d05;}})});}_0x37302d=_[_0x8c78('0x48')]({},_0x37302d,_0x4fdc8c[_0x8c78('0x49')]);var _0x34af77={'where':_0x37302d[_0x8c78('0x43')]};return db[_0x8c78('0x36')][_0x8c78('0x2a')](_0x34af77)[_0x8c78('0x30')](function(_0x569ac8){_0x437f59['count']=_0x569ac8;if(_0x4fdc8c[_0x8c78('0x3b')][_0x8c78('0x4a')]){_0x37302d[_0x8c78('0x4b')]=[{'all':!![]}];}return db[_0x8c78('0x36')][_0x8c78('0x4c')](_0x37302d);})[_0x8c78('0x30')](function(_0x3acbcf){_0x437f59[_0x8c78('0x4d')]=_0x3acbcf;return _0x437f59;})[_0x8c78('0x30')](respondWithFilteredResult(_0x1889cd,_0x37302d))[_0x8c78('0x25')](handleError(_0x1889cd,null));};exports[_0x8c78('0x4e')]=function(_0x2a51df,_0x177437){var _0x413741={'raw':![],'where':{'id':_0x2a51df[_0x8c78('0x4f')]['id']}},_0x49cf6f={};_0x49cf6f[_0x8c78('0x3a')]=_['keys'](db[_0x8c78('0x36')][_0x8c78('0x37')]);_0x49cf6f[_0x8c78('0x3b')]=_[_0x8c78('0x50')](_0x2a51df['query']);_0x49cf6f[_0x8c78('0x3c')]=_['intersection'](_0x49cf6f[_0x8c78('0x3a')],_0x49cf6f['query']);_0x413741[_0x8c78('0x3f')]=_['intersection'](_0x49cf6f[_0x8c78('0x3a')],qs[_0x8c78('0x3e')](_0x2a51df['query']['fields']));_0x413741['attributes']=_0x413741[_0x8c78('0x3f')][_0x8c78('0x40')]?_0x413741[_0x8c78('0x3f')]:_0x49cf6f[_0x8c78('0x3a')];if(_0x2a51df[_0x8c78('0x3b')][_0x8c78('0x4a')]){_0x413741[_0x8c78('0x4b')]=[{'all':!![]}];}_0x413741=_[_0x8c78('0x48')]({},_0x413741,_0x2a51df['options']);return db[_0x8c78('0x36')]['find'](_0x413741)['then'](handleEntityNotFound(_0x177437,null))[_0x8c78('0x30')](respondWithResult(_0x177437,null))[_0x8c78('0x25')](handleError(_0x177437,null));};exports[_0x8c78('0x51')]=function(_0x47d195,_0x2dbb56){return db[_0x8c78('0x36')][_0x8c78('0x51')](_0x47d195['body'],{})[_0x8c78('0x30')](respondWithResult(_0x2dbb56,0xc9))[_0x8c78('0x25')](handleError(_0x2dbb56,null));};exports[_0x8c78('0x2f')]=function(_0x3a6b80,_0x6f4515){if(_0x3a6b80[_0x8c78('0x52')]['id']){delete _0x3a6b80[_0x8c78('0x52')]['id'];}return db[_0x8c78('0x36')][_0x8c78('0x53')]({'where':{'id':_0x3a6b80[_0x8c78('0x4f')]['id']}})[_0x8c78('0x30')](handleEntityNotFound(_0x6f4515,null))[_0x8c78('0x30')](saveUpdates(_0x3a6b80[_0x8c78('0x52')],null))[_0x8c78('0x30')](respondWithResult(_0x6f4515,null))[_0x8c78('0x25')](handleError(_0x6f4515,null));};exports[_0x8c78('0x54')]=function(_0x33d849,_0x41a752){return db['ServicenowAccount'][_0x8c78('0x53')]({'where':{'id':_0x33d849['params']['id']}})[_0x8c78('0x30')](handleEntityNotFound(_0x41a752,null))[_0x8c78('0x30')](removeEntity(_0x41a752,null))['catch'](handleError(_0x41a752,null));};exports[_0x8c78('0x55')]=function(_0x8ae0fa,_0x470271,_0x2542e2){var _0x70303c={};var _0x8beb74={};var _0x2d168a;var _0x12edf1;return db[_0x8c78('0x36')][_0x8c78('0x56')]({'where':{'id':_0x8ae0fa[_0x8c78('0x4f')]['id']}})[_0x8c78('0x30')](handleEntityNotFound(_0x470271,null))['then'](function(_0x47c312){if(_0x47c312){_0x2d168a=_0x47c312;_0x8beb74[_0x8c78('0x3a')]=_[_0x8c78('0x50')](db[_0x8c78('0x57')][_0x8c78('0x37')]);_0x8beb74['query']=_['keys'](_0x8ae0fa[_0x8c78('0x3b')]);_0x8beb74['filters']=_[_0x8c78('0x3d')](_0x8beb74[_0x8c78('0x3a')],_0x8beb74[_0x8c78('0x3b')]);_0x70303c[_0x8c78('0x3f')]=_[_0x8c78('0x3d')](_0x8beb74[_0x8c78('0x3a')],qs[_0x8c78('0x3e')](_0x8ae0fa[_0x8c78('0x3b')][_0x8c78('0x3e')]));_0x70303c[_0x8c78('0x3f')]=_0x70303c[_0x8c78('0x3f')][_0x8c78('0x40')]?_0x70303c[_0x8c78('0x3f')]:_0x8beb74[_0x8c78('0x3a')];_0x70303c[_0x8c78('0x58')]=qs['sort'](_0x8ae0fa[_0x8c78('0x3b')][_0x8c78('0x42')]);_0x70303c[_0x8c78('0x43')]=qs['filters'](_[_0x8c78('0x44')](_0x8ae0fa[_0x8c78('0x3b')],_0x8beb74['filters']));if(_0x8ae0fa['query'][_0x8c78('0x45')]){_0x70303c[_0x8c78('0x43')]=_[_0x8c78('0x48')](_0x70303c[_0x8c78('0x43')],{'$or':_[_0x8c78('0x35')](_0x70303c[_0x8c78('0x3f')],function(_0x4914e0){var _0x412d43={};_0x412d43[_0x4914e0]={'$like':'%'+_0x8ae0fa[_0x8c78('0x3b')][_0x8c78('0x45')]+'%'};return _0x412d43;})});}_0x70303c=_[_0x8c78('0x48')]({},_0x70303c,_0x8ae0fa[_0x8c78('0x49')]);return _0x2d168a[_0x8c78('0x55')](_0x70303c);}})['then'](function(_0x2914e3){if(_0x2914e3){_0x12edf1=_0x2914e3['length'];if(!_0x8ae0fa[_0x8c78('0x3b')]['hasOwnProperty'](_0x8c78('0x59'))){_0x70303c[_0x8c78('0x41')]=qs['limit'](_0x8ae0fa[_0x8c78('0x3b')]['limit']);_0x70303c[_0x8c78('0x2b')]=qs[_0x8c78('0x2b')](_0x8ae0fa[_0x8c78('0x3b')][_0x8c78('0x2b')]);}return _0x2d168a[_0x8c78('0x55')](_0x70303c);}})[_0x8c78('0x30')](function(_0x1b8227){if(_0x1b8227){return _0x1b8227?{'count':_0x12edf1,'rows':_0x1b8227}:null;}})[_0x8c78('0x30')](respondWithResult(_0x470271,null))['catch'](handleError(_0x470271,null));};exports[_0x8c78('0x5a')]=function(_0x1b0e30,_0x5d0404,_0x103cf9){if(_0x1b0e30[_0x8c78('0x52')]['id']){delete _0x1b0e30[_0x8c78('0x52')]['id'];}return db[_0x8c78('0x36')][_0x8c78('0x56')]({'where':{'id':_0x1b0e30[_0x8c78('0x4f')]['id']}})[_0x8c78('0x30')](handleEntityNotFound(_0x5d0404,null))['then'](function(_0x33b652){if(_0x33b652){_0x1b0e30[_0x8c78('0x52')][_0x8c78('0x5b')]=_0x33b652['id'];_0x1b0e30[_0x8c78('0x52')][_0x8c78('0x5c')]=integrations['getSubjects'](_0x1b0e30[_0x8c78('0x52')]['channel'],_0x1b0e30[_0x8c78('0x52')]['type']);_0x1b0e30[_0x8c78('0x52')][_0x8c78('0x5d')]=integrations[_0x8c78('0x5e')](_0x1b0e30[_0x8c78('0x52')][_0x8c78('0x5f')],_0x1b0e30[_0x8c78('0x52')]['type']);return db[_0x8c78('0x57')][_0x8c78('0x51')](_0x1b0e30[_0x8c78('0x52')],{'include':[{'model':db['ServicenowField'],'as':_0x8c78('0x5c')},{'model':db[_0x8c78('0x60')],'as':_0x8c78('0x5d')}]});}return null;})[_0x8c78('0x30')](respondWithResult(_0x5d0404,null))[_0x8c78('0x25')](handleError(_0x5d0404,null));};exports[_0x8c78('0x61')]=function(_0x1bd417,_0x3225fa,_0x137551){var _0x3a060f=[_0x8c78('0x62'),_0x8c78('0x63'),_0x8c78('0x64'),'subcategory','close_code','notify',_0x8c78('0x65'),_0x8c78('0x66'),'category'];var _0x441cb5=[_0x8c78('0x67'),_0x8c78('0x62'),_0x8c78('0x68'),_0x8c78('0x69'),_0x8c78('0x6a'),_0x8c78('0x6b'),_0x8c78('0x6c'),_0x8c78('0x63'),'approval_history',_0x8c78('0x6d'),_0x8c78('0x6e'),_0x8c78('0x6f'),'opened_by',_0x8c78('0x70'),_0x8c78('0x71'),'sys_domain','state',_0x8c78('0x72'),_0x8c78('0x64'),_0x8c78('0x58'),_0x8c78('0x73'),_0x8c78('0x74'),_0x8c78('0x75'),_0x8c78('0x76'),'impact','active',_0x8c78('0x77'),_0x8c78('0x78'),_0x8c78('0x79'),_0x8c78('0x7a'),_0x8c78('0x7b'),'time_worked',_0x8c78('0x7c'),_0x8c78('0x7d'),_0x8c78('0x7e'),_0x8c78('0x7f'),_0x8c78('0x80'),'reopened_time',_0x8c78('0x81'),_0x8c78('0x82'),_0x8c78('0x83'),_0x8c78('0x84'),'work_notes',_0x8c78('0x85'),'close_code',_0x8c78('0x86'),'delivery_task',_0x8c78('0x87'),_0x8c78('0x88'),_0x8c78('0x89'),_0x8c78('0x8a'),_0x8c78('0x8b'),_0x8c78('0x8c'),_0x8c78('0x8d'),'sys_class_name',_0x8c78('0x8e'),'closed_by',_0x8c78('0x8f'),_0x8c78('0x90'),_0x8c78('0x91'),'contact_type',_0x8c78('0x92'),_0x8c78('0x65'),_0x8c78('0x93'),'problem_id',_0x8c78('0x94'),_0x8c78('0x95'),_0x8c78('0x96'),_0x8c78('0x97'),_0x8c78('0x66'),'comments','sla_due',_0x8c78('0x98'),_0x8c78('0x99'),'due_date','sys_mod_count',_0x8c78('0x9a'),_0x8c78('0x9b'),_0x8c78('0x9c'),_0x8c78('0x9d'),'correlation_id','location','category'];var _0x3dd968='';var _0x328fff='';var _0x18f8fb=[];var _0x3f74cf='';var _0x4b5e52='';var _0x30d060=[];var _0xaa61c1='';var _0x269bda='';var _0x3f2276={};var _0x23729e='';return db[_0x8c78('0x36')][_0x8c78('0x56')]({'where':{'id':_0x1bd417[_0x8c78('0x4f')]['id']},'attributes':['id',_0x8c78('0x9e'),_0x8c78('0x9f'),'email',_0x8c78('0xa0'),_0x8c78('0xa1')]})[_0x8c78('0x30')](handleEntityNotFound(_0x3225fa,null))[_0x8c78('0x30')](function(_0x96e901){if(_0x96e901){_0x23729e=_0x96e901[_0x8c78('0xa0')];var _0x47b0df=_0x23729e[_0x8c78('0xa2')](-0x1);if(_0x47b0df==='/'){_0x23729e=_0x23729e[_0x8c78('0xa3')](0x0,_0x23729e[_0x8c78('0xa4')](_0x47b0df));}_0x269bda=util[_0x8c78('0xa5')]('%s/api/now/doc/table/schema/',_0x23729e);_0xaa61c1=util[_0x8c78('0xa5')](_0x8c78('0xa6'),_0x23729e);_0x3f2276={'user':_0x96e901[_0x8c78('0x9e')],'pass':_0x96e901[_0x8c78('0x9f')]};var _0x4c6645={'method':'GET','uri':_0x269bda+_0x8c78('0xa7'),'auth':_0x3f2276,'json':!![]};return rp(_0x4c6645);}})[_0x8c78('0x30')](function(_0x4ebe5c){if(_0x4ebe5c[_0x8c78('0xa8')][_0x8c78('0x40')]>0x0){_0x3dd968=_0x4ebe5c[_0x8c78('0xa8')];}console[_0x8c78('0xa9')](_0x8c78('0xaa'),_0x3dd968);_0x30d060=[];_0x328fff=Object[_0x8c78('0xab')]([],_0x3dd968);_['remove'](_0x328fff,function(_0x1f247e){return!_0x3a060f[_0x8c78('0xac')](_0x1f247e[_0x8c78('0x32')]);});_0x328fff[_0x8c78('0xad')](function(_0xec3015){var _0x364724=createFieldObject(_0xaa61c1,_0x3f2276,_0xec3015[_0x8c78('0xae')],_0xec3015[_0x8c78('0x32')],_0xec3015[_0x8c78('0xaf')],![]);_0x30d060[_0x8c78('0xb0')](_0x364724);});return Promise[_0x8c78('0xb1')](_0x30d060);})['then'](function(_0x25784c){_0x18f8fb=_0x25784c;_0x3f74cf=Object[_0x8c78('0xab')]([],_0x3dd968);console[_0x8c78('0xa9')]('TCL:\x20_object',_0x3dd968);_[_0x8c78('0xb2')](_0x3f74cf,function(_0x5aa00b){return _0x441cb5[_0x8c78('0xac')](_0x5aa00b[_0x8c78('0x32')]);});console['log'](_0x8c78('0xb3'),_0x3f74cf);_0x30d060=[];_0x3f74cf[_0x8c78('0xad')](function(_0x545c40){var _0x3c2129=createFieldObject(_0xaa61c1,_0x3f2276,_0x545c40['internalType'],_0x545c40[_0x8c78('0x32')],_0x545c40[_0x8c78('0xaf')],!![]);_0x30d060[_0x8c78('0xb0')](_0x3c2129);});return Promise['all'](_0x30d060);})[_0x8c78('0x30')](function(_0xc153c5){_0x4b5e52=_0xc153c5;var _0x241474=_0x18f8fb[_0x8c78('0xb4')](_0x4b5e52);return{'count':_0x241474[_0x8c78('0x40')],'rows':_0x241474};})[_0x8c78('0x30')](respondWithResult(_0x3225fa,null))[_0x8c78('0x25')](function(_0x4e3fb7){console[_0x8c78('0xa9')](_0x8c78('0xb5')+_0x4e3fb7);var _0x800185=_0x1bd417[_0x8c78('0x3b')][_0x8c78('0xb6')]?0x1f4:_0x4e3fb7[_0x8c78('0xb7')]||0x1f4;logger['error'](_0x4e3fb7[_0x8c78('0x31')]);delete _0x4e3fb7[_0x8c78('0x32')];if(_0x800185===0x191){_0x800185=0x190;}_0x3225fa['status'](_0x800185)[_0x8c78('0x33')](_0x1bd417[_0x8c78('0x3b')][_0x8c78('0xb6')]?{'message':_0x8c78('0xb8'),'statusCode':_0x4e3fb7[_0x8c78('0xb7')]}:_0x4e3fb7);});};function createFieldObject(_0x5c3521,_0x41e4d8,_0xa83483,_0x5bd27d,_0x4e14ee,_0x44a956){return new Promise(function(_0x592c32,_0x5e11b0){var _0xb35ea0={'id':_0x5bd27d,'name':_0x4e14ee,'custom':_0x44a956};if(_0xa83483===_0x8c78('0xb9')){_0xb35ea0['options']=[{'name':_0x8c78('0xba'),'value':_0x8c78('0xbb')},{'name':'False','value':_0x8c78('0xbc')}];_0x592c32(_0xb35ea0);}else{var _0xfd9068={'method':'GET','uri':_0x5c3521+_0x8c78('0xbd')+_0x5bd27d,'auth':_0x41e4d8,'json':!![]};return rp(_0xfd9068)[_0x8c78('0x30')](function(_0x70e87f){var _0x3727a8=[];if(_0x70e87f['result'][_0x8c78('0x40')]>0x0){_0x70e87f[_0x8c78('0xa8')]['forEach'](function(_0x175ae7){if(_0x175ae7['inactive']===_0x8c78('0xbc')){var _0x177a50={'name':_0x175ae7[_0x8c78('0xaf')],'value':_0x175ae7[_0x8c78('0xbe')]};_0x3727a8[_0x8c78('0xb0')](_0x177a50);}});}_0xb35ea0[_0x8c78('0x49')]=_0x3727a8;if(_0xb35ea0[_0x8c78('0x49')][_0x8c78('0x40')]>0x0){_0x592c32(_0xb35ea0);}else{if(_0x44a956==![]){_0x592c32();}else{_0x592c32(_0xb35ea0);}}});}});} \ No newline at end of file +var _0x5ec3=['info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','options','includeAll','include','create','body','find','params','getConfigurations','findOne','ServicenowConfiguration','filter','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','work_notes','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','incident\x20table\x20objects','assign','includes','internalType','label','all','log','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','concat','send','Wrong\x20credentials','statusCode','True','true','inactive','false','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','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','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message'];(function(_0x2ff88b,_0x559d50){var _0x52bca0=function(_0x395b40){while(--_0x395b40){_0x2ff88b['push'](_0x2ff88b['shift']());}};_0x52bca0(++_0x559d50);}(_0x5ec3,0xa1));var _0x35ec=function(_0x3fa604,_0x4e9e1d){_0x3fa604=_0x3fa604-0x0;var _0x2de423=_0x5ec3[_0x3fa604];return _0x2de423;};'use strict';var pdf=require(_0x35ec('0x0'));var emlformat=require(_0x35ec('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35ec('0x2'));var jsonpatch=require(_0x35ec('0x3'));var rp=require(_0x35ec('0x4'));var moment=require(_0x35ec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x35ec('0x6'));var util=require(_0x35ec('0x7'));var path=require(_0x35ec('0x8'));var sox=require(_0x35ec('0x9'));var csv=require(_0x35ec('0xa'));var ejs=require(_0x35ec('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x35ec('0xc'));var crypto=require(_0x35ec('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x35ec('0xe'));var toCsv=require(_0x35ec('0xa'));var querystring=require(_0x35ec('0xf'));var Papa=require(_0x35ec('0x10'));var Redis=require(_0x35ec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35ec('0x12'));var as=require(_0x35ec('0x13'));var hardwareService=require(_0x35ec('0x14'));var logger=require(_0x35ec('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x35ec('0x16'));var db=require(_0x35ec('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x188b72,_0x87424f,_0x27f067){if(_0x27f067){var _0x376217=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x376217[_0x35ec('0x18')](_0x87424f)){return _0x188b72;}else{throw new db[(_0x35ec('0x19'))][(_0x35ec('0x1a'))](_0x35ec('0x1b'));}}else{return _0x188b72;}}function respondWithRpcPromise(_0x2d3bcb,_0x3a239d,_0x8632c7,_0x201209){return new BPromise(function(_0x444560,_0x242bab){var _0x427fdd=_0x201209||client;return _0x427fdd['request'](_0x2d3bcb,_0x8632c7)[_0x35ec('0x1c')](function(_0x1612e6){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x3a239d,_0x35ec('0x1d'));logger[_0x35ec('0x1e')](_0x35ec('0x1f'),_0x3a239d,'request\x20sent',JSON[_0x35ec('0x20')](_0x1612e6));if(_0x1612e6[_0x35ec('0x21')]){if(_0x1612e6[_0x35ec('0x21')][_0x35ec('0x22')]===0x1f4){logger[_0x35ec('0x21')](_0x35ec('0x23'),_0x3a239d,_0x1612e6[_0x35ec('0x21')][_0x35ec('0x24')]);return _0x242bab(_0x1612e6[_0x35ec('0x21')][_0x35ec('0x24')]);}logger[_0x35ec('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0x3a239d,_0x1612e6[_0x35ec('0x21')][_0x35ec('0x24')]);return _0x444560(_0x1612e6['error'][_0x35ec('0x24')]);}else{logger[_0x35ec('0x25')](_0x35ec('0x23'),_0x3a239d,'request\x20sent');_0x444560(_0x1612e6[_0x35ec('0x26')]['message']);}})[_0x35ec('0x27')](function(_0x32324d){logger[_0x35ec('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0x3a239d,_0x32324d);_0x242bab(_0x32324d);});});}function respondWithStatusCode(_0x4d39df,_0x740d21){_0x740d21=_0x740d21||0xcc;return function(_0x2ff471){if(_0x2ff471){return _0x4d39df[_0x35ec('0x28')](_0x740d21);}return _0x4d39df[_0x35ec('0x29')](_0x740d21)[_0x35ec('0x2a')]();};}function respondWithResult(_0x322d51,_0x541b03){_0x541b03=_0x541b03||0xc8;return function(_0x3c0dc9){if(_0x3c0dc9){return _0x322d51[_0x35ec('0x29')](_0x541b03)['json'](_0x3c0dc9);}};}function respondWithFilteredResult(_0xe88cee,_0x173982){return function(_0x34474e){if(_0x34474e){var _0x271cf1=_0x34474e[_0x35ec('0x2b')],_0x34b61b=_0x173982['offset'],_0x444d90=_0x173982[_0x35ec('0x2c')]+_0x173982[_0x35ec('0x2d')],_0x22eba9;if(_0x444d90>=_0x271cf1){_0x444d90=_0x271cf1;_0x22eba9=0xc8;}else{_0x22eba9=0xce;}_0xe88cee[_0x35ec('0x29')](_0x22eba9);return _0xe88cee[_0x35ec('0x2e')](_0x35ec('0x2f'),_0x34b61b+'-'+_0x444d90+'/'+_0x271cf1)[_0x35ec('0x30')](_0x34474e);}return null;};}function patchUpdates(_0x59b7f5){return function(_0x584649){try{jsonpatch[_0x35ec('0x31')](_0x584649,_0x59b7f5,!![]);}catch(_0x348fc1){return BPromise[_0x35ec('0x32')](_0x348fc1);}return _0x584649[_0x35ec('0x33')]();};}function saveUpdates(_0x393981,_0x9e48f5){return function(_0x72031){if(_0x72031){return _0x72031[_0x35ec('0x34')](_0x393981)[_0x35ec('0x1c')](function(_0x4679d0){return _0x4679d0;});}return null;};}function removeEntity(_0x1e6984,_0xc93638){return function(_0x84b87f){if(_0x84b87f){return _0x84b87f[_0x35ec('0x35')]()[_0x35ec('0x1c')](function(){_0x1e6984['status'](0xcc)[_0x35ec('0x2a')]();});}};}function handleEntityNotFound(_0x2bb39d,_0x52b78d){return function(_0x18d0e7){if(!_0x18d0e7){_0x2bb39d[_0x35ec('0x28')](0x194);}return _0x18d0e7;};}function handleError(_0x111e4b,_0x3e3a82){_0x3e3a82=_0x3e3a82||0x1f4;return function(_0x58da42){logger[_0x35ec('0x21')](_0x58da42[_0x35ec('0x36')]);if(_0x58da42['name']){delete _0x58da42['name'];}_0x111e4b[_0x35ec('0x29')](_0x3e3a82)['send'](_0x58da42);};}exports[_0x35ec('0x37')]=function(_0x21a75c,_0x5c7ca7){var _0x3e47cc={},_0x3d63fb={},_0x412a14={'count':0x0,'rows':[]};var _0x120311=_[_0x35ec('0x38')](db[_0x35ec('0x39')][_0x35ec('0x3a')],function(_0x5c5c75){return{'name':_0x5c5c75[_0x35ec('0x3b')],'type':_0x5c5c75[_0x35ec('0x3c')][_0x35ec('0x3d')]};});_0x3d63fb['model']=_['map'](_0x120311,_0x35ec('0x3e'));_0x3d63fb[_0x35ec('0x3f')]=_[_0x35ec('0x40')](_0x21a75c[_0x35ec('0x3f')]);_0x3d63fb['filters']=_[_0x35ec('0x41')](_0x3d63fb[_0x35ec('0x42')],_0x3d63fb[_0x35ec('0x3f')]);_0x3e47cc['attributes']=_[_0x35ec('0x41')](_0x3d63fb[_0x35ec('0x42')],qs[_0x35ec('0x43')](_0x21a75c['query'][_0x35ec('0x43')]));_0x3e47cc['attributes']=_0x3e47cc[_0x35ec('0x44')][_0x35ec('0x45')]?_0x3e47cc[_0x35ec('0x44')]:_0x3d63fb[_0x35ec('0x42')];if(!_0x21a75c[_0x35ec('0x3f')]['hasOwnProperty'](_0x35ec('0x46'))){_0x3e47cc['limit']=qs[_0x35ec('0x2d')](_0x21a75c[_0x35ec('0x3f')][_0x35ec('0x2d')]);_0x3e47cc[_0x35ec('0x2c')]=qs[_0x35ec('0x2c')](_0x21a75c['query'][_0x35ec('0x2c')]);}_0x3e47cc[_0x35ec('0x47')]=qs[_0x35ec('0x48')](_0x21a75c[_0x35ec('0x3f')][_0x35ec('0x48')]);_0x3e47cc[_0x35ec('0x49')]=qs[_0x35ec('0x4a')](_[_0x35ec('0x4b')](_0x21a75c[_0x35ec('0x3f')],_0x3d63fb[_0x35ec('0x4a')]),_0x120311);if(_0x21a75c[_0x35ec('0x3f')]['filter']){_0x3e47cc[_0x35ec('0x49')]=_[_0x35ec('0x4c')](_0x3e47cc[_0x35ec('0x49')],{'$or':_[_0x35ec('0x38')](_0x120311,function(_0x14d90c){if(_0x14d90c[_0x35ec('0x3c')]!=='VIRTUAL'){var _0x2c4d03={};_0x2c4d03[_0x14d90c['name']]={'$like':'%'+_0x21a75c['query']['filter']+'%'};return _0x2c4d03;}})});}_0x3e47cc=_['merge']({},_0x3e47cc,_0x21a75c[_0x35ec('0x4d')]);var _0x34ae58={'where':_0x3e47cc[_0x35ec('0x49')]};return db[_0x35ec('0x39')][_0x35ec('0x2b')](_0x34ae58)[_0x35ec('0x1c')](function(_0x2f271d){_0x412a14[_0x35ec('0x2b')]=_0x2f271d;if(_0x21a75c['query'][_0x35ec('0x4e')]){_0x3e47cc['include']=[{'all':!![]}];}return db[_0x35ec('0x39')]['findAll'](_0x3e47cc);})[_0x35ec('0x1c')](function(_0x3135cc){_0x412a14['rows']=_0x3135cc;return _0x412a14;})[_0x35ec('0x1c')](respondWithFilteredResult(_0x5c7ca7,_0x3e47cc))['catch'](handleError(_0x5c7ca7,null));};exports['show']=function(_0x551f40,_0x375cb4){var _0x3f6fbb={'raw':![],'where':{'id':_0x551f40['params']['id']}},_0x5e2348={};_0x5e2348[_0x35ec('0x42')]=_['keys'](db[_0x35ec('0x39')][_0x35ec('0x3a')]);_0x5e2348[_0x35ec('0x3f')]=_['keys'](_0x551f40[_0x35ec('0x3f')]);_0x5e2348[_0x35ec('0x4a')]=_['intersection'](_0x5e2348[_0x35ec('0x42')],_0x5e2348[_0x35ec('0x3f')]);_0x3f6fbb[_0x35ec('0x44')]=_[_0x35ec('0x41')](_0x5e2348['model'],qs[_0x35ec('0x43')](_0x551f40[_0x35ec('0x3f')][_0x35ec('0x43')]));_0x3f6fbb[_0x35ec('0x44')]=_0x3f6fbb[_0x35ec('0x44')][_0x35ec('0x45')]?_0x3f6fbb['attributes']:_0x5e2348[_0x35ec('0x42')];if(_0x551f40[_0x35ec('0x3f')][_0x35ec('0x4e')]){_0x3f6fbb[_0x35ec('0x4f')]=[{'all':!![]}];}_0x3f6fbb=_[_0x35ec('0x4c')]({},_0x3f6fbb,_0x551f40[_0x35ec('0x4d')]);return db[_0x35ec('0x39')]['find'](_0x3f6fbb)[_0x35ec('0x1c')](handleEntityNotFound(_0x375cb4,null))[_0x35ec('0x1c')](respondWithResult(_0x375cb4,null))[_0x35ec('0x27')](handleError(_0x375cb4,null));};exports[_0x35ec('0x50')]=function(_0x333419,_0x4f18b9){return db['ServicenowAccount'][_0x35ec('0x50')](_0x333419[_0x35ec('0x51')],{})[_0x35ec('0x1c')](respondWithResult(_0x4f18b9,0xc9))[_0x35ec('0x27')](handleError(_0x4f18b9,null));};exports[_0x35ec('0x34')]=function(_0x15fe64,_0x39071d){if(_0x15fe64['body']['id']){delete _0x15fe64[_0x35ec('0x51')]['id'];}return db[_0x35ec('0x39')][_0x35ec('0x52')]({'where':{'id':_0x15fe64[_0x35ec('0x53')]['id']}})['then'](handleEntityNotFound(_0x39071d,null))[_0x35ec('0x1c')](saveUpdates(_0x15fe64[_0x35ec('0x51')],null))[_0x35ec('0x1c')](respondWithResult(_0x39071d,null))[_0x35ec('0x27')](handleError(_0x39071d,null));};exports[_0x35ec('0x35')]=function(_0x22c62e,_0x441c22){return db[_0x35ec('0x39')]['find']({'where':{'id':_0x22c62e['params']['id']}})['then'](handleEntityNotFound(_0x441c22,null))['then'](removeEntity(_0x441c22,null))[_0x35ec('0x27')](handleError(_0x441c22,null));};exports[_0x35ec('0x54')]=function(_0x33e8ac,_0x1b8f91,_0x5396da){var _0xa8ac8f={};var _0x2dcf99={};var _0x1435aa;var _0x229da6;return db[_0x35ec('0x39')][_0x35ec('0x55')]({'where':{'id':_0x33e8ac['params']['id']}})[_0x35ec('0x1c')](handleEntityNotFound(_0x1b8f91,null))[_0x35ec('0x1c')](function(_0x5be277){if(_0x5be277){_0x1435aa=_0x5be277;_0x2dcf99[_0x35ec('0x42')]=_['keys'](db[_0x35ec('0x56')][_0x35ec('0x3a')]);_0x2dcf99[_0x35ec('0x3f')]=_[_0x35ec('0x40')](_0x33e8ac[_0x35ec('0x3f')]);_0x2dcf99['filters']=_[_0x35ec('0x41')](_0x2dcf99[_0x35ec('0x42')],_0x2dcf99[_0x35ec('0x3f')]);_0xa8ac8f[_0x35ec('0x44')]=_[_0x35ec('0x41')](_0x2dcf99[_0x35ec('0x42')],qs[_0x35ec('0x43')](_0x33e8ac['query']['fields']));_0xa8ac8f['attributes']=_0xa8ac8f['attributes']['length']?_0xa8ac8f[_0x35ec('0x44')]:_0x2dcf99['model'];_0xa8ac8f['order']=qs['sort'](_0x33e8ac[_0x35ec('0x3f')]['sort']);_0xa8ac8f[_0x35ec('0x49')]=qs[_0x35ec('0x4a')](_[_0x35ec('0x4b')](_0x33e8ac[_0x35ec('0x3f')],_0x2dcf99['filters']));if(_0x33e8ac[_0x35ec('0x3f')][_0x35ec('0x57')]){_0xa8ac8f[_0x35ec('0x49')]=_['merge'](_0xa8ac8f[_0x35ec('0x49')],{'$or':_[_0x35ec('0x38')](_0xa8ac8f[_0x35ec('0x44')],function(_0x21f5d1){var _0x57eb47={};_0x57eb47[_0x21f5d1]={'$like':'%'+_0x33e8ac[_0x35ec('0x3f')]['filter']+'%'};return _0x57eb47;})});}_0xa8ac8f=_[_0x35ec('0x4c')]({},_0xa8ac8f,_0x33e8ac[_0x35ec('0x4d')]);return _0x1435aa['getConfigurations'](_0xa8ac8f);}})[_0x35ec('0x1c')](function(_0x3d76c0){if(_0x3d76c0){_0x229da6=_0x3d76c0[_0x35ec('0x45')];if(!_0x33e8ac[_0x35ec('0x3f')][_0x35ec('0x58')](_0x35ec('0x46'))){_0xa8ac8f[_0x35ec('0x2d')]=qs[_0x35ec('0x2d')](_0x33e8ac[_0x35ec('0x3f')][_0x35ec('0x2d')]);_0xa8ac8f[_0x35ec('0x2c')]=qs['offset'](_0x33e8ac[_0x35ec('0x3f')][_0x35ec('0x2c')]);}return _0x1435aa[_0x35ec('0x54')](_0xa8ac8f);}})[_0x35ec('0x1c')](function(_0x5917a8){if(_0x5917a8){return _0x5917a8?{'count':_0x229da6,'rows':_0x5917a8}:null;}})[_0x35ec('0x1c')](respondWithResult(_0x1b8f91,null))[_0x35ec('0x27')](handleError(_0x1b8f91,null));};exports[_0x35ec('0x59')]=function(_0x32b97f,_0x566a57,_0x1808a4){if(_0x32b97f['body']['id']){delete _0x32b97f[_0x35ec('0x51')]['id'];}return db[_0x35ec('0x39')][_0x35ec('0x55')]({'where':{'id':_0x32b97f[_0x35ec('0x53')]['id']}})[_0x35ec('0x1c')](handleEntityNotFound(_0x566a57,null))[_0x35ec('0x1c')](function(_0x4b639d){if(_0x4b639d){_0x32b97f['body'][_0x35ec('0x5a')]=_0x4b639d['id'];_0x32b97f[_0x35ec('0x51')]['Subjects']=integrations[_0x35ec('0x5b')](_0x32b97f[_0x35ec('0x51')][_0x35ec('0x5c')],_0x32b97f[_0x35ec('0x51')]['type']);_0x32b97f[_0x35ec('0x51')]['Descriptions']=integrations[_0x35ec('0x5d')](_0x32b97f[_0x35ec('0x51')][_0x35ec('0x5c')],_0x32b97f[_0x35ec('0x51')][_0x35ec('0x3c')]);return db[_0x35ec('0x56')]['create'](_0x32b97f[_0x35ec('0x51')],{'include':[{'model':db[_0x35ec('0x5e')],'as':'Subjects'},{'model':db[_0x35ec('0x5e')],'as':_0x35ec('0x5f')}]});}return null;})[_0x35ec('0x1c')](respondWithResult(_0x566a57,null))['catch'](handleError(_0x566a57,null));};exports[_0x35ec('0x60')]=function(_0x53b3bc,_0x3a8330,_0x194d53){var _0x3f27dd=[_0x35ec('0x61'),_0x35ec('0x62'),_0x35ec('0x63'),_0x35ec('0x64'),_0x35ec('0x65'),_0x35ec('0x66'),'incident_state','severity',_0x35ec('0x67')];var _0x1fc63b=[_0x35ec('0x68'),_0x35ec('0x61'),'caused_by',_0x35ec('0x69'),_0x35ec('0x6a'),_0x35ec('0x6b'),_0x35ec('0x6c'),_0x35ec('0x62'),_0x35ec('0x6d'),'number',_0x35ec('0x6e'),_0x35ec('0x6f'),_0x35ec('0x70'),'user_input',_0x35ec('0x71'),_0x35ec('0x72'),_0x35ec('0x73'),'sys_created_by',_0x35ec('0x63'),_0x35ec('0x47'),_0x35ec('0x74'),_0x35ec('0x75'),'cmdb_ci',_0x35ec('0x76'),_0x35ec('0x77'),_0x35ec('0x78'),_0x35ec('0x79'),_0x35ec('0x7a'),_0x35ec('0x7b'),_0x35ec('0x7c'),_0x35ec('0x7d'),_0x35ec('0x7e'),_0x35ec('0x7f'),_0x35ec('0x80'),_0x35ec('0x81'),_0x35ec('0x82'),'work_end',_0x35ec('0x83'),_0x35ec('0x84'),_0x35ec('0x85'),'approval_set',_0x35ec('0x64'),_0x35ec('0x86'),'short_description','close_code','correlation_display','delivery_task',_0x35ec('0x87'),_0x35ec('0x88'),_0x35ec('0x89'),_0x35ec('0x8a'),_0x35ec('0x8b'),_0x35ec('0x8c'),_0x35ec('0x66'),_0x35ec('0x8d'),_0x35ec('0x8e'),_0x35ec('0x8f'),_0x35ec('0x90'),'parent_incident',_0x35ec('0x91'),_0x35ec('0x92'),_0x35ec('0x93'),_0x35ec('0x94'),_0x35ec('0x95'),_0x35ec('0x96'),_0x35ec('0x97'),_0x35ec('0x98'),_0x35ec('0x99'),_0x35ec('0x9a'),_0x35ec('0x9b'),_0x35ec('0x9c'),_0x35ec('0x9d'),_0x35ec('0x9e'),_0x35ec('0x9f'),'due_date',_0x35ec('0xa0'),_0x35ec('0xa1'),_0x35ec('0xa2'),_0x35ec('0xa3'),_0x35ec('0xa4'),_0x35ec('0xa5'),_0x35ec('0xa6'),_0x35ec('0x67')];var _0x14509='';var _0x286957='';var _0x1c82d7=[];var _0x404776='';var _0x11f298='';var _0x6e6559=[];var _0x22d23c='';var _0x27d981='';var _0x3f7a02={};var _0x42d319='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x53b3bc[_0x35ec('0x53')]['id']},'attributes':['id',_0x35ec('0xa7'),_0x35ec('0xa8'),_0x35ec('0xa9'),_0x35ec('0xaa'),_0x35ec('0xab')]})[_0x35ec('0x1c')](handleEntityNotFound(_0x3a8330,null))['then'](function(_0x2d56d4){if(_0x2d56d4){_0x42d319=_0x2d56d4[_0x35ec('0xaa')];var _0x66cf19=_0x42d319[_0x35ec('0xac')](-0x1);if(_0x66cf19==='/'){_0x42d319=_0x42d319[_0x35ec('0xad')](0x0,_0x42d319[_0x35ec('0xae')](_0x66cf19));}_0x27d981=util[_0x35ec('0xaf')]('%s/api/now/doc/table/schema/',_0x42d319);_0x22d23c=util[_0x35ec('0xaf')](_0x35ec('0xb0'),_0x42d319);_0x3f7a02={'user':_0x2d56d4[_0x35ec('0xa7')],'pass':_0x2d56d4[_0x35ec('0xa8')]};var _0x5379b4={'method':_0x35ec('0xb1'),'uri':_0x27d981+_0x35ec('0xb2'),'auth':_0x3f7a02,'json':!![]};return rp(_0x5379b4);}})['then'](function(_0x4bd75a){if(_0x4bd75a['result'][_0x35ec('0x45')]>0x0){_0x14509=_0x4bd75a['result'];}console['log'](_0x35ec('0xb3'),_0x14509);_0x6e6559=[];_0x286957=Object[_0x35ec('0xb4')]([],_0x14509);_['remove'](_0x286957,function(_0x354df6){return!_0x3f27dd[_0x35ec('0xb5')](_0x354df6[_0x35ec('0x3e')]);});_0x286957['forEach'](function(_0x593a0b){var _0x38bc12=createFieldObject(_0x22d23c,_0x3f7a02,_0x593a0b[_0x35ec('0xb6')],_0x593a0b['name'],_0x593a0b[_0x35ec('0xb7')],![]);_0x6e6559['push'](_0x38bc12);});return Promise[_0x35ec('0xb8')](_0x6e6559);})['then'](function(_0x158fb0){_0x1c82d7=_0x158fb0;_0x404776=Object[_0x35ec('0xb4')]([],_0x14509);console[_0x35ec('0xb9')]('TCL:\x20_object',_0x14509);_[_0x35ec('0xba')](_0x404776,function(_0xc7e760){return _0x1fc63b['includes'](_0xc7e760[_0x35ec('0x3e')]);});console['log'](_0x35ec('0xbb'),_0x404776);_0x6e6559=[];_0x404776[_0x35ec('0xbc')](function(_0x3035b9){var _0x4bb774=createFieldObject(_0x22d23c,_0x3f7a02,_0x3035b9['internalType'],_0x3035b9['name'],_0x3035b9[_0x35ec('0xb7')],!![]);_0x6e6559[_0x35ec('0xbd')](_0x4bb774);});return Promise[_0x35ec('0xb8')](_0x6e6559);})[_0x35ec('0x1c')](function(_0x3f71ee){_0x11f298=_0x3f71ee;var _0x5b229e=_0x1c82d7[_0x35ec('0xbe')](_0x11f298);return{'count':_0x5b229e[_0x35ec('0x45')],'rows':_0x5b229e};})[_0x35ec('0x1c')](respondWithResult(_0x3a8330,null))['catch'](function(_0x24b998){console['log']('ServiceNow\x20error:\x20'+_0x24b998);var _0x2c069e=_0x53b3bc[_0x35ec('0x3f')][_0x35ec('0x18')]?0x1f4:_0x24b998['statusCode']||0x1f4;logger['error'](_0x24b998[_0x35ec('0x36')]);delete _0x24b998[_0x35ec('0x3e')];if(_0x2c069e===0x191){_0x2c069e=0x190;}_0x3a8330[_0x35ec('0x29')](_0x2c069e)[_0x35ec('0xbf')](_0x53b3bc[_0x35ec('0x3f')][_0x35ec('0x18')]?{'message':_0x35ec('0xc0'),'statusCode':_0x24b998[_0x35ec('0xc1')]}:_0x24b998);});};function createFieldObject(_0x537e54,_0x51665a,_0x5ccf21,_0x2514ba,_0x2eac37,_0xc6f71b){return new Promise(function(_0x3989f8,_0x3dcf8f){var _0x263fb0={'id':_0x2514ba,'name':_0x2eac37,'custom':_0xc6f71b};if(_0x5ccf21==='boolean'){_0x263fb0[_0x35ec('0x4d')]=[{'name':_0x35ec('0xc2'),'value':_0x35ec('0xc3')},{'name':'False','value':'false'}];_0x3989f8(_0x263fb0);}else{var _0x4b70fe={'method':_0x35ec('0xb1'),'uri':_0x537e54+'sys_choice?sysparm_query=name=incident^element='+_0x2514ba,'auth':_0x51665a,'json':!![]};return rp(_0x4b70fe)['then'](function(_0x4021fb){var _0x2edd16=[];if(_0x4021fb[_0x35ec('0x26')][_0x35ec('0x45')]>0x0){_0x4021fb[_0x35ec('0x26')][_0x35ec('0xbc')](function(_0x35205b){if(_0x35205b[_0x35ec('0xc4')]===_0x35ec('0xc5')){var _0x3ca099={'name':_0x35205b[_0x35ec('0xb7')],'value':_0x35205b['value']};_0x2edd16[_0x35ec('0xbd')](_0x3ca099);}});}_0x263fb0[_0x35ec('0x4d')]=_0x2edd16;if(_0x263fb0[_0x35ec('0x4d')][_0x35ec('0x45')]>0x0){_0x3989f8(_0x263fb0);}else{if(_0xc6f71b==![]){_0x3989f8();}else{_0x3989f8(_0x263fb0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e13b0b5..80950b2 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 _0x3a4c=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','lodash','util','api','moment','bluebird','request-promise'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0x3a4c,0xe4));var _0xc3a4=function(_0xddbe4b,_0xbd131c){_0xddbe4b=_0xddbe4b-0x0;var _0x222a24=_0x3a4c[_0xddbe4b];return _0x222a24;};'use strict';var _=require(_0xc3a4('0x0'));var util=require(_0xc3a4('0x1'));var logger=require('../../config/logger')(_0xc3a4('0x2'));var moment=require(_0xc3a4('0x3'));var BPromise=require(_0xc3a4('0x4'));var rp=require(_0xc3a4('0x5'));var fs=require('fs');var path=require(_0xc3a4('0x6'));var rimraf=require(_0xc3a4('0x7'));var config=require(_0xc3a4('0x8'));var attributes=require(_0xc3a4('0x9'));var integrations=require(_0xc3a4('0xa'));module['exports']=function(_0xdebc20,_0xbde53a){return _0xdebc20[_0xc3a4('0xb')](_0xc3a4('0xc'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4955=['path','rimraf','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x33414d,_0x32021b){var _0x3af72f=function(_0x28c356){while(--_0x28c356){_0x33414d['push'](_0x33414d['shift']());}};_0x3af72f(++_0x32021b);}(_0x4955,0x181));var _0x5495=function(_0x6696,_0x246731){_0x6696=_0x6696-0x0;var _0x32bd72=_0x4955[_0x6696];return _0x32bd72;};'use strict';var _=require(_0x5495('0x0'));var util=require('util');var logger=require(_0x5495('0x1'))('api');var moment=require(_0x5495('0x2'));var BPromise=require(_0x5495('0x3'));var rp=require(_0x5495('0x4'));var fs=require('fs');var path=require(_0x5495('0x5'));var rimraf=require(_0x5495('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x5495('0x7'));module[_0x5495('0x8')]=function(_0x5f53f3,_0x181821){return _0x5f53f3['define']('ServicenowAccount',attributes,{'tableName':_0x5495('0x9'),'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 0c6ed08..475cf2f 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 _0xb235=['message','catch','GetServicenowAccount','findAll','raw','options','where','attributes','limit','include','map','model','debug','ShowServicenowAccount','ServicenowAccount','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s'];(function(_0x556757,_0x54da56){var _0x14852c=function(_0x22e67a){while(--_0x22e67a){_0x556757['push'](_0x556757['shift']());}};_0x14852c(++_0x54da56);}(_0xb235,0xd5));var _0x5b23=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0xb235[_0x5d8631];return _0x34c15e;};'use strict';var _=require(_0x5b23('0x0'));var util=require(_0x5b23('0x1'));var moment=require('moment');var BPromise=require(_0x5b23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b23('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b23('0x4'));var logger=require(_0x5b23('0x5'))(_0x5b23('0x6'));var config=require(_0x5b23('0x7'));var jayson=require(_0x5b23('0x8'));var client=jayson[_0x5b23('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1733d7,_0xb6ea1f,_0x6d0f5f){return new BPromise(function(_0x460d7d,_0x2f1eb6){return client[_0x5b23('0xa')](_0x1733d7,_0x6d0f5f)[_0x5b23('0xb')](function(_0x4ab99f){logger[_0x5b23('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0xb6ea1f,_0x5b23('0xd'));logger['debug'](_0x5b23('0xe'),_0xb6ea1f,_0x5b23('0xd'),JSON[_0x5b23('0xf')](_0x4ab99f));if(_0x4ab99f[_0x5b23('0x10')]){if(_0x4ab99f[_0x5b23('0x10')]['code']===0x1f4){logger[_0x5b23('0x10')](_0x5b23('0x11'),_0xb6ea1f,_0x4ab99f[_0x5b23('0x10')][_0x5b23('0x12')]);return _0x2f1eb6(_0x4ab99f['error'][_0x5b23('0x12')]);}logger[_0x5b23('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0xb6ea1f,_0x4ab99f[_0x5b23('0x10')]['message']);return _0x460d7d(_0x4ab99f[_0x5b23('0x10')]['message']);}else{logger[_0x5b23('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0xb6ea1f,_0x5b23('0xd'));_0x460d7d(_0x4ab99f['result'][_0x5b23('0x12')]);}})[_0x5b23('0x13')](function(_0x40e885){logger[_0x5b23('0x10')](_0x5b23('0x11'),_0xb6ea1f,_0x40e885);_0x2f1eb6(_0x40e885);});});}exports[_0x5b23('0x14')]=function(_0x49b8a6){var _0x39f379=this;return new Promise(function(_0x469a69,_0x3c8834){return db['ServicenowAccount'][_0x5b23('0x15')]({'raw':_0x49b8a6['options']?_0x49b8a6['options'][_0x5b23('0x16')]===undefined?!![]:![]:!![],'where':_0x49b8a6[_0x5b23('0x17')]?_0x49b8a6[_0x5b23('0x17')][_0x5b23('0x18')]||null:null,'attributes':_0x49b8a6[_0x5b23('0x17')]?_0x49b8a6[_0x5b23('0x17')][_0x5b23('0x19')]||null:null,'limit':_0x49b8a6['options']?_0x49b8a6[_0x5b23('0x17')][_0x5b23('0x1a')]||null:null,'include':_0x49b8a6[_0x5b23('0x17')]?_0x49b8a6[_0x5b23('0x17')][_0x5b23('0x1b')]?_[_0x5b23('0x1c')](_0x49b8a6[_0x5b23('0x17')][_0x5b23('0x1b')],function(_0x5cce85){return{'model':db[_0x5cce85[_0x5b23('0x1d')]],'as':_0x5cce85['as'],'attributes':_0x5cce85[_0x5b23('0x19')],'include':_0x5cce85[_0x5b23('0x1b')]?_[_0x5b23('0x1c')](_0x5cce85[_0x5b23('0x1b')],function(_0x3a127e){return{'model':db[_0x3a127e['model']],'as':_0x3a127e['as'],'attributes':_0x3a127e[_0x5b23('0x19')],'include':_0x3a127e[_0x5b23('0x1b')]?_['map'](_0x3a127e['include'],function(_0x4d10bc){return{'model':db[_0x4d10bc[_0x5b23('0x1d')]],'as':_0x4d10bc['as'],'attributes':_0x4d10bc[_0x5b23('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5b23('0xb')](function(_0x4cb7c3){logger[_0x5b23('0xc')]('GetServicenowAccount',_0x49b8a6);logger[_0x5b23('0x1e')]('GetServicenowAccount',_0x49b8a6,JSON[_0x5b23('0xf')](_0x4cb7c3));_0x469a69(_0x4cb7c3);})[_0x5b23('0x13')](function(_0x1e41d9){logger[_0x5b23('0x10')](_0x5b23('0x14'),_0x1e41d9[_0x5b23('0x12')],_0x49b8a6);_0x3c8834(_0x39f379[_0x5b23('0x10')](0x1f4,_0x1e41d9[_0x5b23('0x12')]));});});};exports[_0x5b23('0x1f')]=function(_0xdcc31d){var _0xb02a52=this;return new Promise(function(_0x3e446d,_0x371a23){return db[_0x5b23('0x20')]['find']({'raw':_0xdcc31d['options']?_0xdcc31d[_0x5b23('0x17')][_0x5b23('0x16')]===undefined?!![]:![]:!![],'where':_0xdcc31d['options']?_0xdcc31d[_0x5b23('0x17')][_0x5b23('0x18')]||null:null,'attributes':_0xdcc31d[_0x5b23('0x17')]?_0xdcc31d[_0x5b23('0x17')][_0x5b23('0x19')]||null:null,'include':_0xdcc31d[_0x5b23('0x17')]?_0xdcc31d[_0x5b23('0x17')]['include']?_['map'](_0xdcc31d[_0x5b23('0x17')][_0x5b23('0x1b')],function(_0x3f41d7){return{'model':db[_0x3f41d7['model']],'as':_0x3f41d7['as'],'attributes':_0x3f41d7[_0x5b23('0x19')],'include':_0x3f41d7[_0x5b23('0x1b')]?_[_0x5b23('0x1c')](_0x3f41d7[_0x5b23('0x1b')],function(_0x176d5b){return{'model':db[_0x176d5b[_0x5b23('0x1d')]],'as':_0x176d5b['as'],'attributes':_0x176d5b['attributes'],'include':_0x176d5b[_0x5b23('0x1b')]?_[_0x5b23('0x1c')](_0x176d5b[_0x5b23('0x1b')],function(_0x222767){return{'model':db[_0x222767[_0x5b23('0x1d')]],'as':_0x222767['as'],'attributes':_0x222767[_0x5b23('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5b23('0xb')](function(_0xa403c1){logger[_0x5b23('0xc')](_0x5b23('0x1f'),_0xdcc31d);logger[_0x5b23('0x1e')]('ShowServicenowAccount',_0xdcc31d,JSON[_0x5b23('0xf')](_0xa403c1));_0x3e446d(_0xa403c1);})['catch'](function(_0x4d85b7){logger[_0x5b23('0x10')]('ShowServicenowAccount',_0x4d85b7['message'],_0xdcc31d);_0x371a23(_0xb02a52['error'](0x1f4,_0x4d85b7[_0x5b23('0x12')]));});});}; \ No newline at end of file +var _0x9518=['options','raw','where','attributes','limit','include','map','model','catch','ShowServicenowAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','request\x20sent','result','GetServicenowAccount','findAll'];(function(_0x2a97f7,_0x465e0c){var _0x13c258=function(_0x1b043d){while(--_0x1b043d){_0x2a97f7['push'](_0x2a97f7['shift']());}};_0x13c258(++_0x465e0c);}(_0x9518,0x115));var _0x8951=function(_0x3b2308,_0x53754c){_0x3b2308=_0x3b2308-0x0;var _0x42a190=_0x9518[_0x3b2308];return _0x42a190;};'use strict';var _=require(_0x8951('0x0'));var util=require(_0x8951('0x1'));var moment=require(_0x8951('0x2'));var BPromise=require(_0x8951('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8951('0x4'));var db=require(_0x8951('0x5'))['db'];var utils=require(_0x8951('0x6'));var logger=require(_0x8951('0x7'))(_0x8951('0x8'));var config=require(_0x8951('0x9'));var jayson=require(_0x8951('0xa'));var client=jayson[_0x8951('0xb')][_0x8951('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc69528,_0x2bef74,_0x5a4124){return new BPromise(function(_0x216bdc,_0x56ca45){return client[_0x8951('0xd')](_0xc69528,_0x5a4124)[_0x8951('0xe')](function(_0x23b825){logger[_0x8951('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x2bef74,'request\x20sent');logger[_0x8951('0x10')](_0x8951('0x11'),_0x2bef74,'request\x20sent',JSON[_0x8951('0x12')](_0x23b825));if(_0x23b825['error']){if(_0x23b825[_0x8951('0x13')][_0x8951('0x14')]===0x1f4){logger['error'](_0x8951('0x15'),_0x2bef74,_0x23b825[_0x8951('0x13')]['message']);return _0x56ca45(_0x23b825[_0x8951('0x13')]['message']);}logger[_0x8951('0x13')](_0x8951('0x15'),_0x2bef74,_0x23b825[_0x8951('0x13')][_0x8951('0x16')]);return _0x216bdc(_0x23b825[_0x8951('0x13')][_0x8951('0x16')]);}else{logger[_0x8951('0xf')](_0x8951('0x15'),_0x2bef74,_0x8951('0x17'));_0x216bdc(_0x23b825[_0x8951('0x18')][_0x8951('0x16')]);}})['catch'](function(_0x14cad3){logger[_0x8951('0x13')](_0x8951('0x15'),_0x2bef74,_0x14cad3);_0x56ca45(_0x14cad3);});});}exports[_0x8951('0x19')]=function(_0x51956a){var _0x74bbf9=this;return new Promise(function(_0x17b010,_0x34917a){return db['ServicenowAccount'][_0x8951('0x1a')]({'raw':_0x51956a[_0x8951('0x1b')]?_0x51956a[_0x8951('0x1b')][_0x8951('0x1c')]===undefined?!![]:![]:!![],'where':_0x51956a['options']?_0x51956a[_0x8951('0x1b')][_0x8951('0x1d')]||null:null,'attributes':_0x51956a['options']?_0x51956a[_0x8951('0x1b')][_0x8951('0x1e')]||null:null,'limit':_0x51956a[_0x8951('0x1b')]?_0x51956a[_0x8951('0x1b')][_0x8951('0x1f')]||null:null,'include':_0x51956a[_0x8951('0x1b')]?_0x51956a[_0x8951('0x1b')][_0x8951('0x20')]?_[_0x8951('0x21')](_0x51956a[_0x8951('0x1b')][_0x8951('0x20')],function(_0x2fbd3a){return{'model':db[_0x2fbd3a[_0x8951('0x22')]],'as':_0x2fbd3a['as'],'attributes':_0x2fbd3a[_0x8951('0x1e')],'include':_0x2fbd3a[_0x8951('0x20')]?_[_0x8951('0x21')](_0x2fbd3a[_0x8951('0x20')],function(_0x347441){return{'model':db[_0x347441[_0x8951('0x22')]],'as':_0x347441['as'],'attributes':_0x347441[_0x8951('0x1e')],'include':_0x347441[_0x8951('0x20')]?_['map'](_0x347441['include'],function(_0x2b71d9){return{'model':db[_0x2b71d9['model']],'as':_0x2b71d9['as'],'attributes':_0x2b71d9[_0x8951('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8951('0xe')](function(_0x31a8ad){logger[_0x8951('0xf')]('GetServicenowAccount',_0x51956a);logger[_0x8951('0x10')](_0x8951('0x19'),_0x51956a,JSON[_0x8951('0x12')](_0x31a8ad));_0x17b010(_0x31a8ad);})[_0x8951('0x23')](function(_0x1769bc){logger['error'](_0x8951('0x19'),_0x1769bc[_0x8951('0x16')],_0x51956a);_0x34917a(_0x74bbf9[_0x8951('0x13')](0x1f4,_0x1769bc['message']));});});};exports[_0x8951('0x24')]=function(_0x57df18){var _0x467bcb=this;return new Promise(function(_0x529f97,_0x3a3819){return db['ServicenowAccount'][_0x8951('0x25')]({'raw':_0x57df18[_0x8951('0x1b')]?_0x57df18['options']['raw']===undefined?!![]:![]:!![],'where':_0x57df18['options']?_0x57df18[_0x8951('0x1b')][_0x8951('0x1d')]||null:null,'attributes':_0x57df18[_0x8951('0x1b')]?_0x57df18[_0x8951('0x1b')][_0x8951('0x1e')]||null:null,'include':_0x57df18[_0x8951('0x1b')]?_0x57df18[_0x8951('0x1b')][_0x8951('0x20')]?_['map'](_0x57df18[_0x8951('0x1b')][_0x8951('0x20')],function(_0x1f8464){return{'model':db[_0x1f8464[_0x8951('0x22')]],'as':_0x1f8464['as'],'attributes':_0x1f8464[_0x8951('0x1e')],'include':_0x1f8464[_0x8951('0x20')]?_[_0x8951('0x21')](_0x1f8464['include'],function(_0x3e4771){return{'model':db[_0x3e4771[_0x8951('0x22')]],'as':_0x3e4771['as'],'attributes':_0x3e4771[_0x8951('0x1e')],'include':_0x3e4771[_0x8951('0x20')]?_[_0x8951('0x21')](_0x3e4771['include'],function(_0x28ec4f){return{'model':db[_0x28ec4f['model']],'as':_0x28ec4f['as'],'attributes':_0x28ec4f[_0x8951('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8951('0xe')](function(_0x5f498c){logger[_0x8951('0xf')](_0x8951('0x24'),_0x57df18);logger[_0x8951('0x10')](_0x8951('0x24'),_0x57df18,JSON[_0x8951('0x12')](_0x5f498c));_0x529f97(_0x5f498c);})['catch'](function(_0x782d0d){logger[_0x8951('0x13')](_0x8951('0x24'),_0x782d0d[_0x8951('0x16')],_0x57df18);_0x3a3819(_0x467bcb[_0x8951('0x13')](0x1f4,_0x782d0d[_0x8951('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b17baba..92a3e9a 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 _0xfc9b=['/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x70b273,_0x34c5a0){var _0x72ac98=function(_0xcc7e43){while(--_0xcc7e43){_0x70b273['push'](_0x70b273['shift']());}};_0x72ac98(++_0x34c5a0);}(_0xfc9b,0xd7));var _0xbfc9=function(_0x381b96,_0x2a7f5d){_0x381b96=_0x381b96-0x0;var _0x222fcd=_0xfc9b[_0x381b96];return _0x222fcd;};'use strict';var multer=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var path=require(_0xbfc9('0x2'));var timeout=require(_0xbfc9('0x3'));var express=require(_0xbfc9('0x4'));var router=express[_0xbfc9('0x5')]();var auth=require(_0xbfc9('0x6'));var interaction=require(_0xbfc9('0x7'));var config=require(_0xbfc9('0x8'));var controller=require(_0xbfc9('0x9'));router[_0xbfc9('0xa')]('/',auth[_0xbfc9('0xb')](),controller[_0xbfc9('0xc')]);router[_0xbfc9('0xa')](_0xbfc9('0xd'),auth[_0xbfc9('0xb')](),controller[_0xbfc9('0xe')]);router[_0xbfc9('0xa')](_0xbfc9('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xbfc9('0xa')](_0xbfc9('0x10'),auth[_0xbfc9('0xb')](),controller[_0xbfc9('0x11')]);router[_0xbfc9('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xbfc9('0x12')]);router[_0xbfc9('0x13')]('/',auth[_0xbfc9('0xb')](),controller['create']);router[_0xbfc9('0x14')](_0xbfc9('0xd'),auth[_0xbfc9('0xb')](),controller['update']);router[_0xbfc9('0x15')](_0xbfc9('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xbfc9('0x16')]=router; \ No newline at end of file +var _0xaf14=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x101c1a,_0x37f379){var _0x18bb93=function(_0x23a67c){while(--_0x23a67c){_0x101c1a['push'](_0x101c1a['shift']());}};_0x18bb93(++_0x37f379);}(_0xaf14,0x13b));var _0x4af1=function(_0x18b31d,_0x4e9519){_0x18b31d=_0x18b31d-0x0;var _0x112463=_0xaf14[_0x18b31d];return _0x112463;};'use strict';var multer=require(_0x4af1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4af1('0x1'));var express=require(_0x4af1('0x2'));var router=express['Router']();var auth=require(_0x4af1('0x3'));var interaction=require(_0x4af1('0x4'));var config=require(_0x4af1('0x5'));var controller=require('./intServicenowConfiguration.controller');router[_0x4af1('0x6')]('/',auth[_0x4af1('0x7')](),controller[_0x4af1('0x8')]);router[_0x4af1('0x6')](_0x4af1('0x9'),auth[_0x4af1('0x7')](),controller[_0x4af1('0xa')]);router[_0x4af1('0x6')](_0x4af1('0xb'),auth[_0x4af1('0x7')](),controller[_0x4af1('0xc')]);router['get'](_0x4af1('0xd'),auth[_0x4af1('0x7')](),controller[_0x4af1('0xe')]);router[_0x4af1('0x6')](_0x4af1('0xf'),auth[_0x4af1('0x7')](),controller[_0x4af1('0x10')]);router[_0x4af1('0x11')]('/',auth[_0x4af1('0x7')](),controller[_0x4af1('0x12')]);router[_0x4af1('0x13')](_0x4af1('0x9'),auth['isAuthenticated'](),controller[_0x4af1('0x14')]);router[_0x4af1('0x15')]('/:id',auth[_0x4af1('0x7')](),controller[_0x4af1('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index af8f268..b1fdc04 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 _0xd8d6=['sequelize','exports','STRING'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xd8d6,0x9f));var _0x6d8d=function(_0x20020a,_0x2e8f87){_0x20020a=_0x20020a-0x0;var _0x3ab313=_0xd8d6[_0x20020a];return _0x3ab313;};'use strict';var Sequelize=require(_0x6d8d('0x0'));module[_0x6d8d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d8d('0x2')]}}; \ No newline at end of file +var _0xc90a=['exports','STRING','sequelize'];(function(_0x499aa7,_0x505149){var _0x233cd4=function(_0x34d83b){while(--_0x34d83b){_0x499aa7['push'](_0x499aa7['shift']());}};_0x233cd4(++_0x505149);}(_0xc90a,0xfb));var _0xac90=function(_0x2bd0d5,_0x4ace31){_0x2bd0d5=_0x2bd0d5-0x0;var _0x3a963e=_0xc90a[_0x2bd0d5];return _0x3a963e;};'use strict';var Sequelize=require(_0xac90('0x0'));module[_0xac90('0x1')]={'name':{'type':Sequelize[_0xac90('0x2')]},'description':{'type':Sequelize[_0xac90('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8c4230a..b98edb5 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 _0x5c00=['mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','result','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','intersection','options','catch','create','body','find','getFields','findOne','getSubjects','getDescriptions','ServicenowField','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0xee6a6a,_0x4e67ce){var _0x206012=function(_0x3cee2a){while(--_0x3cee2a){_0xee6a6a['push'](_0xee6a6a['shift']());}};_0x206012(++_0x4e67ce);}(_0x5c00,0x17e));var _0x05c0=function(_0x1418a5,_0x19c106){_0x1418a5=_0x1418a5-0x0;var _0x22c849=_0x5c00[_0x1418a5];return _0x22c849;};'use strict';var pdf=require(_0x05c0('0x0'));var emlformat=require(_0x05c0('0x1'));var rimraf=require(_0x05c0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05c0('0x3'));var rp=require('request-promise');var moment=require(_0x05c0('0x4'));var BPromise=require(_0x05c0('0x5'));var Mustache=require(_0x05c0('0x6'));var util=require(_0x05c0('0x7'));var path=require('path');var sox=require(_0x05c0('0x8'));var csv=require(_0x05c0('0x9'));var ejs=require(_0x05c0('0xa'));var fs=require('fs');var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var db=require(_0x05c0('0x17'))['db'];var jayson=require(_0x05c0('0x18'));var client=jayson['client'][_0x05c0('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5eec41,_0x16a290,_0x49e07e){if(_0x49e07e){var _0x20ff48=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20ff48[_0x05c0('0x1a')](_0x16a290)){return _0x5eec41;}else{throw new db[(_0x05c0('0x1b'))][(_0x05c0('0x1c'))](_0x05c0('0x1d'));}}else{return _0x5eec41;}}function respondWithRpcPromise(_0xd7b487,_0x4c3e54,_0x238e25,_0x161a5f){return new BPromise(function(_0x4bb164,_0x29e6b0){var _0x27c7bd=_0x161a5f||client;return _0x27c7bd[_0x05c0('0x1e')](_0xd7b487,_0x238e25)[_0x05c0('0x1f')](function(_0xd07ad1){logger[_0x05c0('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4c3e54,_0x05c0('0x21'));logger[_0x05c0('0x22')](_0x05c0('0x23'),_0x4c3e54,'request\x20sent',JSON[_0x05c0('0x24')](_0xd07ad1));if(_0xd07ad1[_0x05c0('0x25')]){if(_0xd07ad1[_0x05c0('0x25')][_0x05c0('0x26')]===0x1f4){logger[_0x05c0('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4c3e54,_0xd07ad1[_0x05c0('0x25')][_0x05c0('0x27')]);return _0x29e6b0(_0xd07ad1['error']['message']);}logger['error'](_0x05c0('0x28'),_0x4c3e54,_0xd07ad1[_0x05c0('0x25')][_0x05c0('0x27')]);return _0x4bb164(_0xd07ad1[_0x05c0('0x25')][_0x05c0('0x27')]);}else{logger[_0x05c0('0x20')](_0x05c0('0x28'),_0x4c3e54,'request\x20sent');_0x4bb164(_0xd07ad1[_0x05c0('0x29')][_0x05c0('0x27')]);}})['catch'](function(_0x530966){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4c3e54,_0x530966);_0x29e6b0(_0x530966);});});}function respondWithStatusCode(_0x56aa78,_0x3df135){_0x3df135=_0x3df135||0xcc;return function(_0x15b497){if(_0x15b497){return _0x56aa78['sendStatus'](_0x3df135);}return _0x56aa78[_0x05c0('0x2a')](_0x3df135)[_0x05c0('0x2b')]();};}function respondWithResult(_0x3617dc,_0x889c75){_0x889c75=_0x889c75||0xc8;return function(_0x58769a){if(_0x58769a){return _0x3617dc[_0x05c0('0x2a')](_0x889c75)[_0x05c0('0x2c')](_0x58769a);}};}function respondWithFilteredResult(_0x2ceaed,_0x200e80){return function(_0x216a5c){if(_0x216a5c){var _0x5d12e0=_0x216a5c[_0x05c0('0x2d')],_0x57886b=_0x200e80[_0x05c0('0x2e')],_0x56ba64=_0x200e80[_0x05c0('0x2e')]+_0x200e80[_0x05c0('0x2f')],_0x2df109;if(_0x56ba64>=_0x5d12e0){_0x56ba64=_0x5d12e0;_0x2df109=0xc8;}else{_0x2df109=0xce;}_0x2ceaed[_0x05c0('0x2a')](_0x2df109);return _0x2ceaed[_0x05c0('0x30')](_0x05c0('0x31'),_0x57886b+'-'+_0x56ba64+'/'+_0x5d12e0)[_0x05c0('0x2c')](_0x216a5c);}return null;};}function patchUpdates(_0x87b07c){return function(_0x3e38f0){try{jsonpatch[_0x05c0('0x32')](_0x3e38f0,_0x87b07c,!![]);}catch(_0x50f03d){return BPromise['reject'](_0x50f03d);}return _0x3e38f0[_0x05c0('0x33')]();};}function saveUpdates(_0x31b0b8,_0x861027){return function(_0x5c652f){if(_0x5c652f){return _0x5c652f[_0x05c0('0x34')](_0x31b0b8)[_0x05c0('0x1f')](function(_0x4b0ea1){return _0x4b0ea1;});}return null;};}function removeEntity(_0x25936a,_0x4e923d){return function(_0x3d81bb){if(_0x3d81bb){return _0x3d81bb[_0x05c0('0x35')]()[_0x05c0('0x1f')](function(){_0x25936a[_0x05c0('0x2a')](0xcc)[_0x05c0('0x2b')]();});}};}function handleEntityNotFound(_0x2a9e82,_0x3dfacc){return function(_0x9da3fa){if(!_0x9da3fa){_0x2a9e82[_0x05c0('0x36')](0x194);}return _0x9da3fa;};}function handleError(_0x3a72c2,_0x39d783){_0x39d783=_0x39d783||0x1f4;return function(_0x3a9c63){logger[_0x05c0('0x25')](_0x3a9c63[_0x05c0('0x37')]);if(_0x3a9c63[_0x05c0('0x38')]){delete _0x3a9c63[_0x05c0('0x38')];}_0x3a72c2[_0x05c0('0x2a')](_0x39d783)[_0x05c0('0x39')](_0x3a9c63);};}exports[_0x05c0('0x3a')]=function(_0x1faa63,_0x3d1bae){var _0x337847={},_0x9ca737={},_0x285422={'count':0x0,'rows':[]};var _0x3d3291=_[_0x05c0('0x3b')](db[_0x05c0('0x3c')][_0x05c0('0x3d')],function(_0x40d4db){return{'name':_0x40d4db[_0x05c0('0x3e')],'type':_0x40d4db[_0x05c0('0x3f')][_0x05c0('0x40')]};});_0x9ca737[_0x05c0('0x41')]=_['map'](_0x3d3291,_0x05c0('0x38'));_0x9ca737[_0x05c0('0x42')]=_[_0x05c0('0x43')](_0x1faa63[_0x05c0('0x42')]);_0x9ca737['filters']=_['intersection'](_0x9ca737[_0x05c0('0x41')],_0x9ca737[_0x05c0('0x42')]);_0x337847[_0x05c0('0x44')]=_['intersection'](_0x9ca737[_0x05c0('0x41')],qs[_0x05c0('0x45')](_0x1faa63[_0x05c0('0x42')][_0x05c0('0x45')]));_0x337847['attributes']=_0x337847[_0x05c0('0x44')][_0x05c0('0x46')]?_0x337847['attributes']:_0x9ca737[_0x05c0('0x41')];if(!_0x1faa63[_0x05c0('0x42')][_0x05c0('0x47')](_0x05c0('0x48'))){_0x337847[_0x05c0('0x2f')]=qs[_0x05c0('0x2f')](_0x1faa63[_0x05c0('0x42')]['limit']);_0x337847['offset']=qs[_0x05c0('0x2e')](_0x1faa63[_0x05c0('0x42')][_0x05c0('0x2e')]);}_0x337847[_0x05c0('0x49')]=qs[_0x05c0('0x4a')](_0x1faa63['query'][_0x05c0('0x4a')]);_0x337847[_0x05c0('0x4b')]=qs[_0x05c0('0x4c')](_[_0x05c0('0x4d')](_0x1faa63[_0x05c0('0x42')],_0x9ca737[_0x05c0('0x4c')]),_0x3d3291);if(_0x1faa63[_0x05c0('0x42')]['filter']){_0x337847[_0x05c0('0x4b')]=_[_0x05c0('0x4e')](_0x337847[_0x05c0('0x4b')],{'$or':_[_0x05c0('0x3b')](_0x3d3291,function(_0x4396df){if(_0x4396df[_0x05c0('0x3f')]!==_0x05c0('0x4f')){var _0x42835d={};_0x42835d[_0x4396df[_0x05c0('0x38')]]={'$like':'%'+_0x1faa63[_0x05c0('0x42')][_0x05c0('0x50')]+'%'};return _0x42835d;}})});}_0x337847=_['merge']({},_0x337847,_0x1faa63['options']);var _0x2e3f47={'where':_0x337847[_0x05c0('0x4b')]};return db[_0x05c0('0x3c')][_0x05c0('0x2d')](_0x2e3f47)[_0x05c0('0x1f')](function(_0x856372){_0x285422['count']=_0x856372;if(_0x1faa63[_0x05c0('0x42')][_0x05c0('0x51')]){_0x337847[_0x05c0('0x52')]=[{'all':!![]}];}return db[_0x05c0('0x3c')]['findAll'](_0x337847);})[_0x05c0('0x1f')](function(_0x2440e8){_0x285422[_0x05c0('0x53')]=_0x2440e8;return _0x285422;})[_0x05c0('0x1f')](respondWithFilteredResult(_0x3d1bae,_0x337847))['catch'](handleError(_0x3d1bae,null));};exports[_0x05c0('0x54')]=function(_0x39e6ad,_0x2e5660){var _0x9b521b={'raw':![],'where':{'id':_0x39e6ad[_0x05c0('0x55')]['id']}},_0x5ef6cf={};_0x5ef6cf[_0x05c0('0x41')]=_['keys'](db[_0x05c0('0x3c')]['rawAttributes']);_0x5ef6cf['query']=_[_0x05c0('0x43')](_0x39e6ad['query']);_0x5ef6cf[_0x05c0('0x4c')]=_[_0x05c0('0x56')](_0x5ef6cf[_0x05c0('0x41')],_0x5ef6cf[_0x05c0('0x42')]);_0x9b521b[_0x05c0('0x44')]=_[_0x05c0('0x56')](_0x5ef6cf['model'],qs[_0x05c0('0x45')](_0x39e6ad['query'][_0x05c0('0x45')]));_0x9b521b[_0x05c0('0x44')]=_0x9b521b[_0x05c0('0x44')][_0x05c0('0x46')]?_0x9b521b[_0x05c0('0x44')]:_0x5ef6cf[_0x05c0('0x41')];if(_0x39e6ad[_0x05c0('0x42')]['includeAll']){_0x9b521b['include']=[{'all':!![]}];}_0x9b521b=_['merge']({},_0x9b521b,_0x39e6ad[_0x05c0('0x57')]);return db[_0x05c0('0x3c')]['find'](_0x9b521b)['then'](handleEntityNotFound(_0x2e5660,null))[_0x05c0('0x1f')](respondWithResult(_0x2e5660,null))[_0x05c0('0x58')](handleError(_0x2e5660,null));};exports[_0x05c0('0x59')]=function(_0xbe455d,_0x1a3dcd){return db[_0x05c0('0x3c')][_0x05c0('0x59')](_0xbe455d['body'],{})[_0x05c0('0x1f')](respondWithResult(_0x1a3dcd,0xc9))[_0x05c0('0x58')](handleError(_0x1a3dcd,null));};exports[_0x05c0('0x34')]=function(_0x179e5a,_0x4b5e1f){if(_0x179e5a[_0x05c0('0x5a')]['id']){delete _0x179e5a['body']['id'];}return db[_0x05c0('0x3c')][_0x05c0('0x5b')]({'where':{'id':_0x179e5a['params']['id']}})[_0x05c0('0x1f')](handleEntityNotFound(_0x4b5e1f,null))['then'](saveUpdates(_0x179e5a[_0x05c0('0x5a')],null))[_0x05c0('0x1f')](respondWithResult(_0x4b5e1f,null))[_0x05c0('0x58')](handleError(_0x4b5e1f,null));};exports[_0x05c0('0x35')]=function(_0x371ba8,_0x2226e3){return db['ServicenowConfiguration'][_0x05c0('0x5b')]({'where':{'id':_0x371ba8[_0x05c0('0x55')]['id']}})[_0x05c0('0x1f')](handleEntityNotFound(_0x2226e3,null))[_0x05c0('0x1f')](removeEntity(_0x2226e3,null))[_0x05c0('0x58')](handleError(_0x2226e3,null));};exports[_0x05c0('0x5c')]=function(_0x58c7bc,_0x284650,_0x2dff63){var _0x1dd246={};var _0x41de8c={};var _0x1584a3;var _0x16288c;return db[_0x05c0('0x3c')][_0x05c0('0x5d')]({'where':{'id':_0x58c7bc[_0x05c0('0x55')]['id']}})[_0x05c0('0x1f')](handleEntityNotFound(_0x284650,null))[_0x05c0('0x1f')](function(_0x376618){if(_0x376618){_0x1584a3=_0x376618;_0x41de8c['model']=_['keys'](db['ServicenowField'][_0x05c0('0x3d')]);_0x41de8c[_0x05c0('0x42')]=_[_0x05c0('0x43')](_0x58c7bc['query']);_0x41de8c[_0x05c0('0x4c')]=_[_0x05c0('0x56')](_0x41de8c[_0x05c0('0x41')],_0x41de8c[_0x05c0('0x42')]);_0x1dd246[_0x05c0('0x44')]=_[_0x05c0('0x56')](_0x41de8c[_0x05c0('0x41')],qs['fields'](_0x58c7bc[_0x05c0('0x42')][_0x05c0('0x45')]));_0x1dd246[_0x05c0('0x44')]=_0x1dd246[_0x05c0('0x44')]['length']?_0x1dd246['attributes']:_0x41de8c['model'];_0x1dd246[_0x05c0('0x49')]=qs[_0x05c0('0x4a')](_0x58c7bc[_0x05c0('0x42')][_0x05c0('0x4a')]);_0x1dd246[_0x05c0('0x4b')]=qs[_0x05c0('0x4c')](_[_0x05c0('0x4d')](_0x58c7bc['query'],_0x41de8c[_0x05c0('0x4c')]));if(_0x58c7bc[_0x05c0('0x42')][_0x05c0('0x50')]){_0x1dd246[_0x05c0('0x4b')]=_[_0x05c0('0x4e')](_0x1dd246['where'],{'$or':_['map'](_0x1dd246[_0x05c0('0x44')],function(_0x204706){var _0x50bcf1={};_0x50bcf1[_0x204706]={'$like':'%'+_0x58c7bc[_0x05c0('0x42')]['filter']+'%'};return _0x50bcf1;})});}_0x1dd246=_['merge']({},_0x1dd246,_0x58c7bc[_0x05c0('0x57')]);return _0x1584a3[_0x05c0('0x5c')](_0x1dd246);}})[_0x05c0('0x1f')](function(_0x50725c){if(_0x50725c){_0x16288c=_0x50725c['length'];if(!_0x58c7bc[_0x05c0('0x42')][_0x05c0('0x47')](_0x05c0('0x48'))){_0x1dd246['limit']=qs['limit'](_0x58c7bc['query']['limit']);_0x1dd246['offset']=qs[_0x05c0('0x2e')](_0x58c7bc['query']['offset']);}return _0x1584a3['getFields'](_0x1dd246);}})[_0x05c0('0x1f')](function(_0x1a6dc4){if(_0x1a6dc4){return _0x1a6dc4?{'count':_0x16288c,'rows':_0x1a6dc4}:null;}})[_0x05c0('0x1f')](respondWithResult(_0x284650,null))['catch'](handleError(_0x284650,null));};exports[_0x05c0('0x5e')]=function(_0x1820ac,_0x500e3a,_0x2ac43c){var _0x1830dc={};var _0x17ed82={};var _0x3048f3;var _0x4a32c4;return db[_0x05c0('0x3c')][_0x05c0('0x5d')]({'where':{'id':_0x1820ac[_0x05c0('0x55')]['id']}})[_0x05c0('0x1f')](handleEntityNotFound(_0x500e3a,null))[_0x05c0('0x1f')](function(_0x570168){if(_0x570168){_0x3048f3=_0x570168;_0x17ed82['model']=_[_0x05c0('0x43')](db['ServicenowField'][_0x05c0('0x3d')]);_0x17ed82[_0x05c0('0x42')]=_['keys'](_0x1820ac[_0x05c0('0x42')]);_0x17ed82['filters']=_['intersection'](_0x17ed82['model'],_0x17ed82['query']);_0x1830dc[_0x05c0('0x44')]=_[_0x05c0('0x56')](_0x17ed82[_0x05c0('0x41')],qs[_0x05c0('0x45')](_0x1820ac['query'][_0x05c0('0x45')]));_0x1830dc[_0x05c0('0x44')]=_0x1830dc[_0x05c0('0x44')][_0x05c0('0x46')]?_0x1830dc[_0x05c0('0x44')]:_0x17ed82['model'];_0x1830dc[_0x05c0('0x49')]=qs['sort'](_0x1820ac['query'][_0x05c0('0x4a')]);_0x1830dc[_0x05c0('0x4b')]=qs[_0x05c0('0x4c')](_[_0x05c0('0x4d')](_0x1820ac[_0x05c0('0x42')],_0x17ed82[_0x05c0('0x4c')]));if(_0x1820ac['query']['filter']){_0x1830dc[_0x05c0('0x4b')]=_[_0x05c0('0x4e')](_0x1830dc[_0x05c0('0x4b')],{'$or':_['map'](_0x1830dc[_0x05c0('0x44')],function(_0x7c5ce6){var _0x1cba99={};_0x1cba99[_0x7c5ce6]={'$like':'%'+_0x1820ac[_0x05c0('0x42')][_0x05c0('0x50')]+'%'};return _0x1cba99;})});}_0x1830dc=_[_0x05c0('0x4e')]({},_0x1830dc,_0x1820ac['options']);return _0x3048f3[_0x05c0('0x5e')](_0x1830dc);}})[_0x05c0('0x1f')](function(_0x4be0bf){if(_0x4be0bf){_0x4a32c4=_0x4be0bf[_0x05c0('0x46')];if(!_0x1820ac[_0x05c0('0x42')]['hasOwnProperty'](_0x05c0('0x48'))){_0x1830dc[_0x05c0('0x2f')]=qs[_0x05c0('0x2f')](_0x1820ac[_0x05c0('0x42')][_0x05c0('0x2f')]);_0x1830dc[_0x05c0('0x2e')]=qs['offset'](_0x1820ac[_0x05c0('0x42')]['offset']);}return _0x3048f3[_0x05c0('0x5e')](_0x1830dc);}})[_0x05c0('0x1f')](function(_0x12ddfb){if(_0x12ddfb){return _0x12ddfb?{'count':_0x4a32c4,'rows':_0x12ddfb}:null;}})[_0x05c0('0x1f')](respondWithResult(_0x500e3a,null))[_0x05c0('0x58')](handleError(_0x500e3a,null));};exports[_0x05c0('0x5f')]=function(_0x28ce96,_0xe1a739,_0x2de8b3){var _0x39c847={};var _0x5f015a={};var _0x23c221;var _0x4f920f;return db[_0x05c0('0x3c')]['findOne']({'where':{'id':_0x28ce96[_0x05c0('0x55')]['id']}})[_0x05c0('0x1f')](handleEntityNotFound(_0xe1a739,null))[_0x05c0('0x1f')](function(_0xaad786){if(_0xaad786){_0x23c221=_0xaad786;_0x5f015a[_0x05c0('0x41')]=_[_0x05c0('0x43')](db[_0x05c0('0x60')][_0x05c0('0x3d')]);_0x5f015a[_0x05c0('0x42')]=_['keys'](_0x28ce96['query']);_0x5f015a[_0x05c0('0x4c')]=_[_0x05c0('0x56')](_0x5f015a[_0x05c0('0x41')],_0x5f015a[_0x05c0('0x42')]);_0x39c847[_0x05c0('0x44')]=_[_0x05c0('0x56')](_0x5f015a[_0x05c0('0x41')],qs['fields'](_0x28ce96[_0x05c0('0x42')]['fields']));_0x39c847[_0x05c0('0x44')]=_0x39c847['attributes'][_0x05c0('0x46')]?_0x39c847['attributes']:_0x5f015a[_0x05c0('0x41')];_0x39c847[_0x05c0('0x49')]=qs['sort'](_0x28ce96[_0x05c0('0x42')]['sort']);_0x39c847['where']=qs[_0x05c0('0x4c')](_[_0x05c0('0x4d')](_0x28ce96[_0x05c0('0x42')],_0x5f015a[_0x05c0('0x4c')]));if(_0x28ce96[_0x05c0('0x42')][_0x05c0('0x50')]){_0x39c847[_0x05c0('0x4b')]=_['merge'](_0x39c847['where'],{'$or':_['map'](_0x39c847['attributes'],function(_0x55e330){var _0x16ae0f={};_0x16ae0f[_0x55e330]={'$like':'%'+_0x28ce96[_0x05c0('0x42')][_0x05c0('0x50')]+'%'};return _0x16ae0f;})});}_0x39c847=_[_0x05c0('0x4e')]({},_0x39c847,_0x28ce96['options']);return _0x23c221[_0x05c0('0x5f')](_0x39c847);}})[_0x05c0('0x1f')](function(_0x303be3){if(_0x303be3){_0x4f920f=_0x303be3[_0x05c0('0x46')];if(!_0x28ce96[_0x05c0('0x42')][_0x05c0('0x47')](_0x05c0('0x48'))){_0x39c847[_0x05c0('0x2f')]=qs[_0x05c0('0x2f')](_0x28ce96['query'][_0x05c0('0x2f')]);_0x39c847['offset']=qs[_0x05c0('0x2e')](_0x28ce96['query'][_0x05c0('0x2e')]);}return _0x23c221[_0x05c0('0x5f')](_0x39c847);}})['then'](function(_0x2273eb){if(_0x2273eb){return _0x2273eb?{'count':_0x4f920f,'rows':_0x2273eb}:null;}})[_0x05c0('0x1f')](respondWithResult(_0xe1a739,null))['catch'](handleError(_0xe1a739,null));}; \ No newline at end of file +var _0x9c00=['ServicenowConfiguration','rawAttributes','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','update','getFields','findOne','pick','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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','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','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','stack','name','send','index','map'];(function(_0x330b5a,_0x1cc7ac){var _0x44ebc2=function(_0x24be96){while(--_0x24be96){_0x330b5a['push'](_0x330b5a['shift']());}};_0x44ebc2(++_0x1cc7ac);}(_0x9c00,0x1a0));var _0x09c0=function(_0x36975e,_0x103ce0){_0x36975e=_0x36975e-0x0;var _0x51ded9=_0x9c00[_0x36975e];return _0x51ded9;};'use strict';var pdf=require(_0x09c0('0x0'));var emlformat=require(_0x09c0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x09c0('0x2'));var rp=require(_0x09c0('0x3'));var moment=require('moment');var BPromise=require(_0x09c0('0x4'));var Mustache=require(_0x09c0('0x5'));var util=require(_0x09c0('0x6'));var path=require(_0x09c0('0x7'));var sox=require(_0x09c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var db=require(_0x09c0('0x19'))['db'];var jayson=require(_0x09c0('0x1a'));var client=jayson[_0x09c0('0x1b')][_0x09c0('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x331905,_0x6149a8,_0x2a86da){if(_0x2a86da){var _0x342ceb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x342ceb[_0x09c0('0x1d')](_0x6149a8)){return _0x331905;}else{throw new db[(_0x09c0('0x1e'))][(_0x09c0('0x1f'))](_0x09c0('0x20'));}}else{return _0x331905;}}function respondWithRpcPromise(_0x45a265,_0x33c3d6,_0x2fdf11,_0x4ff6b7){return new BPromise(function(_0x590129,_0x558b4f){var _0x42030d=_0x4ff6b7||client;return _0x42030d[_0x09c0('0x21')](_0x45a265,_0x2fdf11)[_0x09c0('0x22')](function(_0x628272){logger['info'](_0x09c0('0x23'),_0x33c3d6,'request\x20sent');logger['debug'](_0x09c0('0x24'),_0x33c3d6,'request\x20sent',JSON[_0x09c0('0x25')](_0x628272));if(_0x628272[_0x09c0('0x26')]){if(_0x628272[_0x09c0('0x26')]['code']===0x1f4){logger[_0x09c0('0x26')](_0x09c0('0x23'),_0x33c3d6,_0x628272[_0x09c0('0x26')][_0x09c0('0x27')]);return _0x558b4f(_0x628272[_0x09c0('0x26')][_0x09c0('0x27')]);}logger[_0x09c0('0x26')]('ServicenowConfiguration,\x20%s,\x20%s',_0x33c3d6,_0x628272[_0x09c0('0x26')][_0x09c0('0x27')]);return _0x590129(_0x628272[_0x09c0('0x26')][_0x09c0('0x27')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x33c3d6,_0x09c0('0x28'));_0x590129(_0x628272[_0x09c0('0x29')][_0x09c0('0x27')]);}})[_0x09c0('0x2a')](function(_0x491e6f){logger[_0x09c0('0x26')](_0x09c0('0x23'),_0x33c3d6,_0x491e6f);_0x558b4f(_0x491e6f);});});}function respondWithStatusCode(_0x56d883,_0x2c7202){_0x2c7202=_0x2c7202||0xcc;return function(_0x163a59){if(_0x163a59){return _0x56d883[_0x09c0('0x2b')](_0x2c7202);}return _0x56d883[_0x09c0('0x2c')](_0x2c7202)[_0x09c0('0x2d')]();};}function respondWithResult(_0x1d2d9d,_0x45cc64){_0x45cc64=_0x45cc64||0xc8;return function(_0x35b61c){if(_0x35b61c){return _0x1d2d9d[_0x09c0('0x2c')](_0x45cc64)[_0x09c0('0x2e')](_0x35b61c);}};}function respondWithFilteredResult(_0x46a36a,_0x5e53ac){return function(_0x15a667){if(_0x15a667){var _0x1bdde9=_0x15a667[_0x09c0('0x2f')],_0x53a7b8=_0x5e53ac['offset'],_0x1d09e0=_0x5e53ac[_0x09c0('0x30')]+_0x5e53ac[_0x09c0('0x31')],_0x5aa0b9;if(_0x1d09e0>=_0x1bdde9){_0x1d09e0=_0x1bdde9;_0x5aa0b9=0xc8;}else{_0x5aa0b9=0xce;}_0x46a36a[_0x09c0('0x2c')](_0x5aa0b9);return _0x46a36a[_0x09c0('0x32')]('Content-Range',_0x53a7b8+'-'+_0x1d09e0+'/'+_0x1bdde9)['json'](_0x15a667);}return null;};}function patchUpdates(_0x17c374){return function(_0x38a315){try{jsonpatch[_0x09c0('0x33')](_0x38a315,_0x17c374,!![]);}catch(_0x5c93ca){return BPromise[_0x09c0('0x34')](_0x5c93ca);}return _0x38a315['save']();};}function saveUpdates(_0x350cd3,_0x21755d){return function(_0x16cf08){if(_0x16cf08){return _0x16cf08['update'](_0x350cd3)[_0x09c0('0x22')](function(_0x4574f7){return _0x4574f7;});}return null;};}function removeEntity(_0xbb7685,_0x184c0b){return function(_0x234f07){if(_0x234f07){return _0x234f07[_0x09c0('0x35')]()[_0x09c0('0x22')](function(){_0xbb7685['status'](0xcc)[_0x09c0('0x2d')]();});}};}function handleEntityNotFound(_0x2c19be,_0x2f136c){return function(_0x132f6c){if(!_0x132f6c){_0x2c19be[_0x09c0('0x2b')](0x194);}return _0x132f6c;};}function handleError(_0x50a37e,_0x920e2c){_0x920e2c=_0x920e2c||0x1f4;return function(_0x20349e){logger[_0x09c0('0x26')](_0x20349e[_0x09c0('0x36')]);if(_0x20349e[_0x09c0('0x37')]){delete _0x20349e['name'];}_0x50a37e[_0x09c0('0x2c')](_0x920e2c)[_0x09c0('0x38')](_0x20349e);};}exports[_0x09c0('0x39')]=function(_0x16f81e,_0x419d1c){var _0x3e8b74={},_0x21c48c={},_0x5f50fe={'count':0x0,'rows':[]};var _0x363b5c=_[_0x09c0('0x3a')](db[_0x09c0('0x3b')][_0x09c0('0x3c')],function(_0x453c23){return{'name':_0x453c23['fieldName'],'type':_0x453c23['type']['key']};});_0x21c48c['model']=_[_0x09c0('0x3a')](_0x363b5c,_0x09c0('0x37'));_0x21c48c[_0x09c0('0x3d')]=_[_0x09c0('0x3e')](_0x16f81e[_0x09c0('0x3d')]);_0x21c48c['filters']=_[_0x09c0('0x3f')](_0x21c48c[_0x09c0('0x40')],_0x21c48c['query']);_0x3e8b74[_0x09c0('0x41')]=_['intersection'](_0x21c48c[_0x09c0('0x40')],qs['fields'](_0x16f81e[_0x09c0('0x3d')][_0x09c0('0x42')]));_0x3e8b74['attributes']=_0x3e8b74[_0x09c0('0x41')][_0x09c0('0x43')]?_0x3e8b74['attributes']:_0x21c48c[_0x09c0('0x40')];if(!_0x16f81e[_0x09c0('0x3d')][_0x09c0('0x44')](_0x09c0('0x45'))){_0x3e8b74[_0x09c0('0x31')]=qs[_0x09c0('0x31')](_0x16f81e['query'][_0x09c0('0x31')]);_0x3e8b74[_0x09c0('0x30')]=qs[_0x09c0('0x30')](_0x16f81e['query'][_0x09c0('0x30')]);}_0x3e8b74[_0x09c0('0x46')]=qs[_0x09c0('0x47')](_0x16f81e['query'][_0x09c0('0x47')]);_0x3e8b74[_0x09c0('0x48')]=qs['filters'](_['pick'](_0x16f81e[_0x09c0('0x3d')],_0x21c48c[_0x09c0('0x49')]),_0x363b5c);if(_0x16f81e['query'][_0x09c0('0x4a')]){_0x3e8b74[_0x09c0('0x48')]=_['merge'](_0x3e8b74[_0x09c0('0x48')],{'$or':_[_0x09c0('0x3a')](_0x363b5c,function(_0x2e7d4f){if(_0x2e7d4f[_0x09c0('0x4b')]!==_0x09c0('0x4c')){var _0x569e02={};_0x569e02[_0x2e7d4f[_0x09c0('0x37')]]={'$like':'%'+_0x16f81e['query']['filter']+'%'};return _0x569e02;}})});}_0x3e8b74=_[_0x09c0('0x4d')]({},_0x3e8b74,_0x16f81e[_0x09c0('0x4e')]);var _0x17876c={'where':_0x3e8b74[_0x09c0('0x48')]};return db[_0x09c0('0x3b')][_0x09c0('0x2f')](_0x17876c)['then'](function(_0x5e239a){_0x5f50fe['count']=_0x5e239a;if(_0x16f81e[_0x09c0('0x3d')][_0x09c0('0x4f')]){_0x3e8b74[_0x09c0('0x50')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x09c0('0x51')](_0x3e8b74);})[_0x09c0('0x22')](function(_0x2016f1){_0x5f50fe[_0x09c0('0x52')]=_0x2016f1;return _0x5f50fe;})[_0x09c0('0x22')](respondWithFilteredResult(_0x419d1c,_0x3e8b74))[_0x09c0('0x2a')](handleError(_0x419d1c,null));};exports[_0x09c0('0x53')]=function(_0x2b3c56,_0x3f6d14){var _0x38085c={'raw':![],'where':{'id':_0x2b3c56[_0x09c0('0x54')]['id']}},_0x1b0198={};_0x1b0198[_0x09c0('0x40')]=_[_0x09c0('0x3e')](db[_0x09c0('0x3b')][_0x09c0('0x3c')]);_0x1b0198[_0x09c0('0x3d')]=_[_0x09c0('0x3e')](_0x2b3c56[_0x09c0('0x3d')]);_0x1b0198[_0x09c0('0x49')]=_['intersection'](_0x1b0198[_0x09c0('0x40')],_0x1b0198[_0x09c0('0x3d')]);_0x38085c[_0x09c0('0x41')]=_[_0x09c0('0x3f')](_0x1b0198[_0x09c0('0x40')],qs['fields'](_0x2b3c56[_0x09c0('0x3d')][_0x09c0('0x42')]));_0x38085c[_0x09c0('0x41')]=_0x38085c['attributes'][_0x09c0('0x43')]?_0x38085c[_0x09c0('0x41')]:_0x1b0198[_0x09c0('0x40')];if(_0x2b3c56[_0x09c0('0x3d')][_0x09c0('0x4f')]){_0x38085c[_0x09c0('0x50')]=[{'all':!![]}];}_0x38085c=_[_0x09c0('0x4d')]({},_0x38085c,_0x2b3c56['options']);return db[_0x09c0('0x3b')][_0x09c0('0x55')](_0x38085c)[_0x09c0('0x22')](handleEntityNotFound(_0x3f6d14,null))[_0x09c0('0x22')](respondWithResult(_0x3f6d14,null))[_0x09c0('0x2a')](handleError(_0x3f6d14,null));};exports[_0x09c0('0x56')]=function(_0x3ebabb,_0x4987cf){return db['ServicenowConfiguration'][_0x09c0('0x56')](_0x3ebabb[_0x09c0('0x57')],{})[_0x09c0('0x22')](respondWithResult(_0x4987cf,0xc9))['catch'](handleError(_0x4987cf,null));};exports[_0x09c0('0x58')]=function(_0x5b8e7f,_0x2fecec){if(_0x5b8e7f[_0x09c0('0x57')]['id']){delete _0x5b8e7f[_0x09c0('0x57')]['id'];}return db[_0x09c0('0x3b')][_0x09c0('0x55')]({'where':{'id':_0x5b8e7f[_0x09c0('0x54')]['id']}})[_0x09c0('0x22')](handleEntityNotFound(_0x2fecec,null))['then'](saveUpdates(_0x5b8e7f[_0x09c0('0x57')],null))[_0x09c0('0x22')](respondWithResult(_0x2fecec,null))[_0x09c0('0x2a')](handleError(_0x2fecec,null));};exports[_0x09c0('0x35')]=function(_0x3a6845,_0x219195){return db[_0x09c0('0x3b')][_0x09c0('0x55')]({'where':{'id':_0x3a6845[_0x09c0('0x54')]['id']}})[_0x09c0('0x22')](handleEntityNotFound(_0x219195,null))[_0x09c0('0x22')](removeEntity(_0x219195,null))['catch'](handleError(_0x219195,null));};exports[_0x09c0('0x59')]=function(_0x3564e6,_0x26dc22,_0x6894c1){var _0x4f3457={};var _0x157520={};var _0x48dae0;var _0x29205f;return db[_0x09c0('0x3b')][_0x09c0('0x5a')]({'where':{'id':_0x3564e6['params']['id']}})['then'](handleEntityNotFound(_0x26dc22,null))[_0x09c0('0x22')](function(_0x36e3b0){if(_0x36e3b0){_0x48dae0=_0x36e3b0;_0x157520[_0x09c0('0x40')]=_[_0x09c0('0x3e')](db['ServicenowField'][_0x09c0('0x3c')]);_0x157520[_0x09c0('0x3d')]=_['keys'](_0x3564e6[_0x09c0('0x3d')]);_0x157520[_0x09c0('0x49')]=_[_0x09c0('0x3f')](_0x157520[_0x09c0('0x40')],_0x157520['query']);_0x4f3457[_0x09c0('0x41')]=_[_0x09c0('0x3f')](_0x157520[_0x09c0('0x40')],qs[_0x09c0('0x42')](_0x3564e6[_0x09c0('0x3d')][_0x09c0('0x42')]));_0x4f3457[_0x09c0('0x41')]=_0x4f3457[_0x09c0('0x41')][_0x09c0('0x43')]?_0x4f3457[_0x09c0('0x41')]:_0x157520[_0x09c0('0x40')];_0x4f3457[_0x09c0('0x46')]=qs[_0x09c0('0x47')](_0x3564e6['query'][_0x09c0('0x47')]);_0x4f3457[_0x09c0('0x48')]=qs[_0x09c0('0x49')](_[_0x09c0('0x5b')](_0x3564e6[_0x09c0('0x3d')],_0x157520['filters']));if(_0x3564e6[_0x09c0('0x3d')][_0x09c0('0x4a')]){_0x4f3457[_0x09c0('0x48')]=_[_0x09c0('0x4d')](_0x4f3457['where'],{'$or':_[_0x09c0('0x3a')](_0x4f3457[_0x09c0('0x41')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x3564e6[_0x09c0('0x3d')][_0x09c0('0x4a')]+'%'};return _0x325013;})});}_0x4f3457=_[_0x09c0('0x4d')]({},_0x4f3457,_0x3564e6[_0x09c0('0x4e')]);return _0x48dae0['getFields'](_0x4f3457);}})[_0x09c0('0x22')](function(_0x302c81){if(_0x302c81){_0x29205f=_0x302c81[_0x09c0('0x43')];if(!_0x3564e6[_0x09c0('0x3d')][_0x09c0('0x44')]('nolimit')){_0x4f3457[_0x09c0('0x31')]=qs[_0x09c0('0x31')](_0x3564e6[_0x09c0('0x3d')][_0x09c0('0x31')]);_0x4f3457[_0x09c0('0x30')]=qs[_0x09c0('0x30')](_0x3564e6['query']['offset']);}return _0x48dae0['getFields'](_0x4f3457);}})['then'](function(_0x7c1cb8){if(_0x7c1cb8){return _0x7c1cb8?{'count':_0x29205f,'rows':_0x7c1cb8}:null;}})[_0x09c0('0x22')](respondWithResult(_0x26dc22,null))[_0x09c0('0x2a')](handleError(_0x26dc22,null));};exports['getSubjects']=function(_0x3306b9,_0x595b73,_0x368108){var _0x14872e={};var _0x5732ae={};var _0x3998ec;var _0x48d41f;return db['ServicenowConfiguration'][_0x09c0('0x5a')]({'where':{'id':_0x3306b9[_0x09c0('0x54')]['id']}})[_0x09c0('0x22')](handleEntityNotFound(_0x595b73,null))[_0x09c0('0x22')](function(_0x2c34e6){if(_0x2c34e6){_0x3998ec=_0x2c34e6;_0x5732ae[_0x09c0('0x40')]=_[_0x09c0('0x3e')](db[_0x09c0('0x5c')][_0x09c0('0x3c')]);_0x5732ae[_0x09c0('0x3d')]=_['keys'](_0x3306b9[_0x09c0('0x3d')]);_0x5732ae[_0x09c0('0x49')]=_['intersection'](_0x5732ae['model'],_0x5732ae[_0x09c0('0x3d')]);_0x14872e[_0x09c0('0x41')]=_[_0x09c0('0x3f')](_0x5732ae[_0x09c0('0x40')],qs[_0x09c0('0x42')](_0x3306b9[_0x09c0('0x3d')][_0x09c0('0x42')]));_0x14872e['attributes']=_0x14872e[_0x09c0('0x41')]['length']?_0x14872e[_0x09c0('0x41')]:_0x5732ae[_0x09c0('0x40')];_0x14872e[_0x09c0('0x46')]=qs[_0x09c0('0x47')](_0x3306b9[_0x09c0('0x3d')]['sort']);_0x14872e[_0x09c0('0x48')]=qs['filters'](_[_0x09c0('0x5b')](_0x3306b9['query'],_0x5732ae[_0x09c0('0x49')]));if(_0x3306b9[_0x09c0('0x3d')][_0x09c0('0x4a')]){_0x14872e[_0x09c0('0x48')]=_[_0x09c0('0x4d')](_0x14872e[_0x09c0('0x48')],{'$or':_[_0x09c0('0x3a')](_0x14872e['attributes'],function(_0x4ab50d){var _0x2c29c2={};_0x2c29c2[_0x4ab50d]={'$like':'%'+_0x3306b9[_0x09c0('0x3d')][_0x09c0('0x4a')]+'%'};return _0x2c29c2;})});}_0x14872e=_[_0x09c0('0x4d')]({},_0x14872e,_0x3306b9[_0x09c0('0x4e')]);return _0x3998ec[_0x09c0('0x5d')](_0x14872e);}})[_0x09c0('0x22')](function(_0x139c05){if(_0x139c05){_0x48d41f=_0x139c05[_0x09c0('0x43')];if(!_0x3306b9[_0x09c0('0x3d')]['hasOwnProperty']('nolimit')){_0x14872e['limit']=qs[_0x09c0('0x31')](_0x3306b9[_0x09c0('0x3d')][_0x09c0('0x31')]);_0x14872e['offset']=qs['offset'](_0x3306b9[_0x09c0('0x3d')]['offset']);}return _0x3998ec[_0x09c0('0x5d')](_0x14872e);}})[_0x09c0('0x22')](function(_0x5c3d6a){if(_0x5c3d6a){return _0x5c3d6a?{'count':_0x48d41f,'rows':_0x5c3d6a}:null;}})[_0x09c0('0x22')](respondWithResult(_0x595b73,null))['catch'](handleError(_0x595b73,null));};exports[_0x09c0('0x5e')]=function(_0x1fd9ce,_0x15a0fe,_0x55dcf1){var _0x2ea30f={};var _0x456adf={};var _0x2a637e;var _0x27012f;return db[_0x09c0('0x3b')][_0x09c0('0x5a')]({'where':{'id':_0x1fd9ce[_0x09c0('0x54')]['id']}})[_0x09c0('0x22')](handleEntityNotFound(_0x15a0fe,null))[_0x09c0('0x22')](function(_0x26cb1d){if(_0x26cb1d){_0x2a637e=_0x26cb1d;_0x456adf[_0x09c0('0x40')]=_[_0x09c0('0x3e')](db['ServicenowField'][_0x09c0('0x3c')]);_0x456adf[_0x09c0('0x3d')]=_[_0x09c0('0x3e')](_0x1fd9ce[_0x09c0('0x3d')]);_0x456adf[_0x09c0('0x49')]=_['intersection'](_0x456adf[_0x09c0('0x40')],_0x456adf['query']);_0x2ea30f['attributes']=_[_0x09c0('0x3f')](_0x456adf[_0x09c0('0x40')],qs[_0x09c0('0x42')](_0x1fd9ce['query'][_0x09c0('0x42')]));_0x2ea30f[_0x09c0('0x41')]=_0x2ea30f[_0x09c0('0x41')][_0x09c0('0x43')]?_0x2ea30f[_0x09c0('0x41')]:_0x456adf[_0x09c0('0x40')];_0x2ea30f['order']=qs[_0x09c0('0x47')](_0x1fd9ce[_0x09c0('0x3d')]['sort']);_0x2ea30f[_0x09c0('0x48')]=qs[_0x09c0('0x49')](_['pick'](_0x1fd9ce[_0x09c0('0x3d')],_0x456adf[_0x09c0('0x49')]));if(_0x1fd9ce[_0x09c0('0x3d')]['filter']){_0x2ea30f[_0x09c0('0x48')]=_[_0x09c0('0x4d')](_0x2ea30f['where'],{'$or':_[_0x09c0('0x3a')](_0x2ea30f[_0x09c0('0x41')],function(_0x5aa1b6){var _0x42a643={};_0x42a643[_0x5aa1b6]={'$like':'%'+_0x1fd9ce[_0x09c0('0x3d')][_0x09c0('0x4a')]+'%'};return _0x42a643;})});}_0x2ea30f=_[_0x09c0('0x4d')]({},_0x2ea30f,_0x1fd9ce[_0x09c0('0x4e')]);return _0x2a637e['getDescriptions'](_0x2ea30f);}})[_0x09c0('0x22')](function(_0x2bf080){if(_0x2bf080){_0x27012f=_0x2bf080[_0x09c0('0x43')];if(!_0x1fd9ce['query'][_0x09c0('0x44')](_0x09c0('0x45'))){_0x2ea30f[_0x09c0('0x31')]=qs['limit'](_0x1fd9ce[_0x09c0('0x3d')][_0x09c0('0x31')]);_0x2ea30f[_0x09c0('0x30')]=qs[_0x09c0('0x30')](_0x1fd9ce[_0x09c0('0x3d')][_0x09c0('0x30')]);}return _0x2a637e[_0x09c0('0x5e')](_0x2ea30f);}})['then'](function(_0x22a245){if(_0x22a245){return _0x22a245?{'count':_0x27012f,'rows':_0x22a245}:null;}})[_0x09c0('0x22')](respondWithResult(_0x15a0fe,null))[_0x09c0('0x2a')](handleError(_0x15a0fe,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 51cf1b6..daac17d 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 _0x6e9b=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x454e37,_0x39016d){var _0xf78f57=function(_0x4cc363){while(--_0x4cc363){_0x454e37['push'](_0x454e37['shift']());}};_0xf78f57(++_0x39016d);}(_0x6e9b,0xea));var _0xb6e9=function(_0xb5514c,_0x4fe280){_0xb5514c=_0xb5514c-0x0;var _0x27d7a8=_0x6e9b[_0xb5514c];return _0x27d7a8;};'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('bluebird');var rp=require(_0xb6e9('0x5'));var fs=require('fs');var path=require(_0xb6e9('0x6'));var rimraf=require(_0xb6e9('0x7'));var config=require('../../config/environment');var attributes=require(_0xb6e9('0x8'));module[_0xb6e9('0x9')]=function(_0x2bdfb8,_0x6b0286){return _0x2bdfb8[_0xb6e9('0xa')](_0xb6e9('0xb'),attributes,{'tableName':_0xb6e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c9b=['rimraf','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','path'];(function(_0x103c4c,_0x285348){var _0x3fc15e=function(_0x40e0e6){while(--_0x40e0e6){_0x103c4c['push'](_0x103c4c['shift']());}};_0x3fc15e(++_0x285348);}(_0x9c9b,0x194));var _0xb9c9=function(_0x22c95d,_0x197acf){_0x22c95d=_0x22c95d-0x0;var _0x4831fe=_0x9c9b[_0x22c95d];return _0x4831fe;};'use strict';var _=require('lodash');var util=require(_0xb9c9('0x0'));var logger=require(_0xb9c9('0x1'))(_0xb9c9('0x2'));var moment=require(_0xb9c9('0x3'));var BPromise=require(_0xb9c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9c9('0x5'));var rimraf=require(_0xb9c9('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0xfe4cb4,_0x26bf07){return _0xfe4cb4[_0xb9c9('0x7')](_0xb9c9('0x8'),attributes,{'tableName':_0xb9c9('0x9'),'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 da08aee..51cab7e 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 _0x7e9a=['message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x12a06b,_0x417b51){var _0x5d0bb8=function(_0x41d3d0){while(--_0x41d3d0){_0x12a06b['push'](_0x12a06b['shift']());}};_0x5d0bb8(++_0x417b51);}(_0x7e9a,0x127));var _0xa7e9=function(_0x41fff6,_0x42aa8d){_0x41fff6=_0x41fff6-0x0;var _0x2ddf19=_0x7e9a[_0x41fff6];return _0x2ddf19;};'use strict';var _=require('lodash');var util=require(_0xa7e9('0x0'));var moment=require(_0xa7e9('0x1'));var BPromise=require(_0xa7e9('0x2'));var rs=require(_0xa7e9('0x3'));var fs=require('fs');var Redis=require(_0xa7e9('0x4'));var db=require(_0xa7e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7e9('0x6'))(_0xa7e9('0x7'));var config=require('../../config/environment');var jayson=require(_0xa7e9('0x8'));var client=jayson['client'][_0xa7e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56d0a8,_0x30b6e2,_0x54f0be){return new BPromise(function(_0xe00e4a,_0x2da73c){return client[_0xa7e9('0xa')](_0x56d0a8,_0x54f0be)[_0xa7e9('0xb')](function(_0x44410e){logger[_0xa7e9('0xc')](_0xa7e9('0xd'),_0x30b6e2,_0xa7e9('0xe'));logger[_0xa7e9('0xf')](_0xa7e9('0x10'),_0x30b6e2,_0xa7e9('0xe'),JSON[_0xa7e9('0x11')](_0x44410e));if(_0x44410e['error']){if(_0x44410e['error'][_0xa7e9('0x12')]===0x1f4){logger[_0xa7e9('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x30b6e2,_0x44410e[_0xa7e9('0x13')][_0xa7e9('0x14')]);return _0x2da73c(_0x44410e[_0xa7e9('0x13')][_0xa7e9('0x14')]);}logger[_0xa7e9('0x13')](_0xa7e9('0xd'),_0x30b6e2,_0x44410e[_0xa7e9('0x13')][_0xa7e9('0x14')]);return _0xe00e4a(_0x44410e['error'][_0xa7e9('0x14')]);}else{logger[_0xa7e9('0xc')](_0xa7e9('0xd'),_0x30b6e2,_0xa7e9('0xe'));_0xe00e4a(_0x44410e['result'][_0xa7e9('0x14')]);}})['catch'](function(_0x13d419){logger[_0xa7e9('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x30b6e2,_0x13d419);_0x2da73c(_0x13d419);});});} \ No newline at end of file +var _0xd39e=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug'];(function(_0x551dde,_0x2d9be8){var _0x581414=function(_0x12fce8){while(--_0x12fce8){_0x551dde['push'](_0x551dde['shift']());}};_0x581414(++_0x2d9be8);}(_0xd39e,0xd6));var _0xed39=function(_0x1e691f,_0x215f5f){_0x1e691f=_0x1e691f-0x0;var _0x5b37cb=_0xd39e[_0x1e691f];return _0x5b37cb;};'use strict';var _=require('lodash');var util=require(_0xed39('0x0'));var moment=require(_0xed39('0x1'));var BPromise=require(_0xed39('0x2'));var rs=require(_0xed39('0x3'));var fs=require('fs');var Redis=require(_0xed39('0x4'));var db=require(_0xed39('0x5'))['db'];var utils=require(_0xed39('0x6'));var logger=require(_0xed39('0x7'))(_0xed39('0x8'));var config=require(_0xed39('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xed39('0xa')][_0xed39('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8be10e,_0x143389,_0x2adf37){return new BPromise(function(_0x39cb2c,_0x3241b3){return client['request'](_0x8be10e,_0x2adf37)[_0xed39('0xc')](function(_0x191d9c){logger[_0xed39('0xd')](_0xed39('0xe'),_0x143389,'request\x20sent');logger[_0xed39('0xf')](_0xed39('0x10'),_0x143389,'request\x20sent',JSON['stringify'](_0x191d9c));if(_0x191d9c[_0xed39('0x11')]){if(_0x191d9c[_0xed39('0x11')][_0xed39('0x12')]===0x1f4){logger[_0xed39('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x143389,_0x191d9c[_0xed39('0x11')][_0xed39('0x13')]);return _0x3241b3(_0x191d9c[_0xed39('0x11')]['message']);}logger['error'](_0xed39('0xe'),_0x143389,_0x191d9c[_0xed39('0x11')][_0xed39('0x13')]);return _0x39cb2c(_0x191d9c[_0xed39('0x11')]['message']);}else{logger[_0xed39('0xd')](_0xed39('0xe'),_0x143389,_0xed39('0x14'));_0x39cb2c(_0x191d9c[_0xed39('0x15')][_0xed39('0x13')]);}})[_0xed39('0x16')](function(_0x2cf710){logger[_0xed39('0x11')](_0xed39('0xe'),_0x143389,_0x2cf710);_0x3241b3(_0x2cf710);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 5ffdd1e..5470492 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 _0xc8a0=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xc8a0,0xf7));var _0x0c8a=function(_0x31d3c3,_0x5279a3){_0x31d3c3=_0x31d3c3-0x0;var _0x58f1a7=_0xc8a0[_0x31d3c3];return _0x58f1a7;};'use strict';var multer=require(_0x0c8a('0x0'));var util=require(_0x0c8a('0x1'));var path=require(_0x0c8a('0x2'));var timeout=require(_0x0c8a('0x3'));var express=require(_0x0c8a('0x4'));var router=express[_0x0c8a('0x5')]();var auth=require(_0x0c8a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0c8a('0x7'));var controller=require(_0x0c8a('0x8'));router[_0x0c8a('0x9')]('/',auth[_0x0c8a('0xa')](),controller[_0x0c8a('0xb')]);router[_0x0c8a('0x9')](_0x0c8a('0xc'),auth[_0x0c8a('0xa')](),controller[_0x0c8a('0xd')]);router[_0x0c8a('0xe')]('/',auth[_0x0c8a('0xa')](),controller['create']);router[_0x0c8a('0xf')](_0x0c8a('0xc'),auth['isAuthenticated'](),controller[_0x0c8a('0x10')]);router[_0x0c8a('0x11')](_0x0c8a('0xc'),auth[_0x0c8a('0xa')](),controller[_0x0c8a('0x12')]);module[_0x0c8a('0x13')]=router; \ No newline at end of file +var _0x5bf2=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','multer','util','path','connect-timeout','Router'];(function(_0x2d6681,_0x3c743f){var _0xe61ddc=function(_0x32ce7d){while(--_0x32ce7d){_0x2d6681['push'](_0x2d6681['shift']());}};_0xe61ddc(++_0x3c743f);}(_0x5bf2,0x8b));var _0x25bf=function(_0x2b07c6,_0x3c5db5){_0x2b07c6=_0x2b07c6-0x0;var _0xb3fbc4=_0x5bf2[_0x2b07c6];return _0xb3fbc4;};'use strict';var multer=require(_0x25bf('0x0'));var util=require(_0x25bf('0x1'));var path=require(_0x25bf('0x2'));var timeout=require(_0x25bf('0x3'));var express=require('express');var router=express[_0x25bf('0x4')]();var auth=require(_0x25bf('0x5'));var interaction=require(_0x25bf('0x6'));var config=require(_0x25bf('0x7'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x25bf('0x8')](),controller[_0x25bf('0x9')]);router[_0x25bf('0xa')](_0x25bf('0xb'),auth['isAuthenticated'](),controller[_0x25bf('0xc')]);router[_0x25bf('0xd')]('/',auth[_0x25bf('0x8')](),controller['create']);router[_0x25bf('0xe')](_0x25bf('0xb'),auth[_0x25bf('0x8')](),controller[_0x25bf('0xf')]);router['delete'](_0x25bf('0xb'),auth[_0x25bf('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c6e84d3..c35382c 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 _0xdcd0=['STRING','variable','BOOLEAN','sequelize','ENUM','customVariable','keyValue'];(function(_0x5050f8,_0x346aca){var _0x54c929=function(_0x212841){while(--_0x212841){_0x5050f8['push'](_0x5050f8['shift']());}};_0x54c929(++_0x346aca);}(_0xdcd0,0xb9));var _0x0dcd=function(_0x8cafee,_0x9f33e4){_0x8cafee=_0x8cafee-0x0;var _0x2d989d=_0xdcd0[_0x8cafee];return _0x2d989d;};'use strict';var Sequelize=require(_0x0dcd('0x0'));module['exports']={'type':{'type':Sequelize[_0x0dcd('0x1')]('string','variable',_0x0dcd('0x2'),_0x0dcd('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0dcd('0x4')]},'key':{'type':Sequelize[_0x0dcd('0x4')]},'keyType':{'type':Sequelize[_0x0dcd('0x1')]('string',_0x0dcd('0x5'),_0x0dcd('0x2'))},'keyContent':{'type':Sequelize[_0x0dcd('0x4')]},'idField':{'type':Sequelize[_0x0dcd('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0dcd('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0dcd('0x4')]}}; \ No newline at end of file +var _0xdec1=['string','variable','customVariable','keyValue','STRING','sequelize','ENUM'];(function(_0x5b3d20,_0x155cc5){var _0x4fb5be=function(_0x3b4266){while(--_0x3b4266){_0x5b3d20['push'](_0x5b3d20['shift']());}};_0x4fb5be(++_0x155cc5);}(_0xdec1,0x11d));var _0x1dec=function(_0x1c007c,_0x1a8f4b){_0x1c007c=_0x1c007c-0x0;var _0x4df717=_0xdec1[_0x1c007c];return _0x4df717;};'use strict';var Sequelize=require(_0x1dec('0x0'));module['exports']={'type':{'type':Sequelize[_0x1dec('0x1')](_0x1dec('0x2'),_0x1dec('0x3'),_0x1dec('0x4'),_0x1dec('0x5')),'defaultValue':_0x1dec('0x2')},'content':{'type':Sequelize[_0x1dec('0x6')]},'key':{'type':Sequelize[_0x1dec('0x6')]},'keyType':{'type':Sequelize[_0x1dec('0x1')](_0x1dec('0x2'),_0x1dec('0x3'),_0x1dec('0x4'))},'keyContent':{'type':Sequelize[_0x1dec('0x6')]},'idField':{'type':Sequelize[_0x1dec('0x6')]},'nameField':{'type':Sequelize[_0x1dec('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1dec('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 4bf758c..ab4680f 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(_0x4a367a,_0x57effa){var _0x3d7f63=function(_0x1d9638){while(--_0x1d9638){_0x4a367a['push'](_0x4a367a['shift']());}};_0x3d7f63(++_0x57effa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x91d498,_0x482a89){var _0x1e0294=function(_0x214950){while(--_0x214950){_0x91d498['push'](_0x91d498['shift']());}};_0x1e0294(++_0x482a89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 e65c59c..3a63599 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 _0x1fc6=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','api','moment','bluebird','request-promise','rimraf','./intServicenowField.attributes'];(function(_0x108a98,_0x112087){var _0xd4205=function(_0xb5e7d9){while(--_0xb5e7d9){_0x108a98['push'](_0x108a98['shift']());}};_0xd4205(++_0x112087);}(_0x1fc6,0x1e3));var _0x61fc=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x1fc6[_0x25c326];return _0x762452;};'use strict';var _=require('lodash');var util=require(_0x61fc('0x0'));var logger=require('../../config/logger')(_0x61fc('0x1'));var moment=require(_0x61fc('0x2'));var BPromise=require(_0x61fc('0x3'));var rp=require(_0x61fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61fc('0x5'));var config=require('../../config/environment');var attributes=require(_0x61fc('0x6'));module[_0x61fc('0x7')]=function(_0x51d3b5,_0x501d36){return _0x51d3b5[_0x61fc('0x8')](_0x61fc('0x9'),attributes,{'tableName':_0x61fc('0xa'),'paranoid':![],'indexes':[{'name':_0x61fc('0xb'),'fields':[_0x61fc('0xc'),_0x61fc('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9c1=['../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x32c39d,_0x580359){var _0x5a494d=function(_0x398d76){while(--_0x398d76){_0x32c39d['push'](_0x32c39d['shift']());}};_0x5a494d(++_0x580359);}(_0xc9c1,0x1e8));var _0x1c9c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xc9c1[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x1c9c('0x0'));var util=require(_0x1c9c('0x1'));var logger=require(_0x1c9c('0x2'))(_0x1c9c('0x3'));var moment=require('moment');var BPromise=require(_0x1c9c('0x4'));var rp=require(_0x1c9c('0x5'));var fs=require('fs');var path=require(_0x1c9c('0x6'));var rimraf=require(_0x1c9c('0x7'));var config=require(_0x1c9c('0x8'));var attributes=require(_0x1c9c('0x9'));module[_0x1c9c('0xa')]=function(_0x5ce250,_0x36954c){return _0x5ce250[_0x1c9c('0xb')](_0x1c9c('0xc'),attributes,{'tableName':_0x1c9c('0xd'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1c9c('0xe'),_0x1c9c('0xf')],'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 5b1c748..4ddc4dd 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 _0x55f4=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55f4,0x1c0));var _0x455f=function(_0x319b02,_0x1be26d){_0x319b02=_0x319b02-0x0;var _0x2a5ec4=_0x55f4[_0x319b02];return _0x2a5ec4;};'use strict';var _=require(_0x455f('0x0'));var util=require(_0x455f('0x1'));var moment=require(_0x455f('0x2'));var BPromise=require('bluebird');var rs=require(_0x455f('0x3'));var fs=require('fs');var Redis=require(_0x455f('0x4'));var db=require(_0x455f('0x5'))['db'];var utils=require(_0x455f('0x6'));var logger=require(_0x455f('0x7'))(_0x455f('0x8'));var config=require('../../config/environment');var jayson=require(_0x455f('0x9'));var client=jayson['client'][_0x455f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c357f,_0xb0ef0e,_0x337ec7){return new BPromise(function(_0x115e99,_0xf53f01){return client[_0x455f('0xb')](_0x3c357f,_0x337ec7)[_0x455f('0xc')](function(_0x114a51){logger[_0x455f('0xd')](_0x455f('0xe'),_0xb0ef0e,_0x455f('0xf'));logger[_0x455f('0x10')](_0x455f('0x11'),_0xb0ef0e,_0x455f('0xf'),JSON['stringify'](_0x114a51));if(_0x114a51[_0x455f('0x12')]){if(_0x114a51['error'][_0x455f('0x13')]===0x1f4){logger[_0x455f('0x12')](_0x455f('0xe'),_0xb0ef0e,_0x114a51[_0x455f('0x12')]['message']);return _0xf53f01(_0x114a51[_0x455f('0x12')][_0x455f('0x14')]);}logger[_0x455f('0x12')](_0x455f('0xe'),_0xb0ef0e,_0x114a51[_0x455f('0x12')][_0x455f('0x14')]);return _0x115e99(_0x114a51['error'][_0x455f('0x14')]);}else{logger[_0x455f('0xd')](_0x455f('0xe'),_0xb0ef0e,_0x455f('0xf'));_0x115e99(_0x114a51[_0x455f('0x15')]['message']);}})['catch'](function(_0x1c6dd2){logger[_0x455f('0x12')](_0x455f('0xe'),_0xb0ef0e,_0x1c6dd2);_0xf53f01(_0x1c6dd2);});});} \ No newline at end of file +var _0x48af=['client','request','then','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x555552,_0x576279){var _0x5b280d=function(_0x2ef8ef){while(--_0x2ef8ef){_0x555552['push'](_0x555552['shift']());}};_0x5b280d(++_0x576279);}(_0x48af,0xef));var _0xf48a=function(_0x44bcb6,_0x16e9a3){_0x44bcb6=_0x44bcb6-0x0;var _0x49ac0f=_0x48af[_0x44bcb6];return _0x49ac0f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf48a('0x0'));var BPromise=require(_0xf48a('0x1'));var rs=require(_0xf48a('0x2'));var fs=require('fs');var Redis=require(_0xf48a('0x3'));var db=require(_0xf48a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf48a('0x5'))('rpc');var config=require(_0xf48a('0x6'));var jayson=require(_0xf48a('0x7'));var client=jayson[_0xf48a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43374f,_0x1d9dec,_0x4792de){return new BPromise(function(_0x45f0e4,_0x5110f3){return client[_0xf48a('0x9')](_0x43374f,_0x4792de)[_0xf48a('0xa')](function(_0x1fdc00){logger['info'](_0xf48a('0xb'),_0x1d9dec,_0xf48a('0xc'));logger[_0xf48a('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x1d9dec,'request\x20sent',JSON[_0xf48a('0xe')](_0x1fdc00));if(_0x1fdc00[_0xf48a('0xf')]){if(_0x1fdc00[_0xf48a('0xf')][_0xf48a('0x10')]===0x1f4){logger[_0xf48a('0xf')](_0xf48a('0xb'),_0x1d9dec,_0x1fdc00['error'][_0xf48a('0x11')]);return _0x5110f3(_0x1fdc00[_0xf48a('0xf')][_0xf48a('0x11')]);}logger['error'](_0xf48a('0xb'),_0x1d9dec,_0x1fdc00['error'][_0xf48a('0x11')]);return _0x45f0e4(_0x1fdc00[_0xf48a('0xf')][_0xf48a('0x11')]);}else{logger['info'](_0xf48a('0xb'),_0x1d9dec,'request\x20sent');_0x45f0e4(_0x1fdc00['result'][_0xf48a('0x11')]);}})[_0xf48a('0x12')](function(_0x38d16d){logger['error'](_0xf48a('0xb'),_0x1d9dec,_0x38d16d);_0x5110f3(_0x38d16d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 35b2d98..b6793f3 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 _0x379a=['getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x217372,_0x1822ce){var _0x2715a1=function(_0x5712db){while(--_0x5712db){_0x217372['push'](_0x217372['shift']());}};_0x2715a1(++_0x1822ce);}(_0x379a,0xd0));var _0xa379=function(_0xd578cb,_0x2167a3){_0xd578cb=_0xd578cb-0x0;var _0x775533=_0x379a[_0xd578cb];return _0x775533;};'use strict';var multer=require(_0xa379('0x0'));var util=require(_0xa379('0x1'));var path=require(_0xa379('0x2'));var timeout=require(_0xa379('0x3'));var express=require(_0xa379('0x4'));var router=express[_0xa379('0x5')]();var auth=require(_0xa379('0x6'));var interaction=require(_0xa379('0x7'));var config=require(_0xa379('0x8'));var controller=require(_0xa379('0x9'));router[_0xa379('0xa')]('/',auth[_0xa379('0xb')](),controller[_0xa379('0xc')]);router['get'](_0xa379('0xd'),auth[_0xa379('0xb')](),controller[_0xa379('0xe')]);router[_0xa379('0xa')]('/:id/configurations',auth[_0xa379('0xb')](),controller[_0xa379('0xf')]);router['get'](_0xa379('0x10'),auth[_0xa379('0xb')](),controller[_0xa379('0x11')]);router[_0xa379('0x12')]('/',auth[_0xa379('0xb')](),controller[_0xa379('0x13')]);router['post'](_0xa379('0x14'),auth[_0xa379('0xb')](),controller[_0xa379('0x15')]);router[_0xa379('0x16')]('/:id',auth[_0xa379('0xb')](),controller['update']);router['delete'](_0xa379('0xd'),auth['isAuthenticated'](),controller[_0xa379('0x17')]);module[_0xa379('0x18')]=router; \ No newline at end of file +var _0x9d04=['path','express','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','update','delete','destroy','exports','multer','util'];(function(_0x4cc61d,_0x3fd027){var _0x916589=function(_0x3f8b72){while(--_0x3f8b72){_0x4cc61d['push'](_0x4cc61d['shift']());}};_0x916589(++_0x3fd027);}(_0x9d04,0x18e));var _0x49d0=function(_0x5cb0b7,_0x393d63){_0x5cb0b7=_0x5cb0b7-0x0;var _0x54bbb2=_0x9d04[_0x5cb0b7];return _0x54bbb2;};'use strict';var multer=require(_0x49d0('0x0'));var util=require(_0x49d0('0x1'));var path=require(_0x49d0('0x2'));var timeout=require('connect-timeout');var express=require(_0x49d0('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x49d0('0x4'));var config=require('../../config/environment');var controller=require(_0x49d0('0x5'));router[_0x49d0('0x6')]('/',auth[_0x49d0('0x7')](),controller[_0x49d0('0x8')]);router[_0x49d0('0x6')](_0x49d0('0x9'),auth[_0x49d0('0x7')](),controller[_0x49d0('0xa')]);router[_0x49d0('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x49d0('0xb')]);router[_0x49d0('0x6')](_0x49d0('0xc'),auth[_0x49d0('0x7')](),controller[_0x49d0('0xd')]);router[_0x49d0('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49d0('0xe')](_0x49d0('0xf'),auth[_0x49d0('0x7')](),controller['addConfiguration']);router['put'](_0x49d0('0x9'),auth[_0x49d0('0x7')](),controller[_0x49d0('0x10')]);router[_0x49d0('0x11')](_0x49d0('0x9'),auth[_0x49d0('0x7')](),controller[_0x49d0('0x12')]);module[_0x49d0('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index fd2a50b..3fa7c74 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 _0xf872=['exports','STRING','sequelize'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xf872,0x1eb));var _0x2f87=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0xf872[_0x2b45b5];return _0x1d9c06;};'use strict';var Sequelize=require(_0x2f87('0x0'));module[_0x2f87('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2f87('0x2')]},'username':{'type':Sequelize[_0x2f87('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x2f87('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2f87('0x2')]}}; \ No newline at end of file +var _0x24ea=['remoteUri','sequelize','STRING','username'];(function(_0x4d3de8,_0x4a8511){var _0xc8aba7=function(_0x434b61){while(--_0x434b61){_0x4d3de8['push'](_0x4d3de8['shift']());}};_0xc8aba7(++_0x4a8511);}(_0x24ea,0x195));var _0xa24e=function(_0x4fe777,_0x40dec8){_0x4fe777=_0x4fe777-0x0;var _0x2a3437=_0x24ea[_0x4fe777];return _0x2a3437;};'use strict';var Sequelize=require(_0xa24e('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24e('0x1')]},'description':{'type':Sequelize[_0xa24e('0x1')]},'username':{'type':Sequelize[_0xa24e('0x1')],'unique':_0xa24e('0x2')},'password':{'type':Sequelize[_0xa24e('0x1')]},'remoteUri':{'type':Sequelize[_0xa24e('0x1')],'unique':_0xa24e('0x3')},'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 8f84d93..dad9c49 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 _0x23c9=['getDescriptions','SugarcrmField','Subjects','getFields','description','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Password\x20Expired','format','Calls','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','params','include','options','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions'];(function(_0x27bd9b,_0x206238){var _0xbd6219=function(_0x3c1577){while(--_0x3c1577){_0x27bd9b['push'](_0x27bd9b['shift']());}};_0xbd6219(++_0x206238);}(_0x23c9,0x1a1));var _0x923c=function(_0x333767,_0x220733){_0x333767=_0x333767-0x0;var _0x42a755=_0x23c9[_0x333767];return _0x42a755;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x923c('0x0'));var rimraf=require(_0x923c('0x1'));var zipdir=require(_0x923c('0x2'));var jsonpatch=require(_0x923c('0x3'));var rp=require('request-promise');var moment=require(_0x923c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x923c('0x5'));var util=require(_0x923c('0x6'));var path=require(_0x923c('0x7'));var sox=require('sox');var csv=require(_0x923c('0x8'));var ejs=require(_0x923c('0x9'));var fs=require('fs');var _=require(_0x923c('0xa'));var squel=require('squel');var crypto=require(_0x923c('0xb'));var jsforce=require(_0x923c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x923c('0x8'));var querystring=require(_0x923c('0xd'));var Papa=require(_0x923c('0xe'));var Redis=require(_0x923c('0xf'));var authService=require(_0x923c('0x10'));var qs=require(_0x923c('0x11'));var as=require(_0x923c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x923c('0x13'))('api');var utils=require(_0x923c('0x14'));var config=require(_0x923c('0x15'));var db=require(_0x923c('0x16'))['db'];var integrations=require(_0x923c('0x17'));var jayson=require(_0x923c('0x18'));var client=jayson[_0x923c('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x5d6ffd,_0x512b12,_0xf8913a){if(_0xf8913a){var _0x121cc6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x121cc6[_0x923c('0x1a')](_0x512b12)){return _0x5d6ffd;}else{throw new db[(_0x923c('0x1b'))][(_0x923c('0x1c'))](_0x923c('0x1d'));}}else{return _0x5d6ffd;}}function respondWithRpcPromise(_0x21b172,_0x2eb02c,_0x11ba5a,_0x5b37ac){return new BPromise(function(_0x308be8,_0x297fc3){var _0x2a4d23=_0x5b37ac||client;return _0x2a4d23[_0x923c('0x1e')](_0x21b172,_0x11ba5a)[_0x923c('0x1f')](function(_0x23a969){logger['info'](_0x923c('0x20'),_0x2eb02c,'request\x20sent');logger[_0x923c('0x21')](_0x923c('0x22'),_0x2eb02c,_0x923c('0x23'),JSON['stringify'](_0x23a969));if(_0x23a969[_0x923c('0x24')]){if(_0x23a969[_0x923c('0x24')][_0x923c('0x25')]===0x1f4){logger[_0x923c('0x24')](_0x923c('0x20'),_0x2eb02c,_0x23a969[_0x923c('0x24')][_0x923c('0x26')]);return _0x297fc3(_0x23a969[_0x923c('0x24')][_0x923c('0x26')]);}logger[_0x923c('0x24')](_0x923c('0x20'),_0x2eb02c,_0x23a969[_0x923c('0x24')]['message']);return _0x308be8(_0x23a969[_0x923c('0x24')][_0x923c('0x26')]);}else{logger['info'](_0x923c('0x20'),_0x2eb02c,_0x923c('0x23'));_0x308be8(_0x23a969[_0x923c('0x27')][_0x923c('0x26')]);}})[_0x923c('0x28')](function(_0x4e20c2){logger[_0x923c('0x24')]('SugarcrmAccount,\x20%s,\x20%s',_0x2eb02c,_0x4e20c2);_0x297fc3(_0x4e20c2);});});}function respondWithStatusCode(_0x438580,_0x416172){_0x416172=_0x416172||0xcc;return function(_0x51ad21){if(_0x51ad21){return _0x438580['sendStatus'](_0x416172);}return _0x438580[_0x923c('0x29')](_0x416172)[_0x923c('0x2a')]();};}function respondWithResult(_0x28c483,_0x567c55){_0x567c55=_0x567c55||0xc8;return function(_0x191bb5){if(_0x191bb5){return _0x28c483['status'](_0x567c55)['json'](_0x191bb5);}};}function respondWithFilteredResult(_0x475d7a,_0x5f371a){return function(_0x528a6e){if(_0x528a6e){var _0xf3e355=_0x528a6e[_0x923c('0x2b')],_0x196e09=_0x5f371a[_0x923c('0x2c')],_0x1e7909=_0x5f371a['offset']+_0x5f371a[_0x923c('0x2d')],_0x4467b2;if(_0x1e7909>=_0xf3e355){_0x1e7909=_0xf3e355;_0x4467b2=0xc8;}else{_0x4467b2=0xce;}_0x475d7a[_0x923c('0x29')](_0x4467b2);return _0x475d7a[_0x923c('0x2e')](_0x923c('0x2f'),_0x196e09+'-'+_0x1e7909+'/'+_0xf3e355)[_0x923c('0x30')](_0x528a6e);}return null;};}function patchUpdates(_0x40a56c){return function(_0x587d85){try{jsonpatch[_0x923c('0x31')](_0x587d85,_0x40a56c,!![]);}catch(_0x384454){return BPromise[_0x923c('0x32')](_0x384454);}return _0x587d85[_0x923c('0x33')]();};}function saveUpdates(_0x180f63,_0x38ccfc){return function(_0x5378ea){if(_0x5378ea){return _0x5378ea['update'](_0x180f63)[_0x923c('0x1f')](function(_0x58f003){return _0x58f003;});}return null;};}function removeEntity(_0x37dbee,_0x1de60b){return function(_0x1b2593){if(_0x1b2593){return _0x1b2593[_0x923c('0x34')]()[_0x923c('0x1f')](function(){_0x37dbee[_0x923c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd410a7,_0x374937){return function(_0x172885){if(!_0x172885){_0xd410a7['sendStatus'](0x194);}return _0x172885;};}function handleError(_0x5af561,_0xc87bea){_0xc87bea=_0xc87bea||0x1f4;return function(_0x2649a0){logger[_0x923c('0x24')](_0x2649a0['stack']);if(_0x2649a0[_0x923c('0x35')]){delete _0x2649a0['name'];}_0x5af561[_0x923c('0x29')](_0xc87bea)[_0x923c('0x36')](_0x2649a0);};}exports[_0x923c('0x37')]=function(_0x3dd57e,_0x3a6534){var _0x4c4204={},_0x3ce406={},_0x4b2c61={'count':0x0,'rows':[]};var _0xe054f0=_['map'](db[_0x923c('0x38')][_0x923c('0x39')],function(_0xc955c3){return{'name':_0xc955c3[_0x923c('0x3a')],'type':_0xc955c3[_0x923c('0x3b')][_0x923c('0x3c')]};});_0x3ce406[_0x923c('0x3d')]=_[_0x923c('0x3e')](_0xe054f0,_0x923c('0x35'));_0x3ce406[_0x923c('0x3f')]=_[_0x923c('0x40')](_0x3dd57e['query']);_0x3ce406[_0x923c('0x41')]=_[_0x923c('0x42')](_0x3ce406[_0x923c('0x3d')],_0x3ce406[_0x923c('0x3f')]);_0x4c4204[_0x923c('0x43')]=_[_0x923c('0x42')](_0x3ce406[_0x923c('0x3d')],qs[_0x923c('0x44')](_0x3dd57e[_0x923c('0x3f')]['fields']));_0x4c4204['attributes']=_0x4c4204['attributes'][_0x923c('0x45')]?_0x4c4204[_0x923c('0x43')]:_0x3ce406[_0x923c('0x3d')];if(!_0x3dd57e['query'][_0x923c('0x46')]('nolimit')){_0x4c4204[_0x923c('0x2d')]=qs[_0x923c('0x2d')](_0x3dd57e[_0x923c('0x3f')][_0x923c('0x2d')]);_0x4c4204[_0x923c('0x2c')]=qs[_0x923c('0x2c')](_0x3dd57e['query']['offset']);}_0x4c4204[_0x923c('0x47')]=qs[_0x923c('0x48')](_0x3dd57e[_0x923c('0x3f')][_0x923c('0x48')]);_0x4c4204[_0x923c('0x49')]=qs[_0x923c('0x41')](_[_0x923c('0x4a')](_0x3dd57e[_0x923c('0x3f')],_0x3ce406[_0x923c('0x41')]),_0xe054f0);if(_0x3dd57e[_0x923c('0x3f')]['filter']){_0x4c4204[_0x923c('0x49')]=_['merge'](_0x4c4204[_0x923c('0x49')],{'$or':_[_0x923c('0x3e')](_0xe054f0,function(_0x1e30b2){if(_0x1e30b2[_0x923c('0x3b')]!==_0x923c('0x4b')){var _0x5d7db2={};_0x5d7db2[_0x1e30b2[_0x923c('0x35')]]={'$like':'%'+_0x3dd57e[_0x923c('0x3f')][_0x923c('0x4c')]+'%'};return _0x5d7db2;}})});}_0x4c4204=_[_0x923c('0x4d')]({},_0x4c4204,_0x3dd57e['options']);var _0x4867b9={'where':_0x4c4204['where']};return db[_0x923c('0x38')][_0x923c('0x2b')](_0x4867b9)[_0x923c('0x1f')](function(_0x2b7194){_0x4b2c61[_0x923c('0x2b')]=_0x2b7194;if(_0x3dd57e[_0x923c('0x3f')][_0x923c('0x4e')]){_0x4c4204['include']=[{'all':!![]}];}return db[_0x923c('0x38')][_0x923c('0x4f')](_0x4c4204);})['then'](function(_0x183a06){_0x4b2c61['rows']=_0x183a06;return _0x4b2c61;})[_0x923c('0x1f')](respondWithFilteredResult(_0x3a6534,_0x4c4204))[_0x923c('0x28')](handleError(_0x3a6534,null));};exports['show']=function(_0x156667,_0x3873d1){var _0x42e903={'raw':![],'where':{'id':_0x156667[_0x923c('0x50')]['id']}},_0xd72360={};_0xd72360[_0x923c('0x3d')]=_[_0x923c('0x40')](db[_0x923c('0x38')][_0x923c('0x39')]);_0xd72360[_0x923c('0x3f')]=_[_0x923c('0x40')](_0x156667['query']);_0xd72360['filters']=_[_0x923c('0x42')](_0xd72360[_0x923c('0x3d')],_0xd72360[_0x923c('0x3f')]);_0x42e903['attributes']=_[_0x923c('0x42')](_0xd72360['model'],qs[_0x923c('0x44')](_0x156667[_0x923c('0x3f')][_0x923c('0x44')]));_0x42e903[_0x923c('0x43')]=_0x42e903['attributes'][_0x923c('0x45')]?_0x42e903[_0x923c('0x43')]:_0xd72360['model'];if(_0x156667[_0x923c('0x3f')]['includeAll']){_0x42e903[_0x923c('0x51')]=[{'all':!![]}];}_0x42e903=_[_0x923c('0x4d')]({},_0x42e903,_0x156667[_0x923c('0x52')]);return db[_0x923c('0x38')][_0x923c('0x53')](_0x42e903)[_0x923c('0x1f')](handleEntityNotFound(_0x3873d1,null))[_0x923c('0x1f')](respondWithResult(_0x3873d1,null))[_0x923c('0x28')](handleError(_0x3873d1,null));};exports['create']=function(_0x568404,_0x3a2924){return db[_0x923c('0x38')][_0x923c('0x54')](_0x568404[_0x923c('0x55')],{})[_0x923c('0x1f')](respondWithResult(_0x3a2924,0xc9))[_0x923c('0x28')](handleError(_0x3a2924,null));};exports['update']=function(_0x27547d,_0xd195e4){if(_0x27547d['body']['id']){delete _0x27547d['body']['id'];}return db[_0x923c('0x38')]['find']({'where':{'id':_0x27547d['params']['id']}})[_0x923c('0x1f')](handleEntityNotFound(_0xd195e4,null))[_0x923c('0x1f')](saveUpdates(_0x27547d['body'],null))[_0x923c('0x1f')](respondWithResult(_0xd195e4,null))[_0x923c('0x28')](handleError(_0xd195e4,null));};exports[_0x923c('0x34')]=function(_0xc90262,_0x480441){return db[_0x923c('0x38')][_0x923c('0x53')]({'where':{'id':_0xc90262[_0x923c('0x50')]['id']}})[_0x923c('0x1f')](handleEntityNotFound(_0x480441,null))[_0x923c('0x1f')](removeEntity(_0x480441,null))['catch'](handleError(_0x480441,null));};exports[_0x923c('0x56')]=function(_0x269854,_0x40973d,_0x2daf75){var _0x3730d4={};var _0x57775e={};var _0x1a5681;var _0x3622f1;return db[_0x923c('0x38')][_0x923c('0x57')]({'where':{'id':_0x269854[_0x923c('0x50')]['id']}})[_0x923c('0x1f')](handleEntityNotFound(_0x40973d,null))[_0x923c('0x1f')](function(_0x18865c){if(_0x18865c){_0x1a5681=_0x18865c;_0x57775e['model']=_[_0x923c('0x40')](db[_0x923c('0x58')]['rawAttributes']);_0x57775e[_0x923c('0x3f')]=_[_0x923c('0x40')](_0x269854['query']);_0x57775e[_0x923c('0x41')]=_['intersection'](_0x57775e[_0x923c('0x3d')],_0x57775e[_0x923c('0x3f')]);_0x3730d4[_0x923c('0x43')]=_[_0x923c('0x42')](_0x57775e[_0x923c('0x3d')],qs['fields'](_0x269854['query'][_0x923c('0x44')]));_0x3730d4['attributes']=_0x3730d4[_0x923c('0x43')][_0x923c('0x45')]?_0x3730d4[_0x923c('0x43')]:_0x57775e[_0x923c('0x3d')];_0x3730d4[_0x923c('0x47')]=qs[_0x923c('0x48')](_0x269854[_0x923c('0x3f')][_0x923c('0x48')]);_0x3730d4[_0x923c('0x49')]=qs[_0x923c('0x41')](_[_0x923c('0x4a')](_0x269854['query'],_0x57775e[_0x923c('0x41')]));if(_0x269854['query']['filter']){_0x3730d4[_0x923c('0x49')]=_[_0x923c('0x4d')](_0x3730d4[_0x923c('0x49')],{'$or':_[_0x923c('0x3e')](_0x3730d4[_0x923c('0x43')],function(_0x1dfd7a){var _0x31d498={};_0x31d498[_0x1dfd7a]={'$like':'%'+_0x269854[_0x923c('0x3f')]['filter']+'%'};return _0x31d498;})});}_0x3730d4=_[_0x923c('0x4d')]({},_0x3730d4,_0x269854[_0x923c('0x52')]);return _0x1a5681['getConfigurations'](_0x3730d4);}})[_0x923c('0x1f')](function(_0x1a96fa){if(_0x1a96fa){_0x3622f1=_0x1a96fa['length'];if(!_0x269854[_0x923c('0x3f')]['hasOwnProperty'](_0x923c('0x59'))){_0x3730d4['limit']=qs['limit'](_0x269854[_0x923c('0x3f')][_0x923c('0x2d')]);_0x3730d4[_0x923c('0x2c')]=qs[_0x923c('0x2c')](_0x269854[_0x923c('0x3f')][_0x923c('0x2c')]);}return _0x1a5681[_0x923c('0x56')](_0x3730d4);}})[_0x923c('0x1f')](function(_0x500e65){if(_0x500e65){return _0x500e65?{'count':_0x3622f1,'rows':_0x500e65}:null;}})[_0x923c('0x1f')](respondWithResult(_0x40973d,null))[_0x923c('0x28')](handleError(_0x40973d,null));};exports[_0x923c('0x5a')]=function(_0x293868,_0x5cca8e,_0x5cdcb1){if(_0x293868[_0x923c('0x55')]['id']){delete _0x293868[_0x923c('0x55')]['id'];}return db[_0x923c('0x38')][_0x923c('0x57')]({'where':{'id':_0x293868[_0x923c('0x50')]['id']}})[_0x923c('0x1f')](handleEntityNotFound(_0x5cca8e,null))[_0x923c('0x1f')](function(_0x17199a){if(_0x17199a){_0x293868[_0x923c('0x55')][_0x923c('0x5b')]=_0x17199a['id'];_0x293868[_0x923c('0x55')]['Subjects']=integrations[_0x923c('0x5c')](_0x293868['body'][_0x923c('0x5d')],_0x293868[_0x923c('0x55')][_0x923c('0x3b')]);_0x293868['body'][_0x923c('0x5e')]=integrations[_0x923c('0x5f')](_0x293868['body'][_0x923c('0x5d')],_0x293868['body'][_0x923c('0x3b')]);return db[_0x923c('0x58')][_0x923c('0x54')](_0x293868[_0x923c('0x55')],{'include':[{'model':db[_0x923c('0x60')],'as':_0x923c('0x61')},{'model':db[_0x923c('0x60')],'as':_0x923c('0x5e')}]});}return null;})[_0x923c('0x1f')](respondWithResult(_0x5cca8e,null))[_0x923c('0x28')](handleError(_0x5cca8e,null));};exports[_0x923c('0x62')]=function(_0x4625f6,_0xa0fec6,_0x34b6d8){var _0x590373='';var _0x56e462=['id',_0x923c('0x35'),'assigned_user_id','created_by',_0x923c('0x63'),'date_start','duration_hours',_0x923c('0x64'),_0x923c('0x65'),_0x923c('0x66'),_0x923c('0x67'),_0x923c('0x68')];return db[_0x923c('0x38')]['findOne']({'where':{'id':_0x4625f6[_0x923c('0x50')]['id']},'attributes':['id','username',_0x923c('0x69'),_0x923c('0x6a')]})['then'](handleEntityNotFound(_0xa0fec6,null))[_0x923c('0x1f')](function(_0x51649b){if(_0x51649b){_0x590373=_0x51649b[_0x923c('0x6a')];var _0x2fe0c5=_0x590373[_0x923c('0x6b')](-0x1);if(_0x2fe0c5==='/'){_0x590373=_0x590373['substring'](0x0,_0x590373[_0x923c('0x6c')](_0x2fe0c5));}return rp({'method':_0x923c('0x6d'),'uri':util['format'](_0x923c('0x6e'),_0x590373,_0x923c('0x6f')),'json':!![],'form':{'method':_0x923c('0x70'),'input_type':'JSON','response_type':_0x923c('0x71'),'rest_data':JSON[_0x923c('0x72')]({'user_auth':{'user_name':_0x51649b['username'],'password':_0x51649b[_0x923c('0x69')],'encryption':_0x923c('0x73')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x923c('0x1f')](function(_0x5c1c81){if(_0x5c1c81&&_0x5c1c81['name']!=='Invalid\x20Login'&&_0x5c1c81[_0x923c('0x35')]!==_0x923c('0x74')){return rp({'method':'POST','uri':util[_0x923c('0x75')]('%s%s',_0x590373,_0x923c('0x6f')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x923c('0x71'),'response_type':_0x923c('0x71'),'rest_data':JSON[_0x923c('0x72')]({'session':_0x5c1c81['id'],'module_name':_0x923c('0x76')})}})[_0x923c('0x1f')](function(_0x185646){if(_0x185646){var _0x5bad4b=_['values'](_0x185646[_0x923c('0x77')]);_[_0x923c('0x78')](_0x5bad4b,function(_0xb8310){return _0x56e462[_0x923c('0x79')](_0xb8310[_0x923c('0x35')]);});return{'count':_0x5bad4b[_0x923c('0x45')],'rows':_[_0x923c('0x3e')](_0x5bad4b,function(_0xe20d33){return{'id':_0xe20d33[_0x923c('0x35')],'name':_0xe20d33[_0x923c('0x7a')],'custom':_[_0x923c('0x7b')](_0xe20d33['name'],'_c')?!![]:![],'options':_0xe20d33['options']?_[_0x923c('0x3e')](_['values'](_0xe20d33['options']),function(_0x294974){return{'name':_0x294974[_0x923c('0x7c')],'value':_0x294974['name']};}):[]};})};}})[_0x923c('0x1f')](respondWithResult(_0xa0fec6,null))[_0x923c('0x28')](function(_0x41a138){var _0x2a8e88=_0x4625f6['query']['test']?0x1f4:_0x41a138[_0x923c('0x7d')]||0x1f4;logger[_0x923c('0x24')](_0x923c('0x7e'),_0x923c('0x62'),_0x2a8e88,JSON[_0x923c('0x72')](_0x41a138));delete _0x41a138['name'];if(_0x2a8e88===0x191){_0x2a8e88=0x190;}_0xa0fec6[_0x923c('0x29')](_0x2a8e88)[_0x923c('0x36')](_0x4625f6[_0x923c('0x3f')][_0x923c('0x1a')]?{'message':_0x923c('0x7f'),'statusCode':_0x41a138[_0x923c('0x7d')]}:_0x41a138);});}else{var _0x3fe2e8=0x1f4;_0xa0fec6[_0x923c('0x29')](_0x3fe2e8)[_0x923c('0x36')]({'message':_0x923c('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xe1cf=['crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','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','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','Content-Range','apply','save','update','name','send','map','SugarcrmAccount','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','Descriptions','channel','SugarcrmConfiguration','SugarcrmField','Subjects','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','values','value','test','getFields','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel'];(function(_0xd723,_0x164010){var _0x5179d2=function(_0x43b1cb){while(--_0x43b1cb){_0xd723['push'](_0xd723['shift']());}};_0x5179d2(++_0x164010);}(_0xe1cf,0xed));var _0xfe1c=function(_0x266e7c,_0x36b3d1){_0x266e7c=_0x266e7c-0x0;var _0x529b4d=_0xe1cf[_0x266e7c];return _0x529b4d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfe1c('0x0'));var rimraf=require(_0xfe1c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe1c('0x2'));var rp=require(_0xfe1c('0x3'));var moment=require(_0xfe1c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfe1c('0x5'));var util=require('util');var path=require(_0xfe1c('0x6'));var sox=require(_0xfe1c('0x7'));var csv=require(_0xfe1c('0x8'));var ejs=require(_0xfe1c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfe1c('0xa'));var crypto=require(_0xfe1c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe1c('0x8'));var querystring=require(_0xfe1c('0xc'));var Papa=require(_0xfe1c('0xd'));var Redis=require(_0xfe1c('0xe'));var authService=require(_0xfe1c('0xf'));var qs=require(_0xfe1c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe1c('0x11'));var logger=require(_0xfe1c('0x12'))(_0xfe1c('0x13'));var utils=require(_0xfe1c('0x14'));var config=require(_0xfe1c('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xfe1c('0x16'));var client=jayson[_0xfe1c('0x17')][_0xfe1c('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4d7218,_0x1dc337,_0x654f25){if(_0x654f25){var _0x3100e5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3100e5['test'](_0x1dc337)){return _0x4d7218;}else{throw new db[(_0xfe1c('0x19'))]['ValidationError'](_0xfe1c('0x1a'));}}else{return _0x4d7218;}}function respondWithRpcPromise(_0xb9ca7,_0x1a205f,_0x3e98ba,_0x49861f){return new BPromise(function(_0x126885,_0x525bde){var _0x289333=_0x49861f||client;return _0x289333[_0xfe1c('0x1b')](_0xb9ca7,_0x3e98ba)[_0xfe1c('0x1c')](function(_0x2da0eb){logger[_0xfe1c('0x1d')](_0xfe1c('0x1e'),_0x1a205f,_0xfe1c('0x1f'));logger[_0xfe1c('0x20')](_0xfe1c('0x21'),_0x1a205f,'request\x20sent',JSON[_0xfe1c('0x22')](_0x2da0eb));if(_0x2da0eb[_0xfe1c('0x23')]){if(_0x2da0eb[_0xfe1c('0x23')][_0xfe1c('0x24')]===0x1f4){logger['error'](_0xfe1c('0x1e'),_0x1a205f,_0x2da0eb[_0xfe1c('0x23')][_0xfe1c('0x25')]);return _0x525bde(_0x2da0eb[_0xfe1c('0x23')][_0xfe1c('0x25')]);}logger[_0xfe1c('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x1a205f,_0x2da0eb[_0xfe1c('0x23')]['message']);return _0x126885(_0x2da0eb[_0xfe1c('0x23')][_0xfe1c('0x25')]);}else{logger[_0xfe1c('0x1d')](_0xfe1c('0x1e'),_0x1a205f,_0xfe1c('0x1f'));_0x126885(_0x2da0eb[_0xfe1c('0x26')][_0xfe1c('0x25')]);}})[_0xfe1c('0x27')](function(_0x1bceb4){logger[_0xfe1c('0x23')](_0xfe1c('0x1e'),_0x1a205f,_0x1bceb4);_0x525bde(_0x1bceb4);});});}function respondWithStatusCode(_0x529d90,_0x336c28){_0x336c28=_0x336c28||0xcc;return function(_0x55a803){if(_0x55a803){return _0x529d90['sendStatus'](_0x336c28);}return _0x529d90[_0xfe1c('0x28')](_0x336c28)[_0xfe1c('0x29')]();};}function respondWithResult(_0x2cbd31,_0x58b503){_0x58b503=_0x58b503||0xc8;return function(_0x4381d3){if(_0x4381d3){return _0x2cbd31['status'](_0x58b503)[_0xfe1c('0x2a')](_0x4381d3);}};}function respondWithFilteredResult(_0x310f8b,_0x32cc8a){return function(_0x160965){if(_0x160965){var _0x559a2e=_0x160965[_0xfe1c('0x2b')],_0x3408df=_0x32cc8a[_0xfe1c('0x2c')],_0x1f51f4=_0x32cc8a[_0xfe1c('0x2c')]+_0x32cc8a['limit'],_0x4837d4;if(_0x1f51f4>=_0x559a2e){_0x1f51f4=_0x559a2e;_0x4837d4=0xc8;}else{_0x4837d4=0xce;}_0x310f8b[_0xfe1c('0x28')](_0x4837d4);return _0x310f8b['set'](_0xfe1c('0x2d'),_0x3408df+'-'+_0x1f51f4+'/'+_0x559a2e)[_0xfe1c('0x2a')](_0x160965);}return null;};}function patchUpdates(_0x432011){return function(_0x598154){try{jsonpatch[_0xfe1c('0x2e')](_0x598154,_0x432011,!![]);}catch(_0x20b45a){return BPromise['reject'](_0x20b45a);}return _0x598154[_0xfe1c('0x2f')]();};}function saveUpdates(_0x4df946,_0x253ea3){return function(_0x15fd30){if(_0x15fd30){return _0x15fd30[_0xfe1c('0x30')](_0x4df946)['then'](function(_0x4bc6e0){return _0x4bc6e0;});}return null;};}function removeEntity(_0x25b683,_0x34a150){return function(_0x40a2a5){if(_0x40a2a5){return _0x40a2a5['destroy']()[_0xfe1c('0x1c')](function(){_0x25b683[_0xfe1c('0x28')](0xcc)[_0xfe1c('0x29')]();});}};}function handleEntityNotFound(_0x281c7e,_0x1e5383){return function(_0x31738e){if(!_0x31738e){_0x281c7e['sendStatus'](0x194);}return _0x31738e;};}function handleError(_0x2f5a9f,_0x5eb5a9){_0x5eb5a9=_0x5eb5a9||0x1f4;return function(_0xc8a7db){logger['error'](_0xc8a7db['stack']);if(_0xc8a7db[_0xfe1c('0x31')]){delete _0xc8a7db['name'];}_0x2f5a9f['status'](_0x5eb5a9)[_0xfe1c('0x32')](_0xc8a7db);};}exports['index']=function(_0x52d1b0,_0x1f084e){var _0x8d03c2={},_0x50c5c2={},_0x521ade={'count':0x0,'rows':[]};var _0x552ed6=_[_0xfe1c('0x33')](db[_0xfe1c('0x34')]['rawAttributes'],function(_0x1c45b0){return{'name':_0x1c45b0[_0xfe1c('0x35')],'type':_0x1c45b0['type']['key']};});_0x50c5c2[_0xfe1c('0x36')]=_[_0xfe1c('0x33')](_0x552ed6,'name');_0x50c5c2[_0xfe1c('0x37')]=_[_0xfe1c('0x38')](_0x52d1b0['query']);_0x50c5c2[_0xfe1c('0x39')]=_[_0xfe1c('0x3a')](_0x50c5c2[_0xfe1c('0x36')],_0x50c5c2['query']);_0x8d03c2[_0xfe1c('0x3b')]=_[_0xfe1c('0x3a')](_0x50c5c2[_0xfe1c('0x36')],qs[_0xfe1c('0x3c')](_0x52d1b0[_0xfe1c('0x37')][_0xfe1c('0x3c')]));_0x8d03c2['attributes']=_0x8d03c2[_0xfe1c('0x3b')][_0xfe1c('0x3d')]?_0x8d03c2[_0xfe1c('0x3b')]:_0x50c5c2[_0xfe1c('0x36')];if(!_0x52d1b0[_0xfe1c('0x37')][_0xfe1c('0x3e')](_0xfe1c('0x3f'))){_0x8d03c2[_0xfe1c('0x40')]=qs[_0xfe1c('0x40')](_0x52d1b0[_0xfe1c('0x37')][_0xfe1c('0x40')]);_0x8d03c2['offset']=qs[_0xfe1c('0x2c')](_0x52d1b0[_0xfe1c('0x37')][_0xfe1c('0x2c')]);}_0x8d03c2[_0xfe1c('0x41')]=qs[_0xfe1c('0x42')](_0x52d1b0[_0xfe1c('0x37')][_0xfe1c('0x42')]);_0x8d03c2[_0xfe1c('0x43')]=qs[_0xfe1c('0x39')](_[_0xfe1c('0x44')](_0x52d1b0[_0xfe1c('0x37')],_0x50c5c2[_0xfe1c('0x39')]),_0x552ed6);if(_0x52d1b0['query']['filter']){_0x8d03c2[_0xfe1c('0x43')]=_[_0xfe1c('0x45')](_0x8d03c2[_0xfe1c('0x43')],{'$or':_[_0xfe1c('0x33')](_0x552ed6,function(_0x50b179){if(_0x50b179[_0xfe1c('0x46')]!==_0xfe1c('0x47')){var _0x4a990c={};_0x4a990c[_0x50b179['name']]={'$like':'%'+_0x52d1b0[_0xfe1c('0x37')][_0xfe1c('0x48')]+'%'};return _0x4a990c;}})});}_0x8d03c2=_[_0xfe1c('0x45')]({},_0x8d03c2,_0x52d1b0[_0xfe1c('0x49')]);var _0x2a160b={'where':_0x8d03c2[_0xfe1c('0x43')]};return db['SugarcrmAccount'][_0xfe1c('0x2b')](_0x2a160b)['then'](function(_0x579252){_0x521ade['count']=_0x579252;if(_0x52d1b0[_0xfe1c('0x37')][_0xfe1c('0x4a')]){_0x8d03c2[_0xfe1c('0x4b')]=[{'all':!![]}];}return db[_0xfe1c('0x34')][_0xfe1c('0x4c')](_0x8d03c2);})[_0xfe1c('0x1c')](function(_0xcef318){_0x521ade[_0xfe1c('0x4d')]=_0xcef318;return _0x521ade;})[_0xfe1c('0x1c')](respondWithFilteredResult(_0x1f084e,_0x8d03c2))[_0xfe1c('0x27')](handleError(_0x1f084e,null));};exports['show']=function(_0x432d6f,_0x11f8e0){var _0x10f072={'raw':![],'where':{'id':_0x432d6f[_0xfe1c('0x4e')]['id']}},_0x57e225={};_0x57e225[_0xfe1c('0x36')]=_[_0xfe1c('0x38')](db[_0xfe1c('0x34')][_0xfe1c('0x4f')]);_0x57e225[_0xfe1c('0x37')]=_[_0xfe1c('0x38')](_0x432d6f['query']);_0x57e225[_0xfe1c('0x39')]=_[_0xfe1c('0x3a')](_0x57e225['model'],_0x57e225['query']);_0x10f072[_0xfe1c('0x3b')]=_['intersection'](_0x57e225[_0xfe1c('0x36')],qs[_0xfe1c('0x3c')](_0x432d6f[_0xfe1c('0x37')]['fields']));_0x10f072[_0xfe1c('0x3b')]=_0x10f072['attributes'][_0xfe1c('0x3d')]?_0x10f072[_0xfe1c('0x3b')]:_0x57e225['model'];if(_0x432d6f[_0xfe1c('0x37')][_0xfe1c('0x4a')]){_0x10f072[_0xfe1c('0x4b')]=[{'all':!![]}];}_0x10f072=_['merge']({},_0x10f072,_0x432d6f[_0xfe1c('0x49')]);return db[_0xfe1c('0x34')][_0xfe1c('0x50')](_0x10f072)[_0xfe1c('0x1c')](handleEntityNotFound(_0x11f8e0,null))[_0xfe1c('0x1c')](respondWithResult(_0x11f8e0,null))[_0xfe1c('0x27')](handleError(_0x11f8e0,null));};exports[_0xfe1c('0x51')]=function(_0x5638ff,_0x25fc65){return db[_0xfe1c('0x34')][_0xfe1c('0x51')](_0x5638ff[_0xfe1c('0x52')],{})['then'](respondWithResult(_0x25fc65,0xc9))[_0xfe1c('0x27')](handleError(_0x25fc65,null));};exports[_0xfe1c('0x30')]=function(_0x183a98,_0x50c50d){if(_0x183a98['body']['id']){delete _0x183a98[_0xfe1c('0x52')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x183a98['params']['id']}})['then'](handleEntityNotFound(_0x50c50d,null))['then'](saveUpdates(_0x183a98[_0xfe1c('0x52')],null))[_0xfe1c('0x1c')](respondWithResult(_0x50c50d,null))['catch'](handleError(_0x50c50d,null));};exports[_0xfe1c('0x53')]=function(_0xc8694c,_0x30e9ad){return db[_0xfe1c('0x34')]['find']({'where':{'id':_0xc8694c[_0xfe1c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x30e9ad,null))['then'](removeEntity(_0x30e9ad,null))[_0xfe1c('0x27')](handleError(_0x30e9ad,null));};exports[_0xfe1c('0x54')]=function(_0x17b87e,_0x1feb0e,_0x413586){var _0xed2d35={};var _0x40f6e4={};var _0x4077b2;var _0xd9866c;return db[_0xfe1c('0x34')][_0xfe1c('0x55')]({'where':{'id':_0x17b87e['params']['id']}})[_0xfe1c('0x1c')](handleEntityNotFound(_0x1feb0e,null))['then'](function(_0x2961a8){if(_0x2961a8){_0x4077b2=_0x2961a8;_0x40f6e4[_0xfe1c('0x36')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x40f6e4['query']=_[_0xfe1c('0x38')](_0x17b87e[_0xfe1c('0x37')]);_0x40f6e4['filters']=_[_0xfe1c('0x3a')](_0x40f6e4[_0xfe1c('0x36')],_0x40f6e4[_0xfe1c('0x37')]);_0xed2d35[_0xfe1c('0x3b')]=_[_0xfe1c('0x3a')](_0x40f6e4[_0xfe1c('0x36')],qs['fields'](_0x17b87e[_0xfe1c('0x37')][_0xfe1c('0x3c')]));_0xed2d35[_0xfe1c('0x3b')]=_0xed2d35['attributes'][_0xfe1c('0x3d')]?_0xed2d35['attributes']:_0x40f6e4['model'];_0xed2d35['order']=qs[_0xfe1c('0x42')](_0x17b87e['query'][_0xfe1c('0x42')]);_0xed2d35['where']=qs[_0xfe1c('0x39')](_[_0xfe1c('0x44')](_0x17b87e[_0xfe1c('0x37')],_0x40f6e4['filters']));if(_0x17b87e['query']['filter']){_0xed2d35[_0xfe1c('0x43')]=_[_0xfe1c('0x45')](_0xed2d35[_0xfe1c('0x43')],{'$or':_[_0xfe1c('0x33')](_0xed2d35['attributes'],function(_0x53f46e){var _0x4b6ec2={};_0x4b6ec2[_0x53f46e]={'$like':'%'+_0x17b87e[_0xfe1c('0x37')][_0xfe1c('0x48')]+'%'};return _0x4b6ec2;})});}_0xed2d35=_[_0xfe1c('0x45')]({},_0xed2d35,_0x17b87e['options']);return _0x4077b2[_0xfe1c('0x54')](_0xed2d35);}})[_0xfe1c('0x1c')](function(_0x5acf7b){if(_0x5acf7b){_0xd9866c=_0x5acf7b[_0xfe1c('0x3d')];if(!_0x17b87e[_0xfe1c('0x37')][_0xfe1c('0x3e')](_0xfe1c('0x3f'))){_0xed2d35[_0xfe1c('0x40')]=qs[_0xfe1c('0x40')](_0x17b87e['query'][_0xfe1c('0x40')]);_0xed2d35[_0xfe1c('0x2c')]=qs[_0xfe1c('0x2c')](_0x17b87e[_0xfe1c('0x37')]['offset']);}return _0x4077b2[_0xfe1c('0x54')](_0xed2d35);}})['then'](function(_0x23ac33){if(_0x23ac33){return _0x23ac33?{'count':_0xd9866c,'rows':_0x23ac33}:null;}})['then'](respondWithResult(_0x1feb0e,null))[_0xfe1c('0x27')](handleError(_0x1feb0e,null));};exports['addConfiguration']=function(_0x5544b7,_0x4cf0ed,_0x398c1e){if(_0x5544b7[_0xfe1c('0x52')]['id']){delete _0x5544b7[_0xfe1c('0x52')]['id'];}return db['SugarcrmAccount'][_0xfe1c('0x55')]({'where':{'id':_0x5544b7['params']['id']}})[_0xfe1c('0x1c')](handleEntityNotFound(_0x4cf0ed,null))[_0xfe1c('0x1c')](function(_0x2d76f5){if(_0x2d76f5){_0x5544b7[_0xfe1c('0x52')]['AccountId']=_0x2d76f5['id'];_0x5544b7[_0xfe1c('0x52')]['Subjects']=integrations['getSubjects'](_0x5544b7[_0xfe1c('0x52')]['channel'],_0x5544b7['body'][_0xfe1c('0x46')]);_0x5544b7[_0xfe1c('0x52')][_0xfe1c('0x56')]=integrations['getDescriptions'](_0x5544b7[_0xfe1c('0x52')][_0xfe1c('0x57')],_0x5544b7['body'][_0xfe1c('0x46')]);return db[_0xfe1c('0x58')][_0xfe1c('0x51')](_0x5544b7[_0xfe1c('0x52')],{'include':[{'model':db[_0xfe1c('0x59')],'as':_0xfe1c('0x5a')},{'model':db[_0xfe1c('0x59')],'as':_0xfe1c('0x56')}]});}return null;})[_0xfe1c('0x1c')](respondWithResult(_0x4cf0ed,null))[_0xfe1c('0x27')](handleError(_0x4cf0ed,null));};exports['getFields']=function(_0x533abc,_0x4bb2cc,_0x110c54){var _0x17bc97='';var _0x377851=['id','name',_0xfe1c('0x5b'),_0xfe1c('0x5c'),'description',_0xfe1c('0x5d'),_0xfe1c('0x5e'),_0xfe1c('0x5f'),'parent_id',_0xfe1c('0x60'),_0xfe1c('0x61'),_0xfe1c('0x62')];return db[_0xfe1c('0x34')]['findOne']({'where':{'id':_0x533abc['params']['id']},'attributes':['id',_0xfe1c('0x63'),_0xfe1c('0x64'),_0xfe1c('0x65')]})['then'](handleEntityNotFound(_0x4bb2cc,null))[_0xfe1c('0x1c')](function(_0xcfce14){if(_0xcfce14){_0x17bc97=_0xcfce14[_0xfe1c('0x65')];var _0x24b99a=_0x17bc97[_0xfe1c('0x66')](-0x1);if(_0x24b99a==='/'){_0x17bc97=_0x17bc97[_0xfe1c('0x67')](0x0,_0x17bc97[_0xfe1c('0x68')](_0x24b99a));}return rp({'method':_0xfe1c('0x69'),'uri':util[_0xfe1c('0x6a')](_0xfe1c('0x6b'),_0x17bc97,_0xfe1c('0x6c')),'json':!![],'form':{'method':'login','input_type':_0xfe1c('0x6d'),'response_type':_0xfe1c('0x6d'),'rest_data':JSON[_0xfe1c('0x22')]({'user_auth':{'user_name':_0xcfce14[_0xfe1c('0x63')],'password':_0xcfce14[_0xfe1c('0x64')],'encryption':_0xfe1c('0x6e')},'application':_0xfe1c('0x6f')})}});}})[_0xfe1c('0x1c')](function(_0x312b43){if(_0x312b43&&_0x312b43[_0xfe1c('0x31')]!==_0xfe1c('0x70')&&_0x312b43[_0xfe1c('0x31')]!==_0xfe1c('0x71')){return rp({'method':_0xfe1c('0x69'),'uri':util[_0xfe1c('0x6a')](_0xfe1c('0x6b'),_0x17bc97,_0xfe1c('0x6c')),'json':!![],'form':{'method':_0xfe1c('0x72'),'input_type':_0xfe1c('0x6d'),'response_type':'JSON','rest_data':JSON[_0xfe1c('0x22')]({'session':_0x312b43['id'],'module_name':_0xfe1c('0x73')})}})[_0xfe1c('0x1c')](function(_0x502cd0){if(_0x502cd0){var _0x5be018=_['values'](_0x502cd0[_0xfe1c('0x74')]);_[_0xfe1c('0x75')](_0x5be018,function(_0x2e6143){return _0x377851['includes'](_0x2e6143[_0xfe1c('0x31')]);});return{'count':_0x5be018[_0xfe1c('0x3d')],'rows':_['map'](_0x5be018,function(_0x4fd3a1){return{'id':_0x4fd3a1[_0xfe1c('0x31')],'name':_0x4fd3a1['label'],'custom':_['endsWith'](_0x4fd3a1[_0xfe1c('0x31')],'_c')?!![]:![],'options':_0x4fd3a1[_0xfe1c('0x49')]?_[_0xfe1c('0x33')](_[_0xfe1c('0x76')](_0x4fd3a1[_0xfe1c('0x49')]),function(_0x11166f){return{'name':_0x11166f[_0xfe1c('0x77')],'value':_0x11166f['name']};}):[]};})};}})[_0xfe1c('0x1c')](respondWithResult(_0x4bb2cc,null))[_0xfe1c('0x27')](function(_0x453d8a){var _0x1b76f5=_0x533abc['query'][_0xfe1c('0x78')]?0x1f4:_0x453d8a['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xfe1c('0x79'),_0x1b76f5,JSON[_0xfe1c('0x22')](_0x453d8a));delete _0x453d8a[_0xfe1c('0x31')];if(_0x1b76f5===0x191){_0x1b76f5=0x190;}_0x4bb2cc[_0xfe1c('0x28')](_0x1b76f5)[_0xfe1c('0x32')](_0x533abc[_0xfe1c('0x37')][_0xfe1c('0x78')]?{'message':_0xfe1c('0x7a'),'statusCode':_0x453d8a[_0xfe1c('0x7b')]}:_0x453d8a);});}else{var _0x31c6d9=0x1f4;_0x4bb2cc['status'](_0x31c6d9)[_0xfe1c('0x32')]({'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 8cf35f4..1707665 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 _0x8e1d=['moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x8e1d,0x190));var _0xd8e1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8e1d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xd8e1('0x0'));var util=require('util');var logger=require(_0xd8e1('0x1'))(_0xd8e1('0x2'));var moment=require(_0xd8e1('0x3'));var BPromise=require(_0xd8e1('0x4'));var rp=require(_0xd8e1('0x5'));var fs=require('fs');var path=require(_0xd8e1('0x6'));var rimraf=require('rimraf');var config=require(_0xd8e1('0x7'));var attributes=require(_0xd8e1('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd8e1('0x9')]=function(_0x3d68be,_0x728129){return _0x3d68be[_0xd8e1('0xa')](_0xd8e1('0xb'),attributes,{'tableName':_0xd8e1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x942a=['util','../../config/logger','api','moment','bluebird','rimraf','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x40ed25,_0x361e53){var _0x29cca0=function(_0x239ab6){while(--_0x239ab6){_0x40ed25['push'](_0x40ed25['shift']());}};_0x29cca0(++_0x361e53);}(_0x942a,0x196));var _0xa942=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x942a[_0xe4bb3d];return _0xd9e51;};'use strict';var _=require(_0xa942('0x0'));var util=require(_0xa942('0x1'));var logger=require(_0xa942('0x2'))(_0xa942('0x3'));var moment=require(_0xa942('0x4'));var BPromise=require(_0xa942('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa942('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xa942('0x7'));module[_0xa942('0x8')]=function(_0x3bc36b,_0x3a727c){return _0x3bc36b['define'](_0xa942('0x9'),attributes,{'tableName':_0xa942('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 29bc17d..add9110 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 _0x6142=['info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','raw','options','where','limit','include','map','model','attributes','ShowSugarcrmAccount','SugarcrmAccount','find','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3c4f93,_0x24be5c){var _0x56d097=function(_0x30ad6e){while(--_0x30ad6e){_0x3c4f93['push'](_0x3c4f93['shift']());}};_0x56d097(++_0x24be5c);}(_0x6142,0xa3));var _0x2614=function(_0x2c1bbe,_0x5c4e40){_0x2c1bbe=_0x2c1bbe-0x0;var _0x46315a=_0x6142[_0x2c1bbe];return _0x46315a;};'use strict';var _=require('lodash');var util=require(_0x2614('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2614('0x1'));var fs=require('fs');var Redis=require(_0x2614('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2614('0x3'));var logger=require(_0x2614('0x4'))(_0x2614('0x5'));var config=require(_0x2614('0x6'));var jayson=require(_0x2614('0x7'));var client=jayson[_0x2614('0x8')][_0x2614('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11ac0f,_0x2cc177,_0x142668){return new BPromise(function(_0x237fb3,_0x46037b){return client[_0x2614('0xa')](_0x11ac0f,_0x142668)[_0x2614('0xb')](function(_0x144d40){logger[_0x2614('0xc')](_0x2614('0xd'),_0x2cc177,_0x2614('0xe'));logger[_0x2614('0xf')](_0x2614('0x10'),_0x2cc177,_0x2614('0xe'),JSON[_0x2614('0x11')](_0x144d40));if(_0x144d40[_0x2614('0x12')]){if(_0x144d40[_0x2614('0x12')][_0x2614('0x13')]===0x1f4){logger[_0x2614('0x12')](_0x2614('0xd'),_0x2cc177,_0x144d40[_0x2614('0x12')][_0x2614('0x14')]);return _0x46037b(_0x144d40[_0x2614('0x12')][_0x2614('0x14')]);}logger[_0x2614('0x12')](_0x2614('0xd'),_0x2cc177,_0x144d40[_0x2614('0x12')][_0x2614('0x14')]);return _0x237fb3(_0x144d40[_0x2614('0x12')][_0x2614('0x14')]);}else{logger['info'](_0x2614('0xd'),_0x2cc177,_0x2614('0xe'));_0x237fb3(_0x144d40[_0x2614('0x15')][_0x2614('0x14')]);}})['catch'](function(_0x33d6ce){logger[_0x2614('0x12')](_0x2614('0xd'),_0x2cc177,_0x33d6ce);_0x46037b(_0x33d6ce);});});}exports[_0x2614('0x16')]=function(_0x4a4cb0){var _0x6857a2=this;return new Promise(function(_0x341e34,_0x453ab2){return db['SugarcrmAccount']['findAll']({'raw':_0x4a4cb0['options']?_0x4a4cb0['options'][_0x2614('0x17')]===undefined?!![]:![]:!![],'where':_0x4a4cb0[_0x2614('0x18')]?_0x4a4cb0[_0x2614('0x18')][_0x2614('0x19')]||null:null,'attributes':_0x4a4cb0['options']?_0x4a4cb0[_0x2614('0x18')]['attributes']||null:null,'limit':_0x4a4cb0['options']?_0x4a4cb0[_0x2614('0x18')][_0x2614('0x1a')]||null:null,'include':_0x4a4cb0[_0x2614('0x18')]?_0x4a4cb0[_0x2614('0x18')][_0x2614('0x1b')]?_[_0x2614('0x1c')](_0x4a4cb0[_0x2614('0x18')][_0x2614('0x1b')],function(_0x3a81db){return{'model':db[_0x3a81db[_0x2614('0x1d')]],'as':_0x3a81db['as'],'attributes':_0x3a81db[_0x2614('0x1e')],'include':_0x3a81db['include']?_['map'](_0x3a81db['include'],function(_0x259e76){return{'model':db[_0x259e76[_0x2614('0x1d')]],'as':_0x259e76['as'],'attributes':_0x259e76[_0x2614('0x1e')],'include':_0x259e76['include']?_[_0x2614('0x1c')](_0x259e76['include'],function(_0x36d95f){return{'model':db[_0x36d95f[_0x2614('0x1d')]],'as':_0x36d95f['as'],'attributes':_0x36d95f[_0x2614('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2614('0xb')](function(_0x17c5f8){logger[_0x2614('0xc')]('GetSugarcrmAccount',_0x4a4cb0);logger[_0x2614('0xf')](_0x2614('0x16'),_0x4a4cb0,JSON[_0x2614('0x11')](_0x17c5f8));_0x341e34(_0x17c5f8);})['catch'](function(_0x1a664d){logger[_0x2614('0x12')](_0x2614('0x16'),_0x1a664d[_0x2614('0x14')],_0x4a4cb0);_0x453ab2(_0x6857a2[_0x2614('0x12')](0x1f4,_0x1a664d[_0x2614('0x14')]));});});};exports[_0x2614('0x1f')]=function(_0x244ef1){var _0x3aeeee=this;return new Promise(function(_0x4e93c8,_0x216617){return db[_0x2614('0x20')][_0x2614('0x21')]({'raw':_0x244ef1['options']?_0x244ef1[_0x2614('0x18')][_0x2614('0x17')]===undefined?!![]:![]:!![],'where':_0x244ef1['options']?_0x244ef1[_0x2614('0x18')]['where']||null:null,'attributes':_0x244ef1[_0x2614('0x18')]?_0x244ef1[_0x2614('0x18')][_0x2614('0x1e')]||null:null,'include':_0x244ef1[_0x2614('0x18')]?_0x244ef1['options'][_0x2614('0x1b')]?_['map'](_0x244ef1[_0x2614('0x18')]['include'],function(_0x540a56){return{'model':db[_0x540a56[_0x2614('0x1d')]],'as':_0x540a56['as'],'attributes':_0x540a56[_0x2614('0x1e')],'include':_0x540a56[_0x2614('0x1b')]?_[_0x2614('0x1c')](_0x540a56['include'],function(_0x159aff){return{'model':db[_0x159aff['model']],'as':_0x159aff['as'],'attributes':_0x159aff[_0x2614('0x1e')],'include':_0x159aff[_0x2614('0x1b')]?_[_0x2614('0x1c')](_0x159aff[_0x2614('0x1b')],function(_0x2319cf){return{'model':db[_0x2319cf[_0x2614('0x1d')]],'as':_0x2319cf['as'],'attributes':_0x2319cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x2614('0xb')](function(_0xf8e167){logger[_0x2614('0xc')](_0x2614('0x1f'),_0x244ef1);logger[_0x2614('0xf')](_0x2614('0x1f'),_0x244ef1,JSON['stringify'](_0xf8e167));_0x4e93c8(_0xf8e167);})[_0x2614('0x22')](function(_0xd01972){logger[_0x2614('0x12')]('ShowSugarcrmAccount',_0xd01972['message'],_0x244ef1);_0x216617(_0x3aeeee[_0x2614('0x12')](0x1f4,_0xd01972[_0x2614('0x14')]));});});}; \ No newline at end of file +var _0x9a78=['raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x546fa4,_0x5dbb18){var _0x25867e=function(_0x2097c9){while(--_0x2097c9){_0x546fa4['push'](_0x546fa4['shift']());}};_0x25867e(++_0x5dbb18);}(_0x9a78,0x171));var _0x89a7=function(_0x1f4be8,_0x59fc4a){_0x1f4be8=_0x1f4be8-0x0;var _0x25a41d=_0x9a78[_0x1f4be8];return _0x25a41d;};'use strict';var _=require(_0x89a7('0x0'));var util=require(_0x89a7('0x1'));var moment=require(_0x89a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x89a7('0x3'));var fs=require('fs');var Redis=require(_0x89a7('0x4'));var db=require(_0x89a7('0x5'))['db'];var utils=require(_0x89a7('0x6'));var logger=require(_0x89a7('0x7'))(_0x89a7('0x8'));var config=require('../../config/environment');var jayson=require(_0x89a7('0x9'));var client=jayson['client'][_0x89a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x326512,_0x331c9b,_0x3a3750){return new BPromise(function(_0x8cd69f,_0x38e60e){return client['request'](_0x326512,_0x3a3750)[_0x89a7('0xb')](function(_0x14ccee){logger[_0x89a7('0xc')](_0x89a7('0xd'),_0x331c9b,'request\x20sent');logger[_0x89a7('0xe')](_0x89a7('0xf'),_0x331c9b,_0x89a7('0x10'),JSON[_0x89a7('0x11')](_0x14ccee));if(_0x14ccee[_0x89a7('0x12')]){if(_0x14ccee[_0x89a7('0x12')][_0x89a7('0x13')]===0x1f4){logger[_0x89a7('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x331c9b,_0x14ccee[_0x89a7('0x12')]['message']);return _0x38e60e(_0x14ccee[_0x89a7('0x12')][_0x89a7('0x14')]);}logger[_0x89a7('0x12')](_0x89a7('0xd'),_0x331c9b,_0x14ccee[_0x89a7('0x12')][_0x89a7('0x14')]);return _0x8cd69f(_0x14ccee['error'][_0x89a7('0x14')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x331c9b,_0x89a7('0x10'));_0x8cd69f(_0x14ccee[_0x89a7('0x15')]['message']);}})[_0x89a7('0x16')](function(_0x5cdf8e){logger[_0x89a7('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x331c9b,_0x5cdf8e);_0x38e60e(_0x5cdf8e);});});}exports[_0x89a7('0x17')]=function(_0x2f5405){var _0x410fab=this;return new Promise(function(_0x17b3cb,_0x4c1fe0){return db[_0x89a7('0x18')][_0x89a7('0x19')]({'raw':_0x2f5405[_0x89a7('0x1a')]?_0x2f5405[_0x89a7('0x1a')][_0x89a7('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f5405[_0x89a7('0x1a')]?_0x2f5405[_0x89a7('0x1a')][_0x89a7('0x1c')]||null:null,'attributes':_0x2f5405[_0x89a7('0x1a')]?_0x2f5405[_0x89a7('0x1a')][_0x89a7('0x1d')]||null:null,'limit':_0x2f5405[_0x89a7('0x1a')]?_0x2f5405['options'][_0x89a7('0x1e')]||null:null,'include':_0x2f5405[_0x89a7('0x1a')]?_0x2f5405['options'][_0x89a7('0x1f')]?_[_0x89a7('0x20')](_0x2f5405[_0x89a7('0x1a')][_0x89a7('0x1f')],function(_0x3295bc){return{'model':db[_0x3295bc[_0x89a7('0x21')]],'as':_0x3295bc['as'],'attributes':_0x3295bc[_0x89a7('0x1d')],'include':_0x3295bc['include']?_[_0x89a7('0x20')](_0x3295bc['include'],function(_0x3b3dba){return{'model':db[_0x3b3dba['model']],'as':_0x3b3dba['as'],'attributes':_0x3b3dba['attributes'],'include':_0x3b3dba[_0x89a7('0x1f')]?_['map'](_0x3b3dba[_0x89a7('0x1f')],function(_0x5081f9){return{'model':db[_0x5081f9['model']],'as':_0x5081f9['as'],'attributes':_0x5081f9[_0x89a7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x89a7('0xb')](function(_0x233c7a){logger['info'](_0x89a7('0x17'),_0x2f5405);logger['debug'](_0x89a7('0x17'),_0x2f5405,JSON['stringify'](_0x233c7a));_0x17b3cb(_0x233c7a);})[_0x89a7('0x16')](function(_0x30817b){logger[_0x89a7('0x12')](_0x89a7('0x17'),_0x30817b[_0x89a7('0x14')],_0x2f5405);_0x4c1fe0(_0x410fab['error'](0x1f4,_0x30817b[_0x89a7('0x14')]));});});};exports[_0x89a7('0x22')]=function(_0x7f8f2f){var _0x3aa299=this;return new Promise(function(_0x41e313,_0x16fed2){return db[_0x89a7('0x18')][_0x89a7('0x23')]({'raw':_0x7f8f2f['options']?_0x7f8f2f[_0x89a7('0x1a')][_0x89a7('0x1b')]===undefined?!![]:![]:!![],'where':_0x7f8f2f[_0x89a7('0x1a')]?_0x7f8f2f[_0x89a7('0x1a')]['where']||null:null,'attributes':_0x7f8f2f[_0x89a7('0x1a')]?_0x7f8f2f[_0x89a7('0x1a')][_0x89a7('0x1d')]||null:null,'include':_0x7f8f2f[_0x89a7('0x1a')]?_0x7f8f2f[_0x89a7('0x1a')]['include']?_[_0x89a7('0x20')](_0x7f8f2f['options']['include'],function(_0x3dd95c){return{'model':db[_0x3dd95c[_0x89a7('0x21')]],'as':_0x3dd95c['as'],'attributes':_0x3dd95c[_0x89a7('0x1d')],'include':_0x3dd95c[_0x89a7('0x1f')]?_[_0x89a7('0x20')](_0x3dd95c[_0x89a7('0x1f')],function(_0x35e3e1){return{'model':db[_0x35e3e1[_0x89a7('0x21')]],'as':_0x35e3e1['as'],'attributes':_0x35e3e1[_0x89a7('0x1d')],'include':_0x35e3e1['include']?_[_0x89a7('0x20')](_0x35e3e1['include'],function(_0x4beccf){return{'model':db[_0x4beccf[_0x89a7('0x21')]],'as':_0x4beccf['as'],'attributes':_0x4beccf['attributes']};}):[]};}):[]};}):[]:[]})[_0x89a7('0xb')](function(_0x8bd448){logger[_0x89a7('0xc')]('ShowSugarcrmAccount',_0x7f8f2f);logger[_0x89a7('0xe')](_0x89a7('0x22'),_0x7f8f2f,JSON['stringify'](_0x8bd448));_0x41e313(_0x8bd448);})[_0x89a7('0x16')](function(_0x2475bf){logger['error'](_0x89a7('0x22'),_0x2475bf['message'],_0x7f8f2f);_0x16fed2(_0x3aa299['error'](0x1f4,_0x2475bf['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 76c5feb..6572258 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 _0x8d84=['show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x178b60,_0x6e6a09){var _0x3312d8=function(_0x153a0a){while(--_0x153a0a){_0x178b60['push'](_0x178b60['shift']());}};_0x3312d8(++_0x6e6a09);}(_0x8d84,0x16b));var _0x48d8=function(_0x32c80c,_0x4e2212){_0x32c80c=_0x32c80c-0x0;var _0x39804d=_0x8d84[_0x32c80c];return _0x39804d;};'use strict';var multer=require(_0x48d8('0x0'));var util=require(_0x48d8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x48d8('0x2'));var router=express['Router']();var auth=require(_0x48d8('0x3'));var interaction=require(_0x48d8('0x4'));var config=require(_0x48d8('0x5'));var controller=require(_0x48d8('0x6'));router[_0x48d8('0x7')]('/',auth[_0x48d8('0x8')](),controller[_0x48d8('0x9')]);router[_0x48d8('0x7')](_0x48d8('0xa'),auth[_0x48d8('0x8')](),controller[_0x48d8('0xb')]);router['get'](_0x48d8('0xc'),auth[_0x48d8('0x8')](),controller['getFields']);router[_0x48d8('0x7')](_0x48d8('0xd'),auth[_0x48d8('0x8')](),controller[_0x48d8('0xe')]);router[_0x48d8('0x7')](_0x48d8('0xf'),auth[_0x48d8('0x8')](),controller[_0x48d8('0x10')]);router['post']('/',auth[_0x48d8('0x8')](),controller[_0x48d8('0x11')]);router[_0x48d8('0x12')](_0x48d8('0xa'),auth['isAuthenticated'](),controller[_0x48d8('0x13')]);router[_0x48d8('0x14')]('/:id',auth[_0x48d8('0x8')](),controller[_0x48d8('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbbd1=['getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xbbd1,0x14d));var _0x1bbd=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0xbbd1[_0x45f111];return _0x483508;};'use strict';var multer=require(_0x1bbd('0x0'));var util=require(_0x1bbd('0x1'));var path=require(_0x1bbd('0x2'));var timeout=require(_0x1bbd('0x3'));var express=require(_0x1bbd('0x4'));var router=express[_0x1bbd('0x5')]();var auth=require(_0x1bbd('0x6'));var interaction=require(_0x1bbd('0x7'));var config=require(_0x1bbd('0x8'));var controller=require(_0x1bbd('0x9'));router[_0x1bbd('0xa')]('/',auth['isAuthenticated'](),controller[_0x1bbd('0xb')]);router[_0x1bbd('0xa')](_0x1bbd('0xc'),auth[_0x1bbd('0xd')](),controller[_0x1bbd('0xe')]);router['get'](_0x1bbd('0xf'),auth['isAuthenticated'](),controller[_0x1bbd('0x10')]);router[_0x1bbd('0xa')](_0x1bbd('0x11'),auth['isAuthenticated'](),controller[_0x1bbd('0x12')]);router['get'](_0x1bbd('0x13'),auth['isAuthenticated'](),controller[_0x1bbd('0x14')]);router[_0x1bbd('0x15')]('/',auth[_0x1bbd('0xd')](),controller['create']);router[_0x1bbd('0x16')](_0x1bbd('0xc'),auth[_0x1bbd('0xd')](),controller[_0x1bbd('0x17')]);router[_0x1bbd('0x18')](_0x1bbd('0xc'),auth['isAuthenticated'](),controller[_0x1bbd('0x19')]);module[_0x1bbd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 97b474e..fbb2eba 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 _0xf773=['exports','STRING','sequelize'];(function(_0x2046dd,_0x40a9ab){var _0x2eb055=function(_0x1c65e8){while(--_0x1c65e8){_0x2046dd['push'](_0x2046dd['shift']());}};_0x2eb055(++_0x40a9ab);}(_0xf773,0x1d0));var _0x3f77=function(_0x2824e8,_0x2199b3){_0x2824e8=_0x2824e8-0x0;var _0x2509a7=_0xf773[_0x2824e8];return _0x2509a7;};'use strict';var Sequelize=require(_0x3f77('0x0'));module[_0x3f77('0x1')]={'name':{'type':Sequelize[_0x3f77('0x2')]},'description':{'type':Sequelize[_0x3f77('0x2')]}}; \ No newline at end of file +var _0x731a=['exports','STRING','sequelize'];(function(_0x41d987,_0x3a172f){var _0xf7c61d=function(_0x1221b0){while(--_0x1221b0){_0x41d987['push'](_0x41d987['shift']());}};_0xf7c61d(++_0x3a172f);}(_0x731a,0x104));var _0xa731=function(_0x294a77,_0x8a359d){_0x294a77=_0x294a77-0x0;var _0x17db6d=_0x731a[_0x294a77];return _0x17db6d;};'use strict';var Sequelize=require(_0xa731('0x0'));module[_0xa731('0x1')]={'name':{'type':Sequelize[_0xa731('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a41ce09..321d282 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 _0x799a=['findAll','rows','params','find','create','body','findOne','SugarcrmField','getFields','nolimit','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','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','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','SugarcrmConfiguration','includeAll','include'];(function(_0x5723e2,_0x4f629d){var _0x544543=function(_0x5ed9f4){while(--_0x5ed9f4){_0x5723e2['push'](_0x5723e2['shift']());}};_0x544543(++_0x4f629d);}(_0x799a,0x117));var _0xa799=function(_0x5df173,_0x4a4c40){_0x5df173=_0x5df173-0x0;var _0x7ac066=_0x799a[_0x5df173];return _0x7ac066;};'use strict';var pdf=require(_0xa799('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa799('0x1'));var zipdir=require(_0xa799('0x2'));var jsonpatch=require(_0xa799('0x3'));var rp=require(_0xa799('0x4'));var moment=require(_0xa799('0x5'));var BPromise=require(_0xa799('0x6'));var Mustache=require(_0xa799('0x7'));var util=require('util');var path=require(_0xa799('0x8'));var sox=require(_0xa799('0x9'));var csv=require(_0xa799('0xa'));var ejs=require(_0xa799('0xb'));var fs=require('fs');var _=require(_0xa799('0xc'));var squel=require(_0xa799('0xd'));var crypto=require(_0xa799('0xe'));var jsforce=require(_0xa799('0xf'));var deskjs=require(_0xa799('0x10'));var toCsv=require(_0xa799('0xa'));var querystring=require(_0xa799('0x11'));var Papa=require(_0xa799('0x12'));var Redis=require(_0xa799('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa799('0x14'));var hardwareService=require(_0xa799('0x15'));var logger=require(_0xa799('0x16'))('api');var utils=require(_0xa799('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xa799('0x18')][_0xa799('0x19')]({'port':0x232a});function checkPasswordPattern(_0xd53385,_0x3c7d05,_0x2c9e9e){if(_0x2c9e9e){var _0x5beb45=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5beb45[_0xa799('0x1a')](_0x3c7d05)){return _0xd53385;}else{throw new db['Sequelize'][(_0xa799('0x1b'))](_0xa799('0x1c'));}}else{return _0xd53385;}}function respondWithRpcPromise(_0x577b41,_0x38fd82,_0x4466d4,_0x3524c8){return new BPromise(function(_0x1ae9a1,_0x3a4b53){var _0x222598=_0x3524c8||client;return _0x222598[_0xa799('0x1d')](_0x577b41,_0x4466d4)[_0xa799('0x1e')](function(_0x25f00c){logger[_0xa799('0x1f')](_0xa799('0x20'),_0x38fd82,'request\x20sent');logger[_0xa799('0x21')](_0xa799('0x22'),_0x38fd82,_0xa799('0x23'),JSON['stringify'](_0x25f00c));if(_0x25f00c[_0xa799('0x24')]){if(_0x25f00c[_0xa799('0x24')]['code']===0x1f4){logger[_0xa799('0x24')](_0xa799('0x20'),_0x38fd82,_0x25f00c[_0xa799('0x24')][_0xa799('0x25')]);return _0x3a4b53(_0x25f00c[_0xa799('0x24')][_0xa799('0x25')]);}logger[_0xa799('0x24')](_0xa799('0x20'),_0x38fd82,_0x25f00c[_0xa799('0x24')]['message']);return _0x1ae9a1(_0x25f00c[_0xa799('0x24')][_0xa799('0x25')]);}else{logger['info'](_0xa799('0x20'),_0x38fd82,_0xa799('0x23'));_0x1ae9a1(_0x25f00c['result'][_0xa799('0x25')]);}})[_0xa799('0x26')](function(_0x506c11){logger[_0xa799('0x24')](_0xa799('0x20'),_0x38fd82,_0x506c11);_0x3a4b53(_0x506c11);});});}function respondWithStatusCode(_0x14328c,_0x4b2ce1){_0x4b2ce1=_0x4b2ce1||0xcc;return function(_0x4834ca){if(_0x4834ca){return _0x14328c[_0xa799('0x27')](_0x4b2ce1);}return _0x14328c[_0xa799('0x28')](_0x4b2ce1)[_0xa799('0x29')]();};}function respondWithResult(_0x1994b8,_0x5d71cd){_0x5d71cd=_0x5d71cd||0xc8;return function(_0x52dfb5){if(_0x52dfb5){return _0x1994b8[_0xa799('0x28')](_0x5d71cd)['json'](_0x52dfb5);}};}function respondWithFilteredResult(_0x4e8d5a,_0x349fa9){return function(_0x20e810){if(_0x20e810){var _0x4c6670=_0x20e810[_0xa799('0x2a')],_0x59bc00=_0x349fa9[_0xa799('0x2b')],_0x4f80fd=_0x349fa9['offset']+_0x349fa9[_0xa799('0x2c')],_0x3052ff;if(_0x4f80fd>=_0x4c6670){_0x4f80fd=_0x4c6670;_0x3052ff=0xc8;}else{_0x3052ff=0xce;}_0x4e8d5a['status'](_0x3052ff);return _0x4e8d5a[_0xa799('0x2d')](_0xa799('0x2e'),_0x59bc00+'-'+_0x4f80fd+'/'+_0x4c6670)['json'](_0x20e810);}return null;};}function patchUpdates(_0x219f6b){return function(_0x38aba0){try{jsonpatch['apply'](_0x38aba0,_0x219f6b,!![]);}catch(_0x5eb8ae){return BPromise[_0xa799('0x2f')](_0x5eb8ae);}return _0x38aba0[_0xa799('0x30')]();};}function saveUpdates(_0xb14852,_0xda3b01){return function(_0xe01942){if(_0xe01942){return _0xe01942[_0xa799('0x31')](_0xb14852)[_0xa799('0x1e')](function(_0x294878){return _0x294878;});}return null;};}function removeEntity(_0x104825,_0x50244b){return function(_0x41b265){if(_0x41b265){return _0x41b265[_0xa799('0x32')]()[_0xa799('0x1e')](function(){_0x104825[_0xa799('0x28')](0xcc)[_0xa799('0x29')]();});}};}function handleEntityNotFound(_0x393119,_0x3d97e8){return function(_0x12a8a8){if(!_0x12a8a8){_0x393119['sendStatus'](0x194);}return _0x12a8a8;};}function handleError(_0x411a2d,_0x1aaaf6){_0x1aaaf6=_0x1aaaf6||0x1f4;return function(_0x1a2df8){logger['error'](_0x1a2df8['stack']);if(_0x1a2df8[_0xa799('0x33')]){delete _0x1a2df8[_0xa799('0x33')];}_0x411a2d['status'](_0x1aaaf6)[_0xa799('0x34')](_0x1a2df8);};}exports[_0xa799('0x35')]=function(_0x3eadd7,_0x1a12e6){var _0xf93413={},_0x1c2b74={},_0x4e9ffa={'count':0x0,'rows':[]};var _0x35279c=_[_0xa799('0x36')](db['SugarcrmConfiguration'][_0xa799('0x37')],function(_0x436e6b){return{'name':_0x436e6b[_0xa799('0x38')],'type':_0x436e6b[_0xa799('0x39')]['key']};});_0x1c2b74[_0xa799('0x3a')]=_[_0xa799('0x36')](_0x35279c,_0xa799('0x33'));_0x1c2b74[_0xa799('0x3b')]=_[_0xa799('0x3c')](_0x3eadd7[_0xa799('0x3b')]);_0x1c2b74['filters']=_[_0xa799('0x3d')](_0x1c2b74[_0xa799('0x3a')],_0x1c2b74[_0xa799('0x3b')]);_0xf93413['attributes']=_[_0xa799('0x3d')](_0x1c2b74[_0xa799('0x3a')],qs[_0xa799('0x3e')](_0x3eadd7[_0xa799('0x3b')][_0xa799('0x3e')]));_0xf93413[_0xa799('0x3f')]=_0xf93413[_0xa799('0x3f')][_0xa799('0x40')]?_0xf93413[_0xa799('0x3f')]:_0x1c2b74[_0xa799('0x3a')];if(!_0x3eadd7[_0xa799('0x3b')][_0xa799('0x41')]('nolimit')){_0xf93413[_0xa799('0x2c')]=qs[_0xa799('0x2c')](_0x3eadd7[_0xa799('0x3b')][_0xa799('0x2c')]);_0xf93413[_0xa799('0x2b')]=qs[_0xa799('0x2b')](_0x3eadd7[_0xa799('0x3b')]['offset']);}_0xf93413[_0xa799('0x42')]=qs[_0xa799('0x43')](_0x3eadd7['query']['sort']);_0xf93413[_0xa799('0x44')]=qs['filters'](_[_0xa799('0x45')](_0x3eadd7[_0xa799('0x3b')],_0x1c2b74[_0xa799('0x46')]),_0x35279c);if(_0x3eadd7[_0xa799('0x3b')][_0xa799('0x47')]){_0xf93413['where']=_[_0xa799('0x48')](_0xf93413[_0xa799('0x44')],{'$or':_[_0xa799('0x36')](_0x35279c,function(_0x42c573){if(_0x42c573[_0xa799('0x39')]!=='VIRTUAL'){var _0x1c0fc5={};_0x1c0fc5[_0x42c573[_0xa799('0x33')]]={'$like':'%'+_0x3eadd7[_0xa799('0x3b')][_0xa799('0x47')]+'%'};return _0x1c0fc5;}})});}_0xf93413=_[_0xa799('0x48')]({},_0xf93413,_0x3eadd7[_0xa799('0x49')]);var _0x4ff806={'where':_0xf93413[_0xa799('0x44')]};return db[_0xa799('0x4a')]['count'](_0x4ff806)[_0xa799('0x1e')](function(_0x740290){_0x4e9ffa[_0xa799('0x2a')]=_0x740290;if(_0x3eadd7[_0xa799('0x3b')][_0xa799('0x4b')]){_0xf93413[_0xa799('0x4c')]=[{'all':!![]}];}return db[_0xa799('0x4a')][_0xa799('0x4d')](_0xf93413);})[_0xa799('0x1e')](function(_0x5d6507){_0x4e9ffa[_0xa799('0x4e')]=_0x5d6507;return _0x4e9ffa;})['then'](respondWithFilteredResult(_0x1a12e6,_0xf93413))[_0xa799('0x26')](handleError(_0x1a12e6,null));};exports['show']=function(_0xaa9f32,_0x529b98){var _0x1188f5={'raw':![],'where':{'id':_0xaa9f32[_0xa799('0x4f')]['id']}},_0x2919cd={};_0x2919cd[_0xa799('0x3a')]=_['keys'](db[_0xa799('0x4a')]['rawAttributes']);_0x2919cd[_0xa799('0x3b')]=_[_0xa799('0x3c')](_0xaa9f32[_0xa799('0x3b')]);_0x2919cd[_0xa799('0x46')]=_[_0xa799('0x3d')](_0x2919cd[_0xa799('0x3a')],_0x2919cd[_0xa799('0x3b')]);_0x1188f5[_0xa799('0x3f')]=_[_0xa799('0x3d')](_0x2919cd[_0xa799('0x3a')],qs[_0xa799('0x3e')](_0xaa9f32[_0xa799('0x3b')][_0xa799('0x3e')]));_0x1188f5[_0xa799('0x3f')]=_0x1188f5['attributes'][_0xa799('0x40')]?_0x1188f5[_0xa799('0x3f')]:_0x2919cd[_0xa799('0x3a')];if(_0xaa9f32[_0xa799('0x3b')][_0xa799('0x4b')]){_0x1188f5['include']=[{'all':!![]}];}_0x1188f5=_['merge']({},_0x1188f5,_0xaa9f32[_0xa799('0x49')]);return db[_0xa799('0x4a')][_0xa799('0x50')](_0x1188f5)['then'](handleEntityNotFound(_0x529b98,null))['then'](respondWithResult(_0x529b98,null))['catch'](handleError(_0x529b98,null));};exports[_0xa799('0x51')]=function(_0x206386,_0x2f5810){return db[_0xa799('0x4a')][_0xa799('0x51')](_0x206386[_0xa799('0x52')],{})['then'](respondWithResult(_0x2f5810,0xc9))[_0xa799('0x26')](handleError(_0x2f5810,null));};exports[_0xa799('0x31')]=function(_0x204d76,_0x5741ad){if(_0x204d76['body']['id']){delete _0x204d76[_0xa799('0x52')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x204d76[_0xa799('0x4f')]['id']}})[_0xa799('0x1e')](handleEntityNotFound(_0x5741ad,null))[_0xa799('0x1e')](saveUpdates(_0x204d76['body'],null))[_0xa799('0x1e')](respondWithResult(_0x5741ad,null))['catch'](handleError(_0x5741ad,null));};exports[_0xa799('0x32')]=function(_0x412837,_0x233a91){return db['SugarcrmConfiguration'][_0xa799('0x50')]({'where':{'id':_0x412837[_0xa799('0x4f')]['id']}})['then'](handleEntityNotFound(_0x233a91,null))[_0xa799('0x1e')](removeEntity(_0x233a91,null))[_0xa799('0x26')](handleError(_0x233a91,null));};exports['getFields']=function(_0x3073f2,_0x1a76e3,_0x468c35){var _0x1f5047={};var _0x4d32ee={};var _0x6bb43;var _0x3d4c40;return db[_0xa799('0x4a')][_0xa799('0x53')]({'where':{'id':_0x3073f2[_0xa799('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1a76e3,null))[_0xa799('0x1e')](function(_0x2b45c4){if(_0x2b45c4){_0x6bb43=_0x2b45c4;_0x4d32ee[_0xa799('0x3a')]=_[_0xa799('0x3c')](db[_0xa799('0x54')]['rawAttributes']);_0x4d32ee[_0xa799('0x3b')]=_['keys'](_0x3073f2[_0xa799('0x3b')]);_0x4d32ee[_0xa799('0x46')]=_[_0xa799('0x3d')](_0x4d32ee[_0xa799('0x3a')],_0x4d32ee[_0xa799('0x3b')]);_0x1f5047[_0xa799('0x3f')]=_['intersection'](_0x4d32ee[_0xa799('0x3a')],qs[_0xa799('0x3e')](_0x3073f2[_0xa799('0x3b')]['fields']));_0x1f5047['attributes']=_0x1f5047[_0xa799('0x3f')][_0xa799('0x40')]?_0x1f5047[_0xa799('0x3f')]:_0x4d32ee[_0xa799('0x3a')];_0x1f5047[_0xa799('0x42')]=qs['sort'](_0x3073f2['query'][_0xa799('0x43')]);_0x1f5047[_0xa799('0x44')]=qs[_0xa799('0x46')](_[_0xa799('0x45')](_0x3073f2[_0xa799('0x3b')],_0x4d32ee[_0xa799('0x46')]));if(_0x3073f2['query'][_0xa799('0x47')]){_0x1f5047[_0xa799('0x44')]=_[_0xa799('0x48')](_0x1f5047[_0xa799('0x44')],{'$or':_['map'](_0x1f5047[_0xa799('0x3f')],function(_0x33b488){var _0x1c1008={};_0x1c1008[_0x33b488]={'$like':'%'+_0x3073f2[_0xa799('0x3b')][_0xa799('0x47')]+'%'};return _0x1c1008;})});}_0x1f5047=_[_0xa799('0x48')]({},_0x1f5047,_0x3073f2[_0xa799('0x49')]);return _0x6bb43[_0xa799('0x55')](_0x1f5047);}})[_0xa799('0x1e')](function(_0x55e086){if(_0x55e086){_0x3d4c40=_0x55e086[_0xa799('0x40')];if(!_0x3073f2[_0xa799('0x3b')][_0xa799('0x41')](_0xa799('0x56'))){_0x1f5047[_0xa799('0x2c')]=qs[_0xa799('0x2c')](_0x3073f2[_0xa799('0x3b')]['limit']);_0x1f5047['offset']=qs[_0xa799('0x2b')](_0x3073f2[_0xa799('0x3b')][_0xa799('0x2b')]);}return _0x6bb43[_0xa799('0x55')](_0x1f5047);}})['then'](function(_0x3a501d){if(_0x3a501d){return _0x3a501d?{'count':_0x3d4c40,'rows':_0x3a501d}:null;}})[_0xa799('0x1e')](respondWithResult(_0x1a76e3,null))[_0xa799('0x26')](handleError(_0x1a76e3,null));};exports[_0xa799('0x57')]=function(_0x120e26,_0x21003a,_0x12354c){var _0x49fb3a={};var _0x5515e3={};var _0x3222fe;var _0x2236ff;return db['SugarcrmConfiguration'][_0xa799('0x53')]({'where':{'id':_0x120e26[_0xa799('0x4f')]['id']}})[_0xa799('0x1e')](handleEntityNotFound(_0x21003a,null))[_0xa799('0x1e')](function(_0x4597e6){if(_0x4597e6){_0x3222fe=_0x4597e6;_0x5515e3[_0xa799('0x3a')]=_['keys'](db[_0xa799('0x54')][_0xa799('0x37')]);_0x5515e3['query']=_[_0xa799('0x3c')](_0x120e26[_0xa799('0x3b')]);_0x5515e3[_0xa799('0x46')]=_[_0xa799('0x3d')](_0x5515e3[_0xa799('0x3a')],_0x5515e3[_0xa799('0x3b')]);_0x49fb3a['attributes']=_[_0xa799('0x3d')](_0x5515e3['model'],qs['fields'](_0x120e26[_0xa799('0x3b')][_0xa799('0x3e')]));_0x49fb3a[_0xa799('0x3f')]=_0x49fb3a[_0xa799('0x3f')][_0xa799('0x40')]?_0x49fb3a[_0xa799('0x3f')]:_0x5515e3[_0xa799('0x3a')];_0x49fb3a[_0xa799('0x42')]=qs['sort'](_0x120e26[_0xa799('0x3b')][_0xa799('0x43')]);_0x49fb3a[_0xa799('0x44')]=qs[_0xa799('0x46')](_[_0xa799('0x45')](_0x120e26[_0xa799('0x3b')],_0x5515e3['filters']));if(_0x120e26['query'][_0xa799('0x47')]){_0x49fb3a['where']=_[_0xa799('0x48')](_0x49fb3a['where'],{'$or':_['map'](_0x49fb3a['attributes'],function(_0x13b30d){var _0x48e76c={};_0x48e76c[_0x13b30d]={'$like':'%'+_0x120e26['query'][_0xa799('0x47')]+'%'};return _0x48e76c;})});}_0x49fb3a=_[_0xa799('0x48')]({},_0x49fb3a,_0x120e26[_0xa799('0x49')]);return _0x3222fe[_0xa799('0x57')](_0x49fb3a);}})[_0xa799('0x1e')](function(_0x2b8cf1){if(_0x2b8cf1){_0x2236ff=_0x2b8cf1['length'];if(!_0x120e26[_0xa799('0x3b')]['hasOwnProperty']('nolimit')){_0x49fb3a[_0xa799('0x2c')]=qs[_0xa799('0x2c')](_0x120e26[_0xa799('0x3b')][_0xa799('0x2c')]);_0x49fb3a[_0xa799('0x2b')]=qs['offset'](_0x120e26[_0xa799('0x3b')][_0xa799('0x2b')]);}return _0x3222fe[_0xa799('0x57')](_0x49fb3a);}})[_0xa799('0x1e')](function(_0x41c054){if(_0x41c054){return _0x41c054?{'count':_0x2236ff,'rows':_0x41c054}:null;}})[_0xa799('0x1e')](respondWithResult(_0x21003a,null))['catch'](handleError(_0x21003a,null));};exports[_0xa799('0x58')]=function(_0x494270,_0x3669d3,_0x3f3180){var _0x1e294f={};var _0x28848a={};var _0x74286;var _0x384507;return db['SugarcrmConfiguration'][_0xa799('0x53')]({'where':{'id':_0x494270[_0xa799('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3669d3,null))['then'](function(_0x4fc41a){if(_0x4fc41a){_0x74286=_0x4fc41a;_0x28848a[_0xa799('0x3a')]=_[_0xa799('0x3c')](db['SugarcrmField'][_0xa799('0x37')]);_0x28848a[_0xa799('0x3b')]=_[_0xa799('0x3c')](_0x494270['query']);_0x28848a[_0xa799('0x46')]=_[_0xa799('0x3d')](_0x28848a[_0xa799('0x3a')],_0x28848a[_0xa799('0x3b')]);_0x1e294f[_0xa799('0x3f')]=_[_0xa799('0x3d')](_0x28848a['model'],qs[_0xa799('0x3e')](_0x494270[_0xa799('0x3b')][_0xa799('0x3e')]));_0x1e294f[_0xa799('0x3f')]=_0x1e294f[_0xa799('0x3f')]['length']?_0x1e294f[_0xa799('0x3f')]:_0x28848a[_0xa799('0x3a')];_0x1e294f['order']=qs[_0xa799('0x43')](_0x494270[_0xa799('0x3b')][_0xa799('0x43')]);_0x1e294f[_0xa799('0x44')]=qs['filters'](_['pick'](_0x494270[_0xa799('0x3b')],_0x28848a['filters']));if(_0x494270[_0xa799('0x3b')][_0xa799('0x47')]){_0x1e294f['where']=_['merge'](_0x1e294f[_0xa799('0x44')],{'$or':_[_0xa799('0x36')](_0x1e294f[_0xa799('0x3f')],function(_0x16117e){var _0x4fe1ef={};_0x4fe1ef[_0x16117e]={'$like':'%'+_0x494270[_0xa799('0x3b')][_0xa799('0x47')]+'%'};return _0x4fe1ef;})});}_0x1e294f=_[_0xa799('0x48')]({},_0x1e294f,_0x494270[_0xa799('0x49')]);return _0x74286['getDescriptions'](_0x1e294f);}})['then'](function(_0x881d61){if(_0x881d61){_0x384507=_0x881d61[_0xa799('0x40')];if(!_0x494270[_0xa799('0x3b')][_0xa799('0x41')](_0xa799('0x56'))){_0x1e294f['limit']=qs[_0xa799('0x2c')](_0x494270[_0xa799('0x3b')][_0xa799('0x2c')]);_0x1e294f[_0xa799('0x2b')]=qs[_0xa799('0x2b')](_0x494270[_0xa799('0x3b')][_0xa799('0x2b')]);}return _0x74286[_0xa799('0x58')](_0x1e294f);}})[_0xa799('0x1e')](function(_0xfc5be9){if(_0xfc5be9){return _0xfc5be9?{'count':_0x384507,'rows':_0xfc5be9}:null;}})['then'](respondWithResult(_0x3669d3,null))['catch'](handleError(_0x3669d3,null));}; \ No newline at end of file +var _0x9407=['lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../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','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','where','options','SugarcrmConfiguration','includeAll','include','findAll','rows','find','create','body','params','getFields','findOne','SugarcrmField','filter','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x55f581,_0x5ec16b){var _0x45b013=function(_0x2f973e){while(--_0x2f973e){_0x55f581['push'](_0x55f581['shift']());}};_0x45b013(++_0x5ec16b);}(_0x9407,0x165));var _0x7940=function(_0x3d0f50,_0x5b1132){_0x3d0f50=_0x3d0f50-0x0;var _0x503258=_0x9407[_0x3d0f50];return _0x503258;};'use strict';var pdf=require(_0x7940('0x0'));var emlformat=require(_0x7940('0x1'));var rimraf=require(_0x7940('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7940('0x3'));var moment=require(_0x7940('0x4'));var BPromise=require(_0x7940('0x5'));var Mustache=require(_0x7940('0x6'));var util=require(_0x7940('0x7'));var path=require('path');var sox=require(_0x7940('0x8'));var csv=require(_0x7940('0x9'));var ejs=require(_0x7940('0xa'));var fs=require('fs');var _=require(_0x7940('0xb'));var squel=require('squel');var crypto=require(_0x7940('0xc'));var jsforce=require(_0x7940('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7940('0x9'));var querystring=require(_0x7940('0xe'));var Papa=require('papaparse');var Redis=require(_0x7940('0xf'));var authService=require(_0x7940('0x10'));var qs=require(_0x7940('0x11'));var as=require(_0x7940('0x12'));var hardwareService=require(_0x7940('0x13'));var logger=require(_0x7940('0x14'))('api');var utils=require(_0x7940('0x15'));var config=require('../../config/environment');var db=require(_0x7940('0x16'))['db'];var jayson=require(_0x7940('0x17'));var client=jayson[_0x7940('0x18')][_0x7940('0x19')]({'port':0x232a});function checkPasswordPattern(_0x116300,_0x4252b8,_0x1d92d4){if(_0x1d92d4){var _0x5809d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5809d3[_0x7940('0x1a')](_0x4252b8)){return _0x116300;}else{throw new db[(_0x7940('0x1b'))][(_0x7940('0x1c'))](_0x7940('0x1d'));}}else{return _0x116300;}}function respondWithRpcPromise(_0x3cfa3c,_0x1860d6,_0x2f392e,_0x43b0a6){return new BPromise(function(_0x3e3e2d,_0x108009){var _0xf432e7=_0x43b0a6||client;return _0xf432e7[_0x7940('0x1e')](_0x3cfa3c,_0x2f392e)[_0x7940('0x1f')](function(_0xd87dcc){logger[_0x7940('0x20')](_0x7940('0x21'),_0x1860d6,_0x7940('0x22'));logger['debug'](_0x7940('0x23'),_0x1860d6,_0x7940('0x22'),JSON['stringify'](_0xd87dcc));if(_0xd87dcc[_0x7940('0x24')]){if(_0xd87dcc[_0x7940('0x24')][_0x7940('0x25')]===0x1f4){logger[_0x7940('0x24')](_0x7940('0x21'),_0x1860d6,_0xd87dcc[_0x7940('0x24')]['message']);return _0x108009(_0xd87dcc[_0x7940('0x24')][_0x7940('0x26')]);}logger['error'](_0x7940('0x21'),_0x1860d6,_0xd87dcc[_0x7940('0x24')][_0x7940('0x26')]);return _0x3e3e2d(_0xd87dcc[_0x7940('0x24')][_0x7940('0x26')]);}else{logger['info'](_0x7940('0x21'),_0x1860d6,'request\x20sent');_0x3e3e2d(_0xd87dcc[_0x7940('0x27')][_0x7940('0x26')]);}})[_0x7940('0x28')](function(_0x2e406d){logger[_0x7940('0x24')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1860d6,_0x2e406d);_0x108009(_0x2e406d);});});}function respondWithStatusCode(_0x4a5a9c,_0x3b07ed){_0x3b07ed=_0x3b07ed||0xcc;return function(_0x438927){if(_0x438927){return _0x4a5a9c[_0x7940('0x29')](_0x3b07ed);}return _0x4a5a9c['status'](_0x3b07ed)['end']();};}function respondWithResult(_0x2a8e53,_0x3e5007){_0x3e5007=_0x3e5007||0xc8;return function(_0x511583){if(_0x511583){return _0x2a8e53[_0x7940('0x2a')](_0x3e5007)['json'](_0x511583);}};}function respondWithFilteredResult(_0x468aae,_0x10cbd1){return function(_0x2d9ec1){if(_0x2d9ec1){var _0x435162=_0x2d9ec1[_0x7940('0x2b')],_0x367240=_0x10cbd1[_0x7940('0x2c')],_0x30b336=_0x10cbd1['offset']+_0x10cbd1[_0x7940('0x2d')],_0x2c2216;if(_0x30b336>=_0x435162){_0x30b336=_0x435162;_0x2c2216=0xc8;}else{_0x2c2216=0xce;}_0x468aae[_0x7940('0x2a')](_0x2c2216);return _0x468aae['set'](_0x7940('0x2e'),_0x367240+'-'+_0x30b336+'/'+_0x435162)[_0x7940('0x2f')](_0x2d9ec1);}return null;};}function patchUpdates(_0x5902d7){return function(_0x3977d0){try{jsonpatch[_0x7940('0x30')](_0x3977d0,_0x5902d7,!![]);}catch(_0x10da57){return BPromise[_0x7940('0x31')](_0x10da57);}return _0x3977d0['save']();};}function saveUpdates(_0x4a710a,_0x6062c7){return function(_0x50948b){if(_0x50948b){return _0x50948b[_0x7940('0x32')](_0x4a710a)[_0x7940('0x1f')](function(_0x48e30a){return _0x48e30a;});}return null;};}function removeEntity(_0x336913,_0x3744b2){return function(_0x56b366){if(_0x56b366){return _0x56b366[_0x7940('0x33')]()[_0x7940('0x1f')](function(){_0x336913['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x343c8d,_0x2d541c){return function(_0x34cf7d){if(!_0x34cf7d){_0x343c8d[_0x7940('0x29')](0x194);}return _0x34cf7d;};}function handleError(_0x35c3f5,_0x309607){_0x309607=_0x309607||0x1f4;return function(_0xd508f0){logger[_0x7940('0x24')](_0xd508f0[_0x7940('0x34')]);if(_0xd508f0[_0x7940('0x35')]){delete _0xd508f0[_0x7940('0x35')];}_0x35c3f5['status'](_0x309607)[_0x7940('0x36')](_0xd508f0);};}exports[_0x7940('0x37')]=function(_0x40df9b,_0x1d35c9){var _0x599cd3={},_0x13dace={},_0x4cb99c={'count':0x0,'rows':[]};var _0x48b665=_[_0x7940('0x38')](db['SugarcrmConfiguration'][_0x7940('0x39')],function(_0x53359f){return{'name':_0x53359f[_0x7940('0x3a')],'type':_0x53359f[_0x7940('0x3b')][_0x7940('0x3c')]};});_0x13dace[_0x7940('0x3d')]=_[_0x7940('0x38')](_0x48b665,_0x7940('0x35'));_0x13dace[_0x7940('0x3e')]=_[_0x7940('0x3f')](_0x40df9b[_0x7940('0x3e')]);_0x13dace[_0x7940('0x40')]=_[_0x7940('0x41')](_0x13dace[_0x7940('0x3d')],_0x13dace[_0x7940('0x3e')]);_0x599cd3[_0x7940('0x42')]=_['intersection'](_0x13dace[_0x7940('0x3d')],qs[_0x7940('0x43')](_0x40df9b[_0x7940('0x3e')][_0x7940('0x43')]));_0x599cd3[_0x7940('0x42')]=_0x599cd3[_0x7940('0x42')][_0x7940('0x44')]?_0x599cd3[_0x7940('0x42')]:_0x13dace[_0x7940('0x3d')];if(!_0x40df9b['query']['hasOwnProperty'](_0x7940('0x45'))){_0x599cd3[_0x7940('0x2d')]=qs['limit'](_0x40df9b[_0x7940('0x3e')][_0x7940('0x2d')]);_0x599cd3[_0x7940('0x2c')]=qs['offset'](_0x40df9b[_0x7940('0x3e')][_0x7940('0x2c')]);}_0x599cd3[_0x7940('0x46')]=qs[_0x7940('0x47')](_0x40df9b[_0x7940('0x3e')]['sort']);_0x599cd3['where']=qs[_0x7940('0x40')](_[_0x7940('0x48')](_0x40df9b[_0x7940('0x3e')],_0x13dace[_0x7940('0x40')]),_0x48b665);if(_0x40df9b['query']['filter']){_0x599cd3['where']=_[_0x7940('0x49')](_0x599cd3[_0x7940('0x4a')],{'$or':_[_0x7940('0x38')](_0x48b665,function(_0x5595c9){if(_0x5595c9['type']!=='VIRTUAL'){var _0x596ce0={};_0x596ce0[_0x5595c9['name']]={'$like':'%'+_0x40df9b[_0x7940('0x3e')]['filter']+'%'};return _0x596ce0;}})});}_0x599cd3=_['merge']({},_0x599cd3,_0x40df9b[_0x7940('0x4b')]);var _0x1769b6={'where':_0x599cd3['where']};return db[_0x7940('0x4c')][_0x7940('0x2b')](_0x1769b6)[_0x7940('0x1f')](function(_0xce4e0c){_0x4cb99c[_0x7940('0x2b')]=_0xce4e0c;if(_0x40df9b['query'][_0x7940('0x4d')]){_0x599cd3[_0x7940('0x4e')]=[{'all':!![]}];}return db[_0x7940('0x4c')][_0x7940('0x4f')](_0x599cd3);})[_0x7940('0x1f')](function(_0x3ba5a0){_0x4cb99c[_0x7940('0x50')]=_0x3ba5a0;return _0x4cb99c;})[_0x7940('0x1f')](respondWithFilteredResult(_0x1d35c9,_0x599cd3))[_0x7940('0x28')](handleError(_0x1d35c9,null));};exports['show']=function(_0x446df0,_0x4c0d8d){var _0x40b716={'raw':![],'where':{'id':_0x446df0['params']['id']}},_0x396221={};_0x396221[_0x7940('0x3d')]=_[_0x7940('0x3f')](db[_0x7940('0x4c')][_0x7940('0x39')]);_0x396221['query']=_[_0x7940('0x3f')](_0x446df0[_0x7940('0x3e')]);_0x396221[_0x7940('0x40')]=_['intersection'](_0x396221[_0x7940('0x3d')],_0x396221[_0x7940('0x3e')]);_0x40b716[_0x7940('0x42')]=_[_0x7940('0x41')](_0x396221['model'],qs[_0x7940('0x43')](_0x446df0['query'][_0x7940('0x43')]));_0x40b716[_0x7940('0x42')]=_0x40b716[_0x7940('0x42')][_0x7940('0x44')]?_0x40b716[_0x7940('0x42')]:_0x396221[_0x7940('0x3d')];if(_0x446df0[_0x7940('0x3e')]['includeAll']){_0x40b716[_0x7940('0x4e')]=[{'all':!![]}];}_0x40b716=_[_0x7940('0x49')]({},_0x40b716,_0x446df0[_0x7940('0x4b')]);return db[_0x7940('0x4c')][_0x7940('0x51')](_0x40b716)[_0x7940('0x1f')](handleEntityNotFound(_0x4c0d8d,null))['then'](respondWithResult(_0x4c0d8d,null))[_0x7940('0x28')](handleError(_0x4c0d8d,null));};exports[_0x7940('0x52')]=function(_0x5777cc,_0x2fad8e){return db[_0x7940('0x4c')][_0x7940('0x52')](_0x5777cc[_0x7940('0x53')],{})[_0x7940('0x1f')](respondWithResult(_0x2fad8e,0xc9))[_0x7940('0x28')](handleError(_0x2fad8e,null));};exports[_0x7940('0x32')]=function(_0x286a90,_0x1bb0f6){if(_0x286a90[_0x7940('0x53')]['id']){delete _0x286a90[_0x7940('0x53')]['id'];}return db[_0x7940('0x4c')][_0x7940('0x51')]({'where':{'id':_0x286a90[_0x7940('0x54')]['id']}})[_0x7940('0x1f')](handleEntityNotFound(_0x1bb0f6,null))[_0x7940('0x1f')](saveUpdates(_0x286a90['body'],null))[_0x7940('0x1f')](respondWithResult(_0x1bb0f6,null))[_0x7940('0x28')](handleError(_0x1bb0f6,null));};exports['destroy']=function(_0x1557fa,_0x5dcecf){return db[_0x7940('0x4c')][_0x7940('0x51')]({'where':{'id':_0x1557fa[_0x7940('0x54')]['id']}})[_0x7940('0x1f')](handleEntityNotFound(_0x5dcecf,null))[_0x7940('0x1f')](removeEntity(_0x5dcecf,null))['catch'](handleError(_0x5dcecf,null));};exports[_0x7940('0x55')]=function(_0x4765ae,_0x49e938,_0x446ed7){var _0x18f510={};var _0x8e4553={};var _0x4744bb;var _0x2506d5;return db[_0x7940('0x4c')][_0x7940('0x56')]({'where':{'id':_0x4765ae[_0x7940('0x54')]['id']}})[_0x7940('0x1f')](handleEntityNotFound(_0x49e938,null))[_0x7940('0x1f')](function(_0x470c97){if(_0x470c97){_0x4744bb=_0x470c97;_0x8e4553[_0x7940('0x3d')]=_[_0x7940('0x3f')](db[_0x7940('0x57')]['rawAttributes']);_0x8e4553[_0x7940('0x3e')]=_['keys'](_0x4765ae[_0x7940('0x3e')]);_0x8e4553[_0x7940('0x40')]=_[_0x7940('0x41')](_0x8e4553['model'],_0x8e4553['query']);_0x18f510[_0x7940('0x42')]=_['intersection'](_0x8e4553[_0x7940('0x3d')],qs[_0x7940('0x43')](_0x4765ae[_0x7940('0x3e')][_0x7940('0x43')]));_0x18f510['attributes']=_0x18f510['attributes'][_0x7940('0x44')]?_0x18f510[_0x7940('0x42')]:_0x8e4553['model'];_0x18f510['order']=qs[_0x7940('0x47')](_0x4765ae[_0x7940('0x3e')][_0x7940('0x47')]);_0x18f510[_0x7940('0x4a')]=qs[_0x7940('0x40')](_[_0x7940('0x48')](_0x4765ae[_0x7940('0x3e')],_0x8e4553[_0x7940('0x40')]));if(_0x4765ae['query'][_0x7940('0x58')]){_0x18f510[_0x7940('0x4a')]=_['merge'](_0x18f510[_0x7940('0x4a')],{'$or':_[_0x7940('0x38')](_0x18f510[_0x7940('0x42')],function(_0x40cb89){var _0x511caa={};_0x511caa[_0x40cb89]={'$like':'%'+_0x4765ae[_0x7940('0x3e')][_0x7940('0x58')]+'%'};return _0x511caa;})});}_0x18f510=_[_0x7940('0x49')]({},_0x18f510,_0x4765ae[_0x7940('0x4b')]);return _0x4744bb[_0x7940('0x55')](_0x18f510);}})[_0x7940('0x1f')](function(_0x390aaf){if(_0x390aaf){_0x2506d5=_0x390aaf[_0x7940('0x44')];if(!_0x4765ae[_0x7940('0x3e')][_0x7940('0x59')](_0x7940('0x45'))){_0x18f510['limit']=qs[_0x7940('0x2d')](_0x4765ae[_0x7940('0x3e')][_0x7940('0x2d')]);_0x18f510['offset']=qs['offset'](_0x4765ae[_0x7940('0x3e')][_0x7940('0x2c')]);}return _0x4744bb['getFields'](_0x18f510);}})[_0x7940('0x1f')](function(_0x472055){if(_0x472055){return _0x472055?{'count':_0x2506d5,'rows':_0x472055}:null;}})[_0x7940('0x1f')](respondWithResult(_0x49e938,null))[_0x7940('0x28')](handleError(_0x49e938,null));};exports['getSubjects']=function(_0x19d55e,_0x37acc8,_0x3dbcbb){var _0x55a7b2={};var _0x97cb43={};var _0x1e51c2;var _0x51e1ca;return db['SugarcrmConfiguration'][_0x7940('0x56')]({'where':{'id':_0x19d55e['params']['id']}})[_0x7940('0x1f')](handleEntityNotFound(_0x37acc8,null))[_0x7940('0x1f')](function(_0x405965){if(_0x405965){_0x1e51c2=_0x405965;_0x97cb43[_0x7940('0x3d')]=_[_0x7940('0x3f')](db[_0x7940('0x57')][_0x7940('0x39')]);_0x97cb43[_0x7940('0x3e')]=_[_0x7940('0x3f')](_0x19d55e[_0x7940('0x3e')]);_0x97cb43['filters']=_[_0x7940('0x41')](_0x97cb43[_0x7940('0x3d')],_0x97cb43[_0x7940('0x3e')]);_0x55a7b2[_0x7940('0x42')]=_[_0x7940('0x41')](_0x97cb43[_0x7940('0x3d')],qs[_0x7940('0x43')](_0x19d55e[_0x7940('0x3e')][_0x7940('0x43')]));_0x55a7b2[_0x7940('0x42')]=_0x55a7b2['attributes'][_0x7940('0x44')]?_0x55a7b2['attributes']:_0x97cb43[_0x7940('0x3d')];_0x55a7b2[_0x7940('0x46')]=qs[_0x7940('0x47')](_0x19d55e[_0x7940('0x3e')][_0x7940('0x47')]);_0x55a7b2[_0x7940('0x4a')]=qs[_0x7940('0x40')](_[_0x7940('0x48')](_0x19d55e[_0x7940('0x3e')],_0x97cb43[_0x7940('0x40')]));if(_0x19d55e[_0x7940('0x3e')][_0x7940('0x58')]){_0x55a7b2[_0x7940('0x4a')]=_['merge'](_0x55a7b2[_0x7940('0x4a')],{'$or':_[_0x7940('0x38')](_0x55a7b2[_0x7940('0x42')],function(_0x2b1d96){var _0x2088b0={};_0x2088b0[_0x2b1d96]={'$like':'%'+_0x19d55e[_0x7940('0x3e')][_0x7940('0x58')]+'%'};return _0x2088b0;})});}_0x55a7b2=_[_0x7940('0x49')]({},_0x55a7b2,_0x19d55e[_0x7940('0x4b')]);return _0x1e51c2[_0x7940('0x5a')](_0x55a7b2);}})[_0x7940('0x1f')](function(_0x184e6e){if(_0x184e6e){_0x51e1ca=_0x184e6e['length'];if(!_0x19d55e[_0x7940('0x3e')][_0x7940('0x59')](_0x7940('0x45'))){_0x55a7b2['limit']=qs[_0x7940('0x2d')](_0x19d55e['query'][_0x7940('0x2d')]);_0x55a7b2[_0x7940('0x2c')]=qs[_0x7940('0x2c')](_0x19d55e[_0x7940('0x3e')]['offset']);}return _0x1e51c2[_0x7940('0x5a')](_0x55a7b2);}})[_0x7940('0x1f')](function(_0x32f1e9){if(_0x32f1e9){return _0x32f1e9?{'count':_0x51e1ca,'rows':_0x32f1e9}:null;}})[_0x7940('0x1f')](respondWithResult(_0x37acc8,null))[_0x7940('0x28')](handleError(_0x37acc8,null));};exports['getDescriptions']=function(_0x38463b,_0x33d439,_0x2d8365){var _0x2971b7={};var _0x426cd2={};var _0xac7927;var _0x1b197e;return db[_0x7940('0x4c')]['findOne']({'where':{'id':_0x38463b[_0x7940('0x54')]['id']}})[_0x7940('0x1f')](handleEntityNotFound(_0x33d439,null))[_0x7940('0x1f')](function(_0x320ef4){if(_0x320ef4){_0xac7927=_0x320ef4;_0x426cd2[_0x7940('0x3d')]=_[_0x7940('0x3f')](db[_0x7940('0x57')][_0x7940('0x39')]);_0x426cd2[_0x7940('0x3e')]=_[_0x7940('0x3f')](_0x38463b['query']);_0x426cd2[_0x7940('0x40')]=_[_0x7940('0x41')](_0x426cd2['model'],_0x426cd2[_0x7940('0x3e')]);_0x2971b7[_0x7940('0x42')]=_['intersection'](_0x426cd2[_0x7940('0x3d')],qs[_0x7940('0x43')](_0x38463b[_0x7940('0x3e')][_0x7940('0x43')]));_0x2971b7[_0x7940('0x42')]=_0x2971b7[_0x7940('0x42')][_0x7940('0x44')]?_0x2971b7[_0x7940('0x42')]:_0x426cd2[_0x7940('0x3d')];_0x2971b7['order']=qs[_0x7940('0x47')](_0x38463b[_0x7940('0x3e')]['sort']);_0x2971b7[_0x7940('0x4a')]=qs[_0x7940('0x40')](_[_0x7940('0x48')](_0x38463b[_0x7940('0x3e')],_0x426cd2['filters']));if(_0x38463b['query'][_0x7940('0x58')]){_0x2971b7[_0x7940('0x4a')]=_[_0x7940('0x49')](_0x2971b7[_0x7940('0x4a')],{'$or':_[_0x7940('0x38')](_0x2971b7[_0x7940('0x42')],function(_0x1d3f71){var _0x43d6c6={};_0x43d6c6[_0x1d3f71]={'$like':'%'+_0x38463b['query'][_0x7940('0x58')]+'%'};return _0x43d6c6;})});}_0x2971b7=_[_0x7940('0x49')]({},_0x2971b7,_0x38463b[_0x7940('0x4b')]);return _0xac7927['getDescriptions'](_0x2971b7);}})[_0x7940('0x1f')](function(_0xc88070){if(_0xc88070){_0x1b197e=_0xc88070[_0x7940('0x44')];if(!_0x38463b[_0x7940('0x3e')][_0x7940('0x59')](_0x7940('0x45'))){_0x2971b7[_0x7940('0x2d')]=qs[_0x7940('0x2d')](_0x38463b[_0x7940('0x3e')][_0x7940('0x2d')]);_0x2971b7[_0x7940('0x2c')]=qs[_0x7940('0x2c')](_0x38463b[_0x7940('0x3e')][_0x7940('0x2c')]);}return _0xac7927[_0x7940('0x5b')](_0x2971b7);}})[_0x7940('0x1f')](function(_0x55b527){if(_0x55b527){return _0x55b527?{'count':_0x1b197e,'rows':_0x55b527}:null;}})[_0x7940('0x1f')](respondWithResult(_0x33d439,null))[_0x7940('0x28')](handleError(_0x33d439,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5988fc7..1b89b3d 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 _0xc8c6=['define','SugarcrmConfiguration','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x51a344,_0x41934b){var _0xa079dd=function(_0x5f1584){while(--_0x5f1584){_0x51a344['push'](_0x51a344['shift']());}};_0xa079dd(++_0x41934b);}(_0xc8c6,0x98));var _0x6c8c=function(_0x54554e,_0x2202ad){_0x54554e=_0x54554e-0x0;var _0x1f7a99=_0xc8c6[_0x54554e];return _0x1f7a99;};'use strict';var _=require(_0x6c8c('0x0'));var util=require('util');var logger=require(_0x6c8c('0x1'))(_0x6c8c('0x2'));var moment=require(_0x6c8c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c8c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c8c('0x5'));var config=require(_0x6c8c('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x6c8c('0x7')]=function(_0x161e4f,_0x35934e){return _0x161e4f[_0x6c8c('0x8')](_0x6c8c('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x927d=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','../../config/environment','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration'];(function(_0x3ac19e,_0x1f0e26){var _0x33ed11=function(_0x3c17ce){while(--_0x3c17ce){_0x3ac19e['push'](_0x3ac19e['shift']());}};_0x33ed11(++_0x1f0e26);}(_0x927d,0x91));var _0xd927=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x927d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd927('0x0'));var util=require(_0xd927('0x1'));var logger=require(_0xd927('0x2'))(_0xd927('0x3'));var moment=require(_0xd927('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd927('0x5'));var attributes=require(_0xd927('0x6'));module['exports']=function(_0xfc839f,_0x5ced3e){return _0xfc839f['define'](_0xd927('0x7'),attributes,{'tableName':_0xd927('0x8'),'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 e94cdb4..64a900e 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 _0x5642=['client','http','request','then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ff41c,_0x483c21){var _0x275644=function(_0xcaef54){while(--_0xcaef54){_0x4ff41c['push'](_0x4ff41c['shift']());}};_0x275644(++_0x483c21);}(_0x5642,0x98));var _0x2564=function(_0x46d21a,_0x46920e){_0x46d21a=_0x46d21a-0x0;var _0x32574f=_0x5642[_0x46d21a];return _0x32574f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2564('0x0'));var rs=require(_0x2564('0x1'));var fs=require('fs');var Redis=require(_0x2564('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2564('0x3'));var logger=require(_0x2564('0x4'))(_0x2564('0x5'));var config=require(_0x2564('0x6'));var jayson=require(_0x2564('0x7'));var client=jayson[_0x2564('0x8')][_0x2564('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f0fe0,_0x28357e,_0x27733b){return new BPromise(function(_0x167a4e,_0x3b86d0){return client[_0x2564('0xa')](_0x1f0fe0,_0x27733b)[_0x2564('0xb')](function(_0x38b39a){logger[_0x2564('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x28357e,_0x2564('0xd'));logger['debug'](_0x2564('0xe'),_0x28357e,_0x2564('0xd'),JSON[_0x2564('0xf')](_0x38b39a));if(_0x38b39a[_0x2564('0x10')]){if(_0x38b39a[_0x2564('0x10')]['code']===0x1f4){logger[_0x2564('0x10')](_0x2564('0x11'),_0x28357e,_0x38b39a[_0x2564('0x10')][_0x2564('0x12')]);return _0x3b86d0(_0x38b39a[_0x2564('0x10')][_0x2564('0x12')]);}logger[_0x2564('0x10')](_0x2564('0x11'),_0x28357e,_0x38b39a[_0x2564('0x10')][_0x2564('0x12')]);return _0x167a4e(_0x38b39a['error'][_0x2564('0x12')]);}else{logger[_0x2564('0xc')](_0x2564('0x11'),_0x28357e,_0x2564('0xd'));_0x167a4e(_0x38b39a[_0x2564('0x13')]['message']);}})['catch'](function(_0x3433aa){logger['error'](_0x2564('0x11'),_0x28357e,_0x3433aa);_0x3b86d0(_0x3433aa);});});} \ No newline at end of file +var _0xd652=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0xd652,0x19c));var _0x2d65=function(_0x2b0ce0,_0x394b3b){_0x2b0ce0=_0x2b0ce0-0x0;var _0x1b042d=_0xd652[_0x2b0ce0];return _0x1b042d;};'use strict';var _=require(_0x2d65('0x0'));var util=require(_0x2d65('0x1'));var moment=require(_0x2d65('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d65('0x3'));var fs=require('fs');var Redis=require(_0x2d65('0x4'));var db=require(_0x2d65('0x5'))['db'];var utils=require(_0x2d65('0x6'));var logger=require('../../config/logger')(_0x2d65('0x7'));var config=require(_0x2d65('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2d65('0x9')][_0x2d65('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52b8bb,_0x2d525f,_0x3266e2){return new BPromise(function(_0x13a495,_0x2bb8b3){return client[_0x2d65('0xb')](_0x52b8bb,_0x3266e2)[_0x2d65('0xc')](function(_0x2e87da){logger[_0x2d65('0xd')](_0x2d65('0xe'),_0x2d525f,_0x2d65('0xf'));logger[_0x2d65('0x10')](_0x2d65('0x11'),_0x2d525f,'request\x20sent',JSON[_0x2d65('0x12')](_0x2e87da));if(_0x2e87da['error']){if(_0x2e87da[_0x2d65('0x13')]['code']===0x1f4){logger[_0x2d65('0x13')](_0x2d65('0xe'),_0x2d525f,_0x2e87da[_0x2d65('0x13')]['message']);return _0x2bb8b3(_0x2e87da[_0x2d65('0x13')][_0x2d65('0x14')]);}logger[_0x2d65('0x13')](_0x2d65('0xe'),_0x2d525f,_0x2e87da[_0x2d65('0x13')][_0x2d65('0x14')]);return _0x13a495(_0x2e87da[_0x2d65('0x13')][_0x2d65('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2d525f,'request\x20sent');_0x13a495(_0x2e87da[_0x2d65('0x15')][_0x2d65('0x14')]);}})[_0x2d65('0x16')](function(_0x34d2d7){logger[_0x2d65('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2d525f,_0x34d2d7);_0x2bb8b3(_0x34d2d7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index ef9e495..3e69153 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 _0xd4ec=['connect-timeout','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2940d2,_0x492142){var _0x2a4049=function(_0x5065a5){while(--_0x5065a5){_0x2940d2['push'](_0x2940d2['shift']());}};_0x2a4049(++_0x492142);}(_0xd4ec,0x179));var _0xcd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcd4e('0x0'));var util=require(_0xcd4e('0x1'));var path=require(_0xcd4e('0x2'));var timeout=require(_0xcd4e('0x3'));var express=require('express');var router=express[_0xcd4e('0x4')]();var auth=require(_0xcd4e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcd4e('0x6'));var controller=require(_0xcd4e('0x7'));router[_0xcd4e('0x8')]('/',auth[_0xcd4e('0x9')](),controller[_0xcd4e('0xa')]);router[_0xcd4e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xcd4e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd4e('0xc')]);router[_0xcd4e('0xd')](_0xcd4e('0xe'),auth[_0xcd4e('0x9')](),controller[_0xcd4e('0xf')]);router[_0xcd4e('0x10')](_0xcd4e('0xe'),auth[_0xcd4e('0x9')](),controller[_0xcd4e('0x11')]);module[_0xcd4e('0x12')]=router; \ No newline at end of file +var _0x1e7b=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x1ee394,_0x566525){var _0xdc4597=function(_0x3ef83f){while(--_0x3ef83f){_0x1ee394['push'](_0x1ee394['shift']());}};_0xdc4597(++_0x566525);}(_0x1e7b,0x12a));var _0xb1e7=function(_0x2db0e0,_0x43c8c0){_0x2db0e0=_0x2db0e0-0x0;var _0x1d78ca=_0x1e7b[_0x2db0e0];return _0x1d78ca;};'use strict';var multer=require(_0xb1e7('0x0'));var util=require(_0xb1e7('0x1'));var path=require(_0xb1e7('0x2'));var timeout=require(_0xb1e7('0x3'));var express=require(_0xb1e7('0x4'));var router=express['Router']();var auth=require(_0xb1e7('0x5'));var interaction=require(_0xb1e7('0x6'));var config=require(_0xb1e7('0x7'));var controller=require(_0xb1e7('0x8'));router[_0xb1e7('0x9')]('/',auth[_0xb1e7('0xa')](),controller[_0xb1e7('0xb')]);router[_0xb1e7('0x9')](_0xb1e7('0xc'),auth[_0xb1e7('0xa')](),controller[_0xb1e7('0xd')]);router[_0xb1e7('0xe')]('/',auth[_0xb1e7('0xa')](),controller[_0xb1e7('0xf')]);router[_0xb1e7('0x10')](_0xb1e7('0xc'),auth[_0xb1e7('0xa')](),controller[_0xb1e7('0x11')]);router[_0xb1e7('0x12')](_0xb1e7('0xc'),auth['isAuthenticated'](),controller[_0xb1e7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 53a09c8..2ec9c45 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 _0xa9e7=['ENUM','keyValue','string','STRING','variable','customVariable','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e7,0xfa));var _0x7a9e=function(_0x149c1f,_0x7b4dc6){_0x149c1f=_0x149c1f-0x0;var _0x309eeb=_0xa9e7[_0x149c1f];return _0x309eeb;};'use strict';var Sequelize=require(_0x7a9e('0x0'));module[_0x7a9e('0x1')]={'type':{'type':Sequelize[_0x7a9e('0x2')]('string','variable','customVariable',_0x7a9e('0x3')),'defaultValue':_0x7a9e('0x4')},'content':{'type':Sequelize[_0x7a9e('0x5')]},'key':{'type':Sequelize[_0x7a9e('0x5')]},'keyType':{'type':Sequelize[_0x7a9e('0x2')](_0x7a9e('0x4'),_0x7a9e('0x6'),_0x7a9e('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7a9e('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7a9e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7a9e('0x5')]}}; \ No newline at end of file +var _0x359a=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x22d81b,_0x17039a){var _0xba37c5=function(_0x5b29c8){while(--_0x5b29c8){_0x22d81b['push'](_0x22d81b['shift']());}};_0xba37c5(++_0x17039a);}(_0x359a,0x153));var _0xa359=function(_0x22826c,_0x562e83){_0x22826c=_0x22826c-0x0;var _0x1725a4=_0x359a[_0x22826c];return _0x1725a4;};'use strict';var Sequelize=require(_0xa359('0x0'));module[_0xa359('0x1')]={'type':{'type':Sequelize[_0xa359('0x2')](_0xa359('0x3'),_0xa359('0x4'),'customVariable',_0xa359('0x5')),'defaultValue':_0xa359('0x3')},'content':{'type':Sequelize[_0xa359('0x6')]},'key':{'type':Sequelize[_0xa359('0x6')]},'keyType':{'type':Sequelize[_0xa359('0x2')](_0xa359('0x3'),_0xa359('0x4'),_0xa359('0x7'))},'keyContent':{'type':Sequelize[_0xa359('0x6')]},'idField':{'type':Sequelize[_0xa359('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa359('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 8e47d68..8bf7694 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 _0x6dd8=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','rows','catch','params','intersection','options','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x54de06,_0x391c3b){var _0x3610a7=function(_0x21e884){while(--_0x21e884){_0x54de06['push'](_0x54de06['shift']());}};_0x3610a7(++_0x391c3b);}(_0x6dd8,0x87));var _0x86dd=function(_0x145f15,_0x3837a3){_0x145f15=_0x145f15-0x0;var _0x1dd966=_0x6dd8[_0x145f15];return _0x1dd966;};'use strict';var pdf=require(_0x86dd('0x0'));var emlformat=require(_0x86dd('0x1'));var rimraf=require(_0x86dd('0x2'));var zipdir=require(_0x86dd('0x3'));var jsonpatch=require(_0x86dd('0x4'));var rp=require(_0x86dd('0x5'));var moment=require('moment');var BPromise=require(_0x86dd('0x6'));var Mustache=require(_0x86dd('0x7'));var util=require(_0x86dd('0x8'));var path=require(_0x86dd('0x9'));var sox=require(_0x86dd('0xa'));var csv=require(_0x86dd('0xb'));var ejs=require(_0x86dd('0xc'));var fs=require('fs');var _=require(_0x86dd('0xd'));var squel=require(_0x86dd('0xe'));var crypto=require(_0x86dd('0xf'));var jsforce=require(_0x86dd('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x86dd('0x11'));var Papa=require(_0x86dd('0x12'));var Redis=require(_0x86dd('0x13'));var authService=require(_0x86dd('0x14'));var qs=require(_0x86dd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86dd('0x16'));var logger=require(_0x86dd('0x17'))(_0x86dd('0x18'));var utils=require(_0x86dd('0x19'));var config=require(_0x86dd('0x1a'));var db=require(_0x86dd('0x1b'))['db'];function respondWithStatusCode(_0x3faf29,_0x4f187b){_0x4f187b=_0x4f187b||0xcc;return function(_0x5d0146){if(_0x5d0146){return _0x3faf29[_0x86dd('0x1c')](_0x4f187b);}return _0x3faf29[_0x86dd('0x1d')](_0x4f187b)['end']();};}function respondWithResult(_0x2fc1bf,_0x4062da){_0x4062da=_0x4062da||0xc8;return function(_0x986836){if(_0x986836){return _0x2fc1bf[_0x86dd('0x1d')](_0x4062da)[_0x86dd('0x1e')](_0x986836);}};}function respondWithFilteredResult(_0x3c00e5,_0x35aa93){return function(_0x127977){if(_0x127977){var _0x3ea11=_0x127977['count'],_0x28177d=_0x35aa93[_0x86dd('0x1f')],_0x52a837=_0x35aa93[_0x86dd('0x1f')]+_0x35aa93['limit'],_0x3e2d7a;if(_0x52a837>=_0x3ea11){_0x52a837=_0x3ea11;_0x3e2d7a=0xc8;}else{_0x3e2d7a=0xce;}_0x3c00e5['status'](_0x3e2d7a);return _0x3c00e5[_0x86dd('0x20')](_0x86dd('0x21'),_0x28177d+'-'+_0x52a837+'/'+_0x3ea11)[_0x86dd('0x1e')](_0x127977);}return null;};}function patchUpdates(_0x12a943){return function(_0x3f1eeb){try{jsonpatch[_0x86dd('0x22')](_0x3f1eeb,_0x12a943,!![]);}catch(_0x2d945c){return BPromise[_0x86dd('0x23')](_0x2d945c);}return _0x3f1eeb[_0x86dd('0x24')]();};}function saveUpdates(_0x21ef48,_0x2bc04c){return function(_0x3b3ba8){if(_0x3b3ba8){return _0x3b3ba8[_0x86dd('0x25')](_0x21ef48)[_0x86dd('0x26')](function(_0x43605d){return _0x43605d;});}return null;};}function removeEntity(_0x12eced,_0x524a75){return function(_0x1c63c7){if(_0x1c63c7){return _0x1c63c7[_0x86dd('0x27')]()[_0x86dd('0x26')](function(){_0x12eced[_0x86dd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x563f11,_0x39d556){return function(_0x42ea29){if(!_0x42ea29){_0x563f11[_0x86dd('0x1c')](0x194);}return _0x42ea29;};}function handleError(_0x117312,_0x27ea17){_0x27ea17=_0x27ea17||0x1f4;return function(_0x2ce577){logger['error'](_0x2ce577[_0x86dd('0x28')]);if(_0x2ce577['name']){delete _0x2ce577[_0x86dd('0x29')];}_0x117312[_0x86dd('0x1d')](_0x27ea17)['send'](_0x2ce577);};}exports['index']=function(_0x434ba1,_0x7fa460){var _0x2b54cc={},_0xf595f6={},_0x43b480={'count':0x0,'rows':[]};var _0x562041=_['map'](db[_0x86dd('0x2a')][_0x86dd('0x2b')],function(_0x3a9024){return{'name':_0x3a9024[_0x86dd('0x2c')],'type':_0x3a9024[_0x86dd('0x2d')][_0x86dd('0x2e')]};});_0xf595f6[_0x86dd('0x2f')]=_[_0x86dd('0x30')](_0x562041,_0x86dd('0x29'));_0xf595f6[_0x86dd('0x31')]=_[_0x86dd('0x32')](_0x434ba1[_0x86dd('0x31')]);_0xf595f6[_0x86dd('0x33')]=_['intersection'](_0xf595f6[_0x86dd('0x2f')],_0xf595f6['query']);_0x2b54cc[_0x86dd('0x34')]=_['intersection'](_0xf595f6[_0x86dd('0x2f')],qs[_0x86dd('0x35')](_0x434ba1['query']['fields']));_0x2b54cc['attributes']=_0x2b54cc[_0x86dd('0x34')][_0x86dd('0x36')]?_0x2b54cc[_0x86dd('0x34')]:_0xf595f6[_0x86dd('0x2f')];if(!_0x434ba1[_0x86dd('0x31')][_0x86dd('0x37')](_0x86dd('0x38'))){_0x2b54cc[_0x86dd('0x39')]=qs[_0x86dd('0x39')](_0x434ba1['query'][_0x86dd('0x39')]);_0x2b54cc['offset']=qs[_0x86dd('0x1f')](_0x434ba1[_0x86dd('0x31')][_0x86dd('0x1f')]);}_0x2b54cc[_0x86dd('0x3a')]=qs[_0x86dd('0x3b')](_0x434ba1[_0x86dd('0x31')][_0x86dd('0x3b')]);_0x2b54cc['where']=qs[_0x86dd('0x33')](_[_0x86dd('0x3c')](_0x434ba1[_0x86dd('0x31')],_0xf595f6[_0x86dd('0x33')]),_0x562041);if(_0x434ba1[_0x86dd('0x31')][_0x86dd('0x3d')]){_0x2b54cc[_0x86dd('0x3e')]=_[_0x86dd('0x3f')](_0x2b54cc['where'],{'$or':_[_0x86dd('0x30')](_0x562041,function(_0x5e28c5){if(_0x5e28c5[_0x86dd('0x2d')]!==_0x86dd('0x40')){var _0x2b9ce7={};_0x2b9ce7[_0x5e28c5[_0x86dd('0x29')]]={'$like':'%'+_0x434ba1[_0x86dd('0x31')][_0x86dd('0x3d')]+'%'};return _0x2b9ce7;}})});}_0x2b54cc=_['merge']({},_0x2b54cc,_0x434ba1['options']);var _0x297ee7={'where':_0x2b54cc[_0x86dd('0x3e')]};return db[_0x86dd('0x2a')][_0x86dd('0x41')](_0x297ee7)[_0x86dd('0x26')](function(_0x16918e){_0x43b480[_0x86dd('0x41')]=_0x16918e;if(_0x434ba1[_0x86dd('0x31')][_0x86dd('0x42')]){_0x2b54cc[_0x86dd('0x43')]=[{'all':!![]}];}return db[_0x86dd('0x2a')]['findAll'](_0x2b54cc);})[_0x86dd('0x26')](function(_0x1af69b){_0x43b480[_0x86dd('0x44')]=_0x1af69b;return _0x43b480;})[_0x86dd('0x26')](respondWithFilteredResult(_0x7fa460,_0x2b54cc))[_0x86dd('0x45')](handleError(_0x7fa460,null));};exports['show']=function(_0x4a7991,_0x15b934){var _0x4938c7={'raw':!![],'where':{'id':_0x4a7991[_0x86dd('0x46')]['id']}},_0x9f18b5={};_0x9f18b5[_0x86dd('0x2f')]=_[_0x86dd('0x32')](db[_0x86dd('0x2a')]['rawAttributes']);_0x9f18b5['query']=_[_0x86dd('0x32')](_0x4a7991[_0x86dd('0x31')]);_0x9f18b5[_0x86dd('0x33')]=_[_0x86dd('0x47')](_0x9f18b5[_0x86dd('0x2f')],_0x9f18b5['query']);_0x4938c7[_0x86dd('0x34')]=_[_0x86dd('0x47')](_0x9f18b5[_0x86dd('0x2f')],qs[_0x86dd('0x35')](_0x4a7991['query'][_0x86dd('0x35')]));_0x4938c7['attributes']=_0x4938c7[_0x86dd('0x34')][_0x86dd('0x36')]?_0x4938c7[_0x86dd('0x34')]:_0x9f18b5[_0x86dd('0x2f')];if(_0x4a7991[_0x86dd('0x31')][_0x86dd('0x42')]){_0x4938c7[_0x86dd('0x43')]=[{'all':!![]}];}_0x4938c7=_['merge']({},_0x4938c7,_0x4a7991[_0x86dd('0x48')]);return db[_0x86dd('0x2a')][_0x86dd('0x49')](_0x4938c7)[_0x86dd('0x26')](handleEntityNotFound(_0x15b934,null))[_0x86dd('0x26')](respondWithResult(_0x15b934,null))['catch'](handleError(_0x15b934,null));};exports['create']=function(_0x186215,_0x1953c6){return db[_0x86dd('0x2a')]['create'](_0x186215[_0x86dd('0x4a')],{})[_0x86dd('0x26')](respondWithResult(_0x1953c6,0xc9))[_0x86dd('0x45')](handleError(_0x1953c6,null));};exports[_0x86dd('0x25')]=function(_0x3002f2,_0x190e16){if(_0x3002f2[_0x86dd('0x4a')]['id']){delete _0x3002f2[_0x86dd('0x4a')]['id'];}return db[_0x86dd('0x2a')][_0x86dd('0x49')]({'where':{'id':_0x3002f2[_0x86dd('0x46')]['id']}})[_0x86dd('0x26')](handleEntityNotFound(_0x190e16,null))[_0x86dd('0x26')](saveUpdates(_0x3002f2[_0x86dd('0x4a')],null))[_0x86dd('0x26')](respondWithResult(_0x190e16,null))[_0x86dd('0x45')](handleError(_0x190e16,null));};exports['destroy']=function(_0x1dadb9,_0xcb8592){return db[_0x86dd('0x2a')]['find']({'where':{'id':_0x1dadb9[_0x86dd('0x46')]['id']}})[_0x86dd('0x26')](handleEntityNotFound(_0xcb8592,null))['then'](removeEntity(_0xcb8592,null))[_0x86dd('0x45')](handleError(_0xcb8592,null));}; \ No newline at end of file +var _0xc7d1=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','send','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','catch','options','create','body','update','params','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x30b37d,_0x13fc3c){var _0x2cb056=function(_0x43fbcd){while(--_0x43fbcd){_0x30b37d['push'](_0x30b37d['shift']());}};_0x2cb056(++_0x13fc3c);}(_0xc7d1,0x7e));var _0x1c7d=function(_0x49eb51,_0x5405b1){_0x49eb51=_0x49eb51-0x0;var _0x2af309=_0xc7d1[_0x49eb51];return _0x2af309;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1c7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c7d('0x1'));var jsonpatch=require(_0x1c7d('0x2'));var rp=require(_0x1c7d('0x3'));var moment=require('moment');var BPromise=require(_0x1c7d('0x4'));var Mustache=require('mustache');var util=require(_0x1c7d('0x5'));var path=require('path');var sox=require(_0x1c7d('0x6'));var csv=require(_0x1c7d('0x7'));var ejs=require(_0x1c7d('0x8'));var fs=require('fs');var _=require(_0x1c7d('0x9'));var squel=require('squel');var crypto=require(_0x1c7d('0xa'));var jsforce=require(_0x1c7d('0xb'));var deskjs=require(_0x1c7d('0xc'));var toCsv=require(_0x1c7d('0x7'));var querystring=require(_0x1c7d('0xd'));var Papa=require(_0x1c7d('0xe'));var Redis=require(_0x1c7d('0xf'));var authService=require(_0x1c7d('0x10'));var qs=require(_0x1c7d('0x11'));var as=require(_0x1c7d('0x12'));var hardwareService=require(_0x1c7d('0x13'));var logger=require(_0x1c7d('0x14'))(_0x1c7d('0x15'));var utils=require('../../config/utils');var config=require(_0x1c7d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34b540,_0x418a40){_0x418a40=_0x418a40||0xcc;return function(_0x542cc7){if(_0x542cc7){return _0x34b540['sendStatus'](_0x418a40);}return _0x34b540[_0x1c7d('0x17')](_0x418a40)[_0x1c7d('0x18')]();};}function respondWithResult(_0x4cdeea,_0x4077f2){_0x4077f2=_0x4077f2||0xc8;return function(_0x1759a8){if(_0x1759a8){return _0x4cdeea['status'](_0x4077f2)[_0x1c7d('0x19')](_0x1759a8);}};}function respondWithFilteredResult(_0x3f9c1d,_0x546101){return function(_0x2a519f){if(_0x2a519f){var _0x46f3d8=_0x2a519f[_0x1c7d('0x1a')],_0x54c76d=_0x546101[_0x1c7d('0x1b')],_0x2922d8=_0x546101[_0x1c7d('0x1b')]+_0x546101[_0x1c7d('0x1c')],_0x2f11d2;if(_0x2922d8>=_0x46f3d8){_0x2922d8=_0x46f3d8;_0x2f11d2=0xc8;}else{_0x2f11d2=0xce;}_0x3f9c1d[_0x1c7d('0x17')](_0x2f11d2);return _0x3f9c1d[_0x1c7d('0x1d')](_0x1c7d('0x1e'),_0x54c76d+'-'+_0x2922d8+'/'+_0x46f3d8)[_0x1c7d('0x19')](_0x2a519f);}return null;};}function patchUpdates(_0x318517){return function(_0x400adf){try{jsonpatch[_0x1c7d('0x1f')](_0x400adf,_0x318517,!![]);}catch(_0x59e924){return BPromise[_0x1c7d('0x20')](_0x59e924);}return _0x400adf['save']();};}function saveUpdates(_0x4bacb7,_0x419dfb){return function(_0xe9190d){if(_0xe9190d){return _0xe9190d['update'](_0x4bacb7)[_0x1c7d('0x21')](function(_0x35661c){return _0x35661c;});}return null;};}function removeEntity(_0x52826c,_0xca9a6d){return function(_0x7f5ec){if(_0x7f5ec){return _0x7f5ec[_0x1c7d('0x22')]()[_0x1c7d('0x21')](function(){_0x52826c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20edc3,_0xb30108){return function(_0x3d68e7){if(!_0x3d68e7){_0x20edc3[_0x1c7d('0x23')](0x194);}return _0x3d68e7;};}function handleError(_0x39f685,_0x3e2cde){_0x3e2cde=_0x3e2cde||0x1f4;return function(_0xe5f5df){logger[_0x1c7d('0x24')](_0xe5f5df[_0x1c7d('0x25')]);if(_0xe5f5df['name']){delete _0xe5f5df['name'];}_0x39f685[_0x1c7d('0x17')](_0x3e2cde)[_0x1c7d('0x26')](_0xe5f5df);};}exports[_0x1c7d('0x27')]=function(_0x261166,_0x2975ff){var _0xb456ba={},_0x527f59={},_0x49b74a={'count':0x0,'rows':[]};var _0x2523d4=_['map'](db[_0x1c7d('0x28')][_0x1c7d('0x29')],function(_0x3cf4e3){return{'name':_0x3cf4e3[_0x1c7d('0x2a')],'type':_0x3cf4e3[_0x1c7d('0x2b')][_0x1c7d('0x2c')]};});_0x527f59[_0x1c7d('0x2d')]=_[_0x1c7d('0x2e')](_0x2523d4,_0x1c7d('0x2f'));_0x527f59[_0x1c7d('0x30')]=_[_0x1c7d('0x31')](_0x261166['query']);_0x527f59[_0x1c7d('0x32')]=_[_0x1c7d('0x33')](_0x527f59['model'],_0x527f59[_0x1c7d('0x30')]);_0xb456ba[_0x1c7d('0x34')]=_[_0x1c7d('0x33')](_0x527f59[_0x1c7d('0x2d')],qs[_0x1c7d('0x35')](_0x261166[_0x1c7d('0x30')][_0x1c7d('0x35')]));_0xb456ba['attributes']=_0xb456ba['attributes'][_0x1c7d('0x36')]?_0xb456ba[_0x1c7d('0x34')]:_0x527f59[_0x1c7d('0x2d')];if(!_0x261166[_0x1c7d('0x30')][_0x1c7d('0x37')](_0x1c7d('0x38'))){_0xb456ba[_0x1c7d('0x1c')]=qs[_0x1c7d('0x1c')](_0x261166['query'][_0x1c7d('0x1c')]);_0xb456ba[_0x1c7d('0x1b')]=qs[_0x1c7d('0x1b')](_0x261166[_0x1c7d('0x30')][_0x1c7d('0x1b')]);}_0xb456ba['order']=qs['sort'](_0x261166['query'][_0x1c7d('0x39')]);_0xb456ba['where']=qs[_0x1c7d('0x32')](_[_0x1c7d('0x3a')](_0x261166['query'],_0x527f59['filters']),_0x2523d4);if(_0x261166['query'][_0x1c7d('0x3b')]){_0xb456ba['where']=_[_0x1c7d('0x3c')](_0xb456ba['where'],{'$or':_[_0x1c7d('0x2e')](_0x2523d4,function(_0x2ad7dc){if(_0x2ad7dc['type']!==_0x1c7d('0x3d')){var _0xd15c98={};_0xd15c98[_0x2ad7dc[_0x1c7d('0x2f')]]={'$like':'%'+_0x261166[_0x1c7d('0x30')][_0x1c7d('0x3b')]+'%'};return _0xd15c98;}})});}_0xb456ba=_[_0x1c7d('0x3c')]({},_0xb456ba,_0x261166['options']);var _0x2489f={'where':_0xb456ba[_0x1c7d('0x3e')]};return db[_0x1c7d('0x28')]['count'](_0x2489f)[_0x1c7d('0x21')](function(_0x135548){_0x49b74a[_0x1c7d('0x1a')]=_0x135548;if(_0x261166[_0x1c7d('0x30')][_0x1c7d('0x3f')]){_0xb456ba[_0x1c7d('0x40')]=[{'all':!![]}];}return db[_0x1c7d('0x28')]['findAll'](_0xb456ba);})[_0x1c7d('0x21')](function(_0x3e2b24){_0x49b74a['rows']=_0x3e2b24;return _0x49b74a;})[_0x1c7d('0x21')](respondWithFilteredResult(_0x2975ff,_0xb456ba))[_0x1c7d('0x41')](handleError(_0x2975ff,null));};exports['show']=function(_0x288b14,_0x49ee71){var _0x33fb9e={'raw':!![],'where':{'id':_0x288b14['params']['id']}},_0x299595={};_0x299595[_0x1c7d('0x2d')]=_['keys'](db[_0x1c7d('0x28')][_0x1c7d('0x29')]);_0x299595[_0x1c7d('0x30')]=_[_0x1c7d('0x31')](_0x288b14[_0x1c7d('0x30')]);_0x299595[_0x1c7d('0x32')]=_[_0x1c7d('0x33')](_0x299595[_0x1c7d('0x2d')],_0x299595['query']);_0x33fb9e[_0x1c7d('0x34')]=_[_0x1c7d('0x33')](_0x299595[_0x1c7d('0x2d')],qs[_0x1c7d('0x35')](_0x288b14[_0x1c7d('0x30')]['fields']));_0x33fb9e[_0x1c7d('0x34')]=_0x33fb9e[_0x1c7d('0x34')]['length']?_0x33fb9e['attributes']:_0x299595[_0x1c7d('0x2d')];if(_0x288b14[_0x1c7d('0x30')][_0x1c7d('0x3f')]){_0x33fb9e[_0x1c7d('0x40')]=[{'all':!![]}];}_0x33fb9e=_[_0x1c7d('0x3c')]({},_0x33fb9e,_0x288b14[_0x1c7d('0x42')]);return db['SugarcrmField']['find'](_0x33fb9e)[_0x1c7d('0x21')](handleEntityNotFound(_0x49ee71,null))[_0x1c7d('0x21')](respondWithResult(_0x49ee71,null))[_0x1c7d('0x41')](handleError(_0x49ee71,null));};exports[_0x1c7d('0x43')]=function(_0x3623b7,_0x59ca26){return db[_0x1c7d('0x28')][_0x1c7d('0x43')](_0x3623b7[_0x1c7d('0x44')],{})[_0x1c7d('0x21')](respondWithResult(_0x59ca26,0xc9))[_0x1c7d('0x41')](handleError(_0x59ca26,null));};exports[_0x1c7d('0x45')]=function(_0x453bab,_0x450b0e){if(_0x453bab['body']['id']){delete _0x453bab['body']['id'];}return db[_0x1c7d('0x28')]['find']({'where':{'id':_0x453bab[_0x1c7d('0x46')]['id']}})[_0x1c7d('0x21')](handleEntityNotFound(_0x450b0e,null))[_0x1c7d('0x21')](saveUpdates(_0x453bab[_0x1c7d('0x44')],null))['then'](respondWithResult(_0x450b0e,null))[_0x1c7d('0x41')](handleError(_0x450b0e,null));};exports[_0x1c7d('0x22')]=function(_0x49320c,_0x40170e){return db[_0x1c7d('0x28')][_0x1c7d('0x47')]({'where':{'id':_0x49320c[_0x1c7d('0x46')]['id']}})[_0x1c7d('0x21')](handleEntityNotFound(_0x40170e,null))['then'](removeEntity(_0x40170e,null))[_0x1c7d('0x41')](handleError(_0x40170e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index fe65061..1a7214a 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 _0xb7f3=['sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x547321,_0xd2311d){var _0x786235=function(_0x42e82a){while(--_0x42e82a){_0x547321['push'](_0x547321['shift']());}};_0x786235(++_0xd2311d);}(_0xb7f3,0xc6));var _0x3b7f=function(_0x9ed876,_0x35aca0){_0x9ed876=_0x9ed876-0x0;var _0x4db02e=_0xb7f3[_0x9ed876];return _0x4db02e;};'use strict';var _=require(_0x3b7f('0x0'));var util=require(_0x3b7f('0x1'));var logger=require(_0x3b7f('0x2'))(_0x3b7f('0x3'));var moment=require(_0x3b7f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b7f('0x6'));var config=require(_0x3b7f('0x7'));var attributes=require(_0x3b7f('0x8'));module['exports']=function(_0x5c619b,_0x58a21c){return _0x5c619b[_0x3b7f('0x9')](_0x3b7f('0xa'),attributes,{'tableName':_0x3b7f('0xb'),'paranoid':![],'indexes':[{'name':_0x3b7f('0xc'),'fields':[_0x3b7f('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee2b=['FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xee2b,0x1c1));var _0xbee2=function(_0x453dcb,_0x2f260b){_0x453dcb=_0x453dcb-0x0;var _0x1a09e4=_0xee2b[_0x453dcb];return _0x1a09e4;};'use strict';var _=require(_0xbee2('0x0'));var util=require('util');var logger=require(_0xbee2('0x1'))(_0xbee2('0x2'));var moment=require(_0xbee2('0x3'));var BPromise=require(_0xbee2('0x4'));var rp=require(_0xbee2('0x5'));var fs=require('fs');var path=require(_0xbee2('0x6'));var rimraf=require(_0xbee2('0x7'));var config=require(_0xbee2('0x8'));var attributes=require(_0xbee2('0x9'));module[_0xbee2('0xa')]=function(_0x3aec32,_0x252ae1){return _0x3aec32[_0xbee2('0xb')](_0xbee2('0xc'),attributes,{'tableName':_0xbee2('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xbee2('0xe'),_0xbee2('0xf')],'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 d6c2ca3..bef4961 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 _0x5eb8=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x45b807,_0x24131c){var _0x291ceb=function(_0x41cf87){while(--_0x41cf87){_0x45b807['push'](_0x45b807['shift']());}};_0x291ceb(++_0x24131c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5ca784,_0x28bea2){_0x5ca784=_0x5ca784-0x0;var _0x5aa579=_0x5eb8[_0x5ca784];return _0x5aa579;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ 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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8603,0x190));var _0x3860=function(_0x50bace,_0x16f8b7){_0x50bace=_0x50bace-0x0;var _0x25dc5e=_0x8603[_0x50bace];return _0x25dc5e;};'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 1d3b0c6..ddd9821 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 _0xa221=['multer','express','Router','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','exports'];(function(_0x3d82b4,_0x371265){var _0x17dfb7=function(_0x3b1e21){while(--_0x3b1e21){_0x3d82b4['push'](_0x3d82b4['shift']());}};_0x17dfb7(++_0x371265);}(_0xa221,0x1c2));var _0x1a22=function(_0x39b1eb,_0x43af9b){_0x39b1eb=_0x39b1eb-0x0;var _0x435246=_0xa221[_0x39b1eb];return _0x435246;};'use strict';var multer=require(_0x1a22('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1a22('0x1'));var router=express[_0x1a22('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a22('0x3'));var controller=require(_0x1a22('0x4'));router[_0x1a22('0x5')]('/',auth[_0x1a22('0x6')](),controller['index']);router[_0x1a22('0x5')](_0x1a22('0x7'),auth[_0x1a22('0x6')](),controller['show']);router[_0x1a22('0x5')](_0x1a22('0x8'),auth[_0x1a22('0x6')](),controller[_0x1a22('0x9')]);router[_0x1a22('0x5')]('/:id/fields',auth[_0x1a22('0x6')](),controller[_0x1a22('0xa')]);router[_0x1a22('0xb')]('/',auth[_0x1a22('0x6')](),controller[_0x1a22('0xc')]);router[_0x1a22('0xb')](_0x1a22('0x8'),auth[_0x1a22('0x6')](),controller[_0x1a22('0xd')]);router[_0x1a22('0xe')](_0x1a22('0x7'),auth[_0x1a22('0x6')](),controller[_0x1a22('0xf')]);router['delete'](_0x1a22('0x7'),auth['isAuthenticated'](),controller[_0x1a22('0x10')]);module[_0x1a22('0x11')]=router; \ No newline at end of file +var _0xfd14=['connect-timeout','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','exports','multer','util','path'];(function(_0x1f7367,_0x2c635e){var _0x5e048f=function(_0x14399d){while(--_0x14399d){_0x1f7367['push'](_0x1f7367['shift']());}};_0x5e048f(++_0x2c635e);}(_0xfd14,0xd9));var _0x4fd1=function(_0xbd0857,_0x46de4f){_0xbd0857=_0xbd0857-0x0;var _0x515b38=_0xfd14[_0xbd0857];return _0x515b38;};'use strict';var multer=require(_0x4fd1('0x0'));var util=require(_0x4fd1('0x1'));var path=require(_0x4fd1('0x2'));var timeout=require(_0x4fd1('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x4fd1('0x4'));var interaction=require(_0x4fd1('0x5'));var config=require('../../config/environment');var controller=require(_0x4fd1('0x6'));router[_0x4fd1('0x7')]('/',auth[_0x4fd1('0x8')](),controller[_0x4fd1('0x9')]);router[_0x4fd1('0x7')](_0x4fd1('0xa'),auth[_0x4fd1('0x8')](),controller['show']);router[_0x4fd1('0x7')](_0x4fd1('0xb'),auth[_0x4fd1('0x8')](),controller['getConfigurations']);router[_0x4fd1('0x7')](_0x4fd1('0xc'),auth[_0x4fd1('0x8')](),controller[_0x4fd1('0xd')]);router[_0x4fd1('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4fd1('0xe')](_0x4fd1('0xb'),auth[_0x4fd1('0x8')](),controller[_0x4fd1('0xf')]);router['put'](_0x4fd1('0xa'),auth[_0x4fd1('0x8')](),controller[_0x4fd1('0x10')]);router[_0x4fd1('0x11')](_0x4fd1('0xa'),auth[_0x4fd1('0x8')](),controller[_0x4fd1('0x12')]);module[_0x4fd1('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 22ec08e..b946caf 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 _0xac88=['HelpDesk','sequelize','exports','STRING'];(function(_0x47120,_0x4e4359){var _0x6e0048=function(_0x570f0c){while(--_0x570f0c){_0x47120['push'](_0x47120['shift']());}};_0x6e0048(++_0x4e4359);}(_0xac88,0x141));var _0x8ac8=function(_0x3604f2,_0x2f369b){_0x3604f2=_0x3604f2-0x0;var _0x238dc0=_0xac88[_0x3604f2];return _0x238dc0;};'use strict';var Sequelize=require(_0x8ac8('0x0'));module[_0x8ac8('0x1')]={'name':{'type':Sequelize[_0x8ac8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8ac8('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8ac8('0x2')],'allowNull':![],'defaultValue':_0x8ac8('0x3')},'remoteUri':{'type':Sequelize[_0x8ac8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8ac8('0x2')]},'accessKey':{'type':Sequelize[_0x8ac8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdbf7=['STRING','sequelize'];(function(_0xc2b0f1,_0x56def6){var _0x488933=function(_0x570f15){while(--_0x570f15){_0xc2b0f1['push'](_0xc2b0f1['shift']());}};_0x488933(++_0x56def6);}(_0xdbf7,0x131));var _0x7dbf=function(_0x36c0eb,_0x3890ca){_0x36c0eb=_0x36c0eb-0x0;var _0x1d5727=_0xdbf7[_0x36c0eb];return _0x1d5727;};'use strict';var Sequelize=require(_0x7dbf('0x0'));module['exports']={'name':{'type':Sequelize[_0x7dbf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7dbf('0x1')]},'username':{'type':Sequelize[_0x7dbf('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7dbf('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x7dbf('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7dbf('0x1')]},'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 2dafb66..457ac1f 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 _0xdfe9=['remove','includes','false','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','stringify','send','Wrong\x20credentials','statusCode','html-pdf','eml-format','zip-dir','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','name','index','VtigerAccount','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','include','findAll','show','params','rawAttributes','includeAll','create','body','getConfigurations','VtigerConfiguration','sort','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','GET','getchallenge','POST','login','success','describe','sessionName','autogenerated','reference'];(function(_0x1efa0a,_0x166054){var _0xd75b88=function(_0x17f146){while(--_0x17f146){_0x1efa0a['push'](_0x1efa0a['shift']());}};_0xd75b88(++_0x166054);}(_0xdfe9,0x8a));var _0x9dfe=function(_0x180145,_0x356c7a){_0x180145=_0x180145-0x0;var _0x13aad7=_0xdfe9[_0x180145];return _0x13aad7;};'use strict';var pdf=require(_0x9dfe('0x0'));var emlformat=require(_0x9dfe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9dfe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9dfe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9dfe('0x4'));var path=require(_0x9dfe('0x5'));var sox=require(_0x9dfe('0x6'));var csv=require(_0x9dfe('0x7'));var ejs=require(_0x9dfe('0x8'));var fs=require('fs');var _=require(_0x9dfe('0x9'));var squel=require('squel');var crypto=require(_0x9dfe('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9dfe('0x7'));var querystring=require(_0x9dfe('0xb'));var Papa=require(_0x9dfe('0xc'));var Redis=require(_0x9dfe('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9dfe('0xe'));var as=require(_0x9dfe('0xf'));var hardwareService=require(_0x9dfe('0x10'));var logger=require(_0x9dfe('0x11'))(_0x9dfe('0x12'));var utils=require('../../config/utils');var config=require(_0x9dfe('0x13'));var db=require(_0x9dfe('0x14'))['db'];var integrations=require(_0x9dfe('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x9dfe('0x16')][_0x9dfe('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2a8019,_0x15d4fe,_0x11abdc){if(_0x11abdc){var _0x4421c5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4421c5['test'](_0x15d4fe)){return _0x2a8019;}else{throw new db[(_0x9dfe('0x18'))][(_0x9dfe('0x19'))](_0x9dfe('0x1a'));}}else{return _0x2a8019;}}function respondWithRpcPromise(_0x3e850c,_0x1b9825,_0x410757,_0x4c3c36){return new BPromise(function(_0x5cab6e,_0xc01291){var _0x363d56=_0x4c3c36||client;return _0x363d56[_0x9dfe('0x1b')](_0x3e850c,_0x410757)[_0x9dfe('0x1c')](function(_0x3fc36a){logger[_0x9dfe('0x1d')](_0x9dfe('0x1e'),_0x1b9825,_0x9dfe('0x1f'));logger[_0x9dfe('0x20')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1b9825,_0x9dfe('0x1f'),JSON['stringify'](_0x3fc36a));if(_0x3fc36a[_0x9dfe('0x21')]){if(_0x3fc36a[_0x9dfe('0x21')]['code']===0x1f4){logger[_0x9dfe('0x21')]('VtigerAccount,\x20%s,\x20%s',_0x1b9825,_0x3fc36a[_0x9dfe('0x21')]['message']);return _0xc01291(_0x3fc36a['error'][_0x9dfe('0x22')]);}logger['error'](_0x9dfe('0x1e'),_0x1b9825,_0x3fc36a[_0x9dfe('0x21')][_0x9dfe('0x22')]);return _0x5cab6e(_0x3fc36a['error'][_0x9dfe('0x22')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x1b9825,_0x9dfe('0x1f'));_0x5cab6e(_0x3fc36a[_0x9dfe('0x23')][_0x9dfe('0x22')]);}})[_0x9dfe('0x24')](function(_0x4a0e8b){logger[_0x9dfe('0x21')](_0x9dfe('0x1e'),_0x1b9825,_0x4a0e8b);_0xc01291(_0x4a0e8b);});});}function respondWithStatusCode(_0x2a5942,_0x453493){_0x453493=_0x453493||0xcc;return function(_0x910ff9){if(_0x910ff9){return _0x2a5942[_0x9dfe('0x25')](_0x453493);}return _0x2a5942[_0x9dfe('0x26')](_0x453493)[_0x9dfe('0x27')]();};}function respondWithResult(_0x454f57,_0x3526ee){_0x3526ee=_0x3526ee||0xc8;return function(_0x5c21d){if(_0x5c21d){return _0x454f57[_0x9dfe('0x26')](_0x3526ee)[_0x9dfe('0x28')](_0x5c21d);}};}function respondWithFilteredResult(_0x2c3068,_0x41de79){return function(_0x33a955){if(_0x33a955){var _0x4c0d99=_0x33a955['count'],_0x4fde9e=_0x41de79['offset'],_0x1bf544=_0x41de79[_0x9dfe('0x29')]+_0x41de79[_0x9dfe('0x2a')],_0x875907;if(_0x1bf544>=_0x4c0d99){_0x1bf544=_0x4c0d99;_0x875907=0xc8;}else{_0x875907=0xce;}_0x2c3068[_0x9dfe('0x26')](_0x875907);return _0x2c3068['set'](_0x9dfe('0x2b'),_0x4fde9e+'-'+_0x1bf544+'/'+_0x4c0d99)[_0x9dfe('0x28')](_0x33a955);}return null;};}function patchUpdates(_0x220adc){return function(_0x38349e){try{jsonpatch['apply'](_0x38349e,_0x220adc,!![]);}catch(_0x1d15be){return BPromise[_0x9dfe('0x2c')](_0x1d15be);}return _0x38349e[_0x9dfe('0x2d')]();};}function saveUpdates(_0x10ac4a,_0x17da7c){return function(_0x1de91a){if(_0x1de91a){return _0x1de91a[_0x9dfe('0x2e')](_0x10ac4a)['then'](function(_0x1f11df){return _0x1f11df;});}return null;};}function removeEntity(_0x5b4186,_0x2294f6){return function(_0x2dd872){if(_0x2dd872){return _0x2dd872['destroy']()[_0x9dfe('0x1c')](function(){_0x5b4186[_0x9dfe('0x26')](0xcc)[_0x9dfe('0x27')]();});}};}function handleEntityNotFound(_0x56588b,_0x570609){return function(_0x275b39){if(!_0x275b39){_0x56588b[_0x9dfe('0x25')](0x194);}return _0x275b39;};}function handleError(_0x1577f4,_0x578278){_0x578278=_0x578278||0x1f4;return function(_0x16e830){logger[_0x9dfe('0x21')](_0x16e830['stack']);if(_0x16e830[_0x9dfe('0x2f')]){delete _0x16e830[_0x9dfe('0x2f')];}_0x1577f4[_0x9dfe('0x26')](_0x578278)['send'](_0x16e830);};}exports[_0x9dfe('0x30')]=function(_0xe22818,_0x30b6de){var _0x507870={},_0x4cfced={},_0x5f09a6={'count':0x0,'rows':[]};var _0x34fb03=_['map'](db[_0x9dfe('0x31')]['rawAttributes'],function(_0x29dd8c){return{'name':_0x29dd8c[_0x9dfe('0x32')],'type':_0x29dd8c[_0x9dfe('0x33')][_0x9dfe('0x34')]};});_0x4cfced[_0x9dfe('0x35')]=_[_0x9dfe('0x36')](_0x34fb03,_0x9dfe('0x2f'));_0x4cfced['query']=_[_0x9dfe('0x37')](_0xe22818['query']);_0x4cfced[_0x9dfe('0x38')]=_[_0x9dfe('0x39')](_0x4cfced['model'],_0x4cfced[_0x9dfe('0x3a')]);_0x507870['attributes']=_[_0x9dfe('0x39')](_0x4cfced[_0x9dfe('0x35')],qs['fields'](_0xe22818['query'][_0x9dfe('0x3b')]));_0x507870[_0x9dfe('0x3c')]=_0x507870[_0x9dfe('0x3c')][_0x9dfe('0x3d')]?_0x507870[_0x9dfe('0x3c')]:_0x4cfced[_0x9dfe('0x35')];if(!_0xe22818[_0x9dfe('0x3a')][_0x9dfe('0x3e')](_0x9dfe('0x3f'))){_0x507870[_0x9dfe('0x2a')]=qs[_0x9dfe('0x2a')](_0xe22818[_0x9dfe('0x3a')][_0x9dfe('0x2a')]);_0x507870[_0x9dfe('0x29')]=qs[_0x9dfe('0x29')](_0xe22818['query'][_0x9dfe('0x29')]);}_0x507870[_0x9dfe('0x40')]=qs['sort'](_0xe22818[_0x9dfe('0x3a')]['sort']);_0x507870[_0x9dfe('0x41')]=qs[_0x9dfe('0x38')](_[_0x9dfe('0x42')](_0xe22818['query'],_0x4cfced[_0x9dfe('0x38')]),_0x34fb03);if(_0xe22818[_0x9dfe('0x3a')]['filter']){_0x507870[_0x9dfe('0x41')]=_[_0x9dfe('0x43')](_0x507870[_0x9dfe('0x41')],{'$or':_['map'](_0x34fb03,function(_0x3f759b){if(_0x3f759b[_0x9dfe('0x33')]!==_0x9dfe('0x44')){var _0x59b970={};_0x59b970[_0x3f759b[_0x9dfe('0x2f')]]={'$like':'%'+_0xe22818[_0x9dfe('0x3a')][_0x9dfe('0x45')]+'%'};return _0x59b970;}})});}_0x507870=_[_0x9dfe('0x43')]({},_0x507870,_0xe22818[_0x9dfe('0x46')]);var _0x2bb46b={'where':_0x507870[_0x9dfe('0x41')]};return db[_0x9dfe('0x31')]['count'](_0x2bb46b)[_0x9dfe('0x1c')](function(_0x36636c){_0x5f09a6['count']=_0x36636c;if(_0xe22818[_0x9dfe('0x3a')]['includeAll']){_0x507870[_0x9dfe('0x47')]=[{'all':!![]}];}return db['VtigerAccount'][_0x9dfe('0x48')](_0x507870);})[_0x9dfe('0x1c')](function(_0x542662){_0x5f09a6['rows']=_0x542662;return _0x5f09a6;})[_0x9dfe('0x1c')](respondWithFilteredResult(_0x30b6de,_0x507870))['catch'](handleError(_0x30b6de,null));};exports[_0x9dfe('0x49')]=function(_0x1477cd,_0x44b217){var _0x28a7be={'raw':![],'where':{'id':_0x1477cd[_0x9dfe('0x4a')]['id']}},_0x179bae={};_0x179bae[_0x9dfe('0x35')]=_[_0x9dfe('0x37')](db[_0x9dfe('0x31')][_0x9dfe('0x4b')]);_0x179bae['query']=_[_0x9dfe('0x37')](_0x1477cd[_0x9dfe('0x3a')]);_0x179bae[_0x9dfe('0x38')]=_[_0x9dfe('0x39')](_0x179bae[_0x9dfe('0x35')],_0x179bae[_0x9dfe('0x3a')]);_0x28a7be[_0x9dfe('0x3c')]=_[_0x9dfe('0x39')](_0x179bae['model'],qs[_0x9dfe('0x3b')](_0x1477cd[_0x9dfe('0x3a')]['fields']));_0x28a7be[_0x9dfe('0x3c')]=_0x28a7be[_0x9dfe('0x3c')]['length']?_0x28a7be[_0x9dfe('0x3c')]:_0x179bae[_0x9dfe('0x35')];if(_0x1477cd[_0x9dfe('0x3a')][_0x9dfe('0x4c')]){_0x28a7be[_0x9dfe('0x47')]=[{'all':!![]}];}_0x28a7be=_['merge']({},_0x28a7be,_0x1477cd[_0x9dfe('0x46')]);return db['VtigerAccount']['find'](_0x28a7be)[_0x9dfe('0x1c')](handleEntityNotFound(_0x44b217,null))[_0x9dfe('0x1c')](respondWithResult(_0x44b217,null))[_0x9dfe('0x24')](handleError(_0x44b217,null));};exports[_0x9dfe('0x4d')]=function(_0x4ab503,_0x1e262e){return db['VtigerAccount'][_0x9dfe('0x4d')](_0x4ab503['body'],{})['then'](respondWithResult(_0x1e262e,0xc9))['catch'](handleError(_0x1e262e,null));};exports[_0x9dfe('0x2e')]=function(_0x567aab,_0x2d68c8){if(_0x567aab[_0x9dfe('0x4e')]['id']){delete _0x567aab[_0x9dfe('0x4e')]['id'];}return db[_0x9dfe('0x31')]['find']({'where':{'id':_0x567aab['params']['id']}})[_0x9dfe('0x1c')](handleEntityNotFound(_0x2d68c8,null))['then'](saveUpdates(_0x567aab['body'],null))['then'](respondWithResult(_0x2d68c8,null))[_0x9dfe('0x24')](handleError(_0x2d68c8,null));};exports['destroy']=function(_0x63e33c,_0x10b79e){return db[_0x9dfe('0x31')]['find']({'where':{'id':_0x63e33c[_0x9dfe('0x4a')]['id']}})[_0x9dfe('0x1c')](handleEntityNotFound(_0x10b79e,null))[_0x9dfe('0x1c')](removeEntity(_0x10b79e,null))[_0x9dfe('0x24')](handleError(_0x10b79e,null));};exports[_0x9dfe('0x4f')]=function(_0x1f009b,_0x4c7cce,_0x2bcc4d){var _0x26fc85={};var _0x239b72={};var _0x4d7d22;var _0x4dcf32;return db[_0x9dfe('0x31')]['findOne']({'where':{'id':_0x1f009b[_0x9dfe('0x4a')]['id']}})[_0x9dfe('0x1c')](handleEntityNotFound(_0x4c7cce,null))[_0x9dfe('0x1c')](function(_0x3fe115){if(_0x3fe115){_0x4d7d22=_0x3fe115;_0x239b72['model']=_[_0x9dfe('0x37')](db[_0x9dfe('0x50')][_0x9dfe('0x4b')]);_0x239b72[_0x9dfe('0x3a')]=_['keys'](_0x1f009b[_0x9dfe('0x3a')]);_0x239b72[_0x9dfe('0x38')]=_[_0x9dfe('0x39')](_0x239b72[_0x9dfe('0x35')],_0x239b72[_0x9dfe('0x3a')]);_0x26fc85['attributes']=_[_0x9dfe('0x39')](_0x239b72[_0x9dfe('0x35')],qs[_0x9dfe('0x3b')](_0x1f009b['query'][_0x9dfe('0x3b')]));_0x26fc85[_0x9dfe('0x3c')]=_0x26fc85['attributes'][_0x9dfe('0x3d')]?_0x26fc85[_0x9dfe('0x3c')]:_0x239b72['model'];_0x26fc85[_0x9dfe('0x40')]=qs['sort'](_0x1f009b['query'][_0x9dfe('0x51')]);_0x26fc85[_0x9dfe('0x41')]=qs[_0x9dfe('0x38')](_[_0x9dfe('0x42')](_0x1f009b[_0x9dfe('0x3a')],_0x239b72[_0x9dfe('0x38')]));if(_0x1f009b[_0x9dfe('0x3a')][_0x9dfe('0x45')]){_0x26fc85['where']=_['merge'](_0x26fc85[_0x9dfe('0x41')],{'$or':_[_0x9dfe('0x36')](_0x26fc85[_0x9dfe('0x3c')],function(_0x56daa9){var _0x484a90={};_0x484a90[_0x56daa9]={'$like':'%'+_0x1f009b['query'][_0x9dfe('0x45')]+'%'};return _0x484a90;})});}_0x26fc85=_['merge']({},_0x26fc85,_0x1f009b[_0x9dfe('0x46')]);return _0x4d7d22[_0x9dfe('0x4f')](_0x26fc85);}})[_0x9dfe('0x1c')](function(_0x2757ab){if(_0x2757ab){_0x4dcf32=_0x2757ab['length'];if(!_0x1f009b[_0x9dfe('0x3a')][_0x9dfe('0x3e')](_0x9dfe('0x3f'))){_0x26fc85[_0x9dfe('0x2a')]=qs['limit'](_0x1f009b['query'][_0x9dfe('0x2a')]);_0x26fc85['offset']=qs['offset'](_0x1f009b['query'][_0x9dfe('0x29')]);}return _0x4d7d22[_0x9dfe('0x4f')](_0x26fc85);}})[_0x9dfe('0x1c')](function(_0x178249){if(_0x178249){return _0x178249?{'count':_0x4dcf32,'rows':_0x178249}:null;}})[_0x9dfe('0x1c')](respondWithResult(_0x4c7cce,null))[_0x9dfe('0x24')](handleError(_0x4c7cce,null));};exports[_0x9dfe('0x52')]=function(_0x895e30,_0x4e082c,_0x123daf){if(_0x895e30['body']['id']){delete _0x895e30[_0x9dfe('0x4e')]['id'];}return db[_0x9dfe('0x31')][_0x9dfe('0x53')]({'where':{'id':_0x895e30['params']['id']}})[_0x9dfe('0x1c')](handleEntityNotFound(_0x4e082c,null))[_0x9dfe('0x1c')](function(_0x282ef8){if(_0x282ef8){_0x895e30[_0x9dfe('0x4e')][_0x9dfe('0x54')]=_0x282ef8['id'];_0x895e30['body'][_0x9dfe('0x55')]=integrations[_0x9dfe('0x56')](_0x895e30[_0x9dfe('0x4e')][_0x9dfe('0x57')],_0x895e30['body'][_0x9dfe('0x33')]);_0x895e30[_0x9dfe('0x4e')][_0x9dfe('0x58')]=integrations[_0x9dfe('0x59')](_0x895e30[_0x9dfe('0x4e')][_0x9dfe('0x57')],_0x895e30[_0x9dfe('0x4e')]['type']);return db[_0x9dfe('0x50')]['create'](_0x895e30['body'],{'include':[{'model':db[_0x9dfe('0x5a')],'as':_0x9dfe('0x55')},{'model':db[_0x9dfe('0x5a')],'as':'Descriptions'}]});}return null;})[_0x9dfe('0x1c')](respondWithResult(_0x4e082c,null))[_0x9dfe('0x24')](handleError(_0x4e082c,null));};var md5=require(_0x9dfe('0x5b'));exports[_0x9dfe('0x5c')]=function(_0x2e689c,_0x5e7086,_0x464cd7){var _0x39bf31=null;var _0x4ab797=null;var _0x2bafc3=null;var _0x166dbb=null;var _0x16130b='';return db[_0x9dfe('0x31')][_0x9dfe('0x53')]({'where':{'id':_0x2e689c[_0x9dfe('0x4a')]['id']},'attributes':['id',_0x9dfe('0x2f'),_0x9dfe('0x5d'),_0x9dfe('0x5e'),_0x9dfe('0x5f'),_0x9dfe('0x60'),_0x9dfe('0x61'),_0x9dfe('0x62')]})[_0x9dfe('0x1c')](handleEntityNotFound(_0x5e7086,null))[_0x9dfe('0x1c')](function(_0x107d00){if(_0x107d00){_0x39bf31=_0x107d00[_0x9dfe('0x5d')];_0x4ab797=_0x107d00['accessKey'];_0x2bafc3=_0x107d00[_0x9dfe('0x5f')];_0x16130b=_0x107d00[_0x9dfe('0x60')];var _0x3516f6=_0x16130b[_0x9dfe('0x63')](-0x1);if(_0x3516f6==='/'){_0x16130b=_0x16130b[_0x9dfe('0x64')](0x0,_0x16130b['lastIndexOf'](_0x3516f6));}_0x166dbb=util['format']('%s/webservice.php',_0x16130b);var _0x526c0e={'method':_0x9dfe('0x65'),'uri':_0x166dbb,'qs':{'operation':_0x9dfe('0x66'),'username':_0x107d00[_0x9dfe('0x5d')]},'json':!![]};return rp(_0x526c0e);}})['then'](function(_0x16de3f){if(_0x16de3f['success']){var _0x250411={'method':_0x9dfe('0x67'),'uri':_0x166dbb,'form':{'operation':_0x9dfe('0x68'),'username':_0x39bf31,'accessKey':md5(_0x16de3f['result']['token']+_0x4ab797)},'json':!![]};return rp(_0x250411);}})[_0x9dfe('0x1c')](function(_0x548764){if(_0x548764[_0x9dfe('0x69')]){var _0x4623af={'method':_0x9dfe('0x65'),'uri':_0x166dbb,'qs':{'operation':_0x9dfe('0x6a'),'username':_0x39bf31,'sessionName':_0x548764[_0x9dfe('0x23')][_0x9dfe('0x6b')],'elementType':_0x2bafc3},'json':!![]};return rp(_0x4623af);}})[_0x9dfe('0x1c')](function(_0x17f95b){if(_0x17f95b[_0x9dfe('0x69')]){var _0x383d45=[_0x9dfe('0x6c'),_0x9dfe('0x6d'),'owner'];_[_0x9dfe('0x6e')](_0x17f95b['result']['fields'],function(_0x383d8e){return _0x383d45[_0x9dfe('0x6f')](_0x383d8e[_0x9dfe('0x33')][_0x9dfe('0x2f')]);});_[_0x9dfe('0x6e')](_0x17f95b[_0x9dfe('0x23')][_0x9dfe('0x3b')],function(_0x22cfba){return _0x22cfba['editable']===_0x9dfe('0x70');});return{'count':_0x17f95b[_0x9dfe('0x23')][_0x9dfe('0x3b')]['length'],'rows':_['map'](_0x17f95b['result']['fields'],function(_0x4964df){return{'id':_0x4964df[_0x9dfe('0x2f')],'name':_0x4964df['label'],'custom':_['startsWith'](_0x4964df[_0x9dfe('0x2f')],_0x9dfe('0x71'))?!![]:![],'options':_0x4964df[_0x9dfe('0x33')][_0x9dfe('0x2f')]===_0x9dfe('0x72')&&_0x4964df[_0x9dfe('0x33')]['picklistValues'][_0x9dfe('0x3d')]>0x0?_[_0x9dfe('0x36')](_0x4964df[_0x9dfe('0x33')][_0x9dfe('0x73')],function(_0x16dd23){return{'name':_0x16dd23['label'],'value':_0x16dd23[_0x9dfe('0x74')]};}):[]};})};}})[_0x9dfe('0x1c')](respondWithResult(_0x5e7086,null))[_0x9dfe('0x24')](function(_0xa89f12){console[_0x9dfe('0x75')](_0x9dfe('0x76')+_0xa89f12);var _0x23fec5=_0x2e689c[_0x9dfe('0x3a')][_0x9dfe('0x77')]?0x1f4:_0xa89f12['statusCode']||0x1f4;logger[_0x9dfe('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x9dfe('0x5c'),_0x23fec5,JSON[_0x9dfe('0x78')](_0xa89f12));delete _0xa89f12['name'];if(_0x23fec5===0x191){_0x23fec5=0x190;}_0x5e7086[_0x9dfe('0x26')](_0x23fec5)[_0x9dfe('0x79')](_0x2e689c['query'][_0x9dfe('0x77')]?{'message':_0x9dfe('0x7a'),'statusCode':_0xa89f12[_0x9dfe('0x7b')]}:_0xa89f12);});}; \ No newline at end of file +var _0x7b0a=['picklistValues','value','log','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','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','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','name','send','VtigerAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','order','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','VtigerConfiguration','VtigerField','Subjects','Descriptions','md5','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','token','success','sessionName','reference','owner','includes','remove','editable','false','label','cf_','picklist'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7b0a,0x84));var _0xa7b0=function(_0x22acbd,_0x5687a9){_0x22acbd=_0x22acbd-0x0;var _0x598618=_0x7b0a[_0x22acbd];return _0x598618;};'use strict';var pdf=require(_0xa7b0('0x0'));var emlformat=require(_0xa7b0('0x1'));var rimraf=require(_0xa7b0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7b0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa7b0('0x4'));var util=require(_0xa7b0('0x5'));var path=require(_0xa7b0('0x6'));var sox=require(_0xa7b0('0x7'));var csv=require(_0xa7b0('0x8'));var ejs=require(_0xa7b0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa7b0('0xa'));var crypto=require(_0xa7b0('0xb'));var jsforce=require(_0xa7b0('0xc'));var deskjs=require(_0xa7b0('0xd'));var toCsv=require(_0xa7b0('0x8'));var querystring=require(_0xa7b0('0xe'));var Papa=require(_0xa7b0('0xf'));var Redis=require(_0xa7b0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa7b0('0x11'));var as=require(_0xa7b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7b0('0x13'))(_0xa7b0('0x14'));var utils=require(_0xa7b0('0x15'));var config=require(_0xa7b0('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xa7b0('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x3677a5,_0x2b053c,_0x54f333){if(_0x54f333){var _0x176d74=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x176d74[_0xa7b0('0x18')](_0x2b053c)){return _0x3677a5;}else{throw new db['Sequelize'][(_0xa7b0('0x19'))](_0xa7b0('0x1a'));}}else{return _0x3677a5;}}function respondWithRpcPromise(_0x3c7a8c,_0x5588e1,_0x5d30d5,_0x162340){return new BPromise(function(_0x14d2ca,_0x18c2b6){var _0x2709ed=_0x162340||client;return _0x2709ed[_0xa7b0('0x1b')](_0x3c7a8c,_0x5d30d5)['then'](function(_0x6a4e33){logger[_0xa7b0('0x1c')](_0xa7b0('0x1d'),_0x5588e1,_0xa7b0('0x1e'));logger[_0xa7b0('0x1f')](_0xa7b0('0x20'),_0x5588e1,_0xa7b0('0x1e'),JSON[_0xa7b0('0x21')](_0x6a4e33));if(_0x6a4e33[_0xa7b0('0x22')]){if(_0x6a4e33['error'][_0xa7b0('0x23')]===0x1f4){logger[_0xa7b0('0x22')](_0xa7b0('0x1d'),_0x5588e1,_0x6a4e33[_0xa7b0('0x22')][_0xa7b0('0x24')]);return _0x18c2b6(_0x6a4e33[_0xa7b0('0x22')][_0xa7b0('0x24')]);}logger[_0xa7b0('0x22')](_0xa7b0('0x1d'),_0x5588e1,_0x6a4e33[_0xa7b0('0x22')][_0xa7b0('0x24')]);return _0x14d2ca(_0x6a4e33[_0xa7b0('0x22')][_0xa7b0('0x24')]);}else{logger['info'](_0xa7b0('0x1d'),_0x5588e1,_0xa7b0('0x1e'));_0x14d2ca(_0x6a4e33[_0xa7b0('0x25')][_0xa7b0('0x24')]);}})[_0xa7b0('0x26')](function(_0x1f2dbe){logger['error'](_0xa7b0('0x1d'),_0x5588e1,_0x1f2dbe);_0x18c2b6(_0x1f2dbe);});});}function respondWithStatusCode(_0x5cde66,_0x119af0){_0x119af0=_0x119af0||0xcc;return function(_0x25919d){if(_0x25919d){return _0x5cde66[_0xa7b0('0x27')](_0x119af0);}return _0x5cde66[_0xa7b0('0x28')](_0x119af0)[_0xa7b0('0x29')]();};}function respondWithResult(_0x3aaaea,_0x3f68c8){_0x3f68c8=_0x3f68c8||0xc8;return function(_0x54444d){if(_0x54444d){return _0x3aaaea[_0xa7b0('0x28')](_0x3f68c8)['json'](_0x54444d);}};}function respondWithFilteredResult(_0x23bfd9,_0x4cf622){return function(_0x5320e3){if(_0x5320e3){var _0x225142=_0x5320e3[_0xa7b0('0x2a')],_0x50e1f2=_0x4cf622[_0xa7b0('0x2b')],_0x5109f9=_0x4cf622[_0xa7b0('0x2b')]+_0x4cf622[_0xa7b0('0x2c')],_0x15b6e0;if(_0x5109f9>=_0x225142){_0x5109f9=_0x225142;_0x15b6e0=0xc8;}else{_0x15b6e0=0xce;}_0x23bfd9[_0xa7b0('0x28')](_0x15b6e0);return _0x23bfd9['set'](_0xa7b0('0x2d'),_0x50e1f2+'-'+_0x5109f9+'/'+_0x225142)[_0xa7b0('0x2e')](_0x5320e3);}return null;};}function patchUpdates(_0x52448d){return function(_0x1bcf8e){try{jsonpatch[_0xa7b0('0x2f')](_0x1bcf8e,_0x52448d,!![]);}catch(_0x171ffd){return BPromise[_0xa7b0('0x30')](_0x171ffd);}return _0x1bcf8e['save']();};}function saveUpdates(_0x5ce7f6,_0xfd4916){return function(_0x4ec470){if(_0x4ec470){return _0x4ec470[_0xa7b0('0x31')](_0x5ce7f6)[_0xa7b0('0x32')](function(_0x2924da){return _0x2924da;});}return null;};}function removeEntity(_0x2e0b38,_0x2385c5){return function(_0x5b74d7){if(_0x5b74d7){return _0x5b74d7[_0xa7b0('0x33')]()[_0xa7b0('0x32')](function(){_0x2e0b38[_0xa7b0('0x28')](0xcc)[_0xa7b0('0x29')]();});}};}function handleEntityNotFound(_0x5df3b5,_0x49f45a){return function(_0xf1b240){if(!_0xf1b240){_0x5df3b5['sendStatus'](0x194);}return _0xf1b240;};}function handleError(_0x104a01,_0x48a9e5){_0x48a9e5=_0x48a9e5||0x1f4;return function(_0x1b1e86){logger[_0xa7b0('0x22')](_0x1b1e86['stack']);if(_0x1b1e86[_0xa7b0('0x34')]){delete _0x1b1e86['name'];}_0x104a01[_0xa7b0('0x28')](_0x48a9e5)[_0xa7b0('0x35')](_0x1b1e86);};}exports['index']=function(_0x543e2d,_0x21feb0){var _0x21fe2d={},_0x33f8c3={},_0x3365aa={'count':0x0,'rows':[]};var _0x1acadb=_['map'](db[_0xa7b0('0x36')][_0xa7b0('0x37')],function(_0x5c8b0f){return{'name':_0x5c8b0f[_0xa7b0('0x38')],'type':_0x5c8b0f[_0xa7b0('0x39')][_0xa7b0('0x3a')]};});_0x33f8c3[_0xa7b0('0x3b')]=_[_0xa7b0('0x3c')](_0x1acadb,'name');_0x33f8c3[_0xa7b0('0x3d')]=_[_0xa7b0('0x3e')](_0x543e2d['query']);_0x33f8c3[_0xa7b0('0x3f')]=_[_0xa7b0('0x40')](_0x33f8c3[_0xa7b0('0x3b')],_0x33f8c3[_0xa7b0('0x3d')]);_0x21fe2d[_0xa7b0('0x41')]=_['intersection'](_0x33f8c3[_0xa7b0('0x3b')],qs[_0xa7b0('0x42')](_0x543e2d[_0xa7b0('0x3d')]['fields']));_0x21fe2d[_0xa7b0('0x41')]=_0x21fe2d['attributes'][_0xa7b0('0x43')]?_0x21fe2d['attributes']:_0x33f8c3[_0xa7b0('0x3b')];if(!_0x543e2d[_0xa7b0('0x3d')]['hasOwnProperty'](_0xa7b0('0x44'))){_0x21fe2d[_0xa7b0('0x2c')]=qs[_0xa7b0('0x2c')](_0x543e2d[_0xa7b0('0x3d')][_0xa7b0('0x2c')]);_0x21fe2d[_0xa7b0('0x2b')]=qs['offset'](_0x543e2d[_0xa7b0('0x3d')][_0xa7b0('0x2b')]);}_0x21fe2d['order']=qs[_0xa7b0('0x45')](_0x543e2d[_0xa7b0('0x3d')][_0xa7b0('0x45')]);_0x21fe2d['where']=qs[_0xa7b0('0x3f')](_[_0xa7b0('0x46')](_0x543e2d[_0xa7b0('0x3d')],_0x33f8c3['filters']),_0x1acadb);if(_0x543e2d[_0xa7b0('0x3d')]['filter']){_0x21fe2d[_0xa7b0('0x47')]=_[_0xa7b0('0x48')](_0x21fe2d[_0xa7b0('0x47')],{'$or':_[_0xa7b0('0x3c')](_0x1acadb,function(_0xaa451e){if(_0xaa451e[_0xa7b0('0x39')]!=='VIRTUAL'){var _0x3b94f6={};_0x3b94f6[_0xaa451e[_0xa7b0('0x34')]]={'$like':'%'+_0x543e2d[_0xa7b0('0x3d')][_0xa7b0('0x49')]+'%'};return _0x3b94f6;}})});}_0x21fe2d=_[_0xa7b0('0x48')]({},_0x21fe2d,_0x543e2d[_0xa7b0('0x4a')]);var _0x20c540={'where':_0x21fe2d['where']};return db[_0xa7b0('0x36')][_0xa7b0('0x2a')](_0x20c540)['then'](function(_0x5766e8){_0x3365aa[_0xa7b0('0x2a')]=_0x5766e8;if(_0x543e2d[_0xa7b0('0x3d')][_0xa7b0('0x4b')]){_0x21fe2d[_0xa7b0('0x4c')]=[{'all':!![]}];}return db[_0xa7b0('0x36')][_0xa7b0('0x4d')](_0x21fe2d);})[_0xa7b0('0x32')](function(_0x113c50){_0x3365aa[_0xa7b0('0x4e')]=_0x113c50;return _0x3365aa;})[_0xa7b0('0x32')](respondWithFilteredResult(_0x21feb0,_0x21fe2d))[_0xa7b0('0x26')](handleError(_0x21feb0,null));};exports[_0xa7b0('0x4f')]=function(_0x2fa0d6,_0x1a0131){var _0x3f5064={'raw':![],'where':{'id':_0x2fa0d6[_0xa7b0('0x50')]['id']}},_0x1131dd={};_0x1131dd['model']=_['keys'](db[_0xa7b0('0x36')][_0xa7b0('0x37')]);_0x1131dd['query']=_[_0xa7b0('0x3e')](_0x2fa0d6[_0xa7b0('0x3d')]);_0x1131dd[_0xa7b0('0x3f')]=_[_0xa7b0('0x40')](_0x1131dd[_0xa7b0('0x3b')],_0x1131dd[_0xa7b0('0x3d')]);_0x3f5064[_0xa7b0('0x41')]=_[_0xa7b0('0x40')](_0x1131dd['model'],qs[_0xa7b0('0x42')](_0x2fa0d6[_0xa7b0('0x3d')][_0xa7b0('0x42')]));_0x3f5064[_0xa7b0('0x41')]=_0x3f5064['attributes']['length']?_0x3f5064[_0xa7b0('0x41')]:_0x1131dd[_0xa7b0('0x3b')];if(_0x2fa0d6[_0xa7b0('0x3d')]['includeAll']){_0x3f5064[_0xa7b0('0x4c')]=[{'all':!![]}];}_0x3f5064=_[_0xa7b0('0x48')]({},_0x3f5064,_0x2fa0d6[_0xa7b0('0x4a')]);return db['VtigerAccount'][_0xa7b0('0x51')](_0x3f5064)[_0xa7b0('0x32')](handleEntityNotFound(_0x1a0131,null))[_0xa7b0('0x32')](respondWithResult(_0x1a0131,null))[_0xa7b0('0x26')](handleError(_0x1a0131,null));};exports[_0xa7b0('0x52')]=function(_0x507270,_0x5121a3){return db[_0xa7b0('0x36')][_0xa7b0('0x52')](_0x507270[_0xa7b0('0x53')],{})[_0xa7b0('0x32')](respondWithResult(_0x5121a3,0xc9))[_0xa7b0('0x26')](handleError(_0x5121a3,null));};exports[_0xa7b0('0x31')]=function(_0x182fb6,_0x3ca1a9){if(_0x182fb6[_0xa7b0('0x53')]['id']){delete _0x182fb6[_0xa7b0('0x53')]['id'];}return db[_0xa7b0('0x36')][_0xa7b0('0x51')]({'where':{'id':_0x182fb6['params']['id']}})['then'](handleEntityNotFound(_0x3ca1a9,null))[_0xa7b0('0x32')](saveUpdates(_0x182fb6[_0xa7b0('0x53')],null))[_0xa7b0('0x32')](respondWithResult(_0x3ca1a9,null))[_0xa7b0('0x26')](handleError(_0x3ca1a9,null));};exports[_0xa7b0('0x33')]=function(_0x4223e4,_0x3c944e){return db[_0xa7b0('0x36')]['find']({'where':{'id':_0x4223e4[_0xa7b0('0x50')]['id']}})[_0xa7b0('0x32')](handleEntityNotFound(_0x3c944e,null))['then'](removeEntity(_0x3c944e,null))['catch'](handleError(_0x3c944e,null));};exports[_0xa7b0('0x54')]=function(_0x28e8da,_0x16692a,_0x131bf4){var _0x28cf3e={};var _0x112a20={};var _0x494dad;var _0x2241f5;return db[_0xa7b0('0x36')][_0xa7b0('0x55')]({'where':{'id':_0x28e8da['params']['id']}})['then'](handleEntityNotFound(_0x16692a,null))[_0xa7b0('0x32')](function(_0x3d5ceb){if(_0x3d5ceb){_0x494dad=_0x3d5ceb;_0x112a20[_0xa7b0('0x3b')]=_[_0xa7b0('0x3e')](db['VtigerConfiguration']['rawAttributes']);_0x112a20[_0xa7b0('0x3d')]=_['keys'](_0x28e8da['query']);_0x112a20[_0xa7b0('0x3f')]=_['intersection'](_0x112a20[_0xa7b0('0x3b')],_0x112a20[_0xa7b0('0x3d')]);_0x28cf3e[_0xa7b0('0x41')]=_[_0xa7b0('0x40')](_0x112a20[_0xa7b0('0x3b')],qs[_0xa7b0('0x42')](_0x28e8da['query']['fields']));_0x28cf3e['attributes']=_0x28cf3e['attributes'][_0xa7b0('0x43')]?_0x28cf3e['attributes']:_0x112a20['model'];_0x28cf3e[_0xa7b0('0x56')]=qs[_0xa7b0('0x45')](_0x28e8da[_0xa7b0('0x3d')][_0xa7b0('0x45')]);_0x28cf3e[_0xa7b0('0x47')]=qs[_0xa7b0('0x3f')](_[_0xa7b0('0x46')](_0x28e8da[_0xa7b0('0x3d')],_0x112a20[_0xa7b0('0x3f')]));if(_0x28e8da[_0xa7b0('0x3d')][_0xa7b0('0x49')]){_0x28cf3e[_0xa7b0('0x47')]=_['merge'](_0x28cf3e[_0xa7b0('0x47')],{'$or':_['map'](_0x28cf3e[_0xa7b0('0x41')],function(_0x3accc3){var _0x51dd35={};_0x51dd35[_0x3accc3]={'$like':'%'+_0x28e8da['query'][_0xa7b0('0x49')]+'%'};return _0x51dd35;})});}_0x28cf3e=_[_0xa7b0('0x48')]({},_0x28cf3e,_0x28e8da[_0xa7b0('0x4a')]);return _0x494dad[_0xa7b0('0x54')](_0x28cf3e);}})[_0xa7b0('0x32')](function(_0x31279f){if(_0x31279f){_0x2241f5=_0x31279f[_0xa7b0('0x43')];if(!_0x28e8da['query'][_0xa7b0('0x57')](_0xa7b0('0x44'))){_0x28cf3e[_0xa7b0('0x2c')]=qs[_0xa7b0('0x2c')](_0x28e8da[_0xa7b0('0x3d')][_0xa7b0('0x2c')]);_0x28cf3e[_0xa7b0('0x2b')]=qs['offset'](_0x28e8da['query']['offset']);}return _0x494dad[_0xa7b0('0x54')](_0x28cf3e);}})[_0xa7b0('0x32')](function(_0x358494){if(_0x358494){return _0x358494?{'count':_0x2241f5,'rows':_0x358494}:null;}})[_0xa7b0('0x32')](respondWithResult(_0x16692a,null))[_0xa7b0('0x26')](handleError(_0x16692a,null));};exports[_0xa7b0('0x58')]=function(_0x72a7ad,_0x326f0a,_0x414eb6){if(_0x72a7ad[_0xa7b0('0x53')]['id']){delete _0x72a7ad[_0xa7b0('0x53')]['id'];}return db[_0xa7b0('0x36')][_0xa7b0('0x55')]({'where':{'id':_0x72a7ad[_0xa7b0('0x50')]['id']}})[_0xa7b0('0x32')](handleEntityNotFound(_0x326f0a,null))[_0xa7b0('0x32')](function(_0x4e8ac6){if(_0x4e8ac6){_0x72a7ad[_0xa7b0('0x53')][_0xa7b0('0x59')]=_0x4e8ac6['id'];_0x72a7ad[_0xa7b0('0x53')]['Subjects']=integrations[_0xa7b0('0x5a')](_0x72a7ad[_0xa7b0('0x53')][_0xa7b0('0x5b')],_0x72a7ad[_0xa7b0('0x53')][_0xa7b0('0x39')]);_0x72a7ad[_0xa7b0('0x53')]['Descriptions']=integrations['getDescriptions'](_0x72a7ad['body'][_0xa7b0('0x5b')],_0x72a7ad[_0xa7b0('0x53')][_0xa7b0('0x39')]);return db[_0xa7b0('0x5c')][_0xa7b0('0x52')](_0x72a7ad[_0xa7b0('0x53')],{'include':[{'model':db[_0xa7b0('0x5d')],'as':_0xa7b0('0x5e')},{'model':db[_0xa7b0('0x5d')],'as':_0xa7b0('0x5f')}]});}return null;})['then'](respondWithResult(_0x326f0a,null))['catch'](handleError(_0x326f0a,null));};var md5=require(_0xa7b0('0x60'));exports['getFields']=function(_0x20ca84,_0xa73488,_0xaef803){var _0x2f09b7=null;var _0x970c87=null;var _0x4264bf=null;var _0x3caf0d=null;var _0x14f143='';return db[_0xa7b0('0x36')][_0xa7b0('0x55')]({'where':{'id':_0x20ca84[_0xa7b0('0x50')]['id']},'attributes':['id',_0xa7b0('0x34'),_0xa7b0('0x61'),_0xa7b0('0x62'),'moduleName',_0xa7b0('0x63'),_0xa7b0('0x64'),_0xa7b0('0x65')]})[_0xa7b0('0x32')](handleEntityNotFound(_0xa73488,null))['then'](function(_0x264afd){if(_0x264afd){_0x2f09b7=_0x264afd[_0xa7b0('0x61')];_0x970c87=_0x264afd[_0xa7b0('0x65')];_0x4264bf=_0x264afd[_0xa7b0('0x66')];_0x14f143=_0x264afd[_0xa7b0('0x63')];var _0x2eaae6=_0x14f143[_0xa7b0('0x67')](-0x1);if(_0x2eaae6==='/'){_0x14f143=_0x14f143['substring'](0x0,_0x14f143[_0xa7b0('0x68')](_0x2eaae6));}_0x3caf0d=util[_0xa7b0('0x69')](_0xa7b0('0x6a'),_0x14f143);var _0x41d562={'method':_0xa7b0('0x6b'),'uri':_0x3caf0d,'qs':{'operation':_0xa7b0('0x6c'),'username':_0x264afd[_0xa7b0('0x61')]},'json':!![]};return rp(_0x41d562);}})[_0xa7b0('0x32')](function(_0x57588e){if(_0x57588e['success']){var _0x4dc2af={'method':_0xa7b0('0x6d'),'uri':_0x3caf0d,'form':{'operation':'login','username':_0x2f09b7,'accessKey':md5(_0x57588e[_0xa7b0('0x25')][_0xa7b0('0x6e')]+_0x970c87)},'json':!![]};return rp(_0x4dc2af);}})[_0xa7b0('0x32')](function(_0x54ebfa){if(_0x54ebfa[_0xa7b0('0x6f')]){var _0x17900f={'method':_0xa7b0('0x6b'),'uri':_0x3caf0d,'qs':{'operation':'describe','username':_0x2f09b7,'sessionName':_0x54ebfa[_0xa7b0('0x25')][_0xa7b0('0x70')],'elementType':_0x4264bf},'json':!![]};return rp(_0x17900f);}})[_0xa7b0('0x32')](function(_0x3a7ab2){if(_0x3a7ab2['success']){var _0x50a185=['autogenerated',_0xa7b0('0x71'),_0xa7b0('0x72')];_['remove'](_0x3a7ab2[_0xa7b0('0x25')][_0xa7b0('0x42')],function(_0x16dcb2){return _0x50a185[_0xa7b0('0x73')](_0x16dcb2[_0xa7b0('0x39')][_0xa7b0('0x34')]);});_[_0xa7b0('0x74')](_0x3a7ab2['result'][_0xa7b0('0x42')],function(_0x5a26ae){return _0x5a26ae[_0xa7b0('0x75')]===_0xa7b0('0x76');});return{'count':_0x3a7ab2['result'][_0xa7b0('0x42')][_0xa7b0('0x43')],'rows':_[_0xa7b0('0x3c')](_0x3a7ab2['result']['fields'],function(_0x66f2f5){return{'id':_0x66f2f5['name'],'name':_0x66f2f5[_0xa7b0('0x77')],'custom':_['startsWith'](_0x66f2f5[_0xa7b0('0x34')],_0xa7b0('0x78'))?!![]:![],'options':_0x66f2f5['type'][_0xa7b0('0x34')]===_0xa7b0('0x79')&&_0x66f2f5[_0xa7b0('0x39')][_0xa7b0('0x7a')]['length']>0x0?_[_0xa7b0('0x3c')](_0x66f2f5[_0xa7b0('0x39')][_0xa7b0('0x7a')],function(_0x5b8dd9){return{'name':_0x5b8dd9[_0xa7b0('0x77')],'value':_0x5b8dd9[_0xa7b0('0x7b')]};}):[]};})};}})['then'](respondWithResult(_0xa73488,null))[_0xa7b0('0x26')](function(_0x3933f2){console[_0xa7b0('0x7c')]('vTiger\x20error:\x20'+_0x3933f2);var _0x569814=_0x20ca84[_0xa7b0('0x3d')][_0xa7b0('0x18')]?0x1f4:_0x3933f2[_0xa7b0('0x7d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x569814,JSON['stringify'](_0x3933f2));delete _0x3933f2[_0xa7b0('0x34')];if(_0x569814===0x191){_0x569814=0x190;}_0xa73488['status'](_0x569814)[_0xa7b0('0x35')](_0x20ca84[_0xa7b0('0x3d')][_0xa7b0('0x18')]?{'message':_0xa7b0('0x7e'),'statusCode':_0x3933f2[_0xa7b0('0x7d')]}:_0x3933f2);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 48a47ec..44d3c13 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 _0xde9d=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x50912c,_0x4c29d7){var _0x3f955d=function(_0x15b773){while(--_0x15b773){_0x50912c['push'](_0x50912c['shift']());}};_0x3f955d(++_0x4c29d7);}(_0xde9d,0x156));var _0xdde9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xde9d[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var logger=require(_0xdde9('0x2'))(_0xdde9('0x3'));var moment=require(_0xdde9('0x4'));var BPromise=require('bluebird');var rp=require(_0xdde9('0x5'));var fs=require('fs');var path=require(_0xdde9('0x6'));var rimraf=require(_0xdde9('0x7'));var config=require('../../config/environment');var attributes=require(_0xdde9('0x8'));var integrations=require(_0xdde9('0x9'));module[_0xdde9('0xa')]=function(_0x4c10e9,_0x289ccb){return _0x4c10e9[_0xdde9('0xb')](_0xdde9('0xc'),attributes,{'tableName':_0xdde9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4424=['lodash','api','moment','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x250dd3,_0x3490b3){var _0x3abddf=function(_0x5d1df5){while(--_0x5d1df5){_0x250dd3['push'](_0x250dd3['shift']());}};_0x3abddf(++_0x3490b3);}(_0x4424,0x16b));var _0x4442=function(_0x4040ad,_0x4fcc19){_0x4040ad=_0x4040ad-0x0;var _0x2f5d2e=_0x4424[_0x4040ad];return _0x2f5d2e;};'use strict';var _=require(_0x4442('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4442('0x1'));var moment=require(_0x4442('0x2'));var BPromise=require(_0x4442('0x3'));var rp=require(_0x4442('0x4'));var fs=require('fs');var path=require(_0x4442('0x5'));var rimraf=require(_0x4442('0x6'));var config=require('../../config/environment');var attributes=require(_0x4442('0x7'));var integrations=require(_0x4442('0x8'));module[_0x4442('0x9')]=function(_0x473178,_0x26b559){return _0x473178[_0x4442('0xa')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','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 95f4a48..2626796 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 _0x9ff1=['GetVtigerAccount','debug','ShowVtigerAccount','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VtigerAccount','findAll','options','where','attributes','limit','include','map','model'];(function(_0x38d19d,_0x2cc1ff){var _0x5d9e77=function(_0x4b808b){while(--_0x4b808b){_0x38d19d['push'](_0x38d19d['shift']());}};_0x5d9e77(++_0x2cc1ff);}(_0x9ff1,0x10c));var _0x19ff=function(_0x585234,_0x3ae470){_0x585234=_0x585234-0x0;var _0x28b8a7=_0x9ff1[_0x585234];return _0x28b8a7;};'use strict';var _=require(_0x19ff('0x0'));var util=require(_0x19ff('0x1'));var moment=require(_0x19ff('0x2'));var BPromise=require(_0x19ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19ff('0x4'))['db'];var utils=require(_0x19ff('0x5'));var logger=require(_0x19ff('0x6'))(_0x19ff('0x7'));var config=require(_0x19ff('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1395cb,_0x339a74,_0x229fc0){return new BPromise(function(_0x36ff2a,_0x3caeff){return client[_0x19ff('0x9')](_0x1395cb,_0x229fc0)[_0x19ff('0xa')](function(_0x5cc5da){logger[_0x19ff('0xb')](_0x19ff('0xc'),_0x339a74,'request\x20sent');logger['debug'](_0x19ff('0xd'),_0x339a74,_0x19ff('0xe'),JSON[_0x19ff('0xf')](_0x5cc5da));if(_0x5cc5da['error']){if(_0x5cc5da['error']['code']===0x1f4){logger[_0x19ff('0x10')](_0x19ff('0xc'),_0x339a74,_0x5cc5da['error'][_0x19ff('0x11')]);return _0x3caeff(_0x5cc5da[_0x19ff('0x10')][_0x19ff('0x11')]);}logger[_0x19ff('0x10')](_0x19ff('0xc'),_0x339a74,_0x5cc5da[_0x19ff('0x10')][_0x19ff('0x11')]);return _0x36ff2a(_0x5cc5da[_0x19ff('0x10')][_0x19ff('0x11')]);}else{logger[_0x19ff('0xb')](_0x19ff('0xc'),_0x339a74,_0x19ff('0xe'));_0x36ff2a(_0x5cc5da[_0x19ff('0x12')][_0x19ff('0x11')]);}})[_0x19ff('0x13')](function(_0x4550e5){logger[_0x19ff('0x10')](_0x19ff('0xc'),_0x339a74,_0x4550e5);_0x3caeff(_0x4550e5);});});}exports['GetVtigerAccount']=function(_0x1913ec){var _0xe3924a=this;return new Promise(function(_0x30e693,_0x3db9b8){return db[_0x19ff('0x14')][_0x19ff('0x15')]({'raw':_0x1913ec[_0x19ff('0x16')]?_0x1913ec[_0x19ff('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1913ec[_0x19ff('0x16')]?_0x1913ec['options'][_0x19ff('0x17')]||null:null,'attributes':_0x1913ec['options']?_0x1913ec[_0x19ff('0x16')][_0x19ff('0x18')]||null:null,'limit':_0x1913ec['options']?_0x1913ec[_0x19ff('0x16')][_0x19ff('0x19')]||null:null,'include':_0x1913ec[_0x19ff('0x16')]?_0x1913ec[_0x19ff('0x16')][_0x19ff('0x1a')]?_[_0x19ff('0x1b')](_0x1913ec['options'][_0x19ff('0x1a')],function(_0x3b4e8c){return{'model':db[_0x3b4e8c[_0x19ff('0x1c')]],'as':_0x3b4e8c['as'],'attributes':_0x3b4e8c[_0x19ff('0x18')],'include':_0x3b4e8c[_0x19ff('0x1a')]?_[_0x19ff('0x1b')](_0x3b4e8c[_0x19ff('0x1a')],function(_0x113f49){return{'model':db[_0x113f49['model']],'as':_0x113f49['as'],'attributes':_0x113f49[_0x19ff('0x18')],'include':_0x113f49[_0x19ff('0x1a')]?_[_0x19ff('0x1b')](_0x113f49[_0x19ff('0x1a')],function(_0x1928d){return{'model':db[_0x1928d['model']],'as':_0x1928d['as'],'attributes':_0x1928d[_0x19ff('0x18')]};}):[]};}):[]};}):[]:[]})[_0x19ff('0xa')](function(_0x4d4279){logger['info'](_0x19ff('0x1d'),_0x1913ec);logger[_0x19ff('0x1e')](_0x19ff('0x1d'),_0x1913ec,JSON[_0x19ff('0xf')](_0x4d4279));_0x30e693(_0x4d4279);})[_0x19ff('0x13')](function(_0x2c3b83){logger[_0x19ff('0x10')](_0x19ff('0x1d'),_0x2c3b83[_0x19ff('0x11')],_0x1913ec);_0x3db9b8(_0xe3924a[_0x19ff('0x10')](0x1f4,_0x2c3b83[_0x19ff('0x11')]));});});};exports[_0x19ff('0x1f')]=function(_0x566cb3){var _0xe6846c=this;return new Promise(function(_0x2a3111,_0x14e1d1){return db[_0x19ff('0x14')]['find']({'raw':_0x566cb3[_0x19ff('0x16')]?_0x566cb3['options'][_0x19ff('0x20')]===undefined?!![]:![]:!![],'where':_0x566cb3[_0x19ff('0x16')]?_0x566cb3['options'][_0x19ff('0x17')]||null:null,'attributes':_0x566cb3[_0x19ff('0x16')]?_0x566cb3[_0x19ff('0x16')]['attributes']||null:null,'include':_0x566cb3['options']?_0x566cb3['options']['include']?_[_0x19ff('0x1b')](_0x566cb3[_0x19ff('0x16')][_0x19ff('0x1a')],function(_0x347491){return{'model':db[_0x347491[_0x19ff('0x1c')]],'as':_0x347491['as'],'attributes':_0x347491[_0x19ff('0x18')],'include':_0x347491[_0x19ff('0x1a')]?_['map'](_0x347491[_0x19ff('0x1a')],function(_0x3616af){return{'model':db[_0x3616af[_0x19ff('0x1c')]],'as':_0x3616af['as'],'attributes':_0x3616af[_0x19ff('0x18')],'include':_0x3616af[_0x19ff('0x1a')]?_['map'](_0x3616af['include'],function(_0x556bc2){return{'model':db[_0x556bc2[_0x19ff('0x1c')]],'as':_0x556bc2['as'],'attributes':_0x556bc2[_0x19ff('0x18')]};}):[]};}):[]};}):[]:[]})[_0x19ff('0xa')](function(_0x2f7d2f){logger[_0x19ff('0xb')]('ShowVtigerAccount',_0x566cb3);logger['debug'](_0x19ff('0x1f'),_0x566cb3,JSON['stringify'](_0x2f7d2f));_0x2a3111(_0x2f7d2f);})[_0x19ff('0x13')](function(_0x51f640){logger['error'](_0x19ff('0x1f'),_0x51f640[_0x19ff('0x11')],_0x566cb3);_0x14e1d1(_0xe6846c[_0x19ff('0x10')](0x1f4,_0x51f640['message']));});});}; \ No newline at end of file +var _0x8755=['../../config/environment','jayson/promise','client','http','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xfab3e1,_0x2d9028){var _0x5afd4d=function(_0x2f3ac5){while(--_0x2f3ac5){_0xfab3e1['push'](_0xfab3e1['shift']());}};_0x5afd4d(++_0x2d9028);}(_0x8755,0x13b));var _0x5875=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8755[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5875('0x0'));var util=require(_0x5875('0x1'));var moment=require(_0x5875('0x2'));var BPromise=require(_0x5875('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5875('0x4'));var db=require(_0x5875('0x5'))['db'];var utils=require(_0x5875('0x6'));var logger=require(_0x5875('0x7'))(_0x5875('0x8'));var config=require(_0x5875('0x9'));var jayson=require(_0x5875('0xa'));var client=jayson[_0x5875('0xb')][_0x5875('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cafd6,_0xfc0489,_0x5c60a9){return new BPromise(function(_0xbd6498,_0x282696){return client['request'](_0x5cafd6,_0x5c60a9)['then'](function(_0x531486){logger['info'](_0x5875('0xd'),_0xfc0489,'request\x20sent');logger[_0x5875('0xe')](_0x5875('0xf'),_0xfc0489,_0x5875('0x10'),JSON['stringify'](_0x531486));if(_0x531486['error']){if(_0x531486[_0x5875('0x11')][_0x5875('0x12')]===0x1f4){logger[_0x5875('0x11')](_0x5875('0xd'),_0xfc0489,_0x531486[_0x5875('0x11')][_0x5875('0x13')]);return _0x282696(_0x531486[_0x5875('0x11')][_0x5875('0x13')]);}logger[_0x5875('0x11')]('VtigerAccount,\x20%s,\x20%s',_0xfc0489,_0x531486[_0x5875('0x11')][_0x5875('0x13')]);return _0xbd6498(_0x531486[_0x5875('0x11')]['message']);}else{logger[_0x5875('0x14')](_0x5875('0xd'),_0xfc0489,_0x5875('0x10'));_0xbd6498(_0x531486['result'][_0x5875('0x13')]);}})[_0x5875('0x15')](function(_0xf7a140){logger[_0x5875('0x11')](_0x5875('0xd'),_0xfc0489,_0xf7a140);_0x282696(_0xf7a140);});});}exports[_0x5875('0x16')]=function(_0x3bb45a){var _0x5b843c=this;return new Promise(function(_0x180735,_0x415ad5){return db[_0x5875('0x17')][_0x5875('0x18')]({'raw':_0x3bb45a[_0x5875('0x19')]?_0x3bb45a['options'][_0x5875('0x1a')]===undefined?!![]:![]:!![],'where':_0x3bb45a[_0x5875('0x19')]?_0x3bb45a[_0x5875('0x19')][_0x5875('0x1b')]||null:null,'attributes':_0x3bb45a['options']?_0x3bb45a['options'][_0x5875('0x1c')]||null:null,'limit':_0x3bb45a[_0x5875('0x19')]?_0x3bb45a[_0x5875('0x19')][_0x5875('0x1d')]||null:null,'include':_0x3bb45a['options']?_0x3bb45a['options'][_0x5875('0x1e')]?_[_0x5875('0x1f')](_0x3bb45a['options'][_0x5875('0x1e')],function(_0x284686){return{'model':db[_0x284686['model']],'as':_0x284686['as'],'attributes':_0x284686[_0x5875('0x1c')],'include':_0x284686['include']?_[_0x5875('0x1f')](_0x284686[_0x5875('0x1e')],function(_0x1c5832){return{'model':db[_0x1c5832[_0x5875('0x20')]],'as':_0x1c5832['as'],'attributes':_0x1c5832[_0x5875('0x1c')],'include':_0x1c5832[_0x5875('0x1e')]?_['map'](_0x1c5832[_0x5875('0x1e')],function(_0x2b6922){return{'model':db[_0x2b6922[_0x5875('0x20')]],'as':_0x2b6922['as'],'attributes':_0x2b6922['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ca9ba){logger[_0x5875('0x14')](_0x5875('0x16'),_0x3bb45a);logger['debug'](_0x5875('0x16'),_0x3bb45a,JSON[_0x5875('0x21')](_0x1ca9ba));_0x180735(_0x1ca9ba);})['catch'](function(_0x136404){logger['error']('GetVtigerAccount',_0x136404[_0x5875('0x13')],_0x3bb45a);_0x415ad5(_0x5b843c[_0x5875('0x11')](0x1f4,_0x136404['message']));});});};exports[_0x5875('0x22')]=function(_0x2c58a3){var _0x184c4c=this;return new Promise(function(_0x58d088,_0x4bc404){return db[_0x5875('0x17')][_0x5875('0x23')]({'raw':_0x2c58a3[_0x5875('0x19')]?_0x2c58a3[_0x5875('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2c58a3[_0x5875('0x19')]?_0x2c58a3[_0x5875('0x19')][_0x5875('0x1b')]||null:null,'attributes':_0x2c58a3[_0x5875('0x19')]?_0x2c58a3[_0x5875('0x19')][_0x5875('0x1c')]||null:null,'include':_0x2c58a3[_0x5875('0x19')]?_0x2c58a3[_0x5875('0x19')][_0x5875('0x1e')]?_['map'](_0x2c58a3[_0x5875('0x19')][_0x5875('0x1e')],function(_0x2647b9){return{'model':db[_0x2647b9[_0x5875('0x20')]],'as':_0x2647b9['as'],'attributes':_0x2647b9[_0x5875('0x1c')],'include':_0x2647b9['include']?_['map'](_0x2647b9[_0x5875('0x1e')],function(_0x13d655){return{'model':db[_0x13d655[_0x5875('0x20')]],'as':_0x13d655['as'],'attributes':_0x13d655[_0x5875('0x1c')],'include':_0x13d655[_0x5875('0x1e')]?_['map'](_0x13d655[_0x5875('0x1e')],function(_0x317f94){return{'model':db[_0x317f94[_0x5875('0x20')]],'as':_0x317f94['as'],'attributes':_0x317f94[_0x5875('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6492d0){logger[_0x5875('0x14')](_0x5875('0x22'),_0x2c58a3);logger[_0x5875('0xe')]('ShowVtigerAccount',_0x2c58a3,JSON['stringify'](_0x6492d0));_0x58d088(_0x6492d0);})['catch'](function(_0x1f5433){logger[_0x5875('0x11')](_0x5875('0x22'),_0x1f5433['message'],_0x2c58a3);_0x4bc404(_0x184c4c[_0x5875('0x11')](0x1f4,_0x1f5433[_0x5875('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index dafd507..d8363d5 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x45781,_0x266641){var _0x10783b=function(_0xd1be3c){while(--_0xd1be3c){_0x45781['push'](_0x45781['shift']());}};_0x10783b(++_0x266641);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48cde8,_0x1eccef){_0x48cde8=_0x48cde8-0x0;var _0x3d7ee5=_0x5f2f[_0x48cde8];return _0x3d7ee5;};'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('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('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(_0x53f63a,_0x41db8d){var _0x4e1b9e=function(_0x55466){while(--_0x55466){_0x53f63a['push'](_0x53f63a['shift']());}};_0x4e1b9e(++_0x41db8d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d5f7a,_0x189a90){_0x3d5f7a=_0x3d5f7a-0x0;var _0xce3308=_0xb10b[_0x3d5f7a];return _0xce3308;};'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 7d887b6..8f12c3c 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 _0x99ce=['STRING','sequelize','exports'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0x99ce,0x16c));var _0xe99c=function(_0x341b44,_0x1c7131){_0x341b44=_0x341b44-0x0;var _0x1cb37b=_0x99ce[_0x341b44];return _0x1cb37b;};'use strict';var Sequelize=require(_0xe99c('0x0'));module[_0xe99c('0x1')]={'name':{'type':Sequelize[_0xe99c('0x2')]},'description':{'type':Sequelize[_0xe99c('0x2')]}}; \ No newline at end of file +var _0xebba=['STRING'];(function(_0x4dcd77,_0x4a751b){var _0x41ec65=function(_0x15e872){while(--_0x15e872){_0x4dcd77['push'](_0x4dcd77['shift']());}};_0x41ec65(++_0x4a751b);}(_0xebba,0x187));var _0xaebb=function(_0xd96403,_0x53df02){_0xd96403=_0xd96403-0x0;var _0x4d8e18=_0xebba[_0xd96403];return _0x4d8e18;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaebb('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 9658797..32f24b5 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 _0x9e2a=['message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','map','VtigerConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','findOne','VtigerField','getFields','getSubjects','getDescriptions','html-pdf','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3367c1,_0x52ccc2){var _0x3bf1d0=function(_0xe42fd5){while(--_0xe42fd5){_0x3367c1['push'](_0x3367c1['shift']());}};_0x3bf1d0(++_0x52ccc2);}(_0x9e2a,0xe1));var _0xa9e2=function(_0x2d1d2c,_0x23f59a){_0x2d1d2c=_0x2d1d2c-0x0;var _0x3ca6f6=_0x9e2a[_0x2d1d2c];return _0x3ca6f6;};'use strict';var pdf=require(_0xa9e2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa9e2('0x1'));var moment=require(_0xa9e2('0x2'));var BPromise=require(_0xa9e2('0x3'));var Mustache=require(_0xa9e2('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa9e2('0x5'));var ejs=require(_0xa9e2('0x6'));var fs=require('fs');var _=require(_0xa9e2('0x7'));var squel=require(_0xa9e2('0x8'));var crypto=require(_0xa9e2('0x9'));var jsforce=require(_0xa9e2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa9e2('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9e2('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xa9e2('0xc'));var as=require(_0xa9e2('0xd'));var hardwareService=require(_0xa9e2('0xe'));var logger=require('../../config/logger')(_0xa9e2('0xf'));var utils=require(_0xa9e2('0x10'));var config=require(_0xa9e2('0x11'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa9e2('0x12'));var client=jayson[_0xa9e2('0x13')][_0xa9e2('0x14')]({'port':0x232a});function checkPasswordPattern(_0x26774f,_0x9146a6,_0x402bc5){if(_0x402bc5){var _0x3e9ed5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e9ed5[_0xa9e2('0x15')](_0x9146a6)){return _0x26774f;}else{throw new db[(_0xa9e2('0x16'))][(_0xa9e2('0x17'))]('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 _0x26774f;}}function respondWithRpcPromise(_0x2f6e74,_0x4aed84,_0x4a26f3,_0x29b289){return new BPromise(function(_0x5ea885,_0x576cb8){var _0x117c15=_0x29b289||client;return _0x117c15[_0xa9e2('0x18')](_0x2f6e74,_0x4a26f3)[_0xa9e2('0x19')](function(_0x1ecb9d){logger[_0xa9e2('0x1a')](_0xa9e2('0x1b'),_0x4aed84,'request\x20sent');logger[_0xa9e2('0x1c')](_0xa9e2('0x1d'),_0x4aed84,_0xa9e2('0x1e'),JSON['stringify'](_0x1ecb9d));if(_0x1ecb9d[_0xa9e2('0x1f')]){if(_0x1ecb9d['error'][_0xa9e2('0x20')]===0x1f4){logger['error'](_0xa9e2('0x1b'),_0x4aed84,_0x1ecb9d[_0xa9e2('0x1f')]['message']);return _0x576cb8(_0x1ecb9d['error']['message']);}logger['error'](_0xa9e2('0x1b'),_0x4aed84,_0x1ecb9d[_0xa9e2('0x1f')][_0xa9e2('0x21')]);return _0x5ea885(_0x1ecb9d['error'][_0xa9e2('0x21')]);}else{logger[_0xa9e2('0x1a')](_0xa9e2('0x1b'),_0x4aed84,_0xa9e2('0x1e'));_0x5ea885(_0x1ecb9d['result']['message']);}})['catch'](function(_0x53bd8d){logger['error'](_0xa9e2('0x1b'),_0x4aed84,_0x53bd8d);_0x576cb8(_0x53bd8d);});});}function respondWithStatusCode(_0x2cd269,_0x3b12bf){_0x3b12bf=_0x3b12bf||0xcc;return function(_0x443735){if(_0x443735){return _0x2cd269[_0xa9e2('0x22')](_0x3b12bf);}return _0x2cd269[_0xa9e2('0x23')](_0x3b12bf)[_0xa9e2('0x24')]();};}function respondWithResult(_0x5f3e4c,_0x31fdc0){_0x31fdc0=_0x31fdc0||0xc8;return function(_0x196e12){if(_0x196e12){return _0x5f3e4c[_0xa9e2('0x23')](_0x31fdc0)[_0xa9e2('0x25')](_0x196e12);}};}function respondWithFilteredResult(_0x599906,_0x298eb3){return function(_0x4d153a){if(_0x4d153a){var _0x43bc3b=_0x4d153a[_0xa9e2('0x26')],_0x333d8e=_0x298eb3[_0xa9e2('0x27')],_0x233e6b=_0x298eb3['offset']+_0x298eb3[_0xa9e2('0x28')],_0x30b7b2;if(_0x233e6b>=_0x43bc3b){_0x233e6b=_0x43bc3b;_0x30b7b2=0xc8;}else{_0x30b7b2=0xce;}_0x599906[_0xa9e2('0x23')](_0x30b7b2);return _0x599906[_0xa9e2('0x29')](_0xa9e2('0x2a'),_0x333d8e+'-'+_0x233e6b+'/'+_0x43bc3b)[_0xa9e2('0x25')](_0x4d153a);}return null;};}function patchUpdates(_0x4aa6e3){return function(_0x1a3bdb){try{jsonpatch[_0xa9e2('0x2b')](_0x1a3bdb,_0x4aa6e3,!![]);}catch(_0x529d1e){return BPromise['reject'](_0x529d1e);}return _0x1a3bdb[_0xa9e2('0x2c')]();};}function saveUpdates(_0x55393b,_0x220c50){return function(_0x142242){if(_0x142242){return _0x142242[_0xa9e2('0x2d')](_0x55393b)[_0xa9e2('0x19')](function(_0x3d7769){return _0x3d7769;});}return null;};}function removeEntity(_0x190877,_0x517acc){return function(_0x4ce8a1){if(_0x4ce8a1){return _0x4ce8a1[_0xa9e2('0x2e')]()['then'](function(){_0x190877[_0xa9e2('0x23')](0xcc)[_0xa9e2('0x24')]();});}};}function handleEntityNotFound(_0x154b73,_0x3a8ed7){return function(_0x32682c){if(!_0x32682c){_0x154b73['sendStatus'](0x194);}return _0x32682c;};}function handleError(_0x59dbcc,_0x145687){_0x145687=_0x145687||0x1f4;return function(_0x38993f){logger[_0xa9e2('0x1f')](_0x38993f[_0xa9e2('0x2f')]);if(_0x38993f['name']){delete _0x38993f[_0xa9e2('0x30')];}_0x59dbcc[_0xa9e2('0x23')](_0x145687)[_0xa9e2('0x31')](_0x38993f);};}exports['index']=function(_0x25f61e,_0x5982c1){var _0x53d1c0={},_0xd141ec={},_0x4e7f04={'count':0x0,'rows':[]};var _0xc999e3=_[_0xa9e2('0x32')](db[_0xa9e2('0x33')][_0xa9e2('0x34')],function(_0x1a9a39){return{'name':_0x1a9a39['fieldName'],'type':_0x1a9a39[_0xa9e2('0x35')][_0xa9e2('0x36')]};});_0xd141ec[_0xa9e2('0x37')]=_['map'](_0xc999e3,_0xa9e2('0x30'));_0xd141ec[_0xa9e2('0x38')]=_['keys'](_0x25f61e[_0xa9e2('0x38')]);_0xd141ec[_0xa9e2('0x39')]=_[_0xa9e2('0x3a')](_0xd141ec[_0xa9e2('0x37')],_0xd141ec[_0xa9e2('0x38')]);_0x53d1c0[_0xa9e2('0x3b')]=_['intersection'](_0xd141ec['model'],qs[_0xa9e2('0x3c')](_0x25f61e['query'][_0xa9e2('0x3c')]));_0x53d1c0[_0xa9e2('0x3b')]=_0x53d1c0[_0xa9e2('0x3b')][_0xa9e2('0x3d')]?_0x53d1c0[_0xa9e2('0x3b')]:_0xd141ec[_0xa9e2('0x37')];if(!_0x25f61e[_0xa9e2('0x38')][_0xa9e2('0x3e')](_0xa9e2('0x3f'))){_0x53d1c0[_0xa9e2('0x28')]=qs[_0xa9e2('0x28')](_0x25f61e[_0xa9e2('0x38')][_0xa9e2('0x28')]);_0x53d1c0[_0xa9e2('0x27')]=qs[_0xa9e2('0x27')](_0x25f61e['query'][_0xa9e2('0x27')]);}_0x53d1c0[_0xa9e2('0x40')]=qs[_0xa9e2('0x41')](_0x25f61e['query'][_0xa9e2('0x41')]);_0x53d1c0[_0xa9e2('0x42')]=qs['filters'](_[_0xa9e2('0x43')](_0x25f61e[_0xa9e2('0x38')],_0xd141ec[_0xa9e2('0x39')]),_0xc999e3);if(_0x25f61e[_0xa9e2('0x38')][_0xa9e2('0x44')]){_0x53d1c0[_0xa9e2('0x42')]=_['merge'](_0x53d1c0['where'],{'$or':_[_0xa9e2('0x32')](_0xc999e3,function(_0x202d8c){if(_0x202d8c['type']!=='VIRTUAL'){var _0x5d9478={};_0x5d9478[_0x202d8c[_0xa9e2('0x30')]]={'$like':'%'+_0x25f61e[_0xa9e2('0x38')][_0xa9e2('0x44')]+'%'};return _0x5d9478;}})});}_0x53d1c0=_[_0xa9e2('0x45')]({},_0x53d1c0,_0x25f61e[_0xa9e2('0x46')]);var _0x276f74={'where':_0x53d1c0['where']};return db[_0xa9e2('0x33')][_0xa9e2('0x26')](_0x276f74)[_0xa9e2('0x19')](function(_0x3972d6){_0x4e7f04[_0xa9e2('0x26')]=_0x3972d6;if(_0x25f61e[_0xa9e2('0x38')]['includeAll']){_0x53d1c0[_0xa9e2('0x47')]=[{'all':!![]}];}return db[_0xa9e2('0x33')][_0xa9e2('0x48')](_0x53d1c0);})[_0xa9e2('0x19')](function(_0x50f3e0){_0x4e7f04['rows']=_0x50f3e0;return _0x4e7f04;})[_0xa9e2('0x19')](respondWithFilteredResult(_0x5982c1,_0x53d1c0))[_0xa9e2('0x49')](handleError(_0x5982c1,null));};exports[_0xa9e2('0x4a')]=function(_0x36baf1,_0x2ba242){var _0x1b6742={'raw':![],'where':{'id':_0x36baf1[_0xa9e2('0x4b')]['id']}},_0x773375={};_0x773375[_0xa9e2('0x37')]=_[_0xa9e2('0x4c')](db[_0xa9e2('0x33')]['rawAttributes']);_0x773375[_0xa9e2('0x38')]=_['keys'](_0x36baf1[_0xa9e2('0x38')]);_0x773375[_0xa9e2('0x39')]=_[_0xa9e2('0x3a')](_0x773375[_0xa9e2('0x37')],_0x773375[_0xa9e2('0x38')]);_0x1b6742['attributes']=_[_0xa9e2('0x3a')](_0x773375[_0xa9e2('0x37')],qs[_0xa9e2('0x3c')](_0x36baf1[_0xa9e2('0x38')]['fields']));_0x1b6742[_0xa9e2('0x3b')]=_0x1b6742[_0xa9e2('0x3b')]['length']?_0x1b6742[_0xa9e2('0x3b')]:_0x773375[_0xa9e2('0x37')];if(_0x36baf1[_0xa9e2('0x38')][_0xa9e2('0x4d')]){_0x1b6742[_0xa9e2('0x47')]=[{'all':!![]}];}_0x1b6742=_[_0xa9e2('0x45')]({},_0x1b6742,_0x36baf1[_0xa9e2('0x46')]);return db[_0xa9e2('0x33')][_0xa9e2('0x4e')](_0x1b6742)[_0xa9e2('0x19')](handleEntityNotFound(_0x2ba242,null))['then'](respondWithResult(_0x2ba242,null))[_0xa9e2('0x49')](handleError(_0x2ba242,null));};exports[_0xa9e2('0x4f')]=function(_0x2196fe,_0x11c6bc){return db[_0xa9e2('0x33')][_0xa9e2('0x4f')](_0x2196fe['body'],{})[_0xa9e2('0x19')](respondWithResult(_0x11c6bc,0xc9))[_0xa9e2('0x49')](handleError(_0x11c6bc,null));};exports['update']=function(_0x2eb446,_0x3a252b){if(_0x2eb446[_0xa9e2('0x50')]['id']){delete _0x2eb446[_0xa9e2('0x50')]['id'];}return db['VtigerConfiguration'][_0xa9e2('0x4e')]({'where':{'id':_0x2eb446[_0xa9e2('0x4b')]['id']}})[_0xa9e2('0x19')](handleEntityNotFound(_0x3a252b,null))[_0xa9e2('0x19')](saveUpdates(_0x2eb446['body'],null))['then'](respondWithResult(_0x3a252b,null))[_0xa9e2('0x49')](handleError(_0x3a252b,null));};exports[_0xa9e2('0x2e')]=function(_0x201978,_0x608617){return db[_0xa9e2('0x33')][_0xa9e2('0x4e')]({'where':{'id':_0x201978[_0xa9e2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x608617,null))[_0xa9e2('0x19')](removeEntity(_0x608617,null))['catch'](handleError(_0x608617,null));};exports['getFields']=function(_0x1102d7,_0x3b0e37,_0x4de5ae){var _0x4ccadf={};var _0xcead99={};var _0x36cef5;var _0x147078;return db[_0xa9e2('0x33')][_0xa9e2('0x51')]({'where':{'id':_0x1102d7[_0xa9e2('0x4b')]['id']}})[_0xa9e2('0x19')](handleEntityNotFound(_0x3b0e37,null))[_0xa9e2('0x19')](function(_0x258249){if(_0x258249){_0x36cef5=_0x258249;_0xcead99['model']=_[_0xa9e2('0x4c')](db[_0xa9e2('0x52')][_0xa9e2('0x34')]);_0xcead99[_0xa9e2('0x38')]=_[_0xa9e2('0x4c')](_0x1102d7[_0xa9e2('0x38')]);_0xcead99['filters']=_[_0xa9e2('0x3a')](_0xcead99[_0xa9e2('0x37')],_0xcead99[_0xa9e2('0x38')]);_0x4ccadf[_0xa9e2('0x3b')]=_[_0xa9e2('0x3a')](_0xcead99[_0xa9e2('0x37')],qs[_0xa9e2('0x3c')](_0x1102d7[_0xa9e2('0x38')][_0xa9e2('0x3c')]));_0x4ccadf[_0xa9e2('0x3b')]=_0x4ccadf[_0xa9e2('0x3b')]['length']?_0x4ccadf[_0xa9e2('0x3b')]:_0xcead99[_0xa9e2('0x37')];_0x4ccadf[_0xa9e2('0x40')]=qs[_0xa9e2('0x41')](_0x1102d7[_0xa9e2('0x38')][_0xa9e2('0x41')]);_0x4ccadf[_0xa9e2('0x42')]=qs[_0xa9e2('0x39')](_[_0xa9e2('0x43')](_0x1102d7['query'],_0xcead99[_0xa9e2('0x39')]));if(_0x1102d7[_0xa9e2('0x38')][_0xa9e2('0x44')]){_0x4ccadf[_0xa9e2('0x42')]=_['merge'](_0x4ccadf[_0xa9e2('0x42')],{'$or':_[_0xa9e2('0x32')](_0x4ccadf['attributes'],function(_0x257b08){var _0x2bd753={};_0x2bd753[_0x257b08]={'$like':'%'+_0x1102d7[_0xa9e2('0x38')][_0xa9e2('0x44')]+'%'};return _0x2bd753;})});}_0x4ccadf=_['merge']({},_0x4ccadf,_0x1102d7['options']);return _0x36cef5['getFields'](_0x4ccadf);}})[_0xa9e2('0x19')](function(_0xa03096){if(_0xa03096){_0x147078=_0xa03096['length'];if(!_0x1102d7[_0xa9e2('0x38')]['hasOwnProperty'](_0xa9e2('0x3f'))){_0x4ccadf[_0xa9e2('0x28')]=qs[_0xa9e2('0x28')](_0x1102d7[_0xa9e2('0x38')][_0xa9e2('0x28')]);_0x4ccadf[_0xa9e2('0x27')]=qs['offset'](_0x1102d7[_0xa9e2('0x38')][_0xa9e2('0x27')]);}return _0x36cef5[_0xa9e2('0x53')](_0x4ccadf);}})[_0xa9e2('0x19')](function(_0x12f3f7){if(_0x12f3f7){return _0x12f3f7?{'count':_0x147078,'rows':_0x12f3f7}:null;}})[_0xa9e2('0x19')](respondWithResult(_0x3b0e37,null))[_0xa9e2('0x49')](handleError(_0x3b0e37,null));};exports['getSubjects']=function(_0x33e0e7,_0x1c4016,_0xc342d0){var _0x19e620={};var _0x3fcb06={};var _0x328cce;var _0x4df7e9;return db['VtigerConfiguration'][_0xa9e2('0x51')]({'where':{'id':_0x33e0e7[_0xa9e2('0x4b')]['id']}})[_0xa9e2('0x19')](handleEntityNotFound(_0x1c4016,null))[_0xa9e2('0x19')](function(_0x56e720){if(_0x56e720){_0x328cce=_0x56e720;_0x3fcb06[_0xa9e2('0x37')]=_['keys'](db[_0xa9e2('0x52')]['rawAttributes']);_0x3fcb06[_0xa9e2('0x38')]=_[_0xa9e2('0x4c')](_0x33e0e7['query']);_0x3fcb06[_0xa9e2('0x39')]=_[_0xa9e2('0x3a')](_0x3fcb06[_0xa9e2('0x37')],_0x3fcb06[_0xa9e2('0x38')]);_0x19e620[_0xa9e2('0x3b')]=_[_0xa9e2('0x3a')](_0x3fcb06[_0xa9e2('0x37')],qs[_0xa9e2('0x3c')](_0x33e0e7[_0xa9e2('0x38')][_0xa9e2('0x3c')]));_0x19e620[_0xa9e2('0x3b')]=_0x19e620[_0xa9e2('0x3b')][_0xa9e2('0x3d')]?_0x19e620[_0xa9e2('0x3b')]:_0x3fcb06[_0xa9e2('0x37')];_0x19e620[_0xa9e2('0x40')]=qs['sort'](_0x33e0e7[_0xa9e2('0x38')][_0xa9e2('0x41')]);_0x19e620['where']=qs[_0xa9e2('0x39')](_['pick'](_0x33e0e7[_0xa9e2('0x38')],_0x3fcb06['filters']));if(_0x33e0e7[_0xa9e2('0x38')][_0xa9e2('0x44')]){_0x19e620[_0xa9e2('0x42')]=_['merge'](_0x19e620[_0xa9e2('0x42')],{'$or':_[_0xa9e2('0x32')](_0x19e620['attributes'],function(_0x583bb2){var _0x4b3ae6={};_0x4b3ae6[_0x583bb2]={'$like':'%'+_0x33e0e7['query'][_0xa9e2('0x44')]+'%'};return _0x4b3ae6;})});}_0x19e620=_['merge']({},_0x19e620,_0x33e0e7[_0xa9e2('0x46')]);return _0x328cce[_0xa9e2('0x54')](_0x19e620);}})[_0xa9e2('0x19')](function(_0x40e3d3){if(_0x40e3d3){_0x4df7e9=_0x40e3d3[_0xa9e2('0x3d')];if(!_0x33e0e7[_0xa9e2('0x38')][_0xa9e2('0x3e')](_0xa9e2('0x3f'))){_0x19e620[_0xa9e2('0x28')]=qs[_0xa9e2('0x28')](_0x33e0e7[_0xa9e2('0x38')]['limit']);_0x19e620[_0xa9e2('0x27')]=qs[_0xa9e2('0x27')](_0x33e0e7['query'][_0xa9e2('0x27')]);}return _0x328cce[_0xa9e2('0x54')](_0x19e620);}})[_0xa9e2('0x19')](function(_0xc24552){if(_0xc24552){return _0xc24552?{'count':_0x4df7e9,'rows':_0xc24552}:null;}})[_0xa9e2('0x19')](respondWithResult(_0x1c4016,null))['catch'](handleError(_0x1c4016,null));};exports[_0xa9e2('0x55')]=function(_0x5ad6f0,_0x373e89,_0x24630f){var _0x1f1886={};var _0x488942={};var _0x3b05e7;var _0x566b92;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x5ad6f0[_0xa9e2('0x4b')]['id']}})[_0xa9e2('0x19')](handleEntityNotFound(_0x373e89,null))[_0xa9e2('0x19')](function(_0x437a39){if(_0x437a39){_0x3b05e7=_0x437a39;_0x488942[_0xa9e2('0x37')]=_[_0xa9e2('0x4c')](db['VtigerField'][_0xa9e2('0x34')]);_0x488942[_0xa9e2('0x38')]=_['keys'](_0x5ad6f0[_0xa9e2('0x38')]);_0x488942[_0xa9e2('0x39')]=_[_0xa9e2('0x3a')](_0x488942[_0xa9e2('0x37')],_0x488942[_0xa9e2('0x38')]);_0x1f1886[_0xa9e2('0x3b')]=_['intersection'](_0x488942[_0xa9e2('0x37')],qs[_0xa9e2('0x3c')](_0x5ad6f0['query'][_0xa9e2('0x3c')]));_0x1f1886[_0xa9e2('0x3b')]=_0x1f1886[_0xa9e2('0x3b')][_0xa9e2('0x3d')]?_0x1f1886[_0xa9e2('0x3b')]:_0x488942['model'];_0x1f1886[_0xa9e2('0x40')]=qs[_0xa9e2('0x41')](_0x5ad6f0[_0xa9e2('0x38')][_0xa9e2('0x41')]);_0x1f1886[_0xa9e2('0x42')]=qs[_0xa9e2('0x39')](_[_0xa9e2('0x43')](_0x5ad6f0[_0xa9e2('0x38')],_0x488942[_0xa9e2('0x39')]));if(_0x5ad6f0[_0xa9e2('0x38')]['filter']){_0x1f1886[_0xa9e2('0x42')]=_['merge'](_0x1f1886[_0xa9e2('0x42')],{'$or':_[_0xa9e2('0x32')](_0x1f1886[_0xa9e2('0x3b')],function(_0x35fa90){var _0x5141ca={};_0x5141ca[_0x35fa90]={'$like':'%'+_0x5ad6f0[_0xa9e2('0x38')][_0xa9e2('0x44')]+'%'};return _0x5141ca;})});}_0x1f1886=_['merge']({},_0x1f1886,_0x5ad6f0[_0xa9e2('0x46')]);return _0x3b05e7[_0xa9e2('0x55')](_0x1f1886);}})[_0xa9e2('0x19')](function(_0x25e876){if(_0x25e876){_0x566b92=_0x25e876[_0xa9e2('0x3d')];if(!_0x5ad6f0['query'][_0xa9e2('0x3e')](_0xa9e2('0x3f'))){_0x1f1886[_0xa9e2('0x28')]=qs['limit'](_0x5ad6f0[_0xa9e2('0x38')][_0xa9e2('0x28')]);_0x1f1886[_0xa9e2('0x27')]=qs[_0xa9e2('0x27')](_0x5ad6f0['query'][_0xa9e2('0x27')]);}return _0x3b05e7[_0xa9e2('0x55')](_0x1f1886);}})[_0xa9e2('0x19')](function(_0x383023){if(_0x383023){return _0x383023?{'count':_0x566b92,'rows':_0x383023}:null;}})[_0xa9e2('0x19')](respondWithResult(_0x373e89,null))[_0xa9e2('0x49')](handleError(_0x373e89,null));}; \ No newline at end of file +var _0x2f9f=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','getSubjects','VtigerField','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus'];(function(_0xd3f076,_0x447fff){var _0x2ffe1f=function(_0x11f36c){while(--_0x11f36c){_0xd3f076['push'](_0xd3f076['shift']());}};_0x2ffe1f(++_0x447fff);}(_0x2f9f,0x96));var _0xf2f9=function(_0x2e8fe5,_0x2eeb3a){_0x2e8fe5=_0x2e8fe5-0x0;var _0x17dab8=_0x2f9f[_0x2e8fe5];return _0x17dab8;};'use strict';var pdf=require(_0xf2f9('0x0'));var emlformat=require(_0xf2f9('0x1'));var rimraf=require(_0xf2f9('0x2'));var zipdir=require(_0xf2f9('0x3'));var jsonpatch=require(_0xf2f9('0x4'));var rp=require('request-promise');var moment=require(_0xf2f9('0x5'));var BPromise=require(_0xf2f9('0x6'));var Mustache=require(_0xf2f9('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf2f9('0x8'));var csv=require(_0xf2f9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf2f9('0xa'));var squel=require(_0xf2f9('0xb'));var crypto=require(_0xf2f9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf2f9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf2f9('0xe'));var Papa=require(_0xf2f9('0xf'));var Redis=require('ioredis');var authService=require(_0xf2f9('0x10'));var qs=require(_0xf2f9('0x11'));var as=require(_0xf2f9('0x12'));var hardwareService=require(_0xf2f9('0x13'));var logger=require(_0xf2f9('0x14'))(_0xf2f9('0x15'));var utils=require('../../config/utils');var config=require(_0xf2f9('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf2f9('0x17'));var client=jayson[_0xf2f9('0x18')][_0xf2f9('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4f49ad,_0x212de6,_0x18b809){if(_0x18b809){var _0x4872db=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4872db[_0xf2f9('0x1a')](_0x212de6)){return _0x4f49ad;}else{throw new db[(_0xf2f9('0x1b'))][(_0xf2f9('0x1c'))](_0xf2f9('0x1d'));}}else{return _0x4f49ad;}}function respondWithRpcPromise(_0x4080ef,_0x7ee9f6,_0x28cc48,_0x1e1a86){return new BPromise(function(_0x1b298c,_0x1a2436){var _0x3ecd9f=_0x1e1a86||client;return _0x3ecd9f[_0xf2f9('0x1e')](_0x4080ef,_0x28cc48)['then'](function(_0x220d7f){logger[_0xf2f9('0x1f')](_0xf2f9('0x20'),_0x7ee9f6,_0xf2f9('0x21'));logger[_0xf2f9('0x22')](_0xf2f9('0x23'),_0x7ee9f6,'request\x20sent',JSON[_0xf2f9('0x24')](_0x220d7f));if(_0x220d7f[_0xf2f9('0x25')]){if(_0x220d7f[_0xf2f9('0x25')][_0xf2f9('0x26')]===0x1f4){logger['error'](_0xf2f9('0x20'),_0x7ee9f6,_0x220d7f[_0xf2f9('0x25')][_0xf2f9('0x27')]);return _0x1a2436(_0x220d7f['error'][_0xf2f9('0x27')]);}logger['error'](_0xf2f9('0x20'),_0x7ee9f6,_0x220d7f['error'][_0xf2f9('0x27')]);return _0x1b298c(_0x220d7f[_0xf2f9('0x25')][_0xf2f9('0x27')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x7ee9f6,_0xf2f9('0x21'));_0x1b298c(_0x220d7f[_0xf2f9('0x28')]['message']);}})['catch'](function(_0x535502){logger['error'](_0xf2f9('0x20'),_0x7ee9f6,_0x535502);_0x1a2436(_0x535502);});});}function respondWithStatusCode(_0x3bd94f,_0x182b98){_0x182b98=_0x182b98||0xcc;return function(_0x446e4d){if(_0x446e4d){return _0x3bd94f[_0xf2f9('0x29')](_0x182b98);}return _0x3bd94f[_0xf2f9('0x2a')](_0x182b98)[_0xf2f9('0x2b')]();};}function respondWithResult(_0x381fc3,_0x387eb3){_0x387eb3=_0x387eb3||0xc8;return function(_0x3a4833){if(_0x3a4833){return _0x381fc3[_0xf2f9('0x2a')](_0x387eb3)[_0xf2f9('0x2c')](_0x3a4833);}};}function respondWithFilteredResult(_0x3a276,_0x178bbd){return function(_0x5b51b7){if(_0x5b51b7){var _0x30e8d3=_0x5b51b7[_0xf2f9('0x2d')],_0x398d12=_0x178bbd[_0xf2f9('0x2e')],_0x369283=_0x178bbd['offset']+_0x178bbd[_0xf2f9('0x2f')],_0x4f7c03;if(_0x369283>=_0x30e8d3){_0x369283=_0x30e8d3;_0x4f7c03=0xc8;}else{_0x4f7c03=0xce;}_0x3a276[_0xf2f9('0x2a')](_0x4f7c03);return _0x3a276[_0xf2f9('0x30')](_0xf2f9('0x31'),_0x398d12+'-'+_0x369283+'/'+_0x30e8d3)[_0xf2f9('0x2c')](_0x5b51b7);}return null;};}function patchUpdates(_0x22c8dc){return function(_0x4a307c){try{jsonpatch[_0xf2f9('0x32')](_0x4a307c,_0x22c8dc,!![]);}catch(_0x5bdacc){return BPromise[_0xf2f9('0x33')](_0x5bdacc);}return _0x4a307c['save']();};}function saveUpdates(_0x3bbb5b,_0x38cf77){return function(_0x31a59a){if(_0x31a59a){return _0x31a59a[_0xf2f9('0x34')](_0x3bbb5b)[_0xf2f9('0x35')](function(_0x16b7e7){return _0x16b7e7;});}return null;};}function removeEntity(_0x3808ce,_0x51f433){return function(_0x4d0f50){if(_0x4d0f50){return _0x4d0f50[_0xf2f9('0x36')]()['then'](function(){_0x3808ce[_0xf2f9('0x2a')](0xcc)[_0xf2f9('0x2b')]();});}};}function handleEntityNotFound(_0xfd26b9,_0x577a14){return function(_0x462e67){if(!_0x462e67){_0xfd26b9['sendStatus'](0x194);}return _0x462e67;};}function handleError(_0x534a2a,_0x4692db){_0x4692db=_0x4692db||0x1f4;return function(_0x1652c4){logger[_0xf2f9('0x25')](_0x1652c4[_0xf2f9('0x37')]);if(_0x1652c4[_0xf2f9('0x38')]){delete _0x1652c4[_0xf2f9('0x38')];}_0x534a2a['status'](_0x4692db)[_0xf2f9('0x39')](_0x1652c4);};}exports[_0xf2f9('0x3a')]=function(_0x4f1992,_0x86dfb8){var _0x30d761={},_0x723c58={},_0x3b8f38={'count':0x0,'rows':[]};var _0x405b07=_[_0xf2f9('0x3b')](db[_0xf2f9('0x3c')][_0xf2f9('0x3d')],function(_0x5e08b0){return{'name':_0x5e08b0[_0xf2f9('0x3e')],'type':_0x5e08b0[_0xf2f9('0x3f')][_0xf2f9('0x40')]};});_0x723c58[_0xf2f9('0x41')]=_[_0xf2f9('0x3b')](_0x405b07,_0xf2f9('0x38'));_0x723c58[_0xf2f9('0x42')]=_[_0xf2f9('0x43')](_0x4f1992[_0xf2f9('0x42')]);_0x723c58['filters']=_[_0xf2f9('0x44')](_0x723c58[_0xf2f9('0x41')],_0x723c58[_0xf2f9('0x42')]);_0x30d761[_0xf2f9('0x45')]=_[_0xf2f9('0x44')](_0x723c58['model'],qs[_0xf2f9('0x46')](_0x4f1992[_0xf2f9('0x42')]['fields']));_0x30d761[_0xf2f9('0x45')]=_0x30d761['attributes'][_0xf2f9('0x47')]?_0x30d761['attributes']:_0x723c58['model'];if(!_0x4f1992[_0xf2f9('0x42')][_0xf2f9('0x48')](_0xf2f9('0x49'))){_0x30d761['limit']=qs[_0xf2f9('0x2f')](_0x4f1992['query'][_0xf2f9('0x2f')]);_0x30d761[_0xf2f9('0x2e')]=qs[_0xf2f9('0x2e')](_0x4f1992[_0xf2f9('0x42')][_0xf2f9('0x2e')]);}_0x30d761[_0xf2f9('0x4a')]=qs[_0xf2f9('0x4b')](_0x4f1992[_0xf2f9('0x42')]['sort']);_0x30d761[_0xf2f9('0x4c')]=qs[_0xf2f9('0x4d')](_[_0xf2f9('0x4e')](_0x4f1992[_0xf2f9('0x42')],_0x723c58['filters']),_0x405b07);if(_0x4f1992['query'][_0xf2f9('0x4f')]){_0x30d761['where']=_[_0xf2f9('0x50')](_0x30d761[_0xf2f9('0x4c')],{'$or':_['map'](_0x405b07,function(_0x8a7c56){if(_0x8a7c56[_0xf2f9('0x3f')]!=='VIRTUAL'){var _0x22ae98={};_0x22ae98[_0x8a7c56[_0xf2f9('0x38')]]={'$like':'%'+_0x4f1992[_0xf2f9('0x42')][_0xf2f9('0x4f')]+'%'};return _0x22ae98;}})});}_0x30d761=_[_0xf2f9('0x50')]({},_0x30d761,_0x4f1992[_0xf2f9('0x51')]);var _0x1762e2={'where':_0x30d761[_0xf2f9('0x4c')]};return db[_0xf2f9('0x3c')][_0xf2f9('0x2d')](_0x1762e2)[_0xf2f9('0x35')](function(_0x58c426){_0x3b8f38[_0xf2f9('0x2d')]=_0x58c426;if(_0x4f1992[_0xf2f9('0x42')][_0xf2f9('0x52')]){_0x30d761[_0xf2f9('0x53')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x30d761);})[_0xf2f9('0x35')](function(_0xf5edc2){_0x3b8f38[_0xf2f9('0x54')]=_0xf5edc2;return _0x3b8f38;})[_0xf2f9('0x35')](respondWithFilteredResult(_0x86dfb8,_0x30d761))[_0xf2f9('0x55')](handleError(_0x86dfb8,null));};exports[_0xf2f9('0x56')]=function(_0x69e026,_0x269b8a){var _0xe4279a={'raw':![],'where':{'id':_0x69e026[_0xf2f9('0x57')]['id']}},_0x5a02da={};_0x5a02da[_0xf2f9('0x41')]=_[_0xf2f9('0x43')](db[_0xf2f9('0x3c')][_0xf2f9('0x3d')]);_0x5a02da['query']=_['keys'](_0x69e026[_0xf2f9('0x42')]);_0x5a02da[_0xf2f9('0x4d')]=_[_0xf2f9('0x44')](_0x5a02da[_0xf2f9('0x41')],_0x5a02da[_0xf2f9('0x42')]);_0xe4279a[_0xf2f9('0x45')]=_[_0xf2f9('0x44')](_0x5a02da['model'],qs[_0xf2f9('0x46')](_0x69e026['query'][_0xf2f9('0x46')]));_0xe4279a[_0xf2f9('0x45')]=_0xe4279a[_0xf2f9('0x45')][_0xf2f9('0x47')]?_0xe4279a[_0xf2f9('0x45')]:_0x5a02da[_0xf2f9('0x41')];if(_0x69e026[_0xf2f9('0x42')][_0xf2f9('0x52')]){_0xe4279a[_0xf2f9('0x53')]=[{'all':!![]}];}_0xe4279a=_['merge']({},_0xe4279a,_0x69e026[_0xf2f9('0x51')]);return db['VtigerConfiguration'][_0xf2f9('0x58')](_0xe4279a)['then'](handleEntityNotFound(_0x269b8a,null))[_0xf2f9('0x35')](respondWithResult(_0x269b8a,null))['catch'](handleError(_0x269b8a,null));};exports[_0xf2f9('0x59')]=function(_0x4eb8a6,_0x1ae40e){return db[_0xf2f9('0x3c')]['create'](_0x4eb8a6['body'],{})[_0xf2f9('0x35')](respondWithResult(_0x1ae40e,0xc9))['catch'](handleError(_0x1ae40e,null));};exports['update']=function(_0x54a343,_0x37fe27){if(_0x54a343['body']['id']){delete _0x54a343[_0xf2f9('0x5a')]['id'];}return db['VtigerConfiguration'][_0xf2f9('0x58')]({'where':{'id':_0x54a343[_0xf2f9('0x57')]['id']}})[_0xf2f9('0x35')](handleEntityNotFound(_0x37fe27,null))[_0xf2f9('0x35')](saveUpdates(_0x54a343[_0xf2f9('0x5a')],null))['then'](respondWithResult(_0x37fe27,null))[_0xf2f9('0x55')](handleError(_0x37fe27,null));};exports[_0xf2f9('0x36')]=function(_0x27170b,_0x49baf7){return db[_0xf2f9('0x3c')][_0xf2f9('0x58')]({'where':{'id':_0x27170b['params']['id']}})['then'](handleEntityNotFound(_0x49baf7,null))[_0xf2f9('0x35')](removeEntity(_0x49baf7,null))['catch'](handleError(_0x49baf7,null));};exports['getFields']=function(_0x5ea255,_0x548590,_0x1d02ae){var _0x1d5c5d={};var _0x548d0c={};var _0x1c8010;var _0x5d66fe;return db[_0xf2f9('0x3c')]['findOne']({'where':{'id':_0x5ea255[_0xf2f9('0x57')]['id']}})[_0xf2f9('0x35')](handleEntityNotFound(_0x548590,null))['then'](function(_0x4bd3c9){if(_0x4bd3c9){_0x1c8010=_0x4bd3c9;_0x548d0c[_0xf2f9('0x41')]=_['keys'](db['VtigerField']['rawAttributes']);_0x548d0c['query']=_[_0xf2f9('0x43')](_0x5ea255[_0xf2f9('0x42')]);_0x548d0c[_0xf2f9('0x4d')]=_[_0xf2f9('0x44')](_0x548d0c[_0xf2f9('0x41')],_0x548d0c['query']);_0x1d5c5d[_0xf2f9('0x45')]=_[_0xf2f9('0x44')](_0x548d0c[_0xf2f9('0x41')],qs[_0xf2f9('0x46')](_0x5ea255[_0xf2f9('0x42')][_0xf2f9('0x46')]));_0x1d5c5d[_0xf2f9('0x45')]=_0x1d5c5d[_0xf2f9('0x45')][_0xf2f9('0x47')]?_0x1d5c5d['attributes']:_0x548d0c[_0xf2f9('0x41')];_0x1d5c5d['order']=qs['sort'](_0x5ea255[_0xf2f9('0x42')][_0xf2f9('0x4b')]);_0x1d5c5d[_0xf2f9('0x4c')]=qs[_0xf2f9('0x4d')](_[_0xf2f9('0x4e')](_0x5ea255[_0xf2f9('0x42')],_0x548d0c['filters']));if(_0x5ea255[_0xf2f9('0x42')]['filter']){_0x1d5c5d[_0xf2f9('0x4c')]=_['merge'](_0x1d5c5d[_0xf2f9('0x4c')],{'$or':_[_0xf2f9('0x3b')](_0x1d5c5d['attributes'],function(_0x41b09d){var _0x3e761d={};_0x3e761d[_0x41b09d]={'$like':'%'+_0x5ea255['query'][_0xf2f9('0x4f')]+'%'};return _0x3e761d;})});}_0x1d5c5d=_[_0xf2f9('0x50')]({},_0x1d5c5d,_0x5ea255[_0xf2f9('0x51')]);return _0x1c8010['getFields'](_0x1d5c5d);}})[_0xf2f9('0x35')](function(_0x1e8758){if(_0x1e8758){_0x5d66fe=_0x1e8758['length'];if(!_0x5ea255[_0xf2f9('0x42')][_0xf2f9('0x48')](_0xf2f9('0x49'))){_0x1d5c5d[_0xf2f9('0x2f')]=qs['limit'](_0x5ea255['query'][_0xf2f9('0x2f')]);_0x1d5c5d['offset']=qs[_0xf2f9('0x2e')](_0x5ea255[_0xf2f9('0x42')]['offset']);}return _0x1c8010[_0xf2f9('0x5b')](_0x1d5c5d);}})['then'](function(_0x18bea2){if(_0x18bea2){return _0x18bea2?{'count':_0x5d66fe,'rows':_0x18bea2}:null;}})['then'](respondWithResult(_0x548590,null))[_0xf2f9('0x55')](handleError(_0x548590,null));};exports[_0xf2f9('0x5c')]=function(_0x548a07,_0x314e92,_0x5f0782){var _0x42d535={};var _0xc8647e={};var _0x3af972;var _0x59bcb3;return db[_0xf2f9('0x3c')]['findOne']({'where':{'id':_0x548a07['params']['id']}})[_0xf2f9('0x35')](handleEntityNotFound(_0x314e92,null))[_0xf2f9('0x35')](function(_0x24d16e){if(_0x24d16e){_0x3af972=_0x24d16e;_0xc8647e[_0xf2f9('0x41')]=_['keys'](db[_0xf2f9('0x5d')]['rawAttributes']);_0xc8647e[_0xf2f9('0x42')]=_['keys'](_0x548a07[_0xf2f9('0x42')]);_0xc8647e[_0xf2f9('0x4d')]=_[_0xf2f9('0x44')](_0xc8647e['model'],_0xc8647e[_0xf2f9('0x42')]);_0x42d535[_0xf2f9('0x45')]=_[_0xf2f9('0x44')](_0xc8647e[_0xf2f9('0x41')],qs[_0xf2f9('0x46')](_0x548a07['query'][_0xf2f9('0x46')]));_0x42d535[_0xf2f9('0x45')]=_0x42d535['attributes'][_0xf2f9('0x47')]?_0x42d535[_0xf2f9('0x45')]:_0xc8647e[_0xf2f9('0x41')];_0x42d535['order']=qs[_0xf2f9('0x4b')](_0x548a07[_0xf2f9('0x42')]['sort']);_0x42d535[_0xf2f9('0x4c')]=qs[_0xf2f9('0x4d')](_[_0xf2f9('0x4e')](_0x548a07[_0xf2f9('0x42')],_0xc8647e[_0xf2f9('0x4d')]));if(_0x548a07[_0xf2f9('0x42')]['filter']){_0x42d535['where']=_[_0xf2f9('0x50')](_0x42d535[_0xf2f9('0x4c')],{'$or':_[_0xf2f9('0x3b')](_0x42d535[_0xf2f9('0x45')],function(_0x4395f9){var _0x1a1710={};_0x1a1710[_0x4395f9]={'$like':'%'+_0x548a07[_0xf2f9('0x42')][_0xf2f9('0x4f')]+'%'};return _0x1a1710;})});}_0x42d535=_[_0xf2f9('0x50')]({},_0x42d535,_0x548a07['options']);return _0x3af972[_0xf2f9('0x5c')](_0x42d535);}})['then'](function(_0x34c510){if(_0x34c510){_0x59bcb3=_0x34c510[_0xf2f9('0x47')];if(!_0x548a07['query']['hasOwnProperty'](_0xf2f9('0x49'))){_0x42d535[_0xf2f9('0x2f')]=qs[_0xf2f9('0x2f')](_0x548a07[_0xf2f9('0x42')][_0xf2f9('0x2f')]);_0x42d535[_0xf2f9('0x2e')]=qs[_0xf2f9('0x2e')](_0x548a07[_0xf2f9('0x42')][_0xf2f9('0x2e')]);}return _0x3af972[_0xf2f9('0x5c')](_0x42d535);}})[_0xf2f9('0x35')](function(_0x6febdb){if(_0x6febdb){return _0x6febdb?{'count':_0x59bcb3,'rows':_0x6febdb}:null;}})[_0xf2f9('0x35')](respondWithResult(_0x314e92,null))[_0xf2f9('0x55')](handleError(_0x314e92,null));};exports[_0xf2f9('0x5e')]=function(_0x416e4d,_0x178e79,_0x45b6a7){var _0x5a62e5={};var _0x479f74={};var _0x30cd12;var _0x4ad43b;return db[_0xf2f9('0x3c')][_0xf2f9('0x5f')]({'where':{'id':_0x416e4d[_0xf2f9('0x57')]['id']}})[_0xf2f9('0x35')](handleEntityNotFound(_0x178e79,null))[_0xf2f9('0x35')](function(_0x309e93){if(_0x309e93){_0x30cd12=_0x309e93;_0x479f74[_0xf2f9('0x41')]=_[_0xf2f9('0x43')](db['VtigerField']['rawAttributes']);_0x479f74[_0xf2f9('0x42')]=_['keys'](_0x416e4d[_0xf2f9('0x42')]);_0x479f74[_0xf2f9('0x4d')]=_[_0xf2f9('0x44')](_0x479f74[_0xf2f9('0x41')],_0x479f74[_0xf2f9('0x42')]);_0x5a62e5['attributes']=_[_0xf2f9('0x44')](_0x479f74['model'],qs[_0xf2f9('0x46')](_0x416e4d[_0xf2f9('0x42')][_0xf2f9('0x46')]));_0x5a62e5[_0xf2f9('0x45')]=_0x5a62e5[_0xf2f9('0x45')][_0xf2f9('0x47')]?_0x5a62e5[_0xf2f9('0x45')]:_0x479f74['model'];_0x5a62e5[_0xf2f9('0x4a')]=qs[_0xf2f9('0x4b')](_0x416e4d[_0xf2f9('0x42')][_0xf2f9('0x4b')]);_0x5a62e5['where']=qs[_0xf2f9('0x4d')](_[_0xf2f9('0x4e')](_0x416e4d['query'],_0x479f74['filters']));if(_0x416e4d[_0xf2f9('0x42')][_0xf2f9('0x4f')]){_0x5a62e5[_0xf2f9('0x4c')]=_[_0xf2f9('0x50')](_0x5a62e5['where'],{'$or':_[_0xf2f9('0x3b')](_0x5a62e5[_0xf2f9('0x45')],function(_0x11c91c){var _0x1c6e25={};_0x1c6e25[_0x11c91c]={'$like':'%'+_0x416e4d['query'][_0xf2f9('0x4f')]+'%'};return _0x1c6e25;})});}_0x5a62e5=_[_0xf2f9('0x50')]({},_0x5a62e5,_0x416e4d[_0xf2f9('0x51')]);return _0x30cd12[_0xf2f9('0x5e')](_0x5a62e5);}})[_0xf2f9('0x35')](function(_0x33032a){if(_0x33032a){_0x4ad43b=_0x33032a['length'];if(!_0x416e4d[_0xf2f9('0x42')][_0xf2f9('0x48')](_0xf2f9('0x49'))){_0x5a62e5[_0xf2f9('0x2f')]=qs[_0xf2f9('0x2f')](_0x416e4d[_0xf2f9('0x42')]['limit']);_0x5a62e5[_0xf2f9('0x2e')]=qs[_0xf2f9('0x2e')](_0x416e4d[_0xf2f9('0x42')][_0xf2f9('0x2e')]);}return _0x30cd12['getDescriptions'](_0x5a62e5);}})['then'](function(_0x92e216){if(_0x92e216){return _0x92e216?{'count':_0x4ad43b,'rows':_0x92e216}:null;}})['then'](respondWithResult(_0x178e79,null))[_0xf2f9('0x55')](handleError(_0x178e79,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 65c64b9..d4887fd 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 _0x1fc8=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','util','api'];(function(_0x59137b,_0x20880e){var _0x267490=function(_0xcec6de){while(--_0xcec6de){_0x59137b['push'](_0x59137b['shift']());}};_0x267490(++_0x20880e);}(_0x1fc8,0x76));var _0x81fc=function(_0x4caa00,_0x2515c9){_0x4caa00=_0x4caa00-0x0;var _0x10d007=_0x1fc8[_0x4caa00];return _0x10d007;};'use strict';var _=require('lodash');var util=require(_0x81fc('0x0'));var logger=require('../../config/logger')(_0x81fc('0x1'));var moment=require('moment');var BPromise=require(_0x81fc('0x2'));var rp=require(_0x81fc('0x3'));var fs=require('fs');var path=require(_0x81fc('0x4'));var rimraf=require(_0x81fc('0x5'));var config=require(_0x81fc('0x6'));var attributes=require(_0x81fc('0x7'));module[_0x81fc('0x8')]=function(_0x28c9d1,_0x2608c8){return _0x28c9d1['define'](_0x81fc('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x728c=['moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger'];(function(_0x2a90f9,_0x520722){var _0x3b606f=function(_0x4e8686){while(--_0x4e8686){_0x2a90f9['push'](_0x2a90f9['shift']());}};_0x3b606f(++_0x520722);}(_0x728c,0x1c6));var _0xc728=function(_0x3578a7,_0x2d8fc6){_0x3578a7=_0x3578a7-0x0;var _0x1377b3=_0x728c[_0x3578a7];return _0x1377b3;};'use strict';var _=require(_0xc728('0x0'));var util=require('util');var logger=require(_0xc728('0x1'))('api');var moment=require(_0xc728('0x2'));var BPromise=require(_0xc728('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc728('0x4'));var rimraf=require(_0xc728('0x5'));var config=require(_0xc728('0x6'));var attributes=require(_0xc728('0x7'));module[_0xc728('0x8')]=function(_0x2da47e,_0x2fb26a){return _0x2da47e[_0xc728('0x9')](_0xc728('0xa'),attributes,{'tableName':_0xc728('0xb'),'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 4777af5..2e118d4 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 _0x9b20=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x9b20,0x166));var _0x09b2=function(_0x5120be,_0x57e8de){_0x5120be=_0x5120be-0x0;var _0xd044c6=_0x9b20[_0x5120be];return _0xd044c6;};'use strict';var _=require(_0x09b2('0x0'));var util=require(_0x09b2('0x1'));var moment=require(_0x09b2('0x2'));var BPromise=require(_0x09b2('0x3'));var rs=require(_0x09b2('0x4'));var fs=require('fs');var Redis=require(_0x09b2('0x5'));var db=require(_0x09b2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x09b2('0x7'))('rpc');var config=require(_0x09b2('0x8'));var jayson=require(_0x09b2('0x9'));var client=jayson[_0x09b2('0xa')][_0x09b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43fc7d,_0xa1502,_0x4710c8){return new BPromise(function(_0x5203e6,_0xb915e6){return client['request'](_0x43fc7d,_0x4710c8)[_0x09b2('0xc')](function(_0x228035){logger[_0x09b2('0xd')](_0x09b2('0xe'),_0xa1502,'request\x20sent');logger['debug'](_0x09b2('0xf'),_0xa1502,_0x09b2('0x10'),JSON['stringify'](_0x228035));if(_0x228035[_0x09b2('0x11')]){if(_0x228035[_0x09b2('0x11')][_0x09b2('0x12')]===0x1f4){logger[_0x09b2('0x11')](_0x09b2('0xe'),_0xa1502,_0x228035[_0x09b2('0x11')]['message']);return _0xb915e6(_0x228035['error']['message']);}logger[_0x09b2('0x11')](_0x09b2('0xe'),_0xa1502,_0x228035['error'][_0x09b2('0x13')]);return _0x5203e6(_0x228035[_0x09b2('0x11')]['message']);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0xa1502,'request\x20sent');_0x5203e6(_0x228035['result']['message']);}})['catch'](function(_0x527c5a){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0xa1502,_0x527c5a);_0xb915e6(_0x527c5a);});});} \ No newline at end of file +var _0xcc8e=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcc8e,0x127));var _0xecc8=function(_0x152305,_0x18f49c){_0x152305=_0x152305-0x0;var _0x2c59a3=_0xcc8e[_0x152305];return _0x2c59a3;};'use strict';var _=require(_0xecc8('0x0'));var util=require('util');var moment=require(_0xecc8('0x1'));var BPromise=require('bluebird');var rs=require(_0xecc8('0x2'));var fs=require('fs');var Redis=require(_0xecc8('0x3'));var db=require(_0xecc8('0x4'))['db'];var utils=require(_0xecc8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xecc8('0x6'));var jayson=require(_0xecc8('0x7'));var client=jayson[_0xecc8('0x8')][_0xecc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x103c2a,_0x19e0c9,_0x579288){return new BPromise(function(_0x47e071,_0x1152e9){return client[_0xecc8('0xa')](_0x103c2a,_0x579288)[_0xecc8('0xb')](function(_0x38f1dc){logger[_0xecc8('0xc')](_0xecc8('0xd'),_0x19e0c9,_0xecc8('0xe'));logger[_0xecc8('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x19e0c9,_0xecc8('0xe'),JSON[_0xecc8('0x10')](_0x38f1dc));if(_0x38f1dc[_0xecc8('0x11')]){if(_0x38f1dc[_0xecc8('0x11')][_0xecc8('0x12')]===0x1f4){logger[_0xecc8('0x11')](_0xecc8('0xd'),_0x19e0c9,_0x38f1dc[_0xecc8('0x11')][_0xecc8('0x13')]);return _0x1152e9(_0x38f1dc[_0xecc8('0x11')][_0xecc8('0x13')]);}logger[_0xecc8('0x11')](_0xecc8('0xd'),_0x19e0c9,_0x38f1dc['error']['message']);return _0x47e071(_0x38f1dc[_0xecc8('0x11')]['message']);}else{logger[_0xecc8('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x19e0c9,_0xecc8('0xe'));_0x47e071(_0x38f1dc['result'][_0xecc8('0x13')]);}})['catch'](function(_0x5a58a2){logger[_0xecc8('0x11')](_0xecc8('0xd'),_0x19e0c9,_0x5a58a2);_0x1152e9(_0x5a58a2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index a98907b..99a2106 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 _0x585d=['../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x55d7c2,_0x4ce6fb){var _0x1755ef=function(_0xddc25c){while(--_0xddc25c){_0x55d7c2['push'](_0x55d7c2['shift']());}};_0x1755ef(++_0x4ce6fb);}(_0x585d,0x93));var _0xd585=function(_0x12bdd6,_0x5e2860){_0x12bdd6=_0x12bdd6-0x0;var _0x599091=_0x585d[_0x12bdd6];return _0x599091;};'use strict';var multer=require('multer');var util=require(_0xd585('0x0'));var path=require('path');var timeout=require(_0xd585('0x1'));var express=require(_0xd585('0x2'));var router=express[_0xd585('0x3')]();var auth=require(_0xd585('0x4'));var interaction=require(_0xd585('0x5'));var config=require(_0xd585('0x6'));var controller=require(_0xd585('0x7'));router[_0xd585('0x8')]('/',auth[_0xd585('0x9')](),controller[_0xd585('0xa')]);router[_0xd585('0x8')](_0xd585('0xb'),auth['isAuthenticated'](),controller[_0xd585('0xc')]);router[_0xd585('0xd')]('/',auth[_0xd585('0x9')](),controller['create']);router[_0xd585('0xe')]('/:id',auth[_0xd585('0x9')](),controller[_0xd585('0xf')]);router[_0xd585('0x10')](_0xd585('0xb'),auth['isAuthenticated'](),controller[_0xd585('0x11')]);module[_0xd585('0x12')]=router; \ No newline at end of file +var _0x73ab=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','multer','util'];(function(_0x3697f4,_0x735974){var _0x3bd8cd=function(_0x3dda4a){while(--_0x3dda4a){_0x3697f4['push'](_0x3697f4['shift']());}};_0x3bd8cd(++_0x735974);}(_0x73ab,0x1a7));var _0xb73a=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0x73ab[_0x2179f1];return _0x176ec9;};'use strict';var multer=require(_0xb73a('0x0'));var util=require(_0xb73a('0x1'));var path=require('path');var timeout=require(_0xb73a('0x2'));var express=require(_0xb73a('0x3'));var router=express['Router']();var auth=require(_0xb73a('0x4'));var interaction=require(_0xb73a('0x5'));var config=require(_0xb73a('0x6'));var controller=require(_0xb73a('0x7'));router[_0xb73a('0x8')]('/',auth[_0xb73a('0x9')](),controller[_0xb73a('0xa')]);router['get'](_0xb73a('0xb'),auth[_0xb73a('0x9')](),controller[_0xb73a('0xc')]);router[_0xb73a('0xd')]('/',auth[_0xb73a('0x9')](),controller[_0xb73a('0xe')]);router[_0xb73a('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb73a('0x10')](_0xb73a('0xb'),auth[_0xb73a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index aa2998f..3f958bf 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 _0xba2d=['customVariable','exports','string','STRING','ENUM','variable'];(function(_0x405a1f,_0x446aa3){var _0x4fd010=function(_0xc2ed83){while(--_0xc2ed83){_0x405a1f['push'](_0x405a1f['shift']());}};_0x4fd010(++_0x446aa3);}(_0xba2d,0xa3));var _0xdba2=function(_0x18369d,_0x4792cd){_0x18369d=_0x18369d-0x0;var _0x1940ef=_0xba2d[_0x18369d];return _0x1940ef;};'use strict';var Sequelize=require('sequelize');module[_0xdba2('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue'),'defaultValue':_0xdba2('0x1')},'content':{'type':Sequelize[_0xdba2('0x2')]},'key':{'type':Sequelize[_0xdba2('0x2')]},'keyType':{'type':Sequelize[_0xdba2('0x3')](_0xdba2('0x1'),_0xdba2('0x4'),_0xdba2('0x5'))},'keyContent':{'type':Sequelize[_0xdba2('0x2')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdba2('0x2')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdba2('0x2')]}}; \ No newline at end of file +var _0xf3cd=['customVariable','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0xf3cd[_0x5f36cd];return _0x49832a;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'type':{'type':Sequelize[_0xdf3c('0x2')](_0xdf3c('0x3'),_0xdf3c('0x4'),_0xdf3c('0x5'),'keyValue'),'defaultValue':_0xdf3c('0x3')},'content':{'type':Sequelize[_0xdf3c('0x6')]},'key':{'type':Sequelize[_0xdf3c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xdf3c('0x3'),_0xdf3c('0x4'),_0xdf3c('0x5'))},'keyContent':{'type':Sequelize[_0xdf3c('0x6')]},'idField':{'type':Sequelize[_0xdf3c('0x6')]},'nameField':{'type':Sequelize[_0xdf3c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf3c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9ff507a..f2acb24 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 _0x8e0d=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VtigerField','count','includeAll','findAll','rows','show','params','include','catch','create','body','find','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce'];(function(_0x105278,_0x774ed2){var _0x47b1f=function(_0xf8a100){while(--_0xf8a100){_0x105278['push'](_0x105278['shift']());}};_0x47b1f(++_0x774ed2);}(_0x8e0d,0x82));var _0xd8e0=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8e0d[_0x16b9ed];return _0x66b1f8;};'use strict';var pdf=require(_0xd8e0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd8e0('0x1'));var jsonpatch=require(_0xd8e0('0x2'));var rp=require('request-promise');var moment=require(_0xd8e0('0x3'));var BPromise=require(_0xd8e0('0x4'));var Mustache=require(_0xd8e0('0x5'));var util=require(_0xd8e0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd8e0('0x7'));var ejs=require(_0xd8e0('0x8'));var fs=require('fs');var _=require(_0xd8e0('0x9'));var squel=require(_0xd8e0('0xa'));var crypto=require('crypto');var jsforce=require(_0xd8e0('0xb'));var deskjs=require(_0xd8e0('0xc'));var toCsv=require(_0xd8e0('0x7'));var querystring=require(_0xd8e0('0xd'));var Papa=require(_0xd8e0('0xe'));var Redis=require('ioredis');var authService=require(_0xd8e0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd8e0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd8e0('0x11'));var utils=require(_0xd8e0('0x12'));var config=require(_0xd8e0('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57a6df,_0xdc16bd){_0xdc16bd=_0xdc16bd||0xcc;return function(_0x4d968a){if(_0x4d968a){return _0x57a6df[_0xd8e0('0x14')](_0xdc16bd);}return _0x57a6df['status'](_0xdc16bd)['end']();};}function respondWithResult(_0x496593,_0x1557be){_0x1557be=_0x1557be||0xc8;return function(_0x5c983a){if(_0x5c983a){return _0x496593[_0xd8e0('0x15')](_0x1557be)[_0xd8e0('0x16')](_0x5c983a);}};}function respondWithFilteredResult(_0x2f0004,_0x14e38b){return function(_0x2689d3){if(_0x2689d3){var _0x28f3e0=_0x2689d3['count'],_0xe5d019=_0x14e38b[_0xd8e0('0x17')],_0x345e21=_0x14e38b[_0xd8e0('0x17')]+_0x14e38b[_0xd8e0('0x18')],_0x1ce603;if(_0x345e21>=_0x28f3e0){_0x345e21=_0x28f3e0;_0x1ce603=0xc8;}else{_0x1ce603=0xce;}_0x2f0004[_0xd8e0('0x15')](_0x1ce603);return _0x2f0004[_0xd8e0('0x19')](_0xd8e0('0x1a'),_0xe5d019+'-'+_0x345e21+'/'+_0x28f3e0)[_0xd8e0('0x16')](_0x2689d3);}return null;};}function patchUpdates(_0x3dc2d7){return function(_0x4e7238){try{jsonpatch[_0xd8e0('0x1b')](_0x4e7238,_0x3dc2d7,!![]);}catch(_0x4e41d4){return BPromise['reject'](_0x4e41d4);}return _0x4e7238[_0xd8e0('0x1c')]();};}function saveUpdates(_0x4f4b18,_0x55ce9b){return function(_0x50c2a2){if(_0x50c2a2){return _0x50c2a2[_0xd8e0('0x1d')](_0x4f4b18)[_0xd8e0('0x1e')](function(_0x57a7c2){return _0x57a7c2;});}return null;};}function removeEntity(_0xbf80a,_0x4209fb){return function(_0x1d31de){if(_0x1d31de){return _0x1d31de[_0xd8e0('0x1f')]()[_0xd8e0('0x1e')](function(){_0xbf80a[_0xd8e0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1757f3,_0x340ae1){return function(_0x54c515){if(!_0x54c515){_0x1757f3['sendStatus'](0x194);}return _0x54c515;};}function handleError(_0x5d82f9,_0x309684){_0x309684=_0x309684||0x1f4;return function(_0x1c3aed){logger[_0xd8e0('0x20')](_0x1c3aed[_0xd8e0('0x21')]);if(_0x1c3aed[_0xd8e0('0x22')]){delete _0x1c3aed['name'];}_0x5d82f9['status'](_0x309684)[_0xd8e0('0x23')](_0x1c3aed);};}exports[_0xd8e0('0x24')]=function(_0x15f15b,_0x169373){var _0x51c7b6={},_0x15bd32={},_0x3da15f={'count':0x0,'rows':[]};var _0xd60219=_[_0xd8e0('0x25')](db['VtigerField'][_0xd8e0('0x26')],function(_0x46f3a2){return{'name':_0x46f3a2[_0xd8e0('0x27')],'type':_0x46f3a2[_0xd8e0('0x28')][_0xd8e0('0x29')]};});_0x15bd32[_0xd8e0('0x2a')]=_[_0xd8e0('0x25')](_0xd60219,'name');_0x15bd32[_0xd8e0('0x2b')]=_[_0xd8e0('0x2c')](_0x15f15b[_0xd8e0('0x2b')]);_0x15bd32[_0xd8e0('0x2d')]=_[_0xd8e0('0x2e')](_0x15bd32[_0xd8e0('0x2a')],_0x15bd32[_0xd8e0('0x2b')]);_0x51c7b6[_0xd8e0('0x2f')]=_[_0xd8e0('0x2e')](_0x15bd32[_0xd8e0('0x2a')],qs[_0xd8e0('0x30')](_0x15f15b['query'][_0xd8e0('0x30')]));_0x51c7b6[_0xd8e0('0x2f')]=_0x51c7b6[_0xd8e0('0x2f')][_0xd8e0('0x31')]?_0x51c7b6[_0xd8e0('0x2f')]:_0x15bd32[_0xd8e0('0x2a')];if(!_0x15f15b['query'][_0xd8e0('0x32')](_0xd8e0('0x33'))){_0x51c7b6[_0xd8e0('0x18')]=qs[_0xd8e0('0x18')](_0x15f15b[_0xd8e0('0x2b')][_0xd8e0('0x18')]);_0x51c7b6['offset']=qs[_0xd8e0('0x17')](_0x15f15b[_0xd8e0('0x2b')][_0xd8e0('0x17')]);}_0x51c7b6['order']=qs[_0xd8e0('0x34')](_0x15f15b['query'][_0xd8e0('0x34')]);_0x51c7b6[_0xd8e0('0x35')]=qs[_0xd8e0('0x2d')](_[_0xd8e0('0x36')](_0x15f15b[_0xd8e0('0x2b')],_0x15bd32[_0xd8e0('0x2d')]),_0xd60219);if(_0x15f15b['query'][_0xd8e0('0x37')]){_0x51c7b6[_0xd8e0('0x35')]=_[_0xd8e0('0x38')](_0x51c7b6[_0xd8e0('0x35')],{'$or':_[_0xd8e0('0x25')](_0xd60219,function(_0x576275){if(_0x576275[_0xd8e0('0x28')]!==_0xd8e0('0x39')){var _0x1f6041={};_0x1f6041[_0x576275[_0xd8e0('0x22')]]={'$like':'%'+_0x15f15b[_0xd8e0('0x2b')][_0xd8e0('0x37')]+'%'};return _0x1f6041;}})});}_0x51c7b6=_[_0xd8e0('0x38')]({},_0x51c7b6,_0x15f15b[_0xd8e0('0x3a')]);var _0x1c9c45={'where':_0x51c7b6['where']};return db[_0xd8e0('0x3b')][_0xd8e0('0x3c')](_0x1c9c45)[_0xd8e0('0x1e')](function(_0x304234){_0x3da15f[_0xd8e0('0x3c')]=_0x304234;if(_0x15f15b[_0xd8e0('0x2b')][_0xd8e0('0x3d')]){_0x51c7b6['include']=[{'all':!![]}];}return db[_0xd8e0('0x3b')][_0xd8e0('0x3e')](_0x51c7b6);})[_0xd8e0('0x1e')](function(_0x286035){_0x3da15f[_0xd8e0('0x3f')]=_0x286035;return _0x3da15f;})[_0xd8e0('0x1e')](respondWithFilteredResult(_0x169373,_0x51c7b6))['catch'](handleError(_0x169373,null));};exports[_0xd8e0('0x40')]=function(_0x3f0f31,_0x48e1ec){var _0x371ca7={'raw':!![],'where':{'id':_0x3f0f31[_0xd8e0('0x41')]['id']}},_0x104bed={};_0x104bed[_0xd8e0('0x2a')]=_[_0xd8e0('0x2c')](db[_0xd8e0('0x3b')][_0xd8e0('0x26')]);_0x104bed[_0xd8e0('0x2b')]=_[_0xd8e0('0x2c')](_0x3f0f31[_0xd8e0('0x2b')]);_0x104bed[_0xd8e0('0x2d')]=_[_0xd8e0('0x2e')](_0x104bed[_0xd8e0('0x2a')],_0x104bed['query']);_0x371ca7['attributes']=_[_0xd8e0('0x2e')](_0x104bed['model'],qs[_0xd8e0('0x30')](_0x3f0f31[_0xd8e0('0x2b')]['fields']));_0x371ca7[_0xd8e0('0x2f')]=_0x371ca7[_0xd8e0('0x2f')][_0xd8e0('0x31')]?_0x371ca7[_0xd8e0('0x2f')]:_0x104bed[_0xd8e0('0x2a')];if(_0x3f0f31['query'][_0xd8e0('0x3d')]){_0x371ca7[_0xd8e0('0x42')]=[{'all':!![]}];}_0x371ca7=_[_0xd8e0('0x38')]({},_0x371ca7,_0x3f0f31['options']);return db['VtigerField']['find'](_0x371ca7)[_0xd8e0('0x1e')](handleEntityNotFound(_0x48e1ec,null))[_0xd8e0('0x1e')](respondWithResult(_0x48e1ec,null))[_0xd8e0('0x43')](handleError(_0x48e1ec,null));};exports[_0xd8e0('0x44')]=function(_0x2ddbb7,_0x20234e){return db['VtigerField'][_0xd8e0('0x44')](_0x2ddbb7[_0xd8e0('0x45')],{})[_0xd8e0('0x1e')](respondWithResult(_0x20234e,0xc9))[_0xd8e0('0x43')](handleError(_0x20234e,null));};exports[_0xd8e0('0x1d')]=function(_0x3c6af6,_0x1035ad){if(_0x3c6af6[_0xd8e0('0x45')]['id']){delete _0x3c6af6['body']['id'];}return db[_0xd8e0('0x3b')][_0xd8e0('0x46')]({'where':{'id':_0x3c6af6['params']['id']}})['then'](handleEntityNotFound(_0x1035ad,null))[_0xd8e0('0x1e')](saveUpdates(_0x3c6af6[_0xd8e0('0x45')],null))[_0xd8e0('0x1e')](respondWithResult(_0x1035ad,null))[_0xd8e0('0x43')](handleError(_0x1035ad,null));};exports[_0xd8e0('0x1f')]=function(_0x3abde9,_0x16ecfd){return db[_0xd8e0('0x3b')][_0xd8e0('0x46')]({'where':{'id':_0x3abde9['params']['id']}})[_0xd8e0('0x1e')](handleEntityNotFound(_0x16ecfd,null))[_0xd8e0('0x1e')](removeEntity(_0x16ecfd,null))[_0xd8e0('0x43')](handleError(_0x16ecfd,null));}; \ No newline at end of file +var _0xd624=['html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','VtigerField','count','findAll','rows','show','params','length','includeAll','include','catch','create','body','update','find'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0xd624,0x124));var _0x4d62=function(_0x92ec44,_0x48bdb6){_0x92ec44=_0x92ec44-0x0;var _0x341b89=_0xd624[_0x92ec44];return _0x341b89;};'use strict';var pdf=require(_0x4d62('0x0'));var emlformat=require(_0x4d62('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d62('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4d62('0x3'));var Mustache=require(_0x4d62('0x4'));var util=require(_0x4d62('0x5'));var path=require(_0x4d62('0x6'));var sox=require(_0x4d62('0x7'));var csv=require(_0x4d62('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4d62('0x9'));var crypto=require(_0x4d62('0xa'));var jsforce=require(_0x4d62('0xb'));var deskjs=require(_0x4d62('0xc'));var toCsv=require(_0x4d62('0x8'));var querystring=require('querystring');var Papa=require(_0x4d62('0xd'));var Redis=require(_0x4d62('0xe'));var authService=require(_0x4d62('0xf'));var qs=require(_0x4d62('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d62('0x11'));var logger=require(_0x4d62('0x12'))(_0x4d62('0x13'));var utils=require(_0x4d62('0x14'));var config=require(_0x4d62('0x15'));var db=require(_0x4d62('0x16'))['db'];function respondWithStatusCode(_0x277538,_0xc94193){_0xc94193=_0xc94193||0xcc;return function(_0x3d30a7){if(_0x3d30a7){return _0x277538[_0x4d62('0x17')](_0xc94193);}return _0x277538[_0x4d62('0x18')](_0xc94193)[_0x4d62('0x19')]();};}function respondWithResult(_0x530fb5,_0x117c68){_0x117c68=_0x117c68||0xc8;return function(_0x409910){if(_0x409910){return _0x530fb5[_0x4d62('0x18')](_0x117c68)['json'](_0x409910);}};}function respondWithFilteredResult(_0x31af1d,_0x1f3b54){return function(_0x142396){if(_0x142396){var _0x5e2cee=_0x142396['count'],_0x4974f4=_0x1f3b54['offset'],_0x36b786=_0x1f3b54[_0x4d62('0x1a')]+_0x1f3b54[_0x4d62('0x1b')],_0x1a7c65;if(_0x36b786>=_0x5e2cee){_0x36b786=_0x5e2cee;_0x1a7c65=0xc8;}else{_0x1a7c65=0xce;}_0x31af1d['status'](_0x1a7c65);return _0x31af1d[_0x4d62('0x1c')](_0x4d62('0x1d'),_0x4974f4+'-'+_0x36b786+'/'+_0x5e2cee)[_0x4d62('0x1e')](_0x142396);}return null;};}function patchUpdates(_0x1736f9){return function(_0x12e82e){try{jsonpatch[_0x4d62('0x1f')](_0x12e82e,_0x1736f9,!![]);}catch(_0x268ece){return BPromise[_0x4d62('0x20')](_0x268ece);}return _0x12e82e[_0x4d62('0x21')]();};}function saveUpdates(_0x3e656e,_0x494a8f){return function(_0x5d9e64){if(_0x5d9e64){return _0x5d9e64['update'](_0x3e656e)[_0x4d62('0x22')](function(_0x1cafd9){return _0x1cafd9;});}return null;};}function removeEntity(_0x5af192,_0x5a0796){return function(_0x3a5e4f){if(_0x3a5e4f){return _0x3a5e4f[_0x4d62('0x23')]()[_0x4d62('0x22')](function(){_0x5af192['status'](0xcc)[_0x4d62('0x19')]();});}};}function handleEntityNotFound(_0x30c443,_0x1a7ee9){return function(_0x57987b){if(!_0x57987b){_0x30c443[_0x4d62('0x17')](0x194);}return _0x57987b;};}function handleError(_0x1c7bc6,_0x4d4b94){_0x4d4b94=_0x4d4b94||0x1f4;return function(_0x16cff5){logger[_0x4d62('0x24')](_0x16cff5[_0x4d62('0x25')]);if(_0x16cff5[_0x4d62('0x26')]){delete _0x16cff5[_0x4d62('0x26')];}_0x1c7bc6[_0x4d62('0x18')](_0x4d4b94)[_0x4d62('0x27')](_0x16cff5);};}exports[_0x4d62('0x28')]=function(_0x181fe6,_0x474c69){var _0xb5036e={},_0x54536c={},_0x5c13aa={'count':0x0,'rows':[]};var _0x5174da=_[_0x4d62('0x29')](db['VtigerField'][_0x4d62('0x2a')],function(_0x2b76af){return{'name':_0x2b76af[_0x4d62('0x2b')],'type':_0x2b76af['type'][_0x4d62('0x2c')]};});_0x54536c['model']=_['map'](_0x5174da,_0x4d62('0x26'));_0x54536c['query']=_[_0x4d62('0x2d')](_0x181fe6[_0x4d62('0x2e')]);_0x54536c[_0x4d62('0x2f')]=_[_0x4d62('0x30')](_0x54536c[_0x4d62('0x31')],_0x54536c[_0x4d62('0x2e')]);_0xb5036e[_0x4d62('0x32')]=_[_0x4d62('0x30')](_0x54536c['model'],qs[_0x4d62('0x33')](_0x181fe6[_0x4d62('0x2e')][_0x4d62('0x33')]));_0xb5036e['attributes']=_0xb5036e[_0x4d62('0x32')]['length']?_0xb5036e['attributes']:_0x54536c['model'];if(!_0x181fe6[_0x4d62('0x2e')]['hasOwnProperty']('nolimit')){_0xb5036e['limit']=qs['limit'](_0x181fe6[_0x4d62('0x2e')][_0x4d62('0x1b')]);_0xb5036e[_0x4d62('0x1a')]=qs[_0x4d62('0x1a')](_0x181fe6[_0x4d62('0x2e')][_0x4d62('0x1a')]);}_0xb5036e[_0x4d62('0x34')]=qs[_0x4d62('0x35')](_0x181fe6[_0x4d62('0x2e')]['sort']);_0xb5036e[_0x4d62('0x36')]=qs['filters'](_['pick'](_0x181fe6['query'],_0x54536c[_0x4d62('0x2f')]),_0x5174da);if(_0x181fe6[_0x4d62('0x2e')][_0x4d62('0x37')]){_0xb5036e[_0x4d62('0x36')]=_[_0x4d62('0x38')](_0xb5036e[_0x4d62('0x36')],{'$or':_['map'](_0x5174da,function(_0x33bf61){if(_0x33bf61['type']!==_0x4d62('0x39')){var _0x19c094={};_0x19c094[_0x33bf61[_0x4d62('0x26')]]={'$like':'%'+_0x181fe6[_0x4d62('0x2e')]['filter']+'%'};return _0x19c094;}})});}_0xb5036e=_[_0x4d62('0x38')]({},_0xb5036e,_0x181fe6[_0x4d62('0x3a')]);var _0x4ccbe2={'where':_0xb5036e['where']};return db[_0x4d62('0x3b')][_0x4d62('0x3c')](_0x4ccbe2)[_0x4d62('0x22')](function(_0x550ca0){_0x5c13aa['count']=_0x550ca0;if(_0x181fe6['query']['includeAll']){_0xb5036e['include']=[{'all':!![]}];}return db['VtigerField'][_0x4d62('0x3d')](_0xb5036e);})[_0x4d62('0x22')](function(_0x3633e9){_0x5c13aa[_0x4d62('0x3e')]=_0x3633e9;return _0x5c13aa;})[_0x4d62('0x22')](respondWithFilteredResult(_0x474c69,_0xb5036e))['catch'](handleError(_0x474c69,null));};exports[_0x4d62('0x3f')]=function(_0x39a729,_0x50dd27){var _0x178d83={'raw':!![],'where':{'id':_0x39a729[_0x4d62('0x40')]['id']}},_0xda7aeb={};_0xda7aeb[_0x4d62('0x31')]=_[_0x4d62('0x2d')](db[_0x4d62('0x3b')]['rawAttributes']);_0xda7aeb[_0x4d62('0x2e')]=_['keys'](_0x39a729[_0x4d62('0x2e')]);_0xda7aeb[_0x4d62('0x2f')]=_['intersection'](_0xda7aeb[_0x4d62('0x31')],_0xda7aeb['query']);_0x178d83[_0x4d62('0x32')]=_[_0x4d62('0x30')](_0xda7aeb[_0x4d62('0x31')],qs[_0x4d62('0x33')](_0x39a729[_0x4d62('0x2e')]['fields']));_0x178d83[_0x4d62('0x32')]=_0x178d83[_0x4d62('0x32')][_0x4d62('0x41')]?_0x178d83[_0x4d62('0x32')]:_0xda7aeb[_0x4d62('0x31')];if(_0x39a729[_0x4d62('0x2e')][_0x4d62('0x42')]){_0x178d83[_0x4d62('0x43')]=[{'all':!![]}];}_0x178d83=_[_0x4d62('0x38')]({},_0x178d83,_0x39a729[_0x4d62('0x3a')]);return db[_0x4d62('0x3b')]['find'](_0x178d83)['then'](handleEntityNotFound(_0x50dd27,null))[_0x4d62('0x22')](respondWithResult(_0x50dd27,null))[_0x4d62('0x44')](handleError(_0x50dd27,null));};exports[_0x4d62('0x45')]=function(_0x3a8591,_0x2924fb){return db['VtigerField']['create'](_0x3a8591[_0x4d62('0x46')],{})[_0x4d62('0x22')](respondWithResult(_0x2924fb,0xc9))[_0x4d62('0x44')](handleError(_0x2924fb,null));};exports[_0x4d62('0x47')]=function(_0x3a8c7e,_0x514d3c){if(_0x3a8c7e['body']['id']){delete _0x3a8c7e[_0x4d62('0x46')]['id'];}return db['VtigerField'][_0x4d62('0x48')]({'where':{'id':_0x3a8c7e[_0x4d62('0x40')]['id']}})[_0x4d62('0x22')](handleEntityNotFound(_0x514d3c,null))['then'](saveUpdates(_0x3a8c7e[_0x4d62('0x46')],null))[_0x4d62('0x22')](respondWithResult(_0x514d3c,null))[_0x4d62('0x44')](handleError(_0x514d3c,null));};exports[_0x4d62('0x23')]=function(_0x315797,_0x2fc33e){return db[_0x4d62('0x3b')][_0x4d62('0x48')]({'where':{'id':_0x315797[_0x4d62('0x40')]['id']}})[_0x4d62('0x22')](handleEntityNotFound(_0x2fc33e,null))[_0x4d62('0x22')](removeEntity(_0x2fc33e,null))['catch'](handleError(_0x2fc33e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 1d5834f..5e72869 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 _0xe706=['rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x414806,_0x12a8c2){var _0x14e039=function(_0x40fb9c){while(--_0x40fb9c){_0x414806['push'](_0x414806['shift']());}};_0x14e039(++_0x12a8c2);}(_0xe706,0xa3));var _0x6e70=function(_0x358fd3,_0x4a9c44){_0x358fd3=_0x358fd3-0x0;var _0x1ad0f3=_0xe706[_0x358fd3];return _0x1ad0f3;};'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':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xf'),_0x6e70('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['int_vtiger_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VtigerField'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5aa20c,_0x28b6ca){_0x5aa20c=_0x5aa20c-0x0;var _0x5d0a3a=_0xf3cd[_0x5aa20c];return _0x5d0a3a;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intVtigerField.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xdf3c('0xd'),'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 1faba63..893a8bb 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 _0xdef9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x15503e,_0x2ce699){var _0x271c52=function(_0x39096a){while(--_0x39096a){_0x15503e['push'](_0x15503e['shift']());}};_0x271c52(++_0x2ce699);}(_0xdef9,0x1ed));var _0x9def=function(_0x4a752b,_0x1a8b9a){_0x4a752b=_0x4a752b-0x0;var _0x4696a4=_0xdef9[_0x4a752b];return _0x4696a4;};'use strict';var _=require(_0x9def('0x0'));var util=require(_0x9def('0x1'));var moment=require(_0x9def('0x2'));var BPromise=require(_0x9def('0x3'));var rs=require(_0x9def('0x4'));var fs=require('fs');var Redis=require(_0x9def('0x5'));var db=require(_0x9def('0x6'))['db'];var utils=require(_0x9def('0x7'));var logger=require(_0x9def('0x8'))(_0x9def('0x9'));var config=require(_0x9def('0xa'));var jayson=require(_0x9def('0xb'));var client=jayson[_0x9def('0xc')][_0x9def('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40c607,_0x25a03e,_0x42296c){return new BPromise(function(_0x1efce0,_0x8262f1){return client['request'](_0x40c607,_0x42296c)[_0x9def('0xe')](function(_0x4f0a0d){logger['info'](_0x9def('0xf'),_0x25a03e,_0x9def('0x10'));logger[_0x9def('0x11')](_0x9def('0x12'),_0x25a03e,'request\x20sent',JSON[_0x9def('0x13')](_0x4f0a0d));if(_0x4f0a0d[_0x9def('0x14')]){if(_0x4f0a0d[_0x9def('0x14')][_0x9def('0x15')]===0x1f4){logger['error'](_0x9def('0xf'),_0x25a03e,_0x4f0a0d[_0x9def('0x14')]['message']);return _0x8262f1(_0x4f0a0d[_0x9def('0x14')]['message']);}logger['error'](_0x9def('0xf'),_0x25a03e,_0x4f0a0d[_0x9def('0x14')][_0x9def('0x16')]);return _0x1efce0(_0x4f0a0d['error'][_0x9def('0x16')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x25a03e,_0x9def('0x10'));_0x1efce0(_0x4f0a0d[_0x9def('0x17')][_0x9def('0x16')]);}})[_0x9def('0x18')](function(_0x463520){logger[_0x9def('0x14')](_0x9def('0xf'),_0x25a03e,_0x463520);_0x8262f1(_0x463520);});});} \ No newline at end of file +var _0x1d21=['../../config/environment','jayson/promise','client','http','request','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0x1d21,0x158));var _0x11d2=function(_0x1602fb,_0x20b6b3){_0x1602fb=_0x1602fb-0x0;var _0x461831=_0x1d21[_0x1602fb];return _0x461831;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var moment=require(_0x11d2('0x2'));var BPromise=require(_0x11d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11d2('0x4'));var db=require(_0x11d2('0x5'))['db'];var utils=require(_0x11d2('0x6'));var logger=require(_0x11d2('0x7'))('rpc');var config=require(_0x11d2('0x8'));var jayson=require(_0x11d2('0x9'));var client=jayson[_0x11d2('0xa')][_0x11d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1eb6ca,_0x185dc4,_0x3a3713){return new BPromise(function(_0x4d8792,_0xd6d34c){return client[_0x11d2('0xc')](_0x1eb6ca,_0x3a3713)['then'](function(_0x3109ab){logger['info'](_0x11d2('0xd'),_0x185dc4,_0x11d2('0xe'));logger['debug'](_0x11d2('0xf'),_0x185dc4,_0x11d2('0xe'),JSON[_0x11d2('0x10')](_0x3109ab));if(_0x3109ab[_0x11d2('0x11')]){if(_0x3109ab['error']['code']===0x1f4){logger[_0x11d2('0x11')](_0x11d2('0xd'),_0x185dc4,_0x3109ab[_0x11d2('0x11')]['message']);return _0xd6d34c(_0x3109ab[_0x11d2('0x11')][_0x11d2('0x12')]);}logger[_0x11d2('0x11')](_0x11d2('0xd'),_0x185dc4,_0x3109ab['error'][_0x11d2('0x12')]);return _0x4d8792(_0x3109ab[_0x11d2('0x11')]['message']);}else{logger[_0x11d2('0x13')](_0x11d2('0xd'),_0x185dc4,_0x11d2('0xe'));_0x4d8792(_0x3109ab[_0x11d2('0x14')][_0x11d2('0x12')]);}})[_0x11d2('0x15')](function(_0x3e75f4){logger[_0x11d2('0x11')](_0x11d2('0xd'),_0x185dc4,_0x3e75f4);_0xd6d34c(_0x3e75f4);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 40b00f2..0e7e6c7 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 _0x5611=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','create','post','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index'];(function(_0x194f9a,_0x479b58){var _0x559c89=function(_0x243059){while(--_0x243059){_0x194f9a['push'](_0x194f9a['shift']());}};_0x559c89(++_0x479b58);}(_0x5611,0x8f));var _0x1561=function(_0x164ca5,_0x21dd28){_0x164ca5=_0x164ca5-0x0;var _0x516b3f=_0x5611[_0x164ca5];return _0x516b3f;};'use strict';var multer=require(_0x1561('0x0'));var util=require('util');var path=require(_0x1561('0x1'));var timeout=require(_0x1561('0x2'));var express=require(_0x1561('0x3'));var router=express[_0x1561('0x4')]();var auth=require(_0x1561('0x5'));var interaction=require(_0x1561('0x6'));var config=require(_0x1561('0x7'));var controller=require(_0x1561('0x8'));router[_0x1561('0x9')]('/',auth['isAuthenticated'](),controller[_0x1561('0xa')]);router['get'](_0x1561('0xb'),auth[_0x1561('0xc')](),controller[_0x1561('0xd')]);router['get'](_0x1561('0xe'),auth[_0x1561('0xc')](),controller[_0x1561('0xf')]);router[_0x1561('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1561('0x10')]);router['post']('/',auth[_0x1561('0xc')](),controller[_0x1561('0x11')]);router[_0x1561('0x12')]('/:id/configurations',auth[_0x1561('0xc')](),controller['addConfiguration']);router['put']('/:id',auth[_0x1561('0xc')](),controller[_0x1561('0x13')]);router[_0x1561('0x14')](_0x1561('0xb'),auth[_0x1561('0xc')](),controller[_0x1561('0x15')]);module['exports']=router; \ No newline at end of file +var _0x46f4=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','/:id','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x46f4,0xb9));var _0x446f=function(_0x22c242,_0x3182a6){_0x22c242=_0x22c242-0x0;var _0x48ba73=_0x46f4[_0x22c242];return _0x48ba73;};'use strict';var multer=require(_0x446f('0x0'));var util=require('util');var path=require(_0x446f('0x1'));var timeout=require(_0x446f('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x446f('0x3'));var interaction=require(_0x446f('0x4'));var config=require(_0x446f('0x5'));var controller=require(_0x446f('0x6'));router[_0x446f('0x7')]('/',auth[_0x446f('0x8')](),controller['index']);router[_0x446f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x446f('0x9')]);router[_0x446f('0x7')](_0x446f('0xa'),auth[_0x446f('0x8')](),controller[_0x446f('0xb')]);router[_0x446f('0x7')](_0x446f('0xc'),auth[_0x446f('0x8')](),controller[_0x446f('0xd')]);router['post']('/',auth[_0x446f('0x8')](),controller['create']);router['post'](_0x446f('0xa'),auth[_0x446f('0x8')](),controller[_0x446f('0xe')]);router[_0x446f('0xf')](_0x446f('0x10'),auth[_0x446f('0x8')](),controller['update']);router['delete'](_0x446f('0x10'),auth[_0x446f('0x8')](),controller[_0x446f('0x11')]);module[_0x446f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4915772..6d215cb 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 _0xb75e=['ENUM','password','token','newTab','integrationTab','sequelize','exports','STRING','username','remoteUri'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb75e,0xc3));var _0xeb75=function(_0x8efffa,_0x2e2434){_0x8efffa=_0x8efffa-0x0;var _0x1f5546=_0xb75e[_0x8efffa];return _0x1f5546;};'use strict';var Sequelize=require(_0xeb75('0x0'));module[_0xeb75('0x1')]={'name':{'type':Sequelize[_0xeb75('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xeb75('0x2')],'unique':_0xeb75('0x3')},'password':{'type':Sequelize[_0xeb75('0x2')]},'token':{'type':Sequelize[_0xeb75('0x2')]},'remoteUri':{'type':Sequelize[_0xeb75('0x2')],'unique':_0xeb75('0x4')},'authType':{'type':Sequelize[_0xeb75('0x5')](_0xeb75('0x6'),_0xeb75('0x7')),'defaultValue':_0xeb75('0x6')},'serverUrl':{'type':Sequelize[_0xeb75('0x2')]},'type':{'type':Sequelize[_0xeb75('0x5')]('integrationTab',_0xeb75('0x8')),'defaultValue':_0xeb75('0x9')}}; \ No newline at end of file +var _0xdf28=['STRING','username','remoteUri','ENUM','password','integrationTab','newTab','sequelize','exports'];(function(_0x9ab7c8,_0x10bf61){var _0x55d83c=function(_0x48ab72){while(--_0x48ab72){_0x9ab7c8['push'](_0x9ab7c8['shift']());}};_0x55d83c(++_0x10bf61);}(_0xdf28,0x142));var _0x8df2=function(_0x53cf89,_0x437980){_0x53cf89=_0x53cf89-0x0;var _0x4928de=_0xdf28[_0x53cf89];return _0x4928de;};'use strict';var Sequelize=require(_0x8df2('0x0'));module[_0x8df2('0x1')]={'name':{'type':Sequelize[_0x8df2('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x8df2('0x3')},'password':{'type':Sequelize[_0x8df2('0x2')]},'token':{'type':Sequelize[_0x8df2('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8df2('0x4')},'authType':{'type':Sequelize[_0x8df2('0x5')](_0x8df2('0x6'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8df2('0x5')](_0x8df2('0x7'),_0x8df2('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 089e95d..4150629 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 _0x1201=['includeAll','find','create','body','getConfigurations','findOne','ZendeskConfiguration','sort','getSubjects','channel','Descriptions','ZendeskField','Subjects','getFields','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','Basic\x20%s','username','base64','headers','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','position','system_field_options','custom_field_options','statusCode','send','html-pdf','eml-format','rimraf','request-promise','mustache','path','ejs','lodash','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../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','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','include','rows','params'];(function(_0x4abc3b,_0x50fbd1){var _0x49c2a5=function(_0x2f7114){while(--_0x2f7114){_0x4abc3b['push'](_0x4abc3b['shift']());}};_0x49c2a5(++_0x50fbd1);}(_0x1201,0xa3));var _0x1120=function(_0x44c5c1,_0x4d9d55){_0x44c5c1=_0x44c5c1-0x0;var _0x467172=_0x1201[_0x44c5c1];return _0x467172;};'use strict';var pdf=require(_0x1120('0x0'));var emlformat=require(_0x1120('0x1'));var rimraf=require(_0x1120('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1120('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1120('0x4'));var util=require('util');var path=require(_0x1120('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1120('0x6'));var fs=require('fs');var _=require(_0x1120('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1120('0x8'));var toCsv=require(_0x1120('0x9'));var querystring=require(_0x1120('0xa'));var Papa=require('papaparse');var Redis=require(_0x1120('0xb'));var authService=require(_0x1120('0xc'));var qs=require(_0x1120('0xd'));var as=require(_0x1120('0xe'));var hardwareService=require(_0x1120('0xf'));var logger=require(_0x1120('0x10'))(_0x1120('0x11'));var utils=require('../../config/utils');var config=require(_0x1120('0x12'));var db=require(_0x1120('0x13'))['db'];var integrations=require(_0x1120('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x1120('0x15')][_0x1120('0x16')]({'port':0x232a});function checkPasswordPattern(_0x171255,_0x5a7d5c,_0xe97d96){if(_0xe97d96){var _0x2b120e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b120e[_0x1120('0x17')](_0x5a7d5c)){return _0x171255;}else{throw new db[(_0x1120('0x18'))]['ValidationError'](_0x1120('0x19'));}}else{return _0x171255;}}function respondWithRpcPromise(_0x470f91,_0x2c47c6,_0x18a120,_0xb30757){return new BPromise(function(_0x5f2861,_0x5a3f66){var _0x697673=_0xb30757||client;return _0x697673[_0x1120('0x1a')](_0x470f91,_0x18a120)[_0x1120('0x1b')](function(_0x4d9af9){logger[_0x1120('0x1c')](_0x1120('0x1d'),_0x2c47c6,_0x1120('0x1e'));logger[_0x1120('0x1f')](_0x1120('0x20'),_0x2c47c6,'request\x20sent',JSON[_0x1120('0x21')](_0x4d9af9));if(_0x4d9af9['error']){if(_0x4d9af9['error'][_0x1120('0x22')]===0x1f4){logger[_0x1120('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x2c47c6,_0x4d9af9[_0x1120('0x23')][_0x1120('0x24')]);return _0x5a3f66(_0x4d9af9[_0x1120('0x23')][_0x1120('0x24')]);}logger[_0x1120('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x2c47c6,_0x4d9af9[_0x1120('0x23')]['message']);return _0x5f2861(_0x4d9af9[_0x1120('0x23')]['message']);}else{logger[_0x1120('0x1c')]('ZendeskAccount,\x20%s,\x20%s',_0x2c47c6,'request\x20sent');_0x5f2861(_0x4d9af9[_0x1120('0x25')]['message']);}})[_0x1120('0x26')](function(_0x3fa61b){logger[_0x1120('0x23')](_0x1120('0x1d'),_0x2c47c6,_0x3fa61b);_0x5a3f66(_0x3fa61b);});});}function respondWithStatusCode(_0x14341f,_0x2e5839){_0x2e5839=_0x2e5839||0xcc;return function(_0x1b7d97){if(_0x1b7d97){return _0x14341f[_0x1120('0x27')](_0x2e5839);}return _0x14341f['status'](_0x2e5839)['end']();};}function respondWithResult(_0x12c731,_0x85c130){_0x85c130=_0x85c130||0xc8;return function(_0x350383){if(_0x350383){return _0x12c731[_0x1120('0x28')](_0x85c130)[_0x1120('0x29')](_0x350383);}};}function respondWithFilteredResult(_0x49d72c,_0x4cb0f9){return function(_0x24b9ca){if(_0x24b9ca){var _0x13a0c7=_0x24b9ca['count'],_0xe5616b=_0x4cb0f9[_0x1120('0x2a')],_0x4fe574=_0x4cb0f9[_0x1120('0x2a')]+_0x4cb0f9[_0x1120('0x2b')],_0x145726;if(_0x4fe574>=_0x13a0c7){_0x4fe574=_0x13a0c7;_0x145726=0xc8;}else{_0x145726=0xce;}_0x49d72c['status'](_0x145726);return _0x49d72c[_0x1120('0x2c')](_0x1120('0x2d'),_0xe5616b+'-'+_0x4fe574+'/'+_0x13a0c7)[_0x1120('0x29')](_0x24b9ca);}return null;};}function patchUpdates(_0x4f31cd){return function(_0x4baf9b){try{jsonpatch['apply'](_0x4baf9b,_0x4f31cd,!![]);}catch(_0x20bcc4){return BPromise[_0x1120('0x2e')](_0x20bcc4);}return _0x4baf9b[_0x1120('0x2f')]();};}function saveUpdates(_0x3ead57,_0x296d8e){return function(_0x384468){if(_0x384468){return _0x384468[_0x1120('0x30')](_0x3ead57)[_0x1120('0x1b')](function(_0x3b7168){return _0x3b7168;});}return null;};}function removeEntity(_0x400230,_0x41f8ea){return function(_0x3ebbb6){if(_0x3ebbb6){return _0x3ebbb6[_0x1120('0x31')]()[_0x1120('0x1b')](function(){_0x400230['status'](0xcc)[_0x1120('0x32')]();});}};}function handleEntityNotFound(_0x5c2543,_0x43c555){return function(_0x35b348){if(!_0x35b348){_0x5c2543[_0x1120('0x27')](0x194);}return _0x35b348;};}function handleError(_0x48c18d,_0x3f3655){_0x3f3655=_0x3f3655||0x1f4;return function(_0x4ecaf4){logger['error'](_0x4ecaf4[_0x1120('0x33')]);if(_0x4ecaf4[_0x1120('0x34')]){delete _0x4ecaf4[_0x1120('0x34')];}_0x48c18d[_0x1120('0x28')](_0x3f3655)['send'](_0x4ecaf4);};}exports[_0x1120('0x35')]=function(_0x5e53b1,_0xd7f86e){var _0x1f3ef8={},_0x55354c={},_0x18183b={'count':0x0,'rows':[]};var _0x479939=_[_0x1120('0x36')](db[_0x1120('0x37')][_0x1120('0x38')],function(_0x53b7f5){return{'name':_0x53b7f5[_0x1120('0x39')],'type':_0x53b7f5[_0x1120('0x3a')]['key']};});_0x55354c[_0x1120('0x3b')]=_[_0x1120('0x36')](_0x479939,_0x1120('0x34'));_0x55354c[_0x1120('0x3c')]=_[_0x1120('0x3d')](_0x5e53b1[_0x1120('0x3c')]);_0x55354c[_0x1120('0x3e')]=_[_0x1120('0x3f')](_0x55354c['model'],_0x55354c[_0x1120('0x3c')]);_0x1f3ef8['attributes']=_['intersection'](_0x55354c['model'],qs[_0x1120('0x40')](_0x5e53b1[_0x1120('0x3c')][_0x1120('0x40')]));_0x1f3ef8[_0x1120('0x41')]=_0x1f3ef8[_0x1120('0x41')][_0x1120('0x42')]?_0x1f3ef8[_0x1120('0x41')]:_0x55354c[_0x1120('0x3b')];if(!_0x5e53b1[_0x1120('0x3c')][_0x1120('0x43')](_0x1120('0x44'))){_0x1f3ef8[_0x1120('0x2b')]=qs[_0x1120('0x2b')](_0x5e53b1['query'][_0x1120('0x2b')]);_0x1f3ef8[_0x1120('0x2a')]=qs['offset'](_0x5e53b1[_0x1120('0x3c')][_0x1120('0x2a')]);}_0x1f3ef8[_0x1120('0x45')]=qs['sort'](_0x5e53b1['query']['sort']);_0x1f3ef8['where']=qs[_0x1120('0x3e')](_[_0x1120('0x46')](_0x5e53b1[_0x1120('0x3c')],_0x55354c['filters']),_0x479939);if(_0x5e53b1[_0x1120('0x3c')][_0x1120('0x47')]){_0x1f3ef8[_0x1120('0x48')]=_[_0x1120('0x49')](_0x1f3ef8[_0x1120('0x48')],{'$or':_[_0x1120('0x36')](_0x479939,function(_0x1a8aef){if(_0x1a8aef['type']!==_0x1120('0x4a')){var _0x2a9a28={};_0x2a9a28[_0x1a8aef[_0x1120('0x34')]]={'$like':'%'+_0x5e53b1[_0x1120('0x3c')][_0x1120('0x47')]+'%'};return _0x2a9a28;}})});}_0x1f3ef8=_[_0x1120('0x49')]({},_0x1f3ef8,_0x5e53b1[_0x1120('0x4b')]);var _0x2f2ff3={'where':_0x1f3ef8['where']};return db[_0x1120('0x37')]['count'](_0x2f2ff3)[_0x1120('0x1b')](function(_0x36e137){_0x18183b['count']=_0x36e137;if(_0x5e53b1['query']['includeAll']){_0x1f3ef8[_0x1120('0x4c')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x1f3ef8);})[_0x1120('0x1b')](function(_0x547445){_0x18183b[_0x1120('0x4d')]=_0x547445;return _0x18183b;})['then'](respondWithFilteredResult(_0xd7f86e,_0x1f3ef8))[_0x1120('0x26')](handleError(_0xd7f86e,null));};exports['show']=function(_0x3d1459,_0x5107c7){var _0x2eae56={'raw':![],'where':{'id':_0x3d1459[_0x1120('0x4e')]['id']}},_0x513525={};_0x513525[_0x1120('0x3b')]=_['keys'](db[_0x1120('0x37')]['rawAttributes']);_0x513525['query']=_[_0x1120('0x3d')](_0x3d1459[_0x1120('0x3c')]);_0x513525['filters']=_[_0x1120('0x3f')](_0x513525['model'],_0x513525[_0x1120('0x3c')]);_0x2eae56[_0x1120('0x41')]=_[_0x1120('0x3f')](_0x513525[_0x1120('0x3b')],qs['fields'](_0x3d1459[_0x1120('0x3c')][_0x1120('0x40')]));_0x2eae56[_0x1120('0x41')]=_0x2eae56[_0x1120('0x41')]['length']?_0x2eae56[_0x1120('0x41')]:_0x513525[_0x1120('0x3b')];if(_0x3d1459[_0x1120('0x3c')][_0x1120('0x4f')]){_0x2eae56[_0x1120('0x4c')]=[{'all':!![]}];}_0x2eae56=_['merge']({},_0x2eae56,_0x3d1459['options']);return db['ZendeskAccount'][_0x1120('0x50')](_0x2eae56)[_0x1120('0x1b')](handleEntityNotFound(_0x5107c7,null))[_0x1120('0x1b')](respondWithResult(_0x5107c7,null))[_0x1120('0x26')](handleError(_0x5107c7,null));};exports[_0x1120('0x51')]=function(_0x19fe23,_0x1dad5a){return db[_0x1120('0x37')][_0x1120('0x51')](_0x19fe23[_0x1120('0x52')],{})[_0x1120('0x1b')](respondWithResult(_0x1dad5a,0xc9))['catch'](handleError(_0x1dad5a,null));};exports['update']=function(_0x1d026a,_0x48b3c1){if(_0x1d026a['body']['id']){delete _0x1d026a[_0x1120('0x52')]['id'];}return db['ZendeskAccount'][_0x1120('0x50')]({'where':{'id':_0x1d026a[_0x1120('0x4e')]['id']}})[_0x1120('0x1b')](handleEntityNotFound(_0x48b3c1,null))[_0x1120('0x1b')](saveUpdates(_0x1d026a[_0x1120('0x52')],null))['then'](respondWithResult(_0x48b3c1,null))['catch'](handleError(_0x48b3c1,null));};exports[_0x1120('0x31')]=function(_0x4f02ed,_0x1d3deb){return db[_0x1120('0x37')][_0x1120('0x50')]({'where':{'id':_0x4f02ed[_0x1120('0x4e')]['id']}})[_0x1120('0x1b')](handleEntityNotFound(_0x1d3deb,null))[_0x1120('0x1b')](removeEntity(_0x1d3deb,null))[_0x1120('0x26')](handleError(_0x1d3deb,null));};exports[_0x1120('0x53')]=function(_0x529443,_0x3f1ac6,_0xdeb73d){var _0x4ca7f0={};var _0x34561a={};var _0x304ee6;var _0x2cb058;return db[_0x1120('0x37')][_0x1120('0x54')]({'where':{'id':_0x529443[_0x1120('0x4e')]['id']}})[_0x1120('0x1b')](handleEntityNotFound(_0x3f1ac6,null))['then'](function(_0x4b197e){if(_0x4b197e){_0x304ee6=_0x4b197e;_0x34561a[_0x1120('0x3b')]=_[_0x1120('0x3d')](db[_0x1120('0x55')][_0x1120('0x38')]);_0x34561a[_0x1120('0x3c')]=_['keys'](_0x529443['query']);_0x34561a[_0x1120('0x3e')]=_[_0x1120('0x3f')](_0x34561a[_0x1120('0x3b')],_0x34561a['query']);_0x4ca7f0[_0x1120('0x41')]=_[_0x1120('0x3f')](_0x34561a[_0x1120('0x3b')],qs['fields'](_0x529443[_0x1120('0x3c')][_0x1120('0x40')]));_0x4ca7f0[_0x1120('0x41')]=_0x4ca7f0[_0x1120('0x41')]['length']?_0x4ca7f0[_0x1120('0x41')]:_0x34561a[_0x1120('0x3b')];_0x4ca7f0[_0x1120('0x45')]=qs['sort'](_0x529443[_0x1120('0x3c')][_0x1120('0x56')]);_0x4ca7f0['where']=qs[_0x1120('0x3e')](_['pick'](_0x529443[_0x1120('0x3c')],_0x34561a['filters']));if(_0x529443[_0x1120('0x3c')]['filter']){_0x4ca7f0[_0x1120('0x48')]=_[_0x1120('0x49')](_0x4ca7f0['where'],{'$or':_[_0x1120('0x36')](_0x4ca7f0[_0x1120('0x41')],function(_0x5c48fb){var _0x2511ae={};_0x2511ae[_0x5c48fb]={'$like':'%'+_0x529443[_0x1120('0x3c')][_0x1120('0x47')]+'%'};return _0x2511ae;})});}_0x4ca7f0=_[_0x1120('0x49')]({},_0x4ca7f0,_0x529443['options']);return _0x304ee6[_0x1120('0x53')](_0x4ca7f0);}})[_0x1120('0x1b')](function(_0x1f11bf){if(_0x1f11bf){_0x2cb058=_0x1f11bf[_0x1120('0x42')];if(!_0x529443[_0x1120('0x3c')][_0x1120('0x43')]('nolimit')){_0x4ca7f0[_0x1120('0x2b')]=qs[_0x1120('0x2b')](_0x529443['query']['limit']);_0x4ca7f0[_0x1120('0x2a')]=qs[_0x1120('0x2a')](_0x529443[_0x1120('0x3c')][_0x1120('0x2a')]);}return _0x304ee6[_0x1120('0x53')](_0x4ca7f0);}})[_0x1120('0x1b')](function(_0x4d264f){if(_0x4d264f){return _0x4d264f?{'count':_0x2cb058,'rows':_0x4d264f}:null;}})[_0x1120('0x1b')](respondWithResult(_0x3f1ac6,null))['catch'](handleError(_0x3f1ac6,null));};exports['addConfiguration']=function(_0xe018fe,_0x125bb4,_0x3479be){if(_0xe018fe[_0x1120('0x52')]['id']){delete _0xe018fe['body']['id'];}return db[_0x1120('0x37')]['findOne']({'where':{'id':_0xe018fe[_0x1120('0x4e')]['id']}})[_0x1120('0x1b')](handleEntityNotFound(_0x125bb4,null))[_0x1120('0x1b')](function(_0x52526e){if(_0x52526e){_0xe018fe[_0x1120('0x52')]['AccountId']=_0x52526e['id'];_0xe018fe['body']['Subjects']=integrations[_0x1120('0x57')](_0xe018fe[_0x1120('0x52')][_0x1120('0x58')],_0xe018fe[_0x1120('0x52')][_0x1120('0x3a')]);_0xe018fe[_0x1120('0x52')][_0x1120('0x59')]=integrations['getDescriptions'](_0xe018fe[_0x1120('0x52')][_0x1120('0x58')],_0xe018fe['body']['type']);return db[_0x1120('0x55')][_0x1120('0x51')](_0xe018fe[_0x1120('0x52')],{'include':[{'model':db[_0x1120('0x5a')],'as':_0x1120('0x5b')},{'model':db[_0x1120('0x5a')],'as':_0x1120('0x59')}]});}return null;})[_0x1120('0x1b')](respondWithResult(_0x125bb4,null))[_0x1120('0x26')](handleError(_0x125bb4,null));};exports[_0x1120('0x5c')]=function(_0x2e3202,_0x3f7b8c,_0x1a7b84){var _0x444a7b='';return db[_0x1120('0x37')][_0x1120('0x54')]({'where':{'id':_0x2e3202['params']['id']},'attributes':['id','username',_0x1120('0x5d'),_0x1120('0x5e'),_0x1120('0x5f'),_0x1120('0x60')]})[_0x1120('0x1b')](handleEntityNotFound(_0x3f7b8c,null))[_0x1120('0x1b')](function(_0x41e429){if(_0x41e429){_0x444a7b=_0x41e429[_0x1120('0x60')];var _0x3f56a0=_0x444a7b[_0x1120('0x61')](-0x1);if(_0x3f56a0==='/'){_0x444a7b=_0x444a7b[_0x1120('0x62')](0x0,_0x444a7b[_0x1120('0x63')](_0x3f56a0));}var _0xa1ab4e={'method':_0x1120('0x64'),'uri':util[_0x1120('0x65')]('%s/%s',_0x444a7b,_0x1120('0x66')),'json':!![]};switch(_0x41e429[_0x1120('0x5f')]){case _0x1120('0x5d'):_0xa1ab4e['headers']={'Authorization':util[_0x1120('0x65')](_0x1120('0x67'),new Buffer(util[_0x1120('0x65')]('%s:%s',_0x41e429[_0x1120('0x68')],_0x41e429[_0x1120('0x5d')]))['toString'](_0x1120('0x69')))};break;case _0x1120('0x5e'):_0xa1ab4e[_0x1120('0x6a')]={'Authorization':util[_0x1120('0x65')](_0x1120('0x67'),new Buffer(util[_0x1120('0x65')](_0x1120('0x6b'),_0x41e429[_0x1120('0x68')],_0x41e429[_0x1120('0x5e')]))[_0x1120('0x6c')]('base64'))};break;default:throw new db[(_0x1120('0x18'))][(_0x1120('0x6d'))](_0x1120('0x6e'));}return rp(_0xa1ab4e);}})[_0x1120('0x1b')](function(_0x5fdd8e){if(_0x5fdd8e){var _0x18a71f=[_0x1120('0x6f'),'description',_0x1120('0x70'),_0x1120('0x71')];_[_0x1120('0x72')](_0x5fdd8e[_0x1120('0x66')],function(_0x4744b1){return _0x18a71f[_0x1120('0x73')](_0x4744b1[_0x1120('0x3a')]);});return{'count':_0x5fdd8e[_0x1120('0x66')][_0x1120('0x42')],'rows':_[_0x1120('0x36')](_0x5fdd8e[_0x1120('0x66')],function(_0x2033c1){return{'id':_0x2033c1['id'],'name':_0x2033c1[_0x1120('0x74')]>0x7?_0x2033c1['title']:_0x2033c1[_0x1120('0x3a')],'custom':_0x2033c1[_0x1120('0x74')]>0x7?!![]:![],'options':_0x2033c1[_0x1120('0x75')]?_0x2033c1[_0x1120('0x75')]:_0x2033c1[_0x1120('0x76')]?_0x2033c1[_0x1120('0x76')]:[]};})};}})[_0x1120('0x1b')](respondWithResult(_0x3f7b8c,null))['catch'](function(_0x2fe9d3){var _0x5a8f05=_0x2e3202[_0x1120('0x3c')][_0x1120('0x17')]?0x1f4:_0x2fe9d3[_0x1120('0x77')]||0x1f4;logger[_0x1120('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x1120('0x5c'),_0x5a8f05,JSON[_0x1120('0x21')](_0x2fe9d3));delete _0x2fe9d3[_0x1120('0x34')];if(_0x5a8f05===0x191){_0x5a8f05=0x190;}_0x3f7b8c[_0x1120('0x28')](_0x5a8f05)[_0x1120('0x78')](_0x2e3202[_0x1120('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2fe9d3['statusCode']}:_0x2fe9d3);});}; \ No newline at end of file +var _0x30ee=['%s/%s','ticket_fields','password','headers','Basic\x20%s','%s:%s','username','base64','token','toString','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','title','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','stack','name','index','map','ZendeskAccount','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','show','params','keys','includeAll','find','catch','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','order','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Descriptions','getFields','authType','remoteUri','slice','substring','GET','format'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0x30ee,0x1a3));var _0xe30e=function(_0x383627,_0x5be16e){_0x383627=_0x383627-0x0;var _0x2c16a0=_0x30ee[_0x383627];return _0x2c16a0;};'use strict';var pdf=require(_0xe30e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe30e('0x1'));var jsonpatch=require(_0xe30e('0x2'));var rp=require(_0xe30e('0x3'));var moment=require(_0xe30e('0x4'));var BPromise=require(_0xe30e('0x5'));var Mustache=require(_0xe30e('0x6'));var util=require(_0xe30e('0x7'));var path=require(_0xe30e('0x8'));var sox=require(_0xe30e('0x9'));var csv=require(_0xe30e('0xa'));var ejs=require(_0xe30e('0xb'));var fs=require('fs');var _=require(_0xe30e('0xc'));var squel=require(_0xe30e('0xd'));var crypto=require('crypto');var jsforce=require(_0xe30e('0xe'));var deskjs=require(_0xe30e('0xf'));var toCsv=require(_0xe30e('0xa'));var querystring=require(_0xe30e('0x10'));var Papa=require(_0xe30e('0x11'));var Redis=require(_0xe30e('0x12'));var authService=require(_0xe30e('0x13'));var qs=require(_0xe30e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe30e('0x15'))(_0xe30e('0x16'));var utils=require(_0xe30e('0x17'));var config=require(_0xe30e('0x18'));var db=require(_0xe30e('0x19'))['db'];var integrations=require(_0xe30e('0x1a'));var jayson=require(_0xe30e('0x1b'));var client=jayson[_0xe30e('0x1c')][_0xe30e('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x2cb923,_0x57b44e,_0x57085c){if(_0x57085c){var _0x11b6c1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11b6c1[_0xe30e('0x1e')](_0x57b44e)){return _0x2cb923;}else{throw new db[(_0xe30e('0x1f'))][(_0xe30e('0x20'))]('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 _0x2cb923;}}function respondWithRpcPromise(_0x2cf371,_0x319eb1,_0x15118d,_0x1a0be5){return new BPromise(function(_0x30972d,_0xe8a803){var _0x232a98=_0x1a0be5||client;return _0x232a98['request'](_0x2cf371,_0x15118d)[_0xe30e('0x21')](function(_0xf71025){logger['info'](_0xe30e('0x22'),_0x319eb1,_0xe30e('0x23'));logger[_0xe30e('0x24')](_0xe30e('0x25'),_0x319eb1,_0xe30e('0x23'),JSON[_0xe30e('0x26')](_0xf71025));if(_0xf71025[_0xe30e('0x27')]){if(_0xf71025['error'][_0xe30e('0x28')]===0x1f4){logger['error'](_0xe30e('0x22'),_0x319eb1,_0xf71025[_0xe30e('0x27')][_0xe30e('0x29')]);return _0xe8a803(_0xf71025[_0xe30e('0x27')][_0xe30e('0x29')]);}logger[_0xe30e('0x27')](_0xe30e('0x22'),_0x319eb1,_0xf71025['error']['message']);return _0x30972d(_0xf71025[_0xe30e('0x27')]['message']);}else{logger[_0xe30e('0x2a')]('ZendeskAccount,\x20%s,\x20%s',_0x319eb1,_0xe30e('0x23'));_0x30972d(_0xf71025[_0xe30e('0x2b')][_0xe30e('0x29')]);}})['catch'](function(_0xe46f6){logger['error'](_0xe30e('0x22'),_0x319eb1,_0xe46f6);_0xe8a803(_0xe46f6);});});}function respondWithStatusCode(_0x23c58e,_0x3c3724){_0x3c3724=_0x3c3724||0xcc;return function(_0x56a804){if(_0x56a804){return _0x23c58e[_0xe30e('0x2c')](_0x3c3724);}return _0x23c58e[_0xe30e('0x2d')](_0x3c3724)[_0xe30e('0x2e')]();};}function respondWithResult(_0x8cff7f,_0x4dd9c2){_0x4dd9c2=_0x4dd9c2||0xc8;return function(_0x3c7d66){if(_0x3c7d66){return _0x8cff7f['status'](_0x4dd9c2)[_0xe30e('0x2f')](_0x3c7d66);}};}function respondWithFilteredResult(_0x5eed3f,_0x62e4c){return function(_0x43565c){if(_0x43565c){var _0x5718fc=_0x43565c[_0xe30e('0x30')],_0x105cbe=_0x62e4c[_0xe30e('0x31')],_0x5e2f79=_0x62e4c[_0xe30e('0x31')]+_0x62e4c[_0xe30e('0x32')],_0x5bbd29;if(_0x5e2f79>=_0x5718fc){_0x5e2f79=_0x5718fc;_0x5bbd29=0xc8;}else{_0x5bbd29=0xce;}_0x5eed3f['status'](_0x5bbd29);return _0x5eed3f[_0xe30e('0x33')](_0xe30e('0x34'),_0x105cbe+'-'+_0x5e2f79+'/'+_0x5718fc)[_0xe30e('0x2f')](_0x43565c);}return null;};}function patchUpdates(_0x9bb103){return function(_0x3b9d14){try{jsonpatch['apply'](_0x3b9d14,_0x9bb103,!![]);}catch(_0x37770f){return BPromise[_0xe30e('0x35')](_0x37770f);}return _0x3b9d14[_0xe30e('0x36')]();};}function saveUpdates(_0x296866,_0x5974b7){return function(_0x11ba39){if(_0x11ba39){return _0x11ba39[_0xe30e('0x37')](_0x296866)[_0xe30e('0x21')](function(_0x4528cd){return _0x4528cd;});}return null;};}function removeEntity(_0x19abad,_0xcb6b47){return function(_0x106ab7){if(_0x106ab7){return _0x106ab7['destroy']()[_0xe30e('0x21')](function(){_0x19abad['status'](0xcc)[_0xe30e('0x2e')]();});}};}function handleEntityNotFound(_0xc2feb5,_0x532ce7){return function(_0x1d7a13){if(!_0x1d7a13){_0xc2feb5[_0xe30e('0x2c')](0x194);}return _0x1d7a13;};}function handleError(_0x195c53,_0x43523c){_0x43523c=_0x43523c||0x1f4;return function(_0x3d2c40){logger[_0xe30e('0x27')](_0x3d2c40[_0xe30e('0x38')]);if(_0x3d2c40[_0xe30e('0x39')]){delete _0x3d2c40[_0xe30e('0x39')];}_0x195c53['status'](_0x43523c)['send'](_0x3d2c40);};}exports[_0xe30e('0x3a')]=function(_0xf0aa37,_0x201ccd){var _0x4a6b58={},_0x40bd24={},_0x3cd97a={'count':0x0,'rows':[]};var _0x516682=_[_0xe30e('0x3b')](db[_0xe30e('0x3c')][_0xe30e('0x3d')],function(_0x5596da){return{'name':_0x5596da[_0xe30e('0x3e')],'type':_0x5596da['type'][_0xe30e('0x3f')]};});_0x40bd24[_0xe30e('0x40')]=_[_0xe30e('0x3b')](_0x516682,_0xe30e('0x39'));_0x40bd24[_0xe30e('0x41')]=_['keys'](_0xf0aa37[_0xe30e('0x41')]);_0x40bd24[_0xe30e('0x42')]=_['intersection'](_0x40bd24[_0xe30e('0x40')],_0x40bd24['query']);_0x4a6b58[_0xe30e('0x43')]=_[_0xe30e('0x44')](_0x40bd24[_0xe30e('0x40')],qs[_0xe30e('0x45')](_0xf0aa37[_0xe30e('0x41')][_0xe30e('0x45')]));_0x4a6b58[_0xe30e('0x43')]=_0x4a6b58[_0xe30e('0x43')][_0xe30e('0x46')]?_0x4a6b58['attributes']:_0x40bd24[_0xe30e('0x40')];if(!_0xf0aa37['query'][_0xe30e('0x47')](_0xe30e('0x48'))){_0x4a6b58[_0xe30e('0x32')]=qs['limit'](_0xf0aa37[_0xe30e('0x41')][_0xe30e('0x32')]);_0x4a6b58['offset']=qs[_0xe30e('0x31')](_0xf0aa37[_0xe30e('0x41')][_0xe30e('0x31')]);}_0x4a6b58['order']=qs[_0xe30e('0x49')](_0xf0aa37[_0xe30e('0x41')][_0xe30e('0x49')]);_0x4a6b58[_0xe30e('0x4a')]=qs[_0xe30e('0x42')](_[_0xe30e('0x4b')](_0xf0aa37[_0xe30e('0x41')],_0x40bd24['filters']),_0x516682);if(_0xf0aa37[_0xe30e('0x41')][_0xe30e('0x4c')]){_0x4a6b58[_0xe30e('0x4a')]=_[_0xe30e('0x4d')](_0x4a6b58[_0xe30e('0x4a')],{'$or':_[_0xe30e('0x3b')](_0x516682,function(_0x1b063d){if(_0x1b063d[_0xe30e('0x4e')]!==_0xe30e('0x4f')){var _0x749652={};_0x749652[_0x1b063d['name']]={'$like':'%'+_0xf0aa37[_0xe30e('0x41')][_0xe30e('0x4c')]+'%'};return _0x749652;}})});}_0x4a6b58=_[_0xe30e('0x4d')]({},_0x4a6b58,_0xf0aa37[_0xe30e('0x50')]);var _0x233632={'where':_0x4a6b58[_0xe30e('0x4a')]};return db[_0xe30e('0x3c')][_0xe30e('0x30')](_0x233632)[_0xe30e('0x21')](function(_0x353e00){_0x3cd97a[_0xe30e('0x30')]=_0x353e00;if(_0xf0aa37['query']['includeAll']){_0x4a6b58[_0xe30e('0x51')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x4a6b58);})[_0xe30e('0x21')](function(_0x1f9109){_0x3cd97a[_0xe30e('0x52')]=_0x1f9109;return _0x3cd97a;})[_0xe30e('0x21')](respondWithFilteredResult(_0x201ccd,_0x4a6b58))['catch'](handleError(_0x201ccd,null));};exports[_0xe30e('0x53')]=function(_0xb42f2d,_0x5bfebf){var _0x4a8462={'raw':![],'where':{'id':_0xb42f2d[_0xe30e('0x54')]['id']}},_0xc5e94c={};_0xc5e94c[_0xe30e('0x40')]=_[_0xe30e('0x55')](db['ZendeskAccount'][_0xe30e('0x3d')]);_0xc5e94c[_0xe30e('0x41')]=_[_0xe30e('0x55')](_0xb42f2d[_0xe30e('0x41')]);_0xc5e94c[_0xe30e('0x42')]=_[_0xe30e('0x44')](_0xc5e94c[_0xe30e('0x40')],_0xc5e94c[_0xe30e('0x41')]);_0x4a8462[_0xe30e('0x43')]=_['intersection'](_0xc5e94c[_0xe30e('0x40')],qs[_0xe30e('0x45')](_0xb42f2d['query'][_0xe30e('0x45')]));_0x4a8462[_0xe30e('0x43')]=_0x4a8462[_0xe30e('0x43')][_0xe30e('0x46')]?_0x4a8462[_0xe30e('0x43')]:_0xc5e94c[_0xe30e('0x40')];if(_0xb42f2d[_0xe30e('0x41')][_0xe30e('0x56')]){_0x4a8462[_0xe30e('0x51')]=[{'all':!![]}];}_0x4a8462=_['merge']({},_0x4a8462,_0xb42f2d[_0xe30e('0x50')]);return db[_0xe30e('0x3c')][_0xe30e('0x57')](_0x4a8462)[_0xe30e('0x21')](handleEntityNotFound(_0x5bfebf,null))[_0xe30e('0x21')](respondWithResult(_0x5bfebf,null))[_0xe30e('0x58')](handleError(_0x5bfebf,null));};exports[_0xe30e('0x59')]=function(_0x1787c3,_0x18fe4b){return db[_0xe30e('0x3c')][_0xe30e('0x59')](_0x1787c3[_0xe30e('0x5a')],{})[_0xe30e('0x21')](respondWithResult(_0x18fe4b,0xc9))['catch'](handleError(_0x18fe4b,null));};exports[_0xe30e('0x37')]=function(_0x312104,_0x514c9f){if(_0x312104[_0xe30e('0x5a')]['id']){delete _0x312104['body']['id'];}return db[_0xe30e('0x3c')][_0xe30e('0x57')]({'where':{'id':_0x312104['params']['id']}})[_0xe30e('0x21')](handleEntityNotFound(_0x514c9f,null))[_0xe30e('0x21')](saveUpdates(_0x312104[_0xe30e('0x5a')],null))[_0xe30e('0x21')](respondWithResult(_0x514c9f,null))[_0xe30e('0x58')](handleError(_0x514c9f,null));};exports[_0xe30e('0x5b')]=function(_0x3e79c0,_0x2a30c7){return db[_0xe30e('0x3c')][_0xe30e('0x57')]({'where':{'id':_0x3e79c0['params']['id']}})['then'](handleEntityNotFound(_0x2a30c7,null))['then'](removeEntity(_0x2a30c7,null))[_0xe30e('0x58')](handleError(_0x2a30c7,null));};exports[_0xe30e('0x5c')]=function(_0xa1466c,_0x2b41c5,_0x240666){var _0x322753={};var _0xb1ed00={};var _0x410e2b;var _0x40b428;return db[_0xe30e('0x3c')][_0xe30e('0x5d')]({'where':{'id':_0xa1466c[_0xe30e('0x54')]['id']}})[_0xe30e('0x21')](handleEntityNotFound(_0x2b41c5,null))[_0xe30e('0x21')](function(_0x3191d4){if(_0x3191d4){_0x410e2b=_0x3191d4;_0xb1ed00[_0xe30e('0x40')]=_['keys'](db[_0xe30e('0x5e')][_0xe30e('0x3d')]);_0xb1ed00['query']=_[_0xe30e('0x55')](_0xa1466c[_0xe30e('0x41')]);_0xb1ed00[_0xe30e('0x42')]=_[_0xe30e('0x44')](_0xb1ed00[_0xe30e('0x40')],_0xb1ed00[_0xe30e('0x41')]);_0x322753['attributes']=_[_0xe30e('0x44')](_0xb1ed00[_0xe30e('0x40')],qs[_0xe30e('0x45')](_0xa1466c[_0xe30e('0x41')][_0xe30e('0x45')]));_0x322753['attributes']=_0x322753[_0xe30e('0x43')]['length']?_0x322753[_0xe30e('0x43')]:_0xb1ed00[_0xe30e('0x40')];_0x322753[_0xe30e('0x5f')]=qs['sort'](_0xa1466c[_0xe30e('0x41')]['sort']);_0x322753[_0xe30e('0x4a')]=qs[_0xe30e('0x42')](_[_0xe30e('0x4b')](_0xa1466c[_0xe30e('0x41')],_0xb1ed00[_0xe30e('0x42')]));if(_0xa1466c[_0xe30e('0x41')][_0xe30e('0x4c')]){_0x322753[_0xe30e('0x4a')]=_[_0xe30e('0x4d')](_0x322753[_0xe30e('0x4a')],{'$or':_[_0xe30e('0x3b')](_0x322753['attributes'],function(_0x3b3616){var _0x150fab={};_0x150fab[_0x3b3616]={'$like':'%'+_0xa1466c[_0xe30e('0x41')][_0xe30e('0x4c')]+'%'};return _0x150fab;})});}_0x322753=_[_0xe30e('0x4d')]({},_0x322753,_0xa1466c[_0xe30e('0x50')]);return _0x410e2b[_0xe30e('0x5c')](_0x322753);}})[_0xe30e('0x21')](function(_0x4e3a2c){if(_0x4e3a2c){_0x40b428=_0x4e3a2c[_0xe30e('0x46')];if(!_0xa1466c[_0xe30e('0x41')][_0xe30e('0x47')]('nolimit')){_0x322753[_0xe30e('0x32')]=qs[_0xe30e('0x32')](_0xa1466c[_0xe30e('0x41')][_0xe30e('0x32')]);_0x322753[_0xe30e('0x31')]=qs[_0xe30e('0x31')](_0xa1466c['query'][_0xe30e('0x31')]);}return _0x410e2b[_0xe30e('0x5c')](_0x322753);}})[_0xe30e('0x21')](function(_0x4bf09b){if(_0x4bf09b){return _0x4bf09b?{'count':_0x40b428,'rows':_0x4bf09b}:null;}})['then'](respondWithResult(_0x2b41c5,null))[_0xe30e('0x58')](handleError(_0x2b41c5,null));};exports[_0xe30e('0x60')]=function(_0x576277,_0x5ea696,_0x34a8a0){if(_0x576277[_0xe30e('0x5a')]['id']){delete _0x576277[_0xe30e('0x5a')]['id'];}return db[_0xe30e('0x3c')][_0xe30e('0x5d')]({'where':{'id':_0x576277[_0xe30e('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ea696,null))['then'](function(_0x2d18d4){if(_0x2d18d4){_0x576277[_0xe30e('0x5a')][_0xe30e('0x61')]=_0x2d18d4['id'];_0x576277[_0xe30e('0x5a')]['Subjects']=integrations[_0xe30e('0x62')](_0x576277[_0xe30e('0x5a')][_0xe30e('0x63')],_0x576277[_0xe30e('0x5a')]['type']);_0x576277['body']['Descriptions']=integrations['getDescriptions'](_0x576277['body']['channel'],_0x576277[_0xe30e('0x5a')][_0xe30e('0x4e')]);return db['ZendeskConfiguration']['create'](_0x576277[_0xe30e('0x5a')],{'include':[{'model':db[_0xe30e('0x64')],'as':'Subjects'},{'model':db[_0xe30e('0x64')],'as':_0xe30e('0x65')}]});}return null;})[_0xe30e('0x21')](respondWithResult(_0x5ea696,null))['catch'](handleError(_0x5ea696,null));};exports[_0xe30e('0x66')]=function(_0x2f1534,_0x5dd590,_0x741715){var _0x50bf8b='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x2f1534[_0xe30e('0x54')]['id']},'attributes':['id','username','password','token',_0xe30e('0x67'),_0xe30e('0x68')]})['then'](handleEntityNotFound(_0x5dd590,null))[_0xe30e('0x21')](function(_0x44710e){if(_0x44710e){_0x50bf8b=_0x44710e['remoteUri'];var _0x38f755=_0x50bf8b[_0xe30e('0x69')](-0x1);if(_0x38f755==='/'){_0x50bf8b=_0x50bf8b[_0xe30e('0x6a')](0x0,_0x50bf8b['lastIndexOf'](_0x38f755));}var _0x18395c={'method':_0xe30e('0x6b'),'uri':util[_0xe30e('0x6c')](_0xe30e('0x6d'),_0x50bf8b,_0xe30e('0x6e')),'json':!![]};switch(_0x44710e[_0xe30e('0x67')]){case _0xe30e('0x6f'):_0x18395c[_0xe30e('0x70')]={'Authorization':util['format'](_0xe30e('0x71'),new Buffer(util[_0xe30e('0x6c')](_0xe30e('0x72'),_0x44710e[_0xe30e('0x73')],_0x44710e['password']))['toString'](_0xe30e('0x74')))};break;case _0xe30e('0x75'):_0x18395c[_0xe30e('0x70')]={'Authorization':util['format'](_0xe30e('0x71'),new Buffer(util[_0xe30e('0x6c')]('%s/token:%s',_0x44710e[_0xe30e('0x73')],_0x44710e[_0xe30e('0x75')]))[_0xe30e('0x76')]('base64'))};break;default:throw new db[(_0xe30e('0x1f'))][(_0xe30e('0x20'))](_0xe30e('0x77'));}return rp(_0x18395c);}})[_0xe30e('0x21')](function(_0xa0cb98){if(_0xa0cb98){var _0x40338f=[_0xe30e('0x78'),_0xe30e('0x79'),_0xe30e('0x7a'),_0xe30e('0x7b')];_[_0xe30e('0x7c')](_0xa0cb98[_0xe30e('0x6e')],function(_0x2d15e5){return _0x40338f[_0xe30e('0x7d')](_0x2d15e5[_0xe30e('0x4e')]);});return{'count':_0xa0cb98[_0xe30e('0x6e')][_0xe30e('0x46')],'rows':_[_0xe30e('0x3b')](_0xa0cb98[_0xe30e('0x6e')],function(_0x3974e5){return{'id':_0x3974e5['id'],'name':_0x3974e5['position']>0x7?_0x3974e5[_0xe30e('0x7e')]:_0x3974e5[_0xe30e('0x4e')],'custom':_0x3974e5['position']>0x7?!![]:![],'options':_0x3974e5[_0xe30e('0x7f')]?_0x3974e5[_0xe30e('0x7f')]:_0x3974e5['custom_field_options']?_0x3974e5[_0xe30e('0x80')]:[]};})};}})[_0xe30e('0x21')](respondWithResult(_0x5dd590,null))[_0xe30e('0x58')](function(_0x2bc605){var _0x20c96d=_0x2f1534[_0xe30e('0x41')]['test']?0x1f4:_0x2bc605['statusCode']||0x1f4;logger[_0xe30e('0x27')](_0xe30e('0x81'),_0xe30e('0x66'),_0x20c96d,JSON[_0xe30e('0x26')](_0x2bc605));delete _0x2bc605[_0xe30e('0x39')];if(_0x20c96d===0x191){_0x20c96d=0x190;}_0x5dd590[_0xe30e('0x2d')](_0x20c96d)[_0xe30e('0x82')](_0x2f1534[_0xe30e('0x41')][_0xe30e('0x1e')]?{'message':_0xe30e('0x83'),'statusCode':_0x2bc605['statusCode']}:_0x2bc605);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index f3b58f6..b1b3f08 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 _0x4a45=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','int_zendesk_accounts'];(function(_0x6fa310,_0x577b36){var _0x53ed7f=function(_0x13321d){while(--_0x13321d){_0x6fa310['push'](_0x6fa310['shift']());}};_0x53ed7f(++_0x577b36);}(_0x4a45,0xaa));var _0x54a4=function(_0x4342ca,_0x1f46be){_0x4342ca=_0x4342ca-0x0;var _0x3d9af1=_0x4a45[_0x4342ca];return _0x3d9af1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x54a4('0x0'))(_0x54a4('0x1'));var moment=require('moment');var BPromise=require(_0x54a4('0x2'));var rp=require(_0x54a4('0x3'));var fs=require('fs');var path=require(_0x54a4('0x4'));var rimraf=require(_0x54a4('0x5'));var config=require(_0x54a4('0x6'));var attributes=require(_0x54a4('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x54a4('0x8')]=function(_0x487b92,_0xfa4a2b){return _0x487b92['define']('ZendeskAccount',attributes,{'tableName':_0x54a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb49=['ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intZendeskAccount.attributes','exports'];(function(_0x29ee89,_0x145bc6){var _0x1e7b09=function(_0x3a20e7){while(--_0x3a20e7){_0x29ee89['push'](_0x29ee89['shift']());}};_0x1e7b09(++_0x145bc6);}(_0xeb49,0x188));var _0x9eb4=function(_0x4fb871,_0x136c1c){_0x4fb871=_0x4fb871-0x0;var _0x29b8db=_0xeb49[_0x4fb871];return _0x29b8db;};'use strict';var _=require(_0x9eb4('0x0'));var util=require('util');var logger=require(_0x9eb4('0x1'))('api');var moment=require(_0x9eb4('0x2'));var BPromise=require(_0x9eb4('0x3'));var rp=require(_0x9eb4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9eb4('0x5'));var attributes=require(_0x9eb4('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x9eb4('0x7')]=function(_0x1b9dad,_0x26bf7a){return _0x1b9dad['define'](_0x9eb4('0x8'),attributes,{'tableName':_0x9eb4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 984c4f3..a8ca245 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 _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options'];(function(_0x56d124,_0x3f8e9f){var _0x57074b=function(_0x3a4123){while(--_0x3a4123){_0x56d124['push'](_0x56d124['shift']());}};_0x57074b(++_0x3f8e9f);}(_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')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ 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(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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 987ab1c..3a50502 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 _0x8e85=['Router','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3881f8,_0x1d2c78){var _0x39ec21=function(_0x33bdab){while(--_0x33bdab){_0x3881f8['push'](_0x3881f8['shift']());}};_0x39ec21(++_0x1d2c78);}(_0x8e85,0x14d));var _0x58e8=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x8e85[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x58e8('0x0'));var util=require(_0x58e8('0x1'));var path=require(_0x58e8('0x2'));var timeout=require(_0x58e8('0x3'));var express=require(_0x58e8('0x4'));var router=express[_0x58e8('0x5')]();var auth=require(_0x58e8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x58e8('0x7'));var controller=require(_0x58e8('0x8'));router[_0x58e8('0x9')]('/',auth[_0x58e8('0xa')](),controller[_0x58e8('0xb')]);router[_0x58e8('0x9')](_0x58e8('0xc'),auth[_0x58e8('0xa')](),controller[_0x58e8('0xd')]);router[_0x58e8('0x9')](_0x58e8('0xe'),auth['isAuthenticated'](),controller[_0x58e8('0xf')]);router['get'](_0x58e8('0x10'),auth[_0x58e8('0xa')](),controller[_0x58e8('0x11')]);router[_0x58e8('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x58e8('0x12'),auth[_0x58e8('0xa')](),controller[_0x58e8('0x13')]);router[_0x58e8('0x14')]('/',auth[_0x58e8('0xa')](),controller['create']);router[_0x58e8('0x14')](_0x58e8('0x12'),auth[_0x58e8('0xa')](),controller['setTags']);router[_0x58e8('0x15')]('/:id',auth[_0x58e8('0xa')](),controller[_0x58e8('0x16')]);router[_0x58e8('0x17')](_0x58e8('0xc'),auth[_0x58e8('0xa')](),controller[_0x58e8('0x18')]);module[_0x58e8('0x19')]=router; \ No newline at end of file +var _0xdc69=['delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update'];(function(_0x756417,_0x29428a){var _0x41dd70=function(_0x3a068a){while(--_0x3a068a){_0x756417['push'](_0x756417['shift']());}};_0x41dd70(++_0x29428a);}(_0xdc69,0x122));var _0x9dc6=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0xdc69[_0x12b8ec];return _0x21af77;};'use strict';var multer=require('multer');var util=require(_0x9dc6('0x0'));var path=require('path');var timeout=require(_0x9dc6('0x1'));var express=require(_0x9dc6('0x2'));var router=express[_0x9dc6('0x3')]();var auth=require(_0x9dc6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9dc6('0x5'));var controller=require(_0x9dc6('0x6'));router[_0x9dc6('0x7')]('/',auth[_0x9dc6('0x8')](),controller['index']);router['get']('/:id',auth[_0x9dc6('0x8')](),controller[_0x9dc6('0x9')]);router['get']('/:id/fields',auth[_0x9dc6('0x8')](),controller['getFields']);router[_0x9dc6('0x7')](_0x9dc6('0xa'),auth[_0x9dc6('0x8')](),controller[_0x9dc6('0xb')]);router[_0x9dc6('0x7')](_0x9dc6('0xc'),auth[_0x9dc6('0x8')](),controller[_0x9dc6('0xd')]);router[_0x9dc6('0x7')](_0x9dc6('0xe'),auth[_0x9dc6('0x8')](),controller[_0x9dc6('0xf')]);router[_0x9dc6('0x10')]('/',auth['isAuthenticated'](),controller[_0x9dc6('0x11')]);router['post']('/:id/tags',auth[_0x9dc6('0x8')](),controller[_0x9dc6('0x12')]);router[_0x9dc6('0x13')](_0x9dc6('0x14'),auth[_0x9dc6('0x8')](),controller[_0x9dc6('0x15')]);router[_0x9dc6('0x16')]('/:id',auth[_0x9dc6('0x8')](),controller[_0x9dc6('0x17')]);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 8763167..0b6c63c 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 _0x253c=['sequelize','STRING'];(function(_0x5ce75c,_0x3f6635){var _0x3a0fbe=function(_0x5045d1){while(--_0x5045d1){_0x5ce75c['push'](_0x5ce75c['shift']());}};_0x3a0fbe(++_0x3f6635);}(_0x253c,0x1ee));var _0xc253=function(_0x4b0008,_0x41218b){_0x4b0008=_0x4b0008-0x0;var _0x401c96=_0x253c[_0x4b0008];return _0x401c96;};'use strict';var Sequelize=require(_0xc253('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc253('0x1')]}}; \ No newline at end of file +var _0x5c22=['sequelize','STRING'];(function(_0x1fbd44,_0x4d9c98){var _0x19e60d=function(_0x1ba943){while(--_0x1ba943){_0x1fbd44['push'](_0x1fbd44['shift']());}};_0x19e60d(++_0x4d9c98);}(_0x5c22,0x94));var _0x25c2=function(_0x39c6b0,_0x110ca4){_0x39c6b0=_0x39c6b0-0x0;var _0x3b0110=_0x5c22[_0x39c6b0];return _0x3b0110;};'use strict';var Sequelize=require(_0x25c2('0x0'));module['exports']={'name':{'type':Sequelize[_0x25c2('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index fb65914..fbdd218 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 _0xae1b=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','stack','name','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','ZendeskConfiguration','find','create','update','body','params','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto'];(function(_0x48a3ae,_0x5214a6){var _0x290aaf=function(_0x257487){while(--_0x257487){_0x48a3ae['push'](_0x48a3ae['shift']());}};_0x290aaf(++_0x5214a6);}(_0xae1b,0xad));var _0xbae1=function(_0x11ac88,_0x17576c){_0x11ac88=_0x11ac88-0x0;var _0x4e2712=_0xae1b[_0x11ac88];return _0x4e2712;};'use strict';var pdf=require(_0xbae1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbae1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbae1('0x2'));var moment=require(_0xbae1('0x3'));var BPromise=require(_0xbae1('0x4'));var Mustache=require(_0xbae1('0x5'));var util=require(_0xbae1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbae1('0x7'));var ejs=require(_0xbae1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbae1('0x9'));var crypto=require(_0xbae1('0xa'));var jsforce=require(_0xbae1('0xb'));var deskjs=require(_0xbae1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbae1('0xd'));var Papa=require(_0xbae1('0xe'));var Redis=require('ioredis');var authService=require(_0xbae1('0xf'));var qs=require(_0xbae1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbae1('0x11'))('api');var utils=require(_0xbae1('0x12'));var config=require(_0xbae1('0x13'));var db=require(_0xbae1('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbae1('0x15')][_0xbae1('0x16')]({'port':0x232a});function checkPasswordPattern(_0x1e30e3,_0x1541ec,_0x384109){if(_0x384109){var _0x20a109=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20a109['test'](_0x1541ec)){return _0x1e30e3;}else{throw new db['Sequelize'][(_0xbae1('0x17'))](_0xbae1('0x18'));}}else{return _0x1e30e3;}}function respondWithRpcPromise(_0x504ee4,_0x367d20,_0xa5cf99,_0x2859e4){return new BPromise(function(_0x1c1232,_0x23a05e){var _0x55c3be=_0x2859e4||client;return _0x55c3be[_0xbae1('0x19')](_0x504ee4,_0xa5cf99)[_0xbae1('0x1a')](function(_0x2b3696){logger[_0xbae1('0x1b')]('ZendeskConfiguration,\x20%s,\x20%s',_0x367d20,_0xbae1('0x1c'));logger['debug'](_0xbae1('0x1d'),_0x367d20,_0xbae1('0x1c'),JSON['stringify'](_0x2b3696));if(_0x2b3696[_0xbae1('0x1e')]){if(_0x2b3696[_0xbae1('0x1e')][_0xbae1('0x1f')]===0x1f4){logger[_0xbae1('0x1e')](_0xbae1('0x20'),_0x367d20,_0x2b3696[_0xbae1('0x1e')]['message']);return _0x23a05e(_0x2b3696['error'][_0xbae1('0x21')]);}logger[_0xbae1('0x1e')](_0xbae1('0x20'),_0x367d20,_0x2b3696['error'][_0xbae1('0x21')]);return _0x1c1232(_0x2b3696[_0xbae1('0x1e')][_0xbae1('0x21')]);}else{logger[_0xbae1('0x1b')](_0xbae1('0x20'),_0x367d20,_0xbae1('0x1c'));_0x1c1232(_0x2b3696[_0xbae1('0x22')][_0xbae1('0x21')]);}})[_0xbae1('0x23')](function(_0x371f7c){logger[_0xbae1('0x1e')](_0xbae1('0x20'),_0x367d20,_0x371f7c);_0x23a05e(_0x371f7c);});});}function respondWithStatusCode(_0x5b6d88,_0x4ee7cf){_0x4ee7cf=_0x4ee7cf||0xcc;return function(_0x1ba87f){if(_0x1ba87f){return _0x5b6d88[_0xbae1('0x24')](_0x4ee7cf);}return _0x5b6d88[_0xbae1('0x25')](_0x4ee7cf)[_0xbae1('0x26')]();};}function respondWithResult(_0x2ac004,_0x1614d0){_0x1614d0=_0x1614d0||0xc8;return function(_0x2fd41c){if(_0x2fd41c){return _0x2ac004[_0xbae1('0x25')](_0x1614d0)[_0xbae1('0x27')](_0x2fd41c);}};}function respondWithFilteredResult(_0x13aa10,_0x276faa){return function(_0x2457eb){if(_0x2457eb){var _0xef85a4=_0x2457eb[_0xbae1('0x28')],_0x14a935=_0x276faa[_0xbae1('0x29')],_0x365cb6=_0x276faa[_0xbae1('0x29')]+_0x276faa[_0xbae1('0x2a')],_0x41170f;if(_0x365cb6>=_0xef85a4){_0x365cb6=_0xef85a4;_0x41170f=0xc8;}else{_0x41170f=0xce;}_0x13aa10[_0xbae1('0x25')](_0x41170f);return _0x13aa10[_0xbae1('0x2b')](_0xbae1('0x2c'),_0x14a935+'-'+_0x365cb6+'/'+_0xef85a4)[_0xbae1('0x27')](_0x2457eb);}return null;};}function patchUpdates(_0x1c1beb){return function(_0x1dc68f){try{jsonpatch[_0xbae1('0x2d')](_0x1dc68f,_0x1c1beb,!![]);}catch(_0x5d8bd3){return BPromise['reject'](_0x5d8bd3);}return _0x1dc68f[_0xbae1('0x2e')]();};}function saveUpdates(_0x35b657,_0x57b082){return function(_0x1f3d09){if(_0x1f3d09){return _0x1f3d09['update'](_0x35b657)['then'](function(_0x4de9e1){return _0x4de9e1;});}return null;};}function removeEntity(_0x3b8275,_0x4b7624){return function(_0x2e56d1){if(_0x2e56d1){return _0x2e56d1[_0xbae1('0x2f')]()[_0xbae1('0x1a')](function(){_0x3b8275['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eca6c,_0x36481b){return function(_0x1432b6){if(!_0x1432b6){_0x1eca6c[_0xbae1('0x24')](0x194);}return _0x1432b6;};}function handleError(_0x3b3b55,_0xc35f6e){_0xc35f6e=_0xc35f6e||0x1f4;return function(_0x88e333){logger[_0xbae1('0x1e')](_0x88e333[_0xbae1('0x30')]);if(_0x88e333[_0xbae1('0x31')]){delete _0x88e333[_0xbae1('0x31')];}_0x3b3b55[_0xbae1('0x25')](_0xc35f6e)['send'](_0x88e333);};}exports['index']=function(_0x52de95,_0x146b9b){var _0x544556={},_0xd7c3c6={},_0xa50cf0={'count':0x0,'rows':[]};var _0x1c4dcf=_[_0xbae1('0x32')](db['ZendeskConfiguration'][_0xbae1('0x33')],function(_0x26ace2){return{'name':_0x26ace2[_0xbae1('0x34')],'type':_0x26ace2[_0xbae1('0x35')][_0xbae1('0x36')]};});_0xd7c3c6['model']=_[_0xbae1('0x32')](_0x1c4dcf,_0xbae1('0x31'));_0xd7c3c6['query']=_[_0xbae1('0x37')](_0x52de95[_0xbae1('0x38')]);_0xd7c3c6[_0xbae1('0x39')]=_[_0xbae1('0x3a')](_0xd7c3c6['model'],_0xd7c3c6['query']);_0x544556[_0xbae1('0x3b')]=_[_0xbae1('0x3a')](_0xd7c3c6[_0xbae1('0x3c')],qs[_0xbae1('0x3d')](_0x52de95[_0xbae1('0x38')]['fields']));_0x544556[_0xbae1('0x3b')]=_0x544556['attributes'][_0xbae1('0x3e')]?_0x544556[_0xbae1('0x3b')]:_0xd7c3c6[_0xbae1('0x3c')];if(!_0x52de95['query'][_0xbae1('0x3f')](_0xbae1('0x40'))){_0x544556[_0xbae1('0x2a')]=qs[_0xbae1('0x2a')](_0x52de95[_0xbae1('0x38')][_0xbae1('0x2a')]);_0x544556[_0xbae1('0x29')]=qs[_0xbae1('0x29')](_0x52de95[_0xbae1('0x38')]['offset']);}_0x544556[_0xbae1('0x41')]=qs[_0xbae1('0x42')](_0x52de95[_0xbae1('0x38')][_0xbae1('0x42')]);_0x544556['where']=qs[_0xbae1('0x39')](_['pick'](_0x52de95[_0xbae1('0x38')],_0xd7c3c6[_0xbae1('0x39')]),_0x1c4dcf);if(_0x52de95[_0xbae1('0x38')][_0xbae1('0x43')]){_0x544556[_0xbae1('0x44')]=_[_0xbae1('0x45')](_0x544556['where'],{'$or':_['map'](_0x1c4dcf,function(_0x2d5752){if(_0x2d5752['type']!==_0xbae1('0x46')){var _0x2b881d={};_0x2b881d[_0x2d5752['name']]={'$like':'%'+_0x52de95['query'][_0xbae1('0x43')]+'%'};return _0x2b881d;}})});}_0x544556=_[_0xbae1('0x45')]({},_0x544556,_0x52de95[_0xbae1('0x47')]);var _0x38f117={'where':_0x544556[_0xbae1('0x44')]};return db['ZendeskConfiguration'][_0xbae1('0x28')](_0x38f117)[_0xbae1('0x1a')](function(_0x5231a9){_0xa50cf0['count']=_0x5231a9;if(_0x52de95[_0xbae1('0x38')][_0xbae1('0x48')]){_0x544556[_0xbae1('0x49')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xbae1('0x4a')](_0x544556);})[_0xbae1('0x1a')](function(_0x2cc477){_0xa50cf0[_0xbae1('0x4b')]=_0x2cc477;return _0xa50cf0;})['then'](respondWithFilteredResult(_0x146b9b,_0x544556))[_0xbae1('0x23')](handleError(_0x146b9b,null));};exports['show']=function(_0x34f6de,_0x48efd3){var _0x9c1a2f={'raw':![],'where':{'id':_0x34f6de['params']['id']}},_0x3f169d={};_0x3f169d[_0xbae1('0x3c')]=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x3f169d[_0xbae1('0x38')]=_[_0xbae1('0x37')](_0x34f6de['query']);_0x3f169d[_0xbae1('0x39')]=_[_0xbae1('0x3a')](_0x3f169d[_0xbae1('0x3c')],_0x3f169d[_0xbae1('0x38')]);_0x9c1a2f['attributes']=_[_0xbae1('0x3a')](_0x3f169d[_0xbae1('0x3c')],qs[_0xbae1('0x3d')](_0x34f6de[_0xbae1('0x38')][_0xbae1('0x3d')]));_0x9c1a2f['attributes']=_0x9c1a2f[_0xbae1('0x3b')][_0xbae1('0x3e')]?_0x9c1a2f['attributes']:_0x3f169d[_0xbae1('0x3c')];if(_0x34f6de[_0xbae1('0x38')][_0xbae1('0x48')]){_0x9c1a2f['include']=[{'all':!![]}];}_0x9c1a2f=_['merge']({},_0x9c1a2f,_0x34f6de[_0xbae1('0x47')]);return db[_0xbae1('0x4c')][_0xbae1('0x4d')](_0x9c1a2f)[_0xbae1('0x1a')](handleEntityNotFound(_0x48efd3,null))[_0xbae1('0x1a')](respondWithResult(_0x48efd3,null))['catch'](handleError(_0x48efd3,null));};exports[_0xbae1('0x4e')]=function(_0x550b55,_0x2af8e4){return db[_0xbae1('0x4c')][_0xbae1('0x4e')](_0x550b55['body'],{})[_0xbae1('0x1a')](respondWithResult(_0x2af8e4,0xc9))[_0xbae1('0x23')](handleError(_0x2af8e4,null));};exports[_0xbae1('0x4f')]=function(_0x1240f0,_0x1ed348){if(_0x1240f0[_0xbae1('0x50')]['id']){delete _0x1240f0[_0xbae1('0x50')]['id'];}return db[_0xbae1('0x4c')][_0xbae1('0x4d')]({'where':{'id':_0x1240f0[_0xbae1('0x51')]['id']}})[_0xbae1('0x1a')](handleEntityNotFound(_0x1ed348,null))[_0xbae1('0x1a')](saveUpdates(_0x1240f0[_0xbae1('0x50')],null))[_0xbae1('0x1a')](respondWithResult(_0x1ed348,null))['catch'](handleError(_0x1ed348,null));};exports['destroy']=function(_0x237370,_0x104872){return db['ZendeskConfiguration'][_0xbae1('0x4d')]({'where':{'id':_0x237370[_0xbae1('0x51')]['id']}})[_0xbae1('0x1a')](handleEntityNotFound(_0x104872,null))[_0xbae1('0x1a')](removeEntity(_0x104872,null))[_0xbae1('0x23')](handleError(_0x104872,null));};exports[_0xbae1('0x52')]=function(_0x425799,_0x2e32a1,_0x11f771){var _0x4970e9={};var _0x339347={};var _0x5d3a73;var _0x155c37;return db['ZendeskConfiguration'][_0xbae1('0x53')]({'where':{'id':_0x425799[_0xbae1('0x51')]['id']}})[_0xbae1('0x1a')](handleEntityNotFound(_0x2e32a1,null))[_0xbae1('0x1a')](function(_0x3ef7bb){if(_0x3ef7bb){_0x5d3a73=_0x3ef7bb;_0x339347[_0xbae1('0x3c')]=_['keys'](db[_0xbae1('0x54')]['rawAttributes']);_0x339347['query']=_[_0xbae1('0x37')](_0x425799['query']);_0x339347[_0xbae1('0x39')]=_[_0xbae1('0x3a')](_0x339347[_0xbae1('0x3c')],_0x339347[_0xbae1('0x38')]);_0x4970e9[_0xbae1('0x3b')]=_['intersection'](_0x339347[_0xbae1('0x3c')],qs['fields'](_0x425799[_0xbae1('0x38')][_0xbae1('0x3d')]));_0x4970e9[_0xbae1('0x3b')]=_0x4970e9['attributes']['length']?_0x4970e9[_0xbae1('0x3b')]:_0x339347[_0xbae1('0x3c')];_0x4970e9[_0xbae1('0x41')]=qs[_0xbae1('0x42')](_0x425799[_0xbae1('0x38')][_0xbae1('0x42')]);_0x4970e9[_0xbae1('0x44')]=qs['filters'](_[_0xbae1('0x55')](_0x425799['query'],_0x339347[_0xbae1('0x39')]));if(_0x425799[_0xbae1('0x38')][_0xbae1('0x43')]){_0x4970e9[_0xbae1('0x44')]=_[_0xbae1('0x45')](_0x4970e9[_0xbae1('0x44')],{'$or':_[_0xbae1('0x32')](_0x4970e9['attributes'],function(_0x7d4c7f){var _0x3de98b={};_0x3de98b[_0x7d4c7f]={'$like':'%'+_0x425799[_0xbae1('0x38')][_0xbae1('0x43')]+'%'};return _0x3de98b;})});}_0x4970e9=_['merge']({},_0x4970e9,_0x425799['options']);return _0x5d3a73['getFields'](_0x4970e9);}})[_0xbae1('0x1a')](function(_0x515ccd){if(_0x515ccd){_0x155c37=_0x515ccd[_0xbae1('0x3e')];if(!_0x425799['query']['hasOwnProperty'](_0xbae1('0x40'))){_0x4970e9[_0xbae1('0x2a')]=qs['limit'](_0x425799[_0xbae1('0x38')][_0xbae1('0x2a')]);_0x4970e9[_0xbae1('0x29')]=qs['offset'](_0x425799['query'][_0xbae1('0x29')]);}return _0x5d3a73[_0xbae1('0x52')](_0x4970e9);}})[_0xbae1('0x1a')](function(_0x49302f){if(_0x49302f){return _0x49302f?{'count':_0x155c37,'rows':_0x49302f}:null;}})[_0xbae1('0x1a')](respondWithResult(_0x2e32a1,null))[_0xbae1('0x23')](handleError(_0x2e32a1,null));};exports[_0xbae1('0x56')]=function(_0x1a7306,_0x2964c4,_0x3d3054){var _0x257088={};var _0x1eb5be={};var _0x2cec5a;var _0x40bee1;return db[_0xbae1('0x4c')][_0xbae1('0x53')]({'where':{'id':_0x1a7306[_0xbae1('0x51')]['id']}})[_0xbae1('0x1a')](handleEntityNotFound(_0x2964c4,null))['then'](function(_0x44b07d){if(_0x44b07d){_0x2cec5a=_0x44b07d;_0x1eb5be[_0xbae1('0x3c')]=_['keys'](db[_0xbae1('0x54')][_0xbae1('0x33')]);_0x1eb5be[_0xbae1('0x38')]=_['keys'](_0x1a7306[_0xbae1('0x38')]);_0x1eb5be[_0xbae1('0x39')]=_[_0xbae1('0x3a')](_0x1eb5be[_0xbae1('0x3c')],_0x1eb5be[_0xbae1('0x38')]);_0x257088[_0xbae1('0x3b')]=_[_0xbae1('0x3a')](_0x1eb5be[_0xbae1('0x3c')],qs[_0xbae1('0x3d')](_0x1a7306[_0xbae1('0x38')][_0xbae1('0x3d')]));_0x257088[_0xbae1('0x3b')]=_0x257088[_0xbae1('0x3b')][_0xbae1('0x3e')]?_0x257088[_0xbae1('0x3b')]:_0x1eb5be['model'];_0x257088['order']=qs[_0xbae1('0x42')](_0x1a7306['query']['sort']);_0x257088[_0xbae1('0x44')]=qs[_0xbae1('0x39')](_[_0xbae1('0x55')](_0x1a7306[_0xbae1('0x38')],_0x1eb5be[_0xbae1('0x39')]));if(_0x1a7306[_0xbae1('0x38')][_0xbae1('0x43')]){_0x257088[_0xbae1('0x44')]=_['merge'](_0x257088['where'],{'$or':_[_0xbae1('0x32')](_0x257088[_0xbae1('0x3b')],function(_0x58393b){var _0x2dfd34={};_0x2dfd34[_0x58393b]={'$like':'%'+_0x1a7306[_0xbae1('0x38')][_0xbae1('0x43')]+'%'};return _0x2dfd34;})});}_0x257088=_[_0xbae1('0x45')]({},_0x257088,_0x1a7306['options']);return _0x2cec5a[_0xbae1('0x56')](_0x257088);}})['then'](function(_0x380299){if(_0x380299){_0x40bee1=_0x380299[_0xbae1('0x3e')];if(!_0x1a7306[_0xbae1('0x38')][_0xbae1('0x3f')](_0xbae1('0x40'))){_0x257088['limit']=qs[_0xbae1('0x2a')](_0x1a7306[_0xbae1('0x38')]['limit']);_0x257088[_0xbae1('0x29')]=qs[_0xbae1('0x29')](_0x1a7306[_0xbae1('0x38')][_0xbae1('0x29')]);}return _0x2cec5a[_0xbae1('0x56')](_0x257088);}})[_0xbae1('0x1a')](function(_0x3f6e97){if(_0x3f6e97){return _0x3f6e97?{'count':_0x40bee1,'rows':_0x3f6e97}:null;}})['then'](respondWithResult(_0x2964c4,null))[_0xbae1('0x23')](handleError(_0x2964c4,null));};exports[_0xbae1('0x57')]=function(_0x289f4f,_0x11d9aa,_0x25d72d){var _0x2cc888={};var _0x15498e={};var _0x288bf7;var _0x4a5b12;return db[_0xbae1('0x4c')][_0xbae1('0x53')]({'where':{'id':_0x289f4f[_0xbae1('0x51')]['id']}})[_0xbae1('0x1a')](handleEntityNotFound(_0x11d9aa,null))['then'](function(_0x3300d9){if(_0x3300d9){_0x288bf7=_0x3300d9;_0x15498e['model']=_['keys'](db[_0xbae1('0x54')][_0xbae1('0x33')]);_0x15498e[_0xbae1('0x38')]=_[_0xbae1('0x37')](_0x289f4f['query']);_0x15498e[_0xbae1('0x39')]=_[_0xbae1('0x3a')](_0x15498e[_0xbae1('0x3c')],_0x15498e['query']);_0x2cc888['attributes']=_[_0xbae1('0x3a')](_0x15498e[_0xbae1('0x3c')],qs[_0xbae1('0x3d')](_0x289f4f['query'][_0xbae1('0x3d')]));_0x2cc888[_0xbae1('0x3b')]=_0x2cc888[_0xbae1('0x3b')][_0xbae1('0x3e')]?_0x2cc888[_0xbae1('0x3b')]:_0x15498e[_0xbae1('0x3c')];_0x2cc888[_0xbae1('0x41')]=qs[_0xbae1('0x42')](_0x289f4f['query'][_0xbae1('0x42')]);_0x2cc888[_0xbae1('0x44')]=qs[_0xbae1('0x39')](_['pick'](_0x289f4f[_0xbae1('0x38')],_0x15498e[_0xbae1('0x39')]));if(_0x289f4f[_0xbae1('0x38')][_0xbae1('0x43')]){_0x2cc888[_0xbae1('0x44')]=_[_0xbae1('0x45')](_0x2cc888[_0xbae1('0x44')],{'$or':_[_0xbae1('0x32')](_0x2cc888[_0xbae1('0x3b')],function(_0x29ccde){var _0x504596={};_0x504596[_0x29ccde]={'$like':'%'+_0x289f4f[_0xbae1('0x38')][_0xbae1('0x43')]+'%'};return _0x504596;})});}_0x2cc888=_['merge']({},_0x2cc888,_0x289f4f[_0xbae1('0x47')]);return _0x288bf7[_0xbae1('0x57')](_0x2cc888);}})[_0xbae1('0x1a')](function(_0x3242bb){if(_0x3242bb){_0x4a5b12=_0x3242bb[_0xbae1('0x3e')];if(!_0x289f4f[_0xbae1('0x38')][_0xbae1('0x3f')]('nolimit')){_0x2cc888[_0xbae1('0x2a')]=qs[_0xbae1('0x2a')](_0x289f4f[_0xbae1('0x38')][_0xbae1('0x2a')]);_0x2cc888[_0xbae1('0x29')]=qs[_0xbae1('0x29')](_0x289f4f[_0xbae1('0x38')][_0xbae1('0x29')]);}return _0x288bf7['getDescriptions'](_0x2cc888);}})[_0xbae1('0x1a')](function(_0x49f8f1){if(_0x49f8f1){return _0x49f8f1?{'count':_0x4a5b12,'rows':_0x49f8f1}:null;}})[_0xbae1('0x1a')](respondWithResult(_0x11d9aa,null))[_0xbae1('0x23')](handleError(_0x11d9aa,null));};exports[_0xbae1('0x58')]=function(_0x3f7877,_0x4238c6,_0x2cd924){var _0x317cc3={};var _0x3e3339={};var _0x1f634b;var _0x4e969c;return db['ZendeskConfiguration'][_0xbae1('0x53')]({'where':{'id':_0x3f7877[_0xbae1('0x51')]['id']}})[_0xbae1('0x1a')](handleEntityNotFound(_0x4238c6,null))[_0xbae1('0x1a')](function(_0x2b7d2c){if(_0x2b7d2c){_0x1f634b=_0x2b7d2c;_0x3e3339['model']=_[_0xbae1('0x37')](db[_0xbae1('0x59')][_0xbae1('0x33')]);_0x3e3339['query']=_[_0xbae1('0x37')](_0x3f7877['query']);_0x3e3339['filters']=_[_0xbae1('0x3a')](_0x3e3339[_0xbae1('0x3c')],_0x3e3339[_0xbae1('0x38')]);_0x317cc3['attributes']=_[_0xbae1('0x3a')](_0x3e3339[_0xbae1('0x3c')],qs[_0xbae1('0x3d')](_0x3f7877[_0xbae1('0x38')][_0xbae1('0x3d')]));_0x317cc3[_0xbae1('0x3b')]=_0x317cc3[_0xbae1('0x3b')][_0xbae1('0x3e')]?_0x317cc3['attributes']:_0x3e3339[_0xbae1('0x3c')];_0x317cc3[_0xbae1('0x41')]=qs[_0xbae1('0x42')](_0x3f7877[_0xbae1('0x38')][_0xbae1('0x42')]);_0x317cc3[_0xbae1('0x44')]=qs['filters'](_['pick'](_0x3f7877['query'],_0x3e3339[_0xbae1('0x39')]));if(_0x3f7877['query'][_0xbae1('0x43')]){_0x317cc3['where']=_['merge'](_0x317cc3[_0xbae1('0x44')],{'$or':_[_0xbae1('0x32')](_0x317cc3[_0xbae1('0x3b')],function(_0x273dab){var _0x57c85c={};_0x57c85c[_0x273dab]={'$like':'%'+_0x3f7877[_0xbae1('0x38')][_0xbae1('0x43')]+'%'};return _0x57c85c;})});}_0x317cc3=_[_0xbae1('0x45')]({},_0x317cc3,_0x3f7877[_0xbae1('0x47')]);return _0x1f634b['getTags'](_0x317cc3);}})[_0xbae1('0x1a')](function(_0x1e614d){if(_0x1e614d){_0x4e969c=_0x1e614d[_0xbae1('0x3e')];if(!_0x3f7877['query'][_0xbae1('0x3f')](_0xbae1('0x40'))){_0x317cc3[_0xbae1('0x2a')]=qs[_0xbae1('0x2a')](_0x3f7877[_0xbae1('0x38')][_0xbae1('0x2a')]);_0x317cc3[_0xbae1('0x29')]=qs['offset'](_0x3f7877['query'][_0xbae1('0x29')]);}return _0x1f634b[_0xbae1('0x58')](_0x317cc3);}})['then'](function(_0x1c2a99){if(_0x1c2a99){return _0x1c2a99?{'count':_0x4e969c,'rows':_0x1c2a99}:null;}})[_0xbae1('0x1a')](respondWithResult(_0x4238c6,null))[_0xbae1('0x23')](handleError(_0x4238c6,null));};exports[_0xbae1('0x5a')]=function(_0x3072b6,_0x5bf8a5,_0x2d36f8){if(_0x3072b6[_0xbae1('0x50')]['id']){delete _0x3072b6['body']['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3072b6[_0xbae1('0x51')]['id']}})[_0xbae1('0x1a')](handleEntityNotFound(_0x5bf8a5,null))[_0xbae1('0x1a')](function(_0x1fc05f){if(_0x1fc05f){return _0x1fc05f[_0xbae1('0x5a')](_0x3072b6[_0xbae1('0x50')][_0xbae1('0x5b')]||[]);}return null;})[_0xbae1('0x1a')](respondWithResult(_0x5bf8a5,null))[_0xbae1('0x23')](handleError(_0x5bf8a5,null));}; \ No newline at end of file +var _0x22b4=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../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','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','stack','name','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','create','body','find','destroy','getFields','order','pick','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x22b4,0x184));var _0x422b=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x22b4[_0x1b6c6d];return _0x290d9d;};'use strict';var pdf=require(_0x422b('0x0'));var emlformat=require(_0x422b('0x1'));var rimraf=require(_0x422b('0x2'));var zipdir=require(_0x422b('0x3'));var jsonpatch=require(_0x422b('0x4'));var rp=require(_0x422b('0x5'));var moment=require(_0x422b('0x6'));var BPromise=require(_0x422b('0x7'));var Mustache=require(_0x422b('0x8'));var util=require('util');var path=require(_0x422b('0x9'));var sox=require(_0x422b('0xa'));var csv=require('to-csv');var ejs=require(_0x422b('0xb'));var fs=require('fs');var _=require(_0x422b('0xc'));var squel=require(_0x422b('0xd'));var crypto=require(_0x422b('0xe'));var jsforce=require(_0x422b('0xf'));var deskjs=require(_0x422b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x422b('0x11'));var Papa=require('papaparse');var Redis=require(_0x422b('0x12'));var authService=require(_0x422b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x422b('0x14'));var hardwareService=require(_0x422b('0x15'));var logger=require(_0x422b('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x422b('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x422b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5e9f69,_0x4757e1,_0x19af7f){if(_0x19af7f){var _0x35374a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35374a[_0x422b('0x19')](_0x4757e1)){return _0x5e9f69;}else{throw new db[(_0x422b('0x1a'))]['ValidationError'](_0x422b('0x1b'));}}else{return _0x5e9f69;}}function respondWithRpcPromise(_0x4909b5,_0x1ccb6f,_0x3e2b11,_0x422cff){return new BPromise(function(_0x5ba547,_0x20053f){var _0x52c686=_0x422cff||client;return _0x52c686[_0x422b('0x1c')](_0x4909b5,_0x3e2b11)['then'](function(_0x414888){logger[_0x422b('0x1d')](_0x422b('0x1e'),_0x1ccb6f,_0x422b('0x1f'));logger[_0x422b('0x20')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1ccb6f,'request\x20sent',JSON[_0x422b('0x21')](_0x414888));if(_0x414888['error']){if(_0x414888['error'][_0x422b('0x22')]===0x1f4){logger['error'](_0x422b('0x1e'),_0x1ccb6f,_0x414888[_0x422b('0x23')][_0x422b('0x24')]);return _0x20053f(_0x414888[_0x422b('0x23')]['message']);}logger['error'](_0x422b('0x1e'),_0x1ccb6f,_0x414888[_0x422b('0x23')]['message']);return _0x5ba547(_0x414888[_0x422b('0x23')]['message']);}else{logger['info'](_0x422b('0x1e'),_0x1ccb6f,_0x422b('0x1f'));_0x5ba547(_0x414888[_0x422b('0x25')]['message']);}})[_0x422b('0x26')](function(_0x55dd7b){logger[_0x422b('0x23')](_0x422b('0x1e'),_0x1ccb6f,_0x55dd7b);_0x20053f(_0x55dd7b);});});}function respondWithStatusCode(_0x1e97d5,_0x414ddb){_0x414ddb=_0x414ddb||0xcc;return function(_0x48c53a){if(_0x48c53a){return _0x1e97d5[_0x422b('0x27')](_0x414ddb);}return _0x1e97d5[_0x422b('0x28')](_0x414ddb)['end']();};}function respondWithResult(_0x3685bf,_0x8e4abf){_0x8e4abf=_0x8e4abf||0xc8;return function(_0xa1ec3){if(_0xa1ec3){return _0x3685bf['status'](_0x8e4abf)[_0x422b('0x29')](_0xa1ec3);}};}function respondWithFilteredResult(_0x687ddf,_0x36c6e9){return function(_0x121d3a){if(_0x121d3a){var _0x343280=_0x121d3a[_0x422b('0x2a')],_0x4a1533=_0x36c6e9['offset'],_0x14794f=_0x36c6e9[_0x422b('0x2b')]+_0x36c6e9[_0x422b('0x2c')],_0x1fd700;if(_0x14794f>=_0x343280){_0x14794f=_0x343280;_0x1fd700=0xc8;}else{_0x1fd700=0xce;}_0x687ddf[_0x422b('0x28')](_0x1fd700);return _0x687ddf[_0x422b('0x2d')](_0x422b('0x2e'),_0x4a1533+'-'+_0x14794f+'/'+_0x343280)[_0x422b('0x29')](_0x121d3a);}return null;};}function patchUpdates(_0x5d7d66){return function(_0x150e17){try{jsonpatch[_0x422b('0x2f')](_0x150e17,_0x5d7d66,!![]);}catch(_0x191ef2){return BPromise[_0x422b('0x30')](_0x191ef2);}return _0x150e17[_0x422b('0x31')]();};}function saveUpdates(_0x4444aa,_0x3f2328){return function(_0x892398){if(_0x892398){return _0x892398[_0x422b('0x32')](_0x4444aa)[_0x422b('0x33')](function(_0x3be23d){return _0x3be23d;});}return null;};}function removeEntity(_0x4f9ffa,_0x86fede){return function(_0x35c359){if(_0x35c359){return _0x35c359['destroy']()[_0x422b('0x33')](function(){_0x4f9ffa['status'](0xcc)[_0x422b('0x34')]();});}};}function handleEntityNotFound(_0x3bd00b,_0x5669e4){return function(_0x1f9d2f){if(!_0x1f9d2f){_0x3bd00b[_0x422b('0x27')](0x194);}return _0x1f9d2f;};}function handleError(_0x1f53fb,_0x57cff4){_0x57cff4=_0x57cff4||0x1f4;return function(_0x92614){logger[_0x422b('0x23')](_0x92614[_0x422b('0x35')]);if(_0x92614['name']){delete _0x92614[_0x422b('0x36')];}_0x1f53fb[_0x422b('0x28')](_0x57cff4)['send'](_0x92614);};}exports[_0x422b('0x37')]=function(_0x38ad6d,_0x4da13e){var _0x20c538={},_0x4580c4={},_0x2424be={'count':0x0,'rows':[]};var _0x5dbf51=_['map'](db[_0x422b('0x38')][_0x422b('0x39')],function(_0x5211b6){return{'name':_0x5211b6[_0x422b('0x3a')],'type':_0x5211b6[_0x422b('0x3b')][_0x422b('0x3c')]};});_0x4580c4['model']=_[_0x422b('0x3d')](_0x5dbf51,_0x422b('0x36'));_0x4580c4[_0x422b('0x3e')]=_[_0x422b('0x3f')](_0x38ad6d[_0x422b('0x3e')]);_0x4580c4[_0x422b('0x40')]=_[_0x422b('0x41')](_0x4580c4[_0x422b('0x42')],_0x4580c4['query']);_0x20c538[_0x422b('0x43')]=_[_0x422b('0x41')](_0x4580c4[_0x422b('0x42')],qs['fields'](_0x38ad6d[_0x422b('0x3e')][_0x422b('0x44')]));_0x20c538['attributes']=_0x20c538[_0x422b('0x43')][_0x422b('0x45')]?_0x20c538['attributes']:_0x4580c4[_0x422b('0x42')];if(!_0x38ad6d[_0x422b('0x3e')][_0x422b('0x46')](_0x422b('0x47'))){_0x20c538[_0x422b('0x2c')]=qs[_0x422b('0x2c')](_0x38ad6d[_0x422b('0x3e')][_0x422b('0x2c')]);_0x20c538[_0x422b('0x2b')]=qs[_0x422b('0x2b')](_0x38ad6d[_0x422b('0x3e')]['offset']);}_0x20c538['order']=qs[_0x422b('0x48')](_0x38ad6d[_0x422b('0x3e')]['sort']);_0x20c538[_0x422b('0x49')]=qs[_0x422b('0x40')](_['pick'](_0x38ad6d[_0x422b('0x3e')],_0x4580c4[_0x422b('0x40')]),_0x5dbf51);if(_0x38ad6d[_0x422b('0x3e')][_0x422b('0x4a')]){_0x20c538[_0x422b('0x49')]=_[_0x422b('0x4b')](_0x20c538[_0x422b('0x49')],{'$or':_[_0x422b('0x3d')](_0x5dbf51,function(_0xa86ca3){if(_0xa86ca3[_0x422b('0x3b')]!==_0x422b('0x4c')){var _0x2f9362={};_0x2f9362[_0xa86ca3[_0x422b('0x36')]]={'$like':'%'+_0x38ad6d[_0x422b('0x3e')][_0x422b('0x4a')]+'%'};return _0x2f9362;}})});}_0x20c538=_[_0x422b('0x4b')]({},_0x20c538,_0x38ad6d[_0x422b('0x4d')]);var _0x3e03b8={'where':_0x20c538[_0x422b('0x49')]};return db[_0x422b('0x38')][_0x422b('0x2a')](_0x3e03b8)[_0x422b('0x33')](function(_0x3b411b){_0x2424be[_0x422b('0x2a')]=_0x3b411b;if(_0x38ad6d['query'][_0x422b('0x4e')]){_0x20c538['include']=[{'all':!![]}];}return db[_0x422b('0x38')]['findAll'](_0x20c538);})['then'](function(_0x456f77){_0x2424be[_0x422b('0x4f')]=_0x456f77;return _0x2424be;})['then'](respondWithFilteredResult(_0x4da13e,_0x20c538))[_0x422b('0x26')](handleError(_0x4da13e,null));};exports[_0x422b('0x50')]=function(_0x4f03aa,_0x220f44){var _0x550963={'raw':![],'where':{'id':_0x4f03aa[_0x422b('0x51')]['id']}},_0x163aa3={};_0x163aa3['model']=_[_0x422b('0x3f')](db['ZendeskConfiguration'][_0x422b('0x39')]);_0x163aa3[_0x422b('0x3e')]=_[_0x422b('0x3f')](_0x4f03aa[_0x422b('0x3e')]);_0x163aa3['filters']=_[_0x422b('0x41')](_0x163aa3[_0x422b('0x42')],_0x163aa3[_0x422b('0x3e')]);_0x550963[_0x422b('0x43')]=_[_0x422b('0x41')](_0x163aa3[_0x422b('0x42')],qs[_0x422b('0x44')](_0x4f03aa[_0x422b('0x3e')][_0x422b('0x44')]));_0x550963[_0x422b('0x43')]=_0x550963[_0x422b('0x43')][_0x422b('0x45')]?_0x550963[_0x422b('0x43')]:_0x163aa3['model'];if(_0x4f03aa[_0x422b('0x3e')]['includeAll']){_0x550963[_0x422b('0x52')]=[{'all':!![]}];}_0x550963=_[_0x422b('0x4b')]({},_0x550963,_0x4f03aa[_0x422b('0x4d')]);return db[_0x422b('0x38')]['find'](_0x550963)[_0x422b('0x33')](handleEntityNotFound(_0x220f44,null))[_0x422b('0x33')](respondWithResult(_0x220f44,null))['catch'](handleError(_0x220f44,null));};exports['create']=function(_0x469db2,_0x53927d){return db[_0x422b('0x38')][_0x422b('0x53')](_0x469db2['body'],{})[_0x422b('0x33')](respondWithResult(_0x53927d,0xc9))[_0x422b('0x26')](handleError(_0x53927d,null));};exports[_0x422b('0x32')]=function(_0x178e14,_0x3fc11e){if(_0x178e14[_0x422b('0x54')]['id']){delete _0x178e14['body']['id'];}return db[_0x422b('0x38')][_0x422b('0x55')]({'where':{'id':_0x178e14[_0x422b('0x51')]['id']}})['then'](handleEntityNotFound(_0x3fc11e,null))[_0x422b('0x33')](saveUpdates(_0x178e14['body'],null))['then'](respondWithResult(_0x3fc11e,null))['catch'](handleError(_0x3fc11e,null));};exports[_0x422b('0x56')]=function(_0x51ad72,_0x4c1799){return db[_0x422b('0x38')][_0x422b('0x55')]({'where':{'id':_0x51ad72[_0x422b('0x51')]['id']}})[_0x422b('0x33')](handleEntityNotFound(_0x4c1799,null))['then'](removeEntity(_0x4c1799,null))[_0x422b('0x26')](handleError(_0x4c1799,null));};exports[_0x422b('0x57')]=function(_0x2c3945,_0x340df8,_0x1380b3){var _0x4d48f4={};var _0x855634={};var _0x174102;var _0x35b2ee;return db[_0x422b('0x38')]['findOne']({'where':{'id':_0x2c3945[_0x422b('0x51')]['id']}})['then'](handleEntityNotFound(_0x340df8,null))[_0x422b('0x33')](function(_0x1e2068){if(_0x1e2068){_0x174102=_0x1e2068;_0x855634[_0x422b('0x42')]=_[_0x422b('0x3f')](db['ZendeskField'][_0x422b('0x39')]);_0x855634[_0x422b('0x3e')]=_[_0x422b('0x3f')](_0x2c3945[_0x422b('0x3e')]);_0x855634[_0x422b('0x40')]=_['intersection'](_0x855634[_0x422b('0x42')],_0x855634[_0x422b('0x3e')]);_0x4d48f4['attributes']=_[_0x422b('0x41')](_0x855634['model'],qs[_0x422b('0x44')](_0x2c3945[_0x422b('0x3e')][_0x422b('0x44')]));_0x4d48f4[_0x422b('0x43')]=_0x4d48f4[_0x422b('0x43')][_0x422b('0x45')]?_0x4d48f4[_0x422b('0x43')]:_0x855634[_0x422b('0x42')];_0x4d48f4[_0x422b('0x58')]=qs[_0x422b('0x48')](_0x2c3945['query'][_0x422b('0x48')]);_0x4d48f4['where']=qs[_0x422b('0x40')](_[_0x422b('0x59')](_0x2c3945[_0x422b('0x3e')],_0x855634[_0x422b('0x40')]));if(_0x2c3945[_0x422b('0x3e')][_0x422b('0x4a')]){_0x4d48f4[_0x422b('0x49')]=_[_0x422b('0x4b')](_0x4d48f4[_0x422b('0x49')],{'$or':_[_0x422b('0x3d')](_0x4d48f4[_0x422b('0x43')],function(_0x35a851){var _0x291590={};_0x291590[_0x35a851]={'$like':'%'+_0x2c3945[_0x422b('0x3e')][_0x422b('0x4a')]+'%'};return _0x291590;})});}_0x4d48f4=_[_0x422b('0x4b')]({},_0x4d48f4,_0x2c3945[_0x422b('0x4d')]);return _0x174102['getFields'](_0x4d48f4);}})[_0x422b('0x33')](function(_0x12e3e3){if(_0x12e3e3){_0x35b2ee=_0x12e3e3[_0x422b('0x45')];if(!_0x2c3945[_0x422b('0x3e')]['hasOwnProperty'](_0x422b('0x47'))){_0x4d48f4[_0x422b('0x2c')]=qs['limit'](_0x2c3945[_0x422b('0x3e')][_0x422b('0x2c')]);_0x4d48f4[_0x422b('0x2b')]=qs[_0x422b('0x2b')](_0x2c3945[_0x422b('0x3e')][_0x422b('0x2b')]);}return _0x174102['getFields'](_0x4d48f4);}})['then'](function(_0x251158){if(_0x251158){return _0x251158?{'count':_0x35b2ee,'rows':_0x251158}:null;}})[_0x422b('0x33')](respondWithResult(_0x340df8,null))['catch'](handleError(_0x340df8,null));};exports[_0x422b('0x5a')]=function(_0x4f41cd,_0x454b35,_0xb09eaf){var _0x77cc8a={};var _0x572fba={};var _0x247be5;var _0x3461da;return db[_0x422b('0x38')][_0x422b('0x5b')]({'where':{'id':_0x4f41cd[_0x422b('0x51')]['id']}})[_0x422b('0x33')](handleEntityNotFound(_0x454b35,null))['then'](function(_0x8f8f1){if(_0x8f8f1){_0x247be5=_0x8f8f1;_0x572fba['model']=_[_0x422b('0x3f')](db[_0x422b('0x5c')][_0x422b('0x39')]);_0x572fba[_0x422b('0x3e')]=_['keys'](_0x4f41cd['query']);_0x572fba[_0x422b('0x40')]=_['intersection'](_0x572fba[_0x422b('0x42')],_0x572fba[_0x422b('0x3e')]);_0x77cc8a['attributes']=_[_0x422b('0x41')](_0x572fba[_0x422b('0x42')],qs['fields'](_0x4f41cd[_0x422b('0x3e')][_0x422b('0x44')]));_0x77cc8a[_0x422b('0x43')]=_0x77cc8a[_0x422b('0x43')][_0x422b('0x45')]?_0x77cc8a[_0x422b('0x43')]:_0x572fba[_0x422b('0x42')];_0x77cc8a['order']=qs[_0x422b('0x48')](_0x4f41cd[_0x422b('0x3e')][_0x422b('0x48')]);_0x77cc8a[_0x422b('0x49')]=qs[_0x422b('0x40')](_[_0x422b('0x59')](_0x4f41cd['query'],_0x572fba[_0x422b('0x40')]));if(_0x4f41cd['query'][_0x422b('0x4a')]){_0x77cc8a[_0x422b('0x49')]=_[_0x422b('0x4b')](_0x77cc8a[_0x422b('0x49')],{'$or':_[_0x422b('0x3d')](_0x77cc8a[_0x422b('0x43')],function(_0x2ddfa8){var _0x24ea51={};_0x24ea51[_0x2ddfa8]={'$like':'%'+_0x4f41cd[_0x422b('0x3e')][_0x422b('0x4a')]+'%'};return _0x24ea51;})});}_0x77cc8a=_[_0x422b('0x4b')]({},_0x77cc8a,_0x4f41cd[_0x422b('0x4d')]);return _0x247be5[_0x422b('0x5a')](_0x77cc8a);}})['then'](function(_0x26510e){if(_0x26510e){_0x3461da=_0x26510e[_0x422b('0x45')];if(!_0x4f41cd['query']['hasOwnProperty'](_0x422b('0x47'))){_0x77cc8a['limit']=qs['limit'](_0x4f41cd[_0x422b('0x3e')][_0x422b('0x2c')]);_0x77cc8a[_0x422b('0x2b')]=qs[_0x422b('0x2b')](_0x4f41cd[_0x422b('0x3e')][_0x422b('0x2b')]);}return _0x247be5[_0x422b('0x5a')](_0x77cc8a);}})['then'](function(_0x4d75a5){if(_0x4d75a5){return _0x4d75a5?{'count':_0x3461da,'rows':_0x4d75a5}:null;}})[_0x422b('0x33')](respondWithResult(_0x454b35,null))[_0x422b('0x26')](handleError(_0x454b35,null));};exports[_0x422b('0x5d')]=function(_0x2d22e6,_0x363b40,_0x28edad){var _0x3d47bb={};var _0x1e0162={};var _0x364398;var _0x49431f;return db[_0x422b('0x38')][_0x422b('0x5b')]({'where':{'id':_0x2d22e6['params']['id']}})[_0x422b('0x33')](handleEntityNotFound(_0x363b40,null))['then'](function(_0x220162){if(_0x220162){_0x364398=_0x220162;_0x1e0162[_0x422b('0x42')]=_[_0x422b('0x3f')](db[_0x422b('0x5c')][_0x422b('0x39')]);_0x1e0162[_0x422b('0x3e')]=_['keys'](_0x2d22e6[_0x422b('0x3e')]);_0x1e0162[_0x422b('0x40')]=_[_0x422b('0x41')](_0x1e0162['model'],_0x1e0162[_0x422b('0x3e')]);_0x3d47bb[_0x422b('0x43')]=_[_0x422b('0x41')](_0x1e0162['model'],qs[_0x422b('0x44')](_0x2d22e6[_0x422b('0x3e')]['fields']));_0x3d47bb['attributes']=_0x3d47bb['attributes'][_0x422b('0x45')]?_0x3d47bb[_0x422b('0x43')]:_0x1e0162[_0x422b('0x42')];_0x3d47bb[_0x422b('0x58')]=qs[_0x422b('0x48')](_0x2d22e6[_0x422b('0x3e')][_0x422b('0x48')]);_0x3d47bb[_0x422b('0x49')]=qs[_0x422b('0x40')](_[_0x422b('0x59')](_0x2d22e6[_0x422b('0x3e')],_0x1e0162[_0x422b('0x40')]));if(_0x2d22e6[_0x422b('0x3e')][_0x422b('0x4a')]){_0x3d47bb[_0x422b('0x49')]=_['merge'](_0x3d47bb[_0x422b('0x49')],{'$or':_['map'](_0x3d47bb[_0x422b('0x43')],function(_0x88c0ed){var _0x281ab1={};_0x281ab1[_0x88c0ed]={'$like':'%'+_0x2d22e6[_0x422b('0x3e')][_0x422b('0x4a')]+'%'};return _0x281ab1;})});}_0x3d47bb=_['merge']({},_0x3d47bb,_0x2d22e6[_0x422b('0x4d')]);return _0x364398['getDescriptions'](_0x3d47bb);}})[_0x422b('0x33')](function(_0x3a336b){if(_0x3a336b){_0x49431f=_0x3a336b[_0x422b('0x45')];if(!_0x2d22e6[_0x422b('0x3e')][_0x422b('0x46')](_0x422b('0x47'))){_0x3d47bb['limit']=qs[_0x422b('0x2c')](_0x2d22e6[_0x422b('0x3e')]['limit']);_0x3d47bb[_0x422b('0x2b')]=qs['offset'](_0x2d22e6[_0x422b('0x3e')]['offset']);}return _0x364398[_0x422b('0x5d')](_0x3d47bb);}})[_0x422b('0x33')](function(_0x4c2c82){if(_0x4c2c82){return _0x4c2c82?{'count':_0x49431f,'rows':_0x4c2c82}:null;}})[_0x422b('0x33')](respondWithResult(_0x363b40,null))[_0x422b('0x26')](handleError(_0x363b40,null));};exports[_0x422b('0x5e')]=function(_0x1f0e05,_0x458a93,_0x2c8bb9){var _0x506fa8={};var _0x572c88={};var _0x584cf9;var _0x1506e4;return db[_0x422b('0x38')][_0x422b('0x5b')]({'where':{'id':_0x1f0e05[_0x422b('0x51')]['id']}})[_0x422b('0x33')](handleEntityNotFound(_0x458a93,null))[_0x422b('0x33')](function(_0x585cc6){if(_0x585cc6){_0x584cf9=_0x585cc6;_0x572c88['model']=_[_0x422b('0x3f')](db[_0x422b('0x5f')][_0x422b('0x39')]);_0x572c88[_0x422b('0x3e')]=_[_0x422b('0x3f')](_0x1f0e05[_0x422b('0x3e')]);_0x572c88[_0x422b('0x40')]=_[_0x422b('0x41')](_0x572c88[_0x422b('0x42')],_0x572c88[_0x422b('0x3e')]);_0x506fa8[_0x422b('0x43')]=_[_0x422b('0x41')](_0x572c88[_0x422b('0x42')],qs[_0x422b('0x44')](_0x1f0e05['query'][_0x422b('0x44')]));_0x506fa8[_0x422b('0x43')]=_0x506fa8[_0x422b('0x43')]['length']?_0x506fa8[_0x422b('0x43')]:_0x572c88[_0x422b('0x42')];_0x506fa8[_0x422b('0x58')]=qs[_0x422b('0x48')](_0x1f0e05['query'][_0x422b('0x48')]);_0x506fa8['where']=qs['filters'](_['pick'](_0x1f0e05[_0x422b('0x3e')],_0x572c88[_0x422b('0x40')]));if(_0x1f0e05[_0x422b('0x3e')][_0x422b('0x4a')]){_0x506fa8[_0x422b('0x49')]=_[_0x422b('0x4b')](_0x506fa8[_0x422b('0x49')],{'$or':_[_0x422b('0x3d')](_0x506fa8[_0x422b('0x43')],function(_0x66cfcb){var _0x9784da={};_0x9784da[_0x66cfcb]={'$like':'%'+_0x1f0e05['query'][_0x422b('0x4a')]+'%'};return _0x9784da;})});}_0x506fa8=_[_0x422b('0x4b')]({},_0x506fa8,_0x1f0e05['options']);return _0x584cf9[_0x422b('0x5e')](_0x506fa8);}})[_0x422b('0x33')](function(_0x28e935){if(_0x28e935){_0x1506e4=_0x28e935[_0x422b('0x45')];if(!_0x1f0e05['query'][_0x422b('0x46')](_0x422b('0x47'))){_0x506fa8[_0x422b('0x2c')]=qs[_0x422b('0x2c')](_0x1f0e05[_0x422b('0x3e')][_0x422b('0x2c')]);_0x506fa8['offset']=qs[_0x422b('0x2b')](_0x1f0e05[_0x422b('0x3e')][_0x422b('0x2b')]);}return _0x584cf9[_0x422b('0x5e')](_0x506fa8);}})[_0x422b('0x33')](function(_0x290b15){if(_0x290b15){return _0x290b15?{'count':_0x1506e4,'rows':_0x290b15}:null;}})['then'](respondWithResult(_0x458a93,null))['catch'](handleError(_0x458a93,null));};exports['setTags']=function(_0xc3d3ac,_0x5961fb,_0x26b57a){if(_0xc3d3ac[_0x422b('0x54')]['id']){delete _0xc3d3ac[_0x422b('0x54')]['id'];}return db['ZendeskConfiguration'][_0x422b('0x5b')]({'where':{'id':_0xc3d3ac['params']['id']}})[_0x422b('0x33')](handleEntityNotFound(_0x5961fb,null))['then'](function(_0x56449c){if(_0x56449c){return _0x56449c[_0x422b('0x60')](_0xc3d3ac['body'][_0x422b('0x61')]||[]);}return null;})[_0x422b('0x33')](respondWithResult(_0x5961fb,null))[_0x422b('0x26')](handleError(_0x5961fb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 863d204..d78ddfb 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 _0xf5d0=['api','moment','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','util','../../config/logger'];(function(_0x111252,_0x4a7856){var _0x504145=function(_0x1e7bd1){while(--_0x1e7bd1){_0x111252['push'](_0x111252['shift']());}};_0x504145(++_0x4a7856);}(_0xf5d0,0xc4));var _0x0f5d=function(_0x366cde,_0x47b7cf){_0x366cde=_0x366cde-0x0;var _0x4331df=_0xf5d0[_0x366cde];return _0x4331df;};'use strict';var _=require('lodash');var util=require(_0x0f5d('0x0'));var logger=require(_0x0f5d('0x1'))(_0x0f5d('0x2'));var moment=require(_0x0f5d('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f5d('0x4'));var fs=require('fs');var path=require(_0x0f5d('0x5'));var rimraf=require(_0x0f5d('0x6'));var config=require('../../config/environment');var attributes=require(_0x0f5d('0x7'));module[_0x0f5d('0x8')]=function(_0x13e5ef,_0x474b00){return _0x13e5ef[_0x0f5d('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0x0f5d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaad2=['ZendeskConfiguration','int_zendesk_configurations','lodash','moment','path','rimraf','exports','define'];(function(_0x3d1a05,_0x59d24a){var _0x44d517=function(_0x2ccee9){while(--_0x2ccee9){_0x3d1a05['push'](_0x3d1a05['shift']());}};_0x44d517(++_0x59d24a);}(_0xaad2,0x18a));var _0x2aad=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xaad2[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x2aad('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2aad('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2aad('0x2'));var rimraf=require(_0x2aad('0x3'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0x2aad('0x4')]=function(_0x49cf8d,_0x4e8c44){return _0x49cf8d[_0x2aad('0x5')](_0x2aad('0x6'),attributes,{'tableName':_0x2aad('0x7'),'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 b7026bb..a5e2b76 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 _0x417d=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x417d,0xdf));var _0xd417=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x417d[_0x4953da];return _0x2d3780;};'use strict';var _=require(_0xd417('0x0'));var util=require(_0xd417('0x1'));var moment=require(_0xd417('0x2'));var BPromise=require(_0xd417('0x3'));var rs=require(_0xd417('0x4'));var fs=require('fs');var Redis=require(_0xd417('0x5'));var db=require(_0xd417('0x6'))['db'];var utils=require(_0xd417('0x7'));var logger=require(_0xd417('0x8'))(_0xd417('0x9'));var config=require('../../config/environment');var jayson=require(_0xd417('0xa'));var client=jayson[_0xd417('0xb')][_0xd417('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e8eaa,_0x1a90c6,_0x2439b4){return new BPromise(function(_0x51e629,_0xf50acf){return client[_0xd417('0xd')](_0x2e8eaa,_0x2439b4)['then'](function(_0x6674aa){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x1a90c6,'request\x20sent');logger[_0xd417('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1a90c6,'request\x20sent',JSON[_0xd417('0xf')](_0x6674aa));if(_0x6674aa[_0xd417('0x10')]){if(_0x6674aa[_0xd417('0x10')][_0xd417('0x11')]===0x1f4){logger['error'](_0xd417('0x12'),_0x1a90c6,_0x6674aa[_0xd417('0x10')]['message']);return _0xf50acf(_0x6674aa[_0xd417('0x10')][_0xd417('0x13')]);}logger['error'](_0xd417('0x12'),_0x1a90c6,_0x6674aa[_0xd417('0x10')][_0xd417('0x13')]);return _0x51e629(_0x6674aa[_0xd417('0x10')][_0xd417('0x13')]);}else{logger[_0xd417('0x14')](_0xd417('0x12'),_0x1a90c6,_0xd417('0x15'));_0x51e629(_0x6674aa[_0xd417('0x16')]['message']);}})['catch'](function(_0x5d186a){logger[_0xd417('0x10')](_0xd417('0x12'),_0x1a90c6,_0x5d186a);_0xf50acf(_0x5d186a);});});} \ No newline at end of file +var _0xf407=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','ZendeskConfiguration,\x20%s,\x20%s','catch','util','moment'];(function(_0xc2099f,_0x27a4af){var _0x3df993=function(_0x12f597){while(--_0x12f597){_0xc2099f['push'](_0xc2099f['shift']());}};_0x3df993(++_0x27a4af);}(_0xf407,0xd0));var _0x7f40=function(_0x4a7a57,_0x1164a2){_0x4a7a57=_0x4a7a57-0x0;var _0x4717de=_0xf407[_0x4a7a57];return _0x4717de;};'use strict';var _=require('lodash');var util=require(_0x7f40('0x0'));var moment=require(_0x7f40('0x1'));var BPromise=require(_0x7f40('0x2'));var rs=require(_0x7f40('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f40('0x4'))['db'];var utils=require(_0x7f40('0x5'));var logger=require(_0x7f40('0x6'))(_0x7f40('0x7'));var config=require(_0x7f40('0x8'));var jayson=require(_0x7f40('0x9'));var client=jayson[_0x7f40('0xa')][_0x7f40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a6ee6,_0x4548ba,_0x30f153){return new BPromise(function(_0xb3022,_0x1a660b){return client[_0x7f40('0xc')](_0x4a6ee6,_0x30f153)[_0x7f40('0xd')](function(_0x1caadd){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x4548ba,_0x7f40('0xe'));logger[_0x7f40('0xf')](_0x7f40('0x10'),_0x4548ba,_0x7f40('0xe'),JSON['stringify'](_0x1caadd));if(_0x1caadd[_0x7f40('0x11')]){if(_0x1caadd[_0x7f40('0x11')]['code']===0x1f4){logger[_0x7f40('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4548ba,_0x1caadd[_0x7f40('0x11')][_0x7f40('0x12')]);return _0x1a660b(_0x1caadd[_0x7f40('0x11')][_0x7f40('0x12')]);}logger[_0x7f40('0x11')](_0x7f40('0x13'),_0x4548ba,_0x1caadd['error'][_0x7f40('0x12')]);return _0xb3022(_0x1caadd[_0x7f40('0x11')]['message']);}else{logger['info'](_0x7f40('0x13'),_0x4548ba,'request\x20sent');_0xb3022(_0x1caadd['result'][_0x7f40('0x12')]);}})[_0x7f40('0x14')](function(_0x1c8912){logger['error'](_0x7f40('0x13'),_0x4548ba,_0x1c8912);_0x1a660b(_0x1c8912);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index cafb7d2..357e006 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 _0x5296=['destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete'];(function(_0x499c60,_0x30e75e){var _0x41a5f2=function(_0x38aefe){while(--_0x38aefe){_0x499c60['push'](_0x499c60['shift']());}};_0x41a5f2(++_0x30e75e);}(_0x5296,0x17d));var _0x6529=function(_0x321e65,_0x38fc67){_0x321e65=_0x321e65-0x0;var _0xef93a8=_0x5296[_0x321e65];return _0xef93a8;};'use strict';var multer=require(_0x6529('0x0'));var util=require(_0x6529('0x1'));var path=require(_0x6529('0x2'));var timeout=require(_0x6529('0x3'));var express=require(_0x6529('0x4'));var router=express['Router']();var auth=require(_0x6529('0x5'));var interaction=require(_0x6529('0x6'));var config=require(_0x6529('0x7'));var controller=require(_0x6529('0x8'));router[_0x6529('0x9')]('/',auth[_0x6529('0xa')](),controller[_0x6529('0xb')]);router[_0x6529('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6529('0xc')]('/',auth['isAuthenticated'](),controller[_0x6529('0xd')]);router[_0x6529('0xe')](_0x6529('0xf'),auth[_0x6529('0xa')](),controller[_0x6529('0x10')]);router[_0x6529('0x11')](_0x6529('0xf'),auth[_0x6529('0xa')](),controller[_0x6529('0x12')]);module['exports']=router; \ No newline at end of file +var _0xab9e=['/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service','./intZendeskField.controller','get','isAuthenticated','show','post','create'];(function(_0x19485f,_0x4f8d0f){var _0xc4f5d9=function(_0x576169){while(--_0x576169){_0x19485f['push'](_0x19485f['shift']());}};_0xc4f5d9(++_0x4f8d0f);}(_0xab9e,0x6e));var _0xeab9=function(_0x2d40de,_0x3434be){_0x2d40de=_0x2d40de-0x0;var _0x3cb15e=_0xab9e[_0x2d40de];return _0x3cb15e;};'use strict';var multer=require(_0xeab9('0x0'));var util=require(_0xeab9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeab9('0x2'));var router=express['Router']();var auth=require(_0xeab9('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeab9('0x4'));router[_0xeab9('0x5')]('/',auth[_0xeab9('0x6')](),controller['index']);router['get']('/:id',auth[_0xeab9('0x6')](),controller[_0xeab9('0x7')]);router[_0xeab9('0x8')]('/',auth[_0xeab9('0x6')](),controller[_0xeab9('0x9')]);router['put'](_0xeab9('0xa'),auth[_0xeab9('0x6')](),controller[_0xeab9('0xb')]);router[_0xeab9('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xeab9('0xd')]);module[_0xeab9('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6943464..2724424 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 _0x8147=['exports','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8147,0x179));var _0x7814=function(_0x363049,_0x233d74){_0x363049=_0x363049-0x0;var _0x1a0357=_0x8147[_0x363049];return _0x1a0357;};'use strict';var Sequelize=require(_0x7814('0x0'));module[_0x7814('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7814('0x2'),_0x7814('0x3'),_0x7814('0x4'),'keyValue'),'defaultValue':_0x7814('0x2')},'content':{'type':Sequelize[_0x7814('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7814('0x2'),_0x7814('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7814('0x5')]},'nameField':{'type':Sequelize[_0x7814('0x5')]},'customField':{'type':Sequelize[_0x7814('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd449=['ENUM','variable','customVariable','sequelize','string','STRING'];(function(_0x184890,_0x257f1b){var _0x5727d4=function(_0x3b8f9f){while(--_0x3b8f9f){_0x184890['push'](_0x184890['shift']());}};_0x5727d4(++_0x257f1b);}(_0xd449,0x153));var _0x9d44=function(_0x437b02,_0x34b630){_0x437b02=_0x437b02-0x0;var _0xf8c681=_0xd449[_0x437b02];return _0xf8c681;};'use strict';var Sequelize=require(_0x9d44('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue'),'defaultValue':_0x9d44('0x1')},'content':{'type':Sequelize[_0x9d44('0x2')]},'key':{'type':Sequelize[_0x9d44('0x2')]},'keyType':{'type':Sequelize[_0x9d44('0x3')]('string',_0x9d44('0x4'),_0x9d44('0x5'))},'keyContent':{'type':Sequelize[_0x9d44('0x2')]},'idField':{'type':Sequelize[_0x9d44('0x2')]},'nameField':{'type':Sequelize[_0x9d44('0x2')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d44('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 2ca95be..2306473 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 _0x240b=['offset','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','where','pick','filter','VIRTUAL','options','ZendeskField','includeAll','include','findAll','rows','show','params','rawAttributes','length','merge','find','catch','create','body','destroy','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count'];(function(_0x3be5d2,_0x2e9740){var _0x440de1=function(_0x15b672){while(--_0x15b672){_0x3be5d2['push'](_0x3be5d2['shift']());}};_0x440de1(++_0x2e9740);}(_0x240b,0x1a9));var _0xb240=function(_0x1f22d4,_0x2b0d0e){_0x1f22d4=_0x1f22d4-0x0;var _0x4843ee=_0x240b[_0x1f22d4];return _0x4843ee;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb240('0x0'));var jsonpatch=require(_0xb240('0x1'));var rp=require('request-promise');var moment=require(_0xb240('0x2'));var BPromise=require(_0xb240('0x3'));var Mustache=require(_0xb240('0x4'));var util=require(_0xb240('0x5'));var path=require(_0xb240('0x6'));var sox=require(_0xb240('0x7'));var csv=require(_0xb240('0x8'));var ejs=require(_0xb240('0x9'));var fs=require('fs');var _=require(_0xb240('0xa'));var squel=require(_0xb240('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb240('0x8'));var querystring=require(_0xb240('0xc'));var Papa=require(_0xb240('0xd'));var Redis=require('ioredis');var authService=require(_0xb240('0xe'));var qs=require(_0xb240('0xf'));var as=require(_0xb240('0x10'));var hardwareService=require(_0xb240('0x11'));var logger=require(_0xb240('0x12'))(_0xb240('0x13'));var utils=require(_0xb240('0x14'));var config=require(_0xb240('0x15'));var db=require(_0xb240('0x16'))['db'];function respondWithStatusCode(_0x2df03f,_0x25d9b9){_0x25d9b9=_0x25d9b9||0xcc;return function(_0x6b12f6){if(_0x6b12f6){return _0x2df03f['sendStatus'](_0x25d9b9);}return _0x2df03f[_0xb240('0x17')](_0x25d9b9)['end']();};}function respondWithResult(_0x3b26d8,_0x2d9edb){_0x2d9edb=_0x2d9edb||0xc8;return function(_0x64739){if(_0x64739){return _0x3b26d8['status'](_0x2d9edb)['json'](_0x64739);}};}function respondWithFilteredResult(_0x597406,_0x1c39dc){return function(_0x5919a0){if(_0x5919a0){var _0x1c4b4f=_0x5919a0[_0xb240('0x18')],_0x915c7d=_0x1c39dc['offset'],_0x3c6f06=_0x1c39dc[_0xb240('0x19')]+_0x1c39dc['limit'],_0x2b03cb;if(_0x3c6f06>=_0x1c4b4f){_0x3c6f06=_0x1c4b4f;_0x2b03cb=0xc8;}else{_0x2b03cb=0xce;}_0x597406[_0xb240('0x17')](_0x2b03cb);return _0x597406[_0xb240('0x1a')](_0xb240('0x1b'),_0x915c7d+'-'+_0x3c6f06+'/'+_0x1c4b4f)[_0xb240('0x1c')](_0x5919a0);}return null;};}function patchUpdates(_0x3167df){return function(_0x58d015){try{jsonpatch[_0xb240('0x1d')](_0x58d015,_0x3167df,!![]);}catch(_0x6d80aa){return BPromise[_0xb240('0x1e')](_0x6d80aa);}return _0x58d015[_0xb240('0x1f')]();};}function saveUpdates(_0x29fe93,_0x260ca3){return function(_0x5084bf){if(_0x5084bf){return _0x5084bf[_0xb240('0x20')](_0x29fe93)[_0xb240('0x21')](function(_0x480445){return _0x480445;});}return null;};}function removeEntity(_0x38ffbe,_0x18d588){return function(_0x36dce9){if(_0x36dce9){return _0x36dce9['destroy']()[_0xb240('0x21')](function(){_0x38ffbe[_0xb240('0x17')](0xcc)[_0xb240('0x22')]();});}};}function handleEntityNotFound(_0x5e7a17,_0x3887a3){return function(_0x30172d){if(!_0x30172d){_0x5e7a17[_0xb240('0x23')](0x194);}return _0x30172d;};}function handleError(_0x3b8b02,_0x5f170e){_0x5f170e=_0x5f170e||0x1f4;return function(_0x20f296){logger[_0xb240('0x24')](_0x20f296[_0xb240('0x25')]);if(_0x20f296[_0xb240('0x26')]){delete _0x20f296['name'];}_0x3b8b02[_0xb240('0x17')](_0x5f170e)[_0xb240('0x27')](_0x20f296);};}exports[_0xb240('0x28')]=function(_0xe3fdc9,_0x590be1){var _0x42395a={},_0x42f924={},_0x54c1e8={'count':0x0,'rows':[]};var _0x1d62c6=_[_0xb240('0x29')](db['ZendeskField']['rawAttributes'],function(_0x2e29d2){return{'name':_0x2e29d2[_0xb240('0x2a')],'type':_0x2e29d2[_0xb240('0x2b')][_0xb240('0x2c')]};});_0x42f924[_0xb240('0x2d')]=_[_0xb240('0x29')](_0x1d62c6,_0xb240('0x26'));_0x42f924[_0xb240('0x2e')]=_[_0xb240('0x2f')](_0xe3fdc9[_0xb240('0x2e')]);_0x42f924[_0xb240('0x30')]=_[_0xb240('0x31')](_0x42f924[_0xb240('0x2d')],_0x42f924[_0xb240('0x2e')]);_0x42395a[_0xb240('0x32')]=_['intersection'](_0x42f924[_0xb240('0x2d')],qs[_0xb240('0x33')](_0xe3fdc9[_0xb240('0x2e')][_0xb240('0x33')]));_0x42395a[_0xb240('0x32')]=_0x42395a['attributes']['length']?_0x42395a[_0xb240('0x32')]:_0x42f924[_0xb240('0x2d')];if(!_0xe3fdc9[_0xb240('0x2e')][_0xb240('0x34')]('nolimit')){_0x42395a[_0xb240('0x35')]=qs[_0xb240('0x35')](_0xe3fdc9[_0xb240('0x2e')][_0xb240('0x35')]);_0x42395a[_0xb240('0x19')]=qs[_0xb240('0x19')](_0xe3fdc9[_0xb240('0x2e')]['offset']);}_0x42395a[_0xb240('0x36')]=qs['sort'](_0xe3fdc9[_0xb240('0x2e')]['sort']);_0x42395a[_0xb240('0x37')]=qs[_0xb240('0x30')](_[_0xb240('0x38')](_0xe3fdc9[_0xb240('0x2e')],_0x42f924[_0xb240('0x30')]),_0x1d62c6);if(_0xe3fdc9[_0xb240('0x2e')][_0xb240('0x39')]){_0x42395a[_0xb240('0x37')]=_['merge'](_0x42395a[_0xb240('0x37')],{'$or':_[_0xb240('0x29')](_0x1d62c6,function(_0x1b6421){if(_0x1b6421[_0xb240('0x2b')]!==_0xb240('0x3a')){var _0x457dfa={};_0x457dfa[_0x1b6421[_0xb240('0x26')]]={'$like':'%'+_0xe3fdc9[_0xb240('0x2e')][_0xb240('0x39')]+'%'};return _0x457dfa;}})});}_0x42395a=_['merge']({},_0x42395a,_0xe3fdc9[_0xb240('0x3b')]);var _0x2177dc={'where':_0x42395a['where']};return db[_0xb240('0x3c')]['count'](_0x2177dc)['then'](function(_0x5b3523){_0x54c1e8['count']=_0x5b3523;if(_0xe3fdc9['query'][_0xb240('0x3d')]){_0x42395a[_0xb240('0x3e')]=[{'all':!![]}];}return db[_0xb240('0x3c')][_0xb240('0x3f')](_0x42395a);})['then'](function(_0x261cf4){_0x54c1e8[_0xb240('0x40')]=_0x261cf4;return _0x54c1e8;})[_0xb240('0x21')](respondWithFilteredResult(_0x590be1,_0x42395a))['catch'](handleError(_0x590be1,null));};exports[_0xb240('0x41')]=function(_0x75ba34,_0x6995e){var _0x4193b1={'raw':!![],'where':{'id':_0x75ba34[_0xb240('0x42')]['id']}},_0x39f1c9={};_0x39f1c9[_0xb240('0x2d')]=_[_0xb240('0x2f')](db['ZendeskField'][_0xb240('0x43')]);_0x39f1c9[_0xb240('0x2e')]=_[_0xb240('0x2f')](_0x75ba34[_0xb240('0x2e')]);_0x39f1c9[_0xb240('0x30')]=_[_0xb240('0x31')](_0x39f1c9[_0xb240('0x2d')],_0x39f1c9[_0xb240('0x2e')]);_0x4193b1[_0xb240('0x32')]=_[_0xb240('0x31')](_0x39f1c9['model'],qs['fields'](_0x75ba34[_0xb240('0x2e')][_0xb240('0x33')]));_0x4193b1['attributes']=_0x4193b1['attributes'][_0xb240('0x44')]?_0x4193b1[_0xb240('0x32')]:_0x39f1c9[_0xb240('0x2d')];if(_0x75ba34[_0xb240('0x2e')][_0xb240('0x3d')]){_0x4193b1[_0xb240('0x3e')]=[{'all':!![]}];}_0x4193b1=_[_0xb240('0x45')]({},_0x4193b1,_0x75ba34[_0xb240('0x3b')]);return db[_0xb240('0x3c')][_0xb240('0x46')](_0x4193b1)[_0xb240('0x21')](handleEntityNotFound(_0x6995e,null))[_0xb240('0x21')](respondWithResult(_0x6995e,null))[_0xb240('0x47')](handleError(_0x6995e,null));};exports[_0xb240('0x48')]=function(_0x2d7423,_0x1c2eb6){return db[_0xb240('0x3c')][_0xb240('0x48')](_0x2d7423[_0xb240('0x49')],{})[_0xb240('0x21')](respondWithResult(_0x1c2eb6,0xc9))[_0xb240('0x47')](handleError(_0x1c2eb6,null));};exports[_0xb240('0x20')]=function(_0x3e6a9e,_0x15f844){if(_0x3e6a9e[_0xb240('0x49')]['id']){delete _0x3e6a9e[_0xb240('0x49')]['id'];}return db[_0xb240('0x3c')][_0xb240('0x46')]({'where':{'id':_0x3e6a9e['params']['id']}})['then'](handleEntityNotFound(_0x15f844,null))['then'](saveUpdates(_0x3e6a9e['body'],null))[_0xb240('0x21')](respondWithResult(_0x15f844,null))[_0xb240('0x47')](handleError(_0x15f844,null));};exports[_0xb240('0x4a')]=function(_0xde2332,_0x3f48bc){return db[_0xb240('0x3c')][_0xb240('0x46')]({'where':{'id':_0xde2332[_0xb240('0x42')]['id']}})[_0xb240('0x21')](handleEntityNotFound(_0x3f48bc,null))[_0xb240('0x21')](removeEntity(_0x3f48bc,null))[_0xb240('0x47')](handleError(_0x3f48bc,null));}; \ No newline at end of file +var _0x98ef=['filter','options','includeAll','params','ZendeskField','include','merge','find','catch','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../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','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x98ef,0x1b6));var _0xf98e=function(_0x542a89,_0x2e4b8a){_0x542a89=_0x542a89-0x0;var _0x267439=_0x98ef[_0x542a89];return _0x267439;};'use strict';var pdf=require(_0xf98e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf98e('0x1'));var zipdir=require(_0xf98e('0x2'));var jsonpatch=require(_0xf98e('0x3'));var rp=require(_0xf98e('0x4'));var moment=require(_0xf98e('0x5'));var BPromise=require(_0xf98e('0x6'));var Mustache=require(_0xf98e('0x7'));var util=require(_0xf98e('0x8'));var path=require('path');var sox=require(_0xf98e('0x9'));var csv=require('to-csv');var ejs=require(_0xf98e('0xa'));var fs=require('fs');var _=require(_0xf98e('0xb'));var squel=require('squel');var crypto=require(_0xf98e('0xc'));var jsforce=require(_0xf98e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf98e('0xe'));var querystring=require(_0xf98e('0xf'));var Papa=require(_0xf98e('0x10'));var Redis=require('ioredis');var authService=require(_0xf98e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf98e('0x12'));var logger=require(_0xf98e('0x13'))(_0xf98e('0x14'));var utils=require(_0xf98e('0x15'));var config=require(_0xf98e('0x16'));var db=require(_0xf98e('0x17'))['db'];function respondWithStatusCode(_0x22671f,_0x496fec){_0x496fec=_0x496fec||0xcc;return function(_0x3c513e){if(_0x3c513e){return _0x22671f[_0xf98e('0x18')](_0x496fec);}return _0x22671f[_0xf98e('0x19')](_0x496fec)[_0xf98e('0x1a')]();};}function respondWithResult(_0x20c457,_0x222ac5){_0x222ac5=_0x222ac5||0xc8;return function(_0x2440e5){if(_0x2440e5){return _0x20c457[_0xf98e('0x19')](_0x222ac5)[_0xf98e('0x1b')](_0x2440e5);}};}function respondWithFilteredResult(_0x1aecc3,_0x3ba602){return function(_0x2bc476){if(_0x2bc476){var _0x73d19a=_0x2bc476[_0xf98e('0x1c')],_0x2ac005=_0x3ba602[_0xf98e('0x1d')],_0x1ee871=_0x3ba602[_0xf98e('0x1d')]+_0x3ba602[_0xf98e('0x1e')],_0x36a8ea;if(_0x1ee871>=_0x73d19a){_0x1ee871=_0x73d19a;_0x36a8ea=0xc8;}else{_0x36a8ea=0xce;}_0x1aecc3[_0xf98e('0x19')](_0x36a8ea);return _0x1aecc3[_0xf98e('0x1f')](_0xf98e('0x20'),_0x2ac005+'-'+_0x1ee871+'/'+_0x73d19a)[_0xf98e('0x1b')](_0x2bc476);}return null;};}function patchUpdates(_0x59a543){return function(_0x78ce5e){try{jsonpatch[_0xf98e('0x21')](_0x78ce5e,_0x59a543,!![]);}catch(_0x2b577f){return BPromise[_0xf98e('0x22')](_0x2b577f);}return _0x78ce5e['save']();};}function saveUpdates(_0x4c99b0,_0x1a9703){return function(_0x166013){if(_0x166013){return _0x166013['update'](_0x4c99b0)[_0xf98e('0x23')](function(_0x19d192){return _0x19d192;});}return null;};}function removeEntity(_0x3231c9,_0x1c5097){return function(_0x2164ed){if(_0x2164ed){return _0x2164ed[_0xf98e('0x24')]()[_0xf98e('0x23')](function(){_0x3231c9['status'](0xcc)[_0xf98e('0x1a')]();});}};}function handleEntityNotFound(_0x39ed3d,_0x47b1c4){return function(_0x12373a){if(!_0x12373a){_0x39ed3d[_0xf98e('0x18')](0x194);}return _0x12373a;};}function handleError(_0x7afe55,_0x274b6e){_0x274b6e=_0x274b6e||0x1f4;return function(_0x2c3833){logger['error'](_0x2c3833[_0xf98e('0x25')]);if(_0x2c3833[_0xf98e('0x26')]){delete _0x2c3833['name'];}_0x7afe55[_0xf98e('0x19')](_0x274b6e)[_0xf98e('0x27')](_0x2c3833);};}exports['index']=function(_0x4a7dcc,_0x2a6ed9){var _0xb727ac={},_0x12788c={},_0x9e458f={'count':0x0,'rows':[]};var _0xe5741a=_[_0xf98e('0x28')](db['ZendeskField'][_0xf98e('0x29')],function(_0x462a16){return{'name':_0x462a16['fieldName'],'type':_0x462a16[_0xf98e('0x2a')][_0xf98e('0x2b')]};});_0x12788c[_0xf98e('0x2c')]=_[_0xf98e('0x28')](_0xe5741a,'name');_0x12788c['query']=_[_0xf98e('0x2d')](_0x4a7dcc[_0xf98e('0x2e')]);_0x12788c[_0xf98e('0x2f')]=_[_0xf98e('0x30')](_0x12788c[_0xf98e('0x2c')],_0x12788c[_0xf98e('0x2e')]);_0xb727ac[_0xf98e('0x31')]=_[_0xf98e('0x30')](_0x12788c['model'],qs[_0xf98e('0x32')](_0x4a7dcc['query'][_0xf98e('0x32')]));_0xb727ac[_0xf98e('0x31')]=_0xb727ac[_0xf98e('0x31')][_0xf98e('0x33')]?_0xb727ac['attributes']:_0x12788c[_0xf98e('0x2c')];if(!_0x4a7dcc[_0xf98e('0x2e')][_0xf98e('0x34')](_0xf98e('0x35'))){_0xb727ac[_0xf98e('0x1e')]=qs['limit'](_0x4a7dcc[_0xf98e('0x2e')]['limit']);_0xb727ac[_0xf98e('0x1d')]=qs[_0xf98e('0x1d')](_0x4a7dcc[_0xf98e('0x2e')][_0xf98e('0x1d')]);}_0xb727ac[_0xf98e('0x36')]=qs[_0xf98e('0x37')](_0x4a7dcc[_0xf98e('0x2e')][_0xf98e('0x37')]);_0xb727ac[_0xf98e('0x38')]=qs[_0xf98e('0x2f')](_[_0xf98e('0x39')](_0x4a7dcc[_0xf98e('0x2e')],_0x12788c[_0xf98e('0x2f')]),_0xe5741a);if(_0x4a7dcc[_0xf98e('0x2e')]['filter']){_0xb727ac[_0xf98e('0x38')]=_['merge'](_0xb727ac[_0xf98e('0x38')],{'$or':_[_0xf98e('0x28')](_0xe5741a,function(_0x2de666){if(_0x2de666[_0xf98e('0x2a')]!==_0xf98e('0x3a')){var _0x4f9a33={};_0x4f9a33[_0x2de666[_0xf98e('0x26')]]={'$like':'%'+_0x4a7dcc[_0xf98e('0x2e')][_0xf98e('0x3b')]+'%'};return _0x4f9a33;}})});}_0xb727ac=_['merge']({},_0xb727ac,_0x4a7dcc[_0xf98e('0x3c')]);var _0x11a4b7={'where':_0xb727ac['where']};return db['ZendeskField']['count'](_0x11a4b7)[_0xf98e('0x23')](function(_0x59ee7f){_0x9e458f[_0xf98e('0x1c')]=_0x59ee7f;if(_0x4a7dcc[_0xf98e('0x2e')][_0xf98e('0x3d')]){_0xb727ac['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0xb727ac);})[_0xf98e('0x23')](function(_0x41c14f){_0x9e458f['rows']=_0x41c14f;return _0x9e458f;})['then'](respondWithFilteredResult(_0x2a6ed9,_0xb727ac))['catch'](handleError(_0x2a6ed9,null));};exports['show']=function(_0x4eb7ee,_0x4e2dc8){var _0xcf866d={'raw':!![],'where':{'id':_0x4eb7ee[_0xf98e('0x3e')]['id']}},_0x381f0e={};_0x381f0e['model']=_[_0xf98e('0x2d')](db[_0xf98e('0x3f')][_0xf98e('0x29')]);_0x381f0e[_0xf98e('0x2e')]=_[_0xf98e('0x2d')](_0x4eb7ee[_0xf98e('0x2e')]);_0x381f0e['filters']=_['intersection'](_0x381f0e[_0xf98e('0x2c')],_0x381f0e[_0xf98e('0x2e')]);_0xcf866d[_0xf98e('0x31')]=_[_0xf98e('0x30')](_0x381f0e[_0xf98e('0x2c')],qs[_0xf98e('0x32')](_0x4eb7ee[_0xf98e('0x2e')]['fields']));_0xcf866d[_0xf98e('0x31')]=_0xcf866d[_0xf98e('0x31')][_0xf98e('0x33')]?_0xcf866d[_0xf98e('0x31')]:_0x381f0e[_0xf98e('0x2c')];if(_0x4eb7ee[_0xf98e('0x2e')][_0xf98e('0x3d')]){_0xcf866d[_0xf98e('0x40')]=[{'all':!![]}];}_0xcf866d=_[_0xf98e('0x41')]({},_0xcf866d,_0x4eb7ee[_0xf98e('0x3c')]);return db['ZendeskField'][_0xf98e('0x42')](_0xcf866d)[_0xf98e('0x23')](handleEntityNotFound(_0x4e2dc8,null))[_0xf98e('0x23')](respondWithResult(_0x4e2dc8,null))[_0xf98e('0x43')](handleError(_0x4e2dc8,null));};exports[_0xf98e('0x44')]=function(_0x2b3c65,_0x11efcb){return db[_0xf98e('0x3f')][_0xf98e('0x44')](_0x2b3c65[_0xf98e('0x45')],{})[_0xf98e('0x23')](respondWithResult(_0x11efcb,0xc9))[_0xf98e('0x43')](handleError(_0x11efcb,null));};exports[_0xf98e('0x46')]=function(_0x5b6cad,_0x502280){if(_0x5b6cad[_0xf98e('0x45')]['id']){delete _0x5b6cad[_0xf98e('0x45')]['id'];}return db[_0xf98e('0x3f')][_0xf98e('0x42')]({'where':{'id':_0x5b6cad[_0xf98e('0x3e')]['id']}})[_0xf98e('0x23')](handleEntityNotFound(_0x502280,null))[_0xf98e('0x23')](saveUpdates(_0x5b6cad['body'],null))[_0xf98e('0x23')](respondWithResult(_0x502280,null))[_0xf98e('0x43')](handleError(_0x502280,null));};exports[_0xf98e('0x24')]=function(_0x151961,_0x3c979f){return db[_0xf98e('0x3f')][_0xf98e('0x42')]({'where':{'id':_0x151961[_0xf98e('0x3e')]['id']}})[_0xf98e('0x23')](handleEntityNotFound(_0x3c979f,null))['then'](removeEntity(_0x3c979f,null))[_0xf98e('0x43')](handleError(_0x3c979f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c8c2cc9..54220ae 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 _0x9ffd=['ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','define'];(function(_0x5a0d48,_0x3b8a2b){var _0x5852ac=function(_0x35b4c6){while(--_0x35b4c6){_0x5a0d48['push'](_0x5a0d48['shift']());}};_0x5852ac(++_0x3b8a2b);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x159f1f,_0xc8e8b1){_0x159f1f=_0x159f1f-0x0;var _0x187d7d=_0x9ffd[_0x159f1f];return _0x187d7d;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('0xb'),'paranoid':![],'indexes':[{'name':_0xd9ff('0xc'),'fields':[_0xd9ff('0xd'),_0xd9ff('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1752=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1752,0xa5));var _0x2175=function(_0x22fb7a,_0xc5e0c7){_0x22fb7a=_0x22fb7a-0x0;var _0x1049d1=_0x1752[_0x22fb7a];return _0x1049d1;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var logger=require(_0x2175('0x1'))(_0x2175('0x2'));var moment=require(_0x2175('0x3'));var BPromise=require(_0x2175('0x4'));var rp=require(_0x2175('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2175('0x6'));var config=require(_0x2175('0x7'));var attributes=require(_0x2175('0x8'));module[_0x2175('0x9')]=function(_0x222868,_0x27ff0b){return _0x222868[_0x2175('0xa')](_0x2175('0xb'),attributes,{'tableName':_0x2175('0xc'),'paranoid':![],'indexes':[{'name':_0x2175('0xd'),'fields':['idField',_0x2175('0xe')],'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 d9ae2c9..aafa576 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 _0x9828=['rpc','../../config/environment','jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4569d7,_0x56e87f){var _0x37bc44=function(_0x38943b){while(--_0x38943b){_0x4569d7['push'](_0x4569d7['shift']());}};_0x37bc44(++_0x56e87f);}(_0x9828,0x1c4));var _0x8982=function(_0x406a37,_0x10c6ab){_0x406a37=_0x406a37-0x0;var _0xc09724=_0x9828[_0x406a37];return _0xc09724;};'use strict';var _=require('lodash');var util=require(_0x8982('0x0'));var moment=require(_0x8982('0x1'));var BPromise=require(_0x8982('0x2'));var rs=require(_0x8982('0x3'));var fs=require('fs');var Redis=require(_0x8982('0x4'));var db=require(_0x8982('0x5'))['db'];var utils=require(_0x8982('0x6'));var logger=require(_0x8982('0x7'))(_0x8982('0x8'));var config=require(_0x8982('0x9'));var jayson=require(_0x8982('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x434e80,_0x32c797,_0x46d705){return new BPromise(function(_0x34105d,_0x162959){return client[_0x8982('0xb')](_0x434e80,_0x46d705)[_0x8982('0xc')](function(_0x3c7439){logger[_0x8982('0xd')](_0x8982('0xe'),_0x32c797,_0x8982('0xf'));logger['debug'](_0x8982('0x10'),_0x32c797,_0x8982('0xf'),JSON[_0x8982('0x11')](_0x3c7439));if(_0x3c7439[_0x8982('0x12')]){if(_0x3c7439[_0x8982('0x12')][_0x8982('0x13')]===0x1f4){logger[_0x8982('0x12')](_0x8982('0xe'),_0x32c797,_0x3c7439[_0x8982('0x12')][_0x8982('0x14')]);return _0x162959(_0x3c7439[_0x8982('0x12')][_0x8982('0x14')]);}logger[_0x8982('0x12')](_0x8982('0xe'),_0x32c797,_0x3c7439['error']['message']);return _0x34105d(_0x3c7439[_0x8982('0x12')][_0x8982('0x14')]);}else{logger['info'](_0x8982('0xe'),_0x32c797,_0x8982('0xf'));_0x34105d(_0x3c7439[_0x8982('0x15')]['message']);}})[_0x8982('0x16')](function(_0x4890ff){logger[_0x8982('0x12')](_0x8982('0xe'),_0x32c797,_0x4890ff);_0x162959(_0x4890ff);});});} \ No newline at end of file +var _0xd0ec=['then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x231103,_0x57b8c0){var _0x3c4718=function(_0x51411c){while(--_0x51411c){_0x231103['push'](_0x231103['shift']());}};_0x3c4718(++_0x57b8c0);}(_0xd0ec,0x14d));var _0xcd0e=function(_0x4cc5be,_0x428734){_0x4cc5be=_0x4cc5be-0x0;var _0x543e21=_0xd0ec[_0x4cc5be];return _0x543e21;};'use strict';var _=require(_0xcd0e('0x0'));var util=require(_0xcd0e('0x1'));var moment=require(_0xcd0e('0x2'));var BPromise=require(_0xcd0e('0x3'));var rs=require(_0xcd0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd0e('0x5'))(_0xcd0e('0x6'));var config=require(_0xcd0e('0x7'));var jayson=require(_0xcd0e('0x8'));var client=jayson[_0xcd0e('0x9')][_0xcd0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x477854,_0x47753b,_0x39d5c3){return new BPromise(function(_0xfd2989,_0x4829af){return client[_0xcd0e('0xb')](_0x477854,_0x39d5c3)[_0xcd0e('0xc')](function(_0x2812b8){logger[_0xcd0e('0xd')](_0xcd0e('0xe'),_0x47753b,_0xcd0e('0xf'));logger['debug'](_0xcd0e('0x10'),_0x47753b,_0xcd0e('0xf'),JSON[_0xcd0e('0x11')](_0x2812b8));if(_0x2812b8['error']){if(_0x2812b8[_0xcd0e('0x12')][_0xcd0e('0x13')]===0x1f4){logger[_0xcd0e('0x12')](_0xcd0e('0xe'),_0x47753b,_0x2812b8[_0xcd0e('0x12')][_0xcd0e('0x14')]);return _0x4829af(_0x2812b8[_0xcd0e('0x12')][_0xcd0e('0x14')]);}logger[_0xcd0e('0x12')]('ZendeskField,\x20%s,\x20%s',_0x47753b,_0x2812b8[_0xcd0e('0x12')][_0xcd0e('0x14')]);return _0xfd2989(_0x2812b8['error'][_0xcd0e('0x14')]);}else{logger[_0xcd0e('0xd')](_0xcd0e('0xe'),_0x47753b,_0xcd0e('0xf'));_0xfd2989(_0x2812b8[_0xcd0e('0x15')][_0xcd0e('0x14')]);}})[_0xcd0e('0x16')](function(_0x178488){logger['error'](_0xcd0e('0xe'),_0x47753b,_0x178488);_0x4829af(_0x178488);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 80ff60a..281da3f 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 _0x8c78=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./intZohoAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x8c78,0xda));var _0x88c7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8c78[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x88c7('0x0'));var path=require(_0x88c7('0x1'));var timeout=require(_0x88c7('0x2'));var express=require(_0x88c7('0x3'));var router=express[_0x88c7('0x4')]();var auth=require(_0x88c7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x88c7('0x6'));router[_0x88c7('0x7')]('/',auth['isAuthenticated'](),controller[_0x88c7('0x8')]);router[_0x88c7('0x7')](_0x88c7('0x9'),auth[_0x88c7('0xa')](),controller[_0x88c7('0xb')]);router[_0x88c7('0x7')](_0x88c7('0xc'),auth[_0x88c7('0xa')](),controller[_0x88c7('0xd')]);router[_0x88c7('0x7')](_0x88c7('0xe'),auth[_0x88c7('0xa')](),controller[_0x88c7('0xf')]);router[_0x88c7('0x10')]('/',auth[_0x88c7('0xa')](),controller[_0x88c7('0x11')]);router[_0x88c7('0x10')]('/:id/configurations',auth[_0x88c7('0xa')](),controller[_0x88c7('0x12')]);router[_0x88c7('0x13')](_0x88c7('0x9'),auth[_0x88c7('0xa')](),controller[_0x88c7('0x14')]);router[_0x88c7('0x15')](_0x88c7('0x9'),auth['isAuthenticated'](),controller[_0x88c7('0x16')]);module[_0x88c7('0x17')]=router; \ No newline at end of file +var _0x4763=['/:id/fields','post','create','addConfiguration','put','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','getConfigurations'];(function(_0xd93e8f,_0x23363f){var _0x505025=function(_0x5ce1b1){while(--_0x5ce1b1){_0xd93e8f['push'](_0xd93e8f['shift']());}};_0x505025(++_0x23363f);}(_0x4763,0x16f));var _0x3476=function(_0x206477,_0x81c2be){_0x206477=_0x206477-0x0;var _0x3a0992=_0x4763[_0x206477];return _0x3a0992;};'use strict';var multer=require('multer');var util=require(_0x3476('0x0'));var path=require(_0x3476('0x1'));var timeout=require(_0x3476('0x2'));var express=require(_0x3476('0x3'));var router=express[_0x3476('0x4')]();var auth=require(_0x3476('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3476('0x6'));var controller=require(_0x3476('0x7'));router[_0x3476('0x8')]('/',auth[_0x3476('0x9')](),controller['index']);router[_0x3476('0x8')]('/:id',auth[_0x3476('0x9')](),controller['show']);router[_0x3476('0x8')]('/:id/configurations',auth[_0x3476('0x9')](),controller[_0x3476('0xa')]);router[_0x3476('0x8')](_0x3476('0xb'),auth[_0x3476('0x9')](),controller['getFields']);router[_0x3476('0xc')]('/',auth[_0x3476('0x9')](),controller[_0x3476('0xd')]);router[_0x3476('0xc')]('/:id/configurations',auth[_0x3476('0x9')](),controller[_0x3476('0xe')]);router[_0x3476('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3476('0x10'),auth[_0x3476('0x9')](),controller['destroy']);module[_0x3476('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ad4d5b5..1b57953 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 _0x9acd=['exports','STRING','sequelize'];(function(_0x2103fa,_0xe60333){var _0x4c135e=function(_0x414567){while(--_0x414567){_0x2103fa['push'](_0x2103fa['shift']());}};_0x4c135e(++_0xe60333);}(_0x9acd,0xb9));var _0xd9ac=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9acd[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0xd9ac('0x0'));module[_0xd9ac('0x1')]={'name':{'type':Sequelize[_0xd9ac('0x2')]},'description':{'type':Sequelize[_0xd9ac('0x2')]},'host':{'type':Sequelize[_0xd9ac('0x2')]},'zone':{'type':Sequelize[_0xd9ac('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xd9ac('0x2')]},'serverUrl':{'type':Sequelize[_0xd9ac('0x2')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4fcd=['STRING','sequelize','exports'];(function(_0x131d0a,_0x14523d){var _0x1bdb23=function(_0x1ac99f){while(--_0x1ac99f){_0x131d0a['push'](_0x131d0a['shift']());}};_0x1bdb23(++_0x14523d);}(_0x4fcd,0xc1));var _0xd4fc=function(_0x2613ae,_0x182ecd){_0x2613ae=_0x2613ae-0x0;var _0x36c1fe=_0x4fcd[_0x2613ae];return _0x36c1fe;};'use strict';var Sequelize=require(_0xd4fc('0x0'));module[_0xd4fc('0x1')]={'name':{'type':Sequelize[_0xd4fc('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xd4fc('0x2')]},'zone':{'type':Sequelize[_0xd4fc('0x2')]},'clientId':{'type':Sequelize[_0xd4fc('0x2')]},'clientSecret':{'type':Sequelize[_0xd4fc('0x2')]},'serverUrl':{'type':Sequelize[_0xd4fc('0x2')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xd4fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 109fcbe..8050db9 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 _0xe6d5=['../../config/license/hardware','api','../../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','request\x20sent','debug','stringify','error','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','destroy','stack','name','send','map','ZohoAccount','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','params','rawAttributes','intersection','create','body','update','find','getConfigurations','findOne','ZohoConfiguration','order','length','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','code','zoho.eu','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5de5df,_0x4cb0da){var _0x1f0f8b=function(_0x1a7acd){while(--_0x1a7acd){_0x5de5df['push'](_0x5de5df['shift']());}};_0x1f0f8b(++_0x4cb0da);}(_0xe6d5,0x18a));var _0x5e6d=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xe6d5[_0x46f1a6];return _0x38429a;};'use strict';var pdf=require(_0x5e6d('0x0'));var emlformat=require(_0x5e6d('0x1'));var rimraf=require(_0x5e6d('0x2'));var zipdir=require(_0x5e6d('0x3'));var jsonpatch=require(_0x5e6d('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5e6d('0x5'));var Mustache=require(_0x5e6d('0x6'));var util=require(_0x5e6d('0x7'));var path=require(_0x5e6d('0x8'));var sox=require('sox');var csv=require(_0x5e6d('0x9'));var ejs=require(_0x5e6d('0xa'));var fs=require('fs');var _=require(_0x5e6d('0xb'));var squel=require(_0x5e6d('0xc'));var crypto=require(_0x5e6d('0xd'));var jsforce=require(_0x5e6d('0xe'));var deskjs=require(_0x5e6d('0xf'));var toCsv=require(_0x5e6d('0x9'));var querystring=require(_0x5e6d('0x10'));var Papa=require('papaparse');var Redis=require(_0x5e6d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5e6d('0x12'));var as=require(_0x5e6d('0x13'));var hardwareService=require(_0x5e6d('0x14'));var logger=require('../../config/logger')(_0x5e6d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x5e6d('0x16'));var jayson=require(_0x5e6d('0x17'));var client=jayson[_0x5e6d('0x18')][_0x5e6d('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5df682,_0x4d7c23,_0x7ce45d){if(_0x7ce45d){var _0x46b9f7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x46b9f7[_0x5e6d('0x1a')](_0x4d7c23)){return _0x5df682;}else{throw new db[(_0x5e6d('0x1b'))][(_0x5e6d('0x1c'))](_0x5e6d('0x1d'));}}else{return _0x5df682;}}function respondWithRpcPromise(_0x530f4c,_0x242069,_0x3b54f6,_0x38c443){return new BPromise(function(_0xb492b8,_0x288f4d){var _0x314a8e=_0x38c443||client;return _0x314a8e[_0x5e6d('0x1e')](_0x530f4c,_0x3b54f6)[_0x5e6d('0x1f')](function(_0x3c9330){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x242069,_0x5e6d('0x20'));logger[_0x5e6d('0x21')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x242069,_0x5e6d('0x20'),JSON[_0x5e6d('0x22')](_0x3c9330));if(_0x3c9330[_0x5e6d('0x23')]){if(_0x3c9330[_0x5e6d('0x23')]['code']===0x1f4){logger[_0x5e6d('0x23')](_0x5e6d('0x24'),_0x242069,_0x3c9330['error'][_0x5e6d('0x25')]);return _0x288f4d(_0x3c9330[_0x5e6d('0x23')][_0x5e6d('0x25')]);}logger['error'](_0x5e6d('0x24'),_0x242069,_0x3c9330[_0x5e6d('0x23')][_0x5e6d('0x25')]);return _0xb492b8(_0x3c9330[_0x5e6d('0x23')]['message']);}else{logger[_0x5e6d('0x26')]('ZohoAccount,\x20%s,\x20%s',_0x242069,_0x5e6d('0x20'));_0xb492b8(_0x3c9330[_0x5e6d('0x27')]['message']);}})[_0x5e6d('0x28')](function(_0x4c7ff8){logger[_0x5e6d('0x23')](_0x5e6d('0x24'),_0x242069,_0x4c7ff8);_0x288f4d(_0x4c7ff8);});});}function respondWithStatusCode(_0x18c460,_0x1217d3){_0x1217d3=_0x1217d3||0xcc;return function(_0x41ad70){if(_0x41ad70){return _0x18c460[_0x5e6d('0x29')](_0x1217d3);}return _0x18c460[_0x5e6d('0x2a')](_0x1217d3)['end']();};}function respondWithResult(_0x144d59,_0x2ed5be){_0x2ed5be=_0x2ed5be||0xc8;return function(_0x5b4a00){if(_0x5b4a00){return _0x144d59[_0x5e6d('0x2a')](_0x2ed5be)[_0x5e6d('0x2b')](_0x5b4a00);}};}function respondWithFilteredResult(_0x350849,_0x3fc083){return function(_0x24a4f6){if(_0x24a4f6){var _0x2a4e67=_0x24a4f6[_0x5e6d('0x2c')],_0x5b662f=_0x3fc083[_0x5e6d('0x2d')],_0x859dec=_0x3fc083[_0x5e6d('0x2d')]+_0x3fc083[_0x5e6d('0x2e')],_0x1beb9b;if(_0x859dec>=_0x2a4e67){_0x859dec=_0x2a4e67;_0x1beb9b=0xc8;}else{_0x1beb9b=0xce;}_0x350849[_0x5e6d('0x2a')](_0x1beb9b);return _0x350849[_0x5e6d('0x2f')](_0x5e6d('0x30'),_0x5b662f+'-'+_0x859dec+'/'+_0x2a4e67)[_0x5e6d('0x2b')](_0x24a4f6);}return null;};}function patchUpdates(_0x3cd3c6){return function(_0x4f4f77){try{jsonpatch[_0x5e6d('0x31')](_0x4f4f77,_0x3cd3c6,!![]);}catch(_0x3f77a3){return BPromise['reject'](_0x3f77a3);}return _0x4f4f77['save']();};}function saveUpdates(_0x57e0b6,_0x36c67e){return function(_0x22a899){if(_0x22a899){return _0x22a899['update'](_0x57e0b6)[_0x5e6d('0x1f')](function(_0x4fd9b4){return _0x4fd9b4;});}return null;};}function removeEntity(_0x31ba74,_0x165e9e){return function(_0x9af096){if(_0x9af096){return _0x9af096[_0x5e6d('0x32')]()[_0x5e6d('0x1f')](function(){_0x31ba74['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa2a283,_0x2735d9){return function(_0x25973e){if(!_0x25973e){_0xa2a283[_0x5e6d('0x29')](0x194);}return _0x25973e;};}function handleError(_0xdbe73c,_0x4f134e){_0x4f134e=_0x4f134e||0x1f4;return function(_0x57d9b3){logger[_0x5e6d('0x23')](_0x57d9b3[_0x5e6d('0x33')]);if(_0x57d9b3[_0x5e6d('0x34')]){delete _0x57d9b3['name'];}_0xdbe73c[_0x5e6d('0x2a')](_0x4f134e)[_0x5e6d('0x35')](_0x57d9b3);};}exports['index']=function(_0x4da82f,_0x1e9a51){var _0x30f7f8={},_0xc00775={},_0x335baf={'count':0x0,'rows':[]};var _0x9c419a=_[_0x5e6d('0x36')](db[_0x5e6d('0x37')]['rawAttributes'],function(_0x29617a){return{'name':_0x29617a[_0x5e6d('0x38')],'type':_0x29617a[_0x5e6d('0x39')][_0x5e6d('0x3a')]};});_0xc00775[_0x5e6d('0x3b')]=_[_0x5e6d('0x36')](_0x9c419a,'name');_0xc00775[_0x5e6d('0x3c')]=_[_0x5e6d('0x3d')](_0x4da82f['query']);_0xc00775[_0x5e6d('0x3e')]=_['intersection'](_0xc00775['model'],_0xc00775['query']);_0x30f7f8[_0x5e6d('0x3f')]=_['intersection'](_0xc00775[_0x5e6d('0x3b')],qs['fields'](_0x4da82f[_0x5e6d('0x3c')][_0x5e6d('0x40')]));_0x30f7f8[_0x5e6d('0x3f')]=_0x30f7f8[_0x5e6d('0x3f')]['length']?_0x30f7f8[_0x5e6d('0x3f')]:_0xc00775[_0x5e6d('0x3b')];if(!_0x4da82f[_0x5e6d('0x3c')][_0x5e6d('0x41')](_0x5e6d('0x42'))){_0x30f7f8[_0x5e6d('0x2e')]=qs['limit'](_0x4da82f[_0x5e6d('0x3c')]['limit']);_0x30f7f8['offset']=qs['offset'](_0x4da82f[_0x5e6d('0x3c')]['offset']);}_0x30f7f8['order']=qs['sort'](_0x4da82f[_0x5e6d('0x3c')][_0x5e6d('0x43')]);_0x30f7f8[_0x5e6d('0x44')]=qs['filters'](_[_0x5e6d('0x45')](_0x4da82f['query'],_0xc00775[_0x5e6d('0x3e')]),_0x9c419a);if(_0x4da82f[_0x5e6d('0x3c')]['filter']){_0x30f7f8[_0x5e6d('0x44')]=_[_0x5e6d('0x46')](_0x30f7f8[_0x5e6d('0x44')],{'$or':_[_0x5e6d('0x36')](_0x9c419a,function(_0x4bef1e){if(_0x4bef1e['type']!=='VIRTUAL'){var _0x3ff2f6={};_0x3ff2f6[_0x4bef1e[_0x5e6d('0x34')]]={'$like':'%'+_0x4da82f[_0x5e6d('0x3c')][_0x5e6d('0x47')]+'%'};return _0x3ff2f6;}})});}_0x30f7f8=_['merge']({},_0x30f7f8,_0x4da82f[_0x5e6d('0x48')]);var _0x22bc43={'where':_0x30f7f8['where']};return db[_0x5e6d('0x37')]['count'](_0x22bc43)[_0x5e6d('0x1f')](function(_0x58d666){_0x335baf[_0x5e6d('0x2c')]=_0x58d666;if(_0x4da82f['query'][_0x5e6d('0x49')]){_0x30f7f8[_0x5e6d('0x4a')]=[{'all':!![]}];}return db[_0x5e6d('0x37')][_0x5e6d('0x4b')](_0x30f7f8);})['then'](function(_0x2fb7bb){_0x335baf[_0x5e6d('0x4c')]=_0x2fb7bb;return _0x335baf;})[_0x5e6d('0x1f')](respondWithFilteredResult(_0x1e9a51,_0x30f7f8))[_0x5e6d('0x28')](handleError(_0x1e9a51,null));};exports['show']=function(_0x105921,_0x71867c){var _0x1124ad={'raw':![],'where':{'id':_0x105921[_0x5e6d('0x4d')]['id']}},_0x275ef1={};_0x275ef1[_0x5e6d('0x3b')]=_['keys'](db[_0x5e6d('0x37')][_0x5e6d('0x4e')]);_0x275ef1[_0x5e6d('0x3c')]=_['keys'](_0x105921[_0x5e6d('0x3c')]);_0x275ef1[_0x5e6d('0x3e')]=_[_0x5e6d('0x4f')](_0x275ef1['model'],_0x275ef1['query']);_0x1124ad['attributes']=_[_0x5e6d('0x4f')](_0x275ef1[_0x5e6d('0x3b')],qs['fields'](_0x105921[_0x5e6d('0x3c')][_0x5e6d('0x40')]));_0x1124ad[_0x5e6d('0x3f')]=_0x1124ad['attributes']['length']?_0x1124ad[_0x5e6d('0x3f')]:_0x275ef1[_0x5e6d('0x3b')];if(_0x105921[_0x5e6d('0x3c')][_0x5e6d('0x49')]){_0x1124ad[_0x5e6d('0x4a')]=[{'all':!![]}];}_0x1124ad=_[_0x5e6d('0x46')]({},_0x1124ad,_0x105921[_0x5e6d('0x48')]);return db[_0x5e6d('0x37')]['find'](_0x1124ad)['then'](handleEntityNotFound(_0x71867c,null))[_0x5e6d('0x1f')](respondWithResult(_0x71867c,null))['catch'](handleError(_0x71867c,null));};exports[_0x5e6d('0x50')]=function(_0x41aa33,_0x5ba45){return db['ZohoAccount'][_0x5e6d('0x50')](_0x41aa33[_0x5e6d('0x51')],{})[_0x5e6d('0x1f')](respondWithResult(_0x5ba45,0xc9))[_0x5e6d('0x28')](handleError(_0x5ba45,null));};exports[_0x5e6d('0x52')]=function(_0x46a6f4,_0x117d9d){if(_0x46a6f4[_0x5e6d('0x51')]['id']){delete _0x46a6f4[_0x5e6d('0x51')]['id'];}return db['ZohoAccount'][_0x5e6d('0x53')]({'where':{'id':_0x46a6f4[_0x5e6d('0x4d')]['id']}})[_0x5e6d('0x1f')](handleEntityNotFound(_0x117d9d,null))[_0x5e6d('0x1f')](saveUpdates(_0x46a6f4['body'],null))[_0x5e6d('0x1f')](respondWithResult(_0x117d9d,null))[_0x5e6d('0x28')](handleError(_0x117d9d,null));};exports[_0x5e6d('0x32')]=function(_0x1fc129,_0x2e8725){return db[_0x5e6d('0x37')][_0x5e6d('0x53')]({'where':{'id':_0x1fc129[_0x5e6d('0x4d')]['id']}})[_0x5e6d('0x1f')](handleEntityNotFound(_0x2e8725,null))[_0x5e6d('0x1f')](removeEntity(_0x2e8725,null))[_0x5e6d('0x28')](handleError(_0x2e8725,null));};exports[_0x5e6d('0x54')]=function(_0x5d7319,_0x2870f3,_0x247c49){var _0xa42b80={};var _0x369cc4={};var _0x2de175;var _0x34b3f8;return db[_0x5e6d('0x37')][_0x5e6d('0x55')]({'where':{'id':_0x5d7319['params']['id']}})[_0x5e6d('0x1f')](handleEntityNotFound(_0x2870f3,null))[_0x5e6d('0x1f')](function(_0x11370d){if(_0x11370d){_0x2de175=_0x11370d;_0x369cc4[_0x5e6d('0x3b')]=_[_0x5e6d('0x3d')](db[_0x5e6d('0x56')][_0x5e6d('0x4e')]);_0x369cc4[_0x5e6d('0x3c')]=_[_0x5e6d('0x3d')](_0x5d7319[_0x5e6d('0x3c')]);_0x369cc4[_0x5e6d('0x3e')]=_['intersection'](_0x369cc4[_0x5e6d('0x3b')],_0x369cc4[_0x5e6d('0x3c')]);_0xa42b80[_0x5e6d('0x3f')]=_['intersection'](_0x369cc4[_0x5e6d('0x3b')],qs[_0x5e6d('0x40')](_0x5d7319[_0x5e6d('0x3c')][_0x5e6d('0x40')]));_0xa42b80['attributes']=_0xa42b80[_0x5e6d('0x3f')]['length']?_0xa42b80['attributes']:_0x369cc4[_0x5e6d('0x3b')];_0xa42b80[_0x5e6d('0x57')]=qs[_0x5e6d('0x43')](_0x5d7319[_0x5e6d('0x3c')]['sort']);_0xa42b80[_0x5e6d('0x44')]=qs[_0x5e6d('0x3e')](_['pick'](_0x5d7319[_0x5e6d('0x3c')],_0x369cc4[_0x5e6d('0x3e')]));if(_0x5d7319[_0x5e6d('0x3c')][_0x5e6d('0x47')]){_0xa42b80[_0x5e6d('0x44')]=_[_0x5e6d('0x46')](_0xa42b80[_0x5e6d('0x44')],{'$or':_[_0x5e6d('0x36')](_0xa42b80[_0x5e6d('0x3f')],function(_0x6545ed){var _0x44008e={};_0x44008e[_0x6545ed]={'$like':'%'+_0x5d7319['query'][_0x5e6d('0x47')]+'%'};return _0x44008e;})});}_0xa42b80=_[_0x5e6d('0x46')]({},_0xa42b80,_0x5d7319[_0x5e6d('0x48')]);return _0x2de175[_0x5e6d('0x54')](_0xa42b80);}})[_0x5e6d('0x1f')](function(_0x3db3d6){if(_0x3db3d6){_0x34b3f8=_0x3db3d6[_0x5e6d('0x58')];if(!_0x5d7319[_0x5e6d('0x3c')][_0x5e6d('0x41')](_0x5e6d('0x42'))){_0xa42b80[_0x5e6d('0x2e')]=qs[_0x5e6d('0x2e')](_0x5d7319[_0x5e6d('0x3c')][_0x5e6d('0x2e')]);_0xa42b80[_0x5e6d('0x2d')]=qs[_0x5e6d('0x2d')](_0x5d7319[_0x5e6d('0x3c')][_0x5e6d('0x2d')]);}return _0x2de175[_0x5e6d('0x54')](_0xa42b80);}})[_0x5e6d('0x1f')](function(_0x4eb12a){if(_0x4eb12a){return _0x4eb12a?{'count':_0x34b3f8,'rows':_0x4eb12a}:null;}})['then'](respondWithResult(_0x2870f3,null))[_0x5e6d('0x28')](handleError(_0x2870f3,null));};exports['addConfiguration']=function(_0x3d34b1,_0x44240e,_0x5872c5){if(_0x3d34b1[_0x5e6d('0x51')]['id']){delete _0x3d34b1[_0x5e6d('0x51')]['id'];}return db['ZohoAccount'][_0x5e6d('0x55')]({'where':{'id':_0x3d34b1[_0x5e6d('0x4d')]['id']}})[_0x5e6d('0x1f')](handleEntityNotFound(_0x44240e,null))['then'](function(_0x833a2f){if(_0x833a2f){_0x3d34b1[_0x5e6d('0x51')][_0x5e6d('0x59')]=_0x833a2f['id'];_0x3d34b1['body'][_0x5e6d('0x5a')]=integrations[_0x5e6d('0x5b')](_0x3d34b1[_0x5e6d('0x51')][_0x5e6d('0x5c')],_0x3d34b1['body'][_0x5e6d('0x39')]);_0x3d34b1[_0x5e6d('0x51')][_0x5e6d('0x5d')]=integrations[_0x5e6d('0x5e')](_0x3d34b1[_0x5e6d('0x51')][_0x5e6d('0x5c')],_0x3d34b1[_0x5e6d('0x51')][_0x5e6d('0x39')]);return db[_0x5e6d('0x56')][_0x5e6d('0x50')](_0x3d34b1[_0x5e6d('0x51')],{'include':[{'model':db[_0x5e6d('0x5f')],'as':_0x5e6d('0x5a')},{'model':db[_0x5e6d('0x5f')],'as':_0x5e6d('0x5d')}]});}return null;})[_0x5e6d('0x1f')](respondWithResult(_0x44240e,null))['catch'](handleError(_0x44240e,null));};function getAccessToken(_0x108c3a){return new Promise(function(_0x3379ce,_0x521ba5){var _0x30d1d7;switch(_0x108c3a['zone']){case'US':_0x30d1d7=_0x5e6d('0x60');break;case'AU':_0x30d1d7=_0x5e6d('0x61');break;case'EU':_0x30d1d7='https://accounts.zoho.eu';break;case'IN':_0x30d1d7=_0x5e6d('0x62');break;case'CN':_0x30d1d7=_0x5e6d('0x63');break;default:_0x30d1d7=_0x5e6d('0x64');break;}var _0xe3e842={'method':_0x5e6d('0x65'),'uri':_0x30d1d7+'/oauth/v2/token','qs':{'refresh_token':_0x108c3a['refreshToken'],'client_id':_0x108c3a[_0x5e6d('0x66')],'client_secret':_0x108c3a[_0x5e6d('0x67')],'grant_type':_0x5e6d('0x68')},'json':!![]};return rp(_0xe3e842)[_0x5e6d('0x1f')](function(_0x3c3181){if(_0x3c3181[_0x5e6d('0x69')]){_0x3379ce(_0x3c3181[_0x5e6d('0x69')]);}else{_0x521ba5('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x5e6d('0x28')](function(_0x32c5da){_0x521ba5(_0x32c5da);});});}exports[_0x5e6d('0x6a')]=function(_0x45e354,_0x3dd950,_0x13f98b){var _0x248166,_0x5da22f,_0x4c1def,_0x10386c,_0x4afb73;return db[_0x5e6d('0x37')]['findOne']({'where':{'id':_0x45e354[_0x5e6d('0x4d')]['id']},'attributes':['id',_0x5e6d('0x6b'),_0x5e6d('0x6c'),_0x5e6d('0x66'),_0x5e6d('0x67'),'serverUrl',_0x5e6d('0x6d'),'refreshToken']})['then'](handleEntityNotFound(_0x3dd950,null))['then'](function(_0x3578b8){_0x4afb73=_0x3578b8;_0x248166=_0x4afb73[_0x5e6d('0x6b')];_0x5da22f=_0x248166===_0x5e6d('0x6e')?'eu':'com';_0x4c1def=_0x4afb73[_0x5e6d('0x6f')];var _0x513422=_0x4c1def[_0x5e6d('0x70')](-0x1);if(_0x513422==='/'||_0x513422==='\x5c'||_0x513422===':'){_0x4c1def=_0x4c1def[_0x5e6d('0x71')](0x0,_0x4c1def[_0x5e6d('0x72')](_0x513422));}if(!_0x4afb73['refreshToken']){throw new Error(_0x5e6d('0x73'));}return getAccessToken(_0x4afb73);})[_0x5e6d('0x1f')](function(_0x5de193){if(_0x5de193){return rp({'method':'GET','uri':util[_0x5e6d('0x74')](_0x5e6d('0x75'),_0x5da22f),'qs':{'module':_0x5e6d('0x76')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5de193},'json':!![]});}})[_0x5e6d('0x1f')](function(_0x7f5d7f){if(_0x7f5d7f){if(_0x7f5d7f[_0x5e6d('0x77')]&&_0x7f5d7f[_0x5e6d('0x77')][_0x5e6d('0x23')]){throw new Error(_0x7f5d7f[_0x5e6d('0x77')][_0x5e6d('0x23')]['message']);}var _0x1e4bb5=[];var _0x51b7c3=[];var _0x3c68b7=[_0x5e6d('0x78'),_0x5e6d('0x79'),_0x5e6d('0x7a'),_0x5e6d('0x7b'),'Call_Duration',_0x5e6d('0x7c'),_0x5e6d('0x7d'),_0x5e6d('0x7e')];_0x51b7c3=_[_0x5e6d('0x7f')](_0x7f5d7f['fields'],function(_0x52126f){return _0x3c68b7['includes'](_0x52126f[_0x5e6d('0x80')]);});for(var _0x6705a6=0x0;_0x6705a6<_0x51b7c3[_0x5e6d('0x58')];_0x6705a6++){if(_0x51b7c3[_0x6705a6][_0x5e6d('0x81')]===![]){_0x1e4bb5[_0x5e6d('0x82')]({'id':_0x51b7c3[_0x6705a6]['id'],'name':_0x51b7c3[_0x6705a6][_0x5e6d('0x83')],'custom':_0x51b7c3[_0x6705a6]['custom_field'],'options':_0x51b7c3[_0x6705a6][_0x5e6d('0x84')]===_0x5e6d('0x85')&&_0x51b7c3[_0x6705a6][_0x5e6d('0x86')][_0x5e6d('0x58')]>-0x1?_[_0x5e6d('0x36')](_0x51b7c3[_0x6705a6][_0x5e6d('0x86')],function(_0x3d3ef4){return{'name':_0x3d3ef4,'value':_0x3d3ef4};}):[]});}}return{'count':_0x1e4bb5['length'],'rows':_0x1e4bb5};}else{return{'count':0x0,'rows':[]};}})[_0x5e6d('0x1f')](respondWithResult(_0x3dd950,null))[_0x5e6d('0x28')](function(_0x250b42){var _0x51633b=_0x45e354[_0x5e6d('0x3c')][_0x5e6d('0x1a')]?0x1f4:_0x250b42[_0x5e6d('0x87')]||0x1f4;logger[_0x5e6d('0x23')](_0x5e6d('0x88'),'getFields',_0x51633b,JSON[_0x5e6d('0x22')](_0x250b42));delete _0x250b42['name'];if(_0x51633b===0x191){_0x51633b=0x190;}_0x3dd950[_0x5e6d('0x2a')](_0x51633b)[_0x5e6d('0x35')](_0x45e354[_0x5e6d('0x3c')]['test']?{'message':_0x5e6d('0x89'),'statusCode':_0x250b42[_0x5e6d('0x87')]}:_0x250b42);});}; \ No newline at end of file +var _0xad48=['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','../../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','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','apply','save','update','destroy','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','params','keys','length','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','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','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Result','Call_Type','includes','api_name','system_mandatory','data_type','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x58d620,_0x31a57f){var _0x32d4cc=function(_0x31d483){while(--_0x31d483){_0x58d620['push'](_0x58d620['shift']());}};_0x32d4cc(++_0x31a57f);}(_0xad48,0x101));var _0x8ad4=function(_0x1b6fd0,_0xe625fe){_0x1b6fd0=_0x1b6fd0-0x0;var _0x3bea01=_0xad48[_0x1b6fd0];return _0x3bea01;};'use strict';var pdf=require(_0x8ad4('0x0'));var emlformat=require(_0x8ad4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8ad4('0x2'));var rp=require('request-promise');var moment=require(_0x8ad4('0x3'));var BPromise=require(_0x8ad4('0x4'));var Mustache=require(_0x8ad4('0x5'));var util=require(_0x8ad4('0x6'));var path=require(_0x8ad4('0x7'));var sox=require(_0x8ad4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8ad4('0x9'));var squel=require(_0x8ad4('0xa'));var crypto=require(_0x8ad4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8ad4('0xc'));var toCsv=require(_0x8ad4('0xd'));var querystring=require(_0x8ad4('0xe'));var Papa=require(_0x8ad4('0xf'));var Redis=require(_0x8ad4('0x10'));var authService=require(_0x8ad4('0x11'));var qs=require(_0x8ad4('0x12'));var as=require(_0x8ad4('0x13'));var hardwareService=require(_0x8ad4('0x14'));var logger=require(_0x8ad4('0x15'))('api');var utils=require(_0x8ad4('0x16'));var config=require(_0x8ad4('0x17'));var db=require(_0x8ad4('0x18'))['db'];var integrations=require(_0x8ad4('0x19'));var jayson=require(_0x8ad4('0x1a'));var client=jayson[_0x8ad4('0x1b')][_0x8ad4('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x5815b6,_0x416502,_0x635d42){if(_0x635d42){var _0x6dc061=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6dc061[_0x8ad4('0x1d')](_0x416502)){return _0x5815b6;}else{throw new db[(_0x8ad4('0x1e'))][(_0x8ad4('0x1f'))](_0x8ad4('0x20'));}}else{return _0x5815b6;}}function respondWithRpcPromise(_0x92231b,_0x45067b,_0x4717a5,_0x4f52b6){return new BPromise(function(_0x1671f1,_0x1b53da){var _0x20b66c=_0x4f52b6||client;return _0x20b66c[_0x8ad4('0x21')](_0x92231b,_0x4717a5)[_0x8ad4('0x22')](function(_0x4763dd){logger[_0x8ad4('0x23')](_0x8ad4('0x24'),_0x45067b,_0x8ad4('0x25'));logger['debug'](_0x8ad4('0x26'),_0x45067b,_0x8ad4('0x25'),JSON[_0x8ad4('0x27')](_0x4763dd));if(_0x4763dd['error']){if(_0x4763dd[_0x8ad4('0x28')][_0x8ad4('0x29')]===0x1f4){logger['error'](_0x8ad4('0x24'),_0x45067b,_0x4763dd[_0x8ad4('0x28')][_0x8ad4('0x2a')]);return _0x1b53da(_0x4763dd[_0x8ad4('0x28')][_0x8ad4('0x2a')]);}logger[_0x8ad4('0x28')](_0x8ad4('0x24'),_0x45067b,_0x4763dd['error'][_0x8ad4('0x2a')]);return _0x1671f1(_0x4763dd['error'][_0x8ad4('0x2a')]);}else{logger[_0x8ad4('0x23')](_0x8ad4('0x24'),_0x45067b,_0x8ad4('0x25'));_0x1671f1(_0x4763dd['result'][_0x8ad4('0x2a')]);}})['catch'](function(_0x2f1136){logger[_0x8ad4('0x28')]('ZohoAccount,\x20%s,\x20%s',_0x45067b,_0x2f1136);_0x1b53da(_0x2f1136);});});}function respondWithStatusCode(_0x26e241,_0x5e999f){_0x5e999f=_0x5e999f||0xcc;return function(_0x95dd6){if(_0x95dd6){return _0x26e241[_0x8ad4('0x2b')](_0x5e999f);}return _0x26e241[_0x8ad4('0x2c')](_0x5e999f)[_0x8ad4('0x2d')]();};}function respondWithResult(_0x737c5c,_0x15cc8e){_0x15cc8e=_0x15cc8e||0xc8;return function(_0x163c00){if(_0x163c00){return _0x737c5c[_0x8ad4('0x2c')](_0x15cc8e)[_0x8ad4('0x2e')](_0x163c00);}};}function respondWithFilteredResult(_0x40dd9c,_0x220dfe){return function(_0x42ec2a){if(_0x42ec2a){var _0x4b0d70=_0x42ec2a[_0x8ad4('0x2f')],_0x1f47da=_0x220dfe['offset'],_0xb29852=_0x220dfe[_0x8ad4('0x30')]+_0x220dfe[_0x8ad4('0x31')],_0x4ce3de;if(_0xb29852>=_0x4b0d70){_0xb29852=_0x4b0d70;_0x4ce3de=0xc8;}else{_0x4ce3de=0xce;}_0x40dd9c[_0x8ad4('0x2c')](_0x4ce3de);return _0x40dd9c['set']('Content-Range',_0x1f47da+'-'+_0xb29852+'/'+_0x4b0d70)[_0x8ad4('0x2e')](_0x42ec2a);}return null;};}function patchUpdates(_0x496ebc){return function(_0x5cb2ba){try{jsonpatch[_0x8ad4('0x32')](_0x5cb2ba,_0x496ebc,!![]);}catch(_0x196c77){return BPromise['reject'](_0x196c77);}return _0x5cb2ba[_0x8ad4('0x33')]();};}function saveUpdates(_0x14009c,_0x167608){return function(_0x416514){if(_0x416514){return _0x416514[_0x8ad4('0x34')](_0x14009c)['then'](function(_0x488361){return _0x488361;});}return null;};}function removeEntity(_0xcfb327,_0x46b9a5){return function(_0x2051f1){if(_0x2051f1){return _0x2051f1[_0x8ad4('0x35')]()[_0x8ad4('0x22')](function(){_0xcfb327[_0x8ad4('0x2c')](0xcc)[_0x8ad4('0x2d')]();});}};}function handleEntityNotFound(_0x556b63,_0x1a4e77){return function(_0x1ca518){if(!_0x1ca518){_0x556b63[_0x8ad4('0x2b')](0x194);}return _0x1ca518;};}function handleError(_0x1cd42c,_0x531714){_0x531714=_0x531714||0x1f4;return function(_0x325b81){logger[_0x8ad4('0x28')](_0x325b81['stack']);if(_0x325b81[_0x8ad4('0x36')]){delete _0x325b81['name'];}_0x1cd42c[_0x8ad4('0x2c')](_0x531714)[_0x8ad4('0x37')](_0x325b81);};}exports[_0x8ad4('0x38')]=function(_0x12e098,_0x4ee53c){var _0xf1b9c2={},_0x58fc07={},_0x2abe93={'count':0x0,'rows':[]};var _0x2993a3=_['map'](db[_0x8ad4('0x39')][_0x8ad4('0x3a')],function(_0x4098e9){return{'name':_0x4098e9[_0x8ad4('0x3b')],'type':_0x4098e9[_0x8ad4('0x3c')][_0x8ad4('0x3d')]};});_0x58fc07[_0x8ad4('0x3e')]=_[_0x8ad4('0x3f')](_0x2993a3,'name');_0x58fc07[_0x8ad4('0x40')]=_['keys'](_0x12e098[_0x8ad4('0x40')]);_0x58fc07[_0x8ad4('0x41')]=_[_0x8ad4('0x42')](_0x58fc07['model'],_0x58fc07[_0x8ad4('0x40')]);_0xf1b9c2[_0x8ad4('0x43')]=_[_0x8ad4('0x42')](_0x58fc07['model'],qs[_0x8ad4('0x44')](_0x12e098[_0x8ad4('0x40')][_0x8ad4('0x44')]));_0xf1b9c2[_0x8ad4('0x43')]=_0xf1b9c2[_0x8ad4('0x43')]['length']?_0xf1b9c2[_0x8ad4('0x43')]:_0x58fc07[_0x8ad4('0x3e')];if(!_0x12e098['query'][_0x8ad4('0x45')](_0x8ad4('0x46'))){_0xf1b9c2[_0x8ad4('0x31')]=qs[_0x8ad4('0x31')](_0x12e098[_0x8ad4('0x40')]['limit']);_0xf1b9c2['offset']=qs['offset'](_0x12e098['query'][_0x8ad4('0x30')]);}_0xf1b9c2[_0x8ad4('0x47')]=qs[_0x8ad4('0x48')](_0x12e098['query']['sort']);_0xf1b9c2[_0x8ad4('0x49')]=qs[_0x8ad4('0x41')](_[_0x8ad4('0x4a')](_0x12e098['query'],_0x58fc07[_0x8ad4('0x41')]),_0x2993a3);if(_0x12e098[_0x8ad4('0x40')][_0x8ad4('0x4b')]){_0xf1b9c2[_0x8ad4('0x49')]=_[_0x8ad4('0x4c')](_0xf1b9c2[_0x8ad4('0x49')],{'$or':_[_0x8ad4('0x3f')](_0x2993a3,function(_0x1f73e6){if(_0x1f73e6[_0x8ad4('0x3c')]!=='VIRTUAL'){var _0x57804c={};_0x57804c[_0x1f73e6[_0x8ad4('0x36')]]={'$like':'%'+_0x12e098[_0x8ad4('0x40')][_0x8ad4('0x4b')]+'%'};return _0x57804c;}})});}_0xf1b9c2=_['merge']({},_0xf1b9c2,_0x12e098[_0x8ad4('0x4d')]);var _0x10cc2c={'where':_0xf1b9c2[_0x8ad4('0x49')]};return db[_0x8ad4('0x39')][_0x8ad4('0x2f')](_0x10cc2c)[_0x8ad4('0x22')](function(_0x225086){_0x2abe93[_0x8ad4('0x2f')]=_0x225086;if(_0x12e098[_0x8ad4('0x40')]['includeAll']){_0xf1b9c2[_0x8ad4('0x4e')]=[{'all':!![]}];}return db[_0x8ad4('0x39')][_0x8ad4('0x4f')](_0xf1b9c2);})[_0x8ad4('0x22')](function(_0x4b85ef){_0x2abe93['rows']=_0x4b85ef;return _0x2abe93;})[_0x8ad4('0x22')](respondWithFilteredResult(_0x4ee53c,_0xf1b9c2))[_0x8ad4('0x50')](handleError(_0x4ee53c,null));};exports['show']=function(_0x2a0add,_0x5f334f){var _0x37abf8={'raw':![],'where':{'id':_0x2a0add[_0x8ad4('0x51')]['id']}},_0x43ea8b={};_0x43ea8b[_0x8ad4('0x3e')]=_[_0x8ad4('0x52')](db['ZohoAccount']['rawAttributes']);_0x43ea8b[_0x8ad4('0x40')]=_[_0x8ad4('0x52')](_0x2a0add['query']);_0x43ea8b[_0x8ad4('0x41')]=_[_0x8ad4('0x42')](_0x43ea8b[_0x8ad4('0x3e')],_0x43ea8b[_0x8ad4('0x40')]);_0x37abf8[_0x8ad4('0x43')]=_[_0x8ad4('0x42')](_0x43ea8b[_0x8ad4('0x3e')],qs['fields'](_0x2a0add[_0x8ad4('0x40')][_0x8ad4('0x44')]));_0x37abf8[_0x8ad4('0x43')]=_0x37abf8[_0x8ad4('0x43')][_0x8ad4('0x53')]?_0x37abf8['attributes']:_0x43ea8b[_0x8ad4('0x3e')];if(_0x2a0add[_0x8ad4('0x40')]['includeAll']){_0x37abf8[_0x8ad4('0x4e')]=[{'all':!![]}];}_0x37abf8=_[_0x8ad4('0x4c')]({},_0x37abf8,_0x2a0add[_0x8ad4('0x4d')]);return db['ZohoAccount'][_0x8ad4('0x54')](_0x37abf8)[_0x8ad4('0x22')](handleEntityNotFound(_0x5f334f,null))['then'](respondWithResult(_0x5f334f,null))[_0x8ad4('0x50')](handleError(_0x5f334f,null));};exports[_0x8ad4('0x55')]=function(_0x38d71f,_0x304274){return db[_0x8ad4('0x39')][_0x8ad4('0x55')](_0x38d71f['body'],{})[_0x8ad4('0x22')](respondWithResult(_0x304274,0xc9))[_0x8ad4('0x50')](handleError(_0x304274,null));};exports['update']=function(_0x38c2c5,_0x38e589){if(_0x38c2c5[_0x8ad4('0x56')]['id']){delete _0x38c2c5[_0x8ad4('0x56')]['id'];}return db[_0x8ad4('0x39')][_0x8ad4('0x54')]({'where':{'id':_0x38c2c5['params']['id']}})[_0x8ad4('0x22')](handleEntityNotFound(_0x38e589,null))[_0x8ad4('0x22')](saveUpdates(_0x38c2c5[_0x8ad4('0x56')],null))['then'](respondWithResult(_0x38e589,null))[_0x8ad4('0x50')](handleError(_0x38e589,null));};exports[_0x8ad4('0x35')]=function(_0x1001f4,_0x48e36d){return db[_0x8ad4('0x39')][_0x8ad4('0x54')]({'where':{'id':_0x1001f4[_0x8ad4('0x51')]['id']}})[_0x8ad4('0x22')](handleEntityNotFound(_0x48e36d,null))[_0x8ad4('0x22')](removeEntity(_0x48e36d,null))[_0x8ad4('0x50')](handleError(_0x48e36d,null));};exports[_0x8ad4('0x57')]=function(_0x26f937,_0x1068d2,_0x5823a8){var _0x5ef2d7={};var _0x167584={};var _0x483526;var _0x15e890;return db['ZohoAccount'][_0x8ad4('0x58')]({'where':{'id':_0x26f937[_0x8ad4('0x51')]['id']}})['then'](handleEntityNotFound(_0x1068d2,null))[_0x8ad4('0x22')](function(_0xb6136b){if(_0xb6136b){_0x483526=_0xb6136b;_0x167584[_0x8ad4('0x3e')]=_[_0x8ad4('0x52')](db['ZohoConfiguration']['rawAttributes']);_0x167584[_0x8ad4('0x40')]=_[_0x8ad4('0x52')](_0x26f937['query']);_0x167584[_0x8ad4('0x41')]=_[_0x8ad4('0x42')](_0x167584[_0x8ad4('0x3e')],_0x167584['query']);_0x5ef2d7[_0x8ad4('0x43')]=_[_0x8ad4('0x42')](_0x167584[_0x8ad4('0x3e')],qs[_0x8ad4('0x44')](_0x26f937[_0x8ad4('0x40')][_0x8ad4('0x44')]));_0x5ef2d7[_0x8ad4('0x43')]=_0x5ef2d7['attributes'][_0x8ad4('0x53')]?_0x5ef2d7[_0x8ad4('0x43')]:_0x167584[_0x8ad4('0x3e')];_0x5ef2d7[_0x8ad4('0x47')]=qs[_0x8ad4('0x48')](_0x26f937[_0x8ad4('0x40')]['sort']);_0x5ef2d7[_0x8ad4('0x49')]=qs[_0x8ad4('0x41')](_[_0x8ad4('0x4a')](_0x26f937['query'],_0x167584[_0x8ad4('0x41')]));if(_0x26f937[_0x8ad4('0x40')][_0x8ad4('0x4b')]){_0x5ef2d7[_0x8ad4('0x49')]=_[_0x8ad4('0x4c')](_0x5ef2d7[_0x8ad4('0x49')],{'$or':_[_0x8ad4('0x3f')](_0x5ef2d7[_0x8ad4('0x43')],function(_0x42ee4b){var _0x432971={};_0x432971[_0x42ee4b]={'$like':'%'+_0x26f937['query'][_0x8ad4('0x4b')]+'%'};return _0x432971;})});}_0x5ef2d7=_[_0x8ad4('0x4c')]({},_0x5ef2d7,_0x26f937[_0x8ad4('0x4d')]);return _0x483526[_0x8ad4('0x57')](_0x5ef2d7);}})[_0x8ad4('0x22')](function(_0x4883ee){if(_0x4883ee){_0x15e890=_0x4883ee[_0x8ad4('0x53')];if(!_0x26f937[_0x8ad4('0x40')][_0x8ad4('0x45')]('nolimit')){_0x5ef2d7['limit']=qs[_0x8ad4('0x31')](_0x26f937['query'][_0x8ad4('0x31')]);_0x5ef2d7[_0x8ad4('0x30')]=qs['offset'](_0x26f937['query'][_0x8ad4('0x30')]);}return _0x483526['getConfigurations'](_0x5ef2d7);}})[_0x8ad4('0x22')](function(_0x7edce5){if(_0x7edce5){return _0x7edce5?{'count':_0x15e890,'rows':_0x7edce5}:null;}})['then'](respondWithResult(_0x1068d2,null))['catch'](handleError(_0x1068d2,null));};exports[_0x8ad4('0x59')]=function(_0x46b34d,_0xb817f1,_0x5eda34){if(_0x46b34d[_0x8ad4('0x56')]['id']){delete _0x46b34d[_0x8ad4('0x56')]['id'];}return db[_0x8ad4('0x39')][_0x8ad4('0x58')]({'where':{'id':_0x46b34d['params']['id']}})[_0x8ad4('0x22')](handleEntityNotFound(_0xb817f1,null))[_0x8ad4('0x22')](function(_0x550a61){if(_0x550a61){_0x46b34d[_0x8ad4('0x56')][_0x8ad4('0x5a')]=_0x550a61['id'];_0x46b34d['body'][_0x8ad4('0x5b')]=integrations[_0x8ad4('0x5c')](_0x46b34d[_0x8ad4('0x56')][_0x8ad4('0x5d')],_0x46b34d[_0x8ad4('0x56')][_0x8ad4('0x3c')]);_0x46b34d[_0x8ad4('0x56')][_0x8ad4('0x5e')]=integrations[_0x8ad4('0x5f')](_0x46b34d[_0x8ad4('0x56')]['channel'],_0x46b34d[_0x8ad4('0x56')]['type']);return db[_0x8ad4('0x60')][_0x8ad4('0x55')](_0x46b34d[_0x8ad4('0x56')],{'include':[{'model':db[_0x8ad4('0x61')],'as':_0x8ad4('0x5b')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x8ad4('0x22')](respondWithResult(_0xb817f1,null))['catch'](handleError(_0xb817f1,null));};function getAccessToken(_0x20648f){return new Promise(function(_0x448d6b,_0x25e4a3){var _0x9e0787;switch(_0x20648f[_0x8ad4('0x62')]){case'US':_0x9e0787='https://accounts.zoho.com';break;case'AU':_0x9e0787=_0x8ad4('0x63');break;case'EU':_0x9e0787=_0x8ad4('0x64');break;case'IN':_0x9e0787=_0x8ad4('0x65');break;case'CN':_0x9e0787=_0x8ad4('0x66');break;default:_0x9e0787=_0x8ad4('0x64');break;}var _0x5e7c4f={'method':_0x8ad4('0x67'),'uri':_0x9e0787+_0x8ad4('0x68'),'qs':{'refresh_token':_0x20648f[_0x8ad4('0x69')],'client_id':_0x20648f[_0x8ad4('0x6a')],'client_secret':_0x20648f[_0x8ad4('0x6b')],'grant_type':_0x8ad4('0x6c')},'json':!![]};return rp(_0x5e7c4f)[_0x8ad4('0x22')](function(_0x19778c){if(_0x19778c[_0x8ad4('0x6d')]){_0x448d6b(_0x19778c['access_token']);}else{_0x25e4a3(_0x8ad4('0x6e'));}})[_0x8ad4('0x50')](function(_0x58b03f){_0x25e4a3(_0x58b03f);});});}exports[_0x8ad4('0x6f')]=function(_0x536f55,_0x396885,_0x29c355){var _0x22c400,_0x4d2cdd,_0x5de7bc,_0x90fe27,_0x3785b5;return db[_0x8ad4('0x39')][_0x8ad4('0x58')]({'where':{'id':_0x536f55['params']['id']},'attributes':['id',_0x8ad4('0x70'),_0x8ad4('0x62'),_0x8ad4('0x6a'),_0x8ad4('0x6b'),_0x8ad4('0x71'),_0x8ad4('0x29'),_0x8ad4('0x69')]})[_0x8ad4('0x22')](handleEntityNotFound(_0x396885,null))[_0x8ad4('0x22')](function(_0x25e6aa){_0x3785b5=_0x25e6aa;_0x22c400=_0x3785b5[_0x8ad4('0x70')];_0x4d2cdd=_0x22c400===_0x8ad4('0x72')?'eu':'com';_0x5de7bc=_0x3785b5[_0x8ad4('0x71')];var _0x4f8580=_0x5de7bc['slice'](-0x1);if(_0x4f8580==='/'||_0x4f8580==='\x5c'||_0x4f8580===':'){_0x5de7bc=_0x5de7bc['substring'](0x0,_0x5de7bc[_0x8ad4('0x73')](_0x4f8580));}if(!_0x3785b5[_0x8ad4('0x69')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x3785b5);})['then'](function(_0x147ed2){if(_0x147ed2){return rp({'method':'GET','uri':util[_0x8ad4('0x74')](_0x8ad4('0x75'),_0x4d2cdd),'qs':{'module':_0x8ad4('0x76')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x147ed2},'json':!![]});}})[_0x8ad4('0x22')](function(_0x457038){if(_0x457038){if(_0x457038['response']&&_0x457038[_0x8ad4('0x77')][_0x8ad4('0x28')]){throw new Error(_0x457038['response'][_0x8ad4('0x28')]['message']);}var _0x37148e=[];var _0x1a144f=[];var _0x14574d=[_0x8ad4('0x78'),_0x8ad4('0x79'),_0x8ad4('0x7a'),_0x8ad4('0x7b'),'Call_Duration',_0x8ad4('0x7c'),'Call_Start_Time',_0x8ad4('0x7d')];_0x1a144f=_['remove'](_0x457038[_0x8ad4('0x44')],function(_0x3617aa){return _0x14574d[_0x8ad4('0x7e')](_0x3617aa[_0x8ad4('0x7f')]);});for(var _0x2d8689=0x0;_0x2d8689<_0x1a144f[_0x8ad4('0x53')];_0x2d8689++){if(_0x1a144f[_0x2d8689][_0x8ad4('0x80')]===![]){_0x37148e['push']({'id':_0x1a144f[_0x2d8689]['id'],'name':_0x1a144f[_0x2d8689]['display_label'],'custom':_0x1a144f[_0x2d8689]['custom_field'],'options':_0x1a144f[_0x2d8689][_0x8ad4('0x81')]==='picklist'&&_0x1a144f[_0x2d8689]['pick_list_values'][_0x8ad4('0x53')]>-0x1?_['map'](_0x1a144f[_0x2d8689]['pick_list_values'],function(_0x21409c){return{'name':_0x21409c,'value':_0x21409c};}):[]});}}return{'count':_0x37148e['length'],'rows':_0x37148e};}else{return{'count':0x0,'rows':[]};}})[_0x8ad4('0x22')](respondWithResult(_0x396885,null))[_0x8ad4('0x50')](function(_0x3e9130){var _0x3a67f9=_0x536f55[_0x8ad4('0x40')][_0x8ad4('0x1d')]?0x1f4:_0x3e9130[_0x8ad4('0x82')]||0x1f4;logger['error'](_0x8ad4('0x83'),'getFields',_0x3a67f9,JSON[_0x8ad4('0x27')](_0x3e9130));delete _0x3e9130[_0x8ad4('0x36')];if(_0x3a67f9===0x191){_0x3a67f9=0x190;}_0x396885[_0x8ad4('0x2c')](_0x3a67f9)[_0x8ad4('0x37')](_0x536f55[_0x8ad4('0x40')]['test']?{'message':_0x8ad4('0x84'),'statusCode':_0x3e9130[_0x8ad4('0x82')]}:_0x3e9130);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4c98dfc..e585a9d 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 _0x5720=['https://accounts.zoho.eu','/oauth/v2/token','application/x-www-form-urlencoded','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','define','int_zoho_accounts','changed','clientId','clientSecret','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','then','parse','refresh_token','refreshToken','info','format','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','zone'];(function(_0x578eae,_0xc5cd36){var _0x184fb5=function(_0x3fd249){while(--_0x3fd249){_0x578eae['push'](_0x578eae['shift']());}};_0x184fb5(++_0xc5cd36);}(_0x5720,0x81));var _0x0572=function(_0x3e589a,_0xf8df5a){_0x3e589a=_0x3e589a-0x0;var _0x511383=_0x5720[_0x3e589a];return _0x511383;};'use strict';var _=require(_0x0572('0x0'));var util=require(_0x0572('0x1'));var logger=require(_0x0572('0x2'))(_0x0572('0x3'));var moment=require(_0x0572('0x4'));var BPromise=require(_0x0572('0x5'));var rp=require(_0x0572('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0572('0x7'));var config=require(_0x0572('0x8'));var attributes=require(_0x0572('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x7a3bd2,_0x5836f9){return _0x7a3bd2[_0x0572('0xa')]('ZohoAccount',attributes,{'tableName':_0x0572('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x392ac5,_0x4f838b,_0x51adf0){if(_0x392ac5[_0x0572('0xc')]('zone')||_0x392ac5[_0x0572('0xc')]('serverUrl')||_0x392ac5[_0x0572('0xc')](_0x0572('0xd'))||_0x392ac5['changed'](_0x0572('0xe'))||_0x392ac5['changed'](_0x0572('0xf'))||_0x392ac5['changed'](_0x0572('0x10'))){var _0x365038,_0x524e68;_0x365038=_0x392ac5[_0x0572('0x11')];var _0xa7ad80=_0x365038[_0x0572('0x12')](-0x1);if(_0xa7ad80==='/'||_0xa7ad80==='\x5c'||_0xa7ad80===':'){_0x365038=_0x365038[_0x0572('0x13')](0x0,_0x365038[_0x0572('0x14')](_0xa7ad80));}switch(_0x392ac5['zone']){case'US':_0x524e68=_0x0572('0x15');break;case'AU':_0x524e68=_0x0572('0x16');break;case'IN':_0x524e68=_0x0572('0x17');break;case'CN':_0x524e68=_0x0572('0x18');break;default:_0x524e68='https://accounts.zoho.eu';break;}var _0x12f503={'method':_0x0572('0x19'),'uri':_0x524e68+'/oauth/v2/token','form':{'grant_type':_0x0572('0x1a'),'client_id':_0x392ac5[_0x0572('0xd')],'client_secret':_0x392ac5[_0x0572('0xe')],'redirect_uri':_0x392ac5[_0x0572('0x11')],'code':_0x392ac5[_0x0572('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x12f503)[_0x0572('0x1b')](function(_0x188319){var _0x54e310=JSON[_0x0572('0x1c')](_0x188319);if(_0x54e310[_0x0572('0x1d')]){_0x392ac5[_0x0572('0x1e')]=_0x54e310[_0x0572('0x1d')];logger[_0x0572('0x1f')](util[_0x0572('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x392ac5[_0x0572('0x21')],_0x392ac5['id']));}else{logger[_0x0572('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x392ac5[_0x0572('0x21')],_0x392ac5['id']),util[_0x0572('0x23')](_0x54e310,{'showHidden':![],'depth':null}));}return _0x51adf0(null,_0x4f838b);})[_0x0572('0x24')](function(_0x30a274){logger['error'](util['format'](_0x0572('0x25'),_0x392ac5[_0x0572('0x21')],_0x392ac5['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x51adf0(_0x30a274);});}else{return _0x51adf0(null,_0x4f838b);}},'beforeUpdate':function(_0x45c03b,_0x4ed323,_0x5a00d8){if(_0x45c03b['changed'](_0x0572('0x26'))||_0x45c03b[_0x0572('0xc')](_0x0572('0x11'))||_0x45c03b[_0x0572('0xc')](_0x0572('0xd'))||_0x45c03b[_0x0572('0xc')]('clientSecret')||_0x45c03b[_0x0572('0xc')](_0x0572('0xf'))||_0x45c03b['changed'](_0x0572('0x10'))){var _0x1e1ac2,_0x50be0d;_0x1e1ac2=_0x45c03b['serverUrl'];var _0x53c73e=_0x1e1ac2[_0x0572('0x12')](-0x1);if(_0x53c73e==='/'||_0x53c73e==='\x5c'||_0x53c73e===':'){_0x1e1ac2=_0x1e1ac2[_0x0572('0x13')](0x0,_0x1e1ac2[_0x0572('0x14')](_0x53c73e));}switch(_0x45c03b[_0x0572('0x26')]){case'US':_0x50be0d='https://accounts.zoho.com';break;case'AU':_0x50be0d=_0x0572('0x16');break;case'IN':_0x50be0d=_0x0572('0x17');break;case'CN':_0x50be0d=_0x0572('0x18');break;default:_0x50be0d=_0x0572('0x27');break;}var _0x23673e={'method':_0x0572('0x19'),'uri':_0x50be0d+_0x0572('0x28'),'form':{'grant_type':'authorization_code','client_id':_0x45c03b[_0x0572('0xd')],'client_secret':_0x45c03b[_0x0572('0xe')],'redirect_uri':_0x45c03b[_0x0572('0x11')],'code':_0x45c03b['code']},'headers':{'Content-Type':_0x0572('0x29')}};return rp(_0x23673e)[_0x0572('0x1b')](function(_0x55e95a){var _0x35e262=JSON['parse'](_0x55e95a);if(_0x35e262[_0x0572('0x1d')]){_0x45c03b[_0x0572('0x1e')]=_0x35e262['refresh_token'];logger[_0x0572('0x1f')](util[_0x0572('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x45c03b['name'],_0x45c03b['id']));}else{logger[_0x0572('0x22')](util[_0x0572('0x20')](_0x0572('0x25'),_0x45c03b['name'],_0x45c03b['id']),util[_0x0572('0x23')](_0x35e262,{'showHidden':![],'depth':null}));}return _0x5a00d8(null,_0x4ed323);})[_0x0572('0x24')](function(_0x1a2c1b){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x45c03b[_0x0572('0x21')],_0x45c03b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5a00d8(_0x1a2c1b);});}else{return _0x5a00d8(null,_0x4ed323);}}}});}; \ No newline at end of file +var _0x4d4d=['exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','serverUrl','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','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','code','substring','/oauth/v2/token','authorization_code','catch','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x4667b2,_0x135b67){var _0x1070f2=function(_0xa72ca5){while(--_0xa72ca5){_0x4667b2['push'](_0x4667b2['shift']());}};_0x1070f2(++_0x135b67);}(_0x4d4d,0xa0));var _0xd4d4=function(_0x5a6a93,_0x1a9039){_0x5a6a93=_0x5a6a93-0x0;var _0x4e0a43=_0x4d4d[_0x5a6a93];return _0x4e0a43;};'use strict';var _=require(_0xd4d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd4d4('0x1'));var moment=require('moment');var BPromise=require(_0xd4d4('0x2'));var rp=require(_0xd4d4('0x3'));var fs=require('fs');var path=require(_0xd4d4('0x4'));var rimraf=require(_0xd4d4('0x5'));var config=require(_0xd4d4('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xd4d4('0x7'));module[_0xd4d4('0x8')]=function(_0xe36b4,_0x2841d1){return _0xe36b4[_0xd4d4('0x9')](_0xd4d4('0xa'),attributes,{'tableName':_0xd4d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15df62,_0x34362c,_0x286d96){if(_0x15df62[_0xd4d4('0xc')](_0xd4d4('0xd'))||_0x15df62[_0xd4d4('0xc')]('serverUrl')||_0x15df62[_0xd4d4('0xc')](_0xd4d4('0xe'))||_0x15df62[_0xd4d4('0xc')](_0xd4d4('0xf'))||_0x15df62[_0xd4d4('0xc')]('code')||_0x15df62[_0xd4d4('0xc')]('host')){var _0x58264a,_0xfaf8bc;_0x58264a=_0x15df62[_0xd4d4('0x10')];var _0x384af1=_0x58264a[_0xd4d4('0x11')](-0x1);if(_0x384af1==='/'||_0x384af1==='\x5c'||_0x384af1===':'){_0x58264a=_0x58264a['substring'](0x0,_0x58264a[_0xd4d4('0x12')](_0x384af1));}switch(_0x15df62['zone']){case'US':_0xfaf8bc=_0xd4d4('0x13');break;case'AU':_0xfaf8bc=_0xd4d4('0x14');break;case'IN':_0xfaf8bc=_0xd4d4('0x15');break;case'CN':_0xfaf8bc=_0xd4d4('0x16');break;default:_0xfaf8bc=_0xd4d4('0x17');break;}var _0x5f245f={'method':_0xd4d4('0x18'),'uri':_0xfaf8bc+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x15df62[_0xd4d4('0xe')],'client_secret':_0x15df62[_0xd4d4('0xf')],'redirect_uri':_0x15df62[_0xd4d4('0x10')],'code':_0x15df62['code']},'headers':{'Content-Type':_0xd4d4('0x19')}};return rp(_0x5f245f)[_0xd4d4('0x1a')](function(_0x275198){var _0x2df154=JSON[_0xd4d4('0x1b')](_0x275198);if(_0x2df154[_0xd4d4('0x1c')]){_0x15df62[_0xd4d4('0x1d')]=_0x2df154[_0xd4d4('0x1c')];logger[_0xd4d4('0x1e')](util[_0xd4d4('0x1f')](_0xd4d4('0x20'),_0x15df62[_0xd4d4('0x21')],_0x15df62['id']));}else{logger[_0xd4d4('0x22')](util[_0xd4d4('0x1f')](_0xd4d4('0x23'),_0x15df62['name'],_0x15df62['id']),util[_0xd4d4('0x24')](_0x2df154,{'showHidden':![],'depth':null}));}return _0x286d96(null,_0x34362c);})['catch'](function(_0x3251d1){logger['error'](util['format'](_0xd4d4('0x23'),_0x15df62[_0xd4d4('0x21')],_0x15df62['id']),util[_0xd4d4('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x286d96(_0x3251d1);});}else{return _0x286d96(null,_0x34362c);}},'beforeUpdate':function(_0x47f040,_0x4548d8,_0x4a76b2){if(_0x47f040[_0xd4d4('0xc')]('zone')||_0x47f040[_0xd4d4('0xc')](_0xd4d4('0x10'))||_0x47f040[_0xd4d4('0xc')](_0xd4d4('0xe'))||_0x47f040[_0xd4d4('0xc')](_0xd4d4('0xf'))||_0x47f040[_0xd4d4('0xc')](_0xd4d4('0x25'))||_0x47f040[_0xd4d4('0xc')]('host')){var _0x51978b,_0x2d9cf8;_0x51978b=_0x47f040[_0xd4d4('0x10')];var _0x1bddd0=_0x51978b['slice'](-0x1);if(_0x1bddd0==='/'||_0x1bddd0==='\x5c'||_0x1bddd0===':'){_0x51978b=_0x51978b[_0xd4d4('0x26')](0x0,_0x51978b[_0xd4d4('0x12')](_0x1bddd0));}switch(_0x47f040['zone']){case'US':_0x2d9cf8=_0xd4d4('0x13');break;case'AU':_0x2d9cf8='https://accounts.zoho.com.au';break;case'IN':_0x2d9cf8=_0xd4d4('0x15');break;case'CN':_0x2d9cf8=_0xd4d4('0x16');break;default:_0x2d9cf8='https://accounts.zoho.eu';break;}var _0xe9f698={'method':'POST','uri':_0x2d9cf8+_0xd4d4('0x27'),'form':{'grant_type':_0xd4d4('0x28'),'client_id':_0x47f040[_0xd4d4('0xe')],'client_secret':_0x47f040[_0xd4d4('0xf')],'redirect_uri':_0x47f040[_0xd4d4('0x10')],'code':_0x47f040[_0xd4d4('0x25')]},'headers':{'Content-Type':_0xd4d4('0x19')}};return rp(_0xe9f698)[_0xd4d4('0x1a')](function(_0xd08e7b){var _0x484bd0=JSON[_0xd4d4('0x1b')](_0xd08e7b);if(_0x484bd0[_0xd4d4('0x1c')]){_0x47f040[_0xd4d4('0x1d')]=_0x484bd0[_0xd4d4('0x1c')];logger[_0xd4d4('0x1e')](util['format'](_0xd4d4('0x20'),_0x47f040[_0xd4d4('0x21')],_0x47f040['id']));}else{logger[_0xd4d4('0x22')](util['format'](_0xd4d4('0x23'),_0x47f040[_0xd4d4('0x21')],_0x47f040['id']),util[_0xd4d4('0x24')](_0x484bd0,{'showHidden':![],'depth':null}));}return _0x4a76b2(null,_0x4548d8);})[_0xd4d4('0x29')](function(_0x27a90d){logger[_0xd4d4('0x22')](util[_0xd4d4('0x1f')](_0xd4d4('0x23'),_0x47f040[_0xd4d4('0x21')],_0x47f040['id']),util[_0xd4d4('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x4a76b2(_0x27a90d);});}else{return _0x4a76b2(null,_0x4548d8);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index be42903..409c3be 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 _0x229c=['include','map','model','attributes','ShowZohoAccount','find','raw','where','then','util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','limit'];(function(_0x53ce18,_0x51ff4e){var _0x253e5a=function(_0x1663a4){while(--_0x1663a4){_0x53ce18['push'](_0x53ce18['shift']());}};_0x253e5a(++_0x51ff4e);}(_0x229c,0xcf));var _0xc229=function(_0x381d88,_0x187470){_0x381d88=_0x381d88-0x0;var _0x10c0c1=_0x229c[_0x381d88];return _0x10c0c1;};'use strict';var _=require('lodash');var util=require(_0xc229('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc229('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc229('0x2'));var logger=require('../../config/logger')(_0xc229('0x3'));var config=require(_0xc229('0x4'));var jayson=require(_0xc229('0x5'));var client=jayson['client'][_0xc229('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x52978a,_0x41ede5,_0x14cd26){return new BPromise(function(_0x504d48,_0x3fb59d){return client[_0xc229('0x7')](_0x52978a,_0x14cd26)['then'](function(_0x529822){logger[_0xc229('0x8')]('ZohoAccount,\x20%s,\x20%s',_0x41ede5,'request\x20sent');logger[_0xc229('0x9')](_0xc229('0xa'),_0x41ede5,_0xc229('0xb'),JSON[_0xc229('0xc')](_0x529822));if(_0x529822[_0xc229('0xd')]){if(_0x529822[_0xc229('0xd')][_0xc229('0xe')]===0x1f4){logger[_0xc229('0xd')](_0xc229('0xf'),_0x41ede5,_0x529822[_0xc229('0xd')][_0xc229('0x10')]);return _0x3fb59d(_0x529822[_0xc229('0xd')][_0xc229('0x10')]);}logger['error'](_0xc229('0xf'),_0x41ede5,_0x529822['error'][_0xc229('0x10')]);return _0x504d48(_0x529822[_0xc229('0xd')][_0xc229('0x10')]);}else{logger[_0xc229('0x8')](_0xc229('0xf'),_0x41ede5,_0xc229('0xb'));_0x504d48(_0x529822[_0xc229('0x11')][_0xc229('0x10')]);}})[_0xc229('0x12')](function(_0x3c3b1c){logger[_0xc229('0xd')](_0xc229('0xf'),_0x41ede5,_0x3c3b1c);_0x3fb59d(_0x3c3b1c);});});}exports[_0xc229('0x13')]=function(_0x4cae05){var _0x379e41=this;return new Promise(function(_0x10339a,_0x393e8c){return db[_0xc229('0x14')][_0xc229('0x15')]({'raw':_0x4cae05[_0xc229('0x16')]?_0x4cae05[_0xc229('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4cae05['options']?_0x4cae05[_0xc229('0x16')]['where']||null:null,'attributes':_0x4cae05[_0xc229('0x16')]?_0x4cae05[_0xc229('0x16')]['attributes']||null:null,'limit':_0x4cae05['options']?_0x4cae05[_0xc229('0x16')][_0xc229('0x17')]||null:null,'include':_0x4cae05[_0xc229('0x16')]?_0x4cae05[_0xc229('0x16')][_0xc229('0x18')]?_[_0xc229('0x19')](_0x4cae05[_0xc229('0x16')]['include'],function(_0x5cb52f){return{'model':db[_0x5cb52f[_0xc229('0x1a')]],'as':_0x5cb52f['as'],'attributes':_0x5cb52f[_0xc229('0x1b')],'include':_0x5cb52f['include']?_['map'](_0x5cb52f[_0xc229('0x18')],function(_0x30c711){return{'model':db[_0x30c711[_0xc229('0x1a')]],'as':_0x30c711['as'],'attributes':_0x30c711[_0xc229('0x1b')],'include':_0x30c711[_0xc229('0x18')]?_[_0xc229('0x19')](_0x30c711['include'],function(_0x103d43){return{'model':db[_0x103d43[_0xc229('0x1a')]],'as':_0x103d43['as'],'attributes':_0x103d43[_0xc229('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x524908){logger[_0xc229('0x8')]('GetZohoAccount',_0x4cae05);logger[_0xc229('0x9')](_0xc229('0x13'),_0x4cae05,JSON[_0xc229('0xc')](_0x524908));_0x10339a(_0x524908);})[_0xc229('0x12')](function(_0xfa1ba2){logger[_0xc229('0xd')](_0xc229('0x13'),_0xfa1ba2[_0xc229('0x10')],_0x4cae05);_0x393e8c(_0x379e41[_0xc229('0xd')](0x1f4,_0xfa1ba2[_0xc229('0x10')]));});});};exports[_0xc229('0x1c')]=function(_0x3aef16){var _0x4192d0=this;return new Promise(function(_0x25cd16,_0x2e7fe7){return db[_0xc229('0x14')][_0xc229('0x1d')]({'raw':_0x3aef16[_0xc229('0x16')]?_0x3aef16[_0xc229('0x16')][_0xc229('0x1e')]===undefined?!![]:![]:!![],'where':_0x3aef16[_0xc229('0x16')]?_0x3aef16['options'][_0xc229('0x1f')]||null:null,'attributes':_0x3aef16['options']?_0x3aef16[_0xc229('0x16')][_0xc229('0x1b')]||null:null,'include':_0x3aef16['options']?_0x3aef16[_0xc229('0x16')][_0xc229('0x18')]?_[_0xc229('0x19')](_0x3aef16[_0xc229('0x16')][_0xc229('0x18')],function(_0x42b7a3){return{'model':db[_0x42b7a3['model']],'as':_0x42b7a3['as'],'attributes':_0x42b7a3[_0xc229('0x1b')],'include':_0x42b7a3[_0xc229('0x18')]?_[_0xc229('0x19')](_0x42b7a3[_0xc229('0x18')],function(_0x39a7c2){return{'model':db[_0x39a7c2[_0xc229('0x1a')]],'as':_0x39a7c2['as'],'attributes':_0x39a7c2[_0xc229('0x1b')],'include':_0x39a7c2[_0xc229('0x18')]?_[_0xc229('0x19')](_0x39a7c2[_0xc229('0x18')],function(_0x31d5bb){return{'model':db[_0x31d5bb['model']],'as':_0x31d5bb['as'],'attributes':_0x31d5bb[_0xc229('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc229('0x20')](function(_0x251b4b){logger['info'](_0xc229('0x1c'),_0x3aef16);logger[_0xc229('0x9')]('ShowZohoAccount',_0x3aef16,JSON['stringify'](_0x251b4b));_0x25cd16(_0x251b4b);})[_0xc229('0x12')](function(_0x4eafbd){logger['error']('ShowZohoAccount',_0x4eafbd[_0xc229('0x10')],_0x3aef16);_0x2e7fe7(_0x4192d0['error'](0x1f4,_0x4eafbd['message']));});});}; \ No newline at end of file +var _0x3cdd=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','ZohoAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','map','model','attributes','stringify','ShowZohoAccount','find','raw'];(function(_0x5c1a64,_0x4d8fcd){var _0x49ecd0=function(_0xfb8f58){while(--_0xfb8f58){_0x5c1a64['push'](_0x5c1a64['shift']());}};_0x49ecd0(++_0x4d8fcd);}(_0x3cdd,0xe0));var _0xd3cd=function(_0x2685ca,_0x58bd8c){_0x2685ca=_0x2685ca-0x0;var _0x668910=_0x3cdd[_0x2685ca];return _0x668910;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd3cd('0x0'));var BPromise=require(_0xd3cd('0x1'));var rs=require(_0xd3cd('0x2'));var fs=require('fs');var Redis=require(_0xd3cd('0x3'));var db=require(_0xd3cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3cd('0x5'))(_0xd3cd('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd3cd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d6bee,_0x2a96c0,_0x319710){return new BPromise(function(_0x42bd50,_0x1d970d){return client['request'](_0x1d6bee,_0x319710)[_0xd3cd('0x8')](function(_0x3ae791){logger[_0xd3cd('0x9')]('ZohoAccount,\x20%s,\x20%s',_0x2a96c0,'request\x20sent');logger[_0xd3cd('0xa')](_0xd3cd('0xb'),_0x2a96c0,'request\x20sent',JSON['stringify'](_0x3ae791));if(_0x3ae791[_0xd3cd('0xc')]){if(_0x3ae791[_0xd3cd('0xc')]['code']===0x1f4){logger[_0xd3cd('0xc')](_0xd3cd('0xd'),_0x2a96c0,_0x3ae791['error']['message']);return _0x1d970d(_0x3ae791[_0xd3cd('0xc')]['message']);}logger['error'](_0xd3cd('0xd'),_0x2a96c0,_0x3ae791[_0xd3cd('0xc')][_0xd3cd('0xe')]);return _0x42bd50(_0x3ae791[_0xd3cd('0xc')][_0xd3cd('0xe')]);}else{logger['info'](_0xd3cd('0xd'),_0x2a96c0,_0xd3cd('0xf'));_0x42bd50(_0x3ae791[_0xd3cd('0x10')][_0xd3cd('0xe')]);}})[_0xd3cd('0x11')](function(_0x582645){logger[_0xd3cd('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x2a96c0,_0x582645);_0x1d970d(_0x582645);});});}exports[_0xd3cd('0x12')]=function(_0x2d2c4a){var _0x5e2e76=this;return new Promise(function(_0x2a8c94,_0x2dfc4c){return db[_0xd3cd('0x13')][_0xd3cd('0x14')]({'raw':_0x2d2c4a['options']?_0x2d2c4a['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d2c4a[_0xd3cd('0x15')]?_0x2d2c4a[_0xd3cd('0x15')][_0xd3cd('0x16')]||null:null,'attributes':_0x2d2c4a[_0xd3cd('0x15')]?_0x2d2c4a[_0xd3cd('0x15')]['attributes']||null:null,'limit':_0x2d2c4a[_0xd3cd('0x15')]?_0x2d2c4a[_0xd3cd('0x15')][_0xd3cd('0x17')]||null:null,'include':_0x2d2c4a[_0xd3cd('0x15')]?_0x2d2c4a[_0xd3cd('0x15')][_0xd3cd('0x18')]?_[_0xd3cd('0x19')](_0x2d2c4a[_0xd3cd('0x15')]['include'],function(_0x2d9897){return{'model':db[_0x2d9897[_0xd3cd('0x1a')]],'as':_0x2d9897['as'],'attributes':_0x2d9897['attributes'],'include':_0x2d9897[_0xd3cd('0x18')]?_[_0xd3cd('0x19')](_0x2d9897[_0xd3cd('0x18')],function(_0x246f68){return{'model':db[_0x246f68[_0xd3cd('0x1a')]],'as':_0x246f68['as'],'attributes':_0x246f68[_0xd3cd('0x1b')],'include':_0x246f68[_0xd3cd('0x18')]?_[_0xd3cd('0x19')](_0x246f68[_0xd3cd('0x18')],function(_0x30e3d3){return{'model':db[_0x30e3d3[_0xd3cd('0x1a')]],'as':_0x30e3d3['as'],'attributes':_0x30e3d3[_0xd3cd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd3cd('0x8')](function(_0x406c8c){logger[_0xd3cd('0x9')]('GetZohoAccount',_0x2d2c4a);logger[_0xd3cd('0xa')]('GetZohoAccount',_0x2d2c4a,JSON[_0xd3cd('0x1c')](_0x406c8c));_0x2a8c94(_0x406c8c);})[_0xd3cd('0x11')](function(_0x131655){logger[_0xd3cd('0xc')](_0xd3cd('0x12'),_0x131655[_0xd3cd('0xe')],_0x2d2c4a);_0x2dfc4c(_0x5e2e76[_0xd3cd('0xc')](0x1f4,_0x131655[_0xd3cd('0xe')]));});});};exports[_0xd3cd('0x1d')]=function(_0xe00be8){var _0xe94211=this;return new Promise(function(_0x189299,_0x1b7048){return db[_0xd3cd('0x13')][_0xd3cd('0x1e')]({'raw':_0xe00be8[_0xd3cd('0x15')]?_0xe00be8['options'][_0xd3cd('0x1f')]===undefined?!![]:![]:!![],'where':_0xe00be8['options']?_0xe00be8[_0xd3cd('0x15')][_0xd3cd('0x16')]||null:null,'attributes':_0xe00be8['options']?_0xe00be8[_0xd3cd('0x15')][_0xd3cd('0x1b')]||null:null,'include':_0xe00be8[_0xd3cd('0x15')]?_0xe00be8[_0xd3cd('0x15')][_0xd3cd('0x18')]?_[_0xd3cd('0x19')](_0xe00be8[_0xd3cd('0x15')][_0xd3cd('0x18')],function(_0x1efafd){return{'model':db[_0x1efafd[_0xd3cd('0x1a')]],'as':_0x1efafd['as'],'attributes':_0x1efafd[_0xd3cd('0x1b')],'include':_0x1efafd['include']?_[_0xd3cd('0x19')](_0x1efafd['include'],function(_0x38d4bd){return{'model':db[_0x38d4bd['model']],'as':_0x38d4bd['as'],'attributes':_0x38d4bd[_0xd3cd('0x1b')],'include':_0x38d4bd[_0xd3cd('0x18')]?_[_0xd3cd('0x19')](_0x38d4bd[_0xd3cd('0x18')],function(_0x5bc990){return{'model':db[_0x5bc990['model']],'as':_0x5bc990['as'],'attributes':_0x5bc990['attributes']};}):[]};}):[]};}):[]:[]})[_0xd3cd('0x8')](function(_0x4d0ae3){logger[_0xd3cd('0x9')](_0xd3cd('0x1d'),_0xe00be8);logger[_0xd3cd('0xa')](_0xd3cd('0x1d'),_0xe00be8,JSON[_0xd3cd('0x1c')](_0x4d0ae3));_0x189299(_0x4d0ae3);})[_0xd3cd('0x11')](function(_0xd79a5b){logger[_0xd3cd('0xc')](_0xd3cd('0x1d'),_0xd79a5b[_0xd3cd('0xe')],_0xe00be8);_0x1b7048(_0xe94211[_0xd3cd('0xc')](0x1f4,_0xd79a5b[_0xd3cd('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ebf06cf..acbaa34 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 _0x2a41=['getDescriptions','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x4ffbef,_0x2c7f88){var _0xc25296=function(_0x516f3b){while(--_0x516f3b){_0x4ffbef['push'](_0x4ffbef['shift']());}};_0xc25296(++_0x2c7f88);}(_0x2a41,0x126));var _0x12a4=function(_0x3c8168,_0x461028){_0x3c8168=_0x3c8168-0x0;var _0x20d28a=_0x2a41[_0x3c8168];return _0x20d28a;};'use strict';var multer=require(_0x12a4('0x0'));var util=require('util');var path=require(_0x12a4('0x1'));var timeout=require(_0x12a4('0x2'));var express=require(_0x12a4('0x3'));var router=express[_0x12a4('0x4')]();var auth=require(_0x12a4('0x5'));var interaction=require(_0x12a4('0x6'));var config=require(_0x12a4('0x7'));var controller=require(_0x12a4('0x8'));router[_0x12a4('0x9')]('/',auth['isAuthenticated'](),controller[_0x12a4('0xa')]);router[_0x12a4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x12a4('0xb')]);router['get'](_0x12a4('0xc'),auth[_0x12a4('0xd')](),controller[_0x12a4('0xe')]);router[_0x12a4('0x9')](_0x12a4('0xf'),auth['isAuthenticated'](),controller[_0x12a4('0x10')]);router[_0x12a4('0x9')](_0x12a4('0x11'),auth[_0x12a4('0xd')](),controller[_0x12a4('0x12')]);router[_0x12a4('0x13')]('/',auth[_0x12a4('0xd')](),controller[_0x12a4('0x14')]);router[_0x12a4('0x15')](_0x12a4('0x16'),auth[_0x12a4('0xd')](),controller[_0x12a4('0x17')]);router['delete'](_0x12a4('0x16'),auth[_0x12a4('0xd')](),controller[_0x12a4('0x18')]);module[_0x12a4('0x19')]=router; \ No newline at end of file +var _0xb16f=['put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','/:id','show','/:id/fields','isAuthenticated','getSubjects','get','/:id/descriptions','getDescriptions','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb16f,0xf6));var _0xfb16=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xb16f[_0x37756b];return _0x46efec;};'use strict';var multer=require(_0xfb16('0x0'));var util=require(_0xfb16('0x1'));var path=require(_0xfb16('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb16('0x3'));var router=express[_0xfb16('0x4')]();var auth=require(_0xfb16('0x5'));var interaction=require(_0xfb16('0x6'));var config=require('../../config/environment');var controller=require(_0xfb16('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xfb16('0x8'),auth['isAuthenticated'](),controller[_0xfb16('0x9')]);router['get'](_0xfb16('0xa'),auth[_0xfb16('0xb')](),controller['getFields']);router['get']('/:id/subjects',auth[_0xfb16('0xb')](),controller[_0xfb16('0xc')]);router[_0xfb16('0xd')](_0xfb16('0xe'),auth[_0xfb16('0xb')](),controller[_0xfb16('0xf')]);router[_0xfb16('0x10')]('/',auth[_0xfb16('0xb')](),controller[_0xfb16('0x11')]);router[_0xfb16('0x12')](_0xfb16('0x8'),auth['isAuthenticated'](),controller[_0xfb16('0x13')]);router['delete']('/:id',auth[_0xfb16('0xb')](),controller[_0xfb16('0x14')]);module[_0xfb16('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 5d35f74..03318ba 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 _0x02e8=['contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x2f8306,_0x34c68a){var _0x2f7248=function(_0x7828e9){while(--_0x7828e9){_0x2f8306['push'](_0x2f8306['shift']());}};_0x2f7248(++_0x34c68a);}(_0x02e8,0x1c1));var _0x802e=function(_0x38cf3d,_0x2b8f37){_0x38cf3d=_0x38cf3d-0x0;var _0x4b97f0=_0x02e8[_0x38cf3d];return _0x4b97f0;};'use strict';var Sequelize=require(_0x802e('0x0'));module[_0x802e('0x1')]={'name':{'type':Sequelize[_0x802e('0x2')]},'moduleCreate':{'type':Sequelize[_0x802e('0x3')](_0x802e('0x4'),_0x802e('0x5'),'nothing'),'defaultValue':_0x802e('0x4')},'moduleSearch':{'type':Sequelize[_0x802e('0x3')]('contact_lead',_0x802e('0x5'),_0x802e('0x4')),'defaultValue':_0x802e('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1cf8=['lead','contact','nothing','contact_lead','STRING','sequelize','ENUM'];(function(_0x78029b,_0x19ce64){var _0x2c1b66=function(_0x3d1543){while(--_0x3d1543){_0x78029b['push'](_0x78029b['shift']());}};_0x2c1b66(++_0x19ce64);}(_0x1cf8,0x147));var _0x81cf=function(_0x4f3242,_0x391954){_0x4f3242=_0x4f3242-0x0;var _0x49844f=_0x1cf8[_0x4f3242];return _0x49844f;};'use strict';var Sequelize=require(_0x81cf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x81cf('0x1')](_0x81cf('0x2'),_0x81cf('0x3'),_0x81cf('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x81cf('0x1')](_0x81cf('0x5'),'contact',_0x81cf('0x2')),'defaultValue':_0x81cf('0x5')},'description':{'type':Sequelize[_0x81cf('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index edf1056..44061ae 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 _0xc023=['send','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','ZohoConfiguration','includeAll','include','show','find','create','body','params','ZohoField','filter','getFields','getSubjects','findOne','getDescriptions','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','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','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','end','stack','name'];(function(_0xa261f5,_0x37ed4e){var _0x4a889b=function(_0x2e1c9f){while(--_0x2e1c9f){_0xa261f5['push'](_0xa261f5['shift']());}};_0x4a889b(++_0x37ed4e);}(_0xc023,0x18b));var _0x3c02=function(_0x1f15cb,_0x16f055){_0x1f15cb=_0x1f15cb-0x0;var _0x171557=_0xc023[_0x1f15cb];return _0x171557;};'use strict';var pdf=require(_0x3c02('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3c02('0x1'));var jsonpatch=require(_0x3c02('0x2'));var rp=require(_0x3c02('0x3'));var moment=require(_0x3c02('0x4'));var BPromise=require(_0x3c02('0x5'));var Mustache=require(_0x3c02('0x6'));var util=require(_0x3c02('0x7'));var path=require(_0x3c02('0x8'));var sox=require(_0x3c02('0x9'));var csv=require(_0x3c02('0xa'));var ejs=require(_0x3c02('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c02('0xc'));var crypto=require(_0x3c02('0xd'));var jsforce=require(_0x3c02('0xe'));var deskjs=require(_0x3c02('0xf'));var toCsv=require(_0x3c02('0xa'));var querystring=require(_0x3c02('0x10'));var Papa=require(_0x3c02('0x11'));var Redis=require(_0x3c02('0x12'));var authService=require(_0x3c02('0x13'));var qs=require(_0x3c02('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c02('0x15'));var logger=require('../../config/logger')(_0x3c02('0x16'));var utils=require(_0x3c02('0x17'));var config=require(_0x3c02('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3c02('0x19'));var client=jayson['client'][_0x3c02('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3252ef,_0x3501fb,_0x7ad08){if(_0x7ad08){var _0xbe5471=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xbe5471['test'](_0x3501fb)){return _0x3252ef;}else{throw new db['Sequelize'][(_0x3c02('0x1b'))](_0x3c02('0x1c'));}}else{return _0x3252ef;}}function respondWithRpcPromise(_0x2453e6,_0x1a9cb6,_0x4913e5,_0x327adb){return new BPromise(function(_0x5828b3,_0x29c813){var _0x13ad1a=_0x327adb||client;return _0x13ad1a['request'](_0x2453e6,_0x4913e5)[_0x3c02('0x1d')](function(_0x403f74){logger[_0x3c02('0x1e')](_0x3c02('0x1f'),_0x1a9cb6,_0x3c02('0x20'));logger[_0x3c02('0x21')](_0x3c02('0x22'),_0x1a9cb6,_0x3c02('0x20'),JSON['stringify'](_0x403f74));if(_0x403f74[_0x3c02('0x23')]){if(_0x403f74['error'][_0x3c02('0x24')]===0x1f4){logger[_0x3c02('0x23')](_0x3c02('0x1f'),_0x1a9cb6,_0x403f74[_0x3c02('0x23')][_0x3c02('0x25')]);return _0x29c813(_0x403f74[_0x3c02('0x23')][_0x3c02('0x25')]);}logger[_0x3c02('0x23')](_0x3c02('0x1f'),_0x1a9cb6,_0x403f74[_0x3c02('0x23')][_0x3c02('0x25')]);return _0x5828b3(_0x403f74[_0x3c02('0x23')][_0x3c02('0x25')]);}else{logger[_0x3c02('0x1e')]('ZohoConfiguration,\x20%s,\x20%s',_0x1a9cb6,_0x3c02('0x20'));_0x5828b3(_0x403f74[_0x3c02('0x26')][_0x3c02('0x25')]);}})[_0x3c02('0x27')](function(_0x2671ca){logger[_0x3c02('0x23')]('ZohoConfiguration,\x20%s,\x20%s',_0x1a9cb6,_0x2671ca);_0x29c813(_0x2671ca);});});}function respondWithStatusCode(_0xcbc994,_0x4022ed){_0x4022ed=_0x4022ed||0xcc;return function(_0x486eb5){if(_0x486eb5){return _0xcbc994[_0x3c02('0x28')](_0x4022ed);}return _0xcbc994[_0x3c02('0x29')](_0x4022ed)['end']();};}function respondWithResult(_0x3fc776,_0x1ab82b){_0x1ab82b=_0x1ab82b||0xc8;return function(_0x5025f5){if(_0x5025f5){return _0x3fc776['status'](_0x1ab82b)[_0x3c02('0x2a')](_0x5025f5);}};}function respondWithFilteredResult(_0x9efa74,_0x328fd7){return function(_0x1b5960){if(_0x1b5960){var _0x416909=_0x1b5960[_0x3c02('0x2b')],_0x48b956=_0x328fd7[_0x3c02('0x2c')],_0x3b8b48=_0x328fd7[_0x3c02('0x2c')]+_0x328fd7[_0x3c02('0x2d')],_0x49c828;if(_0x3b8b48>=_0x416909){_0x3b8b48=_0x416909;_0x49c828=0xc8;}else{_0x49c828=0xce;}_0x9efa74[_0x3c02('0x29')](_0x49c828);return _0x9efa74[_0x3c02('0x2e')]('Content-Range',_0x48b956+'-'+_0x3b8b48+'/'+_0x416909)['json'](_0x1b5960);}return null;};}function patchUpdates(_0xb56146){return function(_0xa3ff17){try{jsonpatch[_0x3c02('0x2f')](_0xa3ff17,_0xb56146,!![]);}catch(_0x29dd7a){return BPromise[_0x3c02('0x30')](_0x29dd7a);}return _0xa3ff17[_0x3c02('0x31')]();};}function saveUpdates(_0x487193,_0x514035){return function(_0x151fb2){if(_0x151fb2){return _0x151fb2[_0x3c02('0x32')](_0x487193)[_0x3c02('0x1d')](function(_0x574834){return _0x574834;});}return null;};}function removeEntity(_0x5381dc,_0x4f3e79){return function(_0x23619f){if(_0x23619f){return _0x23619f[_0x3c02('0x33')]()['then'](function(){_0x5381dc['status'](0xcc)[_0x3c02('0x34')]();});}};}function handleEntityNotFound(_0x2d660d,_0x25a27f){return function(_0x312855){if(!_0x312855){_0x2d660d[_0x3c02('0x28')](0x194);}return _0x312855;};}function handleError(_0x137468,_0x5c6367){_0x5c6367=_0x5c6367||0x1f4;return function(_0x5ea5a3){logger[_0x3c02('0x23')](_0x5ea5a3[_0x3c02('0x35')]);if(_0x5ea5a3[_0x3c02('0x36')]){delete _0x5ea5a3[_0x3c02('0x36')];}_0x137468[_0x3c02('0x29')](_0x5c6367)[_0x3c02('0x37')](_0x5ea5a3);};}exports['index']=function(_0x3b0a8d,_0x54b7d0){var _0x20c635={},_0x1e76de={},_0x5e5f3b={'count':0x0,'rows':[]};var _0x581d68=_['map'](db['ZohoConfiguration'][_0x3c02('0x38')],function(_0x53ca3c){return{'name':_0x53ca3c[_0x3c02('0x39')],'type':_0x53ca3c['type']['key']};});_0x1e76de[_0x3c02('0x3a')]=_[_0x3c02('0x3b')](_0x581d68,_0x3c02('0x36'));_0x1e76de[_0x3c02('0x3c')]=_[_0x3c02('0x3d')](_0x3b0a8d['query']);_0x1e76de[_0x3c02('0x3e')]=_[_0x3c02('0x3f')](_0x1e76de['model'],_0x1e76de[_0x3c02('0x3c')]);_0x20c635['attributes']=_[_0x3c02('0x3f')](_0x1e76de[_0x3c02('0x3a')],qs[_0x3c02('0x40')](_0x3b0a8d['query']['fields']));_0x20c635[_0x3c02('0x41')]=_0x20c635[_0x3c02('0x41')][_0x3c02('0x42')]?_0x20c635[_0x3c02('0x41')]:_0x1e76de[_0x3c02('0x3a')];if(!_0x3b0a8d['query'][_0x3c02('0x43')](_0x3c02('0x44'))){_0x20c635[_0x3c02('0x2d')]=qs['limit'](_0x3b0a8d[_0x3c02('0x3c')][_0x3c02('0x2d')]);_0x20c635[_0x3c02('0x2c')]=qs['offset'](_0x3b0a8d[_0x3c02('0x3c')][_0x3c02('0x2c')]);}_0x20c635[_0x3c02('0x45')]=qs[_0x3c02('0x46')](_0x3b0a8d[_0x3c02('0x3c')][_0x3c02('0x46')]);_0x20c635[_0x3c02('0x47')]=qs['filters'](_[_0x3c02('0x48')](_0x3b0a8d['query'],_0x1e76de['filters']),_0x581d68);if(_0x3b0a8d[_0x3c02('0x3c')]['filter']){_0x20c635[_0x3c02('0x47')]=_['merge'](_0x20c635[_0x3c02('0x47')],{'$or':_[_0x3c02('0x3b')](_0x581d68,function(_0x509634){if(_0x509634['type']!==_0x3c02('0x49')){var _0x5ddee7={};_0x5ddee7[_0x509634[_0x3c02('0x36')]]={'$like':'%'+_0x3b0a8d[_0x3c02('0x3c')]['filter']+'%'};return _0x5ddee7;}})});}_0x20c635=_[_0x3c02('0x4a')]({},_0x20c635,_0x3b0a8d[_0x3c02('0x4b')]);var _0x1c8a7a={'where':_0x20c635[_0x3c02('0x47')]};return db[_0x3c02('0x4c')][_0x3c02('0x2b')](_0x1c8a7a)[_0x3c02('0x1d')](function(_0xd1d590){_0x5e5f3b['count']=_0xd1d590;if(_0x3b0a8d[_0x3c02('0x3c')][_0x3c02('0x4d')]){_0x20c635[_0x3c02('0x4e')]=[{'all':!![]}];}return db[_0x3c02('0x4c')]['findAll'](_0x20c635);})[_0x3c02('0x1d')](function(_0x1bce47){_0x5e5f3b['rows']=_0x1bce47;return _0x5e5f3b;})['then'](respondWithFilteredResult(_0x54b7d0,_0x20c635))[_0x3c02('0x27')](handleError(_0x54b7d0,null));};exports[_0x3c02('0x4f')]=function(_0x337388,_0x1310bf){var _0x1de4cc={'raw':![],'where':{'id':_0x337388['params']['id']}},_0x554750={};_0x554750[_0x3c02('0x3a')]=_[_0x3c02('0x3d')](db[_0x3c02('0x4c')][_0x3c02('0x38')]);_0x554750[_0x3c02('0x3c')]=_[_0x3c02('0x3d')](_0x337388[_0x3c02('0x3c')]);_0x554750[_0x3c02('0x3e')]=_['intersection'](_0x554750[_0x3c02('0x3a')],_0x554750[_0x3c02('0x3c')]);_0x1de4cc[_0x3c02('0x41')]=_['intersection'](_0x554750[_0x3c02('0x3a')],qs[_0x3c02('0x40')](_0x337388[_0x3c02('0x3c')]['fields']));_0x1de4cc['attributes']=_0x1de4cc[_0x3c02('0x41')][_0x3c02('0x42')]?_0x1de4cc[_0x3c02('0x41')]:_0x554750[_0x3c02('0x3a')];if(_0x337388[_0x3c02('0x3c')]['includeAll']){_0x1de4cc[_0x3c02('0x4e')]=[{'all':!![]}];}_0x1de4cc=_[_0x3c02('0x4a')]({},_0x1de4cc,_0x337388[_0x3c02('0x4b')]);return db[_0x3c02('0x4c')][_0x3c02('0x50')](_0x1de4cc)[_0x3c02('0x1d')](handleEntityNotFound(_0x1310bf,null))[_0x3c02('0x1d')](respondWithResult(_0x1310bf,null))[_0x3c02('0x27')](handleError(_0x1310bf,null));};exports[_0x3c02('0x51')]=function(_0x2fb8e7,_0x5fcefe){return db[_0x3c02('0x4c')][_0x3c02('0x51')](_0x2fb8e7[_0x3c02('0x52')],{})[_0x3c02('0x1d')](respondWithResult(_0x5fcefe,0xc9))[_0x3c02('0x27')](handleError(_0x5fcefe,null));};exports['update']=function(_0x210135,_0x3d128d){if(_0x210135['body']['id']){delete _0x210135[_0x3c02('0x52')]['id'];}return db[_0x3c02('0x4c')][_0x3c02('0x50')]({'where':{'id':_0x210135['params']['id']}})[_0x3c02('0x1d')](handleEntityNotFound(_0x3d128d,null))[_0x3c02('0x1d')](saveUpdates(_0x210135[_0x3c02('0x52')],null))[_0x3c02('0x1d')](respondWithResult(_0x3d128d,null))[_0x3c02('0x27')](handleError(_0x3d128d,null));};exports['destroy']=function(_0x11bee9,_0x53a1ee){return db[_0x3c02('0x4c')][_0x3c02('0x50')]({'where':{'id':_0x11bee9[_0x3c02('0x53')]['id']}})[_0x3c02('0x1d')](handleEntityNotFound(_0x53a1ee,null))[_0x3c02('0x1d')](removeEntity(_0x53a1ee,null))[_0x3c02('0x27')](handleError(_0x53a1ee,null));};exports['getFields']=function(_0x473153,_0x246006,_0x26bb89){var _0x4d93b3={};var _0x21f202={};var _0x3e5f86;var _0x14b48;return db[_0x3c02('0x4c')]['findOne']({'where':{'id':_0x473153[_0x3c02('0x53')]['id']}})[_0x3c02('0x1d')](handleEntityNotFound(_0x246006,null))[_0x3c02('0x1d')](function(_0x18e447){if(_0x18e447){_0x3e5f86=_0x18e447;_0x21f202[_0x3c02('0x3a')]=_[_0x3c02('0x3d')](db[_0x3c02('0x54')][_0x3c02('0x38')]);_0x21f202[_0x3c02('0x3c')]=_[_0x3c02('0x3d')](_0x473153[_0x3c02('0x3c')]);_0x21f202['filters']=_[_0x3c02('0x3f')](_0x21f202['model'],_0x21f202[_0x3c02('0x3c')]);_0x4d93b3[_0x3c02('0x41')]=_[_0x3c02('0x3f')](_0x21f202[_0x3c02('0x3a')],qs[_0x3c02('0x40')](_0x473153['query'][_0x3c02('0x40')]));_0x4d93b3[_0x3c02('0x41')]=_0x4d93b3['attributes']['length']?_0x4d93b3[_0x3c02('0x41')]:_0x21f202[_0x3c02('0x3a')];_0x4d93b3[_0x3c02('0x45')]=qs[_0x3c02('0x46')](_0x473153[_0x3c02('0x3c')][_0x3c02('0x46')]);_0x4d93b3[_0x3c02('0x47')]=qs[_0x3c02('0x3e')](_[_0x3c02('0x48')](_0x473153['query'],_0x21f202[_0x3c02('0x3e')]));if(_0x473153[_0x3c02('0x3c')][_0x3c02('0x55')]){_0x4d93b3[_0x3c02('0x47')]=_[_0x3c02('0x4a')](_0x4d93b3[_0x3c02('0x47')],{'$or':_[_0x3c02('0x3b')](_0x4d93b3[_0x3c02('0x41')],function(_0x1dbec4){var _0x48245e={};_0x48245e[_0x1dbec4]={'$like':'%'+_0x473153[_0x3c02('0x3c')]['filter']+'%'};return _0x48245e;})});}_0x4d93b3=_[_0x3c02('0x4a')]({},_0x4d93b3,_0x473153[_0x3c02('0x4b')]);return _0x3e5f86['getFields'](_0x4d93b3);}})[_0x3c02('0x1d')](function(_0x5c23bb){if(_0x5c23bb){_0x14b48=_0x5c23bb['length'];if(!_0x473153['query'][_0x3c02('0x43')]('nolimit')){_0x4d93b3[_0x3c02('0x2d')]=qs['limit'](_0x473153['query'][_0x3c02('0x2d')]);_0x4d93b3['offset']=qs['offset'](_0x473153['query'][_0x3c02('0x2c')]);}return _0x3e5f86[_0x3c02('0x56')](_0x4d93b3);}})[_0x3c02('0x1d')](function(_0x4a9525){if(_0x4a9525){return _0x4a9525?{'count':_0x14b48,'rows':_0x4a9525}:null;}})[_0x3c02('0x1d')](respondWithResult(_0x246006,null))['catch'](handleError(_0x246006,null));};exports[_0x3c02('0x57')]=function(_0xb73876,_0x14a97d,_0x2c927f){var _0x336e15={};var _0x126441={};var _0x3de802;var _0x302c94;return db['ZohoConfiguration'][_0x3c02('0x58')]({'where':{'id':_0xb73876[_0x3c02('0x53')]['id']}})[_0x3c02('0x1d')](handleEntityNotFound(_0x14a97d,null))[_0x3c02('0x1d')](function(_0x1a53c5){if(_0x1a53c5){_0x3de802=_0x1a53c5;_0x126441['model']=_['keys'](db['ZohoField']['rawAttributes']);_0x126441[_0x3c02('0x3c')]=_[_0x3c02('0x3d')](_0xb73876[_0x3c02('0x3c')]);_0x126441[_0x3c02('0x3e')]=_[_0x3c02('0x3f')](_0x126441[_0x3c02('0x3a')],_0x126441[_0x3c02('0x3c')]);_0x336e15[_0x3c02('0x41')]=_[_0x3c02('0x3f')](_0x126441['model'],qs['fields'](_0xb73876[_0x3c02('0x3c')][_0x3c02('0x40')]));_0x336e15[_0x3c02('0x41')]=_0x336e15[_0x3c02('0x41')][_0x3c02('0x42')]?_0x336e15[_0x3c02('0x41')]:_0x126441[_0x3c02('0x3a')];_0x336e15['order']=qs['sort'](_0xb73876[_0x3c02('0x3c')][_0x3c02('0x46')]);_0x336e15[_0x3c02('0x47')]=qs['filters'](_[_0x3c02('0x48')](_0xb73876[_0x3c02('0x3c')],_0x126441[_0x3c02('0x3e')]));if(_0xb73876[_0x3c02('0x3c')]['filter']){_0x336e15[_0x3c02('0x47')]=_[_0x3c02('0x4a')](_0x336e15[_0x3c02('0x47')],{'$or':_[_0x3c02('0x3b')](_0x336e15[_0x3c02('0x41')],function(_0x1df34e){var _0x1fa2d2={};_0x1fa2d2[_0x1df34e]={'$like':'%'+_0xb73876[_0x3c02('0x3c')][_0x3c02('0x55')]+'%'};return _0x1fa2d2;})});}_0x336e15=_[_0x3c02('0x4a')]({},_0x336e15,_0xb73876[_0x3c02('0x4b')]);return _0x3de802['getSubjects'](_0x336e15);}})['then'](function(_0x2c3171){if(_0x2c3171){_0x302c94=_0x2c3171[_0x3c02('0x42')];if(!_0xb73876[_0x3c02('0x3c')][_0x3c02('0x43')](_0x3c02('0x44'))){_0x336e15[_0x3c02('0x2d')]=qs[_0x3c02('0x2d')](_0xb73876['query'][_0x3c02('0x2d')]);_0x336e15[_0x3c02('0x2c')]=qs[_0x3c02('0x2c')](_0xb73876[_0x3c02('0x3c')]['offset']);}return _0x3de802['getSubjects'](_0x336e15);}})[_0x3c02('0x1d')](function(_0x136b05){if(_0x136b05){return _0x136b05?{'count':_0x302c94,'rows':_0x136b05}:null;}})[_0x3c02('0x1d')](respondWithResult(_0x14a97d,null))[_0x3c02('0x27')](handleError(_0x14a97d,null));};exports[_0x3c02('0x59')]=function(_0x3422b0,_0x5c7cab,_0x5abcfa){var _0x47fcfa={};var _0xc1bfe8={};var _0x366dfd;var _0x57be7e;return db[_0x3c02('0x4c')][_0x3c02('0x58')]({'where':{'id':_0x3422b0[_0x3c02('0x53')]['id']}})['then'](handleEntityNotFound(_0x5c7cab,null))[_0x3c02('0x1d')](function(_0x40875f){if(_0x40875f){_0x366dfd=_0x40875f;_0xc1bfe8[_0x3c02('0x3a')]=_[_0x3c02('0x3d')](db[_0x3c02('0x54')][_0x3c02('0x38')]);_0xc1bfe8[_0x3c02('0x3c')]=_[_0x3c02('0x3d')](_0x3422b0[_0x3c02('0x3c')]);_0xc1bfe8[_0x3c02('0x3e')]=_[_0x3c02('0x3f')](_0xc1bfe8[_0x3c02('0x3a')],_0xc1bfe8['query']);_0x47fcfa['attributes']=_[_0x3c02('0x3f')](_0xc1bfe8['model'],qs[_0x3c02('0x40')](_0x3422b0[_0x3c02('0x3c')]['fields']));_0x47fcfa[_0x3c02('0x41')]=_0x47fcfa[_0x3c02('0x41')][_0x3c02('0x42')]?_0x47fcfa[_0x3c02('0x41')]:_0xc1bfe8[_0x3c02('0x3a')];_0x47fcfa['order']=qs[_0x3c02('0x46')](_0x3422b0[_0x3c02('0x3c')]['sort']);_0x47fcfa[_0x3c02('0x47')]=qs['filters'](_[_0x3c02('0x48')](_0x3422b0[_0x3c02('0x3c')],_0xc1bfe8[_0x3c02('0x3e')]));if(_0x3422b0[_0x3c02('0x3c')][_0x3c02('0x55')]){_0x47fcfa[_0x3c02('0x47')]=_[_0x3c02('0x4a')](_0x47fcfa[_0x3c02('0x47')],{'$or':_[_0x3c02('0x3b')](_0x47fcfa[_0x3c02('0x41')],function(_0x3405c8){var _0x27f88f={};_0x27f88f[_0x3405c8]={'$like':'%'+_0x3422b0[_0x3c02('0x3c')][_0x3c02('0x55')]+'%'};return _0x27f88f;})});}_0x47fcfa=_[_0x3c02('0x4a')]({},_0x47fcfa,_0x3422b0[_0x3c02('0x4b')]);return _0x366dfd[_0x3c02('0x59')](_0x47fcfa);}})[_0x3c02('0x1d')](function(_0x21a41b){if(_0x21a41b){_0x57be7e=_0x21a41b[_0x3c02('0x42')];if(!_0x3422b0[_0x3c02('0x3c')][_0x3c02('0x43')](_0x3c02('0x44'))){_0x47fcfa[_0x3c02('0x2d')]=qs[_0x3c02('0x2d')](_0x3422b0[_0x3c02('0x3c')][_0x3c02('0x2d')]);_0x47fcfa[_0x3c02('0x2c')]=qs[_0x3c02('0x2c')](_0x3422b0[_0x3c02('0x3c')]['offset']);}return _0x366dfd[_0x3c02('0x59')](_0x47fcfa);}})[_0x3c02('0x1d')](function(_0x4b0ce0){if(_0x4b0ce0){return _0x4b0ce0?{'count':_0x57be7e,'rows':_0x4b0ce0}:null;}})[_0x3c02('0x1d')](respondWithResult(_0x5c7cab,null))[_0x3c02('0x27')](handleError(_0x5c7cab,null));}; \ No newline at end of file +var _0xb4f4=['error','message','info','result','sendStatus','status','end','count','offset','Content-Range','json','reject','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','then','rows','show','keys','options','find','catch','create','body','params','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','nolimit','getDescriptions','html-pdf','eml-format','fast-json-patch','moment','mustache','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','ValidationError','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x2118af,_0x5bf739){var _0x1f14a5=function(_0x2432fe){while(--_0x2432fe){_0x2118af['push'](_0x2118af['shift']());}};_0x1f14a5(++_0x5bf739);}(_0xb4f4,0x8d));var _0x4b4f=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xb4f4[_0x1b6c6d];return _0x290d9d;};'use strict';var pdf=require(_0x4b4f('0x0'));var emlformat=require(_0x4b4f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4b4f('0x2'));var rp=require('request-promise');var moment=require(_0x4b4f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4b4f('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4b4f('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4b4f('0x6'));var crypto=require(_0x4b4f('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x4b4f('0x8'));var toCsv=require(_0x4b4f('0x5'));var querystring=require(_0x4b4f('0x9'));var Papa=require(_0x4b4f('0xa'));var Redis=require(_0x4b4f('0xb'));var authService=require(_0x4b4f('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x4b4f('0xd'));var hardwareService=require(_0x4b4f('0xe'));var logger=require('../../config/logger')(_0x4b4f('0xf'));var utils=require(_0x4b4f('0x10'));var config=require('../../config/environment');var db=require(_0x4b4f('0x11'))['db'];var jayson=require(_0x4b4f('0x12'));var client=jayson[_0x4b4f('0x13')][_0x4b4f('0x14')]({'port':0x232a});function checkPasswordPattern(_0xfa6754,_0x242073,_0x44cb2f){if(_0x44cb2f){var _0x322292=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x322292[_0x4b4f('0x15')](_0x242073)){return _0xfa6754;}else{throw new db['Sequelize'][(_0x4b4f('0x16'))]('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 _0xfa6754;}}function respondWithRpcPromise(_0x138c5c,_0x434b4a,_0x4f2363,_0x58fa51){return new BPromise(function(_0x1db451,_0x1dc345){var _0x1d1692=_0x58fa51||client;return _0x1d1692['request'](_0x138c5c,_0x4f2363)['then'](function(_0x37969a){logger['info'](_0x4b4f('0x17'),_0x434b4a,_0x4b4f('0x18'));logger[_0x4b4f('0x19')](_0x4b4f('0x1a'),_0x434b4a,'request\x20sent',JSON[_0x4b4f('0x1b')](_0x37969a));if(_0x37969a['error']){if(_0x37969a['error'][_0x4b4f('0x1c')]===0x1f4){logger['error'](_0x4b4f('0x17'),_0x434b4a,_0x37969a[_0x4b4f('0x1d')]['message']);return _0x1dc345(_0x37969a[_0x4b4f('0x1d')][_0x4b4f('0x1e')]);}logger[_0x4b4f('0x1d')](_0x4b4f('0x17'),_0x434b4a,_0x37969a['error'][_0x4b4f('0x1e')]);return _0x1db451(_0x37969a['error'][_0x4b4f('0x1e')]);}else{logger[_0x4b4f('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x434b4a,_0x4b4f('0x18'));_0x1db451(_0x37969a[_0x4b4f('0x20')]['message']);}})['catch'](function(_0x2cf20a){logger[_0x4b4f('0x1d')](_0x4b4f('0x17'),_0x434b4a,_0x2cf20a);_0x1dc345(_0x2cf20a);});});}function respondWithStatusCode(_0x4272af,_0x3844aa){_0x3844aa=_0x3844aa||0xcc;return function(_0x5053ae){if(_0x5053ae){return _0x4272af[_0x4b4f('0x21')](_0x3844aa);}return _0x4272af[_0x4b4f('0x22')](_0x3844aa)[_0x4b4f('0x23')]();};}function respondWithResult(_0x52c12d,_0x165b85){_0x165b85=_0x165b85||0xc8;return function(_0x1d5d32){if(_0x1d5d32){return _0x52c12d['status'](_0x165b85)['json'](_0x1d5d32);}};}function respondWithFilteredResult(_0x155e6d,_0x2ec5a5){return function(_0x42634b){if(_0x42634b){var _0x5719ab=_0x42634b[_0x4b4f('0x24')],_0xa27d73=_0x2ec5a5['offset'],_0x1df1d9=_0x2ec5a5[_0x4b4f('0x25')]+_0x2ec5a5['limit'],_0x25e9c7;if(_0x1df1d9>=_0x5719ab){_0x1df1d9=_0x5719ab;_0x25e9c7=0xc8;}else{_0x25e9c7=0xce;}_0x155e6d['status'](_0x25e9c7);return _0x155e6d['set'](_0x4b4f('0x26'),_0xa27d73+'-'+_0x1df1d9+'/'+_0x5719ab)[_0x4b4f('0x27')](_0x42634b);}return null;};}function patchUpdates(_0x23ebdc){return function(_0x155a05){try{jsonpatch['apply'](_0x155a05,_0x23ebdc,!![]);}catch(_0x53e105){return BPromise[_0x4b4f('0x28')](_0x53e105);}return _0x155a05['save']();};}function saveUpdates(_0x23edfc,_0x5c2028){return function(_0x3e06f8){if(_0x3e06f8){return _0x3e06f8['update'](_0x23edfc)['then'](function(_0x233384){return _0x233384;});}return null;};}function removeEntity(_0x5a25cd,_0xab427c){return function(_0x11d2eb){if(_0x11d2eb){return _0x11d2eb[_0x4b4f('0x29')]()['then'](function(){_0x5a25cd['status'](0xcc)[_0x4b4f('0x23')]();});}};}function handleEntityNotFound(_0x5bfa66,_0x38b0ea){return function(_0x4d8c90){if(!_0x4d8c90){_0x5bfa66[_0x4b4f('0x21')](0x194);}return _0x4d8c90;};}function handleError(_0x14c48a,_0x2f168b){_0x2f168b=_0x2f168b||0x1f4;return function(_0x5ab920){logger[_0x4b4f('0x1d')](_0x5ab920[_0x4b4f('0x2a')]);if(_0x5ab920[_0x4b4f('0x2b')]){delete _0x5ab920[_0x4b4f('0x2b')];}_0x14c48a['status'](_0x2f168b)[_0x4b4f('0x2c')](_0x5ab920);};}exports[_0x4b4f('0x2d')]=function(_0x254b33,_0x2cdb1d){var _0x14bdc5={},_0x3a2052={},_0x51ba3b={'count':0x0,'rows':[]};var _0x8e1def=_[_0x4b4f('0x2e')](db[_0x4b4f('0x2f')][_0x4b4f('0x30')],function(_0x4a64e3){return{'name':_0x4a64e3[_0x4b4f('0x31')],'type':_0x4a64e3['type']['key']};});_0x3a2052[_0x4b4f('0x32')]=_['map'](_0x8e1def,_0x4b4f('0x2b'));_0x3a2052[_0x4b4f('0x33')]=_['keys'](_0x254b33[_0x4b4f('0x33')]);_0x3a2052[_0x4b4f('0x34')]=_[_0x4b4f('0x35')](_0x3a2052[_0x4b4f('0x32')],_0x3a2052[_0x4b4f('0x33')]);_0x14bdc5['attributes']=_[_0x4b4f('0x35')](_0x3a2052['model'],qs[_0x4b4f('0x36')](_0x254b33[_0x4b4f('0x33')][_0x4b4f('0x36')]));_0x14bdc5[_0x4b4f('0x37')]=_0x14bdc5[_0x4b4f('0x37')][_0x4b4f('0x38')]?_0x14bdc5[_0x4b4f('0x37')]:_0x3a2052[_0x4b4f('0x32')];if(!_0x254b33[_0x4b4f('0x33')]['hasOwnProperty']('nolimit')){_0x14bdc5[_0x4b4f('0x39')]=qs['limit'](_0x254b33[_0x4b4f('0x33')][_0x4b4f('0x39')]);_0x14bdc5[_0x4b4f('0x25')]=qs[_0x4b4f('0x25')](_0x254b33[_0x4b4f('0x33')][_0x4b4f('0x25')]);}_0x14bdc5[_0x4b4f('0x3a')]=qs['sort'](_0x254b33[_0x4b4f('0x33')][_0x4b4f('0x3b')]);_0x14bdc5[_0x4b4f('0x3c')]=qs[_0x4b4f('0x34')](_[_0x4b4f('0x3d')](_0x254b33[_0x4b4f('0x33')],_0x3a2052[_0x4b4f('0x34')]),_0x8e1def);if(_0x254b33['query'][_0x4b4f('0x3e')]){_0x14bdc5['where']=_[_0x4b4f('0x3f')](_0x14bdc5[_0x4b4f('0x3c')],{'$or':_[_0x4b4f('0x2e')](_0x8e1def,function(_0x1280f0){if(_0x1280f0[_0x4b4f('0x40')]!=='VIRTUAL'){var _0x407894={};_0x407894[_0x1280f0['name']]={'$like':'%'+_0x254b33[_0x4b4f('0x33')]['filter']+'%'};return _0x407894;}})});}_0x14bdc5=_['merge']({},_0x14bdc5,_0x254b33['options']);var _0x4533a1={'where':_0x14bdc5[_0x4b4f('0x3c')]};return db[_0x4b4f('0x2f')][_0x4b4f('0x24')](_0x4533a1)['then'](function(_0x256dc8){_0x51ba3b[_0x4b4f('0x24')]=_0x256dc8;if(_0x254b33['query'][_0x4b4f('0x41')]){_0x14bdc5[_0x4b4f('0x42')]=[{'all':!![]}];}return db[_0x4b4f('0x2f')][_0x4b4f('0x43')](_0x14bdc5);})[_0x4b4f('0x44')](function(_0x28ed1a){_0x51ba3b[_0x4b4f('0x45')]=_0x28ed1a;return _0x51ba3b;})[_0x4b4f('0x44')](respondWithFilteredResult(_0x2cdb1d,_0x14bdc5))['catch'](handleError(_0x2cdb1d,null));};exports[_0x4b4f('0x46')]=function(_0x42ac8c,_0x2c38fe){var _0x553a56={'raw':![],'where':{'id':_0x42ac8c['params']['id']}},_0x5f40c2={};_0x5f40c2[_0x4b4f('0x32')]=_[_0x4b4f('0x47')](db[_0x4b4f('0x2f')][_0x4b4f('0x30')]);_0x5f40c2[_0x4b4f('0x33')]=_[_0x4b4f('0x47')](_0x42ac8c[_0x4b4f('0x33')]);_0x5f40c2[_0x4b4f('0x34')]=_['intersection'](_0x5f40c2[_0x4b4f('0x32')],_0x5f40c2[_0x4b4f('0x33')]);_0x553a56[_0x4b4f('0x37')]=_[_0x4b4f('0x35')](_0x5f40c2[_0x4b4f('0x32')],qs['fields'](_0x42ac8c[_0x4b4f('0x33')]['fields']));_0x553a56[_0x4b4f('0x37')]=_0x553a56[_0x4b4f('0x37')][_0x4b4f('0x38')]?_0x553a56[_0x4b4f('0x37')]:_0x5f40c2[_0x4b4f('0x32')];if(_0x42ac8c[_0x4b4f('0x33')]['includeAll']){_0x553a56['include']=[{'all':!![]}];}_0x553a56=_[_0x4b4f('0x3f')]({},_0x553a56,_0x42ac8c[_0x4b4f('0x48')]);return db[_0x4b4f('0x2f')][_0x4b4f('0x49')](_0x553a56)[_0x4b4f('0x44')](handleEntityNotFound(_0x2c38fe,null))['then'](respondWithResult(_0x2c38fe,null))[_0x4b4f('0x4a')](handleError(_0x2c38fe,null));};exports['create']=function(_0x40fcf6,_0x597ea1){return db[_0x4b4f('0x2f')][_0x4b4f('0x4b')](_0x40fcf6[_0x4b4f('0x4c')],{})[_0x4b4f('0x44')](respondWithResult(_0x597ea1,0xc9))[_0x4b4f('0x4a')](handleError(_0x597ea1,null));};exports['update']=function(_0x1bdfdc,_0x4f469a){if(_0x1bdfdc[_0x4b4f('0x4c')]['id']){delete _0x1bdfdc[_0x4b4f('0x4c')]['id'];}return db[_0x4b4f('0x2f')][_0x4b4f('0x49')]({'where':{'id':_0x1bdfdc['params']['id']}})[_0x4b4f('0x44')](handleEntityNotFound(_0x4f469a,null))[_0x4b4f('0x44')](saveUpdates(_0x1bdfdc['body'],null))[_0x4b4f('0x44')](respondWithResult(_0x4f469a,null))[_0x4b4f('0x4a')](handleError(_0x4f469a,null));};exports[_0x4b4f('0x29')]=function(_0x59646e,_0x33d6b3){return db[_0x4b4f('0x2f')][_0x4b4f('0x49')]({'where':{'id':_0x59646e[_0x4b4f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x33d6b3,null))[_0x4b4f('0x44')](removeEntity(_0x33d6b3,null))[_0x4b4f('0x4a')](handleError(_0x33d6b3,null));};exports[_0x4b4f('0x4e')]=function(_0x377598,_0x40e002,_0x1a058e){var _0x35d016={};var _0x2f31ed={};var _0x2d561f;var _0x4da63c;return db['ZohoConfiguration'][_0x4b4f('0x4f')]({'where':{'id':_0x377598['params']['id']}})[_0x4b4f('0x44')](handleEntityNotFound(_0x40e002,null))[_0x4b4f('0x44')](function(_0x3e602f){if(_0x3e602f){_0x2d561f=_0x3e602f;_0x2f31ed['model']=_['keys'](db[_0x4b4f('0x50')][_0x4b4f('0x30')]);_0x2f31ed[_0x4b4f('0x33')]=_[_0x4b4f('0x47')](_0x377598['query']);_0x2f31ed[_0x4b4f('0x34')]=_[_0x4b4f('0x35')](_0x2f31ed['model'],_0x2f31ed[_0x4b4f('0x33')]);_0x35d016[_0x4b4f('0x37')]=_['intersection'](_0x2f31ed[_0x4b4f('0x32')],qs[_0x4b4f('0x36')](_0x377598[_0x4b4f('0x33')][_0x4b4f('0x36')]));_0x35d016[_0x4b4f('0x37')]=_0x35d016['attributes'][_0x4b4f('0x38')]?_0x35d016['attributes']:_0x2f31ed[_0x4b4f('0x32')];_0x35d016['order']=qs['sort'](_0x377598[_0x4b4f('0x33')][_0x4b4f('0x3b')]);_0x35d016['where']=qs[_0x4b4f('0x34')](_['pick'](_0x377598[_0x4b4f('0x33')],_0x2f31ed['filters']));if(_0x377598[_0x4b4f('0x33')][_0x4b4f('0x3e')]){_0x35d016['where']=_[_0x4b4f('0x3f')](_0x35d016['where'],{'$or':_[_0x4b4f('0x2e')](_0x35d016['attributes'],function(_0x1d1639){var _0x16b0c9={};_0x16b0c9[_0x1d1639]={'$like':'%'+_0x377598[_0x4b4f('0x33')][_0x4b4f('0x3e')]+'%'};return _0x16b0c9;})});}_0x35d016=_[_0x4b4f('0x3f')]({},_0x35d016,_0x377598[_0x4b4f('0x48')]);return _0x2d561f[_0x4b4f('0x4e')](_0x35d016);}})[_0x4b4f('0x44')](function(_0x139191){if(_0x139191){_0x4da63c=_0x139191[_0x4b4f('0x38')];if(!_0x377598[_0x4b4f('0x33')][_0x4b4f('0x51')]('nolimit')){_0x35d016[_0x4b4f('0x39')]=qs['limit'](_0x377598[_0x4b4f('0x33')]['limit']);_0x35d016[_0x4b4f('0x25')]=qs['offset'](_0x377598['query']['offset']);}return _0x2d561f[_0x4b4f('0x4e')](_0x35d016);}})['then'](function(_0x4085d2){if(_0x4085d2){return _0x4085d2?{'count':_0x4da63c,'rows':_0x4085d2}:null;}})[_0x4b4f('0x44')](respondWithResult(_0x40e002,null))['catch'](handleError(_0x40e002,null));};exports[_0x4b4f('0x52')]=function(_0xf77aa3,_0x33318c,_0x2e170d){var _0x4316b2={};var _0x248207={};var _0x531d54;var _0x672f71;return db[_0x4b4f('0x2f')][_0x4b4f('0x4f')]({'where':{'id':_0xf77aa3['params']['id']}})[_0x4b4f('0x44')](handleEntityNotFound(_0x33318c,null))[_0x4b4f('0x44')](function(_0x8e1c01){if(_0x8e1c01){_0x531d54=_0x8e1c01;_0x248207[_0x4b4f('0x32')]=_[_0x4b4f('0x47')](db[_0x4b4f('0x50')][_0x4b4f('0x30')]);_0x248207[_0x4b4f('0x33')]=_[_0x4b4f('0x47')](_0xf77aa3['query']);_0x248207[_0x4b4f('0x34')]=_[_0x4b4f('0x35')](_0x248207[_0x4b4f('0x32')],_0x248207['query']);_0x4316b2[_0x4b4f('0x37')]=_[_0x4b4f('0x35')](_0x248207['model'],qs[_0x4b4f('0x36')](_0xf77aa3['query']['fields']));_0x4316b2[_0x4b4f('0x37')]=_0x4316b2[_0x4b4f('0x37')][_0x4b4f('0x38')]?_0x4316b2[_0x4b4f('0x37')]:_0x248207[_0x4b4f('0x32')];_0x4316b2[_0x4b4f('0x3a')]=qs['sort'](_0xf77aa3['query']['sort']);_0x4316b2['where']=qs['filters'](_[_0x4b4f('0x3d')](_0xf77aa3[_0x4b4f('0x33')],_0x248207['filters']));if(_0xf77aa3[_0x4b4f('0x33')][_0x4b4f('0x3e')]){_0x4316b2[_0x4b4f('0x3c')]=_[_0x4b4f('0x3f')](_0x4316b2[_0x4b4f('0x3c')],{'$or':_[_0x4b4f('0x2e')](_0x4316b2['attributes'],function(_0x3ebf25){var _0x1fc01d={};_0x1fc01d[_0x3ebf25]={'$like':'%'+_0xf77aa3[_0x4b4f('0x33')][_0x4b4f('0x3e')]+'%'};return _0x1fc01d;})});}_0x4316b2=_[_0x4b4f('0x3f')]({},_0x4316b2,_0xf77aa3[_0x4b4f('0x48')]);return _0x531d54['getSubjects'](_0x4316b2);}})[_0x4b4f('0x44')](function(_0x250221){if(_0x250221){_0x672f71=_0x250221['length'];if(!_0xf77aa3[_0x4b4f('0x33')][_0x4b4f('0x51')](_0x4b4f('0x53'))){_0x4316b2['limit']=qs['limit'](_0xf77aa3[_0x4b4f('0x33')][_0x4b4f('0x39')]);_0x4316b2[_0x4b4f('0x25')]=qs[_0x4b4f('0x25')](_0xf77aa3[_0x4b4f('0x33')][_0x4b4f('0x25')]);}return _0x531d54[_0x4b4f('0x52')](_0x4316b2);}})[_0x4b4f('0x44')](function(_0x4c318e){if(_0x4c318e){return _0x4c318e?{'count':_0x672f71,'rows':_0x4c318e}:null;}})[_0x4b4f('0x44')](respondWithResult(_0x33318c,null))[_0x4b4f('0x4a')](handleError(_0x33318c,null));};exports[_0x4b4f('0x54')]=function(_0x8f0ca9,_0xe512f1,_0x4a1b12){var _0x5a9f0e={};var _0x332189={};var _0x787dac;var _0x29294f;return db['ZohoConfiguration'][_0x4b4f('0x4f')]({'where':{'id':_0x8f0ca9[_0x4b4f('0x4d')]['id']}})[_0x4b4f('0x44')](handleEntityNotFound(_0xe512f1,null))[_0x4b4f('0x44')](function(_0x326bd5){if(_0x326bd5){_0x787dac=_0x326bd5;_0x332189[_0x4b4f('0x32')]=_[_0x4b4f('0x47')](db[_0x4b4f('0x50')][_0x4b4f('0x30')]);_0x332189[_0x4b4f('0x33')]=_[_0x4b4f('0x47')](_0x8f0ca9[_0x4b4f('0x33')]);_0x332189[_0x4b4f('0x34')]=_[_0x4b4f('0x35')](_0x332189['model'],_0x332189['query']);_0x5a9f0e[_0x4b4f('0x37')]=_[_0x4b4f('0x35')](_0x332189[_0x4b4f('0x32')],qs['fields'](_0x8f0ca9['query'][_0x4b4f('0x36')]));_0x5a9f0e[_0x4b4f('0x37')]=_0x5a9f0e['attributes'][_0x4b4f('0x38')]?_0x5a9f0e[_0x4b4f('0x37')]:_0x332189['model'];_0x5a9f0e[_0x4b4f('0x3a')]=qs[_0x4b4f('0x3b')](_0x8f0ca9[_0x4b4f('0x33')][_0x4b4f('0x3b')]);_0x5a9f0e['where']=qs['filters'](_[_0x4b4f('0x3d')](_0x8f0ca9[_0x4b4f('0x33')],_0x332189[_0x4b4f('0x34')]));if(_0x8f0ca9[_0x4b4f('0x33')][_0x4b4f('0x3e')]){_0x5a9f0e[_0x4b4f('0x3c')]=_[_0x4b4f('0x3f')](_0x5a9f0e[_0x4b4f('0x3c')],{'$or':_[_0x4b4f('0x2e')](_0x5a9f0e[_0x4b4f('0x37')],function(_0x3b997e){var _0x4aeb99={};_0x4aeb99[_0x3b997e]={'$like':'%'+_0x8f0ca9['query'][_0x4b4f('0x3e')]+'%'};return _0x4aeb99;})});}_0x5a9f0e=_[_0x4b4f('0x3f')]({},_0x5a9f0e,_0x8f0ca9[_0x4b4f('0x48')]);return _0x787dac[_0x4b4f('0x54')](_0x5a9f0e);}})[_0x4b4f('0x44')](function(_0x18bd91){if(_0x18bd91){_0x29294f=_0x18bd91[_0x4b4f('0x38')];if(!_0x8f0ca9['query']['hasOwnProperty'](_0x4b4f('0x53'))){_0x5a9f0e[_0x4b4f('0x39')]=qs[_0x4b4f('0x39')](_0x8f0ca9[_0x4b4f('0x33')]['limit']);_0x5a9f0e['offset']=qs[_0x4b4f('0x25')](_0x8f0ca9[_0x4b4f('0x33')][_0x4b4f('0x25')]);}return _0x787dac[_0x4b4f('0x54')](_0x5a9f0e);}})[_0x4b4f('0x44')](function(_0x3e664a){if(_0x3e664a){return _0x3e664a?{'count':_0x29294f,'rows':_0x3e664a}:null;}})[_0x4b4f('0x44')](respondWithResult(_0xe512f1,null))[_0x4b4f('0x4a')](handleError(_0xe512f1,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index aa50e57..70a166c 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 _0x46b2=['./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2d2b31,_0x458476){var _0x455e23=function(_0x2169ea){while(--_0x2169ea){_0x2d2b31['push'](_0x2d2b31['shift']());}};_0x455e23(++_0x458476);}(_0x46b2,0xf4));var _0x246b=function(_0x222731,_0x396036){_0x222731=_0x222731-0x0;var _0x32606f=_0x46b2[_0x222731];return _0x32606f;};'use strict';var _=require(_0x246b('0x0'));var util=require(_0x246b('0x1'));var logger=require(_0x246b('0x2'))(_0x246b('0x3'));var moment=require('moment');var BPromise=require(_0x246b('0x4'));var rp=require(_0x246b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x246b('0x6'));var config=require(_0x246b('0x7'));var attributes=require(_0x246b('0x8'));module[_0x246b('0x9')]=function(_0x34bb64,_0x33485a){return _0x34bb64[_0x246b('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x246b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2503=['./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xc4c5c1,_0x1a3304){var _0x4abc73=function(_0x1cab89){while(--_0x1cab89){_0xc4c5c1['push'](_0xc4c5c1['shift']());}};_0x4abc73(++_0x1a3304);}(_0x2503,0x197));var _0x3250=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2503[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3250('0x0'));var util=require(_0x3250('0x1'));var logger=require(_0x3250('0x2'))(_0x3250('0x3'));var moment=require(_0x3250('0x4'));var BPromise=require('bluebird');var rp=require(_0x3250('0x5'));var fs=require('fs');var path=require(_0x3250('0x6'));var rimraf=require(_0x3250('0x7'));var config=require(_0x3250('0x8'));var attributes=require(_0x3250('0x9'));module[_0x3250('0xa')]=function(_0x56421b,_0x2710f9){return _0x56421b['define'](_0x3250('0xb'),attributes,{'tableName':_0x3250('0xc'),'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 56c0066..2f44db0 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 _0x7fc7=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xcc47fd,_0x3f5165){var _0x5e952d=function(_0x3826bc){while(--_0x3826bc){_0xcc47fd['push'](_0xcc47fd['shift']());}};_0x5e952d(++_0x3f5165);}(_0x7fc7,0x198));var _0x77fc=function(_0x7a9ba7,_0x206167){_0x7a9ba7=_0x7a9ba7-0x0;var _0x330270=_0x7fc7[_0x7a9ba7];return _0x330270;};'use strict';var _=require(_0x77fc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x77fc('0x1'));var rs=require(_0x77fc('0x2'));var fs=require('fs');var Redis=require(_0x77fc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x77fc('0x4'));var logger=require(_0x77fc('0x5'))(_0x77fc('0x6'));var config=require(_0x77fc('0x7'));var jayson=require(_0x77fc('0x8'));var client=jayson[_0x77fc('0x9')][_0x77fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x421c00,_0x37f282,_0x11c9ba){return new BPromise(function(_0xfc5b69,_0x2e13b2){return client[_0x77fc('0xb')](_0x421c00,_0x11c9ba)[_0x77fc('0xc')](function(_0x142eb5){logger[_0x77fc('0xd')](_0x77fc('0xe'),_0x37f282,_0x77fc('0xf'));logger['debug'](_0x77fc('0x10'),_0x37f282,_0x77fc('0xf'),JSON['stringify'](_0x142eb5));if(_0x142eb5['error']){if(_0x142eb5[_0x77fc('0x11')][_0x77fc('0x12')]===0x1f4){logger[_0x77fc('0x11')](_0x77fc('0xe'),_0x37f282,_0x142eb5['error']['message']);return _0x2e13b2(_0x142eb5['error'][_0x77fc('0x13')]);}logger[_0x77fc('0x11')](_0x77fc('0xe'),_0x37f282,_0x142eb5['error']['message']);return _0xfc5b69(_0x142eb5[_0x77fc('0x11')][_0x77fc('0x13')]);}else{logger[_0x77fc('0xd')](_0x77fc('0xe'),_0x37f282,_0x77fc('0xf'));_0xfc5b69(_0x142eb5[_0x77fc('0x14')][_0x77fc('0x13')]);}})[_0x77fc('0x15')](function(_0x480147){logger['error'](_0x77fc('0xe'),_0x37f282,_0x480147);_0x2e13b2(_0x480147);});});} \ No newline at end of file +var _0x2167=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x29228b,_0x4801be){var _0x2acdce=function(_0x5356a2){while(--_0x5356a2){_0x29228b['push'](_0x29228b['shift']());}};_0x2acdce(++_0x4801be);}(_0x2167,0xe3));var _0x7216=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x2167[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require('lodash');var util=require(_0x7216('0x0'));var moment=require(_0x7216('0x1'));var BPromise=require(_0x7216('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7216('0x3'));var db=require(_0x7216('0x4'))['db'];var utils=require(_0x7216('0x5'));var logger=require('../../config/logger')(_0x7216('0x6'));var config=require(_0x7216('0x7'));var jayson=require(_0x7216('0x8'));var client=jayson['client'][_0x7216('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1948d8,_0xe049a7,_0x55fdec){return new BPromise(function(_0x3e4b42,_0x30006d){return client[_0x7216('0xa')](_0x1948d8,_0x55fdec)[_0x7216('0xb')](function(_0x3e221d){logger[_0x7216('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0xe049a7,_0x7216('0xd'));logger[_0x7216('0xe')](_0x7216('0xf'),_0xe049a7,'request\x20sent',JSON[_0x7216('0x10')](_0x3e221d));if(_0x3e221d[_0x7216('0x11')]){if(_0x3e221d['error']['code']===0x1f4){logger[_0x7216('0x11')](_0x7216('0x12'),_0xe049a7,_0x3e221d[_0x7216('0x11')][_0x7216('0x13')]);return _0x30006d(_0x3e221d[_0x7216('0x11')]['message']);}logger[_0x7216('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0xe049a7,_0x3e221d[_0x7216('0x11')][_0x7216('0x13')]);return _0x3e4b42(_0x3e221d[_0x7216('0x11')][_0x7216('0x13')]);}else{logger[_0x7216('0xc')](_0x7216('0x12'),_0xe049a7,_0x7216('0xd'));_0x3e4b42(_0x3e221d[_0x7216('0x14')][_0x7216('0x13')]);}})[_0x7216('0x15')](function(_0x1cbbc3){logger[_0x7216('0x11')](_0x7216('0x12'),_0xe049a7,_0x1cbbc3);_0x30006d(_0x1cbbc3);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 7ec0c69..303bb61 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 _0x160f=['get','index','show','put','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x3f84eb,_0x2afb16){var _0x44b09b=function(_0x48587a){while(--_0x48587a){_0x3f84eb['push'](_0x3f84eb['shift']());}};_0x44b09b(++_0x2afb16);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var path=require(_0xf160('0x2'));var timeout=require(_0xf160('0x3'));var express=require('express');var router=express[_0xf160('0x4')]();var auth=require(_0xf160('0x5'));var interaction=require(_0xf160('0x6'));var config=require(_0xf160('0x7'));var controller=require(_0xf160('0x8'));router[_0xf160('0x9')]('/',auth['isAuthenticated'](),controller[_0xf160('0xa')]);router[_0xf160('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf160('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf160('0xc')](_0xf160('0xd'),auth[_0xf160('0xe')](),controller[_0xf160('0xf')]);router['delete']('/:id',auth[_0xf160('0xe')](),controller[_0xf160('0x10')]);module[_0xf160('0x11')]=router; \ No newline at end of file +var _0x5b12=['index','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./intZohoField.controller'];(function(_0x27062d,_0x24b179){var _0x4f1478=function(_0x3b4489){while(--_0x3b4489){_0x27062d['push'](_0x27062d['shift']());}};_0x4f1478(++_0x24b179);}(_0x5b12,0xa3));var _0x25b1=function(_0x424641,_0x4988dc){_0x424641=_0x424641-0x0;var _0x32396e=_0x5b12[_0x424641];return _0x32396e;};'use strict';var multer=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var path=require(_0x25b1('0x2'));var timeout=require('connect-timeout');var express=require(_0x25b1('0x3'));var router=express['Router']();var auth=require(_0x25b1('0x4'));var interaction=require(_0x25b1('0x5'));var config=require('../../config/environment');var controller=require(_0x25b1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x25b1('0x7')]);router['get']('/:id',auth[_0x25b1('0x8')](),controller[_0x25b1('0x9')]);router[_0x25b1('0xa')]('/',auth[_0x25b1('0x8')](),controller[_0x25b1('0xb')]);router[_0x25b1('0xc')](_0x25b1('0xd'),auth[_0x25b1('0x8')](),controller['update']);router[_0x25b1('0xe')](_0x25b1('0xd'),auth[_0x25b1('0x8')](),controller[_0x25b1('0xf')]);module[_0x25b1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a9f6ea0..ba5d282 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 _0x7fec=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3be303,_0x10039a){var _0x128775=function(_0x3828e6){while(--_0x3828e6){_0x3be303['push'](_0x3be303['shift']());}};_0x128775(++_0x10039a);}(_0x7fec,0x6e));var _0xc7fe=function(_0x53c1db,_0x4c8c69){_0x53c1db=_0x53c1db-0x0;var _0x187700=_0x7fec[_0x53c1db];return _0x187700;};'use strict';var Sequelize=require(_0xc7fe('0x0'));module[_0xc7fe('0x1')]={'type':{'type':Sequelize[_0xc7fe('0x2')](_0xc7fe('0x3'),_0xc7fe('0x4'),_0xc7fe('0x5'),_0xc7fe('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc7fe('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc7fe('0x2')](_0xc7fe('0x3'),_0xc7fe('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc7fe('0x7')]},'nameField':{'type':Sequelize[_0xc7fe('0x7')]},'customField':{'type':Sequelize[_0xc7fe('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf07=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0x2a275d,_0x4641a9){var _0x1d00ab=function(_0xd36c0){while(--_0xd36c0){_0x2a275d['push'](_0x2a275d['shift']());}};_0x1d00ab(++_0x4641a9);}(_0xbf07,0x77));var _0x7bf0=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xbf07[_0x26b5ff];return _0x58603e;};'use strict';var Sequelize=require(_0x7bf0('0x0'));module[_0x7bf0('0x1')]={'type':{'type':Sequelize[_0x7bf0('0x2')](_0x7bf0('0x3'),'variable',_0x7bf0('0x4'),_0x7bf0('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7bf0('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x7bf0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7bf0('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7bf0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 5227c96..0275986 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(_0xe64990,_0x1934d7){var _0x5a19bc=function(_0x331904){while(--_0x331904){_0xe64990['push'](_0xe64990['shift']());}};_0x5a19bc(++_0x1934d7);}(_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(_0x22cf86,_0x9ecba2){var _0x2d1ea9=function(_0x44b259){while(--_0x44b259){_0x22cf86['push'](_0x22cf86['shift']());}};_0x2d1ea9(++_0x9ecba2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var 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 c795e6a..8255dd6 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 _0x7c19=['./intZohoField.attributes','define','zoho_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7c19,0xeb));var _0x97c1=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7c19[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x97c1('0x0'));var util=require(_0x97c1('0x1'));var logger=require(_0x97c1('0x2'))('api');var moment=require(_0x97c1('0x3'));var BPromise=require(_0x97c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97c1('0x5'));var rimraf=require('rimraf');var config=require(_0x97c1('0x6'));var attributes=require(_0x97c1('0x7'));module['exports']=function(_0x2ad7ae,_0x5a57a8){return _0x2ad7ae[_0x97c1('0x8')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x97c1('0x9'),'fields':['idField',_0x97c1('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7335=['zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','int_zoho_fields'];(function(_0x26bf6a,_0x12478f){var _0x3522c7=function(_0xe1fb6f){while(--_0xe1fb6f){_0x26bf6a['push'](_0x26bf6a['shift']());}};_0x3522c7(++_0x12478f);}(_0x7335,0x14d));var _0x5733=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x7335[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x5733('0x0'));var util=require(_0x5733('0x1'));var logger=require(_0x5733('0x2'))(_0x5733('0x3'));var moment=require(_0x5733('0x4'));var BPromise=require(_0x5733('0x5'));var rp=require(_0x5733('0x6'));var fs=require('fs');var path=require(_0x5733('0x7'));var rimraf=require('rimraf');var config=require(_0x5733('0x8'));var attributes=require(_0x5733('0x9'));module[_0x5733('0xa')]=function(_0x3d436c,_0xdb16cd){return _0x3d436c['define']('ZohoField',attributes,{'tableName':_0x5733('0xb'),'paranoid':![],'indexes':[{'name':_0x5733('0xc'),'fields':[_0x5733('0xd'),_0x5733('0xe')],'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 14b5d76..b68ead6 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 _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x331ff2,_0x240018){var _0x5864d7=function(_0x2f4cd8){while(--_0x2f4cd8){_0x331ff2['push'](_0x331ff2['shift']());}};_0x5864d7(++_0x240018);}(_0x55ca,0x126));var _0xa55c=function(_0x5967c0,_0x452377){_0x5967c0=_0x5967c0-0x0;var _0x2ad249=_0x55ca[_0x5967c0];return _0x2ad249;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('ZohoField,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('ZohoField,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','ZohoField,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x119457,_0x1d6c85){var _0x51dd16=function(_0x500ced){while(--_0x500ced){_0x119457['push'](_0x119457['shift']());}};_0x51dd16(++_0x1d6c85);}(_0x3e74,0x175));var _0x43e7=function(_0x81ad27,_0x149192){_0x81ad27=_0x81ad27-0x0;var _0x26bb24=_0x3e74[_0x81ad27];return _0x26bb24;};'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']('ZohoField,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('ZohoField,\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')]('ZohoField,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index be8b00b..d34f5c9 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 _0x5c1c=['connect-timeout','express','../../components/auth/service','../../config/environment','exports','multer','path'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x5c1c,0x1e8));var _0xc5c1=function(_0x1ec4a1,_0x32292e){_0x1ec4a1=_0x1ec4a1-0x0;var _0x59e9c4=_0x5c1c[_0x1ec4a1];return _0x59e9c4;};'use strict';var multer=require(_0xc5c1('0x0'));var util=require('util');var path=require(_0xc5c1('0x1'));var timeout=require(_0xc5c1('0x2'));var express=require(_0xc5c1('0x3'));var router=express['Router']();var auth=require(_0xc5c1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc5c1('0x5'));module[_0xc5c1('0x6')]=router; \ No newline at end of file +var _0xcb08=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x572598,_0x49d08d){var _0x430373=function(_0x329eb9){while(--_0x329eb9){_0x572598['push'](_0x572598['shift']());}};_0x430373(++_0x49d08d);}(_0xcb08,0x1be));var _0x8cb0=function(_0x192430,_0x569442){_0x192430=_0x192430-0x0;var _0x5166e3=_0xcb08[_0x192430];return _0x5166e3;};'use strict';var multer=require(_0x8cb0('0x0'));var util=require(_0x8cb0('0x1'));var path=require(_0x8cb0('0x2'));var timeout=require(_0x8cb0('0x3'));var express=require(_0x8cb0('0x4'));var router=express[_0x8cb0('0x5')]();var auth=require(_0x8cb0('0x6'));var interaction=require(_0x8cb0('0x7'));var config=require(_0x8cb0('0x8'));module[_0x8cb0('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 72355c1..7ed1cc6 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 _0x9cef=['unique_name_and_version','app.js','BOOLEAN','sequelize','exports','STRING'];(function(_0x9ed5c7,_0x236445){var _0x480ca6=function(_0x44a915){while(--_0x44a915){_0x9ed5c7['push'](_0x9ed5c7['shift']());}};_0x480ca6(++_0x236445);}(_0x9cef,0x129));var _0xf9ce=function(_0x15833e,_0x58a046){_0x15833e=_0x15833e-0x0;var _0x5c4745=_0x9cef[_0x15833e];return _0x5c4745;};'use strict';var Sequelize=require(_0xf9ce('0x0'));module[_0xf9ce('0x1')]={'name':{'type':Sequelize[_0xf9ce('0x2')],'allowNull':![],'unique':_0xf9ce('0x3')},'version':{'type':Sequelize[_0xf9ce('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xf9ce('0x2')],'defaultValue':_0xf9ce('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf9ce('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xf9ce('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xf9ce('0x2')]},'logo':{'type':Sequelize[_0xf9ce('0x2')]},'state':{'type':Sequelize[_0xf9ce('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xf9ce('0x2')]},'title':{'type':Sequelize[_0xf9ce('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x5a66=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x15ad95,_0x566009){var _0x439717=function(_0x5b73a1){while(--_0x5b73a1){_0x15ad95['push'](_0x15ad95['shift']());}};_0x439717(++_0x566009);}(_0x5a66,0x1f4));var _0x65a6=function(_0x3b4922,_0x2fa365){_0x3b4922=_0x3b4922-0x0;var _0x239729=_0x5a66[_0x3b4922];return _0x239729;};'use strict';var Sequelize=require(_0x65a6('0x0'));module[_0x65a6('0x1')]={'name':{'type':Sequelize[_0x65a6('0x2')],'allowNull':![],'unique':_0x65a6('0x3')},'version':{'type':Sequelize[_0x65a6('0x2')],'allowNull':![],'unique':_0x65a6('0x3')},'main':{'type':Sequelize[_0x65a6('0x2')],'defaultValue':_0x65a6('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x65a6('0x2')]},'type':{'type':Sequelize[_0x65a6('0x2')]},'size':{'type':Sequelize[_0x65a6('0x5')]},'active':{'type':Sequelize[_0x65a6('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x65a6('0x2')]},'logo':{'type':Sequelize[_0x65a6('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x65a6('0x7')},'description':{'type':Sequelize[_0x65a6('0x2')]},'title':{'type':Sequelize[_0x65a6('0x2')]},'remoteUri':{'type':Sequelize[_0x65a6('0x2')]},'link':{'type':Sequelize[_0x65a6('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 54d1f33..d15d1ce 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 _0x7782=['find','create','body','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','count','includeAll','findAll','rows','catch','show','params','include'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x7782,0x123));var _0x2778=function(_0x4d310e,_0xc1e573){_0x4d310e=_0x4d310e-0x0;var _0x45dc79=_0x7782[_0x4d310e];return _0x45dc79;};'use strict';var pdf=require(_0x2778('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2778('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2778('0x2'));var rp=require('request-promise');var moment=require(_0x2778('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2778('0x4'));var util=require(_0x2778('0x5'));var path=require(_0x2778('0x6'));var sox=require(_0x2778('0x7'));var csv=require(_0x2778('0x8'));var ejs=require(_0x2778('0x9'));var fs=require('fs');var _=require(_0x2778('0xa'));var squel=require('squel');var crypto=require(_0x2778('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2778('0xc'));var toCsv=require(_0x2778('0x8'));var querystring=require(_0x2778('0xd'));var Papa=require('papaparse');var Redis=require(_0x2778('0xe'));var authService=require(_0x2778('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2778('0x10'));var hardwareService=require(_0x2778('0x11'));var logger=require('../../config/logger')(_0x2778('0x12'));var utils=require(_0x2778('0x13'));var config=require(_0x2778('0x14'));var db=require(_0x2778('0x15'))['db'];function respondWithStatusCode(_0xc7cef3,_0x45f954){_0x45f954=_0x45f954||0xcc;return function(_0x72aa13){if(_0x72aa13){return _0xc7cef3[_0x2778('0x16')](_0x45f954);}return _0xc7cef3[_0x2778('0x17')](_0x45f954)[_0x2778('0x18')]();};}function respondWithResult(_0x31ee7b,_0x16033d){_0x16033d=_0x16033d||0xc8;return function(_0x10e3d4){if(_0x10e3d4){return _0x31ee7b['status'](_0x16033d)[_0x2778('0x19')](_0x10e3d4);}};}function respondWithFilteredResult(_0x3737d3,_0x50945d){return function(_0x270a37){if(_0x270a37){var _0x4a26a0=_0x270a37['count'],_0x248cb6=_0x50945d[_0x2778('0x1a')],_0x212629=_0x50945d[_0x2778('0x1a')]+_0x50945d[_0x2778('0x1b')],_0x2717a3;if(_0x212629>=_0x4a26a0){_0x212629=_0x4a26a0;_0x2717a3=0xc8;}else{_0x2717a3=0xce;}_0x3737d3[_0x2778('0x17')](_0x2717a3);return _0x3737d3[_0x2778('0x1c')](_0x2778('0x1d'),_0x248cb6+'-'+_0x212629+'/'+_0x4a26a0)[_0x2778('0x19')](_0x270a37);}return null;};}function patchUpdates(_0xca7ff){return function(_0x38c417){try{jsonpatch[_0x2778('0x1e')](_0x38c417,_0xca7ff,!![]);}catch(_0x448aa5){return BPromise[_0x2778('0x1f')](_0x448aa5);}return _0x38c417[_0x2778('0x20')]();};}function saveUpdates(_0x27deb2,_0x1a83d7){return function(_0x429177){if(_0x429177){return _0x429177[_0x2778('0x21')](_0x27deb2)[_0x2778('0x22')](function(_0x21134f){return _0x21134f;});}return null;};}function removeEntity(_0x3cd973,_0x3d67af){return function(_0x3fb3a){if(_0x3fb3a){return _0x3fb3a[_0x2778('0x23')]()[_0x2778('0x22')](function(){_0x3cd973['status'](0xcc)[_0x2778('0x18')]();});}};}function handleEntityNotFound(_0x389c21,_0x262afe){return function(_0x51ccaa){if(!_0x51ccaa){_0x389c21[_0x2778('0x16')](0x194);}return _0x51ccaa;};}function handleError(_0x3a26d6,_0x3da615){_0x3da615=_0x3da615||0x1f4;return function(_0x34af22){logger['error'](_0x34af22[_0x2778('0x24')]);if(_0x34af22[_0x2778('0x25')]){delete _0x34af22['name'];}_0x3a26d6[_0x2778('0x17')](_0x3da615)[_0x2778('0x26')](_0x34af22);};}exports['index']=function(_0x4d59bd,_0x91bd27){var _0x4e52af={},_0x515225={},_0xe5234a={'count':0x0,'rows':[]};var _0x563251=_[_0x2778('0x27')](db['Integration']['rawAttributes'],function(_0x11f89a){return{'name':_0x11f89a[_0x2778('0x28')],'type':_0x11f89a[_0x2778('0x29')][_0x2778('0x2a')]};});_0x515225[_0x2778('0x2b')]=_['map'](_0x563251,_0x2778('0x25'));_0x515225[_0x2778('0x2c')]=_[_0x2778('0x2d')](_0x4d59bd[_0x2778('0x2c')]);_0x515225[_0x2778('0x2e')]=_[_0x2778('0x2f')](_0x515225['model'],_0x515225[_0x2778('0x2c')]);_0x4e52af[_0x2778('0x30')]=_[_0x2778('0x2f')](_0x515225[_0x2778('0x2b')],qs[_0x2778('0x31')](_0x4d59bd[_0x2778('0x2c')][_0x2778('0x31')]));_0x4e52af[_0x2778('0x30')]=_0x4e52af[_0x2778('0x30')][_0x2778('0x32')]?_0x4e52af['attributes']:_0x515225[_0x2778('0x2b')];if(!_0x4d59bd[_0x2778('0x2c')][_0x2778('0x33')]('nolimit')){_0x4e52af[_0x2778('0x1b')]=qs[_0x2778('0x1b')](_0x4d59bd[_0x2778('0x2c')][_0x2778('0x1b')]);_0x4e52af[_0x2778('0x1a')]=qs[_0x2778('0x1a')](_0x4d59bd[_0x2778('0x2c')]['offset']);}_0x4e52af[_0x2778('0x34')]=qs[_0x2778('0x35')](_0x4d59bd['query'][_0x2778('0x35')]);_0x4e52af[_0x2778('0x36')]=qs[_0x2778('0x2e')](_[_0x2778('0x37')](_0x4d59bd[_0x2778('0x2c')],_0x515225[_0x2778('0x2e')]),_0x563251);if(_0x4d59bd['query'][_0x2778('0x38')]){_0x4e52af[_0x2778('0x36')]=_[_0x2778('0x39')](_0x4e52af[_0x2778('0x36')],{'$or':_[_0x2778('0x27')](_0x563251,function(_0x40f2a0){if(_0x40f2a0[_0x2778('0x29')]!==_0x2778('0x3a')){var _0x4ad235={};_0x4ad235[_0x40f2a0[_0x2778('0x25')]]={'$like':'%'+_0x4d59bd[_0x2778('0x2c')]['filter']+'%'};return _0x4ad235;}})});}_0x4e52af=_[_0x2778('0x39')]({},_0x4e52af,_0x4d59bd[_0x2778('0x3b')]);var _0x36760b={'where':_0x4e52af[_0x2778('0x36')]};return db[_0x2778('0x3c')][_0x2778('0x3d')](_0x36760b)[_0x2778('0x22')](function(_0x3c549b){_0xe5234a['count']=_0x3c549b;if(_0x4d59bd['query'][_0x2778('0x3e')]){_0x4e52af['include']=[{'all':!![]}];}return db[_0x2778('0x3c')][_0x2778('0x3f')](_0x4e52af);})[_0x2778('0x22')](function(_0x3e6cc0){_0xe5234a[_0x2778('0x40')]=_0x3e6cc0;return _0xe5234a;})['then'](respondWithFilteredResult(_0x91bd27,_0x4e52af))[_0x2778('0x41')](handleError(_0x91bd27,null));};exports[_0x2778('0x42')]=function(_0x3e96b2,_0x2b20f4){var _0x5db510={'raw':![],'where':{'id':_0x3e96b2[_0x2778('0x43')]['id']}},_0x1f8c72={};_0x1f8c72[_0x2778('0x2b')]=_['keys'](db[_0x2778('0x3c')]['rawAttributes']);_0x1f8c72[_0x2778('0x2c')]=_[_0x2778('0x2d')](_0x3e96b2['query']);_0x1f8c72[_0x2778('0x2e')]=_[_0x2778('0x2f')](_0x1f8c72[_0x2778('0x2b')],_0x1f8c72[_0x2778('0x2c')]);_0x5db510['attributes']=_[_0x2778('0x2f')](_0x1f8c72[_0x2778('0x2b')],qs[_0x2778('0x31')](_0x3e96b2[_0x2778('0x2c')]['fields']));_0x5db510[_0x2778('0x30')]=_0x5db510[_0x2778('0x30')][_0x2778('0x32')]?_0x5db510[_0x2778('0x30')]:_0x1f8c72[_0x2778('0x2b')];if(_0x3e96b2[_0x2778('0x2c')][_0x2778('0x3e')]){_0x5db510[_0x2778('0x44')]=[{'all':!![]}];}_0x5db510=_[_0x2778('0x39')]({},_0x5db510,_0x3e96b2['options']);return db[_0x2778('0x3c')][_0x2778('0x45')](_0x5db510)['then'](handleEntityNotFound(_0x2b20f4,null))['then'](respondWithResult(_0x2b20f4,null))['catch'](handleError(_0x2b20f4,null));};exports[_0x2778('0x46')]=function(_0x448995,_0x3c88c0){return db[_0x2778('0x3c')][_0x2778('0x46')](_0x448995[_0x2778('0x47')],{})['then'](respondWithResult(_0x3c88c0,0xc9))[_0x2778('0x41')](handleError(_0x3c88c0,null));};exports['update']=function(_0x1a044,_0x2a8942){if(_0x1a044['body']['id']){delete _0x1a044[_0x2778('0x47')]['id'];}return db[_0x2778('0x3c')]['find']({'where':{'id':_0x1a044[_0x2778('0x43')]['id']}})[_0x2778('0x22')](handleEntityNotFound(_0x2a8942,null))[_0x2778('0x22')](saveUpdates(_0x1a044[_0x2778('0x47')],null))['then'](respondWithResult(_0x2a8942,null))[_0x2778('0x41')](handleError(_0x2a8942,null));};exports[_0x2778('0x23')]=function(_0xa26431,_0x137701){return db[_0x2778('0x3c')][_0x2778('0x45')]({'where':{'id':_0xa26431['params']['id']}})[_0x2778('0x22')](handleEntityNotFound(_0x137701,null))[_0x2778('0x22')](removeEntity(_0x137701,null))[_0x2778('0x41')](handleError(_0x137701,null));}; \ No newline at end of file +var _0xc78b=['key','query','filters','intersection','model','attributes','length','nolimit','limit','sort','where','pick','filter','includeAll','include','findAll','params','keys','fields','merge','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type'];(function(_0x5dd1cb,_0x5b15b4){var _0x170f6f=function(_0x121ae9){while(--_0x121ae9){_0x5dd1cb['push'](_0x5dd1cb['shift']());}};_0x170f6f(++_0x5b15b4);}(_0xc78b,0xed));var _0xbc78=function(_0x3d7a58,_0x409a0d){_0x3d7a58=_0x3d7a58-0x0;var _0x2a5fa7=_0xc78b[_0x3d7a58];return _0x2a5fa7;};'use strict';var pdf=require(_0xbc78('0x0'));var emlformat=require(_0xbc78('0x1'));var rimraf=require(_0xbc78('0x2'));var zipdir=require(_0xbc78('0x3'));var jsonpatch=require(_0xbc78('0x4'));var rp=require(_0xbc78('0x5'));var moment=require(_0xbc78('0x6'));var BPromise=require(_0xbc78('0x7'));var Mustache=require(_0xbc78('0x8'));var util=require('util');var path=require(_0xbc78('0x9'));var sox=require(_0xbc78('0xa'));var csv=require('to-csv');var ejs=require(_0xbc78('0xb'));var fs=require('fs');var _=require(_0xbc78('0xc'));var squel=require(_0xbc78('0xd'));var crypto=require(_0xbc78('0xe'));var jsforce=require(_0xbc78('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbc78('0x10'));var querystring=require(_0xbc78('0x11'));var Papa=require(_0xbc78('0x12'));var Redis=require('ioredis');var authService=require(_0xbc78('0x13'));var qs=require(_0xbc78('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc78('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xbc78('0x16'));var config=require(_0xbc78('0x17'));var db=require(_0xbc78('0x18'))['db'];function respondWithStatusCode(_0x443e0c,_0x2d5eb4){_0x2d5eb4=_0x2d5eb4||0xcc;return function(_0x405540){if(_0x405540){return _0x443e0c[_0xbc78('0x19')](_0x2d5eb4);}return _0x443e0c[_0xbc78('0x1a')](_0x2d5eb4)['end']();};}function respondWithResult(_0x5e7b26,_0x103830){_0x103830=_0x103830||0xc8;return function(_0x5b7784){if(_0x5b7784){return _0x5e7b26['status'](_0x103830)[_0xbc78('0x1b')](_0x5b7784);}};}function respondWithFilteredResult(_0x593abb,_0x1cb230){return function(_0x5511c7){if(_0x5511c7){var _0x533c9b=_0x5511c7[_0xbc78('0x1c')],_0x292eb0=_0x1cb230[_0xbc78('0x1d')],_0x484673=_0x1cb230['offset']+_0x1cb230['limit'],_0x597c4f;if(_0x484673>=_0x533c9b){_0x484673=_0x533c9b;_0x597c4f=0xc8;}else{_0x597c4f=0xce;}_0x593abb['status'](_0x597c4f);return _0x593abb[_0xbc78('0x1e')](_0xbc78('0x1f'),_0x292eb0+'-'+_0x484673+'/'+_0x533c9b)[_0xbc78('0x1b')](_0x5511c7);}return null;};}function patchUpdates(_0x2897f3){return function(_0x35acec){try{jsonpatch[_0xbc78('0x20')](_0x35acec,_0x2897f3,!![]);}catch(_0x289a66){return BPromise['reject'](_0x289a66);}return _0x35acec['save']();};}function saveUpdates(_0x1bbc65,_0x3b65a5){return function(_0x13da65){if(_0x13da65){return _0x13da65[_0xbc78('0x21')](_0x1bbc65)[_0xbc78('0x22')](function(_0x44a826){return _0x44a826;});}return null;};}function removeEntity(_0x4a6b5a,_0x46fb4d){return function(_0x33f4c5){if(_0x33f4c5){return _0x33f4c5[_0xbc78('0x23')]()[_0xbc78('0x22')](function(){_0x4a6b5a[_0xbc78('0x1a')](0xcc)[_0xbc78('0x24')]();});}};}function handleEntityNotFound(_0x4ddcd0,_0x5b64f3){return function(_0x4bbe81){if(!_0x4bbe81){_0x4ddcd0[_0xbc78('0x19')](0x194);}return _0x4bbe81;};}function handleError(_0x2870eb,_0x569830){_0x569830=_0x569830||0x1f4;return function(_0x1506b9){logger[_0xbc78('0x25')](_0x1506b9[_0xbc78('0x26')]);if(_0x1506b9['name']){delete _0x1506b9[_0xbc78('0x27')];}_0x2870eb[_0xbc78('0x1a')](_0x569830)[_0xbc78('0x28')](_0x1506b9);};}exports[_0xbc78('0x29')]=function(_0x1d4f85,_0x12c904){var _0x350c77={},_0x531168={},_0x15fdbe={'count':0x0,'rows':[]};var _0x556fd8=_[_0xbc78('0x2a')](db[_0xbc78('0x2b')][_0xbc78('0x2c')],function(_0x1b8691){return{'name':_0x1b8691[_0xbc78('0x2d')],'type':_0x1b8691[_0xbc78('0x2e')][_0xbc78('0x2f')]};});_0x531168['model']=_[_0xbc78('0x2a')](_0x556fd8,_0xbc78('0x27'));_0x531168['query']=_['keys'](_0x1d4f85[_0xbc78('0x30')]);_0x531168[_0xbc78('0x31')]=_[_0xbc78('0x32')](_0x531168[_0xbc78('0x33')],_0x531168[_0xbc78('0x30')]);_0x350c77[_0xbc78('0x34')]=_[_0xbc78('0x32')](_0x531168[_0xbc78('0x33')],qs['fields'](_0x1d4f85['query']['fields']));_0x350c77[_0xbc78('0x34')]=_0x350c77['attributes'][_0xbc78('0x35')]?_0x350c77[_0xbc78('0x34')]:_0x531168['model'];if(!_0x1d4f85['query']['hasOwnProperty'](_0xbc78('0x36'))){_0x350c77[_0xbc78('0x37')]=qs[_0xbc78('0x37')](_0x1d4f85['query'][_0xbc78('0x37')]);_0x350c77[_0xbc78('0x1d')]=qs[_0xbc78('0x1d')](_0x1d4f85[_0xbc78('0x30')][_0xbc78('0x1d')]);}_0x350c77['order']=qs[_0xbc78('0x38')](_0x1d4f85[_0xbc78('0x30')][_0xbc78('0x38')]);_0x350c77[_0xbc78('0x39')]=qs[_0xbc78('0x31')](_[_0xbc78('0x3a')](_0x1d4f85[_0xbc78('0x30')],_0x531168['filters']),_0x556fd8);if(_0x1d4f85[_0xbc78('0x30')][_0xbc78('0x3b')]){_0x350c77[_0xbc78('0x39')]=_['merge'](_0x350c77[_0xbc78('0x39')],{'$or':_[_0xbc78('0x2a')](_0x556fd8,function(_0x59c722){if(_0x59c722[_0xbc78('0x2e')]!=='VIRTUAL'){var _0x478ce6={};_0x478ce6[_0x59c722[_0xbc78('0x27')]]={'$like':'%'+_0x1d4f85[_0xbc78('0x30')][_0xbc78('0x3b')]+'%'};return _0x478ce6;}})});}_0x350c77=_['merge']({},_0x350c77,_0x1d4f85['options']);var _0x1b85e3={'where':_0x350c77[_0xbc78('0x39')]};return db['Integration'][_0xbc78('0x1c')](_0x1b85e3)['then'](function(_0x1061c7){_0x15fdbe['count']=_0x1061c7;if(_0x1d4f85['query'][_0xbc78('0x3c')]){_0x350c77[_0xbc78('0x3d')]=[{'all':!![]}];}return db[_0xbc78('0x2b')][_0xbc78('0x3e')](_0x350c77);})[_0xbc78('0x22')](function(_0x52a625){_0x15fdbe['rows']=_0x52a625;return _0x15fdbe;})[_0xbc78('0x22')](respondWithFilteredResult(_0x12c904,_0x350c77))['catch'](handleError(_0x12c904,null));};exports['show']=function(_0x2cc292,_0x7d6f37){var _0x59ed45={'raw':![],'where':{'id':_0x2cc292[_0xbc78('0x3f')]['id']}},_0x7fc525={};_0x7fc525[_0xbc78('0x33')]=_[_0xbc78('0x40')](db[_0xbc78('0x2b')][_0xbc78('0x2c')]);_0x7fc525[_0xbc78('0x30')]=_['keys'](_0x2cc292[_0xbc78('0x30')]);_0x7fc525[_0xbc78('0x31')]=_[_0xbc78('0x32')](_0x7fc525[_0xbc78('0x33')],_0x7fc525[_0xbc78('0x30')]);_0x59ed45[_0xbc78('0x34')]=_['intersection'](_0x7fc525['model'],qs[_0xbc78('0x41')](_0x2cc292[_0xbc78('0x30')]['fields']));_0x59ed45[_0xbc78('0x34')]=_0x59ed45['attributes']['length']?_0x59ed45[_0xbc78('0x34')]:_0x7fc525[_0xbc78('0x33')];if(_0x2cc292[_0xbc78('0x30')][_0xbc78('0x3c')]){_0x59ed45[_0xbc78('0x3d')]=[{'all':!![]}];}_0x59ed45=_[_0xbc78('0x42')]({},_0x59ed45,_0x2cc292['options']);return db[_0xbc78('0x2b')]['find'](_0x59ed45)['then'](handleEntityNotFound(_0x7d6f37,null))[_0xbc78('0x22')](respondWithResult(_0x7d6f37,null))[_0xbc78('0x43')](handleError(_0x7d6f37,null));};exports[_0xbc78('0x44')]=function(_0x5b02f7,_0x211a1e){return db[_0xbc78('0x2b')][_0xbc78('0x44')](_0x5b02f7[_0xbc78('0x45')],{})[_0xbc78('0x22')](respondWithResult(_0x211a1e,0xc9))[_0xbc78('0x43')](handleError(_0x211a1e,null));};exports['update']=function(_0x5761a1,_0x55f229){if(_0x5761a1[_0xbc78('0x45')]['id']){delete _0x5761a1[_0xbc78('0x45')]['id'];}return db['Integration'][_0xbc78('0x46')]({'where':{'id':_0x5761a1[_0xbc78('0x3f')]['id']}})['then'](handleEntityNotFound(_0x55f229,null))[_0xbc78('0x22')](saveUpdates(_0x5761a1['body'],null))['then'](respondWithResult(_0x55f229,null))[_0xbc78('0x43')](handleError(_0x55f229,null));};exports[_0xbc78('0x23')]=function(_0x76de1e,_0x5b7586){return db[_0xbc78('0x2b')][_0xbc78('0x46')]({'where':{'id':_0x76de1e[_0xbc78('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5b7586,null))[_0xbc78('0x22')](removeEntity(_0x5b7586,null))[_0xbc78('0x43')](handleError(_0x5b7586,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c99644d..954c2f2 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 _0xd6bd=['integrations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./integration.attributes','define'];(function(_0x31bcdf,_0x1fe0b8){var _0x195066=function(_0x5c047b){while(--_0x5c047b){_0x31bcdf['push'](_0x31bcdf['shift']());}};_0x195066(++_0x1fe0b8);}(_0xd6bd,0xf1));var _0xdd6b=function(_0x2e9199,_0x1cedf5){_0x2e9199=_0x2e9199-0x0;var _0x46dc64=_0xd6bd[_0x2e9199];return _0x46dc64;};'use strict';var _=require(_0xdd6b('0x0'));var util=require(_0xdd6b('0x1'));var logger=require(_0xdd6b('0x2'))(_0xdd6b('0x3'));var moment=require(_0xdd6b('0x4'));var BPromise=require('bluebird');var rp=require(_0xdd6b('0x5'));var fs=require('fs');var path=require(_0xdd6b('0x6'));var rimraf=require(_0xdd6b('0x7'));var config=require(_0xdd6b('0x8'));var attributes=require(_0xdd6b('0x9'));module['exports']=function(_0x5da82d,_0x53f33f){return _0x5da82d[_0xdd6b('0xa')]('Integration',attributes,{'tableName':_0xdd6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdcc=['bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','util','../../config/logger'];(function(_0x39971e,_0x4b7c5b){var _0x208ce0=function(_0x16e7ae){while(--_0x16e7ae){_0x39971e['push'](_0x39971e['shift']());}};_0x208ce0(++_0x4b7c5b);}(_0xfdcc,0x1b6));var _0xcfdc=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0xfdcc[_0x2aee2f];return _0x19337f;};'use strict';var _=require('lodash');var util=require(_0xcfdc('0x0'));var logger=require(_0xcfdc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcfdc('0x2'));var rp=require(_0xcfdc('0x3'));var fs=require('fs');var path=require(_0xcfdc('0x4'));var rimraf=require(_0xcfdc('0x5'));var config=require(_0xcfdc('0x6'));var attributes=require(_0xcfdc('0x7'));module[_0xcfdc('0x8')]=function(_0x40b92c,_0x174a8a){return _0x40b92c['define'](_0xcfdc('0x9'),attributes,{'tableName':_0xcfdc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 32e55eb..3635a52 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 _0x7dbc=['debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','Integration,\x20%s,\x20%s','request\x20sent'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0x7dbc,0xe2));var _0xc7db=function(_0x5a0290,_0x27cf74){_0x5a0290=_0x5a0290-0x0;var _0x176674=_0x7dbc[_0x5a0290];return _0x176674;};'use strict';var _=require(_0xc7db('0x0'));var util=require(_0xc7db('0x1'));var moment=require('moment');var BPromise=require(_0xc7db('0x2'));var rs=require(_0xc7db('0x3'));var fs=require('fs');var Redis=require(_0xc7db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7db('0x5'));var logger=require(_0xc7db('0x6'))(_0xc7db('0x7'));var config=require(_0xc7db('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc7db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x256ea6,_0x4f8491,_0x51dd2c){return new BPromise(function(_0x9eff32,_0x3429f3){return client['request'](_0x256ea6,_0x51dd2c)[_0xc7db('0xa')](function(_0x3e41ad){logger[_0xc7db('0xb')](_0xc7db('0xc'),_0x4f8491,_0xc7db('0xd'));logger[_0xc7db('0xe')](_0xc7db('0xf'),_0x4f8491,'request\x20sent',JSON[_0xc7db('0x10')](_0x3e41ad));if(_0x3e41ad['error']){if(_0x3e41ad[_0xc7db('0x11')][_0xc7db('0x12')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x4f8491,_0x3e41ad[_0xc7db('0x11')][_0xc7db('0x13')]);return _0x3429f3(_0x3e41ad[_0xc7db('0x11')][_0xc7db('0x13')]);}logger[_0xc7db('0x11')](_0xc7db('0xc'),_0x4f8491,_0x3e41ad['error'][_0xc7db('0x13')]);return _0x9eff32(_0x3e41ad['error'][_0xc7db('0x13')]);}else{logger['info'](_0xc7db('0xc'),_0x4f8491,_0xc7db('0xd'));_0x9eff32(_0x3e41ad['result'][_0xc7db('0x13')]);}})['catch'](function(_0x57e07d){logger[_0xc7db('0x11')](_0xc7db('0xc'),_0x4f8491,_0x57e07d);_0x3429f3(_0x57e07d);});});} \ No newline at end of file +var _0x653d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0x653d,0x133));var _0xd653=function(_0x5148b1,_0xf065ee){_0x5148b1=_0x5148b1-0x0;var _0x5a82a8=_0x653d[_0x5148b1];return _0x5a82a8;};'use strict';var _=require('lodash');var util=require(_0xd653('0x0'));var moment=require(_0xd653('0x1'));var BPromise=require(_0xd653('0x2'));var rs=require(_0xd653('0x3'));var fs=require('fs');var Redis=require(_0xd653('0x4'));var db=require(_0xd653('0x5'))['db'];var utils=require(_0xd653('0x6'));var logger=require(_0xd653('0x7'))(_0xd653('0x8'));var config=require(_0xd653('0x9'));var jayson=require(_0xd653('0xa'));var client=jayson[_0xd653('0xb')][_0xd653('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bf7a1,_0x490041,_0x5cbb43){return new BPromise(function(_0x378ba9,_0x5b46f9){return client[_0xd653('0xd')](_0x2bf7a1,_0x5cbb43)[_0xd653('0xe')](function(_0x5234e0){logger[_0xd653('0xf')](_0xd653('0x10'),_0x490041,_0xd653('0x11'));logger['debug'](_0xd653('0x12'),_0x490041,'request\x20sent',JSON[_0xd653('0x13')](_0x5234e0));if(_0x5234e0[_0xd653('0x14')]){if(_0x5234e0[_0xd653('0x14')][_0xd653('0x15')]===0x1f4){logger[_0xd653('0x14')](_0xd653('0x10'),_0x490041,_0x5234e0[_0xd653('0x14')]['message']);return _0x5b46f9(_0x5234e0['error'][_0xd653('0x16')]);}logger[_0xd653('0x14')](_0xd653('0x10'),_0x490041,_0x5234e0[_0xd653('0x14')][_0xd653('0x16')]);return _0x378ba9(_0x5234e0[_0xd653('0x14')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x490041,_0xd653('0x11'));_0x378ba9(_0x5234e0[_0xd653('0x17')][_0xd653('0x16')]);}})['catch'](function(_0x2a4d7f){logger[_0xd653('0x14')](_0xd653('0x10'),_0x490041,_0x2a4d7f);_0x5b46f9(_0x2a4d7f);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 04b11a0..dadfd89 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 _0xc916=['express','Router','../../components/auth/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports','path','connect-timeout'];(function(_0x5db2b5,_0x24e4c5){var _0x2fd39f=function(_0x17f679){while(--_0x17f679){_0x5db2b5['push'](_0x5db2b5['shift']());}};_0x2fd39f(++_0x24e4c5);}(_0xc916,0x1d2));var _0x6c91=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xc916[_0x118653];return _0xc11fa6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6c91('0x0'));var timeout=require(_0x6c91('0x1'));var express=require(_0x6c91('0x2'));var router=express[_0x6c91('0x3')]();var auth=require(_0x6c91('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6c91('0x5'));var controller=require(_0x6c91('0x6'));router[_0x6c91('0x7')]('/',auth[_0x6c91('0x8')](),controller[_0x6c91('0x9')]);router[_0x6c91('0x7')](_0x6c91('0xa'),auth[_0x6c91('0x8')](),controller[_0x6c91('0xb')]);router[_0x6c91('0x7')](_0x6c91('0xc'),auth['isAuthenticated'](),controller[_0x6c91('0xd')]);router['post']('/',auth[_0x6c91('0x8')](),controller[_0x6c91('0xe')]);router[_0x6c91('0xf')]('/:id',auth[_0x6c91('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6c91('0x10')]);module[_0x6c91('0x11')]=router; \ No newline at end of file +var _0x4f3c=['../../config/environment','./integrationReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x51363e,_0x46a245){var _0x98b230=function(_0x277f2f){while(--_0x277f2f){_0x51363e['push'](_0x51363e['shift']());}};_0x98b230(++_0x46a245);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x2493a8,_0x5a240d){_0x2493a8=_0x2493a8-0x0;var _0x2b06c9=_0x4f3c[_0x2493a8];return _0x2b06c9;};'use strict';var multer=require(_0xc4f3('0x0'));var util=require(_0xc4f3('0x1'));var path=require(_0xc4f3('0x2'));var timeout=require(_0xc4f3('0x3'));var express=require(_0xc4f3('0x4'));var router=express[_0xc4f3('0x5')]();var auth=require(_0xc4f3('0x6'));var interaction=require(_0xc4f3('0x7'));var config=require(_0xc4f3('0x8'));var controller=require(_0xc4f3('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc4f3('0xa')]);router[_0xc4f3('0xb')](_0xc4f3('0xc'),auth[_0xc4f3('0xd')](),controller[_0xc4f3('0xe')]);router[_0xc4f3('0xb')](_0xc4f3('0xf'),auth[_0xc4f3('0xd')](),controller[_0xc4f3('0x10')]);router[_0xc4f3('0x11')]('/',auth['isAuthenticated'](),controller[_0xc4f3('0x12')]);router['put']('/:id',auth[_0xc4f3('0xd')](),controller['update']);router[_0xc4f3('0x13')](_0xc4f3('0xf'),auth[_0xc4f3('0xd')](),controller['destroy']);module[_0xc4f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index eeaa717..3e4f20f 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 _0x88e1=['exports','STRING','INTEGER','DATE','BOOLEAN','RECEIVED','FAILED'];(function(_0x2bbf53,_0x10ba24){var _0x46447a=function(_0x3a644c){while(--_0x3a644c){_0x2bbf53['push'](_0x2bbf53['shift']());}};_0x46447a(++_0x10ba24);}(_0x88e1,0x18f));var _0x188e=function(_0x2f7270,_0x307af1){_0x2f7270=_0x2f7270-0x0;var _0xe1d89a=_0x88e1[_0x2f7270];return _0xe1d89a;};'use strict';var Sequelize=require('sequelize');module[_0x188e('0x0')]={'integration':{'type':Sequelize[_0x188e('0x1')]},'eventChannel':{'type':Sequelize[_0x188e('0x1')]},'exitStatus':{'type':Sequelize[_0x188e('0x1')]},'ticketId':{'type':Sequelize[_0x188e('0x1')]},'integrationId':{'type':Sequelize[_0x188e('0x2')]},'contacts':{'type':Sequelize[_0x188e('0x1')]},'uniqueid':{'type':Sequelize[_0x188e('0x1')]},'calleridnum':{'type':Sequelize[_0x188e('0x1')]},'calleridname':{'type':Sequelize[_0x188e('0x1')]},'queue':{'type':Sequelize[_0x188e('0x1')]},'interface':{'type':Sequelize[_0x188e('0x1')]},'membername':{'type':Sequelize[_0x188e('0x1')]},'agentcalledAt':{'type':Sequelize[_0x188e('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x188e('0x2')]},'agentcomplete':{'type':Sequelize[_0x188e('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x188e('0x2')]},'agentacw':{'type':Sequelize[_0x188e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x188e('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x188e('0x3')]},'lastevent':{'type':Sequelize[_0x188e('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x188e('0x2')]},'channelstatedesc':{'type':Sequelize[_0x188e('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x188e('0x1')]},'language':{'type':Sequelize[_0x188e('0x1')]},'accountcode':{'type':Sequelize[_0x188e('0x1')]},'context':{'type':Sequelize[_0x188e('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x188e('0x1')]},'destchannel':{'type':Sequelize[_0x188e('0x1')]},'destchannelstate':{'type':Sequelize[_0x188e('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x188e('0x1')]},'destcalleridnum':{'type':Sequelize[_0x188e('0x1')]},'destcalleridname':{'type':Sequelize[_0x188e('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x188e('0x1')]},'destlanguage':{'type':Sequelize[_0x188e('0x1')]},'destaccountcode':{'type':Sequelize[_0x188e('0x1')]},'destcontext':{'type':Sequelize[_0x188e('0x1')]},'destexten':{'type':Sequelize[_0x188e('0x1')]},'destpriority':{'type':Sequelize[_0x188e('0x1')]},'destuniqueid':{'type':Sequelize[_0x188e('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x188e('0x1')]},'subject':{'type':Sequelize[_0x188e('0x1')]},'from':{'type':Sequelize[_0x188e('0x1')]},'to':{'type':Sequelize[_0x188e('0x1')]},'cc':{'type':Sequelize[_0x188e('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM']('SENT','SENDING',_0x188e('0x5'),_0x188e('0x6'))},'url':{'type':Sequelize[_0x188e('0x1')]},'app':{'type':Sequelize[_0x188e('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x188e('0x2')]}}; \ No newline at end of file +var _0xaa84=['TEXT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','BOOLEAN','DATE'];(function(_0x50102a,_0x134e4f){var _0x22e707=function(_0x380971){while(--_0x380971){_0x50102a['push'](_0x50102a['shift']());}};_0x22e707(++_0x134e4f);}(_0xaa84,0x11c));var _0x4aa8=function(_0x38cf84,_0x445013){_0x38cf84=_0x38cf84-0x0;var _0x469f28=_0xaa84[_0x38cf84];return _0x469f28;};'use strict';var Sequelize=require(_0x4aa8('0x0'));module[_0x4aa8('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x4aa8('0x2')]},'exitStatus':{'type':Sequelize[_0x4aa8('0x2')]},'ticketId':{'type':Sequelize[_0x4aa8('0x2')]},'integrationId':{'type':Sequelize[_0x4aa8('0x3')]},'contacts':{'type':Sequelize[_0x4aa8('0x2')]},'uniqueid':{'type':Sequelize[_0x4aa8('0x2')]},'calleridnum':{'type':Sequelize[_0x4aa8('0x2')]},'calleridname':{'type':Sequelize[_0x4aa8('0x2')]},'queue':{'type':Sequelize[_0x4aa8('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x4aa8('0x3')]},'agentcomplete':{'type':Sequelize[_0x4aa8('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4aa8('0x5')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x4aa8('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4aa8('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x4aa8('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4aa8('0x5')]},'agentdump':{'type':Sequelize[_0x4aa8('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4aa8('0x5')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4aa8('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4aa8('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4aa8('0x2')]},'connectedlinename':{'type':Sequelize[_0x4aa8('0x2')]},'language':{'type':Sequelize[_0x4aa8('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4aa8('0x2')]},'priority':{'type':Sequelize[_0x4aa8('0x2')]},'destchannel':{'type':Sequelize[_0x4aa8('0x2')]},'destchannelstate':{'type':Sequelize[_0x4aa8('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x4aa8('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4aa8('0x2')]},'destcalleridname':{'type':Sequelize[_0x4aa8('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4aa8('0x2')]},'destlanguage':{'type':Sequelize[_0x4aa8('0x2')]},'destaccountcode':{'type':Sequelize[_0x4aa8('0x2')]},'destcontext':{'type':Sequelize[_0x4aa8('0x2')]},'destexten':{'type':Sequelize[_0x4aa8('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4aa8('0x2')]},'messageId':{'type':Sequelize[_0x4aa8('0x2')]},'inReplyTo':{'type':Sequelize[_0x4aa8('0x2')]},'subject':{'type':Sequelize[_0x4aa8('0x2')]},'from':{'type':Sequelize[_0x4aa8('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x4aa8('0x6')]},'html':{'type':Sequelize[_0x4aa8('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM']('SENT',_0x4aa8('0x7'),_0x4aa8('0x8'),_0x4aa8('0x9'))},'url':{'type':Sequelize[_0x4aa8('0x2')]},'app':{'type':Sequelize[_0x4aa8('0x2')]},'appdata':{'type':Sequelize[_0x4aa8('0x2')]},'projectId':{'type':Sequelize[_0x4aa8('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 553740c..d352c79 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 _0x5806=['model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','length','catch','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','json','reject','save','update','then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x371ac2,_0xc5961c){var _0x37d93d=function(_0x26b927){while(--_0x26b927){_0x371ac2['push'](_0x371ac2['shift']());}};_0x37d93d(++_0xc5961c);}(_0x5806,0x187));var _0x6580=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x5806[_0x2850c0];return _0x21e830;};'use strict';var pdf=require(_0x6580('0x0'));var emlformat=require(_0x6580('0x1'));var rimraf=require(_0x6580('0x2'));var zipdir=require(_0x6580('0x3'));var jsonpatch=require(_0x6580('0x4'));var rp=require('request-promise');var moment=require(_0x6580('0x5'));var BPromise=require(_0x6580('0x6'));var Mustache=require(_0x6580('0x7'));var util=require(_0x6580('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6580('0x9'));var ejs=require(_0x6580('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6580('0xb'));var crypto=require(_0x6580('0xc'));var jsforce=require(_0x6580('0xd'));var deskjs=require(_0x6580('0xe'));var toCsv=require(_0x6580('0x9'));var querystring=require('querystring');var Papa=require(_0x6580('0xf'));var Redis=require(_0x6580('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6580('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6580('0x12'))(_0x6580('0x13'));var utils=require(_0x6580('0x14'));var config=require(_0x6580('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d07f7,_0xbdc726){_0xbdc726=_0xbdc726||0xcc;return function(_0x35d9ec){if(_0x35d9ec){return _0x4d07f7[_0x6580('0x16')](_0xbdc726);}return _0x4d07f7[_0x6580('0x17')](_0xbdc726)[_0x6580('0x18')]();};}function respondWithResult(_0x4440cb,_0x16a2c5){_0x16a2c5=_0x16a2c5||0xc8;return function(_0x145e86){if(_0x145e86){return _0x4440cb[_0x6580('0x17')](_0x16a2c5)['json'](_0x145e86);}};}function respondWithFilteredResult(_0x491809,_0x521cfd){return function(_0x4e18c5){if(_0x4e18c5){var _0x1def1d=_0x4e18c5['count'],_0xd0a2b7=_0x521cfd[_0x6580('0x19')],_0x5f073b=_0x521cfd[_0x6580('0x19')]+_0x521cfd[_0x6580('0x1a')],_0x394402;if(_0x5f073b>=_0x1def1d){_0x5f073b=_0x1def1d;_0x394402=0xc8;}else{_0x394402=0xce;}_0x491809['status'](_0x394402);return _0x491809[_0x6580('0x1b')]('Content-Range',_0xd0a2b7+'-'+_0x5f073b+'/'+_0x1def1d)[_0x6580('0x1c')](_0x4e18c5);}return null;};}function patchUpdates(_0x41a689){return function(_0x184d61){try{jsonpatch['apply'](_0x184d61,_0x41a689,!![]);}catch(_0xe90498){return BPromise[_0x6580('0x1d')](_0xe90498);}return _0x184d61[_0x6580('0x1e')]();};}function saveUpdates(_0x198012,_0x343ba4){return function(_0x132b72){if(_0x132b72){return _0x132b72[_0x6580('0x1f')](_0x198012)['then'](function(_0x476584){return _0x476584;});}return null;};}function removeEntity(_0x4f0387,_0x260fe8){return function(_0x1bcd5a){if(_0x1bcd5a){return _0x1bcd5a['destroy']()[_0x6580('0x20')](function(){_0x4f0387[_0x6580('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x412845,_0x2f1937){return function(_0x4f00ae){if(!_0x4f00ae){_0x412845[_0x6580('0x16')](0x194);}return _0x4f00ae;};}function handleError(_0x2d6091,_0x11fa33){_0x11fa33=_0x11fa33||0x1f4;return function(_0x56c28d){logger[_0x6580('0x21')](_0x56c28d[_0x6580('0x22')]);if(_0x56c28d[_0x6580('0x23')]){delete _0x56c28d[_0x6580('0x23')];}_0x2d6091[_0x6580('0x17')](_0x11fa33)[_0x6580('0x24')](_0x56c28d);};}exports[_0x6580('0x25')]=function(_0x20fd19,_0x5b3ab2){var _0x481b2c={},_0x2509a6={},_0xdac12e={'count':0x0,'rows':[]};var _0x5aee14=_[_0x6580('0x26')](db[_0x6580('0x27')][_0x6580('0x28')],function(_0x38b08a){return{'name':_0x38b08a[_0x6580('0x29')],'type':_0x38b08a[_0x6580('0x2a')][_0x6580('0x2b')]};});_0x2509a6['model']=_[_0x6580('0x26')](_0x5aee14,_0x6580('0x23'));_0x2509a6[_0x6580('0x2c')]=_[_0x6580('0x2d')](_0x20fd19['query']);_0x2509a6[_0x6580('0x2e')]=_['intersection'](_0x2509a6[_0x6580('0x2f')],_0x2509a6[_0x6580('0x2c')]);_0x481b2c[_0x6580('0x30')]=_[_0x6580('0x31')](_0x2509a6[_0x6580('0x2f')],qs[_0x6580('0x32')](_0x20fd19[_0x6580('0x2c')]['fields']));_0x481b2c[_0x6580('0x30')]=_0x481b2c[_0x6580('0x30')]['length']?_0x481b2c[_0x6580('0x30')]:_0x2509a6[_0x6580('0x2f')];if(!_0x20fd19[_0x6580('0x2c')][_0x6580('0x33')](_0x6580('0x34'))){_0x481b2c[_0x6580('0x1a')]=qs['limit'](_0x20fd19[_0x6580('0x2c')][_0x6580('0x1a')]);_0x481b2c['offset']=qs['offset'](_0x20fd19[_0x6580('0x2c')][_0x6580('0x19')]);}_0x481b2c[_0x6580('0x35')]=qs[_0x6580('0x36')](_0x20fd19['query'][_0x6580('0x36')]);_0x481b2c[_0x6580('0x37')]=qs[_0x6580('0x2e')](_['pick'](_0x20fd19[_0x6580('0x2c')],_0x2509a6['filters']),_0x5aee14);if(_0x20fd19['query'][_0x6580('0x38')]){_0x481b2c[_0x6580('0x37')]=_[_0x6580('0x39')](_0x481b2c['where'],{'$or':_[_0x6580('0x26')](_0x5aee14,function(_0xe207e5){if(_0xe207e5[_0x6580('0x2a')]!==_0x6580('0x3a')){var _0x1373ac={};_0x1373ac[_0xe207e5['name']]={'$like':'%'+_0x20fd19['query'][_0x6580('0x38')]+'%'};return _0x1373ac;}})});}_0x481b2c=_['merge']({},_0x481b2c,_0x20fd19[_0x6580('0x3b')]);var _0x46828d={'where':_0x481b2c['where']};return db[_0x6580('0x27')][_0x6580('0x3c')](_0x46828d)[_0x6580('0x20')](function(_0x4749ec){_0xdac12e[_0x6580('0x3c')]=_0x4749ec;if(_0x20fd19[_0x6580('0x2c')][_0x6580('0x3d')]){_0x481b2c[_0x6580('0x3e')]=[{'all':!![]}];}return db[_0x6580('0x27')][_0x6580('0x3f')](_0x481b2c);})['then'](function(_0x33aa06){_0xdac12e['rows']=_0x33aa06;return _0xdac12e;})[_0x6580('0x20')](respondWithFilteredResult(_0x5b3ab2,_0x481b2c))['catch'](handleError(_0x5b3ab2,null));};exports[_0x6580('0x40')]=function(_0x34a549,_0x241b22){var _0x16a440={'raw':![],'where':{'id':_0x34a549[_0x6580('0x41')]['id']}},_0x5174da={};_0x5174da[_0x6580('0x2f')]=_['keys'](db[_0x6580('0x27')][_0x6580('0x28')]);_0x5174da[_0x6580('0x2c')]=_['keys'](_0x34a549[_0x6580('0x2c')]);_0x5174da[_0x6580('0x2e')]=_[_0x6580('0x31')](_0x5174da[_0x6580('0x2f')],_0x5174da[_0x6580('0x2c')]);_0x16a440[_0x6580('0x30')]=_[_0x6580('0x31')](_0x5174da['model'],qs[_0x6580('0x32')](_0x34a549['query'][_0x6580('0x32')]));_0x16a440[_0x6580('0x30')]=_0x16a440[_0x6580('0x30')][_0x6580('0x42')]?_0x16a440[_0x6580('0x30')]:_0x5174da[_0x6580('0x2f')];if(_0x34a549['query'][_0x6580('0x3d')]){_0x16a440['include']=[{'all':!![]}];}_0x16a440=_[_0x6580('0x39')]({},_0x16a440,_0x34a549[_0x6580('0x3b')]);return db[_0x6580('0x27')]['find'](_0x16a440)[_0x6580('0x20')](handleEntityNotFound(_0x241b22,null))[_0x6580('0x20')](respondWithResult(_0x241b22,null))[_0x6580('0x43')](handleError(_0x241b22,null));};exports[_0x6580('0x44')]=function(_0x25df06,_0x2950c3){return db[_0x6580('0x27')][_0x6580('0x44')](_0x25df06[_0x6580('0x45')],{})['then'](respondWithResult(_0x2950c3,0xc9))[_0x6580('0x43')](handleError(_0x2950c3,null));};exports[_0x6580('0x1f')]=function(_0x1aef4f,_0xff0654){if(_0x1aef4f[_0x6580('0x45')]['id']){delete _0x1aef4f[_0x6580('0x45')]['id'];}return db[_0x6580('0x27')][_0x6580('0x46')]({'where':{'id':_0x1aef4f[_0x6580('0x41')]['id']}})[_0x6580('0x20')](handleEntityNotFound(_0xff0654,null))[_0x6580('0x20')](saveUpdates(_0x1aef4f[_0x6580('0x45')],null))[_0x6580('0x20')](respondWithResult(_0xff0654,null))[_0x6580('0x43')](handleError(_0xff0654,null));};exports[_0x6580('0x47')]=function(_0x47d103,_0x49065e){return db[_0x6580('0x27')]['find']({'where':{'id':_0x47d103[_0x6580('0x41')]['id']}})['then'](handleEntityNotFound(_0x49065e,null))[_0x6580('0x20')](removeEntity(_0x49065e,null))['catch'](handleError(_0x49065e,null));};exports[_0x6580('0x48')]=function(_0x1aa473,_0x95c379){return db[_0x6580('0x27')][_0x6580('0x48')]()[_0x6580('0x20')](respondWithResult(_0x95c379,null))[_0x6580('0x43')](handleError(_0x95c379,null));}; \ No newline at end of file +var _0x8cc6=['body','describe','html-pdf','zip-dir','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create'];(function(_0x166106,_0x1061af){var _0x599192=function(_0x438bef){while(--_0x438bef){_0x166106['push'](_0x166106['shift']());}};_0x599192(++_0x1061af);}(_0x8cc6,0x122));var _0x68cc=function(_0x3e2f7c,_0x1930e4){_0x3e2f7c=_0x3e2f7c-0x0;var _0x12df2e=_0x8cc6[_0x3e2f7c];return _0x12df2e;};'use strict';var pdf=require(_0x68cc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x68cc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x68cc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x68cc('0x3'));var util=require(_0x68cc('0x4'));var path=require('path');var sox=require(_0x68cc('0x5'));var csv=require(_0x68cc('0x6'));var ejs=require(_0x68cc('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x68cc('0x8'));var crypto=require(_0x68cc('0x9'));var jsforce=require(_0x68cc('0xa'));var deskjs=require(_0x68cc('0xb'));var toCsv=require(_0x68cc('0x6'));var querystring=require(_0x68cc('0xc'));var Papa=require(_0x68cc('0xd'));var Redis=require('ioredis');var authService=require(_0x68cc('0xe'));var qs=require(_0x68cc('0xf'));var as=require(_0x68cc('0x10'));var hardwareService=require(_0x68cc('0x11'));var logger=require(_0x68cc('0x12'))(_0x68cc('0x13'));var utils=require(_0x68cc('0x14'));var config=require('../../config/environment');var db=require(_0x68cc('0x15'))['db'];function respondWithStatusCode(_0x382d56,_0xfafc0d){_0xfafc0d=_0xfafc0d||0xcc;return function(_0x3cc129){if(_0x3cc129){return _0x382d56[_0x68cc('0x16')](_0xfafc0d);}return _0x382d56['status'](_0xfafc0d)[_0x68cc('0x17')]();};}function respondWithResult(_0x3db23f,_0x47477a){_0x47477a=_0x47477a||0xc8;return function(_0x5df097){if(_0x5df097){return _0x3db23f[_0x68cc('0x18')](_0x47477a)[_0x68cc('0x19')](_0x5df097);}};}function respondWithFilteredResult(_0x5642de,_0x2e5bf5){return function(_0x3b4481){if(_0x3b4481){var _0x36bc68=_0x3b4481[_0x68cc('0x1a')],_0x250c03=_0x2e5bf5['offset'],_0x5840d1=_0x2e5bf5['offset']+_0x2e5bf5[_0x68cc('0x1b')],_0x148f12;if(_0x5840d1>=_0x36bc68){_0x5840d1=_0x36bc68;_0x148f12=0xc8;}else{_0x148f12=0xce;}_0x5642de[_0x68cc('0x18')](_0x148f12);return _0x5642de[_0x68cc('0x1c')]('Content-Range',_0x250c03+'-'+_0x5840d1+'/'+_0x36bc68)[_0x68cc('0x19')](_0x3b4481);}return null;};}function patchUpdates(_0x423114){return function(_0x547435){try{jsonpatch['apply'](_0x547435,_0x423114,!![]);}catch(_0x4b1b3c){return BPromise[_0x68cc('0x1d')](_0x4b1b3c);}return _0x547435[_0x68cc('0x1e')]();};}function saveUpdates(_0x746ae7,_0x369cd8){return function(_0xc2c911){if(_0xc2c911){return _0xc2c911[_0x68cc('0x1f')](_0x746ae7)[_0x68cc('0x20')](function(_0x1cd94b){return _0x1cd94b;});}return null;};}function removeEntity(_0x2e5b3a,_0x409f71){return function(_0x2ad2eb){if(_0x2ad2eb){return _0x2ad2eb[_0x68cc('0x21')]()[_0x68cc('0x20')](function(){_0x2e5b3a[_0x68cc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b588,_0x21e2a8){return function(_0x359808){if(!_0x359808){_0x13b588['sendStatus'](0x194);}return _0x359808;};}function handleError(_0x3a06a0,_0x5c69d4){_0x5c69d4=_0x5c69d4||0x1f4;return function(_0x10b245){logger[_0x68cc('0x22')](_0x10b245[_0x68cc('0x23')]);if(_0x10b245[_0x68cc('0x24')]){delete _0x10b245[_0x68cc('0x24')];}_0x3a06a0['status'](_0x5c69d4)[_0x68cc('0x25')](_0x10b245);};}exports[_0x68cc('0x26')]=function(_0x931a90,_0x5c0d72){var _0x1a32eb={},_0x138ccd={},_0x186c26={'count':0x0,'rows':[]};var _0x380fd6=_[_0x68cc('0x27')](db[_0x68cc('0x28')][_0x68cc('0x29')],function(_0x2515ed){return{'name':_0x2515ed[_0x68cc('0x2a')],'type':_0x2515ed[_0x68cc('0x2b')][_0x68cc('0x2c')]};});_0x138ccd['model']=_[_0x68cc('0x27')](_0x380fd6,_0x68cc('0x24'));_0x138ccd[_0x68cc('0x2d')]=_['keys'](_0x931a90[_0x68cc('0x2d')]);_0x138ccd[_0x68cc('0x2e')]=_[_0x68cc('0x2f')](_0x138ccd[_0x68cc('0x30')],_0x138ccd[_0x68cc('0x2d')]);_0x1a32eb[_0x68cc('0x31')]=_['intersection'](_0x138ccd[_0x68cc('0x30')],qs[_0x68cc('0x32')](_0x931a90[_0x68cc('0x2d')][_0x68cc('0x32')]));_0x1a32eb[_0x68cc('0x31')]=_0x1a32eb[_0x68cc('0x31')][_0x68cc('0x33')]?_0x1a32eb[_0x68cc('0x31')]:_0x138ccd[_0x68cc('0x30')];if(!_0x931a90[_0x68cc('0x2d')][_0x68cc('0x34')]('nolimit')){_0x1a32eb[_0x68cc('0x1b')]=qs[_0x68cc('0x1b')](_0x931a90[_0x68cc('0x2d')][_0x68cc('0x1b')]);_0x1a32eb['offset']=qs[_0x68cc('0x35')](_0x931a90['query'][_0x68cc('0x35')]);}_0x1a32eb['order']=qs[_0x68cc('0x36')](_0x931a90[_0x68cc('0x2d')]['sort']);_0x1a32eb[_0x68cc('0x37')]=qs[_0x68cc('0x2e')](_[_0x68cc('0x38')](_0x931a90[_0x68cc('0x2d')],_0x138ccd['filters']),_0x380fd6);if(_0x931a90[_0x68cc('0x2d')][_0x68cc('0x39')]){_0x1a32eb[_0x68cc('0x37')]=_[_0x68cc('0x3a')](_0x1a32eb['where'],{'$or':_['map'](_0x380fd6,function(_0x7300a1){if(_0x7300a1[_0x68cc('0x2b')]!==_0x68cc('0x3b')){var _0xd8ab11={};_0xd8ab11[_0x7300a1[_0x68cc('0x24')]]={'$like':'%'+_0x931a90[_0x68cc('0x2d')][_0x68cc('0x39')]+'%'};return _0xd8ab11;}})});}_0x1a32eb=_[_0x68cc('0x3a')]({},_0x1a32eb,_0x931a90[_0x68cc('0x3c')]);var _0x1f2bc3={'where':_0x1a32eb['where']};return db[_0x68cc('0x28')][_0x68cc('0x1a')](_0x1f2bc3)[_0x68cc('0x20')](function(_0x144c85){_0x186c26[_0x68cc('0x1a')]=_0x144c85;if(_0x931a90[_0x68cc('0x2d')][_0x68cc('0x3d')]){_0x1a32eb[_0x68cc('0x3e')]=[{'all':!![]}];}return db[_0x68cc('0x28')]['findAll'](_0x1a32eb);})[_0x68cc('0x20')](function(_0x4f78a9){_0x186c26[_0x68cc('0x3f')]=_0x4f78a9;return _0x186c26;})[_0x68cc('0x20')](respondWithFilteredResult(_0x5c0d72,_0x1a32eb))[_0x68cc('0x40')](handleError(_0x5c0d72,null));};exports[_0x68cc('0x41')]=function(_0x2db064,_0x4a9b12){var _0x46b6db={'raw':![],'where':{'id':_0x2db064[_0x68cc('0x42')]['id']}},_0x1bb9cf={};_0x1bb9cf[_0x68cc('0x30')]=_[_0x68cc('0x43')](db['IntegrationReport'][_0x68cc('0x29')]);_0x1bb9cf[_0x68cc('0x2d')]=_[_0x68cc('0x43')](_0x2db064['query']);_0x1bb9cf[_0x68cc('0x2e')]=_[_0x68cc('0x2f')](_0x1bb9cf[_0x68cc('0x30')],_0x1bb9cf['query']);_0x46b6db[_0x68cc('0x31')]=_[_0x68cc('0x2f')](_0x1bb9cf[_0x68cc('0x30')],qs['fields'](_0x2db064['query'][_0x68cc('0x32')]));_0x46b6db[_0x68cc('0x31')]=_0x46b6db[_0x68cc('0x31')][_0x68cc('0x33')]?_0x46b6db[_0x68cc('0x31')]:_0x1bb9cf[_0x68cc('0x30')];if(_0x2db064['query'][_0x68cc('0x3d')]){_0x46b6db[_0x68cc('0x3e')]=[{'all':!![]}];}_0x46b6db=_[_0x68cc('0x3a')]({},_0x46b6db,_0x2db064[_0x68cc('0x3c')]);return db[_0x68cc('0x28')][_0x68cc('0x44')](_0x46b6db)[_0x68cc('0x20')](handleEntityNotFound(_0x4a9b12,null))[_0x68cc('0x20')](respondWithResult(_0x4a9b12,null))[_0x68cc('0x40')](handleError(_0x4a9b12,null));};exports[_0x68cc('0x45')]=function(_0x28274b,_0x5163db){return db[_0x68cc('0x28')][_0x68cc('0x45')](_0x28274b['body'],{})[_0x68cc('0x20')](respondWithResult(_0x5163db,0xc9))[_0x68cc('0x40')](handleError(_0x5163db,null));};exports['update']=function(_0x2692d4,_0x49011c){if(_0x2692d4[_0x68cc('0x46')]['id']){delete _0x2692d4[_0x68cc('0x46')]['id'];}return db[_0x68cc('0x28')][_0x68cc('0x44')]({'where':{'id':_0x2692d4[_0x68cc('0x42')]['id']}})[_0x68cc('0x20')](handleEntityNotFound(_0x49011c,null))[_0x68cc('0x20')](saveUpdates(_0x2692d4[_0x68cc('0x46')],null))['then'](respondWithResult(_0x49011c,null))[_0x68cc('0x40')](handleError(_0x49011c,null));};exports[_0x68cc('0x21')]=function(_0x24c0c7,_0xccca7f){return db['IntegrationReport'][_0x68cc('0x44')]({'where':{'id':_0x24c0c7['params']['id']}})[_0x68cc('0x20')](handleEntityNotFound(_0xccca7f,null))[_0x68cc('0x20')](removeEntity(_0xccca7f,null))[_0x68cc('0x40')](handleError(_0xccca7f,null));};exports[_0x68cc('0x47')]=function(_0xaaaa5c,_0x5f276d){return db[_0x68cc('0x28')][_0x68cc('0x47')]()[_0x68cc('0x20')](respondWithResult(_0x5f276d,null))[_0x68cc('0x40')](handleError(_0x5f276d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0a1f0ec..d1a3810 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 _0x7a72=['./integrationReport.attributes','exports','define','report_integration','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a72,0x13a));var _0x27a7=function(_0xedbb63,_0x4419bc){_0xedbb63=_0xedbb63-0x0;var _0x10fed5=_0x7a72[_0xedbb63];return _0x10fed5;};'use strict';var _=require('lodash');var util=require(_0x27a7('0x0'));var logger=require('../../config/logger')(_0x27a7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x27a7('0x2'));var fs=require('fs');var path=require(_0x27a7('0x3'));var rimraf=require(_0x27a7('0x4'));var config=require(_0x27a7('0x5'));var attributes=require(_0x27a7('0x6'));module[_0x27a7('0x7')]=function(_0x5a2ab0,_0x3cfd01){return _0x5a2ab0[_0x27a7('0x8')]('IntegrationReport',attributes,{'tableName':_0x27a7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fb8=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5fb8,0xe8));var _0x85fb=function(_0x54ff38,_0x17fe73){_0x54ff38=_0x54ff38-0x0;var _0x24dab6=_0x5fb8[_0x54ff38];return _0x24dab6;};'use strict';var _=require(_0x85fb('0x0'));var util=require(_0x85fb('0x1'));var logger=require(_0x85fb('0x2'))('api');var moment=require(_0x85fb('0x3'));var BPromise=require(_0x85fb('0x4'));var rp=require(_0x85fb('0x5'));var fs=require('fs');var path=require(_0x85fb('0x6'));var rimraf=require(_0x85fb('0x7'));var config=require(_0x85fb('0x8'));var attributes=require(_0x85fb('0x9'));module['exports']=function(_0x59fc4d,_0x53e36a){return _0x59fc4d[_0x85fb('0xa')](_0x85fb('0xb'),attributes,{'tableName':_0x85fb('0xc'),'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 cdb98d8..8ce3a8b 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x22bfa5,_0x38cb2e){var _0x5b49b5=function(_0x31892e){while(--_0x31892e){_0x22bfa5['push'](_0x22bfa5['shift']());}};_0x5b49b5(++_0x38cb2e);}(_0xb10b,0x12a));var _0xbb10=function(_0x349ac1,_0x443243){_0x349ac1=_0x349ac1-0x0;var _0x77840a=_0xb10b[_0x349ac1];return _0x77840a;};'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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x23cc76,_0x9c756b){var _0x2f5c13=function(_0x57c44b){while(--_0x57c44b){_0x23cc76['push'](_0x23cc76['shift']());}};_0x2f5c13(++_0x9c756b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 084cda0..4612f7a 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 _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0xbc928d,_0x25ede0){var _0xe86803=function(_0x3ec45){while(--_0x3ec45){_0xbc928d['push'](_0xbc928d['shift']());}};_0xe86803(++_0x25ede0);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file +var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x55ca,0x126));var _0xa55c=function(_0x5e33f6,_0x2e18e6){_0x5e33f6=_0x5e33f6-0x0;var _0x20cb0f=_0x55ca[_0x5e33f6];return _0x20cb0f;};'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/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 0156951..d1f7b91 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 _0x35a5=['sequelize','exports','STRING'];(function(_0x59fdd0,_0x2fcb06){var _0x1f7490=function(_0x52b035){while(--_0x52b035){_0x59fdd0['push'](_0x59fdd0['shift']());}};_0x1f7490(++_0x2fcb06);}(_0x35a5,0x1c2));var _0x535a=function(_0x20c983,_0x5230f2){_0x20c983=_0x20c983-0x0;var _0x3b747a=_0x35a5[_0x20c983];return _0x3b747a;};'use strict';var Sequelize=require(_0x535a('0x0'));module[_0x535a('0x1')]={'name':{'type':Sequelize[_0x535a('0x2')]},'description':{'type':Sequelize[_0x535a('0x2')]},'interval':{'type':Sequelize[_0x535a('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xe538=['sequelize','exports','STRING'];(function(_0x39d0f7,_0x4fcdf0){var _0x498cfa=function(_0x3152bf){while(--_0x3152bf){_0x39d0f7['push'](_0x39d0f7['shift']());}};_0x498cfa(++_0x4fcdf0);}(_0xe538,0x198));var _0x8e53=function(_0x3f127b,_0x986b51){_0x3f127b=_0x3f127b-0x0;var _0x23ed00=_0xe538[_0x3f127b];return _0x23ed00;};'use strict';var Sequelize=require(_0x8e53('0x0'));module[_0x8e53('0x1')]={'name':{'type':Sequelize[_0x8e53('0x2')]},'description':{'type':Sequelize[_0x8e53('0x2')]},'interval':{'type':Sequelize[_0x8e53('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 2b72271..e55a1b7 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 _0x00bb=['query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','hasOwnProperty','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','Intervals','UserProfileResource','destroy','end','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key'];(function(_0x3d141f,_0x436724){var _0x4e214b=function(_0x467151){while(--_0x467151){_0x3d141f['push'](_0x3d141f['shift']());}};_0x4e214b(++_0x436724);}(_0x00bb,0x18c));var _0xb00b=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x00bb[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb00b('0x3'));var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require(_0xb00b('0x8'));var csv=require(_0xb00b('0x9'));var ejs=require(_0xb00b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb00b('0xb'));var crypto=require('crypto');var jsforce=require(_0xb00b('0xc'));var deskjs=require(_0xb00b('0xd'));var toCsv=require(_0xb00b('0x9'));var querystring=require(_0xb00b('0xe'));var Papa=require(_0xb00b('0xf'));var Redis=require('ioredis');var authService=require(_0xb00b('0x10'));var qs=require(_0xb00b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb00b('0x12'));var logger=require(_0xb00b('0x13'))(_0xb00b('0x14'));var utils=require(_0xb00b('0x15'));var config=require(_0xb00b('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0xb00b('0x17'));function respondWithStatusCode(_0x8cdf19,_0x51a000){_0x51a000=_0x51a000||0xcc;return function(_0x2ce845){if(_0x2ce845){return _0x8cdf19[_0xb00b('0x18')](_0x51a000);}return _0x8cdf19['status'](_0x51a000)['end']();};}function respondWithResult(_0x1e0663,_0x383a13){_0x383a13=_0x383a13||0xc8;return function(_0x676df3){if(_0x676df3){return _0x1e0663[_0xb00b('0x19')](_0x383a13)[_0xb00b('0x1a')](_0x676df3);}};}function respondWithFilteredResult(_0x317754,_0x399801){return function(_0x2fa153){if(_0x2fa153){var _0x38dc46=_0x2fa153[_0xb00b('0x1b')],_0x39ac6e=_0x399801[_0xb00b('0x1c')],_0x344b36=_0x399801[_0xb00b('0x1c')]+_0x399801[_0xb00b('0x1d')],_0xa9e43b;if(_0x344b36>=_0x38dc46){_0x344b36=_0x38dc46;_0xa9e43b=0xc8;}else{_0xa9e43b=0xce;}_0x317754[_0xb00b('0x19')](_0xa9e43b);return _0x317754['set'](_0xb00b('0x1e'),_0x39ac6e+'-'+_0x344b36+'/'+_0x38dc46)['json'](_0x2fa153);}return null;};}function patchUpdates(_0x104b49){return function(_0x3a88d6){try{jsonpatch['apply'](_0x3a88d6,_0x104b49,!![]);}catch(_0x4c984d){return BPromise[_0xb00b('0x1f')](_0x4c984d);}return _0x3a88d6[_0xb00b('0x20')]();};}function saveUpdates(_0x93ae7f,_0x51f6e1){return function(_0x4672d9){if(_0x4672d9){return _0x4672d9[_0xb00b('0x21')](_0x93ae7f)[_0xb00b('0x22')](function(_0x57e4b4){return _0x57e4b4;});}return null;};}function removeEntity(_0x1140a9,_0x4072b5){return function(_0x20ae7a){if(_0x20ae7a){return _0x20ae7a['destroy']()['then'](function(){var _0xdc2d34=_0x20ae7a['get']({'plain':!![]});var _0x1b0f22=_0xb00b('0x23');return db[_0xb00b('0x24')][_0xb00b('0x25')]({'where':{'type':_0x1b0f22,'resourceId':_0xdc2d34['id']}})[_0xb00b('0x22')](function(){return _0x20ae7a;});})[_0xb00b('0x22')](function(){_0x1140a9[_0xb00b('0x19')](0xcc)[_0xb00b('0x26')]();});}};}function handleEntityNotFound(_0x5e3f4d,_0x16c61d){return function(_0xe18c3f){if(!_0xe18c3f){_0x5e3f4d[_0xb00b('0x18')](0x194);}return _0xe18c3f;};}function handleError(_0x18b8d2,_0x299c5b){_0x299c5b=_0x299c5b||0x1f4;return function(_0x3c9787){logger['error'](_0x3c9787[_0xb00b('0x27')]);if(_0x3c9787[_0xb00b('0x28')]){delete _0x3c9787['name'];}_0x18b8d2[_0xb00b('0x19')](_0x299c5b)[_0xb00b('0x29')](_0x3c9787);};}exports[_0xb00b('0x2a')]=function(_0x32b54c,_0x34bff1){var _0x4d4c02={},_0xbc45a8={},_0x132814={'count':0x0,'rows':[]};var _0x244c95=_[_0xb00b('0x2b')](db[_0xb00b('0x2c')][_0xb00b('0x2d')],function(_0x50725a){return{'name':_0x50725a[_0xb00b('0x2e')],'type':_0x50725a[_0xb00b('0x2f')][_0xb00b('0x30')]};});_0xbc45a8['model']=_[_0xb00b('0x2b')](_0x244c95,'name');_0xbc45a8[_0xb00b('0x31')]=_[_0xb00b('0x32')](_0x32b54c[_0xb00b('0x31')]);_0xbc45a8[_0xb00b('0x33')]=_['intersection'](_0xbc45a8[_0xb00b('0x34')],_0xbc45a8['query']);_0x4d4c02[_0xb00b('0x35')]=_[_0xb00b('0x36')](_0xbc45a8[_0xb00b('0x34')],qs[_0xb00b('0x37')](_0x32b54c[_0xb00b('0x31')][_0xb00b('0x37')]));_0x4d4c02[_0xb00b('0x35')]=_0x4d4c02[_0xb00b('0x35')][_0xb00b('0x38')]?_0x4d4c02[_0xb00b('0x35')]:_0xbc45a8[_0xb00b('0x34')];if(!_0x32b54c[_0xb00b('0x31')]['hasOwnProperty'](_0xb00b('0x39'))){_0x4d4c02[_0xb00b('0x1d')]=qs['limit'](_0x32b54c[_0xb00b('0x31')]['limit']);_0x4d4c02[_0xb00b('0x1c')]=qs['offset'](_0x32b54c['query'][_0xb00b('0x1c')]);}_0x4d4c02[_0xb00b('0x3a')]=qs['sort'](_0x32b54c['query'][_0xb00b('0x3b')]);_0x4d4c02[_0xb00b('0x3c')]=qs[_0xb00b('0x33')](_[_0xb00b('0x3d')](_0x32b54c['query'],_0xbc45a8[_0xb00b('0x33')]),_0x244c95);if(_0x32b54c[_0xb00b('0x31')]['filter']){_0x4d4c02[_0xb00b('0x3c')]=_[_0xb00b('0x3e')](_0x4d4c02[_0xb00b('0x3c')],{'$or':_[_0xb00b('0x2b')](_0x244c95,function(_0x2f4878){if(_0x2f4878[_0xb00b('0x2f')]!==_0xb00b('0x3f')){var _0x2ee4e7={};_0x2ee4e7[_0x2f4878['name']]={'$like':'%'+_0x32b54c[_0xb00b('0x31')][_0xb00b('0x40')]+'%'};return _0x2ee4e7;}})});}_0x4d4c02=_[_0xb00b('0x3e')]({},_0x4d4c02,_0x32b54c[_0xb00b('0x41')]);var _0x56682b={'where':_0x4d4c02[_0xb00b('0x3c')]};return db[_0xb00b('0x2c')][_0xb00b('0x1b')](_0x56682b)[_0xb00b('0x22')](function(_0x3759e1){_0x132814['count']=_0x3759e1;if(_0x32b54c['query'][_0xb00b('0x42')]){_0x4d4c02[_0xb00b('0x43')]=[{'all':!![]}];}return db[_0xb00b('0x2c')]['findAll'](_0x4d4c02);})['then'](function(_0x393508){_0x132814[_0xb00b('0x44')]=_0x393508;return _0x132814;})['then'](respondWithFilteredResult(_0x34bff1,_0x4d4c02))[_0xb00b('0x45')](handleError(_0x34bff1,null));};exports[_0xb00b('0x46')]=function(_0x3634ca,_0x4b50a8){var _0x11a686={'raw':!![],'where':{'id':_0x3634ca[_0xb00b('0x47')]['id']}},_0x53505b={};_0x53505b[_0xb00b('0x34')]=_[_0xb00b('0x32')](db[_0xb00b('0x2c')][_0xb00b('0x2d')]);_0x53505b[_0xb00b('0x31')]=_['keys'](_0x3634ca['query']);_0x53505b[_0xb00b('0x33')]=_['intersection'](_0x53505b['model'],_0x53505b[_0xb00b('0x31')]);_0x11a686[_0xb00b('0x35')]=_[_0xb00b('0x36')](_0x53505b[_0xb00b('0x34')],qs[_0xb00b('0x37')](_0x3634ca[_0xb00b('0x31')][_0xb00b('0x37')]));_0x11a686[_0xb00b('0x35')]=_0x11a686[_0xb00b('0x35')][_0xb00b('0x38')]?_0x11a686['attributes']:_0x53505b['model'];if(_0x3634ca[_0xb00b('0x31')][_0xb00b('0x42')]){_0x11a686[_0xb00b('0x43')]=[{'all':!![]}];}_0x11a686=_[_0xb00b('0x3e')]({},_0x11a686,_0x3634ca[_0xb00b('0x41')]);return db[_0xb00b('0x2c')][_0xb00b('0x48')](_0x11a686)['then'](handleEntityNotFound(_0x4b50a8,null))[_0xb00b('0x22')](respondWithResult(_0x4b50a8,null))[_0xb00b('0x45')](handleError(_0x4b50a8,null));};exports[_0xb00b('0x49')]=function(_0x401129,_0x16d8e7){return db[_0xb00b('0x2c')][_0xb00b('0x49')](_0x401129[_0xb00b('0x4a')],{})[_0xb00b('0x22')](function(_0xb2783d){var _0x729955=_0x401129[_0xb00b('0x4b')][_0xb00b('0x4c')]({'plain':!![]});if(!_0x729955)throw new Error(_0xb00b('0x4d'));if(_0x729955['role']==='user'){var _0x578955=_0xb2783d[_0xb00b('0x4c')]({'plain':!![]});var _0x384cc8=_0xb00b('0x23');return db[_0xb00b('0x4e')][_0xb00b('0x48')]({'where':{'name':_0x384cc8,'userProfileId':_0x729955[_0xb00b('0x4f')]},'raw':!![]})['then'](function(_0xa3ec89){if(_0xa3ec89&&_0xa3ec89[_0xb00b('0x50')]===0x0){return db[_0xb00b('0x24')]['create']({'name':_0x578955[_0xb00b('0x28')],'resourceId':_0x578955['id'],'type':_0xa3ec89[_0xb00b('0x28')],'sectionId':_0xa3ec89['id']},{})[_0xb00b('0x22')](function(){return _0xb2783d;});}else{return _0xb2783d;}})[_0xb00b('0x45')](function(_0x405c8b){logger[_0xb00b('0x51')](_0xb00b('0x52'),_0x405c8b);throw _0x405c8b;});}return _0xb2783d;})[_0xb00b('0x22')](respondWithResult(_0x16d8e7,0xc9))[_0xb00b('0x45')](handleError(_0x16d8e7,null));};exports['update']=function(_0x79b11,_0x36b25e){if(_0x79b11[_0xb00b('0x4a')]['id']){delete _0x79b11[_0xb00b('0x4a')]['id'];}return db[_0xb00b('0x2c')][_0xb00b('0x48')]({'where':{'id':_0x79b11[_0xb00b('0x47')]['id']}})[_0xb00b('0x22')](handleEntityNotFound(_0x36b25e,null))[_0xb00b('0x22')](saveUpdates(_0x79b11['body'],null))[_0xb00b('0x22')](respondWithResult(_0x36b25e,null))[_0xb00b('0x45')](handleError(_0x36b25e,null));};exports[_0xb00b('0x25')]=function(_0x1e7356,_0x527f80){return db[_0xb00b('0x2c')]['find']({'where':{'id':_0x1e7356['params']['id']}})[_0xb00b('0x22')](handleEntityNotFound(_0x527f80,null))[_0xb00b('0x22')](removeEntity(_0x527f80,null))[_0xb00b('0x45')](handleError(_0x527f80,null));};exports['addInterval']=function(_0x2cd46a,_0x1d484a,_0x3dd5fd){if(_0x2cd46a[_0xb00b('0x4a')]['id']){delete _0x2cd46a[_0xb00b('0x4a')]['id'];}return db['Interval'][_0xb00b('0x48')]({'where':{'id':_0x2cd46a['params']['id']}})['then'](handleEntityNotFound(_0x1d484a,null))[_0xb00b('0x22')](function(_0x52b02b){if(_0x52b02b){_0x2cd46a[_0xb00b('0x4a')][_0xb00b('0x53')]=_0x52b02b['id'];return db[_0xb00b('0x2c')][_0xb00b('0x49')](_0x2cd46a[_0xb00b('0x4a')]);}})[_0xb00b('0x22')](respondWithResult(_0x1d484a,null))[_0xb00b('0x45')](handleError(_0x1d484a,null));};exports['getIntervals']=function(_0xc3cf64,_0x3abd98,_0x575397){var _0x4557e6={};var _0x30c759={};var _0x2e6077;var _0x31c559;return db['Interval']['findOne']({'where':{'id':_0xc3cf64[_0xb00b('0x47')]['id']}})[_0xb00b('0x22')](handleEntityNotFound(_0x3abd98,null))[_0xb00b('0x22')](function(_0x5d6306){if(_0x5d6306){_0x2e6077=_0x5d6306;_0x30c759[_0xb00b('0x34')]=_['keys'](db['Interval'][_0xb00b('0x2d')]);_0x30c759[_0xb00b('0x31')]=_[_0xb00b('0x32')](_0xc3cf64[_0xb00b('0x31')]);_0x30c759[_0xb00b('0x33')]=_[_0xb00b('0x36')](_0x30c759[_0xb00b('0x34')],_0x30c759[_0xb00b('0x31')]);_0x4557e6[_0xb00b('0x35')]=_['intersection'](_0x30c759[_0xb00b('0x34')],qs[_0xb00b('0x37')](_0xc3cf64[_0xb00b('0x31')][_0xb00b('0x37')]));_0x4557e6[_0xb00b('0x35')]=_0x4557e6[_0xb00b('0x35')][_0xb00b('0x38')]?_0x4557e6[_0xb00b('0x35')]:_0x30c759[_0xb00b('0x34')];_0x4557e6[_0xb00b('0x3a')]=qs[_0xb00b('0x3b')](_0xc3cf64[_0xb00b('0x31')]['sort']);_0x4557e6[_0xb00b('0x3c')]=qs['filters'](_['pick'](_0xc3cf64[_0xb00b('0x31')],_0x30c759[_0xb00b('0x33')]));if(_0xc3cf64[_0xb00b('0x31')][_0xb00b('0x40')]){_0x4557e6['where']=_['merge'](_0x4557e6[_0xb00b('0x3c')],{'$or':_['map'](_0x4557e6[_0xb00b('0x35')],function(_0x172498){var _0x150e09={};_0x150e09[_0x172498]={'$like':'%'+_0xc3cf64[_0xb00b('0x31')]['filter']+'%'};return _0x150e09;})});}_0x4557e6=_[_0xb00b('0x3e')]({},_0x4557e6,_0xc3cf64[_0xb00b('0x41')]);return _0x2e6077[_0xb00b('0x54')](_0x4557e6);}})[_0xb00b('0x22')](function(_0x2a707f){if(_0x2a707f){_0x31c559=_0x2a707f[_0xb00b('0x38')];if(!_0xc3cf64[_0xb00b('0x31')][_0xb00b('0x55')](_0xb00b('0x39'))){_0x4557e6[_0xb00b('0x1d')]=qs['limit'](_0xc3cf64[_0xb00b('0x31')][_0xb00b('0x1d')]);_0x4557e6['offset']=qs[_0xb00b('0x1c')](_0xc3cf64['query'][_0xb00b('0x1c')]);}return _0x2e6077[_0xb00b('0x54')](_0x4557e6);}})[_0xb00b('0x22')](function(_0x140080){if(_0x140080){return _0x140080?{'count':_0x31c559,'rows':_0x140080}:null;}})[_0xb00b('0x22')](respondWithResult(_0x3abd98,null))[_0xb00b('0x45')](handleError(_0x3abd98,null));};exports['addIntervals']=function(_0x397a5a,_0x43a8af,_0x287f83){return db[_0xb00b('0x2c')]['findOne']({'where':{'id':_0x397a5a[_0xb00b('0x47')]['id']}})[_0xb00b('0x22')](handleEntityNotFound(_0x43a8af,null))[_0xb00b('0x22')](function(_0x4d9f1f){if(_0x4d9f1f){return db[_0xb00b('0x56')][_0xb00b('0x57')](function(_0x5b7aee){return db[_0xb00b('0x2c')][_0xb00b('0x25')]({'where':{'IntervalId':_0x397a5a[_0xb00b('0x47')]['id']},'transaction':_0x5b7aee})[_0xb00b('0x22')](function(_0x44c123){var _0x19593e=_[_0xb00b('0x2b')](_0x397a5a[_0xb00b('0x4a')],function(_0x1be0af){delete _0x1be0af['id'];_0x1be0af[_0xb00b('0x53')]=_0x397a5a[_0xb00b('0x47')]['id'];return _0x1be0af;});return db['Interval'][_0xb00b('0x58')](_0x19593e,{'transaction':_0x5b7aee});});})[_0xb00b('0x22')](function(){return db[_0xb00b('0x2c')]['findAll']({'where':{'IntervalId':_0x397a5a['params']['id']}});});}})['then'](respondWithResult(_0x43a8af,null))[_0xb00b('0x45')](handleError(_0x43a8af,null));}; \ No newline at end of file +var _0xd7f5=['status','json','count','offset','limit','set','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','map','Interval','rawAttributes','fieldName','type','query','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','addInterval','IntervalId','getIntervals','filter','nolimit','addIntervals','findOne','transaction','bulkCreate','findAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end'];(function(_0x2a64b1,_0x575846){var _0x4ed9e3=function(_0x9b35fe){while(--_0x9b35fe){_0x2a64b1['push'](_0x2a64b1['shift']());}};_0x4ed9e3(++_0x575846);}(_0xd7f5,0x93));var _0x5d7f=function(_0x4cd226,_0x489a22){_0x4cd226=_0x4cd226-0x0;var _0x19c008=_0xd7f5[_0x4cd226];return _0x19c008;};'use strict';var pdf=require(_0x5d7f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5d7f('0x1'));var zipdir=require(_0x5d7f('0x2'));var jsonpatch=require(_0x5d7f('0x3'));var rp=require(_0x5d7f('0x4'));var moment=require(_0x5d7f('0x5'));var BPromise=require(_0x5d7f('0x6'));var Mustache=require(_0x5d7f('0x7'));var util=require(_0x5d7f('0x8'));var path=require(_0x5d7f('0x9'));var sox=require(_0x5d7f('0xa'));var csv=require(_0x5d7f('0xb'));var ejs=require(_0x5d7f('0xc'));var fs=require('fs');var _=require(_0x5d7f('0xd'));var squel=require(_0x5d7f('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d7f('0xf'));var toCsv=require(_0x5d7f('0xb'));var querystring=require(_0x5d7f('0x10'));var Papa=require('papaparse');var Redis=require(_0x5d7f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5d7f('0x12'));var as=require(_0x5d7f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d7f('0x14'))(_0x5d7f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5d7f('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x584f76,_0x31e657){_0x31e657=_0x31e657||0xcc;return function(_0x5b623f){if(_0x5b623f){return _0x584f76[_0x5d7f('0x17')](_0x31e657);}return _0x584f76['status'](_0x31e657)[_0x5d7f('0x18')]();};}function respondWithResult(_0x14d4bf,_0x20fafa){_0x20fafa=_0x20fafa||0xc8;return function(_0x118eda){if(_0x118eda){return _0x14d4bf[_0x5d7f('0x19')](_0x20fafa)[_0x5d7f('0x1a')](_0x118eda);}};}function respondWithFilteredResult(_0x91f0e3,_0x287de3){return function(_0x41c8cc){if(_0x41c8cc){var _0xd0fe7d=_0x41c8cc[_0x5d7f('0x1b')],_0x38f972=_0x287de3[_0x5d7f('0x1c')],_0xae28b9=_0x287de3['offset']+_0x287de3[_0x5d7f('0x1d')],_0x2e4194;if(_0xae28b9>=_0xd0fe7d){_0xae28b9=_0xd0fe7d;_0x2e4194=0xc8;}else{_0x2e4194=0xce;}_0x91f0e3[_0x5d7f('0x19')](_0x2e4194);return _0x91f0e3[_0x5d7f('0x1e')]('Content-Range',_0x38f972+'-'+_0xae28b9+'/'+_0xd0fe7d)[_0x5d7f('0x1a')](_0x41c8cc);}return null;};}function patchUpdates(_0x2e38d6){return function(_0x294670){try{jsonpatch['apply'](_0x294670,_0x2e38d6,!![]);}catch(_0x585959){return BPromise[_0x5d7f('0x1f')](_0x585959);}return _0x294670[_0x5d7f('0x20')]();};}function saveUpdates(_0x343ae8,_0x1ad4b0){return function(_0x276386){if(_0x276386){return _0x276386[_0x5d7f('0x21')](_0x343ae8)[_0x5d7f('0x22')](function(_0x4d0aca){return _0x4d0aca;});}return null;};}function removeEntity(_0x32a895,_0x256d82){return function(_0x4c23c8){if(_0x4c23c8){return _0x4c23c8[_0x5d7f('0x23')]()[_0x5d7f('0x22')](function(){var _0x5a9c80=_0x4c23c8[_0x5d7f('0x24')]({'plain':!![]});var _0x54bae4=_0x5d7f('0x25');return db[_0x5d7f('0x26')]['destroy']({'where':{'type':_0x54bae4,'resourceId':_0x5a9c80['id']}})['then'](function(){return _0x4c23c8;});})[_0x5d7f('0x22')](function(){_0x32a895[_0x5d7f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x219e10,_0x30a30f){return function(_0x1027ed){if(!_0x1027ed){_0x219e10[_0x5d7f('0x17')](0x194);}return _0x1027ed;};}function handleError(_0x18df35,_0x4a2bef){_0x4a2bef=_0x4a2bef||0x1f4;return function(_0x1c9e34){logger[_0x5d7f('0x27')](_0x1c9e34[_0x5d7f('0x28')]);if(_0x1c9e34[_0x5d7f('0x29')]){delete _0x1c9e34['name'];}_0x18df35[_0x5d7f('0x19')](_0x4a2bef)['send'](_0x1c9e34);};}exports['index']=function(_0x5001eb,_0x2791c0){var _0x2c443e={},_0x603ff4={},_0x483a6e={'count':0x0,'rows':[]};var _0x59c5ec=_[_0x5d7f('0x2a')](db[_0x5d7f('0x2b')][_0x5d7f('0x2c')],function(_0x9d7a10){return{'name':_0x9d7a10[_0x5d7f('0x2d')],'type':_0x9d7a10[_0x5d7f('0x2e')]['key']};});_0x603ff4['model']=_[_0x5d7f('0x2a')](_0x59c5ec,_0x5d7f('0x29'));_0x603ff4['query']=_['keys'](_0x5001eb[_0x5d7f('0x2f')]);_0x603ff4['filters']=_[_0x5d7f('0x30')](_0x603ff4['model'],_0x603ff4[_0x5d7f('0x2f')]);_0x2c443e[_0x5d7f('0x31')]=_[_0x5d7f('0x30')](_0x603ff4[_0x5d7f('0x32')],qs[_0x5d7f('0x33')](_0x5001eb['query'][_0x5d7f('0x33')]));_0x2c443e[_0x5d7f('0x31')]=_0x2c443e[_0x5d7f('0x31')]['length']?_0x2c443e[_0x5d7f('0x31')]:_0x603ff4['model'];if(!_0x5001eb[_0x5d7f('0x2f')][_0x5d7f('0x34')]('nolimit')){_0x2c443e[_0x5d7f('0x1d')]=qs[_0x5d7f('0x1d')](_0x5001eb[_0x5d7f('0x2f')][_0x5d7f('0x1d')]);_0x2c443e[_0x5d7f('0x1c')]=qs[_0x5d7f('0x1c')](_0x5001eb[_0x5d7f('0x2f')]['offset']);}_0x2c443e[_0x5d7f('0x35')]=qs[_0x5d7f('0x36')](_0x5001eb['query'][_0x5d7f('0x36')]);_0x2c443e[_0x5d7f('0x37')]=qs[_0x5d7f('0x38')](_[_0x5d7f('0x39')](_0x5001eb[_0x5d7f('0x2f')],_0x603ff4[_0x5d7f('0x38')]),_0x59c5ec);if(_0x5001eb[_0x5d7f('0x2f')]['filter']){_0x2c443e[_0x5d7f('0x37')]=_[_0x5d7f('0x3a')](_0x2c443e['where'],{'$or':_['map'](_0x59c5ec,function(_0x27e30c){if(_0x27e30c['type']!==_0x5d7f('0x3b')){var _0x27debf={};_0x27debf[_0x27e30c[_0x5d7f('0x29')]]={'$like':'%'+_0x5001eb[_0x5d7f('0x2f')]['filter']+'%'};return _0x27debf;}})});}_0x2c443e=_['merge']({},_0x2c443e,_0x5001eb[_0x5d7f('0x3c')]);var _0x441e4b={'where':_0x2c443e[_0x5d7f('0x37')]};return db['Interval'][_0x5d7f('0x1b')](_0x441e4b)[_0x5d7f('0x22')](function(_0x40f9df){_0x483a6e[_0x5d7f('0x1b')]=_0x40f9df;if(_0x5001eb['query'][_0x5d7f('0x3d')]){_0x2c443e['include']=[{'all':!![]}];}return db[_0x5d7f('0x2b')]['findAll'](_0x2c443e);})[_0x5d7f('0x22')](function(_0xaa378a){_0x483a6e[_0x5d7f('0x3e')]=_0xaa378a;return _0x483a6e;})[_0x5d7f('0x22')](respondWithFilteredResult(_0x2791c0,_0x2c443e))[_0x5d7f('0x3f')](handleError(_0x2791c0,null));};exports[_0x5d7f('0x40')]=function(_0x18175d,_0x4775a9){var _0x2899f8={'raw':!![],'where':{'id':_0x18175d[_0x5d7f('0x41')]['id']}},_0x4d30d1={};_0x4d30d1[_0x5d7f('0x32')]=_[_0x5d7f('0x42')](db[_0x5d7f('0x2b')][_0x5d7f('0x2c')]);_0x4d30d1['query']=_[_0x5d7f('0x42')](_0x18175d[_0x5d7f('0x2f')]);_0x4d30d1['filters']=_['intersection'](_0x4d30d1[_0x5d7f('0x32')],_0x4d30d1[_0x5d7f('0x2f')]);_0x2899f8[_0x5d7f('0x31')]=_[_0x5d7f('0x30')](_0x4d30d1[_0x5d7f('0x32')],qs[_0x5d7f('0x33')](_0x18175d['query'][_0x5d7f('0x33')]));_0x2899f8['attributes']=_0x2899f8[_0x5d7f('0x31')][_0x5d7f('0x43')]?_0x2899f8[_0x5d7f('0x31')]:_0x4d30d1[_0x5d7f('0x32')];if(_0x18175d[_0x5d7f('0x2f')][_0x5d7f('0x3d')]){_0x2899f8['include']=[{'all':!![]}];}_0x2899f8=_[_0x5d7f('0x3a')]({},_0x2899f8,_0x18175d['options']);return db[_0x5d7f('0x2b')]['find'](_0x2899f8)[_0x5d7f('0x22')](handleEntityNotFound(_0x4775a9,null))[_0x5d7f('0x22')](respondWithResult(_0x4775a9,null))['catch'](handleError(_0x4775a9,null));};exports[_0x5d7f('0x44')]=function(_0x5240e2,_0x343d1e){return db['Interval'][_0x5d7f('0x44')](_0x5240e2[_0x5d7f('0x45')],{})[_0x5d7f('0x22')](function(_0x2d46d5){var _0x16a165=_0x5240e2[_0x5d7f('0x46')][_0x5d7f('0x24')]({'plain':!![]});if(!_0x16a165)throw new Error(_0x5d7f('0x47'));if(_0x16a165[_0x5d7f('0x48')]===_0x5d7f('0x46')){var _0x17bba1=_0x2d46d5[_0x5d7f('0x24')]({'plain':!![]});var _0x449ab8=_0x5d7f('0x25');return db[_0x5d7f('0x49')][_0x5d7f('0x4a')]({'where':{'name':_0x449ab8,'userProfileId':_0x16a165[_0x5d7f('0x4b')]},'raw':!![]})[_0x5d7f('0x22')](function(_0x51efe9){if(_0x51efe9&&_0x51efe9['autoAssociation']===0x0){return db['UserProfileResource'][_0x5d7f('0x44')]({'name':_0x17bba1['name'],'resourceId':_0x17bba1['id'],'type':_0x51efe9[_0x5d7f('0x29')],'sectionId':_0x51efe9['id']},{})[_0x5d7f('0x22')](function(){return _0x2d46d5;});}else{return _0x2d46d5;}})['catch'](function(_0x16926b){logger[_0x5d7f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16926b);throw _0x16926b;});}return _0x2d46d5;})['then'](respondWithResult(_0x343d1e,0xc9))[_0x5d7f('0x3f')](handleError(_0x343d1e,null));};exports[_0x5d7f('0x21')]=function(_0x9d1e45,_0x2d1f8a){if(_0x9d1e45[_0x5d7f('0x45')]['id']){delete _0x9d1e45['body']['id'];}return db[_0x5d7f('0x2b')][_0x5d7f('0x4a')]({'where':{'id':_0x9d1e45['params']['id']}})['then'](handleEntityNotFound(_0x2d1f8a,null))['then'](saveUpdates(_0x9d1e45['body'],null))['then'](respondWithResult(_0x2d1f8a,null))[_0x5d7f('0x3f')](handleError(_0x2d1f8a,null));};exports[_0x5d7f('0x23')]=function(_0x44989b,_0x32045f){return db[_0x5d7f('0x2b')][_0x5d7f('0x4a')]({'where':{'id':_0x44989b[_0x5d7f('0x41')]['id']}})[_0x5d7f('0x22')](handleEntityNotFound(_0x32045f,null))[_0x5d7f('0x22')](removeEntity(_0x32045f,null))['catch'](handleError(_0x32045f,null));};exports[_0x5d7f('0x4c')]=function(_0x322439,_0x3a0052,_0x1ad33a){if(_0x322439['body']['id']){delete _0x322439['body']['id'];}return db['Interval'][_0x5d7f('0x4a')]({'where':{'id':_0x322439[_0x5d7f('0x41')]['id']}})[_0x5d7f('0x22')](handleEntityNotFound(_0x3a0052,null))[_0x5d7f('0x22')](function(_0x23c454){if(_0x23c454){_0x322439['body'][_0x5d7f('0x4d')]=_0x23c454['id'];return db[_0x5d7f('0x2b')][_0x5d7f('0x44')](_0x322439[_0x5d7f('0x45')]);}})[_0x5d7f('0x22')](respondWithResult(_0x3a0052,null))[_0x5d7f('0x3f')](handleError(_0x3a0052,null));};exports[_0x5d7f('0x4e')]=function(_0x366faf,_0x578da5,_0x57507b){var _0x2e29b0={};var _0x211be9={};var _0x43dcc4;var _0x29bdd2;return db['Interval']['findOne']({'where':{'id':_0x366faf[_0x5d7f('0x41')]['id']}})[_0x5d7f('0x22')](handleEntityNotFound(_0x578da5,null))['then'](function(_0x35e6f7){if(_0x35e6f7){_0x43dcc4=_0x35e6f7;_0x211be9['model']=_[_0x5d7f('0x42')](db['Interval'][_0x5d7f('0x2c')]);_0x211be9[_0x5d7f('0x2f')]=_[_0x5d7f('0x42')](_0x366faf[_0x5d7f('0x2f')]);_0x211be9[_0x5d7f('0x38')]=_[_0x5d7f('0x30')](_0x211be9['model'],_0x211be9[_0x5d7f('0x2f')]);_0x2e29b0[_0x5d7f('0x31')]=_['intersection'](_0x211be9[_0x5d7f('0x32')],qs['fields'](_0x366faf[_0x5d7f('0x2f')][_0x5d7f('0x33')]));_0x2e29b0['attributes']=_0x2e29b0[_0x5d7f('0x31')][_0x5d7f('0x43')]?_0x2e29b0[_0x5d7f('0x31')]:_0x211be9[_0x5d7f('0x32')];_0x2e29b0['order']=qs[_0x5d7f('0x36')](_0x366faf[_0x5d7f('0x2f')][_0x5d7f('0x36')]);_0x2e29b0[_0x5d7f('0x37')]=qs[_0x5d7f('0x38')](_[_0x5d7f('0x39')](_0x366faf[_0x5d7f('0x2f')],_0x211be9[_0x5d7f('0x38')]));if(_0x366faf[_0x5d7f('0x2f')][_0x5d7f('0x4f')]){_0x2e29b0[_0x5d7f('0x37')]=_['merge'](_0x2e29b0[_0x5d7f('0x37')],{'$or':_[_0x5d7f('0x2a')](_0x2e29b0[_0x5d7f('0x31')],function(_0x12ed88){var _0x2e4544={};_0x2e4544[_0x12ed88]={'$like':'%'+_0x366faf[_0x5d7f('0x2f')][_0x5d7f('0x4f')]+'%'};return _0x2e4544;})});}_0x2e29b0=_[_0x5d7f('0x3a')]({},_0x2e29b0,_0x366faf['options']);return _0x43dcc4[_0x5d7f('0x4e')](_0x2e29b0);}})[_0x5d7f('0x22')](function(_0x4ce96c){if(_0x4ce96c){_0x29bdd2=_0x4ce96c['length'];if(!_0x366faf[_0x5d7f('0x2f')][_0x5d7f('0x34')](_0x5d7f('0x50'))){_0x2e29b0[_0x5d7f('0x1d')]=qs[_0x5d7f('0x1d')](_0x366faf[_0x5d7f('0x2f')][_0x5d7f('0x1d')]);_0x2e29b0[_0x5d7f('0x1c')]=qs['offset'](_0x366faf[_0x5d7f('0x2f')][_0x5d7f('0x1c')]);}return _0x43dcc4[_0x5d7f('0x4e')](_0x2e29b0);}})[_0x5d7f('0x22')](function(_0x13df7d){if(_0x13df7d){return _0x13df7d?{'count':_0x29bdd2,'rows':_0x13df7d}:null;}})[_0x5d7f('0x22')](respondWithResult(_0x578da5,null))['catch'](handleError(_0x578da5,null));};exports[_0x5d7f('0x51')]=function(_0x3fd207,_0x2efd16,_0x335741){return db['Interval'][_0x5d7f('0x52')]({'where':{'id':_0x3fd207[_0x5d7f('0x41')]['id']}})[_0x5d7f('0x22')](handleEntityNotFound(_0x2efd16,null))['then'](function(_0x30a3e9){if(_0x30a3e9){return db['sequelize'][_0x5d7f('0x53')](function(_0x4793ae){return db[_0x5d7f('0x2b')][_0x5d7f('0x23')]({'where':{'IntervalId':_0x3fd207[_0x5d7f('0x41')]['id']},'transaction':_0x4793ae})[_0x5d7f('0x22')](function(_0x17ad79){var _0x47ad43=_['map'](_0x3fd207[_0x5d7f('0x45')],function(_0x3dddb9){delete _0x3dddb9['id'];_0x3dddb9['IntervalId']=_0x3fd207[_0x5d7f('0x41')]['id'];return _0x3dddb9;});return db[_0x5d7f('0x2b')][_0x5d7f('0x54')](_0x47ad43,{'transaction':_0x4793ae});});})[_0x5d7f('0x22')](function(){return db['Interval'][_0x5d7f('0x55')]({'where':{'IntervalId':_0x3fd207['params']['id']}});});}})['then'](respondWithResult(_0x2efd16,null))[_0x5d7f('0x3f')](handleError(_0x2efd16,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 2da9f9a..12ad9c8 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 _0x6f7a=['bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','rewrite','lodash','util','../../config/logger','api'];(function(_0x49e2b8,_0x5cf700){var _0x1f2213=function(_0x51f2bb){while(--_0x51f2bb){_0x49e2b8['push'](_0x49e2b8['shift']());}};_0x1f2213(++_0x5cf700);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x459a33,_0x445736){_0x459a33=_0x459a33-0x0;var _0x44d366=_0x6f7a[_0x459a33];return _0x44d366;};'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'));var extensions=require(_0xa6f7('0xa'));module[_0xa6f7('0xb')]=function(_0x1fdd5f,_0x335aaa){return _0x1fdd5f[_0xa6f7('0xc')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x30f2a7,_0x2674c9){extensions[_0xa6f7('0xd')](_0x1fdd5f,_0x30f2a7);},'afterBulkCreate':function(_0x362404,_0x23bb05,_0x49a451){_0x49a451();extensions['rewrite'](_0x1fdd5f,_0x362404[0x0]);},'afterUpdate':function(_0x2fd1d0,_0x225da4){extensions['rewrite'](_0x1fdd5f,_0x2fd1d0);},'afterDestroy':function(_0x178f20,_0x5623bf){extensions[_0xa6f7('0xd')](_0x1fdd5f,_0x178f20);}}});}; \ No newline at end of file +var _0x61a5=['api','bluebird','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','../../config/logger'];(function(_0x1c913d,_0x42beef){var _0x1c78b0=function(_0x12f1ef){while(--_0x12f1ef){_0x1c913d['push'](_0x1c913d['shift']());}};_0x1c78b0(++_0x42beef);}(_0x61a5,0x19e));var _0x561a=function(_0xffd1b5,_0x1ede18){_0xffd1b5=_0xffd1b5-0x0;var _0x3176d6=_0x61a5[_0xffd1b5];return _0x3176d6;};'use strict';var _=require(_0x561a('0x0'));var util=require('util');var logger=require(_0x561a('0x1'))(_0x561a('0x2'));var moment=require('moment');var BPromise=require(_0x561a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x561a('0x4'));var rimraf=require(_0x561a('0x5'));var config=require(_0x561a('0x6'));var attributes=require(_0x561a('0x7'));var extensions=require(_0x561a('0x8'));module[_0x561a('0x9')]=function(_0x1e2ce1,_0x2a763a){return _0x1e2ce1['define'](_0x561a('0xa'),attributes,{'tableName':_0x561a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe056b2,_0x5cd4f6){extensions[_0x561a('0xc')](_0x1e2ce1,_0xe056b2);},'afterBulkCreate':function(_0x2a0fdb,_0x5a4e9b,_0x44b705){_0x44b705();extensions[_0x561a('0xc')](_0x1e2ce1,_0x2a0fdb[0x0]);},'afterUpdate':function(_0x139208,_0x41a34a){extensions['rewrite'](_0x1e2ce1,_0x139208);},'afterDestroy':function(_0x52759e,_0x20c1f8){extensions[_0x561a('0xc')](_0x1e2ce1,_0x52759e);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index bf45118..fba8d38 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 _0xd9c6=['error','code','message','catch','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','ShowInterval','Interval','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5a41e9,_0x545f66){var _0x209919=function(_0x48f915){while(--_0x48f915){_0x5a41e9['push'](_0x5a41e9['shift']());}};_0x209919(++_0x545f66);}(_0xd9c6,0x1c0));var _0x6d9c=function(_0x798a03,_0xff9c94){_0x798a03=_0x798a03-0x0;var _0x5881e4=_0xd9c6[_0x798a03];return _0x5881e4;};'use strict';var _=require(_0x6d9c('0x0'));var util=require(_0x6d9c('0x1'));var moment=require(_0x6d9c('0x2'));var BPromise=require(_0x6d9c('0x3'));var rs=require(_0x6d9c('0x4'));var fs=require('fs');var Redis=require(_0x6d9c('0x5'));var db=require(_0x6d9c('0x6'))['db'];var utils=require(_0x6d9c('0x7'));var logger=require(_0x6d9c('0x8'))(_0x6d9c('0x9'));var config=require('../../config/environment');var jayson=require(_0x6d9c('0xa'));var client=jayson[_0x6d9c('0xb')][_0x6d9c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x373b12,_0x510606,_0x28ce2d){return new BPromise(function(_0x40551c,_0x41124a){return client[_0x6d9c('0xd')](_0x373b12,_0x28ce2d)[_0x6d9c('0xe')](function(_0x341a8b){logger[_0x6d9c('0xf')](_0x6d9c('0x10'),_0x510606,_0x6d9c('0x11'));logger[_0x6d9c('0x12')]('Interval,\x20%s,\x20%s,\x20%s',_0x510606,_0x6d9c('0x11'),JSON[_0x6d9c('0x13')](_0x341a8b));if(_0x341a8b[_0x6d9c('0x14')]){if(_0x341a8b['error'][_0x6d9c('0x15')]===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x510606,_0x341a8b[_0x6d9c('0x14')][_0x6d9c('0x16')]);return _0x41124a(_0x341a8b[_0x6d9c('0x14')][_0x6d9c('0x16')]);}logger[_0x6d9c('0x14')](_0x6d9c('0x10'),_0x510606,_0x341a8b[_0x6d9c('0x14')][_0x6d9c('0x16')]);return _0x40551c(_0x341a8b['error'][_0x6d9c('0x16')]);}else{logger[_0x6d9c('0xf')](_0x6d9c('0x10'),_0x510606,_0x6d9c('0x11'));_0x40551c(_0x341a8b['result'][_0x6d9c('0x16')]);}})[_0x6d9c('0x17')](function(_0x1a624d){logger['error'](_0x6d9c('0x10'),_0x510606,_0x1a624d);_0x41124a(_0x1a624d);});});}exports[_0x6d9c('0x18')]=function(_0x57993e){var _0x4ef744=this;return new Promise(function(_0x1e72d0,_0x2a0be0){return db['Interval'][_0x6d9c('0x19')]({'raw':_0x57993e[_0x6d9c('0x1a')]?_0x57993e[_0x6d9c('0x1a')][_0x6d9c('0x1b')]===undefined?!![]:![]:!![],'where':_0x57993e[_0x6d9c('0x1a')]?_0x57993e['options'][_0x6d9c('0x1c')]||null:null,'attributes':_0x57993e[_0x6d9c('0x1a')]?_0x57993e[_0x6d9c('0x1a')][_0x6d9c('0x1d')]||null:null,'limit':_0x57993e[_0x6d9c('0x1a')]?_0x57993e['options'][_0x6d9c('0x1e')]||null:null,'include':_0x57993e['options']?_0x57993e[_0x6d9c('0x1a')][_0x6d9c('0x1f')]?_[_0x6d9c('0x20')](_0x57993e[_0x6d9c('0x1a')]['include'],function(_0x55b343){return{'model':db[_0x55b343[_0x6d9c('0x21')]],'as':_0x55b343['as'],'attributes':_0x55b343[_0x6d9c('0x1d')],'include':_0x55b343[_0x6d9c('0x1f')]?_[_0x6d9c('0x20')](_0x55b343[_0x6d9c('0x1f')],function(_0x1e32f9){return{'model':db[_0x1e32f9[_0x6d9c('0x21')]],'as':_0x1e32f9['as'],'attributes':_0x1e32f9['attributes'],'include':_0x1e32f9[_0x6d9c('0x1f')]?_['map'](_0x1e32f9[_0x6d9c('0x1f')],function(_0x4506b5){return{'model':db[_0x4506b5[_0x6d9c('0x21')]],'as':_0x4506b5['as'],'attributes':_0x4506b5[_0x6d9c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6d9c('0xe')](function(_0x3b5fdf){logger[_0x6d9c('0xf')]('GetInterval',_0x57993e);logger[_0x6d9c('0x12')](_0x6d9c('0x18'),_0x57993e,JSON[_0x6d9c('0x13')](_0x3b5fdf));_0x1e72d0(_0x3b5fdf);})[_0x6d9c('0x17')](function(_0x4b20d7){logger[_0x6d9c('0x14')](_0x6d9c('0x18'),_0x4b20d7[_0x6d9c('0x16')],_0x57993e);_0x2a0be0(_0x4ef744[_0x6d9c('0x14')](0x1f4,_0x4b20d7[_0x6d9c('0x16')]));});});};exports[_0x6d9c('0x22')]=function(_0x423f88){var _0x1027d4=this;return new Promise(function(_0x14fa6c,_0x3aef1e){return db[_0x6d9c('0x23')]['find']({'raw':_0x423f88[_0x6d9c('0x1a')]?_0x423f88['options'][_0x6d9c('0x1b')]===undefined?!![]:![]:!![],'where':_0x423f88[_0x6d9c('0x1a')]?_0x423f88['options'][_0x6d9c('0x1c')]||null:null,'attributes':_0x423f88[_0x6d9c('0x1a')]?_0x423f88[_0x6d9c('0x1a')]['attributes']||null:null,'include':_0x423f88[_0x6d9c('0x1a')]?_0x423f88['options'][_0x6d9c('0x1f')]?_[_0x6d9c('0x20')](_0x423f88['options'][_0x6d9c('0x1f')],function(_0x848a38){return{'model':db[_0x848a38[_0x6d9c('0x21')]],'as':_0x848a38['as'],'attributes':_0x848a38[_0x6d9c('0x1d')],'include':_0x848a38['include']?_[_0x6d9c('0x20')](_0x848a38[_0x6d9c('0x1f')],function(_0x1ac4a5){return{'model':db[_0x1ac4a5['model']],'as':_0x1ac4a5['as'],'attributes':_0x1ac4a5[_0x6d9c('0x1d')],'include':_0x1ac4a5[_0x6d9c('0x1f')]?_[_0x6d9c('0x20')](_0x1ac4a5['include'],function(_0x4aa04f){return{'model':db[_0x4aa04f[_0x6d9c('0x21')]],'as':_0x4aa04f['as'],'attributes':_0x4aa04f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe04670){logger[_0x6d9c('0xf')](_0x6d9c('0x22'),_0x423f88);logger[_0x6d9c('0x12')](_0x6d9c('0x22'),_0x423f88,JSON[_0x6d9c('0x13')](_0xe04670));_0x14fa6c(_0xe04670);})[_0x6d9c('0x17')](function(_0x5f46e6){logger['error'](_0x6d9c('0x22'),_0x5f46e6[_0x6d9c('0x16')],_0x423f88);_0x3aef1e(_0x1027d4[_0x6d9c('0x14')](0x1f4,_0x5f46e6[_0x6d9c('0x16')]));});});}; \ No newline at end of file +var _0x3e94=['message','info','result','GetInterval','Interval','findAll','options','raw','where','limit','map','include','model','attributes','then','catch','find','ShowInterval','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','Interval,\x20%s,\x20%s'];(function(_0xa7efcc,_0x5600bf){var _0x2e6497=function(_0x91e738){while(--_0x91e738){_0xa7efcc['push'](_0xa7efcc['shift']());}};_0x2e6497(++_0x5600bf);}(_0x3e94,0x1e6));var _0x43e9=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3e94[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x43e9('0x2'));var fs=require('fs');var Redis=require(_0x43e9('0x3'));var db=require(_0x43e9('0x4'))['db'];var utils=require(_0x43e9('0x5'));var logger=require(_0x43e9('0x6'))('rpc');var config=require(_0x43e9('0x7'));var jayson=require(_0x43e9('0x8'));var client=jayson[_0x43e9('0x9')][_0x43e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40045a,_0x4fc2f0,_0x4c8fcf){return new BPromise(function(_0x2aea7b,_0x1840c3){return client['request'](_0x40045a,_0x4c8fcf)['then'](function(_0x5e3a9b){logger['info']('Interval,\x20%s,\x20%s',_0x4fc2f0,_0x43e9('0xb'));logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x4fc2f0,_0x43e9('0xb'),JSON[_0x43e9('0xe')](_0x5e3a9b));if(_0x5e3a9b[_0x43e9('0xf')]){if(_0x5e3a9b[_0x43e9('0xf')][_0x43e9('0x10')]===0x1f4){logger['error'](_0x43e9('0x11'),_0x4fc2f0,_0x5e3a9b[_0x43e9('0xf')][_0x43e9('0x12')]);return _0x1840c3(_0x5e3a9b[_0x43e9('0xf')][_0x43e9('0x12')]);}logger[_0x43e9('0xf')](_0x43e9('0x11'),_0x4fc2f0,_0x5e3a9b[_0x43e9('0xf')][_0x43e9('0x12')]);return _0x2aea7b(_0x5e3a9b[_0x43e9('0xf')]['message']);}else{logger[_0x43e9('0x13')]('Interval,\x20%s,\x20%s',_0x4fc2f0,_0x43e9('0xb'));_0x2aea7b(_0x5e3a9b[_0x43e9('0x14')][_0x43e9('0x12')]);}})['catch'](function(_0x2e6376){logger[_0x43e9('0xf')](_0x43e9('0x11'),_0x4fc2f0,_0x2e6376);_0x1840c3(_0x2e6376);});});}exports[_0x43e9('0x15')]=function(_0x2e4179){var _0x544a07=this;return new Promise(function(_0xdde161,_0x1dd6e4){return db[_0x43e9('0x16')][_0x43e9('0x17')]({'raw':_0x2e4179[_0x43e9('0x18')]?_0x2e4179[_0x43e9('0x18')][_0x43e9('0x19')]===undefined?!![]:![]:!![],'where':_0x2e4179[_0x43e9('0x18')]?_0x2e4179[_0x43e9('0x18')][_0x43e9('0x1a')]||null:null,'attributes':_0x2e4179[_0x43e9('0x18')]?_0x2e4179[_0x43e9('0x18')]['attributes']||null:null,'limit':_0x2e4179[_0x43e9('0x18')]?_0x2e4179['options'][_0x43e9('0x1b')]||null:null,'include':_0x2e4179[_0x43e9('0x18')]?_0x2e4179[_0x43e9('0x18')]['include']?_[_0x43e9('0x1c')](_0x2e4179[_0x43e9('0x18')][_0x43e9('0x1d')],function(_0x1e5d31){return{'model':db[_0x1e5d31[_0x43e9('0x1e')]],'as':_0x1e5d31['as'],'attributes':_0x1e5d31['attributes'],'include':_0x1e5d31[_0x43e9('0x1d')]?_[_0x43e9('0x1c')](_0x1e5d31[_0x43e9('0x1d')],function(_0x29348e){return{'model':db[_0x29348e[_0x43e9('0x1e')]],'as':_0x29348e['as'],'attributes':_0x29348e[_0x43e9('0x1f')],'include':_0x29348e['include']?_[_0x43e9('0x1c')](_0x29348e['include'],function(_0x3a34cd){return{'model':db[_0x3a34cd[_0x43e9('0x1e')]],'as':_0x3a34cd['as'],'attributes':_0x3a34cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x43e9('0x20')](function(_0x2e445c){logger[_0x43e9('0x13')]('GetInterval',_0x2e4179);logger[_0x43e9('0xc')]('GetInterval',_0x2e4179,JSON[_0x43e9('0xe')](_0x2e445c));_0xdde161(_0x2e445c);})[_0x43e9('0x21')](function(_0x2a8cee){logger[_0x43e9('0xf')]('GetInterval',_0x2a8cee[_0x43e9('0x12')],_0x2e4179);_0x1dd6e4(_0x544a07['error'](0x1f4,_0x2a8cee[_0x43e9('0x12')]));});});};exports['ShowInterval']=function(_0xbf7fcc){var _0x4683f1=this;return new Promise(function(_0x422251,_0x41b50c){return db[_0x43e9('0x16')][_0x43e9('0x22')]({'raw':_0xbf7fcc[_0x43e9('0x18')]?_0xbf7fcc[_0x43e9('0x18')][_0x43e9('0x19')]===undefined?!![]:![]:!![],'where':_0xbf7fcc[_0x43e9('0x18')]?_0xbf7fcc['options'][_0x43e9('0x1a')]||null:null,'attributes':_0xbf7fcc[_0x43e9('0x18')]?_0xbf7fcc[_0x43e9('0x18')][_0x43e9('0x1f')]||null:null,'include':_0xbf7fcc['options']?_0xbf7fcc[_0x43e9('0x18')][_0x43e9('0x1d')]?_['map'](_0xbf7fcc[_0x43e9('0x18')]['include'],function(_0x4364a8){return{'model':db[_0x4364a8[_0x43e9('0x1e')]],'as':_0x4364a8['as'],'attributes':_0x4364a8['attributes'],'include':_0x4364a8[_0x43e9('0x1d')]?_[_0x43e9('0x1c')](_0x4364a8[_0x43e9('0x1d')],function(_0x24e9d5){return{'model':db[_0x24e9d5[_0x43e9('0x1e')]],'as':_0x24e9d5['as'],'attributes':_0x24e9d5[_0x43e9('0x1f')],'include':_0x24e9d5[_0x43e9('0x1d')]?_['map'](_0x24e9d5[_0x43e9('0x1d')],function(_0x50a216){return{'model':db[_0x50a216[_0x43e9('0x1e')]],'as':_0x50a216['as'],'attributes':_0x50a216['attributes']};}):[]};}):[]};}):[]:[]})[_0x43e9('0x20')](function(_0x31eee7){logger['info'](_0x43e9('0x23'),_0xbf7fcc);logger['debug'](_0x43e9('0x23'),_0xbf7fcc,JSON[_0x43e9('0xe')](_0x31eee7));_0x422251(_0x31eee7);})[_0x43e9('0x21')](function(_0x1b62ac){logger['error'](_0x43e9('0x23'),_0x1b62ac[_0x43e9('0x12')],_0xbf7fcc);_0x41b50c(_0x4683f1[_0x43e9('0xf')](0x1f4,_0x1b62ac[_0x43e9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index bd37c4d..ded5326 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 _0xc42f=['express','Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports'];(function(_0x396629,_0x24efaa){var _0xd523d7=function(_0x109768){while(--_0x109768){_0x396629['push'](_0x396629['shift']());}};_0xd523d7(++_0x24efaa);}(_0xc42f,0x1d0));var _0xfc42=function(_0x5b9878,_0x1a331c){_0x5b9878=_0x5b9878-0x0;var _0x2307bf=_0xc42f[_0x5b9878];return _0x2307bf;};'use strict';var express=require(_0xfc42('0x0'));var router=express[_0xfc42('0x1')]();var auth=require(_0xfc42('0x2'));var controller=require(_0xfc42('0x3'));router[_0xfc42('0x4')]('/',auth[_0xfc42('0x5')](),controller[_0xfc42('0x6')]);module[_0xfc42('0x7')]=router; \ No newline at end of file +var _0xe85c=['send','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xe85c,0x103));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xce85('0x0'));var router=express[_0xce85('0x1')]();var auth=require(_0xce85('0x2'));var controller=require(_0xce85('0x3'));router[_0xce85('0x4')]('/',auth['isAuthenticated'](),controller[_0xce85('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index d9298a3..b60dc98 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 _0x98b6=['openIssue','send','body','headers','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','setEncoding','utf8','data','end','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write'];(function(_0x4c3422,_0x4cda71){var _0x2bbe92=function(_0x337351){while(--_0x337351){_0x4c3422['push'](_0x4c3422['shift']());}};_0x2bbe92(++_0x4cda71);}(_0x98b6,0x103));var _0x698b=function(_0x10c4e9,_0x386a2e){_0x10c4e9=_0x10c4e9-0x0;var _0x3f39de=_0x98b6[_0x10c4e9];return _0x3f39de;};'use strict';var BPromise=require('bluebird');var https=require(_0x698b('0x0'));var logger=require(_0x698b('0x1'))(_0x698b('0x2'));var USERNAME=_0x698b('0x3');var PASSWORD=_0x698b('0x4');function openIssue(_0x1317ac,_0x39d677){var _0x56b4d={'fields':{'project':{'key':_0x1317ac['key']||_0x698b('0x5')},'summary':(_0x1317ac[_0x698b('0x6')]||_0x698b('0x7'))+_0x698b('0x8')+_0x1317ac['ip'],'description':_0x1317ac[_0x698b('0x9')]||JSON['stringify'](_0x1317ac),'issuetype':{'name':_0x1317ac[_0x698b('0xa')]||_0x698b('0xb')}}};_0x56b4d[_0x698b('0xc')][_0x698b('0xd')]=_0x1317ac[_0x698b('0xe')];_0x56b4d[_0x698b('0xc')][_0x698b('0xf')]=_0x1317ac['oldToken'];_0x56b4d[_0x698b('0xc')][_0x698b('0x10')]=_0x1317ac['newToken'];_0x56b4d[_0x698b('0xc')][_0x698b('0x11')]=_0x1317ac[_0x698b('0x12')];_0x56b4d['fields']['customfield_11504']=_0x1317ac[_0x698b('0x13')];_0x56b4d[_0x698b('0xc')][_0x698b('0x14')]=_0x1317ac['ip'];var _0x449da1={'host':_0x698b('0x15'),'port':0x1bb,'path':_0x698b('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x698b('0x17'),'Authorization':_0x698b('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x698b('0x19')](_0x698b('0x1a'))}};var _0xc834b6=JSON['stringify'](_0x56b4d);var _0x271f88=https['request'](_0x449da1,function(_0x1daa1c){_0x1daa1c[_0x698b('0x1b')](_0x698b('0x1c'));var _0xa8e827='';_0x1daa1c['on'](_0x698b('0x1d'),function(_0x3e0a04){_0xa8e827+=_0x3e0a04;});_0x1daa1c['on'](_0x698b('0x1e'),function(){if(_0x39d677){return _0x39d677['status'](_0x1daa1c['statusCode'])[_0x698b('0x1f')](JSON[_0x698b('0x20')](_0xa8e827));}});});_0x271f88['on']('error',function(_0x46736a){if(_0x39d677){return _0x39d677['status'](0x1f4)[_0x698b('0x1f')]({'errors':[{'message':_0x698b('0x21'),'type':'api.jira'}]});}});_0x271f88[_0x698b('0x22')](_0xc834b6);_0x271f88['end']();}exports[_0x698b('0x23')]=openIssue;exports[_0x698b('0x24')]=function(_0x12f2ed,_0x346b0d){_0x12f2ed[_0x698b('0x25')]['ip']=_0x12f2ed[_0x698b('0x26')]['x-forwarded-for']||_0x12f2ed[_0x698b('0x27')][_0x698b('0x28')]||_0x12f2ed[_0x698b('0x29')][_0x698b('0x28')]||_0x12f2ed[_0x698b('0x27')][_0x698b('0x29')][_0x698b('0x28')];return openIssue(_0x12f2ed[_0x698b('0x25')],_0x346b0d);}; \ No newline at end of file +var _0x92f7=['api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','/rest/api/2/issue','Basic\x20','toString','request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','https'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x92f7,0xa7));var _0x792f=function(_0xd281e2,_0x5b9fc4){_0xd281e2=_0xd281e2-0x0;var _0xfbc4e1=_0x92f7[_0xd281e2];return _0xfbc4e1;};'use strict';var BPromise=require('bluebird');var https=require(_0x792f('0x0'));var logger=require('../../config/logger')(_0x792f('0x1'));var USERNAME='support';var PASSWORD=_0x792f('0x2');function openIssue(_0x553b22,_0x3b5981){var _0x35e47f={'fields':{'project':{'key':_0x553b22[_0x792f('0x3')]||_0x792f('0x4')},'summary':(_0x553b22[_0x792f('0x5')]||_0x792f('0x6'))+_0x792f('0x7')+_0x553b22['ip'],'description':_0x553b22['description']||JSON[_0x792f('0x8')](_0x553b22),'issuetype':{'name':_0x553b22[_0x792f('0x9')]||_0x792f('0xa')}}};_0x35e47f[_0x792f('0xb')][_0x792f('0xc')]=_0x553b22[_0x792f('0xd')];_0x35e47f[_0x792f('0xb')]['customfield_11501']=_0x553b22[_0x792f('0xe')];_0x35e47f[_0x792f('0xb')][_0x792f('0xf')]=_0x553b22[_0x792f('0x10')];_0x35e47f[_0x792f('0xb')][_0x792f('0x11')]=_0x553b22[_0x792f('0x12')];_0x35e47f[_0x792f('0xb')]['customfield_11504']=_0x553b22[_0x792f('0x13')];_0x35e47f[_0x792f('0xb')][_0x792f('0x14')]=_0x553b22['ip'];var _0x4d8811={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x792f('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x792f('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x792f('0x17')]('base64')}};var _0x218914=JSON['stringify'](_0x35e47f);var _0x547b6f=https[_0x792f('0x18')](_0x4d8811,function(_0x181f79){_0x181f79[_0x792f('0x19')](_0x792f('0x1a'));var _0x57d23d='';_0x181f79['on'](_0x792f('0x1b'),function(_0x4447c6){_0x57d23d+=_0x4447c6;});_0x181f79['on'](_0x792f('0x1c'),function(){if(_0x3b5981){return _0x3b5981[_0x792f('0x1d')](_0x181f79['statusCode'])[_0x792f('0x1e')](JSON[_0x792f('0x1f')](_0x57d23d));}});});_0x547b6f['on'](_0x792f('0x20'),function(_0x36a7fe){if(_0x3b5981){return _0x3b5981[_0x792f('0x1d')](0x1f4)[_0x792f('0x1e')]({'errors':[{'message':_0x792f('0x21'),'type':'api.jira'}]});}});_0x547b6f['write'](_0x218914);_0x547b6f[_0x792f('0x1c')]();}exports[_0x792f('0x22')]=openIssue;exports[_0x792f('0x23')]=function(_0x3f0ee1,_0x33a580){_0x3f0ee1[_0x792f('0x24')]['ip']=_0x3f0ee1[_0x792f('0x25')][_0x792f('0x26')]||_0x3f0ee1['connection'][_0x792f('0x27')]||_0x3f0ee1[_0x792f('0x28')]['remoteAddress']||_0x3f0ee1[_0x792f('0x29')][_0x792f('0x28')][_0x792f('0x27')];return openIssue(_0x3f0ee1['body'],_0x33a580);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a707c29..5215416 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 _0xe42c=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','create','/:id','update','delete','multer','path','connect-timeout','express'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xe42c,0x172));var _0xce42=function(_0x32e4c9,_0x54a38c){_0x32e4c9=_0x32e4c9-0x0;var _0x2591b5=_0xe42c[_0x32e4c9];return _0x2591b5;};'use strict';var multer=require(_0xce42('0x0'));var util=require('util');var path=require(_0xce42('0x1'));var timeout=require(_0xce42('0x2'));var express=require(_0xce42('0x3'));var router=express[_0xce42('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xce42('0x5'));var config=require(_0xce42('0x6'));var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0xce42('0x7')](),controller[_0xce42('0x8')]);router[_0xce42('0x9')](_0xce42('0xa'),auth[_0xce42('0x7')](),controller[_0xce42('0xb')]);router[_0xce42('0x9')]('/:id',auth[_0xce42('0x7')](),controller[_0xce42('0xc')]);router['post']('/',auth[_0xce42('0x7')](),controller[_0xce42('0xd')]);router['put'](_0xce42('0xe'),auth[_0xce42('0x7')](),controller[_0xce42('0xf')]);router[_0xce42('0x10')](_0xce42('0xe'),auth[_0xce42('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe2d3=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0x55a2c4,_0x1c540a){var _0x2526bf=function(_0x4d8a40){while(--_0x4d8a40){_0x55a2c4['push'](_0x55a2c4['shift']());}};_0x2526bf(++_0x1c540a);}(_0xe2d3,0x13a));var _0x3e2d=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0xe2d3[_0x35e92e];return _0x1205a8;};'use strict';var multer=require(_0x3e2d('0x0'));var util=require(_0x3e2d('0x1'));var path=require(_0x3e2d('0x2'));var timeout=require(_0x3e2d('0x3'));var express=require(_0x3e2d('0x4'));var router=express[_0x3e2d('0x5')]();var auth=require(_0x3e2d('0x6'));var interaction=require(_0x3e2d('0x7'));var config=require(_0x3e2d('0x8'));var controller=require(_0x3e2d('0x9'));router[_0x3e2d('0xa')]('/',auth[_0x3e2d('0xb')](),controller[_0x3e2d('0xc')]);router[_0x3e2d('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x3e2d('0xd')]);router[_0x3e2d('0xa')](_0x3e2d('0xe'),auth['isAuthenticated'](),controller[_0x3e2d('0xf')]);router['post']('/',auth[_0x3e2d('0xb')](),controller[_0x3e2d('0x10')]);router['put'](_0x3e2d('0xe'),auth['isAuthenticated'](),controller[_0x3e2d('0x11')]);router[_0x3e2d('0x12')](_0x3e2d('0xe'),auth[_0x3e2d('0xb')](),controller[_0x3e2d('0x13')]);module[_0x3e2d('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index e8c3b36..7ffe260 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 _0xa473=['STRING','long','sequelize','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa473,0x18a));var _0x3a47=function(_0x51d3e4,_0x4f422f){_0x51d3e4=_0x51d3e4-0x0;var _0x1e0a0e=_0xa473[_0x51d3e4];return _0x1e0a0e;};'use strict';var Sequelize=require(_0x3a47('0x0'));module[_0x3a47('0x1')]={'question':{'type':Sequelize[_0x3a47('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x3a47('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x3a47('0x2')]},'queue':{'type':Sequelize[_0x3a47('0x2')]},'uniqueid':{'type':Sequelize[_0x3a47('0x2')]},'calleridname':{'type':Sequelize[_0x3a47('0x2')]},'calleridnum':{'type':Sequelize[_0x3a47('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd0c2=['long','exports','STRING'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0xd0c2,0x76));var _0x2d0c=function(_0x199f47,_0x4adae0){_0x199f47=_0x199f47-0x0;var _0x31a9cb=_0xd0c2[_0x199f47];return _0x31a9cb;};'use strict';var Sequelize=require('sequelize');module[_0x2d0c('0x0')]={'question':{'type':Sequelize[_0x2d0c('0x1')]},'answer':{'type':Sequelize['TEXT'](_0x2d0c('0x2'))},'membername':{'type':Sequelize[_0x2d0c('0x1')]},'projectname':{'type':Sequelize[_0x2d0c('0x1')]},'queue':{'type':Sequelize[_0x2d0c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2d0c('0x1')]},'calleridnum':{'type':Sequelize[_0x2d0c('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 83bdf09..24932aa 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 _0x2084=['findAll','rows','catch','show','params','model','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','VIRTUAL','options','include'];(function(_0x2b9ab7,_0x1d3a6d){var _0x4da4a4=function(_0x4651c3){while(--_0x4651c3){_0x2b9ab7['push'](_0x2b9ab7['shift']());}};_0x4da4a4(++_0x1d3a6d);}(_0x2084,0xec));var _0x4208=function(_0x13f72d,_0x40874d){_0x13f72d=_0x13f72d-0x0;var _0x3ebfdf=_0x2084[_0x13f72d];return _0x3ebfdf;};'use strict';var pdf=require(_0x4208('0x0'));var emlformat=require(_0x4208('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4208('0x2'));var jsonpatch=require(_0x4208('0x3'));var rp=require('request-promise');var moment=require(_0x4208('0x4'));var BPromise=require(_0x4208('0x5'));var Mustache=require(_0x4208('0x6'));var util=require(_0x4208('0x7'));var path=require('path');var sox=require(_0x4208('0x8'));var csv=require(_0x4208('0x9'));var ejs=require(_0x4208('0xa'));var fs=require('fs');var _=require(_0x4208('0xb'));var squel=require(_0x4208('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4208('0xd'));var toCsv=require(_0x4208('0x9'));var querystring=require('querystring');var Papa=require(_0x4208('0xe'));var Redis=require(_0x4208('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4208('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4208('0x11'));var logger=require(_0x4208('0x12'))(_0x4208('0x13'));var utils=require(_0x4208('0x14'));var config=require(_0x4208('0x15'));var db=require(_0x4208('0x16'))['db'];function respondWithStatusCode(_0xcfd2fb,_0x103981){_0x103981=_0x103981||0xcc;return function(_0x54b5fb){if(_0x54b5fb){return _0xcfd2fb[_0x4208('0x17')](_0x103981);}return _0xcfd2fb[_0x4208('0x18')](_0x103981)['end']();};}function respondWithResult(_0xfbe6d9,_0x4fb507){_0x4fb507=_0x4fb507||0xc8;return function(_0x4f818e){if(_0x4f818e){return _0xfbe6d9['status'](_0x4fb507)[_0x4208('0x19')](_0x4f818e);}};}function respondWithFilteredResult(_0x2c69ff,_0xc7e9a8){return function(_0x35886f){if(_0x35886f){var _0x579b08=_0x35886f[_0x4208('0x1a')],_0x3593ab=_0xc7e9a8[_0x4208('0x1b')],_0x291775=_0xc7e9a8[_0x4208('0x1b')]+_0xc7e9a8['limit'],_0x1059ef;if(_0x291775>=_0x579b08){_0x291775=_0x579b08;_0x1059ef=0xc8;}else{_0x1059ef=0xce;}_0x2c69ff['status'](_0x1059ef);return _0x2c69ff[_0x4208('0x1c')](_0x4208('0x1d'),_0x3593ab+'-'+_0x291775+'/'+_0x579b08)['json'](_0x35886f);}return null;};}function patchUpdates(_0x50ebe4){return function(_0x327892){try{jsonpatch[_0x4208('0x1e')](_0x327892,_0x50ebe4,!![]);}catch(_0x514f10){return BPromise[_0x4208('0x1f')](_0x514f10);}return _0x327892[_0x4208('0x20')]();};}function saveUpdates(_0x47f4ab,_0xb1713c){return function(_0x3b28ec){if(_0x3b28ec){return _0x3b28ec[_0x4208('0x21')](_0x47f4ab)[_0x4208('0x22')](function(_0x4156f1){return _0x4156f1;});}return null;};}function removeEntity(_0x23f8c7,_0x20885f){return function(_0x107854){if(_0x107854){return _0x107854['destroy']()['then'](function(){_0x23f8c7['status'](0xcc)[_0x4208('0x23')]();});}};}function handleEntityNotFound(_0x1aac36,_0x1b12d6){return function(_0x5c9785){if(!_0x5c9785){_0x1aac36[_0x4208('0x17')](0x194);}return _0x5c9785;};}function handleError(_0x5e8dc4,_0x41d3bb){_0x41d3bb=_0x41d3bb||0x1f4;return function(_0x1ce9b1){logger[_0x4208('0x24')](_0x1ce9b1[_0x4208('0x25')]);if(_0x1ce9b1[_0x4208('0x26')]){delete _0x1ce9b1[_0x4208('0x26')];}_0x5e8dc4['status'](_0x41d3bb)[_0x4208('0x27')](_0x1ce9b1);};}exports[_0x4208('0x28')]=function(_0x306814,_0x145680){var _0x893a27={},_0x470755={},_0x593965={'count':0x0,'rows':[]};var _0x20bed2=_[_0x4208('0x29')](db[_0x4208('0x2a')][_0x4208('0x2b')],function(_0x3ab0e2){return{'name':_0x3ab0e2[_0x4208('0x2c')],'type':_0x3ab0e2[_0x4208('0x2d')][_0x4208('0x2e')]};});_0x470755['model']=_[_0x4208('0x29')](_0x20bed2,'name');_0x470755[_0x4208('0x2f')]=_[_0x4208('0x30')](_0x306814[_0x4208('0x2f')]);_0x470755[_0x4208('0x31')]=_[_0x4208('0x32')](_0x470755['model'],_0x470755['query']);_0x893a27['attributes']=_[_0x4208('0x32')](_0x470755['model'],qs['fields'](_0x306814['query'][_0x4208('0x33')]));_0x893a27[_0x4208('0x34')]=_0x893a27[_0x4208('0x34')][_0x4208('0x35')]?_0x893a27[_0x4208('0x34')]:_0x470755['model'];if(!_0x306814[_0x4208('0x2f')][_0x4208('0x36')](_0x4208('0x37'))){_0x893a27['limit']=qs['limit'](_0x306814[_0x4208('0x2f')][_0x4208('0x38')]);_0x893a27[_0x4208('0x1b')]=qs[_0x4208('0x1b')](_0x306814['query'][_0x4208('0x1b')]);}_0x893a27[_0x4208('0x39')]=qs['sort'](_0x306814['query']['sort']);_0x893a27[_0x4208('0x3a')]=qs[_0x4208('0x31')](_['pick'](_0x306814[_0x4208('0x2f')],_0x470755[_0x4208('0x31')]),_0x20bed2);if(_0x306814[_0x4208('0x2f')][_0x4208('0x3b')]){_0x893a27[_0x4208('0x3a')]=_[_0x4208('0x3c')](_0x893a27[_0x4208('0x3a')],{'$or':_[_0x4208('0x29')](_0x20bed2,function(_0x8cfdf6){if(_0x8cfdf6['type']!==_0x4208('0x3d')){var _0x155836={};_0x155836[_0x8cfdf6['name']]={'$like':'%'+_0x306814[_0x4208('0x2f')][_0x4208('0x3b')]+'%'};return _0x155836;}})});}_0x893a27=_[_0x4208('0x3c')]({},_0x893a27,_0x306814[_0x4208('0x3e')]);var _0x4456fb={'where':_0x893a27[_0x4208('0x3a')]};return db[_0x4208('0x2a')][_0x4208('0x1a')](_0x4456fb)[_0x4208('0x22')](function(_0x48f72b){_0x593965['count']=_0x48f72b;if(_0x306814[_0x4208('0x2f')]['includeAll']){_0x893a27[_0x4208('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4208('0x40')](_0x893a27);})['then'](function(_0x442b95){_0x593965[_0x4208('0x41')]=_0x442b95;return _0x593965;})[_0x4208('0x22')](respondWithFilteredResult(_0x145680,_0x893a27))[_0x4208('0x42')](handleError(_0x145680,null));};exports[_0x4208('0x43')]=function(_0x2ef7b2,_0x514ea8){var _0x3a44c5={'raw':!![],'where':{'id':_0x2ef7b2[_0x4208('0x44')]['id']}},_0x1ae06e={};_0x1ae06e[_0x4208('0x45')]=_[_0x4208('0x30')](db[_0x4208('0x2a')]['rawAttributes']);_0x1ae06e['query']=_[_0x4208('0x30')](_0x2ef7b2['query']);_0x1ae06e[_0x4208('0x31')]=_['intersection'](_0x1ae06e['model'],_0x1ae06e[_0x4208('0x2f')]);_0x3a44c5[_0x4208('0x34')]=_[_0x4208('0x32')](_0x1ae06e['model'],qs['fields'](_0x2ef7b2[_0x4208('0x2f')]['fields']));_0x3a44c5['attributes']=_0x3a44c5[_0x4208('0x34')]['length']?_0x3a44c5[_0x4208('0x34')]:_0x1ae06e['model'];if(_0x2ef7b2[_0x4208('0x2f')]['includeAll']){_0x3a44c5[_0x4208('0x3f')]=[{'all':!![]}];}_0x3a44c5=_[_0x4208('0x3c')]({},_0x3a44c5,_0x2ef7b2[_0x4208('0x3e')]);return db[_0x4208('0x2a')][_0x4208('0x46')](_0x3a44c5)[_0x4208('0x22')](handleEntityNotFound(_0x514ea8,null))[_0x4208('0x22')](respondWithResult(_0x514ea8,null))[_0x4208('0x42')](handleError(_0x514ea8,null));};exports[_0x4208('0x47')]=function(_0x2ce84a,_0x2d344a){return db[_0x4208('0x2a')][_0x4208('0x47')](_0x2ce84a[_0x4208('0x48')],{})[_0x4208('0x22')](respondWithResult(_0x2d344a,0xc9))[_0x4208('0x42')](handleError(_0x2d344a,null));};exports[_0x4208('0x21')]=function(_0x5db37a,_0x34c78f){if(_0x5db37a['body']['id']){delete _0x5db37a[_0x4208('0x48')]['id'];}return db[_0x4208('0x2a')][_0x4208('0x46')]({'where':{'id':_0x5db37a[_0x4208('0x44')]['id']}})[_0x4208('0x22')](handleEntityNotFound(_0x34c78f,null))[_0x4208('0x22')](saveUpdates(_0x5db37a['body'],null))[_0x4208('0x22')](respondWithResult(_0x34c78f,null))[_0x4208('0x42')](handleError(_0x34c78f,null));};exports[_0x4208('0x49')]=function(_0x4da665,_0x5f455b){return db[_0x4208('0x2a')][_0x4208('0x46')]({'where':{'id':_0x4da665['params']['id']}})[_0x4208('0x22')](handleEntityNotFound(_0x5f455b,null))[_0x4208('0x22')](removeEntity(_0x5f455b,null))[_0x4208('0x42')](handleError(_0x5f455b,null));};exports[_0x4208('0x4a')]=function(_0x15eb63,_0x4dc2fd){return db[_0x4208('0x2a')][_0x4208('0x4a')]()['then'](respondWithResult(_0x4dc2fd,null))['catch'](handleError(_0x4dc2fd,null));}; \ No newline at end of file +var _0x97e2=['ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','count','offset','limit','status','set','json','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','JscriptyAnswerReport','includeAll','catch','show','length','create','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','util','path','sox'];(function(_0xd3f37c,_0x3e890d){var _0x3463f2=function(_0x5d0380){while(--_0x5d0380){_0xd3f37c['push'](_0xd3f37c['shift']());}};_0x3463f2(++_0x3e890d);}(_0x97e2,0x15b));var _0x297e=function(_0x13fc19,_0x26a311){_0x13fc19=_0x13fc19-0x0;var _0x25afcf=_0x97e2[_0x13fc19];return _0x25afcf;};'use strict';var pdf=require(_0x297e('0x0'));var emlformat=require(_0x297e('0x1'));var rimraf=require(_0x297e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x297e('0x3'));var rp=require('request-promise');var moment=require(_0x297e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x297e('0x5'));var path=require(_0x297e('0x6'));var sox=require(_0x297e('0x7'));var csv=require('to-csv');var ejs=require(_0x297e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x297e('0x9'));var crypto=require(_0x297e('0xa'));var jsforce=require(_0x297e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x297e('0xc'));var querystring=require('querystring');var Papa=require(_0x297e('0xd'));var Redis=require(_0x297e('0xe'));var authService=require(_0x297e('0xf'));var qs=require(_0x297e('0x10'));var as=require(_0x297e('0x11'));var hardwareService=require(_0x297e('0x12'));var logger=require('../../config/logger')(_0x297e('0x13'));var utils=require(_0x297e('0x14'));var config=require(_0x297e('0x15'));var db=require(_0x297e('0x16'))['db'];function respondWithStatusCode(_0x40973b,_0x1ec216){_0x1ec216=_0x1ec216||0xcc;return function(_0x433f76){if(_0x433f76){return _0x40973b[_0x297e('0x17')](_0x1ec216);}return _0x40973b['status'](_0x1ec216)['end']();};}function respondWithResult(_0x11bd41,_0x3f2e8b){_0x3f2e8b=_0x3f2e8b||0xc8;return function(_0x3baa24){if(_0x3baa24){return _0x11bd41['status'](_0x3f2e8b)['json'](_0x3baa24);}};}function respondWithFilteredResult(_0x18394f,_0x1ec667){return function(_0x5bb3f2){if(_0x5bb3f2){var _0x15920a=_0x5bb3f2[_0x297e('0x18')],_0x4be273=_0x1ec667[_0x297e('0x19')],_0xc173eb=_0x1ec667[_0x297e('0x19')]+_0x1ec667[_0x297e('0x1a')],_0x386618;if(_0xc173eb>=_0x15920a){_0xc173eb=_0x15920a;_0x386618=0xc8;}else{_0x386618=0xce;}_0x18394f[_0x297e('0x1b')](_0x386618);return _0x18394f[_0x297e('0x1c')]('Content-Range',_0x4be273+'-'+_0xc173eb+'/'+_0x15920a)[_0x297e('0x1d')](_0x5bb3f2);}return null;};}function patchUpdates(_0x27ca00){return function(_0xe9d29c){try{jsonpatch[_0x297e('0x1e')](_0xe9d29c,_0x27ca00,!![]);}catch(_0x5b6ca1){return BPromise[_0x297e('0x1f')](_0x5b6ca1);}return _0xe9d29c[_0x297e('0x20')]();};}function saveUpdates(_0x2d37bf,_0x271873){return function(_0x364256){if(_0x364256){return _0x364256[_0x297e('0x21')](_0x2d37bf)[_0x297e('0x22')](function(_0x290df6){return _0x290df6;});}return null;};}function removeEntity(_0x42324d,_0x1c537c){return function(_0x464033){if(_0x464033){return _0x464033[_0x297e('0x23')]()['then'](function(){_0x42324d[_0x297e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc8f728,_0x447393){return function(_0x106ca8){if(!_0x106ca8){_0xc8f728['sendStatus'](0x194);}return _0x106ca8;};}function handleError(_0x123a04,_0x5e53c4){_0x5e53c4=_0x5e53c4||0x1f4;return function(_0x59ea4e){logger['error'](_0x59ea4e[_0x297e('0x24')]);if(_0x59ea4e[_0x297e('0x25')]){delete _0x59ea4e['name'];}_0x123a04[_0x297e('0x1b')](_0x5e53c4)['send'](_0x59ea4e);};}exports[_0x297e('0x26')]=function(_0x18bac1,_0x2dbd6f){var _0x559322={},_0x3727bd={},_0x587551={'count':0x0,'rows':[]};var _0x1620d8=_[_0x297e('0x27')](db['JscriptyAnswerReport'][_0x297e('0x28')],function(_0xdf909a){return{'name':_0xdf909a[_0x297e('0x29')],'type':_0xdf909a[_0x297e('0x2a')][_0x297e('0x2b')]};});_0x3727bd['model']=_[_0x297e('0x27')](_0x1620d8,_0x297e('0x25'));_0x3727bd[_0x297e('0x2c')]=_[_0x297e('0x2d')](_0x18bac1['query']);_0x3727bd[_0x297e('0x2e')]=_[_0x297e('0x2f')](_0x3727bd[_0x297e('0x30')],_0x3727bd[_0x297e('0x2c')]);_0x559322[_0x297e('0x31')]=_[_0x297e('0x2f')](_0x3727bd['model'],qs['fields'](_0x18bac1['query'][_0x297e('0x32')]));_0x559322[_0x297e('0x31')]=_0x559322[_0x297e('0x31')]['length']?_0x559322[_0x297e('0x31')]:_0x3727bd['model'];if(!_0x18bac1['query'][_0x297e('0x33')](_0x297e('0x34'))){_0x559322[_0x297e('0x1a')]=qs['limit'](_0x18bac1[_0x297e('0x2c')][_0x297e('0x1a')]);_0x559322[_0x297e('0x19')]=qs['offset'](_0x18bac1[_0x297e('0x2c')][_0x297e('0x19')]);}_0x559322[_0x297e('0x35')]=qs['sort'](_0x18bac1[_0x297e('0x2c')][_0x297e('0x36')]);_0x559322['where']=qs[_0x297e('0x2e')](_[_0x297e('0x37')](_0x18bac1[_0x297e('0x2c')],_0x3727bd['filters']),_0x1620d8);if(_0x18bac1['query'][_0x297e('0x38')]){_0x559322['where']=_[_0x297e('0x39')](_0x559322[_0x297e('0x3a')],{'$or':_[_0x297e('0x27')](_0x1620d8,function(_0x285f49){if(_0x285f49[_0x297e('0x2a')]!==_0x297e('0x3b')){var _0x3baf61={};_0x3baf61[_0x285f49[_0x297e('0x25')]]={'$like':'%'+_0x18bac1['query']['filter']+'%'};return _0x3baf61;}})});}_0x559322=_[_0x297e('0x39')]({},_0x559322,_0x18bac1[_0x297e('0x3c')]);var _0x46cab7={'where':_0x559322[_0x297e('0x3a')]};return db[_0x297e('0x3d')][_0x297e('0x18')](_0x46cab7)[_0x297e('0x22')](function(_0x36c886){_0x587551[_0x297e('0x18')]=_0x36c886;if(_0x18bac1[_0x297e('0x2c')][_0x297e('0x3e')]){_0x559322['include']=[{'all':!![]}];}return db[_0x297e('0x3d')]['findAll'](_0x559322);})[_0x297e('0x22')](function(_0x3fa5e2){_0x587551['rows']=_0x3fa5e2;return _0x587551;})[_0x297e('0x22')](respondWithFilteredResult(_0x2dbd6f,_0x559322))[_0x297e('0x3f')](handleError(_0x2dbd6f,null));};exports[_0x297e('0x40')]=function(_0x1c5405,_0x19731d){var _0x2f52f9={'raw':!![],'where':{'id':_0x1c5405['params']['id']}},_0x5174d0={};_0x5174d0[_0x297e('0x30')]=_[_0x297e('0x2d')](db[_0x297e('0x3d')][_0x297e('0x28')]);_0x5174d0[_0x297e('0x2c')]=_['keys'](_0x1c5405['query']);_0x5174d0[_0x297e('0x2e')]=_[_0x297e('0x2f')](_0x5174d0[_0x297e('0x30')],_0x5174d0[_0x297e('0x2c')]);_0x2f52f9['attributes']=_[_0x297e('0x2f')](_0x5174d0[_0x297e('0x30')],qs[_0x297e('0x32')](_0x1c5405[_0x297e('0x2c')][_0x297e('0x32')]));_0x2f52f9[_0x297e('0x31')]=_0x2f52f9[_0x297e('0x31')][_0x297e('0x41')]?_0x2f52f9['attributes']:_0x5174d0[_0x297e('0x30')];if(_0x1c5405[_0x297e('0x2c')]['includeAll']){_0x2f52f9['include']=[{'all':!![]}];}_0x2f52f9=_[_0x297e('0x39')]({},_0x2f52f9,_0x1c5405['options']);return db[_0x297e('0x3d')]['find'](_0x2f52f9)[_0x297e('0x22')](handleEntityNotFound(_0x19731d,null))['then'](respondWithResult(_0x19731d,null))[_0x297e('0x3f')](handleError(_0x19731d,null));};exports[_0x297e('0x42')]=function(_0x218318,_0x319dd1){return db[_0x297e('0x3d')][_0x297e('0x42')](_0x218318[_0x297e('0x43')],{})[_0x297e('0x22')](respondWithResult(_0x319dd1,0xc9))['catch'](handleError(_0x319dd1,null));};exports[_0x297e('0x21')]=function(_0x4bd76e,_0x30ba93){if(_0x4bd76e[_0x297e('0x43')]['id']){delete _0x4bd76e[_0x297e('0x43')]['id'];}return db[_0x297e('0x3d')][_0x297e('0x44')]({'where':{'id':_0x4bd76e['params']['id']}})[_0x297e('0x22')](handleEntityNotFound(_0x30ba93,null))[_0x297e('0x22')](saveUpdates(_0x4bd76e[_0x297e('0x43')],null))[_0x297e('0x22')](respondWithResult(_0x30ba93,null))[_0x297e('0x3f')](handleError(_0x30ba93,null));};exports[_0x297e('0x23')]=function(_0xf5930,_0x2965c9){return db[_0x297e('0x3d')][_0x297e('0x44')]({'where':{'id':_0xf5930[_0x297e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2965c9,null))[_0x297e('0x22')](removeEntity(_0x2965c9,null))[_0x297e('0x3f')](handleError(_0x2965c9,null));};exports[_0x297e('0x46')]=function(_0x24f7fc,_0x25b2c9){return db[_0x297e('0x3d')][_0x297e('0x46')]()[_0x297e('0x22')](respondWithResult(_0x25b2c9,null))[_0x297e('0x3f')](handleError(_0x25b2c9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7355923..6630c26 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 _0x0938=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0xb84491,_0x406f70){var _0x248f40=function(_0x535ad9){while(--_0x535ad9){_0xb84491['push'](_0xb84491['shift']());}};_0x248f40(++_0x406f70);}(_0x0938,0x144));var _0x8093=function(_0x277415,_0x38968b){_0x277415=_0x277415-0x0;var _0x376342=_0x0938[_0x277415];return _0x376342;};'use strict';var _=require('lodash');var util=require(_0x8093('0x0'));var logger=require('../../config/logger')(_0x8093('0x1'));var moment=require(_0x8093('0x2'));var BPromise=require(_0x8093('0x3'));var rp=require(_0x8093('0x4'));var fs=require('fs');var path=require(_0x8093('0x5'));var rimraf=require(_0x8093('0x6'));var config=require(_0x8093('0x7'));var attributes=require(_0x8093('0x8'));module['exports']=function(_0x366ca8,_0x41e4dd){return _0x366ca8[_0x8093('0x9')](_0x8093('0xa'),attributes,{'tableName':_0x8093('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20d4=['define','report_jscripty_answers','util','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x4b1473,_0x570c61){var _0x4eb602=function(_0x4ee4ab){while(--_0x4ee4ab){_0x4b1473['push'](_0x4b1473['shift']());}};_0x4eb602(++_0x570c61);}(_0x20d4,0xac));var _0x420d=function(_0x1fa102,_0x34e385){_0x1fa102=_0x1fa102-0x0;var _0x5d683e=_0x20d4[_0x1fa102];return _0x5d683e;};'use strict';var _=require('lodash');var util=require(_0x420d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x420d('0x1'));var rp=require(_0x420d('0x2'));var fs=require('fs');var path=require(_0x420d('0x3'));var rimraf=require(_0x420d('0x4'));var config=require(_0x420d('0x5'));var attributes=require(_0x420d('0x6'));module[_0x420d('0x7')]=function(_0x2ff88d,_0x44e1f8){return _0x2ff88d[_0x420d('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0x420d('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 c662f3b..6a83986 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 _0xa093=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1cb115,_0x55cac1){var _0x27dd09=function(_0x46d60f){while(--_0x46d60f){_0x1cb115['push'](_0x1cb115['shift']());}};_0x27dd09(++_0x55cac1);}(_0xa093,0x18e));var _0x3a09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa093[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a09('0x0'));var util=require(_0x3a09('0x1'));var moment=require(_0x3a09('0x2'));var BPromise=require(_0x3a09('0x3'));var rs=require(_0x3a09('0x4'));var fs=require('fs');var Redis=require(_0x3a09('0x5'));var db=require(_0x3a09('0x6'))['db'];var utils=require(_0x3a09('0x7'));var logger=require(_0x3a09('0x8'))(_0x3a09('0x9'));var config=require(_0x3a09('0xa'));var jayson=require(_0x3a09('0xb'));var client=jayson[_0x3a09('0xc')][_0x3a09('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x21a1e2,_0x12f0ad,_0x146a17){return new BPromise(function(_0x5265fc,_0x2a0a8a){return client['request'](_0x21a1e2,_0x146a17)[_0x3a09('0xe')](function(_0xf39682){logger[_0x3a09('0xf')](_0x3a09('0x10'),_0x12f0ad,_0x3a09('0x11'));logger[_0x3a09('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x12f0ad,_0x3a09('0x11'),JSON[_0x3a09('0x13')](_0xf39682));if(_0xf39682[_0x3a09('0x14')]){if(_0xf39682[_0x3a09('0x14')][_0x3a09('0x15')]===0x1f4){logger[_0x3a09('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x12f0ad,_0xf39682[_0x3a09('0x14')][_0x3a09('0x16')]);return _0x2a0a8a(_0xf39682[_0x3a09('0x14')][_0x3a09('0x16')]);}logger[_0x3a09('0x14')](_0x3a09('0x10'),_0x12f0ad,_0xf39682[_0x3a09('0x14')][_0x3a09('0x16')]);return _0x5265fc(_0xf39682['error'][_0x3a09('0x16')]);}else{logger[_0x3a09('0xf')](_0x3a09('0x10'),_0x12f0ad,_0x3a09('0x11'));_0x5265fc(_0xf39682[_0x3a09('0x17')][_0x3a09('0x16')]);}})[_0x3a09('0x18')](function(_0x5e58c8){logger[_0x3a09('0x14')](_0x3a09('0x10'),_0x12f0ad,_0x5e58c8);_0x2a0a8a(_0x5e58c8);});});} \ No newline at end of file +var _0x3aa7=['client','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3aa7,0x173));var _0x73aa=function(_0x1d4074,_0x14dd79){_0x1d4074=_0x1d4074-0x0;var _0x258fc1=_0x3aa7[_0x1d4074];return _0x258fc1;};'use strict';var _=require('lodash');var util=require(_0x73aa('0x0'));var moment=require(_0x73aa('0x1'));var BPromise=require(_0x73aa('0x2'));var rs=require(_0x73aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x73aa('0x4'));var logger=require(_0x73aa('0x5'))(_0x73aa('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x73aa('0x7')][_0x73aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x165736,_0x4e443b,_0x2492e8){return new BPromise(function(_0x503764,_0x59bd2d){return client[_0x73aa('0x9')](_0x165736,_0x2492e8)['then'](function(_0xa8c218){logger['info'](_0x73aa('0xa'),_0x4e443b,_0x73aa('0xb'));logger[_0x73aa('0xc')](_0x73aa('0xd'),_0x4e443b,_0x73aa('0xb'),JSON[_0x73aa('0xe')](_0xa8c218));if(_0xa8c218[_0x73aa('0xf')]){if(_0xa8c218[_0x73aa('0xf')][_0x73aa('0x10')]===0x1f4){logger['error'](_0x73aa('0xa'),_0x4e443b,_0xa8c218['error'][_0x73aa('0x11')]);return _0x59bd2d(_0xa8c218[_0x73aa('0xf')]['message']);}logger['error'](_0x73aa('0xa'),_0x4e443b,_0xa8c218[_0x73aa('0xf')][_0x73aa('0x11')]);return _0x503764(_0xa8c218[_0x73aa('0xf')][_0x73aa('0x11')]);}else{logger[_0x73aa('0x12')](_0x73aa('0xa'),_0x4e443b,_0x73aa('0xb'));_0x503764(_0xa8c218[_0x73aa('0x13')][_0x73aa('0x11')]);}})[_0x73aa('0x14')](function(_0x27b0f1){logger[_0x73aa('0xf')](_0x73aa('0xa'),_0x4e443b,_0x27b0f1);_0x59bd2d(_0x27b0f1);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index bca6f48..fba6e7b 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 _0x3bf9=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','post','/:id/clone','clone','update','delete','destroy'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3bf9,0x8b));var _0x93bf=function(_0x23c217,_0x3aee12){_0x23c217=_0x23c217-0x0;var _0x53fcf8=_0x3bf9[_0x23c217];return _0x53fcf8;};'use strict';var multer=require('multer');var util=require(_0x93bf('0x0'));var path=require(_0x93bf('0x1'));var timeout=require(_0x93bf('0x2'));var express=require('express');var router=express[_0x93bf('0x3')]();var auth=require(_0x93bf('0x4'));var interaction=require(_0x93bf('0x5'));var config=require(_0x93bf('0x6'));var controller=require(_0x93bf('0x7'));router[_0x93bf('0x8')]('/',auth[_0x93bf('0x9')](),controller['index']);router['get'](_0x93bf('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x93bf('0x8')](_0x93bf('0xb'),auth[_0x93bf('0x9')](),controller[_0x93bf('0xc')]);router[_0x93bf('0x8')](_0x93bf('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x93bf('0xe'),auth['isAuthenticated'](),timeout(_0x93bf('0xf')),controller['getSummary']);router[_0x93bf('0x10')]('/',auth[_0x93bf('0x9')](),controller['create']);router['post'](_0x93bf('0x11'),auth[_0x93bf('0x9')](),controller[_0x93bf('0x12')]);router['put'](_0x93bf('0xa'),auth['isAuthenticated'](),controller[_0x93bf('0x13')]);router[_0x93bf('0x14')](_0x93bf('0xa'),auth['isAuthenticated'](),controller[_0x93bf('0x15')]);module[_0x93bf('0x16')]=router; \ No newline at end of file +var _0xc7b8=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','30s','getSummary','post','create','/:id/clone','clone','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xf65805,_0x4a113b){var _0x564b8f=function(_0x3dd3c3){while(--_0x3dd3c3){_0xf65805['push'](_0xf65805['shift']());}};_0x564b8f(++_0x4a113b);}(_0xc7b8,0x119));var _0x8c7b=function(_0x2bbcd7,_0x15203a){_0x2bbcd7=_0x2bbcd7-0x0;var _0x42f5ff=_0xc7b8[_0x2bbcd7];return _0x42f5ff;};'use strict';var multer=require(_0x8c7b('0x0'));var util=require(_0x8c7b('0x1'));var path=require('path');var timeout=require(_0x8c7b('0x2'));var express=require(_0x8c7b('0x3'));var router=express[_0x8c7b('0x4')]();var auth=require(_0x8c7b('0x5'));var interaction=require(_0x8c7b('0x6'));var config=require(_0x8c7b('0x7'));var controller=require('./jscriptyProject.controller');router[_0x8c7b('0x8')]('/',auth[_0x8c7b('0x9')](),controller[_0x8c7b('0xa')]);router[_0x8c7b('0x8')](_0x8c7b('0xb'),auth[_0x8c7b('0x9')](),controller[_0x8c7b('0xc')]);router['get'](_0x8c7b('0xd'),auth[_0x8c7b('0x9')](),controller['getSessions']);router[_0x8c7b('0x8')]('/:id/answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x8c7b('0x8')]('/:id/summary',auth[_0x8c7b('0x9')](),timeout(_0x8c7b('0xe')),controller[_0x8c7b('0xf')]);router[_0x8c7b('0x10')]('/',auth['isAuthenticated'](),controller[_0x8c7b('0x11')]);router[_0x8c7b('0x10')](_0x8c7b('0x12'),auth[_0x8c7b('0x9')](),controller[_0x8c7b('0x13')]);router['put'](_0x8c7b('0xb'),auth[_0x8c7b('0x9')](),controller[_0x8c7b('0x14')]);router[_0x8c7b('0x15')](_0x8c7b('0xb'),auth['isAuthenticated'](),controller[_0x8c7b('0x16')]);module[_0x8c7b('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 2ee9d74..5cf1df4 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 _0x4bc0=['isString','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','name','STRING','isObjectLike','setDataValue','formData'];(function(_0x39ae21,_0x1ffcde){var _0x47d8f2=function(_0x2d6729){while(--_0x2d6729){_0x39ae21['push'](_0x39ae21['shift']());}};_0x47d8f2(++_0x1ffcde);}(_0x4bc0,0x115));var _0x04bc=function(_0x460f40,_0x1149a4){_0x460f40=_0x460f40-0x0;var _0x3c0ac8=_0x4bc0[_0x460f40];return _0x3c0ac8;};'use strict';var Sequelize=require(_0x04bc('0x0'));var _=require(_0x04bc('0x1'));var util=require(_0x04bc('0x2'));module[_0x04bc('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x04bc('0x4')},'description':{'type':Sequelize[_0x04bc('0x5')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x2d54cc){if(_[_0x04bc('0x6')](_0x2d54cc)){this[_0x04bc('0x7')](_0x04bc('0x8'),JSON['stringify'](_0x2d54cc));}else if(_[_0x04bc('0x9')](_0x2d54cc)){this[_0x04bc('0x7')](_0x04bc('0x8'),_0x2d54cc);}else{this[_0x04bc('0x7')]('formData',util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x04bc('0xa')](_0x04bc('0x4'))||'',this[_0x04bc('0xa')](_0x04bc('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x04bc('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x04bc('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0xa2b0=['sequelize','util','exports','STRING','name','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xa2b0,0xff));var _0x0a2b=function(_0x247d19,_0x1dcde0){_0x247d19=_0x247d19-0x0;var _0x1ed62e=_0xa2b0[_0x247d19];return _0x1ed62e;};'use strict';var Sequelize=require(_0x0a2b('0x0'));var _=require('lodash');var util=require(_0x0a2b('0x1'));module[_0x0a2b('0x2')]={'name':{'type':Sequelize[_0x0a2b('0x3')],'unique':_0x0a2b('0x4')},'description':{'type':Sequelize[_0x0a2b('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x0a2b('0x5')),'set':function(_0x33faba){if(_[_0x0a2b('0x6')](_0x33faba)){this[_0x0a2b('0x7')](_0x0a2b('0x8'),JSON[_0x0a2b('0x9')](_0x33faba));}else if(_[_0x0a2b('0xa')](_0x33faba)){this[_0x0a2b('0x7')](_0x0a2b('0x8'),_0x33faba);}else{this['setDataValue'](_0x0a2b('0x8'),util[_0x0a2b('0xb')](_0x0a2b('0xc'),this[_0x0a2b('0xd')](_0x0a2b('0x4'))||'',this[_0x0a2b('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0a2b('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 5956cb2..9387ce5 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 _0x89c8=['questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','Projects','UserProfileResource','end','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','params','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','catch','clone','find','omit','createdAt','updatedAt','error','getSessions','JscriptySessionReport','nolimit','order','ProjectId','include','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport'];(function(_0x5bd398,_0x1973fa){var _0x5c552f=function(_0x2245b3){while(--_0x2245b3){_0x5bd398['push'](_0x5bd398['shift']());}};_0x5c552f(++_0x1973fa);}(_0x89c8,0xfc));var _0x889c=function(_0x1802f5,_0x3c969c){_0x1802f5=_0x1802f5-0x0;var _0xc6ec4c=_0x89c8[_0x1802f5];return _0xc6ec4c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x889c('0x0'));var rimraf=require(_0x889c('0x1'));var zipdir=require(_0x889c('0x2'));var jsonpatch=require(_0x889c('0x3'));var rp=require(_0x889c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x889c('0x5'));var util=require(_0x889c('0x6'));var path=require(_0x889c('0x7'));var sox=require('sox');var csv=require(_0x889c('0x8'));var ejs=require(_0x889c('0x9'));var fs=require('fs');var _=require(_0x889c('0xa'));var squel=require(_0x889c('0xb'));var crypto=require('crypto');var jsforce=require(_0x889c('0xc'));var deskjs=require(_0x889c('0xd'));var toCsv=require(_0x889c('0x8'));var querystring=require('querystring');var Papa=require(_0x889c('0xe'));var Redis=require(_0x889c('0xf'));var authService=require(_0x889c('0x10'));var qs=require(_0x889c('0x11'));var as=require(_0x889c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x889c('0x13'))(_0x889c('0x14'));var utils=require(_0x889c('0x15'));var config=require(_0x889c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4915f8,_0x3edfa2){_0x3edfa2=_0x3edfa2||0xcc;return function(_0x1f53b){if(_0x1f53b){return _0x4915f8[_0x889c('0x17')](_0x3edfa2);}return _0x4915f8[_0x889c('0x18')](_0x3edfa2)['end']();};}function respondWithResult(_0x2fe1e5,_0x14b193){_0x14b193=_0x14b193||0xc8;return function(_0x4ecddb){if(_0x4ecddb){return _0x2fe1e5['status'](_0x14b193)['json'](_0x4ecddb);}};}function respondWithFilteredResult(_0x22085a,_0x1c8f8d){return function(_0x747a90){if(_0x747a90){var _0x248198=_0x747a90[_0x889c('0x19')],_0x16d22a=_0x1c8f8d[_0x889c('0x1a')],_0x2558a7=_0x1c8f8d['offset']+_0x1c8f8d[_0x889c('0x1b')],_0x21e244;if(_0x2558a7>=_0x248198){_0x2558a7=_0x248198;_0x21e244=0xc8;}else{_0x21e244=0xce;}_0x22085a['status'](_0x21e244);return _0x22085a[_0x889c('0x1c')](_0x889c('0x1d'),_0x16d22a+'-'+_0x2558a7+'/'+_0x248198)[_0x889c('0x1e')](_0x747a90);}return null;};}function patchUpdates(_0x5241e3){return function(_0xa987c3){try{jsonpatch[_0x889c('0x1f')](_0xa987c3,_0x5241e3,!![]);}catch(_0x5dbc96){return BPromise[_0x889c('0x20')](_0x5dbc96);}return _0xa987c3['save']();};}function saveUpdates(_0x2c60ba,_0x2d6f98){return function(_0x3dab42){if(_0x3dab42){return _0x3dab42[_0x889c('0x21')](_0x2c60ba)[_0x889c('0x22')](function(_0x309c8a){return _0x309c8a;});}return null;};}function removeEntity(_0x271cd5,_0x286ecb){return function(_0x401e00){if(_0x401e00){return _0x401e00[_0x889c('0x23')]()[_0x889c('0x22')](function(){var _0x39cdc9=_0x401e00['get']({'plain':!![]});var _0x21bf8a=_0x889c('0x24');return db[_0x889c('0x25')][_0x889c('0x23')]({'where':{'type':_0x21bf8a,'resourceId':_0x39cdc9['id']}})['then'](function(){return _0x401e00;});})[_0x889c('0x22')](function(){_0x271cd5[_0x889c('0x18')](0xcc)[_0x889c('0x26')]();});}};}function handleEntityNotFound(_0x5e81e5,_0x158052){return function(_0x2e24a1){if(!_0x2e24a1){_0x5e81e5['sendStatus'](0x194);}return _0x2e24a1;};}function handleError(_0x207471,_0x3c4800){_0x3c4800=_0x3c4800||0x1f4;return function(_0x5ef072){logger['error'](_0x5ef072['stack']);if(_0x5ef072[_0x889c('0x27')]){delete _0x5ef072[_0x889c('0x27')];}_0x207471[_0x889c('0x18')](_0x3c4800)[_0x889c('0x28')](_0x5ef072);};}exports[_0x889c('0x29')]=function(_0xe0370b,_0x4b2431){var _0x5505d1={},_0x2efb41={},_0x3d5938={'count':0x0,'rows':[]};var _0x5a54ed=_[_0x889c('0x2a')](db[_0x889c('0x2b')][_0x889c('0x2c')],function(_0x1b704b){return{'name':_0x1b704b[_0x889c('0x2d')],'type':_0x1b704b['type'][_0x889c('0x2e')]};});_0x2efb41[_0x889c('0x2f')]=_[_0x889c('0x2a')](_0x5a54ed,'name');_0x2efb41[_0x889c('0x30')]=_[_0x889c('0x31')](_0xe0370b['query']);_0x2efb41[_0x889c('0x32')]=_[_0x889c('0x33')](_0x2efb41['model'],_0x2efb41[_0x889c('0x30')]);_0x5505d1[_0x889c('0x34')]=_[_0x889c('0x33')](_0x2efb41[_0x889c('0x2f')],qs[_0x889c('0x35')](_0xe0370b[_0x889c('0x30')][_0x889c('0x35')]));_0x5505d1['attributes']=_0x5505d1[_0x889c('0x34')][_0x889c('0x36')]?_0x5505d1['attributes']:_0x2efb41[_0x889c('0x2f')];if(!_0xe0370b[_0x889c('0x30')][_0x889c('0x37')]('nolimit')){_0x5505d1[_0x889c('0x1b')]=qs[_0x889c('0x1b')](_0xe0370b['query'][_0x889c('0x1b')]);_0x5505d1[_0x889c('0x1a')]=qs[_0x889c('0x1a')](_0xe0370b[_0x889c('0x30')]['offset']);}_0x5505d1['order']=qs[_0x889c('0x38')](_0xe0370b['query'][_0x889c('0x38')]);_0x5505d1[_0x889c('0x39')]=qs[_0x889c('0x32')](_[_0x889c('0x3a')](_0xe0370b[_0x889c('0x30')],_0x2efb41[_0x889c('0x32')]),_0x5a54ed);if(_0xe0370b[_0x889c('0x30')]['filter']){_0x5505d1[_0x889c('0x39')]=_[_0x889c('0x3b')](_0x5505d1[_0x889c('0x39')],{'$or':_[_0x889c('0x2a')](_0x5a54ed,function(_0x158e8f){if(_0x158e8f[_0x889c('0x3c')]!==_0x889c('0x3d')){var _0x29fa30={};_0x29fa30[_0x158e8f[_0x889c('0x27')]]={'$like':'%'+_0xe0370b[_0x889c('0x30')][_0x889c('0x3e')]+'%'};return _0x29fa30;}})});}_0x5505d1=_['merge']({},_0x5505d1,_0xe0370b[_0x889c('0x3f')]);var _0x8fad46={'where':_0x5505d1['where']};return db[_0x889c('0x2b')][_0x889c('0x19')](_0x8fad46)[_0x889c('0x22')](function(_0x51ce26){_0x3d5938[_0x889c('0x19')]=_0x51ce26;if(_0xe0370b[_0x889c('0x30')][_0x889c('0x40')]){_0x5505d1['include']=[{'all':!![]}];}return db[_0x889c('0x2b')]['findAll'](_0x5505d1);})['then'](function(_0x3a5381){_0x3d5938[_0x889c('0x41')]=_0x3a5381;return _0x3d5938;})[_0x889c('0x22')](respondWithFilteredResult(_0x4b2431,_0x5505d1))['catch'](handleError(_0x4b2431,null));};exports['show']=function(_0x1e8614,_0x1e0349){var _0x24680={'raw':![],'where':{'id':_0x1e8614[_0x889c('0x42')]['id']}},_0x1ab6e5={};_0x1ab6e5[_0x889c('0x2f')]=_[_0x889c('0x31')](db[_0x889c('0x2b')][_0x889c('0x2c')]);_0x1ab6e5[_0x889c('0x30')]=_[_0x889c('0x31')](_0x1e8614['query']);_0x1ab6e5[_0x889c('0x32')]=_['intersection'](_0x1ab6e5[_0x889c('0x2f')],_0x1ab6e5[_0x889c('0x30')]);_0x24680[_0x889c('0x34')]=_[_0x889c('0x33')](_0x1ab6e5[_0x889c('0x2f')],qs[_0x889c('0x35')](_0x1e8614[_0x889c('0x30')][_0x889c('0x35')]));_0x24680[_0x889c('0x34')]=_0x24680[_0x889c('0x34')]['length']?_0x24680[_0x889c('0x34')]:_0x1ab6e5[_0x889c('0x2f')];if(_0x1e8614[_0x889c('0x30')][_0x889c('0x40')]){_0x24680['include']=[{'all':!![]}];}_0x24680=_[_0x889c('0x3b')]({},_0x24680,_0x1e8614[_0x889c('0x3f')]);return db[_0x889c('0x2b')]['find'](_0x24680)[_0x889c('0x22')](handleEntityNotFound(_0x1e0349,null))['then'](respondWithResult(_0x1e0349,null))['catch'](handleError(_0x1e0349,null));};exports[_0x889c('0x43')]=function(_0x515820,_0x41a67e){return db[_0x889c('0x2b')][_0x889c('0x43')](_0x515820[_0x889c('0x44')],{})['then'](function(_0x14fb9b){var _0x5aaecf=_0x515820[_0x889c('0x45')][_0x889c('0x46')]({'plain':!![]});if(!_0x5aaecf)throw new Error(_0x889c('0x47'));if(_0x5aaecf[_0x889c('0x48')]===_0x889c('0x45')){var _0x23a73c=_0x14fb9b[_0x889c('0x46')]({'plain':!![]});var _0xa921bd='Projects';return db[_0x889c('0x49')]['find']({'where':{'name':_0xa921bd,'userProfileId':_0x5aaecf[_0x889c('0x4a')]},'raw':!![]})['then'](function(_0x54f0c0){if(_0x54f0c0&&_0x54f0c0[_0x889c('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x23a73c[_0x889c('0x27')],'resourceId':_0x23a73c['id'],'type':_0x54f0c0[_0x889c('0x27')],'sectionId':_0x54f0c0['id']},{})[_0x889c('0x22')](function(){return _0x14fb9b;});}else{return _0x14fb9b;}})['catch'](function(_0x57acad){logger['error'](_0x889c('0x4c'),_0x57acad);throw _0x57acad;});}return _0x14fb9b;})[_0x889c('0x22')](respondWithResult(_0x41a67e,0xc9))[_0x889c('0x4d')](handleError(_0x41a67e,null));};exports[_0x889c('0x4e')]=function(_0x523b87,_0x4fe56f){var _0x57855d={'where':{'id':_0x523b87[_0x889c('0x42')]['id']}},_0x4790a6={};_0x4790a6['model']=_[_0x889c('0x31')](db[_0x889c('0x2b')][_0x889c('0x2c')]);_0x57855d[_0x889c('0x34')]=_[_0x889c('0x33')](_0x4790a6[_0x889c('0x2f')],qs['fields'](_0x523b87[_0x889c('0x30')]['fields']));_0x57855d['attributes']=_0x57855d['attributes']['length']?_0x57855d['attributes']:_0x4790a6['model'];if(_0x523b87[_0x889c('0x30')][_0x889c('0x40')]){_0x57855d['include']=[{'all':!![]}];}_0x57855d=_[_0x889c('0x3b')]({},_0x57855d,_0x523b87['options']);return db[_0x889c('0x2b')][_0x889c('0x4f')](_0x57855d)[_0x889c('0x22')](handleEntityNotFound(_0x4fe56f,null))['then'](function(_0x4292aa){if(_0x4292aa){var _0x27757=_0x4292aa[_0x889c('0x46')]({'plain':!![]});_0x27757=qs[_0x889c('0x50')](_0x27757,['id',_0x889c('0x51'),_0x889c('0x52')]);_0x523b87[_0x889c('0x44')]=_[_0x889c('0x50')](_0x523b87['body'],['id',_0x889c('0x51'),_0x889c('0x52')]);return db['JscriptyProject'][_0x889c('0x43')](_[_0x889c('0x3b')](_0x27757,_0x523b87[_0x889c('0x44')]),{'include':_0x523b87[_0x889c('0x30')][_0x889c('0x40')]?[{'all':!![]}]:undefined})[_0x889c('0x22')](function(_0x4415dd){var _0x40c2bd=_0x523b87[_0x889c('0x45')][_0x889c('0x46')]({'plain':!![]});if(!_0x40c2bd)throw new Error(_0x889c('0x47'));if(_0x40c2bd[_0x889c('0x48')]===_0x889c('0x45')){var _0x136c71=_0x4415dd[_0x889c('0x46')]({'plain':!![]});var _0x2688c2='Projects';return db[_0x889c('0x49')][_0x889c('0x4f')]({'where':{'name':_0x2688c2,'userProfileId':_0x40c2bd[_0x889c('0x4a')]},'raw':!![]})['then'](function(_0x18b65d){if(_0x18b65d&&_0x18b65d[_0x889c('0x4b')]===0x0){return db[_0x889c('0x25')][_0x889c('0x43')]({'name':_0x136c71[_0x889c('0x27')],'resourceId':_0x136c71['id'],'type':_0x18b65d[_0x889c('0x27')],'sectionId':_0x18b65d['id']},{})[_0x889c('0x22')](function(){return _0x4415dd;});}else{return _0x4415dd;}})['catch'](function(_0x5b8c7d){logger[_0x889c('0x53')](_0x889c('0x4c'),_0x5b8c7d);throw _0x5b8c7d;});}return _0x4415dd;});}})[_0x889c('0x22')](respondWithResult(_0x4fe56f,0xc9))[_0x889c('0x4d')](handleError(_0x4fe56f,null));};exports['update']=function(_0x29b0ad,_0xe00508){if(_0x29b0ad[_0x889c('0x44')]['id']){delete _0x29b0ad[_0x889c('0x44')]['id'];}return db['JscriptyProject'][_0x889c('0x4f')]({'where':{'id':_0x29b0ad[_0x889c('0x42')]['id']}})['then'](handleEntityNotFound(_0xe00508,null))['then'](saveUpdates(_0x29b0ad[_0x889c('0x44')],null))[_0x889c('0x22')](respondWithResult(_0xe00508,null))[_0x889c('0x4d')](handleError(_0xe00508,null));};exports['destroy']=function(_0x1f3a80,_0x2bedb3){return db['JscriptyProject'][_0x889c('0x4f')]({'where':{'id':_0x1f3a80['params']['id']}})['then'](handleEntityNotFound(_0x2bedb3,null))[_0x889c('0x22')](removeEntity(_0x2bedb3,null))[_0x889c('0x4d')](handleError(_0x2bedb3,null));};exports[_0x889c('0x54')]=function(_0x379bb5,_0x151a5f,_0x5d5a4a){var _0x221fcf={'raw':!![],'where':{}};var _0x1c90c7={};var _0x5e3d9e={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x379bb5[_0x889c('0x42')]['id']}})['then'](handleEntityNotFound(_0x151a5f,null))[_0x889c('0x22')](function(_0x4228e1){if(_0x4228e1){_0x1c90c7[_0x889c('0x2f')]=_[_0x889c('0x31')](db[_0x889c('0x55')][_0x889c('0x2c')]);_0x1c90c7[_0x889c('0x30')]=_[_0x889c('0x31')](_0x379bb5[_0x889c('0x30')]);_0x1c90c7[_0x889c('0x32')]=_['intersection'](_0x1c90c7[_0x889c('0x2f')],_0x1c90c7[_0x889c('0x30')]);_0x221fcf[_0x889c('0x34')]=_['intersection'](_0x1c90c7[_0x889c('0x2f')],qs[_0x889c('0x35')](_0x379bb5['query'][_0x889c('0x35')]));_0x221fcf[_0x889c('0x34')]=_0x221fcf[_0x889c('0x34')][_0x889c('0x36')]?_0x221fcf[_0x889c('0x34')]:_0x1c90c7[_0x889c('0x2f')];if(!_0x379bb5[_0x889c('0x30')][_0x889c('0x37')](_0x889c('0x56'))){_0x221fcf[_0x889c('0x1b')]=qs[_0x889c('0x1b')](_0x379bb5[_0x889c('0x30')][_0x889c('0x1b')]);_0x221fcf[_0x889c('0x1a')]=qs[_0x889c('0x1a')](_0x379bb5[_0x889c('0x30')][_0x889c('0x1a')]);}_0x221fcf[_0x889c('0x57')]=qs[_0x889c('0x38')](_0x379bb5[_0x889c('0x30')][_0x889c('0x38')]);_0x221fcf[_0x889c('0x39')]=qs[_0x889c('0x32')](_[_0x889c('0x3a')](_0x379bb5[_0x889c('0x30')],_0x1c90c7[_0x889c('0x32')]));_0x221fcf[_0x889c('0x39')][_0x889c('0x58')]=_0x4228e1['id'];if(_0x379bb5[_0x889c('0x30')][_0x889c('0x3e')]){_0x221fcf[_0x889c('0x39')]=_[_0x889c('0x3b')](_0x221fcf[_0x889c('0x39')],{'$or':_[_0x889c('0x2a')](_0x221fcf[_0x889c('0x34')],function(_0x2618b3){var _0x102df4={};_0x102df4[_0x2618b3]={'$like':'%'+_0x379bb5['query']['filter']+'%'};return _0x102df4;})});}_0x221fcf=_['merge']({},_0x221fcf,_0x379bb5[_0x889c('0x3f')]);return db['JscriptySessionReport'][_0x889c('0x19')]({'where':_0x221fcf['where']})[_0x889c('0x22')](function(_0x2f5ce7){_0x5e3d9e[_0x889c('0x19')]=_0x2f5ce7;if(_0x379bb5[_0x889c('0x30')][_0x889c('0x40')]){_0x221fcf[_0x889c('0x59')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x889c('0x5a')](_0x221fcf);})[_0x889c('0x22')](function(_0x563873){_0x5e3d9e[_0x889c('0x41')]=_0x563873;return _0x5e3d9e;});}})[_0x889c('0x22')](respondWithFilteredResult(_0x151a5f,_0x221fcf))['catch'](handleError(_0x151a5f,null));};exports[_0x889c('0x5b')]=function(_0x183bd3,_0x387ab9,_0x3bc411){var _0x2cdd14={'raw':!![],'where':{}};var _0x597e75={};var _0x26e032={'count':0x0,'rows':[]};return db[_0x889c('0x2b')]['findOne']({'where':{'id':_0x183bd3[_0x889c('0x42')]['id']}})['then'](handleEntityNotFound(_0x387ab9,null))[_0x889c('0x22')](function(_0x1257ab){if(_0x1257ab){_0x597e75[_0x889c('0x2f')]=_['keys'](db[_0x889c('0x5c')]['rawAttributes']);_0x597e75[_0x889c('0x30')]=_['keys'](_0x183bd3[_0x889c('0x30')]);_0x597e75['filters']=_[_0x889c('0x33')](_0x597e75[_0x889c('0x2f')],_0x597e75['query']);_0x2cdd14[_0x889c('0x34')]=_[_0x889c('0x33')](_0x597e75['model'],qs[_0x889c('0x35')](_0x183bd3[_0x889c('0x30')][_0x889c('0x35')]));_0x2cdd14[_0x889c('0x34')]=_0x2cdd14[_0x889c('0x34')][_0x889c('0x36')]?_0x2cdd14['attributes']:_0x597e75[_0x889c('0x2f')];if(!_0x183bd3[_0x889c('0x30')]['hasOwnProperty'](_0x889c('0x56'))){_0x2cdd14[_0x889c('0x1b')]=qs['limit'](_0x183bd3[_0x889c('0x30')][_0x889c('0x1b')]);_0x2cdd14[_0x889c('0x1a')]=qs[_0x889c('0x1a')](_0x183bd3['query'][_0x889c('0x1a')]);}_0x2cdd14[_0x889c('0x57')]=qs[_0x889c('0x38')](_0x183bd3[_0x889c('0x30')][_0x889c('0x38')]);_0x2cdd14[_0x889c('0x39')]=qs['filters'](_[_0x889c('0x3a')](_0x183bd3[_0x889c('0x30')],_0x597e75['filters']));_0x2cdd14[_0x889c('0x39')]['ProjectId']=_0x1257ab['id'];if(_0x183bd3[_0x889c('0x30')][_0x889c('0x3e')]){_0x2cdd14[_0x889c('0x39')]=_['merge'](_0x2cdd14[_0x889c('0x39')],{'$or':_[_0x889c('0x2a')](_0x2cdd14[_0x889c('0x34')],function(_0x20e52c){var _0x5d5f22={};_0x5d5f22[_0x20e52c]={'$like':'%'+_0x183bd3[_0x889c('0x30')][_0x889c('0x3e')]+'%'};return _0x5d5f22;})});}_0x2cdd14=_[_0x889c('0x3b')]({},_0x2cdd14,_0x183bd3[_0x889c('0x3f')]);return db['JscriptyAnswerReport']['count']({'where':_0x2cdd14[_0x889c('0x39')]})[_0x889c('0x22')](function(_0xad2244){_0x26e032[_0x889c('0x19')]=_0xad2244;if(_0x183bd3[_0x889c('0x30')][_0x889c('0x40')]){_0x2cdd14[_0x889c('0x59')]=[{'all':!![]}];}return db[_0x889c('0x5c')][_0x889c('0x5a')](_0x2cdd14);})[_0x889c('0x22')](function(_0xdfa61d){_0x26e032[_0x889c('0x41')]=_0xdfa61d;return _0x26e032;});}})[_0x889c('0x22')](respondWithFilteredResult(_0x387ab9,_0x2cdd14))[_0x889c('0x4d')](handleError(_0x387ab9,null));};function char(_0x5e6c48){return _0x889c('0x5d')===typeof _0x5e6c48?String[_0x889c('0x5e')]['apply'](null,arguments):_0x5e6c48;}function needsEncapsulation(_0x5a6c18){return!!_0x5a6c18&&(_0x5a6c18[_0x889c('0x5f')]()[_0x889c('0x60')](char(0xd))>=0x0||_0x5a6c18[_0x889c('0x5f')]()['indexOf'](char(0xa))>=0x0||_0x5a6c18[_0x889c('0x5f')]()[_0x889c('0x60')](char(0x2c))>=0x0||_0x5a6c18[_0x889c('0x5f')]()[_0x889c('0x60')](char(0x22))>=0x0);}function encapsulate(_0x129ac0){var _0x592347=char(0x22),_0x579979='\x5c'+char(0x22),_0x9422e3=_0x129ac0[_0x889c('0x5f')]()[_0x889c('0x61')](new RegExp(_0x592347,'g'),_0x579979);return _0x592347+_0x9422e3+_0x592347;}exports[_0x889c('0x62')]=function(_0xc692c0,_0x447b55,_0x274628){var _0x58a5e2,_0x11c4b3;var _0x49c33b={'where':{'ProjectId':_0xc692c0['params']['id']}};if(_0xc692c0['query'][_0x889c('0x63')]){_0x49c33b['where'][_0x889c('0x64')]=JSON['parse'](_0xc692c0['query'][_0x889c('0x63')]);}return db[_0x889c('0x55')][_0x889c('0x5a')](_0x49c33b)[_0x889c('0x22')](handleEntityNotFound(_0x447b55,null))[_0x889c('0x22')](function(_0x3193c9){if(_0x3193c9){_0x58a5e2=_0x3193c9;return db[_0x889c('0x65')][_0x889c('0x5a')]({'where':{'SessionId':{'$in':_[_0x889c('0x2a')](_0x58a5e2,'id')},'ProjectId':_0xc692c0[_0x889c('0x42')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x447b55,null))[_0x889c('0x22')](function(_0x15a5af){if(_0x15a5af){_0x11c4b3=_0x15a5af;var _0x1813be={};for(var _0x3ad52c=0x0,_0x5ed7c2=_0x11c4b3[_0x889c('0x36')];_0x3ad52c<_0x5ed7c2;_0x3ad52c++){if(!_0x1813be[_0x889c('0x37')](_0x11c4b3[_0x3ad52c][_0x889c('0x66')])){_0x1813be[_0x11c4b3[_0x3ad52c][_0x889c('0x66')]]=needsEncapsulation(_0x11c4b3[_0x3ad52c][_0x889c('0x67')])?encapsulate(_0x11c4b3[_0x3ad52c][_0x889c('0x67')]):_0x11c4b3[_0x3ad52c][_0x889c('0x67')];}}var _0x4137f4=[],_0x4d934a={};for(var _0x438c43=0x0,_0x3822e7=_0x58a5e2[_0x889c('0x36')];_0x438c43<_0x3822e7;_0x438c43++){_0x4d934a={'ProjectId':_0xc692c0[_0x889c('0x42')]['id'],'SessionId':_0x58a5e2[_0x438c43]['id'],'StartTime':moment(_0x58a5e2[_0x438c43]['starttime'])[_0x889c('0x68')](_0x889c('0x69'))};for(var _0xb62932=0x0,_0x3e1c45=_0x11c4b3[_0x889c('0x36')];_0xb62932<_0x3e1c45;_0xb62932++){if(_0x11c4b3[_0xb62932][_0x889c('0x6a')]==_0x58a5e2[_0x438c43]['id']&&_0x1813be[_0x889c('0x37')](_0x11c4b3[_0xb62932]['questionId'])){_0x4d934a[_0x1813be[_0x11c4b3[_0xb62932][_0x889c('0x66')]]]=_0x11c4b3[_0xb62932]['answer'];}}for(var _0x9b532b in _0x1813be){if(!_0x4d934a[_0x889c('0x37')](_0x1813be[_0x9b532b])){_0x4d934a[_0x1813be[_0x9b532b]]=null;}}_0x4137f4[_0x889c('0x6b')](_0x4d934a);}return _0x4137f4;}})[_0x889c('0x22')](function(_0x172d79){if(!_[_0x889c('0x6c')](_0x172d79)){var _0x11e7d9=toCsv(_0x172d79);var _0x3352ae=Date[_0x889c('0x6d')]();fs[_0x889c('0x6e')](util[_0x889c('0x68')](_0x889c('0x6f'),_0xc692c0[_0x889c('0x42')]['id'],_0x3352ae),_0x11e7d9);_0x447b55[_0x889c('0x70')](_0x889c('0x71'),_0x889c('0x72')+util[_0x889c('0x68')](_0x889c('0x73'),_0xc692c0[_0x889c('0x42')]['id'],_0x3352ae));_0x447b55['setHeader'](_0x889c('0x74'),'text/csv');return _0x447b55[_0x889c('0x75')](util[_0x889c('0x68')](_0x889c('0x6f'),_0xc692c0[_0x889c('0x42')]['id'],_0x3352ae));}else{return _0x447b55[_0x889c('0x17')](0xcc);}})[_0x889c('0x4d')](handleError(_0x447b55,null));}; \ No newline at end of file +var _0x1b91=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','destroy','get','Projects','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','UserProfileResource','getSessions','findOne','JscriptySessionReport','nolimit','sort','ProjectId','JscriptyAnswerReport','apply','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis'];(function(_0xec884c,_0x3b9d53){var _0x40598a=function(_0x5a2b78){while(--_0x5a2b78){_0xec884c['push'](_0xec884c['shift']());}};_0x40598a(++_0x3b9d53);}(_0x1b91,0xd5));var _0x11b9=function(_0x179921,_0x4b027f){_0x179921=_0x179921-0x0;var _0x687776=_0x1b91[_0x179921];return _0x687776;};'use strict';var pdf=require(_0x11b9('0x0'));var emlformat=require(_0x11b9('0x1'));var rimraf=require(_0x11b9('0x2'));var zipdir=require(_0x11b9('0x3'));var jsonpatch=require(_0x11b9('0x4'));var rp=require(_0x11b9('0x5'));var moment=require('moment');var BPromise=require(_0x11b9('0x6'));var Mustache=require(_0x11b9('0x7'));var util=require('util');var path=require('path');var sox=require(_0x11b9('0x8'));var csv=require(_0x11b9('0x9'));var ejs=require(_0x11b9('0xa'));var fs=require('fs');var _=require(_0x11b9('0xb'));var squel=require(_0x11b9('0xc'));var crypto=require('crypto');var jsforce=require(_0x11b9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x11b9('0xe'));var Papa=require(_0x11b9('0xf'));var Redis=require(_0x11b9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x11b9('0x11'));var as=require(_0x11b9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11b9('0x13'))(_0x11b9('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x11b9('0x15'))['db'];function respondWithStatusCode(_0x42c20f,_0x2fd65a){_0x2fd65a=_0x2fd65a||0xcc;return function(_0x46f3c4){if(_0x46f3c4){return _0x42c20f[_0x11b9('0x16')](_0x2fd65a);}return _0x42c20f[_0x11b9('0x17')](_0x2fd65a)[_0x11b9('0x18')]();};}function respondWithResult(_0xc56b99,_0x4d6e36){_0x4d6e36=_0x4d6e36||0xc8;return function(_0x5f26f3){if(_0x5f26f3){return _0xc56b99[_0x11b9('0x17')](_0x4d6e36)[_0x11b9('0x19')](_0x5f26f3);}};}function respondWithFilteredResult(_0x45a98e,_0x3f072e){return function(_0x6f4c4b){if(_0x6f4c4b){var _0x53e193=_0x6f4c4b[_0x11b9('0x1a')],_0x22ae5f=_0x3f072e['offset'],_0x4d9ad9=_0x3f072e[_0x11b9('0x1b')]+_0x3f072e['limit'],_0x443b89;if(_0x4d9ad9>=_0x53e193){_0x4d9ad9=_0x53e193;_0x443b89=0xc8;}else{_0x443b89=0xce;}_0x45a98e['status'](_0x443b89);return _0x45a98e[_0x11b9('0x1c')](_0x11b9('0x1d'),_0x22ae5f+'-'+_0x4d9ad9+'/'+_0x53e193)[_0x11b9('0x19')](_0x6f4c4b);}return null;};}function patchUpdates(_0x2b81a4){return function(_0x29ba04){try{jsonpatch['apply'](_0x29ba04,_0x2b81a4,!![]);}catch(_0x4bf089){return BPromise['reject'](_0x4bf089);}return _0x29ba04[_0x11b9('0x1e')]();};}function saveUpdates(_0x5ec702,_0x5991be){return function(_0x158c51){if(_0x158c51){return _0x158c51[_0x11b9('0x1f')](_0x5ec702)[_0x11b9('0x20')](function(_0x4a2e96){return _0x4a2e96;});}return null;};}function removeEntity(_0x2c6c08,_0x2acb18){return function(_0x3266e5){if(_0x3266e5){return _0x3266e5[_0x11b9('0x21')]()[_0x11b9('0x20')](function(){var _0x5b3a21=_0x3266e5[_0x11b9('0x22')]({'plain':!![]});var _0x3b9524=_0x11b9('0x23');return db['UserProfileResource'][_0x11b9('0x21')]({'where':{'type':_0x3b9524,'resourceId':_0x5b3a21['id']}})[_0x11b9('0x20')](function(){return _0x3266e5;});})[_0x11b9('0x20')](function(){_0x2c6c08[_0x11b9('0x17')](0xcc)[_0x11b9('0x18')]();});}};}function handleEntityNotFound(_0x48c953,_0xfe7724){return function(_0x48ef9b){if(!_0x48ef9b){_0x48c953[_0x11b9('0x16')](0x194);}return _0x48ef9b;};}function handleError(_0x2407ed,_0x2e4c8c){_0x2e4c8c=_0x2e4c8c||0x1f4;return function(_0x55ed42){logger[_0x11b9('0x24')](_0x55ed42['stack']);if(_0x55ed42['name']){delete _0x55ed42[_0x11b9('0x25')];}_0x2407ed[_0x11b9('0x17')](_0x2e4c8c)[_0x11b9('0x26')](_0x55ed42);};}exports[_0x11b9('0x27')]=function(_0x389b55,_0x2d9ccb){var _0x5f11ba={},_0xeedd67={},_0xed6631={'count':0x0,'rows':[]};var _0xcb2830=_[_0x11b9('0x28')](db[_0x11b9('0x29')][_0x11b9('0x2a')],function(_0x595597){return{'name':_0x595597[_0x11b9('0x2b')],'type':_0x595597['type'][_0x11b9('0x2c')]};});_0xeedd67['model']=_[_0x11b9('0x28')](_0xcb2830,_0x11b9('0x25'));_0xeedd67['query']=_[_0x11b9('0x2d')](_0x389b55[_0x11b9('0x2e')]);_0xeedd67['filters']=_[_0x11b9('0x2f')](_0xeedd67[_0x11b9('0x30')],_0xeedd67[_0x11b9('0x2e')]);_0x5f11ba[_0x11b9('0x31')]=_[_0x11b9('0x2f')](_0xeedd67[_0x11b9('0x30')],qs[_0x11b9('0x32')](_0x389b55[_0x11b9('0x2e')]['fields']));_0x5f11ba[_0x11b9('0x31')]=_0x5f11ba[_0x11b9('0x31')][_0x11b9('0x33')]?_0x5f11ba[_0x11b9('0x31')]:_0xeedd67[_0x11b9('0x30')];if(!_0x389b55['query'][_0x11b9('0x34')]('nolimit')){_0x5f11ba['limit']=qs[_0x11b9('0x35')](_0x389b55[_0x11b9('0x2e')]['limit']);_0x5f11ba['offset']=qs[_0x11b9('0x1b')](_0x389b55[_0x11b9('0x2e')][_0x11b9('0x1b')]);}_0x5f11ba[_0x11b9('0x36')]=qs['sort'](_0x389b55[_0x11b9('0x2e')]['sort']);_0x5f11ba[_0x11b9('0x37')]=qs[_0x11b9('0x38')](_[_0x11b9('0x39')](_0x389b55['query'],_0xeedd67[_0x11b9('0x38')]),_0xcb2830);if(_0x389b55[_0x11b9('0x2e')][_0x11b9('0x3a')]){_0x5f11ba[_0x11b9('0x37')]=_[_0x11b9('0x3b')](_0x5f11ba[_0x11b9('0x37')],{'$or':_['map'](_0xcb2830,function(_0x25d1b4){if(_0x25d1b4['type']!==_0x11b9('0x3c')){var _0x31df22={};_0x31df22[_0x25d1b4[_0x11b9('0x25')]]={'$like':'%'+_0x389b55[_0x11b9('0x2e')][_0x11b9('0x3a')]+'%'};return _0x31df22;}})});}_0x5f11ba=_[_0x11b9('0x3b')]({},_0x5f11ba,_0x389b55[_0x11b9('0x3d')]);var _0x33daa3={'where':_0x5f11ba[_0x11b9('0x37')]};return db[_0x11b9('0x29')][_0x11b9('0x1a')](_0x33daa3)[_0x11b9('0x20')](function(_0xaedfbe){_0xed6631[_0x11b9('0x1a')]=_0xaedfbe;if(_0x389b55[_0x11b9('0x2e')][_0x11b9('0x3e')]){_0x5f11ba[_0x11b9('0x3f')]=[{'all':!![]}];}return db[_0x11b9('0x29')][_0x11b9('0x40')](_0x5f11ba);})['then'](function(_0x4d0ef2){_0xed6631[_0x11b9('0x41')]=_0x4d0ef2;return _0xed6631;})[_0x11b9('0x20')](respondWithFilteredResult(_0x2d9ccb,_0x5f11ba))[_0x11b9('0x42')](handleError(_0x2d9ccb,null));};exports[_0x11b9('0x43')]=function(_0x3da8af,_0x5c384f){var _0x2144ac={'raw':![],'where':{'id':_0x3da8af[_0x11b9('0x44')]['id']}},_0x1016dd={};_0x1016dd[_0x11b9('0x30')]=_['keys'](db['JscriptyProject'][_0x11b9('0x2a')]);_0x1016dd[_0x11b9('0x2e')]=_[_0x11b9('0x2d')](_0x3da8af['query']);_0x1016dd[_0x11b9('0x38')]=_['intersection'](_0x1016dd[_0x11b9('0x30')],_0x1016dd[_0x11b9('0x2e')]);_0x2144ac[_0x11b9('0x31')]=_[_0x11b9('0x2f')](_0x1016dd[_0x11b9('0x30')],qs[_0x11b9('0x32')](_0x3da8af[_0x11b9('0x2e')]['fields']));_0x2144ac[_0x11b9('0x31')]=_0x2144ac[_0x11b9('0x31')][_0x11b9('0x33')]?_0x2144ac[_0x11b9('0x31')]:_0x1016dd[_0x11b9('0x30')];if(_0x3da8af[_0x11b9('0x2e')]['includeAll']){_0x2144ac['include']=[{'all':!![]}];}_0x2144ac=_['merge']({},_0x2144ac,_0x3da8af[_0x11b9('0x3d')]);return db['JscriptyProject'][_0x11b9('0x45')](_0x2144ac)[_0x11b9('0x20')](handleEntityNotFound(_0x5c384f,null))[_0x11b9('0x20')](respondWithResult(_0x5c384f,null))['catch'](handleError(_0x5c384f,null));};exports[_0x11b9('0x46')]=function(_0x125fe2,_0x5d02ef){return db[_0x11b9('0x29')][_0x11b9('0x46')](_0x125fe2[_0x11b9('0x47')],{})[_0x11b9('0x20')](function(_0x3d4088){var _0x279a9e=_0x125fe2[_0x11b9('0x48')][_0x11b9('0x22')]({'plain':!![]});if(!_0x279a9e)throw new Error(_0x11b9('0x49'));if(_0x279a9e['role']===_0x11b9('0x48')){var _0x1a0615=_0x3d4088[_0x11b9('0x22')]({'plain':!![]});var _0x55eecf=_0x11b9('0x23');return db[_0x11b9('0x4a')][_0x11b9('0x45')]({'where':{'name':_0x55eecf,'userProfileId':_0x279a9e['userProfileId']},'raw':!![]})[_0x11b9('0x20')](function(_0x5d7f74){if(_0x5d7f74&&_0x5d7f74[_0x11b9('0x4b')]===0x0){return db['UserProfileResource'][_0x11b9('0x46')]({'name':_0x1a0615['name'],'resourceId':_0x1a0615['id'],'type':_0x5d7f74[_0x11b9('0x25')],'sectionId':_0x5d7f74['id']},{})[_0x11b9('0x20')](function(){return _0x3d4088;});}else{return _0x3d4088;}})[_0x11b9('0x42')](function(_0xfa2af9){logger[_0x11b9('0x24')](_0x11b9('0x4c'),_0xfa2af9);throw _0xfa2af9;});}return _0x3d4088;})['then'](respondWithResult(_0x5d02ef,0xc9))[_0x11b9('0x42')](handleError(_0x5d02ef,null));};exports[_0x11b9('0x4d')]=function(_0x4e54b7,_0x51f5d7){var _0x2953ba={'where':{'id':_0x4e54b7[_0x11b9('0x44')]['id']}},_0x442708={};_0x442708['model']=_['keys'](db[_0x11b9('0x29')][_0x11b9('0x2a')]);_0x2953ba[_0x11b9('0x31')]=_[_0x11b9('0x2f')](_0x442708[_0x11b9('0x30')],qs[_0x11b9('0x32')](_0x4e54b7[_0x11b9('0x2e')][_0x11b9('0x32')]));_0x2953ba[_0x11b9('0x31')]=_0x2953ba[_0x11b9('0x31')][_0x11b9('0x33')]?_0x2953ba[_0x11b9('0x31')]:_0x442708[_0x11b9('0x30')];if(_0x4e54b7[_0x11b9('0x2e')][_0x11b9('0x3e')]){_0x2953ba[_0x11b9('0x3f')]=[{'all':!![]}];}_0x2953ba=_[_0x11b9('0x3b')]({},_0x2953ba,_0x4e54b7[_0x11b9('0x3d')]);return db[_0x11b9('0x29')]['find'](_0x2953ba)['then'](handleEntityNotFound(_0x51f5d7,null))['then'](function(_0x132aa3){if(_0x132aa3){var _0x15e9fb=_0x132aa3['get']({'plain':!![]});_0x15e9fb=qs[_0x11b9('0x4e')](_0x15e9fb,['id',_0x11b9('0x4f'),_0x11b9('0x50')]);_0x4e54b7['body']=_[_0x11b9('0x4e')](_0x4e54b7['body'],['id','createdAt',_0x11b9('0x50')]);return db[_0x11b9('0x29')][_0x11b9('0x46')](_[_0x11b9('0x3b')](_0x15e9fb,_0x4e54b7[_0x11b9('0x47')]),{'include':_0x4e54b7[_0x11b9('0x2e')][_0x11b9('0x3e')]?[{'all':!![]}]:undefined})[_0x11b9('0x20')](function(_0x220541){var _0x1bb184=_0x4e54b7[_0x11b9('0x48')][_0x11b9('0x22')]({'plain':!![]});if(!_0x1bb184)throw new Error(_0x11b9('0x49'));if(_0x1bb184[_0x11b9('0x51')]===_0x11b9('0x48')){var _0x5a3f69=_0x220541[_0x11b9('0x22')]({'plain':!![]});var _0x22ca73='Projects';return db[_0x11b9('0x4a')][_0x11b9('0x45')]({'where':{'name':_0x22ca73,'userProfileId':_0x1bb184['userProfileId']},'raw':!![]})['then'](function(_0x60a352){if(_0x60a352&&_0x60a352[_0x11b9('0x4b')]===0x0){return db[_0x11b9('0x52')][_0x11b9('0x46')]({'name':_0x5a3f69[_0x11b9('0x25')],'resourceId':_0x5a3f69['id'],'type':_0x60a352[_0x11b9('0x25')],'sectionId':_0x60a352['id']},{})[_0x11b9('0x20')](function(){return _0x220541;});}else{return _0x220541;}})[_0x11b9('0x42')](function(_0x29f016){logger['error'](_0x11b9('0x4c'),_0x29f016);throw _0x29f016;});}return _0x220541;});}})[_0x11b9('0x20')](respondWithResult(_0x51f5d7,0xc9))[_0x11b9('0x42')](handleError(_0x51f5d7,null));};exports[_0x11b9('0x1f')]=function(_0x5ce78c,_0x57a964){if(_0x5ce78c[_0x11b9('0x47')]['id']){delete _0x5ce78c[_0x11b9('0x47')]['id'];}return db[_0x11b9('0x29')][_0x11b9('0x45')]({'where':{'id':_0x5ce78c[_0x11b9('0x44')]['id']}})[_0x11b9('0x20')](handleEntityNotFound(_0x57a964,null))[_0x11b9('0x20')](saveUpdates(_0x5ce78c[_0x11b9('0x47')],null))[_0x11b9('0x20')](respondWithResult(_0x57a964,null))[_0x11b9('0x42')](handleError(_0x57a964,null));};exports[_0x11b9('0x21')]=function(_0x5deff7,_0x39ad6d){return db['JscriptyProject']['find']({'where':{'id':_0x5deff7[_0x11b9('0x44')]['id']}})[_0x11b9('0x20')](handleEntityNotFound(_0x39ad6d,null))[_0x11b9('0x20')](removeEntity(_0x39ad6d,null))[_0x11b9('0x42')](handleError(_0x39ad6d,null));};exports[_0x11b9('0x53')]=function(_0x1725cf,_0x49bc01,_0x559cc0){var _0x49f4d1={'raw':!![],'where':{}};var _0x1c01b4={};var _0x492a94={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x11b9('0x54')]({'where':{'id':_0x1725cf[_0x11b9('0x44')]['id']}})[_0x11b9('0x20')](handleEntityNotFound(_0x49bc01,null))[_0x11b9('0x20')](function(_0xa26c4){if(_0xa26c4){_0x1c01b4[_0x11b9('0x30')]=_['keys'](db[_0x11b9('0x55')][_0x11b9('0x2a')]);_0x1c01b4[_0x11b9('0x2e')]=_[_0x11b9('0x2d')](_0x1725cf[_0x11b9('0x2e')]);_0x1c01b4[_0x11b9('0x38')]=_[_0x11b9('0x2f')](_0x1c01b4['model'],_0x1c01b4[_0x11b9('0x2e')]);_0x49f4d1['attributes']=_[_0x11b9('0x2f')](_0x1c01b4[_0x11b9('0x30')],qs[_0x11b9('0x32')](_0x1725cf[_0x11b9('0x2e')]['fields']));_0x49f4d1[_0x11b9('0x31')]=_0x49f4d1['attributes'][_0x11b9('0x33')]?_0x49f4d1[_0x11b9('0x31')]:_0x1c01b4['model'];if(!_0x1725cf[_0x11b9('0x2e')][_0x11b9('0x34')](_0x11b9('0x56'))){_0x49f4d1['limit']=qs[_0x11b9('0x35')](_0x1725cf[_0x11b9('0x2e')]['limit']);_0x49f4d1['offset']=qs[_0x11b9('0x1b')](_0x1725cf[_0x11b9('0x2e')][_0x11b9('0x1b')]);}_0x49f4d1[_0x11b9('0x36')]=qs['sort'](_0x1725cf[_0x11b9('0x2e')][_0x11b9('0x57')]);_0x49f4d1['where']=qs[_0x11b9('0x38')](_['pick'](_0x1725cf[_0x11b9('0x2e')],_0x1c01b4['filters']));_0x49f4d1['where'][_0x11b9('0x58')]=_0xa26c4['id'];if(_0x1725cf[_0x11b9('0x2e')][_0x11b9('0x3a')]){_0x49f4d1[_0x11b9('0x37')]=_[_0x11b9('0x3b')](_0x49f4d1[_0x11b9('0x37')],{'$or':_[_0x11b9('0x28')](_0x49f4d1[_0x11b9('0x31')],function(_0x311718){var _0x592102={};_0x592102[_0x311718]={'$like':'%'+_0x1725cf['query'][_0x11b9('0x3a')]+'%'};return _0x592102;})});}_0x49f4d1=_[_0x11b9('0x3b')]({},_0x49f4d1,_0x1725cf[_0x11b9('0x3d')]);return db[_0x11b9('0x55')][_0x11b9('0x1a')]({'where':_0x49f4d1[_0x11b9('0x37')]})['then'](function(_0x4912e9){_0x492a94[_0x11b9('0x1a')]=_0x4912e9;if(_0x1725cf[_0x11b9('0x2e')]['includeAll']){_0x49f4d1[_0x11b9('0x3f')]=[{'all':!![]}];}return db[_0x11b9('0x55')][_0x11b9('0x40')](_0x49f4d1);})['then'](function(_0xc5173c){_0x492a94[_0x11b9('0x41')]=_0xc5173c;return _0x492a94;});}})['then'](respondWithFilteredResult(_0x49bc01,_0x49f4d1))['catch'](handleError(_0x49bc01,null));};exports['getAnswers']=function(_0x18878a,_0x213d2a,_0x14626f){var _0x32607b={'raw':!![],'where':{}};var _0x4b7fd7={};var _0x840e68={'count':0x0,'rows':[]};return db[_0x11b9('0x29')]['findOne']({'where':{'id':_0x18878a[_0x11b9('0x44')]['id']}})[_0x11b9('0x20')](handleEntityNotFound(_0x213d2a,null))[_0x11b9('0x20')](function(_0x39eed1){if(_0x39eed1){_0x4b7fd7[_0x11b9('0x30')]=_[_0x11b9('0x2d')](db[_0x11b9('0x59')][_0x11b9('0x2a')]);_0x4b7fd7[_0x11b9('0x2e')]=_[_0x11b9('0x2d')](_0x18878a[_0x11b9('0x2e')]);_0x4b7fd7[_0x11b9('0x38')]=_['intersection'](_0x4b7fd7[_0x11b9('0x30')],_0x4b7fd7[_0x11b9('0x2e')]);_0x32607b[_0x11b9('0x31')]=_[_0x11b9('0x2f')](_0x4b7fd7[_0x11b9('0x30')],qs['fields'](_0x18878a[_0x11b9('0x2e')][_0x11b9('0x32')]));_0x32607b['attributes']=_0x32607b[_0x11b9('0x31')]['length']?_0x32607b['attributes']:_0x4b7fd7[_0x11b9('0x30')];if(!_0x18878a[_0x11b9('0x2e')][_0x11b9('0x34')](_0x11b9('0x56'))){_0x32607b[_0x11b9('0x35')]=qs[_0x11b9('0x35')](_0x18878a['query']['limit']);_0x32607b['offset']=qs[_0x11b9('0x1b')](_0x18878a[_0x11b9('0x2e')][_0x11b9('0x1b')]);}_0x32607b[_0x11b9('0x36')]=qs[_0x11b9('0x57')](_0x18878a[_0x11b9('0x2e')][_0x11b9('0x57')]);_0x32607b[_0x11b9('0x37')]=qs[_0x11b9('0x38')](_[_0x11b9('0x39')](_0x18878a[_0x11b9('0x2e')],_0x4b7fd7[_0x11b9('0x38')]));_0x32607b[_0x11b9('0x37')][_0x11b9('0x58')]=_0x39eed1['id'];if(_0x18878a['query'][_0x11b9('0x3a')]){_0x32607b[_0x11b9('0x37')]=_[_0x11b9('0x3b')](_0x32607b['where'],{'$or':_[_0x11b9('0x28')](_0x32607b['attributes'],function(_0x2ca3ea){var _0x37deed={};_0x37deed[_0x2ca3ea]={'$like':'%'+_0x18878a[_0x11b9('0x2e')][_0x11b9('0x3a')]+'%'};return _0x37deed;})});}_0x32607b=_[_0x11b9('0x3b')]({},_0x32607b,_0x18878a[_0x11b9('0x3d')]);return db['JscriptyAnswerReport']['count']({'where':_0x32607b['where']})[_0x11b9('0x20')](function(_0x250b26){_0x840e68[_0x11b9('0x1a')]=_0x250b26;if(_0x18878a[_0x11b9('0x2e')][_0x11b9('0x3e')]){_0x32607b['include']=[{'all':!![]}];}return db[_0x11b9('0x59')][_0x11b9('0x40')](_0x32607b);})[_0x11b9('0x20')](function(_0x3a2166){_0x840e68['rows']=_0x3a2166;return _0x840e68;});}})[_0x11b9('0x20')](respondWithFilteredResult(_0x213d2a,_0x32607b))[_0x11b9('0x42')](handleError(_0x213d2a,null));};function char(_0x11dce5){return'number'===typeof _0x11dce5?String['fromCharCode'][_0x11b9('0x5a')](null,arguments):_0x11dce5;}function needsEncapsulation(_0x2c471c){return!!_0x2c471c&&(_0x2c471c[_0x11b9('0x5b')]()['indexOf'](char(0xd))>=0x0||_0x2c471c[_0x11b9('0x5b')]()[_0x11b9('0x5c')](char(0xa))>=0x0||_0x2c471c[_0x11b9('0x5b')]()[_0x11b9('0x5c')](char(0x2c))>=0x0||_0x2c471c['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x54e864){var _0x45ddfc=char(0x22),_0x3250aa='\x5c'+char(0x22),_0xda31a8=_0x54e864[_0x11b9('0x5b')]()[_0x11b9('0x5d')](new RegExp(_0x45ddfc,'g'),_0x3250aa);return _0x45ddfc+_0xda31a8+_0x45ddfc;}exports[_0x11b9('0x5e')]=function(_0xae4f05,_0x3b5578,_0x457ac1){var _0x2db9f9,_0x216053;var _0x20a8cb={'where':{'ProjectId':_0xae4f05[_0x11b9('0x44')]['id']}};if(_0xae4f05['query'][_0x11b9('0x5f')]){_0x20a8cb[_0x11b9('0x37')]['starttime']=JSON[_0x11b9('0x60')](_0xae4f05[_0x11b9('0x2e')][_0x11b9('0x5f')]);}return db[_0x11b9('0x55')][_0x11b9('0x40')](_0x20a8cb)[_0x11b9('0x20')](handleEntityNotFound(_0x3b5578,null))[_0x11b9('0x20')](function(_0x17156a){if(_0x17156a){_0x2db9f9=_0x17156a;return db[_0x11b9('0x61')]['findAll']({'where':{'SessionId':{'$in':_[_0x11b9('0x28')](_0x2db9f9,'id')},'ProjectId':_0xae4f05['params']['id']},'order':_0x11b9('0x62')});}})[_0x11b9('0x20')](handleEntityNotFound(_0x3b5578,null))[_0x11b9('0x20')](function(_0x2a8e33){if(_0x2a8e33){_0x216053=_0x2a8e33;var _0x338554={};for(var _0x39a9b1=0x0,_0x1d4046=_0x216053['length'];_0x39a9b1<_0x1d4046;_0x39a9b1++){if(!_0x338554[_0x11b9('0x34')](_0x216053[_0x39a9b1][_0x11b9('0x63')])){_0x338554[_0x216053[_0x39a9b1][_0x11b9('0x63')]]=needsEncapsulation(_0x216053[_0x39a9b1][_0x11b9('0x64')])?encapsulate(_0x216053[_0x39a9b1]['question']):_0x216053[_0x39a9b1][_0x11b9('0x64')];}}var _0x27b970=[],_0x2b9969={};for(var _0x55feb9=0x0,_0x496330=_0x2db9f9['length'];_0x55feb9<_0x496330;_0x55feb9++){_0x2b9969={'ProjectId':_0xae4f05['params']['id'],'SessionId':_0x2db9f9[_0x55feb9]['id'],'StartTime':moment(_0x2db9f9[_0x55feb9][_0x11b9('0x65')])[_0x11b9('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3b5022=0x0,_0x1da190=_0x216053[_0x11b9('0x33')];_0x3b5022<_0x1da190;_0x3b5022++){if(_0x216053[_0x3b5022][_0x11b9('0x67')]==_0x2db9f9[_0x55feb9]['id']&&_0x338554[_0x11b9('0x34')](_0x216053[_0x3b5022][_0x11b9('0x63')])){_0x2b9969[_0x338554[_0x216053[_0x3b5022][_0x11b9('0x63')]]]=_0x216053[_0x3b5022][_0x11b9('0x68')];}}for(var _0x522296 in _0x338554){if(!_0x2b9969[_0x11b9('0x34')](_0x338554[_0x522296])){_0x2b9969[_0x338554[_0x522296]]=null;}}_0x27b970[_0x11b9('0x69')](_0x2b9969);}return _0x27b970;}})['then'](function(_0x326ba9){if(!_[_0x11b9('0x6a')](_0x326ba9)){var _0x3555ec=toCsv(_0x326ba9);var _0x373023=Date['now']();fs[_0x11b9('0x6b')](util[_0x11b9('0x66')](_0x11b9('0x6c'),_0xae4f05['params']['id'],_0x373023),_0x3555ec);_0x3b5578[_0x11b9('0x6d')](_0x11b9('0x6e'),_0x11b9('0x6f')+util[_0x11b9('0x66')](_0x11b9('0x70'),_0xae4f05[_0x11b9('0x44')]['id'],_0x373023));_0x3b5578[_0x11b9('0x6d')]('Content-type',_0x11b9('0x71'));return _0x3b5578[_0x11b9('0x72')](util[_0x11b9('0x66')](_0x11b9('0x6c'),_0xae4f05['params']['id'],_0x373023));}else{return _0x3b5578['sendStatus'](0xcc);}})[_0x11b9('0x42')](handleError(_0x3b5578,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 4212d90..fbdcd55 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 _0x8eba=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyProject','lodash','../../config/logger','api'];(function(_0x137815,_0x78dd4b){var _0x29ded1=function(_0x32d620){while(--_0x32d620){_0x137815['push'](_0x137815['shift']());}};_0x29ded1(++_0x78dd4b);}(_0x8eba,0xc3));var _0xa8eb=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x8eba[_0x419e17];return _0x1f2044;};'use strict';var _=require(_0xa8eb('0x0'));var util=require('util');var logger=require(_0xa8eb('0x1'))(_0xa8eb('0x2'));var moment=require(_0xa8eb('0x3'));var BPromise=require(_0xa8eb('0x4'));var rp=require(_0xa8eb('0x5'));var fs=require('fs');var path=require(_0xa8eb('0x6'));var rimraf=require(_0xa8eb('0x7'));var config=require(_0xa8eb('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0xa8eb('0x9')]=function(_0x45219f,_0x43551f){return _0x45219f['define'](_0xa8eb('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd38=['exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2336ea,_0x46e872){var _0x216bf9=function(_0x14a50d){while(--_0x14a50d){_0x2336ea['push'](_0x2336ea['shift']());}};_0x216bf9(++_0x46e872);}(_0xcd38,0x6c));var _0x8cd3=function(_0x2ad4fe,_0x159fce){_0x2ad4fe=_0x2ad4fe-0x0;var _0x5ac8b4=_0xcd38[_0x2ad4fe];return _0x5ac8b4;};'use strict';var _=require(_0x8cd3('0x0'));var util=require(_0x8cd3('0x1'));var logger=require(_0x8cd3('0x2'))(_0x8cd3('0x3'));var moment=require(_0x8cd3('0x4'));var BPromise=require(_0x8cd3('0x5'));var rp=require(_0x8cd3('0x6'));var fs=require('fs');var path=require(_0x8cd3('0x7'));var rimraf=require('rimraf');var config=require(_0x8cd3('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x8cd3('0x9')]=function(_0x145c4f,_0x2292b){return _0x145c4f[_0x8cd3('0xa')](_0x8cd3('0xb'),attributes,{'tableName':_0x8cd3('0xc'),'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 ab66203..2c6d4cb 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 _0xe17b=['error','code','message','result','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0xcb8fa7,_0x22e0cb){var _0x3d0976=function(_0x36897e){while(--_0x36897e){_0xcb8fa7['push'](_0xcb8fa7['shift']());}};_0x3d0976(++_0x22e0cb);}(_0xe17b,0x1df));var _0xbe17=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0xe17b[_0x28a5ad];return _0x176b8a;};'use strict';var _=require(_0xbe17('0x0'));var util=require(_0xbe17('0x1'));var moment=require('moment');var BPromise=require(_0xbe17('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe17('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbe17('0x4'))(_0xbe17('0x5'));var config=require(_0xbe17('0x6'));var jayson=require(_0xbe17('0x7'));var client=jayson['client'][_0xbe17('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36bca3,_0xdc9b43,_0x23a8a7){return new BPromise(function(_0x67c809,_0x3b4691){return client['request'](_0x36bca3,_0x23a8a7)[_0xbe17('0x9')](function(_0x5f53fb){logger[_0xbe17('0xa')](_0xbe17('0xb'),_0xdc9b43,_0xbe17('0xc'));logger[_0xbe17('0xd')](_0xbe17('0xe'),_0xdc9b43,_0xbe17('0xc'),JSON['stringify'](_0x5f53fb));if(_0x5f53fb['error']){if(_0x5f53fb[_0xbe17('0xf')][_0xbe17('0x10')]===0x1f4){logger['error'](_0xbe17('0xb'),_0xdc9b43,_0x5f53fb[_0xbe17('0xf')][_0xbe17('0x11')]);return _0x3b4691(_0x5f53fb[_0xbe17('0xf')]['message']);}logger[_0xbe17('0xf')](_0xbe17('0xb'),_0xdc9b43,_0x5f53fb['error'][_0xbe17('0x11')]);return _0x67c809(_0x5f53fb['error'][_0xbe17('0x11')]);}else{logger[_0xbe17('0xa')](_0xbe17('0xb'),_0xdc9b43,_0xbe17('0xc'));_0x67c809(_0x5f53fb[_0xbe17('0x12')][_0xbe17('0x11')]);}})['catch'](function(_0x263fd0){logger['error'](_0xbe17('0xb'),_0xdc9b43,_0x263fd0);_0x3b4691(_0x263fd0);});});} \ No newline at end of file +var _0x86e9=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util'];(function(_0x37be66,_0x100346){var _0x3885f4=function(_0x194207){while(--_0x194207){_0x37be66['push'](_0x37be66['shift']());}};_0x3885f4(++_0x100346);}(_0x86e9,0x148));var _0x986e=function(_0x14f8ef,_0x1b1107){_0x14f8ef=_0x14f8ef-0x0;var _0x3b97f6=_0x86e9[_0x14f8ef];return _0x3b97f6;};'use strict';var _=require(_0x986e('0x0'));var util=require(_0x986e('0x1'));var moment=require(_0x986e('0x2'));var BPromise=require(_0x986e('0x3'));var rs=require(_0x986e('0x4'));var fs=require('fs');var Redis=require(_0x986e('0x5'));var db=require(_0x986e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x986e('0x7'));var config=require(_0x986e('0x8'));var jayson=require(_0x986e('0x9'));var client=jayson[_0x986e('0xa')][_0x986e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d9c58,_0xf42b52,_0x2d6cfe){return new BPromise(function(_0x27bede,_0x43609d){return client[_0x986e('0xc')](_0x2d9c58,_0x2d6cfe)[_0x986e('0xd')](function(_0x33ae91){logger[_0x986e('0xe')](_0x986e('0xf'),_0xf42b52,_0x986e('0x10'));logger[_0x986e('0x11')](_0x986e('0x12'),_0xf42b52,_0x986e('0x10'),JSON['stringify'](_0x33ae91));if(_0x33ae91[_0x986e('0x13')]){if(_0x33ae91[_0x986e('0x13')]['code']===0x1f4){logger[_0x986e('0x13')]('JscriptyProject,\x20%s,\x20%s',_0xf42b52,_0x33ae91[_0x986e('0x13')][_0x986e('0x14')]);return _0x43609d(_0x33ae91[_0x986e('0x13')][_0x986e('0x14')]);}logger[_0x986e('0x13')](_0x986e('0xf'),_0xf42b52,_0x33ae91[_0x986e('0x13')][_0x986e('0x14')]);return _0x27bede(_0x33ae91['error']['message']);}else{logger[_0x986e('0xe')]('JscriptyProject,\x20%s,\x20%s',_0xf42b52,'request\x20sent');_0x27bede(_0x33ae91['result'][_0x986e('0x14')]);}})[_0x986e('0x15')](function(_0x4569ba){logger[_0x986e('0x13')](_0x986e('0xf'),_0xf42b52,_0x4569ba);_0x43609d(_0x4569ba);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 37a032a..9aa9eb6 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 _0xe6ee=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','delete'];(function(_0xa9c826,_0x4b53f9){var _0x392e76=function(_0x341b09){while(--_0x341b09){_0xa9c826['push'](_0xa9c826['shift']());}};_0x392e76(++_0x4b53f9);}(_0xe6ee,0x1ca));var _0xee6e=function(_0x259252,_0x2ce1bf){_0x259252=_0x259252-0x0;var _0x49f20f=_0xe6ee[_0x259252];return _0x49f20f;};'use strict';var multer=require(_0xee6e('0x0'));var util=require('util');var path=require(_0xee6e('0x1'));var timeout=require(_0xee6e('0x2'));var express=require(_0xee6e('0x3'));var router=express[_0xee6e('0x4')]();var auth=require(_0xee6e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xee6e('0x6'));var controller=require(_0xee6e('0x7'));router[_0xee6e('0x8')]('/',auth[_0xee6e('0x9')](),controller[_0xee6e('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xee6e('0xb')]);router[_0xee6e('0x8')](_0xee6e('0xc'),auth['isAuthenticated'](),controller[_0xee6e('0xd')]);router['post']('/',auth[_0xee6e('0x9')](),controller[_0xee6e('0xe')]);router[_0xee6e('0xf')](_0xee6e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xee6e('0x10')](_0xee6e('0xc'),auth['isAuthenticated'](),controller[_0xee6e('0x11')]);module[_0xee6e('0x12')]=router; \ No newline at end of file +var _0xaf9a=['create','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post'];(function(_0x266f87,_0x5b5086){var _0x1ce676=function(_0x55014e){while(--_0x55014e){_0x266f87['push'](_0x266f87['shift']());}};_0x1ce676(++_0x5b5086);}(_0xaf9a,0x9b));var _0xaaf9=function(_0x396034,_0x3842d8){_0x396034=_0x396034-0x0;var _0x393894=_0xaf9a[_0x396034];return _0x393894;};'use strict';var multer=require(_0xaaf9('0x0'));var util=require('util');var path=require(_0xaaf9('0x1'));var timeout=require('connect-timeout');var express=require(_0xaaf9('0x2'));var router=express[_0xaaf9('0x3')]();var auth=require(_0xaaf9('0x4'));var interaction=require(_0xaaf9('0x5'));var config=require(_0xaaf9('0x6'));var controller=require(_0xaaf9('0x7'));router[_0xaaf9('0x8')]('/',auth['isAuthenticated'](),controller[_0xaaf9('0x9')]);router[_0xaaf9('0x8')](_0xaaf9('0xa'),auth['isAuthenticated'](),controller[_0xaaf9('0xb')]);router[_0xaaf9('0x8')](_0xaaf9('0xc'),auth[_0xaaf9('0xd')](),controller[_0xaaf9('0xe')]);router[_0xaaf9('0xf')]('/',auth[_0xaaf9('0xd')](),controller[_0xaaf9('0x10')]);router['put'](_0xaaf9('0xc'),auth[_0xaaf9('0xd')](),controller['update']);router[_0xaaf9('0x11')](_0xaaf9('0xc'),auth[_0xaaf9('0xd')](),controller[_0xaaf9('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 3240694..63f9cd7 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 _0x0bb9=['TEXT','long','sequelize','exports','STRING'];(function(_0x5263c6,_0x6b9a73){var _0x2f86fd=function(_0x39c470){while(--_0x39c470){_0x5263c6['push'](_0x5263c6['shift']());}};_0x2f86fd(++_0x6b9a73);}(_0x0bb9,0x8e));var _0x90bb=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x0bb9[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0x90bb('0x0'));module[_0x90bb('0x1')]={'question':{'type':Sequelize[_0x90bb('0x2')]},'answer':{'type':Sequelize[_0x90bb('0x3')](_0x90bb('0x4'))},'membername':{'type':Sequelize[_0x90bb('0x2')]},'projectname':{'type':Sequelize[_0x90bb('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x90bb('0x2')]},'calleridnum':{'type':Sequelize[_0x90bb('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x51d9=['sequelize','exports','STRING','TEXT','long'];(function(_0x159c66,_0x23a8d3){var _0x1d2cb8=function(_0x1068a0){while(--_0x1068a0){_0x159c66['push'](_0x159c66['shift']());}};_0x1d2cb8(++_0x23a8d3);}(_0x51d9,0x1a9));var _0x951d=function(_0x4a9bfe,_0x3bb585){_0x4a9bfe=_0x4a9bfe-0x0;var _0xd8f755=_0x51d9[_0x4a9bfe];return _0xd8f755;};'use strict';var Sequelize=require(_0x951d('0x0'));module[_0x951d('0x1')]={'question':{'type':Sequelize[_0x951d('0x2')]},'answer':{'type':Sequelize[_0x951d('0x3')](_0x951d('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x951d('0x2')]},'queue':{'type':Sequelize[_0x951d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x951d('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index b4ad1c3..003cf18 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 _0xf949=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','map','JscriptyQuestionReport','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','keys','options','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring'];(function(_0xf17775,_0x57fa65){var _0x4bf3b2=function(_0xb54e71){while(--_0xb54e71){_0xf17775['push'](_0xf17775['shift']());}};_0x4bf3b2(++_0x57fa65);}(_0xf949,0x1ac));var _0x9f94=function(_0x19d0ed,_0x5b5ccb){_0x19d0ed=_0x19d0ed-0x0;var _0x4218bf=_0xf949[_0x19d0ed];return _0x4218bf;};'use strict';var pdf=require(_0x9f94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9f94('0x1'));var zipdir=require(_0x9f94('0x2'));var jsonpatch=require(_0x9f94('0x3'));var rp=require(_0x9f94('0x4'));var moment=require(_0x9f94('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9f94('0x6'));var path=require(_0x9f94('0x7'));var sox=require(_0x9f94('0x8'));var csv=require(_0x9f94('0x9'));var ejs=require(_0x9f94('0xa'));var fs=require('fs');var _=require(_0x9f94('0xb'));var squel=require('squel');var crypto=require(_0x9f94('0xc'));var jsforce=require(_0x9f94('0xd'));var deskjs=require(_0x9f94('0xe'));var toCsv=require(_0x9f94('0x9'));var querystring=require(_0x9f94('0xf'));var Papa=require(_0x9f94('0x10'));var Redis=require(_0x9f94('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f94('0x12'));var as=require(_0x9f94('0x13'));var hardwareService=require(_0x9f94('0x14'));var logger=require('../../config/logger')(_0x9f94('0x15'));var utils=require(_0x9f94('0x16'));var config=require(_0x9f94('0x17'));var db=require(_0x9f94('0x18'))['db'];function respondWithStatusCode(_0x209b0e,_0x16408d){_0x16408d=_0x16408d||0xcc;return function(_0x2b9020){if(_0x2b9020){return _0x209b0e[_0x9f94('0x19')](_0x16408d);}return _0x209b0e[_0x9f94('0x1a')](_0x16408d)[_0x9f94('0x1b')]();};}function respondWithResult(_0x374501,_0x46fd23){_0x46fd23=_0x46fd23||0xc8;return function(_0x141cc1){if(_0x141cc1){return _0x374501[_0x9f94('0x1a')](_0x46fd23)[_0x9f94('0x1c')](_0x141cc1);}};}function respondWithFilteredResult(_0x60de61,_0x3074cc){return function(_0x1218ab){if(_0x1218ab){var _0x467ae1=_0x1218ab[_0x9f94('0x1d')],_0x5d7eeb=_0x3074cc['offset'],_0x135b35=_0x3074cc[_0x9f94('0x1e')]+_0x3074cc[_0x9f94('0x1f')],_0x4b4745;if(_0x135b35>=_0x467ae1){_0x135b35=_0x467ae1;_0x4b4745=0xc8;}else{_0x4b4745=0xce;}_0x60de61[_0x9f94('0x1a')](_0x4b4745);return _0x60de61[_0x9f94('0x20')](_0x9f94('0x21'),_0x5d7eeb+'-'+_0x135b35+'/'+_0x467ae1)[_0x9f94('0x1c')](_0x1218ab);}return null;};}function patchUpdates(_0x584ff9){return function(_0x4cb707){try{jsonpatch[_0x9f94('0x22')](_0x4cb707,_0x584ff9,!![]);}catch(_0x10f8a7){return BPromise[_0x9f94('0x23')](_0x10f8a7);}return _0x4cb707[_0x9f94('0x24')]();};}function saveUpdates(_0x32f26e,_0x334b33){return function(_0x2abc3e){if(_0x2abc3e){return _0x2abc3e[_0x9f94('0x25')](_0x32f26e)[_0x9f94('0x26')](function(_0x51896f){return _0x51896f;});}return null;};}function removeEntity(_0x45be6e,_0x339fbd){return function(_0xee1b41){if(_0xee1b41){return _0xee1b41['destroy']()[_0x9f94('0x26')](function(){_0x45be6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x477124,_0x1299a8){return function(_0x3e5382){if(!_0x3e5382){_0x477124[_0x9f94('0x19')](0x194);}return _0x3e5382;};}function handleError(_0x489c5a,_0x44d325){_0x44d325=_0x44d325||0x1f4;return function(_0x1a373a){logger[_0x9f94('0x27')](_0x1a373a['stack']);if(_0x1a373a[_0x9f94('0x28')]){delete _0x1a373a[_0x9f94('0x28')];}_0x489c5a['status'](_0x44d325)['send'](_0x1a373a);};}exports['index']=function(_0x107d2a,_0xdf069a){var _0x44e49a={},_0x22c025={},_0x36ed88={'count':0x0,'rows':[]};var _0x31ef36=_[_0x9f94('0x29')](db[_0x9f94('0x2a')][_0x9f94('0x2b')],function(_0x45b503){return{'name':_0x45b503[_0x9f94('0x2c')],'type':_0x45b503['type']['key']};});_0x22c025[_0x9f94('0x2d')]=_['map'](_0x31ef36,_0x9f94('0x28'));_0x22c025[_0x9f94('0x2e')]=_['keys'](_0x107d2a[_0x9f94('0x2e')]);_0x22c025[_0x9f94('0x2f')]=_[_0x9f94('0x30')](_0x22c025[_0x9f94('0x2d')],_0x22c025[_0x9f94('0x2e')]);_0x44e49a['attributes']=_['intersection'](_0x22c025[_0x9f94('0x2d')],qs[_0x9f94('0x31')](_0x107d2a['query'][_0x9f94('0x31')]));_0x44e49a[_0x9f94('0x32')]=_0x44e49a[_0x9f94('0x32')][_0x9f94('0x33')]?_0x44e49a[_0x9f94('0x32')]:_0x22c025['model'];if(!_0x107d2a[_0x9f94('0x2e')][_0x9f94('0x34')](_0x9f94('0x35'))){_0x44e49a[_0x9f94('0x1f')]=qs[_0x9f94('0x1f')](_0x107d2a['query'][_0x9f94('0x1f')]);_0x44e49a[_0x9f94('0x1e')]=qs[_0x9f94('0x1e')](_0x107d2a['query'][_0x9f94('0x1e')]);}_0x44e49a[_0x9f94('0x36')]=qs[_0x9f94('0x37')](_0x107d2a[_0x9f94('0x2e')][_0x9f94('0x37')]);_0x44e49a[_0x9f94('0x38')]=qs[_0x9f94('0x2f')](_[_0x9f94('0x39')](_0x107d2a[_0x9f94('0x2e')],_0x22c025[_0x9f94('0x2f')]),_0x31ef36);if(_0x107d2a[_0x9f94('0x2e')]['filter']){_0x44e49a['where']=_[_0x9f94('0x3a')](_0x44e49a['where'],{'$or':_[_0x9f94('0x29')](_0x31ef36,function(_0x2c28a3){if(_0x2c28a3[_0x9f94('0x3b')]!==_0x9f94('0x3c')){var _0x4c6b70={};_0x4c6b70[_0x2c28a3[_0x9f94('0x28')]]={'$like':'%'+_0x107d2a[_0x9f94('0x2e')][_0x9f94('0x3d')]+'%'};return _0x4c6b70;}})});}_0x44e49a=_[_0x9f94('0x3a')]({},_0x44e49a,_0x107d2a['options']);var _0x4e90d7={'where':_0x44e49a[_0x9f94('0x38')]};return db[_0x9f94('0x2a')][_0x9f94('0x1d')](_0x4e90d7)[_0x9f94('0x26')](function(_0x3c7c53){_0x36ed88[_0x9f94('0x1d')]=_0x3c7c53;if(_0x107d2a[_0x9f94('0x2e')][_0x9f94('0x3e')]){_0x44e49a[_0x9f94('0x3f')]=[{'all':!![]}];}return db[_0x9f94('0x2a')]['findAll'](_0x44e49a);})[_0x9f94('0x26')](function(_0x558f1f){_0x36ed88[_0x9f94('0x40')]=_0x558f1f;return _0x36ed88;})[_0x9f94('0x26')](respondWithFilteredResult(_0xdf069a,_0x44e49a))[_0x9f94('0x41')](handleError(_0xdf069a,null));};exports[_0x9f94('0x42')]=function(_0x37043e,_0x54dfa6){var _0x695780={'raw':!![],'where':{'id':_0x37043e['params']['id']}},_0x210c69={};_0x210c69[_0x9f94('0x2d')]=_[_0x9f94('0x43')](db[_0x9f94('0x2a')][_0x9f94('0x2b')]);_0x210c69[_0x9f94('0x2e')]=_[_0x9f94('0x43')](_0x37043e[_0x9f94('0x2e')]);_0x210c69[_0x9f94('0x2f')]=_[_0x9f94('0x30')](_0x210c69[_0x9f94('0x2d')],_0x210c69['query']);_0x695780['attributes']=_[_0x9f94('0x30')](_0x210c69[_0x9f94('0x2d')],qs['fields'](_0x37043e[_0x9f94('0x2e')]['fields']));_0x695780[_0x9f94('0x32')]=_0x695780[_0x9f94('0x32')][_0x9f94('0x33')]?_0x695780[_0x9f94('0x32')]:_0x210c69[_0x9f94('0x2d')];if(_0x37043e[_0x9f94('0x2e')]['includeAll']){_0x695780['include']=[{'all':!![]}];}_0x695780=_[_0x9f94('0x3a')]({},_0x695780,_0x37043e[_0x9f94('0x44')]);return db[_0x9f94('0x2a')][_0x9f94('0x45')](_0x695780)[_0x9f94('0x26')](handleEntityNotFound(_0x54dfa6,null))['then'](respondWithResult(_0x54dfa6,null))[_0x9f94('0x41')](handleError(_0x54dfa6,null));};exports[_0x9f94('0x46')]=function(_0xff121e,_0x203013){return db[_0x9f94('0x2a')]['create'](_0xff121e[_0x9f94('0x47')],{})[_0x9f94('0x26')](respondWithResult(_0x203013,0xc9))[_0x9f94('0x41')](handleError(_0x203013,null));};exports[_0x9f94('0x25')]=function(_0x3fbf1b,_0x400125){if(_0x3fbf1b[_0x9f94('0x47')]['id']){delete _0x3fbf1b[_0x9f94('0x47')]['id'];}return db[_0x9f94('0x2a')][_0x9f94('0x45')]({'where':{'id':_0x3fbf1b[_0x9f94('0x48')]['id']}})[_0x9f94('0x26')](handleEntityNotFound(_0x400125,null))[_0x9f94('0x26')](saveUpdates(_0x3fbf1b['body'],null))[_0x9f94('0x26')](respondWithResult(_0x400125,null))[_0x9f94('0x41')](handleError(_0x400125,null));};exports['destroy']=function(_0x5ea33,_0x1cf6f3){return db[_0x9f94('0x2a')][_0x9f94('0x45')]({'where':{'id':_0x5ea33[_0x9f94('0x48')]['id']}})[_0x9f94('0x26')](handleEntityNotFound(_0x1cf6f3,null))[_0x9f94('0x26')](removeEntity(_0x1cf6f3,null))[_0x9f94('0x41')](handleError(_0x1cf6f3,null));};exports['describe']=function(_0x998d6d,_0x97714a){return db[_0x9f94('0x2a')][_0x9f94('0x49')]()[_0x9f94('0x26')](respondWithResult(_0x97714a,null))['catch'](handleError(_0x97714a,null));}; \ No newline at end of file +var _0xd36d=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','error','name','send','index','JscriptyQuestionReport','rawAttributes','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','params','describe','html-pdf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd36d,0x1c6));var _0xdd36=function(_0x1d06f2,_0x1e3a1c){_0x1d06f2=_0x1d06f2-0x0;var _0x197585=_0xd36d[_0x1d06f2];return _0x197585;};'use strict';var pdf=require(_0xdd36('0x0'));var emlformat=require(_0xdd36('0x1'));var rimraf=require(_0xdd36('0x2'));var zipdir=require(_0xdd36('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd36('0x4'));var moment=require('moment');var BPromise=require(_0xdd36('0x5'));var Mustache=require(_0xdd36('0x6'));var util=require(_0xdd36('0x7'));var path=require(_0xdd36('0x8'));var sox=require('sox');var csv=require(_0xdd36('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd36('0xa'));var squel=require(_0xdd36('0xb'));var crypto=require('crypto');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(_0xdd36('0xc'));var authService=require(_0xdd36('0xd'));var qs=require(_0xdd36('0xe'));var as=require(_0xdd36('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd36('0x10'))('api');var utils=require(_0xdd36('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x137bc4,_0x275fd3){_0x275fd3=_0x275fd3||0xcc;return function(_0x3573ff){if(_0x3573ff){return _0x137bc4[_0xdd36('0x12')](_0x275fd3);}return _0x137bc4[_0xdd36('0x13')](_0x275fd3)[_0xdd36('0x14')]();};}function respondWithResult(_0x172b42,_0x4f650f){_0x4f650f=_0x4f650f||0xc8;return function(_0x495f1f){if(_0x495f1f){return _0x172b42['status'](_0x4f650f)[_0xdd36('0x15')](_0x495f1f);}};}function respondWithFilteredResult(_0x54b717,_0x515177){return function(_0x63c86f){if(_0x63c86f){var _0x25bf9b=_0x63c86f[_0xdd36('0x16')],_0x18b51d=_0x515177[_0xdd36('0x17')],_0x296d57=_0x515177[_0xdd36('0x17')]+_0x515177[_0xdd36('0x18')],_0x5917ba;if(_0x296d57>=_0x25bf9b){_0x296d57=_0x25bf9b;_0x5917ba=0xc8;}else{_0x5917ba=0xce;}_0x54b717[_0xdd36('0x13')](_0x5917ba);return _0x54b717['set'](_0xdd36('0x19'),_0x18b51d+'-'+_0x296d57+'/'+_0x25bf9b)[_0xdd36('0x15')](_0x63c86f);}return null;};}function patchUpdates(_0x48ceb4){return function(_0x4b565e){try{jsonpatch['apply'](_0x4b565e,_0x48ceb4,!![]);}catch(_0x4ddca8){return BPromise[_0xdd36('0x1a')](_0x4ddca8);}return _0x4b565e['save']();};}function saveUpdates(_0x120433,_0x1b203b){return function(_0x2a00a0){if(_0x2a00a0){return _0x2a00a0[_0xdd36('0x1b')](_0x120433)[_0xdd36('0x1c')](function(_0x1a4e6e){return _0x1a4e6e;});}return null;};}function removeEntity(_0x3b7850,_0x4924cc){return function(_0x57b526){if(_0x57b526){return _0x57b526[_0xdd36('0x1d')]()[_0xdd36('0x1c')](function(){_0x3b7850[_0xdd36('0x13')](0xcc)[_0xdd36('0x14')]();});}};}function handleEntityNotFound(_0x4fb7b8,_0x7ba246){return function(_0x84d937){if(!_0x84d937){_0x4fb7b8['sendStatus'](0x194);}return _0x84d937;};}function handleError(_0x4e5b7f,_0x35b33b){_0x35b33b=_0x35b33b||0x1f4;return function(_0x4b0d07){logger[_0xdd36('0x1e')](_0x4b0d07['stack']);if(_0x4b0d07[_0xdd36('0x1f')]){delete _0x4b0d07['name'];}_0x4e5b7f[_0xdd36('0x13')](_0x35b33b)[_0xdd36('0x20')](_0x4b0d07);};}exports[_0xdd36('0x21')]=function(_0x33a51a,_0x2bb775){var _0x3f3d55={},_0x2509be={},_0x2ee09c={'count':0x0,'rows':[]};var _0x427d77=_['map'](db[_0xdd36('0x22')][_0xdd36('0x23')],function(_0x471292){return{'name':_0x471292['fieldName'],'type':_0x471292['type']['key']};});_0x2509be[_0xdd36('0x24')]=_[_0xdd36('0x25')](_0x427d77,'name');_0x2509be[_0xdd36('0x26')]=_[_0xdd36('0x27')](_0x33a51a[_0xdd36('0x26')]);_0x2509be[_0xdd36('0x28')]=_['intersection'](_0x2509be[_0xdd36('0x24')],_0x2509be[_0xdd36('0x26')]);_0x3f3d55[_0xdd36('0x29')]=_['intersection'](_0x2509be['model'],qs['fields'](_0x33a51a['query'][_0xdd36('0x2a')]));_0x3f3d55['attributes']=_0x3f3d55[_0xdd36('0x29')][_0xdd36('0x2b')]?_0x3f3d55[_0xdd36('0x29')]:_0x2509be['model'];if(!_0x33a51a[_0xdd36('0x26')]['hasOwnProperty'](_0xdd36('0x2c'))){_0x3f3d55['limit']=qs[_0xdd36('0x18')](_0x33a51a[_0xdd36('0x26')][_0xdd36('0x18')]);_0x3f3d55[_0xdd36('0x17')]=qs[_0xdd36('0x17')](_0x33a51a[_0xdd36('0x26')]['offset']);}_0x3f3d55[_0xdd36('0x2d')]=qs[_0xdd36('0x2e')](_0x33a51a[_0xdd36('0x26')][_0xdd36('0x2e')]);_0x3f3d55[_0xdd36('0x2f')]=qs[_0xdd36('0x28')](_[_0xdd36('0x30')](_0x33a51a[_0xdd36('0x26')],_0x2509be[_0xdd36('0x28')]),_0x427d77);if(_0x33a51a[_0xdd36('0x26')]['filter']){_0x3f3d55[_0xdd36('0x2f')]=_[_0xdd36('0x31')](_0x3f3d55['where'],{'$or':_[_0xdd36('0x25')](_0x427d77,function(_0x4b05d7){if(_0x4b05d7[_0xdd36('0x32')]!==_0xdd36('0x33')){var _0xa36a38={};_0xa36a38[_0x4b05d7[_0xdd36('0x1f')]]={'$like':'%'+_0x33a51a['query']['filter']+'%'};return _0xa36a38;}})});}_0x3f3d55=_['merge']({},_0x3f3d55,_0x33a51a[_0xdd36('0x34')]);var _0xb05d6c={'where':_0x3f3d55['where']};return db[_0xdd36('0x22')][_0xdd36('0x16')](_0xb05d6c)[_0xdd36('0x1c')](function(_0x24df73){_0x2ee09c[_0xdd36('0x16')]=_0x24df73;if(_0x33a51a[_0xdd36('0x26')][_0xdd36('0x35')]){_0x3f3d55[_0xdd36('0x36')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xdd36('0x37')](_0x3f3d55);})[_0xdd36('0x1c')](function(_0x46f254){_0x2ee09c[_0xdd36('0x38')]=_0x46f254;return _0x2ee09c;})[_0xdd36('0x1c')](respondWithFilteredResult(_0x2bb775,_0x3f3d55))[_0xdd36('0x39')](handleError(_0x2bb775,null));};exports[_0xdd36('0x3a')]=function(_0x30ef06,_0x1f29ec){var _0x341f9c={'raw':!![],'where':{'id':_0x30ef06['params']['id']}},_0x2b6440={};_0x2b6440['model']=_[_0xdd36('0x27')](db[_0xdd36('0x22')][_0xdd36('0x23')]);_0x2b6440['query']=_['keys'](_0x30ef06[_0xdd36('0x26')]);_0x2b6440['filters']=_[_0xdd36('0x3b')](_0x2b6440[_0xdd36('0x24')],_0x2b6440[_0xdd36('0x26')]);_0x341f9c[_0xdd36('0x29')]=_['intersection'](_0x2b6440[_0xdd36('0x24')],qs[_0xdd36('0x2a')](_0x30ef06['query'][_0xdd36('0x2a')]));_0x341f9c[_0xdd36('0x29')]=_0x341f9c[_0xdd36('0x29')][_0xdd36('0x2b')]?_0x341f9c[_0xdd36('0x29')]:_0x2b6440['model'];if(_0x30ef06[_0xdd36('0x26')][_0xdd36('0x35')]){_0x341f9c[_0xdd36('0x36')]=[{'all':!![]}];}_0x341f9c=_[_0xdd36('0x31')]({},_0x341f9c,_0x30ef06[_0xdd36('0x34')]);return db[_0xdd36('0x22')][_0xdd36('0x3c')](_0x341f9c)[_0xdd36('0x1c')](handleEntityNotFound(_0x1f29ec,null))[_0xdd36('0x1c')](respondWithResult(_0x1f29ec,null))['catch'](handleError(_0x1f29ec,null));};exports[_0xdd36('0x3d')]=function(_0xbf72ca,_0x46393f){return db[_0xdd36('0x22')][_0xdd36('0x3d')](_0xbf72ca['body'],{})['then'](respondWithResult(_0x46393f,0xc9))[_0xdd36('0x39')](handleError(_0x46393f,null));};exports['update']=function(_0x40d803,_0x23f828){if(_0x40d803[_0xdd36('0x3e')]['id']){delete _0x40d803[_0xdd36('0x3e')]['id'];}return db[_0xdd36('0x22')][_0xdd36('0x3c')]({'where':{'id':_0x40d803[_0xdd36('0x3f')]['id']}})[_0xdd36('0x1c')](handleEntityNotFound(_0x23f828,null))['then'](saveUpdates(_0x40d803[_0xdd36('0x3e')],null))['then'](respondWithResult(_0x23f828,null))['catch'](handleError(_0x23f828,null));};exports[_0xdd36('0x1d')]=function(_0x3dadc0,_0x170e73){return db['JscriptyQuestionReport'][_0xdd36('0x3c')]({'where':{'id':_0x3dadc0[_0xdd36('0x3f')]['id']}})[_0xdd36('0x1c')](handleEntityNotFound(_0x170e73,null))[_0xdd36('0x1c')](removeEntity(_0x170e73,null))['catch'](handleError(_0x170e73,null));};exports[_0xdd36('0x40')]=function(_0x6e7bf4,_0x47ea86){return db[_0xdd36('0x22')]['describe']()[_0xdd36('0x1c')](respondWithResult(_0x47ea86,null))[_0xdd36('0x39')](handleError(_0x47ea86,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index cde29f1..53b7eb9 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 _0x21e9=['api','moment','bluebird','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','util','../../config/logger'];(function(_0x575dbb,_0x4ed18c){var _0x5acfd8=function(_0x29a54d){while(--_0x29a54d){_0x575dbb['push'](_0x575dbb['shift']());}};_0x5acfd8(++_0x4ed18c);}(_0x21e9,0x98));var _0x921e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x21e9[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x921e('0x0'));var logger=require(_0x921e('0x1'))(_0x921e('0x2'));var moment=require(_0x921e('0x3'));var BPromise=require(_0x921e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x921e('0x5'));var config=require(_0x921e('0x6'));var attributes=require(_0x921e('0x7'));module[_0x921e('0x8')]=function(_0x13903f,_0x3d338d){return _0x13903f[_0x921e('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x921e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc361=['path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','lodash','../../config/logger','api','moment','request-promise'];(function(_0x13e0c6,_0x28f847){var _0x479450=function(_0xfb5f95){while(--_0xfb5f95){_0x13e0c6['push'](_0x13e0c6['shift']());}};_0x479450(++_0x28f847);}(_0xc361,0x8a));var _0x1c36=function(_0x54d8c4,_0x4d19cf){_0x54d8c4=_0x54d8c4-0x0;var _0x3568f4=_0xc361[_0x54d8c4];return _0x3568f4;};'use strict';var _=require(_0x1c36('0x0'));var util=require('util');var logger=require(_0x1c36('0x1'))(_0x1c36('0x2'));var moment=require(_0x1c36('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c36('0x4'));var fs=require('fs');var path=require(_0x1c36('0x5'));var rimraf=require(_0x1c36('0x6'));var config=require(_0x1c36('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x1c36('0x8')]=function(_0x1b7cce,_0x5effb5){return _0x1b7cce[_0x1c36('0x9')](_0x1c36('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index e27361c..42be203 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 _0x5895=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x290c31,_0x534b8a){var _0x2eb0ac=function(_0x54bd7){while(--_0x54bd7){_0x290c31['push'](_0x290c31['shift']());}};_0x2eb0ac(++_0x534b8a);}(_0x5895,0xf6));var _0x5589=function(_0x5d7917,_0x1014a3){_0x5d7917=_0x5d7917-0x0;var _0x5eca82=_0x5895[_0x5d7917];return _0x5eca82;};'use strict';var _=require(_0x5589('0x0'));var util=require(_0x5589('0x1'));var moment=require(_0x5589('0x2'));var BPromise=require(_0x5589('0x3'));var rs=require(_0x5589('0x4'));var fs=require('fs');var Redis=require(_0x5589('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5589('0x6'));var logger=require(_0x5589('0x7'))(_0x5589('0x8'));var config=require(_0x5589('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5589('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55e12a,_0x5bcd08,_0x9a02b3){return new BPromise(function(_0x4dff39,_0xa133ef){return client['request'](_0x55e12a,_0x9a02b3)['then'](function(_0x2c4ec9){logger[_0x5589('0xb')](_0x5589('0xc'),_0x5bcd08,_0x5589('0xd'));logger[_0x5589('0xe')](_0x5589('0xf'),_0x5bcd08,'request\x20sent',JSON['stringify'](_0x2c4ec9));if(_0x2c4ec9[_0x5589('0x10')]){if(_0x2c4ec9[_0x5589('0x10')][_0x5589('0x11')]===0x1f4){logger[_0x5589('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5bcd08,_0x2c4ec9['error'][_0x5589('0x12')]);return _0xa133ef(_0x2c4ec9[_0x5589('0x10')]['message']);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5bcd08,_0x2c4ec9['error'][_0x5589('0x12')]);return _0x4dff39(_0x2c4ec9['error'][_0x5589('0x12')]);}else{logger[_0x5589('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5bcd08,_0x5589('0xd'));_0x4dff39(_0x2c4ec9[_0x5589('0x13')]['message']);}})['catch'](function(_0x34a464){logger[_0x5589('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5bcd08,_0x34a464);_0xa133ef(_0x34a464);});});} \ No newline at end of file +var _0x7285=['then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7285,0x82));var _0x5728=function(_0x102106,_0x2f75c9){_0x102106=_0x102106-0x0;var _0x29b019=_0x7285[_0x102106];return _0x29b019;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5728('0x0'));var BPromise=require(_0x5728('0x1'));var rs=require(_0x5728('0x2'));var fs=require('fs');var Redis=require(_0x5728('0x3'));var db=require(_0x5728('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5728('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5728('0x6'));var client=jayson[_0x5728('0x7')][_0x5728('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bf52,_0x7241a4,_0x51c8d2){return new BPromise(function(_0x593d98,_0x422b6d){return client[_0x5728('0x9')](_0x12bf52,_0x51c8d2)[_0x5728('0xa')](function(_0x4e7af9){logger['info'](_0x5728('0xb'),_0x7241a4,_0x5728('0xc'));logger[_0x5728('0xd')](_0x5728('0xe'),_0x7241a4,_0x5728('0xc'),JSON[_0x5728('0xf')](_0x4e7af9));if(_0x4e7af9[_0x5728('0x10')]){if(_0x4e7af9[_0x5728('0x10')]['code']===0x1f4){logger[_0x5728('0x10')](_0x5728('0xb'),_0x7241a4,_0x4e7af9[_0x5728('0x10')][_0x5728('0x11')]);return _0x422b6d(_0x4e7af9[_0x5728('0x10')]['message']);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x7241a4,_0x4e7af9[_0x5728('0x10')]['message']);return _0x593d98(_0x4e7af9[_0x5728('0x10')][_0x5728('0x11')]);}else{logger[_0x5728('0x12')](_0x5728('0xb'),_0x7241a4,_0x5728('0xc'));_0x593d98(_0x4e7af9[_0x5728('0x13')]['message']);}})['catch'](function(_0x530f47){logger[_0x5728('0x10')](_0x5728('0xb'),_0x7241a4,_0x530f47);_0x422b6d(_0x530f47);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 9702b5b..027266f 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 _0x8b7c=['delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','update'];(function(_0x38c3fb,_0x3ee22c){var _0x3d6929=function(_0x268a54){while(--_0x268a54){_0x38c3fb['push'](_0x38c3fb['shift']());}};_0x3d6929(++_0x3ee22c);}(_0x8b7c,0x119));var _0xc8b7=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0x8b7c[_0x540160];return _0x476120;};'use strict';var multer=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var path=require(_0xc8b7('0x2'));var timeout=require(_0xc8b7('0x3'));var express=require(_0xc8b7('0x4'));var router=express[_0xc8b7('0x5')]();var auth=require(_0xc8b7('0x6'));var interaction=require(_0xc8b7('0x7'));var config=require('../../config/environment');var controller=require(_0xc8b7('0x8'));router[_0xc8b7('0x9')]('/',auth[_0xc8b7('0xa')](),controller['index']);router[_0xc8b7('0x9')](_0xc8b7('0xb'),auth[_0xc8b7('0xa')](),controller[_0xc8b7('0xc')]);router[_0xc8b7('0x9')](_0xc8b7('0xd'),auth['isAuthenticated'](),controller[_0xc8b7('0xe')]);router['get'](_0xc8b7('0xf'),auth[_0xc8b7('0xa')](),controller[_0xc8b7('0x10')]);router[_0xc8b7('0x11')]('/',auth[_0xc8b7('0xa')](),controller['create']);router['put']('/:id',auth[_0xc8b7('0xa')](),controller[_0xc8b7('0x12')]);router[_0xc8b7('0x13')](_0xc8b7('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x07c3=['show','/:id/questions','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x07c3,0x1bf));var _0x307c=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x07c3[_0x503950];return _0x1657a9;};'use strict';var multer=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var path=require(_0x307c('0x2'));var timeout=require(_0x307c('0x3'));var express=require(_0x307c('0x4'));var router=express[_0x307c('0x5')]();var auth=require(_0x307c('0x6'));var interaction=require(_0x307c('0x7'));var config=require('../../config/environment');var controller=require(_0x307c('0x8'));router[_0x307c('0x9')]('/',auth[_0x307c('0xa')](),controller[_0x307c('0xb')]);router[_0x307c('0x9')](_0x307c('0xc'),auth[_0x307c('0xa')](),controller[_0x307c('0xd')]);router[_0x307c('0x9')](_0x307c('0xe'),auth[_0x307c('0xa')](),controller[_0x307c('0xf')]);router[_0x307c('0x9')](_0x307c('0x10'),auth[_0x307c('0xa')](),controller['getQuestions']);router[_0x307c('0x11')]('/',auth[_0x307c('0xa')](),controller[_0x307c('0x12')]);router[_0x307c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x307c('0x14')]);router['delete'](_0x307c('0xe'),auth[_0x307c('0xa')](),controller['destroy']);module[_0x307c('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 c7bee45..029b458 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 _0x11c4=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','DATE','setDataValue','starttime','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11c4,0xf1));var _0x411c=function(_0x484e19,_0x2a94ff){_0x484e19=_0x484e19-0x0;var _0x59ac8d=_0x11c4[_0x484e19];return _0x59ac8d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x411c('0x0')],'set':function(_0x47beb8){this[_0x411c('0x1')](_0x411c('0x2'),_0x47beb8);this[_0x411c('0x1')]('endtime',moment()[_0x411c('0x3')](_0x411c('0x4')));}},'endtime':{'type':Sequelize[_0x411c('0x0')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x411c('0x5')]},'uniqueid':{'type':Sequelize[_0x411c('0x5')]},'calleridname':{'type':Sequelize[_0x411c('0x5')]},'calleridnum':{'type':Sequelize[_0x411c('0x5')]},'completed':{'type':Sequelize[_0x411c('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xca0d=['STRING','BOOLEAN','moment','exports','DATE','setDataValue','endtime'];(function(_0x5aa86d,_0x619a5c){var _0x377da0=function(_0x344cf6){while(--_0x344cf6){_0x5aa86d['push'](_0x5aa86d['shift']());}};_0x377da0(++_0x619a5c);}(_0xca0d,0x10c));var _0xdca0=function(_0x493efe,_0x3a60ba){_0x493efe=_0x493efe-0x0;var _0x554a59=_0xca0d[_0x493efe];return _0x554a59;};'use strict';var moment=require(_0xdca0('0x0'));var Sequelize=require('sequelize');module[_0xdca0('0x1')]={'starttime':{'type':Sequelize[_0xdca0('0x2')],'set':function(_0x1affdb){this[_0xdca0('0x3')]('starttime',_0x1affdb);this[_0xdca0('0x3')](_0xdca0('0x4'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xdca0('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdca0('0x5')]},'calleridname':{'type':Sequelize[_0xdca0('0x5')]},'calleridnum':{'type':Sequelize[_0xdca0('0x5')]},'completed':{'type':Sequelize[_0xdca0('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7de20ca..c31da9f 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 _0x752f=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getQuestions','SessionId','JscriptyQuestionReport','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x4b07b7,_0x3bb016){var _0x642a62=function(_0x490219){while(--_0x490219){_0x4b07b7['push'](_0x4b07b7['shift']());}};_0x642a62(++_0x3bb016);}(_0x752f,0x1f0));var _0xf752=function(_0x5b0421,_0x22bc4c){_0x5b0421=_0x5b0421-0x0;var _0x50a184=_0x752f[_0x5b0421];return _0x50a184;};'use strict';var pdf=require(_0xf752('0x0'));var emlformat=require(_0xf752('0x1'));var rimraf=require(_0xf752('0x2'));var zipdir=require(_0xf752('0x3'));var jsonpatch=require(_0xf752('0x4'));var rp=require('request-promise');var moment=require(_0xf752('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf752('0x6'));var util=require(_0xf752('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf752('0x8'));var ejs=require(_0xf752('0x9'));var fs=require('fs');var _=require(_0xf752('0xa'));var squel=require(_0xf752('0xb'));var crypto=require(_0xf752('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf752('0xd'));var toCsv=require(_0xf752('0x8'));var querystring=require(_0xf752('0xe'));var Papa=require(_0xf752('0xf'));var Redis=require(_0xf752('0x10'));var authService=require(_0xf752('0x11'));var qs=require(_0xf752('0x12'));var as=require(_0xf752('0x13'));var hardwareService=require(_0xf752('0x14'));var logger=require(_0xf752('0x15'))(_0xf752('0x16'));var utils=require('../../config/utils');var config=require(_0xf752('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44161d,_0xb42818){_0xb42818=_0xb42818||0xcc;return function(_0x59d5ad){if(_0x59d5ad){return _0x44161d['sendStatus'](_0xb42818);}return _0x44161d[_0xf752('0x18')](_0xb42818)[_0xf752('0x19')]();};}function respondWithResult(_0x57b47f,_0x26e16c){_0x26e16c=_0x26e16c||0xc8;return function(_0x502d66){if(_0x502d66){return _0x57b47f[_0xf752('0x18')](_0x26e16c)[_0xf752('0x1a')](_0x502d66);}};}function respondWithFilteredResult(_0x35a5f8,_0x40998d){return function(_0xbd8a3){if(_0xbd8a3){var _0x466163=_0xbd8a3[_0xf752('0x1b')],_0x111410=_0x40998d[_0xf752('0x1c')],_0x4fae46=_0x40998d[_0xf752('0x1c')]+_0x40998d[_0xf752('0x1d')],_0x41364d;if(_0x4fae46>=_0x466163){_0x4fae46=_0x466163;_0x41364d=0xc8;}else{_0x41364d=0xce;}_0x35a5f8[_0xf752('0x18')](_0x41364d);return _0x35a5f8[_0xf752('0x1e')](_0xf752('0x1f'),_0x111410+'-'+_0x4fae46+'/'+_0x466163)['json'](_0xbd8a3);}return null;};}function patchUpdates(_0x4ae795){return function(_0x30ce54){try{jsonpatch['apply'](_0x30ce54,_0x4ae795,!![]);}catch(_0x32bd35){return BPromise[_0xf752('0x20')](_0x32bd35);}return _0x30ce54[_0xf752('0x21')]();};}function saveUpdates(_0x21f1c0,_0x1f0955){return function(_0x45aaef){if(_0x45aaef){return _0x45aaef[_0xf752('0x22')](_0x21f1c0)[_0xf752('0x23')](function(_0x7c1f91){return _0x7c1f91;});}return null;};}function removeEntity(_0x41aa77,_0x22a693){return function(_0x4c2d2b){if(_0x4c2d2b){return _0x4c2d2b[_0xf752('0x24')]()[_0xf752('0x23')](function(){_0x41aa77[_0xf752('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf04d34,_0x467dcb){return function(_0x1037db){if(!_0x1037db){_0xf04d34[_0xf752('0x25')](0x194);}return _0x1037db;};}function handleError(_0x4715e4,_0x5a8962){_0x5a8962=_0x5a8962||0x1f4;return function(_0x13794f){logger[_0xf752('0x26')](_0x13794f[_0xf752('0x27')]);if(_0x13794f['name']){delete _0x13794f[_0xf752('0x28')];}_0x4715e4[_0xf752('0x18')](_0x5a8962)['send'](_0x13794f);};}exports[_0xf752('0x29')]=function(_0x3e42c0,_0x536b67){var _0x4cb939={},_0x38a56e={},_0x43a201={'count':0x0,'rows':[]};var _0x508571=_[_0xf752('0x2a')](db[_0xf752('0x2b')][_0xf752('0x2c')],function(_0x5847d0){return{'name':_0x5847d0[_0xf752('0x2d')],'type':_0x5847d0[_0xf752('0x2e')][_0xf752('0x2f')]};});_0x38a56e[_0xf752('0x30')]=_['map'](_0x508571,_0xf752('0x28'));_0x38a56e[_0xf752('0x31')]=_[_0xf752('0x32')](_0x3e42c0[_0xf752('0x31')]);_0x38a56e['filters']=_[_0xf752('0x33')](_0x38a56e[_0xf752('0x30')],_0x38a56e[_0xf752('0x31')]);_0x4cb939[_0xf752('0x34')]=_[_0xf752('0x33')](_0x38a56e[_0xf752('0x30')],qs[_0xf752('0x35')](_0x3e42c0[_0xf752('0x31')][_0xf752('0x35')]));_0x4cb939[_0xf752('0x34')]=_0x4cb939[_0xf752('0x34')][_0xf752('0x36')]?_0x4cb939[_0xf752('0x34')]:_0x38a56e[_0xf752('0x30')];if(!_0x3e42c0[_0xf752('0x31')][_0xf752('0x37')](_0xf752('0x38'))){_0x4cb939[_0xf752('0x1d')]=qs[_0xf752('0x1d')](_0x3e42c0['query'][_0xf752('0x1d')]);_0x4cb939[_0xf752('0x1c')]=qs[_0xf752('0x1c')](_0x3e42c0['query'][_0xf752('0x1c')]);}_0x4cb939[_0xf752('0x39')]=qs['sort'](_0x3e42c0['query'][_0xf752('0x3a')]);_0x4cb939['where']=qs[_0xf752('0x3b')](_['pick'](_0x3e42c0['query'],_0x38a56e[_0xf752('0x3b')]),_0x508571);if(_0x3e42c0[_0xf752('0x31')][_0xf752('0x3c')]){_0x4cb939[_0xf752('0x3d')]=_[_0xf752('0x3e')](_0x4cb939[_0xf752('0x3d')],{'$or':_[_0xf752('0x2a')](_0x508571,function(_0x350646){if(_0x350646[_0xf752('0x2e')]!==_0xf752('0x3f')){var _0x33f2ad={};_0x33f2ad[_0x350646['name']]={'$like':'%'+_0x3e42c0[_0xf752('0x31')][_0xf752('0x3c')]+'%'};return _0x33f2ad;}})});}_0x4cb939=_[_0xf752('0x3e')]({},_0x4cb939,_0x3e42c0[_0xf752('0x40')]);var _0x43a9e1={'where':_0x4cb939[_0xf752('0x3d')]};return db[_0xf752('0x2b')]['count'](_0x43a9e1)['then'](function(_0x568012){_0x43a201[_0xf752('0x1b')]=_0x568012;if(_0x3e42c0[_0xf752('0x31')][_0xf752('0x41')]){_0x4cb939[_0xf752('0x42')]=[{'all':!![]}];}return db[_0xf752('0x2b')][_0xf752('0x43')](_0x4cb939);})[_0xf752('0x23')](function(_0x30fcb4){_0x43a201[_0xf752('0x44')]=_0x30fcb4;return _0x43a201;})[_0xf752('0x23')](respondWithFilteredResult(_0x536b67,_0x4cb939))[_0xf752('0x45')](handleError(_0x536b67,null));};exports['show']=function(_0x965641,_0x41d2db){var _0x4b3edd={'raw':!![],'where':{'id':_0x965641[_0xf752('0x46')]['id']}},_0x10db84={};_0x10db84[_0xf752('0x30')]=_[_0xf752('0x32')](db[_0xf752('0x2b')][_0xf752('0x2c')]);_0x10db84[_0xf752('0x31')]=_['keys'](_0x965641[_0xf752('0x31')]);_0x10db84['filters']=_[_0xf752('0x33')](_0x10db84[_0xf752('0x30')],_0x10db84[_0xf752('0x31')]);_0x4b3edd[_0xf752('0x34')]=_[_0xf752('0x33')](_0x10db84[_0xf752('0x30')],qs[_0xf752('0x35')](_0x965641[_0xf752('0x31')]['fields']));_0x4b3edd[_0xf752('0x34')]=_0x4b3edd[_0xf752('0x34')]['length']?_0x4b3edd[_0xf752('0x34')]:_0x10db84[_0xf752('0x30')];if(_0x965641[_0xf752('0x31')][_0xf752('0x41')]){_0x4b3edd['include']=[{'all':!![]}];}_0x4b3edd=_['merge']({},_0x4b3edd,_0x965641[_0xf752('0x40')]);return db['JscriptySessionReport'][_0xf752('0x47')](_0x4b3edd)['then'](handleEntityNotFound(_0x41d2db,null))[_0xf752('0x23')](respondWithResult(_0x41d2db,null))[_0xf752('0x45')](handleError(_0x41d2db,null));};exports['create']=function(_0x1fcaa6,_0x5f15e4){return db[_0xf752('0x2b')][_0xf752('0x48')](_0x1fcaa6[_0xf752('0x49')],{})[_0xf752('0x23')](respondWithResult(_0x5f15e4,0xc9))[_0xf752('0x45')](handleError(_0x5f15e4,null));};exports[_0xf752('0x22')]=function(_0x30c730,_0x4f5094){if(_0x30c730[_0xf752('0x49')]['id']){delete _0x30c730['body']['id'];}return db['JscriptySessionReport'][_0xf752('0x47')]({'where':{'id':_0x30c730[_0xf752('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f5094,null))[_0xf752('0x23')](saveUpdates(_0x30c730[_0xf752('0x49')],null))[_0xf752('0x23')](respondWithResult(_0x4f5094,null))[_0xf752('0x45')](handleError(_0x4f5094,null));};exports[_0xf752('0x24')]=function(_0x32ce39,_0xffa44){return db[_0xf752('0x2b')]['find']({'where':{'id':_0x32ce39[_0xf752('0x46')]['id']}})[_0xf752('0x23')](handleEntityNotFound(_0xffa44,null))[_0xf752('0x23')](removeEntity(_0xffa44,null))[_0xf752('0x45')](handleError(_0xffa44,null));};exports[_0xf752('0x4a')]=function(_0x20b2de,_0x2c0a6a){return db[_0xf752('0x2b')][_0xf752('0x4a')]()[_0xf752('0x23')](respondWithResult(_0x2c0a6a,null))[_0xf752('0x45')](handleError(_0x2c0a6a,null));};exports[_0xf752('0x4b')]=function(_0x488330,_0x31856d,_0x4409fa){var _0x325607={'raw':!![],'where':{}};var _0x22185f={};var _0x53faea={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x488330[_0xf752('0x46')]['id']}})['then'](handleEntityNotFound(_0x31856d,null))[_0xf752('0x23')](function(_0x2d64ae){if(_0x2d64ae){_0x22185f[_0xf752('0x30')]=_['keys'](db['JscriptyQuestionReport'][_0xf752('0x2c')]);_0x22185f[_0xf752('0x31')]=_[_0xf752('0x32')](_0x488330[_0xf752('0x31')]);_0x22185f['filters']=_[_0xf752('0x33')](_0x22185f[_0xf752('0x30')],_0x22185f[_0xf752('0x31')]);_0x325607['attributes']=_['intersection'](_0x22185f[_0xf752('0x30')],qs[_0xf752('0x35')](_0x488330['query']['fields']));_0x325607['attributes']=_0x325607[_0xf752('0x34')][_0xf752('0x36')]?_0x325607[_0xf752('0x34')]:_0x22185f['model'];if(!_0x488330[_0xf752('0x31')][_0xf752('0x37')](_0xf752('0x38'))){_0x325607[_0xf752('0x1d')]=qs[_0xf752('0x1d')](_0x488330['query'][_0xf752('0x1d')]);_0x325607[_0xf752('0x1c')]=qs['offset'](_0x488330[_0xf752('0x31')][_0xf752('0x1c')]);}_0x325607[_0xf752('0x39')]=qs['sort'](_0x488330[_0xf752('0x31')][_0xf752('0x3a')]);_0x325607[_0xf752('0x3d')]=qs['filters'](_['pick'](_0x488330[_0xf752('0x31')],_0x22185f[_0xf752('0x3b')]));_0x325607[_0xf752('0x3d')][_0xf752('0x4c')]=_0x2d64ae['id'];if(_0x488330[_0xf752('0x31')]['filter']){_0x325607[_0xf752('0x3d')]=_[_0xf752('0x3e')](_0x325607[_0xf752('0x3d')],{'$or':_[_0xf752('0x2a')](_0x325607[_0xf752('0x34')],function(_0x289e02){var _0x3905d9={};_0x3905d9[_0x289e02]={'$like':'%'+_0x488330[_0xf752('0x31')][_0xf752('0x3c')]+'%'};return _0x3905d9;})});}_0x325607=_[_0xf752('0x3e')]({},_0x325607,_0x488330[_0xf752('0x40')]);return db[_0xf752('0x4d')]['count']({'where':_0x325607['where']})[_0xf752('0x23')](function(_0x3993e1){_0x53faea[_0xf752('0x1b')]=_0x3993e1;if(_0x488330[_0xf752('0x31')][_0xf752('0x41')]){_0x325607[_0xf752('0x42')]=[{'all':!![]}];}return db[_0xf752('0x4d')][_0xf752('0x43')](_0x325607);})['then'](function(_0x209c2d){_0x53faea[_0xf752('0x44')]=_0x209c2d;return _0x53faea;});}})[_0xf752('0x23')](respondWithFilteredResult(_0x31856d,_0x325607))[_0xf752('0x45')](handleError(_0x31856d,null));}; \ No newline at end of file +var _0xb1ed=['json','apply','save','update','then','error','stack','send','index','map','JscriptySessionReport','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','includeAll','rows','catch','params','rawAttributes','create','body','find','describe','getQuestions','findOne','hasOwnProperty','nolimit','pick','JscriptyQuestionReport','include','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','status','set'];(function(_0xc52b54,_0x217e40){var _0x2864e8=function(_0x5d9e1f){while(--_0x5d9e1f){_0xc52b54['push'](_0xc52b54['shift']());}};_0x2864e8(++_0x217e40);}(_0xb1ed,0xce));var _0xdb1e=function(_0x319f60,_0x4f36b0){_0x319f60=_0x319f60-0x0;var _0x1d4491=_0xb1ed[_0x319f60];return _0x1d4491;};'use strict';var pdf=require(_0xdb1e('0x0'));var emlformat=require(_0xdb1e('0x1'));var rimraf=require(_0xdb1e('0x2'));var zipdir=require(_0xdb1e('0x3'));var jsonpatch=require(_0xdb1e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb1e('0x5'));var Mustache=require(_0xdb1e('0x6'));var util=require(_0xdb1e('0x7'));var path=require(_0xdb1e('0x8'));var sox=require(_0xdb1e('0x9'));var csv=require('to-csv');var ejs=require(_0xdb1e('0xa'));var fs=require('fs');var _=require(_0xdb1e('0xb'));var squel=require(_0xdb1e('0xc'));var crypto=require(_0xdb1e('0xd'));var jsforce=require(_0xdb1e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdb1e('0xf'));var querystring=require(_0xdb1e('0x10'));var Papa=require(_0xdb1e('0x11'));var Redis=require(_0xdb1e('0x12'));var authService=require(_0xdb1e('0x13'));var qs=require(_0xdb1e('0x14'));var as=require(_0xdb1e('0x15'));var hardwareService=require(_0xdb1e('0x16'));var logger=require(_0xdb1e('0x17'))(_0xdb1e('0x18'));var utils=require(_0xdb1e('0x19'));var config=require(_0xdb1e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29e5fa,_0x358e35){_0x358e35=_0x358e35||0xcc;return function(_0xb8c31b){if(_0xb8c31b){return _0x29e5fa[_0xdb1e('0x1b')](_0x358e35);}return _0x29e5fa['status'](_0x358e35)[_0xdb1e('0x1c')]();};}function respondWithResult(_0x438291,_0x47e5b9){_0x47e5b9=_0x47e5b9||0xc8;return function(_0x16da1d){if(_0x16da1d){return _0x438291['status'](_0x47e5b9)['json'](_0x16da1d);}};}function respondWithFilteredResult(_0x13824d,_0x4761a8){return function(_0x40cbd9){if(_0x40cbd9){var _0x4432e6=_0x40cbd9[_0xdb1e('0x1d')],_0x7ce2db=_0x4761a8[_0xdb1e('0x1e')],_0x29ef8a=_0x4761a8[_0xdb1e('0x1e')]+_0x4761a8[_0xdb1e('0x1f')],_0x544c6d;if(_0x29ef8a>=_0x4432e6){_0x29ef8a=_0x4432e6;_0x544c6d=0xc8;}else{_0x544c6d=0xce;}_0x13824d[_0xdb1e('0x20')](_0x544c6d);return _0x13824d[_0xdb1e('0x21')]('Content-Range',_0x7ce2db+'-'+_0x29ef8a+'/'+_0x4432e6)[_0xdb1e('0x22')](_0x40cbd9);}return null;};}function patchUpdates(_0x14ebff){return function(_0x421de2){try{jsonpatch[_0xdb1e('0x23')](_0x421de2,_0x14ebff,!![]);}catch(_0xd3dc54){return BPromise['reject'](_0xd3dc54);}return _0x421de2[_0xdb1e('0x24')]();};}function saveUpdates(_0x1c0b0e,_0x331e8c){return function(_0xd46b57){if(_0xd46b57){return _0xd46b57[_0xdb1e('0x25')](_0x1c0b0e)[_0xdb1e('0x26')](function(_0x2681c5){return _0x2681c5;});}return null;};}function removeEntity(_0xa14458,_0x211d57){return function(_0x597994){if(_0x597994){return _0x597994['destroy']()[_0xdb1e('0x26')](function(){_0xa14458[_0xdb1e('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27e4bd,_0x276269){return function(_0x45129a){if(!_0x45129a){_0x27e4bd[_0xdb1e('0x1b')](0x194);}return _0x45129a;};}function handleError(_0x147ceb,_0x230187){_0x230187=_0x230187||0x1f4;return function(_0x52b27e){logger[_0xdb1e('0x27')](_0x52b27e[_0xdb1e('0x28')]);if(_0x52b27e['name']){delete _0x52b27e['name'];}_0x147ceb[_0xdb1e('0x20')](_0x230187)[_0xdb1e('0x29')](_0x52b27e);};}exports[_0xdb1e('0x2a')]=function(_0x2bf9e4,_0x256bd1){var _0x105b19={},_0x4f9a28={},_0x1fb2a8={'count':0x0,'rows':[]};var _0x4226f0=_[_0xdb1e('0x2b')](db[_0xdb1e('0x2c')]['rawAttributes'],function(_0x4f16da){return{'name':_0x4f16da[_0xdb1e('0x2d')],'type':_0x4f16da[_0xdb1e('0x2e')][_0xdb1e('0x2f')]};});_0x4f9a28[_0xdb1e('0x30')]=_['map'](_0x4226f0,_0xdb1e('0x31'));_0x4f9a28['query']=_[_0xdb1e('0x32')](_0x2bf9e4[_0xdb1e('0x33')]);_0x4f9a28[_0xdb1e('0x34')]=_[_0xdb1e('0x35')](_0x4f9a28[_0xdb1e('0x30')],_0x4f9a28[_0xdb1e('0x33')]);_0x105b19[_0xdb1e('0x36')]=_[_0xdb1e('0x35')](_0x4f9a28[_0xdb1e('0x30')],qs[_0xdb1e('0x37')](_0x2bf9e4[_0xdb1e('0x33')][_0xdb1e('0x37')]));_0x105b19[_0xdb1e('0x36')]=_0x105b19[_0xdb1e('0x36')][_0xdb1e('0x38')]?_0x105b19[_0xdb1e('0x36')]:_0x4f9a28[_0xdb1e('0x30')];if(!_0x2bf9e4['query']['hasOwnProperty']('nolimit')){_0x105b19[_0xdb1e('0x1f')]=qs['limit'](_0x2bf9e4[_0xdb1e('0x33')][_0xdb1e('0x1f')]);_0x105b19[_0xdb1e('0x1e')]=qs[_0xdb1e('0x1e')](_0x2bf9e4['query']['offset']);}_0x105b19[_0xdb1e('0x39')]=qs[_0xdb1e('0x3a')](_0x2bf9e4[_0xdb1e('0x33')][_0xdb1e('0x3a')]);_0x105b19[_0xdb1e('0x3b')]=qs['filters'](_['pick'](_0x2bf9e4[_0xdb1e('0x33')],_0x4f9a28[_0xdb1e('0x34')]),_0x4226f0);if(_0x2bf9e4[_0xdb1e('0x33')]['filter']){_0x105b19['where']=_[_0xdb1e('0x3c')](_0x105b19['where'],{'$or':_[_0xdb1e('0x2b')](_0x4226f0,function(_0x3aaa2f){if(_0x3aaa2f[_0xdb1e('0x2e')]!==_0xdb1e('0x3d')){var _0x553c57={};_0x553c57[_0x3aaa2f['name']]={'$like':'%'+_0x2bf9e4[_0xdb1e('0x33')][_0xdb1e('0x3e')]+'%'};return _0x553c57;}})});}_0x105b19=_[_0xdb1e('0x3c')]({},_0x105b19,_0x2bf9e4['options']);var _0x4e031f={'where':_0x105b19['where']};return db[_0xdb1e('0x2c')][_0xdb1e('0x1d')](_0x4e031f)[_0xdb1e('0x26')](function(_0x3a2968){_0x1fb2a8[_0xdb1e('0x1d')]=_0x3a2968;if(_0x2bf9e4['query'][_0xdb1e('0x3f')]){_0x105b19['include']=[{'all':!![]}];}return db[_0xdb1e('0x2c')]['findAll'](_0x105b19);})[_0xdb1e('0x26')](function(_0x4c6164){_0x1fb2a8[_0xdb1e('0x40')]=_0x4c6164;return _0x1fb2a8;})['then'](respondWithFilteredResult(_0x256bd1,_0x105b19))[_0xdb1e('0x41')](handleError(_0x256bd1,null));};exports['show']=function(_0x5b65ec,_0x23d174){var _0xb55974={'raw':!![],'where':{'id':_0x5b65ec[_0xdb1e('0x42')]['id']}},_0x51b98e={};_0x51b98e[_0xdb1e('0x30')]=_[_0xdb1e('0x32')](db[_0xdb1e('0x2c')][_0xdb1e('0x43')]);_0x51b98e[_0xdb1e('0x33')]=_[_0xdb1e('0x32')](_0x5b65ec['query']);_0x51b98e[_0xdb1e('0x34')]=_[_0xdb1e('0x35')](_0x51b98e[_0xdb1e('0x30')],_0x51b98e[_0xdb1e('0x33')]);_0xb55974['attributes']=_[_0xdb1e('0x35')](_0x51b98e[_0xdb1e('0x30')],qs[_0xdb1e('0x37')](_0x5b65ec[_0xdb1e('0x33')]['fields']));_0xb55974[_0xdb1e('0x36')]=_0xb55974[_0xdb1e('0x36')][_0xdb1e('0x38')]?_0xb55974[_0xdb1e('0x36')]:_0x51b98e[_0xdb1e('0x30')];if(_0x5b65ec[_0xdb1e('0x33')][_0xdb1e('0x3f')]){_0xb55974['include']=[{'all':!![]}];}_0xb55974=_[_0xdb1e('0x3c')]({},_0xb55974,_0x5b65ec['options']);return db[_0xdb1e('0x2c')]['find'](_0xb55974)[_0xdb1e('0x26')](handleEntityNotFound(_0x23d174,null))[_0xdb1e('0x26')](respondWithResult(_0x23d174,null))[_0xdb1e('0x41')](handleError(_0x23d174,null));};exports[_0xdb1e('0x44')]=function(_0x385661,_0xbbdf87){return db['JscriptySessionReport'][_0xdb1e('0x44')](_0x385661['body'],{})[_0xdb1e('0x26')](respondWithResult(_0xbbdf87,0xc9))[_0xdb1e('0x41')](handleError(_0xbbdf87,null));};exports['update']=function(_0x39dcea,_0x298a07){if(_0x39dcea[_0xdb1e('0x45')]['id']){delete _0x39dcea[_0xdb1e('0x45')]['id'];}return db[_0xdb1e('0x2c')]['find']({'where':{'id':_0x39dcea[_0xdb1e('0x42')]['id']}})[_0xdb1e('0x26')](handleEntityNotFound(_0x298a07,null))[_0xdb1e('0x26')](saveUpdates(_0x39dcea[_0xdb1e('0x45')],null))[_0xdb1e('0x26')](respondWithResult(_0x298a07,null))[_0xdb1e('0x41')](handleError(_0x298a07,null));};exports['destroy']=function(_0x39b475,_0x542da9){return db[_0xdb1e('0x2c')][_0xdb1e('0x46')]({'where':{'id':_0x39b475[_0xdb1e('0x42')]['id']}})['then'](handleEntityNotFound(_0x542da9,null))[_0xdb1e('0x26')](removeEntity(_0x542da9,null))[_0xdb1e('0x41')](handleError(_0x542da9,null));};exports[_0xdb1e('0x47')]=function(_0x44aacf,_0x4d12cd){return db[_0xdb1e('0x2c')]['describe']()[_0xdb1e('0x26')](respondWithResult(_0x4d12cd,null))[_0xdb1e('0x41')](handleError(_0x4d12cd,null));};exports[_0xdb1e('0x48')]=function(_0x49fd34,_0x3c9880,_0x2e4083){var _0x3fa1e4={'raw':!![],'where':{}};var _0x1636cb={};var _0x30f228={'count':0x0,'rows':[]};return db[_0xdb1e('0x2c')][_0xdb1e('0x49')]({'where':{'id':_0x49fd34[_0xdb1e('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c9880,null))[_0xdb1e('0x26')](function(_0x18ae58){if(_0x18ae58){_0x1636cb[_0xdb1e('0x30')]=_[_0xdb1e('0x32')](db['JscriptyQuestionReport'][_0xdb1e('0x43')]);_0x1636cb[_0xdb1e('0x33')]=_[_0xdb1e('0x32')](_0x49fd34[_0xdb1e('0x33')]);_0x1636cb['filters']=_[_0xdb1e('0x35')](_0x1636cb['model'],_0x1636cb[_0xdb1e('0x33')]);_0x3fa1e4[_0xdb1e('0x36')]=_[_0xdb1e('0x35')](_0x1636cb[_0xdb1e('0x30')],qs[_0xdb1e('0x37')](_0x49fd34[_0xdb1e('0x33')][_0xdb1e('0x37')]));_0x3fa1e4[_0xdb1e('0x36')]=_0x3fa1e4['attributes'][_0xdb1e('0x38')]?_0x3fa1e4[_0xdb1e('0x36')]:_0x1636cb[_0xdb1e('0x30')];if(!_0x49fd34[_0xdb1e('0x33')][_0xdb1e('0x4a')](_0xdb1e('0x4b'))){_0x3fa1e4['limit']=qs['limit'](_0x49fd34[_0xdb1e('0x33')][_0xdb1e('0x1f')]);_0x3fa1e4[_0xdb1e('0x1e')]=qs[_0xdb1e('0x1e')](_0x49fd34[_0xdb1e('0x33')][_0xdb1e('0x1e')]);}_0x3fa1e4['order']=qs[_0xdb1e('0x3a')](_0x49fd34[_0xdb1e('0x33')][_0xdb1e('0x3a')]);_0x3fa1e4[_0xdb1e('0x3b')]=qs['filters'](_[_0xdb1e('0x4c')](_0x49fd34[_0xdb1e('0x33')],_0x1636cb[_0xdb1e('0x34')]));_0x3fa1e4[_0xdb1e('0x3b')]['SessionId']=_0x18ae58['id'];if(_0x49fd34[_0xdb1e('0x33')][_0xdb1e('0x3e')]){_0x3fa1e4[_0xdb1e('0x3b')]=_[_0xdb1e('0x3c')](_0x3fa1e4[_0xdb1e('0x3b')],{'$or':_[_0xdb1e('0x2b')](_0x3fa1e4[_0xdb1e('0x36')],function(_0x1eb424){var _0x1210a6={};_0x1210a6[_0x1eb424]={'$like':'%'+_0x49fd34[_0xdb1e('0x33')][_0xdb1e('0x3e')]+'%'};return _0x1210a6;})});}_0x3fa1e4=_[_0xdb1e('0x3c')]({},_0x3fa1e4,_0x49fd34['options']);return db[_0xdb1e('0x4d')][_0xdb1e('0x1d')]({'where':_0x3fa1e4[_0xdb1e('0x3b')]})['then'](function(_0x3834e0){_0x30f228[_0xdb1e('0x1d')]=_0x3834e0;if(_0x49fd34[_0xdb1e('0x33')][_0xdb1e('0x3f')]){_0x3fa1e4[_0xdb1e('0x4e')]=[{'all':!![]}];}return db[_0xdb1e('0x4d')][_0xdb1e('0x4f')](_0x3fa1e4);})['then'](function(_0x434958){_0x30f228[_0xdb1e('0x40')]=_0x434958;return _0x30f228;});}})[_0xdb1e('0x26')](respondWithFilteredResult(_0x3c9880,_0x3fa1e4))[_0xdb1e('0x41')](handleError(_0x3c9880,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a6f6afa..9f02564 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 _0xcb22=['./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x336d54,_0x4cb876){var _0x571a8d=function(_0x3746f6){while(--_0x3746f6){_0x336d54['push'](_0x336d54['shift']());}};_0x571a8d(++_0x4cb876);}(_0xcb22,0xc8));var _0x2cb2=function(_0x232497,_0x1b15a3){_0x232497=_0x232497-0x0;var _0x27e7a8=_0xcb22[_0x232497];return _0x27e7a8;};'use strict';var _=require(_0x2cb2('0x0'));var util=require(_0x2cb2('0x1'));var logger=require(_0x2cb2('0x2'))(_0x2cb2('0x3'));var moment=require(_0x2cb2('0x4'));var BPromise=require(_0x2cb2('0x5'));var rp=require(_0x2cb2('0x6'));var fs=require('fs');var path=require(_0x2cb2('0x7'));var rimraf=require(_0x2cb2('0x8'));var config=require(_0x2cb2('0x9'));var attributes=require(_0x2cb2('0xa'));module['exports']=function(_0x77ae56,_0x3582d7){return _0x77ae56[_0x2cb2('0xb')](_0x2cb2('0xc'),attributes,{'tableName':_0x2cb2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport'];(function(_0x7cc8f7,_0xa90d24){var _0x1ecf25=function(_0x336b0c){while(--_0x336b0c){_0x7cc8f7['push'](_0x7cc8f7['shift']());}};_0x1ecf25(++_0xa90d24);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 0a5b754..54c2482 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 _0xccda=['../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3289fe,_0x30c98a){var _0x27e5bd=function(_0x299ff5){while(--_0x299ff5){_0x3289fe['push'](_0x3289fe['shift']());}};_0x27e5bd(++_0x30c98a);}(_0xccda,0x14f));var _0xaccd=function(_0xfc2644,_0x4a3b13){_0xfc2644=_0xfc2644-0x0;var _0x4873b7=_0xccda[_0xfc2644];return _0x4873b7;};'use strict';var _=require(_0xaccd('0x0'));var util=require('util');var moment=require(_0xaccd('0x1'));var BPromise=require(_0xaccd('0x2'));var rs=require(_0xaccd('0x3'));var fs=require('fs');var Redis=require(_0xaccd('0x4'));var db=require(_0xaccd('0x5'))['db'];var utils=require(_0xaccd('0x6'));var logger=require('../../config/logger')(_0xaccd('0x7'));var config=require('../../config/environment');var jayson=require(_0xaccd('0x8'));var client=jayson['client'][_0xaccd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ff2ff,_0x4ee70,_0xa116de){return new BPromise(function(_0x5c0ec5,_0x3f6fd4){return client['request'](_0x4ff2ff,_0xa116de)[_0xaccd('0xa')](function(_0x1f205d){logger[_0xaccd('0xb')](_0xaccd('0xc'),_0x4ee70,_0xaccd('0xd'));logger[_0xaccd('0xe')](_0xaccd('0xf'),_0x4ee70,'request\x20sent',JSON[_0xaccd('0x10')](_0x1f205d));if(_0x1f205d[_0xaccd('0x11')]){if(_0x1f205d[_0xaccd('0x11')]['code']===0x1f4){logger[_0xaccd('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4ee70,_0x1f205d[_0xaccd('0x11')][_0xaccd('0x12')]);return _0x3f6fd4(_0x1f205d['error'][_0xaccd('0x12')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4ee70,_0x1f205d['error'][_0xaccd('0x12')]);return _0x5c0ec5(_0x1f205d[_0xaccd('0x11')][_0xaccd('0x12')]);}else{logger[_0xaccd('0xb')](_0xaccd('0xc'),_0x4ee70,'request\x20sent');_0x5c0ec5(_0x1f205d[_0xaccd('0x13')][_0xaccd('0x12')]);}})['catch'](function(_0x4de380){logger[_0xaccd('0x11')](_0xaccd('0xc'),_0x4ee70,_0x4de380);_0x3f6fd4(_0x4de380);});});} \ No newline at end of file +var _0xa666=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','JscriptySessionReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa666,0x6c));var _0x6a66=function(_0x1aa2b0,_0x1114da){_0x1aa2b0=_0x1aa2b0-0x0;var _0x2e34ba=_0xa666[_0x1aa2b0];return _0x2e34ba;};'use strict';var _=require(_0x6a66('0x0'));var util=require(_0x6a66('0x1'));var moment=require(_0x6a66('0x2'));var BPromise=require(_0x6a66('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a66('0x4'));var db=require(_0x6a66('0x5'))['db'];var utils=require(_0x6a66('0x6'));var logger=require('../../config/logger')(_0x6a66('0x7'));var config=require(_0x6a66('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a66('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ebb8c,_0x2a78c1,_0x4b957d){return new BPromise(function(_0x39e1b7,_0x1f678a){return client['request'](_0x2ebb8c,_0x4b957d)['then'](function(_0x4e4069){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2a78c1,_0x6a66('0xa'));logger['debug'](_0x6a66('0xb'),_0x2a78c1,'request\x20sent',JSON['stringify'](_0x4e4069));if(_0x4e4069['error']){if(_0x4e4069['error']['code']===0x1f4){logger[_0x6a66('0xc')](_0x6a66('0xd'),_0x2a78c1,_0x4e4069[_0x6a66('0xc')][_0x6a66('0xe')]);return _0x1f678a(_0x4e4069[_0x6a66('0xc')][_0x6a66('0xe')]);}logger[_0x6a66('0xc')](_0x6a66('0xd'),_0x2a78c1,_0x4e4069[_0x6a66('0xc')]['message']);return _0x39e1b7(_0x4e4069[_0x6a66('0xc')]['message']);}else{logger[_0x6a66('0xf')](_0x6a66('0xd'),_0x2a78c1,'request\x20sent');_0x39e1b7(_0x4e4069[_0x6a66('0x10')][_0x6a66('0xe')]);}})[_0x6a66('0x11')](function(_0x3f7abc){logger['error'](_0x6a66('0xd'),_0x2a78c1,_0x3f7abc);_0x1f678a(_0x3f7abc);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b67ebde..6d809ff 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 _0x5c41=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id','isAuthenticated','update','exports'];(function(_0xdd7a7b,_0x254b3a){var _0x40ca7d=function(_0x4c2744){while(--_0x4c2744){_0xdd7a7b['push'](_0xdd7a7b['shift']());}};_0x40ca7d(++_0x254b3a);}(_0x5c41,0x1ce));var _0x15c4=function(_0x6e822b,_0x287586){_0x6e822b=_0x6e822b-0x0;var _0xf74bd8=_0x5c41[_0x6e822b];return _0xf74bd8;};'use strict';var multer=require('multer');var util=require(_0x15c4('0x0'));var path=require('path');var timeout=require(_0x15c4('0x1'));var express=require(_0x15c4('0x2'));var router=express[_0x15c4('0x3')]();var auth=require(_0x15c4('0x4'));var interaction=require(_0x15c4('0x5'));var config=require('../../config/environment');var controller=require(_0x15c4('0x6'));router[_0x15c4('0x7')]('/',controller[_0x15c4('0x8')]);router[_0x15c4('0x9')](_0x15c4('0xa'),auth[_0x15c4('0xb')](),controller[_0x15c4('0xc')]);module[_0x15c4('0xd')]=router; \ No newline at end of file +var _0x8f10=['Router','../../components/auth/service','./license.controller','get','index','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express'];(function(_0x2382b7,_0x271ef2){var _0x4ea157=function(_0x13209c){while(--_0x13209c){_0x2382b7['push'](_0x2382b7['shift']());}};_0x4ea157(++_0x271ef2);}(_0x8f10,0x6b));var _0x08f1=function(_0x23b8c7,_0x4da4cd){_0x23b8c7=_0x23b8c7-0x0;var _0x521897=_0x8f10[_0x23b8c7];return _0x521897;};'use strict';var multer=require(_0x08f1('0x0'));var util=require(_0x08f1('0x1'));var path=require(_0x08f1('0x2'));var timeout=require(_0x08f1('0x3'));var express=require(_0x08f1('0x4'));var router=express[_0x08f1('0x5')]();var auth=require(_0x08f1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x08f1('0x7'));router[_0x08f1('0x8')]('/',controller[_0x08f1('0x9')]);router['put'](_0x08f1('0xa'),auth[_0x08f1('0xb')](),controller[_0x08f1('0xc')]);module[_0x08f1('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a6e7fc0..a1c20fa 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 _0xf494=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x24c2ac,_0x1d3748){var _0x4db65f=function(_0x1bb4cb){while(--_0x1bb4cb){_0x24c2ac['push'](_0x24c2ac['shift']());}};_0x4db65f(++_0x1d3748);}(_0xf494,0x1c6));var _0x4f49=function(_0x27fa52,_0x347642){_0x27fa52=_0x27fa52-0x0;var _0x332b19=_0xf494[_0x27fa52];return _0x332b19;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'license':{'type':Sequelize[_0x4f49('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x4f49('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x4f49('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fab=['exports','STRING','INTEGER','sequelize'];(function(_0xefa0ef,_0x4d4621){var _0x4adcb7=function(_0xe2eba2){while(--_0xe2eba2){_0xefa0ef['push'](_0xefa0ef['shift']());}};_0x4adcb7(++_0x4d4621);}(_0x5fab,0x177));var _0xb5fa=function(_0x5a89ea,_0x436388){_0x5a89ea=_0x5a89ea-0x0;var _0x21193d=_0x5fab[_0x5a89ea];return _0x21193d;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xb5fa('0x2')]},'data2':{'type':Sequelize[_0xb5fa('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xb5fa('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 5eacfae..e7744c0 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 _0x2cd4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','error','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','length','merge','options','getLicense','then','catch','body','find','params','get','key','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x41f475,_0x1fcf9a){var _0x4bc0bf=function(_0x53d8c5){while(--_0x53d8c5){_0x41f475['push'](_0x41f475['shift']());}};_0x4bc0bf(++_0x1fcf9a);}(_0x2cd4,0x159));var _0x42cd=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0x2cd4[_0x547add];return _0x2ed1f3;};'use strict';var pdf=require(_0x42cd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x42cd('0x1'));var zipdir=require(_0x42cd('0x2'));var jsonpatch=require(_0x42cd('0x3'));var rp=require(_0x42cd('0x4'));var moment=require('moment');var BPromise=require(_0x42cd('0x5'));var Mustache=require(_0x42cd('0x6'));var util=require(_0x42cd('0x7'));var path=require(_0x42cd('0x8'));var sox=require('sox');var csv=require(_0x42cd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x42cd('0xa'));var jsforce=require(_0x42cd('0xb'));var deskjs=require(_0x42cd('0xc'));var toCsv=require(_0x42cd('0x9'));var querystring=require(_0x42cd('0xd'));var Papa=require(_0x42cd('0xe'));var Redis=require(_0x42cd('0xf'));var authService=require(_0x42cd('0x10'));var qs=require(_0x42cd('0x11'));var as=require(_0x42cd('0x12'));var hardwareService=require(_0x42cd('0x13'));var logger=require(_0x42cd('0x14'))(_0x42cd('0x15'));var utils=require(_0x42cd('0x16'));var config=require('../../config/environment');var db=require(_0x42cd('0x17'))['db'];function respondWithStatusCode(_0x442879,_0x380c73){_0x380c73=_0x380c73||0xcc;return function(_0x1d39e5){if(_0x1d39e5){return _0x442879[_0x42cd('0x18')](_0x380c73);}return _0x442879[_0x42cd('0x19')](_0x380c73)[_0x42cd('0x1a')]();};}function respondWithResult(_0x520df5,_0x50797b){_0x50797b=_0x50797b||0xc8;return function(_0x239111){if(_0x239111){return _0x520df5[_0x42cd('0x19')](_0x50797b)[_0x42cd('0x1b')](_0x239111);}};}function respondWithFilteredResult(_0x1414ab,_0x1e45a6){return function(_0x30b630){if(_0x30b630){var _0xed6b3a=_0x30b630['count'],_0x200c36=_0x1e45a6[_0x42cd('0x1c')],_0x3f721a=_0x1e45a6['offset']+_0x1e45a6[_0x42cd('0x1d')],_0x4ec3c7;if(_0x3f721a>=_0xed6b3a){_0x3f721a=_0xed6b3a;_0x4ec3c7=0xc8;}else{_0x4ec3c7=0xce;}_0x1414ab[_0x42cd('0x19')](_0x4ec3c7);return _0x1414ab[_0x42cd('0x1e')](_0x42cd('0x1f'),_0x200c36+'-'+_0x3f721a+'/'+_0xed6b3a)['json'](_0x30b630);}return null;};}function patchUpdates(_0x233bd6){return function(_0x4e5c3f){try{jsonpatch[_0x42cd('0x20')](_0x4e5c3f,_0x233bd6,!![]);}catch(_0x4ea885){return BPromise[_0x42cd('0x21')](_0x4ea885);}return _0x4e5c3f[_0x42cd('0x22')]();};}function saveUpdates(_0x363c8d,_0x8726ce){return function(_0x21cb2f){if(_0x21cb2f){return _0x21cb2f['update'](_0x363c8d)['then'](function(_0x3a640e){return _0x3a640e;});}return null;};}function removeEntity(_0x1ecf6a,_0x31688e){return function(_0x4d5556){if(_0x4d5556){return _0x4d5556['destroy']()['then'](function(){_0x1ecf6a['status'](0xcc)[_0x42cd('0x1a')]();});}};}function handleEntityNotFound(_0x233a72,_0x56b688){return function(_0x5ef0ea){if(!_0x5ef0ea){_0x233a72['sendStatus'](0x194);}return _0x5ef0ea;};}function handleError(_0x12a284,_0x2ac2a6){_0x2ac2a6=_0x2ac2a6||0x1f4;return function(_0x2d3999){logger[_0x42cd('0x23')](_0x2d3999[_0x42cd('0x24')]);if(_0x2d3999[_0x42cd('0x25')]){delete _0x2d3999[_0x42cd('0x25')];}_0x12a284[_0x42cd('0x19')](_0x2ac2a6)[_0x42cd('0x26')](_0x2d3999);};}var utilLicense=require(_0x42cd('0x27'));exports[_0x42cd('0x28')]=function(_0x509aa3,_0x5cf2f8){var _0x45d9fa={'raw':!![],'where':{'id':0x1}},_0xd30faf={};_0xd30faf[_0x42cd('0x29')]=_[_0x42cd('0x2a')](db[_0x42cd('0x2b')][_0x42cd('0x2c')]);_0xd30faf['query']=_[_0x42cd('0x2a')](_0x509aa3[_0x42cd('0x2d')]);_0xd30faf[_0x42cd('0x2e')]=_[_0x42cd('0x2f')](_0xd30faf[_0x42cd('0x29')],_0xd30faf[_0x42cd('0x2d')]);_0x45d9fa[_0x42cd('0x30')]=_[_0x42cd('0x2f')](_0xd30faf[_0x42cd('0x29')],qs['fields'](_0x509aa3[_0x42cd('0x2d')]['fields']));_0x45d9fa['attributes']=_0x45d9fa[_0x42cd('0x30')][_0x42cd('0x31')]?_0x45d9fa[_0x42cd('0x30')]:_0xd30faf[_0x42cd('0x29')];_0x45d9fa=_[_0x42cd('0x32')]({},_0x45d9fa,_0x509aa3[_0x42cd('0x33')]);return utilLicense[_0x42cd('0x34')](_0x45d9fa)[_0x42cd('0x35')](respondWithResult(_0x5cf2f8,null))[_0x42cd('0x36')](handleError(_0x5cf2f8,null));};exports['update']=function(_0xc78dc6,_0x31b3e0){if(_0xc78dc6[_0x42cd('0x37')]['id']){delete _0xc78dc6[_0x42cd('0x37')]['id'];}return db['License'][_0x42cd('0x38')]({'where':{'id':_0xc78dc6[_0x42cd('0x39')]['id']}})[_0x42cd('0x35')](handleEntityNotFound(_0x31b3e0,null))[_0x42cd('0x35')](function(_0x3f1bd7){var _0x580c17=_0x3f1bd7[_0x42cd('0x3a')]({'plain':!![]});return utilLicense['checkLicense'](_0x580c17,_0xc78dc6['body'][_0x42cd('0x3b')]);})[_0x42cd('0x35')](function(_0x54c3db){if(!_0x54c3db['demo']){return saveUpdates(_0xc78dc6[_0x42cd('0x37')],null);}return _0x54c3db;})[_0x42cd('0x35')](respondWithResult(_0x31b3e0,null))[_0x42cd('0x36')](handleError(_0x31b3e0,null));}; \ No newline at end of file +var _0xf9fd=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','model','License','rawAttributes','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto'];(function(_0x16325c,_0x5a5e78){var _0x4daabc=function(_0x4b341){while(--_0x4b341){_0x16325c['push'](_0x16325c['shift']());}};_0x4daabc(++_0x5a5e78);}(_0xf9fd,0x18a));var _0xdf9f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9fd[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xdf9f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf9f('0x1'));var jsonpatch=require(_0xdf9f('0x2'));var rp=require('request-promise');var moment=require(_0xdf9f('0x3'));var BPromise=require(_0xdf9f('0x4'));var Mustache=require(_0xdf9f('0x5'));var util=require(_0xdf9f('0x6'));var path=require(_0xdf9f('0x7'));var sox=require(_0xdf9f('0x8'));var csv=require(_0xdf9f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdf9f('0xa'));var squel=require('squel');var crypto=require(_0xdf9f('0xb'));var jsforce=require(_0xdf9f('0xc'));var deskjs=require(_0xdf9f('0xd'));var toCsv=require(_0xdf9f('0x9'));var querystring=require(_0xdf9f('0xe'));var Papa=require('papaparse');var Redis=require(_0xdf9f('0xf'));var authService=require(_0xdf9f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdf9f('0x11'));var hardwareService=require(_0xdf9f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xdf9f('0x13'));var config=require(_0xdf9f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c57f4,_0x41c73f){_0x41c73f=_0x41c73f||0xcc;return function(_0x2c6d7a){if(_0x2c6d7a){return _0x3c57f4[_0xdf9f('0x15')](_0x41c73f);}return _0x3c57f4['status'](_0x41c73f)[_0xdf9f('0x16')]();};}function respondWithResult(_0x3f246c,_0x45e023){_0x45e023=_0x45e023||0xc8;return function(_0x2d8b77){if(_0x2d8b77){return _0x3f246c[_0xdf9f('0x17')](_0x45e023)[_0xdf9f('0x18')](_0x2d8b77);}};}function respondWithFilteredResult(_0x26010f,_0xe13578){return function(_0x4962d0){if(_0x4962d0){var _0x11aea3=_0x4962d0[_0xdf9f('0x19')],_0x1382b0=_0xe13578[_0xdf9f('0x1a')],_0x5e3648=_0xe13578[_0xdf9f('0x1a')]+_0xe13578[_0xdf9f('0x1b')],_0x2bb0fd;if(_0x5e3648>=_0x11aea3){_0x5e3648=_0x11aea3;_0x2bb0fd=0xc8;}else{_0x2bb0fd=0xce;}_0x26010f[_0xdf9f('0x17')](_0x2bb0fd);return _0x26010f[_0xdf9f('0x1c')](_0xdf9f('0x1d'),_0x1382b0+'-'+_0x5e3648+'/'+_0x11aea3)[_0xdf9f('0x18')](_0x4962d0);}return null;};}function patchUpdates(_0x41954f){return function(_0x1aa284){try{jsonpatch[_0xdf9f('0x1e')](_0x1aa284,_0x41954f,!![]);}catch(_0x34f924){return BPromise[_0xdf9f('0x1f')](_0x34f924);}return _0x1aa284[_0xdf9f('0x20')]();};}function saveUpdates(_0x55b663,_0x8a406f){return function(_0x4f992c){if(_0x4f992c){return _0x4f992c[_0xdf9f('0x21')](_0x55b663)[_0xdf9f('0x22')](function(_0x1dd87b){return _0x1dd87b;});}return null;};}function removeEntity(_0x55799e,_0x1ce5ff){return function(_0x43630e){if(_0x43630e){return _0x43630e[_0xdf9f('0x23')]()[_0xdf9f('0x22')](function(){_0x55799e[_0xdf9f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x332df1,_0x281a78){return function(_0x2a22ce){if(!_0x2a22ce){_0x332df1[_0xdf9f('0x15')](0x194);}return _0x2a22ce;};}function handleError(_0x512b8d,_0x3ae43a){_0x3ae43a=_0x3ae43a||0x1f4;return function(_0x4a7998){logger[_0xdf9f('0x24')](_0x4a7998[_0xdf9f('0x25')]);if(_0x4a7998['name']){delete _0x4a7998['name'];}_0x512b8d['status'](_0x3ae43a)[_0xdf9f('0x26')](_0x4a7998);};}var utilLicense=require('../../config/license/util');exports[_0xdf9f('0x27')]=function(_0x2e7762,_0x144b74){var _0xcfb22f={'raw':!![],'where':{'id':0x1}},_0xcd4aa1={};_0xcd4aa1[_0xdf9f('0x28')]=_['keys'](db[_0xdf9f('0x29')][_0xdf9f('0x2a')]);_0xcd4aa1[_0xdf9f('0x2b')]=_['keys'](_0x2e7762[_0xdf9f('0x2b')]);_0xcd4aa1['filters']=_[_0xdf9f('0x2c')](_0xcd4aa1[_0xdf9f('0x28')],_0xcd4aa1[_0xdf9f('0x2b')]);_0xcfb22f[_0xdf9f('0x2d')]=_['intersection'](_0xcd4aa1[_0xdf9f('0x28')],qs[_0xdf9f('0x2e')](_0x2e7762[_0xdf9f('0x2b')]['fields']));_0xcfb22f['attributes']=_0xcfb22f[_0xdf9f('0x2d')][_0xdf9f('0x2f')]?_0xcfb22f[_0xdf9f('0x2d')]:_0xcd4aa1[_0xdf9f('0x28')];_0xcfb22f=_[_0xdf9f('0x30')]({},_0xcfb22f,_0x2e7762[_0xdf9f('0x31')]);return utilLicense[_0xdf9f('0x32')](_0xcfb22f)['then'](respondWithResult(_0x144b74,null))[_0xdf9f('0x33')](handleError(_0x144b74,null));};exports[_0xdf9f('0x21')]=function(_0x20cc83,_0x15ea17){if(_0x20cc83[_0xdf9f('0x34')]['id']){delete _0x20cc83[_0xdf9f('0x34')]['id'];}return db['License'][_0xdf9f('0x35')]({'where':{'id':_0x20cc83[_0xdf9f('0x36')]['id']}})['then'](handleEntityNotFound(_0x15ea17,null))['then'](function(_0x15e216){var _0x1c62e3=_0x15e216[_0xdf9f('0x37')]({'plain':!![]});return utilLicense[_0xdf9f('0x38')](_0x1c62e3,_0x20cc83['body'][_0xdf9f('0x39')]);})['then'](function(_0x25e4b9){if(!_0x25e4b9['demo']){return saveUpdates(_0x20cc83[_0xdf9f('0x34')],null);}return _0x25e4b9;})['then'](respondWithResult(_0x15ea17,null))[_0xdf9f('0x33')](handleError(_0x15ea17,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 0108152..80c80bd 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(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0xb10b,0x12a));var _0xbb10=function(_0x5515a7,_0x2c4af1){_0x5515a7=_0x5515a7-0x0;var _0x43f4bf=_0xb10b[_0x5515a7];return _0x43f4bf;};'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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x309385,_0x3ab38f){var _0x45b0f5=function(_0x4fa7e0){while(--_0x4fa7e0){_0x309385['push'](_0x309385['shift']());}};_0x45b0f5(++_0x3ab38f);}(_0xb10b,0x12a));var _0xbb10=function(_0x298510,_0x21b06b){_0x298510=_0x298510-0x0;var _0x51f279=_0xb10b[_0x298510];return _0x51f279;};'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 diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 876809f..2e67c44 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 _0x4a1d=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x4c5d3a,_0x42ae15){var _0x3f5227=function(_0x31d9a1){while(--_0x31d9a1){_0x4c5d3a['push'](_0x4c5d3a['shift']());}};_0x3f5227(++_0x42ae15);}(_0x4a1d,0x77));var _0xd4a1=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4a1d[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xd4a1('0x0'));var util=require(_0xd4a1('0x1'));var moment=require(_0xd4a1('0x2'));var BPromise=require(_0xd4a1('0x3'));var rs=require(_0xd4a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4a1('0x5'))['db'];var utils=require(_0xd4a1('0x6'));var logger=require(_0xd4a1('0x7'))(_0xd4a1('0x8'));var config=require(_0xd4a1('0x9'));var jayson=require(_0xd4a1('0xa'));var client=jayson[_0xd4a1('0xb')][_0xd4a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cfa45,_0x3140b8,_0x1c2e6f){return new BPromise(function(_0x2b91a6,_0x3a9ecc){return client[_0xd4a1('0xd')](_0x5cfa45,_0x1c2e6f)['then'](function(_0x503a27){logger[_0xd4a1('0xe')](_0xd4a1('0xf'),_0x3140b8,_0xd4a1('0x10'));logger[_0xd4a1('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x3140b8,_0xd4a1('0x10'),JSON[_0xd4a1('0x12')](_0x503a27));if(_0x503a27[_0xd4a1('0x13')]){if(_0x503a27['error'][_0xd4a1('0x14')]===0x1f4){logger[_0xd4a1('0x13')](_0xd4a1('0xf'),_0x3140b8,_0x503a27[_0xd4a1('0x13')]['message']);return _0x3a9ecc(_0x503a27[_0xd4a1('0x13')][_0xd4a1('0x15')]);}logger[_0xd4a1('0x13')]('License,\x20%s,\x20%s',_0x3140b8,_0x503a27[_0xd4a1('0x13')][_0xd4a1('0x15')]);return _0x2b91a6(_0x503a27[_0xd4a1('0x13')][_0xd4a1('0x15')]);}else{logger['info']('License,\x20%s,\x20%s',_0x3140b8,_0xd4a1('0x10'));_0x2b91a6(_0x503a27[_0xd4a1('0x16')][_0xd4a1('0x15')]);}})[_0xd4a1('0x17')](function(_0x212d0c){logger['error'](_0xd4a1('0xf'),_0x3140b8,_0x212d0c);_0x3a9ecc(_0x212d0c);});});} \ No newline at end of file +var _0x4a3c=['info','License,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4a4751,_0x2b4e4e){var _0x30db8e=function(_0x6443b){while(--_0x6443b){_0x4a4751['push'](_0x4a4751['shift']());}};_0x30db8e(++_0x2b4e4e);}(_0x4a3c,0x13c));var _0xc4a3=function(_0x46adf1,_0x1288f9){_0x46adf1=_0x46adf1-0x0;var _0x322ee2=_0x4a3c[_0x46adf1];return _0x322ee2;};'use strict';var _=require(_0xc4a3('0x0'));var util=require('util');var moment=require(_0xc4a3('0x1'));var BPromise=require(_0xc4a3('0x2'));var rs=require(_0xc4a3('0x3'));var fs=require('fs');var Redis=require(_0xc4a3('0x4'));var db=require(_0xc4a3('0x5'))['db'];var utils=require(_0xc4a3('0x6'));var logger=require(_0xc4a3('0x7'))('rpc');var config=require(_0xc4a3('0x8'));var jayson=require(_0xc4a3('0x9'));var client=jayson[_0xc4a3('0xa')][_0xc4a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1c84,_0x49fa26,_0x596b01){return new BPromise(function(_0xc11c29,_0x58bdcd){return client[_0xc4a3('0xc')](_0x4b1c84,_0x596b01)[_0xc4a3('0xd')](function(_0x1e7f27){logger[_0xc4a3('0xe')](_0xc4a3('0xf'),_0x49fa26,_0xc4a3('0x10'));logger[_0xc4a3('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x49fa26,'request\x20sent',JSON['stringify'](_0x1e7f27));if(_0x1e7f27['error']){if(_0x1e7f27['error']['code']===0x1f4){logger['error'](_0xc4a3('0xf'),_0x49fa26,_0x1e7f27[_0xc4a3('0x12')][_0xc4a3('0x13')]);return _0x58bdcd(_0x1e7f27[_0xc4a3('0x12')]['message']);}logger[_0xc4a3('0x12')](_0xc4a3('0xf'),_0x49fa26,_0x1e7f27['error'][_0xc4a3('0x13')]);return _0xc11c29(_0x1e7f27[_0xc4a3('0x12')][_0xc4a3('0x13')]);}else{logger[_0xc4a3('0xe')](_0xc4a3('0xf'),_0x49fa26,_0xc4a3('0x10'));_0xc11c29(_0x1e7f27[_0xc4a3('0x14')][_0xc4a3('0x13')]);}})[_0xc4a3('0x15')](function(_0x584b6d){logger[_0xc4a3('0x12')](_0xc4a3('0xf'),_0x49fa26,_0x584b6d);_0x58bdcd(_0x584b6d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ac3676c..3a8c52d 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 _0x38f8=['removeDispositions','delete','removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','put','update'];(function(_0x2c499e,_0x27795d){var _0x32ff6c=function(_0x4459b0){while(--_0x4459b0){_0x2c499e['push'](_0x2c499e['shift']());}};_0x32ff6c(++_0x27795d);}(_0x38f8,0x197));var _0x838f=function(_0x2e1ccf,_0x132102){_0x2e1ccf=_0x2e1ccf-0x0;var _0x3befc6=_0x38f8[_0x2e1ccf];return _0x3befc6;};'use strict';var multer=require(_0x838f('0x0'));var util=require(_0x838f('0x1'));var path=require(_0x838f('0x2'));var timeout=require(_0x838f('0x3'));var express=require(_0x838f('0x4'));var router=express[_0x838f('0x5')]();var auth=require(_0x838f('0x6'));var interaction=require(_0x838f('0x7'));var config=require(_0x838f('0x8'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x838f('0x9')](),controller[_0x838f('0xa')]);router['get'](_0x838f('0xb'),auth[_0x838f('0x9')](),controller[_0x838f('0xc')]);router[_0x838f('0xd')](_0x838f('0xe'),auth[_0x838f('0x9')](),controller[_0x838f('0xf')]);router[_0x838f('0xd')](_0x838f('0x10'),auth['isAuthenticated'](),controller[_0x838f('0x11')]);router[_0x838f('0xd')]('/:id/canned_answers',auth[_0x838f('0x9')](),controller[_0x838f('0x12')]);router['get'](_0x838f('0x13'),auth[_0x838f('0x9')](),controller[_0x838f('0x14')]);router['get'](_0x838f('0x15'),auth[_0x838f('0x9')](),controller['getSmtp']);router[_0x838f('0xd')]('/:id/interactions',auth[_0x838f('0x9')](),controller[_0x838f('0x16')]);router[_0x838f('0xd')](_0x838f('0x17'),auth[_0x838f('0x9')](),controller[_0x838f('0x18')]);router[_0x838f('0xd')](_0x838f('0x19'),auth[_0x838f('0x9')](),controller[_0x838f('0x1a')]);router[_0x838f('0xd')](_0x838f('0x1b'),auth[_0x838f('0x9')](),controller[_0x838f('0x1c')]);router[_0x838f('0xd')](_0x838f('0x1d'),auth[_0x838f('0x9')](),controller[_0x838f('0x1e')]);router[_0x838f('0x1f')](_0x838f('0x10'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x838f('0x1f')]('/:id/canned_answers',auth[_0x838f('0x9')](),controller[_0x838f('0x20')]);router[_0x838f('0x1f')]('/',auth[_0x838f('0x9')](),controller[_0x838f('0x21')]);router[_0x838f('0x1f')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x838f('0x22')]);router[_0x838f('0x1f')]('/:id/out_servers',auth[_0x838f('0x9')](),controller[_0x838f('0x23')]);router[_0x838f('0x1f')](_0x838f('0x24'),auth[_0x838f('0x9')](),controller[_0x838f('0x25')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x838f('0x26')]);router[_0x838f('0x1f')](_0x838f('0x27'),auth['isAuthenticated'](),controller[_0x838f('0x28')]);router[_0x838f('0x1f')](_0x838f('0x1d'),auth[_0x838f('0x9')](),controller['addAgents']);router[_0x838f('0x29')]('/:id',auth[_0x838f('0x9')](),controller[_0x838f('0x2a')]);router['delete'](_0x838f('0x10'),auth[_0x838f('0x9')](),controller[_0x838f('0x2b')]);router[_0x838f('0x2c')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x838f('0x2d')]);router[_0x838f('0x2c')](_0x838f('0x13'),auth['isAuthenticated'](),controller[_0x838f('0x2e')]);router[_0x838f('0x2c')]('/:id/out_servers',auth[_0x838f('0x9')](),controller['removeSmtp']);router[_0x838f('0x2c')](_0x838f('0xe'),auth[_0x838f('0x9')](),controller[_0x838f('0x2f')]);router[_0x838f('0x2c')](_0x838f('0x1d'),auth[_0x838f('0x9')](),controller[_0x838f('0x30')]);module[_0x838f('0x31')]=router; \ No newline at end of file +var _0xbea3=['addInteraction','addApplications','/:id/send','/:id/users','addAgents','update','delete','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','create','addSmtp'];(function(_0x124096,_0xbb4341){var _0x123aed=function(_0x4db081){while(--_0x4db081){_0x124096['push'](_0x124096['shift']());}};_0x123aed(++_0xbb4341);}(_0xbea3,0x163));var _0x3bea=function(_0x4fc643,_0x952539){_0x4fc643=_0x4fc643-0x0;var _0x36373b=_0xbea3[_0x4fc643];return _0x36373b;};'use strict';var multer=require(_0x3bea('0x0'));var util=require(_0x3bea('0x1'));var path=require('path');var timeout=require(_0x3bea('0x2'));var express=require('express');var router=express[_0x3bea('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3bea('0x4'));var config=require(_0x3bea('0x5'));var controller=require('./mailAccount.controller');router[_0x3bea('0x6')]('/',auth[_0x3bea('0x7')](),controller[_0x3bea('0x8')]);router[_0x3bea('0x6')](_0x3bea('0x9'),auth[_0x3bea('0x7')](),controller[_0x3bea('0xa')]);router[_0x3bea('0x6')](_0x3bea('0xb'),auth[_0x3bea('0x7')](),controller['show']);router[_0x3bea('0x6')](_0x3bea('0xc'),auth[_0x3bea('0x7')](),controller[_0x3bea('0xd')]);router[_0x3bea('0x6')](_0x3bea('0xe'),auth['isAuthenticated'](),controller[_0x3bea('0xf')]);router[_0x3bea('0x6')](_0x3bea('0x10'),auth[_0x3bea('0x7')](),controller[_0x3bea('0x11')]);router[_0x3bea('0x6')](_0x3bea('0x12'),auth[_0x3bea('0x7')](),controller['getSmtp']);router[_0x3bea('0x6')](_0x3bea('0x13'),auth['isAuthenticated'](),controller[_0x3bea('0x14')]);router[_0x3bea('0x6')](_0x3bea('0x15'),auth[_0x3bea('0x7')](),controller[_0x3bea('0x16')]);router[_0x3bea('0x6')](_0x3bea('0x17'),auth['isAuthenticated'](),controller[_0x3bea('0x18')]);router['get'](_0x3bea('0x19'),auth['isAuthenticated'](),controller[_0x3bea('0x1a')]);router[_0x3bea('0x6')]('/:id/users',auth[_0x3bea('0x7')](),controller[_0x3bea('0x1b')]);router[_0x3bea('0x1c')](_0x3bea('0xc'),auth[_0x3bea('0x7')](),controller[_0x3bea('0x1d')]);router[_0x3bea('0x1c')](_0x3bea('0xe'),auth[_0x3bea('0x7')](),controller['addAnswer']);router[_0x3bea('0x1c')]('/',auth[_0x3bea('0x7')](),controller[_0x3bea('0x1e')]);router[_0x3bea('0x1c')](_0x3bea('0x10'),auth['isAuthenticated'](),controller['addImap']);router['post'](_0x3bea('0x12'),auth['isAuthenticated'](),controller[_0x3bea('0x1f')]);router[_0x3bea('0x1c')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x3bea('0x20')]);router['post']('/:id/applications',auth[_0x3bea('0x7')](),controller[_0x3bea('0x21')]);router[_0x3bea('0x1c')](_0x3bea('0x22'),auth['isAuthenticated'](),controller['send']);router['post'](_0x3bea('0x23'),auth[_0x3bea('0x7')](),controller[_0x3bea('0x24')]);router['put'](_0x3bea('0xb'),auth[_0x3bea('0x7')](),controller[_0x3bea('0x25')]);router[_0x3bea('0x26')](_0x3bea('0xc'),auth[_0x3bea('0x7')](),controller['removeDispositions']);router[_0x3bea('0x26')](_0x3bea('0xe'),auth[_0x3bea('0x7')](),controller['removeAnswers']);router[_0x3bea('0x26')](_0x3bea('0x10'),auth['isAuthenticated'](),controller['removeImap']);router['delete'](_0x3bea('0x12'),auth[_0x3bea('0x7')](),controller[_0x3bea('0x27')]);router['delete'](_0x3bea('0xb'),auth[_0x3bea('0x7')](),controller[_0x3bea('0x28')]);router[_0x3bea('0x26')](_0x3bea('0x23'),auth[_0x3bea('0x7')](),controller[_0x3bea('0x29')]);module[_0x3bea('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 241a51d..328d599 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 _0x1e8b=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x421b57,_0x4984d0){var _0x1afd30=function(_0x56fdff){while(--_0x56fdff){_0x421b57['push'](_0x421b57['shift']());}};_0x1afd30(++_0x4984d0);}(_0x1e8b,0x14c));var _0xb1e8=function(_0x3cc3e7,_0x14d25b){_0x3cc3e7=_0x3cc3e7-0x0;var _0x481539=_0x1e8b[_0x3cc3e7];return _0x481539;};'use strict';var Sequelize=require(_0xb1e8('0x0'));module['exports']={'description':{'type':Sequelize[_0xb1e8('0x1')]},'name':{'type':Sequelize[_0xb1e8('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xb1e8('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xb1e8('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb1e8('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xb1e8('0x3')]},'markAsUnread':{'type':Sequelize[_0xb1e8('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb1e8('0x1')],'allowNull':![],'defaultValue':_0xb1e8('0x4')},'fontSize':{'type':Sequelize[_0xb1e8('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb1e8('0x3')],'defaultValue':function(){return _0xb1e8('0x6');}},'notificationSound':{'type':Sequelize[_0xb1e8('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb1e8('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb1e8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb1e8('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb1e8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb1e8('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb1e8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb1e8('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb1e8('0x2')],'defaultValue':![],'comment':_0xb1e8('0x7'),'set':function(_0x147168){if(!_0x147168)this[_0xb1e8('0x8')](_0xb1e8('0x9'),null);this['setDataValue'](_0xb1e8('0xa'),_0x147168);}}}; \ No newline at end of file +var _0xe93b=['exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x404976,_0x535bd6){var _0x4c40a8=function(_0x34a381){while(--_0x34a381){_0x404976['push'](_0x404976['shift']());}};_0x4c40a8(++_0x535bd6);}(_0xe93b,0x8b));var _0xbe93=function(_0xd35870,_0x3ffeff){_0xd35870=_0xd35870-0x0;var _0xff1509=_0xe93b[_0xd35870];return _0xff1509;};'use strict';var Sequelize=require(_0xbe93('0x0'));module[_0xbe93('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xbe93('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xbe93('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xbe93('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xbe93('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xbe93('0x4')]},'markAsUnread':{'type':Sequelize[_0xbe93('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbe93('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xbe93('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xbe93('0x4')],'defaultValue':function(){return _0xbe93('0x7');}},'notificationSound':{'type':Sequelize[_0xbe93('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbe93('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbe93('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbe93('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbe93('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbe93('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe93('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xbe93('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xbe93('0x3')],'defaultValue':![],'comment':_0xbe93('0xa'),'set':function(_0x5b8a39){if(!_0x5b8a39)this[_0xbe93('0xb')](_0xbe93('0xc'),null);this[_0xbe93('0xb')](_0xbe93('0xd'),_0x5b8a39);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5188e7d..1cac457 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 _0xcbd9=['status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','MailAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','includeAll','include','findAll','show','params','rawAttributes','find','body','describe','MailAccountId','Disposition','create','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','order','ListId','description','isNil','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','getSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','internal','Tags','tag','addApplications','sequelize','transaction','destroy','bulkCreate','priority','getApplications','MailApplication','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','Interaction','verifySmtp','secure','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','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','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0xcbd9,0x91));var _0x9cbd=function(_0x1c0adf,_0xe1d577){_0x1c0adf=_0x1c0adf-0x0;var _0x40d45e=_0xcbd9[_0x1c0adf];return _0x40d45e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9cbd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9cbd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9cbd('0x2'));var moment=require(_0x9cbd('0x3'));var BPromise=require(_0x9cbd('0x4'));var Mustache=require(_0x9cbd('0x5'));var util=require(_0x9cbd('0x6'));var path=require(_0x9cbd('0x7'));var sox=require(_0x9cbd('0x8'));var csv=require(_0x9cbd('0x9'));var ejs=require(_0x9cbd('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9cbd('0xb'));var crypto=require(_0x9cbd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9cbd('0xd'));var toCsv=require(_0x9cbd('0x9'));var querystring=require(_0x9cbd('0xe'));var Papa=require(_0x9cbd('0xf'));var Redis=require(_0x9cbd('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9cbd('0x11'));var hardwareService=require(_0x9cbd('0x12'));var logger=require(_0x9cbd('0x13'))(_0x9cbd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9cbd('0x15'))['db'];config[_0x9cbd('0x16')]=_[_0x9cbd('0x17')](config[_0x9cbd('0x16')],{'host':_0x9cbd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9cbd('0x19')]({'port':0x232b});function checkPasswordPattern(_0x549e71,_0x774c26,_0x1d7a42){if(_0x1d7a42){var _0x5894ff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5894ff['test'](_0x774c26)){return _0x549e71;}else{throw new db[(_0x9cbd('0x1a'))][(_0x9cbd('0x1b'))](_0x9cbd('0x1c'));}}else{return _0x549e71;}}function respondWithRpcPromise(_0x5c0d88,_0x30971c,_0x2e6501,_0x4b15bb){return new BPromise(function(_0x3cd679,_0x45b291){var _0x31cc8d=_0x4b15bb||client;return _0x31cc8d['request'](_0x5c0d88,_0x2e6501)[_0x9cbd('0x1d')](function(_0x1cafd9){logger[_0x9cbd('0x1e')](_0x9cbd('0x1f'),_0x30971c,'request\x20sent');logger[_0x9cbd('0x20')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x30971c,_0x9cbd('0x21'),JSON[_0x9cbd('0x22')](_0x1cafd9));if(_0x1cafd9[_0x9cbd('0x23')]){if(_0x1cafd9['error'][_0x9cbd('0x24')]===0x1f4){logger['error'](_0x9cbd('0x1f'),_0x30971c,_0x1cafd9[_0x9cbd('0x23')]['message']);return _0x45b291(_0x1cafd9[_0x9cbd('0x23')][_0x9cbd('0x25')]);}logger[_0x9cbd('0x23')](_0x9cbd('0x1f'),_0x30971c,_0x1cafd9[_0x9cbd('0x23')][_0x9cbd('0x25')]);return _0x3cd679(_0x1cafd9[_0x9cbd('0x23')][_0x9cbd('0x25')]);}else{logger['info'](_0x9cbd('0x1f'),_0x30971c,_0x9cbd('0x21'));_0x3cd679(_0x1cafd9[_0x9cbd('0x26')]['message']);}})[_0x9cbd('0x27')](function(_0x14c759){logger[_0x9cbd('0x23')](_0x9cbd('0x1f'),_0x30971c,_0x14c759);_0x45b291(_0x14c759);});});}function respondWithStatusCode(_0x15a932,_0x3a8b6d){_0x3a8b6d=_0x3a8b6d||0xcc;return function(_0x496f34){if(_0x496f34){return _0x15a932['sendStatus'](_0x3a8b6d);}return _0x15a932[_0x9cbd('0x28')](_0x3a8b6d)['end']();};}function respondWithResult(_0x193a0d,_0x351eae){_0x351eae=_0x351eae||0xc8;return function(_0x2b5f43){if(_0x2b5f43){return _0x193a0d[_0x9cbd('0x28')](_0x351eae)[_0x9cbd('0x29')](_0x2b5f43);}};}function respondWithFilteredResult(_0x46e337,_0x1b45be){return function(_0xced4c8){if(_0xced4c8){var _0x441ecc=_0xced4c8[_0x9cbd('0x2a')],_0x3d1a4f=_0x1b45be[_0x9cbd('0x2b')],_0x3987dd=_0x1b45be[_0x9cbd('0x2b')]+_0x1b45be[_0x9cbd('0x2c')],_0xb7c2fb;if(_0x3987dd>=_0x441ecc){_0x3987dd=_0x441ecc;_0xb7c2fb=0xc8;}else{_0xb7c2fb=0xce;}_0x46e337[_0x9cbd('0x28')](_0xb7c2fb);return _0x46e337[_0x9cbd('0x2d')](_0x9cbd('0x2e'),_0x3d1a4f+'-'+_0x3987dd+'/'+_0x441ecc)[_0x9cbd('0x29')](_0xced4c8);}return null;};}function patchUpdates(_0x782d49){return function(_0x1e695f){try{jsonpatch[_0x9cbd('0x2f')](_0x1e695f,_0x782d49,!![]);}catch(_0x238552){return BPromise[_0x9cbd('0x30')](_0x238552);}return _0x1e695f[_0x9cbd('0x31')]();};}function saveUpdates(_0x4e7c4a,_0x382ddd){return function(_0x517178){if(_0x517178){return _0x517178[_0x9cbd('0x32')](_0x4e7c4a)[_0x9cbd('0x1d')](function(_0x4f68c0){return _0x4f68c0;});}return null;};}function removeEntity(_0x3ec1da,_0x4d37cf){return function(_0x4c7e18){if(_0x4c7e18){return _0x4c7e18['destroy']()[_0x9cbd('0x1d')](function(){var _0xa27ac0=_0x4c7e18[_0x9cbd('0x33')]({'plain':!![]});var _0x1c09c0=_0x9cbd('0x34');return db[_0x9cbd('0x35')]['destroy']({'where':{'type':_0x1c09c0,'resourceId':_0xa27ac0['id']}})[_0x9cbd('0x1d')](function(){return _0x4c7e18;});})[_0x9cbd('0x1d')](function(){_0x3ec1da[_0x9cbd('0x28')](0xcc)[_0x9cbd('0x36')]();});}};}function handleEntityNotFound(_0x256ea2,_0x1651c9){return function(_0x3a8cec){if(!_0x3a8cec){_0x256ea2[_0x9cbd('0x37')](0x194);}return _0x3a8cec;};}function handleError(_0x15ee46,_0x4ac7f6){_0x4ac7f6=_0x4ac7f6||0x1f4;return function(_0x17a4d6){logger[_0x9cbd('0x23')](_0x17a4d6[_0x9cbd('0x38')]);if(_0x17a4d6['name']){delete _0x17a4d6[_0x9cbd('0x39')];}_0x15ee46[_0x9cbd('0x28')](_0x4ac7f6)[_0x9cbd('0x3a')](_0x17a4d6);};}exports[_0x9cbd('0x3b')]=function(_0x1c3214,_0x3790ee){var _0x31cefa={'include':[{'model':db[_0x9cbd('0x3c')],'as':_0x9cbd('0x3d')},{'model':db[_0x9cbd('0x3e')],'as':_0x9cbd('0x3f')},{'model':db[_0x9cbd('0x40')],'as':_0x9cbd('0x41')}]},_0x4e13db={},_0x1bbcf5={'count':0x0,'rows':[]};var _0x486020=_[_0x9cbd('0x42')](db['MailAccount']['rawAttributes'],function(_0x3340f6){return{'name':_0x3340f6[_0x9cbd('0x43')],'type':_0x3340f6[_0x9cbd('0x44')][_0x9cbd('0x45')]};});_0x4e13db[_0x9cbd('0x46')]=_[_0x9cbd('0x42')](_0x486020,'name');_0x4e13db[_0x9cbd('0x47')]=_[_0x9cbd('0x48')](_0x1c3214[_0x9cbd('0x47')]);_0x4e13db[_0x9cbd('0x49')]=_['intersection'](_0x4e13db[_0x9cbd('0x46')],_0x4e13db[_0x9cbd('0x47')]);_0x31cefa[_0x9cbd('0x4a')]=_[_0x9cbd('0x4b')](_0x4e13db['model'],qs[_0x9cbd('0x4c')](_0x1c3214[_0x9cbd('0x47')][_0x9cbd('0x4c')]));_0x31cefa[_0x9cbd('0x4a')]=_0x31cefa[_0x9cbd('0x4a')][_0x9cbd('0x4d')]?_0x31cefa[_0x9cbd('0x4a')]:_0x4e13db[_0x9cbd('0x46')];if(!_0x1c3214[_0x9cbd('0x47')][_0x9cbd('0x4e')](_0x9cbd('0x4f'))){_0x31cefa[_0x9cbd('0x2c')]=qs[_0x9cbd('0x2c')](_0x1c3214[_0x9cbd('0x47')]['limit']);_0x31cefa[_0x9cbd('0x2b')]=qs[_0x9cbd('0x2b')](_0x1c3214[_0x9cbd('0x47')]['offset']);}_0x31cefa['order']=qs[_0x9cbd('0x50')](_0x1c3214[_0x9cbd('0x47')][_0x9cbd('0x50')]);_0x31cefa[_0x9cbd('0x51')]=qs[_0x9cbd('0x49')](_[_0x9cbd('0x52')](_0x1c3214['query'],_0x4e13db[_0x9cbd('0x49')]),_0x486020);if(_0x1c3214[_0x9cbd('0x47')][_0x9cbd('0x53')]){_0x31cefa[_0x9cbd('0x51')]=_[_0x9cbd('0x54')](_0x31cefa[_0x9cbd('0x51')],{'$or':_['map'](_0x486020,function(_0x48b13b){if(_0x48b13b['type']!==_0x9cbd('0x55')){var _0x2e120a={};_0x2e120a[_0x48b13b[_0x9cbd('0x39')]]={'$like':'%'+_0x1c3214[_0x9cbd('0x47')][_0x9cbd('0x53')]+'%'};return _0x2e120a;}})});}_0x31cefa=_['merge']({},_0x31cefa,_0x1c3214[_0x9cbd('0x56')]);var _0x1d9a24={'where':_0x31cefa[_0x9cbd('0x51')]};return db[_0x9cbd('0x57')][_0x9cbd('0x2a')](_0x1d9a24)[_0x9cbd('0x1d')](function(_0x479ddc){_0x1bbcf5['count']=_0x479ddc;if(_0x1c3214['query'][_0x9cbd('0x58')]){_0x31cefa[_0x9cbd('0x59')]=[{'all':!![]}];}return db['MailAccount'][_0x9cbd('0x5a')](_0x31cefa);})[_0x9cbd('0x1d')](function(_0x214e9e){_0x1bbcf5['rows']=_0x214e9e;return _0x1bbcf5;})[_0x9cbd('0x1d')](respondWithFilteredResult(_0x3790ee,_0x31cefa))[_0x9cbd('0x27')](handleError(_0x3790ee,null));};exports[_0x9cbd('0x5b')]=function(_0x3e3cc1,_0x21f306){var _0x3283c2={'raw':![],'where':{'id':_0x3e3cc1[_0x9cbd('0x5c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x9cbd('0x3d')},{'model':db[_0x9cbd('0x3e')],'as':_0x9cbd('0x3f')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x405199={};_0x405199['model']=_[_0x9cbd('0x48')](db['MailAccount'][_0x9cbd('0x5d')]);_0x405199['query']=_[_0x9cbd('0x48')](_0x3e3cc1['query']);_0x405199[_0x9cbd('0x49')]=_[_0x9cbd('0x4b')](_0x405199[_0x9cbd('0x46')],_0x405199[_0x9cbd('0x47')]);_0x3283c2[_0x9cbd('0x4a')]=_[_0x9cbd('0x4b')](_0x405199[_0x9cbd('0x46')],qs['fields'](_0x3e3cc1[_0x9cbd('0x47')][_0x9cbd('0x4c')]));_0x3283c2[_0x9cbd('0x4a')]=_0x3283c2[_0x9cbd('0x4a')][_0x9cbd('0x4d')]?_0x3283c2[_0x9cbd('0x4a')]:_0x405199['model'];if(_0x3e3cc1['query']['includeAll']){_0x3283c2[_0x9cbd('0x59')]=[{'all':!![]}];}_0x3283c2=_[_0x9cbd('0x54')]({},_0x3283c2,_0x3e3cc1[_0x9cbd('0x56')]);return db[_0x9cbd('0x57')][_0x9cbd('0x5e')](_0x3283c2)[_0x9cbd('0x1d')](handleEntityNotFound(_0x21f306,null))[_0x9cbd('0x1d')](respondWithResult(_0x21f306,null))[_0x9cbd('0x27')](handleError(_0x21f306,null));};exports['update']=function(_0x2b1a87,_0x43bab9){if(_0x2b1a87[_0x9cbd('0x5f')]['id']){delete _0x2b1a87[_0x9cbd('0x5f')]['id'];}return db['MailAccount'][_0x9cbd('0x5e')]({'where':{'id':_0x2b1a87['params']['id']},'include':[{'model':db[_0x9cbd('0x3c')],'as':_0x9cbd('0x3d')},{'model':db[_0x9cbd('0x3e')],'as':_0x9cbd('0x3f')},{'model':db[_0x9cbd('0x40')],'as':_0x9cbd('0x41')}]})[_0x9cbd('0x1d')](handleEntityNotFound(_0x43bab9,null))[_0x9cbd('0x1d')](saveUpdates(_0x2b1a87[_0x9cbd('0x5f')],null))[_0x9cbd('0x1d')](function(_0x4b4615){if(_0x4b4615&&_0x2b1a87[_0x9cbd('0x5f')][_0x9cbd('0x3d')]){return db[_0x9cbd('0x3c')][_0x9cbd('0x32')](_0x2b1a87['body']['Imap'],{'where':{'MailAccountId':_0x4b4615['id']}})[_0x9cbd('0x1d')](function(){return _0x4b4615;});}return _0x4b4615;})[_0x9cbd('0x1d')](function(_0x1691c5){if(_0x1691c5&&_0x2b1a87[_0x9cbd('0x5f')]['Smtp']){return db['MailServerOut'][_0x9cbd('0x32')](_0x2b1a87[_0x9cbd('0x5f')][_0x9cbd('0x3f')],{'where':{'MailAccountId':_0x1691c5['id']}})[_0x9cbd('0x1d')](function(){return _0x1691c5;});}return _0x1691c5;})[_0x9cbd('0x1d')](respondWithResult(_0x43bab9,null))[_0x9cbd('0x27')](handleError(_0x43bab9,null));};exports['describe']=function(_0x19f184,_0x50367f){return db['MailAccount'][_0x9cbd('0x60')]()['then'](respondWithResult(_0x50367f,null))[_0x9cbd('0x27')](handleError(_0x50367f,null));};exports['addDisposition']=function(_0x224c95,_0x5e6459,_0x2b3bb5){if(_0x224c95[_0x9cbd('0x5f')]['id']){delete _0x224c95[_0x9cbd('0x5f')]['id'];}return db['MailAccount'][_0x9cbd('0x5e')]({'where':{'id':_0x224c95[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x5e6459,null))[_0x9cbd('0x1d')](function(_0x9a452b){if(_0x9a452b){_0x224c95['body'][_0x9cbd('0x61')]=_0x9a452b['id'];return db[_0x9cbd('0x62')][_0x9cbd('0x63')](_0x224c95['body']);}})[_0x9cbd('0x1d')](respondWithResult(_0x5e6459,null))[_0x9cbd('0x27')](handleError(_0x5e6459,null));};exports[_0x9cbd('0x64')]=function(_0x58dc9d,_0x15334d,_0x5cf9e0){var _0x424c0b={'raw':![],'where':{}};var _0x2af3be={};var _0x510e02={'count':0x0,'rows':[]};return db[_0x9cbd('0x57')][_0x9cbd('0x65')]({'where':{'id':_0x58dc9d['params']['id']}})['then'](handleEntityNotFound(_0x15334d,null))[_0x9cbd('0x1d')](function(_0x566004){if(_0x566004){_0x2af3be[_0x9cbd('0x46')]=_['keys'](db[_0x9cbd('0x62')][_0x9cbd('0x5d')]);_0x2af3be[_0x9cbd('0x47')]=_[_0x9cbd('0x48')](_0x58dc9d['query']);_0x2af3be[_0x9cbd('0x49')]=_[_0x9cbd('0x4b')](_0x2af3be['model'],_0x2af3be[_0x9cbd('0x47')]);_0x424c0b['attributes']=_['intersection'](_0x2af3be[_0x9cbd('0x46')],qs[_0x9cbd('0x4c')](_0x58dc9d[_0x9cbd('0x47')][_0x9cbd('0x4c')]));_0x424c0b[_0x9cbd('0x4a')]=_0x424c0b[_0x9cbd('0x4a')][_0x9cbd('0x4d')]?_0x424c0b[_0x9cbd('0x4a')]:_0x2af3be[_0x9cbd('0x46')];if(!_0x58dc9d[_0x9cbd('0x47')][_0x9cbd('0x4e')](_0x9cbd('0x4f'))){_0x424c0b[_0x9cbd('0x2c')]=qs[_0x9cbd('0x2c')](_0x58dc9d[_0x9cbd('0x47')]['limit']);_0x424c0b[_0x9cbd('0x2b')]=qs[_0x9cbd('0x2b')](_0x58dc9d['query'][_0x9cbd('0x2b')]);}_0x424c0b['order']=qs[_0x9cbd('0x50')](_0x58dc9d[_0x9cbd('0x47')]['sort']);_0x424c0b['where']=qs[_0x9cbd('0x49')](_[_0x9cbd('0x52')](_0x58dc9d[_0x9cbd('0x47')],_0x2af3be[_0x9cbd('0x49')]));_0x424c0b[_0x9cbd('0x51')][_0x9cbd('0x61')]=_0x566004['id'];if(_0x58dc9d[_0x9cbd('0x47')]['filter']){_0x424c0b[_0x9cbd('0x51')]=_['merge'](_0x424c0b[_0x9cbd('0x51')],{'$or':_['map'](_0x424c0b['attributes'],function(_0xe03f50){var _0x43b6d1={};_0x43b6d1[_0xe03f50]={'$like':'%'+_0x58dc9d[_0x9cbd('0x47')][_0x9cbd('0x53')]+'%'};return _0x43b6d1;})});}_0x424c0b=_[_0x9cbd('0x54')]({},_0x424c0b,_0x58dc9d['options']);return db[_0x9cbd('0x62')][_0x9cbd('0x2a')]({'where':_0x424c0b[_0x9cbd('0x51')]})['then'](function(_0x1a39f4){_0x510e02[_0x9cbd('0x2a')]=_0x1a39f4;if(_0x58dc9d[_0x9cbd('0x47')][_0x9cbd('0x58')]){_0x424c0b[_0x9cbd('0x59')]=[{'all':!![]}];}return db['Disposition'][_0x9cbd('0x5a')](_0x424c0b);})['then'](function(_0x590341){_0x510e02[_0x9cbd('0x66')]=_0x590341;return _0x510e02;});}})['then'](respondWithFilteredResult(_0x15334d,_0x424c0b))[_0x9cbd('0x27')](handleError(_0x15334d,null));};exports['removeDispositions']=function(_0x527307,_0x3a2ccd,_0x3d7ab2){return db['MailAccount'][_0x9cbd('0x5e')]({'where':{'id':_0x527307[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x3a2ccd,null))[_0x9cbd('0x1d')](function(_0x52342a){if(_0x52342a){return _0x52342a[_0x9cbd('0x67')](_0x527307[_0x9cbd('0x47')][_0x9cbd('0x68')]);}})[_0x9cbd('0x1d')](respondWithStatusCode(_0x3a2ccd,null))[_0x9cbd('0x27')](handleError(_0x3a2ccd,null));};exports['addAnswer']=function(_0x35794b,_0x1a88c0,_0x155424){if(_0x35794b[_0x9cbd('0x5f')]['id']){delete _0x35794b[_0x9cbd('0x5f')]['id'];}return db[_0x9cbd('0x57')][_0x9cbd('0x5e')]({'where':{'id':_0x35794b[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x1a88c0,null))[_0x9cbd('0x1d')](function(_0x3a747c){if(_0x3a747c){_0x35794b['body'][_0x9cbd('0x61')]=_0x3a747c['id'];return db[_0x9cbd('0x69')][_0x9cbd('0x63')](_0x35794b[_0x9cbd('0x5f')]);}})['then'](respondWithResult(_0x1a88c0,null))[_0x9cbd('0x27')](handleError(_0x1a88c0,null));};exports['getAnswers']=function(_0x4d30a4,_0x27c998,_0x420017){var _0x3548d6={'raw':![],'where':{}};var _0x494d68={};var _0x41ae98={'count':0x0,'rows':[]};return db[_0x9cbd('0x57')][_0x9cbd('0x65')]({'where':{'id':_0x4d30a4[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x27c998,null))[_0x9cbd('0x1d')](function(_0x58231e){if(_0x58231e){_0x494d68[_0x9cbd('0x46')]=_[_0x9cbd('0x48')](db['CannedAnswer'][_0x9cbd('0x5d')]);_0x494d68[_0x9cbd('0x47')]=_[_0x9cbd('0x48')](_0x4d30a4[_0x9cbd('0x47')]);_0x494d68['filters']=_[_0x9cbd('0x4b')](_0x494d68[_0x9cbd('0x46')],_0x494d68[_0x9cbd('0x47')]);_0x3548d6[_0x9cbd('0x4a')]=_[_0x9cbd('0x4b')](_0x494d68[_0x9cbd('0x46')],qs[_0x9cbd('0x4c')](_0x4d30a4[_0x9cbd('0x47')][_0x9cbd('0x4c')]));_0x3548d6['attributes']=_0x3548d6[_0x9cbd('0x4a')][_0x9cbd('0x4d')]?_0x3548d6['attributes']:_0x494d68['model'];if(!_0x4d30a4[_0x9cbd('0x47')][_0x9cbd('0x4e')]('nolimit')){_0x3548d6[_0x9cbd('0x2c')]=qs[_0x9cbd('0x2c')](_0x4d30a4[_0x9cbd('0x47')][_0x9cbd('0x2c')]);_0x3548d6[_0x9cbd('0x2b')]=qs[_0x9cbd('0x2b')](_0x4d30a4[_0x9cbd('0x47')][_0x9cbd('0x2b')]);}_0x3548d6[_0x9cbd('0x6a')]=qs[_0x9cbd('0x50')](_0x4d30a4['query'][_0x9cbd('0x50')]);_0x3548d6[_0x9cbd('0x51')]=qs['filters'](_[_0x9cbd('0x52')](_0x4d30a4['query'],_0x494d68[_0x9cbd('0x49')]));_0x3548d6['where']['MailAccountId']=_0x58231e['id'];if(_0x4d30a4[_0x9cbd('0x47')][_0x9cbd('0x53')]){_0x3548d6[_0x9cbd('0x51')]=_['merge'](_0x3548d6['where'],{'$or':_[_0x9cbd('0x42')](_0x3548d6[_0x9cbd('0x4a')],function(_0x368320){var _0x37a2b0={};_0x37a2b0[_0x368320]={'$like':'%'+_0x4d30a4[_0x9cbd('0x47')]['filter']+'%'};return _0x37a2b0;})});}_0x3548d6=_[_0x9cbd('0x54')]({},_0x3548d6,_0x4d30a4[_0x9cbd('0x56')]);return db['CannedAnswer'][_0x9cbd('0x2a')]({'where':_0x3548d6[_0x9cbd('0x51')]})[_0x9cbd('0x1d')](function(_0x4e1491){_0x41ae98[_0x9cbd('0x2a')]=_0x4e1491;if(_0x4d30a4[_0x9cbd('0x47')][_0x9cbd('0x58')]){_0x3548d6[_0x9cbd('0x59')]=[{'all':!![]}];}return db[_0x9cbd('0x69')]['findAll'](_0x3548d6);})['then'](function(_0x1586ba){_0x41ae98[_0x9cbd('0x66')]=_0x1586ba;return _0x41ae98;});}})[_0x9cbd('0x1d')](respondWithFilteredResult(_0x27c998,_0x3548d6))[_0x9cbd('0x27')](handleError(_0x27c998,null));};exports['removeAnswers']=function(_0x564fd5,_0xe7c477,_0x257fd0){return db[_0x9cbd('0x57')][_0x9cbd('0x5e')]({'where':{'id':_0x564fd5[_0x9cbd('0x5c')]['id']}})['then'](handleEntityNotFound(_0xe7c477,null))[_0x9cbd('0x1d')](function(_0x3b1c38){if(_0x3b1c38){return _0x3b1c38['removeAnswers'](_0x564fd5[_0x9cbd('0x47')][_0x9cbd('0x68')]);}})[_0x9cbd('0x1d')](respondWithStatusCode(_0xe7c477,null))['catch'](handleError(_0xe7c477,null));};exports[_0x9cbd('0x63')]=function(_0x2b49ff,_0x244eb7){var _0x4cf579={'name':_0x2b49ff[_0x9cbd('0x5f')][_0x9cbd('0x39')],'key':_0x2b49ff[_0x9cbd('0x5f')][_0x9cbd('0x45')],'email':_0x2b49ff[_0x9cbd('0x5f')]['email'],'ListId':_0x2b49ff['body'][_0x9cbd('0x6b')],'active':!_['isNil'](_0x2b49ff[_0x9cbd('0x5f')]['active'])?_0x2b49ff['body']['active']:!![],'description':_0x2b49ff[_0x9cbd('0x5f')][_0x9cbd('0x6c')]||null,'Imap':{},'Smtp':{}};if(_[_0x9cbd('0x6d')](_0x2b49ff[_0x9cbd('0x5f')]['cservice'])){if(_0x2b49ff['body'][_0x9cbd('0x6e')]){_0x4cf579[_0x9cbd('0x3d')][_0x9cbd('0x6f')]=_0x4cf579[_0x9cbd('0x3f')][_0x9cbd('0x6f')]=_0x2b49ff['body'][_0x9cbd('0x70')];_0x4cf579['Imap'][_0x9cbd('0x71')]=_0x4cf579[_0x9cbd('0x3f')]['pass']=_0x2b49ff[_0x9cbd('0x5f')][_0x9cbd('0x72')];}else{_0x4cf579[_0x9cbd('0x3d')][_0x9cbd('0x73')]=_0x4cf579['Smtp']['authentication']=![];}_0x4cf579[_0x9cbd('0x3d')][_0x9cbd('0x74')]=_0x2b49ff[_0x9cbd('0x5f')][_0x9cbd('0x3d')]['host'];_0x4cf579[_0x9cbd('0x3d')]['port']=_0x2b49ff[_0x9cbd('0x5f')]['Imap'][_0x9cbd('0x75')];_0x4cf579[_0x9cbd('0x3f')][_0x9cbd('0x74')]=_0x2b49ff['body'][_0x9cbd('0x3f')]['host'];_0x4cf579['Smtp'][_0x9cbd('0x75')]=_0x2b49ff[_0x9cbd('0x5f')][_0x9cbd('0x3f')]['port'];}else{_0x4cf579[_0x9cbd('0x3d')]['service']=_0x4cf579[_0x9cbd('0x3f')][_0x9cbd('0x76')]=_0x2b49ff[_0x9cbd('0x5f')]['cservice'];_0x4cf579[_0x9cbd('0x3d')][_0x9cbd('0x6f')]=_0x4cf579[_0x9cbd('0x3f')][_0x9cbd('0x6f')]=_0x2b49ff['body'][_0x9cbd('0x70')];_0x4cf579[_0x9cbd('0x3d')][_0x9cbd('0x71')]=_0x4cf579[_0x9cbd('0x3f')][_0x9cbd('0x77')]=_0x2b49ff[_0x9cbd('0x5f')][_0x9cbd('0x72')];}return db[_0x9cbd('0x57')][_0x9cbd('0x63')](_0x4cf579,{'include':[{'model':db[_0x9cbd('0x3e')],'as':'Smtp'},{'model':db[_0x9cbd('0x3c')],'as':_0x9cbd('0x3d')}]})[_0x9cbd('0x1d')](function(_0x5e2def){var _0x305c5e=_0x2b49ff[_0x9cbd('0x6f')][_0x9cbd('0x33')]({'plain':!![]});if(!_0x305c5e)throw new Error(_0x9cbd('0x78'));if(_0x305c5e[_0x9cbd('0x79')]==='user'){var _0x1ef815=_0x5e2def[_0x9cbd('0x33')]({'plain':!![]});return db[_0x9cbd('0x7a')][_0x9cbd('0x5e')]({'where':{'name':_0x9cbd('0x34'),'userProfileId':_0x305c5e[_0x9cbd('0x7b')]},'raw':!![]})[_0x9cbd('0x1d')](function(_0x56577f){if(_0x56577f&&_0x56577f[_0x9cbd('0x7c')]===0x0){return db['UserProfileResource']['create']({'name':_0x1ef815[_0x9cbd('0x39')],'resourceId':_0x1ef815['id'],'type':_0x56577f['name'],'sectionId':_0x56577f['id']},{})[_0x9cbd('0x1d')](function(){return _0x5e2def;});}else{return _0x5e2def;}})[_0x9cbd('0x27')](function(_0x4d99df){logger[_0x9cbd('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d99df);throw _0x4d99df;});}return _0x5e2def;})[_0x9cbd('0x1d')](respondWithResult(_0x244eb7,0xc9))[_0x9cbd('0x27')](handleError(_0x244eb7,null));};exports[_0x9cbd('0x7d')]=function(_0x437851,_0x5e9822,_0x1cd00f){return db[_0x9cbd('0x57')]['findOne']({'where':{'id':_0x437851[_0x9cbd('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5e9822,null))['then'](function(_0x17d804){if(_0x17d804){return _0x17d804[_0x9cbd('0x7d')]();}return null;})[_0x9cbd('0x1d')](respondWithResult(_0x5e9822,null))[_0x9cbd('0x27')](handleError(_0x5e9822,null));};exports[_0x9cbd('0x7e')]=function(_0x35ddf8,_0x157375,_0x3b84cb){if(_0x35ddf8[_0x9cbd('0x5f')]['id']){delete _0x35ddf8[_0x9cbd('0x5f')]['id'];}return db[_0x9cbd('0x57')][_0x9cbd('0x5e')]({'where':{'id':_0x35ddf8[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x157375,null))[_0x9cbd('0x1d')](function(_0x1ccc08){if(_0x1ccc08){_0x35ddf8[_0x9cbd('0x5f')][_0x9cbd('0x61')]=_0x1ccc08['id'];return db[_0x9cbd('0x3c')][_0x9cbd('0x63')](_0x35ddf8[_0x9cbd('0x5f')]);}})[_0x9cbd('0x1d')](respondWithResult(_0x157375,null))['catch'](handleError(_0x157375,null));};exports['removeImap']=function(_0x59978d,_0x3edc9b,_0x44c1de){return db[_0x9cbd('0x57')][_0x9cbd('0x65')]({'where':{'id':_0x59978d[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x3edc9b,null))[_0x9cbd('0x1d')](function(_0x52771b){if(_0x52771b){return _0x52771b['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x3edc9b,null))[_0x9cbd('0x27')](handleError(_0x3edc9b,null));};exports[_0x9cbd('0x7f')]=function(_0x4ae61d,_0x1c1f68,_0xed9d54){return db['MailAccount'][_0x9cbd('0x65')]({'where':{'id':_0x4ae61d[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x1c1f68,null))['then'](function(_0x37673d){if(_0x37673d){return _0x37673d['getSmtp']();}return null;})[_0x9cbd('0x1d')](respondWithResult(_0x1c1f68,null))[_0x9cbd('0x27')](handleError(_0x1c1f68,null));};exports['addSmtp']=function(_0x85a8a5,_0xb2723d,_0x361359){if(_0x85a8a5['body']['id']){delete _0x85a8a5[_0x9cbd('0x5f')]['id'];}return db[_0x9cbd('0x57')][_0x9cbd('0x5e')]({'where':{'id':_0x85a8a5[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0xb2723d,null))[_0x9cbd('0x1d')](function(_0x568a91){if(_0x568a91){_0x85a8a5[_0x9cbd('0x5f')]['MailAccountId']=_0x568a91['id'];return db[_0x9cbd('0x3e')][_0x9cbd('0x63')](_0x85a8a5[_0x9cbd('0x5f')]);}})[_0x9cbd('0x1d')](respondWithResult(_0xb2723d,null))[_0x9cbd('0x27')](handleError(_0xb2723d,null));};exports['removeSmtp']=function(_0x2e3b08,_0x1883c3,_0x818ab9){return db['MailAccount'][_0x9cbd('0x65')]({'where':{'id':_0x2e3b08[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x1883c3,null))[_0x9cbd('0x1d')](function(_0x4f325c){if(_0x4f325c){return _0x4f325c[_0x9cbd('0x80')](null);}return null;})[_0x9cbd('0x1d')](respondWithStatusCode(_0x1883c3,null))[_0x9cbd('0x27')](handleError(_0x1883c3,null));};exports[_0x9cbd('0x81')]=function(_0x233d13,_0x4ea0ce,_0x3c1770){return db['MailInteraction'][_0x9cbd('0x5e')]({'where':{'id':_0x233d13[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x4ea0ce,null))[_0x9cbd('0x1d')](function(_0x4d1e14){if(_0x4d1e14){return _0x4d1e14[_0x9cbd('0x81')](_0x233d13[_0x9cbd('0x5f')][_0x9cbd('0x68')],_[_0x9cbd('0x82')](_0x233d13[_0x9cbd('0x5f')],[_0x9cbd('0x68'),'id'])||{});}})[_0x9cbd('0x1d')](respondWithResult(_0x4ea0ce,null))['catch'](handleError(_0x4ea0ce,null));};exports[_0x9cbd('0x83')]=function(_0x5364f2,_0xe5fde3,_0xc8c579){var _0x31151d={'raw':![],'where':{}};var _0x25d02c={};var _0x55ffc6={'count':0x0,'rows':[]};return db[_0x9cbd('0x57')]['findOne']({'where':{'id':_0x5364f2[_0x9cbd('0x5c')]['id']}})['then'](handleEntityNotFound(_0xe5fde3,null))[_0x9cbd('0x1d')](function(_0x5acd3d){if(_0x5acd3d){_0x25d02c[_0x9cbd('0x46')]=_[_0x9cbd('0x48')](db[_0x9cbd('0x84')][_0x9cbd('0x5d')]);_0x25d02c[_0x9cbd('0x47')]=_[_0x9cbd('0x48')](_0x5364f2[_0x9cbd('0x47')]);_0x25d02c[_0x9cbd('0x49')]=_['intersection'](_0x25d02c[_0x9cbd('0x46')],_0x25d02c['query']);_0x31151d[_0x9cbd('0x4a')]=_['intersection'](_0x25d02c[_0x9cbd('0x46')],qs[_0x9cbd('0x4c')](_0x5364f2[_0x9cbd('0x47')][_0x9cbd('0x4c')]));_0x31151d['attributes']=_0x31151d['attributes'][_0x9cbd('0x4d')]?_0x31151d[_0x9cbd('0x4a')]:_0x25d02c[_0x9cbd('0x46')];if(!_0x5364f2['query'][_0x9cbd('0x4e')]('nolimit')){_0x31151d[_0x9cbd('0x2c')]=qs[_0x9cbd('0x2c')](_0x5364f2[_0x9cbd('0x47')][_0x9cbd('0x2c')]);_0x31151d[_0x9cbd('0x2b')]=qs['offset'](_0x5364f2[_0x9cbd('0x47')][_0x9cbd('0x2b')]);}_0x31151d[_0x9cbd('0x6a')]=qs[_0x9cbd('0x50')](_0x5364f2['query'][_0x9cbd('0x50')]);_0x31151d['where']=qs[_0x9cbd('0x49')](_[_0x9cbd('0x52')](_0x5364f2[_0x9cbd('0x47')],_0x25d02c['filters']));_0x31151d[_0x9cbd('0x51')][_0x9cbd('0x61')]=_0x5acd3d['id'];if(_0x5364f2[_0x9cbd('0x47')]['filter']){_0x31151d[_0x9cbd('0x51')]=_[_0x9cbd('0x54')](_0x31151d['where'],{'$or':_[_0x9cbd('0x42')](_0x31151d[_0x9cbd('0x4a')],function(_0x26cc6e){var _0x1f5773={};_0x1f5773[_0x26cc6e]={'$like':'%'+_0x5364f2['query'][_0x9cbd('0x53')]+'%'};return _0x1f5773;})});}_0x31151d=_[_0x9cbd('0x54')]({},_0x31151d,_0x5364f2[_0x9cbd('0x56')]);return db[_0x9cbd('0x84')][_0x9cbd('0x2a')]({'where':_0x31151d[_0x9cbd('0x51')]})['then'](function(_0x65878a){_0x55ffc6[_0x9cbd('0x2a')]=_0x65878a;if(_0x5364f2['query'][_0x9cbd('0x58')]){_0x31151d[_0x9cbd('0x59')]=[{'model':db[_0x9cbd('0x85')],'as':_0x9cbd('0x86'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x9cbd('0x39'),'fullname',_0x9cbd('0x87')],'required':![]},{'model':db['Tag'],'as':_0x9cbd('0x88'),'attributes':['id',_0x9cbd('0x39'),'color'],'where':_0x5364f2[_0x9cbd('0x47')][_0x9cbd('0x89')]?{'id':_0x5364f2[_0x9cbd('0x47')][_0x9cbd('0x89')]}:undefined,'required':_0x5364f2[_0x9cbd('0x47')]['tag']?!![]:![]}];}return db[_0x9cbd('0x84')]['findAll'](_0x31151d);})[_0x9cbd('0x1d')](function(_0x541138){_0x55ffc6[_0x9cbd('0x66')]=_0x541138;return _0x55ffc6;});}})[_0x9cbd('0x1d')](respondWithFilteredResult(_0xe5fde3,_0x31151d))['catch'](handleError(_0xe5fde3,null));};exports[_0x9cbd('0x8a')]=function(_0x5257ff,_0x1fa95b,_0x48fcd8){return db[_0x9cbd('0x57')][_0x9cbd('0x65')]({'where':{'id':_0x5257ff['params']['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x1fa95b,null))['then'](function(_0x46041c){if(_0x46041c){return db[_0x9cbd('0x8b')][_0x9cbd('0x8c')](function(_0x448974){return db['MailApplication'][_0x9cbd('0x8d')]({'where':{'MailAccountId':_0x5257ff[_0x9cbd('0x5c')]['id']},'transaction':_0x448974})[_0x9cbd('0x1d')](function(_0x41b0e8){var _0x4ade61=_[_0x9cbd('0x42')](_0x5257ff[_0x9cbd('0x5f')],function(_0xab7d42){_0xab7d42['MailAccountId']=_0x5257ff[_0x9cbd('0x5c')]['id'];return _0xab7d42;});return db['MailApplication'][_0x9cbd('0x8e')](_0x4ade61,{'transaction':_0x448974});});})[_0x9cbd('0x1d')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x5257ff['params']['id']},'order':_0x9cbd('0x8f')});});}})[_0x9cbd('0x1d')](respondWithResult(_0x1fa95b,null))[_0x9cbd('0x27')](handleError(_0x1fa95b,null));};exports[_0x9cbd('0x90')]=function(_0x4c20d9,_0x5d635c,_0x3077e3){var _0x214279={};var _0x583b10={};var _0x38ff07;var _0x20f191;return db[_0x9cbd('0x57')][_0x9cbd('0x65')]({'where':{'id':_0x4c20d9[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x5d635c,null))[_0x9cbd('0x1d')](function(_0x451b10){if(_0x451b10){_0x38ff07=_0x451b10;_0x583b10[_0x9cbd('0x46')]=_[_0x9cbd('0x48')](db[_0x9cbd('0x91')][_0x9cbd('0x5d')]);_0x583b10[_0x9cbd('0x47')]=_['keys'](_0x4c20d9[_0x9cbd('0x47')]);_0x583b10[_0x9cbd('0x49')]=_[_0x9cbd('0x4b')](_0x583b10[_0x9cbd('0x46')],_0x583b10[_0x9cbd('0x47')]);_0x214279[_0x9cbd('0x4a')]=_[_0x9cbd('0x4b')](_0x583b10['model'],qs[_0x9cbd('0x4c')](_0x4c20d9[_0x9cbd('0x47')][_0x9cbd('0x4c')]));_0x214279[_0x9cbd('0x4a')]=_0x214279[_0x9cbd('0x4a')]['length']?_0x214279[_0x9cbd('0x4a')]:_0x583b10['model'];_0x214279[_0x9cbd('0x6a')]=qs[_0x9cbd('0x50')](_0x4c20d9[_0x9cbd('0x47')][_0x9cbd('0x50')]);_0x214279[_0x9cbd('0x51')]=qs[_0x9cbd('0x49')](_['pick'](_0x4c20d9[_0x9cbd('0x47')],_0x583b10[_0x9cbd('0x49')]));if(_0x4c20d9[_0x9cbd('0x47')][_0x9cbd('0x53')]){_0x214279[_0x9cbd('0x51')]=_[_0x9cbd('0x54')](_0x214279[_0x9cbd('0x51')],{'$or':_[_0x9cbd('0x42')](_0x214279[_0x9cbd('0x4a')],function(_0x47d4ad){var _0x690276={};_0x690276[_0x47d4ad]={'$like':'%'+_0x4c20d9[_0x9cbd('0x47')][_0x9cbd('0x53')]+'%'};return _0x690276;})});}_0x214279=_[_0x9cbd('0x54')]({},_0x214279,_0x4c20d9[_0x9cbd('0x56')]);return _0x38ff07['getApplications'](_0x214279);}})['then'](function(_0x5db5ed){if(_0x5db5ed){_0x20f191=_0x5db5ed['length'];if(!_0x4c20d9[_0x9cbd('0x47')][_0x9cbd('0x4e')](_0x9cbd('0x4f'))){_0x214279[_0x9cbd('0x2c')]=qs['limit'](_0x4c20d9[_0x9cbd('0x47')][_0x9cbd('0x2c')]);_0x214279[_0x9cbd('0x2b')]=qs['offset'](_0x4c20d9[_0x9cbd('0x47')]['offset']);}return _0x38ff07[_0x9cbd('0x90')](_0x214279);}})[_0x9cbd('0x1d')](function(_0x1aed30){if(_0x1aed30){return _0x1aed30?{'count':_0x20f191,'rows':_0x1aed30}:null;}})[_0x9cbd('0x1d')](respondWithResult(_0x5d635c,null))[_0x9cbd('0x27')](handleError(_0x5d635c,null));};exports['getMessages']=function(_0x2d1594,_0x51f503,_0x783a79){var _0xa9ce7d={'raw':!![],'where':{}};var _0x13f5f6={};var _0x1c816c={'count':0x0,'rows':[]};return db[_0x9cbd('0x57')][_0x9cbd('0x65')]({'where':{'id':_0x2d1594[_0x9cbd('0x5c')]['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x51f503,null))['then'](function(_0x221334){if(_0x221334){_0x13f5f6[_0x9cbd('0x46')]=_['keys'](db[_0x9cbd('0x92')][_0x9cbd('0x5d')]);_0x13f5f6[_0x9cbd('0x47')]=_[_0x9cbd('0x48')](_0x2d1594['query']);_0x13f5f6[_0x9cbd('0x49')]=_[_0x9cbd('0x4b')](_0x13f5f6[_0x9cbd('0x46')],_0x13f5f6[_0x9cbd('0x47')]);_0xa9ce7d[_0x9cbd('0x4a')]=_[_0x9cbd('0x4b')](_0x13f5f6[_0x9cbd('0x46')],qs[_0x9cbd('0x4c')](_0x2d1594[_0x9cbd('0x47')][_0x9cbd('0x4c')]));_0xa9ce7d['attributes']=_0xa9ce7d[_0x9cbd('0x4a')]['length']?_0xa9ce7d[_0x9cbd('0x4a')]:_0x13f5f6[_0x9cbd('0x46')];if(!_0x2d1594[_0x9cbd('0x47')][_0x9cbd('0x4e')](_0x9cbd('0x4f'))){_0xa9ce7d['limit']=qs[_0x9cbd('0x2c')](_0x2d1594[_0x9cbd('0x47')][_0x9cbd('0x2c')]);_0xa9ce7d[_0x9cbd('0x2b')]=qs[_0x9cbd('0x2b')](_0x2d1594[_0x9cbd('0x47')][_0x9cbd('0x2b')]);}_0xa9ce7d[_0x9cbd('0x6a')]=qs[_0x9cbd('0x50')](_0x2d1594[_0x9cbd('0x47')][_0x9cbd('0x50')]);_0xa9ce7d[_0x9cbd('0x51')]=qs[_0x9cbd('0x49')](_['pick'](_0x2d1594[_0x9cbd('0x47')],_0x13f5f6[_0x9cbd('0x49')]));_0xa9ce7d[_0x9cbd('0x51')][_0x9cbd('0x61')]=_0x221334['id'];if(_0x2d1594['query'][_0x9cbd('0x53')]){_0xa9ce7d[_0x9cbd('0x51')]=_[_0x9cbd('0x54')](_0xa9ce7d[_0x9cbd('0x51')],{'$or':_[_0x9cbd('0x42')](_0xa9ce7d[_0x9cbd('0x4a')],function(_0x2f9230){var _0x193bc2={};_0x193bc2[_0x2f9230]={'$like':'%'+_0x2d1594[_0x9cbd('0x47')][_0x9cbd('0x53')]+'%'};return _0x193bc2;})});}if(_0x2d1594[_0x9cbd('0x47')][_0x9cbd('0x93')]){var _0x1c0c82=_0x2d1594[_0x9cbd('0x47')][_0x9cbd('0x93')][_0x9cbd('0x94')](',');var _0x515651={};_0x515651[_0x1c0c82[0x0]]={'$gte':moment(_0x1c0c82[0x1])[_0x9cbd('0x95')](_0x9cbd('0x96'))};_0xa9ce7d['where']=_[_0x9cbd('0x54')](_0xa9ce7d[_0x9cbd('0x51')],_0x515651);}_0xa9ce7d=_['merge']({},_0xa9ce7d,_0x2d1594[_0x9cbd('0x56')]);return db[_0x9cbd('0x92')][_0x9cbd('0x2a')]({'where':_0xa9ce7d['where']})[_0x9cbd('0x1d')](function(_0x32e0e6){_0x1c816c[_0x9cbd('0x2a')]=_0x32e0e6;if(_0x2d1594[_0x9cbd('0x47')][_0x9cbd('0x58')]){_0xa9ce7d['include']=[{'all':!![]}];}return db[_0x9cbd('0x92')][_0x9cbd('0x5a')](_0xa9ce7d);})[_0x9cbd('0x1d')](function(_0xfa16d){_0x1c816c[_0x9cbd('0x66')]=_0xfa16d;return _0x1c816c;});}})['then'](respondWithFilteredResult(_0x51f503,_0xa9ce7d))['catch'](handleError(_0x51f503,null));};exports[_0x9cbd('0x3a')]=function(_0x3f1846,_0x33519c,_0x30fb4d){var _0x1703c8,_0x46ebbb={},_0x3673ea;if(_0x3f1846[_0x9cbd('0x5f')]['to']){_0x3673ea=_0x3f1846[_0x9cbd('0x5f')]['to'][_0x9cbd('0x94')](',')[0x0];}return db['MailAccount'][_0x9cbd('0x5e')]({'where':{'id':_0x3f1846[_0x9cbd('0x5c')]['id']},'include':[{'model':db[_0x9cbd('0x97')],'as':_0x9cbd('0x98'),'include':[{'model':db[_0x9cbd('0x85')],'as':_0x9cbd('0x99'),'where':{'email':_0x3673ea},'limit':0x1,'order':[[_0x9cbd('0x9a'),_0x9cbd('0x9b')]]}]},{'model':db[_0x9cbd('0x3e')],'as':_0x9cbd('0x3f'),'raw':!![]}]})[_0x9cbd('0x1d')](handleEntityNotFound(_0x33519c,null))[_0x9cbd('0x1d')](function(_0x263a95){if(_0x263a95){_0x1703c8=_0x263a95;if(_0x263a95[_0x9cbd('0x3f')]){if(_[_0x9cbd('0x6d')](_0x3f1846[_0x9cbd('0x5f')][_0x9cbd('0x9c')])){_0x3f1846[_0x9cbd('0x5f')][_0x9cbd('0x9c')]=util['format'](_0x9cbd('0x9d'),_0x263a95[_0x9cbd('0x39')],_0x263a95[_0x9cbd('0x9e')]||_0x263a95[_0x9cbd('0x3f')][_0x9cbd('0x6f')]);}if(_0x3f1846['body'][_0x9cbd('0x9f')]&&_0x3f1846[_0x9cbd('0x5f')][_0x9cbd('0x9f')]['length']){for(var _0x5cb454=0x0;_0x5cb454<_0x3f1846[_0x9cbd('0x5f')][_0x9cbd('0x9f')][_0x9cbd('0x4d')];_0x5cb454+=0x1){_0x3f1846[_0x9cbd('0x5f')][_0x9cbd('0x9f')][_0x5cb454]={'filename':_0x3f1846['body']['attachments'][_0x5cb454][_0x9cbd('0x39')],'path':path[_0x9cbd('0xa0')](config[_0x9cbd('0xa1')],_0x9cbd('0xa2'),_0x3f1846['body'][_0x9cbd('0x9f')][_0x5cb454][_0x9cbd('0xa3')])};}}var _0x1ddc97={'tls':{'rejectUnauthorized':![]}};if(_[_0x9cbd('0x6d')](_0x263a95['Smtp']['service'])){if(_0x263a95[_0x9cbd('0x3f')][_0x9cbd('0x73')]){_0x1ddc97[_0x9cbd('0xa4')]={'user':_0x263a95[_0x9cbd('0x3f')][_0x9cbd('0x6f')],'pass':_0x263a95[_0x9cbd('0x3f')]['pass']};}_0x1ddc97[_0x9cbd('0x74')]=_0x263a95[_0x9cbd('0x3f')][_0x9cbd('0x74')];_0x1ddc97[_0x9cbd('0x75')]=_0x263a95[_0x9cbd('0x3f')]['port'];_0x1ddc97['secure']=_0x263a95[_0x9cbd('0x3f')]['secure'];}else{_0x1ddc97[_0x9cbd('0x76')]=_0x263a95[_0x9cbd('0x3f')][_0x9cbd('0x76')];_0x1ddc97[_0x9cbd('0xa4')]={'user':_0x263a95[_0x9cbd('0x3f')][_0x9cbd('0x6f')],'pass':_0x263a95[_0x9cbd('0x3f')][_0x9cbd('0x77')]};}return respondWithRpcPromise(_0x9cbd('0xa5'),_0x9cbd('0xa6'),{'account':_0x1ddc97,'message':_0x3f1846[_0x9cbd('0x5f')]});}else{throw new Error('List\x20not\x20found');}}})[_0x9cbd('0x1d')](function(_0x15b9b8){if(_0x15b9b8){_0x46ebbb=_0x15b9b8;if(_0x1703c8[_0x9cbd('0x98')]){if(_0x1703c8[_0x9cbd('0x98')][_0x9cbd('0x99')][_0x9cbd('0x4d')]){return _0x1703c8['List'][_0x9cbd('0x99')][0x0];}else{return db[_0x9cbd('0x85')][_0x9cbd('0x63')](_[_0x9cbd('0x17')](_0x3f1846[_0x9cbd('0x5f')],{'firstName':_0x3f1846[_0x9cbd('0x5f')]['to'],'email':_0x3f1846[_0x9cbd('0x5f')]['to'],'phone':_0x3f1846[_0x9cbd('0x5f')]['to'],'ListId':_0x1703c8[_0x9cbd('0x6b')]}));}}else{throw new Error(_0x9cbd('0xa7'));}}})[_0x9cbd('0x1d')](function(_0x141f50){if(_0x141f50){var _0x451f19={'UserId':_0x3f1846[_0x9cbd('0x6f')]['id'],'ContactId':_0x141f50['id'],'MailAccountId':_0x1703c8['id'],'inReplyTo':_0x46ebbb[_0x9cbd('0xa8')],'to':_0x3f1846[_0x9cbd('0x5f')][_0x9cbd('0x9c')],'cc':_0x3f1846[_0x9cbd('0x5f')]['cc'],'subject':_0x3f1846['body'][_0x9cbd('0xa9')],'attach':_0x3f1846[_0x9cbd('0x5f')]['attach'],'firstMsgDirection':_0x9cbd('0xaa'),'lastMsgAt':moment()[_0x9cbd('0x95')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x9cbd('0xaa'),'lastMsgBody':_0x3f1846[_0x9cbd('0x5f')][_0x9cbd('0x5f')],'Messages':[_[_0x9cbd('0x54')](_0x3f1846[_0x9cbd('0x5f')],{'messageId':_0x46ebbb[_0x9cbd('0xa8')],'sentAt':moment()[_0x9cbd('0x95')](_0x9cbd('0x96')),'read':!![],'MailAccountId':_0x1703c8['id'],'UserId':_0x3f1846[_0x9cbd('0x6f')]['id'],'ContactId':_0x141f50['id']})]};if(_0x3f1846[_0x9cbd('0x5f')][_0x9cbd('0xab')]){_0x451f19=_[_0x9cbd('0x54')](_0x451f19,_0x3f1846['body'][_0x9cbd('0xab')]);}return db[_0x9cbd('0x84')]['create'](_0x451f19,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0x9cbd('0x1d')](respondWithResult(_0x33519c,null))[_0x9cbd('0x27')](handleError(_0x33519c,null));};exports[_0x9cbd('0xac')]=function(_0x51b23b,_0x443f59,_0x28af1e){return db[_0x9cbd('0x57')]['find']({'where':{'id':_0x51b23b[_0x9cbd('0x5c')]['id']},'include':[{'model':db[_0x9cbd('0x3e')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x443f59,null))[_0x9cbd('0x1d')](function(_0x35d68a){if(_0x35d68a&&_0x35d68a[_0x9cbd('0x3f')]){var _0x5aca2a={'id':_0x35d68a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x35d68a[_0x9cbd('0x3f')]['service']){_0x5aca2a['service']=_0x35d68a[_0x9cbd('0x3f')][_0x9cbd('0x76')];}else{_0x5aca2a['host']=_0x35d68a[_0x9cbd('0x3f')]['host'];_0x5aca2a[_0x9cbd('0x75')]=_0x35d68a[_0x9cbd('0x3f')][_0x9cbd('0x75')];_0x5aca2a[_0x9cbd('0xad')]=_0x35d68a['Smtp'][_0x9cbd('0xad')];}if(_0x35d68a[_0x9cbd('0x3f')][_0x9cbd('0x73')]){_0x5aca2a[_0x9cbd('0xa4')]={'user':_0x35d68a[_0x9cbd('0x3f')][_0x9cbd('0x6f')],'pass':_0x35d68a[_0x9cbd('0x3f')][_0x9cbd('0x77')]};}return respondWithRpcPromise(_0x9cbd('0xae'),_0x9cbd('0xac'),{'account':_0x5aca2a});}})[_0x9cbd('0x1d')](respondWithResult(_0x443f59,null))[_0x9cbd('0x27')](handleError(_0x443f59,null));};exports[_0x9cbd('0x8d')]=function(_0x40fcc1,_0x2de9d4){return db[_0x9cbd('0x57')]['find']({'where':{'id':_0x40fcc1[_0x9cbd('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2de9d4,null))[_0x9cbd('0x1d')](function(_0x13f5b7){if(_0x13f5b7&&_0x13f5b7[_0x9cbd('0x76')]){throw new db[(_0x9cbd('0x1a'))][(_0x9cbd('0x1b'))](_0x9cbd('0xaf'));}return _0x13f5b7;})[_0x9cbd('0x1d')](removeEntity(_0x2de9d4,null))[_0x9cbd('0x27')](handleError(_0x2de9d4,null));};exports[_0x9cbd('0xb0')]=function(_0x22160a,_0x365502,_0x2b4e3d){return db[_0x9cbd('0x57')][_0x9cbd('0x5e')]({'where':{'id':_0x22160a['params']['id']}})[_0x9cbd('0x1d')](handleEntityNotFound(_0x365502,null))[_0x9cbd('0x1d')](function(_0x1946a0){if(_0x1946a0){return _0x1946a0[_0x9cbd('0xb0')](_0x22160a['body'][_0x9cbd('0x68')],_[_0x9cbd('0x82')](_0x22160a[_0x9cbd('0x5f')],['ids','id'])||{})[_0x9cbd('0xb1')](function(_0xdb0d36){for(var _0x4e92dd=0x0;_0x4e92dd<_0x22160a[_0x9cbd('0x5f')][_0x9cbd('0x68')][_0x9cbd('0x4d')];_0x4e92dd+=0x1){socket[_0x9cbd('0xb2')](_0x9cbd('0xb3'),{'UserId':_0x22160a['body'][_0x9cbd('0x68')][_0x4e92dd],'MailAccountId':_0x22160a[_0x9cbd('0x5c')]['id']});}return _0xdb0d36;});}})[_0x9cbd('0x1d')](respondWithResult(_0x365502,null))['catch'](handleError(_0x365502,null));};exports['removeAgents']=function(_0x254917,_0x3b44b6,_0x2e6b7e){return db['MailAccount']['find']({'where':{'id':_0x254917['params']['id']}})['then'](handleEntityNotFound(_0x3b44b6,null))[_0x9cbd('0x1d')](function(_0x51dde9){if(_0x51dde9){return _0x51dde9[_0x9cbd('0xb4')](_0x254917[_0x9cbd('0x47')][_0x9cbd('0x68')])[_0x9cbd('0x1d')](function(){if(_[_0x9cbd('0xb5')](_0x254917['query'][_0x9cbd('0x68')])){for(var _0x310cdc=0x0;_0x310cdc<_0x254917[_0x9cbd('0x47')]['ids']['length'];_0x310cdc+=0x1){socket['emit'](_0x9cbd('0xb6'),{'UserId':Number(_0x254917['query'][_0x9cbd('0x68')][_0x310cdc]),'MailAccountId':Number(_0x254917[_0x9cbd('0x5c')]['id'])});}}else{socket['emit'](_0x9cbd('0xb6'),{'UserId':Number(_0x254917[_0x9cbd('0x47')]['ids']),'MailAccountId':Number(_0x254917['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3b44b6,null))['catch'](handleError(_0x3b44b6,null));};exports[_0x9cbd('0xb7')]=function(_0x220894,_0x1106b8,_0x38a337){var _0x165b99={};var _0x37ee75={};var _0x41687b;var _0x50f38b;return db[_0x9cbd('0x57')]['findOne']({'where':{'id':_0x220894[_0x9cbd('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1106b8,null))[_0x9cbd('0x1d')](function(_0x5d9802){if(_0x5d9802){_0x41687b=_0x5d9802;_0x37ee75[_0x9cbd('0x46')]=_['keys'](db[_0x9cbd('0xb8')][_0x9cbd('0x5d')]);_0x37ee75[_0x9cbd('0x47')]=_[_0x9cbd('0x48')](_0x220894[_0x9cbd('0x47')]);_0x37ee75[_0x9cbd('0x49')]=_[_0x9cbd('0x4b')](_0x37ee75['model'],_0x37ee75[_0x9cbd('0x47')]);_0x165b99[_0x9cbd('0x4a')]=_[_0x9cbd('0x4b')](_0x37ee75[_0x9cbd('0x46')],qs[_0x9cbd('0x4c')](_0x220894['query'][_0x9cbd('0x4c')]));_0x165b99['attributes']=_0x165b99['attributes']['length']?_0x165b99[_0x9cbd('0x4a')]:_0x37ee75['model'];_0x165b99[_0x9cbd('0x6a')]=qs[_0x9cbd('0x50')](_0x220894[_0x9cbd('0x47')][_0x9cbd('0x50')]);_0x165b99[_0x9cbd('0x51')]=qs[_0x9cbd('0x49')](_[_0x9cbd('0x52')](_0x220894[_0x9cbd('0x47')],_0x37ee75[_0x9cbd('0x49')]));if(_0x220894[_0x9cbd('0x47')][_0x9cbd('0x53')]){_0x165b99[_0x9cbd('0x51')]=_[_0x9cbd('0x54')](_0x165b99[_0x9cbd('0x51')],{'$or':_[_0x9cbd('0x42')](_0x165b99['attributes'],function(_0x1d173f){var _0x5abc80={};_0x5abc80[_0x1d173f]={'$like':'%'+_0x220894[_0x9cbd('0x47')][_0x9cbd('0x53')]+'%'};return _0x5abc80;})});}_0x165b99=_[_0x9cbd('0x54')]({},_0x165b99,_0x220894['options']);return _0x41687b[_0x9cbd('0xb7')](_0x165b99);}})[_0x9cbd('0x1d')](function(_0x1d233b){if(_0x1d233b){_0x50f38b=_0x1d233b[_0x9cbd('0x4d')];if(!_0x220894['query'][_0x9cbd('0x4e')](_0x9cbd('0x4f'))){_0x165b99['limit']=qs['limit'](_0x220894[_0x9cbd('0x47')][_0x9cbd('0x2c')]);_0x165b99[_0x9cbd('0x2b')]=qs[_0x9cbd('0x2b')](_0x220894[_0x9cbd('0x47')][_0x9cbd('0x2b')]);}return _0x41687b[_0x9cbd('0xb7')](_0x165b99);}})[_0x9cbd('0x1d')](function(_0x522537){if(_0x522537){return _0x522537?{'count':_0x50f38b,'rows':_0x522537}:null;}})['then'](respondWithResult(_0x1106b8,null))[_0x9cbd('0x27')](handleError(_0x1106b8,null));}; \ No newline at end of file +var _0x1e4f=['removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','defaults','redis','socket.io-emitter','./mailAccount.socket','register','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','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','MailServerIn','Imap','Smtp','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailAccount','includeAll','include','findAll','rows','show','params','MailServerOut','rawAttributes','body','find','Pause','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','active','description','isNil','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','cservice','role','get','UserProfileSection','MailAccounts','autoAssociation','getImap','addImap','setImap','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','tag','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','server/files/attachments','basename','service','auth','secure','SendMail','List\x20not\x20found','List','subject','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit'];(function(_0x2bf659,_0x3abc58){var _0x324128=function(_0x470fce){while(--_0x470fce){_0x2bf659['push'](_0x2bf659['shift']());}};_0x324128(++_0x3abc58);}(_0x1e4f,0x178));var _0xf1e4=function(_0x5c3fac,_0x5f0267){_0x5c3fac=_0x5c3fac-0x0;var _0x382099=_0x1e4f[_0x5c3fac];return _0x382099;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf1e4('0x0'));var rimraf=require(_0xf1e4('0x1'));var zipdir=require(_0xf1e4('0x2'));var jsonpatch=require(_0xf1e4('0x3'));var rp=require(_0xf1e4('0x4'));var moment=require('moment');var BPromise=require(_0xf1e4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf1e4('0x6'));var sox=require(_0xf1e4('0x7'));var csv=require(_0xf1e4('0x8'));var ejs=require(_0xf1e4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf1e4('0xa'));var jsforce=require(_0xf1e4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf1e4('0x8'));var querystring=require(_0xf1e4('0xc'));var Papa=require(_0xf1e4('0xd'));var Redis=require(_0xf1e4('0xe'));var authService=require(_0xf1e4('0xf'));var qs=require(_0xf1e4('0x10'));var as=require(_0xf1e4('0x11'));var hardwareService=require(_0xf1e4('0x12'));var logger=require(_0xf1e4('0x13'))('api');var utils=require(_0xf1e4('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf1e4('0x15')](config[_0xf1e4('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xf1e4('0x17'))(new Redis(config['redis']));require(_0xf1e4('0x18'))[_0xf1e4('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf1e4('0x1a')][_0xf1e4('0x1b')]({'port':0x232b});function checkPasswordPattern(_0x2c8509,_0x1b6940,_0xedb37e){if(_0xedb37e){var _0x510b27=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x510b27[_0xf1e4('0x1c')](_0x1b6940)){return _0x2c8509;}else{throw new db[(_0xf1e4('0x1d'))][(_0xf1e4('0x1e'))](_0xf1e4('0x1f'));}}else{return _0x2c8509;}}function respondWithRpcPromise(_0x5e8631,_0x446678,_0x395bbc,_0x11f52c){return new BPromise(function(_0x3636a9,_0x3d1c2e){var _0x265537=_0x11f52c||client;return _0x265537[_0xf1e4('0x20')](_0x5e8631,_0x395bbc)[_0xf1e4('0x21')](function(_0x5ae31e){logger[_0xf1e4('0x22')](_0xf1e4('0x23'),_0x446678,'request\x20sent');logger[_0xf1e4('0x24')](_0xf1e4('0x25'),_0x446678,_0xf1e4('0x26'),JSON[_0xf1e4('0x27')](_0x5ae31e));if(_0x5ae31e[_0xf1e4('0x28')]){if(_0x5ae31e['error'][_0xf1e4('0x29')]===0x1f4){logger[_0xf1e4('0x28')]('MailAccount,\x20%s,\x20%s',_0x446678,_0x5ae31e[_0xf1e4('0x28')][_0xf1e4('0x2a')]);return _0x3d1c2e(_0x5ae31e[_0xf1e4('0x28')][_0xf1e4('0x2a')]);}logger[_0xf1e4('0x28')](_0xf1e4('0x23'),_0x446678,_0x5ae31e[_0xf1e4('0x28')][_0xf1e4('0x2a')]);return _0x3636a9(_0x5ae31e[_0xf1e4('0x28')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x446678,_0xf1e4('0x26'));_0x3636a9(_0x5ae31e['result'][_0xf1e4('0x2a')]);}})[_0xf1e4('0x2b')](function(_0x3544c0){logger[_0xf1e4('0x28')](_0xf1e4('0x23'),_0x446678,_0x3544c0);_0x3d1c2e(_0x3544c0);});});}function respondWithStatusCode(_0x1bc4bc,_0x186cbf){_0x186cbf=_0x186cbf||0xcc;return function(_0x105a9a){if(_0x105a9a){return _0x1bc4bc[_0xf1e4('0x2c')](_0x186cbf);}return _0x1bc4bc[_0xf1e4('0x2d')](_0x186cbf)[_0xf1e4('0x2e')]();};}function respondWithResult(_0x3e2361,_0x53ea20){_0x53ea20=_0x53ea20||0xc8;return function(_0xa76b10){if(_0xa76b10){return _0x3e2361[_0xf1e4('0x2d')](_0x53ea20)[_0xf1e4('0x2f')](_0xa76b10);}};}function respondWithFilteredResult(_0x4b8b69,_0x3b624f){return function(_0x2b0aff){if(_0x2b0aff){var _0x9d2162=_0x2b0aff[_0xf1e4('0x30')],_0x2877a7=_0x3b624f[_0xf1e4('0x31')],_0x2a4a4f=_0x3b624f[_0xf1e4('0x31')]+_0x3b624f[_0xf1e4('0x32')],_0x525da5;if(_0x2a4a4f>=_0x9d2162){_0x2a4a4f=_0x9d2162;_0x525da5=0xc8;}else{_0x525da5=0xce;}_0x4b8b69[_0xf1e4('0x2d')](_0x525da5);return _0x4b8b69[_0xf1e4('0x33')](_0xf1e4('0x34'),_0x2877a7+'-'+_0x2a4a4f+'/'+_0x9d2162)[_0xf1e4('0x2f')](_0x2b0aff);}return null;};}function patchUpdates(_0x220091){return function(_0x374d89){try{jsonpatch[_0xf1e4('0x35')](_0x374d89,_0x220091,!![]);}catch(_0x965005){return BPromise[_0xf1e4('0x36')](_0x965005);}return _0x374d89[_0xf1e4('0x37')]();};}function saveUpdates(_0x5028d0,_0x3541b2){return function(_0x191f59){if(_0x191f59){return _0x191f59[_0xf1e4('0x38')](_0x5028d0)['then'](function(_0x562862){return _0x562862;});}return null;};}function removeEntity(_0x4b587e,_0x35b23a){return function(_0x38ce96){if(_0x38ce96){return _0x38ce96[_0xf1e4('0x39')]()['then'](function(){var _0x1aeee8=_0x38ce96['get']({'plain':!![]});var _0x527149='MailAccounts';return db['UserProfileResource'][_0xf1e4('0x39')]({'where':{'type':_0x527149,'resourceId':_0x1aeee8['id']}})[_0xf1e4('0x21')](function(){return _0x38ce96;});})[_0xf1e4('0x21')](function(){_0x4b587e[_0xf1e4('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a49ab,_0x412176){return function(_0x1eb56f){if(!_0x1eb56f){_0x1a49ab[_0xf1e4('0x2c')](0x194);}return _0x1eb56f;};}function handleError(_0x4ed9e8,_0x5e5bff){_0x5e5bff=_0x5e5bff||0x1f4;return function(_0x2b1e39){logger[_0xf1e4('0x28')](_0x2b1e39[_0xf1e4('0x3a')]);if(_0x2b1e39[_0xf1e4('0x3b')]){delete _0x2b1e39['name'];}_0x4ed9e8['status'](_0x5e5bff)[_0xf1e4('0x3c')](_0x2b1e39);};}exports['index']=function(_0x558090,_0x5face5){var _0x37e9d5={'include':[{'model':db[_0xf1e4('0x3d')],'as':_0xf1e4('0x3e')},{'model':db['MailServerOut'],'as':_0xf1e4('0x3f')},{'model':db['Pause'],'as':_0xf1e4('0x40')}]},_0x1f4457={},_0x24ba4a={'count':0x0,'rows':[]};var _0x5c6787=_[_0xf1e4('0x41')](db['MailAccount']['rawAttributes'],function(_0x180857){return{'name':_0x180857[_0xf1e4('0x42')],'type':_0x180857[_0xf1e4('0x43')][_0xf1e4('0x44')]};});_0x1f4457[_0xf1e4('0x45')]=_['map'](_0x5c6787,_0xf1e4('0x3b'));_0x1f4457[_0xf1e4('0x46')]=_[_0xf1e4('0x47')](_0x558090[_0xf1e4('0x46')]);_0x1f4457[_0xf1e4('0x48')]=_[_0xf1e4('0x49')](_0x1f4457[_0xf1e4('0x45')],_0x1f4457[_0xf1e4('0x46')]);_0x37e9d5[_0xf1e4('0x4a')]=_[_0xf1e4('0x49')](_0x1f4457[_0xf1e4('0x45')],qs[_0xf1e4('0x4b')](_0x558090[_0xf1e4('0x46')][_0xf1e4('0x4b')]));_0x37e9d5[_0xf1e4('0x4a')]=_0x37e9d5[_0xf1e4('0x4a')][_0xf1e4('0x4c')]?_0x37e9d5['attributes']:_0x1f4457[_0xf1e4('0x45')];if(!_0x558090[_0xf1e4('0x46')][_0xf1e4('0x4d')](_0xf1e4('0x4e'))){_0x37e9d5[_0xf1e4('0x32')]=qs[_0xf1e4('0x32')](_0x558090[_0xf1e4('0x46')][_0xf1e4('0x32')]);_0x37e9d5[_0xf1e4('0x31')]=qs[_0xf1e4('0x31')](_0x558090[_0xf1e4('0x46')][_0xf1e4('0x31')]);}_0x37e9d5[_0xf1e4('0x4f')]=qs[_0xf1e4('0x50')](_0x558090[_0xf1e4('0x46')][_0xf1e4('0x50')]);_0x37e9d5['where']=qs[_0xf1e4('0x48')](_[_0xf1e4('0x51')](_0x558090[_0xf1e4('0x46')],_0x1f4457[_0xf1e4('0x48')]),_0x5c6787);if(_0x558090[_0xf1e4('0x46')][_0xf1e4('0x52')]){_0x37e9d5[_0xf1e4('0x53')]=_[_0xf1e4('0x54')](_0x37e9d5[_0xf1e4('0x53')],{'$or':_['map'](_0x5c6787,function(_0x1cf7f9){if(_0x1cf7f9[_0xf1e4('0x43')]!==_0xf1e4('0x55')){var _0x1b74a6={};_0x1b74a6[_0x1cf7f9['name']]={'$like':'%'+_0x558090[_0xf1e4('0x46')][_0xf1e4('0x52')]+'%'};return _0x1b74a6;}})});}_0x37e9d5=_[_0xf1e4('0x54')]({},_0x37e9d5,_0x558090[_0xf1e4('0x56')]);var _0x5ecede={'where':_0x37e9d5[_0xf1e4('0x53')]};return db[_0xf1e4('0x57')][_0xf1e4('0x30')](_0x5ecede)['then'](function(_0x5b6158){_0x24ba4a[_0xf1e4('0x30')]=_0x5b6158;if(_0x558090[_0xf1e4('0x46')][_0xf1e4('0x58')]){_0x37e9d5[_0xf1e4('0x59')]=[{'all':!![]}];}return db['MailAccount'][_0xf1e4('0x5a')](_0x37e9d5);})[_0xf1e4('0x21')](function(_0x1b373b){_0x24ba4a[_0xf1e4('0x5b')]=_0x1b373b;return _0x24ba4a;})[_0xf1e4('0x21')](respondWithFilteredResult(_0x5face5,_0x37e9d5))['catch'](handleError(_0x5face5,null));};exports[_0xf1e4('0x5c')]=function(_0x431392,_0x3edce7){var _0x44d3eb={'raw':![],'where':{'id':_0x431392[_0xf1e4('0x5d')]['id']},'include':[{'model':db[_0xf1e4('0x3d')],'as':_0xf1e4('0x3e')},{'model':db[_0xf1e4('0x5e')],'as':_0xf1e4('0x3f')},{'model':db['Pause'],'as':_0xf1e4('0x40')}]},_0x104fe7={};_0x104fe7[_0xf1e4('0x45')]=_[_0xf1e4('0x47')](db[_0xf1e4('0x57')][_0xf1e4('0x5f')]);_0x104fe7[_0xf1e4('0x46')]=_[_0xf1e4('0x47')](_0x431392[_0xf1e4('0x46')]);_0x104fe7[_0xf1e4('0x48')]=_['intersection'](_0x104fe7['model'],_0x104fe7[_0xf1e4('0x46')]);_0x44d3eb[_0xf1e4('0x4a')]=_[_0xf1e4('0x49')](_0x104fe7[_0xf1e4('0x45')],qs[_0xf1e4('0x4b')](_0x431392[_0xf1e4('0x46')][_0xf1e4('0x4b')]));_0x44d3eb[_0xf1e4('0x4a')]=_0x44d3eb[_0xf1e4('0x4a')]['length']?_0x44d3eb[_0xf1e4('0x4a')]:_0x104fe7[_0xf1e4('0x45')];if(_0x431392[_0xf1e4('0x46')][_0xf1e4('0x58')]){_0x44d3eb[_0xf1e4('0x59')]=[{'all':!![]}];}_0x44d3eb=_[_0xf1e4('0x54')]({},_0x44d3eb,_0x431392['options']);return db[_0xf1e4('0x57')]['find'](_0x44d3eb)['then'](handleEntityNotFound(_0x3edce7,null))['then'](respondWithResult(_0x3edce7,null))[_0xf1e4('0x2b')](handleError(_0x3edce7,null));};exports[_0xf1e4('0x38')]=function(_0x965e6d,_0x1e807b){if(_0x965e6d[_0xf1e4('0x60')]['id']){delete _0x965e6d[_0xf1e4('0x60')]['id'];}return db[_0xf1e4('0x57')][_0xf1e4('0x61')]({'where':{'id':_0x965e6d[_0xf1e4('0x5d')]['id']},'include':[{'model':db[_0xf1e4('0x3d')],'as':'Imap'},{'model':db[_0xf1e4('0x5e')],'as':'Smtp'},{'model':db[_0xf1e4('0x62')],'as':_0xf1e4('0x40')}]})[_0xf1e4('0x21')](handleEntityNotFound(_0x1e807b,null))[_0xf1e4('0x21')](saveUpdates(_0x965e6d[_0xf1e4('0x60')],null))[_0xf1e4('0x21')](function(_0x16d797){if(_0x16d797&&_0x965e6d['body']['Imap']){return db[_0xf1e4('0x3d')][_0xf1e4('0x38')](_0x965e6d[_0xf1e4('0x60')][_0xf1e4('0x3e')],{'where':{'MailAccountId':_0x16d797['id']}})['then'](function(){return _0x16d797;});}return _0x16d797;})[_0xf1e4('0x21')](function(_0x27c8d7){if(_0x27c8d7&&_0x965e6d['body'][_0xf1e4('0x3f')]){return db[_0xf1e4('0x5e')][_0xf1e4('0x38')](_0x965e6d[_0xf1e4('0x60')]['Smtp'],{'where':{'MailAccountId':_0x27c8d7['id']}})[_0xf1e4('0x21')](function(){return _0x27c8d7;});}return _0x27c8d7;})[_0xf1e4('0x21')](respondWithResult(_0x1e807b,null))['catch'](handleError(_0x1e807b,null));};exports['describe']=function(_0x21d5be,_0x356638){return db['MailAccount'][_0xf1e4('0x63')]()[_0xf1e4('0x21')](respondWithResult(_0x356638,null))[_0xf1e4('0x2b')](handleError(_0x356638,null));};exports[_0xf1e4('0x64')]=function(_0x2c4ae8,_0x23d9cc,_0x352a30){if(_0x2c4ae8['body']['id']){delete _0x2c4ae8[_0xf1e4('0x60')]['id'];}return db['MailAccount'][_0xf1e4('0x61')]({'where':{'id':_0x2c4ae8[_0xf1e4('0x5d')]['id']}})['then'](handleEntityNotFound(_0x23d9cc,null))[_0xf1e4('0x21')](function(_0x1a22c){if(_0x1a22c){_0x2c4ae8['body'][_0xf1e4('0x65')]=_0x1a22c['id'];return db[_0xf1e4('0x66')][_0xf1e4('0x67')](_0x2c4ae8['body']);}})[_0xf1e4('0x21')](respondWithResult(_0x23d9cc,null))[_0xf1e4('0x2b')](handleError(_0x23d9cc,null));};exports[_0xf1e4('0x68')]=function(_0x5aef6d,_0x598190,_0x36b23c){var _0x5a2822={'raw':![],'where':{}};var _0x1a1b25={};var _0x4b0487={'count':0x0,'rows':[]};return db[_0xf1e4('0x57')][_0xf1e4('0x69')]({'where':{'id':_0x5aef6d['params']['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x598190,null))[_0xf1e4('0x21')](function(_0x3b5d6a){if(_0x3b5d6a){_0x1a1b25[_0xf1e4('0x45')]=_[_0xf1e4('0x47')](db[_0xf1e4('0x66')][_0xf1e4('0x5f')]);_0x1a1b25[_0xf1e4('0x46')]=_[_0xf1e4('0x47')](_0x5aef6d['query']);_0x1a1b25[_0xf1e4('0x48')]=_['intersection'](_0x1a1b25[_0xf1e4('0x45')],_0x1a1b25[_0xf1e4('0x46')]);_0x5a2822['attributes']=_[_0xf1e4('0x49')](_0x1a1b25[_0xf1e4('0x45')],qs[_0xf1e4('0x4b')](_0x5aef6d[_0xf1e4('0x46')][_0xf1e4('0x4b')]));_0x5a2822[_0xf1e4('0x4a')]=_0x5a2822[_0xf1e4('0x4a')][_0xf1e4('0x4c')]?_0x5a2822[_0xf1e4('0x4a')]:_0x1a1b25[_0xf1e4('0x45')];if(!_0x5aef6d[_0xf1e4('0x46')]['hasOwnProperty'](_0xf1e4('0x4e'))){_0x5a2822[_0xf1e4('0x32')]=qs[_0xf1e4('0x32')](_0x5aef6d['query'][_0xf1e4('0x32')]);_0x5a2822[_0xf1e4('0x31')]=qs['offset'](_0x5aef6d[_0xf1e4('0x46')]['offset']);}_0x5a2822[_0xf1e4('0x4f')]=qs['sort'](_0x5aef6d[_0xf1e4('0x46')][_0xf1e4('0x50')]);_0x5a2822[_0xf1e4('0x53')]=qs[_0xf1e4('0x48')](_[_0xf1e4('0x51')](_0x5aef6d['query'],_0x1a1b25[_0xf1e4('0x48')]));_0x5a2822[_0xf1e4('0x53')][_0xf1e4('0x65')]=_0x3b5d6a['id'];if(_0x5aef6d['query'][_0xf1e4('0x52')]){_0x5a2822[_0xf1e4('0x53')]=_[_0xf1e4('0x54')](_0x5a2822['where'],{'$or':_[_0xf1e4('0x41')](_0x5a2822['attributes'],function(_0x59faa8){var _0x154906={};_0x154906[_0x59faa8]={'$like':'%'+_0x5aef6d[_0xf1e4('0x46')][_0xf1e4('0x52')]+'%'};return _0x154906;})});}_0x5a2822=_[_0xf1e4('0x54')]({},_0x5a2822,_0x5aef6d[_0xf1e4('0x56')]);return db[_0xf1e4('0x66')][_0xf1e4('0x30')]({'where':_0x5a2822[_0xf1e4('0x53')]})['then'](function(_0xa1ff06){_0x4b0487[_0xf1e4('0x30')]=_0xa1ff06;if(_0x5aef6d[_0xf1e4('0x46')]['includeAll']){_0x5a2822[_0xf1e4('0x59')]=[{'all':!![]}];}return db[_0xf1e4('0x66')][_0xf1e4('0x5a')](_0x5a2822);})['then'](function(_0x71af76){_0x4b0487['rows']=_0x71af76;return _0x4b0487;});}})[_0xf1e4('0x21')](respondWithFilteredResult(_0x598190,_0x5a2822))[_0xf1e4('0x2b')](handleError(_0x598190,null));};exports[_0xf1e4('0x6a')]=function(_0x525eda,_0x4a5cc4,_0x4e3efc){return db[_0xf1e4('0x57')][_0xf1e4('0x61')]({'where':{'id':_0x525eda[_0xf1e4('0x5d')]['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x4a5cc4,null))[_0xf1e4('0x21')](function(_0x35a729){if(_0x35a729){return _0x35a729[_0xf1e4('0x6a')](_0x525eda[_0xf1e4('0x46')][_0xf1e4('0x6b')]);}})[_0xf1e4('0x21')](respondWithStatusCode(_0x4a5cc4,null))['catch'](handleError(_0x4a5cc4,null));};exports[_0xf1e4('0x6c')]=function(_0x185f64,_0xe546ee,_0x4ade0c){if(_0x185f64[_0xf1e4('0x60')]['id']){delete _0x185f64[_0xf1e4('0x60')]['id'];}return db['MailAccount'][_0xf1e4('0x61')]({'where':{'id':_0x185f64[_0xf1e4('0x5d')]['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0xe546ee,null))[_0xf1e4('0x21')](function(_0x5e49ca){if(_0x5e49ca){_0x185f64[_0xf1e4('0x60')][_0xf1e4('0x65')]=_0x5e49ca['id'];return db[_0xf1e4('0x6d')][_0xf1e4('0x67')](_0x185f64['body']);}})['then'](respondWithResult(_0xe546ee,null))[_0xf1e4('0x2b')](handleError(_0xe546ee,null));};exports['getAnswers']=function(_0x35a1dd,_0x549413,_0x285584){var _0x5fabba={'raw':![],'where':{}};var _0x31305a={};var _0x25f2df={'count':0x0,'rows':[]};return db[_0xf1e4('0x57')][_0xf1e4('0x69')]({'where':{'id':_0x35a1dd['params']['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x549413,null))[_0xf1e4('0x21')](function(_0x306ea8){if(_0x306ea8){_0x31305a[_0xf1e4('0x45')]=_['keys'](db[_0xf1e4('0x6d')]['rawAttributes']);_0x31305a[_0xf1e4('0x46')]=_['keys'](_0x35a1dd['query']);_0x31305a[_0xf1e4('0x48')]=_['intersection'](_0x31305a[_0xf1e4('0x45')],_0x31305a[_0xf1e4('0x46')]);_0x5fabba[_0xf1e4('0x4a')]=_['intersection'](_0x31305a[_0xf1e4('0x45')],qs[_0xf1e4('0x4b')](_0x35a1dd[_0xf1e4('0x46')][_0xf1e4('0x4b')]));_0x5fabba[_0xf1e4('0x4a')]=_0x5fabba['attributes'][_0xf1e4('0x4c')]?_0x5fabba['attributes']:_0x31305a[_0xf1e4('0x45')];if(!_0x35a1dd[_0xf1e4('0x46')][_0xf1e4('0x4d')](_0xf1e4('0x4e'))){_0x5fabba[_0xf1e4('0x32')]=qs[_0xf1e4('0x32')](_0x35a1dd['query'][_0xf1e4('0x32')]);_0x5fabba[_0xf1e4('0x31')]=qs[_0xf1e4('0x31')](_0x35a1dd[_0xf1e4('0x46')][_0xf1e4('0x31')]);}_0x5fabba[_0xf1e4('0x4f')]=qs['sort'](_0x35a1dd[_0xf1e4('0x46')][_0xf1e4('0x50')]);_0x5fabba[_0xf1e4('0x53')]=qs[_0xf1e4('0x48')](_[_0xf1e4('0x51')](_0x35a1dd['query'],_0x31305a[_0xf1e4('0x48')]));_0x5fabba['where']['MailAccountId']=_0x306ea8['id'];if(_0x35a1dd['query'][_0xf1e4('0x52')]){_0x5fabba[_0xf1e4('0x53')]=_[_0xf1e4('0x54')](_0x5fabba[_0xf1e4('0x53')],{'$or':_[_0xf1e4('0x41')](_0x5fabba['attributes'],function(_0x1ecb6f){var _0x562dc5={};_0x562dc5[_0x1ecb6f]={'$like':'%'+_0x35a1dd['query']['filter']+'%'};return _0x562dc5;})});}_0x5fabba=_[_0xf1e4('0x54')]({},_0x5fabba,_0x35a1dd['options']);return db[_0xf1e4('0x6d')][_0xf1e4('0x30')]({'where':_0x5fabba[_0xf1e4('0x53')]})[_0xf1e4('0x21')](function(_0x29f666){_0x25f2df[_0xf1e4('0x30')]=_0x29f666;if(_0x35a1dd[_0xf1e4('0x46')][_0xf1e4('0x58')]){_0x5fabba[_0xf1e4('0x59')]=[{'all':!![]}];}return db[_0xf1e4('0x6d')][_0xf1e4('0x5a')](_0x5fabba);})[_0xf1e4('0x21')](function(_0x2c2064){_0x25f2df[_0xf1e4('0x5b')]=_0x2c2064;return _0x25f2df;});}})['then'](respondWithFilteredResult(_0x549413,_0x5fabba))['catch'](handleError(_0x549413,null));};exports['removeAnswers']=function(_0x45920e,_0x5ef120,_0x80030e){return db[_0xf1e4('0x57')][_0xf1e4('0x61')]({'where':{'id':_0x45920e['params']['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x5ef120,null))[_0xf1e4('0x21')](function(_0x475e3e){if(_0x475e3e){return _0x475e3e[_0xf1e4('0x6e')](_0x45920e[_0xf1e4('0x46')][_0xf1e4('0x6b')]);}})[_0xf1e4('0x21')](respondWithStatusCode(_0x5ef120,null))['catch'](handleError(_0x5ef120,null));};exports['create']=function(_0x3262e6,_0x5e1deb){var _0x224884={'name':_0x3262e6['body'][_0xf1e4('0x3b')],'key':_0x3262e6[_0xf1e4('0x60')]['key'],'email':_0x3262e6[_0xf1e4('0x60')][_0xf1e4('0x6f')],'ListId':_0x3262e6[_0xf1e4('0x60')]['ListId'],'active':!_['isNil'](_0x3262e6['body']['active'])?_0x3262e6['body'][_0xf1e4('0x70')]:!![],'description':_0x3262e6[_0xf1e4('0x60')][_0xf1e4('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0xf1e4('0x72')](_0x3262e6[_0xf1e4('0x60')]['cservice'])){if(_0x3262e6['body'][_0xf1e4('0x73')]){_0x224884[_0xf1e4('0x3e')]['user']=_0x224884[_0xf1e4('0x3f')][_0xf1e4('0x74')]=_0x3262e6[_0xf1e4('0x60')][_0xf1e4('0x75')];_0x224884[_0xf1e4('0x3e')][_0xf1e4('0x76')]=_0x224884[_0xf1e4('0x3f')][_0xf1e4('0x77')]=_0x3262e6[_0xf1e4('0x60')][_0xf1e4('0x78')];}else{_0x224884[_0xf1e4('0x3e')][_0xf1e4('0x79')]=_0x224884[_0xf1e4('0x3f')][_0xf1e4('0x79')]=![];}_0x224884[_0xf1e4('0x3e')][_0xf1e4('0x7a')]=_0x3262e6[_0xf1e4('0x60')][_0xf1e4('0x3e')][_0xf1e4('0x7a')];_0x224884[_0xf1e4('0x3e')][_0xf1e4('0x7b')]=_0x3262e6['body'][_0xf1e4('0x3e')][_0xf1e4('0x7b')];_0x224884[_0xf1e4('0x3f')][_0xf1e4('0x7a')]=_0x3262e6[_0xf1e4('0x60')][_0xf1e4('0x3f')][_0xf1e4('0x7a')];_0x224884['Smtp'][_0xf1e4('0x7b')]=_0x3262e6[_0xf1e4('0x60')]['Smtp']['port'];}else{_0x224884['Imap']['service']=_0x224884[_0xf1e4('0x3f')]['service']=_0x3262e6['body'][_0xf1e4('0x7c')];_0x224884[_0xf1e4('0x3e')][_0xf1e4('0x74')]=_0x224884[_0xf1e4('0x3f')][_0xf1e4('0x74')]=_0x3262e6[_0xf1e4('0x60')][_0xf1e4('0x75')];_0x224884[_0xf1e4('0x3e')]['password']=_0x224884[_0xf1e4('0x3f')]['pass']=_0x3262e6['body'][_0xf1e4('0x78')];}return db[_0xf1e4('0x57')][_0xf1e4('0x67')](_0x224884,{'include':[{'model':db[_0xf1e4('0x5e')],'as':_0xf1e4('0x3f')},{'model':db[_0xf1e4('0x3d')],'as':_0xf1e4('0x3e')}]})[_0xf1e4('0x21')](function(_0x301ff0){var _0x2d7894=_0x3262e6['user']['get']({'plain':!![]});if(!_0x2d7894)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d7894[_0xf1e4('0x7d')]==='user'){var _0x549ba7=_0x301ff0[_0xf1e4('0x7e')]({'plain':!![]});return db[_0xf1e4('0x7f')][_0xf1e4('0x61')]({'where':{'name':_0xf1e4('0x80'),'userProfileId':_0x2d7894['userProfileId']},'raw':!![]})[_0xf1e4('0x21')](function(_0x1ee0c1){if(_0x1ee0c1&&_0x1ee0c1[_0xf1e4('0x81')]===0x0){return db['UserProfileResource'][_0xf1e4('0x67')]({'name':_0x549ba7[_0xf1e4('0x3b')],'resourceId':_0x549ba7['id'],'type':_0x1ee0c1[_0xf1e4('0x3b')],'sectionId':_0x1ee0c1['id']},{})[_0xf1e4('0x21')](function(){return _0x301ff0;});}else{return _0x301ff0;}})[_0xf1e4('0x2b')](function(_0x286271){logger[_0xf1e4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x286271);throw _0x286271;});}return _0x301ff0;})[_0xf1e4('0x21')](respondWithResult(_0x5e1deb,0xc9))[_0xf1e4('0x2b')](handleError(_0x5e1deb,null));};exports[_0xf1e4('0x82')]=function(_0x17ad6b,_0xb30090,_0x10aaba){return db[_0xf1e4('0x57')]['findOne']({'where':{'id':_0x17ad6b[_0xf1e4('0x5d')]['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0xb30090,null))[_0xf1e4('0x21')](function(_0x1b52c0){if(_0x1b52c0){return _0x1b52c0[_0xf1e4('0x82')]();}return null;})['then'](respondWithResult(_0xb30090,null))['catch'](handleError(_0xb30090,null));};exports[_0xf1e4('0x83')]=function(_0x45ec13,_0x12b2a9,_0x2ef585){if(_0x45ec13[_0xf1e4('0x60')]['id']){delete _0x45ec13[_0xf1e4('0x60')]['id'];}return db['MailAccount'][_0xf1e4('0x61')]({'where':{'id':_0x45ec13[_0xf1e4('0x5d')]['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x12b2a9,null))[_0xf1e4('0x21')](function(_0x35855f){if(_0x35855f){_0x45ec13[_0xf1e4('0x60')][_0xf1e4('0x65')]=_0x35855f['id'];return db[_0xf1e4('0x3d')][_0xf1e4('0x67')](_0x45ec13[_0xf1e4('0x60')]);}})[_0xf1e4('0x21')](respondWithResult(_0x12b2a9,null))[_0xf1e4('0x2b')](handleError(_0x12b2a9,null));};exports['removeImap']=function(_0x3b3ce3,_0x59f0fc,_0x2c7ae0){return db['MailAccount']['findOne']({'where':{'id':_0x3b3ce3[_0xf1e4('0x5d')]['id']}})['then'](handleEntityNotFound(_0x59f0fc,null))['then'](function(_0xaaab79){if(_0xaaab79){return _0xaaab79[_0xf1e4('0x84')](null);}return null;})[_0xf1e4('0x21')](respondWithStatusCode(_0x59f0fc,null))['catch'](handleError(_0x59f0fc,null));};exports['getSmtp']=function(_0x230866,_0x49615e,_0x543323){return db['MailAccount'][_0xf1e4('0x69')]({'where':{'id':_0x230866['params']['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x49615e,null))[_0xf1e4('0x21')](function(_0x46ff51){if(_0x46ff51){return _0x46ff51['getSmtp']();}return null;})[_0xf1e4('0x21')](respondWithResult(_0x49615e,null))[_0xf1e4('0x2b')](handleError(_0x49615e,null));};exports[_0xf1e4('0x85')]=function(_0x54642a,_0x12b801,_0x512b9f){if(_0x54642a[_0xf1e4('0x60')]['id']){delete _0x54642a[_0xf1e4('0x60')]['id'];}return db[_0xf1e4('0x57')]['find']({'where':{'id':_0x54642a[_0xf1e4('0x5d')]['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x12b801,null))[_0xf1e4('0x21')](function(_0x49eac3){if(_0x49eac3){_0x54642a[_0xf1e4('0x60')]['MailAccountId']=_0x49eac3['id'];return db[_0xf1e4('0x5e')]['create'](_0x54642a[_0xf1e4('0x60')]);}})['then'](respondWithResult(_0x12b801,null))[_0xf1e4('0x2b')](handleError(_0x12b801,null));};exports[_0xf1e4('0x86')]=function(_0x4dca2c,_0xd11a44,_0x4408cf){return db[_0xf1e4('0x57')]['findOne']({'where':{'id':_0x4dca2c['params']['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0xd11a44,null))[_0xf1e4('0x21')](function(_0x481b79){if(_0x481b79){return _0x481b79[_0xf1e4('0x87')](null);}return null;})[_0xf1e4('0x21')](respondWithStatusCode(_0xd11a44,null))[_0xf1e4('0x2b')](handleError(_0xd11a44,null));};exports[_0xf1e4('0x88')]=function(_0x23093a,_0x2da06c,_0x141215){return db[_0xf1e4('0x89')]['find']({'where':{'id':_0x23093a[_0xf1e4('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2da06c,null))['then'](function(_0x109d37){if(_0x109d37){return _0x109d37[_0xf1e4('0x88')](_0x23093a[_0xf1e4('0x60')][_0xf1e4('0x6b')],_[_0xf1e4('0x8a')](_0x23093a[_0xf1e4('0x60')],[_0xf1e4('0x6b'),'id'])||{});}})[_0xf1e4('0x21')](respondWithResult(_0x2da06c,null))[_0xf1e4('0x2b')](handleError(_0x2da06c,null));};exports['getInteractions']=function(_0x4d913a,_0x19bf74,_0x593ffa){var _0x13838b={'raw':![],'where':{}};var _0x19b6d0={};var _0x547c6a={'count':0x0,'rows':[]};return db[_0xf1e4('0x57')][_0xf1e4('0x69')]({'where':{'id':_0x4d913a[_0xf1e4('0x5d')]['id']}})['then'](handleEntityNotFound(_0x19bf74,null))[_0xf1e4('0x21')](function(_0x12e334){if(_0x12e334){_0x19b6d0[_0xf1e4('0x45')]=_[_0xf1e4('0x47')](db[_0xf1e4('0x89')][_0xf1e4('0x5f')]);_0x19b6d0[_0xf1e4('0x46')]=_['keys'](_0x4d913a[_0xf1e4('0x46')]);_0x19b6d0[_0xf1e4('0x48')]=_[_0xf1e4('0x49')](_0x19b6d0['model'],_0x19b6d0[_0xf1e4('0x46')]);_0x13838b[_0xf1e4('0x4a')]=_[_0xf1e4('0x49')](_0x19b6d0['model'],qs[_0xf1e4('0x4b')](_0x4d913a[_0xf1e4('0x46')][_0xf1e4('0x4b')]));_0x13838b[_0xf1e4('0x4a')]=_0x13838b['attributes'][_0xf1e4('0x4c')]?_0x13838b[_0xf1e4('0x4a')]:_0x19b6d0[_0xf1e4('0x45')];if(!_0x4d913a[_0xf1e4('0x46')][_0xf1e4('0x4d')](_0xf1e4('0x4e'))){_0x13838b[_0xf1e4('0x32')]=qs[_0xf1e4('0x32')](_0x4d913a['query'][_0xf1e4('0x32')]);_0x13838b[_0xf1e4('0x31')]=qs[_0xf1e4('0x31')](_0x4d913a['query'][_0xf1e4('0x31')]);}_0x13838b[_0xf1e4('0x4f')]=qs[_0xf1e4('0x50')](_0x4d913a[_0xf1e4('0x46')][_0xf1e4('0x50')]);_0x13838b['where']=qs['filters'](_['pick'](_0x4d913a[_0xf1e4('0x46')],_0x19b6d0[_0xf1e4('0x48')]));_0x13838b['where'][_0xf1e4('0x65')]=_0x12e334['id'];if(_0x4d913a[_0xf1e4('0x46')][_0xf1e4('0x52')]){_0x13838b[_0xf1e4('0x53')]=_[_0xf1e4('0x54')](_0x13838b[_0xf1e4('0x53')],{'$or':_[_0xf1e4('0x41')](_0x13838b['attributes'],function(_0x36f28){var _0x324a49={};_0x324a49[_0x36f28]={'$like':'%'+_0x4d913a['query'][_0xf1e4('0x52')]+'%'};return _0x324a49;})});}_0x13838b=_['merge']({},_0x13838b,_0x4d913a[_0xf1e4('0x56')]);return db[_0xf1e4('0x89')][_0xf1e4('0x30')]({'where':_0x13838b[_0xf1e4('0x53')]})[_0xf1e4('0x21')](function(_0x36396f){_0x547c6a[_0xf1e4('0x30')]=_0x36396f;if(_0x4d913a['query']['includeAll']){_0x13838b[_0xf1e4('0x59')]=[{'model':db[_0xf1e4('0x8b')],'as':_0xf1e4('0x8c'),'required':![]},{'model':db[_0xf1e4('0x8d')],'as':_0xf1e4('0x8e'),'attributes':[_0xf1e4('0x3b'),_0xf1e4('0x8f'),_0xf1e4('0x90')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xf1e4('0x3b'),'color'],'where':_0x4d913a[_0xf1e4('0x46')][_0xf1e4('0x91')]?{'id':_0x4d913a[_0xf1e4('0x46')][_0xf1e4('0x91')]}:undefined,'required':_0x4d913a[_0xf1e4('0x46')][_0xf1e4('0x91')]?!![]:![]}];}return db[_0xf1e4('0x89')][_0xf1e4('0x5a')](_0x13838b);})['then'](function(_0x457f55){_0x547c6a[_0xf1e4('0x5b')]=_0x457f55;return _0x547c6a;});}})['then'](respondWithFilteredResult(_0x19bf74,_0x13838b))[_0xf1e4('0x2b')](handleError(_0x19bf74,null));};exports['addApplications']=function(_0x5d25a2,_0x507812,_0x7df5a0){return db[_0xf1e4('0x57')]['findOne']({'where':{'id':_0x5d25a2['params']['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x507812,null))['then'](function(_0xef1834){if(_0xef1834){return db['sequelize']['transaction'](function(_0x3bb84d){return db[_0xf1e4('0x92')]['destroy']({'where':{'MailAccountId':_0x5d25a2[_0xf1e4('0x5d')]['id']},'transaction':_0x3bb84d})[_0xf1e4('0x21')](function(_0x2c1adb){var _0x4fd531=_[_0xf1e4('0x41')](_0x5d25a2['body'],function(_0x362bb7){_0x362bb7[_0xf1e4('0x65')]=_0x5d25a2[_0xf1e4('0x5d')]['id'];return _0x362bb7;});return db[_0xf1e4('0x92')][_0xf1e4('0x93')](_0x4fd531,{'transaction':_0x3bb84d});});})[_0xf1e4('0x21')](function(){return db['MailApplication'][_0xf1e4('0x94')]({'where':{'MailAccountId':_0x5d25a2[_0xf1e4('0x5d')]['id']},'order':_0xf1e4('0x95')});});}})[_0xf1e4('0x21')](respondWithResult(_0x507812,null))[_0xf1e4('0x2b')](handleError(_0x507812,null));};exports[_0xf1e4('0x96')]=function(_0x2065cd,_0x5bc004,_0x52f59f){var _0x225e2e={};var _0x2a80b5={};var _0x814318;var _0x4f343e;return db[_0xf1e4('0x57')]['findOne']({'where':{'id':_0x2065cd[_0xf1e4('0x5d')]['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x5bc004,null))[_0xf1e4('0x21')](function(_0x5d21ec){if(_0x5d21ec){_0x814318=_0x5d21ec;_0x2a80b5['model']=_['keys'](db[_0xf1e4('0x92')][_0xf1e4('0x5f')]);_0x2a80b5[_0xf1e4('0x46')]=_['keys'](_0x2065cd[_0xf1e4('0x46')]);_0x2a80b5[_0xf1e4('0x48')]=_[_0xf1e4('0x49')](_0x2a80b5['model'],_0x2a80b5[_0xf1e4('0x46')]);_0x225e2e[_0xf1e4('0x4a')]=_[_0xf1e4('0x49')](_0x2a80b5[_0xf1e4('0x45')],qs['fields'](_0x2065cd['query'][_0xf1e4('0x4b')]));_0x225e2e['attributes']=_0x225e2e[_0xf1e4('0x4a')][_0xf1e4('0x4c')]?_0x225e2e[_0xf1e4('0x4a')]:_0x2a80b5[_0xf1e4('0x45')];_0x225e2e[_0xf1e4('0x4f')]=qs[_0xf1e4('0x50')](_0x2065cd[_0xf1e4('0x46')]['sort']);_0x225e2e[_0xf1e4('0x53')]=qs['filters'](_['pick'](_0x2065cd[_0xf1e4('0x46')],_0x2a80b5['filters']));if(_0x2065cd['query'][_0xf1e4('0x52')]){_0x225e2e[_0xf1e4('0x53')]=_[_0xf1e4('0x54')](_0x225e2e[_0xf1e4('0x53')],{'$or':_[_0xf1e4('0x41')](_0x225e2e[_0xf1e4('0x4a')],function(_0x1c2950){var _0x2ab609={};_0x2ab609[_0x1c2950]={'$like':'%'+_0x2065cd[_0xf1e4('0x46')][_0xf1e4('0x52')]+'%'};return _0x2ab609;})});}_0x225e2e=_[_0xf1e4('0x54')]({},_0x225e2e,_0x2065cd[_0xf1e4('0x56')]);return _0x814318['getApplications'](_0x225e2e);}})['then'](function(_0x4f3ab9){if(_0x4f3ab9){_0x4f343e=_0x4f3ab9['length'];if(!_0x2065cd['query']['hasOwnProperty']('nolimit')){_0x225e2e['limit']=qs[_0xf1e4('0x32')](_0x2065cd['query'][_0xf1e4('0x32')]);_0x225e2e[_0xf1e4('0x31')]=qs['offset'](_0x2065cd['query']['offset']);}return _0x814318['getApplications'](_0x225e2e);}})[_0xf1e4('0x21')](function(_0x4ef043){if(_0x4ef043){return _0x4ef043?{'count':_0x4f343e,'rows':_0x4ef043}:null;}})[_0xf1e4('0x21')](respondWithResult(_0x5bc004,null))['catch'](handleError(_0x5bc004,null));};exports[_0xf1e4('0x97')]=function(_0x40d050,_0x418f02,_0x487d40){var _0xb568d8={'raw':!![],'where':{}};var _0x50d0bc={};var _0x27b587={'count':0x0,'rows':[]};return db[_0xf1e4('0x57')][_0xf1e4('0x69')]({'where':{'id':_0x40d050[_0xf1e4('0x5d')]['id']}})['then'](handleEntityNotFound(_0x418f02,null))[_0xf1e4('0x21')](function(_0x3b5cbe){if(_0x3b5cbe){_0x50d0bc[_0xf1e4('0x45')]=_[_0xf1e4('0x47')](db[_0xf1e4('0x98')][_0xf1e4('0x5f')]);_0x50d0bc[_0xf1e4('0x46')]=_['keys'](_0x40d050[_0xf1e4('0x46')]);_0x50d0bc[_0xf1e4('0x48')]=_['intersection'](_0x50d0bc[_0xf1e4('0x45')],_0x50d0bc[_0xf1e4('0x46')]);_0xb568d8[_0xf1e4('0x4a')]=_[_0xf1e4('0x49')](_0x50d0bc[_0xf1e4('0x45')],qs[_0xf1e4('0x4b')](_0x40d050[_0xf1e4('0x46')]['fields']));_0xb568d8[_0xf1e4('0x4a')]=_0xb568d8['attributes'][_0xf1e4('0x4c')]?_0xb568d8[_0xf1e4('0x4a')]:_0x50d0bc['model'];if(!_0x40d050[_0xf1e4('0x46')]['hasOwnProperty']('nolimit')){_0xb568d8[_0xf1e4('0x32')]=qs[_0xf1e4('0x32')](_0x40d050[_0xf1e4('0x46')][_0xf1e4('0x32')]);_0xb568d8[_0xf1e4('0x31')]=qs[_0xf1e4('0x31')](_0x40d050[_0xf1e4('0x46')]['offset']);}_0xb568d8[_0xf1e4('0x4f')]=qs[_0xf1e4('0x50')](_0x40d050[_0xf1e4('0x46')]['sort']);_0xb568d8['where']=qs[_0xf1e4('0x48')](_['pick'](_0x40d050[_0xf1e4('0x46')],_0x50d0bc[_0xf1e4('0x48')]));_0xb568d8['where']['MailAccountId']=_0x3b5cbe['id'];if(_0x40d050[_0xf1e4('0x46')][_0xf1e4('0x52')]){_0xb568d8['where']=_[_0xf1e4('0x54')](_0xb568d8[_0xf1e4('0x53')],{'$or':_[_0xf1e4('0x41')](_0xb568d8[_0xf1e4('0x4a')],function(_0xb57390){var _0x3ff7f1={};_0x3ff7f1[_0xb57390]={'$like':'%'+_0x40d050[_0xf1e4('0x46')][_0xf1e4('0x52')]+'%'};return _0x3ff7f1;})});}if(_0x40d050['query'][_0xf1e4('0x99')]){var _0x5473bd=_0x40d050[_0xf1e4('0x46')][_0xf1e4('0x99')][_0xf1e4('0x9a')](',');var _0x18873a={};_0x18873a[_0x5473bd[0x0]]={'$gte':moment(_0x5473bd[0x1])['format'](_0xf1e4('0x9b'))};_0xb568d8[_0xf1e4('0x53')]=_[_0xf1e4('0x54')](_0xb568d8[_0xf1e4('0x53')],_0x18873a);}_0xb568d8=_['merge']({},_0xb568d8,_0x40d050['options']);return db['MailMessage'][_0xf1e4('0x30')]({'where':_0xb568d8['where']})[_0xf1e4('0x21')](function(_0x396837){_0x27b587[_0xf1e4('0x30')]=_0x396837;if(_0x40d050['query'][_0xf1e4('0x58')]){_0xb568d8[_0xf1e4('0x59')]=[{'all':!![]}];}return db[_0xf1e4('0x98')][_0xf1e4('0x5a')](_0xb568d8);})[_0xf1e4('0x21')](function(_0x4c3b5a){_0x27b587[_0xf1e4('0x5b')]=_0x4c3b5a;return _0x27b587;});}})[_0xf1e4('0x21')](respondWithFilteredResult(_0x418f02,_0xb568d8))[_0xf1e4('0x2b')](handleError(_0x418f02,null));};exports[_0xf1e4('0x3c')]=function(_0x331d4d,_0x1edebb,_0x3899b6){var _0x483e65,_0x29eea5={},_0x4d4bfa;if(_0x331d4d['body']['to']){_0x4d4bfa=_0x331d4d[_0xf1e4('0x60')]['to']['split'](',')[0x0];}return db[_0xf1e4('0x57')][_0xf1e4('0x61')]({'where':{'id':_0x331d4d[_0xf1e4('0x5d')]['id']},'include':[{'model':db[_0xf1e4('0x9c')],'as':'List','include':[{'model':db[_0xf1e4('0x8b')],'as':_0xf1e4('0x9d'),'where':{'email':_0x4d4bfa},'limit':0x1,'order':[[_0xf1e4('0x9e'),_0xf1e4('0x9f')]]}]},{'model':db[_0xf1e4('0x5e')],'as':_0xf1e4('0x3f'),'raw':!![]}]})['then'](handleEntityNotFound(_0x1edebb,null))[_0xf1e4('0x21')](function(_0x3d0c5d){if(_0x3d0c5d){_0x483e65=_0x3d0c5d;if(_0x3d0c5d[_0xf1e4('0x3f')]){if(_[_0xf1e4('0x72')](_0x331d4d[_0xf1e4('0x60')]['from'])){_0x331d4d[_0xf1e4('0x60')][_0xf1e4('0xa0')]=util[_0xf1e4('0xa1')](_0xf1e4('0xa2'),_0x3d0c5d[_0xf1e4('0x3b')],_0x3d0c5d[_0xf1e4('0x6f')]||_0x3d0c5d['Smtp']['user']);}if(_0x331d4d[_0xf1e4('0x60')][_0xf1e4('0xa3')]&&_0x331d4d['body'][_0xf1e4('0xa3')][_0xf1e4('0x4c')]){for(var _0x18d55f=0x0;_0x18d55f<_0x331d4d['body']['attachments'][_0xf1e4('0x4c')];_0x18d55f+=0x1){_0x331d4d[_0xf1e4('0x60')][_0xf1e4('0xa3')][_0x18d55f]={'filename':_0x331d4d[_0xf1e4('0x60')][_0xf1e4('0xa3')][_0x18d55f][_0xf1e4('0x3b')],'path':path[_0xf1e4('0xa4')](config['root'],_0xf1e4('0xa5'),_0x331d4d[_0xf1e4('0x60')][_0xf1e4('0xa3')][_0x18d55f][_0xf1e4('0xa6')])};}}var _0x4f26c2={'tls':{'rejectUnauthorized':![]}};if(_[_0xf1e4('0x72')](_0x3d0c5d[_0xf1e4('0x3f')][_0xf1e4('0xa7')])){if(_0x3d0c5d[_0xf1e4('0x3f')]['authentication']){_0x4f26c2[_0xf1e4('0xa8')]={'user':_0x3d0c5d[_0xf1e4('0x3f')][_0xf1e4('0x74')],'pass':_0x3d0c5d['Smtp'][_0xf1e4('0x77')]};}_0x4f26c2[_0xf1e4('0x7a')]=_0x3d0c5d['Smtp']['host'];_0x4f26c2[_0xf1e4('0x7b')]=_0x3d0c5d[_0xf1e4('0x3f')][_0xf1e4('0x7b')];_0x4f26c2[_0xf1e4('0xa9')]=_0x3d0c5d[_0xf1e4('0x3f')][_0xf1e4('0xa9')];}else{_0x4f26c2[_0xf1e4('0xa7')]=_0x3d0c5d['Smtp'][_0xf1e4('0xa7')];_0x4f26c2[_0xf1e4('0xa8')]={'user':_0x3d0c5d[_0xf1e4('0x3f')][_0xf1e4('0x74')],'pass':_0x3d0c5d[_0xf1e4('0x3f')][_0xf1e4('0x77')]};}return respondWithRpcPromise(_0xf1e4('0xaa'),'sendMail',{'account':_0x4f26c2,'message':_0x331d4d['body']});}else{throw new Error(_0xf1e4('0xab'));}}})[_0xf1e4('0x21')](function(_0x452f1b){if(_0x452f1b){_0x29eea5=_0x452f1b;if(_0x483e65[_0xf1e4('0xac')]){if(_0x483e65[_0xf1e4('0xac')]['Contacts'][_0xf1e4('0x4c')]){return _0x483e65[_0xf1e4('0xac')][_0xf1e4('0x9d')][0x0];}else{return db[_0xf1e4('0x8b')]['create'](_[_0xf1e4('0x15')](_0x331d4d[_0xf1e4('0x60')],{'firstName':_0x331d4d[_0xf1e4('0x60')]['to'],'email':_0x331d4d[_0xf1e4('0x60')]['to'],'phone':_0x331d4d[_0xf1e4('0x60')]['to'],'ListId':_0x483e65['ListId']}));}}else{throw new Error(_0xf1e4('0xab'));}}})['then'](function(_0xaf4131){if(_0xaf4131){var _0x245ffc={'UserId':_0x331d4d[_0xf1e4('0x74')]['id'],'ContactId':_0xaf4131['id'],'MailAccountId':_0x483e65['id'],'inReplyTo':_0x29eea5['messageId'],'to':_0x331d4d[_0xf1e4('0x60')][_0xf1e4('0xa0')],'cc':_0x331d4d[_0xf1e4('0x60')]['cc'],'subject':_0x331d4d[_0xf1e4('0x60')][_0xf1e4('0xad')],'attach':_0x331d4d[_0xf1e4('0x60')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','lastMsgBody':_0x331d4d[_0xf1e4('0x60')][_0xf1e4('0x60')],'Messages':[_[_0xf1e4('0x54')](_0x331d4d[_0xf1e4('0x60')],{'messageId':_0x29eea5['messageId'],'sentAt':moment()[_0xf1e4('0xa1')](_0xf1e4('0x9b')),'read':!![],'MailAccountId':_0x483e65['id'],'UserId':_0x331d4d[_0xf1e4('0x74')]['id'],'ContactId':_0xaf4131['id']})]};if(_0x331d4d[_0xf1e4('0x60')]['Interaction']){_0x245ffc=_[_0xf1e4('0x54')](_0x245ffc,_0x331d4d['body'][_0xf1e4('0xae')]);}return db[_0xf1e4('0x89')][_0xf1e4('0x67')](_0x245ffc,{'include':[{'model':db['MailMessage'],'as':_0xf1e4('0xaf')}]});}})[_0xf1e4('0x21')](respondWithResult(_0x1edebb,null))['catch'](handleError(_0x1edebb,null));};exports[_0xf1e4('0xb0')]=function(_0x57c721,_0x45b5ac,_0x1c6df7){return db['MailAccount']['find']({'where':{'id':_0x57c721[_0xf1e4('0x5d')]['id']},'include':[{'model':db[_0xf1e4('0x5e')],'as':_0xf1e4('0x3f'),'raw':!![]}]})['then'](handleEntityNotFound(_0x45b5ac,null))['then'](function(_0x12210a){if(_0x12210a&&_0x12210a['Smtp']){var _0x5d924e={'id':_0x12210a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x12210a[_0xf1e4('0x3f')][_0xf1e4('0xa7')]){_0x5d924e['service']=_0x12210a[_0xf1e4('0x3f')]['service'];}else{_0x5d924e[_0xf1e4('0x7a')]=_0x12210a[_0xf1e4('0x3f')][_0xf1e4('0x7a')];_0x5d924e[_0xf1e4('0x7b')]=_0x12210a[_0xf1e4('0x3f')][_0xf1e4('0x7b')];_0x5d924e['secure']=_0x12210a[_0xf1e4('0x3f')][_0xf1e4('0xa9')];}if(_0x12210a['Smtp'][_0xf1e4('0x79')]){_0x5d924e['auth']={'user':_0x12210a[_0xf1e4('0x3f')][_0xf1e4('0x74')],'pass':_0x12210a[_0xf1e4('0x3f')]['pass']};}return respondWithRpcPromise(_0xf1e4('0xb1'),_0xf1e4('0xb0'),{'account':_0x5d924e});}})['then'](respondWithResult(_0x45b5ac,null))[_0xf1e4('0x2b')](handleError(_0x45b5ac,null));};exports[_0xf1e4('0x39')]=function(_0x25e7c8,_0x273831){return db[_0xf1e4('0x57')][_0xf1e4('0x61')]({'where':{'id':_0x25e7c8[_0xf1e4('0x5d')]['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x273831,null))[_0xf1e4('0x21')](function(_0x498ef4){if(_0x498ef4&&_0x498ef4[_0xf1e4('0xa7')]){throw new db['Sequelize']['ValidationError'](_0xf1e4('0xb2'));}return _0x498ef4;})[_0xf1e4('0x21')](removeEntity(_0x273831,null))['catch'](handleError(_0x273831,null));};exports[_0xf1e4('0xb3')]=function(_0x3188f0,_0x37e7c6,_0x3f7dae){return db['MailAccount'][_0xf1e4('0x61')]({'where':{'id':_0x3188f0['params']['id']}})['then'](handleEntityNotFound(_0x37e7c6,null))[_0xf1e4('0x21')](function(_0x33baed){if(_0x33baed){return _0x33baed[_0xf1e4('0xb3')](_0x3188f0['body'][_0xf1e4('0x6b')],_[_0xf1e4('0x8a')](_0x3188f0['body'],[_0xf1e4('0x6b'),'id'])||{})[_0xf1e4('0xb4')](function(_0xe123c5){for(var _0x331d49=0x0;_0x331d49<_0x3188f0[_0xf1e4('0x60')][_0xf1e4('0x6b')][_0xf1e4('0x4c')];_0x331d49+=0x1){socket[_0xf1e4('0xb5')]('userMailAccount:save',{'UserId':_0x3188f0[_0xf1e4('0x60')][_0xf1e4('0x6b')][_0x331d49],'MailAccountId':_0x3188f0[_0xf1e4('0x5d')]['id']});}return _0xe123c5;});}})[_0xf1e4('0x21')](respondWithResult(_0x37e7c6,null))['catch'](handleError(_0x37e7c6,null));};exports[_0xf1e4('0xb6')]=function(_0xdfb120,_0x159354,_0x14b03b){return db[_0xf1e4('0x57')]['find']({'where':{'id':_0xdfb120[_0xf1e4('0x5d')]['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x159354,null))[_0xf1e4('0x21')](function(_0x4973ee){if(_0x4973ee){return _0x4973ee[_0xf1e4('0xb6')](_0xdfb120['query'][_0xf1e4('0x6b')])[_0xf1e4('0x21')](function(){if(_[_0xf1e4('0xb7')](_0xdfb120[_0xf1e4('0x46')][_0xf1e4('0x6b')])){for(var _0x49b396=0x0;_0x49b396<_0xdfb120[_0xf1e4('0x46')][_0xf1e4('0x6b')]['length'];_0x49b396+=0x1){socket[_0xf1e4('0xb5')](_0xf1e4('0xb8'),{'UserId':Number(_0xdfb120[_0xf1e4('0x46')][_0xf1e4('0x6b')][_0x49b396]),'MailAccountId':Number(_0xdfb120[_0xf1e4('0x5d')]['id'])});}}else{socket[_0xf1e4('0xb5')]('userMailAccount:remove',{'UserId':Number(_0xdfb120[_0xf1e4('0x46')][_0xf1e4('0x6b')]),'MailAccountId':Number(_0xdfb120[_0xf1e4('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x159354,null))[_0xf1e4('0x2b')](handleError(_0x159354,null));};exports[_0xf1e4('0xb9')]=function(_0x247322,_0x5534eb,_0x28f10a){var _0x1d4b22={};var _0x260298={};var _0x16b019;var _0x3dea8b;return db[_0xf1e4('0x57')]['findOne']({'where':{'id':_0x247322[_0xf1e4('0x5d')]['id']}})[_0xf1e4('0x21')](handleEntityNotFound(_0x5534eb,null))[_0xf1e4('0x21')](function(_0x18f610){if(_0x18f610){_0x16b019=_0x18f610;_0x260298[_0xf1e4('0x45')]=_[_0xf1e4('0x47')](db[_0xf1e4('0x8d')][_0xf1e4('0x5f')]);_0x260298['query']=_[_0xf1e4('0x47')](_0x247322[_0xf1e4('0x46')]);_0x260298[_0xf1e4('0x48')]=_[_0xf1e4('0x49')](_0x260298[_0xf1e4('0x45')],_0x260298[_0xf1e4('0x46')]);_0x1d4b22['attributes']=_['intersection'](_0x260298[_0xf1e4('0x45')],qs[_0xf1e4('0x4b')](_0x247322['query'][_0xf1e4('0x4b')]));_0x1d4b22[_0xf1e4('0x4a')]=_0x1d4b22['attributes'][_0xf1e4('0x4c')]?_0x1d4b22[_0xf1e4('0x4a')]:_0x260298[_0xf1e4('0x45')];_0x1d4b22[_0xf1e4('0x4f')]=qs[_0xf1e4('0x50')](_0x247322[_0xf1e4('0x46')][_0xf1e4('0x50')]);_0x1d4b22[_0xf1e4('0x53')]=qs[_0xf1e4('0x48')](_[_0xf1e4('0x51')](_0x247322['query'],_0x260298[_0xf1e4('0x48')]));if(_0x247322[_0xf1e4('0x46')][_0xf1e4('0x52')]){_0x1d4b22['where']=_[_0xf1e4('0x54')](_0x1d4b22['where'],{'$or':_[_0xf1e4('0x41')](_0x1d4b22[_0xf1e4('0x4a')],function(_0x8ef00c){var _0x194d90={};_0x194d90[_0x8ef00c]={'$like':'%'+_0x247322[_0xf1e4('0x46')][_0xf1e4('0x52')]+'%'};return _0x194d90;})});}_0x1d4b22=_[_0xf1e4('0x54')]({},_0x1d4b22,_0x247322[_0xf1e4('0x56')]);return _0x16b019[_0xf1e4('0xb9')](_0x1d4b22);}})['then'](function(_0x976775){if(_0x976775){_0x3dea8b=_0x976775['length'];if(!_0x247322[_0xf1e4('0x46')][_0xf1e4('0x4d')](_0xf1e4('0x4e'))){_0x1d4b22[_0xf1e4('0x32')]=qs[_0xf1e4('0x32')](_0x247322[_0xf1e4('0x46')][_0xf1e4('0x32')]);_0x1d4b22[_0xf1e4('0x31')]=qs[_0xf1e4('0x31')](_0x247322[_0xf1e4('0x46')]['offset']);}return _0x16b019[_0xf1e4('0xb9')](_0x1d4b22);}})[_0xf1e4('0x21')](function(_0x28d873){if(_0x28d873){return _0x28d873?{'count':_0x3dea8b,'rows':_0x28d873}:null;}})[_0xf1e4('0x21')](respondWithResult(_0x5534eb,null))[_0xf1e4('0x2b')](handleError(_0x5534eb,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index bcf2934..8c229cb 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 _0x7953=['remove','emit','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','update'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0x7953,0x1b4));var _0x3795=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0x7953[_0x834bb6];return _0xa35d00;};'use strict';var EventEmitter=require(_0x3795('0x0'));var MailAccount=require(_0x3795('0x1'))['db'][_0x3795('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3795('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3795('0x4'),'afterDestroy':_0x3795('0x5')};function emitEvent(_0x8dc0c8){return function(_0x3dc39b,_0x2e454d,_0x3ee41d){MailAccountEvents[_0x3795('0x6')](_0x8dc0c8+':'+_0x3dc39b['id'],_0x3dc39b);MailAccountEvents[_0x3795('0x6')](_0x8dc0c8,_0x3dc39b);_0x3ee41d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x3795('0x7')](e,emitEvent(event));}}module[_0x3795('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x9f17=['MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x9f17,0xc4));var _0x79f1=function(_0x4005db,_0x3d7bfd){_0x4005db=_0x4005db-0x0;var _0x341c5f=_0x9f17[_0x4005db];return _0x341c5f;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x79f1('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x79f1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x79f1('0x2'),'afterDestroy':_0x79f1('0x3')};function emitEvent(_0x1616f){return function(_0x48f008,_0x1ae098,_0x24ff8e){MailAccountEvents[_0x79f1('0x4')](_0x1616f+':'+_0x48f008['id'],_0x48f008);MailAccountEvents[_0x79f1('0x4')](_0x1616f,_0x48f008);_0x24ff8e(null);};}for(var e in events){if(events[_0x79f1('0x5')](e)){var event=events[e];MailAccount[_0x79f1('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 8e2bc61..8ddda97 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 _0xbe77=['MailAccount','mail_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xbe77,0x9c));var _0x7be7=function(_0x174400,_0x3a166e){_0x174400=_0x174400-0x0;var _0x52ef78=_0xbe77[_0x174400];return _0x52ef78;};'use strict';var _=require('lodash');var util=require(_0x7be7('0x0'));var logger=require(_0x7be7('0x1'))(_0x7be7('0x2'));var moment=require(_0x7be7('0x3'));var BPromise=require(_0x7be7('0x4'));var rp=require(_0x7be7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7be7('0x6'));var config=require(_0x7be7('0x7'));var attributes=require(_0x7be7('0x8'));module['exports']=function(_0x205c05,_0xcdd1c4){return _0x205c05['define'](_0x7be7('0x9'),attributes,{'tableName':_0x7be7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x919b=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x3342ee,_0x2ba4ce){var _0xfa5dda=function(_0x1e595c){while(--_0x1e595c){_0x3342ee['push'](_0x3342ee['shift']());}};_0xfa5dda(++_0x2ba4ce);}(_0x919b,0x1ba));var _0xb919=function(_0x75699f,_0x1b02c3){_0x75699f=_0x75699f-0x0;var _0x137423=_0x919b[_0x75699f];return _0x137423;};'use strict';var _=require(_0xb919('0x0'));var util=require(_0xb919('0x1'));var logger=require('../../config/logger')(_0xb919('0x2'));var moment=require(_0xb919('0x3'));var BPromise=require('bluebird');var rp=require(_0xb919('0x4'));var fs=require('fs');var path=require(_0xb919('0x5'));var rimraf=require(_0xb919('0x6'));var config=require(_0xb919('0x7'));var attributes=require(_0xb919('0x8'));module[_0xb919('0x9')]=function(_0x2df793,_0x34c333){return _0x2df793[_0xb919('0xa')](_0xb919('0xb'),attributes,{'tableName':_0xb919('0xc'),'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 0d150fb..0bcbcb5 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 _0xe5b5=['stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowMailAccount','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','MailApplication','Applications','MailServerOut','account','omit','list','applications','orderBy','priority','asc','autoclose','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','MailMessage','Messages','Contact\x20not\x20found','spread','update','attach','interaction','get','created','attachments','originTo','originCc','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5a6983,_0x38627f){var _0x516234=function(_0x22fcdc){while(--_0x22fcdc){_0x5a6983['push'](_0x5a6983['shift']());}};_0x516234(++_0x38627f);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0xe5b5[_0xb6e43];return _0x47c40f;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232c});config[_0x5e5b('0xe')]=_[_0x5e5b('0xf')](config[_0x5e5b('0xe')],{'host':_0x5e5b('0x10'),'port':0x18eb});var socket=require(_0x5e5b('0x11'))(new Redis(config[_0x5e5b('0xe')]));require(_0x5e5b('0x12'))[_0x5e5b('0x13')](socket);function respondWithRpcPromise(_0x3f8534,_0x492a0e,_0x300890){return new BPromise(function(_0x59112d,_0x108c34){return client[_0x5e5b('0x14')](_0x3f8534,_0x300890)[_0x5e5b('0x15')](function(_0x3f64b6){logger['info']('MailAccount,\x20%s,\x20%s',_0x492a0e,'request\x20sent');logger[_0x5e5b('0x16')](_0x5e5b('0x17'),_0x492a0e,_0x5e5b('0x18'),JSON[_0x5e5b('0x19')](_0x3f64b6));if(_0x3f64b6[_0x5e5b('0x1a')]){if(_0x3f64b6[_0x5e5b('0x1a')][_0x5e5b('0x1b')]===0x1f4){logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x3f64b6[_0x5e5b('0x1a')]['message']);return _0x108c34(_0x3f64b6[_0x5e5b('0x1a')]['message']);}logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x3f64b6[_0x5e5b('0x1a')][_0x5e5b('0x1d')]);return _0x59112d(_0x3f64b6['error'][_0x5e5b('0x1d')]);}else{logger['info'](_0x5e5b('0x1c'),_0x492a0e,_0x5e5b('0x18'));_0x59112d(_0x3f64b6['result'][_0x5e5b('0x1d')]);}})[_0x5e5b('0x1e')](function(_0x2281c8){logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x2281c8);_0x108c34(_0x2281c8);});});}exports[_0x5e5b('0x1f')]=function(_0x490e2b){var _0x2fdc38=this;return new Promise(function(_0x1aa0c2,_0x3c488e){return db[_0x5e5b('0x20')][_0x5e5b('0x21')]({'raw':_0x490e2b[_0x5e5b('0x22')]?_0x490e2b[_0x5e5b('0x22')][_0x5e5b('0x23')]===undefined?!![]:![]:!![],'where':_0x490e2b['options']?_0x490e2b['options'][_0x5e5b('0x24')]||null:null,'attributes':_0x490e2b[_0x5e5b('0x22')]?_0x490e2b[_0x5e5b('0x22')][_0x5e5b('0x25')]||null:null,'limit':_0x490e2b[_0x5e5b('0x22')]?_0x490e2b[_0x5e5b('0x22')][_0x5e5b('0x26')]||null:null,'include':_0x490e2b[_0x5e5b('0x22')]?_0x490e2b[_0x5e5b('0x22')][_0x5e5b('0x27')]?_[_0x5e5b('0x28')](_0x490e2b['options'][_0x5e5b('0x27')],function(_0x75800d){return{'model':db[_0x75800d[_0x5e5b('0x29')]],'as':_0x75800d['as'],'attributes':_0x75800d['attributes'],'include':_0x75800d[_0x5e5b('0x27')]?_[_0x5e5b('0x28')](_0x75800d['include'],function(_0x13ff91){return{'model':db[_0x13ff91[_0x5e5b('0x29')]],'as':_0x13ff91['as'],'attributes':_0x13ff91[_0x5e5b('0x25')],'include':_0x13ff91[_0x5e5b('0x27')]?_[_0x5e5b('0x28')](_0x13ff91[_0x5e5b('0x27')],function(_0x2cb695){return{'model':db[_0x2cb695[_0x5e5b('0x29')]],'as':_0x2cb695['as'],'attributes':_0x2cb695[_0x5e5b('0x25')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0x15')](function(_0xcb272c){logger[_0x5e5b('0x2a')]('GetMailAccount',_0x490e2b);logger['debug'](_0x5e5b('0x1f'),_0x490e2b,JSON[_0x5e5b('0x19')](_0xcb272c));_0x1aa0c2(_0xcb272c);})[_0x5e5b('0x1e')](function(_0x3dcdab){logger[_0x5e5b('0x1a')]('GetMailAccount',_0x3dcdab[_0x5e5b('0x1d')],_0x490e2b);_0x3c488e(_0x2fdc38['error'](0x1f4,_0x3dcdab[_0x5e5b('0x1d')]));});});};exports[_0x5e5b('0x2b')]=function(_0x11fa95){var _0xc2bc09=this;return new Promise(function(_0x4b9801,_0x22e906){return db[_0x5e5b('0x20')]['find']({'raw':_0x11fa95[_0x5e5b('0x22')]?_0x11fa95[_0x5e5b('0x22')][_0x5e5b('0x23')]===undefined?!![]:![]:!![],'where':_0x11fa95[_0x5e5b('0x22')]?_0x11fa95[_0x5e5b('0x22')][_0x5e5b('0x24')]||null:null,'attributes':_0x11fa95[_0x5e5b('0x22')]?_0x11fa95[_0x5e5b('0x22')]['attributes']||null:null,'include':_0x11fa95[_0x5e5b('0x22')]?_0x11fa95[_0x5e5b('0x22')][_0x5e5b('0x27')]?_[_0x5e5b('0x28')](_0x11fa95[_0x5e5b('0x22')][_0x5e5b('0x27')],function(_0x4fec9e){return{'model':db[_0x4fec9e['model']],'as':_0x4fec9e['as'],'attributes':_0x4fec9e[_0x5e5b('0x25')],'include':_0x4fec9e[_0x5e5b('0x27')]?_[_0x5e5b('0x28')](_0x4fec9e['include'],function(_0x2c23f4){return{'model':db[_0x2c23f4[_0x5e5b('0x29')]],'as':_0x2c23f4['as'],'attributes':_0x2c23f4[_0x5e5b('0x25')],'include':_0x2c23f4[_0x5e5b('0x27')]?_['map'](_0x2c23f4[_0x5e5b('0x27')],function(_0x44c6d2){return{'model':db[_0x44c6d2['model']],'as':_0x44c6d2['as'],'attributes':_0x44c6d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e5b('0x15')](function(_0x2c8b04){logger[_0x5e5b('0x2a')]('ShowMailAccount',_0x11fa95);logger[_0x5e5b('0x16')]('ShowMailAccount',_0x11fa95,JSON['stringify'](_0x2c8b04));_0x4b9801(_0x2c8b04);})[_0x5e5b('0x1e')](function(_0x2bcfaa){logger[_0x5e5b('0x1a')](_0x5e5b('0x2b'),_0x2bcfaa[_0x5e5b('0x1d')],_0x11fa95);_0x22e906(_0xc2bc09[_0x5e5b('0x1a')](0x1f4,_0x2bcfaa[_0x5e5b('0x1d')]));});});};exports[_0x5e5b('0x2c')]=function(_0x1034fa){var _0x53b88f=this;return new Promise(function(_0x1f1907,_0xc02f70){var _0x4b0ec9={'body':_0x1034fa[_0x5e5b('0x2d')],'channel':'mail'};var _0x125f95=_[_0x5e5b('0x2e')](_[_0x5e5b('0x2f')](db[_0x5e5b('0x30')][_0x5e5b('0x31')]),[_0x5e5b('0x32'),_0x5e5b('0x33'),_0x5e5b('0x34'),_0x5e5b('0x35')]);var _0x397ba4=![];if(_0x1034fa[_0x5e5b('0x2d')]['id']){delete _0x1034fa['body']['id'];}if(_[_0x5e5b('0x36')](_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x37')])){return _0xc02f70(_0x53b88f['error'](0x1f4,_0x5e5b('0x38')));}if(_[_0x5e5b('0x36')](_0x1034fa['body'][_0x5e5b('0x2d')])||_0x1034fa[_0x5e5b('0x2d')]['body']===''){return _0xc02f70(_0x53b88f[_0x5e5b('0x1a')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x1034fa['body'][_0x5e5b('0x39')])){return _0xc02f70(_0x53b88f['error'](0x1f4,_0x5e5b('0x3a')+_0x125f95));}if(!_['includes'](_0x125f95,_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x39')])){return _0xc02f70(_0x53b88f[_0x5e5b('0x1a')](0x1f4,_0x5e5b('0x3b')+_0x125f95));}var _0x172503={};_0x172503[_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x39')]]=_0x1034fa['body']['from'];return db[_0x5e5b('0x20')]['find']({'where':{'id':_0x1034fa['account']['id']},'include':[{'model':db['CmList'],'as':_0x5e5b('0x3c'),'include':[{'model':db['CmContact'],'as':_0x5e5b('0x3d'),'where':_0x172503,'limit':0x1,'order':[[_0x5e5b('0x33'),_0x5e5b('0x3e')]]}]},{'model':db[_0x5e5b('0x3f')],'as':_0x5e5b('0x40')},{'model':db[_0x5e5b('0x41')],'as':'Smtp'}]})[_0x5e5b('0x15')](function(_0x3ae495){if(_0x3ae495&&_0x3ae495['List']){var _0x4765ab=_0x3ae495['get']({'plain':!![]});_0x4b0ec9[_0x5e5b('0x42')]=_[_0x5e5b('0x43')](_0x4765ab,[_0x5e5b('0x40'),_0x5e5b('0x3c')]);_0x4b0ec9['applications']=_0x4765ab[_0x5e5b('0x40')];_0x4b0ec9[_0x5e5b('0x44')]=_0x4765ab['List'];_0x4b0ec9[_0x5e5b('0x45')]=_[_0x5e5b('0x46')](_0x4b0ec9[_0x5e5b('0x45')],[_0x5e5b('0x47')],[_0x5e5b('0x48')]);if(_0x4b0ec9[_0x5e5b('0x42')]&&_0x4b0ec9['account'][_0x5e5b('0x49')]){_0x4b0ec9[_0x5e5b('0x45')]['push']({'id':0x0,'priority':_0x4b0ec9[_0x5e5b('0x45')][_0x5e5b('0x4a')]+0x1,'app':_0x5e5b('0x4b'),'appdata':'autoclose','interval':_0x5e5b('0x4c')});}if(_0x4b0ec9[_0x5e5b('0x42')][_0x5e5b('0x40')]){delete _0x4b0ec9['account'][_0x5e5b('0x40')];}if(_0x4b0ec9[_0x5e5b('0x42')][_0x5e5b('0x3c')]){delete _0x4b0ec9['account']['List'];}if(_0x4765ab[_0x5e5b('0x3c')]['Contacts']['length']){return _0x4765ab[_0x5e5b('0x3c')][_0x5e5b('0x3d')][0x0];}var _0x4774ee=_['defaults'](_0x1034fa[_0x5e5b('0x2d')],{'firstName':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x37')],'ListId':_0x4765ab[_0x5e5b('0x35')]});_0x4774ee[_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x39')]]=_0x1034fa['body']['from'];return db[_0x5e5b('0x30')][_0x5e5b('0x4d')](_0x4774ee);}else{throw new Error(_0x5e5b('0x4e'));}})[_0x5e5b('0x15')](function(_0x54542b){_0x4b0ec9[_0x5e5b('0x4f')]=_0x54542b;if(_0x54542b){if(!_0x1034fa['body'][_0x5e5b('0x1d')][_0x5e5b('0x50')]){_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')][_0x5e5b('0x50')]=rs[_0x5e5b('0x51')]()+'\x20'+_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')]['from'];}var _0x3963eb={'ContactId':_0x54542b['id'],'MailAccountId':_0x1034fa[_0x5e5b('0x42')]['id'],'inReplyTo':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')][_0x5e5b('0x50')],'to':_0x1034fa['body'][_0x5e5b('0x1d')][_0x5e5b('0x37')],'cc':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')]['cc'],'subject':_0x1034fa[_0x5e5b('0x2d')]['message'][_0x5e5b('0x52')],'attach':_0x1034fa['body'][_0x5e5b('0x1d')]['attach'],'lastMsgAt':moment()[_0x5e5b('0x53')](_0x5e5b('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x2d')]};return db[_0x5e5b('0x55')][_0x5e5b('0x56')]({'where':{'closed':![],'MailAccountId':_0x1034fa['account']['id']},'include':[{'model':db[_0x5e5b('0x57')],'as':_0x5e5b('0x58'),'attributes':[_0x5e5b('0x50')],'where':{'messageId':_0x1034fa[_0x5e5b('0x2d')]['message']['inReplyTo']}}]})[_0x5e5b('0x15')](function(_0x12287f){if(_0x12287f){return[_0x12287f,![]];}return db['MailInteraction'][_0x5e5b('0x4d')](_0x3963eb)[_0x5e5b('0x15')](function(_0x517f76){return[_0x517f76,!![]];});});}else{throw new Error(_0x5e5b('0x59'));}})[_0x5e5b('0x5a')](function(_0x5d2c8f,_0x470658){if(_0x5d2c8f){_0x397ba4=_0x470658;if(!_0x470658){return _0x5d2c8f[_0x5e5b('0x5b')]({'inReplyTo':_0x1034fa['body']['message']['messageId'],'to':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')][_0x5e5b('0x37')],'cc':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')]['cc'],'subject':_0x1034fa['body'][_0x5e5b('0x1d')][_0x5e5b('0x52')],'attach':_0x5d2c8f['attach']?_0x5d2c8f[_0x5e5b('0x5c')]:_0x1034fa['body']['message'][_0x5e5b('0x5c')],'substatus':null,'substatusAt':moment()[_0x5e5b('0x53')](_0x5e5b('0x54')),'lastMsgAt':moment()[_0x5e5b('0x53')](_0x5e5b('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x2d')]});}else{return _0x5d2c8f;}}})['then'](function(_0x37146f){_0x4b0ec9[_0x5e5b('0x5d')]=_0x37146f[_0x5e5b('0x5e')]({'plain':!![]});_0x4b0ec9[_0x5e5b('0x5d')][_0x5e5b('0x5f')]=_0x397ba4;return db[_0x5e5b('0x57')][_0x5e5b('0x4d')]({'body':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x2d')],'MailAccountId':_0x1034fa[_0x5e5b('0x42')]['id'],'MailInteractionId':_0x37146f['id'],'direction':'in','ContactId':_0x4b0ec9[_0x5e5b('0x4f')]['id'],'messageId':_0x1034fa['body'][_0x5e5b('0x1d')][_0x5e5b('0x50')],'from':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')][_0x5e5b('0x37')],'to':_0x1034fa['body'][_0x5e5b('0x1d')]['to'],'cc':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')]['cc'],'subject':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')][_0x5e5b('0x52')],'attach':_0x1034fa['body'][_0x5e5b('0x1d')][_0x5e5b('0x5c')],'Attachments':_0x1034fa[_0x5e5b('0x2d')]['message'][_0x5e5b('0x60')],'originTo':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')][_0x5e5b('0x61')],'originCc':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')][_0x5e5b('0x62')],'bcc':_0x1034fa[_0x5e5b('0x2d')][_0x5e5b('0x1d')]['bcc']},{'include':[{'model':db[_0x5e5b('0x63')],'as':'Attachments'}]});})[_0x5e5b('0x15')](function(_0xd054eb){_0x4b0ec9['message']=_0xd054eb;if(_0x4b0ec9['interaction'][_0x5e5b('0x64')]){return db[_0x5e5b('0x65')]['find']({'attributes':['id',_0x5e5b('0x66')],'where':{'id':_0x4b0ec9['interaction']['UserId']}})[_0x5e5b('0x15')](function(_0x5cb712){if(_0x5cb712){_0x4b0ec9[_0x5e5b('0x45')][_0x5e5b('0x67')]({'id':0x0,'priority':0x0,'app':_0x5e5b('0x68'),'appdata':_0x5cb712['name']+','+(_0x4b0ec9[_0x5e5b('0x42')][_0x5e5b('0x69')]||0xa),'interval':_0x5e5b('0x4c')});}return respondWithRpcPromise('Start',_0x5e5b('0x6a'),_0x4b0ec9);});}return respondWithRpcPromise(_0x5e5b('0x6b'),'startRouting',_0x4b0ec9);})[_0x5e5b('0x15')](function(_0x4d28cb){_0x1f1907(_0x4d28cb);})['catch'](function(_0x1e6f7c){_0xc02f70(_0x53b88f[_0x5e5b('0x1a')](0x1f4,_0x1e6f7c[_0x5e5b('0x1d')]));});});}; \ No newline at end of file +var _0x04b8=['catch','ShowMailAccount','find','NotifyMailAccount','body','mail','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','priority','asc','autoclose','length','*,*,*,*','CmContact','create','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Contact\x20not\x20found','spread','format','created','contact','originTo','originCc','bcc','Attachments','interaction','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x5c107d,_0x155dbe){var _0x3eaf06=function(_0x348dd6){while(--_0x348dd6){_0x5c107d['push'](_0x5c107d['shift']());}};_0x3eaf06(++_0x155dbe);}(_0x04b8,0x159));var _0x804b=function(_0x250635,_0x2f621b){_0x250635=_0x250635-0x0;var _0x4f0688=_0x04b8[_0x250635];return _0x4f0688;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var moment=require('moment');var BPromise=require(_0x804b('0x1'));var rs=require(_0x804b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x804b('0x3'))['db'];var utils=require(_0x804b('0x4'));var logger=require('../../config/logger')(_0x804b('0x5'));var config=require(_0x804b('0x6'));var jayson=require(_0x804b('0x7'));var client=jayson['client'][_0x804b('0x8')]({'port':0x232c});config[_0x804b('0x9')]=_[_0x804b('0xa')](config['redis'],{'host':_0x804b('0xb'),'port':0x18eb});var socket=require(_0x804b('0xc'))(new Redis(config['redis']));require(_0x804b('0xd'))[_0x804b('0xe')](socket);function respondWithRpcPromise(_0x222487,_0x22c59a,_0x1c5c15){return new BPromise(function(_0x5c1a40,_0x22c98d){return client[_0x804b('0xf')](_0x222487,_0x1c5c15)[_0x804b('0x10')](function(_0x7029e7){logger[_0x804b('0x11')](_0x804b('0x12'),_0x22c59a,'request\x20sent');logger[_0x804b('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x22c59a,_0x804b('0x14'),JSON[_0x804b('0x15')](_0x7029e7));if(_0x7029e7[_0x804b('0x16')]){if(_0x7029e7[_0x804b('0x16')]['code']===0x1f4){logger[_0x804b('0x16')](_0x804b('0x12'),_0x22c59a,_0x7029e7[_0x804b('0x16')][_0x804b('0x17')]);return _0x22c98d(_0x7029e7['error'][_0x804b('0x17')]);}logger[_0x804b('0x16')]('MailAccount,\x20%s,\x20%s',_0x22c59a,_0x7029e7[_0x804b('0x16')]['message']);return _0x5c1a40(_0x7029e7[_0x804b('0x16')][_0x804b('0x17')]);}else{logger[_0x804b('0x11')](_0x804b('0x12'),_0x22c59a,_0x804b('0x14'));_0x5c1a40(_0x7029e7['result'][_0x804b('0x17')]);}})['catch'](function(_0x247380){logger[_0x804b('0x16')](_0x804b('0x12'),_0x22c59a,_0x247380);_0x22c98d(_0x247380);});});}exports[_0x804b('0x18')]=function(_0x5b2357){var _0x2892b8=this;return new Promise(function(_0x1e29a7,_0x427166){return db[_0x804b('0x19')][_0x804b('0x1a')]({'raw':_0x5b2357[_0x804b('0x1b')]?_0x5b2357[_0x804b('0x1b')][_0x804b('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b2357[_0x804b('0x1b')]?_0x5b2357[_0x804b('0x1b')][_0x804b('0x1d')]||null:null,'attributes':_0x5b2357['options']?_0x5b2357[_0x804b('0x1b')][_0x804b('0x1e')]||null:null,'limit':_0x5b2357['options']?_0x5b2357[_0x804b('0x1b')][_0x804b('0x1f')]||null:null,'include':_0x5b2357[_0x804b('0x1b')]?_0x5b2357[_0x804b('0x1b')][_0x804b('0x20')]?_['map'](_0x5b2357[_0x804b('0x1b')][_0x804b('0x20')],function(_0x4e7266){return{'model':db[_0x4e7266[_0x804b('0x21')]],'as':_0x4e7266['as'],'attributes':_0x4e7266[_0x804b('0x1e')],'include':_0x4e7266[_0x804b('0x20')]?_[_0x804b('0x22')](_0x4e7266[_0x804b('0x20')],function(_0x5cc1dd){return{'model':db[_0x5cc1dd[_0x804b('0x21')]],'as':_0x5cc1dd['as'],'attributes':_0x5cc1dd[_0x804b('0x1e')],'include':_0x5cc1dd[_0x804b('0x20')]?_[_0x804b('0x22')](_0x5cc1dd[_0x804b('0x20')],function(_0x4a6079){return{'model':db[_0x4a6079[_0x804b('0x21')]],'as':_0x4a6079['as'],'attributes':_0x4a6079[_0x804b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x804b('0x10')](function(_0x5c7026){logger[_0x804b('0x11')](_0x804b('0x18'),_0x5b2357);logger[_0x804b('0x13')]('GetMailAccount',_0x5b2357,JSON[_0x804b('0x15')](_0x5c7026));_0x1e29a7(_0x5c7026);})[_0x804b('0x23')](function(_0x5e8f85){logger[_0x804b('0x16')](_0x804b('0x18'),_0x5e8f85[_0x804b('0x17')],_0x5b2357);_0x427166(_0x2892b8[_0x804b('0x16')](0x1f4,_0x5e8f85[_0x804b('0x17')]));});});};exports[_0x804b('0x24')]=function(_0x551792){var _0x3b0692=this;return new Promise(function(_0xc3e8e,_0x16e460){return db[_0x804b('0x19')][_0x804b('0x25')]({'raw':_0x551792[_0x804b('0x1b')]?_0x551792[_0x804b('0x1b')][_0x804b('0x1c')]===undefined?!![]:![]:!![],'where':_0x551792[_0x804b('0x1b')]?_0x551792[_0x804b('0x1b')][_0x804b('0x1d')]||null:null,'attributes':_0x551792[_0x804b('0x1b')]?_0x551792[_0x804b('0x1b')][_0x804b('0x1e')]||null:null,'include':_0x551792[_0x804b('0x1b')]?_0x551792[_0x804b('0x1b')][_0x804b('0x20')]?_[_0x804b('0x22')](_0x551792[_0x804b('0x1b')][_0x804b('0x20')],function(_0xa9d773){return{'model':db[_0xa9d773[_0x804b('0x21')]],'as':_0xa9d773['as'],'attributes':_0xa9d773[_0x804b('0x1e')],'include':_0xa9d773[_0x804b('0x20')]?_[_0x804b('0x22')](_0xa9d773['include'],function(_0x4dde32){return{'model':db[_0x4dde32['model']],'as':_0x4dde32['as'],'attributes':_0x4dde32[_0x804b('0x1e')],'include':_0x4dde32[_0x804b('0x20')]?_[_0x804b('0x22')](_0x4dde32['include'],function(_0x5918f2){return{'model':db[_0x5918f2['model']],'as':_0x5918f2['as'],'attributes':_0x5918f2[_0x804b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x804b('0x10')](function(_0x43cbdf){logger[_0x804b('0x11')](_0x804b('0x24'),_0x551792);logger[_0x804b('0x13')](_0x804b('0x24'),_0x551792,JSON[_0x804b('0x15')](_0x43cbdf));_0xc3e8e(_0x43cbdf);})[_0x804b('0x23')](function(_0x1d8398){logger[_0x804b('0x16')](_0x804b('0x24'),_0x1d8398[_0x804b('0x17')],_0x551792);_0x16e460(_0x3b0692['error'](0x1f4,_0x1d8398[_0x804b('0x17')]));});});};exports[_0x804b('0x26')]=function(_0xb877d6){var _0x3d6d8a=this;return new Promise(function(_0x62cfee,_0x48e61d){var _0x5d337d={'body':_0xb877d6[_0x804b('0x27')],'channel':_0x804b('0x28')};var _0xbaa118=_['difference'](_[_0x804b('0x29')](db['CmContact'][_0x804b('0x2a')]),[_0x804b('0x2b'),_0x804b('0x2c'),_0x804b('0x2d'),_0x804b('0x2e')]);var _0x13b986=![];if(_0xb877d6[_0x804b('0x27')]['id']){delete _0xb877d6['body']['id'];}if(_[_0x804b('0x2f')](_0xb877d6[_0x804b('0x27')][_0x804b('0x30')])){return _0x48e61d(_0x3d6d8a[_0x804b('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x804b('0x2f')](_0xb877d6[_0x804b('0x27')][_0x804b('0x27')])||_0xb877d6[_0x804b('0x27')][_0x804b('0x27')]===''){return _0x48e61d(_0x3d6d8a[_0x804b('0x16')](0x1f4,_0x804b('0x31')));}if(_[_0x804b('0x2f')](_0xb877d6['body'][_0x804b('0x32')])){return _0x48e61d(_0x3d6d8a['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xbaa118));}if(!_['includes'](_0xbaa118,_0xb877d6[_0x804b('0x27')]['mapKey'])){return _0x48e61d(_0x3d6d8a[_0x804b('0x16')](0x1f4,_0x804b('0x33')+_0xbaa118));}var _0x1eda0a={};_0x1eda0a[_0xb877d6[_0x804b('0x27')]['mapKey']]=_0xb877d6[_0x804b('0x27')][_0x804b('0x30')];return db[_0x804b('0x19')]['find']({'where':{'id':_0xb877d6[_0x804b('0x34')]['id']},'include':[{'model':db[_0x804b('0x35')],'as':_0x804b('0x36'),'include':[{'model':db['CmContact'],'as':_0x804b('0x37'),'where':_0x1eda0a,'limit':0x1,'order':[[_0x804b('0x2c'),_0x804b('0x38')]]}]},{'model':db[_0x804b('0x39')],'as':_0x804b('0x3a')},{'model':db[_0x804b('0x3b')],'as':_0x804b('0x3c')}]})[_0x804b('0x10')](function(_0x1d3e73){if(_0x1d3e73&&_0x1d3e73[_0x804b('0x36')]){var _0x376ece=_0x1d3e73[_0x804b('0x3d')]({'plain':!![]});_0x5d337d[_0x804b('0x34')]=_[_0x804b('0x3e')](_0x376ece,['Applications','List']);_0x5d337d[_0x804b('0x3f')]=_0x376ece[_0x804b('0x3a')];_0x5d337d[_0x804b('0x40')]=_0x376ece[_0x804b('0x36')];_0x5d337d[_0x804b('0x3f')]=_['orderBy'](_0x5d337d[_0x804b('0x3f')],[_0x804b('0x41')],[_0x804b('0x42')]);if(_0x5d337d[_0x804b('0x34')]&&_0x5d337d[_0x804b('0x34')][_0x804b('0x43')]){_0x5d337d['applications']['push']({'id':0x0,'priority':_0x5d337d[_0x804b('0x3f')][_0x804b('0x44')]+0x1,'app':'close','appdata':'autoclose','interval':_0x804b('0x45')});}if(_0x5d337d[_0x804b('0x34')][_0x804b('0x3a')]){delete _0x5d337d['account'][_0x804b('0x3a')];}if(_0x5d337d[_0x804b('0x34')]['List']){delete _0x5d337d[_0x804b('0x34')]['List'];}if(_0x376ece[_0x804b('0x36')]['Contacts'][_0x804b('0x44')]){return _0x376ece[_0x804b('0x36')]['Contacts'][0x0];}var _0x2f9360=_['defaults'](_0xb877d6[_0x804b('0x27')],{'firstName':_0xb877d6[_0x804b('0x27')][_0x804b('0x30')],'ListId':_0x376ece[_0x804b('0x2e')]});_0x2f9360[_0xb877d6[_0x804b('0x27')][_0x804b('0x32')]]=_0xb877d6[_0x804b('0x27')][_0x804b('0x30')];return db[_0x804b('0x46')][_0x804b('0x47')](_0x2f9360);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x13fb5c){_0x5d337d['contact']=_0x13fb5c;if(_0x13fb5c){if(!_0xb877d6['body'][_0x804b('0x17')][_0x804b('0x48')]){_0xb877d6[_0x804b('0x27')][_0x804b('0x17')]['messageId']=rs['generate']()+'\x20'+_0xb877d6[_0x804b('0x27')][_0x804b('0x17')][_0x804b('0x30')];}var _0x6005bf={'ContactId':_0x13fb5c['id'],'MailAccountId':_0xb877d6[_0x804b('0x34')]['id'],'inReplyTo':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')][_0x804b('0x48')],'to':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')][_0x804b('0x30')],'cc':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')]['cc'],'subject':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')][_0x804b('0x49')],'attach':_0xb877d6['body'][_0x804b('0x17')][_0x804b('0x4a')],'lastMsgAt':moment()['format'](_0x804b('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0xb877d6[_0x804b('0x27')][_0x804b('0x27')]};return db[_0x804b('0x4c')]['find']({'where':{'closed':![],'MailAccountId':_0xb877d6[_0x804b('0x34')]['id']},'include':[{'model':db[_0x804b('0x4d')],'as':'Messages','attributes':[_0x804b('0x48')],'where':{'messageId':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')]['inReplyTo']}}]})[_0x804b('0x10')](function(_0x313b76){if(_0x313b76){return[_0x313b76,![]];}return db[_0x804b('0x4c')][_0x804b('0x47')](_0x6005bf)[_0x804b('0x10')](function(_0x555d2e){return[_0x555d2e,!![]];});});}else{throw new Error(_0x804b('0x4e'));}})[_0x804b('0x4f')](function(_0x3c043e,_0x33f78d){if(_0x3c043e){_0x13b986=_0x33f78d;if(!_0x33f78d){return _0x3c043e['update']({'inReplyTo':_0xb877d6['body'][_0x804b('0x17')]['messageId'],'to':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')][_0x804b('0x30')],'cc':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')]['cc'],'subject':_0xb877d6['body'][_0x804b('0x17')][_0x804b('0x49')],'attach':_0x3c043e[_0x804b('0x4a')]?_0x3c043e['attach']:_0xb877d6[_0x804b('0x27')][_0x804b('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0x804b('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x804b('0x50')](_0x804b('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0xb877d6['body'][_0x804b('0x27')]});}else{return _0x3c043e;}}})[_0x804b('0x10')](function(_0xaedaf6){_0x5d337d['interaction']=_0xaedaf6[_0x804b('0x3d')]({'plain':!![]});_0x5d337d['interaction'][_0x804b('0x51')]=_0x13b986;return db[_0x804b('0x4d')][_0x804b('0x47')]({'body':_0xb877d6[_0x804b('0x27')]['body'],'MailAccountId':_0xb877d6[_0x804b('0x34')]['id'],'MailInteractionId':_0xaedaf6['id'],'direction':'in','ContactId':_0x5d337d[_0x804b('0x52')]['id'],'messageId':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')][_0x804b('0x48')],'from':_0xb877d6[_0x804b('0x27')]['message'][_0x804b('0x30')],'to':_0xb877d6[_0x804b('0x27')]['message']['to'],'cc':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')]['cc'],'subject':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')]['subject'],'attach':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')]['attach'],'Attachments':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')]['attachments'],'originTo':_0xb877d6[_0x804b('0x27')]['message'][_0x804b('0x53')],'originCc':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')][_0x804b('0x54')],'bcc':_0xb877d6[_0x804b('0x27')][_0x804b('0x17')][_0x804b('0x55')]},{'include':[{'model':db['Attachment'],'as':_0x804b('0x56')}]});})['then'](function(_0x18fdd5){_0x5d337d[_0x804b('0x17')]=_0x18fdd5;if(_0x5d337d[_0x804b('0x57')][_0x804b('0x58')]){return db[_0x804b('0x59')][_0x804b('0x25')]({'attributes':['id',_0x804b('0x5a')],'where':{'id':_0x5d337d[_0x804b('0x57')][_0x804b('0x58')]}})[_0x804b('0x10')](function(_0x38e199){if(_0x38e199){_0x5d337d['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x804b('0x5b'),'appdata':_0x38e199[_0x804b('0x5a')]+','+(_0x5d337d[_0x804b('0x34')][_0x804b('0x5c')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x804b('0x5d'),_0x804b('0x5e'),_0x5d337d);});}return respondWithRpcPromise(_0x804b('0x5d'),_0x804b('0x5e'),_0x5d337d);})[_0x804b('0x10')](function(_0x1ba4ba){_0x62cfee(_0x1ba4ba);})[_0x804b('0x23')](function(_0x3185c3){_0x48e61d(_0x3d6d8a[_0x804b('0x16')](0x1f4,_0x3185c3[_0x804b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 8bf8a20..9bddcdd 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 _0xc906=['register','mailAccount:','./mailAccount.events','save','update','emit','removeListener'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xc906,0x1ad));var _0x6c90=function(_0x4a10dc,_0x18293e){_0x4a10dc=_0x4a10dc-0x0;var _0x5f50a1=_0xc906[_0x4a10dc];return _0x5f50a1;};'use strict';var MailAccountEvents=require(_0x6c90('0x0'));var events=[_0x6c90('0x1'),'remove',_0x6c90('0x2')];function createListener(_0x29fa26,_0xc65efc){return function(_0x52d2ec){_0xc65efc[_0x6c90('0x3')](_0x29fa26,_0x52d2ec);};}function removeListener(_0x237d5d,_0x3bb133){return function(){MailAccountEvents[_0x6c90('0x4')](_0x237d5d,_0x3bb133);};}exports[_0x6c90('0x5')]=function(_0x2b55b8){for(var _0x5491d9=0x0,_0x4c1d85=events['length'];_0x5491d9<_0x4c1d85;_0x5491d9++){var _0x2a960d=events[_0x5491d9];var _0x54d440=createListener(_0x6c90('0x6')+_0x2a960d,_0x2b55b8);MailAccountEvents['on'](_0x2a960d,_0x54d440);}}; \ No newline at end of file +var _0x31f0=['emit','removeListener','mailAccount:','./mailAccount.events','remove'];(function(_0x55b9ec,_0x41377a){var _0x515f6f=function(_0x14a2bd){while(--_0x14a2bd){_0x55b9ec['push'](_0x55b9ec['shift']());}};_0x515f6f(++_0x41377a);}(_0x31f0,0xb7));var _0x031f=function(_0x6f0aba,_0x46b6a4){_0x6f0aba=_0x6f0aba-0x0;var _0x52d519=_0x31f0[_0x6f0aba];return _0x52d519;};'use strict';var MailAccountEvents=require(_0x031f('0x0'));var events=['save',_0x031f('0x1'),'update'];function createListener(_0x3747a5,_0x2021ea){return function(_0x2b04d4){_0x2021ea[_0x031f('0x2')](_0x3747a5,_0x2b04d4);};}function removeListener(_0x526a45,_0x3c0612){return function(){MailAccountEvents[_0x031f('0x3')](_0x526a45,_0x3c0612);};}exports['register']=function(_0x4c0f94){for(var _0x56328c=0x0,_0x3dc98e=events['length'];_0x56328c<_0x3dc98e;_0x56328c++){var _0x365f59=events[_0x56328c];var _0x4300b4=createListener(_0x031f('0x4')+_0x365f59,_0x4c0f94);MailAccountEvents['on'](_0x365f59,_0x4300b4);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 03288d3..f9c507d 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 _0xbf6e=['get','/:id','isAuthenticated','show','put','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb0724a,_0x3f3393){var _0x31104c=function(_0x48f309){while(--_0x48f309){_0xb0724a['push'](_0xb0724a['shift']());}};_0x31104c(++_0x3f3393);}(_0xbf6e,0x149));var _0xebf6=function(_0x86b9b,_0x3bee57){_0x86b9b=_0x86b9b-0x0;var _0x42a820=_0xbf6e[_0x86b9b];return _0x42a820;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebf6('0x0'));var timeout=require(_0xebf6('0x1'));var express=require(_0xebf6('0x2'));var router=express[_0xebf6('0x3')]();var auth=require(_0xebf6('0x4'));var interaction=require(_0xebf6('0x5'));var config=require(_0xebf6('0x6'));var controller=require('./mailApplication.controller');router[_0xebf6('0x7')](_0xebf6('0x8'),auth[_0xebf6('0x9')](),controller[_0xebf6('0xa')]);router[_0xebf6('0xb')](_0xebf6('0x8'),auth[_0xebf6('0x9')](),controller['update']);router[_0xebf6('0xc')](_0xebf6('0x8'),auth[_0xebf6('0x9')](),controller['destroy']);module[_0xebf6('0xd')]=router; \ No newline at end of file +var _0x0972=['delete','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0972,0x64));var _0x2097=function(_0x39ba28,_0x1d49f3){_0x39ba28=_0x39ba28-0x0;var _0x39caca=_0x0972[_0x39ba28];return _0x39caca;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var auth=require(_0x2097('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2097('0x4'));var controller=require(_0x2097('0x5'));router[_0x2097('0x6')](_0x2097('0x7'),auth[_0x2097('0x8')](),controller[_0x2097('0x9')]);router[_0x2097('0xa')]('/:id',auth[_0x2097('0x8')](),controller[_0x2097('0xb')]);router[_0x2097('0xc')](_0x2097('0x7'),auth[_0x2097('0x8')](),controller['destroy']);module[_0x2097('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 48d5122..33925f4 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 _0x5e39=['noop','TEXT','*,*,*,*','exports'];(function(_0x176fe6,_0x4c4886){var _0x2b85f5=function(_0x2cba9c){while(--_0x2cba9c){_0x176fe6['push'](_0x176fe6['shift']());}};_0x2b85f5(++_0x4c4886);}(_0x5e39,0x15b));var _0x95e3=function(_0x1a345e,_0x48f11d){_0x1a345e=_0x1a345e-0x0;var _0x505e93=_0x5e39[_0x1a345e];return _0x505e93;};'use strict';var Sequelize=require('sequelize');module[_0x95e3('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x95e3('0x1')},'appdata':{'type':Sequelize[_0x95e3('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x95e3('0x3')}}; \ No newline at end of file +var _0x243d=['INTEGER','STRING','noop'];(function(_0x3cf718,_0x474b79){var _0x28e526=function(_0x43865b){while(--_0x43865b){_0x3cf718['push'](_0x3cf718['shift']());}};_0x28e526(++_0x474b79);}(_0x243d,0xc6));var _0xd243=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x243d[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xd243('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xd243('0x1')],'allowNull':![],'defaultValue':_0xd243('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd243('0x1')]},'interval':{'type':Sequelize[_0xd243('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 07bae8d..de7d6d2 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 _0x35c8=['rimraf','zip-dir','fast-json-patch','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','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','end','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','attributes','fields','include','merge','find','then','catch','body','destroy','html-pdf','eml-format'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0x35c8,0xa6));var _0x835c=function(_0x13072c,_0x567eec){_0x13072c=_0x13072c-0x0;var _0x4b2b8a=_0x35c8[_0x13072c];return _0x4b2b8a;};'use strict';var pdf=require(_0x835c('0x0'));var emlformat=require(_0x835c('0x1'));var rimraf=require(_0x835c('0x2'));var zipdir=require(_0x835c('0x3'));var jsonpatch=require(_0x835c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x835c('0x5'));var Mustache=require(_0x835c('0x6'));var util=require(_0x835c('0x7'));var path=require(_0x835c('0x8'));var sox=require(_0x835c('0x9'));var csv=require(_0x835c('0xa'));var ejs=require(_0x835c('0xb'));var fs=require('fs');var _=require(_0x835c('0xc'));var squel=require('squel');var crypto=require(_0x835c('0xd'));var jsforce=require(_0x835c('0xe'));var deskjs=require(_0x835c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x835c('0x10'));var Papa=require(_0x835c('0x11'));var Redis=require(_0x835c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x835c('0x13'));var as=require(_0x835c('0x14'));var hardwareService=require(_0x835c('0x15'));var logger=require(_0x835c('0x16'))(_0x835c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x835c('0x18'))['db'];function respondWithStatusCode(_0x41d462,_0x25a426){_0x25a426=_0x25a426||0xcc;return function(_0x5bf773){if(_0x5bf773){return _0x41d462[_0x835c('0x19')](_0x25a426);}return _0x41d462[_0x835c('0x1a')](_0x25a426)['end']();};}function respondWithResult(_0x5e9f03,_0x27325d){_0x27325d=_0x27325d||0xc8;return function(_0x3f3981){if(_0x3f3981){return _0x5e9f03[_0x835c('0x1a')](_0x27325d)[_0x835c('0x1b')](_0x3f3981);}};}function respondWithFilteredResult(_0x450d10,_0x4c4329){return function(_0x573dbb){if(_0x573dbb){var _0x2aa00b=_0x573dbb[_0x835c('0x1c')],_0x6fb7d4=_0x4c4329[_0x835c('0x1d')],_0x2c36f5=_0x4c4329[_0x835c('0x1d')]+_0x4c4329[_0x835c('0x1e')],_0x60ff38;if(_0x2c36f5>=_0x2aa00b){_0x2c36f5=_0x2aa00b;_0x60ff38=0xc8;}else{_0x60ff38=0xce;}_0x450d10[_0x835c('0x1a')](_0x60ff38);return _0x450d10[_0x835c('0x1f')](_0x835c('0x20'),_0x6fb7d4+'-'+_0x2c36f5+'/'+_0x2aa00b)['json'](_0x573dbb);}return null;};}function patchUpdates(_0x2f3645){return function(_0x4164d4){try{jsonpatch[_0x835c('0x21')](_0x4164d4,_0x2f3645,!![]);}catch(_0x33f055){return BPromise['reject'](_0x33f055);}return _0x4164d4['save']();};}function saveUpdates(_0x43688e,_0x2bdaa0){return function(_0x2c95de){if(_0x2c95de){return _0x2c95de[_0x835c('0x22')](_0x43688e)['then'](function(_0x58601f){return _0x58601f;});}return null;};}function removeEntity(_0x426bf1,_0xac1982){return function(_0x5ec56b){if(_0x5ec56b){return _0x5ec56b['destroy']()['then'](function(){_0x426bf1[_0x835c('0x1a')](0xcc)[_0x835c('0x23')]();});}};}function handleEntityNotFound(_0x18444b,_0x640b5e){return function(_0x5eff20){if(!_0x5eff20){_0x18444b[_0x835c('0x19')](0x194);}return _0x5eff20;};}function handleError(_0x725015,_0x385414){_0x385414=_0x385414||0x1f4;return function(_0x44f1a5){logger[_0x835c('0x24')](_0x44f1a5[_0x835c('0x25')]);if(_0x44f1a5[_0x835c('0x26')]){delete _0x44f1a5['name'];}_0x725015[_0x835c('0x1a')](_0x385414)[_0x835c('0x27')](_0x44f1a5);};}exports[_0x835c('0x28')]=function(_0x305395,_0x21ee70){var _0x5b7024={'raw':!![],'where':{'id':_0x305395[_0x835c('0x29')]['id']}},_0x3eea6f={};_0x3eea6f[_0x835c('0x2a')]=_[_0x835c('0x2b')](db[_0x835c('0x2c')]['rawAttributes']);_0x3eea6f[_0x835c('0x2d')]=_[_0x835c('0x2b')](_0x305395['query']);_0x3eea6f[_0x835c('0x2e')]=_['intersection'](_0x3eea6f['model'],_0x3eea6f['query']);_0x5b7024[_0x835c('0x2f')]=_['intersection'](_0x3eea6f[_0x835c('0x2a')],qs['fields'](_0x305395[_0x835c('0x2d')][_0x835c('0x30')]));_0x5b7024[_0x835c('0x2f')]=_0x5b7024['attributes']['length']?_0x5b7024[_0x835c('0x2f')]:_0x3eea6f[_0x835c('0x2a')];if(_0x305395['query']['includeAll']){_0x5b7024[_0x835c('0x31')]=[{'all':!![]}];}_0x5b7024=_[_0x835c('0x32')]({},_0x5b7024,_0x305395['options']);return db[_0x835c('0x2c')][_0x835c('0x33')](_0x5b7024)[_0x835c('0x34')](handleEntityNotFound(_0x21ee70,null))['then'](respondWithResult(_0x21ee70,null))[_0x835c('0x35')](handleError(_0x21ee70,null));};exports[_0x835c('0x22')]=function(_0x20fb4e,_0x3412f2){if(_0x20fb4e[_0x835c('0x36')]['id']){delete _0x20fb4e[_0x835c('0x36')]['id'];}return db[_0x835c('0x2c')][_0x835c('0x33')]({'where':{'id':_0x20fb4e[_0x835c('0x29')]['id']}})[_0x835c('0x34')](handleEntityNotFound(_0x3412f2,null))[_0x835c('0x34')](saveUpdates(_0x20fb4e['body'],null))[_0x835c('0x34')](respondWithResult(_0x3412f2,null))['catch'](handleError(_0x3412f2,null));};exports[_0x835c('0x37')]=function(_0x1f6822,_0x20ca5b){return db[_0x835c('0x2c')][_0x835c('0x33')]({'where':{'id':_0x1f6822[_0x835c('0x29')]['id']}})['then'](handleEntityNotFound(_0x20ca5b,null))[_0x835c('0x34')](removeEntity(_0x20ca5b,null))['catch'](handleError(_0x20ca5b,null));}; \ No newline at end of file +var _0x0748=['status','json','count','offset','limit','Content-Range','save','update','sendStatus','error','stack','name','send','params','model','keys','rawAttributes','intersection','query','fields','attributes','includeAll','include','merge','options','MailApplication','find','then','catch','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x498889,_0x547993){var _0xd6cb2d=function(_0x50b51a){while(--_0x50b51a){_0x498889['push'](_0x498889['shift']());}};_0xd6cb2d(++_0x547993);}(_0x0748,0xc7));var _0x8074=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x0748[_0xbe200f];return _0x192597;};'use strict';var pdf=require(_0x8074('0x0'));var emlformat=require(_0x8074('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8074('0x2'));var jsonpatch=require(_0x8074('0x3'));var rp=require(_0x8074('0x4'));var moment=require(_0x8074('0x5'));var BPromise=require(_0x8074('0x6'));var Mustache=require('mustache');var util=require(_0x8074('0x7'));var path=require(_0x8074('0x8'));var sox=require(_0x8074('0x9'));var csv=require('to-csv');var ejs=require(_0x8074('0xa'));var fs=require('fs');var _=require(_0x8074('0xb'));var squel=require('squel');var crypto=require(_0x8074('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8074('0xd'));var querystring=require(_0x8074('0xe'));var Papa=require(_0x8074('0xf'));var Redis=require(_0x8074('0x10'));var authService=require(_0x8074('0x11'));var qs=require(_0x8074('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8074('0x13'));var logger=require(_0x8074('0x14'))(_0x8074('0x15'));var utils=require(_0x8074('0x16'));var config=require(_0x8074('0x17'));var db=require(_0x8074('0x18'))['db'];function respondWithStatusCode(_0x596136,_0x5dba05){_0x5dba05=_0x5dba05||0xcc;return function(_0x59d9ae){if(_0x59d9ae){return _0x596136['sendStatus'](_0x5dba05);}return _0x596136[_0x8074('0x19')](_0x5dba05)['end']();};}function respondWithResult(_0x1a0eaa,_0x50a643){_0x50a643=_0x50a643||0xc8;return function(_0x15866e){if(_0x15866e){return _0x1a0eaa[_0x8074('0x19')](_0x50a643)[_0x8074('0x1a')](_0x15866e);}};}function respondWithFilteredResult(_0x36205e,_0x5574cd){return function(_0x3a24e1){if(_0x3a24e1){var _0x2e99b5=_0x3a24e1[_0x8074('0x1b')],_0x3e21ca=_0x5574cd[_0x8074('0x1c')],_0x45e157=_0x5574cd[_0x8074('0x1c')]+_0x5574cd[_0x8074('0x1d')],_0x287d48;if(_0x45e157>=_0x2e99b5){_0x45e157=_0x2e99b5;_0x287d48=0xc8;}else{_0x287d48=0xce;}_0x36205e['status'](_0x287d48);return _0x36205e['set'](_0x8074('0x1e'),_0x3e21ca+'-'+_0x45e157+'/'+_0x2e99b5)['json'](_0x3a24e1);}return null;};}function patchUpdates(_0x68de51){return function(_0x128cd0){try{jsonpatch['apply'](_0x128cd0,_0x68de51,!![]);}catch(_0x6996c8){return BPromise['reject'](_0x6996c8);}return _0x128cd0[_0x8074('0x1f')]();};}function saveUpdates(_0x302294,_0xdfa50e){return function(_0x526aaa){if(_0x526aaa){return _0x526aaa[_0x8074('0x20')](_0x302294)['then'](function(_0x5d7fb7){return _0x5d7fb7;});}return null;};}function removeEntity(_0x145d16,_0x3afbe4){return function(_0x32bbc7){if(_0x32bbc7){return _0x32bbc7['destroy']()['then'](function(){_0x145d16[_0x8074('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c935,_0x4ababb){return function(_0x4c53a7){if(!_0x4c53a7){_0x54c935[_0x8074('0x21')](0x194);}return _0x4c53a7;};}function handleError(_0x5c0077,_0x67ca42){_0x67ca42=_0x67ca42||0x1f4;return function(_0x2b7a80){logger[_0x8074('0x22')](_0x2b7a80[_0x8074('0x23')]);if(_0x2b7a80['name']){delete _0x2b7a80[_0x8074('0x24')];}_0x5c0077[_0x8074('0x19')](_0x67ca42)[_0x8074('0x25')](_0x2b7a80);};}exports['show']=function(_0x26b80c,_0x1c3476){var _0x485ffe={'raw':!![],'where':{'id':_0x26b80c[_0x8074('0x26')]['id']}},_0x497802={};_0x497802[_0x8074('0x27')]=_[_0x8074('0x28')](db['MailApplication'][_0x8074('0x29')]);_0x497802['query']=_['keys'](_0x26b80c['query']);_0x497802['filters']=_[_0x8074('0x2a')](_0x497802['model'],_0x497802[_0x8074('0x2b')]);_0x485ffe['attributes']=_['intersection'](_0x497802[_0x8074('0x27')],qs['fields'](_0x26b80c[_0x8074('0x2b')][_0x8074('0x2c')]));_0x485ffe[_0x8074('0x2d')]=_0x485ffe[_0x8074('0x2d')]['length']?_0x485ffe[_0x8074('0x2d')]:_0x497802['model'];if(_0x26b80c[_0x8074('0x2b')][_0x8074('0x2e')]){_0x485ffe[_0x8074('0x2f')]=[{'all':!![]}];}_0x485ffe=_[_0x8074('0x30')]({},_0x485ffe,_0x26b80c[_0x8074('0x31')]);return db[_0x8074('0x32')][_0x8074('0x33')](_0x485ffe)['then'](handleEntityNotFound(_0x1c3476,null))[_0x8074('0x34')](respondWithResult(_0x1c3476,null))[_0x8074('0x35')](handleError(_0x1c3476,null));};exports[_0x8074('0x20')]=function(_0x33e893,_0x171731){if(_0x33e893[_0x8074('0x36')]['id']){delete _0x33e893[_0x8074('0x36')]['id'];}return db[_0x8074('0x32')][_0x8074('0x33')]({'where':{'id':_0x33e893['params']['id']}})[_0x8074('0x34')](handleEntityNotFound(_0x171731,null))['then'](saveUpdates(_0x33e893[_0x8074('0x36')],null))[_0x8074('0x34')](respondWithResult(_0x171731,null))[_0x8074('0x35')](handleError(_0x171731,null));};exports[_0x8074('0x37')]=function(_0x43c9ef,_0x347475){return db[_0x8074('0x32')]['find']({'where':{'id':_0x43c9ef[_0x8074('0x26')]['id']}})[_0x8074('0x34')](handleEntityNotFound(_0x347475,null))[_0x8074('0x34')](removeEntity(_0x347475,null))['catch'](handleError(_0x347475,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index e803af3..5fe6805 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 _0xd769=['../../config/logger','api','moment','request-promise','rimraf','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x1cf48c,_0x2100fe){var _0x30a1c6=function(_0xf5b576){while(--_0xf5b576){_0x1cf48c['push'](_0x1cf48c['shift']());}};_0x30a1c6(++_0x2100fe);}(_0xd769,0x116));var _0x9d76=function(_0x5ddbc3,_0x224176){_0x5ddbc3=_0x5ddbc3-0x0;var _0x7f91b7=_0xd769[_0x5ddbc3];return _0x7f91b7;};'use strict';var _=require(_0x9d76('0x0'));var util=require(_0x9d76('0x1'));var logger=require(_0x9d76('0x2'))(_0x9d76('0x3'));var moment=require(_0x9d76('0x4'));var BPromise=require('bluebird');var rp=require(_0x9d76('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d76('0x6'));var config=require('../../config/environment');var attributes=require(_0x9d76('0x7'));module[_0x9d76('0x8')]=function(_0x3bc094,_0xa93489){return _0x3bc094[_0x9d76('0x9')](_0x9d76('0xa'),attributes,{'tableName':_0x9d76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9d76('0xc'),'collate':_0x9d76('0xd')});}; \ No newline at end of file +var _0x0624=['bluebird','request-promise','path','rimraf','../../config/environment','exports','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0x0624,0x141));var _0x4062=function(_0x86c946,_0x44b63b){_0x86c946=_0x86c946-0x0;var _0x210b09=_0x0624[_0x86c946];return _0x210b09;};'use strict';var _=require(_0x4062('0x0'));var util=require(_0x4062('0x1'));var logger=require(_0x4062('0x2'))('api');var moment=require(_0x4062('0x3'));var BPromise=require(_0x4062('0x4'));var rp=require(_0x4062('0x5'));var fs=require('fs');var path=require(_0x4062('0x6'));var rimraf=require(_0x4062('0x7'));var config=require(_0x4062('0x8'));var attributes=require('./mailApplication.attributes');module[_0x4062('0x9')]=function(_0x23d907,_0x16987f){return _0x23d907['define'](_0x4062('0xa'),attributes,{'tableName':_0x4062('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4062('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ff2ea30..9eb0839 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 _0x6322=['attributes','limit','stringify','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','where'];(function(_0xdc688e,_0x5f4edc){var _0x2a9763=function(_0x27219f){while(--_0x27219f){_0xdc688e['push'](_0xdc688e['shift']());}};_0x2a9763(++_0x5f4edc);}(_0x6322,0x1a7));var _0x2632=function(_0xd6b214,_0x206fa2){_0xd6b214=_0xd6b214-0x0;var _0x1b69d0=_0x6322[_0xd6b214];return _0x1b69d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2632('0x0'));var BPromise=require(_0x2632('0x1'));var rs=require(_0x2632('0x2'));var fs=require('fs');var Redis=require(_0x2632('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2632('0x4'));var logger=require(_0x2632('0x5'))('rpc');var config=require(_0x2632('0x6'));var jayson=require(_0x2632('0x7'));var client=jayson[_0x2632('0x8')][_0x2632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1384be,_0x41bef4,_0x5c3513){return new BPromise(function(_0x19c503,_0x95b73f){return client['request'](_0x1384be,_0x5c3513)[_0x2632('0xa')](function(_0x39e82b){logger[_0x2632('0xb')](_0x2632('0xc'),_0x41bef4,'request\x20sent');logger[_0x2632('0xd')](_0x2632('0xe'),_0x41bef4,_0x2632('0xf'),JSON['stringify'](_0x39e82b));if(_0x39e82b['error']){if(_0x39e82b['error'][_0x2632('0x10')]===0x1f4){logger[_0x2632('0x11')](_0x2632('0xc'),_0x41bef4,_0x39e82b[_0x2632('0x11')]['message']);return _0x95b73f(_0x39e82b['error']['message']);}logger[_0x2632('0x11')]('MailApplication,\x20%s,\x20%s',_0x41bef4,_0x39e82b['error']['message']);return _0x19c503(_0x39e82b['error'][_0x2632('0x12')]);}else{logger['info'](_0x2632('0xc'),_0x41bef4,_0x2632('0xf'));_0x19c503(_0x39e82b[_0x2632('0x13')][_0x2632('0x12')]);}})[_0x2632('0x14')](function(_0x312fd6){logger[_0x2632('0x11')](_0x2632('0xc'),_0x41bef4,_0x312fd6);_0x95b73f(_0x312fd6);});});}exports[_0x2632('0x15')]=function(_0x5526a2){var _0x3640c9=this;return new Promise(function(_0x5f1774,_0x494f18){return db[_0x2632('0x16')][_0x2632('0x17')](_0x5526a2['body'],{'raw':_0x5526a2[_0x2632('0x18')]?_0x5526a2[_0x2632('0x18')][_0x2632('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5526a2[_0x2632('0x18')]?_0x5526a2['options'][_0x2632('0x1a')]||null:null,'attributes':_0x5526a2['options']?_0x5526a2['options'][_0x2632('0x1b')]||null:null,'limit':_0x5526a2[_0x2632('0x18')]?_0x5526a2['options'][_0x2632('0x1c')]||null:null})[_0x2632('0xa')](function(_0x2cad53){logger['info'](_0x2632('0x15'),_0x5526a2);logger[_0x2632('0xd')](_0x2632('0x15'),_0x5526a2,JSON[_0x2632('0x1d')](_0x2cad53));_0x5f1774(_0x2cad53);})[_0x2632('0x14')](function(_0x3e1cff){logger[_0x2632('0x11')](_0x2632('0x15'),_0x3e1cff[_0x2632('0x12')],_0x5526a2);_0x494f18(_0x3640c9[_0x2632('0x11')](0x1f4,_0x3e1cff['message']));});});}; \ No newline at end of file +var _0x0756=['attributes','limit','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','code','MailApplication,\x20%s,\x20%s','error','message','result','UpdateMailApplication','MailApplication','update','body','options'];(function(_0x5e1954,_0x28fe51){var _0x1fadc0=function(_0x56a8d7){while(--_0x56a8d7){_0x5e1954['push'](_0x5e1954['shift']());}};_0x1fadc0(++_0x28fe51);}(_0x0756,0xb8));var _0x6075=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x0756[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x6075('0x0'));var util=require(_0x6075('0x1'));var moment=require('moment');var BPromise=require(_0x6075('0x2'));var rs=require(_0x6075('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6075('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6075('0x5'))(_0x6075('0x6'));var config=require(_0x6075('0x7'));var jayson=require(_0x6075('0x8'));var client=jayson[_0x6075('0x9')][_0x6075('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcdda96,_0x4cab72,_0x543b21){return new BPromise(function(_0x340a7a,_0x3a602e){return client[_0x6075('0xb')](_0xcdda96,_0x543b21)[_0x6075('0xc')](function(_0x4a0f4c){logger['info']('MailApplication,\x20%s,\x20%s',_0x4cab72,_0x6075('0xd'));logger[_0x6075('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x4cab72,_0x6075('0xd'),JSON[_0x6075('0xf')](_0x4a0f4c));if(_0x4a0f4c['error']){if(_0x4a0f4c['error'][_0x6075('0x10')]===0x1f4){logger['error'](_0x6075('0x11'),_0x4cab72,_0x4a0f4c[_0x6075('0x12')][_0x6075('0x13')]);return _0x3a602e(_0x4a0f4c[_0x6075('0x12')][_0x6075('0x13')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x4cab72,_0x4a0f4c[_0x6075('0x12')][_0x6075('0x13')]);return _0x340a7a(_0x4a0f4c[_0x6075('0x12')][_0x6075('0x13')]);}else{logger['info'](_0x6075('0x11'),_0x4cab72,_0x6075('0xd'));_0x340a7a(_0x4a0f4c[_0x6075('0x14')][_0x6075('0x13')]);}})['catch'](function(_0xf0d1a1){logger[_0x6075('0x12')](_0x6075('0x11'),_0x4cab72,_0xf0d1a1);_0x3a602e(_0xf0d1a1);});});}exports[_0x6075('0x15')]=function(_0x521710){var _0x478d84=this;return new Promise(function(_0x2c58f5,_0x42c54a){return db[_0x6075('0x16')][_0x6075('0x17')](_0x521710[_0x6075('0x18')],{'raw':_0x521710[_0x6075('0x19')]?_0x521710[_0x6075('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x521710[_0x6075('0x19')]?_0x521710[_0x6075('0x19')]['where']||null:null,'attributes':_0x521710[_0x6075('0x19')]?_0x521710['options'][_0x6075('0x1a')]||null:null,'limit':_0x521710[_0x6075('0x19')]?_0x521710[_0x6075('0x19')][_0x6075('0x1b')]||null:null})[_0x6075('0xc')](function(_0x392810){logger[_0x6075('0x1c')]('UpdateMailApplication',_0x521710);logger['debug'](_0x6075('0x15'),_0x521710,JSON[_0x6075('0xf')](_0x392810));_0x2c58f5(_0x392810);})[_0x6075('0x1d')](function(_0x1e1a93){logger[_0x6075('0x12')](_0x6075('0x15'),_0x1e1a93[_0x6075('0x13')],_0x521710);_0x42c54a(_0x478d84['error'](0x1f4,_0x1e1a93[_0x6075('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 7d3e88b..d0ebe17 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 _0x68da=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','mail','addTags','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x2c6ae3,_0x5451aa){var _0x3f82bf=function(_0x3d1ec7){while(--_0x3d1ec7){_0x2c6ae3['push'](_0x2c6ae3['shift']());}};_0x3f82bf(++_0x5451aa);}(_0x68da,0x173));var _0xa68d=function(_0x5e8460,_0x2003b5){_0x5e8460=_0x5e8460-0x0;var _0x3d50fd=_0x68da[_0x5e8460];return _0x3d50fd;};'use strict';var multer=require(_0xa68d('0x0'));var util=require(_0xa68d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa68d('0x2'));var router=express[_0xa68d('0x3')]();var auth=require(_0xa68d('0x4'));var interaction=require(_0xa68d('0x5'));var config=require(_0xa68d('0x6'));var controller=require(_0xa68d('0x7'));router[_0xa68d('0x8')]('/',auth[_0xa68d('0x9')](),controller[_0xa68d('0xa')]);router[_0xa68d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa68d('0xb')]);router[_0xa68d('0x8')](_0xa68d('0xc'),auth['isAuthenticated'](),controller[_0xa68d('0xd')]);router[_0xa68d('0x8')]('/:id/messages',auth[_0xa68d('0x9')](),controller[_0xa68d('0xe')]);router['get'](_0xa68d('0xf'),auth['isAuthenticated'](),controller[_0xa68d('0x10')]);router[_0xa68d('0x11')]('/',auth[_0xa68d('0x9')](),controller['create']);router['post'](_0xa68d('0x12'),auth[_0xa68d('0x9')](),controller[_0xa68d('0x13')]);router[_0xa68d('0x11')](_0xa68d('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0xa68d('0x15'),'mailinteraction:addtags'),controller[_0xa68d('0x16')]);router['put'](_0xa68d('0xc'),auth[_0xa68d('0x9')](),interaction[_0xa68d('0x17')](_0xa68d('0x15'),_0xa68d('0x18')),controller[_0xa68d('0x19')]);router[_0xa68d('0x1a')]('/:id',auth[_0xa68d('0x9')](),interaction[_0xa68d('0x17')](_0xa68d('0x15'),_0xa68d('0x1b')),controller[_0xa68d('0x1c')]);router[_0xa68d('0x1a')](_0xa68d('0x14'),auth[_0xa68d('0x9')](),controller[_0xa68d('0x1d')]);module[_0xa68d('0x1e')]=router; \ No newline at end of file +var _0x55db=['destroy','delete','/:id/tags','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','mail','mailinteraction:addtags','addTags','tracked','mailinteraction:update','update','mailinteraction:destroy'];(function(_0xfa716b,_0x1fa236){var _0xe946ab=function(_0x495c2e){while(--_0x495c2e){_0xfa716b['push'](_0xfa716b['shift']());}};_0xe946ab(++_0x1fa236);}(_0x55db,0x1b5));var _0xb55d=function(_0x27143d,_0x157388){_0x27143d=_0x27143d-0x0;var _0x2ab2cc=_0x55db[_0x27143d];return _0x2ab2cc;};'use strict';var multer=require('multer');var util=require(_0xb55d('0x0'));var path=require(_0xb55d('0x1'));var timeout=require('connect-timeout');var express=require(_0xb55d('0x2'));var router=express[_0xb55d('0x3')]();var auth=require(_0xb55d('0x4'));var interaction=require(_0xb55d('0x5'));var config=require('../../config/environment');var controller=require(_0xb55d('0x6'));router['get']('/',auth[_0xb55d('0x7')](),controller[_0xb55d('0x8')]);router[_0xb55d('0x9')](_0xb55d('0xa'),auth[_0xb55d('0x7')](),controller[_0xb55d('0xb')]);router[_0xb55d('0x9')](_0xb55d('0xc'),auth[_0xb55d('0x7')](),controller[_0xb55d('0xd')]);router[_0xb55d('0x9')](_0xb55d('0xe'),auth[_0xb55d('0x7')](),controller[_0xb55d('0xf')]);router[_0xb55d('0x9')](_0xb55d('0x10'),auth[_0xb55d('0x7')](),controller[_0xb55d('0x11')]);router['post']('/',auth[_0xb55d('0x7')](),controller[_0xb55d('0x12')]);router[_0xb55d('0x13')](_0xb55d('0xe'),auth[_0xb55d('0x7')](),controller[_0xb55d('0x14')]);router['post']('/:id/tags',auth[_0xb55d('0x7')](),interaction['tracked'](_0xb55d('0x15'),_0xb55d('0x16')),controller[_0xb55d('0x17')]);router['put'](_0xb55d('0xc'),auth[_0xb55d('0x7')](),interaction[_0xb55d('0x18')]('mail',_0xb55d('0x19')),controller[_0xb55d('0x1a')]);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xb55d('0x15'),_0xb55d('0x1b')),controller[_0xb55d('0x1c')]);router[_0xb55d('0x1d')](_0xb55d('0x1e'),auth[_0xb55d('0x7')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 423c2ca..473f57b 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 _0x96e5=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out','long'];(function(_0x390ca8,_0x32ebb7){var _0x4908ff=function(_0x1a72dc){while(--_0x1a72dc){_0x390ca8['push'](_0x390ca8['shift']());}};_0x4908ff(++_0x32ebb7);}(_0x96e5,0x168));var _0x596e=function(_0x37c236,_0x1aca1c){_0x37c236=_0x37c236-0x0;var _0x886db1=_0x96e5[_0x37c236];return _0x886db1;};'use strict';var Sequelize=require(_0x596e('0x0'));var iconv=require(_0x596e('0x1'));module[_0x596e('0x2')]={'closed':{'type':Sequelize[_0x596e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x596e('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x596e('0x5')]},'inReplyTo':{'type':Sequelize[_0x596e('0x5')](0x1fe)},'to':{'type':Sequelize[_0x596e('0x5')]},'cc':{'type':Sequelize[_0x596e('0x6')]('long')},'subject':{'type':Sequelize[_0x596e('0x6')]()},'attach':{'type':Sequelize[_0x596e('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x596e('0x4')]},'substatus':{'type':Sequelize[_0x596e('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x596e('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x596e('0x7')]('in',_0x596e('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x596e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x596e('0x7')]('in',_0x596e('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x596e('0x6')]('long')},'lastMsgText':{'type':Sequelize[_0x596e('0x6')](_0x596e('0x9'))}}; \ No newline at end of file +var _0x4016=['iconv','exports','BOOLEAN','STRING','TEXT','long','DATE','out','sequelize'];(function(_0x5388b2,_0x15a377){var _0x7e028=function(_0x54ae79){while(--_0x54ae79){_0x5388b2['push'](_0x5388b2['shift']());}};_0x7e028(++_0x15a377);}(_0x4016,0x1e5));var _0x6401=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4016[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x6401('0x0'));var iconv=require(_0x6401('0x1'));module[_0x6401('0x2')]={'closed':{'type':Sequelize[_0x6401('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6401('0x4')]},'inReplyTo':{'type':Sequelize[_0x6401('0x4')](0x1fe)},'to':{'type':Sequelize[_0x6401('0x4')]},'cc':{'type':Sequelize[_0x6401('0x5')](_0x6401('0x6'))},'subject':{'type':Sequelize[_0x6401('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6401('0x7')]},'substatus':{'type':Sequelize[_0x6401('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6401('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x6401('0x5')]('long')},'lastMsgText':{'type':Sequelize['TEXT'](_0x6401('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index bc3d581..cafdcd0 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(_0xad97ba,_0x57d5c0){var _0x45fdfd=function(_0x1df1f6){while(--_0x1df1f6){_0xad97ba['push'](_0xad97ba['shift']());}};_0x45fdfd(++_0x57d5c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x53b0bd,_0x4b528a){var _0xa421fc=function(_0x53666a){while(--_0x53666a){_0x53b0bd['push'](_0x53b0bd['shift']());}};_0xa421fc(++_0x4b528a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 273a360..194a22b 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 _0x29e1=['map','findAll','then','setDataValue','unreadMessages','length','emit','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','remove','getUsers'];(function(_0x39519f,_0x2826b5){var _0x108929=function(_0x636d3){while(--_0x636d3){_0x39519f['push'](_0x39519f['shift']());}};_0x108929(++_0x2826b5);}(_0x29e1,0x81));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x129e('0x0'))['db'][_0x129e('0x1')];var MailMessage=require(_0x129e('0x0'))['db'][_0x129e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x129e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x129e('0x4')};function emitEvent(_0x4b614f){return function(_0x42632c,_0x3acbee,_0x4f6082){_0x42632c[_0x129e('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x202fcb){_0x42632c['setDataValue']('Users',_0x202fcb[_0x129e('0x6')](function(_0x20cdac){return{'id':_0x20cdac['id']};}));return MailMessage[_0x129e('0x7')]({'where':{'MailInteractionId':_0x42632c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x129e('0x8')](function(_0x2f36e4){_0x42632c[_0x129e('0x9')](_0x129e('0xa'),_0x2f36e4[_0x129e('0xb')]);MailInteractionEvents['emit'](_0x4b614f+':'+_0x42632c['id'],_0x42632c);MailInteractionEvents[_0x129e('0xc')](_0x4b614f,_0x42632c);_0x4f6082(null);})['catch'](_0x4f6082(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x129e('0xd')](e,emitEvent(event));}}module[_0x129e('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x0b71=['../../mysqldb','MailMessage','save','update','setDataValue','map','findAll','then','length','catch','hasOwnProperty','exports','events'];(function(_0x5df571,_0x1d309e){var _0x7dbe84=function(_0x10ce42){while(--_0x10ce42){_0x5df571['push'](_0x5df571['shift']());}};_0x7dbe84(++_0x1d309e);}(_0x0b71,0xdc));var _0x10b7=function(_0x212721,_0x1c0edc){_0x212721=_0x212721-0x0;var _0x369f08=_0x0b71[_0x212721];return _0x369f08;};'use strict';var EventEmitter=require(_0x10b7('0x0'));var MailInteraction=require(_0x10b7('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x10b7('0x1'))['db'][_0x10b7('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x10b7('0x3'),'afterUpdate':_0x10b7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x19649c){return function(_0x56986d,_0xd7b7d5,_0x2a2852){_0x56986d['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x9fde2d){_0x56986d[_0x10b7('0x5')]('Users',_0x9fde2d[_0x10b7('0x6')](function(_0x520e4c){return{'id':_0x520e4c['id']};}));return MailMessage[_0x10b7('0x7')]({'where':{'MailInteractionId':_0x56986d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x10b7('0x8')](function(_0x5809f7){_0x56986d[_0x10b7('0x5')]('unreadMessages',_0x5809f7[_0x10b7('0x9')]);MailInteractionEvents['emit'](_0x19649c+':'+_0x56986d['id'],_0x56986d);MailInteractionEvents['emit'](_0x19649c,_0x56986d);_0x2a2852(null);})[_0x10b7('0xa')](_0x2a2852(null));};}for(var e in events){if(events[_0x10b7('0xb')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x10b7('0xc')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 0f2e150..672c2b7 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 _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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e74,0x175));var _0x43e7=function(_0x599c4f,_0x4429fd){_0x599c4f=_0x599c4f-0x0;var _0x3a3d9a=_0x3e74[_0x599c4f];return _0x3a3d9a;};'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 +var _0x9957=['api','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','lodash','util','../../config/logger'];(function(_0x495fcf,_0xdfdee){var _0x481d42=function(_0xce7157){while(--_0xce7157){_0x495fcf['push'](_0x495fcf['shift']());}};_0x481d42(++_0xdfdee);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa2e5f0,_0x3116fb,_0x18c8a3){if(_0xa2e5f0[_0x7995('0xe')]){_0xa2e5f0[_0x7995('0xf')]=moment()[_0x7995('0x10')](_0x7995('0x11'));}if(_0xa2e5f0['closed']){_0xa2e5f0[_0x7995('0x12')]=moment()[_0x7995('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x18c8a3(null,_0x3116fb);},'beforeUpdate':function(_0xb0c872,_0x2cb37a,_0x19a27e){if(_0xb0c872[_0x7995('0x13')](_0x7995('0xe'))){_0xb0c872[_0x7995('0xf')]=_0xb0c872[_0x7995('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xb0c872[_0x7995('0x13')](_0x7995('0x14'))){_0xb0c872[_0x7995('0x12')]=moment()[_0x7995('0x10')](_0x7995('0x11'));_0xb0c872[_0x7995('0xe')]=null;_0xb0c872[_0x7995('0xf')]=null;}_0x19a27e(null,_0xb0c872);},'afterUpdate':function(_0x41cbf0,_0x5377e5,_0x2eeacc){var _0x565d97=_0x137b6b[_0x7995('0x15')];var _0x37f297=_0x41cbf0[_0x7995('0x16')]({'plain':!![]});if(_0x37f297[_0x7995('0x14')]){return _0x565d97[_0x7995('0x17')][_0x7995('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x37f297['id']}})['then'](function(){_0x2eeacc();})['catch'](function(_0x2536c8){_0x2eeacc(_0x2536c8);});}else{_0x2eeacc();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 0b38d01..505e26e 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 _0xcc40=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailInteraction','update','body','options','raw','attributes','limit','UpdateMailInteraction','find','where','addTags','ids','omit','AddTags','lodash'];(function(_0xb8afde,_0x50d813){var _0xe961d5=function(_0x1c8161){while(--_0x1c8161){_0xb8afde['push'](_0xb8afde['shift']());}};_0xe961d5(++_0x50d813);}(_0xcc40,0x97));var _0x0cc4=function(_0x2e9e35,_0x4a8b9c){_0x2e9e35=_0x2e9e35-0x0;var _0xe465af=_0xcc40[_0x2e9e35];return _0xe465af;};'use strict';var _=require(_0x0cc4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0cc4('0x1'));var rs=require(_0x0cc4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cc4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cc4('0x4'))(_0x0cc4('0x5'));var config=require('../../config/environment');var jayson=require(_0x0cc4('0x6'));var client=jayson['client'][_0x0cc4('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0cc4('0x8')],{'host':_0x0cc4('0x9'),'port':0x18eb});var socket=require(_0x0cc4('0xa'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x0cc4('0xb')](socket);function respondWithRpcPromise(_0x36b2b2,_0x5205b0,_0x584d01){return new BPromise(function(_0x40e8f6,_0x1da7b0){return client[_0x0cc4('0xc')](_0x36b2b2,_0x584d01)[_0x0cc4('0xd')](function(_0x1614d2){logger[_0x0cc4('0xe')](_0x0cc4('0xf'),_0x5205b0,_0x0cc4('0x10'));logger[_0x0cc4('0x11')](_0x0cc4('0x12'),_0x5205b0,_0x0cc4('0x10'),JSON[_0x0cc4('0x13')](_0x1614d2));if(_0x1614d2[_0x0cc4('0x14')]){if(_0x1614d2[_0x0cc4('0x14')][_0x0cc4('0x15')]===0x1f4){logger['error'](_0x0cc4('0xf'),_0x5205b0,_0x1614d2[_0x0cc4('0x14')][_0x0cc4('0x16')]);return _0x1da7b0(_0x1614d2[_0x0cc4('0x14')][_0x0cc4('0x16')]);}logger['error'](_0x0cc4('0xf'),_0x5205b0,_0x1614d2[_0x0cc4('0x14')][_0x0cc4('0x16')]);return _0x40e8f6(_0x1614d2[_0x0cc4('0x14')]['message']);}else{logger[_0x0cc4('0xe')](_0x0cc4('0xf'),_0x5205b0,_0x0cc4('0x10'));_0x40e8f6(_0x1614d2['result'][_0x0cc4('0x16')]);}})[_0x0cc4('0x17')](function(_0x3b3f83){logger['error'](_0x0cc4('0xf'),_0x5205b0,_0x3b3f83);_0x1da7b0(_0x3b3f83);});});}exports['UpdateMailInteraction']=function(_0x502991){var _0x3b9b96=this;return new Promise(function(_0x5c8a6e,_0x20a35f){return db[_0x0cc4('0x18')][_0x0cc4('0x19')](_0x502991[_0x0cc4('0x1a')],{'raw':_0x502991[_0x0cc4('0x1b')]?_0x502991[_0x0cc4('0x1b')][_0x0cc4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502991['options']?_0x502991[_0x0cc4('0x1b')]['where']||null:null,'attributes':_0x502991['options']?_0x502991[_0x0cc4('0x1b')][_0x0cc4('0x1d')]||null:null,'limit':_0x502991[_0x0cc4('0x1b')]?_0x502991['options'][_0x0cc4('0x1e')]||null:null})[_0x0cc4('0xd')](function(_0x406e05){logger[_0x0cc4('0xe')](_0x0cc4('0x1f'),_0x502991);logger['debug'](_0x0cc4('0x1f'),_0x502991,JSON['stringify'](_0x406e05));_0x5c8a6e(_0x406e05);})[_0x0cc4('0x17')](function(_0x192dfc){logger[_0x0cc4('0x14')](_0x0cc4('0x1f'),_0x192dfc[_0x0cc4('0x16')],_0x502991);_0x20a35f(_0x3b9b96[_0x0cc4('0x14')](0x1f4,_0x192dfc[_0x0cc4('0x16')]));});});};exports['AddTagsToMailInteraction']=function(_0x51640c){return new Promise(function(_0x29ea00,_0x29d2ea){return db[_0x0cc4('0x18')][_0x0cc4('0x20')]({'where':_0x51640c[_0x0cc4('0x1b')]?_0x51640c[_0x0cc4('0x1b')][_0x0cc4('0x21')]||null:null})['then'](function(_0x522eef){if(_0x522eef){return _0x522eef[_0x0cc4('0x22')](_0x51640c[_0x0cc4('0x1a')][_0x0cc4('0x23')],_[_0x0cc4('0x24')](_0x51640c['body'],[_0x0cc4('0x23'),'id'])||{});}})['spread'](function(_0x5c4a32){logger[_0x0cc4('0xe')]('AddTags',_0x51640c);logger[_0x0cc4('0x11')](_0x0cc4('0x25'),_0x51640c,JSON['stringify'](_0x5c4a32));_0x29ea00(_0x5c4a32);})['catch'](function(_0x363938){logger['error']('AddTags',_0x363938[_0x0cc4('0x16')],_0x51640c);_0x29d2ea(_this[_0x0cc4('0x14')](0x1f4,_0x363938[_0x0cc4('0x16')]));});});}; \ No newline at end of file +var _0x94d2=['attributes','limit','then','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where'];(function(_0x27a2e2,_0x320a19){var _0x340c65=function(_0x5db77c){while(--_0x5db77c){_0x27a2e2['push'](_0x27a2e2['shift']());}};_0x340c65(++_0x320a19);}(_0x94d2,0x1cd));var _0x294d=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x94d2[_0x1b02bb];return _0x131245;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x294d('0x0'));var BPromise=require(_0x294d('0x1'));var rs=require(_0x294d('0x2'));var fs=require('fs');var Redis=require(_0x294d('0x3'));var db=require(_0x294d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x294d('0x5'));var config=require(_0x294d('0x6'));var jayson=require(_0x294d('0x7'));var client=jayson[_0x294d('0x8')][_0x294d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x294d('0xa')],{'host':_0x294d('0xb'),'port':0x18eb});var socket=require(_0x294d('0xc'))(new Redis(config[_0x294d('0xa')]));require(_0x294d('0xd'))['register'](socket);function respondWithRpcPromise(_0x7931bb,_0x297494,_0x53d5f5){return new BPromise(function(_0x20af48,_0x18fde9){return client['request'](_0x7931bb,_0x53d5f5)['then'](function(_0x165330){logger[_0x294d('0xe')](_0x294d('0xf'),_0x297494,'request\x20sent');logger[_0x294d('0x10')](_0x294d('0x11'),_0x297494,_0x294d('0x12'),JSON[_0x294d('0x13')](_0x165330));if(_0x165330['error']){if(_0x165330[_0x294d('0x14')]['code']===0x1f4){logger['error'](_0x294d('0xf'),_0x297494,_0x165330[_0x294d('0x14')][_0x294d('0x15')]);return _0x18fde9(_0x165330[_0x294d('0x14')]['message']);}logger[_0x294d('0x14')]('MailInteraction,\x20%s,\x20%s',_0x297494,_0x165330['error']['message']);return _0x20af48(_0x165330['error'][_0x294d('0x15')]);}else{logger[_0x294d('0xe')](_0x294d('0xf'),_0x297494,_0x294d('0x12'));_0x20af48(_0x165330[_0x294d('0x16')][_0x294d('0x15')]);}})[_0x294d('0x17')](function(_0x9a7c6a){logger['error'](_0x294d('0xf'),_0x297494,_0x9a7c6a);_0x18fde9(_0x9a7c6a);});});}exports[_0x294d('0x18')]=function(_0x578e13){var _0xa9338a=this;return new Promise(function(_0x19cee1,_0x429da3){return db[_0x294d('0x19')][_0x294d('0x1a')](_0x578e13[_0x294d('0x1b')],{'raw':_0x578e13[_0x294d('0x1c')]?_0x578e13[_0x294d('0x1c')][_0x294d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x578e13[_0x294d('0x1c')]?_0x578e13[_0x294d('0x1c')][_0x294d('0x1e')]||null:null,'attributes':_0x578e13[_0x294d('0x1c')]?_0x578e13[_0x294d('0x1c')][_0x294d('0x1f')]||null:null,'limit':_0x578e13['options']?_0x578e13['options'][_0x294d('0x20')]||null:null})[_0x294d('0x21')](function(_0x10fb2e){logger[_0x294d('0xe')](_0x294d('0x18'),_0x578e13);logger[_0x294d('0x10')]('UpdateMailInteraction',_0x578e13,JSON[_0x294d('0x13')](_0x10fb2e));_0x19cee1(_0x10fb2e);})['catch'](function(_0x4670ae){logger[_0x294d('0x14')](_0x294d('0x18'),_0x4670ae[_0x294d('0x15')],_0x578e13);_0x429da3(_0xa9338a[_0x294d('0x14')](0x1f4,_0x4670ae[_0x294d('0x15')]));});});};exports[_0x294d('0x22')]=function(_0x4ad67d){return new Promise(function(_0xc15349,_0x2b2072){return db[_0x294d('0x19')][_0x294d('0x23')]({'where':_0x4ad67d[_0x294d('0x1c')]?_0x4ad67d[_0x294d('0x1c')][_0x294d('0x1e')]||null:null})[_0x294d('0x21')](function(_0x4d68ff){if(_0x4d68ff){return _0x4d68ff[_0x294d('0x24')](_0x4ad67d[_0x294d('0x1b')][_0x294d('0x25')],_[_0x294d('0x26')](_0x4ad67d['body'],['ids','id'])||{});}})[_0x294d('0x27')](function(_0x5da8f){logger[_0x294d('0xe')](_0x294d('0x28'),_0x4ad67d);logger[_0x294d('0x10')](_0x294d('0x28'),_0x4ad67d,JSON[_0x294d('0x13')](_0x5da8f));_0xc15349(_0x5da8f);})[_0x294d('0x17')](function(_0x28557a){logger['error'](_0x294d('0x28'),_0x28557a[_0x294d('0x15')],_0x4ad67d);_0x2b2072(_this[_0x294d('0x14')](0x1f4,_0x28557a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 2642775..1df2cdb 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 _0x994a=['save','remove','update','emit','length','mailInteraction:'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x994a,0x126));var _0xa994=function(_0x38c7c4,_0x1f2860){_0x38c7c4=_0x38c7c4-0x0;var _0x30d84a=_0x994a[_0x38c7c4];return _0x30d84a;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xa994('0x0'),_0xa994('0x1'),_0xa994('0x2')];function createListener(_0x4474d3,_0x1f5fe4){return function(_0x39f284){_0x1f5fe4[_0xa994('0x3')](_0x4474d3,_0x39f284);};}function removeListener(_0x15dbd5,_0x2a210f){return function(){MailInteractionEvents['removeListener'](_0x15dbd5,_0x2a210f);};}exports['register']=function(_0x424910){for(var _0x37024b=0x0,_0x328f85=events[_0xa994('0x4')];_0x37024b<_0x328f85;_0x37024b++){var _0xa7bddf=events[_0x37024b];var _0x1481e1=createListener(_0xa994('0x5')+_0xa7bddf,_0x424910);MailInteractionEvents['on'](_0xa7bddf,_0x1481e1);}}; \ No newline at end of file +var _0x1100=['mailInteraction:','save','remove','update','emit','removeListener','length'];(function(_0x4b9669,_0x229723){var _0x5de66a=function(_0x151b58){while(--_0x151b58){_0x4b9669['push'](_0x4b9669['shift']());}};_0x5de66a(++_0x229723);}(_0x1100,0x166));var _0x0110=function(_0x34b052,_0x2270be){_0x34b052=_0x34b052-0x0;var _0x25ccf3=_0x1100[_0x34b052];return _0x25ccf3;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x0110('0x0'),_0x0110('0x1'),_0x0110('0x2')];function createListener(_0x931378,_0x2b7b2f){return function(_0xab0820){_0x2b7b2f[_0x0110('0x3')](_0x931378,_0xab0820);};}function removeListener(_0x5cd92e,_0x56ba05){return function(){MailInteractionEvents[_0x0110('0x4')](_0x5cd92e,_0x56ba05);};}exports['register']=function(_0x5de2ba){for(var _0x27ffe7=0x0,_0x48375b=events[_0x0110('0x5')];_0x27ffe7<_0x48375b;_0x27ffe7++){var _0x6b182c=events[_0x27ffe7];var _0x42bd84=createListener(_0x0110('0x6')+_0x6b182c,_0x5de2ba);MailInteractionEvents['on'](_0x6b182c,_0x42bd84);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index d737805..c43e036 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 _0x9c5a=['isAuthenticated','get','/describe','/:id','show','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x1c7ad0,_0x448315){var _0x27314b=function(_0x49bd56){while(--_0x49bd56){_0x1c7ad0['push'](_0x1c7ad0['shift']());}};_0x27314b(++_0x448315);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0xfc0bf,_0x34e510){_0xfc0bf=_0xfc0bf-0x0;var _0xe2edf7=_0x9c5a[_0xfc0bf];return _0xe2edf7;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var auth=require(_0xa9c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9c5('0x6'));var controller=require(_0xa9c5('0x7'));router['get']('/',auth[_0xa9c5('0x8')](),controller['index']);router[_0xa9c5('0x9')](_0xa9c5('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa9c5('0x9')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0x9')]('/:id/download',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa9c5('0xe')](_0xa9c5('0xf'),_0xa9c5('0x10')),controller[_0xa9c5('0x11')]);router[_0xa9c5('0x12')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x13')]);router[_0xa9c5('0x12')](_0xa9c5('0x14'),auth['isAuthenticated'](),controller[_0xa9c5('0x15')]);router[_0xa9c5('0x12')](_0xa9c5('0x16'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x17')]);router[_0xa9c5('0x18')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x19')]);module[_0xa9c5('0x1a')]=router; \ No newline at end of file +var _0xd6d6=['mailmessage:create','update','put','/:id/accept','accept','reject','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','mail'];(function(_0x54d4be,_0x35ae6e){var _0x131067=function(_0x4502be){while(--_0x4502be){_0x54d4be['push'](_0x54d4be['shift']());}};_0x131067(++_0x35ae6e);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x92cc3e,_0x3a682f){_0x92cc3e=_0x92cc3e-0x0;var _0x3c5f02=_0xd6d6[_0x92cc3e];return _0x3c5f02;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var auth=require(_0x6d6d('0x5'));var interaction=require(_0x6d6d('0x6'));var config=require(_0x6d6d('0x7'));var controller=require(_0x6d6d('0x8'));router[_0x6d6d('0x9')]('/',auth[_0x6d6d('0xa')](),controller['index']);router[_0x6d6d('0x9')](_0x6d6d('0xb'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0xc')]);router[_0x6d6d('0x9')](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller['show']);router['get'](_0x6d6d('0xe'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0xf')]);router[_0x6d6d('0x10')]('/',auth[_0x6d6d('0xa')](),interaction['tracked'](_0x6d6d('0x11'),_0x6d6d('0x12')),controller['create']);router['put'](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0x13')]);router[_0x6d6d('0x14')](_0x6d6d('0x15'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0x16')]);router[_0x6d6d('0x14')]('/:id/reject',auth[_0x6d6d('0xa')](),controller[_0x6d6d('0x17')]);router[_0x6d6d('0x18')](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller['destroy']);module[_0x6d6d('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 450958c..b2ade5a 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 _0x8b0e=['exports','TEXT','long','BOOLEAN','out','STRING','DATE','INTEGER','sequelize','lodash'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x8b0e,0x166));var _0xe8b0=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0x8b0e[_0x2d2258];return _0x18e155;};'use strict';var Sequelize=require(_0xe8b0('0x0'));var _=require(_0xe8b0('0x1'));module[_0xe8b0('0x2')]={'body':{'type':Sequelize[_0xe8b0('0x3')](_0xe8b0('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe8b0('0x3')]('medium')},'read':{'type':Sequelize[_0xe8b0('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe8b0('0x6')),'defaultValue':_0xe8b0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe8b0('0x7')](0x1fe)},'from':{'type':Sequelize[_0xe8b0('0x7')]},'to':{'type':Sequelize[_0xe8b0('0x3')](_0xe8b0('0x4'))},'cc':{'type':Sequelize[_0xe8b0('0x3')](_0xe8b0('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0xe8b0('0x4'))},'subject':{'type':Sequelize[_0xe8b0('0x3')]},'sentAt':{'type':Sequelize[_0xe8b0('0x8')]},'attach':{'type':Sequelize[_0xe8b0('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe8b0('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe8b0('0x8')]},'originTo':{'type':Sequelize[_0xe8b0('0x3')](_0xe8b0('0x4'))},'originCc':{'type':Sequelize[_0xe8b0('0x3')]('long')}}; \ No newline at end of file +var _0xb7e2=['out','STRING','TEXT','DATE','INTEGER','BOOLEAN','sequelize','exports','long','medium','ENUM'];(function(_0x3fb780,_0x540d09){var _0x49bcf4=function(_0x122b11){while(--_0x122b11){_0x3fb780['push'](_0x3fb780['shift']());}};_0x49bcf4(++_0x540d09);}(_0xb7e2,0x103));var _0x2b7e=function(_0x325bb1,_0x2913d8){_0x325bb1=_0x325bb1-0x0;var _0x5b2ee4=_0xb7e2[_0x325bb1];return _0x5b2ee4;};'use strict';var Sequelize=require(_0x2b7e('0x0'));var _=require('lodash');module[_0x2b7e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2b7e('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2b7e('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2b7e('0x4')]('in',_0x2b7e('0x5')),'defaultValue':_0x2b7e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2b7e('0x6')](0x1fe)},'from':{'type':Sequelize[_0x2b7e('0x6')]},'to':{'type':Sequelize[_0x2b7e('0x7')]('long')},'cc':{'type':Sequelize[_0x2b7e('0x7')](_0x2b7e('0x2'))},'bcc':{'type':Sequelize[_0x2b7e('0x7')]('long')},'subject':{'type':Sequelize[_0x2b7e('0x7')]},'sentAt':{'type':Sequelize[_0x2b7e('0x8')]},'attach':{'type':Sequelize[_0x2b7e('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2b7e('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2b7e('0x8')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x2b7e('0x7')](_0x2b7e('0x2'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 40ec60f..eea2f2f 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 _0xf2d7=['error','info','result','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','status','send','MailMessage','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','include','catch','show','includeAll','find','body','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','authentication','user','pass','auth','attachments','join','server/files/attachments','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','mail-interactions','accept','mail','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','MailInteraction','MailInteractionId','interaction','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','role','null','RejectMessage','download','toString','server','files','root','message-%s.eml','bcc','subject','createdAt','Attachment','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','http','client','Sequelize','ValidationError','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','message'];(function(_0x20d9f0,_0x453415){var _0x195dda=function(_0x58d8e8){while(--_0x58d8e8){_0x20d9f0['push'](_0x20d9f0['shift']());}};_0x195dda(++_0x453415);}(_0xf2d7,0x121));var _0x7f2d=function(_0x6113d9,_0x445529){_0x6113d9=_0x6113d9-0x0;var _0x19c424=_0xf2d7[_0x6113d9];return _0x19c424;};'use strict';var pdf=require(_0x7f2d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7f2d('0x1'));var zipdir=require(_0x7f2d('0x2'));var jsonpatch=require(_0x7f2d('0x3'));var rp=require(_0x7f2d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7f2d('0x5'));var path=require('path');var sox=require(_0x7f2d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7f2d('0x7'));var squel=require('squel');var crypto=require(_0x7f2d('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x7f2d('0x9'));var toCsv=require(_0x7f2d('0xa'));var querystring=require(_0x7f2d('0xb'));var Papa=require(_0x7f2d('0xc'));var Redis=require(_0x7f2d('0xd'));var authService=require(_0x7f2d('0xe'));var qs=require(_0x7f2d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f2d('0x10'));var logger=require(_0x7f2d('0x11'))(_0x7f2d('0x12'));var utils=require(_0x7f2d('0x13'));var config=require('../../config/environment');var db=require(_0x7f2d('0x14'))['db'];config[_0x7f2d('0x15')]=_[_0x7f2d('0x16')](config['redis'],{'host':_0x7f2d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f2d('0x15')]));require('./mailMessage.socket')[_0x7f2d('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7f2d('0x19')]({'port':0x232c});var client9003=jayson[_0x7f2d('0x1a')]['http']({'port':0x232b});var client9002=jayson[_0x7f2d('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x787482,_0xf7d12f,_0xa9eb6e){if(_0xa9eb6e){var _0xe1217b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe1217b['test'](_0xf7d12f)){return _0x787482;}else{throw new db[(_0x7f2d('0x1b'))][(_0x7f2d('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 _0x787482;}}function respondWithRpcPromise(_0x1a85ee,_0x5217ca,_0x3c5de8,_0x912d9f){return new BPromise(function(_0xba46bf,_0x47b0d5){var _0x2d9099=_0x912d9f||client;return _0x2d9099['request'](_0x1a85ee,_0x3c5de8)['then'](function(_0xba9cf7){logger['info'](_0x7f2d('0x1d'),_0x5217ca,_0x7f2d('0x1e'));logger[_0x7f2d('0x1f')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5217ca,_0x7f2d('0x1e'),JSON[_0x7f2d('0x20')](_0xba9cf7));if(_0xba9cf7['error']){if(_0xba9cf7['error'][_0x7f2d('0x21')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x5217ca,_0xba9cf7['error'][_0x7f2d('0x22')]);return _0x47b0d5(_0xba9cf7[_0x7f2d('0x23')][_0x7f2d('0x22')]);}logger[_0x7f2d('0x23')]('MailMessage,\x20%s,\x20%s',_0x5217ca,_0xba9cf7['error']['message']);return _0xba46bf(_0xba9cf7[_0x7f2d('0x23')][_0x7f2d('0x22')]);}else{logger[_0x7f2d('0x24')](_0x7f2d('0x1d'),_0x5217ca,_0x7f2d('0x1e'));_0xba46bf(_0xba9cf7[_0x7f2d('0x25')][_0x7f2d('0x22')]);}})['catch'](function(_0x3cef71){logger[_0x7f2d('0x23')](_0x7f2d('0x1d'),_0x5217ca,_0x3cef71);_0x47b0d5(_0x3cef71);});});}function respondWithStatusCode(_0x74028,_0x361c35){_0x361c35=_0x361c35||0xcc;return function(_0x53e6cf){if(_0x53e6cf){return _0x74028[_0x7f2d('0x26')](_0x361c35);}return _0x74028['status'](_0x361c35)[_0x7f2d('0x27')]();};}function respondWithResult(_0x34ef54,_0x45c6af){_0x45c6af=_0x45c6af||0xc8;return function(_0x92b4ed){if(_0x92b4ed){return _0x34ef54['status'](_0x45c6af)[_0x7f2d('0x28')](_0x92b4ed);}};}function respondWithFilteredResult(_0x470979,_0x56d1e6){return function(_0x1856ec){if(_0x1856ec){var _0x3ca855=_0x1856ec[_0x7f2d('0x29')],_0x1bea22=_0x56d1e6[_0x7f2d('0x2a')],_0x471f97=_0x56d1e6[_0x7f2d('0x2a')]+_0x56d1e6[_0x7f2d('0x2b')],_0x22ac89;if(_0x471f97>=_0x3ca855){_0x471f97=_0x3ca855;_0x22ac89=0xc8;}else{_0x22ac89=0xce;}_0x470979['status'](_0x22ac89);return _0x470979[_0x7f2d('0x2c')](_0x7f2d('0x2d'),_0x1bea22+'-'+_0x471f97+'/'+_0x3ca855)[_0x7f2d('0x28')](_0x1856ec);}return null;};}function patchUpdates(_0x8af231){return function(_0x437b32){try{jsonpatch[_0x7f2d('0x2e')](_0x437b32,_0x8af231,!![]);}catch(_0x29fa67){return BPromise[_0x7f2d('0x2f')](_0x29fa67);}return _0x437b32[_0x7f2d('0x30')]();};}function saveUpdates(_0x3e2c1b,_0x16e260){return function(_0x2f9eaf){if(_0x2f9eaf){return _0x2f9eaf[_0x7f2d('0x31')](_0x3e2c1b)['then'](function(_0x1f54c4){return _0x1f54c4;});}return null;};}function removeEntity(_0x5084d4,_0x2700c2){return function(_0x171cea){if(_0x171cea){return _0x171cea[_0x7f2d('0x32')]()[_0x7f2d('0x33')](function(){_0x5084d4['status'](0xcc)[_0x7f2d('0x27')]();});}};}function handleEntityNotFound(_0xf59b92,_0x2b6bfc){return function(_0x28f54b){if(!_0x28f54b){_0xf59b92[_0x7f2d('0x26')](0x194);}return _0x28f54b;};}function handleError(_0x4ebc43,_0x187513){_0x187513=_0x187513||0x1f4;return function(_0xc3121){logger['error'](_0xc3121[_0x7f2d('0x34')]);if(_0xc3121[_0x7f2d('0x35')]){delete _0xc3121['name'];}_0x4ebc43[_0x7f2d('0x36')](_0x187513)[_0x7f2d('0x37')](_0xc3121);};}exports['index']=function(_0x2ddd9d,_0x225017){var _0x4fc7d6={},_0x13d469={},_0xbc4c83={'count':0x0,'rows':[]};var _0xef77f8=_['map'](db[_0x7f2d('0x38')]['rawAttributes'],function(_0x54d608){return{'name':_0x54d608[_0x7f2d('0x39')],'type':_0x54d608[_0x7f2d('0x3a')][_0x7f2d('0x3b')]};});_0x13d469[_0x7f2d('0x3c')]=_[_0x7f2d('0x3d')](_0xef77f8,_0x7f2d('0x35'));_0x13d469[_0x7f2d('0x3e')]=_[_0x7f2d('0x3f')](_0x2ddd9d[_0x7f2d('0x3e')]);_0x13d469['filters']=_['intersection'](_0x13d469['model'],_0x13d469[_0x7f2d('0x3e')]);_0x4fc7d6[_0x7f2d('0x40')]=_[_0x7f2d('0x41')](_0x13d469[_0x7f2d('0x3c')],qs[_0x7f2d('0x42')](_0x2ddd9d[_0x7f2d('0x3e')]['fields']));_0x4fc7d6[_0x7f2d('0x40')]=_0x4fc7d6[_0x7f2d('0x40')][_0x7f2d('0x43')]?_0x4fc7d6[_0x7f2d('0x40')]:_0x13d469['model'];if(!_0x2ddd9d[_0x7f2d('0x3e')][_0x7f2d('0x44')](_0x7f2d('0x45'))){_0x4fc7d6[_0x7f2d('0x2b')]=qs['limit'](_0x2ddd9d[_0x7f2d('0x3e')][_0x7f2d('0x2b')]);_0x4fc7d6[_0x7f2d('0x2a')]=qs[_0x7f2d('0x2a')](_0x2ddd9d[_0x7f2d('0x3e')]['offset']);}_0x4fc7d6[_0x7f2d('0x46')]=qs['sort'](_0x2ddd9d[_0x7f2d('0x3e')]['sort']);_0x4fc7d6[_0x7f2d('0x47')]=qs[_0x7f2d('0x48')](_['pick'](_0x2ddd9d[_0x7f2d('0x3e')],_0x13d469['filters']),_0xef77f8);if(_0x2ddd9d[_0x7f2d('0x3e')][_0x7f2d('0x49')]){_0x4fc7d6[_0x7f2d('0x47')]=_[_0x7f2d('0x4a')](_0x4fc7d6[_0x7f2d('0x47')],{'$or':_[_0x7f2d('0x3d')](_0xef77f8,function(_0xbbd51e){if(_0xbbd51e[_0x7f2d('0x3a')]!==_0x7f2d('0x4b')){var _0x38b8cb={};_0x38b8cb[_0xbbd51e['name']]={'$like':'%'+_0x2ddd9d[_0x7f2d('0x3e')]['filter']+'%'};return _0x38b8cb;}})});}_0x4fc7d6=_[_0x7f2d('0x4a')]({},_0x4fc7d6,_0x2ddd9d[_0x7f2d('0x4c')]);var _0x46ea56={'where':_0x4fc7d6[_0x7f2d('0x47')]};return db[_0x7f2d('0x38')][_0x7f2d('0x29')](_0x46ea56)['then'](function(_0x740056){_0xbc4c83[_0x7f2d('0x29')]=_0x740056;if(_0x2ddd9d[_0x7f2d('0x3e')]['includeAll']){_0x4fc7d6[_0x7f2d('0x4d')]=[{'all':!![]}];}return db[_0x7f2d('0x38')]['findAll'](_0x4fc7d6);})[_0x7f2d('0x33')](function(_0x3943a3){_0xbc4c83['rows']=_0x3943a3;return _0xbc4c83;})[_0x7f2d('0x33')](respondWithFilteredResult(_0x225017,_0x4fc7d6))[_0x7f2d('0x4e')](handleError(_0x225017,null));};exports[_0x7f2d('0x4f')]=function(_0x2c7c45,_0x84885e){var _0x583f87={'raw':!![],'where':{'id':_0x2c7c45['params']['id']}},_0x4700ea={};_0x4700ea[_0x7f2d('0x3c')]=_['keys'](db[_0x7f2d('0x38')]['rawAttributes']);_0x4700ea['query']=_['keys'](_0x2c7c45[_0x7f2d('0x3e')]);_0x4700ea[_0x7f2d('0x48')]=_[_0x7f2d('0x41')](_0x4700ea['model'],_0x4700ea[_0x7f2d('0x3e')]);_0x583f87[_0x7f2d('0x40')]=_[_0x7f2d('0x41')](_0x4700ea[_0x7f2d('0x3c')],qs[_0x7f2d('0x42')](_0x2c7c45[_0x7f2d('0x3e')][_0x7f2d('0x42')]));_0x583f87[_0x7f2d('0x40')]=_0x583f87[_0x7f2d('0x40')][_0x7f2d('0x43')]?_0x583f87[_0x7f2d('0x40')]:_0x4700ea[_0x7f2d('0x3c')];if(_0x2c7c45[_0x7f2d('0x3e')][_0x7f2d('0x50')]){_0x583f87['include']=[{'all':!![]}];}_0x583f87=_['merge']({},_0x583f87,_0x2c7c45[_0x7f2d('0x4c')]);return db[_0x7f2d('0x38')][_0x7f2d('0x51')](_0x583f87)['then'](handleEntityNotFound(_0x84885e,null))[_0x7f2d('0x33')](respondWithResult(_0x84885e,null))[_0x7f2d('0x4e')](handleError(_0x84885e,null));};exports[_0x7f2d('0x31')]=function(_0x133a0c,_0x28bc70){if(_0x133a0c['body']['id']){delete _0x133a0c[_0x7f2d('0x52')]['id'];}return db[_0x7f2d('0x38')][_0x7f2d('0x51')]({'where':{'id':_0x133a0c[_0x7f2d('0x53')]['id']}})['then'](handleEntityNotFound(_0x28bc70,null))['then'](saveUpdates(_0x133a0c[_0x7f2d('0x52')],null))[_0x7f2d('0x33')](respondWithResult(_0x28bc70,null))[_0x7f2d('0x4e')](handleError(_0x28bc70,null));};exports[_0x7f2d('0x32')]=function(_0x280458,_0x2aa1c4){return db[_0x7f2d('0x38')]['find']({'where':{'id':_0x280458[_0x7f2d('0x53')]['id']}})[_0x7f2d('0x33')](handleEntityNotFound(_0x2aa1c4,null))[_0x7f2d('0x33')](removeEntity(_0x2aa1c4,null))[_0x7f2d('0x4e')](handleError(_0x2aa1c4,null));};exports[_0x7f2d('0x54')]=function(_0x29fa91,_0x2b08c1){return db['MailMessage'][_0x7f2d('0x54')]()[_0x7f2d('0x33')](respondWithResult(_0x2b08c1,null))[_0x7f2d('0x4e')](handleError(_0x2b08c1,null));};exports[_0x7f2d('0x55')]=function(_0x4fe5e7,_0x21b4e3){return db[_0x7f2d('0x38')][_0x7f2d('0x55')](_0x4fe5e7['body'])['then'](function(_0x2a91ec){if(_0x2a91ec){if(_0x2a91ec[_0x7f2d('0x56')]===_0x7f2d('0x57')&&!_0x2a91ec[_0x7f2d('0x58')]){var _0x39202f,_0x1a81c4,_0x5a54d3;if(_0x4fe5e7['body']['to']){_0x1a81c4=_0x4fe5e7[_0x7f2d('0x52')]['to'][_0x7f2d('0x59')](',')[0x0];}return db[_0x7f2d('0x5a')][_0x7f2d('0x5b')]({'where':{'id':_0x2a91ec[_0x7f2d('0x5c')]},'include':[{'model':db[_0x7f2d('0x5d')],'as':_0x7f2d('0x5e'),'include':[{'model':db['CmContact'],'as':_0x7f2d('0x5f'),'where':{'email':_0x1a81c4},'limit':0x1,'order':[[_0x7f2d('0x60'),_0x7f2d('0x61')]]}]},{'model':db['MailServerOut'],'as':_0x7f2d('0x62'),'raw':!![]}]})['then'](function(_0x5391e5){_0x39202f=_0x5391e5;if(_0x39202f&&_0x39202f[_0x7f2d('0x62')]){var _0x496df4={'tls':{'rejectUnauthorized':![]}};if(_[_0x7f2d('0x63')](_0x39202f[_0x7f2d('0x62')][_0x7f2d('0x64')])){_0x496df4[_0x7f2d('0x65')]=_0x39202f['Smtp'][_0x7f2d('0x65')];_0x496df4[_0x7f2d('0x66')]=_0x39202f[_0x7f2d('0x62')][_0x7f2d('0x66')];_0x496df4[_0x7f2d('0x67')]=_0x39202f[_0x7f2d('0x62')][_0x7f2d('0x67')];if(_0x39202f[_0x7f2d('0x62')][_0x7f2d('0x68')]){_0x496df4['auth']={'user':_0x39202f['Smtp'][_0x7f2d('0x69')],'pass':_0x39202f[_0x7f2d('0x62')][_0x7f2d('0x6a')]};}}else{_0x496df4[_0x7f2d('0x64')]=_0x39202f[_0x7f2d('0x62')][_0x7f2d('0x64')];_0x496df4[_0x7f2d('0x6b')]={'user':_0x39202f[_0x7f2d('0x62')]['user'],'pass':_0x39202f[_0x7f2d('0x62')][_0x7f2d('0x6a')]};_0x496df4[_0x7f2d('0x67')]=_0x39202f[_0x7f2d('0x62')][_0x7f2d('0x67')];}if(_0x4fe5e7['body'][_0x7f2d('0x6c')]&&_0x4fe5e7['body'][_0x7f2d('0x6c')][_0x7f2d('0x43')]){for(var _0x38e8f5=0x0;_0x38e8f5<_0x4fe5e7['body'][_0x7f2d('0x6c')][_0x7f2d('0x43')];_0x38e8f5+=0x1){_0x4fe5e7[_0x7f2d('0x52')][_0x7f2d('0x6c')][_0x38e8f5]={'filename':_0x4fe5e7[_0x7f2d('0x52')]['attachments'][_0x38e8f5][_0x7f2d('0x35')],'path':path[_0x7f2d('0x6d')](config['root'],_0x7f2d('0x6e'),_0x4fe5e7['body']['attachments'][_0x38e8f5][_0x7f2d('0x6f')])};}}_0x5a54d3={'account':_0x496df4,'message':_0x4fe5e7[_0x7f2d('0x52')]};return;}})[_0x7f2d('0x33')](function(){if(_0x39202f['List']){if(_0x39202f[_0x7f2d('0x5e')][_0x7f2d('0x5f')][_0x7f2d('0x43')]){return _0x39202f[_0x7f2d('0x5e')][_0x7f2d('0x5f')][0x0];}else{return db[_0x7f2d('0x70')][_0x7f2d('0x55')](_[_0x7f2d('0x16')](_0x4fe5e7[_0x7f2d('0x52')],{'firstName':_0x4fe5e7['body']['to'],'email':_0x4fe5e7[_0x7f2d('0x52')]['to'],'phone':_0x4fe5e7['body']['to'],'ListId':_0x39202f[_0x7f2d('0x71')]}));}}else{throw new Error(_0x7f2d('0x72'));}})[_0x7f2d('0x33')](function(){if(_0x5a54d3){return respondWithRpcPromise(_0x7f2d('0x73'),_0x7f2d('0x74'),_0x5a54d3,client9003)[_0x7f2d('0x33')](function(_0x2398b6){return _0x2a91ec[_0x7f2d('0x31')]({'read':!![],'messageId':_0x2398b6[_0x7f2d('0x75')],'sentAt':moment()[_0x7f2d('0x76')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x7f2d('0x4e')](function(_0x8fe8ef){logger[_0x7f2d('0x23')]('%s',JSON[_0x7f2d('0x20')](_0x8fe8ef));return _0x2a91ec;});}return _0x2a91ec;});}return _0x2a91ec;}})[_0x7f2d('0x33')](respondWithResult(_0x21b4e3,0xc9))[_0x7f2d('0x4e')](handleError(_0x21b4e3,null));};var interaction_log=require('../../config/logger')(_0x7f2d('0x77'));exports[_0x7f2d('0x78')]=function(_0x246287,_0x3fb74b,_0x14f3dd){var _0x3d4fc4={'channel':_0x7f2d('0x79')};if(_0x246287[_0x7f2d('0x52')]['id']){delete _0x246287[_0x7f2d('0x52')]['id'];}_0x246287[_0x7f2d('0x52')]['read']=!![];_0x246287[_0x7f2d('0x52')][_0x7f2d('0x7a')]=moment()[_0x7f2d('0x76')](_0x7f2d('0x7b'));_0x246287[_0x7f2d('0x52')][_0x7f2d('0x7c')]=_0x246287[_0x7f2d('0x52')][_0x7f2d('0x7c')]||_0x246287['user']['id'];return db['MailMessage']['find']({'where':{'id':_0x246287[_0x7f2d('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x7f2d('0x70')],'as':_0x7f2d('0x7d')}]})['then'](handleEntityNotFound(_0x3fb74b,null))[_0x7f2d('0x33')](saveUpdates(_0x246287[_0x7f2d('0x52')],null))[_0x7f2d('0x33')](function(_0x5e1fa0){if(_0x5e1fa0){_0x3d4fc4[_0x7f2d('0x22')]=_0x5e1fa0[_0x7f2d('0x7e')]({'plain':!![]});return db[_0x7f2d('0x7f')][_0x7f2d('0x51')]({'where':{'id':_0x5e1fa0[_0x7f2d('0x80')]}});}return null;})[_0x7f2d('0x33')](handleEntityNotFound(_0x3fb74b,null))[_0x7f2d('0x33')](function(_0x3f7429){if(_0x3f7429){return _0x3f7429[_0x7f2d('0x31')]({'UserId':_0x246287[_0x7f2d('0x52')][_0x7f2d('0x7c')],'read1stAt':_[_0x7f2d('0x63')](_0x3f7429['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7f2d('0x33')](function(_0x4bcbbe){if(_0x4bcbbe){_0x3d4fc4[_0x7f2d('0x81')]=_0x4bcbbe[_0x7f2d('0x7e')]({'plain':!![]});interaction_log[_0x7f2d('0x24')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x246287[_0x7f2d('0x69')]['id'],_0x246287[_0x7f2d('0x69')][_0x7f2d('0x35')],_0x246287[_0x7f2d('0x69')]['role'],_0x3d4fc4[_0x7f2d('0x81')]['id'],_0x246287[_0x7f2d('0x52')]?JSON[_0x7f2d('0x20')](_0x246287[_0x7f2d('0x52')]):'null');return respondWithRpcPromise('AcceptMessage',_0x7f2d('0x82'),_0x3d4fc4);}return null;})['then'](function(_0x121551){if(_0x121551){if(_0x246287[_0x7f2d('0x52')][_0x7f2d('0x83')]){_0x3d4fc4[_0x7f2d('0x22')][_0x7f2d('0x84')]=util[_0x7f2d('0x76')](_0x7f2d('0x85'),_0x246287[_0x7f2d('0x69')][_0x7f2d('0x35')]);_0x3d4fc4[_0x7f2d('0x22')]['channel']=_0x3d4fc4[_0x7f2d('0x86')];_0x3d4fc4[_0x7f2d('0x22')][_0x7f2d('0x87')]=_0x7f2d('0x78');return respondWithRpcPromise(_0x7f2d('0x88'),_0x7f2d('0x88'),{'event':_0x7f2d('0x89'),'message':_0x3d4fc4['message']},client9002)[_0x7f2d('0x33')](function(){return _0x3d4fc4;});}return _0x3d4fc4;}return null;})[_0x7f2d('0x33')](respondWithResult(_0x3fb74b,null))[_0x7f2d('0x4e')](handleError(_0x3fb74b,null));};var interaction_log=require(_0x7f2d('0x11'))(_0x7f2d('0x77'));exports[_0x7f2d('0x2f')]=function(_0x2ad695,_0x493b5f,_0x2f8cf9){var _0x454d0d={'agent':{},'channel':_0x7f2d('0x79')};if(_0x2ad695[_0x7f2d('0x52')]['id']){delete _0x2ad695[_0x7f2d('0x52')]['id'];}_0x2ad695[_0x7f2d('0x52')][_0x7f2d('0x7c')]=_0x2ad695[_0x7f2d('0x52')][_0x7f2d('0x7c')]||_0x2ad695[_0x7f2d('0x69')]['id'];_0x454d0d['agent']['id']=_0x2ad695['body'][_0x7f2d('0x7c')];return db[_0x7f2d('0x38')][_0x7f2d('0x51')]({'where':{'id':_0x2ad695[_0x7f2d('0x53')]['id'],'UserId':null}})[_0x7f2d('0x33')](handleEntityNotFound(_0x493b5f,null))[_0x7f2d('0x33')](function(_0x578564){if(_0x578564){_0x454d0d[_0x7f2d('0x22')]=_0x578564['get']({'plain':!![]});return db[_0x7f2d('0x7f')][_0x7f2d('0x51')]({'where':{'id':_0x578564[_0x7f2d('0x80')]}});}return null;})[_0x7f2d('0x33')](handleEntityNotFound(_0x493b5f,null))[_0x7f2d('0x33')](function(_0x3e0e66){if(_0x3e0e66){_0x454d0d[_0x7f2d('0x81')]=_0x3e0e66[_0x7f2d('0x7e')]({'plain':!![]});interaction_log[_0x7f2d('0x24')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ad695['user']['id'],_0x2ad695[_0x7f2d('0x69')][_0x7f2d('0x35')],_0x2ad695[_0x7f2d('0x69')][_0x7f2d('0x8a')],_0x454d0d['interaction']['id'],_0x2ad695[_0x7f2d('0x52')]?JSON[_0x7f2d('0x20')](_0x2ad695[_0x7f2d('0x52')]):_0x7f2d('0x8b'));return respondWithRpcPromise(_0x7f2d('0x8c'),'rejectMessage',_0x454d0d);}return null;})[_0x7f2d('0x33')](function(_0x18194c){if(_0x18194c){_0x18194c[_0x7f2d('0x22')]['interface']=util['format'](_0x7f2d('0x85'),_0x2ad695[_0x7f2d('0x69')][_0x7f2d('0x35')]);_0x18194c[_0x7f2d('0x22')][_0x7f2d('0x86')]=_0x454d0d[_0x7f2d('0x86')];_0x18194c[_0x7f2d('0x22')]['event']='reject';respondWithRpcPromise(_0x7f2d('0x88'),_0x7f2d('0x88'),{'event':'rejectmessage','message':_0x18194c['message']},client9002);return _0x454d0d;}return null;})[_0x7f2d('0x33')](respondWithResult(_0x493b5f,null))['catch'](handleError(_0x493b5f,null));};exports[_0x7f2d('0x8d')]=function(_0x2ee829,_0x6fe352){var _0x32b442=moment()['unix']()[_0x7f2d('0x8e')]();var _0x4c8154=path['join'](config['root'],_0x7f2d('0x8f'),_0x7f2d('0x90'),'tmp');var _0x2e032f=path[_0x7f2d('0x6d')](config[_0x7f2d('0x91')],'server',_0x7f2d('0x90'),_0x7f2d('0x6c'));var _0x3cb7bc=util[_0x7f2d('0x76')](_0x7f2d('0x92'),_0x32b442);return db[_0x7f2d('0x38')][_0x7f2d('0x51')]({'where':{'id':_0x2ee829[_0x7f2d('0x53')]['id']},'attributes':['id',_0x7f2d('0x52'),'from','to','cc',_0x7f2d('0x93'),_0x7f2d('0x94'),_0x7f2d('0x95')],'include':_0x2ee829[_0x7f2d('0x3e')][_0x7f2d('0x6c')]?[{'model':db[_0x7f2d('0x96')],'as':'Attachments'}]:undefined})[_0x7f2d('0x33')](handleEntityNotFound(_0x6fe352,null))[_0x7f2d('0x33')](function(_0x123970){if(_0x123970){var _0x55baf8=_0x123970;var _0x324380={'from':_0x55baf8[_0x7f2d('0x97')],'to':_0x55baf8['to'],'subject':_0x55baf8[_0x7f2d('0x94')],'html':_0x55baf8['body'],'headers':{'Date':moment(_0x55baf8[_0x7f2d('0x95')])[_0x7f2d('0x76')](_0x7f2d('0x98'))},'attachments':[]};if(_0x123970['cc']){_0x324380['headers']['Cc']=_0x123970['cc'];}if(_0x123970[_0x7f2d('0x93')]){_0x324380[_0x7f2d('0x99')][_0x7f2d('0x9a')]=_0x123970[_0x7f2d('0x93')];}return new BPromise(function(_0x4c4d89,_0x424d84){if(_0x123970[_0x7f2d('0x9b')]){for(var _0x439ba6=0x0;_0x439ba6<_0x123970[_0x7f2d('0x9b')][_0x7f2d('0x43')];_0x439ba6++){var _0x654d6c=_0x123970[_0x7f2d('0x9b')][_0x439ba6];var _0x5a4069=path[_0x7f2d('0x6d')](_0x2e032f,_0x654d6c['basename']);if(fs[_0x7f2d('0x9c')](_0x5a4069)){_0x324380[_0x7f2d('0x6c')][_0x7f2d('0x9d')]({'name':_0x654d6c['name'],'contentType':_0x654d6c[_0x7f2d('0x3a')],'data':fs[_0x7f2d('0x9e')](_0x5a4069)});}}}emlformat[_0x7f2d('0x9f')](_0x324380,function(_0x418a26,_0x3251e8){if(_0x418a26)return _0x424d84(_0x418a26);fs['writeFileSync'](path[_0x7f2d('0x6d')](_0x4c8154,_0x3cb7bc),_0x3251e8);return _0x4c4d89(_0x3251e8);});});}})[_0x7f2d('0x33')](function(_0x485838){if(_0x485838){return _0x6fe352[_0x7f2d('0x8d')](path[_0x7f2d('0x6d')](_0x4c8154,_0x3cb7bc),_0x3cb7bc,function(_0x1ac7bc){if(_0x1ac7bc){console[_0x7f2d('0xa0')]('err',_0x1ac7bc);}else{fs[_0x7f2d('0xa1')](path['join'](_0x4c8154,_0x3cb7bc));}});}})[_0x7f2d('0x4e')](handleError(_0x6fe352,null));}; \ No newline at end of file +var _0x1e6c=['end','name','send','map','MailMessage','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','create','out','secret','split','findOne','MailAccountId','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','List','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail','read','UserId','Contact','get','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','mail-interactions','agent','role','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','headers','existsSync','push','readFileSync','writeFileSync','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','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','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x1e6c,0x11a));var _0xc1e6=function(_0xf394a,_0x20d1dd){_0xf394a=_0xf394a-0x0;var _0xde580f=_0x1e6c[_0xf394a];return _0xde580f;};'use strict';var pdf=require(_0xc1e6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc1e6('0x1'));var zipdir=require(_0xc1e6('0x2'));var jsonpatch=require(_0xc1e6('0x3'));var rp=require(_0xc1e6('0x4'));var moment=require(_0xc1e6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc1e6('0x6'));var path=require(_0xc1e6('0x7'));var sox=require(_0xc1e6('0x8'));var csv=require(_0xc1e6('0x9'));var ejs=require(_0xc1e6('0xa'));var fs=require('fs');var _=require(_0xc1e6('0xb'));var squel=require(_0xc1e6('0xc'));var crypto=require('crypto');var jsforce=require(_0xc1e6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc1e6('0x9'));var querystring=require('querystring');var Papa=require(_0xc1e6('0xe'));var Redis=require(_0xc1e6('0xf'));var authService=require(_0xc1e6('0x10'));var qs=require(_0xc1e6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1e6('0x12'))(_0xc1e6('0x13'));var utils=require(_0xc1e6('0x14'));var config=require('../../config/environment');var db=require(_0xc1e6('0x15'))['db'];config[_0xc1e6('0x16')]=_[_0xc1e6('0x17')](config[_0xc1e6('0x16')],{'host':_0xc1e6('0x18'),'port':0x18eb});var socket=require(_0xc1e6('0x19'))(new Redis(config[_0xc1e6('0x16')]));require(_0xc1e6('0x1a'))[_0xc1e6('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc1e6('0x1c')][_0xc1e6('0x1d')]({'port':0x232c});var client9003=jayson[_0xc1e6('0x1c')][_0xc1e6('0x1d')]({'port':0x232b});var client9002=jayson[_0xc1e6('0x1c')][_0xc1e6('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xb850be,_0x2ee6cf,_0x32dc7a){if(_0x32dc7a){var _0x3f975c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f975c['test'](_0x2ee6cf)){return _0xb850be;}else{throw new db[(_0xc1e6('0x1e'))][(_0xc1e6('0x1f'))](_0xc1e6('0x20'));}}else{return _0xb850be;}}function respondWithRpcPromise(_0x2864a6,_0x5d9dc4,_0x5adebf,_0x50240d){return new BPromise(function(_0x149205,_0x1b9e95){var _0x2515ef=_0x50240d||client;return _0x2515ef[_0xc1e6('0x21')](_0x2864a6,_0x5adebf)[_0xc1e6('0x22')](function(_0x1b4983){logger[_0xc1e6('0x23')]('MailMessage,\x20%s,\x20%s',_0x5d9dc4,_0xc1e6('0x24'));logger['debug'](_0xc1e6('0x25'),_0x5d9dc4,_0xc1e6('0x24'),JSON['stringify'](_0x1b4983));if(_0x1b4983['error']){if(_0x1b4983[_0xc1e6('0x26')][_0xc1e6('0x27')]===0x1f4){logger[_0xc1e6('0x26')](_0xc1e6('0x28'),_0x5d9dc4,_0x1b4983[_0xc1e6('0x26')]['message']);return _0x1b9e95(_0x1b4983[_0xc1e6('0x26')][_0xc1e6('0x29')]);}logger[_0xc1e6('0x26')](_0xc1e6('0x28'),_0x5d9dc4,_0x1b4983[_0xc1e6('0x26')]['message']);return _0x149205(_0x1b4983[_0xc1e6('0x26')][_0xc1e6('0x29')]);}else{logger[_0xc1e6('0x23')](_0xc1e6('0x28'),_0x5d9dc4,_0xc1e6('0x24'));_0x149205(_0x1b4983['result'][_0xc1e6('0x29')]);}})['catch'](function(_0x9a2272){logger['error'](_0xc1e6('0x28'),_0x5d9dc4,_0x9a2272);_0x1b9e95(_0x9a2272);});});}function respondWithStatusCode(_0x5d4adc,_0x8c8fb9){_0x8c8fb9=_0x8c8fb9||0xcc;return function(_0x48f9f3){if(_0x48f9f3){return _0x5d4adc[_0xc1e6('0x2a')](_0x8c8fb9);}return _0x5d4adc[_0xc1e6('0x2b')](_0x8c8fb9)['end']();};}function respondWithResult(_0x29f894,_0x4d503a){_0x4d503a=_0x4d503a||0xc8;return function(_0x43a9da){if(_0x43a9da){return _0x29f894['status'](_0x4d503a)[_0xc1e6('0x2c')](_0x43a9da);}};}function respondWithFilteredResult(_0x26a8ca,_0x12a815){return function(_0x485d99){if(_0x485d99){var _0x2d4d24=_0x485d99[_0xc1e6('0x2d')],_0x123d98=_0x12a815[_0xc1e6('0x2e')],_0x15d0db=_0x12a815['offset']+_0x12a815[_0xc1e6('0x2f')],_0x454aaf;if(_0x15d0db>=_0x2d4d24){_0x15d0db=_0x2d4d24;_0x454aaf=0xc8;}else{_0x454aaf=0xce;}_0x26a8ca[_0xc1e6('0x2b')](_0x454aaf);return _0x26a8ca['set'](_0xc1e6('0x30'),_0x123d98+'-'+_0x15d0db+'/'+_0x2d4d24)['json'](_0x485d99);}return null;};}function patchUpdates(_0x3b8c86){return function(_0x25ed48){try{jsonpatch[_0xc1e6('0x31')](_0x25ed48,_0x3b8c86,!![]);}catch(_0x4bce33){return BPromise[_0xc1e6('0x32')](_0x4bce33);}return _0x25ed48[_0xc1e6('0x33')]();};}function saveUpdates(_0x22c379,_0xe7af73){return function(_0x26c81a){if(_0x26c81a){return _0x26c81a[_0xc1e6('0x34')](_0x22c379)[_0xc1e6('0x22')](function(_0x4e24fe){return _0x4e24fe;});}return null;};}function removeEntity(_0x307e82,_0x51c773){return function(_0x122149){if(_0x122149){return _0x122149[_0xc1e6('0x35')]()['then'](function(){_0x307e82[_0xc1e6('0x2b')](0xcc)[_0xc1e6('0x36')]();});}};}function handleEntityNotFound(_0x34f526,_0x13d65e){return function(_0x2d1a47){if(!_0x2d1a47){_0x34f526[_0xc1e6('0x2a')](0x194);}return _0x2d1a47;};}function handleError(_0x5258c4,_0x477e1c){_0x477e1c=_0x477e1c||0x1f4;return function(_0x2fb8ae){logger[_0xc1e6('0x26')](_0x2fb8ae['stack']);if(_0x2fb8ae[_0xc1e6('0x37')]){delete _0x2fb8ae['name'];}_0x5258c4[_0xc1e6('0x2b')](_0x477e1c)[_0xc1e6('0x38')](_0x2fb8ae);};}exports['index']=function(_0x48d192,_0x82c3cb){var _0x1f897f={},_0x174de9={},_0x36b5a9={'count':0x0,'rows':[]};var _0x3c188d=_[_0xc1e6('0x39')](db[_0xc1e6('0x3a')][_0xc1e6('0x3b')],function(_0x4843a8){return{'name':_0x4843a8[_0xc1e6('0x3c')],'type':_0x4843a8['type']['key']};});_0x174de9[_0xc1e6('0x3d')]=_[_0xc1e6('0x39')](_0x3c188d,_0xc1e6('0x37'));_0x174de9['query']=_['keys'](_0x48d192[_0xc1e6('0x3e')]);_0x174de9[_0xc1e6('0x3f')]=_['intersection'](_0x174de9['model'],_0x174de9[_0xc1e6('0x3e')]);_0x1f897f[_0xc1e6('0x40')]=_[_0xc1e6('0x41')](_0x174de9[_0xc1e6('0x3d')],qs['fields'](_0x48d192[_0xc1e6('0x3e')][_0xc1e6('0x42')]));_0x1f897f[_0xc1e6('0x40')]=_0x1f897f['attributes'][_0xc1e6('0x43')]?_0x1f897f[_0xc1e6('0x40')]:_0x174de9[_0xc1e6('0x3d')];if(!_0x48d192[_0xc1e6('0x3e')][_0xc1e6('0x44')](_0xc1e6('0x45'))){_0x1f897f['limit']=qs[_0xc1e6('0x2f')](_0x48d192[_0xc1e6('0x3e')][_0xc1e6('0x2f')]);_0x1f897f[_0xc1e6('0x2e')]=qs[_0xc1e6('0x2e')](_0x48d192['query'][_0xc1e6('0x2e')]);}_0x1f897f[_0xc1e6('0x46')]=qs[_0xc1e6('0x47')](_0x48d192[_0xc1e6('0x3e')][_0xc1e6('0x47')]);_0x1f897f[_0xc1e6('0x48')]=qs[_0xc1e6('0x3f')](_[_0xc1e6('0x49')](_0x48d192['query'],_0x174de9[_0xc1e6('0x3f')]),_0x3c188d);if(_0x48d192[_0xc1e6('0x3e')][_0xc1e6('0x4a')]){_0x1f897f[_0xc1e6('0x48')]=_[_0xc1e6('0x4b')](_0x1f897f['where'],{'$or':_['map'](_0x3c188d,function(_0x562ec7){if(_0x562ec7[_0xc1e6('0x4c')]!=='VIRTUAL'){var _0x41d535={};_0x41d535[_0x562ec7[_0xc1e6('0x37')]]={'$like':'%'+_0x48d192[_0xc1e6('0x3e')][_0xc1e6('0x4a')]+'%'};return _0x41d535;}})});}_0x1f897f=_[_0xc1e6('0x4b')]({},_0x1f897f,_0x48d192[_0xc1e6('0x4d')]);var _0xc53145={'where':_0x1f897f[_0xc1e6('0x48')]};return db['MailMessage'][_0xc1e6('0x2d')](_0xc53145)[_0xc1e6('0x22')](function(_0x2583b6){_0x36b5a9[_0xc1e6('0x2d')]=_0x2583b6;if(_0x48d192[_0xc1e6('0x3e')][_0xc1e6('0x4e')]){_0x1f897f[_0xc1e6('0x4f')]=[{'all':!![]}];}return db[_0xc1e6('0x3a')][_0xc1e6('0x50')](_0x1f897f);})['then'](function(_0x1de344){_0x36b5a9[_0xc1e6('0x51')]=_0x1de344;return _0x36b5a9;})[_0xc1e6('0x22')](respondWithFilteredResult(_0x82c3cb,_0x1f897f))[_0xc1e6('0x52')](handleError(_0x82c3cb,null));};exports[_0xc1e6('0x53')]=function(_0x393436,_0x368335){var _0x4f7ce4={'raw':!![],'where':{'id':_0x393436[_0xc1e6('0x54')]['id']}},_0x23fd84={};_0x23fd84[_0xc1e6('0x3d')]=_[_0xc1e6('0x55')](db[_0xc1e6('0x3a')]['rawAttributes']);_0x23fd84[_0xc1e6('0x3e')]=_[_0xc1e6('0x55')](_0x393436[_0xc1e6('0x3e')]);_0x23fd84[_0xc1e6('0x3f')]=_[_0xc1e6('0x41')](_0x23fd84['model'],_0x23fd84['query']);_0x4f7ce4['attributes']=_['intersection'](_0x23fd84[_0xc1e6('0x3d')],qs[_0xc1e6('0x42')](_0x393436['query'][_0xc1e6('0x42')]));_0x4f7ce4['attributes']=_0x4f7ce4['attributes'][_0xc1e6('0x43')]?_0x4f7ce4[_0xc1e6('0x40')]:_0x23fd84[_0xc1e6('0x3d')];if(_0x393436['query'][_0xc1e6('0x4e')]){_0x4f7ce4['include']=[{'all':!![]}];}_0x4f7ce4=_[_0xc1e6('0x4b')]({},_0x4f7ce4,_0x393436[_0xc1e6('0x4d')]);return db[_0xc1e6('0x3a')][_0xc1e6('0x56')](_0x4f7ce4)[_0xc1e6('0x22')](handleEntityNotFound(_0x368335,null))[_0xc1e6('0x22')](respondWithResult(_0x368335,null))[_0xc1e6('0x52')](handleError(_0x368335,null));};exports[_0xc1e6('0x34')]=function(_0x29400e,_0x2de3c3){if(_0x29400e[_0xc1e6('0x57')]['id']){delete _0x29400e[_0xc1e6('0x57')]['id'];}return db[_0xc1e6('0x3a')][_0xc1e6('0x56')]({'where':{'id':_0x29400e[_0xc1e6('0x54')]['id']}})[_0xc1e6('0x22')](handleEntityNotFound(_0x2de3c3,null))['then'](saveUpdates(_0x29400e[_0xc1e6('0x57')],null))['then'](respondWithResult(_0x2de3c3,null))[_0xc1e6('0x52')](handleError(_0x2de3c3,null));};exports[_0xc1e6('0x35')]=function(_0x2e5a7b,_0x311efc){return db[_0xc1e6('0x3a')][_0xc1e6('0x56')]({'where':{'id':_0x2e5a7b['params']['id']}})[_0xc1e6('0x22')](handleEntityNotFound(_0x311efc,null))[_0xc1e6('0x22')](removeEntity(_0x311efc,null))[_0xc1e6('0x52')](handleError(_0x311efc,null));};exports[_0xc1e6('0x58')]=function(_0x18bf2b,_0x4abc9f){return db['MailMessage'][_0xc1e6('0x58')]()['then'](respondWithResult(_0x4abc9f,null))[_0xc1e6('0x52')](handleError(_0x4abc9f,null));};exports[_0xc1e6('0x59')]=function(_0x26ef77,_0x1b9063){return db[_0xc1e6('0x3a')]['create'](_0x26ef77[_0xc1e6('0x57')])[_0xc1e6('0x22')](function(_0x609c06){if(_0x609c06){if(_0x609c06['direction']===_0xc1e6('0x5a')&&!_0x609c06[_0xc1e6('0x5b')]){var _0x6c558e,_0x32114e,_0x2fbe5a;if(_0x26ef77['body']['to']){_0x32114e=_0x26ef77[_0xc1e6('0x57')]['to'][_0xc1e6('0x5c')](',')[0x0];}return db['MailAccount'][_0xc1e6('0x5d')]({'where':{'id':_0x609c06[_0xc1e6('0x5e')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xc1e6('0x5f')],'as':_0xc1e6('0x60'),'where':{'email':_0x32114e},'limit':0x1,'order':[[_0xc1e6('0x61'),_0xc1e6('0x62')]]}]},{'model':db[_0xc1e6('0x63')],'as':_0xc1e6('0x64'),'raw':!![]}]})[_0xc1e6('0x22')](function(_0x36c8c7){_0x6c558e=_0x36c8c7;if(_0x6c558e&&_0x6c558e['Smtp']){var _0x1fd8ca={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x6c558e[_0xc1e6('0x64')][_0xc1e6('0x65')])){_0x1fd8ca['host']=_0x6c558e[_0xc1e6('0x64')][_0xc1e6('0x66')];_0x1fd8ca[_0xc1e6('0x67')]=_0x6c558e['Smtp']['port'];_0x1fd8ca['secure']=_0x6c558e[_0xc1e6('0x64')][_0xc1e6('0x68')];if(_0x6c558e['Smtp'][_0xc1e6('0x69')]){_0x1fd8ca[_0xc1e6('0x6a')]={'user':_0x6c558e['Smtp'][_0xc1e6('0x6b')],'pass':_0x6c558e[_0xc1e6('0x64')][_0xc1e6('0x6c')]};}}else{_0x1fd8ca[_0xc1e6('0x65')]=_0x6c558e[_0xc1e6('0x64')]['service'];_0x1fd8ca[_0xc1e6('0x6a')]={'user':_0x6c558e[_0xc1e6('0x64')][_0xc1e6('0x6b')],'pass':_0x6c558e[_0xc1e6('0x64')][_0xc1e6('0x6c')]};_0x1fd8ca['secure']=_0x6c558e[_0xc1e6('0x64')][_0xc1e6('0x68')];}if(_0x26ef77[_0xc1e6('0x57')]['attachments']&&_0x26ef77[_0xc1e6('0x57')][_0xc1e6('0x6d')][_0xc1e6('0x43')]){for(var _0xefb261=0x0;_0xefb261<_0x26ef77[_0xc1e6('0x57')][_0xc1e6('0x6d')][_0xc1e6('0x43')];_0xefb261+=0x1){_0x26ef77[_0xc1e6('0x57')]['attachments'][_0xefb261]={'filename':_0x26ef77[_0xc1e6('0x57')]['attachments'][_0xefb261][_0xc1e6('0x37')],'path':path[_0xc1e6('0x6e')](config[_0xc1e6('0x6f')],_0xc1e6('0x70'),_0x26ef77['body'][_0xc1e6('0x6d')][_0xefb261][_0xc1e6('0x71')])};}}_0x2fbe5a={'account':_0x1fd8ca,'message':_0x26ef77['body']};return;}})[_0xc1e6('0x22')](function(){if(_0x6c558e[_0xc1e6('0x72')]){if(_0x6c558e['List']['Contacts'][_0xc1e6('0x43')]){return _0x6c558e[_0xc1e6('0x72')][_0xc1e6('0x60')][0x0];}else{return db[_0xc1e6('0x5f')][_0xc1e6('0x59')](_[_0xc1e6('0x17')](_0x26ef77[_0xc1e6('0x57')],{'firstName':_0x26ef77[_0xc1e6('0x57')]['to'],'email':_0x26ef77[_0xc1e6('0x57')]['to'],'phone':_0x26ef77[_0xc1e6('0x57')]['to'],'ListId':_0x6c558e['ListId']}));}}else{throw new Error(_0xc1e6('0x73'));}})[_0xc1e6('0x22')](function(){if(_0x2fbe5a){return respondWithRpcPromise(_0xc1e6('0x74'),_0xc1e6('0x75'),_0x2fbe5a,client9003)[_0xc1e6('0x22')](function(_0x45da8e){return _0x609c06[_0xc1e6('0x34')]({'read':!![],'messageId':_0x45da8e[_0xc1e6('0x76')],'sentAt':moment()[_0xc1e6('0x77')](_0xc1e6('0x78'))});})[_0xc1e6('0x52')](function(_0x3c2a28){logger[_0xc1e6('0x26')]('%s',JSON[_0xc1e6('0x79')](_0x3c2a28));return _0x609c06;});}return _0x609c06;});}return _0x609c06;}})[_0xc1e6('0x22')](respondWithResult(_0x1b9063,0xc9))[_0xc1e6('0x52')](handleError(_0x1b9063,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports['accept']=function(_0x3c9a5f,_0xd4fb19,_0x1657ce){var _0x4a7b2f={'channel':_0xc1e6('0x7a')};if(_0x3c9a5f[_0xc1e6('0x57')]['id']){delete _0x3c9a5f['body']['id'];}_0x3c9a5f[_0xc1e6('0x57')][_0xc1e6('0x7b')]=!![];_0x3c9a5f[_0xc1e6('0x57')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3c9a5f['body'][_0xc1e6('0x7c')]=_0x3c9a5f[_0xc1e6('0x57')][_0xc1e6('0x7c')]||_0x3c9a5f[_0xc1e6('0x6b')]['id'];return db[_0xc1e6('0x3a')]['find']({'where':{'id':_0x3c9a5f[_0xc1e6('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xc1e6('0x5f')],'as':_0xc1e6('0x7d')}]})[_0xc1e6('0x22')](handleEntityNotFound(_0xd4fb19,null))[_0xc1e6('0x22')](saveUpdates(_0x3c9a5f[_0xc1e6('0x57')],null))[_0xc1e6('0x22')](function(_0xa9e176){if(_0xa9e176){_0x4a7b2f[_0xc1e6('0x29')]=_0xa9e176[_0xc1e6('0x7e')]({'plain':!![]});return db[_0xc1e6('0x7f')][_0xc1e6('0x56')]({'where':{'id':_0xa9e176[_0xc1e6('0x80')]}});}return null;})[_0xc1e6('0x22')](handleEntityNotFound(_0xd4fb19,null))[_0xc1e6('0x22')](function(_0x1383dd){if(_0x1383dd){return _0x1383dd[_0xc1e6('0x34')]({'UserId':_0x3c9a5f[_0xc1e6('0x57')]['UserId'],'read1stAt':_[_0xc1e6('0x81')](_0x1383dd['read1stAt'])?moment()['format'](_0xc1e6('0x78')):undefined});}return null;})[_0xc1e6('0x22')](function(_0x4bae49){if(_0x4bae49){_0x4a7b2f[_0xc1e6('0x82')]=_0x4bae49[_0xc1e6('0x7e')]({'plain':!![]});interaction_log[_0xc1e6('0x23')](_0xc1e6('0x83'),_0x3c9a5f[_0xc1e6('0x6b')]['id'],_0x3c9a5f[_0xc1e6('0x6b')][_0xc1e6('0x37')],_0x3c9a5f['user']['role'],_0x4a7b2f['interaction']['id'],_0x3c9a5f[_0xc1e6('0x57')]?JSON[_0xc1e6('0x79')](_0x3c9a5f[_0xc1e6('0x57')]):_0xc1e6('0x84'));return respondWithRpcPromise(_0xc1e6('0x85'),_0xc1e6('0x86'),_0x4a7b2f);}return null;})[_0xc1e6('0x22')](function(_0x13333d){if(_0x13333d){if(_0x3c9a5f[_0xc1e6('0x57')][_0xc1e6('0x87')]){_0x4a7b2f['message'][_0xc1e6('0x88')]=util[_0xc1e6('0x77')](_0xc1e6('0x89'),_0x3c9a5f[_0xc1e6('0x6b')][_0xc1e6('0x37')]);_0x4a7b2f[_0xc1e6('0x29')][_0xc1e6('0x8a')]=_0x4a7b2f[_0xc1e6('0x8a')];_0x4a7b2f[_0xc1e6('0x29')][_0xc1e6('0x8b')]=_0xc1e6('0x8c');return respondWithRpcPromise(_0xc1e6('0x8d'),_0xc1e6('0x8d'),{'event':'acceptmessage','message':_0x4a7b2f['message']},client9002)[_0xc1e6('0x22')](function(){return _0x4a7b2f;});}return _0x4a7b2f;}return null;})[_0xc1e6('0x22')](respondWithResult(_0xd4fb19,null))[_0xc1e6('0x52')](handleError(_0xd4fb19,null));};var interaction_log=require(_0xc1e6('0x12'))(_0xc1e6('0x8e'));exports[_0xc1e6('0x32')]=function(_0x1c3f06,_0x3aa69a,_0x4f8fe4){var _0x1650da={'agent':{},'channel':'mail'};if(_0x1c3f06[_0xc1e6('0x57')]['id']){delete _0x1c3f06['body']['id'];}_0x1c3f06[_0xc1e6('0x57')][_0xc1e6('0x7c')]=_0x1c3f06[_0xc1e6('0x57')][_0xc1e6('0x7c')]||_0x1c3f06[_0xc1e6('0x6b')]['id'];_0x1650da[_0xc1e6('0x8f')]['id']=_0x1c3f06['body'][_0xc1e6('0x7c')];return db[_0xc1e6('0x3a')][_0xc1e6('0x56')]({'where':{'id':_0x1c3f06['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3aa69a,null))[_0xc1e6('0x22')](function(_0x3935d3){if(_0x3935d3){_0x1650da['message']=_0x3935d3[_0xc1e6('0x7e')]({'plain':!![]});return db[_0xc1e6('0x7f')][_0xc1e6('0x56')]({'where':{'id':_0x3935d3['MailInteractionId']}});}return null;})[_0xc1e6('0x22')](handleEntityNotFound(_0x3aa69a,null))[_0xc1e6('0x22')](function(_0x3a3164){if(_0x3a3164){_0x1650da['interaction']=_0x3a3164[_0xc1e6('0x7e')]({'plain':!![]});interaction_log[_0xc1e6('0x23')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1c3f06[_0xc1e6('0x6b')]['id'],_0x1c3f06[_0xc1e6('0x6b')]['name'],_0x1c3f06[_0xc1e6('0x6b')][_0xc1e6('0x90')],_0x1650da['interaction']['id'],_0x1c3f06['body']?JSON[_0xc1e6('0x79')](_0x1c3f06['body']):_0xc1e6('0x84'));return respondWithRpcPromise(_0xc1e6('0x91'),_0xc1e6('0x92'),_0x1650da);}return null;})[_0xc1e6('0x22')](function(_0x1e07ea){if(_0x1e07ea){_0x1e07ea[_0xc1e6('0x29')]['interface']=util[_0xc1e6('0x77')]('SIP/%s',_0x1c3f06['user'][_0xc1e6('0x37')]);_0x1e07ea['message'][_0xc1e6('0x8a')]=_0x1650da[_0xc1e6('0x8a')];_0x1e07ea[_0xc1e6('0x29')]['event']='reject';respondWithRpcPromise(_0xc1e6('0x8d'),_0xc1e6('0x8d'),{'event':_0xc1e6('0x93'),'message':_0x1e07ea[_0xc1e6('0x29')]},client9002);return _0x1650da;}return null;})[_0xc1e6('0x22')](respondWithResult(_0x3aa69a,null))[_0xc1e6('0x52')](handleError(_0x3aa69a,null));};exports[_0xc1e6('0x94')]=function(_0x2a1e21,_0x26950c){var _0x21afa9=moment()[_0xc1e6('0x95')]()[_0xc1e6('0x96')]();var _0x51bf5b=path[_0xc1e6('0x6e')](config[_0xc1e6('0x6f')],_0xc1e6('0x97'),_0xc1e6('0x98'),_0xc1e6('0x99'));var _0x551d46=path[_0xc1e6('0x6e')](config[_0xc1e6('0x6f')],'server',_0xc1e6('0x98'),'attachments');var _0x4f8f05=util[_0xc1e6('0x77')](_0xc1e6('0x9a'),_0x21afa9);return db['MailMessage'][_0xc1e6('0x56')]({'where':{'id':_0x2a1e21['params']['id']},'attributes':['id',_0xc1e6('0x57'),_0xc1e6('0x9b'),'to','cc',_0xc1e6('0x9c'),_0xc1e6('0x9d'),_0xc1e6('0x9e')],'include':_0x2a1e21[_0xc1e6('0x3e')][_0xc1e6('0x6d')]?[{'model':db[_0xc1e6('0x9f')],'as':_0xc1e6('0xa0')}]:undefined})[_0xc1e6('0x22')](handleEntityNotFound(_0x26950c,null))[_0xc1e6('0x22')](function(_0x20a6db){if(_0x20a6db){var _0x5ba11e=_0x20a6db;var _0x5a266c={'from':_0x5ba11e[_0xc1e6('0x9b')],'to':_0x5ba11e['to'],'subject':_0x5ba11e[_0xc1e6('0x9d')],'html':_0x5ba11e['body'],'headers':{'Date':moment(_0x5ba11e['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x20a6db['cc']){_0x5a266c[_0xc1e6('0xa1')]['Cc']=_0x20a6db['cc'];}if(_0x20a6db['bcc']){_0x5a266c[_0xc1e6('0xa1')]['Bcc']=_0x20a6db[_0xc1e6('0x9c')];}return new BPromise(function(_0x5ce7be,_0x3bf907){if(_0x20a6db[_0xc1e6('0xa0')]){for(var _0xb00638=0x0;_0xb00638<_0x20a6db[_0xc1e6('0xa0')]['length'];_0xb00638++){var _0x1ea7dc=_0x20a6db[_0xc1e6('0xa0')][_0xb00638];var _0xde0837=path[_0xc1e6('0x6e')](_0x551d46,_0x1ea7dc[_0xc1e6('0x71')]);if(fs[_0xc1e6('0xa2')](_0xde0837)){_0x5a266c[_0xc1e6('0x6d')][_0xc1e6('0xa3')]({'name':_0x1ea7dc['name'],'contentType':_0x1ea7dc[_0xc1e6('0x4c')],'data':fs[_0xc1e6('0xa4')](_0xde0837)});}}}emlformat['build'](_0x5a266c,function(_0x2e8f25,_0xb9589a){if(_0x2e8f25)return _0x3bf907(_0x2e8f25);fs[_0xc1e6('0xa5')](path[_0xc1e6('0x6e')](_0x51bf5b,_0x4f8f05),_0xb9589a);return _0x5ce7be(_0xb9589a);});});}})[_0xc1e6('0x22')](function(_0x3712ab){if(_0x3712ab){return _0x26950c['download'](path[_0xc1e6('0x6e')](_0x51bf5b,_0x4f8f05),_0x4f8f05,function(_0x5f3ac8){if(_0x5f3ac8){console[_0xc1e6('0xa6')]('err',_0x5f3ac8);}else{fs[_0xc1e6('0xa7')](path['join'](_0x51bf5b,_0x4f8f05));}});}})[_0xc1e6('0x52')](handleError(_0x26950c,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 172c0e7..84d72a1 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 _0x4eb2=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x5564aa,_0x521816){var _0x42fcd4=function(_0x3d657){while(--_0x3d657){_0x5564aa['push'](_0x5564aa['shift']());}};_0x42fcd4(++_0x521816);}(_0x4eb2,0xcc));var _0x24eb=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x4eb2[_0x173d7e];return _0x2220d6;};'use strict';var EventEmitter=require(_0x24eb('0x0'));var MailMessage=require(_0x24eb('0x1'))['db'][_0x24eb('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x24eb('0x3')](0x0);var events={'afterCreate':_0x24eb('0x4'),'afterUpdate':'update','afterDestroy':_0x24eb('0x5')};function emitEvent(_0xadaff0){return function(_0x4c6dbd,_0x2269fd,_0x3cfde8){MailMessageEvents['emit'](_0xadaff0+':'+_0x4c6dbd['id'],_0x4c6dbd);MailMessageEvents[_0x24eb('0x6')](_0xadaff0,_0x4c6dbd);_0x3cfde8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x24eb('0x7')](e,emitEvent(event));}}module[_0x24eb('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xccc9=['emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove'];(function(_0x43390f,_0xe82743){var _0x1b5924=function(_0x142e86){while(--_0x142e86){_0x43390f['push'](_0x43390f['shift']());}};_0x1b5924(++_0xe82743);}(_0xccc9,0xff));var _0x9ccc=function(_0x3d75fa,_0x23dd66){_0x3d75fa=_0x3d75fa-0x0;var _0xe23aad=_0xccc9[_0x3d75fa];return _0xe23aad;};'use strict';var EventEmitter=require(_0x9ccc('0x0'));var MailMessage=require(_0x9ccc('0x1'))['db'][_0x9ccc('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9ccc('0x3')](0x0);var events={'afterCreate':_0x9ccc('0x4'),'afterUpdate':'update','afterDestroy':_0x9ccc('0x5')};function emitEvent(_0x4660bc){return function(_0x1f4cb5,_0x86cc2b,_0x10440a){MailMessageEvents[_0x9ccc('0x6')](_0x4660bc+':'+_0x1f4cb5['id'],_0x1f4cb5);MailMessageEvents[_0x9ccc('0x6')](_0x4660bc,_0x1f4cb5);_0x10440a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x9ccc('0x7')](e,emitEvent(event));}}module[_0x9ccc('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index fcbce52..39e27eb 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 _0x3670=['request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','toLowerCase','out','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3670,0xd4));var _0x0367=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3670[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0367('0x0'));var util=require(_0x0367('0x1'));var logger=require(_0x0367('0x2'))('api');var moment=require(_0x0367('0x3'));var BPromise=require(_0x0367('0x4'));var rp=require(_0x0367('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x0367('0x6'));var rimraf=require(_0x0367('0x7'));var config=require(_0x0367('0x8'));var attributes=require(_0x0367('0x9'));module['exports']=function(_0x4e00cc,_0x5c2aa3){return _0x4e00cc[_0x0367('0xa')]('MailMessage',attributes,{'tableName':_0x0367('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0367('0xc')]},{'name':_0x0367('0xd'),'fields':[_0x0367('0xe'),_0x0367('0xf')],'type':_0x0367('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f0203,_0x51de62,_0x33718c){if(_0x3f0203[_0x0367('0x11')]){_0x3f0203[_0x0367('0xe')]=htmlToText['fromString'](_0x3f0203[_0x0367('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x33718c(null,_0x51de62);},'afterCreate':function(_0x42756f,_0x33b6b2,_0xd59ee9){var _0x29128c=_0x4e00cc['models'];var _0x3b8195=_0x42756f[_0x0367('0x12')]({'plain':!![]});if(_0x3b8195[_0x0367('0x13')][_0x0367('0x14')]()==='in'||_0x3b8195['direction'][_0x0367('0x14')]()===_0x0367('0x15')&&!_0x3b8195['secret']&&!_['isNil'](_0x3b8195[_0x0367('0x16')])){_0x29128c[_0x0367('0x17')][_0x0367('0x18')]({'where':{'id':_0x3b8195[_0x0367('0x19')]}})[_0x0367('0x1a')](function(_0x2c6f5a){if(_0x2c6f5a){_0x2c6f5a[_0x0367('0x1b')]({'lastMsgAt':_0x3b8195[_0x0367('0x1c')],'lastMsgDirection':_0x3b8195[_0x0367('0x13')][_0x0367('0x14')](),'lastMsgBody':_0x3b8195[_0x0367('0x11')]});}})[_0x0367('0x1d')](function(_0x27e7e0){console['error'](_0x27e7e0);});}_0xd59ee9();}},'charset':_0x0367('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x667b=['findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','body','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction'];(function(_0x1340ee,_0x14a779){var _0x3ef3e7=function(_0x87247){while(--_0x87247){_0x1340ee['push'](_0x1340ee['shift']());}};_0x3ef3e7(++_0x14a779);}(_0x667b,0xb2));var _0xb667=function(_0x8560d3,_0x26a504){_0x8560d3=_0x8560d3-0x0;var _0x33b1b5=_0x667b[_0x8560d3];return _0x33b1b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb667('0x0'))(_0xb667('0x1'));var moment=require(_0xb667('0x2'));var BPromise=require(_0xb667('0x3'));var rp=require(_0xb667('0x4'));var htmlToText=require(_0xb667('0x5'));var fs=require('fs');var path=require(_0xb667('0x6'));var rimraf=require(_0xb667('0x7'));var config=require(_0xb667('0x8'));var attributes=require(_0xb667('0x9'));module[_0xb667('0xa')]=function(_0x50f531,_0x14d311){return _0x50f531['define'](_0xb667('0xb'),attributes,{'tableName':_0xb667('0xc'),'paranoid':![],'indexes':[{'name':_0xb667('0xd'),'fields':[_0xb667('0xd')]},{'name':_0xb667('0xe'),'fields':[_0xb667('0xf'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x40d74a,_0x560df1,_0x28792e){if(_0x40d74a[_0xb667('0x10')]){_0x40d74a[_0xb667('0xf')]=htmlToText[_0xb667('0x11')](_0x40d74a[_0xb667('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x28792e(null,_0x560df1);},'afterCreate':function(_0x236665,_0x51b088,_0x13f40b){var _0x2927ef=_0x50f531[_0xb667('0x12')];var _0x1638ac=_0x236665['get']({'plain':!![]});if(_0x1638ac[_0xb667('0x13')][_0xb667('0x14')]()==='in'||_0x1638ac['direction'][_0xb667('0x14')]()===_0xb667('0x15')&&!_0x1638ac[_0xb667('0x16')]&&!_[_0xb667('0x17')](_0x1638ac[_0xb667('0x18')])){_0x2927ef[_0xb667('0x19')][_0xb667('0x1a')]({'where':{'id':_0x1638ac[_0xb667('0x1b')]}})[_0xb667('0x1c')](function(_0x22fbbe){if(_0x22fbbe){_0x22fbbe[_0xb667('0x1d')]({'lastMsgAt':_0x1638ac['createdAt'],'lastMsgDirection':_0x1638ac[_0xb667('0x13')][_0xb667('0x14')](),'lastMsgBody':_0x1638ac[_0xb667('0x10')]});}})[_0xb667('0x1e')](function(_0x3d5ffe){console[_0xb667('0x1f')](_0x3d5ffe);});}_0x13f40b();}},'charset':_0xb667('0x20'),'collate':_0xb667('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index fd35f36..c432aa0 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 _0xd819=['message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','then','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s'];(function(_0x3bb4fe,_0x37dbb9){var _0x2e28f2=function(_0x497654){while(--_0x497654){_0x3bb4fe['push'](_0x3bb4fe['shift']());}};_0x2e28f2(++_0x37dbb9);}(_0xd819,0x181));var _0x9d81=function(_0x26f68f,_0x125079){_0x26f68f=_0x26f68f-0x0;var _0x3047dd=_0xd819[_0x26f68f];return _0x3047dd;};'use strict';var _=require('lodash');var util=require(_0x9d81('0x0'));var moment=require(_0x9d81('0x1'));var BPromise=require(_0x9d81('0x2'));var rs=require(_0x9d81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d81('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d81('0x5'))('rpc');var config=require(_0x9d81('0x6'));var jayson=require(_0x9d81('0x7'));var client=jayson[_0x9d81('0x8')]['http']({'port':0x232a});config[_0x9d81('0x9')]=_[_0x9d81('0xa')](config[_0x9d81('0x9')],{'host':_0x9d81('0xb'),'port':0x18eb});var socket=require(_0x9d81('0xc'))(new Redis(config[_0x9d81('0x9')]));require(_0x9d81('0xd'))[_0x9d81('0xe')](socket);function respondWithRpcPromise(_0x25a4c0,_0x3932e7,_0x17a3a3){return new BPromise(function(_0x44bba4,_0x404b15){return client[_0x9d81('0xf')](_0x25a4c0,_0x17a3a3)['then'](function(_0x139d28){logger[_0x9d81('0x10')]('MailMessage,\x20%s,\x20%s',_0x3932e7,_0x9d81('0x11'));logger[_0x9d81('0x12')](_0x9d81('0x13'),_0x3932e7,_0x9d81('0x11'),JSON['stringify'](_0x139d28));if(_0x139d28[_0x9d81('0x14')]){if(_0x139d28['error'][_0x9d81('0x15')]===0x1f4){logger['error'](_0x9d81('0x16'),_0x3932e7,_0x139d28[_0x9d81('0x14')]['message']);return _0x404b15(_0x139d28[_0x9d81('0x14')][_0x9d81('0x17')]);}logger[_0x9d81('0x14')](_0x9d81('0x16'),_0x3932e7,_0x139d28[_0x9d81('0x14')][_0x9d81('0x17')]);return _0x44bba4(_0x139d28[_0x9d81('0x14')][_0x9d81('0x17')]);}else{logger['info'](_0x9d81('0x16'),_0x3932e7,_0x9d81('0x11'));_0x44bba4(_0x139d28[_0x9d81('0x18')][_0x9d81('0x17')]);}})[_0x9d81('0x19')](function(_0x49e4c9){logger['error'](_0x9d81('0x16'),_0x3932e7,_0x49e4c9);_0x404b15(_0x49e4c9);});});}exports[_0x9d81('0x1a')]=function(_0x3104ad){var _0x40960c=this;return new Promise(function(_0x409720,_0x175d4f){return db[_0x9d81('0x1b')][_0x9d81('0x1c')](_0x3104ad[_0x9d81('0x1d')],{'raw':_0x3104ad[_0x9d81('0x1e')]?_0x3104ad[_0x9d81('0x1e')][_0x9d81('0x1f')]===undefined?!![]:![]:!![]})[_0x9d81('0x20')](function(_0x4a9c9c){logger[_0x9d81('0x10')](_0x9d81('0x1a'),_0x3104ad);logger[_0x9d81('0x12')](_0x9d81('0x1a'),_0x3104ad,JSON[_0x9d81('0x21')](_0x4a9c9c));_0x409720(_0x4a9c9c);})[_0x9d81('0x19')](function(_0x3d7be7){logger[_0x9d81('0x14')]('CreateMailMessage',_0x3d7be7[_0x9d81('0x17')],_0x3104ad);_0x175d4f(_0x40960c[_0x9d81('0x14')](0x1f4,_0x3d7be7[_0x9d81('0x17')]));});});}; \ No newline at end of file +var _0xf072=['request','then','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','CreateMailMessage','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xf072,0x1cf));var _0x2f07=function(_0x39485f,_0x17c637){_0x39485f=_0x39485f-0x0;var _0x1dc8fb=_0xf072[_0x39485f];return _0x1dc8fb;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var moment=require(_0x2f07('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f07('0x4'))['db'];var utils=require(_0x2f07('0x5'));var logger=require(_0x2f07('0x6'))('rpc');var config=require(_0x2f07('0x7'));var jayson=require(_0x2f07('0x8'));var client=jayson[_0x2f07('0x9')][_0x2f07('0xa')]({'port':0x232a});config[_0x2f07('0xb')]=_[_0x2f07('0xc')](config[_0x2f07('0xb')],{'host':_0x2f07('0xd'),'port':0x18eb});var socket=require(_0x2f07('0xe'))(new Redis(config[_0x2f07('0xb')]));require(_0x2f07('0xf'))[_0x2f07('0x10')](socket);function respondWithRpcPromise(_0x1a3848,_0x18fe13,_0x14e237){return new BPromise(function(_0x564260,_0xdb2783){return client[_0x2f07('0x11')](_0x1a3848,_0x14e237)[_0x2f07('0x12')](function(_0x3525be){logger['info']('MailMessage,\x20%s,\x20%s',_0x18fe13,_0x2f07('0x13'));logger[_0x2f07('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x18fe13,_0x2f07('0x13'),JSON[_0x2f07('0x15')](_0x3525be));if(_0x3525be[_0x2f07('0x16')]){if(_0x3525be['error'][_0x2f07('0x17')]===0x1f4){logger[_0x2f07('0x16')](_0x2f07('0x18'),_0x18fe13,_0x3525be[_0x2f07('0x16')][_0x2f07('0x19')]);return _0xdb2783(_0x3525be[_0x2f07('0x16')]['message']);}logger[_0x2f07('0x16')]('MailMessage,\x20%s,\x20%s',_0x18fe13,_0x3525be[_0x2f07('0x16')][_0x2f07('0x19')]);return _0x564260(_0x3525be[_0x2f07('0x16')][_0x2f07('0x19')]);}else{logger[_0x2f07('0x1a')](_0x2f07('0x18'),_0x18fe13,_0x2f07('0x13'));_0x564260(_0x3525be[_0x2f07('0x1b')]['message']);}})[_0x2f07('0x1c')](function(_0x4e35fd){logger[_0x2f07('0x16')](_0x2f07('0x18'),_0x18fe13,_0x4e35fd);_0xdb2783(_0x4e35fd);});});}exports[_0x2f07('0x1d')]=function(_0xd944d6){var _0x2ef47d=this;return new Promise(function(_0x5267e1,_0x45df73){return db['MailMessage']['create'](_0xd944d6['body'],{'raw':_0xd944d6[_0x2f07('0x1e')]?_0xd944d6['options'][_0x2f07('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x354ee2){logger[_0x2f07('0x1a')](_0x2f07('0x1d'),_0xd944d6);logger[_0x2f07('0x14')]('CreateMailMessage',_0xd944d6,JSON[_0x2f07('0x15')](_0x354ee2));_0x5267e1(_0x354ee2);})[_0x2f07('0x1c')](function(_0x37c42a){logger['error'](_0x2f07('0x1d'),_0x37c42a[_0x2f07('0x19')],_0xd944d6);_0x45df73(_0x2ef47d['error'](0x1f4,_0x37c42a[_0x2f07('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 68fdd07..5d6fd0d 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 _0x45a0=['length','mailMessage:','./mailMessage.events','save','update','emit'];(function(_0x1b6d5a,_0x5e1ebe){var _0x3a601c=function(_0x341f43){while(--_0x341f43){_0x1b6d5a['push'](_0x1b6d5a['shift']());}};_0x3a601c(++_0x5e1ebe);}(_0x45a0,0x1e8));var _0x045a=function(_0x369c01,_0x2acc02){_0x369c01=_0x369c01-0x0;var _0x50cbbf=_0x45a0[_0x369c01];return _0x50cbbf;};'use strict';var MailMessageEvents=require(_0x045a('0x0'));var events=[_0x045a('0x1'),'remove',_0x045a('0x2')];function createListener(_0x559991,_0x4b39ae){return function(_0x51295f){_0x4b39ae[_0x045a('0x3')](_0x559991,_0x51295f);};}function removeListener(_0x19f6c5,_0x34c3cd){return function(){MailMessageEvents['removeListener'](_0x19f6c5,_0x34c3cd);};}exports['register']=function(_0x5ada11){for(var _0x2f94ff=0x0,_0x2af007=events[_0x045a('0x4')];_0x2f94ff<_0x2af007;_0x2f94ff++){var _0x31014f=events[_0x2f94ff];var _0x35cad9=createListener(_0x045a('0x5')+_0x31014f,_0x5ada11);MailMessageEvents['on'](_0x31014f,_0x35cad9);}}; \ No newline at end of file +var _0xcac6=['register','length','mailMessage:','save','remove','update','emit','removeListener'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0xcac6,0xa3));var _0x6cac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcac6[_0x321bb2];return _0x9c12ed;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x6cac('0x0'),_0x6cac('0x1'),_0x6cac('0x2')];function createListener(_0x73a7f7,_0x52fc3b){return function(_0x50a4ed){_0x52fc3b[_0x6cac('0x3')](_0x73a7f7,_0x50a4ed);};}function removeListener(_0x431603,_0x2810e7){return function(){MailMessageEvents[_0x6cac('0x4')](_0x431603,_0x2810e7);};}exports[_0x6cac('0x5')]=function(_0x44b83d){for(var _0x11700d=0x0,_0x51a850=events[_0x6cac('0x6')];_0x11700d<_0x51a850;_0x11700d++){var _0x21c42a=events[_0x11700d];var _0x353359=createListener(_0x6cac('0x7')+_0x21c42a,_0x44b83d);MailMessageEvents['on'](_0x21c42a,_0x353359);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 56891d1..46207de 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 _0xb56c=['Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x349819,_0x2d5a50){var _0x478c0d=function(_0x2e50a3){while(--_0x2e50a3){_0x349819['push'](_0x349819['shift']());}};_0x478c0d(++_0x2d5a50);}(_0xb56c,0x18f));var _0xcb56=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0xb56c[_0x3299d1];return _0x44356e;};'use strict';var multer=require(_0xcb56('0x0'));var util=require(_0xcb56('0x1'));var path=require('path');var timeout=require(_0xcb56('0x2'));var express=require(_0xcb56('0x3'));var router=express[_0xcb56('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcb56('0x5'));var config=require(_0xcb56('0x6'));var controller=require(_0xcb56('0x7'));router[_0xcb56('0x8')]('/',auth['isAuthenticated'](),controller[_0xcb56('0x9')]);router[_0xcb56('0x8')](_0xcb56('0xa'),auth[_0xcb56('0xb')](),controller[_0xcb56('0xc')]);router[_0xcb56('0x8')](_0xcb56('0xd'),auth[_0xcb56('0xb')](),controller[_0xcb56('0xe')]);router[_0xcb56('0x8')](_0xcb56('0xf'),auth[_0xcb56('0xb')](),controller[_0xcb56('0x10')]);router[_0xcb56('0x8')](_0xcb56('0x11'),auth[_0xcb56('0xb')](),controller[_0xcb56('0x12')]);router[_0xcb56('0x8')](_0xcb56('0x13'),auth[_0xcb56('0xb')](),controller[_0xcb56('0x14')]);router[_0xcb56('0x15')]('/',auth[_0xcb56('0xb')](),controller[_0xcb56('0x16')]);router[_0xcb56('0x15')](_0xcb56('0x11'),auth[_0xcb56('0xb')](),controller[_0xcb56('0x17')]);router[_0xcb56('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xcb56('0x18')]);router[_0xcb56('0x19')](_0xcb56('0xd'),auth[_0xcb56('0xb')](),controller[_0xcb56('0x1a')]);router[_0xcb56('0x1b')](_0xcb56('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xcb56('0x11'),auth[_0xcb56('0xb')](),controller[_0xcb56('0x1c')]);router[_0xcb56('0x1b')](_0xcb56('0x13'),auth[_0xcb56('0xb')](),controller[_0xcb56('0x1d')]);module[_0xcb56('0x1e')]=router; \ No newline at end of file +var _0x091c=['./mailQueue.controller','get','index','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x162a95,_0x9dfb1f){var _0x54cd40=function(_0x249ed1){while(--_0x249ed1){_0x162a95['push'](_0x162a95['shift']());}};_0x54cd40(++_0x9dfb1f);}(_0x091c,0xbc));var _0xc091=function(_0x1f8413,_0x18f221){_0x1f8413=_0x1f8413-0x0;var _0x133870=_0x091c[_0x1f8413];return _0x133870;};'use strict';var multer=require('multer');var util=require(_0xc091('0x0'));var path=require(_0xc091('0x1'));var timeout=require(_0xc091('0x2'));var express=require(_0xc091('0x3'));var router=express[_0xc091('0x4')]();var auth=require(_0xc091('0x5'));var interaction=require(_0xc091('0x6'));var config=require(_0xc091('0x7'));var controller=require(_0xc091('0x8'));router[_0xc091('0x9')]('/',auth['isAuthenticated'](),controller[_0xc091('0xa')]);router['get']('/describe',auth[_0xc091('0xb')](),controller['describe']);router[_0xc091('0x9')](_0xc091('0xc'),auth['isAuthenticated'](),controller[_0xc091('0xd')]);router['get'](_0xc091('0xe'),auth[_0xc091('0xb')](),controller[_0xc091('0xf')]);router[_0xc091('0x9')](_0xc091('0x10'),auth[_0xc091('0xb')](),controller[_0xc091('0x11')]);router[_0xc091('0x9')](_0xc091('0x12'),auth[_0xc091('0xb')](),controller['getAgents']);router[_0xc091('0x13')]('/',auth['isAuthenticated'](),controller[_0xc091('0x14')]);router[_0xc091('0x13')](_0xc091('0x10'),auth[_0xc091('0xb')](),controller['addTeams']);router[_0xc091('0x13')](_0xc091('0x12'),auth[_0xc091('0xb')](),controller[_0xc091('0x15')]);router[_0xc091('0x16')](_0xc091('0xc'),auth[_0xc091('0xb')](),controller[_0xc091('0x17')]);router[_0xc091('0x18')]('/:id',auth[_0xc091('0xb')](),controller[_0xc091('0x19')]);router[_0xc091('0x18')](_0xc091('0x10'),auth[_0xc091('0xb')](),controller['removeTeams']);router['delete'](_0xc091('0x12'),auth[_0xc091('0xb')](),controller[_0xc091('0x1a')]);module[_0xc091('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index a5993fa..68708b6 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 _0x09d2=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x3125d4,_0x4e2faa){var _0x4d87e9=function(_0xa18ff1){while(--_0xa18ff1){_0x3125d4['push'](_0x3125d4['shift']());}};_0x4d87e9(++_0x4e2faa);}(_0x09d2,0x1d2));var _0x209d=function(_0x3fb178,_0x33631b){_0x3fb178=_0x3fb178-0x0;var _0x512966=_0x09d2[_0x3fb178];return _0x512966;};'use strict';var Sequelize=require(_0x209d('0x0'));module[_0x209d('0x1')]={'name':{'type':Sequelize[_0x209d('0x2')],'unique':_0x209d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x209d('0x2')]},'timeout':{'type':Sequelize[_0x209d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x209d('0x5')](_0x209d('0x6'),_0x209d('0x7'),_0x209d('0x8'))}}; \ No newline at end of file +var _0x1b30=['name','STRING','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0x1b30,0x1b0));var _0x01b3=function(_0x3a98b2,_0x216bf6){_0x3a98b2=_0x3a98b2-0x0;var _0x1e0a6c=_0x1b30[_0x3a98b2];return _0x1e0a6c;};'use strict';var Sequelize=require(_0x01b3('0x0'));module[_0x01b3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x01b3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x01b3('0x3')]},'timeout':{'type':Sequelize[_0x01b3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x01b3('0x5')](_0x01b3('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index b739d1e..f34dfd7 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 _0xad96=['send','MailQueue','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','MailQueueId','findAndCountAll','agent','mailPause','updatedAt','createdAt','%s/%s','getTeams','Team','ids','Agents','online','voicePause','flatMap','get','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','union','value','isEmpty','userMailQueue:remove','addAgents','spread','userMailQueue:save','removeAgents','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/environment','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name'];(function(_0x105642,_0x7d2cac){var _0x507156=function(_0x43767f){while(--_0x43767f){_0x105642['push'](_0x105642['shift']());}};_0x507156(++_0x7d2cac);}(_0xad96,0x17b));var _0x6ad9=function(_0x3a0a97,_0x82ccf2){_0x3a0a97=_0x3a0a97-0x0;var _0x46f4e1=_0xad96[_0x3a0a97];return _0x46f4e1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6ad9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ad9('0x1'));var jsonpatch=require(_0x6ad9('0x2'));var rp=require(_0x6ad9('0x3'));var moment=require('moment');var BPromise=require(_0x6ad9('0x4'));var Mustache=require(_0x6ad9('0x5'));var util=require(_0x6ad9('0x6'));var path=require('path');var sox=require(_0x6ad9('0x7'));var csv=require(_0x6ad9('0x8'));var ejs=require(_0x6ad9('0x9'));var fs=require('fs');var _=require(_0x6ad9('0xa'));var squel=require('squel');var crypto=require(_0x6ad9('0xb'));var jsforce=require(_0x6ad9('0xc'));var deskjs=require(_0x6ad9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6ad9('0xe'));var Papa=require(_0x6ad9('0xf'));var Redis=require(_0x6ad9('0x10'));var authService=require(_0x6ad9('0x11'));var qs=require(_0x6ad9('0x12'));var as=require(_0x6ad9('0x13'));var hardwareService=require(_0x6ad9('0x14'));var logger=require(_0x6ad9('0x15'))(_0x6ad9('0x16'));var utils=require('../../config/utils');var config=require(_0x6ad9('0x17'));var db=require('../../mysqldb')['db'];config[_0x6ad9('0x18')]=_[_0x6ad9('0x19')](config['redis'],{'host':_0x6ad9('0x1a'),'port':0x18eb});var socket=require(_0x6ad9('0x1b'))(new Redis(config[_0x6ad9('0x18')]));require(_0x6ad9('0x1c'))[_0x6ad9('0x1d')](socket);function respondWithStatusCode(_0x279a83,_0x2de8a1){_0x2de8a1=_0x2de8a1||0xcc;return function(_0x2e58e6){if(_0x2e58e6){return _0x279a83[_0x6ad9('0x1e')](_0x2de8a1);}return _0x279a83[_0x6ad9('0x1f')](_0x2de8a1)[_0x6ad9('0x20')]();};}function respondWithResult(_0x3c24b2,_0x2e6b38){_0x2e6b38=_0x2e6b38||0xc8;return function(_0x2f40ef){if(_0x2f40ef){return _0x3c24b2[_0x6ad9('0x1f')](_0x2e6b38)[_0x6ad9('0x21')](_0x2f40ef);}};}function respondWithFilteredResult(_0x22921c,_0x390287){return function(_0x5c9452){if(_0x5c9452){var _0x35d3d9=_0x5c9452[_0x6ad9('0x22')],_0x55c417=_0x390287['offset'],_0x36aee7=_0x390287[_0x6ad9('0x23')]+_0x390287['limit'],_0x5383a7;if(_0x36aee7>=_0x35d3d9){_0x36aee7=_0x35d3d9;_0x5383a7=0xc8;}else{_0x5383a7=0xce;}_0x22921c[_0x6ad9('0x1f')](_0x5383a7);return _0x22921c[_0x6ad9('0x24')](_0x6ad9('0x25'),_0x55c417+'-'+_0x36aee7+'/'+_0x35d3d9)[_0x6ad9('0x21')](_0x5c9452);}return null;};}function patchUpdates(_0x31b85d){return function(_0x44f240){try{jsonpatch[_0x6ad9('0x26')](_0x44f240,_0x31b85d,!![]);}catch(_0x2b8f01){return BPromise[_0x6ad9('0x27')](_0x2b8f01);}return _0x44f240[_0x6ad9('0x28')]();};}function saveUpdates(_0x5cd72a,_0xffe200){return function(_0x208091){if(_0x208091){return _0x208091[_0x6ad9('0x29')](_0x5cd72a)[_0x6ad9('0x2a')](function(_0x89813){return _0x89813;});}return null;};}function removeEntity(_0x1691b1,_0x551360){return function(_0x3887ca){if(_0x3887ca){return _0x3887ca[_0x6ad9('0x2b')]()[_0x6ad9('0x2a')](function(){var _0x1dc549=_0x3887ca['get']({'plain':!![]});var _0x5bf431='MailQueues';return db[_0x6ad9('0x2c')][_0x6ad9('0x2b')]({'where':{'type':_0x5bf431,'resourceId':_0x1dc549['id']}})[_0x6ad9('0x2a')](function(){return _0x3887ca;});})[_0x6ad9('0x2a')](function(){_0x1691b1[_0x6ad9('0x1f')](0xcc)[_0x6ad9('0x20')]();});}};}function handleEntityNotFound(_0x593c59,_0x496ec0){return function(_0x151512){if(!_0x151512){_0x593c59[_0x6ad9('0x1e')](0x194);}return _0x151512;};}function handleError(_0x126cca,_0x14e7f5){_0x14e7f5=_0x14e7f5||0x1f4;return function(_0x17c19d){logger['error'](_0x17c19d[_0x6ad9('0x2d')]);if(_0x17c19d[_0x6ad9('0x2e')]){delete _0x17c19d[_0x6ad9('0x2e')];}_0x126cca[_0x6ad9('0x1f')](_0x14e7f5)[_0x6ad9('0x2f')](_0x17c19d);};}exports['index']=function(_0x78fc7c,_0x4d424b){var _0x52dcab={},_0x7ed1ab={},_0x39daa3={'count':0x0,'rows':[]};var _0x541325=_['map'](db[_0x6ad9('0x30')][_0x6ad9('0x31')],function(_0x40ea15){return{'name':_0x40ea15['fieldName'],'type':_0x40ea15['type'][_0x6ad9('0x32')]};});_0x7ed1ab[_0x6ad9('0x33')]=_[_0x6ad9('0x34')](_0x541325,'name');_0x7ed1ab[_0x6ad9('0x35')]=_[_0x6ad9('0x36')](_0x78fc7c[_0x6ad9('0x35')]);_0x7ed1ab[_0x6ad9('0x37')]=_[_0x6ad9('0x38')](_0x7ed1ab[_0x6ad9('0x33')],_0x7ed1ab[_0x6ad9('0x35')]);_0x52dcab[_0x6ad9('0x39')]=_['intersection'](_0x7ed1ab[_0x6ad9('0x33')],qs[_0x6ad9('0x3a')](_0x78fc7c[_0x6ad9('0x35')][_0x6ad9('0x3a')]));_0x52dcab['attributes']=_0x52dcab[_0x6ad9('0x39')][_0x6ad9('0x3b')]?_0x52dcab['attributes']:_0x7ed1ab[_0x6ad9('0x33')];if(!_0x78fc7c[_0x6ad9('0x35')][_0x6ad9('0x3c')](_0x6ad9('0x3d'))){_0x52dcab['limit']=qs[_0x6ad9('0x3e')](_0x78fc7c[_0x6ad9('0x35')][_0x6ad9('0x3e')]);_0x52dcab[_0x6ad9('0x23')]=qs['offset'](_0x78fc7c[_0x6ad9('0x35')][_0x6ad9('0x23')]);}_0x52dcab[_0x6ad9('0x3f')]=qs[_0x6ad9('0x40')](_0x78fc7c[_0x6ad9('0x35')][_0x6ad9('0x40')]);_0x52dcab[_0x6ad9('0x41')]=qs[_0x6ad9('0x37')](_[_0x6ad9('0x42')](_0x78fc7c[_0x6ad9('0x35')],_0x7ed1ab['filters']),_0x541325);if(_0x78fc7c[_0x6ad9('0x35')][_0x6ad9('0x43')]){_0x52dcab[_0x6ad9('0x41')]=_['merge'](_0x52dcab[_0x6ad9('0x41')],{'$or':_[_0x6ad9('0x34')](_0x541325,function(_0x407162){if(_0x407162[_0x6ad9('0x44')]!=='VIRTUAL'){var _0x5a80c5={};_0x5a80c5[_0x407162[_0x6ad9('0x2e')]]={'$like':'%'+_0x78fc7c['query'][_0x6ad9('0x43')]+'%'};return _0x5a80c5;}})});}_0x52dcab=_[_0x6ad9('0x45')]({},_0x52dcab,_0x78fc7c['options']);var _0x6ff46e={'where':_0x52dcab['where']};return db[_0x6ad9('0x30')][_0x6ad9('0x22')](_0x6ff46e)[_0x6ad9('0x2a')](function(_0x204e53){_0x39daa3[_0x6ad9('0x22')]=_0x204e53;if(_0x78fc7c[_0x6ad9('0x35')]['includeAll']){_0x52dcab[_0x6ad9('0x46')]=[{'all':!![]}];}return db[_0x6ad9('0x30')][_0x6ad9('0x47')](_0x52dcab);})[_0x6ad9('0x2a')](function(_0x4ec8cd){_0x39daa3[_0x6ad9('0x48')]=_0x4ec8cd;return _0x39daa3;})[_0x6ad9('0x2a')](respondWithFilteredResult(_0x4d424b,_0x52dcab))[_0x6ad9('0x49')](handleError(_0x4d424b,null));};exports[_0x6ad9('0x4a')]=function(_0x556b33,_0x2aded0){var _0x21d767={'raw':!![],'where':{'id':_0x556b33[_0x6ad9('0x4b')]['id']}},_0x5ac249={};_0x5ac249[_0x6ad9('0x33')]=_[_0x6ad9('0x36')](db['MailQueue'][_0x6ad9('0x31')]);_0x5ac249[_0x6ad9('0x35')]=_[_0x6ad9('0x36')](_0x556b33[_0x6ad9('0x35')]);_0x5ac249['filters']=_['intersection'](_0x5ac249[_0x6ad9('0x33')],_0x5ac249[_0x6ad9('0x35')]);_0x21d767[_0x6ad9('0x39')]=_[_0x6ad9('0x38')](_0x5ac249[_0x6ad9('0x33')],qs[_0x6ad9('0x3a')](_0x556b33[_0x6ad9('0x35')][_0x6ad9('0x3a')]));_0x21d767['attributes']=_0x21d767['attributes'][_0x6ad9('0x3b')]?_0x21d767[_0x6ad9('0x39')]:_0x5ac249[_0x6ad9('0x33')];if(_0x556b33['query'][_0x6ad9('0x4c')]){_0x21d767[_0x6ad9('0x46')]=[{'all':!![]}];}_0x21d767=_[_0x6ad9('0x45')]({},_0x21d767,_0x556b33[_0x6ad9('0x4d')]);return db[_0x6ad9('0x30')][_0x6ad9('0x4e')](_0x21d767)[_0x6ad9('0x2a')](handleEntityNotFound(_0x2aded0,null))[_0x6ad9('0x2a')](respondWithResult(_0x2aded0,null))[_0x6ad9('0x49')](handleError(_0x2aded0,null));};exports[_0x6ad9('0x4f')]=function(_0x53206e,_0x252ef8){return db['MailQueue']['create'](_0x53206e['body'],{})[_0x6ad9('0x2a')](function(_0x3e65d5){var _0x2e81ea=_0x53206e[_0x6ad9('0x50')]['get']({'plain':!![]});if(!_0x2e81ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e81ea[_0x6ad9('0x51')]===_0x6ad9('0x50')){var _0x2cea96=_0x3e65d5['get']({'plain':!![]});var _0x50fd7c=_0x6ad9('0x52');return db[_0x6ad9('0x53')]['find']({'where':{'name':_0x50fd7c,'userProfileId':_0x2e81ea[_0x6ad9('0x54')]},'raw':!![]})['then'](function(_0x311f7d){if(_0x311f7d&&_0x311f7d[_0x6ad9('0x55')]===0x0){return db[_0x6ad9('0x2c')]['create']({'name':_0x2cea96['name'],'resourceId':_0x2cea96['id'],'type':_0x311f7d[_0x6ad9('0x2e')],'sectionId':_0x311f7d['id']},{})[_0x6ad9('0x2a')](function(){return _0x3e65d5;});}else{return _0x3e65d5;}})[_0x6ad9('0x49')](function(_0x235fa2){logger[_0x6ad9('0x56')](_0x6ad9('0x57'),_0x235fa2);throw _0x235fa2;});}return _0x3e65d5;})[_0x6ad9('0x2a')](respondWithResult(_0x252ef8,0xc9))[_0x6ad9('0x49')](handleError(_0x252ef8,null));};exports[_0x6ad9('0x29')]=function(_0x59919a,_0x99325){if(_0x59919a[_0x6ad9('0x58')]['id']){delete _0x59919a[_0x6ad9('0x58')]['id'];}return db[_0x6ad9('0x30')][_0x6ad9('0x4e')]({'where':{'id':_0x59919a[_0x6ad9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x99325,null))['then'](saveUpdates(_0x59919a[_0x6ad9('0x58')],null))[_0x6ad9('0x2a')](respondWithResult(_0x99325,null))[_0x6ad9('0x49')](handleError(_0x99325,null));};exports[_0x6ad9('0x2b')]=function(_0x296af3,_0x4c976d){return db[_0x6ad9('0x30')]['find']({'where':{'id':_0x296af3[_0x6ad9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4c976d,null))['then'](removeEntity(_0x4c976d,null))['catch'](handleError(_0x4c976d,null));};exports[_0x6ad9('0x59')]=function(_0x509478,_0x1eac45){return db[_0x6ad9('0x30')][_0x6ad9('0x59')]()['then'](respondWithResult(_0x1eac45,null))[_0x6ad9('0x49')](handleError(_0x1eac45,null));};exports[_0x6ad9('0x5a')]=function(_0x5f230e,_0x34677b,_0x16cce3){var _0x4940ae={'raw':!![],'where':{}},_0xeee3e3={},_0x467fe1;return db['MailQueue'][_0x6ad9('0x5b')]({'where':{'id':_0x5f230e['params']['id']}})[_0x6ad9('0x2a')](handleEntityNotFound(_0x34677b,null))[_0x6ad9('0x2a')](function(_0x25e441){if(_0x25e441){_0x467fe1=_0x25e441['get']({'plain':!![]});_0xeee3e3[_0x6ad9('0x33')]=_[_0x6ad9('0x36')](db[_0x6ad9('0x5c')]['rawAttributes']);_0xeee3e3[_0x6ad9('0x35')]=_[_0x6ad9('0x36')](_0x5f230e[_0x6ad9('0x35')]);_0xeee3e3[_0x6ad9('0x37')]=_[_0x6ad9('0x38')](_0xeee3e3[_0x6ad9('0x33')],_0xeee3e3[_0x6ad9('0x35')]);_0x4940ae[_0x6ad9('0x39')]=_[_0x6ad9('0x38')](_0xeee3e3[_0x6ad9('0x33')],qs[_0x6ad9('0x3a')](_0x5f230e['query'][_0x6ad9('0x3a')]));_0x4940ae[_0x6ad9('0x39')]=_0x4940ae['attributes']['length']?_0x4940ae['attributes']:_0xeee3e3[_0x6ad9('0x33')];if(!_0x5f230e[_0x6ad9('0x35')][_0x6ad9('0x3c')](_0x6ad9('0x3d'))){_0x4940ae[_0x6ad9('0x3e')]=qs[_0x6ad9('0x3e')](_0x5f230e[_0x6ad9('0x35')][_0x6ad9('0x3e')]);_0x4940ae['offset']=qs[_0x6ad9('0x23')](_0x5f230e['query']['offset']);}_0x4940ae[_0x6ad9('0x3f')]=qs['sort'](_0x5f230e[_0x6ad9('0x35')][_0x6ad9('0x40')]);_0x4940ae[_0x6ad9('0x41')]=qs[_0x6ad9('0x37')](_['pick'](_0x5f230e[_0x6ad9('0x35')],_0xeee3e3[_0x6ad9('0x37')]));_0x4940ae['where'][_0x6ad9('0x5d')]=_0x25e441['id'];if(_0x5f230e[_0x6ad9('0x35')][_0x6ad9('0x43')]){_0x4940ae[_0x6ad9('0x41')]=_[_0x6ad9('0x45')](_0x4940ae[_0x6ad9('0x41')],{'$or':_[_0x6ad9('0x34')](_0x4940ae[_0x6ad9('0x39')],function(_0x49bb4a){var _0x16fef7={};_0x16fef7[_0x49bb4a]={'$like':'%'+_0x5f230e[_0x6ad9('0x35')][_0x6ad9('0x43')]+'%'};return _0x16fef7;})});}_0x4940ae=_['merge']({},_0x4940ae,_0x5f230e['options']);return db[_0x6ad9('0x5c')][_0x6ad9('0x47')](_0x4940ae);}})['then'](function(_0x22ce1f){if(_0x22ce1f){return db['User'][_0x6ad9('0x5e')]({'where':{'id':_[_0x6ad9('0x34')](_0x22ce1f,'UserId'),'role':_0x6ad9('0x5f')},'attributes':['id',_0x6ad9('0x2e'),_0x6ad9('0x60'),_0x6ad9('0x61'),_0x6ad9('0x62')]});}})[_0x6ad9('0x2a')](function(_0x2fbf45){if(_0x2fbf45){return{'count':_0x2fbf45[_0x6ad9('0x22')],'rows':_[_0x6ad9('0x34')](_0x2fbf45[_0x6ad9('0x48')],function(_0x9824c1){return{'membername':_0x9824c1[_0x6ad9('0x2e')],'UserId':_0x9824c1['id'],'queue_name':_0x467fe1['name'],'MailQueueId':_0x467fe1['id'],'interface':util['format'](_0x6ad9('0x63'),'SIP',_0x9824c1[_0x6ad9('0x2e')]),'penalty':0x0,'paused':_0x9824c1[_0x6ad9('0x60')],'createdAt':_0x9824c1['createdAt'],'updatedAt':_0x9824c1[_0x6ad9('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6ad9('0x2a')](respondWithFilteredResult(_0x34677b,_0x4940ae))['catch'](handleError(_0x34677b,null));};exports[_0x6ad9('0x64')]=function(_0x3220f2,_0x10ff2c,_0x9ee8c5){var _0x308280={};var _0x237a30={};var _0x35f95d;var _0x113a8c;return db[_0x6ad9('0x30')][_0x6ad9('0x5b')]({'where':{'id':_0x3220f2[_0x6ad9('0x4b')]['id']}})[_0x6ad9('0x2a')](handleEntityNotFound(_0x10ff2c,null))[_0x6ad9('0x2a')](function(_0x4da05c){if(_0x4da05c){_0x35f95d=_0x4da05c;_0x237a30[_0x6ad9('0x33')]=_[_0x6ad9('0x36')](db[_0x6ad9('0x65')][_0x6ad9('0x31')]);_0x237a30[_0x6ad9('0x35')]=_[_0x6ad9('0x36')](_0x3220f2['query']);_0x237a30[_0x6ad9('0x37')]=_[_0x6ad9('0x38')](_0x237a30['model'],_0x237a30[_0x6ad9('0x35')]);_0x308280[_0x6ad9('0x39')]=_['intersection'](_0x237a30['model'],qs['fields'](_0x3220f2[_0x6ad9('0x35')]['fields']));_0x308280[_0x6ad9('0x39')]=_0x308280[_0x6ad9('0x39')][_0x6ad9('0x3b')]?_0x308280[_0x6ad9('0x39')]:_0x237a30['model'];_0x308280[_0x6ad9('0x3f')]=qs[_0x6ad9('0x40')](_0x3220f2[_0x6ad9('0x35')]['sort']);_0x308280['where']=qs[_0x6ad9('0x37')](_['pick'](_0x3220f2[_0x6ad9('0x35')],_0x237a30[_0x6ad9('0x37')]));if(_0x3220f2['query']['filter']){_0x308280[_0x6ad9('0x41')]=_['merge'](_0x308280['where'],{'$or':_[_0x6ad9('0x34')](_0x308280['attributes'],function(_0x588fac){var _0x26eb17={};_0x26eb17[_0x588fac]={'$like':'%'+_0x3220f2[_0x6ad9('0x35')]['filter']+'%'};return _0x26eb17;})});}_0x308280=_[_0x6ad9('0x45')]({},_0x308280,_0x3220f2['options']);return _0x35f95d[_0x6ad9('0x64')](_0x308280);}})[_0x6ad9('0x2a')](function(_0x122041){if(_0x122041){_0x113a8c=_0x122041['length'];if(!_0x3220f2[_0x6ad9('0x35')][_0x6ad9('0x3c')](_0x6ad9('0x3d'))){_0x308280[_0x6ad9('0x3e')]=qs[_0x6ad9('0x3e')](_0x3220f2[_0x6ad9('0x35')][_0x6ad9('0x3e')]);_0x308280[_0x6ad9('0x23')]=qs['offset'](_0x3220f2[_0x6ad9('0x35')][_0x6ad9('0x23')]);}return _0x35f95d[_0x6ad9('0x64')](_0x308280);}})['then'](function(_0x4f22a0){if(_0x4f22a0){return _0x4f22a0?{'count':_0x113a8c,'rows':_0x4f22a0}:null;}})[_0x6ad9('0x2a')](respondWithResult(_0x10ff2c,null))['catch'](handleError(_0x10ff2c,null));};exports['addTeams']=function(_0x509f88,_0x2e140e,_0x3eb136){var _0x35245c=_0x509f88['body'][_0x6ad9('0x66')];return db[_0x6ad9('0x65')][_0x6ad9('0x47')]({'where':{'id':_0x35245c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6ad9('0x67'),'attributes':['id',_0x6ad9('0x2e'),_0x6ad9('0x68'),_0x6ad9('0x69'),'interface'],'raw':!![]}]})[_0x6ad9('0x2a')](function(_0x27d695){if(_0x27d695){var _0xe3fb3a=_[_0x6ad9('0x6a')](_0x27d695,function(_0x33ab4d){var _0x2f8bdc=_0x33ab4d[_0x6ad9('0x6b')]({'plain':!![]});return _0x2f8bdc[_0x6ad9('0x67')];});return db['MailQueue'][_0x6ad9('0x4e')]({'where':{'id':_0x509f88[_0x6ad9('0x4b')]['id']}})['then'](function(_0xc3d509){return db[_0x6ad9('0x6c')][_0x6ad9('0x6d')](function(_0x158ea5){return _0xc3d509[_0x6ad9('0x6e')](_0x35245c,{'transaction':_0x158ea5})[_0x6ad9('0x2a')](function(){return BPromise[_0x6ad9('0x6f')](_0xe3fb3a,function(_0xa7d631){return db['UserMailQueue'][_0x6ad9('0x70')]({'where':{'UserId':_0xa7d631['id'],'MailQueueId':_0x509f88[_0x6ad9('0x4b')]['id']},'transaction':_0x158ea5});});})['then'](function(){_0xe3fb3a[_0x6ad9('0x71')](function(_0x540d95){socket[_0x6ad9('0x72')]('userMailQueue:save',{'UserId':_0x540d95['id'],'MailQueueId':_0xc3d509['id']});});});});});}})[_0x6ad9('0x2a')](respondWithStatusCode(_0x2e140e,null))[_0x6ad9('0x49')](handleError(_0x2e140e,null));};exports[_0x6ad9('0x73')]=function(_0x3b8d80,_0x569bb2,_0x2bd11c){return db[_0x6ad9('0x65')][_0x6ad9('0x47')]({'where':{'id':_0x3b8d80[_0x6ad9('0x35')][_0x6ad9('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6ad9('0x2a')](handleEntityNotFound(_0x569bb2,null))[_0x6ad9('0x2a')](function(_0x16abd2){var _0x3239d8=_['map'](_0x16abd2,'id');var _0x2732d9=[];var _0x4fdc69=[];var _0x135a87=squel[_0x6ad9('0x74')]();_0x135a87[_0x6ad9('0x75')](_0x6ad9('0x76'))[_0x6ad9('0x77')](_0x6ad9('0x78'),'tq')[_0x6ad9('0x79')](_0x6ad9('0x7a'),'ut',_0x6ad9('0x7b'))['where'](_0x6ad9('0x7c'),_0x3b8d80[_0x6ad9('0x4b')]['id']);for(var _0x1179c3=0x0;_0x1179c3<_0x16abd2[_0x6ad9('0x3b')];_0x1179c3+=0x1){let _0x555c62=_0x16abd2[_0x1179c3];for(var _0x4c14fe=0x0;_0x4c14fe<_0x555c62['Agents']['length'];_0x4c14fe+=0x1){let _0x34d996=_0x555c62[_0x6ad9('0x67')][_0x4c14fe];var _0x25ae96=_0x135a87[_0x6ad9('0x7d')]();_0x25ae96[_0x6ad9('0x41')](_0x6ad9('0x7e'),_0x34d996['id']);_0x4fdc69[_0x6ad9('0x7f')](db['sequelize'][_0x6ad9('0x35')](_0x25ae96['toString'](),{'type':db['sequelize'][_0x6ad9('0x80')][_0x6ad9('0x81')]})[_0x6ad9('0x2a')](function(_0x5eb101){if(_0x5eb101[_0x6ad9('0x3b')]===0x1){return _0x34d996['id'];}else{var _0x3547b9=_['every'](_[_0x6ad9('0x34')](_0x5eb101,'TeamId'),function(_0x351110){return _[_0x6ad9('0x82')](_0x3239d8,_0x351110);});if(_0x3547b9){return _0x34d996['id'];}}}));}}return BPromise[_0x6ad9('0x83')](_0x4fdc69)[_0x6ad9('0x2a')](function(_0x1a0a50){_0x2732d9=_(_0x2732d9)[_0x6ad9('0x84')](_0x1a0a50)['compact']()[_0x6ad9('0x85')]();return db[_0x6ad9('0x30')][_0x6ad9('0x4e')]({'where':{'id':_0x3b8d80[_0x6ad9('0x4b')]['id']}})[_0x6ad9('0x2a')](function(_0x230251){return db['sequelize']['transaction'](function(_0x5b3ea2){return _0x230251['removeTeams'](_0x3b8d80[_0x6ad9('0x35')][_0x6ad9('0x66')],{'transaction':_0x5b3ea2})[_0x6ad9('0x2a')](function(){if(!_[_0x6ad9('0x86')](_0x2732d9)){return _0x230251['removeAgents'](_0x2732d9,{'transaction':_0x5b3ea2});}})[_0x6ad9('0x2a')](function(){_0x2732d9[_0x6ad9('0x71')](function(_0x1da185){socket['emit'](_0x6ad9('0x87'),{'UserId':_0x1da185,'MailQueueId':_0x230251['id']});});});});});});})['then'](respondWithStatusCode(_0x569bb2,null))[_0x6ad9('0x49')](handleError(_0x569bb2,null));};exports[_0x6ad9('0x88')]=function(_0x1bd9e1,_0x3b8127,_0x1d9425){return db['MailQueue']['find']({'where':{'id':_0x1bd9e1['params']['id']}})['then'](handleEntityNotFound(_0x3b8127,null))[_0x6ad9('0x2a')](function(_0x42b925){if(_0x42b925){return _0x42b925[_0x6ad9('0x88')](_0x1bd9e1[_0x6ad9('0x58')][_0x6ad9('0x66')],_['omit'](_0x1bd9e1[_0x6ad9('0x58')],[_0x6ad9('0x66'),'id'])||{})[_0x6ad9('0x89')](function(_0x2dd8c8){for(var _0xee9e12=0x0;_0xee9e12<_0x1bd9e1['body']['ids']['length'];_0xee9e12+=0x1){socket['emit'](_0x6ad9('0x8a'),{'UserId':_0x1bd9e1[_0x6ad9('0x58')][_0x6ad9('0x66')][_0xee9e12],'MailQueueId':_0x1bd9e1[_0x6ad9('0x4b')]['id']});}return _0x2dd8c8;});}})[_0x6ad9('0x2a')](respondWithResult(_0x3b8127,null))[_0x6ad9('0x49')](handleError(_0x3b8127,null));};exports[_0x6ad9('0x8b')]=function(_0x51f154,_0x15340a,_0x16db9e){return db[_0x6ad9('0x30')][_0x6ad9('0x4e')]({'where':{'id':_0x51f154[_0x6ad9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15340a,null))[_0x6ad9('0x2a')](function(_0x13905e){if(_0x13905e){return _0x13905e[_0x6ad9('0x8b')](_0x51f154[_0x6ad9('0x35')][_0x6ad9('0x66')])[_0x6ad9('0x2a')](function(){if(_['isArray'](_0x51f154[_0x6ad9('0x35')][_0x6ad9('0x66')])){for(var _0x5b8031=0x0;_0x5b8031<_0x51f154[_0x6ad9('0x35')][_0x6ad9('0x66')][_0x6ad9('0x3b')];_0x5b8031+=0x1){socket['emit'](_0x6ad9('0x87'),{'UserId':Number(_0x51f154[_0x6ad9('0x35')][_0x6ad9('0x66')][_0x5b8031]),'MailQueueId':Number(_0x51f154[_0x6ad9('0x4b')]['id'])});}}else{socket['emit'](_0x6ad9('0x87'),{'UserId':Number(_0x51f154[_0x6ad9('0x35')][_0x6ad9('0x66')]),'MailQueueId':Number(_0x51f154[_0x6ad9('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x15340a,null))[_0x6ad9('0x49')](handleError(_0x15340a,null));};exports[_0x6ad9('0x8c')]=function(_0x41d097,_0x480c74,_0x16af2c){var _0xe4d0f8={};var _0x4cfa1a={};var _0x420030;var _0x4427b2;return db['MailQueue'][_0x6ad9('0x5b')]({'where':{'id':_0x41d097[_0x6ad9('0x4b')]['id']}})[_0x6ad9('0x2a')](handleEntityNotFound(_0x480c74,null))[_0x6ad9('0x2a')](function(_0x4d1c8a){if(_0x4d1c8a){_0x420030=_0x4d1c8a;_0x4cfa1a[_0x6ad9('0x33')]=_['keys'](db[_0x6ad9('0x8d')][_0x6ad9('0x31')]);_0x4cfa1a[_0x6ad9('0x35')]=_[_0x6ad9('0x36')](_0x41d097[_0x6ad9('0x35')]);_0x4cfa1a['filters']=_['intersection'](_0x4cfa1a[_0x6ad9('0x33')],_0x4cfa1a[_0x6ad9('0x35')]);_0xe4d0f8['attributes']=_['intersection'](_0x4cfa1a['model'],qs[_0x6ad9('0x3a')](_0x41d097[_0x6ad9('0x35')][_0x6ad9('0x3a')]));_0xe4d0f8[_0x6ad9('0x39')]=_0xe4d0f8[_0x6ad9('0x39')]['length']?_0xe4d0f8[_0x6ad9('0x39')]:_0x4cfa1a[_0x6ad9('0x33')];_0xe4d0f8[_0x6ad9('0x3f')]=qs[_0x6ad9('0x40')](_0x41d097[_0x6ad9('0x35')][_0x6ad9('0x40')]);_0xe4d0f8[_0x6ad9('0x41')]=qs[_0x6ad9('0x37')](_[_0x6ad9('0x42')](_0x41d097[_0x6ad9('0x35')],_0x4cfa1a['filters']));if(_0x41d097[_0x6ad9('0x35')][_0x6ad9('0x43')]){_0xe4d0f8['where']=_['merge'](_0xe4d0f8[_0x6ad9('0x41')],{'$or':_[_0x6ad9('0x34')](_0xe4d0f8[_0x6ad9('0x39')],function(_0x2bedfe){var _0x42f418={};_0x42f418[_0x2bedfe]={'$like':'%'+_0x41d097[_0x6ad9('0x35')]['filter']+'%'};return _0x42f418;})});}_0xe4d0f8=_[_0x6ad9('0x45')]({},_0xe4d0f8,_0x41d097['options']);return _0x420030[_0x6ad9('0x8c')](_0xe4d0f8);}})[_0x6ad9('0x2a')](function(_0x209cda){if(_0x209cda){_0x4427b2=_0x209cda['length'];if(!_0x41d097['query'][_0x6ad9('0x3c')](_0x6ad9('0x3d'))){_0xe4d0f8['limit']=qs[_0x6ad9('0x3e')](_0x41d097[_0x6ad9('0x35')][_0x6ad9('0x3e')]);_0xe4d0f8[_0x6ad9('0x23')]=qs[_0x6ad9('0x23')](_0x41d097['query'][_0x6ad9('0x23')]);}return _0x420030[_0x6ad9('0x8c')](_0xe4d0f8);}})[_0x6ad9('0x2a')](function(_0x2adba5){if(_0x2adba5){return _0x2adba5?{'count':_0x4427b2,'rows':_0x2adba5}:null;}})['then'](respondWithResult(_0x480c74,null))[_0x6ad9('0x49')](handleError(_0x480c74,null));}; \ No newline at end of file +var _0x892a=['rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MailQueues','destroy','error','stack','name','map','MailQueue','rawAttributes','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','order','MailQueueId','findAndCountAll','updatedAt','createdAt','rows','format','%s/%s','SIP','mailPause','getTeams','Team','ids','findAll','User','Agents','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','value','removeAgents','emit','addAgents','spread','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format'];(function(_0x4f0f27,_0x51deba){var _0x2ce661=function(_0x52a20f){while(--_0x52a20f){_0x4f0f27['push'](_0x4f0f27['shift']());}};_0x2ce661(++_0x51deba);}(_0x892a,0x18d));var _0xa892=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x892a[_0x5e9876];return _0x576c48;};'use strict';var pdf=require(_0xa892('0x0'));var emlformat=require(_0xa892('0x1'));var rimraf=require(_0xa892('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa892('0x3'));var rp=require(_0xa892('0x4'));var moment=require(_0xa892('0x5'));var BPromise=require(_0xa892('0x6'));var Mustache=require(_0xa892('0x7'));var util=require(_0xa892('0x8'));var path=require(_0xa892('0x9'));var sox=require('sox');var csv=require(_0xa892('0xa'));var ejs=require(_0xa892('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa892('0xc'));var jsforce=require(_0xa892('0xd'));var deskjs=require(_0xa892('0xe'));var toCsv=require(_0xa892('0xa'));var querystring=require(_0xa892('0xf'));var Papa=require(_0xa892('0x10'));var Redis=require(_0xa892('0x11'));var authService=require(_0xa892('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa892('0x13'));var hardwareService=require(_0xa892('0x14'));var logger=require(_0xa892('0x15'))('api');var utils=require(_0xa892('0x16'));var config=require(_0xa892('0x17'));var db=require('../../mysqldb')['db'];config[_0xa892('0x18')]=_['defaults'](config[_0xa892('0x18')],{'host':_0xa892('0x19'),'port':0x18eb});var socket=require(_0xa892('0x1a'))(new Redis(config[_0xa892('0x18')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x53a809,_0x3fe4b8){_0x3fe4b8=_0x3fe4b8||0xcc;return function(_0x381ce5){if(_0x381ce5){return _0x53a809['sendStatus'](_0x3fe4b8);}return _0x53a809[_0xa892('0x1b')](_0x3fe4b8)[_0xa892('0x1c')]();};}function respondWithResult(_0x5b575c,_0x1b1bd6){_0x1b1bd6=_0x1b1bd6||0xc8;return function(_0xa5d284){if(_0xa5d284){return _0x5b575c[_0xa892('0x1b')](_0x1b1bd6)[_0xa892('0x1d')](_0xa5d284);}};}function respondWithFilteredResult(_0x19dca6,_0x4a8175){return function(_0x5a7cbc){if(_0x5a7cbc){var _0x2bd993=_0x5a7cbc['count'],_0x316f71=_0x4a8175[_0xa892('0x1e')],_0x5c9f54=_0x4a8175[_0xa892('0x1e')]+_0x4a8175[_0xa892('0x1f')],_0x5c4c94;if(_0x5c9f54>=_0x2bd993){_0x5c9f54=_0x2bd993;_0x5c4c94=0xc8;}else{_0x5c4c94=0xce;}_0x19dca6[_0xa892('0x1b')](_0x5c4c94);return _0x19dca6[_0xa892('0x20')](_0xa892('0x21'),_0x316f71+'-'+_0x5c9f54+'/'+_0x2bd993)['json'](_0x5a7cbc);}return null;};}function patchUpdates(_0x4fc9a0){return function(_0x4b2dad){try{jsonpatch[_0xa892('0x22')](_0x4b2dad,_0x4fc9a0,!![]);}catch(_0x5616c2){return BPromise[_0xa892('0x23')](_0x5616c2);}return _0x4b2dad[_0xa892('0x24')]();};}function saveUpdates(_0x166fda,_0x4c11f6){return function(_0x1779c5){if(_0x1779c5){return _0x1779c5[_0xa892('0x25')](_0x166fda)['then'](function(_0x1ba9b8){return _0x1ba9b8;});}return null;};}function removeEntity(_0x70f6c3,_0x242738){return function(_0x1c36fe){if(_0x1c36fe){return _0x1c36fe['destroy']()[_0xa892('0x26')](function(){var _0x51a8a0=_0x1c36fe[_0xa892('0x27')]({'plain':!![]});var _0x5e3082=_0xa892('0x28');return db['UserProfileResource'][_0xa892('0x29')]({'where':{'type':_0x5e3082,'resourceId':_0x51a8a0['id']}})['then'](function(){return _0x1c36fe;});})[_0xa892('0x26')](function(){_0x70f6c3[_0xa892('0x1b')](0xcc)[_0xa892('0x1c')]();});}};}function handleEntityNotFound(_0x2737f1,_0x1936cf){return function(_0x2dd743){if(!_0x2dd743){_0x2737f1['sendStatus'](0x194);}return _0x2dd743;};}function handleError(_0x42b603,_0x960041){_0x960041=_0x960041||0x1f4;return function(_0x523b50){logger[_0xa892('0x2a')](_0x523b50[_0xa892('0x2b')]);if(_0x523b50[_0xa892('0x2c')]){delete _0x523b50[_0xa892('0x2c')];}_0x42b603[_0xa892('0x1b')](_0x960041)['send'](_0x523b50);};}exports['index']=function(_0x2ecd5f,_0x599509){var _0x19fbf0={},_0xf78c5a={},_0x4b5e40={'count':0x0,'rows':[]};var _0x23f5a9=_[_0xa892('0x2d')](db[_0xa892('0x2e')][_0xa892('0x2f')],function(_0x156b19){return{'name':_0x156b19['fieldName'],'type':_0x156b19['type']['key']};});_0xf78c5a[_0xa892('0x30')]=_[_0xa892('0x2d')](_0x23f5a9,_0xa892('0x2c'));_0xf78c5a['query']=_['keys'](_0x2ecd5f['query']);_0xf78c5a[_0xa892('0x31')]=_[_0xa892('0x32')](_0xf78c5a[_0xa892('0x30')],_0xf78c5a[_0xa892('0x33')]);_0x19fbf0[_0xa892('0x34')]=_['intersection'](_0xf78c5a[_0xa892('0x30')],qs[_0xa892('0x35')](_0x2ecd5f[_0xa892('0x33')][_0xa892('0x35')]));_0x19fbf0[_0xa892('0x34')]=_0x19fbf0[_0xa892('0x34')][_0xa892('0x36')]?_0x19fbf0['attributes']:_0xf78c5a[_0xa892('0x30')];if(!_0x2ecd5f[_0xa892('0x33')][_0xa892('0x37')](_0xa892('0x38'))){_0x19fbf0['limit']=qs[_0xa892('0x1f')](_0x2ecd5f[_0xa892('0x33')][_0xa892('0x1f')]);_0x19fbf0[_0xa892('0x1e')]=qs[_0xa892('0x1e')](_0x2ecd5f[_0xa892('0x33')][_0xa892('0x1e')]);}_0x19fbf0['order']=qs[_0xa892('0x39')](_0x2ecd5f[_0xa892('0x33')][_0xa892('0x39')]);_0x19fbf0['where']=qs[_0xa892('0x31')](_[_0xa892('0x3a')](_0x2ecd5f['query'],_0xf78c5a[_0xa892('0x31')]),_0x23f5a9);if(_0x2ecd5f[_0xa892('0x33')][_0xa892('0x3b')]){_0x19fbf0[_0xa892('0x3c')]=_[_0xa892('0x3d')](_0x19fbf0[_0xa892('0x3c')],{'$or':_[_0xa892('0x2d')](_0x23f5a9,function(_0x1cbde9){if(_0x1cbde9[_0xa892('0x3e')]!==_0xa892('0x3f')){var _0x5c9873={};_0x5c9873[_0x1cbde9[_0xa892('0x2c')]]={'$like':'%'+_0x2ecd5f['query'][_0xa892('0x3b')]+'%'};return _0x5c9873;}})});}_0x19fbf0=_[_0xa892('0x3d')]({},_0x19fbf0,_0x2ecd5f[_0xa892('0x40')]);var _0x2d9c9c={'where':_0x19fbf0[_0xa892('0x3c')]};return db[_0xa892('0x2e')][_0xa892('0x41')](_0x2d9c9c)['then'](function(_0x126089){_0x4b5e40[_0xa892('0x41')]=_0x126089;if(_0x2ecd5f[_0xa892('0x33')][_0xa892('0x42')]){_0x19fbf0[_0xa892('0x43')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x19fbf0);})[_0xa892('0x26')](function(_0x4d6511){_0x4b5e40['rows']=_0x4d6511;return _0x4b5e40;})[_0xa892('0x26')](respondWithFilteredResult(_0x599509,_0x19fbf0))[_0xa892('0x44')](handleError(_0x599509,null));};exports[_0xa892('0x45')]=function(_0x541c3c,_0x89b23c){var _0x4dd44f={'raw':!![],'where':{'id':_0x541c3c[_0xa892('0x46')]['id']}},_0x4a7965={};_0x4a7965[_0xa892('0x30')]=_['keys'](db[_0xa892('0x2e')]['rawAttributes']);_0x4a7965[_0xa892('0x33')]=_[_0xa892('0x47')](_0x541c3c['query']);_0x4a7965[_0xa892('0x31')]=_[_0xa892('0x32')](_0x4a7965[_0xa892('0x30')],_0x4a7965[_0xa892('0x33')]);_0x4dd44f[_0xa892('0x34')]=_[_0xa892('0x32')](_0x4a7965[_0xa892('0x30')],qs['fields'](_0x541c3c[_0xa892('0x33')][_0xa892('0x35')]));_0x4dd44f[_0xa892('0x34')]=_0x4dd44f[_0xa892('0x34')][_0xa892('0x36')]?_0x4dd44f[_0xa892('0x34')]:_0x4a7965[_0xa892('0x30')];if(_0x541c3c[_0xa892('0x33')][_0xa892('0x42')]){_0x4dd44f[_0xa892('0x43')]=[{'all':!![]}];}_0x4dd44f=_[_0xa892('0x3d')]({},_0x4dd44f,_0x541c3c[_0xa892('0x40')]);return db[_0xa892('0x2e')]['find'](_0x4dd44f)['then'](handleEntityNotFound(_0x89b23c,null))[_0xa892('0x26')](respondWithResult(_0x89b23c,null))['catch'](handleError(_0x89b23c,null));};exports[_0xa892('0x48')]=function(_0x550d96,_0x303007){return db[_0xa892('0x2e')][_0xa892('0x48')](_0x550d96[_0xa892('0x49')],{})[_0xa892('0x26')](function(_0x7fd582){var _0x163ab0=_0x550d96[_0xa892('0x4a')][_0xa892('0x27')]({'plain':!![]});if(!_0x163ab0)throw new Error(_0xa892('0x4b'));if(_0x163ab0['role']===_0xa892('0x4a')){var _0x2b7058=_0x7fd582[_0xa892('0x27')]({'plain':!![]});var _0x149fc5=_0xa892('0x28');return db[_0xa892('0x4c')][_0xa892('0x4d')]({'where':{'name':_0x149fc5,'userProfileId':_0x163ab0['userProfileId']},'raw':!![]})[_0xa892('0x26')](function(_0x545547){if(_0x545547&&_0x545547['autoAssociation']===0x0){return db[_0xa892('0x4e')][_0xa892('0x48')]({'name':_0x2b7058[_0xa892('0x2c')],'resourceId':_0x2b7058['id'],'type':_0x545547[_0xa892('0x2c')],'sectionId':_0x545547['id']},{})[_0xa892('0x26')](function(){return _0x7fd582;});}else{return _0x7fd582;}})[_0xa892('0x44')](function(_0x4ac33f){logger['error'](_0xa892('0x4f'),_0x4ac33f);throw _0x4ac33f;});}return _0x7fd582;})[_0xa892('0x26')](respondWithResult(_0x303007,0xc9))[_0xa892('0x44')](handleError(_0x303007,null));};exports[_0xa892('0x25')]=function(_0x576e63,_0x69f172){if(_0x576e63['body']['id']){delete _0x576e63[_0xa892('0x49')]['id'];}return db[_0xa892('0x2e')][_0xa892('0x4d')]({'where':{'id':_0x576e63[_0xa892('0x46')]['id']}})[_0xa892('0x26')](handleEntityNotFound(_0x69f172,null))['then'](saveUpdates(_0x576e63[_0xa892('0x49')],null))['then'](respondWithResult(_0x69f172,null))[_0xa892('0x44')](handleError(_0x69f172,null));};exports[_0xa892('0x29')]=function(_0x48bc91,_0x2adf4c){return db[_0xa892('0x2e')]['find']({'where':{'id':_0x48bc91['params']['id']}})[_0xa892('0x26')](handleEntityNotFound(_0x2adf4c,null))[_0xa892('0x26')](removeEntity(_0x2adf4c,null))[_0xa892('0x44')](handleError(_0x2adf4c,null));};exports[_0xa892('0x50')]=function(_0x27abe5,_0x213c36){return db[_0xa892('0x2e')]['describe']()[_0xa892('0x26')](respondWithResult(_0x213c36,null))[_0xa892('0x44')](handleError(_0x213c36,null));};exports[_0xa892('0x51')]=function(_0x1b45cc,_0x2ac9f3,_0x460246){var _0x46ed73={'raw':!![],'where':{}},_0x27acb5={},_0x4296ad;return db['MailQueue'][_0xa892('0x52')]({'where':{'id':_0x1b45cc['params']['id']}})[_0xa892('0x26')](handleEntityNotFound(_0x2ac9f3,null))[_0xa892('0x26')](function(_0x5a5fc1){if(_0x5a5fc1){_0x4296ad=_0x5a5fc1['get']({'plain':!![]});_0x27acb5[_0xa892('0x30')]=_[_0xa892('0x47')](db[_0xa892('0x53')][_0xa892('0x2f')]);_0x27acb5[_0xa892('0x33')]=_[_0xa892('0x47')](_0x1b45cc[_0xa892('0x33')]);_0x27acb5[_0xa892('0x31')]=_[_0xa892('0x32')](_0x27acb5[_0xa892('0x30')],_0x27acb5['query']);_0x46ed73[_0xa892('0x34')]=_[_0xa892('0x32')](_0x27acb5[_0xa892('0x30')],qs[_0xa892('0x35')](_0x1b45cc[_0xa892('0x33')][_0xa892('0x35')]));_0x46ed73['attributes']=_0x46ed73[_0xa892('0x34')][_0xa892('0x36')]?_0x46ed73[_0xa892('0x34')]:_0x27acb5['model'];if(!_0x1b45cc['query'][_0xa892('0x37')](_0xa892('0x38'))){_0x46ed73[_0xa892('0x1f')]=qs[_0xa892('0x1f')](_0x1b45cc[_0xa892('0x33')][_0xa892('0x1f')]);_0x46ed73['offset']=qs[_0xa892('0x1e')](_0x1b45cc[_0xa892('0x33')][_0xa892('0x1e')]);}_0x46ed73[_0xa892('0x54')]=qs[_0xa892('0x39')](_0x1b45cc['query']['sort']);_0x46ed73[_0xa892('0x3c')]=qs[_0xa892('0x31')](_['pick'](_0x1b45cc['query'],_0x27acb5[_0xa892('0x31')]));_0x46ed73[_0xa892('0x3c')][_0xa892('0x55')]=_0x5a5fc1['id'];if(_0x1b45cc[_0xa892('0x33')][_0xa892('0x3b')]){_0x46ed73[_0xa892('0x3c')]=_[_0xa892('0x3d')](_0x46ed73['where'],{'$or':_[_0xa892('0x2d')](_0x46ed73[_0xa892('0x34')],function(_0x1f5ef9){var _0x5f017d={};_0x5f017d[_0x1f5ef9]={'$like':'%'+_0x1b45cc['query'][_0xa892('0x3b')]+'%'};return _0x5f017d;})});}_0x46ed73=_[_0xa892('0x3d')]({},_0x46ed73,_0x1b45cc['options']);return db[_0xa892('0x53')]['findAll'](_0x46ed73);}})[_0xa892('0x26')](function(_0x206a3d){if(_0x206a3d){return db['User'][_0xa892('0x56')]({'where':{'id':_[_0xa892('0x2d')](_0x206a3d,'UserId'),'role':'agent'},'attributes':['id',_0xa892('0x2c'),'mailPause',_0xa892('0x57'),_0xa892('0x58')]});}})[_0xa892('0x26')](function(_0x2d5fb8){if(_0x2d5fb8){return{'count':_0x2d5fb8[_0xa892('0x41')],'rows':_[_0xa892('0x2d')](_0x2d5fb8[_0xa892('0x59')],function(_0x4c2f58){return{'membername':_0x4c2f58[_0xa892('0x2c')],'UserId':_0x4c2f58['id'],'queue_name':_0x4296ad[_0xa892('0x2c')],'MailQueueId':_0x4296ad['id'],'interface':util[_0xa892('0x5a')](_0xa892('0x5b'),_0xa892('0x5c'),_0x4c2f58[_0xa892('0x2c')]),'penalty':0x0,'paused':_0x4c2f58[_0xa892('0x5d')],'createdAt':_0x4c2f58[_0xa892('0x58')],'updatedAt':_0x4c2f58[_0xa892('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa892('0x26')](respondWithFilteredResult(_0x2ac9f3,_0x46ed73))[_0xa892('0x44')](handleError(_0x2ac9f3,null));};exports[_0xa892('0x5e')]=function(_0x159223,_0x8d29d4,_0x541f89){var _0x3aaa33={};var _0x1040cb={};var _0x1b06c4;var _0x3d2384;return db['MailQueue'][_0xa892('0x52')]({'where':{'id':_0x159223['params']['id']}})[_0xa892('0x26')](handleEntityNotFound(_0x8d29d4,null))[_0xa892('0x26')](function(_0x46c3fa){if(_0x46c3fa){_0x1b06c4=_0x46c3fa;_0x1040cb['model']=_[_0xa892('0x47')](db[_0xa892('0x5f')][_0xa892('0x2f')]);_0x1040cb[_0xa892('0x33')]=_[_0xa892('0x47')](_0x159223[_0xa892('0x33')]);_0x1040cb['filters']=_[_0xa892('0x32')](_0x1040cb[_0xa892('0x30')],_0x1040cb['query']);_0x3aaa33[_0xa892('0x34')]=_[_0xa892('0x32')](_0x1040cb['model'],qs[_0xa892('0x35')](_0x159223[_0xa892('0x33')]['fields']));_0x3aaa33[_0xa892('0x34')]=_0x3aaa33['attributes']['length']?_0x3aaa33[_0xa892('0x34')]:_0x1040cb[_0xa892('0x30')];_0x3aaa33[_0xa892('0x54')]=qs[_0xa892('0x39')](_0x159223[_0xa892('0x33')]['sort']);_0x3aaa33[_0xa892('0x3c')]=qs[_0xa892('0x31')](_['pick'](_0x159223[_0xa892('0x33')],_0x1040cb['filters']));if(_0x159223[_0xa892('0x33')]['filter']){_0x3aaa33['where']=_[_0xa892('0x3d')](_0x3aaa33['where'],{'$or':_['map'](_0x3aaa33[_0xa892('0x34')],function(_0xe8d551){var _0x31cbb9={};_0x31cbb9[_0xe8d551]={'$like':'%'+_0x159223[_0xa892('0x33')]['filter']+'%'};return _0x31cbb9;})});}_0x3aaa33=_['merge']({},_0x3aaa33,_0x159223['options']);return _0x1b06c4[_0xa892('0x5e')](_0x3aaa33);}})[_0xa892('0x26')](function(_0x189612){if(_0x189612){_0x3d2384=_0x189612[_0xa892('0x36')];if(!_0x159223[_0xa892('0x33')][_0xa892('0x37')](_0xa892('0x38'))){_0x3aaa33[_0xa892('0x1f')]=qs['limit'](_0x159223[_0xa892('0x33')][_0xa892('0x1f')]);_0x3aaa33[_0xa892('0x1e')]=qs[_0xa892('0x1e')](_0x159223[_0xa892('0x33')][_0xa892('0x1e')]);}return _0x1b06c4['getTeams'](_0x3aaa33);}})['then'](function(_0x590025){if(_0x590025){return _0x590025?{'count':_0x3d2384,'rows':_0x590025}:null;}})[_0xa892('0x26')](respondWithResult(_0x8d29d4,null))[_0xa892('0x44')](handleError(_0x8d29d4,null));};exports['addTeams']=function(_0x45b33b,_0x48f0ad,_0x5a8ca0){var _0x412824=_0x45b33b[_0xa892('0x49')][_0xa892('0x60')];return db[_0xa892('0x5f')][_0xa892('0x61')]({'where':{'id':_0x412824},'attributes':['id'],'include':[{'model':db[_0xa892('0x62')],'as':_0xa892('0x63'),'attributes':['id',_0xa892('0x2c'),'online',_0xa892('0x64'),_0xa892('0x65')],'raw':!![]}]})[_0xa892('0x26')](function(_0x343159){if(_0x343159){var _0x47ab7a=_[_0xa892('0x66')](_0x343159,function(_0x2627ca){var _0x54a21c=_0x2627ca[_0xa892('0x27')]({'plain':!![]});return _0x54a21c[_0xa892('0x63')];});return db['MailQueue'][_0xa892('0x4d')]({'where':{'id':_0x45b33b[_0xa892('0x46')]['id']}})[_0xa892('0x26')](function(_0x98f48c){return db['sequelize'][_0xa892('0x67')](function(_0x466c93){return _0x98f48c[_0xa892('0x68')](_0x412824,{'transaction':_0x466c93})[_0xa892('0x26')](function(){return BPromise[_0xa892('0x69')](_0x47ab7a,function(_0x1af6c0){return db[_0xa892('0x53')][_0xa892('0x6a')]({'where':{'UserId':_0x1af6c0['id'],'MailQueueId':_0x45b33b[_0xa892('0x46')]['id']},'transaction':_0x466c93});});})[_0xa892('0x26')](function(){_0x47ab7a[_0xa892('0x6b')](function(_0xfb691d){socket['emit'](_0xa892('0x6c'),{'UserId':_0xfb691d['id'],'MailQueueId':_0x98f48c['id']});});});});});}})['then'](respondWithStatusCode(_0x48f0ad,null))[_0xa892('0x44')](handleError(_0x48f0ad,null));};exports[_0xa892('0x6d')]=function(_0x3ae352,_0x49beb5,_0x9b4b9d){return db[_0xa892('0x5f')][_0xa892('0x61')]({'where':{'id':_0x3ae352[_0xa892('0x33')][_0xa892('0x60')]},'attributes':['id'],'include':[{'model':db[_0xa892('0x62')],'as':_0xa892('0x63'),'attributes':['id'],'raw':!![]}]})[_0xa892('0x26')](handleEntityNotFound(_0x49beb5,null))[_0xa892('0x26')](function(_0xb45c11){var _0x308db4=_[_0xa892('0x2d')](_0xb45c11,'id');var _0x168527=[];var _0x3357ee=[];var _0x3b16ef=squel[_0xa892('0x6e')]();_0x3b16ef['field'](_0xa892('0x6f'))['from'](_0xa892('0x70'),'tq')[_0xa892('0x71')](_0xa892('0x72'),'ut',_0xa892('0x73'))[_0xa892('0x3c')]('MailQueueId\x20=\x20?',_0x3ae352[_0xa892('0x46')]['id']);for(var _0xcd139=0x0;_0xcd139<_0xb45c11[_0xa892('0x36')];_0xcd139+=0x1){let _0x4909ca=_0xb45c11[_0xcd139];for(var _0x5b0f68=0x0;_0x5b0f68<_0x4909ca[_0xa892('0x63')][_0xa892('0x36')];_0x5b0f68+=0x1){let _0x892ee3=_0x4909ca[_0xa892('0x63')][_0x5b0f68];var _0x70a1d6=_0x3b16ef['clone']();_0x70a1d6[_0xa892('0x3c')]('ut.UserId\x20=\x20?',_0x892ee3['id']);_0x3357ee[_0xa892('0x74')](db[_0xa892('0x75')]['query'](_0x70a1d6[_0xa892('0x76')](),{'type':db['sequelize']['QueryTypes'][_0xa892('0x77')]})[_0xa892('0x26')](function(_0x1ddc52){if(_0x1ddc52[_0xa892('0x36')]===0x1){return _0x892ee3['id'];}else{var _0x2e0a42=_[_0xa892('0x78')](_[_0xa892('0x2d')](_0x1ddc52,_0xa892('0x79')),function(_0x41b704){return _[_0xa892('0x7a')](_0x308db4,_0x41b704);});if(_0x2e0a42){return _0x892ee3['id'];}}}));}}return BPromise[_0xa892('0x7b')](_0x3357ee)[_0xa892('0x26')](function(_0x186d0b){_0x168527=_(_0x168527)[_0xa892('0x7c')](_0x186d0b)['compact']()[_0xa892('0x7d')]();return db[_0xa892('0x2e')][_0xa892('0x4d')]({'where':{'id':_0x3ae352[_0xa892('0x46')]['id']}})[_0xa892('0x26')](function(_0x49ec71){return db[_0xa892('0x75')][_0xa892('0x67')](function(_0xfab168){return _0x49ec71[_0xa892('0x6d')](_0x3ae352['query']['ids'],{'transaction':_0xfab168})[_0xa892('0x26')](function(){if(!_['isEmpty'](_0x168527)){return _0x49ec71[_0xa892('0x7e')](_0x168527,{'transaction':_0xfab168});}})[_0xa892('0x26')](function(){_0x168527[_0xa892('0x6b')](function(_0x4d5c2f){socket[_0xa892('0x7f')]('userMailQueue:remove',{'UserId':_0x4d5c2f,'MailQueueId':_0x49ec71['id']});});});});});});})[_0xa892('0x26')](respondWithStatusCode(_0x49beb5,null))['catch'](handleError(_0x49beb5,null));};exports[_0xa892('0x80')]=function(_0x456b18,_0x161ce6,_0x3098bd){return db[_0xa892('0x2e')]['find']({'where':{'id':_0x456b18['params']['id']}})['then'](handleEntityNotFound(_0x161ce6,null))[_0xa892('0x26')](function(_0x272b5b){if(_0x272b5b){return _0x272b5b[_0xa892('0x80')](_0x456b18[_0xa892('0x49')]['ids'],_['omit'](_0x456b18[_0xa892('0x49')],['ids','id'])||{})[_0xa892('0x81')](function(_0x17f512){for(var _0x37e58d=0x0;_0x37e58d<_0x456b18[_0xa892('0x49')]['ids'][_0xa892('0x36')];_0x37e58d+=0x1){socket[_0xa892('0x7f')](_0xa892('0x6c'),{'UserId':_0x456b18['body'][_0xa892('0x60')][_0x37e58d],'MailQueueId':_0x456b18[_0xa892('0x46')]['id']});}return _0x17f512;});}})[_0xa892('0x26')](respondWithResult(_0x161ce6,null))[_0xa892('0x44')](handleError(_0x161ce6,null));};exports[_0xa892('0x7e')]=function(_0xd783f0,_0x139c75,_0x21c835){return db[_0xa892('0x2e')][_0xa892('0x4d')]({'where':{'id':_0xd783f0[_0xa892('0x46')]['id']}})['then'](handleEntityNotFound(_0x139c75,null))[_0xa892('0x26')](function(_0x3b4f37){if(_0x3b4f37){return _0x3b4f37[_0xa892('0x7e')](_0xd783f0[_0xa892('0x33')][_0xa892('0x60')])[_0xa892('0x26')](function(){if(_[_0xa892('0x82')](_0xd783f0[_0xa892('0x33')][_0xa892('0x60')])){for(var _0x566989=0x0;_0x566989<_0xd783f0[_0xa892('0x33')][_0xa892('0x60')][_0xa892('0x36')];_0x566989+=0x1){socket[_0xa892('0x7f')](_0xa892('0x83'),{'UserId':Number(_0xd783f0['query'][_0xa892('0x60')][_0x566989]),'MailQueueId':Number(_0xd783f0[_0xa892('0x46')]['id'])});}}else{socket[_0xa892('0x7f')](_0xa892('0x83'),{'UserId':Number(_0xd783f0[_0xa892('0x33')][_0xa892('0x60')]),'MailQueueId':Number(_0xd783f0[_0xa892('0x46')]['id'])});}});}})[_0xa892('0x26')](respondWithStatusCode(_0x139c75,null))[_0xa892('0x44')](handleError(_0x139c75,null));};exports['getAgents']=function(_0x50a1b1,_0x44f8e2,_0x246400){var _0x5c1f4f={};var _0x1fb77c={};var _0x5ec71b;var _0xd1c28a;return db[_0xa892('0x2e')][_0xa892('0x52')]({'where':{'id':_0x50a1b1[_0xa892('0x46')]['id']}})['then'](handleEntityNotFound(_0x44f8e2,null))['then'](function(_0x27320b){if(_0x27320b){_0x5ec71b=_0x27320b;_0x1fb77c[_0xa892('0x30')]=_[_0xa892('0x47')](db[_0xa892('0x62')][_0xa892('0x2f')]);_0x1fb77c[_0xa892('0x33')]=_['keys'](_0x50a1b1['query']);_0x1fb77c[_0xa892('0x31')]=_[_0xa892('0x32')](_0x1fb77c[_0xa892('0x30')],_0x1fb77c[_0xa892('0x33')]);_0x5c1f4f[_0xa892('0x34')]=_[_0xa892('0x32')](_0x1fb77c[_0xa892('0x30')],qs['fields'](_0x50a1b1[_0xa892('0x33')][_0xa892('0x35')]));_0x5c1f4f[_0xa892('0x34')]=_0x5c1f4f[_0xa892('0x34')]['length']?_0x5c1f4f[_0xa892('0x34')]:_0x1fb77c[_0xa892('0x30')];_0x5c1f4f[_0xa892('0x54')]=qs[_0xa892('0x39')](_0x50a1b1['query'][_0xa892('0x39')]);_0x5c1f4f[_0xa892('0x3c')]=qs[_0xa892('0x31')](_[_0xa892('0x3a')](_0x50a1b1['query'],_0x1fb77c['filters']));if(_0x50a1b1['query']['filter']){_0x5c1f4f['where']=_[_0xa892('0x3d')](_0x5c1f4f[_0xa892('0x3c')],{'$or':_[_0xa892('0x2d')](_0x5c1f4f[_0xa892('0x34')],function(_0x221ab1){var _0x480569={};_0x480569[_0x221ab1]={'$like':'%'+_0x50a1b1[_0xa892('0x33')][_0xa892('0x3b')]+'%'};return _0x480569;})});}_0x5c1f4f=_[_0xa892('0x3d')]({},_0x5c1f4f,_0x50a1b1[_0xa892('0x40')]);return _0x5ec71b[_0xa892('0x84')](_0x5c1f4f);}})[_0xa892('0x26')](function(_0xac9714){if(_0xac9714){_0xd1c28a=_0xac9714[_0xa892('0x36')];if(!_0x50a1b1[_0xa892('0x33')]['hasOwnProperty'](_0xa892('0x38'))){_0x5c1f4f[_0xa892('0x1f')]=qs[_0xa892('0x1f')](_0x50a1b1['query']['limit']);_0x5c1f4f['offset']=qs['offset'](_0x50a1b1[_0xa892('0x33')][_0xa892('0x1e')]);}return _0x5ec71b[_0xa892('0x84')](_0x5c1f4f);}})[_0xa892('0x26')](function(_0x5cc638){if(_0x5cc638){return _0x5cc638?{'count':_0xd1c28a,'rows':_0x5cc638}:null;}})[_0xa892('0x26')](respondWithResult(_0x44f8e2,null))[_0xa892('0x44')](handleError(_0x44f8e2,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index e3d5e18..cd9c77c 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 _0xae64=['events','setMaxListeners','save','update','remove','hasOwnProperty','exports'];(function(_0xe266af,_0x4388b0){var _0x9f775d=function(_0x5ce7bb){while(--_0x5ce7bb){_0xe266af['push'](_0xe266af['shift']());}};_0x9f775d(++_0x4388b0);}(_0xae64,0x149));var _0x4ae6=function(_0x4a1353,_0x2fbe86){_0x4a1353=_0x4a1353-0x0;var _0x3805cc=_0xae64[_0x4a1353];return _0x3805cc;};'use strict';var EventEmitter=require(_0x4ae6('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4ae6('0x1')](0x0);var events={'afterCreate':_0x4ae6('0x2'),'afterUpdate':_0x4ae6('0x3'),'afterDestroy':_0x4ae6('0x4')};function emitEvent(_0x5f54e9){return function(_0x50374c,_0x4bcc95,_0x57b9e8){MailQueueEvents['emit'](_0x5f54e9+':'+_0x50374c['id'],_0x50374c);MailQueueEvents['emit'](_0x5f54e9,_0x50374c);_0x57b9e8(null);};}for(var e in events){if(events[_0x4ae6('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x4ae6('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x2eeb=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0x2eeb,0x96));var _0xb2ee=function(_0x2568b3,_0x1b598b){_0x2568b3=_0x2568b3-0x0;var _0x1918aa=_0x2eeb[_0x2568b3];return _0x1918aa;};'use strict';var EventEmitter=require(_0xb2ee('0x0'));var MailQueue=require(_0xb2ee('0x1'))['db'][_0xb2ee('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb2ee('0x3')](0x0);var events={'afterCreate':_0xb2ee('0x4'),'afterUpdate':_0xb2ee('0x5'),'afterDestroy':_0xb2ee('0x6')};function emitEvent(_0x2670ba){return function(_0x575d6a,_0x3cf0c3,_0x53113b){MailQueueEvents[_0xb2ee('0x7')](_0x2670ba+':'+_0x575d6a['id'],_0x575d6a);MailQueueEvents[_0xb2ee('0x7')](_0x2670ba,_0x575d6a);_0x53113b(null);};}for(var e in events){if(events[_0xb2ee('0x8')](e)){var event=events[e];MailQueue[_0xb2ee('0x9')](e,emitEvent(event));}}module[_0xb2ee('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 3ff0d93..157a2a5 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 _0xc1a6=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','mail_queues','lodash','util','api','moment'];(function(_0x427ea5,_0x33b039){var _0xa3c8b7=function(_0x596870){while(--_0x596870){_0x427ea5['push'](_0x427ea5['shift']());}};_0xa3c8b7(++_0x33b039);}(_0xc1a6,0x80));var _0x6c1a=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xc1a6[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x6c1a('0x0'));var util=require(_0x6c1a('0x1'));var logger=require('../../config/logger')(_0x6c1a('0x2'));var moment=require(_0x6c1a('0x3'));var BPromise=require(_0x6c1a('0x4'));var rp=require(_0x6c1a('0x5'));var fs=require('fs');var path=require(_0x6c1a('0x6'));var rimraf=require(_0x6c1a('0x7'));var config=require(_0x6c1a('0x8'));var attributes=require(_0x6c1a('0x9'));module[_0x6c1a('0xa')]=function(_0x2dfab8,_0xc7b989){return _0x2dfab8['define']('MailQueue',attributes,{'tableName':_0x6c1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaad2=['../../config/environment','./mailQueue.attributes','define','MailQueue','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x228cc2,_0x258735){var _0x3b1c56=function(_0x1407d5){while(--_0x1407d5){_0x228cc2['push'](_0x228cc2['shift']());}};_0x3b1c56(++_0x258735);}(_0xaad2,0x1a6));var _0x2aad=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0xaad2[_0x187718];return _0x29ddf4;};'use strict';var _=require('lodash');var util=require(_0x2aad('0x0'));var logger=require(_0x2aad('0x1'))(_0x2aad('0x2'));var moment=require(_0x2aad('0x3'));var BPromise=require('bluebird');var rp=require(_0x2aad('0x4'));var fs=require('fs');var path=require(_0x2aad('0x5'));var rimraf=require(_0x2aad('0x6'));var config=require(_0x2aad('0x7'));var attributes=require(_0x2aad('0x8'));module['exports']=function(_0x3d569a,_0x46b05d){return _0x3d569a[_0x2aad('0x9')](_0x2aad('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 3f36cba..3bb8c28 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 _0x4967=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailQueue','MailQueue','findAll','options','raw','limit','include','model','map','attributes','ShowMailQueue','find','where','util','moment','bluebird','randomstring'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x4967,0x11b));var _0x7496=function(_0x52598d,_0x10fb73){_0x52598d=_0x52598d-0x0;var _0x170309=_0x4967[_0x52598d];return _0x170309;};'use strict';var _=require('lodash');var util=require(_0x7496('0x0'));var moment=require(_0x7496('0x1'));var BPromise=require(_0x7496('0x2'));var rs=require(_0x7496('0x3'));var fs=require('fs');var Redis=require(_0x7496('0x4'));var db=require(_0x7496('0x5'))['db'];var utils=require(_0x7496('0x6'));var logger=require(_0x7496('0x7'))(_0x7496('0x8'));var config=require(_0x7496('0x9'));var jayson=require(_0x7496('0xa'));var client=jayson['client'][_0x7496('0xb')]({'port':0x232a});config[_0x7496('0xc')]=_[_0x7496('0xd')](config['redis'],{'host':_0x7496('0xe'),'port':0x18eb});var socket=require(_0x7496('0xf'))(new Redis(config[_0x7496('0xc')]));require(_0x7496('0x10'))['register'](socket);function respondWithRpcPromise(_0xe6c790,_0x530e6c,_0x461a4f){return new BPromise(function(_0x4ca54a,_0x37b185){return client[_0x7496('0x11')](_0xe6c790,_0x461a4f)[_0x7496('0x12')](function(_0x3a55ee){logger[_0x7496('0x13')](_0x7496('0x14'),_0x530e6c,_0x7496('0x15'));logger[_0x7496('0x16')](_0x7496('0x17'),_0x530e6c,_0x7496('0x15'),JSON[_0x7496('0x18')](_0x3a55ee));if(_0x3a55ee[_0x7496('0x19')]){if(_0x3a55ee[_0x7496('0x19')]['code']===0x1f4){logger[_0x7496('0x19')](_0x7496('0x14'),_0x530e6c,_0x3a55ee[_0x7496('0x19')][_0x7496('0x1a')]);return _0x37b185(_0x3a55ee['error'][_0x7496('0x1a')]);}logger['error'](_0x7496('0x14'),_0x530e6c,_0x3a55ee['error']['message']);return _0x4ca54a(_0x3a55ee['error'][_0x7496('0x1a')]);}else{logger[_0x7496('0x13')](_0x7496('0x14'),_0x530e6c,'request\x20sent');_0x4ca54a(_0x3a55ee['result'][_0x7496('0x1a')]);}})[_0x7496('0x1b')](function(_0x2db3a8){logger[_0x7496('0x19')](_0x7496('0x14'),_0x530e6c,_0x2db3a8);_0x37b185(_0x2db3a8);});});}exports[_0x7496('0x1c')]=function(_0x3c3860){var _0x23f943=this;return new Promise(function(_0x3ace2d,_0x27d350){return db[_0x7496('0x1d')][_0x7496('0x1e')]({'raw':_0x3c3860[_0x7496('0x1f')]?_0x3c3860['options'][_0x7496('0x20')]===undefined?!![]:![]:!![],'where':_0x3c3860[_0x7496('0x1f')]?_0x3c3860[_0x7496('0x1f')]['where']||null:null,'attributes':_0x3c3860['options']?_0x3c3860['options']['attributes']||null:null,'limit':_0x3c3860['options']?_0x3c3860[_0x7496('0x1f')][_0x7496('0x21')]||null:null,'include':_0x3c3860[_0x7496('0x1f')]?_0x3c3860['options'][_0x7496('0x22')]?_['map'](_0x3c3860[_0x7496('0x1f')][_0x7496('0x22')],function(_0x7cbade){return{'model':db[_0x7cbade[_0x7496('0x23')]],'as':_0x7cbade['as'],'attributes':_0x7cbade['attributes'],'include':_0x7cbade[_0x7496('0x22')]?_[_0x7496('0x24')](_0x7cbade[_0x7496('0x22')],function(_0xc3e5a0){return{'model':db[_0xc3e5a0[_0x7496('0x23')]],'as':_0xc3e5a0['as'],'attributes':_0xc3e5a0['attributes'],'include':_0xc3e5a0['include']?_[_0x7496('0x24')](_0xc3e5a0[_0x7496('0x22')],function(_0x13bf44){return{'model':db[_0x13bf44[_0x7496('0x23')]],'as':_0x13bf44['as'],'attributes':_0x13bf44[_0x7496('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7496('0x12')](function(_0x5ab814){logger[_0x7496('0x13')](_0x7496('0x1c'),_0x3c3860);logger['debug'](_0x7496('0x1c'),_0x3c3860,JSON[_0x7496('0x18')](_0x5ab814));_0x3ace2d(_0x5ab814);})['catch'](function(_0x4627d9){logger['error'](_0x7496('0x1c'),_0x4627d9[_0x7496('0x1a')],_0x3c3860);_0x27d350(_0x23f943['error'](0x1f4,_0x4627d9[_0x7496('0x1a')]));});});};exports[_0x7496('0x26')]=function(_0xee05da){var _0x37eb1d=this;return new Promise(function(_0x2ae579,_0x8f67f2){return db[_0x7496('0x1d')][_0x7496('0x27')]({'raw':_0xee05da['options']?_0xee05da[_0x7496('0x1f')][_0x7496('0x20')]===undefined?!![]:![]:!![],'where':_0xee05da['options']?_0xee05da[_0x7496('0x1f')][_0x7496('0x28')]||null:null,'attributes':_0xee05da[_0x7496('0x1f')]?_0xee05da[_0x7496('0x1f')][_0x7496('0x25')]||null:null,'include':_0xee05da['options']?_0xee05da[_0x7496('0x1f')][_0x7496('0x22')]?_[_0x7496('0x24')](_0xee05da['options']['include'],function(_0x15a147){return{'model':db[_0x15a147[_0x7496('0x23')]],'as':_0x15a147['as'],'attributes':_0x15a147['attributes'],'include':_0x15a147[_0x7496('0x22')]?_[_0x7496('0x24')](_0x15a147[_0x7496('0x22')],function(_0x4bbaf2){return{'model':db[_0x4bbaf2['model']],'as':_0x4bbaf2['as'],'attributes':_0x4bbaf2[_0x7496('0x25')],'include':_0x4bbaf2[_0x7496('0x22')]?_[_0x7496('0x24')](_0x4bbaf2['include'],function(_0x1a5e65){return{'model':db[_0x1a5e65[_0x7496('0x23')]],'as':_0x1a5e65['as'],'attributes':_0x1a5e65[_0x7496('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7496('0x12')](function(_0x4a7504){logger['info']('ShowMailQueue',_0xee05da);logger['debug'](_0x7496('0x26'),_0xee05da,JSON[_0x7496('0x18')](_0x4a7504));_0x2ae579(_0x4a7504);})[_0x7496('0x1b')](function(_0x2edc70){logger[_0x7496('0x19')](_0x7496('0x26'),_0x2edc70[_0x7496('0x1a')],_0xee05da);_0x8f67f2(_0x37eb1d[_0x7496('0x19')](0x1f4,_0x2edc70[_0x7496('0x1a')]));});});}; \ No newline at end of file +var _0xf4c6=['then','debug','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','model','map'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xf4c6,0x1b2));var _0x6f4c=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0xf4c6[_0x28b0a4];return _0x105ce6;};'use strict';var _=require(_0x6f4c('0x0'));var util=require(_0x6f4c('0x1'));var moment=require(_0x6f4c('0x2'));var BPromise=require(_0x6f4c('0x3'));var rs=require(_0x6f4c('0x4'));var fs=require('fs');var Redis=require(_0x6f4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f4c('0x6'));var logger=require(_0x6f4c('0x7'))(_0x6f4c('0x8'));var config=require(_0x6f4c('0x9'));var jayson=require(_0x6f4c('0xa'));var client=jayson[_0x6f4c('0xb')]['http']({'port':0x232a});config['redis']=_[_0x6f4c('0xc')](config['redis'],{'host':_0x6f4c('0xd'),'port':0x18eb});var socket=require(_0x6f4c('0xe'))(new Redis(config[_0x6f4c('0xf')]));require(_0x6f4c('0x10'))[_0x6f4c('0x11')](socket);function respondWithRpcPromise(_0x4cb5cf,_0x8a71f8,_0x223f9a){return new BPromise(function(_0x2bbd10,_0x47c9a3){return client[_0x6f4c('0x12')](_0x4cb5cf,_0x223f9a)['then'](function(_0x5ade13){logger[_0x6f4c('0x13')](_0x6f4c('0x14'),_0x8a71f8,'request\x20sent');logger['debug'](_0x6f4c('0x15'),_0x8a71f8,_0x6f4c('0x16'),JSON[_0x6f4c('0x17')](_0x5ade13));if(_0x5ade13[_0x6f4c('0x18')]){if(_0x5ade13[_0x6f4c('0x18')][_0x6f4c('0x19')]===0x1f4){logger[_0x6f4c('0x18')](_0x6f4c('0x14'),_0x8a71f8,_0x5ade13[_0x6f4c('0x18')][_0x6f4c('0x1a')]);return _0x47c9a3(_0x5ade13[_0x6f4c('0x18')]['message']);}logger['error'](_0x6f4c('0x14'),_0x8a71f8,_0x5ade13[_0x6f4c('0x18')][_0x6f4c('0x1a')]);return _0x2bbd10(_0x5ade13[_0x6f4c('0x18')][_0x6f4c('0x1a')]);}else{logger[_0x6f4c('0x13')](_0x6f4c('0x14'),_0x8a71f8,_0x6f4c('0x16'));_0x2bbd10(_0x5ade13[_0x6f4c('0x1b')]['message']);}})[_0x6f4c('0x1c')](function(_0x3fdb34){logger['error'](_0x6f4c('0x14'),_0x8a71f8,_0x3fdb34);_0x47c9a3(_0x3fdb34);});});}exports[_0x6f4c('0x1d')]=function(_0x2e229a){var _0x1b076e=this;return new Promise(function(_0x3c4388,_0x2ca5d0){return db[_0x6f4c('0x1e')]['findAll']({'raw':_0x2e229a[_0x6f4c('0x1f')]?_0x2e229a[_0x6f4c('0x1f')][_0x6f4c('0x20')]===undefined?!![]:![]:!![],'where':_0x2e229a['options']?_0x2e229a[_0x6f4c('0x1f')][_0x6f4c('0x21')]||null:null,'attributes':_0x2e229a[_0x6f4c('0x1f')]?_0x2e229a[_0x6f4c('0x1f')][_0x6f4c('0x22')]||null:null,'limit':_0x2e229a[_0x6f4c('0x1f')]?_0x2e229a[_0x6f4c('0x1f')][_0x6f4c('0x23')]||null:null,'include':_0x2e229a[_0x6f4c('0x1f')]?_0x2e229a[_0x6f4c('0x1f')][_0x6f4c('0x24')]?_['map'](_0x2e229a[_0x6f4c('0x1f')][_0x6f4c('0x24')],function(_0x1c9fd7){return{'model':db[_0x1c9fd7[_0x6f4c('0x25')]],'as':_0x1c9fd7['as'],'attributes':_0x1c9fd7[_0x6f4c('0x22')],'include':_0x1c9fd7['include']?_[_0x6f4c('0x26')](_0x1c9fd7[_0x6f4c('0x24')],function(_0x659de0){return{'model':db[_0x659de0['model']],'as':_0x659de0['as'],'attributes':_0x659de0['attributes'],'include':_0x659de0[_0x6f4c('0x24')]?_[_0x6f4c('0x26')](_0x659de0[_0x6f4c('0x24')],function(_0x5e3097){return{'model':db[_0x5e3097['model']],'as':_0x5e3097['as'],'attributes':_0x5e3097[_0x6f4c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6f4c('0x27')](function(_0x44b4fd){logger['info'](_0x6f4c('0x1d'),_0x2e229a);logger[_0x6f4c('0x28')]('GetMailQueue',_0x2e229a,JSON[_0x6f4c('0x17')](_0x44b4fd));_0x3c4388(_0x44b4fd);})[_0x6f4c('0x1c')](function(_0x11bec6){logger[_0x6f4c('0x18')](_0x6f4c('0x1d'),_0x11bec6[_0x6f4c('0x1a')],_0x2e229a);_0x2ca5d0(_0x1b076e['error'](0x1f4,_0x11bec6['message']));});});};exports['ShowMailQueue']=function(_0x37843e){var _0x4fc70c=this;return new Promise(function(_0x484f23,_0x7f0f99){return db[_0x6f4c('0x1e')][_0x6f4c('0x29')]({'raw':_0x37843e[_0x6f4c('0x1f')]?_0x37843e[_0x6f4c('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x37843e[_0x6f4c('0x1f')]?_0x37843e[_0x6f4c('0x1f')][_0x6f4c('0x21')]||null:null,'attributes':_0x37843e[_0x6f4c('0x1f')]?_0x37843e[_0x6f4c('0x1f')][_0x6f4c('0x22')]||null:null,'include':_0x37843e['options']?_0x37843e[_0x6f4c('0x1f')][_0x6f4c('0x24')]?_[_0x6f4c('0x26')](_0x37843e['options'][_0x6f4c('0x24')],function(_0x4324db){return{'model':db[_0x4324db[_0x6f4c('0x25')]],'as':_0x4324db['as'],'attributes':_0x4324db[_0x6f4c('0x22')],'include':_0x4324db[_0x6f4c('0x24')]?_['map'](_0x4324db['include'],function(_0x229e7d){return{'model':db[_0x229e7d[_0x6f4c('0x25')]],'as':_0x229e7d['as'],'attributes':_0x229e7d['attributes'],'include':_0x229e7d[_0x6f4c('0x24')]?_[_0x6f4c('0x26')](_0x229e7d['include'],function(_0x5cf511){return{'model':db[_0x5cf511[_0x6f4c('0x25')]],'as':_0x5cf511['as'],'attributes':_0x5cf511[_0x6f4c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6f4c('0x27')](function(_0x31ff10){logger[_0x6f4c('0x13')](_0x6f4c('0x2a'),_0x37843e);logger[_0x6f4c('0x28')]('ShowMailQueue',_0x37843e,JSON[_0x6f4c('0x17')](_0x31ff10));_0x484f23(_0x31ff10);})[_0x6f4c('0x1c')](function(_0x380057){logger['error'](_0x6f4c('0x2a'),_0x380057[_0x6f4c('0x1a')],_0x37843e);_0x7f0f99(_0x4fc70c[_0x6f4c('0x18')](0x1f4,_0x380057[_0x6f4c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 5de45eb..95f9ea9 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 _0x1de6=['length','save','remove','emit','removeListener'];(function(_0x2b7076,_0x4887e6){var _0x1af53b=function(_0x2632bb){while(--_0x2632bb){_0x2b7076['push'](_0x2b7076['shift']());}};_0x1af53b(++_0x4887e6);}(_0x1de6,0x105));var _0x61de=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0x1de6[_0x43b08];return _0x5e05f4;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x61de('0x0'),_0x61de('0x1'),'update'];function createListener(_0x4237dd,_0x13a0be){return function(_0x57965e){_0x13a0be[_0x61de('0x2')](_0x4237dd,_0x57965e);};}function removeListener(_0x1b7488,_0x2ac687){return function(){MailQueueEvents[_0x61de('0x3')](_0x1b7488,_0x2ac687);};}exports['register']=function(_0x559306){for(var _0x37f07e=0x0,_0x29ff10=events[_0x61de('0x4')];_0x37f07e<_0x29ff10;_0x37f07e++){var _0x5da6af=events[_0x37f07e];var _0x19408e=createListener('mailQueue:'+_0x5da6af,_0x559306);MailQueueEvents['on'](_0x5da6af,_0x19408e);}}; \ No newline at end of file +var _0xe79c=['emit','removeListener','register','length','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe79c,0x172));var _0xce79=function(_0x1d847e,_0x49f32f){_0x1d847e=_0x1d847e-0x0;var _0x353bea=_0xe79c[_0x1d847e];return _0x353bea;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xce79('0x0'),'remove',_0xce79('0x1')];function createListener(_0x335d12,_0x181380){return function(_0x5020e6){_0x181380[_0xce79('0x2')](_0x335d12,_0x5020e6);};}function removeListener(_0x35f978,_0xf03a2d){return function(){MailQueueEvents[_0xce79('0x3')](_0x35f978,_0xf03a2d);};}exports[_0xce79('0x4')]=function(_0xade333){for(var _0x25cd84=0x0,_0x49a8fb=events[_0xce79('0x5')];_0x25cd84<_0x49a8fb;_0x25cd84++){var _0x56fd80=events[_0x25cd84];var _0x1ff25c=createListener('mailQueue:'+_0x56fd80,_0xade333);MailQueueEvents['on'](_0x56fd80,_0x1ff25c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 36ec0eb..6a9c3d2 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 _0xa1db=['multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','isAuthenticated','describe','get','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x40c5a5,_0x34dcd3){var _0x17396a=function(_0x143304){while(--_0x143304){_0x40c5a5['push'](_0x40c5a5['shift']());}};_0x17396a(++_0x34dcd3);}(_0xa1db,0x1b5));var _0xba1d=function(_0x16d644,_0x46545e){_0x16d644=_0x16d644-0x0;var _0xf808cc=_0xa1db[_0x16d644];return _0xf808cc;};'use strict';var multer=require(_0xba1d('0x0'));var util=require(_0xba1d('0x1'));var path=require('path');var timeout=require(_0xba1d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xba1d('0x3'));var interaction=require(_0xba1d('0x4'));var config=require(_0xba1d('0x5'));var controller=require(_0xba1d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xba1d('0x7')]);router['get']('/describe',auth[_0xba1d('0x8')](),controller[_0xba1d('0x9')]);router[_0xba1d('0xa')](_0xba1d('0xb'),auth[_0xba1d('0x8')](),controller['show']);router[_0xba1d('0xc')]('/',auth[_0xba1d('0x8')](),controller[_0xba1d('0xd')]);router[_0xba1d('0xe')](_0xba1d('0xb'),auth[_0xba1d('0x8')](),controller[_0xba1d('0xf')]);router[_0xba1d('0x10')]('/:id',auth[_0xba1d('0x8')](),controller[_0xba1d('0x11')]);module[_0xba1d('0x12')]=router; \ No newline at end of file +var _0x60d7=['get','/describe','isAuthenticated','describe','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x60d7,0x115));var _0x760d=function(_0x3504ed,_0x18df7b){_0x3504ed=_0x3504ed-0x0;var _0x5ae5ec=_0x60d7[_0x3504ed];return _0x5ae5ec;};'use strict';var multer=require(_0x760d('0x0'));var util=require(_0x760d('0x1'));var path=require(_0x760d('0x2'));var timeout=require(_0x760d('0x3'));var express=require(_0x760d('0x4'));var router=express[_0x760d('0x5')]();var auth=require(_0x760d('0x6'));var interaction=require(_0x760d('0x7'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x760d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x760d('0x8')](_0x760d('0x9'),auth[_0x760d('0xa')](),controller[_0x760d('0xb')]);router[_0x760d('0x8')]('/:id',auth[_0x760d('0xa')](),controller[_0x760d('0xc')]);router['post']('/',auth[_0x760d('0xa')](),controller['create']);router[_0x760d('0xd')](_0x760d('0xe'),auth[_0x760d('0xa')](),controller[_0x760d('0xf')]);router[_0x760d('0x10')](_0x760d('0xe'),auth[_0x760d('0xa')](),controller[_0x760d('0x11')]);module[_0x760d('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 25bade8..07f0752 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 _0x5bde=['DATE','moment','sequelize','exports','STRING'];(function(_0x3bc44d,_0x47f40a){var _0x5e9b5b=function(_0x46492d){while(--_0x46492d){_0x3bc44d['push'](_0x3bc44d['shift']());}};_0x5e9b5b(++_0x47f40a);}(_0x5bde,0xd3));var _0xe5bd=function(_0x13fd88,_0x252227){_0x13fd88=_0x13fd88-0x0;var _0x59557d=_0x5bde[_0x13fd88];return _0x59557d;};'use strict';var moment=require(_0xe5bd('0x0'));var Sequelize=require(_0xe5bd('0x1'));module[_0xe5bd('0x2')]={'uniqueid':{'type':Sequelize[_0xe5bd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe5bd('0x3')]},'joinAt':{'type':Sequelize[_0xe5bd('0x4')]},'leaveAt':{'type':Sequelize[_0xe5bd('0x4')]},'acceptAt':{'type':Sequelize[_0xe5bd('0x4')]},'exitAt':{'type':Sequelize[_0xe5bd('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7e48=['DATE','sequelize'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x7e48,0x103));var _0x87e4=function(_0x366587,_0x582b77){_0x366587=_0x366587-0x0;var _0xa53909=_0x7e48[_0x366587];return _0xa53909;};'use strict';var moment=require('moment');var Sequelize=require(_0x87e4('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x87e4('0x1')]},'leaveAt':{'type':Sequelize[_0x87e4('0x1')]},'acceptAt':{'type':Sequelize[_0x87e4('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 1219721..47b530b 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 _0x2a1d=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','Content-Range','json','apply','reject','save','destroy','then','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','show','params','find','catch','create','update','body','describe','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x131cb4,_0x240196){var _0x6a1bf3=function(_0xe4dff7){while(--_0xe4dff7){_0x131cb4['push'](_0x131cb4['shift']());}};_0x6a1bf3(++_0x240196);}(_0x2a1d,0x113));var _0xd2a1=function(_0x51a21f,_0x585342){_0x51a21f=_0x51a21f-0x0;var _0x2b388c=_0x2a1d[_0x51a21f];return _0x2b388c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd2a1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2a1('0x1'));var rp=require(_0xd2a1('0x2'));var moment=require('moment');var BPromise=require(_0xd2a1('0x3'));var Mustache=require('mustache');var util=require(_0xd2a1('0x4'));var path=require('path');var sox=require(_0xd2a1('0x5'));var csv=require(_0xd2a1('0x6'));var ejs=require(_0xd2a1('0x7'));var fs=require('fs');var _=require(_0xd2a1('0x8'));var squel=require(_0xd2a1('0x9'));var crypto=require(_0xd2a1('0xa'));var jsforce=require(_0xd2a1('0xb'));var deskjs=require(_0xd2a1('0xc'));var toCsv=require(_0xd2a1('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd2a1('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd2a1('0xe'));var hardwareService=require(_0xd2a1('0xf'));var logger=require(_0xd2a1('0x10'))(_0xd2a1('0x11'));var utils=require(_0xd2a1('0x12'));var config=require('../../config/environment');var db=require(_0xd2a1('0x13'))['db'];function respondWithStatusCode(_0x278851,_0x6d0136){_0x6d0136=_0x6d0136||0xcc;return function(_0x4db042){if(_0x4db042){return _0x278851['sendStatus'](_0x6d0136);}return _0x278851[_0xd2a1('0x14')](_0x6d0136)[_0xd2a1('0x15')]();};}function respondWithResult(_0x4dd6bf,_0xb84f04){_0xb84f04=_0xb84f04||0xc8;return function(_0x2d094c){if(_0x2d094c){return _0x4dd6bf[_0xd2a1('0x14')](_0xb84f04)['json'](_0x2d094c);}};}function respondWithFilteredResult(_0x47b62f,_0x63bf7f){return function(_0x58cc46){if(_0x58cc46){var _0xfb1b42=_0x58cc46['count'],_0x4340cb=_0x63bf7f[_0xd2a1('0x16')],_0x4fc1c3=_0x63bf7f[_0xd2a1('0x16')]+_0x63bf7f['limit'],_0x1fa50e;if(_0x4fc1c3>=_0xfb1b42){_0x4fc1c3=_0xfb1b42;_0x1fa50e=0xc8;}else{_0x1fa50e=0xce;}_0x47b62f[_0xd2a1('0x14')](_0x1fa50e);return _0x47b62f['set'](_0xd2a1('0x17'),_0x4340cb+'-'+_0x4fc1c3+'/'+_0xfb1b42)[_0xd2a1('0x18')](_0x58cc46);}return null;};}function patchUpdates(_0x2c05db){return function(_0x227f74){try{jsonpatch[_0xd2a1('0x19')](_0x227f74,_0x2c05db,!![]);}catch(_0xe08217){return BPromise[_0xd2a1('0x1a')](_0xe08217);}return _0x227f74[_0xd2a1('0x1b')]();};}function saveUpdates(_0x252f2f,_0x3e7639){return function(_0x246499){if(_0x246499){return _0x246499['update'](_0x252f2f)['then'](function(_0x4d9274){return _0x4d9274;});}return null;};}function removeEntity(_0x4faffe,_0x5934d3){return function(_0x16a62e){if(_0x16a62e){return _0x16a62e[_0xd2a1('0x1c')]()[_0xd2a1('0x1d')](function(){_0x4faffe['status'](0xcc)[_0xd2a1('0x15')]();});}};}function handleEntityNotFound(_0x3a5839,_0x439451){return function(_0x299a9c){if(!_0x299a9c){_0x3a5839[_0xd2a1('0x1e')](0x194);}return _0x299a9c;};}function handleError(_0x32960f,_0xb91dfe){_0xb91dfe=_0xb91dfe||0x1f4;return function(_0xb1be8a){logger[_0xd2a1('0x1f')](_0xb1be8a['stack']);if(_0xb1be8a[_0xd2a1('0x20')]){delete _0xb1be8a[_0xd2a1('0x20')];}_0x32960f[_0xd2a1('0x14')](_0xb91dfe)[_0xd2a1('0x21')](_0xb1be8a);};}exports[_0xd2a1('0x22')]=function(_0x570ed7,_0x288643){var _0x533a71={},_0x378484={},_0x30935b={'count':0x0,'rows':[]};var _0xb86c0d=_[_0xd2a1('0x23')](db[_0xd2a1('0x24')][_0xd2a1('0x25')],function(_0x1f9b79){return{'name':_0x1f9b79[_0xd2a1('0x26')],'type':_0x1f9b79['type'][_0xd2a1('0x27')]};});_0x378484[_0xd2a1('0x28')]=_[_0xd2a1('0x23')](_0xb86c0d,_0xd2a1('0x20'));_0x378484['query']=_[_0xd2a1('0x29')](_0x570ed7['query']);_0x378484[_0xd2a1('0x2a')]=_['intersection'](_0x378484[_0xd2a1('0x28')],_0x378484[_0xd2a1('0x2b')]);_0x533a71[_0xd2a1('0x2c')]=_[_0xd2a1('0x2d')](_0x378484[_0xd2a1('0x28')],qs['fields'](_0x570ed7[_0xd2a1('0x2b')][_0xd2a1('0x2e')]));_0x533a71['attributes']=_0x533a71[_0xd2a1('0x2c')][_0xd2a1('0x2f')]?_0x533a71[_0xd2a1('0x2c')]:_0x378484['model'];if(!_0x570ed7[_0xd2a1('0x2b')][_0xd2a1('0x30')](_0xd2a1('0x31'))){_0x533a71['limit']=qs['limit'](_0x570ed7[_0xd2a1('0x2b')][_0xd2a1('0x32')]);_0x533a71[_0xd2a1('0x16')]=qs[_0xd2a1('0x16')](_0x570ed7['query'][_0xd2a1('0x16')]);}_0x533a71[_0xd2a1('0x33')]=qs[_0xd2a1('0x34')](_0x570ed7['query'][_0xd2a1('0x34')]);_0x533a71[_0xd2a1('0x35')]=qs[_0xd2a1('0x2a')](_[_0xd2a1('0x36')](_0x570ed7[_0xd2a1('0x2b')],_0x378484[_0xd2a1('0x2a')]),_0xb86c0d);if(_0x570ed7[_0xd2a1('0x2b')][_0xd2a1('0x37')]){_0x533a71[_0xd2a1('0x35')]=_[_0xd2a1('0x38')](_0x533a71[_0xd2a1('0x35')],{'$or':_[_0xd2a1('0x23')](_0xb86c0d,function(_0x2a2f2e){if(_0x2a2f2e[_0xd2a1('0x39')]!==_0xd2a1('0x3a')){var _0x2beab1={};_0x2beab1[_0x2a2f2e[_0xd2a1('0x20')]]={'$like':'%'+_0x570ed7['query'][_0xd2a1('0x37')]+'%'};return _0x2beab1;}})});}_0x533a71=_[_0xd2a1('0x38')]({},_0x533a71,_0x570ed7[_0xd2a1('0x3b')]);var _0x35c989={'where':_0x533a71[_0xd2a1('0x35')]};return db[_0xd2a1('0x24')]['count'](_0x35c989)[_0xd2a1('0x1d')](function(_0x7d31f6){_0x30935b[_0xd2a1('0x3c')]=_0x7d31f6;if(_0x570ed7['query'][_0xd2a1('0x3d')]){_0x533a71[_0xd2a1('0x3e')]=[{'all':!![]}];}return db[_0xd2a1('0x24')]['findAll'](_0x533a71);})['then'](function(_0x4bc362){_0x30935b[_0xd2a1('0x3f')]=_0x4bc362;return _0x30935b;})[_0xd2a1('0x1d')](respondWithFilteredResult(_0x288643,_0x533a71))['catch'](handleError(_0x288643,null));};exports[_0xd2a1('0x40')]=function(_0x239ab2,_0x4a48b3){var _0x421d94={'raw':!![],'where':{'id':_0x239ab2[_0xd2a1('0x41')]['id']}},_0xaf6ece={};_0xaf6ece[_0xd2a1('0x28')]=_[_0xd2a1('0x29')](db[_0xd2a1('0x24')][_0xd2a1('0x25')]);_0xaf6ece['query']=_[_0xd2a1('0x29')](_0x239ab2[_0xd2a1('0x2b')]);_0xaf6ece[_0xd2a1('0x2a')]=_[_0xd2a1('0x2d')](_0xaf6ece[_0xd2a1('0x28')],_0xaf6ece[_0xd2a1('0x2b')]);_0x421d94[_0xd2a1('0x2c')]=_[_0xd2a1('0x2d')](_0xaf6ece[_0xd2a1('0x28')],qs[_0xd2a1('0x2e')](_0x239ab2['query'][_0xd2a1('0x2e')]));_0x421d94[_0xd2a1('0x2c')]=_0x421d94['attributes'][_0xd2a1('0x2f')]?_0x421d94['attributes']:_0xaf6ece[_0xd2a1('0x28')];if(_0x239ab2['query'][_0xd2a1('0x3d')]){_0x421d94[_0xd2a1('0x3e')]=[{'all':!![]}];}_0x421d94=_[_0xd2a1('0x38')]({},_0x421d94,_0x239ab2['options']);return db['MailQueueReport'][_0xd2a1('0x42')](_0x421d94)[_0xd2a1('0x1d')](handleEntityNotFound(_0x4a48b3,null))[_0xd2a1('0x1d')](respondWithResult(_0x4a48b3,null))[_0xd2a1('0x43')](handleError(_0x4a48b3,null));};exports[_0xd2a1('0x44')]=function(_0x3d0fec,_0x12bddd){return db['MailQueueReport']['create'](_0x3d0fec['body'],{})[_0xd2a1('0x1d')](respondWithResult(_0x12bddd,0xc9))[_0xd2a1('0x43')](handleError(_0x12bddd,null));};exports[_0xd2a1('0x45')]=function(_0x1aa413,_0xc7a684){if(_0x1aa413['body']['id']){delete _0x1aa413[_0xd2a1('0x46')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x1aa413[_0xd2a1('0x41')]['id']}})[_0xd2a1('0x1d')](handleEntityNotFound(_0xc7a684,null))['then'](saveUpdates(_0x1aa413[_0xd2a1('0x46')],null))[_0xd2a1('0x1d')](respondWithResult(_0xc7a684,null))[_0xd2a1('0x43')](handleError(_0xc7a684,null));};exports['destroy']=function(_0x315836,_0x3b86da){return db[_0xd2a1('0x24')][_0xd2a1('0x42')]({'where':{'id':_0x315836[_0xd2a1('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b86da,null))[_0xd2a1('0x1d')](removeEntity(_0x3b86da,null))[_0xd2a1('0x43')](handleError(_0x3b86da,null));};exports[_0xd2a1('0x47')]=function(_0x5f182b,_0xf7dc19){return db[_0xd2a1('0x24')][_0xd2a1('0x47')]()[_0xd2a1('0x1d')](respondWithResult(_0xf7dc19,null))[_0xd2a1('0x43')](handleError(_0xf7dc19,null));}; \ No newline at end of file +var _0xad8f=['mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4fdb70,_0x98d2ea){var _0x3f0a4c=function(_0x4a7db0){while(--_0x4a7db0){_0x4fdb70['push'](_0x4fdb70['shift']());}};_0x3f0a4c(++_0x98d2ea);}(_0xad8f,0xd9));var _0xfad8=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xad8f[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0xfad8('0x0'));var emlformat=require(_0xfad8('0x1'));var rimraf=require(_0xfad8('0x2'));var zipdir=require(_0xfad8('0x3'));var jsonpatch=require(_0xfad8('0x4'));var rp=require(_0xfad8('0x5'));var moment=require(_0xfad8('0x6'));var BPromise=require(_0xfad8('0x7'));var Mustache=require(_0xfad8('0x8'));var util=require('util');var path=require(_0xfad8('0x9'));var sox=require(_0xfad8('0xa'));var csv=require('to-csv');var ejs=require(_0xfad8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfad8('0xc'));var crypto=require(_0xfad8('0xd'));var jsforce=require(_0xfad8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfad8('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfad8('0x10'));var authService=require(_0xfad8('0x11'));var qs=require(_0xfad8('0x12'));var as=require(_0xfad8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfad8('0x14'))(_0xfad8('0x15'));var utils=require(_0xfad8('0x16'));var config=require(_0xfad8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35852e,_0xbde44b){_0xbde44b=_0xbde44b||0xcc;return function(_0x583ade){if(_0x583ade){return _0x35852e['sendStatus'](_0xbde44b);}return _0x35852e[_0xfad8('0x18')](_0xbde44b)[_0xfad8('0x19')]();};}function respondWithResult(_0x2aacd4,_0x431b6e){_0x431b6e=_0x431b6e||0xc8;return function(_0x4ccb1f){if(_0x4ccb1f){return _0x2aacd4['status'](_0x431b6e)[_0xfad8('0x1a')](_0x4ccb1f);}};}function respondWithFilteredResult(_0x16a9f4,_0xc7db90){return function(_0x320512){if(_0x320512){var _0x1cb1ea=_0x320512[_0xfad8('0x1b')],_0x2ddb3e=_0xc7db90[_0xfad8('0x1c')],_0x2fcc96=_0xc7db90[_0xfad8('0x1c')]+_0xc7db90[_0xfad8('0x1d')],_0xa7b022;if(_0x2fcc96>=_0x1cb1ea){_0x2fcc96=_0x1cb1ea;_0xa7b022=0xc8;}else{_0xa7b022=0xce;}_0x16a9f4['status'](_0xa7b022);return _0x16a9f4[_0xfad8('0x1e')](_0xfad8('0x1f'),_0x2ddb3e+'-'+_0x2fcc96+'/'+_0x1cb1ea)[_0xfad8('0x1a')](_0x320512);}return null;};}function patchUpdates(_0x31a1f7){return function(_0x199ae2){try{jsonpatch[_0xfad8('0x20')](_0x199ae2,_0x31a1f7,!![]);}catch(_0x1bf126){return BPromise[_0xfad8('0x21')](_0x1bf126);}return _0x199ae2[_0xfad8('0x22')]();};}function saveUpdates(_0x1e4299,_0x225852){return function(_0x5cd0ce){if(_0x5cd0ce){return _0x5cd0ce[_0xfad8('0x23')](_0x1e4299)['then'](function(_0x23c9cf){return _0x23c9cf;});}return null;};}function removeEntity(_0xf8002,_0x25e327){return function(_0x2c89ba){if(_0x2c89ba){return _0x2c89ba[_0xfad8('0x24')]()[_0xfad8('0x25')](function(){_0xf8002[_0xfad8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a8aa5,_0x55105f){return function(_0x7083b0){if(!_0x7083b0){_0x4a8aa5[_0xfad8('0x26')](0x194);}return _0x7083b0;};}function handleError(_0x50d4a4,_0x59eb1a){_0x59eb1a=_0x59eb1a||0x1f4;return function(_0x4f032a){logger[_0xfad8('0x27')](_0x4f032a[_0xfad8('0x28')]);if(_0x4f032a[_0xfad8('0x29')]){delete _0x4f032a[_0xfad8('0x29')];}_0x50d4a4[_0xfad8('0x18')](_0x59eb1a)[_0xfad8('0x2a')](_0x4f032a);};}exports[_0xfad8('0x2b')]=function(_0x5551d1,_0x3eb1fe){var _0x53f70a={},_0x13ab1f={},_0x8c46fb={'count':0x0,'rows':[]};var _0x5181a7=_[_0xfad8('0x2c')](db[_0xfad8('0x2d')][_0xfad8('0x2e')],function(_0x4d846a){return{'name':_0x4d846a['fieldName'],'type':_0x4d846a[_0xfad8('0x2f')][_0xfad8('0x30')]};});_0x13ab1f[_0xfad8('0x31')]=_['map'](_0x5181a7,_0xfad8('0x29'));_0x13ab1f[_0xfad8('0x32')]=_['keys'](_0x5551d1[_0xfad8('0x32')]);_0x13ab1f[_0xfad8('0x33')]=_[_0xfad8('0x34')](_0x13ab1f[_0xfad8('0x31')],_0x13ab1f['query']);_0x53f70a[_0xfad8('0x35')]=_[_0xfad8('0x34')](_0x13ab1f[_0xfad8('0x31')],qs[_0xfad8('0x36')](_0x5551d1[_0xfad8('0x32')][_0xfad8('0x36')]));_0x53f70a[_0xfad8('0x35')]=_0x53f70a[_0xfad8('0x35')][_0xfad8('0x37')]?_0x53f70a[_0xfad8('0x35')]:_0x13ab1f[_0xfad8('0x31')];if(!_0x5551d1[_0xfad8('0x32')][_0xfad8('0x38')](_0xfad8('0x39'))){_0x53f70a[_0xfad8('0x1d')]=qs[_0xfad8('0x1d')](_0x5551d1[_0xfad8('0x32')]['limit']);_0x53f70a[_0xfad8('0x1c')]=qs[_0xfad8('0x1c')](_0x5551d1[_0xfad8('0x32')][_0xfad8('0x1c')]);}_0x53f70a['order']=qs[_0xfad8('0x3a')](_0x5551d1[_0xfad8('0x32')][_0xfad8('0x3a')]);_0x53f70a[_0xfad8('0x3b')]=qs[_0xfad8('0x33')](_[_0xfad8('0x3c')](_0x5551d1['query'],_0x13ab1f[_0xfad8('0x33')]),_0x5181a7);if(_0x5551d1[_0xfad8('0x32')][_0xfad8('0x3d')]){_0x53f70a[_0xfad8('0x3b')]=_['merge'](_0x53f70a[_0xfad8('0x3b')],{'$or':_[_0xfad8('0x2c')](_0x5181a7,function(_0x3d591c){if(_0x3d591c[_0xfad8('0x2f')]!==_0xfad8('0x3e')){var _0x4543bf={};_0x4543bf[_0x3d591c['name']]={'$like':'%'+_0x5551d1[_0xfad8('0x32')][_0xfad8('0x3d')]+'%'};return _0x4543bf;}})});}_0x53f70a=_['merge']({},_0x53f70a,_0x5551d1[_0xfad8('0x3f')]);var _0x2ec793={'where':_0x53f70a[_0xfad8('0x3b')]};return db[_0xfad8('0x2d')]['count'](_0x2ec793)[_0xfad8('0x25')](function(_0x443f2e){_0x8c46fb[_0xfad8('0x1b')]=_0x443f2e;if(_0x5551d1[_0xfad8('0x32')]['includeAll']){_0x53f70a[_0xfad8('0x40')]=[{'all':!![]}];}return db[_0xfad8('0x2d')][_0xfad8('0x41')](_0x53f70a);})[_0xfad8('0x25')](function(_0x5cba54){_0x8c46fb['rows']=_0x5cba54;return _0x8c46fb;})[_0xfad8('0x25')](respondWithFilteredResult(_0x3eb1fe,_0x53f70a))[_0xfad8('0x42')](handleError(_0x3eb1fe,null));};exports[_0xfad8('0x43')]=function(_0x2d18cc,_0x43a74c){var _0x3b4906={'raw':!![],'where':{'id':_0x2d18cc[_0xfad8('0x44')]['id']}},_0x58384b={};_0x58384b[_0xfad8('0x31')]=_[_0xfad8('0x45')](db['MailQueueReport']['rawAttributes']);_0x58384b[_0xfad8('0x32')]=_['keys'](_0x2d18cc[_0xfad8('0x32')]);_0x58384b[_0xfad8('0x33')]=_['intersection'](_0x58384b['model'],_0x58384b['query']);_0x3b4906[_0xfad8('0x35')]=_[_0xfad8('0x34')](_0x58384b[_0xfad8('0x31')],qs[_0xfad8('0x36')](_0x2d18cc[_0xfad8('0x32')][_0xfad8('0x36')]));_0x3b4906[_0xfad8('0x35')]=_0x3b4906[_0xfad8('0x35')][_0xfad8('0x37')]?_0x3b4906['attributes']:_0x58384b[_0xfad8('0x31')];if(_0x2d18cc['query'][_0xfad8('0x46')]){_0x3b4906[_0xfad8('0x40')]=[{'all':!![]}];}_0x3b4906=_['merge']({},_0x3b4906,_0x2d18cc['options']);return db[_0xfad8('0x2d')][_0xfad8('0x47')](_0x3b4906)[_0xfad8('0x25')](handleEntityNotFound(_0x43a74c,null))[_0xfad8('0x25')](respondWithResult(_0x43a74c,null))[_0xfad8('0x42')](handleError(_0x43a74c,null));};exports[_0xfad8('0x48')]=function(_0x35bb7,_0x4291a9){return db[_0xfad8('0x2d')][_0xfad8('0x48')](_0x35bb7['body'],{})[_0xfad8('0x25')](respondWithResult(_0x4291a9,0xc9))[_0xfad8('0x42')](handleError(_0x4291a9,null));};exports[_0xfad8('0x23')]=function(_0x1cb111,_0x355fe8){if(_0x1cb111[_0xfad8('0x49')]['id']){delete _0x1cb111[_0xfad8('0x49')]['id'];}return db[_0xfad8('0x2d')]['find']({'where':{'id':_0x1cb111[_0xfad8('0x44')]['id']}})[_0xfad8('0x25')](handleEntityNotFound(_0x355fe8,null))[_0xfad8('0x25')](saveUpdates(_0x1cb111[_0xfad8('0x49')],null))[_0xfad8('0x25')](respondWithResult(_0x355fe8,null))[_0xfad8('0x42')](handleError(_0x355fe8,null));};exports[_0xfad8('0x24')]=function(_0x310f5f,_0x47bedd){return db['MailQueueReport']['find']({'where':{'id':_0x310f5f[_0xfad8('0x44')]['id']}})[_0xfad8('0x25')](handleEntityNotFound(_0x47bedd,null))[_0xfad8('0x25')](removeEntity(_0x47bedd,null))[_0xfad8('0x42')](handleError(_0x47bedd,null));};exports[_0xfad8('0x4a')]=function(_0x3f451f,_0xbca7c5){return db[_0xfad8('0x2d')]['describe']()[_0xfad8('0x25')](respondWithResult(_0xbca7c5,null))[_0xfad8('0x42')](handleError(_0xbca7c5,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index ebd15ce..b148d21 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 _0xbdfb=['../../config/environment','exports','define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x551254,_0x4248f8){var _0x4d72f3=function(_0x1a47af){while(--_0x1a47af){_0x551254['push'](_0x551254['shift']());}};_0x4d72f3(++_0x4248f8);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x239904,_0x4b11e2){_0x239904=_0x239904-0x0;var _0x259609=_0xbdfb[_0x239904];return _0x259609;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var logger=require(_0xbbdf('0x2'))(_0xbbdf('0x3'));var moment=require(_0xbbdf('0x4'));var BPromise=require(_0xbbdf('0x5'));var rp=require(_0xbbdf('0x6'));var fs=require('fs');var path=require(_0xbbdf('0x7'));var rimraf=require(_0xbbdf('0x8'));var config=require(_0xbbdf('0x9'));var attributes=require('./mailQueueReport.attributes');module[_0xbbdf('0xa')]=function(_0x3184ff,_0x54d048){return _0x3184ff[_0xbbdf('0xb')](_0xbbdf('0xc'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xbbdf('0xd'),'fields':[_0xbbdf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4af8=['path','../../config/environment','./mailQueueReport.attributes','MailQueueReport','report_mail_queue','moment','bluebird','request-promise'];(function(_0x132a19,_0x26fae6){var _0x33bf22=function(_0xf80837){while(--_0xf80837){_0x132a19['push'](_0x132a19['shift']());}};_0x33bf22(++_0x26fae6);}(_0x4af8,0x1ad));var _0x84af=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x4af8[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x84af('0x0'));var BPromise=require(_0x84af('0x1'));var rp=require(_0x84af('0x2'));var fs=require('fs');var path=require(_0x84af('0x3'));var rimraf=require('rimraf');var config=require(_0x84af('0x4'));var attributes=require(_0x84af('0x5'));module['exports']=function(_0x37c4f9,_0x3971f1){return _0x37c4f9['define'](_0x84af('0x6'),attributes,{'tableName':_0x84af('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','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 1a5fc19..e181990 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x17d0b3,_0x3700d9){var _0x5582a5=function(_0x38d09c){while(--_0x38d09c){_0x17d0b3['push'](_0x17d0b3['shift']());}};_0x5582a5(++_0x3700d9);}(_0x7a54,0x106));var _0x47a5=function(_0x3fff2f,_0x41306b){_0x3fff2f=_0x3fff2f-0x0;var _0x22d477=_0x7a54[_0x3fff2f];return _0x22d477;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7096=['then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','body','options','raw','UpdateMailQueueReport','update','where','attributes','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5596f3,_0x47ce95){var _0x4da3da=function(_0x325482){while(--_0x325482){_0x5596f3['push'](_0x5596f3['shift']());}};_0x4da3da(++_0x47ce95);}(_0x7096,0x10c));var _0x6709=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7096[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});}exports[_0x6709('0x16')]=function(_0x235a54){var _0x4a732e=this;return new Promise(function(_0x9c1fd8,_0x166c97){return db[_0x6709('0x17')]['create'](_0x235a54[_0x6709('0x18')],{'raw':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3c4971){logger[_0x6709('0xc')](_0x6709('0x16'),_0x235a54);logger[_0x6709('0xf')](_0x6709('0x16'),_0x235a54,JSON[_0x6709('0x10')](_0x3c4971));_0x9c1fd8(_0x3c4971);})[_0x6709('0x15')](function(_0x17763d){logger[_0x6709('0x11')](_0x6709('0x16'),_0x17763d[_0x6709('0x13')],_0x235a54);_0x166c97(_0x4a732e[_0x6709('0x11')](0x1f4,_0x17763d['message']));});});};exports[_0x6709('0x1b')]=function(_0x81138e){var _0x2bcc73=this;return new Promise(function(_0x5c7982,_0x2e3483){return db[_0x6709('0x17')][_0x6709('0x1c')](_0x81138e[_0x6709('0x18')],{'raw':_0x81138e['options']?_0x81138e[_0x6709('0x19')][_0x6709('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x81138e['options']?_0x81138e[_0x6709('0x19')][_0x6709('0x1d')]||null:null,'attributes':_0x81138e['options']?_0x81138e[_0x6709('0x19')][_0x6709('0x1e')]||null:null,'limit':_0x81138e['options']?_0x81138e[_0x6709('0x19')]['limit']||null:null})[_0x6709('0xb')](function(_0x3cd555){logger['info'](_0x6709('0x1b'),_0x81138e);logger['debug'](_0x6709('0x1b'),_0x81138e,JSON[_0x6709('0x10')](_0x3cd555));_0x5c7982(_0x3cd555);})['catch'](function(_0x1a9eea){logger['error'](_0x6709('0x1b'),_0x1a9eea[_0x6709('0x13')],_0x81138e);_0x2e3483(_0x2bcc73['error'](0x1f4,_0x1a9eea['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 591ed7d..117c38e 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 _0x8c73=['../../components/auth/service','../../components/interaction/service','exports','util','path','connect-timeout','express','Router'];(function(_0x334672,_0x42f550){var _0x7cb6dc=function(_0x212934){while(--_0x212934){_0x334672['push'](_0x334672['shift']());}};_0x7cb6dc(++_0x42f550);}(_0x8c73,0xbb));var _0x38c7=function(_0x3eb2ea,_0x401c21){_0x3eb2ea=_0x3eb2ea-0x0;var _0x516fe4=_0x8c73[_0x3eb2ea];return _0x516fe4;};'use strict';var multer=require('multer');var util=require(_0x38c7('0x0'));var path=require(_0x38c7('0x1'));var timeout=require(_0x38c7('0x2'));var express=require(_0x38c7('0x3'));var router=express[_0x38c7('0x4')]();var auth=require(_0x38c7('0x5'));var interaction=require(_0x38c7('0x6'));var config=require('../../config/environment');module[_0x38c7('0x7')]=router; \ No newline at end of file +var _0x2605=['../../components/interaction/service','../../config/environment','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3a1cfe,_0x56db3e){var _0x1d6ff8=function(_0x4b7e54){while(--_0x4b7e54){_0x3a1cfe['push'](_0x3a1cfe['shift']());}};_0x1d6ff8(++_0x56db3e);}(_0x2605,0xc7));var _0x5260=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x2605[_0x30faee];return _0x3a90ab;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5260('0x0'));var express=require(_0x5260('0x1'));var router=express[_0x5260('0x2')]();var auth=require(_0x5260('0x3'));var interaction=require(_0x5260('0x4'));var config=require(_0x5260('0x5'));module[_0x5260('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a2c0d4c..8266e06 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 _0x075e=['INTEGER','exports','STRING','BOOLEAN','INBOX'];(function(_0x29fba8,_0x2b16f2){var _0x42f260=function(_0x2800a5){while(--_0x2800a5){_0x29fba8['push'](_0x29fba8['shift']());}};_0x42f260(++_0x2b16f2);}(_0x075e,0x11e));var _0xe075=function(_0x5e8097,_0x2dc885){_0x5e8097=_0x5e8097-0x0;var _0x218521=_0x075e[_0x5e8097];return _0x218521;};'use strict';var Sequelize=require('sequelize');module[_0xe075('0x0')]={'description':{'type':Sequelize[_0xe075('0x1')]},'host':{'type':Sequelize[_0xe075('0x1')]},'authentication':{'type':Sequelize[_0xe075('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe075('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xe075('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xe075('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe075('0x1')],'defaultValue':_0xe075('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe075('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe075('0x1')]}}; \ No newline at end of file +var _0x861f=['sequelize','exports','STRING','BOOLEAN','username','INTEGER'];(function(_0x33a764,_0x2fa127){var _0x3afb83=function(_0x337fb4){while(--_0x337fb4){_0x33a764['push'](_0x33a764['shift']());}};_0x3afb83(++_0x2fa127);}(_0x861f,0xba));var _0xf861=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0x861f[_0x2fbcf6];return _0x3e7265;};'use strict';var Sequelize=require(_0xf861('0x0'));module[_0xf861('0x1')]={'description':{'type':Sequelize[_0xf861('0x2')]},'host':{'type':Sequelize[_0xf861('0x2')]},'authentication':{'type':Sequelize[_0xf861('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf861('0x2')],'unique':_0xf861('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf861('0x5')]},'tls':{'type':Sequelize[_0xf861('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf861('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf861('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index c79dbae..5c0cf72 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 _0xd2f5=['../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x27c785,_0x47218c){var _0x437331=function(_0x3fe408){while(--_0x3fe408){_0x27c785['push'](_0x27c785['shift']());}};_0x437331(++_0x47218c);}(_0xd2f5,0x144));var _0x5d2f=function(_0x4d8a5a,_0x3523cd){_0x4d8a5a=_0x4d8a5a-0x0;var _0x1dc2a9=_0xd2f5[_0x4d8a5a];return _0x1dc2a9;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var logger=require(_0x5d2f('0x1'))('api');var moment=require(_0x5d2f('0x2'));var BPromise=require('bluebird');var rp=require(_0x5d2f('0x3'));var fs=require('fs');var path=require(_0x5d2f('0x4'));var rimraf=require(_0x5d2f('0x5'));var config=require(_0x5d2f('0x6'));var attributes=require(_0x5d2f('0x7'));module[_0x5d2f('0x8')]=function(_0x2392df,_0x16e9fa){return _0x2392df['define'](_0x5d2f('0x9'),attributes,{'tableName':_0x5d2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66da=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','path'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x66da,0x16f));var _0xa66d=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0x66da[_0x1c6ef2];return _0x404b8c;};'use strict';var _=require(_0xa66d('0x0'));var util=require(_0xa66d('0x1'));var logger=require(_0xa66d('0x2'))(_0xa66d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa66d('0x4'));var rimraf=require(_0xa66d('0x5'));var config=require(_0xa66d('0x6'));var attributes=require(_0xa66d('0x7'));module[_0xa66d('0x8')]=function(_0x4ee440,_0x142a69){return _0x4ee440[_0xa66d('0x9')](_0xa66d('0xa'),attributes,{'tableName':_0xa66d('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 a5a7064..01b5f3f 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 _0xa3a3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x329f9e,_0x162883){var _0x4dc956=function(_0x56b271){while(--_0x56b271){_0x329f9e['push'](_0x329f9e['shift']());}};_0x4dc956(++_0x162883);}(_0xa3a3,0x1c0));var _0x3a3a=function(_0x408626,_0x421fc6){_0x408626=_0x408626-0x0;var _0x36ef72=_0xa3a3[_0x408626];return _0x36ef72;};'use strict';var _=require(_0x3a3a('0x0'));var util=require(_0x3a3a('0x1'));var moment=require(_0x3a3a('0x2'));var BPromise=require(_0x3a3a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a3a('0x4'));var db=require(_0x3a3a('0x5'))['db'];var utils=require(_0x3a3a('0x6'));var logger=require(_0x3a3a('0x7'))(_0x3a3a('0x8'));var config=require(_0x3a3a('0x9'));var jayson=require(_0x3a3a('0xa'));var client=jayson[_0x3a3a('0xb')][_0x3a3a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a7f97,_0x4ada40,_0x5eb6b6){return new BPromise(function(_0x10ba52,_0x5919e4){return client['request'](_0x1a7f97,_0x5eb6b6)['then'](function(_0x28b6fc){logger[_0x3a3a('0xd')]('MailServerIn,\x20%s,\x20%s',_0x4ada40,_0x3a3a('0xe'));logger['debug'](_0x3a3a('0xf'),_0x4ada40,_0x3a3a('0xe'),JSON[_0x3a3a('0x10')](_0x28b6fc));if(_0x28b6fc[_0x3a3a('0x11')]){if(_0x28b6fc[_0x3a3a('0x11')][_0x3a3a('0x12')]===0x1f4){logger[_0x3a3a('0x11')](_0x3a3a('0x13'),_0x4ada40,_0x28b6fc['error'][_0x3a3a('0x14')]);return _0x5919e4(_0x28b6fc[_0x3a3a('0x11')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x4ada40,_0x28b6fc[_0x3a3a('0x11')][_0x3a3a('0x14')]);return _0x10ba52(_0x28b6fc[_0x3a3a('0x11')]['message']);}else{logger[_0x3a3a('0xd')](_0x3a3a('0x13'),_0x4ada40,_0x3a3a('0xe'));_0x10ba52(_0x28b6fc[_0x3a3a('0x15')][_0x3a3a('0x14')]);}})[_0x3a3a('0x16')](function(_0x259d2e){logger[_0x3a3a('0x11')](_0x3a3a('0x13'),_0x4ada40,_0x259d2e);_0x5919e4(_0x259d2e);});});}exports['GetMailServerIn']=function(_0x4631f9){var _0x23b2cc=this;return new Promise(function(_0x404120,_0x449780){return db[_0x3a3a('0x17')][_0x3a3a('0x18')]({'raw':_0x4631f9['options']?_0x4631f9[_0x3a3a('0x19')][_0x3a3a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4631f9[_0x3a3a('0x19')]?_0x4631f9[_0x3a3a('0x19')][_0x3a3a('0x1b')]||null:null,'attributes':_0x4631f9[_0x3a3a('0x19')]?_0x4631f9[_0x3a3a('0x19')][_0x3a3a('0x1c')]||null:null,'limit':_0x4631f9['options']?_0x4631f9['options'][_0x3a3a('0x1d')]||null:null,'include':_0x4631f9['options']?_0x4631f9[_0x3a3a('0x19')][_0x3a3a('0x1e')]?_[_0x3a3a('0x1f')](_0x4631f9[_0x3a3a('0x19')][_0x3a3a('0x1e')],function(_0x47a5fa){return{'model':db[_0x47a5fa[_0x3a3a('0x20')]],'as':_0x47a5fa['as'],'attributes':_0x47a5fa[_0x3a3a('0x1c')],'include':_0x47a5fa[_0x3a3a('0x1e')]?_[_0x3a3a('0x1f')](_0x47a5fa[_0x3a3a('0x1e')],function(_0x377fd9){return{'model':db[_0x377fd9[_0x3a3a('0x20')]],'as':_0x377fd9['as'],'attributes':_0x377fd9[_0x3a3a('0x1c')],'include':_0x377fd9[_0x3a3a('0x1e')]?_[_0x3a3a('0x1f')](_0x377fd9[_0x3a3a('0x1e')],function(_0x41af5c){return{'model':db[_0x41af5c[_0x3a3a('0x20')]],'as':_0x41af5c['as'],'attributes':_0x41af5c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4667b8){logger[_0x3a3a('0xd')](_0x3a3a('0x21'),_0x4631f9);logger[_0x3a3a('0x22')](_0x3a3a('0x21'),_0x4631f9,JSON[_0x3a3a('0x10')](_0x4667b8));_0x404120(_0x4667b8);})[_0x3a3a('0x16')](function(_0x5473c1){logger[_0x3a3a('0x11')](_0x3a3a('0x21'),_0x5473c1[_0x3a3a('0x14')],_0x4631f9);_0x449780(_0x23b2cc['error'](0x1f4,_0x5473c1[_0x3a3a('0x14')]));});});}; \ No newline at end of file +var _0xc611=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','lodash','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc611,0x1aa));var _0x1c61=function(_0x50e1d3,_0x1bead5){_0x50e1d3=_0x50e1d3-0x0;var _0x1fdf4d=_0xc611[_0x50e1d3];return _0x1fdf4d;};'use strict';var _=require(_0x1c61('0x0'));var util=require('util');var moment=require(_0x1c61('0x1'));var BPromise=require(_0x1c61('0x2'));var rs=require(_0x1c61('0x3'));var fs=require('fs');var Redis=require(_0x1c61('0x4'));var db=require(_0x1c61('0x5'))['db'];var utils=require(_0x1c61('0x6'));var logger=require(_0x1c61('0x7'))(_0x1c61('0x8'));var config=require(_0x1c61('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1c61('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8e917b,_0x4e6885,_0x5e7e58){return new BPromise(function(_0xf58c06,_0x40af6e){return client[_0x1c61('0xb')](_0x8e917b,_0x5e7e58)[_0x1c61('0xc')](function(_0x21591c){logger[_0x1c61('0xd')](_0x1c61('0xe'),_0x4e6885,'request\x20sent');logger[_0x1c61('0xf')](_0x1c61('0x10'),_0x4e6885,_0x1c61('0x11'),JSON[_0x1c61('0x12')](_0x21591c));if(_0x21591c[_0x1c61('0x13')]){if(_0x21591c[_0x1c61('0x13')][_0x1c61('0x14')]===0x1f4){logger[_0x1c61('0x13')](_0x1c61('0xe'),_0x4e6885,_0x21591c['error'][_0x1c61('0x15')]);return _0x40af6e(_0x21591c[_0x1c61('0x13')]['message']);}logger['error'](_0x1c61('0xe'),_0x4e6885,_0x21591c[_0x1c61('0x13')]['message']);return _0xf58c06(_0x21591c[_0x1c61('0x13')][_0x1c61('0x15')]);}else{logger[_0x1c61('0xd')](_0x1c61('0xe'),_0x4e6885,_0x1c61('0x11'));_0xf58c06(_0x21591c[_0x1c61('0x16')]['message']);}})['catch'](function(_0x2a0ba5){logger[_0x1c61('0x13')](_0x1c61('0xe'),_0x4e6885,_0x2a0ba5);_0x40af6e(_0x2a0ba5);});});}exports[_0x1c61('0x17')]=function(_0x52f9ad){var _0x348214=this;return new Promise(function(_0x193ed2,_0x3bccf2){return db[_0x1c61('0x18')][_0x1c61('0x19')]({'raw':_0x52f9ad[_0x1c61('0x1a')]?_0x52f9ad[_0x1c61('0x1a')][_0x1c61('0x1b')]===undefined?!![]:![]:!![],'where':_0x52f9ad[_0x1c61('0x1a')]?_0x52f9ad[_0x1c61('0x1a')]['where']||null:null,'attributes':_0x52f9ad[_0x1c61('0x1a')]?_0x52f9ad['options'][_0x1c61('0x1c')]||null:null,'limit':_0x52f9ad[_0x1c61('0x1a')]?_0x52f9ad[_0x1c61('0x1a')][_0x1c61('0x1d')]||null:null,'include':_0x52f9ad[_0x1c61('0x1a')]?_0x52f9ad['options'][_0x1c61('0x1e')]?_['map'](_0x52f9ad[_0x1c61('0x1a')][_0x1c61('0x1e')],function(_0x1d72fc){return{'model':db[_0x1d72fc['model']],'as':_0x1d72fc['as'],'attributes':_0x1d72fc[_0x1c61('0x1c')],'include':_0x1d72fc[_0x1c61('0x1e')]?_['map'](_0x1d72fc['include'],function(_0x35ef5f){return{'model':db[_0x35ef5f['model']],'as':_0x35ef5f['as'],'attributes':_0x35ef5f['attributes'],'include':_0x35ef5f[_0x1c61('0x1e')]?_[_0x1c61('0x1f')](_0x35ef5f[_0x1c61('0x1e')],function(_0xc29eeb){return{'model':db[_0xc29eeb[_0x1c61('0x20')]],'as':_0xc29eeb['as'],'attributes':_0xc29eeb['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c61('0xc')](function(_0x27a570){logger[_0x1c61('0xd')]('GetMailServerIn',_0x52f9ad);logger[_0x1c61('0xf')]('GetMailServerIn',_0x52f9ad,JSON[_0x1c61('0x12')](_0x27a570));_0x193ed2(_0x27a570);})['catch'](function(_0x37482a){logger[_0x1c61('0x13')](_0x1c61('0x17'),_0x37482a['message'],_0x52f9ad);_0x3bccf2(_0x348214['error'](0x1f4,_0x37482a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b54d37b..c020fbb 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 _0x2544=['./mailServerOut.controller','get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x46a6c7,_0x496ccc){var _0x13fe5e=function(_0x2ec8c0){while(--_0x2ec8c0){_0x46a6c7['push'](_0x46a6c7['shift']());}};_0x13fe5e(++_0x496ccc);}(_0x2544,0xdc));var _0x4254=function(_0x5c6339,_0x30d01a){_0x5c6339=_0x5c6339-0x0;var _0x40bd71=_0x2544[_0x5c6339];return _0x40bd71;};'use strict';var multer=require(_0x4254('0x0'));var util=require(_0x4254('0x1'));var path=require(_0x4254('0x2'));var timeout=require(_0x4254('0x3'));var express=require(_0x4254('0x4'));var router=express[_0x4254('0x5')]();var auth=require(_0x4254('0x6'));var interaction=require(_0x4254('0x7'));var config=require('../../config/environment');var controller=require(_0x4254('0x8'));router[_0x4254('0x9')]('/',auth[_0x4254('0xa')](),controller['index']);router[_0x4254('0x9')]('/:id',auth[_0x4254('0xa')](),controller[_0x4254('0xb')]);router[_0x4254('0xc')]('/',auth['isAuthenticated'](),controller[_0x4254('0xd')]);router[_0x4254('0xe')](_0x4254('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x4254('0x10')](_0x4254('0xf'),auth['isAuthenticated'](),controller[_0x4254('0x11')]);module[_0x4254('0x12')]=router; \ No newline at end of file +var _0x088a=['update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x088a,0xa4));var _0xa088=function(_0x56fe68,_0x40fdef){_0x56fe68=_0x56fe68-0x0;var _0x1eeb3b=_0x088a[_0x56fe68];return _0x1eeb3b;};'use strict';var multer=require('multer');var util=require(_0xa088('0x0'));var path=require(_0xa088('0x1'));var timeout=require(_0xa088('0x2'));var express=require(_0xa088('0x3'));var router=express[_0xa088('0x4')]();var auth=require(_0xa088('0x5'));var interaction=require(_0xa088('0x6'));var config=require(_0xa088('0x7'));var controller=require(_0xa088('0x8'));router[_0xa088('0x9')]('/',auth[_0xa088('0xa')](),controller[_0xa088('0xb')]);router[_0xa088('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa088('0xc')]);router[_0xa088('0xd')]('/',auth['isAuthenticated'](),controller[_0xa088('0xe')]);router[_0xa088('0xf')]('/:id',auth[_0xa088('0xa')](),controller[_0xa088('0x10')]);router[_0xa088('0x11')]('/:id',auth[_0xa088('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index d808273..0618cdb 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 _0xc17d=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xc17d,0x96));var _0xdc17=function(_0x3254cd,_0x3b4ea0){_0x3254cd=_0x3254cd-0x0;var _0x729d06=_0xc17d[_0x3254cd];return _0x729d06;};'use strict';var Sequelize=require(_0xdc17('0x0'));module[_0xdc17('0x1')]={'description':{'type':Sequelize[_0xdc17('0x2')]},'host':{'type':Sequelize[_0xdc17('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xdc17('0x2')]},'port':{'type':Sequelize[_0xdc17('0x3')]},'secure':{'type':Sequelize[_0xdc17('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xdc17('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xdbfa=['INTEGER','BOOLEAN','STRING'];(function(_0x1fb9d9,_0x14d0a1){var _0x47ed31=function(_0x26cf2b){while(--_0x26cf2b){_0x1fb9d9['push'](_0x1fb9d9['shift']());}};_0x47ed31(++_0x14d0a1);}(_0xdbfa,0x128));var _0xadbf=function(_0x5b85dd,_0x4d3bf2){_0x5b85dd=_0x5b85dd-0x0;var _0x4390b4=_0xdbfa[_0x5b85dd];return _0x4390b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xadbf('0x0')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xadbf('0x0')]},'port':{'type':Sequelize[_0xadbf('0x1')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xadbf('0x0')]},'authentication':{'type':Sequelize[_0xadbf('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 2553c32..63a1f0a 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 _0xd058=['intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','includeAll','catch','show','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','query'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd058,0xe7));var _0x8d05=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0xd058[_0x4aa838];return _0x3abff0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8d05('0x0'));var rimraf=require(_0x8d05('0x1'));var zipdir=require(_0x8d05('0x2'));var jsonpatch=require(_0x8d05('0x3'));var rp=require(_0x8d05('0x4'));var moment=require('moment');var BPromise=require(_0x8d05('0x5'));var Mustache=require(_0x8d05('0x6'));var util=require(_0x8d05('0x7'));var path=require(_0x8d05('0x8'));var sox=require(_0x8d05('0x9'));var csv=require(_0x8d05('0xa'));var ejs=require(_0x8d05('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8d05('0xc'));var crypto=require(_0x8d05('0xd'));var jsforce=require(_0x8d05('0xe'));var deskjs=require(_0x8d05('0xf'));var toCsv=require(_0x8d05('0xa'));var querystring=require(_0x8d05('0x10'));var Papa=require(_0x8d05('0x11'));var Redis=require(_0x8d05('0x12'));var authService=require(_0x8d05('0x13'));var qs=require(_0x8d05('0x14'));var as=require(_0x8d05('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d05('0x16'))(_0x8d05('0x17'));var utils=require('../../config/utils');var config=require(_0x8d05('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14e6c7,_0x1dd6b3){_0x1dd6b3=_0x1dd6b3||0xcc;return function(_0x429073){if(_0x429073){return _0x14e6c7['sendStatus'](_0x1dd6b3);}return _0x14e6c7[_0x8d05('0x19')](_0x1dd6b3)['end']();};}function respondWithResult(_0x497a98,_0x4e92f8){_0x4e92f8=_0x4e92f8||0xc8;return function(_0x82ec17){if(_0x82ec17){return _0x497a98[_0x8d05('0x19')](_0x4e92f8)[_0x8d05('0x1a')](_0x82ec17);}};}function respondWithFilteredResult(_0x1a7a94,_0x469d75){return function(_0x17c4f6){if(_0x17c4f6){var _0x3277ce=_0x17c4f6[_0x8d05('0x1b')],_0x2706c0=_0x469d75['offset'],_0x24562f=_0x469d75[_0x8d05('0x1c')]+_0x469d75[_0x8d05('0x1d')],_0x32662a;if(_0x24562f>=_0x3277ce){_0x24562f=_0x3277ce;_0x32662a=0xc8;}else{_0x32662a=0xce;}_0x1a7a94['status'](_0x32662a);return _0x1a7a94['set'](_0x8d05('0x1e'),_0x2706c0+'-'+_0x24562f+'/'+_0x3277ce)[_0x8d05('0x1a')](_0x17c4f6);}return null;};}function patchUpdates(_0x40e226){return function(_0x5384a6){try{jsonpatch[_0x8d05('0x1f')](_0x5384a6,_0x40e226,!![]);}catch(_0x212ac7){return BPromise[_0x8d05('0x20')](_0x212ac7);}return _0x5384a6[_0x8d05('0x21')]();};}function saveUpdates(_0x4c7bd3,_0x3f6aa9){return function(_0x318285){if(_0x318285){return _0x318285[_0x8d05('0x22')](_0x4c7bd3)[_0x8d05('0x23')](function(_0x1571ce){return _0x1571ce;});}return null;};}function removeEntity(_0x32ac4a,_0x1dce4d){return function(_0x36e358){if(_0x36e358){return _0x36e358[_0x8d05('0x24')]()[_0x8d05('0x23')](function(){_0x32ac4a[_0x8d05('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5eb,_0x1198c0){return function(_0x16e15a){if(!_0x16e15a){_0x2d5eb[_0x8d05('0x25')](0x194);}return _0x16e15a;};}function handleError(_0x508843,_0x33a6d7){_0x33a6d7=_0x33a6d7||0x1f4;return function(_0x2b425c){logger[_0x8d05('0x26')](_0x2b425c[_0x8d05('0x27')]);if(_0x2b425c[_0x8d05('0x28')]){delete _0x2b425c[_0x8d05('0x28')];}_0x508843[_0x8d05('0x19')](_0x33a6d7)['send'](_0x2b425c);};}exports[_0x8d05('0x29')]=function(_0x38d534,_0x27bd68){var _0x20563c={},_0x3b682a={},_0x29271b={'count':0x0,'rows':[]};var _0x4f1b5a=_[_0x8d05('0x2a')](db[_0x8d05('0x2b')][_0x8d05('0x2c')],function(_0xcc0683){return{'name':_0xcc0683[_0x8d05('0x2d')],'type':_0xcc0683[_0x8d05('0x2e')][_0x8d05('0x2f')]};});_0x3b682a['model']=_['map'](_0x4f1b5a,_0x8d05('0x28'));_0x3b682a[_0x8d05('0x30')]=_['keys'](_0x38d534[_0x8d05('0x30')]);_0x3b682a['filters']=_[_0x8d05('0x31')](_0x3b682a['model'],_0x3b682a[_0x8d05('0x30')]);_0x20563c['attributes']=_['intersection'](_0x3b682a[_0x8d05('0x32')],qs[_0x8d05('0x33')](_0x38d534[_0x8d05('0x30')]['fields']));_0x20563c[_0x8d05('0x34')]=_0x20563c['attributes']['length']?_0x20563c[_0x8d05('0x34')]:_0x3b682a[_0x8d05('0x32')];if(!_0x38d534[_0x8d05('0x30')][_0x8d05('0x35')](_0x8d05('0x36'))){_0x20563c[_0x8d05('0x1d')]=qs['limit'](_0x38d534[_0x8d05('0x30')]['limit']);_0x20563c[_0x8d05('0x1c')]=qs[_0x8d05('0x1c')](_0x38d534[_0x8d05('0x30')][_0x8d05('0x1c')]);}_0x20563c[_0x8d05('0x37')]=qs[_0x8d05('0x38')](_0x38d534[_0x8d05('0x30')][_0x8d05('0x38')]);_0x20563c['where']=qs[_0x8d05('0x39')](_[_0x8d05('0x3a')](_0x38d534[_0x8d05('0x30')],_0x3b682a[_0x8d05('0x39')]),_0x4f1b5a);if(_0x38d534[_0x8d05('0x30')]['filter']){_0x20563c['where']=_[_0x8d05('0x3b')](_0x20563c[_0x8d05('0x3c')],{'$or':_[_0x8d05('0x2a')](_0x4f1b5a,function(_0x954738){if(_0x954738[_0x8d05('0x2e')]!=='VIRTUAL'){var _0x507fe1={};_0x507fe1[_0x954738[_0x8d05('0x28')]]={'$like':'%'+_0x38d534[_0x8d05('0x30')]['filter']+'%'};return _0x507fe1;}})});}_0x20563c=_[_0x8d05('0x3b')]({},_0x20563c,_0x38d534['options']);var _0x25b367={'where':_0x20563c[_0x8d05('0x3c')]};return db['MailServerOut']['count'](_0x25b367)[_0x8d05('0x23')](function(_0x187936){_0x29271b['count']=_0x187936;if(_0x38d534[_0x8d05('0x30')][_0x8d05('0x3d')]){_0x20563c['include']=[{'all':!![]}];}return db[_0x8d05('0x2b')]['findAll'](_0x20563c);})[_0x8d05('0x23')](function(_0x5490c2){_0x29271b['rows']=_0x5490c2;return _0x29271b;})['then'](respondWithFilteredResult(_0x27bd68,_0x20563c))[_0x8d05('0x3e')](handleError(_0x27bd68,null));};exports[_0x8d05('0x3f')]=function(_0x1cfe5c,_0x274b11){var _0x2a4458={'raw':!![],'where':{'id':_0x1cfe5c[_0x8d05('0x40')]['id']}},_0x31857c={};_0x31857c['model']=_[_0x8d05('0x41')](db[_0x8d05('0x2b')][_0x8d05('0x2c')]);_0x31857c['query']=_[_0x8d05('0x41')](_0x1cfe5c[_0x8d05('0x30')]);_0x31857c['filters']=_[_0x8d05('0x31')](_0x31857c[_0x8d05('0x32')],_0x31857c[_0x8d05('0x30')]);_0x2a4458[_0x8d05('0x34')]=_['intersection'](_0x31857c[_0x8d05('0x32')],qs[_0x8d05('0x33')](_0x1cfe5c[_0x8d05('0x30')][_0x8d05('0x33')]));_0x2a4458['attributes']=_0x2a4458[_0x8d05('0x34')]['length']?_0x2a4458[_0x8d05('0x34')]:_0x31857c[_0x8d05('0x32')];if(_0x1cfe5c[_0x8d05('0x30')][_0x8d05('0x3d')]){_0x2a4458['include']=[{'all':!![]}];}_0x2a4458=_[_0x8d05('0x3b')]({},_0x2a4458,_0x1cfe5c[_0x8d05('0x42')]);return db[_0x8d05('0x2b')][_0x8d05('0x43')](_0x2a4458)['then'](handleEntityNotFound(_0x274b11,null))['then'](respondWithResult(_0x274b11,null))[_0x8d05('0x3e')](handleError(_0x274b11,null));};exports[_0x8d05('0x44')]=function(_0x224d69,_0x2c4581){return db[_0x8d05('0x2b')]['create'](_0x224d69[_0x8d05('0x45')],{})[_0x8d05('0x23')](respondWithResult(_0x2c4581,0xc9))[_0x8d05('0x3e')](handleError(_0x2c4581,null));};exports[_0x8d05('0x22')]=function(_0x55cf39,_0x296502){if(_0x55cf39['body']['id']){delete _0x55cf39[_0x8d05('0x45')]['id'];}return db[_0x8d05('0x2b')]['find']({'where':{'id':_0x55cf39[_0x8d05('0x40')]['id']}})[_0x8d05('0x23')](handleEntityNotFound(_0x296502,null))[_0x8d05('0x23')](saveUpdates(_0x55cf39[_0x8d05('0x45')],null))['then'](respondWithResult(_0x296502,null))[_0x8d05('0x3e')](handleError(_0x296502,null));};exports[_0x8d05('0x24')]=function(_0x482a2e,_0x599451){return db[_0x8d05('0x2b')][_0x8d05('0x43')]({'where':{'id':_0x482a2e[_0x8d05('0x40')]['id']}})[_0x8d05('0x23')](handleEntityNotFound(_0x599451,null))[_0x8d05('0x23')](removeEntity(_0x599451,null))[_0x8d05('0x3e')](handleError(_0x599451,null));}; \ No newline at end of file +var _0xc24f=['create','body','params','find','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','MailServerOut','rawAttributes','fieldName','model','map','keys','query','attributes','fields','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','intersection','length'];(function(_0x53e36f,_0x1c8f8d){var _0x173b18=function(_0x4de911){while(--_0x4de911){_0x53e36f['push'](_0x53e36f['shift']());}};_0x173b18(++_0x1c8f8d);}(_0xc24f,0x184));var _0xfc24=function(_0x70bb3b,_0x5796f6){_0x70bb3b=_0x70bb3b-0x0;var _0x35fa1f=_0xc24f[_0x70bb3b];return _0x35fa1f;};'use strict';var pdf=require(_0xfc24('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfc24('0x1'));var zipdir=require(_0xfc24('0x2'));var jsonpatch=require(_0xfc24('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc24('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfc24('0x5'));var sox=require(_0xfc24('0x6'));var csv=require('to-csv');var ejs=require(_0xfc24('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfc24('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc24('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfc24('0xa'));var Redis=require(_0xfc24('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xfc24('0xc'));var as=require(_0xfc24('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc24('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xfc24('0xf'));var db=require(_0xfc24('0x10'))['db'];function respondWithStatusCode(_0x43de5e,_0x3d9e42){_0x3d9e42=_0x3d9e42||0xcc;return function(_0x3c11c3){if(_0x3c11c3){return _0x43de5e[_0xfc24('0x11')](_0x3d9e42);}return _0x43de5e['status'](_0x3d9e42)[_0xfc24('0x12')]();};}function respondWithResult(_0x549969,_0x4598a2){_0x4598a2=_0x4598a2||0xc8;return function(_0x457749){if(_0x457749){return _0x549969['status'](_0x4598a2)[_0xfc24('0x13')](_0x457749);}};}function respondWithFilteredResult(_0x15b990,_0x50f9f2){return function(_0xc139b4){if(_0xc139b4){var _0x41fc1a=_0xc139b4[_0xfc24('0x14')],_0x47361b=_0x50f9f2[_0xfc24('0x15')],_0x278575=_0x50f9f2[_0xfc24('0x15')]+_0x50f9f2[_0xfc24('0x16')],_0x1c7fd8;if(_0x278575>=_0x41fc1a){_0x278575=_0x41fc1a;_0x1c7fd8=0xc8;}else{_0x1c7fd8=0xce;}_0x15b990[_0xfc24('0x17')](_0x1c7fd8);return _0x15b990[_0xfc24('0x18')](_0xfc24('0x19'),_0x47361b+'-'+_0x278575+'/'+_0x41fc1a)[_0xfc24('0x13')](_0xc139b4);}return null;};}function patchUpdates(_0x2f4994){return function(_0x52daef){try{jsonpatch[_0xfc24('0x1a')](_0x52daef,_0x2f4994,!![]);}catch(_0x442e56){return BPromise[_0xfc24('0x1b')](_0x442e56);}return _0x52daef[_0xfc24('0x1c')]();};}function saveUpdates(_0xcb3654,_0x5937d3){return function(_0x56655c){if(_0x56655c){return _0x56655c['update'](_0xcb3654)[_0xfc24('0x1d')](function(_0x3a40c0){return _0x3a40c0;});}return null;};}function removeEntity(_0x2061f7,_0x18f304){return function(_0x5b1102){if(_0x5b1102){return _0x5b1102[_0xfc24('0x1e')]()['then'](function(){_0x2061f7[_0xfc24('0x17')](0xcc)[_0xfc24('0x12')]();});}};}function handleEntityNotFound(_0x8d7f66,_0xc5e07b){return function(_0x4ebb73){if(!_0x4ebb73){_0x8d7f66['sendStatus'](0x194);}return _0x4ebb73;};}function handleError(_0xf92c36,_0x289f5f){_0x289f5f=_0x289f5f||0x1f4;return function(_0x55d2e1){logger[_0xfc24('0x1f')](_0x55d2e1[_0xfc24('0x20')]);if(_0x55d2e1[_0xfc24('0x21')]){delete _0x55d2e1[_0xfc24('0x21')];}_0xf92c36[_0xfc24('0x17')](_0x289f5f)['send'](_0x55d2e1);};}exports['index']=function(_0x4acc83,_0x1d370b){var _0x97a0d6={},_0x32a892={},_0xc55130={'count':0x0,'rows':[]};var _0x47df41=_['map'](db[_0xfc24('0x22')][_0xfc24('0x23')],function(_0x43af3d){return{'name':_0x43af3d[_0xfc24('0x24')],'type':_0x43af3d['type']['key']};});_0x32a892[_0xfc24('0x25')]=_[_0xfc24('0x26')](_0x47df41,_0xfc24('0x21'));_0x32a892['query']=_[_0xfc24('0x27')](_0x4acc83['query']);_0x32a892['filters']=_['intersection'](_0x32a892[_0xfc24('0x25')],_0x32a892[_0xfc24('0x28')]);_0x97a0d6[_0xfc24('0x29')]=_['intersection'](_0x32a892['model'],qs['fields'](_0x4acc83[_0xfc24('0x28')][_0xfc24('0x2a')]));_0x97a0d6[_0xfc24('0x29')]=_0x97a0d6['attributes']['length']?_0x97a0d6[_0xfc24('0x29')]:_0x32a892[_0xfc24('0x25')];if(!_0x4acc83['query']['hasOwnProperty']('nolimit')){_0x97a0d6[_0xfc24('0x16')]=qs['limit'](_0x4acc83[_0xfc24('0x28')]['limit']);_0x97a0d6[_0xfc24('0x15')]=qs[_0xfc24('0x15')](_0x4acc83[_0xfc24('0x28')][_0xfc24('0x15')]);}_0x97a0d6[_0xfc24('0x2b')]=qs[_0xfc24('0x2c')](_0x4acc83['query']['sort']);_0x97a0d6[_0xfc24('0x2d')]=qs[_0xfc24('0x2e')](_[_0xfc24('0x2f')](_0x4acc83[_0xfc24('0x28')],_0x32a892[_0xfc24('0x2e')]),_0x47df41);if(_0x4acc83['query']['filter']){_0x97a0d6[_0xfc24('0x2d')]=_[_0xfc24('0x30')](_0x97a0d6['where'],{'$or':_[_0xfc24('0x26')](_0x47df41,function(_0x35a9df){if(_0x35a9df[_0xfc24('0x31')]!==_0xfc24('0x32')){var _0x2eca98={};_0x2eca98[_0x35a9df[_0xfc24('0x21')]]={'$like':'%'+_0x4acc83['query'][_0xfc24('0x33')]+'%'};return _0x2eca98;}})});}_0x97a0d6=_['merge']({},_0x97a0d6,_0x4acc83[_0xfc24('0x34')]);var _0x49c87b={'where':_0x97a0d6[_0xfc24('0x2d')]};return db[_0xfc24('0x22')][_0xfc24('0x14')](_0x49c87b)[_0xfc24('0x1d')](function(_0x3fe301){_0xc55130['count']=_0x3fe301;if(_0x4acc83[_0xfc24('0x28')][_0xfc24('0x35')]){_0x97a0d6[_0xfc24('0x36')]=[{'all':!![]}];}return db[_0xfc24('0x22')]['findAll'](_0x97a0d6);})[_0xfc24('0x1d')](function(_0x16f681){_0xc55130[_0xfc24('0x37')]=_0x16f681;return _0xc55130;})[_0xfc24('0x1d')](respondWithFilteredResult(_0x1d370b,_0x97a0d6))[_0xfc24('0x38')](handleError(_0x1d370b,null));};exports[_0xfc24('0x39')]=function(_0x5f0b42,_0x49b6db){var _0x46ce50={'raw':!![],'where':{'id':_0x5f0b42['params']['id']}},_0x1dc220={};_0x1dc220[_0xfc24('0x25')]=_[_0xfc24('0x27')](db['MailServerOut'][_0xfc24('0x23')]);_0x1dc220[_0xfc24('0x28')]=_['keys'](_0x5f0b42[_0xfc24('0x28')]);_0x1dc220[_0xfc24('0x2e')]=_['intersection'](_0x1dc220[_0xfc24('0x25')],_0x1dc220[_0xfc24('0x28')]);_0x46ce50[_0xfc24('0x29')]=_[_0xfc24('0x3a')](_0x1dc220[_0xfc24('0x25')],qs[_0xfc24('0x2a')](_0x5f0b42[_0xfc24('0x28')]['fields']));_0x46ce50['attributes']=_0x46ce50[_0xfc24('0x29')][_0xfc24('0x3b')]?_0x46ce50[_0xfc24('0x29')]:_0x1dc220[_0xfc24('0x25')];if(_0x5f0b42[_0xfc24('0x28')][_0xfc24('0x35')]){_0x46ce50[_0xfc24('0x36')]=[{'all':!![]}];}_0x46ce50=_[_0xfc24('0x30')]({},_0x46ce50,_0x5f0b42[_0xfc24('0x34')]);return db[_0xfc24('0x22')]['find'](_0x46ce50)[_0xfc24('0x1d')](handleEntityNotFound(_0x49b6db,null))['then'](respondWithResult(_0x49b6db,null))[_0xfc24('0x38')](handleError(_0x49b6db,null));};exports[_0xfc24('0x3c')]=function(_0x93418e,_0x5f16ee){return db[_0xfc24('0x22')][_0xfc24('0x3c')](_0x93418e[_0xfc24('0x3d')],{})['then'](respondWithResult(_0x5f16ee,0xc9))[_0xfc24('0x38')](handleError(_0x5f16ee,null));};exports['update']=function(_0x213cde,_0x3bd820){if(_0x213cde['body']['id']){delete _0x213cde['body']['id'];}return db[_0xfc24('0x22')]['find']({'where':{'id':_0x213cde[_0xfc24('0x3e')]['id']}})[_0xfc24('0x1d')](handleEntityNotFound(_0x3bd820,null))[_0xfc24('0x1d')](saveUpdates(_0x213cde[_0xfc24('0x3d')],null))[_0xfc24('0x1d')](respondWithResult(_0x3bd820,null))[_0xfc24('0x38')](handleError(_0x3bd820,null));};exports[_0xfc24('0x1e')]=function(_0x36898f,_0x41e44e){return db['MailServerOut'][_0xfc24('0x3f')]({'where':{'id':_0x36898f[_0xfc24('0x3e')]['id']}})['then'](handleEntityNotFound(_0x41e44e,null))['then'](removeEntity(_0x41e44e,null))[_0xfc24('0x38')](handleError(_0x41e44e,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9e71514..3b3f34b 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 _0x4f6c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','util'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x4f6c,0x1c7));var _0xc4f6=function(_0x2ec0e1,_0x4f6c92){_0x2ec0e1=_0x2ec0e1-0x0;var _0x1d6d2c=_0x4f6c[_0x2ec0e1];return _0x1d6d2c;};'use strict';var _=require('lodash');var util=require(_0xc4f6('0x0'));var logger=require(_0xc4f6('0x1'))(_0xc4f6('0x2'));var moment=require(_0xc4f6('0x3'));var BPromise=require(_0xc4f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4f6('0x5'));var rimraf=require(_0xc4f6('0x6'));var config=require(_0xc4f6('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xc4f6('0x8')]=function(_0x311393,_0x57d4f5){return _0x311393[_0xc4f6('0x9')](_0xc4f6('0xa'),attributes,{'tableName':_0xc4f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x628b=['path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5bf152,_0x2884b3){var _0x5d1230=function(_0x40a921){while(--_0x40a921){_0x5bf152['push'](_0x5bf152['shift']());}};_0x5d1230(++_0x2884b3);}(_0x628b,0x159));var _0xb628=function(_0x9d3a22,_0xab4aa8){_0x9d3a22=_0x9d3a22-0x0;var _0x3335a0=_0x628b[_0x9d3a22];return _0x3335a0;};'use strict';var _=require(_0xb628('0x0'));var util=require(_0xb628('0x1'));var logger=require('../../config/logger')(_0xb628('0x2'));var moment=require(_0xb628('0x3'));var BPromise=require(_0xb628('0x4'));var rp=require(_0xb628('0x5'));var fs=require('fs');var path=require(_0xb628('0x6'));var rimraf=require('rimraf');var config=require(_0xb628('0x7'));var attributes=require(_0xb628('0x8'));module[_0xb628('0x9')]=function(_0x1cb997,_0x43697c){return _0x1cb997[_0xb628('0xa')](_0xb628('0xb'),attributes,{'tableName':_0xb628('0xc'),'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 d095332..c51be4c 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 _0xc8ea=['request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s'];(function(_0x48c1a9,_0xd865e6){var _0x4cad7d=function(_0x1dfdc4){while(--_0x1dfdc4){_0x48c1a9['push'](_0x48c1a9['shift']());}};_0x4cad7d(++_0xd865e6);}(_0xc8ea,0x10e));var _0xac8e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xc8ea[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0xac8e('0x0'));var util=require(_0xac8e('0x1'));var moment=require(_0xac8e('0x2'));var BPromise=require(_0xac8e('0x3'));var rs=require(_0xac8e('0x4'));var fs=require('fs');var Redis=require(_0xac8e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xac8e('0x6'));var logger=require(_0xac8e('0x7'))(_0xac8e('0x8'));var config=require(_0xac8e('0x9'));var jayson=require(_0xac8e('0xa'));var client=jayson[_0xac8e('0xb')][_0xac8e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f42b8,_0x358ebc,_0xd0aae2){return new BPromise(function(_0x15d01e,_0x5938e3){return client[_0xac8e('0xd')](_0x4f42b8,_0xd0aae2)['then'](function(_0x48ef67){logger[_0xac8e('0xe')](_0xac8e('0xf'),_0x358ebc,_0xac8e('0x10'));logger['debug'](_0xac8e('0x11'),_0x358ebc,_0xac8e('0x10'),JSON[_0xac8e('0x12')](_0x48ef67));if(_0x48ef67[_0xac8e('0x13')]){if(_0x48ef67[_0xac8e('0x13')]['code']===0x1f4){logger['error'](_0xac8e('0xf'),_0x358ebc,_0x48ef67[_0xac8e('0x13')][_0xac8e('0x14')]);return _0x5938e3(_0x48ef67['error'][_0xac8e('0x14')]);}logger[_0xac8e('0x13')]('MailServerOut,\x20%s,\x20%s',_0x358ebc,_0x48ef67[_0xac8e('0x13')][_0xac8e('0x14')]);return _0x15d01e(_0x48ef67['error'][_0xac8e('0x14')]);}else{logger[_0xac8e('0xe')](_0xac8e('0xf'),_0x358ebc,_0xac8e('0x10'));_0x15d01e(_0x48ef67['result'][_0xac8e('0x14')]);}})[_0xac8e('0x15')](function(_0x3338a0){logger[_0xac8e('0x13')](_0xac8e('0xf'),_0x358ebc,_0x3338a0);_0x5938e3(_0x3338a0);});});} \ No newline at end of file +var _0x5fe5=['MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0xa3356c,_0x245e7f){var _0x21312a=function(_0x1789d4){while(--_0x1789d4){_0xa3356c['push'](_0xa3356c['shift']());}};_0x21312a(++_0x245e7f);}(_0x5fe5,0x1a7));var _0x55fe=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0x5fe5[_0x29e3b6];return _0x55d4b0;};'use strict';var _=require(_0x55fe('0x0'));var util=require(_0x55fe('0x1'));var moment=require(_0x55fe('0x2'));var BPromise=require(_0x55fe('0x3'));var rs=require(_0x55fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55fe('0x5'))['db'];var utils=require(_0x55fe('0x6'));var logger=require(_0x55fe('0x7'))(_0x55fe('0x8'));var config=require(_0x55fe('0x9'));var jayson=require(_0x55fe('0xa'));var client=jayson['client'][_0x55fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x266b55,_0x3f64d0,_0x3becf4){return new BPromise(function(_0x270dbc,_0x52667f){return client[_0x55fe('0xc')](_0x266b55,_0x3becf4)['then'](function(_0x8ac7ca){logger[_0x55fe('0xd')](_0x55fe('0xe'),_0x3f64d0,_0x55fe('0xf'));logger[_0x55fe('0x10')](_0x55fe('0x11'),_0x3f64d0,_0x55fe('0xf'),JSON[_0x55fe('0x12')](_0x8ac7ca));if(_0x8ac7ca[_0x55fe('0x13')]){if(_0x8ac7ca[_0x55fe('0x13')][_0x55fe('0x14')]===0x1f4){logger[_0x55fe('0x13')](_0x55fe('0xe'),_0x3f64d0,_0x8ac7ca[_0x55fe('0x13')][_0x55fe('0x15')]);return _0x52667f(_0x8ac7ca[_0x55fe('0x13')][_0x55fe('0x15')]);}logger[_0x55fe('0x13')](_0x55fe('0xe'),_0x3f64d0,_0x8ac7ca['error'][_0x55fe('0x15')]);return _0x270dbc(_0x8ac7ca[_0x55fe('0x13')][_0x55fe('0x15')]);}else{logger['info'](_0x55fe('0xe'),_0x3f64d0,_0x55fe('0xf'));_0x270dbc(_0x8ac7ca['result'][_0x55fe('0x15')]);}})[_0x55fe('0x16')](function(_0x436ed7){logger['error'](_0x55fe('0xe'),_0x3f64d0,_0x436ed7);_0x52667f(_0x436ed7);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 528eacc..e97a786 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 _0xa5f4=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','post','put','/:id','update','delete','destroy','multer','path'];(function(_0x31de3c,_0x55a229){var _0x58e00d=function(_0x2b4a12){while(--_0x2b4a12){_0x31de3c['push'](_0x31de3c['shift']());}};_0x58e00d(++_0x55a229);}(_0xa5f4,0x1f2));var _0x4a5f=function(_0x1534a7,_0x28dc30){_0x1534a7=_0x1534a7-0x0;var _0x4735ce=_0xa5f4[_0x1534a7];return _0x4735ce;};'use strict';var multer=require(_0x4a5f('0x0'));var util=require('util');var path=require(_0x4a5f('0x1'));var timeout=require(_0x4a5f('0x2'));var express=require(_0x4a5f('0x3'));var router=express[_0x4a5f('0x4')]();var auth=require(_0x4a5f('0x5'));var interaction=require(_0x4a5f('0x6'));var config=require(_0x4a5f('0x7'));var controller=require(_0x4a5f('0x8'));router['get']('/',auth[_0x4a5f('0x9')](),controller[_0x4a5f('0xa')]);router[_0x4a5f('0xb')](_0x4a5f('0xc'),auth[_0x4a5f('0x9')](),controller[_0x4a5f('0xd')]);router['get']('/:id',auth[_0x4a5f('0x9')](),controller['show']);router[_0x4a5f('0xe')]('/',auth[_0x4a5f('0x9')](),controller['create']);router[_0x4a5f('0xf')](_0x4a5f('0x10'),auth[_0x4a5f('0x9')](),controller[_0x4a5f('0x11')]);router[_0x4a5f('0x12')](_0x4a5f('0x10'),auth[_0x4a5f('0x9')](),controller[_0x4a5f('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdb74=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x4a8ef4,_0x3c5443){var _0x1528b8=function(_0x5d8902){while(--_0x5d8902){_0x4a8ef4['push'](_0x4a8ef4['shift']());}};_0x1528b8(++_0x3c5443);}(_0xdb74,0x67));var _0x4db7=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xdb74[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require(_0x4db7('0x0'));var path=require('path');var timeout=require(_0x4db7('0x1'));var express=require(_0x4db7('0x2'));var router=express[_0x4db7('0x3')]();var auth=require(_0x4db7('0x4'));var interaction=require(_0x4db7('0x5'));var config=require(_0x4db7('0x6'));var controller=require(_0x4db7('0x7'));router['get']('/',auth[_0x4db7('0x8')](),controller[_0x4db7('0x9')]);router[_0x4db7('0xa')]('/describe',auth[_0x4db7('0x8')](),controller[_0x4db7('0xb')]);router[_0x4db7('0xa')](_0x4db7('0xc'),auth['isAuthenticated'](),controller[_0x4db7('0xd')]);router[_0x4db7('0xe')]('/',auth[_0x4db7('0x8')](),controller[_0x4db7('0xf')]);router[_0x4db7('0x10')](_0x4db7('0xc'),auth['isAuthenticated'](),controller[_0x4db7('0x11')]);router[_0x4db7('0x12')](_0x4db7('0xc'),auth[_0x4db7('0x8')](),controller[_0x4db7('0x13')]);module[_0x4db7('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 ea7fde9..698f920 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 _0x323f=['name','STRING','exports'];(function(_0x58ab22,_0x42c988){var _0x3bedba=function(_0x121f16){while(--_0x121f16){_0x58ab22['push'](_0x58ab22['shift']());}};_0x3bedba(++_0x42c988);}(_0x323f,0x1ee));var _0xf323=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x323f[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require('sequelize');module[_0xf323('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xf323('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf323('0x2')]}}; \ No newline at end of file +var _0x5360=['exports','STRING','name','sequelize'];(function(_0x6aae6c,_0x5bf37e){var _0x1a8f58=function(_0xf03250){while(--_0xf03250){_0x6aae6c['push'](_0x6aae6c['shift']());}};_0x1a8f58(++_0x5bf37e);}(_0x5360,0x157));var _0x0536=function(_0x56d0d3,_0xe98c44){_0x56d0d3=_0x56d0d3-0x0;var _0x539438=_0x5360[_0x56d0d3];return _0x539438;};'use strict';var Sequelize=require(_0x0536('0x0'));module[_0x0536('0x1')]={'name':{'type':Sequelize[_0x0536('0x2')],'unique':_0x0536('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 1576d3a..74ae39a 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 _0x9b30=['rawAttributes','fields','length','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','catch','show','params'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x9b30,0xee));var _0x09b3=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x9b30[_0x13b8f3];return _0x1a6d06;};'use strict';var pdf=require(_0x09b3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x09b3('0x1'));var jsonpatch=require(_0x09b3('0x2'));var rp=require(_0x09b3('0x3'));var moment=require(_0x09b3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x09b3('0x5'));var util=require(_0x09b3('0x6'));var path=require(_0x09b3('0x7'));var sox=require(_0x09b3('0x8'));var csv=require(_0x09b3('0x9'));var ejs=require(_0x09b3('0xa'));var fs=require('fs');var _=require(_0x09b3('0xb'));var squel=require(_0x09b3('0xc'));var crypto=require('crypto');var jsforce=require(_0x09b3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x09b3('0x9'));var querystring=require('querystring');var Papa=require(_0x09b3('0xe'));var Redis=require(_0x09b3('0xf'));var authService=require(_0x09b3('0x10'));var qs=require(_0x09b3('0x11'));var as=require(_0x09b3('0x12'));var hardwareService=require(_0x09b3('0x13'));var logger=require(_0x09b3('0x14'))(_0x09b3('0x15'));var utils=require(_0x09b3('0x16'));var config=require(_0x09b3('0x17'));var db=require(_0x09b3('0x18'))['db'];function respondWithStatusCode(_0x8ec91a,_0x483bff){_0x483bff=_0x483bff||0xcc;return function(_0x36ce2f){if(_0x36ce2f){return _0x8ec91a['sendStatus'](_0x483bff);}return _0x8ec91a['status'](_0x483bff)[_0x09b3('0x19')]();};}function respondWithResult(_0x186590,_0x224a58){_0x224a58=_0x224a58||0xc8;return function(_0x1c305f){if(_0x1c305f){return _0x186590['status'](_0x224a58)[_0x09b3('0x1a')](_0x1c305f);}};}function respondWithFilteredResult(_0x21d75f,_0x132330){return function(_0x3d7da9){if(_0x3d7da9){var _0x3d46c9=_0x3d7da9[_0x09b3('0x1b')],_0x2137cd=_0x132330[_0x09b3('0x1c')],_0xb822cc=_0x132330[_0x09b3('0x1c')]+_0x132330[_0x09b3('0x1d')],_0x3c73e7;if(_0xb822cc>=_0x3d46c9){_0xb822cc=_0x3d46c9;_0x3c73e7=0xc8;}else{_0x3c73e7=0xce;}_0x21d75f[_0x09b3('0x1e')](_0x3c73e7);return _0x21d75f['set'](_0x09b3('0x1f'),_0x2137cd+'-'+_0xb822cc+'/'+_0x3d46c9)['json'](_0x3d7da9);}return null;};}function patchUpdates(_0x550d79){return function(_0x2316dc){try{jsonpatch[_0x09b3('0x20')](_0x2316dc,_0x550d79,!![]);}catch(_0x5cd790){return BPromise[_0x09b3('0x21')](_0x5cd790);}return _0x2316dc[_0x09b3('0x22')]();};}function saveUpdates(_0x175640,_0x486b3e){return function(_0x3d9b2a){if(_0x3d9b2a){return _0x3d9b2a[_0x09b3('0x23')](_0x175640)[_0x09b3('0x24')](function(_0x1e1a58){return _0x1e1a58;});}return null;};}function removeEntity(_0x12f5a6,_0x4362a9){return function(_0x1cbe98){if(_0x1cbe98){return _0x1cbe98[_0x09b3('0x25')]()[_0x09b3('0x24')](function(){_0x12f5a6[_0x09b3('0x1e')](0xcc)[_0x09b3('0x19')]();});}};}function handleEntityNotFound(_0x209b4f,_0xe3d2eb){return function(_0x15039f){if(!_0x15039f){_0x209b4f[_0x09b3('0x26')](0x194);}return _0x15039f;};}function handleError(_0xb24313,_0x3cc212){_0x3cc212=_0x3cc212||0x1f4;return function(_0x8b23e0){logger[_0x09b3('0x27')](_0x8b23e0[_0x09b3('0x28')]);if(_0x8b23e0['name']){delete _0x8b23e0[_0x09b3('0x29')];}_0xb24313['status'](_0x3cc212)[_0x09b3('0x2a')](_0x8b23e0);};}exports[_0x09b3('0x2b')]=function(_0x365504,_0x36f47a){var _0xb46cff={},_0x4b1635={},_0x30ed0b={'count':0x0,'rows':[]};var _0x1cc1d0=_[_0x09b3('0x2c')](db['MailSubstatus']['rawAttributes'],function(_0x468b93){return{'name':_0x468b93['fieldName'],'type':_0x468b93['type'][_0x09b3('0x2d')]};});_0x4b1635[_0x09b3('0x2e')]=_[_0x09b3('0x2c')](_0x1cc1d0,_0x09b3('0x29'));_0x4b1635[_0x09b3('0x2f')]=_[_0x09b3('0x30')](_0x365504['query']);_0x4b1635[_0x09b3('0x31')]=_[_0x09b3('0x32')](_0x4b1635[_0x09b3('0x2e')],_0x4b1635['query']);_0xb46cff['attributes']=_[_0x09b3('0x32')](_0x4b1635[_0x09b3('0x2e')],qs['fields'](_0x365504['query']['fields']));_0xb46cff[_0x09b3('0x33')]=_0xb46cff[_0x09b3('0x33')]['length']?_0xb46cff[_0x09b3('0x33')]:_0x4b1635[_0x09b3('0x2e')];if(!_0x365504[_0x09b3('0x2f')][_0x09b3('0x34')](_0x09b3('0x35'))){_0xb46cff['limit']=qs[_0x09b3('0x1d')](_0x365504[_0x09b3('0x2f')][_0x09b3('0x1d')]);_0xb46cff['offset']=qs[_0x09b3('0x1c')](_0x365504['query'][_0x09b3('0x1c')]);}_0xb46cff[_0x09b3('0x36')]=qs[_0x09b3('0x37')](_0x365504[_0x09b3('0x2f')][_0x09b3('0x37')]);_0xb46cff[_0x09b3('0x38')]=qs[_0x09b3('0x31')](_[_0x09b3('0x39')](_0x365504[_0x09b3('0x2f')],_0x4b1635[_0x09b3('0x31')]),_0x1cc1d0);if(_0x365504[_0x09b3('0x2f')][_0x09b3('0x3a')]){_0xb46cff[_0x09b3('0x38')]=_[_0x09b3('0x3b')](_0xb46cff[_0x09b3('0x38')],{'$or':_[_0x09b3('0x2c')](_0x1cc1d0,function(_0x35f524){if(_0x35f524[_0x09b3('0x3c')]!==_0x09b3('0x3d')){var _0x3e3a28={};_0x3e3a28[_0x35f524[_0x09b3('0x29')]]={'$like':'%'+_0x365504[_0x09b3('0x2f')][_0x09b3('0x3a')]+'%'};return _0x3e3a28;}})});}_0xb46cff=_[_0x09b3('0x3b')]({},_0xb46cff,_0x365504[_0x09b3('0x3e')]);var _0x166c06={'where':_0xb46cff['where']};return db[_0x09b3('0x3f')]['count'](_0x166c06)[_0x09b3('0x24')](function(_0x3fc96d){_0x30ed0b[_0x09b3('0x1b')]=_0x3fc96d;if(_0x365504[_0x09b3('0x2f')][_0x09b3('0x40')]){_0xb46cff[_0x09b3('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0x09b3('0x42')](_0xb46cff);})[_0x09b3('0x24')](function(_0x4fece0){_0x30ed0b['rows']=_0x4fece0;return _0x30ed0b;})['then'](respondWithFilteredResult(_0x36f47a,_0xb46cff))[_0x09b3('0x43')](handleError(_0x36f47a,null));};exports[_0x09b3('0x44')]=function(_0x80d419,_0x39ecda){var _0x5dc899={'raw':!![],'where':{'id':_0x80d419[_0x09b3('0x45')]['id']}},_0x32f262={};_0x32f262[_0x09b3('0x2e')]=_[_0x09b3('0x30')](db['MailSubstatus'][_0x09b3('0x46')]);_0x32f262[_0x09b3('0x2f')]=_[_0x09b3('0x30')](_0x80d419[_0x09b3('0x2f')]);_0x32f262['filters']=_[_0x09b3('0x32')](_0x32f262[_0x09b3('0x2e')],_0x32f262[_0x09b3('0x2f')]);_0x5dc899['attributes']=_['intersection'](_0x32f262[_0x09b3('0x2e')],qs['fields'](_0x80d419[_0x09b3('0x2f')][_0x09b3('0x47')]));_0x5dc899[_0x09b3('0x33')]=_0x5dc899[_0x09b3('0x33')][_0x09b3('0x48')]?_0x5dc899[_0x09b3('0x33')]:_0x32f262[_0x09b3('0x2e')];if(_0x80d419[_0x09b3('0x2f')]['includeAll']){_0x5dc899['include']=[{'all':!![]}];}_0x5dc899=_[_0x09b3('0x3b')]({},_0x5dc899,_0x80d419['options']);return db['MailSubstatus'][_0x09b3('0x49')](_0x5dc899)[_0x09b3('0x24')](handleEntityNotFound(_0x39ecda,null))[_0x09b3('0x24')](respondWithResult(_0x39ecda,null))[_0x09b3('0x43')](handleError(_0x39ecda,null));};exports[_0x09b3('0x4a')]=function(_0x3f4e13,_0x5be3fa){return db[_0x09b3('0x3f')][_0x09b3('0x4a')](_0x3f4e13['body'],{})[_0x09b3('0x24')](respondWithResult(_0x5be3fa,0xc9))[_0x09b3('0x43')](handleError(_0x5be3fa,null));};exports[_0x09b3('0x23')]=function(_0x57ba5e,_0x209691){if(_0x57ba5e[_0x09b3('0x4b')]['id']){delete _0x57ba5e[_0x09b3('0x4b')]['id'];}return db[_0x09b3('0x3f')][_0x09b3('0x49')]({'where':{'id':_0x57ba5e[_0x09b3('0x45')]['id']}})[_0x09b3('0x24')](handleEntityNotFound(_0x209691,null))[_0x09b3('0x24')](saveUpdates(_0x57ba5e[_0x09b3('0x4b')],null))[_0x09b3('0x24')](respondWithResult(_0x209691,null))[_0x09b3('0x43')](handleError(_0x209691,null));};exports[_0x09b3('0x25')]=function(_0x53bf28,_0x35eb57){return db[_0x09b3('0x3f')][_0x09b3('0x49')]({'where':{'id':_0x53bf28[_0x09b3('0x45')]['id']}})[_0x09b3('0x24')](handleEntityNotFound(_0x35eb57,null))[_0x09b3('0x24')](removeEntity(_0x35eb57,null))[_0x09b3('0x43')](handleError(_0x35eb57,null));};exports[_0x09b3('0x4c')]=function(_0x23cfdd,_0x241c6e){return db[_0x09b3('0x3f')][_0x09b3('0x4c')]()[_0x09b3('0x24')](respondWithResult(_0x241c6e,null))[_0x09b3('0x43')](handleError(_0x241c6e,null));}; \ No newline at end of file +var _0xf0ac=['MailSubstatus','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','type','filter'];(function(_0x1974f,_0x137909){var _0x18654d=function(_0x34819b){while(--_0x34819b){_0x1974f['push'](_0x1974f['shift']());}};_0x18654d(++_0x137909);}(_0xf0ac,0xe5));var _0xcf0a=function(_0x4d41bc,_0x1a8bbb){_0x4d41bc=_0x4d41bc-0x0;var _0x51c0f8=_0xf0ac[_0x4d41bc];return _0x51c0f8;};'use strict';var pdf=require(_0xcf0a('0x0'));var emlformat=require(_0xcf0a('0x1'));var rimraf=require(_0xcf0a('0x2'));var zipdir=require(_0xcf0a('0x3'));var jsonpatch=require(_0xcf0a('0x4'));var rp=require(_0xcf0a('0x5'));var moment=require('moment');var BPromise=require(_0xcf0a('0x6'));var Mustache=require(_0xcf0a('0x7'));var util=require(_0xcf0a('0x8'));var path=require('path');var sox=require(_0xcf0a('0x9'));var csv=require('to-csv');var ejs=require(_0xcf0a('0xa'));var fs=require('fs');var _=require(_0xcf0a('0xb'));var squel=require(_0xcf0a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcf0a('0xd'));var querystring=require(_0xcf0a('0xe'));var Papa=require(_0xcf0a('0xf'));var Redis=require(_0xcf0a('0x10'));var authService=require(_0xcf0a('0x11'));var qs=require(_0xcf0a('0x12'));var as=require(_0xcf0a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcf0a('0x14'));var utils=require(_0xcf0a('0x15'));var config=require('../../config/environment');var db=require(_0xcf0a('0x16'))['db'];function respondWithStatusCode(_0x5a71a0,_0x13d700){_0x13d700=_0x13d700||0xcc;return function(_0x399690){if(_0x399690){return _0x5a71a0['sendStatus'](_0x13d700);}return _0x5a71a0[_0xcf0a('0x17')](_0x13d700)[_0xcf0a('0x18')]();};}function respondWithResult(_0x48b55e,_0x3da4d8){_0x3da4d8=_0x3da4d8||0xc8;return function(_0x2a42d9){if(_0x2a42d9){return _0x48b55e[_0xcf0a('0x17')](_0x3da4d8)[_0xcf0a('0x19')](_0x2a42d9);}};}function respondWithFilteredResult(_0x301667,_0x212f08){return function(_0x871c1f){if(_0x871c1f){var _0x206774=_0x871c1f[_0xcf0a('0x1a')],_0x40d133=_0x212f08[_0xcf0a('0x1b')],_0x361f86=_0x212f08[_0xcf0a('0x1b')]+_0x212f08[_0xcf0a('0x1c')],_0x3661d0;if(_0x361f86>=_0x206774){_0x361f86=_0x206774;_0x3661d0=0xc8;}else{_0x3661d0=0xce;}_0x301667[_0xcf0a('0x17')](_0x3661d0);return _0x301667['set'](_0xcf0a('0x1d'),_0x40d133+'-'+_0x361f86+'/'+_0x206774)[_0xcf0a('0x19')](_0x871c1f);}return null;};}function patchUpdates(_0x255916){return function(_0x153112){try{jsonpatch[_0xcf0a('0x1e')](_0x153112,_0x255916,!![]);}catch(_0x575dce){return BPromise[_0xcf0a('0x1f')](_0x575dce);}return _0x153112[_0xcf0a('0x20')]();};}function saveUpdates(_0x555eb9,_0x2208e7){return function(_0x5f4b69){if(_0x5f4b69){return _0x5f4b69[_0xcf0a('0x21')](_0x555eb9)['then'](function(_0x34272d){return _0x34272d;});}return null;};}function removeEntity(_0x4581f2,_0x372531){return function(_0x5d962a){if(_0x5d962a){return _0x5d962a['destroy']()[_0xcf0a('0x22')](function(){_0x4581f2[_0xcf0a('0x17')](0xcc)[_0xcf0a('0x18')]();});}};}function handleEntityNotFound(_0x84395a,_0x12d2ba){return function(_0x2b89d9){if(!_0x2b89d9){_0x84395a[_0xcf0a('0x23')](0x194);}return _0x2b89d9;};}function handleError(_0x50144c,_0x5f7aef){_0x5f7aef=_0x5f7aef||0x1f4;return function(_0x3c5344){logger[_0xcf0a('0x24')](_0x3c5344[_0xcf0a('0x25')]);if(_0x3c5344[_0xcf0a('0x26')]){delete _0x3c5344['name'];}_0x50144c['status'](_0x5f7aef)[_0xcf0a('0x27')](_0x3c5344);};}exports[_0xcf0a('0x28')]=function(_0x2b46e3,_0x3daa0b){var _0x29184b={},_0x18a062={},_0x2cb5a8={'count':0x0,'rows':[]};var _0xf7e65=_[_0xcf0a('0x29')](db['MailSubstatus'][_0xcf0a('0x2a')],function(_0x19ccf6){return{'name':_0x19ccf6[_0xcf0a('0x2b')],'type':_0x19ccf6['type'][_0xcf0a('0x2c')]};});_0x18a062[_0xcf0a('0x2d')]=_[_0xcf0a('0x29')](_0xf7e65,_0xcf0a('0x26'));_0x18a062['query']=_[_0xcf0a('0x2e')](_0x2b46e3[_0xcf0a('0x2f')]);_0x18a062[_0xcf0a('0x30')]=_[_0xcf0a('0x31')](_0x18a062['model'],_0x18a062[_0xcf0a('0x2f')]);_0x29184b[_0xcf0a('0x32')]=_[_0xcf0a('0x31')](_0x18a062['model'],qs[_0xcf0a('0x33')](_0x2b46e3[_0xcf0a('0x2f')][_0xcf0a('0x33')]));_0x29184b['attributes']=_0x29184b[_0xcf0a('0x32')]['length']?_0x29184b['attributes']:_0x18a062['model'];if(!_0x2b46e3[_0xcf0a('0x2f')]['hasOwnProperty'](_0xcf0a('0x34'))){_0x29184b[_0xcf0a('0x1c')]=qs[_0xcf0a('0x1c')](_0x2b46e3[_0xcf0a('0x2f')][_0xcf0a('0x1c')]);_0x29184b['offset']=qs['offset'](_0x2b46e3[_0xcf0a('0x2f')][_0xcf0a('0x1b')]);}_0x29184b['order']=qs[_0xcf0a('0x35')](_0x2b46e3[_0xcf0a('0x2f')][_0xcf0a('0x35')]);_0x29184b[_0xcf0a('0x36')]=qs[_0xcf0a('0x30')](_[_0xcf0a('0x37')](_0x2b46e3[_0xcf0a('0x2f')],_0x18a062[_0xcf0a('0x30')]),_0xf7e65);if(_0x2b46e3['query']['filter']){_0x29184b['where']=_[_0xcf0a('0x38')](_0x29184b[_0xcf0a('0x36')],{'$or':_[_0xcf0a('0x29')](_0xf7e65,function(_0x3f2949){if(_0x3f2949[_0xcf0a('0x39')]!=='VIRTUAL'){var _0x3fb28f={};_0x3fb28f[_0x3f2949[_0xcf0a('0x26')]]={'$like':'%'+_0x2b46e3[_0xcf0a('0x2f')][_0xcf0a('0x3a')]+'%'};return _0x3fb28f;}})});}_0x29184b=_[_0xcf0a('0x38')]({},_0x29184b,_0x2b46e3['options']);var _0x47e346={'where':_0x29184b[_0xcf0a('0x36')]};return db[_0xcf0a('0x3b')][_0xcf0a('0x1a')](_0x47e346)[_0xcf0a('0x22')](function(_0x444925){_0x2cb5a8[_0xcf0a('0x1a')]=_0x444925;if(_0x2b46e3[_0xcf0a('0x2f')][_0xcf0a('0x3c')]){_0x29184b[_0xcf0a('0x3d')]=[{'all':!![]}];}return db[_0xcf0a('0x3b')][_0xcf0a('0x3e')](_0x29184b);})[_0xcf0a('0x22')](function(_0x1d25ca){_0x2cb5a8['rows']=_0x1d25ca;return _0x2cb5a8;})[_0xcf0a('0x22')](respondWithFilteredResult(_0x3daa0b,_0x29184b))[_0xcf0a('0x3f')](handleError(_0x3daa0b,null));};exports[_0xcf0a('0x40')]=function(_0x31b57f,_0x25579d){var _0x4e4293={'raw':!![],'where':{'id':_0x31b57f[_0xcf0a('0x41')]['id']}},_0x1a9422={};_0x1a9422['model']=_[_0xcf0a('0x2e')](db['MailSubstatus'][_0xcf0a('0x2a')]);_0x1a9422[_0xcf0a('0x2f')]=_[_0xcf0a('0x2e')](_0x31b57f[_0xcf0a('0x2f')]);_0x1a9422[_0xcf0a('0x30')]=_[_0xcf0a('0x31')](_0x1a9422['model'],_0x1a9422[_0xcf0a('0x2f')]);_0x4e4293[_0xcf0a('0x32')]=_[_0xcf0a('0x31')](_0x1a9422[_0xcf0a('0x2d')],qs['fields'](_0x31b57f[_0xcf0a('0x2f')][_0xcf0a('0x33')]));_0x4e4293[_0xcf0a('0x32')]=_0x4e4293[_0xcf0a('0x32')]['length']?_0x4e4293['attributes']:_0x1a9422[_0xcf0a('0x2d')];if(_0x31b57f[_0xcf0a('0x2f')][_0xcf0a('0x3c')]){_0x4e4293[_0xcf0a('0x3d')]=[{'all':!![]}];}_0x4e4293=_[_0xcf0a('0x38')]({},_0x4e4293,_0x31b57f[_0xcf0a('0x42')]);return db[_0xcf0a('0x3b')]['find'](_0x4e4293)[_0xcf0a('0x22')](handleEntityNotFound(_0x25579d,null))[_0xcf0a('0x22')](respondWithResult(_0x25579d,null))[_0xcf0a('0x3f')](handleError(_0x25579d,null));};exports[_0xcf0a('0x43')]=function(_0x2ab7de,_0x44672c){return db[_0xcf0a('0x3b')][_0xcf0a('0x43')](_0x2ab7de[_0xcf0a('0x44')],{})[_0xcf0a('0x22')](respondWithResult(_0x44672c,0xc9))[_0xcf0a('0x3f')](handleError(_0x44672c,null));};exports[_0xcf0a('0x21')]=function(_0xae7a9,_0x25292e){if(_0xae7a9[_0xcf0a('0x44')]['id']){delete _0xae7a9[_0xcf0a('0x44')]['id'];}return db[_0xcf0a('0x3b')][_0xcf0a('0x45')]({'where':{'id':_0xae7a9[_0xcf0a('0x41')]['id']}})[_0xcf0a('0x22')](handleEntityNotFound(_0x25292e,null))[_0xcf0a('0x22')](saveUpdates(_0xae7a9['body'],null))['then'](respondWithResult(_0x25292e,null))[_0xcf0a('0x3f')](handleError(_0x25292e,null));};exports[_0xcf0a('0x46')]=function(_0xb97741,_0x47aaab){return db[_0xcf0a('0x3b')]['find']({'where':{'id':_0xb97741[_0xcf0a('0x41')]['id']}})[_0xcf0a('0x22')](handleEntityNotFound(_0x47aaab,null))[_0xcf0a('0x22')](removeEntity(_0x47aaab,null))['catch'](handleError(_0x47aaab,null));};exports[_0xcf0a('0x47')]=function(_0x5c623a,_0x2afbdc){return db[_0xcf0a('0x3b')][_0xcf0a('0x47')]()[_0xcf0a('0x22')](respondWithResult(_0x2afbdc,null))[_0xcf0a('0x3f')](handleError(_0x2afbdc,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index ab07ac3..dd282de 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 _0x8d98=['rimraf','../../config/environment','exports','define','MailSubstatus','mail_substatuses','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8d98,0xc6));var _0x88d9=function(_0x5d5da5,_0x530556){_0x5d5da5=_0x5d5da5-0x0;var _0x3e5ec5=_0x8d98[_0x5d5da5];return _0x3e5ec5;};'use strict';var _=require('lodash');var util=require(_0x88d9('0x0'));var logger=require(_0x88d9('0x1'))(_0x88d9('0x2'));var moment=require(_0x88d9('0x3'));var BPromise=require('bluebird');var rp=require(_0x88d9('0x4'));var fs=require('fs');var path=require(_0x88d9('0x5'));var rimraf=require(_0x88d9('0x6'));var config=require(_0x88d9('0x7'));var attributes=require('./mailSubstatus.attributes');module[_0x88d9('0x8')]=function(_0x14e686,_0x48b56e){return _0x14e686[_0x88d9('0x9')](_0x88d9('0xa'),attributes,{'tableName':_0x88d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb66=['request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','mail_substatuses','util','../../config/logger','api','moment','bluebird'];(function(_0x1dd781,_0x17161a){var _0x540451=function(_0x1a4ebe){while(--_0x1a4ebe){_0x1dd781['push'](_0x1dd781['shift']());}};_0x540451(++_0x17161a);}(_0xdb66,0x73));var _0x6db6=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xdb66[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var util=require(_0x6db6('0x0'));var logger=require(_0x6db6('0x1'))(_0x6db6('0x2'));var moment=require(_0x6db6('0x3'));var BPromise=require(_0x6db6('0x4'));var rp=require(_0x6db6('0x5'));var fs=require('fs');var path=require(_0x6db6('0x6'));var rimraf=require(_0x6db6('0x7'));var config=require('../../config/environment');var attributes=require(_0x6db6('0x8'));module[_0x6db6('0x9')]=function(_0x2c97a2,_0x49f659){return _0x2c97a2[_0x6db6('0xa')]('MailSubstatus',attributes,{'tableName':_0x6db6('0xb'),'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 ba8ee62..7fbfff4 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x3fbb0a,_0x28a2dd){var _0x57139e=function(_0x209c0c){while(--_0x209c0c){_0x3fbb0a['push'](_0x3fbb0a['shift']());}};_0x57139e(++_0x28a2dd);}(_0x54ef,0x112));var _0xf54e=function(_0x1c3372,_0x2de696){_0x1c3372=_0x1c3372-0x0;var _0x4c5a76=_0x54ef[_0x1c3372];return _0x4c5a76;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result'];(function(_0x25fb88,_0x5922a3){var _0x16f6f8=function(_0x1f8377){while(--_0x1f8377){_0x25fb88['push'](_0x25fb88['shift']());}};_0x16f6f8(++_0x5922a3);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1be790,_0x112549){_0x1be790=_0x1be790-0x0;var _0x7668c8=_0xf3cd[_0x1be790];return _0x7668c8;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index a4d829b..3294eec 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 _0x4606=['/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x31de92,_0x2e2469){var _0x3bd859=function(_0x5097ba){while(--_0x5097ba){_0x31de92['push'](_0x31de92['shift']());}};_0x3bd859(++_0x2e2469);}(_0x4606,0xc5));var _0x6460=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4606[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6460('0x0'));var util=require(_0x6460('0x1'));var path=require('path');var timeout=require(_0x6460('0x2'));var express=require(_0x6460('0x3'));var router=express[_0x6460('0x4')]();var auth=require(_0x6460('0x5'));var interaction=require(_0x6460('0x6'));var config=require(_0x6460('0x7'));var controller=require('./mailTransferReport.controller');router[_0x6460('0x8')]('/',auth[_0x6460('0x9')](),controller[_0x6460('0xa')]);router['get'](_0x6460('0xb'),auth[_0x6460('0x9')](),controller[_0x6460('0xc')]);router[_0x6460('0x8')](_0x6460('0xd'),auth[_0x6460('0x9')](),controller[_0x6460('0xe')]);router[_0x6460('0xf')]('/',auth['isAuthenticated'](),controller[_0x6460('0x10')]);router[_0x6460('0x11')](_0x6460('0xd'),auth[_0x6460('0x9')](),controller[_0x6460('0x12')]);router[_0x6460('0x13')](_0x6460('0xd'),auth[_0x6460('0x9')](),controller[_0x6460('0x14')]);module['exports']=router; \ No newline at end of file +var _0xdd58=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x20cc29,_0x30a46d){var _0x28d513=function(_0x179b06){while(--_0x179b06){_0x20cc29['push'](_0x20cc29['shift']());}};_0x28d513(++_0x30a46d);}(_0xdd58,0x12d));var _0x8dd5=function(_0x15db2b,_0xf3995d){_0x15db2b=_0x15db2b-0x0;var _0x3f54e2=_0xdd58[_0x15db2b];return _0x3f54e2;};'use strict';var multer=require('multer');var util=require(_0x8dd5('0x0'));var path=require(_0x8dd5('0x1'));var timeout=require(_0x8dd5('0x2'));var express=require(_0x8dd5('0x3'));var router=express['Router']();var auth=require(_0x8dd5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8dd5('0x5'));var controller=require(_0x8dd5('0x6'));router[_0x8dd5('0x7')]('/',auth[_0x8dd5('0x8')](),controller['index']);router['get']('/describe',auth[_0x8dd5('0x8')](),controller[_0x8dd5('0x9')]);router['get'](_0x8dd5('0xa'),auth['isAuthenticated'](),controller[_0x8dd5('0xb')]);router[_0x8dd5('0xc')]('/',auth[_0x8dd5('0x8')](),controller[_0x8dd5('0xd')]);router[_0x8dd5('0xe')](_0x8dd5('0xa'),auth['isAuthenticated'](),controller[_0x8dd5('0xf')]);router['delete'](_0x8dd5('0xa'),auth['isAuthenticated'](),controller[_0x8dd5('0x10')]);module[_0x8dd5('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 4a51dd0..47c9de8 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 _0x4323=['STRING','account','agent','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x145042,_0x458dd4){var _0x214a0c=function(_0x4c88ac){while(--_0x4c88ac){_0x145042['push'](_0x145042['shift']());}};_0x214a0c(++_0x458dd4);}(_0x4323,0x84));var _0x3432=function(_0x31055b,_0x112394){_0x31055b=_0x31055b-0x0;var _0xb3e22f=_0x4323[_0x31055b];return _0xb3e22f;};'use strict';var moment=require(_0x3432('0x0'));var Sequelize=require(_0x3432('0x1'));module[_0x3432('0x2')]={'uniqueid':{'type':Sequelize[_0x3432('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3432('0x4'),_0x3432('0x5'),_0x3432('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x3432('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x3432('0x8')]}}; \ No newline at end of file +var _0xc6e9=['sequelize','exports','ENUM','agent','queue','NOW','moment'];(function(_0x3984cc,_0x1c4850){var _0x3242dc=function(_0x3eb90e){while(--_0x3eb90e){_0x3984cc['push'](_0x3984cc['shift']());}};_0x3242dc(++_0x1c4850);}(_0xc6e9,0x172));var _0x9c6e=function(_0x253e1b,_0x448910){_0x253e1b=_0x253e1b-0x0;var _0x3ae787=_0xc6e9[_0x253e1b];return _0x3ae787;};'use strict';var moment=require(_0x9c6e('0x0'));var Sequelize=require(_0x9c6e('0x1'));module[_0x9c6e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9c6e('0x3')]('account',_0x9c6e('0x4'),_0x9c6e('0x5')),'allowNull':![],'defaultValue':_0x9c6e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9c6e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 4b30c11..f7e2d60 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 _0x8824=['describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','status','end','offset','limit','set','Content-Range','json','save','update','destroy','then','sendStatus','error','name','send','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','count','includeAll','include','MailTransferReport','rows','catch','params','keys','options','find','create','body'];(function(_0x31dd7e,_0x72d5da){var _0x2a6bfd=function(_0x34a241){while(--_0x34a241){_0x31dd7e['push'](_0x31dd7e['shift']());}};_0x2a6bfd(++_0x72d5da);}(_0x8824,0x169));var _0x4882=function(_0x58a0f2,_0xda36f5){_0x58a0f2=_0x58a0f2-0x0;var _0x590bb=_0x8824[_0x58a0f2];return _0x590bb;};'use strict';var pdf=require(_0x4882('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4882('0x1'));var zipdir=require(_0x4882('0x2'));var jsonpatch=require(_0x4882('0x3'));var rp=require(_0x4882('0x4'));var moment=require(_0x4882('0x5'));var BPromise=require(_0x4882('0x6'));var Mustache=require(_0x4882('0x7'));var util=require(_0x4882('0x8'));var path=require('path');var sox=require(_0x4882('0x9'));var csv=require(_0x4882('0xa'));var ejs=require(_0x4882('0xb'));var fs=require('fs');var _=require(_0x4882('0xc'));var squel=require('squel');var crypto=require(_0x4882('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4882('0xe'));var toCsv=require(_0x4882('0xa'));var querystring=require(_0x4882('0xf'));var Papa=require(_0x4882('0x10'));var Redis=require(_0x4882('0x11'));var authService=require(_0x4882('0x12'));var qs=require(_0x4882('0x13'));var as=require(_0x4882('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4882('0x15'))(_0x4882('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9a9250,_0x405a9f){_0x405a9f=_0x405a9f||0xcc;return function(_0x41577d){if(_0x41577d){return _0x9a9250['sendStatus'](_0x405a9f);}return _0x9a9250[_0x4882('0x17')](_0x405a9f)[_0x4882('0x18')]();};}function respondWithResult(_0x1a283d,_0x12e84a){_0x12e84a=_0x12e84a||0xc8;return function(_0x2fae21){if(_0x2fae21){return _0x1a283d[_0x4882('0x17')](_0x12e84a)['json'](_0x2fae21);}};}function respondWithFilteredResult(_0xe5b5f3,_0xf0ef1d){return function(_0x43dfa9){if(_0x43dfa9){var _0x528379=_0x43dfa9['count'],_0x2360c3=_0xf0ef1d['offset'],_0x57e1dd=_0xf0ef1d[_0x4882('0x19')]+_0xf0ef1d[_0x4882('0x1a')],_0x139080;if(_0x57e1dd>=_0x528379){_0x57e1dd=_0x528379;_0x139080=0xc8;}else{_0x139080=0xce;}_0xe5b5f3[_0x4882('0x17')](_0x139080);return _0xe5b5f3[_0x4882('0x1b')](_0x4882('0x1c'),_0x2360c3+'-'+_0x57e1dd+'/'+_0x528379)[_0x4882('0x1d')](_0x43dfa9);}return null;};}function patchUpdates(_0x2a7128){return function(_0x1be32f){try{jsonpatch['apply'](_0x1be32f,_0x2a7128,!![]);}catch(_0x283d0e){return BPromise['reject'](_0x283d0e);}return _0x1be32f[_0x4882('0x1e')]();};}function saveUpdates(_0x30fd3f,_0x4d2832){return function(_0x105701){if(_0x105701){return _0x105701[_0x4882('0x1f')](_0x30fd3f)['then'](function(_0x4915bd){return _0x4915bd;});}return null;};}function removeEntity(_0x3efc7f,_0x50ede6){return function(_0x7eadf0){if(_0x7eadf0){return _0x7eadf0[_0x4882('0x20')]()[_0x4882('0x21')](function(){_0x3efc7f[_0x4882('0x17')](0xcc)[_0x4882('0x18')]();});}};}function handleEntityNotFound(_0x267e0e,_0x586abb){return function(_0x4480ec){if(!_0x4480ec){_0x267e0e[_0x4882('0x22')](0x194);}return _0x4480ec;};}function handleError(_0x604430,_0x157cf8){_0x157cf8=_0x157cf8||0x1f4;return function(_0x3b58f4){logger[_0x4882('0x23')](_0x3b58f4['stack']);if(_0x3b58f4[_0x4882('0x24')]){delete _0x3b58f4[_0x4882('0x24')];}_0x604430[_0x4882('0x17')](_0x157cf8)[_0x4882('0x25')](_0x3b58f4);};}exports['index']=function(_0x248b2c,_0x4e33f8){var _0x3334b9={},_0x211f22={},_0x38bdc3={'count':0x0,'rows':[]};var _0x353cf9=_['map'](db['MailTransferReport'][_0x4882('0x26')],function(_0x239176){return{'name':_0x239176[_0x4882('0x27')],'type':_0x239176['type'][_0x4882('0x28')]};});_0x211f22['model']=_['map'](_0x353cf9,_0x4882('0x24'));_0x211f22[_0x4882('0x29')]=_['keys'](_0x248b2c[_0x4882('0x29')]);_0x211f22[_0x4882('0x2a')]=_[_0x4882('0x2b')](_0x211f22[_0x4882('0x2c')],_0x211f22['query']);_0x3334b9['attributes']=_[_0x4882('0x2b')](_0x211f22['model'],qs[_0x4882('0x2d')](_0x248b2c[_0x4882('0x29')]['fields']));_0x3334b9['attributes']=_0x3334b9[_0x4882('0x2e')][_0x4882('0x2f')]?_0x3334b9[_0x4882('0x2e')]:_0x211f22[_0x4882('0x2c')];if(!_0x248b2c[_0x4882('0x29')][_0x4882('0x30')](_0x4882('0x31'))){_0x3334b9[_0x4882('0x1a')]=qs[_0x4882('0x1a')](_0x248b2c['query']['limit']);_0x3334b9['offset']=qs[_0x4882('0x19')](_0x248b2c[_0x4882('0x29')]['offset']);}_0x3334b9[_0x4882('0x32')]=qs[_0x4882('0x33')](_0x248b2c[_0x4882('0x29')][_0x4882('0x33')]);_0x3334b9[_0x4882('0x34')]=qs[_0x4882('0x2a')](_[_0x4882('0x35')](_0x248b2c[_0x4882('0x29')],_0x211f22[_0x4882('0x2a')]),_0x353cf9);if(_0x248b2c[_0x4882('0x29')][_0x4882('0x36')]){_0x3334b9[_0x4882('0x34')]=_[_0x4882('0x37')](_0x3334b9[_0x4882('0x34')],{'$or':_[_0x4882('0x38')](_0x353cf9,function(_0x2a6e11){if(_0x2a6e11[_0x4882('0x39')]!==_0x4882('0x3a')){var _0x417b6f={};_0x417b6f[_0x2a6e11[_0x4882('0x24')]]={'$like':'%'+_0x248b2c['query'][_0x4882('0x36')]+'%'};return _0x417b6f;}})});}_0x3334b9=_[_0x4882('0x37')]({},_0x3334b9,_0x248b2c['options']);var _0x2874a4={'where':_0x3334b9[_0x4882('0x34')]};return db['MailTransferReport'][_0x4882('0x3b')](_0x2874a4)[_0x4882('0x21')](function(_0x975770){_0x38bdc3[_0x4882('0x3b')]=_0x975770;if(_0x248b2c[_0x4882('0x29')][_0x4882('0x3c')]){_0x3334b9[_0x4882('0x3d')]=[{'all':!![]}];}return db[_0x4882('0x3e')]['findAll'](_0x3334b9);})[_0x4882('0x21')](function(_0xecfaea){_0x38bdc3[_0x4882('0x3f')]=_0xecfaea;return _0x38bdc3;})[_0x4882('0x21')](respondWithFilteredResult(_0x4e33f8,_0x3334b9))[_0x4882('0x40')](handleError(_0x4e33f8,null));};exports['show']=function(_0x4d21cd,_0x3618de){var _0x512408={'raw':!![],'where':{'id':_0x4d21cd[_0x4882('0x41')]['id']}},_0x286dfd={};_0x286dfd[_0x4882('0x2c')]=_[_0x4882('0x42')](db['MailTransferReport'][_0x4882('0x26')]);_0x286dfd[_0x4882('0x29')]=_[_0x4882('0x42')](_0x4d21cd[_0x4882('0x29')]);_0x286dfd[_0x4882('0x2a')]=_[_0x4882('0x2b')](_0x286dfd[_0x4882('0x2c')],_0x286dfd[_0x4882('0x29')]);_0x512408[_0x4882('0x2e')]=_['intersection'](_0x286dfd[_0x4882('0x2c')],qs[_0x4882('0x2d')](_0x4d21cd[_0x4882('0x29')][_0x4882('0x2d')]));_0x512408[_0x4882('0x2e')]=_0x512408['attributes'][_0x4882('0x2f')]?_0x512408['attributes']:_0x286dfd[_0x4882('0x2c')];if(_0x4d21cd[_0x4882('0x29')][_0x4882('0x3c')]){_0x512408[_0x4882('0x3d')]=[{'all':!![]}];}_0x512408=_['merge']({},_0x512408,_0x4d21cd[_0x4882('0x43')]);return db[_0x4882('0x3e')][_0x4882('0x44')](_0x512408)[_0x4882('0x21')](handleEntityNotFound(_0x3618de,null))['then'](respondWithResult(_0x3618de,null))[_0x4882('0x40')](handleError(_0x3618de,null));};exports[_0x4882('0x45')]=function(_0x72dee0,_0x4e5e2b){return db[_0x4882('0x3e')][_0x4882('0x45')](_0x72dee0[_0x4882('0x46')],{})[_0x4882('0x21')](respondWithResult(_0x4e5e2b,0xc9))['catch'](handleError(_0x4e5e2b,null));};exports[_0x4882('0x1f')]=function(_0x47c8c6,_0xeefa8c){if(_0x47c8c6['body']['id']){delete _0x47c8c6[_0x4882('0x46')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x47c8c6[_0x4882('0x41')]['id']}})['then'](handleEntityNotFound(_0xeefa8c,null))[_0x4882('0x21')](saveUpdates(_0x47c8c6[_0x4882('0x46')],null))['then'](respondWithResult(_0xeefa8c,null))['catch'](handleError(_0xeefa8c,null));};exports[_0x4882('0x20')]=function(_0x12c88c,_0x3273ec){return db[_0x4882('0x3e')][_0x4882('0x44')]({'where':{'id':_0x12c88c[_0x4882('0x41')]['id']}})[_0x4882('0x21')](handleEntityNotFound(_0x3273ec,null))[_0x4882('0x21')](removeEntity(_0x3273ec,null))[_0x4882('0x40')](handleError(_0x3273ec,null));};exports[_0x4882('0x47')]=function(_0x1f160c,_0x3b1f17){return db[_0x4882('0x3e')][_0x4882('0x47')]()[_0x4882('0x21')](respondWithResult(_0x3b1f17,null))[_0x4882('0x40')](handleError(_0x3b1f17,null));}; \ No newline at end of file +var _0x499c=['model','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','options','includeAll','findAll','rows','catch','include','find','create','body','params','describe','html-pdf','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','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','map','keys','query','intersection','attributes'];(function(_0xc4d8b0,_0x572cc3){var _0x796e24=function(_0xe702f2){while(--_0xe702f2){_0xc4d8b0['push'](_0xc4d8b0['shift']());}};_0x796e24(++_0x572cc3);}(_0x499c,0xfa));var _0xc499=function(_0x2ccbf4,_0x230c9e){_0x2ccbf4=_0x2ccbf4-0x0;var _0x5782dc=_0x499c[_0x2ccbf4];return _0x5782dc;};'use strict';var pdf=require(_0xc499('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc499('0x1'));var jsonpatch=require(_0xc499('0x2'));var rp=require(_0xc499('0x3'));var moment=require(_0xc499('0x4'));var BPromise=require(_0xc499('0x5'));var Mustache=require(_0xc499('0x6'));var util=require(_0xc499('0x7'));var path=require('path');var sox=require(_0xc499('0x8'));var csv=require(_0xc499('0x9'));var ejs=require(_0xc499('0xa'));var fs=require('fs');var _=require(_0xc499('0xb'));var squel=require(_0xc499('0xc'));var crypto=require(_0xc499('0xd'));var jsforce=require(_0xc499('0xe'));var deskjs=require(_0xc499('0xf'));var toCsv=require(_0xc499('0x9'));var querystring=require('querystring');var Papa=require(_0xc499('0x10'));var Redis=require(_0xc499('0x11'));var authService=require(_0xc499('0x12'));var qs=require(_0xc499('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc499('0x14'));var logger=require('../../config/logger')(_0xc499('0x15'));var utils=require(_0xc499('0x16'));var config=require(_0xc499('0x17'));var db=require(_0xc499('0x18'))['db'];function respondWithStatusCode(_0x2f2d39,_0x799152){_0x799152=_0x799152||0xcc;return function(_0x46fe8a){if(_0x46fe8a){return _0x2f2d39['sendStatus'](_0x799152);}return _0x2f2d39[_0xc499('0x19')](_0x799152)[_0xc499('0x1a')]();};}function respondWithResult(_0x395551,_0x50c7da){_0x50c7da=_0x50c7da||0xc8;return function(_0x3d205b){if(_0x3d205b){return _0x395551[_0xc499('0x19')](_0x50c7da)[_0xc499('0x1b')](_0x3d205b);}};}function respondWithFilteredResult(_0x210f1a,_0x2aa595){return function(_0x278fbe){if(_0x278fbe){var _0x233b8f=_0x278fbe[_0xc499('0x1c')],_0x5e4a81=_0x2aa595[_0xc499('0x1d')],_0x39c876=_0x2aa595[_0xc499('0x1d')]+_0x2aa595[_0xc499('0x1e')],_0xc769cb;if(_0x39c876>=_0x233b8f){_0x39c876=_0x233b8f;_0xc769cb=0xc8;}else{_0xc769cb=0xce;}_0x210f1a[_0xc499('0x19')](_0xc769cb);return _0x210f1a[_0xc499('0x1f')](_0xc499('0x20'),_0x5e4a81+'-'+_0x39c876+'/'+_0x233b8f)['json'](_0x278fbe);}return null;};}function patchUpdates(_0x241d0e){return function(_0x39e438){try{jsonpatch[_0xc499('0x21')](_0x39e438,_0x241d0e,!![]);}catch(_0x14d6ca){return BPromise[_0xc499('0x22')](_0x14d6ca);}return _0x39e438[_0xc499('0x23')]();};}function saveUpdates(_0x2151eb,_0x161588){return function(_0x23a1ad){if(_0x23a1ad){return _0x23a1ad[_0xc499('0x24')](_0x2151eb)[_0xc499('0x25')](function(_0x2f2897){return _0x2f2897;});}return null;};}function removeEntity(_0x4f0718,_0x279680){return function(_0xb1d95){if(_0xb1d95){return _0xb1d95[_0xc499('0x26')]()[_0xc499('0x25')](function(){_0x4f0718[_0xc499('0x19')](0xcc)[_0xc499('0x1a')]();});}};}function handleEntityNotFound(_0xb570ec,_0xbb8763){return function(_0x15133d){if(!_0x15133d){_0xb570ec[_0xc499('0x27')](0x194);}return _0x15133d;};}function handleError(_0x45363d,_0x3e926a){_0x3e926a=_0x3e926a||0x1f4;return function(_0x13beb6){logger[_0xc499('0x28')](_0x13beb6[_0xc499('0x29')]);if(_0x13beb6[_0xc499('0x2a')]){delete _0x13beb6[_0xc499('0x2a')];}_0x45363d['status'](_0x3e926a)[_0xc499('0x2b')](_0x13beb6);};}exports[_0xc499('0x2c')]=function(_0x449643,_0x21eaf7){var _0x2b4c97={},_0x247f11={},_0x264a04={'count':0x0,'rows':[]};var _0x58ba34=_['map'](db[_0xc499('0x2d')][_0xc499('0x2e')],function(_0x30247d){return{'name':_0x30247d[_0xc499('0x2f')],'type':_0x30247d[_0xc499('0x30')]['key']};});_0x247f11['model']=_[_0xc499('0x31')](_0x58ba34,_0xc499('0x2a'));_0x247f11['query']=_[_0xc499('0x32')](_0x449643[_0xc499('0x33')]);_0x247f11['filters']=_[_0xc499('0x34')](_0x247f11['model'],_0x247f11[_0xc499('0x33')]);_0x2b4c97[_0xc499('0x35')]=_['intersection'](_0x247f11[_0xc499('0x36')],qs[_0xc499('0x37')](_0x449643[_0xc499('0x33')]['fields']));_0x2b4c97[_0xc499('0x35')]=_0x2b4c97[_0xc499('0x35')][_0xc499('0x38')]?_0x2b4c97[_0xc499('0x35')]:_0x247f11[_0xc499('0x36')];if(!_0x449643[_0xc499('0x33')][_0xc499('0x39')](_0xc499('0x3a'))){_0x2b4c97[_0xc499('0x1e')]=qs[_0xc499('0x1e')](_0x449643[_0xc499('0x33')][_0xc499('0x1e')]);_0x2b4c97[_0xc499('0x1d')]=qs[_0xc499('0x1d')](_0x449643[_0xc499('0x33')]['offset']);}_0x2b4c97['order']=qs[_0xc499('0x3b')](_0x449643['query'][_0xc499('0x3b')]);_0x2b4c97['where']=qs['filters'](_[_0xc499('0x3c')](_0x449643['query'],_0x247f11[_0xc499('0x3d')]),_0x58ba34);if(_0x449643[_0xc499('0x33')][_0xc499('0x3e')]){_0x2b4c97[_0xc499('0x3f')]=_['merge'](_0x2b4c97[_0xc499('0x3f')],{'$or':_[_0xc499('0x31')](_0x58ba34,function(_0x2186da){if(_0x2186da[_0xc499('0x30')]!=='VIRTUAL'){var _0x50931f={};_0x50931f[_0x2186da[_0xc499('0x2a')]]={'$like':'%'+_0x449643[_0xc499('0x33')][_0xc499('0x3e')]+'%'};return _0x50931f;}})});}_0x2b4c97=_[_0xc499('0x40')]({},_0x2b4c97,_0x449643[_0xc499('0x41')]);var _0x2d0982={'where':_0x2b4c97[_0xc499('0x3f')]};return db[_0xc499('0x2d')][_0xc499('0x1c')](_0x2d0982)[_0xc499('0x25')](function(_0x366aad){_0x264a04['count']=_0x366aad;if(_0x449643[_0xc499('0x33')][_0xc499('0x42')]){_0x2b4c97['include']=[{'all':!![]}];}return db[_0xc499('0x2d')][_0xc499('0x43')](_0x2b4c97);})['then'](function(_0x237643){_0x264a04[_0xc499('0x44')]=_0x237643;return _0x264a04;})[_0xc499('0x25')](respondWithFilteredResult(_0x21eaf7,_0x2b4c97))[_0xc499('0x45')](handleError(_0x21eaf7,null));};exports['show']=function(_0x219330,_0x5ee025){var _0x17d532={'raw':!![],'where':{'id':_0x219330['params']['id']}},_0x2c625c={};_0x2c625c[_0xc499('0x36')]=_[_0xc499('0x32')](db[_0xc499('0x2d')][_0xc499('0x2e')]);_0x2c625c[_0xc499('0x33')]=_[_0xc499('0x32')](_0x219330[_0xc499('0x33')]);_0x2c625c[_0xc499('0x3d')]=_[_0xc499('0x34')](_0x2c625c[_0xc499('0x36')],_0x2c625c[_0xc499('0x33')]);_0x17d532[_0xc499('0x35')]=_[_0xc499('0x34')](_0x2c625c[_0xc499('0x36')],qs[_0xc499('0x37')](_0x219330[_0xc499('0x33')][_0xc499('0x37')]));_0x17d532[_0xc499('0x35')]=_0x17d532[_0xc499('0x35')][_0xc499('0x38')]?_0x17d532[_0xc499('0x35')]:_0x2c625c['model'];if(_0x219330[_0xc499('0x33')][_0xc499('0x42')]){_0x17d532[_0xc499('0x46')]=[{'all':!![]}];}_0x17d532=_[_0xc499('0x40')]({},_0x17d532,_0x219330[_0xc499('0x41')]);return db[_0xc499('0x2d')][_0xc499('0x47')](_0x17d532)[_0xc499('0x25')](handleEntityNotFound(_0x5ee025,null))[_0xc499('0x25')](respondWithResult(_0x5ee025,null))[_0xc499('0x45')](handleError(_0x5ee025,null));};exports['create']=function(_0x29dbeb,_0x135b3b){return db[_0xc499('0x2d')][_0xc499('0x48')](_0x29dbeb[_0xc499('0x49')],{})[_0xc499('0x25')](respondWithResult(_0x135b3b,0xc9))[_0xc499('0x45')](handleError(_0x135b3b,null));};exports[_0xc499('0x24')]=function(_0x4ad62d,_0x362c96){if(_0x4ad62d['body']['id']){delete _0x4ad62d[_0xc499('0x49')]['id'];}return db[_0xc499('0x2d')][_0xc499('0x47')]({'where':{'id':_0x4ad62d[_0xc499('0x4a')]['id']}})[_0xc499('0x25')](handleEntityNotFound(_0x362c96,null))[_0xc499('0x25')](saveUpdates(_0x4ad62d[_0xc499('0x49')],null))[_0xc499('0x25')](respondWithResult(_0x362c96,null))['catch'](handleError(_0x362c96,null));};exports[_0xc499('0x26')]=function(_0x277ba7,_0x1aadf9){return db[_0xc499('0x2d')][_0xc499('0x47')]({'where':{'id':_0x277ba7[_0xc499('0x4a')]['id']}})[_0xc499('0x25')](handleEntityNotFound(_0x1aadf9,null))[_0xc499('0x25')](removeEntity(_0x1aadf9,null))[_0xc499('0x45')](handleError(_0x1aadf9,null));};exports[_0xc499('0x4b')]=function(_0x1d4004,_0x3f7f7d){return db[_0xc499('0x2d')][_0xc499('0x4b')]()[_0xc499('0x25')](respondWithResult(_0x3f7f7d,null))['catch'](handleError(_0x3f7f7d,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c2f0d86..de81bad 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 _0xaa83=['./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','util','request-promise','rimraf','../../config/environment'];(function(_0x3dbd97,_0x5a0738){var _0x44f649=function(_0x2e5498){while(--_0x2e5498){_0x3dbd97['push'](_0x3dbd97['shift']());}};_0x44f649(++_0x5a0738);}(_0xaa83,0xaf));var _0x3aa8=function(_0x478743,_0x54127e){_0x478743=_0x478743-0x0;var _0x499e70=_0xaa83[_0x478743];return _0x499e70;};'use strict';var _=require(_0x3aa8('0x0'));var util=require(_0x3aa8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3aa8('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3aa8('0x3'));var config=require(_0x3aa8('0x4'));var attributes=require(_0x3aa8('0x5'));module[_0x3aa8('0x6')]=function(_0x12fd2d,_0x355e3b){return _0x12fd2d[_0x3aa8('0x7')](_0x3aa8('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x3aa8('0x9'),'fields':[_0x3aa8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c5a=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3f9325,_0x5e346a){var _0x3cf883=function(_0x4de006){while(--_0x4de006){_0x3f9325['push'](_0x3f9325['shift']());}};_0x3cf883(++_0x5e346a);}(_0x5c5a,0xad));var _0xa5c5=function(_0x33581f,_0x597af5){_0x33581f=_0x33581f-0x0;var _0x3ab6fb=_0x5c5a[_0x33581f];return _0x3ab6fb;};'use strict';var _=require(_0xa5c5('0x0'));var util=require(_0xa5c5('0x1'));var logger=require(_0xa5c5('0x2'))(_0xa5c5('0x3'));var moment=require(_0xa5c5('0x4'));var BPromise=require(_0xa5c5('0x5'));var rp=require(_0xa5c5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5c5('0x7'));var config=require(_0xa5c5('0x8'));var attributes=require(_0xa5c5('0x9'));module[_0xa5c5('0xa')]=function(_0x55bd6c,_0x37c422){return _0x55bd6c[_0xa5c5('0xb')](_0xa5c5('0xc'),attributes,{'tableName':_0xa5c5('0xd'),'paranoid':![],'indexes':[{'name':_0xa5c5('0xe'),'fields':[_0xa5c5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 96fff29..61fc7a1 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 _0x1be6=['info','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1be6,0x162));var _0x61be=function(_0x216ce7,_0xb65bdd){_0x216ce7=_0x216ce7-0x0;var _0x15181d=_0x1be6[_0x216ce7];return _0x15181d;};'use strict';var _=require(_0x61be('0x0'));var util=require(_0x61be('0x1'));var moment=require(_0x61be('0x2'));var BPromise=require(_0x61be('0x3'));var rs=require(_0x61be('0x4'));var fs=require('fs');var Redis=require(_0x61be('0x5'));var db=require(_0x61be('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x61be('0x7'))(_0x61be('0x8'));var config=require(_0x61be('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x61be('0xa')][_0x61be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12da33,_0x1781d7,_0x3bffcd){return new BPromise(function(_0x5065bf,_0x4b0984){return client[_0x61be('0xc')](_0x12da33,_0x3bffcd)[_0x61be('0xd')](function(_0x4d2db2){logger[_0x61be('0xe')](_0x61be('0xf'),_0x1781d7,'request\x20sent');logger[_0x61be('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x1781d7,_0x61be('0x11'),JSON[_0x61be('0x12')](_0x4d2db2));if(_0x4d2db2[_0x61be('0x13')]){if(_0x4d2db2['error'][_0x61be('0x14')]===0x1f4){logger[_0x61be('0x13')](_0x61be('0xf'),_0x1781d7,_0x4d2db2[_0x61be('0x13')][_0x61be('0x15')]);return _0x4b0984(_0x4d2db2['error'][_0x61be('0x15')]);}logger[_0x61be('0x13')](_0x61be('0xf'),_0x1781d7,_0x4d2db2[_0x61be('0x13')][_0x61be('0x15')]);return _0x5065bf(_0x4d2db2[_0x61be('0x13')][_0x61be('0x15')]);}else{logger[_0x61be('0xe')](_0x61be('0xf'),_0x1781d7,_0x61be('0x11'));_0x5065bf(_0x4d2db2['result'][_0x61be('0x15')]);}})[_0x61be('0x16')](function(_0x444499){logger[_0x61be('0x13')](_0x61be('0xf'),_0x1781d7,_0x444499);_0x4b0984(_0x444499);});});} \ No newline at end of file +var _0x62cc=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x501c32,_0x2f24c9){var _0x9bd372=function(_0x34c2be){while(--_0x34c2be){_0x501c32['push'](_0x501c32['shift']());}};_0x9bd372(++_0x2f24c9);}(_0x62cc,0x8a));var _0xc62c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62cc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc62c('0x0'));var util=require(_0xc62c('0x1'));var moment=require('moment');var BPromise=require(_0xc62c('0x2'));var rs=require(_0xc62c('0x3'));var fs=require('fs');var Redis=require(_0xc62c('0x4'));var db=require(_0xc62c('0x5'))['db'];var utils=require(_0xc62c('0x6'));var logger=require(_0xc62c('0x7'))(_0xc62c('0x8'));var config=require(_0xc62c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc62c('0xa')][_0xc62c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d0013,_0x4bcb8d,_0x50691e){return new BPromise(function(_0x3365c5,_0x8e369a){return client[_0xc62c('0xc')](_0x2d0013,_0x50691e)[_0xc62c('0xd')](function(_0x6f76f7){logger[_0xc62c('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x4bcb8d,_0xc62c('0xf'));logger[_0xc62c('0x10')](_0xc62c('0x11'),_0x4bcb8d,_0xc62c('0xf'),JSON[_0xc62c('0x12')](_0x6f76f7));if(_0x6f76f7[_0xc62c('0x13')]){if(_0x6f76f7[_0xc62c('0x13')]['code']===0x1f4){logger['error'](_0xc62c('0x14'),_0x4bcb8d,_0x6f76f7['error'][_0xc62c('0x15')]);return _0x8e369a(_0x6f76f7[_0xc62c('0x13')][_0xc62c('0x15')]);}logger[_0xc62c('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x4bcb8d,_0x6f76f7[_0xc62c('0x13')]['message']);return _0x3365c5(_0x6f76f7['error']['message']);}else{logger[_0xc62c('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x4bcb8d,_0xc62c('0xf'));_0x3365c5(_0x6f76f7[_0xc62c('0x16')]['message']);}})[_0xc62c('0x17')](function(_0xbb7e26){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x4bcb8d,_0xbb7e26);_0x8e369a(_0xbb7e26);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index b80bb18..ba98336 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 _0x1649=['delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x2e2eab,_0x2e609a){var _0x2357bc=function(_0x2235ad){while(--_0x2235ad){_0x2e2eab['push'](_0x2e2eab['shift']());}};_0x2357bc(++_0x2e609a);}(_0x1649,0x1b7));var _0x9164=function(_0x2d9485,_0x34061a){_0x2d9485=_0x2d9485-0x0;var _0x22f905=_0x1649[_0x2d9485];return _0x22f905;};'use strict';var multer=require('multer');var util=require(_0x9164('0x0'));var path=require(_0x9164('0x1'));var timeout=require(_0x9164('0x2'));var express=require('express');var router=express[_0x9164('0x3')]();var auth=require(_0x9164('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9164('0x5'));var controller=require(_0x9164('0x6'));router[_0x9164('0x7')]('/',auth[_0x9164('0x8')](),controller[_0x9164('0x9')]);router[_0x9164('0x7')](_0x9164('0xa'),auth[_0x9164('0x8')](),controller[_0x9164('0xb')]);router['get'](_0x9164('0xc'),auth[_0x9164('0x8')](),controller[_0x9164('0xd')]);router[_0x9164('0xe')]('/',auth[_0x9164('0x8')](),controller[_0x9164('0xf')]);router[_0x9164('0x10')](_0x9164('0xc'),auth[_0x9164('0x8')](),controller['update']);router[_0x9164('0x11')](_0x9164('0xc'),auth[_0x9164('0x8')](),controller['destroy']);module[_0x9164('0x12')]=router; \ No newline at end of file +var _0x7034=['../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x7034,0xd6));var _0x4703=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x7034[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0x4703('0x0'));var util=require(_0x4703('0x1'));var path=require(_0x4703('0x2'));var timeout=require(_0x4703('0x3'));var express=require(_0x4703('0x4'));var router=express[_0x4703('0x5')]();var auth=require(_0x4703('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4703('0x7'));var controller=require('./memberReport.controller');router[_0x4703('0x8')]('/',auth['isAuthenticated'](),controller[_0x4703('0x9')]);router[_0x4703('0x8')](_0x4703('0xa'),auth[_0x4703('0xb')](),controller[_0x4703('0xc')]);router[_0x4703('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4703('0xd')]);router[_0x4703('0xe')]('/',auth[_0x4703('0xb')](),controller[_0x4703('0xf')]);router[_0x4703('0x10')](_0x4703('0x11'),auth[_0x4703('0xb')](),controller[_0x4703('0x12')]);router[_0x4703('0x13')](_0x4703('0x11'),auth[_0x4703('0xb')](),controller[_0x4703('0x14')]);module[_0x4703('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 4339aa5..f98cd9d 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 _0x485e=['seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x4ec13d,_0x358a8f){var _0x3c3fa7=function(_0x2615f6){while(--_0x2615f6){_0x4ec13d['push'](_0x4ec13d['shift']());}};_0x3c3fa7(++_0x358a8f);}(_0x485e,0x1c2));var _0xe485=function(_0x4f32de,_0x5bd4a){_0x4f32de=_0x4f32de-0x0;var _0x149821=_0x485e[_0x4f32de];return _0x149821;};'use strict';var Sequelize=require(_0xe485('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xe485('0x1')]},'membername':{'type':Sequelize[_0xe485('0x1')]},'interface':{'type':Sequelize[_0xe485('0x1')]},'type':{'type':Sequelize[_0xe485('0x1')],'defaultValue':_0xe485('0x2'),'comment':_0xe485('0x3')},'duration':{'type':Sequelize[_0xe485('0x4')]},'enterAt':{'type':Sequelize[_0xe485('0x5')]},'exitAt':{'type':Sequelize[_0xe485('0x5')],'set':function(_0x27bb3f){var _0x3fdf86=moment(_0x27bb3f);var _0x1e54cc=moment(this[_0xe485('0x6')](_0xe485('0x7')));var _0x4c5e74=_0x3fdf86[_0xe485('0x8')](_0x1e54cc,_0xe485('0x9'));this[_0xe485('0xa')](_0xe485('0xb'),_0x27bb3f);this['setDataValue'](_0xe485('0xc'),_0x4c5e74||null);}},'data1':{'type':Sequelize[_0xe485('0x1')],'comment':_0xe485('0xd')},'data2':{'type':Sequelize[_0xe485('0x1')],'comment':_0xe485('0xe')},'data3':{'type':Sequelize[_0xe485('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xe485('0x1')],'comment':_0xe485('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0xe485('0x10')},'role':{'type':Sequelize[_0xe485('0x1')]},'internal':{'type':Sequelize[_0xe485('0x4')]},'uniqueid':{'type':Sequelize[_0xe485('0x1')]}}; \ No newline at end of file +var _0xbcee=['talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x35a521,_0x117bef){var _0xf6d2ef=function(_0x4284b){while(--_0x4284b){_0x35a521['push'](_0x35a521['shift']());}};_0xf6d2ef(++_0x117bef);}(_0xbcee,0x172));var _0xebce=function(_0x644caa,_0x154713){_0x644caa=_0x644caa-0x0;var _0x5c29f2=_0xbcee[_0x644caa];return _0x5c29f2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xebce('0x0'));module[_0xebce('0x1')]={'channel':{'type':Sequelize[_0xebce('0x2')]},'membername':{'type':Sequelize[_0xebce('0x2')]},'interface':{'type':Sequelize[_0xebce('0x2')]},'type':{'type':Sequelize[_0xebce('0x2')],'defaultValue':_0xebce('0x3'),'comment':_0xebce('0x4')},'duration':{'type':Sequelize[_0xebce('0x5')]},'enterAt':{'type':Sequelize[_0xebce('0x6')]},'exitAt':{'type':Sequelize[_0xebce('0x6')],'set':function(_0xef832a){var _0x209674=moment(_0xef832a);var _0xf7a07b=moment(this[_0xebce('0x7')]('enterAt'));var _0x3d24cb=_0x209674['diff'](_0xf7a07b,'seconds');this[_0xebce('0x8')](_0xebce('0x9'),_0xef832a);this['setDataValue'](_0xebce('0xa'),_0x3d24cb||null);}},'data1':{'type':Sequelize[_0xebce('0x2')],'comment':_0xebce('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0xebce('0xc')},'data3':{'type':Sequelize[_0xebce('0x2')],'comment':_0xebce('0xd')},'data4':{'type':Sequelize[_0xebce('0x2')],'comment':_0xebce('0xe')},'data5':{'type':Sequelize[_0xebce('0x2')],'comment':_0xebce('0xf')},'role':{'type':Sequelize[_0xebce('0x2')]},'internal':{'type':Sequelize[_0xebce('0x5')]},'uniqueid':{'type':Sequelize[_0xebce('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 3fa794f..333de62 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 _0xebb4=['length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','type','options','MemberReport','includeAll','include','find','catch','create','body','params','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','map','fieldName','key','keys','query','model','attributes','intersection','fields'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0xebb4,0x1bf));var _0x4ebb=function(_0x4efed9,_0x1ccd6a){_0x4efed9=_0x4efed9-0x0;var _0x7aafbc=_0xebb4[_0x4efed9];return _0x7aafbc;};'use strict';var pdf=require(_0x4ebb('0x0'));var emlformat=require(_0x4ebb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4ebb('0x2'));var jsonpatch=require(_0x4ebb('0x3'));var rp=require(_0x4ebb('0x4'));var moment=require('moment');var BPromise=require(_0x4ebb('0x5'));var Mustache=require(_0x4ebb('0x6'));var util=require(_0x4ebb('0x7'));var path=require(_0x4ebb('0x8'));var sox=require('sox');var csv=require(_0x4ebb('0x9'));var ejs=require(_0x4ebb('0xa'));var fs=require('fs');var _=require(_0x4ebb('0xb'));var squel=require(_0x4ebb('0xc'));var crypto=require(_0x4ebb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4ebb('0xe'));var toCsv=require(_0x4ebb('0x9'));var querystring=require(_0x4ebb('0xf'));var Papa=require(_0x4ebb('0x10'));var Redis=require(_0x4ebb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ebb('0x12'));var as=require(_0x4ebb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ebb('0x14'))(_0x4ebb('0x15'));var utils=require('../../config/utils');var config=require(_0x4ebb('0x16'));var db=require(_0x4ebb('0x17'))['db'];function respondWithStatusCode(_0x876931,_0x22d925){_0x22d925=_0x22d925||0xcc;return function(_0x1540a8){if(_0x1540a8){return _0x876931[_0x4ebb('0x18')](_0x22d925);}return _0x876931['status'](_0x22d925)[_0x4ebb('0x19')]();};}function respondWithResult(_0x2f3000,_0x87dd98){_0x87dd98=_0x87dd98||0xc8;return function(_0x4f0e46){if(_0x4f0e46){return _0x2f3000[_0x4ebb('0x1a')](_0x87dd98)[_0x4ebb('0x1b')](_0x4f0e46);}};}function respondWithFilteredResult(_0x24d1f4,_0x142688){return function(_0x39e66d){if(_0x39e66d){var _0x2c81c2=_0x39e66d[_0x4ebb('0x1c')],_0x503430=_0x142688[_0x4ebb('0x1d')],_0x4bd8f8=_0x142688['offset']+_0x142688[_0x4ebb('0x1e')],_0x52e108;if(_0x4bd8f8>=_0x2c81c2){_0x4bd8f8=_0x2c81c2;_0x52e108=0xc8;}else{_0x52e108=0xce;}_0x24d1f4[_0x4ebb('0x1a')](_0x52e108);return _0x24d1f4[_0x4ebb('0x1f')](_0x4ebb('0x20'),_0x503430+'-'+_0x4bd8f8+'/'+_0x2c81c2)[_0x4ebb('0x1b')](_0x39e66d);}return null;};}function patchUpdates(_0x19dee9){return function(_0x237710){try{jsonpatch['apply'](_0x237710,_0x19dee9,!![]);}catch(_0x331eea){return BPromise[_0x4ebb('0x21')](_0x331eea);}return _0x237710['save']();};}function saveUpdates(_0x164d22,_0x680174){return function(_0x1ca10f){if(_0x1ca10f){return _0x1ca10f[_0x4ebb('0x22')](_0x164d22)['then'](function(_0x3a68eb){return _0x3a68eb;});}return null;};}function removeEntity(_0x46789b,_0x2d3330){return function(_0x17b7f2){if(_0x17b7f2){return _0x17b7f2['destroy']()[_0x4ebb('0x23')](function(){_0x46789b[_0x4ebb('0x1a')](0xcc)[_0x4ebb('0x19')]();});}};}function handleEntityNotFound(_0x37f3e2,_0x43d665){return function(_0x136b4c){if(!_0x136b4c){_0x37f3e2['sendStatus'](0x194);}return _0x136b4c;};}function handleError(_0x5d2a45,_0x398341){_0x398341=_0x398341||0x1f4;return function(_0x582721){logger[_0x4ebb('0x24')](_0x582721[_0x4ebb('0x25')]);if(_0x582721[_0x4ebb('0x26')]){delete _0x582721[_0x4ebb('0x26')];}_0x5d2a45['status'](_0x398341)[_0x4ebb('0x27')](_0x582721);};}exports[_0x4ebb('0x28')]=function(_0x1c8f76,_0xbeec55){var _0x8bd613={},_0x5303e3={},_0x29173a={'count':0x0,'rows':[]};var _0x2a6d75=_[_0x4ebb('0x29')](db['MemberReport']['rawAttributes'],function(_0x441823){return{'name':_0x441823[_0x4ebb('0x2a')],'type':_0x441823['type'][_0x4ebb('0x2b')]};});_0x5303e3['model']=_[_0x4ebb('0x29')](_0x2a6d75,_0x4ebb('0x26'));_0x5303e3['query']=_[_0x4ebb('0x2c')](_0x1c8f76[_0x4ebb('0x2d')]);_0x5303e3['filters']=_['intersection'](_0x5303e3[_0x4ebb('0x2e')],_0x5303e3[_0x4ebb('0x2d')]);_0x8bd613[_0x4ebb('0x2f')]=_[_0x4ebb('0x30')](_0x5303e3['model'],qs[_0x4ebb('0x31')](_0x1c8f76['query']['fields']));_0x8bd613[_0x4ebb('0x2f')]=_0x8bd613['attributes'][_0x4ebb('0x32')]?_0x8bd613['attributes']:_0x5303e3[_0x4ebb('0x2e')];if(!_0x1c8f76['query'][_0x4ebb('0x33')]('nolimit')){_0x8bd613['limit']=qs[_0x4ebb('0x1e')](_0x1c8f76[_0x4ebb('0x2d')][_0x4ebb('0x1e')]);_0x8bd613['offset']=qs[_0x4ebb('0x1d')](_0x1c8f76[_0x4ebb('0x2d')][_0x4ebb('0x1d')]);}_0x8bd613[_0x4ebb('0x34')]=qs[_0x4ebb('0x35')](_0x1c8f76[_0x4ebb('0x2d')][_0x4ebb('0x35')]);_0x8bd613['where']=qs[_0x4ebb('0x36')](_[_0x4ebb('0x37')](_0x1c8f76['query'],_0x5303e3[_0x4ebb('0x36')]),_0x2a6d75);if(_0x1c8f76[_0x4ebb('0x2d')][_0x4ebb('0x38')]){_0x8bd613[_0x4ebb('0x39')]=_[_0x4ebb('0x3a')](_0x8bd613[_0x4ebb('0x39')],{'$or':_['map'](_0x2a6d75,function(_0x44c910){if(_0x44c910[_0x4ebb('0x3b')]!=='VIRTUAL'){var _0x29cfbb={};_0x29cfbb[_0x44c910[_0x4ebb('0x26')]]={'$like':'%'+_0x1c8f76['query'][_0x4ebb('0x38')]+'%'};return _0x29cfbb;}})});}_0x8bd613=_[_0x4ebb('0x3a')]({},_0x8bd613,_0x1c8f76[_0x4ebb('0x3c')]);var _0x4ef866={'where':_0x8bd613[_0x4ebb('0x39')]};return db[_0x4ebb('0x3d')][_0x4ebb('0x1c')](_0x4ef866)[_0x4ebb('0x23')](function(_0x493b38){_0x29173a[_0x4ebb('0x1c')]=_0x493b38;if(_0x1c8f76[_0x4ebb('0x2d')][_0x4ebb('0x3e')]){_0x8bd613[_0x4ebb('0x3f')]=[{'all':!![]}];}return db[_0x4ebb('0x3d')]['findAll'](_0x8bd613);})[_0x4ebb('0x23')](function(_0x1204a2){_0x29173a['rows']=_0x1204a2;return _0x29173a;})[_0x4ebb('0x23')](respondWithFilteredResult(_0xbeec55,_0x8bd613))['catch'](handleError(_0xbeec55,null));};exports['show']=function(_0x55d14b,_0x5c3dd6){var _0x412eac={'raw':!![],'where':{'id':_0x55d14b['params']['id']}},_0x461547={};_0x461547[_0x4ebb('0x2e')]=_[_0x4ebb('0x2c')](db['MemberReport']['rawAttributes']);_0x461547[_0x4ebb('0x2d')]=_[_0x4ebb('0x2c')](_0x55d14b[_0x4ebb('0x2d')]);_0x461547[_0x4ebb('0x36')]=_[_0x4ebb('0x30')](_0x461547[_0x4ebb('0x2e')],_0x461547[_0x4ebb('0x2d')]);_0x412eac[_0x4ebb('0x2f')]=_[_0x4ebb('0x30')](_0x461547['model'],qs[_0x4ebb('0x31')](_0x55d14b['query'][_0x4ebb('0x31')]));_0x412eac['attributes']=_0x412eac[_0x4ebb('0x2f')][_0x4ebb('0x32')]?_0x412eac[_0x4ebb('0x2f')]:_0x461547['model'];if(_0x55d14b[_0x4ebb('0x2d')]['includeAll']){_0x412eac[_0x4ebb('0x3f')]=[{'all':!![]}];}_0x412eac=_[_0x4ebb('0x3a')]({},_0x412eac,_0x55d14b[_0x4ebb('0x3c')]);return db['MemberReport'][_0x4ebb('0x40')](_0x412eac)[_0x4ebb('0x23')](handleEntityNotFound(_0x5c3dd6,null))['then'](respondWithResult(_0x5c3dd6,null))[_0x4ebb('0x41')](handleError(_0x5c3dd6,null));};exports['create']=function(_0x3abe0f,_0x5b4440){return db[_0x4ebb('0x3d')][_0x4ebb('0x42')](_0x3abe0f['body'],{})[_0x4ebb('0x23')](respondWithResult(_0x5b4440,0xc9))['catch'](handleError(_0x5b4440,null));};exports['update']=function(_0x2095e3,_0x4ee287){if(_0x2095e3[_0x4ebb('0x43')]['id']){delete _0x2095e3[_0x4ebb('0x43')]['id'];}return db[_0x4ebb('0x3d')]['find']({'where':{'id':_0x2095e3[_0x4ebb('0x44')]['id']}})[_0x4ebb('0x23')](handleEntityNotFound(_0x4ee287,null))[_0x4ebb('0x23')](saveUpdates(_0x2095e3[_0x4ebb('0x43')],null))[_0x4ebb('0x23')](respondWithResult(_0x4ee287,null))[_0x4ebb('0x41')](handleError(_0x4ee287,null));};exports[_0x4ebb('0x45')]=function(_0x4176e2,_0x15531c){return db['MemberReport'][_0x4ebb('0x40')]({'where':{'id':_0x4176e2[_0x4ebb('0x44')]['id']}})[_0x4ebb('0x23')](handleEntityNotFound(_0x15531c,null))['then'](removeEntity(_0x15531c,null))[_0x4ebb('0x41')](handleError(_0x15531c,null));};exports[_0x4ebb('0x46')]=function(_0x508d2f,_0x1a27cb){return db[_0x4ebb('0x3d')][_0x4ebb('0x46')]()[_0x4ebb('0x23')](respondWithResult(_0x1a27cb,null))[_0x4ebb('0x41')](handleError(_0x1a27cb,null));}; \ No newline at end of file +var _0xd6c2=['set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','MemberReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','fields','includeAll','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit'];(function(_0x55d639,_0x421644){var _0x26044f=function(_0x56a99c){while(--_0x56a99c){_0x55d639['push'](_0x55d639['shift']());}};_0x26044f(++_0x421644);}(_0xd6c2,0xba));var _0x2d6c=function(_0xc6c14e,_0x4c3e78){_0xc6c14e=_0xc6c14e-0x0;var _0x13dd0e=_0xd6c2[_0xc6c14e];return _0x13dd0e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2d6c('0x0'));var rimraf=require(_0x2d6c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d6c('0x2'));var rp=require(_0x2d6c('0x3'));var moment=require('moment');var BPromise=require(_0x2d6c('0x4'));var Mustache=require('mustache');var util=require(_0x2d6c('0x5'));var path=require(_0x2d6c('0x6'));var sox=require('sox');var csv=require(_0x2d6c('0x7'));var ejs=require(_0x2d6c('0x8'));var fs=require('fs');var _=require(_0x2d6c('0x9'));var squel=require(_0x2d6c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2d6c('0xb'));var toCsv=require(_0x2d6c('0x7'));var querystring=require(_0x2d6c('0xc'));var Papa=require('papaparse');var Redis=require(_0x2d6c('0xd'));var authService=require(_0x2d6c('0xe'));var qs=require(_0x2d6c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d6c('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x2d6c('0x11'));var config=require(_0x2d6c('0x12'));var db=require(_0x2d6c('0x13'))['db'];function respondWithStatusCode(_0x1aae4e,_0xdba3e2){_0xdba3e2=_0xdba3e2||0xcc;return function(_0x53b550){if(_0x53b550){return _0x1aae4e[_0x2d6c('0x14')](_0xdba3e2);}return _0x1aae4e[_0x2d6c('0x15')](_0xdba3e2)['end']();};}function respondWithResult(_0x39b5e9,_0x11c07d){_0x11c07d=_0x11c07d||0xc8;return function(_0x5a8dfc){if(_0x5a8dfc){return _0x39b5e9[_0x2d6c('0x15')](_0x11c07d)['json'](_0x5a8dfc);}};}function respondWithFilteredResult(_0x56c435,_0xce13aa){return function(_0xbc594a){if(_0xbc594a){var _0x9af6b0=_0xbc594a['count'],_0x2d80e6=_0xce13aa[_0x2d6c('0x16')],_0x11f477=_0xce13aa['offset']+_0xce13aa[_0x2d6c('0x17')],_0x465965;if(_0x11f477>=_0x9af6b0){_0x11f477=_0x9af6b0;_0x465965=0xc8;}else{_0x465965=0xce;}_0x56c435['status'](_0x465965);return _0x56c435[_0x2d6c('0x18')](_0x2d6c('0x19'),_0x2d80e6+'-'+_0x11f477+'/'+_0x9af6b0)[_0x2d6c('0x1a')](_0xbc594a);}return null;};}function patchUpdates(_0x30dc0a){return function(_0x32f6a1){try{jsonpatch[_0x2d6c('0x1b')](_0x32f6a1,_0x30dc0a,!![]);}catch(_0x29013a){return BPromise[_0x2d6c('0x1c')](_0x29013a);}return _0x32f6a1[_0x2d6c('0x1d')]();};}function saveUpdates(_0x34d3b6,_0x30a404){return function(_0x3119f9){if(_0x3119f9){return _0x3119f9[_0x2d6c('0x1e')](_0x34d3b6)[_0x2d6c('0x1f')](function(_0x265b5b){return _0x265b5b;});}return null;};}function removeEntity(_0x2e14d1,_0x469b8f){return function(_0x502606){if(_0x502606){return _0x502606[_0x2d6c('0x20')]()['then'](function(){_0x2e14d1[_0x2d6c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x219456,_0x4b6e03){return function(_0x46f7d7){if(!_0x46f7d7){_0x219456[_0x2d6c('0x14')](0x194);}return _0x46f7d7;};}function handleError(_0x40b519,_0x177937){_0x177937=_0x177937||0x1f4;return function(_0x326c90){logger[_0x2d6c('0x21')](_0x326c90[_0x2d6c('0x22')]);if(_0x326c90['name']){delete _0x326c90[_0x2d6c('0x23')];}_0x40b519[_0x2d6c('0x15')](_0x177937)['send'](_0x326c90);};}exports[_0x2d6c('0x24')]=function(_0x4102c4,_0x5b9041){var _0x35ec35={},_0x5d063d={},_0x5d008f={'count':0x0,'rows':[]};var _0x28b48e=_['map'](db[_0x2d6c('0x25')][_0x2d6c('0x26')],function(_0x139cd2){return{'name':_0x139cd2['fieldName'],'type':_0x139cd2[_0x2d6c('0x27')][_0x2d6c('0x28')]};});_0x5d063d[_0x2d6c('0x29')]=_[_0x2d6c('0x2a')](_0x28b48e,_0x2d6c('0x23'));_0x5d063d[_0x2d6c('0x2b')]=_[_0x2d6c('0x2c')](_0x4102c4['query']);_0x5d063d[_0x2d6c('0x2d')]=_[_0x2d6c('0x2e')](_0x5d063d[_0x2d6c('0x29')],_0x5d063d[_0x2d6c('0x2b')]);_0x35ec35[_0x2d6c('0x2f')]=_[_0x2d6c('0x2e')](_0x5d063d[_0x2d6c('0x29')],qs['fields'](_0x4102c4[_0x2d6c('0x2b')]['fields']));_0x35ec35[_0x2d6c('0x2f')]=_0x35ec35[_0x2d6c('0x2f')]['length']?_0x35ec35[_0x2d6c('0x2f')]:_0x5d063d[_0x2d6c('0x29')];if(!_0x4102c4[_0x2d6c('0x2b')][_0x2d6c('0x30')](_0x2d6c('0x31'))){_0x35ec35[_0x2d6c('0x17')]=qs[_0x2d6c('0x17')](_0x4102c4[_0x2d6c('0x2b')][_0x2d6c('0x17')]);_0x35ec35[_0x2d6c('0x16')]=qs[_0x2d6c('0x16')](_0x4102c4['query'][_0x2d6c('0x16')]);}_0x35ec35['order']=qs[_0x2d6c('0x32')](_0x4102c4[_0x2d6c('0x2b')][_0x2d6c('0x32')]);_0x35ec35[_0x2d6c('0x33')]=qs['filters'](_[_0x2d6c('0x34')](_0x4102c4['query'],_0x5d063d[_0x2d6c('0x2d')]),_0x28b48e);if(_0x4102c4[_0x2d6c('0x2b')][_0x2d6c('0x35')]){_0x35ec35[_0x2d6c('0x33')]=_[_0x2d6c('0x36')](_0x35ec35[_0x2d6c('0x33')],{'$or':_['map'](_0x28b48e,function(_0x5150b2){if(_0x5150b2[_0x2d6c('0x27')]!==_0x2d6c('0x37')){var _0x3775c7={};_0x3775c7[_0x5150b2[_0x2d6c('0x23')]]={'$like':'%'+_0x4102c4[_0x2d6c('0x2b')][_0x2d6c('0x35')]+'%'};return _0x3775c7;}})});}_0x35ec35=_[_0x2d6c('0x36')]({},_0x35ec35,_0x4102c4[_0x2d6c('0x38')]);var _0x5bba2e={'where':_0x35ec35['where']};return db[_0x2d6c('0x25')][_0x2d6c('0x39')](_0x5bba2e)[_0x2d6c('0x1f')](function(_0x5cda46){_0x5d008f[_0x2d6c('0x39')]=_0x5cda46;if(_0x4102c4['query']['includeAll']){_0x35ec35[_0x2d6c('0x3a')]=[{'all':!![]}];}return db[_0x2d6c('0x25')][_0x2d6c('0x3b')](_0x35ec35);})[_0x2d6c('0x1f')](function(_0x10702c){_0x5d008f[_0x2d6c('0x3c')]=_0x10702c;return _0x5d008f;})[_0x2d6c('0x1f')](respondWithFilteredResult(_0x5b9041,_0x35ec35))[_0x2d6c('0x3d')](handleError(_0x5b9041,null));};exports[_0x2d6c('0x3e')]=function(_0x347866,_0x58c425){var _0xc86f43={'raw':!![],'where':{'id':_0x347866['params']['id']}},_0x7d1e01={};_0x7d1e01[_0x2d6c('0x29')]=_[_0x2d6c('0x2c')](db[_0x2d6c('0x25')][_0x2d6c('0x26')]);_0x7d1e01['query']=_[_0x2d6c('0x2c')](_0x347866['query']);_0x7d1e01['filters']=_[_0x2d6c('0x2e')](_0x7d1e01['model'],_0x7d1e01[_0x2d6c('0x2b')]);_0xc86f43[_0x2d6c('0x2f')]=_['intersection'](_0x7d1e01[_0x2d6c('0x29')],qs[_0x2d6c('0x3f')](_0x347866['query']['fields']));_0xc86f43['attributes']=_0xc86f43[_0x2d6c('0x2f')]['length']?_0xc86f43[_0x2d6c('0x2f')]:_0x7d1e01['model'];if(_0x347866[_0x2d6c('0x2b')][_0x2d6c('0x40')]){_0xc86f43['include']=[{'all':!![]}];}_0xc86f43=_['merge']({},_0xc86f43,_0x347866['options']);return db[_0x2d6c('0x25')]['find'](_0xc86f43)[_0x2d6c('0x1f')](handleEntityNotFound(_0x58c425,null))['then'](respondWithResult(_0x58c425,null))[_0x2d6c('0x3d')](handleError(_0x58c425,null));};exports[_0x2d6c('0x41')]=function(_0x507063,_0x5686b6){return db[_0x2d6c('0x25')][_0x2d6c('0x41')](_0x507063['body'],{})['then'](respondWithResult(_0x5686b6,0xc9))['catch'](handleError(_0x5686b6,null));};exports[_0x2d6c('0x1e')]=function(_0x2504db,_0x5a270b){if(_0x2504db[_0x2d6c('0x42')]['id']){delete _0x2504db[_0x2d6c('0x42')]['id'];}return db['MemberReport'][_0x2d6c('0x43')]({'where':{'id':_0x2504db[_0x2d6c('0x44')]['id']}})[_0x2d6c('0x1f')](handleEntityNotFound(_0x5a270b,null))[_0x2d6c('0x1f')](saveUpdates(_0x2504db[_0x2d6c('0x42')],null))[_0x2d6c('0x1f')](respondWithResult(_0x5a270b,null))[_0x2d6c('0x3d')](handleError(_0x5a270b,null));};exports['destroy']=function(_0x5ad0fc,_0x41836d){return db['MemberReport'][_0x2d6c('0x43')]({'where':{'id':_0x5ad0fc[_0x2d6c('0x44')]['id']}})[_0x2d6c('0x1f')](handleEntityNotFound(_0x41836d,null))[_0x2d6c('0x1f')](removeEntity(_0x41836d,null))[_0x2d6c('0x3d')](handleError(_0x41836d,null));};exports['describe']=function(_0x2189bb,_0x23fb35){return db[_0x2d6c('0x25')][_0x2d6c('0x45')]()[_0x2d6c('0x1f')](respondWithResult(_0x23fb35,null))[_0x2d6c('0x3d')](handleError(_0x23fb35,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 91c522c..df43a74 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 _0x5ad3=['membername_interface','membername','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member'];(function(_0x423f32,_0xa71a18){var _0x512afc=function(_0x5b65b9){while(--_0x5b65b9){_0x423f32['push'](_0x423f32['shift']());}};_0x512afc(++_0xa71a18);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x5ad3[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));module[_0x35ad('0xa')]=function(_0x436dcb,_0x36c606){return _0x436dcb[_0x35ad('0xb')]('MemberReport',attributes,{'tableName':_0x35ad('0xc'),'paranoid':![],'indexes':[{'name':_0x35ad('0xd'),'fields':[_0x35ad('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcca7=['api','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','report_member','membername_interface','membername','interface','lodash','util','../../config/logger'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xcca7,0x1aa));var _0x7cca=function(_0x19d40b,_0x84b75b){_0x19d40b=_0x19d40b-0x0;var _0x5f3ede=_0xcca7[_0x19d40b];return _0x5f3ede;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var logger=require(_0x7cca('0x2'))(_0x7cca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7cca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var attributes=require(_0x7cca('0x7'));module[_0x7cca('0x8')]=function(_0x1c6c95,_0xe70805){return _0x1c6c95['define']('MemberReport',attributes,{'tableName':_0x7cca('0x9'),'paranoid':![],'indexes':[{'name':_0x7cca('0xa'),'fields':[_0x7cca('0xb'),_0x7cca('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 2852792..ba2a2f1 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 _0x5494=['findAll','options','raw','where','attributes','limit','include','model','map','CreateMemberReport','body','UpdateMemberReport','MemberReport','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport'];(function(_0x2534f5,_0x1f65ce){var _0x41d078=function(_0x336df0){while(--_0x336df0){_0x2534f5['push'](_0x2534f5['shift']());}};_0x41d078(++_0x1f65ce);}(_0x5494,0xfb));var _0x4549=function(_0x51380e,_0x55b897){_0x51380e=_0x51380e-0x0;var _0x2ed390=_0x5494[_0x51380e];return _0x2ed390;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4549('0x0'));var rs=require(_0x4549('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4549('0x2'))['db'];var utils=require(_0x4549('0x3'));var logger=require(_0x4549('0x4'))('rpc');var config=require(_0x4549('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4549('0x6')][_0x4549('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x37dbb6,_0x4c6563,_0x2a19de){return new BPromise(function(_0x4b6392,_0x5da90c){return client['request'](_0x37dbb6,_0x2a19de)[_0x4549('0x8')](function(_0x3c0e6e){logger['info'](_0x4549('0x9'),_0x4c6563,_0x4549('0xa'));logger[_0x4549('0xb')](_0x4549('0xc'),_0x4c6563,_0x4549('0xa'),JSON[_0x4549('0xd')](_0x3c0e6e));if(_0x3c0e6e['error']){if(_0x3c0e6e[_0x4549('0xe')][_0x4549('0xf')]===0x1f4){logger[_0x4549('0xe')]('MemberReport,\x20%s,\x20%s',_0x4c6563,_0x3c0e6e['error']['message']);return _0x5da90c(_0x3c0e6e[_0x4549('0xe')][_0x4549('0x10')]);}logger[_0x4549('0xe')](_0x4549('0x9'),_0x4c6563,_0x3c0e6e['error'][_0x4549('0x10')]);return _0x4b6392(_0x3c0e6e[_0x4549('0xe')][_0x4549('0x10')]);}else{logger[_0x4549('0x11')](_0x4549('0x9'),_0x4c6563,'request\x20sent');_0x4b6392(_0x3c0e6e[_0x4549('0x12')]['message']);}})[_0x4549('0x13')](function(_0x202c4d){logger[_0x4549('0xe')](_0x4549('0x9'),_0x4c6563,_0x202c4d);_0x5da90c(_0x202c4d);});});}exports[_0x4549('0x14')]=function(_0x455d93){var _0x53eeb9=this;return new Promise(function(_0x3e3ae3,_0x2929dd){return db['MemberReport'][_0x4549('0x15')]({'raw':_0x455d93[_0x4549('0x16')]?_0x455d93[_0x4549('0x16')][_0x4549('0x17')]===undefined?!![]:![]:!![],'where':_0x455d93[_0x4549('0x16')]?_0x455d93[_0x4549('0x16')][_0x4549('0x18')]||null:null,'attributes':_0x455d93[_0x4549('0x16')]?_0x455d93['options'][_0x4549('0x19')]||null:null,'limit':_0x455d93[_0x4549('0x16')]?_0x455d93[_0x4549('0x16')][_0x4549('0x1a')]||null:null,'include':_0x455d93['options']?_0x455d93[_0x4549('0x16')][_0x4549('0x1b')]?_['map'](_0x455d93[_0x4549('0x16')][_0x4549('0x1b')],function(_0x2b0a14){return{'model':db[_0x2b0a14[_0x4549('0x1c')]],'as':_0x2b0a14['as'],'attributes':_0x2b0a14[_0x4549('0x19')],'include':_0x2b0a14[_0x4549('0x1b')]?_[_0x4549('0x1d')](_0x2b0a14[_0x4549('0x1b')],function(_0x43d2f4){return{'model':db[_0x43d2f4[_0x4549('0x1c')]],'as':_0x43d2f4['as'],'attributes':_0x43d2f4[_0x4549('0x19')],'include':_0x43d2f4[_0x4549('0x1b')]?_[_0x4549('0x1d')](_0x43d2f4['include'],function(_0x376dcb){return{'model':db[_0x376dcb[_0x4549('0x1c')]],'as':_0x376dcb['as'],'attributes':_0x376dcb[_0x4549('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15660e){logger[_0x4549('0x11')]('GetMemberReport',_0x455d93);logger['debug'](_0x4549('0x14'),_0x455d93,JSON[_0x4549('0xd')](_0x15660e));_0x3e3ae3(_0x15660e);})['catch'](function(_0x526f3b){logger[_0x4549('0xe')](_0x4549('0x14'),_0x526f3b[_0x4549('0x10')],_0x455d93);_0x2929dd(_0x53eeb9[_0x4549('0xe')](0x1f4,_0x526f3b[_0x4549('0x10')]));});});};exports[_0x4549('0x1e')]=function(_0x365651){var _0x2c1b49=this;return new Promise(function(_0x202ad5,_0x168bc7){return db['MemberReport']['create'](_0x365651[_0x4549('0x1f')],{'raw':_0x365651[_0x4549('0x16')]?_0x365651[_0x4549('0x16')][_0x4549('0x17')]===undefined?!![]:![]:!![]})[_0x4549('0x8')](function(_0x48fec8){logger[_0x4549('0x11')](_0x4549('0x1e'),_0x365651);logger[_0x4549('0xb')]('CreateMemberReport',_0x365651,JSON[_0x4549('0xd')](_0x48fec8));_0x202ad5(_0x48fec8);})[_0x4549('0x13')](function(_0x7d071a){logger[_0x4549('0xe')]('CreateMemberReport',_0x7d071a[_0x4549('0x10')],_0x365651);_0x168bc7(_0x2c1b49[_0x4549('0xe')](0x1f4,_0x7d071a[_0x4549('0x10')]));});});};exports[_0x4549('0x20')]=function(_0x4bee37){var _0x4ec514=this;return new Promise(function(_0xe65fb9,_0x3b7bf0){return db[_0x4549('0x21')]['update'](_0x4bee37[_0x4549('0x1f')],{'raw':_0x4bee37[_0x4549('0x16')]?_0x4bee37[_0x4549('0x16')][_0x4549('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bee37[_0x4549('0x16')]?_0x4bee37['options'][_0x4549('0x18')]||null:null,'attributes':_0x4bee37[_0x4549('0x16')]?_0x4bee37[_0x4549('0x16')][_0x4549('0x19')]||null:null,'limit':_0x4bee37[_0x4549('0x16')]?_0x4bee37[_0x4549('0x16')][_0x4549('0x1a')]||null:null})['then'](function(_0x483faa){logger[_0x4549('0x11')](_0x4549('0x20'),_0x4bee37);logger[_0x4549('0xb')]('UpdateMemberReport',_0x4bee37,JSON[_0x4549('0xd')](_0x483faa));_0xe65fb9(_0x483faa);})[_0x4549('0x13')](function(_0x137f37){logger[_0x4549('0xe')](_0x4549('0x20'),_0x137f37[_0x4549('0x10')],_0x4bee37);_0x3b7bf0(_0x4ec514['error'](0x1f4,_0x137f37[_0x4549('0x10')]));});});}; \ No newline at end of file +var _0x4f7b=['CreateMemberReport','create','raw','UpdateMemberReport','update','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MemberReport','findAll','options','attributes','limit','include','map','model','GetMemberReport','debug'];(function(_0x27be20,_0xb053be){var _0x5379ed=function(_0x3f43b3){while(--_0x3f43b3){_0x27be20['push'](_0x27be20['shift']());}};_0x5379ed(++_0xb053be);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x2ac1d,_0x321fea){_0x2ac1d=_0x2ac1d-0x0;var _0x269ca6=_0x4f7b[_0x2ac1d];return _0x269ca6;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});}exports['GetMemberReport']=function(_0x53b135){var _0x3a78b7=this;return new Promise(function(_0x22e273,_0x4b93fc){return db[_0xb4f7('0x17')][_0xb4f7('0x18')]({'raw':_0x53b135[_0xb4f7('0x19')]?_0x53b135['options']['raw']===undefined?!![]:![]:!![],'where':_0x53b135[_0xb4f7('0x19')]?_0x53b135[_0xb4f7('0x19')]['where']||null:null,'attributes':_0x53b135[_0xb4f7('0x19')]?_0x53b135[_0xb4f7('0x19')][_0xb4f7('0x1a')]||null:null,'limit':_0x53b135[_0xb4f7('0x19')]?_0x53b135['options'][_0xb4f7('0x1b')]||null:null,'include':_0x53b135['options']?_0x53b135[_0xb4f7('0x19')][_0xb4f7('0x1c')]?_[_0xb4f7('0x1d')](_0x53b135[_0xb4f7('0x19')][_0xb4f7('0x1c')],function(_0xbdee98){return{'model':db[_0xbdee98['model']],'as':_0xbdee98['as'],'attributes':_0xbdee98[_0xb4f7('0x1a')],'include':_0xbdee98[_0xb4f7('0x1c')]?_[_0xb4f7('0x1d')](_0xbdee98[_0xb4f7('0x1c')],function(_0x2ec8d4){return{'model':db[_0x2ec8d4[_0xb4f7('0x1e')]],'as':_0x2ec8d4['as'],'attributes':_0x2ec8d4['attributes'],'include':_0x2ec8d4[_0xb4f7('0x1c')]?_[_0xb4f7('0x1d')](_0x2ec8d4[_0xb4f7('0x1c')],function(_0x1f385d){return{'model':db[_0x1f385d[_0xb4f7('0x1e')]],'as':_0x1f385d['as'],'attributes':_0x1f385d['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4f7('0xc')](function(_0x2757f9){logger['info'](_0xb4f7('0x1f'),_0x53b135);logger[_0xb4f7('0x20')](_0xb4f7('0x1f'),_0x53b135,JSON[_0xb4f7('0x11')](_0x2757f9));_0x22e273(_0x2757f9);})['catch'](function(_0x2cb1b3){logger[_0xb4f7('0x12')](_0xb4f7('0x1f'),_0x2cb1b3[_0xb4f7('0x14')],_0x53b135);_0x4b93fc(_0x3a78b7['error'](0x1f4,_0x2cb1b3['message']));});});};exports[_0xb4f7('0x21')]=function(_0x54f33b){var _0x30c8c0=this;return new Promise(function(_0x2d61f0,_0x4d21a1){return db['MemberReport'][_0xb4f7('0x22')](_0x54f33b['body'],{'raw':_0x54f33b[_0xb4f7('0x19')]?_0x54f33b[_0xb4f7('0x19')][_0xb4f7('0x23')]===undefined?!![]:![]:!![]})[_0xb4f7('0xc')](function(_0x47365e){logger[_0xb4f7('0xd')](_0xb4f7('0x21'),_0x54f33b);logger['debug']('CreateMemberReport',_0x54f33b,JSON[_0xb4f7('0x11')](_0x47365e));_0x2d61f0(_0x47365e);})[_0xb4f7('0x16')](function(_0x5951a3){logger[_0xb4f7('0x12')]('CreateMemberReport',_0x5951a3[_0xb4f7('0x14')],_0x54f33b);_0x4d21a1(_0x30c8c0[_0xb4f7('0x12')](0x1f4,_0x5951a3[_0xb4f7('0x14')]));});});};exports[_0xb4f7('0x24')]=function(_0x36bf43){var _0x2c2ea4=this;return new Promise(function(_0x1172c9,_0x9ac24c){return db[_0xb4f7('0x17')][_0xb4f7('0x25')](_0x36bf43['body'],{'raw':_0x36bf43[_0xb4f7('0x19')]?_0x36bf43[_0xb4f7('0x19')][_0xb4f7('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36bf43[_0xb4f7('0x19')]?_0x36bf43[_0xb4f7('0x19')][_0xb4f7('0x26')]||null:null,'attributes':_0x36bf43[_0xb4f7('0x19')]?_0x36bf43[_0xb4f7('0x19')][_0xb4f7('0x1a')]||null:null,'limit':_0x36bf43['options']?_0x36bf43[_0xb4f7('0x19')][_0xb4f7('0x1b')]||null:null})[_0xb4f7('0xc')](function(_0x16eb19){logger[_0xb4f7('0xd')]('UpdateMemberReport',_0x36bf43);logger['debug']('UpdateMemberReport',_0x36bf43,JSON[_0xb4f7('0x11')](_0x16eb19));_0x1172c9(_0x16eb19);})[_0xb4f7('0x16')](function(_0x5c59a0){logger[_0xb4f7('0x12')](_0xb4f7('0x24'),_0x5c59a0[_0xb4f7('0x14')],_0x36bf43);_0x9ac24c(_0x2c2ea4[_0xb4f7('0x12')](0x1f4,_0x5c59a0['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index a0dfcd3..8e4b089 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 _0x5eb8=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x513f27,_0x1cbc87){var _0xa316b7=function(_0x3b592d){while(--_0x3b592d){_0x513f27['push'](_0x513f27['shift']());}};_0xa316b7(++_0x1cbc87);}(_0x5eb8,0xb0));var _0x85eb=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0x5eb8[_0x218972];return _0x1bb1a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var auth=require(_0x85eb('0x4'));var interaction=require(_0x85eb('0x5'));var config=require(_0x85eb('0x6'));var controller=require(_0x85eb('0x7'));router[_0x85eb('0x8')]('/',controller[_0x85eb('0x9')]);module[_0x85eb('0xa')]=router; \ No newline at end of file +var _0x5c00=['index','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x5a4127,_0xe4dd78){var _0x6db786=function(_0x1bfa0f){while(--_0x1bfa0f){_0x5a4127['push'](_0x5a4127['shift']());}};_0x6db786(++_0xe4dd78);}(_0x5c00,0x17e));var _0x05c0=function(_0x3e36b6,_0x43de3b){_0x3e36b6=_0x3e36b6-0x0;var _0x4a3a36=_0x5c00[_0x3e36b6];return _0x4a3a36;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var auth=require(_0x05c0('0x4'));var interaction=require(_0x05c0('0x5'));var config=require(_0x05c0('0x6'));var controller=require(_0x05c0('0x7'));router['get']('/',controller[_0x05c0('0x8')]);module[_0x05c0('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 8c10f55..a617b3c 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 _0x2dcb=['STRING','version'];(function(_0x45bda8,_0x373600){var _0x2d7daf=function(_0x231fc7){while(--_0x231fc7){_0x45bda8['push'](_0x45bda8['shift']());}};_0x2d7daf(++_0x373600);}(_0x2dcb,0x172));var _0xb2dc=function(_0x5981b9,_0x1250f8){_0x5981b9=_0x5981b9-0x0;var _0x2ea4ad=_0x2dcb[_0x5981b9];return _0x2ea4ad;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0xb2dc('0x0')],'unique':_0xb2dc('0x1')}}; \ No newline at end of file +var _0x7e17=['STRING','version','exports'];(function(_0x1ca02d,_0x3e7b18){var _0x1269f8=function(_0x279f19){while(--_0x279f19){_0x1ca02d['push'](_0x1ca02d['shift']());}};_0x1269f8(++_0x3e7b18);}(_0x7e17,0x89));var _0x77e1=function(_0x5e2be0,_0x51090e){_0x5e2be0=_0x5e2be0-0x0;var _0x23d711=_0x7e17[_0x5e2be0];return _0x23d711;};'use strict';var Sequelize=require('sequelize');module[_0x77e1('0x0')]={'version':{'type':Sequelize[_0x77e1('0x1')],'unique':_0x77e1('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d16acea..cb366da 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 _0x008c=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','destroy','then','name','send','index','map','Migration','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4a5a01,_0x225785){var _0x518f32=function(_0x96fd45){while(--_0x96fd45){_0x4a5a01['push'](_0x4a5a01['shift']());}};_0x518f32(++_0x225785);}(_0x008c,0x188));var _0xc008=function(_0x588c33,_0xe686f7){_0x588c33=_0x588c33-0x0;var _0x5c639c=_0x008c[_0x588c33];return _0x5c639c;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];function respondWithStatusCode(_0x2a5b4e,_0x9ffa93){_0x9ffa93=_0x9ffa93||0xcc;return function(_0x1819c6){if(_0x1819c6){return _0x2a5b4e[_0xc008('0x17')](_0x9ffa93);}return _0x2a5b4e['status'](_0x9ffa93)['end']();};}function respondWithResult(_0x33f44c,_0x50c1ab){_0x50c1ab=_0x50c1ab||0xc8;return function(_0x25e13f){if(_0x25e13f){return _0x33f44c[_0xc008('0x18')](_0x50c1ab)[_0xc008('0x19')](_0x25e13f);}};}function respondWithFilteredResult(_0x339ffc,_0x3f0ecf){return function(_0x5ee00b){if(_0x5ee00b){var _0x5e894e=_0x5ee00b[_0xc008('0x1a')],_0x4bd0f4=_0x3f0ecf[_0xc008('0x1b')],_0x11ef38=_0x3f0ecf['offset']+_0x3f0ecf['limit'],_0x15a6ad;if(_0x11ef38>=_0x5e894e){_0x11ef38=_0x5e894e;_0x15a6ad=0xc8;}else{_0x15a6ad=0xce;}_0x339ffc['status'](_0x15a6ad);return _0x339ffc['set'](_0xc008('0x1c'),_0x4bd0f4+'-'+_0x11ef38+'/'+_0x5e894e)[_0xc008('0x19')](_0x5ee00b);}return null;};}function patchUpdates(_0x501137){return function(_0x813397){try{jsonpatch['apply'](_0x813397,_0x501137,!![]);}catch(_0x4bd611){return BPromise['reject'](_0x4bd611);}return _0x813397['save']();};}function saveUpdates(_0x5754a0,_0x4b9726){return function(_0x5560b1){if(_0x5560b1){return _0x5560b1['update'](_0x5754a0)['then'](function(_0x5a58bd){return _0x5a58bd;});}return null;};}function removeEntity(_0x13a263,_0x4777a6){return function(_0x251db2){if(_0x251db2){return _0x251db2[_0xc008('0x1d')]()[_0xc008('0x1e')](function(){_0x13a263[_0xc008('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(!_0x58a6ea){_0x459fd9[_0xc008('0x17')](0x194);}return _0x58a6ea;};}function handleError(_0x36f358,_0x2e3cfb){_0x2e3cfb=_0x2e3cfb||0x1f4;return function(_0x3cb28c){logger['error'](_0x3cb28c['stack']);if(_0x3cb28c['name']){delete _0x3cb28c[_0xc008('0x1f')];}_0x36f358[_0xc008('0x18')](_0x2e3cfb)[_0xc008('0x20')](_0x3cb28c);};}exports[_0xc008('0x21')]=function(_0x5bebd9,_0x5e2aca){var _0x4fce9c={},_0x4adbab={},_0x4caaf4={'count':0x0,'rows':[]};var _0x3865c0=_[_0xc008('0x22')](db[_0xc008('0x23')]['rawAttributes'],function(_0x24c14c){return{'name':_0x24c14c[_0xc008('0x24')],'type':_0x24c14c[_0xc008('0x25')][_0xc008('0x26')]};});_0x4adbab['model']=_[_0xc008('0x22')](_0x3865c0,_0xc008('0x1f'));_0x4adbab['query']=_['keys'](_0x5bebd9['query']);_0x4adbab[_0xc008('0x27')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],_0x4adbab[_0xc008('0x2a')]);_0x4fce9c[_0xc008('0x2b')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2c')]));_0x4fce9c[_0xc008('0x2b')]=_0x4fce9c[_0xc008('0x2b')]['length']?_0x4fce9c[_0xc008('0x2b')]:_0x4adbab[_0xc008('0x29')];if(!_0x5bebd9['query'][_0xc008('0x2d')](_0xc008('0x2e'))){_0x4fce9c[_0xc008('0x2f')]=qs[_0xc008('0x2f')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2f')]);_0x4fce9c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x5bebd9[_0xc008('0x2a')]['offset']);}_0x4fce9c[_0xc008('0x30')]=qs[_0xc008('0x31')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x31')]);_0x4fce9c[_0xc008('0x32')]=qs[_0xc008('0x27')](_[_0xc008('0x33')](_0x5bebd9['query'],_0x4adbab[_0xc008('0x27')]),_0x3865c0);if(_0x5bebd9[_0xc008('0x2a')]['filter']){_0x4fce9c[_0xc008('0x32')]=_[_0xc008('0x34')](_0x4fce9c['where'],{'$or':_[_0xc008('0x22')](_0x3865c0,function(_0x2e4ae1){if(_0x2e4ae1[_0xc008('0x25')]!=='VIRTUAL'){var _0x53b353={};_0x53b353[_0x2e4ae1['name']]={'$like':'%'+_0x5bebd9[_0xc008('0x2a')]['filter']+'%'};return _0x53b353;}})});}_0x4fce9c=_[_0xc008('0x34')]({},_0x4fce9c,_0x5bebd9[_0xc008('0x35')]);var _0x6a4ccb={'where':_0x4fce9c[_0xc008('0x32')]};return db[_0xc008('0x23')][_0xc008('0x1a')](_0x6a4ccb)[_0xc008('0x1e')](function(_0x35b496){_0x4caaf4[_0xc008('0x1a')]=_0x35b496;if(_0x5bebd9[_0xc008('0x2a')][_0xc008('0x36')]){_0x4fce9c[_0xc008('0x37')]=[{'all':!![]}];}return db[_0xc008('0x23')][_0xc008('0x38')](_0x4fce9c);})['then'](function(_0x3238b4){_0x4caaf4[_0xc008('0x39')]=_0x3238b4;return _0x4caaf4;})[_0xc008('0x1e')](respondWithFilteredResult(_0x5e2aca,_0x4fce9c))[_0xc008('0x3a')](handleError(_0x5e2aca,null));}; \ No newline at end of file +var _0xe706=['type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','Migration','include','findAll','rows','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe706,0xa3));var _0x6e70=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0xe706[_0x2d2258];return _0x18e155;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={},_0x3af17f={},_0x83c836={'count':0x0,'rows':[]};var _0x114344=_[_0x6e70('0x2c')](db['Migration'][_0x6e70('0x2d')],function(_0x406f29){return{'name':_0x406f29[_0x6e70('0x2e')],'type':_0x406f29[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x2c')](_0x114344,_0x6e70('0x29'));_0x3af17f[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x4a67ac['query']);_0x3af17f[_0x6e70('0x34')]=_['intersection'](_0x3af17f[_0x6e70('0x31')],_0x3af17f['query']);_0x2c4d37[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x3af17f[_0x6e70('0x31')],qs['fields'](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x37')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2c4d37['attributes']:_0x3af17f[_0x6e70('0x31')];if(!_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x39')](_0x6e70('0x3a'))){_0x2c4d37[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x20')]);_0x2c4d37[_0x6e70('0x3b')]=qs[_0x6e70('0x3b')](_0x4a67ac['query'][_0x6e70('0x3b')]);}_0x2c4d37['order']=qs[_0x6e70('0x3c')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3c')]);_0x2c4d37[_0x6e70('0x3d')]=qs[_0x6e70('0x34')](_[_0x6e70('0x3e')](_0x4a67ac[_0x6e70('0x32')],_0x3af17f[_0x6e70('0x34')]),_0x114344);if(_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]){_0x2c4d37[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x2c4d37[_0x6e70('0x3d')],{'$or':_['map'](_0x114344,function(_0x5446a2){if(_0x5446a2['type']!==_0x6e70('0x41')){var _0x3841a0={};_0x3841a0[_0x5446a2[_0x6e70('0x29')]]={'$like':'%'+_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]+'%'};return _0x3841a0;}})});}_0x2c4d37=_[_0x6e70('0x40')]({},_0x2c4d37,_0x4a67ac['options']);var _0x3b508c={'where':_0x2c4d37[_0x6e70('0x3d')]};return db[_0x6e70('0x42')][_0x6e70('0x1f')](_0x3b508c)[_0x6e70('0x27')](function(_0x37bf46){_0x83c836[_0x6e70('0x1f')]=_0x37bf46;if(_0x4a67ac[_0x6e70('0x32')]['includeAll']){_0x2c4d37[_0x6e70('0x43')]=[{'all':!![]}];}return db[_0x6e70('0x42')][_0x6e70('0x44')](_0x2c4d37);})[_0x6e70('0x27')](function(_0x201da9){_0x83c836[_0x6e70('0x45')]=_0x201da9;return _0x83c836;})[_0x6e70('0x27')](respondWithFilteredResult(_0x54a5fe,_0x2c4d37))['catch'](handleError(_0x54a5fe,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a2c9cb6..e3577fc 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 _0xb945=['path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','moment'];(function(_0x35a04d,_0x466c33){var _0x56d5cd=function(_0x5687cc){while(--_0x5687cc){_0x35a04d['push'](_0x35a04d['shift']());}};_0x56d5cd(++_0x466c33);}(_0xb945,0x97));var _0x5b94=function(_0x163374,_0x1b0054){_0x163374=_0x163374-0x0;var _0x445d96=_0xb945[_0x163374];return _0x445d96;};'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'));module[_0x5b94('0x7')]=function(_0x4bef06,_0x492388){return _0x4bef06[_0x5b94('0x8')](_0x5b94('0x9'),attributes,{'tableName':_0x5b94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ce1=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x28fc62,_0x4af771){var _0x4e2bef=function(_0x5b75b7){while(--_0x5b75b7){_0x28fc62['push'](_0x28fc62['shift']());}};_0x4e2bef(++_0x4af771);}(_0x5ce1,0x1e7));var _0x15ce=function(_0x3517d9,_0x1e6703){_0x3517d9=_0x3517d9-0x0;var _0x29a2f4=_0x5ce1[_0x3517d9];return _0x29a2f4;};'use strict';var _=require(_0x15ce('0x0'));var util=require(_0x15ce('0x1'));var logger=require(_0x15ce('0x2'))(_0x15ce('0x3'));var moment=require(_0x15ce('0x4'));var BPromise=require(_0x15ce('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15ce('0x6'));var rimraf=require(_0x15ce('0x7'));var config=require(_0x15ce('0x8'));var attributes=require(_0x15ce('0x9'));module[_0x15ce('0xa')]=function(_0x1cf0a2,_0xbf7efd){return _0x1cf0a2[_0x15ce('0xb')](_0x15ce('0xc'),attributes,{'tableName':'migrations','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 c0fb10b..051cbd4 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 _0xf4e9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x1ca5c0,_0x45c0b0){var _0x42071c=function(_0x54c516){while(--_0x54c516){_0x1ca5c0['push'](_0x1ca5c0['shift']());}};_0x42071c(++_0x45c0b0);}(_0xf4e9,0x174));var _0x9f4e=function(_0x26594c,_0x42df64){_0x26594c=_0x26594c-0x0;var _0x3bbccc=_0xf4e9[_0x26594c];return _0x3bbccc;};'use strict';var _=require(_0x9f4e('0x0'));var util=require(_0x9f4e('0x1'));var moment=require(_0x9f4e('0x2'));var BPromise=require(_0x9f4e('0x3'));var rs=require(_0x9f4e('0x4'));var fs=require('fs');var Redis=require(_0x9f4e('0x5'));var db=require(_0x9f4e('0x6'))['db'];var utils=require(_0x9f4e('0x7'));var logger=require('../../config/logger')(_0x9f4e('0x8'));var config=require(_0x9f4e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9f4e('0xa')][_0x9f4e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13fb06,_0x384af9,_0x26387c){return new BPromise(function(_0x45cf1f,_0x2e0549){return client[_0x9f4e('0xc')](_0x13fb06,_0x26387c)['then'](function(_0x589d4f){logger[_0x9f4e('0xd')](_0x9f4e('0xe'),_0x384af9,_0x9f4e('0xf'));logger['debug'](_0x9f4e('0x10'),_0x384af9,_0x9f4e('0xf'),JSON[_0x9f4e('0x11')](_0x589d4f));if(_0x589d4f[_0x9f4e('0x12')]){if(_0x589d4f['error']['code']===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x384af9,_0x589d4f[_0x9f4e('0x12')][_0x9f4e('0x13')]);return _0x2e0549(_0x589d4f[_0x9f4e('0x12')][_0x9f4e('0x13')]);}logger[_0x9f4e('0x12')]('Migration,\x20%s,\x20%s',_0x384af9,_0x589d4f[_0x9f4e('0x12')][_0x9f4e('0x13')]);return _0x45cf1f(_0x589d4f[_0x9f4e('0x12')][_0x9f4e('0x13')]);}else{logger[_0x9f4e('0xd')](_0x9f4e('0xe'),_0x384af9,_0x9f4e('0xf'));_0x45cf1f(_0x589d4f[_0x9f4e('0x14')][_0x9f4e('0x13')]);}})[_0x9f4e('0x15')](function(_0x50747b){logger[_0x9f4e('0x12')](_0x9f4e('0xe'),_0x384af9,_0x50747b);_0x2e0549(_0x50747b);});});} \ No newline at end of file +var _0xdb89=['http','request','then','Migration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x674941,_0x43e51e){var _0x1420e9=function(_0x3f065d){while(--_0x3f065d){_0x674941['push'](_0x674941['shift']());}};_0x1420e9(++_0x43e51e);}(_0xdb89,0xda));var _0x9db8=function(_0x26daf4,_0x351a1b){_0x26daf4=_0x26daf4-0x0;var _0x1ccfe0=_0xdb89[_0x26daf4];return _0x1ccfe0;};'use strict';var _=require(_0x9db8('0x0'));var util=require(_0x9db8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9db8('0x2'));var fs=require('fs');var Redis=require(_0x9db8('0x3'));var db=require(_0x9db8('0x4'))['db'];var utils=require(_0x9db8('0x5'));var logger=require(_0x9db8('0x6'))(_0x9db8('0x7'));var config=require(_0x9db8('0x8'));var jayson=require(_0x9db8('0x9'));var client=jayson['client'][_0x9db8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4752c8,_0x415729,_0x3584dd){return new BPromise(function(_0x5ba844,_0x129e7b){return client[_0x9db8('0xb')](_0x4752c8,_0x3584dd)[_0x9db8('0xc')](function(_0x407197){logger['info'](_0x9db8('0xd'),_0x415729,_0x9db8('0xe'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x415729,_0x9db8('0xe'),JSON[_0x9db8('0xf')](_0x407197));if(_0x407197[_0x9db8('0x10')]){if(_0x407197[_0x9db8('0x10')][_0x9db8('0x11')]===0x1f4){logger[_0x9db8('0x10')]('Migration,\x20%s,\x20%s',_0x415729,_0x407197[_0x9db8('0x10')][_0x9db8('0x12')]);return _0x129e7b(_0x407197['error']['message']);}logger[_0x9db8('0x10')](_0x9db8('0xd'),_0x415729,_0x407197[_0x9db8('0x10')][_0x9db8('0x12')]);return _0x5ba844(_0x407197[_0x9db8('0x10')][_0x9db8('0x12')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x415729,_0x9db8('0xe'));_0x5ba844(_0x407197['result'][_0x9db8('0x12')]);}})['catch'](function(_0x1aa9db){logger[_0x9db8('0x10')](_0x9db8('0xd'),_0x415729,_0x1aa9db);_0x129e7b(_0x1aa9db);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 6fc2b04..ae49396 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 _0x80a3=['get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x339504,_0x4a3525){var _0x22810f=function(_0x194081){while(--_0x194081){_0x339504['push'](_0x339504['shift']());}};_0x22810f(++_0x4a3525);}(_0x80a3,0x1e6));var _0x380a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x80a3[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x380a('0x0'));var util=require(_0x380a('0x1'));var path=require(_0x380a('0x2'));var timeout=require('connect-timeout');var express=require(_0x380a('0x3'));var router=express['Router']();var auth=require(_0x380a('0x4'));var interaction=require(_0x380a('0x5'));var config=require(_0x380a('0x6'));var controller=require('./network.controller');router[_0x380a('0x7')]('/',auth[_0x380a('0x8')](),controller[_0x380a('0x9')]);router[_0x380a('0x7')](_0x380a('0xa'),auth[_0x380a('0x8')](),controller[_0x380a('0xb')]);router[_0x380a('0xc')]('/',auth[_0x380a('0x8')](),controller[_0x380a('0xd')]);router[_0x380a('0xe')](_0x380a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x380a('0xf')](_0x380a('0xa'),auth[_0x380a('0x8')](),controller['destroy']);module[_0x380a('0x10')]=router; \ No newline at end of file +var _0x0d56=['index','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0d56,0x113));var _0x60d5=function(_0x4ef826,_0x2e0ac8){_0x4ef826=_0x4ef826-0x0;var _0x154b8=_0x0d56[_0x4ef826];return _0x154b8;};'use strict';var multer=require(_0x60d5('0x0'));var util=require(_0x60d5('0x1'));var path=require(_0x60d5('0x2'));var timeout=require(_0x60d5('0x3'));var express=require(_0x60d5('0x4'));var router=express[_0x60d5('0x5')]();var auth=require(_0x60d5('0x6'));var interaction=require(_0x60d5('0x7'));var config=require(_0x60d5('0x8'));var controller=require('./network.controller');router[_0x60d5('0x9')]('/',auth['isAuthenticated'](),controller[_0x60d5('0xa')]);router[_0x60d5('0x9')](_0x60d5('0xb'),auth[_0x60d5('0xc')](),controller[_0x60d5('0xd')]);router[_0x60d5('0xe')]('/',auth['isAuthenticated'](),controller[_0x60d5('0xf')]);router[_0x60d5('0x10')](_0x60d5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x60d5('0x11')](_0x60d5('0xb'),auth[_0x60d5('0xc')](),controller[_0x60d5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2fd9eef..439359b 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(_0x138031,_0x1dfde5){var _0x25bc69=function(_0x5f34b0){while(--_0x5f34b0){_0x138031['push'](_0x138031['shift']());}};_0x25bc69(++_0x1dfde5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x30c7ea,_0x500126){var _0x3657c9=function(_0x20d92f){while(--_0x20d92f){_0x30c7ea['push'](_0x30c7ea['shift']());}};_0x3657c9(++_0x500126);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 bcd06bc..00b77c7 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 _0x8b04=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','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','Network,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','apply','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','sort','pick','where','VIRTUAL','filter','options','Network','count','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','sequelize','transaction','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','update','destroy','/etc/asterisk/sip_xcally_%s.conf','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x1bd037,_0x17669f){var _0x581e27=function(_0x5aea0b){while(--_0x5aea0b){_0x1bd037['push'](_0x1bd037['shift']());}};_0x581e27(++_0x17669f);}(_0x8b04,0x130));var _0x48b0=function(_0x146ed6,_0x356f88){_0x146ed6=_0x146ed6-0x0;var _0x2dd649=_0x8b04[_0x146ed6];return _0x2dd649;};'use strict';var pdf=require(_0x48b0('0x0'));var emlformat=require(_0x48b0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x48b0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48b0('0x3'));var moment=require(_0x48b0('0x4'));var BPromise=require(_0x48b0('0x5'));var Mustache=require(_0x48b0('0x6'));var util=require(_0x48b0('0x7'));var path=require(_0x48b0('0x8'));var sox=require(_0x48b0('0x9'));var csv=require(_0x48b0('0xa'));var ejs=require(_0x48b0('0xb'));var fs=require('fs');var _=require(_0x48b0('0xc'));var squel=require('squel');var crypto=require(_0x48b0('0xd'));var jsforce=require(_0x48b0('0xe'));var deskjs=require(_0x48b0('0xf'));var toCsv=require(_0x48b0('0xa'));var querystring=require(_0x48b0('0x10'));var Papa=require(_0x48b0('0x11'));var Redis=require(_0x48b0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x48b0('0x13'));var as=require(_0x48b0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48b0('0x15'))(_0x48b0('0x16'));var utils=require('../../config/utils');var config=require(_0x48b0('0x17'));var db=require(_0x48b0('0x18'))['db'];var jayson=require(_0x48b0('0x19'));var client=jayson[_0x48b0('0x1a')][_0x48b0('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3f7c29,_0x52bb16,_0x5bcd8b){if(_0x5bcd8b){var _0x43e9e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43e9e9['test'](_0x52bb16)){return _0x3f7c29;}else{throw new db[(_0x48b0('0x1c'))]['ValidationError'](_0x48b0('0x1d'));}}else{return _0x3f7c29;}}function respondWithRpcPromise(_0x341566,_0x2e736d,_0x37110c,_0x57154e){return new BPromise(function(_0x377f65,_0x29e511){var _0x23840e=_0x57154e||client;return _0x23840e['request'](_0x341566,_0x37110c)[_0x48b0('0x1e')](function(_0x4f796f){logger['info'](_0x48b0('0x1f'),_0x2e736d,'request\x20sent');logger[_0x48b0('0x20')]('Network,\x20%s,\x20%s,\x20%s',_0x2e736d,_0x48b0('0x21'),JSON['stringify'](_0x4f796f));if(_0x4f796f[_0x48b0('0x22')]){if(_0x4f796f[_0x48b0('0x22')][_0x48b0('0x23')]===0x1f4){logger[_0x48b0('0x22')](_0x48b0('0x1f'),_0x2e736d,_0x4f796f['error']['message']);return _0x29e511(_0x4f796f['error']['message']);}logger['error'](_0x48b0('0x1f'),_0x2e736d,_0x4f796f[_0x48b0('0x22')][_0x48b0('0x24')]);return _0x377f65(_0x4f796f[_0x48b0('0x22')]['message']);}else{logger[_0x48b0('0x25')]('Network,\x20%s,\x20%s',_0x2e736d,_0x48b0('0x21'));_0x377f65(_0x4f796f[_0x48b0('0x26')][_0x48b0('0x24')]);}})[_0x48b0('0x27')](function(_0x3761b0){logger['error']('Network,\x20%s,\x20%s',_0x2e736d,_0x3761b0);_0x29e511(_0x3761b0);});});}function respondWithStatusCode(_0x57012b,_0x5609fb){_0x5609fb=_0x5609fb||0xcc;return function(_0x4dace2){if(_0x4dace2){return _0x57012b[_0x48b0('0x28')](_0x5609fb);}return _0x57012b[_0x48b0('0x29')](_0x5609fb)[_0x48b0('0x2a')]();};}function respondWithResult(_0x379d13,_0x590eb4){_0x590eb4=_0x590eb4||0xc8;return function(_0x5b747f){if(_0x5b747f){return _0x379d13[_0x48b0('0x29')](_0x590eb4)[_0x48b0('0x2b')](_0x5b747f);}};}function respondWithFilteredResult(_0x52451b,_0x50e7cf){return function(_0x450bcf){if(_0x450bcf){var _0x3b4b3c=_0x450bcf['count'],_0x47e6a6=_0x50e7cf['offset'],_0x175f52=_0x50e7cf[_0x48b0('0x2c')]+_0x50e7cf[_0x48b0('0x2d')],_0x3d1ff3;if(_0x175f52>=_0x3b4b3c){_0x175f52=_0x3b4b3c;_0x3d1ff3=0xc8;}else{_0x3d1ff3=0xce;}_0x52451b[_0x48b0('0x29')](_0x3d1ff3);return _0x52451b[_0x48b0('0x2e')]('Content-Range',_0x47e6a6+'-'+_0x175f52+'/'+_0x3b4b3c)[_0x48b0('0x2b')](_0x450bcf);}return null;};}function patchUpdates(_0x50a2a1){return function(_0x1c872d){try{jsonpatch[_0x48b0('0x2f')](_0x1c872d,_0x50a2a1,!![]);}catch(_0x3498b9){return BPromise['reject'](_0x3498b9);}return _0x1c872d['save']();};}function saveUpdates(_0x42c45d,_0x265c34){return function(_0x254220){if(_0x254220){return _0x254220['update'](_0x42c45d)['then'](function(_0x299832){return _0x299832;});}return null;};}function removeEntity(_0x238f24,_0x1fe08b){return function(_0x1dc474){if(_0x1dc474){return _0x1dc474['destroy']()[_0x48b0('0x1e')](function(){_0x238f24['status'](0xcc)[_0x48b0('0x2a')]();});}};}function handleEntityNotFound(_0x348019,_0x33781a){return function(_0x12b909){if(!_0x12b909){_0x348019[_0x48b0('0x28')](0x194);}return _0x12b909;};}function handleError(_0x3f873e,_0x24bf60){_0x24bf60=_0x24bf60||0x1f4;return function(_0x226463){logger[_0x48b0('0x22')](_0x226463['stack']);if(_0x226463[_0x48b0('0x30')]){delete _0x226463[_0x48b0('0x30')];}_0x3f873e[_0x48b0('0x29')](_0x24bf60)[_0x48b0('0x31')](_0x226463);};}exports[_0x48b0('0x32')]=function(_0x288712,_0x46f4ff){var _0x2310d5={},_0x380080={},_0x5d932e={'count':0x0,'rows':[]};var _0x3d3dd3=_[_0x48b0('0x33')](db['Network'][_0x48b0('0x34')],function(_0x28c3b1){return{'name':_0x28c3b1[_0x48b0('0x35')],'type':_0x28c3b1[_0x48b0('0x36')][_0x48b0('0x37')]};});_0x380080[_0x48b0('0x38')]=_[_0x48b0('0x33')](_0x3d3dd3,'name');_0x380080['query']=_['keys'](_0x288712[_0x48b0('0x39')]);_0x380080[_0x48b0('0x3a')]=_[_0x48b0('0x3b')](_0x380080[_0x48b0('0x38')],_0x380080['query']);_0x2310d5[_0x48b0('0x3c')]=_[_0x48b0('0x3b')](_0x380080[_0x48b0('0x38')],qs['fields'](_0x288712[_0x48b0('0x39')][_0x48b0('0x3d')]));_0x2310d5[_0x48b0('0x3c')]=_0x2310d5[_0x48b0('0x3c')]['length']?_0x2310d5['attributes']:_0x380080['model'];if(!_0x288712['query']['hasOwnProperty']('nolimit')){_0x2310d5[_0x48b0('0x2d')]=qs[_0x48b0('0x2d')](_0x288712[_0x48b0('0x39')][_0x48b0('0x2d')]);_0x2310d5['offset']=qs[_0x48b0('0x2c')](_0x288712['query'][_0x48b0('0x2c')]);}_0x2310d5['order']=qs[_0x48b0('0x3e')](_0x288712[_0x48b0('0x39')][_0x48b0('0x3e')]);_0x2310d5['where']=qs['filters'](_[_0x48b0('0x3f')](_0x288712[_0x48b0('0x39')],_0x380080[_0x48b0('0x3a')]),_0x3d3dd3);if(_0x288712['query']['filter']){_0x2310d5[_0x48b0('0x40')]=_['merge'](_0x2310d5[_0x48b0('0x40')],{'$or':_['map'](_0x3d3dd3,function(_0x32b532){if(_0x32b532[_0x48b0('0x36')]!==_0x48b0('0x41')){var _0x4d22f8={};_0x4d22f8[_0x32b532[_0x48b0('0x30')]]={'$like':'%'+_0x288712[_0x48b0('0x39')][_0x48b0('0x42')]+'%'};return _0x4d22f8;}})});}_0x2310d5=_['merge']({},_0x2310d5,_0x288712[_0x48b0('0x43')]);var _0x3bae9f={'where':_0x2310d5[_0x48b0('0x40')]};return db[_0x48b0('0x44')][_0x48b0('0x45')](_0x3bae9f)[_0x48b0('0x1e')](function(_0x121f8d){_0x5d932e[_0x48b0('0x45')]=_0x121f8d;if(_0x288712['query'][_0x48b0('0x46')]){_0x2310d5[_0x48b0('0x47')]=[{'all':!![]}];}return db[_0x48b0('0x44')][_0x48b0('0x48')](_0x2310d5);})['then'](function(_0x42041a){_0x5d932e[_0x48b0('0x49')]=_0x42041a;return _0x5d932e;})[_0x48b0('0x1e')](respondWithFilteredResult(_0x46f4ff,_0x2310d5))[_0x48b0('0x27')](handleError(_0x46f4ff,null));};exports[_0x48b0('0x4a')]=function(_0x1952b2,_0x41cc12){var _0x163f5e={'raw':!![],'where':{'id':_0x1952b2[_0x48b0('0x4b')]['id']}},_0x4a255c={};_0x4a255c[_0x48b0('0x38')]=_[_0x48b0('0x4c')](db[_0x48b0('0x44')]['rawAttributes']);_0x4a255c['query']=_[_0x48b0('0x4c')](_0x1952b2[_0x48b0('0x39')]);_0x4a255c[_0x48b0('0x3a')]=_[_0x48b0('0x3b')](_0x4a255c['model'],_0x4a255c[_0x48b0('0x39')]);_0x163f5e['attributes']=_['intersection'](_0x4a255c['model'],qs['fields'](_0x1952b2[_0x48b0('0x39')]['fields']));_0x163f5e[_0x48b0('0x3c')]=_0x163f5e['attributes'][_0x48b0('0x4d')]?_0x163f5e['attributes']:_0x4a255c[_0x48b0('0x38')];if(_0x1952b2[_0x48b0('0x39')][_0x48b0('0x46')]){_0x163f5e[_0x48b0('0x47')]=[{'all':!![]}];}_0x163f5e=_[_0x48b0('0x4e')]({},_0x163f5e,_0x1952b2[_0x48b0('0x43')]);return db[_0x48b0('0x44')][_0x48b0('0x4f')](_0x163f5e)[_0x48b0('0x1e')](handleEntityNotFound(_0x41cc12,null))[_0x48b0('0x1e')](respondWithResult(_0x41cc12,null))[_0x48b0('0x27')](handleError(_0x41cc12,null));};exports[_0x48b0('0x50')]=function(_0x51b434,_0x5b637b,_0x429f00){var _0x3fc439;return db[_0x48b0('0x51')][_0x48b0('0x52')](function(_0xf81273){return db[_0x48b0('0x44')][_0x48b0('0x50')](_0x51b434[_0x48b0('0x53')],{'raw':!![]})['then'](function(_0x178ef7){_0x3fc439=_0x178ef7;return db[_0x48b0('0x44')][_0x48b0('0x48')]({'where':{'type':_0x51b434['body'][_0x48b0('0x36')]},'raw':!![]});})[_0x48b0('0x1e')](function(_0x13e1f9){if(_0x3fc439[_0x48b0('0x36')]['toUpperCase']()==_0x48b0('0x54')){var _0x13ce14=fs[_0x48b0('0x55')](path[_0x48b0('0x56')](config[_0x48b0('0x57')],_0x48b0('0x58')),'utf8');var _0x2e63c1=ejs[_0x48b0('0x59')](_0x13ce14,{'networks':_0x13e1f9||[]});fs['writeFileSync'](_0x48b0('0x5a'),_0x2e63c1);return respondWithRpcPromise(_0x48b0('0x5b'),_0x48b0('0x50'),{'module':_0x48b0('0x5c')});}else if(_0x3fc439[_0x48b0('0x36')][_0x48b0('0x5d')]()==_0x48b0('0x5e')){var _0x281d01=fs[_0x48b0('0x55')](path[_0x48b0('0x56')](config['root'],_0x48b0('0x5f')),_0x48b0('0x60'));var _0x5507c5=ejs[_0x48b0('0x59')](_0x281d01,{'networks':_0x13e1f9||[]});fs[_0x48b0('0x61')](_0x48b0('0x62'),_0x5507c5);return respondWithRpcPromise(_0x48b0('0x5b'),'create',{'module':_0x48b0('0x5c')});}else{var _0x20739b=fs[_0x48b0('0x55')](path[_0x48b0('0x56')](config['root'],_0x48b0('0x63')),'utf8');var _0x2c6858=ejs[_0x48b0('0x59')](_0x20739b,{'networks':_0x13e1f9||[]});fs[_0x48b0('0x61')](util[_0x48b0('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x51b434['body']['type'][_0x48b0('0x65')]()),_0x2c6858);return respondWithRpcPromise('Reload',_0x48b0('0x50'),{'module':_0x48b0('0x66')});}return null;})['then'](function(){return _0x3fc439;});})[_0x48b0('0x1e')](respondWithResult(_0x5b637b,0xc9))[_0x48b0('0x27')](handleError(_0x5b637b,null));};exports[_0x48b0('0x67')]=function(_0x3cb221,_0x17eb8a,_0x152412){var _0x1c85b7;return db[_0x48b0('0x51')][_0x48b0('0x52')](function(_0x1492a3){return db['Network'][_0x48b0('0x4f')]({'where':{'id':_0x3cb221['params']['id']}})[_0x48b0('0x1e')](handleEntityNotFound(_0x17eb8a,null))[_0x48b0('0x1e')](saveUpdates(_0x3cb221['body'],null))['then'](function(_0x1431a5){if(_0x1431a5){_0x1c85b7=_0x1431a5;return db['Network'][_0x48b0('0x48')]({'where':{'type':_0x1c85b7[_0x48b0('0x36')]},'raw':!![]});}return null;})['then'](function(_0x1b76ad){if(_0x1c85b7[_0x48b0('0x36')]['toUpperCase']()==_0x48b0('0x54')){var _0x3dd8b9=fs[_0x48b0('0x55')](path[_0x48b0('0x56')](config[_0x48b0('0x57')],_0x48b0('0x58')),_0x48b0('0x60'));var _0x45acec=ejs[_0x48b0('0x59')](_0x3dd8b9,{'networks':_0x1b76ad||[]});fs[_0x48b0('0x61')]('/etc/asterisk/stun_xcally.conf',_0x45acec);return respondWithRpcPromise('Reload',_0x48b0('0x67'),{'module':_0x48b0('0x5c')});}else if(_0x1c85b7[_0x48b0('0x36')][_0x48b0('0x5d')]()==_0x48b0('0x5e')){var _0x3b9557=fs[_0x48b0('0x55')](path[_0x48b0('0x56')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x48b0('0x60'));var _0x329aab=ejs[_0x48b0('0x59')](_0x3b9557,{'networks':_0x1b76ad||[]});fs[_0x48b0('0x61')]('/etc/asterisk/turn_xcally.conf',_0x329aab);return respondWithRpcPromise(_0x48b0('0x5b'),'update',{'module':_0x48b0('0x5c')});}else{var _0x2de122=fs[_0x48b0('0x55')](path[_0x48b0('0x56')](config[_0x48b0('0x57')],_0x48b0('0x63')),_0x48b0('0x60'));var _0x329f4d=ejs['render'](_0x2de122,{'networks':_0x1b76ad||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3cb221[_0x48b0('0x53')][_0x48b0('0x36')][_0x48b0('0x65')]()),_0x329f4d);return respondWithRpcPromise('Reload','update',{'module':_0x48b0('0x66')});}return null;})[_0x48b0('0x1e')](function(_0x322cb2){if(_0x322cb2){return _0x1c85b7;}return null;});})[_0x48b0('0x1e')](respondWithResult(_0x17eb8a,null))[_0x48b0('0x27')](handleError(_0x17eb8a,null));};exports[_0x48b0('0x68')]=function(_0x3631af,_0x442b60,_0x4a903d){var _0x1fa1d8;return db['Network'][_0x48b0('0x4f')]({'where':{'id':_0x3631af[_0x48b0('0x4b')]['id']}})[_0x48b0('0x1e')](function(_0x4e2c6a){_0x1fa1d8=_0x4e2c6a;return _0x4e2c6a;})[_0x48b0('0x1e')](handleEntityNotFound(_0x442b60,null))[_0x48b0('0x1e')](removeEntity(_0x442b60,null))[_0x48b0('0x1e')](function(){if(_0x1fa1d8){return db[_0x48b0('0x44')]['findAll']({'where':{'type':_0x1fa1d8['type']},'raw':!![]});}})['then'](function(_0x1e63a0){if(_0x1fa1d8['type'][_0x48b0('0x5d')]()==_0x48b0('0x54')){var _0x15d950=fs[_0x48b0('0x55')](path[_0x48b0('0x56')](config['root'],_0x48b0('0x58')),_0x48b0('0x60'));var _0x2c1645=ejs[_0x48b0('0x59')](_0x15d950,{'networks':_0x1e63a0||[]});fs[_0x48b0('0x61')]('/etc/asterisk/stun_xcally.conf',_0x2c1645);return respondWithRpcPromise(_0x48b0('0x5b'),'destroy',{'module':_0x48b0('0x5c')});}else if(_0x1fa1d8[_0x48b0('0x36')][_0x48b0('0x5d')]()==_0x48b0('0x5e')){var _0x55d04f=fs[_0x48b0('0x55')](path[_0x48b0('0x56')](config['root'],_0x48b0('0x5f')),_0x48b0('0x60'));var _0x5e2fb5=ejs[_0x48b0('0x59')](_0x55d04f,{'networks':_0x1e63a0||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5e2fb5);return respondWithRpcPromise(_0x48b0('0x5b'),_0x48b0('0x68'),{'module':_0x48b0('0x5c')});}else{var _0x462126=fs[_0x48b0('0x55')](path[_0x48b0('0x56')](config[_0x48b0('0x57')],_0x48b0('0x63')),_0x48b0('0x60'));var _0x295a3d=ejs[_0x48b0('0x59')](_0x462126,{'networks':_0x1e63a0||[]});fs[_0x48b0('0x61')](util[_0x48b0('0x64')](_0x48b0('0x69'),_0x3631af[_0x48b0('0x53')][_0x48b0('0x36')][_0x48b0('0x65')]()),_0x295a3d);return respondWithRpcPromise('Reload','destroy',{'module':_0x48b0('0x66')});}return null;})['catch'](handleError(_0x442b60,null));}; \ No newline at end of file +var _0xd582=['catch','show','params','find','create','sequelize','transaction','type','toUpperCase','STUN','readFileSync','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','root','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','body','toLowerCase','chan_sip.so','update','format','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','json','count','offset','limit','apply','reject','save','end','stack','name','status','send','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Network','findAll','rows'];(function(_0x5cfc23,_0x4484dc){var _0x4261be=function(_0x4cf9f4){while(--_0x4cf9f4){_0x5cfc23['push'](_0x5cfc23['shift']());}};_0x4261be(++_0x4484dc);}(_0xd582,0xff));var _0x2d58=function(_0x255840,_0x411b6e){_0x255840=_0x255840-0x0;var _0x40dad5=_0xd582[_0x255840];return _0x40dad5;};'use strict';var pdf=require(_0x2d58('0x0'));var emlformat=require(_0x2d58('0x1'));var rimraf=require(_0x2d58('0x2'));var zipdir=require(_0x2d58('0x3'));var jsonpatch=require(_0x2d58('0x4'));var rp=require(_0x2d58('0x5'));var moment=require(_0x2d58('0x6'));var BPromise=require(_0x2d58('0x7'));var Mustache=require(_0x2d58('0x8'));var util=require(_0x2d58('0x9'));var path=require(_0x2d58('0xa'));var sox=require(_0x2d58('0xb'));var csv=require(_0x2d58('0xc'));var ejs=require(_0x2d58('0xd'));var fs=require('fs');var _=require(_0x2d58('0xe'));var squel=require(_0x2d58('0xf'));var crypto=require(_0x2d58('0x10'));var jsforce=require(_0x2d58('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x2d58('0xc'));var querystring=require(_0x2d58('0x12'));var Papa=require('papaparse');var Redis=require(_0x2d58('0x13'));var authService=require(_0x2d58('0x14'));var qs=require(_0x2d58('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d58('0x16'));var logger=require(_0x2d58('0x17'))(_0x2d58('0x18'));var utils=require(_0x2d58('0x19'));var config=require(_0x2d58('0x1a'));var db=require(_0x2d58('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2d58('0x1c')][_0x2d58('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x8cbe17,_0x5484e0,_0x30d23e){if(_0x30d23e){var _0x505518=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x505518['test'](_0x5484e0)){return _0x8cbe17;}else{throw new db[(_0x2d58('0x1e'))][(_0x2d58('0x1f'))](_0x2d58('0x20'));}}else{return _0x8cbe17;}}function respondWithRpcPromise(_0x55c27e,_0x2add1d,_0x267712,_0x7d3804){return new BPromise(function(_0x393e5e,_0x35cc0e){var _0x493998=_0x7d3804||client;return _0x493998[_0x2d58('0x21')](_0x55c27e,_0x267712)[_0x2d58('0x22')](function(_0x10e188){logger[_0x2d58('0x23')](_0x2d58('0x24'),_0x2add1d,_0x2d58('0x25'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x2add1d,_0x2d58('0x25'),JSON[_0x2d58('0x26')](_0x10e188));if(_0x10e188[_0x2d58('0x27')]){if(_0x10e188['error'][_0x2d58('0x28')]===0x1f4){logger[_0x2d58('0x27')](_0x2d58('0x24'),_0x2add1d,_0x10e188[_0x2d58('0x27')]['message']);return _0x35cc0e(_0x10e188[_0x2d58('0x27')]['message']);}logger[_0x2d58('0x27')](_0x2d58('0x24'),_0x2add1d,_0x10e188[_0x2d58('0x27')][_0x2d58('0x29')]);return _0x393e5e(_0x10e188[_0x2d58('0x27')][_0x2d58('0x29')]);}else{logger[_0x2d58('0x23')](_0x2d58('0x24'),_0x2add1d,'request\x20sent');_0x393e5e(_0x10e188['result']['message']);}})['catch'](function(_0x4c9441){logger[_0x2d58('0x27')](_0x2d58('0x24'),_0x2add1d,_0x4c9441);_0x35cc0e(_0x4c9441);});});}function respondWithStatusCode(_0x439eec,_0x3a0f2e){_0x3a0f2e=_0x3a0f2e||0xcc;return function(_0x5939fc){if(_0x5939fc){return _0x439eec[_0x2d58('0x2a')](_0x3a0f2e);}return _0x439eec['status'](_0x3a0f2e)['end']();};}function respondWithResult(_0x4e8b21,_0x27bc8b){_0x27bc8b=_0x27bc8b||0xc8;return function(_0x4c23e2){if(_0x4c23e2){return _0x4e8b21['status'](_0x27bc8b)[_0x2d58('0x2b')](_0x4c23e2);}};}function respondWithFilteredResult(_0x389405,_0x37f56e){return function(_0x316566){if(_0x316566){var _0x40960f=_0x316566[_0x2d58('0x2c')],_0x4fbfa4=_0x37f56e[_0x2d58('0x2d')],_0x3f14b2=_0x37f56e[_0x2d58('0x2d')]+_0x37f56e[_0x2d58('0x2e')],_0x3da94d;if(_0x3f14b2>=_0x40960f){_0x3f14b2=_0x40960f;_0x3da94d=0xc8;}else{_0x3da94d=0xce;}_0x389405['status'](_0x3da94d);return _0x389405['set']('Content-Range',_0x4fbfa4+'-'+_0x3f14b2+'/'+_0x40960f)['json'](_0x316566);}return null;};}function patchUpdates(_0xf09ea5){return function(_0x4a03cf){try{jsonpatch[_0x2d58('0x2f')](_0x4a03cf,_0xf09ea5,!![]);}catch(_0x4e3491){return BPromise[_0x2d58('0x30')](_0x4e3491);}return _0x4a03cf[_0x2d58('0x31')]();};}function saveUpdates(_0x513a53,_0x50159b){return function(_0x19be1e){if(_0x19be1e){return _0x19be1e['update'](_0x513a53)['then'](function(_0x40b222){return _0x40b222;});}return null;};}function removeEntity(_0x595def,_0x562825){return function(_0x214c60){if(_0x214c60){return _0x214c60['destroy']()['then'](function(){_0x595def['status'](0xcc)[_0x2d58('0x32')]();});}};}function handleEntityNotFound(_0x573afc,_0x2dfef8){return function(_0x55f50e){if(!_0x55f50e){_0x573afc[_0x2d58('0x2a')](0x194);}return _0x55f50e;};}function handleError(_0x86ffc1,_0x20a409){_0x20a409=_0x20a409||0x1f4;return function(_0xb41113){logger[_0x2d58('0x27')](_0xb41113[_0x2d58('0x33')]);if(_0xb41113['name']){delete _0xb41113[_0x2d58('0x34')];}_0x86ffc1[_0x2d58('0x35')](_0x20a409)[_0x2d58('0x36')](_0xb41113);};}exports['index']=function(_0x3dcc17,_0x1e8111){var _0x51a135={},_0x10b67d={},_0x3b79c2={'count':0x0,'rows':[]};var _0x3714dc=_[_0x2d58('0x37')](db['Network'][_0x2d58('0x38')],function(_0x3296ed){return{'name':_0x3296ed[_0x2d58('0x39')],'type':_0x3296ed['type'][_0x2d58('0x3a')]};});_0x10b67d[_0x2d58('0x3b')]=_[_0x2d58('0x37')](_0x3714dc,_0x2d58('0x34'));_0x10b67d['query']=_[_0x2d58('0x3c')](_0x3dcc17[_0x2d58('0x3d')]);_0x10b67d['filters']=_[_0x2d58('0x3e')](_0x10b67d[_0x2d58('0x3b')],_0x10b67d[_0x2d58('0x3d')]);_0x51a135[_0x2d58('0x3f')]=_[_0x2d58('0x3e')](_0x10b67d[_0x2d58('0x3b')],qs[_0x2d58('0x40')](_0x3dcc17[_0x2d58('0x3d')][_0x2d58('0x40')]));_0x51a135['attributes']=_0x51a135[_0x2d58('0x3f')][_0x2d58('0x41')]?_0x51a135[_0x2d58('0x3f')]:_0x10b67d[_0x2d58('0x3b')];if(!_0x3dcc17['query'][_0x2d58('0x42')](_0x2d58('0x43'))){_0x51a135[_0x2d58('0x2e')]=qs[_0x2d58('0x2e')](_0x3dcc17['query'][_0x2d58('0x2e')]);_0x51a135['offset']=qs[_0x2d58('0x2d')](_0x3dcc17['query'][_0x2d58('0x2d')]);}_0x51a135[_0x2d58('0x44')]=qs[_0x2d58('0x45')](_0x3dcc17[_0x2d58('0x3d')][_0x2d58('0x45')]);_0x51a135[_0x2d58('0x46')]=qs[_0x2d58('0x47')](_[_0x2d58('0x48')](_0x3dcc17['query'],_0x10b67d[_0x2d58('0x47')]),_0x3714dc);if(_0x3dcc17[_0x2d58('0x3d')][_0x2d58('0x49')]){_0x51a135[_0x2d58('0x46')]=_[_0x2d58('0x4a')](_0x51a135[_0x2d58('0x46')],{'$or':_['map'](_0x3714dc,function(_0x1e6165){if(_0x1e6165['type']!=='VIRTUAL'){var _0x23c36c={};_0x23c36c[_0x1e6165[_0x2d58('0x34')]]={'$like':'%'+_0x3dcc17[_0x2d58('0x3d')][_0x2d58('0x49')]+'%'};return _0x23c36c;}})});}_0x51a135=_['merge']({},_0x51a135,_0x3dcc17[_0x2d58('0x4b')]);var _0x314870={'where':_0x51a135[_0x2d58('0x46')]};return db['Network'][_0x2d58('0x2c')](_0x314870)[_0x2d58('0x22')](function(_0x13d9be){_0x3b79c2[_0x2d58('0x2c')]=_0x13d9be;if(_0x3dcc17[_0x2d58('0x3d')][_0x2d58('0x4c')]){_0x51a135[_0x2d58('0x4d')]=[{'all':!![]}];}return db[_0x2d58('0x4e')][_0x2d58('0x4f')](_0x51a135);})[_0x2d58('0x22')](function(_0x5d3036){_0x3b79c2[_0x2d58('0x50')]=_0x5d3036;return _0x3b79c2;})[_0x2d58('0x22')](respondWithFilteredResult(_0x1e8111,_0x51a135))[_0x2d58('0x51')](handleError(_0x1e8111,null));};exports[_0x2d58('0x52')]=function(_0xa0d2a1,_0x2e1e70){var _0x38bd1b={'raw':!![],'where':{'id':_0xa0d2a1[_0x2d58('0x53')]['id']}},_0x298b78={};_0x298b78[_0x2d58('0x3b')]=_[_0x2d58('0x3c')](db[_0x2d58('0x4e')][_0x2d58('0x38')]);_0x298b78[_0x2d58('0x3d')]=_[_0x2d58('0x3c')](_0xa0d2a1['query']);_0x298b78[_0x2d58('0x47')]=_[_0x2d58('0x3e')](_0x298b78[_0x2d58('0x3b')],_0x298b78[_0x2d58('0x3d')]);_0x38bd1b[_0x2d58('0x3f')]=_[_0x2d58('0x3e')](_0x298b78[_0x2d58('0x3b')],qs[_0x2d58('0x40')](_0xa0d2a1[_0x2d58('0x3d')][_0x2d58('0x40')]));_0x38bd1b['attributes']=_0x38bd1b[_0x2d58('0x3f')][_0x2d58('0x41')]?_0x38bd1b[_0x2d58('0x3f')]:_0x298b78[_0x2d58('0x3b')];if(_0xa0d2a1['query'][_0x2d58('0x4c')]){_0x38bd1b[_0x2d58('0x4d')]=[{'all':!![]}];}_0x38bd1b=_['merge']({},_0x38bd1b,_0xa0d2a1[_0x2d58('0x4b')]);return db['Network'][_0x2d58('0x54')](_0x38bd1b)['then'](handleEntityNotFound(_0x2e1e70,null))[_0x2d58('0x22')](respondWithResult(_0x2e1e70,null))[_0x2d58('0x51')](handleError(_0x2e1e70,null));};exports[_0x2d58('0x55')]=function(_0x5a1639,_0x58e6a1,_0x5a2203){var _0xa6810b;return db[_0x2d58('0x56')][_0x2d58('0x57')](function(_0x2558b4){return db[_0x2d58('0x4e')][_0x2d58('0x55')](_0x5a1639['body'],{'raw':!![]})[_0x2d58('0x22')](function(_0x3b281f){_0xa6810b=_0x3b281f;return db[_0x2d58('0x4e')]['findAll']({'where':{'type':_0x5a1639['body']['type']},'raw':!![]});})[_0x2d58('0x22')](function(_0xe112ec){if(_0xa6810b[_0x2d58('0x58')][_0x2d58('0x59')]()==_0x2d58('0x5a')){var _0x20da55=fs[_0x2d58('0x5b')](path['join'](config['root'],_0x2d58('0x5c')),_0x2d58('0x5d'));var _0x41253b=ejs[_0x2d58('0x5e')](_0x20da55,{'networks':_0xe112ec||[]});fs[_0x2d58('0x5f')](_0x2d58('0x60'),_0x41253b);return respondWithRpcPromise(_0x2d58('0x61'),_0x2d58('0x55'),{'module':'res_stun_monitor.so'});}else if(_0xa6810b['type']['toUpperCase']()==_0x2d58('0x62')){var _0x4bd170=fs[_0x2d58('0x5b')](path[_0x2d58('0x63')](config['root'],_0x2d58('0x64')),'utf8');var _0x31024f=ejs[_0x2d58('0x5e')](_0x4bd170,{'networks':_0xe112ec||[]});fs['writeFileSync'](_0x2d58('0x65'),_0x31024f);return respondWithRpcPromise(_0x2d58('0x61'),'create',{'module':_0x2d58('0x66')});}else{var _0x54a6a0=fs[_0x2d58('0x5b')](path[_0x2d58('0x63')](config[_0x2d58('0x67')],_0x2d58('0x68')),_0x2d58('0x5d'));var _0xbc3016=ejs[_0x2d58('0x5e')](_0x54a6a0,{'networks':_0xe112ec||[]});fs[_0x2d58('0x5f')](util['format'](_0x2d58('0x69'),_0x5a1639[_0x2d58('0x6a')][_0x2d58('0x58')][_0x2d58('0x6b')]()),_0xbc3016);return respondWithRpcPromise(_0x2d58('0x61'),'create',{'module':_0x2d58('0x6c')});}return null;})[_0x2d58('0x22')](function(){return _0xa6810b;});})[_0x2d58('0x22')](respondWithResult(_0x58e6a1,0xc9))[_0x2d58('0x51')](handleError(_0x58e6a1,null));};exports[_0x2d58('0x6d')]=function(_0x28660a,_0x29b7c6,_0x2b108d){var _0x1f0781;return db[_0x2d58('0x56')][_0x2d58('0x57')](function(_0x1f674b){return db[_0x2d58('0x4e')][_0x2d58('0x54')]({'where':{'id':_0x28660a[_0x2d58('0x53')]['id']}})[_0x2d58('0x22')](handleEntityNotFound(_0x29b7c6,null))['then'](saveUpdates(_0x28660a[_0x2d58('0x6a')],null))[_0x2d58('0x22')](function(_0x27601e){if(_0x27601e){_0x1f0781=_0x27601e;return db[_0x2d58('0x4e')][_0x2d58('0x4f')]({'where':{'type':_0x1f0781[_0x2d58('0x58')]},'raw':!![]});}return null;})[_0x2d58('0x22')](function(_0x3b1edb){if(_0x1f0781[_0x2d58('0x58')]['toUpperCase']()==_0x2d58('0x5a')){var _0x3e0552=fs['readFileSync'](path[_0x2d58('0x63')](config[_0x2d58('0x67')],_0x2d58('0x5c')),_0x2d58('0x5d'));var _0x37011a=ejs[_0x2d58('0x5e')](_0x3e0552,{'networks':_0x3b1edb||[]});fs[_0x2d58('0x5f')](_0x2d58('0x60'),_0x37011a);return respondWithRpcPromise(_0x2d58('0x61'),_0x2d58('0x6d'),{'module':_0x2d58('0x66')});}else if(_0x1f0781[_0x2d58('0x58')][_0x2d58('0x59')]()=='TURN'){var _0x14b674=fs[_0x2d58('0x5b')](path['join'](config[_0x2d58('0x67')],_0x2d58('0x64')),_0x2d58('0x5d'));var _0x43e91e=ejs['render'](_0x14b674,{'networks':_0x3b1edb||[]});fs['writeFileSync'](_0x2d58('0x65'),_0x43e91e);return respondWithRpcPromise(_0x2d58('0x61'),_0x2d58('0x6d'),{'module':_0x2d58('0x66')});}else{var _0x3f9b42=fs[_0x2d58('0x5b')](path[_0x2d58('0x63')](config[_0x2d58('0x67')],'server/files/templates/network.ejs'),_0x2d58('0x5d'));var _0x2f47d1=ejs[_0x2d58('0x5e')](_0x3f9b42,{'networks':_0x3b1edb||[]});fs[_0x2d58('0x5f')](util[_0x2d58('0x6e')](_0x2d58('0x69'),_0x28660a['body']['type']['toLowerCase']()),_0x2f47d1);return respondWithRpcPromise(_0x2d58('0x61'),_0x2d58('0x6d'),{'module':_0x2d58('0x6c')});}return null;})['then'](function(_0x393870){if(_0x393870){return _0x1f0781;}return null;});})[_0x2d58('0x22')](respondWithResult(_0x29b7c6,null))[_0x2d58('0x51')](handleError(_0x29b7c6,null));};exports[_0x2d58('0x6f')]=function(_0x40a2c7,_0x413a04,_0x759df6){var _0x43f299;return db[_0x2d58('0x4e')][_0x2d58('0x54')]({'where':{'id':_0x40a2c7[_0x2d58('0x53')]['id']}})[_0x2d58('0x22')](function(_0x42de67){_0x43f299=_0x42de67;return _0x42de67;})['then'](handleEntityNotFound(_0x413a04,null))['then'](removeEntity(_0x413a04,null))[_0x2d58('0x22')](function(){if(_0x43f299){return db[_0x2d58('0x4e')][_0x2d58('0x4f')]({'where':{'type':_0x43f299[_0x2d58('0x58')]},'raw':!![]});}})['then'](function(_0x8a2176){if(_0x43f299[_0x2d58('0x58')]['toUpperCase']()==_0x2d58('0x5a')){var _0x2e2010=fs[_0x2d58('0x5b')](path[_0x2d58('0x63')](config[_0x2d58('0x67')],_0x2d58('0x5c')),_0x2d58('0x5d'));var _0x53f7ed=ejs[_0x2d58('0x5e')](_0x2e2010,{'networks':_0x8a2176||[]});fs[_0x2d58('0x5f')](_0x2d58('0x60'),_0x53f7ed);return respondWithRpcPromise('Reload',_0x2d58('0x6f'),{'module':'res_stun_monitor.so'});}else if(_0x43f299['type'][_0x2d58('0x59')]()==_0x2d58('0x62')){var _0x3ad275=fs['readFileSync'](path[_0x2d58('0x63')](config[_0x2d58('0x67')],_0x2d58('0x64')),'utf8');var _0x43c5f9=ejs[_0x2d58('0x5e')](_0x3ad275,{'networks':_0x8a2176||[]});fs[_0x2d58('0x5f')](_0x2d58('0x65'),_0x43c5f9);return respondWithRpcPromise(_0x2d58('0x61'),_0x2d58('0x6f'),{'module':_0x2d58('0x66')});}else{var _0x488b6f=fs[_0x2d58('0x5b')](path[_0x2d58('0x63')](config[_0x2d58('0x67')],'server/files/templates/network.ejs'),'utf8');var _0x437118=ejs[_0x2d58('0x5e')](_0x488b6f,{'networks':_0x8a2176||[]});fs['writeFileSync'](util[_0x2d58('0x6e')](_0x2d58('0x69'),_0x40a2c7[_0x2d58('0x6a')][_0x2d58('0x58')][_0x2d58('0x6b')]()),_0x437118);return respondWithRpcPromise(_0x2d58('0x61'),_0x2d58('0x6f'),{'module':'chan_sip.so'});}return null;})[_0x2d58('0x51')](handleError(_0x413a04,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 4413034..bf05385 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 _0xd3d1=['../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x588fd3,_0x40b0ac){var _0x396015=function(_0x25e5d1){while(--_0x25e5d1){_0x588fd3['push'](_0x588fd3['shift']());}};_0x396015(++_0x40b0ac);}(_0xd3d1,0x172));var _0x1d3d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd3d1[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d3d('0x2'));var BPromise=require(_0x1d3d('0x3'));var rp=require(_0x1d3d('0x4'));var fs=require('fs');var path=require(_0x1d3d('0x5'));var rimraf=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var attributes=require(_0x1d3d('0x8'));module[_0x1d3d('0x9')]=function(_0x1cbe06,_0x449475){return _0x1cbe06[_0x1d3d('0xa')](_0x1d3d('0xb'),attributes,{'tableName':_0x1d3d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39cb=['network','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','define','Network'];(function(_0x297999,_0x48a4bc){var _0x2abdfa=function(_0x2184cf){while(--_0x2184cf){_0x297999['push'](_0x297999['shift']());}};_0x2abdfa(++_0x48a4bc);}(_0x39cb,0x1bd));var _0xb39c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39cb[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var logger=require(_0xb39c('0x1'))('api');var moment=require(_0xb39c('0x2'));var BPromise=require(_0xb39c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb39c('0x4'));var rimraf=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var attributes=require(_0xb39c('0x7'));module[_0xb39c('0x8')]=function(_0x4ae4cf,_0x32cdcd){return _0x4ae4cf[_0xb39c('0x9')](_0xb39c('0xa'),attributes,{'tableName':_0xb39c('0xb'),'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 04e6cbd..365cae9 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 _0x5ec4=['result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x5ec4,0x145));var _0x45ec=function(_0xf6459e,_0x46ce62){_0xf6459e=_0xf6459e-0x0;var _0x5d4dc2=_0x5ec4[_0xf6459e];return _0x5d4dc2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x45ec('0x0'));var rs=require(_0x45ec('0x1'));var fs=require('fs');var Redis=require(_0x45ec('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x45ec('0x3'));var logger=require(_0x45ec('0x4'))(_0x45ec('0x5'));var config=require(_0x45ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x45ec('0x7')][_0x45ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x230aae,_0x3bfcc4,_0x125e9f){return new BPromise(function(_0x274b39,_0x1a70e9){return client['request'](_0x230aae,_0x125e9f)[_0x45ec('0x9')](function(_0x5606af){logger['info'](_0x45ec('0xa'),_0x3bfcc4,_0x45ec('0xb'));logger[_0x45ec('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x3bfcc4,_0x45ec('0xb'),JSON[_0x45ec('0xd')](_0x5606af));if(_0x5606af['error']){if(_0x5606af[_0x45ec('0xe')][_0x45ec('0xf')]===0x1f4){logger[_0x45ec('0xe')](_0x45ec('0xa'),_0x3bfcc4,_0x5606af[_0x45ec('0xe')][_0x45ec('0x10')]);return _0x1a70e9(_0x5606af[_0x45ec('0xe')][_0x45ec('0x10')]);}logger['error'](_0x45ec('0xa'),_0x3bfcc4,_0x5606af[_0x45ec('0xe')][_0x45ec('0x10')]);return _0x274b39(_0x5606af[_0x45ec('0xe')][_0x45ec('0x10')]);}else{logger['info'](_0x45ec('0xa'),_0x3bfcc4,_0x45ec('0xb'));_0x274b39(_0x5606af[_0x45ec('0x11')][_0x45ec('0x10')]);}})[_0x45ec('0x12')](function(_0x923bc1){logger['error'](_0x45ec('0xa'),_0x3bfcc4,_0x923bc1);_0x1a70e9(_0x923bc1);});});} \ No newline at end of file +var _0xb4a3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0xb4a3,0x72));var _0x3b4a=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xb4a3[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x3b4a('0x0'));var util=require('util');var moment=require(_0x3b4a('0x1'));var BPromise=require(_0x3b4a('0x2'));var rs=require(_0x3b4a('0x3'));var fs=require('fs');var Redis=require(_0x3b4a('0x4'));var db=require(_0x3b4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b4a('0x6'))(_0x3b4a('0x7'));var config=require('../../config/environment');var jayson=require(_0x3b4a('0x8'));var client=jayson[_0x3b4a('0x9')][_0x3b4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8b6cfc,_0x2ed021,_0x4b427f){return new BPromise(function(_0x11bd6e,_0x48eb2a){return client[_0x3b4a('0xb')](_0x8b6cfc,_0x4b427f)['then'](function(_0x4bb56d){logger['info'](_0x3b4a('0xc'),_0x2ed021,_0x3b4a('0xd'));logger[_0x3b4a('0xe')](_0x3b4a('0xf'),_0x2ed021,_0x3b4a('0xd'),JSON[_0x3b4a('0x10')](_0x4bb56d));if(_0x4bb56d['error']){if(_0x4bb56d[_0x3b4a('0x11')][_0x3b4a('0x12')]===0x1f4){logger[_0x3b4a('0x11')]('Network,\x20%s,\x20%s',_0x2ed021,_0x4bb56d[_0x3b4a('0x11')]['message']);return _0x48eb2a(_0x4bb56d[_0x3b4a('0x11')]['message']);}logger[_0x3b4a('0x11')](_0x3b4a('0xc'),_0x2ed021,_0x4bb56d['error'][_0x3b4a('0x13')]);return _0x11bd6e(_0x4bb56d[_0x3b4a('0x11')][_0x3b4a('0x13')]);}else{logger[_0x3b4a('0x14')](_0x3b4a('0xc'),_0x2ed021,_0x3b4a('0xd'));_0x11bd6e(_0x4bb56d[_0x3b4a('0x15')][_0x3b4a('0x13')]);}})[_0x3b4a('0x16')](function(_0x4daac6){logger[_0x3b4a('0x11')](_0x3b4a('0xc'),_0x2ed021,_0x4daac6);_0x48eb2a(_0x4daac6);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index dec1fcc..d45dd35 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 _0xcc5a=['isAuthenticated','sendNotification','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./notification.controller','post'];(function(_0x13490b,_0x2232ab){var _0x25d1b0=function(_0x59c3ae){while(--_0x59c3ae){_0x13490b['push'](_0x13490b['shift']());}};_0x25d1b0(++_0x2232ab);}(_0xcc5a,0x107));var _0xacc5=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0xcc5a[_0x1daaa9];return _0x1dd221;};'use strict';var multer=require(_0xacc5('0x0'));var util=require(_0xacc5('0x1'));var path=require(_0xacc5('0x2'));var timeout=require(_0xacc5('0x3'));var express=require(_0xacc5('0x4'));var router=express[_0xacc5('0x5')]();var auth=require(_0xacc5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xacc5('0x7'));var controller=require(_0xacc5('0x8'));router[_0xacc5('0x9')]('/',auth[_0xacc5('0xa')](),controller[_0xacc5('0xb')]);module[_0xacc5('0xc')]=router; \ No newline at end of file +var _0xeafe=['../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','isAuthenticated','sendNotification','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1a9362,_0x435d63){var _0x4e0573=function(_0x580ef3){while(--_0x580ef3){_0x1a9362['push'](_0x1a9362['shift']());}};_0x4e0573(++_0x435d63);}(_0xeafe,0x180));var _0xeeaf=function(_0xa7a62f,_0x355c91){_0xa7a62f=_0xa7a62f-0x0;var _0x3d1641=_0xeafe[_0xa7a62f];return _0x3d1641;};'use strict';var multer=require(_0xeeaf('0x0'));var util=require(_0xeeaf('0x1'));var path=require(_0xeeaf('0x2'));var timeout=require(_0xeeaf('0x3'));var express=require(_0xeeaf('0x4'));var router=express[_0xeeaf('0x5')]();var auth=require(_0xeeaf('0x6'));var interaction=require(_0xeeaf('0x7'));var config=require(_0xeeaf('0x8'));var controller=require(_0xeeaf('0x9'));router['post']('/',auth[_0xeeaf('0xa')](),controller[_0xeeaf('0xb')]);module[_0xeeaf('0xc')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index fdd63d7..cf43542 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 _0xe822=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xe822,0x75));var _0x2e82=function(_0x1ff38f,_0x77afc8){_0x1ff38f=_0x1ff38f-0x0;var _0x5c394a=_0xe822[_0x1ff38f];return _0x5c394a;};'use strict';var Sequelize=require(_0x2e82('0x0'));module[_0x2e82('0x1')]={'body':{'type':Sequelize[_0x2e82('0x2')]},'senderName':{'type':Sequelize[_0x2e82('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x2e82('0x3')]},'beep':{'type':Sequelize[_0x2e82('0x4')]}}; \ No newline at end of file +var _0x7cf7=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x44d902,_0x376b4e){var _0x27aa72=function(_0x5059fd){while(--_0x5059fd){_0x44d902['push'](_0x44d902['shift']());}};_0x27aa72(++_0x376b4e);}(_0x7cf7,0x1af));var _0x77cf=function(_0x58328e,_0x7ab78d){_0x58328e=_0x58328e-0x0;var _0x2484f2=_0x7cf7[_0x58328e];return _0x2484f2;};'use strict';var Sequelize=require(_0x77cf('0x0'));module[_0x77cf('0x1')]={'body':{'type':Sequelize[_0x77cf('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x77cf('0x2')]},'recipientsDescription':{'type':Sequelize[_0x77cf('0x3')]},'beep':{'type':Sequelize[_0x77cf('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index fd48c7f..47d45f7 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 _0x9ae9=['apply','save','then','destroy','error','stack','name','send','sendNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','Notification','create','forEach','emit','notification:send','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','ids','queue','replace','Queue','push','all','union','flatten','catch','getAgents','map','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','./notification.socket','register','sendStatus','end','json','count','offset','limit','status','set','Content-Range'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x9ae9,0x1d3));var _0x99ae=function(_0x5467f1,_0x4ca013){_0x5467f1=_0x5467f1-0x0;var _0x1c1041=_0x9ae9[_0x5467f1];return _0x1c1041;};'use strict';var pdf=require(_0x99ae('0x0'));var emlformat=require(_0x99ae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x99ae('0x2'));var jsonpatch=require(_0x99ae('0x3'));var rp=require('request-promise');var moment=require(_0x99ae('0x4'));var BPromise=require(_0x99ae('0x5'));var Mustache=require(_0x99ae('0x6'));var util=require(_0x99ae('0x7'));var path=require(_0x99ae('0x8'));var sox=require(_0x99ae('0x9'));var csv=require('to-csv');var ejs=require(_0x99ae('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x99ae('0xb'));var crypto=require(_0x99ae('0xc'));var jsforce=require(_0x99ae('0xd'));var deskjs=require(_0x99ae('0xe'));var toCsv=require(_0x99ae('0xf'));var querystring=require('querystring');var Papa=require(_0x99ae('0x10'));var Redis=require(_0x99ae('0x11'));var authService=require(_0x99ae('0x12'));var qs=require(_0x99ae('0x13'));var as=require(_0x99ae('0x14'));var hardwareService=require(_0x99ae('0x15'));var logger=require(_0x99ae('0x16'))(_0x99ae('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x99ae('0x18'))['db'];config[_0x99ae('0x19')]=_[_0x99ae('0x1a')](config[_0x99ae('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99ae('0x19')]));require(_0x99ae('0x1b'))[_0x99ae('0x1c')](socket);function respondWithStatusCode(_0x36dd50,_0x287b0d){_0x287b0d=_0x287b0d||0xcc;return function(_0x2c06ee){if(_0x2c06ee){return _0x36dd50[_0x99ae('0x1d')](_0x287b0d);}return _0x36dd50['status'](_0x287b0d)[_0x99ae('0x1e')]();};}function respondWithResult(_0x18e866,_0x444386){_0x444386=_0x444386||0xc8;return function(_0x4c1e12){if(_0x4c1e12){return _0x18e866['status'](_0x444386)[_0x99ae('0x1f')](_0x4c1e12);}};}function respondWithFilteredResult(_0x912862,_0x1ba016){return function(_0x12e5a7){if(_0x12e5a7){var _0x3020bd=_0x12e5a7[_0x99ae('0x20')],_0x4e67f1=_0x1ba016[_0x99ae('0x21')],_0x171f62=_0x1ba016['offset']+_0x1ba016[_0x99ae('0x22')],_0x2c45d6;if(_0x171f62>=_0x3020bd){_0x171f62=_0x3020bd;_0x2c45d6=0xc8;}else{_0x2c45d6=0xce;}_0x912862[_0x99ae('0x23')](_0x2c45d6);return _0x912862[_0x99ae('0x24')](_0x99ae('0x25'),_0x4e67f1+'-'+_0x171f62+'/'+_0x3020bd)[_0x99ae('0x1f')](_0x12e5a7);}return null;};}function patchUpdates(_0x255e78){return function(_0x7ec516){try{jsonpatch[_0x99ae('0x26')](_0x7ec516,_0x255e78,!![]);}catch(_0x882187){return BPromise['reject'](_0x882187);}return _0x7ec516[_0x99ae('0x27')]();};}function saveUpdates(_0x1a27e5,_0x1b43e6){return function(_0x1f57c3){if(_0x1f57c3){return _0x1f57c3['update'](_0x1a27e5)[_0x99ae('0x28')](function(_0x13087b){return _0x13087b;});}return null;};}function removeEntity(_0x230d23,_0x5101b3){return function(_0x4d6bf3){if(_0x4d6bf3){return _0x4d6bf3[_0x99ae('0x29')]()[_0x99ae('0x28')](function(){_0x230d23[_0x99ae('0x23')](0xcc)[_0x99ae('0x1e')]();});}};}function handleEntityNotFound(_0x5a6b52,_0xbd4d11){return function(_0x1dfcd3){if(!_0x1dfcd3){_0x5a6b52[_0x99ae('0x1d')](0x194);}return _0x1dfcd3;};}function handleError(_0x4c82d0,_0x3f844f){_0x3f844f=_0x3f844f||0x1f4;return function(_0x1407cf){logger[_0x99ae('0x2a')](_0x1407cf[_0x99ae('0x2b')]);if(_0x1407cf[_0x99ae('0x2c')]){delete _0x1407cf[_0x99ae('0x2c')];}_0x4c82d0[_0x99ae('0x23')](_0x3f844f)[_0x99ae('0x2d')](_0x1407cf);};}exports[_0x99ae('0x2e')]=function(_0xe5592a,_0x4c2f0f,_0xd89600){if(!_0xe5592a[_0x99ae('0x2f')][_0x99ae('0x30')](_0x99ae('0x31'))&&!_0xe5592a[_0x99ae('0x2f')][_0x99ae('0x30')]('TemplateId')){throw new db[(_0x99ae('0x32'))][(_0x99ae('0x33'))](_0x99ae('0x34'));}else{if(_0xe5592a['body'][_0x99ae('0x30')](_0x99ae('0x35'))&&!_0xe5592a[_0x99ae('0x2f')][_0x99ae('0x30')]('view')){throw new db[(_0x99ae('0x32'))][(_0x99ae('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xe5592a[_0x99ae('0x2f')][_0x99ae('0x30')](_0x99ae('0x36'))){throw new db['Sequelize'][(_0x99ae('0x33'))](_0x99ae('0x37'));}else{try{var _0x43aeef=JSON[_0x99ae('0x38')](_0xe5592a['body'][_0x99ae('0x36')]);}catch(_0xfee509){logger[_0x99ae('0x2a')](_0xfee509);throw new db[(_0x99ae('0x32'))][(_0x99ae('0x33'))](_0x99ae('0x39'));}var _0x9a67ba=[_0x99ae('0x3a'),_0x99ae('0x3b'),_0x99ae('0x3c'),_0x99ae('0x3d'),_0x99ae('0x3e'),'voicequeue','whatsappqueue',_0x99ae('0x3f'),_0x99ae('0x40')];if(_[_0x99ae('0x41')](_0x43aeef,function(_0x581b4f){return!_[_0x99ae('0x42')](_0x9a67ba,_0x581b4f['model'][_0x99ae('0x43')]());})){throw new db['Sequelize'][(_0x99ae('0x33'))](_0x99ae('0x44'));}}}var _0x201389={};_0x201389[_0x99ae('0x45')]=_0xe5592a[_0x99ae('0x2f')][_0x99ae('0x30')](_0x99ae('0x45'))?_0xe5592a[_0x99ae('0x2f')][_0x99ae('0x45')]:_0xe5592a[_0x99ae('0x40')][_0x99ae('0x46')];_0x201389[_0x99ae('0x47')]=_['isEmpty'](_0xe5592a[_0x99ae('0x2f')][_0x99ae('0x47')])?null:_0xe5592a[_0x99ae('0x2f')][_0x99ae('0x47')];_0x201389[_0x99ae('0x48')]=_0xe5592a['body'][_0x99ae('0x48')]||![];_0x201389[_0x99ae('0x49')]=_0xe5592a[_0x99ae('0x40')]['id'];return getContent(_0xe5592a[_0x99ae('0x2f')])[_0x99ae('0x28')](function(_0xfd5779){_0x201389[_0x99ae('0x2f')]=_0xfd5779;return getRecipients(_0x43aeef);})[_0x99ae('0x28')](function(_0x2b8942){_0x201389[_0x99ae('0x4a')]=_[_0x99ae('0x4b')](_0x2b8942)['join'](',');return db[_0x99ae('0x4c')][_0x99ae('0x4d')](function(_0xc3a12d){return db[_0x99ae('0x4e')][_0x99ae('0x4f')](_0x201389,{'raw':!![],'transaction':_0xc3a12d})[_0x99ae('0x28')](function(_0x106736){var _0x476714={'sender':_0x201389[_0x99ae('0x45')],'description':_0x201389[_0x99ae('0x47')],'content':_0x201389[_0x99ae('0x2f')],'beep':_0x201389['beep']};_0x2b8942[_0x99ae('0x50')](function(_0x5f0a5b){_0x476714['recipient']=_0x5f0a5b;socket[_0x99ae('0x51')](_0x99ae('0x52'),_0x476714);});return _0x106736;});});})[_0x99ae('0x28')](respondWithResult(_0x4c2f0f,0xc9))['catch'](handleError(_0x4c2f0f,null));};function getContent(_0x502aac){return new BPromise(function(_0x6c63de,_0x5f017f){if(_0x502aac[_0x99ae('0x31')]){_0x6c63de(_0x502aac[_0x99ae('0x31')]);return;}return db[_0x99ae('0x53')][_0x99ae('0x54')]({'attributes':['html'],'where':{'id':_0x502aac[_0x99ae('0x35')]},'raw':!![]})[_0x99ae('0x28')](function(_0x123ee5){if(!_0x123ee5)throw new db['Sequelize'][(_0x99ae('0x33'))](_0x99ae('0x55'));var _0x56b7bc=Mustache[_0x99ae('0x56')](_0x123ee5[_0x99ae('0x57')],_0x502aac['view']);_0x6c63de(_0x56b7bc);})['catch'](function(_0x34eb69){_0x5f017f(_0x34eb69);});});}function getRecipients(_0x58964a){return new BPromise(function(_0x1d5639,_0x3c16ed){var _0xaa8617=[];var _0x42644e=[];_0x58964a['forEach'](function(_0x38fe49){var _0x1d0f66=_[_0x99ae('0x58')](_0x38fe49['model'][_0x99ae('0x43')]());if(_0x1d0f66===_0x99ae('0x59')){_0xaa8617=_['union'](_0xaa8617,_0x38fe49[_0x99ae('0x5a')]);}else{if(_[_0x99ae('0x42')](_0x1d0f66,_0x99ae('0x5b')))_0x1d0f66=_0x1d0f66[_0x99ae('0x5c')]('queue',_0x99ae('0x5d'));_0x38fe49[_0x99ae('0x5a')][_0x99ae('0x50')](function(_0x38e501){_0x42644e[_0x99ae('0x5e')](getAgents(_0x1d0f66,_0x38e501));});}});return BPromise[_0x99ae('0x5f')](_0x42644e)[_0x99ae('0x28')](function(_0x1420e5){_0xaa8617=_[_0x99ae('0x60')](_0xaa8617,_[_0x99ae('0x61')](_0x1420e5));_0x1d5639(_0xaa8617);})[_0x99ae('0x62')](function(_0x423a8b){_0x3c16ed(_0x423a8b);});});}function getAgents(_0x58bffa,_0x1009b){return new BPromise(function(_0x166206,_0x1f7193){return db[_0x58bffa][_0x99ae('0x54')]({'where':{'id':_0x1009b}})[_0x99ae('0x28')](function(_0xc73727){return _0xc73727[_0x99ae('0x63')]({'attributes':['id'],'raw':!![]})[_0x99ae('0x28')](function(_0x35930d){var _0x340bca=_[_0x99ae('0x64')](_0x35930d,'id');_0x166206(_0x340bca);});})[_0x99ae('0x62')](function(_0x37c3a0){_0x1f7193(_0x37c3a0);});});} \ No newline at end of file +var _0x0bbc=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','sendNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','Notification','create','emit','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','forEach','startCase','User','union','ids','queue','replace','push','all','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x5b2a35,_0x4814b6){var _0x5ce1e0=function(_0x1464d9){while(--_0x1464d9){_0x5b2a35['push'](_0x5b2a35['shift']());}};_0x5ce1e0(++_0x4814b6);}(_0x0bbc,0xaf));var _0xc0bb=function(_0x41063b,_0x530d6b){_0x41063b=_0x41063b-0x0;var _0xc692dc=_0x0bbc[_0x41063b];return _0xc692dc;};'use strict';var pdf=require(_0xc0bb('0x0'));var emlformat=require(_0xc0bb('0x1'));var rimraf=require(_0xc0bb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0bb('0x3'));var rp=require(_0xc0bb('0x4'));var moment=require(_0xc0bb('0x5'));var BPromise=require(_0xc0bb('0x6'));var Mustache=require(_0xc0bb('0x7'));var util=require('util');var path=require(_0xc0bb('0x8'));var sox=require(_0xc0bb('0x9'));var csv=require(_0xc0bb('0xa'));var ejs=require(_0xc0bb('0xb'));var fs=require('fs');var _=require(_0xc0bb('0xc'));var squel=require('squel');var crypto=require(_0xc0bb('0xd'));var jsforce=require(_0xc0bb('0xe'));var deskjs=require(_0xc0bb('0xf'));var toCsv=require(_0xc0bb('0xa'));var querystring=require(_0xc0bb('0x10'));var Papa=require(_0xc0bb('0x11'));var Redis=require('ioredis');var authService=require(_0xc0bb('0x12'));var qs=require(_0xc0bb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc0bb('0x14'));var logger=require(_0xc0bb('0x15'))(_0xc0bb('0x16'));var utils=require(_0xc0bb('0x17'));var config=require(_0xc0bb('0x18'));var db=require('../../mysqldb')['db'];config[_0xc0bb('0x19')]=_[_0xc0bb('0x1a')](config[_0xc0bb('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xc0bb('0x1b'))(new Redis(config[_0xc0bb('0x19')]));require(_0xc0bb('0x1c'))[_0xc0bb('0x1d')](socket);function respondWithStatusCode(_0x5ac473,_0x519f8d){_0x519f8d=_0x519f8d||0xcc;return function(_0x42f145){if(_0x42f145){return _0x5ac473[_0xc0bb('0x1e')](_0x519f8d);}return _0x5ac473[_0xc0bb('0x1f')](_0x519f8d)[_0xc0bb('0x20')]();};}function respondWithResult(_0x19879f,_0x4a190a){_0x4a190a=_0x4a190a||0xc8;return function(_0x2efe58){if(_0x2efe58){return _0x19879f[_0xc0bb('0x1f')](_0x4a190a)[_0xc0bb('0x21')](_0x2efe58);}};}function respondWithFilteredResult(_0x1b9cd5,_0x287313){return function(_0x613b26){if(_0x613b26){var _0x57172f=_0x613b26[_0xc0bb('0x22')],_0x3e9643=_0x287313[_0xc0bb('0x23')],_0xf89b18=_0x287313[_0xc0bb('0x23')]+_0x287313[_0xc0bb('0x24')],_0x2e55c1;if(_0xf89b18>=_0x57172f){_0xf89b18=_0x57172f;_0x2e55c1=0xc8;}else{_0x2e55c1=0xce;}_0x1b9cd5['status'](_0x2e55c1);return _0x1b9cd5[_0xc0bb('0x25')](_0xc0bb('0x26'),_0x3e9643+'-'+_0xf89b18+'/'+_0x57172f)[_0xc0bb('0x21')](_0x613b26);}return null;};}function patchUpdates(_0x459f55){return function(_0x644312){try{jsonpatch['apply'](_0x644312,_0x459f55,!![]);}catch(_0x17edcb){return BPromise['reject'](_0x17edcb);}return _0x644312[_0xc0bb('0x27')]();};}function saveUpdates(_0x425bbf,_0x11c293){return function(_0x33cc45){if(_0x33cc45){return _0x33cc45['update'](_0x425bbf)[_0xc0bb('0x28')](function(_0x36b478){return _0x36b478;});}return null;};}function removeEntity(_0x2ff248,_0xe3e298){return function(_0x3fe298){if(_0x3fe298){return _0x3fe298[_0xc0bb('0x29')]()[_0xc0bb('0x28')](function(){_0x2ff248['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de21f,_0x21797e){return function(_0x3eb82a){if(!_0x3eb82a){_0x3de21f[_0xc0bb('0x1e')](0x194);}return _0x3eb82a;};}function handleError(_0x4a875c,_0x2a8bae){_0x2a8bae=_0x2a8bae||0x1f4;return function(_0x3999a9){logger[_0xc0bb('0x2a')](_0x3999a9[_0xc0bb('0x2b')]);if(_0x3999a9[_0xc0bb('0x2c')]){delete _0x3999a9['name'];}_0x4a875c[_0xc0bb('0x1f')](_0x2a8bae)['send'](_0x3999a9);};}exports[_0xc0bb('0x2d')]=function(_0x5305a9,_0x269f25,_0x213719){if(!_0x5305a9[_0xc0bb('0x2e')][_0xc0bb('0x2f')]('text')&&!_0x5305a9[_0xc0bb('0x2e')]['hasOwnProperty'](_0xc0bb('0x30'))){throw new db[(_0xc0bb('0x31'))][(_0xc0bb('0x32'))](_0xc0bb('0x33'));}else{if(_0x5305a9[_0xc0bb('0x2e')][_0xc0bb('0x2f')](_0xc0bb('0x30'))&&!_0x5305a9[_0xc0bb('0x2e')][_0xc0bb('0x2f')]('view')){throw new db[(_0xc0bb('0x31'))][(_0xc0bb('0x32'))](_0xc0bb('0x34'));}if(!_0x5305a9['body'][_0xc0bb('0x2f')](_0xc0bb('0x35'))){throw new db['Sequelize']['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4543eb=JSON[_0xc0bb('0x36')](_0x5305a9[_0xc0bb('0x2e')][_0xc0bb('0x35')]);}catch(_0x395ff1){logger[_0xc0bb('0x2a')](_0x395ff1);throw new db[(_0xc0bb('0x31'))]['ValidationError'](_0xc0bb('0x37'));}var _0x176dc7=[_0xc0bb('0x38'),_0xc0bb('0x39'),'mailqueue',_0xc0bb('0x3a'),'smsqueue','voicequeue','whatsappqueue',_0xc0bb('0x3b'),_0xc0bb('0x3c')];if(_[_0xc0bb('0x3d')](_0x4543eb,function(_0x3b1e22){return!_[_0xc0bb('0x3e')](_0x176dc7,_0x3b1e22[_0xc0bb('0x3f')][_0xc0bb('0x40')]());})){throw new db[(_0xc0bb('0x31'))][(_0xc0bb('0x32'))](_0xc0bb('0x41'));}}}var _0x1f723b={};_0x1f723b['senderName']=_0x5305a9[_0xc0bb('0x2e')][_0xc0bb('0x2f')](_0xc0bb('0x42'))?_0x5305a9['body'][_0xc0bb('0x42')]:_0x5305a9['user'][_0xc0bb('0x43')];_0x1f723b[_0xc0bb('0x44')]=_['isEmpty'](_0x5305a9[_0xc0bb('0x2e')][_0xc0bb('0x44')])?null:_0x5305a9[_0xc0bb('0x2e')]['recipientsDescription'];_0x1f723b[_0xc0bb('0x45')]=_0x5305a9[_0xc0bb('0x2e')][_0xc0bb('0x45')]||![];_0x1f723b[_0xc0bb('0x46')]=_0x5305a9[_0xc0bb('0x3c')]['id'];return getContent(_0x5305a9[_0xc0bb('0x2e')])[_0xc0bb('0x28')](function(_0x5d4496){_0x1f723b['body']=_0x5d4496;return getRecipients(_0x4543eb);})[_0xc0bb('0x28')](function(_0x57b626){_0x1f723b[_0xc0bb('0x47')]=_[_0xc0bb('0x48')](_0x57b626)[_0xc0bb('0x49')](',');return db[_0xc0bb('0x4a')][_0xc0bb('0x4b')](function(_0x1aaba7){return db[_0xc0bb('0x4c')][_0xc0bb('0x4d')](_0x1f723b,{'raw':!![],'transaction':_0x1aaba7})[_0xc0bb('0x28')](function(_0x29f23d){var _0x15141b={'sender':_0x1f723b['senderName'],'description':_0x1f723b[_0xc0bb('0x44')],'content':_0x1f723b['body'],'beep':_0x1f723b[_0xc0bb('0x45')]};_0x57b626['forEach'](function(_0x451374){_0x15141b['recipient']=_0x451374;socket[_0xc0bb('0x4e')]('notification:send',_0x15141b);});return _0x29f23d;});});})[_0xc0bb('0x28')](respondWithResult(_0x269f25,0xc9))[_0xc0bb('0x4f')](handleError(_0x269f25,null));};function getContent(_0x5c1210){return new BPromise(function(_0x5ea7e1,_0x71e5f5){if(_0x5c1210[_0xc0bb('0x50')]){_0x5ea7e1(_0x5c1210[_0xc0bb('0x50')]);return;}return db[_0xc0bb('0x51')][_0xc0bb('0x52')]({'attributes':[_0xc0bb('0x53')],'where':{'id':_0x5c1210['TemplateId']},'raw':!![]})[_0xc0bb('0x28')](function(_0x3d1317){if(!_0x3d1317)throw new db[(_0xc0bb('0x31'))][(_0xc0bb('0x32'))](_0xc0bb('0x54'));var _0x39035a=Mustache[_0xc0bb('0x55')](_0x3d1317['html'],_0x5c1210[_0xc0bb('0x56')]);_0x5ea7e1(_0x39035a);})[_0xc0bb('0x4f')](function(_0x2a3e70){_0x71e5f5(_0x2a3e70);});});}function getRecipients(_0x510856){return new BPromise(function(_0xeb6d42,_0x508eb5){var _0x4c6e6c=[];var _0x5f2dbd=[];_0x510856[_0xc0bb('0x57')](function(_0xabca37){var _0x228314=_[_0xc0bb('0x58')](_0xabca37[_0xc0bb('0x3f')][_0xc0bb('0x40')]());if(_0x228314===_0xc0bb('0x59')){_0x4c6e6c=_[_0xc0bb('0x5a')](_0x4c6e6c,_0xabca37[_0xc0bb('0x5b')]);}else{if(_[_0xc0bb('0x3e')](_0x228314,_0xc0bb('0x5c')))_0x228314=_0x228314[_0xc0bb('0x5d')](_0xc0bb('0x5c'),'Queue');_0xabca37[_0xc0bb('0x5b')][_0xc0bb('0x57')](function(_0x324458){_0x5f2dbd[_0xc0bb('0x5e')](getAgents(_0x228314,_0x324458));});}});return BPromise[_0xc0bb('0x5f')](_0x5f2dbd)['then'](function(_0x5233f8){_0x4c6e6c=_[_0xc0bb('0x5a')](_0x4c6e6c,_['flatten'](_0x5233f8));_0xeb6d42(_0x4c6e6c);})[_0xc0bb('0x4f')](function(_0x3f8ca2){_0x508eb5(_0x3f8ca2);});});}function getAgents(_0x3283fc,_0x12ab61){return new BPromise(function(_0x4808ed,_0x55a6ce){return db[_0x3283fc][_0xc0bb('0x52')]({'where':{'id':_0x12ab61}})['then'](function(_0x59b68d){return _0x59b68d['getAgents']({'attributes':['id'],'raw':!![]})[_0xc0bb('0x28')](function(_0xe3d3c0){var _0x4ea444=_['map'](_0xe3d3c0,'id');_0x4808ed(_0x4ea444);});})['catch'](function(_0x2d2247){_0x55a6ce(_0x2d2247);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index eea5067..2392ce6 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 _0xb10b=['hasOwnProperty','hook','events','Notification','setMaxListeners','save','remove','emit'];(function(_0x4b3946,_0x1d529f){var _0x24ba53=function(_0x18d3d8){while(--_0x18d3d8){_0x4b3946['push'](_0x4b3946['shift']());}};_0x24ba53(++_0x1d529f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ff332,_0x145564){_0x3ff332=_0x3ff332-0x0;var _0x5a2264=_0xb10b[_0x3ff332];return _0x5a2264;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Notification=require('../../mysqldb')['db'][_0xbb10('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){NotificationEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);NotificationEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Notification[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x42621b,_0x129717){var _0x35abaa=function(_0x3ff9ca){while(--_0x3ff9ca){_0x42621b['push'](_0x42621b['shift']());}};_0x35abaa(++_0x129717);}(_0xdb28,0x106));var _0x8db2=function(_0x1b89df,_0x280f9d){_0x1b89df=_0x1b89df-0x0;var _0xe52db3=_0xdb28[_0x1b89df];return _0xe52db3;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Notification=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){NotificationEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);NotificationEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index aa997f5..a0d20aa 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 _0xd7d1=['path','rimraf','../../config/environment','./notification.attributes','exports','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc43a0c,_0x4266a0){var _0x57e423=function(_0x61cf3d){while(--_0x61cf3d){_0xc43a0c['push'](_0xc43a0c['shift']());}};_0x57e423(++_0x4266a0);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x142a57,_0x1e7462){_0x142a57=_0x142a57-0x0;var _0x1b718e=_0xd7d1[_0x142a57];return _0x1b718e;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1d7d('0xf'),'collate':_0x1d7d('0x10')});}; \ No newline at end of file +var _0x087b=['utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','define','Notification','notifications'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x087b,0x11a));var _0xb087=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x087b[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb087('0x2'));var BPromise=require('bluebird');var rp=require(_0xb087('0x3'));var fs=require('fs');var path=require(_0xb087('0x4'));var rimraf=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var attributes=require(_0xb087('0x7'));module[_0xb087('0x8')]=function(_0x40156d,_0x17d6e8){return _0x40156d[_0xb087('0x9')](_0xb087('0xa'),attributes,{'tableName':_0xb087('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb087('0xc'),'collate':_0xb087('0xd')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index b89c5dc..b63bf63 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 _0x55ab=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x55ab,0xd6));var _0xb55a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x55ab[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xb55a('0x0'));var moment=require(_0xb55a('0x1'));var BPromise=require(_0xb55a('0x2'));var rs=require(_0xb55a('0x3'));var fs=require('fs');var Redis=require(_0xb55a('0x4'));var db=require(_0xb55a('0x5'))['db'];var utils=require(_0xb55a('0x6'));var logger=require(_0xb55a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb55a('0x8')][_0xb55a('0x9')]({'port':0x232a});config[_0xb55a('0xa')]=_[_0xb55a('0xb')](config[_0xb55a('0xa')],{'host':_0xb55a('0xc'),'port':0x18eb});var socket=require(_0xb55a('0xd'))(new Redis(config[_0xb55a('0xa')]));require(_0xb55a('0xe'))[_0xb55a('0xf')](socket);function respondWithRpcPromise(_0x53649f,_0x3caffd,_0x536bdf){return new BPromise(function(_0x3a7b4f,_0x1f1289){return client[_0xb55a('0x10')](_0x53649f,_0x536bdf)[_0xb55a('0x11')](function(_0x418466){logger[_0xb55a('0x12')](_0xb55a('0x13'),_0x3caffd,_0xb55a('0x14'));logger[_0xb55a('0x15')](_0xb55a('0x16'),_0x3caffd,'request\x20sent',JSON['stringify'](_0x418466));if(_0x418466[_0xb55a('0x17')]){if(_0x418466[_0xb55a('0x17')]['code']===0x1f4){logger[_0xb55a('0x17')](_0xb55a('0x13'),_0x3caffd,_0x418466[_0xb55a('0x17')]['message']);return _0x1f1289(_0x418466['error'][_0xb55a('0x18')]);}logger[_0xb55a('0x17')]('Notification,\x20%s,\x20%s',_0x3caffd,_0x418466[_0xb55a('0x17')]['message']);return _0x3a7b4f(_0x418466['error'][_0xb55a('0x18')]);}else{logger['info'](_0xb55a('0x13'),_0x3caffd,_0xb55a('0x14'));_0x3a7b4f(_0x418466[_0xb55a('0x19')][_0xb55a('0x18')]);}})[_0xb55a('0x1a')](function(_0x44fda6){logger[_0xb55a('0x17')](_0xb55a('0x13'),_0x3caffd,_0x44fda6);_0x1f1289(_0x44fda6);});});} \ No newline at end of file +var _0xb432=['../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis'];(function(_0x5a201f,_0x215377){var _0x51a936=function(_0x36d274){while(--_0x36d274){_0x5a201f['push'](_0x5a201f['shift']());}};_0x51a936(++_0x215377);}(_0xb432,0x1d7));var _0x2b43=function(_0x474418,_0x342efb){_0x474418=_0x474418-0x0;var _0x5307a7=_0xb432[_0x474418];return _0x5307a7;};'use strict';var _=require('lodash');var util=require(_0x2b43('0x0'));var moment=require('moment');var BPromise=require(_0x2b43('0x1'));var rs=require(_0x2b43('0x2'));var fs=require('fs');var Redis=require(_0x2b43('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b43('0x4'));var logger=require('../../config/logger')(_0x2b43('0x5'));var config=require('../../config/environment');var jayson=require(_0x2b43('0x6'));var client=jayson[_0x2b43('0x7')][_0x2b43('0x8')]({'port':0x232a});config[_0x2b43('0x9')]=_['defaults'](config['redis'],{'host':_0x2b43('0xa'),'port':0x18eb});var socket=require(_0x2b43('0xb'))(new Redis(config[_0x2b43('0x9')]));require(_0x2b43('0xc'))[_0x2b43('0xd')](socket);function respondWithRpcPromise(_0x13322c,_0x341c1c,_0x40d5c6){return new BPromise(function(_0x2b4673,_0x301434){return client[_0x2b43('0xe')](_0x13322c,_0x40d5c6)[_0x2b43('0xf')](function(_0x5514ee){logger[_0x2b43('0x10')](_0x2b43('0x11'),_0x341c1c,_0x2b43('0x12'));logger['debug'](_0x2b43('0x13'),_0x341c1c,'request\x20sent',JSON[_0x2b43('0x14')](_0x5514ee));if(_0x5514ee[_0x2b43('0x15')]){if(_0x5514ee[_0x2b43('0x15')][_0x2b43('0x16')]===0x1f4){logger[_0x2b43('0x15')](_0x2b43('0x11'),_0x341c1c,_0x5514ee[_0x2b43('0x15')][_0x2b43('0x17')]);return _0x301434(_0x5514ee[_0x2b43('0x15')][_0x2b43('0x17')]);}logger['error'](_0x2b43('0x11'),_0x341c1c,_0x5514ee['error'][_0x2b43('0x17')]);return _0x2b4673(_0x5514ee[_0x2b43('0x15')]['message']);}else{logger[_0x2b43('0x10')]('Notification,\x20%s,\x20%s',_0x341c1c,_0x2b43('0x12'));_0x2b4673(_0x5514ee[_0x2b43('0x18')][_0x2b43('0x17')]);}})['catch'](function(_0x1a45b0){logger[_0x2b43('0x15')]('Notification,\x20%s,\x20%s',_0x341c1c,_0x1a45b0);_0x301434(_0x1a45b0);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 2a9fa8c..975ce3b 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 _0xe1a2=['removeListener','register','notification:','./notification.events','save','remove','update'];(function(_0x2502dc,_0x1b2a43){var _0x5d6ae6=function(_0x2de1de){while(--_0x2de1de){_0x2502dc['push'](_0x2502dc['shift']());}};_0x5d6ae6(++_0x1b2a43);}(_0xe1a2,0x1df));var _0x2e1a=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0xe1a2[_0x1347f8];return _0x218368;};'use strict';var NotificationEvents=require(_0x2e1a('0x0'));var events=[_0x2e1a('0x1'),_0x2e1a('0x2'),_0x2e1a('0x3')];function createListener(_0x5947f7,_0x2067c2){return function(_0x13b7df){_0x2067c2['emit'](_0x5947f7,_0x13b7df);};}function removeListener(_0x3ffd6e,_0x42f936){return function(){NotificationEvents[_0x2e1a('0x4')](_0x3ffd6e,_0x42f936);};}exports[_0x2e1a('0x5')]=function(_0x1d6f62){for(var _0x1d0d98=0x0,_0x130317=events['length'];_0x1d0d98<_0x130317;_0x1d0d98++){var _0x1d63f7=events[_0x1d0d98];var _0x5aa90c=createListener(_0x2e1a('0x6')+_0x1d63f7,_0x1d6f62);NotificationEvents['on'](_0x1d63f7,_0x5aa90c);}}; \ No newline at end of file +var _0x97c8=['remove','update','emit','removeListener','length','./notification.events','save'];(function(_0x1d895d,_0x3e5c93){var _0x2dae23=function(_0x443cd0){while(--_0x443cd0){_0x1d895d['push'](_0x1d895d['shift']());}};_0x2dae23(++_0x3e5c93);}(_0x97c8,0xd7));var _0x897c=function(_0xb47dc0,_0x407032){_0xb47dc0=_0xb47dc0-0x0;var _0x57f0b0=_0x97c8[_0xb47dc0];return _0x57f0b0;};'use strict';var NotificationEvents=require(_0x897c('0x0'));var events=[_0x897c('0x1'),_0x897c('0x2'),_0x897c('0x3')];function createListener(_0x4b9bfd,_0x24d615){return function(_0x2a5eb5){_0x24d615[_0x897c('0x4')](_0x4b9bfd,_0x2a5eb5);};}function removeListener(_0x5db900,_0x21adfd){return function(){NotificationEvents[_0x897c('0x5')](_0x5db900,_0x21adfd);};}exports['register']=function(_0x45b5a5){for(var _0x4890a4=0x0,_0x14ced=events[_0x897c('0x6')];_0x4890a4<_0x14ced;_0x4890a4++){var _0xc3c2a=events[_0x4890a4];var _0x1fd705=createListener('notification:'+_0xc3c2a,_0x45b5a5);NotificationEvents['on'](_0xc3c2a,_0x1fd705);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 37f380c..ce67dc4 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 _0x144a=['destroy','removeAgents','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/users','post','create','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete'];(function(_0x56a8b8,_0x344ea3){var _0x353df1=function(_0x37ef6a){while(--_0x37ef6a){_0x56a8b8['push'](_0x56a8b8['shift']());}};_0x353df1(++_0x344ea3);}(_0x144a,0xc8));var _0xa144=function(_0x2db606,_0x31542e){_0x2db606=_0x2db606-0x0;var _0x181514=_0x144a[_0x2db606];return _0x181514;};'use strict';var multer=require('multer');var util=require(_0xa144('0x0'));var path=require(_0xa144('0x1'));var timeout=require('connect-timeout');var express=require(_0xa144('0x2'));var router=express[_0xa144('0x3')]();var auth=require(_0xa144('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa144('0x5'));var controller=require(_0xa144('0x6'));router[_0xa144('0x7')]('/',auth[_0xa144('0x8')](),controller[_0xa144('0x9')]);router['get'](_0xa144('0xa'),auth[_0xa144('0x8')](),controller[_0xa144('0xb')]);router['get'](_0xa144('0xc'),auth[_0xa144('0x8')](),controller[_0xa144('0xd')]);router['get'](_0xa144('0xe'),auth[_0xa144('0x8')](),controller[_0xa144('0xf')]);router[_0xa144('0x7')](_0xa144('0x10'),auth[_0xa144('0x8')](),controller['getAnswers']);router[_0xa144('0x7')](_0xa144('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0xa144('0x7')]('/:id/interactions',auth[_0xa144('0x8')](),controller[_0xa144('0x12')]);router[_0xa144('0x7')](_0xa144('0x13'),auth[_0xa144('0x8')](),controller['getAgents']);router[_0xa144('0x14')]('/',auth[_0xa144('0x8')](),controller[_0xa144('0x15')]);router[_0xa144('0x14')](_0xa144('0xe'),auth[_0xa144('0x8')](),controller['addDisposition']);router[_0xa144('0x14')](_0xa144('0x10'),auth[_0xa144('0x8')](),controller['addAnswer']);router[_0xa144('0x14')](_0xa144('0x16'),controller[_0xa144('0x17')]);router['post'](_0xa144('0x11'),auth[_0xa144('0x8')](),controller[_0xa144('0x18')]);router[_0xa144('0x14')](_0xa144('0x13'),auth['isAuthenticated'](),controller[_0xa144('0x19')]);router['post'](_0xa144('0x1a'),auth[_0xa144('0x8')](),controller[_0xa144('0x1b')]);router[_0xa144('0x1c')](_0xa144('0xc'),auth['isAuthenticated'](),controller[_0xa144('0x1d')]);router[_0xa144('0x1e')](_0xa144('0xc'),auth['isAuthenticated'](),controller[_0xa144('0x1f')]);router[_0xa144('0x1e')]('/:id/dispositions',auth[_0xa144('0x8')](),controller['removeDispositions']);router[_0xa144('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0xa144('0x1e')](_0xa144('0x13'),auth['isAuthenticated'](),controller[_0xa144('0x20')]);module['exports']=router; \ No newline at end of file +var _0xfad5=['get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','/:id/interactions','/:id/users','post','create','/:id/canned_answers','notify','addApplications','addAgents','/:id/send','send','/:id','update','delete','removeDispositions','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0xd38ba1,_0x302247){var _0x1dd2a9=function(_0x41ad2e){while(--_0x41ad2e){_0xd38ba1['push'](_0xd38ba1['shift']());}};_0x1dd2a9(++_0x302247);}(_0xfad5,0x162));var _0x5fad=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xfad5[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x5fad('0x0'));var util=require('util');var path=require(_0x5fad('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5fad('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5fad('0x3'));var config=require(_0x5fad('0x4'));var controller=require(_0x5fad('0x5'));router[_0x5fad('0x6')]('/',auth[_0x5fad('0x7')](),controller['index']);router['get'](_0x5fad('0x8'),auth[_0x5fad('0x7')](),controller[_0x5fad('0x9')]);router[_0x5fad('0x6')]('/:id',auth[_0x5fad('0x7')](),controller[_0x5fad('0xa')]);router[_0x5fad('0x6')](_0x5fad('0xb'),auth[_0x5fad('0x7')](),controller[_0x5fad('0xc')]);router[_0x5fad('0x6')]('/:id/canned_answers',auth[_0x5fad('0x7')](),controller[_0x5fad('0xd')]);router['get'](_0x5fad('0xe'),auth[_0x5fad('0x7')](),controller['getApplications']);router[_0x5fad('0x6')](_0x5fad('0xf'),auth[_0x5fad('0x7')](),controller['getInteractions']);router['get'](_0x5fad('0x10'),auth[_0x5fad('0x7')](),controller['getAgents']);router[_0x5fad('0x11')]('/',auth[_0x5fad('0x7')](),controller[_0x5fad('0x12')]);router[_0x5fad('0x11')](_0x5fad('0xb'),auth[_0x5fad('0x7')](),controller['addDisposition']);router[_0x5fad('0x11')](_0x5fad('0x13'),auth[_0x5fad('0x7')](),controller['addAnswer']);router[_0x5fad('0x11')]('/:id/notify',controller[_0x5fad('0x14')]);router[_0x5fad('0x11')](_0x5fad('0xe'),auth[_0x5fad('0x7')](),controller[_0x5fad('0x15')]);router['post'](_0x5fad('0x10'),auth[_0x5fad('0x7')](),controller[_0x5fad('0x16')]);router[_0x5fad('0x11')](_0x5fad('0x17'),auth['isAuthenticated'](),controller[_0x5fad('0x18')]);router['put'](_0x5fad('0x19'),auth[_0x5fad('0x7')](),controller[_0x5fad('0x1a')]);router[_0x5fad('0x1b')](_0x5fad('0x19'),auth[_0x5fad('0x7')](),controller['destroy']);router['delete'](_0x5fad('0xb'),auth['isAuthenticated'](),controller[_0x5fad('0x1c')]);router[_0x5fad('0x1b')]('/:id/canned_answers',auth[_0x5fad('0x7')](),controller['removeAnswers']);router[_0x5fad('0x1b')](_0x5fad('0x10'),auth[_0x5fad('0x7')](),controller['removeAgents']);module[_0x5fad('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 6a78649..6e44283 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 _0x0ffc=['STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports'];(function(_0x3b334f,_0x5d0405){var _0x5013a8=function(_0x3862c2){while(--_0x3862c2){_0x3b334f['push'](_0x3b334f['shift']());}};_0x5013a8(++_0x5d0405);}(_0x0ffc,0x1ec));var _0xc0ff=function(_0x398417,_0x1f1218){_0x398417=_0x398417-0x0;var _0x1a20b4=_0x0ffc[_0x398417];return _0x1a20b4;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xc0ff('0x0'));module[_0xc0ff('0x1')]={'name':{'type':Sequelize[_0xc0ff('0x2')],'unique':_0xc0ff('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xc0ff('0x2')],'defaultValue':function(){return rs[_0xc0ff('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xc0ff('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc0ff('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc0ff('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc0ff('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xc0ff('0x2')]},'queueTransfer':{'type':Sequelize[_0xc0ff('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc0ff('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc0ff('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc0ff('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc0ff('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xc0ff('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc0ff('0x9'),'set':function(_0x552094){if(!_0x552094)this[_0xc0ff('0xa')](_0xc0ff('0xb'),null);this[_0xc0ff('0xa')](_0xc0ff('0xc'),_0x552094);}}}; \ No newline at end of file +var _0x1763=['STRING','name','generate','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1763,0x151));var _0x3176=function(_0x4d1120,_0x57f789){_0x4d1120=_0x4d1120-0x0;var _0x350c20=_0x1763[_0x4d1120];return _0x350c20;};'use strict';var Sequelize=require(_0x3176('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x3176('0x1')],'unique':_0x3176('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x3176('0x1')]},'token':{'type':Sequelize[_0x3176('0x1')],'defaultValue':function(){return rs[_0x3176('0x3')]();}},'replyUri':{'type':Sequelize[_0x3176('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3176('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3176('0x4')],'defaultValue':function(){return _0x3176('0x5');}},'notificationSound':{'type':Sequelize[_0x3176('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3176('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3176('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3176('0x1')]},'queueTransfer':{'type':Sequelize[_0x3176('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3176('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3176('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3176('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x3176('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x3176('0x6')],'defaultValue':![],'comment':_0x3176('0x9'),'set':function(_0x189859){if(!_0x189859)this[_0x3176('0xa')](_0x3176('0xb'),null);this['setDataValue'](_0x3176('0xc'),_0x189859);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index de13c87..4f26472 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 _0x29dd=['find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpnechannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','List','Contacts','updatedAt','DESC','OpenchannelApplication','account','Applications','list','applications','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','ids','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','CmList','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','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~!@#$%^&-_=+[{]}.','then','info','request\x20sent','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','OpenchannelAccount','includeAll','include','findAll','rows','params'];(function(_0x2f317b,_0x16f717){var _0x111d29=function(_0x41dc4b){while(--_0x41dc4b){_0x2f317b['push'](_0x2f317b['shift']());}};_0x111d29(++_0x16f717);}(_0x29dd,0x121));var _0xd29d=function(_0x187bdb,_0x113caa){_0x187bdb=_0x187bdb-0x0;var _0x189f69=_0x29dd[_0x187bdb];return _0x189f69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd29d('0x0'));var rimraf=require(_0xd29d('0x1'));var zipdir=require(_0xd29d('0x2'));var jsonpatch=require(_0xd29d('0x3'));var rp=require(_0xd29d('0x4'));var moment=require(_0xd29d('0x5'));var BPromise=require(_0xd29d('0x6'));var Mustache=require('mustache');var util=require(_0xd29d('0x7'));var path=require(_0xd29d('0x8'));var sox=require(_0xd29d('0x9'));var csv=require('to-csv');var ejs=require(_0xd29d('0xa'));var fs=require('fs');var _=require(_0xd29d('0xb'));var squel=require(_0xd29d('0xc'));var crypto=require(_0xd29d('0xd'));var jsforce=require(_0xd29d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd29d('0xf'));var authService=require(_0xd29d('0x10'));var qs=require(_0xd29d('0x11'));var as=require(_0xd29d('0x12'));var hardwareService=require(_0xd29d('0x13'));var logger=require(_0xd29d('0x14'))('api');var utils=require(_0xd29d('0x15'));var config=require(_0xd29d('0x16'));var db=require(_0xd29d('0x17'))['db'];config['redis']=_[_0xd29d('0x18')](config[_0xd29d('0x19')],{'host':_0xd29d('0x1a'),'port':0x18eb});var socket=require(_0xd29d('0x1b'))(new Redis(config[_0xd29d('0x19')]));require('./openchannelAccount.socket')[_0xd29d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd29d('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xd29d('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x1cee8a,_0x32e7e7,_0xfe17f3){if(_0xfe17f3){var _0x5dfae8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5dfae8[_0xd29d('0x1e')](_0x32e7e7)){return _0x1cee8a;}else{throw new db[(_0xd29d('0x1f'))][(_0xd29d('0x20'))](_0xd29d('0x21'));}}else{return _0x1cee8a;}}function respondWithRpcPromise(_0x2f9718,_0x301d76,_0x243ab5,_0x58dc5f){return new BPromise(function(_0x515e0d,_0x4077ac){var _0x5b72ed=_0x58dc5f||client;return _0x5b72ed['request'](_0x2f9718,_0x243ab5)[_0xd29d('0x22')](function(_0x414723){logger[_0xd29d('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x301d76,_0xd29d('0x24'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x301d76,'request\x20sent',JSON[_0xd29d('0x25')](_0x414723));if(_0x414723[_0xd29d('0x26')]){if(_0x414723[_0xd29d('0x26')][_0xd29d('0x27')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x301d76,_0x414723['error'][_0xd29d('0x28')]);return _0x4077ac(_0x414723[_0xd29d('0x26')]['message']);}logger[_0xd29d('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x301d76,_0x414723[_0xd29d('0x26')][_0xd29d('0x28')]);return _0x515e0d(_0x414723['error'][_0xd29d('0x28')]);}else{logger['info'](_0xd29d('0x29'),_0x301d76,_0xd29d('0x24'));_0x515e0d(_0x414723[_0xd29d('0x2a')][_0xd29d('0x28')]);}})[_0xd29d('0x2b')](function(_0x6c905d){logger[_0xd29d('0x26')](_0xd29d('0x29'),_0x301d76,_0x6c905d);_0x4077ac(_0x6c905d);});});}function respondWithStatusCode(_0x13234a,_0x26f2f4){_0x26f2f4=_0x26f2f4||0xcc;return function(_0x1fe7c6){if(_0x1fe7c6){return _0x13234a['sendStatus'](_0x26f2f4);}return _0x13234a[_0xd29d('0x2c')](_0x26f2f4)[_0xd29d('0x2d')]();};}function respondWithResult(_0x169011,_0x585ac4){_0x585ac4=_0x585ac4||0xc8;return function(_0x1f82fd){if(_0x1f82fd){return _0x169011[_0xd29d('0x2c')](_0x585ac4)['json'](_0x1f82fd);}};}function respondWithFilteredResult(_0x3af65e,_0x41f494){return function(_0xb4fbd){if(_0xb4fbd){var _0x2a7edb=_0xb4fbd[_0xd29d('0x2e')],_0x61e4a8=_0x41f494['offset'],_0x144107=_0x41f494[_0xd29d('0x2f')]+_0x41f494[_0xd29d('0x30')],_0x1d5d91;if(_0x144107>=_0x2a7edb){_0x144107=_0x2a7edb;_0x1d5d91=0xc8;}else{_0x1d5d91=0xce;}_0x3af65e[_0xd29d('0x2c')](_0x1d5d91);return _0x3af65e[_0xd29d('0x31')](_0xd29d('0x32'),_0x61e4a8+'-'+_0x144107+'/'+_0x2a7edb)[_0xd29d('0x33')](_0xb4fbd);}return null;};}function patchUpdates(_0x3f6518){return function(_0x14a4b7){try{jsonpatch[_0xd29d('0x34')](_0x14a4b7,_0x3f6518,!![]);}catch(_0x188fb4){return BPromise[_0xd29d('0x35')](_0x188fb4);}return _0x14a4b7[_0xd29d('0x36')]();};}function saveUpdates(_0x6cac00,_0x576650){return function(_0x37dad7){if(_0x37dad7){return _0x37dad7[_0xd29d('0x37')](_0x6cac00)[_0xd29d('0x22')](function(_0x2cc115){return _0x2cc115;});}return null;};}function removeEntity(_0x45fb33,_0xcc6d2a){return function(_0x356331){if(_0x356331){return _0x356331[_0xd29d('0x38')]()['then'](function(){var _0x2c25e8=_0x356331[_0xd29d('0x39')]({'plain':!![]});var _0x235b93=_0xd29d('0x3a');return db[_0xd29d('0x3b')][_0xd29d('0x38')]({'where':{'type':_0x235b93,'resourceId':_0x2c25e8['id']}})['then'](function(){return _0x356331;});})[_0xd29d('0x22')](function(){_0x45fb33[_0xd29d('0x2c')](0xcc)[_0xd29d('0x2d')]();});}};}function handleEntityNotFound(_0x5e372d,_0x37c4f9){return function(_0x243bcb){if(!_0x243bcb){_0x5e372d[_0xd29d('0x3c')](0x194);}return _0x243bcb;};}function handleError(_0x3a6419,_0x31fb35){_0x31fb35=_0x31fb35||0x1f4;return function(_0x2cf3ad){logger[_0xd29d('0x26')](_0x2cf3ad[_0xd29d('0x3d')]);if(_0x2cf3ad[_0xd29d('0x3e')]){delete _0x2cf3ad['name'];}_0x3a6419['status'](_0x31fb35)[_0xd29d('0x3f')](_0x2cf3ad);};}exports['index']=function(_0x5bf20c,_0x14f055){var _0x592682={'include':[{'model':db[_0xd29d('0x40')],'as':_0xd29d('0x41')}]},_0x41036a={},_0x533d6d={'count':0x0,'rows':[]};var _0x40840e=_[_0xd29d('0x42')](db['OpenchannelAccount'][_0xd29d('0x43')],function(_0x34d706){return{'name':_0x34d706[_0xd29d('0x44')],'type':_0x34d706[_0xd29d('0x45')][_0xd29d('0x46')]};});_0x41036a[_0xd29d('0x47')]=_[_0xd29d('0x42')](_0x40840e,_0xd29d('0x3e'));_0x41036a[_0xd29d('0x48')]=_[_0xd29d('0x49')](_0x5bf20c[_0xd29d('0x48')]);_0x41036a['filters']=_['intersection'](_0x41036a[_0xd29d('0x47')],_0x41036a[_0xd29d('0x48')]);_0x592682['attributes']=_[_0xd29d('0x4a')](_0x41036a[_0xd29d('0x47')],qs[_0xd29d('0x4b')](_0x5bf20c['query'][_0xd29d('0x4b')]));_0x592682[_0xd29d('0x4c')]=_0x592682[_0xd29d('0x4c')][_0xd29d('0x4d')]?_0x592682[_0xd29d('0x4c')]:_0x41036a[_0xd29d('0x47')];if(!_0x5bf20c[_0xd29d('0x48')]['hasOwnProperty'](_0xd29d('0x4e'))){_0x592682[_0xd29d('0x30')]=qs[_0xd29d('0x30')](_0x5bf20c[_0xd29d('0x48')][_0xd29d('0x30')]);_0x592682['offset']=qs[_0xd29d('0x2f')](_0x5bf20c['query'][_0xd29d('0x2f')]);}_0x592682['order']=qs[_0xd29d('0x4f')](_0x5bf20c[_0xd29d('0x48')][_0xd29d('0x4f')]);_0x592682[_0xd29d('0x50')]=qs['filters'](_[_0xd29d('0x51')](_0x5bf20c[_0xd29d('0x48')],_0x41036a[_0xd29d('0x52')]),_0x40840e);if(_0x5bf20c['query'][_0xd29d('0x53')]){_0x592682[_0xd29d('0x50')]=_[_0xd29d('0x54')](_0x592682['where'],{'$or':_[_0xd29d('0x42')](_0x40840e,function(_0x16da5f){if(_0x16da5f[_0xd29d('0x45')]!==_0xd29d('0x55')){var _0x388ba8={};_0x388ba8[_0x16da5f['name']]={'$like':'%'+_0x5bf20c[_0xd29d('0x48')][_0xd29d('0x53')]+'%'};return _0x388ba8;}})});}_0x592682=_[_0xd29d('0x54')]({},_0x592682,_0x5bf20c[_0xd29d('0x56')]);var _0x410f70={'where':_0x592682['where']};return db[_0xd29d('0x57')][_0xd29d('0x2e')](_0x410f70)[_0xd29d('0x22')](function(_0x29bc91){_0x533d6d[_0xd29d('0x2e')]=_0x29bc91;if(_0x5bf20c['query'][_0xd29d('0x58')]){_0x592682[_0xd29d('0x59')]=[{'all':!![]}];}return db[_0xd29d('0x57')][_0xd29d('0x5a')](_0x592682);})[_0xd29d('0x22')](function(_0x3bbcc5){_0x533d6d[_0xd29d('0x5b')]=_0x3bbcc5;return _0x533d6d;})['then'](respondWithFilteredResult(_0x14f055,_0x592682))[_0xd29d('0x2b')](handleError(_0x14f055,null));};exports['show']=function(_0x199dd5,_0xb031ed){var _0x3cc412={'raw':![],'where':{'id':_0x199dd5[_0xd29d('0x5c')]['id']},'include':[{'model':db[_0xd29d('0x40')],'as':_0xd29d('0x41')}]},_0x521157={};_0x521157[_0xd29d('0x47')]=_[_0xd29d('0x49')](db['OpenchannelAccount'][_0xd29d('0x43')]);_0x521157[_0xd29d('0x48')]=_[_0xd29d('0x49')](_0x199dd5['query']);_0x521157[_0xd29d('0x52')]=_[_0xd29d('0x4a')](_0x521157['model'],_0x521157[_0xd29d('0x48')]);_0x3cc412['attributes']=_[_0xd29d('0x4a')](_0x521157[_0xd29d('0x47')],qs['fields'](_0x199dd5[_0xd29d('0x48')][_0xd29d('0x4b')]));_0x3cc412['attributes']=_0x3cc412[_0xd29d('0x4c')]['length']?_0x3cc412[_0xd29d('0x4c')]:_0x521157['model'];if(_0x199dd5[_0xd29d('0x48')][_0xd29d('0x58')]){_0x3cc412[_0xd29d('0x59')]=[{'all':!![]}];}_0x3cc412=_[_0xd29d('0x54')]({},_0x3cc412,_0x199dd5['options']);return db[_0xd29d('0x57')][_0xd29d('0x5d')](_0x3cc412)[_0xd29d('0x22')](handleEntityNotFound(_0xb031ed,null))['then'](respondWithResult(_0xb031ed,null))['catch'](handleError(_0xb031ed,null));};exports[_0xd29d('0x5e')]=function(_0x54023e,_0x62f113){return db[_0xd29d('0x57')][_0xd29d('0x5e')](_0x54023e[_0xd29d('0x5f')],{})[_0xd29d('0x22')](function(_0x40be58){var _0x3b2258=_0x54023e['user'][_0xd29d('0x39')]({'plain':!![]});if(!_0x3b2258)throw new Error(_0xd29d('0x60'));if(_0x3b2258[_0xd29d('0x61')]===_0xd29d('0x62')){var _0x3f1b27=_0x40be58[_0xd29d('0x39')]({'plain':!![]});var _0x3cd994=_0xd29d('0x3a');return db[_0xd29d('0x63')][_0xd29d('0x5d')]({'where':{'name':_0x3cd994,'userProfileId':_0x3b2258['userProfileId']},'raw':!![]})[_0xd29d('0x22')](function(_0x3c8587){if(_0x3c8587&&_0x3c8587[_0xd29d('0x64')]===0x0){return db[_0xd29d('0x3b')][_0xd29d('0x5e')]({'name':_0x3f1b27['name'],'resourceId':_0x3f1b27['id'],'type':_0x3c8587[_0xd29d('0x3e')],'sectionId':_0x3c8587['id']},{})[_0xd29d('0x22')](function(){return _0x40be58;});}else{return _0x40be58;}})['catch'](function(_0x488af6){logger[_0xd29d('0x26')](_0xd29d('0x65'),_0x488af6);throw _0x488af6;});}return _0x40be58;})['then'](respondWithResult(_0x62f113,0xc9))['catch'](handleError(_0x62f113,null));};exports[_0xd29d('0x37')]=function(_0x1aabd8,_0x261634){if(_0x1aabd8[_0xd29d('0x5f')]['id']){delete _0x1aabd8['body']['id'];}return db['OpenchannelAccount'][_0xd29d('0x5d')]({'where':{'id':_0x1aabd8[_0xd29d('0x5c')]['id']},'include':[{'model':db[_0xd29d('0x40')],'as':'mandatoryDispositionPause'}]})[_0xd29d('0x22')](handleEntityNotFound(_0x261634,null))[_0xd29d('0x22')](saveUpdates(_0x1aabd8['body'],null))['then'](respondWithResult(_0x261634,null))[_0xd29d('0x2b')](handleError(_0x261634,null));};exports['destroy']=function(_0x125728,_0x57b7e0){return db[_0xd29d('0x57')][_0xd29d('0x5d')]({'where':{'id':_0x125728[_0xd29d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x57b7e0,null))[_0xd29d('0x22')](removeEntity(_0x57b7e0,null))[_0xd29d('0x2b')](handleError(_0x57b7e0,null));};exports[_0xd29d('0x66')]=function(_0x52cf03,_0x9597c7){return db[_0xd29d('0x57')][_0xd29d('0x66')]()[_0xd29d('0x22')](respondWithResult(_0x9597c7,null))[_0xd29d('0x2b')](handleError(_0x9597c7,null));};exports['addDisposition']=function(_0x3b0dcc,_0x3f2254,_0x25f032){if(_0x3b0dcc[_0xd29d('0x5f')]['id']){delete _0x3b0dcc[_0xd29d('0x5f')]['id'];}return db['OpenchannelAccount'][_0xd29d('0x5d')]({'where':{'id':_0x3b0dcc[_0xd29d('0x5c')]['id']}})[_0xd29d('0x22')](handleEntityNotFound(_0x3f2254,null))[_0xd29d('0x22')](function(_0x3ea8da){if(_0x3ea8da){_0x3b0dcc[_0xd29d('0x5f')][_0xd29d('0x67')]=_0x3ea8da['id'];return db[_0xd29d('0x68')][_0xd29d('0x5e')](_0x3b0dcc[_0xd29d('0x5f')]);}})[_0xd29d('0x22')](respondWithResult(_0x3f2254,null))[_0xd29d('0x2b')](handleError(_0x3f2254,null));};exports[_0xd29d('0x69')]=function(_0x53cbc6,_0xa8d474,_0x39d5be){var _0x365201={'raw':![],'where':{}};var _0x4b7dc2={};var _0x576387={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xd29d('0x6a')]({'where':{'id':_0x53cbc6['params']['id']}})['then'](handleEntityNotFound(_0xa8d474,null))[_0xd29d('0x22')](function(_0x476f99){if(_0x476f99){_0x4b7dc2['model']=_[_0xd29d('0x49')](db[_0xd29d('0x68')]['rawAttributes']);_0x4b7dc2[_0xd29d('0x48')]=_[_0xd29d('0x49')](_0x53cbc6[_0xd29d('0x48')]);_0x4b7dc2[_0xd29d('0x52')]=_[_0xd29d('0x4a')](_0x4b7dc2[_0xd29d('0x47')],_0x4b7dc2['query']);_0x365201[_0xd29d('0x4c')]=_['intersection'](_0x4b7dc2[_0xd29d('0x47')],qs['fields'](_0x53cbc6[_0xd29d('0x48')][_0xd29d('0x4b')]));_0x365201['attributes']=_0x365201[_0xd29d('0x4c')][_0xd29d('0x4d')]?_0x365201[_0xd29d('0x4c')]:_0x4b7dc2[_0xd29d('0x47')];if(!_0x53cbc6['query'][_0xd29d('0x6b')]('nolimit')){_0x365201[_0xd29d('0x30')]=qs[_0xd29d('0x30')](_0x53cbc6['query']['limit']);_0x365201['offset']=qs['offset'](_0x53cbc6[_0xd29d('0x48')]['offset']);}_0x365201[_0xd29d('0x6c')]=qs[_0xd29d('0x4f')](_0x53cbc6[_0xd29d('0x48')][_0xd29d('0x4f')]);_0x365201[_0xd29d('0x50')]=qs[_0xd29d('0x52')](_[_0xd29d('0x51')](_0x53cbc6[_0xd29d('0x48')],_0x4b7dc2[_0xd29d('0x52')]));_0x365201['where'][_0xd29d('0x6d')]=_0x476f99['id'];if(_0x53cbc6['query'][_0xd29d('0x53')]){_0x365201[_0xd29d('0x50')]=_[_0xd29d('0x54')](_0x365201[_0xd29d('0x50')],{'$or':_[_0xd29d('0x42')](_0x365201['attributes'],function(_0x1ff87d){var _0xac4aa={};_0xac4aa[_0x1ff87d]={'$like':'%'+_0x53cbc6['query'][_0xd29d('0x53')]+'%'};return _0xac4aa;})});}_0x365201=_['merge']({},_0x365201,_0x53cbc6['options']);return db['Disposition'][_0xd29d('0x2e')]({'where':_0x365201['where']})['then'](function(_0x265494){_0x576387[_0xd29d('0x2e')]=_0x265494;if(_0x53cbc6[_0xd29d('0x48')][_0xd29d('0x58')]){_0x365201['include']=[{'all':!![]}];}return db[_0xd29d('0x68')]['findAll'](_0x365201);})[_0xd29d('0x22')](function(_0x302e54){_0x576387['rows']=_0x302e54;return _0x576387;});}})[_0xd29d('0x22')](respondWithFilteredResult(_0xa8d474,_0x365201))[_0xd29d('0x2b')](handleError(_0xa8d474,null));};exports['removeDispositions']=function(_0x761c6,_0x25315a,_0x1dd082){return db[_0xd29d('0x57')]['find']({'where':{'id':_0x761c6['params']['id']}})['then'](handleEntityNotFound(_0x25315a,null))[_0xd29d('0x22')](function(_0xfa8102){if(_0xfa8102){return _0xfa8102[_0xd29d('0x6e')](_0x761c6[_0xd29d('0x48')]['ids']);}})[_0xd29d('0x22')](respondWithStatusCode(_0x25315a,null))[_0xd29d('0x2b')](handleError(_0x25315a,null));};exports[_0xd29d('0x6f')]=function(_0x2e954d,_0x3d5ffe,_0x1052a4){if(_0x2e954d['body']['id']){delete _0x2e954d[_0xd29d('0x5f')]['id'];}return db[_0xd29d('0x57')][_0xd29d('0x5d')]({'where':{'id':_0x2e954d[_0xd29d('0x5c')]['id']}})[_0xd29d('0x22')](handleEntityNotFound(_0x3d5ffe,null))[_0xd29d('0x22')](function(_0x25c5bd){if(_0x25c5bd){_0x2e954d[_0xd29d('0x5f')][_0xd29d('0x6d')]=_0x25c5bd['id'];return db[_0xd29d('0x70')][_0xd29d('0x5e')](_0x2e954d[_0xd29d('0x5f')]);}})[_0xd29d('0x22')](respondWithResult(_0x3d5ffe,null))[_0xd29d('0x2b')](handleError(_0x3d5ffe,null));};exports['getAnswers']=function(_0x51ff6d,_0x1a16c1,_0x14cfad){var _0x30a8d4={'raw':![],'where':{}};var _0x2aab08={};var _0x26145f={'count':0x0,'rows':[]};return db[_0xd29d('0x57')][_0xd29d('0x6a')]({'where':{'id':_0x51ff6d[_0xd29d('0x5c')]['id']}})[_0xd29d('0x22')](handleEntityNotFound(_0x1a16c1,null))['then'](function(_0x33f75f){if(_0x33f75f){_0x2aab08['model']=_[_0xd29d('0x49')](db[_0xd29d('0x70')]['rawAttributes']);_0x2aab08[_0xd29d('0x48')]=_[_0xd29d('0x49')](_0x51ff6d[_0xd29d('0x48')]);_0x2aab08[_0xd29d('0x52')]=_[_0xd29d('0x4a')](_0x2aab08['model'],_0x2aab08[_0xd29d('0x48')]);_0x30a8d4['attributes']=_[_0xd29d('0x4a')](_0x2aab08[_0xd29d('0x47')],qs['fields'](_0x51ff6d[_0xd29d('0x48')][_0xd29d('0x4b')]));_0x30a8d4['attributes']=_0x30a8d4['attributes'][_0xd29d('0x4d')]?_0x30a8d4['attributes']:_0x2aab08[_0xd29d('0x47')];if(!_0x51ff6d[_0xd29d('0x48')][_0xd29d('0x6b')](_0xd29d('0x4e'))){_0x30a8d4[_0xd29d('0x30')]=qs[_0xd29d('0x30')](_0x51ff6d['query'][_0xd29d('0x30')]);_0x30a8d4[_0xd29d('0x2f')]=qs[_0xd29d('0x2f')](_0x51ff6d[_0xd29d('0x48')][_0xd29d('0x2f')]);}_0x30a8d4[_0xd29d('0x6c')]=qs[_0xd29d('0x4f')](_0x51ff6d['query'][_0xd29d('0x4f')]);_0x30a8d4[_0xd29d('0x50')]=qs[_0xd29d('0x52')](_['pick'](_0x51ff6d[_0xd29d('0x48')],_0x2aab08['filters']));_0x30a8d4[_0xd29d('0x50')][_0xd29d('0x6d')]=_0x33f75f['id'];if(_0x51ff6d['query'][_0xd29d('0x53')]){_0x30a8d4[_0xd29d('0x50')]=_[_0xd29d('0x54')](_0x30a8d4[_0xd29d('0x50')],{'$or':_[_0xd29d('0x42')](_0x30a8d4['attributes'],function(_0xc9f132){var _0x5aa66b={};_0x5aa66b[_0xc9f132]={'$like':'%'+_0x51ff6d[_0xd29d('0x48')][_0xd29d('0x53')]+'%'};return _0x5aa66b;})});}_0x30a8d4=_[_0xd29d('0x54')]({},_0x30a8d4,_0x51ff6d[_0xd29d('0x56')]);return db[_0xd29d('0x70')][_0xd29d('0x2e')]({'where':_0x30a8d4[_0xd29d('0x50')]})[_0xd29d('0x22')](function(_0x269754){_0x26145f[_0xd29d('0x2e')]=_0x269754;if(_0x51ff6d[_0xd29d('0x48')][_0xd29d('0x58')]){_0x30a8d4[_0xd29d('0x59')]=[{'all':!![]}];}return db[_0xd29d('0x70')][_0xd29d('0x5a')](_0x30a8d4);})[_0xd29d('0x22')](function(_0x28508b){_0x26145f['rows']=_0x28508b;return _0x26145f;});}})[_0xd29d('0x22')](respondWithFilteredResult(_0x1a16c1,_0x30a8d4))[_0xd29d('0x2b')](handleError(_0x1a16c1,null));};exports['removeAnswers']=function(_0x21d023,_0x5e2461,_0x28ce87){return db[_0xd29d('0x57')]['find']({'where':{'id':_0x21d023['params']['id']}})['then'](handleEntityNotFound(_0x5e2461,null))[_0xd29d('0x22')](function(_0x25eac9){if(_0x25eac9){return _0x25eac9[_0xd29d('0x71')](_0x21d023[_0xd29d('0x48')]['ids']);}})[_0xd29d('0x22')](respondWithStatusCode(_0x5e2461,null))[_0xd29d('0x2b')](handleError(_0x5e2461,null));};exports[_0xd29d('0x72')]=function(_0x307de9,_0x385272,_0x27b545){var _0x1245c3={'body':_0x307de9[_0xd29d('0x5f')],'channel':_0xd29d('0x73')};var _0x4ca546=[];var _0x288a17=[];var _0x144eb2={};var _0x1a0aa9=![];return db[_0xd29d('0x74')][_0xd29d('0x66')]()[_0xd29d('0x22')](function(_0x48040e){if(!_0x48040e){throw new db[(_0xd29d('0x1f'))][(_0xd29d('0x20'))](_0xd29d('0x75'));}_0x4ca546=_[_0xd29d('0x76')](_[_0xd29d('0x49')](_0x48040e),['createdAt','updatedAt']);_0x288a17=_[_0xd29d('0x76')](_[_0xd29d('0x49')](_0x48040e),[_0xd29d('0x77'),'updatedAt',_0xd29d('0x78'),_0xd29d('0x79')]);if(_0x307de9[_0xd29d('0x5f')]['id']){delete _0x307de9['body']['id'];}if(_[_0xd29d('0x7a')](_0x307de9[_0xd29d('0x5f')]['from'])){throw new db['Sequelize'][(_0xd29d('0x20'))](_0xd29d('0x7b'));}if(_[_0xd29d('0x7a')](_0x307de9[_0xd29d('0x5f')][_0xd29d('0x5f')])||_0x307de9[_0xd29d('0x5f')][_0xd29d('0x5f')]===''){throw new db[(_0xd29d('0x1f'))][(_0xd29d('0x20'))](_0xd29d('0x7c'));}if(_['isNil'](_0x307de9[_0xd29d('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0xd29d('0x20'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x288a17);}if(!_[_0xd29d('0x7d')](_0x288a17,_0x307de9[_0xd29d('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0xd29d('0x20'))](_0xd29d('0x7e')+_0x288a17);}_0x144eb2[_0x307de9[_0xd29d('0x5f')][_0xd29d('0x7f')]]=_0x307de9['body'][_0xd29d('0x80')];})[_0xd29d('0x22')](function(){return db[_0xd29d('0x57')]['find']({'where':{'id':_0x307de9[_0xd29d('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0xd29d('0x81'),'include':[{'model':db[_0xd29d('0x74')],'as':_0xd29d('0x82'),'where':_0x144eb2,'limit':0x1,'order':[[_0xd29d('0x83'),_0xd29d('0x84')]]}]},{'model':db[_0xd29d('0x85')],'as':'Applications'}]});})[_0xd29d('0x22')](handleEntityNotFound(_0x385272,null))[_0xd29d('0x22')](function(_0x3efbac){if(_0x3efbac&&_0x3efbac[_0xd29d('0x81')]){_0x1245c3[_0xd29d('0x86')]=_0x3efbac;_0x1245c3['applications']=_0x3efbac[_0xd29d('0x87')];_0x1245c3[_0xd29d('0x88')]=_0x3efbac[_0xd29d('0x81')];_0x1245c3[_0xd29d('0x89')]=_['orderBy'](_0x1245c3['applications'],[_0xd29d('0x8a')],[_0xd29d('0x8b')]);if(_0x1245c3[_0xd29d('0x86')][_0xd29d('0x87')]){delete _0x1245c3[_0xd29d('0x86')][_0xd29d('0x87')];}if(_0x1245c3[_0xd29d('0x86')][_0xd29d('0x81')]&&_0x1245c3['account'][_0xd29d('0x81')][_0xd29d('0x82')][_0xd29d('0x4d')]){return _0x1245c3[_0xd29d('0x86')][_0xd29d('0x81')]['Contacts'][0x0];}var _0x72a181=_['defaults'](_0x307de9[_0xd29d('0x5f')],{'firstName':_0x307de9['body'][_0xd29d('0x80')],'ListId':_0x3efbac['ListId']});_0x72a181[_0x307de9[_0xd29d('0x5f')][_0xd29d('0x7f')]]=_0x307de9[_0xd29d('0x5f')][_0xd29d('0x80')];return db[_0xd29d('0x74')][_0xd29d('0x5e')](_0x72a181,{'fields':_0x4ca546,'raw':!![]});}})[_0xd29d('0x22')](handleEntityNotFound(_0x385272,null))[_0xd29d('0x22')](function(_0x1a17ff){_0x1245c3[_0xd29d('0x8c')]=_0x1a17ff;if(_0x1a17ff){var _0x8f7379={'ContactId':_0x1a17ff['id'],'OpenchannelAccountId':_0x307de9[_0xd29d('0x5c')]['id'],'from':(_0x1a17ff[_0xd29d('0x8d')]||'')+'\x20'+(_0x1a17ff[_0xd29d('0x8e')]||'')};var _0x4086b9={'OpenchannelAccountId':_0x307de9[_0xd29d('0x5c')]['id'],'closed':![]};if(_0x307de9['body'][_0xd29d('0x8f')]){_0x4086b9['threadId']=_0x307de9[_0xd29d('0x5f')][_0xd29d('0x8f')];return db[_0xd29d('0x90')][_0xd29d('0x5d')]({'where':_0x4086b9})[_0xd29d('0x22')](function(_0x5beac5){if(_0x5beac5){return[_0x5beac5,![]];}_0x8f7379[_0xd29d('0x8f')]=_0x307de9[_0xd29d('0x5f')][_0xd29d('0x8f')];_0x8f7379['externalUrl']=_0x307de9[_0xd29d('0x5f')][_0xd29d('0x91')];return db['OpenchannelInteraction']['create'](_0x8f7379)[_0xd29d('0x22')](function(_0x41a326){return[_0x41a326,!![]];});});}else{_0x4086b9[_0xd29d('0x8f')]=null;}_0x4086b9[_0xd29d('0x92')]=_0x1a17ff['id'];return db[_0xd29d('0x90')][_0xd29d('0x5d')]({'where':_0x4086b9})[_0xd29d('0x22')](function(_0x1780f2){if(_0x1780f2){return[_0x1780f2,![]];}return db[_0xd29d('0x90')]['create'](_0x8f7379)[_0xd29d('0x22')](function(_0x44d13d){return[_0x44d13d,!![]];});});}})['spread'](function(_0x1c1ac5,_0x3448fe){if(_0x1c1ac5){_0x1a0aa9=_0x3448fe;if(!_0x3448fe){var _0x57aeac={'from':(_0x1245c3['contact'][_0xd29d('0x8d')]||'')+'\x20'+(_0x1245c3[_0xd29d('0x8c')][_0xd29d('0x8e')]||'')};if(_0x307de9[_0xd29d('0x5f')]['threadId']&&_0x307de9['body'][_0xd29d('0x93')]&&_0x307de9[_0xd29d('0x5f')][_0xd29d('0x8f')]!=_0x307de9['body'][_0xd29d('0x93')]){_0x57aeac[_0xd29d('0x8f')]=_0x307de9[_0xd29d('0x5f')][_0xd29d('0x93')];}return _0x1c1ac5[_0xd29d('0x37')](_0x57aeac);}else{return _0x1c1ac5;}}})['then'](function(_0x54251b){_0x1245c3[_0xd29d('0x94')]=_0x54251b[_0xd29d('0x39')]({'plain':!![]});_0x1245c3['interaction']['created']=_0x1a0aa9;if(_0x1245c3[_0xd29d('0x94')]['created']){if(_0x1245c3[_0xd29d('0x86')][_0xd29d('0x95')]){_0x1245c3[_0xd29d('0x89')][_0xd29d('0x96')]({'id':0x0,'priority':_0x1245c3[_0xd29d('0x89')][_0xd29d('0x4d')]+0x1,'app':_0xd29d('0x97'),'appdata':_0xd29d('0x98'),'interval':_0xd29d('0x99')});}}return db[_0xd29d('0x9a')]['create']({'body':_0x307de9[_0xd29d('0x5f')][_0xd29d('0x5f')],'OpenchannelAccountId':_0x307de9[_0xd29d('0x5c')]['id'],'OpenchannelInteractionId':_0x54251b['id'],'direction':'in','ContactId':_0x1245c3[_0xd29d('0x8c')]['id'],'AttachmentId':_0x307de9['body'][_0xd29d('0x9b')]});})['then'](function(_0x50d7fd){_0x1245c3[_0xd29d('0x28')]=_0x50d7fd;if(_0x1245c3['interaction'][_0xd29d('0x9c')]){return db[_0xd29d('0x9d')]['find']({'attributes':['id','name'],'where':{'id':_0x1245c3[_0xd29d('0x94')][_0xd29d('0x9c')]}})[_0xd29d('0x22')](function(_0xd6dd9f){if(_0xd6dd9f){_0x1245c3['applications'][_0xd29d('0x9e')]({'id':0x0,'priority':0x0,'app':_0xd29d('0x9f'),'appdata':_0xd6dd9f[_0xd29d('0x3e')]+','+(_0x1245c3[_0xd29d('0x86')][_0xd29d('0xa0')]||0xa),'interval':_0xd29d('0x99')});_0x1245c3[_0xd29d('0xa1')]=![];}return respondWithRpcPromise(_0xd29d('0xa2'),_0xd29d('0xa3'),_0x1245c3);});}return respondWithRpcPromise(_0xd29d('0xa2'),'startRouting',_0x1245c3);})['then'](function(_0x1a84e8){respondWithRpcPromise(_0xd29d('0xa4'),'EventManager',{'event':_0xd29d('0x72'),'message':_0x1a84e8},client9002);return _0x1a84e8;})['then'](respondWithResult(_0x385272,null))[_0xd29d('0x2b')](handleError(_0x385272,null));};exports['addApplications']=function(_0x10eedf,_0x218177,_0x35c8b0){return db[_0xd29d('0x57')][_0xd29d('0x6a')]({'where':{'id':_0x10eedf[_0xd29d('0x5c')]['id']}})[_0xd29d('0x22')](handleEntityNotFound(_0x218177,null))['then'](function(_0x47c34e){if(_0x47c34e){return db[_0xd29d('0xa5')][_0xd29d('0xa6')](function(_0x592548){return db[_0xd29d('0x85')]['destroy']({'where':{'OpenchannelAccountId':_0x10eedf[_0xd29d('0x5c')]['id']},'transaction':_0x592548})[_0xd29d('0x22')](function(_0x294f32){var _0xa59038=_[_0xd29d('0x42')](_0x10eedf[_0xd29d('0x5f')],function(_0x2fcb91){_0x2fcb91[_0xd29d('0x6d')]=_0x10eedf[_0xd29d('0x5c')]['id'];return _0x2fcb91;});return db[_0xd29d('0x85')][_0xd29d('0xa7')](_0xa59038,{'transaction':_0x592548});});})['then'](function(){return db[_0xd29d('0x85')][_0xd29d('0xa8')]({'where':{'OpenchannelAccountId':_0x10eedf[_0xd29d('0x5c')]['id']},'order':_0xd29d('0x8a')});});}})[_0xd29d('0x22')](respondWithResult(_0x218177,null))[_0xd29d('0x2b')](handleError(_0x218177,null));};exports[_0xd29d('0xa9')]=function(_0x83e4aa,_0x4c2f6b,_0x5af68b){var _0x4206e9={};var _0x3de74d={};var _0x23ecd8;var _0x3af22e;return db[_0xd29d('0x57')]['findOne']({'where':{'id':_0x83e4aa[_0xd29d('0x5c')]['id']}})[_0xd29d('0x22')](handleEntityNotFound(_0x4c2f6b,null))[_0xd29d('0x22')](function(_0x3b492d){if(_0x3b492d){_0x23ecd8=_0x3b492d;_0x3de74d[_0xd29d('0x47')]=_[_0xd29d('0x49')](db['OpenchannelApplication']['rawAttributes']);_0x3de74d[_0xd29d('0x48')]=_[_0xd29d('0x49')](_0x83e4aa[_0xd29d('0x48')]);_0x3de74d[_0xd29d('0x52')]=_[_0xd29d('0x4a')](_0x3de74d[_0xd29d('0x47')],_0x3de74d[_0xd29d('0x48')]);_0x4206e9[_0xd29d('0x4c')]=_[_0xd29d('0x4a')](_0x3de74d[_0xd29d('0x47')],qs['fields'](_0x83e4aa[_0xd29d('0x48')][_0xd29d('0x4b')]));_0x4206e9[_0xd29d('0x4c')]=_0x4206e9[_0xd29d('0x4c')]['length']?_0x4206e9[_0xd29d('0x4c')]:_0x3de74d[_0xd29d('0x47')];_0x4206e9['order']=qs[_0xd29d('0x4f')](_0x83e4aa['query'][_0xd29d('0x4f')]);_0x4206e9['where']=qs[_0xd29d('0x52')](_['pick'](_0x83e4aa[_0xd29d('0x48')],_0x3de74d['filters']));if(_0x83e4aa[_0xd29d('0x48')]['filter']){_0x4206e9['where']=_[_0xd29d('0x54')](_0x4206e9['where'],{'$or':_[_0xd29d('0x42')](_0x4206e9['attributes'],function(_0x2eaaf9){var _0x13dd70={};_0x13dd70[_0x2eaaf9]={'$like':'%'+_0x83e4aa[_0xd29d('0x48')][_0xd29d('0x53')]+'%'};return _0x13dd70;})});}_0x4206e9=_[_0xd29d('0x54')]({},_0x4206e9,_0x83e4aa[_0xd29d('0x56')]);return _0x23ecd8[_0xd29d('0xa9')](_0x4206e9);}})[_0xd29d('0x22')](function(_0x348c23){if(_0x348c23){_0x3af22e=_0x348c23[_0xd29d('0x4d')];if(!_0x83e4aa[_0xd29d('0x48')][_0xd29d('0x6b')](_0xd29d('0x4e'))){_0x4206e9[_0xd29d('0x30')]=qs[_0xd29d('0x30')](_0x83e4aa['query'][_0xd29d('0x30')]);_0x4206e9['offset']=qs[_0xd29d('0x2f')](_0x83e4aa[_0xd29d('0x48')][_0xd29d('0x2f')]);}return _0x23ecd8['getApplications'](_0x4206e9);}})['then'](function(_0x41871c){if(_0x41871c){return _0x41871c?{'count':_0x3af22e,'rows':_0x41871c}:null;}})[_0xd29d('0x22')](respondWithResult(_0x4c2f6b,null))[_0xd29d('0x2b')](handleError(_0x4c2f6b,null));};exports[_0xd29d('0xaa')]=function(_0x3dc48d,_0x1bd31b,_0x1c6a24){var _0x410dca={'raw':![],'where':{}};var _0x209c23={};var _0x1a36ba={'count':0x0,'rows':[]};return db[_0xd29d('0x57')][_0xd29d('0x6a')]({'where':{'id':_0x3dc48d[_0xd29d('0x5c')]['id']}})[_0xd29d('0x22')](handleEntityNotFound(_0x1bd31b,null))[_0xd29d('0x22')](function(_0x4eea4d){if(_0x4eea4d){_0x209c23[_0xd29d('0x47')]=_[_0xd29d('0x49')](db[_0xd29d('0x90')][_0xd29d('0x43')]);_0x209c23[_0xd29d('0x48')]=_[_0xd29d('0x49')](_0x3dc48d['query']);_0x209c23[_0xd29d('0x52')]=_[_0xd29d('0x4a')](_0x209c23['model'],_0x209c23[_0xd29d('0x48')]);_0x410dca[_0xd29d('0x4c')]=_['intersection'](_0x209c23[_0xd29d('0x47')],qs['fields'](_0x3dc48d[_0xd29d('0x48')][_0xd29d('0x4b')]));_0x410dca['attributes']=_0x410dca[_0xd29d('0x4c')][_0xd29d('0x4d')]?_0x410dca[_0xd29d('0x4c')]:_0x209c23[_0xd29d('0x47')];if(!_0x3dc48d['query']['hasOwnProperty'](_0xd29d('0x4e'))){_0x410dca[_0xd29d('0x30')]=qs[_0xd29d('0x30')](_0x3dc48d[_0xd29d('0x48')]['limit']);_0x410dca['offset']=qs[_0xd29d('0x2f')](_0x3dc48d[_0xd29d('0x48')][_0xd29d('0x2f')]);}_0x410dca['order']=qs[_0xd29d('0x4f')](_0x3dc48d[_0xd29d('0x48')]['sort']);_0x410dca[_0xd29d('0x50')]=qs['filters'](_[_0xd29d('0x51')](_0x3dc48d[_0xd29d('0x48')],_0x209c23[_0xd29d('0x52')]));_0x410dca[_0xd29d('0x50')][_0xd29d('0x6d')]=_0x4eea4d['id'];if(_0x3dc48d[_0xd29d('0x48')][_0xd29d('0x53')]){_0x410dca['where']=_[_0xd29d('0x54')](_0x410dca[_0xd29d('0x50')],{'$or':_[_0xd29d('0x42')](_0x410dca[_0xd29d('0x4c')],function(_0x5a3db8){var _0x180be5={};_0x180be5[_0x5a3db8]={'$like':'%'+_0x3dc48d[_0xd29d('0x48')][_0xd29d('0x53')]+'%'};return _0x180be5;})});}_0x410dca=_[_0xd29d('0x54')]({},_0x410dca,_0x3dc48d['options']);return db[_0xd29d('0x90')][_0xd29d('0x2e')]({'where':_0x410dca[_0xd29d('0x50')]})['then'](function(_0xb11970){_0x1a36ba[_0xd29d('0x2e')]=_0xb11970;if(_0x3dc48d['query'][_0xd29d('0x58')]){_0x410dca[_0xd29d('0x59')]=[{'model':db[_0xd29d('0x74')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xd29d('0xab'),'attributes':['name',_0xd29d('0xac'),_0xd29d('0xad')],'required':![]},{'model':db[_0xd29d('0xae')],'as':_0xd29d('0xaf'),'attributes':['id',_0xd29d('0x3e'),_0xd29d('0xb0')],'where':_0x3dc48d['query']['tag']?{'id':_0x3dc48d[_0xd29d('0x48')][_0xd29d('0xb1')]}:undefined,'required':_0x3dc48d[_0xd29d('0x48')][_0xd29d('0xb1')]?!![]:![]}];}return db[_0xd29d('0x90')][_0xd29d('0x5a')](_0x410dca);})[_0xd29d('0x22')](function(_0xedda7f){_0x1a36ba[_0xd29d('0x5b')]=_0xedda7f;return _0x1a36ba;});}})['then'](respondWithFilteredResult(_0x1bd31b,_0x410dca))[_0xd29d('0x2b')](handleError(_0x1bd31b,null));};exports['addAgents']=function(_0x300f31,_0x585a9a,_0x10205d){return db[_0xd29d('0x57')]['find']({'where':{'id':_0x300f31[_0xd29d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x585a9a,null))[_0xd29d('0x22')](function(_0x3933c1){if(_0x3933c1){return _0x3933c1[_0xd29d('0xb2')](_0x300f31[_0xd29d('0x5f')][_0xd29d('0xb3')],_[_0xd29d('0xb4')](_0x300f31[_0xd29d('0x5f')],[_0xd29d('0xb3'),'id'])||{})['spread'](function(_0x5b5f5d){for(var _0x4ff48c=0x0;_0x4ff48c<_0x300f31[_0xd29d('0x5f')][_0xd29d('0xb3')][_0xd29d('0x4d')];_0x4ff48c+=0x1){socket['emit'](_0xd29d('0xb5'),{'UserId':_0x300f31[_0xd29d('0x5f')]['ids'][_0x4ff48c],'OpenchannelAccountId':_0x300f31['params']['id']});}return _0x5b5f5d;});}})[_0xd29d('0x22')](respondWithResult(_0x585a9a,null))['catch'](handleError(_0x585a9a,null));};exports[_0xd29d('0xb6')]=function(_0x147a4c,_0x2665aa,_0x176b57){return db[_0xd29d('0x57')][_0xd29d('0x5d')]({'where':{'id':_0x147a4c[_0xd29d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2665aa,null))[_0xd29d('0x22')](function(_0x5663f7){if(_0x5663f7){return _0x5663f7[_0xd29d('0xb6')](_0x147a4c['query'][_0xd29d('0xb3')])[_0xd29d('0x22')](function(){if(_[_0xd29d('0xb7')](_0x147a4c[_0xd29d('0x48')][_0xd29d('0xb3')])){for(var _0xd93cc6=0x0;_0xd93cc6<_0x147a4c[_0xd29d('0x48')][_0xd29d('0xb3')][_0xd29d('0x4d')];_0xd93cc6+=0x1){socket[_0xd29d('0xb8')](_0xd29d('0xb9'),{'UserId':Number(_0x147a4c[_0xd29d('0x48')][_0xd29d('0xb3')][_0xd93cc6]),'OpenchannelAccountId':Number(_0x147a4c['params']['id'])});}}else{socket['emit'](_0xd29d('0xb9'),{'UserId':Number(_0x147a4c[_0xd29d('0x48')][_0xd29d('0xb3')]),'OpenchannelAccountId':Number(_0x147a4c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2665aa,null))[_0xd29d('0x2b')](handleError(_0x2665aa,null));};exports[_0xd29d('0xba')]=function(_0x215512,_0x49e6ce,_0x2ff7a6){var _0xf67494={};var _0x5154ce={};var _0x15c094;var _0x2628d1;return db['OpenchannelAccount'][_0xd29d('0x6a')]({'where':{'id':_0x215512[_0xd29d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x49e6ce,null))['then'](function(_0x1c4ea7){if(_0x1c4ea7){_0x15c094=_0x1c4ea7;_0x5154ce[_0xd29d('0x47')]=_[_0xd29d('0x49')](db[_0xd29d('0x9d')][_0xd29d('0x43')]);_0x5154ce[_0xd29d('0x48')]=_[_0xd29d('0x49')](_0x215512[_0xd29d('0x48')]);_0x5154ce['filters']=_[_0xd29d('0x4a')](_0x5154ce[_0xd29d('0x47')],_0x5154ce[_0xd29d('0x48')]);_0xf67494[_0xd29d('0x4c')]=_[_0xd29d('0x4a')](_0x5154ce[_0xd29d('0x47')],qs[_0xd29d('0x4b')](_0x215512[_0xd29d('0x48')]['fields']));_0xf67494[_0xd29d('0x4c')]=_0xf67494[_0xd29d('0x4c')]['length']?_0xf67494[_0xd29d('0x4c')]:_0x5154ce['model'];_0xf67494['order']=qs[_0xd29d('0x4f')](_0x215512['query'][_0xd29d('0x4f')]);_0xf67494[_0xd29d('0x50')]=qs[_0xd29d('0x52')](_[_0xd29d('0x51')](_0x215512[_0xd29d('0x48')],_0x5154ce[_0xd29d('0x52')]));if(_0x215512[_0xd29d('0x48')][_0xd29d('0x53')]){_0xf67494[_0xd29d('0x50')]=_['merge'](_0xf67494[_0xd29d('0x50')],{'$or':_[_0xd29d('0x42')](_0xf67494[_0xd29d('0x4c')],function(_0x159061){var _0x4e10b6={};_0x4e10b6[_0x159061]={'$like':'%'+_0x215512[_0xd29d('0x48')][_0xd29d('0x53')]+'%'};return _0x4e10b6;})});}_0xf67494=_[_0xd29d('0x54')]({},_0xf67494,_0x215512[_0xd29d('0x56')]);return _0x15c094['getAgents'](_0xf67494);}})[_0xd29d('0x22')](function(_0x4ceede){if(_0x4ceede){_0x2628d1=_0x4ceede[_0xd29d('0x4d')];if(!_0x215512[_0xd29d('0x48')][_0xd29d('0x6b')](_0xd29d('0x4e'))){_0xf67494[_0xd29d('0x30')]=qs['limit'](_0x215512[_0xd29d('0x48')][_0xd29d('0x30')]);_0xf67494[_0xd29d('0x2f')]=qs[_0xd29d('0x2f')](_0x215512[_0xd29d('0x48')][_0xd29d('0x2f')]);}return _0x15c094[_0xd29d('0xba')](_0xf67494);}})['then'](function(_0x38cd5a){if(_0x38cd5a){return _0x38cd5a?{'count':_0x2628d1,'rows':_0x38cd5a}:null;}})['then'](respondWithResult(_0x49e6ce,null))['catch'](handleError(_0x49e6ce,null));};exports[_0xd29d('0x3f')]=function(_0x3aecbf,_0x1527ab,_0x480b81){var _0x8da9c3,_0x318aa5,_0x1b9fc7;if(_[_0xd29d('0x7a')](_0x3aecbf[_0xd29d('0x5f')][_0xd29d('0x5f')])||_0x3aecbf[_0xd29d('0x5f')][_0xd29d('0x5f')]===''){throw new db[(_0xd29d('0x1f'))][(_0xd29d('0x20'))](_0xd29d('0x7c'));}if(_[_0xd29d('0x7a')](_0x3aecbf[_0xd29d('0x5f')]['to'])){}_0x8da9c3=_0x3aecbf[_0xd29d('0x5f')]['to'];return db['OpenchannelAccount'][_0xd29d('0x6a')]({'where':{'id':_0x3aecbf[_0xd29d('0x5c')]['id']}})[_0xd29d('0x22')](handleEntityNotFound(_0x1527ab,null))[_0xd29d('0x22')](function(_0x32443a){if(_0x32443a){return db['OpenchannelAccount'][_0xd29d('0x5d')]({'where':{'id':_0x32443a['id']},'include':[{'model':db[_0xd29d('0xbb')],'as':_0xd29d('0x81'),'include':[{'model':db[_0xd29d('0x74')],'as':_0xd29d('0x82'),'where':{[_0x32443a[_0xd29d('0x7f')]]:_0x8da9c3},'limit':0x1,'order':[[_0xd29d('0x83'),_0xd29d('0x84')]]}]}]})[_0xd29d('0x22')](handleEntityNotFound(_0x1527ab,null))[_0xd29d('0x22')](function(_0x4ac22){if(_0x4ac22&&_0x4ac22['List']){_0x318aa5=_0x4ac22[_0xd29d('0x39')]({'plain':!![]});if(_0x318aa5[_0xd29d('0x81')]&&_0x318aa5['List'][_0xd29d('0x82')][_0xd29d('0x4d')]){return _0x318aa5[_0xd29d('0x81')][_0xd29d('0x82')][0x0];}return db[_0xd29d('0x74')]['create'](_[_0xd29d('0x18')](_0x3aecbf[_0xd29d('0x5f')],{'firstName':_0x8da9c3,[_0x4ac22['mapKey']]:_0x8da9c3,'phone':_0x8da9c3,'ListId':_0x318aa5['ListId']}));}})[_0xd29d('0x22')](handleEntityNotFound(_0x1527ab,null))[_0xd29d('0x22')](function(_0x4a1754){if(_0x4a1754){_0x1b9fc7=_0x4a1754;return db[_0xd29d('0x90')][_0xd29d('0x5d')]({'where':{'ContactId':_0x1b9fc7['id'],'closed':![],'OpenchannelAccountId':_0x318aa5['id']}})[_0xd29d('0x22')](function(_0x2ec537){if(_0x2ec537){return[_0x2ec537,![]];}return db[_0xd29d('0x90')][_0xd29d('0x5e')]({'UserId':_0x3aecbf[_0xd29d('0x62')]['id'],'ContactId':_0x1b9fc7['id'],'OpenchannelAccountId':_0x318aa5['id'],'lastMsgDirection':_0xd29d('0xbc'),'Messages':[_[_0xd29d('0x54')](_0x3aecbf[_0xd29d('0x5f')],{'read':![],'body':_0x3aecbf[_0xd29d('0x5f')][_0xd29d('0x5f')],'OpenchannelAccountId':_0x318aa5['id'],'UserId':_0x3aecbf[_0xd29d('0x62')]['id'],'ContactId':_0x1b9fc7['id']})]},{'include':[{'model':db[_0xd29d('0x9a')],'as':'Messages'}]})['then'](function(_0x1402c5){return[_0x1402c5,!![]];});});}})['spread'](function(_0x226fd7,_0x1adea1){if(_0x1adea1){return _0x226fd7;}return db['OpenchannelMessage'][_0xd29d('0x5e')](_['merge'](_0x3aecbf[_0xd29d('0x5f')],{'read':![],'body':_0x3aecbf['body'][_0xd29d('0x5f')],'OpenchannelAccountId':_0x318aa5['id'],'OpenchannelInteractionId':_0x226fd7['id'],'UserId':_0x3aecbf[_0xd29d('0x62')]['id'],'ContactId':_0x1b9fc7['id']}))[_0xd29d('0x22')](function(_0x3f7bbb){_0x226fd7[_0xd29d('0xbd')][_0xd29d('0xbe')]=[];_0x226fd7[_0xd29d('0xbd')][_0xd29d('0xbe')][_0xd29d('0x96')](_0x3f7bbb[_0xd29d('0xbd')]);return _0x226fd7;});});}})[_0xd29d('0x22')](respondWithResult(_0x1527ab,null))[_0xd29d('0x2b')](handleError(_0x1527ab,null));}; \ No newline at end of file +var _0x52f6=['include','findAll','rows','show','params','Pause','mandatoryDispositionPause','keys','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','UserProfileResource','find','describe','OpnechannelAccountId','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','DESC','Applications','applications','list','priority','account','Contacts','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','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~!@#$%^&-_=+[{]}.','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','OpenchannelAccount','includeAll'];(function(_0x557f1c,_0x477821){var _0x5edf28=function(_0x5f537e){while(--_0x5f537e){_0x557f1c['push'](_0x557f1c['shift']());}};_0x5edf28(++_0x477821);}(_0x52f6,0x67));var _0x652f=function(_0x2dfeab,_0x16502d){_0x2dfeab=_0x2dfeab-0x0;var _0xe23120=_0x52f6[_0x2dfeab];return _0xe23120;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x652f('0x0'));var rimraf=require(_0x652f('0x1'));var zipdir=require(_0x652f('0x2'));var jsonpatch=require(_0x652f('0x3'));var rp=require('request-promise');var moment=require(_0x652f('0x4'));var BPromise=require(_0x652f('0x5'));var Mustache=require('mustache');var util=require(_0x652f('0x6'));var path=require(_0x652f('0x7'));var sox=require(_0x652f('0x8'));var csv=require('to-csv');var ejs=require(_0x652f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x652f('0xa'));var crypto=require(_0x652f('0xb'));var jsforce=require(_0x652f('0xc'));var deskjs=require(_0x652f('0xd'));var toCsv=require(_0x652f('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x652f('0xf'));var authService=require(_0x652f('0x10'));var qs=require(_0x652f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x652f('0x12'));var logger=require(_0x652f('0x13'))(_0x652f('0x14'));var utils=require(_0x652f('0x15'));var config=require(_0x652f('0x16'));var db=require(_0x652f('0x17'))['db'];config[_0x652f('0x18')]=_['defaults'](config[_0x652f('0x18')],{'host':_0x652f('0x19'),'port':0x18eb});var socket=require(_0x652f('0x1a'))(new Redis(config[_0x652f('0x18')]));require(_0x652f('0x1b'))['register'](socket);var jayson=require(_0x652f('0x1c'));var client=jayson[_0x652f('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x652f('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x4bc80c,_0xbb3903,_0x2ec3c9){if(_0x2ec3c9){var _0x1cbc31=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1cbc31[_0x652f('0x1f')](_0xbb3903)){return _0x4bc80c;}else{throw new db[(_0x652f('0x20'))]['ValidationError'](_0x652f('0x21'));}}else{return _0x4bc80c;}}function respondWithRpcPromise(_0x3dca97,_0xeb411,_0x1b2c2f,_0x311a22){return new BPromise(function(_0xca2fbc,_0x1f04da){var _0x18da69=_0x311a22||client;return _0x18da69[_0x652f('0x22')](_0x3dca97,_0x1b2c2f)[_0x652f('0x23')](function(_0x40764e){logger['info'](_0x652f('0x24'),_0xeb411,_0x652f('0x25'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xeb411,_0x652f('0x25'),JSON[_0x652f('0x26')](_0x40764e));if(_0x40764e[_0x652f('0x27')]){if(_0x40764e[_0x652f('0x27')][_0x652f('0x28')]===0x1f4){logger[_0x652f('0x27')](_0x652f('0x24'),_0xeb411,_0x40764e[_0x652f('0x27')]['message']);return _0x1f04da(_0x40764e[_0x652f('0x27')][_0x652f('0x29')]);}logger[_0x652f('0x27')](_0x652f('0x24'),_0xeb411,_0x40764e['error'][_0x652f('0x29')]);return _0xca2fbc(_0x40764e[_0x652f('0x27')][_0x652f('0x29')]);}else{logger['info'](_0x652f('0x24'),_0xeb411,_0x652f('0x25'));_0xca2fbc(_0x40764e['result'][_0x652f('0x29')]);}})[_0x652f('0x2a')](function(_0x4c67fd){logger[_0x652f('0x27')](_0x652f('0x24'),_0xeb411,_0x4c67fd);_0x1f04da(_0x4c67fd);});});}function respondWithStatusCode(_0x1cbcfd,_0x43f96f){_0x43f96f=_0x43f96f||0xcc;return function(_0x22bd9c){if(_0x22bd9c){return _0x1cbcfd[_0x652f('0x2b')](_0x43f96f);}return _0x1cbcfd[_0x652f('0x2c')](_0x43f96f)['end']();};}function respondWithResult(_0x2e3940,_0x365cd4){_0x365cd4=_0x365cd4||0xc8;return function(_0x12364f){if(_0x12364f){return _0x2e3940[_0x652f('0x2c')](_0x365cd4)[_0x652f('0x2d')](_0x12364f);}};}function respondWithFilteredResult(_0x38a562,_0x3d5189){return function(_0xab1fe7){if(_0xab1fe7){var _0x28958e=_0xab1fe7[_0x652f('0x2e')],_0x55322e=_0x3d5189['offset'],_0x64b78=_0x3d5189[_0x652f('0x2f')]+_0x3d5189[_0x652f('0x30')],_0x76dcfb;if(_0x64b78>=_0x28958e){_0x64b78=_0x28958e;_0x76dcfb=0xc8;}else{_0x76dcfb=0xce;}_0x38a562[_0x652f('0x2c')](_0x76dcfb);return _0x38a562[_0x652f('0x31')](_0x652f('0x32'),_0x55322e+'-'+_0x64b78+'/'+_0x28958e)[_0x652f('0x2d')](_0xab1fe7);}return null;};}function patchUpdates(_0x4206da){return function(_0x4df3ce){try{jsonpatch[_0x652f('0x33')](_0x4df3ce,_0x4206da,!![]);}catch(_0x5c7d31){return BPromise[_0x652f('0x34')](_0x5c7d31);}return _0x4df3ce[_0x652f('0x35')]();};}function saveUpdates(_0xa807f4,_0x2f6a7e){return function(_0x2d84dc){if(_0x2d84dc){return _0x2d84dc[_0x652f('0x36')](_0xa807f4)[_0x652f('0x23')](function(_0x418edc){return _0x418edc;});}return null;};}function removeEntity(_0x302b15,_0x446b53){return function(_0x11fb60){if(_0x11fb60){return _0x11fb60['destroy']()[_0x652f('0x23')](function(){var _0x36ee17=_0x11fb60[_0x652f('0x37')]({'plain':!![]});var _0x42b789='OpenchannelAccounts';return db['UserProfileResource'][_0x652f('0x38')]({'where':{'type':_0x42b789,'resourceId':_0x36ee17['id']}})[_0x652f('0x23')](function(){return _0x11fb60;});})[_0x652f('0x23')](function(){_0x302b15[_0x652f('0x2c')](0xcc)[_0x652f('0x39')]();});}};}function handleEntityNotFound(_0x4903ad,_0x44909a){return function(_0x11275c){if(!_0x11275c){_0x4903ad['sendStatus'](0x194);}return _0x11275c;};}function handleError(_0x169f31,_0x31dba4){_0x31dba4=_0x31dba4||0x1f4;return function(_0x271d8b){logger[_0x652f('0x27')](_0x271d8b[_0x652f('0x3a')]);if(_0x271d8b[_0x652f('0x3b')]){delete _0x271d8b[_0x652f('0x3b')];}_0x169f31[_0x652f('0x2c')](_0x31dba4)[_0x652f('0x3c')](_0x271d8b);};}exports['index']=function(_0x3b64dd,_0x5afec5){var _0x51c83c={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3ff64f={},_0x3a976c={'count':0x0,'rows':[]};var _0x14c3f6=_[_0x652f('0x3d')](db['OpenchannelAccount'][_0x652f('0x3e')],function(_0x5a7e62){return{'name':_0x5a7e62['fieldName'],'type':_0x5a7e62[_0x652f('0x3f')][_0x652f('0x40')]};});_0x3ff64f[_0x652f('0x41')]=_[_0x652f('0x3d')](_0x14c3f6,_0x652f('0x3b'));_0x3ff64f[_0x652f('0x42')]=_['keys'](_0x3b64dd[_0x652f('0x42')]);_0x3ff64f['filters']=_['intersection'](_0x3ff64f['model'],_0x3ff64f['query']);_0x51c83c[_0x652f('0x43')]=_[_0x652f('0x44')](_0x3ff64f['model'],qs[_0x652f('0x45')](_0x3b64dd[_0x652f('0x42')][_0x652f('0x45')]));_0x51c83c[_0x652f('0x43')]=_0x51c83c[_0x652f('0x43')]['length']?_0x51c83c['attributes']:_0x3ff64f[_0x652f('0x41')];if(!_0x3b64dd[_0x652f('0x42')][_0x652f('0x46')](_0x652f('0x47'))){_0x51c83c[_0x652f('0x30')]=qs[_0x652f('0x30')](_0x3b64dd[_0x652f('0x42')][_0x652f('0x30')]);_0x51c83c[_0x652f('0x2f')]=qs[_0x652f('0x2f')](_0x3b64dd[_0x652f('0x42')][_0x652f('0x2f')]);}_0x51c83c[_0x652f('0x48')]=qs['sort'](_0x3b64dd[_0x652f('0x42')][_0x652f('0x49')]);_0x51c83c['where']=qs[_0x652f('0x4a')](_[_0x652f('0x4b')](_0x3b64dd[_0x652f('0x42')],_0x3ff64f['filters']),_0x14c3f6);if(_0x3b64dd[_0x652f('0x42')][_0x652f('0x4c')]){_0x51c83c[_0x652f('0x4d')]=_[_0x652f('0x4e')](_0x51c83c[_0x652f('0x4d')],{'$or':_[_0x652f('0x3d')](_0x14c3f6,function(_0x6793b){if(_0x6793b[_0x652f('0x3f')]!==_0x652f('0x4f')){var _0x499fc1={};_0x499fc1[_0x6793b[_0x652f('0x3b')]]={'$like':'%'+_0x3b64dd['query'][_0x652f('0x4c')]+'%'};return _0x499fc1;}})});}_0x51c83c=_[_0x652f('0x4e')]({},_0x51c83c,_0x3b64dd['options']);var _0x2571cc={'where':_0x51c83c[_0x652f('0x4d')]};return db[_0x652f('0x50')][_0x652f('0x2e')](_0x2571cc)[_0x652f('0x23')](function(_0x48ffbb){_0x3a976c[_0x652f('0x2e')]=_0x48ffbb;if(_0x3b64dd['query'][_0x652f('0x51')]){_0x51c83c[_0x652f('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x652f('0x53')](_0x51c83c);})[_0x652f('0x23')](function(_0x515110){_0x3a976c[_0x652f('0x54')]=_0x515110;return _0x3a976c;})['then'](respondWithFilteredResult(_0x5afec5,_0x51c83c))[_0x652f('0x2a')](handleError(_0x5afec5,null));};exports[_0x652f('0x55')]=function(_0x1bc7fd,_0x2c1f44){var _0x45b018={'raw':![],'where':{'id':_0x1bc7fd[_0x652f('0x56')]['id']},'include':[{'model':db[_0x652f('0x57')],'as':_0x652f('0x58')}]},_0x1dca89={};_0x1dca89[_0x652f('0x41')]=_[_0x652f('0x59')](db['OpenchannelAccount'][_0x652f('0x3e')]);_0x1dca89['query']=_['keys'](_0x1bc7fd[_0x652f('0x42')]);_0x1dca89[_0x652f('0x4a')]=_[_0x652f('0x44')](_0x1dca89[_0x652f('0x41')],_0x1dca89[_0x652f('0x42')]);_0x45b018[_0x652f('0x43')]=_['intersection'](_0x1dca89[_0x652f('0x41')],qs['fields'](_0x1bc7fd[_0x652f('0x42')]['fields']));_0x45b018[_0x652f('0x43')]=_0x45b018[_0x652f('0x43')][_0x652f('0x5a')]?_0x45b018[_0x652f('0x43')]:_0x1dca89[_0x652f('0x41')];if(_0x1bc7fd['query'][_0x652f('0x51')]){_0x45b018[_0x652f('0x52')]=[{'all':!![]}];}_0x45b018=_[_0x652f('0x4e')]({},_0x45b018,_0x1bc7fd[_0x652f('0x5b')]);return db[_0x652f('0x50')]['find'](_0x45b018)[_0x652f('0x23')](handleEntityNotFound(_0x2c1f44,null))[_0x652f('0x23')](respondWithResult(_0x2c1f44,null))['catch'](handleError(_0x2c1f44,null));};exports[_0x652f('0x5c')]=function(_0x51d0e6,_0x30045c){return db[_0x652f('0x50')][_0x652f('0x5c')](_0x51d0e6[_0x652f('0x5d')],{})[_0x652f('0x23')](function(_0x53a01d){var _0x2ce35e=_0x51d0e6[_0x652f('0x5e')]['get']({'plain':!![]});if(!_0x2ce35e)throw new Error(_0x652f('0x5f'));if(_0x2ce35e[_0x652f('0x60')]===_0x652f('0x5e')){var _0x479c3f=_0x53a01d[_0x652f('0x37')]({'plain':!![]});var _0x408c01=_0x652f('0x61');return db[_0x652f('0x62')]['find']({'where':{'name':_0x408c01,'userProfileId':_0x2ce35e[_0x652f('0x63')]},'raw':!![]})[_0x652f('0x23')](function(_0x47ebcd){if(_0x47ebcd&&_0x47ebcd['autoAssociation']===0x0){return db[_0x652f('0x64')][_0x652f('0x5c')]({'name':_0x479c3f[_0x652f('0x3b')],'resourceId':_0x479c3f['id'],'type':_0x47ebcd[_0x652f('0x3b')],'sectionId':_0x47ebcd['id']},{})[_0x652f('0x23')](function(){return _0x53a01d;});}else{return _0x53a01d;}})['catch'](function(_0x9cee20){logger[_0x652f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9cee20);throw _0x9cee20;});}return _0x53a01d;})[_0x652f('0x23')](respondWithResult(_0x30045c,0xc9))[_0x652f('0x2a')](handleError(_0x30045c,null));};exports[_0x652f('0x36')]=function(_0x4a2532,_0x2eb044){if(_0x4a2532['body']['id']){delete _0x4a2532[_0x652f('0x5d')]['id'];}return db['OpenchannelAccount'][_0x652f('0x65')]({'where':{'id':_0x4a2532[_0x652f('0x56')]['id']},'include':[{'model':db[_0x652f('0x57')],'as':_0x652f('0x58')}]})[_0x652f('0x23')](handleEntityNotFound(_0x2eb044,null))[_0x652f('0x23')](saveUpdates(_0x4a2532[_0x652f('0x5d')],null))[_0x652f('0x23')](respondWithResult(_0x2eb044,null))[_0x652f('0x2a')](handleError(_0x2eb044,null));};exports[_0x652f('0x38')]=function(_0x387fd6,_0x4eb170){return db[_0x652f('0x50')]['find']({'where':{'id':_0x387fd6[_0x652f('0x56')]['id']}})[_0x652f('0x23')](handleEntityNotFound(_0x4eb170,null))[_0x652f('0x23')](removeEntity(_0x4eb170,null))[_0x652f('0x2a')](handleError(_0x4eb170,null));};exports[_0x652f('0x66')]=function(_0x1294c4,_0xdc8568){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0xdc8568,null))[_0x652f('0x2a')](handleError(_0xdc8568,null));};exports['addDisposition']=function(_0x35454d,_0x2724e2,_0x5a7985){if(_0x35454d['body']['id']){delete _0x35454d[_0x652f('0x5d')]['id'];}return db[_0x652f('0x50')]['find']({'where':{'id':_0x35454d[_0x652f('0x56')]['id']}})['then'](handleEntityNotFound(_0x2724e2,null))[_0x652f('0x23')](function(_0xa7fbe0){if(_0xa7fbe0){_0x35454d['body'][_0x652f('0x67')]=_0xa7fbe0['id'];return db[_0x652f('0x68')][_0x652f('0x5c')](_0x35454d[_0x652f('0x5d')]);}})['then'](respondWithResult(_0x2724e2,null))[_0x652f('0x2a')](handleError(_0x2724e2,null));};exports[_0x652f('0x69')]=function(_0x3c6ca2,_0x262ff5,_0x55b5f9){var _0x1b5ab3={'raw':![],'where':{}};var _0x460444={};var _0x2b6bac={'count':0x0,'rows':[]};return db[_0x652f('0x50')][_0x652f('0x6a')]({'where':{'id':_0x3c6ca2[_0x652f('0x56')]['id']}})['then'](handleEntityNotFound(_0x262ff5,null))[_0x652f('0x23')](function(_0x18344c){if(_0x18344c){_0x460444[_0x652f('0x41')]=_[_0x652f('0x59')](db[_0x652f('0x68')][_0x652f('0x3e')]);_0x460444[_0x652f('0x42')]=_['keys'](_0x3c6ca2['query']);_0x460444[_0x652f('0x4a')]=_[_0x652f('0x44')](_0x460444[_0x652f('0x41')],_0x460444[_0x652f('0x42')]);_0x1b5ab3[_0x652f('0x43')]=_[_0x652f('0x44')](_0x460444[_0x652f('0x41')],qs['fields'](_0x3c6ca2[_0x652f('0x42')]['fields']));_0x1b5ab3[_0x652f('0x43')]=_0x1b5ab3[_0x652f('0x43')][_0x652f('0x5a')]?_0x1b5ab3['attributes']:_0x460444[_0x652f('0x41')];if(!_0x3c6ca2['query'][_0x652f('0x46')](_0x652f('0x47'))){_0x1b5ab3[_0x652f('0x30')]=qs[_0x652f('0x30')](_0x3c6ca2[_0x652f('0x42')][_0x652f('0x30')]);_0x1b5ab3[_0x652f('0x2f')]=qs['offset'](_0x3c6ca2[_0x652f('0x42')][_0x652f('0x2f')]);}_0x1b5ab3[_0x652f('0x48')]=qs[_0x652f('0x49')](_0x3c6ca2[_0x652f('0x42')]['sort']);_0x1b5ab3[_0x652f('0x4d')]=qs[_0x652f('0x4a')](_['pick'](_0x3c6ca2[_0x652f('0x42')],_0x460444[_0x652f('0x4a')]));_0x1b5ab3['where'][_0x652f('0x6b')]=_0x18344c['id'];if(_0x3c6ca2[_0x652f('0x42')]['filter']){_0x1b5ab3[_0x652f('0x4d')]=_[_0x652f('0x4e')](_0x1b5ab3[_0x652f('0x4d')],{'$or':_['map'](_0x1b5ab3[_0x652f('0x43')],function(_0x1458f0){var _0x76031a={};_0x76031a[_0x1458f0]={'$like':'%'+_0x3c6ca2[_0x652f('0x42')][_0x652f('0x4c')]+'%'};return _0x76031a;})});}_0x1b5ab3=_[_0x652f('0x4e')]({},_0x1b5ab3,_0x3c6ca2[_0x652f('0x5b')]);return db['Disposition']['count']({'where':_0x1b5ab3[_0x652f('0x4d')]})[_0x652f('0x23')](function(_0x2a10ec){_0x2b6bac[_0x652f('0x2e')]=_0x2a10ec;if(_0x3c6ca2[_0x652f('0x42')][_0x652f('0x51')]){_0x1b5ab3['include']=[{'all':!![]}];}return db[_0x652f('0x68')][_0x652f('0x53')](_0x1b5ab3);})[_0x652f('0x23')](function(_0x719105){_0x2b6bac[_0x652f('0x54')]=_0x719105;return _0x2b6bac;});}})[_0x652f('0x23')](respondWithFilteredResult(_0x262ff5,_0x1b5ab3))[_0x652f('0x2a')](handleError(_0x262ff5,null));};exports[_0x652f('0x6c')]=function(_0x59a223,_0x1e3162,_0x50c082){return db['OpenchannelAccount']['find']({'where':{'id':_0x59a223['params']['id']}})[_0x652f('0x23')](handleEntityNotFound(_0x1e3162,null))['then'](function(_0x252b26){if(_0x252b26){return _0x252b26[_0x652f('0x6c')](_0x59a223['query'][_0x652f('0x6d')]);}})[_0x652f('0x23')](respondWithStatusCode(_0x1e3162,null))[_0x652f('0x2a')](handleError(_0x1e3162,null));};exports['addAnswer']=function(_0x2ec9fb,_0xa9de66,_0x1ce239){if(_0x2ec9fb[_0x652f('0x5d')]['id']){delete _0x2ec9fb[_0x652f('0x5d')]['id'];}return db['OpenchannelAccount'][_0x652f('0x65')]({'where':{'id':_0x2ec9fb[_0x652f('0x56')]['id']}})[_0x652f('0x23')](handleEntityNotFound(_0xa9de66,null))[_0x652f('0x23')](function(_0x3b018b){if(_0x3b018b){_0x2ec9fb[_0x652f('0x5d')][_0x652f('0x6b')]=_0x3b018b['id'];return db[_0x652f('0x6e')][_0x652f('0x5c')](_0x2ec9fb[_0x652f('0x5d')]);}})[_0x652f('0x23')](respondWithResult(_0xa9de66,null))[_0x652f('0x2a')](handleError(_0xa9de66,null));};exports[_0x652f('0x6f')]=function(_0x57e2ce,_0x209ea2,_0x5ab2dc){var _0x20cec1={'raw':![],'where':{}};var _0x95a591={};var _0x1bec4d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x652f('0x6a')]({'where':{'id':_0x57e2ce['params']['id']}})[_0x652f('0x23')](handleEntityNotFound(_0x209ea2,null))['then'](function(_0x2a4de5){if(_0x2a4de5){_0x95a591[_0x652f('0x41')]=_[_0x652f('0x59')](db[_0x652f('0x6e')][_0x652f('0x3e')]);_0x95a591[_0x652f('0x42')]=_['keys'](_0x57e2ce[_0x652f('0x42')]);_0x95a591['filters']=_[_0x652f('0x44')](_0x95a591[_0x652f('0x41')],_0x95a591['query']);_0x20cec1[_0x652f('0x43')]=_[_0x652f('0x44')](_0x95a591[_0x652f('0x41')],qs[_0x652f('0x45')](_0x57e2ce['query'][_0x652f('0x45')]));_0x20cec1[_0x652f('0x43')]=_0x20cec1[_0x652f('0x43')][_0x652f('0x5a')]?_0x20cec1[_0x652f('0x43')]:_0x95a591[_0x652f('0x41')];if(!_0x57e2ce['query']['hasOwnProperty'](_0x652f('0x47'))){_0x20cec1[_0x652f('0x30')]=qs[_0x652f('0x30')](_0x57e2ce[_0x652f('0x42')][_0x652f('0x30')]);_0x20cec1[_0x652f('0x2f')]=qs[_0x652f('0x2f')](_0x57e2ce[_0x652f('0x42')][_0x652f('0x2f')]);}_0x20cec1[_0x652f('0x48')]=qs[_0x652f('0x49')](_0x57e2ce[_0x652f('0x42')][_0x652f('0x49')]);_0x20cec1['where']=qs[_0x652f('0x4a')](_['pick'](_0x57e2ce[_0x652f('0x42')],_0x95a591[_0x652f('0x4a')]));_0x20cec1[_0x652f('0x4d')][_0x652f('0x6b')]=_0x2a4de5['id'];if(_0x57e2ce[_0x652f('0x42')][_0x652f('0x4c')]){_0x20cec1['where']=_['merge'](_0x20cec1[_0x652f('0x4d')],{'$or':_[_0x652f('0x3d')](_0x20cec1[_0x652f('0x43')],function(_0x83a136){var _0x154522={};_0x154522[_0x83a136]={'$like':'%'+_0x57e2ce[_0x652f('0x42')][_0x652f('0x4c')]+'%'};return _0x154522;})});}_0x20cec1=_[_0x652f('0x4e')]({},_0x20cec1,_0x57e2ce[_0x652f('0x5b')]);return db['CannedAnswer'][_0x652f('0x2e')]({'where':_0x20cec1['where']})['then'](function(_0x51a977){_0x1bec4d[_0x652f('0x2e')]=_0x51a977;if(_0x57e2ce['query']['includeAll']){_0x20cec1[_0x652f('0x52')]=[{'all':!![]}];}return db[_0x652f('0x6e')]['findAll'](_0x20cec1);})[_0x652f('0x23')](function(_0x23b300){_0x1bec4d['rows']=_0x23b300;return _0x1bec4d;});}})['then'](respondWithFilteredResult(_0x209ea2,_0x20cec1))[_0x652f('0x2a')](handleError(_0x209ea2,null));};exports[_0x652f('0x70')]=function(_0x2a8f99,_0x1b42e8,_0x559b67){return db[_0x652f('0x50')][_0x652f('0x65')]({'where':{'id':_0x2a8f99[_0x652f('0x56')]['id']}})[_0x652f('0x23')](handleEntityNotFound(_0x1b42e8,null))[_0x652f('0x23')](function(_0x22c296){if(_0x22c296){return _0x22c296[_0x652f('0x70')](_0x2a8f99[_0x652f('0x42')][_0x652f('0x6d')]);}})[_0x652f('0x23')](respondWithStatusCode(_0x1b42e8,null))['catch'](handleError(_0x1b42e8,null));};exports['notify']=function(_0x172d71,_0x398bbc,_0x473723){var _0x201df1={'body':_0x172d71['body'],'channel':_0x652f('0x71')};var _0x50f0bb=[];var _0x2f75aa=[];var _0x5f25e5={};var _0x5ae74a=![];return db[_0x652f('0x72')][_0x652f('0x66')]()[_0x652f('0x23')](function(_0x14ab37){if(!_0x14ab37){throw new db[(_0x652f('0x20'))][(_0x652f('0x73'))](_0x652f('0x74'));}_0x50f0bb=_['difference'](_[_0x652f('0x59')](_0x14ab37),['createdAt',_0x652f('0x75')]);_0x2f75aa=_[_0x652f('0x76')](_[_0x652f('0x59')](_0x14ab37),['createdAt','updatedAt',_0x652f('0x77'),_0x652f('0x78')]);if(_0x172d71[_0x652f('0x5d')]['id']){delete _0x172d71[_0x652f('0x5d')]['id'];}if(_[_0x652f('0x79')](_0x172d71['body']['from'])){throw new db[(_0x652f('0x20'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x172d71[_0x652f('0x5d')][_0x652f('0x5d')])||_0x172d71[_0x652f('0x5d')][_0x652f('0x5d')]===''){throw new db['Sequelize'][(_0x652f('0x73'))](_0x652f('0x7a'));}if(_[_0x652f('0x79')](_0x172d71['body'][_0x652f('0x7b')])){throw new db[(_0x652f('0x20'))]['ValidationError'](_0x652f('0x7c')+_0x2f75aa);}if(!_[_0x652f('0x7d')](_0x2f75aa,_0x172d71[_0x652f('0x5d')]['mapKey'])){throw new db[(_0x652f('0x20'))][(_0x652f('0x73'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2f75aa);}_0x5f25e5[_0x172d71[_0x652f('0x5d')][_0x652f('0x7b')]]=_0x172d71[_0x652f('0x5d')][_0x652f('0x7e')];})[_0x652f('0x23')](function(){return db['OpenchannelAccount'][_0x652f('0x65')]({'where':{'id':_0x172d71[_0x652f('0x56')]['id']},'include':[{'model':db[_0x652f('0x7f')],'as':_0x652f('0x80'),'include':[{'model':db[_0x652f('0x72')],'as':'Contacts','where':_0x5f25e5,'limit':0x1,'order':[[_0x652f('0x75'),_0x652f('0x81')]]}]},{'model':db['OpenchannelApplication'],'as':_0x652f('0x82')}]});})['then'](handleEntityNotFound(_0x398bbc,null))[_0x652f('0x23')](function(_0x2a96d8){if(_0x2a96d8&&_0x2a96d8[_0x652f('0x80')]){_0x201df1['account']=_0x2a96d8;_0x201df1[_0x652f('0x83')]=_0x2a96d8[_0x652f('0x82')];_0x201df1[_0x652f('0x84')]=_0x2a96d8[_0x652f('0x80')];_0x201df1['applications']=_['orderBy'](_0x201df1[_0x652f('0x83')],[_0x652f('0x85')],['asc']);if(_0x201df1[_0x652f('0x86')][_0x652f('0x82')]){delete _0x201df1[_0x652f('0x86')]['Applications'];}if(_0x201df1[_0x652f('0x86')][_0x652f('0x80')]&&_0x201df1[_0x652f('0x86')][_0x652f('0x80')][_0x652f('0x87')][_0x652f('0x5a')]){return _0x201df1[_0x652f('0x86')][_0x652f('0x80')][_0x652f('0x87')][0x0];}var _0xd265a2=_[_0x652f('0x88')](_0x172d71[_0x652f('0x5d')],{'firstName':_0x172d71[_0x652f('0x5d')][_0x652f('0x7e')],'ListId':_0x2a96d8[_0x652f('0x78')]});_0xd265a2[_0x172d71['body']['mapKey']]=_0x172d71[_0x652f('0x5d')][_0x652f('0x7e')];return db[_0x652f('0x72')]['create'](_0xd265a2,{'fields':_0x50f0bb,'raw':!![]});}})[_0x652f('0x23')](handleEntityNotFound(_0x398bbc,null))['then'](function(_0x368b56){_0x201df1['contact']=_0x368b56;if(_0x368b56){var _0x4fc160={'ContactId':_0x368b56['id'],'OpenchannelAccountId':_0x172d71['params']['id'],'from':(_0x368b56[_0x652f('0x89')]||'')+'\x20'+(_0x368b56[_0x652f('0x8a')]||'')};var _0x5dbb39={'OpenchannelAccountId':_0x172d71['params']['id'],'closed':![]};if(_0x172d71[_0x652f('0x5d')][_0x652f('0x8b')]){_0x5dbb39[_0x652f('0x8b')]=_0x172d71[_0x652f('0x5d')][_0x652f('0x8b')];return db[_0x652f('0x8c')][_0x652f('0x65')]({'where':_0x5dbb39})['then'](function(_0x51667f){if(_0x51667f){return[_0x51667f,![]];}_0x4fc160['threadId']=_0x172d71[_0x652f('0x5d')]['threadId'];_0x4fc160[_0x652f('0x8d')]=_0x172d71[_0x652f('0x5d')][_0x652f('0x8d')];return db[_0x652f('0x8c')][_0x652f('0x5c')](_0x4fc160)[_0x652f('0x23')](function(_0x460f24){return[_0x460f24,!![]];});});}else{_0x5dbb39['threadId']=null;}_0x5dbb39[_0x652f('0x8e')]=_0x368b56['id'];return db[_0x652f('0x8c')][_0x652f('0x65')]({'where':_0x5dbb39})[_0x652f('0x23')](function(_0x46513b){if(_0x46513b){return[_0x46513b,![]];}return db[_0x652f('0x8c')]['create'](_0x4fc160)[_0x652f('0x23')](function(_0x57e9f2){return[_0x57e9f2,!![]];});});}})[_0x652f('0x8f')](function(_0x11b0cd,_0x4d93d4){if(_0x11b0cd){_0x5ae74a=_0x4d93d4;if(!_0x4d93d4){var _0x31e4d5={'from':(_0x201df1[_0x652f('0x90')][_0x652f('0x89')]||'')+'\x20'+(_0x201df1[_0x652f('0x90')][_0x652f('0x8a')]||'')};if(_0x172d71[_0x652f('0x5d')]['threadId']&&_0x172d71[_0x652f('0x5d')]['messageId']&&_0x172d71['body'][_0x652f('0x8b')]!=_0x172d71['body'][_0x652f('0x91')]){_0x31e4d5[_0x652f('0x8b')]=_0x172d71[_0x652f('0x5d')][_0x652f('0x91')];}return _0x11b0cd['update'](_0x31e4d5);}else{return _0x11b0cd;}}})[_0x652f('0x23')](function(_0x2dfeba){_0x201df1[_0x652f('0x92')]=_0x2dfeba[_0x652f('0x37')]({'plain':!![]});_0x201df1[_0x652f('0x92')][_0x652f('0x93')]=_0x5ae74a;if(_0x201df1[_0x652f('0x92')]['created']){if(_0x201df1[_0x652f('0x86')]['autoclose']){_0x201df1[_0x652f('0x83')][_0x652f('0x94')]({'id':0x0,'priority':_0x201df1['applications'][_0x652f('0x5a')]+0x1,'app':_0x652f('0x95'),'appdata':_0x652f('0x96'),'interval':_0x652f('0x97')});}}return db['OpenchannelMessage']['create']({'body':_0x172d71[_0x652f('0x5d')][_0x652f('0x5d')],'OpenchannelAccountId':_0x172d71[_0x652f('0x56')]['id'],'OpenchannelInteractionId':_0x2dfeba['id'],'direction':'in','ContactId':_0x201df1[_0x652f('0x90')]['id'],'AttachmentId':_0x172d71[_0x652f('0x5d')][_0x652f('0x98')]});})['then'](function(_0x2cd928){_0x201df1[_0x652f('0x29')]=_0x2cd928;if(_0x201df1[_0x652f('0x92')][_0x652f('0x99')]){return db[_0x652f('0x9a')][_0x652f('0x65')]({'attributes':['id',_0x652f('0x3b')],'where':{'id':_0x201df1[_0x652f('0x92')][_0x652f('0x99')]}})[_0x652f('0x23')](function(_0x372cbd){if(_0x372cbd){_0x201df1['applications'][_0x652f('0x9b')]({'id':0x0,'priority':0x0,'app':_0x652f('0x9c'),'appdata':_0x372cbd[_0x652f('0x3b')]+','+(_0x201df1['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x201df1[_0x652f('0x9d')]=![];}return respondWithRpcPromise(_0x652f('0x9e'),_0x652f('0x9f'),_0x201df1);});}return respondWithRpcPromise(_0x652f('0x9e'),_0x652f('0x9f'),_0x201df1);})[_0x652f('0x23')](function(_0x3c548f){respondWithRpcPromise(_0x652f('0xa0'),'EventManager',{'event':_0x652f('0xa1'),'message':_0x3c548f},client9002);return _0x3c548f;})[_0x652f('0x23')](respondWithResult(_0x398bbc,null))[_0x652f('0x2a')](handleError(_0x398bbc,null));};exports[_0x652f('0xa2')]=function(_0x6e3f51,_0x20fb1d,_0x4a3b3e){return db['OpenchannelAccount'][_0x652f('0x6a')]({'where':{'id':_0x6e3f51['params']['id']}})[_0x652f('0x23')](handleEntityNotFound(_0x20fb1d,null))[_0x652f('0x23')](function(_0x45e60c){if(_0x45e60c){return db[_0x652f('0xa3')][_0x652f('0xa4')](function(_0x531edd){return db[_0x652f('0xa5')][_0x652f('0x38')]({'where':{'OpenchannelAccountId':_0x6e3f51[_0x652f('0x56')]['id']},'transaction':_0x531edd})[_0x652f('0x23')](function(_0x1e9613){var _0x1bb43d=_[_0x652f('0x3d')](_0x6e3f51[_0x652f('0x5d')],function(_0x5d7eff){_0x5d7eff[_0x652f('0x6b')]=_0x6e3f51['params']['id'];return _0x5d7eff;});return db[_0x652f('0xa5')][_0x652f('0xa6')](_0x1bb43d,{'transaction':_0x531edd});});})['then'](function(){return db[_0x652f('0xa5')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x6e3f51['params']['id']},'order':_0x652f('0x85')});});}})[_0x652f('0x23')](respondWithResult(_0x20fb1d,null))[_0x652f('0x2a')](handleError(_0x20fb1d,null));};exports[_0x652f('0xa7')]=function(_0x57159b,_0x1c0231,_0x47208f){var _0x17597c={};var _0x39312f={};var _0x2ed5b8;var _0x489348;return db[_0x652f('0x50')]['findOne']({'where':{'id':_0x57159b[_0x652f('0x56')]['id']}})[_0x652f('0x23')](handleEntityNotFound(_0x1c0231,null))[_0x652f('0x23')](function(_0x9921b5){if(_0x9921b5){_0x2ed5b8=_0x9921b5;_0x39312f['model']=_[_0x652f('0x59')](db['OpenchannelApplication'][_0x652f('0x3e')]);_0x39312f[_0x652f('0x42')]=_[_0x652f('0x59')](_0x57159b['query']);_0x39312f['filters']=_[_0x652f('0x44')](_0x39312f[_0x652f('0x41')],_0x39312f['query']);_0x17597c['attributes']=_['intersection'](_0x39312f['model'],qs[_0x652f('0x45')](_0x57159b[_0x652f('0x42')][_0x652f('0x45')]));_0x17597c[_0x652f('0x43')]=_0x17597c[_0x652f('0x43')]['length']?_0x17597c[_0x652f('0x43')]:_0x39312f[_0x652f('0x41')];_0x17597c['order']=qs[_0x652f('0x49')](_0x57159b[_0x652f('0x42')]['sort']);_0x17597c[_0x652f('0x4d')]=qs['filters'](_['pick'](_0x57159b[_0x652f('0x42')],_0x39312f[_0x652f('0x4a')]));if(_0x57159b[_0x652f('0x42')][_0x652f('0x4c')]){_0x17597c['where']=_[_0x652f('0x4e')](_0x17597c['where'],{'$or':_['map'](_0x17597c[_0x652f('0x43')],function(_0x1c6aa9){var _0x3f0a27={};_0x3f0a27[_0x1c6aa9]={'$like':'%'+_0x57159b[_0x652f('0x42')][_0x652f('0x4c')]+'%'};return _0x3f0a27;})});}_0x17597c=_['merge']({},_0x17597c,_0x57159b[_0x652f('0x5b')]);return _0x2ed5b8[_0x652f('0xa7')](_0x17597c);}})['then'](function(_0x5d26b1){if(_0x5d26b1){_0x489348=_0x5d26b1[_0x652f('0x5a')];if(!_0x57159b['query'][_0x652f('0x46')](_0x652f('0x47'))){_0x17597c['limit']=qs[_0x652f('0x30')](_0x57159b[_0x652f('0x42')][_0x652f('0x30')]);_0x17597c[_0x652f('0x2f')]=qs[_0x652f('0x2f')](_0x57159b[_0x652f('0x42')][_0x652f('0x2f')]);}return _0x2ed5b8['getApplications'](_0x17597c);}})[_0x652f('0x23')](function(_0x50b56c){if(_0x50b56c){return _0x50b56c?{'count':_0x489348,'rows':_0x50b56c}:null;}})[_0x652f('0x23')](respondWithResult(_0x1c0231,null))[_0x652f('0x2a')](handleError(_0x1c0231,null));};exports[_0x652f('0xa8')]=function(_0x15fd7d,_0x506005,_0x10b6a2){var _0x3d016={'raw':![],'where':{}};var _0x88a4f9={};var _0x976a92={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x15fd7d[_0x652f('0x56')]['id']}})[_0x652f('0x23')](handleEntityNotFound(_0x506005,null))[_0x652f('0x23')](function(_0x3bf14c){if(_0x3bf14c){_0x88a4f9['model']=_['keys'](db[_0x652f('0x8c')][_0x652f('0x3e')]);_0x88a4f9['query']=_[_0x652f('0x59')](_0x15fd7d[_0x652f('0x42')]);_0x88a4f9[_0x652f('0x4a')]=_[_0x652f('0x44')](_0x88a4f9[_0x652f('0x41')],_0x88a4f9['query']);_0x3d016[_0x652f('0x43')]=_['intersection'](_0x88a4f9[_0x652f('0x41')],qs[_0x652f('0x45')](_0x15fd7d[_0x652f('0x42')]['fields']));_0x3d016[_0x652f('0x43')]=_0x3d016[_0x652f('0x43')][_0x652f('0x5a')]?_0x3d016['attributes']:_0x88a4f9[_0x652f('0x41')];if(!_0x15fd7d[_0x652f('0x42')][_0x652f('0x46')]('nolimit')){_0x3d016[_0x652f('0x30')]=qs[_0x652f('0x30')](_0x15fd7d[_0x652f('0x42')]['limit']);_0x3d016['offset']=qs[_0x652f('0x2f')](_0x15fd7d[_0x652f('0x42')][_0x652f('0x2f')]);}_0x3d016[_0x652f('0x48')]=qs[_0x652f('0x49')](_0x15fd7d['query'][_0x652f('0x49')]);_0x3d016[_0x652f('0x4d')]=qs[_0x652f('0x4a')](_[_0x652f('0x4b')](_0x15fd7d[_0x652f('0x42')],_0x88a4f9[_0x652f('0x4a')]));_0x3d016[_0x652f('0x4d')]['OpenchannelAccountId']=_0x3bf14c['id'];if(_0x15fd7d['query'][_0x652f('0x4c')]){_0x3d016['where']=_['merge'](_0x3d016[_0x652f('0x4d')],{'$or':_['map'](_0x3d016[_0x652f('0x43')],function(_0x525c03){var _0x22e963={};_0x22e963[_0x525c03]={'$like':'%'+_0x15fd7d['query']['filter']+'%'};return _0x22e963;})});}_0x3d016=_[_0x652f('0x4e')]({},_0x3d016,_0x15fd7d['options']);return db[_0x652f('0x8c')]['count']({'where':_0x3d016[_0x652f('0x4d')]})[_0x652f('0x23')](function(_0x386c43){_0x976a92[_0x652f('0x2e')]=_0x386c43;if(_0x15fd7d['query'][_0x652f('0x51')]){_0x3d016[_0x652f('0x52')]=[{'model':db[_0x652f('0x72')],'as':_0x652f('0xa9'),'required':![]},{'model':db[_0x652f('0x9a')],'as':_0x652f('0xaa'),'attributes':['name',_0x652f('0xab'),_0x652f('0xac')],'required':![]},{'model':db[_0x652f('0xad')],'as':'Tags','attributes':['id',_0x652f('0x3b'),'color'],'where':_0x15fd7d[_0x652f('0x42')][_0x652f('0xae')]?{'id':_0x15fd7d['query'][_0x652f('0xae')]}:undefined,'required':_0x15fd7d[_0x652f('0x42')][_0x652f('0xae')]?!![]:![]}];}return db[_0x652f('0x8c')][_0x652f('0x53')](_0x3d016);})[_0x652f('0x23')](function(_0x119a0e){_0x976a92[_0x652f('0x54')]=_0x119a0e;return _0x976a92;});}})['then'](respondWithFilteredResult(_0x506005,_0x3d016))[_0x652f('0x2a')](handleError(_0x506005,null));};exports['addAgents']=function(_0x31a41a,_0x4b238e,_0x4d95a2){return db[_0x652f('0x50')][_0x652f('0x65')]({'where':{'id':_0x31a41a['params']['id']}})[_0x652f('0x23')](handleEntityNotFound(_0x4b238e,null))[_0x652f('0x23')](function(_0xe290d4){if(_0xe290d4){return _0xe290d4[_0x652f('0xaf')](_0x31a41a[_0x652f('0x5d')][_0x652f('0x6d')],_[_0x652f('0xb0')](_0x31a41a[_0x652f('0x5d')],[_0x652f('0x6d'),'id'])||{})[_0x652f('0x8f')](function(_0x7a4c83){for(var _0x58e219=0x0;_0x58e219<_0x31a41a[_0x652f('0x5d')][_0x652f('0x6d')]['length'];_0x58e219+=0x1){socket[_0x652f('0xb1')]('userOpenchannelAccount:save',{'UserId':_0x31a41a[_0x652f('0x5d')]['ids'][_0x58e219],'OpenchannelAccountId':_0x31a41a[_0x652f('0x56')]['id']});}return _0x7a4c83;});}})[_0x652f('0x23')](respondWithResult(_0x4b238e,null))[_0x652f('0x2a')](handleError(_0x4b238e,null));};exports['removeAgents']=function(_0x5a49f8,_0x2c0086,_0x38bac6){return db[_0x652f('0x50')]['find']({'where':{'id':_0x5a49f8['params']['id']}})['then'](handleEntityNotFound(_0x2c0086,null))['then'](function(_0x3e2815){if(_0x3e2815){return _0x3e2815[_0x652f('0xb2')](_0x5a49f8[_0x652f('0x42')][_0x652f('0x6d')])[_0x652f('0x23')](function(){if(_[_0x652f('0xb3')](_0x5a49f8[_0x652f('0x42')][_0x652f('0x6d')])){for(var _0xc89381=0x0;_0xc89381<_0x5a49f8[_0x652f('0x42')][_0x652f('0x6d')][_0x652f('0x5a')];_0xc89381+=0x1){socket[_0x652f('0xb1')](_0x652f('0xb4'),{'UserId':Number(_0x5a49f8['query'][_0x652f('0x6d')][_0xc89381]),'OpenchannelAccountId':Number(_0x5a49f8[_0x652f('0x56')]['id'])});}}else{socket[_0x652f('0xb1')]('userOpenchannelAccount:remove',{'UserId':Number(_0x5a49f8[_0x652f('0x42')][_0x652f('0x6d')]),'OpenchannelAccountId':Number(_0x5a49f8[_0x652f('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c0086,null))['catch'](handleError(_0x2c0086,null));};exports['getAgents']=function(_0x2e1c6d,_0x29beb5,_0x2c6f65){var _0x50f8ba={};var _0x90dd40={};var _0x1c5dc2;var _0x3e6177;return db['OpenchannelAccount'][_0x652f('0x6a')]({'where':{'id':_0x2e1c6d[_0x652f('0x56')]['id']}})[_0x652f('0x23')](handleEntityNotFound(_0x29beb5,null))['then'](function(_0x3e5fb6){if(_0x3e5fb6){_0x1c5dc2=_0x3e5fb6;_0x90dd40[_0x652f('0x41')]=_[_0x652f('0x59')](db[_0x652f('0x9a')]['rawAttributes']);_0x90dd40[_0x652f('0x42')]=_[_0x652f('0x59')](_0x2e1c6d[_0x652f('0x42')]);_0x90dd40['filters']=_[_0x652f('0x44')](_0x90dd40[_0x652f('0x41')],_0x90dd40['query']);_0x50f8ba[_0x652f('0x43')]=_[_0x652f('0x44')](_0x90dd40['model'],qs['fields'](_0x2e1c6d[_0x652f('0x42')]['fields']));_0x50f8ba[_0x652f('0x43')]=_0x50f8ba[_0x652f('0x43')][_0x652f('0x5a')]?_0x50f8ba['attributes']:_0x90dd40[_0x652f('0x41')];_0x50f8ba['order']=qs['sort'](_0x2e1c6d['query'][_0x652f('0x49')]);_0x50f8ba[_0x652f('0x4d')]=qs[_0x652f('0x4a')](_['pick'](_0x2e1c6d[_0x652f('0x42')],_0x90dd40[_0x652f('0x4a')]));if(_0x2e1c6d[_0x652f('0x42')][_0x652f('0x4c')]){_0x50f8ba['where']=_[_0x652f('0x4e')](_0x50f8ba[_0x652f('0x4d')],{'$or':_['map'](_0x50f8ba[_0x652f('0x43')],function(_0x3c1439){var _0x2c6465={};_0x2c6465[_0x3c1439]={'$like':'%'+_0x2e1c6d[_0x652f('0x42')][_0x652f('0x4c')]+'%'};return _0x2c6465;})});}_0x50f8ba=_[_0x652f('0x4e')]({},_0x50f8ba,_0x2e1c6d['options']);return _0x1c5dc2[_0x652f('0xb5')](_0x50f8ba);}})[_0x652f('0x23')](function(_0x507815){if(_0x507815){_0x3e6177=_0x507815[_0x652f('0x5a')];if(!_0x2e1c6d[_0x652f('0x42')]['hasOwnProperty'](_0x652f('0x47'))){_0x50f8ba[_0x652f('0x30')]=qs[_0x652f('0x30')](_0x2e1c6d['query'][_0x652f('0x30')]);_0x50f8ba[_0x652f('0x2f')]=qs[_0x652f('0x2f')](_0x2e1c6d['query'][_0x652f('0x2f')]);}return _0x1c5dc2[_0x652f('0xb5')](_0x50f8ba);}})[_0x652f('0x23')](function(_0x33fcd0){if(_0x33fcd0){return _0x33fcd0?{'count':_0x3e6177,'rows':_0x33fcd0}:null;}})['then'](respondWithResult(_0x29beb5,null))['catch'](handleError(_0x29beb5,null));};exports[_0x652f('0x3c')]=function(_0xe44549,_0x225cf2,_0x384917){var _0x2c3146,_0x10073c,_0x55329f;if(_[_0x652f('0x79')](_0xe44549[_0x652f('0x5d')][_0x652f('0x5d')])||_0xe44549[_0x652f('0x5d')][_0x652f('0x5d')]===''){throw new db[(_0x652f('0x20'))][(_0x652f('0x73'))](_0x652f('0x7a'));}if(_['isNil'](_0xe44549[_0x652f('0x5d')]['to'])){}_0x2c3146=_0xe44549['body']['to'];return db['OpenchannelAccount'][_0x652f('0x6a')]({'where':{'id':_0xe44549[_0x652f('0x56')]['id']}})[_0x652f('0x23')](handleEntityNotFound(_0x225cf2,null))[_0x652f('0x23')](function(_0x5e370e){if(_0x5e370e){return db[_0x652f('0x50')][_0x652f('0x65')]({'where':{'id':_0x5e370e['id']},'include':[{'model':db[_0x652f('0x7f')],'as':'List','include':[{'model':db[_0x652f('0x72')],'as':_0x652f('0x87'),'where':{[_0x5e370e[_0x652f('0x7b')]]:_0x2c3146},'limit':0x1,'order':[['updatedAt',_0x652f('0x81')]]}]}]})[_0x652f('0x23')](handleEntityNotFound(_0x225cf2,null))[_0x652f('0x23')](function(_0x490176){if(_0x490176&&_0x490176[_0x652f('0x80')]){_0x10073c=_0x490176[_0x652f('0x37')]({'plain':!![]});if(_0x10073c[_0x652f('0x80')]&&_0x10073c['List'][_0x652f('0x87')]['length']){return _0x10073c[_0x652f('0x80')]['Contacts'][0x0];}return db[_0x652f('0x72')][_0x652f('0x5c')](_[_0x652f('0x88')](_0xe44549[_0x652f('0x5d')],{'firstName':_0x2c3146,[_0x490176[_0x652f('0x7b')]]:_0x2c3146,'phone':_0x2c3146,'ListId':_0x10073c['ListId']}));}})[_0x652f('0x23')](handleEntityNotFound(_0x225cf2,null))[_0x652f('0x23')](function(_0x16fe42){if(_0x16fe42){_0x55329f=_0x16fe42;return db[_0x652f('0x8c')]['find']({'where':{'ContactId':_0x55329f['id'],'closed':![],'OpenchannelAccountId':_0x10073c['id']}})['then'](function(_0x3975cc){if(_0x3975cc){return[_0x3975cc,![]];}return db[_0x652f('0x8c')][_0x652f('0x5c')]({'UserId':_0xe44549['user']['id'],'ContactId':_0x55329f['id'],'OpenchannelAccountId':_0x10073c['id'],'lastMsgDirection':_0x652f('0xb6'),'Messages':[_[_0x652f('0x4e')](_0xe44549[_0x652f('0x5d')],{'read':![],'body':_0xe44549['body'][_0x652f('0x5d')],'OpenchannelAccountId':_0x10073c['id'],'UserId':_0xe44549[_0x652f('0x5e')]['id'],'ContactId':_0x55329f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x652f('0xb7')}]})['then'](function(_0x231def){return[_0x231def,!![]];});});}})[_0x652f('0x8f')](function(_0x19be3d,_0x4fd204){if(_0x4fd204){return _0x19be3d;}return db['OpenchannelMessage'][_0x652f('0x5c')](_['merge'](_0xe44549[_0x652f('0x5d')],{'read':![],'body':_0xe44549['body'][_0x652f('0x5d')],'OpenchannelAccountId':_0x10073c['id'],'OpenchannelInteractionId':_0x19be3d['id'],'UserId':_0xe44549[_0x652f('0x5e')]['id'],'ContactId':_0x55329f['id']}))['then'](function(_0x19ffd4){_0x19be3d[_0x652f('0xb8')]['Messages']=[];_0x19be3d['dataValues'][_0x652f('0xb7')][_0x652f('0x94')](_0x19ffd4[_0x652f('0xb8')]);return _0x19be3d;});});}})[_0x652f('0x23')](respondWithResult(_0x225cf2,null))[_0x652f('0x2a')](handleError(_0x225cf2,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 3fe67ba..963ef28 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 _0xd38e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x8f9d63,_0x39df6f){var _0x43259e=function(_0x565df8){while(--_0x565df8){_0x8f9d63['push'](_0x8f9d63['shift']());}};_0x43259e(++_0x39df6f);}(_0xd38e,0x11e));var _0xed38=function(_0x34d00e,_0x3797b0){_0x34d00e=_0x34d00e-0x0;var _0xa822b2=_0xd38e[_0x34d00e];return _0xa822b2;};'use strict';var EventEmitter=require(_0xed38('0x0'));var OpenchannelAccount=require(_0xed38('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xed38('0x2')](0x0);var events={'afterCreate':_0xed38('0x3'),'afterUpdate':_0xed38('0x4'),'afterDestroy':_0xed38('0x5')};function emitEvent(_0x57aef9){return function(_0x530722,_0x7b90fb,_0x229ec1){OpenchannelAccountEvents['emit'](_0x57aef9+':'+_0x530722['id'],_0x530722);OpenchannelAccountEvents[_0xed38('0x6')](_0x57aef9,_0x530722);_0x229ec1(null);};}for(var e in events){if(events[_0xed38('0x7')](e)){var event=events[e];OpenchannelAccount[_0xed38('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x6ce0=['events','save','update','remove','emit','exports'];(function(_0x35700c,_0x3d37ff){var _0x17199c=function(_0x1be5a2){while(--_0x1be5a2){_0x35700c['push'](_0x35700c['shift']());}};_0x17199c(++_0x3d37ff);}(_0x6ce0,0x11a));var _0x06ce=function(_0x12bc0d,_0x1e40ca){_0x12bc0d=_0x12bc0d-0x0;var _0x18cf40=_0x6ce0[_0x12bc0d];return _0x18cf40;};'use strict';var EventEmitter=require(_0x06ce('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x06ce('0x1'),'afterUpdate':_0x06ce('0x2'),'afterDestroy':_0x06ce('0x3')};function emitEvent(_0x114feb){return function(_0x4bbeef,_0x499fc6,_0x14e123){OpenchannelAccountEvents[_0x06ce('0x4')](_0x114feb+':'+_0x4bbeef['id'],_0x4bbeef);OpenchannelAccountEvents[_0x06ce('0x4')](_0x114feb,_0x4bbeef);_0x14e123(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x06ce('0x5')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 9f7fa9c..129d5a4 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 _0x3baf=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3baf,0x1e9));var _0xf3ba=function(_0x39d9d7,_0xb6691){_0x39d9d7=_0x39d9d7-0x0;var _0x3b1c1d=_0x3baf[_0x39d9d7];return _0x3b1c1d;};'use strict';var _=require(_0xf3ba('0x0'));var util=require('util');var logger=require(_0xf3ba('0x1'))(_0xf3ba('0x2'));var moment=require(_0xf3ba('0x3'));var BPromise=require(_0xf3ba('0x4'));var rp=require(_0xf3ba('0x5'));var fs=require('fs');var path=require(_0xf3ba('0x6'));var rimraf=require(_0xf3ba('0x7'));var config=require(_0xf3ba('0x8'));var attributes=require(_0xf3ba('0x9'));module[_0xf3ba('0xa')]=function(_0x1c1fc3,_0x9f946e){return _0x1c1fc3[_0xf3ba('0xb')](_0xf3ba('0xc'),attributes,{'tableName':_0xf3ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d47=['define','OpenchannelAccount','openchannel_accounts','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./openchannelAccount.attributes','exports'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x5d47,0x10b));var _0x75d4=function(_0x21d96f,_0x361373){_0x21d96f=_0x21d96f-0x0;var _0x53e23f=_0x5d47[_0x21d96f];return _0x53e23f;};'use strict';var _=require(_0x75d4('0x0'));var util=require('util');var logger=require(_0x75d4('0x1'))('api');var moment=require(_0x75d4('0x2'));var BPromise=require(_0x75d4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75d4('0x4'));var rimraf=require('rimraf');var config=require(_0x75d4('0x5'));var attributes=require(_0x75d4('0x6'));module[_0x75d4('0x7')]=function(_0x1512da,_0x339f36){return _0x1512da[_0x75d4('0x8')](_0x75d4('0x9'),attributes,{'tableName':_0x75d4('0xa'),'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 c5c635e..3a21acc 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 _0x627f=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0x229252,_0x46b6b9){var _0x315e84=function(_0x5c1eda){while(--_0x5c1eda){_0x229252['push'](_0x229252['shift']());}};_0x315e84(++_0x46b6b9);}(_0x627f,0x15d));var _0xf627=function(_0x2fea68,_0x31caf5){_0x2fea68=_0x2fea68-0x0;var _0x4576e4=_0x627f[_0x2fea68];return _0x4576e4;};'use strict';var _=require('lodash');var util=require(_0xf627('0x0'));var moment=require('moment');var BPromise=require(_0xf627('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf627('0x2'));var db=require(_0xf627('0x3'))['db'];var utils=require(_0xf627('0x4'));var logger=require(_0xf627('0x5'))('rpc');var config=require(_0xf627('0x6'));var jayson=require(_0xf627('0x7'));var client=jayson['client'][_0xf627('0x8')]({'port':0x232a});config[_0xf627('0x9')]=_[_0xf627('0xa')](config[_0xf627('0x9')],{'host':_0xf627('0xb'),'port':0x18eb});var socket=require(_0xf627('0xc'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xf627('0xd')](socket);function respondWithRpcPromise(_0xa5c716,_0x1de4a1,_0x30c78f){return new BPromise(function(_0xb5e54e,_0x2dcdff){return client['request'](_0xa5c716,_0x30c78f)[_0xf627('0xe')](function(_0x4e1e45){logger[_0xf627('0xf')](_0xf627('0x10'),_0x1de4a1,_0xf627('0x11'));logger[_0xf627('0x12')](_0xf627('0x13'),_0x1de4a1,_0xf627('0x11'),JSON[_0xf627('0x14')](_0x4e1e45));if(_0x4e1e45[_0xf627('0x15')]){if(_0x4e1e45[_0xf627('0x15')]['code']===0x1f4){logger[_0xf627('0x15')](_0xf627('0x10'),_0x1de4a1,_0x4e1e45[_0xf627('0x15')][_0xf627('0x16')]);return _0x2dcdff(_0x4e1e45['error'][_0xf627('0x16')]);}logger[_0xf627('0x15')](_0xf627('0x10'),_0x1de4a1,_0x4e1e45[_0xf627('0x15')][_0xf627('0x16')]);return _0xb5e54e(_0x4e1e45[_0xf627('0x15')][_0xf627('0x16')]);}else{logger[_0xf627('0xf')](_0xf627('0x10'),_0x1de4a1,_0xf627('0x11'));_0xb5e54e(_0x4e1e45[_0xf627('0x17')][_0xf627('0x16')]);}})[_0xf627('0x18')](function(_0x24b6c7){logger[_0xf627('0x15')](_0xf627('0x10'),_0x1de4a1,_0x24b6c7);_0x2dcdff(_0x24b6c7);});});} \ No newline at end of file +var _0x50fd=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','info'];(function(_0x20f22f,_0x12f7b2){var _0x4e15ab=function(_0x1851dd){while(--_0x1851dd){_0x20f22f['push'](_0x20f22f['shift']());}};_0x4e15ab(++_0x12f7b2);}(_0x50fd,0x8c));var _0xd50f=function(_0x4f6ca4,_0x3c49f9){_0x4f6ca4=_0x4f6ca4-0x0;var _0x2c5a6d=_0x50fd[_0x4f6ca4];return _0x2c5a6d;};'use strict';var _=require(_0xd50f('0x0'));var util=require('util');var moment=require(_0xd50f('0x1'));var BPromise=require('bluebird');var rs=require(_0xd50f('0x2'));var fs=require('fs');var Redis=require(_0xd50f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd50f('0x4'));var logger=require(_0xd50f('0x5'))(_0xd50f('0x6'));var config=require(_0xd50f('0x7'));var jayson=require(_0xd50f('0x8'));var client=jayson[_0xd50f('0x9')]['http']({'port':0x232a});config[_0xd50f('0xa')]=_['defaults'](config[_0xd50f('0xa')],{'host':_0xd50f('0xb'),'port':0x18eb});var socket=require(_0xd50f('0xc'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xd50f('0xd')](socket);function respondWithRpcPromise(_0x197384,_0x44e56f,_0x2b45e5){return new BPromise(function(_0x267054,_0x202eaa){return client[_0xd50f('0xe')](_0x197384,_0x2b45e5)['then'](function(_0x9e9938){logger[_0xd50f('0xf')](_0xd50f('0x10'),_0x44e56f,_0xd50f('0x11'));logger[_0xd50f('0x12')](_0xd50f('0x13'),_0x44e56f,_0xd50f('0x11'),JSON[_0xd50f('0x14')](_0x9e9938));if(_0x9e9938[_0xd50f('0x15')]){if(_0x9e9938['error'][_0xd50f('0x16')]===0x1f4){logger['error'](_0xd50f('0x10'),_0x44e56f,_0x9e9938[_0xd50f('0x15')]['message']);return _0x202eaa(_0x9e9938[_0xd50f('0x15')]['message']);}logger[_0xd50f('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x44e56f,_0x9e9938['error']['message']);return _0x267054(_0x9e9938[_0xd50f('0x15')][_0xd50f('0x17')]);}else{logger['info'](_0xd50f('0x10'),_0x44e56f,_0xd50f('0x11'));_0x267054(_0x9e9938[_0xd50f('0x18')][_0xd50f('0x17')]);}})[_0xd50f('0x19')](function(_0x50cf05){logger[_0xd50f('0x15')](_0xd50f('0x10'),_0x44e56f,_0x50cf05);_0x202eaa(_0x50cf05);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5061afa..81059a9 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 _0x06f8=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update','register'];(function(_0x13b1e5,_0xddd116){var _0x324bce=function(_0x5a49bb){while(--_0x5a49bb){_0x13b1e5['push'](_0x13b1e5['shift']());}};_0x324bce(++_0xddd116);}(_0x06f8,0x167));var _0x806f=function(_0x478b7c,_0x53c050){_0x478b7c=_0x478b7c-0x0;var _0xd93212=_0x06f8[_0x478b7c];return _0xd93212;};'use strict';var OpenchannelAccountEvents=require(_0x806f('0x0'));var events=[_0x806f('0x1'),_0x806f('0x2'),_0x806f('0x3')];function createListener(_0x6c9638,_0x154af4){return function(_0x3bf056){_0x154af4['emit'](_0x6c9638,_0x3bf056);};}function removeListener(_0x128c00,_0x4ff7fa){return function(){OpenchannelAccountEvents['removeListener'](_0x128c00,_0x4ff7fa);};}exports[_0x806f('0x4')]=function(_0x509360){for(var _0xecbe98=0x0,_0x2ad205=events[_0x806f('0x5')];_0xecbe98<_0x2ad205;_0xecbe98++){var _0x34f262=events[_0xecbe98];var _0x194684=createListener(_0x806f('0x6')+_0x34f262,_0x509360);OpenchannelAccountEvents['on'](_0x34f262,_0x194684);}}; \ No newline at end of file +var _0x08d7=['./openchannelAccount.events','save','update','emit','removeListener','length','openchannelAccount:'];(function(_0x4e8601,_0x209e83){var _0x2e3773=function(_0x2e3925){while(--_0x2e3925){_0x4e8601['push'](_0x4e8601['shift']());}};_0x2e3773(++_0x209e83);}(_0x08d7,0x188));var _0x708d=function(_0x386078,_0x49ad4f){_0x386078=_0x386078-0x0;var _0xd6675c=_0x08d7[_0x386078];return _0xd6675c;};'use strict';var OpenchannelAccountEvents=require(_0x708d('0x0'));var events=[_0x708d('0x1'),'remove',_0x708d('0x2')];function createListener(_0x5ee643,_0x4f88c6){return function(_0x5f2e11){_0x4f88c6[_0x708d('0x3')](_0x5ee643,_0x5f2e11);};}function removeListener(_0x5884a1,_0x498301){return function(){OpenchannelAccountEvents[_0x708d('0x4')](_0x5884a1,_0x498301);};}exports['register']=function(_0x3766cb){for(var _0x291646=0x0,_0x43da87=events[_0x708d('0x5')];_0x291646<_0x43da87;_0x291646++){var _0x5ad6d3=events[_0x291646];var _0x1b28e5=createListener(_0x708d('0x6')+_0x5ad6d3,_0x3766cb);OpenchannelAccountEvents['on'](_0x5ad6d3,_0x1b28e5);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index a3659f4..3deab5b 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 _0xba7c=['./openchannelApplication.controller','get','isAuthenticated','/:id','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x18d1be,_0x5ec389){var _0x526abf=function(_0x122902){while(--_0x122902){_0x18d1be['push'](_0x18d1be['shift']());}};_0x526abf(++_0x5ec389);}(_0xba7c,0x1d4));var _0xcba7=function(_0x369d7e,_0x4c28ed){_0x369d7e=_0x369d7e-0x0;var _0x1a0185=_0xba7c[_0x369d7e];return _0x1a0185;};'use strict';var multer=require(_0xcba7('0x0'));var util=require(_0xcba7('0x1'));var path=require(_0xcba7('0x2'));var timeout=require(_0xcba7('0x3'));var express=require('express');var router=express[_0xcba7('0x4')]();var auth=require(_0xcba7('0x5'));var interaction=require(_0xcba7('0x6'));var config=require(_0xcba7('0x7'));var controller=require(_0xcba7('0x8'));router[_0xcba7('0x9')]('/',auth[_0xcba7('0xa')](),controller['index']);router[_0xcba7('0x9')](_0xcba7('0xb'),auth[_0xcba7('0xa')](),controller['show']);router[_0xcba7('0xc')]('/',auth[_0xcba7('0xa')](),controller['create']);router[_0xcba7('0xd')](_0xcba7('0xb'),auth[_0xcba7('0xa')](),controller[_0xcba7('0xe')]);router['delete'](_0xcba7('0xb'),auth[_0xcba7('0xa')](),controller[_0xcba7('0xf')]);module[_0xcba7('0x10')]=router; \ No newline at end of file +var _0x38ce=['../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4dddcc,_0x5dae19){var _0x2e9da1=function(_0x141fc0){while(--_0x141fc0){_0x4dddcc['push'](_0x4dddcc['shift']());}};_0x2e9da1(++_0x5dae19);}(_0x38ce,0x14f));var _0xe38c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x38ce[_0x580576];return _0x3f55a0;};'use strict';var multer=require(_0xe38c('0x0'));var util=require(_0xe38c('0x1'));var path=require('path');var timeout=require(_0xe38c('0x2'));var express=require(_0xe38c('0x3'));var router=express[_0xe38c('0x4')]();var auth=require(_0xe38c('0x5'));var interaction=require(_0xe38c('0x6'));var config=require(_0xe38c('0x7'));var controller=require(_0xe38c('0x8'));router[_0xe38c('0x9')]('/',auth[_0xe38c('0xa')](),controller[_0xe38c('0xb')]);router['get'](_0xe38c('0xc'),auth[_0xe38c('0xa')](),controller['show']);router['post']('/',auth[_0xe38c('0xa')](),controller[_0xe38c('0xd')]);router[_0xe38c('0xe')](_0xe38c('0xc'),auth[_0xe38c('0xa')](),controller[_0xe38c('0xf')]);router[_0xe38c('0x10')](_0xe38c('0xc'),auth[_0xe38c('0xa')](),controller[_0xe38c('0x11')]);module[_0xe38c('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index fccf241..d18ba8d 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 _0x004d=['STRING','noop','TEXT','exports'];(function(_0x18a68d,_0x16dba9){var _0x44e57b=function(_0x55a209){while(--_0x55a209){_0x18a68d['push'](_0x18a68d['shift']());}};_0x44e57b(++_0x16dba9);}(_0x004d,0x183));var _0xd004=function(_0x38506f,_0x234765){_0x38506f=_0x38506f-0x0;var _0x19251c=_0x004d[_0x38506f];return _0x19251c;};'use strict';var Sequelize=require('sequelize');module[_0xd004('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd004('0x1')],'allowNull':![],'defaultValue':_0xd004('0x2')},'appdata':{'type':Sequelize[_0xd004('0x3')]()},'description':{'type':Sequelize[_0xd004('0x1')]},'interval':{'type':Sequelize[_0xd004('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfafe=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfafe,0x1e3));var _0xefaf=function(_0x4c117d,_0xf11d85){_0x4c117d=_0x4c117d-0x0;var _0x1d1319=_0xfafe[_0x4c117d];return _0x1d1319;};'use strict';var Sequelize=require(_0xefaf('0x0'));module[_0xefaf('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xefaf('0x2')],'allowNull':![],'defaultValue':_0xefaf('0x3')},'appdata':{'type':Sequelize[_0xefaf('0x4')]()},'description':{'type':Sequelize[_0xefaf('0x2')]},'interval':{'type':Sequelize[_0xefaf('0x2')],'defaultValue':_0xefaf('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index dd1995c..2098ccb 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 _0x55d6=['util','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelApplication','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x55d6,0x8c));var _0x655d=function(_0x1f4549,_0x57782f){_0x1f4549=_0x1f4549-0x0;var _0x46d1b9=_0x55d6[_0x1f4549];return _0x46d1b9;};'use strict';var pdf=require(_0x655d('0x0'));var emlformat=require(_0x655d('0x1'));var rimraf=require(_0x655d('0x2'));var zipdir=require(_0x655d('0x3'));var jsonpatch=require(_0x655d('0x4'));var rp=require(_0x655d('0x5'));var moment=require(_0x655d('0x6'));var BPromise=require(_0x655d('0x7'));var Mustache=require('mustache');var util=require(_0x655d('0x8'));var path=require('path');var sox=require(_0x655d('0x9'));var csv=require(_0x655d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x655d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x655d('0xc'));var toCsv=require(_0x655d('0xa'));var querystring=require(_0x655d('0xd'));var Papa=require(_0x655d('0xe'));var Redis=require(_0x655d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x655d('0x10'));var hardwareService=require(_0x655d('0x11'));var logger=require('../../config/logger')(_0x655d('0x12'));var utils=require(_0x655d('0x13'));var config=require(_0x655d('0x14'));var db=require(_0x655d('0x15'))['db'];function respondWithStatusCode(_0x376269,_0x1754e3){_0x1754e3=_0x1754e3||0xcc;return function(_0x536b67){if(_0x536b67){return _0x376269[_0x655d('0x16')](_0x1754e3);}return _0x376269[_0x655d('0x17')](_0x1754e3)[_0x655d('0x18')]();};}function respondWithResult(_0x3b64e8,_0x54fec3){_0x54fec3=_0x54fec3||0xc8;return function(_0x3ccc34){if(_0x3ccc34){return _0x3b64e8[_0x655d('0x17')](_0x54fec3)[_0x655d('0x19')](_0x3ccc34);}};}function respondWithFilteredResult(_0x2d5342,_0x5536d3){return function(_0x153826){if(_0x153826){var _0x4f1db6=_0x153826['count'],_0x21c948=_0x5536d3['offset'],_0x40829a=_0x5536d3[_0x655d('0x1a')]+_0x5536d3[_0x655d('0x1b')],_0x4b3947;if(_0x40829a>=_0x4f1db6){_0x40829a=_0x4f1db6;_0x4b3947=0xc8;}else{_0x4b3947=0xce;}_0x2d5342[_0x655d('0x17')](_0x4b3947);return _0x2d5342['set'](_0x655d('0x1c'),_0x21c948+'-'+_0x40829a+'/'+_0x4f1db6)[_0x655d('0x19')](_0x153826);}return null;};}function patchUpdates(_0xf84093){return function(_0xec6bc0){try{jsonpatch[_0x655d('0x1d')](_0xec6bc0,_0xf84093,!![]);}catch(_0x5d4e04){return BPromise[_0x655d('0x1e')](_0x5d4e04);}return _0xec6bc0[_0x655d('0x1f')]();};}function saveUpdates(_0x1329cb,_0x139352){return function(_0x1acb8d){if(_0x1acb8d){return _0x1acb8d[_0x655d('0x20')](_0x1329cb)[_0x655d('0x21')](function(_0x34125a){return _0x34125a;});}return null;};}function removeEntity(_0x105967,_0x558d95){return function(_0x3646a9){if(_0x3646a9){return _0x3646a9[_0x655d('0x22')]()[_0x655d('0x21')](function(){_0x105967[_0x655d('0x17')](0xcc)[_0x655d('0x18')]();});}};}function handleEntityNotFound(_0x260801,_0xb73844){return function(_0x38d0f7){if(!_0x38d0f7){_0x260801[_0x655d('0x16')](0x194);}return _0x38d0f7;};}function handleError(_0x5c1e45,_0x54cf1c){_0x54cf1c=_0x54cf1c||0x1f4;return function(_0x5bd138){logger[_0x655d('0x23')](_0x5bd138[_0x655d('0x24')]);if(_0x5bd138[_0x655d('0x25')]){delete _0x5bd138[_0x655d('0x25')];}_0x5c1e45[_0x655d('0x17')](_0x54cf1c)[_0x655d('0x26')](_0x5bd138);};}exports[_0x655d('0x27')]=function(_0x268a38,_0x133dd4){var _0xb974a5={},_0x18ac22={},_0x5ef77d={'count':0x0,'rows':[]};var _0x39e45f=_['map'](db[_0x655d('0x28')]['rawAttributes'],function(_0x33b1f1){return{'name':_0x33b1f1[_0x655d('0x29')],'type':_0x33b1f1[_0x655d('0x2a')][_0x655d('0x2b')]};});_0x18ac22['model']=_[_0x655d('0x2c')](_0x39e45f,_0x655d('0x25'));_0x18ac22[_0x655d('0x2d')]=_[_0x655d('0x2e')](_0x268a38[_0x655d('0x2d')]);_0x18ac22[_0x655d('0x2f')]=_[_0x655d('0x30')](_0x18ac22[_0x655d('0x31')],_0x18ac22[_0x655d('0x2d')]);_0xb974a5['attributes']=_['intersection'](_0x18ac22[_0x655d('0x31')],qs['fields'](_0x268a38['query'][_0x655d('0x32')]));_0xb974a5[_0x655d('0x33')]=_0xb974a5[_0x655d('0x33')]['length']?_0xb974a5[_0x655d('0x33')]:_0x18ac22[_0x655d('0x31')];if(!_0x268a38['query']['hasOwnProperty'](_0x655d('0x34'))){_0xb974a5[_0x655d('0x1b')]=qs[_0x655d('0x1b')](_0x268a38[_0x655d('0x2d')][_0x655d('0x1b')]);_0xb974a5['offset']=qs[_0x655d('0x1a')](_0x268a38[_0x655d('0x2d')][_0x655d('0x1a')]);}_0xb974a5[_0x655d('0x35')]=qs[_0x655d('0x36')](_0x268a38[_0x655d('0x2d')][_0x655d('0x36')]);_0xb974a5[_0x655d('0x37')]=qs[_0x655d('0x2f')](_[_0x655d('0x38')](_0x268a38[_0x655d('0x2d')],_0x18ac22[_0x655d('0x2f')]),_0x39e45f);if(_0x268a38[_0x655d('0x2d')][_0x655d('0x39')]){_0xb974a5[_0x655d('0x37')]=_['merge'](_0xb974a5[_0x655d('0x37')],{'$or':_['map'](_0x39e45f,function(_0x46f116){if(_0x46f116[_0x655d('0x2a')]!==_0x655d('0x3a')){var _0xb263ef={};_0xb263ef[_0x46f116[_0x655d('0x25')]]={'$like':'%'+_0x268a38['query'][_0x655d('0x39')]+'%'};return _0xb263ef;}})});}_0xb974a5=_[_0x655d('0x3b')]({},_0xb974a5,_0x268a38[_0x655d('0x3c')]);var _0x53c106={'where':_0xb974a5[_0x655d('0x37')]};return db[_0x655d('0x28')][_0x655d('0x3d')](_0x53c106)['then'](function(_0x336d79){_0x5ef77d[_0x655d('0x3d')]=_0x336d79;if(_0x268a38[_0x655d('0x2d')][_0x655d('0x3e')]){_0xb974a5[_0x655d('0x3f')]=[{'all':!![]}];}return db[_0x655d('0x28')][_0x655d('0x40')](_0xb974a5);})[_0x655d('0x21')](function(_0x2ef722){_0x5ef77d[_0x655d('0x41')]=_0x2ef722;return _0x5ef77d;})[_0x655d('0x21')](respondWithFilteredResult(_0x133dd4,_0xb974a5))[_0x655d('0x42')](handleError(_0x133dd4,null));};exports[_0x655d('0x43')]=function(_0x2cd79b,_0xd392e3){var _0xc06fb2={'raw':!![],'where':{'id':_0x2cd79b[_0x655d('0x44')]['id']}},_0x3bbf8b={};_0x3bbf8b[_0x655d('0x31')]=_[_0x655d('0x2e')](db[_0x655d('0x28')][_0x655d('0x45')]);_0x3bbf8b[_0x655d('0x2d')]=_[_0x655d('0x2e')](_0x2cd79b[_0x655d('0x2d')]);_0x3bbf8b['filters']=_[_0x655d('0x30')](_0x3bbf8b[_0x655d('0x31')],_0x3bbf8b[_0x655d('0x2d')]);_0xc06fb2[_0x655d('0x33')]=_[_0x655d('0x30')](_0x3bbf8b['model'],qs['fields'](_0x2cd79b[_0x655d('0x2d')]['fields']));_0xc06fb2['attributes']=_0xc06fb2[_0x655d('0x33')][_0x655d('0x46')]?_0xc06fb2['attributes']:_0x3bbf8b[_0x655d('0x31')];if(_0x2cd79b[_0x655d('0x2d')]['includeAll']){_0xc06fb2['include']=[{'all':!![]}];}_0xc06fb2=_[_0x655d('0x3b')]({},_0xc06fb2,_0x2cd79b[_0x655d('0x3c')]);return db[_0x655d('0x28')][_0x655d('0x47')](_0xc06fb2)[_0x655d('0x21')](handleEntityNotFound(_0xd392e3,null))[_0x655d('0x21')](respondWithResult(_0xd392e3,null))[_0x655d('0x42')](handleError(_0xd392e3,null));};exports[_0x655d('0x48')]=function(_0x379c19,_0x6e0625){return db['OpenchannelApplication']['create'](_0x379c19[_0x655d('0x49')],{})[_0x655d('0x21')](respondWithResult(_0x6e0625,0xc9))['catch'](handleError(_0x6e0625,null));};exports['update']=function(_0x3596b8,_0x1c9256){if(_0x3596b8['body']['id']){delete _0x3596b8['body']['id'];}return db['OpenchannelApplication'][_0x655d('0x47')]({'where':{'id':_0x3596b8[_0x655d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c9256,null))[_0x655d('0x21')](saveUpdates(_0x3596b8[_0x655d('0x49')],null))[_0x655d('0x21')](respondWithResult(_0x1c9256,null))[_0x655d('0x42')](handleError(_0x1c9256,null));};exports[_0x655d('0x22')]=function(_0x162616,_0x2fdfed){return db['OpenchannelApplication'][_0x655d('0x47')]({'where':{'id':_0x162616[_0x655d('0x44')]['id']}})[_0x655d('0x21')](handleEntityNotFound(_0x2fdfed,null))[_0x655d('0x21')](removeEntity(_0x2fdfed,null))[_0x655d('0x42')](handleError(_0x2fdfed,null));}; \ No newline at end of file +var _0xdb74=['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','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelApplication','includeAll','include','findAll','rows','show','params','intersection','catch','create','body','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x404eb2,_0x165be2){var _0x3f04b8=function(_0x5c7fa){while(--_0x5c7fa){_0x404eb2['push'](_0x404eb2['shift']());}};_0x3f04b8(++_0x165be2);}(_0xdb74,0xe1));var _0x4db7=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xdb74[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4db7('0x0'));var zipdir=require(_0x4db7('0x1'));var jsonpatch=require(_0x4db7('0x2'));var rp=require('request-promise');var moment=require(_0x4db7('0x3'));var BPromise=require(_0x4db7('0x4'));var Mustache=require(_0x4db7('0x5'));var util=require(_0x4db7('0x6'));var path=require(_0x4db7('0x7'));var sox=require(_0x4db7('0x8'));var csv=require(_0x4db7('0x9'));var ejs=require(_0x4db7('0xa'));var fs=require('fs');var _=require(_0x4db7('0xb'));var squel=require(_0x4db7('0xc'));var crypto=require(_0x4db7('0xd'));var jsforce=require(_0x4db7('0xe'));var deskjs=require(_0x4db7('0xf'));var toCsv=require(_0x4db7('0x9'));var querystring=require(_0x4db7('0x10'));var Papa=require(_0x4db7('0x11'));var Redis=require(_0x4db7('0x12'));var authService=require(_0x4db7('0x13'));var qs=require(_0x4db7('0x14'));var as=require(_0x4db7('0x15'));var hardwareService=require(_0x4db7('0x16'));var logger=require(_0x4db7('0x17'))(_0x4db7('0x18'));var utils=require(_0x4db7('0x19'));var config=require('../../config/environment');var db=require(_0x4db7('0x1a'))['db'];function respondWithStatusCode(_0x179f07,_0x4922af){_0x4922af=_0x4922af||0xcc;return function(_0x10dd23){if(_0x10dd23){return _0x179f07['sendStatus'](_0x4922af);}return _0x179f07[_0x4db7('0x1b')](_0x4922af)[_0x4db7('0x1c')]();};}function respondWithResult(_0x4dbc03,_0x4f7176){_0x4f7176=_0x4f7176||0xc8;return function(_0x16c7d1){if(_0x16c7d1){return _0x4dbc03[_0x4db7('0x1b')](_0x4f7176)[_0x4db7('0x1d')](_0x16c7d1);}};}function respondWithFilteredResult(_0x45498d,_0x22a4f7){return function(_0x300796){if(_0x300796){var _0x5522b2=_0x300796[_0x4db7('0x1e')],_0x15300e=_0x22a4f7[_0x4db7('0x1f')],_0x55fda8=_0x22a4f7[_0x4db7('0x1f')]+_0x22a4f7[_0x4db7('0x20')],_0x38b566;if(_0x55fda8>=_0x5522b2){_0x55fda8=_0x5522b2;_0x38b566=0xc8;}else{_0x38b566=0xce;}_0x45498d[_0x4db7('0x1b')](_0x38b566);return _0x45498d[_0x4db7('0x21')](_0x4db7('0x22'),_0x15300e+'-'+_0x55fda8+'/'+_0x5522b2)[_0x4db7('0x1d')](_0x300796);}return null;};}function patchUpdates(_0x4d4c7d){return function(_0x5b88a){try{jsonpatch[_0x4db7('0x23')](_0x5b88a,_0x4d4c7d,!![]);}catch(_0x2c919f){return BPromise[_0x4db7('0x24')](_0x2c919f);}return _0x5b88a[_0x4db7('0x25')]();};}function saveUpdates(_0x4e694b,_0x5bdd71){return function(_0x126741){if(_0x126741){return _0x126741[_0x4db7('0x26')](_0x4e694b)[_0x4db7('0x27')](function(_0x179322){return _0x179322;});}return null;};}function removeEntity(_0x3b08b7,_0x3f2fe3){return function(_0x3fcdc6){if(_0x3fcdc6){return _0x3fcdc6[_0x4db7('0x28')]()[_0x4db7('0x27')](function(){_0x3b08b7[_0x4db7('0x1b')](0xcc)[_0x4db7('0x1c')]();});}};}function handleEntityNotFound(_0x344d04,_0x2eaab2){return function(_0x5c947f){if(!_0x5c947f){_0x344d04[_0x4db7('0x29')](0x194);}return _0x5c947f;};}function handleError(_0x3fa28a,_0x16bebc){_0x16bebc=_0x16bebc||0x1f4;return function(_0x506a9d){logger[_0x4db7('0x2a')](_0x506a9d[_0x4db7('0x2b')]);if(_0x506a9d[_0x4db7('0x2c')]){delete _0x506a9d[_0x4db7('0x2c')];}_0x3fa28a[_0x4db7('0x1b')](_0x16bebc)[_0x4db7('0x2d')](_0x506a9d);};}exports[_0x4db7('0x2e')]=function(_0x4b3b36,_0x51f090){var _0x449f57={},_0x3f9ec2={},_0xec6b99={'count':0x0,'rows':[]};var _0x53dc06=_[_0x4db7('0x2f')](db['OpenchannelApplication'][_0x4db7('0x30')],function(_0x5367a4){return{'name':_0x5367a4['fieldName'],'type':_0x5367a4[_0x4db7('0x31')][_0x4db7('0x32')]};});_0x3f9ec2[_0x4db7('0x33')]=_['map'](_0x53dc06,_0x4db7('0x2c'));_0x3f9ec2[_0x4db7('0x34')]=_[_0x4db7('0x35')](_0x4b3b36[_0x4db7('0x34')]);_0x3f9ec2[_0x4db7('0x36')]=_['intersection'](_0x3f9ec2[_0x4db7('0x33')],_0x3f9ec2['query']);_0x449f57['attributes']=_['intersection'](_0x3f9ec2[_0x4db7('0x33')],qs[_0x4db7('0x37')](_0x4b3b36[_0x4db7('0x34')][_0x4db7('0x37')]));_0x449f57[_0x4db7('0x38')]=_0x449f57['attributes'][_0x4db7('0x39')]?_0x449f57[_0x4db7('0x38')]:_0x3f9ec2[_0x4db7('0x33')];if(!_0x4b3b36[_0x4db7('0x34')][_0x4db7('0x3a')]('nolimit')){_0x449f57[_0x4db7('0x20')]=qs['limit'](_0x4b3b36[_0x4db7('0x34')]['limit']);_0x449f57[_0x4db7('0x1f')]=qs[_0x4db7('0x1f')](_0x4b3b36[_0x4db7('0x34')][_0x4db7('0x1f')]);}_0x449f57[_0x4db7('0x3b')]=qs[_0x4db7('0x3c')](_0x4b3b36[_0x4db7('0x34')][_0x4db7('0x3c')]);_0x449f57[_0x4db7('0x3d')]=qs['filters'](_[_0x4db7('0x3e')](_0x4b3b36[_0x4db7('0x34')],_0x3f9ec2[_0x4db7('0x36')]),_0x53dc06);if(_0x4b3b36['query'][_0x4db7('0x3f')]){_0x449f57[_0x4db7('0x3d')]=_[_0x4db7('0x40')](_0x449f57[_0x4db7('0x3d')],{'$or':_[_0x4db7('0x2f')](_0x53dc06,function(_0x5bea1b){if(_0x5bea1b[_0x4db7('0x31')]!==_0x4db7('0x41')){var _0x2a8e2b={};_0x2a8e2b[_0x5bea1b[_0x4db7('0x2c')]]={'$like':'%'+_0x4b3b36[_0x4db7('0x34')][_0x4db7('0x3f')]+'%'};return _0x2a8e2b;}})});}_0x449f57=_[_0x4db7('0x40')]({},_0x449f57,_0x4b3b36[_0x4db7('0x42')]);var _0x2f87ec={'where':_0x449f57[_0x4db7('0x3d')]};return db[_0x4db7('0x43')]['count'](_0x2f87ec)['then'](function(_0x42b2ab){_0xec6b99[_0x4db7('0x1e')]=_0x42b2ab;if(_0x4b3b36['query'][_0x4db7('0x44')]){_0x449f57[_0x4db7('0x45')]=[{'all':!![]}];}return db[_0x4db7('0x43')][_0x4db7('0x46')](_0x449f57);})['then'](function(_0x3b1034){_0xec6b99[_0x4db7('0x47')]=_0x3b1034;return _0xec6b99;})[_0x4db7('0x27')](respondWithFilteredResult(_0x51f090,_0x449f57))['catch'](handleError(_0x51f090,null));};exports[_0x4db7('0x48')]=function(_0x59bb12,_0x56cf51){var _0x40ed51={'raw':!![],'where':{'id':_0x59bb12[_0x4db7('0x49')]['id']}},_0x5da198={};_0x5da198[_0x4db7('0x33')]=_[_0x4db7('0x35')](db['OpenchannelApplication'][_0x4db7('0x30')]);_0x5da198[_0x4db7('0x34')]=_[_0x4db7('0x35')](_0x59bb12[_0x4db7('0x34')]);_0x5da198[_0x4db7('0x36')]=_[_0x4db7('0x4a')](_0x5da198['model'],_0x5da198[_0x4db7('0x34')]);_0x40ed51[_0x4db7('0x38')]=_[_0x4db7('0x4a')](_0x5da198[_0x4db7('0x33')],qs[_0x4db7('0x37')](_0x59bb12['query'][_0x4db7('0x37')]));_0x40ed51[_0x4db7('0x38')]=_0x40ed51['attributes']['length']?_0x40ed51[_0x4db7('0x38')]:_0x5da198[_0x4db7('0x33')];if(_0x59bb12[_0x4db7('0x34')][_0x4db7('0x44')]){_0x40ed51['include']=[{'all':!![]}];}_0x40ed51=_['merge']({},_0x40ed51,_0x59bb12[_0x4db7('0x42')]);return db[_0x4db7('0x43')]['find'](_0x40ed51)[_0x4db7('0x27')](handleEntityNotFound(_0x56cf51,null))['then'](respondWithResult(_0x56cf51,null))[_0x4db7('0x4b')](handleError(_0x56cf51,null));};exports[_0x4db7('0x4c')]=function(_0x2c73af,_0x3c0f7e){return db[_0x4db7('0x43')][_0x4db7('0x4c')](_0x2c73af[_0x4db7('0x4d')],{})[_0x4db7('0x27')](respondWithResult(_0x3c0f7e,0xc9))[_0x4db7('0x4b')](handleError(_0x3c0f7e,null));};exports['update']=function(_0x191458,_0x426322){if(_0x191458[_0x4db7('0x4d')]['id']){delete _0x191458[_0x4db7('0x4d')]['id'];}return db[_0x4db7('0x43')][_0x4db7('0x4e')]({'where':{'id':_0x191458[_0x4db7('0x49')]['id']}})['then'](handleEntityNotFound(_0x426322,null))[_0x4db7('0x27')](saveUpdates(_0x191458[_0x4db7('0x4d')],null))['then'](respondWithResult(_0x426322,null))[_0x4db7('0x4b')](handleError(_0x426322,null));};exports[_0x4db7('0x28')]=function(_0x2ee49b,_0x21c284){return db[_0x4db7('0x43')][_0x4db7('0x4e')]({'where':{'id':_0x2ee49b[_0x4db7('0x49')]['id']}})[_0x4db7('0x27')](handleEntityNotFound(_0x21c284,null))[_0x4db7('0x27')](removeEntity(_0x21c284,null))[_0x4db7('0x4b')](handleError(_0x21c284,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index c02c173..1dca47f 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 _0xac26=['exports','define','openchannel_applications','utf8mb4','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xac26,0xee));var _0x6ac2=function(_0x20d0dc,_0x3960f3){_0x20d0dc=_0x20d0dc-0x0;var _0x127c42=_0xac26[_0x20d0dc];return _0x127c42;};'use strict';var _=require(_0x6ac2('0x0'));var util=require(_0x6ac2('0x1'));var logger=require('../../config/logger')(_0x6ac2('0x2'));var moment=require(_0x6ac2('0x3'));var BPromise=require(_0x6ac2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ac2('0x5'));var rimraf=require(_0x6ac2('0x6'));var config=require(_0x6ac2('0x7'));var attributes=require(_0x6ac2('0x8'));module[_0x6ac2('0x9')]=function(_0x2a3a89,_0x1572d4){return _0x2a3a89[_0x6ac2('0xa')]('OpenchannelApplication',attributes,{'tableName':_0x6ac2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6ac2('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6b18=['lodash','api','bluebird','../../config/environment','./openchannelApplication.attributes','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x575934,_0x4a6760){var _0x109a3d=function(_0x1c20a1){while(--_0x1c20a1){_0x575934['push'](_0x575934['shift']());}};_0x109a3d(++_0x4a6760);}(_0x6b18,0x80));var _0x86b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6b18[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x86b1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x86b1('0x1'));var moment=require('moment');var BPromise=require(_0x86b1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x86b1('0x3'));var attributes=require(_0x86b1('0x4'));module['exports']=function(_0x536ca6,_0x3c42ff){return _0x536ca6['define']('OpenchannelApplication',attributes,{'tableName':_0x86b1('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86b1('0x6'),'collate':_0x86b1('0x7')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 2747505..f7f168b 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(_0x5259f7,_0xdcdc61){var _0x11e597=function(_0x390f89){while(--_0x390f89){_0x5259f7['push'](_0x5259f7['shift']());}};_0x11e597(++_0xdcdc61);}(_0xb10b,0x12a));var _0xbb10=function(_0x58f8a7,_0xbd36a7){_0x58f8a7=_0x58f8a7-0x0;var _0x149b97=_0xb10b[_0x58f8a7];return _0x149b97;};'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(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_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 0889f89..6a25bc1 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 _0xd1dd=['index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:destroy','destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x58f971,_0x44d986){var _0x5e02f3=function(_0x4805a5){while(--_0x4805a5){_0x58f971['push'](_0x58f971['shift']());}};_0x5e02f3(++_0x44d986);}(_0xd1dd,0x1a9));var _0xdd1d=function(_0x4fba16,_0x5db313){_0x4fba16=_0x4fba16-0x0;var _0x4bf557=_0xd1dd[_0x4fba16];return _0x4bf557;};'use strict';var multer=require('multer');var util=require(_0xdd1d('0x0'));var path=require(_0xdd1d('0x1'));var timeout=require(_0xdd1d('0x2'));var express=require(_0xdd1d('0x3'));var router=express[_0xdd1d('0x4')]();var auth=require(_0xdd1d('0x5'));var interaction=require(_0xdd1d('0x6'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xdd1d('0x7')]('/',auth[_0xdd1d('0x8')](),controller[_0xdd1d('0x9')]);router[_0xdd1d('0x7')](_0xdd1d('0xa'),auth[_0xdd1d('0x8')](),controller[_0xdd1d('0xb')]);router[_0xdd1d('0x7')](_0xdd1d('0xc'),auth[_0xdd1d('0x8')](),controller[_0xdd1d('0xd')]);router['get'](_0xdd1d('0xe'),auth[_0xdd1d('0x8')](),controller[_0xdd1d('0xf')]);router[_0xdd1d('0x7')]('/:id/download',auth[_0xdd1d('0x8')](),controller[_0xdd1d('0x10')]);router[_0xdd1d('0x11')]('/',auth[_0xdd1d('0x8')](),controller[_0xdd1d('0x12')]);router[_0xdd1d('0x11')](_0xdd1d('0xe'),auth[_0xdd1d('0x8')](),controller[_0xdd1d('0x13')]);router[_0xdd1d('0x11')](_0xdd1d('0x14'),auth[_0xdd1d('0x8')](),interaction[_0xdd1d('0x15')](_0xdd1d('0x16'),_0xdd1d('0x17')),controller[_0xdd1d('0x18')]);router[_0xdd1d('0x19')](_0xdd1d('0xc'),auth[_0xdd1d('0x8')](),interaction[_0xdd1d('0x15')](_0xdd1d('0x16'),'openchannelinteraction:update'),controller['update']);router['delete'](_0xdd1d('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xdd1d('0x16'),_0xdd1d('0x1a')),controller[_0xdd1d('0x1b')]);router[_0xdd1d('0x1c')](_0xdd1d('0x14'),auth['isAuthenticated'](),controller[_0xdd1d('0x1d')]);module[_0xdd1d('0x1e')]=router; \ No newline at end of file +var _0xedd8=['../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','/:id/messages','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xedd8,0x14a));var _0x8edd=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0xedd8[_0x54381d];return _0x5308a7;};'use strict';var multer=require(_0x8edd('0x0'));var util=require(_0x8edd('0x1'));var path=require(_0x8edd('0x2'));var timeout=require(_0x8edd('0x3'));var express=require('express');var router=express[_0x8edd('0x4')]();var auth=require(_0x8edd('0x5'));var interaction=require(_0x8edd('0x6'));var config=require(_0x8edd('0x7'));var controller=require(_0x8edd('0x8'));router[_0x8edd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8edd('0x9')](_0x8edd('0xa'),auth[_0x8edd('0xb')](),controller[_0x8edd('0xc')]);router[_0x8edd('0x9')](_0x8edd('0xd'),auth[_0x8edd('0xb')](),controller['show']);router[_0x8edd('0x9')](_0x8edd('0xe'),auth[_0x8edd('0xb')](),controller['getMessages']);router[_0x8edd('0x9')]('/:id/download',auth[_0x8edd('0xb')](),controller['download']);router[_0x8edd('0xf')]('/',auth[_0x8edd('0xb')](),controller['create']);router[_0x8edd('0xf')](_0x8edd('0xe'),auth[_0x8edd('0xb')](),controller[_0x8edd('0x10')]);router[_0x8edd('0xf')](_0x8edd('0x11'),auth[_0x8edd('0xb')](),interaction[_0x8edd('0x12')](_0x8edd('0x13'),_0x8edd('0x14')),controller['addTags']);router[_0x8edd('0x15')](_0x8edd('0xd'),auth[_0x8edd('0xb')](),interaction[_0x8edd('0x12')]('openchannel',_0x8edd('0x16')),controller[_0x8edd('0x17')]);router[_0x8edd('0x18')](_0x8edd('0xd'),auth[_0x8edd('0xb')](),interaction[_0x8edd('0x12')](_0x8edd('0x13'),'openchannelinteraction:destroy'),controller[_0x8edd('0x19')]);router[_0x8edd('0x18')](_0x8edd('0x11'),auth[_0x8edd('0xb')](),controller[_0x8edd('0x1a')]);module[_0x8edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 1d186ae..aa6558c 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 _0x380b=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x96d4e0,_0x187eb7){var _0x3bcac0=function(_0xd5c22f){while(--_0xd5c22f){_0x96d4e0['push'](_0x96d4e0['shift']());}};_0x3bcac0(++_0x187eb7);}(_0x380b,0x13f));var _0xb380=function(_0x2f406d,_0x3f995a){_0x2f406d=_0x2f406d-0x0;var _0x34d901=_0x380b[_0x2f406d];return _0x34d901;};'use strict';var Sequelize=require(_0xb380('0x0'));module['exports']={'closed':{'type':Sequelize[_0xb380('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb380('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb380('0x3')]},'read1stAt':{'type':Sequelize[_0xb380('0x2')]},'threadId':{'type':Sequelize[_0xb380('0x3')]},'externalUrl':{'type':Sequelize[_0xb380('0x3')]},'lastMsgAt':{'type':Sequelize[_0xb380('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xb380('0x4')]('in',_0xb380('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xb380('0x3')]}}; \ No newline at end of file +var _0x4d39=['DATE','ENUM','sequelize','exports','BOOLEAN','STRING'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x4d39,0xc8));var _0x94d3=function(_0x20be99,_0x38fc8a){_0x20be99=_0x20be99-0x0;var _0x4e7449=_0x4d39[_0x20be99];return _0x4e7449;};'use strict';var Sequelize=require(_0x94d3('0x0'));module[_0x94d3('0x1')]={'closed':{'type':Sequelize[_0x94d3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x94d3('0x3')]},'read1stAt':{'type':Sequelize[_0x94d3('0x4')]},'threadId':{'type':Sequelize[_0x94d3('0x3')]},'externalUrl':{'type':Sequelize[_0x94d3('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x94d3('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x94d3('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 687a596..8a9fa9f 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 _0x50fe=['OpenchannelInteractionId','all','rows','show','params','includeAll','include','options','create','describe','OpenchannelMessage','ids','getMessages','findOne','format','findAll','addTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','Contact','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','get','mkdirSync','10px','40px','Openchannel','YYYY-MM-DD','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','threadId','Public','basename','createReadStream','pipe','createWriteStream','System','firstName','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','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/logger','api','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','end','status','json','offset','set','Content-Range','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','index','OpenchannelInteraction','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.OpenchannelInteractionId','from','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','keys','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','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)','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','isEmpty','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','count','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString'];(function(_0xcf7d1e,_0x1b00ad){var _0x42b2cb=function(_0x4c5c9b){while(--_0x4c5c9b){_0xcf7d1e['push'](_0xcf7d1e['shift']());}};_0x42b2cb(++_0x1b00ad);}(_0x50fe,0x12a));var _0xe50f=function(_0x114d66,_0x3c1188){_0x114d66=_0x114d66-0x0;var _0x5189c7=_0x50fe[_0x114d66];return _0x5189c7;};'use strict';var pdf=require(_0xe50f('0x0'));var emlformat=require(_0xe50f('0x1'));var rimraf=require(_0xe50f('0x2'));var zipdir=require(_0xe50f('0x3'));var jsonpatch=require(_0xe50f('0x4'));var rp=require(_0xe50f('0x5'));var moment=require(_0xe50f('0x6'));var BPromise=require(_0xe50f('0x7'));var Mustache=require(_0xe50f('0x8'));var util=require(_0xe50f('0x9'));var path=require(_0xe50f('0xa'));var sox=require(_0xe50f('0xb'));var csv=require(_0xe50f('0xc'));var ejs=require(_0xe50f('0xd'));var fs=require('fs');var _=require(_0xe50f('0xe'));var squel=require(_0xe50f('0xf'));var crypto=require('crypto');var jsforce=require(_0xe50f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe50f('0xc'));var querystring=require('querystring');var Papa=require(_0xe50f('0x11'));var Redis=require(_0xe50f('0x12'));var authService=require(_0xe50f('0x13'));var qs=require(_0xe50f('0x14'));var as=require(_0xe50f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe50f('0x16'))(_0xe50f('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe50f('0x18'))['db'];config[_0xe50f('0x19')]=_[_0xe50f('0x1a')](config[_0xe50f('0x19')],{'host':_0xe50f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe50f('0x19')]));require(_0xe50f('0x1c'))[_0xe50f('0x1d')](socket);function respondWithStatusCode(_0x31728b,_0x496631){_0x496631=_0x496631||0xcc;return function(_0x1ee6a0){if(_0x1ee6a0){return _0x31728b[_0xe50f('0x1e')](_0x496631);}return _0x31728b['status'](_0x496631)[_0xe50f('0x1f')]();};}function respondWithResult(_0x402666,_0x27e240){_0x27e240=_0x27e240||0xc8;return function(_0xee24d3){if(_0xee24d3){return _0x402666[_0xe50f('0x20')](_0x27e240)[_0xe50f('0x21')](_0xee24d3);}};}function respondWithFilteredResult(_0x36263d,_0x335f9a){return function(_0x396626){if(_0x396626){var _0x56ed7a=_0x396626['count'],_0x4cf71e=_0x335f9a[_0xe50f('0x22')],_0x175e50=_0x335f9a['offset']+_0x335f9a['limit'],_0x129d18;if(_0x175e50>=_0x56ed7a){_0x175e50=_0x56ed7a;_0x129d18=0xc8;}else{_0x129d18=0xce;}_0x36263d[_0xe50f('0x20')](_0x129d18);return _0x36263d[_0xe50f('0x23')](_0xe50f('0x24'),_0x4cf71e+'-'+_0x175e50+'/'+_0x56ed7a)[_0xe50f('0x21')](_0x396626);}return null;};}function patchUpdates(_0x8c94c9){return function(_0x1df96e){try{jsonpatch['apply'](_0x1df96e,_0x8c94c9,!![]);}catch(_0x28e180){return BPromise['reject'](_0x28e180);}return _0x1df96e[_0xe50f('0x25')]();};}function saveUpdates(_0x36e678,_0xe77962){return function(_0xd7f62c){if(_0xd7f62c){return _0xd7f62c[_0xe50f('0x26')](_0x36e678)[_0xe50f('0x27')](function(_0x331fd9){return _0x331fd9;});}return null;};}function removeEntity(_0x4d9f15,_0xa01752){return function(_0x40dad8){if(_0x40dad8){return _0x40dad8[_0xe50f('0x28')]()[_0xe50f('0x27')](function(){_0x4d9f15[_0xe50f('0x20')](0xcc)[_0xe50f('0x1f')]();});}};}function handleEntityNotFound(_0x2caae0,_0x4210bb){return function(_0x5cbd7e){if(!_0x5cbd7e){_0x2caae0['sendStatus'](0x194);}return _0x5cbd7e;};}function handleError(_0x51e8bd,_0xaf5a8a){_0xaf5a8a=_0xaf5a8a||0x1f4;return function(_0x5e9d55){logger[_0xe50f('0x29')](_0x5e9d55[_0xe50f('0x2a')]);if(_0x5e9d55[_0xe50f('0x2b')]){delete _0x5e9d55['name'];}_0x51e8bd['status'](_0xaf5a8a)[_0xe50f('0x2c')](_0x5e9d55);};}function getInteractionUsers(_0x1dab5a,_0x24d2c9){return new BPromise(function(_0x2abbb6,_0x19b405){try{if(_0x24d2c9[_0x1dab5a['id']]){_0x1dab5a['Users']=_[_0xe50f('0x2d')](_0x24d2c9[_0x1dab5a['id']],function(_0x1c174c){return{'id':_0x1c174c['id'],'fullname':_0x1c174c[_0xe50f('0x2e')]};});}}catch(_0x2a9256){_0x19b405(_0x2a9256);}_0x2abbb6(_0x1dab5a);});}function getInteractionTags(_0x4a63a6,_0x2377c4){return new BPromise(function(_0x37c7bd,_0x1ee246){try{if(_0x4a63a6[_0xe50f('0x2f')]){_0x4a63a6[_0xe50f('0x30')]=[];_0x4a63a6[_0xe50f('0x2f')][_0xe50f('0x31')](',')['forEach'](function(_0x49a3f3){_0x4a63a6[_0xe50f('0x30')][_0xe50f('0x32')](_0x2377c4[_0x49a3f3]);});}delete _0x4a63a6['TagIds'];}catch(_0x268d61){_0x1ee246(_0x268d61);}_0x37c7bd(_0x4a63a6);});}function updateOpenchannelInteraction(_0x1133c9,_0x437d0d,_0x496d4c){return new BPromise(function(_0x3cf8e1,_0x4a8c04){return getInteractionUsers(_0x1133c9,_0x496d4c)[_0xe50f('0x27')](function(_0x25b98e){return getInteractionTags(_0x25b98e,_0x437d0d);})['then'](function(_0x32cab2){_0x3cf8e1(_0x32cab2);})[_0xe50f('0x33')](function(_0x223abc){_0x4a8c04(_0x223abc);});});}exports[_0xe50f('0x34')]=function(_0x9d4d7b,_0x46eca3){var _0x24d316={},_0x41c975={},_0x5d00e3={'count':0x0,'rows':[]};var _0x4f50a3=_[_0xe50f('0x2d')](db[_0xe50f('0x35')][_0xe50f('0x36')],function(_0x55b7e9){return{'name':_0x55b7e9['fieldName'],'type':_0x55b7e9[_0xe50f('0x37')][_0xe50f('0x38')]};});_0x41c975[_0xe50f('0x39')]=_[_0xe50f('0x2d')](_0x4f50a3,'name');_0x41c975[_0xe50f('0x3a')]=_['keys'](_0x9d4d7b[_0xe50f('0x3a')]);_0x41c975[_0xe50f('0x3b')]=_[_0xe50f('0x3c')](_0x41c975['model'],_0x41c975[_0xe50f('0x3a')]);_0x24d316[_0xe50f('0x3d')]=_['intersection'](_0x41c975['model'],qs['fields'](_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x3e')]));_0x24d316[_0xe50f('0x3d')]=_0x24d316[_0xe50f('0x3d')][_0xe50f('0x3f')]?_0x24d316[_0xe50f('0x3d')]:_0x41c975[_0xe50f('0x39')];if(!_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x40')](_0xe50f('0x41'))){_0x24d316[_0xe50f('0x42')]=qs[_0xe50f('0x42')](_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x42')]);_0x24d316[_0xe50f('0x22')]=qs[_0xe50f('0x22')](_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x22')]);}_0x24d316[_0xe50f('0x43')]=qs['sort'](_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x44')]);_0x24d316[_0xe50f('0x45')]=qs[_0xe50f('0x3b')](_[_0xe50f('0x46')](_0x9d4d7b[_0xe50f('0x3a')],_0x41c975[_0xe50f('0x3b')]),_0x4f50a3);var _0x5e4790=[];var _0x4b4013=squel[_0xe50f('0x47')]()[_0xe50f('0x48')]('id')[_0xe50f('0x48')](_0xe50f('0x2b'))[_0xe50f('0x48')](_0xe50f('0x49'))['from']('tools_tags');var _0x1c2295=squel[_0xe50f('0x47')]()[_0xe50f('0x48')](_0xe50f('0x4a'))['field'](_0xe50f('0x4b'))[_0xe50f('0x48')](_0xe50f('0x4c'))[_0xe50f('0x4d')]('user_has_openchannel_interactions','ui')[_0xe50f('0x4e')](_0xe50f('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x15cf35=squel[_0xe50f('0x47')]()[_0xe50f('0x4d')]('openchannel_interactions','i')[_0xe50f('0x4e')](_0xe50f('0x50'),'c',_0xe50f('0x51'))[_0xe50f('0x4e')]('users','o',_0xe50f('0x52'))[_0xe50f('0x4e')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0xe50f('0x4e')](_0xe50f('0x53'),'me',_0xe50f('0x54'))[_0xe50f('0x4e')](_0xe50f('0x55'),'it',_0xe50f('0x56'))[_0xe50f('0x4e')](_0xe50f('0x57'),'t',_0xe50f('0x58'));var _0x10d600=squel['expr']();var _0x1511f3=[];var _0x5d6622=squel[_0xe50f('0x59')]();var _0x5a10dd;if(_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x5a')]){_0x5a10dd=as[_0xe50f('0x5b')](_0x9d4d7b['query']['search']);var _0xf998b8=_0x5a10dd['sqlOperator'];for(var _0x4f7f33=0x0;_0x4f7f33<_0x5a10dd[_0xe50f('0x5c')][_0xe50f('0x3f')];_0x4f7f33++){var _0x45aa96=_0x5a10dd[_0xe50f('0x5c')][_0x4f7f33];var _0x22c20e='i';var _0x3e4555=_[_0xe50f('0x5d')](_0x4f50a3,[_0xe50f('0x2b'),_0x45aa96[_0xe50f('0x48')]]);if(!_0x3e4555){switch(_0x45aa96[_0xe50f('0x48')]){case _0xe50f('0x5e'):if(_0x45aa96[_0xe50f('0x5f')]==0x1){_0x15cf35['having']('`'+_0x45aa96['field']+_0xe50f('0x60'));}else{_0x15cf35[_0xe50f('0x61')]('`'+_0x45aa96[_0xe50f('0x48')]+'`\x20>\x200');}break;case'Contact':if(_0x45aa96['operator']===_0xe50f('0x62')){if(_0x45aa96[_0xe50f('0x5f')]['split']('\x20')['length']>0x1){_0x10d600[_0xf998b8](_0xe50f('0x63'),qs['getFullTextValue'](_0x45aa96[_0xe50f('0x5f')]),null);}else{var _0x2320a9='%'+_0x45aa96[_0xe50f('0x5f')]+'%';_0x10d600[_0xf998b8]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2320a9,_0x2320a9,_0x2320a9);}}else{_0x3e4555=_[_0xe50f('0x5d')](_0x4f50a3,[_0xe50f('0x2b'),_0xe50f('0x64')]);_0x45aa96[_0xe50f('0x48')]=_0xe50f('0x64');_0x1fbe79=as[_0xe50f('0x65')](_0x22c20e,_0x3e4555[_0xe50f('0x37')],_0x45aa96);_0x10d600[_0xf998b8](_0x1fbe79[_0xe50f('0x66')],_0x1fbe79['value']['start'],_0x1fbe79[_0xe50f('0x5f')][_0xe50f('0x1f')]);}break;case _0xe50f('0x67'):var _0x14b59c=_0x45aa96[_0xe50f('0x5f')][_0xe50f('0x31')](',')['map'](function(_0x58e017){return Number(_0x58e017);});_0x14b59c[_0xe50f('0x68')](function(_0x4ddbc5){_0x5d6622['or'](_0xe50f('0x69'),'%,'+_0x4ddbc5+',%');});_0x1511f3=_[_0xe50f('0x6a')](_0x1511f3,_0x14b59c);break;case _0xe50f('0x6b'):if(_0x45aa96[_0xe50f('0x6c')]==='$substring'){_0x10d600[_0xf998b8](_0xe50f('0x6d'),'%'+_0x45aa96[_0xe50f('0x5f')]+'%',null);}else{_0x3e4555=_[_0xe50f('0x5d')](_0x4f50a3,[_0xe50f('0x2b'),_0xe50f('0x6e')]);_0x45aa96['field']='UserId';_0x1fbe79=as['buildExpression'](_0x22c20e,_0x3e4555[_0xe50f('0x37')],_0x45aa96);_0x10d600[_0xf998b8](_0x1fbe79[_0xe50f('0x66')],_0x1fbe79['value'][_0xe50f('0x6f')],_0x1fbe79[_0xe50f('0x5f')][_0xe50f('0x1f')]);}break;case _0xe50f('0x70'):_0x1fbe79=as[_0xe50f('0x65')]('me',null,_0x45aa96);_0x10d600[_0xf998b8](_0x1fbe79[_0xe50f('0x66')],_0x1fbe79['value'][_0xe50f('0x6f')],_0x1fbe79[_0xe50f('0x5f')][_0xe50f('0x1f')]);break;}}else{var _0x1fbe79=as[_0xe50f('0x65')](_0x22c20e,_0x3e4555[_0xe50f('0x37')],_0x45aa96);_0x10d600[_0xf998b8](_0x1fbe79['text'],_0x1fbe79['value'][_0xe50f('0x6f')],_0x1fbe79[_0xe50f('0x5f')][_0xe50f('0x1f')]);}}}else{var _0x43160f=_(_0x9d4d7b[_0xe50f('0x3a')])[_0xe50f('0x71')]()[_0xe50f('0x2d')](function(_0xbf4289){return _['some'](_0x4f50a3,[_0xe50f('0x2b'),_0xbf4289])?_0xbf4289:undefined;})[_0xe50f('0x72')]()[_0xe50f('0x5f')]();if(!_['isEmpty'](_0x43160f)){_0x43160f['forEach'](function(_0x4a7274){if(_0x4a7274===_0xe50f('0x73')){_0x15cf35[_0xe50f('0x45')](_0xe50f('0x74'),[][_0xe50f('0x75')](_0x9d4d7b[_0xe50f('0x3a')][_0x4a7274]));}else if(_0x4a7274===_0xe50f('0x76')){var _0x53a0af=JSON['parse'](_0x9d4d7b[_0xe50f('0x3a')][_0x4a7274])[_0xe50f('0x77')];var _0x11cc8b=JSON['parse'](_0x9d4d7b['query'][_0x4a7274])[_0xe50f('0x78')];_0x15cf35['where'](_0xe50f('0x79'),_0x53a0af,_0x11cc8b);}else{if(_0x9d4d7b['query'][_0x4a7274]==='null'){_0x15cf35[_0xe50f('0x45')]('i.'+_0x4a7274+_0xe50f('0x7a'));}else{_0x15cf35['where']('i.'+_0x4a7274+'\x20=\x20?',_0x9d4d7b[_0xe50f('0x3a')][_0x4a7274]);}}});}if(_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x7b')]){if(_0x9d4d7b[_0xe50f('0x3a')]['read']==0x1){_0x15cf35['having'](_0xe50f('0x7c'));}else{_0x15cf35[_0xe50f('0x61')]('`unreadMessages`\x20>\x200');}}if(_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x7d')]){_0x1511f3=_['isArray'](_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x7d')])?_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x7d')]:new Array(_0x9d4d7b['query'][_0xe50f('0x7d')]);_0x1511f3['forEach'](function(_0x54d9c5){_0x5d6622['or'](_0xe50f('0x69'),'%,'+_0x54d9c5+',%');});}if(_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x7e')]){var _0x9030c6=_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x7e')][_0xe50f('0x7f')]('\x5c','\x5c\x5c')[_0xe50f('0x7f')]('\x27\x27',_0xe50f('0x80'));if(qs[_0xe50f('0x81')](_0x9030c6)){_0x10d600['or'](_0xe50f('0x82'),_0x9030c6+'%');}else{_0x10d600['or'](_0xe50f('0x83'),qs[_0xe50f('0x84')](_0x9030c6))['or'](_0xe50f('0x85'),_0x9030c6+'%')['or'](_0xe50f('0x86'),_0x9030c6+'%');}}}_0x15cf35['where'](_0x10d600);_0x15cf35[_0xe50f('0x87')](_0xe50f('0x88'));var _0x9d36a1={'type':db[_0xe50f('0x89')][_0xe50f('0x8a')][_0xe50f('0x8b')],'raw':!![]};var _0x58bec1=_0x15cf35['clone']();_0x58bec1['field'](_0xe50f('0x88'));_0x58bec1[_0xe50f('0x48')](_0xe50f('0x8c'),_0xe50f('0x5e'));if(_0x24d316[_0xe50f('0x43')]){_0x24d316[_0xe50f('0x43')]['forEach'](function(_0x313e58){_0x15cf35[_0xe50f('0x43')]('i.'+_0x313e58[0x0],_0x313e58[0x1]===_0xe50f('0x8d')?![]:!![]);});}if(!_['isEmpty'](_0x1511f3)){_0x15cf35['having'](_0x5d6622);_0x58bec1['where']('t.id\x20IN\x20?',_0x1511f3);}BPromise[_0xe50f('0x8e')]()[_0xe50f('0x27')](function(){if(!_0x5a10dd){if(_0x9d4d7b[_0xe50f('0x3a')]['OpenchannelAccountId']||_0x9d4d7b[_0xe50f('0x3a')]['journey'])return;_0x58bec1[_0xe50f('0x45')](_0xe50f('0x8f'));_0x15cf35['where'](_0xe50f('0x8f'));return;}return _0x9d4d7b[_0xe50f('0x90')][_0xe50f('0x91')]({'attributes':['id'],'raw':!![]})[_0xe50f('0x27')](function(_0x44ba99){if(_[_0xe50f('0x92')](_0x44ba99)){_0x58bec1[_0xe50f('0x45')](_0xe50f('0x93'));_0x15cf35[_0xe50f('0x45')](_0xe50f('0x93'));}else{_0x58bec1[_0xe50f('0x45')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xe50f('0x2d')](_0x44ba99,'id'));_0x15cf35[_0xe50f('0x45')](_0xe50f('0x74'),_[_0xe50f('0x2d')](_0x44ba99,'id'));}});})[_0xe50f('0x27')](function(){db[_0xe50f('0x94')]['query'](_0x58bec1['toString'](),_0x9d36a1)['then'](function(_0x835489){_0x5d00e3[_0xe50f('0x95')]=_0x835489[_0xe50f('0x3f')];if(_0x5d00e3[_0xe50f('0x95')]===0x0)return[];return db['sequelize'][_0xe50f('0x3a')](_0x4b4013['toString'](),_0x9d36a1)[_0xe50f('0x27')](function(_0xf820e){_0x5e4790=_[_0xe50f('0x96')](_0xf820e,'id');_0x9d36a1=_[_0xe50f('0x97')](_0x9d36a1,{'model':db[_0xe50f('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9d4d7b[_0xe50f('0x3a')][_0xe50f('0x3e')]){_0x24d316[_0xe50f('0x3d')]['forEach'](function(_0x38ff89){_0x15cf35[_0xe50f('0x48')]('i.'+_0x38ff89);});}else{_0x15cf35[_0xe50f('0x48')](_0xe50f('0x8c'),_0xe50f('0x5e'));_0x15cf35[_0xe50f('0x48')]('a.key',_0xe50f('0x98'));_0x15cf35[_0xe50f('0x48')](_0xe50f('0x99'),_0xe50f('0x9a'));_0x15cf35[_0xe50f('0x48')]('i.*');_0x15cf35[_0xe50f('0x48')]('c.firstName',_0xe50f('0x9b'));_0x15cf35[_0xe50f('0x48')]('c.lastName',_0xe50f('0x9c'));_0x15cf35[_0xe50f('0x48')]('c.email',_0xe50f('0x9d'));_0x15cf35[_0xe50f('0x48')](_0xe50f('0x9e'),_0xe50f('0x9f'));_0x15cf35[_0xe50f('0x48')](_0xe50f('0xa0'),_0xe50f('0xa1'));_0x15cf35[_0xe50f('0x48')](_0xe50f('0xa2'),_0xe50f('0xa3'));_0x15cf35[_0xe50f('0x48')](_0xe50f('0xa4'),'Owner.fullname');_0x15cf35[_0xe50f('0x48')]('o.internal',_0xe50f('0xa5'));_0x15cf35[_0xe50f('0x48')](_0xe50f('0xa6'),_0xe50f('0x2f'));}if(_0x24d316[_0xe50f('0x42')])_0x15cf35['limit'](_0x24d316[_0xe50f('0x42')]);if(_0x24d316[_0xe50f('0x22')])_0x15cf35['offset'](_0x24d316[_0xe50f('0x22')]);return db[_0xe50f('0x94')][_0xe50f('0x3a')](_0x15cf35[_0xe50f('0xa7')](),_0x9d36a1);})[_0xe50f('0x27')](function(_0x2cf492){_0x1c2295[_0xe50f('0x45')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xe50f('0x2d')](_0x2cf492,'id'));return db['sequelize']['query'](_0x1c2295[_0xe50f('0xa7')](),_0x9d36a1)['then'](function(_0x951d03){var _0x9ad54=_['groupBy'](_0x951d03,_0xe50f('0xa8'));var _0x260af1=[];_0x2cf492[_0xe50f('0x68')](function(_0x1fc345){_0x260af1[_0xe50f('0x32')](updateOpenchannelInteraction(_0x1fc345,_0x5e4790,_0x9ad54));});return BPromise[_0xe50f('0xa9')](_0x260af1);});});})[_0xe50f('0x27')](function(_0x403053){_0x5d00e3[_0xe50f('0xaa')]=_0x403053;return _0x5d00e3;})[_0xe50f('0x27')](respondWithFilteredResult(_0x46eca3,_0x24d316));})[_0xe50f('0x33')](handleError(_0x46eca3,null));};exports[_0xe50f('0xab')]=function(_0x182c96,_0x228cba){var _0x5c2fb6={'raw':![],'where':{'id':_0x182c96[_0xe50f('0xac')]['id']}},_0x1977b={};_0x1977b['model']=_[_0xe50f('0x71')](db['OpenchannelInteraction']['rawAttributes']);_0x1977b[_0xe50f('0x3a')]=_[_0xe50f('0x71')](_0x182c96[_0xe50f('0x3a')]);_0x1977b[_0xe50f('0x3b')]=_['intersection'](_0x1977b[_0xe50f('0x39')],_0x1977b[_0xe50f('0x3a')]);_0x5c2fb6[_0xe50f('0x3d')]=_[_0xe50f('0x3c')](_0x1977b[_0xe50f('0x39')],qs[_0xe50f('0x3e')](_0x182c96[_0xe50f('0x3a')][_0xe50f('0x3e')]));_0x5c2fb6[_0xe50f('0x3d')]=_0x5c2fb6['attributes']['length']?_0x5c2fb6[_0xe50f('0x3d')]:_0x1977b[_0xe50f('0x39')];if(_0x182c96[_0xe50f('0x3a')][_0xe50f('0xad')]){_0x5c2fb6[_0xe50f('0xae')]=[{'all':!![]}];}_0x5c2fb6=_[_0xe50f('0x97')]({},_0x5c2fb6,_0x182c96[_0xe50f('0xaf')]);return db[_0xe50f('0x35')][_0xe50f('0x5d')](_0x5c2fb6)[_0xe50f('0x27')](handleEntityNotFound(_0x228cba,null))[_0xe50f('0x27')](respondWithResult(_0x228cba,null))[_0xe50f('0x33')](handleError(_0x228cba,null));};exports['create']=function(_0x17c8ca,_0x1f7e6b){return db[_0xe50f('0x35')][_0xe50f('0xb0')](_0x17c8ca['body'],{})[_0xe50f('0x27')](respondWithResult(_0x1f7e6b,0xc9))[_0xe50f('0x33')](handleError(_0x1f7e6b,null));};exports[_0xe50f('0x26')]=function(_0x4b9101,_0x3ee54c){if(_0x4b9101[_0xe50f('0x70')]['id']){delete _0x4b9101[_0xe50f('0x70')]['id'];}return db[_0xe50f('0x35')][_0xe50f('0x5d')]({'where':{'id':_0x4b9101[_0xe50f('0xac')]['id']}})[_0xe50f('0x27')](handleEntityNotFound(_0x3ee54c,null))[_0xe50f('0x27')](saveUpdates(_0x4b9101[_0xe50f('0x70')],null))[_0xe50f('0x27')](respondWithResult(_0x3ee54c,null))[_0xe50f('0x33')](handleError(_0x3ee54c,null));};exports['destroy']=function(_0x2a6ff8,_0x441cca){return db[_0xe50f('0x35')][_0xe50f('0x5d')]({'where':{'id':_0x2a6ff8[_0xe50f('0xac')]['id']}})[_0xe50f('0x27')](handleEntityNotFound(_0x441cca,null))['then'](removeEntity(_0x441cca,null))[_0xe50f('0x33')](handleError(_0x441cca,null));};exports[_0xe50f('0xb1')]=function(_0x3b9141,_0x389c31){return db[_0xe50f('0x35')][_0xe50f('0xb1')]()[_0xe50f('0x27')](respondWithResult(_0x389c31,null))[_0xe50f('0x33')](handleError(_0x389c31,null));};exports['addMessage']=function(_0xc1b16a,_0x2d9717,_0x2642d1){return db[_0xe50f('0xb2')][_0xe50f('0x5d')]({'where':{'id':_0xc1b16a[_0xe50f('0xac')]['id']}})['then'](handleEntityNotFound(_0x2d9717,null))[_0xe50f('0x27')](function(_0x1249da){if(_0x1249da){return _0x1249da['addMessage'](_0xc1b16a[_0xe50f('0x70')]['ids'],_['omit'](_0xc1b16a['body'],[_0xe50f('0xb3'),'id'])||{});}})[_0xe50f('0x27')](respondWithResult(_0x2d9717,null))[_0xe50f('0x33')](handleError(_0x2d9717,null));};exports[_0xe50f('0xb4')]=function(_0x21737d,_0x33baee,_0x38b837){var _0x12cd0d={'raw':![],'where':{}};var _0x56dacf={};var _0x26c397={'count':0x0,'rows':[]};return db[_0xe50f('0x35')][_0xe50f('0xb5')]({'where':{'id':_0x21737d['params']['id']}})[_0xe50f('0x27')](handleEntityNotFound(_0x33baee,null))[_0xe50f('0x27')](function(_0x48ca38){if(_0x48ca38){_0x56dacf[_0xe50f('0x39')]=_[_0xe50f('0x71')](db[_0xe50f('0xb2')][_0xe50f('0x36')]);_0x56dacf[_0xe50f('0x3a')]=_['keys'](_0x21737d[_0xe50f('0x3a')]);_0x56dacf['filters']=_['intersection'](_0x56dacf[_0xe50f('0x39')],_0x56dacf['query']);_0x12cd0d[_0xe50f('0x3d')]=_[_0xe50f('0x3c')](_0x56dacf['model'],qs['fields'](_0x21737d[_0xe50f('0x3a')][_0xe50f('0x3e')]));_0x12cd0d[_0xe50f('0x3d')]=_0x12cd0d[_0xe50f('0x3d')]['length']?_0x12cd0d[_0xe50f('0x3d')]:_0x56dacf[_0xe50f('0x39')];if(!_0x21737d[_0xe50f('0x3a')][_0xe50f('0x40')](_0xe50f('0x41'))){_0x12cd0d[_0xe50f('0x42')]=qs[_0xe50f('0x42')](_0x21737d[_0xe50f('0x3a')][_0xe50f('0x42')]);_0x12cd0d['offset']=qs[_0xe50f('0x22')](_0x21737d[_0xe50f('0x3a')][_0xe50f('0x22')]);}_0x12cd0d['order']=qs[_0xe50f('0x44')](_0x21737d[_0xe50f('0x3a')][_0xe50f('0x44')]);_0x12cd0d[_0xe50f('0x45')]=qs[_0xe50f('0x3b')](_['pick'](_0x21737d[_0xe50f('0x3a')],_0x56dacf[_0xe50f('0x3b')]));_0x12cd0d[_0xe50f('0x45')]['OpenchannelInteractionId']=_0x48ca38['id'];if(_0x21737d[_0xe50f('0x3a')][_0xe50f('0x7e')]){_0x12cd0d[_0xe50f('0x45')]=_[_0xe50f('0x97')](_0x12cd0d['where'],{'$or':_[_0xe50f('0x2d')](_0x12cd0d[_0xe50f('0x3d')],function(_0x21a419){var _0x5b483c={};_0x5b483c[_0x21a419]={'$like':'%'+_0x21737d['query'][_0xe50f('0x7e')]+'%'};return _0x5b483c;})});}if(_0x21737d[_0xe50f('0x3a')][_0xe50f('0x77')]){var _0x3d7763=_0x21737d['query']['$gte'][_0xe50f('0x31')](',');var _0x205c05={};_0x205c05[_0x3d7763[0x0]]={'$gte':moment(_0x3d7763[0x1])[_0xe50f('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x12cd0d[_0xe50f('0x45')]=_[_0xe50f('0x97')](_0x12cd0d[_0xe50f('0x45')],_0x205c05);}_0x12cd0d=_[_0xe50f('0x97')]({},_0x12cd0d,_0x21737d['options']);return db[_0xe50f('0xb2')]['count']({'where':_0x12cd0d[_0xe50f('0x45')]})['then'](function(_0x1d9527){_0x26c397[_0xe50f('0x95')]=_0x1d9527;if(_0x21737d[_0xe50f('0x3a')][_0xe50f('0xad')]){_0x12cd0d[_0xe50f('0xae')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xe50f('0xb7')](_0x12cd0d);})[_0xe50f('0x27')](function(_0x1a3356){_0x26c397[_0xe50f('0xaa')]=_0x1a3356;return _0x26c397;});}})['then'](respondWithFilteredResult(_0x33baee,_0x12cd0d))[_0xe50f('0x33')](handleError(_0x33baee,null));};exports[_0xe50f('0xb8')]=function(_0x17b1e7,_0x51e33c,_0x51db5c){return db[_0xe50f('0x35')][_0xe50f('0x5d')]({'where':{'id':_0x17b1e7[_0xe50f('0xac')]['id']}})[_0xe50f('0x27')](handleEntityNotFound(_0x51e33c,null))[_0xe50f('0x27')](function(_0x14104a){if(_0x14104a){return _0x14104a['setTags'](_0x17b1e7['body'][_0xe50f('0xb3')],_[_0xe50f('0xb9')](_0x17b1e7['body'],[_0xe50f('0xb3'),'id'])||{})[_0xe50f('0xba')](function(){return db['Tag'][_0xe50f('0xb7')]({'attributes':['id',_0xe50f('0x2b'),_0xe50f('0x49')],'where':{'id':_0x17b1e7[_0xe50f('0x70')][_0xe50f('0xb3')]}});})[_0xe50f('0x27')](function(_0xfe9635){socket[_0xe50f('0xbb')](_0xe50f('0xbc'),{'id':Number(_0x17b1e7[_0xe50f('0xac')]['id']),'tags':_0xfe9635||[]});return{'id':Number(_0x17b1e7[_0xe50f('0xac')]['id']),'tags':_0xfe9635||[]};});}})[_0xe50f('0x27')](respondWithResult(_0x51e33c,null))[_0xe50f('0x33')](handleError(_0x51e33c,null));};exports[_0xe50f('0xbd')]=function(_0x268751,_0x3806ca,_0x2340b1){return db[_0xe50f('0x35')][_0xe50f('0x5d')]({'where':{'id':_0x268751['params']['id']}})[_0xe50f('0x27')](handleEntityNotFound(_0x3806ca,null))[_0xe50f('0x27')](function(_0x490776){if(_0x490776){return _0x490776[_0xe50f('0xbd')](_0x268751[_0xe50f('0x3a')][_0xe50f('0xb3')]);}})[_0xe50f('0x27')](respondWithStatusCode(_0x3806ca,null))[_0xe50f('0x33')](handleError(_0x3806ca,null));};exports[_0xe50f('0xbe')]=function(_0x606f4e,_0xaadef8){var _0x44feec=moment()[_0xe50f('0xbf')]()[_0xe50f('0xa7')]();var _0x36fd48=path[_0xe50f('0xc0')](config[_0xe50f('0xc1')],_0xe50f('0xc2'),_0xe50f('0xc3'),_0xe50f('0xc4'));var _0x1af225=path[_0xe50f('0xc0')](config[_0xe50f('0xc1')],_0xe50f('0xc2'),_0xe50f('0xc3'),_0xe50f('0xc5'));var _0x3cafa3=path[_0xe50f('0xc0')](_0x36fd48,_0x44feec);var _0xca77b4=util[_0xe50f('0xb6')]('transcript-%d-%s.zip',_0x606f4e[_0xe50f('0xac')]['id'],_0x44feec);var _0x17788c=path[_0xe50f('0xc0')](_0x36fd48,_0xca77b4);var _0x211a91=[];_0x211a91[_0xe50f('0x32')]({'model':db[_0xe50f('0x6b')],'as':_0xe50f('0x6b'),'attributes':['id','fullname'],'raw':!![]});_0x211a91['push']({'model':db[_0xe50f('0xc6')],'as':_0xe50f('0xc7'),'attributes':['id','firstName',_0xe50f('0xc8')],'raw':!![]});if(_0x606f4e['query']['attachments']){_0x211a91['push']({'model':db[_0xe50f('0xc9')],'as':_0xe50f('0xc9'),'raw':!![]});}var _0x35ae25=[{'model':db[_0xe50f('0xb2')],'as':_0xe50f('0xca'),'attributes':['id',_0xe50f('0x70'),_0xe50f('0x76'),_0xe50f('0xcb'),_0xe50f('0xcc'),_0xe50f('0x7b')],'include':_0x211a91}];_0x35ae25[_0xe50f('0x32')]({'model':db[_0xe50f('0xcd')],'as':'Account','attributes':['id','name']});_0x35ae25['push']({'model':db[_0xe50f('0x6b')],'as':'Owner','attributes':['id',_0xe50f('0x2e')]});return db['OpenchannelInteraction'][_0xe50f('0x5d')]({'where':{'id':_0x606f4e[_0xe50f('0xac')]['id']},'include':_0x35ae25})[_0xe50f('0x27')](handleEntityNotFound(_0xaadef8,null))['then'](function(_0x1ef358){if(_0x1ef358){var _0x5f4be1=_0x1ef358[_0xe50f('0xce')]({'plain':!![]});fs[_0xe50f('0xcf')](_0x3cafa3);var _0x37d4dd={'format':'A4','border':_0xe50f('0xd0'),'header':{'height':_0xe50f('0xd1'),'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':'30px','contents':{'default':util[_0xe50f('0xb6')]('\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[_0xe50f('0xb6')]('%s\x20#%d',_0xe50f('0xd2'),_0x5f4be1['id']),moment()[_0xe50f('0xb6')](_0xe50f('0xd3'))[_0xe50f('0xa7')]())}}};var _0x8b6e24={'channel':_0xe50f('0xd2'),'account':_0x5f4be1[_0xe50f('0xd4')][_0xe50f('0x2b')],'agent':_0x5f4be1[_0xe50f('0xd5')]?_0x5f4be1['Owner'][_0xe50f('0x2e')]:_0xe50f('0xd6'),'createdAt':moment(_0x5f4be1['createdAt'])[_0xe50f('0xb6')](_0xe50f('0xd7'))[_0xe50f('0xa7')](),'closedAt':_0x5f4be1[_0xe50f('0xd8')]?moment(_0x5f4be1['closedAt'])[_0xe50f('0xb6')](_0xe50f('0xd7'))[_0xe50f('0xa7')]():'','disposition':_0x5f4be1[_0xe50f('0xd9')],'visibility':_0x5f4be1[_0xe50f('0xda')]?_0xe50f('0xdb'):'Private','messages':_(_0x5f4be1['Messages'])[_0xe50f('0x7e')]({'secret':![]})[_0xe50f('0x2d')](function(_0x400799){if(_0x400799['Attachment']){var _0x355be6=path[_0xe50f('0xc0')](_0x1af225,_0x400799[_0xe50f('0xc9')][_0xe50f('0xdc')]);if(fs['existsSync'](_0x355be6)){fs[_0xe50f('0xdd')](_0x355be6)[_0xe50f('0xde')](fs[_0xe50f('0xdf')](path['join'](_0x3cafa3,_0x400799[_0xe50f('0xc9')][_0xe50f('0xdc')])));}}return{'date':moment(_0x400799['createdAt'])[_0xe50f('0xb6')](_0xe50f('0xd7'))[_0xe50f('0xa7')](),'sender':_0x400799['direction']==='out'?_0x400799[_0xe50f('0x6b')]?_0x400799['User'][_0xe50f('0x2e')]:_0xe50f('0xe0'):_0x400799[_0xe50f('0xc7')][_0xe50f('0xe1')]+(_0x400799['Contact']['lastName']?'\x20'+_0x400799[_0xe50f('0xc7')]['lastName']:''),'body':_0x400799['Attachment']?_0x400799['Attachment'][_0xe50f('0xdc')]:_0x400799[_0xe50f('0x70')],'direction':_0x400799[_0xe50f('0xcb')]==='out'?'A':'C','secret':_0x400799['secret'],'read':_0x400799[_0xe50f('0x7b')],'attachment':_0x400799[_0xe50f('0xc9')]};})[_0xe50f('0x5f')]()};return ejs['renderFile'](path[_0xe50f('0xc0')](config[_0xe50f('0xc1')],'server',_0xe50f('0xe2'),_0xe50f('0xe3')),{'interaction':_0x8b6e24})['then'](function(_0x5d8759){return new BPromise(function(_0x11cae6,_0x16a347){pdf[_0xe50f('0xb0')](_0x5d8759,_0x37d4dd)[_0xe50f('0xe4')](path[_0xe50f('0xc0')](_0x3cafa3,_0xe50f('0xe5')+_0x5f4be1['id']+'-'+_0x44feec+'.pdf'),function(_0x4c3c55,_0x33ce65){if(_0x4c3c55)return _0x16a347(_0x4c3c55);_0x11cae6(_0x33ce65);});});})[_0xe50f('0x27')](function(){return new BPromise(function(_0x2d08ea,_0x52641a){zipdir(_0x3cafa3,{'saveTo':_0x17788c},function(_0x4cf1de,_0x318ee2){if(_0x4cf1de)return _0x52641a(_0x4cf1de);return _0x2d08ea(_0x318ee2);});})[_0xe50f('0x27')](function(){return new BPromise(function(_0x452808,_0x2b0d00){rimraf(_0x3cafa3,function(_0x5b2f68){if(_0x5b2f68)_0x2b0d00(_0x5b2f68);return _0x452808();});});})['then'](function(){return _0xaadef8[_0xe50f('0xbe')](_0x17788c,_0xca77b4,function(_0x3029a8){if(_0x3029a8){console[_0xe50f('0xe6')](_0xe50f('0xe7'),_0x3029a8);}else{fs[_0xe50f('0xe8')](_0x17788c);}});});});}else{return _0xaadef8['sendStatus'](0xc8);}})[_0xe50f('0x33')](handleError(_0xaadef8,null));}; \ No newline at end of file +var _0x69b4=['o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','catch','show','includeAll','include','options','find','create','params','describe','addMessage','OpenchannelMessage','ids','getMessages','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','Tag','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','direction','OpenchannelAccount','Account','Owner','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\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','Openchannel','YYYY-MM-DD','N.A.','closed','Public','Private','Messages','basename','createReadStream','pipe','out','System','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','index','OpenchannelInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','field','color','from','select','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','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','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax'];(function(_0x162a16,_0x20c857){var _0x35144f=function(_0x2f7834){while(--_0x2f7834){_0x162a16['push'](_0x162a16['shift']());}};_0x35144f(++_0x20c857);}(_0x69b4,0x133));var _0x469b=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x69b4[_0x465028];return _0xb783d4;};'use strict';var pdf=require(_0x469b('0x0'));var emlformat=require(_0x469b('0x1'));var rimraf=require(_0x469b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x469b('0x3'));var rp=require(_0x469b('0x4'));var moment=require(_0x469b('0x5'));var BPromise=require(_0x469b('0x6'));var Mustache=require(_0x469b('0x7'));var util=require(_0x469b('0x8'));var path=require(_0x469b('0x9'));var sox=require(_0x469b('0xa'));var csv=require(_0x469b('0xb'));var ejs=require(_0x469b('0xc'));var fs=require('fs');var _=require(_0x469b('0xd'));var squel=require('squel');var crypto=require(_0x469b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x469b('0xf'));var toCsv=require(_0x469b('0xb'));var querystring=require(_0x469b('0x10'));var Papa=require(_0x469b('0x11'));var Redis=require('ioredis');var authService=require(_0x469b('0x12'));var qs=require(_0x469b('0x13'));var as=require(_0x469b('0x14'));var hardwareService=require(_0x469b('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x469b('0x16'));var db=require(_0x469b('0x17'))['db'];config['redis']=_[_0x469b('0x18')](config[_0x469b('0x19')],{'host':_0x469b('0x1a'),'port':0x18eb});var socket=require(_0x469b('0x1b'))(new Redis(config[_0x469b('0x19')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3d392e,_0x28745e){_0x28745e=_0x28745e||0xcc;return function(_0x57cebe){if(_0x57cebe){return _0x3d392e[_0x469b('0x1c')](_0x28745e);}return _0x3d392e[_0x469b('0x1d')](_0x28745e)['end']();};}function respondWithResult(_0x5c359a,_0x5f0b5f){_0x5f0b5f=_0x5f0b5f||0xc8;return function(_0x51838d){if(_0x51838d){return _0x5c359a[_0x469b('0x1d')](_0x5f0b5f)[_0x469b('0x1e')](_0x51838d);}};}function respondWithFilteredResult(_0x2eaa20,_0x303238){return function(_0x37bbf6){if(_0x37bbf6){var _0x1b4a87=_0x37bbf6[_0x469b('0x1f')],_0x4cb5f8=_0x303238[_0x469b('0x20')],_0x45d8e2=_0x303238[_0x469b('0x20')]+_0x303238['limit'],_0x1e6527;if(_0x45d8e2>=_0x1b4a87){_0x45d8e2=_0x1b4a87;_0x1e6527=0xc8;}else{_0x1e6527=0xce;}_0x2eaa20[_0x469b('0x1d')](_0x1e6527);return _0x2eaa20[_0x469b('0x21')](_0x469b('0x22'),_0x4cb5f8+'-'+_0x45d8e2+'/'+_0x1b4a87)[_0x469b('0x1e')](_0x37bbf6);}return null;};}function patchUpdates(_0x53aad8){return function(_0x43a1eb){try{jsonpatch[_0x469b('0x23')](_0x43a1eb,_0x53aad8,!![]);}catch(_0x37e049){return BPromise[_0x469b('0x24')](_0x37e049);}return _0x43a1eb[_0x469b('0x25')]();};}function saveUpdates(_0x4f4ad3,_0x226a3a){return function(_0x4075bf){if(_0x4075bf){return _0x4075bf[_0x469b('0x26')](_0x4f4ad3)[_0x469b('0x27')](function(_0x268866){return _0x268866;});}return null;};}function removeEntity(_0x488058,_0x4866e4){return function(_0x70ab0){if(_0x70ab0){return _0x70ab0[_0x469b('0x28')]()[_0x469b('0x27')](function(){_0x488058[_0x469b('0x1d')](0xcc)[_0x469b('0x29')]();});}};}function handleEntityNotFound(_0x406f3f,_0x327a35){return function(_0x1f06ae){if(!_0x1f06ae){_0x406f3f['sendStatus'](0x194);}return _0x1f06ae;};}function handleError(_0x1aef4d,_0x220b69){_0x220b69=_0x220b69||0x1f4;return function(_0x31f298){logger[_0x469b('0x2a')](_0x31f298[_0x469b('0x2b')]);if(_0x31f298[_0x469b('0x2c')]){delete _0x31f298[_0x469b('0x2c')];}_0x1aef4d['status'](_0x220b69)[_0x469b('0x2d')](_0x31f298);};}function getInteractionUsers(_0x370947,_0x2aa10f){return new BPromise(function(_0x39ae53,_0x2569f8){try{if(_0x2aa10f[_0x370947['id']]){_0x370947[_0x469b('0x2e')]=_[_0x469b('0x2f')](_0x2aa10f[_0x370947['id']],function(_0x440c3c){return{'id':_0x440c3c['id'],'fullname':_0x440c3c[_0x469b('0x30')]};});}}catch(_0x5cb714){_0x2569f8(_0x5cb714);}_0x39ae53(_0x370947);});}function getInteractionTags(_0x27e239,_0x4a2fda){return new BPromise(function(_0x3af0de,_0x2aba99){try{if(_0x27e239[_0x469b('0x31')]){_0x27e239['Tags']=[];_0x27e239['TagIds'][_0x469b('0x32')](',')[_0x469b('0x33')](function(_0x3c7a93){_0x27e239[_0x469b('0x34')][_0x469b('0x35')](_0x4a2fda[_0x3c7a93]);});}delete _0x27e239[_0x469b('0x31')];}catch(_0x3dbe16){_0x2aba99(_0x3dbe16);}_0x3af0de(_0x27e239);});}function updateOpenchannelInteraction(_0xd52ac3,_0x222285,_0x337698){return new BPromise(function(_0x191aad,_0x21c62a){return getInteractionUsers(_0xd52ac3,_0x337698)['then'](function(_0x5c699b){return getInteractionTags(_0x5c699b,_0x222285);})[_0x469b('0x27')](function(_0x4d3539){_0x191aad(_0x4d3539);})['catch'](function(_0x13076a){_0x21c62a(_0x13076a);});});}exports[_0x469b('0x36')]=function(_0x433139,_0x28f5c1){var _0xa3be40={},_0x161f02={},_0x3fb683={'count':0x0,'rows':[]};var _0x187cee=_['map'](db[_0x469b('0x37')][_0x469b('0x38')],function(_0x38a159){return{'name':_0x38a159['fieldName'],'type':_0x38a159[_0x469b('0x39')][_0x469b('0x3a')]};});_0x161f02[_0x469b('0x3b')]=_['map'](_0x187cee,_0x469b('0x2c'));_0x161f02[_0x469b('0x3c')]=_[_0x469b('0x3d')](_0x433139[_0x469b('0x3c')]);_0x161f02[_0x469b('0x3e')]=_[_0x469b('0x3f')](_0x161f02[_0x469b('0x3b')],_0x161f02['query']);_0xa3be40[_0x469b('0x40')]=_[_0x469b('0x3f')](_0x161f02[_0x469b('0x3b')],qs[_0x469b('0x41')](_0x433139[_0x469b('0x3c')][_0x469b('0x41')]));_0xa3be40[_0x469b('0x40')]=_0xa3be40[_0x469b('0x40')][_0x469b('0x42')]?_0xa3be40['attributes']:_0x161f02[_0x469b('0x3b')];if(!_0x433139[_0x469b('0x3c')][_0x469b('0x43')](_0x469b('0x44'))){_0xa3be40['limit']=qs[_0x469b('0x45')](_0x433139[_0x469b('0x3c')]['limit']);_0xa3be40[_0x469b('0x20')]=qs[_0x469b('0x20')](_0x433139[_0x469b('0x3c')]['offset']);}_0xa3be40[_0x469b('0x46')]=qs['sort'](_0x433139[_0x469b('0x3c')]['sort']);_0xa3be40[_0x469b('0x47')]=qs[_0x469b('0x3e')](_[_0x469b('0x48')](_0x433139['query'],_0x161f02[_0x469b('0x3e')]),_0x187cee);var _0x2b68e5=[];var _0x41a411=squel['select']()[_0x469b('0x49')]('id')[_0x469b('0x49')](_0x469b('0x2c'))[_0x469b('0x49')](_0x469b('0x4a'))[_0x469b('0x4b')]('tools_tags');var _0x48d582=squel[_0x469b('0x4c')]()[_0x469b('0x49')](_0x469b('0x4d'))[_0x469b('0x49')](_0x469b('0x4e'))[_0x469b('0x49')](_0x469b('0x4f'))['from'](_0x469b('0x50'),'ui')[_0x469b('0x51')](_0x469b('0x52'),'u',_0x469b('0x53'));var _0x57a247=squel[_0x469b('0x4c')]()['from'](_0x469b('0x54'),'i')[_0x469b('0x51')]('cm_contacts','c',_0x469b('0x55'))['left_join']('users','o',_0x469b('0x56'))['left_join'](_0x469b('0x57'),'a',_0x469b('0x58'))[_0x469b('0x51')](_0x469b('0x59'),'me',_0x469b('0x5a'))[_0x469b('0x51')](_0x469b('0x5b'),'it',_0x469b('0x5c'))[_0x469b('0x51')](_0x469b('0x5d'),'t',_0x469b('0x5e'));var _0x5570e3=squel[_0x469b('0x5f')]();var _0x1217de=[];var _0x485785=squel[_0x469b('0x5f')]();var _0x5d8c10;if(_0x433139[_0x469b('0x3c')]['search']){_0x5d8c10=as[_0x469b('0x60')](_0x433139[_0x469b('0x3c')][_0x469b('0x61')]);var _0x21714a=_0x5d8c10['sqlOperator'];for(var _0x2654ef=0x0;_0x2654ef<_0x5d8c10[_0x469b('0x62')]['length'];_0x2654ef++){var _0x45d2b0=_0x5d8c10[_0x469b('0x62')][_0x2654ef];var _0x13b79e='i';var _0x4e5fe=_['find'](_0x187cee,[_0x469b('0x2c'),_0x45d2b0[_0x469b('0x49')]]);if(!_0x4e5fe){switch(_0x45d2b0[_0x469b('0x49')]){case _0x469b('0x63'):if(_0x45d2b0[_0x469b('0x64')]==0x1){_0x57a247[_0x469b('0x65')]('`'+_0x45d2b0[_0x469b('0x49')]+_0x469b('0x66'));}else{_0x57a247['having']('`'+_0x45d2b0[_0x469b('0x49')]+'`\x20>\x200');}break;case _0x469b('0x67'):if(_0x45d2b0[_0x469b('0x68')]==='$substring'){if(_0x45d2b0[_0x469b('0x64')][_0x469b('0x32')]('\x20')[_0x469b('0x42')]>0x1){_0x5570e3[_0x21714a](_0x469b('0x69'),qs[_0x469b('0x6a')](_0x45d2b0[_0x469b('0x64')]),null);}else{var _0x2245fd='%'+_0x45d2b0[_0x469b('0x64')]+'%';_0x5570e3[_0x21714a](_0x469b('0x6b'),_0x2245fd,_0x2245fd,_0x2245fd);}}else{_0x4e5fe=_['find'](_0x187cee,['name',_0x469b('0x6c')]);_0x45d2b0[_0x469b('0x49')]=_0x469b('0x6c');_0x3e6fb1=as[_0x469b('0x6d')](_0x13b79e,_0x4e5fe[_0x469b('0x39')],_0x45d2b0);_0x5570e3[_0x21714a](_0x3e6fb1[_0x469b('0x6e')],_0x3e6fb1[_0x469b('0x64')][_0x469b('0x6f')],_0x3e6fb1[_0x469b('0x64')]['end']);}break;case'Tag':var _0x48ed28=_0x45d2b0['value']['split'](',')[_0x469b('0x2f')](function(_0x41a090){return Number(_0x41a090);});_0x48ed28[_0x469b('0x33')](function(_0x2c9ba5){_0x485785['or'](_0x469b('0x70'),'%,'+_0x2c9ba5+',%');});_0x1217de=_['union'](_0x1217de,_0x48ed28);break;case _0x469b('0x71'):if(_0x45d2b0['operator']==='$substring'){_0x5570e3[_0x21714a](_0x469b('0x72'),'%'+_0x45d2b0[_0x469b('0x64')]+'%',null);}else{_0x4e5fe=_['find'](_0x187cee,['name','UserId']);_0x45d2b0[_0x469b('0x49')]=_0x469b('0x73');_0x3e6fb1=as[_0x469b('0x6d')](_0x13b79e,_0x4e5fe[_0x469b('0x39')],_0x45d2b0);_0x5570e3[_0x21714a](_0x3e6fb1[_0x469b('0x6e')],_0x3e6fb1['value'][_0x469b('0x6f')],_0x3e6fb1[_0x469b('0x64')][_0x469b('0x29')]);}break;case _0x469b('0x74'):_0x3e6fb1=as['buildExpression']('me',null,_0x45d2b0);_0x5570e3[_0x21714a](_0x3e6fb1[_0x469b('0x6e')],_0x3e6fb1['value'][_0x469b('0x6f')],_0x3e6fb1[_0x469b('0x64')]['end']);break;}}else{var _0x3e6fb1=as[_0x469b('0x6d')](_0x13b79e,_0x4e5fe[_0x469b('0x39')],_0x45d2b0);_0x5570e3[_0x21714a](_0x3e6fb1[_0x469b('0x6e')],_0x3e6fb1[_0x469b('0x64')]['start'],_0x3e6fb1['value']['end']);}}}else{var _0x248bd1=_(_0x433139[_0x469b('0x3c')])[_0x469b('0x3d')]()[_0x469b('0x2f')](function(_0x2b4ab7){return _[_0x469b('0x75')](_0x187cee,['name',_0x2b4ab7])?_0x2b4ab7:undefined;})['compact']()[_0x469b('0x64')]();if(!_[_0x469b('0x76')](_0x248bd1)){_0x248bd1[_0x469b('0x33')](function(_0x3ce40e){if(_0x3ce40e==='OpenchannelAccountId'){_0x57a247[_0x469b('0x47')](_0x469b('0x77'),[][_0x469b('0x78')](_0x433139[_0x469b('0x3c')][_0x3ce40e]));}else if(_0x3ce40e===_0x469b('0x79')){var _0x2953f9=JSON[_0x469b('0x7a')](_0x433139['query'][_0x3ce40e])[_0x469b('0x7b')];var _0x14c904=JSON[_0x469b('0x7a')](_0x433139['query'][_0x3ce40e])[_0x469b('0x7c')];_0x57a247[_0x469b('0x47')](_0x469b('0x7d'),_0x2953f9,_0x14c904);}else{if(_0x433139[_0x469b('0x3c')][_0x3ce40e]===_0x469b('0x7e')){_0x57a247[_0x469b('0x47')]('i.'+_0x3ce40e+'\x20IS\x20NULL');}else{_0x57a247[_0x469b('0x47')]('i.'+_0x3ce40e+_0x469b('0x7f'),_0x433139[_0x469b('0x3c')][_0x3ce40e]);}}});}if(_0x433139[_0x469b('0x3c')][_0x469b('0x80')]){if(_0x433139[_0x469b('0x3c')][_0x469b('0x80')]==0x1){_0x57a247['having'](_0x469b('0x81'));}else{_0x57a247['having'](_0x469b('0x82'));}}if(_0x433139[_0x469b('0x3c')][_0x469b('0x83')]){_0x1217de=_[_0x469b('0x84')](_0x433139['query']['tag'])?_0x433139['query'][_0x469b('0x83')]:new Array(_0x433139[_0x469b('0x3c')][_0x469b('0x83')]);_0x1217de[_0x469b('0x33')](function(_0x40dca3){_0x485785['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x40dca3+',%');});}if(_0x433139[_0x469b('0x3c')]['filter']){var _0xb8178a=_0x433139[_0x469b('0x3c')][_0x469b('0x85')][_0x469b('0x86')]('\x5c','\x5c\x5c')[_0x469b('0x86')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x469b('0x87')](_0xb8178a)){_0x5570e3['or'](_0x469b('0x88'),_0xb8178a+'%');}else{_0x5570e3['or'](_0x469b('0x89'),qs['getFullTextValue'](_0xb8178a))['or'](_0x469b('0x8a'),_0xb8178a+'%')['or'](_0x469b('0x8b'),_0xb8178a+'%');}}}_0x57a247[_0x469b('0x47')](_0x5570e3);_0x57a247[_0x469b('0x8c')](_0x469b('0x8d'));var _0x252c64={'type':db[_0x469b('0x8e')]['QueryTypes'][_0x469b('0x8f')],'raw':!![]};var _0x1508bf=_0x57a247[_0x469b('0x90')]();_0x1508bf[_0x469b('0x49')](_0x469b('0x8d'));_0x1508bf[_0x469b('0x49')](_0x469b('0x91'),_0x469b('0x63'));if(_0xa3be40['order']){_0xa3be40[_0x469b('0x46')]['forEach'](function(_0x387011){_0x57a247[_0x469b('0x46')]('i.'+_0x387011[0x0],_0x387011[0x1]===_0x469b('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x1217de)){_0x57a247[_0x469b('0x65')](_0x485785);_0x1508bf[_0x469b('0x47')]('t.id\x20IN\x20?',_0x1217de);}BPromise['resolve']()[_0x469b('0x27')](function(){if(!_0x5d8c10){if(_0x433139[_0x469b('0x3c')][_0x469b('0x93')]||_0x433139[_0x469b('0x3c')][_0x469b('0x94')])return;_0x1508bf['where'](_0x469b('0x95'));_0x57a247[_0x469b('0x47')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x433139[_0x469b('0x96')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x469b('0x27')](function(_0x189bd1){if(_[_0x469b('0x76')](_0x189bd1)){_0x1508bf[_0x469b('0x47')](_0x469b('0x97'));_0x57a247[_0x469b('0x47')](_0x469b('0x97'));}else{_0x1508bf[_0x469b('0x47')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x189bd1,'id'));_0x57a247[_0x469b('0x47')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x469b('0x2f')](_0x189bd1,'id'));}});})[_0x469b('0x27')](function(){db[_0x469b('0x98')][_0x469b('0x3c')](_0x1508bf[_0x469b('0x99')](),_0x252c64)[_0x469b('0x27')](function(_0x136b88){_0x3fb683[_0x469b('0x1f')]=_0x136b88[_0x469b('0x42')];if(_0x3fb683['count']===0x0)return[];return db[_0x469b('0x98')]['query'](_0x41a411[_0x469b('0x99')](),_0x252c64)[_0x469b('0x27')](function(_0x2b989e){_0x2b68e5=_[_0x469b('0x9a')](_0x2b989e,'id');_0x252c64=_[_0x469b('0x9b')](_0x252c64,{'model':db[_0x469b('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x433139[_0x469b('0x3c')][_0x469b('0x41')]){_0xa3be40[_0x469b('0x40')][_0x469b('0x33')](function(_0x1e5d04){_0x57a247[_0x469b('0x49')]('i.'+_0x1e5d04);});}else{_0x57a247[_0x469b('0x49')](_0x469b('0x91'),'unreadMessages');_0x57a247[_0x469b('0x49')](_0x469b('0x9c'),_0x469b('0x9d'));_0x57a247[_0x469b('0x49')](_0x469b('0x9e'),'Account.mandatoryDisposition');_0x57a247[_0x469b('0x49')](_0x469b('0x9f'));_0x57a247[_0x469b('0x49')](_0x469b('0xa0'),_0x469b('0xa1'));_0x57a247[_0x469b('0x49')](_0x469b('0xa2'),_0x469b('0xa3'));_0x57a247['field'](_0x469b('0xa4'),_0x469b('0xa5'));_0x57a247['field'](_0x469b('0xa6'),_0x469b('0xa7'));_0x57a247[_0x469b('0x49')]('c.mobile','Contact.mobile');_0x57a247[_0x469b('0x49')](_0x469b('0xa8'),'Contact.fax');_0x57a247[_0x469b('0x49')](_0x469b('0xa9'),_0x469b('0xaa'));_0x57a247[_0x469b('0x49')](_0x469b('0xab'),'Owner.internal');_0x57a247[_0x469b('0x49')](_0x469b('0xac'),_0x469b('0x31'));}if(_0xa3be40[_0x469b('0x45')])_0x57a247[_0x469b('0x45')](_0xa3be40[_0x469b('0x45')]);if(_0xa3be40[_0x469b('0x20')])_0x57a247[_0x469b('0x20')](_0xa3be40['offset']);return db[_0x469b('0x98')]['query'](_0x57a247[_0x469b('0x99')](),_0x252c64);})[_0x469b('0x27')](function(_0x73943e){_0x48d582['where'](_0x469b('0xad'),_[_0x469b('0x2f')](_0x73943e,'id'));return db['sequelize'][_0x469b('0x3c')](_0x48d582['toString'](),_0x252c64)[_0x469b('0x27')](function(_0x3b9af6){var _0x696394=_[_0x469b('0xae')](_0x3b9af6,_0x469b('0xaf'));var _0x9c079c=[];_0x73943e[_0x469b('0x33')](function(_0x326e73){_0x9c079c['push'](updateOpenchannelInteraction(_0x326e73,_0x2b68e5,_0x696394));});return BPromise[_0x469b('0xb0')](_0x9c079c);});});})[_0x469b('0x27')](function(_0x4c90dc){_0x3fb683[_0x469b('0xb1')]=_0x4c90dc;return _0x3fb683;})[_0x469b('0x27')](respondWithFilteredResult(_0x28f5c1,_0xa3be40));})[_0x469b('0xb2')](handleError(_0x28f5c1,null));};exports[_0x469b('0xb3')]=function(_0xd7a55f,_0x2c07cc){var _0x5c69f7={'raw':![],'where':{'id':_0xd7a55f['params']['id']}},_0x469c25={};_0x469c25[_0x469b('0x3b')]=_[_0x469b('0x3d')](db['OpenchannelInteraction'][_0x469b('0x38')]);_0x469c25['query']=_[_0x469b('0x3d')](_0xd7a55f[_0x469b('0x3c')]);_0x469c25[_0x469b('0x3e')]=_[_0x469b('0x3f')](_0x469c25['model'],_0x469c25[_0x469b('0x3c')]);_0x5c69f7[_0x469b('0x40')]=_[_0x469b('0x3f')](_0x469c25[_0x469b('0x3b')],qs['fields'](_0xd7a55f[_0x469b('0x3c')][_0x469b('0x41')]));_0x5c69f7[_0x469b('0x40')]=_0x5c69f7[_0x469b('0x40')][_0x469b('0x42')]?_0x5c69f7['attributes']:_0x469c25[_0x469b('0x3b')];if(_0xd7a55f['query'][_0x469b('0xb4')]){_0x5c69f7[_0x469b('0xb5')]=[{'all':!![]}];}_0x5c69f7=_['merge']({},_0x5c69f7,_0xd7a55f[_0x469b('0xb6')]);return db[_0x469b('0x37')][_0x469b('0xb7')](_0x5c69f7)[_0x469b('0x27')](handleEntityNotFound(_0x2c07cc,null))[_0x469b('0x27')](respondWithResult(_0x2c07cc,null))[_0x469b('0xb2')](handleError(_0x2c07cc,null));};exports[_0x469b('0xb8')]=function(_0x6b6944,_0x61f4a5){return db['OpenchannelInteraction'][_0x469b('0xb8')](_0x6b6944['body'],{})['then'](respondWithResult(_0x61f4a5,0xc9))[_0x469b('0xb2')](handleError(_0x61f4a5,null));};exports[_0x469b('0x26')]=function(_0x28d53f,_0x21850b){if(_0x28d53f['body']['id']){delete _0x28d53f[_0x469b('0x74')]['id'];}return db[_0x469b('0x37')]['find']({'where':{'id':_0x28d53f[_0x469b('0xb9')]['id']}})[_0x469b('0x27')](handleEntityNotFound(_0x21850b,null))[_0x469b('0x27')](saveUpdates(_0x28d53f[_0x469b('0x74')],null))[_0x469b('0x27')](respondWithResult(_0x21850b,null))[_0x469b('0xb2')](handleError(_0x21850b,null));};exports['destroy']=function(_0x3bbf58,_0x234ca5){return db[_0x469b('0x37')]['find']({'where':{'id':_0x3bbf58[_0x469b('0xb9')]['id']}})['then'](handleEntityNotFound(_0x234ca5,null))['then'](removeEntity(_0x234ca5,null))[_0x469b('0xb2')](handleError(_0x234ca5,null));};exports[_0x469b('0xba')]=function(_0x23c9e0,_0x582de8){return db[_0x469b('0x37')][_0x469b('0xba')]()['then'](respondWithResult(_0x582de8,null))['catch'](handleError(_0x582de8,null));};exports[_0x469b('0xbb')]=function(_0x408a59,_0x275ac6,_0x27ca85){return db[_0x469b('0xbc')][_0x469b('0xb7')]({'where':{'id':_0x408a59[_0x469b('0xb9')]['id']}})[_0x469b('0x27')](handleEntityNotFound(_0x275ac6,null))[_0x469b('0x27')](function(_0x3aa147){if(_0x3aa147){return _0x3aa147[_0x469b('0xbb')](_0x408a59[_0x469b('0x74')][_0x469b('0xbd')],_['omit'](_0x408a59[_0x469b('0x74')],['ids','id'])||{});}})[_0x469b('0x27')](respondWithResult(_0x275ac6,null))[_0x469b('0xb2')](handleError(_0x275ac6,null));};exports[_0x469b('0xbe')]=function(_0x52f609,_0x2a86fb,_0x35815a){var _0x182b2c={'raw':![],'where':{}};var _0x42d738={};var _0x26eb7c={'count':0x0,'rows':[]};return db[_0x469b('0x37')]['findOne']({'where':{'id':_0x52f609['params']['id']}})['then'](handleEntityNotFound(_0x2a86fb,null))[_0x469b('0x27')](function(_0x22c8ef){if(_0x22c8ef){_0x42d738[_0x469b('0x3b')]=_[_0x469b('0x3d')](db[_0x469b('0xbc')][_0x469b('0x38')]);_0x42d738[_0x469b('0x3c')]=_['keys'](_0x52f609[_0x469b('0x3c')]);_0x42d738[_0x469b('0x3e')]=_[_0x469b('0x3f')](_0x42d738[_0x469b('0x3b')],_0x42d738[_0x469b('0x3c')]);_0x182b2c[_0x469b('0x40')]=_['intersection'](_0x42d738[_0x469b('0x3b')],qs[_0x469b('0x41')](_0x52f609[_0x469b('0x3c')][_0x469b('0x41')]));_0x182b2c[_0x469b('0x40')]=_0x182b2c[_0x469b('0x40')]['length']?_0x182b2c['attributes']:_0x42d738[_0x469b('0x3b')];if(!_0x52f609[_0x469b('0x3c')][_0x469b('0x43')]('nolimit')){_0x182b2c[_0x469b('0x45')]=qs['limit'](_0x52f609['query'][_0x469b('0x45')]);_0x182b2c[_0x469b('0x20')]=qs[_0x469b('0x20')](_0x52f609[_0x469b('0x3c')][_0x469b('0x20')]);}_0x182b2c[_0x469b('0x46')]=qs[_0x469b('0xbf')](_0x52f609[_0x469b('0x3c')][_0x469b('0xbf')]);_0x182b2c[_0x469b('0x47')]=qs['filters'](_['pick'](_0x52f609[_0x469b('0x3c')],_0x42d738[_0x469b('0x3e')]));_0x182b2c[_0x469b('0x47')]['OpenchannelInteractionId']=_0x22c8ef['id'];if(_0x52f609[_0x469b('0x3c')][_0x469b('0x85')]){_0x182b2c[_0x469b('0x47')]=_[_0x469b('0x9b')](_0x182b2c[_0x469b('0x47')],{'$or':_[_0x469b('0x2f')](_0x182b2c[_0x469b('0x40')],function(_0x5745e2){var _0x1d8630={};_0x1d8630[_0x5745e2]={'$like':'%'+_0x52f609[_0x469b('0x3c')][_0x469b('0x85')]+'%'};return _0x1d8630;})});}if(_0x52f609[_0x469b('0x3c')][_0x469b('0x7b')]){var _0x352cd1=_0x52f609['query'][_0x469b('0x7b')][_0x469b('0x32')](',');var _0x1b8ef7={};_0x1b8ef7[_0x352cd1[0x0]]={'$gte':moment(_0x352cd1[0x1])[_0x469b('0xc0')](_0x469b('0xc1'))};_0x182b2c['where']=_[_0x469b('0x9b')](_0x182b2c[_0x469b('0x47')],_0x1b8ef7);}_0x182b2c=_[_0x469b('0x9b')]({},_0x182b2c,_0x52f609[_0x469b('0xb6')]);return db[_0x469b('0xbc')][_0x469b('0x1f')]({'where':_0x182b2c[_0x469b('0x47')]})[_0x469b('0x27')](function(_0x24ed22){_0x26eb7c['count']=_0x24ed22;if(_0x52f609[_0x469b('0x3c')][_0x469b('0xb4')]){_0x182b2c['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x469b('0xc2')](_0x182b2c);})['then'](function(_0x511e8d){_0x26eb7c['rows']=_0x511e8d;return _0x26eb7c;});}})[_0x469b('0x27')](respondWithFilteredResult(_0x2a86fb,_0x182b2c))[_0x469b('0xb2')](handleError(_0x2a86fb,null));};exports['addTags']=function(_0x539589,_0x30f2c0,_0x491167){return db[_0x469b('0x37')][_0x469b('0xb7')]({'where':{'id':_0x539589[_0x469b('0xb9')]['id']}})[_0x469b('0x27')](handleEntityNotFound(_0x30f2c0,null))[_0x469b('0x27')](function(_0x3f0bea){if(_0x3f0bea){return _0x3f0bea[_0x469b('0xc3')](_0x539589[_0x469b('0x74')][_0x469b('0xbd')],_[_0x469b('0xc4')](_0x539589[_0x469b('0x74')],[_0x469b('0xbd'),'id'])||{})['spread'](function(){return db[_0x469b('0xc5')][_0x469b('0xc2')]({'attributes':['id',_0x469b('0x2c'),_0x469b('0x4a')],'where':{'id':_0x539589[_0x469b('0x74')]['ids']}});})['then'](function(_0x2af8b7){socket['emit'](_0x469b('0xc6'),{'id':Number(_0x539589[_0x469b('0xb9')]['id']),'tags':_0x2af8b7||[]});return{'id':Number(_0x539589[_0x469b('0xb9')]['id']),'tags':_0x2af8b7||[]};});}})[_0x469b('0x27')](respondWithResult(_0x30f2c0,null))[_0x469b('0xb2')](handleError(_0x30f2c0,null));};exports[_0x469b('0xc7')]=function(_0x3728f5,_0x405249,_0x4d8b2d){return db[_0x469b('0x37')][_0x469b('0xb7')]({'where':{'id':_0x3728f5['params']['id']}})[_0x469b('0x27')](handleEntityNotFound(_0x405249,null))['then'](function(_0x16f239){if(_0x16f239){return _0x16f239[_0x469b('0xc7')](_0x3728f5[_0x469b('0x3c')][_0x469b('0xbd')]);}})[_0x469b('0x27')](respondWithStatusCode(_0x405249,null))[_0x469b('0xb2')](handleError(_0x405249,null));};exports[_0x469b('0xc8')]=function(_0x570146,_0x4d7468){var _0x1074a6=moment()[_0x469b('0xc9')]()[_0x469b('0x99')]();var _0x10b2a6=path[_0x469b('0xca')](config[_0x469b('0xcb')],_0x469b('0xcc'),_0x469b('0xcd'),'tmp');var _0x2ba748=path[_0x469b('0xca')](config[_0x469b('0xcb')],_0x469b('0xcc'),'files',_0x469b('0xce'));var _0x379290=path['join'](_0x10b2a6,_0x1074a6);var _0xa59730=util['format'](_0x469b('0xcf'),_0x570146[_0x469b('0xb9')]['id'],_0x1074a6);var _0x3d0fab=path[_0x469b('0xca')](_0x10b2a6,_0xa59730);var _0x8d301c=[];_0x8d301c[_0x469b('0x35')]({'model':db[_0x469b('0x71')],'as':_0x469b('0x71'),'attributes':['id','fullname'],'raw':!![]});_0x8d301c[_0x469b('0x35')]({'model':db['CmContact'],'as':_0x469b('0x67'),'attributes':['id',_0x469b('0xd0'),_0x469b('0xd1')],'raw':!![]});if(_0x570146[_0x469b('0x3c')][_0x469b('0xce')]){_0x8d301c[_0x469b('0x35')]({'model':db[_0x469b('0xd2')],'as':_0x469b('0xd2'),'raw':!![]});}var _0x5e702e=[{'model':db[_0x469b('0xbc')],'as':'Messages','attributes':['id',_0x469b('0x74'),'createdAt',_0x469b('0xd3'),'secret',_0x469b('0x80')],'include':_0x8d301c}];_0x5e702e[_0x469b('0x35')]({'model':db[_0x469b('0xd4')],'as':_0x469b('0xd5'),'attributes':['id',_0x469b('0x2c')]});_0x5e702e['push']({'model':db[_0x469b('0x71')],'as':_0x469b('0xd6'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x469b('0xb7')]({'where':{'id':_0x570146[_0x469b('0xb9')]['id']},'include':_0x5e702e})['then'](handleEntityNotFound(_0x4d7468,null))[_0x469b('0x27')](function(_0x433608){if(_0x433608){var _0x537749=_0x433608[_0x469b('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x379290);var _0x16b12a={'format':'A4','border':'10px','header':{'height':_0x469b('0xd8'),'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':'30px','contents':{'default':util[_0x469b('0xc0')](_0x469b('0xd9'),util[_0x469b('0xc0')](_0x469b('0xda'),_0x469b('0xdb'),_0x537749['id']),moment()[_0x469b('0xc0')](_0x469b('0xdc'))['toString']())}}};var _0xf525d2={'channel':'Openchannel','account':_0x537749['Account'][_0x469b('0x2c')],'agent':_0x537749[_0x469b('0xd6')]?_0x537749[_0x469b('0xd6')][_0x469b('0x30')]:_0x469b('0xdd'),'createdAt':moment(_0x537749[_0x469b('0x79')])[_0x469b('0xc0')](_0x469b('0xc1'))[_0x469b('0x99')](),'closedAt':_0x537749[_0x469b('0xde')]?moment(_0x537749['closedAt'])['format'](_0x469b('0xc1'))['toString']():'','disposition':_0x537749['disposition'],'visibility':_0x537749['threadId']?_0x469b('0xdf'):_0x469b('0xe0'),'messages':_(_0x537749[_0x469b('0xe1')])[_0x469b('0x85')]({'secret':![]})[_0x469b('0x2f')](function(_0x523021){if(_0x523021[_0x469b('0xd2')]){var _0x411b6a=path['join'](_0x2ba748,_0x523021[_0x469b('0xd2')][_0x469b('0xe2')]);if(fs['existsSync'](_0x411b6a)){fs[_0x469b('0xe3')](_0x411b6a)[_0x469b('0xe4')](fs['createWriteStream'](path[_0x469b('0xca')](_0x379290,_0x523021[_0x469b('0xd2')]['basename'])));}}return{'date':moment(_0x523021[_0x469b('0x79')])[_0x469b('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x523021[_0x469b('0xd3')]===_0x469b('0xe5')?_0x523021[_0x469b('0x71')]?_0x523021[_0x469b('0x71')][_0x469b('0x30')]:_0x469b('0xe6'):_0x523021[_0x469b('0x67')][_0x469b('0xd0')]+(_0x523021[_0x469b('0x67')]['lastName']?'\x20'+_0x523021[_0x469b('0x67')]['lastName']:''),'body':_0x523021[_0x469b('0xd2')]?_0x523021[_0x469b('0xd2')][_0x469b('0xe2')]:_0x523021['body'],'direction':_0x523021[_0x469b('0xd3')]===_0x469b('0xe5')?'A':'C','secret':_0x523021['secret'],'read':_0x523021[_0x469b('0x80')],'attachment':_0x523021[_0x469b('0xd2')]};})[_0x469b('0x64')]()};return ejs[_0x469b('0xe7')](path[_0x469b('0xca')](config[_0x469b('0xcb')],'server',_0x469b('0xe8'),_0x469b('0xe9')),{'interaction':_0xf525d2})[_0x469b('0x27')](function(_0x5a0d39){return new BPromise(function(_0x555a19,_0x228191){pdf[_0x469b('0xb8')](_0x5a0d39,_0x16b12a)[_0x469b('0xea')](path[_0x469b('0xca')](_0x379290,'transcript-'+_0x537749['id']+'-'+_0x1074a6+_0x469b('0xeb')),function(_0x47f1fd,_0x1bde46){if(_0x47f1fd)return _0x228191(_0x47f1fd);_0x555a19(_0x1bde46);});});})[_0x469b('0x27')](function(){return new BPromise(function(_0x1cc6e7,_0x1f5317){zipdir(_0x379290,{'saveTo':_0x3d0fab},function(_0x7ace00,_0x3f51bd){if(_0x7ace00)return _0x1f5317(_0x7ace00);return _0x1cc6e7(_0x3f51bd);});})[_0x469b('0x27')](function(){return new BPromise(function(_0x17c20c,_0x383a78){rimraf(_0x379290,function(_0x1fb3e9){if(_0x1fb3e9)_0x383a78(_0x1fb3e9);return _0x17c20c();});});})[_0x469b('0x27')](function(){return _0x4d7468['download'](_0x3d0fab,_0xa59730,function(_0x3dbbb2){if(_0x3dbbb2){console[_0x469b('0xec')](_0x469b('0xed'),_0x3dbbb2);}else{fs['unlinkSync'](_0x3d0fab);}});});});}else{return _0x4d7468[_0x469b('0x1c')](0xc8);}})['catch'](handleError(_0x4d7468,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 66c5450..1d7976b 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 _0x01e2=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x5c548a,_0x4c9331){var _0x4bb4f7=function(_0x3657d9){while(--_0x3657d9){_0x5c548a['push'](_0x5c548a['shift']());}};_0x4bb4f7(++_0x4c9331);}(_0x01e2,0x120));var _0x201e=function(_0x58d9a1,_0x46312c){_0x58d9a1=_0x58d9a1-0x0;var _0x5dbcf3=_0x01e2[_0x58d9a1];return _0x5dbcf3;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x201e('0x0')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x201e('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x201e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x201e('0x3')};function emitEvent(_0xc44a96){return function(_0x3e9162,_0x28c0d6,_0x335df5){_0x3e9162[_0x201e('0x4')]({'attributes':['id'],'raw':!![]})[_0x201e('0x5')](function(_0x196d04){_0x3e9162[_0x201e('0x6')](_0x201e('0x7'),_0x196d04[_0x201e('0x8')](function(_0x292468){return{'id':_0x292468['id']};}));return OpenchannelMessage[_0x201e('0x9')]({'where':{'OpenchannelInteractionId':_0x3e9162['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2374ed){_0x3e9162[_0x201e('0x6')]('unreadMessages',_0x2374ed[_0x201e('0xa')]);OpenchannelInteractionEvents['emit'](_0xc44a96+':'+_0x3e9162['id'],_0x3e9162);OpenchannelInteractionEvents[_0x201e('0xb')](_0xc44a96,_0x3e9162);_0x335df5(null);})[_0x201e('0xc')](_0x335df5(null));};}for(var e in events){if(events[_0x201e('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x201e('0xe')](e,emitEvent(event));}}module[_0x201e('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4c48=['getUsers','then','map','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update'];(function(_0x1aac4a,_0x5aa689){var _0x29f4b8=function(_0x530a56){while(--_0x530a56){_0x1aac4a['push'](_0x1aac4a['shift']());}};_0x29f4b8(++_0x5aa689);}(_0x4c48,0x18f));var _0x84c4=function(_0x3f4cd0,_0x303070){_0x3f4cd0=_0x3f4cd0-0x0;var _0x3f9f01=_0x4c48[_0x3f4cd0];return _0x3f9f01;};'use strict';var EventEmitter=require(_0x84c4('0x0'));var OpenchannelInteraction=require(_0x84c4('0x1'))['db'][_0x84c4('0x2')];var OpenchannelMessage=require(_0x84c4('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x84c4('0x3')](0x0);var events={'afterCreate':_0x84c4('0x4'),'afterUpdate':_0x84c4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3e5deb){return function(_0x4d2088,_0x1f95a3,_0x5adade){_0x4d2088[_0x84c4('0x6')]({'attributes':['id'],'raw':!![]})[_0x84c4('0x7')](function(_0x416da6){_0x4d2088['setDataValue']('Users',_0x416da6[_0x84c4('0x8')](function(_0x13372f){return{'id':_0x13372f['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4d2088['id'],'direction':'in','read':![]},'raw':!![]});})[_0x84c4('0x7')](function(_0x59adca){_0x4d2088['setDataValue'](_0x84c4('0x9'),_0x59adca[_0x84c4('0xa')]);OpenchannelInteractionEvents[_0x84c4('0xb')](_0x3e5deb+':'+_0x4d2088['id'],_0x4d2088);OpenchannelInteractionEvents[_0x84c4('0xb')](_0x3e5deb,_0x4d2088);_0x5adade(null);})[_0x84c4('0xc')](_0x5adade(null));};}for(var e in events){if(events[_0x84c4('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x84c4('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0e4a17d..f2533d5 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 _0xf7a4=['OpenchannelInteraction','openchannel_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define'];(function(_0x3a6239,_0x45d7e8){var _0x43542d=function(_0x1f5fd2){while(--_0x1f5fd2){_0x3a6239['push'](_0x3a6239['shift']());}};_0x43542d(++_0x45d7e8);}(_0xf7a4,0x195));var _0x4f7a=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xf7a4[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x4f7a('0x0'));var util=require(_0x4f7a('0x1'));var logger=require(_0x4f7a('0x2'))(_0x4f7a('0x3'));var moment=require(_0x4f7a('0x4'));var BPromise=require('bluebird');var rp=require(_0x4f7a('0x5'));var fs=require('fs');var path=require(_0x4f7a('0x6'));var rimraf=require(_0x4f7a('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f7a('0x8'));module[_0x4f7a('0x9')]=function(_0x23699f,_0x20ad50){return _0x23699f[_0x4f7a('0xa')](_0x4f7a('0xb'),attributes,{'tableName':_0x4f7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4bc132,_0xd4b3dd,_0x4b9fb2){if(_0x4bc132[_0x4f7a('0xd')](_0x4f7a('0xe'))){_0x4bc132['closedAt']=moment()['format'](_0x4f7a('0xf'));}_0x4b9fb2(null,_0x4bc132);}}});}; \ No newline at end of file +var _0x6a49=['path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','format','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6a49,0x19a));var _0x96a4=function(_0x1bcadf,_0x12b827){_0x1bcadf=_0x1bcadf-0x0;var _0x39ed2c=_0x6a49[_0x1bcadf];return _0x39ed2c;};'use strict';var _=require(_0x96a4('0x0'));var util=require(_0x96a4('0x1'));var logger=require(_0x96a4('0x2'))(_0x96a4('0x3'));var moment=require(_0x96a4('0x4'));var BPromise=require(_0x96a4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96a4('0x6'));var rimraf=require(_0x96a4('0x7'));var config=require('../../config/environment');var attributes=require(_0x96a4('0x8'));module[_0x96a4('0x9')]=function(_0x37c4c0,_0x20e8ed){return _0x37c4c0[_0x96a4('0xa')](_0x96a4('0xb'),attributes,{'tableName':_0x96a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a2e55,_0x5c6ef9,_0xe02d9c){if(_0x1a2e55[_0x96a4('0xd')](_0x96a4('0xe'))){_0x1a2e55['closedAt']=moment()[_0x96a4('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0xe02d9c(null,_0x1a2e55);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index f32ddc9..7032634 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 _0xfb37=['UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','debug','AddTagsToOpenchannelInteraction','find','addTags','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4a6462,_0x61b1b5){var _0x122407=function(_0x42618b){while(--_0x42618b){_0x4a6462['push'](_0x4a6462['shift']());}};_0x122407(++_0x61b1b5);}(_0xfb37,0x8a));var _0x7fb3=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0xfb37[_0x1f7839];return _0x36b42e;};'use strict';var _=require(_0x7fb3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7fb3('0x1'));var rs=require(_0x7fb3('0x2'));var fs=require('fs');var Redis=require(_0x7fb3('0x3'));var db=require(_0x7fb3('0x4'))['db'];var utils=require(_0x7fb3('0x5'));var logger=require(_0x7fb3('0x6'))('rpc');var config=require(_0x7fb3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7fb3('0x8')][_0x7fb3('0x9')]({'port':0x232a});config[_0x7fb3('0xa')]=_['defaults'](config[_0x7fb3('0xa')],{'host':_0x7fb3('0xb'),'port':0x18eb});var socket=require(_0x7fb3('0xc'))(new Redis(config[_0x7fb3('0xa')]));require('./openchannelInteraction.socket')[_0x7fb3('0xd')](socket);function respondWithRpcPromise(_0x4475c6,_0x515319,_0x4be776){return new BPromise(function(_0x1a63ed,_0xc04163){return client[_0x7fb3('0xe')](_0x4475c6,_0x4be776)[_0x7fb3('0xf')](function(_0x5f0d05){logger[_0x7fb3('0x10')](_0x7fb3('0x11'),_0x515319,'request\x20sent');logger['debug'](_0x7fb3('0x12'),_0x515319,_0x7fb3('0x13'),JSON[_0x7fb3('0x14')](_0x5f0d05));if(_0x5f0d05[_0x7fb3('0x15')]){if(_0x5f0d05[_0x7fb3('0x15')][_0x7fb3('0x16')]===0x1f4){logger['error'](_0x7fb3('0x11'),_0x515319,_0x5f0d05[_0x7fb3('0x15')][_0x7fb3('0x17')]);return _0xc04163(_0x5f0d05[_0x7fb3('0x15')][_0x7fb3('0x17')]);}logger[_0x7fb3('0x15')](_0x7fb3('0x11'),_0x515319,_0x5f0d05['error']['message']);return _0x1a63ed(_0x5f0d05['error'][_0x7fb3('0x17')]);}else{logger[_0x7fb3('0x10')](_0x7fb3('0x11'),_0x515319,'request\x20sent');_0x1a63ed(_0x5f0d05[_0x7fb3('0x18')][_0x7fb3('0x17')]);}})[_0x7fb3('0x19')](function(_0x1875b2){logger[_0x7fb3('0x15')](_0x7fb3('0x11'),_0x515319,_0x1875b2);_0xc04163(_0x1875b2);});});}exports[_0x7fb3('0x1a')]=function(_0x557438){var _0x3642ca=this;return new Promise(function(_0x59d7c2,_0x4d0e28){return db[_0x7fb3('0x1b')][_0x7fb3('0x1c')](_0x557438[_0x7fb3('0x1d')],{'raw':_0x557438[_0x7fb3('0x1e')]?_0x557438[_0x7fb3('0x1e')][_0x7fb3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x557438[_0x7fb3('0x1e')]?_0x557438[_0x7fb3('0x1e')][_0x7fb3('0x20')]||null:null,'attributes':_0x557438[_0x7fb3('0x1e')]?_0x557438['options']['attributes']||null:null,'limit':_0x557438[_0x7fb3('0x1e')]?_0x557438[_0x7fb3('0x1e')][_0x7fb3('0x21')]||null:null})['then'](function(_0x48c9ce){logger['info'](_0x7fb3('0x1a'),_0x557438);logger[_0x7fb3('0x22')]('UpdateOpenchannelInteraction',_0x557438,JSON[_0x7fb3('0x14')](_0x48c9ce));_0x59d7c2(_0x48c9ce);})[_0x7fb3('0x19')](function(_0x17da43){logger['error'](_0x7fb3('0x1a'),_0x17da43['message'],_0x557438);_0x4d0e28(_0x3642ca[_0x7fb3('0x15')](0x1f4,_0x17da43[_0x7fb3('0x17')]));});});};exports[_0x7fb3('0x23')]=function(_0x18428a){return new Promise(function(_0x51eb17,_0x52bbdb){return db[_0x7fb3('0x1b')][_0x7fb3('0x24')]({'where':_0x18428a['options']?_0x18428a['options']['where']||null:null})[_0x7fb3('0xf')](function(_0x45485d){if(_0x45485d){return _0x45485d[_0x7fb3('0x25')](_0x18428a[_0x7fb3('0x1d')]['ids'],_[_0x7fb3('0x26')](_0x18428a[_0x7fb3('0x1d')],['ids','id'])||{});}})[_0x7fb3('0x27')](function(_0x106925){logger['info'](_0x7fb3('0x28'),_0x18428a);logger[_0x7fb3('0x22')](_0x7fb3('0x28'),_0x18428a,JSON[_0x7fb3('0x14')](_0x106925));_0x51eb17(_0x106925);})[_0x7fb3('0x19')](function(_0x302a0b){logger[_0x7fb3('0x15')](_0x7fb3('0x28'),_0x302a0b[_0x7fb3('0x17')],_0x18428a);_0x52bbdb(_this[_0x7fb3('0x15')](0x1f4,_0x302a0b[_0x7fb3('0x17')]));});});}; \ No newline at end of file +var _0x74d3=['message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x31892c,_0x53c36a){var _0x5ead51=function(_0x1b4802){while(--_0x1b4802){_0x31892c['push'](_0x31892c['shift']());}};_0x5ead51(++_0x53c36a);}(_0x74d3,0x15c));var _0x374d=function(_0x36770e,_0x152503){_0x36770e=_0x36770e-0x0;var _0x30d73b=_0x74d3[_0x36770e];return _0x30d73b;};'use strict';var _=require(_0x374d('0x0'));var util=require(_0x374d('0x1'));var moment=require(_0x374d('0x2'));var BPromise=require(_0x374d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x374d('0x4'));var db=require(_0x374d('0x5'))['db'];var utils=require(_0x374d('0x6'));var logger=require('../../config/logger')(_0x374d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x374d('0x8')][_0x374d('0x9')]({'port':0x232a});config[_0x374d('0xa')]=_['defaults'](config[_0x374d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x374d('0xb'))(new Redis(config[_0x374d('0xa')]));require(_0x374d('0xc'))['register'](socket);function respondWithRpcPromise(_0x339eb1,_0x35512d,_0x279046){return new BPromise(function(_0x370125,_0x4d3135){return client['request'](_0x339eb1,_0x279046)[_0x374d('0xd')](function(_0x46d61e){logger[_0x374d('0xe')](_0x374d('0xf'),_0x35512d,_0x374d('0x10'));logger['debug'](_0x374d('0x11'),_0x35512d,'request\x20sent',JSON[_0x374d('0x12')](_0x46d61e));if(_0x46d61e[_0x374d('0x13')]){if(_0x46d61e[_0x374d('0x13')][_0x374d('0x14')]===0x1f4){logger[_0x374d('0x13')](_0x374d('0xf'),_0x35512d,_0x46d61e['error'][_0x374d('0x15')]);return _0x4d3135(_0x46d61e[_0x374d('0x13')][_0x374d('0x15')]);}logger['error'](_0x374d('0xf'),_0x35512d,_0x46d61e['error'][_0x374d('0x15')]);return _0x370125(_0x46d61e['error'][_0x374d('0x15')]);}else{logger[_0x374d('0xe')](_0x374d('0xf'),_0x35512d,_0x374d('0x10'));_0x370125(_0x46d61e[_0x374d('0x16')][_0x374d('0x15')]);}})[_0x374d('0x17')](function(_0x4a979d){logger[_0x374d('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x35512d,_0x4a979d);_0x4d3135(_0x4a979d);});});}exports[_0x374d('0x18')]=function(_0x3deb2b){var _0x45506c=this;return new Promise(function(_0x482b5a,_0x19efdd){return db[_0x374d('0x19')][_0x374d('0x1a')](_0x3deb2b[_0x374d('0x1b')],{'raw':_0x3deb2b[_0x374d('0x1c')]?_0x3deb2b[_0x374d('0x1c')][_0x374d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3deb2b[_0x374d('0x1c')]?_0x3deb2b[_0x374d('0x1c')]['where']||null:null,'attributes':_0x3deb2b['options']?_0x3deb2b[_0x374d('0x1c')][_0x374d('0x1e')]||null:null,'limit':_0x3deb2b[_0x374d('0x1c')]?_0x3deb2b['options'][_0x374d('0x1f')]||null:null})[_0x374d('0xd')](function(_0x5c0110){logger[_0x374d('0xe')]('UpdateOpenchannelInteraction',_0x3deb2b);logger[_0x374d('0x20')](_0x374d('0x18'),_0x3deb2b,JSON['stringify'](_0x5c0110));_0x482b5a(_0x5c0110);})[_0x374d('0x17')](function(_0x4ccdf0){logger[_0x374d('0x13')](_0x374d('0x18'),_0x4ccdf0[_0x374d('0x15')],_0x3deb2b);_0x19efdd(_0x45506c[_0x374d('0x13')](0x1f4,_0x4ccdf0[_0x374d('0x15')]));});});};exports[_0x374d('0x21')]=function(_0x5dadcf){return new Promise(function(_0x4f2bef,_0x80310a){return db[_0x374d('0x19')][_0x374d('0x22')]({'where':_0x5dadcf[_0x374d('0x1c')]?_0x5dadcf[_0x374d('0x1c')][_0x374d('0x23')]||null:null})[_0x374d('0xd')](function(_0x7d06c4){if(_0x7d06c4){return _0x7d06c4[_0x374d('0x24')](_0x5dadcf[_0x374d('0x1b')][_0x374d('0x25')],_[_0x374d('0x26')](_0x5dadcf['body'],['ids','id'])||{});}})[_0x374d('0x27')](function(_0x4592db){logger[_0x374d('0xe')](_0x374d('0x28'),_0x5dadcf);logger[_0x374d('0x20')](_0x374d('0x28'),_0x5dadcf,JSON[_0x374d('0x12')](_0x4592db));_0x4f2bef(_0x4592db);})[_0x374d('0x17')](function(_0xfde0f0){logger[_0x374d('0x13')](_0x374d('0x28'),_0xfde0f0['message'],_0x5dadcf);_0x80310a(_this[_0x374d('0x13')](0x1f4,_0xfde0f0[_0x374d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f27a60e..7868253 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 _0x0aa5=['./openchannelInteraction.events','save','remove','emit','removeListener','openchannelInteraction:'];(function(_0xf35574,_0x28f942){var _0x63bb2e=function(_0x5c812e){while(--_0x5c812e){_0xf35574['push'](_0xf35574['shift']());}};_0x63bb2e(++_0x28f942);}(_0x0aa5,0x72));var _0x50aa=function(_0x10d309,_0x2eb2ff){_0x10d309=_0x10d309-0x0;var _0x580361=_0x0aa5[_0x10d309];return _0x580361;};'use strict';var OpenchannelInteractionEvents=require(_0x50aa('0x0'));var events=[_0x50aa('0x1'),_0x50aa('0x2'),'update'];function createListener(_0x28c6d7,_0x299117){return function(_0xca638d){_0x299117[_0x50aa('0x3')](_0x28c6d7,_0xca638d);};}function removeListener(_0x2f383c,_0x5bd2a3){return function(){OpenchannelInteractionEvents[_0x50aa('0x4')](_0x2f383c,_0x5bd2a3);};}exports['register']=function(_0x4d20a9){for(var _0x59ab01=0x0,_0x7b1a5=events['length'];_0x59ab01<_0x7b1a5;_0x59ab01++){var _0x4c9c37=events[_0x59ab01];var _0x281228=createListener(_0x50aa('0x5')+_0x4c9c37,_0x4d20a9);OpenchannelInteractionEvents['on'](_0x4c9c37,_0x281228);}}; \ No newline at end of file +var _0xabce=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','update','emit'];(function(_0x3cfe4e,_0x3e2fed){var _0x22e983=function(_0x75f797){while(--_0x75f797){_0x3cfe4e['push'](_0x3cfe4e['shift']());}};_0x22e983(++_0x3e2fed);}(_0xabce,0x19a));var _0xeabc=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xabce[_0x433a86];return _0x23000c;};'use strict';var OpenchannelInteractionEvents=require(_0xeabc('0x0'));var events=['save','remove',_0xeabc('0x1')];function createListener(_0x1f5aa0,_0x57a767){return function(_0x2c1171){_0x57a767[_0xeabc('0x2')](_0x1f5aa0,_0x2c1171);};}function removeListener(_0x19d7bb,_0x550ba3){return function(){OpenchannelInteractionEvents[_0xeabc('0x3')](_0x19d7bb,_0x550ba3);};}exports[_0xeabc('0x4')]=function(_0x2342cb){for(var _0x37afc3=0x0,_0x35ad8e=events[_0xeabc('0x5')];_0x37afc3<_0x35ad8e;_0x37afc3++){var _0x109b20=events[_0x37afc3];var _0xaf0a2f=createListener(_0xeabc('0x6')+_0x109b20,_0x2342cb);OpenchannelInteractionEvents['on'](_0x109b20,_0xaf0a2f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 1d5f647..90ed253 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 _0xae6a=['/:id','show','post','openchannel','openchannelmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe'];(function(_0xa93fbb,_0x19b407){var _0x226b42=function(_0x16e134){while(--_0x16e134){_0xa93fbb['push'](_0xa93fbb['shift']());}};_0x226b42(++_0x19b407);}(_0xae6a,0x1b6));var _0xaae6=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xae6a[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xaae6('0x0'));var util=require(_0xaae6('0x1'));var path=require('path');var timeout=require(_0xaae6('0x2'));var express=require(_0xaae6('0x3'));var router=express[_0xaae6('0x4')]();var auth=require(_0xaae6('0x5'));var interaction=require(_0xaae6('0x6'));var config=require(_0xaae6('0x7'));var controller=require('./openchannelMessage.controller');router[_0xaae6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaae6('0x9'),auth[_0xaae6('0xa')](),controller[_0xaae6('0xb')]);router[_0xaae6('0x8')](_0xaae6('0xc'),auth['isAuthenticated'](),controller[_0xaae6('0xd')]);router[_0xaae6('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xaae6('0xf'),_0xaae6('0x10')),controller[_0xaae6('0x11')]);router[_0xaae6('0x12')]('/:id',auth[_0xaae6('0xa')](),controller['update']);router[_0xaae6('0x12')](_0xaae6('0x13'),auth[_0xaae6('0xa')](),controller[_0xaae6('0x14')]);router[_0xaae6('0x12')](_0xaae6('0x15'),auth[_0xaae6('0xa')](),controller[_0xaae6('0x16')]);router[_0xaae6('0x17')](_0xaae6('0xc'),auth[_0xaae6('0xa')](),controller[_0xaae6('0x18')]);module['exports']=router; \ No newline at end of file +var _0xda69=['Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','openchannel','openchannelmessage:create','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','express'];(function(_0x4e8401,_0x51b328){var _0x17269f=function(_0x35ac65){while(--_0x35ac65){_0x4e8401['push'](_0x4e8401['shift']());}};_0x17269f(++_0x51b328);}(_0xda69,0x1de));var _0x9da6=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xda69[_0x46ae5a];return _0x434986;};'use strict';var multer=require(_0x9da6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9da6('0x1'));var router=express[_0x9da6('0x2')]();var auth=require(_0x9da6('0x3'));var interaction=require(_0x9da6('0x4'));var config=require('../../config/environment');var controller=require(_0x9da6('0x5'));router['get']('/',auth[_0x9da6('0x6')](),controller[_0x9da6('0x7')]);router[_0x9da6('0x8')](_0x9da6('0x9'),auth[_0x9da6('0x6')](),controller[_0x9da6('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9da6('0x6')](),interaction['tracked'](_0x9da6('0xb'),_0x9da6('0xc')),controller['create']);router['put']('/:id',auth[_0x9da6('0x6')](),controller['update']);router[_0x9da6('0xd')](_0x9da6('0xe'),auth['isAuthenticated'](),controller[_0x9da6('0xf')]);router[_0x9da6('0xd')]('/:id/reject',auth['isAuthenticated'](),controller[_0x9da6('0x10')]);router[_0x9da6('0x11')](_0x9da6('0x12'),auth[_0x9da6('0x6')](),controller[_0x9da6('0x13')]);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 d54cc26..ec02f6c 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 _0xcc2d=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0xcc2d,0x85));var _0xdcc2=function(_0x2cccb4,_0x30f1b5){_0x2cccb4=_0x2cccb4-0x0;var _0x48f67c=_0xcc2d[_0x2cccb4];return _0x48f67c;};'use strict';var Sequelize=require(_0xdcc2('0x0'));module[_0xdcc2('0x1')]={'body':{'type':Sequelize[_0xdcc2('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xdcc2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdcc2('0x4')]('in','out'),'defaultValue':_0xdcc2('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xdcc2('0x6')]}}; \ No newline at end of file +var _0x2d96=['BOOLEAN','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x42af0e,_0x421d97){var _0x52ae0b=function(_0x37ee91){while(--_0x37ee91){_0x42af0e['push'](_0x42af0e['shift']());}};_0x52ae0b(++_0x421d97);}(_0x2d96,0x81));var _0x62d9=function(_0x546bf5,_0x52fc92){_0x546bf5=_0x546bf5-0x0;var _0x5632c8=_0x2d96[_0x546bf5];return _0x5632c8;};'use strict';var Sequelize=require(_0x62d9('0x0'));module[_0x62d9('0x1')]={'body':{'type':Sequelize[_0x62d9('0x2')](_0x62d9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x62d9('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x62d9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x62d9('0x5')),'defaultValue':_0x62d9('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x62d9('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 010bafd..5b9e479 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 _0xf9b2=['findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','update','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','get','user','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','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~!@#$%^&-_=+[{]}.','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','code','error','message','sendStatus','status','end','count','offset','limit','json','apply','reject','save','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelMessage','includeAll','include'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xf9b2,0x120));var _0x2f9b=function(_0x525c12,_0x290bd4){_0x525c12=_0x525c12-0x0;var _0xe40ffa=_0xf9b2[_0x525c12];return _0xe40ffa;};'use strict';var pdf=require(_0x2f9b('0x0'));var emlformat=require(_0x2f9b('0x1'));var rimraf=require(_0x2f9b('0x2'));var zipdir=require(_0x2f9b('0x3'));var jsonpatch=require(_0x2f9b('0x4'));var rp=require(_0x2f9b('0x5'));var moment=require(_0x2f9b('0x6'));var BPromise=require(_0x2f9b('0x7'));var Mustache=require(_0x2f9b('0x8'));var util=require(_0x2f9b('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x2f9b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2f9b('0xb'));var squel=require(_0x2f9b('0xc'));var crypto=require(_0x2f9b('0xd'));var jsforce=require(_0x2f9b('0xe'));var deskjs=require(_0x2f9b('0xf'));var toCsv=require(_0x2f9b('0xa'));var querystring=require('querystring');var Papa=require(_0x2f9b('0x10'));var Redis=require(_0x2f9b('0x11'));var authService=require(_0x2f9b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2f9b('0x13'));var hardwareService=require(_0x2f9b('0x14'));var logger=require(_0x2f9b('0x15'))('api');var utils=require(_0x2f9b('0x16'));var config=require(_0x2f9b('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2f9b('0x18')](config[_0x2f9b('0x19')],{'host':_0x2f9b('0x1a'),'port':0x18eb});var socket=require(_0x2f9b('0x1b'))(new Redis(config[_0x2f9b('0x19')]));require('./openchannelMessage.socket')[_0x2f9b('0x1c')](socket);var jayson=require(_0x2f9b('0x1d'));var client=jayson[_0x2f9b('0x1e')][_0x2f9b('0x1f')]({'port':0x232c});var client9002=jayson[_0x2f9b('0x1e')][_0x2f9b('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x8733c2,_0x77078,_0x57975f){if(_0x57975f){var _0x38279d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38279d[_0x2f9b('0x20')](_0x77078)){return _0x8733c2;}else{throw new db[(_0x2f9b('0x21'))][(_0x2f9b('0x22'))](_0x2f9b('0x23'));}}else{return _0x8733c2;}}function respondWithRpcPromise(_0x3b612e,_0x25cc73,_0x560aa6,_0x40f236){return new BPromise(function(_0x32b927,_0x357e1d){var _0x506343=_0x40f236||client;return _0x506343['request'](_0x3b612e,_0x560aa6)[_0x2f9b('0x24')](function(_0x17551b){logger[_0x2f9b('0x25')](_0x2f9b('0x26'),_0x25cc73,_0x2f9b('0x27'));logger[_0x2f9b('0x28')](_0x2f9b('0x29'),_0x25cc73,_0x2f9b('0x27'),JSON['stringify'](_0x17551b));if(_0x17551b['error']){if(_0x17551b['error'][_0x2f9b('0x2a')]===0x1f4){logger['error'](_0x2f9b('0x26'),_0x25cc73,_0x17551b[_0x2f9b('0x2b')][_0x2f9b('0x2c')]);return _0x357e1d(_0x17551b[_0x2f9b('0x2b')][_0x2f9b('0x2c')]);}logger[_0x2f9b('0x2b')](_0x2f9b('0x26'),_0x25cc73,_0x17551b[_0x2f9b('0x2b')][_0x2f9b('0x2c')]);return _0x32b927(_0x17551b['error'][_0x2f9b('0x2c')]);}else{logger[_0x2f9b('0x25')](_0x2f9b('0x26'),_0x25cc73,_0x2f9b('0x27'));_0x32b927(_0x17551b['result']['message']);}})['catch'](function(_0x5abf08){logger[_0x2f9b('0x2b')](_0x2f9b('0x26'),_0x25cc73,_0x5abf08);_0x357e1d(_0x5abf08);});});}function respondWithStatusCode(_0x59cc12,_0x46bb04){_0x46bb04=_0x46bb04||0xcc;return function(_0x2db709){if(_0x2db709){return _0x59cc12[_0x2f9b('0x2d')](_0x46bb04);}return _0x59cc12[_0x2f9b('0x2e')](_0x46bb04)[_0x2f9b('0x2f')]();};}function respondWithResult(_0x21a34b,_0x1670d1){_0x1670d1=_0x1670d1||0xc8;return function(_0x297fe9){if(_0x297fe9){return _0x21a34b[_0x2f9b('0x2e')](_0x1670d1)['json'](_0x297fe9);}};}function respondWithFilteredResult(_0x466050,_0x5391bb){return function(_0x404826){if(_0x404826){var _0x1d9b37=_0x404826[_0x2f9b('0x30')],_0x586bb7=_0x5391bb[_0x2f9b('0x31')],_0xd0158f=_0x5391bb[_0x2f9b('0x31')]+_0x5391bb[_0x2f9b('0x32')],_0x36df9a;if(_0xd0158f>=_0x1d9b37){_0xd0158f=_0x1d9b37;_0x36df9a=0xc8;}else{_0x36df9a=0xce;}_0x466050[_0x2f9b('0x2e')](_0x36df9a);return _0x466050['set']('Content-Range',_0x586bb7+'-'+_0xd0158f+'/'+_0x1d9b37)[_0x2f9b('0x33')](_0x404826);}return null;};}function patchUpdates(_0x12d3bf){return function(_0x3066b5){try{jsonpatch[_0x2f9b('0x34')](_0x3066b5,_0x12d3bf,!![]);}catch(_0x1eb6fe){return BPromise[_0x2f9b('0x35')](_0x1eb6fe);}return _0x3066b5[_0x2f9b('0x36')]();};}function saveUpdates(_0x3bae6d,_0x19dc7a){return function(_0x4134b9){if(_0x4134b9){return _0x4134b9['update'](_0x3bae6d)[_0x2f9b('0x24')](function(_0x1633c2){return _0x1633c2;});}return null;};}function removeEntity(_0x36a5f5,_0x34fd61){return function(_0x64084e){if(_0x64084e){return _0x64084e[_0x2f9b('0x37')]()[_0x2f9b('0x24')](function(){_0x36a5f5[_0x2f9b('0x2e')](0xcc)[_0x2f9b('0x2f')]();});}};}function handleEntityNotFound(_0x42d135,_0x2f652a){return function(_0x595b3e){if(!_0x595b3e){_0x42d135[_0x2f9b('0x2d')](0x194);}return _0x595b3e;};}function handleError(_0x431403,_0x4ff8bd){_0x4ff8bd=_0x4ff8bd||0x1f4;return function(_0x8560cf){logger[_0x2f9b('0x2b')](_0x8560cf[_0x2f9b('0x38')]);if(_0x8560cf[_0x2f9b('0x39')]){delete _0x8560cf['name'];}_0x431403[_0x2f9b('0x2e')](_0x4ff8bd)['send'](_0x8560cf);};}exports[_0x2f9b('0x3a')]=function(_0x54801f,_0xa2b03a){var _0x36a123={},_0x3d2bfb={},_0x4cbf1d={'count':0x0,'rows':[]};var _0x1ee69f=_[_0x2f9b('0x3b')](db['OpenchannelMessage']['rawAttributes'],function(_0x3b719c){return{'name':_0x3b719c[_0x2f9b('0x3c')],'type':_0x3b719c[_0x2f9b('0x3d')][_0x2f9b('0x3e')]};});_0x3d2bfb[_0x2f9b('0x3f')]=_[_0x2f9b('0x3b')](_0x1ee69f,_0x2f9b('0x39'));_0x3d2bfb[_0x2f9b('0x40')]=_[_0x2f9b('0x41')](_0x54801f['query']);_0x3d2bfb[_0x2f9b('0x42')]=_[_0x2f9b('0x43')](_0x3d2bfb[_0x2f9b('0x3f')],_0x3d2bfb[_0x2f9b('0x40')]);_0x36a123[_0x2f9b('0x44')]=_[_0x2f9b('0x43')](_0x3d2bfb[_0x2f9b('0x3f')],qs['fields'](_0x54801f[_0x2f9b('0x40')]['fields']));_0x36a123[_0x2f9b('0x44')]=_0x36a123['attributes'][_0x2f9b('0x45')]?_0x36a123[_0x2f9b('0x44')]:_0x3d2bfb[_0x2f9b('0x3f')];if(!_0x54801f[_0x2f9b('0x40')]['hasOwnProperty'](_0x2f9b('0x46'))){_0x36a123['limit']=qs[_0x2f9b('0x32')](_0x54801f[_0x2f9b('0x40')]['limit']);_0x36a123[_0x2f9b('0x31')]=qs['offset'](_0x54801f[_0x2f9b('0x40')][_0x2f9b('0x31')]);}_0x36a123[_0x2f9b('0x47')]=qs['sort'](_0x54801f[_0x2f9b('0x40')][_0x2f9b('0x48')]);_0x36a123[_0x2f9b('0x49')]=qs[_0x2f9b('0x42')](_[_0x2f9b('0x4a')](_0x54801f[_0x2f9b('0x40')],_0x3d2bfb[_0x2f9b('0x42')]),_0x1ee69f);if(_0x54801f[_0x2f9b('0x40')][_0x2f9b('0x4b')]){_0x36a123[_0x2f9b('0x49')]=_[_0x2f9b('0x4c')](_0x36a123[_0x2f9b('0x49')],{'$or':_[_0x2f9b('0x3b')](_0x1ee69f,function(_0x4179ad){if(_0x4179ad[_0x2f9b('0x3d')]!=='VIRTUAL'){var _0x3219b5={};_0x3219b5[_0x4179ad[_0x2f9b('0x39')]]={'$like':'%'+_0x54801f[_0x2f9b('0x40')][_0x2f9b('0x4b')]+'%'};return _0x3219b5;}})});}_0x36a123=_[_0x2f9b('0x4c')]({},_0x36a123,_0x54801f[_0x2f9b('0x4d')]);var _0x1615fe={'where':_0x36a123[_0x2f9b('0x49')]};return db[_0x2f9b('0x4e')][_0x2f9b('0x30')](_0x1615fe)[_0x2f9b('0x24')](function(_0x16d837){_0x4cbf1d['count']=_0x16d837;if(_0x54801f['query'][_0x2f9b('0x4f')]){_0x36a123[_0x2f9b('0x50')]=[{'all':!![]}];}return db[_0x2f9b('0x4e')][_0x2f9b('0x51')](_0x36a123);})[_0x2f9b('0x24')](function(_0x224147){_0x4cbf1d[_0x2f9b('0x52')]=_0x224147;return _0x4cbf1d;})[_0x2f9b('0x24')](respondWithFilteredResult(_0xa2b03a,_0x36a123))[_0x2f9b('0x53')](handleError(_0xa2b03a,null));};exports[_0x2f9b('0x54')]=function(_0x2b4b95,_0x2a13b1){var _0x50989e={'raw':!![],'where':{'id':_0x2b4b95[_0x2f9b('0x55')]['id']}},_0xce805a={};_0xce805a[_0x2f9b('0x3f')]=_[_0x2f9b('0x41')](db[_0x2f9b('0x4e')][_0x2f9b('0x56')]);_0xce805a[_0x2f9b('0x40')]=_['keys'](_0x2b4b95[_0x2f9b('0x40')]);_0xce805a[_0x2f9b('0x42')]=_[_0x2f9b('0x43')](_0xce805a[_0x2f9b('0x3f')],_0xce805a[_0x2f9b('0x40')]);_0x50989e['attributes']=_[_0x2f9b('0x43')](_0xce805a[_0x2f9b('0x3f')],qs[_0x2f9b('0x57')](_0x2b4b95[_0x2f9b('0x40')][_0x2f9b('0x57')]));_0x50989e[_0x2f9b('0x44')]=_0x50989e[_0x2f9b('0x44')]['length']?_0x50989e[_0x2f9b('0x44')]:_0xce805a['model'];if(_0x2b4b95[_0x2f9b('0x40')][_0x2f9b('0x4f')]){_0x50989e[_0x2f9b('0x50')]=[{'all':!![]}];}_0x50989e=_[_0x2f9b('0x4c')]({},_0x50989e,_0x2b4b95[_0x2f9b('0x4d')]);return db['OpenchannelMessage'][_0x2f9b('0x58')](_0x50989e)[_0x2f9b('0x24')](handleEntityNotFound(_0x2a13b1,null))['then'](respondWithResult(_0x2a13b1,null))[_0x2f9b('0x53')](handleError(_0x2a13b1,null));};exports[_0x2f9b('0x59')]=function(_0x354560,_0x443c9f){return db[_0x2f9b('0x4e')][_0x2f9b('0x59')](_0x354560[_0x2f9b('0x5a')],{})[_0x2f9b('0x24')](respondWithResult(_0x443c9f,0xc9))[_0x2f9b('0x53')](handleError(_0x443c9f,null));};exports[_0x2f9b('0x5b')]=function(_0x1d4fa3,_0x38a65d){if(_0x1d4fa3[_0x2f9b('0x5a')]['id']){delete _0x1d4fa3['body']['id'];}return db[_0x2f9b('0x4e')][_0x2f9b('0x58')]({'where':{'id':_0x1d4fa3[_0x2f9b('0x55')]['id']}})[_0x2f9b('0x24')](handleEntityNotFound(_0x38a65d,null))['then'](saveUpdates(_0x1d4fa3[_0x2f9b('0x5a')],null))[_0x2f9b('0x24')](respondWithResult(_0x38a65d,null))['catch'](handleError(_0x38a65d,null));};exports['destroy']=function(_0x1c993d,_0x2c6a02){return db[_0x2f9b('0x4e')][_0x2f9b('0x58')]({'where':{'id':_0x1c993d['params']['id']}})[_0x2f9b('0x24')](handleEntityNotFound(_0x2c6a02,null))[_0x2f9b('0x24')](removeEntity(_0x2c6a02,null))[_0x2f9b('0x53')](handleError(_0x2c6a02,null));};exports[_0x2f9b('0x5c')]=function(_0x52a283,_0x4855e8){return db[_0x2f9b('0x4e')][_0x2f9b('0x5c')]()[_0x2f9b('0x24')](respondWithResult(_0x4855e8,null))[_0x2f9b('0x53')](handleError(_0x4855e8,null));};var interaction_log=require(_0x2f9b('0x15'))(_0x2f9b('0x5d'));exports['accept']=function(_0x2e35f3,_0x49df46,_0x57e177){var _0x5ea426={'channel':_0x2f9b('0x5e')};if(_0x2e35f3[_0x2f9b('0x5a')]['id']){delete _0x2e35f3[_0x2f9b('0x5a')]['id'];}_0x2e35f3[_0x2f9b('0x5a')][_0x2f9b('0x5f')]=!![];_0x2e35f3[_0x2f9b('0x5a')][_0x2f9b('0x60')]=moment()[_0x2f9b('0x61')](_0x2f9b('0x62'));_0x2e35f3[_0x2f9b('0x5a')][_0x2f9b('0x63')]=_0x2e35f3['body'][_0x2f9b('0x63')]||_0x2e35f3['user']['id'];return db[_0x2f9b('0x4e')]['find']({'where':{'id':_0x2e35f3['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x2f9b('0x64')}]})[_0x2f9b('0x24')](handleEntityNotFound(_0x49df46,null))[_0x2f9b('0x24')](saveUpdates(_0x2e35f3['body'],null))[_0x2f9b('0x24')](function(_0x7b593a){if(_0x7b593a){_0x5ea426[_0x2f9b('0x2c')]=_0x7b593a['get']({'plain':!![]});return db[_0x2f9b('0x65')][_0x2f9b('0x58')]({'where':{'id':_0x7b593a[_0x2f9b('0x66')]}});}return null;})[_0x2f9b('0x24')](handleEntityNotFound(_0x49df46,null))[_0x2f9b('0x24')](function(_0x57e8f0){if(_0x57e8f0){return _0x57e8f0[_0x2f9b('0x5b')]({'UserId':_0x2e35f3['body']['UserId'],'read1stAt':_['isNil'](_0x57e8f0[_0x2f9b('0x67')])?moment()[_0x2f9b('0x61')](_0x2f9b('0x62')):undefined});}return null;})[_0x2f9b('0x24')](function(_0x2c4b5d){if(_0x2c4b5d){_0x5ea426[_0x2f9b('0x68')]=_0x2c4b5d[_0x2f9b('0x69')]({'plain':!![]});interaction_log[_0x2f9b('0x25')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e35f3[_0x2f9b('0x6a')]['id'],_0x2e35f3[_0x2f9b('0x6a')][_0x2f9b('0x39')],_0x2e35f3['user']['role'],_0x5ea426[_0x2f9b('0x68')]['id'],_0x2e35f3[_0x2f9b('0x5a')]?JSON[_0x2f9b('0x6b')](_0x2e35f3[_0x2f9b('0x5a')]):_0x2f9b('0x6c'));return respondWithRpcPromise(_0x2f9b('0x6d'),_0x2f9b('0x6e'),_0x5ea426);}return null;})['then'](function(_0x58905e){if(_0x58905e){if(_0x2e35f3[_0x2f9b('0x5a')][_0x2f9b('0x6f')]){_0x5ea426[_0x2f9b('0x2c')]['interface']=util[_0x2f9b('0x61')](_0x2f9b('0x70'),_0x2e35f3[_0x2f9b('0x6a')][_0x2f9b('0x39')]);_0x5ea426['message'][_0x2f9b('0x71')]=_0x5ea426[_0x2f9b('0x71')];_0x5ea426[_0x2f9b('0x2c')][_0x2f9b('0x72')]='accept';return respondWithRpcPromise(_0x2f9b('0x73'),_0x2f9b('0x73'),{'event':_0x2f9b('0x74'),'message':_0x5ea426[_0x2f9b('0x2c')]},client9002)[_0x2f9b('0x24')](function(){return _0x5ea426;});}return _0x5ea426;}return null;})[_0x2f9b('0x24')](respondWithResult(_0x49df46,null))[_0x2f9b('0x53')](handleError(_0x49df46,null));};var interaction_log=require('../../config/logger')(_0x2f9b('0x5d'));exports[_0x2f9b('0x35')]=function(_0x44820f,_0x398116,_0x59a1d6){var _0x5ca0e1={'agent':{},'channel':_0x2f9b('0x5e')};if(_0x44820f[_0x2f9b('0x5a')]['id']){delete _0x44820f[_0x2f9b('0x5a')]['id'];}_0x44820f['body']['UserId']=_0x44820f[_0x2f9b('0x5a')]['UserId']||_0x44820f[_0x2f9b('0x6a')]['id'];_0x5ca0e1[_0x2f9b('0x75')]['id']=_0x44820f[_0x2f9b('0x5a')][_0x2f9b('0x63')];return db[_0x2f9b('0x4e')][_0x2f9b('0x58')]({'where':{'id':_0x44820f[_0x2f9b('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x398116,null))[_0x2f9b('0x24')](function(_0xe91b7e){if(_0xe91b7e){_0x5ca0e1[_0x2f9b('0x2c')]=_0xe91b7e[_0x2f9b('0x69')]({'plain':!![]});return db['OpenchannelInteraction'][_0x2f9b('0x58')]({'where':{'id':_0xe91b7e[_0x2f9b('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x398116,null))[_0x2f9b('0x24')](function(_0x5e47c0){if(_0x5e47c0){_0x5ca0e1[_0x2f9b('0x68')]=_0x5e47c0[_0x2f9b('0x69')]({'plain':!![]});interaction_log['info'](_0x2f9b('0x76'),_0x44820f[_0x2f9b('0x6a')]['id'],_0x44820f[_0x2f9b('0x6a')][_0x2f9b('0x39')],_0x44820f[_0x2f9b('0x6a')][_0x2f9b('0x77')],_0x5ca0e1[_0x2f9b('0x68')]['id'],_0x44820f[_0x2f9b('0x5a')]?JSON[_0x2f9b('0x6b')](_0x44820f['body']):_0x2f9b('0x6c'));return respondWithRpcPromise('RejectMessage',_0x2f9b('0x78'),_0x5ca0e1);}return null;})['then'](function(_0x8be5c3){if(_0x8be5c3){_0x8be5c3[_0x2f9b('0x2c')][_0x2f9b('0x79')]=util['format'](_0x2f9b('0x70'),_0x44820f['user'][_0x2f9b('0x39')]);_0x8be5c3[_0x2f9b('0x2c')][_0x2f9b('0x71')]=_0x5ca0e1[_0x2f9b('0x71')];_0x8be5c3[_0x2f9b('0x2c')][_0x2f9b('0x72')]=_0x2f9b('0x35');respondWithRpcPromise(_0x2f9b('0x73'),_0x2f9b('0x73'),{'event':_0x2f9b('0x7a'),'message':_0x8be5c3['message']},client9002);return _0x5ca0e1;}return null;})[_0x2f9b('0x24')](respondWithResult(_0x398116,null))[_0x2f9b('0x53')](handleError(_0x398116,null));}; \ No newline at end of file +var _0x3344=['reject','save','update','destroy','stack','name','send','map','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','OpenchannelMessage','findAll','rows','show','params','rawAttributes','keys','length','include','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','./openchannelMessage.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~!@#$%^&-_=+[{]}.','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','status','end','json','count','offset','set','Content-Range','apply'];(function(_0x383339,_0x3d185b){var _0x1f5132=function(_0x4dfa59){while(--_0x4dfa59){_0x383339['push'](_0x383339['shift']());}};_0x1f5132(++_0x3d185b);}(_0x3344,0x13e));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x4334('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4334('0x1'));var jsonpatch=require(_0x4334('0x2'));var rp=require('request-promise');var moment=require(_0x4334('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4334('0x4'));var util=require(_0x4334('0x5'));var path=require('path');var sox=require(_0x4334('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4334('0x7'));var squel=require(_0x4334('0x8'));var crypto=require(_0x4334('0x9'));var jsforce=require(_0x4334('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4334('0xb'));var Papa=require(_0x4334('0xc'));var Redis=require(_0x4334('0xd'));var authService=require(_0x4334('0xe'));var qs=require(_0x4334('0xf'));var as=require(_0x4334('0x10'));var hardwareService=require(_0x4334('0x11'));var logger=require(_0x4334('0x12'))('api');var utils=require(_0x4334('0x13'));var config=require(_0x4334('0x14'));var db=require(_0x4334('0x15'))['db'];config['redis']=_[_0x4334('0x16')](config['redis'],{'host':_0x4334('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4334('0x18')]));require(_0x4334('0x19'))['register'](socket);var jayson=require(_0x4334('0x1a'));var client=jayson[_0x4334('0x1b')][_0x4334('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x4334('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x21bef7,_0x420f7b,_0x46f26f){if(_0x46f26f){var _0xd45c06=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd45c06[_0x4334('0x1d')](_0x420f7b)){return _0x21bef7;}else{throw new db['Sequelize'][(_0x4334('0x1e'))](_0x4334('0x1f'));}}else{return _0x21bef7;}}function respondWithRpcPromise(_0x2a22f9,_0xea1d6c,_0x697327,_0x336e72){return new BPromise(function(_0x2e15fb,_0x3147d0){var _0x16cc20=_0x336e72||client;return _0x16cc20['request'](_0x2a22f9,_0x697327)[_0x4334('0x20')](function(_0x5811d6){logger['info'](_0x4334('0x21'),_0xea1d6c,'request\x20sent');logger[_0x4334('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xea1d6c,_0x4334('0x23'),JSON[_0x4334('0x24')](_0x5811d6));if(_0x5811d6[_0x4334('0x25')]){if(_0x5811d6[_0x4334('0x25')][_0x4334('0x26')]===0x1f4){logger[_0x4334('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0xea1d6c,_0x5811d6[_0x4334('0x25')][_0x4334('0x27')]);return _0x3147d0(_0x5811d6[_0x4334('0x25')][_0x4334('0x27')]);}logger[_0x4334('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0xea1d6c,_0x5811d6['error'][_0x4334('0x27')]);return _0x2e15fb(_0x5811d6['error'][_0x4334('0x27')]);}else{logger[_0x4334('0x28')](_0x4334('0x21'),_0xea1d6c,_0x4334('0x23'));_0x2e15fb(_0x5811d6[_0x4334('0x29')][_0x4334('0x27')]);}})[_0x4334('0x2a')](function(_0x4be8df){logger[_0x4334('0x25')](_0x4334('0x21'),_0xea1d6c,_0x4be8df);_0x3147d0(_0x4be8df);});});}function respondWithStatusCode(_0x230878,_0x427d01){_0x427d01=_0x427d01||0xcc;return function(_0x47de9e){if(_0x47de9e){return _0x230878['sendStatus'](_0x427d01);}return _0x230878[_0x4334('0x2b')](_0x427d01)[_0x4334('0x2c')]();};}function respondWithResult(_0x5220be,_0x58d377){_0x58d377=_0x58d377||0xc8;return function(_0xce3a4e){if(_0xce3a4e){return _0x5220be[_0x4334('0x2b')](_0x58d377)[_0x4334('0x2d')](_0xce3a4e);}};}function respondWithFilteredResult(_0x1b22f0,_0x2b6082){return function(_0x53f69d){if(_0x53f69d){var _0x4f990e=_0x53f69d[_0x4334('0x2e')],_0x556ac8=_0x2b6082[_0x4334('0x2f')],_0x2ddd55=_0x2b6082['offset']+_0x2b6082['limit'],_0x3be374;if(_0x2ddd55>=_0x4f990e){_0x2ddd55=_0x4f990e;_0x3be374=0xc8;}else{_0x3be374=0xce;}_0x1b22f0[_0x4334('0x2b')](_0x3be374);return _0x1b22f0[_0x4334('0x30')](_0x4334('0x31'),_0x556ac8+'-'+_0x2ddd55+'/'+_0x4f990e)[_0x4334('0x2d')](_0x53f69d);}return null;};}function patchUpdates(_0x23bcfd){return function(_0x193f2a){try{jsonpatch[_0x4334('0x32')](_0x193f2a,_0x23bcfd,!![]);}catch(_0x5065bc){return BPromise[_0x4334('0x33')](_0x5065bc);}return _0x193f2a[_0x4334('0x34')]();};}function saveUpdates(_0xfa813d,_0x435727){return function(_0xbcd524){if(_0xbcd524){return _0xbcd524[_0x4334('0x35')](_0xfa813d)[_0x4334('0x20')](function(_0x5435c2){return _0x5435c2;});}return null;};}function removeEntity(_0x3211d2,_0x278840){return function(_0xd2bdb8){if(_0xd2bdb8){return _0xd2bdb8[_0x4334('0x36')]()[_0x4334('0x20')](function(){_0x3211d2[_0x4334('0x2b')](0xcc)[_0x4334('0x2c')]();});}};}function handleEntityNotFound(_0x505917,_0x4140ec){return function(_0x46059e){if(!_0x46059e){_0x505917['sendStatus'](0x194);}return _0x46059e;};}function handleError(_0x4bbeb6,_0x54a82e){_0x54a82e=_0x54a82e||0x1f4;return function(_0x3879cc){logger['error'](_0x3879cc[_0x4334('0x37')]);if(_0x3879cc[_0x4334('0x38')]){delete _0x3879cc[_0x4334('0x38')];}_0x4bbeb6[_0x4334('0x2b')](_0x54a82e)[_0x4334('0x39')](_0x3879cc);};}exports['index']=function(_0xec6566,_0x4f929e){var _0x502eab={},_0x199257={},_0x4128f6={'count':0x0,'rows':[]};var _0x4e1504=_[_0x4334('0x3a')](db['OpenchannelMessage']['rawAttributes'],function(_0x1d4bdb){return{'name':_0x1d4bdb['fieldName'],'type':_0x1d4bdb[_0x4334('0x3b')]['key']};});_0x199257[_0x4334('0x3c')]=_[_0x4334('0x3a')](_0x4e1504,_0x4334('0x38'));_0x199257[_0x4334('0x3d')]=_['keys'](_0xec6566[_0x4334('0x3d')]);_0x199257[_0x4334('0x3e')]=_[_0x4334('0x3f')](_0x199257[_0x4334('0x3c')],_0x199257[_0x4334('0x3d')]);_0x502eab['attributes']=_[_0x4334('0x3f')](_0x199257[_0x4334('0x3c')],qs[_0x4334('0x40')](_0xec6566[_0x4334('0x3d')][_0x4334('0x40')]));_0x502eab[_0x4334('0x41')]=_0x502eab['attributes']['length']?_0x502eab[_0x4334('0x41')]:_0x199257[_0x4334('0x3c')];if(!_0xec6566[_0x4334('0x3d')][_0x4334('0x42')](_0x4334('0x43'))){_0x502eab[_0x4334('0x44')]=qs[_0x4334('0x44')](_0xec6566[_0x4334('0x3d')][_0x4334('0x44')]);_0x502eab[_0x4334('0x2f')]=qs['offset'](_0xec6566['query']['offset']);}_0x502eab[_0x4334('0x45')]=qs[_0x4334('0x46')](_0xec6566[_0x4334('0x3d')][_0x4334('0x46')]);_0x502eab[_0x4334('0x47')]=qs['filters'](_[_0x4334('0x48')](_0xec6566[_0x4334('0x3d')],_0x199257[_0x4334('0x3e')]),_0x4e1504);if(_0xec6566[_0x4334('0x3d')][_0x4334('0x49')]){_0x502eab[_0x4334('0x47')]=_[_0x4334('0x4a')](_0x502eab['where'],{'$or':_[_0x4334('0x3a')](_0x4e1504,function(_0x438402){if(_0x438402[_0x4334('0x3b')]!==_0x4334('0x4b')){var _0x27f2e0={};_0x27f2e0[_0x438402[_0x4334('0x38')]]={'$like':'%'+_0xec6566[_0x4334('0x3d')][_0x4334('0x49')]+'%'};return _0x27f2e0;}})});}_0x502eab=_[_0x4334('0x4a')]({},_0x502eab,_0xec6566[_0x4334('0x4c')]);var _0x20916b={'where':_0x502eab[_0x4334('0x47')]};return db['OpenchannelMessage'][_0x4334('0x2e')](_0x20916b)[_0x4334('0x20')](function(_0x598ddf){_0x4128f6[_0x4334('0x2e')]=_0x598ddf;if(_0xec6566[_0x4334('0x3d')][_0x4334('0x4d')]){_0x502eab['include']=[{'all':!![]}];}return db[_0x4334('0x4e')][_0x4334('0x4f')](_0x502eab);})[_0x4334('0x20')](function(_0x40a6b1){_0x4128f6[_0x4334('0x50')]=_0x40a6b1;return _0x4128f6;})['then'](respondWithFilteredResult(_0x4f929e,_0x502eab))[_0x4334('0x2a')](handleError(_0x4f929e,null));};exports[_0x4334('0x51')]=function(_0x415e37,_0x3db05f){var _0x86f974={'raw':!![],'where':{'id':_0x415e37[_0x4334('0x52')]['id']}},_0x9ba25f={};_0x9ba25f['model']=_['keys'](db[_0x4334('0x4e')][_0x4334('0x53')]);_0x9ba25f[_0x4334('0x3d')]=_[_0x4334('0x54')](_0x415e37[_0x4334('0x3d')]);_0x9ba25f[_0x4334('0x3e')]=_['intersection'](_0x9ba25f['model'],_0x9ba25f['query']);_0x86f974[_0x4334('0x41')]=_[_0x4334('0x3f')](_0x9ba25f['model'],qs[_0x4334('0x40')](_0x415e37[_0x4334('0x3d')][_0x4334('0x40')]));_0x86f974['attributes']=_0x86f974[_0x4334('0x41')][_0x4334('0x55')]?_0x86f974[_0x4334('0x41')]:_0x9ba25f[_0x4334('0x3c')];if(_0x415e37['query'][_0x4334('0x4d')]){_0x86f974[_0x4334('0x56')]=[{'all':!![]}];}_0x86f974=_[_0x4334('0x4a')]({},_0x86f974,_0x415e37[_0x4334('0x4c')]);return db[_0x4334('0x4e')][_0x4334('0x57')](_0x86f974)[_0x4334('0x20')](handleEntityNotFound(_0x3db05f,null))[_0x4334('0x20')](respondWithResult(_0x3db05f,null))[_0x4334('0x2a')](handleError(_0x3db05f,null));};exports[_0x4334('0x58')]=function(_0x53eb81,_0x3ba184){return db[_0x4334('0x4e')][_0x4334('0x58')](_0x53eb81[_0x4334('0x59')],{})[_0x4334('0x20')](respondWithResult(_0x3ba184,0xc9))['catch'](handleError(_0x3ba184,null));};exports[_0x4334('0x35')]=function(_0x18838c,_0x47cd86){if(_0x18838c[_0x4334('0x59')]['id']){delete _0x18838c['body']['id'];}return db[_0x4334('0x4e')][_0x4334('0x57')]({'where':{'id':_0x18838c[_0x4334('0x52')]['id']}})['then'](handleEntityNotFound(_0x47cd86,null))['then'](saveUpdates(_0x18838c[_0x4334('0x59')],null))['then'](respondWithResult(_0x47cd86,null))[_0x4334('0x2a')](handleError(_0x47cd86,null));};exports[_0x4334('0x36')]=function(_0x4ac844,_0x1a2fd9){return db[_0x4334('0x4e')][_0x4334('0x57')]({'where':{'id':_0x4ac844[_0x4334('0x52')]['id']}})['then'](handleEntityNotFound(_0x1a2fd9,null))['then'](removeEntity(_0x1a2fd9,null))[_0x4334('0x2a')](handleError(_0x1a2fd9,null));};exports['describe']=function(_0x49859c,_0x35e24f){return db[_0x4334('0x4e')][_0x4334('0x5a')]()[_0x4334('0x20')](respondWithResult(_0x35e24f,null))[_0x4334('0x2a')](handleError(_0x35e24f,null));};var interaction_log=require(_0x4334('0x12'))(_0x4334('0x5b'));exports[_0x4334('0x5c')]=function(_0x57dbb8,_0x77a212,_0x42b879){var _0x1ce0bc={'channel':_0x4334('0x5d')};if(_0x57dbb8[_0x4334('0x59')]['id']){delete _0x57dbb8[_0x4334('0x59')]['id'];}_0x57dbb8['body'][_0x4334('0x5e')]=!![];_0x57dbb8[_0x4334('0x59')][_0x4334('0x5f')]=moment()[_0x4334('0x60')](_0x4334('0x61'));_0x57dbb8[_0x4334('0x59')]['UserId']=_0x57dbb8[_0x4334('0x59')][_0x4334('0x62')]||_0x57dbb8[_0x4334('0x63')]['id'];return db[_0x4334('0x4e')][_0x4334('0x57')]({'where':{'id':_0x57dbb8[_0x4334('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x4334('0x64')],'as':_0x4334('0x65')}]})[_0x4334('0x20')](handleEntityNotFound(_0x77a212,null))[_0x4334('0x20')](saveUpdates(_0x57dbb8[_0x4334('0x59')],null))[_0x4334('0x20')](function(_0x468a1d){if(_0x468a1d){_0x1ce0bc[_0x4334('0x27')]=_0x468a1d['get']({'plain':!![]});return db[_0x4334('0x66')][_0x4334('0x57')]({'where':{'id':_0x468a1d[_0x4334('0x67')]}});}return null;})[_0x4334('0x20')](handleEntityNotFound(_0x77a212,null))['then'](function(_0x17b623){if(_0x17b623){return _0x17b623[_0x4334('0x35')]({'UserId':_0x57dbb8['body'][_0x4334('0x62')],'read1stAt':_[_0x4334('0x68')](_0x17b623[_0x4334('0x69')])?moment()[_0x4334('0x60')](_0x4334('0x61')):undefined});}return null;})[_0x4334('0x20')](function(_0x375983){if(_0x375983){_0x1ce0bc[_0x4334('0x6a')]=_0x375983[_0x4334('0x6b')]({'plain':!![]});interaction_log[_0x4334('0x28')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57dbb8['user']['id'],_0x57dbb8[_0x4334('0x63')][_0x4334('0x38')],_0x57dbb8[_0x4334('0x63')][_0x4334('0x6c')],_0x1ce0bc['interaction']['id'],_0x57dbb8['body']?JSON['stringify'](_0x57dbb8[_0x4334('0x59')]):_0x4334('0x6d'));return respondWithRpcPromise(_0x4334('0x6e'),_0x4334('0x6f'),_0x1ce0bc);}return null;})['then'](function(_0x6a0a0a){if(_0x6a0a0a){if(_0x57dbb8[_0x4334('0x59')]['manual']){_0x1ce0bc['message'][_0x4334('0x70')]=util['format'](_0x4334('0x71'),_0x57dbb8[_0x4334('0x63')][_0x4334('0x38')]);_0x1ce0bc[_0x4334('0x27')]['channel']=_0x1ce0bc[_0x4334('0x72')];_0x1ce0bc[_0x4334('0x27')][_0x4334('0x73')]=_0x4334('0x5c');return respondWithRpcPromise(_0x4334('0x74'),_0x4334('0x74'),{'event':_0x4334('0x75'),'message':_0x1ce0bc[_0x4334('0x27')]},client9002)[_0x4334('0x20')](function(){return _0x1ce0bc;});}return _0x1ce0bc;}return null;})[_0x4334('0x20')](respondWithResult(_0x77a212,null))[_0x4334('0x2a')](handleError(_0x77a212,null));};var interaction_log=require(_0x4334('0x12'))(_0x4334('0x5b'));exports[_0x4334('0x33')]=function(_0x4292b3,_0x2c4f1d,_0x17d629){var _0x288f57={'agent':{},'channel':_0x4334('0x5d')};if(_0x4292b3[_0x4334('0x59')]['id']){delete _0x4292b3[_0x4334('0x59')]['id'];}_0x4292b3[_0x4334('0x59')]['UserId']=_0x4292b3[_0x4334('0x59')][_0x4334('0x62')]||_0x4292b3['user']['id'];_0x288f57[_0x4334('0x76')]['id']=_0x4292b3['body'][_0x4334('0x62')];return db['OpenchannelMessage']['find']({'where':{'id':_0x4292b3[_0x4334('0x52')]['id'],'UserId':null}})[_0x4334('0x20')](handleEntityNotFound(_0x2c4f1d,null))[_0x4334('0x20')](function(_0x5afb7d){if(_0x5afb7d){_0x288f57[_0x4334('0x27')]=_0x5afb7d['get']({'plain':!![]});return db[_0x4334('0x66')][_0x4334('0x57')]({'where':{'id':_0x5afb7d[_0x4334('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x2c4f1d,null))['then'](function(_0x40a082){if(_0x40a082){_0x288f57[_0x4334('0x6a')]=_0x40a082[_0x4334('0x6b')]({'plain':!![]});interaction_log['info'](_0x4334('0x77'),_0x4292b3[_0x4334('0x63')]['id'],_0x4292b3[_0x4334('0x63')][_0x4334('0x38')],_0x4292b3[_0x4334('0x63')][_0x4334('0x6c')],_0x288f57[_0x4334('0x6a')]['id'],_0x4292b3[_0x4334('0x59')]?JSON[_0x4334('0x24')](_0x4292b3[_0x4334('0x59')]):'null');return respondWithRpcPromise(_0x4334('0x78'),_0x4334('0x79'),_0x288f57);}return null;})[_0x4334('0x20')](function(_0x5a3249){if(_0x5a3249){_0x5a3249['message'][_0x4334('0x70')]=util['format']('SIP/%s',_0x4292b3['user']['name']);_0x5a3249[_0x4334('0x27')][_0x4334('0x72')]=_0x288f57['channel'];_0x5a3249[_0x4334('0x27')]['event']=_0x4334('0x33');respondWithRpcPromise('EventManager',_0x4334('0x74'),{'event':_0x4334('0x7a'),'message':_0x5a3249['message']},client9002);return _0x288f57;}return null;})['then'](respondWithResult(_0x2c4f1d,null))[_0x4334('0x2a')](handleError(_0x2c4f1d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 3822abe..461bddd 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 _0x373d=['hook','exports','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x15e636,_0x2264f4){var _0x5e76b0=function(_0x19e9df){while(--_0x19e9df){_0x15e636['push'](_0x15e636['shift']());}};_0x5e76b0(++_0x2264f4);}(_0x373d,0xb8));var _0xd373=function(_0x43b068,_0x400bbe){_0x43b068=_0x43b068-0x0;var _0x269c2b=_0x373d[_0x43b068];return _0x269c2b;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xd373('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xd373('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd373('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2ce0cd){return function(_0x8e544f,_0x75858b,_0x556a3b){OpenchannelMessageEvents[_0xd373('0x3')](_0x2ce0cd+':'+_0x8e544f['id'],_0x8e544f);OpenchannelMessageEvents['emit'](_0x2ce0cd,_0x8e544f);_0x556a3b(null);};}for(var e in events){if(events[_0xd373('0x4')](e)){var event=events[e];OpenchannelMessage[_0xd373('0x5')](e,emitEvent(event));}}module[_0xd373('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xdba3=['emit','hasOwnProperty','events','OpenchannelMessage','setMaxListeners','save','remove'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0xdba3,0x1de));var _0x3dba=function(_0x2b48d6,_0x4e4b2b){_0x2b48d6=_0x2b48d6-0x0;var _0x46cd9b=_0xdba3[_0x2b48d6];return _0x46cd9b;};'use strict';var EventEmitter=require(_0x3dba('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x3dba('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3dba('0x2')](0x0);var events={'afterCreate':_0x3dba('0x3'),'afterUpdate':'update','afterDestroy':_0x3dba('0x4')};function emitEvent(_0xbbddd){return function(_0x1ac4e8,_0x3ac335,_0x2136f3){OpenchannelMessageEvents[_0x3dba('0x5')](_0xbbddd+':'+_0x1ac4e8['id'],_0x1ac4e8);OpenchannelMessageEvents['emit'](_0xbbddd,_0x1ac4e8);_0x2136f3(null);};}for(var e in events){if(events[_0x3dba('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index e0172a2..522950f 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 _0x67a2=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','error','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','method','GET','POST','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','finally','utf8mb4_unicode_ci','lodash'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x67a2,0xd3));var _0x267a=function(_0x477a0b,_0x149974){_0x477a0b=_0x477a0b-0x0;var _0x2f0a8e=_0x67a2[_0x477a0b];return _0x2f0a8e;};'use strict';var _=require(_0x267a('0x0'));var util=require(_0x267a('0x1'));var logger=require('../../config/logger')(_0x267a('0x2'));var moment=require(_0x267a('0x3'));var BPromise=require(_0x267a('0x4'));var rp=require(_0x267a('0x5'));var fs=require('fs');var path=require(_0x267a('0x6'));var rimraf=require(_0x267a('0x7'));var config=require(_0x267a('0x8'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x17090d,_0x3539d5){return _0x17090d[_0x267a('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x267a('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x267a('0xb')],'type':_0x267a('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x84fef4,_0x95a54e,_0x207db5){var _0x42e210=_0x17090d[_0x267a('0xd')];var _0x52bb27=_0x84fef4[_0x267a('0xe')]({'plain':!![]});if(_0x52bb27[_0x267a('0xf')][_0x267a('0x10')]()==='in'||_0x52bb27[_0x267a('0xf')][_0x267a('0x10')]()===_0x267a('0x11')&&!_0x52bb27[_0x267a('0x12')]&&!_[_0x267a('0x13')](_0x52bb27[_0x267a('0x14')])){_0x42e210[_0x267a('0x15')][_0x267a('0x16')]({'where':{'id':_0x52bb27['OpenchannelInteractionId']}})[_0x267a('0x17')](function(_0x558c88){if(_0x558c88){_0x558c88[_0x267a('0x18')]({'lastMsgAt':_0x52bb27[_0x267a('0x19')],'lastMsgDirection':_0x52bb27[_0x267a('0xf')]['toLowerCase']()});}})['catch'](function(_0x44ed17){console[_0x267a('0x1a')](_0x44ed17);});}if(_0x52bb27[_0x267a('0xf')]==='out'&&!_0x52bb27[_0x267a('0x12')]){var _0x168d29;_0x42e210[_0x267a('0x1b')][_0x267a('0x1c')]()[_0x267a('0x17')](function(_0x54a7fe){return _0x42e210[_0x267a('0x1d')]['find']({'where':{'id':_0x52bb27[_0x267a('0x1e')]},'include':[{'model':_0x42e210[_0x267a('0x15')],'as':'Interactions','where':{'id':_0x52bb27[_0x267a('0x1f')]},'limit':0x1,'include':[{'model':_0x42e210['CmContact'],'as':_0x267a('0x20'),'attributes':_[_0x267a('0x21')](_0x54a7fe)}]}]});})[_0x267a('0x17')](function(_0x5017b3){_0x168d29=_0x5017b3[_0x267a('0xe')]({'plain':!![]});if(_0x168d29&&_0x168d29[_0x267a('0x22')]){logger[_0x267a('0x23')](_0x267a('0x24'),'afterCreate',util[_0x267a('0x25')](_0x267a('0x26'),_0x52bb27['id'],_0x168d29[_0x267a('0x22')]));if(_0x168d29[_0x267a('0x27')]&&_0x168d29[_0x267a('0x27')][_0x267a('0x28')]){_0x52bb27[_0x267a('0x29')]=_[_0x267a('0x2a')](_0x168d29['Interactions'][0x0],_0x267a('0x20'));_0x52bb27[_0x267a('0x20')]=_0x168d29[_0x267a('0x27')][0x0]['Contact'];}var _0x95a54e={'method':'POST','uri':encodeURI(_0x168d29['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x95a54e[_0x267a('0x2b')]){case _0x267a('0x2c'):_0x95a54e['qs']=_0x52bb27;break;case _0x267a('0x2d'):_0x95a54e[_0x267a('0xb')]=_0x52bb27;break;}return rp(_0x95a54e)[_0x267a('0x17')](function(_0x35c021){logger[_0x267a('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x267a('0x2e'),util[_0x267a('0x25')](_0x267a('0x2f'),_0x52bb27['id'],_0x168d29['replyUri']));if(_0x35c021['body'][_0x267a('0x30')]&&_0x35c021['body'][_0x267a('0x30')]!=_0x52bb27[_0x267a('0x29')][_0x267a('0x30')]){return _0x42e210[_0x267a('0x15')][_0x267a('0x18')]({'threadId':_0x35c021['body'][_0x267a('0x30')]},{'logging':!![],'where':{'id':_0x52bb27['Interaction']['id']}});}else{return;}})[_0x267a('0x17')](function(){return _0x84fef4[_0x267a('0x18')]({'read':!![]});})[_0x267a('0x31')](function(_0x42b0f3){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x267a('0x2e'),util[_0x267a('0x32')](_0x42b0f3,{'showHidden':![],'depth':null}));_0x207db5();});}else{_0x207db5();}})[_0x267a('0x33')](function(){_0x207db5();});}else{_0x207db5();}}},'charset':'utf8mb4','collate':_0x267a('0x34')});}; \ No newline at end of file +var _0x92f0=['replyUri','Interaction','omit','POST','method','GET','body','afterCreate','threadId','finally','utf8mb4','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','error','CmContact','describe','OpenchannelAccount','OpenchannelInteraction','Interactions','Contact','info','format','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x92f0,0x10d));var _0x092f=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0x92f0[_0x158e3b];return _0x551a1d;};'use strict';var _=require('lodash');var util=require(_0x092f('0x0'));var logger=require(_0x092f('0x1'))('api');var moment=require(_0x092f('0x2'));var BPromise=require(_0x092f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x092f('0x4'));var config=require(_0x092f('0x5'));var attributes=require(_0x092f('0x6'));module[_0x092f('0x7')]=function(_0x2996b0,_0x2b6dcb){return _0x2996b0['define'](_0x092f('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x092f('0x9'),'fields':['body'],'type':_0x092f('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x513796,_0x1e70e5,_0x517a36){var _0x2f073a=_0x2996b0[_0x092f('0xb')];var _0x32bc71=_0x513796['get']({'plain':!![]});if(_0x32bc71[_0x092f('0xc')][_0x092f('0xd')]()==='in'||_0x32bc71[_0x092f('0xc')][_0x092f('0xd')]()===_0x092f('0xe')&&!_0x32bc71['secret']&&!_[_0x092f('0xf')](_0x32bc71[_0x092f('0x10')])){_0x2f073a['OpenchannelInteraction'][_0x092f('0x11')]({'where':{'id':_0x32bc71[_0x092f('0x12')]}})[_0x092f('0x13')](function(_0x3df148){if(_0x3df148){_0x3df148[_0x092f('0x14')]({'lastMsgAt':_0x32bc71[_0x092f('0x15')],'lastMsgDirection':_0x32bc71[_0x092f('0xc')][_0x092f('0xd')]()});}})['catch'](function(_0x352456){console[_0x092f('0x16')](_0x352456);});}if(_0x32bc71[_0x092f('0xc')]===_0x092f('0xe')&&!_0x32bc71['secret']){var _0x530214;_0x2f073a[_0x092f('0x17')][_0x092f('0x18')]()[_0x092f('0x13')](function(_0x3dcdee){return _0x2f073a[_0x092f('0x19')]['find']({'where':{'id':_0x32bc71['OpenchannelAccountId']},'include':[{'model':_0x2f073a[_0x092f('0x1a')],'as':_0x092f('0x1b'),'where':{'id':_0x32bc71[_0x092f('0x12')]},'limit':0x1,'include':[{'model':_0x2f073a[_0x092f('0x17')],'as':_0x092f('0x1c'),'attributes':_['keys'](_0x3dcdee)}]}]});})[_0x092f('0x13')](function(_0x4a7114){_0x530214=_0x4a7114['get']({'plain':!![]});if(_0x530214&&_0x530214['replyUri']){logger[_0x092f('0x1d')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x092f('0x1e')](_0x092f('0x1f'),_0x32bc71['id'],_0x530214[_0x092f('0x20')]));if(_0x530214['Interactions']&&_0x530214[_0x092f('0x1b')]['length']){_0x32bc71[_0x092f('0x21')]=_[_0x092f('0x22')](_0x530214[_0x092f('0x1b')][0x0],_0x092f('0x1c'));_0x32bc71[_0x092f('0x1c')]=_0x530214[_0x092f('0x1b')][0x0][_0x092f('0x1c')];}var _0x1e70e5={'method':_0x092f('0x23'),'uri':encodeURI(_0x530214[_0x092f('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1e70e5[_0x092f('0x24')]){case _0x092f('0x25'):_0x1e70e5['qs']=_0x32bc71;break;case _0x092f('0x23'):_0x1e70e5[_0x092f('0x26')]=_0x32bc71;break;}return rp(_0x1e70e5)['then'](function(_0x2c0524){logger[_0x092f('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x092f('0x27'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x32bc71['id'],_0x530214[_0x092f('0x20')]));if(_0x2c0524[_0x092f('0x26')][_0x092f('0x28')]&&_0x2c0524[_0x092f('0x26')]['threadId']!=_0x32bc71[_0x092f('0x21')]['threadId']){return _0x2f073a[_0x092f('0x1a')][_0x092f('0x14')]({'threadId':_0x2c0524[_0x092f('0x26')][_0x092f('0x28')]},{'logging':!![],'where':{'id':_0x32bc71[_0x092f('0x21')]['id']}});}else{return;}})[_0x092f('0x13')](function(){return _0x513796['update']({'read':!![]});})['catch'](function(_0x4f74c8){logger[_0x092f('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x092f('0x27'),util['inspect'](_0x4f74c8,{'showHidden':![],'depth':null}));_0x517a36();});}else{_0x517a36();}})[_0x092f('0x29')](function(){_0x517a36();});}else{_0x517a36();}}},'charset':_0x092f('0x2a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 177f46f..9af8669 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 _0x1122=['OpenchannelMessage','create','body','options','raw','then','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateOpenchannelMessage'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2112('0x0'));var util=require('util');var moment=require(_0x2112('0x1'));var BPromise=require(_0x2112('0x2'));var rs=require(_0x2112('0x3'));var fs=require('fs');var Redis=require(_0x2112('0x4'));var db=require(_0x2112('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2112('0x6'));var config=require('../../config/environment');var jayson=require(_0x2112('0x7'));var client=jayson[_0x2112('0x8')]['http']({'port':0x232a});config[_0x2112('0x9')]=_[_0x2112('0xa')](config[_0x2112('0x9')],{'host':_0x2112('0xb'),'port':0x18eb});var socket=require(_0x2112('0xc'))(new Redis(config[_0x2112('0x9')]));require(_0x2112('0xd'))[_0x2112('0xe')](socket);function respondWithRpcPromise(_0x18a596,_0x485a3d,_0x4690e6){return new BPromise(function(_0x46fc8b,_0x42eddd){return client[_0x2112('0xf')](_0x18a596,_0x4690e6)['then'](function(_0xa0a089){logger[_0x2112('0x10')](_0x2112('0x11'),_0x485a3d,_0x2112('0x12'));logger[_0x2112('0x13')](_0x2112('0x14'),_0x485a3d,_0x2112('0x12'),JSON['stringify'](_0xa0a089));if(_0xa0a089[_0x2112('0x15')]){if(_0xa0a089['error'][_0x2112('0x16')]===0x1f4){logger[_0x2112('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x485a3d,_0xa0a089[_0x2112('0x15')]['message']);return _0x42eddd(_0xa0a089[_0x2112('0x15')]['message']);}logger[_0x2112('0x15')](_0x2112('0x11'),_0x485a3d,_0xa0a089['error'][_0x2112('0x17')]);return _0x46fc8b(_0xa0a089['error'][_0x2112('0x17')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x485a3d,_0x2112('0x12'));_0x46fc8b(_0xa0a089['result']['message']);}})[_0x2112('0x18')](function(_0x28d498){logger[_0x2112('0x15')](_0x2112('0x11'),_0x485a3d,_0x28d498);_0x42eddd(_0x28d498);});});}exports[_0x2112('0x19')]=function(_0x49d9ca){var _0x368104=this;return new Promise(function(_0x514d50,_0x5b7e84){return db[_0x2112('0x1a')][_0x2112('0x1b')](_0x49d9ca[_0x2112('0x1c')],{'raw':_0x49d9ca['options']?_0x49d9ca[_0x2112('0x1d')][_0x2112('0x1e')]===undefined?!![]:![]:!![]})[_0x2112('0x1f')](function(_0x101565){logger[_0x2112('0x10')](_0x2112('0x19'),_0x49d9ca);logger[_0x2112('0x13')](_0x2112('0x19'),_0x49d9ca,JSON[_0x2112('0x20')](_0x101565));_0x514d50(_0x101565);})['catch'](function(_0x2ad11b){logger[_0x2112('0x15')](_0x2112('0x19'),_0x2ad11b[_0x2112('0x17')],_0x49d9ca);_0x5b7e84(_0x368104[_0x2112('0x15')](0x1f4,_0x2ad11b[_0x2112('0x17')]));});});}; \ No newline at end of file +var _0xf105=['client','http','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','create','body','options','raw','CreateOpenchannelMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1f4bf4,_0x4e0104){var _0x56859d=function(_0x245883){while(--_0x245883){_0x1f4bf4['push'](_0x1f4bf4['shift']());}};_0x56859d(++_0x4e0104);}(_0xf105,0x1b0));var _0x5f10=function(_0x3dee63,_0x4e96f2){_0x3dee63=_0x3dee63-0x0;var _0x5deed9=_0xf105[_0x3dee63];return _0x5deed9;};'use strict';var _=require(_0x5f10('0x0'));var util=require(_0x5f10('0x1'));var moment=require(_0x5f10('0x2'));var BPromise=require(_0x5f10('0x3'));var rs=require(_0x5f10('0x4'));var fs=require('fs');var Redis=require(_0x5f10('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f10('0x6'));var logger=require('../../config/logger')(_0x5f10('0x7'));var config=require(_0x5f10('0x8'));var jayson=require(_0x5f10('0x9'));var client=jayson[_0x5f10('0xa')][_0x5f10('0xb')]({'port':0x232a});config[_0x5f10('0xc')]=_[_0x5f10('0xd')](config[_0x5f10('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f10('0xe'))(new Redis(config[_0x5f10('0xc')]));require(_0x5f10('0xf'))[_0x5f10('0x10')](socket);function respondWithRpcPromise(_0x1b5463,_0x6dc96e,_0x540d92){return new BPromise(function(_0x1009b9,_0x3fd8eb){return client[_0x5f10('0x11')](_0x1b5463,_0x540d92)[_0x5f10('0x12')](function(_0x20fad6){logger[_0x5f10('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x6dc96e,_0x5f10('0x14'));logger[_0x5f10('0x15')](_0x5f10('0x16'),_0x6dc96e,_0x5f10('0x14'),JSON['stringify'](_0x20fad6));if(_0x20fad6['error']){if(_0x20fad6[_0x5f10('0x17')][_0x5f10('0x18')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x6dc96e,_0x20fad6[_0x5f10('0x17')]['message']);return _0x3fd8eb(_0x20fad6['error']['message']);}logger[_0x5f10('0x17')](_0x5f10('0x19'),_0x6dc96e,_0x20fad6['error'][_0x5f10('0x1a')]);return _0x1009b9(_0x20fad6[_0x5f10('0x17')]['message']);}else{logger[_0x5f10('0x13')](_0x5f10('0x19'),_0x6dc96e,_0x5f10('0x14'));_0x1009b9(_0x20fad6[_0x5f10('0x1b')]['message']);}})['catch'](function(_0x40c679){logger[_0x5f10('0x17')](_0x5f10('0x19'),_0x6dc96e,_0x40c679);_0x3fd8eb(_0x40c679);});});}exports['CreateOpenchannelMessage']=function(_0x1a5ac4){var _0x1230e0=this;return new Promise(function(_0x4e7cf1,_0x3983f0){return db['OpenchannelMessage'][_0x5f10('0x1c')](_0x1a5ac4[_0x5f10('0x1d')],{'raw':_0x1a5ac4[_0x5f10('0x1e')]?_0x1a5ac4[_0x5f10('0x1e')][_0x5f10('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x5407a6){logger[_0x5f10('0x13')](_0x5f10('0x20'),_0x1a5ac4);logger[_0x5f10('0x15')](_0x5f10('0x20'),_0x1a5ac4,JSON[_0x5f10('0x21')](_0x5407a6));_0x4e7cf1(_0x5407a6);})['catch'](function(_0x3aa6a3){logger[_0x5f10('0x17')](_0x5f10('0x20'),_0x3aa6a3[_0x5f10('0x1a')],_0x1a5ac4);_0x3983f0(_0x1230e0['error'](0x1f4,_0x3aa6a3['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3f364bd..f63e7b0 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 _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_0x49a57f,_0x405f38){var _0x2fa2a5=function(_0x359a98){while(--_0x359a98){_0x49a57f['push'](_0x49a57f['shift']());}};_0x2fa2a5(++_0x405f38);}(_0xac4a,0x13f));var _0xaac4=function(_0x82a75,_0x4a562d){_0x82a75=_0x82a75-0x0;var _0x2a208d=_0xac4a[_0x82a75];return _0x2a208d;};'use strict';var OpenchannelMessageEvents=require(_0xaac4('0x0'));var events=[_0xaac4('0x1'),_0xaac4('0x2'),_0xaac4('0x3')];function createListener(_0x38f4f4,_0x1dc251){return function(_0x5aeb7d){_0x1dc251['emit'](_0x38f4f4,_0x5aeb7d);};}function removeListener(_0x2af0f6,_0x2a5762){return function(){OpenchannelMessageEvents[_0xaac4('0x4')](_0x2af0f6,_0x2a5762);};}exports['register']=function(_0x1283a5){for(var _0x53d03a=0x0,_0x1cdfc5=events['length'];_0x53d03a<_0x1cdfc5;_0x53d03a++){var _0x1e4283=events[_0x53d03a];var _0x27354c=createListener('openchannelMessage:'+_0x1e4283,_0x1283a5);OpenchannelMessageEvents['on'](_0x1e4283,_0x27354c);}}; \ No newline at end of file +var _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x42e803,_0x5b3e49){var _0x3b73f2=function(_0x2cecc4){while(--_0x2cecc4){_0x42e803['push'](_0x42e803['shift']());}};_0x3b73f2(++_0x5b3e49);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x246115,_0x398123){_0x246115=_0x246115-0x0;var _0x385878=_0xcb91[_0x246115];return _0x385878;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 80a38d7..045dbdd 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 _0xf072=['getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x48c4cf,_0xdf9497){var _0x483f32=function(_0x4c37ba){while(--_0x4c37ba){_0x48c4cf['push'](_0x48c4cf['shift']());}};_0x483f32(++_0xdf9497);}(_0xf072,0x1cf));var _0x2f07=function(_0x3e04e6,_0x2a3ce3){_0x3e04e6=_0x3e04e6-0x0;var _0x190557=_0xf072[_0x3e04e6];return _0x190557;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var auth=require(_0x2f07('0x4'));var interaction=require(_0x2f07('0x5'));var config=require(_0x2f07('0x6'));var controller=require('./openchannelQueue.controller');router[_0x2f07('0x7')]('/',auth[_0x2f07('0x8')](),controller[_0x2f07('0x9')]);router[_0x2f07('0x7')](_0x2f07('0xa'),auth[_0x2f07('0x8')](),controller[_0x2f07('0xb')]);router[_0x2f07('0x7')](_0x2f07('0xc'),auth[_0x2f07('0x8')](),controller[_0x2f07('0xd')]);router[_0x2f07('0x7')](_0x2f07('0xe'),auth[_0x2f07('0x8')](),controller[_0x2f07('0xf')]);router['get'](_0x2f07('0x10'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x11')]);router[_0x2f07('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x2f07('0x12')]);router[_0x2f07('0x13')]('/',auth['isAuthenticated'](),controller[_0x2f07('0x14')]);router[_0x2f07('0x13')](_0x2f07('0x10'),auth['isAuthenticated'](),controller[_0x2f07('0x15')]);router[_0x2f07('0x13')](_0x2f07('0x16'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x17')]);router[_0x2f07('0x18')]('/:id',auth[_0x2f07('0x8')](),controller['update']);router[_0x2f07('0x19')](_0x2f07('0xc'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x1a')]);router[_0x2f07('0x19')](_0x2f07('0x10'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x1b')]);router['delete'](_0x2f07('0x16'),auth['isAuthenticated'](),controller[_0x2f07('0x1c')]);module[_0x2f07('0x1d')]=router; \ No newline at end of file +var _0x737d=['get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','multer','util','../../components/auth/service','../../config/environment'];(function(_0x3f1ee0,_0x30762f){var _0x41f93c=function(_0x7c397d){while(--_0x7c397d){_0x3f1ee0['push'](_0x3f1ee0['shift']());}};_0x41f93c(++_0x30762f);}(_0x737d,0xbc));var _0xd737=function(_0x28eb00,_0x3d546f){_0x28eb00=_0x28eb00-0x0;var _0x273831=_0x737d[_0x28eb00];return _0x273831;};'use strict';var multer=require(_0xd737('0x0'));var util=require(_0xd737('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xd737('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xd737('0x3'));var controller=require('./openchannelQueue.controller');router[_0xd737('0x4')]('/',auth[_0xd737('0x5')](),controller[_0xd737('0x6')]);router[_0xd737('0x4')](_0xd737('0x7'),auth[_0xd737('0x5')](),controller[_0xd737('0x8')]);router[_0xd737('0x4')](_0xd737('0x9'),auth[_0xd737('0x5')](),controller['show']);router[_0xd737('0x4')](_0xd737('0xa'),auth['isAuthenticated'](),controller[_0xd737('0xb')]);router[_0xd737('0x4')]('/:id/teams',auth[_0xd737('0x5')](),controller[_0xd737('0xc')]);router['get'](_0xd737('0xd'),auth['isAuthenticated'](),controller[_0xd737('0xe')]);router[_0xd737('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd737('0xf')](_0xd737('0x10'),auth['isAuthenticated'](),controller[_0xd737('0x11')]);router[_0xd737('0xf')](_0xd737('0xd'),auth[_0xd737('0x5')](),controller[_0xd737('0x12')]);router[_0xd737('0x13')](_0xd737('0x9'),auth[_0xd737('0x5')](),controller['update']);router['delete'](_0xd737('0x9'),auth[_0xd737('0x5')](),controller[_0xd737('0x14')]);router[_0xd737('0x15')](_0xd737('0x10'),auth[_0xd737('0x5')](),controller[_0xd737('0x16')]);router[_0xd737('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xd737('0x17')]);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 96354a5..5dadd91 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 _0x30cb=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x93da70,_0x1a48ac){var _0x2984c4=function(_0x3c6389){while(--_0x3c6389){_0x93da70['push'](_0x93da70['shift']());}};_0x2984c4(++_0x1a48ac);}(_0x30cb,0x1f1));var _0xb30c=function(_0xcc3caf,_0x11800f){_0xcc3caf=_0xcc3caf-0x0;var _0x5d1173=_0x30cb[_0xcc3caf];return _0x5d1173;};'use strict';var Sequelize=require(_0xb30c('0x0'));module[_0xb30c('0x1')]={'name':{'type':Sequelize[_0xb30c('0x2')],'unique':_0xb30c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb30c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb30c('0x4')](_0xb30c('0x5'),_0xb30c('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x9666=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x38c3c2,_0x44b430){var _0x4a1fed=function(_0x4f4b56){while(--_0x4f4b56){_0x38c3c2['push'](_0x38c3c2['shift']());}};_0x4a1fed(++_0x44b430);}(_0x9666,0x17a));var _0x6966=function(_0x13b880,_0x7bd56c){_0x13b880=_0x13b880-0x0;var _0x2bee77=_0x9666[_0x13b880];return _0x2bee77;};'use strict';var Sequelize=require(_0x6966('0x0'));module[_0x6966('0x1')]={'name':{'type':Sequelize[_0x6966('0x2')],'unique':_0x6966('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6966('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6966('0x5')](_0x6966('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a526cfb..a2d50fe 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 _0x41ec=['union','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','removeAgents','getAgents','html-pdf','eml-format','zip-dir','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','body','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','agent','updatedAt','format','SIP','openchannelPause','createdAt','Team','getTeams','addTeams','ids','Agents','flatMap','find','transaction','each','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x41ec,0x8f));var _0xc41e=function(_0x106c51,_0x28da33){_0x106c51=_0x106c51-0x0;var _0x45f8f1=_0x41ec[_0x106c51];return _0x45f8f1;};'use strict';var pdf=require(_0xc41e('0x0'));var emlformat=require(_0xc41e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc41e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc41e('0x3'));var BPromise=require(_0xc41e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc41e('0x5'));var sox=require(_0xc41e('0x6'));var csv=require('to-csv');var ejs=require(_0xc41e('0x7'));var fs=require('fs');var _=require(_0xc41e('0x8'));var squel=require(_0xc41e('0x9'));var crypto=require('crypto');var jsforce=require(_0xc41e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc41e('0xb'));var querystring=require(_0xc41e('0xc'));var Papa=require(_0xc41e('0xd'));var Redis=require(_0xc41e('0xe'));var authService=require(_0xc41e('0xf'));var qs=require(_0xc41e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc41e('0x11'));var logger=require(_0xc41e('0x12'))(_0xc41e('0x13'));var utils=require(_0xc41e('0x14'));var config=require(_0xc41e('0x15'));var db=require(_0xc41e('0x16'))['db'];config[_0xc41e('0x17')]=_[_0xc41e('0x18')](config[_0xc41e('0x17')],{'host':_0xc41e('0x19'),'port':0x18eb});var socket=require(_0xc41e('0x1a'))(new Redis(config[_0xc41e('0x17')]));require(_0xc41e('0x1b'))[_0xc41e('0x1c')](socket);function respondWithStatusCode(_0x4482d2,_0x3c4dc1){_0x3c4dc1=_0x3c4dc1||0xcc;return function(_0x493333){if(_0x493333){return _0x4482d2[_0xc41e('0x1d')](_0x3c4dc1);}return _0x4482d2[_0xc41e('0x1e')](_0x3c4dc1)[_0xc41e('0x1f')]();};}function respondWithResult(_0x4ae787,_0x404a77){_0x404a77=_0x404a77||0xc8;return function(_0x60547d){if(_0x60547d){return _0x4ae787[_0xc41e('0x1e')](_0x404a77)['json'](_0x60547d);}};}function respondWithFilteredResult(_0x419ac9,_0x43a50a){return function(_0x5b4e9c){if(_0x5b4e9c){var _0x2bb5c8=_0x5b4e9c[_0xc41e('0x20')],_0x44fb0a=_0x43a50a[_0xc41e('0x21')],_0x4400a2=_0x43a50a[_0xc41e('0x21')]+_0x43a50a['limit'],_0x410a3e;if(_0x4400a2>=_0x2bb5c8){_0x4400a2=_0x2bb5c8;_0x410a3e=0xc8;}else{_0x410a3e=0xce;}_0x419ac9['status'](_0x410a3e);return _0x419ac9[_0xc41e('0x22')](_0xc41e('0x23'),_0x44fb0a+'-'+_0x4400a2+'/'+_0x2bb5c8)[_0xc41e('0x24')](_0x5b4e9c);}return null;};}function patchUpdates(_0x3e1d80){return function(_0x5994a3){try{jsonpatch[_0xc41e('0x25')](_0x5994a3,_0x3e1d80,!![]);}catch(_0x786643){return BPromise[_0xc41e('0x26')](_0x786643);}return _0x5994a3[_0xc41e('0x27')]();};}function saveUpdates(_0x49da6f,_0x17bf7d){return function(_0x40ff99){if(_0x40ff99){return _0x40ff99[_0xc41e('0x28')](_0x49da6f)[_0xc41e('0x29')](function(_0x42f9f0){return _0x42f9f0;});}return null;};}function removeEntity(_0x1db62e,_0x867ec4){return function(_0x2b29ac){if(_0x2b29ac){return _0x2b29ac[_0xc41e('0x2a')]()[_0xc41e('0x29')](function(){var _0x4502b7=_0x2b29ac[_0xc41e('0x2b')]({'plain':!![]});var _0x369ac8=_0xc41e('0x2c');return db[_0xc41e('0x2d')][_0xc41e('0x2a')]({'where':{'type':_0x369ac8,'resourceId':_0x4502b7['id']}})[_0xc41e('0x29')](function(){return _0x2b29ac;});})[_0xc41e('0x29')](function(){_0x1db62e[_0xc41e('0x1e')](0xcc)[_0xc41e('0x1f')]();});}};}function handleEntityNotFound(_0x58521f,_0x3f044a){return function(_0x5bafd){if(!_0x5bafd){_0x58521f[_0xc41e('0x1d')](0x194);}return _0x5bafd;};}function handleError(_0x45bc39,_0x4c89b1){_0x4c89b1=_0x4c89b1||0x1f4;return function(_0x28820e){logger[_0xc41e('0x2e')](_0x28820e[_0xc41e('0x2f')]);if(_0x28820e[_0xc41e('0x30')]){delete _0x28820e['name'];}_0x45bc39[_0xc41e('0x1e')](_0x4c89b1)[_0xc41e('0x31')](_0x28820e);};}exports['index']=function(_0x801979,_0x45435c){var _0xf2a7d3={},_0x1c9395={},_0x273c23={'count':0x0,'rows':[]};var _0x207df3=_[_0xc41e('0x32')](db[_0xc41e('0x33')]['rawAttributes'],function(_0x293615){return{'name':_0x293615[_0xc41e('0x34')],'type':_0x293615[_0xc41e('0x35')]['key']};});_0x1c9395[_0xc41e('0x36')]=_[_0xc41e('0x32')](_0x207df3,_0xc41e('0x30'));_0x1c9395[_0xc41e('0x37')]=_[_0xc41e('0x38')](_0x801979['query']);_0x1c9395[_0xc41e('0x39')]=_['intersection'](_0x1c9395['model'],_0x1c9395['query']);_0xf2a7d3['attributes']=_[_0xc41e('0x3a')](_0x1c9395[_0xc41e('0x36')],qs[_0xc41e('0x3b')](_0x801979[_0xc41e('0x37')][_0xc41e('0x3b')]));_0xf2a7d3[_0xc41e('0x3c')]=_0xf2a7d3['attributes'][_0xc41e('0x3d')]?_0xf2a7d3[_0xc41e('0x3c')]:_0x1c9395[_0xc41e('0x36')];if(!_0x801979[_0xc41e('0x37')][_0xc41e('0x3e')](_0xc41e('0x3f'))){_0xf2a7d3[_0xc41e('0x40')]=qs['limit'](_0x801979[_0xc41e('0x37')][_0xc41e('0x40')]);_0xf2a7d3[_0xc41e('0x21')]=qs[_0xc41e('0x21')](_0x801979['query'][_0xc41e('0x21')]);}_0xf2a7d3[_0xc41e('0x41')]=qs[_0xc41e('0x42')](_0x801979[_0xc41e('0x37')][_0xc41e('0x42')]);_0xf2a7d3[_0xc41e('0x43')]=qs[_0xc41e('0x39')](_[_0xc41e('0x44')](_0x801979[_0xc41e('0x37')],_0x1c9395[_0xc41e('0x39')]),_0x207df3);if(_0x801979[_0xc41e('0x37')][_0xc41e('0x45')]){_0xf2a7d3[_0xc41e('0x43')]=_['merge'](_0xf2a7d3[_0xc41e('0x43')],{'$or':_['map'](_0x207df3,function(_0x496c20){if(_0x496c20[_0xc41e('0x35')]!=='VIRTUAL'){var _0x26cbb1={};_0x26cbb1[_0x496c20[_0xc41e('0x30')]]={'$like':'%'+_0x801979['query'][_0xc41e('0x45')]+'%'};return _0x26cbb1;}})});}_0xf2a7d3=_[_0xc41e('0x46')]({},_0xf2a7d3,_0x801979[_0xc41e('0x47')]);var _0x11587f={'where':_0xf2a7d3[_0xc41e('0x43')]};return db['OpenchannelQueue'][_0xc41e('0x20')](_0x11587f)[_0xc41e('0x29')](function(_0x1d2050){_0x273c23['count']=_0x1d2050;if(_0x801979[_0xc41e('0x37')][_0xc41e('0x48')]){_0xf2a7d3[_0xc41e('0x49')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xc41e('0x4a')](_0xf2a7d3);})[_0xc41e('0x29')](function(_0x27e815){_0x273c23[_0xc41e('0x4b')]=_0x27e815;return _0x273c23;})['then'](respondWithFilteredResult(_0x45435c,_0xf2a7d3))['catch'](handleError(_0x45435c,null));};exports[_0xc41e('0x4c')]=function(_0x474205,_0x33cb55){var _0x42d9cf={'raw':!![],'where':{'id':_0x474205[_0xc41e('0x4d')]['id']}},_0x20879b={};_0x20879b[_0xc41e('0x36')]=_[_0xc41e('0x38')](db[_0xc41e('0x33')][_0xc41e('0x4e')]);_0x20879b[_0xc41e('0x37')]=_['keys'](_0x474205[_0xc41e('0x37')]);_0x20879b['filters']=_['intersection'](_0x20879b[_0xc41e('0x36')],_0x20879b['query']);_0x42d9cf[_0xc41e('0x3c')]=_[_0xc41e('0x3a')](_0x20879b['model'],qs[_0xc41e('0x3b')](_0x474205[_0xc41e('0x37')][_0xc41e('0x3b')]));_0x42d9cf[_0xc41e('0x3c')]=_0x42d9cf['attributes'][_0xc41e('0x3d')]?_0x42d9cf['attributes']:_0x20879b[_0xc41e('0x36')];if(_0x474205[_0xc41e('0x37')][_0xc41e('0x48')]){_0x42d9cf[_0xc41e('0x49')]=[{'all':!![]}];}_0x42d9cf=_[_0xc41e('0x46')]({},_0x42d9cf,_0x474205['options']);return db[_0xc41e('0x33')]['find'](_0x42d9cf)['then'](handleEntityNotFound(_0x33cb55,null))['then'](respondWithResult(_0x33cb55,null))[_0xc41e('0x4f')](handleError(_0x33cb55,null));};exports[_0xc41e('0x50')]=function(_0x104d82,_0x13d683){return db[_0xc41e('0x33')]['create'](_0x104d82['body'],{})[_0xc41e('0x29')](function(_0x139a3d){var _0x54d76d=_0x104d82[_0xc41e('0x51')][_0xc41e('0x2b')]({'plain':!![]});if(!_0x54d76d)throw new Error(_0xc41e('0x52'));if(_0x54d76d['role']==='user'){var _0x3609ab=_0x139a3d['get']({'plain':!![]});var _0xd6d77d=_0xc41e('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0xd6d77d,'userProfileId':_0x54d76d['userProfileId']},'raw':!![]})[_0xc41e('0x29')](function(_0x527b18){if(_0x527b18&&_0x527b18[_0xc41e('0x53')]===0x0){return db[_0xc41e('0x2d')][_0xc41e('0x50')]({'name':_0x3609ab[_0xc41e('0x30')],'resourceId':_0x3609ab['id'],'type':_0x527b18[_0xc41e('0x30')],'sectionId':_0x527b18['id']},{})['then'](function(){return _0x139a3d;});}else{return _0x139a3d;}})[_0xc41e('0x4f')](function(_0x3f6ea5){logger[_0xc41e('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f6ea5);throw _0x3f6ea5;});}return _0x139a3d;})['then'](respondWithResult(_0x13d683,0xc9))[_0xc41e('0x4f')](handleError(_0x13d683,null));};exports[_0xc41e('0x28')]=function(_0x239783,_0xe6840f){if(_0x239783[_0xc41e('0x54')]['id']){delete _0x239783['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x239783[_0xc41e('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe6840f,null))['then'](saveUpdates(_0x239783[_0xc41e('0x54')],null))[_0xc41e('0x29')](respondWithResult(_0xe6840f,null))[_0xc41e('0x4f')](handleError(_0xe6840f,null));};exports[_0xc41e('0x2a')]=function(_0x2cb921,_0x5bbdf9){return db['OpenchannelQueue']['find']({'where':{'id':_0x2cb921['params']['id']}})['then'](handleEntityNotFound(_0x5bbdf9,null))[_0xc41e('0x29')](removeEntity(_0x5bbdf9,null))[_0xc41e('0x4f')](handleError(_0x5bbdf9,null));};exports['describe']=function(_0xbf6c66,_0x50b841){return db['OpenchannelQueue'][_0xc41e('0x55')]()[_0xc41e('0x29')](respondWithResult(_0x50b841,null))[_0xc41e('0x4f')](handleError(_0x50b841,null));};exports[_0xc41e('0x56')]=function(_0x3e2250,_0x2a2d99,_0x87a690){var _0x402d18={'raw':!![],'where':{}},_0x1fcc81={},_0x3273ab;return db['OpenchannelQueue'][_0xc41e('0x57')]({'where':{'id':_0x3e2250[_0xc41e('0x4d')]['id']}})[_0xc41e('0x29')](handleEntityNotFound(_0x2a2d99,null))[_0xc41e('0x29')](function(_0x416aa6){if(_0x416aa6){_0x3273ab=_0x416aa6[_0xc41e('0x2b')]({'plain':!![]});_0x1fcc81[_0xc41e('0x36')]=_[_0xc41e('0x38')](db[_0xc41e('0x58')][_0xc41e('0x4e')]);_0x1fcc81[_0xc41e('0x37')]=_[_0xc41e('0x38')](_0x3e2250['query']);_0x1fcc81['filters']=_[_0xc41e('0x3a')](_0x1fcc81[_0xc41e('0x36')],_0x1fcc81[_0xc41e('0x37')]);_0x402d18[_0xc41e('0x3c')]=_['intersection'](_0x1fcc81[_0xc41e('0x36')],qs[_0xc41e('0x3b')](_0x3e2250[_0xc41e('0x37')][_0xc41e('0x3b')]));_0x402d18[_0xc41e('0x3c')]=_0x402d18[_0xc41e('0x3c')][_0xc41e('0x3d')]?_0x402d18['attributes']:_0x1fcc81[_0xc41e('0x36')];if(!_0x3e2250[_0xc41e('0x37')]['hasOwnProperty'](_0xc41e('0x3f'))){_0x402d18[_0xc41e('0x40')]=qs[_0xc41e('0x40')](_0x3e2250[_0xc41e('0x37')]['limit']);_0x402d18[_0xc41e('0x21')]=qs['offset'](_0x3e2250[_0xc41e('0x37')][_0xc41e('0x21')]);}_0x402d18['order']=qs['sort'](_0x3e2250['query'][_0xc41e('0x42')]);_0x402d18[_0xc41e('0x43')]=qs['filters'](_['pick'](_0x3e2250[_0xc41e('0x37')],_0x1fcc81['filters']));_0x402d18[_0xc41e('0x43')][_0xc41e('0x59')]=_0x416aa6['id'];if(_0x3e2250['query'][_0xc41e('0x45')]){_0x402d18[_0xc41e('0x43')]=_[_0xc41e('0x46')](_0x402d18[_0xc41e('0x43')],{'$or':_[_0xc41e('0x32')](_0x402d18[_0xc41e('0x3c')],function(_0x3519c5){var _0x35cffa={};_0x35cffa[_0x3519c5]={'$like':'%'+_0x3e2250[_0xc41e('0x37')][_0xc41e('0x45')]+'%'};return _0x35cffa;})});}_0x402d18=_[_0xc41e('0x46')]({},_0x402d18,_0x3e2250[_0xc41e('0x47')]);return db['UserOpenchannelQueue'][_0xc41e('0x4a')](_0x402d18);}})[_0xc41e('0x29')](function(_0x48fa22){if(_0x48fa22){return db[_0xc41e('0x5a')][_0xc41e('0x5b')]({'where':{'id':_[_0xc41e('0x32')](_0x48fa22,'UserId'),'role':_0xc41e('0x5c')},'attributes':['id',_0xc41e('0x30'),'openchannelPause',_0xc41e('0x5d'),'createdAt']});}})[_0xc41e('0x29')](function(_0x19c0c6){if(_0x19c0c6){return{'count':_0x19c0c6[_0xc41e('0x20')],'rows':_[_0xc41e('0x32')](_0x19c0c6[_0xc41e('0x4b')],function(_0x58986a){return{'membername':_0x58986a['name'],'UserId':_0x58986a['id'],'queue_name':_0x3273ab[_0xc41e('0x30')],'OpenchannelQueueId':_0x3273ab['id'],'interface':util[_0xc41e('0x5e')]('%s/%s',_0xc41e('0x5f'),_0x58986a[_0xc41e('0x30')]),'penalty':0x0,'paused':_0x58986a[_0xc41e('0x60')],'createdAt':_0x58986a[_0xc41e('0x61')],'updatedAt':_0x58986a[_0xc41e('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc41e('0x29')](respondWithFilteredResult(_0x2a2d99,_0x402d18))[_0xc41e('0x4f')](handleError(_0x2a2d99,null));};exports['getTeams']=function(_0x5382e2,_0x527fae,_0x304f5f){var _0x44a852={};var _0x2cb7f4={};var _0x462584;var _0x423343;return db['OpenchannelQueue'][_0xc41e('0x57')]({'where':{'id':_0x5382e2[_0xc41e('0x4d')]['id']}})[_0xc41e('0x29')](handleEntityNotFound(_0x527fae,null))[_0xc41e('0x29')](function(_0x434f28){if(_0x434f28){_0x462584=_0x434f28;_0x2cb7f4['model']=_['keys'](db[_0xc41e('0x62')]['rawAttributes']);_0x2cb7f4[_0xc41e('0x37')]=_[_0xc41e('0x38')](_0x5382e2['query']);_0x2cb7f4[_0xc41e('0x39')]=_[_0xc41e('0x3a')](_0x2cb7f4[_0xc41e('0x36')],_0x2cb7f4['query']);_0x44a852[_0xc41e('0x3c')]=_[_0xc41e('0x3a')](_0x2cb7f4[_0xc41e('0x36')],qs[_0xc41e('0x3b')](_0x5382e2[_0xc41e('0x37')][_0xc41e('0x3b')]));_0x44a852['attributes']=_0x44a852[_0xc41e('0x3c')]['length']?_0x44a852['attributes']:_0x2cb7f4[_0xc41e('0x36')];_0x44a852['order']=qs[_0xc41e('0x42')](_0x5382e2[_0xc41e('0x37')][_0xc41e('0x42')]);_0x44a852['where']=qs[_0xc41e('0x39')](_['pick'](_0x5382e2[_0xc41e('0x37')],_0x2cb7f4[_0xc41e('0x39')]));if(_0x5382e2[_0xc41e('0x37')][_0xc41e('0x45')]){_0x44a852[_0xc41e('0x43')]=_[_0xc41e('0x46')](_0x44a852[_0xc41e('0x43')],{'$or':_[_0xc41e('0x32')](_0x44a852['attributes'],function(_0x4992e2){var _0x332f14={};_0x332f14[_0x4992e2]={'$like':'%'+_0x5382e2[_0xc41e('0x37')][_0xc41e('0x45')]+'%'};return _0x332f14;})});}_0x44a852=_[_0xc41e('0x46')]({},_0x44a852,_0x5382e2['options']);return _0x462584[_0xc41e('0x63')](_0x44a852);}})['then'](function(_0x1b4c14){if(_0x1b4c14){_0x423343=_0x1b4c14[_0xc41e('0x3d')];if(!_0x5382e2[_0xc41e('0x37')][_0xc41e('0x3e')](_0xc41e('0x3f'))){_0x44a852[_0xc41e('0x40')]=qs[_0xc41e('0x40')](_0x5382e2['query'][_0xc41e('0x40')]);_0x44a852['offset']=qs[_0xc41e('0x21')](_0x5382e2[_0xc41e('0x37')][_0xc41e('0x21')]);}return _0x462584['getTeams'](_0x44a852);}})[_0xc41e('0x29')](function(_0x26064e){if(_0x26064e){return _0x26064e?{'count':_0x423343,'rows':_0x26064e}:null;}})[_0xc41e('0x29')](respondWithResult(_0x527fae,null))[_0xc41e('0x4f')](handleError(_0x527fae,null));};exports[_0xc41e('0x64')]=function(_0x22107c,_0x4fc951,_0x390a1b){var _0x32b71b=_0x22107c[_0xc41e('0x54')][_0xc41e('0x65')];return db[_0xc41e('0x62')][_0xc41e('0x4a')]({'where':{'id':_0x32b71b},'attributes':['id'],'include':[{'model':db[_0xc41e('0x5a')],'as':_0xc41e('0x66'),'attributes':['id',_0xc41e('0x30'),'online','voicePause','interface'],'raw':!![]}]})[_0xc41e('0x29')](function(_0x4eb44b){if(_0x4eb44b){var _0x2db452=_[_0xc41e('0x67')](_0x4eb44b,function(_0x44d747){var _0x28b910=_0x44d747[_0xc41e('0x2b')]({'plain':!![]});return _0x28b910[_0xc41e('0x66')];});return db['OpenchannelQueue'][_0xc41e('0x68')]({'where':{'id':_0x22107c['params']['id']}})['then'](function(_0x5e6418){return db['sequelize'][_0xc41e('0x69')](function(_0x2c71f0){return _0x5e6418['addTeams'](_0x32b71b,{'transaction':_0x2c71f0})[_0xc41e('0x29')](function(){return BPromise[_0xc41e('0x6a')](_0x2db452,function(_0x446533){return db[_0xc41e('0x58')]['findOrCreate']({'where':{'UserId':_0x446533['id'],'OpenchannelQueueId':_0x22107c['params']['id']},'transaction':_0x2c71f0});});})[_0xc41e('0x29')](function(){_0x2db452[_0xc41e('0x6b')](function(_0x178563){socket[_0xc41e('0x6c')]('userOpenchannelQueue:save',{'UserId':_0x178563['id'],'OpenchannelQueueId':_0x5e6418['id']});});});});});}})['then'](respondWithStatusCode(_0x4fc951,null))[_0xc41e('0x4f')](handleError(_0x4fc951,null));};exports[_0xc41e('0x6d')]=function(_0x4130a3,_0xcfb591,_0x2619ca){return db['Team'][_0xc41e('0x4a')]({'where':{'id':_0x4130a3[_0xc41e('0x37')][_0xc41e('0x65')]},'attributes':['id'],'include':[{'model':db[_0xc41e('0x5a')],'as':_0xc41e('0x66'),'attributes':['id'],'raw':!![]}]})[_0xc41e('0x29')](handleEntityNotFound(_0xcfb591,null))['then'](function(_0x1282a7){var _0x1856d8=_[_0xc41e('0x32')](_0x1282a7,'id');var _0x4cae82=[];var _0x553fd7=[];var _0x3a14b6=squel[_0xc41e('0x6e')]();_0x3a14b6['field'](_0xc41e('0x6f'))[_0xc41e('0x70')](_0xc41e('0x71'),'tq')[_0xc41e('0x72')]('user_has_teams','ut',_0xc41e('0x73'))[_0xc41e('0x43')]('OpenchannelQueueId\x20=\x20?',_0x4130a3[_0xc41e('0x4d')]['id']);for(var _0x449b06=0x0;_0x449b06<_0x1282a7[_0xc41e('0x3d')];_0x449b06+=0x1){let _0x2854a4=_0x1282a7[_0x449b06];for(var _0x402588=0x0;_0x402588<_0x2854a4['Agents'][_0xc41e('0x3d')];_0x402588+=0x1){let _0x2e8971=_0x2854a4[_0xc41e('0x66')][_0x402588];var _0xb37c4e=_0x3a14b6['clone']();_0xb37c4e[_0xc41e('0x43')](_0xc41e('0x74'),_0x2e8971['id']);_0x553fd7[_0xc41e('0x75')](db[_0xc41e('0x76')][_0xc41e('0x37')](_0xb37c4e[_0xc41e('0x77')](),{'type':db['sequelize'][_0xc41e('0x78')][_0xc41e('0x79')]})[_0xc41e('0x29')](function(_0x8c4b40){if(_0x8c4b40[_0xc41e('0x3d')]===0x1){return _0x2e8971['id'];}else{var _0x241f7f=_[_0xc41e('0x7a')](_[_0xc41e('0x32')](_0x8c4b40,_0xc41e('0x7b')),function(_0xf29fcc){return _['includes'](_0x1856d8,_0xf29fcc);});if(_0x241f7f){return _0x2e8971['id'];}}}));}}return BPromise[_0xc41e('0x7c')](_0x553fd7)[_0xc41e('0x29')](function(_0x2f708f){_0x4cae82=_(_0x4cae82)[_0xc41e('0x7d')](_0x2f708f)['compact']()['value']();return db[_0xc41e('0x33')][_0xc41e('0x68')]({'where':{'id':_0x4130a3[_0xc41e('0x4d')]['id']}})[_0xc41e('0x29')](function(_0x37c342){return db[_0xc41e('0x76')][_0xc41e('0x69')](function(_0x480054){return _0x37c342[_0xc41e('0x6d')](_0x4130a3[_0xc41e('0x37')][_0xc41e('0x65')],{'transaction':_0x480054})[_0xc41e('0x29')](function(){if(!_[_0xc41e('0x7e')](_0x4cae82)){return _0x37c342['removeAgents'](_0x4cae82,{'transaction':_0x480054});}})[_0xc41e('0x29')](function(){_0x4cae82[_0xc41e('0x6b')](function(_0x1c7ea9){socket[_0xc41e('0x6c')](_0xc41e('0x7f'),{'UserId':_0x1c7ea9,'OpenchannelQueueId':_0x37c342['id']});});});});});});})['then'](respondWithStatusCode(_0xcfb591,null))[_0xc41e('0x4f')](handleError(_0xcfb591,null));};exports['addAgents']=function(_0x14a4e1,_0x1318b7,_0x3ba70f){return db[_0xc41e('0x33')]['find']({'where':{'id':_0x14a4e1[_0xc41e('0x4d')]['id']}})[_0xc41e('0x29')](handleEntityNotFound(_0x1318b7,null))[_0xc41e('0x29')](function(_0x1248c9){if(_0x1248c9){return _0x1248c9[_0xc41e('0x80')](_0x14a4e1[_0xc41e('0x54')][_0xc41e('0x65')],_[_0xc41e('0x81')](_0x14a4e1[_0xc41e('0x54')],[_0xc41e('0x65'),'id'])||{})[_0xc41e('0x82')](function(_0x30825c){for(var _0x43d3b0=0x0;_0x43d3b0<_0x14a4e1['body'][_0xc41e('0x65')][_0xc41e('0x3d')];_0x43d3b0+=0x1){socket[_0xc41e('0x6c')](_0xc41e('0x83'),{'UserId':_0x14a4e1[_0xc41e('0x54')][_0xc41e('0x65')][_0x43d3b0],'OpenchannelQueueId':_0x14a4e1[_0xc41e('0x4d')]['id']});}return _0x30825c;});}})[_0xc41e('0x29')](respondWithResult(_0x1318b7,null))[_0xc41e('0x4f')](handleError(_0x1318b7,null));};exports[_0xc41e('0x84')]=function(_0x138860,_0x59f8b4,_0x371e6d){return db[_0xc41e('0x33')][_0xc41e('0x68')]({'where':{'id':_0x138860[_0xc41e('0x4d')]['id']}})[_0xc41e('0x29')](handleEntityNotFound(_0x59f8b4,null))[_0xc41e('0x29')](function(_0x55949d){if(_0x55949d){return _0x55949d['removeAgents'](_0x138860[_0xc41e('0x37')]['ids'])[_0xc41e('0x29')](function(){if(_['isArray'](_0x138860[_0xc41e('0x37')][_0xc41e('0x65')])){for(var _0x93b696=0x0;_0x93b696<_0x138860[_0xc41e('0x37')][_0xc41e('0x65')][_0xc41e('0x3d')];_0x93b696+=0x1){socket[_0xc41e('0x6c')](_0xc41e('0x7f'),{'UserId':Number(_0x138860[_0xc41e('0x37')]['ids'][_0x93b696]),'OpenchannelQueueId':Number(_0x138860['params']['id'])});}}else{socket[_0xc41e('0x6c')](_0xc41e('0x7f'),{'UserId':Number(_0x138860[_0xc41e('0x37')][_0xc41e('0x65')]),'OpenchannelQueueId':Number(_0x138860['params']['id'])});}});}})['then'](respondWithStatusCode(_0x59f8b4,null))[_0xc41e('0x4f')](handleError(_0x59f8b4,null));};exports['getAgents']=function(_0x21672b,_0x16adb3,_0x8b36ec){var _0x2bce62={};var _0x48a38f={};var _0x1e95d2;var _0x195250;return db[_0xc41e('0x33')][_0xc41e('0x57')]({'where':{'id':_0x21672b[_0xc41e('0x4d')]['id']}})[_0xc41e('0x29')](handleEntityNotFound(_0x16adb3,null))['then'](function(_0x36f55a){if(_0x36f55a){_0x1e95d2=_0x36f55a;_0x48a38f[_0xc41e('0x36')]=_['keys'](db[_0xc41e('0x5a')][_0xc41e('0x4e')]);_0x48a38f['query']=_[_0xc41e('0x38')](_0x21672b[_0xc41e('0x37')]);_0x48a38f['filters']=_[_0xc41e('0x3a')](_0x48a38f[_0xc41e('0x36')],_0x48a38f['query']);_0x2bce62[_0xc41e('0x3c')]=_[_0xc41e('0x3a')](_0x48a38f[_0xc41e('0x36')],qs[_0xc41e('0x3b')](_0x21672b[_0xc41e('0x37')]['fields']));_0x2bce62[_0xc41e('0x3c')]=_0x2bce62[_0xc41e('0x3c')][_0xc41e('0x3d')]?_0x2bce62[_0xc41e('0x3c')]:_0x48a38f[_0xc41e('0x36')];_0x2bce62[_0xc41e('0x41')]=qs['sort'](_0x21672b[_0xc41e('0x37')][_0xc41e('0x42')]);_0x2bce62['where']=qs[_0xc41e('0x39')](_['pick'](_0x21672b[_0xc41e('0x37')],_0x48a38f['filters']));if(_0x21672b['query'][_0xc41e('0x45')]){_0x2bce62['where']=_[_0xc41e('0x46')](_0x2bce62[_0xc41e('0x43')],{'$or':_[_0xc41e('0x32')](_0x2bce62[_0xc41e('0x3c')],function(_0x293e18){var _0x448360={};_0x448360[_0x293e18]={'$like':'%'+_0x21672b[_0xc41e('0x37')][_0xc41e('0x45')]+'%'};return _0x448360;})});}_0x2bce62=_[_0xc41e('0x46')]({},_0x2bce62,_0x21672b[_0xc41e('0x47')]);return _0x1e95d2['getAgents'](_0x2bce62);}})[_0xc41e('0x29')](function(_0x278d2e){if(_0x278d2e){_0x195250=_0x278d2e[_0xc41e('0x3d')];if(!_0x21672b[_0xc41e('0x37')][_0xc41e('0x3e')](_0xc41e('0x3f'))){_0x2bce62['limit']=qs[_0xc41e('0x40')](_0x21672b[_0xc41e('0x37')][_0xc41e('0x40')]);_0x2bce62['offset']=qs[_0xc41e('0x21')](_0x21672b['query'][_0xc41e('0x21')]);}return _0x1e95d2[_0xc41e('0x85')](_0x2bce62);}})['then'](function(_0x47d126){if(_0x47d126){return _0x47d126?{'count':_0x195250,'rows':_0x47d126}:null;}})[_0xc41e('0x29')](respondWithResult(_0x16adb3,null))[_0xc41e('0x4f')](handleError(_0x16adb3,null));}; \ No newline at end of file +var _0x27ea=['team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','transaction','removeAgents','emit','userOpenchannelQueue:remove','addAgents','spread','isArray','findOne','html-pdf','eml-format','rimraf','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','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','OpenchannelQueues','sendStatus','error','name','send','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','nolimit','order','OpenchannelQueueId','User','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId'];(function(_0x1bd5b3,_0x1d5c64){var _0x5a9c4d=function(_0x5742b4){while(--_0x5742b4){_0x1bd5b3['push'](_0x1bd5b3['shift']());}};_0x5a9c4d(++_0x1d5c64);}(_0x27ea,0xa6));var _0xa27e=function(_0x25d9a9,_0x483979){_0x25d9a9=_0x25d9a9-0x0;var _0x3d3b53=_0x27ea[_0x25d9a9];return _0x3d3b53;};'use strict';var pdf=require(_0xa27e('0x0'));var emlformat=require(_0xa27e('0x1'));var rimraf=require(_0xa27e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa27e('0x3'));var rp=require('request-promise');var moment=require(_0xa27e('0x4'));var BPromise=require(_0xa27e('0x5'));var Mustache=require(_0xa27e('0x6'));var util=require(_0xa27e('0x7'));var path=require('path');var sox=require(_0xa27e('0x8'));var csv=require(_0xa27e('0x9'));var ejs=require(_0xa27e('0xa'));var fs=require('fs');var _=require(_0xa27e('0xb'));var squel=require(_0xa27e('0xc'));var crypto=require(_0xa27e('0xd'));var jsforce=require(_0xa27e('0xe'));var deskjs=require(_0xa27e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa27e('0x10'));var Papa=require(_0xa27e('0x11'));var Redis=require(_0xa27e('0x12'));var authService=require(_0xa27e('0x13'));var qs=require(_0xa27e('0x14'));var as=require(_0xa27e('0x15'));var hardwareService=require(_0xa27e('0x16'));var logger=require(_0xa27e('0x17'))(_0xa27e('0x18'));var utils=require(_0xa27e('0x19'));var config=require(_0xa27e('0x1a'));var db=require(_0xa27e('0x1b'))['db'];config[_0xa27e('0x1c')]=_[_0xa27e('0x1d')](config[_0xa27e('0x1c')],{'host':_0xa27e('0x1e'),'port':0x18eb});var socket=require(_0xa27e('0x1f'))(new Redis(config[_0xa27e('0x1c')]));require('./openchannelQueue.socket')[_0xa27e('0x20')](socket);function respondWithStatusCode(_0x1fb046,_0x48c3c8){_0x48c3c8=_0x48c3c8||0xcc;return function(_0x529a23){if(_0x529a23){return _0x1fb046['sendStatus'](_0x48c3c8);}return _0x1fb046[_0xa27e('0x21')](_0x48c3c8)[_0xa27e('0x22')]();};}function respondWithResult(_0x57a249,_0x4cbff3){_0x4cbff3=_0x4cbff3||0xc8;return function(_0x13abc0){if(_0x13abc0){return _0x57a249['status'](_0x4cbff3)[_0xa27e('0x23')](_0x13abc0);}};}function respondWithFilteredResult(_0xc39678,_0x30240c){return function(_0xa7583f){if(_0xa7583f){var _0x5645cf=_0xa7583f[_0xa27e('0x24')],_0x29e688=_0x30240c[_0xa27e('0x25')],_0x78bffa=_0x30240c[_0xa27e('0x25')]+_0x30240c['limit'],_0xe9f7;if(_0x78bffa>=_0x5645cf){_0x78bffa=_0x5645cf;_0xe9f7=0xc8;}else{_0xe9f7=0xce;}_0xc39678[_0xa27e('0x21')](_0xe9f7);return _0xc39678[_0xa27e('0x26')](_0xa27e('0x27'),_0x29e688+'-'+_0x78bffa+'/'+_0x5645cf)[_0xa27e('0x23')](_0xa7583f);}return null;};}function patchUpdates(_0x27e7a3){return function(_0x1cb95b){try{jsonpatch[_0xa27e('0x28')](_0x1cb95b,_0x27e7a3,!![]);}catch(_0x526298){return BPromise[_0xa27e('0x29')](_0x526298);}return _0x1cb95b[_0xa27e('0x2a')]();};}function saveUpdates(_0x1052f1,_0x3808d8){return function(_0x74796a){if(_0x74796a){return _0x74796a['update'](_0x1052f1)['then'](function(_0x39a866){return _0x39a866;});}return null;};}function removeEntity(_0x160f3a,_0x5cbc7c){return function(_0x20ff21){if(_0x20ff21){return _0x20ff21[_0xa27e('0x2b')]()[_0xa27e('0x2c')](function(){var _0x4f642c=_0x20ff21[_0xa27e('0x2d')]({'plain':!![]});var _0x3936ea=_0xa27e('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x3936ea,'resourceId':_0x4f642c['id']}})['then'](function(){return _0x20ff21;});})['then'](function(){_0x160f3a[_0xa27e('0x21')](0xcc)[_0xa27e('0x22')]();});}};}function handleEntityNotFound(_0x45cb10,_0x261c28){return function(_0x50ee49){if(!_0x50ee49){_0x45cb10[_0xa27e('0x2f')](0x194);}return _0x50ee49;};}function handleError(_0x2b36ba,_0x1a63a2){_0x1a63a2=_0x1a63a2||0x1f4;return function(_0x44432){logger[_0xa27e('0x30')](_0x44432['stack']);if(_0x44432[_0xa27e('0x31')]){delete _0x44432[_0xa27e('0x31')];}_0x2b36ba['status'](_0x1a63a2)[_0xa27e('0x32')](_0x44432);};}exports['index']=function(_0x270e5d,_0x56ddfd){var _0x1399aa={},_0x4a6de7={},_0xe40a30={'count':0x0,'rows':[]};var _0x2e4c44=_['map'](db[_0xa27e('0x33')][_0xa27e('0x34')],function(_0x51e717){return{'name':_0x51e717[_0xa27e('0x35')],'type':_0x51e717[_0xa27e('0x36')][_0xa27e('0x37')]};});_0x4a6de7[_0xa27e('0x38')]=_[_0xa27e('0x39')](_0x2e4c44,_0xa27e('0x31'));_0x4a6de7['query']=_['keys'](_0x270e5d[_0xa27e('0x3a')]);_0x4a6de7[_0xa27e('0x3b')]=_[_0xa27e('0x3c')](_0x4a6de7[_0xa27e('0x38')],_0x4a6de7[_0xa27e('0x3a')]);_0x1399aa['attributes']=_[_0xa27e('0x3c')](_0x4a6de7['model'],qs[_0xa27e('0x3d')](_0x270e5d[_0xa27e('0x3a')][_0xa27e('0x3d')]));_0x1399aa[_0xa27e('0x3e')]=_0x1399aa[_0xa27e('0x3e')][_0xa27e('0x3f')]?_0x1399aa[_0xa27e('0x3e')]:_0x4a6de7[_0xa27e('0x38')];if(!_0x270e5d['query'][_0xa27e('0x40')]('nolimit')){_0x1399aa[_0xa27e('0x41')]=qs[_0xa27e('0x41')](_0x270e5d[_0xa27e('0x3a')]['limit']);_0x1399aa[_0xa27e('0x25')]=qs[_0xa27e('0x25')](_0x270e5d[_0xa27e('0x3a')][_0xa27e('0x25')]);}_0x1399aa['order']=qs[_0xa27e('0x42')](_0x270e5d[_0xa27e('0x3a')][_0xa27e('0x42')]);_0x1399aa[_0xa27e('0x43')]=qs['filters'](_[_0xa27e('0x44')](_0x270e5d[_0xa27e('0x3a')],_0x4a6de7[_0xa27e('0x3b')]),_0x2e4c44);if(_0x270e5d[_0xa27e('0x3a')][_0xa27e('0x45')]){_0x1399aa[_0xa27e('0x43')]=_[_0xa27e('0x46')](_0x1399aa['where'],{'$or':_[_0xa27e('0x39')](_0x2e4c44,function(_0x3d4445){if(_0x3d4445['type']!==_0xa27e('0x47')){var _0x3a3bba={};_0x3a3bba[_0x3d4445[_0xa27e('0x31')]]={'$like':'%'+_0x270e5d[_0xa27e('0x3a')][_0xa27e('0x45')]+'%'};return _0x3a3bba;}})});}_0x1399aa=_['merge']({},_0x1399aa,_0x270e5d['options']);var _0x4b3a4f={'where':_0x1399aa['where']};return db['OpenchannelQueue'][_0xa27e('0x24')](_0x4b3a4f)['then'](function(_0x31688d){_0xe40a30['count']=_0x31688d;if(_0x270e5d[_0xa27e('0x3a')][_0xa27e('0x48')]){_0x1399aa['include']=[{'all':!![]}];}return db[_0xa27e('0x33')][_0xa27e('0x49')](_0x1399aa);})['then'](function(_0x3fb30a){_0xe40a30[_0xa27e('0x4a')]=_0x3fb30a;return _0xe40a30;})[_0xa27e('0x2c')](respondWithFilteredResult(_0x56ddfd,_0x1399aa))[_0xa27e('0x4b')](handleError(_0x56ddfd,null));};exports[_0xa27e('0x4c')]=function(_0x201e8c,_0x4eabbb){var _0x1fe492={'raw':!![],'where':{'id':_0x201e8c[_0xa27e('0x4d')]['id']}},_0x247624={};_0x247624[_0xa27e('0x38')]=_[_0xa27e('0x4e')](db[_0xa27e('0x33')][_0xa27e('0x34')]);_0x247624[_0xa27e('0x3a')]=_['keys'](_0x201e8c[_0xa27e('0x3a')]);_0x247624[_0xa27e('0x3b')]=_['intersection'](_0x247624[_0xa27e('0x38')],_0x247624[_0xa27e('0x3a')]);_0x1fe492['attributes']=_['intersection'](_0x247624[_0xa27e('0x38')],qs[_0xa27e('0x3d')](_0x201e8c[_0xa27e('0x3a')]['fields']));_0x1fe492['attributes']=_0x1fe492[_0xa27e('0x3e')]['length']?_0x1fe492['attributes']:_0x247624[_0xa27e('0x38')];if(_0x201e8c[_0xa27e('0x3a')]['includeAll']){_0x1fe492[_0xa27e('0x4f')]=[{'all':!![]}];}_0x1fe492=_['merge']({},_0x1fe492,_0x201e8c[_0xa27e('0x50')]);return db[_0xa27e('0x33')][_0xa27e('0x51')](_0x1fe492)[_0xa27e('0x2c')](handleEntityNotFound(_0x4eabbb,null))[_0xa27e('0x2c')](respondWithResult(_0x4eabbb,null))['catch'](handleError(_0x4eabbb,null));};exports[_0xa27e('0x52')]=function(_0x2870a8,_0x1c6186){return db[_0xa27e('0x33')][_0xa27e('0x52')](_0x2870a8[_0xa27e('0x53')],{})[_0xa27e('0x2c')](function(_0x4c7620){var _0x29636b=_0x2870a8['user'][_0xa27e('0x2d')]({'plain':!![]});if(!_0x29636b)throw new Error(_0xa27e('0x54'));if(_0x29636b[_0xa27e('0x55')]==='user'){var _0x5ea8d1=_0x4c7620[_0xa27e('0x2d')]({'plain':!![]});var _0x39aa4c=_0xa27e('0x2e');return db[_0xa27e('0x56')][_0xa27e('0x51')]({'where':{'name':_0x39aa4c,'userProfileId':_0x29636b[_0xa27e('0x57')]},'raw':!![]})[_0xa27e('0x2c')](function(_0x32bb45){if(_0x32bb45&&_0x32bb45[_0xa27e('0x58')]===0x0){return db[_0xa27e('0x59')][_0xa27e('0x52')]({'name':_0x5ea8d1[_0xa27e('0x31')],'resourceId':_0x5ea8d1['id'],'type':_0x32bb45[_0xa27e('0x31')],'sectionId':_0x32bb45['id']},{})['then'](function(){return _0x4c7620;});}else{return _0x4c7620;}})['catch'](function(_0x3f3c56){logger[_0xa27e('0x30')](_0xa27e('0x5a'),_0x3f3c56);throw _0x3f3c56;});}return _0x4c7620;})['then'](respondWithResult(_0x1c6186,0xc9))[_0xa27e('0x4b')](handleError(_0x1c6186,null));};exports[_0xa27e('0x5b')]=function(_0x4b0750,_0x151a31){if(_0x4b0750[_0xa27e('0x53')]['id']){delete _0x4b0750[_0xa27e('0x53')]['id'];}return db[_0xa27e('0x33')][_0xa27e('0x51')]({'where':{'id':_0x4b0750[_0xa27e('0x4d')]['id']}})[_0xa27e('0x2c')](handleEntityNotFound(_0x151a31,null))[_0xa27e('0x2c')](saveUpdates(_0x4b0750[_0xa27e('0x53')],null))[_0xa27e('0x2c')](respondWithResult(_0x151a31,null))[_0xa27e('0x4b')](handleError(_0x151a31,null));};exports['destroy']=function(_0x5701aa,_0xe5bfc5){return db[_0xa27e('0x33')][_0xa27e('0x51')]({'where':{'id':_0x5701aa[_0xa27e('0x4d')]['id']}})[_0xa27e('0x2c')](handleEntityNotFound(_0xe5bfc5,null))[_0xa27e('0x2c')](removeEntity(_0xe5bfc5,null))[_0xa27e('0x4b')](handleError(_0xe5bfc5,null));};exports[_0xa27e('0x5c')]=function(_0x1f5b61,_0x17bb68){return db[_0xa27e('0x33')][_0xa27e('0x5c')]()['then'](respondWithResult(_0x17bb68,null))[_0xa27e('0x4b')](handleError(_0x17bb68,null));};exports[_0xa27e('0x5d')]=function(_0xb078ce,_0x3742cd,_0x3f74ae){var _0x59676f={'raw':!![],'where':{}},_0x2e21af={},_0x1f9e2f;return db[_0xa27e('0x33')]['findOne']({'where':{'id':_0xb078ce[_0xa27e('0x4d')]['id']}})[_0xa27e('0x2c')](handleEntityNotFound(_0x3742cd,null))[_0xa27e('0x2c')](function(_0x63fcf0){if(_0x63fcf0){_0x1f9e2f=_0x63fcf0[_0xa27e('0x2d')]({'plain':!![]});_0x2e21af['model']=_[_0xa27e('0x4e')](db['UserOpenchannelQueue'][_0xa27e('0x34')]);_0x2e21af['query']=_[_0xa27e('0x4e')](_0xb078ce[_0xa27e('0x3a')]);_0x2e21af[_0xa27e('0x3b')]=_[_0xa27e('0x3c')](_0x2e21af[_0xa27e('0x38')],_0x2e21af['query']);_0x59676f[_0xa27e('0x3e')]=_['intersection'](_0x2e21af[_0xa27e('0x38')],qs[_0xa27e('0x3d')](_0xb078ce[_0xa27e('0x3a')]['fields']));_0x59676f[_0xa27e('0x3e')]=_0x59676f[_0xa27e('0x3e')]['length']?_0x59676f[_0xa27e('0x3e')]:_0x2e21af[_0xa27e('0x38')];if(!_0xb078ce[_0xa27e('0x3a')][_0xa27e('0x40')](_0xa27e('0x5e'))){_0x59676f[_0xa27e('0x41')]=qs[_0xa27e('0x41')](_0xb078ce[_0xa27e('0x3a')]['limit']);_0x59676f[_0xa27e('0x25')]=qs[_0xa27e('0x25')](_0xb078ce[_0xa27e('0x3a')][_0xa27e('0x25')]);}_0x59676f[_0xa27e('0x5f')]=qs[_0xa27e('0x42')](_0xb078ce[_0xa27e('0x3a')][_0xa27e('0x42')]);_0x59676f[_0xa27e('0x43')]=qs['filters'](_[_0xa27e('0x44')](_0xb078ce[_0xa27e('0x3a')],_0x2e21af[_0xa27e('0x3b')]));_0x59676f['where'][_0xa27e('0x60')]=_0x63fcf0['id'];if(_0xb078ce[_0xa27e('0x3a')]['filter']){_0x59676f[_0xa27e('0x43')]=_[_0xa27e('0x46')](_0x59676f['where'],{'$or':_[_0xa27e('0x39')](_0x59676f[_0xa27e('0x3e')],function(_0x15a8e3){var _0x1ed08b={};_0x1ed08b[_0x15a8e3]={'$like':'%'+_0xb078ce[_0xa27e('0x3a')][_0xa27e('0x45')]+'%'};return _0x1ed08b;})});}_0x59676f=_[_0xa27e('0x46')]({},_0x59676f,_0xb078ce[_0xa27e('0x50')]);return db['UserOpenchannelQueue'][_0xa27e('0x49')](_0x59676f);}})[_0xa27e('0x2c')](function(_0x292578){if(_0x292578){return db[_0xa27e('0x61')]['findAndCountAll']({'where':{'id':_[_0xa27e('0x39')](_0x292578,_0xa27e('0x62')),'role':_0xa27e('0x63')},'attributes':['id',_0xa27e('0x31'),_0xa27e('0x64'),'updatedAt',_0xa27e('0x65')]});}})[_0xa27e('0x2c')](function(_0x18336c){if(_0x18336c){return{'count':_0x18336c[_0xa27e('0x24')],'rows':_[_0xa27e('0x39')](_0x18336c[_0xa27e('0x4a')],function(_0x8dc2be){return{'membername':_0x8dc2be[_0xa27e('0x31')],'UserId':_0x8dc2be['id'],'queue_name':_0x1f9e2f[_0xa27e('0x31')],'OpenchannelQueueId':_0x1f9e2f['id'],'interface':util[_0xa27e('0x66')](_0xa27e('0x67'),_0xa27e('0x68'),_0x8dc2be[_0xa27e('0x31')]),'penalty':0x0,'paused':_0x8dc2be[_0xa27e('0x64')],'createdAt':_0x8dc2be[_0xa27e('0x65')],'updatedAt':_0x8dc2be[_0xa27e('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa27e('0x2c')](respondWithFilteredResult(_0x3742cd,_0x59676f))[_0xa27e('0x4b')](handleError(_0x3742cd,null));};exports['getTeams']=function(_0x475278,_0x59f640,_0x2e31b2){var _0x290692={};var _0x19105a={};var _0x3796e3;var _0x254969;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x475278[_0xa27e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x59f640,null))[_0xa27e('0x2c')](function(_0x419dea){if(_0x419dea){_0x3796e3=_0x419dea;_0x19105a[_0xa27e('0x38')]=_[_0xa27e('0x4e')](db[_0xa27e('0x6a')][_0xa27e('0x34')]);_0x19105a[_0xa27e('0x3a')]=_[_0xa27e('0x4e')](_0x475278[_0xa27e('0x3a')]);_0x19105a[_0xa27e('0x3b')]=_[_0xa27e('0x3c')](_0x19105a['model'],_0x19105a[_0xa27e('0x3a')]);_0x290692['attributes']=_[_0xa27e('0x3c')](_0x19105a[_0xa27e('0x38')],qs[_0xa27e('0x3d')](_0x475278['query'][_0xa27e('0x3d')]));_0x290692[_0xa27e('0x3e')]=_0x290692['attributes']['length']?_0x290692[_0xa27e('0x3e')]:_0x19105a[_0xa27e('0x38')];_0x290692[_0xa27e('0x5f')]=qs[_0xa27e('0x42')](_0x475278[_0xa27e('0x3a')][_0xa27e('0x42')]);_0x290692[_0xa27e('0x43')]=qs[_0xa27e('0x3b')](_['pick'](_0x475278[_0xa27e('0x3a')],_0x19105a[_0xa27e('0x3b')]));if(_0x475278['query'][_0xa27e('0x45')]){_0x290692[_0xa27e('0x43')]=_[_0xa27e('0x46')](_0x290692[_0xa27e('0x43')],{'$or':_['map'](_0x290692[_0xa27e('0x3e')],function(_0x5da29d){var _0x5156da={};_0x5156da[_0x5da29d]={'$like':'%'+_0x475278[_0xa27e('0x3a')]['filter']+'%'};return _0x5156da;})});}_0x290692=_[_0xa27e('0x46')]({},_0x290692,_0x475278[_0xa27e('0x50')]);return _0x3796e3[_0xa27e('0x6b')](_0x290692);}})[_0xa27e('0x2c')](function(_0x460ac6){if(_0x460ac6){_0x254969=_0x460ac6['length'];if(!_0x475278[_0xa27e('0x3a')][_0xa27e('0x40')](_0xa27e('0x5e'))){_0x290692['limit']=qs[_0xa27e('0x41')](_0x475278['query'][_0xa27e('0x41')]);_0x290692[_0xa27e('0x25')]=qs['offset'](_0x475278['query'][_0xa27e('0x25')]);}return _0x3796e3[_0xa27e('0x6b')](_0x290692);}})[_0xa27e('0x2c')](function(_0x516684){if(_0x516684){return _0x516684?{'count':_0x254969,'rows':_0x516684}:null;}})['then'](respondWithResult(_0x59f640,null))['catch'](handleError(_0x59f640,null));};exports[_0xa27e('0x6c')]=function(_0x55df37,_0x2e36db,_0x36d0ad){var _0x11ed2f=_0x55df37[_0xa27e('0x53')][_0xa27e('0x6d')];return db[_0xa27e('0x6a')][_0xa27e('0x49')]({'where':{'id':_0x11ed2f},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa27e('0x6e'),'attributes':['id','name',_0xa27e('0x6f'),_0xa27e('0x70'),'interface'],'raw':!![]}]})[_0xa27e('0x2c')](function(_0x43e00e){if(_0x43e00e){var _0x46edf2=_[_0xa27e('0x71')](_0x43e00e,function(_0x63b008){var _0x5d714d=_0x63b008[_0xa27e('0x2d')]({'plain':!![]});return _0x5d714d['Agents'];});return db['OpenchannelQueue'][_0xa27e('0x51')]({'where':{'id':_0x55df37['params']['id']}})[_0xa27e('0x2c')](function(_0x5b3c35){return db[_0xa27e('0x72')]['transaction'](function(_0x26e51d){return _0x5b3c35['addTeams'](_0x11ed2f,{'transaction':_0x26e51d})[_0xa27e('0x2c')](function(){return BPromise[_0xa27e('0x73')](_0x46edf2,function(_0x5dc314){return db['UserOpenchannelQueue'][_0xa27e('0x74')]({'where':{'UserId':_0x5dc314['id'],'OpenchannelQueueId':_0x55df37[_0xa27e('0x4d')]['id']},'transaction':_0x26e51d});});})[_0xa27e('0x2c')](function(){_0x46edf2['forEach'](function(_0xd2cef5){socket['emit'](_0xa27e('0x75'),{'UserId':_0xd2cef5['id'],'OpenchannelQueueId':_0x5b3c35['id']});});});});});}})[_0xa27e('0x2c')](respondWithStatusCode(_0x2e36db,null))[_0xa27e('0x4b')](handleError(_0x2e36db,null));};exports[_0xa27e('0x76')]=function(_0x21fc7e,_0x30a6b9,_0x58dec3){return db[_0xa27e('0x6a')][_0xa27e('0x49')]({'where':{'id':_0x21fc7e['query'][_0xa27e('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xa27e('0x61')],'as':_0xa27e('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x30a6b9,null))['then'](function(_0x8a229a){var _0x31347f=_[_0xa27e('0x39')](_0x8a229a,'id');var _0x13efce=[];var _0x2fa0fd=[];var _0x46149f=squel[_0xa27e('0x77')]();_0x46149f[_0xa27e('0x78')](_0xa27e('0x79'))['from'](_0xa27e('0x7a'),'tq')['join'](_0xa27e('0x7b'),'ut',_0xa27e('0x7c'))[_0xa27e('0x43')](_0xa27e('0x7d'),_0x21fc7e[_0xa27e('0x4d')]['id']);for(var _0x59831a=0x0;_0x59831a<_0x8a229a[_0xa27e('0x3f')];_0x59831a+=0x1){let _0x132d12=_0x8a229a[_0x59831a];for(var _0x1d6e0b=0x0;_0x1d6e0b<_0x132d12[_0xa27e('0x6e')]['length'];_0x1d6e0b+=0x1){let _0x233ce2=_0x132d12[_0xa27e('0x6e')][_0x1d6e0b];var _0x464a19=_0x46149f['clone']();_0x464a19[_0xa27e('0x43')]('ut.UserId\x20=\x20?',_0x233ce2['id']);_0x2fa0fd[_0xa27e('0x7e')](db[_0xa27e('0x72')][_0xa27e('0x3a')](_0x464a19[_0xa27e('0x7f')](),{'type':db['sequelize'][_0xa27e('0x80')][_0xa27e('0x81')]})['then'](function(_0x23b9d4){if(_0x23b9d4[_0xa27e('0x3f')]===0x1){return _0x233ce2['id'];}else{var _0x4e81ed=_[_0xa27e('0x82')](_['map'](_0x23b9d4,_0xa27e('0x83')),function(_0x283bd1){return _['includes'](_0x31347f,_0x283bd1);});if(_0x4e81ed){return _0x233ce2['id'];}}}));}}return BPromise[_0xa27e('0x84')](_0x2fa0fd)[_0xa27e('0x2c')](function(_0x3506c5){_0x13efce=_(_0x13efce)[_0xa27e('0x85')](_0x3506c5)[_0xa27e('0x86')]()[_0xa27e('0x87')]();return db[_0xa27e('0x33')][_0xa27e('0x51')]({'where':{'id':_0x21fc7e['params']['id']}})['then'](function(_0x321577){return db[_0xa27e('0x72')][_0xa27e('0x88')](function(_0x53113d){return _0x321577[_0xa27e('0x76')](_0x21fc7e['query'][_0xa27e('0x6d')],{'transaction':_0x53113d})['then'](function(){if(!_['isEmpty'](_0x13efce)){return _0x321577[_0xa27e('0x89')](_0x13efce,{'transaction':_0x53113d});}})[_0xa27e('0x2c')](function(){_0x13efce['forEach'](function(_0x253e66){socket[_0xa27e('0x8a')](_0xa27e('0x8b'),{'UserId':_0x253e66,'OpenchannelQueueId':_0x321577['id']});});});});});});})[_0xa27e('0x2c')](respondWithStatusCode(_0x30a6b9,null))['catch'](handleError(_0x30a6b9,null));};exports[_0xa27e('0x8c')]=function(_0x264ad0,_0x5b468a,_0x1dc112){return db[_0xa27e('0x33')][_0xa27e('0x51')]({'where':{'id':_0x264ad0[_0xa27e('0x4d')]['id']}})[_0xa27e('0x2c')](handleEntityNotFound(_0x5b468a,null))[_0xa27e('0x2c')](function(_0x563d4a){if(_0x563d4a){return _0x563d4a[_0xa27e('0x8c')](_0x264ad0['body'][_0xa27e('0x6d')],_['omit'](_0x264ad0[_0xa27e('0x53')],[_0xa27e('0x6d'),'id'])||{})[_0xa27e('0x8d')](function(_0x142fac){for(var _0x2d03a7=0x0;_0x2d03a7<_0x264ad0[_0xa27e('0x53')][_0xa27e('0x6d')]['length'];_0x2d03a7+=0x1){socket[_0xa27e('0x8a')](_0xa27e('0x75'),{'UserId':_0x264ad0[_0xa27e('0x53')][_0xa27e('0x6d')][_0x2d03a7],'OpenchannelQueueId':_0x264ad0['params']['id']});}return _0x142fac;});}})['then'](respondWithResult(_0x5b468a,null))[_0xa27e('0x4b')](handleError(_0x5b468a,null));};exports[_0xa27e('0x89')]=function(_0x5befa1,_0x2be594,_0x45843f){return db['OpenchannelQueue'][_0xa27e('0x51')]({'where':{'id':_0x5befa1[_0xa27e('0x4d')]['id']}})[_0xa27e('0x2c')](handleEntityNotFound(_0x2be594,null))[_0xa27e('0x2c')](function(_0x1a4622){if(_0x1a4622){return _0x1a4622['removeAgents'](_0x5befa1[_0xa27e('0x3a')][_0xa27e('0x6d')])['then'](function(){if(_[_0xa27e('0x8e')](_0x5befa1[_0xa27e('0x3a')][_0xa27e('0x6d')])){for(var _0x5c0f65=0x0;_0x5c0f65<_0x5befa1[_0xa27e('0x3a')][_0xa27e('0x6d')]['length'];_0x5c0f65+=0x1){socket[_0xa27e('0x8a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5befa1[_0xa27e('0x3a')][_0xa27e('0x6d')][_0x5c0f65]),'OpenchannelQueueId':Number(_0x5befa1[_0xa27e('0x4d')]['id'])});}}else{socket[_0xa27e('0x8a')](_0xa27e('0x8b'),{'UserId':Number(_0x5befa1['query'][_0xa27e('0x6d')]),'OpenchannelQueueId':Number(_0x5befa1[_0xa27e('0x4d')]['id'])});}});}})[_0xa27e('0x2c')](respondWithStatusCode(_0x2be594,null))[_0xa27e('0x4b')](handleError(_0x2be594,null));};exports['getAgents']=function(_0x610d27,_0x372961,_0x5c32fa){var _0x1b6bc4={};var _0x67f706={};var _0x15d8cd;var _0x1e3f4e;return db[_0xa27e('0x33')][_0xa27e('0x8f')]({'where':{'id':_0x610d27['params']['id']}})[_0xa27e('0x2c')](handleEntityNotFound(_0x372961,null))[_0xa27e('0x2c')](function(_0x3e2e48){if(_0x3e2e48){_0x15d8cd=_0x3e2e48;_0x67f706[_0xa27e('0x38')]=_[_0xa27e('0x4e')](db['User'][_0xa27e('0x34')]);_0x67f706[_0xa27e('0x3a')]=_[_0xa27e('0x4e')](_0x610d27[_0xa27e('0x3a')]);_0x67f706['filters']=_[_0xa27e('0x3c')](_0x67f706[_0xa27e('0x38')],_0x67f706['query']);_0x1b6bc4['attributes']=_[_0xa27e('0x3c')](_0x67f706[_0xa27e('0x38')],qs['fields'](_0x610d27[_0xa27e('0x3a')][_0xa27e('0x3d')]));_0x1b6bc4[_0xa27e('0x3e')]=_0x1b6bc4[_0xa27e('0x3e')][_0xa27e('0x3f')]?_0x1b6bc4[_0xa27e('0x3e')]:_0x67f706[_0xa27e('0x38')];_0x1b6bc4[_0xa27e('0x5f')]=qs[_0xa27e('0x42')](_0x610d27['query']['sort']);_0x1b6bc4['where']=qs[_0xa27e('0x3b')](_['pick'](_0x610d27[_0xa27e('0x3a')],_0x67f706[_0xa27e('0x3b')]));if(_0x610d27[_0xa27e('0x3a')][_0xa27e('0x45')]){_0x1b6bc4[_0xa27e('0x43')]=_[_0xa27e('0x46')](_0x1b6bc4[_0xa27e('0x43')],{'$or':_[_0xa27e('0x39')](_0x1b6bc4[_0xa27e('0x3e')],function(_0x26e38e){var _0x6e6a94={};_0x6e6a94[_0x26e38e]={'$like':'%'+_0x610d27[_0xa27e('0x3a')]['filter']+'%'};return _0x6e6a94;})});}_0x1b6bc4=_[_0xa27e('0x46')]({},_0x1b6bc4,_0x610d27['options']);return _0x15d8cd['getAgents'](_0x1b6bc4);}})['then'](function(_0x8ae821){if(_0x8ae821){_0x1e3f4e=_0x8ae821[_0xa27e('0x3f')];if(!_0x610d27[_0xa27e('0x3a')]['hasOwnProperty']('nolimit')){_0x1b6bc4[_0xa27e('0x41')]=qs['limit'](_0x610d27[_0xa27e('0x3a')]['limit']);_0x1b6bc4['offset']=qs[_0xa27e('0x25')](_0x610d27[_0xa27e('0x3a')]['offset']);}return _0x15d8cd['getAgents'](_0x1b6bc4);}})[_0xa27e('0x2c')](function(_0x2849a9){if(_0x2849a9){return _0x2849a9?{'count':_0x1e3f4e,'rows':_0x2849a9}:null;}})[_0xa27e('0x2c')](respondWithResult(_0x372961,null))['catch'](handleError(_0x372961,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index ee9e756..01bbefe 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 _0x0bc8=['emit','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bc8,0x1a3));var _0x80bc=function(_0x5852dd,_0x3070d8){_0x5852dd=_0x5852dd-0x0;var _0x4aa03f=_0x0bc8[_0x5852dd];return _0x4aa03f;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x80bc('0x0'))['db'][_0x80bc('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x80bc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x80bc('0x3'),'afterDestroy':_0x80bc('0x4')};function emitEvent(_0x237478){return function(_0x280966,_0x511cf4,_0x2bfe3f){OpenchannelQueueEvents['emit'](_0x237478+':'+_0x280966['id'],_0x280966);OpenchannelQueueEvents[_0x80bc('0x5')](_0x237478,_0x280966);_0x2bfe3f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x80bc('0x6')](e,emitEvent(event));}}module[_0x80bc('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb5a9=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x20a107,_0x5a1b5c){var _0x19bdbd=function(_0x459f9f){while(--_0x459f9f){_0x20a107['push'](_0x20a107['shift']());}};_0x19bdbd(++_0x5a1b5c);}(_0xb5a9,0x168));var _0x9b5a=function(_0x1c1e1b,_0x5af1cc){_0x1c1e1b=_0x1c1e1b-0x0;var _0xe20220=_0xb5a9[_0x1c1e1b];return _0xe20220;};'use strict';var EventEmitter=require(_0x9b5a('0x0'));var OpenchannelQueue=require(_0x9b5a('0x1'))['db'][_0x9b5a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9b5a('0x3')](0x0);var events={'afterCreate':_0x9b5a('0x4'),'afterUpdate':_0x9b5a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38738c){return function(_0x56a3f0,_0x24e45f,_0x28cc79){OpenchannelQueueEvents[_0x9b5a('0x6')](_0x38738c+':'+_0x56a3f0['id'],_0x56a3f0);OpenchannelQueueEvents[_0x9b5a('0x6')](_0x38738c,_0x56a3f0);_0x28cc79(null);};}for(var e in events){if(events[_0x9b5a('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f2d15e6..5d423f0 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 _0x92f4=['OpenchannelQueue','openchannel_queues','util','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x19497a,_0xfca7d1){var _0x2a1f3e=function(_0x15ec33){while(--_0x15ec33){_0x19497a['push'](_0x19497a['shift']());}};_0x2a1f3e(++_0xfca7d1);}(_0x92f4,0x188));var _0x492f=function(_0x2eaedf,_0x481885){_0x2eaedf=_0x2eaedf-0x0;var _0x4b0bf8=_0x92f4[_0x2eaedf];return _0x4b0bf8;};'use strict';var _=require('lodash');var util=require(_0x492f('0x0'));var logger=require('../../config/logger')(_0x492f('0x1'));var moment=require('moment');var BPromise=require(_0x492f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x492f('0x3'));var rimraf=require(_0x492f('0x4'));var config=require(_0x492f('0x5'));var attributes=require('./openchannelQueue.attributes');module[_0x492f('0x6')]=function(_0x35b737,_0x58169b){return _0x35b737[_0x492f('0x7')](_0x492f('0x8'),attributes,{'tableName':_0x492f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b34=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','util','../../config/logger','api'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x8b34,0x7f));var _0x48b3=function(_0xe15891,_0x6112a0){_0xe15891=_0xe15891-0x0;var _0x4b7f96=_0x8b34[_0xe15891];return _0x4b7f96;};'use strict';var _=require('lodash');var util=require(_0x48b3('0x0'));var logger=require(_0x48b3('0x1'))(_0x48b3('0x2'));var moment=require(_0x48b3('0x3'));var BPromise=require(_0x48b3('0x4'));var rp=require(_0x48b3('0x5'));var fs=require('fs');var path=require(_0x48b3('0x6'));var rimraf=require(_0x48b3('0x7'));var config=require(_0x48b3('0x8'));var attributes=require(_0x48b3('0x9'));module[_0x48b3('0xa')]=function(_0x56b9d0,_0x44ae40){return _0x56b9d0[_0x48b3('0xb')](_0x48b3('0xc'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 9f4be19..6189f3a 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 _0x1ffc=['limit','include','map','debug','ShowOpenchannelQueue','find','model','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','attributes'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x1ffc,0xfe));var _0xc1ff=function(_0x2c1a5e,_0x550e3d){_0x2c1a5e=_0x2c1a5e-0x0;var _0x4cbf6e=_0x1ffc[_0x2c1a5e];return _0x4cbf6e;};'use strict';var _=require(_0xc1ff('0x0'));var util=require(_0xc1ff('0x1'));var moment=require(_0xc1ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xc1ff('0x3'));var fs=require('fs');var Redis=require(_0xc1ff('0x4'));var db=require(_0xc1ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1ff('0x6'))(_0xc1ff('0x7'));var config=require('../../config/environment');var jayson=require(_0xc1ff('0x8'));var client=jayson[_0xc1ff('0x9')][_0xc1ff('0xa')]({'port':0x232a});config[_0xc1ff('0xb')]=_[_0xc1ff('0xc')](config[_0xc1ff('0xb')],{'host':_0xc1ff('0xd'),'port':0x18eb});var socket=require(_0xc1ff('0xe'))(new Redis(config['redis']));require(_0xc1ff('0xf'))[_0xc1ff('0x10')](socket);function respondWithRpcPromise(_0x33a562,_0x1ff84c,_0x131193){return new BPromise(function(_0x593556,_0xa676d2){return client[_0xc1ff('0x11')](_0x33a562,_0x131193)['then'](function(_0x5bc8e6){logger[_0xc1ff('0x12')](_0xc1ff('0x13'),_0x1ff84c,'request\x20sent');logger['debug'](_0xc1ff('0x14'),_0x1ff84c,_0xc1ff('0x15'),JSON[_0xc1ff('0x16')](_0x5bc8e6));if(_0x5bc8e6[_0xc1ff('0x17')]){if(_0x5bc8e6['error'][_0xc1ff('0x18')]===0x1f4){logger['error'](_0xc1ff('0x13'),_0x1ff84c,_0x5bc8e6[_0xc1ff('0x17')][_0xc1ff('0x19')]);return _0xa676d2(_0x5bc8e6['error']['message']);}logger[_0xc1ff('0x17')](_0xc1ff('0x13'),_0x1ff84c,_0x5bc8e6[_0xc1ff('0x17')]['message']);return _0x593556(_0x5bc8e6[_0xc1ff('0x17')]['message']);}else{logger[_0xc1ff('0x12')](_0xc1ff('0x13'),_0x1ff84c,_0xc1ff('0x15'));_0x593556(_0x5bc8e6[_0xc1ff('0x1a')][_0xc1ff('0x19')]);}})[_0xc1ff('0x1b')](function(_0x58f7be){logger[_0xc1ff('0x17')](_0xc1ff('0x13'),_0x1ff84c,_0x58f7be);_0xa676d2(_0x58f7be);});});}exports[_0xc1ff('0x1c')]=function(_0x55196e){var _0xcca83e=this;return new Promise(function(_0xdbe473,_0x210be1){return db[_0xc1ff('0x1d')]['findAll']({'raw':_0x55196e[_0xc1ff('0x1e')]?_0x55196e[_0xc1ff('0x1e')][_0xc1ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x55196e['options']?_0x55196e['options']['where']||null:null,'attributes':_0x55196e[_0xc1ff('0x1e')]?_0x55196e[_0xc1ff('0x1e')][_0xc1ff('0x20')]||null:null,'limit':_0x55196e['options']?_0x55196e[_0xc1ff('0x1e')][_0xc1ff('0x21')]||null:null,'include':_0x55196e[_0xc1ff('0x1e')]?_0x55196e['options'][_0xc1ff('0x22')]?_[_0xc1ff('0x23')](_0x55196e[_0xc1ff('0x1e')][_0xc1ff('0x22')],function(_0x13ed1e){return{'model':db[_0x13ed1e['model']],'as':_0x13ed1e['as'],'attributes':_0x13ed1e[_0xc1ff('0x20')],'include':_0x13ed1e[_0xc1ff('0x22')]?_[_0xc1ff('0x23')](_0x13ed1e[_0xc1ff('0x22')],function(_0x42e71f){return{'model':db[_0x42e71f['model']],'as':_0x42e71f['as'],'attributes':_0x42e71f[_0xc1ff('0x20')],'include':_0x42e71f['include']?_['map'](_0x42e71f[_0xc1ff('0x22')],function(_0x53a13a){return{'model':db[_0x53a13a['model']],'as':_0x53a13a['as'],'attributes':_0x53a13a[_0xc1ff('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5efa48){logger['info'](_0xc1ff('0x1c'),_0x55196e);logger[_0xc1ff('0x24')](_0xc1ff('0x1c'),_0x55196e,JSON['stringify'](_0x5efa48));_0xdbe473(_0x5efa48);})['catch'](function(_0x3a6c9f){logger[_0xc1ff('0x17')](_0xc1ff('0x1c'),_0x3a6c9f[_0xc1ff('0x19')],_0x55196e);_0x210be1(_0xcca83e['error'](0x1f4,_0x3a6c9f[_0xc1ff('0x19')]));});});};exports[_0xc1ff('0x25')]=function(_0x4ce44e){var _0x43a09c=this;return new Promise(function(_0x286d35,_0x247535){return db['OpenchannelQueue'][_0xc1ff('0x26')]({'raw':_0x4ce44e[_0xc1ff('0x1e')]?_0x4ce44e[_0xc1ff('0x1e')][_0xc1ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x4ce44e[_0xc1ff('0x1e')]?_0x4ce44e['options']['where']||null:null,'attributes':_0x4ce44e['options']?_0x4ce44e[_0xc1ff('0x1e')][_0xc1ff('0x20')]||null:null,'include':_0x4ce44e[_0xc1ff('0x1e')]?_0x4ce44e[_0xc1ff('0x1e')][_0xc1ff('0x22')]?_[_0xc1ff('0x23')](_0x4ce44e[_0xc1ff('0x1e')]['include'],function(_0x121fcc){return{'model':db[_0x121fcc[_0xc1ff('0x27')]],'as':_0x121fcc['as'],'attributes':_0x121fcc[_0xc1ff('0x20')],'include':_0x121fcc[_0xc1ff('0x22')]?_['map'](_0x121fcc[_0xc1ff('0x22')],function(_0x3c58fd){return{'model':db[_0x3c58fd[_0xc1ff('0x27')]],'as':_0x3c58fd['as'],'attributes':_0x3c58fd[_0xc1ff('0x20')],'include':_0x3c58fd[_0xc1ff('0x22')]?_[_0xc1ff('0x23')](_0x3c58fd[_0xc1ff('0x22')],function(_0x1affa7){return{'model':db[_0x1affa7['model']],'as':_0x1affa7['as'],'attributes':_0x1affa7['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1ff('0x28')](function(_0x4d1ee3){logger[_0xc1ff('0x12')](_0xc1ff('0x25'),_0x4ce44e);logger[_0xc1ff('0x24')](_0xc1ff('0x25'),_0x4ce44e,JSON[_0xc1ff('0x16')](_0x4d1ee3));_0x286d35(_0x4d1ee3);})[_0xc1ff('0x1b')](function(_0x51e16f){logger['error'](_0xc1ff('0x25'),_0x51e16f[_0xc1ff('0x19')],_0x4ce44e);_0x247535(_0x43a09c[_0xc1ff('0x17')](0x1f4,_0x51e16f['message']));});});}; \ No newline at end of file +var _0xec67=['jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','OpenchannelQueue','find','where','ShowOpenchannelQueue','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0xec67,0x1cd));var _0x7ec6=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0xec67[_0x4eafed];return _0x159c85;};'use strict';var _=require('lodash');var util=require(_0x7ec6('0x0'));var moment=require('moment');var BPromise=require(_0x7ec6('0x1'));var rs=require(_0x7ec6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ec6('0x3'))['db'];var utils=require(_0x7ec6('0x4'));var logger=require(_0x7ec6('0x5'))('rpc');var config=require(_0x7ec6('0x6'));var jayson=require(_0x7ec6('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x7ec6('0x8')]=_[_0x7ec6('0x9')](config[_0x7ec6('0x8')],{'host':_0x7ec6('0xa'),'port':0x18eb});var socket=require(_0x7ec6('0xb'))(new Redis(config['redis']));require(_0x7ec6('0xc'))[_0x7ec6('0xd')](socket);function respondWithRpcPromise(_0x6937cd,_0x3c9ef7,_0x181105){return new BPromise(function(_0x10dd33,_0x4e9e2a){return client['request'](_0x6937cd,_0x181105)[_0x7ec6('0xe')](function(_0x9e60c7){logger[_0x7ec6('0xf')](_0x7ec6('0x10'),_0x3c9ef7,_0x7ec6('0x11'));logger[_0x7ec6('0x12')](_0x7ec6('0x13'),_0x3c9ef7,'request\x20sent',JSON[_0x7ec6('0x14')](_0x9e60c7));if(_0x9e60c7[_0x7ec6('0x15')]){if(_0x9e60c7[_0x7ec6('0x15')][_0x7ec6('0x16')]===0x1f4){logger[_0x7ec6('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x3c9ef7,_0x9e60c7[_0x7ec6('0x15')][_0x7ec6('0x17')]);return _0x4e9e2a(_0x9e60c7['error'][_0x7ec6('0x17')]);}logger['error'](_0x7ec6('0x10'),_0x3c9ef7,_0x9e60c7[_0x7ec6('0x15')][_0x7ec6('0x17')]);return _0x10dd33(_0x9e60c7[_0x7ec6('0x15')][_0x7ec6('0x17')]);}else{logger[_0x7ec6('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x3c9ef7,_0x7ec6('0x11'));_0x10dd33(_0x9e60c7[_0x7ec6('0x18')][_0x7ec6('0x17')]);}})[_0x7ec6('0x19')](function(_0xecd124){logger[_0x7ec6('0x15')](_0x7ec6('0x10'),_0x3c9ef7,_0xecd124);_0x4e9e2a(_0xecd124);});});}exports[_0x7ec6('0x1a')]=function(_0x281501){var _0x41e216=this;return new Promise(function(_0x4644d0,_0x39522c){return db['OpenchannelQueue'][_0x7ec6('0x1b')]({'raw':_0x281501[_0x7ec6('0x1c')]?_0x281501[_0x7ec6('0x1c')][_0x7ec6('0x1d')]===undefined?!![]:![]:!![],'where':_0x281501[_0x7ec6('0x1c')]?_0x281501[_0x7ec6('0x1c')]['where']||null:null,'attributes':_0x281501[_0x7ec6('0x1c')]?_0x281501[_0x7ec6('0x1c')][_0x7ec6('0x1e')]||null:null,'limit':_0x281501[_0x7ec6('0x1c')]?_0x281501[_0x7ec6('0x1c')][_0x7ec6('0x1f')]||null:null,'include':_0x281501[_0x7ec6('0x1c')]?_0x281501[_0x7ec6('0x1c')][_0x7ec6('0x20')]?_[_0x7ec6('0x21')](_0x281501['options'][_0x7ec6('0x20')],function(_0x1961c4){return{'model':db[_0x1961c4['model']],'as':_0x1961c4['as'],'attributes':_0x1961c4[_0x7ec6('0x1e')],'include':_0x1961c4[_0x7ec6('0x20')]?_[_0x7ec6('0x21')](_0x1961c4[_0x7ec6('0x20')],function(_0x99d1fa){return{'model':db[_0x99d1fa[_0x7ec6('0x22')]],'as':_0x99d1fa['as'],'attributes':_0x99d1fa[_0x7ec6('0x1e')],'include':_0x99d1fa[_0x7ec6('0x20')]?_[_0x7ec6('0x21')](_0x99d1fa[_0x7ec6('0x20')],function(_0xed07fd){return{'model':db[_0xed07fd[_0x7ec6('0x22')]],'as':_0xed07fd['as'],'attributes':_0xed07fd[_0x7ec6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7ec6('0xe')](function(_0xe382b2){logger[_0x7ec6('0xf')](_0x7ec6('0x1a'),_0x281501);logger[_0x7ec6('0x12')](_0x7ec6('0x1a'),_0x281501,JSON[_0x7ec6('0x14')](_0xe382b2));_0x4644d0(_0xe382b2);})['catch'](function(_0x5d824a){logger[_0x7ec6('0x15')]('GetOpenchannelQueue',_0x5d824a[_0x7ec6('0x17')],_0x281501);_0x39522c(_0x41e216[_0x7ec6('0x15')](0x1f4,_0x5d824a['message']));});});};exports['ShowOpenchannelQueue']=function(_0x4c1911){var _0x1e787e=this;return new Promise(function(_0x1755ca,_0x489cda){return db[_0x7ec6('0x23')][_0x7ec6('0x24')]({'raw':_0x4c1911[_0x7ec6('0x1c')]?_0x4c1911[_0x7ec6('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4c1911[_0x7ec6('0x1c')]?_0x4c1911[_0x7ec6('0x1c')][_0x7ec6('0x25')]||null:null,'attributes':_0x4c1911[_0x7ec6('0x1c')]?_0x4c1911[_0x7ec6('0x1c')][_0x7ec6('0x1e')]||null:null,'include':_0x4c1911[_0x7ec6('0x1c')]?_0x4c1911[_0x7ec6('0x1c')][_0x7ec6('0x20')]?_[_0x7ec6('0x21')](_0x4c1911[_0x7ec6('0x1c')][_0x7ec6('0x20')],function(_0x31431b){return{'model':db[_0x31431b[_0x7ec6('0x22')]],'as':_0x31431b['as'],'attributes':_0x31431b[_0x7ec6('0x1e')],'include':_0x31431b[_0x7ec6('0x20')]?_['map'](_0x31431b['include'],function(_0x3e3c6b){return{'model':db[_0x3e3c6b[_0x7ec6('0x22')]],'as':_0x3e3c6b['as'],'attributes':_0x3e3c6b[_0x7ec6('0x1e')],'include':_0x3e3c6b[_0x7ec6('0x20')]?_['map'](_0x3e3c6b[_0x7ec6('0x20')],function(_0xfe4407){return{'model':db[_0xfe4407[_0x7ec6('0x22')]],'as':_0xfe4407['as'],'attributes':_0xfe4407[_0x7ec6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7ec6('0xe')](function(_0x5e2621){logger['info'](_0x7ec6('0x26'),_0x4c1911);logger['debug']('ShowOpenchannelQueue',_0x4c1911,JSON[_0x7ec6('0x14')](_0x5e2621));_0x1755ca(_0x5e2621);})[_0x7ec6('0x19')](function(_0x592f8c){logger[_0x7ec6('0x15')](_0x7ec6('0x26'),_0x592f8c[_0x7ec6('0x17')],_0x4c1911);_0x489cda(_0x1e787e[_0x7ec6('0x15')](0x1f4,_0x592f8c[_0x7ec6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 2bbff47..81dd54c 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 _0x5854=['register','./openchannelQueue.events','remove','update','emit','removeListener'];(function(_0x4f2654,_0x3636c4){var _0x25a297=function(_0x28872c){while(--_0x28872c){_0x4f2654['push'](_0x4f2654['shift']());}};_0x25a297(++_0x3636c4);}(_0x5854,0x15d));var _0x4585=function(_0x44364,_0x350475){_0x44364=_0x44364-0x0;var _0x40b63b=_0x5854[_0x44364];return _0x40b63b;};'use strict';var OpenchannelQueueEvents=require(_0x4585('0x0'));var events=['save',_0x4585('0x1'),_0x4585('0x2')];function createListener(_0x360d74,_0x15b041){return function(_0x5e5c59){_0x15b041[_0x4585('0x3')](_0x360d74,_0x5e5c59);};}function removeListener(_0x518dfa,_0xdbfe52){return function(){OpenchannelQueueEvents[_0x4585('0x4')](_0x518dfa,_0xdbfe52);};}exports[_0x4585('0x5')]=function(_0x34ee88){for(var _0x5bada8=0x0,_0x592dd3=events['length'];_0x5bada8<_0x592dd3;_0x5bada8++){var _0x1738bc=events[_0x5bada8];var _0x42e55a=createListener('openchannelQueue:'+_0x1738bc,_0x34ee88);OpenchannelQueueEvents['on'](_0x1738bc,_0x42e55a);}}; \ No newline at end of file +var _0x0c8f=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','removeListener'];(function(_0x332c09,_0x29169d){var _0x36867a=function(_0x582526){while(--_0x582526){_0x332c09['push'](_0x332c09['shift']());}};_0x36867a(++_0x29169d);}(_0x0c8f,0x1eb));var _0xf0c8=function(_0xb398eb,_0x14a3f5){_0xb398eb=_0xb398eb-0x0;var _0x325386=_0x0c8f[_0xb398eb];return _0x325386;};'use strict';var OpenchannelQueueEvents=require(_0xf0c8('0x0'));var events=[_0xf0c8('0x1'),_0xf0c8('0x2'),_0xf0c8('0x3')];function createListener(_0x28e3bf,_0x351ff5){return function(_0x5b79b2){_0x351ff5['emit'](_0x28e3bf,_0x5b79b2);};}function removeListener(_0x5dc8e1,_0x5e522d){return function(){OpenchannelQueueEvents[_0xf0c8('0x4')](_0x5dc8e1,_0x5e522d);};}exports[_0xf0c8('0x5')]=function(_0x4ef4c5){for(var _0x190d49=0x0,_0x547acb=events[_0xf0c8('0x6')];_0x190d49<_0x547acb;_0x190d49++){var _0xa7737a=events[_0x190d49];var _0x14df98=createListener(_0xf0c8('0x7')+_0xa7737a,_0x4ef4c5);OpenchannelQueueEvents['on'](_0xa7737a,_0x14df98);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 59dd7b7..c136b03 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 _0xad5d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','put','update','delete','multer','util','path','connect-timeout','express'];(function(_0xb78b09,_0x4b792b){var _0x272536=function(_0x4af4b7){while(--_0x4af4b7){_0xb78b09['push'](_0xb78b09['shift']());}};_0x272536(++_0x4b792b);}(_0xad5d,0x187));var _0xdad5=function(_0x77b71d,_0x38e802){_0x77b71d=_0x77b71d-0x0;var _0x1b6255=_0xad5d[_0x77b71d];return _0x1b6255;};'use strict';var multer=require(_0xdad5('0x0'));var util=require(_0xdad5('0x1'));var path=require(_0xdad5('0x2'));var timeout=require(_0xdad5('0x3'));var express=require(_0xdad5('0x4'));var router=express[_0xdad5('0x5')]();var auth=require(_0xdad5('0x6'));var interaction=require(_0xdad5('0x7'));var config=require(_0xdad5('0x8'));var controller=require(_0xdad5('0x9'));router[_0xdad5('0xa')]('/',auth[_0xdad5('0xb')](),controller['index']);router[_0xdad5('0xa')](_0xdad5('0xc'),auth[_0xdad5('0xb')](),controller['describe']);router[_0xdad5('0xa')](_0xdad5('0xd'),auth[_0xdad5('0xb')](),controller['show']);router[_0xdad5('0xe')]('/',auth[_0xdad5('0xb')](),controller['create']);router[_0xdad5('0xf')](_0xdad5('0xd'),auth[_0xdad5('0xb')](),controller[_0xdad5('0x10')]);router[_0xdad5('0x11')](_0xdad5('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x416d=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','exports','multer'];(function(_0x339df0,_0x31fa8d){var _0x166059=function(_0x5c1688){while(--_0x5c1688){_0x339df0['push'](_0x339df0['shift']());}};_0x166059(++_0x31fa8d);}(_0x416d,0x7d));var _0xd416=function(_0x229128,_0x273558){_0x229128=_0x229128-0x0;var _0x1875b9=_0x416d[_0x229128];return _0x1875b9;};'use strict';var multer=require(_0xd416('0x0'));var util=require(_0xd416('0x1'));var path=require(_0xd416('0x2'));var timeout=require(_0xd416('0x3'));var express=require('express');var router=express[_0xd416('0x4')]();var auth=require(_0xd416('0x5'));var interaction=require(_0xd416('0x6'));var config=require(_0xd416('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0xd416('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd416('0x8')](_0xd416('0x9'),auth[_0xd416('0xa')](),controller[_0xd416('0xb')]);router[_0xd416('0x8')](_0xd416('0xc'),auth[_0xd416('0xa')](),controller[_0xd416('0xd')]);router[_0xd416('0xe')]('/',auth[_0xd416('0xa')](),controller['create']);router[_0xd416('0xf')](_0xd416('0xc'),auth[_0xd416('0xa')](),controller[_0xd416('0x10')]);router['delete'](_0xd416('0xc'),auth[_0xd416('0xa')](),controller['destroy']);module[_0xd416('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0d3302f..780406b 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 _0xfdc2=['DATE','moment','sequelize','exports','STRING'];(function(_0x635e28,_0x4eecc1){var _0x5bb9dc=function(_0x4e4486){while(--_0x4e4486){_0x635e28['push'](_0x635e28['shift']());}};_0x5bb9dc(++_0x4eecc1);}(_0xfdc2,0xd8));var _0x2fdc=function(_0x4ed278,_0x1ccc2e){_0x4ed278=_0x4ed278-0x0;var _0x1b3866=_0xfdc2[_0x4ed278];return _0x1b3866;};'use strict';var moment=require(_0x2fdc('0x0'));var Sequelize=require(_0x2fdc('0x1'));module[_0x2fdc('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2fdc('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2fdc('0x4')]},'exitAt':{'type':Sequelize[_0x2fdc('0x4')]},'reason':{'type':Sequelize[_0x2fdc('0x3')]}}; \ No newline at end of file +var _0x2ed5=['DATE','sequelize','exports','STRING'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x2ed5,0xa5));var _0x52ed=function(_0x4512dc,_0x1640f9){_0x4512dc=_0x4512dc-0x0;var _0x334ad2=_0x2ed5[_0x4512dc];return _0x334ad2;};'use strict';var moment=require('moment');var Sequelize=require(_0x52ed('0x0'));module[_0x52ed('0x1')]={'uniqueid':{'type':Sequelize[_0x52ed('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x52ed('0x2')]},'joinAt':{'type':Sequelize[_0x52ed('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x52ed('0x3')]},'exitAt':{'type':Sequelize[_0x52ed('0x3')]},'reason':{'type':Sequelize[_0x52ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 71d4b5d..2e355ed 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 _0x61c2=['params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','rows','include','find','catch','create','body'];(function(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0x61c2,0x11f));var _0x261c=function(_0x470b74,_0x3f4052){_0x470b74=_0x470b74-0x0;var _0x59c4c3=_0x61c2[_0x470b74];return _0x59c4c3;};'use strict';var pdf=require(_0x261c('0x0'));var emlformat=require(_0x261c('0x1'));var rimraf=require(_0x261c('0x2'));var zipdir=require(_0x261c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x261c('0x4'));var BPromise=require(_0x261c('0x5'));var Mustache=require(_0x261c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x261c('0x7'));var csv=require('to-csv');var ejs=require(_0x261c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x261c('0x9'));var jsforce=require(_0x261c('0xa'));var deskjs=require(_0x261c('0xb'));var toCsv=require(_0x261c('0xc'));var querystring=require(_0x261c('0xd'));var Papa=require(_0x261c('0xe'));var Redis=require(_0x261c('0xf'));var authService=require(_0x261c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x261c('0x11'));var hardwareService=require(_0x261c('0x12'));var logger=require(_0x261c('0x13'))('api');var utils=require(_0x261c('0x14'));var config=require(_0x261c('0x15'));var db=require(_0x261c('0x16'))['db'];function respondWithStatusCode(_0x27e5fc,_0x56e550){_0x56e550=_0x56e550||0xcc;return function(_0x3caf40){if(_0x3caf40){return _0x27e5fc[_0x261c('0x17')](_0x56e550);}return _0x27e5fc['status'](_0x56e550)[_0x261c('0x18')]();};}function respondWithResult(_0x20af1a,_0x4da031){_0x4da031=_0x4da031||0xc8;return function(_0x1c5a24){if(_0x1c5a24){return _0x20af1a[_0x261c('0x19')](_0x4da031)[_0x261c('0x1a')](_0x1c5a24);}};}function respondWithFilteredResult(_0x1d5319,_0x48fd51){return function(_0x3a6ad9){if(_0x3a6ad9){var _0x27a3c9=_0x3a6ad9[_0x261c('0x1b')],_0x234a12=_0x48fd51[_0x261c('0x1c')],_0x4d625f=_0x48fd51[_0x261c('0x1c')]+_0x48fd51[_0x261c('0x1d')],_0x21b5d4;if(_0x4d625f>=_0x27a3c9){_0x4d625f=_0x27a3c9;_0x21b5d4=0xc8;}else{_0x21b5d4=0xce;}_0x1d5319[_0x261c('0x19')](_0x21b5d4);return _0x1d5319[_0x261c('0x1e')]('Content-Range',_0x234a12+'-'+_0x4d625f+'/'+_0x27a3c9)[_0x261c('0x1a')](_0x3a6ad9);}return null;};}function patchUpdates(_0x5730da){return function(_0x257055){try{jsonpatch[_0x261c('0x1f')](_0x257055,_0x5730da,!![]);}catch(_0x59f2d6){return BPromise[_0x261c('0x20')](_0x59f2d6);}return _0x257055[_0x261c('0x21')]();};}function saveUpdates(_0x1ef550,_0x5f3288){return function(_0x4cd1e0){if(_0x4cd1e0){return _0x4cd1e0[_0x261c('0x22')](_0x1ef550)[_0x261c('0x23')](function(_0x58da00){return _0x58da00;});}return null;};}function removeEntity(_0x10c489,_0x13a947){return function(_0x8fea){if(_0x8fea){return _0x8fea['destroy']()[_0x261c('0x23')](function(){_0x10c489['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56e7cd,_0x173cbc){return function(_0x398b2c){if(!_0x398b2c){_0x56e7cd[_0x261c('0x17')](0x194);}return _0x398b2c;};}function handleError(_0x317655,_0x378d70){_0x378d70=_0x378d70||0x1f4;return function(_0x2c211c){logger[_0x261c('0x24')](_0x2c211c['stack']);if(_0x2c211c[_0x261c('0x25')]){delete _0x2c211c[_0x261c('0x25')];}_0x317655[_0x261c('0x19')](_0x378d70)[_0x261c('0x26')](_0x2c211c);};}exports[_0x261c('0x27')]=function(_0x282242,_0x3bbe9d){var _0x20666f={},_0x52c23={},_0x2df6d3={'count':0x0,'rows':[]};var _0x553742=_[_0x261c('0x28')](db[_0x261c('0x29')][_0x261c('0x2a')],function(_0xd8f8a5){return{'name':_0xd8f8a5[_0x261c('0x2b')],'type':_0xd8f8a5[_0x261c('0x2c')][_0x261c('0x2d')]};});_0x52c23[_0x261c('0x2e')]=_['map'](_0x553742,'name');_0x52c23[_0x261c('0x2f')]=_[_0x261c('0x30')](_0x282242[_0x261c('0x2f')]);_0x52c23['filters']=_['intersection'](_0x52c23[_0x261c('0x2e')],_0x52c23[_0x261c('0x2f')]);_0x20666f[_0x261c('0x31')]=_[_0x261c('0x32')](_0x52c23['model'],qs[_0x261c('0x33')](_0x282242[_0x261c('0x2f')][_0x261c('0x33')]));_0x20666f[_0x261c('0x31')]=_0x20666f['attributes']['length']?_0x20666f[_0x261c('0x31')]:_0x52c23[_0x261c('0x2e')];if(!_0x282242[_0x261c('0x2f')][_0x261c('0x34')]('nolimit')){_0x20666f[_0x261c('0x1d')]=qs[_0x261c('0x1d')](_0x282242[_0x261c('0x2f')]['limit']);_0x20666f[_0x261c('0x1c')]=qs[_0x261c('0x1c')](_0x282242['query'][_0x261c('0x1c')]);}_0x20666f[_0x261c('0x35')]=qs[_0x261c('0x36')](_0x282242[_0x261c('0x2f')]['sort']);_0x20666f['where']=qs['filters'](_[_0x261c('0x37')](_0x282242[_0x261c('0x2f')],_0x52c23[_0x261c('0x38')]),_0x553742);if(_0x282242[_0x261c('0x2f')][_0x261c('0x39')]){_0x20666f['where']=_['merge'](_0x20666f[_0x261c('0x3a')],{'$or':_[_0x261c('0x28')](_0x553742,function(_0x15ca83){if(_0x15ca83['type']!==_0x261c('0x3b')){var _0x37d45c={};_0x37d45c[_0x15ca83[_0x261c('0x25')]]={'$like':'%'+_0x282242[_0x261c('0x2f')][_0x261c('0x39')]+'%'};return _0x37d45c;}})});}_0x20666f=_[_0x261c('0x3c')]({},_0x20666f,_0x282242[_0x261c('0x3d')]);var _0x30c869={'where':_0x20666f[_0x261c('0x3a')]};return db[_0x261c('0x29')][_0x261c('0x1b')](_0x30c869)['then'](function(_0x15161c){_0x2df6d3[_0x261c('0x1b')]=_0x15161c;if(_0x282242[_0x261c('0x2f')]['includeAll']){_0x20666f['include']=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x20666f);})[_0x261c('0x23')](function(_0x13e24f){_0x2df6d3[_0x261c('0x3e')]=_0x13e24f;return _0x2df6d3;})[_0x261c('0x23')](respondWithFilteredResult(_0x3bbe9d,_0x20666f))['catch'](handleError(_0x3bbe9d,null));};exports['show']=function(_0x2723fa,_0x1684a1){var _0x5580fd={'raw':!![],'where':{'id':_0x2723fa['params']['id']}},_0xb9f54c={};_0xb9f54c['model']=_[_0x261c('0x30')](db[_0x261c('0x29')]['rawAttributes']);_0xb9f54c['query']=_[_0x261c('0x30')](_0x2723fa[_0x261c('0x2f')]);_0xb9f54c[_0x261c('0x38')]=_[_0x261c('0x32')](_0xb9f54c['model'],_0xb9f54c[_0x261c('0x2f')]);_0x5580fd[_0x261c('0x31')]=_[_0x261c('0x32')](_0xb9f54c[_0x261c('0x2e')],qs[_0x261c('0x33')](_0x2723fa['query'][_0x261c('0x33')]));_0x5580fd['attributes']=_0x5580fd[_0x261c('0x31')]['length']?_0x5580fd[_0x261c('0x31')]:_0xb9f54c[_0x261c('0x2e')];if(_0x2723fa[_0x261c('0x2f')]['includeAll']){_0x5580fd[_0x261c('0x3f')]=[{'all':!![]}];}_0x5580fd=_['merge']({},_0x5580fd,_0x2723fa[_0x261c('0x3d')]);return db['OpenchannelQueueReport'][_0x261c('0x40')](_0x5580fd)[_0x261c('0x23')](handleEntityNotFound(_0x1684a1,null))['then'](respondWithResult(_0x1684a1,null))[_0x261c('0x41')](handleError(_0x1684a1,null));};exports[_0x261c('0x42')]=function(_0x5003c0,_0xf4e056){return db[_0x261c('0x29')][_0x261c('0x42')](_0x5003c0[_0x261c('0x43')],{})[_0x261c('0x23')](respondWithResult(_0xf4e056,0xc9))['catch'](handleError(_0xf4e056,null));};exports[_0x261c('0x22')]=function(_0x3a80dc,_0x50c2c4){if(_0x3a80dc[_0x261c('0x43')]['id']){delete _0x3a80dc[_0x261c('0x43')]['id'];}return db[_0x261c('0x29')][_0x261c('0x40')]({'where':{'id':_0x3a80dc[_0x261c('0x44')]['id']}})[_0x261c('0x23')](handleEntityNotFound(_0x50c2c4,null))['then'](saveUpdates(_0x3a80dc[_0x261c('0x43')],null))[_0x261c('0x23')](respondWithResult(_0x50c2c4,null))['catch'](handleError(_0x50c2c4,null));};exports[_0x261c('0x45')]=function(_0x3cd0b9,_0x5342b1){return db[_0x261c('0x29')][_0x261c('0x40')]({'where':{'id':_0x3cd0b9[_0x261c('0x44')]['id']}})[_0x261c('0x23')](handleEntityNotFound(_0x5342b1,null))[_0x261c('0x23')](removeEntity(_0x5342b1,null))['catch'](handleError(_0x5342b1,null));};exports[_0x261c('0x46')]=function(_0x2f6763,_0x413a8b){return db[_0x261c('0x29')][_0x261c('0x46')]()['then'](respondWithResult(_0x413a8b,null))['catch'](handleError(_0x413a8b,null));}; \ No newline at end of file +var _0x61f1=['findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include'];(function(_0x58da6d,_0x391410){var _0x44f62a=function(_0x1d7f9a){while(--_0x1d7f9a){_0x58da6d['push'](_0x58da6d['shift']());}};_0x44f62a(++_0x391410);}(_0x61f1,0x18a));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x161f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x161f('0x1'));var jsonpatch=require(_0x161f('0x2'));var rp=require(_0x161f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x161f('0x4'));var util=require(_0x161f('0x5'));var path=require('path');var sox=require(_0x161f('0x6'));var csv=require(_0x161f('0x7'));var ejs=require(_0x161f('0x8'));var fs=require('fs');var _=require(_0x161f('0x9'));var squel=require(_0x161f('0xa'));var crypto=require('crypto');var jsforce=require(_0x161f('0xb'));var deskjs=require(_0x161f('0xc'));var toCsv=require(_0x161f('0x7'));var querystring=require(_0x161f('0xd'));var Papa=require(_0x161f('0xe'));var Redis=require(_0x161f('0xf'));var authService=require(_0x161f('0x10'));var qs=require(_0x161f('0x11'));var as=require(_0x161f('0x12'));var hardwareService=require(_0x161f('0x13'));var logger=require(_0x161f('0x14'))('api');var utils=require(_0x161f('0x15'));var config=require(_0x161f('0x16'));var db=require(_0x161f('0x17'))['db'];function respondWithStatusCode(_0x3dd047,_0x113346){_0x113346=_0x113346||0xcc;return function(_0x4b0917){if(_0x4b0917){return _0x3dd047[_0x161f('0x18')](_0x113346);}return _0x3dd047[_0x161f('0x19')](_0x113346)[_0x161f('0x1a')]();};}function respondWithResult(_0x15d84f,_0x4b34db){_0x4b34db=_0x4b34db||0xc8;return function(_0xc6108b){if(_0xc6108b){return _0x15d84f[_0x161f('0x19')](_0x4b34db)[_0x161f('0x1b')](_0xc6108b);}};}function respondWithFilteredResult(_0x17fcd7,_0x4470d9){return function(_0x1ceffb){if(_0x1ceffb){var _0x594742=_0x1ceffb[_0x161f('0x1c')],_0x486261=_0x4470d9['offset'],_0x3270f3=_0x4470d9[_0x161f('0x1d')]+_0x4470d9[_0x161f('0x1e')],_0x49dffc;if(_0x3270f3>=_0x594742){_0x3270f3=_0x594742;_0x49dffc=0xc8;}else{_0x49dffc=0xce;}_0x17fcd7[_0x161f('0x19')](_0x49dffc);return _0x17fcd7['set'](_0x161f('0x1f'),_0x486261+'-'+_0x3270f3+'/'+_0x594742)['json'](_0x1ceffb);}return null;};}function patchUpdates(_0x1eb321){return function(_0x1d271b){try{jsonpatch[_0x161f('0x20')](_0x1d271b,_0x1eb321,!![]);}catch(_0x5958b4){return BPromise[_0x161f('0x21')](_0x5958b4);}return _0x1d271b[_0x161f('0x22')]();};}function saveUpdates(_0x2ddab0,_0x3a3a61){return function(_0x1153ce){if(_0x1153ce){return _0x1153ce[_0x161f('0x23')](_0x2ddab0)[_0x161f('0x24')](function(_0x41970d){return _0x41970d;});}return null;};}function removeEntity(_0x1be23b,_0x5a92b8){return function(_0x3ae0dc){if(_0x3ae0dc){return _0x3ae0dc[_0x161f('0x25')]()[_0x161f('0x24')](function(){_0x1be23b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xca1a9f,_0xaf2a44){return function(_0x161d91){if(!_0x161d91){_0xca1a9f[_0x161f('0x18')](0x194);}return _0x161d91;};}function handleError(_0x2a1f5f,_0x48b084){_0x48b084=_0x48b084||0x1f4;return function(_0x27d38a){logger[_0x161f('0x26')](_0x27d38a[_0x161f('0x27')]);if(_0x27d38a['name']){delete _0x27d38a[_0x161f('0x28')];}_0x2a1f5f[_0x161f('0x19')](_0x48b084)[_0x161f('0x29')](_0x27d38a);};}exports[_0x161f('0x2a')]=function(_0xd50351,_0x2470ba){var _0x561025={},_0x168b66={},_0x625125={'count':0x0,'rows':[]};var _0x2851fa=_[_0x161f('0x2b')](db[_0x161f('0x2c')][_0x161f('0x2d')],function(_0x589793){return{'name':_0x589793[_0x161f('0x2e')],'type':_0x589793[_0x161f('0x2f')][_0x161f('0x30')]};});_0x168b66['model']=_[_0x161f('0x2b')](_0x2851fa,_0x161f('0x28'));_0x168b66[_0x161f('0x31')]=_[_0x161f('0x32')](_0xd50351[_0x161f('0x31')]);_0x168b66[_0x161f('0x33')]=_[_0x161f('0x34')](_0x168b66[_0x161f('0x35')],_0x168b66['query']);_0x561025['attributes']=_[_0x161f('0x34')](_0x168b66[_0x161f('0x35')],qs[_0x161f('0x36')](_0xd50351['query']['fields']));_0x561025['attributes']=_0x561025[_0x161f('0x37')][_0x161f('0x38')]?_0x561025['attributes']:_0x168b66[_0x161f('0x35')];if(!_0xd50351[_0x161f('0x31')][_0x161f('0x39')](_0x161f('0x3a'))){_0x561025['limit']=qs[_0x161f('0x1e')](_0xd50351['query'][_0x161f('0x1e')]);_0x561025[_0x161f('0x1d')]=qs[_0x161f('0x1d')](_0xd50351[_0x161f('0x31')][_0x161f('0x1d')]);}_0x561025[_0x161f('0x3b')]=qs[_0x161f('0x3c')](_0xd50351[_0x161f('0x31')][_0x161f('0x3c')]);_0x561025[_0x161f('0x3d')]=qs['filters'](_[_0x161f('0x3e')](_0xd50351['query'],_0x168b66[_0x161f('0x33')]),_0x2851fa);if(_0xd50351[_0x161f('0x31')]['filter']){_0x561025[_0x161f('0x3d')]=_[_0x161f('0x3f')](_0x561025[_0x161f('0x3d')],{'$or':_[_0x161f('0x2b')](_0x2851fa,function(_0x56959d){if(_0x56959d[_0x161f('0x2f')]!==_0x161f('0x40')){var _0x4a590a={};_0x4a590a[_0x56959d['name']]={'$like':'%'+_0xd50351['query'][_0x161f('0x41')]+'%'};return _0x4a590a;}})});}_0x561025=_[_0x161f('0x3f')]({},_0x561025,_0xd50351['options']);var _0x39434f={'where':_0x561025['where']};return db['OpenchannelQueueReport'][_0x161f('0x1c')](_0x39434f)[_0x161f('0x24')](function(_0x259300){_0x625125['count']=_0x259300;if(_0xd50351[_0x161f('0x31')][_0x161f('0x42')]){_0x561025[_0x161f('0x43')]=[{'all':!![]}];}return db[_0x161f('0x2c')][_0x161f('0x44')](_0x561025);})[_0x161f('0x24')](function(_0x14f9b1){_0x625125[_0x161f('0x45')]=_0x14f9b1;return _0x625125;})[_0x161f('0x24')](respondWithFilteredResult(_0x2470ba,_0x561025))[_0x161f('0x46')](handleError(_0x2470ba,null));};exports[_0x161f('0x47')]=function(_0xfcccdb,_0x1b07fd){var _0x49a60b={'raw':!![],'where':{'id':_0xfcccdb[_0x161f('0x48')]['id']}},_0x5e6aae={};_0x5e6aae[_0x161f('0x35')]=_[_0x161f('0x32')](db[_0x161f('0x2c')]['rawAttributes']);_0x5e6aae[_0x161f('0x31')]=_[_0x161f('0x32')](_0xfcccdb[_0x161f('0x31')]);_0x5e6aae[_0x161f('0x33')]=_[_0x161f('0x34')](_0x5e6aae[_0x161f('0x35')],_0x5e6aae[_0x161f('0x31')]);_0x49a60b['attributes']=_[_0x161f('0x34')](_0x5e6aae[_0x161f('0x35')],qs['fields'](_0xfcccdb['query'][_0x161f('0x36')]));_0x49a60b['attributes']=_0x49a60b[_0x161f('0x37')][_0x161f('0x38')]?_0x49a60b[_0x161f('0x37')]:_0x5e6aae[_0x161f('0x35')];if(_0xfcccdb[_0x161f('0x31')][_0x161f('0x42')]){_0x49a60b[_0x161f('0x43')]=[{'all':!![]}];}_0x49a60b=_[_0x161f('0x3f')]({},_0x49a60b,_0xfcccdb['options']);return db[_0x161f('0x2c')][_0x161f('0x49')](_0x49a60b)[_0x161f('0x24')](handleEntityNotFound(_0x1b07fd,null))[_0x161f('0x24')](respondWithResult(_0x1b07fd,null))[_0x161f('0x46')](handleError(_0x1b07fd,null));};exports[_0x161f('0x4a')]=function(_0x481c01,_0x3c909c){return db[_0x161f('0x2c')][_0x161f('0x4a')](_0x481c01[_0x161f('0x4b')],{})[_0x161f('0x24')](respondWithResult(_0x3c909c,0xc9))['catch'](handleError(_0x3c909c,null));};exports['update']=function(_0x5d8ef8,_0x565dae){if(_0x5d8ef8[_0x161f('0x4b')]['id']){delete _0x5d8ef8['body']['id'];}return db[_0x161f('0x2c')]['find']({'where':{'id':_0x5d8ef8[_0x161f('0x48')]['id']}})[_0x161f('0x24')](handleEntityNotFound(_0x565dae,null))[_0x161f('0x24')](saveUpdates(_0x5d8ef8['body'],null))[_0x161f('0x24')](respondWithResult(_0x565dae,null))[_0x161f('0x46')](handleError(_0x565dae,null));};exports['destroy']=function(_0x5d5d54,_0x3b51b8){return db['OpenchannelQueueReport'][_0x161f('0x49')]({'where':{'id':_0x5d5d54['params']['id']}})[_0x161f('0x24')](handleEntityNotFound(_0x3b51b8,null))[_0x161f('0x24')](removeEntity(_0x3b51b8,null))[_0x161f('0x46')](handleError(_0x3b51b8,null));};exports[_0x161f('0x4c')]=function(_0x14cea7,_0x1eb15d){return db[_0x161f('0x2c')][_0x161f('0x4c')]()[_0x161f('0x24')](respondWithResult(_0x1eb15d,null))[_0x161f('0x46')](handleError(_0x1eb15d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 38ab0f8..09e748c 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 _0x938a=['rimraf','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','uniqueid','lodash','util','moment'];(function(_0x4dbec1,_0x3dbee9){var _0x56d451=function(_0x365550){while(--_0x365550){_0x4dbec1['push'](_0x4dbec1['shift']());}};_0x56d451(++_0x3dbee9);}(_0x938a,0x1d5));var _0xa938=function(_0x5cb97a,_0x5e0402){_0x5cb97a=_0x5cb97a-0x0;var _0x3bab41=_0x938a[_0x5cb97a];return _0x3bab41;};'use strict';var _=require(_0xa938('0x0'));var util=require(_0xa938('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa938('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa938('0x3'));var config=require('../../config/environment');var attributes=require(_0xa938('0x4'));module[_0xa938('0x5')]=function(_0x5db2a6,_0x214206){return _0x5db2a6['define'](_0xa938('0x6'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xa938('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfada=['request-promise','path','rimraf','./openchannelQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x3d4f17,_0x558cb8){var _0x196c0e=function(_0x301fba){while(--_0x301fba){_0x3d4f17['push'](_0x3d4f17['shift']());}};_0x196c0e(++_0x558cb8);}(_0xfada,0xbb));var _0xafad=function(_0x3534a8,_0x4daad0){_0x3534a8=_0x3534a8-0x0;var _0x7831bc=_0xfada[_0x3534a8];return _0x7831bc;};'use strict';var _=require(_0xafad('0x0'));var util=require(_0xafad('0x1'));var logger=require(_0xafad('0x2'))(_0xafad('0x3'));var moment=require('moment');var BPromise=require(_0xafad('0x4'));var rp=require(_0xafad('0x5'));var fs=require('fs');var path=require(_0xafad('0x6'));var rimraf=require(_0xafad('0x7'));var config=require('../../config/environment');var attributes=require(_0xafad('0x8'));module[_0xafad('0x9')]=function(_0x51f0ce,_0x52d3f2){return _0x51f0ce[_0xafad('0xa')]('OpenchannelQueueReport',attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xafad('0xb'),'fields':[_0xafad('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index a6edd9e..9776bfb 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 _0xc6c0=['then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0xc6c0[_0x46a3e8];return _0xf1442e;};'use strict';var _=require(_0x0c6c('0x0'));var util=require('util');var moment=require(_0x0c6c('0x1'));var BPromise=require(_0x0c6c('0x2'));var rs=require(_0x0c6c('0x3'));var fs=require('fs');var Redis=require(_0x0c6c('0x4'));var db=require(_0x0c6c('0x5'))['db'];var utils=require(_0x0c6c('0x6'));var logger=require(_0x0c6c('0x7'))(_0x0c6c('0x8'));var config=require(_0x0c6c('0x9'));var jayson=require(_0x0c6c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1791cb,_0x223b4f,_0x51208d){return new BPromise(function(_0x2e0cd9,_0x15c862){return client[_0x0c6c('0xb')](_0x1791cb,_0x51208d)[_0x0c6c('0xc')](function(_0x317bcf){logger[_0x0c6c('0xd')](_0x0c6c('0xe'),_0x223b4f,_0x0c6c('0xf'));logger[_0x0c6c('0x10')](_0x0c6c('0x11'),_0x223b4f,_0x0c6c('0xf'),JSON[_0x0c6c('0x12')](_0x317bcf));if(_0x317bcf['error']){if(_0x317bcf[_0x0c6c('0x13')]['code']===0x1f4){logger[_0x0c6c('0x13')](_0x0c6c('0xe'),_0x223b4f,_0x317bcf['error'][_0x0c6c('0x14')]);return _0x15c862(_0x317bcf[_0x0c6c('0x13')][_0x0c6c('0x14')]);}logger[_0x0c6c('0x13')](_0x0c6c('0xe'),_0x223b4f,_0x317bcf['error'][_0x0c6c('0x14')]);return _0x2e0cd9(_0x317bcf[_0x0c6c('0x13')][_0x0c6c('0x14')]);}else{logger[_0x0c6c('0xd')](_0x0c6c('0xe'),_0x223b4f,_0x0c6c('0xf'));_0x2e0cd9(_0x317bcf[_0x0c6c('0x15')]['message']);}})[_0x0c6c('0x16')](function(_0x527ade){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x223b4f,_0x527ade);_0x15c862(_0x527ade);});});}exports[_0x0c6c('0x17')]=function(_0x530333){var _0x9463e8=this;return new Promise(function(_0x50be43,_0x316dbe){return db[_0x0c6c('0x18')][_0x0c6c('0x19')](_0x530333[_0x0c6c('0x1a')],{'raw':_0x530333['options']?_0x530333[_0x0c6c('0x1b')][_0x0c6c('0x1c')]===undefined?!![]:![]:!![]})[_0x0c6c('0xc')](function(_0x1280fb){logger[_0x0c6c('0xd')](_0x0c6c('0x17'),_0x530333);logger[_0x0c6c('0x10')](_0x0c6c('0x17'),_0x530333,JSON[_0x0c6c('0x12')](_0x1280fb));_0x50be43(_0x1280fb);})['catch'](function(_0x323854){logger[_0x0c6c('0x13')](_0x0c6c('0x17'),_0x323854['message'],_0x530333);_0x316dbe(_0x9463e8[_0x0c6c('0x13')](0x1f4,_0x323854['message']));});});};exports[_0x0c6c('0x1d')]=function(_0x35f4ad){var _0x4140e0=this;return new Promise(function(_0x56469d,_0x3fb7a0){return db[_0x0c6c('0x18')][_0x0c6c('0x1e')](_0x35f4ad[_0x0c6c('0x1a')],{'raw':_0x35f4ad[_0x0c6c('0x1b')]?_0x35f4ad[_0x0c6c('0x1b')][_0x0c6c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35f4ad[_0x0c6c('0x1b')]?_0x35f4ad[_0x0c6c('0x1b')][_0x0c6c('0x1f')]||null:null,'attributes':_0x35f4ad['options']?_0x35f4ad[_0x0c6c('0x1b')]['attributes']||null:null,'limit':_0x35f4ad[_0x0c6c('0x1b')]?_0x35f4ad['options'][_0x0c6c('0x20')]||null:null})[_0x0c6c('0xc')](function(_0x184252){logger[_0x0c6c('0xd')](_0x0c6c('0x1d'),_0x35f4ad);logger[_0x0c6c('0x10')](_0x0c6c('0x1d'),_0x35f4ad,JSON[_0x0c6c('0x12')](_0x184252));_0x56469d(_0x184252);})['catch'](function(_0x452d93){logger[_0x0c6c('0x13')]('UpdateOpenchannelQueueReport',_0x452d93[_0x0c6c('0x14')],_0x35f4ad);_0x3fb7a0(_0x4140e0['error'](0x1f4,_0x452d93[_0x0c6c('0x14')]));});});}; \ No newline at end of file +var _0x6132=['catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','limit','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6132,0xf3));var _0x2613=function(_0x5c4b79,_0x483a9f){_0x5c4b79=_0x5c4b79-0x0;var _0x2699c9=_0x6132[_0x5c4b79];return _0x2699c9;};'use strict';var _=require('lodash');var util=require(_0x2613('0x0'));var moment=require('moment');var BPromise=require(_0x2613('0x1'));var rs=require(_0x2613('0x2'));var fs=require('fs');var Redis=require(_0x2613('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2613('0x4'))('rpc');var config=require(_0x2613('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2613('0x6')][_0x2613('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1083a6,_0x546fd4,_0x43c9d4){return new BPromise(function(_0x43c876,_0x51f79d){return client['request'](_0x1083a6,_0x43c9d4)[_0x2613('0x8')](function(_0x47dfc5){logger[_0x2613('0x9')](_0x2613('0xa'),_0x546fd4,_0x2613('0xb'));logger[_0x2613('0xc')](_0x2613('0xd'),_0x546fd4,_0x2613('0xb'),JSON['stringify'](_0x47dfc5));if(_0x47dfc5[_0x2613('0xe')]){if(_0x47dfc5[_0x2613('0xe')][_0x2613('0xf')]===0x1f4){logger[_0x2613('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x546fd4,_0x47dfc5[_0x2613('0xe')][_0x2613('0x10')]);return _0x51f79d(_0x47dfc5[_0x2613('0xe')][_0x2613('0x10')]);}logger[_0x2613('0xe')](_0x2613('0xa'),_0x546fd4,_0x47dfc5[_0x2613('0xe')][_0x2613('0x10')]);return _0x43c876(_0x47dfc5[_0x2613('0xe')][_0x2613('0x10')]);}else{logger[_0x2613('0x9')](_0x2613('0xa'),_0x546fd4,_0x2613('0xb'));_0x43c876(_0x47dfc5[_0x2613('0x11')][_0x2613('0x10')]);}})[_0x2613('0x12')](function(_0xb99fd7){logger[_0x2613('0xe')](_0x2613('0xa'),_0x546fd4,_0xb99fd7);_0x51f79d(_0xb99fd7);});});}exports[_0x2613('0x13')]=function(_0x32e426){var _0x35279f=this;return new Promise(function(_0x5072e5,_0x8adf43){return db[_0x2613('0x14')][_0x2613('0x15')](_0x32e426[_0x2613('0x16')],{'raw':_0x32e426[_0x2613('0x17')]?_0x32e426[_0x2613('0x17')][_0x2613('0x18')]===undefined?!![]:![]:!![]})[_0x2613('0x8')](function(_0x41f86d){logger[_0x2613('0x9')](_0x2613('0x13'),_0x32e426);logger['debug'](_0x2613('0x13'),_0x32e426,JSON[_0x2613('0x19')](_0x41f86d));_0x5072e5(_0x41f86d);})[_0x2613('0x12')](function(_0x55d5c2){logger[_0x2613('0xe')]('CreateOpenchannelQueueReport',_0x55d5c2[_0x2613('0x10')],_0x32e426);_0x8adf43(_0x35279f[_0x2613('0xe')](0x1f4,_0x55d5c2[_0x2613('0x10')]));});});};exports[_0x2613('0x1a')]=function(_0x1e7e26){var _0x2cf4b7=this;return new Promise(function(_0x128aa0,_0x279fcc){return db[_0x2613('0x14')][_0x2613('0x1b')](_0x1e7e26[_0x2613('0x16')],{'raw':_0x1e7e26['options']?_0x1e7e26[_0x2613('0x17')][_0x2613('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e7e26['options']?_0x1e7e26[_0x2613('0x17')]['where']||null:null,'attributes':_0x1e7e26[_0x2613('0x17')]?_0x1e7e26[_0x2613('0x17')]['attributes']||null:null,'limit':_0x1e7e26[_0x2613('0x17')]?_0x1e7e26[_0x2613('0x17')][_0x2613('0x1c')]||null:null})['then'](function(_0x55b95d){logger[_0x2613('0x9')]('UpdateOpenchannelQueueReport',_0x1e7e26);logger[_0x2613('0xc')](_0x2613('0x1a'),_0x1e7e26,JSON[_0x2613('0x19')](_0x55b95d));_0x128aa0(_0x55b95d);})[_0x2613('0x12')](function(_0x4a6008){logger[_0x2613('0xe')](_0x2613('0x1a'),_0x4a6008[_0x2613('0x10')],_0x1e7e26);_0x279fcc(_0x2cf4b7['error'](0x1f4,_0x4a6008[_0x2613('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8cb2816..8a18810 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(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 44738ce..10a2e63 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 _0xb734=['STRING','ENUM','account','agent','queue','DATE','exports'];(function(_0xc75e69,_0x19ac94){var _0x447f25=function(_0x25125c){while(--_0x25125c){_0xc75e69['push'](_0xc75e69['shift']());}};_0x447f25(++_0x19ac94);}(_0xb734,0xc3));var _0x4b73=function(_0x2bbe8d,_0x5156c2){_0x2bbe8d=_0x2bbe8d-0x0;var _0x539e7a=_0xb734[_0x2bbe8d];return _0x539e7a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4b73('0x0')]={'uniqueid':{'type':Sequelize[_0x4b73('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4b73('0x2')](_0x4b73('0x3'),_0x4b73('0x4'),_0x4b73('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x4b73('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x423b=['STRING','agent','queue','DATE','NOW','sequelize'];(function(_0x446832,_0x12964a){var _0x2002bd=function(_0xa1de44){while(--_0xa1de44){_0x446832['push'](_0x446832['shift']());}};_0x2002bd(++_0x12964a);}(_0x423b,0x107));var _0xb423=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x423b[_0x8c43de];return _0xa6591b;};'use strict';var moment=require('moment');var Sequelize=require(_0xb423('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb423('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xb423('0x2'),_0xb423('0x3')),'allowNull':![],'defaultValue':_0xb423('0x3')},'transferredAt':{'type':Sequelize[_0xb423('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xb423('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 5a15760..cedfaa3 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 _0x2fa8=['OpenchannelTransferReport','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','count','includeAll','include','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','json','apply','reject','update','destroy','stack','name','send','map'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0x2fa8,0x1d7));var _0x82fa=function(_0x4e6017,_0x15802c){_0x4e6017=_0x4e6017-0x0;var _0x4f0ad6=_0x2fa8[_0x4e6017];return _0x4f0ad6;};'use strict';var pdf=require(_0x82fa('0x0'));var emlformat=require(_0x82fa('0x1'));var rimraf=require(_0x82fa('0x2'));var zipdir=require(_0x82fa('0x3'));var jsonpatch=require(_0x82fa('0x4'));var rp=require(_0x82fa('0x5'));var moment=require(_0x82fa('0x6'));var BPromise=require(_0x82fa('0x7'));var Mustache=require(_0x82fa('0x8'));var util=require(_0x82fa('0x9'));var path=require(_0x82fa('0xa'));var sox=require(_0x82fa('0xb'));var csv=require('to-csv');var ejs=require(_0x82fa('0xc'));var fs=require('fs');var _=require(_0x82fa('0xd'));var squel=require(_0x82fa('0xe'));var crypto=require(_0x82fa('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x82fa('0x10'));var toCsv=require(_0x82fa('0x11'));var querystring=require(_0x82fa('0x12'));var Papa=require(_0x82fa('0x13'));var Redis=require(_0x82fa('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82fa('0x15'));var logger=require(_0x82fa('0x16'))(_0x82fa('0x17'));var utils=require(_0x82fa('0x18'));var config=require('../../config/environment');var db=require(_0x82fa('0x19'))['db'];function respondWithStatusCode(_0x1e33aa,_0x1270b6){_0x1270b6=_0x1270b6||0xcc;return function(_0x2bcb04){if(_0x2bcb04){return _0x1e33aa[_0x82fa('0x1a')](_0x1270b6);}return _0x1e33aa[_0x82fa('0x1b')](_0x1270b6)[_0x82fa('0x1c')]();};}function respondWithResult(_0x55e3a8,_0x3e5b96){_0x3e5b96=_0x3e5b96||0xc8;return function(_0x3a3966){if(_0x3a3966){return _0x55e3a8[_0x82fa('0x1b')](_0x3e5b96)['json'](_0x3a3966);}};}function respondWithFilteredResult(_0x460b2f,_0x3ddfa7){return function(_0x5a1338){if(_0x5a1338){var _0x55137d=_0x5a1338['count'],_0x4cae2e=_0x3ddfa7[_0x82fa('0x1d')],_0x4404d3=_0x3ddfa7[_0x82fa('0x1d')]+_0x3ddfa7[_0x82fa('0x1e')],_0x1b4b50;if(_0x4404d3>=_0x55137d){_0x4404d3=_0x55137d;_0x1b4b50=0xc8;}else{_0x1b4b50=0xce;}_0x460b2f[_0x82fa('0x1b')](_0x1b4b50);return _0x460b2f['set']('Content-Range',_0x4cae2e+'-'+_0x4404d3+'/'+_0x55137d)[_0x82fa('0x1f')](_0x5a1338);}return null;};}function patchUpdates(_0x383511){return function(_0x315fe4){try{jsonpatch[_0x82fa('0x20')](_0x315fe4,_0x383511,!![]);}catch(_0x5aa510){return BPromise[_0x82fa('0x21')](_0x5aa510);}return _0x315fe4['save']();};}function saveUpdates(_0x1b51e6,_0x49e54e){return function(_0x30e4e3){if(_0x30e4e3){return _0x30e4e3[_0x82fa('0x22')](_0x1b51e6)['then'](function(_0x3bd0f4){return _0x3bd0f4;});}return null;};}function removeEntity(_0x345893,_0x4b5bf1){return function(_0x3f21df){if(_0x3f21df){return _0x3f21df[_0x82fa('0x23')]()['then'](function(){_0x345893['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x76e47d,_0xb91043){return function(_0x1db43e){if(!_0x1db43e){_0x76e47d['sendStatus'](0x194);}return _0x1db43e;};}function handleError(_0x3f3d8f,_0x36bcb4){_0x36bcb4=_0x36bcb4||0x1f4;return function(_0x107b17){logger['error'](_0x107b17[_0x82fa('0x24')]);if(_0x107b17[_0x82fa('0x25')]){delete _0x107b17[_0x82fa('0x25')];}_0x3f3d8f[_0x82fa('0x1b')](_0x36bcb4)[_0x82fa('0x26')](_0x107b17);};}exports['index']=function(_0x31771a,_0xba7481){var _0x349ab8={},_0x697dbc={},_0x39d865={'count':0x0,'rows':[]};var _0x20a72b=_[_0x82fa('0x27')](db[_0x82fa('0x28')]['rawAttributes'],function(_0x8bceda){return{'name':_0x8bceda[_0x82fa('0x29')],'type':_0x8bceda[_0x82fa('0x2a')]['key']};});_0x697dbc['model']=_[_0x82fa('0x27')](_0x20a72b,'name');_0x697dbc[_0x82fa('0x2b')]=_['keys'](_0x31771a[_0x82fa('0x2b')]);_0x697dbc[_0x82fa('0x2c')]=_[_0x82fa('0x2d')](_0x697dbc[_0x82fa('0x2e')],_0x697dbc[_0x82fa('0x2b')]);_0x349ab8[_0x82fa('0x2f')]=_[_0x82fa('0x2d')](_0x697dbc[_0x82fa('0x2e')],qs[_0x82fa('0x30')](_0x31771a['query'][_0x82fa('0x30')]));_0x349ab8[_0x82fa('0x2f')]=_0x349ab8['attributes'][_0x82fa('0x31')]?_0x349ab8[_0x82fa('0x2f')]:_0x697dbc[_0x82fa('0x2e')];if(!_0x31771a[_0x82fa('0x2b')][_0x82fa('0x32')](_0x82fa('0x33'))){_0x349ab8[_0x82fa('0x1e')]=qs[_0x82fa('0x1e')](_0x31771a[_0x82fa('0x2b')][_0x82fa('0x1e')]);_0x349ab8[_0x82fa('0x1d')]=qs[_0x82fa('0x1d')](_0x31771a[_0x82fa('0x2b')]['offset']);}_0x349ab8[_0x82fa('0x34')]=qs[_0x82fa('0x35')](_0x31771a[_0x82fa('0x2b')][_0x82fa('0x35')]);_0x349ab8[_0x82fa('0x36')]=qs[_0x82fa('0x2c')](_[_0x82fa('0x37')](_0x31771a[_0x82fa('0x2b')],_0x697dbc[_0x82fa('0x2c')]),_0x20a72b);if(_0x31771a['query'][_0x82fa('0x38')]){_0x349ab8[_0x82fa('0x36')]=_[_0x82fa('0x39')](_0x349ab8['where'],{'$or':_[_0x82fa('0x27')](_0x20a72b,function(_0x24a2d4){if(_0x24a2d4[_0x82fa('0x2a')]!=='VIRTUAL'){var _0x7e1d27={};_0x7e1d27[_0x24a2d4[_0x82fa('0x25')]]={'$like':'%'+_0x31771a[_0x82fa('0x2b')]['filter']+'%'};return _0x7e1d27;}})});}_0x349ab8=_['merge']({},_0x349ab8,_0x31771a[_0x82fa('0x3a')]);var _0x5b233e={'where':_0x349ab8['where']};return db[_0x82fa('0x28')]['count'](_0x5b233e)[_0x82fa('0x3b')](function(_0x35f46e){_0x39d865[_0x82fa('0x3c')]=_0x35f46e;if(_0x31771a[_0x82fa('0x2b')][_0x82fa('0x3d')]){_0x349ab8[_0x82fa('0x3e')]=[{'all':!![]}];}return db[_0x82fa('0x28')]['findAll'](_0x349ab8);})[_0x82fa('0x3b')](function(_0xf3332d){_0x39d865[_0x82fa('0x3f')]=_0xf3332d;return _0x39d865;})[_0x82fa('0x3b')](respondWithFilteredResult(_0xba7481,_0x349ab8))['catch'](handleError(_0xba7481,null));};exports[_0x82fa('0x40')]=function(_0x57810d,_0x429af1){var _0xfa54df={'raw':!![],'where':{'id':_0x57810d[_0x82fa('0x41')]['id']}},_0xf2bbdc={};_0xf2bbdc['model']=_[_0x82fa('0x42')](db['OpenchannelTransferReport'][_0x82fa('0x43')]);_0xf2bbdc[_0x82fa('0x2b')]=_['keys'](_0x57810d['query']);_0xf2bbdc['filters']=_[_0x82fa('0x2d')](_0xf2bbdc['model'],_0xf2bbdc[_0x82fa('0x2b')]);_0xfa54df[_0x82fa('0x2f')]=_['intersection'](_0xf2bbdc[_0x82fa('0x2e')],qs[_0x82fa('0x30')](_0x57810d[_0x82fa('0x2b')][_0x82fa('0x30')]));_0xfa54df[_0x82fa('0x2f')]=_0xfa54df[_0x82fa('0x2f')][_0x82fa('0x31')]?_0xfa54df[_0x82fa('0x2f')]:_0xf2bbdc[_0x82fa('0x2e')];if(_0x57810d['query'][_0x82fa('0x3d')]){_0xfa54df[_0x82fa('0x3e')]=[{'all':!![]}];}_0xfa54df=_['merge']({},_0xfa54df,_0x57810d[_0x82fa('0x3a')]);return db[_0x82fa('0x28')][_0x82fa('0x44')](_0xfa54df)[_0x82fa('0x3b')](handleEntityNotFound(_0x429af1,null))[_0x82fa('0x3b')](respondWithResult(_0x429af1,null))[_0x82fa('0x45')](handleError(_0x429af1,null));};exports['create']=function(_0x16700a,_0xfa0e1a){return db['OpenchannelTransferReport'][_0x82fa('0x46')](_0x16700a[_0x82fa('0x47')],{})[_0x82fa('0x3b')](respondWithResult(_0xfa0e1a,0xc9))[_0x82fa('0x45')](handleError(_0xfa0e1a,null));};exports[_0x82fa('0x22')]=function(_0x1740cf,_0x446b8c){if(_0x1740cf['body']['id']){delete _0x1740cf[_0x82fa('0x47')]['id'];}return db['OpenchannelTransferReport'][_0x82fa('0x44')]({'where':{'id':_0x1740cf['params']['id']}})[_0x82fa('0x3b')](handleEntityNotFound(_0x446b8c,null))[_0x82fa('0x3b')](saveUpdates(_0x1740cf['body'],null))['then'](respondWithResult(_0x446b8c,null))[_0x82fa('0x45')](handleError(_0x446b8c,null));};exports[_0x82fa('0x23')]=function(_0x51f3be,_0x402b05){return db[_0x82fa('0x28')][_0x82fa('0x44')]({'where':{'id':_0x51f3be[_0x82fa('0x41')]['id']}})[_0x82fa('0x3b')](handleEntityNotFound(_0x402b05,null))[_0x82fa('0x3b')](removeEntity(_0x402b05,null))[_0x82fa('0x45')](handleError(_0x402b05,null));};exports[_0x82fa('0x48')]=function(_0x1bcab8,_0x50cde9){return db[_0x82fa('0x28')]['describe']()[_0x82fa('0x3b')](respondWithResult(_0x50cde9,null))['catch'](handleError(_0x50cde9,null));}; \ No newline at end of file +var _0x3e00=['../../config/environment','../../mysqldb','status','end','json','offset','set','reject','save','update','then','stack','name','map','OpenchannelTransferReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','pick','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x3e00,0xe7));var _0x03e0=function(_0x52755b,_0x1c23a7){_0x52755b=_0x52755b-0x0;var _0x5cd316=_0x3e00[_0x52755b];return _0x5cd316;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x03e0('0x0'));var rimraf=require(_0x03e0('0x1'));var zipdir=require(_0x03e0('0x2'));var jsonpatch=require(_0x03e0('0x3'));var rp=require('request-promise');var moment=require(_0x03e0('0x4'));var BPromise=require(_0x03e0('0x5'));var Mustache=require(_0x03e0('0x6'));var util=require(_0x03e0('0x7'));var path=require(_0x03e0('0x8'));var sox=require('sox');var csv=require(_0x03e0('0x9'));var ejs=require(_0x03e0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x03e0('0xb'));var crypto=require(_0x03e0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x03e0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x03e0('0xe'));var authService=require(_0x03e0('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03e0('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x03e0('0x11'));var db=require(_0x03e0('0x12'))['db'];function respondWithStatusCode(_0x1001c5,_0x5eaa40){_0x5eaa40=_0x5eaa40||0xcc;return function(_0x16fc09){if(_0x16fc09){return _0x1001c5['sendStatus'](_0x5eaa40);}return _0x1001c5[_0x03e0('0x13')](_0x5eaa40)[_0x03e0('0x14')]();};}function respondWithResult(_0x5eeccc,_0x103ad8){_0x103ad8=_0x103ad8||0xc8;return function(_0x21f501){if(_0x21f501){return _0x5eeccc['status'](_0x103ad8)[_0x03e0('0x15')](_0x21f501);}};}function respondWithFilteredResult(_0x28c139,_0x38ef17){return function(_0x2109c5){if(_0x2109c5){var _0x590989=_0x2109c5['count'],_0x533e87=_0x38ef17[_0x03e0('0x16')],_0x10ceb3=_0x38ef17['offset']+_0x38ef17['limit'],_0x2989f3;if(_0x10ceb3>=_0x590989){_0x10ceb3=_0x590989;_0x2989f3=0xc8;}else{_0x2989f3=0xce;}_0x28c139[_0x03e0('0x13')](_0x2989f3);return _0x28c139[_0x03e0('0x17')]('Content-Range',_0x533e87+'-'+_0x10ceb3+'/'+_0x590989)[_0x03e0('0x15')](_0x2109c5);}return null;};}function patchUpdates(_0xe67cc1){return function(_0x22325e){try{jsonpatch['apply'](_0x22325e,_0xe67cc1,!![]);}catch(_0x5f1635){return BPromise[_0x03e0('0x18')](_0x5f1635);}return _0x22325e[_0x03e0('0x19')]();};}function saveUpdates(_0x243b90,_0x50d988){return function(_0x579d66){if(_0x579d66){return _0x579d66[_0x03e0('0x1a')](_0x243b90)[_0x03e0('0x1b')](function(_0x3b67ef){return _0x3b67ef;});}return null;};}function removeEntity(_0x10a59c,_0x4ebb33){return function(_0x622687){if(_0x622687){return _0x622687['destroy']()[_0x03e0('0x1b')](function(){_0x10a59c[_0x03e0('0x13')](0xcc)[_0x03e0('0x14')]();});}};}function handleEntityNotFound(_0x1d0fd9,_0x4a5c96){return function(_0x5f0f94){if(!_0x5f0f94){_0x1d0fd9['sendStatus'](0x194);}return _0x5f0f94;};}function handleError(_0x422731,_0x2f735b){_0x2f735b=_0x2f735b||0x1f4;return function(_0x139181){logger['error'](_0x139181[_0x03e0('0x1c')]);if(_0x139181[_0x03e0('0x1d')]){delete _0x139181[_0x03e0('0x1d')];}_0x422731['status'](_0x2f735b)['send'](_0x139181);};}exports['index']=function(_0x26f6cd,_0x5710c4){var _0x2c49bc={},_0x281157={},_0x46f083={'count':0x0,'rows':[]};var _0x1a0f12=_[_0x03e0('0x1e')](db[_0x03e0('0x1f')][_0x03e0('0x20')],function(_0x27ae18){return{'name':_0x27ae18['fieldName'],'type':_0x27ae18['type'][_0x03e0('0x21')]};});_0x281157[_0x03e0('0x22')]=_[_0x03e0('0x1e')](_0x1a0f12,_0x03e0('0x1d'));_0x281157[_0x03e0('0x23')]=_[_0x03e0('0x24')](_0x26f6cd[_0x03e0('0x23')]);_0x281157[_0x03e0('0x25')]=_[_0x03e0('0x26')](_0x281157[_0x03e0('0x22')],_0x281157['query']);_0x2c49bc['attributes']=_['intersection'](_0x281157[_0x03e0('0x22')],qs[_0x03e0('0x27')](_0x26f6cd[_0x03e0('0x23')][_0x03e0('0x27')]));_0x2c49bc[_0x03e0('0x28')]=_0x2c49bc[_0x03e0('0x28')][_0x03e0('0x29')]?_0x2c49bc['attributes']:_0x281157[_0x03e0('0x22')];if(!_0x26f6cd['query'][_0x03e0('0x2a')](_0x03e0('0x2b'))){_0x2c49bc[_0x03e0('0x2c')]=qs[_0x03e0('0x2c')](_0x26f6cd[_0x03e0('0x23')][_0x03e0('0x2c')]);_0x2c49bc[_0x03e0('0x16')]=qs[_0x03e0('0x16')](_0x26f6cd[_0x03e0('0x23')][_0x03e0('0x16')]);}_0x2c49bc['order']=qs['sort'](_0x26f6cd['query']['sort']);_0x2c49bc['where']=qs[_0x03e0('0x25')](_[_0x03e0('0x2d')](_0x26f6cd[_0x03e0('0x23')],_0x281157['filters']),_0x1a0f12);if(_0x26f6cd[_0x03e0('0x23')]['filter']){_0x2c49bc[_0x03e0('0x2e')]=_[_0x03e0('0x2f')](_0x2c49bc['where'],{'$or':_[_0x03e0('0x1e')](_0x1a0f12,function(_0x2c834b){if(_0x2c834b['type']!==_0x03e0('0x30')){var _0x1628a9={};_0x1628a9[_0x2c834b[_0x03e0('0x1d')]]={'$like':'%'+_0x26f6cd[_0x03e0('0x23')]['filter']+'%'};return _0x1628a9;}})});}_0x2c49bc=_[_0x03e0('0x2f')]({},_0x2c49bc,_0x26f6cd[_0x03e0('0x31')]);var _0x409fd1={'where':_0x2c49bc[_0x03e0('0x2e')]};return db[_0x03e0('0x1f')][_0x03e0('0x32')](_0x409fd1)[_0x03e0('0x1b')](function(_0xcd309){_0x46f083['count']=_0xcd309;if(_0x26f6cd[_0x03e0('0x23')][_0x03e0('0x33')]){_0x2c49bc[_0x03e0('0x34')]=[{'all':!![]}];}return db[_0x03e0('0x1f')]['findAll'](_0x2c49bc);})[_0x03e0('0x1b')](function(_0x5b1f5f){_0x46f083[_0x03e0('0x35')]=_0x5b1f5f;return _0x46f083;})[_0x03e0('0x1b')](respondWithFilteredResult(_0x5710c4,_0x2c49bc))[_0x03e0('0x36')](handleError(_0x5710c4,null));};exports[_0x03e0('0x37')]=function(_0x43b8f6,_0x54a3b9){var _0x34d3a9={'raw':!![],'where':{'id':_0x43b8f6[_0x03e0('0x38')]['id']}},_0x4225e6={};_0x4225e6[_0x03e0('0x22')]=_[_0x03e0('0x24')](db[_0x03e0('0x1f')][_0x03e0('0x20')]);_0x4225e6['query']=_[_0x03e0('0x24')](_0x43b8f6[_0x03e0('0x23')]);_0x4225e6['filters']=_[_0x03e0('0x26')](_0x4225e6['model'],_0x4225e6['query']);_0x34d3a9[_0x03e0('0x28')]=_[_0x03e0('0x26')](_0x4225e6['model'],qs[_0x03e0('0x27')](_0x43b8f6['query'][_0x03e0('0x27')]));_0x34d3a9[_0x03e0('0x28')]=_0x34d3a9[_0x03e0('0x28')][_0x03e0('0x29')]?_0x34d3a9[_0x03e0('0x28')]:_0x4225e6['model'];if(_0x43b8f6['query'][_0x03e0('0x33')]){_0x34d3a9[_0x03e0('0x34')]=[{'all':!![]}];}_0x34d3a9=_[_0x03e0('0x2f')]({},_0x34d3a9,_0x43b8f6['options']);return db[_0x03e0('0x1f')][_0x03e0('0x39')](_0x34d3a9)[_0x03e0('0x1b')](handleEntityNotFound(_0x54a3b9,null))[_0x03e0('0x1b')](respondWithResult(_0x54a3b9,null))['catch'](handleError(_0x54a3b9,null));};exports[_0x03e0('0x3a')]=function(_0x54e7f7,_0x19f103){return db[_0x03e0('0x1f')][_0x03e0('0x3a')](_0x54e7f7['body'],{})[_0x03e0('0x1b')](respondWithResult(_0x19f103,0xc9))['catch'](handleError(_0x19f103,null));};exports['update']=function(_0x1f7c7a,_0x17648b){if(_0x1f7c7a[_0x03e0('0x3b')]['id']){delete _0x1f7c7a[_0x03e0('0x3b')]['id'];}return db[_0x03e0('0x1f')]['find']({'where':{'id':_0x1f7c7a['params']['id']}})['then'](handleEntityNotFound(_0x17648b,null))[_0x03e0('0x1b')](saveUpdates(_0x1f7c7a[_0x03e0('0x3b')],null))[_0x03e0('0x1b')](respondWithResult(_0x17648b,null))[_0x03e0('0x36')](handleError(_0x17648b,null));};exports[_0x03e0('0x3c')]=function(_0x87bf7b,_0x4419ec){return db[_0x03e0('0x1f')]['find']({'where':{'id':_0x87bf7b['params']['id']}})[_0x03e0('0x1b')](handleEntityNotFound(_0x4419ec,null))[_0x03e0('0x1b')](removeEntity(_0x4419ec,null))['catch'](handleError(_0x4419ec,null));};exports[_0x03e0('0x3d')]=function(_0x58c96c,_0x23ab9d){return db[_0x03e0('0x1f')]['describe']()['then'](respondWithResult(_0x23ab9d,null))[_0x03e0('0x36')](handleError(_0x23ab9d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index fca9a38..84880ce 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 _0xe451=['../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer','../../config/logger','request-promise','path','rimraf'];(function(_0x1223bc,_0x4d6823){var _0x5c0891=function(_0x36a7d4){while(--_0x36a7d4){_0x1223bc['push'](_0x1223bc['shift']());}};_0x5c0891(++_0x4d6823);}(_0xe451,0xec));var _0x1e45=function(_0xb16fd,_0xb9d715){_0xb16fd=_0xb16fd-0x0;var _0x49f716=_0xe451[_0xb16fd];return _0x49f716;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e45('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1e45('0x1'));var fs=require('fs');var path=require(_0x1e45('0x2'));var rimraf=require(_0x1e45('0x3'));var config=require(_0x1e45('0x4'));var attributes=require('./openchannelTransferReport.attributes');module[_0x1e45('0x5')]=function(_0x1a163c,_0x115f88){return _0x1a163c['define'](_0x1e45('0x6'),attributes,{'tableName':_0x1e45('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x29b1=['define','report_openchannel_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports'];(function(_0x13872d,_0x1e4cc4){var _0x1e71b8=function(_0x3cd363){while(--_0x3cd363){_0x13872d['push'](_0x13872d['shift']());}};_0x1e71b8(++_0x1e4cc4);}(_0x29b1,0x13b));var _0x129b=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x29b1[_0x187ee1];return _0x388160;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x129b('0x0'))(_0x129b('0x1'));var moment=require(_0x129b('0x2'));var BPromise=require(_0x129b('0x3'));var rp=require(_0x129b('0x4'));var fs=require('fs');var path=require(_0x129b('0x5'));var rimraf=require(_0x129b('0x6'));var config=require(_0x129b('0x7'));var attributes=require(_0x129b('0x8'));module[_0x129b('0x9')]=function(_0x11c23d,_0x5ca1ff){return _0x11c23d[_0x129b('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x129b('0xb'),'paranoid':![],'indexes':[{'name':_0x129b('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index d5eca62..73291d0 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 _0xdcf0=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xdcf0,0xb8));var _0x0dcf=function(_0x129179,_0x3dd450){_0x129179=_0x129179-0x0;var _0x2393d7=_0xdcf0[_0x129179];return _0x2393d7;};'use strict';var _=require(_0x0dcf('0x0'));var util=require(_0x0dcf('0x1'));var moment=require('moment');var BPromise=require(_0x0dcf('0x2'));var rs=require(_0x0dcf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0dcf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0dcf('0x5'));var config=require(_0x0dcf('0x6'));var jayson=require(_0x0dcf('0x7'));var client=jayson[_0x0dcf('0x8')][_0x0dcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x598cf5,_0x9809c2,_0x4ea8e2){return new BPromise(function(_0x37871c,_0x222ffa){return client[_0x0dcf('0xa')](_0x598cf5,_0x4ea8e2)[_0x0dcf('0xb')](function(_0x17e8d6){logger[_0x0dcf('0xc')](_0x0dcf('0xd'),_0x9809c2,'request\x20sent');logger[_0x0dcf('0xe')](_0x0dcf('0xf'),_0x9809c2,_0x0dcf('0x10'),JSON[_0x0dcf('0x11')](_0x17e8d6));if(_0x17e8d6[_0x0dcf('0x12')]){if(_0x17e8d6['error']['code']===0x1f4){logger[_0x0dcf('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x9809c2,_0x17e8d6['error'][_0x0dcf('0x13')]);return _0x222ffa(_0x17e8d6[_0x0dcf('0x12')][_0x0dcf('0x13')]);}logger[_0x0dcf('0x12')](_0x0dcf('0xd'),_0x9809c2,_0x17e8d6[_0x0dcf('0x12')][_0x0dcf('0x13')]);return _0x37871c(_0x17e8d6[_0x0dcf('0x12')]['message']);}else{logger[_0x0dcf('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x9809c2,'request\x20sent');_0x37871c(_0x17e8d6[_0x0dcf('0x14')][_0x0dcf('0x13')]);}})[_0x0dcf('0x15')](function(_0x37f3b0){logger['error'](_0x0dcf('0xd'),_0x9809c2,_0x37f3b0);_0x222ffa(_0x37f3b0);});});} \ No newline at end of file +var _0x2b99=['moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x467520,_0x504453){var _0x527842=function(_0x257996){while(--_0x257996){_0x467520['push'](_0x467520['shift']());}};_0x527842(++_0x504453);}(_0x2b99,0x1b3));var _0x92b9=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x2b99[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x92b9('0x0'));var util=require(_0x92b9('0x1'));var moment=require(_0x92b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x92b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b9('0x4'))['db'];var utils=require(_0x92b9('0x5'));var logger=require('../../config/logger')(_0x92b9('0x6'));var config=require(_0x92b9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x92b9('0x8')][_0x92b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x61f37e,_0x1b1000,_0x4267b2){return new BPromise(function(_0x927fc0,_0x53e1a5){return client[_0x92b9('0xa')](_0x61f37e,_0x4267b2)[_0x92b9('0xb')](function(_0x31f8bb){logger[_0x92b9('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1b1000,_0x92b9('0xd'));logger[_0x92b9('0xe')](_0x92b9('0xf'),_0x1b1000,_0x92b9('0xd'),JSON[_0x92b9('0x10')](_0x31f8bb));if(_0x31f8bb[_0x92b9('0x11')]){if(_0x31f8bb[_0x92b9('0x11')][_0x92b9('0x12')]===0x1f4){logger[_0x92b9('0x11')](_0x92b9('0x13'),_0x1b1000,_0x31f8bb[_0x92b9('0x11')][_0x92b9('0x14')]);return _0x53e1a5(_0x31f8bb[_0x92b9('0x11')][_0x92b9('0x14')]);}logger[_0x92b9('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1b1000,_0x31f8bb[_0x92b9('0x11')][_0x92b9('0x14')]);return _0x927fc0(_0x31f8bb['error']['message']);}else{logger[_0x92b9('0xc')](_0x92b9('0x13'),_0x1b1000,_0x92b9('0xd'));_0x927fc0(_0x31f8bb[_0x92b9('0x15')][_0x92b9('0x14')]);}})[_0x92b9('0x16')](function(_0x491168){logger['error'](_0x92b9('0x13'),_0x1b1000,_0x491168);_0x53e1a5(_0x491168);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a44357e..0c9871b 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 _0xef36=['express','Router','./pause.controller','isAuthenticated','index','get','/:id','post','create','put','update','multer','util','connect-timeout'];(function(_0xd79011,_0x1bb245){var _0xe68fb=function(_0x1f24ad){while(--_0x1f24ad){_0xd79011['push'](_0xd79011['shift']());}};_0xe68fb(++_0x1bb245);}(_0xef36,0x193));var _0x6ef3=function(_0x1800d4,_0x29328c){_0x1800d4=_0x1800d4-0x0;var _0x3a881e=_0xef36[_0x1800d4];return _0x3a881e;};'use strict';var multer=require(_0x6ef3('0x0'));var util=require(_0x6ef3('0x1'));var path=require('path');var timeout=require(_0x6ef3('0x2'));var express=require(_0x6ef3('0x3'));var router=express[_0x6ef3('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6ef3('0x5'));router['get']('/',auth[_0x6ef3('0x6')](),controller[_0x6ef3('0x7')]);router[_0x6ef3('0x8')](_0x6ef3('0x9'),auth[_0x6ef3('0x6')](),controller['show']);router[_0x6ef3('0xa')]('/',auth[_0x6ef3('0x6')](),controller[_0x6ef3('0xb')]);router[_0x6ef3('0xc')](_0x6ef3('0x9'),auth[_0x6ef3('0x6')](),controller[_0x6ef3('0xd')]);router['delete'](_0x6ef3('0x9'),auth[_0x6ef3('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4268=['./pause.controller','get','isAuthenticated','/:id','show','create','put','update','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7a3bfe,_0x41fc9e){var _0x3829e4=function(_0x39685c){while(--_0x39685c){_0x7a3bfe['push'](_0x7a3bfe['shift']());}};_0x3829e4(++_0x41fc9e);}(_0x4268,0xf7));var _0x8426=function(_0x45e02b,_0x1d3448){_0x45e02b=_0x45e02b-0x0;var _0x3746ea=_0x4268[_0x45e02b];return _0x3746ea;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8426('0x0'));var express=require('express');var router=express[_0x8426('0x1')]();var auth=require(_0x8426('0x2'));var interaction=require(_0x8426('0x3'));var config=require(_0x8426('0x4'));var controller=require(_0x8426('0x5'));router[_0x8426('0x6')]('/',auth[_0x8426('0x7')](),controller['index']);router[_0x8426('0x6')](_0x8426('0x8'),auth['isAuthenticated'](),controller[_0x8426('0x9')]);router['post']('/',auth[_0x8426('0x7')](),controller[_0x8426('0xa')]);router[_0x8426('0xb')](_0x8426('0x8'),auth[_0x8426('0x7')](),controller[_0x8426('0xc')]);router['delete'](_0x8426('0x8'),auth[_0x8426('0x7')](),controller['destroy']);module[_0x8426('0xd')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 414f606..5ed407b 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 _0xe663=['name','sequelize','exports','STRING'];(function(_0x31e804,_0x254a20){var _0x543a83=function(_0x177699){while(--_0x177699){_0x31e804['push'](_0x31e804['shift']());}};_0x543a83(++_0x254a20);}(_0xe663,0x1c1));var _0x3e66=function(_0x399de1,_0x1f7013){_0x399de1=_0x399de1-0x0;var _0x3bc906=_0xe663[_0x399de1];return _0x3bc906;};'use strict';var Sequelize=require(_0x3e66('0x0'));module[_0x3e66('0x1')]={'name':{'type':Sequelize[_0x3e66('0x2')],'unique':_0x3e66('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3e66('0x2')]}}; \ No newline at end of file +var _0xff96=['name','sequelize','exports','STRING'];(function(_0x4ae5b9,_0x4a42d2){var _0x3f94f4=function(_0x324f87){while(--_0x324f87){_0x4ae5b9['push'](_0x4ae5b9['shift']());}};_0x3f94f4(++_0x4a42d2);}(_0xff96,0x179));var _0x6ff9=function(_0x2e30d8,_0x344b2c){_0x2e30d8=_0x2e30d8-0x0;var _0x347234=_0xff96[_0x2e30d8];return _0x347234;};'use strict';var Sequelize=require(_0x6ff9('0x0'));module[_0x6ff9('0x1')]={'name':{'type':Sequelize[_0x6ff9('0x2')],'unique':_0x6ff9('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6ff9('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index cf24440..a986032 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 _0x217b=['find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','crypto','jsforce','to-csv','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','destroy','then','Pauses','UserProfileResource','end','error','stack','name','send','index','map','Pause','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','params','include','options'];(function(_0x22f40a,_0x3f0dc9){var _0x410e24=function(_0x31940a){while(--_0x31940a){_0x22f40a['push'](_0x22f40a['shift']());}};_0x410e24(++_0x3f0dc9);}(_0x217b,0x194));var _0xb217=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x217b[_0x1deb03];return _0x189fe7;};'use strict';var pdf=require(_0xb217('0x0'));var emlformat=require(_0xb217('0x1'));var rimraf=require(_0xb217('0x2'));var zipdir=require(_0xb217('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb217('0x4'));var moment=require(_0xb217('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb217('0x6'));var util=require(_0xb217('0x7'));var path=require(_0xb217('0x8'));var sox=require(_0xb217('0x9'));var csv=require('to-csv');var ejs=require(_0xb217('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb217('0xb'));var jsforce=require(_0xb217('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb217('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb217('0xe'));var authService=require(_0xb217('0xf'));var qs=require(_0xb217('0x10'));var as=require(_0xb217('0x11'));var hardwareService=require(_0xb217('0x12'));var logger=require(_0xb217('0x13'))(_0xb217('0x14'));var utils=require('../../config/utils');var config=require(_0xb217('0x15'));var db=require(_0xb217('0x16'))['db'];function respondWithStatusCode(_0x23129c,_0x3bf075){_0x3bf075=_0x3bf075||0xcc;return function(_0x4f60c0){if(_0x4f60c0){return _0x23129c[_0xb217('0x17')](_0x3bf075);}return _0x23129c[_0xb217('0x18')](_0x3bf075)['end']();};}function respondWithResult(_0x2ef88e,_0x263f6b){_0x263f6b=_0x263f6b||0xc8;return function(_0x5c8c31){if(_0x5c8c31){return _0x2ef88e[_0xb217('0x18')](_0x263f6b)[_0xb217('0x19')](_0x5c8c31);}};}function respondWithFilteredResult(_0x9b0815,_0x26dd8e){return function(_0xb08052){if(_0xb08052){var _0x89bd2e=_0xb08052[_0xb217('0x1a')],_0x54fad3=_0x26dd8e[_0xb217('0x1b')],_0x53b759=_0x26dd8e[_0xb217('0x1b')]+_0x26dd8e[_0xb217('0x1c')],_0x3574e0;if(_0x53b759>=_0x89bd2e){_0x53b759=_0x89bd2e;_0x3574e0=0xc8;}else{_0x3574e0=0xce;}_0x9b0815[_0xb217('0x18')](_0x3574e0);return _0x9b0815[_0xb217('0x1d')](_0xb217('0x1e'),_0x54fad3+'-'+_0x53b759+'/'+_0x89bd2e)['json'](_0xb08052);}return null;};}function patchUpdates(_0x4e120e){return function(_0x321861){try{jsonpatch[_0xb217('0x1f')](_0x321861,_0x4e120e,!![]);}catch(_0xd683a0){return BPromise[_0xb217('0x20')](_0xd683a0);}return _0x321861[_0xb217('0x21')]();};}function saveUpdates(_0x2ccb83,_0x6a8d22){return function(_0x2f87e6){if(_0x2f87e6){return _0x2f87e6['update'](_0x2ccb83)['then'](function(_0x17b4ab){return _0x17b4ab;});}return null;};}function removeEntity(_0x350630,_0x5da3af){return function(_0x3e938c){if(_0x3e938c){return _0x3e938c[_0xb217('0x22')]()[_0xb217('0x23')](function(){var _0x24760c=_0x3e938c['get']({'plain':!![]});var _0x27a1cf=_0xb217('0x24');return db[_0xb217('0x25')]['destroy']({'where':{'type':_0x27a1cf,'resourceId':_0x24760c['id']}})['then'](function(){return _0x3e938c;});})[_0xb217('0x23')](function(){_0x350630[_0xb217('0x18')](0xcc)[_0xb217('0x26')]();});}};}function handleEntityNotFound(_0xcb1cb5,_0x12ab56){return function(_0x3e2758){if(!_0x3e2758){_0xcb1cb5['sendStatus'](0x194);}return _0x3e2758;};}function handleError(_0x4ee042,_0x4674ac){_0x4674ac=_0x4674ac||0x1f4;return function(_0x12cfeb){logger[_0xb217('0x27')](_0x12cfeb[_0xb217('0x28')]);if(_0x12cfeb[_0xb217('0x29')]){delete _0x12cfeb[_0xb217('0x29')];}_0x4ee042[_0xb217('0x18')](_0x4674ac)[_0xb217('0x2a')](_0x12cfeb);};}exports[_0xb217('0x2b')]=function(_0x3203bb,_0x196623){var _0x853fcc={},_0x30ceb5={},_0x84c573={'count':0x0,'rows':[]};var _0x3ad7c2=_[_0xb217('0x2c')](db[_0xb217('0x2d')][_0xb217('0x2e')],function(_0x162a66){return{'name':_0x162a66['fieldName'],'type':_0x162a66[_0xb217('0x2f')][_0xb217('0x30')]};});_0x30ceb5[_0xb217('0x31')]=_[_0xb217('0x2c')](_0x3ad7c2,_0xb217('0x29'));_0x30ceb5[_0xb217('0x32')]=_[_0xb217('0x33')](_0x3203bb['query']);_0x30ceb5[_0xb217('0x34')]=_[_0xb217('0x35')](_0x30ceb5['model'],_0x30ceb5[_0xb217('0x32')]);_0x853fcc[_0xb217('0x36')]=_[_0xb217('0x35')](_0x30ceb5[_0xb217('0x31')],qs[_0xb217('0x37')](_0x3203bb[_0xb217('0x32')][_0xb217('0x37')]));_0x853fcc[_0xb217('0x36')]=_0x853fcc[_0xb217('0x36')][_0xb217('0x38')]?_0x853fcc['attributes']:_0x30ceb5[_0xb217('0x31')];if(!_0x3203bb[_0xb217('0x32')]['hasOwnProperty']('nolimit')){_0x853fcc['limit']=qs[_0xb217('0x1c')](_0x3203bb[_0xb217('0x32')][_0xb217('0x1c')]);_0x853fcc[_0xb217('0x1b')]=qs[_0xb217('0x1b')](_0x3203bb[_0xb217('0x32')][_0xb217('0x1b')]);}_0x853fcc[_0xb217('0x39')]=qs[_0xb217('0x3a')](_0x3203bb[_0xb217('0x32')][_0xb217('0x3a')]);_0x853fcc['where']=qs[_0xb217('0x34')](_['pick'](_0x3203bb['query'],_0x30ceb5[_0xb217('0x34')]),_0x3ad7c2);if(_0x3203bb['query'][_0xb217('0x3b')]){_0x853fcc[_0xb217('0x3c')]=_['merge'](_0x853fcc['where'],{'$or':_['map'](_0x3ad7c2,function(_0x4b6b59){if(_0x4b6b59['type']!==_0xb217('0x3d')){var _0x5ccc28={};_0x5ccc28[_0x4b6b59[_0xb217('0x29')]]={'$like':'%'+_0x3203bb['query'][_0xb217('0x3b')]+'%'};return _0x5ccc28;}})});}_0x853fcc=_[_0xb217('0x3e')]({},_0x853fcc,_0x3203bb['options']);var _0x4d413b={'where':_0x853fcc[_0xb217('0x3c')]};return db[_0xb217('0x2d')][_0xb217('0x1a')](_0x4d413b)[_0xb217('0x23')](function(_0x1d2a66){_0x84c573[_0xb217('0x1a')]=_0x1d2a66;if(_0x3203bb[_0xb217('0x32')][_0xb217('0x3f')]){_0x853fcc['include']=[{'all':!![]}];}return db['Pause'][_0xb217('0x40')](_0x853fcc);})[_0xb217('0x23')](function(_0x8702bc){_0x84c573[_0xb217('0x41')]=_0x8702bc;return _0x84c573;})[_0xb217('0x23')](respondWithFilteredResult(_0x196623,_0x853fcc))[_0xb217('0x42')](handleError(_0x196623,null));};exports['show']=function(_0x51872f,_0x4ce050){var _0x140f40={'raw':!![],'where':{'id':_0x51872f[_0xb217('0x43')]['id']}},_0x536cbf={};_0x536cbf[_0xb217('0x31')]=_['keys'](db[_0xb217('0x2d')][_0xb217('0x2e')]);_0x536cbf[_0xb217('0x32')]=_[_0xb217('0x33')](_0x51872f[_0xb217('0x32')]);_0x536cbf[_0xb217('0x34')]=_[_0xb217('0x35')](_0x536cbf[_0xb217('0x31')],_0x536cbf[_0xb217('0x32')]);_0x140f40[_0xb217('0x36')]=_[_0xb217('0x35')](_0x536cbf[_0xb217('0x31')],qs[_0xb217('0x37')](_0x51872f[_0xb217('0x32')][_0xb217('0x37')]));_0x140f40[_0xb217('0x36')]=_0x140f40[_0xb217('0x36')]['length']?_0x140f40[_0xb217('0x36')]:_0x536cbf[_0xb217('0x31')];if(_0x51872f[_0xb217('0x32')][_0xb217('0x3f')]){_0x140f40[_0xb217('0x44')]=[{'all':!![]}];}_0x140f40=_['merge']({},_0x140f40,_0x51872f[_0xb217('0x45')]);return db[_0xb217('0x2d')][_0xb217('0x46')](_0x140f40)[_0xb217('0x23')](handleEntityNotFound(_0x4ce050,null))[_0xb217('0x23')](respondWithResult(_0x4ce050,null))[_0xb217('0x42')](handleError(_0x4ce050,null));};exports[_0xb217('0x47')]=function(_0x383a63,_0x556be7){return db['Pause'][_0xb217('0x47')](_0x383a63[_0xb217('0x48')],{})['then'](function(_0x865bd7){var _0x4fe8e2=_0x383a63[_0xb217('0x49')][_0xb217('0x4a')]({'plain':!![]});if(!_0x4fe8e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fe8e2['role']===_0xb217('0x49')){var _0x338b20=_0x865bd7[_0xb217('0x4a')]({'plain':!![]});var _0xe0d1f3=_0xb217('0x24');return db[_0xb217('0x4b')][_0xb217('0x46')]({'where':{'name':_0xe0d1f3,'userProfileId':_0x4fe8e2[_0xb217('0x4c')]},'raw':!![]})[_0xb217('0x23')](function(_0x376da0){if(_0x376da0&&_0x376da0[_0xb217('0x4d')]===0x0){return db[_0xb217('0x25')]['create']({'name':_0x338b20[_0xb217('0x29')],'resourceId':_0x338b20['id'],'type':_0x376da0['name'],'sectionId':_0x376da0['id']},{})[_0xb217('0x23')](function(){return _0x865bd7;});}else{return _0x865bd7;}})[_0xb217('0x42')](function(_0x509331){logger[_0xb217('0x27')](_0xb217('0x4e'),_0x509331);throw _0x509331;});}return _0x865bd7;})[_0xb217('0x23')](respondWithResult(_0x556be7,0xc9))[_0xb217('0x42')](handleError(_0x556be7,null));};exports['update']=function(_0x3bdb2e,_0x3c893e){if(_0x3bdb2e[_0xb217('0x48')]['id']){delete _0x3bdb2e[_0xb217('0x48')]['id'];}return db[_0xb217('0x2d')][_0xb217('0x46')]({'where':{'id':_0x3bdb2e['params']['id']}})[_0xb217('0x23')](handleEntityNotFound(_0x3c893e,null))['then'](saveUpdates(_0x3bdb2e[_0xb217('0x48')],null))[_0xb217('0x23')](respondWithResult(_0x3c893e,null))[_0xb217('0x42')](handleError(_0x3c893e,null));};exports['destroy']=function(_0x2ccb70,_0x4c5525){return db['Pause'][_0xb217('0x46')]({'where':{'id':_0x2ccb70[_0xb217('0x43')]['id']}})[_0xb217('0x23')](handleEntityNotFound(_0x4c5525,null))['then'](removeEntity(_0x4c5525,null))['catch'](handleError(_0x4c5525,null));}; \ No newline at end of file +var _0x4139=['save','update','then','get','Pauses','UserProfileResource','destroy','error','name','send','index','map','Pause','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','status','json','apply','reject'];(function(_0xefca7,_0x526dd5){var _0x58568b=function(_0x27a0a8){while(--_0x27a0a8){_0xefca7['push'](_0xefca7['shift']());}};_0x58568b(++_0x526dd5);}(_0x4139,0x84));var _0x9413=function(_0x59fa4d,_0x4c9ed4){_0x59fa4d=_0x59fa4d-0x0;var _0x190985=_0x4139[_0x59fa4d];return _0x190985;};'use strict';var pdf=require(_0x9413('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9413('0x1'));var zipdir=require(_0x9413('0x2'));var jsonpatch=require(_0x9413('0x3'));var rp=require('request-promise');var moment=require(_0x9413('0x4'));var BPromise=require(_0x9413('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9413('0x6'));var sox=require(_0x9413('0x7'));var csv=require(_0x9413('0x8'));var ejs=require(_0x9413('0x9'));var fs=require('fs');var _=require(_0x9413('0xa'));var squel=require('squel');var crypto=require(_0x9413('0xb'));var jsforce=require(_0x9413('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9413('0xd'));var Papa=require(_0x9413('0xe'));var Redis=require(_0x9413('0xf'));var authService=require(_0x9413('0x10'));var qs=require(_0x9413('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9413('0x12'))(_0x9413('0x13'));var utils=require(_0x9413('0x14'));var config=require(_0x9413('0x15'));var db=require(_0x9413('0x16'))['db'];function respondWithStatusCode(_0x2c5557,_0x54605e){_0x54605e=_0x54605e||0xcc;return function(_0xaf85f7){if(_0xaf85f7){return _0x2c5557[_0x9413('0x17')](_0x54605e);}return _0x2c5557['status'](_0x54605e)[_0x9413('0x18')]();};}function respondWithResult(_0x4537b6,_0x4edb4f){_0x4edb4f=_0x4edb4f||0xc8;return function(_0x4fc8b7){if(_0x4fc8b7){return _0x4537b6['status'](_0x4edb4f)['json'](_0x4fc8b7);}};}function respondWithFilteredResult(_0x1065fe,_0x2c7c8b){return function(_0x23f5d9){if(_0x23f5d9){var _0x298826=_0x23f5d9[_0x9413('0x19')],_0x3c7911=_0x2c7c8b[_0x9413('0x1a')],_0x95d32f=_0x2c7c8b['offset']+_0x2c7c8b[_0x9413('0x1b')],_0x53c8ec;if(_0x95d32f>=_0x298826){_0x95d32f=_0x298826;_0x53c8ec=0xc8;}else{_0x53c8ec=0xce;}_0x1065fe[_0x9413('0x1c')](_0x53c8ec);return _0x1065fe['set']('Content-Range',_0x3c7911+'-'+_0x95d32f+'/'+_0x298826)[_0x9413('0x1d')](_0x23f5d9);}return null;};}function patchUpdates(_0x156d7f){return function(_0x23559d){try{jsonpatch[_0x9413('0x1e')](_0x23559d,_0x156d7f,!![]);}catch(_0x278a23){return BPromise[_0x9413('0x1f')](_0x278a23);}return _0x23559d[_0x9413('0x20')]();};}function saveUpdates(_0x3e6ceb,_0x32b7fe){return function(_0xfe7ed){if(_0xfe7ed){return _0xfe7ed[_0x9413('0x21')](_0x3e6ceb)[_0x9413('0x22')](function(_0x3b043a){return _0x3b043a;});}return null;};}function removeEntity(_0x4456eb,_0x8a91c6){return function(_0x395453){if(_0x395453){return _0x395453['destroy']()['then'](function(){var _0x4ee026=_0x395453[_0x9413('0x23')]({'plain':!![]});var _0x393007=_0x9413('0x24');return db[_0x9413('0x25')][_0x9413('0x26')]({'where':{'type':_0x393007,'resourceId':_0x4ee026['id']}})[_0x9413('0x22')](function(){return _0x395453;});})['then'](function(){_0x4456eb[_0x9413('0x1c')](0xcc)[_0x9413('0x18')]();});}};}function handleEntityNotFound(_0x317d41,_0x2a23){return function(_0x4336c3){if(!_0x4336c3){_0x317d41['sendStatus'](0x194);}return _0x4336c3;};}function handleError(_0x415253,_0x5f53b9){_0x5f53b9=_0x5f53b9||0x1f4;return function(_0x655bec){logger[_0x9413('0x27')](_0x655bec['stack']);if(_0x655bec[_0x9413('0x28')]){delete _0x655bec[_0x9413('0x28')];}_0x415253[_0x9413('0x1c')](_0x5f53b9)[_0x9413('0x29')](_0x655bec);};}exports[_0x9413('0x2a')]=function(_0x33e254,_0x5c9715){var _0x56a027={},_0x26666e={},_0x2eb58d={'count':0x0,'rows':[]};var _0x3f2c54=_[_0x9413('0x2b')](db[_0x9413('0x2c')]['rawAttributes'],function(_0xf78cb6){return{'name':_0xf78cb6[_0x9413('0x2d')],'type':_0xf78cb6[_0x9413('0x2e')][_0x9413('0x2f')]};});_0x26666e[_0x9413('0x30')]=_[_0x9413('0x2b')](_0x3f2c54,_0x9413('0x28'));_0x26666e['query']=_[_0x9413('0x31')](_0x33e254[_0x9413('0x32')]);_0x26666e[_0x9413('0x33')]=_[_0x9413('0x34')](_0x26666e['model'],_0x26666e[_0x9413('0x32')]);_0x56a027[_0x9413('0x35')]=_[_0x9413('0x34')](_0x26666e['model'],qs[_0x9413('0x36')](_0x33e254[_0x9413('0x32')]['fields']));_0x56a027[_0x9413('0x35')]=_0x56a027['attributes'][_0x9413('0x37')]?_0x56a027[_0x9413('0x35')]:_0x26666e[_0x9413('0x30')];if(!_0x33e254[_0x9413('0x32')][_0x9413('0x38')](_0x9413('0x39'))){_0x56a027[_0x9413('0x1b')]=qs[_0x9413('0x1b')](_0x33e254[_0x9413('0x32')][_0x9413('0x1b')]);_0x56a027[_0x9413('0x1a')]=qs[_0x9413('0x1a')](_0x33e254[_0x9413('0x32')][_0x9413('0x1a')]);}_0x56a027[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x33e254['query'][_0x9413('0x3b')]);_0x56a027['where']=qs[_0x9413('0x33')](_[_0x9413('0x3c')](_0x33e254['query'],_0x26666e[_0x9413('0x33')]),_0x3f2c54);if(_0x33e254[_0x9413('0x32')][_0x9413('0x3d')]){_0x56a027[_0x9413('0x3e')]=_[_0x9413('0x3f')](_0x56a027[_0x9413('0x3e')],{'$or':_[_0x9413('0x2b')](_0x3f2c54,function(_0x40ac57){if(_0x40ac57['type']!=='VIRTUAL'){var _0xaf7a7c={};_0xaf7a7c[_0x40ac57['name']]={'$like':'%'+_0x33e254[_0x9413('0x32')]['filter']+'%'};return _0xaf7a7c;}})});}_0x56a027=_[_0x9413('0x3f')]({},_0x56a027,_0x33e254[_0x9413('0x40')]);var _0x18e89a={'where':_0x56a027[_0x9413('0x3e')]};return db[_0x9413('0x2c')][_0x9413('0x19')](_0x18e89a)[_0x9413('0x22')](function(_0x4575ba){_0x2eb58d[_0x9413('0x19')]=_0x4575ba;if(_0x33e254['query'][_0x9413('0x41')]){_0x56a027[_0x9413('0x42')]=[{'all':!![]}];}return db['Pause'][_0x9413('0x43')](_0x56a027);})[_0x9413('0x22')](function(_0x3c40f0){_0x2eb58d[_0x9413('0x44')]=_0x3c40f0;return _0x2eb58d;})[_0x9413('0x22')](respondWithFilteredResult(_0x5c9715,_0x56a027))[_0x9413('0x45')](handleError(_0x5c9715,null));};exports[_0x9413('0x46')]=function(_0x52f355,_0x120ee0){var _0x415d36={'raw':!![],'where':{'id':_0x52f355['params']['id']}},_0x497db5={};_0x497db5[_0x9413('0x30')]=_[_0x9413('0x31')](db[_0x9413('0x2c')][_0x9413('0x47')]);_0x497db5['query']=_[_0x9413('0x31')](_0x52f355[_0x9413('0x32')]);_0x497db5[_0x9413('0x33')]=_[_0x9413('0x34')](_0x497db5[_0x9413('0x30')],_0x497db5[_0x9413('0x32')]);_0x415d36['attributes']=_[_0x9413('0x34')](_0x497db5['model'],qs[_0x9413('0x36')](_0x52f355[_0x9413('0x32')][_0x9413('0x36')]));_0x415d36[_0x9413('0x35')]=_0x415d36[_0x9413('0x35')][_0x9413('0x37')]?_0x415d36[_0x9413('0x35')]:_0x497db5[_0x9413('0x30')];if(_0x52f355['query']['includeAll']){_0x415d36['include']=[{'all':!![]}];}_0x415d36=_[_0x9413('0x3f')]({},_0x415d36,_0x52f355[_0x9413('0x40')]);return db[_0x9413('0x2c')][_0x9413('0x48')](_0x415d36)[_0x9413('0x22')](handleEntityNotFound(_0x120ee0,null))[_0x9413('0x22')](respondWithResult(_0x120ee0,null))[_0x9413('0x45')](handleError(_0x120ee0,null));};exports[_0x9413('0x49')]=function(_0x218c1c,_0x4a5ed6){return db[_0x9413('0x2c')][_0x9413('0x49')](_0x218c1c[_0x9413('0x4a')],{})['then'](function(_0x545ee0){var _0x575025=_0x218c1c[_0x9413('0x4b')][_0x9413('0x23')]({'plain':!![]});if(!_0x575025)throw new Error(_0x9413('0x4c'));if(_0x575025[_0x9413('0x4d')]===_0x9413('0x4b')){var _0xaf68ec=_0x545ee0[_0x9413('0x23')]({'plain':!![]});var _0x4305c9=_0x9413('0x24');return db[_0x9413('0x4e')]['find']({'where':{'name':_0x4305c9,'userProfileId':_0x575025['userProfileId']},'raw':!![]})[_0x9413('0x22')](function(_0x572677){if(_0x572677&&_0x572677[_0x9413('0x4f')]===0x0){return db[_0x9413('0x25')][_0x9413('0x49')]({'name':_0xaf68ec['name'],'resourceId':_0xaf68ec['id'],'type':_0x572677[_0x9413('0x28')],'sectionId':_0x572677['id']},{})['then'](function(){return _0x545ee0;});}else{return _0x545ee0;}})[_0x9413('0x45')](function(_0x198d5b){logger[_0x9413('0x27')](_0x9413('0x50'),_0x198d5b);throw _0x198d5b;});}return _0x545ee0;})['then'](respondWithResult(_0x4a5ed6,0xc9))[_0x9413('0x45')](handleError(_0x4a5ed6,null));};exports[_0x9413('0x21')]=function(_0x5b86f0,_0x3fa03a){if(_0x5b86f0[_0x9413('0x4a')]['id']){delete _0x5b86f0[_0x9413('0x4a')]['id'];}return db[_0x9413('0x2c')]['find']({'where':{'id':_0x5b86f0['params']['id']}})[_0x9413('0x22')](handleEntityNotFound(_0x3fa03a,null))['then'](saveUpdates(_0x5b86f0['body'],null))['then'](respondWithResult(_0x3fa03a,null))[_0x9413('0x45')](handleError(_0x3fa03a,null));};exports[_0x9413('0x26')]=function(_0xd1ca2f,_0x57aa50){return db[_0x9413('0x2c')][_0x9413('0x48')]({'where':{'id':_0xd1ca2f[_0x9413('0x51')]['id']}})[_0x9413('0x22')](handleEntityNotFound(_0x57aa50,null))[_0x9413('0x22')](removeEntity(_0x57aa50,null))['catch'](handleError(_0x57aa50,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 8a1888c..32827c0 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 _0x8acb=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','Pause','tools_pauses'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8acb,0x1b8));var _0xb8ac=function(_0x13af8a,_0xfb498c){_0x13af8a=_0x13af8a-0x0;var _0x5831a2=_0x8acb[_0x13af8a];return _0x5831a2;};'use strict';var _=require(_0xb8ac('0x0'));var util=require('util');var logger=require(_0xb8ac('0x1'))(_0xb8ac('0x2'));var moment=require(_0xb8ac('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8ac('0x4'));var fs=require('fs');var path=require(_0xb8ac('0x5'));var rimraf=require(_0xb8ac('0x6'));var config=require(_0xb8ac('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x389922,_0x3a191c){return _0x389922[_0xb8ac('0x8')](_0xb8ac('0x9'),attributes,{'tableName':_0xb8ac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93ba=['tools_pauses','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','Pause'];(function(_0x7c13ed,_0x4d9dd5){var _0x4cad66=function(_0x3db414){while(--_0x3db414){_0x7c13ed['push'](_0x7c13ed['shift']());}};_0x4cad66(++_0x4d9dd5);}(_0x93ba,0xbf));var _0xa93b=function(_0x2b380d,_0x33fb20){_0x2b380d=_0x2b380d-0x0;var _0x51298f=_0x93ba[_0x2b380d];return _0x51298f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa93b('0x0'))(_0xa93b('0x1'));var moment=require('moment');var BPromise=require(_0xa93b('0x2'));var rp=require(_0xa93b('0x3'));var fs=require('fs');var path=require(_0xa93b('0x4'));var rimraf=require(_0xa93b('0x5'));var config=require(_0xa93b('0x6'));var attributes=require(_0xa93b('0x7'));module['exports']=function(_0x26b80e,_0x204dc7){return _0x26b80e['define'](_0xa93b('0x8'),attributes,{'tableName':_0xa93b('0x9'),'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 c6f53f1..033b168 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 _0xc02d=['where','attributes','include','map','model','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowPause','Pause','find','options','raw'];(function(_0x2e49e8,_0x424ea3){var _0x12b2a5=function(_0xde8151){while(--_0xde8151){_0x2e49e8['push'](_0x2e49e8['shift']());}};_0x12b2a5(++_0x424ea3);}(_0xc02d,0x1aa));var _0xdc02=function(_0x3c04d7,_0x472801){_0x3c04d7=_0x3c04d7-0x0;var _0x2fb24=_0xc02d[_0x3c04d7];return _0x2fb24;};'use strict';var _=require('lodash');var util=require(_0xdc02('0x0'));var moment=require(_0xdc02('0x1'));var BPromise=require(_0xdc02('0x2'));var rs=require(_0xdc02('0x3'));var fs=require('fs');var Redis=require(_0xdc02('0x4'));var db=require(_0xdc02('0x5'))['db'];var utils=require(_0xdc02('0x6'));var logger=require(_0xdc02('0x7'))(_0xdc02('0x8'));var config=require(_0xdc02('0x9'));var jayson=require(_0xdc02('0xa'));var client=jayson['client'][_0xdc02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc472b,_0x30e0ad,_0x1560da){return new BPromise(function(_0x4a678f,_0x50a902){return client[_0xdc02('0xc')](_0xc472b,_0x1560da)[_0xdc02('0xd')](function(_0x1fed26){logger['info'](_0xdc02('0xe'),_0x30e0ad,'request\x20sent');logger[_0xdc02('0xf')](_0xdc02('0x10'),_0x30e0ad,_0xdc02('0x11'),JSON[_0xdc02('0x12')](_0x1fed26));if(_0x1fed26['error']){if(_0x1fed26[_0xdc02('0x13')][_0xdc02('0x14')]===0x1f4){logger[_0xdc02('0x13')](_0xdc02('0xe'),_0x30e0ad,_0x1fed26['error'][_0xdc02('0x15')]);return _0x50a902(_0x1fed26[_0xdc02('0x13')][_0xdc02('0x15')]);}logger['error'](_0xdc02('0xe'),_0x30e0ad,_0x1fed26['error'][_0xdc02('0x15')]);return _0x4a678f(_0x1fed26[_0xdc02('0x13')][_0xdc02('0x15')]);}else{logger['info'](_0xdc02('0xe'),_0x30e0ad,_0xdc02('0x11'));_0x4a678f(_0x1fed26[_0xdc02('0x16')]['message']);}})[_0xdc02('0x17')](function(_0x4d96ef){logger[_0xdc02('0x13')](_0xdc02('0xe'),_0x30e0ad,_0x4d96ef);_0x50a902(_0x4d96ef);});});}exports[_0xdc02('0x18')]=function(_0x26be9e){var _0x532a50=this;return new Promise(function(_0x4f731f,_0x88b0b2){return db[_0xdc02('0x19')][_0xdc02('0x1a')]({'raw':_0x26be9e[_0xdc02('0x1b')]?_0x26be9e[_0xdc02('0x1b')][_0xdc02('0x1c')]===undefined?!![]:![]:!![],'where':_0x26be9e[_0xdc02('0x1b')]?_0x26be9e[_0xdc02('0x1b')][_0xdc02('0x1d')]||null:null,'attributes':_0x26be9e[_0xdc02('0x1b')]?_0x26be9e[_0xdc02('0x1b')][_0xdc02('0x1e')]||null:null,'include':_0x26be9e['options']?_0x26be9e[_0xdc02('0x1b')][_0xdc02('0x1f')]?_[_0xdc02('0x20')](_0x26be9e['options'][_0xdc02('0x1f')],function(_0x86f55d){return{'model':db[_0x86f55d[_0xdc02('0x21')]],'as':_0x86f55d['as'],'attributes':_0x86f55d[_0xdc02('0x1e')],'include':_0x86f55d[_0xdc02('0x1f')]?_[_0xdc02('0x20')](_0x86f55d[_0xdc02('0x1f')],function(_0x513f02){return{'model':db[_0x513f02[_0xdc02('0x21')]],'as':_0x513f02['as'],'attributes':_0x513f02[_0xdc02('0x1e')],'include':_0x513f02[_0xdc02('0x1f')]?_[_0xdc02('0x20')](_0x513f02[_0xdc02('0x1f')],function(_0x523b8d){return{'model':db[_0x523b8d[_0xdc02('0x21')]],'as':_0x523b8d['as'],'attributes':_0x523b8d[_0xdc02('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ebcb2){logger[_0xdc02('0x22')](_0xdc02('0x18'),_0x26be9e);logger[_0xdc02('0xf')](_0xdc02('0x18'),_0x26be9e,JSON[_0xdc02('0x12')](_0x2ebcb2));_0x4f731f(_0x2ebcb2);})['catch'](function(_0x55dfb7){logger[_0xdc02('0x13')](_0xdc02('0x18'),_0x55dfb7['message'],_0x26be9e);_0x88b0b2(_0x532a50[_0xdc02('0x13')](0x1f4,_0x55dfb7[_0xdc02('0x15')]));});});}; \ No newline at end of file +var _0xb492=['ShowPause','Pause','options','raw','where','include','model','attributes','map','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x2deac4,_0xc27a2b){var _0x1c0bda=function(_0x1deceb){while(--_0x1deceb){_0x2deac4['push'](_0x2deac4['shift']());}};_0x1c0bda(++_0xc27a2b);}(_0xb492,0x172));var _0x2b49=function(_0x1bfec2,_0x11ebf3){_0x1bfec2=_0x1bfec2-0x0;var _0x4a5f78=_0xb492[_0x1bfec2];return _0x4a5f78;};'use strict';var _=require('lodash');var util=require(_0x2b49('0x0'));var moment=require(_0x2b49('0x1'));var BPromise=require(_0x2b49('0x2'));var rs=require(_0x2b49('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2b49('0x4'));var logger=require(_0x2b49('0x5'))(_0x2b49('0x6'));var config=require(_0x2b49('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2b49('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x363d21,_0x4b4d49,_0x2b745f){return new BPromise(function(_0x1b06c2,_0x349f69){return client[_0x2b49('0x9')](_0x363d21,_0x2b745f)[_0x2b49('0xa')](function(_0x597a3d){logger[_0x2b49('0xb')](_0x2b49('0xc'),_0x4b4d49,'request\x20sent');logger[_0x2b49('0xd')](_0x2b49('0xe'),_0x4b4d49,_0x2b49('0xf'),JSON['stringify'](_0x597a3d));if(_0x597a3d[_0x2b49('0x10')]){if(_0x597a3d[_0x2b49('0x10')][_0x2b49('0x11')]===0x1f4){logger[_0x2b49('0x10')](_0x2b49('0xc'),_0x4b4d49,_0x597a3d[_0x2b49('0x10')]['message']);return _0x349f69(_0x597a3d['error'][_0x2b49('0x12')]);}logger[_0x2b49('0x10')]('Pause,\x20%s,\x20%s',_0x4b4d49,_0x597a3d['error'][_0x2b49('0x12')]);return _0x1b06c2(_0x597a3d[_0x2b49('0x10')][_0x2b49('0x12')]);}else{logger['info'](_0x2b49('0xc'),_0x4b4d49,_0x2b49('0xf'));_0x1b06c2(_0x597a3d['result']['message']);}})[_0x2b49('0x13')](function(_0xa72527){logger[_0x2b49('0x10')](_0x2b49('0xc'),_0x4b4d49,_0xa72527);_0x349f69(_0xa72527);});});}exports[_0x2b49('0x14')]=function(_0x248de1){var _0xd51946=this;return new Promise(function(_0x25f0d8,_0x2034e5){return db[_0x2b49('0x15')]['find']({'raw':_0x248de1[_0x2b49('0x16')]?_0x248de1['options'][_0x2b49('0x17')]===undefined?!![]:![]:!![],'where':_0x248de1[_0x2b49('0x16')]?_0x248de1[_0x2b49('0x16')][_0x2b49('0x18')]||null:null,'attributes':_0x248de1[_0x2b49('0x16')]?_0x248de1[_0x2b49('0x16')]['attributes']||null:null,'include':_0x248de1[_0x2b49('0x16')]?_0x248de1[_0x2b49('0x16')][_0x2b49('0x19')]?_['map'](_0x248de1[_0x2b49('0x16')]['include'],function(_0x579d9e){return{'model':db[_0x579d9e[_0x2b49('0x1a')]],'as':_0x579d9e['as'],'attributes':_0x579d9e[_0x2b49('0x1b')],'include':_0x579d9e[_0x2b49('0x19')]?_[_0x2b49('0x1c')](_0x579d9e[_0x2b49('0x19')],function(_0x522591){return{'model':db[_0x522591[_0x2b49('0x1a')]],'as':_0x522591['as'],'attributes':_0x522591['attributes'],'include':_0x522591[_0x2b49('0x19')]?_[_0x2b49('0x1c')](_0x522591[_0x2b49('0x19')],function(_0x464754){return{'model':db[_0x464754['model']],'as':_0x464754['as'],'attributes':_0x464754[_0x2b49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2b49('0xa')](function(_0x1dee89){logger[_0x2b49('0xb')](_0x2b49('0x14'),_0x248de1);logger[_0x2b49('0xd')]('ShowPause',_0x248de1,JSON[_0x2b49('0x1d')](_0x1dee89));_0x25f0d8(_0x1dee89);})[_0x2b49('0x13')](function(_0x237233){logger[_0x2b49('0x10')](_0x2b49('0x14'),_0x237233[_0x2b49('0x12')],_0x248de1);_0x2034e5(_0xd51946[_0x2b49('0x10')](0x1f4,_0x237233[_0x2b49('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index e0bec55..f14fc01 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 _0x7c32=['isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','replace','format','extname','now','post','single','file','upload','webhookPost','put','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x7c32,0xd8));var _0x27c3=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7c32[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x27c3('0x0'));var util=require(_0x27c3('0x1'));var path=require(_0x27c3('0x2'));var timeout=require(_0x27c3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x27c3('0x4'));var interaction=require(_0x27c3('0x5'));var config=require(_0x27c3('0x6'));var controller=require('./plugin.controller');router[_0x27c3('0x7')]('/',auth[_0x27c3('0x8')](),controller[_0x27c3('0x9')]);router[_0x27c3('0x7')](_0x27c3('0xa'),controller[_0x27c3('0xb')]);router[_0x27c3('0x7')](_0x27c3('0xc'),auth[_0x27c3('0x8')](),controller[_0x27c3('0xd')]);router[_0x27c3('0x7')](_0x27c3('0xe'),auth[_0x27c3('0x8')](),controller[_0x27c3('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1f5e40,_0x39801b,_0x938a2c){_0x938a2c(null,path[_0x27c3('0x10')](config[_0x27c3('0x11')],_0x27c3('0x12')));},'filename':function(_0xeb94ef,_0x284b60,_0x38d8ad){_0x284b60['originalname']=_0x284b60[_0x27c3('0x13')][_0x27c3('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38d8ad(null,util[_0x27c3('0x15')]('%s-%s%s',path['basename'](_0x284b60['originalname'],path[_0x27c3('0x16')](_0x284b60['originalname'])),Date[_0x27c3('0x17')](),path[_0x27c3('0x16')](_0x284b60['originalname'])));}})});router[_0x27c3('0x18')]('/',upload[_0x27c3('0x19')](_0x27c3('0x1a')),controller[_0x27c3('0x1b')]);router[_0x27c3('0x18')](_0x27c3('0xa'),controller[_0x27c3('0x1c')]);router[_0x27c3('0x1d')](_0x27c3('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x27c3('0x1e')](_0x27c3('0xc'),auth[_0x27c3('0x8')](),controller[_0x27c3('0x1e')]);module[_0x27c3('0x1f')]=router; \ No newline at end of file +var _0xd7ca=['delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','file','upload','webhookPost','put','update'];(function(_0x5d0737,_0x5e0b7e){var _0xc15e1=function(_0xb50647){while(--_0xb50647){_0x5d0737['push'](_0x5d0737['shift']());}};_0xc15e1(++_0x5e0b7e);}(_0xd7ca,0x1d6));var _0xad7c=function(_0xe5397e,_0x88febf){_0xe5397e=_0xe5397e-0x0;var _0x959991=_0xd7ca[_0xe5397e];return _0x959991;};'use strict';var multer=require(_0xad7c('0x0'));var util=require(_0xad7c('0x1'));var path=require(_0xad7c('0x2'));var timeout=require(_0xad7c('0x3'));var express=require('express');var router=express[_0xad7c('0x4')]();var auth=require(_0xad7c('0x5'));var interaction=require(_0xad7c('0x6'));var config=require(_0xad7c('0x7'));var controller=require(_0xad7c('0x8'));router[_0xad7c('0x9')]('/',auth[_0xad7c('0xa')](),controller[_0xad7c('0xb')]);router[_0xad7c('0x9')](_0xad7c('0xc'),controller[_0xad7c('0xd')]);router[_0xad7c('0x9')](_0xad7c('0xe'),auth[_0xad7c('0xa')](),controller[_0xad7c('0xf')]);router['get'](_0xad7c('0x10'),auth['isAuthenticated'](),controller[_0xad7c('0x11')]);var upload=multer({'storage':multer[_0xad7c('0x12')]({'destination':function(_0x5a83e9,_0x25be56,_0x3be648){_0x3be648(null,path[_0xad7c('0x13')](config[_0xad7c('0x14')],_0xad7c('0x15')));},'filename':function(_0x4ba403,_0x11e17f,_0x5f338b){_0x11e17f[_0xad7c('0x16')]=_0x11e17f[_0xad7c('0x16')][_0xad7c('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5f338b(null,util[_0xad7c('0x18')](_0xad7c('0x19'),path['basename'](_0x11e17f[_0xad7c('0x16')],path[_0xad7c('0x1a')](_0x11e17f[_0xad7c('0x16')])),Date[_0xad7c('0x1b')](),path[_0xad7c('0x1a')](_0x11e17f[_0xad7c('0x16')])));}})});router[_0xad7c('0x1c')]('/',upload['single'](_0xad7c('0x1d')),controller[_0xad7c('0x1e')]);router[_0xad7c('0x1c')](_0xad7c('0xc'),controller[_0xad7c('0x1f')]);router[_0xad7c('0x20')](_0xad7c('0xe'),auth['isAuthenticated'](),controller[_0xad7c('0x21')]);router[_0xad7c('0x22')](_0xad7c('0xe'),auth[_0xad7c('0xa')](),controller[_0xad7c('0x22')]);module[_0xad7c('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 ef00734..d43c022 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 _0xd209=['sequelize','exports','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING'];(function(_0x497f85,_0x472835){var _0x5f107b=function(_0x185f02){while(--_0x185f02){_0x497f85['push'](_0x497f85['shift']());}};_0x5f107b(++_0x472835);}(_0xd209,0xb6));var _0x9d20=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xd209[_0xbe200f];return _0x192597;};'use strict';var Sequelize=require(_0x9d20('0x0'));module[_0x9d20('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9d20('0x2')](_0x9d20('0x3'),_0x9d20('0x4'))},'description':{'type':Sequelize[_0x9d20('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x9d20('0x6')},'active':{'type':Sequelize[_0x9d20('0x7')],'defaultValue':0x0,'comment':_0x9d20('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x9d20('0x9'),_0x9d20('0xa'),_0x9d20('0xb'),'never'),'defaultValue':_0x9d20('0xb'),'comment':_0x9d20('0xc')},'icon':{'type':Sequelize[_0x9d20('0xd')]},'adminUrl':{'type':Sequelize[_0x9d20('0xd')]},'agentUrl':{'type':Sequelize[_0x9d20('0xd')]},'scriptName':{'type':Sequelize[_0x9d20('0xd')]},'scriptPath':{'type':Sequelize[_0x9d20('0xd')]}}; \ No newline at end of file +var _0xa468=['script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','ENUM','html'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0xa468,0xef));var _0x8a46=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xa468[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8a46('0x0')]},'type':{'type':Sequelize[_0x8a46('0x1')](_0x8a46('0x2'),_0x8a46('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x8a46('0x4')]},'path':{'type':Sequelize[_0x8a46('0x0')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x8a46('0x5')],'defaultValue':0x0,'comment':_0x8a46('0x6')},'sidebar':{'type':Sequelize[_0x8a46('0x1')]('adminOnly',_0x8a46('0x7'),'always',_0x8a46('0x8')),'defaultValue':_0x8a46('0x9'),'comment':_0x8a46('0xa')},'icon':{'type':Sequelize[_0x8a46('0x0')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x8a46('0x0')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x8a46('0x0')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 7773cec..5c44cbe 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 _0xd783=['../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','options','include','findAll','rows','catch','params','length','includeAll','find','download','root','format','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','pipe','glob','**/*','server/files/plugins','basename','node_modules/**/*','join','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','undefined','type','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','headers','content-length','set','endsWith','statusCode','webhookPost','resolve','http://localhost:','content-type','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0x2dbb18,_0x41b2e1){var _0x312fc7=function(_0x50dacb){while(--_0x50dacb){_0x2dbb18['push'](_0x2dbb18['shift']());}};_0x312fc7(++_0x41b2e1);}(_0xd783,0x90));var _0x3d78=function(_0x1a61db,_0x3ad3af){_0x1a61db=_0x1a61db-0x0;var _0x5ac3bf=_0xd783[_0x1a61db];return _0x5ac3bf;};'use strict';var pdf=require(_0x3d78('0x0'));var emlformat=require(_0x3d78('0x1'));var rimraf=require(_0x3d78('0x2'));var zipdir=require(_0x3d78('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d78('0x4'));var moment=require(_0x3d78('0x5'));var BPromise=require(_0x3d78('0x6'));var Mustache=require(_0x3d78('0x7'));var util=require(_0x3d78('0x8'));var path=require(_0x3d78('0x9'));var sox=require(_0x3d78('0xa'));var csv=require(_0x3d78('0xb'));var ejs=require(_0x3d78('0xc'));var fs=require('fs');var _=require(_0x3d78('0xd'));var squel=require(_0x3d78('0xe'));var crypto=require('crypto');var jsforce=require(_0x3d78('0xf'));var deskjs=require(_0x3d78('0x10'));var toCsv=require(_0x3d78('0xb'));var querystring=require(_0x3d78('0x11'));var Papa=require('papaparse');var extract=require(_0x3d78('0x12'));var rimraf=require(_0x3d78('0x2'));var archiver=require(_0x3d78('0x13'));var Redis=require(_0x3d78('0x14'));var authService=require(_0x3d78('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d78('0x16'));var logger=require('../../config/logger')(_0x3d78('0x17'));var utils=require(_0x3d78('0x18'));var config=require('../../config/environment');var db=require(_0x3d78('0x19'))['db'];config[_0x3d78('0x1a')]=_[_0x3d78('0x1b')](config[_0x3d78('0x1a')],{'host':_0x3d78('0x1c'),'port':0x18eb});var socket=require(_0x3d78('0x1d'))(new Redis(config[_0x3d78('0x1a')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x5265b9,_0xfe520a){_0xfe520a=_0xfe520a||0xcc;return function(_0x2c90d4){if(_0x2c90d4){return _0x5265b9['sendStatus'](_0xfe520a);}return _0x5265b9[_0x3d78('0x1e')](_0xfe520a)[_0x3d78('0x1f')]();};}function respondWithResult(_0x58319b,_0x43eb89){_0x43eb89=_0x43eb89||0xc8;return function(_0xb60cc7){if(_0xb60cc7){return _0x58319b['status'](_0x43eb89)[_0x3d78('0x20')](_0xb60cc7);}};}function respondWithFilteredResult(_0x5520fd,_0x608ca7){return function(_0x558d48){if(_0x558d48){var _0xd72a80=_0x558d48[_0x3d78('0x21')],_0x30db98=_0x608ca7[_0x3d78('0x22')],_0xa0d1d6=_0x608ca7['offset']+_0x608ca7[_0x3d78('0x23')],_0x2a9d07;if(_0xa0d1d6>=_0xd72a80){_0xa0d1d6=_0xd72a80;_0x2a9d07=0xc8;}else{_0x2a9d07=0xce;}_0x5520fd[_0x3d78('0x1e')](_0x2a9d07);return _0x5520fd['set'](_0x3d78('0x24'),_0x30db98+'-'+_0xa0d1d6+'/'+_0xd72a80)[_0x3d78('0x20')](_0x558d48);}return null;};}function patchUpdates(_0x21e44f){return function(_0x2572f9){try{jsonpatch[_0x3d78('0x25')](_0x2572f9,_0x21e44f,!![]);}catch(_0x115e53){return BPromise[_0x3d78('0x26')](_0x115e53);}return _0x2572f9[_0x3d78('0x27')]();};}function saveUpdates(_0x5e10ed,_0x6397d7){return function(_0x544ba7){if(_0x544ba7){return _0x544ba7[_0x3d78('0x28')](_0x5e10ed)[_0x3d78('0x29')](function(_0x1a3517){return _0x1a3517;});}return null;};}function removeEntity(_0x40fed6,_0x3103a3){return function(_0x3e4fec){if(_0x3e4fec){return _0x3e4fec[_0x3d78('0x2a')]()[_0x3d78('0x29')](function(){var _0x1b39b6=_0x3e4fec[_0x3d78('0x2b')]({'plain':!![]});var _0x1b51c1='Plugins';return db[_0x3d78('0x2c')][_0x3d78('0x2a')]({'where':{'type':_0x1b51c1,'resourceId':_0x1b39b6['id']}})[_0x3d78('0x29')](function(){return _0x3e4fec;});})[_0x3d78('0x29')](function(){_0x40fed6[_0x3d78('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300175,_0x7d3476){return function(_0x6e8bdb){if(!_0x6e8bdb){_0x300175[_0x3d78('0x2d')](0x194);}return _0x6e8bdb;};}function handleError(_0x3464a1,_0x1f196c){_0x1f196c=_0x1f196c||0x1f4;return function(_0x3a9410){logger['error'](_0x3a9410[_0x3d78('0x2e')]);if(_0x3a9410['name']){delete _0x3a9410[_0x3d78('0x2f')];}_0x3464a1[_0x3d78('0x1e')](_0x1f196c)[_0x3d78('0x30')](_0x3a9410);};}exports['index']=function(_0x46ac49,_0x55a12a){var _0x1ec00f={},_0x347083={},_0x2e8bf0={'count':0x0,'rows':[]};var _0x5740a0=_[_0x3d78('0x31')](db[_0x3d78('0x32')][_0x3d78('0x33')],function(_0x1c9b32){return{'name':_0x1c9b32[_0x3d78('0x34')],'type':_0x1c9b32['type'][_0x3d78('0x35')]};});_0x347083[_0x3d78('0x36')]=_['map'](_0x5740a0,'name');_0x347083[_0x3d78('0x37')]=_[_0x3d78('0x38')](_0x46ac49[_0x3d78('0x37')]);_0x347083[_0x3d78('0x39')]=_[_0x3d78('0x3a')](_0x347083['model'],_0x347083['query']);_0x1ec00f['attributes']=_[_0x3d78('0x3a')](_0x347083[_0x3d78('0x36')],qs[_0x3d78('0x3b')](_0x46ac49[_0x3d78('0x37')][_0x3d78('0x3b')]));_0x1ec00f[_0x3d78('0x3c')]=_0x1ec00f[_0x3d78('0x3c')]['length']?_0x1ec00f['attributes']:_0x347083[_0x3d78('0x36')];if(!_0x46ac49['query'][_0x3d78('0x3d')]('nolimit')){_0x1ec00f[_0x3d78('0x23')]=qs[_0x3d78('0x23')](_0x46ac49['query'][_0x3d78('0x23')]);_0x1ec00f[_0x3d78('0x22')]=qs[_0x3d78('0x22')](_0x46ac49[_0x3d78('0x37')][_0x3d78('0x22')]);}_0x1ec00f['order']=qs[_0x3d78('0x3e')](_0x46ac49[_0x3d78('0x37')][_0x3d78('0x3e')]);_0x1ec00f[_0x3d78('0x3f')]=qs['filters'](_['pick'](_0x46ac49[_0x3d78('0x37')],_0x347083[_0x3d78('0x39')]),_0x5740a0);if(_0x46ac49[_0x3d78('0x37')][_0x3d78('0x40')]){_0x1ec00f[_0x3d78('0x3f')]=_['merge'](_0x1ec00f['where'],{'$or':_[_0x3d78('0x31')](_0x5740a0,function(_0x50f392){if(_0x50f392['type']!=='VIRTUAL'){var _0x5d55a0={};_0x5d55a0[_0x50f392['name']]={'$like':'%'+_0x46ac49[_0x3d78('0x37')][_0x3d78('0x40')]+'%'};return _0x5d55a0;}})});}_0x1ec00f=_[_0x3d78('0x41')]({},_0x1ec00f,_0x46ac49[_0x3d78('0x42')]);var _0x3d91b2={'where':_0x1ec00f[_0x3d78('0x3f')]};return db[_0x3d78('0x32')][_0x3d78('0x21')](_0x3d91b2)[_0x3d78('0x29')](function(_0x305d76){_0x2e8bf0[_0x3d78('0x21')]=_0x305d76;if(_0x46ac49[_0x3d78('0x37')]['includeAll']){_0x1ec00f[_0x3d78('0x43')]=[{'all':!![]}];}return db['Plugin'][_0x3d78('0x44')](_0x1ec00f);})[_0x3d78('0x29')](function(_0x3468c4){_0x2e8bf0[_0x3d78('0x45')]=_0x3468c4;return _0x2e8bf0;})[_0x3d78('0x29')](respondWithFilteredResult(_0x55a12a,_0x1ec00f))[_0x3d78('0x46')](handleError(_0x55a12a,null));};exports['show']=function(_0x4cc169,_0x1316cb){var _0x84fd95={'raw':!![],'where':{'id':_0x4cc169[_0x3d78('0x47')]['id']}},_0x53b94b={};_0x53b94b['model']=_['keys'](db[_0x3d78('0x32')]['rawAttributes']);_0x53b94b[_0x3d78('0x37')]=_[_0x3d78('0x38')](_0x4cc169[_0x3d78('0x37')]);_0x53b94b[_0x3d78('0x39')]=_[_0x3d78('0x3a')](_0x53b94b[_0x3d78('0x36')],_0x53b94b[_0x3d78('0x37')]);_0x84fd95['attributes']=_[_0x3d78('0x3a')](_0x53b94b[_0x3d78('0x36')],qs[_0x3d78('0x3b')](_0x4cc169[_0x3d78('0x37')]['fields']));_0x84fd95[_0x3d78('0x3c')]=_0x84fd95[_0x3d78('0x3c')][_0x3d78('0x48')]?_0x84fd95[_0x3d78('0x3c')]:_0x53b94b['model'];if(_0x4cc169[_0x3d78('0x37')][_0x3d78('0x49')]){_0x84fd95[_0x3d78('0x43')]=[{'all':!![]}];}_0x84fd95=_[_0x3d78('0x41')]({},_0x84fd95,_0x4cc169['options']);return db[_0x3d78('0x32')][_0x3d78('0x4a')](_0x84fd95)[_0x3d78('0x29')](handleEntityNotFound(_0x1316cb,null))['then'](respondWithResult(_0x1316cb,null))[_0x3d78('0x46')](handleError(_0x1316cb,null));};exports[_0x3d78('0x4b')]=function(_0x31d26b,_0x24b3b3,_0x23a9ff){return db[_0x3d78('0x32')]['find']({'where':{'id':_0x31d26b['params']['id']},'attributes':[_0x3d78('0x2f'),_0x3d78('0x9')],'raw':!![]})[_0x3d78('0x29')](handleEntityNotFound(_0x24b3b3,null))['then'](function(_0x373b61){if(_0x373b61){var _0x5ca720=path['join'](config[_0x3d78('0x4c')],'server/files/plugins',util[_0x3d78('0x4d')]('%s.zip',path['basename'](_0x373b61[_0x3d78('0x9')])));var _0x3b49eb=fs[_0x3d78('0x4e')](_0x5ca720);var _0x4498ca=archiver(_0x3d78('0x4f'),{'zlib':{'level':0x9}});_0x4498ca['on'](_0x3d78('0x50'),function(_0x386968){if(_0x386968[_0x3d78('0x51')]==='ENOENT'){logger['error'](_0x386968);}else{throw new db[(_0x3d78('0x52'))][(_0x3d78('0x53'))](_0x3d78('0x54'));}});_0x4498ca['on'](_0x3d78('0x55'),function(_0x694b1){throw new db[(_0x3d78('0x52'))][(_0x3d78('0x53'))](_0x3d78('0x54'));});_0x4498ca[_0x3d78('0x56')](_0x3b49eb);_0x4498ca[_0x3d78('0x57')](_0x3d78('0x58'),{'cwd':path['join'](config[_0x3d78('0x4c')],_0x3d78('0x59'),path['dirname'](_0x373b61[_0x3d78('0x9')])),'ignore':[path['join'](path[_0x3d78('0x5a')](_0x373b61[_0x3d78('0x9')]),_0x3d78('0x5b')),path[_0x3d78('0x5c')](path[_0x3d78('0x5a')](_0x373b61[_0x3d78('0x9')]),_0x3d78('0x5d'))],'nodir':!![]})[_0x3d78('0x5e')]();_0x3b49eb['on']('close',function(){if(!fs[_0x3d78('0x5f')](_0x5ca720)){throw new db[(_0x3d78('0x52'))][(_0x3d78('0x53'))](_0x3d78('0x60'));}return _0x24b3b3[_0x3d78('0x4b')](_0x5ca720,util[_0x3d78('0x4d')]('%s.zip',path[_0x3d78('0x5a')](_0x373b61[_0x3d78('0x9')])),function(_0x2449b1){if(_0x2449b1){throw new db[(_0x3d78('0x52'))][(_0x3d78('0x53'))](_0x3d78('0x61'));}fs[_0x3d78('0x62')](_0x5ca720);logger[_0x3d78('0x63')](_0x3d78('0x64'));logger[_0x3d78('0x63')](_0x3d78('0x65'));});});}return null;})[_0x3d78('0x46')](handleError(_0x24b3b3,null));};exports['upload']=function(_0x1eb382,_0x32918d,_0x35837d){var _0x48395a=path[_0x3d78('0x5a')](_0x1eb382['file']['filename'],path['extname'](_0x1eb382[_0x3d78('0x66')]['filename']));var _0x186e25=path[_0x3d78('0x5c')](config['root'],'server/files/plugins',_0x1eb382['file'][_0x3d78('0x67')]);var _0x17990e=path[_0x3d78('0x5c')](config[_0x3d78('0x4c')],'server/files/plugins',_0x48395a);logger[_0x3d78('0x63')]('Plugin\x20upload\x20filepath:\x20%s',_0x186e25);logger[_0x3d78('0x63')](_0x3d78('0x68'),_0x17990e);try{fs[_0x3d78('0x69')](_0x186e25,parseInt(_0x3d78('0x6a'),0x8));extract(_0x186e25,{'dir':_0x17990e},function(_0x50fd69){if(_0x50fd69){logger[_0x3d78('0x55')](_0x50fd69);handleError(_0x50fd69,!![]);};var _0x2fd7d8=fs[_0x3d78('0x6b')](_0x17990e);if(_0x2fd7d8[_0x3d78('0x48')]>0x1){removeReferences(_0x186e25,_0x17990e);logger[_0x3d78('0x55')](_0x3d78('0x6c'));return _0x35837d(new Error(_0x3d78('0x6c')));}var _0xad5e5c=fs[_0x3d78('0x6d')](path[_0x3d78('0x5c')](_0x17990e,_0x2fd7d8[0x0]));if(_0xad5e5c['isFile']()){removeReferences(_0x186e25,_0x17990e);logger[_0x3d78('0x55')](_0x3d78('0x6c'));return _0x35837d(new Error(_0x3d78('0x6c')));}if(_0xad5e5c[_0x3d78('0x6e')]()){var _0x263021=fs[_0x3d78('0x6b')](path[_0x3d78('0x5c')](_0x17990e,_0x2fd7d8[0x0]));if(_0x263021['length']===0x0){removeReferences(_0x186e25,_0x17990e);logger['error'](_0x3d78('0x6c'));return _0x35837d(new Error(_0x3d78('0x6c')));}var _0x30fa9e=_0x263021[_0x3d78('0x6f')](function(_0x3f13cd){return _0x3f13cd===_0x3d78('0x70');});if(!_0x30fa9e){return _0x35837d(new Error(_0x3d78('0x71')));}var _0x3c8f18=fs[_0x3d78('0x72')](path[_0x3d78('0x5c')](_0x17990e,_0x2fd7d8[0x0],_0x3d78('0x70')));var _0x290089=JSON['parse'](_0x3c8f18);if('undefined'==typeof _0x290089[_0x3d78('0x2f')]){return _0x35837d(new Error(_0x3d78('0x73')));}if(_0x3d78('0x74')==typeof _0x290089[_0x3d78('0x75')]){return _0x35837d(new Error(_0x3d78('0x76')));}if(_0x3d78('0x74')==typeof _0x290089[_0x3d78('0x77')]){return _0x35837d(new Error(_0x3d78('0x78')));}if(_0x3d78('0x74')==typeof _0x290089[_0x3d78('0x79')]){return _0x35837d(new Error(_0x3d78('0x7a')));}if(_0x290089['type']===_0x3d78('0x7b')){if(_0x3d78('0x74')==typeof _0x290089[_0x3d78('0x79')][_0x3d78('0x7c')]){return _0x35837d(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x3d78('0x74')==typeof _0x290089['parameters'][_0x3d78('0x7c')]['admin']&&_0x3d78('0x74')==typeof _0x290089[_0x3d78('0x79')][_0x3d78('0x7c')][_0x3d78('0x7d')]){return _0x35837d(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x290089[_0x3d78('0x75')]===_0x3d78('0x7e')){if('undefined'==typeof _0x290089[_0x3d78('0x79')][_0x3d78('0x7f')]){return _0x35837d(new Error(_0x3d78('0x80')));}if(_0x3d78('0x74')==typeof _0x290089['parameters'][_0x3d78('0x81')]){return _0x35837d(new Error(_0x3d78('0x82')));}}else{return _0x35837d(new Error(_0x3d78('0x83')));}var _0x516d02=_0x290089[_0x3d78('0x2f')];var _0x2ada6b=_0x290089[_0x3d78('0x84')];var _0x1dec3f=_0x290089[_0x3d78('0x75')];var _0x2bc676=_0x290089[_0x3d78('0x85')]?_0x290089[_0x3d78('0x85')]:_0x3d78('0x86');var _0x206c1e=_0x290089['icon']?_0x290089[_0x3d78('0x87')]:'icon-apps';var _0x1fe8c8='';var _0x692b5d='';var _0x4f5991='';var _0x1668ed='';var _0x4ad179=_0x290089['version'];if(_0x1dec3f==='html'){if(_0x3d78('0x74')!=typeof _0x290089['parameters'][_0x3d78('0x7c')][_0x3d78('0x88')]){var _0x413ea4=_0x290089[_0x3d78('0x79')][_0x3d78('0x7c')][_0x3d78('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x3d78('0x89')](_0x413ea4)){_0x1fe8c8=path[_0x3d78('0x5c')](_0x3d78('0x8a'),_0x48395a,_0x2fd7d8[0x0],_0x413ea4);}else{_0x1fe8c8=_0x413ea4;}}else{logger[_0x3d78('0x63')](_0x3d78('0x8b'));}if(_0x3d78('0x74')!=typeof _0x290089[_0x3d78('0x79')][_0x3d78('0x7c')]['agent']){var _0x1b98e6=_0x290089['parameters'][_0x3d78('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x3d78('0x89')](_0x1b98e6)){_0x692b5d=path[_0x3d78('0x5c')](_0x3d78('0x8a'),_0x48395a,_0x2fd7d8[0x0],_0x1b98e6);}else{_0x692b5d=_0x1b98e6;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x1dec3f==='script'){_0x4f5991=_0x290089[_0x3d78('0x79')][_0x3d78('0x7f')];_0x1668ed=_0x290089[_0x3d78('0x79')][_0x3d78('0x81')];if(_0x3d78('0x74')!=typeof _0x290089[_0x3d78('0x79')][_0x3d78('0x7c')]){if(_0x3d78('0x74')!=typeof _0x290089[_0x3d78('0x79')][_0x3d78('0x7c')][_0x3d78('0x88')]){var _0x413ea4=_0x290089[_0x3d78('0x79')][_0x3d78('0x7c')][_0x3d78('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x3d78('0x89')](_0x413ea4)){_0x1fe8c8=path[_0x3d78('0x5c')]('plugins',_0x48395a,_0x2fd7d8[0x0],_0x413ea4);}else{_0x1fe8c8=_0x413ea4;}}if(_0x3d78('0x74')!=typeof _0x290089[_0x3d78('0x79')][_0x3d78('0x7c')]['agent']){var _0x1b98e6=_0x290089[_0x3d78('0x79')][_0x3d78('0x7c')][_0x3d78('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1b98e6)){_0x692b5d=path[_0x3d78('0x5c')](_0x3d78('0x8a'),_0x48395a,_0x2fd7d8[0x0],_0x1b98e6);}else{_0x692b5d=_0x1b98e6;}}}}var _0x492bcf={'name':_0x516d02,'description':_0x2ada6b,'path':path['join'](_0x48395a,_0x2fd7d8[0x0]),'type':_0x1dec3f,'sidebar':_0x2bc676,'icon':_0x206c1e,'adminUrl':_0x1fe8c8,'agentUrl':_0x692b5d,'scriptName':_0x4f5991,'scriptPath':_0x1668ed,'version':_0x4ad179};removeReferences(_0x186e25,null);return db[_0x3d78('0x32')][_0x3d78('0x8c')](_0x492bcf)[_0x3d78('0x29')](function(_0x1df3a7){var _0xbcccea={'role':_0x1eb382['body'][_0x3d78('0x8d')],'userProfileId':_0x1eb382[_0x3d78('0x8e')]['userProfileId']};if(!_0xbcccea)throw new Error(_0x3d78('0x8f'));if(_0xbcccea[_0x3d78('0x8d')]===_0x3d78('0x90')){var _0x16b3a2=_0x1df3a7['get']({'plain':!![]});return db['UserProfileSection'][_0x3d78('0x4a')]({'where':{'name':_0x3d78('0x91'),'userProfileId':_0xbcccea[_0x3d78('0x92')]},'raw':!![]})[_0x3d78('0x29')](function(_0x217594){if(_0x217594&&_0x217594[_0x3d78('0x93')]===0x0){return db[_0x3d78('0x2c')][_0x3d78('0x8c')]({'name':_0x16b3a2[_0x3d78('0x2f')],'resourceId':_0x16b3a2['id'],'type':_0x217594[_0x3d78('0x2f')],'sectionId':_0x217594['id']},{})[_0x3d78('0x29')](function(){return _0x1df3a7;});}else{return _0x1df3a7;}})[_0x3d78('0x46')](function(_0x262264){logger[_0x3d78('0x55')](_0x3d78('0x94'),_0x262264);throw _0x262264;});}return _0x1df3a7;})[_0x3d78('0x29')](respondWithResult(_0x32918d,null))[_0x3d78('0x46')](handleError(_0x32918d,null));}});}catch(_0x215e0a){_0x32918d[_0x3d78('0x1e')](0x1f4)[_0x3d78('0x30')](_0x215e0a);}};function removeReferences(_0x1f6d00,_0x43f39b){try{if(_0x1f6d00){fs[_0x3d78('0x62')](_0x1f6d00);logger[_0x3d78('0x63')](_0x3d78('0x95'));}if(_0x43f39b){rimraf(_0x43f39b,function(){});logger[_0x3d78('0x63')](_0x3d78('0x96'));}}catch(_0xe07389){logger[_0x3d78('0x55')](_0xe07389);}}exports[_0x3d78('0x28')]=function(_0x161519,_0x3aea43,_0x18a27d){return db[_0x3d78('0x32')][_0x3d78('0x4a')]({'where':{'id':_0x161519[_0x3d78('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aea43,null))[_0x3d78('0x29')](saveUpdates(_0x161519[_0x3d78('0x8e')],null))[_0x3d78('0x29')](respondWithResult(_0x3aea43,null))['catch'](handleError(_0x3aea43,null));};exports[_0x3d78('0x97')]=function(_0x535b8d,_0x542d15,_0x2f795a){return db[_0x3d78('0x32')][_0x3d78('0x4a')]({'where':{'id':_0x535b8d[_0x3d78('0x47')]['id']}})[_0x3d78('0x29')](function(_0xafe43){if(_0xafe43){return _0xafe43[_0x3d78('0x2a')]();}})[_0x3d78('0x29')](function(_0x1768dc){rimraf(path[_0x3d78('0x5c')](config[_0x3d78('0x4c')],_0x3d78('0x59'),path['dirname'](_0x1768dc[_0x3d78('0x9')])),function(){});return _0x1768dc;})['then'](handleEntityNotFound(_0x542d15,null))['then'](respondWithStatusCode(_0x542d15,null))[_0x3d78('0x46')](handleError(_0x542d15,null));};exports[_0x3d78('0x98')]=function(_0x22aece,_0x205d76,_0x4ed131){return BPromise['resolve']()['then'](function(){if(!_0x22aece[_0x3d78('0x37')]['path']){throw new Error(_0x3d78('0x99'));}if(!_0x22aece['query']['port']){throw new Error(_0x3d78('0x9a'));}var _0x541687=_0x22aece[_0x3d78('0x37')][_0x3d78('0x9b')]?_0x22aece['query']['hostname']+':'+_0x22aece['query']['port']:'http://localhost:'+_0x22aece[_0x3d78('0x37')][_0x3d78('0x9c')];var _0x16d21a=_0x22aece[_0x3d78('0x37')][_0x3d78('0x20')]?_0x22aece['query'][_0x3d78('0x20')]:!![];var _0x18b014=_0x22aece[_0x3d78('0x37')][_0x3d78('0x9d')]?_0x22aece[_0x3d78('0x37')][_0x3d78('0x9d')]:null;var _0x3d8fce={'method':_0x22aece[_0x3d78('0x9e')],'uri':util['format']('%s%s',_0x541687,_0x22aece[_0x3d78('0x37')]['path']),'json':_0x16d21a,'resolveWithFullResponse':!![],'encoding':_0x18b014,'qs':_0x22aece[_0x3d78('0x37')]};if(_0x22aece[_0x3d78('0x9f')]){_0x3d8fce[_0x3d78('0x9f')]=_0x22aece[_0x3d78('0x9f')];if(_0x3d8fce['headers'][_0x3d78('0xa0')]){delete _0x3d8fce['headers'][_0x3d78('0xa0')];}}if(_0x3d8fce[_0x3d78('0x9f')]['content-type']){delete _0x3d8fce['headers']['content-type'];}return rp(_0x3d8fce);})[_0x3d78('0x29')](function(_0x58eebd){if(_0x58eebd){_0x205d76[_0x3d78('0xa1')](_0x58eebd[_0x3d78('0x9f')]);logger[_0x3d78('0x63')](_0x58eebd[_0x3d78('0x8e')]);if(_[_0x3d78('0xa2')](_0x22aece[_0x3d78('0x37')][_0x3d78('0x9')],_0x3d78('0x4b'))&&_0x58eebd[_0x3d78('0xa3')]==0x1f4){return _0x205d76[_0x3d78('0x2d')](_0x58eebd[_0x3d78('0xa3')]);}else{return _0x205d76[_0x3d78('0x1e')](_0x58eebd[_0x3d78('0xa3')])['send'](_0x58eebd[_0x3d78('0x8e')]);}}else{return _0x205d76[_0x3d78('0x2d')](0xc8);}})['catch'](handleError(_0x205d76,null));};exports[_0x3d78('0xa4')]=function(_0x3bfb09,_0x45c813,_0x58edaf){return BPromise[_0x3d78('0xa5')]()[_0x3d78('0x29')](function(){if(!_0x3bfb09[_0x3d78('0x37')][_0x3d78('0x9')]){throw new Error(_0x3d78('0x99'));}if(!_0x3bfb09[_0x3d78('0x37')][_0x3d78('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2bb995=_0x3bfb09[_0x3d78('0x37')][_0x3d78('0x9b')]?_0x3bfb09['query'][_0x3d78('0x9b')]+':'+_0x3bfb09[_0x3d78('0x37')][_0x3d78('0x9c')]:_0x3d78('0xa6')+_0x3bfb09[_0x3d78('0x37')][_0x3d78('0x9c')];var _0x4c0314=_0x3bfb09[_0x3d78('0x37')][_0x3d78('0x20')]?_0x3bfb09[_0x3d78('0x37')][_0x3d78('0x20')]:!![];var _0x6dca60=_0x3bfb09[_0x3d78('0x37')][_0x3d78('0x9d')]?_0x3bfb09[_0x3d78('0x37')][_0x3d78('0x9d')]:null;var _0x5bf278={'method':_0x3bfb09[_0x3d78('0x9e')],'uri':util[_0x3d78('0x4d')]('%s%s',_0x2bb995,_0x3bfb09[_0x3d78('0x37')][_0x3d78('0x9')]),'json':_0x4c0314,'resolveWithFullResponse':!![],'encoding':_0x6dca60,'body':_0x3bfb09[_0x3d78('0x8e')]};if(_0x3bfb09['headers']){_0x5bf278['headers']=_0x3bfb09[_0x3d78('0x9f')];if(_0x5bf278[_0x3d78('0x9f')][_0x3d78('0xa0')]){delete _0x5bf278[_0x3d78('0x9f')][_0x3d78('0xa0')];}}if(_0x5bf278[_0x3d78('0x9f')][_0x3d78('0xa7')]){delete _0x5bf278[_0x3d78('0x9f')][_0x3d78('0xa7')];}return rp(_0x5bf278);})[_0x3d78('0x29')](function(_0xb01c4f){if(_0xb01c4f){_0x45c813[_0x3d78('0xa1')](_0xb01c4f[_0x3d78('0x9f')]);logger[_0x3d78('0x63')](_0xb01c4f['body']);return _0x45c813['status'](_0xb01c4f[_0x3d78('0xa3')])[_0x3d78('0x30')](_0xb01c4f[_0x3d78('0x8e')]);}else{return _0x45c813['sendStatus'](0xc8);}})[_0x3d78('0x46')](handleError(_0x45c813,null));}; \ No newline at end of file +var _0x488d=['status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','download','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','pipe','**/*','join','root','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','unlinkSync','info','Download\x20completed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','icon','html','admin','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','test','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','port','method','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','sendStatus'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x488d,0x1df));var _0xd488=function(_0x557f4a,_0x4bfe60){_0x557f4a=_0x557f4a-0x0;var _0x19c609=_0x488d[_0x557f4a];return _0x19c609;};'use strict';var pdf=require(_0xd488('0x0'));var emlformat=require(_0xd488('0x1'));var rimraf=require(_0xd488('0x2'));var zipdir=require(_0xd488('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd488('0x4'));var moment=require(_0xd488('0x5'));var BPromise=require(_0xd488('0x6'));var Mustache=require(_0xd488('0x7'));var util=require(_0xd488('0x8'));var path=require(_0xd488('0x9'));var sox=require(_0xd488('0xa'));var csv=require(_0xd488('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd488('0xc'));var squel=require(_0xd488('0xd'));var crypto=require(_0xd488('0xe'));var jsforce=require(_0xd488('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd488('0x10'));var Papa=require(_0xd488('0x11'));var extract=require(_0xd488('0x12'));var rimraf=require(_0xd488('0x2'));var archiver=require(_0xd488('0x13'));var Redis=require(_0xd488('0x14'));var authService=require(_0xd488('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xd488('0x16'));var hardwareService=require(_0xd488('0x17'));var logger=require(_0xd488('0x18'))(_0xd488('0x19'));var utils=require(_0xd488('0x1a'));var config=require(_0xd488('0x1b'));var db=require(_0xd488('0x1c'))['db'];config[_0xd488('0x1d')]=_['defaults'](config[_0xd488('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xd488('0x1e'))(new Redis(config[_0xd488('0x1d')]));require(_0xd488('0x1f'))[_0xd488('0x20')](socket);function respondWithStatusCode(_0x5af518,_0x40321c){_0x40321c=_0x40321c||0xcc;return function(_0x20d7dc){if(_0x20d7dc){return _0x5af518[_0xd488('0x21')](_0x40321c);}return _0x5af518[_0xd488('0x22')](_0x40321c)[_0xd488('0x23')]();};}function respondWithResult(_0x288216,_0x200694){_0x200694=_0x200694||0xc8;return function(_0x442215){if(_0x442215){return _0x288216[_0xd488('0x22')](_0x200694)[_0xd488('0x24')](_0x442215);}};}function respondWithFilteredResult(_0x49d642,_0x302b9f){return function(_0x59e1e2){if(_0x59e1e2){var _0x588474=_0x59e1e2[_0xd488('0x25')],_0x333d9d=_0x302b9f[_0xd488('0x26')],_0x1a5ef6=_0x302b9f[_0xd488('0x26')]+_0x302b9f[_0xd488('0x27')],_0x128570;if(_0x1a5ef6>=_0x588474){_0x1a5ef6=_0x588474;_0x128570=0xc8;}else{_0x128570=0xce;}_0x49d642[_0xd488('0x22')](_0x128570);return _0x49d642[_0xd488('0x28')](_0xd488('0x29'),_0x333d9d+'-'+_0x1a5ef6+'/'+_0x588474)['json'](_0x59e1e2);}return null;};}function patchUpdates(_0x510688){return function(_0x2a085c){try{jsonpatch[_0xd488('0x2a')](_0x2a085c,_0x510688,!![]);}catch(_0x466570){return BPromise['reject'](_0x466570);}return _0x2a085c[_0xd488('0x2b')]();};}function saveUpdates(_0x51b059,_0x552a79){return function(_0x55bad4){if(_0x55bad4){return _0x55bad4[_0xd488('0x2c')](_0x51b059)[_0xd488('0x2d')](function(_0x438b4a){return _0x438b4a;});}return null;};}function removeEntity(_0x5a2350,_0x5c5bab){return function(_0x1124ea){if(_0x1124ea){return _0x1124ea[_0xd488('0x2e')]()[_0xd488('0x2d')](function(){var _0x2502c1=_0x1124ea[_0xd488('0x2f')]({'plain':!![]});var _0x35b901=_0xd488('0x30');return db[_0xd488('0x31')][_0xd488('0x2e')]({'where':{'type':_0x35b901,'resourceId':_0x2502c1['id']}})[_0xd488('0x2d')](function(){return _0x1124ea;});})[_0xd488('0x2d')](function(){_0x5a2350[_0xd488('0x22')](0xcc)[_0xd488('0x23')]();});}};}function handleEntityNotFound(_0x45a980,_0x1fc037){return function(_0x570f55){if(!_0x570f55){_0x45a980[_0xd488('0x21')](0x194);}return _0x570f55;};}function handleError(_0x888de6,_0x4b1f80){_0x4b1f80=_0x4b1f80||0x1f4;return function(_0x241568){logger[_0xd488('0x32')](_0x241568[_0xd488('0x33')]);if(_0x241568[_0xd488('0x34')]){delete _0x241568[_0xd488('0x34')];}_0x888de6['status'](_0x4b1f80)[_0xd488('0x35')](_0x241568);};}exports[_0xd488('0x36')]=function(_0x3edeca,_0x7b1acc){var _0x45bbe0={},_0x126fac={},_0x1aa0d8={'count':0x0,'rows':[]};var _0x159eed=_[_0xd488('0x37')](db[_0xd488('0x38')]['rawAttributes'],function(_0x49bb9b){return{'name':_0x49bb9b['fieldName'],'type':_0x49bb9b[_0xd488('0x39')][_0xd488('0x3a')]};});_0x126fac[_0xd488('0x3b')]=_[_0xd488('0x37')](_0x159eed,_0xd488('0x34'));_0x126fac[_0xd488('0x3c')]=_['keys'](_0x3edeca[_0xd488('0x3c')]);_0x126fac['filters']=_[_0xd488('0x3d')](_0x126fac[_0xd488('0x3b')],_0x126fac['query']);_0x45bbe0[_0xd488('0x3e')]=_[_0xd488('0x3d')](_0x126fac[_0xd488('0x3b')],qs[_0xd488('0x3f')](_0x3edeca['query'][_0xd488('0x3f')]));_0x45bbe0['attributes']=_0x45bbe0[_0xd488('0x3e')][_0xd488('0x40')]?_0x45bbe0['attributes']:_0x126fac['model'];if(!_0x3edeca[_0xd488('0x3c')][_0xd488('0x41')]('nolimit')){_0x45bbe0[_0xd488('0x27')]=qs['limit'](_0x3edeca[_0xd488('0x3c')][_0xd488('0x27')]);_0x45bbe0[_0xd488('0x26')]=qs['offset'](_0x3edeca[_0xd488('0x3c')][_0xd488('0x26')]);}_0x45bbe0[_0xd488('0x42')]=qs[_0xd488('0x43')](_0x3edeca[_0xd488('0x3c')][_0xd488('0x43')]);_0x45bbe0[_0xd488('0x44')]=qs['filters'](_[_0xd488('0x45')](_0x3edeca[_0xd488('0x3c')],_0x126fac[_0xd488('0x46')]),_0x159eed);if(_0x3edeca[_0xd488('0x3c')][_0xd488('0x47')]){_0x45bbe0[_0xd488('0x44')]=_[_0xd488('0x48')](_0x45bbe0[_0xd488('0x44')],{'$or':_[_0xd488('0x37')](_0x159eed,function(_0x5ee85e){if(_0x5ee85e['type']!==_0xd488('0x49')){var _0x4e8f7b={};_0x4e8f7b[_0x5ee85e['name']]={'$like':'%'+_0x3edeca[_0xd488('0x3c')][_0xd488('0x47')]+'%'};return _0x4e8f7b;}})});}_0x45bbe0=_[_0xd488('0x48')]({},_0x45bbe0,_0x3edeca[_0xd488('0x4a')]);var _0x19f24a={'where':_0x45bbe0['where']};return db[_0xd488('0x38')][_0xd488('0x25')](_0x19f24a)[_0xd488('0x2d')](function(_0x51eff7){_0x1aa0d8[_0xd488('0x25')]=_0x51eff7;if(_0x3edeca[_0xd488('0x3c')][_0xd488('0x4b')]){_0x45bbe0[_0xd488('0x4c')]=[{'all':!![]}];}return db[_0xd488('0x38')]['findAll'](_0x45bbe0);})[_0xd488('0x2d')](function(_0x756ff){_0x1aa0d8[_0xd488('0x4d')]=_0x756ff;return _0x1aa0d8;})['then'](respondWithFilteredResult(_0x7b1acc,_0x45bbe0))['catch'](handleError(_0x7b1acc,null));};exports[_0xd488('0x4e')]=function(_0x3d1367,_0x23f9c9){var _0x49fdf9={'raw':!![],'where':{'id':_0x3d1367[_0xd488('0x4f')]['id']}},_0x5b94db={};_0x5b94db[_0xd488('0x3b')]=_[_0xd488('0x50')](db[_0xd488('0x38')]['rawAttributes']);_0x5b94db[_0xd488('0x3c')]=_[_0xd488('0x50')](_0x3d1367[_0xd488('0x3c')]);_0x5b94db['filters']=_['intersection'](_0x5b94db[_0xd488('0x3b')],_0x5b94db[_0xd488('0x3c')]);_0x49fdf9[_0xd488('0x3e')]=_['intersection'](_0x5b94db[_0xd488('0x3b')],qs[_0xd488('0x3f')](_0x3d1367[_0xd488('0x3c')][_0xd488('0x3f')]));_0x49fdf9['attributes']=_0x49fdf9['attributes'][_0xd488('0x40')]?_0x49fdf9['attributes']:_0x5b94db[_0xd488('0x3b')];if(_0x3d1367[_0xd488('0x3c')][_0xd488('0x4b')]){_0x49fdf9[_0xd488('0x4c')]=[{'all':!![]}];}_0x49fdf9=_[_0xd488('0x48')]({},_0x49fdf9,_0x3d1367[_0xd488('0x4a')]);return db[_0xd488('0x38')][_0xd488('0x51')](_0x49fdf9)['then'](handleEntityNotFound(_0x23f9c9,null))['then'](respondWithResult(_0x23f9c9,null))[_0xd488('0x52')](handleError(_0x23f9c9,null));};exports[_0xd488('0x53')]=function(_0x39a2d0,_0x502e7b,_0x664d3){return db[_0xd488('0x38')][_0xd488('0x51')]({'where':{'id':_0x39a2d0['params']['id']},'attributes':[_0xd488('0x34'),_0xd488('0x9')],'raw':!![]})[_0xd488('0x2d')](handleEntityNotFound(_0x502e7b,null))[_0xd488('0x2d')](function(_0x3e08da){if(_0x3e08da){var _0x289c9f=path['join'](config['root'],'server/files/plugins',util[_0xd488('0x54')](_0xd488('0x55'),path[_0xd488('0x56')](_0x3e08da['path'])));var _0x26f1ea=fs[_0xd488('0x57')](_0x289c9f);var _0x1fd24f=archiver(_0xd488('0x58'),{'zlib':{'level':0x9}});_0x1fd24f['on'](_0xd488('0x59'),function(_0x3625ae){if(_0x3625ae[_0xd488('0x5a')]===_0xd488('0x5b')){logger[_0xd488('0x32')](_0x3625ae);}else{throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x1fd24f['on'](_0xd488('0x32'),function(_0x3d26f1){throw new db[(_0xd488('0x5c'))][(_0xd488('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x1fd24f[_0xd488('0x5e')](_0x26f1ea);_0x1fd24f['glob'](_0xd488('0x5f'),{'cwd':path[_0xd488('0x60')](config[_0xd488('0x61')],_0xd488('0x62'),path[_0xd488('0x63')](_0x3e08da['path'])),'ignore':[path[_0xd488('0x60')](path[_0xd488('0x56')](_0x3e08da['path']),_0xd488('0x64')),path[_0xd488('0x60')](path[_0xd488('0x56')](_0x3e08da[_0xd488('0x9')]),_0xd488('0x65'))],'nodir':!![]})[_0xd488('0x66')]();_0x26f1ea['on']('close',function(){if(!fs[_0xd488('0x67')](_0x289c9f)){throw new db['Sequelize']['Error']('Plugin\x20not\x20found');}return _0x502e7b[_0xd488('0x53')](_0x289c9f,util[_0xd488('0x54')](_0xd488('0x55'),path[_0xd488('0x56')](_0x3e08da[_0xd488('0x9')])),function(_0x235527){if(_0x235527){throw new db[(_0xd488('0x5c'))][(_0xd488('0x5d'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xd488('0x68')](_0x289c9f);logger[_0xd488('0x69')](_0xd488('0x6a'));logger[_0xd488('0x69')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x502e7b,null));};exports[_0xd488('0x6b')]=function(_0x5e4a04,_0x5e518f,_0x3ee4fa){var _0x164f54=path[_0xd488('0x56')](_0x5e4a04[_0xd488('0x6c')][_0xd488('0x6d')],path['extname'](_0x5e4a04[_0xd488('0x6c')]['filename']));var _0x1aaee7=path[_0xd488('0x60')](config[_0xd488('0x61')],_0xd488('0x62'),_0x5e4a04[_0xd488('0x6c')][_0xd488('0x6d')]);var _0x5282da=path[_0xd488('0x60')](config[_0xd488('0x61')],_0xd488('0x62'),_0x164f54);logger[_0xd488('0x69')](_0xd488('0x6e'),_0x1aaee7);logger[_0xd488('0x69')](_0xd488('0x6f'),_0x5282da);try{fs[_0xd488('0x70')](_0x1aaee7,parseInt(_0xd488('0x71'),0x8));extract(_0x1aaee7,{'dir':_0x5282da},function(_0x1d932a){if(_0x1d932a){logger['error'](_0x1d932a);handleError(_0x1d932a,!![]);};var _0x1d2490=fs['readdirSync'](_0x5282da);if(_0x1d2490[_0xd488('0x40')]>0x1){removeReferences(_0x1aaee7,_0x5282da);logger['error'](_0xd488('0x72'));return _0x3ee4fa(new Error('Invalid\x20plugin\x20structure'));}var _0x317c04=fs[_0xd488('0x73')](path[_0xd488('0x60')](_0x5282da,_0x1d2490[0x0]));if(_0x317c04[_0xd488('0x74')]()){removeReferences(_0x1aaee7,_0x5282da);logger[_0xd488('0x32')](_0xd488('0x72'));return _0x3ee4fa(new Error(_0xd488('0x72')));}if(_0x317c04[_0xd488('0x75')]()){var _0x4956a2=fs[_0xd488('0x76')](path[_0xd488('0x60')](_0x5282da,_0x1d2490[0x0]));if(_0x4956a2['length']===0x0){removeReferences(_0x1aaee7,_0x5282da);logger[_0xd488('0x32')](_0xd488('0x72'));return _0x3ee4fa(new Error(_0xd488('0x72')));}var _0x208583=_0x4956a2[_0xd488('0x77')](function(_0x555804){return _0x555804===_0xd488('0x78');});if(!_0x208583){return _0x3ee4fa(new Error('Plugin\x20manifest\x20missing'));}var _0x3d7955=fs['readFileSync'](path['join'](_0x5282da,_0x1d2490[0x0],_0xd488('0x78')));var _0x21c388=JSON[_0xd488('0x79')](_0x3d7955);if(_0xd488('0x7a')==typeof _0x21c388[_0xd488('0x34')]){return _0x3ee4fa(new Error(_0xd488('0x7b')));}if(_0xd488('0x7a')==typeof _0x21c388[_0xd488('0x39')]){return _0x3ee4fa(new Error(_0xd488('0x7c')));}if(_0xd488('0x7a')==typeof _0x21c388[_0xd488('0x7d')]){return _0x3ee4fa(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xd488('0x7a')==typeof _0x21c388[_0xd488('0x7e')]){return _0x3ee4fa(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x21c388['type']==='html'){if(_0xd488('0x7a')==typeof _0x21c388[_0xd488('0x7e')][_0xd488('0x7f')]){return _0x3ee4fa(new Error(_0xd488('0x80')));}if(_0xd488('0x7a')==typeof _0x21c388[_0xd488('0x7e')][_0xd488('0x7f')]['admin']&&_0xd488('0x7a')==typeof _0x21c388[_0xd488('0x7e')][_0xd488('0x7f')]['agent']){return _0x3ee4fa(new Error(_0xd488('0x81')));}}else if(_0x21c388[_0xd488('0x39')]==='script'){if(_0xd488('0x7a')==typeof _0x21c388[_0xd488('0x7e')][_0xd488('0x82')]){return _0x3ee4fa(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xd488('0x7a')==typeof _0x21c388[_0xd488('0x7e')][_0xd488('0x83')]){return _0x3ee4fa(new Error(_0xd488('0x84')));}}else{return _0x3ee4fa(new Error(_0xd488('0x85')));}var _0xd86993=_0x21c388[_0xd488('0x34')];var _0x1b8948=_0x21c388[_0xd488('0x86')];var _0x12d4b7=_0x21c388[_0xd488('0x39')];var _0x477db6=_0x21c388['sidebar']?_0x21c388['sidebar']:'always';var _0x2221d8=_0x21c388[_0xd488('0x87')]?_0x21c388[_0xd488('0x87')]:'icon-apps';var _0x308e17='';var _0x47ce9c='';var _0x1a4d69='';var _0x32c604='';var _0x422fcb=_0x21c388['version'];if(_0x12d4b7===_0xd488('0x88')){if(_0xd488('0x7a')!=typeof _0x21c388[_0xd488('0x7e')][_0xd488('0x7f')][_0xd488('0x89')]){var _0x29aa75=_0x21c388[_0xd488('0x7e')][_0xd488('0x7f')][_0xd488('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x29aa75)){_0x308e17=path[_0xd488('0x60')]('plugins',_0x164f54,_0x1d2490[0x0],_0x29aa75);}else{_0x308e17=_0x29aa75;}}else{logger[_0xd488('0x69')](_0xd488('0x8a'));}if(_0xd488('0x7a')!=typeof _0x21c388['parameters']['views'][_0xd488('0x8b')]){var _0x218237=_0x21c388[_0xd488('0x7e')][_0xd488('0x7f')][_0xd488('0x8b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x218237)){_0x47ce9c=path['join'](_0xd488('0x8c'),_0x164f54,_0x1d2490[0x0],_0x218237);}else{_0x47ce9c=_0x218237;}}else{logger[_0xd488('0x69')](_0xd488('0x8d'));}}else if(_0x12d4b7===_0xd488('0x8e')){_0x1a4d69=_0x21c388[_0xd488('0x7e')][_0xd488('0x82')];_0x32c604=_0x21c388[_0xd488('0x7e')][_0xd488('0x83')];if(_0xd488('0x7a')!=typeof _0x21c388[_0xd488('0x7e')][_0xd488('0x7f')]){if(_0xd488('0x7a')!=typeof _0x21c388[_0xd488('0x7e')]['views'][_0xd488('0x89')]){var _0x29aa75=_0x21c388['parameters'][_0xd488('0x7f')][_0xd488('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xd488('0x8f')](_0x29aa75)){_0x308e17=path['join']('plugins',_0x164f54,_0x1d2490[0x0],_0x29aa75);}else{_0x308e17=_0x29aa75;}}if(_0xd488('0x7a')!=typeof _0x21c388['parameters']['views'][_0xd488('0x8b')]){var _0x218237=_0x21c388[_0xd488('0x7e')][_0xd488('0x7f')][_0xd488('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0xd488('0x8f')](_0x218237)){_0x47ce9c=path[_0xd488('0x60')]('plugins',_0x164f54,_0x1d2490[0x0],_0x218237);}else{_0x47ce9c=_0x218237;}}}}var _0x5676ec={'name':_0xd86993,'description':_0x1b8948,'path':path['join'](_0x164f54,_0x1d2490[0x0]),'type':_0x12d4b7,'sidebar':_0x477db6,'icon':_0x2221d8,'adminUrl':_0x308e17,'agentUrl':_0x47ce9c,'scriptName':_0x1a4d69,'scriptPath':_0x32c604,'version':_0x422fcb};removeReferences(_0x1aaee7,null);return db[_0xd488('0x38')][_0xd488('0x90')](_0x5676ec)[_0xd488('0x2d')](function(_0x1d89cf){var _0x17ed7d={'role':_0x5e4a04[_0xd488('0x91')]['role'],'userProfileId':_0x5e4a04['body'][_0xd488('0x92')]};if(!_0x17ed7d)throw new Error(_0xd488('0x93'));if(_0x17ed7d[_0xd488('0x94')]===_0xd488('0x95')){var _0x3909cb=_0x1d89cf[_0xd488('0x2f')]({'plain':!![]});return db[_0xd488('0x96')]['find']({'where':{'name':_0xd488('0x30'),'userProfileId':_0x17ed7d[_0xd488('0x92')]},'raw':!![]})['then'](function(_0x2f6f17){if(_0x2f6f17&&_0x2f6f17[_0xd488('0x97')]===0x0){return db[_0xd488('0x31')][_0xd488('0x90')]({'name':_0x3909cb[_0xd488('0x34')],'resourceId':_0x3909cb['id'],'type':_0x2f6f17[_0xd488('0x34')],'sectionId':_0x2f6f17['id']},{})[_0xd488('0x2d')](function(){return _0x1d89cf;});}else{return _0x1d89cf;}})[_0xd488('0x52')](function(_0x3359b9){logger[_0xd488('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3359b9);throw _0x3359b9;});}return _0x1d89cf;})[_0xd488('0x2d')](respondWithResult(_0x5e518f,null))[_0xd488('0x52')](handleError(_0x5e518f,null));}});}catch(_0x493c4d){_0x5e518f[_0xd488('0x22')](0x1f4)[_0xd488('0x35')](_0x493c4d);}};function removeReferences(_0x21c39c,_0x42b08b){try{if(_0x21c39c){fs['unlinkSync'](_0x21c39c);logger[_0xd488('0x69')](_0xd488('0x98'));}if(_0x42b08b){rimraf(_0x42b08b,function(){});logger['info'](_0xd488('0x99'));}}catch(_0x43300d){logger[_0xd488('0x32')](_0x43300d);}}exports[_0xd488('0x2c')]=function(_0x1d417e,_0x299f8a,_0x63c3e){return db[_0xd488('0x38')]['find']({'where':{'id':_0x1d417e['params']['id']}})['then'](handleEntityNotFound(_0x299f8a,null))[_0xd488('0x2d')](saveUpdates(_0x1d417e[_0xd488('0x91')],null))['then'](respondWithResult(_0x299f8a,null))['catch'](handleError(_0x299f8a,null));};exports[_0xd488('0x9a')]=function(_0xb2b68e,_0x466168,_0x4d1a17){return db[_0xd488('0x38')][_0xd488('0x51')]({'where':{'id':_0xb2b68e[_0xd488('0x4f')]['id']}})[_0xd488('0x2d')](function(_0x29974d){if(_0x29974d){return _0x29974d[_0xd488('0x2e')]();}})[_0xd488('0x2d')](function(_0x2b649a){rimraf(path[_0xd488('0x60')](config[_0xd488('0x61')],_0xd488('0x62'),path[_0xd488('0x63')](_0x2b649a[_0xd488('0x9')])),function(){});return _0x2b649a;})['then'](handleEntityNotFound(_0x466168,null))[_0xd488('0x2d')](respondWithStatusCode(_0x466168,null))['catch'](handleError(_0x466168,null));};exports[_0xd488('0x9b')]=function(_0x250f95,_0x365b47,_0x168166){return BPromise[_0xd488('0x9c')]()[_0xd488('0x2d')](function(){if(!_0x250f95[_0xd488('0x3c')][_0xd488('0x9')]){throw new Error(_0xd488('0x9d'));}if(!_0x250f95[_0xd488('0x3c')]['port']){throw new Error(_0xd488('0x9e'));}var _0xba8c81=_0x250f95[_0xd488('0x3c')][_0xd488('0x9f')]?_0x250f95['query'][_0xd488('0x9f')]+':'+_0x250f95[_0xd488('0x3c')]['port']:_0xd488('0xa0')+_0x250f95['query']['port'];var _0x4a4684=_0x250f95[_0xd488('0x3c')][_0xd488('0x24')]?_0x250f95['query'][_0xd488('0x24')]:!![];var _0x2776ac=_0x250f95['query'][_0xd488('0xa1')]?_0x250f95[_0xd488('0x3c')][_0xd488('0xa1')]:null;var _0x3bb707={'method':_0x250f95['method'],'uri':util[_0xd488('0x54')](_0xd488('0xa2'),_0xba8c81,_0x250f95[_0xd488('0x3c')][_0xd488('0x9')]),'json':_0x4a4684,'resolveWithFullResponse':!![],'encoding':_0x2776ac,'qs':_0x250f95[_0xd488('0x3c')]};if(_0x250f95[_0xd488('0xa3')]){_0x3bb707[_0xd488('0xa3')]=_0x250f95[_0xd488('0xa3')];if(_0x3bb707[_0xd488('0xa3')][_0xd488('0xa4')]){delete _0x3bb707[_0xd488('0xa3')][_0xd488('0xa4')];}}if(_0x3bb707[_0xd488('0xa3')]['content-type']){delete _0x3bb707[_0xd488('0xa3')][_0xd488('0xa5')];}return rp(_0x3bb707);})[_0xd488('0x2d')](function(_0x4018f1){if(_0x4018f1){_0x365b47[_0xd488('0x28')](_0x4018f1[_0xd488('0xa3')]);logger[_0xd488('0x69')](_0x4018f1['body']);if(_[_0xd488('0xa6')](_0x250f95[_0xd488('0x3c')]['path'],_0xd488('0x53'))&&_0x4018f1[_0xd488('0xa7')]==0x1f4){return _0x365b47[_0xd488('0x21')](_0x4018f1[_0xd488('0xa7')]);}else{return _0x365b47[_0xd488('0x22')](_0x4018f1['statusCode'])['send'](_0x4018f1[_0xd488('0x91')]);}}else{return _0x365b47[_0xd488('0x21')](0xc8);}})[_0xd488('0x52')](handleError(_0x365b47,null));};exports[_0xd488('0xa8')]=function(_0x3bc584,_0x2405cc,_0x3d5f9f){return BPromise[_0xd488('0x9c')]()[_0xd488('0x2d')](function(){if(!_0x3bc584[_0xd488('0x3c')][_0xd488('0x9')]){throw new Error(_0xd488('0x9d'));}if(!_0x3bc584[_0xd488('0x3c')][_0xd488('0xa9')]){throw new Error(_0xd488('0x9e'));}var _0x48fd51=_0x3bc584['query'][_0xd488('0x9f')]?_0x3bc584[_0xd488('0x3c')]['hostname']+':'+_0x3bc584[_0xd488('0x3c')]['port']:_0xd488('0xa0')+_0x3bc584[_0xd488('0x3c')]['port'];var _0x56c66b=_0x3bc584['query']['json']?_0x3bc584[_0xd488('0x3c')]['json']:!![];var _0x126946=_0x3bc584[_0xd488('0x3c')][_0xd488('0xa1')]?_0x3bc584[_0xd488('0x3c')]['encoding']:null;var _0x1ffbcf={'method':_0x3bc584[_0xd488('0xaa')],'uri':util['format'](_0xd488('0xa2'),_0x48fd51,_0x3bc584[_0xd488('0x3c')][_0xd488('0x9')]),'json':_0x56c66b,'resolveWithFullResponse':!![],'encoding':_0x126946,'body':_0x3bc584[_0xd488('0x91')]};if(_0x3bc584[_0xd488('0xa3')]){_0x1ffbcf['headers']=_0x3bc584[_0xd488('0xa3')];if(_0x1ffbcf[_0xd488('0xa3')][_0xd488('0xa4')]){delete _0x1ffbcf['headers']['content-length'];}}if(_0x1ffbcf[_0xd488('0xa3')][_0xd488('0xa5')]){delete _0x1ffbcf[_0xd488('0xa3')][_0xd488('0xa5')];}return rp(_0x1ffbcf);})[_0xd488('0x2d')](function(_0x3d28ba){if(_0x3d28ba){_0x2405cc['set'](_0x3d28ba[_0xd488('0xa3')]);logger[_0xd488('0x69')](_0x3d28ba['body']);return _0x2405cc[_0xd488('0x22')](_0x3d28ba[_0xd488('0xa7')])[_0xd488('0x35')](_0x3d28ba[_0xd488('0x91')]);}else{return _0x2405cc['sendStatus'](0xc8);}})[_0xd488('0x52')](handleError(_0x2405cc,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ec1d06f..d1a5143 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 _0x28f2=['remove','emit','hook','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x2f3933,_0x475ba9){var _0x3f56a0=function(_0x5b20ec){while(--_0x5b20ec){_0x2f3933['push'](_0x2f3933['shift']());}};_0x3f56a0(++_0x475ba9);}(_0x28f2,0x193));var _0x228f=function(_0x76376b,_0x3edb7b){_0x76376b=_0x76376b-0x0;var _0x410343=_0x28f2[_0x76376b];return _0x410343;};'use strict';var EventEmitter=require(_0x228f('0x0'));var Plugin=require(_0x228f('0x1'))['db'][_0x228f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x228f('0x3')](0x0);var events={'afterCreate':_0x228f('0x4'),'afterUpdate':'update','afterDestroy':_0x228f('0x5')};function emitEvent(_0x11c2cd){return function(_0x79ed5f,_0x4303c3,_0x2bb7d7){PluginEvents[_0x228f('0x6')](_0x11c2cd+':'+_0x79ed5f['id'],_0x79ed5f);PluginEvents[_0x228f('0x6')](_0x11c2cd,_0x79ed5f);_0x2bb7d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x228f('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xdb28=['Plugin','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x424eb0,_0xd5e5cb){var _0x345128=function(_0x12c56f){while(--_0x12c56f){_0x424eb0['push'](_0x424eb0['shift']());}};_0x345128(++_0xd5e5cb);}(_0xdb28,0x106));var _0x8db2=function(_0x1510a4,_0x2a56b7){_0x1510a4=_0x1510a4-0x0;var _0x2ff957=_0xdb28[_0x1510a4];return _0x2ff957;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Plugin=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){PluginEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);PluginEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 40bb036..150ff34 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 _0x0ee2=['define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x539bde,_0x14b7db){var _0x1718d4=function(_0x1d35e0){while(--_0x1d35e0){_0x539bde['push'](_0x539bde['shift']());}};_0x1718d4(++_0x14b7db);}(_0x0ee2,0x1df));var _0x20ee=function(_0x571ee7,_0x9a27a4){_0x571ee7=_0x571ee7-0x0;var _0x48bc4c=_0x0ee2[_0x571ee7];return _0x48bc4c;};'use strict';var _=require(_0x20ee('0x0'));var util=require(_0x20ee('0x1'));var logger=require(_0x20ee('0x2'))(_0x20ee('0x3'));var moment=require(_0x20ee('0x4'));var BPromise=require(_0x20ee('0x5'));var rp=require(_0x20ee('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20ee('0x7'));var config=require(_0x20ee('0x8'));var attributes=require(_0x20ee('0x9'));module[_0x20ee('0xa')]=function(_0x528108,_0x5d3461){return _0x528108[_0x20ee('0xb')](_0x20ee('0xc'),attributes,{'tableName':_0x20ee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09e1=['Plugin','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x2f3666,_0x46e986){var _0x227f67=function(_0x465d2f){while(--_0x465d2f){_0x2f3666['push'](_0x2f3666['shift']());}};_0x227f67(++_0x46e986);}(_0x09e1,0x143));var _0x109e=function(_0x50077f,_0x481c48){_0x50077f=_0x50077f-0x0;var _0x5bd3dc=_0x09e1[_0x50077f];return _0x5bd3dc;};'use strict';var _=require(_0x109e('0x0'));var util=require(_0x109e('0x1'));var logger=require(_0x109e('0x2'))(_0x109e('0x3'));var moment=require(_0x109e('0x4'));var BPromise=require(_0x109e('0x5'));var rp=require(_0x109e('0x6'));var fs=require('fs');var path=require(_0x109e('0x7'));var rimraf=require(_0x109e('0x8'));var config=require(_0x109e('0x9'));var attributes=require(_0x109e('0xa'));module[_0x109e('0xb')]=function(_0x2a8ce9,_0x297aa5){return _0x2a8ce9[_0x109e('0xc')](_0x109e('0xd'),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 5603735..d5ded08 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 _0x1b1e=['request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','options','raw','bluebird','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x1b1e,0xe6));var _0xe1b1=function(_0x4d8fe1,_0x3ed474){_0x4d8fe1=_0x4d8fe1-0x0;var _0x46685e=_0x1b1e[_0x4d8fe1];return _0x46685e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe1b1('0x0'));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(_0xe1b1('0x1'))('rpc');var config=require(_0xe1b1('0x2'));var jayson=require('jayson/promise');var client=jayson[_0xe1b1('0x3')][_0xe1b1('0x4')]({'port':0x232a});config[_0xe1b1('0x5')]=_[_0xe1b1('0x6')](config[_0xe1b1('0x5')],{'host':_0xe1b1('0x7'),'port':0x18eb});var socket=require(_0xe1b1('0x8'))(new Redis(config[_0xe1b1('0x5')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x1e722c,_0xa3c757,_0x4681eb){return new BPromise(function(_0x51f80f,_0x5075dd){return client[_0xe1b1('0x9')](_0x1e722c,_0x4681eb)[_0xe1b1('0xa')](function(_0x23b8a1){logger[_0xe1b1('0xb')](_0xe1b1('0xc'),_0xa3c757,_0xe1b1('0xd'));logger[_0xe1b1('0xe')](_0xe1b1('0xf'),_0xa3c757,_0xe1b1('0xd'),JSON[_0xe1b1('0x10')](_0x23b8a1));if(_0x23b8a1[_0xe1b1('0x11')]){if(_0x23b8a1['error'][_0xe1b1('0x12')]===0x1f4){logger[_0xe1b1('0x11')]('Plugin,\x20%s,\x20%s',_0xa3c757,_0x23b8a1[_0xe1b1('0x11')][_0xe1b1('0x13')]);return _0x5075dd(_0x23b8a1[_0xe1b1('0x11')][_0xe1b1('0x13')]);}logger['error'](_0xe1b1('0xc'),_0xa3c757,_0x23b8a1[_0xe1b1('0x11')][_0xe1b1('0x13')]);return _0x51f80f(_0x23b8a1[_0xe1b1('0x11')]['message']);}else{logger[_0xe1b1('0xb')](_0xe1b1('0xc'),_0xa3c757,_0xe1b1('0xd'));_0x51f80f(_0x23b8a1[_0xe1b1('0x14')]['message']);}})[_0xe1b1('0x15')](function(_0x211cbf){logger['error']('Plugin,\x20%s,\x20%s',_0xa3c757,_0x211cbf);_0x5075dd(_0x211cbf);});});}exports[_0xe1b1('0x16')]=function(_0x41c04f){var _0x1a2d83=this;return new Promise(function(_0x3bec59,_0x494553){return db[_0xe1b1('0x17')][_0xe1b1('0x18')](_0x41c04f['body'],{'raw':_0x41c04f['options']?_0x41c04f[_0xe1b1('0x19')][_0xe1b1('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3c2563){logger['info'](_0xe1b1('0x16'),_0x41c04f);logger[_0xe1b1('0xe')](_0xe1b1('0x16'),_0x41c04f,JSON[_0xe1b1('0x10')](_0x3c2563));_0x3bec59(_0x3c2563);})[_0xe1b1('0x15')](function(_0x1b650c){logger['error'](_0xe1b1('0x16'),_0x1b650c[_0xe1b1('0x13')],_0x41c04f);_0x494553(_0x1a2d83['error'](0x1f4,_0x1b650c[_0xe1b1('0x13')]));});});}; \ No newline at end of file +var _0x07f8=['message','info','result','catch','CreatePlugin','Plugin','create','options','debug','stringify','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','request','then','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error'];(function(_0x2eb13a,_0x38849d){var _0x3a58d8=function(_0x207bb8){while(--_0x207bb8){_0x2eb13a['push'](_0x2eb13a['shift']());}};_0x3a58d8(++_0x38849d);}(_0x07f8,0x10f));var _0x807f=function(_0x20eaca,_0x5c6fd6){_0x20eaca=_0x20eaca-0x0;var _0xe4e235=_0x07f8[_0x20eaca];return _0xe4e235;};'use strict';var _=require(_0x807f('0x0'));var util=require(_0x807f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x807f('0x2'));var db=require(_0x807f('0x3'))['db'];var utils=require(_0x807f('0x4'));var logger=require(_0x807f('0x5'))(_0x807f('0x6'));var config=require(_0x807f('0x7'));var jayson=require(_0x807f('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x807f('0x9')]=_[_0x807f('0xa')](config[_0x807f('0x9')],{'host':_0x807f('0xb'),'port':0x18eb});var socket=require(_0x807f('0xc'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x577294,_0x20bf17,_0xf8ef87){return new BPromise(function(_0x5eb05d,_0x3c8a34){return client[_0x807f('0xd')](_0x577294,_0xf8ef87)[_0x807f('0xe')](function(_0x498b39){logger['info'](_0x807f('0xf'),_0x20bf17,_0x807f('0x10'));logger['debug'](_0x807f('0x11'),_0x20bf17,_0x807f('0x10'),JSON['stringify'](_0x498b39));if(_0x498b39[_0x807f('0x12')]){if(_0x498b39[_0x807f('0x12')]['code']===0x1f4){logger[_0x807f('0x12')](_0x807f('0xf'),_0x20bf17,_0x498b39['error'][_0x807f('0x13')]);return _0x3c8a34(_0x498b39[_0x807f('0x12')][_0x807f('0x13')]);}logger[_0x807f('0x12')](_0x807f('0xf'),_0x20bf17,_0x498b39[_0x807f('0x12')][_0x807f('0x13')]);return _0x5eb05d(_0x498b39[_0x807f('0x12')][_0x807f('0x13')]);}else{logger[_0x807f('0x14')](_0x807f('0xf'),_0x20bf17,_0x807f('0x10'));_0x5eb05d(_0x498b39[_0x807f('0x15')][_0x807f('0x13')]);}})[_0x807f('0x16')](function(_0x5123c2){logger[_0x807f('0x12')]('Plugin,\x20%s,\x20%s',_0x20bf17,_0x5123c2);_0x3c8a34(_0x5123c2);});});}exports[_0x807f('0x17')]=function(_0x5b7f87){var _0x878732=this;return new Promise(function(_0x353c5c,_0x1dfd72){return db[_0x807f('0x18')][_0x807f('0x19')](_0x5b7f87['body'],{'raw':_0x5b7f87[_0x807f('0x1a')]?_0x5b7f87[_0x807f('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xeda5d9){logger[_0x807f('0x14')](_0x807f('0x17'),_0x5b7f87);logger[_0x807f('0x1b')]('CreatePlugin',_0x5b7f87,JSON[_0x807f('0x1c')](_0xeda5d9));_0x353c5c(_0xeda5d9);})['catch'](function(_0x41420d){logger[_0x807f('0x12')]('CreatePlugin',_0x41420d['message'],_0x5b7f87);_0x1dfd72(_0x878732[_0x807f('0x12')](0x1f4,_0x41420d[_0x807f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5ad0237..3e99269 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 _0xa596=['emit','removeListener','length','./plugin.events','save','update'];(function(_0x2ad78d,_0x470f64){var _0x309a77=function(_0x23eb0b){while(--_0x23eb0b){_0x2ad78d['push'](_0x2ad78d['shift']());}};_0x309a77(++_0x470f64);}(_0xa596,0x7b));var _0x6a59=function(_0xe5c22,_0x1250ed){_0xe5c22=_0xe5c22-0x0;var _0x1ead3d=_0xa596[_0xe5c22];return _0x1ead3d;};'use strict';var PluginEvents=require(_0x6a59('0x0'));var events=[_0x6a59('0x1'),'remove',_0x6a59('0x2')];function createListener(_0x15ba20,_0x2cf59f){return function(_0x115c98){_0x2cf59f[_0x6a59('0x3')](_0x15ba20,_0x115c98);};}function removeListener(_0xf0435f,_0x11cce1){return function(){PluginEvents[_0x6a59('0x4')](_0xf0435f,_0x11cce1);};}exports['register']=function(_0x37d9ef){for(var _0x3fab57=0x0,_0x21e97f=events[_0x6a59('0x5')];_0x3fab57<_0x21e97f;_0x3fab57++){var _0xb50532=events[_0x3fab57];var _0x3c392f=createListener('plugin:'+_0xb50532,_0x37d9ef);PluginEvents['on'](_0xb50532,_0x3c392f);}}; \ No newline at end of file +var _0xa412=['save','remove','update','register','plugin:','./plugin.events'];(function(_0x2e1116,_0x5574a0){var _0x334636=function(_0x30154c){while(--_0x30154c){_0x2e1116['push'](_0x2e1116['shift']());}};_0x334636(++_0x5574a0);}(_0xa412,0xa7));var _0x2a41=function(_0x32e5a4,_0x4e6841){_0x32e5a4=_0x32e5a4-0x0;var _0x2e2054=_0xa412[_0x32e5a4];return _0x2e2054;};'use strict';var PluginEvents=require(_0x2a41('0x0'));var events=[_0x2a41('0x1'),_0x2a41('0x2'),_0x2a41('0x3')];function createListener(_0x3ffbcc,_0x1c8048){return function(_0x473575){_0x1c8048['emit'](_0x3ffbcc,_0x473575);};}function removeListener(_0x33e87b,_0x517ee2){return function(){PluginEvents['removeListener'](_0x33e87b,_0x517ee2);};}exports[_0x2a41('0x4')]=function(_0x54a9ea){for(var _0x56d9e2=0x0,_0x39ed65=events['length'];_0x56d9e2<_0x39ed65;_0x56d9e2++){var _0x4880e9=events[_0x56d9e2];var _0x1fdaf4=createListener(_0x2a41('0x5')+_0x4880e9,_0x54a9ea);PluginEvents['on'](_0x4880e9,_0x1fdaf4);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b53174a..0d13206 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 _0xd57d=['isAuthenticated','index','/:id','post','create','put','update','destroy','exports','express','../../components/auth/service','./pm2.controller','get'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xd57d,0xf3));var _0xdd57=function(_0x195ae3,_0x421775){_0x195ae3=_0x195ae3-0x0;var _0x29b5d7=_0xd57d[_0x195ae3];return _0x29b5d7;};'use strict';var express=require(_0xdd57('0x0'));var router=express['Router']();var auth=require(_0xdd57('0x1'));var controller=require(_0xdd57('0x2'));router[_0xdd57('0x3')]('/',auth[_0xdd57('0x4')](),controller[_0xdd57('0x5')]);router[_0xdd57('0x3')](_0xdd57('0x6'),auth[_0xdd57('0x4')](),controller['show']);router[_0xdd57('0x7')]('/',auth['isAuthenticated'](),controller[_0xdd57('0x8')]);router[_0xdd57('0x9')]('/:id',auth[_0xdd57('0x4')](),controller[_0xdd57('0xa')]);router['delete']('/:id',auth[_0xdd57('0x4')](),controller[_0xdd57('0xb')]);module[_0xdd57('0xc')]=router; \ No newline at end of file +var _0xdc58=['put','/:id','delete','destroy','exports','express','Router','get','isAuthenticated','index','show','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdc58,0x71));var _0x8dc5=function(_0x42d10b,_0x562a22){_0x42d10b=_0x42d10b-0x0;var _0x256d90=_0xdc58[_0x42d10b];return _0x256d90;};'use strict';var express=require(_0x8dc5('0x0'));var router=express[_0x8dc5('0x1')]();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0x8dc5('0x2')]('/',auth[_0x8dc5('0x3')](),controller[_0x8dc5('0x4')]);router['get']('/:id',auth[_0x8dc5('0x3')](),controller[_0x8dc5('0x5')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8dc5('0x6')]);router[_0x8dc5('0x7')](_0x8dc5('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x8dc5('0x9')]('/:id',auth[_0x8dc5('0x3')](),controller[_0x8dc5('0xa')]);module[_0x8dc5('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 3a70b9a..3049171 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 _0xbeb4=['motion2','length','show','describe','params','catch','create','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','send','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','child_process','exec','sendStatus','json','name','status','npm\x20install','error','list','then','reject','express'];(function(_0x9f5ee9,_0x146d7a){var _0xb6130d=function(_0x566b35){while(--_0x566b35){_0x9f5ee9['push'](_0x9f5ee9['shift']());}};_0xb6130d(++_0x146d7a);}(_0xbeb4,0x181));var _0x4beb=function(_0x2f180f,_0x2110e5){_0x2f180f=_0x2f180f-0x0;var _0x447977=_0xbeb4[_0x2f180f];return _0x447977;};'use strict';var _=require(_0x4beb('0x0'));var pm2=require(_0x4beb('0x1'));var logger=require('../../config/logger')(_0x4beb('0x2'));var path=require('path');var exec=require(_0x4beb('0x3'))[_0x4beb('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x206de9,_0x468fc0){return function(_0x42ef24){if(!_0x42ef24){_0x206de9[_0x4beb('0x5')](0x194);;}return _0x42ef24;};}function respondWithResult(_0xc35f45,_0x425fe1){_0x425fe1=_0x425fe1||0xc8;return function(_0x5b99c1){if(_0x5b99c1){return _0xc35f45['status'](_0x425fe1)[_0x4beb('0x6')](_0x5b99c1);}return null;};}function handleError(_0x106031,_0xd5c337){_0xd5c337=_0xd5c337||0x1f4;return function(_0x6e0bcf){logger['error'](_0x6e0bcf['stack']);if(_0x6e0bcf[_0x4beb('0x7')]){delete _0x6e0bcf[_0x4beb('0x7')];}_0x106031[_0x4beb('0x8')](_0xd5c337)['send'](_0x6e0bcf);};}function execChildProcess(){return new BPromise(function(_0x5cee5b,_0x773165){exec(_0x4beb('0x9'),function(_0xc84cab,_0x5c223e,_0x554465){logger['info'](_0x5c223e);logger['info'](_0x554465);if(_0xc84cab){logger[_0x4beb('0xa')](_0xc84cab);return _0x773165(_0xc84cab);}return _0x5cee5b(_0x5c223e);});});}exports['index']=function(_0x21d8cc,_0x385ed7){return pm2[_0x4beb('0xb')]()[_0x4beb('0xc')](function(_0x2d5752){if(_0x2d5752){var _0x13a055=_[_0x4beb('0xd')](_0x2d5752,function(_0x2078b5){return _0x2078b5[_0x4beb('0x7')]===_0x4beb('0xe')||_0x2078b5[_0x4beb('0x7')]===_0x4beb('0xf');});return{'rows':_0x13a055,'count':_0x13a055[_0x4beb('0x10')]};}return null;})[_0x4beb('0xc')](respondWithResult(_0x385ed7,null))['catch'](handleError(_0x385ed7,null));};exports[_0x4beb('0x11')]=function(_0x56ea87,_0x3eeb6f){return pm2[_0x4beb('0x12')](_0x56ea87[_0x4beb('0x13')]['id'])[_0x4beb('0xc')](respondWithResult(_0x3eeb6f,null))['then'](handleEntityNotFound(_0x3eeb6f,null))[_0x4beb('0x14')](handleError(_0x3eeb6f,null));};exports[_0x4beb('0x15')]=function(_0x2c97e0,_0x3cb530){if(_0x2c97e0[_0x4beb('0x16')][_0x4beb('0x7')]&&_0x2c97e0[_0x4beb('0x16')][_0x4beb('0x17')]){var _0x4bfc65=path[_0x4beb('0x18')](__dirname,_0x4beb('0x19'),_0x2c97e0[_0x4beb('0x16')][_0x4beb('0x17')]);var _0x4c23b7=process[_0x4beb('0x1a')]();process['chdir'](path[_0x4beb('0x1b')](_0x4bfc65));return execChildProcess()['then'](function(_0x3c2baa){process[_0x4beb('0x1c')](_0x4c23b7);return pm2[_0x4beb('0x1d')]({'name':_0x2c97e0[_0x4beb('0x16')][_0x4beb('0x7')],'script':_0x4bfc65});})['then'](function(_0x5644f1){pm2[_0x4beb('0x1e')]();return _0x5644f1[0x0];})[_0x4beb('0xc')](respondWithResult(_0x3cb530,0xc9))[_0x4beb('0x14')](handleError(_0x3cb530,null));}else{return _0x3cb530[_0x4beb('0x8')](0x1f4)[_0x4beb('0x1f')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x4beb('0x20')]=function(_0x56855f,_0x59bdb2){if(_0x56855f['body']['id']){delete _0x56855f[_0x4beb('0x16')]['id'];}var _0x2e0efe={'online':_0x4beb('0x21'),'stopped':_0x4beb('0x22')};if(_0x2e0efe[_0x4beb('0x23')](_0x56855f[_0x4beb('0x16')]['status'])){return pm2[_0x2e0efe[_0x56855f[_0x4beb('0x16')][_0x4beb('0x8')]]](_0x56855f[_0x4beb('0x13')]['id'])[_0x4beb('0xc')](respondWithResult(_0x59bdb2,0xc8))[_0x4beb('0x14')](handleError(_0x59bdb2,null));}else{return _0x59bdb2['status'](0x1f4)[_0x4beb('0x1f')]({'message':_0x4beb('0x24')});}};exports[_0x4beb('0x25')]=function(_0xb9af42,_0xca968c){if(_0xb9af42['body']['id']){delete _0xb9af42[_0x4beb('0x16')]['id'];}if(_0xb9af42[_0x4beb('0x13')]['id']){return pm2[_0x4beb('0x26')](_0xb9af42[_0x4beb('0x13')]['id'])['then'](function(_0x2b4e7b){pm2['dump']();return _0x2b4e7b[0x0];})[_0x4beb('0xc')](respondWithResult(_0xca968c,null))['catch'](handleError(_0xca968c,null));}else{return _0xca968c[_0x4beb('0x8')](0x1f4)['send']({'message':_0x4beb('0x27')});}}; \ No newline at end of file +var _0x0267=['express','motion2','catch','describe','body','script','../../files/plugins','chdir','dirname','dump','update','restart','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0x0267,0x1d9));var _0x7026=function(_0x4dfa39,_0x5c0e07){_0x4dfa39=_0x4dfa39-0x0;var _0x2c5c38=_0x0267[_0x4dfa39];return _0x2c5c38;};'use strict';var _=require('lodash');var pm2=require(_0x7026('0x0'));var logger=require(_0x7026('0x1'))(_0x7026('0x2'));var path=require(_0x7026('0x3'));var exec=require(_0x7026('0x4'))[_0x7026('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0xacc7d8,_0x49a35f){return function(_0x317064){if(!_0x317064){_0xacc7d8[_0x7026('0x6')](0x194);;}return _0x317064;};}function respondWithResult(_0x590d1c,_0x1d2bad){_0x1d2bad=_0x1d2bad||0xc8;return function(_0x322cdb){if(_0x322cdb){return _0x590d1c[_0x7026('0x7')](_0x1d2bad)['json'](_0x322cdb);}return null;};}function handleError(_0x381f60,_0x24e3e5){_0x24e3e5=_0x24e3e5||0x1f4;return function(_0x36d77c){logger[_0x7026('0x8')](_0x36d77c[_0x7026('0x9')]);if(_0x36d77c[_0x7026('0xa')]){delete _0x36d77c[_0x7026('0xa')];}_0x381f60[_0x7026('0x7')](_0x24e3e5)[_0x7026('0xb')](_0x36d77c);};}function execChildProcess(){return new BPromise(function(_0x2f8134,_0x20ed8c){exec(_0x7026('0xc'),function(_0x1a95c2,_0xd594e8,_0x223b87){logger[_0x7026('0xd')](_0xd594e8);logger['info'](_0x223b87);if(_0x1a95c2){logger[_0x7026('0x8')](_0x1a95c2);return _0x20ed8c(_0x1a95c2);}return _0x2f8134(_0xd594e8);});});}exports[_0x7026('0xe')]=function(_0x33053d,_0xbd782){return pm2[_0x7026('0xf')]()[_0x7026('0x10')](function(_0x27bd2c){if(_0x27bd2c){var _0x41c54b=_['reject'](_0x27bd2c,function(_0x2e099a){return _0x2e099a[_0x7026('0xa')]===_0x7026('0x11')||_0x2e099a[_0x7026('0xa')]===_0x7026('0x12');});return{'rows':_0x41c54b,'count':_0x41c54b['length']};}return null;})[_0x7026('0x10')](respondWithResult(_0xbd782,null))[_0x7026('0x13')](handleError(_0xbd782,null));};exports['show']=function(_0x32385c,_0x26209e){return pm2[_0x7026('0x14')](_0x32385c['params']['id'])[_0x7026('0x10')](respondWithResult(_0x26209e,null))[_0x7026('0x10')](handleEntityNotFound(_0x26209e,null))[_0x7026('0x13')](handleError(_0x26209e,null));};exports['create']=function(_0x1ceea2,_0x265cfa){if(_0x1ceea2[_0x7026('0x15')][_0x7026('0xa')]&&_0x1ceea2[_0x7026('0x15')][_0x7026('0x16')]){var _0x17a299=path['join'](__dirname,_0x7026('0x17'),_0x1ceea2[_0x7026('0x15')][_0x7026('0x16')]);var _0x24a021=process['cwd']();process[_0x7026('0x18')](path[_0x7026('0x19')](_0x17a299));return execChildProcess()[_0x7026('0x10')](function(_0x4f6320){process[_0x7026('0x18')](_0x24a021);return pm2['start']({'name':_0x1ceea2[_0x7026('0x15')]['name'],'script':_0x17a299});})[_0x7026('0x10')](function(_0x128af6){pm2[_0x7026('0x1a')]();return _0x128af6[0x0];})['then'](respondWithResult(_0x265cfa,0xc9))[_0x7026('0x13')](handleError(_0x265cfa,null));}else{return _0x265cfa[_0x7026('0x7')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x7026('0x1b')]=function(_0x27b9b7,_0x513cf6){if(_0x27b9b7[_0x7026('0x15')]['id']){delete _0x27b9b7[_0x7026('0x15')]['id'];}var _0x4a89c5={'online':_0x7026('0x1c'),'stopped':'stop'};if(_0x4a89c5[_0x7026('0x1d')](_0x27b9b7[_0x7026('0x15')][_0x7026('0x7')])){return pm2[_0x4a89c5[_0x27b9b7[_0x7026('0x15')][_0x7026('0x7')]]](_0x27b9b7[_0x7026('0x1e')]['id'])['then'](respondWithResult(_0x513cf6,0xc8))[_0x7026('0x13')](handleError(_0x513cf6,null));}else{return _0x513cf6[_0x7026('0x7')](0x1f4)[_0x7026('0xb')]({'message':_0x7026('0x1f')});}};exports[_0x7026('0x20')]=function(_0x3da779,_0x370894){if(_0x3da779[_0x7026('0x15')]['id']){delete _0x3da779[_0x7026('0x15')]['id'];}if(_0x3da779[_0x7026('0x1e')]['id']){return pm2[_0x7026('0x21')](_0x3da779[_0x7026('0x1e')]['id'])[_0x7026('0x10')](function(_0x5df6b2){pm2[_0x7026('0x1a')]();return _0x5df6b2[0x0];})[_0x7026('0x10')](respondWithResult(_0x370894,null))[_0x7026('0x13')](handleError(_0x370894,null));}else{return _0x370894[_0x7026('0x7')](0x1f4)['send']({'message':_0x7026('0x22')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 142734e..ffed358 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 _0xb827=['util','express','exports','multer'];(function(_0x35408d,_0x58b803){var _0x25af9a=function(_0x37959e){while(--_0x37959e){_0x35408d['push'](_0x35408d['shift']());}};_0x25af9a(++_0x58b803);}(_0xb827,0xc7));var _0x7b82=function(_0x50a0f8,_0x27c0fb){_0x50a0f8=_0x50a0f8-0x0;var _0x52e53d=_0xb827[_0x50a0f8];return _0x52e53d;};'use strict';var multer=require(_0x7b82('0x0'));var util=require(_0x7b82('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7b82('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x7b82('0x3')]=router; \ No newline at end of file +var _0x43ea=['../../components/interaction/service','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x16b6fb,_0x7c304f){var _0x13527d=function(_0x1998a8){while(--_0x1998a8){_0x16b6fb['push'](_0x16b6fb['shift']());}};_0x13527d(++_0x7c304f);}(_0x43ea,0x1c2));var _0xa43e=function(_0x4656bb,_0x2c4488){_0x4656bb=_0x4656bb-0x0;var _0xc61fa9=_0x43ea[_0x4656bb];return _0xc61fa9;};'use strict';var multer=require(_0xa43e('0x0'));var util=require('util');var path=require(_0xa43e('0x1'));var timeout=require(_0xa43e('0x2'));var express=require(_0xa43e('0x3'));var router=express['Router']();var auth=require(_0xa43e('0x4'));var interaction=require(_0xa43e('0x5'));var config=require('../../config/environment');module[_0xa43e('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index fb966e2..50c0cdf 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 _0x7980=['STRING','sequelize','exports','INTEGER','DATE'];(function(_0xe6c1c5,_0x4a8df3){var _0x2eb3bd=function(_0xbaa3c1){while(--_0xbaa3c1){_0xe6c1c5['push'](_0xe6c1c5['shift']());}};_0x2eb3bd(++_0x4a8df3);}(_0x7980,0x137));var _0x0798=function(_0x29220e,_0x449b05){_0x29220e=_0x29220e-0x0;var _0x54aed0=_0x7980[_0x29220e];return _0x54aed0;};'use strict';var Sequelize=require(_0x0798('0x0'));module[_0x0798('0x1')]={'state':{'type':Sequelize[_0x0798('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0798('0x3')]},'uniqueid':{'type':Sequelize[_0x0798('0x4')]},'starttime':{'type':Sequelize[_0x0798('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0798('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0798('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0798('0x4')]}}; \ No newline at end of file +var _0x82d0=['sequelize','INTEGER','STRING','DATE'];(function(_0x1fdfdc,_0xba7922){var _0x4f0656=function(_0xeb4703){while(--_0xeb4703){_0x1fdfdc['push'](_0x1fdfdc['shift']());}};_0x4f0656(++_0xba7922);}(_0x82d0,0xb4));var _0x082d=function(_0x3a6b78,_0x2d62be){_0x3a6b78=_0x3a6b78-0x0;var _0x4943d4=_0x82d0[_0x3a6b78];return _0x4943d4;};'use strict';var Sequelize=require(_0x082d('0x0'));module['exports']={'state':{'type':Sequelize[_0x082d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x082d('0x2')]},'scheduledat':{'type':Sequelize[_0x082d('0x3')]},'uniqueid':{'type':Sequelize[_0x082d('0x2')]},'starttime':{'type':Sequelize[_0x082d('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x082d('0x2')]},'campaigntype':{'type':Sequelize[_0x082d('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 ca2d58b..0d94eee 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 _0x1854=['request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api'];(function(_0x31ef02,_0x50674d){var _0x44ab88=function(_0x40c222){while(--_0x40c222){_0x31ef02['push'](_0x31ef02['shift']());}};_0x44ab88(++_0x50674d);}(_0x1854,0x188));var _0x4185=function(_0x37e342,_0x160c8f){_0x37e342=_0x37e342-0x0;var _0x1768f9=_0x1854[_0x37e342];return _0x1768f9;};'use strict';var _=require(_0x4185('0x0'));var util=require(_0x4185('0x1'));var logger=require(_0x4185('0x2'))(_0x4185('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4185('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4185('0x5'));var config=require(_0x4185('0x6'));var attributes=require(_0x4185('0x7'));module['exports']=function(_0x4cf5aa,_0x5e285c){return _0x4cf5aa[_0x4185('0x8')](_0x4185('0x9'),attributes,{'tableName':_0x4185('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd79b=['path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc8a692,_0x579320){var _0x5055d8=function(_0x528459){while(--_0x528459){_0xc8a692['push'](_0xc8a692['shift']());}};_0x5055d8(++_0x579320);}(_0xd79b,0xf5));var _0xbd79=function(_0x10e385,_0x3ae335){_0x10e385=_0x10e385-0x0;var _0x32f4c2=_0xd79b[_0x10e385];return _0x32f4c2;};'use strict';var _=require(_0xbd79('0x0'));var util=require(_0xbd79('0x1'));var logger=require(_0xbd79('0x2'))(_0xbd79('0x3'));var moment=require(_0xbd79('0x4'));var BPromise=require(_0xbd79('0x5'));var rp=require(_0xbd79('0x6'));var fs=require('fs');var path=require(_0xbd79('0x7'));var rimraf=require(_0xbd79('0x8'));var config=require(_0xbd79('0x9'));var attributes=require(_0xbd79('0xa'));module['exports']=function(_0x39d41f,_0x2ada9d){return _0x39d41f[_0xbd79('0xb')](_0xbd79('0xc'),attributes,{'tableName':_0xbd79('0xd'),'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 2ed47d6..39045ec 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 _0x49d0=['options','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body'];(function(_0x36ab21,_0x44b7c0){var _0x1da5a6=function(_0x168519){while(--_0x168519){_0x36ab21['push'](_0x36ab21['shift']());}};_0x1da5a6(++_0x44b7c0);}(_0x49d0,0x136));var _0x049d=function(_0x557280,_0x5d138e){_0x557280=_0x557280-0x0;var _0x1dcac3=_0x49d0[_0x557280];return _0x1dcac3;};'use strict';var _=require('lodash');var util=require(_0x049d('0x0'));var moment=require(_0x049d('0x1'));var BPromise=require(_0x049d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x049d('0x3'));var db=require(_0x049d('0x4'))['db'];var utils=require(_0x049d('0x5'));var logger=require(_0x049d('0x6'))(_0x049d('0x7'));var config=require('../../config/environment');var jayson=require(_0x049d('0x8'));var client=jayson[_0x049d('0x9')][_0x049d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f34e0,_0x15b767,_0x151a81){return new BPromise(function(_0x26cd24,_0x3efc82){return client[_0x049d('0xb')](_0x2f34e0,_0x151a81)['then'](function(_0xff4a91){logger['info'](_0x049d('0xc'),_0x15b767,'request\x20sent');logger[_0x049d('0xd')](_0x049d('0xe'),_0x15b767,_0x049d('0xf'),JSON['stringify'](_0xff4a91));if(_0xff4a91[_0x049d('0x10')]){if(_0xff4a91[_0x049d('0x10')][_0x049d('0x11')]===0x1f4){logger[_0x049d('0x10')](_0x049d('0xc'),_0x15b767,_0xff4a91[_0x049d('0x10')][_0x049d('0x12')]);return _0x3efc82(_0xff4a91[_0x049d('0x10')][_0x049d('0x12')]);}logger[_0x049d('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x15b767,_0xff4a91[_0x049d('0x10')][_0x049d('0x12')]);return _0x26cd24(_0xff4a91['error'][_0x049d('0x12')]);}else{logger[_0x049d('0x13')](_0x049d('0xc'),_0x15b767,_0x049d('0xf'));_0x26cd24(_0xff4a91[_0x049d('0x14')][_0x049d('0x12')]);}})[_0x049d('0x15')](function(_0x30c6a0){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x15b767,_0x30c6a0);_0x3efc82(_0x30c6a0);});});}exports[_0x049d('0x16')]=function(_0x3f365a){var _0x1c0b20=this;return new Promise(function(_0x19293c,_0x1fd213){return db[_0x049d('0x17')][_0x049d('0x18')](_0x3f365a[_0x049d('0x19')],{'raw':_0x3f365a[_0x049d('0x1a')]?_0x3f365a['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4a515b){logger[_0x049d('0x13')]('CreateReportAgentPreview',_0x3f365a);logger[_0x049d('0xd')](_0x049d('0x16'),_0x3f365a,JSON[_0x049d('0x1b')](_0x4a515b));_0x19293c(_0x4a515b);})[_0x049d('0x15')](function(_0x6c167a){logger['error'](_0x049d('0x16'),_0x6c167a[_0x049d('0x12')],_0x3f365a);_0x1fd213(_0x1c0b20['error'](0x1f4,_0x6c167a[_0x049d('0x12')]));});});}; \ No newline at end of file +var _0x0870=['create','body','options','raw','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','CreateReportAgentPreview'];(function(_0x3c2090,_0x4548fd){var _0x30ed8b=function(_0xddab49){while(--_0xddab49){_0x3c2090['push'](_0x3c2090['shift']());}};_0x30ed8b(++_0x4548fd);}(_0x0870,0x9c));var _0x0087=function(_0x51043d,_0x285da7){_0x51043d=_0x51043d-0x0;var _0x224034=_0x0870[_0x51043d];return _0x224034;};'use strict';var _=require('lodash');var util=require(_0x0087('0x0'));var moment=require(_0x0087('0x1'));var BPromise=require(_0x0087('0x2'));var rs=require(_0x0087('0x3'));var fs=require('fs');var Redis=require(_0x0087('0x4'));var db=require(_0x0087('0x5'))['db'];var utils=require(_0x0087('0x6'));var logger=require(_0x0087('0x7'))(_0x0087('0x8'));var config=require(_0x0087('0x9'));var jayson=require(_0x0087('0xa'));var client=jayson[_0x0087('0xb')][_0x0087('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ac6c6,_0xc944dc,_0x5a09b5){return new BPromise(function(_0x1aa697,_0x2c5a1f){return client[_0x0087('0xd')](_0x3ac6c6,_0x5a09b5)[_0x0087('0xe')](function(_0x3059cd){logger[_0x0087('0xf')](_0x0087('0x10'),_0xc944dc,_0x0087('0x11'));logger[_0x0087('0x12')](_0x0087('0x13'),_0xc944dc,_0x0087('0x11'),JSON['stringify'](_0x3059cd));if(_0x3059cd[_0x0087('0x14')]){if(_0x3059cd[_0x0087('0x14')]['code']===0x1f4){logger[_0x0087('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0xc944dc,_0x3059cd[_0x0087('0x14')]['message']);return _0x2c5a1f(_0x3059cd[_0x0087('0x14')][_0x0087('0x15')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xc944dc,_0x3059cd[_0x0087('0x14')][_0x0087('0x15')]);return _0x1aa697(_0x3059cd[_0x0087('0x14')][_0x0087('0x15')]);}else{logger[_0x0087('0xf')](_0x0087('0x10'),_0xc944dc,_0x0087('0x11'));_0x1aa697(_0x3059cd[_0x0087('0x16')][_0x0087('0x15')]);}})['catch'](function(_0x2d7224){logger['error'](_0x0087('0x10'),_0xc944dc,_0x2d7224);_0x2c5a1f(_0x2d7224);});});}exports[_0x0087('0x17')]=function(_0x39c2b8){var _0xfc61a4=this;return new Promise(function(_0x416b22,_0x159a99){return db['ReportAgentPreview'][_0x0087('0x18')](_0x39c2b8[_0x0087('0x19')],{'raw':_0x39c2b8[_0x0087('0x1a')]?_0x39c2b8[_0x0087('0x1a')][_0x0087('0x1b')]===undefined?!![]:![]:!![]})[_0x0087('0xe')](function(_0x2afd98){logger[_0x0087('0xf')](_0x0087('0x17'),_0x39c2b8);logger[_0x0087('0x12')](_0x0087('0x17'),_0x39c2b8,JSON[_0x0087('0x1c')](_0x2afd98));_0x416b22(_0x2afd98);})[_0x0087('0x1d')](function(_0x5d0979){logger[_0x0087('0x14')](_0x0087('0x17'),_0x5d0979['message'],_0x39c2b8);_0x159a99(_0xfc61a4[_0x0087('0x14')](0x1f4,_0x5d0979[_0x0087('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 03a44bb..ad53b1f 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 _0xe72f=['/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound/channels','outboundChannels','/agents','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','chat','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','util','path','express','../../components/auth/service','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','voiceQueuesPreview'];(function(_0x46e1a3,_0x3f2d9a){var _0x47b61d=function(_0x5e014f){while(--_0x5e014f){_0x46e1a3['push'](_0x46e1a3['shift']());}};_0x47b61d(++_0x3f2d9a);}(_0xe72f,0x74));var _0xfe72=function(_0x4da350,_0x1f6f09){_0x4da350=_0x4da350-0x0;var _0x430e1e=_0xe72f[_0x4da350];return _0x430e1e;};'use strict';var multer=require('multer');var util=require(_0xfe72('0x0'));var path=require(_0xfe72('0x1'));var express=require(_0xfe72('0x2'));var router=express['Router']();var auth=require(_0xfe72('0x3'));var controller=require(_0xfe72('0x4'));router[_0xfe72('0x5')]('/voice/channels',auth[_0xfe72('0x6')](),controller['voiceChannels']);router['get'](_0xfe72('0x7'),auth[_0xfe72('0x6')](),controller['voiceChannelMixMonitor']);router[_0xfe72('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xfe72('0x6')](),controller[_0xfe72('0x8')]);router[_0xfe72('0x5')]('/voice/queues',auth[_0xfe72('0x6')](),controller[_0xfe72('0x9')]);router[_0xfe72('0x5')](_0xfe72('0xa'),auth[_0xfe72('0x6')](),controller[_0xfe72('0xb')]);router[_0xfe72('0x5')](_0xfe72('0xc'),auth[_0xfe72('0x6')](),controller[_0xfe72('0xd')]);router[_0xfe72('0x5')]('/mail/accounts',auth[_0xfe72('0x6')](),controller['mailAccounts']);router['get'](_0xfe72('0xe'),auth[_0xfe72('0x6')](),controller[_0xfe72('0xf')]);router['get']('/sms/queues',auth[_0xfe72('0x6')](),controller[_0xfe72('0x10')]);router[_0xfe72('0x5')](_0xfe72('0x11'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x12')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth[_0xfe72('0x6')](),controller[_0xfe72('0x13')]);router[_0xfe72('0x5')](_0xfe72('0x14'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x15')]);router['get'](_0xfe72('0x16'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x17')]);router[_0xfe72('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xfe72('0x6')](),controller[_0xfe72('0x18')]);router[_0xfe72('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xfe72('0x6')](),controller[_0xfe72('0x19')]);router[_0xfe72('0x5')](_0xfe72('0x1a'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x1b')]);router[_0xfe72('0x5')]('/outbound',auth[_0xfe72('0x6')](),controller['outbound']);router[_0xfe72('0x5')](_0xfe72('0x1c'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x1d')]);router[_0xfe72('0x5')](_0xfe72('0x1e'),auth[_0xfe72('0x6')](),controller['agents']);router[_0xfe72('0x1f')](_0xfe72('0x20'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x21')]);router['get']('/telephones',auth[_0xfe72('0x6')](),controller[_0xfe72('0x22')]);router[_0xfe72('0x5')](_0xfe72('0x23'),auth['isAuthenticated'](),controller[_0xfe72('0x24')]);router[_0xfe72('0x5')](_0xfe72('0x25'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x26')]);router['get'](_0xfe72('0x27'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x28')]);router[_0xfe72('0x5')](_0xfe72('0x29'),auth[_0xfe72('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0xfe72('0x5')](_0xfe72('0x2a'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x2b')]);router[_0xfe72('0x5')]('/openchannel/queues/waitinginteractions',auth[_0xfe72('0x6')](),controller[_0xfe72('0x2c')]);router['get']('/sms/queues/waitinginteractions',auth[_0xfe72('0x6')](),controller[_0xfe72('0x2d')]);router['get'](_0xfe72('0x2e'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x2f')]);router[_0xfe72('0x5')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xfe72('0x30')]);router['post'](_0xfe72('0x31'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x32')](_0xfe72('0x33')));router[_0xfe72('0x5')](_0xfe72('0x34'),auth['isAuthenticated'](),controller[_0xfe72('0x35')]);router[_0xfe72('0x36')]('/chat/queues/:id/notify',auth[_0xfe72('0x6')](),controller[_0xfe72('0x32')](_0xfe72('0x37')));router[_0xfe72('0x5')]('/chat/queues/:id',auth[_0xfe72('0x6')](),controller['showChatQueues']);router['post'](_0xfe72('0x38'),auth['isAuthenticated'](),controller[_0xfe72('0x32')](_0xfe72('0x39')));router[_0xfe72('0x5')]('/fax/queues/:id',auth[_0xfe72('0x6')](),controller[_0xfe72('0x3a')]);router[_0xfe72('0x36')](_0xfe72('0x3b'),auth['isAuthenticated'](),controller[_0xfe72('0x32')](_0xfe72('0x3c')));router[_0xfe72('0x5')](_0xfe72('0x3d'),auth[_0xfe72('0x6')](),controller[_0xfe72('0x3e')]);router[_0xfe72('0x36')](_0xfe72('0x3f'),auth['isAuthenticated'](),controller[_0xfe72('0x32')]('sms'));router[_0xfe72('0x36')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xfe72('0x40')));router[_0xfe72('0x5')](_0xfe72('0x41'),auth[_0xfe72('0x6')](),controller['showSmsQueues']);router[_0xfe72('0x5')]('/whatsapp/queues/:id',auth[_0xfe72('0x6')](),controller[_0xfe72('0x42')]);router[_0xfe72('0x36')](_0xfe72('0x43'),auth[_0xfe72('0x6')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x65e1=['mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','post','fax','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions'];(function(_0x4ca141,_0x28c31a){var _0xd7b085=function(_0x11f5c2){while(--_0x11f5c2){_0x4ca141['push'](_0x4ca141['shift']());}};_0xd7b085(++_0x28c31a);}(_0x65e1,0xc0));var _0x165e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x65e1[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x165e('0x0'));var util=require(_0x165e('0x1'));var path=require(_0x165e('0x2'));var express=require(_0x165e('0x3'));var router=express[_0x165e('0x4')]();var auth=require(_0x165e('0x5'));var controller=require(_0x165e('0x6'));router[_0x165e('0x7')](_0x165e('0x8'),auth[_0x165e('0x9')](),controller['voiceChannels']);router[_0x165e('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x165e('0x9')](),controller[_0x165e('0xa')]);router[_0x165e('0x7')](_0x165e('0xb'),auth[_0x165e('0x9')](),controller[_0x165e('0xc')]);router[_0x165e('0x7')](_0x165e('0xd'),auth[_0x165e('0x9')](),controller[_0x165e('0xe')]);router[_0x165e('0x7')]('/chat/queues',auth['isAuthenticated'](),controller[_0x165e('0xf')]);router[_0x165e('0x7')]('/mail/queues',auth[_0x165e('0x9')](),controller[_0x165e('0x10')]);router[_0x165e('0x7')](_0x165e('0x11'),auth[_0x165e('0x9')](),controller[_0x165e('0x12')]);router[_0x165e('0x7')](_0x165e('0x13'),auth['isAuthenticated'](),controller[_0x165e('0x14')]);router[_0x165e('0x7')](_0x165e('0x15'),auth[_0x165e('0x9')](),controller[_0x165e('0x16')]);router[_0x165e('0x7')](_0x165e('0x17'),auth[_0x165e('0x9')](),controller[_0x165e('0x18')]);router['get'](_0x165e('0x19'),auth[_0x165e('0x9')](),controller[_0x165e('0x1a')]);router[_0x165e('0x7')](_0x165e('0x1b'),auth['isAuthenticated'](),controller[_0x165e('0x1c')]);router[_0x165e('0x7')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x165e('0x1d')]);router[_0x165e('0x7')]('/voice/queues/channels/:uniqueid',auth[_0x165e('0x9')](),controller[_0x165e('0x1e')]);router[_0x165e('0x7')](_0x165e('0x1f'),auth[_0x165e('0x9')](),controller[_0x165e('0x20')]);router['get'](_0x165e('0x21'),auth[_0x165e('0x9')](),controller[_0x165e('0x22')]);router[_0x165e('0x7')](_0x165e('0x23'),auth['isAuthenticated'](),controller[_0x165e('0x24')]);router[_0x165e('0x7')](_0x165e('0x25'),auth[_0x165e('0x9')](),controller[_0x165e('0x26')]);router[_0x165e('0x7')](_0x165e('0x27'),auth[_0x165e('0x9')](),controller[_0x165e('0x28')]);router[_0x165e('0x7')](_0x165e('0x29'),auth['isAuthenticated'](),controller[_0x165e('0x2a')]);router[_0x165e('0x2b')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x165e('0x2c')]);router['get'](_0x165e('0x2d'),auth['isAuthenticated'](),controller['telephones']);router['get'](_0x165e('0x2e'),auth[_0x165e('0x9')](),controller[_0x165e('0x2f')]);router[_0x165e('0x7')](_0x165e('0x30'),auth[_0x165e('0x9')](),controller[_0x165e('0x31')]);router[_0x165e('0x7')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x165e('0x32')]);router[_0x165e('0x7')](_0x165e('0x33'),auth[_0x165e('0x9')](),controller[_0x165e('0x34')]);router[_0x165e('0x7')](_0x165e('0x35'),auth[_0x165e('0x9')](),controller[_0x165e('0x36')]);router[_0x165e('0x7')](_0x165e('0x37'),auth['isAuthenticated'](),controller[_0x165e('0x38')]);router[_0x165e('0x7')](_0x165e('0x39'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x165e('0x7')](_0x165e('0x3a'),auth[_0x165e('0x9')](),controller[_0x165e('0x3b')]);router[_0x165e('0x7')](_0x165e('0x3c'),auth[_0x165e('0x9')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x165e('0x3d'),auth[_0x165e('0x9')](),controller[_0x165e('0x3e')](_0x165e('0x3f')));router['get']('/mail/queues/:id',auth[_0x165e('0x9')](),controller['showMailQueues']);router['post'](_0x165e('0x40'),auth[_0x165e('0x9')](),controller[_0x165e('0x3e')](_0x165e('0x41')));router['get'](_0x165e('0x42'),auth[_0x165e('0x9')](),controller[_0x165e('0x43')]);router[_0x165e('0x44')]('/fax/queues/:id/notify',auth[_0x165e('0x9')](),controller[_0x165e('0x3e')](_0x165e('0x45')));router[_0x165e('0x7')]('/fax/queues/:id',auth[_0x165e('0x9')](),controller[_0x165e('0x46')]);router['post']('/openchannel/queues/:id/notify',auth[_0x165e('0x9')](),controller[_0x165e('0x3e')](_0x165e('0x47')));router[_0x165e('0x7')](_0x165e('0x48'),auth['isAuthenticated'](),controller[_0x165e('0x49')]);router['post'](_0x165e('0x4a'),auth[_0x165e('0x9')](),controller['queueNotify'](_0x165e('0x4b')));router[_0x165e('0x44')](_0x165e('0x4c'),auth[_0x165e('0x9')](),controller[_0x165e('0x3e')](_0x165e('0x4d')));router['get'](_0x165e('0x4e'),auth[_0x165e('0x9')](),controller[_0x165e('0x4f')]);router[_0x165e('0x7')]('/whatsapp/queues/:id',auth[_0x165e('0x9')](),controller['showWhatsappQueues']);router['post'](_0x165e('0x50'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x165e('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 13c328f..b024170 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 _0x1451=['hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','\x20Queue\x20not\x20found','findOne','messageId','Interaction','update','queue','MessageId','QueueId','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','\x20Message\x20not\x20found','InteractionId','TransferReport','agent','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','name','isNil','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user'];(function(_0x3efed6,_0xccd8a8){var _0x1ad423=function(_0x22283b){while(--_0x22283b){_0x3efed6['push'](_0x3efed6['shift']());}};_0x1ad423(++_0xccd8a8);}(_0x1451,0x193));var _0x1145=function(_0x3a175b,_0x505d13){_0x3a175b=_0x3a175b-0x0;var _0x9b84fa=_0x1451[_0x3a175b];return _0x9b84fa;};'use strict';var BPromise=require(_0x1145('0x0'));var moment=require(_0x1145('0x1'));var _=require('lodash');var util=require(_0x1145('0x2'));var db=require(_0x1145('0x3'))['db'];var logger=require(_0x1145('0x4'))(_0x1145('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1145('0x6')][_0x1145('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client'][_0x1145('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x506a5e,_0x130155,_0x4a14b7){return new BPromise(function(_0x140006,_0x1793d3){var _0x4ea0f0=_0x4a14b7?_0x4a14b7:amiClient;return _0x4ea0f0[_0x1145('0x8')](_0x506a5e,_0x130155)[_0x1145('0x9')](function(_0x4eb678){if(_0x4eb678[_0x1145('0xa')]){if(_0x4eb678[_0x1145('0xa')][_0x1145('0xb')]===0x1f4){return _0x1793d3(_0x4eb678[_0x1145('0xa')][_0x1145('0xc')]);}return _0x140006(_0x4eb678[_0x1145('0xa')][_0x1145('0xc')]);}else{_0x140006(_0x4eb678[_0x1145('0xd')]);}})[_0x1145('0xe')](function(_0x184702){_0x1793d3(_0x184702);});});}function respondWithResult(_0x2adc31,_0x48a972){_0x48a972=_0x48a972||0xc8;return function(_0x3fca1c){if(_0x3fca1c){return _0x2adc31[_0x1145('0xf')](_0x48a972)[_0x1145('0x10')](_0x3fca1c);}return _0x2adc31[_0x1145('0x11')](0x194);};}function handleError(_0x202e98,_0x2bd417){_0x2bd417=_0x2bd417||0x1f4;return function(_0x26ed9f){logger[_0x1145('0xa')](_0x26ed9f['stack']);if(_0x26ed9f['name']){delete _0x26ed9f[_0x1145('0x12')];}_0x202e98['status'](_0x2bd417)['send'](_0x26ed9f);};}function findById(_0x50984d){return function(_0x52c79c){if(!_[_0x1145('0x13')](_0x50984d)&&!_['isNil'](_0x52c79c)&&!_['isNil'](_0x52c79c['rows'])){return _[_0x1145('0x14')](_0x52c79c['rows'],function(_0x31c9ed){return _0x31c9ed['id']==_0x50984d;});}return null;};}exports[_0x1145('0x15')]=function(_0x5e4e93,_0x403e6b){return respondWithRpcPromise(_0x1145('0x16'),_0x5e4e93[_0x1145('0x17')])[_0x1145('0x9')](respondWithResult(_0x403e6b,null))['catch'](handleError(_0x403e6b,null));};exports[_0x1145('0x18')]=function(_0x1ce483,_0x33a757){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x1145('0x19')](_0x1ce483[_0x1145('0x17')],_0x1ce483['params']))[_0x1145('0x9')](respondWithResult(_0x33a757,null))[_0x1145('0xe')](handleError(_0x33a757,null));};exports[_0x1145('0x1a')]=function(_0x38ef17,_0x363855){return respondWithRpcPromise(_0x1145('0x1b'),_['merge'](_0x38ef17[_0x1145('0x17')],_0x38ef17[_0x1145('0x1c')]))[_0x1145('0x9')](respondWithResult(_0x363855,null))['catch'](handleError(_0x363855,null));};exports[_0x1145('0x1d')]=function(_0x3923e9,_0x3848e0){return respondWithRpcPromise(_0x1145('0x1e'),_0x3923e9[_0x1145('0x17')])[_0x1145('0x9')](respondWithResult(_0x3848e0,null))[_0x1145('0xe')](handleError(_0x3848e0,null));};exports['showVoiceQueues']=function(_0x4fa22,_0x4ae08d){return respondWithRpcPromise('VoiceQueues',_0x4fa22['query'])[_0x1145('0x9')](findById(_0x4fa22[_0x1145('0x1c')]['id']))['then'](respondWithResult(_0x4ae08d,null))['catch'](handleError(_0x4ae08d,null));};exports[_0x1145('0x1f')]=function(_0x372b88,_0x1e8659){return respondWithRpcPromise(_0x1145('0x20'),_[_0x1145('0x19')](_0x372b88[_0x1145('0x17')],_0x372b88[_0x1145('0x1c')]))[_0x1145('0x9')](respondWithResult(_0x1e8659,null))[_0x1145('0xe')](handleError(_0x1e8659,null));};exports['voiceQueuesChannels']=function(_0x5a8e96,_0x422632){return respondWithRpcPromise(_0x1145('0x21'),_0x5a8e96[_0x1145('0x17')])['then'](respondWithResult(_0x422632,null))[_0x1145('0xe')](handleError(_0x422632,null));};exports[_0x1145('0x22')]=function(_0x39e20f,_0x178e34){return respondWithRpcPromise(_0x1145('0x23'),_[_0x1145('0x19')](_0x39e20f['query'],_0x39e20f[_0x1145('0x1c')]))['then'](respondWithResult(_0x178e34,null))[_0x1145('0xe')](handleError(_0x178e34,null));};exports['voiceQueuesChannelHangup']=function(_0x176de0,_0xe6f35){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x1145('0x19')](_0x176de0[_0x1145('0x17')],_0x176de0[_0x1145('0x1c')]))[_0x1145('0x9')](respondWithResult(_0xe6f35,null))[_0x1145('0xe')](handleError(_0xe6f35,null));};exports['voiceQueuesChannelRedirect']=function(_0xfb3cb7,_0x540bb8){return respondWithRpcPromise(_0x1145('0x24'),_['merge'](_0xfb3cb7['query'],_0xfb3cb7['params']))['then'](respondWithResult(_0x540bb8,null))['catch'](handleError(_0x540bb8,null));};exports[_0x1145('0x25')]=function(_0x4c078a,_0x5e9e45){return respondWithRpcPromise('Outbound',_0x4c078a['query'])[_0x1145('0x9')](respondWithResult(_0x5e9e45,null))[_0x1145('0xe')](handleError(_0x5e9e45,null));};exports[_0x1145('0x26')]=function(_0x176831,_0x477467){return respondWithRpcPromise(_0x1145('0x27'),_0x176831['query'])['then'](respondWithResult(_0x477467,null))[_0x1145('0xe')](handleError(_0x477467,null));};exports['agents']=function(_0x4a5d9e,_0x266a69){var _0x121fc5;return respondWithRpcPromise('Agents',_0x4a5d9e['query'])[_0x1145('0x9')](function(_0xf2d1d2){_0x121fc5=_0xf2d1d2;return respondWithRpcPromise(_0x1145('0x28'),_0x4a5d9e[_0x1145('0x17')],routingClient);})['then'](function(_0x1e0813){return _[_0x1145('0x19')]({},_0x1e0813,_0x121fc5);})[_0x1145('0x9')](respondWithResult(_0x266a69,null))[_0x1145('0xe')](handleError(_0x266a69,null));};exports[_0x1145('0x29')]=function(_0x2ad3f9,_0x2fc17a){if(_0x2ad3f9[_0x1145('0x2a')]&&_0x2ad3f9['body'][_0x1145('0x2b')]&&_0x2ad3f9['user']&&_0x2ad3f9[_0x1145('0x2c')][_0x1145('0x12')]){for(var _0x55a988 in _0x2ad3f9[_0x1145('0x2a')]['interaction']){if(_0x2ad3f9[_0x1145('0x2a')]['interaction'][_0x1145('0x2d')](_0x55a988)){db[_0x1145('0x2e')][_0x1145('0x2f')]({'where':{'channel':_0x55a988,'membername':_0x2ad3f9[_0x1145('0x2c')][_0x1145('0x12')],'type':_0x1145('0x30'),'exitAt':null,'uniqueid':_0x2ad3f9[_0x1145('0x2a')][_0x1145('0x2b')][_0x55a988]&&_0x2ad3f9[_0x1145('0x2a')][_0x1145('0x2b')][_0x55a988][_0x1145('0x31')]?{'$notIn':_0x2ad3f9[_0x1145('0x2a')][_0x1145('0x2b')][_0x55a988]}:{'$ne':null}}})[_0x1145('0x9')](function(_0x569d65){var _0x3f2238=moment()[_0x1145('0x32')](_0x1145('0x33'));for(var _0x3a524e=0x0,_0xb95ae2=_0x569d65['length'];_0x3a524e<_0xb95ae2;_0x3a524e+=0x1){_0x569d65[_0x3a524e][_0x1145('0x34')]({'exitAt':_0x3f2238});}});for(var _0x29cc91=0x0;_0x29cc91<_0x2ad3f9['body'][_0x1145('0x2b')][_0x55a988][_0x1145('0x31')];_0x29cc91+=0x1){db[_0x1145('0x2e')][_0x1145('0x35')]({'where':{'channel':_0x55a988,'membername':_0x2ad3f9[_0x1145('0x2c')][_0x1145('0x12')],'type':_0x1145('0x30'),'uniqueid':_0x2ad3f9['body'][_0x1145('0x2b')][_0x55a988][_0x29cc91],'exitAt':null},'defaults':{'channel':_0x55a988,'membername':_0x2ad3f9['user']['name'],'interface':_[_0x1145('0x13')](_0x2ad3f9['user'][_0x1145('0x36')])?util[_0x1145('0x32')](_0x1145('0x37'),_0x2ad3f9[_0x1145('0x2c')][_0x1145('0x12')]):_0x2ad3f9['user'][_0x1145('0x36')],'type':_0x1145('0x30'),'enterAt':moment()[_0x1145('0x32')](_0x1145('0x33')),'role':'agent','internal':_0x2ad3f9[_0x1145('0x2c')][_0x1145('0x38')],'uniqueid':_0x2ad3f9['body']['interaction'][_0x55a988][_0x29cc91]}});}}}}return respondWithRpcPromise(_0x1145('0x39'),{'id':_0x2ad3f9[_0x1145('0x1c')]['id'],'capacity':_0x2ad3f9[_0x1145('0x2a')][_0x1145('0x3a')]},routingClient)[_0x1145('0x9')](respondWithResult(_0x2fc17a,null))[_0x1145('0xe')](handleError(_0x2fc17a,null));};exports[_0x1145('0x3b')]=function(_0x37b5d8,_0x227d79){return respondWithRpcPromise(_0x1145('0x3c'),_0x37b5d8['query'])[_0x1145('0x9')](respondWithResult(_0x227d79,null))[_0x1145('0xe')](handleError(_0x227d79,null));};exports['trunks']=function(_0x18c050,_0x1f5ae6){return respondWithRpcPromise(_0x1145('0x3d'),_0x18c050[_0x1145('0x17')])[_0x1145('0x9')](respondWithResult(_0x1f5ae6,null))[_0x1145('0xe')](handleError(_0x1f5ae6,null));};exports[_0x1145('0x3e')]=function(_0x5a466c,_0x14c9f1){return respondWithRpcPromise(_0x1145('0x3f'),_0x5a466c[_0x1145('0x17')])[_0x1145('0x9')](respondWithResult(_0x14c9f1,null))[_0x1145('0xe')](handleError(_0x14c9f1,null));};exports['chatQueues']=function(_0x2973b2,_0x5be9da){return respondWithRpcPromise('ChatQueues',_0x2973b2[_0x1145('0x17')],routingClient)['then'](respondWithResult(_0x5be9da,null))['catch'](handleError(_0x5be9da,null));};exports[_0x1145('0x40')]=function(_0x500061,_0x3874f9){return respondWithRpcPromise(_0x1145('0x41'),_0x500061[_0x1145('0x17')],routingClient)[_0x1145('0x9')](findById(_0x500061[_0x1145('0x1c')]['id']))[_0x1145('0x9')](respondWithResult(_0x3874f9,null))['catch'](handleError(_0x3874f9,null));};exports[_0x1145('0x42')]=function(_0x5aa26e,_0x409409){return respondWithRpcPromise('MailQueues',_0x5aa26e[_0x1145('0x17')],routingClient)[_0x1145('0x9')](respondWithResult(_0x409409,null))['catch'](handleError(_0x409409,null));};exports[_0x1145('0x43')]=function(_0x44d702,_0xafc416){return respondWithRpcPromise('MailQueues',_0x44d702[_0x1145('0x17')],routingClient)['then'](findById(_0x44d702[_0x1145('0x1c')]['id']))[_0x1145('0x9')](respondWithResult(_0xafc416,null))[_0x1145('0xe')](handleError(_0xafc416,null));};exports[_0x1145('0x44')]=function(_0x4cfcbe,_0x226d0a){return respondWithRpcPromise(_0x1145('0x45'),_0x4cfcbe[_0x1145('0x17')],mailClient)[_0x1145('0x9')](respondWithResult(_0x226d0a,null))[_0x1145('0xe')](handleError(_0x226d0a,null));};exports['openchannelQueues']=function(_0x9eb176,_0x778aa0){return respondWithRpcPromise(_0x1145('0x46'),_0x9eb176[_0x1145('0x17')],routingClient)[_0x1145('0x9')](respondWithResult(_0x778aa0,null))[_0x1145('0xe')](handleError(_0x778aa0,null));};exports[_0x1145('0x47')]=function(_0x397f27,_0x2e35ab){return respondWithRpcPromise(_0x1145('0x46'),_0x397f27[_0x1145('0x17')],routingClient)[_0x1145('0x9')](findById(_0x397f27[_0x1145('0x1c')]['id']))[_0x1145('0x9')](respondWithResult(_0x2e35ab,null))[_0x1145('0xe')](handleError(_0x2e35ab,null));};exports[_0x1145('0x48')]=function(_0x51640d,_0x3ee0cf){return respondWithRpcPromise(_0x1145('0x49'),_0x51640d[_0x1145('0x17')],routingClient)[_0x1145('0x9')](respondWithResult(_0x3ee0cf,null))[_0x1145('0xe')](handleError(_0x3ee0cf,null));};exports[_0x1145('0x4a')]=function(_0x289557,_0x48c430){return respondWithRpcPromise(_0x1145('0x49'),_0x289557['query'],routingClient)['then'](findById(_0x289557[_0x1145('0x1c')]['id']))['then'](respondWithResult(_0x48c430,null))['catch'](handleError(_0x48c430,null));};exports[_0x1145('0x4b')]=function(_0x5005d5,_0x567936){return respondWithRpcPromise(_0x1145('0x4c'),_0x5005d5['query'],routingClient)['then'](respondWithResult(_0x567936,null))[_0x1145('0xe')](handleError(_0x567936,null));};exports[_0x1145('0x4d')]=function(_0x509a6f,_0x515f7f){return respondWithRpcPromise(_0x1145('0x4c'),_0x509a6f['query'],routingClient)[_0x1145('0x9')](findById(_0x509a6f[_0x1145('0x1c')]['id']))['then'](respondWithResult(_0x515f7f,null))[_0x1145('0xe')](handleError(_0x515f7f,null));};exports[_0x1145('0x4e')]=function(_0x3b55d6,_0xdab3bc){return respondWithRpcPromise(_0x1145('0x4f'),_0x3b55d6[_0x1145('0x17')],routingClient)[_0x1145('0x9')](respondWithResult(_0xdab3bc,null))[_0x1145('0xe')](handleError(_0xdab3bc,null));};exports['showFaxQueues']=function(_0x21a85e,_0x8bc6ff){return respondWithRpcPromise(_0x1145('0x4f'),_0x21a85e[_0x1145('0x17')],routingClient)[_0x1145('0x9')](findById(_0x21a85e[_0x1145('0x1c')]['id']))[_0x1145('0x9')](respondWithResult(_0x8bc6ff,null))['catch'](handleError(_0x8bc6ff,null));};exports[_0x1145('0x50')]=function(_0xfd6ba1,_0x53b235){return respondWithRpcPromise(_0x1145('0x51'),_0xfd6ba1['query'])[_0x1145('0x9')](respondWithResult(_0x53b235,null))[_0x1145('0xe')](handleError(_0x53b235,null));};exports[_0x1145('0x52')]=function(_0x2c3017,_0x350f97){return respondWithRpcPromise(_0x1145('0x53'),_0x2c3017[_0x1145('0x17')],routingClient)['then'](respondWithResult(_0x350f97,null))['catch'](handleError(_0x350f97,null));};exports['mailQueuesWaitingInteractions']=function(_0x4288c2,_0x27d611){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x4288c2[_0x1145('0x17')],routingClient)['then'](respondWithResult(_0x27d611,null))[_0x1145('0xe')](handleError(_0x27d611,null));};exports[_0x1145('0x54')]=function(_0x4de99f,_0x1996ae){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4de99f['query'],routingClient)[_0x1145('0x9')](respondWithResult(_0x1996ae,null))[_0x1145('0xe')](handleError(_0x1996ae,null));};exports['smsQueuesWaitingInteractions']=function(_0x18d307,_0x200797){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x18d307[_0x1145('0x17')],routingClient)[_0x1145('0x9')](respondWithResult(_0x200797,null))['catch'](handleError(_0x200797,null));};exports[_0x1145('0x55')]=function(_0x5160e1,_0x4f35d9){return respondWithRpcPromise(_0x1145('0x56'),_0x5160e1[_0x1145('0x17')],routingClient)[_0x1145('0x9')](respondWithResult(_0x4f35d9,null))[_0x1145('0xe')](handleError(_0x4f35d9,null));};exports['faxQueuesWaitingInteractions']=function(_0x4c48fe,_0x230399){return respondWithRpcPromise(_0x1145('0x57'),_0x4c48fe['query'],routingClient)[_0x1145('0x9')](respondWithResult(_0x230399,null))['catch'](handleError(_0x230399,null));};exports['queueNotify']=function(_0x136b8e){return function(_0x4817a4,_0x42e3da){var _0x4eb54d,_0x3cb2dc;var _0x2f4fbe=_[_0x1145('0x58')](_0x136b8e);var _0x10c90a=_0x136b8e===_0x1145('0x59')?_0x1145('0x5a'):_0x1145('0x5b');return db[_0x2f4fbe+'Queue']['findOne']({'raw':!![],'where':{'id':_0x4817a4[_0x1145('0x1c')]['id']}})[_0x1145('0x9')](function(_0xf8d502){if(_[_0x1145('0x13')](_0xf8d502)){throw new Error(_0x2f4fbe+_0x1145('0x5c'));}_0x4eb54d=_0xf8d502;return db[_0x2f4fbe+'Message'][_0x1145('0x5d')]({'where':{'id':_0x4817a4['body'][_0x1145('0x5e')]},'include':[{'model':db[_0x2f4fbe+_0x1145('0x5f')],'as':_0x1145('0x5f')},{'model':db[_0x2f4fbe+_0x10c90a],'as':_0x1145('0x5b')}]});})['then'](function(_0x8f0a53){if(_[_0x1145('0x13')](_0x8f0a53)){throw new Error(_0x2f4fbe+'\x20Message\x20not\x20found');}_0x3cb2dc=_0x8f0a53;return _0x8f0a53[_0x1145('0x60')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1145('0x9')](function(){var _0x1b58c3={'uniqueid':_0x136b8e+'.'+_0x3cb2dc['id']+'.'+_0x3cb2dc['Interaction']['id'],'FromUserId':_0x4817a4[_0x1145('0x2c')]['id'],'type':_0x1145('0x61')};_0x1b58c3[_0x2f4fbe+_0x1145('0x62')]=_0x3cb2dc['id'];_0x1b58c3[_0x2f4fbe+'InteractionId']=_0x3cb2dc[_0x1145('0x5f')]['id'];_0x1b58c3['From'+_0x2f4fbe+_0x10c90a+'Id']=_0x3cb2dc[_0x1145('0x5b')]['id'];_0x1b58c3['To'+_0x2f4fbe+_0x1145('0x63')]=_0x4eb54d['id'];return db[_0x2f4fbe+'TransferReport'][_0x1145('0x64')](_0x1b58c3);})[_0x1145('0x9')](function(){return respondWithRpcPromise(_0x1145('0x65'),{'channel':_0x136b8e,'interaction':_0x3cb2dc[_0x1145('0x5f')],'message':_0x3cb2dc,'account':_0x3cb2dc['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1145('0x61'),'appdata':_0x4eb54d['name']+','+(_0x3cb2dc['Account']['queueTransferTimeout']||0x12c),'interval':_0x1145('0x66')}]},routingClient);})[_0x1145('0x9')](respondWithResult(_0x42e3da,null))[_0x1145('0xe')](handleError(_0x42e3da,null));};};exports[_0x1145('0x67')]=function(_0x127a6b,_0x154b78){var _0x5630d6,_0x5cfa04;if(_[_0x1145('0x13')](_0x127a6b[_0x1145('0x2a')][_0x1145('0x68')])){throw new Error(_0x1145('0x69'));}var _0x4a819f=_0x127a6b[_0x1145('0x2a')][_0x1145('0x68')];var _0x1ed932=_['capitalize'](_0x4a819f);var _0x480c3e=_0x4a819f===_0x1145('0x59')?_0x1145('0x5a'):_0x1145('0x5b');return db['User'][_0x1145('0x5d')]({'raw':!![],'where':{'id':_0x127a6b[_0x1145('0x1c')]['id'],'role':'agent'}})['then'](function(_0x2a4b3a){if(_[_0x1145('0x13')](_0x2a4b3a)){throw new Error(_0x1145('0x6a'));}_0x5630d6=_0x2a4b3a;return db[_0x1ed932+'Message'][_0x1145('0x5d')]({'where':{'id':_0x127a6b[_0x1145('0x2a')][_0x1145('0x5e')]},'include':[{'model':db[_0x1ed932+_0x1145('0x5f')],'as':'Interaction'},{'model':db[_0x1ed932+_0x480c3e],'as':_0x1145('0x5b')}]});})[_0x1145('0x9')](function(_0x19f89c){if(_[_0x1145('0x13')](_0x19f89c)){throw new Error(_0x1ed932+_0x1145('0x6b'));}_0x5cfa04=_0x19f89c;return _0x19f89c['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x1145('0x9')](function(){var _0x20bbfc={'uniqueid':_0x4a819f+'.'+_0x5cfa04['id']+'.'+_0x5cfa04[_0x1145('0x5f')]['id'],'FromUserId':_0x127a6b[_0x1145('0x2c')]['id'],'type':_0x1145('0x61'),'ToUserId':_0x5630d6['id']};_0x20bbfc[_0x1ed932+_0x1145('0x62')]=_0x5cfa04['id'];_0x20bbfc[_0x1ed932+_0x1145('0x6c')]=_0x5cfa04['Interaction']['id'];_0x20bbfc['From'+_0x1ed932+_0x480c3e+'Id']=_0x5cfa04['Account']['id'];return db[_0x1ed932+_0x1145('0x6d')][_0x1145('0x64')](_0x20bbfc);})[_0x1145('0x9')](function(){return respondWithRpcPromise(_0x1145('0x65'),{'channel':_0x4a819f,'interaction':_0x5cfa04[_0x1145('0x5f')],'message':_0x5cfa04,'account':_0x5cfa04[_0x1145('0x5b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1145('0x6e'),'appdata':_0x5630d6[_0x1145('0x12')]+','+(_0x5cfa04[_0x1145('0x5b')][_0x1145('0x6f')]||0x12c),'interval':_0x1145('0x66')}]},routingClient);})[_0x1145('0x9')](respondWithResult(_0x154b78,null))[_0x1145('0xe')](handleError(_0x154b78,null));}; \ No newline at end of file +var _0xd53f=['MemberReport','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Account','findOne','messageId','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','create','Start','Interaction','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','jayson/promise','client','http','error','code','message','result','status','json','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','then','catch','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xd53f,0x131));var _0xfd53=function(_0x5c2dc8,_0x3bb768){_0x5c2dc8=_0x5c2dc8-0x0;var _0x1ca64c=_0xd53f[_0x5c2dc8];return _0x1ca64c;};'use strict';var BPromise=require(_0xfd53('0x0'));var moment=require(_0xfd53('0x1'));var _=require(_0xfd53('0x2'));var util=require('util');var db=require(_0xfd53('0x3'))['db'];var logger=require(_0xfd53('0x4'))('api');var jayson=require(_0xfd53('0x5'));var amiClient=jayson[_0xfd53('0x6')][_0xfd53('0x7')]({'port':0x232a});var mailClient=jayson[_0xfd53('0x6')][_0xfd53('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xfd53('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x59a6fa,_0x3fdfdd,_0x5c94ab){return new BPromise(function(_0x2763d4,_0x4a6935){var _0x11e8d5=_0x5c94ab?_0x5c94ab:amiClient;return _0x11e8d5['request'](_0x59a6fa,_0x3fdfdd)['then'](function(_0x320f0c){if(_0x320f0c['error']){if(_0x320f0c[_0xfd53('0x8')][_0xfd53('0x9')]===0x1f4){return _0x4a6935(_0x320f0c[_0xfd53('0x8')][_0xfd53('0xa')]);}return _0x2763d4(_0x320f0c['error'][_0xfd53('0xa')]);}else{_0x2763d4(_0x320f0c[_0xfd53('0xb')]);}})['catch'](function(_0x48ca31){_0x4a6935(_0x48ca31);});});}function respondWithResult(_0x5b0555,_0x213d51){_0x213d51=_0x213d51||0xc8;return function(_0x1043f9){if(_0x1043f9){return _0x5b0555[_0xfd53('0xc')](_0x213d51)[_0xfd53('0xd')](_0x1043f9);}return _0x5b0555[_0xfd53('0xe')](0x194);};}function handleError(_0x107d9c,_0x1d9d1e){_0x1d9d1e=_0x1d9d1e||0x1f4;return function(_0x49404){logger[_0xfd53('0x8')](_0x49404[_0xfd53('0xf')]);if(_0x49404[_0xfd53('0x10')]){delete _0x49404[_0xfd53('0x10')];}_0x107d9c['status'](_0x1d9d1e)[_0xfd53('0x11')](_0x49404);};}function findById(_0x2d9e67){return function(_0x2f11a0){if(!_['isNil'](_0x2d9e67)&&!_[_0xfd53('0x12')](_0x2f11a0)&&!_['isNil'](_0x2f11a0['rows'])){return _[_0xfd53('0x13')](_0x2f11a0[_0xfd53('0x14')],function(_0x4d3e65){return _0x4d3e65['id']==_0x2d9e67;});}return null;};}exports[_0xfd53('0x15')]=function(_0x5c0a45,_0x1bb14e){return respondWithRpcPromise(_0xfd53('0x16'),_0x5c0a45['query'])[_0xfd53('0x17')](respondWithResult(_0x1bb14e,null))[_0xfd53('0x18')](handleError(_0x1bb14e,null));};exports['voiceChannelMixMonitor']=function(_0x219f3b,_0x589309){return respondWithRpcPromise(_0xfd53('0x19'),_[_0xfd53('0x1a')](_0x219f3b[_0xfd53('0x1b')],_0x219f3b[_0xfd53('0x1c')]))[_0xfd53('0x17')](respondWithResult(_0x589309,null))[_0xfd53('0x18')](handleError(_0x589309,null));};exports[_0xfd53('0x1d')]=function(_0x3982dd,_0x4ff496){return respondWithRpcPromise(_0xfd53('0x1e'),_[_0xfd53('0x1a')](_0x3982dd[_0xfd53('0x1b')],_0x3982dd[_0xfd53('0x1c')]))[_0xfd53('0x17')](respondWithResult(_0x4ff496,null))[_0xfd53('0x18')](handleError(_0x4ff496,null));};exports[_0xfd53('0x1f')]=function(_0xdac9d7,_0x427019){return respondWithRpcPromise(_0xfd53('0x20'),_0xdac9d7['query'])[_0xfd53('0x17')](respondWithResult(_0x427019,null))[_0xfd53('0x18')](handleError(_0x427019,null));};exports[_0xfd53('0x21')]=function(_0x91c7cf,_0x523a8a){return respondWithRpcPromise(_0xfd53('0x20'),_0x91c7cf[_0xfd53('0x1b')])[_0xfd53('0x17')](findById(_0x91c7cf[_0xfd53('0x1c')]['id']))[_0xfd53('0x17')](respondWithResult(_0x523a8a,null))[_0xfd53('0x18')](handleError(_0x523a8a,null));};exports[_0xfd53('0x22')]=function(_0x9b3ec8,_0x224bc3){return respondWithRpcPromise(_0xfd53('0x23'),_[_0xfd53('0x1a')](_0x9b3ec8[_0xfd53('0x1b')],_0x9b3ec8[_0xfd53('0x1c')]))[_0xfd53('0x17')](respondWithResult(_0x224bc3,null))[_0xfd53('0x18')](handleError(_0x224bc3,null));};exports[_0xfd53('0x24')]=function(_0x3f1a84,_0x1e1280){return respondWithRpcPromise(_0xfd53('0x25'),_0x3f1a84[_0xfd53('0x1b')])[_0xfd53('0x17')](respondWithResult(_0x1e1280,null))[_0xfd53('0x18')](handleError(_0x1e1280,null));};exports[_0xfd53('0x26')]=function(_0x92f90d,_0x4b9845){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xfd53('0x1a')](_0x92f90d[_0xfd53('0x1b')],_0x92f90d[_0xfd53('0x1c')]))[_0xfd53('0x17')](respondWithResult(_0x4b9845,null))[_0xfd53('0x18')](handleError(_0x4b9845,null));};exports[_0xfd53('0x27')]=function(_0x29021b,_0x51ec3a){return respondWithRpcPromise(_0xfd53('0x28'),_[_0xfd53('0x1a')](_0x29021b[_0xfd53('0x1b')],_0x29021b['params']))[_0xfd53('0x17')](respondWithResult(_0x51ec3a,null))['catch'](handleError(_0x51ec3a,null));};exports[_0xfd53('0x29')]=function(_0x4a31a5,_0x2a0cc7){return respondWithRpcPromise(_0xfd53('0x2a'),_['merge'](_0x4a31a5[_0xfd53('0x1b')],_0x4a31a5['params']))[_0xfd53('0x17')](respondWithResult(_0x2a0cc7,null))[_0xfd53('0x18')](handleError(_0x2a0cc7,null));};exports['outbound']=function(_0x1f6b33,_0x41bca7){return respondWithRpcPromise(_0xfd53('0x2b'),_0x1f6b33[_0xfd53('0x1b')])['then'](respondWithResult(_0x41bca7,null))[_0xfd53('0x18')](handleError(_0x41bca7,null));};exports[_0xfd53('0x2c')]=function(_0x3d2c00,_0x3cec96){return respondWithRpcPromise(_0xfd53('0x2d'),_0x3d2c00[_0xfd53('0x1b')])[_0xfd53('0x17')](respondWithResult(_0x3cec96,null))['catch'](handleError(_0x3cec96,null));};exports[_0xfd53('0x2e')]=function(_0x10d36c,_0x5778f7){var _0x2a7966;return respondWithRpcPromise(_0xfd53('0x2f'),_0x10d36c[_0xfd53('0x1b')])[_0xfd53('0x17')](function(_0x2fe679){_0x2a7966=_0x2fe679;return respondWithRpcPromise(_0xfd53('0x2f'),_0x10d36c[_0xfd53('0x1b')],routingClient);})[_0xfd53('0x17')](function(_0x1ff55a){return _[_0xfd53('0x1a')]({},_0x1ff55a,_0x2a7966);})[_0xfd53('0x17')](respondWithResult(_0x5778f7,null))[_0xfd53('0x18')](handleError(_0x5778f7,null));};exports[_0xfd53('0x30')]=function(_0x54ecb4,_0x193b8c){if(_0x54ecb4[_0xfd53('0x31')]&&_0x54ecb4[_0xfd53('0x31')][_0xfd53('0x32')]&&_0x54ecb4[_0xfd53('0x33')]&&_0x54ecb4[_0xfd53('0x33')][_0xfd53('0x10')]){for(var _0x22812b in _0x54ecb4['body'][_0xfd53('0x32')]){if(_0x54ecb4[_0xfd53('0x31')][_0xfd53('0x32')][_0xfd53('0x34')](_0x22812b)){db['MemberReport']['findAll']({'where':{'channel':_0x22812b,'membername':_0x54ecb4['user']['name'],'type':_0xfd53('0x35'),'exitAt':null,'uniqueid':_0x54ecb4[_0xfd53('0x31')][_0xfd53('0x32')][_0x22812b]&&_0x54ecb4[_0xfd53('0x31')]['interaction'][_0x22812b][_0xfd53('0x36')]?{'$notIn':_0x54ecb4[_0xfd53('0x31')][_0xfd53('0x32')][_0x22812b]}:{'$ne':null}}})[_0xfd53('0x17')](function(_0x4aee4b){var _0x16d852=moment()[_0xfd53('0x37')](_0xfd53('0x38'));for(var _0x1314bc=0x0,_0x3584ea=_0x4aee4b[_0xfd53('0x36')];_0x1314bc<_0x3584ea;_0x1314bc+=0x1){_0x4aee4b[_0x1314bc][_0xfd53('0x39')]({'exitAt':_0x16d852});}});for(var _0x3e8096=0x0;_0x3e8096<_0x54ecb4[_0xfd53('0x31')][_0xfd53('0x32')][_0x22812b]['length'];_0x3e8096+=0x1){db[_0xfd53('0x3a')][_0xfd53('0x3b')]({'where':{'channel':_0x22812b,'membername':_0x54ecb4[_0xfd53('0x33')][_0xfd53('0x10')],'type':'INTERACTION','uniqueid':_0x54ecb4[_0xfd53('0x31')][_0xfd53('0x32')][_0x22812b][_0x3e8096],'exitAt':null},'defaults':{'channel':_0x22812b,'membername':_0x54ecb4[_0xfd53('0x33')]['name'],'interface':_[_0xfd53('0x12')](_0x54ecb4['user'][_0xfd53('0x3c')])?util[_0xfd53('0x37')]('SIP/%s',_0x54ecb4[_0xfd53('0x33')][_0xfd53('0x10')]):_0x54ecb4[_0xfd53('0x33')]['interface'],'type':_0xfd53('0x35'),'enterAt':moment()[_0xfd53('0x37')](_0xfd53('0x38')),'role':_0xfd53('0x3d'),'internal':_0x54ecb4['user'][_0xfd53('0x3e')],'uniqueid':_0x54ecb4['body'][_0xfd53('0x32')][_0x22812b][_0x3e8096]}});}}}}return respondWithRpcPromise(_0xfd53('0x3f'),{'id':_0x54ecb4['params']['id'],'capacity':_0x54ecb4['body'][_0xfd53('0x40')]},routingClient)['then'](respondWithResult(_0x193b8c,null))[_0xfd53('0x18')](handleError(_0x193b8c,null));};exports[_0xfd53('0x41')]=function(_0x218b34,_0x27d1c7){return respondWithRpcPromise('Telephones',_0x218b34['query'])['then'](respondWithResult(_0x27d1c7,null))[_0xfd53('0x18')](handleError(_0x27d1c7,null));};exports[_0xfd53('0x42')]=function(_0x5de01a,_0x202a05){return respondWithRpcPromise(_0xfd53('0x43'),_0x5de01a['query'])[_0xfd53('0x17')](respondWithResult(_0x202a05,null))[_0xfd53('0x18')](handleError(_0x202a05,null));};exports[_0xfd53('0x44')]=function(_0x49cf95,_0x361004){return respondWithRpcPromise('Campaigns',_0x49cf95[_0xfd53('0x1b')])[_0xfd53('0x17')](respondWithResult(_0x361004,null))[_0xfd53('0x18')](handleError(_0x361004,null));};exports[_0xfd53('0x45')]=function(_0x4dfb6e,_0x47674b){return respondWithRpcPromise(_0xfd53('0x46'),_0x4dfb6e['query'],routingClient)[_0xfd53('0x17')](respondWithResult(_0x47674b,null))[_0xfd53('0x18')](handleError(_0x47674b,null));};exports[_0xfd53('0x47')]=function(_0x5018c6,_0x58bbe1){return respondWithRpcPromise('ChatQueues',_0x5018c6[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](findById(_0x5018c6[_0xfd53('0x1c')]['id']))[_0xfd53('0x17')](respondWithResult(_0x58bbe1,null))[_0xfd53('0x18')](handleError(_0x58bbe1,null));};exports[_0xfd53('0x48')]=function(_0xd8207a,_0x45d813){return respondWithRpcPromise(_0xfd53('0x49'),_0xd8207a[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](respondWithResult(_0x45d813,null))['catch'](handleError(_0x45d813,null));};exports[_0xfd53('0x4a')]=function(_0x421e24,_0x12a226){return respondWithRpcPromise(_0xfd53('0x49'),_0x421e24[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](findById(_0x421e24[_0xfd53('0x1c')]['id']))['then'](respondWithResult(_0x12a226,null))[_0xfd53('0x18')](handleError(_0x12a226,null));};exports[_0xfd53('0x4b')]=function(_0xeaba48,_0x5a755e){return respondWithRpcPromise(_0xfd53('0x4c'),_0xeaba48[_0xfd53('0x1b')],mailClient)[_0xfd53('0x17')](respondWithResult(_0x5a755e,null))[_0xfd53('0x18')](handleError(_0x5a755e,null));};exports[_0xfd53('0x4d')]=function(_0x2089be,_0x339f6a){return respondWithRpcPromise('OpenchannelQueues',_0x2089be[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](respondWithResult(_0x339f6a,null))['catch'](handleError(_0x339f6a,null));};exports['showOpenchannelQueues']=function(_0x404b00,_0xf059cc){return respondWithRpcPromise(_0xfd53('0x4e'),_0x404b00[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](findById(_0x404b00[_0xfd53('0x1c')]['id']))[_0xfd53('0x17')](respondWithResult(_0xf059cc,null))[_0xfd53('0x18')](handleError(_0xf059cc,null));};exports[_0xfd53('0x4f')]=function(_0x1b646d,_0x694227){return respondWithRpcPromise(_0xfd53('0x50'),_0x1b646d[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](respondWithResult(_0x694227,null))[_0xfd53('0x18')](handleError(_0x694227,null));};exports['showSmsQueues']=function(_0xdcf26a,_0x587002){return respondWithRpcPromise('SmsQueues',_0xdcf26a['query'],routingClient)[_0xfd53('0x17')](findById(_0xdcf26a['params']['id']))[_0xfd53('0x17')](respondWithResult(_0x587002,null))[_0xfd53('0x18')](handleError(_0x587002,null));};exports[_0xfd53('0x51')]=function(_0x4f6a98,_0x1a5be9){return respondWithRpcPromise(_0xfd53('0x52'),_0x4f6a98[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](respondWithResult(_0x1a5be9,null))[_0xfd53('0x18')](handleError(_0x1a5be9,null));};exports['showWhatsappQueues']=function(_0x5d43a5,_0x3a281c){return respondWithRpcPromise(_0xfd53('0x52'),_0x5d43a5[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](findById(_0x5d43a5[_0xfd53('0x1c')]['id']))[_0xfd53('0x17')](respondWithResult(_0x3a281c,null))[_0xfd53('0x18')](handleError(_0x3a281c,null));};exports[_0xfd53('0x53')]=function(_0x5d0832,_0x29eb53){return respondWithRpcPromise(_0xfd53('0x54'),_0x5d0832['query'],routingClient)[_0xfd53('0x17')](respondWithResult(_0x29eb53,null))['catch'](handleError(_0x29eb53,null));};exports[_0xfd53('0x55')]=function(_0x530dc3,_0x4b3dab){return respondWithRpcPromise(_0xfd53('0x54'),_0x530dc3[_0xfd53('0x1b')],routingClient)['then'](findById(_0x530dc3[_0xfd53('0x1c')]['id']))[_0xfd53('0x17')](respondWithResult(_0x4b3dab,null))[_0xfd53('0x18')](handleError(_0x4b3dab,null));};exports[_0xfd53('0x56')]=function(_0x1a96d1,_0x5e8963){return respondWithRpcPromise(_0xfd53('0x57'),_0x1a96d1['query'])[_0xfd53('0x17')](respondWithResult(_0x5e8963,null))[_0xfd53('0x18')](handleError(_0x5e8963,null));};exports[_0xfd53('0x58')]=function(_0x5ed683,_0x490644){return respondWithRpcPromise(_0xfd53('0x59'),_0x5ed683[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](respondWithResult(_0x490644,null))[_0xfd53('0x18')](handleError(_0x490644,null));};exports[_0xfd53('0x5a')]=function(_0x3e6648,_0x5d2928){return respondWithRpcPromise(_0xfd53('0x5b'),_0x3e6648[_0xfd53('0x1b')],routingClient)['then'](respondWithResult(_0x5d2928,null))['catch'](handleError(_0x5d2928,null));};exports[_0xfd53('0x5c')]=function(_0x44b39a,_0x215c8a){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x44b39a[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](respondWithResult(_0x215c8a,null))[_0xfd53('0x18')](handleError(_0x215c8a,null));};exports[_0xfd53('0x5d')]=function(_0x19bf2c,_0x5c3ea6){return respondWithRpcPromise(_0xfd53('0x5e'),_0x19bf2c['query'],routingClient)['then'](respondWithResult(_0x5c3ea6,null))[_0xfd53('0x18')](handleError(_0x5c3ea6,null));};exports[_0xfd53('0x5f')]=function(_0x5decf6,_0x1aec57){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x5decf6[_0xfd53('0x1b')],routingClient)[_0xfd53('0x17')](respondWithResult(_0x1aec57,null))[_0xfd53('0x18')](handleError(_0x1aec57,null));};exports['faxQueuesWaitingInteractions']=function(_0xb3417a,_0x4fb384){return respondWithRpcPromise(_0xfd53('0x60'),_0xb3417a[_0xfd53('0x1b')],routingClient)['then'](respondWithResult(_0x4fb384,null))[_0xfd53('0x18')](handleError(_0x4fb384,null));};exports['queueNotify']=function(_0x2c1222){return function(_0x489445,_0x49be9b){var _0xe435f5,_0x4d71c4;var _0xdae206=_['capitalize'](_0x2c1222);var _0x2aac2d=_0x2c1222===_0xfd53('0x61')?_0xfd53('0x62'):_0xfd53('0x63');return db[_0xdae206+'Queue'][_0xfd53('0x64')]({'raw':!![],'where':{'id':_0x489445['params']['id']}})[_0xfd53('0x17')](function(_0x422955){if(_[_0xfd53('0x12')](_0x422955)){throw new Error(_0xdae206+'\x20Queue\x20not\x20found');}_0xe435f5=_0x422955;return db[_0xdae206+'Message']['findOne']({'where':{'id':_0x489445[_0xfd53('0x31')][_0xfd53('0x65')]},'include':[{'model':db[_0xdae206+'Interaction'],'as':'Interaction'},{'model':db[_0xdae206+_0x2aac2d],'as':'Account'}]});})[_0xfd53('0x17')](function(_0x17581e){if(_[_0xfd53('0x12')](_0x17581e)){throw new Error(_0xdae206+_0xfd53('0x66'));}_0x4d71c4=_0x17581e;return _0x17581e[_0xfd53('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0xfd53('0x17')](function(){var _0x133764={'uniqueid':_0x2c1222+'.'+_0x4d71c4['id']+'.'+_0x4d71c4['Interaction']['id'],'FromUserId':_0x489445[_0xfd53('0x33')]['id'],'type':_0xfd53('0x68')};_0x133764[_0xdae206+_0xfd53('0x69')]=_0x4d71c4['id'];_0x133764[_0xdae206+_0xfd53('0x6a')]=_0x4d71c4['Interaction']['id'];_0x133764[_0xfd53('0x6b')+_0xdae206+_0x2aac2d+'Id']=_0x4d71c4[_0xfd53('0x63')]['id'];_0x133764['To'+_0xdae206+_0xfd53('0x6c')]=_0xe435f5['id'];return db[_0xdae206+'TransferReport'][_0xfd53('0x6d')](_0x133764);})[_0xfd53('0x17')](function(){return respondWithRpcPromise(_0xfd53('0x6e'),{'channel':_0x2c1222,'interaction':_0x4d71c4[_0xfd53('0x6f')],'message':_0x4d71c4,'account':_0x4d71c4['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xfd53('0x68'),'appdata':_0xe435f5['name']+','+(_0x4d71c4[_0xfd53('0x63')][_0xfd53('0x70')]||0x12c),'interval':_0xfd53('0x71')}]},routingClient);})[_0xfd53('0x17')](respondWithResult(_0x49be9b,null))[_0xfd53('0x18')](handleError(_0x49be9b,null));};};exports[_0xfd53('0x72')]=function(_0x16fbc1,_0x3aebb0){var _0x3fe0a6,_0x333c52;if(_[_0xfd53('0x12')](_0x16fbc1[_0xfd53('0x31')][_0xfd53('0x73')])){throw new Error(_0xfd53('0x74'));}var _0x219b1f=_0x16fbc1[_0xfd53('0x31')][_0xfd53('0x73')];var _0x3e1a70=_[_0xfd53('0x75')](_0x219b1f);var _0x66fc00=_0x219b1f===_0xfd53('0x61')?_0xfd53('0x62'):'Account';return db[_0xfd53('0x76')][_0xfd53('0x64')]({'raw':!![],'where':{'id':_0x16fbc1[_0xfd53('0x1c')]['id'],'role':_0xfd53('0x3d')}})[_0xfd53('0x17')](function(_0x4fd5b0){if(_[_0xfd53('0x12')](_0x4fd5b0)){throw new Error(_0xfd53('0x77'));}_0x3fe0a6=_0x4fd5b0;return db[_0x3e1a70+'Message'][_0xfd53('0x64')]({'where':{'id':_0x16fbc1['body'][_0xfd53('0x65')]},'include':[{'model':db[_0x3e1a70+_0xfd53('0x6f')],'as':_0xfd53('0x6f')},{'model':db[_0x3e1a70+_0x66fc00],'as':_0xfd53('0x63')}]});})[_0xfd53('0x17')](function(_0x48d716){if(_[_0xfd53('0x12')](_0x48d716)){throw new Error(_0x3e1a70+_0xfd53('0x66'));}_0x333c52=_0x48d716;return _0x48d716[_0xfd53('0x67')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x477bb4={'uniqueid':_0x219b1f+'.'+_0x333c52['id']+'.'+_0x333c52[_0xfd53('0x6f')]['id'],'FromUserId':_0x16fbc1[_0xfd53('0x33')]['id'],'type':_0xfd53('0x68'),'ToUserId':_0x3fe0a6['id']};_0x477bb4[_0x3e1a70+_0xfd53('0x69')]=_0x333c52['id'];_0x477bb4[_0x3e1a70+_0xfd53('0x6a')]=_0x333c52[_0xfd53('0x6f')]['id'];_0x477bb4[_0xfd53('0x6b')+_0x3e1a70+_0x66fc00+'Id']=_0x333c52[_0xfd53('0x63')]['id'];return db[_0x3e1a70+'TransferReport'][_0xfd53('0x6d')](_0x477bb4);})[_0xfd53('0x17')](function(){return respondWithRpcPromise(_0xfd53('0x6e'),{'channel':_0x219b1f,'interaction':_0x333c52[_0xfd53('0x6f')],'message':_0x333c52,'account':_0x333c52['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xfd53('0x3d'),'appdata':_0x3fe0a6['name']+','+(_0x333c52[_0xfd53('0x63')][_0xfd53('0x78')]||0x12c),'interval':_0xfd53('0x71')}]},routingClient);})['then'](respondWithResult(_0x3aebb0,null))['catch'](handleError(_0x3aebb0,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 199a840..f1684e3 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 _0x9cb3=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','show','/:id/run','run','post','create','/:id','destroy','exports'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x9cb3,0xa0));var _0x39cb=function(_0x44774d,_0x27fe98){_0x44774d=_0x44774d-0x0;var _0x282b23=_0x9cb3[_0x44774d];return _0x282b23;};'use strict';var multer=require(_0x39cb('0x0'));var util=require(_0x39cb('0x1'));var path=require(_0x39cb('0x2'));var timeout=require(_0x39cb('0x3'));var express=require(_0x39cb('0x4'));var router=express['Router']();var auth=require(_0x39cb('0x5'));var interaction=require(_0x39cb('0x6'));var config=require(_0x39cb('0x7'));var controller=require(_0x39cb('0x8'));router['get']('/',auth[_0x39cb('0x9')](),controller[_0x39cb('0xa')]);router[_0x39cb('0xb')]('/:id',auth[_0x39cb('0x9')](),controller[_0x39cb('0xc')]);router[_0x39cb('0xb')](_0x39cb('0xd'),auth[_0x39cb('0x9')](),controller[_0x39cb('0xe')]);router[_0x39cb('0xf')]('/',auth['isAuthenticated'](),controller[_0x39cb('0x10')]);router['put'](_0x39cb('0x11'),auth[_0x39cb('0x9')](),controller['update']);router['delete']('/:id',auth[_0x39cb('0x9')](),controller[_0x39cb('0x12')]);module[_0x39cb('0x13')]=router; \ No newline at end of file +var _0x697a=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','/:id','/:id/run','run','post','create'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x697a,0x91));var _0xa697=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x697a[_0x2ae2ad];return _0x26dbd7;};'use strict';var multer=require(_0xa697('0x0'));var util=require(_0xa697('0x1'));var path=require(_0xa697('0x2'));var timeout=require(_0xa697('0x3'));var express=require('express');var router=express[_0xa697('0x4')]();var auth=require(_0xa697('0x5'));var interaction=require(_0xa697('0x6'));var config=require('../../config/environment');var controller=require(_0xa697('0x7'));router[_0xa697('0x8')]('/',auth[_0xa697('0x9')](),controller['index']);router[_0xa697('0x8')](_0xa697('0xa'),auth[_0xa697('0x9')](),controller['show']);router[_0xa697('0x8')](_0xa697('0xb'),auth['isAuthenticated'](),controller[_0xa697('0xc')]);router[_0xa697('0xd')]('/',auth['isAuthenticated'](),controller[_0xa697('0xe')]);router[_0xa697('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa697('0x10')]);router[_0xa697('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa697('0x12')]);module[_0xa697('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 9c43661..0f2347f 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 _0xc6ac=['minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours'];(function(_0x576607,_0x4b1d47){var _0xb0e831=function(_0x21ce17){while(--_0x21ce17){_0x576607['push'](_0x576607['shift']());}};_0xb0e831(++_0x4b1d47);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4768c9,_0x3cb482){_0x4768c9=_0x4768c9-0x0;var _0x1d7a35=_0xc6ac[_0x4768c9];return _0x1d7a35;};'use strict';var Sequelize=require(_0xcc6a('0x0'));module[_0xcc6a('0x1')]={'name':{'type':Sequelize[_0xcc6a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcc6a('0x2')]},'active':{'type':Sequelize[_0xcc6a('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xcc6a('0x2')],'allowNull':![],'defaultValue':_0xcc6a('0x4')},'startAt':{'type':Sequelize[_0xcc6a('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xcc6a('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xcc6a('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xcc6a('0x7')](_0xcc6a('0x8'),_0xcc6a('0x9'),_0xcc6a('0xa'),'weeks',_0xcc6a('0xb'),_0xcc6a('0xc'),_0xcc6a('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xcc6a('0x7')](_0xcc6a('0xe'),_0xcc6a('0xf'),_0xcc6a('0x10')),'allowNull':![],'defaultValue':_0xcc6a('0xe')},'type':{'type':Sequelize['ENUM'](_0xcc6a('0x11'),_0xcc6a('0x12')),'allowNull':![],'defaultValue':_0xcc6a('0x11')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xcc6a('0x2')]},'cc':{'type':Sequelize[_0xcc6a('0x13')]},'bcc':{'type':Sequelize[_0xcc6a('0x13')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x2e88=['pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','ENUM','years','months','weeks','days','hours','minutes','csv'];(function(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0x2e88,0x95));var _0x82e8=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x2e88[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0x82e8('0x0'));module[_0x82e8('0x1')]={'name':{'type':Sequelize[_0x82e8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x82e8('0x2')]},'active':{'type':Sequelize[_0x82e8('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x82e8('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x82e8('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x82e8('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x82e8('0x5')](_0x82e8('0x6'),'quarters',_0x82e8('0x7'),_0x82e8('0x8'),_0x82e8('0x9'),_0x82e8('0xa'),_0x82e8('0xb')),'allowNull':![],'defaultValue':_0x82e8('0x9')},'output':{'type':Sequelize[_0x82e8('0x5')](_0x82e8('0xc'),_0x82e8('0xd'),_0x82e8('0xe')),'allowNull':![],'defaultValue':_0x82e8('0xc')},'type':{'type':Sequelize['ENUM'](_0x82e8('0xf'),_0x82e8('0x10')),'allowNull':![],'defaultValue':_0x82e8('0xf')},'sendMail':{'type':Sequelize[_0x82e8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x82e8('0x2')]},'cc':{'type':Sequelize[_0x82e8('0x11')]},'bcc':{'type':Sequelize[_0x82e8('0x11')]},'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 a9a3a57..e716b5b 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 _0x35e4=['UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','get','Scheduler'];(function(_0x56d58c,_0x1df6f7){var _0x2daa31=function(_0x36f316){while(--_0x36f316){_0x56d58c['push'](_0x56d58c['shift']());}};_0x2daa31(++_0x1df6f7);}(_0x35e4,0x80));var _0x435e=function(_0x3037c7,_0x420144){_0x3037c7=_0x3037c7-0x0;var _0x1e6cf3=_0x35e4[_0x3037c7];return _0x1e6cf3;};'use strict';var pdf=require(_0x435e('0x0'));var emlformat=require(_0x435e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x435e('0x2'));var jsonpatch=require(_0x435e('0x3'));var rp=require(_0x435e('0x4'));var moment=require(_0x435e('0x5'));var BPromise=require(_0x435e('0x6'));var Mustache=require(_0x435e('0x7'));var util=require('util');var path=require(_0x435e('0x8'));var sox=require(_0x435e('0x9'));var csv=require(_0x435e('0xa'));var ejs=require(_0x435e('0xb'));var fs=require('fs');var _=require(_0x435e('0xc'));var squel=require(_0x435e('0xd'));var crypto=require(_0x435e('0xe'));var jsforce=require(_0x435e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x435e('0xa'));var querystring=require(_0x435e('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x435e('0x11'));var qs=require(_0x435e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x435e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x435e('0x14'));var config=require('../../config/environment');var db=require(_0x435e('0x15'))['db'];function respondWithStatusCode(_0x5ee452,_0x56e817){_0x56e817=_0x56e817||0xcc;return function(_0x430c45){if(_0x430c45){return _0x5ee452[_0x435e('0x16')](_0x56e817);}return _0x5ee452[_0x435e('0x17')](_0x56e817)[_0x435e('0x18')]();};}function respondWithResult(_0x2a8834,_0x1ac690){_0x1ac690=_0x1ac690||0xc8;return function(_0x1f123a){if(_0x1f123a){return _0x2a8834[_0x435e('0x17')](_0x1ac690)[_0x435e('0x19')](_0x1f123a);}};}function respondWithFilteredResult(_0x48b62a,_0x3eb052){return function(_0x468e34){if(_0x468e34){var _0x6ed6f5=_0x468e34[_0x435e('0x1a')],_0x36b263=_0x3eb052[_0x435e('0x1b')],_0x417ca1=_0x3eb052[_0x435e('0x1b')]+_0x3eb052['limit'],_0x1891a2;if(_0x417ca1>=_0x6ed6f5){_0x417ca1=_0x6ed6f5;_0x1891a2=0xc8;}else{_0x1891a2=0xce;}_0x48b62a[_0x435e('0x17')](_0x1891a2);return _0x48b62a[_0x435e('0x1c')](_0x435e('0x1d'),_0x36b263+'-'+_0x417ca1+'/'+_0x6ed6f5)['json'](_0x468e34);}return null;};}function patchUpdates(_0x3d57f5){return function(_0x51afec){try{jsonpatch[_0x435e('0x1e')](_0x51afec,_0x3d57f5,!![]);}catch(_0x47f955){return BPromise['reject'](_0x47f955);}return _0x51afec[_0x435e('0x1f')]();};}function saveUpdates(_0x374278,_0x1261cd){return function(_0x4e407c){if(_0x4e407c){return _0x4e407c['update'](_0x374278)[_0x435e('0x20')](function(_0x3bee9a){return _0x3bee9a;});}return null;};}function removeEntity(_0x150633,_0x1f9d66){return function(_0x3e1e3c){if(_0x3e1e3c){return _0x3e1e3c[_0x435e('0x21')]()[_0x435e('0x20')](function(){var _0x52e7b6=_0x3e1e3c[_0x435e('0x22')]({'plain':!![]});var _0x19bf96=_0x435e('0x23');return db[_0x435e('0x24')]['destroy']({'where':{'type':_0x19bf96,'resourceId':_0x52e7b6['id']}})['then'](function(){return _0x3e1e3c;});})[_0x435e('0x20')](function(){_0x150633['status'](0xcc)[_0x435e('0x18')]();});}};}function handleEntityNotFound(_0xbd60f,_0x17005){return function(_0x2c818a){if(!_0x2c818a){_0xbd60f['sendStatus'](0x194);}return _0x2c818a;};}function handleError(_0x318514,_0x1b0061){_0x1b0061=_0x1b0061||0x1f4;return function(_0x36c4cb){logger[_0x435e('0x25')](_0x36c4cb[_0x435e('0x26')]);if(_0x36c4cb[_0x435e('0x27')]){delete _0x36c4cb['name'];}_0x318514[_0x435e('0x17')](_0x1b0061)[_0x435e('0x28')](_0x36c4cb);};}exports[_0x435e('0x29')]=function(_0x548c17,_0x45c5b8){var _0x5d5ffc={},_0x86d133={},_0x28e6eb={'count':0x0,'rows':[]};var _0x5ee617=_[_0x435e('0x2a')](db[_0x435e('0x2b')][_0x435e('0x2c')],function(_0x4c0f09){return{'name':_0x4c0f09[_0x435e('0x2d')],'type':_0x4c0f09[_0x435e('0x2e')]['key']};});_0x86d133[_0x435e('0x2f')]=_[_0x435e('0x2a')](_0x5ee617,_0x435e('0x27'));_0x86d133['query']=_['keys'](_0x548c17[_0x435e('0x30')]);_0x86d133['filters']=_[_0x435e('0x31')](_0x86d133[_0x435e('0x2f')],_0x86d133[_0x435e('0x30')]);_0x5d5ffc['attributes']=_[_0x435e('0x31')](_0x86d133[_0x435e('0x2f')],qs[_0x435e('0x32')](_0x548c17[_0x435e('0x30')][_0x435e('0x32')]));_0x5d5ffc['attributes']=_0x5d5ffc[_0x435e('0x33')][_0x435e('0x34')]?_0x5d5ffc[_0x435e('0x33')]:_0x86d133['model'];if(!_0x548c17[_0x435e('0x30')][_0x435e('0x35')](_0x435e('0x36'))){_0x5d5ffc[_0x435e('0x37')]=qs[_0x435e('0x37')](_0x548c17['query']['limit']);_0x5d5ffc[_0x435e('0x1b')]=qs[_0x435e('0x1b')](_0x548c17[_0x435e('0x30')][_0x435e('0x1b')]);}_0x5d5ffc[_0x435e('0x38')]=qs[_0x435e('0x39')](_0x548c17[_0x435e('0x30')][_0x435e('0x39')]);_0x5d5ffc[_0x435e('0x3a')]=qs['filters'](_['pick'](_0x548c17[_0x435e('0x30')],_0x86d133['filters']),_0x5ee617);if(_0x548c17[_0x435e('0x30')]['filter']){_0x5d5ffc[_0x435e('0x3a')]=_[_0x435e('0x3b')](_0x5d5ffc[_0x435e('0x3a')],{'$or':_[_0x435e('0x2a')](_0x5ee617,function(_0x30aec1){if(_0x30aec1[_0x435e('0x2e')]!==_0x435e('0x3c')){var _0xe68a98={};_0xe68a98[_0x30aec1[_0x435e('0x27')]]={'$like':'%'+_0x548c17['query']['filter']+'%'};return _0xe68a98;}})});}_0x5d5ffc=_['merge']({},_0x5d5ffc,_0x548c17['options']);var _0x1fe850={'where':_0x5d5ffc[_0x435e('0x3a')]};return db['Schedule']['count'](_0x1fe850)[_0x435e('0x20')](function(_0x1107fa){_0x28e6eb['count']=_0x1107fa;if(_0x548c17[_0x435e('0x30')][_0x435e('0x3d')]){_0x5d5ffc[_0x435e('0x3e')]=[{'all':!![]}];}return db[_0x435e('0x2b')][_0x435e('0x3f')](_0x5d5ffc);})[_0x435e('0x20')](function(_0x3826cd){_0x28e6eb[_0x435e('0x40')]=_0x3826cd;return _0x28e6eb;})['then'](respondWithFilteredResult(_0x45c5b8,_0x5d5ffc))[_0x435e('0x41')](handleError(_0x45c5b8,null));};exports['show']=function(_0x4704be,_0x4155b0){var _0x23ff4d={'raw':![],'where':{'id':_0x4704be[_0x435e('0x42')]['id']}},_0xffb959={};_0xffb959[_0x435e('0x2f')]=_[_0x435e('0x43')](db[_0x435e('0x2b')][_0x435e('0x2c')]);_0xffb959[_0x435e('0x30')]=_[_0x435e('0x43')](_0x4704be[_0x435e('0x30')]);_0xffb959['filters']=_[_0x435e('0x31')](_0xffb959[_0x435e('0x2f')],_0xffb959[_0x435e('0x30')]);_0x23ff4d[_0x435e('0x33')]=_[_0x435e('0x31')](_0xffb959[_0x435e('0x2f')],qs[_0x435e('0x32')](_0x4704be[_0x435e('0x30')][_0x435e('0x32')]));_0x23ff4d[_0x435e('0x33')]=_0x23ff4d[_0x435e('0x33')][_0x435e('0x34')]?_0x23ff4d[_0x435e('0x33')]:_0xffb959['model'];if(_0x4704be[_0x435e('0x30')][_0x435e('0x3d')]){_0x23ff4d[_0x435e('0x3e')]=[{'all':!![]}];}_0x23ff4d=_[_0x435e('0x3b')]({},_0x23ff4d,_0x4704be[_0x435e('0x44')]);return db[_0x435e('0x2b')]['find'](_0x23ff4d)['then'](handleEntityNotFound(_0x4155b0,null))[_0x435e('0x20')](respondWithResult(_0x4155b0,null))['catch'](handleError(_0x4155b0,null));};exports['create']=function(_0xf4e0d6,_0x28db31){return db[_0x435e('0x2b')][_0x435e('0x45')](_0xf4e0d6[_0x435e('0x46')],{})[_0x435e('0x20')](function(_0x7b8533){var _0x55b2e6=_0xf4e0d6[_0x435e('0x47')]['get']({'plain':!![]});if(!_0x55b2e6)throw new Error(_0x435e('0x48'));if(_0x55b2e6[_0x435e('0x49')]===_0x435e('0x47')){var _0x298adf=_0x7b8533[_0x435e('0x22')]({'plain':!![]});var _0x21f407=_0x435e('0x23');return db[_0x435e('0x4a')][_0x435e('0x4b')]({'where':{'name':_0x21f407,'userProfileId':_0x55b2e6[_0x435e('0x4c')]},'raw':!![]})[_0x435e('0x20')](function(_0x8c24b){if(_0x8c24b&&_0x8c24b[_0x435e('0x4d')]===0x0){return db[_0x435e('0x24')][_0x435e('0x45')]({'name':_0x298adf[_0x435e('0x27')],'resourceId':_0x298adf['id'],'type':_0x8c24b['name'],'sectionId':_0x8c24b['id']},{})[_0x435e('0x20')](function(){return _0x7b8533;});}else{return _0x7b8533;}})['catch'](function(_0x3cfe19){logger['error'](_0x435e('0x4e'),_0x3cfe19);throw _0x3cfe19;});}return _0x7b8533;})[_0x435e('0x20')](respondWithResult(_0x28db31,0xc9))['catch'](handleError(_0x28db31,null));};exports[_0x435e('0x4f')]=function(_0x1f0fb0,_0x43c9d2){if(_0x1f0fb0[_0x435e('0x46')]['id']){delete _0x1f0fb0[_0x435e('0x46')]['id'];}return db['Schedule'][_0x435e('0x4b')]({'where':{'id':_0x1f0fb0[_0x435e('0x42')]['id']}})['then'](handleEntityNotFound(_0x43c9d2,null))['then'](saveUpdates(_0x1f0fb0[_0x435e('0x46')],null))[_0x435e('0x20')](respondWithResult(_0x43c9d2,null))[_0x435e('0x41')](handleError(_0x43c9d2,null));};exports['destroy']=function(_0x4d64ec,_0x212cd1){return db[_0x435e('0x2b')][_0x435e('0x4b')]({'where':{'id':_0x4d64ec[_0x435e('0x42')]['id']}})['then'](handleEntityNotFound(_0x212cd1,null))[_0x435e('0x20')](removeEntity(_0x212cd1,null))[_0x435e('0x41')](handleError(_0x212cd1,null));};exports[_0x435e('0x50')]=function(_0x382e89,_0x90e5a9,_0x469156){var _0xd01b0=require(_0x435e('0x51'));return db[_0x435e('0x2b')]['find']({'where':{'id':_0x382e89[_0x435e('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x90e5a9,null))[_0x435e('0x20')](function(){_0xd01b0['run'](_0x382e89[_0x435e('0x42')]['id']);})['then'](respondWithStatusCode(_0x90e5a9,null))[_0x435e('0x41')](handleError(_0x90e5a9,null));}; \ No newline at end of file +var _0xdc0a=['update','run','../../config/schedule','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','then','get','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','map','Schedule','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','catch','params','find','body','user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xeb7df2,_0x499ab3){var _0x564935=function(_0x4c71ee){while(--_0x4c71ee){_0xeb7df2['push'](_0xeb7df2['shift']());}};_0x564935(++_0x499ab3);}(_0xdc0a,0x18e));var _0xadc0=function(_0x1b2779,_0x181d22){_0x1b2779=_0x1b2779-0x0;var _0x162929=_0xdc0a[_0x1b2779];return _0x162929;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xadc0('0x0'));var rp=require(_0xadc0('0x1'));var moment=require(_0xadc0('0x2'));var BPromise=require(_0xadc0('0x3'));var Mustache=require(_0xadc0('0x4'));var util=require(_0xadc0('0x5'));var path=require(_0xadc0('0x6'));var sox=require('sox');var csv=require(_0xadc0('0x7'));var ejs=require(_0xadc0('0x8'));var fs=require('fs');var _=require(_0xadc0('0x9'));var squel=require('squel');var crypto=require(_0xadc0('0xa'));var jsforce=require(_0xadc0('0xb'));var deskjs=require(_0xadc0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xadc0('0xd'));var Papa=require(_0xadc0('0xe'));var Redis=require(_0xadc0('0xf'));var authService=require(_0xadc0('0x10'));var qs=require(_0xadc0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadc0('0x12'));var logger=require(_0xadc0('0x13'))('api');var utils=require(_0xadc0('0x14'));var config=require(_0xadc0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed3a4,_0x840a98){_0x840a98=_0x840a98||0xcc;return function(_0x5b7965){if(_0x5b7965){return _0x3ed3a4[_0xadc0('0x16')](_0x840a98);}return _0x3ed3a4['status'](_0x840a98)[_0xadc0('0x17')]();};}function respondWithResult(_0x340392,_0x14a781){_0x14a781=_0x14a781||0xc8;return function(_0x4caf17){if(_0x4caf17){return _0x340392[_0xadc0('0x18')](_0x14a781)[_0xadc0('0x19')](_0x4caf17);}};}function respondWithFilteredResult(_0x5bcbc9,_0x54008d){return function(_0xbafdcc){if(_0xbafdcc){var _0x46d84b=_0xbafdcc['count'],_0x48ef6d=_0x54008d[_0xadc0('0x1a')],_0x4ea25a=_0x54008d[_0xadc0('0x1a')]+_0x54008d[_0xadc0('0x1b')],_0x7fe842;if(_0x4ea25a>=_0x46d84b){_0x4ea25a=_0x46d84b;_0x7fe842=0xc8;}else{_0x7fe842=0xce;}_0x5bcbc9[_0xadc0('0x18')](_0x7fe842);return _0x5bcbc9[_0xadc0('0x1c')](_0xadc0('0x1d'),_0x48ef6d+'-'+_0x4ea25a+'/'+_0x46d84b)[_0xadc0('0x19')](_0xbafdcc);}return null;};}function patchUpdates(_0x4c6fc7){return function(_0x1706ec){try{jsonpatch[_0xadc0('0x1e')](_0x1706ec,_0x4c6fc7,!![]);}catch(_0x24c78a){return BPromise[_0xadc0('0x1f')](_0x24c78a);}return _0x1706ec['save']();};}function saveUpdates(_0x1bab55,_0x3c767f){return function(_0x552ee3){if(_0x552ee3){return _0x552ee3['update'](_0x1bab55)['then'](function(_0x50dcde){return _0x50dcde;});}return null;};}function removeEntity(_0x19d093,_0x5029fa){return function(_0x58217c){if(_0x58217c){return _0x58217c['destroy']()[_0xadc0('0x20')](function(){var _0x4f7b6f=_0x58217c[_0xadc0('0x21')]({'plain':!![]});var _0x5017a0=_0xadc0('0x22');return db[_0xadc0('0x23')][_0xadc0('0x24')]({'where':{'type':_0x5017a0,'resourceId':_0x4f7b6f['id']}})[_0xadc0('0x20')](function(){return _0x58217c;});})[_0xadc0('0x20')](function(){_0x19d093['status'](0xcc)[_0xadc0('0x17')]();});}};}function handleEntityNotFound(_0xc6a247,_0x219d94){return function(_0x400ec2){if(!_0x400ec2){_0xc6a247['sendStatus'](0x194);}return _0x400ec2;};}function handleError(_0xe72dee,_0x32c640){_0x32c640=_0x32c640||0x1f4;return function(_0x3a1ced){logger[_0xadc0('0x25')](_0x3a1ced[_0xadc0('0x26')]);if(_0x3a1ced[_0xadc0('0x27')]){delete _0x3a1ced[_0xadc0('0x27')];}_0xe72dee[_0xadc0('0x18')](_0x32c640)[_0xadc0('0x28')](_0x3a1ced);};}exports[_0xadc0('0x29')]=function(_0x265558,_0x1b3dd2){var _0x9fce16={},_0x497abc={},_0x3511fa={'count':0x0,'rows':[]};var _0x3ea81c=_[_0xadc0('0x2a')](db[_0xadc0('0x2b')][_0xadc0('0x2c')],function(_0x3c0c93){return{'name':_0x3c0c93['fieldName'],'type':_0x3c0c93['type'][_0xadc0('0x2d')]};});_0x497abc['model']=_['map'](_0x3ea81c,'name');_0x497abc[_0xadc0('0x2e')]=_[_0xadc0('0x2f')](_0x265558[_0xadc0('0x2e')]);_0x497abc[_0xadc0('0x30')]=_[_0xadc0('0x31')](_0x497abc[_0xadc0('0x32')],_0x497abc['query']);_0x9fce16[_0xadc0('0x33')]=_['intersection'](_0x497abc[_0xadc0('0x32')],qs[_0xadc0('0x34')](_0x265558['query']['fields']));_0x9fce16['attributes']=_0x9fce16[_0xadc0('0x33')][_0xadc0('0x35')]?_0x9fce16[_0xadc0('0x33')]:_0x497abc['model'];if(!_0x265558[_0xadc0('0x2e')]['hasOwnProperty'](_0xadc0('0x36'))){_0x9fce16[_0xadc0('0x1b')]=qs['limit'](_0x265558[_0xadc0('0x2e')][_0xadc0('0x1b')]);_0x9fce16[_0xadc0('0x1a')]=qs['offset'](_0x265558[_0xadc0('0x2e')][_0xadc0('0x1a')]);}_0x9fce16[_0xadc0('0x37')]=qs[_0xadc0('0x38')](_0x265558[_0xadc0('0x2e')][_0xadc0('0x38')]);_0x9fce16[_0xadc0('0x39')]=qs[_0xadc0('0x30')](_[_0xadc0('0x3a')](_0x265558[_0xadc0('0x2e')],_0x497abc['filters']),_0x3ea81c);if(_0x265558[_0xadc0('0x2e')][_0xadc0('0x3b')]){_0x9fce16[_0xadc0('0x39')]=_['merge'](_0x9fce16[_0xadc0('0x39')],{'$or':_[_0xadc0('0x2a')](_0x3ea81c,function(_0x5239b8){if(_0x5239b8[_0xadc0('0x3c')]!=='VIRTUAL'){var _0x1475e9={};_0x1475e9[_0x5239b8[_0xadc0('0x27')]]={'$like':'%'+_0x265558[_0xadc0('0x2e')][_0xadc0('0x3b')]+'%'};return _0x1475e9;}})});}_0x9fce16=_[_0xadc0('0x3d')]({},_0x9fce16,_0x265558[_0xadc0('0x3e')]);var _0x3404c6={'where':_0x9fce16[_0xadc0('0x39')]};return db['Schedule']['count'](_0x3404c6)[_0xadc0('0x20')](function(_0x1e52db){_0x3511fa['count']=_0x1e52db;if(_0x265558[_0xadc0('0x2e')][_0xadc0('0x3f')]){_0x9fce16[_0xadc0('0x40')]=[{'all':!![]}];}return db['Schedule'][_0xadc0('0x41')](_0x9fce16);})[_0xadc0('0x20')](function(_0x26cd6c){_0x3511fa['rows']=_0x26cd6c;return _0x3511fa;})[_0xadc0('0x20')](respondWithFilteredResult(_0x1b3dd2,_0x9fce16))[_0xadc0('0x42')](handleError(_0x1b3dd2,null));};exports['show']=function(_0x37ac9c,_0x210c60){var _0x2af164={'raw':![],'where':{'id':_0x37ac9c[_0xadc0('0x43')]['id']}},_0x536ee8={};_0x536ee8[_0xadc0('0x32')]=_['keys'](db[_0xadc0('0x2b')]['rawAttributes']);_0x536ee8[_0xadc0('0x2e')]=_[_0xadc0('0x2f')](_0x37ac9c[_0xadc0('0x2e')]);_0x536ee8[_0xadc0('0x30')]=_[_0xadc0('0x31')](_0x536ee8[_0xadc0('0x32')],_0x536ee8[_0xadc0('0x2e')]);_0x2af164['attributes']=_[_0xadc0('0x31')](_0x536ee8[_0xadc0('0x32')],qs['fields'](_0x37ac9c[_0xadc0('0x2e')]['fields']));_0x2af164[_0xadc0('0x33')]=_0x2af164[_0xadc0('0x33')][_0xadc0('0x35')]?_0x2af164[_0xadc0('0x33')]:_0x536ee8[_0xadc0('0x32')];if(_0x37ac9c[_0xadc0('0x2e')][_0xadc0('0x3f')]){_0x2af164['include']=[{'all':!![]}];}_0x2af164=_[_0xadc0('0x3d')]({},_0x2af164,_0x37ac9c[_0xadc0('0x3e')]);return db[_0xadc0('0x2b')][_0xadc0('0x44')](_0x2af164)[_0xadc0('0x20')](handleEntityNotFound(_0x210c60,null))['then'](respondWithResult(_0x210c60,null))['catch'](handleError(_0x210c60,null));};exports['create']=function(_0x4deef9,_0x363ffd){return db['Schedule']['create'](_0x4deef9[_0xadc0('0x45')],{})[_0xadc0('0x20')](function(_0x310223){var _0x3322e8=_0x4deef9[_0xadc0('0x46')][_0xadc0('0x21')]({'plain':!![]});if(!_0x3322e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3322e8[_0xadc0('0x47')]===_0xadc0('0x46')){var _0x5957ad=_0x310223[_0xadc0('0x21')]({'plain':!![]});var _0x318703=_0xadc0('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x318703,'userProfileId':_0x3322e8[_0xadc0('0x48')]},'raw':!![]})[_0xadc0('0x20')](function(_0x1c8b62){if(_0x1c8b62&&_0x1c8b62[_0xadc0('0x49')]===0x0){return db[_0xadc0('0x23')][_0xadc0('0x4a')]({'name':_0x5957ad['name'],'resourceId':_0x5957ad['id'],'type':_0x1c8b62[_0xadc0('0x27')],'sectionId':_0x1c8b62['id']},{})[_0xadc0('0x20')](function(){return _0x310223;});}else{return _0x310223;}})[_0xadc0('0x42')](function(_0x12b69d){logger[_0xadc0('0x25')](_0xadc0('0x4b'),_0x12b69d);throw _0x12b69d;});}return _0x310223;})[_0xadc0('0x20')](respondWithResult(_0x363ffd,0xc9))['catch'](handleError(_0x363ffd,null));};exports[_0xadc0('0x4c')]=function(_0x1a63a9,_0x49e5a8){if(_0x1a63a9[_0xadc0('0x45')]['id']){delete _0x1a63a9[_0xadc0('0x45')]['id'];}return db['Schedule'][_0xadc0('0x44')]({'where':{'id':_0x1a63a9['params']['id']}})[_0xadc0('0x20')](handleEntityNotFound(_0x49e5a8,null))[_0xadc0('0x20')](saveUpdates(_0x1a63a9['body'],null))[_0xadc0('0x20')](respondWithResult(_0x49e5a8,null))['catch'](handleError(_0x49e5a8,null));};exports[_0xadc0('0x24')]=function(_0x49c912,_0x53798c){return db['Schedule'][_0xadc0('0x44')]({'where':{'id':_0x49c912[_0xadc0('0x43')]['id']}})['then'](handleEntityNotFound(_0x53798c,null))[_0xadc0('0x20')](removeEntity(_0x53798c,null))[_0xadc0('0x42')](handleError(_0x53798c,null));};exports[_0xadc0('0x4d')]=function(_0x99fbfa,_0x46b181,_0xaf56d){var _0x40276c=require(_0xadc0('0x4e'));return db[_0xadc0('0x2b')][_0xadc0('0x44')]({'where':{'id':_0x99fbfa[_0xadc0('0x43')]['id']},'raw':!![]})[_0xadc0('0x20')](handleEntityNotFound(_0x46b181,null))[_0xadc0('0x20')](function(){_0x40276c[_0xadc0('0x4d')](_0x99fbfa['params']['id']);})['then'](respondWithStatusCode(_0x46b181,null))[_0xadc0('0x42')](handleError(_0x46b181,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ca66388..b1b65f2 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 _0x3bbc=['./schedule.attributes','exports','Schedule','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x169f86,_0xadf81f){var _0x30cced=function(_0x84611b){while(--_0x84611b){_0x169f86['push'](_0x169f86['shift']());}};_0x30cced(++_0xadf81f);}(_0x3bbc,0xfd));var _0xc3bb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3bbc[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3bb('0x0'))(_0xc3bb('0x1'));var moment=require('moment');var BPromise=require(_0xc3bb('0x2'));var rp=require(_0xc3bb('0x3'));var fs=require('fs');var path=require(_0xc3bb('0x4'));var rimraf=require(_0xc3bb('0x5'));var config=require(_0xc3bb('0x6'));var attributes=require(_0xc3bb('0x7'));module[_0xc3bb('0x8')]=function(_0x2feda1,_0x7d0f98){return _0x2feda1['define'](_0xc3bb('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9979=['request-promise','path','rimraf','./schedule.attributes','exports','tools_schedules','util','../../config/logger','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9979,0x1df));var _0x9997=function(_0x4182e8,_0x238b08){_0x4182e8=_0x4182e8-0x0;var _0x13437d=_0x9979[_0x4182e8];return _0x13437d;};'use strict';var _=require('lodash');var util=require(_0x9997('0x0'));var logger=require(_0x9997('0x1'))(_0x9997('0x2'));var moment=require(_0x9997('0x3'));var BPromise=require(_0x9997('0x4'));var rp=require(_0x9997('0x5'));var fs=require('fs');var path=require(_0x9997('0x6'));var rimraf=require(_0x9997('0x7'));var config=require('../../config/environment');var attributes=require(_0x9997('0x8'));module[_0x9997('0x9')]=function(_0x334fe3,_0x172014){return _0x334fe3['define']('Schedule',attributes,{'tableName':_0x9997('0xa'),'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 b661587..5a6b06b 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 _0xdf8d=['lodash','moment','rpc','client','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x266e2c,_0x57b6ab){var _0xb19c8b=function(_0x4b9f49){while(--_0x4b9f49){_0x266e2c['push'](_0x266e2c['shift']());}};_0xb19c8b(++_0x57b6ab);}(_0xdf8d,0xb6));var _0xddf8=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xdf8d[_0x243217];return _0x478029;};'use strict';var _=require(_0xddf8('0x0'));var util=require('util');var moment=require(_0xddf8('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('../../config/utils');var logger=require('../../config/logger')(_0xddf8('0x2'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xddf8('0x3')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15c4e7,_0xe61c3,_0x183718){return new BPromise(function(_0x324daf,_0x41941f){return client['request'](_0x15c4e7,_0x183718)[_0xddf8('0x4')](function(_0x5e10e7){logger[_0xddf8('0x5')](_0xddf8('0x6'),_0xe61c3,'request\x20sent');logger[_0xddf8('0x7')](_0xddf8('0x8'),_0xe61c3,_0xddf8('0x9'),JSON['stringify'](_0x5e10e7));if(_0x5e10e7['error']){if(_0x5e10e7[_0xddf8('0xa')][_0xddf8('0xb')]===0x1f4){logger['error'](_0xddf8('0x6'),_0xe61c3,_0x5e10e7[_0xddf8('0xa')][_0xddf8('0xc')]);return _0x41941f(_0x5e10e7[_0xddf8('0xa')][_0xddf8('0xc')]);}logger[_0xddf8('0xa')]('Schedule,\x20%s,\x20%s',_0xe61c3,_0x5e10e7[_0xddf8('0xa')][_0xddf8('0xc')]);return _0x324daf(_0x5e10e7[_0xddf8('0xa')][_0xddf8('0xc')]);}else{logger['info'](_0xddf8('0x6'),_0xe61c3,_0xddf8('0x9'));_0x324daf(_0x5e10e7[_0xddf8('0xd')]['message']);}})['catch'](function(_0x36d689){logger[_0xddf8('0xa')](_0xddf8('0x6'),_0xe61c3,_0x36d689);_0x41941f(_0x36d689);});});} \ No newline at end of file +var _0x8ea5=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','debug','stringify','error','code','Schedule,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x1977bd,_0x49edc9){var _0x5672a5=function(_0x2c84a8){while(--_0x2c84a8){_0x1977bd['push'](_0x1977bd['shift']());}};_0x5672a5(++_0x49edc9);}(_0x8ea5,0x1b7));var _0x58ea=function(_0x5f0298,_0x3990a2){_0x5f0298=_0x5f0298-0x0;var _0x1d6a85=_0x8ea5[_0x5f0298];return _0x1d6a85;};'use strict';var _=require(_0x58ea('0x0'));var util=require(_0x58ea('0x1'));var moment=require('moment');var BPromise=require(_0x58ea('0x2'));var rs=require(_0x58ea('0x3'));var fs=require('fs');var Redis=require(_0x58ea('0x4'));var db=require(_0x58ea('0x5'))['db'];var utils=require(_0x58ea('0x6'));var logger=require(_0x58ea('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x58ea('0x8')][_0x58ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x533707,_0x561c51,_0x2e9694){return new BPromise(function(_0x5fafb,_0x1a74cf){return client[_0x58ea('0xa')](_0x533707,_0x2e9694)[_0x58ea('0xb')](function(_0x711f6a){logger[_0x58ea('0xc')]('Schedule,\x20%s,\x20%s',_0x561c51,'request\x20sent');logger[_0x58ea('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x561c51,'request\x20sent',JSON[_0x58ea('0xe')](_0x711f6a));if(_0x711f6a['error']){if(_0x711f6a[_0x58ea('0xf')][_0x58ea('0x10')]===0x1f4){logger['error'](_0x58ea('0x11'),_0x561c51,_0x711f6a[_0x58ea('0xf')]['message']);return _0x1a74cf(_0x711f6a[_0x58ea('0xf')][_0x58ea('0x12')]);}logger[_0x58ea('0xf')](_0x58ea('0x11'),_0x561c51,_0x711f6a['error'][_0x58ea('0x12')]);return _0x5fafb(_0x711f6a['error'][_0x58ea('0x12')]);}else{logger[_0x58ea('0xc')]('Schedule,\x20%s,\x20%s',_0x561c51,_0x58ea('0x13'));_0x5fafb(_0x711f6a[_0x58ea('0x14')][_0x58ea('0x12')]);}})[_0x58ea('0x15')](function(_0x148f79){logger[_0x58ea('0xf')](_0x58ea('0x11'),_0x561c51,_0x148f79);_0x1a74cf(_0x148f79);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 58c0b34..f93ceab 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 _0x567a=['describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x567a,0xdb));var _0xa567=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x567a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa567('0x0'));var timeout=require(_0xa567('0x1'));var express=require('express');var router=express[_0xa567('0x2')]();var auth=require(_0xa567('0x3'));var interaction=require(_0xa567('0x4'));var config=require(_0xa567('0x5'));var controller=require(_0xa567('0x6'));router[_0xa567('0x7')]('/',auth[_0xa567('0x8')](),controller[_0xa567('0x9')]);router[_0xa567('0x7')](_0xa567('0xa'),auth[_0xa567('0x8')](),controller[_0xa567('0xb')]);router['get'](_0xa567('0xc'),auth[_0xa567('0x8')](),controller[_0xa567('0xd')]);router[_0xa567('0x7')](_0xa567('0xe'),auth[_0xa567('0x8')](),controller[_0xa567('0xf')]);router[_0xa567('0x10')]('/',auth[_0xa567('0x8')](),controller[_0xa567('0x11')]);router[_0xa567('0x12')](_0xa567('0xc'),auth[_0xa567('0x8')](),controller[_0xa567('0x13')]);router[_0xa567('0x14')](_0xa567('0xc'),auth['isAuthenticated'](),controller[_0xa567('0x15')]);module[_0xa567('0x16')]=router; \ No newline at end of file +var _0xcd6f=['../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','show','/:id/download','create','put','/:id','delete','destroy','exports','util','Router','../../components/auth/service'];(function(_0x477bf9,_0x7cf50b){var _0x264d79=function(_0x23e5d3){while(--_0x23e5d3){_0x477bf9['push'](_0x477bf9['shift']());}};_0x264d79(++_0x7cf50b);}(_0xcd6f,0xc9));var _0xfcd6=function(_0x59f33e,_0x50645e){_0x59f33e=_0x59f33e-0x0;var _0x412e53=_0xcd6f[_0x59f33e];return _0x412e53;};'use strict';var multer=require('multer');var util=require(_0xfcd6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfcd6('0x1')]();var auth=require(_0xfcd6('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfcd6('0x3'));var controller=require(_0xfcd6('0x4'));router[_0xfcd6('0x5')]('/',auth[_0xfcd6('0x6')](),controller[_0xfcd6('0x7')]);router[_0xfcd6('0x5')](_0xfcd6('0x8'),auth[_0xfcd6('0x6')](),controller['describe']);router[_0xfcd6('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xfcd6('0x9')]);router[_0xfcd6('0x5')](_0xfcd6('0xa'),auth[_0xfcd6('0x6')](),controller['download']);router['post']('/',auth[_0xfcd6('0x6')](),controller[_0xfcd6('0xb')]);router[_0xfcd6('0xc')](_0xfcd6('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xfcd6('0xe')](_0xfcd6('0xd'),auth[_0xfcd6('0x6')](),controller[_0xfcd6('0xf')]);module[_0xfcd6('0x10')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index a5660a6..02e1ce7 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 _0xac9d=['format','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','MM-DD-YYYY\x20HH:mm','toString','DATE'];(function(_0x5a6961,_0x34740b){var _0x185646=function(_0x257e5e){while(--_0x257e5e){_0x5a6961['push'](_0x5a6961['shift']());}};_0x185646(++_0x34740b);}(_0xac9d,0x14d));var _0xdac9=function(_0x35468d,_0x2a7240){_0x35468d=_0x35468d-0x0;var _0x30da52=_0xac9d[_0x35468d];return _0x30da52;};'use strict';var Sequelize=require(_0xdac9('0x0'));var moment=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var config=require(_0xdac9('0x3'));module[_0xdac9('0x4')]={'format':{'type':Sequelize[_0xdac9('0x5')],'get':function(){return this[_0xdac9('0x6')](_0xdac9('0x7'))?path['extname'](this[_0xdac9('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xdac9('0x8')]},'channel':{'type':Sequelize[_0xdac9('0x8')]},'value':{'type':Sequelize[_0xdac9('0x8')],'set':function(_0x776b6c){var _0x1c78c5=_0x776b6c[_0xdac9('0x9')](/\\/g,'/');this['setDataValue'](_0xdac9('0x7'),_0x1c78c5);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdac9('0xa')],'set':function(_0x3a013b){this[_0xdac9('0xb')](_0xdac9('0xc'),moment()[_0xdac9('0xd')](_0x3a013b,'ms'));this[_0xdac9('0xb')](_0xdac9('0xe'),moment());this[_0xdac9('0xb')](_0xdac9('0xf'),_0x3a013b);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xdac9('0x6')](_0xdac9('0xc')))['format'](_0xdac9('0x10'))[_0xdac9('0x11')]();}},'closedAt':{'type':Sequelize[_0xdac9('0x12')],'get':function(){return moment(this['getDataValue'](_0xdac9('0xe')))[_0xdac9('0x13')](_0xdac9('0x10'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xdac9('0x6')](_0xdac9('0x14')))['format'](_0xdac9('0x10'))[_0xdac9('0x11')]();}},'updatedAt':{'type':Sequelize[_0xdac9('0x12')],'get':function(){return moment(this[_0xdac9('0x6')](_0xdac9('0x15')))[_0xdac9('0x13')](_0xdac9('0x10'))[_0xdac9('0x11')]();}}}; \ No newline at end of file +var _0x98a8=['updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt'];(function(_0x4130fa,_0x43f6b4){var _0x37d856=function(_0x8305bd){while(--_0x8305bd){_0x4130fa['push'](_0x4130fa['shift']());}};_0x37d856(++_0x43f6b4);}(_0x98a8,0x12c));var _0x898a=function(_0x170eb3,_0x2d2f52){_0x170eb3=_0x170eb3-0x0;var _0x5378cb=_0x98a8[_0x170eb3];return _0x5378cb;};'use strict';var Sequelize=require(_0x898a('0x0'));var moment=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var config=require(_0x898a('0x3'));module[_0x898a('0x4')]={'format':{'type':Sequelize[_0x898a('0x5')],'get':function(){return this[_0x898a('0x6')]('value')?path[_0x898a('0x7')](this[_0x898a('0x6')](_0x898a('0x8'))):undefined;}},'interactionid':{'type':Sequelize[_0x898a('0x9')]},'channel':{'type':Sequelize[_0x898a('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x3aadc2){var _0x564583=_0x3aadc2[_0x898a('0xa')](/\\/g,'/');this['setDataValue'](_0x898a('0x8'),_0x564583);}},'rating':{'type':Sequelize[_0x898a('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x898a('0xb')],'set':function(_0x96b636){this[_0x898a('0xc')](_0x898a('0xd'),moment()[_0x898a('0xe')](_0x96b636,'ms'));this[_0x898a('0xc')](_0x898a('0xf'),moment());this['setDataValue'](_0x898a('0x10'),_0x96b636);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x898a('0x6')]('startedAt'))[_0x898a('0x11')](_0x898a('0x12'))[_0x898a('0x13')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x898a('0x11')](_0x898a('0x12'))[_0x898a('0x13')]();}},'createdAt':{'type':Sequelize[_0x898a('0x14')],'get':function(){return moment(this[_0x898a('0x6')](_0x898a('0x15')))['format'](_0x898a('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x898a('0x14')],'get':function(){return moment(this['getDataValue'](_0x898a('0x16')))['format'](_0x898a('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index ea32b49..5a1f158 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 _0x5d17=['format','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','ScreenRecording','then','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','merge','find','create','body','createdAt','value','describe','download','../../components/encryptor','uniqueid','root','%s.cypher','existsSync','decryptFile','secrets','recording','join','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','fieldName','key','differenceBy'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0x5d17,0x114));var _0x75d1=function(_0x3df517,_0x373364){_0x3df517=_0x3df517-0x0;var _0x25ddd5=_0x5d17[_0x3df517];return _0x25ddd5;};'use strict';var pdf=require(_0x75d1('0x0'));var emlformat=require(_0x75d1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x75d1('0x2'));var rp=require(_0x75d1('0x3'));var moment=require(_0x75d1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75d1('0x5'));var util=require(_0x75d1('0x6'));var path=require(_0x75d1('0x7'));var sox=require(_0x75d1('0x8'));var csv=require('to-csv');var ejs=require(_0x75d1('0x9'));var fs=require('fs');var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x11'));var hardwareService=require(_0x75d1('0x12'));var logger=require('../../config/logger')(_0x75d1('0x13'));var utils=require(_0x75d1('0x14'));var config=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0x6c1265,_0xd089cf){_0xd089cf=_0xd089cf||0xcc;return function(_0x49667a){if(_0x49667a){return _0x6c1265[_0x75d1('0x17')](_0xd089cf);}return _0x6c1265[_0x75d1('0x18')](_0xd089cf)[_0x75d1('0x19')]();};}function respondWithResult(_0x314a71,_0x49d723){_0x49d723=_0x49d723||0xc8;return function(_0x553697){if(_0x553697){return _0x314a71['status'](_0x49d723)[_0x75d1('0x1a')](_0x553697);}};}function respondWithFilteredResult(_0x12fa32,_0x2fd022){return function(_0x52e649){if(_0x52e649){var _0x1f9620=_0x52e649[_0x75d1('0x1b')],_0x3fff9b=_0x2fd022[_0x75d1('0x1c')],_0x1d30f3=_0x2fd022[_0x75d1('0x1c')]+_0x2fd022[_0x75d1('0x1d')],_0x269e82;if(_0x1d30f3>=_0x1f9620){_0x1d30f3=_0x1f9620;_0x269e82=0xc8;}else{_0x269e82=0xce;}_0x12fa32[_0x75d1('0x18')](_0x269e82);return _0x12fa32[_0x75d1('0x1e')](_0x75d1('0x1f'),_0x3fff9b+'-'+_0x1d30f3+'/'+_0x1f9620)['json'](_0x52e649);}return null;};}function patchUpdates(_0x493fff){return function(_0xc6b282){try{jsonpatch[_0x75d1('0x20')](_0xc6b282,_0x493fff,!![]);}catch(_0x56730d){return BPromise[_0x75d1('0x21')](_0x56730d);}return _0xc6b282[_0x75d1('0x22')]();};}function saveUpdates(_0x579731,_0xf6cc70){return function(_0xa42dbe){if(_0xa42dbe){return _0xa42dbe[_0x75d1('0x23')](_0x579731)['then'](function(_0x1d9d25){return _0x1d9d25;});}return null;};}function removeEntity(_0x522924,_0x501cc7){return function(_0x1cb58c){if(_0x1cb58c){return _0x1cb58c[_0x75d1('0x24')]()['then'](function(){_0x522924[_0x75d1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(!_0x345cf5){_0x3a85c0['sendStatus'](0x194);}return _0x345cf5;};}function handleError(_0x525588,_0x4590ac){_0x4590ac=_0x4590ac||0x1f4;return function(_0x45b18f){logger[_0x75d1('0x25')](_0x45b18f[_0x75d1('0x26')]);if(_0x45b18f['name']){delete _0x45b18f[_0x75d1('0x27')];}_0x525588[_0x75d1('0x18')](_0x4590ac)[_0x75d1('0x28')](_0x45b18f);};}exports['index']=function(_0x54095d,_0x57efd6){var _0x364dc9={},_0x30d9f3={},_0x45c182={'count':0x0,'rows':[]};var _0x468bf0=_[_0x75d1('0x29')](db['ScreenRecording']['rawAttributes'],function(_0x410e16){return{'name':_0x410e16[_0x75d1('0x2a')],'type':_0x410e16['type'][_0x75d1('0x2b')]};});_0x30d9f3['model']=_[_0x75d1('0x2c')](_[_0x75d1('0x29')](_0x468bf0,_0x75d1('0x27')),[_0x75d1('0x2d')]);_0x30d9f3[_0x75d1('0x2e')]=_['keys'](_0x54095d[_0x75d1('0x2e')]);_0x30d9f3[_0x75d1('0x2f')]=_[_0x75d1('0x30')](_0x30d9f3[_0x75d1('0x31')],_0x30d9f3['query']);_0x364dc9[_0x75d1('0x32')]=_['intersection'](_0x30d9f3[_0x75d1('0x31')],qs[_0x75d1('0x33')](_0x54095d['query'][_0x75d1('0x33')]));_0x364dc9[_0x75d1('0x32')]=_0x364dc9[_0x75d1('0x32')][_0x75d1('0x34')]?_0x364dc9[_0x75d1('0x32')]:_0x30d9f3['model'];if(!_0x54095d[_0x75d1('0x2e')][_0x75d1('0x35')](_0x75d1('0x36'))){_0x364dc9[_0x75d1('0x1d')]=qs['limit'](_0x54095d['query']['limit']);_0x364dc9[_0x75d1('0x1c')]=qs[_0x75d1('0x1c')](_0x54095d[_0x75d1('0x2e')][_0x75d1('0x1c')]);}_0x364dc9[_0x75d1('0x37')]=qs[_0x75d1('0x38')](_0x54095d[_0x75d1('0x2e')][_0x75d1('0x38')]);_0x364dc9[_0x75d1('0x39')]=qs['filters'](_[_0x75d1('0x3a')](_0x54095d[_0x75d1('0x2e')],_0x30d9f3[_0x75d1('0x2f')]),_0x468bf0);if(_0x54095d[_0x75d1('0x2e')][_0x75d1('0x3b')]){_0x364dc9['where']=_['merge'](_0x364dc9['where'],{'$or':_[_0x75d1('0x29')](_0x468bf0,function(_0x17c0f6){if(_0x17c0f6[_0x75d1('0x3c')]!==_0x75d1('0x3d')){var _0x460b92={};_0x460b92[_0x17c0f6[_0x75d1('0x27')]]={'$like':'%'+_0x54095d['query']['filter']+'%'};return _0x460b92;}})});}_0x364dc9=_['merge']({},_0x364dc9,_0x54095d[_0x75d1('0x3e')]);var _0x4cb084={'where':_0x364dc9['where']};return db[_0x75d1('0x3f')][_0x75d1('0x1b')](_0x4cb084)[_0x75d1('0x40')](function(_0x46854c){_0x45c182['count']=_0x46854c;if(_0x54095d[_0x75d1('0x2e')][_0x75d1('0x41')]){_0x364dc9[_0x75d1('0x42')]=[{'all':!![]}];}return db[_0x75d1('0x3f')][_0x75d1('0x43')](_0x364dc9);})[_0x75d1('0x40')](function(_0x33df05){_0x45c182[_0x75d1('0x44')]=_0x33df05;return _0x45c182;})[_0x75d1('0x40')](respondWithFilteredResult(_0x57efd6,_0x364dc9))[_0x75d1('0x45')](handleError(_0x57efd6,null));};exports[_0x75d1('0x46')]=function(_0x93922f,_0xe14be9){var _0x577e6e={'raw':![],'where':{'id':_0x93922f[_0x75d1('0x47')]['id']}},_0x16550e={};_0x16550e[_0x75d1('0x31')]=_[_0x75d1('0x48')](db[_0x75d1('0x3f')][_0x75d1('0x49')]);_0x16550e[_0x75d1('0x2e')]=_[_0x75d1('0x48')](_0x93922f['query']);_0x16550e['filters']=_[_0x75d1('0x30')](_0x16550e[_0x75d1('0x31')],_0x16550e[_0x75d1('0x2e')]);_0x577e6e[_0x75d1('0x32')]=_['intersection'](_0x16550e[_0x75d1('0x31')],qs[_0x75d1('0x33')](_0x93922f[_0x75d1('0x2e')][_0x75d1('0x33')]));_0x577e6e['attributes']=_0x577e6e[_0x75d1('0x32')][_0x75d1('0x34')]?_0x577e6e[_0x75d1('0x32')]:_0x16550e[_0x75d1('0x31')];if(_0x93922f['query'][_0x75d1('0x41')]){_0x577e6e['include']=[{'all':!![]}];}_0x577e6e=_[_0x75d1('0x4a')]({},_0x577e6e,_0x93922f[_0x75d1('0x3e')]);return db[_0x75d1('0x3f')][_0x75d1('0x4b')](_0x577e6e)[_0x75d1('0x40')](handleEntityNotFound(_0xe14be9,null))[_0x75d1('0x40')](respondWithResult(_0xe14be9,null))['catch'](handleError(_0xe14be9,null));};exports[_0x75d1('0x4c')]=function(_0x589ad8,_0x5b7663){return db[_0x75d1('0x3f')][_0x75d1('0x4c')](_0x589ad8[_0x75d1('0x4d')],{})[_0x75d1('0x40')](respondWithResult(_0x5b7663,0xc9))[_0x75d1('0x45')](handleError(_0x5b7663,null));};exports[_0x75d1('0x23')]=function(_0x18f96a,_0x5b7b7c){if(_0x18f96a['body']['id']){delete _0x18f96a[_0x75d1('0x4d')]['id'];}delete _0x18f96a[_0x75d1('0x4d')]['duration'];delete _0x18f96a[_0x75d1('0x4d')][_0x75d1('0x4e')];delete _0x18f96a[_0x75d1('0x4d')]['closedAt'];delete _0x18f96a[_0x75d1('0x4d')][_0x75d1('0x4f')];return db[_0x75d1('0x3f')][_0x75d1('0x4b')]({'where':{'id':_0x18f96a[_0x75d1('0x47')]['id']}})[_0x75d1('0x40')](handleEntityNotFound(_0x5b7b7c,null))[_0x75d1('0x40')](saveUpdates(_0x18f96a['body'],null))[_0x75d1('0x40')](respondWithResult(_0x5b7b7c,null))[_0x75d1('0x45')](handleError(_0x5b7b7c,null));};exports[_0x75d1('0x50')]=function(_0x395e0b,_0x43bd9d){return db[_0x75d1('0x3f')][_0x75d1('0x50')]()['then'](respondWithResult(_0x43bd9d,null))[_0x75d1('0x45')](handleError(_0x43bd9d,null));};exports[_0x75d1('0x51')]=function(_0x42d587,_0x575319,_0x350cf4){var _0x30d6bd=require(_0x75d1('0x52'));var _0x382760=![];var _0x281123={};if(_0x42d587[_0x75d1('0x2e')]['type']&&_0x42d587[_0x75d1('0x2e')][_0x75d1('0x3c')]===_0x75d1('0x53')){_0x281123[_0x75d1('0x53')]=_0x42d587[_0x75d1('0x47')]['id'];}else{_0x281123['id']=_0x42d587[_0x75d1('0x47')]['id'];}return db[_0x75d1('0x3f')][_0x75d1('0x4b')]({'where':_0x281123,'attributes':['id',_0x75d1('0x4f')],'raw':!![]})[_0x75d1('0x40')](handleEntityNotFound(_0x575319,null))[_0x75d1('0x40')](function(_0x13050e){if(_0x13050e){var _0x5ceb42=path['join'](config[_0x75d1('0x54')],'server/files/screen_recordings',_0x13050e[_0x75d1('0x4f')]);var _0x1e149b=util['format'](_0x75d1('0x55'),_0x5ceb42);if(fs[_0x75d1('0x56')](_0x1e149b)){_0x382760=!![];return _0x30d6bd[_0x75d1('0x57')](_0x1e149b,_0x5ceb42,config[_0x75d1('0x58')][_0x75d1('0x59')])[_0x75d1('0x40')](function(){return _0x13050e;});}return _0x13050e;}})[_0x75d1('0x40')](function(_0x5048ef){if(_0x5048ef){var _0x3c5da6=path[_0x75d1('0x5a')](config[_0x75d1('0x54')],_0x75d1('0x5b'),_0x5048ef[_0x75d1('0x4f')]);if(!fs[_0x75d1('0x56')](_0x3c5da6)){throw new db[(_0x75d1('0x5c'))][(_0x75d1('0x5d'))](_0x75d1('0x5e'));}if(_0x5048ef[_0x75d1('0x5f')]){return _0x575319['download'](_0x3c5da6,_0x5048ef['filename']+path[_0x75d1('0x60')](_0x3c5da6),function(){if(_0x382760){fs[_0x75d1('0x61')](_0x3c5da6);}});}else{return _0x575319[_0x75d1('0x51')](_0x3c5da6,function(_0x49d9ca){if(_0x382760){fs[_0x75d1('0x61')](_0x3c5da6);}});}}})['catch'](function(_0x2005d1){if(_0x2005d1[_0x75d1('0x62')]===_0x75d1('0x5e')){_0x575319[_0x75d1('0x18')](0x194)['send'](_0x75d1('0x63'));}else{return handleError(_0x575319,null);}});};exports['destroy']=function(_0x4b1943,_0x18d8f3){return db[_0x75d1('0x3f')][_0x75d1('0x4b')]({'where':{'id':_0x4b1943[_0x75d1('0x47')]['id']}})['then'](function(_0x4c45ff){if(!_0x4c45ff)throw new ReferenceError(_0x75d1('0x64'));return _0x4c45ff;})[_0x75d1('0x40')](function(_0x4ec3c5){var _0x1a52fa=path[_0x75d1('0x5a')](config['root'],_0x75d1('0x5b'),_0x4ec3c5[_0x75d1('0x4f')]);logger[_0x75d1('0x65')](_0x75d1('0x66'),_0x1a52fa);if(!_[_0x75d1('0x67')](_0x4ec3c5[_0x75d1('0x4f')])&&fs[_0x75d1('0x56')](_0x1a52fa)){logger[_0x75d1('0x65')](_0x75d1('0x68')+_0x1a52fa+_0x75d1('0x69'));fs[_0x75d1('0x6a')](_0x1a52fa);}_0x1a52fa=_0x1a52fa+'.cypher';if(!_[_0x75d1('0x67')](_0x4ec3c5[_0x75d1('0x4f')])&&fs[_0x75d1('0x56')](_0x1a52fa)){logger[_0x75d1('0x65')](_0x75d1('0x68')+_0x1a52fa+_0x75d1('0x69'));fs[_0x75d1('0x6a')](_0x1a52fa);}return _0x4ec3c5;})['then'](function(_0x5f4395){if(!_0x5f4395)throw new InternalError();return _0x5f4395[_0x75d1('0x24')]();})[_0x75d1('0x40')](function(){_0x18d8f3[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();})[_0x75d1('0x45')](handleError(_0x18d8f3,null));}; \ No newline at end of file +var _0x0d23=['rows','catch','params','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','find','join','server/files/screen_recordings','format','%s.cypher','existsSync','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','download','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0d23,0xe8));var _0x30d2=function(_0x59d795,_0xd98596){_0x59d795=_0x59d795-0x0;var _0xbb606e=_0x0d23[_0x59d795];return _0xbb606e;};'use strict';var pdf=require(_0x30d2('0x0'));var emlformat=require(_0x30d2('0x1'));var rimraf=require(_0x30d2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x30d2('0x3'));var moment=require(_0x30d2('0x4'));var BPromise=require(_0x30d2('0x5'));var Mustache=require(_0x30d2('0x6'));var util=require('util');var path=require(_0x30d2('0x7'));var sox=require(_0x30d2('0x8'));var csv=require(_0x30d2('0x9'));var ejs=require(_0x30d2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x30d2('0xb'));var crypto=require(_0x30d2('0xc'));var jsforce=require(_0x30d2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x30d2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x30d2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x30d2('0xf'));var hardwareService=require(_0x30d2('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x30d2('0x11'));var config=require('../../config/environment');var db=require(_0x30d2('0x12'))['db'];function respondWithStatusCode(_0x186d37,_0x274198){_0x274198=_0x274198||0xcc;return function(_0x1c3368){if(_0x1c3368){return _0x186d37['sendStatus'](_0x274198);}return _0x186d37[_0x30d2('0x13')](_0x274198)[_0x30d2('0x14')]();};}function respondWithResult(_0x41b3b4,_0x3f3f15){_0x3f3f15=_0x3f3f15||0xc8;return function(_0x1433ba){if(_0x1433ba){return _0x41b3b4[_0x30d2('0x13')](_0x3f3f15)[_0x30d2('0x15')](_0x1433ba);}};}function respondWithFilteredResult(_0x182b79,_0x3499d4){return function(_0x3bc72b){if(_0x3bc72b){var _0x2448a8=_0x3bc72b[_0x30d2('0x16')],_0x485b59=_0x3499d4[_0x30d2('0x17')],_0x40e131=_0x3499d4[_0x30d2('0x17')]+_0x3499d4[_0x30d2('0x18')],_0x1706d9;if(_0x40e131>=_0x2448a8){_0x40e131=_0x2448a8;_0x1706d9=0xc8;}else{_0x1706d9=0xce;}_0x182b79[_0x30d2('0x13')](_0x1706d9);return _0x182b79['set'](_0x30d2('0x19'),_0x485b59+'-'+_0x40e131+'/'+_0x2448a8)['json'](_0x3bc72b);}return null;};}function patchUpdates(_0x4c2832){return function(_0x5e88a3){try{jsonpatch['apply'](_0x5e88a3,_0x4c2832,!![]);}catch(_0x30ca7f){return BPromise['reject'](_0x30ca7f);}return _0x5e88a3[_0x30d2('0x1a')]();};}function saveUpdates(_0x1bf124,_0x58baa8){return function(_0x306a0f){if(_0x306a0f){return _0x306a0f[_0x30d2('0x1b')](_0x1bf124)[_0x30d2('0x1c')](function(_0x20b8c6){return _0x20b8c6;});}return null;};}function removeEntity(_0x634553,_0x2c35c0){return function(_0x2f90a2){if(_0x2f90a2){return _0x2f90a2[_0x30d2('0x1d')]()[_0x30d2('0x1c')](function(){_0x634553['status'](0xcc)[_0x30d2('0x14')]();});}};}function handleEntityNotFound(_0x2a715d,_0xa1b7c4){return function(_0x16f979){if(!_0x16f979){_0x2a715d[_0x30d2('0x1e')](0x194);}return _0x16f979;};}function handleError(_0x36702a,_0x579ad0){_0x579ad0=_0x579ad0||0x1f4;return function(_0x474700){logger[_0x30d2('0x1f')](_0x474700[_0x30d2('0x20')]);if(_0x474700['name']){delete _0x474700[_0x30d2('0x21')];}_0x36702a['status'](_0x579ad0)['send'](_0x474700);};}exports[_0x30d2('0x22')]=function(_0x1a7da3,_0x282aa2){var _0x13f535={},_0x236426={},_0x41480c={'count':0x0,'rows':[]};var _0x3d6d82=_[_0x30d2('0x23')](db[_0x30d2('0x24')][_0x30d2('0x25')],function(_0x2aecfb){return{'name':_0x2aecfb[_0x30d2('0x26')],'type':_0x2aecfb[_0x30d2('0x27')][_0x30d2('0x28')]};});_0x236426[_0x30d2('0x29')]=_['differenceBy'](_['map'](_0x3d6d82,_0x30d2('0x21')),['format']);_0x236426[_0x30d2('0x2a')]=_[_0x30d2('0x2b')](_0x1a7da3['query']);_0x236426[_0x30d2('0x2c')]=_['intersection'](_0x236426[_0x30d2('0x29')],_0x236426[_0x30d2('0x2a')]);_0x13f535[_0x30d2('0x2d')]=_[_0x30d2('0x2e')](_0x236426['model'],qs[_0x30d2('0x2f')](_0x1a7da3[_0x30d2('0x2a')][_0x30d2('0x2f')]));_0x13f535[_0x30d2('0x2d')]=_0x13f535[_0x30d2('0x2d')]['length']?_0x13f535[_0x30d2('0x2d')]:_0x236426[_0x30d2('0x29')];if(!_0x1a7da3['query']['hasOwnProperty']('nolimit')){_0x13f535['limit']=qs[_0x30d2('0x18')](_0x1a7da3[_0x30d2('0x2a')][_0x30d2('0x18')]);_0x13f535[_0x30d2('0x17')]=qs[_0x30d2('0x17')](_0x1a7da3[_0x30d2('0x2a')][_0x30d2('0x17')]);}_0x13f535[_0x30d2('0x30')]=qs[_0x30d2('0x31')](_0x1a7da3[_0x30d2('0x2a')][_0x30d2('0x31')]);_0x13f535['where']=qs[_0x30d2('0x2c')](_[_0x30d2('0x32')](_0x1a7da3['query'],_0x236426[_0x30d2('0x2c')]),_0x3d6d82);if(_0x1a7da3[_0x30d2('0x2a')][_0x30d2('0x33')]){_0x13f535[_0x30d2('0x34')]=_[_0x30d2('0x35')](_0x13f535[_0x30d2('0x34')],{'$or':_[_0x30d2('0x23')](_0x3d6d82,function(_0x41228b){if(_0x41228b[_0x30d2('0x27')]!==_0x30d2('0x36')){var _0x3e5e30={};_0x3e5e30[_0x41228b['name']]={'$like':'%'+_0x1a7da3['query']['filter']+'%'};return _0x3e5e30;}})});}_0x13f535=_[_0x30d2('0x35')]({},_0x13f535,_0x1a7da3[_0x30d2('0x37')]);var _0x552489={'where':_0x13f535['where']};return db['ScreenRecording'][_0x30d2('0x16')](_0x552489)[_0x30d2('0x1c')](function(_0x540649){_0x41480c['count']=_0x540649;if(_0x1a7da3['query'][_0x30d2('0x38')]){_0x13f535[_0x30d2('0x39')]=[{'all':!![]}];}return db[_0x30d2('0x24')][_0x30d2('0x3a')](_0x13f535);})[_0x30d2('0x1c')](function(_0x1fd051){_0x41480c[_0x30d2('0x3b')]=_0x1fd051;return _0x41480c;})['then'](respondWithFilteredResult(_0x282aa2,_0x13f535))[_0x30d2('0x3c')](handleError(_0x282aa2,null));};exports['show']=function(_0x20245c,_0x20a877){var _0x151c9e={'raw':![],'where':{'id':_0x20245c[_0x30d2('0x3d')]['id']}},_0xea656a={};_0xea656a[_0x30d2('0x29')]=_[_0x30d2('0x2b')](db[_0x30d2('0x24')][_0x30d2('0x25')]);_0xea656a[_0x30d2('0x2a')]=_[_0x30d2('0x2b')](_0x20245c[_0x30d2('0x2a')]);_0xea656a[_0x30d2('0x2c')]=_[_0x30d2('0x2e')](_0xea656a[_0x30d2('0x29')],_0xea656a[_0x30d2('0x2a')]);_0x151c9e['attributes']=_[_0x30d2('0x2e')](_0xea656a['model'],qs[_0x30d2('0x2f')](_0x20245c['query']['fields']));_0x151c9e[_0x30d2('0x2d')]=_0x151c9e[_0x30d2('0x2d')]['length']?_0x151c9e['attributes']:_0xea656a[_0x30d2('0x29')];if(_0x20245c['query']['includeAll']){_0x151c9e[_0x30d2('0x39')]=[{'all':!![]}];}_0x151c9e=_[_0x30d2('0x35')]({},_0x151c9e,_0x20245c[_0x30d2('0x37')]);return db['ScreenRecording']['find'](_0x151c9e)[_0x30d2('0x1c')](handleEntityNotFound(_0x20a877,null))['then'](respondWithResult(_0x20a877,null))[_0x30d2('0x3c')](handleError(_0x20a877,null));};exports[_0x30d2('0x3e')]=function(_0x2607ca,_0x2a6220){return db[_0x30d2('0x24')][_0x30d2('0x3e')](_0x2607ca[_0x30d2('0x3f')],{})['then'](respondWithResult(_0x2a6220,0xc9))[_0x30d2('0x3c')](handleError(_0x2a6220,null));};exports['update']=function(_0x106e11,_0x31078e){if(_0x106e11[_0x30d2('0x3f')]['id']){delete _0x106e11['body']['id'];}delete _0x106e11[_0x30d2('0x3f')][_0x30d2('0x40')];delete _0x106e11[_0x30d2('0x3f')][_0x30d2('0x41')];delete _0x106e11[_0x30d2('0x3f')][_0x30d2('0x42')];delete _0x106e11['body'][_0x30d2('0x43')];return db[_0x30d2('0x24')]['find']({'where':{'id':_0x106e11['params']['id']}})[_0x30d2('0x1c')](handleEntityNotFound(_0x31078e,null))[_0x30d2('0x1c')](saveUpdates(_0x106e11[_0x30d2('0x3f')],null))['then'](respondWithResult(_0x31078e,null))['catch'](handleError(_0x31078e,null));};exports['describe']=function(_0x2008fa,_0xb3d0b6){return db[_0x30d2('0x24')][_0x30d2('0x44')]()[_0x30d2('0x1c')](respondWithResult(_0xb3d0b6,null))[_0x30d2('0x3c')](handleError(_0xb3d0b6,null));};exports['download']=function(_0x25bf55,_0x17200d,_0x1f61c1){var _0x421ff6=require(_0x30d2('0x45'));var _0x32419e=![];var _0x47dd13={};if(_0x25bf55[_0x30d2('0x2a')][_0x30d2('0x27')]&&_0x25bf55[_0x30d2('0x2a')][_0x30d2('0x27')]===_0x30d2('0x46')){_0x47dd13['uniqueid']=_0x25bf55[_0x30d2('0x3d')]['id'];}else{_0x47dd13['id']=_0x25bf55['params']['id'];}return db[_0x30d2('0x24')][_0x30d2('0x47')]({'where':_0x47dd13,'attributes':['id',_0x30d2('0x43')],'raw':!![]})[_0x30d2('0x1c')](handleEntityNotFound(_0x17200d,null))[_0x30d2('0x1c')](function(_0x59c662){if(_0x59c662){var _0x38caa8=path[_0x30d2('0x48')](config['root'],_0x30d2('0x49'),_0x59c662[_0x30d2('0x43')]);var _0x46e8e8=util[_0x30d2('0x4a')](_0x30d2('0x4b'),_0x38caa8);if(fs[_0x30d2('0x4c')](_0x46e8e8)){_0x32419e=!![];return _0x421ff6['decryptFile'](_0x46e8e8,_0x38caa8,config[_0x30d2('0x4d')][_0x30d2('0x4e')])['then'](function(){return _0x59c662;});}return _0x59c662;}})['then'](function(_0x1c2676){if(_0x1c2676){var _0x39287d=path[_0x30d2('0x48')](config[_0x30d2('0x4f')],_0x30d2('0x49'),_0x1c2676['value']);if(!fs['existsSync'](_0x39287d)){throw new db[(_0x30d2('0x50'))][(_0x30d2('0x51'))](_0x30d2('0x52'));}if(_0x1c2676[_0x30d2('0x53')]){return _0x17200d['download'](_0x39287d,_0x1c2676[_0x30d2('0x53')]+path[_0x30d2('0x54')](_0x39287d),function(){if(_0x32419e){fs['unlink'](_0x39287d);}});}else{return _0x17200d[_0x30d2('0x55')](_0x39287d,function(_0x116722){if(_0x32419e){fs[_0x30d2('0x56')](_0x39287d);}});}}})['catch'](function(_0x289ef5){if(_0x289ef5[_0x30d2('0x57')]===_0x30d2('0x52')){_0x17200d[_0x30d2('0x13')](0x194)['send'](_0x30d2('0x58'));}else{return handleError(_0x17200d,null);}});};exports[_0x30d2('0x1d')]=function(_0x13a7da,_0x1daf67){return db[_0x30d2('0x24')][_0x30d2('0x47')]({'where':{'id':_0x13a7da['params']['id']}})[_0x30d2('0x1c')](function(_0xeb9b44){if(!_0xeb9b44)throw new ReferenceError(_0x30d2('0x59'));return _0xeb9b44;})[_0x30d2('0x1c')](function(_0x9b6b4a){var _0x575c5e=path['join'](config['root'],'server/files/screen_recordings',_0x9b6b4a[_0x30d2('0x43')]);logger[_0x30d2('0x5a')](_0x30d2('0x5b'),_0x575c5e);if(!_[_0x30d2('0x5c')](_0x9b6b4a[_0x30d2('0x43')])&&fs[_0x30d2('0x4c')](_0x575c5e)){logger[_0x30d2('0x5a')](_0x30d2('0x5d')+_0x575c5e+_0x30d2('0x5e'));fs[_0x30d2('0x5f')](_0x575c5e);}_0x575c5e=_0x575c5e+_0x30d2('0x60');if(!_['isNil'](_0x9b6b4a[_0x30d2('0x43')])&&fs[_0x30d2('0x4c')](_0x575c5e)){logger['info']('File:\x20\x22'+_0x575c5e+_0x30d2('0x5e'));fs[_0x30d2('0x5f')](_0x575c5e);}return _0x9b6b4a;})[_0x30d2('0x1c')](function(_0x15f22d){if(!_0x15f22d)throw new InternalError();return _0x15f22d[_0x30d2('0x1d')]();})[_0x30d2('0x1c')](function(){_0x1daf67[_0x30d2('0x13')](0xcc)[_0x30d2('0x14')]();})[_0x30d2('0x3c')](handleError(_0x1daf67,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 80093d8..7e5bfe5 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 _0x4d5a=['screen_recordings','interactionid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./screenRecording.attributes','define','ScreenRecording'];(function(_0x2da8c4,_0x27adda){var _0x3ee006=function(_0x4b9d7c){while(--_0x4b9d7c){_0x2da8c4['push'](_0x2da8c4['shift']());}};_0x3ee006(++_0x27adda);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x4d5a[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0xa4d5('0x0'));var logger=require(_0xa4d5('0x1'))(_0xa4d5('0x2'));var moment=require('moment');var BPromise=require(_0xa4d5('0x3'));var rp=require(_0xa4d5('0x4'));var fs=require('fs');var path=require(_0xa4d5('0x5'));var rimraf=require(_0xa4d5('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4d5('0x7'));module['exports']=function(_0x5e25a5,_0x32d194){return _0x5e25a5[_0xa4d5('0x8')](_0xa4d5('0x9'),attributes,{'tableName':_0xa4d5('0xa'),'paranoid':![],'indexes':[{'name':_0xa4d5('0xb'),'fields':[_0xa4d5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x191b=['util','../../config/logger','api','moment','bluebird','exports','define','ScreenRecording'];(function(_0x23d96d,_0x2c5c84){var _0x52bdbd=function(_0x157f50){while(--_0x157f50){_0x23d96d['push'](_0x23d96d['shift']());}};_0x52bdbd(++_0x2c5c84);}(_0x191b,0x100));var _0xb191=function(_0x41af9a,_0x4e8fc6){_0x41af9a=_0x41af9a-0x0;var _0x104b40=_0x191b[_0x41af9a];return _0x104b40;};'use strict';var _=require('lodash');var util=require(_0xb191('0x0'));var logger=require(_0xb191('0x1'))(_0xb191('0x2'));var moment=require(_0xb191('0x3'));var BPromise=require(_0xb191('0x4'));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('./screenRecording.attributes');module[_0xb191('0x5')]=function(_0x3bca62,_0x283687){return _0x3bca62[_0xb191('0x6')](_0xb191('0x7'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 6ebb904..e6d7428 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(_0x1a5003,_0x2fdf49){var _0xc6aacb=function(_0x3f2c10){while(--_0x3f2c10){_0x1a5003['push'](_0x1a5003['shift']());}};_0xc6aacb(++_0x2fdf49);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x7fd03,_0x4a534f){var _0x289816=function(_0x54a7aa){while(--_0x54a7aa){_0x7fd03['push'](_0x7fd03['shift']());}};_0x289816(++_0x4a534f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 4b8165d..fc3e48b 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 _0xfdb1=['/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','logologin','/:id/logo_login','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0xfdb1,0x74));var _0x1fdb=function(_0x3e3a55,_0x1c1eba){_0x3e3a55=_0x3e3a55-0x0;var _0x2f25d3=_0xfdb1[_0x3e3a55];return _0x2f25d3;};'use strict';var multer=require(_0x1fdb('0x0'));var util=require(_0x1fdb('0x1'));var path=require('path');var timeout=require(_0x1fdb('0x2'));var express=require(_0x1fdb('0x3'));var router=express[_0x1fdb('0x4')]();var auth=require(_0x1fdb('0x5'));var interaction=require(_0x1fdb('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x1fdb('0x7')]('/',auth[_0x1fdb('0x8')](),controller[_0x1fdb('0x9')]);router[_0x1fdb('0x7')](_0x1fdb('0xa'),controller[_0x1fdb('0xb')]);router[_0x1fdb('0x7')](_0x1fdb('0xc'),controller[_0x1fdb('0xd')]);router[_0x1fdb('0x7')]('/:id/logo_login',controller[_0x1fdb('0xe')]);router[_0x1fdb('0x7')](_0x1fdb('0xf'),controller['gdpr']);router['get'](_0x1fdb('0x10'),controller[_0x1fdb('0x11')]);router[_0x1fdb('0x7')](_0x1fdb('0x12'),controller[_0x1fdb('0x13')]);var upload=multer({'storage':multer[_0x1fdb('0x14')]({'destination':function(_0x2b0795,_0xf432b7,_0x359fb6){_0x359fb6(null,path[_0x1fdb('0x15')](config[_0x1fdb('0x16')],_0x1fdb('0x17')));},'filename':function(_0x425913,_0x157162,_0x42f491){_0x42f491(null,util[_0x1fdb('0x18')](_0x1fdb('0x19'),'logo',path[_0x1fdb('0x1a')](_0x157162[_0x1fdb('0x1b')])));}})});router[_0x1fdb('0x1c')](_0x1fdb('0xc'),upload[_0x1fdb('0x1d')](_0x1fdb('0x1e')),controller[_0x1fdb('0x1f')]);var upload=multer({'storage':multer[_0x1fdb('0x14')]({'destination':function(_0x155355,_0x4b709b,_0x2917e1){_0x2917e1(null,path[_0x1fdb('0x15')](config[_0x1fdb('0x16')],_0x1fdb('0x17')));},'filename':function(_0x10c996,_0x1d6e5a,_0x792de8){_0x792de8(null,util[_0x1fdb('0x18')]('%s%s',_0x1fdb('0x20'),path[_0x1fdb('0x1a')](_0x1d6e5a['originalname'])));}})});router[_0x1fdb('0x1c')](_0x1fdb('0x21'),upload['single'](_0x1fdb('0x1e')),controller[_0x1fdb('0x22')]);var upload=multer({'storage':multer[_0x1fdb('0x14')]({'destination':function(_0x2d18b2,_0x227407,_0x4d1000){_0x4d1000(null,path[_0x1fdb('0x15')](config[_0x1fdb('0x16')],'server/files/images/logos/'));},'filename':function(_0x531309,_0x4a0dfd,_0x37553){_0x37553(null,util[_0x1fdb('0x18')](_0x1fdb('0x19'),_0x1fdb('0x23'),path[_0x1fdb('0x1a')](_0x4a0dfd[_0x1fdb('0x1b')])));}})});router['post'](_0x1fdb('0x10'),upload[_0x1fdb('0x1d')]('file'),controller[_0x1fdb('0x24')]);var upload=multer({'storage':multer[_0x1fdb('0x14')]({'destination':function(_0x4682ec,_0x47822d,_0x225471){_0x225471(null,path['join'](config[_0x1fdb('0x16')],'server/files/images/logos/'));},'filename':function(_0x6dce0c,_0x12f055,_0x5d6f3c){_0x5d6f3c(null,util['format'](_0x1fdb('0x19'),_0x1fdb('0x25'),path[_0x1fdb('0x1a')](_0x12f055[_0x1fdb('0x1b')])));}})});router['post']('/:id/favicon',upload[_0x1fdb('0x1d')](_0x1fdb('0x1e')),controller[_0x1fdb('0x26')]);router[_0x1fdb('0x27')](_0x1fdb('0xa'),auth[_0x1fdb('0x8')](),controller[_0x1fdb('0x28')]);module[_0x1fdb('0x29')]=router; \ No newline at end of file +var _0x5436=['file','addLogoLogin','join','preferred','addPreferred','favicon','addFavicon','put','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','format','logo','extname','originalname','post','single','addLogo','server/files/images/logos/','%s%s','logologin'];(function(_0x2c63cb,_0x2f6c97){var _0x11db24=function(_0xa8bdee){while(--_0xa8bdee){_0x2c63cb['push'](_0x2c63cb['shift']());}};_0x11db24(++_0x2f6c97);}(_0x5436,0x1cc));var _0x6543=function(_0x5cc4bc,_0x38e8d5){_0x5cc4bc=_0x5cc4bc-0x0;var _0x1632eb=_0x5436[_0x5cc4bc];return _0x1632eb;};'use strict';var multer=require(_0x6543('0x0'));var util=require(_0x6543('0x1'));var path=require(_0x6543('0x2'));var timeout=require(_0x6543('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6543('0x4'));var interaction=require(_0x6543('0x5'));var config=require(_0x6543('0x6'));var controller=require('./setting.controller');router[_0x6543('0x7')]('/',auth[_0x6543('0x8')](),controller[_0x6543('0x9')]);router[_0x6543('0x7')](_0x6543('0xa'),controller['show']);router[_0x6543('0x7')](_0x6543('0xb'),controller['getLogo']);router['get'](_0x6543('0xc'),controller[_0x6543('0xd')]);router[_0x6543('0x7')](_0x6543('0xe'),controller[_0x6543('0xf')]);router[_0x6543('0x7')](_0x6543('0x10'),controller[_0x6543('0x11')]);router[_0x6543('0x7')](_0x6543('0x12'),controller[_0x6543('0x13')]);var upload=multer({'storage':multer[_0x6543('0x14')]({'destination':function(_0x124998,_0x3dd9d3,_0x529cc3){_0x529cc3(null,path['join'](config[_0x6543('0x15')],'server/files/images/logos/'));},'filename':function(_0x3d7c29,_0x3979cf,_0x30fa3f){_0x30fa3f(null,util[_0x6543('0x16')]('%s%s',_0x6543('0x17'),path[_0x6543('0x18')](_0x3979cf[_0x6543('0x19')])));}})});router[_0x6543('0x1a')]('/:id/logo',upload[_0x6543('0x1b')]('file'),controller[_0x6543('0x1c')]);var upload=multer({'storage':multer[_0x6543('0x14')]({'destination':function(_0xf25df8,_0x3bc578,_0x4c9994){_0x4c9994(null,path['join'](config[_0x6543('0x15')],_0x6543('0x1d')));},'filename':function(_0x7efc1e,_0x49a98f,_0x1f7793){_0x1f7793(null,util[_0x6543('0x16')](_0x6543('0x1e'),_0x6543('0x1f'),path[_0x6543('0x18')](_0x49a98f[_0x6543('0x19')])));}})});router[_0x6543('0x1a')]('/:id/logo_login',upload[_0x6543('0x1b')](_0x6543('0x20')),controller[_0x6543('0x21')]);var upload=multer({'storage':multer[_0x6543('0x14')]({'destination':function(_0x4293c8,_0x476418,_0x525707){_0x525707(null,path[_0x6543('0x22')](config[_0x6543('0x15')],_0x6543('0x1d')));},'filename':function(_0xd0242f,_0x8357,_0x398e4c){_0x398e4c(null,util[_0x6543('0x16')]('%s%s',_0x6543('0x23'),path[_0x6543('0x18')](_0x8357[_0x6543('0x19')])));}})});router[_0x6543('0x1a')](_0x6543('0x10'),upload[_0x6543('0x1b')](_0x6543('0x20')),controller[_0x6543('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2630f6,_0x147223,_0x48f777){_0x48f777(null,path[_0x6543('0x22')](config[_0x6543('0x15')],_0x6543('0x1d')));},'filename':function(_0xa920c4,_0x377461,_0x4aa0cf){_0x4aa0cf(null,util[_0x6543('0x16')](_0x6543('0x1e'),_0x6543('0x25'),path[_0x6543('0x18')](_0x377461[_0x6543('0x19')])));}})});router[_0x6543('0x1a')](_0x6543('0x12'),upload['single']('file'),controller[_0x6543('0x26')]);router[_0x6543('0x27')](_0x6543('0xa'),auth[_0x6543('0x8')](),controller['update']);module[_0x6543('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 979684b..f5e3bbe 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 _0x5c94=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','sequelize','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x4d003f,_0x593984){var _0x26f727=function(_0x39d901){while(--_0x39d901){_0x4d003f['push'](_0x4d003f['shift']());}};_0x26f727(++_0x593984);}(_0x5c94,0x9b));var _0x45c9=function(_0x14e6b9,_0x4fabec){_0x14e6b9=_0x14e6b9-0x0;var _0x390eb6=_0x5c94[_0x14e6b9];return _0x390eb6;};'use strict';var Sequelize=require(_0x45c9('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x45c9('0x1')](0xb),'unique':_0x45c9('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x45c9('0x1')](0xb),'unique':_0x45c9('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x45c9('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x45c9('0x4')],'defaultValue':_0x45c9('0x5')},'logo':{'type':Sequelize[_0x45c9('0x4')]},'defaultLogo':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x45c9('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x45c9('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x45c9('0x4')]},'turnaddr':{'type':Sequelize[_0x45c9('0x4')]},'turnusername':{'type':Sequelize[_0x45c9('0x4')]},'turnpassword':{'type':Sequelize[_0x45c9('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x45c9('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x45c9('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x45c9('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x45c9('0x4')],'defaultValue':_0x45c9('0x7')},'chatTimeout':{'type':Sequelize[_0x45c9('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x45c9('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x45c9('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x45c9('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x45c9('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x45c9('0x4')]},'defaultFavicon':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x45c9('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x45c9('0x1')]},'transcribeRegion':{'type':Sequelize[_0x45c9('0x4')]},'sentiment':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x45c9('0x1')]},'sentimentRegion':{'type':Sequelize[_0x45c9('0x4')]},'language':{'type':Sequelize[_0x45c9('0x4')]},'bucket':{'type':Sequelize[_0x45c9('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x45c9('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x3410=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER','min_mailbox'];(function(_0x2eda7d,_0x162382){var _0x2fd21d=function(_0x3bf4d0){while(--_0x3bf4d0){_0x2eda7d['push'](_0x2eda7d['shift']());}};_0x2fd21d(++_0x162382);}(_0x3410,0x18c));var _0x0341=function(_0x3baa54,_0x4ebfea){_0x3baa54=_0x3baa54-0x0;var _0x126327=_0x3410[_0x3baa54];return _0x126327;};'use strict';var Sequelize=require(_0x0341('0x0'));module[_0x0341('0x1')]={'min_internal':{'type':Sequelize[_0x0341('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0341('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x0341('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0341('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x0341('0x4')]},'defaultLogo':{'type':Sequelize[_0x0341('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x0341('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0341('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0341('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0341('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0341('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0341('0x4')]},'turnaddr':{'type':Sequelize[_0x0341('0x4')]},'turnusername':{'type':Sequelize[_0x0341('0x4')]},'turnpassword':{'type':Sequelize[_0x0341('0x4')]},'pageTitle':{'type':Sequelize[_0x0341('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0341('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0341('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0341('0x4')],'defaultValue':_0x0341('0x6')},'enableEmailPreview':{'type':Sequelize[_0x0341('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x0341('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x0341('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0341('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0341('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0341('0x4')],'defaultValue':_0x0341('0x7')},'chatTimeout':{'type':Sequelize[_0x0341('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0341('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0341('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0341('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0341('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0341('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0341('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0341('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0341('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0341('0x4')]},'sentiment':{'type':Sequelize[_0x0341('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0341('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0341('0x2')]},'sentimentRegion':{'type':Sequelize[_0x0341('0x4')]},'language':{'type':Sequelize[_0x0341('0x4')]},'bucket':{'type':Sequelize[_0x0341('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0341('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c80b465..6ee18e0 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 _0xd0de=['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','jayson/promise','client','test','Sequelize','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','Setting','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','find','body','addLogo','file','logo','filename','getLogo','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','upperFirst','default_logo.svg','existsSync','ValidationError','\x20not\x20found','../../config/license/util','server/files/images/logos','default_loginLogo.svg','default','custom','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x2cc6c2,_0x5407d6){var _0x4c0adf=function(_0x4dc9b1){while(--_0x4dc9b1){_0x2cc6c2['push'](_0x2cc6c2['shift']());}};_0x4c0adf(++_0x5407d6);}(_0xd0de,0xe8));var _0xed0d=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0xd0de[_0x3b231a];return _0x18d67a;};'use strict';var pdf=require(_0xed0d('0x0'));var emlformat=require(_0xed0d('0x1'));var rimraf=require(_0xed0d('0x2'));var zipdir=require(_0xed0d('0x3'));var jsonpatch=require(_0xed0d('0x4'));var rp=require('request-promise');var moment=require(_0xed0d('0x5'));var BPromise=require(_0xed0d('0x6'));var Mustache=require(_0xed0d('0x7'));var util=require(_0xed0d('0x8'));var path=require(_0xed0d('0x9'));var sox=require('sox');var csv=require(_0xed0d('0xa'));var ejs=require(_0xed0d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xed0d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed0d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xed0d('0xe'));var Papa=require(_0xed0d('0xf'));var Redis=require(_0xed0d('0x10'));var authService=require(_0xed0d('0x11'));var qs=require(_0xed0d('0x12'));var as=require(_0xed0d('0x13'));var hardwareService=require(_0xed0d('0x14'));var logger=require(_0xed0d('0x15'))(_0xed0d('0x16'));var utils=require(_0xed0d('0x17'));var config=require(_0xed0d('0x18'));var db=require(_0xed0d('0x19'))['db'];var jayson=require(_0xed0d('0x1a'));var client=jayson[_0xed0d('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x535aa1,_0x22ca1d,_0x9195fb){if(_0x9195fb){var _0x2915f4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2915f4[_0xed0d('0x1c')](_0x22ca1d)){return _0x535aa1;}else{throw new db[(_0xed0d('0x1d'))]['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 _0x535aa1;}}function respondWithRpcPromise(_0x685611,_0x2b1358,_0x5d53f0,_0x4bf283){return new BPromise(function(_0x4504f4,_0x1f2d13){var _0x5c9556=_0x4bf283||client;return _0x5c9556['request'](_0x685611,_0x5d53f0)[_0xed0d('0x1e')](function(_0x366228){logger[_0xed0d('0x1f')](_0xed0d('0x20'),_0x2b1358,_0xed0d('0x21'));logger[_0xed0d('0x22')](_0xed0d('0x23'),_0x2b1358,'request\x20sent',JSON[_0xed0d('0x24')](_0x366228));if(_0x366228[_0xed0d('0x25')]){if(_0x366228[_0xed0d('0x25')][_0xed0d('0x26')]===0x1f4){logger[_0xed0d('0x25')](_0xed0d('0x20'),_0x2b1358,_0x366228[_0xed0d('0x25')][_0xed0d('0x27')]);return _0x1f2d13(_0x366228[_0xed0d('0x25')]['message']);}logger[_0xed0d('0x25')](_0xed0d('0x20'),_0x2b1358,_0x366228[_0xed0d('0x25')]['message']);return _0x4504f4(_0x366228[_0xed0d('0x25')][_0xed0d('0x27')]);}else{logger[_0xed0d('0x1f')]('Setting,\x20%s,\x20%s',_0x2b1358,_0xed0d('0x21'));_0x4504f4(_0x366228[_0xed0d('0x28')][_0xed0d('0x27')]);}})[_0xed0d('0x29')](function(_0x95f1c4){logger['error'](_0xed0d('0x20'),_0x2b1358,_0x95f1c4);_0x1f2d13(_0x95f1c4);});});}function respondWithStatusCode(_0x3122a6,_0x683fd){_0x683fd=_0x683fd||0xcc;return function(_0x148b22){if(_0x148b22){return _0x3122a6['sendStatus'](_0x683fd);}return _0x3122a6[_0xed0d('0x2a')](_0x683fd)[_0xed0d('0x2b')]();};}function respondWithResult(_0x2683fa,_0x28551d){_0x28551d=_0x28551d||0xc8;return function(_0x1a6575){if(_0x1a6575){return _0x2683fa[_0xed0d('0x2a')](_0x28551d)['json'](_0x1a6575);}};}function respondWithFilteredResult(_0x490662,_0x560cf0){return function(_0xa63d27){if(_0xa63d27){var _0x20cdd4=_0xa63d27[_0xed0d('0x2c')],_0x1fabeb=_0x560cf0[_0xed0d('0x2d')],_0x498ea6=_0x560cf0[_0xed0d('0x2d')]+_0x560cf0['limit'],_0x2c1aae;if(_0x498ea6>=_0x20cdd4){_0x498ea6=_0x20cdd4;_0x2c1aae=0xc8;}else{_0x2c1aae=0xce;}_0x490662[_0xed0d('0x2a')](_0x2c1aae);return _0x490662[_0xed0d('0x2e')](_0xed0d('0x2f'),_0x1fabeb+'-'+_0x498ea6+'/'+_0x20cdd4)[_0xed0d('0x30')](_0xa63d27);}return null;};}function patchUpdates(_0x2f477b){return function(_0x425303){try{jsonpatch[_0xed0d('0x31')](_0x425303,_0x2f477b,!![]);}catch(_0x18b975){return BPromise[_0xed0d('0x32')](_0x18b975);}return _0x425303[_0xed0d('0x33')]();};}function saveUpdates(_0x48784b,_0x3512e0){return function(_0x16f55d){if(_0x16f55d){return _0x16f55d[_0xed0d('0x34')](_0x48784b)['then'](function(_0x399650){return _0x399650;});}return null;};}function removeEntity(_0x41b01d,_0xdb49d1){return function(_0x4f081d){if(_0x4f081d){return _0x4f081d[_0xed0d('0x35')]()[_0xed0d('0x1e')](function(){_0x41b01d['status'](0xcc)[_0xed0d('0x2b')]();});}};}function handleEntityNotFound(_0x361a9b,_0x5ba105){return function(_0x3becdf){if(!_0x3becdf){_0x361a9b[_0xed0d('0x36')](0x194);}return _0x3becdf;};}function handleError(_0x3b766b,_0x4455bc){_0x4455bc=_0x4455bc||0x1f4;return function(_0x5f53fe){logger['error'](_0x5f53fe[_0xed0d('0x37')]);if(_0x5f53fe[_0xed0d('0x38')]){delete _0x5f53fe[_0xed0d('0x38')];}_0x3b766b['status'](_0x4455bc)['send'](_0x5f53fe);};}exports[_0xed0d('0x39')]=function(_0x2a0932,_0x226ec7){var _0x195a46={},_0x381980={},_0x6fe4ca={'count':0x0,'rows':[]};var _0x24c221=_[_0xed0d('0x3a')](db[_0xed0d('0x3b')][_0xed0d('0x3c')],function(_0x4b5a92){return{'name':_0x4b5a92['fieldName'],'type':_0x4b5a92[_0xed0d('0x3d')][_0xed0d('0x3e')]};});_0x381980[_0xed0d('0x3f')]=_['map'](_0x24c221,_0xed0d('0x38'));_0x381980[_0xed0d('0x40')]=_[_0xed0d('0x41')](_0x2a0932[_0xed0d('0x40')]);_0x381980['filters']=_[_0xed0d('0x42')](_0x381980['model'],_0x381980[_0xed0d('0x40')]);_0x195a46[_0xed0d('0x43')]=_[_0xed0d('0x42')](_0x381980[_0xed0d('0x3f')],qs['fields'](_0x2a0932[_0xed0d('0x40')][_0xed0d('0x44')]));_0x195a46[_0xed0d('0x43')]=_0x195a46[_0xed0d('0x43')][_0xed0d('0x45')]?_0x195a46['attributes']:_0x381980[_0xed0d('0x3f')];if(!_0x2a0932[_0xed0d('0x40')][_0xed0d('0x46')](_0xed0d('0x47'))){_0x195a46[_0xed0d('0x48')]=qs[_0xed0d('0x48')](_0x2a0932['query'][_0xed0d('0x48')]);_0x195a46[_0xed0d('0x2d')]=qs[_0xed0d('0x2d')](_0x2a0932[_0xed0d('0x40')][_0xed0d('0x2d')]);}_0x195a46[_0xed0d('0x49')]=qs[_0xed0d('0x4a')](_0x2a0932[_0xed0d('0x40')][_0xed0d('0x4a')]);_0x195a46[_0xed0d('0x4b')]=qs[_0xed0d('0x4c')](_[_0xed0d('0x4d')](_0x2a0932[_0xed0d('0x40')],_0x381980['filters']),_0x24c221);if(_0x2a0932[_0xed0d('0x40')][_0xed0d('0x4e')]){_0x195a46[_0xed0d('0x4b')]=_['merge'](_0x195a46[_0xed0d('0x4b')],{'$or':_[_0xed0d('0x3a')](_0x24c221,function(_0x57efc2){if(_0x57efc2['type']!==_0xed0d('0x4f')){var _0xc2609e={};_0xc2609e[_0x57efc2[_0xed0d('0x38')]]={'$like':'%'+_0x2a0932[_0xed0d('0x40')]['filter']+'%'};return _0xc2609e;}})});}_0x195a46=_[_0xed0d('0x50')]({},_0x195a46,_0x2a0932[_0xed0d('0x51')]);var _0xe0342c={'where':_0x195a46[_0xed0d('0x4b')]};return db[_0xed0d('0x3b')][_0xed0d('0x2c')](_0xe0342c)[_0xed0d('0x1e')](function(_0x48230c){_0x6fe4ca[_0xed0d('0x2c')]=_0x48230c;if(_0x2a0932[_0xed0d('0x40')][_0xed0d('0x52')]){_0x195a46[_0xed0d('0x53')]=[{'all':!![]}];}return db[_0xed0d('0x3b')]['findAll'](_0x195a46);})[_0xed0d('0x1e')](function(_0x3c8630){_0x6fe4ca[_0xed0d('0x54')]=_0x3c8630;return _0x6fe4ca;})[_0xed0d('0x1e')](respondWithFilteredResult(_0x226ec7,_0x195a46))['catch'](handleError(_0x226ec7,null));};exports['show']=function(_0x46ea84,_0x28387d){var _0x474f5b={'raw':![],'where':{'id':_0x46ea84[_0xed0d('0x55')]['id']}},_0x3da45e={};_0x3da45e[_0xed0d('0x3f')]=_[_0xed0d('0x41')](db[_0xed0d('0x3b')][_0xed0d('0x3c')]);_0x3da45e['query']=_[_0xed0d('0x41')](_0x46ea84[_0xed0d('0x40')]);_0x3da45e[_0xed0d('0x4c')]=_['intersection'](_0x3da45e[_0xed0d('0x3f')],_0x3da45e[_0xed0d('0x40')]);_0x474f5b[_0xed0d('0x43')]=_[_0xed0d('0x42')](_0x3da45e[_0xed0d('0x3f')],qs[_0xed0d('0x44')](_0x46ea84[_0xed0d('0x40')][_0xed0d('0x44')]));_0x474f5b[_0xed0d('0x43')]=_0x474f5b['attributes'][_0xed0d('0x45')]?_0x474f5b['attributes']:_0x3da45e[_0xed0d('0x3f')];if(_0x46ea84[_0xed0d('0x40')][_0xed0d('0x52')]){_0x474f5b[_0xed0d('0x53')]=[{'all':!![]}];}_0x474f5b=_[_0xed0d('0x50')]({},_0x474f5b,_0x46ea84[_0xed0d('0x51')]);return db['Setting'][_0xed0d('0x56')](_0x474f5b)[_0xed0d('0x1e')](handleEntityNotFound(_0x28387d,null))[_0xed0d('0x1e')](respondWithResult(_0x28387d,null))['catch'](handleError(_0x28387d,null));};exports['update']=function(_0x425afa,_0x516c10){if(_0x425afa[_0xed0d('0x57')]['id']){delete _0x425afa[_0xed0d('0x57')]['id'];}return db[_0xed0d('0x3b')][_0xed0d('0x56')]({'where':{'id':_0x425afa['params']['id']}})['then'](handleEntityNotFound(_0x516c10,null))[_0xed0d('0x1e')](saveUpdates(_0x425afa['body'],null))[_0xed0d('0x1e')](respondWithResult(_0x516c10,null))['catch'](handleError(_0x516c10,null));};exports[_0xed0d('0x58')]=function(_0x2a9793,_0xa4a2b7,_0x7ccd66){if(_0x2a9793[_0xed0d('0x59')]&&_0x2a9793['file']['filename']){_0x2a9793[_0xed0d('0x57')][_0xed0d('0x5a')]=_0x2a9793[_0xed0d('0x59')][_0xed0d('0x5b')];}return db[_0xed0d('0x3b')][_0xed0d('0x56')]({'where':{'id':_0x2a9793[_0xed0d('0x55')]['id']}})[_0xed0d('0x1e')](handleEntityNotFound(_0xa4a2b7,null))['then'](saveUpdates(_0x2a9793[_0xed0d('0x57')],null))[_0xed0d('0x1e')](respondWithResult(_0xa4a2b7,null))[_0xed0d('0x29')](handleError(_0xa4a2b7,null));};exports['addLogoLogin']=function(_0x153b36,_0xd62f47,_0x824e5d){if(_0x153b36[_0xed0d('0x59')]&&_0x153b36['file'][_0xed0d('0x5b')]){_0x153b36[_0xed0d('0x57')]['loginLogo']=_0x153b36['file']['filename'];}return db[_0xed0d('0x3b')][_0xed0d('0x56')]({'where':{'id':_0x153b36[_0xed0d('0x55')]['id']}})['then'](handleEntityNotFound(_0xd62f47,null))[_0xed0d('0x1e')](saveUpdates(_0x153b36[_0xed0d('0x57')],null))[_0xed0d('0x1e')](respondWithResult(_0xd62f47,null))[_0xed0d('0x29')](handleError(_0xd62f47,null));};var utilLicense=require('../../config/license/util');exports[_0xed0d('0x5c')]=function(_0x1666e3,_0x31ce56,_0x500045){var _0x5cb96a='server/files/images/logos';var _0x58b9bd={'custom':![]};return utilLicense[_0xed0d('0x5d')]()[_0xed0d('0x1e')](function(_0x2653cd){if(_0x2653cd){_0x58b9bd=_0x2653cd;}return db[_0xed0d('0x3b')][_0xed0d('0x56')]({'where':{'id':_0x1666e3[_0xed0d('0x55')]['id']},'attributes':['logo',_0xed0d('0x5e'),_0xed0d('0x5f'),_0xed0d('0x60'),_0xed0d('0x61'),_0xed0d('0x62'),_0xed0d('0x63'),_0xed0d('0x64')],'raw':!![]});})[_0xed0d('0x1e')](handleEntityNotFound(_0x31ce56,null))[_0xed0d('0x1e')](function(_0x1e5163){if(_0x1e5163){var _0x16ce6d=_0x1e5163['logo']&&fs['existsSync'](path[_0xed0d('0x65')](config[_0xed0d('0x66')],_0x5cb96a,_['toLower'](_0x1e5163[_0xed0d('0x5a')])))?path[_0xed0d('0x65')](config[_0xed0d('0x66')],_0x5cb96a,_['toLower'](_0x1e5163[_0xed0d('0x5a')])):path['join'](config[_0xed0d('0x66')],_0x5cb96a,_[_0xed0d('0x67')]('default_logo.svg'));var _0x3b249f='default'+_[_0xed0d('0x68')]('logo');if(_0x1e5163[_0x3b249f]||!_0x58b9bd['custom']){_0x16ce6d=path[_0xed0d('0x65')](config[_0xed0d('0x66')],_0x5cb96a,_[_0xed0d('0x67')](_0xed0d('0x69')));}if(!fs[_0xed0d('0x6a')](_0x16ce6d)){throw new db[(_0xed0d('0x1d'))][(_0xed0d('0x6b'))](_[_0xed0d('0x68')](_0xed0d('0x5a'))+_0xed0d('0x6c'));}return _0x31ce56['download'](_0x16ce6d);}})[_0xed0d('0x29')](handleError(_0x31ce56,null));};var utilLicense=require(_0xed0d('0x6d'));exports['getLogoLogin']=function(_0x37f858,_0x4dbda2,_0x29847c){var _0x5c887b=_0xed0d('0x6e');var _0xb9d1be={'custom':![]};return utilLicense[_0xed0d('0x5d')]()[_0xed0d('0x1e')](function(_0x48c26a){if(_0x48c26a){_0xb9d1be=_0x48c26a;}return db[_0xed0d('0x3b')][_0xed0d('0x56')]({'where':{'id':_0x37f858['params']['id']},'attributes':[_0xed0d('0x5a'),_0xed0d('0x5e'),'preferred',_0xed0d('0x60'),'defaultLogo',_0xed0d('0x62'),_0xed0d('0x63'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x4dbda2,null))[_0xed0d('0x1e')](function(_0x79ac64){if(_0x79ac64){var _0x5b3cc0=_0x79ac64['loginLogo']&&fs['existsSync'](path[_0xed0d('0x65')](config['root'],_0x5c887b,_[_0xed0d('0x67')](_0x79ac64[_0xed0d('0x5e')])))?path[_0xed0d('0x65')](config[_0xed0d('0x66')],_0x5c887b,_['toLower'](_0x79ac64[_0xed0d('0x5e')])):path[_0xed0d('0x65')](config['root'],_0x5c887b,_[_0xed0d('0x67')](_0xed0d('0x6f')));var _0x540b3e=_0xed0d('0x70')+_[_0xed0d('0x68')]('loginLogo');if(_0x79ac64[_0x540b3e]||!_0xb9d1be[_0xed0d('0x71')]){_0x5b3cc0=path['join'](config[_0xed0d('0x66')],_0x5c887b,_[_0xed0d('0x67')](_0xed0d('0x6f')));}if(!fs[_0xed0d('0x6a')](_0x5b3cc0)){throw new db[(_0xed0d('0x1d'))]['ValidationError'](_['upperFirst'](_0xed0d('0x5e'))+_0xed0d('0x6c'));}return _0x4dbda2['download'](_0x5b3cc0);}})[_0xed0d('0x29')](handleError(_0x4dbda2,null));};exports['gdpr']=function(_0x56d542,_0x84ec33){return db[_0xed0d('0x3b')][_0xed0d('0x56')]({'where':{'id':_0x56d542[_0xed0d('0x55')]['id']},'attributes':[_0xed0d('0x72')]})[_0xed0d('0x1e')](respondWithResult(_0x84ec33,null))[_0xed0d('0x29')](handleError(_0x84ec33,null));};exports[_0xed0d('0x73')]=function(_0xa8ce05,_0x53bcd3,_0x3c3c85){if(_0xa8ce05['file']&&_0xa8ce05['file'][_0xed0d('0x5b')]){_0xa8ce05[_0xed0d('0x57')][_0xed0d('0x5f')]=_0xa8ce05[_0xed0d('0x59')][_0xed0d('0x5b')];}return db[_0xed0d('0x3b')][_0xed0d('0x56')]({'where':{'id':_0xa8ce05[_0xed0d('0x55')]['id']}})[_0xed0d('0x1e')](handleEntityNotFound(_0x53bcd3,null))[_0xed0d('0x1e')](saveUpdates(_0xa8ce05[_0xed0d('0x57')],null))[_0xed0d('0x1e')](respondWithResult(_0x53bcd3,null))[_0xed0d('0x29')](handleError(_0x53bcd3,null));};var utilLicense=require(_0xed0d('0x6d'));exports[_0xed0d('0x74')]=function(_0x4c0da3,_0x4a7ec0,_0x269df4){var _0x48f829=_0xed0d('0x6e');var _0x3bf86b={'custom':![]};return utilLicense[_0xed0d('0x5d')]()[_0xed0d('0x1e')](function(_0x39d76b){if(_0x39d76b){_0x3bf86b=_0x39d76b;}return db[_0xed0d('0x3b')][_0xed0d('0x56')]({'where':{'id':_0x4c0da3['params']['id']},'attributes':[_0xed0d('0x5a'),_0xed0d('0x5e'),_0xed0d('0x5f'),'favicon','defaultLogo',_0xed0d('0x62'),_0xed0d('0x63'),_0xed0d('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x4a7ec0,null))[_0xed0d('0x1e')](function(_0x182d93){if(_0x182d93){var _0xb9029c=_0x182d93[_0xed0d('0x5f')]&&fs['existsSync'](path[_0xed0d('0x65')](config[_0xed0d('0x66')],_0x48f829,_['toLower'](_0x182d93['preferred'])))?path[_0xed0d('0x65')](config['root'],_0x48f829,_[_0xed0d('0x67')](_0x182d93['preferred'])):path[_0xed0d('0x65')](config[_0xed0d('0x66')],_0x48f829,_[_0xed0d('0x67')](_0xed0d('0x75')));var _0x2ee879='default'+_[_0xed0d('0x68')](_0xed0d('0x5f'));if(_0x182d93[_0x2ee879]||!_0x3bf86b['custom']||!_0x3bf86b[_0xed0d('0x5f')]){_0xb9029c=path[_0xed0d('0x65')](config['root'],_0x48f829,_['toLower'](_0xed0d('0x75')));}if(!fs['existsSync'](_0xb9029c)){throw new db['Sequelize'][(_0xed0d('0x6b'))](_[_0xed0d('0x68')]('preferred')+_0xed0d('0x6c'));}return _0x4a7ec0['download'](_0xb9029c);}})['catch'](handleError(_0x4a7ec0,null));};exports[_0xed0d('0x76')]=function(_0x4cdf4d,_0x462b3a,_0x27bdf3){if(_0x4cdf4d[_0xed0d('0x59')]&&_0x4cdf4d[_0xed0d('0x59')][_0xed0d('0x5b')]){_0x4cdf4d[_0xed0d('0x57')][_0xed0d('0x60')]=_0x4cdf4d[_0xed0d('0x59')][_0xed0d('0x5b')];}return db[_0xed0d('0x3b')]['find']({'where':{'id':_0x4cdf4d['params']['id']}})['then'](handleEntityNotFound(_0x462b3a,null))['then'](saveUpdates(_0x4cdf4d[_0xed0d('0x57')],null))['then'](respondWithResult(_0x462b3a,null))['catch'](handleError(_0x462b3a,null));};var utilLicense=require(_0xed0d('0x6d'));exports[_0xed0d('0x77')]=function(_0x1a1e49,_0x5b0db3,_0x59f1c1){var _0x48f17c=_0xed0d('0x6e');var _0x278d6c={'custom':![]};return utilLicense[_0xed0d('0x5d')]()[_0xed0d('0x1e')](function(_0x4c254c){if(_0x4c254c){_0x278d6c=_0x4c254c;}return db[_0xed0d('0x3b')][_0xed0d('0x56')]({'where':{'id':_0x1a1e49[_0xed0d('0x55')]['id']},'attributes':[_0xed0d('0x5a'),_0xed0d('0x5e'),_0xed0d('0x5f'),'favicon',_0xed0d('0x61'),_0xed0d('0x62'),_0xed0d('0x63'),_0xed0d('0x64')],'raw':!![]});})[_0xed0d('0x1e')](handleEntityNotFound(_0x5b0db3,null))[_0xed0d('0x1e')](function(_0x5e22cc){if(_0x5e22cc){var _0x3dda53=_0x5e22cc[_0xed0d('0x60')]&&fs['existsSync'](path[_0xed0d('0x65')](config['root'],_0x48f17c,_['toLower'](_0x5e22cc['favicon'])))?path['join'](config[_0xed0d('0x66')],_0x48f17c,_[_0xed0d('0x67')](_0x5e22cc[_0xed0d('0x60')])):path[_0xed0d('0x65')](config[_0xed0d('0x66')],_0x48f17c,_['toLower'](_0xed0d('0x78')));var _0x1a247=_0xed0d('0x70')+_[_0xed0d('0x68')]('favicon');if(_0x5e22cc[_0x1a247]||!_0x278d6c['custom']){_0x3dda53=path['join'](config[_0xed0d('0x66')],_0x48f17c,_[_0xed0d('0x67')]('default_favicon.ico'));}if(!fs['existsSync'](_0x3dda53)){throw new db['Sequelize']['ValidationError'](_[_0xed0d('0x68')](_0xed0d('0x60'))+_0xed0d('0x6c'));}return _0x5b0db3[_0xed0d('0x79')](_0x3dda53);}})['catch'](handleError(_0x5b0db3,null));}; \ No newline at end of file +var _0xc358=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','getLogoLogin','favicon','default_loginLogo.svg','\x20not\x20found','download','gdpr','defaultLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','index','map','Setting','rawAttributes','fieldName','type','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit'];(function(_0x55714b,_0x1dfa2b){var _0x190a6e=function(_0x388175){while(--_0x388175){_0x55714b['push'](_0x55714b['shift']());}};_0x190a6e(++_0x1dfa2b);}(_0xc358,0x19e));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8c35('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8c35('0x1'));var zipdir=require(_0x8c35('0x2'));var jsonpatch=require(_0x8c35('0x3'));var rp=require(_0x8c35('0x4'));var moment=require('moment');var BPromise=require(_0x8c35('0x5'));var Mustache=require('mustache');var util=require(_0x8c35('0x6'));var path=require(_0x8c35('0x7'));var sox=require(_0x8c35('0x8'));var csv=require(_0x8c35('0x9'));var ejs=require(_0x8c35('0xa'));var fs=require('fs');var _=require(_0x8c35('0xb'));var squel=require(_0x8c35('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c35('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8c35('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8c35('0xf'));var qs=require(_0x8c35('0x10'));var as=require(_0x8c35('0x11'));var hardwareService=require(_0x8c35('0x12'));var logger=require(_0x8c35('0x13'))(_0x8c35('0x14'));var utils=require(_0x8c35('0x15'));var config=require(_0x8c35('0x16'));var db=require(_0x8c35('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8c35('0x18')][_0x8c35('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4d69c3,_0x2324fc,_0x1fd878){if(_0x1fd878){var _0x5db032=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5db032[_0x8c35('0x1a')](_0x2324fc)){return _0x4d69c3;}else{throw new db['Sequelize'][(_0x8c35('0x1b'))](_0x8c35('0x1c'));}}else{return _0x4d69c3;}}function respondWithRpcPromise(_0x48d73b,_0x4c6a16,_0x268ce1,_0x11d3a4){return new BPromise(function(_0x4df5de,_0x346e54){var _0x15906f=_0x11d3a4||client;return _0x15906f[_0x8c35('0x1d')](_0x48d73b,_0x268ce1)['then'](function(_0x4bfe08){logger[_0x8c35('0x1e')](_0x8c35('0x1f'),_0x4c6a16,_0x8c35('0x20'));logger[_0x8c35('0x21')](_0x8c35('0x22'),_0x4c6a16,_0x8c35('0x20'),JSON['stringify'](_0x4bfe08));if(_0x4bfe08[_0x8c35('0x23')]){if(_0x4bfe08[_0x8c35('0x23')][_0x8c35('0x24')]===0x1f4){logger[_0x8c35('0x23')](_0x8c35('0x1f'),_0x4c6a16,_0x4bfe08['error'][_0x8c35('0x25')]);return _0x346e54(_0x4bfe08[_0x8c35('0x23')][_0x8c35('0x25')]);}logger[_0x8c35('0x23')](_0x8c35('0x1f'),_0x4c6a16,_0x4bfe08[_0x8c35('0x23')]['message']);return _0x4df5de(_0x4bfe08['error']['message']);}else{logger[_0x8c35('0x1e')](_0x8c35('0x1f'),_0x4c6a16,_0x8c35('0x20'));_0x4df5de(_0x4bfe08[_0x8c35('0x26')][_0x8c35('0x25')]);}})[_0x8c35('0x27')](function(_0x4b5303){logger[_0x8c35('0x23')](_0x8c35('0x1f'),_0x4c6a16,_0x4b5303);_0x346e54(_0x4b5303);});});}function respondWithStatusCode(_0x3ea4da,_0x25426b){_0x25426b=_0x25426b||0xcc;return function(_0x5d9172){if(_0x5d9172){return _0x3ea4da['sendStatus'](_0x25426b);}return _0x3ea4da['status'](_0x25426b)[_0x8c35('0x28')]();};}function respondWithResult(_0x43f675,_0x291673){_0x291673=_0x291673||0xc8;return function(_0x28d968){if(_0x28d968){return _0x43f675[_0x8c35('0x29')](_0x291673)[_0x8c35('0x2a')](_0x28d968);}};}function respondWithFilteredResult(_0x5ad3f8,_0x31fe2b){return function(_0x595f82){if(_0x595f82){var _0x436efa=_0x595f82[_0x8c35('0x2b')],_0x594b54=_0x31fe2b[_0x8c35('0x2c')],_0x45cc96=_0x31fe2b[_0x8c35('0x2c')]+_0x31fe2b[_0x8c35('0x2d')],_0x3ec88e;if(_0x45cc96>=_0x436efa){_0x45cc96=_0x436efa;_0x3ec88e=0xc8;}else{_0x3ec88e=0xce;}_0x5ad3f8[_0x8c35('0x29')](_0x3ec88e);return _0x5ad3f8['set'](_0x8c35('0x2e'),_0x594b54+'-'+_0x45cc96+'/'+_0x436efa)[_0x8c35('0x2a')](_0x595f82);}return null;};}function patchUpdates(_0x1253aa){return function(_0x28400e){try{jsonpatch[_0x8c35('0x2f')](_0x28400e,_0x1253aa,!![]);}catch(_0x2899f5){return BPromise[_0x8c35('0x30')](_0x2899f5);}return _0x28400e[_0x8c35('0x31')]();};}function saveUpdates(_0x30161c,_0x4f404b){return function(_0x4015be){if(_0x4015be){return _0x4015be[_0x8c35('0x32')](_0x30161c)[_0x8c35('0x33')](function(_0x3aa863){return _0x3aa863;});}return null;};}function removeEntity(_0x54e018,_0x67219f){return function(_0x1a29c1){if(_0x1a29c1){return _0x1a29c1[_0x8c35('0x34')]()[_0x8c35('0x33')](function(){_0x54e018[_0x8c35('0x29')](0xcc)[_0x8c35('0x28')]();});}};}function handleEntityNotFound(_0x1fec32,_0x556cf8){return function(_0x1beb78){if(!_0x1beb78){_0x1fec32[_0x8c35('0x35')](0x194);}return _0x1beb78;};}function handleError(_0x28f797,_0x4b2358){_0x4b2358=_0x4b2358||0x1f4;return function(_0x5a8d47){logger[_0x8c35('0x23')](_0x5a8d47['stack']);if(_0x5a8d47['name']){delete _0x5a8d47[_0x8c35('0x36')];}_0x28f797['status'](_0x4b2358)['send'](_0x5a8d47);};}exports[_0x8c35('0x37')]=function(_0x5d44fe,_0x562165){var _0x2705c4={},_0x45f5e9={},_0x5b7c35={'count':0x0,'rows':[]};var _0x8abca4=_[_0x8c35('0x38')](db[_0x8c35('0x39')][_0x8c35('0x3a')],function(_0x386fe0){return{'name':_0x386fe0[_0x8c35('0x3b')],'type':_0x386fe0[_0x8c35('0x3c')]['key']};});_0x45f5e9['model']=_['map'](_0x8abca4,_0x8c35('0x36'));_0x45f5e9['query']=_[_0x8c35('0x3d')](_0x5d44fe[_0x8c35('0x3e')]);_0x45f5e9[_0x8c35('0x3f')]=_['intersection'](_0x45f5e9['model'],_0x45f5e9[_0x8c35('0x3e')]);_0x2705c4[_0x8c35('0x40')]=_[_0x8c35('0x41')](_0x45f5e9[_0x8c35('0x42')],qs['fields'](_0x5d44fe[_0x8c35('0x3e')][_0x8c35('0x43')]));_0x2705c4[_0x8c35('0x40')]=_0x2705c4[_0x8c35('0x40')]['length']?_0x2705c4[_0x8c35('0x40')]:_0x45f5e9[_0x8c35('0x42')];if(!_0x5d44fe[_0x8c35('0x3e')][_0x8c35('0x44')](_0x8c35('0x45'))){_0x2705c4[_0x8c35('0x2d')]=qs[_0x8c35('0x2d')](_0x5d44fe['query'][_0x8c35('0x2d')]);_0x2705c4[_0x8c35('0x2c')]=qs['offset'](_0x5d44fe[_0x8c35('0x3e')][_0x8c35('0x2c')]);}_0x2705c4[_0x8c35('0x46')]=qs[_0x8c35('0x47')](_0x5d44fe[_0x8c35('0x3e')][_0x8c35('0x47')]);_0x2705c4[_0x8c35('0x48')]=qs[_0x8c35('0x3f')](_[_0x8c35('0x49')](_0x5d44fe['query'],_0x45f5e9[_0x8c35('0x3f')]),_0x8abca4);if(_0x5d44fe[_0x8c35('0x3e')][_0x8c35('0x4a')]){_0x2705c4['where']=_[_0x8c35('0x4b')](_0x2705c4[_0x8c35('0x48')],{'$or':_[_0x8c35('0x38')](_0x8abca4,function(_0x1ce7ba){if(_0x1ce7ba[_0x8c35('0x3c')]!==_0x8c35('0x4c')){var _0x668837={};_0x668837[_0x1ce7ba[_0x8c35('0x36')]]={'$like':'%'+_0x5d44fe[_0x8c35('0x3e')][_0x8c35('0x4a')]+'%'};return _0x668837;}})});}_0x2705c4=_[_0x8c35('0x4b')]({},_0x2705c4,_0x5d44fe[_0x8c35('0x4d')]);var _0x3fc76b={'where':_0x2705c4[_0x8c35('0x48')]};return db[_0x8c35('0x39')][_0x8c35('0x2b')](_0x3fc76b)[_0x8c35('0x33')](function(_0x26f2ef){_0x5b7c35[_0x8c35('0x2b')]=_0x26f2ef;if(_0x5d44fe['query'][_0x8c35('0x4e')]){_0x2705c4[_0x8c35('0x4f')]=[{'all':!![]}];}return db[_0x8c35('0x39')][_0x8c35('0x50')](_0x2705c4);})['then'](function(_0x4cf2da){_0x5b7c35[_0x8c35('0x51')]=_0x4cf2da;return _0x5b7c35;})[_0x8c35('0x33')](respondWithFilteredResult(_0x562165,_0x2705c4))[_0x8c35('0x27')](handleError(_0x562165,null));};exports[_0x8c35('0x52')]=function(_0x197d68,_0x2a9c1c){var _0x3e76c7={'raw':![],'where':{'id':_0x197d68[_0x8c35('0x53')]['id']}},_0x35bb38={};_0x35bb38['model']=_['keys'](db[_0x8c35('0x39')][_0x8c35('0x3a')]);_0x35bb38['query']=_['keys'](_0x197d68[_0x8c35('0x3e')]);_0x35bb38[_0x8c35('0x3f')]=_['intersection'](_0x35bb38[_0x8c35('0x42')],_0x35bb38['query']);_0x3e76c7[_0x8c35('0x40')]=_[_0x8c35('0x41')](_0x35bb38[_0x8c35('0x42')],qs[_0x8c35('0x43')](_0x197d68[_0x8c35('0x3e')]['fields']));_0x3e76c7['attributes']=_0x3e76c7[_0x8c35('0x40')][_0x8c35('0x54')]?_0x3e76c7['attributes']:_0x35bb38[_0x8c35('0x42')];if(_0x197d68[_0x8c35('0x3e')][_0x8c35('0x4e')]){_0x3e76c7['include']=[{'all':!![]}];}_0x3e76c7=_[_0x8c35('0x4b')]({},_0x3e76c7,_0x197d68['options']);return db[_0x8c35('0x39')]['find'](_0x3e76c7)['then'](handleEntityNotFound(_0x2a9c1c,null))[_0x8c35('0x33')](respondWithResult(_0x2a9c1c,null))['catch'](handleError(_0x2a9c1c,null));};exports[_0x8c35('0x32')]=function(_0x319799,_0x2a701b){if(_0x319799[_0x8c35('0x55')]['id']){delete _0x319799['body']['id'];}return db[_0x8c35('0x39')][_0x8c35('0x56')]({'where':{'id':_0x319799[_0x8c35('0x53')]['id']}})[_0x8c35('0x33')](handleEntityNotFound(_0x2a701b,null))['then'](saveUpdates(_0x319799[_0x8c35('0x55')],null))[_0x8c35('0x33')](respondWithResult(_0x2a701b,null))[_0x8c35('0x27')](handleError(_0x2a701b,null));};exports[_0x8c35('0x57')]=function(_0x281e21,_0x2409ce,_0x469c85){if(_0x281e21[_0x8c35('0x58')]&&_0x281e21[_0x8c35('0x58')][_0x8c35('0x59')]){_0x281e21[_0x8c35('0x55')][_0x8c35('0x5a')]=_0x281e21[_0x8c35('0x58')]['filename'];}return db[_0x8c35('0x39')]['find']({'where':{'id':_0x281e21[_0x8c35('0x53')]['id']}})[_0x8c35('0x33')](handleEntityNotFound(_0x2409ce,null))[_0x8c35('0x33')](saveUpdates(_0x281e21[_0x8c35('0x55')],null))[_0x8c35('0x33')](respondWithResult(_0x2409ce,null))['catch'](handleError(_0x2409ce,null));};exports[_0x8c35('0x5b')]=function(_0x3ea8ec,_0x1ca3ee,_0x3cefb1){if(_0x3ea8ec[_0x8c35('0x58')]&&_0x3ea8ec[_0x8c35('0x58')]['filename']){_0x3ea8ec[_0x8c35('0x55')][_0x8c35('0x5c')]=_0x3ea8ec['file'][_0x8c35('0x59')];}return db[_0x8c35('0x39')][_0x8c35('0x56')]({'where':{'id':_0x3ea8ec['params']['id']}})[_0x8c35('0x33')](handleEntityNotFound(_0x1ca3ee,null))[_0x8c35('0x33')](saveUpdates(_0x3ea8ec[_0x8c35('0x55')],null))['then'](respondWithResult(_0x1ca3ee,null))[_0x8c35('0x27')](handleError(_0x1ca3ee,null));};var utilLicense=require(_0x8c35('0x5d'));exports[_0x8c35('0x5e')]=function(_0x148f0e,_0x5c160f,_0x5d9268){var _0xa89e48=_0x8c35('0x5f');var _0x44e1e7={'custom':![]};return utilLicense[_0x8c35('0x60')]()['then'](function(_0x268563){if(_0x268563){_0x44e1e7=_0x268563;}return db[_0x8c35('0x39')][_0x8c35('0x56')]({'where':{'id':_0x148f0e[_0x8c35('0x53')]['id']},'attributes':[_0x8c35('0x5a'),'loginLogo',_0x8c35('0x61'),'favicon','defaultLogo',_0x8c35('0x62'),_0x8c35('0x63'),_0x8c35('0x64')],'raw':!![]});})[_0x8c35('0x33')](handleEntityNotFound(_0x5c160f,null))['then'](function(_0x251a09){if(_0x251a09){var _0xddd59d=_0x251a09[_0x8c35('0x5a')]&&fs[_0x8c35('0x65')](path[_0x8c35('0x66')](config[_0x8c35('0x67')],_0xa89e48,_['toLower'](_0x251a09[_0x8c35('0x5a')])))?path[_0x8c35('0x66')](config[_0x8c35('0x67')],_0xa89e48,_[_0x8c35('0x68')](_0x251a09[_0x8c35('0x5a')])):path['join'](config[_0x8c35('0x67')],_0xa89e48,_[_0x8c35('0x68')](_0x8c35('0x69')));var _0x1ea2ad=_0x8c35('0x6a')+_[_0x8c35('0x6b')](_0x8c35('0x5a'));if(_0x251a09[_0x1ea2ad]||!_0x44e1e7[_0x8c35('0x6c')]){_0xddd59d=path[_0x8c35('0x66')](config[_0x8c35('0x67')],_0xa89e48,_[_0x8c35('0x68')]('default_logo.svg'));}if(!fs[_0x8c35('0x65')](_0xddd59d)){throw new db[(_0x8c35('0x6d'))][(_0x8c35('0x1b'))](_[_0x8c35('0x6b')](_0x8c35('0x5a'))+'\x20not\x20found');}return _0x5c160f['download'](_0xddd59d);}})['catch'](handleError(_0x5c160f,null));};var utilLicense=require('../../config/license/util');exports[_0x8c35('0x6e')]=function(_0x56325a,_0x1d8e77,_0x2e33e7){var _0x48d1c7=_0x8c35('0x5f');var _0x2565af={'custom':![]};return utilLicense[_0x8c35('0x60')]()['then'](function(_0xf8312f){if(_0xf8312f){_0x2565af=_0xf8312f;}return db['Setting']['find']({'where':{'id':_0x56325a[_0x8c35('0x53')]['id']},'attributes':[_0x8c35('0x5a'),_0x8c35('0x5c'),'preferred',_0x8c35('0x6f'),'defaultLogo','defaultLoginLogo',_0x8c35('0x63'),_0x8c35('0x64')],'raw':!![]});})[_0x8c35('0x33')](handleEntityNotFound(_0x1d8e77,null))[_0x8c35('0x33')](function(_0x117592){if(_0x117592){var _0x16d186=_0x117592[_0x8c35('0x5c')]&&fs[_0x8c35('0x65')](path[_0x8c35('0x66')](config['root'],_0x48d1c7,_[_0x8c35('0x68')](_0x117592['loginLogo'])))?path['join'](config[_0x8c35('0x67')],_0x48d1c7,_[_0x8c35('0x68')](_0x117592[_0x8c35('0x5c')])):path[_0x8c35('0x66')](config['root'],_0x48d1c7,_[_0x8c35('0x68')](_0x8c35('0x70')));var _0x15f666=_0x8c35('0x6a')+_['upperFirst'](_0x8c35('0x5c'));if(_0x117592[_0x15f666]||!_0x2565af[_0x8c35('0x6c')]){_0x16d186=path[_0x8c35('0x66')](config[_0x8c35('0x67')],_0x48d1c7,_[_0x8c35('0x68')](_0x8c35('0x70')));}if(!fs[_0x8c35('0x65')](_0x16d186)){throw new db['Sequelize'][(_0x8c35('0x1b'))](_[_0x8c35('0x6b')](_0x8c35('0x5c'))+_0x8c35('0x71'));}return _0x1d8e77[_0x8c35('0x72')](_0x16d186);}})[_0x8c35('0x27')](handleError(_0x1d8e77,null));};exports[_0x8c35('0x73')]=function(_0x1392d3,_0x751e3a){return db[_0x8c35('0x39')][_0x8c35('0x56')]({'where':{'id':_0x1392d3[_0x8c35('0x53')]['id']},'attributes':['securePassword']})[_0x8c35('0x33')](respondWithResult(_0x751e3a,null))[_0x8c35('0x27')](handleError(_0x751e3a,null));};exports['addPreferred']=function(_0x231aff,_0x5462cc,_0x324b42){if(_0x231aff['file']&&_0x231aff[_0x8c35('0x58')]['filename']){_0x231aff['body'][_0x8c35('0x61')]=_0x231aff[_0x8c35('0x58')]['filename'];}return db[_0x8c35('0x39')][_0x8c35('0x56')]({'where':{'id':_0x231aff[_0x8c35('0x53')]['id']}})[_0x8c35('0x33')](handleEntityNotFound(_0x5462cc,null))['then'](saveUpdates(_0x231aff[_0x8c35('0x55')],null))[_0x8c35('0x33')](respondWithResult(_0x5462cc,null))[_0x8c35('0x27')](handleError(_0x5462cc,null));};var utilLicense=require(_0x8c35('0x5d'));exports['getPreferred']=function(_0x2e9179,_0x486acd,_0x49e7ee){var _0x5802c2=_0x8c35('0x5f');var _0x38a70b={'custom':![]};return utilLicense[_0x8c35('0x60')]()[_0x8c35('0x33')](function(_0x3c7cd2){if(_0x3c7cd2){_0x38a70b=_0x3c7cd2;}return db[_0x8c35('0x39')][_0x8c35('0x56')]({'where':{'id':_0x2e9179[_0x8c35('0x53')]['id']},'attributes':['logo',_0x8c35('0x5c'),_0x8c35('0x61'),'favicon',_0x8c35('0x74'),_0x8c35('0x62'),_0x8c35('0x63'),_0x8c35('0x64')],'raw':!![]});})[_0x8c35('0x33')](handleEntityNotFound(_0x486acd,null))['then'](function(_0x76267b){if(_0x76267b){var _0x3025a5=_0x76267b[_0x8c35('0x61')]&&fs[_0x8c35('0x65')](path[_0x8c35('0x66')](config[_0x8c35('0x67')],_0x5802c2,_[_0x8c35('0x68')](_0x76267b[_0x8c35('0x61')])))?path['join'](config[_0x8c35('0x67')],_0x5802c2,_[_0x8c35('0x68')](_0x76267b[_0x8c35('0x61')])):path[_0x8c35('0x66')](config[_0x8c35('0x67')],_0x5802c2,_['toLower'](_0x8c35('0x75')));var _0x2135d7=_0x8c35('0x6a')+_[_0x8c35('0x6b')]('preferred');if(_0x76267b[_0x2135d7]||!_0x38a70b[_0x8c35('0x6c')]||!_0x38a70b[_0x8c35('0x61')]){_0x3025a5=path[_0x8c35('0x66')](config['root'],_0x5802c2,_[_0x8c35('0x68')](_0x8c35('0x75')));}if(!fs[_0x8c35('0x65')](_0x3025a5)){throw new db[(_0x8c35('0x6d'))][(_0x8c35('0x1b'))](_[_0x8c35('0x6b')](_0x8c35('0x61'))+'\x20not\x20found');}return _0x486acd['download'](_0x3025a5);}})['catch'](handleError(_0x486acd,null));};exports[_0x8c35('0x76')]=function(_0x1bb149,_0x3a99bd,_0x51861f){if(_0x1bb149[_0x8c35('0x58')]&&_0x1bb149[_0x8c35('0x58')][_0x8c35('0x59')]){_0x1bb149[_0x8c35('0x55')][_0x8c35('0x6f')]=_0x1bb149[_0x8c35('0x58')][_0x8c35('0x59')];}return db['Setting'][_0x8c35('0x56')]({'where':{'id':_0x1bb149['params']['id']}})['then'](handleEntityNotFound(_0x3a99bd,null))['then'](saveUpdates(_0x1bb149[_0x8c35('0x55')],null))['then'](respondWithResult(_0x3a99bd,null))[_0x8c35('0x27')](handleError(_0x3a99bd,null));};var utilLicense=require('../../config/license/util');exports[_0x8c35('0x77')]=function(_0x32dfe6,_0x22a30d,_0xf48451){var _0x49c991=_0x8c35('0x5f');var _0xf7772a={'custom':![]};return utilLicense['getLicense']()[_0x8c35('0x33')](function(_0x399a1c){if(_0x399a1c){_0xf7772a=_0x399a1c;}return db[_0x8c35('0x39')]['find']({'where':{'id':_0x32dfe6['params']['id']},'attributes':[_0x8c35('0x5a'),_0x8c35('0x5c'),_0x8c35('0x61'),_0x8c35('0x6f'),_0x8c35('0x74'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x8c35('0x33')](handleEntityNotFound(_0x22a30d,null))['then'](function(_0x43edbe){if(_0x43edbe){var _0x3e83ce=_0x43edbe[_0x8c35('0x6f')]&&fs[_0x8c35('0x65')](path['join'](config[_0x8c35('0x67')],_0x49c991,_[_0x8c35('0x68')](_0x43edbe['favicon'])))?path[_0x8c35('0x66')](config[_0x8c35('0x67')],_0x49c991,_[_0x8c35('0x68')](_0x43edbe[_0x8c35('0x6f')])):path[_0x8c35('0x66')](config[_0x8c35('0x67')],_0x49c991,_[_0x8c35('0x68')]('default_favicon.ico'));var _0x1f0dca=_0x8c35('0x6a')+_['upperFirst'](_0x8c35('0x6f'));if(_0x43edbe[_0x1f0dca]||!_0xf7772a[_0x8c35('0x6c')]){_0x3e83ce=path[_0x8c35('0x66')](config[_0x8c35('0x67')],_0x49c991,_['toLower'](_0x8c35('0x78')));}if(!fs[_0x8c35('0x65')](_0x3e83ce)){throw new db[(_0x8c35('0x6d'))][(_0x8c35('0x1b'))](_[_0x8c35('0x6b')]('favicon')+_0x8c35('0x71'));}return _0x22a30d[_0x8c35('0x72')](_0x3e83ce);}})['catch'](handleError(_0x22a30d,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 18141be..01a516b 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 _0x1f46=['request-promise','path','rimraf','../../config/environment','./setting.attributes','define','Setting','settings','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e507d,_0x3abb4b){var _0x6ccda7=function(_0x378b89){while(--_0x378b89){_0x3e507d['push'](_0x3e507d['shift']());}};_0x6ccda7(++_0x3abb4b);}(_0x1f46,0x78));var _0x61f4=function(_0x412a4a,_0x461b25){_0x412a4a=_0x412a4a-0x0;var _0x55fad5=_0x1f46[_0x412a4a];return _0x55fad5;};'use strict';var _=require(_0x61f4('0x0'));var util=require(_0x61f4('0x1'));var logger=require(_0x61f4('0x2'))(_0x61f4('0x3'));var moment=require(_0x61f4('0x4'));var BPromise=require(_0x61f4('0x5'));var rp=require(_0x61f4('0x6'));var fs=require('fs');var path=require(_0x61f4('0x7'));var rimraf=require(_0x61f4('0x8'));var config=require(_0x61f4('0x9'));var attributes=require(_0x61f4('0xa'));module['exports']=function(_0x5858bb,_0x49ee34){return _0x5858bb[_0x61f4('0xb')](_0x61f4('0xc'),attributes,{'tableName':_0x61f4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5733=['define','settings','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./setting.attributes','exports'];(function(_0x388167,_0x1431ba){var _0x1ea71e=function(_0x216522){while(--_0x216522){_0x388167['push'](_0x388167['shift']());}};_0x1ea71e(++_0x1431ba);}(_0x5733,0xf4));var _0x3573=function(_0x581461,_0x502e14){_0x581461=_0x581461-0x0;var _0x2fc18b=_0x5733[_0x581461];return _0x2fc18b;};'use strict';var _=require(_0x3573('0x0'));var util=require(_0x3573('0x1'));var logger=require(_0x3573('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3573('0x3'));var rp=require(_0x3573('0x4'));var fs=require('fs');var path=require(_0x3573('0x5'));var rimraf=require('rimraf');var config=require(_0x3573('0x6'));var attributes=require(_0x3573('0x7'));module[_0x3573('0x8')]=function(_0x48227e,_0x205225){return _0x48227e[_0x3573('0x9')]('Setting',attributes,{'tableName':_0x3573('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 808efff..7f5e8c2 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 _0xf717=['../../config/environment','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x444424,_0x1bdcfb){var _0x1c891c=function(_0x1ada40){while(--_0x1ada40){_0x444424['push'](_0x444424['shift']());}};_0x1c891c(++_0x1bdcfb);}(_0xf717,0xf5));var _0x7f71=function(_0x3aad54,_0x2dfd85){_0x3aad54=_0x3aad54-0x0;var _0xa378a2=_0xf717[_0x3aad54];return _0xa378a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f71('0x0'));var BPromise=require(_0x7f71('0x1'));var rs=require(_0x7f71('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f71('0x3'))['db'];var utils=require(_0x7f71('0x4'));var logger=require(_0x7f71('0x5'))(_0x7f71('0x6'));var config=require(_0x7f71('0x7'));var jayson=require(_0x7f71('0x8'));var client=jayson['client'][_0x7f71('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ec360,_0x42a95c,_0x1c1c07){return new BPromise(function(_0x3959b1,_0x295a39){return client[_0x7f71('0xa')](_0x3ec360,_0x1c1c07)[_0x7f71('0xb')](function(_0x20fb99){logger['info'](_0x7f71('0xc'),_0x42a95c,'request\x20sent');logger[_0x7f71('0xd')](_0x7f71('0xe'),_0x42a95c,_0x7f71('0xf'),JSON['stringify'](_0x20fb99));if(_0x20fb99[_0x7f71('0x10')]){if(_0x20fb99[_0x7f71('0x10')]['code']===0x1f4){logger[_0x7f71('0x10')](_0x7f71('0xc'),_0x42a95c,_0x20fb99['error'][_0x7f71('0x11')]);return _0x295a39(_0x20fb99['error'][_0x7f71('0x11')]);}logger[_0x7f71('0x10')]('Setting,\x20%s,\x20%s',_0x42a95c,_0x20fb99[_0x7f71('0x10')][_0x7f71('0x11')]);return _0x3959b1(_0x20fb99['error'][_0x7f71('0x11')]);}else{logger[_0x7f71('0x12')](_0x7f71('0xc'),_0x42a95c,'request\x20sent');_0x3959b1(_0x20fb99[_0x7f71('0x13')][_0x7f71('0x11')]);}})[_0x7f71('0x14')](function(_0x3b3099){logger[_0x7f71('0x10')](_0x7f71('0xc'),_0x42a95c,_0x3b3099);_0x295a39(_0x3b3099);});});} \ No newline at end of file +var _0x2b35=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0xfc5fd4,_0x43c5dc){var _0x34fa22=function(_0x1f5770){while(--_0x1f5770){_0xfc5fd4['push'](_0xfc5fd4['shift']());}};_0x34fa22(++_0x43c5dc);}(_0x2b35,0x1a1));var _0x52b3=function(_0x29287c,_0x1bbf21){_0x29287c=_0x29287c-0x0;var _0x27eaca=_0x2b35[_0x29287c];return _0x27eaca;};'use strict';var _=require(_0x52b3('0x0'));var util=require(_0x52b3('0x1'));var moment=require('moment');var BPromise=require(_0x52b3('0x2'));var rs=require(_0x52b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52b3('0x4'))['db'];var utils=require(_0x52b3('0x5'));var logger=require(_0x52b3('0x6'))(_0x52b3('0x7'));var config=require('../../config/environment');var jayson=require(_0x52b3('0x8'));var client=jayson[_0x52b3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x884b4c,_0x17c60f,_0x2a6520){return new BPromise(function(_0x345024,_0x19a6dd){return client[_0x52b3('0xa')](_0x884b4c,_0x2a6520)[_0x52b3('0xb')](function(_0x4492c2){logger['info'](_0x52b3('0xc'),_0x17c60f,_0x52b3('0xd'));logger['debug'](_0x52b3('0xe'),_0x17c60f,_0x52b3('0xd'),JSON[_0x52b3('0xf')](_0x4492c2));if(_0x4492c2[_0x52b3('0x10')]){if(_0x4492c2['error'][_0x52b3('0x11')]===0x1f4){logger[_0x52b3('0x10')](_0x52b3('0xc'),_0x17c60f,_0x4492c2[_0x52b3('0x10')]['message']);return _0x19a6dd(_0x4492c2[_0x52b3('0x10')][_0x52b3('0x12')]);}logger[_0x52b3('0x10')](_0x52b3('0xc'),_0x17c60f,_0x4492c2['error'][_0x52b3('0x12')]);return _0x345024(_0x4492c2['error'][_0x52b3('0x12')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x17c60f,_0x52b3('0xd'));_0x345024(_0x4492c2['result'][_0x52b3('0x12')]);}})[_0x52b3('0x13')](function(_0x3a1143){logger[_0x52b3('0x10')](_0x52b3('0xc'),_0x17c60f,_0x3a1143);_0x19a6dd(_0x3a1143);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 579f9c6..052803d 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 _0x6348=['/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','statusGet','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','notify','addApplications','send','/:id/status','status','addAgents','put'];(function(_0x34751a,_0xbc2322){var _0x394a95=function(_0x3bdcc6){while(--_0x3bdcc6){_0x34751a['push'](_0x34751a['shift']());}};_0x394a95(++_0xbc2322);}(_0x6348,0xa3));var _0x8634=function(_0x116f1c,_0x5be34b){_0x116f1c=_0x116f1c-0x0;var _0x5be838=_0x6348[_0x116f1c];return _0x5be838;};'use strict';var multer=require(_0x8634('0x0'));var util=require(_0x8634('0x1'));var path=require(_0x8634('0x2'));var timeout=require(_0x8634('0x3'));var express=require(_0x8634('0x4'));var router=express[_0x8634('0x5')]();var auth=require(_0x8634('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8634('0x7'));router[_0x8634('0x8')]('/',auth[_0x8634('0x9')](),controller[_0x8634('0xa')]);router['get'](_0x8634('0xb'),auth[_0x8634('0x9')](),controller[_0x8634('0xc')]);router[_0x8634('0x8')]('/:id',auth[_0x8634('0x9')](),controller[_0x8634('0xd')]);router[_0x8634('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8634('0xe')]);router['get'](_0x8634('0xf'),auth[_0x8634('0x9')](),controller['getAnswers']);router[_0x8634('0x8')]('/:id/applications',auth[_0x8634('0x9')](),controller['getApplications']);router[_0x8634('0x8')](_0x8634('0x10'),auth['isAuthenticated'](),controller[_0x8634('0x11')]);router['get']('/:id/status',controller[_0x8634('0x12')]);router['get'](_0x8634('0x13'),auth[_0x8634('0x9')](),controller[_0x8634('0x14')]);router['post']('/',auth[_0x8634('0x9')](),controller['create']);router[_0x8634('0x15')](_0x8634('0x16'),auth[_0x8634('0x9')](),controller[_0x8634('0x17')]);router[_0x8634('0x15')](_0x8634('0xf'),auth['isAuthenticated'](),controller[_0x8634('0x18')]);router[_0x8634('0x15')]('/:id/notify',controller[_0x8634('0x19')]);router[_0x8634('0x15')]('/:id/applications',auth[_0x8634('0x9')](),controller[_0x8634('0x1a')]);router['post']('/:id/send',auth[_0x8634('0x9')](),controller[_0x8634('0x1b')]);router[_0x8634('0x15')](_0x8634('0x1c'),controller[_0x8634('0x1d')]);router[_0x8634('0x15')](_0x8634('0x13'),auth['isAuthenticated'](),controller[_0x8634('0x1e')]);router[_0x8634('0x1f')](_0x8634('0x20'),auth[_0x8634('0x9')](),controller['update']);router[_0x8634('0x21')](_0x8634('0x20'),auth['isAuthenticated'](),controller[_0x8634('0x22')]);router['delete'](_0x8634('0x16'),auth[_0x8634('0x9')](),controller[_0x8634('0x23')]);router[_0x8634('0x21')](_0x8634('0xf'),auth['isAuthenticated'](),controller[_0x8634('0x24')]);router[_0x8634('0x21')](_0x8634('0x13'),auth[_0x8634('0x9')](),controller[_0x8634('0x25')]);module[_0x8634('0x26')]=router; \ No newline at end of file +var _0x7b3a=['path','express','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7b3a,0x93));var _0xa7b3=function(_0x4cf664,_0x5ca30a){_0x4cf664=_0x4cf664-0x0;var _0x1cc8f6=_0x7b3a[_0x4cf664];return _0x1cc8f6;};'use strict';var multer=require(_0xa7b3('0x0'));var util=require('util');var path=require(_0xa7b3('0x1'));var timeout=require('connect-timeout');var express=require(_0xa7b3('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa7b3('0x3'));var controller=require(_0xa7b3('0x4'));router[_0xa7b3('0x5')]('/',auth[_0xa7b3('0x6')](),controller['index']);router[_0xa7b3('0x5')](_0xa7b3('0x7'),auth[_0xa7b3('0x6')](),controller[_0xa7b3('0x8')]);router['get'](_0xa7b3('0x9'),auth[_0xa7b3('0x6')](),controller[_0xa7b3('0xa')]);router[_0xa7b3('0x5')]('/:id/dispositions',auth[_0xa7b3('0x6')](),controller['getDispositions']);router['get'](_0xa7b3('0xb'),auth[_0xa7b3('0x6')](),controller[_0xa7b3('0xc')]);router[_0xa7b3('0x5')]('/:id/applications',auth[_0xa7b3('0x6')](),controller[_0xa7b3('0xd')]);router[_0xa7b3('0x5')](_0xa7b3('0xe'),auth[_0xa7b3('0x6')](),controller[_0xa7b3('0xf')]);router['get'](_0xa7b3('0x10'),controller[_0xa7b3('0x11')]);router[_0xa7b3('0x5')](_0xa7b3('0x12'),auth[_0xa7b3('0x6')](),controller['getAgents']);router['post']('/',auth[_0xa7b3('0x6')](),controller['create']);router[_0xa7b3('0x13')](_0xa7b3('0x14'),auth['isAuthenticated'](),controller[_0xa7b3('0x15')]);router[_0xa7b3('0x13')](_0xa7b3('0xb'),auth[_0xa7b3('0x6')](),controller[_0xa7b3('0x16')]);router[_0xa7b3('0x13')](_0xa7b3('0x17'),controller[_0xa7b3('0x18')]);router['post'](_0xa7b3('0x19'),auth[_0xa7b3('0x6')](),controller['addApplications']);router[_0xa7b3('0x13')]('/:id/send',auth['isAuthenticated'](),controller[_0xa7b3('0x1a')]);router['post']('/:id/status',controller[_0xa7b3('0x1b')]);router[_0xa7b3('0x13')](_0xa7b3('0x12'),auth[_0xa7b3('0x6')](),controller[_0xa7b3('0x1c')]);router[_0xa7b3('0x1d')](_0xa7b3('0x9'),auth[_0xa7b3('0x6')](),controller[_0xa7b3('0x1e')]);router[_0xa7b3('0x1f')](_0xa7b3('0x9'),auth[_0xa7b3('0x6')](),controller[_0xa7b3('0x20')]);router['delete'](_0xa7b3('0x14'),auth['isAuthenticated'](),controller[_0xa7b3('0x21')]);router[_0xa7b3('0x1f')](_0xa7b3('0xb'),auth[_0xa7b3('0x6')](),controller[_0xa7b3('0x22')]);router[_0xa7b3('0x1f')](_0xa7b3('0x12'),auth[_0xa7b3('0x6')](),controller[_0xa7b3('0x23')]);module[_0xa7b3('0x24')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index bd53593..85de4e9 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 _0x7250=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','ENUM','connectel','clicksend','plivo','clickatell','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x453285,_0x1426f6){var _0x4e05e0=function(_0x4fb0e5){while(--_0x4fb0e5){_0x453285['push'](_0x453285['shift']());}};_0x4e05e0(++_0x1426f6);}(_0x7250,0x147));var _0x0725=function(_0x2c3e46,_0x3eeacd){_0x2c3e46=_0x2c3e46-0x0;var _0x571def=_0x7250[_0x2c3e46];return _0x571def;};'use strict';var Sequelize=require(_0x0725('0x0'));var rs=require(_0x0725('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0725('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x0725('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0725('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x0725('0x3')],'defaultValue':function(){return rs[_0x0725('0x4')]();}},'phone':{'type':Sequelize[_0x0725('0x3')]},'type':{'type':Sequelize[_0x0725('0x5')]('twilio','skebby',_0x0725('0x6'),_0x0725('0x7'),_0x0725('0x8'),_0x0725('0x9'),'csc',_0x0725('0xa'),_0x0725('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x0725('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x0725('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0725('0x3')]},'apiKey':{'type':Sequelize[_0x0725('0x3')]},'senderString':{'type':Sequelize[_0x0725('0x3')]},'deliveryReport':{'type':Sequelize[_0x0725('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x0725('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0725('0xd');}},'notificationSound':{'type':Sequelize[_0x0725('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0725('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0725('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0725('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0725('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0725('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0725('0xe')],'comment':_0x0725('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0725('0x10'),'set':function(_0x548b48){if(!_0x548b48)this['setDataValue'](_0x0725('0x11'),null);this['setDataValue'](_0x0725('0x12'),_0x548b48);}}}; \ No newline at end of file +var _0x6d2a=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','name','generate','ENUM','skebby','clicksend','plivo','clickatell','csc','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x401fd6,_0xb28d69){var _0x451f8f=function(_0x315816){while(--_0x315816){_0x401fd6['push'](_0x401fd6['shift']());}};_0x451f8f(++_0xb28d69);}(_0x6d2a,0x191));var _0xa6d2=function(_0xe65ac8,_0x2691be){_0xe65ac8=_0xe65ac8-0x0;var _0x202ba1=_0x6d2a[_0xe65ac8];return _0x202ba1;};'use strict';var Sequelize=require(_0xa6d2('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xa6d2('0x1')],'unique':_0xa6d2('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xa6d2('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa6d2('0x1')],'defaultValue':function(){return rs[_0xa6d2('0x3')]();}},'phone':{'type':Sequelize[_0xa6d2('0x1')]},'type':{'type':Sequelize[_0xa6d2('0x4')]('twilio',_0xa6d2('0x5'),'connectel',_0xa6d2('0x6'),_0xa6d2('0x7'),_0xa6d2('0x8'),_0xa6d2('0x9'),'infobip',_0xa6d2('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xa6d2('0x1')]},'authToken':{'type':Sequelize[_0xa6d2('0x1')]},'smsMethod':{'type':Sequelize[_0xa6d2('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa6d2('0x1')]},'password':{'type':Sequelize[_0xa6d2('0x1')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xa6d2('0x1')]},'deliveryReport':{'type':Sequelize[_0xa6d2('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xa6d2('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa6d2('0xc');}},'notificationSound':{'type':Sequelize[_0xa6d2('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa6d2('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa6d2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa6d2('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa6d2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa6d2('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa6d2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa6d2('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa6d2('0xd')],'comment':_0xa6d2('0xe')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa6d2('0xf'),'set':function(_0x3c7e87){if(!_0x3c7e87)this[_0xa6d2('0x10')](_0xa6d2('0x11'),null);this[_0xa6d2('0x10')]('mandatoryDisposition',_0x3c7e87);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 1304fa5..227d0f9 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 _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(_0x5092f2,_0x3fe719){var _0x308ce8=function(_0x3b0c7c){while(--_0x3b0c7c){_0x5092f2['push'](_0x5092f2['shift']());}};_0x308ce8(++_0x3fe719);}(_0x7a54,0x106));var _0x47a5=function(_0x537571,_0xca8273){_0x537571=_0x537571-0x0;var _0x59913=_0x7a54[_0x537571];return _0x59913;};'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 +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(_0x2bd1af,_0x22e1aa){var _0x1de6d1=function(_0x2e67dd){while(--_0x2e67dd){_0x2bd1af['push'](_0x2bd1af['shift']());}};_0x1de6d1(++_0x22e1aa);}(_0x7a54,0x106));var _0x47a5=function(_0x1d991b,_0x9caa62){_0x1d991b=_0x1d991b-0x0;var _0x11de6c=_0x7a54[_0x1d991b];return _0x11de6c;};'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 64c5aac..2b9617a 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 _0xa82a=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x3c45ba,_0x4f2166){var _0x3dfe00=function(_0x55ac99){while(--_0x55ac99){_0x3c45ba['push'](_0x3c45ba['shift']());}};_0x3dfe00(++_0x4f2166);}(_0xa82a,0xc9));var _0xaa82=function(_0x22dbb5,_0x26ed79){_0x22dbb5=_0x22dbb5-0x0;var _0x14a77e=_0xa82a[_0x22dbb5];return _0x14a77e;};'use strict';var EventEmitter=require(_0xaa82('0x0'));var SmsAccount=require(_0xaa82('0x1'))['db'][_0xaa82('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xaa82('0x3')](0x0);var events={'afterCreate':_0xaa82('0x4'),'afterUpdate':_0xaa82('0x5'),'afterDestroy':_0xaa82('0x6')};function emitEvent(_0x5082aa){return function(_0x74ae89,_0x59fe69,_0x2e082f){SmsAccountEvents[_0xaa82('0x7')](_0x5082aa+':'+_0x74ae89['id'],_0x74ae89);SmsAccountEvents['emit'](_0x5082aa,_0x74ae89);_0x2e082f(null);};}for(var e in events){if(events[_0xaa82('0x8')](e)){var event=events[e];SmsAccount[_0xaa82('0x9')](e,emitEvent(event));}}module[_0xaa82('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x3417=['events','../../mysqldb','SmsAccount','update','remove','emit','hasOwnProperty','exports'];(function(_0xd465de,_0x1d7a90){var _0x31388a=function(_0x793747){while(--_0x793747){_0xd465de['push'](_0xd465de['shift']());}};_0x31388a(++_0x1d7a90);}(_0x3417,0xf8));var _0x7341=function(_0x21c5f4,_0x1be642){_0x21c5f4=_0x21c5f4-0x0;var _0x54587f=_0x3417[_0x21c5f4];return _0x54587f;};'use strict';var EventEmitter=require(_0x7341('0x0'));var SmsAccount=require(_0x7341('0x1'))['db'][_0x7341('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7341('0x3'),'afterDestroy':_0x7341('0x4')};function emitEvent(_0x380dd6){return function(_0x4921da,_0x5689ae,_0x32b22c){SmsAccountEvents['emit'](_0x380dd6+':'+_0x4921da['id'],_0x4921da);SmsAccountEvents[_0x7341('0x5')](_0x380dd6,_0x4921da);_0x32b22c(null);};}for(var e in events){if(events[_0x7341('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x7341('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index a0fd597..bf15453 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(_0x410703,_0x4ae955){var _0x5007d7=function(_0x1a3195){while(--_0x1a3195){_0x410703['push'](_0x410703['shift']());}};_0x5007d7(++_0x4ae955);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x5ce8b9,_0x46d4f9){var _0x28c64f=function(_0x45f0ab){while(--_0x45f0ab){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0x28c64f(++_0x46d4f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 04b9d2b..deaca7d 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 _0xbeff=['request\x20sent','error','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbeff,0xe9));var _0xfbef=function(_0x3df822,_0x22e9ed){_0x3df822=_0x3df822-0x0;var _0x19d1b9=_0xbeff[_0x3df822];return _0x19d1b9;};'use strict';var _=require(_0xfbef('0x0'));var util=require(_0xfbef('0x1'));var moment=require(_0xfbef('0x2'));var BPromise=require(_0xfbef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbef('0x4'))['db'];var utils=require(_0xfbef('0x5'));var logger=require(_0xfbef('0x6'))(_0xfbef('0x7'));var config=require(_0xfbef('0x8'));var jayson=require(_0xfbef('0x9'));var client=jayson[_0xfbef('0xa')][_0xfbef('0xb')]({'port':0x232a});config['redis']=_[_0xfbef('0xc')](config['redis'],{'host':_0xfbef('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfbef('0xe'))['register'](socket);function respondWithRpcPromise(_0x342d86,_0x2adeab,_0x391451){return new BPromise(function(_0x5bffe0,_0x5668f1){return client[_0xfbef('0xf')](_0x342d86,_0x391451)[_0xfbef('0x10')](function(_0x1f53d2){logger[_0xfbef('0x11')]('SmsAccount,\x20%s,\x20%s',_0x2adeab,'request\x20sent');logger['debug'](_0xfbef('0x12'),_0x2adeab,_0xfbef('0x13'),JSON['stringify'](_0x1f53d2));if(_0x1f53d2[_0xfbef('0x14')]){if(_0x1f53d2['error']['code']===0x1f4){logger[_0xfbef('0x14')](_0xfbef('0x15'),_0x2adeab,_0x1f53d2[_0xfbef('0x14')][_0xfbef('0x16')]);return _0x5668f1(_0x1f53d2[_0xfbef('0x14')]['message']);}logger[_0xfbef('0x14')](_0xfbef('0x15'),_0x2adeab,_0x1f53d2['error']['message']);return _0x5bffe0(_0x1f53d2['error'][_0xfbef('0x16')]);}else{logger['info'](_0xfbef('0x15'),_0x2adeab,_0xfbef('0x13'));_0x5bffe0(_0x1f53d2[_0xfbef('0x17')]['message']);}})[_0xfbef('0x18')](function(_0xb82343){logger[_0xfbef('0x14')](_0xfbef('0x15'),_0x2adeab,_0xb82343);_0x5668f1(_0xb82343);});});}exports[_0xfbef('0x19')]=function(_0x44dd51){var _0x809323=this;return new Promise(function(_0x3a7f09,_0x52eeca){return db[_0xfbef('0x1a')][_0xfbef('0x1b')]({'raw':_0x44dd51['options']?_0x44dd51['options'][_0xfbef('0x1c')]===undefined?!![]:![]:!![],'where':_0x44dd51[_0xfbef('0x1d')]?_0x44dd51[_0xfbef('0x1d')][_0xfbef('0x1e')]||null:null,'attributes':_0x44dd51[_0xfbef('0x1d')]?_0x44dd51['options'][_0xfbef('0x1f')]||null:null,'include':_0x44dd51[_0xfbef('0x1d')]?_0x44dd51[_0xfbef('0x1d')][_0xfbef('0x20')]?_[_0xfbef('0x21')](_0x44dd51[_0xfbef('0x1d')][_0xfbef('0x20')],function(_0x33aeab){return{'model':db[_0x33aeab[_0xfbef('0x22')]],'as':_0x33aeab['as'],'attributes':_0x33aeab[_0xfbef('0x1f')],'include':_0x33aeab[_0xfbef('0x20')]?_[_0xfbef('0x21')](_0x33aeab[_0xfbef('0x20')],function(_0x20d6cb){return{'model':db[_0x20d6cb['model']],'as':_0x20d6cb['as'],'attributes':_0x20d6cb[_0xfbef('0x1f')],'include':_0x20d6cb['include']?_['map'](_0x20d6cb['include'],function(_0x563322){return{'model':db[_0x563322[_0xfbef('0x22')]],'as':_0x563322['as'],'attributes':_0x563322[_0xfbef('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b66e8){logger['info'](_0xfbef('0x19'),_0x44dd51);logger['debug'](_0xfbef('0x19'),_0x44dd51,JSON[_0xfbef('0x23')](_0x3b66e8));_0x3a7f09(_0x3b66e8);})[_0xfbef('0x18')](function(_0x27e17c){logger[_0xfbef('0x14')](_0xfbef('0x19'),_0x27e17c['message'],_0x44dd51);_0x52eeca(_0x809323[_0xfbef('0x14')](0x1f4,_0x27e17c['message']));});});}; \ No newline at end of file +var _0x8109=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount','find','options','raw','where','attributes','include','model','map','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xe05ca,_0x5ce053){var _0x217914=function(_0x89f3da){while(--_0x89f3da){_0xe05ca['push'](_0xe05ca['shift']());}};_0x217914(++_0x5ce053);}(_0x8109,0xfc));var _0x9810=function(_0x265ed2,_0x3a2f36){_0x265ed2=_0x265ed2-0x0;var _0x3ab17c=_0x8109[_0x265ed2];return _0x3ab17c;};'use strict';var _=require(_0x9810('0x0'));var util=require(_0x9810('0x1'));var moment=require(_0x9810('0x2'));var BPromise=require(_0x9810('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9810('0x4'));var db=require(_0x9810('0x5'))['db'];var utils=require(_0x9810('0x6'));var logger=require(_0x9810('0x7'))(_0x9810('0x8'));var config=require('../../config/environment');var jayson=require(_0x9810('0x9'));var client=jayson[_0x9810('0xa')][_0x9810('0xb')]({'port':0x232a});config[_0x9810('0xc')]=_[_0x9810('0xd')](config[_0x9810('0xc')],{'host':_0x9810('0xe'),'port':0x18eb});var socket=require(_0x9810('0xf'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x9810('0x10')](socket);function respondWithRpcPromise(_0x45c467,_0x50840b,_0x4188a5){return new BPromise(function(_0x4790f8,_0x412c83){return client['request'](_0x45c467,_0x4188a5)[_0x9810('0x11')](function(_0x8d1a22){logger[_0x9810('0x12')](_0x9810('0x13'),_0x50840b,_0x9810('0x14'));logger[_0x9810('0x15')](_0x9810('0x16'),_0x50840b,_0x9810('0x14'),JSON[_0x9810('0x17')](_0x8d1a22));if(_0x8d1a22[_0x9810('0x18')]){if(_0x8d1a22[_0x9810('0x18')][_0x9810('0x19')]===0x1f4){logger[_0x9810('0x18')](_0x9810('0x13'),_0x50840b,_0x8d1a22[_0x9810('0x18')]['message']);return _0x412c83(_0x8d1a22[_0x9810('0x18')][_0x9810('0x1a')]);}logger['error'](_0x9810('0x13'),_0x50840b,_0x8d1a22[_0x9810('0x18')][_0x9810('0x1a')]);return _0x4790f8(_0x8d1a22[_0x9810('0x18')][_0x9810('0x1a')]);}else{logger['info'](_0x9810('0x13'),_0x50840b,_0x9810('0x14'));_0x4790f8(_0x8d1a22['result'][_0x9810('0x1a')]);}})[_0x9810('0x1b')](function(_0x305fe9){logger[_0x9810('0x18')]('SmsAccount,\x20%s,\x20%s',_0x50840b,_0x305fe9);_0x412c83(_0x305fe9);});});}exports[_0x9810('0x1c')]=function(_0x1ec6ce){var _0x2e21a8=this;return new Promise(function(_0x15f255,_0x3b42a2){return db['SmsAccount'][_0x9810('0x1d')]({'raw':_0x1ec6ce[_0x9810('0x1e')]?_0x1ec6ce['options'][_0x9810('0x1f')]===undefined?!![]:![]:!![],'where':_0x1ec6ce[_0x9810('0x1e')]?_0x1ec6ce[_0x9810('0x1e')][_0x9810('0x20')]||null:null,'attributes':_0x1ec6ce[_0x9810('0x1e')]?_0x1ec6ce[_0x9810('0x1e')][_0x9810('0x21')]||null:null,'include':_0x1ec6ce[_0x9810('0x1e')]?_0x1ec6ce[_0x9810('0x1e')][_0x9810('0x22')]?_['map'](_0x1ec6ce[_0x9810('0x1e')][_0x9810('0x22')],function(_0x4c3ef9){return{'model':db[_0x4c3ef9[_0x9810('0x23')]],'as':_0x4c3ef9['as'],'attributes':_0x4c3ef9[_0x9810('0x21')],'include':_0x4c3ef9['include']?_[_0x9810('0x24')](_0x4c3ef9[_0x9810('0x22')],function(_0x29d09a){return{'model':db[_0x29d09a[_0x9810('0x23')]],'as':_0x29d09a['as'],'attributes':_0x29d09a['attributes'],'include':_0x29d09a['include']?_[_0x9810('0x24')](_0x29d09a[_0x9810('0x22')],function(_0x363ddc){return{'model':db[_0x363ddc[_0x9810('0x23')]],'as':_0x363ddc['as'],'attributes':_0x363ddc[_0x9810('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9810('0x11')](function(_0x508b39){logger[_0x9810('0x12')](_0x9810('0x1c'),_0x1ec6ce);logger['debug'](_0x9810('0x1c'),_0x1ec6ce,JSON[_0x9810('0x17')](_0x508b39));_0x15f255(_0x508b39);})[_0x9810('0x1b')](function(_0x477be4){logger[_0x9810('0x18')](_0x9810('0x1c'),_0x477be4[_0x9810('0x1a')],_0x1ec6ce);_0x3b42a2(_0x2e21a8[_0x9810('0x18')](0x1f4,_0x477be4['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index d49e9a2..4a76adb 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 _0xf1b0=['smsAccount:','./smsAccount.events','save','remove','update','removeListener'];(function(_0x47903d,_0x1d1dca){var _0x176303=function(_0x2c276a){while(--_0x2c276a){_0x47903d['push'](_0x47903d['shift']());}};_0x176303(++_0x1d1dca);}(_0xf1b0,0x151));var _0x0f1b=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0xf1b0[_0x7b173];return _0x1c598c;};'use strict';var SmsAccountEvents=require(_0x0f1b('0x0'));var events=[_0x0f1b('0x1'),_0x0f1b('0x2'),_0x0f1b('0x3')];function createListener(_0x4280c3,_0x4193f3){return function(_0x4ac856){_0x4193f3['emit'](_0x4280c3,_0x4ac856);};}function removeListener(_0x37c2a5,_0x209c8d){return function(){SmsAccountEvents[_0x0f1b('0x4')](_0x37c2a5,_0x209c8d);};}exports['register']=function(_0x28dda7){for(var _0x12f389=0x0,_0xe15b0b=events['length'];_0x12f389<_0xe15b0b;_0x12f389++){var _0x1a2b2a=events[_0x12f389];var _0x2afc75=createListener(_0x0f1b('0x5')+_0x1a2b2a,_0x28dda7);SmsAccountEvents['on'](_0x1a2b2a,_0x2afc75);}}; \ No newline at end of file +var _0xe451=['register','length','smsAccount:','./smsAccount.events','save','remove','update','emit','removeListener'];(function(_0xa3918c,_0x59c668){var _0x322ee2=function(_0x2e7014){while(--_0x2e7014){_0xa3918c['push'](_0xa3918c['shift']());}};_0x322ee2(++_0x59c668);}(_0xe451,0x12c));var _0x1e45=function(_0x2f8809,_0x167daf){_0x2f8809=_0x2f8809-0x0;var _0x561ef3=_0xe451[_0x2f8809];return _0x561ef3;};'use strict';var SmsAccountEvents=require(_0x1e45('0x0'));var events=[_0x1e45('0x1'),_0x1e45('0x2'),_0x1e45('0x3')];function createListener(_0x46a335,_0x1d9fc7){return function(_0x5661a7){_0x1d9fc7[_0x1e45('0x4')](_0x46a335,_0x5661a7);};}function removeListener(_0x54da5a,_0x3ad59c){return function(){SmsAccountEvents[_0x1e45('0x5')](_0x54da5a,_0x3ad59c);};}exports[_0x1e45('0x6')]=function(_0x170aba){for(var _0x3c3b4d=0x0,_0x55d10a=events[_0x1e45('0x7')];_0x3c3b4d<_0x55d10a;_0x3c3b4d++){var _0x2fde13=events[_0x3c3b4d];var _0x57e1ac=createListener(_0x1e45('0x8')+_0x2fde13,_0x170aba);SmsAccountEvents['on'](_0x2fde13,_0x57e1ac);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 30f8d5e..53d92a9 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 _0xb4c2=['index','show','post','create','/:id','update','delete','multer','util','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated'];(function(_0x5e6b52,_0x3bbdda){var _0xafd2bc=function(_0x1324c9){while(--_0x1324c9){_0x5e6b52['push'](_0x5e6b52['shift']());}};_0xafd2bc(++_0x3bbdda);}(_0xb4c2,0x11f));var _0x2b4c=function(_0x208fe2,_0x40a58a){_0x208fe2=_0x208fe2-0x0;var _0x4b283f=_0xb4c2[_0x208fe2];return _0x4b283f;};'use strict';var multer=require(_0x2b4c('0x0'));var util=require(_0x2b4c('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(_0x2b4c('0x2'));var config=require(_0x2b4c('0x3'));var controller=require(_0x2b4c('0x4'));router[_0x2b4c('0x5')]('/',auth[_0x2b4c('0x6')](),controller[_0x2b4c('0x7')]);router[_0x2b4c('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x2b4c('0x8')]);router[_0x2b4c('0x9')]('/',auth[_0x2b4c('0x6')](),controller[_0x2b4c('0xa')]);router['put'](_0x2b4c('0xb'),auth[_0x2b4c('0x6')](),controller[_0x2b4c('0xc')]);router[_0x2b4c('0xd')](_0x2b4c('0xb'),auth[_0x2b4c('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9f6b=['../../components/auth/service','../../config/environment','./smsApplication.controller','isAuthenticated','index','/:id','show','post','create','multer','util','path','connect-timeout','express','Router'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9f6b,0x162));var _0xb9f6=function(_0x680443,_0x1ab79f){_0x680443=_0x680443-0x0;var _0x28121f=_0x9f6b[_0x680443];return _0x28121f;};'use strict';var multer=require(_0xb9f6('0x0'));var util=require(_0xb9f6('0x1'));var path=require(_0xb9f6('0x2'));var timeout=require(_0xb9f6('0x3'));var express=require(_0xb9f6('0x4'));var router=express[_0xb9f6('0x5')]();var auth=require(_0xb9f6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb9f6('0x7'));var controller=require(_0xb9f6('0x8'));router['get']('/',auth[_0xb9f6('0x9')](),controller[_0xb9f6('0xa')]);router['get'](_0xb9f6('0xb'),auth[_0xb9f6('0x9')](),controller[_0xb9f6('0xc')]);router[_0xb9f6('0xd')]('/',auth['isAuthenticated'](),controller[_0xb9f6('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb9f6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 9ba098e..1b8e970 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 _0x5211=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x1762e7,_0x395f19){var _0x3daa52=function(_0x3f2f5b){while(--_0x3f2f5b){_0x1762e7['push'](_0x1762e7['shift']());}};_0x3daa52(++_0x395f19);}(_0x5211,0x17d));var _0x1521=function(_0xc72052,_0x4a3363){_0xc72052=_0xc72052-0x0;var _0x1f9949=_0x5211[_0xc72052];return _0x1f9949;};'use strict';var Sequelize=require(_0x1521('0x0'));module[_0x1521('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1521('0x2')],'allowNull':![],'defaultValue':_0x1521('0x3')},'appdata':{'type':Sequelize[_0x1521('0x4')]()},'description':{'type':Sequelize[_0x1521('0x2')]},'interval':{'type':Sequelize[_0x1521('0x2')],'defaultValue':_0x1521('0x5')}}; \ No newline at end of file +var _0x023b=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x023b,0x80));var _0xb023=function(_0x56c4bc,_0x3e87fa){_0x56c4bc=_0x56c4bc-0x0;var _0x34dfea=_0x023b[_0x56c4bc];return _0x34dfea;};'use strict';var Sequelize=require(_0xb023('0x0'));module[_0xb023('0x1')]={'priority':{'type':Sequelize[_0xb023('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb023('0x3')],'allowNull':![],'defaultValue':_0xb023('0x4')},'appdata':{'type':Sequelize[_0xb023('0x5')]()},'description':{'type':Sequelize[_0xb023('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb023('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e1d5475..d89cd3b 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 _0xbaf0=['to-csv','ejs','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','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','SmsApplication','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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['SmsApplication'][_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));}; \ No newline at end of file +var _0x5204=['moment','bluebird','util','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','index','SmsApplication','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','catch','show','params','rawAttributes','keys','includeAll','include','find','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x14f8a4,_0x47af7f){var _0x562f74=function(_0x11b1b6){while(--_0x11b1b6){_0x14f8a4['push'](_0x14f8a4['shift']());}};_0x562f74(++_0x47af7f);}(_0x5204,0xdf));var _0x4520=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0x5204[_0x36f243];return _0x426436;};'use strict';var pdf=require(_0x4520('0x0'));var emlformat=require(_0x4520('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4520('0x2'));var jsonpatch=require(_0x4520('0x3'));var rp=require(_0x4520('0x4'));var moment=require(_0x4520('0x5'));var BPromise=require(_0x4520('0x6'));var Mustache=require('mustache');var util=require(_0x4520('0x7'));var path=require('path');var sox=require(_0x4520('0x8'));var csv=require(_0x4520('0x9'));var ejs=require(_0x4520('0xa'));var fs=require('fs');var _=require(_0x4520('0xb'));var squel=require(_0x4520('0xc'));var crypto=require(_0x4520('0xd'));var jsforce=require(_0x4520('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4520('0x9'));var querystring=require('querystring');var Papa=require(_0x4520('0xf'));var Redis=require(_0x4520('0x10'));var authService=require(_0x4520('0x11'));var qs=require(_0x4520('0x12'));var as=require(_0x4520('0x13'));var hardwareService=require(_0x4520('0x14'));var logger=require(_0x4520('0x15'))(_0x4520('0x16'));var utils=require(_0x4520('0x17'));var config=require(_0x4520('0x18'));var db=require(_0x4520('0x19'))['db'];function respondWithStatusCode(_0x394072,_0x3c7a5d){_0x3c7a5d=_0x3c7a5d||0xcc;return function(_0x508ea6){if(_0x508ea6){return _0x394072[_0x4520('0x1a')](_0x3c7a5d);}return _0x394072[_0x4520('0x1b')](_0x3c7a5d)[_0x4520('0x1c')]();};}function respondWithResult(_0x4677d7,_0x426836){_0x426836=_0x426836||0xc8;return function(_0x34d383){if(_0x34d383){return _0x4677d7[_0x4520('0x1b')](_0x426836)['json'](_0x34d383);}};}function respondWithFilteredResult(_0x3e53e5,_0x20de6b){return function(_0x1ab841){if(_0x1ab841){var _0x15a31f=_0x1ab841[_0x4520('0x1d')],_0x32d8aa=_0x20de6b[_0x4520('0x1e')],_0x51d85f=_0x20de6b[_0x4520('0x1e')]+_0x20de6b[_0x4520('0x1f')],_0x2c1805;if(_0x51d85f>=_0x15a31f){_0x51d85f=_0x15a31f;_0x2c1805=0xc8;}else{_0x2c1805=0xce;}_0x3e53e5[_0x4520('0x1b')](_0x2c1805);return _0x3e53e5[_0x4520('0x20')](_0x4520('0x21'),_0x32d8aa+'-'+_0x51d85f+'/'+_0x15a31f)[_0x4520('0x22')](_0x1ab841);}return null;};}function patchUpdates(_0x11eaea){return function(_0x398dd2){try{jsonpatch[_0x4520('0x23')](_0x398dd2,_0x11eaea,!![]);}catch(_0x4ac41d){return BPromise[_0x4520('0x24')](_0x4ac41d);}return _0x398dd2['save']();};}function saveUpdates(_0x5ceff6,_0x4c46c5){return function(_0x2b9456){if(_0x2b9456){return _0x2b9456['update'](_0x5ceff6)[_0x4520('0x25')](function(_0x270dc2){return _0x270dc2;});}return null;};}function removeEntity(_0x428d36,_0x534b15){return function(_0x3199a9){if(_0x3199a9){return _0x3199a9[_0x4520('0x26')]()[_0x4520('0x25')](function(){_0x428d36['status'](0xcc)[_0x4520('0x1c')]();});}};}function handleEntityNotFound(_0x847d15,_0x24eacd){return function(_0x3a4680){if(!_0x3a4680){_0x847d15[_0x4520('0x1a')](0x194);}return _0x3a4680;};}function handleError(_0x552da1,_0x3774bd){_0x3774bd=_0x3774bd||0x1f4;return function(_0x15987c){logger[_0x4520('0x27')](_0x15987c[_0x4520('0x28')]);if(_0x15987c['name']){delete _0x15987c[_0x4520('0x29')];}_0x552da1[_0x4520('0x1b')](_0x3774bd)[_0x4520('0x2a')](_0x15987c);};}exports[_0x4520('0x2b')]=function(_0xad9f8,_0x2c95ea){var _0x2d6902={},_0x195c58={},_0x180c44={'count':0x0,'rows':[]};var _0x926ca0=_['map'](db[_0x4520('0x2c')]['rawAttributes'],function(_0x7ce8d2){return{'name':_0x7ce8d2[_0x4520('0x2d')],'type':_0x7ce8d2[_0x4520('0x2e')][_0x4520('0x2f')]};});_0x195c58[_0x4520('0x30')]=_[_0x4520('0x31')](_0x926ca0,'name');_0x195c58[_0x4520('0x32')]=_['keys'](_0xad9f8[_0x4520('0x32')]);_0x195c58['filters']=_[_0x4520('0x33')](_0x195c58['model'],_0x195c58[_0x4520('0x32')]);_0x2d6902['attributes']=_['intersection'](_0x195c58[_0x4520('0x30')],qs[_0x4520('0x34')](_0xad9f8[_0x4520('0x32')]['fields']));_0x2d6902[_0x4520('0x35')]=_0x2d6902[_0x4520('0x35')][_0x4520('0x36')]?_0x2d6902[_0x4520('0x35')]:_0x195c58['model'];if(!_0xad9f8['query'][_0x4520('0x37')](_0x4520('0x38'))){_0x2d6902['limit']=qs[_0x4520('0x1f')](_0xad9f8[_0x4520('0x32')][_0x4520('0x1f')]);_0x2d6902[_0x4520('0x1e')]=qs[_0x4520('0x1e')](_0xad9f8[_0x4520('0x32')]['offset']);}_0x2d6902[_0x4520('0x39')]=qs[_0x4520('0x3a')](_0xad9f8['query'][_0x4520('0x3a')]);_0x2d6902['where']=qs[_0x4520('0x3b')](_[_0x4520('0x3c')](_0xad9f8['query'],_0x195c58['filters']),_0x926ca0);if(_0xad9f8['query'][_0x4520('0x3d')]){_0x2d6902[_0x4520('0x3e')]=_[_0x4520('0x3f')](_0x2d6902[_0x4520('0x3e')],{'$or':_[_0x4520('0x31')](_0x926ca0,function(_0x1ca2b4){if(_0x1ca2b4[_0x4520('0x2e')]!=='VIRTUAL'){var _0x47085e={};_0x47085e[_0x1ca2b4[_0x4520('0x29')]]={'$like':'%'+_0xad9f8[_0x4520('0x32')]['filter']+'%'};return _0x47085e;}})});}_0x2d6902=_[_0x4520('0x3f')]({},_0x2d6902,_0xad9f8[_0x4520('0x40')]);var _0x5c6f84={'where':_0x2d6902['where']};return db[_0x4520('0x2c')][_0x4520('0x1d')](_0x5c6f84)[_0x4520('0x25')](function(_0x11164a){_0x180c44[_0x4520('0x1d')]=_0x11164a;if(_0xad9f8['query']['includeAll']){_0x2d6902['include']=[{'all':!![]}];}return db[_0x4520('0x2c')]['findAll'](_0x2d6902);})[_0x4520('0x25')](function(_0x54da7a){_0x180c44['rows']=_0x54da7a;return _0x180c44;})[_0x4520('0x25')](respondWithFilteredResult(_0x2c95ea,_0x2d6902))[_0x4520('0x41')](handleError(_0x2c95ea,null));};exports[_0x4520('0x42')]=function(_0x214026,_0x21e21c){var _0x59d646={'raw':!![],'where':{'id':_0x214026[_0x4520('0x43')]['id']}},_0x1675e6={};_0x1675e6['model']=_['keys'](db[_0x4520('0x2c')][_0x4520('0x44')]);_0x1675e6['query']=_[_0x4520('0x45')](_0x214026[_0x4520('0x32')]);_0x1675e6[_0x4520('0x3b')]=_[_0x4520('0x33')](_0x1675e6['model'],_0x1675e6[_0x4520('0x32')]);_0x59d646[_0x4520('0x35')]=_[_0x4520('0x33')](_0x1675e6[_0x4520('0x30')],qs[_0x4520('0x34')](_0x214026[_0x4520('0x32')][_0x4520('0x34')]));_0x59d646[_0x4520('0x35')]=_0x59d646[_0x4520('0x35')][_0x4520('0x36')]?_0x59d646[_0x4520('0x35')]:_0x1675e6[_0x4520('0x30')];if(_0x214026[_0x4520('0x32')][_0x4520('0x46')]){_0x59d646[_0x4520('0x47')]=[{'all':!![]}];}_0x59d646=_[_0x4520('0x3f')]({},_0x59d646,_0x214026[_0x4520('0x40')]);return db['SmsApplication'][_0x4520('0x48')](_0x59d646)[_0x4520('0x25')](handleEntityNotFound(_0x21e21c,null))['then'](respondWithResult(_0x21e21c,null))['catch'](handleError(_0x21e21c,null));};exports['create']=function(_0x4dce4f,_0x22e62d){return db['SmsApplication'][_0x4520('0x49')](_0x4dce4f[_0x4520('0x4a')],{})[_0x4520('0x25')](respondWithResult(_0x22e62d,0xc9))[_0x4520('0x41')](handleError(_0x22e62d,null));};exports[_0x4520('0x4b')]=function(_0x5e3eef,_0x2b89be){if(_0x5e3eef[_0x4520('0x4a')]['id']){delete _0x5e3eef[_0x4520('0x4a')]['id'];}return db[_0x4520('0x2c')][_0x4520('0x48')]({'where':{'id':_0x5e3eef[_0x4520('0x43')]['id']}})[_0x4520('0x25')](handleEntityNotFound(_0x2b89be,null))[_0x4520('0x25')](saveUpdates(_0x5e3eef[_0x4520('0x4a')],null))[_0x4520('0x25')](respondWithResult(_0x2b89be,null))[_0x4520('0x41')](handleError(_0x2b89be,null));};exports[_0x4520('0x26')]=function(_0x4cf80e,_0x53987b){return db[_0x4520('0x2c')][_0x4520('0x48')]({'where':{'id':_0x4cf80e[_0x4520('0x43')]['id']}})['then'](handleEntityNotFound(_0x53987b,null))[_0x4520('0x25')](removeEntity(_0x53987b,null))[_0x4520('0x41')](handleError(_0x53987b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d1a4144..9d83e1f 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 _0x34cf=['sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x427249,_0x360587){var _0x5ad328=function(_0x3af302){while(--_0x3af302){_0x427249['push'](_0x427249['shift']());}};_0x5ad328(++_0x360587);}(_0x34cf,0x113));var _0xf34c=function(_0x567d54,_0x516180){_0x567d54=_0x567d54-0x0;var _0x5dcb34=_0x34cf[_0x567d54];return _0x5dcb34;};'use strict';var _=require(_0xf34c('0x0'));var util=require(_0xf34c('0x1'));var logger=require(_0xf34c('0x2'))(_0xf34c('0x3'));var moment=require(_0xf34c('0x4'));var BPromise=require('bluebird');var rp=require(_0xf34c('0x5'));var fs=require('fs');var path=require(_0xf34c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf34c('0x7'));module[_0xf34c('0x8')]=function(_0xef66cc,_0x193e54){return _0xef66cc[_0xf34c('0x9')](_0xf34c('0xa'),attributes,{'tableName':_0xf34c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf34c('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8ce0=['path','rimraf','./smsApplication.attributes','define','SmsApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x28467f,_0x2ec69e){var _0x9db74f=function(_0x464ee3){while(--_0x464ee3){_0x28467f['push'](_0x28467f['shift']());}};_0x9db74f(++_0x2ec69e);}(_0x8ce0,0x172));var _0x08ce=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x8ce0[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x08ce('0x0'));var util=require(_0x08ce('0x1'));var logger=require(_0x08ce('0x2'))(_0x08ce('0x3'));var moment=require(_0x08ce('0x4'));var BPromise=require(_0x08ce('0x5'));var rp=require(_0x08ce('0x6'));var fs=require('fs');var path=require(_0x08ce('0x7'));var rimraf=require(_0x08ce('0x8'));var config=require('../../config/environment');var attributes=require(_0x08ce('0x9'));module['exports']=function(_0x14398e,_0x59528d){return _0x14398e[_0x08ce('0xa')](_0x08ce('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x08ce('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 5f2dde7..1d67662 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 _0x7c22=['SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','then','request\x20sent','debug'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x7c22,0x6c));var _0x27c2=function(_0x93d17a,_0x1bcb82){_0x93d17a=_0x93d17a-0x0;var _0x2b4eee=_0x7c22[_0x93d17a];return _0x2b4eee;};'use strict';var _=require(_0x27c2('0x0'));var util=require(_0x27c2('0x1'));var moment=require('moment');var BPromise=require(_0x27c2('0x2'));var rs=require(_0x27c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27c2('0x4'))['db'];var utils=require(_0x27c2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x27c2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x27c2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32ec44,_0x123055,_0x56736f){return new BPromise(function(_0xb57ae1,_0xd38478){return client[_0x27c2('0x8')](_0x32ec44,_0x56736f)[_0x27c2('0x9')](function(_0x298bb7){logger['info']('SmsApplication,\x20%s,\x20%s',_0x123055,_0x27c2('0xa'));logger[_0x27c2('0xb')](_0x27c2('0xc'),_0x123055,_0x27c2('0xa'),JSON['stringify'](_0x298bb7));if(_0x298bb7[_0x27c2('0xd')]){if(_0x298bb7[_0x27c2('0xd')][_0x27c2('0xe')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x123055,_0x298bb7[_0x27c2('0xd')][_0x27c2('0xf')]);return _0xd38478(_0x298bb7[_0x27c2('0xd')][_0x27c2('0xf')]);}logger[_0x27c2('0xd')]('SmsApplication,\x20%s,\x20%s',_0x123055,_0x298bb7[_0x27c2('0xd')]['message']);return _0xb57ae1(_0x298bb7[_0x27c2('0xd')][_0x27c2('0xf')]);}else{logger[_0x27c2('0x10')](_0x27c2('0x11'),_0x123055,'request\x20sent');_0xb57ae1(_0x298bb7[_0x27c2('0x12')][_0x27c2('0xf')]);}})[_0x27c2('0x13')](function(_0xdbe562){logger[_0x27c2('0xd')](_0x27c2('0x11'),_0x123055,_0xdbe562);_0xd38478(_0xdbe562);});});} \ No newline at end of file +var _0x5a93=['debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x449a12,_0x196a03){var _0x9e89ab=function(_0xfe2ef6){while(--_0xfe2ef6){_0x449a12['push'](_0x449a12['shift']());}};_0x9e89ab(++_0x196a03);}(_0x5a93,0xf6));var _0x35a9=function(_0x4191bb,_0x4910a6){_0x4191bb=_0x4191bb-0x0;var _0x1f9b76=_0x5a93[_0x4191bb];return _0x1f9b76;};'use strict';var _=require('lodash');var util=require(_0x35a9('0x0'));var moment=require('moment');var BPromise=require(_0x35a9('0x1'));var rs=require(_0x35a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35a9('0x3'));var logger=require(_0x35a9('0x4'))(_0x35a9('0x5'));var config=require('../../config/environment');var jayson=require(_0x35a9('0x6'));var client=jayson[_0x35a9('0x7')][_0x35a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x354490,_0x271228,_0x45e6f7){return new BPromise(function(_0x71d143,_0x22d770){return client[_0x35a9('0x9')](_0x354490,_0x45e6f7)[_0x35a9('0xa')](function(_0x5b4f25){logger[_0x35a9('0xb')](_0x35a9('0xc'),_0x271228,_0x35a9('0xd'));logger[_0x35a9('0xe')](_0x35a9('0xf'),_0x271228,_0x35a9('0xd'),JSON['stringify'](_0x5b4f25));if(_0x5b4f25[_0x35a9('0x10')]){if(_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x11')]===0x1f4){logger[_0x35a9('0x10')]('SmsApplication,\x20%s,\x20%s',_0x271228,_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x12')]);return _0x22d770(_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x12')]);}logger['error'](_0x35a9('0xc'),_0x271228,_0x5b4f25[_0x35a9('0x10')][_0x35a9('0x12')]);return _0x71d143(_0x5b4f25[_0x35a9('0x10')]['message']);}else{logger[_0x35a9('0xb')](_0x35a9('0xc'),_0x271228,_0x35a9('0xd'));_0x71d143(_0x5b4f25['result'][_0x35a9('0x12')]);}})[_0x35a9('0x13')](function(_0x14eeb5){logger[_0x35a9('0x10')](_0x35a9('0xc'),_0x271228,_0x14eeb5);_0x22d770(_0x14eeb5);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index d62e22b..714f9a6 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 _0xfdad=['isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','destroy','delete','/:id/tags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0xfdad,0x164));var _0xdfda=function(_0x576ed1,_0x3b6ec4){_0x576ed1=_0x576ed1-0x0;var _0x2f825e=_0xfdad[_0x576ed1];return _0x2f825e;};'use strict';var multer=require(_0xdfda('0x0'));var util=require(_0xdfda('0x1'));var path=require('path');var timeout=require(_0xdfda('0x2'));var express=require(_0xdfda('0x3'));var router=express['Router']();var auth=require(_0xdfda('0x4'));var interaction=require(_0xdfda('0x5'));var config=require(_0xdfda('0x6'));var controller=require('./smsInteraction.controller');router[_0xdfda('0x7')]('/',auth[_0xdfda('0x8')](),controller['index']);router[_0xdfda('0x7')](_0xdfda('0x9'),auth[_0xdfda('0x8')](),controller[_0xdfda('0xa')]);router[_0xdfda('0x7')](_0xdfda('0xb'),auth[_0xdfda('0x8')](),controller[_0xdfda('0xc')]);router[_0xdfda('0x7')](_0xdfda('0xd'),auth[_0xdfda('0x8')](),controller[_0xdfda('0xe')]);router[_0xdfda('0x7')](_0xdfda('0xf'),auth[_0xdfda('0x8')](),controller[_0xdfda('0x10')]);router['post']('/',auth[_0xdfda('0x8')](),controller[_0xdfda('0x11')]);router[_0xdfda('0x12')](_0xdfda('0xd'),auth[_0xdfda('0x8')](),controller['addMessage']);router[_0xdfda('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xdfda('0x13')](_0xdfda('0x14'),_0xdfda('0x15')),controller['addTags']);router[_0xdfda('0x16')]('/:id',auth[_0xdfda('0x8')](),interaction[_0xdfda('0x13')](_0xdfda('0x14'),_0xdfda('0x17')),controller['update']);router['delete'](_0xdfda('0xb'),auth[_0xdfda('0x8')](),interaction[_0xdfda('0x13')](_0xdfda('0x14'),'smsinteraction:destroy'),controller[_0xdfda('0x18')]);router[_0xdfda('0x19')](_0xdfda('0x1a'),auth[_0xdfda('0x8')](),controller['removeTags']);module[_0xdfda('0x1b')]=router; \ No newline at end of file +var _0xdf94=['post','create','/:id/tags','sms','smsinteraction:addtags','addTags','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x7c51b5,_0x50f45d){var _0x129dfe=function(_0x29b8e2){while(--_0x29b8e2){_0x7c51b5['push'](_0x7c51b5['shift']());}};_0x129dfe(++_0x50f45d);}(_0xdf94,0xad));var _0x4df9=function(_0x30f700,_0x203748){_0x30f700=_0x30f700-0x0;var _0x55e4eb=_0xdf94[_0x30f700];return _0x55e4eb;};'use strict';var multer=require('multer');var util=require(_0x4df9('0x0'));var path=require(_0x4df9('0x1'));var timeout=require(_0x4df9('0x2'));var express=require(_0x4df9('0x3'));var router=express[_0x4df9('0x4')]();var auth=require(_0x4df9('0x5'));var interaction=require(_0x4df9('0x6'));var config=require(_0x4df9('0x7'));var controller=require(_0x4df9('0x8'));router[_0x4df9('0x9')]('/',auth[_0x4df9('0xa')](),controller[_0x4df9('0xb')]);router[_0x4df9('0x9')](_0x4df9('0xc'),auth[_0x4df9('0xa')](),controller[_0x4df9('0xd')]);router[_0x4df9('0x9')](_0x4df9('0xe'),auth['isAuthenticated'](),controller[_0x4df9('0xf')]);router[_0x4df9('0x9')](_0x4df9('0x10'),auth[_0x4df9('0xa')](),controller[_0x4df9('0x11')]);router[_0x4df9('0x9')](_0x4df9('0x12'),auth['isAuthenticated'](),controller['download']);router[_0x4df9('0x13')]('/',auth['isAuthenticated'](),controller[_0x4df9('0x14')]);router[_0x4df9('0x13')](_0x4df9('0x10'),auth[_0x4df9('0xa')](),controller['addMessage']);router[_0x4df9('0x13')](_0x4df9('0x15'),auth[_0x4df9('0xa')](),interaction['tracked'](_0x4df9('0x16'),_0x4df9('0x17')),controller[_0x4df9('0x18')]);router['put'](_0x4df9('0xe'),auth['isAuthenticated'](),interaction[_0x4df9('0x19')](_0x4df9('0x16'),_0x4df9('0x1a')),controller[_0x4df9('0x1b')]);router['delete'](_0x4df9('0xe'),auth[_0x4df9('0xa')](),interaction[_0x4df9('0x19')]('sms',_0x4df9('0x1c')),controller['destroy']);router[_0x4df9('0x1d')](_0x4df9('0x15'),auth[_0x4df9('0xa')](),controller[_0x4df9('0x1e')]);module[_0x4df9('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 6865c96..b0307a3 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 _0xb10b=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x3e5de0,_0x2aa52b){var _0x247d28=function(_0x558b6f){while(--_0x558b6f){_0x3e5de0['push'](_0x3e5de0['shift']());}};_0x247d28(++_0x2aa52b);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a94d0,_0x374e5d){_0x4a94d0=_0x4a94d0-0x0;var _0x50128a=_0xb10b[_0x4a94d0];return _0x50128a;};'use strict';var Sequelize=require(_0xbb10('0x0'));var moment=require('moment');module[_0xbb10('0x1')]={'closed':{'type':Sequelize[_0xbb10('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb10('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbb10('0x4')]},'phone':{'type':Sequelize[_0xbb10('0x4')]},'read1stAt':{'type':Sequelize[_0xbb10('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbb10('0x5')]('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb10('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x9ec221,_0x2594a6){var _0xdbe55e=function(_0x4b4c43){while(--_0x4b4c43){_0x9ec221['push'](_0x9ec221['shift']());}};_0xdbe55e(++_0x2594a6);}(_0x757a,0xde));var _0xa757=function(_0x5ed35a,_0x5c2d67){_0x5ed35a=_0x5ed35a-0x0;var _0xe83723=_0x757a[_0x5ed35a];return _0xe83723;};'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 diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index cc5f4a2..87e4d79 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 _0xde2c=['having','`\x20=\x200','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','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','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.email','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','show','includeAll','include','create','update','params','destroy','SmsMessage','addMessage','ids','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','omit','findAll','emit','removeTags','download','unix','join','root','server','transcript-%d-%s.zip','Contact','createdAt','secret','SmsAccount','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','Sms','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','direction','out','System','lastName','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','u.id','user_has_sms_interactions','users','select','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','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'];(function(_0x190194,_0xe6b356){var _0x3acc59=function(_0x54a5b9){while(--_0x54a5b9){_0x190194['push'](_0x190194['shift']());}};_0x3acc59(++_0xe6b356);}(_0xde2c,0x7f));var _0xcde2=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xde2c[_0x12ca5f];return _0xfc3ae9;};'use strict';var pdf=require(_0xcde2('0x0'));var emlformat=require(_0xcde2('0x1'));var rimraf=require(_0xcde2('0x2'));var zipdir=require(_0xcde2('0x3'));var jsonpatch=require(_0xcde2('0x4'));var rp=require(_0xcde2('0x5'));var moment=require(_0xcde2('0x6'));var BPromise=require(_0xcde2('0x7'));var Mustache=require('mustache');var util=require(_0xcde2('0x8'));var path=require(_0xcde2('0x9'));var sox=require(_0xcde2('0xa'));var csv=require(_0xcde2('0xb'));var ejs=require(_0xcde2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var db=require(_0xcde2('0x18'))['db'];config[_0xcde2('0x19')]=_[_0xcde2('0x1a')](config[_0xcde2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xcde2('0x1b'))(new Redis(config['redis']));require(_0xcde2('0x1c'))['register'](socket);function respondWithStatusCode(_0x4b0e0e,_0x34e079){_0x34e079=_0x34e079||0xcc;return function(_0x1c7103){if(_0x1c7103){return _0x4b0e0e[_0xcde2('0x1d')](_0x34e079);}return _0x4b0e0e[_0xcde2('0x1e')](_0x34e079)[_0xcde2('0x1f')]();};}function respondWithResult(_0x5312c7,_0x39b023){_0x39b023=_0x39b023||0xc8;return function(_0x4c558b){if(_0x4c558b){return _0x5312c7[_0xcde2('0x1e')](_0x39b023)[_0xcde2('0x20')](_0x4c558b);}};}function respondWithFilteredResult(_0xbade43,_0x1f1858){return function(_0x5223f1){if(_0x5223f1){var _0x4fd5aa=_0x5223f1[_0xcde2('0x21')],_0x4fe586=_0x1f1858[_0xcde2('0x22')],_0x2b4468=_0x1f1858[_0xcde2('0x22')]+_0x1f1858['limit'],_0x582e84;if(_0x2b4468>=_0x4fd5aa){_0x2b4468=_0x4fd5aa;_0x582e84=0xc8;}else{_0x582e84=0xce;}_0xbade43[_0xcde2('0x1e')](_0x582e84);return _0xbade43[_0xcde2('0x23')](_0xcde2('0x24'),_0x4fe586+'-'+_0x2b4468+'/'+_0x4fd5aa)[_0xcde2('0x20')](_0x5223f1);}return null;};}function patchUpdates(_0x43df7a){return function(_0x57210d){try{jsonpatch['apply'](_0x57210d,_0x43df7a,!![]);}catch(_0x5a92b9){return BPromise[_0xcde2('0x25')](_0x5a92b9);}return _0x57210d[_0xcde2('0x26')]();};}function saveUpdates(_0x2c9562,_0x4063d4){return function(_0xc86374){if(_0xc86374){return _0xc86374['update'](_0x2c9562)[_0xcde2('0x27')](function(_0x52368b){return _0x52368b;});}return null;};}function removeEntity(_0x280d8c,_0xb2123c){return function(_0x26d18e){if(_0x26d18e){return _0x26d18e['destroy']()['then'](function(){_0x280d8c[_0xcde2('0x1e')](0xcc)[_0xcde2('0x1f')]();});}};}function handleEntityNotFound(_0x3e8aaf,_0x217ec9){return function(_0xcadb2){if(!_0xcadb2){_0x3e8aaf['sendStatus'](0x194);}return _0xcadb2;};}function handleError(_0x2d1d17,_0x45275a){_0x45275a=_0x45275a||0x1f4;return function(_0x1dce65){logger['error'](_0x1dce65[_0xcde2('0x28')]);if(_0x1dce65[_0xcde2('0x29')]){delete _0x1dce65[_0xcde2('0x29')];}_0x2d1d17[_0xcde2('0x1e')](_0x45275a)[_0xcde2('0x2a')](_0x1dce65);};}function getInteractionUsers(_0x5b2b7,_0x40b12c){return new BPromise(function(_0x3e492f,_0x5bf1e6){try{if(_0x40b12c[_0x5b2b7['id']]){_0x5b2b7[_0xcde2('0x2b')]=_['map'](_0x40b12c[_0x5b2b7['id']],function(_0x141072){return{'id':_0x141072['id'],'fullname':_0x141072[_0xcde2('0x2c')]};});}}catch(_0x43706c){_0x5bf1e6(_0x43706c);}_0x3e492f(_0x5b2b7);});}function getInteractionTags(_0x49cb58,_0xae46dc){return new BPromise(function(_0x28fedd,_0x58afb1){try{if(_0x49cb58[_0xcde2('0x2d')]){_0x49cb58[_0xcde2('0x2e')]=[];_0x49cb58[_0xcde2('0x2d')][_0xcde2('0x2f')](',')[_0xcde2('0x30')](function(_0xb689cd){_0x49cb58[_0xcde2('0x2e')][_0xcde2('0x31')](_0xae46dc[_0xb689cd]);});}delete _0x49cb58['TagIds'];}catch(_0x3a1f13){_0x58afb1(_0x3a1f13);}_0x28fedd(_0x49cb58);});}function updateSmsInteraction(_0x6fda22,_0x21b7bd,_0x15bd3e){return new BPromise(function(_0x4e2c3a,_0x2ae8e0){return getInteractionUsers(_0x6fda22,_0x15bd3e)[_0xcde2('0x27')](function(_0x2e14f8){return getInteractionTags(_0x2e14f8,_0x21b7bd);})[_0xcde2('0x27')](function(_0x498339){_0x4e2c3a(_0x498339);})[_0xcde2('0x32')](function(_0x452816){_0x2ae8e0(_0x452816);});});}exports[_0xcde2('0x33')]=function(_0x303d45,_0x54ae78){var _0xb9c8d2={},_0x5ab40f={},_0xbde4f4={'count':0x0,'rows':[]};var _0x3090b6=_[_0xcde2('0x34')](db['SmsInteraction'][_0xcde2('0x35')],function(_0x31feeb){return{'name':_0x31feeb[_0xcde2('0x36')],'type':_0x31feeb[_0xcde2('0x37')]['key']};});_0x5ab40f['model']=_[_0xcde2('0x34')](_0x3090b6,_0xcde2('0x29'));_0x5ab40f[_0xcde2('0x38')]=_[_0xcde2('0x39')](_0x303d45[_0xcde2('0x38')]);_0x5ab40f[_0xcde2('0x3a')]=_[_0xcde2('0x3b')](_0x5ab40f[_0xcde2('0x3c')],_0x5ab40f[_0xcde2('0x38')]);_0xb9c8d2['attributes']=_[_0xcde2('0x3b')](_0x5ab40f[_0xcde2('0x3c')],qs[_0xcde2('0x3d')](_0x303d45[_0xcde2('0x38')][_0xcde2('0x3d')]));_0xb9c8d2['attributes']=_0xb9c8d2['attributes'][_0xcde2('0x3e')]?_0xb9c8d2[_0xcde2('0x3f')]:_0x5ab40f[_0xcde2('0x3c')];if(!_0x303d45[_0xcde2('0x38')][_0xcde2('0x40')](_0xcde2('0x41'))){_0xb9c8d2['limit']=qs['limit'](_0x303d45['query'][_0xcde2('0x42')]);_0xb9c8d2[_0xcde2('0x22')]=qs[_0xcde2('0x22')](_0x303d45[_0xcde2('0x38')][_0xcde2('0x22')]);}_0xb9c8d2[_0xcde2('0x43')]=qs[_0xcde2('0x44')](_0x303d45['query']['sort']);_0xb9c8d2[_0xcde2('0x45')]=qs['filters'](_[_0xcde2('0x46')](_0x303d45['query'],_0x5ab40f[_0xcde2('0x3a')]),_0x3090b6);var _0x3239a0=[];var _0x2cf372=squel['select']()[_0xcde2('0x47')]('id')['field'](_0xcde2('0x29'))[_0xcde2('0x47')](_0xcde2('0x48'))[_0xcde2('0x49')](_0xcde2('0x4a'));var _0x27b64f=squel['select']()['field'](_0xcde2('0x4b'))['field']('u.fullname')[_0xcde2('0x47')]('ui.SmsInteractionId')[_0xcde2('0x49')](_0xcde2('0x4c'),'ui')['left_join'](_0xcde2('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x5acde1=squel[_0xcde2('0x4e')]()[_0xcde2('0x49')]('sms_interactions','i')[_0xcde2('0x4f')]('cm_contacts','c',_0xcde2('0x50'))[_0xcde2('0x4f')](_0xcde2('0x4d'),'o',_0xcde2('0x51'))[_0xcde2('0x4f')]('sms_accounts','a',_0xcde2('0x52'))[_0xcde2('0x4f')](_0xcde2('0x53'),'me',_0xcde2('0x54'))['left_join']('sms_interaction_has_tags','it',_0xcde2('0x55'))['left_join'](_0xcde2('0x4a'),'t',_0xcde2('0x56'));var _0x381bd4=squel[_0xcde2('0x57')]();var _0x1ce210=[];var _0x3b7862=squel['expr']();var _0x1ce5fe;if(_0x303d45['query'][_0xcde2('0x58')]){_0x1ce5fe=as['parseSearch'](_0x303d45[_0xcde2('0x38')][_0xcde2('0x58')]);var _0x3d10c8=_0x1ce5fe[_0xcde2('0x59')];for(var _0x446cf0=0x0;_0x446cf0<_0x1ce5fe[_0xcde2('0x5a')]['length'];_0x446cf0++){var _0x3adc5b=_0x1ce5fe['conditions'][_0x446cf0];var _0x138c58='i';var _0x184005=_[_0xcde2('0x5b')](_0x3090b6,[_0xcde2('0x29'),_0x3adc5b[_0xcde2('0x47')]]);if(!_0x184005){switch(_0x3adc5b[_0xcde2('0x47')]){case _0xcde2('0x5c'):if(_0x3adc5b[_0xcde2('0x5d')]==0x1){_0x5acde1[_0xcde2('0x5e')]('`'+_0x3adc5b[_0xcde2('0x47')]+_0xcde2('0x5f'));}else{_0x5acde1[_0xcde2('0x5e')]('`'+_0x3adc5b['field']+'`\x20>\x200');}break;case'Contact':if(_0x3adc5b[_0xcde2('0x60')]==='$substring'){if(_0x3adc5b[_0xcde2('0x5d')][_0xcde2('0x2f')]('\x20')[_0xcde2('0x3e')]>0x1){_0x381bd4[_0x3d10c8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcde2('0x61')](_0x3adc5b['value']),null);}else{var _0x2ccfe9='%'+_0x3adc5b['value']+'%';_0x381bd4[_0x3d10c8](_0xcde2('0x62'),_0x2ccfe9,_0x2ccfe9,_0x2ccfe9);}}else{_0x184005=_[_0xcde2('0x5b')](_0x3090b6,['name',_0xcde2('0x63')]);_0x3adc5b['field']='ContactId';_0x223cb0=as[_0xcde2('0x64')](_0x138c58,_0x184005[_0xcde2('0x37')],_0x3adc5b);_0x381bd4[_0x3d10c8](_0x223cb0[_0xcde2('0x65')],_0x223cb0[_0xcde2('0x5d')][_0xcde2('0x66')],_0x223cb0[_0xcde2('0x5d')]['end']);}break;case _0xcde2('0x67'):var _0x44b3fb=_0x3adc5b[_0xcde2('0x5d')][_0xcde2('0x2f')](',')[_0xcde2('0x34')](function(_0x541a70){return Number(_0x541a70);});_0x44b3fb['forEach'](function(_0x5775bb){_0x3b7862['or'](_0xcde2('0x68'),'%,'+_0x5775bb+',%');});_0x1ce210=_[_0xcde2('0x69')](_0x1ce210,_0x44b3fb);break;case _0xcde2('0x6a'):if(_0x3adc5b[_0xcde2('0x60')]==='$substring'){_0x381bd4[_0x3d10c8](_0xcde2('0x6b'),'%'+_0x3adc5b[_0xcde2('0x5d')]+'%',null);}else{_0x184005=_[_0xcde2('0x5b')](_0x3090b6,[_0xcde2('0x29'),_0xcde2('0x6c')]);_0x3adc5b[_0xcde2('0x47')]='UserId';_0x223cb0=as[_0xcde2('0x64')](_0x138c58,_0x184005[_0xcde2('0x37')],_0x3adc5b);_0x381bd4[_0x3d10c8](_0x223cb0['text'],_0x223cb0[_0xcde2('0x5d')][_0xcde2('0x66')],_0x223cb0[_0xcde2('0x5d')][_0xcde2('0x1f')]);}break;case _0xcde2('0x6d'):_0x223cb0=as[_0xcde2('0x64')]('me',null,_0x3adc5b);_0x381bd4[_0x3d10c8](_0x223cb0[_0xcde2('0x65')],_0x223cb0[_0xcde2('0x5d')][_0xcde2('0x66')],_0x223cb0[_0xcde2('0x5d')]['end']);break;}}else{var _0x223cb0=as[_0xcde2('0x64')](_0x138c58,_0x184005['type'],_0x3adc5b);_0x381bd4[_0x3d10c8](_0x223cb0[_0xcde2('0x65')],_0x223cb0[_0xcde2('0x5d')][_0xcde2('0x66')],_0x223cb0['value'][_0xcde2('0x1f')]);}}}else{var _0x1253c6=_(_0x303d45[_0xcde2('0x38')])[_0xcde2('0x39')]()[_0xcde2('0x34')](function(_0x3aa334){return _[_0xcde2('0x6e')](_0x3090b6,[_0xcde2('0x29'),_0x3aa334])?_0x3aa334:undefined;})[_0xcde2('0x6f')]()[_0xcde2('0x5d')]();if(!_[_0xcde2('0x70')](_0x1253c6)){_0x1253c6['forEach'](function(_0x5bd1bd){if(_0x5bd1bd===_0xcde2('0x71')){_0x5acde1[_0xcde2('0x45')](_0xcde2('0x72'),[]['concat'](_0x303d45['query'][_0x5bd1bd]));}else if(_0x5bd1bd==='createdAt'){var _0x1341d0=JSON[_0xcde2('0x73')](_0x303d45[_0xcde2('0x38')][_0x5bd1bd])[_0xcde2('0x74')];var _0x325b51=JSON[_0xcde2('0x73')](_0x303d45['query'][_0x5bd1bd])['$lte'];_0x5acde1[_0xcde2('0x45')](_0xcde2('0x75'),_0x1341d0,_0x325b51);}else{if(_0x303d45[_0xcde2('0x38')][_0x5bd1bd]===_0xcde2('0x76')){_0x5acde1[_0xcde2('0x45')]('i.'+_0x5bd1bd+_0xcde2('0x77'));}else{_0x5acde1[_0xcde2('0x45')]('i.'+_0x5bd1bd+_0xcde2('0x78'),_0x303d45[_0xcde2('0x38')][_0x5bd1bd]);}}});}if(_0x303d45[_0xcde2('0x38')][_0xcde2('0x79')]){if(_0x303d45[_0xcde2('0x38')][_0xcde2('0x79')]==0x1){_0x5acde1[_0xcde2('0x5e')](_0xcde2('0x7a'));}else{_0x5acde1[_0xcde2('0x5e')](_0xcde2('0x7b'));}}if(_0x303d45[_0xcde2('0x38')][_0xcde2('0x7c')]){_0x1ce210=_[_0xcde2('0x7d')](_0x303d45['query'][_0xcde2('0x7c')])?_0x303d45[_0xcde2('0x38')][_0xcde2('0x7c')]:new Array(_0x303d45[_0xcde2('0x38')][_0xcde2('0x7c')]);_0x1ce210['forEach'](function(_0x2e9714){_0x3b7862['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2e9714+',%');});}if(_0x303d45[_0xcde2('0x38')][_0xcde2('0x7e')]){var _0x171cee=_0x303d45[_0xcde2('0x38')][_0xcde2('0x7e')][_0xcde2('0x7f')]('\x5c','\x5c\x5c')[_0xcde2('0x7f')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x171cee)){_0x381bd4['or'](_0xcde2('0x80'),_0x171cee+'%')['or']('i.phone\x20LIKE\x20?',_0x171cee+'%');}else{_0x381bd4['or'](_0xcde2('0x81'),qs[_0xcde2('0x61')](_0x171cee))['or'](_0xcde2('0x82'),_0x171cee+'%');}}}_0x5acde1[_0xcde2('0x45')](_0x381bd4);_0x5acde1[_0xcde2('0x83')](_0xcde2('0x84'));var _0x257950={'type':db['Sequelize'][_0xcde2('0x85')][_0xcde2('0x86')],'raw':!![]};var _0x25ee3e=_0x5acde1[_0xcde2('0x87')]();_0x25ee3e['field'](_0xcde2('0x84'));_0x25ee3e[_0xcde2('0x47')](_0xcde2('0x88'),_0xcde2('0x5c'));if(_0xb9c8d2[_0xcde2('0x43')]){_0xb9c8d2[_0xcde2('0x43')][_0xcde2('0x30')](function(_0x214cbb){_0x5acde1[_0xcde2('0x43')]('i.'+_0x214cbb[0x0],_0x214cbb[0x1]===_0xcde2('0x89')?![]:!![]);});}if(!_[_0xcde2('0x70')](_0x1ce210)){_0x5acde1[_0xcde2('0x5e')](_0x3b7862);_0x25ee3e[_0xcde2('0x45')]('t.id\x20IN\x20?',_0x1ce210);}BPromise[_0xcde2('0x8a')]()[_0xcde2('0x27')](function(){if(!_0x1ce5fe){if(_0x303d45[_0xcde2('0x38')][_0xcde2('0x71')]||_0x303d45[_0xcde2('0x38')][_0xcde2('0x8b')])return;_0x25ee3e[_0xcde2('0x45')](_0xcde2('0x8c'));_0x5acde1[_0xcde2('0x45')](_0xcde2('0x8c'));return;}return _0x303d45[_0xcde2('0x8d')][_0xcde2('0x8e')]({'attributes':['id'],'raw':!![]})[_0xcde2('0x27')](function(_0x2ff2f2){if(_[_0xcde2('0x70')](_0x2ff2f2)){_0x25ee3e[_0xcde2('0x45')]('i.SmsAccountId\x20IS\x20NULL');_0x5acde1['where'](_0xcde2('0x8f'));}else{_0x25ee3e[_0xcde2('0x45')](_0xcde2('0x72'),_[_0xcde2('0x34')](_0x2ff2f2,'id'));_0x5acde1['where'](_0xcde2('0x72'),_['map'](_0x2ff2f2,'id'));}});})[_0xcde2('0x27')](function(){db['sequelize'][_0xcde2('0x38')](_0x25ee3e[_0xcde2('0x90')](),_0x257950)['then'](function(_0x1c72c2){_0xbde4f4[_0xcde2('0x21')]=_0x1c72c2[_0xcde2('0x3e')];if(_0xbde4f4['count']===0x0)return[];return db[_0xcde2('0x91')][_0xcde2('0x38')](_0x2cf372[_0xcde2('0x90')](),_0x257950)[_0xcde2('0x27')](function(_0x4b7e5f){_0x3239a0=_['keyBy'](_0x4b7e5f,'id');_0x257950=_[_0xcde2('0x92')](_0x257950,{'model':db[_0xcde2('0x93')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x303d45[_0xcde2('0x38')][_0xcde2('0x3d')]){_0xb9c8d2[_0xcde2('0x3f')][_0xcde2('0x30')](function(_0x4be3c3){_0x5acde1[_0xcde2('0x47')]('i.'+_0x4be3c3);});}else{_0x5acde1[_0xcde2('0x47')](_0xcde2('0x88'),_0xcde2('0x5c'));_0x5acde1[_0xcde2('0x47')](_0xcde2('0x94'),_0xcde2('0x95'));_0x5acde1['field'](_0xcde2('0x96'),_0xcde2('0x97'));_0x5acde1['field'](_0xcde2('0x98'));_0x5acde1[_0xcde2('0x47')](_0xcde2('0x99'),'Contact.firstName');_0x5acde1[_0xcde2('0x47')](_0xcde2('0x9a'),'Contact.lastName');_0x5acde1['field']('c.email',_0xcde2('0x9b'));_0x5acde1[_0xcde2('0x47')]('c.phone',_0xcde2('0x9c'));_0x5acde1['field']('c.mobile',_0xcde2('0x9d'));_0x5acde1[_0xcde2('0x47')](_0xcde2('0x9e'),'Contact.fax');_0x5acde1[_0xcde2('0x47')](_0xcde2('0x9f'),_0xcde2('0xa0'));_0x5acde1[_0xcde2('0x47')](_0xcde2('0xa1'),_0xcde2('0xa2'));_0x5acde1[_0xcde2('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0xb9c8d2[_0xcde2('0x42')])_0x5acde1[_0xcde2('0x42')](_0xb9c8d2[_0xcde2('0x42')]);if(_0xb9c8d2[_0xcde2('0x22')])_0x5acde1[_0xcde2('0x22')](_0xb9c8d2['offset']);return db[_0xcde2('0x91')]['query'](_0x5acde1['toString'](),_0x257950);})[_0xcde2('0x27')](function(_0x5aa5c9){_0x27b64f['where'](_0xcde2('0xa3'),_[_0xcde2('0x34')](_0x5aa5c9,'id'));return db[_0xcde2('0x91')][_0xcde2('0x38')](_0x27b64f[_0xcde2('0x90')](),_0x257950)['then'](function(_0x44d0ad){var _0x562486=_[_0xcde2('0xa4')](_0x44d0ad,_0xcde2('0xa5'));var _0x3d96b1=[];_0x5aa5c9[_0xcde2('0x30')](function(_0x5130a5){_0x3d96b1['push'](updateSmsInteraction(_0x5130a5,_0x3239a0,_0x562486));});return BPromise['all'](_0x3d96b1);});});})[_0xcde2('0x27')](function(_0x4bd901){_0xbde4f4['rows']=_0x4bd901;return _0xbde4f4;})[_0xcde2('0x27')](respondWithFilteredResult(_0x54ae78,_0xb9c8d2));})[_0xcde2('0x32')](handleError(_0x54ae78,null));};exports[_0xcde2('0xa6')]=function(_0x15f943,_0xe8b781){var _0x7a6b89={'raw':![],'where':{'id':_0x15f943['params']['id']}},_0x236d70={};_0x236d70[_0xcde2('0x3c')]=_[_0xcde2('0x39')](db[_0xcde2('0x93')][_0xcde2('0x35')]);_0x236d70[_0xcde2('0x38')]=_[_0xcde2('0x39')](_0x15f943[_0xcde2('0x38')]);_0x236d70['filters']=_[_0xcde2('0x3b')](_0x236d70['model'],_0x236d70['query']);_0x7a6b89[_0xcde2('0x3f')]=_[_0xcde2('0x3b')](_0x236d70[_0xcde2('0x3c')],qs[_0xcde2('0x3d')](_0x15f943[_0xcde2('0x38')][_0xcde2('0x3d')]));_0x7a6b89[_0xcde2('0x3f')]=_0x7a6b89['attributes'][_0xcde2('0x3e')]?_0x7a6b89[_0xcde2('0x3f')]:_0x236d70[_0xcde2('0x3c')];if(_0x15f943['query'][_0xcde2('0xa7')]){_0x7a6b89[_0xcde2('0xa8')]=[{'all':!![]}];}_0x7a6b89=_['merge']({},_0x7a6b89,_0x15f943['options']);return db[_0xcde2('0x93')][_0xcde2('0x5b')](_0x7a6b89)[_0xcde2('0x27')](handleEntityNotFound(_0xe8b781,null))[_0xcde2('0x27')](respondWithResult(_0xe8b781,null))[_0xcde2('0x32')](handleError(_0xe8b781,null));};exports['create']=function(_0x5a78ad,_0x2c7414){return db['SmsInteraction'][_0xcde2('0xa9')](_0x5a78ad[_0xcde2('0x6d')],{})[_0xcde2('0x27')](respondWithResult(_0x2c7414,0xc9))[_0xcde2('0x32')](handleError(_0x2c7414,null));};exports[_0xcde2('0xaa')]=function(_0x5350d3,_0x1149c8){if(_0x5350d3[_0xcde2('0x6d')]['id']){delete _0x5350d3[_0xcde2('0x6d')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x5350d3[_0xcde2('0xab')]['id']}})['then'](handleEntityNotFound(_0x1149c8,null))[_0xcde2('0x27')](saveUpdates(_0x5350d3[_0xcde2('0x6d')],null))[_0xcde2('0x27')](respondWithResult(_0x1149c8,null))[_0xcde2('0x32')](handleError(_0x1149c8,null));};exports[_0xcde2('0xac')]=function(_0x404284,_0x427d7a){return db['SmsInteraction']['find']({'where':{'id':_0x404284[_0xcde2('0xab')]['id']}})[_0xcde2('0x27')](handleEntityNotFound(_0x427d7a,null))[_0xcde2('0x27')](removeEntity(_0x427d7a,null))['catch'](handleError(_0x427d7a,null));};exports['describe']=function(_0x12293b,_0x39143c){return db[_0xcde2('0x93')]['describe']()[_0xcde2('0x27')](respondWithResult(_0x39143c,null))[_0xcde2('0x32')](handleError(_0x39143c,null));};exports['addMessage']=function(_0x3eae0b,_0x138eaa,_0x9ffcc8){return db[_0xcde2('0xad')][_0xcde2('0x5b')]({'where':{'id':_0x3eae0b[_0xcde2('0xab')]['id']}})[_0xcde2('0x27')](handleEntityNotFound(_0x138eaa,null))[_0xcde2('0x27')](function(_0x48c169){if(_0x48c169){return _0x48c169[_0xcde2('0xae')](_0x3eae0b[_0xcde2('0x6d')][_0xcde2('0xaf')],_['omit'](_0x3eae0b[_0xcde2('0x6d')],[_0xcde2('0xaf'),'id'])||{});}})[_0xcde2('0x27')](respondWithResult(_0x138eaa,null))[_0xcde2('0x32')](handleError(_0x138eaa,null));};exports['getMessages']=function(_0x1faf97,_0x4268bd,_0x1b520e){var _0x14c475={'raw':![],'where':{}};var _0x223a08={};var _0x4ffbb2={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x1faf97[_0xcde2('0xab')]['id']}})[_0xcde2('0x27')](handleEntityNotFound(_0x4268bd,null))['then'](function(_0x25a17b){if(_0x25a17b){_0x223a08[_0xcde2('0x3c')]=_[_0xcde2('0x39')](db['SmsMessage'][_0xcde2('0x35')]);_0x223a08[_0xcde2('0x38')]=_[_0xcde2('0x39')](_0x1faf97['query']);_0x223a08[_0xcde2('0x3a')]=_[_0xcde2('0x3b')](_0x223a08[_0xcde2('0x3c')],_0x223a08[_0xcde2('0x38')]);_0x14c475[_0xcde2('0x3f')]=_[_0xcde2('0x3b')](_0x223a08[_0xcde2('0x3c')],qs[_0xcde2('0x3d')](_0x1faf97[_0xcde2('0x38')][_0xcde2('0x3d')]));_0x14c475[_0xcde2('0x3f')]=_0x14c475[_0xcde2('0x3f')]['length']?_0x14c475[_0xcde2('0x3f')]:_0x223a08['model'];if(!_0x1faf97[_0xcde2('0x38')]['hasOwnProperty'](_0xcde2('0x41'))){_0x14c475['limit']=qs['limit'](_0x1faf97[_0xcde2('0x38')][_0xcde2('0x42')]);_0x14c475[_0xcde2('0x22')]=qs[_0xcde2('0x22')](_0x1faf97[_0xcde2('0x38')][_0xcde2('0x22')]);}_0x14c475['order']=qs[_0xcde2('0x44')](_0x1faf97[_0xcde2('0x38')][_0xcde2('0x44')]);_0x14c475[_0xcde2('0x45')]=qs[_0xcde2('0x3a')](_[_0xcde2('0x46')](_0x1faf97[_0xcde2('0x38')],_0x223a08[_0xcde2('0x3a')]));_0x14c475[_0xcde2('0x45')][_0xcde2('0xa5')]=_0x25a17b['id'];if(_0x1faf97['query'][_0xcde2('0x7e')]){_0x14c475[_0xcde2('0x45')]=_[_0xcde2('0x92')](_0x14c475[_0xcde2('0x45')],{'$or':_[_0xcde2('0x34')](_0x14c475[_0xcde2('0x3f')],function(_0x504f94){var _0x353e44={};_0x353e44[_0x504f94]={'$like':'%'+_0x1faf97[_0xcde2('0x38')][_0xcde2('0x7e')]+'%'};return _0x353e44;})});}if(_0x1faf97[_0xcde2('0x38')][_0xcde2('0x74')]){var _0x27ab58=_0x1faf97[_0xcde2('0x38')][_0xcde2('0x74')]['split'](',');var _0x5785bf={};_0x5785bf[_0x27ab58[0x0]]={'$gte':moment(_0x27ab58[0x1])[_0xcde2('0xb0')](_0xcde2('0xb1'))};_0x14c475[_0xcde2('0x45')]=_[_0xcde2('0x92')](_0x14c475[_0xcde2('0x45')],_0x5785bf);}_0x14c475=_[_0xcde2('0x92')]({},_0x14c475,_0x1faf97[_0xcde2('0xb2')]);return db[_0xcde2('0xad')][_0xcde2('0x21')]({'where':_0x14c475[_0xcde2('0x45')]})['then'](function(_0x3f9b5b){_0x4ffbb2[_0xcde2('0x21')]=_0x3f9b5b;if(_0x1faf97[_0xcde2('0x38')][_0xcde2('0xa7')]){_0x14c475[_0xcde2('0xa8')]=[{'all':!![]}];}return db[_0xcde2('0xad')]['findAll'](_0x14c475);})[_0xcde2('0x27')](function(_0x49db7b){_0x4ffbb2[_0xcde2('0xb3')]=_0x49db7b;return _0x4ffbb2;});}})[_0xcde2('0x27')](respondWithFilteredResult(_0x4268bd,_0x14c475))[_0xcde2('0x32')](handleError(_0x4268bd,null));};exports[_0xcde2('0xb4')]=function(_0x4ebd59,_0x3f3654,_0x2c736c){return db[_0xcde2('0x93')][_0xcde2('0x5b')]({'where':{'id':_0x4ebd59[_0xcde2('0xab')]['id']}})['then'](handleEntityNotFound(_0x3f3654,null))[_0xcde2('0x27')](function(_0x6b48e){if(_0x6b48e){return _0x6b48e[_0xcde2('0xb5')](_0x4ebd59['body'][_0xcde2('0xaf')],_[_0xcde2('0xb6')](_0x4ebd59[_0xcde2('0x6d')],['ids','id'])||{})['spread'](function(){return db[_0xcde2('0x67')][_0xcde2('0xb7')]({'attributes':['id',_0xcde2('0x29'),_0xcde2('0x48')],'where':{'id':_0x4ebd59['body'][_0xcde2('0xaf')]}});})['then'](function(_0x1a7570){socket[_0xcde2('0xb8')]('smsInteractionTags:save',{'id':Number(_0x4ebd59[_0xcde2('0xab')]['id']),'tags':_0x1a7570||[]});return{'id':Number(_0x4ebd59[_0xcde2('0xab')]['id']),'tags':_0x1a7570||[]};});}})['then'](respondWithResult(_0x3f3654,null))[_0xcde2('0x32')](handleError(_0x3f3654,null));};exports[_0xcde2('0xb9')]=function(_0x5a5422,_0x5de57e,_0x488ec5){return db['SmsInteraction'][_0xcde2('0x5b')]({'where':{'id':_0x5a5422[_0xcde2('0xab')]['id']}})[_0xcde2('0x27')](handleEntityNotFound(_0x5de57e,null))['then'](function(_0x3dae1c){if(_0x3dae1c){return _0x3dae1c[_0xcde2('0xb9')](_0x5a5422[_0xcde2('0x38')][_0xcde2('0xaf')]);}})[_0xcde2('0x27')](respondWithStatusCode(_0x5de57e,null))[_0xcde2('0x32')](handleError(_0x5de57e,null));};exports[_0xcde2('0xba')]=function(_0x51a939,_0x259090){var _0x1dc03f=moment()[_0xcde2('0xbb')]()[_0xcde2('0x90')]();var _0x3d82c8=path[_0xcde2('0xbc')](config[_0xcde2('0xbd')],_0xcde2('0xbe'),'files','tmp');var _0x17a17b=path[_0xcde2('0xbc')](config[_0xcde2('0xbd')],'server','files','attachments');var _0x1d5873=path[_0xcde2('0xbc')](_0x3d82c8,_0x1dc03f);var _0x1868db=util[_0xcde2('0xb0')](_0xcde2('0xbf'),_0x51a939['params']['id'],_0x1dc03f);var _0x43f23e=path[_0xcde2('0xbc')](_0x3d82c8,_0x1868db);var _0x340df3=[];_0x340df3[_0xcde2('0x31')]({'model':db[_0xcde2('0x6a')],'as':_0xcde2('0x6a'),'attributes':['id','fullname'],'raw':!![]});_0x340df3[_0xcde2('0x31')]({'model':db['CmContact'],'as':_0xcde2('0xc0'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x53aff2=[{'model':db[_0xcde2('0xad')],'as':'Messages','attributes':['id','body',_0xcde2('0xc1'),'direction',_0xcde2('0xc2'),_0xcde2('0x79')],'include':_0x340df3}];_0x53aff2[_0xcde2('0x31')]({'model':db[_0xcde2('0xc3')],'as':_0xcde2('0xc4'),'attributes':['id',_0xcde2('0x29')]});_0x53aff2[_0xcde2('0x31')]({'model':db[_0xcde2('0x6a')],'as':'Owner','attributes':['id','fullname']});return db[_0xcde2('0x93')]['find']({'where':{'id':_0x51a939['params']['id']},'include':_0x53aff2})[_0xcde2('0x27')](handleEntityNotFound(_0x259090,null))[_0xcde2('0x27')](function(_0x12d060){if(_0x12d060){var _0x4be643=_0x12d060[_0xcde2('0xc5')]({'plain':!![]});fs[_0xcde2('0xc6')](_0x1d5873);var _0x453824={'format':'A4','border':'10px','header':{'height':_0xcde2('0xc7'),'contents':{'first':_0xcde2('0xc8')}},'footer':{'height':'30px','contents':{'default':util[_0xcde2('0xb0')](_0xcde2('0xc9'),util['format']('%s\x20#%d',_0xcde2('0xca'),_0x4be643['id']),moment()['format'](_0xcde2('0xcb'))[_0xcde2('0x90')]())}}};var _0x36a33a={'channel':'Sms','account':_0x4be643[_0xcde2('0xc4')]['name'],'agent':_0x4be643['Owner']?_0x4be643[_0xcde2('0xcc')][_0xcde2('0x2c')]:_0xcde2('0xcd'),'createdAt':moment(_0x4be643[_0xcde2('0xc1')])[_0xcde2('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x4be643[_0xcde2('0xce')]?moment(_0x4be643[_0xcde2('0xcf')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xcde2('0x90')]():'','disposition':_0x4be643[_0xcde2('0xd0')],'messages':_(_0x4be643['Messages'])[_0xcde2('0x7e')]({'secret':![]})[_0xcde2('0x34')](function(_0x3d673e){return{'date':moment(_0x3d673e[_0xcde2('0xc1')])[_0xcde2('0xb0')](_0xcde2('0xb1'))[_0xcde2('0x90')](),'sender':_0x3d673e[_0xcde2('0xd1')]===_0xcde2('0xd2')?_0x3d673e[_0xcde2('0x6a')]?_0x3d673e['User'][_0xcde2('0x2c')]:_0xcde2('0xd3'):_0x3d673e[_0xcde2('0xc0')]['firstName']+(_0x3d673e['Contact'][_0xcde2('0xd4')]?'\x20'+_0x3d673e[_0xcde2('0xc0')]['lastName']:''),'body':_0x3d673e[_0xcde2('0x6d')],'direction':_0x3d673e['direction']===_0xcde2('0xd2')?'A':'C','secret':_0x3d673e['secret'],'read':_0x3d673e[_0xcde2('0x79')]};})[_0xcde2('0x5d')]()};return ejs[_0xcde2('0xd5')](path['join'](config[_0xcde2('0xbd')],_0xcde2('0xbe'),_0xcde2('0xd6'),_0xcde2('0xd7')),{'interaction':_0x36a33a})[_0xcde2('0x27')](function(_0x3591e6){return new BPromise(function(_0xc6ee3a,_0x2dc70e){pdf[_0xcde2('0xa9')](_0x3591e6,_0x453824)[_0xcde2('0xd8')](path['join'](_0x1d5873,'transcript-'+_0x4be643['id']+'-'+_0x1dc03f+_0xcde2('0xd9')),function(_0x22b5c1,_0x3a0dd8){if(_0x22b5c1)return _0x2dc70e(_0x22b5c1);_0xc6ee3a(_0x3a0dd8);});});})[_0xcde2('0x27')](function(){return new BPromise(function(_0x508e7b,_0x5196f9){zipdir(_0x1d5873,{'saveTo':_0x43f23e},function(_0x21da72,_0x4c68d2){if(_0x21da72)return _0x5196f9(_0x21da72);return _0x508e7b(_0x4c68d2);});})[_0xcde2('0x27')](function(){return new BPromise(function(_0x589af6,_0x1978d9){rimraf(_0x1d5873,function(_0x3b32d5){if(_0x3b32d5)_0x1978d9(_0x3b32d5);return _0x589af6();});});})['then'](function(){return _0x259090[_0xcde2('0xba')](_0x43f23e,_0x1868db,function(_0x258f98){if(_0x258f98){console[_0xcde2('0xda')](_0xcde2('0xdb'),_0x258f98);}else{fs[_0xcde2('0xdc')](_0x43f23e);}});});});}else{return _0x259090[_0xcde2('0x1d')](0xc8);}})[_0xcde2('0x32')](handleError(_0x259090,null));}; \ No newline at end of file +var _0xb58b=['Account','Owner','mkdirSync','10px','\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','YYYY-MM-DD','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','map','fullname','TagIds','split','forEach','Tags','push','catch','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','field','from','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','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?','find','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','compact','isEmpty','SmsAccountId','where','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','SmsInteraction','includeAll','include','merge','options','create','update','describe','addMessage','SmsMessage','ids','omit','getMessages','filter','$gte','format','findAll','addTags','setTags','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','firstName','lastName','direction','secret','SmsAccount'];(function(_0x530525,_0x7e14ec){var _0x41a015=function(_0x4fab3e){while(--_0x4fab3e){_0x530525['push'](_0x530525['shift']());}};_0x41a015(++_0x7e14ec);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4964b5,_0x48bdf0){_0x4964b5=_0x4964b5-0x0;var _0x3663d3=_0xb58b[_0x4964b5];return _0x3663d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb58('0x0'));var rimraf=require(_0xbb58('0x1'));var zipdir=require(_0xbb58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb58('0x3'));var moment=require(_0xbb58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb58('0x5'));var util=require('util');var path=require(_0xbb58('0x6'));var sox=require(_0xbb58('0x7'));var csv=require(_0xbb58('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x8'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var db=require(_0xbb58('0x17'))['db'];config['redis']=_[_0xbb58('0x18')](config[_0xbb58('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb58('0x1a'))(new Redis(config[_0xbb58('0x19')]));require(_0xbb58('0x1b'))[_0xbb58('0x1c')](socket);function respondWithStatusCode(_0x19ceda,_0x58245f){_0x58245f=_0x58245f||0xcc;return function(_0x110944){if(_0x110944){return _0x19ceda[_0xbb58('0x1d')](_0x58245f);}return _0x19ceda['status'](_0x58245f)['end']();};}function respondWithResult(_0x33c20f,_0x445b1f){_0x445b1f=_0x445b1f||0xc8;return function(_0x38d69a){if(_0x38d69a){return _0x33c20f['status'](_0x445b1f)['json'](_0x38d69a);}};}function respondWithFilteredResult(_0x5ac9df,_0x55156e){return function(_0x28637b){if(_0x28637b){var _0x3134ea=_0x28637b[_0xbb58('0x1e')],_0x48f3e0=_0x55156e[_0xbb58('0x1f')],_0xbee66=_0x55156e[_0xbb58('0x1f')]+_0x55156e[_0xbb58('0x20')],_0x497653;if(_0xbee66>=_0x3134ea){_0xbee66=_0x3134ea;_0x497653=0xc8;}else{_0x497653=0xce;}_0x5ac9df[_0xbb58('0x21')](_0x497653);return _0x5ac9df[_0xbb58('0x22')](_0xbb58('0x23'),_0x48f3e0+'-'+_0xbee66+'/'+_0x3134ea)['json'](_0x28637b);}return null;};}function patchUpdates(_0x84f34){return function(_0x2d8c0f){try{jsonpatch[_0xbb58('0x24')](_0x2d8c0f,_0x84f34,!![]);}catch(_0x3b4dc6){return BPromise[_0xbb58('0x25')](_0x3b4dc6);}return _0x2d8c0f[_0xbb58('0x26')]();};}function saveUpdates(_0x49453a,_0x350be7){return function(_0x27bbec){if(_0x27bbec){return _0x27bbec['update'](_0x49453a)[_0xbb58('0x27')](function(_0x53b693){return _0x53b693;});}return null;};}function removeEntity(_0x21964d,_0x287822){return function(_0x152f22){if(_0x152f22){return _0x152f22[_0xbb58('0x28')]()[_0xbb58('0x27')](function(){_0x21964d[_0xbb58('0x21')](0xcc)[_0xbb58('0x29')]();});}};}function handleEntityNotFound(_0x15e4c5,_0x4e0303){return function(_0x283dff){if(!_0x283dff){_0x15e4c5[_0xbb58('0x1d')](0x194);}return _0x283dff;};}function handleError(_0x1be0ae,_0x129094){_0x129094=_0x129094||0x1f4;return function(_0x8e9ed9){logger[_0xbb58('0x2a')](_0x8e9ed9[_0xbb58('0x2b')]);if(_0x8e9ed9[_0xbb58('0x2c')]){delete _0x8e9ed9[_0xbb58('0x2c')];}_0x1be0ae[_0xbb58('0x21')](_0x129094)[_0xbb58('0x2d')](_0x8e9ed9);};}function getInteractionUsers(_0x28b3a3,_0x2a0481){return new BPromise(function(_0x4157c4,_0x3559b6){try{if(_0x2a0481[_0x28b3a3['id']]){_0x28b3a3['Users']=_[_0xbb58('0x2e')](_0x2a0481[_0x28b3a3['id']],function(_0xe46bc1){return{'id':_0xe46bc1['id'],'fullname':_0xe46bc1[_0xbb58('0x2f')]};});}}catch(_0x3c9cee){_0x3559b6(_0x3c9cee);}_0x4157c4(_0x28b3a3);});}function getInteractionTags(_0x3304b9,_0x9d379f){return new BPromise(function(_0x1ba526,_0x643e0e){try{if(_0x3304b9[_0xbb58('0x30')]){_0x3304b9['Tags']=[];_0x3304b9[_0xbb58('0x30')][_0xbb58('0x31')](',')[_0xbb58('0x32')](function(_0x3a1e46){_0x3304b9[_0xbb58('0x33')][_0xbb58('0x34')](_0x9d379f[_0x3a1e46]);});}delete _0x3304b9[_0xbb58('0x30')];}catch(_0x2599af){_0x643e0e(_0x2599af);}_0x1ba526(_0x3304b9);});}function updateSmsInteraction(_0x23816c,_0x1cae1c,_0x389187){return new BPromise(function(_0x34583e,_0x2f5967){return getInteractionUsers(_0x23816c,_0x389187)['then'](function(_0x51b69f){return getInteractionTags(_0x51b69f,_0x1cae1c);})['then'](function(_0x1def9f){_0x34583e(_0x1def9f);})[_0xbb58('0x35')](function(_0x1c207b){_0x2f5967(_0x1c207b);});});}exports[_0xbb58('0x36')]=function(_0xb28e63,_0x3333e5){var _0x3093bf={},_0x29137f={},_0x5db313={'count':0x0,'rows':[]};var _0x2fbf90=_[_0xbb58('0x2e')](db['SmsInteraction'][_0xbb58('0x37')],function(_0x4da3ed){return{'name':_0x4da3ed[_0xbb58('0x38')],'type':_0x4da3ed['type'][_0xbb58('0x39')]};});_0x29137f[_0xbb58('0x3a')]=_['map'](_0x2fbf90,_0xbb58('0x2c'));_0x29137f[_0xbb58('0x3b')]=_[_0xbb58('0x3c')](_0xb28e63[_0xbb58('0x3b')]);_0x29137f[_0xbb58('0x3d')]=_[_0xbb58('0x3e')](_0x29137f[_0xbb58('0x3a')],_0x29137f[_0xbb58('0x3b')]);_0x3093bf['attributes']=_[_0xbb58('0x3e')](_0x29137f[_0xbb58('0x3a')],qs[_0xbb58('0x3f')](_0xb28e63['query']['fields']));_0x3093bf[_0xbb58('0x40')]=_0x3093bf['attributes'][_0xbb58('0x41')]?_0x3093bf[_0xbb58('0x40')]:_0x29137f[_0xbb58('0x3a')];if(!_0xb28e63['query']['hasOwnProperty'](_0xbb58('0x42'))){_0x3093bf[_0xbb58('0x20')]=qs[_0xbb58('0x20')](_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x20')]);_0x3093bf[_0xbb58('0x1f')]=qs['offset'](_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x1f')]);}_0x3093bf[_0xbb58('0x43')]=qs[_0xbb58('0x44')](_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x44')]);_0x3093bf['where']=qs[_0xbb58('0x3d')](_['pick'](_0xb28e63[_0xbb58('0x3b')],_0x29137f[_0xbb58('0x3d')]),_0x2fbf90);var _0x29fb1c=[];var _0x45817f=squel['select']()[_0xbb58('0x45')]('id')[_0xbb58('0x45')](_0xbb58('0x2c'))[_0xbb58('0x45')]('color')[_0xbb58('0x46')]('tools_tags');var _0x2ffd8b=squel[_0xbb58('0x47')]()[_0xbb58('0x45')](_0xbb58('0x48'))[_0xbb58('0x45')](_0xbb58('0x49'))[_0xbb58('0x45')](_0xbb58('0x4a'))[_0xbb58('0x46')](_0xbb58('0x4b'),'ui')[_0xbb58('0x4c')](_0xbb58('0x4d'),'u',_0xbb58('0x4e'));var _0x55a1cc=squel[_0xbb58('0x47')]()['from']('sms_interactions','i')[_0xbb58('0x4c')](_0xbb58('0x4f'),'c',_0xbb58('0x50'))[_0xbb58('0x4c')](_0xbb58('0x4d'),'o',_0xbb58('0x51'))[_0xbb58('0x4c')](_0xbb58('0x52'),'a',_0xbb58('0x53'))[_0xbb58('0x4c')](_0xbb58('0x54'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xbb58('0x4c')](_0xbb58('0x55'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xbb58('0x4c')](_0xbb58('0x56'),'t',_0xbb58('0x57'));var _0xdb0ff7=squel['expr']();var _0x17418c=[];var _0x54d658=squel[_0xbb58('0x58')]();var _0x336598;if(_0xb28e63[_0xbb58('0x3b')]['search']){_0x336598=as[_0xbb58('0x59')](_0xb28e63[_0xbb58('0x3b')]['search']);var _0x419cef=_0x336598['sqlOperator'];for(var _0x28301d=0x0;_0x28301d<_0x336598[_0xbb58('0x5a')][_0xbb58('0x41')];_0x28301d++){var _0x1ec976=_0x336598[_0xbb58('0x5a')][_0x28301d];var _0x13d964='i';var _0x130557=_['find'](_0x2fbf90,[_0xbb58('0x2c'),_0x1ec976[_0xbb58('0x45')]]);if(!_0x130557){switch(_0x1ec976['field']){case _0xbb58('0x5b'):if(_0x1ec976[_0xbb58('0x5c')]==0x1){_0x55a1cc['having']('`'+_0x1ec976[_0xbb58('0x45')]+_0xbb58('0x5d'));}else{_0x55a1cc[_0xbb58('0x5e')]('`'+_0x1ec976['field']+_0xbb58('0x5f'));}break;case _0xbb58('0x60'):if(_0x1ec976[_0xbb58('0x61')]==='$substring'){if(_0x1ec976[_0xbb58('0x5c')]['split']('\x20')[_0xbb58('0x41')]>0x1){_0xdb0ff7[_0x419cef](_0xbb58('0x62'),qs[_0xbb58('0x63')](_0x1ec976['value']),null);}else{var _0x5aaace='%'+_0x1ec976[_0xbb58('0x5c')]+'%';_0xdb0ff7[_0x419cef](_0xbb58('0x64'),_0x5aaace,_0x5aaace,_0x5aaace);}}else{_0x130557=_[_0xbb58('0x65')](_0x2fbf90,[_0xbb58('0x2c'),_0xbb58('0x66')]);_0x1ec976['field']=_0xbb58('0x66');_0x143a40=as[_0xbb58('0x67')](_0x13d964,_0x130557[_0xbb58('0x68')],_0x1ec976);_0xdb0ff7[_0x419cef](_0x143a40['text'],_0x143a40[_0xbb58('0x5c')][_0xbb58('0x69')],_0x143a40[_0xbb58('0x5c')][_0xbb58('0x29')]);}break;case _0xbb58('0x6a'):var _0x5e7ae0=_0x1ec976[_0xbb58('0x5c')][_0xbb58('0x31')](',')[_0xbb58('0x2e')](function(_0x20dcaa){return Number(_0x20dcaa);});_0x5e7ae0[_0xbb58('0x32')](function(_0x38b1ba){_0x54d658['or'](_0xbb58('0x6b'),'%,'+_0x38b1ba+',%');});_0x17418c=_[_0xbb58('0x6c')](_0x17418c,_0x5e7ae0);break;case'User':if(_0x1ec976[_0xbb58('0x61')]==='$substring'){_0xdb0ff7[_0x419cef](_0xbb58('0x6d'),'%'+_0x1ec976[_0xbb58('0x5c')]+'%',null);}else{_0x130557=_[_0xbb58('0x65')](_0x2fbf90,[_0xbb58('0x2c'),_0xbb58('0x6e')]);_0x1ec976[_0xbb58('0x45')]=_0xbb58('0x6e');_0x143a40=as[_0xbb58('0x67')](_0x13d964,_0x130557[_0xbb58('0x68')],_0x1ec976);_0xdb0ff7[_0x419cef](_0x143a40[_0xbb58('0x6f')],_0x143a40[_0xbb58('0x5c')]['start'],_0x143a40[_0xbb58('0x5c')][_0xbb58('0x29')]);}break;case _0xbb58('0x70'):_0x143a40=as['buildExpression']('me',null,_0x1ec976);_0xdb0ff7[_0x419cef](_0x143a40[_0xbb58('0x6f')],_0x143a40['value'][_0xbb58('0x69')],_0x143a40[_0xbb58('0x5c')]['end']);break;}}else{var _0x143a40=as[_0xbb58('0x67')](_0x13d964,_0x130557[_0xbb58('0x68')],_0x1ec976);_0xdb0ff7[_0x419cef](_0x143a40[_0xbb58('0x6f')],_0x143a40[_0xbb58('0x5c')]['start'],_0x143a40['value'][_0xbb58('0x29')]);}}}else{var _0x2f0db7=_(_0xb28e63[_0xbb58('0x3b')])['keys']()[_0xbb58('0x2e')](function(_0x419215){return _['some'](_0x2fbf90,[_0xbb58('0x2c'),_0x419215])?_0x419215:undefined;})[_0xbb58('0x71')]()['value']();if(!_[_0xbb58('0x72')](_0x2f0db7)){_0x2f0db7[_0xbb58('0x32')](function(_0x3c6f5d){if(_0x3c6f5d===_0xbb58('0x73')){_0x55a1cc[_0xbb58('0x74')]('i.SmsAccountId\x20IN\x20?',[][_0xbb58('0x75')](_0xb28e63[_0xbb58('0x3b')][_0x3c6f5d]));}else if(_0x3c6f5d===_0xbb58('0x76')){var _0x1da9c7=JSON[_0xbb58('0x77')](_0xb28e63['query'][_0x3c6f5d])['$gte'];var _0x29f64a=JSON['parse'](_0xb28e63[_0xbb58('0x3b')][_0x3c6f5d])[_0xbb58('0x78')];_0x55a1cc[_0xbb58('0x74')](_0xbb58('0x79'),_0x1da9c7,_0x29f64a);}else{if(_0xb28e63[_0xbb58('0x3b')][_0x3c6f5d]===_0xbb58('0x7a')){_0x55a1cc[_0xbb58('0x74')]('i.'+_0x3c6f5d+_0xbb58('0x7b'));}else{_0x55a1cc[_0xbb58('0x74')]('i.'+_0x3c6f5d+_0xbb58('0x7c'),_0xb28e63['query'][_0x3c6f5d]);}}});}if(_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x7d')]){if(_0xb28e63[_0xbb58('0x3b')]['read']==0x1){_0x55a1cc[_0xbb58('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x55a1cc['having'](_0xbb58('0x7e'));}}if(_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x7f')]){_0x17418c=_[_0xbb58('0x80')](_0xb28e63['query']['tag'])?_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x7f')]:new Array(_0xb28e63['query'][_0xbb58('0x7f')]);_0x17418c[_0xbb58('0x32')](function(_0x3cd96a){_0x54d658['or'](_0xbb58('0x6b'),'%,'+_0x3cd96a+',%');});}if(_0xb28e63[_0xbb58('0x3b')]['filter']){var _0x30b8d2=_0xb28e63['query']['filter'][_0xbb58('0x81')]('\x5c','\x5c\x5c')[_0xbb58('0x81')]('\x27\x27',_0xbb58('0x82'));if(qs['isNumeric'](_0x30b8d2)){_0xdb0ff7['or'](_0xbb58('0x83'),_0x30b8d2+'%')['or'](_0xbb58('0x84'),_0x30b8d2+'%');}else{_0xdb0ff7['or'](_0xbb58('0x85'),qs[_0xbb58('0x63')](_0x30b8d2))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x30b8d2+'%');}}}_0x55a1cc[_0xbb58('0x74')](_0xdb0ff7);_0x55a1cc['group']('i.id');var _0x3addb7={'type':db[_0xbb58('0x86')][_0xbb58('0x87')]['SELECT'],'raw':!![]};var _0x4992f7=_0x55a1cc[_0xbb58('0x88')]();_0x4992f7[_0xbb58('0x45')](_0xbb58('0x89'));_0x4992f7[_0xbb58('0x45')](_0xbb58('0x8a'),_0xbb58('0x5b'));if(_0x3093bf[_0xbb58('0x43')]){_0x3093bf[_0xbb58('0x43')][_0xbb58('0x32')](function(_0x163ca4){_0x55a1cc[_0xbb58('0x43')]('i.'+_0x163ca4[0x0],_0x163ca4[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x17418c)){_0x55a1cc[_0xbb58('0x5e')](_0x54d658);_0x4992f7[_0xbb58('0x74')](_0xbb58('0x8b'),_0x17418c);}BPromise['resolve']()[_0xbb58('0x27')](function(){if(!_0x336598){if(_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x73')]||_0xb28e63['query'][_0xbb58('0x8c')])return;_0x4992f7['where'](_0xbb58('0x8d'));_0x55a1cc['where'](_0xbb58('0x8d'));return;}return _0xb28e63[_0xbb58('0x8e')][_0xbb58('0x8f')]({'attributes':['id'],'raw':!![]})[_0xbb58('0x27')](function(_0x26c15a){if(_[_0xbb58('0x72')](_0x26c15a)){_0x4992f7['where']('i.SmsAccountId\x20IS\x20NULL');_0x55a1cc[_0xbb58('0x74')](_0xbb58('0x90'));}else{_0x4992f7['where'](_0xbb58('0x91'),_[_0xbb58('0x2e')](_0x26c15a,'id'));_0x55a1cc[_0xbb58('0x74')]('i.SmsAccountId\x20IN\x20?',_[_0xbb58('0x2e')](_0x26c15a,'id'));}});})['then'](function(){db[_0xbb58('0x92')][_0xbb58('0x3b')](_0x4992f7[_0xbb58('0x93')](),_0x3addb7)[_0xbb58('0x27')](function(_0x389cd3){_0x5db313[_0xbb58('0x1e')]=_0x389cd3[_0xbb58('0x41')];if(_0x5db313['count']===0x0)return[];return db[_0xbb58('0x92')][_0xbb58('0x3b')](_0x45817f[_0xbb58('0x93')](),_0x3addb7)['then'](function(_0x25fb59){_0x29fb1c=_[_0xbb58('0x94')](_0x25fb59,'id');_0x3addb7=_['merge'](_0x3addb7,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb28e63[_0xbb58('0x3b')][_0xbb58('0x3f')]){_0x3093bf[_0xbb58('0x40')]['forEach'](function(_0x4deb01){_0x55a1cc[_0xbb58('0x45')]('i.'+_0x4deb01);});}else{_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x8a'),_0xbb58('0x5b'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x95'),_0xbb58('0x96'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x97'),_0xbb58('0x98'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x99'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x9a'),_0xbb58('0x9b'));_0x55a1cc['field'](_0xbb58('0x9c'),'Contact.lastName');_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x9d'),_0xbb58('0x9e'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0x9f'),_0xbb58('0xa0'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0xa1'),_0xbb58('0xa2'));_0x55a1cc[_0xbb58('0x45')]('c.fax',_0xbb58('0xa3'));_0x55a1cc[_0xbb58('0x45')](_0xbb58('0xa4'),_0xbb58('0xa5'));_0x55a1cc[_0xbb58('0x45')]('o.internal',_0xbb58('0xa6'));_0x55a1cc['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbb58('0x30'));}if(_0x3093bf['limit'])_0x55a1cc[_0xbb58('0x20')](_0x3093bf['limit']);if(_0x3093bf[_0xbb58('0x1f')])_0x55a1cc['offset'](_0x3093bf[_0xbb58('0x1f')]);return db[_0xbb58('0x92')][_0xbb58('0x3b')](_0x55a1cc[_0xbb58('0x93')](),_0x3addb7);})[_0xbb58('0x27')](function(_0x30cb55){_0x2ffd8b[_0xbb58('0x74')](_0xbb58('0xa7'),_['map'](_0x30cb55,'id'));return db['sequelize'][_0xbb58('0x3b')](_0x2ffd8b[_0xbb58('0x93')](),_0x3addb7)['then'](function(_0x57f022){var _0x56722e=_[_0xbb58('0xa8')](_0x57f022,_0xbb58('0xa9'));var _0x564b8a=[];_0x30cb55[_0xbb58('0x32')](function(_0x4281c0){_0x564b8a[_0xbb58('0x34')](updateSmsInteraction(_0x4281c0,_0x29fb1c,_0x56722e));});return BPromise[_0xbb58('0xaa')](_0x564b8a);});});})[_0xbb58('0x27')](function(_0x343535){_0x5db313[_0xbb58('0xab')]=_0x343535;return _0x5db313;})[_0xbb58('0x27')](respondWithFilteredResult(_0x3333e5,_0x3093bf));})['catch'](handleError(_0x3333e5,null));};exports[_0xbb58('0xac')]=function(_0x1c8f1a,_0x4d9bb7){var _0x5b101d={'raw':![],'where':{'id':_0x1c8f1a[_0xbb58('0xad')]['id']}},_0x2bef7b={};_0x2bef7b[_0xbb58('0x3a')]=_[_0xbb58('0x3c')](db[_0xbb58('0xae')]['rawAttributes']);_0x2bef7b[_0xbb58('0x3b')]=_[_0xbb58('0x3c')](_0x1c8f1a['query']);_0x2bef7b[_0xbb58('0x3d')]=_[_0xbb58('0x3e')](_0x2bef7b[_0xbb58('0x3a')],_0x2bef7b['query']);_0x5b101d[_0xbb58('0x40')]=_[_0xbb58('0x3e')](_0x2bef7b['model'],qs[_0xbb58('0x3f')](_0x1c8f1a[_0xbb58('0x3b')]['fields']));_0x5b101d['attributes']=_0x5b101d[_0xbb58('0x40')][_0xbb58('0x41')]?_0x5b101d['attributes']:_0x2bef7b[_0xbb58('0x3a')];if(_0x1c8f1a[_0xbb58('0x3b')][_0xbb58('0xaf')]){_0x5b101d[_0xbb58('0xb0')]=[{'all':!![]}];}_0x5b101d=_[_0xbb58('0xb1')]({},_0x5b101d,_0x1c8f1a[_0xbb58('0xb2')]);return db['SmsInteraction'][_0xbb58('0x65')](_0x5b101d)['then'](handleEntityNotFound(_0x4d9bb7,null))[_0xbb58('0x27')](respondWithResult(_0x4d9bb7,null))[_0xbb58('0x35')](handleError(_0x4d9bb7,null));};exports[_0xbb58('0xb3')]=function(_0x40a994,_0x68bf76){return db[_0xbb58('0xae')]['create'](_0x40a994[_0xbb58('0x70')],{})['then'](respondWithResult(_0x68bf76,0xc9))[_0xbb58('0x35')](handleError(_0x68bf76,null));};exports[_0xbb58('0xb4')]=function(_0x4cd52b,_0x52bc27){if(_0x4cd52b[_0xbb58('0x70')]['id']){delete _0x4cd52b[_0xbb58('0x70')]['id'];}return db['SmsInteraction'][_0xbb58('0x65')]({'where':{'id':_0x4cd52b['params']['id']}})[_0xbb58('0x27')](handleEntityNotFound(_0x52bc27,null))[_0xbb58('0x27')](saveUpdates(_0x4cd52b[_0xbb58('0x70')],null))[_0xbb58('0x27')](respondWithResult(_0x52bc27,null))[_0xbb58('0x35')](handleError(_0x52bc27,null));};exports[_0xbb58('0x28')]=function(_0x8875f1,_0x2a7465){return db[_0xbb58('0xae')][_0xbb58('0x65')]({'where':{'id':_0x8875f1[_0xbb58('0xad')]['id']}})['then'](handleEntityNotFound(_0x2a7465,null))[_0xbb58('0x27')](removeEntity(_0x2a7465,null))['catch'](handleError(_0x2a7465,null));};exports[_0xbb58('0xb5')]=function(_0x586752,_0x1281d8){return db[_0xbb58('0xae')]['describe']()[_0xbb58('0x27')](respondWithResult(_0x1281d8,null))['catch'](handleError(_0x1281d8,null));};exports[_0xbb58('0xb6')]=function(_0x1378ca,_0x37e3ea,_0x4e387e){return db[_0xbb58('0xb7')][_0xbb58('0x65')]({'where':{'id':_0x1378ca[_0xbb58('0xad')]['id']}})[_0xbb58('0x27')](handleEntityNotFound(_0x37e3ea,null))[_0xbb58('0x27')](function(_0x360749){if(_0x360749){return _0x360749['addMessage'](_0x1378ca[_0xbb58('0x70')][_0xbb58('0xb8')],_[_0xbb58('0xb9')](_0x1378ca['body'],[_0xbb58('0xb8'),'id'])||{});}})[_0xbb58('0x27')](respondWithResult(_0x37e3ea,null))[_0xbb58('0x35')](handleError(_0x37e3ea,null));};exports[_0xbb58('0xba')]=function(_0xa16ba1,_0x26d28e,_0x45e60f){var _0x3641cf={'raw':![],'where':{}};var _0x31a6ee={};var _0x505902={'count':0x0,'rows':[]};return db[_0xbb58('0xae')]['findOne']({'where':{'id':_0xa16ba1[_0xbb58('0xad')]['id']}})['then'](handleEntityNotFound(_0x26d28e,null))[_0xbb58('0x27')](function(_0x1ecf17){if(_0x1ecf17){_0x31a6ee[_0xbb58('0x3a')]=_[_0xbb58('0x3c')](db[_0xbb58('0xb7')][_0xbb58('0x37')]);_0x31a6ee[_0xbb58('0x3b')]=_[_0xbb58('0x3c')](_0xa16ba1[_0xbb58('0x3b')]);_0x31a6ee[_0xbb58('0x3d')]=_[_0xbb58('0x3e')](_0x31a6ee[_0xbb58('0x3a')],_0x31a6ee[_0xbb58('0x3b')]);_0x3641cf[_0xbb58('0x40')]=_[_0xbb58('0x3e')](_0x31a6ee[_0xbb58('0x3a')],qs[_0xbb58('0x3f')](_0xa16ba1[_0xbb58('0x3b')][_0xbb58('0x3f')]));_0x3641cf[_0xbb58('0x40')]=_0x3641cf[_0xbb58('0x40')][_0xbb58('0x41')]?_0x3641cf[_0xbb58('0x40')]:_0x31a6ee[_0xbb58('0x3a')];if(!_0xa16ba1[_0xbb58('0x3b')]['hasOwnProperty'](_0xbb58('0x42'))){_0x3641cf[_0xbb58('0x20')]=qs[_0xbb58('0x20')](_0xa16ba1[_0xbb58('0x3b')]['limit']);_0x3641cf[_0xbb58('0x1f')]=qs[_0xbb58('0x1f')](_0xa16ba1[_0xbb58('0x3b')][_0xbb58('0x1f')]);}_0x3641cf[_0xbb58('0x43')]=qs['sort'](_0xa16ba1[_0xbb58('0x3b')][_0xbb58('0x44')]);_0x3641cf[_0xbb58('0x74')]=qs[_0xbb58('0x3d')](_['pick'](_0xa16ba1[_0xbb58('0x3b')],_0x31a6ee[_0xbb58('0x3d')]));_0x3641cf[_0xbb58('0x74')]['SmsInteractionId']=_0x1ecf17['id'];if(_0xa16ba1['query'][_0xbb58('0xbb')]){_0x3641cf['where']=_[_0xbb58('0xb1')](_0x3641cf[_0xbb58('0x74')],{'$or':_[_0xbb58('0x2e')](_0x3641cf['attributes'],function(_0x12e94f){var _0x27ac56={};_0x27ac56[_0x12e94f]={'$like':'%'+_0xa16ba1['query'][_0xbb58('0xbb')]+'%'};return _0x27ac56;})});}if(_0xa16ba1[_0xbb58('0x3b')]['$gte']){var _0x20e214=_0xa16ba1[_0xbb58('0x3b')][_0xbb58('0xbc')]['split'](',');var _0x2cfa2a={};_0x2cfa2a[_0x20e214[0x0]]={'$gte':moment(_0x20e214[0x1])[_0xbb58('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3641cf[_0xbb58('0x74')]=_[_0xbb58('0xb1')](_0x3641cf[_0xbb58('0x74')],_0x2cfa2a);}_0x3641cf=_[_0xbb58('0xb1')]({},_0x3641cf,_0xa16ba1[_0xbb58('0xb2')]);return db[_0xbb58('0xb7')][_0xbb58('0x1e')]({'where':_0x3641cf[_0xbb58('0x74')]})['then'](function(_0x2a0803){_0x505902['count']=_0x2a0803;if(_0xa16ba1[_0xbb58('0x3b')]['includeAll']){_0x3641cf[_0xbb58('0xb0')]=[{'all':!![]}];}return db[_0xbb58('0xb7')][_0xbb58('0xbe')](_0x3641cf);})[_0xbb58('0x27')](function(_0x3665a8){_0x505902['rows']=_0x3665a8;return _0x505902;});}})[_0xbb58('0x27')](respondWithFilteredResult(_0x26d28e,_0x3641cf))[_0xbb58('0x35')](handleError(_0x26d28e,null));};exports[_0xbb58('0xbf')]=function(_0x200d16,_0x1f5844,_0xab7d39){return db['SmsInteraction']['find']({'where':{'id':_0x200d16['params']['id']}})[_0xbb58('0x27')](handleEntityNotFound(_0x1f5844,null))['then'](function(_0x15d86c){if(_0x15d86c){return _0x15d86c[_0xbb58('0xc0')](_0x200d16[_0xbb58('0x70')][_0xbb58('0xb8')],_[_0xbb58('0xb9')](_0x200d16[_0xbb58('0x70')],[_0xbb58('0xb8'),'id'])||{})['spread'](function(){return db[_0xbb58('0x6a')][_0xbb58('0xbe')]({'attributes':['id',_0xbb58('0x2c'),_0xbb58('0xc1')],'where':{'id':_0x200d16[_0xbb58('0x70')]['ids']}});})[_0xbb58('0x27')](function(_0x5a2861){socket[_0xbb58('0xc2')](_0xbb58('0xc3'),{'id':Number(_0x200d16[_0xbb58('0xad')]['id']),'tags':_0x5a2861||[]});return{'id':Number(_0x200d16[_0xbb58('0xad')]['id']),'tags':_0x5a2861||[]};});}})[_0xbb58('0x27')](respondWithResult(_0x1f5844,null))['catch'](handleError(_0x1f5844,null));};exports[_0xbb58('0xc4')]=function(_0x2ea15c,_0x3d05df,_0x196dbf){return db[_0xbb58('0xae')]['find']({'where':{'id':_0x2ea15c[_0xbb58('0xad')]['id']}})[_0xbb58('0x27')](handleEntityNotFound(_0x3d05df,null))[_0xbb58('0x27')](function(_0x23aaec){if(_0x23aaec){return _0x23aaec['removeTags'](_0x2ea15c[_0xbb58('0x3b')][_0xbb58('0xb8')]);}})['then'](respondWithStatusCode(_0x3d05df,null))[_0xbb58('0x35')](handleError(_0x3d05df,null));};exports[_0xbb58('0xc5')]=function(_0x319d14,_0x3810f1){var _0x426144=moment()[_0xbb58('0xc6')]()[_0xbb58('0x93')]();var _0x90682c=path['join'](config['root'],'server','files','tmp');var _0x362bd8=path[_0xbb58('0xc7')](config[_0xbb58('0xc8')],_0xbb58('0xc9'),_0xbb58('0xca'),_0xbb58('0xcb'));var _0x520662=path[_0xbb58('0xc7')](_0x90682c,_0x426144);var _0x2968e3=util[_0xbb58('0xbd')](_0xbb58('0xcc'),_0x319d14['params']['id'],_0x426144);var _0x47c2ca=path[_0xbb58('0xc7')](_0x90682c,_0x2968e3);var _0x1830b0=[];_0x1830b0[_0xbb58('0x34')]({'model':db[_0xbb58('0xcd')],'as':'User','attributes':['id',_0xbb58('0x2f')],'raw':!![]});_0x1830b0[_0xbb58('0x34')]({'model':db['CmContact'],'as':_0xbb58('0x60'),'attributes':['id',_0xbb58('0xce'),_0xbb58('0xcf')],'raw':!![]});var _0x45809d=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body',_0xbb58('0x76'),_0xbb58('0xd0'),_0xbb58('0xd1'),'read'],'include':_0x1830b0}];_0x45809d['push']({'model':db[_0xbb58('0xd2')],'as':_0xbb58('0xd3'),'attributes':['id','name']});_0x45809d['push']({'model':db[_0xbb58('0xcd')],'as':_0xbb58('0xd4'),'attributes':['id',_0xbb58('0x2f')]});return db[_0xbb58('0xae')][_0xbb58('0x65')]({'where':{'id':_0x319d14[_0xbb58('0xad')]['id']},'include':_0x45809d})[_0xbb58('0x27')](handleEntityNotFound(_0x3810f1,null))[_0xbb58('0x27')](function(_0x51c7e6){if(_0x51c7e6){var _0x3aec87=_0x51c7e6['get']({'plain':!![]});fs[_0xbb58('0xd5')](_0x520662);var _0x4237aa={'format':'A4','border':_0xbb58('0xd6'),'header':{'height':'40px','contents':{'first':_0xbb58('0xd7')}},'footer':{'height':_0xbb58('0xd8'),'contents':{'default':util[_0xbb58('0xbd')](_0xbb58('0xd9'),util['format']('%s\x20#%d','Sms',_0x3aec87['id']),moment()['format'](_0xbb58('0xda'))['toString']())}}};var _0x2d83d1={'channel':_0xbb58('0xdb'),'account':_0x3aec87[_0xbb58('0xd3')][_0xbb58('0x2c')],'agent':_0x3aec87['Owner']?_0x3aec87[_0xbb58('0xd4')][_0xbb58('0x2f')]:_0xbb58('0xdc'),'createdAt':moment(_0x3aec87[_0xbb58('0x76')])[_0xbb58('0xbd')](_0xbb58('0xdd'))[_0xbb58('0x93')](),'closedAt':_0x3aec87[_0xbb58('0xde')]?moment(_0x3aec87[_0xbb58('0xdf')])[_0xbb58('0xbd')](_0xbb58('0xdd'))['toString']():'','disposition':_0x3aec87[_0xbb58('0xe0')],'messages':_(_0x3aec87['Messages'])[_0xbb58('0xbb')]({'secret':![]})[_0xbb58('0x2e')](function(_0x400d28){return{'date':moment(_0x400d28['createdAt'])['format'](_0xbb58('0xdd'))[_0xbb58('0x93')](),'sender':_0x400d28[_0xbb58('0xd0')]==='out'?_0x400d28[_0xbb58('0xcd')]?_0x400d28[_0xbb58('0xcd')][_0xbb58('0x2f')]:_0xbb58('0xe1'):_0x400d28[_0xbb58('0x60')][_0xbb58('0xce')]+(_0x400d28[_0xbb58('0x60')][_0xbb58('0xcf')]?'\x20'+_0x400d28[_0xbb58('0x60')][_0xbb58('0xcf')]:''),'body':_0x400d28[_0xbb58('0x70')],'direction':_0x400d28[_0xbb58('0xd0')]===_0xbb58('0xe2')?'A':'C','secret':_0x400d28[_0xbb58('0xd1')],'read':_0x400d28[_0xbb58('0x7d')]};})[_0xbb58('0x5c')]()};return ejs[_0xbb58('0xe3')](path[_0xbb58('0xc7')](config['root'],_0xbb58('0xc9'),_0xbb58('0xe4'),_0xbb58('0xe5')),{'interaction':_0x2d83d1})[_0xbb58('0x27')](function(_0x1e568f){return new BPromise(function(_0xa2a796,_0x3444ee){pdf[_0xbb58('0xb3')](_0x1e568f,_0x4237aa)[_0xbb58('0xe6')](path[_0xbb58('0xc7')](_0x520662,_0xbb58('0xe7')+_0x3aec87['id']+'-'+_0x426144+_0xbb58('0xe8')),function(_0x5ab9d8,_0x4a3a0c){if(_0x5ab9d8)return _0x3444ee(_0x5ab9d8);_0xa2a796(_0x4a3a0c);});});})[_0xbb58('0x27')](function(){return new BPromise(function(_0x4cc939,_0x272bfe){zipdir(_0x520662,{'saveTo':_0x47c2ca},function(_0x2bff0d,_0x2d5bf4){if(_0x2bff0d)return _0x272bfe(_0x2bff0d);return _0x4cc939(_0x2d5bf4);});})[_0xbb58('0x27')](function(){return new BPromise(function(_0x5cc418,_0x8be3c7){rimraf(_0x520662,function(_0x13e815){if(_0x13e815)_0x8be3c7(_0x13e815);return _0x5cc418();});});})['then'](function(){return _0x3810f1[_0xbb58('0xc5')](_0x47c2ca,_0x2968e3,function(_0x123236){if(_0x123236){console[_0xbb58('0xe9')](_0xbb58('0xea'),_0x123236);}else{fs[_0xbb58('0xeb')](_0x47c2ca);}});});});}else{return _0x3810f1[_0xbb58('0x1d')](0xc8);}})[_0xbb58('0x35')](handleError(_0x3810f1,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index daf268c..9e477fd 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 _0x24ca=['remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','../../mysqldb','SmsMessage','save','update'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x24ca,0x1bc));var _0xa24c=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0x24ca[_0xf34b0a];return _0x5021e1;};'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 +var _0x6921=['exports','../../mysqldb','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x1ff7c5,_0x5c6e19){var _0x16fcdf=function(_0x34c8d7){while(--_0x34c8d7){_0x1ff7c5['push'](_0x1ff7c5['shift']());}};_0x16fcdf(++_0x5c6e19);}(_0x6921,0x1d1));var _0x1692=function(_0x180da6,_0x4cdee1){_0x180da6=_0x180da6-0x0;var _0xaba72c=_0x6921[_0x180da6];return _0xaba72c;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x1692('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x1692('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1692('0x1')](0x0);var events={'afterCreate':_0x1692('0x2'),'afterUpdate':'update','afterDestroy':_0x1692('0x3')};function emitEvent(_0x577497){return function(_0x4581c4,_0x39cc05,_0x15f20e){_0x4581c4[_0x1692('0x4')]({'attributes':['id'],'raw':!![]})[_0x1692('0x5')](function(_0x36d159){_0x4581c4[_0x1692('0x6')](_0x1692('0x7'),_0x36d159[_0x1692('0x8')](function(_0x38159b){return{'id':_0x38159b['id']};}));return SmsMessage[_0x1692('0x9')]({'where':{'SmsInteractionId':_0x4581c4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3dd25c){_0x4581c4['setDataValue'](_0x1692('0xa'),_0x3dd25c[_0x1692('0xb')]);SmsInteractionEvents[_0x1692('0xc')](_0x577497+':'+_0x4581c4['id'],_0x4581c4);SmsInteractionEvents[_0x1692('0xc')](_0x577497,_0x4581c4);_0x15f20e(null);})[_0x1692('0xd')](_0x15f20e(null));};}for(var e in events){if(events[_0x1692('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x1692('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2037d80..fa6214d 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 _0xa677=['SmsInteraction','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x375d74,_0x192737){var _0xee960b=function(_0x493c47){while(--_0x493c47){_0x375d74['push'](_0x375d74['shift']());}};_0xee960b(++_0x192737);}(_0xa677,0x1f1));var _0x7a67=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0xa677[_0x3598bb];return _0x13c837;};'use strict';var _=require(_0x7a67('0x0'));var util=require(_0x7a67('0x1'));var logger=require(_0x7a67('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7a67('0x3'));var rp=require(_0x7a67('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a67('0x5'));var config=require(_0x7a67('0x6'));var attributes=require(_0x7a67('0x7'));module[_0x7a67('0x8')]=function(_0x1e98f2,_0x581061){return _0x1e98f2[_0x7a67('0x9')](_0x7a67('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5831a1,_0x2fafd6,_0x2d92fc){if(_0x5831a1['changed']('closed')){_0x5831a1[_0x7a67('0xb')]=moment()['format'](_0x7a67('0xc'));}_0x2d92fc(null,_0x5831a1);}}});}; \ No newline at end of file +var _0x10df=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closedAt','format'];(function(_0x210acd,_0x5617de){var _0x9ae98a=function(_0x751aad){while(--_0x751aad){_0x210acd['push'](_0x210acd['shift']());}};_0x9ae98a(++_0x5617de);}(_0x10df,0xb1));var _0xf10d=function(_0x1cd585,_0x54276b){_0x1cd585=_0x1cd585-0x0;var _0x3ca87f=_0x10df[_0x1cd585];return _0x3ca87f;};'use strict';var _=require(_0xf10d('0x0'));var util=require(_0xf10d('0x1'));var logger=require(_0xf10d('0x2'))('api');var moment=require(_0xf10d('0x3'));var BPromise=require(_0xf10d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf10d('0x5'));var rimraf=require(_0xf10d('0x6'));var config=require(_0xf10d('0x7'));var attributes=require(_0xf10d('0x8'));module['exports']=function(_0x3d162d,_0x28bda9){return _0x3d162d[_0xf10d('0x9')](_0xf10d('0xa'),attributes,{'tableName':_0xf10d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe5226,_0x5803cf,_0x4c9c67){if(_0xe5226[_0xf10d('0xc')]('closed')){_0xe5226[_0xf10d('0xd')]=moment()[_0xf10d('0xe')](_0xf10d('0xf'));}_0x4c9c67(null,_0xe5226);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 92f2849..c17567e 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 _0x8b25=['register','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','limit','then','debug','find','where','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','./smsInteraction.socket'];(function(_0xf8d324,_0x5d969b){var _0x1fb044=function(_0x772f2d){while(--_0x772f2d){_0xf8d324['push'](_0xf8d324['shift']());}};_0x1fb044(++_0x5d969b);}(_0x8b25,0x85));var _0x58b2=function(_0x5cd236,_0x152c6d){_0x5cd236=_0x5cd236-0x0;var _0x1274c8=_0x8b25[_0x5cd236];return _0x1274c8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x58b2('0x0'));var BPromise=require(_0x58b2('0x1'));var rs=require(_0x58b2('0x2'));var fs=require('fs');var Redis=require(_0x58b2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x58b2('0x4'));var logger=require(_0x58b2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x58b2('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x58b2('0x7')]=_[_0x58b2('0x8')](config[_0x58b2('0x7')],{'host':_0x58b2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58b2('0x7')]));require(_0x58b2('0xa'))[_0x58b2('0xb')](socket);function respondWithRpcPromise(_0x30752a,_0x2c2e20,_0x146ec6){return new BPromise(function(_0x3248d8,_0x380124){return client['request'](_0x30752a,_0x146ec6)['then'](function(_0x164ac8){logger[_0x58b2('0xc')](_0x58b2('0xd'),_0x2c2e20,'request\x20sent');logger['debug'](_0x58b2('0xe'),_0x2c2e20,_0x58b2('0xf'),JSON[_0x58b2('0x10')](_0x164ac8));if(_0x164ac8[_0x58b2('0x11')]){if(_0x164ac8[_0x58b2('0x11')]['code']===0x1f4){logger[_0x58b2('0x11')](_0x58b2('0xd'),_0x2c2e20,_0x164ac8[_0x58b2('0x11')]['message']);return _0x380124(_0x164ac8['error'][_0x58b2('0x12')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2c2e20,_0x164ac8['error'][_0x58b2('0x12')]);return _0x3248d8(_0x164ac8[_0x58b2('0x11')][_0x58b2('0x12')]);}else{logger[_0x58b2('0xc')]('SmsInteraction,\x20%s,\x20%s',_0x2c2e20,_0x58b2('0xf'));_0x3248d8(_0x164ac8[_0x58b2('0x13')][_0x58b2('0x12')]);}})[_0x58b2('0x14')](function(_0x117104){logger[_0x58b2('0x11')](_0x58b2('0xd'),_0x2c2e20,_0x117104);_0x380124(_0x117104);});});}exports[_0x58b2('0x15')]=function(_0x168696){var _0x57ed29=this;return new Promise(function(_0x46ab82,_0x23393d){return db[_0x58b2('0x16')]['update'](_0x168696[_0x58b2('0x17')],{'raw':_0x168696[_0x58b2('0x18')]?_0x168696[_0x58b2('0x18')][_0x58b2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x168696['options']?_0x168696[_0x58b2('0x18')]['where']||null:null,'attributes':_0x168696[_0x58b2('0x18')]?_0x168696[_0x58b2('0x18')]['attributes']||null:null,'limit':_0x168696['options']?_0x168696[_0x58b2('0x18')][_0x58b2('0x1a')]||null:null})[_0x58b2('0x1b')](function(_0x33e51d){logger['info'](_0x58b2('0x15'),_0x168696);logger[_0x58b2('0x1c')](_0x58b2('0x15'),_0x168696,JSON[_0x58b2('0x10')](_0x33e51d));_0x46ab82(_0x33e51d);})[_0x58b2('0x14')](function(_0x13af43){logger[_0x58b2('0x11')]('UpdateSmsInteraction',_0x13af43[_0x58b2('0x12')],_0x168696);_0x23393d(_0x57ed29[_0x58b2('0x11')](0x1f4,_0x13af43[_0x58b2('0x12')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4b592b){return new Promise(function(_0x39cbcf,_0xee2d17){return db[_0x58b2('0x16')][_0x58b2('0x1d')]({'where':_0x4b592b[_0x58b2('0x18')]?_0x4b592b[_0x58b2('0x18')][_0x58b2('0x1e')]||null:null})[_0x58b2('0x1b')](function(_0x463ba3){if(_0x463ba3){return _0x463ba3[_0x58b2('0x1f')](_0x4b592b[_0x58b2('0x17')][_0x58b2('0x20')],_[_0x58b2('0x21')](_0x4b592b[_0x58b2('0x17')],['ids','id'])||{});}})[_0x58b2('0x22')](function(_0x260da8){logger[_0x58b2('0xc')]('AddTags',_0x4b592b);logger['debug']('AddTags',_0x4b592b,JSON[_0x58b2('0x10')](_0x260da8));_0x39cbcf(_0x260da8);})[_0x58b2('0x14')](function(_0x3b00be){logger[_0x58b2('0x11')](_0x58b2('0x23'),_0x3b00be['message'],_0x4b592b);_0xee2d17(_this[_0x58b2('0x11')](0x1f4,_0x3b00be['message']));});});}; \ No newline at end of file +var _0x97cc=['http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsInteraction','update','body','options','raw','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xe5041d,_0x2559a9){var _0x16cce7=function(_0x538a8d){while(--_0x538a8d){_0xe5041d['push'](_0xe5041d['shift']());}};_0x16cce7(++_0x2559a9);}(_0x97cc,0x1e4));var _0xc97c=function(_0x21b7ec,_0x446c89){_0x21b7ec=_0x21b7ec-0x0;var _0x5a2909=_0x97cc[_0x21b7ec];return _0x5a2909;};'use strict';var _=require('lodash');var util=require(_0xc97c('0x0'));var moment=require('moment');var BPromise=require(_0xc97c('0x1'));var rs=require(_0xc97c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc97c('0x3'))['db'];var utils=require(_0xc97c('0x4'));var logger=require(_0xc97c('0x5'))('rpc');var config=require(_0xc97c('0x6'));var jayson=require(_0xc97c('0x7'));var client=jayson['client'][_0xc97c('0x8')]({'port':0x232a});config[_0xc97c('0x9')]=_['defaults'](config[_0xc97c('0x9')],{'host':_0xc97c('0xa'),'port':0x18eb});var socket=require(_0xc97c('0xb'))(new Redis(config['redis']));require(_0xc97c('0xc'))[_0xc97c('0xd')](socket);function respondWithRpcPromise(_0x294059,_0x55d478,_0x5765e2){return new BPromise(function(_0x27d770,_0x1b03a1){return client[_0xc97c('0xe')](_0x294059,_0x5765e2)[_0xc97c('0xf')](function(_0x26e58e){logger[_0xc97c('0x10')](_0xc97c('0x11'),_0x55d478,_0xc97c('0x12'));logger[_0xc97c('0x13')](_0xc97c('0x14'),_0x55d478,_0xc97c('0x12'),JSON[_0xc97c('0x15')](_0x26e58e));if(_0x26e58e[_0xc97c('0x16')]){if(_0x26e58e[_0xc97c('0x16')][_0xc97c('0x17')]===0x1f4){logger[_0xc97c('0x16')](_0xc97c('0x11'),_0x55d478,_0x26e58e['error']['message']);return _0x1b03a1(_0x26e58e[_0xc97c('0x16')][_0xc97c('0x18')]);}logger[_0xc97c('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x55d478,_0x26e58e[_0xc97c('0x16')]['message']);return _0x27d770(_0x26e58e[_0xc97c('0x16')]['message']);}else{logger[_0xc97c('0x10')](_0xc97c('0x11'),_0x55d478,_0xc97c('0x12'));_0x27d770(_0x26e58e[_0xc97c('0x19')][_0xc97c('0x18')]);}})[_0xc97c('0x1a')](function(_0x4797f8){logger[_0xc97c('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x55d478,_0x4797f8);_0x1b03a1(_0x4797f8);});});}exports['UpdateSmsInteraction']=function(_0x204212){var _0x968c2b=this;return new Promise(function(_0x5587f0,_0x49b88b){return db[_0xc97c('0x1b')][_0xc97c('0x1c')](_0x204212[_0xc97c('0x1d')],{'raw':_0x204212[_0xc97c('0x1e')]?_0x204212[_0xc97c('0x1e')][_0xc97c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x204212[_0xc97c('0x1e')]?_0x204212[_0xc97c('0x1e')][_0xc97c('0x20')]||null:null,'attributes':_0x204212[_0xc97c('0x1e')]?_0x204212['options']['attributes']||null:null,'limit':_0x204212[_0xc97c('0x1e')]?_0x204212[_0xc97c('0x1e')][_0xc97c('0x21')]||null:null})[_0xc97c('0xf')](function(_0x440fbd){logger[_0xc97c('0x10')](_0xc97c('0x22'),_0x204212);logger['debug'](_0xc97c('0x22'),_0x204212,JSON['stringify'](_0x440fbd));_0x5587f0(_0x440fbd);})[_0xc97c('0x1a')](function(_0x50e107){logger[_0xc97c('0x16')](_0xc97c('0x22'),_0x50e107[_0xc97c('0x18')],_0x204212);_0x49b88b(_0x968c2b['error'](0x1f4,_0x50e107[_0xc97c('0x18')]));});});};exports[_0xc97c('0x23')]=function(_0x20216d){return new Promise(function(_0x1fa28c,_0x4bd23d){return db[_0xc97c('0x1b')][_0xc97c('0x24')]({'where':_0x20216d[_0xc97c('0x1e')]?_0x20216d[_0xc97c('0x1e')][_0xc97c('0x20')]||null:null})['then'](function(_0x45eeca){if(_0x45eeca){return _0x45eeca[_0xc97c('0x25')](_0x20216d[_0xc97c('0x1d')]['ids'],_['omit'](_0x20216d['body'],[_0xc97c('0x26'),'id'])||{});}})[_0xc97c('0x27')](function(_0x4eb0e0){logger[_0xc97c('0x10')](_0xc97c('0x28'),_0x20216d);logger[_0xc97c('0x13')]('AddTags',_0x20216d,JSON[_0xc97c('0x15')](_0x4eb0e0));_0x1fa28c(_0x4eb0e0);})[_0xc97c('0x1a')](function(_0x2b35b0){logger[_0xc97c('0x16')](_0xc97c('0x28'),_0x2b35b0[_0xc97c('0x18')],_0x20216d);_0x4bd23d(_this[_0xc97c('0x16')](0x1f4,_0x2b35b0[_0xc97c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 3628d5b..558bdea 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 _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0x54e4c6,_0x2568d8){var _0x16e08d=function(_0x18642b){while(--_0x18642b){_0x54e4c6['push'](_0x54e4c6['shift']());}};_0x16e08d(++_0x2568d8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0x0b0e[_0x4843f9];return _0x193c6a;};'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 +var _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0x2f53bd,_0x3fcfcb){var _0x295808=function(_0x26dbc2){while(--_0x26dbc2){_0x2f53bd['push'](_0x2f53bd['shift']());}};_0x295808(++_0x3fcfcb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 665450b..2024053 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 _0xb859=['accept','delete','destroy','exports','path','express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','put','update'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xb859,0x17b));var _0x9b85=function(_0x1f8f66,_0x5dc25a){_0x1f8f66=_0x1f8f66-0x0;var _0x3b992d=_0xb859[_0x1f8f66];return _0x3b992d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9b85('0x0'));var timeout=require('connect-timeout');var express=require(_0x9b85('0x1'));var router=express[_0x9b85('0x2')]();var auth=require(_0x9b85('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9b85('0x4'));var controller=require(_0x9b85('0x5'));router[_0x9b85('0x6')]('/',auth[_0x9b85('0x7')](),controller[_0x9b85('0x8')]);router[_0x9b85('0x6')](_0x9b85('0x9'),auth[_0x9b85('0x7')](),controller[_0x9b85('0xa')]);router[_0x9b85('0x6')](_0x9b85('0xb'),auth['isAuthenticated'](),controller[_0x9b85('0xc')]);router['post']('/',auth[_0x9b85('0x7')](),interaction[_0x9b85('0xd')](_0x9b85('0xe'),_0x9b85('0xf')),controller[_0x9b85('0x10')]);router[_0x9b85('0x11')](_0x9b85('0x12'),controller['status']);router[_0x9b85('0x13')]('/:id',auth[_0x9b85('0x7')](),controller[_0x9b85('0x14')]);router[_0x9b85('0x13')]('/:id/accept',auth[_0x9b85('0x7')](),controller[_0x9b85('0x15')]);router[_0x9b85('0x13')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x9b85('0x16')](_0x9b85('0xb'),auth[_0x9b85('0x7')](),controller[_0x9b85('0x17')]);module[_0x9b85('0x18')]=router; \ No newline at end of file +var _0x9c0e=['/describe','describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index'];(function(_0x565989,_0x3f31f0){var _0xa5b3e7=function(_0x3dd797){while(--_0x3dd797){_0x565989['push'](_0x565989['shift']());}};_0xa5b3e7(++_0x3f31f0);}(_0x9c0e,0x16d));var _0xe9c0=function(_0x3a03e2,_0x9d46f7){_0x3a03e2=_0x3a03e2-0x0;var _0x557b6c=_0x9c0e[_0x3a03e2];return _0x557b6c;};'use strict';var multer=require(_0xe9c0('0x0'));var util=require(_0xe9c0('0x1'));var path=require(_0xe9c0('0x2'));var timeout=require(_0xe9c0('0x3'));var express=require('express');var router=express[_0xe9c0('0x4')]();var auth=require(_0xe9c0('0x5'));var interaction=require(_0xe9c0('0x6'));var config=require(_0xe9c0('0x7'));var controller=require(_0xe9c0('0x8'));router[_0xe9c0('0x9')]('/',auth[_0xe9c0('0xa')](),controller[_0xe9c0('0xb')]);router[_0xe9c0('0x9')](_0xe9c0('0xc'),auth['isAuthenticated'](),controller[_0xe9c0('0xd')]);router['get']('/:id',auth[_0xe9c0('0xa')](),controller[_0xe9c0('0xe')]);router[_0xe9c0('0xf')]('/',auth[_0xe9c0('0xa')](),interaction[_0xe9c0('0x10')](_0xe9c0('0x11'),_0xe9c0('0x12')),controller[_0xe9c0('0x13')]);router['post'](_0xe9c0('0x14'),controller[_0xe9c0('0x15')]);router[_0xe9c0('0x16')](_0xe9c0('0x17'),auth[_0xe9c0('0xa')](),controller['update']);router['put'](_0xe9c0('0x18'),auth[_0xe9c0('0xa')](),controller[_0xe9c0('0x19')]);router[_0xe9c0('0x16')](_0xe9c0('0x1a'),auth[_0xe9c0('0xa')](),controller['reject']);router[_0xe9c0('0x1b')](_0xe9c0('0x17'),auth['isAuthenticated'](),controller[_0xe9c0('0x1c')]);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 6621dd9..64ba2f8 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 _0x1961=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0xf62e6c,_0x160938){var _0x14234f=function(_0x16fe1d){while(--_0x16fe1d){_0xf62e6c['push'](_0xf62e6c['shift']());}};_0x14234f(++_0x160938);}(_0x1961,0x10c));var _0x1196=function(_0x28069a,_0x1113d8){_0x28069a=_0x28069a-0x0;var _0x41adc6=_0x1961[_0x28069a];return _0x41adc6;};'use strict';var Sequelize=require(_0x1196('0x0'));module[_0x1196('0x1')]={'body':{'type':Sequelize[_0x1196('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1196('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1196('0x4')]('in',_0x1196('0x5')),'defaultValue':_0x1196('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x1196('0x6')]},'readAt':{'type':Sequelize[_0x1196('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8150=['ENUM','out','STRING','medium','BOOLEAN'];(function(_0x37d9e3,_0x21943b){var _0x312890=function(_0x3ab969){while(--_0x3ab969){_0x37d9e3['push'](_0x37d9e3['shift']());}};_0x312890(++_0x21943b);}(_0x8150,0x1a7));var _0x0815=function(_0x3aecba,_0x23332f){_0x3aecba=_0x3aecba-0x0;var _0x4a07ac=_0x8150[_0x3aecba];return _0x4a07ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x0815('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x0815('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0815('0x2')]('in',_0x0815('0x3')),'defaultValue':_0x0815('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x0815('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0815('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index bd83398..4d541b8 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 _0x135b=['format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','message','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','Status','infobip','results','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','lodash','squel','crypto','jsforce','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','localhost','socket.io-emitter','register','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','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','sms-interactions','accept','sms'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x135b,0xaf));var _0xb135=function(_0x5285d0,_0x3d424c){_0x5285d0=_0x5285d0-0x0;var _0x4dd0a2=_0x135b[_0x5285d0];return _0x4dd0a2;};'use strict';var pdf=require(_0xb135('0x0'));var emlformat=require(_0xb135('0x1'));var rimraf=require(_0xb135('0x2'));var zipdir=require(_0xb135('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb135('0x4'));var moment=require(_0xb135('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb135('0x6'));var util=require(_0xb135('0x7'));var path=require(_0xb135('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb135('0x9'));var squel=require(_0xb135('0xa'));var crypto=require(_0xb135('0xb'));var jsforce=require(_0xb135('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb135('0xd'));var querystring=require(_0xb135('0xe'));var Papa=require(_0xb135('0xf'));var Redis=require(_0xb135('0x10'));var authService=require(_0xb135('0x11'));var qs=require(_0xb135('0x12'));var as=require(_0xb135('0x13'));var hardwareService=require(_0xb135('0x14'));var logger=require(_0xb135('0x15'))(_0xb135('0x16'));var utils=require(_0xb135('0x17'));var config=require(_0xb135('0x18'));var db=require(_0xb135('0x19'))['db'];config[_0xb135('0x1a')]=_[_0xb135('0x1b')](config[_0xb135('0x1a')],{'host':_0xb135('0x1c'),'port':0x18eb});var socket=require(_0xb135('0x1d'))(new Redis(config[_0xb135('0x1a')]));require('./smsMessage.socket')[_0xb135('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb135('0x1f')][_0xb135('0x20')]({'port':0x232c});var client9002=jayson[_0xb135('0x1f')][_0xb135('0x20')]({'port':0x232a});function checkPasswordPattern(_0x37f3f2,_0x28b9d3,_0x385704){if(_0x385704){var _0x35950d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35950d[_0xb135('0x21')](_0x28b9d3)){return _0x37f3f2;}else{throw new db['Sequelize'][(_0xb135('0x22'))](_0xb135('0x23'));}}else{return _0x37f3f2;}}function respondWithRpcPromise(_0x45c4ae,_0x51b18f,_0x5d9010,_0x2975bf){return new BPromise(function(_0x47d9ef,_0x9530ac){var _0x282dee=_0x2975bf||client;return _0x282dee[_0xb135('0x24')](_0x45c4ae,_0x5d9010)[_0xb135('0x25')](function(_0xc8a99){logger[_0xb135('0x26')](_0xb135('0x27'),_0x51b18f,_0xb135('0x28'));logger[_0xb135('0x29')](_0xb135('0x2a'),_0x51b18f,'request\x20sent',JSON[_0xb135('0x2b')](_0xc8a99));if(_0xc8a99['error']){if(_0xc8a99[_0xb135('0x2c')]['code']===0x1f4){logger[_0xb135('0x2c')]('SmsMessage,\x20%s,\x20%s',_0x51b18f,_0xc8a99['error']['message']);return _0x9530ac(_0xc8a99['error']['message']);}logger['error'](_0xb135('0x27'),_0x51b18f,_0xc8a99[_0xb135('0x2c')]['message']);return _0x47d9ef(_0xc8a99[_0xb135('0x2c')]['message']);}else{logger['info'](_0xb135('0x27'),_0x51b18f,'request\x20sent');_0x47d9ef(_0xc8a99['result']['message']);}})['catch'](function(_0x35cd29){logger[_0xb135('0x2c')](_0xb135('0x27'),_0x51b18f,_0x35cd29);_0x9530ac(_0x35cd29);});});}function respondWithStatusCode(_0x2d1389,_0x11d086){_0x11d086=_0x11d086||0xcc;return function(_0x1da1f3){if(_0x1da1f3){return _0x2d1389[_0xb135('0x2d')](_0x11d086);}return _0x2d1389[_0xb135('0x2e')](_0x11d086)[_0xb135('0x2f')]();};}function respondWithResult(_0x565e84,_0x5c8de4){_0x5c8de4=_0x5c8de4||0xc8;return function(_0x16f4f6){if(_0x16f4f6){return _0x565e84[_0xb135('0x2e')](_0x5c8de4)[_0xb135('0x30')](_0x16f4f6);}};}function respondWithFilteredResult(_0x1d33cb,_0x4d3ebd){return function(_0x322ed1){if(_0x322ed1){var _0x2d521c=_0x322ed1[_0xb135('0x31')],_0x30fc67=_0x4d3ebd[_0xb135('0x32')],_0x4f88c1=_0x4d3ebd['offset']+_0x4d3ebd['limit'],_0x28eed8;if(_0x4f88c1>=_0x2d521c){_0x4f88c1=_0x2d521c;_0x28eed8=0xc8;}else{_0x28eed8=0xce;}_0x1d33cb[_0xb135('0x2e')](_0x28eed8);return _0x1d33cb[_0xb135('0x33')](_0xb135('0x34'),_0x30fc67+'-'+_0x4f88c1+'/'+_0x2d521c)[_0xb135('0x30')](_0x322ed1);}return null;};}function patchUpdates(_0x576657){return function(_0xdaebcb){try{jsonpatch[_0xb135('0x35')](_0xdaebcb,_0x576657,!![]);}catch(_0x4470ee){return BPromise[_0xb135('0x36')](_0x4470ee);}return _0xdaebcb['save']();};}function saveUpdates(_0x2a0692,_0x28bfe9){return function(_0x292376){if(_0x292376){return _0x292376[_0xb135('0x37')](_0x2a0692)['then'](function(_0x4ff221){return _0x4ff221;});}return null;};}function removeEntity(_0xd467f9,_0x211aac){return function(_0x2559b8){if(_0x2559b8){return _0x2559b8[_0xb135('0x38')]()[_0xb135('0x25')](function(){_0xd467f9[_0xb135('0x2e')](0xcc)[_0xb135('0x2f')]();});}};}function handleEntityNotFound(_0x177d13,_0x4c8b24){return function(_0x5d8256){if(!_0x5d8256){_0x177d13[_0xb135('0x2d')](0x194);}return _0x5d8256;};}function handleError(_0x1e878c,_0x49feff){_0x49feff=_0x49feff||0x1f4;return function(_0x20d2de){logger[_0xb135('0x2c')](_0x20d2de['stack']);if(_0x20d2de[_0xb135('0x39')]){delete _0x20d2de[_0xb135('0x39')];}_0x1e878c[_0xb135('0x2e')](_0x49feff)[_0xb135('0x3a')](_0x20d2de);};}exports[_0xb135('0x3b')]=function(_0x21462a,_0x4cf68f){var _0x59bfc5={},_0x477a5a={},_0xce7d76={'count':0x0,'rows':[]};var _0x1c6e05=_[_0xb135('0x3c')](db[_0xb135('0x3d')][_0xb135('0x3e')],function(_0x305f8d){return{'name':_0x305f8d[_0xb135('0x3f')],'type':_0x305f8d['type'][_0xb135('0x40')]};});_0x477a5a['model']=_[_0xb135('0x3c')](_0x1c6e05,_0xb135('0x39'));_0x477a5a[_0xb135('0x41')]=_[_0xb135('0x42')](_0x21462a[_0xb135('0x41')]);_0x477a5a[_0xb135('0x43')]=_['intersection'](_0x477a5a[_0xb135('0x44')],_0x477a5a[_0xb135('0x41')]);_0x59bfc5[_0xb135('0x45')]=_[_0xb135('0x46')](_0x477a5a[_0xb135('0x44')],qs[_0xb135('0x47')](_0x21462a[_0xb135('0x41')][_0xb135('0x47')]));_0x59bfc5[_0xb135('0x45')]=_0x59bfc5['attributes'][_0xb135('0x48')]?_0x59bfc5['attributes']:_0x477a5a[_0xb135('0x44')];if(!_0x21462a[_0xb135('0x41')][_0xb135('0x49')]('nolimit')){_0x59bfc5[_0xb135('0x4a')]=qs[_0xb135('0x4a')](_0x21462a['query'][_0xb135('0x4a')]);_0x59bfc5[_0xb135('0x32')]=qs[_0xb135('0x32')](_0x21462a['query']['offset']);}_0x59bfc5['order']=qs[_0xb135('0x4b')](_0x21462a[_0xb135('0x41')][_0xb135('0x4b')]);_0x59bfc5[_0xb135('0x4c')]=qs[_0xb135('0x43')](_[_0xb135('0x4d')](_0x21462a[_0xb135('0x41')],_0x477a5a[_0xb135('0x43')]),_0x1c6e05);if(_0x21462a['query'][_0xb135('0x4e')]){_0x59bfc5[_0xb135('0x4c')]=_[_0xb135('0x4f')](_0x59bfc5[_0xb135('0x4c')],{'$or':_['map'](_0x1c6e05,function(_0x2d3928){if(_0x2d3928[_0xb135('0x50')]!=='VIRTUAL'){var _0x57c31c={};_0x57c31c[_0x2d3928[_0xb135('0x39')]]={'$like':'%'+_0x21462a[_0xb135('0x41')][_0xb135('0x4e')]+'%'};return _0x57c31c;}})});}_0x59bfc5=_[_0xb135('0x4f')]({},_0x59bfc5,_0x21462a[_0xb135('0x51')]);var _0xcf1691={'where':_0x59bfc5[_0xb135('0x4c')]};return db[_0xb135('0x3d')][_0xb135('0x31')](_0xcf1691)[_0xb135('0x25')](function(_0x3b6a1d){_0xce7d76[_0xb135('0x31')]=_0x3b6a1d;if(_0x21462a[_0xb135('0x41')][_0xb135('0x52')]){_0x59bfc5[_0xb135('0x53')]=[{'all':!![]}];}return db[_0xb135('0x3d')][_0xb135('0x54')](_0x59bfc5);})[_0xb135('0x25')](function(_0x271bfc){_0xce7d76[_0xb135('0x55')]=_0x271bfc;return _0xce7d76;})[_0xb135('0x25')](respondWithFilteredResult(_0x4cf68f,_0x59bfc5))[_0xb135('0x56')](handleError(_0x4cf68f,null));};exports['show']=function(_0x3b2105,_0x1ebacc){var _0x13e657={'raw':!![],'where':{'id':_0x3b2105['params']['id']}},_0x4dce80={};_0x4dce80[_0xb135('0x44')]=_[_0xb135('0x42')](db['SmsMessage'][_0xb135('0x3e')]);_0x4dce80[_0xb135('0x41')]=_[_0xb135('0x42')](_0x3b2105[_0xb135('0x41')]);_0x4dce80[_0xb135('0x43')]=_[_0xb135('0x46')](_0x4dce80[_0xb135('0x44')],_0x4dce80['query']);_0x13e657[_0xb135('0x45')]=_[_0xb135('0x46')](_0x4dce80[_0xb135('0x44')],qs[_0xb135('0x47')](_0x3b2105['query'][_0xb135('0x47')]));_0x13e657[_0xb135('0x45')]=_0x13e657[_0xb135('0x45')][_0xb135('0x48')]?_0x13e657[_0xb135('0x45')]:_0x4dce80[_0xb135('0x44')];if(_0x3b2105[_0xb135('0x41')]['includeAll']){_0x13e657[_0xb135('0x53')]=[{'all':!![]}];}_0x13e657=_[_0xb135('0x4f')]({},_0x13e657,_0x3b2105[_0xb135('0x51')]);return db[_0xb135('0x3d')][_0xb135('0x57')](_0x13e657)[_0xb135('0x25')](handleEntityNotFound(_0x1ebacc,null))[_0xb135('0x25')](respondWithResult(_0x1ebacc,null))[_0xb135('0x56')](handleError(_0x1ebacc,null));};exports[_0xb135('0x58')]=function(_0x1fe5c7,_0x2f7647){return db[_0xb135('0x3d')][_0xb135('0x58')](_0x1fe5c7[_0xb135('0x59')],{})[_0xb135('0x25')](respondWithResult(_0x2f7647,0xc9))[_0xb135('0x56')](handleError(_0x2f7647,null));};exports[_0xb135('0x37')]=function(_0x595107,_0x49c5b6){if(_0x595107[_0xb135('0x59')]['id']){delete _0x595107[_0xb135('0x59')]['id'];}return db[_0xb135('0x3d')][_0xb135('0x57')]({'where':{'id':_0x595107['params']['id']}})[_0xb135('0x25')](handleEntityNotFound(_0x49c5b6,null))[_0xb135('0x25')](saveUpdates(_0x595107[_0xb135('0x59')],null))[_0xb135('0x25')](respondWithResult(_0x49c5b6,null))[_0xb135('0x56')](handleError(_0x49c5b6,null));};exports['destroy']=function(_0x4526d5,_0xb66fe5){return db[_0xb135('0x3d')][_0xb135('0x57')]({'where':{'id':_0x4526d5[_0xb135('0x5a')]['id']}})['then'](handleEntityNotFound(_0xb66fe5,null))[_0xb135('0x25')](removeEntity(_0xb66fe5,null))[_0xb135('0x56')](handleError(_0xb66fe5,null));};exports[_0xb135('0x5b')]=function(_0x15f7e7,_0x3d584a){return db[_0xb135('0x3d')][_0xb135('0x5b')]()[_0xb135('0x25')](respondWithResult(_0x3d584a,null))['catch'](handleError(_0x3d584a,null));};var interaction_log=require(_0xb135('0x15'))(_0xb135('0x5c'));exports[_0xb135('0x5d')]=function(_0x194330,_0x3e5ff2,_0x48a360){var _0x3b09cd={'channel':_0xb135('0x5e')};if(_0x194330[_0xb135('0x59')]['id']){delete _0x194330[_0xb135('0x59')]['id'];}_0x194330[_0xb135('0x59')]['read']=!![];_0x194330[_0xb135('0x59')]['readAt']=moment()[_0xb135('0x5f')](_0xb135('0x60'));_0x194330[_0xb135('0x59')][_0xb135('0x61')]=_0x194330[_0xb135('0x59')]['UserId']||_0x194330[_0xb135('0x62')]['id'];return db[_0xb135('0x3d')][_0xb135('0x57')]({'where':{'id':_0x194330[_0xb135('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0xb135('0x63')],'as':'Contact'}]})[_0xb135('0x25')](handleEntityNotFound(_0x3e5ff2,null))[_0xb135('0x25')](saveUpdates(_0x194330['body'],null))[_0xb135('0x25')](function(_0x1d86bf){if(_0x1d86bf){_0x3b09cd[_0xb135('0x64')]=_0x1d86bf[_0xb135('0x65')]({'plain':!![]});return db[_0xb135('0x66')][_0xb135('0x57')]({'where':{'id':_0x1d86bf[_0xb135('0x67')]}});}return null;})[_0xb135('0x25')](handleEntityNotFound(_0x3e5ff2,null))['then'](function(_0x4404f3){if(_0x4404f3){return _0x4404f3[_0xb135('0x37')]({'UserId':_0x194330[_0xb135('0x59')]['UserId'],'read1stAt':_[_0xb135('0x68')](_0x4404f3[_0xb135('0x69')])?moment()[_0xb135('0x5f')](_0xb135('0x60')):undefined});}return null;})[_0xb135('0x25')](function(_0x55045c){if(_0x55045c){_0x3b09cd[_0xb135('0x6a')]=_0x55045c[_0xb135('0x65')]({'plain':!![]});interaction_log[_0xb135('0x26')](_0xb135('0x6b'),_0x194330[_0xb135('0x62')]['id'],_0x194330[_0xb135('0x62')][_0xb135('0x39')],_0x194330[_0xb135('0x62')][_0xb135('0x6c')],_0x3b09cd[_0xb135('0x6a')]['id'],_0x194330[_0xb135('0x59')]?JSON[_0xb135('0x2b')](_0x194330[_0xb135('0x59')]):_0xb135('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xb135('0x6e'),_0x3b09cd);}return null;})[_0xb135('0x25')](function(_0x1360ff){if(_0x1360ff){if(_0x194330['body'][_0xb135('0x6f')]){_0x3b09cd[_0xb135('0x64')][_0xb135('0x70')]=util['format'](_0xb135('0x71'),_0x194330['user'][_0xb135('0x39')]);_0x3b09cd[_0xb135('0x64')]['channel']=_0x3b09cd[_0xb135('0x72')];_0x3b09cd[_0xb135('0x64')][_0xb135('0x73')]=_0xb135('0x5d');return respondWithRpcPromise('EventManager',_0xb135('0x74'),{'event':_0xb135('0x75'),'message':_0x3b09cd[_0xb135('0x64')]},client9002)['then'](function(){return _0x3b09cd;});}return _0x3b09cd;}return null;})['then'](respondWithResult(_0x3e5ff2,null))[_0xb135('0x56')](handleError(_0x3e5ff2,null));};var interaction_log=require(_0xb135('0x15'))(_0xb135('0x5c'));exports[_0xb135('0x36')]=function(_0x2ff001,_0x344574,_0x22d256){var _0x3faa95={'agent':{},'channel':_0xb135('0x5e')};if(_0x2ff001[_0xb135('0x59')]['id']){delete _0x2ff001[_0xb135('0x59')]['id'];}_0x2ff001[_0xb135('0x59')][_0xb135('0x61')]=_0x2ff001[_0xb135('0x59')][_0xb135('0x61')]||_0x2ff001[_0xb135('0x62')]['id'];_0x3faa95['agent']['id']=_0x2ff001[_0xb135('0x59')][_0xb135('0x61')];return db[_0xb135('0x3d')][_0xb135('0x57')]({'where':{'id':_0x2ff001[_0xb135('0x5a')]['id'],'UserId':null}})[_0xb135('0x25')](handleEntityNotFound(_0x344574,null))[_0xb135('0x25')](function(_0x17bb99){if(_0x17bb99){_0x3faa95['message']=_0x17bb99[_0xb135('0x65')]({'plain':!![]});return db[_0xb135('0x66')][_0xb135('0x57')]({'where':{'id':_0x17bb99['SmsInteractionId']}});}return null;})[_0xb135('0x25')](handleEntityNotFound(_0x344574,null))[_0xb135('0x25')](function(_0x53f6cf){if(_0x53f6cf){_0x3faa95[_0xb135('0x6a')]=_0x53f6cf['get']({'plain':!![]});interaction_log[_0xb135('0x26')](_0xb135('0x76'),_0x2ff001['user']['id'],_0x2ff001[_0xb135('0x62')][_0xb135('0x39')],_0x2ff001[_0xb135('0x62')]['role'],_0x3faa95['interaction']['id'],_0x2ff001[_0xb135('0x59')]?JSON[_0xb135('0x2b')](_0x2ff001[_0xb135('0x59')]):_0xb135('0x6d'));return respondWithRpcPromise(_0xb135('0x77'),_0xb135('0x78'),_0x3faa95);}return null;})['then'](function(_0x1e603f){if(_0x1e603f){_0x1e603f[_0xb135('0x64')][_0xb135('0x70')]=util[_0xb135('0x5f')](_0xb135('0x71'),_0x2ff001[_0xb135('0x62')][_0xb135('0x39')]);_0x1e603f['message'][_0xb135('0x72')]=_0x3faa95[_0xb135('0x72')];_0x1e603f[_0xb135('0x64')][_0xb135('0x73')]=_0xb135('0x36');respondWithRpcPromise(_0xb135('0x74'),_0xb135('0x74'),{'event':_0xb135('0x79'),'message':_0x1e603f[_0xb135('0x64')]},client9002);return _0x3faa95;}return null;})[_0xb135('0x25')](respondWithResult(_0x344574,null))[_0xb135('0x56')](handleError(_0x344574,null));};exports['status']=function(_0x35a55d,_0x2e10d2,_0x2348fb){if(_0x35a55d['body']['id']){delete _0x35a55d['body']['id'];}var _0x51806a;return db[_0xb135('0x3d')]['find']({'where':{'id':_0x35a55d[_0xb135('0x5a')]['id']}})[_0xb135('0x25')](handleEntityNotFound(_0x2e10d2,null))[_0xb135('0x25')](function(_0x50d57c){if(_0x50d57c){_0x51806a=_0x50d57c;return db['SmsAccount'][_0xb135('0x57')]({'where':{'id':_0x50d57c[_0xb135('0x7a')]}});}})['then'](handleEntityNotFound(_0x2e10d2,null))[_0xb135('0x25')](function(_0x2824bc){if(_0x2824bc){logger[_0xb135('0x29')](_0xb135('0x2a'),_0xb135('0x2e'),'received\x20delivery\x20report\x20from',_0x2824bc[_0xb135('0x50')],util[_0xb135('0x7b')](_0x35a55d['body'],{'showHidden':![],'depth':null}));switch(_0x2824bc['type']){case _0xb135('0x7c'):if(_0x35a55d['body'][_0xb135('0x7d')]&&_0x35a55d[_0xb135('0x59')][_0xb135('0x7d')]===_0x51806a[_0xb135('0x7e')]){return _0x51806a[_0xb135('0x37')]({'read':!![]});}else{logger[_0xb135('0x2c')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb135('0x2e'),'twilio',util[_0xb135('0x7b')](_0x35a55d[_0xb135('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb135('0x7f'):if(_0x35a55d[_0xb135('0x59')]['MessageUUID']&&_0x35a55d[_0xb135('0x59')][_0xb135('0x80')]===_0x51806a[_0xb135('0x7e')]&&_[_0xb135('0x81')](['sent','delivered'],_0x35a55d[_0xb135('0x59')][_0xb135('0x82')])>=0x0){return _0x51806a[_0xb135('0x37')]({'read':!![]});}else{logger[_0xb135('0x2c')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','plivio',util[_0xb135('0x7b')](_0x35a55d[_0xb135('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb135('0x83'):var _0x1de3f8=_0x35a55d[_0xb135('0x59')][_0xb135('0x84')][0x0];if(_0x1de3f8['status']['groupName']===_0xb135('0x85')){return _0x51806a[_0xb135('0x37')]({'read':!![]});}else{logger[_0xb135('0x2c')](_0xb135('0x86'),_0xb135('0x2e'),'infobip',util[_0xb135('0x7b')](_0x35a55d['body'],{'showHidden':![],'depth':null}));}break;}return _0x51806a;}})[_0xb135('0x25')](respondWithResult(_0x2e10d2,null))[_0xb135('0x56')](handleError(_0x2e10d2,null));}; \ No newline at end of file +var _0xee11=['read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteractionId','isNil','read1stAt','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','interface','channel','event','EventManager','acceptmessage','reject','sms','agent','SmsInteraction','interaction','RejectMessage','rejectMessage','SIP/%s','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','DELIVERED','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.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~!@#$%^&-_=+[{]}.','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','count','offset','limit','Content-Range','save','update','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','destroy','describe','sms-interactions','accept'];(function(_0x2a9363,_0x1d9f52){var _0x3480dd=function(_0x26efc8){while(--_0x26efc8){_0x2a9363['push'](_0x2a9363['shift']());}};_0x3480dd(++_0x1d9f52);}(_0xee11,0x146));var _0x1ee1=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0xee11[_0x5c6299];return _0x23b564;};'use strict';var pdf=require(_0x1ee1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1ee1('0x1'));var jsonpatch=require(_0x1ee1('0x2'));var rp=require(_0x1ee1('0x3'));var moment=require(_0x1ee1('0x4'));var BPromise=require(_0x1ee1('0x5'));var Mustache=require(_0x1ee1('0x6'));var util=require(_0x1ee1('0x7'));var path=require(_0x1ee1('0x8'));var sox=require('sox');var csv=require(_0x1ee1('0x9'));var ejs=require(_0x1ee1('0xa'));var fs=require('fs');var _=require(_0x1ee1('0xb'));var squel=require(_0x1ee1('0xc'));var crypto=require(_0x1ee1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1ee1('0x9'));var querystring=require(_0x1ee1('0xe'));var Papa=require(_0x1ee1('0xf'));var Redis=require(_0x1ee1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1ee1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ee1('0x12'));var logger=require(_0x1ee1('0x13'))(_0x1ee1('0x14'));var utils=require(_0x1ee1('0x15'));var config=require('../../config/environment');var db=require(_0x1ee1('0x16'))['db'];config[_0x1ee1('0x17')]=_['defaults'](config[_0x1ee1('0x17')],{'host':_0x1ee1('0x18'),'port':0x18eb});var socket=require(_0x1ee1('0x19'))(new Redis(config[_0x1ee1('0x17')]));require(_0x1ee1('0x1a'))[_0x1ee1('0x1b')](socket);var jayson=require(_0x1ee1('0x1c'));var client=jayson[_0x1ee1('0x1d')][_0x1ee1('0x1e')]({'port':0x232c});var client9002=jayson[_0x1ee1('0x1d')][_0x1ee1('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x443dff,_0x3c64f1,_0x3a19db){if(_0x3a19db){var _0x4828ba=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4828ba['test'](_0x3c64f1)){return _0x443dff;}else{throw new db[(_0x1ee1('0x1f'))][(_0x1ee1('0x20'))](_0x1ee1('0x21'));}}else{return _0x443dff;}}function respondWithRpcPromise(_0x2752ba,_0x1e18b9,_0xff3d76,_0x55abff){return new BPromise(function(_0x39229e,_0x3c97aa){var _0x5c380f=_0x55abff||client;return _0x5c380f[_0x1ee1('0x22')](_0x2752ba,_0xff3d76)[_0x1ee1('0x23')](function(_0x4819de){logger['info'](_0x1ee1('0x24'),_0x1e18b9,_0x1ee1('0x25'));logger[_0x1ee1('0x26')](_0x1ee1('0x27'),_0x1e18b9,'request\x20sent',JSON[_0x1ee1('0x28')](_0x4819de));if(_0x4819de[_0x1ee1('0x29')]){if(_0x4819de[_0x1ee1('0x29')]['code']===0x1f4){logger[_0x1ee1('0x29')](_0x1ee1('0x24'),_0x1e18b9,_0x4819de[_0x1ee1('0x29')][_0x1ee1('0x2a')]);return _0x3c97aa(_0x4819de[_0x1ee1('0x29')][_0x1ee1('0x2a')]);}logger['error'](_0x1ee1('0x24'),_0x1e18b9,_0x4819de['error']['message']);return _0x39229e(_0x4819de[_0x1ee1('0x29')][_0x1ee1('0x2a')]);}else{logger['info'](_0x1ee1('0x24'),_0x1e18b9,_0x1ee1('0x25'));_0x39229e(_0x4819de[_0x1ee1('0x2b')][_0x1ee1('0x2a')]);}})[_0x1ee1('0x2c')](function(_0x12c583){logger['error'](_0x1ee1('0x24'),_0x1e18b9,_0x12c583);_0x3c97aa(_0x12c583);});});}function respondWithStatusCode(_0x8a95d8,_0x1784b4){_0x1784b4=_0x1784b4||0xcc;return function(_0x11ce8d){if(_0x11ce8d){return _0x8a95d8[_0x1ee1('0x2d')](_0x1784b4);}return _0x8a95d8[_0x1ee1('0x2e')](_0x1784b4)['end']();};}function respondWithResult(_0x19e4cc,_0x576bf4){_0x576bf4=_0x576bf4||0xc8;return function(_0x1fab9d){if(_0x1fab9d){return _0x19e4cc[_0x1ee1('0x2e')](_0x576bf4)['json'](_0x1fab9d);}};}function respondWithFilteredResult(_0x53d2b3,_0x444ed9){return function(_0xfd544d){if(_0xfd544d){var _0xf63d67=_0xfd544d[_0x1ee1('0x2f')],_0x209592=_0x444ed9[_0x1ee1('0x30')],_0x49241e=_0x444ed9[_0x1ee1('0x30')]+_0x444ed9[_0x1ee1('0x31')],_0x4b9ea4;if(_0x49241e>=_0xf63d67){_0x49241e=_0xf63d67;_0x4b9ea4=0xc8;}else{_0x4b9ea4=0xce;}_0x53d2b3['status'](_0x4b9ea4);return _0x53d2b3['set'](_0x1ee1('0x32'),_0x209592+'-'+_0x49241e+'/'+_0xf63d67)['json'](_0xfd544d);}return null;};}function patchUpdates(_0x25fb77){return function(_0x2a6883){try{jsonpatch['apply'](_0x2a6883,_0x25fb77,!![]);}catch(_0x2fe0a8){return BPromise['reject'](_0x2fe0a8);}return _0x2a6883[_0x1ee1('0x33')]();};}function saveUpdates(_0x4866a9,_0x285110){return function(_0x48a147){if(_0x48a147){return _0x48a147[_0x1ee1('0x34')](_0x4866a9)[_0x1ee1('0x23')](function(_0x513124){return _0x513124;});}return null;};}function removeEntity(_0x4cc56e,_0x3a2746){return function(_0x2d8ac3){if(_0x2d8ac3){return _0x2d8ac3['destroy']()[_0x1ee1('0x23')](function(){_0x4cc56e[_0x1ee1('0x2e')](0xcc)[_0x1ee1('0x35')]();});}};}function handleEntityNotFound(_0x3d9e0a,_0x40964d){return function(_0x71f867){if(!_0x71f867){_0x3d9e0a[_0x1ee1('0x2d')](0x194);}return _0x71f867;};}function handleError(_0x29011b,_0x24ca9e){_0x24ca9e=_0x24ca9e||0x1f4;return function(_0xb651ba){logger[_0x1ee1('0x29')](_0xb651ba[_0x1ee1('0x36')]);if(_0xb651ba[_0x1ee1('0x37')]){delete _0xb651ba[_0x1ee1('0x37')];}_0x29011b[_0x1ee1('0x2e')](_0x24ca9e)[_0x1ee1('0x38')](_0xb651ba);};}exports[_0x1ee1('0x39')]=function(_0x307b0e,_0x435013){var _0xb20ad8={},_0x175da4={},_0x2733a={'count':0x0,'rows':[]};var _0x493e0c=_[_0x1ee1('0x3a')](db[_0x1ee1('0x3b')][_0x1ee1('0x3c')],function(_0x14d787){return{'name':_0x14d787[_0x1ee1('0x3d')],'type':_0x14d787[_0x1ee1('0x3e')][_0x1ee1('0x3f')]};});_0x175da4[_0x1ee1('0x40')]=_[_0x1ee1('0x3a')](_0x493e0c,_0x1ee1('0x37'));_0x175da4[_0x1ee1('0x41')]=_[_0x1ee1('0x42')](_0x307b0e['query']);_0x175da4[_0x1ee1('0x43')]=_[_0x1ee1('0x44')](_0x175da4[_0x1ee1('0x40')],_0x175da4[_0x1ee1('0x41')]);_0xb20ad8[_0x1ee1('0x45')]=_[_0x1ee1('0x44')](_0x175da4[_0x1ee1('0x40')],qs['fields'](_0x307b0e[_0x1ee1('0x41')][_0x1ee1('0x46')]));_0xb20ad8['attributes']=_0xb20ad8[_0x1ee1('0x45')]['length']?_0xb20ad8['attributes']:_0x175da4[_0x1ee1('0x40')];if(!_0x307b0e[_0x1ee1('0x41')]['hasOwnProperty'](_0x1ee1('0x47'))){_0xb20ad8[_0x1ee1('0x31')]=qs[_0x1ee1('0x31')](_0x307b0e[_0x1ee1('0x41')][_0x1ee1('0x31')]);_0xb20ad8['offset']=qs['offset'](_0x307b0e[_0x1ee1('0x41')][_0x1ee1('0x30')]);}_0xb20ad8[_0x1ee1('0x48')]=qs[_0x1ee1('0x49')](_0x307b0e[_0x1ee1('0x41')][_0x1ee1('0x49')]);_0xb20ad8[_0x1ee1('0x4a')]=qs['filters'](_[_0x1ee1('0x4b')](_0x307b0e['query'],_0x175da4[_0x1ee1('0x43')]),_0x493e0c);if(_0x307b0e[_0x1ee1('0x41')][_0x1ee1('0x4c')]){_0xb20ad8[_0x1ee1('0x4a')]=_[_0x1ee1('0x4d')](_0xb20ad8[_0x1ee1('0x4a')],{'$or':_[_0x1ee1('0x3a')](_0x493e0c,function(_0xe22f5a){if(_0xe22f5a[_0x1ee1('0x3e')]!==_0x1ee1('0x4e')){var _0x576bc3={};_0x576bc3[_0xe22f5a[_0x1ee1('0x37')]]={'$like':'%'+_0x307b0e[_0x1ee1('0x41')][_0x1ee1('0x4c')]+'%'};return _0x576bc3;}})});}_0xb20ad8=_['merge']({},_0xb20ad8,_0x307b0e[_0x1ee1('0x4f')]);var _0x81fe7e={'where':_0xb20ad8[_0x1ee1('0x4a')]};return db['SmsMessage'][_0x1ee1('0x2f')](_0x81fe7e)[_0x1ee1('0x23')](function(_0x423b28){_0x2733a[_0x1ee1('0x2f')]=_0x423b28;if(_0x307b0e['query'][_0x1ee1('0x50')]){_0xb20ad8[_0x1ee1('0x51')]=[{'all':!![]}];}return db[_0x1ee1('0x3b')][_0x1ee1('0x52')](_0xb20ad8);})['then'](function(_0x5baf2f){_0x2733a[_0x1ee1('0x53')]=_0x5baf2f;return _0x2733a;})[_0x1ee1('0x23')](respondWithFilteredResult(_0x435013,_0xb20ad8))[_0x1ee1('0x2c')](handleError(_0x435013,null));};exports[_0x1ee1('0x54')]=function(_0x5b9a65,_0x920f1c){var _0x26d977={'raw':!![],'where':{'id':_0x5b9a65[_0x1ee1('0x55')]['id']}},_0x515ef0={};_0x515ef0[_0x1ee1('0x40')]=_[_0x1ee1('0x42')](db[_0x1ee1('0x3b')][_0x1ee1('0x3c')]);_0x515ef0[_0x1ee1('0x41')]=_['keys'](_0x5b9a65[_0x1ee1('0x41')]);_0x515ef0[_0x1ee1('0x43')]=_[_0x1ee1('0x44')](_0x515ef0[_0x1ee1('0x40')],_0x515ef0[_0x1ee1('0x41')]);_0x26d977[_0x1ee1('0x45')]=_['intersection'](_0x515ef0['model'],qs[_0x1ee1('0x46')](_0x5b9a65[_0x1ee1('0x41')]['fields']));_0x26d977['attributes']=_0x26d977[_0x1ee1('0x45')][_0x1ee1('0x56')]?_0x26d977[_0x1ee1('0x45')]:_0x515ef0['model'];if(_0x5b9a65[_0x1ee1('0x41')][_0x1ee1('0x50')]){_0x26d977[_0x1ee1('0x51')]=[{'all':!![]}];}_0x26d977=_[_0x1ee1('0x4d')]({},_0x26d977,_0x5b9a65[_0x1ee1('0x4f')]);return db[_0x1ee1('0x3b')][_0x1ee1('0x57')](_0x26d977)[_0x1ee1('0x23')](handleEntityNotFound(_0x920f1c,null))['then'](respondWithResult(_0x920f1c,null))['catch'](handleError(_0x920f1c,null));};exports[_0x1ee1('0x58')]=function(_0x51b0a5,_0x4ac90f){return db[_0x1ee1('0x3b')]['create'](_0x51b0a5['body'],{})[_0x1ee1('0x23')](respondWithResult(_0x4ac90f,0xc9))[_0x1ee1('0x2c')](handleError(_0x4ac90f,null));};exports['update']=function(_0x476c6f,_0x5bcfae){if(_0x476c6f[_0x1ee1('0x59')]['id']){delete _0x476c6f[_0x1ee1('0x59')]['id'];}return db['SmsMessage'][_0x1ee1('0x57')]({'where':{'id':_0x476c6f[_0x1ee1('0x55')]['id']}})[_0x1ee1('0x23')](handleEntityNotFound(_0x5bcfae,null))[_0x1ee1('0x23')](saveUpdates(_0x476c6f[_0x1ee1('0x59')],null))[_0x1ee1('0x23')](respondWithResult(_0x5bcfae,null))[_0x1ee1('0x2c')](handleError(_0x5bcfae,null));};exports[_0x1ee1('0x5a')]=function(_0x1e14a0,_0x50ca94){return db[_0x1ee1('0x3b')][_0x1ee1('0x57')]({'where':{'id':_0x1e14a0['params']['id']}})[_0x1ee1('0x23')](handleEntityNotFound(_0x50ca94,null))[_0x1ee1('0x23')](removeEntity(_0x50ca94,null))['catch'](handleError(_0x50ca94,null));};exports['describe']=function(_0x1c05b4,_0x2bde09){return db['SmsMessage'][_0x1ee1('0x5b')]()['then'](respondWithResult(_0x2bde09,null))[_0x1ee1('0x2c')](handleError(_0x2bde09,null));};var interaction_log=require(_0x1ee1('0x13'))(_0x1ee1('0x5c'));exports[_0x1ee1('0x5d')]=function(_0x6fde4,_0x2eb7c3,_0x5e6149){var _0x3dd8e4={'channel':'sms'};if(_0x6fde4[_0x1ee1('0x59')]['id']){delete _0x6fde4[_0x1ee1('0x59')]['id'];}_0x6fde4[_0x1ee1('0x59')][_0x1ee1('0x5e')]=!![];_0x6fde4[_0x1ee1('0x59')][_0x1ee1('0x5f')]=moment()[_0x1ee1('0x60')](_0x1ee1('0x61'));_0x6fde4[_0x1ee1('0x59')]['UserId']=_0x6fde4[_0x1ee1('0x59')][_0x1ee1('0x62')]||_0x6fde4[_0x1ee1('0x63')]['id'];return db['SmsMessage'][_0x1ee1('0x57')]({'where':{'id':_0x6fde4[_0x1ee1('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x1ee1('0x64')],'as':_0x1ee1('0x65')}]})[_0x1ee1('0x23')](handleEntityNotFound(_0x2eb7c3,null))[_0x1ee1('0x23')](saveUpdates(_0x6fde4[_0x1ee1('0x59')],null))[_0x1ee1('0x23')](function(_0x2792ff){if(_0x2792ff){_0x3dd8e4[_0x1ee1('0x2a')]=_0x2792ff[_0x1ee1('0x66')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x2792ff[_0x1ee1('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x2eb7c3,null))['then'](function(_0x21080b){if(_0x21080b){return _0x21080b[_0x1ee1('0x34')]({'UserId':_0x6fde4['body']['UserId'],'read1stAt':_[_0x1ee1('0x68')](_0x21080b[_0x1ee1('0x69')])?moment()[_0x1ee1('0x60')](_0x1ee1('0x61')):undefined});}return null;})[_0x1ee1('0x23')](function(_0x394add){if(_0x394add){_0x3dd8e4['interaction']=_0x394add[_0x1ee1('0x66')]({'plain':!![]});interaction_log[_0x1ee1('0x6a')](_0x1ee1('0x6b'),_0x6fde4[_0x1ee1('0x63')]['id'],_0x6fde4[_0x1ee1('0x63')]['name'],_0x6fde4[_0x1ee1('0x63')][_0x1ee1('0x6c')],_0x3dd8e4['interaction']['id'],_0x6fde4[_0x1ee1('0x59')]?JSON['stringify'](_0x6fde4[_0x1ee1('0x59')]):_0x1ee1('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3dd8e4);}return null;})[_0x1ee1('0x23')](function(_0x961d50){if(_0x961d50){if(_0x6fde4[_0x1ee1('0x59')][_0x1ee1('0x6e')]){_0x3dd8e4[_0x1ee1('0x2a')][_0x1ee1('0x6f')]=util[_0x1ee1('0x60')]('SIP/%s',_0x6fde4['user'][_0x1ee1('0x37')]);_0x3dd8e4[_0x1ee1('0x2a')]['channel']=_0x3dd8e4[_0x1ee1('0x70')];_0x3dd8e4['message'][_0x1ee1('0x71')]=_0x1ee1('0x5d');return respondWithRpcPromise(_0x1ee1('0x72'),_0x1ee1('0x72'),{'event':_0x1ee1('0x73'),'message':_0x3dd8e4['message']},client9002)[_0x1ee1('0x23')](function(){return _0x3dd8e4;});}return _0x3dd8e4;}return null;})[_0x1ee1('0x23')](respondWithResult(_0x2eb7c3,null))[_0x1ee1('0x2c')](handleError(_0x2eb7c3,null));};var interaction_log=require(_0x1ee1('0x13'))(_0x1ee1('0x5c'));exports[_0x1ee1('0x74')]=function(_0x5dde57,_0x619c37,_0x48a77a){var _0x12394e={'agent':{},'channel':_0x1ee1('0x75')};if(_0x5dde57['body']['id']){delete _0x5dde57['body']['id'];}_0x5dde57[_0x1ee1('0x59')][_0x1ee1('0x62')]=_0x5dde57[_0x1ee1('0x59')][_0x1ee1('0x62')]||_0x5dde57[_0x1ee1('0x63')]['id'];_0x12394e[_0x1ee1('0x76')]['id']=_0x5dde57[_0x1ee1('0x59')][_0x1ee1('0x62')];return db[_0x1ee1('0x3b')][_0x1ee1('0x57')]({'where':{'id':_0x5dde57[_0x1ee1('0x55')]['id'],'UserId':null}})[_0x1ee1('0x23')](handleEntityNotFound(_0x619c37,null))[_0x1ee1('0x23')](function(_0x17a8f9){if(_0x17a8f9){_0x12394e[_0x1ee1('0x2a')]=_0x17a8f9[_0x1ee1('0x66')]({'plain':!![]});return db[_0x1ee1('0x77')][_0x1ee1('0x57')]({'where':{'id':_0x17a8f9[_0x1ee1('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x619c37,null))[_0x1ee1('0x23')](function(_0x31bd3c){if(_0x31bd3c){_0x12394e[_0x1ee1('0x78')]=_0x31bd3c[_0x1ee1('0x66')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5dde57[_0x1ee1('0x63')]['id'],_0x5dde57['user'][_0x1ee1('0x37')],_0x5dde57[_0x1ee1('0x63')][_0x1ee1('0x6c')],_0x12394e[_0x1ee1('0x78')]['id'],_0x5dde57[_0x1ee1('0x59')]?JSON[_0x1ee1('0x28')](_0x5dde57[_0x1ee1('0x59')]):'null');return respondWithRpcPromise(_0x1ee1('0x79'),_0x1ee1('0x7a'),_0x12394e);}return null;})[_0x1ee1('0x23')](function(_0x15a415){if(_0x15a415){_0x15a415['message']['interface']=util[_0x1ee1('0x60')](_0x1ee1('0x7b'),_0x5dde57[_0x1ee1('0x63')]['name']);_0x15a415['message'][_0x1ee1('0x70')]=_0x12394e[_0x1ee1('0x70')];_0x15a415[_0x1ee1('0x2a')]['event']=_0x1ee1('0x74');respondWithRpcPromise('EventManager',_0x1ee1('0x72'),{'event':'rejectmessage','message':_0x15a415[_0x1ee1('0x2a')]},client9002);return _0x12394e;}return null;})[_0x1ee1('0x23')](respondWithResult(_0x619c37,null))[_0x1ee1('0x2c')](handleError(_0x619c37,null));};exports[_0x1ee1('0x2e')]=function(_0x151096,_0x3a249b,_0x16f618){if(_0x151096[_0x1ee1('0x59')]['id']){delete _0x151096['body']['id'];}var _0x3a5eb3;return db[_0x1ee1('0x3b')][_0x1ee1('0x57')]({'where':{'id':_0x151096[_0x1ee1('0x55')]['id']}})[_0x1ee1('0x23')](handleEntityNotFound(_0x3a249b,null))[_0x1ee1('0x23')](function(_0x1b21a2){if(_0x1b21a2){_0x3a5eb3=_0x1b21a2;return db[_0x1ee1('0x7c')][_0x1ee1('0x57')]({'where':{'id':_0x1b21a2[_0x1ee1('0x7d')]}});}})[_0x1ee1('0x23')](handleEntityNotFound(_0x3a249b,null))[_0x1ee1('0x23')](function(_0x4f18da){if(_0x4f18da){logger[_0x1ee1('0x26')](_0x1ee1('0x27'),_0x1ee1('0x2e'),'received\x20delivery\x20report\x20from',_0x4f18da[_0x1ee1('0x3e')],util[_0x1ee1('0x7e')](_0x151096[_0x1ee1('0x59')],{'showHidden':![],'depth':null}));switch(_0x4f18da[_0x1ee1('0x3e')]){case _0x1ee1('0x7f'):if(_0x151096[_0x1ee1('0x59')][_0x1ee1('0x80')]&&_0x151096[_0x1ee1('0x59')][_0x1ee1('0x80')]===_0x3a5eb3[_0x1ee1('0x81')]){return _0x3a5eb3[_0x1ee1('0x34')]({'read':!![]});}else{logger[_0x1ee1('0x29')](_0x1ee1('0x82'),_0x1ee1('0x2e'),_0x1ee1('0x7f'),util[_0x1ee1('0x7e')](_0x151096[_0x1ee1('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1ee1('0x83'):if(_0x151096[_0x1ee1('0x59')][_0x1ee1('0x84')]&&_0x151096['body'][_0x1ee1('0x84')]===_0x3a5eb3[_0x1ee1('0x81')]&&_[_0x1ee1('0x85')]([_0x1ee1('0x86'),_0x1ee1('0x87')],_0x151096[_0x1ee1('0x59')][_0x1ee1('0x88')])>=0x0){return _0x3a5eb3['update']({'read':!![]});}else{logger[_0x1ee1('0x29')](_0x1ee1('0x82'),'status',_0x1ee1('0x89'),util[_0x1ee1('0x7e')](_0x151096[_0x1ee1('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3526ff=_0x151096['body'][_0x1ee1('0x8a')][0x0];if(_0x3526ff['status']['groupName']===_0x1ee1('0x8b')){return _0x3a5eb3[_0x1ee1('0x34')]({'read':!![]});}else{logger[_0x1ee1('0x29')](_0x1ee1('0x82'),_0x1ee1('0x2e'),'infobip',util[_0x1ee1('0x7e')](_0x151096[_0x1ee1('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x3a5eb3;}})['then'](respondWithResult(_0x3a249b,null))[_0x1ee1('0x2c')](handleError(_0x3a249b,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index cabe717..c08fd16 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 _0xc95b=['SmsMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0xc95b,0x178));var _0xbc95=function(_0x67db95,_0x2c298d){_0x67db95=_0x67db95-0x0;var _0x3a9a2b=_0xc95b[_0x67db95];return _0x3a9a2b;};'use strict';var EventEmitter=require(_0xbc95('0x0'));var SmsMessage=require(_0xbc95('0x1'))['db'][_0xbc95('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xbc95('0x3')](0x0);var events={'afterCreate':_0xbc95('0x4'),'afterUpdate':'update','afterDestroy':_0xbc95('0x5')};function emitEvent(_0x581dc0){return function(_0x2759bd,_0x1d9fde,_0x392d6c){SmsMessageEvents[_0xbc95('0x6')](_0x581dc0+':'+_0x2759bd['id'],_0x2759bd);SmsMessageEvents[_0xbc95('0x6')](_0x581dc0,_0x2759bd);_0x392d6c(null);};}for(var e in events){if(events[_0xbc95('0x7')](e)){var event=events[e];SmsMessage[_0xbc95('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x6cd7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','remove'];(function(_0x204fe9,_0x51ebe1){var _0xdefb11=function(_0x436d5d){while(--_0x436d5d){_0x204fe9['push'](_0x204fe9['shift']());}};_0xdefb11(++_0x51ebe1);}(_0x6cd7,0x134));var _0x76cd=function(_0x4abb10,_0x26897f){_0x4abb10=_0x4abb10-0x0;var _0x2494fe=_0x6cd7[_0x4abb10];return _0x2494fe;};'use strict';var EventEmitter=require(_0x76cd('0x0'));var SmsMessage=require(_0x76cd('0x1'))['db'][_0x76cd('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x76cd('0x3')};function emitEvent(_0x4eddf5){return function(_0x786b9b,_0x2425bf,_0x8dd721){SmsMessageEvents['emit'](_0x4eddf5+':'+_0x786b9b['id'],_0x786b9b);SmsMessageEvents[_0x76cd('0x4')](_0x4eddf5,_0x786b9b);_0x8dd721(null);};}for(var e in events){if(events[_0x76cd('0x5')](e)){var event=events[e];SmsMessage[_0x76cd('0x6')](e,emitEvent(event));}}module[_0x76cd('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 4d505f7..af18182 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 _0x9ee9=['/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','http_code','data','queued_count','clickSend','plivo','remote','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','keys','length','createHash','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','Token\x20not\x20received','finally','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','then','update','catch','SmsAccount','find','SmsAccountId','type','twilio','phone','accountSid','authToken','messages','create','/api/sms/messages/'];(function(_0x28cb42,_0x25400b){var _0xeaf3ee=function(_0x50282d){while(--_0x50282d){_0x28cb42['push'](_0x28cb42['shift']());}};_0xeaf3ee(++_0x25400b);}(_0x9ee9,0xcc));var _0x99ee=function(_0x25b9bf,_0x1aa452){_0x25b9bf=_0x25b9bf-0x0;var _0x381b87=_0x9ee9[_0x25b9bf];return _0x381b87;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x99ee('0x0'))(_0x99ee('0x1'));var moment=require(_0x99ee('0x2'));var BPromise=require(_0x99ee('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99ee('0x4'));var rimraf=require(_0x99ee('0x5'));var config=require('../../config/environment');var attributes=require(_0x99ee('0x6'));module[_0x99ee('0x7')]=function(_0x1ff1f8,_0x4ae714){return _0x1ff1f8[_0x99ee('0x8')](_0x99ee('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x99ee('0xa')]},{'name':_0x99ee('0xb'),'fields':[_0x99ee('0xc')],'type':_0x99ee('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41cb9e,_0x453156,_0x39182a){var _0xb6fc2f=_0x1ff1f8['models'];var _0x2cfed9=_0x41cb9e['get']({'plain':!![]});if(_0x2cfed9[_0x99ee('0xe')][_0x99ee('0xf')]()==='in'||_0x2cfed9[_0x99ee('0xe')][_0x99ee('0xf')]()===_0x99ee('0x10')&&!_0x2cfed9[_0x99ee('0x11')]&&!_[_0x99ee('0x12')](_0x2cfed9[_0x99ee('0x13')])){_0xb6fc2f['SmsInteraction'][_0x99ee('0x14')]({'where':{'id':_0x2cfed9[_0x99ee('0x15')]}})[_0x99ee('0x16')](function(_0x2226a2){if(_0x2226a2){_0x2226a2[_0x99ee('0x17')]({'lastMsgAt':_0x2cfed9['createdAt'],'lastMsgDirection':_0x2cfed9[_0x99ee('0xe')][_0x99ee('0xf')]()});}})[_0x99ee('0x18')](function(_0x2335d3){console['error'](_0x2335d3);});}if(_0x2cfed9[_0x99ee('0xe')]===_0x99ee('0x10')&&!_0x2cfed9[_0x99ee('0x11')]){var _0x5d295b;_0xb6fc2f[_0x99ee('0x19')][_0x99ee('0x1a')]({'where':{'id':_0x2cfed9[_0x99ee('0x1b')]},'raw':!![]})[_0x99ee('0x16')](function(_0xc22909){_0x5d295b=_0xc22909;if(_0x5d295b&&_0x5d295b[_0x99ee('0x1c')]){switch(_0x5d295b[_0x99ee('0x1c')]){case'twilio':var _0x535301=require(_0x99ee('0x1d'));if(_0x5d295b['accountSid']&&_0x5d295b['authToken']&&_0x5d295b[_0x99ee('0x1e')]){var _0x283aff=new _0x535301(_0x5d295b[_0x99ee('0x1f')],_0x5d295b[_0x99ee('0x20')]);_0x283aff[_0x99ee('0x21')][_0x99ee('0x22')]({'body':_0x2cfed9[_0x99ee('0xc')],'to':_0x2cfed9[_0x99ee('0x1e')],'from':_0x5d295b['phone'],'statusCallback':_0x5d295b['remote']+_0x99ee('0x23')+_0x2cfed9['id']+_0x99ee('0x24')+_0x5d295b[_0x99ee('0x25')]})[_0x99ee('0x16')](function(_0x567623){if(_0x567623[_0x99ee('0x26')]){return _0x41cb9e[_0x99ee('0x17')]({'messageId':_0x567623[_0x99ee('0x26')]});}})[_0x99ee('0x18')](function(_0x4c2b15){logger[_0x99ee('0x27')](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x1d'),util['inspect'](_0x4c2b15,{'showHidden':![],'depth':null}));});}else{logger[_0x99ee('0x27')](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x1d'),_0x99ee('0x2a'));}break;case _0x99ee('0x2b'):var _0x435ed5=_0x99ee('0x2c');if(_0x5d295b[_0x99ee('0x2d')]&&_0x5d295b[_0x99ee('0x2e')]){var _0x3af0d7={'recipient':[_0x2cfed9[_0x99ee('0x1e')]],'message':_0x2cfed9[_0x99ee('0xc')],'message_type':_0x5d295b['smsMethod']};if(_0x5d295b[_0x99ee('0x2f')]&&_0x5d295b[_0x99ee('0x2f')]!=='SI'){_0x3af0d7['sender']=_0x5d295b[_0x99ee('0x1e')];}var _0x29349a={'url':_0x435ed5+_0x99ee('0x30')+_0x5d295b[_0x99ee('0x2d')]+_0x99ee('0x31')+_0x5d295b[_0x99ee('0x2e')],'method':_0x99ee('0x32')};rp(_0x29349a)[_0x99ee('0x16')](function(_0x26b9a5){var _0x58f0bf=_0x26b9a5[_0x99ee('0x33')](';');var _0xbd391c={'user_key':_0x58f0bf[0x0],'session_key':_0x58f0bf[0x1]};_0x29349a={'url':_0x435ed5+_0x99ee('0x34'),'method':_0x99ee('0x35'),'headers':{'user_key':_0xbd391c[_0x99ee('0x36')],'Session_key':_0xbd391c[_0x99ee('0x37')]},'json':!![],'body':_0x3af0d7};return rp(_0x29349a);})['then'](function(_0x2d2894){if(_0x2d2894[_0x99ee('0x38')]>=0x1){var _0x428ca2={'messageId':_0x2d2894[_0x99ee('0x39')]};if(_0x5d295b['smsMethod']!=='GP'||!_0x5d295b[_0x99ee('0x3a')]){_0x428ca2[_0x99ee('0x3b')]=!![];}return _0x41cb9e[_0x99ee('0x17')](_0x428ca2);}else{return logger['error'](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x2b'),util[_0x99ee('0x3c')](_0x2d2894,{'showHidden':![],'depth':null}));}})['catch'](function(_0x936723){return logger[_0x99ee('0x27')](_0x99ee('0x28'),'afterCreate','skebby',util[_0x99ee('0x3c')](_0x936723,{'showHidden':![],'depth':null}));});}else{logger[_0x99ee('0x27')](_0x99ee('0x28'),'afterCreate','skebby',_0x99ee('0x3d'));}break;case _0x99ee('0x3e'):if(_0x5d295b[_0x99ee('0x20')]){var _0x185027={'recipient':_0x2cfed9[_0x99ee('0x1e')],'message':_0x2cfed9[_0x99ee('0xc')],'sender':_0x5d295b['senderString']||_0x5d295b[_0x99ee('0x1e')],'authorization':_0x5d295b[_0x99ee('0x20')]};var _0x453156={'method':_0x99ee('0x35'),'uri':_0x99ee('0x3f'),'body':_0x185027,'json':!![]};rp(_0x453156)['then'](function(_0xb2834e){var _0x1f03f2={'messageId':_0xb2834e[_0x99ee('0x40')]};if(!_0x5d295b[_0x99ee('0x3a')]){_0x1f03f2[_0x99ee('0x3b')]=!![];}return _0x41cb9e[_0x99ee('0x17')](_0x1f03f2);})[_0x99ee('0x18')](function(_0x2ad495){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x99ee('0x29'),_0x99ee('0x3e'),util['inspect'](_0x2ad495,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x3e'),_0x99ee('0x41'));}break;case _0x99ee('0x42'):if(_0x5d295b[_0x99ee('0x2d')]&&_0x5d295b['password']){var _0x185027={'messages':[{'source':_0x99ee('0x43'),'to':_0x2cfed9['phone'],'body':_0x2cfed9['body'],'from':_0x5d295b[_0x99ee('0x44')]||_0x5d295b[_0x99ee('0x1e')]}]};var _0xae1b9e=util[_0x99ee('0x45')](_0x99ee('0x46'),_0x5d295b['username'],_0x5d295b[_0x99ee('0x2e')]);var _0x453156={'method':_0x99ee('0x35'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x185027,'headers':{'Authorization':util['format'](_0x99ee('0x47'),new Buffer(_0xae1b9e)['toString']('base64'))},'json':!![]};rp(_0x453156)[_0x99ee('0x16')](function(_0x4ad738){if(_0x4ad738[_0x99ee('0x48')]>=0xc8&&_0x4ad738[_0x99ee('0x48')]<=0xce){if(_0x4ad738['data']&&_0x4ad738[_0x99ee('0x49')][_0x99ee('0x4a')]>0x0){var _0x22e07e=_['head'](_0x4ad738[_0x99ee('0x49')][_0x99ee('0x21')]);var _0x2a6a45={'messageId':_0x22e07e['message_id']};if(!_0x5d295b['deliveryReport']){_0x2a6a45[_0x99ee('0x3b')]=!![];}return _0x41cb9e[_0x99ee('0x17')](_0x2a6a45);}else{logger[_0x99ee('0x27')](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x4b'),util[_0x99ee('0x3c')](_0x4ad738,{'showHidden':![],'depth':null}));}}else{logger[_0x99ee('0x27')](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x4b'),util[_0x99ee('0x3c')](_0x4ad738,{'showHidden':![],'depth':null}));}})[_0x99ee('0x18')](function(_0x12adcd){logger['error'](_0x99ee('0x28'),_0x99ee('0x29'),'clickSend',util[_0x99ee('0x3c')](_0x12adcd,{'showHidden':![],'depth':null}));});}else{logger[_0x99ee('0x27')](_0x99ee('0x28'),_0x99ee('0x29'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0x99ee('0x4c'):if(_0x5d295b['authId']&&_0x5d295b['authToken']){var _0x185027={'dst':_0x2cfed9[_0x99ee('0x1e')],'text':_0x2cfed9[_0x99ee('0xc')],'src':_0x5d295b[_0x99ee('0x44')]||_0x5d295b[_0x99ee('0x1e')],'url':_0x5d295b[_0x99ee('0x4d')]+_0x99ee('0x23')+_0x2cfed9['id']+_0x99ee('0x24')+_0x5d295b[_0x99ee('0x25')]};var _0xae1b9e=util[_0x99ee('0x45')]('%s:%s',_0x5d295b[_0x99ee('0x4e')],_0x5d295b[_0x99ee('0x20')]);var _0x453156={'method':'POST','uri':util[_0x99ee('0x45')](_0x99ee('0x4f'),_0x5d295b['authId']),'body':_0x185027,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xae1b9e)[_0x99ee('0x50')](_0x99ee('0x51')))},'json':!![]};rp(_0x453156)[_0x99ee('0x16')](function(_0x456563){var _0x38f0cb={'messageId':_0x456563[_0x99ee('0x52')][0x0]};return _0x41cb9e[_0x99ee('0x17')](_0x38f0cb);})[_0x99ee('0x18')](function(_0x71adf4){logger['error'](_0x99ee('0x28'),_0x99ee('0x29'),'plivo',util[_0x99ee('0x3c')](_0x71adf4,{'showHidden':![],'depth':null}));});}else{logger[_0x99ee('0x27')](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x4c'),_0x99ee('0x53'));}break;case _0x99ee('0x54'):if(_0x5d295b['username']&&_0x5d295b[_0x99ee('0x2e')]){if(_0x5d295b[_0x99ee('0x55')]){var _0x33fe6e={'method':'POST','uri':_0x5d295b[_0x99ee('0x55')]+_0x99ee('0x56'),'body':{'username':_0x5d295b[_0x99ee('0x2d')],'password':_0x5d295b[_0x99ee('0x2e')]},'json':!![]};return rp(_0x33fe6e)[_0x99ee('0x16')](function(_0x6b0328){var _0x2fcbcc={'method':_0x99ee('0x35'),'uri':_0x5d295b[_0x99ee('0x55')]+_0x99ee('0x57'),'body':{'messages':[{'from':_0x5d295b[_0x99ee('0x1e')],'destinations':[{'to':_0x2cfed9[_0x99ee('0x1e')]}],'text':_0x2cfed9[_0x99ee('0xc')],'notifyUrl':_0x5d295b[_0x99ee('0x4d')]+'/api/sms/messages/'+_0x2cfed9['id']+'/status?token='+_0x5d295b[_0x99ee('0x25')],'notifyContentType':'application/json','callbackData':_0x5d295b['phone']+';'+_0x2cfed9[_0x99ee('0xc')]}]},'headers':{'Authorization':_0x99ee('0x58')+_0x6b0328[_0x99ee('0x25')]},'json':!![]};return rp(_0x2fcbcc)[_0x99ee('0x16')](function(_0x580b95){if(_0x580b95[_0x99ee('0x21')]){var _0x4dbf47={'messageId':_0x580b95[_0x99ee('0x21')][0x0][_0x99ee('0xa')]};if(!_0x5d295b[_0x99ee('0x3a')]){_0x4dbf47[_0x99ee('0x3b')]=!![];}return _0x41cb9e[_0x99ee('0x17')](_0x4dbf47);}else{return logger[_0x99ee('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x99ee('0x54'),util['inspect'](_0x580b95,{'showHidden':![],'depth':null}));}});})[_0x99ee('0x18')](function(_0x32df16){return logger[_0x99ee('0x27')](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x54'),util['inspect'](_0x32df16,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x99ee('0x28'),_0x99ee('0x29'),'infobip',_0x99ee('0x59'));}}else{logger['error'](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x54'),_0x99ee('0x3d'));}break;case _0x99ee('0x5a'):var _0x380ec0=require(_0x99ee('0x5b'));if(_0x5d295b[_0x99ee('0x5c')]){var _0x1fb1f9={};_0x1fb1f9[_0x99ee('0x5d')]=_0x5d295b[_0x99ee('0x2d')];_0x1fb1f9['phone']=_0x2cfed9[_0x99ee('0x1e')];_0x1fb1f9[_0x99ee('0x5e')]=_0x5d295b[_0x99ee('0x1e')];_0x1fb1f9[_0x99ee('0x5f')]=_0x2cfed9[_0x99ee('0xc')];_0x1fb1f9['timestamp']=+new Date();var _0x1cba12='';var _0x21f82d='';var _0x475d8e=Object[_0x99ee('0x60')](_0x1fb1f9);_0x475d8e['sort']();for(var _0x1ab940=0x0;_0x1ab940<_0x475d8e[_0x99ee('0x61')];_0x1ab940++){if(_0x1cba12!=''){_0x1cba12+='&';}_0x1cba12+=_0x475d8e[_0x1ab940]+'='+encodeURIComponent(_0x1fb1f9[_0x475d8e[_0x1ab940]]);_0x21f82d+=_0x1fb1f9[_0x475d8e[_0x1ab940]];}_0x21f82d+=_0x5d295b[_0x99ee('0x5c')];_0x21f82d=_0x380ec0[_0x99ee('0x62')]('md5')[_0x99ee('0x17')](_0x21f82d)['digest'](_0x99ee('0x63'));if(_0x1cba12!==''){_0x1cba12+='&';}_0x1cba12+=_0x99ee('0x64')+_0x21f82d;var _0x29349a={'method':_0x99ee('0x32'),'uri':_0x5d295b[_0x99ee('0x55')]+_0x99ee('0x65')+_0x1cba12,'json':!![]};return rp(_0x29349a)[_0x99ee('0x16')](function(_0x5f23d1){var _0x4e5db6=Object['keys'](_0x5f23d1);if(_0x5f23d1[_0x4e5db6[0x0]]['error']&&parseInt(_0x5f23d1[_0x4e5db6[0x0]]['error'])===0x0){var _0xeb10b7={'messageId':_0x5f23d1[_0x4e5db6[0x0]][_0x99ee('0x66')]};if(!_0x5d295b['deliveryReport']){_0xeb10b7['read']=!![];}return _0x41cb9e[_0x99ee('0x17')](_0xeb10b7);}else{return logger['error'](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x5a'),util[_0x99ee('0x3c')](_0x5f23d1[_0x99ee('0x27')],{'showHidden':![],'depth':null}));}})[_0x99ee('0x18')](function(_0x1751f1){return logger[_0x99ee('0x27')](_0x99ee('0x28'),_0x99ee('0x29'),'csc',util[_0x99ee('0x3c')](_0x1751f1,{'showHidden':![],'depth':null}));});}else{logger[_0x99ee('0x27')](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x5a'),_0x99ee('0x67'));}break;case _0x99ee('0x68'):if(_0x5d295b['apiKey']){var _0x33e91f={'method':'POST','uri':_0x99ee('0x69'),'headers':{'Authorization':_0x5d295b[_0x99ee('0x5c')]},'body':{'content':_0x2cfed9[_0x99ee('0xc')],'to':[_0x2cfed9[_0x99ee('0x1e')]],'from':_0x5d295b[_0x99ee('0x1e')],'binary':![],'clientMessageId':_0x99ee('0x6a'),'charset':_0x99ee('0x6b')},'json':!![]};rp(_0x33e91f)['then'](function(_0x3a0d05){if(!_0x3a0d05['error']){var _0x38ee33={'messageId':_0x3a0d05['messages'][0x0][_0x99ee('0x6c')]};if(!_0x5d295b[_0x99ee('0x3a')]){_0x38ee33[_0x99ee('0x3b')]=!![];}return _0x41cb9e[_0x99ee('0x17')](_0x38ee33);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x99ee('0x68'),util['inspect'](_0x3a0d05['error'],{'showHidden':![],'depth':null}));}})[_0x99ee('0x18')](function(_0x316d79){return logger['error'](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x68'),util[_0x99ee('0x3c')](_0x316d79,{'showHidden':![],'depth':null}));});}else{logger[_0x99ee('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x99ee('0x29'),_0x99ee('0x68'),_0x99ee('0x67'));}break;case _0x99ee('0x6d'):if(_0x5d295b[_0x99ee('0x5c')]){var _0x3df3c8={};var _0x29349a={'method':'POST','uri':_0x99ee('0x6e'),'headers':{'Authorization':_0x99ee('0x6f')+_0x5d295b[_0x99ee('0x5c')],'Content-Type':_0x99ee('0x70')},'body':{'from':_0x5d295b[_0x99ee('0x1e')],'to':_0x2cfed9[_0x99ee('0x1e')],'text':_0x2cfed9[_0x99ee('0xc')]},'json':!![]};return rp(_0x29349a)[_0x99ee('0x16')](function(_0x484c93){if(_0x484c93[_0x99ee('0x71')]==0xca){_0x3df3c8['message']=_0x484c93;var _0x1f4402={'method':'POST','uri':_0x99ee('0x72'),'headers':{'Authorization':_0x99ee('0x6f')+_0x5d295b[_0x99ee('0x5c')],'Content-Type':_0x99ee('0x70')},'body':{'refid':_0x3df3c8[_0x99ee('0x73')]['refid']},'json':!![]};return rp(_0x1f4402)['then'](function(_0x17d998){_0x3df3c8['status']=_0x17d998;var _0x4b3ed6={'messageId':_0x3df3c8[_0x99ee('0x73')][_0x99ee('0x74')],'read':!![]};return _0x41cb9e[_0x99ee('0x17')](_0x4b3ed6);});}else{return logger[_0x99ee('0x27')](_0x99ee('0x28'),'afterCreate',_0x99ee('0x6d'),util[_0x99ee('0x3c')](_0x484c93,{'showHidden':![],'depth':null}));}})[_0x99ee('0x18')](function(_0x174de9){return logger[_0x99ee('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x99ee('0x29'),_0x99ee('0x6d'),util[_0x99ee('0x3c')](_0x174de9,{'showHidden':![],'depth':null}));});}else{return logger[_0x99ee('0x27')](_0x99ee('0x28'),_0x99ee('0x29'),_0x99ee('0x6d'),_0x99ee('0x75'));}break;}}})[_0x99ee('0x76')](function(){_0x39182a();});}else{_0x39182a();}}},'charset':'utf8mb4','collate':_0x99ee('0x77')});}; \ No newline at end of file +var _0xf6b4=['read','connectel','authToken','senderString','POST','https://smsapi.connectel.se/api/send/','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','keys','sort','length','createHash','md5','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','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','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','FULLTEXT','models','direction','toLowerCase','out','isNil','SmsInteraction','findOne','SmsInteractionId','then','createdAt','catch','secret','SmsAccount','SmsAccountId','type','twilio','accountSid','phone','remote','/api/sms/messages/','/status?token=','token','sid','update','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','sender','&password=','GET','user_key','internal_order_id','deliveryReport'];(function(_0x33cdac,_0x45266b){var _0x6862e9=function(_0x2549f4){while(--_0x2549f4){_0x33cdac['push'](_0x33cdac['shift']());}};_0x6862e9(++_0x45266b);}(_0xf6b4,0xaa));var _0x4f6b=function(_0x99c2dd,_0x1d32eb){_0x99c2dd=_0x99c2dd-0x0;var _0x173349=_0xf6b4[_0x99c2dd];return _0x173349;};'use strict';var _=require(_0x4f6b('0x0'));var util=require(_0x4f6b('0x1'));var logger=require('../../config/logger')(_0x4f6b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4f6b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f6b('0x4'));var config=require(_0x4f6b('0x5'));var attributes=require(_0x4f6b('0x6'));module[_0x4f6b('0x7')]=function(_0x2596ab,_0x2864a6){return _0x2596ab['define'](_0x4f6b('0x8'),attributes,{'tableName':_0x4f6b('0x9'),'paranoid':![],'indexes':[{'name':_0x4f6b('0xa'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':_0x4f6b('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59f7c7,_0x54aa2f,_0x224e61){var _0xa827ee=_0x2596ab[_0x4f6b('0xc')];var _0x4b6295=_0x59f7c7['get']({'plain':!![]});if(_0x4b6295[_0x4f6b('0xd')][_0x4f6b('0xe')]()==='in'||_0x4b6295['direction'][_0x4f6b('0xe')]()===_0x4f6b('0xf')&&!_0x4b6295['secret']&&!_[_0x4f6b('0x10')](_0x4b6295['UserId'])){_0xa827ee[_0x4f6b('0x11')][_0x4f6b('0x12')]({'where':{'id':_0x4b6295[_0x4f6b('0x13')]}})[_0x4f6b('0x14')](function(_0x14a517){if(_0x14a517){_0x14a517['update']({'lastMsgAt':_0x4b6295[_0x4f6b('0x15')],'lastMsgDirection':_0x4b6295[_0x4f6b('0xd')]['toLowerCase']()});}})[_0x4f6b('0x16')](function(_0x2df8e0){console['error'](_0x2df8e0);});}if(_0x4b6295['direction']===_0x4f6b('0xf')&&!_0x4b6295[_0x4f6b('0x17')]){var _0x15a869;_0xa827ee[_0x4f6b('0x18')]['find']({'where':{'id':_0x4b6295[_0x4f6b('0x19')]},'raw':!![]})[_0x4f6b('0x14')](function(_0x415a9a){_0x15a869=_0x415a9a;if(_0x15a869&&_0x15a869[_0x4f6b('0x1a')]){switch(_0x15a869[_0x4f6b('0x1a')]){case _0x4f6b('0x1b'):var _0x3baf36=require(_0x4f6b('0x1b'));if(_0x15a869[_0x4f6b('0x1c')]&&_0x15a869['authToken']&&_0x15a869[_0x4f6b('0x1d')]){var _0x2b4d56=new _0x3baf36(_0x15a869[_0x4f6b('0x1c')],_0x15a869['authToken']);_0x2b4d56['messages']['create']({'body':_0x4b6295['body'],'to':_0x4b6295[_0x4f6b('0x1d')],'from':_0x15a869[_0x4f6b('0x1d')],'statusCallback':_0x15a869[_0x4f6b('0x1e')]+_0x4f6b('0x1f')+_0x4b6295['id']+_0x4f6b('0x20')+_0x15a869[_0x4f6b('0x21')]})['then'](function(_0x68521){if(_0x68521[_0x4f6b('0x22')]){return _0x59f7c7[_0x4f6b('0x23')]({'messageId':_0x68521[_0x4f6b('0x22')]});}})[_0x4f6b('0x16')](function(_0x34e373){logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x1b'),util[_0x4f6b('0x27')](_0x34e373,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4f6b('0x1b'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x4f6b('0x28'):var _0x5b2d06=_0x4f6b('0x29');if(_0x15a869[_0x4f6b('0x2a')]&&_0x15a869[_0x4f6b('0x2b')]){var _0x2c6037={'recipient':[_0x4b6295[_0x4f6b('0x1d')]],'message':_0x4b6295[_0x4f6b('0x2c')],'message_type':_0x15a869[_0x4f6b('0x2d')]};if(_0x15a869['smsMethod']&&_0x15a869[_0x4f6b('0x2d')]!=='SI'){_0x2c6037[_0x4f6b('0x2e')]=_0x15a869['phone'];}var _0x79fa6f={'url':_0x5b2d06+'login?username='+_0x15a869[_0x4f6b('0x2a')]+_0x4f6b('0x2f')+_0x15a869['password'],'method':_0x4f6b('0x30')};rp(_0x79fa6f)[_0x4f6b('0x14')](function(_0x5ccbc8){var _0x68f6c2=_0x5ccbc8['split'](';');var _0x535013={'user_key':_0x68f6c2[0x0],'session_key':_0x68f6c2[0x1]};_0x79fa6f={'url':_0x5b2d06+'sms','method':'POST','headers':{'user_key':_0x535013[_0x4f6b('0x31')],'Session_key':_0x535013['session_key']},'json':!![],'body':_0x2c6037};return rp(_0x79fa6f);})['then'](function(_0x287445){if(_0x287445['total_sent']>=0x1){var _0x23c602={'messageId':_0x287445[_0x4f6b('0x32')]};if(_0x15a869[_0x4f6b('0x2d')]!=='GP'||!_0x15a869[_0x4f6b('0x33')]){_0x23c602[_0x4f6b('0x34')]=!![];}return _0x59f7c7[_0x4f6b('0x23')](_0x23c602);}else{return logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x28'),util[_0x4f6b('0x27')](_0x287445,{'showHidden':![],'depth':null}));}})['catch'](function(_0x99b4a0){return logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x28'),util[_0x4f6b('0x27')](_0x99b4a0,{'showHidden':![],'depth':null}));});}else{logger[_0x4f6b('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4f6b('0x26'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x4f6b('0x35'):if(_0x15a869[_0x4f6b('0x36')]){var _0x516eeb={'recipient':_0x4b6295['phone'],'message':_0x4b6295[_0x4f6b('0x2c')],'sender':_0x15a869[_0x4f6b('0x37')]||_0x15a869[_0x4f6b('0x1d')],'authorization':_0x15a869['authToken']};var _0x54aa2f={'method':_0x4f6b('0x38'),'uri':_0x4f6b('0x39'),'body':_0x516eeb,'json':!![]};rp(_0x54aa2f)['then'](function(_0x42a408){var _0x17942f={'messageId':_0x42a408['requestid']};if(!_0x15a869[_0x4f6b('0x33')]){_0x17942f['read']=!![];}return _0x59f7c7['update'](_0x17942f);})['catch'](function(_0x3fa045){logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x35'),util[_0x4f6b('0x27')](_0x3fa045,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x35'),'Missing\x20parameters:\x20authToken');}break;case _0x4f6b('0x3a'):if(_0x15a869['username']&&_0x15a869[_0x4f6b('0x2b')]){var _0x516eeb={'messages':[{'source':_0x4f6b('0x3b'),'to':_0x4b6295[_0x4f6b('0x1d')],'body':_0x4b6295[_0x4f6b('0x2c')],'from':_0x15a869[_0x4f6b('0x37')]||_0x15a869[_0x4f6b('0x1d')]}]};var _0x48b945=util[_0x4f6b('0x3c')](_0x4f6b('0x3d'),_0x15a869[_0x4f6b('0x2a')],_0x15a869['password']);var _0x54aa2f={'method':_0x4f6b('0x38'),'uri':_0x4f6b('0x3e'),'body':_0x516eeb,'headers':{'Authorization':util[_0x4f6b('0x3c')](_0x4f6b('0x3f'),new Buffer(_0x48b945)[_0x4f6b('0x40')](_0x4f6b('0x41')))},'json':!![]};rp(_0x54aa2f)[_0x4f6b('0x14')](function(_0x39aab7){if(_0x39aab7[_0x4f6b('0x42')]>=0xc8&&_0x39aab7['http_code']<=0xce){if(_0x39aab7['data']&&_0x39aab7[_0x4f6b('0x43')]['queued_count']>0x0){var _0x3436d1=_['head'](_0x39aab7[_0x4f6b('0x43')]['messages']);var _0x5b8fa5={'messageId':_0x3436d1[_0x4f6b('0x44')]};if(!_0x15a869['deliveryReport']){_0x5b8fa5['read']=!![];}return _0x59f7c7[_0x4f6b('0x23')](_0x5b8fa5);}else{logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x45'),util[_0x4f6b('0x27')](_0x39aab7,{'showHidden':![],'depth':null}));}}else{logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x45'),util['inspect'](_0x39aab7,{'showHidden':![],'depth':null}));}})[_0x4f6b('0x16')](function(_0x5e9fbd){logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),'clickSend',util['inspect'](_0x5e9fbd,{'showHidden':![],'depth':null}));});}else{logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x45'),_0x4f6b('0x46'));}break;case'plivo':if(_0x15a869[_0x4f6b('0x47')]&&_0x15a869[_0x4f6b('0x36')]){var _0x516eeb={'dst':_0x4b6295['phone'],'text':_0x4b6295['body'],'src':_0x15a869[_0x4f6b('0x37')]||_0x15a869[_0x4f6b('0x1d')],'url':_0x15a869['remote']+_0x4f6b('0x1f')+_0x4b6295['id']+_0x4f6b('0x20')+_0x15a869[_0x4f6b('0x21')]};var _0x48b945=util[_0x4f6b('0x3c')]('%s:%s',_0x15a869[_0x4f6b('0x47')],_0x15a869[_0x4f6b('0x36')]);var _0x54aa2f={'method':_0x4f6b('0x38'),'uri':util['format'](_0x4f6b('0x48'),_0x15a869[_0x4f6b('0x47')]),'body':_0x516eeb,'headers':{'Authorization':util[_0x4f6b('0x3c')](_0x4f6b('0x3f'),new Buffer(_0x48b945)[_0x4f6b('0x40')](_0x4f6b('0x41')))},'json':!![]};rp(_0x54aa2f)[_0x4f6b('0x14')](function(_0x5beb9d){var _0x1a30f3={'messageId':_0x5beb9d[_0x4f6b('0x49')][0x0]};return _0x59f7c7[_0x4f6b('0x23')](_0x1a30f3);})[_0x4f6b('0x16')](function(_0xf38b9a){logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x4a'),util['inspect'](_0xf38b9a,{'showHidden':![],'depth':null}));});}else{logger[_0x4f6b('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4f6b('0x26'),_0x4f6b('0x4a'),_0x4f6b('0x4b'));}break;case _0x4f6b('0x4c'):if(_0x15a869[_0x4f6b('0x2a')]&&_0x15a869[_0x4f6b('0x2b')]){if(_0x15a869[_0x4f6b('0x4d')]){var _0xd0b857={'method':_0x4f6b('0x38'),'uri':_0x15a869[_0x4f6b('0x4d')]+_0x4f6b('0x4e'),'body':{'username':_0x15a869[_0x4f6b('0x2a')],'password':_0x15a869[_0x4f6b('0x2b')]},'json':!![]};return rp(_0xd0b857)[_0x4f6b('0x14')](function(_0x5c9b3f){var _0x164842={'method':_0x4f6b('0x38'),'uri':_0x15a869['baseUrl']+_0x4f6b('0x4f'),'body':{'messages':[{'from':_0x15a869[_0x4f6b('0x1d')],'destinations':[{'to':_0x4b6295[_0x4f6b('0x1d')]}],'text':_0x4b6295[_0x4f6b('0x2c')],'notifyUrl':_0x15a869['remote']+'/api/sms/messages/'+_0x4b6295['id']+_0x4f6b('0x20')+_0x15a869['token'],'notifyContentType':_0x4f6b('0x50'),'callbackData':_0x15a869[_0x4f6b('0x1d')]+';'+_0x4b6295[_0x4f6b('0x2c')]}]},'headers':{'Authorization':_0x4f6b('0x51')+_0x5c9b3f[_0x4f6b('0x21')]},'json':!![]};return rp(_0x164842)[_0x4f6b('0x14')](function(_0x24b406){if(_0x24b406[_0x4f6b('0x52')]){var _0x40a1a8={'messageId':_0x24b406[_0x4f6b('0x52')][0x0][_0x4f6b('0xa')]};if(!_0x15a869[_0x4f6b('0x33')]){_0x40a1a8[_0x4f6b('0x34')]=!![];}return _0x59f7c7[_0x4f6b('0x23')](_0x40a1a8);}else{return logger['error'](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x4c'),util[_0x4f6b('0x27')](_0x24b406,{'showHidden':![],'depth':null}));}});})[_0x4f6b('0x16')](function(_0x2237b1){return logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x4c'),util[_0x4f6b('0x27')](_0x2237b1,{'showHidden':![],'depth':null}));});}else{logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x4c'),_0x4f6b('0x53'));}}else{logger[_0x4f6b('0x24')](_0x4f6b('0x25'),'afterCreate',_0x4f6b('0x4c'),_0x4f6b('0x46'));}break;case _0x4f6b('0x54'):var _0x23caf2=require(_0x4f6b('0x55'));if(_0x15a869[_0x4f6b('0x56')]){var _0x220c76={};_0x220c76[_0x4f6b('0x57')]=_0x15a869['username'];_0x220c76[_0x4f6b('0x1d')]=_0x4b6295[_0x4f6b('0x1d')];_0x220c76[_0x4f6b('0x2e')]=_0x15a869[_0x4f6b('0x1d')];_0x220c76['text']=_0x4b6295[_0x4f6b('0x2c')];_0x220c76['timestamp']=+new Date();var _0x43e5b4='';var _0x33441d='';var _0x578cb8=Object[_0x4f6b('0x58')](_0x220c76);_0x578cb8[_0x4f6b('0x59')]();for(var _0x1d38a4=0x0;_0x1d38a4<_0x578cb8[_0x4f6b('0x5a')];_0x1d38a4++){if(_0x43e5b4!=''){_0x43e5b4+='&';}_0x43e5b4+=_0x578cb8[_0x1d38a4]+'='+encodeURIComponent(_0x220c76[_0x578cb8[_0x1d38a4]]);_0x33441d+=_0x220c76[_0x578cb8[_0x1d38a4]];}_0x33441d+=_0x15a869[_0x4f6b('0x56')];_0x33441d=_0x23caf2[_0x4f6b('0x5b')](_0x4f6b('0x5c'))[_0x4f6b('0x23')](_0x33441d)['digest']('hex');if(_0x43e5b4!==''){_0x43e5b4+='&';}_0x43e5b4+='signature='+_0x33441d;var _0x79fa6f={'method':'GET','uri':_0x15a869[_0x4f6b('0x4d')]+'/external/get/send.php?'+_0x43e5b4,'json':!![]};return rp(_0x79fa6f)[_0x4f6b('0x14')](function(_0x464986){var _0x4cb691=Object['keys'](_0x464986);if(_0x464986[_0x4cb691[0x0]]['error']&&parseInt(_0x464986[_0x4cb691[0x0]][_0x4f6b('0x24')])===0x0){var _0x35add2={'messageId':_0x464986[_0x4cb691[0x0]][_0x4f6b('0x5d')]};if(!_0x15a869[_0x4f6b('0x33')]){_0x35add2[_0x4f6b('0x34')]=!![];}return _0x59f7c7[_0x4f6b('0x23')](_0x35add2);}else{return logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),'csc',util['inspect'](_0x464986[_0x4f6b('0x24')],{'showHidden':![],'depth':null}));}})[_0x4f6b('0x16')](function(_0x221a8c){return logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),'csc',util[_0x4f6b('0x27')](_0x221a8c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4f6b('0x25'),'afterCreate',_0x4f6b('0x54'),'Missing\x20parameters:\x20apiKey');}break;case _0x4f6b('0x5e'):if(_0x15a869[_0x4f6b('0x56')]){var _0x1781ab={'method':'POST','uri':_0x4f6b('0x5f'),'headers':{'Authorization':_0x15a869[_0x4f6b('0x56')]},'body':{'content':_0x4b6295[_0x4f6b('0x2c')],'to':[_0x4b6295[_0x4f6b('0x1d')]],'from':_0x15a869['phone'],'binary':![],'clientMessageId':_0x4f6b('0x60'),'charset':_0x4f6b('0x61')},'json':!![]};rp(_0x1781ab)['then'](function(_0x53826b){if(!_0x53826b[_0x4f6b('0x24')]){var _0x16578f={'messageId':_0x53826b[_0x4f6b('0x52')][0x0][_0x4f6b('0x62')]};if(!_0x15a869[_0x4f6b('0x33')]){_0x16578f[_0x4f6b('0x34')]=!![];}return _0x59f7c7['update'](_0x16578f);}else{return logger[_0x4f6b('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4f6b('0x26'),_0x4f6b('0x5e'),util[_0x4f6b('0x27')](_0x53826b[_0x4f6b('0x24')],{'showHidden':![],'depth':null}));}})[_0x4f6b('0x16')](function(_0x434c0c){return logger[_0x4f6b('0x24')](_0x4f6b('0x25'),'afterCreate',_0x4f6b('0x5e'),util[_0x4f6b('0x27')](_0x434c0c,{'showHidden':![],'depth':null}));});}else{logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x5e'),_0x4f6b('0x63'));}break;case _0x4f6b('0x64'):if(_0x15a869[_0x4f6b('0x56')]){var _0x13ad40={};var _0x79fa6f={'method':'POST','uri':_0x4f6b('0x65'),'headers':{'Authorization':_0x4f6b('0x66')+_0x15a869[_0x4f6b('0x56')],'Content-Type':_0x4f6b('0x50')},'body':{'from':_0x15a869['phone'],'to':_0x4b6295[_0x4f6b('0x1d')],'text':_0x4b6295[_0x4f6b('0x2c')]},'json':!![]};return rp(_0x79fa6f)['then'](function(_0x5c2c18){if(_0x5c2c18[_0x4f6b('0x67')]==0xca){_0x13ad40[_0x4f6b('0x68')]=_0x5c2c18;var _0x316ed6={'method':'POST','uri':_0x4f6b('0x69'),'headers':{'Authorization':'Bearer\x20'+_0x15a869['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x13ad40[_0x4f6b('0x68')][_0x4f6b('0x6a')]},'json':!![]};return rp(_0x316ed6)[_0x4f6b('0x14')](function(_0x4cee2b){_0x13ad40[_0x4f6b('0x6b')]=_0x4cee2b;var _0x321c1a={'messageId':_0x13ad40['message'][_0x4f6b('0x6a')],'read':!![]};return _0x59f7c7[_0x4f6b('0x23')](_0x321c1a);});}else{return logger[_0x4f6b('0x24')](_0x4f6b('0x25'),_0x4f6b('0x26'),_0x4f6b('0x64'),util[_0x4f6b('0x27')](_0x5c2c18,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5500fa){return logger[_0x4f6b('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4f6b('0x26'),_0x4f6b('0x64'),util['inspect'](_0x5500fa,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x4f6b('0x25'),_0x4f6b('0x26'),'intelepeer',_0x4f6b('0x6c'));}break;}}})['finally'](function(){_0x224e61();});}else{_0x224e61();}}},'charset':_0x4f6b('0x6d'),'collate':_0x4f6b('0x6e')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index f9e9de8..0d27f45 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(_0x4981ed,_0x5ee4af){var _0x4134fa=function(_0x510ed9){while(--_0x510ed9){_0x4981ed['push'](_0x4981ed['shift']());}};_0x4134fa(++_0x5ee4af);}(_0xb10b,0x12a));var _0xbb10=function(_0x473d1e,_0x4df799){_0x473d1e=_0x473d1e-0x0;var _0x503be9=_0xb10b[_0x473d1e];return _0x503be9;};'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 _0x0b0e=['message','result','SmsMessage','create','body','options','CreateSmsMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s'];(function(_0x4de9bd,_0x45d424){var _0xb71232=function(_0x51b9c3){while(--_0x51b9c3){_0x4de9bd['push'](_0x4de9bd['shift']());}};_0xb71232(++_0x45d424);}(_0x0b0e,0x187));var _0xe0b0=function(_0x392dc2,_0x47c3f3){_0x392dc2=_0x392dc2-0x0;var _0x14150f=_0x0b0e[_0x392dc2];return _0x14150f;};'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});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateSmsMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateSmsMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1887e5b..ea9515d 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 _0x08ec=['emit','removeListener','register','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x08ec,0x164));var _0xc08e=function(_0x2cc294,_0x468722){_0x2cc294=_0x2cc294-0x0;var _0x1b068e=_0x08ec[_0x2cc294];return _0x1b068e;};'use strict';var SmsMessageEvents=require(_0xc08e('0x0'));var events=[_0xc08e('0x1'),_0xc08e('0x2'),_0xc08e('0x3')];function createListener(_0x543d18,_0x13c74d){return function(_0x40c0e2){_0x13c74d[_0xc08e('0x4')](_0x543d18,_0x40c0e2);};}function removeListener(_0xf2cf7a,_0x20e5ec){return function(){SmsMessageEvents[_0xc08e('0x5')](_0xf2cf7a,_0x20e5ec);};}exports[_0xc08e('0x6')]=function(_0x251554){for(var _0x495fa2=0x0,_0x4ba0b9=events['length'];_0x495fa2<_0x4ba0b9;_0x495fa2++){var _0x19d77f=events[_0x495fa2];var _0x2a4e60=createListener(_0xc08e('0x7')+_0x19d77f,_0x251554);SmsMessageEvents['on'](_0x19d77f,_0x2a4e60);}}; \ No newline at end of file +var _0x1459=['save','remove','update','register','smsMessage:','./smsMessage.events'];(function(_0x17b28b,_0x50a595){var _0x5aed68=function(_0x5005f3){while(--_0x5005f3){_0x17b28b['push'](_0x17b28b['shift']());}};_0x5aed68(++_0x50a595);}(_0x1459,0x185));var _0x9145=function(_0x4c2c07,_0x59f7df){_0x4c2c07=_0x4c2c07-0x0;var _0x2ea378=_0x1459[_0x4c2c07];return _0x2ea378;};'use strict';var SmsMessageEvents=require(_0x9145('0x0'));var events=[_0x9145('0x1'),_0x9145('0x2'),_0x9145('0x3')];function createListener(_0x3437cb,_0x2b1fba){return function(_0x282bd0){_0x2b1fba['emit'](_0x3437cb,_0x282bd0);};}function removeListener(_0x31b914,_0x26e690){return function(){SmsMessageEvents['removeListener'](_0x31b914,_0x26e690);};}exports[_0x9145('0x4')]=function(_0x583f99){for(var _0x123ce2=0x0,_0x35f311=events['length'];_0x123ce2<_0x35f311;_0x123ce2++){var _0x414550=events[_0x123ce2];var _0xb9d383=createListener(_0x9145('0x5')+_0x414550,_0x583f99);SmsMessageEvents['on'](_0x414550,_0xb9d383);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 1880828..cab1c91 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 _0x8411=['post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create'];(function(_0x1c9fab,_0x2787fe){var _0x57db79=function(_0x421789){while(--_0x421789){_0x1c9fab['push'](_0x1c9fab['shift']());}};_0x57db79(++_0x2787fe);}(_0x8411,0x118));var _0x1841=function(_0x2407c1,_0x442e31){_0x2407c1=_0x2407c1-0x0;var _0x1d85d9=_0x8411[_0x2407c1];return _0x1d85d9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1841('0x0'));var timeout=require(_0x1841('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x1841('0x2'));var interaction=require(_0x1841('0x3'));var config=require(_0x1841('0x4'));var controller=require(_0x1841('0x5'));router[_0x1841('0x6')]('/',auth['isAuthenticated'](),controller[_0x1841('0x7')]);router['get'](_0x1841('0x8'),auth[_0x1841('0x9')](),controller[_0x1841('0xa')]);router[_0x1841('0x6')](_0x1841('0xb'),auth[_0x1841('0x9')](),controller[_0x1841('0xc')]);router[_0x1841('0x6')](_0x1841('0xd'),auth[_0x1841('0x9')](),controller[_0x1841('0xe')]);router[_0x1841('0x6')](_0x1841('0xf'),auth[_0x1841('0x9')](),controller[_0x1841('0x10')]);router[_0x1841('0x6')](_0x1841('0x11'),auth[_0x1841('0x9')](),controller[_0x1841('0x12')]);router['post']('/',auth[_0x1841('0x9')](),controller[_0x1841('0x13')]);router[_0x1841('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1841('0x15')]);router[_0x1841('0x14')]('/:id/users',auth[_0x1841('0x9')](),controller[_0x1841('0x16')]);router[_0x1841('0x17')](_0x1841('0xb'),auth[_0x1841('0x9')](),controller[_0x1841('0x18')]);router['delete'](_0x1841('0xb'),auth[_0x1841('0x9')](),controller[_0x1841('0x19')]);router[_0x1841('0x1a')](_0x1841('0xf'),auth[_0x1841('0x9')](),controller[_0x1841('0x1b')]);router[_0x1841('0x1a')](_0x1841('0x11'),auth[_0x1841('0x9')](),controller[_0x1841('0x1c')]);module[_0x1841('0x1d')]=router; \ No newline at end of file +var _0xd8a5=['destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete'];(function(_0xf2267d,_0x10c87c){var _0x207e0d=function(_0x12b23d){while(--_0x12b23d){_0xf2267d['push'](_0xf2267d['shift']());}};_0x207e0d(++_0x10c87c);}(_0xd8a5,0x160));var _0x5d8a=function(_0x226a57,_0x3c5397){_0x226a57=_0x226a57-0x0;var _0xfcdbcc=_0xd8a5[_0x226a57];return _0xfcdbcc;};'use strict';var multer=require(_0x5d8a('0x0'));var util=require('util');var path=require(_0x5d8a('0x1'));var timeout=require(_0x5d8a('0x2'));var express=require('express');var router=express[_0x5d8a('0x3')]();var auth=require(_0x5d8a('0x4'));var interaction=require(_0x5d8a('0x5'));var config=require(_0x5d8a('0x6'));var controller=require(_0x5d8a('0x7'));router[_0x5d8a('0x8')]('/',auth[_0x5d8a('0x9')](),controller[_0x5d8a('0xa')]);router[_0x5d8a('0x8')](_0x5d8a('0xb'),auth[_0x5d8a('0x9')](),controller[_0x5d8a('0xc')]);router[_0x5d8a('0x8')]('/:id',auth[_0x5d8a('0x9')](),controller[_0x5d8a('0xd')]);router[_0x5d8a('0x8')](_0x5d8a('0xe'),auth[_0x5d8a('0x9')](),controller['getMembers']);router[_0x5d8a('0x8')](_0x5d8a('0xf'),auth[_0x5d8a('0x9')](),controller[_0x5d8a('0x10')]);router['get'](_0x5d8a('0x11'),auth[_0x5d8a('0x9')](),controller['getAgents']);router[_0x5d8a('0x12')]('/',auth[_0x5d8a('0x9')](),controller[_0x5d8a('0x13')]);router[_0x5d8a('0x12')](_0x5d8a('0xf'),auth[_0x5d8a('0x9')](),controller[_0x5d8a('0x14')]);router[_0x5d8a('0x12')](_0x5d8a('0x11'),auth[_0x5d8a('0x9')](),controller[_0x5d8a('0x15')]);router[_0x5d8a('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x5d8a('0x17')]);router[_0x5d8a('0x18')]('/:id',auth[_0x5d8a('0x9')](),controller[_0x5d8a('0x19')]);router[_0x5d8a('0x18')](_0x5d8a('0xf'),auth['isAuthenticated'](),controller[_0x5d8a('0x1a')]);router['delete'](_0x5d8a('0x11'),auth[_0x5d8a('0x9')](),controller[_0x5d8a('0x1b')]);module[_0x5d8a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 147a86e..6fa563a 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 _0x9fc5=['INTEGER','ENUM','rrmemory','beepall','sequelize','STRING','name'];(function(_0x4bc51b,_0x2fccc0){var _0x267ddf=function(_0x67df8f){while(--_0x67df8f){_0x4bc51b['push'](_0x4bc51b['shift']());}};_0x267ddf(++_0x2fccc0);}(_0x9fc5,0x123));var _0x59fc=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x9fc5[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0x59fc('0x0'));module['exports']={'name':{'type':Sequelize[_0x59fc('0x1')],'unique':_0x59fc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x59fc('0x1')]},'timeout':{'type':Sequelize[_0x59fc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x59fc('0x4')](_0x59fc('0x5'),_0x59fc('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x8be8=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x8be8,0x10b));var _0x88be=function(_0x200258,_0x5bdf12){_0x200258=_0x200258-0x0;var _0x1edc1d=_0x8be8[_0x200258];return _0x1edc1d;};'use strict';var Sequelize=require(_0x88be('0x0'));module[_0x88be('0x1')]={'name':{'type':Sequelize[_0x88be('0x2')],'unique':_0x88be('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x88be('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x88be('0x5'),_0x88be('0x6'),_0x88be('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 4d607a4..bc375c6 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 _0xf6f5=['agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','forEach','emit','userSmsQueue:save','removeTeams','tq.TeamId','from','team_has_sms_queues','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','union','compact','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','user','role','get','SmsQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','order','User','UserId'];(function(_0x4cbb43,_0x599116){var _0x2394c4=function(_0x53be97){while(--_0x53be97){_0x4cbb43['push'](_0x4cbb43['shift']());}};_0x2394c4(++_0x599116);}(_0xf6f5,0xb6));var _0x5f6f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf6f5[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x5f6f('0x0'));var emlformat=require(_0x5f6f('0x1'));var rimraf=require(_0x5f6f('0x2'));var zipdir=require(_0x5f6f('0x3'));var jsonpatch=require(_0x5f6f('0x4'));var rp=require(_0x5f6f('0x5'));var moment=require(_0x5f6f('0x6'));var BPromise=require(_0x5f6f('0x7'));var Mustache=require('mustache');var util=require(_0x5f6f('0x8'));var path=require(_0x5f6f('0x9'));var sox=require(_0x5f6f('0xa'));var csv=require(_0x5f6f('0xb'));var ejs=require(_0x5f6f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5f6f('0xd'));var crypto=require(_0x5f6f('0xe'));var jsforce=require(_0x5f6f('0xf'));var deskjs=require(_0x5f6f('0x10'));var toCsv=require(_0x5f6f('0xb'));var querystring=require(_0x5f6f('0x11'));var Papa=require(_0x5f6f('0x12'));var Redis=require(_0x5f6f('0x13'));var authService=require(_0x5f6f('0x14'));var qs=require(_0x5f6f('0x15'));var as=require(_0x5f6f('0x16'));var hardwareService=require(_0x5f6f('0x17'));var logger=require('../../config/logger')(_0x5f6f('0x18'));var utils=require('../../config/utils');var config=require(_0x5f6f('0x19'));var db=require(_0x5f6f('0x1a'))['db'];config[_0x5f6f('0x1b')]=_[_0x5f6f('0x1c')](config[_0x5f6f('0x1b')],{'host':_0x5f6f('0x1d'),'port':0x18eb});var socket=require(_0x5f6f('0x1e'))(new Redis(config[_0x5f6f('0x1b')]));require(_0x5f6f('0x1f'))[_0x5f6f('0x20')](socket);function respondWithStatusCode(_0x350e56,_0x401071){_0x401071=_0x401071||0xcc;return function(_0x555db4){if(_0x555db4){return _0x350e56[_0x5f6f('0x21')](_0x401071);}return _0x350e56[_0x5f6f('0x22')](_0x401071)[_0x5f6f('0x23')]();};}function respondWithResult(_0x2e51bc,_0x44ca9a){_0x44ca9a=_0x44ca9a||0xc8;return function(_0x39a0fe){if(_0x39a0fe){return _0x2e51bc[_0x5f6f('0x22')](_0x44ca9a)[_0x5f6f('0x24')](_0x39a0fe);}};}function respondWithFilteredResult(_0x555baf,_0x646d27){return function(_0x4027b8){if(_0x4027b8){var _0x35c838=_0x4027b8[_0x5f6f('0x25')],_0x5932da=_0x646d27[_0x5f6f('0x26')],_0x28b046=_0x646d27['offset']+_0x646d27[_0x5f6f('0x27')],_0x56766a;if(_0x28b046>=_0x35c838){_0x28b046=_0x35c838;_0x56766a=0xc8;}else{_0x56766a=0xce;}_0x555baf[_0x5f6f('0x22')](_0x56766a);return _0x555baf['set'](_0x5f6f('0x28'),_0x5932da+'-'+_0x28b046+'/'+_0x35c838)[_0x5f6f('0x24')](_0x4027b8);}return null;};}function patchUpdates(_0x359a66){return function(_0x1f0272){try{jsonpatch[_0x5f6f('0x29')](_0x1f0272,_0x359a66,!![]);}catch(_0x66320a){return BPromise[_0x5f6f('0x2a')](_0x66320a);}return _0x1f0272[_0x5f6f('0x2b')]();};}function saveUpdates(_0x1e1294,_0x3b0b22){return function(_0x469604){if(_0x469604){return _0x469604[_0x5f6f('0x2c')](_0x1e1294)[_0x5f6f('0x2d')](function(_0x1d82fc){return _0x1d82fc;});}return null;};}function removeEntity(_0x1926e0,_0x130950){return function(_0x348cfb){if(_0x348cfb){return _0x348cfb[_0x5f6f('0x2e')]()[_0x5f6f('0x2d')](function(){var _0x17608b=_0x348cfb['get']({'plain':!![]});var _0x32536a='SmsQueues';return db['UserProfileResource'][_0x5f6f('0x2e')]({'where':{'type':_0x32536a,'resourceId':_0x17608b['id']}})[_0x5f6f('0x2d')](function(){return _0x348cfb;});})['then'](function(){_0x1926e0[_0x5f6f('0x22')](0xcc)[_0x5f6f('0x23')]();});}};}function handleEntityNotFound(_0x1a36a9,_0x3a5ead){return function(_0x53f5d5){if(!_0x53f5d5){_0x1a36a9[_0x5f6f('0x21')](0x194);}return _0x53f5d5;};}function handleError(_0x2c52be,_0x12e9f1){_0x12e9f1=_0x12e9f1||0x1f4;return function(_0x12629f){logger[_0x5f6f('0x2f')](_0x12629f[_0x5f6f('0x30')]);if(_0x12629f[_0x5f6f('0x31')]){delete _0x12629f[_0x5f6f('0x31')];}_0x2c52be[_0x5f6f('0x22')](_0x12e9f1)[_0x5f6f('0x32')](_0x12629f);};}exports[_0x5f6f('0x33')]=function(_0x409621,_0x921e3){var _0x5ed9c1={},_0x205ac3={},_0x3859bc={'count':0x0,'rows':[]};var _0x428225=_[_0x5f6f('0x34')](db[_0x5f6f('0x35')][_0x5f6f('0x36')],function(_0x2e61dd){return{'name':_0x2e61dd[_0x5f6f('0x37')],'type':_0x2e61dd['type'][_0x5f6f('0x38')]};});_0x205ac3[_0x5f6f('0x39')]=_[_0x5f6f('0x34')](_0x428225,_0x5f6f('0x31'));_0x205ac3[_0x5f6f('0x3a')]=_['keys'](_0x409621[_0x5f6f('0x3a')]);_0x205ac3[_0x5f6f('0x3b')]=_[_0x5f6f('0x3c')](_0x205ac3[_0x5f6f('0x39')],_0x205ac3[_0x5f6f('0x3a')]);_0x5ed9c1[_0x5f6f('0x3d')]=_['intersection'](_0x205ac3[_0x5f6f('0x39')],qs[_0x5f6f('0x3e')](_0x409621['query']['fields']));_0x5ed9c1[_0x5f6f('0x3d')]=_0x5ed9c1[_0x5f6f('0x3d')]['length']?_0x5ed9c1[_0x5f6f('0x3d')]:_0x205ac3[_0x5f6f('0x39')];if(!_0x409621[_0x5f6f('0x3a')][_0x5f6f('0x3f')](_0x5f6f('0x40'))){_0x5ed9c1[_0x5f6f('0x27')]=qs['limit'](_0x409621['query'][_0x5f6f('0x27')]);_0x5ed9c1['offset']=qs[_0x5f6f('0x26')](_0x409621['query']['offset']);}_0x5ed9c1['order']=qs['sort'](_0x409621[_0x5f6f('0x3a')][_0x5f6f('0x41')]);_0x5ed9c1['where']=qs['filters'](_[_0x5f6f('0x42')](_0x409621['query'],_0x205ac3['filters']),_0x428225);if(_0x409621[_0x5f6f('0x3a')][_0x5f6f('0x43')]){_0x5ed9c1['where']=_[_0x5f6f('0x44')](_0x5ed9c1[_0x5f6f('0x45')],{'$or':_['map'](_0x428225,function(_0x278f2c){if(_0x278f2c[_0x5f6f('0x46')]!==_0x5f6f('0x47')){var _0x26842e={};_0x26842e[_0x278f2c[_0x5f6f('0x31')]]={'$like':'%'+_0x409621['query'][_0x5f6f('0x43')]+'%'};return _0x26842e;}})});}_0x5ed9c1=_[_0x5f6f('0x44')]({},_0x5ed9c1,_0x409621[_0x5f6f('0x48')]);var _0x243e36={'where':_0x5ed9c1['where']};return db[_0x5f6f('0x35')][_0x5f6f('0x25')](_0x243e36)[_0x5f6f('0x2d')](function(_0x5e31e1){_0x3859bc[_0x5f6f('0x25')]=_0x5e31e1;if(_0x409621[_0x5f6f('0x3a')][_0x5f6f('0x49')]){_0x5ed9c1[_0x5f6f('0x4a')]=[{'all':!![]}];}return db[_0x5f6f('0x35')][_0x5f6f('0x4b')](_0x5ed9c1);})[_0x5f6f('0x2d')](function(_0x2bd893){_0x3859bc[_0x5f6f('0x4c')]=_0x2bd893;return _0x3859bc;})[_0x5f6f('0x2d')](respondWithFilteredResult(_0x921e3,_0x5ed9c1))[_0x5f6f('0x4d')](handleError(_0x921e3,null));};exports[_0x5f6f('0x4e')]=function(_0x1fd7df,_0x700ee2){var _0x1542b0={'raw':!![],'where':{'id':_0x1fd7df[_0x5f6f('0x4f')]['id']}},_0x2b4ccb={};_0x2b4ccb[_0x5f6f('0x39')]=_['keys'](db[_0x5f6f('0x35')][_0x5f6f('0x36')]);_0x2b4ccb[_0x5f6f('0x3a')]=_[_0x5f6f('0x50')](_0x1fd7df['query']);_0x2b4ccb[_0x5f6f('0x3b')]=_[_0x5f6f('0x3c')](_0x2b4ccb[_0x5f6f('0x39')],_0x2b4ccb[_0x5f6f('0x3a')]);_0x1542b0[_0x5f6f('0x3d')]=_[_0x5f6f('0x3c')](_0x2b4ccb[_0x5f6f('0x39')],qs[_0x5f6f('0x3e')](_0x1fd7df[_0x5f6f('0x3a')][_0x5f6f('0x3e')]));_0x1542b0[_0x5f6f('0x3d')]=_0x1542b0[_0x5f6f('0x3d')][_0x5f6f('0x51')]?_0x1542b0[_0x5f6f('0x3d')]:_0x2b4ccb[_0x5f6f('0x39')];if(_0x1fd7df['query']['includeAll']){_0x1542b0[_0x5f6f('0x4a')]=[{'all':!![]}];}_0x1542b0=_[_0x5f6f('0x44')]({},_0x1542b0,_0x1fd7df[_0x5f6f('0x48')]);return db[_0x5f6f('0x35')][_0x5f6f('0x52')](_0x1542b0)[_0x5f6f('0x2d')](handleEntityNotFound(_0x700ee2,null))[_0x5f6f('0x2d')](respondWithResult(_0x700ee2,null))[_0x5f6f('0x4d')](handleError(_0x700ee2,null));};exports[_0x5f6f('0x53')]=function(_0x5e4b15,_0x2706dc){return db['SmsQueue'][_0x5f6f('0x53')](_0x5e4b15['body'],{})[_0x5f6f('0x2d')](function(_0x1eb8b3){var _0x3004d1=_0x5e4b15[_0x5f6f('0x54')]['get']({'plain':!![]});if(!_0x3004d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3004d1[_0x5f6f('0x55')]===_0x5f6f('0x54')){var _0x25344e=_0x1eb8b3[_0x5f6f('0x56')]({'plain':!![]});var _0xb94028=_0x5f6f('0x57');return db[_0x5f6f('0x58')][_0x5f6f('0x52')]({'where':{'name':_0xb94028,'userProfileId':_0x3004d1[_0x5f6f('0x59')]},'raw':!![]})['then'](function(_0x1fc2b2){if(_0x1fc2b2&&_0x1fc2b2['autoAssociation']===0x0){return db[_0x5f6f('0x5a')][_0x5f6f('0x53')]({'name':_0x25344e['name'],'resourceId':_0x25344e['id'],'type':_0x1fc2b2[_0x5f6f('0x31')],'sectionId':_0x1fc2b2['id']},{})[_0x5f6f('0x2d')](function(){return _0x1eb8b3;});}else{return _0x1eb8b3;}})[_0x5f6f('0x4d')](function(_0x3110c7){logger['error'](_0x5f6f('0x5b'),_0x3110c7);throw _0x3110c7;});}return _0x1eb8b3;})[_0x5f6f('0x2d')](respondWithResult(_0x2706dc,0xc9))['catch'](handleError(_0x2706dc,null));};exports[_0x5f6f('0x2c')]=function(_0x2ccb3d,_0xb2fb04){if(_0x2ccb3d['body']['id']){delete _0x2ccb3d[_0x5f6f('0x5c')]['id'];}return db[_0x5f6f('0x35')][_0x5f6f('0x52')]({'where':{'id':_0x2ccb3d['params']['id']}})[_0x5f6f('0x2d')](handleEntityNotFound(_0xb2fb04,null))[_0x5f6f('0x2d')](saveUpdates(_0x2ccb3d[_0x5f6f('0x5c')],null))[_0x5f6f('0x2d')](respondWithResult(_0xb2fb04,null))[_0x5f6f('0x4d')](handleError(_0xb2fb04,null));};exports[_0x5f6f('0x2e')]=function(_0x4a7114,_0x17a828){return db[_0x5f6f('0x35')][_0x5f6f('0x52')]({'where':{'id':_0x4a7114['params']['id']}})['then'](handleEntityNotFound(_0x17a828,null))[_0x5f6f('0x2d')](removeEntity(_0x17a828,null))[_0x5f6f('0x4d')](handleError(_0x17a828,null));};exports[_0x5f6f('0x5d')]=function(_0x227e0e,_0x1c83fd){return db[_0x5f6f('0x35')]['describe']()[_0x5f6f('0x2d')](respondWithResult(_0x1c83fd,null))[_0x5f6f('0x4d')](handleError(_0x1c83fd,null));};exports[_0x5f6f('0x5e')]=function(_0x562728,_0x244500,_0x16d28d){var _0x4c3a3f={'raw':!![],'where':{}},_0xe9121d={},_0xf1e4dc;return db[_0x5f6f('0x35')][_0x5f6f('0x5f')]({'where':{'id':_0x562728[_0x5f6f('0x4f')]['id']}})[_0x5f6f('0x2d')](handleEntityNotFound(_0x244500,null))[_0x5f6f('0x2d')](function(_0x978926){if(_0x978926){_0xf1e4dc=_0x978926['get']({'plain':!![]});_0xe9121d[_0x5f6f('0x39')]=_[_0x5f6f('0x50')](db[_0x5f6f('0x60')][_0x5f6f('0x36')]);_0xe9121d[_0x5f6f('0x3a')]=_[_0x5f6f('0x50')](_0x562728[_0x5f6f('0x3a')]);_0xe9121d['filters']=_[_0x5f6f('0x3c')](_0xe9121d[_0x5f6f('0x39')],_0xe9121d[_0x5f6f('0x3a')]);_0x4c3a3f[_0x5f6f('0x3d')]=_[_0x5f6f('0x3c')](_0xe9121d[_0x5f6f('0x39')],qs[_0x5f6f('0x3e')](_0x562728[_0x5f6f('0x3a')][_0x5f6f('0x3e')]));_0x4c3a3f['attributes']=_0x4c3a3f[_0x5f6f('0x3d')][_0x5f6f('0x51')]?_0x4c3a3f[_0x5f6f('0x3d')]:_0xe9121d[_0x5f6f('0x39')];if(!_0x562728['query'][_0x5f6f('0x3f')](_0x5f6f('0x40'))){_0x4c3a3f['limit']=qs[_0x5f6f('0x27')](_0x562728[_0x5f6f('0x3a')][_0x5f6f('0x27')]);_0x4c3a3f['offset']=qs[_0x5f6f('0x26')](_0x562728['query'][_0x5f6f('0x26')]);}_0x4c3a3f[_0x5f6f('0x61')]=qs[_0x5f6f('0x41')](_0x562728[_0x5f6f('0x3a')]['sort']);_0x4c3a3f[_0x5f6f('0x45')]=qs[_0x5f6f('0x3b')](_[_0x5f6f('0x42')](_0x562728[_0x5f6f('0x3a')],_0xe9121d[_0x5f6f('0x3b')]));_0x4c3a3f['where']['SmsQueueId']=_0x978926['id'];if(_0x562728[_0x5f6f('0x3a')][_0x5f6f('0x43')]){_0x4c3a3f[_0x5f6f('0x45')]=_[_0x5f6f('0x44')](_0x4c3a3f[_0x5f6f('0x45')],{'$or':_['map'](_0x4c3a3f['attributes'],function(_0x3e3f35){var _0x122ba4={};_0x122ba4[_0x3e3f35]={'$like':'%'+_0x562728[_0x5f6f('0x3a')][_0x5f6f('0x43')]+'%'};return _0x122ba4;})});}_0x4c3a3f=_[_0x5f6f('0x44')]({},_0x4c3a3f,_0x562728[_0x5f6f('0x48')]);return db[_0x5f6f('0x60')][_0x5f6f('0x4b')](_0x4c3a3f);}})[_0x5f6f('0x2d')](function(_0x3c1c3d){if(_0x3c1c3d){return db[_0x5f6f('0x62')]['findAndCountAll']({'where':{'id':_[_0x5f6f('0x34')](_0x3c1c3d,_0x5f6f('0x63')),'role':_0x5f6f('0x64')},'attributes':['id',_0x5f6f('0x31'),_0x5f6f('0x65'),'updatedAt',_0x5f6f('0x66')]});}})[_0x5f6f('0x2d')](function(_0x4ac720){if(_0x4ac720){return{'count':_0x4ac720[_0x5f6f('0x25')],'rows':_[_0x5f6f('0x34')](_0x4ac720['rows'],function(_0x28ba4c){return{'membername':_0x28ba4c['name'],'UserId':_0x28ba4c['id'],'queue_name':_0xf1e4dc[_0x5f6f('0x31')],'SmsQueueId':_0xf1e4dc['id'],'interface':util[_0x5f6f('0x67')](_0x5f6f('0x68'),_0x5f6f('0x69'),_0x28ba4c[_0x5f6f('0x31')]),'penalty':0x0,'paused':_0x28ba4c[_0x5f6f('0x65')],'createdAt':_0x28ba4c[_0x5f6f('0x66')],'updatedAt':_0x28ba4c[_0x5f6f('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5f6f('0x2d')](respondWithFilteredResult(_0x244500,_0x4c3a3f))[_0x5f6f('0x4d')](handleError(_0x244500,null));};exports[_0x5f6f('0x6b')]=function(_0x239e6a,_0x13e554,_0x12c6b8){var _0x30deac={};var _0x4a94ee={};var _0xa0f342;var _0x36a3af;return db[_0x5f6f('0x35')][_0x5f6f('0x5f')]({'where':{'id':_0x239e6a[_0x5f6f('0x4f')]['id']}})[_0x5f6f('0x2d')](handleEntityNotFound(_0x13e554,null))[_0x5f6f('0x2d')](function(_0x270615){if(_0x270615){_0xa0f342=_0x270615;_0x4a94ee[_0x5f6f('0x39')]=_[_0x5f6f('0x50')](db[_0x5f6f('0x6c')]['rawAttributes']);_0x4a94ee[_0x5f6f('0x3a')]=_[_0x5f6f('0x50')](_0x239e6a[_0x5f6f('0x3a')]);_0x4a94ee[_0x5f6f('0x3b')]=_['intersection'](_0x4a94ee[_0x5f6f('0x39')],_0x4a94ee[_0x5f6f('0x3a')]);_0x30deac[_0x5f6f('0x3d')]=_['intersection'](_0x4a94ee['model'],qs[_0x5f6f('0x3e')](_0x239e6a[_0x5f6f('0x3a')][_0x5f6f('0x3e')]));_0x30deac[_0x5f6f('0x3d')]=_0x30deac[_0x5f6f('0x3d')][_0x5f6f('0x51')]?_0x30deac['attributes']:_0x4a94ee[_0x5f6f('0x39')];_0x30deac[_0x5f6f('0x61')]=qs[_0x5f6f('0x41')](_0x239e6a[_0x5f6f('0x3a')][_0x5f6f('0x41')]);_0x30deac[_0x5f6f('0x45')]=qs[_0x5f6f('0x3b')](_[_0x5f6f('0x42')](_0x239e6a[_0x5f6f('0x3a')],_0x4a94ee[_0x5f6f('0x3b')]));if(_0x239e6a[_0x5f6f('0x3a')]['filter']){_0x30deac['where']=_[_0x5f6f('0x44')](_0x30deac['where'],{'$or':_[_0x5f6f('0x34')](_0x30deac[_0x5f6f('0x3d')],function(_0x3883a7){var _0x1856d8={};_0x1856d8[_0x3883a7]={'$like':'%'+_0x239e6a['query']['filter']+'%'};return _0x1856d8;})});}_0x30deac=_[_0x5f6f('0x44')]({},_0x30deac,_0x239e6a['options']);return _0xa0f342['getTeams'](_0x30deac);}})[_0x5f6f('0x2d')](function(_0x5b4e4b){if(_0x5b4e4b){_0x36a3af=_0x5b4e4b[_0x5f6f('0x51')];if(!_0x239e6a['query']['hasOwnProperty']('nolimit')){_0x30deac[_0x5f6f('0x27')]=qs[_0x5f6f('0x27')](_0x239e6a[_0x5f6f('0x3a')][_0x5f6f('0x27')]);_0x30deac[_0x5f6f('0x26')]=qs[_0x5f6f('0x26')](_0x239e6a['query'][_0x5f6f('0x26')]);}return _0xa0f342['getTeams'](_0x30deac);}})[_0x5f6f('0x2d')](function(_0x99a5a0){if(_0x99a5a0){return _0x99a5a0?{'count':_0x36a3af,'rows':_0x99a5a0}:null;}})[_0x5f6f('0x2d')](respondWithResult(_0x13e554,null))['catch'](handleError(_0x13e554,null));};exports[_0x5f6f('0x6d')]=function(_0x16bcb6,_0x2f4cb1,_0x3a1559){var _0x4413b8=_0x16bcb6['body'][_0x5f6f('0x6e')];return db[_0x5f6f('0x6c')][_0x5f6f('0x4b')]({'where':{'id':_0x4413b8},'attributes':['id'],'include':[{'model':db[_0x5f6f('0x62')],'as':_0x5f6f('0x6f'),'attributes':['id','name',_0x5f6f('0x70'),_0x5f6f('0x71'),_0x5f6f('0x72')],'raw':!![]}]})[_0x5f6f('0x2d')](function(_0x4e0032){if(_0x4e0032){var _0x1c6900=_[_0x5f6f('0x73')](_0x4e0032,function(_0x5f372c){var _0x1271d7=_0x5f372c[_0x5f6f('0x56')]({'plain':!![]});return _0x1271d7['Agents'];});return db[_0x5f6f('0x35')][_0x5f6f('0x52')]({'where':{'id':_0x16bcb6[_0x5f6f('0x4f')]['id']}})[_0x5f6f('0x2d')](function(_0x2c7c60){return db[_0x5f6f('0x74')]['transaction'](function(_0x3b68d4){return _0x2c7c60[_0x5f6f('0x6d')](_0x4413b8,{'transaction':_0x3b68d4})[_0x5f6f('0x2d')](function(){return BPromise['each'](_0x1c6900,function(_0x584342){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x584342['id'],'SmsQueueId':_0x16bcb6['params']['id']},'transaction':_0x3b68d4});});})[_0x5f6f('0x2d')](function(){_0x1c6900[_0x5f6f('0x75')](function(_0x405fce){socket[_0x5f6f('0x76')](_0x5f6f('0x77'),{'UserId':_0x405fce['id'],'SmsQueueId':_0x2c7c60['id']});});});});});}})[_0x5f6f('0x2d')](respondWithStatusCode(_0x2f4cb1,null))[_0x5f6f('0x4d')](handleError(_0x2f4cb1,null));};exports[_0x5f6f('0x78')]=function(_0x26fb5e,_0x1a1dcb,_0x4f03aa){return db[_0x5f6f('0x6c')]['findAll']({'where':{'id':_0x26fb5e[_0x5f6f('0x3a')][_0x5f6f('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5f6f('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x5f6f('0x2d')](handleEntityNotFound(_0x1a1dcb,null))['then'](function(_0xbda0fd){var _0x5747dc=_[_0x5f6f('0x34')](_0xbda0fd,'id');var _0x5cf052=[];var _0x5c2bc5=[];var _0xc91e1b=squel['select']();_0xc91e1b['field'](_0x5f6f('0x79'))[_0x5f6f('0x7a')](_0x5f6f('0x7b'),'tq')['join'](_0x5f6f('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5f6f('0x45')](_0x5f6f('0x7d'),_0x26fb5e['params']['id']);for(var _0x2e263c=0x0;_0x2e263c<_0xbda0fd[_0x5f6f('0x51')];_0x2e263c+=0x1){let _0x13e95e=_0xbda0fd[_0x2e263c];for(var _0x49b029=0x0;_0x49b029<_0x13e95e[_0x5f6f('0x6f')][_0x5f6f('0x51')];_0x49b029+=0x1){let _0xda1efa=_0x13e95e[_0x5f6f('0x6f')][_0x49b029];var _0x339511=_0xc91e1b['clone']();_0x339511['where'](_0x5f6f('0x7e'),_0xda1efa['id']);_0x5c2bc5['push'](db[_0x5f6f('0x74')][_0x5f6f('0x3a')](_0x339511[_0x5f6f('0x7f')](),{'type':db[_0x5f6f('0x74')][_0x5f6f('0x80')]['SELECT']})[_0x5f6f('0x2d')](function(_0x23232d){if(_0x23232d[_0x5f6f('0x51')]===0x1){return _0xda1efa['id'];}else{var _0x2b648f=_[_0x5f6f('0x81')](_['map'](_0x23232d,_0x5f6f('0x82')),function(_0x7b31f6){return _[_0x5f6f('0x83')](_0x5747dc,_0x7b31f6);});if(_0x2b648f){return _0xda1efa['id'];}}}));}}return BPromise['all'](_0x5c2bc5)['then'](function(_0x37c3c7){_0x5cf052=_(_0x5cf052)[_0x5f6f('0x84')](_0x37c3c7)[_0x5f6f('0x85')]()['value']();return db['SmsQueue']['find']({'where':{'id':_0x26fb5e[_0x5f6f('0x4f')]['id']}})[_0x5f6f('0x2d')](function(_0x4d2b8d){return db['sequelize']['transaction'](function(_0x279772){return _0x4d2b8d[_0x5f6f('0x78')](_0x26fb5e['query'][_0x5f6f('0x6e')],{'transaction':_0x279772})[_0x5f6f('0x2d')](function(){if(!_['isEmpty'](_0x5cf052)){return _0x4d2b8d[_0x5f6f('0x86')](_0x5cf052,{'transaction':_0x279772});}})[_0x5f6f('0x2d')](function(){_0x5cf052[_0x5f6f('0x75')](function(_0x4c7d0b){socket[_0x5f6f('0x76')](_0x5f6f('0x87'),{'UserId':_0x4c7d0b,'SmsQueueId':_0x4d2b8d['id']});});});});});});})[_0x5f6f('0x2d')](respondWithStatusCode(_0x1a1dcb,null))[_0x5f6f('0x4d')](handleError(_0x1a1dcb,null));};exports['addAgents']=function(_0x15933b,_0x3b1a21,_0x4d7de3){return db[_0x5f6f('0x35')]['find']({'where':{'id':_0x15933b['params']['id']}})[_0x5f6f('0x2d')](handleEntityNotFound(_0x3b1a21,null))[_0x5f6f('0x2d')](function(_0x189a37){if(_0x189a37){return _0x189a37[_0x5f6f('0x88')](_0x15933b['body'][_0x5f6f('0x6e')],_[_0x5f6f('0x89')](_0x15933b[_0x5f6f('0x5c')],[_0x5f6f('0x6e'),'id'])||{})[_0x5f6f('0x8a')](function(_0x18e3d6){for(var _0x1b3f20=0x0;_0x1b3f20<_0x15933b[_0x5f6f('0x5c')][_0x5f6f('0x6e')][_0x5f6f('0x51')];_0x1b3f20+=0x1){socket[_0x5f6f('0x76')]('userSmsQueue:save',{'UserId':_0x15933b[_0x5f6f('0x5c')][_0x5f6f('0x6e')][_0x1b3f20],'SmsQueueId':_0x15933b[_0x5f6f('0x4f')]['id']});}return _0x18e3d6;});}})['then'](respondWithResult(_0x3b1a21,null))['catch'](handleError(_0x3b1a21,null));};exports[_0x5f6f('0x86')]=function(_0xcdfaee,_0x2fca5f,_0x36847c){return db[_0x5f6f('0x35')]['find']({'where':{'id':_0xcdfaee['params']['id']}})[_0x5f6f('0x2d')](handleEntityNotFound(_0x2fca5f,null))[_0x5f6f('0x2d')](function(_0x37b128){if(_0x37b128){return _0x37b128[_0x5f6f('0x86')](_0xcdfaee[_0x5f6f('0x3a')][_0x5f6f('0x6e')])[_0x5f6f('0x2d')](function(){if(_[_0x5f6f('0x8b')](_0xcdfaee[_0x5f6f('0x3a')][_0x5f6f('0x6e')])){for(var _0x9cbe0=0x0;_0x9cbe0<_0xcdfaee[_0x5f6f('0x3a')]['ids'][_0x5f6f('0x51')];_0x9cbe0+=0x1){socket[_0x5f6f('0x76')]('userSmsQueue:remove',{'UserId':Number(_0xcdfaee[_0x5f6f('0x3a')][_0x5f6f('0x6e')][_0x9cbe0]),'SmsQueueId':Number(_0xcdfaee['params']['id'])});}}else{socket[_0x5f6f('0x76')](_0x5f6f('0x87'),{'UserId':Number(_0xcdfaee[_0x5f6f('0x3a')][_0x5f6f('0x6e')]),'SmsQueueId':Number(_0xcdfaee[_0x5f6f('0x4f')]['id'])});}});}})[_0x5f6f('0x2d')](respondWithStatusCode(_0x2fca5f,null))[_0x5f6f('0x4d')](handleError(_0x2fca5f,null));};exports[_0x5f6f('0x8c')]=function(_0x1aaab9,_0x17e44b,_0x18130f){var _0x5414eb={};var _0x28011f={};var _0x4e25bb;var _0x404dc1;return db[_0x5f6f('0x35')][_0x5f6f('0x5f')]({'where':{'id':_0x1aaab9['params']['id']}})[_0x5f6f('0x2d')](handleEntityNotFound(_0x17e44b,null))[_0x5f6f('0x2d')](function(_0x33ada9){if(_0x33ada9){_0x4e25bb=_0x33ada9;_0x28011f['model']=_[_0x5f6f('0x50')](db[_0x5f6f('0x62')][_0x5f6f('0x36')]);_0x28011f['query']=_['keys'](_0x1aaab9[_0x5f6f('0x3a')]);_0x28011f[_0x5f6f('0x3b')]=_['intersection'](_0x28011f[_0x5f6f('0x39')],_0x28011f[_0x5f6f('0x3a')]);_0x5414eb[_0x5f6f('0x3d')]=_['intersection'](_0x28011f['model'],qs['fields'](_0x1aaab9[_0x5f6f('0x3a')]['fields']));_0x5414eb[_0x5f6f('0x3d')]=_0x5414eb[_0x5f6f('0x3d')]['length']?_0x5414eb[_0x5f6f('0x3d')]:_0x28011f[_0x5f6f('0x39')];_0x5414eb[_0x5f6f('0x61')]=qs[_0x5f6f('0x41')](_0x1aaab9['query'][_0x5f6f('0x41')]);_0x5414eb[_0x5f6f('0x45')]=qs[_0x5f6f('0x3b')](_[_0x5f6f('0x42')](_0x1aaab9['query'],_0x28011f['filters']));if(_0x1aaab9['query'][_0x5f6f('0x43')]){_0x5414eb['where']=_[_0x5f6f('0x44')](_0x5414eb[_0x5f6f('0x45')],{'$or':_['map'](_0x5414eb['attributes'],function(_0x9d61be){var _0x5c740b={};_0x5c740b[_0x9d61be]={'$like':'%'+_0x1aaab9[_0x5f6f('0x3a')]['filter']+'%'};return _0x5c740b;})});}_0x5414eb=_[_0x5f6f('0x44')]({},_0x5414eb,_0x1aaab9['options']);return _0x4e25bb[_0x5f6f('0x8c')](_0x5414eb);}})[_0x5f6f('0x2d')](function(_0x5b05f4){if(_0x5b05f4){_0x404dc1=_0x5b05f4[_0x5f6f('0x51')];if(!_0x1aaab9[_0x5f6f('0x3a')][_0x5f6f('0x3f')](_0x5f6f('0x40'))){_0x5414eb['limit']=qs[_0x5f6f('0x27')](_0x1aaab9[_0x5f6f('0x3a')][_0x5f6f('0x27')]);_0x5414eb[_0x5f6f('0x26')]=qs['offset'](_0x1aaab9[_0x5f6f('0x3a')][_0x5f6f('0x26')]);}return _0x4e25bb[_0x5f6f('0x8c')](_0x5414eb);}})['then'](function(_0x438423){if(_0x438423){return _0x438423?{'count':_0x404dc1,'rows':_0x438423}:null;}})[_0x5f6f('0x2d')](respondWithResult(_0x17e44b,null))[_0x5f6f('0x4d')](handleError(_0x17e44b,null));}; \ No newline at end of file +var _0x593c=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAndCountAll','UserId','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','getTeams','addTeams','User','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','ids','select','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','moment','bluebird','util','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','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create'];(function(_0x37e39f,_0x426ea2){var _0x5754a6=function(_0x108d89){while(--_0x108d89){_0x37e39f['push'](_0x37e39f['shift']());}};_0x5754a6(++_0x426ea2);}(_0x593c,0x15f));var _0xc593=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x593c[_0x5e709a];return _0x57401a;};'use strict';var pdf=require(_0xc593('0x0'));var emlformat=require(_0xc593('0x1'));var rimraf=require(_0xc593('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc593('0x3'));var BPromise=require(_0xc593('0x4'));var Mustache=require('mustache');var util=require(_0xc593('0x5'));var path=require('path');var sox=require(_0xc593('0x6'));var csv=require(_0xc593('0x7'));var ejs=require(_0xc593('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc593('0x9'));var crypto=require(_0xc593('0xa'));var jsforce=require(_0xc593('0xb'));var deskjs=require(_0xc593('0xc'));var toCsv=require(_0xc593('0x7'));var querystring=require(_0xc593('0xd'));var Papa=require(_0xc593('0xe'));var Redis=require(_0xc593('0xf'));var authService=require(_0xc593('0x10'));var qs=require(_0xc593('0x11'));var as=require(_0xc593('0x12'));var hardwareService=require(_0xc593('0x13'));var logger=require(_0xc593('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc593('0x15'));var db=require(_0xc593('0x16'))['db'];config['redis']=_[_0xc593('0x17')](config[_0xc593('0x18')],{'host':_0xc593('0x19'),'port':0x18eb});var socket=require(_0xc593('0x1a'))(new Redis(config[_0xc593('0x18')]));require(_0xc593('0x1b'))[_0xc593('0x1c')](socket);function respondWithStatusCode(_0x1775a9,_0x131983){_0x131983=_0x131983||0xcc;return function(_0x4d0d79){if(_0x4d0d79){return _0x1775a9[_0xc593('0x1d')](_0x131983);}return _0x1775a9['status'](_0x131983)[_0xc593('0x1e')]();};}function respondWithResult(_0x48a549,_0xf28dfb){_0xf28dfb=_0xf28dfb||0xc8;return function(_0x5ada53){if(_0x5ada53){return _0x48a549[_0xc593('0x1f')](_0xf28dfb)[_0xc593('0x20')](_0x5ada53);}};}function respondWithFilteredResult(_0x406d73,_0x4aa2cc){return function(_0x1592ff){if(_0x1592ff){var _0x5d37e3=_0x1592ff[_0xc593('0x21')],_0x4314a1=_0x4aa2cc[_0xc593('0x22')],_0x26bf88=_0x4aa2cc[_0xc593('0x22')]+_0x4aa2cc[_0xc593('0x23')],_0x4741e8;if(_0x26bf88>=_0x5d37e3){_0x26bf88=_0x5d37e3;_0x4741e8=0xc8;}else{_0x4741e8=0xce;}_0x406d73[_0xc593('0x1f')](_0x4741e8);return _0x406d73[_0xc593('0x24')](_0xc593('0x25'),_0x4314a1+'-'+_0x26bf88+'/'+_0x5d37e3)[_0xc593('0x20')](_0x1592ff);}return null;};}function patchUpdates(_0x5d3e3b){return function(_0x41454e){try{jsonpatch[_0xc593('0x26')](_0x41454e,_0x5d3e3b,!![]);}catch(_0x29217e){return BPromise[_0xc593('0x27')](_0x29217e);}return _0x41454e[_0xc593('0x28')]();};}function saveUpdates(_0x427dea,_0x4f86aa){return function(_0x1c6224){if(_0x1c6224){return _0x1c6224[_0xc593('0x29')](_0x427dea)[_0xc593('0x2a')](function(_0x2c6ddb){return _0x2c6ddb;});}return null;};}function removeEntity(_0x1020e6,_0x57063a){return function(_0x53650a){if(_0x53650a){return _0x53650a['destroy']()[_0xc593('0x2a')](function(){var _0x388d0b=_0x53650a[_0xc593('0x2b')]({'plain':!![]});var _0x4c7573='SmsQueues';return db[_0xc593('0x2c')][_0xc593('0x2d')]({'where':{'type':_0x4c7573,'resourceId':_0x388d0b['id']}})['then'](function(){return _0x53650a;});})[_0xc593('0x2a')](function(){_0x1020e6[_0xc593('0x1f')](0xcc)[_0xc593('0x1e')]();});}};}function handleEntityNotFound(_0x1608b9,_0x382a23){return function(_0x42af51){if(!_0x42af51){_0x1608b9[_0xc593('0x1d')](0x194);}return _0x42af51;};}function handleError(_0x432e1b,_0x640d00){_0x640d00=_0x640d00||0x1f4;return function(_0x438482){logger[_0xc593('0x2e')](_0x438482[_0xc593('0x2f')]);if(_0x438482[_0xc593('0x30')]){delete _0x438482[_0xc593('0x30')];}_0x432e1b[_0xc593('0x1f')](_0x640d00)[_0xc593('0x31')](_0x438482);};}exports[_0xc593('0x32')]=function(_0x54a663,_0x935582){var _0x56ba23={},_0x1a6fef={},_0x4153bf={'count':0x0,'rows':[]};var _0x50a550=_['map'](db[_0xc593('0x33')][_0xc593('0x34')],function(_0x1eeb04){return{'name':_0x1eeb04[_0xc593('0x35')],'type':_0x1eeb04['type']['key']};});_0x1a6fef[_0xc593('0x36')]=_[_0xc593('0x37')](_0x50a550,_0xc593('0x30'));_0x1a6fef[_0xc593('0x38')]=_[_0xc593('0x39')](_0x54a663[_0xc593('0x38')]);_0x1a6fef[_0xc593('0x3a')]=_['intersection'](_0x1a6fef['model'],_0x1a6fef[_0xc593('0x38')]);_0x56ba23[_0xc593('0x3b')]=_[_0xc593('0x3c')](_0x1a6fef[_0xc593('0x36')],qs[_0xc593('0x3d')](_0x54a663[_0xc593('0x38')]['fields']));_0x56ba23[_0xc593('0x3b')]=_0x56ba23[_0xc593('0x3b')][_0xc593('0x3e')]?_0x56ba23[_0xc593('0x3b')]:_0x1a6fef[_0xc593('0x36')];if(!_0x54a663[_0xc593('0x38')][_0xc593('0x3f')](_0xc593('0x40'))){_0x56ba23[_0xc593('0x23')]=qs['limit'](_0x54a663['query'][_0xc593('0x23')]);_0x56ba23[_0xc593('0x22')]=qs[_0xc593('0x22')](_0x54a663['query'][_0xc593('0x22')]);}_0x56ba23[_0xc593('0x41')]=qs[_0xc593('0x42')](_0x54a663[_0xc593('0x38')]['sort']);_0x56ba23[_0xc593('0x43')]=qs[_0xc593('0x3a')](_[_0xc593('0x44')](_0x54a663[_0xc593('0x38')],_0x1a6fef[_0xc593('0x3a')]),_0x50a550);if(_0x54a663[_0xc593('0x38')][_0xc593('0x45')]){_0x56ba23[_0xc593('0x43')]=_[_0xc593('0x46')](_0x56ba23[_0xc593('0x43')],{'$or':_['map'](_0x50a550,function(_0x1d8656){if(_0x1d8656['type']!==_0xc593('0x47')){var _0x3394de={};_0x3394de[_0x1d8656[_0xc593('0x30')]]={'$like':'%'+_0x54a663[_0xc593('0x38')][_0xc593('0x45')]+'%'};return _0x3394de;}})});}_0x56ba23=_[_0xc593('0x46')]({},_0x56ba23,_0x54a663[_0xc593('0x48')]);var _0x1102e4={'where':_0x56ba23[_0xc593('0x43')]};return db['SmsQueue'][_0xc593('0x21')](_0x1102e4)[_0xc593('0x2a')](function(_0x241822){_0x4153bf[_0xc593('0x21')]=_0x241822;if(_0x54a663['query']['includeAll']){_0x56ba23[_0xc593('0x49')]=[{'all':!![]}];}return db[_0xc593('0x33')][_0xc593('0x4a')](_0x56ba23);})[_0xc593('0x2a')](function(_0x40afe7){_0x4153bf['rows']=_0x40afe7;return _0x4153bf;})['then'](respondWithFilteredResult(_0x935582,_0x56ba23))[_0xc593('0x4b')](handleError(_0x935582,null));};exports[_0xc593('0x4c')]=function(_0x17ae62,_0x1d3ffb){var _0x8a43a1={'raw':!![],'where':{'id':_0x17ae62[_0xc593('0x4d')]['id']}},_0x5732b1={};_0x5732b1[_0xc593('0x36')]=_[_0xc593('0x39')](db['SmsQueue'][_0xc593('0x34')]);_0x5732b1[_0xc593('0x38')]=_['keys'](_0x17ae62[_0xc593('0x38')]);_0x5732b1[_0xc593('0x3a')]=_[_0xc593('0x3c')](_0x5732b1[_0xc593('0x36')],_0x5732b1[_0xc593('0x38')]);_0x8a43a1[_0xc593('0x3b')]=_[_0xc593('0x3c')](_0x5732b1[_0xc593('0x36')],qs['fields'](_0x17ae62[_0xc593('0x38')][_0xc593('0x3d')]));_0x8a43a1[_0xc593('0x3b')]=_0x8a43a1[_0xc593('0x3b')][_0xc593('0x3e')]?_0x8a43a1['attributes']:_0x5732b1[_0xc593('0x36')];if(_0x17ae62[_0xc593('0x38')][_0xc593('0x4e')]){_0x8a43a1['include']=[{'all':!![]}];}_0x8a43a1=_[_0xc593('0x46')]({},_0x8a43a1,_0x17ae62[_0xc593('0x48')]);return db[_0xc593('0x33')][_0xc593('0x4f')](_0x8a43a1)[_0xc593('0x2a')](handleEntityNotFound(_0x1d3ffb,null))[_0xc593('0x2a')](respondWithResult(_0x1d3ffb,null))['catch'](handleError(_0x1d3ffb,null));};exports[_0xc593('0x50')]=function(_0x22b4e0,_0x4fcb2a){return db['SmsQueue']['create'](_0x22b4e0[_0xc593('0x51')],{})[_0xc593('0x2a')](function(_0x5b81ab){var _0x4d665a=_0x22b4e0['user']['get']({'plain':!![]});if(!_0x4d665a)throw new Error(_0xc593('0x52'));if(_0x4d665a[_0xc593('0x53')]===_0xc593('0x54')){var _0x3d7344=_0x5b81ab['get']({'plain':!![]});var _0x1af776=_0xc593('0x55');return db[_0xc593('0x56')][_0xc593('0x4f')]({'where':{'name':_0x1af776,'userProfileId':_0x4d665a['userProfileId']},'raw':!![]})[_0xc593('0x2a')](function(_0x45c83e){if(_0x45c83e&&_0x45c83e[_0xc593('0x57')]===0x0){return db[_0xc593('0x2c')]['create']({'name':_0x3d7344[_0xc593('0x30')],'resourceId':_0x3d7344['id'],'type':_0x45c83e[_0xc593('0x30')],'sectionId':_0x45c83e['id']},{})['then'](function(){return _0x5b81ab;});}else{return _0x5b81ab;}})[_0xc593('0x4b')](function(_0x4334d2){logger[_0xc593('0x2e')](_0xc593('0x58'),_0x4334d2);throw _0x4334d2;});}return _0x5b81ab;})[_0xc593('0x2a')](respondWithResult(_0x4fcb2a,0xc9))[_0xc593('0x4b')](handleError(_0x4fcb2a,null));};exports['update']=function(_0x28adcf,_0x54497e){if(_0x28adcf['body']['id']){delete _0x28adcf['body']['id'];}return db['SmsQueue']['find']({'where':{'id':_0x28adcf[_0xc593('0x4d')]['id']}})['then'](handleEntityNotFound(_0x54497e,null))['then'](saveUpdates(_0x28adcf['body'],null))['then'](respondWithResult(_0x54497e,null))[_0xc593('0x4b')](handleError(_0x54497e,null));};exports['destroy']=function(_0x1798df,_0x231c1d){return db[_0xc593('0x33')][_0xc593('0x4f')]({'where':{'id':_0x1798df['params']['id']}})[_0xc593('0x2a')](handleEntityNotFound(_0x231c1d,null))[_0xc593('0x2a')](removeEntity(_0x231c1d,null))[_0xc593('0x4b')](handleError(_0x231c1d,null));};exports[_0xc593('0x59')]=function(_0x351b59,_0xfbd45e){return db[_0xc593('0x33')][_0xc593('0x59')]()[_0xc593('0x2a')](respondWithResult(_0xfbd45e,null))[_0xc593('0x4b')](handleError(_0xfbd45e,null));};exports[_0xc593('0x5a')]=function(_0x53826d,_0x2e0aa0,_0x259097){var _0x2e00a2={'raw':!![],'where':{}},_0x2ab306={},_0x5f2abc;return db['SmsQueue'][_0xc593('0x5b')]({'where':{'id':_0x53826d[_0xc593('0x4d')]['id']}})[_0xc593('0x2a')](handleEntityNotFound(_0x2e0aa0,null))['then'](function(_0x13f157){if(_0x13f157){_0x5f2abc=_0x13f157[_0xc593('0x2b')]({'plain':!![]});_0x2ab306[_0xc593('0x36')]=_['keys'](db[_0xc593('0x5c')][_0xc593('0x34')]);_0x2ab306[_0xc593('0x38')]=_[_0xc593('0x39')](_0x53826d['query']);_0x2ab306[_0xc593('0x3a')]=_[_0xc593('0x3c')](_0x2ab306[_0xc593('0x36')],_0x2ab306[_0xc593('0x38')]);_0x2e00a2[_0xc593('0x3b')]=_[_0xc593('0x3c')](_0x2ab306[_0xc593('0x36')],qs[_0xc593('0x3d')](_0x53826d[_0xc593('0x38')][_0xc593('0x3d')]));_0x2e00a2[_0xc593('0x3b')]=_0x2e00a2[_0xc593('0x3b')]['length']?_0x2e00a2[_0xc593('0x3b')]:_0x2ab306[_0xc593('0x36')];if(!_0x53826d[_0xc593('0x38')][_0xc593('0x3f')](_0xc593('0x40'))){_0x2e00a2[_0xc593('0x23')]=qs['limit'](_0x53826d[_0xc593('0x38')][_0xc593('0x23')]);_0x2e00a2[_0xc593('0x22')]=qs[_0xc593('0x22')](_0x53826d['query']['offset']);}_0x2e00a2[_0xc593('0x41')]=qs[_0xc593('0x42')](_0x53826d[_0xc593('0x38')][_0xc593('0x42')]);_0x2e00a2['where']=qs[_0xc593('0x3a')](_['pick'](_0x53826d['query'],_0x2ab306['filters']));_0x2e00a2['where'][_0xc593('0x5d')]=_0x13f157['id'];if(_0x53826d[_0xc593('0x38')]['filter']){_0x2e00a2['where']=_[_0xc593('0x46')](_0x2e00a2[_0xc593('0x43')],{'$or':_[_0xc593('0x37')](_0x2e00a2[_0xc593('0x3b')],function(_0x348117){var _0x33a5ee={};_0x33a5ee[_0x348117]={'$like':'%'+_0x53826d['query'][_0xc593('0x45')]+'%'};return _0x33a5ee;})});}_0x2e00a2=_['merge']({},_0x2e00a2,_0x53826d['options']);return db[_0xc593('0x5c')][_0xc593('0x4a')](_0x2e00a2);}})[_0xc593('0x2a')](function(_0x34d878){if(_0x34d878){return db['User'][_0xc593('0x5e')]({'where':{'id':_[_0xc593('0x37')](_0x34d878,_0xc593('0x5f')),'role':'agent'},'attributes':['id',_0xc593('0x30'),_0xc593('0x60'),_0xc593('0x61'),_0xc593('0x62')]});}})[_0xc593('0x2a')](function(_0x3e5a59){if(_0x3e5a59){return{'count':_0x3e5a59[_0xc593('0x21')],'rows':_[_0xc593('0x37')](_0x3e5a59[_0xc593('0x63')],function(_0xc9dc2e){return{'membername':_0xc9dc2e[_0xc593('0x30')],'UserId':_0xc9dc2e['id'],'queue_name':_0x5f2abc[_0xc593('0x30')],'SmsQueueId':_0x5f2abc['id'],'interface':util[_0xc593('0x64')](_0xc593('0x65'),_0xc593('0x66'),_0xc9dc2e[_0xc593('0x30')]),'penalty':0x0,'paused':_0xc9dc2e[_0xc593('0x60')],'createdAt':_0xc9dc2e[_0xc593('0x62')],'updatedAt':_0xc9dc2e[_0xc593('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc593('0x2a')](respondWithFilteredResult(_0x2e0aa0,_0x2e00a2))[_0xc593('0x4b')](handleError(_0x2e0aa0,null));};exports['getTeams']=function(_0x5951a1,_0x1bf482,_0x1441f5){var _0x1ec6bf={};var _0x20cb83={};var _0x147af1;var _0x605c60;return db[_0xc593('0x33')][_0xc593('0x5b')]({'where':{'id':_0x5951a1[_0xc593('0x4d')]['id']}})[_0xc593('0x2a')](handleEntityNotFound(_0x1bf482,null))['then'](function(_0x544d43){if(_0x544d43){_0x147af1=_0x544d43;_0x20cb83[_0xc593('0x36')]=_['keys'](db[_0xc593('0x67')]['rawAttributes']);_0x20cb83[_0xc593('0x38')]=_['keys'](_0x5951a1[_0xc593('0x38')]);_0x20cb83[_0xc593('0x3a')]=_[_0xc593('0x3c')](_0x20cb83['model'],_0x20cb83[_0xc593('0x38')]);_0x1ec6bf[_0xc593('0x3b')]=_[_0xc593('0x3c')](_0x20cb83[_0xc593('0x36')],qs[_0xc593('0x3d')](_0x5951a1[_0xc593('0x38')][_0xc593('0x3d')]));_0x1ec6bf[_0xc593('0x3b')]=_0x1ec6bf[_0xc593('0x3b')][_0xc593('0x3e')]?_0x1ec6bf[_0xc593('0x3b')]:_0x20cb83['model'];_0x1ec6bf[_0xc593('0x41')]=qs[_0xc593('0x42')](_0x5951a1[_0xc593('0x38')][_0xc593('0x42')]);_0x1ec6bf[_0xc593('0x43')]=qs[_0xc593('0x3a')](_[_0xc593('0x44')](_0x5951a1[_0xc593('0x38')],_0x20cb83[_0xc593('0x3a')]));if(_0x5951a1['query']['filter']){_0x1ec6bf[_0xc593('0x43')]=_[_0xc593('0x46')](_0x1ec6bf[_0xc593('0x43')],{'$or':_[_0xc593('0x37')](_0x1ec6bf[_0xc593('0x3b')],function(_0x3047ec){var _0x1f4286={};_0x1f4286[_0x3047ec]={'$like':'%'+_0x5951a1[_0xc593('0x38')][_0xc593('0x45')]+'%'};return _0x1f4286;})});}_0x1ec6bf=_[_0xc593('0x46')]({},_0x1ec6bf,_0x5951a1[_0xc593('0x48')]);return _0x147af1['getTeams'](_0x1ec6bf);}})[_0xc593('0x2a')](function(_0x409de4){if(_0x409de4){_0x605c60=_0x409de4[_0xc593('0x3e')];if(!_0x5951a1[_0xc593('0x38')][_0xc593('0x3f')](_0xc593('0x40'))){_0x1ec6bf[_0xc593('0x23')]=qs['limit'](_0x5951a1[_0xc593('0x38')][_0xc593('0x23')]);_0x1ec6bf[_0xc593('0x22')]=qs['offset'](_0x5951a1[_0xc593('0x38')][_0xc593('0x22')]);}return _0x147af1[_0xc593('0x68')](_0x1ec6bf);}})[_0xc593('0x2a')](function(_0x57dda6){if(_0x57dda6){return _0x57dda6?{'count':_0x605c60,'rows':_0x57dda6}:null;}})['then'](respondWithResult(_0x1bf482,null))[_0xc593('0x4b')](handleError(_0x1bf482,null));};exports[_0xc593('0x69')]=function(_0x5da371,_0x1d7c96,_0x23a5c5){var _0x55c8e4=_0x5da371[_0xc593('0x51')]['ids'];return db[_0xc593('0x67')][_0xc593('0x4a')]({'where':{'id':_0x55c8e4},'attributes':['id'],'include':[{'model':db[_0xc593('0x6a')],'as':_0xc593('0x6b'),'attributes':['id',_0xc593('0x30'),_0xc593('0x6c'),_0xc593('0x6d'),'interface'],'raw':!![]}]})[_0xc593('0x2a')](function(_0x3125a4){if(_0x3125a4){var _0xefb06f=_[_0xc593('0x6e')](_0x3125a4,function(_0x1ccdd6){var _0x44d662=_0x1ccdd6[_0xc593('0x2b')]({'plain':!![]});return _0x44d662[_0xc593('0x6b')];});return db['SmsQueue'][_0xc593('0x4f')]({'where':{'id':_0x5da371[_0xc593('0x4d')]['id']}})['then'](function(_0x14e568){return db['sequelize'][_0xc593('0x6f')](function(_0x2228da){return _0x14e568['addTeams'](_0x55c8e4,{'transaction':_0x2228da})[_0xc593('0x2a')](function(){return BPromise[_0xc593('0x70')](_0xefb06f,function(_0x109df7){return db[_0xc593('0x5c')][_0xc593('0x71')]({'where':{'UserId':_0x109df7['id'],'SmsQueueId':_0x5da371['params']['id']},'transaction':_0x2228da});});})[_0xc593('0x2a')](function(){_0xefb06f[_0xc593('0x72')](function(_0x5816d3){socket[_0xc593('0x73')](_0xc593('0x74'),{'UserId':_0x5816d3['id'],'SmsQueueId':_0x14e568['id']});});});});});}})[_0xc593('0x2a')](respondWithStatusCode(_0x1d7c96,null))[_0xc593('0x4b')](handleError(_0x1d7c96,null));};exports['removeTeams']=function(_0x8a0812,_0x3a5d6e,_0x53290f){return db['Team'][_0xc593('0x4a')]({'where':{'id':_0x8a0812['query'][_0xc593('0x75')]},'attributes':['id'],'include':[{'model':db[_0xc593('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc593('0x2a')](handleEntityNotFound(_0x3a5d6e,null))[_0xc593('0x2a')](function(_0x33373b){var _0x361ff8=_[_0xc593('0x37')](_0x33373b,'id');var _0x3ad479=[];var _0x39facc=[];var _0x205520=squel[_0xc593('0x76')]();_0x205520['field'](_0xc593('0x77'))[_0xc593('0x78')](_0xc593('0x79'),'tq')[_0xc593('0x7a')](_0xc593('0x7b'),'ut',_0xc593('0x7c'))['where']('SmsQueueId\x20=\x20?',_0x8a0812[_0xc593('0x4d')]['id']);for(var _0x23938e=0x0;_0x23938e<_0x33373b[_0xc593('0x3e')];_0x23938e+=0x1){let _0x314716=_0x33373b[_0x23938e];for(var _0x7e054f=0x0;_0x7e054f<_0x314716[_0xc593('0x6b')][_0xc593('0x3e')];_0x7e054f+=0x1){let _0x3357c2=_0x314716[_0xc593('0x6b')][_0x7e054f];var _0x3d6bdf=_0x205520['clone']();_0x3d6bdf[_0xc593('0x43')](_0xc593('0x7d'),_0x3357c2['id']);_0x39facc['push'](db[_0xc593('0x7e')]['query'](_0x3d6bdf['toString'](),{'type':db[_0xc593('0x7e')][_0xc593('0x7f')][_0xc593('0x80')]})['then'](function(_0x2d1355){if(_0x2d1355['length']===0x1){return _0x3357c2['id'];}else{var _0x3cb8b4=_[_0xc593('0x81')](_[_0xc593('0x37')](_0x2d1355,_0xc593('0x82')),function(_0xf53c29){return _[_0xc593('0x83')](_0x361ff8,_0xf53c29);});if(_0x3cb8b4){return _0x3357c2['id'];}}}));}}return BPromise[_0xc593('0x84')](_0x39facc)[_0xc593('0x2a')](function(_0x4ebe2e){_0x3ad479=_(_0x3ad479)[_0xc593('0x85')](_0x4ebe2e)['compact']()[_0xc593('0x86')]();return db['SmsQueue'][_0xc593('0x4f')]({'where':{'id':_0x8a0812[_0xc593('0x4d')]['id']}})[_0xc593('0x2a')](function(_0x575a6f){return db['sequelize'][_0xc593('0x6f')](function(_0x5ab3d6){return _0x575a6f[_0xc593('0x87')](_0x8a0812[_0xc593('0x38')]['ids'],{'transaction':_0x5ab3d6})[_0xc593('0x2a')](function(){if(!_[_0xc593('0x88')](_0x3ad479)){return _0x575a6f[_0xc593('0x89')](_0x3ad479,{'transaction':_0x5ab3d6});}})[_0xc593('0x2a')](function(){_0x3ad479[_0xc593('0x72')](function(_0xaa028a){socket['emit']('userSmsQueue:remove',{'UserId':_0xaa028a,'SmsQueueId':_0x575a6f['id']});});});});});});})['then'](respondWithStatusCode(_0x3a5d6e,null))['catch'](handleError(_0x3a5d6e,null));};exports[_0xc593('0x8a')]=function(_0x22f74b,_0x3e8285,_0x1f4645){return db[_0xc593('0x33')]['find']({'where':{'id':_0x22f74b[_0xc593('0x4d')]['id']}})[_0xc593('0x2a')](handleEntityNotFound(_0x3e8285,null))['then'](function(_0x3d3c56){if(_0x3d3c56){return _0x3d3c56[_0xc593('0x8a')](_0x22f74b[_0xc593('0x51')][_0xc593('0x75')],_[_0xc593('0x8b')](_0x22f74b['body'],[_0xc593('0x75'),'id'])||{})[_0xc593('0x8c')](function(_0x4159e2){for(var _0xcea3e5=0x0;_0xcea3e5<_0x22f74b[_0xc593('0x51')][_0xc593('0x75')][_0xc593('0x3e')];_0xcea3e5+=0x1){socket['emit'](_0xc593('0x74'),{'UserId':_0x22f74b['body'][_0xc593('0x75')][_0xcea3e5],'SmsQueueId':_0x22f74b[_0xc593('0x4d')]['id']});}return _0x4159e2;});}})[_0xc593('0x2a')](respondWithResult(_0x3e8285,null))[_0xc593('0x4b')](handleError(_0x3e8285,null));};exports[_0xc593('0x89')]=function(_0x2a61d6,_0x422728,_0x425ae3){return db[_0xc593('0x33')]['find']({'where':{'id':_0x2a61d6[_0xc593('0x4d')]['id']}})[_0xc593('0x2a')](handleEntityNotFound(_0x422728,null))['then'](function(_0x526181){if(_0x526181){return _0x526181[_0xc593('0x89')](_0x2a61d6['query']['ids'])[_0xc593('0x2a')](function(){if(_[_0xc593('0x8d')](_0x2a61d6[_0xc593('0x38')][_0xc593('0x75')])){for(var _0x2d3e5d=0x0;_0x2d3e5d<_0x2a61d6[_0xc593('0x38')][_0xc593('0x75')]['length'];_0x2d3e5d+=0x1){socket[_0xc593('0x73')](_0xc593('0x8e'),{'UserId':Number(_0x2a61d6[_0xc593('0x38')][_0xc593('0x75')][_0x2d3e5d]),'SmsQueueId':Number(_0x2a61d6[_0xc593('0x4d')]['id'])});}}else{socket[_0xc593('0x73')](_0xc593('0x8e'),{'UserId':Number(_0x2a61d6['query'][_0xc593('0x75')]),'SmsQueueId':Number(_0x2a61d6['params']['id'])});}});}})[_0xc593('0x2a')](respondWithStatusCode(_0x422728,null))[_0xc593('0x4b')](handleError(_0x422728,null));};exports[_0xc593('0x8f')]=function(_0x55b80c,_0x3e5bf7,_0x23717e){var _0x533ec9={};var _0x53b4d0={};var _0x50a5c2;var _0x4131cb;return db[_0xc593('0x33')]['findOne']({'where':{'id':_0x55b80c[_0xc593('0x4d')]['id']}})[_0xc593('0x2a')](handleEntityNotFound(_0x3e5bf7,null))[_0xc593('0x2a')](function(_0x150b50){if(_0x150b50){_0x50a5c2=_0x150b50;_0x53b4d0[_0xc593('0x36')]=_[_0xc593('0x39')](db[_0xc593('0x6a')][_0xc593('0x34')]);_0x53b4d0['query']=_['keys'](_0x55b80c[_0xc593('0x38')]);_0x53b4d0['filters']=_[_0xc593('0x3c')](_0x53b4d0['model'],_0x53b4d0[_0xc593('0x38')]);_0x533ec9[_0xc593('0x3b')]=_[_0xc593('0x3c')](_0x53b4d0[_0xc593('0x36')],qs[_0xc593('0x3d')](_0x55b80c['query']['fields']));_0x533ec9[_0xc593('0x3b')]=_0x533ec9[_0xc593('0x3b')][_0xc593('0x3e')]?_0x533ec9[_0xc593('0x3b')]:_0x53b4d0[_0xc593('0x36')];_0x533ec9[_0xc593('0x41')]=qs['sort'](_0x55b80c[_0xc593('0x38')]['sort']);_0x533ec9['where']=qs[_0xc593('0x3a')](_[_0xc593('0x44')](_0x55b80c[_0xc593('0x38')],_0x53b4d0['filters']));if(_0x55b80c[_0xc593('0x38')][_0xc593('0x45')]){_0x533ec9[_0xc593('0x43')]=_[_0xc593('0x46')](_0x533ec9[_0xc593('0x43')],{'$or':_[_0xc593('0x37')](_0x533ec9[_0xc593('0x3b')],function(_0x186484){var _0x4e8613={};_0x4e8613[_0x186484]={'$like':'%'+_0x55b80c[_0xc593('0x38')][_0xc593('0x45')]+'%'};return _0x4e8613;})});}_0x533ec9=_[_0xc593('0x46')]({},_0x533ec9,_0x55b80c[_0xc593('0x48')]);return _0x50a5c2[_0xc593('0x8f')](_0x533ec9);}})[_0xc593('0x2a')](function(_0x5addc6){if(_0x5addc6){_0x4131cb=_0x5addc6['length'];if(!_0x55b80c[_0xc593('0x38')][_0xc593('0x3f')](_0xc593('0x40'))){_0x533ec9['limit']=qs[_0xc593('0x23')](_0x55b80c['query'][_0xc593('0x23')]);_0x533ec9[_0xc593('0x22')]=qs[_0xc593('0x22')](_0x55b80c['query'][_0xc593('0x22')]);}return _0x50a5c2[_0xc593('0x8f')](_0x533ec9);}})[_0xc593('0x2a')](function(_0x1d831b){if(_0x1d831b){return _0x1d831b?{'count':_0x4131cb,'rows':_0x1d831b}:null;}})[_0xc593('0x2a')](respondWithResult(_0x3e5bf7,null))[_0xc593('0x4b')](handleError(_0x3e5bf7,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index fb114cb..ac8acde 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 _0x7d4d=['exports','../../mysqldb','SmsQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x53274b,_0x176dda){var _0x40382c=function(_0x929aa7){while(--_0x929aa7){_0x53274b['push'](_0x53274b['shift']());}};_0x40382c(++_0x176dda);}(_0x7d4d,0xd9));var _0xd7d4=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0x7d4d[_0x2e2681];return _0x368a64;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xd7d4('0x0'))['db'][_0xd7d4('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd7d4('0x2')](0x0);var events={'afterCreate':_0xd7d4('0x3'),'afterUpdate':_0xd7d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x246f54){return function(_0x265647,_0x221827,_0x49b826){SmsQueueEvents[_0xd7d4('0x5')](_0x246f54+':'+_0x265647['id'],_0x265647);SmsQueueEvents[_0xd7d4('0x5')](_0x246f54,_0x265647);_0x49b826(null);};}for(var e in events){if(events[_0xd7d4('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xd7d4('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xe607=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2fae72,_0x19ddcd){var _0x5322ee=function(_0x1f1b46){while(--_0x1f1b46){_0x2fae72['push'](_0x2fae72['shift']());}};_0x5322ee(++_0x19ddcd);}(_0xe607,0x7f));var _0x7e60=function(_0x23c168,_0x57cc87){_0x23c168=_0x23c168-0x0;var _0x5dca4a=_0xe607[_0x23c168];return _0x5dca4a;};'use strict';var EventEmitter=require(_0x7e60('0x0'));var SmsQueue=require(_0x7e60('0x1'))['db'][_0x7e60('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x7e60('0x3')](0x0);var events={'afterCreate':_0x7e60('0x4'),'afterUpdate':'update','afterDestroy':_0x7e60('0x5')};function emitEvent(_0x218dda){return function(_0x53675d,_0x20c1df,_0x324af1){SmsQueueEvents['emit'](_0x218dda+':'+_0x53675d['id'],_0x53675d);SmsQueueEvents[_0x7e60('0x6')](_0x218dda,_0x53675d);_0x324af1(null);};}for(var e in events){if(events[_0x7e60('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x7e60('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 f488125..93164f5 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 _0xe186=['bluebird','request-promise','path','../../config/environment','exports','sms_queues','lodash','util','api','moment'];(function(_0x110f4b,_0x1f5cf6){var _0x28b50c=function(_0x4df190){while(--_0x4df190){_0x110f4b['push'](_0x110f4b['shift']());}};_0x28b50c(++_0x1f5cf6);}(_0xe186,0x146));var _0x6e18=function(_0x427d1b,_0x2f2ec2){_0x427d1b=_0x427d1b-0x0;var _0x646c3f=_0xe186[_0x427d1b];return _0x646c3f;};'use strict';var _=require(_0x6e18('0x0'));var util=require(_0x6e18('0x1'));var logger=require('../../config/logger')(_0x6e18('0x2'));var moment=require(_0x6e18('0x3'));var BPromise=require(_0x6e18('0x4'));var rp=require(_0x6e18('0x5'));var fs=require('fs');var path=require(_0x6e18('0x6'));var rimraf=require('rimraf');var config=require(_0x6e18('0x7'));var attributes=require('./smsQueue.attributes');module[_0x6e18('0x8')]=function(_0x1bafb5,_0x1b9e15){return _0x1bafb5['define']('SmsQueue',attributes,{'tableName':_0x6e18('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa44a=['rimraf','exports','define','sms_queues','lodash','api','moment','bluebird','request-promise','path'];(function(_0x4bb885,_0x1ea860){var _0x5398f3=function(_0x6d3e25){while(--_0x6d3e25){_0x4bb885['push'](_0x4bb885['shift']());}};_0x5398f3(++_0x1ea860);}(_0xa44a,0x9a));var _0xaa44=function(_0x209285,_0x54b0b4){_0x209285=_0x209285-0x0;var _0x165b8d=_0xa44a[_0x209285];return _0x165b8d;};'use strict';var _=require(_0xaa44('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa44('0x1'));var moment=require(_0xaa44('0x2'));var BPromise=require(_0xaa44('0x3'));var rp=require(_0xaa44('0x4'));var fs=require('fs');var path=require(_0xaa44('0x5'));var rimraf=require(_0xaa44('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xaa44('0x7')]=function(_0x39a3f6,_0x4979e3){return _0x39a3f6[_0xaa44('0x8')]('SmsQueue',attributes,{'tableName':_0xaa44('0x9'),'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 86f1707..6e25260 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 _0xe622=['request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetSmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowSmsQueue','SmsQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0xb400ce,_0x51e8dc){var _0x50b4bc=function(_0x3bf6d4){while(--_0x3bf6d4){_0xb400ce['push'](_0xb400ce['shift']());}};_0x50b4bc(++_0x51e8dc);}(_0xe622,0x16a));var _0x2e62=function(_0x57c182,_0x5d69ea){_0x57c182=_0x57c182-0x0;var _0xa9d5a0=_0xe622[_0x57c182];return _0xa9d5a0;};'use strict';var _=require(_0x2e62('0x0'));var util=require('util');var moment=require(_0x2e62('0x1'));var BPromise=require(_0x2e62('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e62('0x3'));var db=require(_0x2e62('0x4'))['db'];var utils=require(_0x2e62('0x5'));var logger=require('../../config/logger')(_0x2e62('0x6'));var config=require(_0x2e62('0x7'));var jayson=require(_0x2e62('0x8'));var client=jayson[_0x2e62('0x9')][_0x2e62('0xa')]({'port':0x232a});config[_0x2e62('0xb')]=_[_0x2e62('0xc')](config[_0x2e62('0xb')],{'host':_0x2e62('0xd'),'port':0x18eb});var socket=require(_0x2e62('0xe'))(new Redis(config['redis']));require(_0x2e62('0xf'))['register'](socket);function respondWithRpcPromise(_0x504cd2,_0x350ae5,_0x402199){return new BPromise(function(_0x219d5a,_0x1dac26){return client[_0x2e62('0x10')](_0x504cd2,_0x402199)[_0x2e62('0x11')](function(_0x403d33){logger[_0x2e62('0x12')](_0x2e62('0x13'),_0x350ae5,'request\x20sent');logger[_0x2e62('0x14')](_0x2e62('0x15'),_0x350ae5,_0x2e62('0x16'),JSON[_0x2e62('0x17')](_0x403d33));if(_0x403d33['error']){if(_0x403d33['error'][_0x2e62('0x18')]===0x1f4){logger['error'](_0x2e62('0x13'),_0x350ae5,_0x403d33[_0x2e62('0x19')][_0x2e62('0x1a')]);return _0x1dac26(_0x403d33[_0x2e62('0x19')][_0x2e62('0x1a')]);}logger[_0x2e62('0x19')](_0x2e62('0x13'),_0x350ae5,_0x403d33[_0x2e62('0x19')][_0x2e62('0x1a')]);return _0x219d5a(_0x403d33['error'][_0x2e62('0x1a')]);}else{logger[_0x2e62('0x12')]('SmsQueue,\x20%s,\x20%s',_0x350ae5,'request\x20sent');_0x219d5a(_0x403d33[_0x2e62('0x1b')][_0x2e62('0x1a')]);}})[_0x2e62('0x1c')](function(_0x40d6c4){logger[_0x2e62('0x19')]('SmsQueue,\x20%s,\x20%s',_0x350ae5,_0x40d6c4);_0x1dac26(_0x40d6c4);});});}exports[_0x2e62('0x1d')]=function(_0x4f36e4){var _0xf4ea8a=this;return new Promise(function(_0x161839,_0x33943e){return db['SmsQueue'][_0x2e62('0x1e')]({'raw':_0x4f36e4[_0x2e62('0x1f')]?_0x4f36e4[_0x2e62('0x1f')][_0x2e62('0x20')]===undefined?!![]:![]:!![],'where':_0x4f36e4[_0x2e62('0x1f')]?_0x4f36e4[_0x2e62('0x1f')][_0x2e62('0x21')]||null:null,'attributes':_0x4f36e4[_0x2e62('0x1f')]?_0x4f36e4['options']['attributes']||null:null,'limit':_0x4f36e4['options']?_0x4f36e4[_0x2e62('0x1f')][_0x2e62('0x22')]||null:null,'include':_0x4f36e4[_0x2e62('0x1f')]?_0x4f36e4[_0x2e62('0x1f')][_0x2e62('0x23')]?_[_0x2e62('0x24')](_0x4f36e4[_0x2e62('0x1f')][_0x2e62('0x23')],function(_0x45ce84){return{'model':db[_0x45ce84[_0x2e62('0x25')]],'as':_0x45ce84['as'],'attributes':_0x45ce84[_0x2e62('0x26')],'include':_0x45ce84[_0x2e62('0x23')]?_[_0x2e62('0x24')](_0x45ce84['include'],function(_0x1b48f8){return{'model':db[_0x1b48f8[_0x2e62('0x25')]],'as':_0x1b48f8['as'],'attributes':_0x1b48f8[_0x2e62('0x26')],'include':_0x1b48f8[_0x2e62('0x23')]?_[_0x2e62('0x24')](_0x1b48f8[_0x2e62('0x23')],function(_0x2b74e9){return{'model':db[_0x2b74e9[_0x2e62('0x25')]],'as':_0x2b74e9['as'],'attributes':_0x2b74e9[_0x2e62('0x26')]};}):[]};}):[]};}):[]:[]})[_0x2e62('0x11')](function(_0x55fca3){logger[_0x2e62('0x12')](_0x2e62('0x1d'),_0x4f36e4);logger[_0x2e62('0x14')](_0x2e62('0x1d'),_0x4f36e4,JSON[_0x2e62('0x17')](_0x55fca3));_0x161839(_0x55fca3);})[_0x2e62('0x1c')](function(_0x20cf88){logger[_0x2e62('0x19')](_0x2e62('0x1d'),_0x20cf88[_0x2e62('0x1a')],_0x4f36e4);_0x33943e(_0xf4ea8a[_0x2e62('0x19')](0x1f4,_0x20cf88[_0x2e62('0x1a')]));});});};exports[_0x2e62('0x27')]=function(_0x1f71d1){var _0x407e60=this;return new Promise(function(_0x3ee46a,_0x1368a9){return db[_0x2e62('0x28')][_0x2e62('0x29')]({'raw':_0x1f71d1[_0x2e62('0x1f')]?_0x1f71d1['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f71d1['options']?_0x1f71d1['options']['where']||null:null,'attributes':_0x1f71d1['options']?_0x1f71d1[_0x2e62('0x1f')][_0x2e62('0x26')]||null:null,'include':_0x1f71d1[_0x2e62('0x1f')]?_0x1f71d1['options'][_0x2e62('0x23')]?_[_0x2e62('0x24')](_0x1f71d1[_0x2e62('0x1f')]['include'],function(_0x33ce57){return{'model':db[_0x33ce57['model']],'as':_0x33ce57['as'],'attributes':_0x33ce57[_0x2e62('0x26')],'include':_0x33ce57['include']?_[_0x2e62('0x24')](_0x33ce57['include'],function(_0x318857){return{'model':db[_0x318857[_0x2e62('0x25')]],'as':_0x318857['as'],'attributes':_0x318857['attributes'],'include':_0x318857[_0x2e62('0x23')]?_['map'](_0x318857[_0x2e62('0x23')],function(_0x1ea877){return{'model':db[_0x1ea877[_0x2e62('0x25')]],'as':_0x1ea877['as'],'attributes':_0x1ea877['attributes']};}):[]};}):[]};}):[]:[]})[_0x2e62('0x11')](function(_0x23361a){logger[_0x2e62('0x12')](_0x2e62('0x27'),_0x1f71d1);logger['debug']('ShowSmsQueue',_0x1f71d1,JSON[_0x2e62('0x17')](_0x23361a));_0x3ee46a(_0x23361a);})['catch'](function(_0x51c04e){logger[_0x2e62('0x19')](_0x2e62('0x27'),_0x51c04e['message'],_0x1f71d1);_0x1368a9(_0x407e60[_0x2e62('0x19')](0x1f4,_0x51c04e[_0x2e62('0x1a')]));});});}; \ No newline at end of file +var _0x29c7=['client','http','redis','localhost','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x58561b,_0x3b3892){var _0xcb80bb=function(_0x36ad8e){while(--_0x36ad8e){_0x58561b['push'](_0x58561b['shift']());}};_0xcb80bb(++_0x3b3892);}(_0x29c7,0x6f));var _0x729c=function(_0x3661d5,_0x295514){_0x3661d5=_0x3661d5-0x0;var _0x5ce30c=_0x29c7[_0x3661d5];return _0x5ce30c;};'use strict';var _=require(_0x729c('0x0'));var util=require(_0x729c('0x1'));var moment=require(_0x729c('0x2'));var BPromise=require('bluebird');var rs=require(_0x729c('0x3'));var fs=require('fs');var Redis=require(_0x729c('0x4'));var db=require(_0x729c('0x5'))['db'];var utils=require(_0x729c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x729c('0x7'));var jayson=require(_0x729c('0x8'));var client=jayson[_0x729c('0x9')][_0x729c('0xa')]({'port':0x232a});config[_0x729c('0xb')]=_['defaults'](config['redis'],{'host':_0x729c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x729c('0xb')]));require('./smsQueue.socket')[_0x729c('0xd')](socket);function respondWithRpcPromise(_0x1ff297,_0x37010c,_0x454e42){return new BPromise(function(_0xc61c77,_0x5765cd){return client[_0x729c('0xe')](_0x1ff297,_0x454e42)[_0x729c('0xf')](function(_0x3a08a4){logger[_0x729c('0x10')](_0x729c('0x11'),_0x37010c,_0x729c('0x12'));logger[_0x729c('0x13')](_0x729c('0x14'),_0x37010c,'request\x20sent',JSON['stringify'](_0x3a08a4));if(_0x3a08a4[_0x729c('0x15')]){if(_0x3a08a4['error'][_0x729c('0x16')]===0x1f4){logger[_0x729c('0x15')]('SmsQueue,\x20%s,\x20%s',_0x37010c,_0x3a08a4[_0x729c('0x15')][_0x729c('0x17')]);return _0x5765cd(_0x3a08a4[_0x729c('0x15')]['message']);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x37010c,_0x3a08a4[_0x729c('0x15')][_0x729c('0x17')]);return _0xc61c77(_0x3a08a4[_0x729c('0x15')][_0x729c('0x17')]);}else{logger[_0x729c('0x10')]('SmsQueue,\x20%s,\x20%s',_0x37010c,_0x729c('0x12'));_0xc61c77(_0x3a08a4[_0x729c('0x18')][_0x729c('0x17')]);}})[_0x729c('0x19')](function(_0x3e7f32){logger['error'](_0x729c('0x11'),_0x37010c,_0x3e7f32);_0x5765cd(_0x3e7f32);});});}exports[_0x729c('0x1a')]=function(_0x135bc4){var _0x4d053e=this;return new Promise(function(_0x577c81,_0xd76cba){return db[_0x729c('0x1b')][_0x729c('0x1c')]({'raw':_0x135bc4[_0x729c('0x1d')]?_0x135bc4[_0x729c('0x1d')][_0x729c('0x1e')]===undefined?!![]:![]:!![],'where':_0x135bc4[_0x729c('0x1d')]?_0x135bc4[_0x729c('0x1d')][_0x729c('0x1f')]||null:null,'attributes':_0x135bc4[_0x729c('0x1d')]?_0x135bc4['options'][_0x729c('0x20')]||null:null,'limit':_0x135bc4[_0x729c('0x1d')]?_0x135bc4['options'][_0x729c('0x21')]||null:null,'include':_0x135bc4[_0x729c('0x1d')]?_0x135bc4[_0x729c('0x1d')][_0x729c('0x22')]?_[_0x729c('0x23')](_0x135bc4[_0x729c('0x1d')][_0x729c('0x22')],function(_0x18467e){return{'model':db[_0x18467e['model']],'as':_0x18467e['as'],'attributes':_0x18467e[_0x729c('0x20')],'include':_0x18467e[_0x729c('0x22')]?_[_0x729c('0x23')](_0x18467e['include'],function(_0x365f7c){return{'model':db[_0x365f7c['model']],'as':_0x365f7c['as'],'attributes':_0x365f7c[_0x729c('0x20')],'include':_0x365f7c['include']?_[_0x729c('0x23')](_0x365f7c[_0x729c('0x22')],function(_0x50f4e7){return{'model':db[_0x50f4e7[_0x729c('0x24')]],'as':_0x50f4e7['as'],'attributes':_0x50f4e7[_0x729c('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d5881){logger[_0x729c('0x10')](_0x729c('0x1a'),_0x135bc4);logger['debug'](_0x729c('0x1a'),_0x135bc4,JSON[_0x729c('0x25')](_0x5d5881));_0x577c81(_0x5d5881);})['catch'](function(_0x35bd0){logger[_0x729c('0x15')](_0x729c('0x1a'),_0x35bd0[_0x729c('0x17')],_0x135bc4);_0xd76cba(_0x4d053e['error'](0x1f4,_0x35bd0[_0x729c('0x17')]));});});};exports['ShowSmsQueue']=function(_0x2e1628){var _0x57706b=this;return new Promise(function(_0x17a059,_0xbee19a){return db[_0x729c('0x1b')][_0x729c('0x26')]({'raw':_0x2e1628[_0x729c('0x1d')]?_0x2e1628[_0x729c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2e1628[_0x729c('0x1d')]?_0x2e1628[_0x729c('0x1d')][_0x729c('0x1f')]||null:null,'attributes':_0x2e1628[_0x729c('0x1d')]?_0x2e1628[_0x729c('0x1d')][_0x729c('0x20')]||null:null,'include':_0x2e1628['options']?_0x2e1628[_0x729c('0x1d')][_0x729c('0x22')]?_[_0x729c('0x23')](_0x2e1628[_0x729c('0x1d')][_0x729c('0x22')],function(_0x69be95){return{'model':db[_0x69be95['model']],'as':_0x69be95['as'],'attributes':_0x69be95['attributes'],'include':_0x69be95[_0x729c('0x22')]?_[_0x729c('0x23')](_0x69be95[_0x729c('0x22')],function(_0x232264){return{'model':db[_0x232264[_0x729c('0x24')]],'as':_0x232264['as'],'attributes':_0x232264['attributes'],'include':_0x232264[_0x729c('0x22')]?_[_0x729c('0x23')](_0x232264[_0x729c('0x22')],function(_0x2b765a){return{'model':db[_0x2b765a[_0x729c('0x24')]],'as':_0x2b765a['as'],'attributes':_0x2b765a['attributes']};}):[]};}):[]};}):[]:[]})[_0x729c('0xf')](function(_0x139666){logger[_0x729c('0x10')]('ShowSmsQueue',_0x2e1628);logger[_0x729c('0x13')](_0x729c('0x27'),_0x2e1628,JSON['stringify'](_0x139666));_0x17a059(_0x139666);})[_0x729c('0x19')](function(_0x5371d9){logger[_0x729c('0x15')](_0x729c('0x27'),_0x5371d9[_0x729c('0x17')],_0x2e1628);_0xbee19a(_0x57706b[_0x729c('0x15')](0x1f4,_0x5371d9[_0x729c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index de85ba3..ec196be 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 _0x7363=['removeListener','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x5df5e1,_0x3e0305){var _0x2fffd3=function(_0x532a7c){while(--_0x532a7c){_0x5df5e1['push'](_0x5df5e1['shift']());}};_0x2fffd3(++_0x3e0305);}(_0x7363,0x153));var _0x3736=function(_0x27a27c,_0x37b846){_0x27a27c=_0x27a27c-0x0;var _0x526849=_0x7363[_0x27a27c];return _0x526849;};'use strict';var SmsQueueEvents=require(_0x3736('0x0'));var events=[_0x3736('0x1'),_0x3736('0x2'),_0x3736('0x3')];function createListener(_0x5b7ba,_0x2480f9){return function(_0x32e434){_0x2480f9['emit'](_0x5b7ba,_0x32e434);};}function removeListener(_0x1fa4f4,_0x2a4874){return function(){SmsQueueEvents[_0x3736('0x4')](_0x1fa4f4,_0x2a4874);};}exports['register']=function(_0xc7b3f4){for(var _0x17d198=0x0,_0x496fe1=events[_0x3736('0x5')];_0x17d198<_0x496fe1;_0x17d198++){var _0x343688=events[_0x17d198];var _0x20c7ed=createListener(_0x3736('0x6')+_0x343688,_0xc7b3f4);SmsQueueEvents['on'](_0x343688,_0x20c7ed);}}; \ No newline at end of file +var _0x2d6e=['update','emit','removeListener','length','smsQueue:'];(function(_0x3ad373,_0x1a13e8){var _0x48b843=function(_0xbf1676){while(--_0xbf1676){_0x3ad373['push'](_0x3ad373['shift']());}};_0x48b843(++_0x1a13e8);}(_0x2d6e,0x11d));var _0xe2d6=function(_0x56d4f6,_0x4e9689){_0x56d4f6=_0x56d4f6-0x0;var _0x2ceca0=_0x2d6e[_0x56d4f6];return _0x2ceca0;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove',_0xe2d6('0x0')];function createListener(_0x1879f5,_0x354730){return function(_0x2f2385){_0x354730[_0xe2d6('0x1')](_0x1879f5,_0x2f2385);};}function removeListener(_0x4cfa3d,_0x3241c4){return function(){SmsQueueEvents[_0xe2d6('0x2')](_0x4cfa3d,_0x3241c4);};}exports['register']=function(_0x328b1a){for(var _0x3a2433=0x0,_0x6cac0f=events[_0xe2d6('0x3')];_0x3a2433<_0x6cac0f;_0x3a2433++){var _0x226ebd=events[_0x3a2433];var _0x41567a=createListener(_0xe2d6('0x4')+_0x226ebd,_0x328b1a);SmsQueueEvents['on'](_0x226ebd,_0x41567a);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c9f031a..130b544 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 _0x5882=['show','post','create','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3a4429,_0x4c34bb){var _0x358408=function(_0x371ff8){while(--_0x371ff8){_0x3a4429['push'](_0x3a4429['shift']());}};_0x358408(++_0x4c34bb);}(_0x5882,0xc3));var _0x2588=function(_0x28efcb,_0x8db8e7){_0x28efcb=_0x28efcb-0x0;var _0x450cc3=_0x5882[_0x28efcb];return _0x450cc3;};'use strict';var multer=require(_0x2588('0x0'));var util=require(_0x2588('0x1'));var path=require(_0x2588('0x2'));var timeout=require('connect-timeout');var express=require(_0x2588('0x3'));var router=express[_0x2588('0x4')]();var auth=require(_0x2588('0x5'));var interaction=require(_0x2588('0x6'));var config=require(_0x2588('0x7'));var controller=require(_0x2588('0x8'));router[_0x2588('0x9')]('/',auth[_0x2588('0xa')](),controller[_0x2588('0xb')]);router[_0x2588('0x9')](_0x2588('0xc'),auth[_0x2588('0xa')](),controller[_0x2588('0xd')]);router['get'](_0x2588('0xe'),auth['isAuthenticated'](),controller[_0x2588('0xf')]);router[_0x2588('0x10')]('/',auth[_0x2588('0xa')](),controller[_0x2588('0x11')]);router[_0x2588('0x12')](_0x2588('0xe'),auth['isAuthenticated'](),controller[_0x2588('0x13')]);router['delete']('/:id',auth[_0x2588('0xa')](),controller[_0x2588('0x14')]);module['exports']=router; \ No newline at end of file +var _0x77f2=['show','post','create','/:id','update','delete','destroy','exports','util','connect-timeout','express','../../config/environment','./smsQueueReport.controller','isAuthenticated','describe','get'];(function(_0x58f48a,_0x375bfd){var _0x426d8c=function(_0x5c0b29){while(--_0x5c0b29){_0x58f48a['push'](_0x58f48a['shift']());}};_0x426d8c(++_0x375bfd);}(_0x77f2,0x188));var _0x277f=function(_0x554047,_0x46ec41){_0x554047=_0x554047-0x0;var _0x5d11e4=_0x77f2[_0x554047];return _0x5d11e4;};'use strict';var multer=require('multer');var util=require(_0x277f('0x0'));var path=require('path');var timeout=require(_0x277f('0x1'));var express=require(_0x277f('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x277f('0x3'));var controller=require(_0x277f('0x4'));router['get']('/',auth[_0x277f('0x5')](),controller['index']);router['get']('/describe',auth[_0x277f('0x5')](),controller[_0x277f('0x6')]);router[_0x277f('0x7')]('/:id',auth[_0x277f('0x5')](),controller[_0x277f('0x8')]);router[_0x277f('0x9')]('/',auth[_0x277f('0x5')](),controller[_0x277f('0xa')]);router['put'](_0x277f('0xb'),auth[_0x277f('0x5')](),controller[_0x277f('0xc')]);router[_0x277f('0xd')](_0x277f('0xb'),auth[_0x277f('0x5')](),controller[_0x277f('0xe')]);module[_0x277f('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index aee6071..43e2b4c 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 _0x7331=['moment','sequelize','exports','STRING','DATE'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x7331,0xb4));var _0x1733=function(_0x29d324,_0xe4ca4e){_0x29d324=_0x29d324-0x0;var _0x258c80=_0x7331[_0x29d324];return _0x258c80;};'use strict';var moment=require(_0x1733('0x0'));var Sequelize=require(_0x1733('0x1'));module[_0x1733('0x2')]={'uniqueid':{'type':Sequelize[_0x1733('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1733('0x3')]},'joinAt':{'type':Sequelize[_0x1733('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1733('0x4')]},'exitAt':{'type':Sequelize[_0x1733('0x4')]},'reason':{'type':Sequelize[_0x1733('0x3')]}}; \ No newline at end of file +var _0xd85c=['sequelize','exports','STRING','DATE','moment'];(function(_0x267618,_0x341e39){var _0x94a18=function(_0x92a653){while(--_0x92a653){_0x267618['push'](_0x267618['shift']());}};_0x94a18(++_0x341e39);}(_0xd85c,0x15d));var _0xcd85=function(_0x20b8b6,_0x29a14c){_0x20b8b6=_0x20b8b6-0x0;var _0x22c341=_0xd85c[_0x20b8b6];return _0x22c341;};'use strict';var moment=require(_0xcd85('0x0'));var Sequelize=require(_0xcd85('0x1'));module[_0xcd85('0x2')]={'uniqueid':{'type':Sequelize[_0xcd85('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xcd85('0x3')]},'joinAt':{'type':Sequelize[_0xcd85('0x4')]},'leaveAt':{'type':Sequelize[_0xcd85('0x4')]},'acceptAt':{'type':Sequelize[_0xcd85('0x4')]},'exitAt':{'type':Sequelize[_0xcd85('0x4')]},'reason':{'type':Sequelize[_0xcd85('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index aaf0bc8..6756500 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(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0x814b,0x1a2));var _0xb814=function(_0x21ccfc,_0x48834e){_0x21ccfc=_0x21ccfc-0x0;var _0x279454=_0x814b[_0x21ccfc];return _0x279454;};'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(_0x2d175f,_0x4c0219){var _0x234cde=function(_0x13c841){while(--_0x13c841){_0x2d175f['push'](_0x2d175f['shift']());}};_0x234cde(++_0x4c0219);}(_0x814b,0x1a2));var _0xb814=function(_0x5c96eb,_0x5404da){_0x5c96eb=_0x5c96eb-0x0;var _0x4ddbad=_0x814b[_0x5c96eb];return _0x4ddbad;};'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 ac5100e..b3f8236 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 _0xe0d1=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash'];(function(_0x177e72,_0x28bf32){var _0x392698=function(_0x45a052){while(--_0x45a052){_0x177e72['push'](_0x177e72['shift']());}};_0x392698(++_0x28bf32);}(_0xe0d1,0xfb));var _0x1e0d=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0xe0d1[_0x1dc24d];return _0x5d7fb2;};'use strict';var _=require(_0x1e0d('0x0'));var util=require(_0x1e0d('0x1'));var logger=require(_0x1e0d('0x2'))(_0x1e0d('0x3'));var moment=require(_0x1e0d('0x4'));var BPromise=require(_0x1e0d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e0d('0x6'));var rimraf=require(_0x1e0d('0x7'));var config=require(_0x1e0d('0x8'));var attributes=require('./smsQueueReport.attributes');module[_0x1e0d('0x9')]=function(_0x2e461b,_0x315701){return _0x2e461b[_0x1e0d('0xa')](_0x1e0d('0xb'),attributes,{'tableName':_0x1e0d('0xc'),'paranoid':![],'indexes':[{'name':_0x1e0d('0xd'),'fields':[_0x1e0d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8594=['../../config/environment','./smsQueueReport.attributes','exports','define','util','api','moment','bluebird','request-promise','path'];(function(_0x5258dc,_0x45b282){var _0x3aa4c7=function(_0x226da7){while(--_0x226da7){_0x5258dc['push'](_0x5258dc['shift']());}};_0x3aa4c7(++_0x45b282);}(_0x8594,0x1c6));var _0x4859=function(_0x1895bd,_0x147024){_0x1895bd=_0x1895bd-0x0;var _0x4913f7=_0x8594[_0x1895bd];return _0x4913f7;};'use strict';var _=require('lodash');var util=require(_0x4859('0x0'));var logger=require('../../config/logger')(_0x4859('0x1'));var moment=require(_0x4859('0x2'));var BPromise=require(_0x4859('0x3'));var rp=require(_0x4859('0x4'));var fs=require('fs');var path=require(_0x4859('0x5'));var rimraf=require('rimraf');var config=require(_0x4859('0x6'));var attributes=require(_0x4859('0x7'));module[_0x4859('0x8')]=function(_0x33a141,_0x4b0958){return _0x33a141[_0x4859('0x9')]('SmsQueueReport',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 4b74d81..5425adb 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 _0xdbb3=['update','body','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','options','raw','then','catch','UpdateSmsQueueReport'];(function(_0x4b6e56,_0x5a6187){var _0x59453b=function(_0x208fe6){while(--_0x208fe6){_0x4b6e56['push'](_0x4b6e56['shift']());}};_0x59453b(++_0x5a6187);}(_0xdbb3,0xdc));var _0x3dbb=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xdbb3[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x3dbb('0x0'));var util=require(_0x3dbb('0x1'));var moment=require(_0x3dbb('0x2'));var BPromise=require(_0x3dbb('0x3'));var rs=require(_0x3dbb('0x4'));var fs=require('fs');var Redis=require(_0x3dbb('0x5'));var db=require(_0x3dbb('0x6'))['db'];var utils=require(_0x3dbb('0x7'));var logger=require(_0x3dbb('0x8'))(_0x3dbb('0x9'));var config=require(_0x3dbb('0xa'));var jayson=require(_0x3dbb('0xb'));var client=jayson[_0x3dbb('0xc')][_0x3dbb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xba4281,_0x46307d,_0x316e3a){return new BPromise(function(_0x423a15,_0x4af7d3){return client['request'](_0xba4281,_0x316e3a)['then'](function(_0x3a1383){logger[_0x3dbb('0xe')](_0x3dbb('0xf'),_0x46307d,'request\x20sent');logger[_0x3dbb('0x10')](_0x3dbb('0x11'),_0x46307d,_0x3dbb('0x12'),JSON[_0x3dbb('0x13')](_0x3a1383));if(_0x3a1383[_0x3dbb('0x14')]){if(_0x3a1383[_0x3dbb('0x14')][_0x3dbb('0x15')]===0x1f4){logger[_0x3dbb('0x14')](_0x3dbb('0xf'),_0x46307d,_0x3a1383[_0x3dbb('0x14')][_0x3dbb('0x16')]);return _0x4af7d3(_0x3a1383['error']['message']);}logger[_0x3dbb('0x14')](_0x3dbb('0xf'),_0x46307d,_0x3a1383['error'][_0x3dbb('0x16')]);return _0x423a15(_0x3a1383[_0x3dbb('0x14')][_0x3dbb('0x16')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x46307d,'request\x20sent');_0x423a15(_0x3a1383[_0x3dbb('0x17')][_0x3dbb('0x16')]);}})['catch'](function(_0x245e45){logger[_0x3dbb('0x14')](_0x3dbb('0xf'),_0x46307d,_0x245e45);_0x4af7d3(_0x245e45);});});}exports[_0x3dbb('0x18')]=function(_0x67f256){var _0x2ecc46=this;return new Promise(function(_0x16b195,_0x40c7ec){return db[_0x3dbb('0x19')][_0x3dbb('0x1a')](_0x67f256['body'],{'raw':_0x67f256[_0x3dbb('0x1b')]?_0x67f256[_0x3dbb('0x1b')][_0x3dbb('0x1c')]===undefined?!![]:![]:!![]})[_0x3dbb('0x1d')](function(_0x5b3f7f){logger['info'](_0x3dbb('0x18'),_0x67f256);logger[_0x3dbb('0x10')]('CreateSmsQueueReport',_0x67f256,JSON[_0x3dbb('0x13')](_0x5b3f7f));_0x16b195(_0x5b3f7f);})[_0x3dbb('0x1e')](function(_0x20b1fc){logger[_0x3dbb('0x14')](_0x3dbb('0x18'),_0x20b1fc['message'],_0x67f256);_0x40c7ec(_0x2ecc46['error'](0x1f4,_0x20b1fc[_0x3dbb('0x16')]));});});};exports[_0x3dbb('0x1f')]=function(_0x3bea5a){var _0x5dd05f=this;return new Promise(function(_0x14031c,_0x3870b9){return db[_0x3dbb('0x19')][_0x3dbb('0x20')](_0x3bea5a[_0x3dbb('0x21')],{'raw':_0x3bea5a[_0x3dbb('0x1b')]?_0x3bea5a[_0x3dbb('0x1b')][_0x3dbb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bea5a[_0x3dbb('0x1b')]?_0x3bea5a['options']['where']||null:null,'attributes':_0x3bea5a[_0x3dbb('0x1b')]?_0x3bea5a[_0x3dbb('0x1b')][_0x3dbb('0x22')]||null:null,'limit':_0x3bea5a[_0x3dbb('0x1b')]?_0x3bea5a[_0x3dbb('0x1b')][_0x3dbb('0x23')]||null:null})['then'](function(_0x26cb99){logger[_0x3dbb('0xe')]('UpdateSmsQueueReport',_0x3bea5a);logger[_0x3dbb('0x10')]('UpdateSmsQueueReport',_0x3bea5a,JSON[_0x3dbb('0x13')](_0x26cb99));_0x14031c(_0x26cb99);})[_0x3dbb('0x1e')](function(_0x523bbc){logger[_0x3dbb('0x14')](_0x3dbb('0x1f'),_0x523bbc[_0x3dbb('0x16')],_0x3bea5a);_0x3870b9(_0x5dd05f[_0x3dbb('0x14')](0x1f4,_0x523bbc[_0x3dbb('0x16')]));});});}; \ No newline at end of file +var _0x3d57=['options','raw','CreateSmsQueueReport','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport','body'];(function(_0x3633f6,_0x1f24df){var _0xf501e8=function(_0x77155e){while(--_0x77155e){_0x3633f6['push'](_0x3633f6['shift']());}};_0xf501e8(++_0x1f24df);}(_0x3d57,0xf8));var _0x73d5=function(_0x3124d4,_0x1267e3){_0x3124d4=_0x3124d4-0x0;var _0x1d9cda=_0x3d57[_0x3124d4];return _0x1d9cda;};'use strict';var _=require(_0x73d5('0x0'));var util=require(_0x73d5('0x1'));var moment=require(_0x73d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x73d5('0x3'));var fs=require('fs');var Redis=require(_0x73d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x73d5('0x5'))(_0x73d5('0x6'));var config=require(_0x73d5('0x7'));var jayson=require(_0x73d5('0x8'));var client=jayson[_0x73d5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47a46f,_0x562580,_0x27157f){return new BPromise(function(_0xd3caae,_0xcdaa26){return client[_0x73d5('0xa')](_0x47a46f,_0x27157f)[_0x73d5('0xb')](function(_0xe591d6){logger[_0x73d5('0xc')](_0x73d5('0xd'),_0x562580,_0x73d5('0xe'));logger['debug'](_0x73d5('0xf'),_0x562580,'request\x20sent',JSON[_0x73d5('0x10')](_0xe591d6));if(_0xe591d6['error']){if(_0xe591d6[_0x73d5('0x11')][_0x73d5('0x12')]===0x1f4){logger['error'](_0x73d5('0xd'),_0x562580,_0xe591d6[_0x73d5('0x11')][_0x73d5('0x13')]);return _0xcdaa26(_0xe591d6['error'][_0x73d5('0x13')]);}logger[_0x73d5('0x11')](_0x73d5('0xd'),_0x562580,_0xe591d6[_0x73d5('0x11')][_0x73d5('0x13')]);return _0xd3caae(_0xe591d6['error'][_0x73d5('0x13')]);}else{logger[_0x73d5('0xc')](_0x73d5('0xd'),_0x562580,_0x73d5('0xe'));_0xd3caae(_0xe591d6['result'][_0x73d5('0x13')]);}})['catch'](function(_0x189053){logger[_0x73d5('0x11')](_0x73d5('0xd'),_0x562580,_0x189053);_0xcdaa26(_0x189053);});});}exports['CreateSmsQueueReport']=function(_0x5d331c){var _0x2833e7=this;return new Promise(function(_0xca7fc1,_0x584d4b){return db[_0x73d5('0x14')]['create'](_0x5d331c[_0x73d5('0x15')],{'raw':_0x5d331c[_0x73d5('0x16')]?_0x5d331c[_0x73d5('0x16')][_0x73d5('0x17')]===undefined?!![]:![]:!![]})[_0x73d5('0xb')](function(_0x5116ee){logger['info'](_0x73d5('0x18'),_0x5d331c);logger['debug']('CreateSmsQueueReport',_0x5d331c,JSON[_0x73d5('0x10')](_0x5116ee));_0xca7fc1(_0x5116ee);})['catch'](function(_0x2c18d9){logger[_0x73d5('0x11')](_0x73d5('0x18'),_0x2c18d9[_0x73d5('0x13')],_0x5d331c);_0x584d4b(_0x2833e7[_0x73d5('0x11')](0x1f4,_0x2c18d9[_0x73d5('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x5d061b){var _0x214e1a=this;return new Promise(function(_0x3becc4,_0x48fd2d){return db[_0x73d5('0x14')][_0x73d5('0x19')](_0x5d061b['body'],{'raw':_0x5d061b['options']?_0x5d061b[_0x73d5('0x16')][_0x73d5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d061b[_0x73d5('0x16')]?_0x5d061b[_0x73d5('0x16')][_0x73d5('0x1a')]||null:null,'attributes':_0x5d061b[_0x73d5('0x16')]?_0x5d061b[_0x73d5('0x16')][_0x73d5('0x1b')]||null:null,'limit':_0x5d061b[_0x73d5('0x16')]?_0x5d061b['options'][_0x73d5('0x1c')]||null:null})[_0x73d5('0xb')](function(_0x6e136d){logger[_0x73d5('0xc')](_0x73d5('0x1d'),_0x5d061b);logger['debug'](_0x73d5('0x1d'),_0x5d061b,JSON[_0x73d5('0x10')](_0x6e136d));_0x3becc4(_0x6e136d);})['catch'](function(_0x4176ba){logger['error'](_0x73d5('0x1d'),_0x4176ba[_0x73d5('0x13')],_0x5d061b);_0x48fd2d(_0x214e1a[_0x73d5('0x11')](0x1f4,_0x4176ba['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a0aa847..8fd9360 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 _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2547=['../../config/environment','get','isAuthenticated','index','describe','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x40fe51,_0x4ef362){var _0x307c59=function(_0xcafcef){while(--_0xcafcef){_0x40fe51['push'](_0x40fe51['shift']());}};_0x307c59(++_0x4ef362);}(_0x2547,0x1cd));var _0x7254=function(_0xf599a9,_0x2ca1f4){_0xf599a9=_0xf599a9-0x0;var _0x575263=_0x2547[_0xf599a9];return _0x575263;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./smsTransferReport.controller');router[_0x7254('0x8')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xa')]);router[_0x7254('0x8')]('/describe',auth[_0x7254('0x9')](),controller[_0x7254('0xb')]);router[_0x7254('0x8')]('/:id',auth[_0x7254('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x7254('0xc')]);router[_0x7254('0xd')](_0x7254('0xe'),auth[_0x7254('0x9')](),controller[_0x7254('0xf')]);router[_0x7254('0x10')]('/:id',auth[_0x7254('0x9')](),controller['destroy']);module[_0x7254('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 dd6a810..12d09cd 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 _0xe263=['account','agent','queue','DATE','moment','exports','STRING'];(function(_0x532dcb,_0xb4fa89){var _0x507b54=function(_0x1eaaf9){while(--_0x1eaaf9){_0x532dcb['push'](_0x532dcb['shift']());}};_0x507b54(++_0xb4fa89);}(_0xe263,0x131));var _0x3e26=function(_0x5593d5,_0x43ed6f){_0x5593d5=_0x5593d5-0x0;var _0x48bbe5=_0xe263[_0x5593d5];return _0x48bbe5;};'use strict';var moment=require(_0x3e26('0x0'));var Sequelize=require('sequelize');module[_0x3e26('0x1')]={'uniqueid':{'type':Sequelize[_0x3e26('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3e26('0x3'),_0x3e26('0x4'),_0x3e26('0x5')),'allowNull':![],'defaultValue':_0x3e26('0x5')},'transferredAt':{'type':Sequelize[_0x3e26('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf5c5=['agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xf5c5,0x13a));var _0x5f5c=function(_0x4b8556,_0x3fc58d){_0x4b8556=_0x4b8556-0x0;var _0x32b2c1=_0xf5c5[_0x4b8556];return _0x32b2c1;};'use strict';var moment=require(_0x5f5c('0x0'));var Sequelize=require(_0x5f5c('0x1'));module[_0x5f5c('0x2')]={'uniqueid':{'type':Sequelize[_0x5f5c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5f5c('0x4')](_0x5f5c('0x5'),_0x5f5c('0x6'),_0x5f5c('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x5f5c('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x5f5c('0x9')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 0650c51..17d7130 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 _0xe706=['catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','SmsTransferReport','include','findAll','rows','params','includeAll','options','find'];(function(_0x578299,_0x5ad73f){var _0x4f5d36=function(_0x208c5e){while(--_0x208c5e){_0x578299['push'](_0x578299['shift']());}};_0x4f5d36(++_0x5ad73f);}(_0xe706,0xa3));var _0x6e70=function(_0x3451ba,_0x4dd59b){_0x3451ba=_0x3451ba-0x0;var _0x558479=_0xe706[_0x3451ba];return _0x558479;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={},_0x3af17f={},_0x83c836={'count':0x0,'rows':[]};var _0x114344=_[_0x6e70('0x2c')](db['SmsTransferReport'][_0x6e70('0x2d')],function(_0x406f29){return{'name':_0x406f29[_0x6e70('0x2e')],'type':_0x406f29[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x2c')](_0x114344,_0x6e70('0x29'));_0x3af17f[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x4a67ac['query']);_0x3af17f[_0x6e70('0x34')]=_['intersection'](_0x3af17f[_0x6e70('0x31')],_0x3af17f['query']);_0x2c4d37[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x3af17f[_0x6e70('0x31')],qs['fields'](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x37')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2c4d37['attributes']:_0x3af17f[_0x6e70('0x31')];if(!_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x39')](_0x6e70('0x3a'))){_0x2c4d37[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x20')]);_0x2c4d37[_0x6e70('0x3b')]=qs[_0x6e70('0x3b')](_0x4a67ac['query'][_0x6e70('0x3b')]);}_0x2c4d37['order']=qs[_0x6e70('0x3c')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3c')]);_0x2c4d37[_0x6e70('0x3d')]=qs[_0x6e70('0x34')](_[_0x6e70('0x3e')](_0x4a67ac[_0x6e70('0x32')],_0x3af17f[_0x6e70('0x34')]),_0x114344);if(_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]){_0x2c4d37[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x2c4d37[_0x6e70('0x3d')],{'$or':_['map'](_0x114344,function(_0x5446a2){if(_0x5446a2['type']!==_0x6e70('0x41')){var _0x3841a0={};_0x3841a0[_0x5446a2[_0x6e70('0x29')]]={'$like':'%'+_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]+'%'};return _0x3841a0;}})});}_0x2c4d37=_[_0x6e70('0x40')]({},_0x2c4d37,_0x4a67ac['options']);var _0x3b508c={'where':_0x2c4d37[_0x6e70('0x3d')]};return db[_0x6e70('0x42')][_0x6e70('0x1f')](_0x3b508c)[_0x6e70('0x27')](function(_0x37bf46){_0x83c836[_0x6e70('0x1f')]=_0x37bf46;if(_0x4a67ac[_0x6e70('0x32')]['includeAll']){_0x2c4d37[_0x6e70('0x43')]=[{'all':!![]}];}return db[_0x6e70('0x42')][_0x6e70('0x44')](_0x2c4d37);})[_0x6e70('0x27')](function(_0x201da9){_0x83c836[_0x6e70('0x45')]=_0x201da9;return _0x83c836;})[_0x6e70('0x27')](respondWithFilteredResult(_0x54a5fe,_0x2c4d37))['catch'](handleError(_0x54a5fe,null));};exports['show']=function(_0x5ae898,_0x154e0c){var _0x2b63cc={'raw':!![],'where':{'id':_0x5ae898[_0x6e70('0x46')]['id']}},_0x83847b={};_0x83847b[_0x6e70('0x31')]=_['keys'](db[_0x6e70('0x42')][_0x6e70('0x2d')]);_0x83847b[_0x6e70('0x32')]=_['keys'](_0x5ae898['query']);_0x83847b['filters']=_[_0x6e70('0x36')](_0x83847b['model'],_0x83847b[_0x6e70('0x32')]);_0x2b63cc[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x83847b[_0x6e70('0x31')],qs['fields'](_0x5ae898[_0x6e70('0x32')]['fields']));_0x2b63cc[_0x6e70('0x35')]=_0x2b63cc[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2b63cc[_0x6e70('0x35')]:_0x83847b['model'];if(_0x5ae898[_0x6e70('0x32')][_0x6e70('0x47')]){_0x2b63cc[_0x6e70('0x43')]=[{'all':!![]}];}_0x2b63cc=_[_0x6e70('0x40')]({},_0x2b63cc,_0x5ae898[_0x6e70('0x48')]);return db[_0x6e70('0x42')][_0x6e70('0x49')](_0x2b63cc)['then'](handleEntityNotFound(_0x154e0c,null))[_0x6e70('0x27')](respondWithResult(_0x154e0c,null))[_0x6e70('0x4a')](handleError(_0x154e0c,null));};exports[_0x6e70('0x4b')]=function(_0x2f99cb,_0x3f86cf){return db[_0x6e70('0x42')][_0x6e70('0x4b')](_0x2f99cb['body'],{})[_0x6e70('0x27')](respondWithResult(_0x3f86cf,0xc9))['catch'](handleError(_0x3f86cf,null));};exports[_0x6e70('0x26')]=function(_0x3836e4,_0x4b351e){if(_0x3836e4['body']['id']){delete _0x3836e4[_0x6e70('0x4c')]['id'];}return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x3836e4['params']['id']}})['then'](handleEntityNotFound(_0x4b351e,null))[_0x6e70('0x27')](saveUpdates(_0x3836e4[_0x6e70('0x4c')],null))[_0x6e70('0x27')](respondWithResult(_0x4b351e,null))[_0x6e70('0x4a')](handleError(_0x4b351e,null));};exports[_0x6e70('0x4d')]=function(_0x340674,_0x4ad5a9){return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x340674[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x4ad5a9,null))[_0x6e70('0x27')](removeEntity(_0x4ad5a9,null))['catch'](handleError(_0x4ad5a9,null));};exports['describe']=function(_0x2c5538,_0x2e3ea6){return db[_0x6e70('0x42')][_0x6e70('0x4e')]()[_0x6e70('0x27')](respondWithResult(_0x2e3ea6,null))['catch'](handleError(_0x2e3ea6,null));}; \ No newline at end of file +var _0xd8b0=['intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','SmsTransferReport','count','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','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','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys'];(function(_0x3e8d3c,_0x2e4078){var _0x5e64c6=function(_0x3e1493){while(--_0x3e1493){_0x3e8d3c['push'](_0x3e8d3c['shift']());}};_0x5e64c6(++_0x2e4078);}(_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(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={},_0x28f639={},_0x3ef745={'count':0x0,'rows':[]};var _0x4c05ee=_[_0x0d8b('0x28')](db['SmsTransferReport'][_0x0d8b('0x29')],function(_0x4b59e5){return{'name':_0x4b59e5[_0x0d8b('0x2a')],'type':_0x4b59e5['type'][_0x0d8b('0x2b')]};});_0x28f639['model']=_[_0x0d8b('0x28')](_0x4c05ee,'name');_0x28f639[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0xa2af02[_0x0d8b('0x2c')]);_0x28f639['filters']=_['intersection'](_0x28f639['model'],_0x28f639[_0x0d8b('0x2c')]);_0x59a905['attributes']=_[_0x0d8b('0x2e')](_0x28f639['model'],qs['fields'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x59a905[_0x0d8b('0x30')]=_0x59a905[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x59a905[_0x0d8b('0x30')]:_0x28f639[_0x0d8b('0x32')];if(!_0xa2af02[_0x0d8b('0x2c')]['hasOwnProperty'](_0x0d8b('0x33'))){_0x59a905[_0x0d8b('0x1b')]=qs['limit'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1b')]);_0x59a905[_0x0d8b('0x1a')]=qs['offset'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}_0x59a905[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0xa2af02[_0x0d8b('0x2c')]['sort']);_0x59a905[_0x0d8b('0x36')]=qs[_0x0d8b('0x37')](_['pick'](_0xa2af02[_0x0d8b('0x2c')],_0x28f639[_0x0d8b('0x37')]),_0x4c05ee);if(_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x59a905[_0x0d8b('0x36')]=_['merge'](_0x59a905['where'],{'$or':_[_0x0d8b('0x28')](_0x4c05ee,function(_0x5c2c04){if(_0x5c2c04['type']!==_0x0d8b('0x39')){var _0x2e279c={};_0x2e279c[_0x5c2c04[_0x0d8b('0x25')]]={'$like':'%'+_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x2e279c;}})});}_0x59a905=_[_0x0d8b('0x3a')]({},_0x59a905,_0xa2af02['options']);var _0x6e5bab={'where':_0x59a905[_0x0d8b('0x36')]};return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')](_0x6e5bab)[_0x0d8b('0x22')](function(_0x1a39ad){_0x3ef745[_0x0d8b('0x3c')]=_0x1a39ad;if(_0xa2af02['query'][_0x0d8b('0x3d')]){_0x59a905[_0x0d8b('0x3e')]=[{'all':!![]}];}return db[_0x0d8b('0x3b')][_0x0d8b('0x3f')](_0x59a905);})['then'](function(_0xe0bf42){_0x3ef745['rows']=_0xe0bf42;return _0x3ef745;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4fe6f9,_0x59a905))[_0x0d8b('0x40')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x41')]=function(_0x26ac10,_0x35fa7e){var _0x3e632e={'raw':!![],'where':{'id':_0x26ac10[_0x0d8b('0x42')]['id']}},_0x1ff17d={};_0x1ff17d[_0x0d8b('0x32')]=_[_0x0d8b('0x2d')](db['SmsTransferReport']['rawAttributes']);_0x1ff17d['query']=_['keys'](_0x26ac10['query']);_0x1ff17d[_0x0d8b('0x37')]=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],_0x1ff17d['query']);_0x3e632e['attributes']=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],qs[_0x0d8b('0x2f')](_0x26ac10['query'][_0x0d8b('0x2f')]));_0x3e632e[_0x0d8b('0x30')]=_0x3e632e['attributes']['length']?_0x3e632e[_0x0d8b('0x30')]:_0x1ff17d['model'];if(_0x26ac10[_0x0d8b('0x2c')]['includeAll']){_0x3e632e['include']=[{'all':!![]}];}_0x3e632e=_[_0x0d8b('0x3a')]({},_0x3e632e,_0x26ac10[_0x0d8b('0x43')]);return db['SmsTransferReport']['find'](_0x3e632e)['then'](handleEntityNotFound(_0x35fa7e,null))['then'](respondWithResult(_0x35fa7e,null))[_0x0d8b('0x40')](handleError(_0x35fa7e,null));};exports[_0x0d8b('0x44')]=function(_0xd9d4c3,_0x490eda){return db[_0x0d8b('0x3b')][_0x0d8b('0x44')](_0xd9d4c3[_0x0d8b('0x45')],{})[_0x0d8b('0x22')](respondWithResult(_0x490eda,0xc9))[_0x0d8b('0x40')](handleError(_0x490eda,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x45')]['id']){delete _0x11d22b[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x3b')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x45')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x40')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x47')]=function(_0x574b90,_0x371fa0){return db['SmsTransferReport']['find']({'where':{'id':_0x574b90[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x371fa0,null))[_0x0d8b('0x22')](removeEntity(_0x371fa0,null))[_0x0d8b('0x40')](handleError(_0x371fa0,null));};exports['describe']=function(_0x131579,_0x1106d6){return db[_0x0d8b('0x3b')][_0x0d8b('0x48')]()[_0x0d8b('0x22')](respondWithResult(_0x1106d6,null))['catch'](handleError(_0x1106d6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 5808899..03767ac 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 _0x8362=['lodash','util','api','bluebird','./smsTransferReport.attributes','exports','define','report_sms_transfer'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x8362,0x70));var _0x2836=function(_0x2363e4,_0x4bb9b3){_0x2363e4=_0x2363e4-0x0;var _0x1f135a=_0x8362[_0x2363e4];return _0x1f135a;};'use strict';var _=require(_0x2836('0x0'));var util=require(_0x2836('0x1'));var logger=require('../../config/logger')(_0x2836('0x2'));var moment=require('moment');var BPromise=require(_0x2836('0x3'));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(_0x2836('0x4'));module[_0x2836('0x5')]=function(_0x5ec3c8,_0x396ba2){return _0x5ec3c8[_0x2836('0x6')]('SmsTransferReport',attributes,{'tableName':_0x2836('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x44fe=['request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x31c2d8,_0x269933){var _0x35349d=function(_0x32253d){while(--_0x32253d){_0x31c2d8['push'](_0x31c2d8['shift']());}};_0x35349d(++_0x269933);}(_0x44fe,0xbc));var _0xe44f=function(_0x524605,_0x3484c1){_0x524605=_0x524605-0x0;var _0x2d3911=_0x44fe[_0x524605];return _0x2d3911;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe44f('0x0'))(_0xe44f('0x1'));var moment=require(_0xe44f('0x2'));var BPromise=require(_0xe44f('0x3'));var rp=require(_0xe44f('0x4'));var fs=require('fs');var path=require(_0xe44f('0x5'));var rimraf=require(_0xe44f('0x6'));var config=require(_0xe44f('0x7'));var attributes=require(_0xe44f('0x8'));module[_0xe44f('0x9')]=function(_0x5ad0f4,_0x4dbfd7){return _0x5ad0f4['define'](_0xe44f('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xe44f('0xb'),'fields':[_0xe44f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d5c018f..7a2acf2 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 _0x54fc=['../../config/environment','jayson/promise','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x36bb2b,_0x46916e){var _0x14c773=function(_0x40cf47){while(--_0x40cf47){_0x36bb2b['push'](_0x36bb2b['shift']());}};_0x14c773(++_0x46916e);}(_0x54fc,0xff));var _0xc54f=function(_0x51434c,_0x201593){_0x51434c=_0x51434c-0x0;var _0x1337ff=_0x54fc[_0x51434c];return _0x1337ff;};'use strict';var _=require(_0xc54f('0x0'));var util=require(_0xc54f('0x1'));var moment=require(_0xc54f('0x2'));var BPromise=require(_0xc54f('0x3'));var rs=require(_0xc54f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc54f('0x5'))['db'];var utils=require(_0xc54f('0x6'));var logger=require(_0xc54f('0x7'))(_0xc54f('0x8'));var config=require(_0xc54f('0x9'));var jayson=require(_0xc54f('0xa'));var client=jayson['client'][_0xc54f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16636c,_0xc31f40,_0x26601c){return new BPromise(function(_0x2a55ee,_0x244528){return client['request'](_0x16636c,_0x26601c)[_0xc54f('0xc')](function(_0x441523){logger[_0xc54f('0xd')](_0xc54f('0xe'),_0xc31f40,_0xc54f('0xf'));logger[_0xc54f('0x10')](_0xc54f('0x11'),_0xc31f40,_0xc54f('0xf'),JSON['stringify'](_0x441523));if(_0x441523[_0xc54f('0x12')]){if(_0x441523[_0xc54f('0x12')]['code']===0x1f4){logger['error'](_0xc54f('0xe'),_0xc31f40,_0x441523[_0xc54f('0x12')][_0xc54f('0x13')]);return _0x244528(_0x441523[_0xc54f('0x12')]['message']);}logger[_0xc54f('0x12')](_0xc54f('0xe'),_0xc31f40,_0x441523[_0xc54f('0x12')][_0xc54f('0x13')]);return _0x2a55ee(_0x441523[_0xc54f('0x12')][_0xc54f('0x13')]);}else{logger[_0xc54f('0xd')](_0xc54f('0xe'),_0xc31f40,_0xc54f('0xf'));_0x2a55ee(_0x441523[_0xc54f('0x14')][_0xc54f('0x13')]);}})[_0xc54f('0x15')](function(_0xc44878){logger['error'](_0xc54f('0xe'),_0xc31f40,_0xc44878);_0x244528(_0xc44878);});});} \ No newline at end of file +var _0xb126=['randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','util','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb126,0x1de));var _0x6b12=function(_0x501ee2,_0x5e0980){_0x501ee2=_0x501ee2-0x0;var _0x3c8573=_0xb126[_0x501ee2];return _0x3c8573;};'use strict';var _=require('lodash');var util=require(_0x6b12('0x0'));var moment=require('moment');var BPromise=require(_0x6b12('0x1'));var rs=require(_0x6b12('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b12('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6b12('0x4'));var jayson=require(_0x6b12('0x5'));var client=jayson[_0x6b12('0x6')][_0x6b12('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2533f2,_0x27084e,_0x47b09a){return new BPromise(function(_0x3f7a5a,_0x2c6a6){return client['request'](_0x2533f2,_0x47b09a)[_0x6b12('0x8')](function(_0x3bf2f6){logger[_0x6b12('0x9')]('SmsTransferReport,\x20%s,\x20%s',_0x27084e,_0x6b12('0xa'));logger[_0x6b12('0xb')](_0x6b12('0xc'),_0x27084e,_0x6b12('0xa'),JSON[_0x6b12('0xd')](_0x3bf2f6));if(_0x3bf2f6['error']){if(_0x3bf2f6[_0x6b12('0xe')][_0x6b12('0xf')]===0x1f4){logger[_0x6b12('0xe')](_0x6b12('0x10'),_0x27084e,_0x3bf2f6[_0x6b12('0xe')][_0x6b12('0x11')]);return _0x2c6a6(_0x3bf2f6[_0x6b12('0xe')][_0x6b12('0x11')]);}logger['error'](_0x6b12('0x10'),_0x27084e,_0x3bf2f6[_0x6b12('0xe')][_0x6b12('0x11')]);return _0x3f7a5a(_0x3bf2f6[_0x6b12('0xe')]['message']);}else{logger[_0x6b12('0x9')](_0x6b12('0x10'),_0x27084e,_0x6b12('0xa'));_0x3f7a5a(_0x3bf2f6[_0x6b12('0x12')][_0x6b12('0x11')]);}})[_0x6b12('0x13')](function(_0x280e7a){logger['error'](_0x6b12('0x10'),_0x27084e,_0x280e7a);_0x2c6a6(_0x280e7a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 68310b1..f9b0379 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 _0xdd0d=['path','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','originalname','replace','format','%s-%s%s','basename','now','post','file','create','put','update','delete','exports','util'];(function(_0x35fb83,_0x4be931){var _0x43ada0=function(_0x4bef4b){while(--_0x4bef4b){_0x35fb83['push'](_0x35fb83['shift']());}};_0x43ada0(++_0x4be931);}(_0xdd0d,0x103));var _0xddd0=function(_0x807901,_0x3416c0){_0x807901=_0x807901-0x0;var _0x908c66=_0xdd0d[_0x807901];return _0x908c66;};'use strict';var multer=require('multer');var util=require(_0xddd0('0x0'));var path=require(_0xddd0('0x1'));var timeout=require(_0xddd0('0x2'));var express=require(_0xddd0('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xddd0('0x4'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xddd0('0x5')]('/',auth[_0xddd0('0x6')](),controller[_0xddd0('0x7')]);router['get'](_0xddd0('0x8'),auth[_0xddd0('0x6')](),controller[_0xddd0('0x9')]);router[_0xddd0('0x5')](_0xddd0('0xa'),auth[_0xddd0('0x6')](),controller[_0xddd0('0xb')]);var upload=multer({'storage':multer[_0xddd0('0xc')]({'destination':function(_0xc0ade6,_0x2f4df5,_0x299afc){_0x299afc(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0xc889d7,_0xf4a14d,_0x11e041){_0xf4a14d[_0xddd0('0xd')]=_0xf4a14d['originalname'][_0xddd0('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x11e041(null,util[_0xddd0('0xf')](_0xddd0('0x10'),path[_0xddd0('0x11')](_0xf4a14d[_0xddd0('0xd')],path['extname'](_0xf4a14d[_0xddd0('0xd')])),Date[_0xddd0('0x12')](),path['extname'](_0xf4a14d[_0xddd0('0xd')])));}})});router[_0xddd0('0x13')]('/',upload['single'](_0xddd0('0x14')),controller[_0xddd0('0x15')]);router[_0xddd0('0x16')](_0xddd0('0x8'),auth[_0xddd0('0x6')](),controller[_0xddd0('0x17')]);router[_0xddd0('0x18')](_0xddd0('0x8'),auth[_0xddd0('0x6')](),controller[_0xddd0('0x18')]);module[_0xddd0('0x19')]=router; \ No newline at end of file +var _0x6d7d=['originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','/:id','update','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','show','/:id/download','isAuthenticated','download','diskStorage','server/files/sounds/original/'];(function(_0x5274eb,_0x510d9a){var _0x2ca2c0=function(_0x38d6a7){while(--_0x38d6a7){_0x5274eb['push'](_0x5274eb['shift']());}};_0x2ca2c0(++_0x510d9a);}(_0x6d7d,0x1b3));var _0xd6d7=function(_0x33e32f,_0x217ce4){_0x33e32f=_0x33e32f-0x0;var _0xb7b433=_0x6d7d[_0x33e32f];return _0xb7b433;};'use strict';var multer=require(_0xd6d7('0x0'));var util=require(_0xd6d7('0x1'));var path=require(_0xd6d7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xd6d7('0x3'));var interaction=require(_0xd6d7('0x4'));var config=require(_0xd6d7('0x5'));var controller=require(_0xd6d7('0x6'));router[_0xd6d7('0x7')]('/',auth['isAuthenticated'](),controller[_0xd6d7('0x8')]);router[_0xd6d7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd6d7('0x9')]);router[_0xd6d7('0x7')](_0xd6d7('0xa'),auth[_0xd6d7('0xb')](),controller[_0xd6d7('0xc')]);var upload=multer({'storage':multer[_0xd6d7('0xd')]({'destination':function(_0x1bbfde,_0xf2ba08,_0x175012){_0x175012(null,path['join'](config['root'],_0xd6d7('0xe')));},'filename':function(_0x57df74,_0x42638e,_0x1d707d){_0x42638e[_0xd6d7('0xf')]=_0x42638e[_0xd6d7('0xf')][_0xd6d7('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d707d(null,util[_0xd6d7('0x11')](_0xd6d7('0x12'),path[_0xd6d7('0x13')](_0x42638e[_0xd6d7('0xf')],path[_0xd6d7('0x14')](_0x42638e['originalname'])),Date[_0xd6d7('0x15')](),path[_0xd6d7('0x14')](_0x42638e[_0xd6d7('0xf')])));}})});router[_0xd6d7('0x16')]('/',upload[_0xd6d7('0x17')](_0xd6d7('0x18')),controller[_0xd6d7('0x19')]);router['put'](_0xd6d7('0x1a'),auth['isAuthenticated'](),controller[_0xd6d7('0x1b')]);router[_0xd6d7('0x1c')]('/:id',auth[_0xd6d7('0xb')](),controller[_0xd6d7('0x1c')]);module[_0xd6d7('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 221e2c9..aeb1c42 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 _0x2138=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x3c2e1c,_0x6f1fe3){var _0x4c56e8=function(_0x1233ca){while(--_0x1233ca){_0x3c2e1c['push'](_0x3c2e1c['shift']());}};_0x4c56e8(++_0x6f1fe3);}(_0x2138,0x190));var _0x8213=function(_0x3a44a8,_0x5f0170){_0x3a44a8=_0x3a44a8-0x0;var _0x386bb7=_0x2138[_0x3a44a8];return _0x386bb7;};'use strict';var Sequelize=require(_0x8213('0x0'));module[_0x8213('0x1')]={'name':{'type':Sequelize[_0x8213('0x2')],'unique':_0x8213('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x8213('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x8213('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x8213('0x4')]},'original_sampleCount':{'type':Sequelize[_0x8213('0x5')]},'original_channelCount':{'type':Sequelize[_0x8213('0x6')]},'original_bitRate':{'type':Sequelize[_0x8213('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x8213('0x2')]},'converted_duration':{'type':Sequelize[_0x8213('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x8213('0x5')]},'converted_channelCount':{'type':Sequelize[_0x8213('0x6')]},'converted_bitRate':{'type':Sequelize[_0x8213('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x8213('0x6')]}}; \ No newline at end of file +var _0x0b4c=['FLOAT','INTEGER','BIGINT','sequelize','exports','STRING'];(function(_0x31a7f1,_0x130e51){var _0x5d4407=function(_0x7df34f){while(--_0x7df34f){_0x31a7f1['push'](_0x31a7f1['shift']());}};_0x5d4407(++_0x130e51);}(_0x0b4c,0xf3));var _0xc0b4=function(_0x3a9b5e,_0x24076b){_0x3a9b5e=_0x3a9b5e-0x0;var _0x9f68b=_0x0b4c[_0x3a9b5e];return _0x9f68b;};'use strict';var Sequelize=require(_0xc0b4('0x0'));module[_0xc0b4('0x1')]={'name':{'type':Sequelize[_0xc0b4('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xc0b4('0x2')]},'display_name':{'type':Sequelize[_0xc0b4('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xc0b4('0x2')]},'original_format':{'type':Sequelize[_0xc0b4('0x2')]},'original_duration':{'type':Sequelize[_0xc0b4('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xc0b4('0x4')]},'original_bitRate':{'type':Sequelize[_0xc0b4('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xc0b4('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xc0b4('0x5')]},'converted_channelCount':{'type':Sequelize[_0xc0b4('0x4')]},'converted_bitRate':{'type':Sequelize[_0xc0b4('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xc0b4('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 74fc50e..0978b84 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 _0xcb52=['end','json','count','limit','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','Sound','findAll','rows','params','include','find','catch','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','download','server/files/sounds/converted','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_sampleRate','body','userProfileId','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','server/files/sounds/original','original_format','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x51cc55,_0x46925d){var _0x28ecbb=function(_0x5a58f8){while(--_0x5a58f8){_0x51cc55['push'](_0x51cc55['shift']());}};_0x28ecbb(++_0x46925d);}(_0xcb52,0x15c));var _0x2cb5=function(_0x5a451c,_0x33b7f1){_0x5a451c=_0x5a451c-0x0;var _0x5eade4=_0xcb52[_0x5a451c];return _0x5eade4;};'use strict';var pdf=require(_0x2cb5('0x0'));var emlformat=require(_0x2cb5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2cb5('0x2'));var moment=require(_0x2cb5('0x3'));var BPromise=require(_0x2cb5('0x4'));var Mustache=require(_0x2cb5('0x5'));var util=require(_0x2cb5('0x6'));var path=require(_0x2cb5('0x7'));var sox=require(_0x2cb5('0x8'));var csv=require(_0x2cb5('0x9'));var ejs=require(_0x2cb5('0xa'));var fs=require('fs');var _=require(_0x2cb5('0xb'));var squel=require(_0x2cb5('0xc'));var crypto=require('crypto');var jsforce=require(_0x2cb5('0xd'));var deskjs=require(_0x2cb5('0xe'));var toCsv=require(_0x2cb5('0x9'));var querystring=require('querystring');var Papa=require(_0x2cb5('0xf'));var Redis=require(_0x2cb5('0x10'));var authService=require(_0x2cb5('0x11'));var qs=require(_0x2cb5('0x12'));var as=require(_0x2cb5('0x13'));var hardwareService=require(_0x2cb5('0x14'));var logger=require(_0x2cb5('0x15'))(_0x2cb5('0x16'));var utils=require(_0x2cb5('0x17'));var config=require('../../config/environment');var db=require(_0x2cb5('0x18'))['db'];function respondWithStatusCode(_0x2afd16,_0x1467bf){_0x1467bf=_0x1467bf||0xcc;return function(_0xde8b1a){if(_0xde8b1a){return _0x2afd16[_0x2cb5('0x19')](_0x1467bf);}return _0x2afd16[_0x2cb5('0x1a')](_0x1467bf)[_0x2cb5('0x1b')]();};}function respondWithResult(_0x2c374f,_0x1200c6){_0x1200c6=_0x1200c6||0xc8;return function(_0x27884c){if(_0x27884c){return _0x2c374f[_0x2cb5('0x1a')](_0x1200c6)[_0x2cb5('0x1c')](_0x27884c);}};}function respondWithFilteredResult(_0x930975,_0x328388){return function(_0x123f97){if(_0x123f97){var _0x5d404a=_0x123f97[_0x2cb5('0x1d')],_0x489990=_0x328388['offset'],_0x55447d=_0x328388['offset']+_0x328388[_0x2cb5('0x1e')],_0x55d413;if(_0x55447d>=_0x5d404a){_0x55447d=_0x5d404a;_0x55d413=0xc8;}else{_0x55d413=0xce;}_0x930975[_0x2cb5('0x1a')](_0x55d413);return _0x930975[_0x2cb5('0x1f')](_0x2cb5('0x20'),_0x489990+'-'+_0x55447d+'/'+_0x5d404a)['json'](_0x123f97);}return null;};}function patchUpdates(_0x30c128){return function(_0x536f18){try{jsonpatch['apply'](_0x536f18,_0x30c128,!![]);}catch(_0x5b31fd){return BPromise[_0x2cb5('0x21')](_0x5b31fd);}return _0x536f18[_0x2cb5('0x22')]();};}function saveUpdates(_0x58f357,_0x31eefc){return function(_0x4e4d4f){if(_0x4e4d4f){return _0x4e4d4f[_0x2cb5('0x23')](_0x58f357)['then'](function(_0x56e149){return _0x56e149;});}return null;};}function removeEntity(_0x4f2e03,_0x1d6c5d){return function(_0x43607e){if(_0x43607e){return _0x43607e['destroy']()[_0x2cb5('0x24')](function(){var _0x2a4bd5=_0x43607e[_0x2cb5('0x25')]({'plain':!![]});var _0x525e92='Sounds';return db[_0x2cb5('0x26')][_0x2cb5('0x27')]({'where':{'type':_0x525e92,'resourceId':_0x2a4bd5['id']}})[_0x2cb5('0x24')](function(){return _0x43607e;});})[_0x2cb5('0x24')](function(){_0x4f2e03[_0x2cb5('0x1a')](0xcc)[_0x2cb5('0x1b')]();});}};}function handleEntityNotFound(_0x4a172a,_0x4d08b7){return function(_0x353075){if(!_0x353075){_0x4a172a[_0x2cb5('0x19')](0x194);}return _0x353075;};}function handleError(_0xfb0eb1,_0x4bf07d){_0x4bf07d=_0x4bf07d||0x1f4;return function(_0x5a057d){logger[_0x2cb5('0x28')](_0x5a057d[_0x2cb5('0x29')]);if(_0x5a057d[_0x2cb5('0x2a')]){delete _0x5a057d[_0x2cb5('0x2a')];}_0xfb0eb1['status'](_0x4bf07d)[_0x2cb5('0x2b')](_0x5a057d);};}exports[_0x2cb5('0x2c')]=function(_0x62f7c,_0x561d2a){var _0x2171ee={},_0x1856f4={},_0x303693={'count':0x0,'rows':[]};var _0x5715c5=_[_0x2cb5('0x2d')](db['Sound'][_0x2cb5('0x2e')],function(_0x2ca118){return{'name':_0x2ca118[_0x2cb5('0x2f')],'type':_0x2ca118[_0x2cb5('0x30')]['key']};});_0x1856f4[_0x2cb5('0x31')]=_[_0x2cb5('0x2d')](_0x5715c5,_0x2cb5('0x2a'));_0x1856f4[_0x2cb5('0x32')]=_[_0x2cb5('0x33')](_0x62f7c[_0x2cb5('0x32')]);_0x1856f4['filters']=_[_0x2cb5('0x34')](_0x1856f4[_0x2cb5('0x31')],_0x1856f4[_0x2cb5('0x32')]);_0x2171ee[_0x2cb5('0x35')]=_[_0x2cb5('0x34')](_0x1856f4[_0x2cb5('0x31')],qs[_0x2cb5('0x36')](_0x62f7c[_0x2cb5('0x32')][_0x2cb5('0x36')]));_0x2171ee['attributes']=_0x2171ee['attributes'][_0x2cb5('0x37')]?_0x2171ee[_0x2cb5('0x35')]:_0x1856f4['model'];if(!_0x62f7c[_0x2cb5('0x32')][_0x2cb5('0x38')](_0x2cb5('0x39'))){_0x2171ee[_0x2cb5('0x1e')]=qs[_0x2cb5('0x1e')](_0x62f7c[_0x2cb5('0x32')][_0x2cb5('0x1e')]);_0x2171ee[_0x2cb5('0x3a')]=qs[_0x2cb5('0x3a')](_0x62f7c[_0x2cb5('0x32')][_0x2cb5('0x3a')]);}_0x2171ee[_0x2cb5('0x3b')]=qs[_0x2cb5('0x3c')](_0x62f7c[_0x2cb5('0x32')]['sort']);_0x2171ee[_0x2cb5('0x3d')]=qs[_0x2cb5('0x3e')](_[_0x2cb5('0x3f')](_0x62f7c[_0x2cb5('0x32')],_0x1856f4['filters']),_0x5715c5);if(_0x62f7c[_0x2cb5('0x32')]['filter']){_0x2171ee[_0x2cb5('0x3d')]=_['merge'](_0x2171ee[_0x2cb5('0x3d')],{'$or':_[_0x2cb5('0x2d')](_0x5715c5,function(_0x1f1df5){if(_0x1f1df5[_0x2cb5('0x30')]!==_0x2cb5('0x40')){var _0xd5c1a0={};_0xd5c1a0[_0x1f1df5[_0x2cb5('0x2a')]]={'$like':'%'+_0x62f7c[_0x2cb5('0x32')][_0x2cb5('0x41')]+'%'};return _0xd5c1a0;}})});}_0x2171ee=_[_0x2cb5('0x42')]({},_0x2171ee,_0x62f7c[_0x2cb5('0x43')]);var _0x18c1f3={'where':_0x2171ee[_0x2cb5('0x3d')]};return db['Sound']['count'](_0x18c1f3)[_0x2cb5('0x24')](function(_0xbe0221){_0x303693[_0x2cb5('0x1d')]=_0xbe0221;if(_0x62f7c['query'][_0x2cb5('0x44')]){_0x2171ee['include']=[{'all':!![]}];}return db[_0x2cb5('0x45')][_0x2cb5('0x46')](_0x2171ee);})[_0x2cb5('0x24')](function(_0x56b527){_0x303693[_0x2cb5('0x47')]=_0x56b527;return _0x303693;})[_0x2cb5('0x24')](respondWithFilteredResult(_0x561d2a,_0x2171ee))['catch'](handleError(_0x561d2a,null));};exports['show']=function(_0x555f75,_0x48891d){var _0x568d43={'raw':!![],'where':{'id':_0x555f75[_0x2cb5('0x48')]['id']}},_0x8f1d5={};_0x8f1d5['model']=_['keys'](db[_0x2cb5('0x45')][_0x2cb5('0x2e')]);_0x8f1d5['query']=_[_0x2cb5('0x33')](_0x555f75[_0x2cb5('0x32')]);_0x8f1d5[_0x2cb5('0x3e')]=_[_0x2cb5('0x34')](_0x8f1d5['model'],_0x8f1d5[_0x2cb5('0x32')]);_0x568d43['attributes']=_[_0x2cb5('0x34')](_0x8f1d5[_0x2cb5('0x31')],qs[_0x2cb5('0x36')](_0x555f75[_0x2cb5('0x32')][_0x2cb5('0x36')]));_0x568d43[_0x2cb5('0x35')]=_0x568d43[_0x2cb5('0x35')][_0x2cb5('0x37')]?_0x568d43[_0x2cb5('0x35')]:_0x8f1d5[_0x2cb5('0x31')];if(_0x555f75[_0x2cb5('0x32')][_0x2cb5('0x44')]){_0x568d43[_0x2cb5('0x49')]=[{'all':!![]}];}_0x568d43=_['merge']({},_0x568d43,_0x555f75['options']);return db['Sound'][_0x2cb5('0x4a')](_0x568d43)[_0x2cb5('0x24')](handleEntityNotFound(_0x48891d,null))[_0x2cb5('0x24')](respondWithResult(_0x48891d,null))[_0x2cb5('0x4b')](handleError(_0x48891d,null));};exports['download']=function(_0x4c2399,_0x3477eb,_0x4f16f9){return db[_0x2cb5('0x45')][_0x2cb5('0x4a')]({'where':{'id':_0x4c2399['params']['id']},'attributes':[_0x2cb5('0x2a'),_0x2cb5('0x4c'),_0x2cb5('0x4d')],'raw':!![]})[_0x2cb5('0x24')](handleEntityNotFound(_0x3477eb,null))['then'](function(_0x58dcec){if(_0x58dcec){if(!fs[_0x2cb5('0x4e')](path[_0x2cb5('0x4f')](config[_0x2cb5('0x50')],'server/files/sounds/converted',_0x58dcec[_0x2cb5('0x4c')]+'.'+_0x58dcec[_0x2cb5('0x4d')]))){throw new db[(_0x2cb5('0x51'))][(_0x2cb5('0x52'))](_0x2cb5('0x53'));}return _0x3477eb[_0x2cb5('0x54')](path[_0x2cb5('0x4f')](config[_0x2cb5('0x50')],_0x2cb5('0x55'),util[_0x2cb5('0x56')](_0x2cb5('0x57'),_0x58dcec[_0x2cb5('0x4c')],_0x58dcec[_0x2cb5('0x4d')])),util[_0x2cb5('0x56')](_0x2cb5('0x57'),_0x58dcec[_0x2cb5('0x2a')],_0x58dcec['converted_format']));}return null;})['catch'](handleError(_0x3477eb,null));};exports['create']=function(_0x354808,_0x549731,_0x5dc03a){var _0x2b4c20={'name':path[_0x2cb5('0x58')](_0x354808[_0x2cb5('0x59')][_0x2cb5('0x5a')],path[_0x2cb5('0x5b')](_0x354808[_0x2cb5('0x59')]['originalname'])),'save_name':path[_0x2cb5('0x58')](_0x354808[_0x2cb5('0x59')][_0x2cb5('0x5c')],path['extname'](_0x354808['file'][_0x2cb5('0x5c')])),'original_format':path[_0x2cb5('0x5b')](_0x354808[_0x2cb5('0x59')]['originalname'])[_0x2cb5('0x5d')](0x1),'converted_format':_0x2cb5('0x5e')};var _0x569b27=path[_0x2cb5('0x4f')](config['root'],'server/files/sounds/original',_0x354808[_0x2cb5('0x59')][_0x2cb5('0x5c')]);var _0xa03cfa=path[_0x2cb5('0x4f')](config['root'],_0x2cb5('0x55'),util[_0x2cb5('0x56')](_0x2cb5('0x57'),path['basename'](_0x354808[_0x2cb5('0x59')][_0x2cb5('0x5c')],path[_0x2cb5('0x5b')](_0x354808[_0x2cb5('0x59')][_0x2cb5('0x5c')])),_0x2b4c20['converted_format']));logger[_0x2cb5('0x5f')](_0x2cb5('0x60'),_0x569b27);logger[_0x2cb5('0x5f')]('Sound\x20upload\x20destination:\x20%s',_0xa03cfa);try{fs[_0x2cb5('0x61')](_0x569b27,parseInt(_0x2cb5('0x62'),0x8));var _0x5467eb=sox[_0x2cb5('0x63')](_0x569b27,_0xa03cfa,{'sampleRate':0x1f40,'format':_0x2cb5('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5467eb['on']('error',function(_0x37303f){fs[_0x2cb5('0x64')](_0x569b27);_0x549731[_0x2cb5('0x1a')](0x1f4)['send'](_0x37303f);});_0x5467eb['on'](_0x2cb5('0x65'),function(_0x205556){_0x2b4c20[_0x2cb5('0x66')]=isNaN(_0x205556[_0x2cb5('0x67')])?null:_0x205556[_0x2cb5('0x67')]*0x3e8;_0x2b4c20[_0x2cb5('0x68')]=isNaN(_0x205556['sampleCount'])?null:_0x205556[_0x2cb5('0x69')];_0x2b4c20[_0x2cb5('0x6a')]=isNaN(_0x205556[_0x2cb5('0x6b')])?null:_0x205556[_0x2cb5('0x6b')];_0x2b4c20[_0x2cb5('0x6c')]=isNaN(_0x205556[_0x2cb5('0x6d')])?null:_0x205556[_0x2cb5('0x6d')];_0x2b4c20[_0x2cb5('0x6e')]=isNaN(_0x205556[_0x2cb5('0x6f')])?null:_0x205556[_0x2cb5('0x6f')];});_0x5467eb['on']('dest',function(_0x243932){_0x2b4c20[_0x2cb5('0x70')]=isNaN(_0x243932[_0x2cb5('0x67')])?null:_0x243932[_0x2cb5('0x67')]*0x3e8;_0x2b4c20['converted_sampleCount']=isNaN(_0x243932[_0x2cb5('0x69')])?null:_0x243932[_0x2cb5('0x69')];_0x2b4c20[_0x2cb5('0x71')]=isNaN(_0x243932[_0x2cb5('0x6b')])?null:_0x243932[_0x2cb5('0x6b')];_0x2b4c20['converted_bitRate']=isNaN(_0x243932[_0x2cb5('0x6d')])?null:_0x243932[_0x2cb5('0x6d')];_0x2b4c20[_0x2cb5('0x72')]=isNaN(_0x243932[_0x2cb5('0x6f')])?null:_0x243932['sampleRate'];});_0x5467eb['on'](_0x2cb5('0x1b'),function(){fs['chmodSync'](_0xa03cfa,parseInt('0777',0x8));return db[_0x2cb5('0x45')]['create'](_0x2b4c20)['then'](function(_0xd411c5){var _0x5ad226={'role':_0x354808[_0x2cb5('0x73')]['role'],'userProfileId':_0x354808[_0x2cb5('0x73')][_0x2cb5('0x74')]};if(!_0x5ad226)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ad226[_0x2cb5('0x75')]===_0x2cb5('0x76')){var _0x333c0b=_0xd411c5[_0x2cb5('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x2cb5('0x4a')]({'where':{'name':'Sounds','userProfileId':_0x5ad226[_0x2cb5('0x74')]},'raw':!![]})[_0x2cb5('0x24')](function(_0x28f5c1){if(_0x28f5c1&&_0x28f5c1[_0x2cb5('0x77')]===0x0){return db['UserProfileResource']['create']({'name':_0x333c0b[_0x2cb5('0x2a')],'resourceId':_0x333c0b['id'],'type':_0x28f5c1[_0x2cb5('0x2a')],'sectionId':_0x28f5c1['id']},{})['then'](function(){return _0xd411c5;});}else{return _0xd411c5;}})[_0x2cb5('0x4b')](function(_0xe3c1e8){logger[_0x2cb5('0x28')](_0x2cb5('0x78'),_0xe3c1e8);throw _0xe3c1e8;});}return _0xd411c5;})[_0x2cb5('0x24')](respondWithResult(_0x549731,null))[_0x2cb5('0x4b')](handleError(_0x549731,null));});_0x5467eb[_0x2cb5('0x79')]();}catch(_0x3e1bdc){_0x549731[_0x2cb5('0x1a')](0x1f4)[_0x2cb5('0x2b')](_0x3e1bdc);}};exports['update']=function(_0x12a5fb,_0x44d965,_0x3d7735){return db[_0x2cb5('0x45')][_0x2cb5('0x4a')]({'where':{'id':_0x12a5fb[_0x2cb5('0x48')]['id']}})[_0x2cb5('0x24')](handleEntityNotFound(_0x44d965,null))[_0x2cb5('0x24')](saveUpdates(_[_0x2cb5('0x3f')](_0x12a5fb[_0x2cb5('0x73')],[_0x2cb5('0x2a'),'description']),null))['then'](respondWithResult(_0x44d965,null))[_0x2cb5('0x4b')](handleError(_0x44d965,null));};exports[_0x2cb5('0x7a')]=function(_0x36844a,_0x513568,_0x2b36a2){return db[_0x2cb5('0x45')]['find']({'where':{'id':_0x36844a[_0x2cb5('0x48')]['id']}})[_0x2cb5('0x24')](function(_0x1c5402){if(_0x1c5402){return _0x1c5402[_0x2cb5('0x27')]();}})[_0x2cb5('0x24')](function(_0x43fe1b){var _0x45c6c3=path[_0x2cb5('0x4f')](config['root'],_0x2cb5('0x7b'),util[_0x2cb5('0x56')]('%s.%s',_0x43fe1b[_0x2cb5('0x4c')],_0x43fe1b[_0x2cb5('0x7c')]));var _0x46ccf3=path[_0x2cb5('0x4f')](config[_0x2cb5('0x50')],'server/files/sounds/converted',util[_0x2cb5('0x56')](_0x2cb5('0x57'),_0x43fe1b[_0x2cb5('0x4c')],_0x43fe1b['converted_format']));fs['unlinkSync'](_0x45c6c3);fs[_0x2cb5('0x64')](_0x46ccf3);return _0x43fe1b;})[_0x2cb5('0x24')](function(_0x2982e1){if(_0x2982e1){return _0x513568[_0x2cb5('0x1a')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x513568,null))[_0x2cb5('0x4b')](handleError(_0x513568,null));}; \ No newline at end of file +var _0xe1fe=['update','get','Sounds','UserProfileResource','destroy','then','error','stack','name','send','map','Sound','rawAttributes','fieldName','key','query','keys','model','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','pick','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','join','root','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError','download','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','format','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','json','apply','reject'];(function(_0x4d19bb,_0x2f9f5a){var _0x4f7095=function(_0x3fe4c3){while(--_0x3fe4c3){_0x4d19bb['push'](_0x4d19bb['shift']());}};_0x4f7095(++_0x2f9f5a);}(_0xe1fe,0x1c3));var _0xee1f=function(_0x57f463,_0x48358){_0x57f463=_0x57f463-0x0;var _0x1e9868=_0xe1fe[_0x57f463];return _0x1e9868;};'use strict';var pdf=require(_0xee1f('0x0'));var emlformat=require(_0xee1f('0x1'));var rimraf=require(_0xee1f('0x2'));var zipdir=require(_0xee1f('0x3'));var jsonpatch=require(_0xee1f('0x4'));var rp=require(_0xee1f('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xee1f('0x6'));var util=require(_0xee1f('0x7'));var path=require(_0xee1f('0x8'));var sox=require(_0xee1f('0x9'));var csv=require(_0xee1f('0xa'));var ejs=require(_0xee1f('0xb'));var fs=require('fs');var _=require(_0xee1f('0xc'));var squel=require(_0xee1f('0xd'));var crypto=require(_0xee1f('0xe'));var jsforce=require(_0xee1f('0xf'));var deskjs=require(_0xee1f('0x10'));var toCsv=require(_0xee1f('0xa'));var querystring=require(_0xee1f('0x11'));var Papa=require(_0xee1f('0x12'));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(_0xee1f('0x13'));var logger=require(_0xee1f('0x14'))(_0xee1f('0x15'));var utils=require(_0xee1f('0x16'));var config=require(_0xee1f('0x17'));var db=require(_0xee1f('0x18'))['db'];function respondWithStatusCode(_0x3f7f6e,_0xd8408d){_0xd8408d=_0xd8408d||0xcc;return function(_0x31512b){if(_0x31512b){return _0x3f7f6e[_0xee1f('0x19')](_0xd8408d);}return _0x3f7f6e[_0xee1f('0x1a')](_0xd8408d)[_0xee1f('0x1b')]();};}function respondWithResult(_0x1a8b4f,_0x39ac58){_0x39ac58=_0x39ac58||0xc8;return function(_0x3302c3){if(_0x3302c3){return _0x1a8b4f['status'](_0x39ac58)['json'](_0x3302c3);}};}function respondWithFilteredResult(_0x1028e8,_0x12900a){return function(_0x15d69f){if(_0x15d69f){var _0x15ebbc=_0x15d69f[_0xee1f('0x1c')],_0x158a8e=_0x12900a[_0xee1f('0x1d')],_0x264150=_0x12900a[_0xee1f('0x1d')]+_0x12900a['limit'],_0x1e2c32;if(_0x264150>=_0x15ebbc){_0x264150=_0x15ebbc;_0x1e2c32=0xc8;}else{_0x1e2c32=0xce;}_0x1028e8[_0xee1f('0x1a')](_0x1e2c32);return _0x1028e8['set']('Content-Range',_0x158a8e+'-'+_0x264150+'/'+_0x15ebbc)[_0xee1f('0x1e')](_0x15d69f);}return null;};}function patchUpdates(_0x247ad6){return function(_0x351ccb){try{jsonpatch[_0xee1f('0x1f')](_0x351ccb,_0x247ad6,!![]);}catch(_0x25cc33){return BPromise[_0xee1f('0x20')](_0x25cc33);}return _0x351ccb['save']();};}function saveUpdates(_0x251bcf,_0x3ebe79){return function(_0x29dad7){if(_0x29dad7){return _0x29dad7[_0xee1f('0x21')](_0x251bcf)['then'](function(_0x5a4a34){return _0x5a4a34;});}return null;};}function removeEntity(_0x325cfb,_0x2eefbc){return function(_0x361953){if(_0x361953){return _0x361953['destroy']()['then'](function(){var _0x18e6b4=_0x361953[_0xee1f('0x22')]({'plain':!![]});var _0x395044=_0xee1f('0x23');return db[_0xee1f('0x24')][_0xee1f('0x25')]({'where':{'type':_0x395044,'resourceId':_0x18e6b4['id']}})['then'](function(){return _0x361953;});})[_0xee1f('0x26')](function(){_0x325cfb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x131848,_0x2b4f19){return function(_0x50432d){if(!_0x50432d){_0x131848[_0xee1f('0x19')](0x194);}return _0x50432d;};}function handleError(_0x302386,_0x34d2f2){_0x34d2f2=_0x34d2f2||0x1f4;return function(_0x5e0ba8){logger[_0xee1f('0x27')](_0x5e0ba8[_0xee1f('0x28')]);if(_0x5e0ba8['name']){delete _0x5e0ba8[_0xee1f('0x29')];}_0x302386[_0xee1f('0x1a')](_0x34d2f2)[_0xee1f('0x2a')](_0x5e0ba8);};}exports['index']=function(_0x3ffb94,_0x5afa2f){var _0x125c30={},_0x4e3c47={},_0x473894={'count':0x0,'rows':[]};var _0x317806=_[_0xee1f('0x2b')](db[_0xee1f('0x2c')][_0xee1f('0x2d')],function(_0x19344b){return{'name':_0x19344b[_0xee1f('0x2e')],'type':_0x19344b['type'][_0xee1f('0x2f')]};});_0x4e3c47['model']=_[_0xee1f('0x2b')](_0x317806,_0xee1f('0x29'));_0x4e3c47[_0xee1f('0x30')]=_[_0xee1f('0x31')](_0x3ffb94['query']);_0x4e3c47['filters']=_['intersection'](_0x4e3c47[_0xee1f('0x32')],_0x4e3c47[_0xee1f('0x30')]);_0x125c30[_0xee1f('0x33')]=_['intersection'](_0x4e3c47[_0xee1f('0x32')],qs['fields'](_0x3ffb94['query'][_0xee1f('0x34')]));_0x125c30[_0xee1f('0x33')]=_0x125c30['attributes'][_0xee1f('0x35')]?_0x125c30[_0xee1f('0x33')]:_0x4e3c47[_0xee1f('0x32')];if(!_0x3ffb94[_0xee1f('0x30')][_0xee1f('0x36')]('nolimit')){_0x125c30[_0xee1f('0x37')]=qs[_0xee1f('0x37')](_0x3ffb94[_0xee1f('0x30')][_0xee1f('0x37')]);_0x125c30[_0xee1f('0x1d')]=qs['offset'](_0x3ffb94[_0xee1f('0x30')][_0xee1f('0x1d')]);}_0x125c30['order']=qs['sort'](_0x3ffb94[_0xee1f('0x30')][_0xee1f('0x38')]);_0x125c30[_0xee1f('0x39')]=qs[_0xee1f('0x3a')](_[_0xee1f('0x3b')](_0x3ffb94['query'],_0x4e3c47[_0xee1f('0x3a')]),_0x317806);if(_0x3ffb94[_0xee1f('0x30')]['filter']){_0x125c30[_0xee1f('0x39')]=_[_0xee1f('0x3c')](_0x125c30[_0xee1f('0x39')],{'$or':_[_0xee1f('0x2b')](_0x317806,function(_0x2cf0fc){if(_0x2cf0fc[_0xee1f('0x3d')]!==_0xee1f('0x3e')){var _0xee4eea={};_0xee4eea[_0x2cf0fc[_0xee1f('0x29')]]={'$like':'%'+_0x3ffb94['query']['filter']+'%'};return _0xee4eea;}})});}_0x125c30=_[_0xee1f('0x3c')]({},_0x125c30,_0x3ffb94['options']);var _0x15ec3f={'where':_0x125c30['where']};return db[_0xee1f('0x2c')][_0xee1f('0x1c')](_0x15ec3f)[_0xee1f('0x26')](function(_0x11ecef){_0x473894[_0xee1f('0x1c')]=_0x11ecef;if(_0x3ffb94['query'][_0xee1f('0x3f')]){_0x125c30['include']=[{'all':!![]}];}return db['Sound'][_0xee1f('0x40')](_0x125c30);})[_0xee1f('0x26')](function(_0x249ca9){_0x473894[_0xee1f('0x41')]=_0x249ca9;return _0x473894;})[_0xee1f('0x26')](respondWithFilteredResult(_0x5afa2f,_0x125c30))[_0xee1f('0x42')](handleError(_0x5afa2f,null));};exports[_0xee1f('0x43')]=function(_0x2fa0d3,_0x14a262){var _0x8a3c3c={'raw':!![],'where':{'id':_0x2fa0d3[_0xee1f('0x44')]['id']}},_0xec5457={};_0xec5457[_0xee1f('0x32')]=_[_0xee1f('0x31')](db[_0xee1f('0x2c')][_0xee1f('0x2d')]);_0xec5457[_0xee1f('0x30')]=_[_0xee1f('0x31')](_0x2fa0d3[_0xee1f('0x30')]);_0xec5457[_0xee1f('0x3a')]=_['intersection'](_0xec5457[_0xee1f('0x32')],_0xec5457[_0xee1f('0x30')]);_0x8a3c3c['attributes']=_['intersection'](_0xec5457[_0xee1f('0x32')],qs[_0xee1f('0x34')](_0x2fa0d3[_0xee1f('0x30')][_0xee1f('0x34')]));_0x8a3c3c['attributes']=_0x8a3c3c[_0xee1f('0x33')][_0xee1f('0x35')]?_0x8a3c3c[_0xee1f('0x33')]:_0xec5457['model'];if(_0x2fa0d3[_0xee1f('0x30')]['includeAll']){_0x8a3c3c['include']=[{'all':!![]}];}_0x8a3c3c=_[_0xee1f('0x3c')]({},_0x8a3c3c,_0x2fa0d3[_0xee1f('0x45')]);return db[_0xee1f('0x2c')]['find'](_0x8a3c3c)[_0xee1f('0x26')](handleEntityNotFound(_0x14a262,null))[_0xee1f('0x26')](respondWithResult(_0x14a262,null))[_0xee1f('0x42')](handleError(_0x14a262,null));};exports['download']=function(_0x3c340a,_0x265e2b,_0x4e8fc8){return db[_0xee1f('0x2c')][_0xee1f('0x46')]({'where':{'id':_0x3c340a['params']['id']},'attributes':['name','save_name','converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x265e2b,null))[_0xee1f('0x26')](function(_0x393a5c){if(_0x393a5c){if(!fs['existsSync'](path[_0xee1f('0x47')](config[_0xee1f('0x48')],_0xee1f('0x49'),_0x393a5c[_0xee1f('0x4a')]+'.'+_0x393a5c[_0xee1f('0x4b')]))){throw new db[(_0xee1f('0x4c'))][(_0xee1f('0x4d'))]('Sound\x20not\x20found');}return _0x265e2b[_0xee1f('0x4e')](path[_0xee1f('0x47')](config[_0xee1f('0x48')],_0xee1f('0x49'),util['format']('%s.%s',_0x393a5c['save_name'],_0x393a5c['converted_format'])),util['format'](_0xee1f('0x4f'),_0x393a5c[_0xee1f('0x29')],_0x393a5c['converted_format']));}return null;})[_0xee1f('0x42')](handleError(_0x265e2b,null));};exports[_0xee1f('0x50')]=function(_0x3d2ca4,_0x206371,_0x14dfa7){var _0x4da060={'name':path[_0xee1f('0x51')](_0x3d2ca4[_0xee1f('0x52')][_0xee1f('0x53')],path[_0xee1f('0x54')](_0x3d2ca4[_0xee1f('0x52')]['originalname'])),'save_name':path[_0xee1f('0x51')](_0x3d2ca4[_0xee1f('0x52')][_0xee1f('0x55')],path['extname'](_0x3d2ca4['file'][_0xee1f('0x55')])),'original_format':path[_0xee1f('0x54')](_0x3d2ca4[_0xee1f('0x52')][_0xee1f('0x53')])[_0xee1f('0x56')](0x1),'converted_format':_0xee1f('0x57')};var _0x1a6361=path[_0xee1f('0x47')](config['root'],_0xee1f('0x58'),_0x3d2ca4[_0xee1f('0x52')][_0xee1f('0x55')]);var _0x44031d=path[_0xee1f('0x47')](config[_0xee1f('0x48')],_0xee1f('0x49'),util[_0xee1f('0x59')](_0xee1f('0x4f'),path[_0xee1f('0x51')](_0x3d2ca4['file'][_0xee1f('0x55')],path[_0xee1f('0x54')](_0x3d2ca4[_0xee1f('0x52')][_0xee1f('0x55')])),_0x4da060[_0xee1f('0x4b')]));logger[_0xee1f('0x5a')](_0xee1f('0x5b'),_0x1a6361);logger[_0xee1f('0x5a')](_0xee1f('0x5c'),_0x44031d);try{fs[_0xee1f('0x5d')](_0x1a6361,parseInt(_0xee1f('0x5e'),0x8));var _0x6d8380=sox[_0xee1f('0x5f')](_0x1a6361,_0x44031d,{'sampleRate':0x1f40,'format':_0xee1f('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6d8380['on']('error',function(_0x376c4f){fs[_0xee1f('0x60')](_0x1a6361);_0x206371[_0xee1f('0x1a')](0x1f4)[_0xee1f('0x2a')](_0x376c4f);});_0x6d8380['on'](_0xee1f('0x61'),function(_0x2de2af){_0x4da060[_0xee1f('0x62')]=isNaN(_0x2de2af['duration'])?null:_0x2de2af[_0xee1f('0x63')]*0x3e8;_0x4da060['original_sampleCount']=isNaN(_0x2de2af[_0xee1f('0x64')])?null:_0x2de2af[_0xee1f('0x64')];_0x4da060[_0xee1f('0x65')]=isNaN(_0x2de2af[_0xee1f('0x66')])?null:_0x2de2af[_0xee1f('0x66')];_0x4da060[_0xee1f('0x67')]=isNaN(_0x2de2af['bitRate'])?null:_0x2de2af[_0xee1f('0x68')];_0x4da060[_0xee1f('0x69')]=isNaN(_0x2de2af[_0xee1f('0x6a')])?null:_0x2de2af[_0xee1f('0x6a')];});_0x6d8380['on']('dest',function(_0x336b7d){_0x4da060[_0xee1f('0x6b')]=isNaN(_0x336b7d[_0xee1f('0x63')])?null:_0x336b7d[_0xee1f('0x63')]*0x3e8;_0x4da060['converted_sampleCount']=isNaN(_0x336b7d[_0xee1f('0x64')])?null:_0x336b7d['sampleCount'];_0x4da060[_0xee1f('0x6c')]=isNaN(_0x336b7d[_0xee1f('0x66')])?null:_0x336b7d[_0xee1f('0x66')];_0x4da060[_0xee1f('0x6d')]=isNaN(_0x336b7d[_0xee1f('0x68')])?null:_0x336b7d[_0xee1f('0x68')];_0x4da060[_0xee1f('0x6e')]=isNaN(_0x336b7d[_0xee1f('0x6a')])?null:_0x336b7d[_0xee1f('0x6a')];});_0x6d8380['on'](_0xee1f('0x1b'),function(){fs[_0xee1f('0x5d')](_0x44031d,parseInt(_0xee1f('0x5e'),0x8));return db[_0xee1f('0x2c')]['create'](_0x4da060)[_0xee1f('0x26')](function(_0x4a85c5){var _0x5df0c7={'role':_0x3d2ca4[_0xee1f('0x6f')]['role'],'userProfileId':_0x3d2ca4[_0xee1f('0x6f')]['userProfileId']};if(!_0x5df0c7)throw new Error(_0xee1f('0x70'));if(_0x5df0c7[_0xee1f('0x71')]===_0xee1f('0x72')){var _0x51c4e4=_0x4a85c5[_0xee1f('0x22')]({'plain':!![]});return db[_0xee1f('0x73')][_0xee1f('0x46')]({'where':{'name':_0xee1f('0x23'),'userProfileId':_0x5df0c7[_0xee1f('0x74')]},'raw':!![]})[_0xee1f('0x26')](function(_0x4d028d){if(_0x4d028d&&_0x4d028d[_0xee1f('0x75')]===0x0){return db['UserProfileResource'][_0xee1f('0x50')]({'name':_0x51c4e4['name'],'resourceId':_0x51c4e4['id'],'type':_0x4d028d[_0xee1f('0x29')],'sectionId':_0x4d028d['id']},{})[_0xee1f('0x26')](function(){return _0x4a85c5;});}else{return _0x4a85c5;}})['catch'](function(_0x4e6ebe){logger[_0xee1f('0x27')](_0xee1f('0x76'),_0x4e6ebe);throw _0x4e6ebe;});}return _0x4a85c5;})[_0xee1f('0x26')](respondWithResult(_0x206371,null))[_0xee1f('0x42')](handleError(_0x206371,null));});_0x6d8380['start']();}catch(_0x342c92){_0x206371[_0xee1f('0x1a')](0x1f4)[_0xee1f('0x2a')](_0x342c92);}};exports[_0xee1f('0x21')]=function(_0x15df34,_0x17adfc,_0x1cb149){return db[_0xee1f('0x2c')][_0xee1f('0x46')]({'where':{'id':_0x15df34[_0xee1f('0x44')]['id']}})[_0xee1f('0x26')](handleEntityNotFound(_0x17adfc,null))['then'](saveUpdates(_[_0xee1f('0x3b')](_0x15df34[_0xee1f('0x6f')],['name','description']),null))[_0xee1f('0x26')](respondWithResult(_0x17adfc,null))['catch'](handleError(_0x17adfc,null));};exports[_0xee1f('0x77')]=function(_0x22c727,_0x551417,_0x1c157a){return db['Sound'][_0xee1f('0x46')]({'where':{'id':_0x22c727['params']['id']}})[_0xee1f('0x26')](function(_0x4078ea){if(_0x4078ea){return _0x4078ea[_0xee1f('0x25')]();}})[_0xee1f('0x26')](function(_0x5ea304){var _0x8ac020=path['join'](config['root'],_0xee1f('0x58'),util['format'](_0xee1f('0x4f'),_0x5ea304[_0xee1f('0x4a')],_0x5ea304[_0xee1f('0x78')]));var _0x3310a7=path[_0xee1f('0x47')](config['root'],_0xee1f('0x49'),util[_0xee1f('0x59')](_0xee1f('0x4f'),_0x5ea304[_0xee1f('0x4a')],_0x5ea304[_0xee1f('0x4b')]));fs['unlinkSync'](_0x8ac020);fs[_0xee1f('0x60')](_0x3310a7);return _0x5ea304;})[_0xee1f('0x26')](function(_0x3784ba){if(_0x3784ba){return _0x551417[_0xee1f('0x1a')](0xcc)[_0xee1f('0x1b')]();}})[_0xee1f('0x26')](handleEntityNotFound(_0x551417,null))[_0xee1f('0x42')](handleError(_0x551417,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index b15390b..f6ad024 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 _0xc368=['Sound','tools_sounds','util','api','moment','bluebird','request-promise','path','../../config/environment','./sound.attributes','exports'];(function(_0x42e632,_0x179f86){var _0x5af8bb=function(_0x355cac){while(--_0x355cac){_0x42e632['push'](_0x42e632['shift']());}};_0x5af8bb(++_0x179f86);}(_0xc368,0x7b));var _0x8c36=function(_0x5e7359,_0x45e861){_0x5e7359=_0x5e7359-0x0;var _0x3962b6=_0xc368[_0x5e7359];return _0x3962b6;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var logger=require('../../config/logger')(_0x8c36('0x1'));var moment=require(_0x8c36('0x2'));var BPromise=require(_0x8c36('0x3'));var rp=require(_0x8c36('0x4'));var fs=require('fs');var path=require(_0x8c36('0x5'));var rimraf=require('rimraf');var config=require(_0x8c36('0x6'));var attributes=require(_0x8c36('0x7'));module[_0x8c36('0x8')]=function(_0x1d3660,_0x5ebfc1){return _0x1d3660['define'](_0x8c36('0x9'),attributes,{'tableName':_0x8c36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cfd=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','Sound','tools_sounds','lodash'];(function(_0x259ceb,_0x353842){var _0x1d0d8e=function(_0x3404d6){while(--_0x3404d6){_0x259ceb['push'](_0x259ceb['shift']());}};_0x1d0d8e(++_0x353842);}(_0x9cfd,0x128));var _0xd9cf=function(_0x42a971,_0x337e98){_0x42a971=_0x42a971-0x0;var _0x47c6a9=_0x9cfd[_0x42a971];return _0x47c6a9;};'use strict';var _=require(_0xd9cf('0x0'));var util=require(_0xd9cf('0x1'));var logger=require(_0xd9cf('0x2'))('api');var moment=require(_0xd9cf('0x3'));var BPromise=require('bluebird');var rp=require(_0xd9cf('0x4'));var fs=require('fs');var path=require(_0xd9cf('0x5'));var rimraf=require(_0xd9cf('0x6'));var config=require(_0xd9cf('0x7'));var attributes=require(_0xd9cf('0x8'));module['exports']=function(_0x13eb8a,_0x345a25){return _0x13eb8a['define'](_0xd9cf('0x9'),attributes,{'tableName':_0xd9cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 5b3372f..7362084 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 _0x40d7=['model','attributes','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','Sound,\x20%s,\x20%s','message','catch','Sound','find','options','raw','where','map','include'];(function(_0x137c51,_0x1b0ab4){var _0x77b4d3=function(_0x246695){while(--_0x246695){_0x137c51['push'](_0x137c51['shift']());}};_0x77b4d3(++_0x1b0ab4);}(_0x40d7,0xbd));var _0x740d=function(_0x5af59e,_0x3771c1){_0x5af59e=_0x5af59e-0x0;var _0x4240df=_0x40d7[_0x5af59e];return _0x4240df;};'use strict';var _=require(_0x740d('0x0'));var util=require(_0x740d('0x1'));var moment=require(_0x740d('0x2'));var BPromise=require(_0x740d('0x3'));var rs=require(_0x740d('0x4'));var fs=require('fs');var Redis=require(_0x740d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x740d('0x6'))(_0x740d('0x7'));var config=require(_0x740d('0x8'));var jayson=require(_0x740d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaefd6f,_0xc862d7,_0x3d3f43){return new BPromise(function(_0x35ff4c,_0x3372c9){return client[_0x740d('0xa')](_0xaefd6f,_0x3d3f43)[_0x740d('0xb')](function(_0x13e6b3){logger[_0x740d('0xc')]('Sound,\x20%s,\x20%s',_0xc862d7,_0x740d('0xd'));logger[_0x740d('0xe')](_0x740d('0xf'),_0xc862d7,_0x740d('0xd'),JSON['stringify'](_0x13e6b3));if(_0x13e6b3['error']){if(_0x13e6b3[_0x740d('0x10')][_0x740d('0x11')]===0x1f4){logger[_0x740d('0x10')](_0x740d('0x12'),_0xc862d7,_0x13e6b3[_0x740d('0x10')][_0x740d('0x13')]);return _0x3372c9(_0x13e6b3[_0x740d('0x10')]['message']);}logger[_0x740d('0x10')](_0x740d('0x12'),_0xc862d7,_0x13e6b3[_0x740d('0x10')][_0x740d('0x13')]);return _0x35ff4c(_0x13e6b3['error'][_0x740d('0x13')]);}else{logger[_0x740d('0xc')]('Sound,\x20%s,\x20%s',_0xc862d7,_0x740d('0xd'));_0x35ff4c(_0x13e6b3['result'][_0x740d('0x13')]);}})[_0x740d('0x14')](function(_0x181825){logger['error']('Sound,\x20%s,\x20%s',_0xc862d7,_0x181825);_0x3372c9(_0x181825);});});}exports['ShowSound']=function(_0x1c611e){var _0x2be2c4=this;return new Promise(function(_0x5ad03f,_0x49febf){return db[_0x740d('0x15')][_0x740d('0x16')]({'raw':_0x1c611e[_0x740d('0x17')]?_0x1c611e[_0x740d('0x17')][_0x740d('0x18')]===undefined?!![]:![]:!![],'where':_0x1c611e[_0x740d('0x17')]?_0x1c611e[_0x740d('0x17')][_0x740d('0x19')]||null:null,'attributes':_0x1c611e['options']?_0x1c611e[_0x740d('0x17')]['attributes']||null:null,'include':_0x1c611e['options']?_0x1c611e['options']['include']?_[_0x740d('0x1a')](_0x1c611e[_0x740d('0x17')][_0x740d('0x1b')],function(_0xac13e4){return{'model':db[_0xac13e4[_0x740d('0x1c')]],'as':_0xac13e4['as'],'attributes':_0xac13e4[_0x740d('0x1d')],'include':_0xac13e4['include']?_['map'](_0xac13e4[_0x740d('0x1b')],function(_0x2fa8d0){return{'model':db[_0x2fa8d0[_0x740d('0x1c')]],'as':_0x2fa8d0['as'],'attributes':_0x2fa8d0[_0x740d('0x1d')],'include':_0x2fa8d0[_0x740d('0x1b')]?_[_0x740d('0x1a')](_0x2fa8d0[_0x740d('0x1b')],function(_0x40b6b8){return{'model':db[_0x40b6b8[_0x740d('0x1c')]],'as':_0x40b6b8['as'],'attributes':_0x40b6b8[_0x740d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d9d0d){logger['info'](_0x740d('0x1e'),_0x1c611e);logger[_0x740d('0xe')](_0x740d('0x1e'),_0x1c611e,JSON['stringify'](_0x2d9d0d));_0x5ad03f(_0x2d9d0d);})[_0x740d('0x14')](function(_0x1ee127){logger[_0x740d('0x10')](_0x740d('0x1e'),_0x1ee127[_0x740d('0x13')],_0x1c611e);_0x49febf(_0x2be2c4[_0x740d('0x10')](0x1f4,_0x1ee127[_0x740d('0x13')]));});});}; \ No newline at end of file +var _0x8c93=['result','catch','ShowSound','Sound','find','options','raw','attributes','map','include','model','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','Sound,\x20%s,\x20%s','message'];(function(_0x3f3c5e,_0x5b6773){var _0xe970e6=function(_0x2fa5d9){while(--_0x2fa5d9){_0x3f3c5e['push'](_0x3f3c5e['shift']());}};_0xe970e6(++_0x5b6773);}(_0x8c93,0xfa));var _0x38c9=function(_0xda929e,_0x2454bc){_0xda929e=_0xda929e-0x0;var _0x4575ab=_0x8c93[_0xda929e];return _0x4575ab;};'use strict';var _=require(_0x38c9('0x0'));var util=require(_0x38c9('0x1'));var moment=require(_0x38c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x38c9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38c9('0x4'))['db'];var utils=require(_0x38c9('0x5'));var logger=require(_0x38c9('0x6'))(_0x38c9('0x7'));var config=require(_0x38c9('0x8'));var jayson=require(_0x38c9('0x9'));var client=jayson[_0x38c9('0xa')][_0x38c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35753a,_0x3fbd1a,_0x1ac82f){return new BPromise(function(_0x4fa947,_0x3cc7c0){return client[_0x38c9('0xc')](_0x35753a,_0x1ac82f)[_0x38c9('0xd')](function(_0x348784){logger[_0x38c9('0xe')]('Sound,\x20%s,\x20%s',_0x3fbd1a,_0x38c9('0xf'));logger['debug'](_0x38c9('0x10'),_0x3fbd1a,_0x38c9('0xf'),JSON[_0x38c9('0x11')](_0x348784));if(_0x348784['error']){if(_0x348784['error'][_0x38c9('0x12')]===0x1f4){logger[_0x38c9('0x13')](_0x38c9('0x14'),_0x3fbd1a,_0x348784['error'][_0x38c9('0x15')]);return _0x3cc7c0(_0x348784[_0x38c9('0x13')][_0x38c9('0x15')]);}logger['error']('Sound,\x20%s,\x20%s',_0x3fbd1a,_0x348784['error'][_0x38c9('0x15')]);return _0x4fa947(_0x348784[_0x38c9('0x13')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x3fbd1a,_0x38c9('0xf'));_0x4fa947(_0x348784[_0x38c9('0x16')]['message']);}})[_0x38c9('0x17')](function(_0x18c3e3){logger['error']('Sound,\x20%s,\x20%s',_0x3fbd1a,_0x18c3e3);_0x3cc7c0(_0x18c3e3);});});}exports[_0x38c9('0x18')]=function(_0x49d318){var _0x33b1fb=this;return new Promise(function(_0x35de44,_0x98cf42){return db[_0x38c9('0x19')][_0x38c9('0x1a')]({'raw':_0x49d318[_0x38c9('0x1b')]?_0x49d318['options'][_0x38c9('0x1c')]===undefined?!![]:![]:!![],'where':_0x49d318[_0x38c9('0x1b')]?_0x49d318[_0x38c9('0x1b')]['where']||null:null,'attributes':_0x49d318[_0x38c9('0x1b')]?_0x49d318[_0x38c9('0x1b')][_0x38c9('0x1d')]||null:null,'include':_0x49d318[_0x38c9('0x1b')]?_0x49d318[_0x38c9('0x1b')]['include']?_[_0x38c9('0x1e')](_0x49d318['options'][_0x38c9('0x1f')],function(_0x5b82bc){return{'model':db[_0x5b82bc[_0x38c9('0x20')]],'as':_0x5b82bc['as'],'attributes':_0x5b82bc['attributes'],'include':_0x5b82bc[_0x38c9('0x1f')]?_[_0x38c9('0x1e')](_0x5b82bc[_0x38c9('0x1f')],function(_0x3a1237){return{'model':db[_0x3a1237[_0x38c9('0x20')]],'as':_0x3a1237['as'],'attributes':_0x3a1237[_0x38c9('0x1d')],'include':_0x3a1237[_0x38c9('0x1f')]?_[_0x38c9('0x1e')](_0x3a1237[_0x38c9('0x1f')],function(_0x1e1606){return{'model':db[_0x1e1606[_0x38c9('0x20')]],'as':_0x1e1606['as'],'attributes':_0x1e1606[_0x38c9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x38c9('0xd')](function(_0x1054eb){logger[_0x38c9('0xe')](_0x38c9('0x18'),_0x49d318);logger[_0x38c9('0x21')](_0x38c9('0x18'),_0x49d318,JSON['stringify'](_0x1054eb));_0x35de44(_0x1054eb);})[_0x38c9('0x17')](function(_0x5dfe05){logger['error'](_0x38c9('0x18'),_0x5dfe05[_0x38c9('0x15')],_0x49d318);_0x98cf42(_0x33b1fb[_0x38c9('0x13')](0x1f4,_0x5dfe05[_0x38c9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index cbb4c2a..c539c84 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 _0xf9d8=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareMessage.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x3828b2,_0x3f20a9){var _0x459805=function(_0x2d52ca){while(--_0x2d52ca){_0x3828b2['push'](_0x3828b2['shift']());}};_0x459805(++_0x3f20a9);}(_0xf9d8,0x1d0));var _0x8f9d=function(_0x4bb36a,_0x424329){_0x4bb36a=_0x4bb36a-0x0;var _0x5b1f2d=_0xf9d8[_0x4bb36a];return _0x5b1f2d;};'use strict';var multer=require(_0x8f9d('0x0'));var util=require(_0x8f9d('0x1'));var path=require(_0x8f9d('0x2'));var timeout=require(_0x8f9d('0x3'));var express=require(_0x8f9d('0x4'));var router=express[_0x8f9d('0x5')]();var auth=require(_0x8f9d('0x6'));var interaction=require(_0x8f9d('0x7'));var config=require('../../config/environment');var controller=require(_0x8f9d('0x8'));router[_0x8f9d('0x9')]('/',auth[_0x8f9d('0xa')](),controller['index']);router['get'](_0x8f9d('0xb'),auth['isAuthenticated'](),controller[_0x8f9d('0xc')]);router[_0x8f9d('0xd')]('/',auth['isAuthenticated'](),controller[_0x8f9d('0xe')]);router[_0x8f9d('0xf')](_0x8f9d('0xb'),auth[_0x8f9d('0xa')](),controller[_0x8f9d('0x10')]);router[_0x8f9d('0x11')](_0x8f9d('0xb'),auth[_0x8f9d('0xa')](),controller[_0x8f9d('0x12')]);module[_0x8f9d('0x13')]=router; \ No newline at end of file +var _0xf20d=['create','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./squareMessage.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xf20d,0x1ac));var _0xdf20=function(_0x201429,_0x54de48){_0x201429=_0x201429-0x0;var _0x2558f3=_0xf20d[_0x201429];return _0x2558f3;};'use strict';var multer=require(_0xdf20('0x0'));var util=require(_0xdf20('0x1'));var path=require(_0xdf20('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf20('0x3'));var router=express[_0xdf20('0x4')]();var auth=require(_0xdf20('0x5'));var interaction=require(_0xdf20('0x6'));var config=require('../../config/environment');var controller=require(_0xdf20('0x7'));router[_0xdf20('0x8')]('/',auth['isAuthenticated'](),controller[_0xdf20('0x9')]);router[_0xdf20('0x8')](_0xdf20('0xa'),auth[_0xdf20('0xb')](),controller[_0xdf20('0xc')]);router[_0xdf20('0xd')]('/',auth[_0xdf20('0xb')](),controller[_0xdf20('0xe')]);router['put'](_0xdf20('0xa'),auth[_0xdf20('0xb')](),controller[_0xdf20('0xf')]);router[_0xdf20('0x10')](_0xdf20('0xa'),auth[_0xdf20('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 880cb47..34e44ae 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 _0x8ea8=['ENUM','out','sequelize','TEXT','medium'];(function(_0x19c1ca,_0x881113){var _0x5960af=function(_0x3e568f){while(--_0x3e568f){_0x19c1ca['push'](_0x19c1ca['shift']());}};_0x5960af(++_0x881113);}(_0x8ea8,0xf2));var _0x88ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x88ea('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x88ea('0x1')](_0x88ea('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x88ea('0x3')]('in',_0x88ea('0x4')),'defaultValue':_0x88ea('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0x42ec=['STRING','medium','out','sequelize','exports'];(function(_0x190417,_0x54dc0d){var _0x110e9c=function(_0x517b86){while(--_0x517b86){_0x190417['push'](_0x190417['shift']());}};_0x110e9c(++_0x54dc0d);}(_0x42ec,0x8a));var _0xc42e=function(_0x3473a6,_0x3bbf1d){_0x3473a6=_0x3473a6-0x0;var _0x587786=_0x42ec[_0x3473a6];return _0x587786;};'use strict';var Sequelize=require(_0xc42e('0x0'));module[_0xc42e('0x1')]={'uniqueid':{'type':Sequelize[_0xc42e('0x2')]},'body':{'type':Sequelize['TEXT'](_0xc42e('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc42e('0x4')),'defaultValue':_0xc42e('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 77dfa9c..3e61153 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 _0xb65e=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','SquareMessage','includeAll','include','findAll','rows','catch','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb65e,0x130));var _0xeb65=function(_0x26e1b0,_0x2c098d){_0x26e1b0=_0x26e1b0-0x0;var _0x3d1eb1=_0xb65e[_0x26e1b0];return _0x3d1eb1;};'use strict';var pdf=require(_0xeb65('0x0'));var emlformat=require(_0xeb65('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeb65('0x2'));var jsonpatch=require(_0xeb65('0x3'));var rp=require('request-promise');var moment=require(_0xeb65('0x4'));var BPromise=require(_0xeb65('0x5'));var Mustache=require(_0xeb65('0x6'));var util=require('util');var path=require(_0xeb65('0x7'));var sox=require(_0xeb65('0x8'));var csv=require('to-csv');var ejs=require(_0xeb65('0x9'));var fs=require('fs');var _=require(_0xeb65('0xa'));var squel=require('squel');var crypto=require(_0xeb65('0xb'));var jsforce=require(_0xeb65('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeb65('0xd'));var qs=require(_0xeb65('0xe'));var as=require(_0xeb65('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb65('0x10'));var utils=require(_0xeb65('0x11'));var config=require(_0xeb65('0x12'));var db=require(_0xeb65('0x13'))['db'];function respondWithStatusCode(_0x459642,_0x26fccd){_0x26fccd=_0x26fccd||0xcc;return function(_0x33a429){if(_0x33a429){return _0x459642[_0xeb65('0x14')](_0x26fccd);}return _0x459642[_0xeb65('0x15')](_0x26fccd)[_0xeb65('0x16')]();};}function respondWithResult(_0x150ce1,_0x1563d7){_0x1563d7=_0x1563d7||0xc8;return function(_0x1db587){if(_0x1db587){return _0x150ce1[_0xeb65('0x15')](_0x1563d7)[_0xeb65('0x17')](_0x1db587);}};}function respondWithFilteredResult(_0x4e2803,_0x20b98d){return function(_0x5dc4b2){if(_0x5dc4b2){var _0x4c3357=_0x5dc4b2[_0xeb65('0x18')],_0x337943=_0x20b98d[_0xeb65('0x19')],_0x2782ef=_0x20b98d[_0xeb65('0x19')]+_0x20b98d[_0xeb65('0x1a')],_0x5ac3a1;if(_0x2782ef>=_0x4c3357){_0x2782ef=_0x4c3357;_0x5ac3a1=0xc8;}else{_0x5ac3a1=0xce;}_0x4e2803['status'](_0x5ac3a1);return _0x4e2803[_0xeb65('0x1b')](_0xeb65('0x1c'),_0x337943+'-'+_0x2782ef+'/'+_0x4c3357)['json'](_0x5dc4b2);}return null;};}function patchUpdates(_0x588864){return function(_0xbc9586){try{jsonpatch[_0xeb65('0x1d')](_0xbc9586,_0x588864,!![]);}catch(_0x5a16f6){return BPromise[_0xeb65('0x1e')](_0x5a16f6);}return _0xbc9586['save']();};}function saveUpdates(_0x2cdcfe,_0x2f9597){return function(_0x3c5743){if(_0x3c5743){return _0x3c5743[_0xeb65('0x1f')](_0x2cdcfe)[_0xeb65('0x20')](function(_0x34fc29){return _0x34fc29;});}return null;};}function removeEntity(_0x1d7505,_0x5ba6f7){return function(_0x152834){if(_0x152834){return _0x152834[_0xeb65('0x21')]()[_0xeb65('0x20')](function(){_0x1d7505[_0xeb65('0x15')](0xcc)[_0xeb65('0x16')]();});}};}function handleEntityNotFound(_0x5bcd9a,_0x3bca25){return function(_0x3d1ee3){if(!_0x3d1ee3){_0x5bcd9a[_0xeb65('0x14')](0x194);}return _0x3d1ee3;};}function handleError(_0x49e807,_0x22f7a1){_0x22f7a1=_0x22f7a1||0x1f4;return function(_0x11b818){logger[_0xeb65('0x22')](_0x11b818['stack']);if(_0x11b818[_0xeb65('0x23')]){delete _0x11b818[_0xeb65('0x23')];}_0x49e807[_0xeb65('0x15')](_0x22f7a1)['send'](_0x11b818);};}exports['index']=function(_0x56a3a9,_0x54e398){var _0x3e7aef={},_0x4b0108={},_0x14f07a={'count':0x0,'rows':[]};var _0xaf5224=_[_0xeb65('0x24')](db['SquareMessage'][_0xeb65('0x25')],function(_0x59739b){return{'name':_0x59739b[_0xeb65('0x26')],'type':_0x59739b['type']['key']};});_0x4b0108[_0xeb65('0x27')]=_['map'](_0xaf5224,'name');_0x4b0108[_0xeb65('0x28')]=_[_0xeb65('0x29')](_0x56a3a9[_0xeb65('0x28')]);_0x4b0108[_0xeb65('0x2a')]=_[_0xeb65('0x2b')](_0x4b0108['model'],_0x4b0108['query']);_0x3e7aef[_0xeb65('0x2c')]=_[_0xeb65('0x2b')](_0x4b0108[_0xeb65('0x27')],qs[_0xeb65('0x2d')](_0x56a3a9[_0xeb65('0x28')][_0xeb65('0x2d')]));_0x3e7aef['attributes']=_0x3e7aef['attributes'][_0xeb65('0x2e')]?_0x3e7aef[_0xeb65('0x2c')]:_0x4b0108[_0xeb65('0x27')];if(!_0x56a3a9[_0xeb65('0x28')][_0xeb65('0x2f')](_0xeb65('0x30'))){_0x3e7aef['limit']=qs[_0xeb65('0x1a')](_0x56a3a9[_0xeb65('0x28')]['limit']);_0x3e7aef[_0xeb65('0x19')]=qs[_0xeb65('0x19')](_0x56a3a9[_0xeb65('0x28')]['offset']);}_0x3e7aef[_0xeb65('0x31')]=qs[_0xeb65('0x32')](_0x56a3a9['query']['sort']);_0x3e7aef[_0xeb65('0x33')]=qs[_0xeb65('0x2a')](_['pick'](_0x56a3a9['query'],_0x4b0108[_0xeb65('0x2a')]),_0xaf5224);if(_0x56a3a9[_0xeb65('0x28')][_0xeb65('0x34')]){_0x3e7aef['where']=_['merge'](_0x3e7aef['where'],{'$or':_['map'](_0xaf5224,function(_0x26e1ef){if(_0x26e1ef['type']!=='VIRTUAL'){var _0x5592ba={};_0x5592ba[_0x26e1ef[_0xeb65('0x23')]]={'$like':'%'+_0x56a3a9['query']['filter']+'%'};return _0x5592ba;}})});}_0x3e7aef=_[_0xeb65('0x35')]({},_0x3e7aef,_0x56a3a9[_0xeb65('0x36')]);var _0x150690={'where':_0x3e7aef[_0xeb65('0x33')]};return db[_0xeb65('0x37')]['count'](_0x150690)[_0xeb65('0x20')](function(_0x4be961){_0x14f07a[_0xeb65('0x18')]=_0x4be961;if(_0x56a3a9[_0xeb65('0x28')][_0xeb65('0x38')]){_0x3e7aef[_0xeb65('0x39')]=[{'all':!![]}];}return db['SquareMessage'][_0xeb65('0x3a')](_0x3e7aef);})[_0xeb65('0x20')](function(_0x1f68b6){_0x14f07a[_0xeb65('0x3b')]=_0x1f68b6;return _0x14f07a;})['then'](respondWithFilteredResult(_0x54e398,_0x3e7aef))[_0xeb65('0x3c')](handleError(_0x54e398,null));};exports['show']=function(_0x42a13b,_0x558dc8){var _0x1f723a={'raw':!![],'where':{'id':_0x42a13b['params']['id']}},_0x158419={};_0x158419['model']=_[_0xeb65('0x29')](db[_0xeb65('0x37')][_0xeb65('0x25')]);_0x158419['query']=_[_0xeb65('0x29')](_0x42a13b[_0xeb65('0x28')]);_0x158419[_0xeb65('0x2a')]=_[_0xeb65('0x2b')](_0x158419[_0xeb65('0x27')],_0x158419[_0xeb65('0x28')]);_0x1f723a[_0xeb65('0x2c')]=_[_0xeb65('0x2b')](_0x158419[_0xeb65('0x27')],qs[_0xeb65('0x2d')](_0x42a13b[_0xeb65('0x28')]['fields']));_0x1f723a[_0xeb65('0x2c')]=_0x1f723a[_0xeb65('0x2c')][_0xeb65('0x2e')]?_0x1f723a[_0xeb65('0x2c')]:_0x158419[_0xeb65('0x27')];if(_0x42a13b['query']['includeAll']){_0x1f723a[_0xeb65('0x39')]=[{'all':!![]}];}_0x1f723a=_[_0xeb65('0x35')]({},_0x1f723a,_0x42a13b[_0xeb65('0x36')]);return db[_0xeb65('0x37')][_0xeb65('0x3d')](_0x1f723a)[_0xeb65('0x20')](handleEntityNotFound(_0x558dc8,null))['then'](respondWithResult(_0x558dc8,null))['catch'](handleError(_0x558dc8,null));};exports[_0xeb65('0x3e')]=function(_0x4827a2,_0x3ac699){return db[_0xeb65('0x37')][_0xeb65('0x3e')](_0x4827a2[_0xeb65('0x3f')],{})['then'](respondWithResult(_0x3ac699,0xc9))[_0xeb65('0x3c')](handleError(_0x3ac699,null));};exports[_0xeb65('0x1f')]=function(_0x5a9f4e,_0x3c0acc){if(_0x5a9f4e[_0xeb65('0x3f')]['id']){delete _0x5a9f4e[_0xeb65('0x3f')]['id'];}return db[_0xeb65('0x37')]['find']({'where':{'id':_0x5a9f4e[_0xeb65('0x40')]['id']}})[_0xeb65('0x20')](handleEntityNotFound(_0x3c0acc,null))[_0xeb65('0x20')](saveUpdates(_0x5a9f4e['body'],null))['then'](respondWithResult(_0x3c0acc,null))[_0xeb65('0x3c')](handleError(_0x3c0acc,null));};exports[_0xeb65('0x21')]=function(_0x5e6116,_0x5a4096){return db['SquareMessage'][_0xeb65('0x3d')]({'where':{'id':_0x5e6116[_0xeb65('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a4096,null))[_0xeb65('0x20')](removeEntity(_0x5a4096,null))[_0xeb65('0x3c')](handleError(_0x5a4096,null));}; \ No newline at end of file +var _0x125e=['merge','includeAll','include','findAll','catch','show','keys','options','find','create','body','update','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','error','stack','name','send','SquareMessage','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter'];(function(_0x26aae0,_0x27785b){var _0xf7c4f9=function(_0x1a35c9){while(--_0x1a35c9){_0x26aae0['push'](_0x26aae0['shift']());}};_0xf7c4f9(++_0x27785b);}(_0x125e,0xd3));var _0xe125=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x125e[_0x533e4e];return _0x1f14bb;};'use strict';var pdf=require(_0xe125('0x0'));var emlformat=require(_0xe125('0x1'));var rimraf=require(_0xe125('0x2'));var zipdir=require(_0xe125('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe125('0x4'));var moment=require('moment');var BPromise=require(_0xe125('0x5'));var Mustache=require(_0xe125('0x6'));var util=require(_0xe125('0x7'));var path=require('path');var sox=require(_0xe125('0x8'));var csv=require(_0xe125('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe125('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe125('0xb'));var deskjs=require(_0xe125('0xc'));var toCsv=require(_0xe125('0x9'));var querystring=require(_0xe125('0xd'));var Papa=require('papaparse');var Redis=require(_0xe125('0xe'));var authService=require(_0xe125('0xf'));var qs=require(_0xe125('0x10'));var as=require(_0xe125('0x11'));var hardwareService=require(_0xe125('0x12'));var logger=require('../../config/logger')(_0xe125('0x13'));var utils=require(_0xe125('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53b8f6,_0x591490){_0x591490=_0x591490||0xcc;return function(_0x8759ac){if(_0x8759ac){return _0x53b8f6[_0xe125('0x15')](_0x591490);}return _0x53b8f6['status'](_0x591490)[_0xe125('0x16')]();};}function respondWithResult(_0x387773,_0xba3e95){_0xba3e95=_0xba3e95||0xc8;return function(_0x553cd3){if(_0x553cd3){return _0x387773[_0xe125('0x17')](_0xba3e95)[_0xe125('0x18')](_0x553cd3);}};}function respondWithFilteredResult(_0x31dfa2,_0x536e27){return function(_0x9f627b){if(_0x9f627b){var _0x296b2b=_0x9f627b[_0xe125('0x19')],_0x8c1f5=_0x536e27[_0xe125('0x1a')],_0x2c3065=_0x536e27[_0xe125('0x1a')]+_0x536e27[_0xe125('0x1b')],_0x3ce41e;if(_0x2c3065>=_0x296b2b){_0x2c3065=_0x296b2b;_0x3ce41e=0xc8;}else{_0x3ce41e=0xce;}_0x31dfa2['status'](_0x3ce41e);return _0x31dfa2[_0xe125('0x1c')](_0xe125('0x1d'),_0x8c1f5+'-'+_0x2c3065+'/'+_0x296b2b)[_0xe125('0x18')](_0x9f627b);}return null;};}function patchUpdates(_0x1d0500){return function(_0x2455f9){try{jsonpatch['apply'](_0x2455f9,_0x1d0500,!![]);}catch(_0x218b66){return BPromise[_0xe125('0x1e')](_0x218b66);}return _0x2455f9[_0xe125('0x1f')]();};}function saveUpdates(_0x13c9fa,_0x55a268){return function(_0x57043d){if(_0x57043d){return _0x57043d['update'](_0x13c9fa)['then'](function(_0x490cee){return _0x490cee;});}return null;};}function removeEntity(_0x4605de,_0x1a00e5){return function(_0x2ff0aa){if(_0x2ff0aa){return _0x2ff0aa[_0xe125('0x20')]()[_0xe125('0x21')](function(){_0x4605de[_0xe125('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb4dd5,_0x4bbc1f){return function(_0x4a16b0){if(!_0x4a16b0){_0xfb4dd5['sendStatus'](0x194);}return _0x4a16b0;};}function handleError(_0x2b1ef7,_0x516630){_0x516630=_0x516630||0x1f4;return function(_0x390eeb){logger[_0xe125('0x22')](_0x390eeb[_0xe125('0x23')]);if(_0x390eeb[_0xe125('0x24')]){delete _0x390eeb[_0xe125('0x24')];}_0x2b1ef7['status'](_0x516630)[_0xe125('0x25')](_0x390eeb);};}exports['index']=function(_0x2dd8c1,_0x566088){var _0x56d81c={},_0x210f75={},_0x45100c={'count':0x0,'rows':[]};var _0x4a8168=_['map'](db[_0xe125('0x26')]['rawAttributes'],function(_0xa4cc23){return{'name':_0xa4cc23['fieldName'],'type':_0xa4cc23['type'][_0xe125('0x27')]};});_0x210f75[_0xe125('0x28')]=_[_0xe125('0x29')](_0x4a8168,_0xe125('0x24'));_0x210f75[_0xe125('0x2a')]=_['keys'](_0x2dd8c1[_0xe125('0x2a')]);_0x210f75[_0xe125('0x2b')]=_[_0xe125('0x2c')](_0x210f75['model'],_0x210f75[_0xe125('0x2a')]);_0x56d81c[_0xe125('0x2d')]=_[_0xe125('0x2c')](_0x210f75[_0xe125('0x28')],qs[_0xe125('0x2e')](_0x2dd8c1[_0xe125('0x2a')][_0xe125('0x2e')]));_0x56d81c[_0xe125('0x2d')]=_0x56d81c[_0xe125('0x2d')][_0xe125('0x2f')]?_0x56d81c['attributes']:_0x210f75[_0xe125('0x28')];if(!_0x2dd8c1['query'][_0xe125('0x30')]('nolimit')){_0x56d81c['limit']=qs['limit'](_0x2dd8c1[_0xe125('0x2a')][_0xe125('0x1b')]);_0x56d81c[_0xe125('0x1a')]=qs[_0xe125('0x1a')](_0x2dd8c1['query']['offset']);}_0x56d81c['order']=qs[_0xe125('0x31')](_0x2dd8c1[_0xe125('0x2a')][_0xe125('0x31')]);_0x56d81c[_0xe125('0x32')]=qs['filters'](_[_0xe125('0x33')](_0x2dd8c1[_0xe125('0x2a')],_0x210f75[_0xe125('0x2b')]),_0x4a8168);if(_0x2dd8c1[_0xe125('0x2a')]['filter']){_0x56d81c[_0xe125('0x32')]=_['merge'](_0x56d81c[_0xe125('0x32')],{'$or':_[_0xe125('0x29')](_0x4a8168,function(_0x272f08){if(_0x272f08['type']!=='VIRTUAL'){var _0x14ba9f={};_0x14ba9f[_0x272f08[_0xe125('0x24')]]={'$like':'%'+_0x2dd8c1[_0xe125('0x2a')][_0xe125('0x34')]+'%'};return _0x14ba9f;}})});}_0x56d81c=_[_0xe125('0x35')]({},_0x56d81c,_0x2dd8c1['options']);var _0x5ee8e0={'where':_0x56d81c[_0xe125('0x32')]};return db[_0xe125('0x26')][_0xe125('0x19')](_0x5ee8e0)[_0xe125('0x21')](function(_0x2e275d){_0x45100c[_0xe125('0x19')]=_0x2e275d;if(_0x2dd8c1['query'][_0xe125('0x36')]){_0x56d81c[_0xe125('0x37')]=[{'all':!![]}];}return db[_0xe125('0x26')][_0xe125('0x38')](_0x56d81c);})[_0xe125('0x21')](function(_0x37103c){_0x45100c['rows']=_0x37103c;return _0x45100c;})[_0xe125('0x21')](respondWithFilteredResult(_0x566088,_0x56d81c))[_0xe125('0x39')](handleError(_0x566088,null));};exports[_0xe125('0x3a')]=function(_0x333538,_0x4418dc){var _0x1dcd90={'raw':!![],'where':{'id':_0x333538['params']['id']}},_0x527bd8={};_0x527bd8[_0xe125('0x28')]=_['keys'](db[_0xe125('0x26')]['rawAttributes']);_0x527bd8[_0xe125('0x2a')]=_[_0xe125('0x3b')](_0x333538[_0xe125('0x2a')]);_0x527bd8[_0xe125('0x2b')]=_[_0xe125('0x2c')](_0x527bd8[_0xe125('0x28')],_0x527bd8[_0xe125('0x2a')]);_0x1dcd90[_0xe125('0x2d')]=_[_0xe125('0x2c')](_0x527bd8[_0xe125('0x28')],qs[_0xe125('0x2e')](_0x333538[_0xe125('0x2a')]['fields']));_0x1dcd90[_0xe125('0x2d')]=_0x1dcd90['attributes'][_0xe125('0x2f')]?_0x1dcd90[_0xe125('0x2d')]:_0x527bd8[_0xe125('0x28')];if(_0x333538[_0xe125('0x2a')][_0xe125('0x36')]){_0x1dcd90[_0xe125('0x37')]=[{'all':!![]}];}_0x1dcd90=_[_0xe125('0x35')]({},_0x1dcd90,_0x333538[_0xe125('0x3c')]);return db[_0xe125('0x26')][_0xe125('0x3d')](_0x1dcd90)[_0xe125('0x21')](handleEntityNotFound(_0x4418dc,null))[_0xe125('0x21')](respondWithResult(_0x4418dc,null))[_0xe125('0x39')](handleError(_0x4418dc,null));};exports[_0xe125('0x3e')]=function(_0x7e66de,_0x531678){return db[_0xe125('0x26')]['create'](_0x7e66de[_0xe125('0x3f')],{})[_0xe125('0x21')](respondWithResult(_0x531678,0xc9))['catch'](handleError(_0x531678,null));};exports[_0xe125('0x40')]=function(_0x5132cf,_0x577188){if(_0x5132cf[_0xe125('0x3f')]['id']){delete _0x5132cf[_0xe125('0x3f')]['id'];}return db[_0xe125('0x26')][_0xe125('0x3d')]({'where':{'id':_0x5132cf[_0xe125('0x41')]['id']}})[_0xe125('0x21')](handleEntityNotFound(_0x577188,null))[_0xe125('0x21')](saveUpdates(_0x5132cf['body'],null))[_0xe125('0x21')](respondWithResult(_0x577188,null))['catch'](handleError(_0x577188,null));};exports[_0xe125('0x20')]=function(_0x8507c5,_0x31c52d){return db['SquareMessage'][_0xe125('0x3d')]({'where':{'id':_0x8507c5[_0xe125('0x41')]['id']}})[_0xe125('0x21')](handleEntityNotFound(_0x31c52d,null))[_0xe125('0x21')](removeEntity(_0x31c52d,null))['catch'](handleError(_0x31c52d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 4655f91..c3772a8 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 _0xdc97=['path','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x571bbc,_0x242132){var _0x3e8edb=function(_0x5cc0a2){while(--_0x5cc0a2){_0x571bbc['push'](_0x571bbc['shift']());}};_0x3e8edb(++_0x242132);}(_0xdc97,0x13b));var _0x7dc9=function(_0x3a8fb1,_0x1c084d){_0x3a8fb1=_0x3a8fb1-0x0;var _0x42ecde=_0xdc97[_0x3a8fb1];return _0x42ecde;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./squareMessage.attributes','define','square_messages','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x168e4c,_0x634aaf){var _0x4c9813=function(_0x101941){while(--_0x101941){_0x168e4c['push'](_0x168e4c['shift']());}};_0x4c9813(++_0x634aaf);}(_0x31f0,0xb7));var _0x031f=function(_0x55ac80,_0x2d36e9){_0x55ac80=_0x55ac80-0x0;var _0x36bef2=_0x31f0[_0x55ac80];return _0x36bef2;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('SquareMessage',attributes,{'tableName':_0x031f('0x9'),'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 480e40a..ba1b625 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 _0x31c2=['request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x2fa0c6,_0x45fbeb){var _0x36ffb0=function(_0x3e82f1){while(--_0x3e82f1){_0x2fa0c6['push'](_0x2fa0c6['shift']());}};_0x36ffb0(++_0x45fbeb);}(_0x31c2,0x1e1));var _0x231c=function(_0x2d06cd,_0x1b435c){_0x2d06cd=_0x2d06cd-0x0;var _0xf450f8=_0x31c2[_0x2d06cd];return _0xf450f8;};'use strict';var _=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var moment=require(_0x231c('0x2'));var BPromise=require(_0x231c('0x3'));var rs=require(_0x231c('0x4'));var fs=require('fs');var Redis=require(_0x231c('0x5'));var db=require(_0x231c('0x6'))['db'];var utils=require(_0x231c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x231c('0x8'));var jayson=require(_0x231c('0x9'));var client=jayson[_0x231c('0xa')][_0x231c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48bfb2,_0x111bf9,_0x49ff9e){return new BPromise(function(_0x439df8,_0x38b3b9){return client[_0x231c('0xc')](_0x48bfb2,_0x49ff9e)['then'](function(_0x2524bf){logger[_0x231c('0xd')](_0x231c('0xe'),_0x111bf9,_0x231c('0xf'));logger[_0x231c('0x10')](_0x231c('0x11'),_0x111bf9,_0x231c('0xf'),JSON['stringify'](_0x2524bf));if(_0x2524bf[_0x231c('0x12')]){if(_0x2524bf[_0x231c('0x12')]['code']===0x1f4){logger[_0x231c('0x12')](_0x231c('0xe'),_0x111bf9,_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);return _0x38b3b9(_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);}logger[_0x231c('0x12')](_0x231c('0xe'),_0x111bf9,_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);return _0x439df8(_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);}else{logger[_0x231c('0xd')](_0x231c('0xe'),_0x111bf9,_0x231c('0xf'));_0x439df8(_0x2524bf[_0x231c('0x14')][_0x231c('0x13')]);}})[_0x231c('0x15')](function(_0x1852e5){logger[_0x231c('0x12')]('SquareMessage,\x20%s,\x20%s',_0x111bf9,_0x1852e5);_0x38b3b9(_0x1852e5);});});}exports[_0x231c('0x16')]=function(_0x341645){var _0x17f9ce=this;return new Promise(function(_0xadea80,_0x36aebc){return db[_0x231c('0x17')][_0x231c('0x18')](_0x341645[_0x231c('0x19')],{'raw':_0x341645[_0x231c('0x1a')]?_0x341645[_0x231c('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x231c('0x1b')](function(_0x5e8a53){logger[_0x231c('0xd')]('CreateSquareMessage',_0x341645);logger[_0x231c('0x10')](_0x231c('0x16'),_0x341645,JSON[_0x231c('0x1c')](_0x5e8a53));_0xadea80(_0x5e8a53);})[_0x231c('0x15')](function(_0x255671){logger[_0x231c('0x12')](_0x231c('0x16'),_0x255671[_0x231c('0x13')],_0x341645);_0x36aebc(_0x17f9ce['error'](0x1f4,_0x255671[_0x231c('0x13')]));});});}; \ No newline at end of file +var _0x0ec6=['body','options','raw','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create'];(function(_0x55a49f,_0x3c2cef){var _0x52eeda=function(_0x482dff){while(--_0x482dff){_0x55a49f['push'](_0x55a49f['shift']());}};_0x52eeda(++_0x3c2cef);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x554aa4,_0x3e2572){_0x554aa4=_0x554aa4-0x0;var _0x50e6ae=_0x0ec6[_0x554aa4];return _0x50e6ae;};'use strict';var _=require(_0x60ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x60ec('0x1'));var rs=require(_0x60ec('0x2'));var fs=require('fs');var Redis=require(_0x60ec('0x3'));var db=require(_0x60ec('0x4'))['db'];var utils=require(_0x60ec('0x5'));var logger=require(_0x60ec('0x6'))(_0x60ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x60ec('0x8'));var client=jayson[_0x60ec('0x9')][_0x60ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x74adc4,_0x5d4cba,_0xcb974c){return new BPromise(function(_0x488ab8,_0x2c4a14){return client[_0x60ec('0xb')](_0x74adc4,_0xcb974c)[_0x60ec('0xc')](function(_0x1363c2){logger[_0x60ec('0xd')](_0x60ec('0xe'),_0x5d4cba,'request\x20sent');logger['debug'](_0x60ec('0xf'),_0x5d4cba,_0x60ec('0x10'),JSON[_0x60ec('0x11')](_0x1363c2));if(_0x1363c2[_0x60ec('0x12')]){if(_0x1363c2[_0x60ec('0x12')]['code']===0x1f4){logger['error'](_0x60ec('0xe'),_0x5d4cba,_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);return _0x2c4a14(_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);}logger['error'](_0x60ec('0xe'),_0x5d4cba,_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);return _0x488ab8(_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);}else{logger[_0x60ec('0xd')](_0x60ec('0xe'),_0x5d4cba,_0x60ec('0x10'));_0x488ab8(_0x1363c2[_0x60ec('0x14')]['message']);}})[_0x60ec('0x15')](function(_0x2778dd){logger[_0x60ec('0x12')](_0x60ec('0xe'),_0x5d4cba,_0x2778dd);_0x2c4a14(_0x2778dd);});});}exports[_0x60ec('0x16')]=function(_0x222c38){var _0x27d863=this;return new Promise(function(_0x13052c,_0xbca8e2){return db[_0x60ec('0x17')][_0x60ec('0x18')](_0x222c38[_0x60ec('0x19')],{'raw':_0x222c38['options']?_0x222c38[_0x60ec('0x1a')][_0x60ec('0x1b')]===undefined?!![]:![]:!![]})[_0x60ec('0xc')](function(_0x278ae3){logger['info'](_0x60ec('0x16'),_0x222c38);logger[_0x60ec('0x1c')](_0x60ec('0x16'),_0x222c38,JSON[_0x60ec('0x11')](_0x278ae3));_0x13052c(_0x278ae3);})[_0x60ec('0x15')](function(_0x354f08){logger['error']('CreateSquareMessage',_0x354f08['message'],_0x222c38);_0xbca8e2(_0x27d863[_0x60ec('0x12')](0x1f4,_0x354f08[_0x60ec('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9b386ba..459cfe1 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 _0xbfd9=['update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','test','post','create','put'];(function(_0x2d37b7,_0x3bf618){var _0x4dfbdb=function(_0x18fc40){while(--_0x18fc40){_0x2d37b7['push'](_0x2d37b7['shift']());}};_0x4dfbdb(++_0x3bf618);}(_0xbfd9,0x1d0));var _0x9bfd=function(_0x1ff2c6,_0x21c9b8){_0x1ff2c6=_0x1ff2c6-0x0;var _0x308eb9=_0xbfd9[_0x1ff2c6];return _0x308eb9;};'use strict';var multer=require('multer');var util=require(_0x9bfd('0x0'));var path=require('path');var timeout=require(_0x9bfd('0x1'));var express=require(_0x9bfd('0x2'));var router=express['Router']();var auth=require(_0x9bfd('0x3'));var interaction=require(_0x9bfd('0x4'));var config=require(_0x9bfd('0x5'));var controller=require(_0x9bfd('0x6'));router['get']('/',auth[_0x9bfd('0x7')](),controller[_0x9bfd('0x8')]);router[_0x9bfd('0x9')](_0x9bfd('0xa'),auth[_0x9bfd('0x7')](),controller[_0x9bfd('0xb')]);router[_0x9bfd('0x9')]('/:id/test',auth[_0x9bfd('0x7')](),timeout('15s'),controller[_0x9bfd('0xc')]);router[_0x9bfd('0xd')]('/',auth['isAuthenticated'](),controller[_0x9bfd('0xe')]);router[_0x9bfd('0xf')](_0x9bfd('0xa'),auth[_0x9bfd('0x7')](),controller[_0x9bfd('0x10')]);router[_0x9bfd('0x11')](_0x9bfd('0xa'),auth[_0x9bfd('0x7')](),controller[_0x9bfd('0x12')]);module[_0x9bfd('0x13')]=router; \ No newline at end of file +var _0x4958=['isAuthenticated','15s','test','post','create','put','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','/:id/test'];(function(_0x1222a7,_0x41cb32){var _0x47f53e=function(_0x1dfb2c){while(--_0x1dfb2c){_0x1222a7['push'](_0x1222a7['shift']());}};_0x47f53e(++_0x41cb32);}(_0x4958,0x192));var _0x8495=function(_0x12c8ff,_0x15857a){_0x12c8ff=_0x12c8ff-0x0;var _0x46281f=_0x4958[_0x12c8ff];return _0x46281f;};'use strict';var multer=require('multer');var util=require(_0x8495('0x0'));var path=require(_0x8495('0x1'));var timeout=require(_0x8495('0x2'));var express=require(_0x8495('0x3'));var router=express[_0x8495('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8495('0x5'));var config=require(_0x8495('0x6'));var controller=require(_0x8495('0x7'));router[_0x8495('0x8')]('/',auth['isAuthenticated'](),controller[_0x8495('0x9')]);router[_0x8495('0x8')](_0x8495('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8495('0x8')](_0x8495('0xb'),auth[_0x8495('0xc')](),timeout(_0x8495('0xd')),controller[_0x8495('0xe')]);router[_0x8495('0xf')]('/',auth[_0x8495('0xc')](),controller[_0x8495('0x10')]);router[_0x8495('0x11')]('/:id',auth[_0x8495('0xc')](),controller['update']);router['delete'](_0x8495('0xa'),auth[_0x8495('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index acf9fa0..d230362 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 _0x8421=['STRING','name','sequelize'];(function(_0x47e522,_0x3d2cb1){var _0x4f1f78=function(_0x27b351){while(--_0x27b351){_0x47e522['push'](_0x47e522['shift']());}};_0x4f1f78(++_0x3d2cb1);}(_0x8421,0x1b5));var _0x1842=function(_0x1cd93a,_0x4399b7){_0x1cd93a=_0x1cd93a-0x0;var _0x11e592=_0x8421[_0x1cd93a];return _0x11e592;};'use strict';var Sequelize=require(_0x1842('0x0'));module['exports']={'name':{'type':Sequelize[_0x1842('0x1')],'unique':_0x1842('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x1842('0x1')]},'description':{'type':Sequelize[_0x1842('0x1')]}}; \ No newline at end of file +var _0x9608=['exports','name','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9608,0x132));var _0x8960=function(_0x4bb58d,_0x411f50){_0x4bb58d=_0x4bb58d-0x0;var _0x444bfb=_0x9608[_0x4bb58d];return _0x444bfb;};'use strict';var Sequelize=require('sequelize');module[_0x8960('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8960('0x1'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8960('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f1d5772..89fccfe 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 _0xffe5=['set','Content-Range','apply','reject','destroy','then','get','ODBC','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status'];(function(_0xffb12e,_0x72099d){var _0xc4bce8=function(_0x13178f){while(--_0x13178f){_0xffb12e['push'](_0xffb12e['shift']());}};_0xc4bce8(++_0x72099d);}(_0xffe5,0x1e5));var _0x5ffe=function(_0x29a72f,_0xd8b4b5){_0x29a72f=_0x29a72f-0x0;var _0x31527d=_0xffe5[_0x29a72f];return _0x31527d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5ffe('0x0'));var rimraf=require(_0x5ffe('0x1'));var zipdir=require(_0x5ffe('0x2'));var jsonpatch=require(_0x5ffe('0x3'));var rp=require('request-promise');var moment=require(_0x5ffe('0x4'));var BPromise=require(_0x5ffe('0x5'));var Mustache=require('mustache');var util=require(_0x5ffe('0x6'));var path=require(_0x5ffe('0x7'));var sox=require(_0x5ffe('0x8'));var csv=require(_0x5ffe('0x9'));var ejs=require(_0x5ffe('0xa'));var fs=require('fs');var _=require(_0x5ffe('0xb'));var squel=require('squel');var crypto=require(_0x5ffe('0xc'));var jsforce=require(_0x5ffe('0xd'));var deskjs=require(_0x5ffe('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5ffe('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5ffe('0x10'));var as=require(_0x5ffe('0x11'));var hardwareService=require(_0x5ffe('0x12'));var logger=require(_0x5ffe('0x13'))(_0x5ffe('0x14'));var utils=require(_0x5ffe('0x15'));var config=require(_0x5ffe('0x16'));var db=require(_0x5ffe('0x17'))['db'];function respondWithStatusCode(_0x111333,_0x47b040){_0x47b040=_0x47b040||0xcc;return function(_0x3c4f14){if(_0x3c4f14){return _0x111333[_0x5ffe('0x18')](_0x47b040);}return _0x111333['status'](_0x47b040)[_0x5ffe('0x19')]();};}function respondWithResult(_0x33b31b,_0xc49378){_0xc49378=_0xc49378||0xc8;return function(_0x3b9f01){if(_0x3b9f01){return _0x33b31b['status'](_0xc49378)[_0x5ffe('0x1a')](_0x3b9f01);}};}function respondWithFilteredResult(_0x53ae6a,_0x3eda95){return function(_0x1cf3d2){if(_0x1cf3d2){var _0x497315=_0x1cf3d2[_0x5ffe('0x1b')],_0x4c03e1=_0x3eda95[_0x5ffe('0x1c')],_0x535342=_0x3eda95[_0x5ffe('0x1c')]+_0x3eda95[_0x5ffe('0x1d')],_0x1c45c1;if(_0x535342>=_0x497315){_0x535342=_0x497315;_0x1c45c1=0xc8;}else{_0x1c45c1=0xce;}_0x53ae6a[_0x5ffe('0x1e')](_0x1c45c1);return _0x53ae6a[_0x5ffe('0x1f')](_0x5ffe('0x20'),_0x4c03e1+'-'+_0x535342+'/'+_0x497315)[_0x5ffe('0x1a')](_0x1cf3d2);}return null;};}function patchUpdates(_0x45ae8b){return function(_0x4acaf3){try{jsonpatch[_0x5ffe('0x21')](_0x4acaf3,_0x45ae8b,!![]);}catch(_0x54b91d){return BPromise[_0x5ffe('0x22')](_0x54b91d);}return _0x4acaf3['save']();};}function saveUpdates(_0x472377,_0x16138c){return function(_0x11b34d){if(_0x11b34d){return _0x11b34d['update'](_0x472377)['then'](function(_0x58cb60){return _0x58cb60;});}return null;};}function removeEntity(_0x51c063,_0x1ab861){return function(_0x3ee8fb){if(_0x3ee8fb){return _0x3ee8fb[_0x5ffe('0x23')]()[_0x5ffe('0x24')](function(){var _0xb7c8ba=_0x3ee8fb[_0x5ffe('0x25')]({'plain':!![]});var _0x698781=_0x5ffe('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x698781,'resourceId':_0xb7c8ba['id']}})[_0x5ffe('0x24')](function(){return _0x3ee8fb;});})['then'](function(){_0x51c063[_0x5ffe('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2314a4,_0x1a0de6){return function(_0x16054d){if(!_0x16054d){_0x2314a4['sendStatus'](0x194);}return _0x16054d;};}function handleError(_0x523447,_0x29ba95){_0x29ba95=_0x29ba95||0x1f4;return function(_0x508f3b){logger[_0x5ffe('0x27')](_0x508f3b[_0x5ffe('0x28')]);if(_0x508f3b[_0x5ffe('0x29')]){delete _0x508f3b[_0x5ffe('0x29')];}_0x523447[_0x5ffe('0x1e')](_0x29ba95)['send'](_0x508f3b);};}exports[_0x5ffe('0x2a')]=function(_0x31423a,_0x12b89e){var _0x5096fc={},_0x1975ca={},_0x57a6a5={'count':0x0,'rows':[]};var _0x1bfdb4=_[_0x5ffe('0x2b')](db[_0x5ffe('0x2c')][_0x5ffe('0x2d')],function(_0x462fd7){return{'name':_0x462fd7[_0x5ffe('0x2e')],'type':_0x462fd7[_0x5ffe('0x2f')][_0x5ffe('0x30')]};});_0x1975ca[_0x5ffe('0x31')]=_[_0x5ffe('0x2b')](_0x1bfdb4,_0x5ffe('0x29'));_0x1975ca[_0x5ffe('0x32')]=_[_0x5ffe('0x33')](_0x31423a[_0x5ffe('0x32')]);_0x1975ca[_0x5ffe('0x34')]=_[_0x5ffe('0x35')](_0x1975ca['model'],_0x1975ca[_0x5ffe('0x32')]);_0x5096fc[_0x5ffe('0x36')]=_[_0x5ffe('0x35')](_0x1975ca['model'],qs[_0x5ffe('0x37')](_0x31423a['query'][_0x5ffe('0x37')]));_0x5096fc[_0x5ffe('0x36')]=_0x5096fc[_0x5ffe('0x36')][_0x5ffe('0x38')]?_0x5096fc[_0x5ffe('0x36')]:_0x1975ca[_0x5ffe('0x31')];if(!_0x31423a[_0x5ffe('0x32')][_0x5ffe('0x39')](_0x5ffe('0x3a'))){_0x5096fc['limit']=qs[_0x5ffe('0x1d')](_0x31423a[_0x5ffe('0x32')][_0x5ffe('0x1d')]);_0x5096fc['offset']=qs[_0x5ffe('0x1c')](_0x31423a['query'][_0x5ffe('0x1c')]);}_0x5096fc['order']=qs['sort'](_0x31423a[_0x5ffe('0x32')][_0x5ffe('0x3b')]);_0x5096fc['where']=qs[_0x5ffe('0x34')](_[_0x5ffe('0x3c')](_0x31423a[_0x5ffe('0x32')],_0x1975ca[_0x5ffe('0x34')]),_0x1bfdb4);if(_0x31423a[_0x5ffe('0x32')][_0x5ffe('0x3d')]){_0x5096fc[_0x5ffe('0x3e')]=_[_0x5ffe('0x3f')](_0x5096fc[_0x5ffe('0x3e')],{'$or':_[_0x5ffe('0x2b')](_0x1bfdb4,function(_0xa83bdc){if(_0xa83bdc[_0x5ffe('0x2f')]!==_0x5ffe('0x40')){var _0xa3a7d0={};_0xa3a7d0[_0xa83bdc[_0x5ffe('0x29')]]={'$like':'%'+_0x31423a[_0x5ffe('0x32')][_0x5ffe('0x3d')]+'%'};return _0xa3a7d0;}})});}_0x5096fc=_['merge']({},_0x5096fc,_0x31423a['options']);var _0x476b02={'where':_0x5096fc['where']};return db[_0x5ffe('0x2c')][_0x5ffe('0x1b')](_0x476b02)[_0x5ffe('0x24')](function(_0x59a412){_0x57a6a5['count']=_0x59a412;if(_0x31423a[_0x5ffe('0x32')][_0x5ffe('0x41')]){_0x5096fc['include']=[{'all':!![]}];}return db[_0x5ffe('0x2c')][_0x5ffe('0x42')](_0x5096fc);})[_0x5ffe('0x24')](function(_0x554360){_0x57a6a5['rows']=_0x554360;return _0x57a6a5;})[_0x5ffe('0x24')](respondWithFilteredResult(_0x12b89e,_0x5096fc))[_0x5ffe('0x43')](handleError(_0x12b89e,null));};exports['show']=function(_0x4b26d1,_0x30b535){var _0xbe27b1={'raw':!![],'where':{'id':_0x4b26d1[_0x5ffe('0x44')]['id']}},_0x10c233={};_0x10c233[_0x5ffe('0x31')]=_['keys'](db['SquareOdbc'][_0x5ffe('0x2d')]);_0x10c233[_0x5ffe('0x32')]=_[_0x5ffe('0x33')](_0x4b26d1[_0x5ffe('0x32')]);_0x10c233['filters']=_[_0x5ffe('0x35')](_0x10c233[_0x5ffe('0x31')],_0x10c233[_0x5ffe('0x32')]);_0xbe27b1[_0x5ffe('0x36')]=_[_0x5ffe('0x35')](_0x10c233[_0x5ffe('0x31')],qs[_0x5ffe('0x37')](_0x4b26d1[_0x5ffe('0x32')]['fields']));_0xbe27b1[_0x5ffe('0x36')]=_0xbe27b1[_0x5ffe('0x36')][_0x5ffe('0x38')]?_0xbe27b1['attributes']:_0x10c233[_0x5ffe('0x31')];if(_0x4b26d1[_0x5ffe('0x32')][_0x5ffe('0x41')]){_0xbe27b1['include']=[{'all':!![]}];}_0xbe27b1=_[_0x5ffe('0x3f')]({},_0xbe27b1,_0x4b26d1[_0x5ffe('0x45')]);return db['SquareOdbc']['find'](_0xbe27b1)[_0x5ffe('0x24')](handleEntityNotFound(_0x30b535,null))[_0x5ffe('0x24')](respondWithResult(_0x30b535,null))[_0x5ffe('0x43')](handleError(_0x30b535,null));};exports[_0x5ffe('0x46')]=function(_0x2eceb6,_0x151844){return db[_0x5ffe('0x2c')][_0x5ffe('0x46')](_0x2eceb6[_0x5ffe('0x47')],{})[_0x5ffe('0x24')](function(_0x368b3c){var _0x14a1c8=_0x2eceb6[_0x5ffe('0x48')][_0x5ffe('0x25')]({'plain':!![]});if(!_0x14a1c8)throw new Error(_0x5ffe('0x49'));if(_0x14a1c8[_0x5ffe('0x4a')]===_0x5ffe('0x48')){var _0x25b1ed=_0x368b3c[_0x5ffe('0x25')]({'plain':!![]});var _0x3d2b41=_0x5ffe('0x26');return db[_0x5ffe('0x4b')][_0x5ffe('0x4c')]({'where':{'name':_0x3d2b41,'userProfileId':_0x14a1c8[_0x5ffe('0x4d')]},'raw':!![]})['then'](function(_0x3941c5){if(_0x3941c5&&_0x3941c5[_0x5ffe('0x4e')]===0x0){return db[_0x5ffe('0x4f')][_0x5ffe('0x46')]({'name':_0x25b1ed['name'],'resourceId':_0x25b1ed['id'],'type':_0x3941c5[_0x5ffe('0x29')],'sectionId':_0x3941c5['id']},{})['then'](function(){return _0x368b3c;});}else{return _0x368b3c;}})[_0x5ffe('0x43')](function(_0x22d240){logger['error'](_0x5ffe('0x50'),_0x22d240);throw _0x22d240;});}return _0x368b3c;})[_0x5ffe('0x24')](respondWithResult(_0x151844,0xc9))[_0x5ffe('0x43')](handleError(_0x151844,null));};exports[_0x5ffe('0x51')]=function(_0x525964,_0xa8b539){if(_0x525964[_0x5ffe('0x47')]['id']){delete _0x525964['body']['id'];}return db['SquareOdbc'][_0x5ffe('0x4c')]({'where':{'id':_0x525964[_0x5ffe('0x44')]['id']}})[_0x5ffe('0x24')](handleEntityNotFound(_0xa8b539,null))['then'](saveUpdates(_0x525964[_0x5ffe('0x47')],null))[_0x5ffe('0x24')](respondWithResult(_0xa8b539,null))[_0x5ffe('0x43')](handleError(_0xa8b539,null));};exports[_0x5ffe('0x23')]=function(_0x3508e8,_0x36bcea){return db[_0x5ffe('0x2c')]['find']({'where':{'id':_0x3508e8[_0x5ffe('0x44')]['id']}})[_0x5ffe('0x24')](handleEntityNotFound(_0x36bcea,null))[_0x5ffe('0x24')](removeEntity(_0x36bcea,null))['catch'](handleError(_0x36bcea,null));};exports['test']=function(_0x4a1148,_0x2aabb6,_0x11df8e){var _0x5413db;return db[_0x5ffe('0x2c')][_0x5ffe('0x4c')]({'where':{'id':_0x4a1148[_0x5ffe('0x44')]['id']},'attributes':['id',_0x5ffe('0x52')]})[_0x5ffe('0x24')](handleEntityNotFound(_0x2aabb6,null))[_0x5ffe('0x24')](function(_0x385e6f){if(_0x385e6f){var _0xb42d24=require(_0x5ffe('0x53'))();_0xb42d24[_0x5ffe('0x54')](_0x385e6f[_0x5ffe('0x52')]);_0xb42d24[_0x5ffe('0x55')]();return _0x385e6f;}})[_0x5ffe('0x24')](respondWithResult(_0x2aabb6,null))[_0x5ffe('0x43')](handleError(_0x2aabb6,null));}; \ No newline at end of file +var _0xc494=['test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../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','reject','save','then','destroy','get','ODBC','UserProfileResource','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x478b43,_0x384010){var _0x5afda8=function(_0x2eeee1){while(--_0x2eeee1){_0x478b43['push'](_0x478b43['shift']());}};_0x5afda8(++_0x384010);}(_0xc494,0x1b8));var _0x4c49=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xc494[_0x33032e];return _0x13316b;};'use strict';var pdf=require(_0x4c49('0x0'));var emlformat=require(_0x4c49('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4c49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c49('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4c49('0x4'));var util=require(_0x4c49('0x5'));var path=require(_0x4c49('0x6'));var sox=require(_0x4c49('0x7'));var csv=require('to-csv');var ejs=require(_0x4c49('0x8'));var fs=require('fs');var _=require(_0x4c49('0x9'));var squel=require(_0x4c49('0xa'));var crypto=require('crypto');var jsforce=require(_0x4c49('0xb'));var deskjs=require(_0x4c49('0xc'));var toCsv=require(_0x4c49('0xd'));var querystring=require('querystring');var Papa=require(_0x4c49('0xe'));var Redis=require(_0x4c49('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4c49('0x10'));var as=require(_0x4c49('0x11'));var hardwareService=require(_0x4c49('0x12'));var logger=require(_0x4c49('0x13'))(_0x4c49('0x14'));var utils=require(_0x4c49('0x15'));var config=require('../../config/environment');var db=require(_0x4c49('0x16'))['db'];function respondWithStatusCode(_0x1da1d8,_0x2ac255){_0x2ac255=_0x2ac255||0xcc;return function(_0x30aba0){if(_0x30aba0){return _0x1da1d8[_0x4c49('0x17')](_0x2ac255);}return _0x1da1d8[_0x4c49('0x18')](_0x2ac255)[_0x4c49('0x19')]();};}function respondWithResult(_0xec50f7,_0x5f1a8f){_0x5f1a8f=_0x5f1a8f||0xc8;return function(_0x24e6ac){if(_0x24e6ac){return _0xec50f7[_0x4c49('0x18')](_0x5f1a8f)[_0x4c49('0x1a')](_0x24e6ac);}};}function respondWithFilteredResult(_0x2a3e12,_0x233cfa){return function(_0x278826){if(_0x278826){var _0x18f87c=_0x278826[_0x4c49('0x1b')],_0x450423=_0x233cfa[_0x4c49('0x1c')],_0x24d4a0=_0x233cfa[_0x4c49('0x1c')]+_0x233cfa[_0x4c49('0x1d')],_0x5949f6;if(_0x24d4a0>=_0x18f87c){_0x24d4a0=_0x18f87c;_0x5949f6=0xc8;}else{_0x5949f6=0xce;}_0x2a3e12[_0x4c49('0x18')](_0x5949f6);return _0x2a3e12[_0x4c49('0x1e')](_0x4c49('0x1f'),_0x450423+'-'+_0x24d4a0+'/'+_0x18f87c)[_0x4c49('0x1a')](_0x278826);}return null;};}function patchUpdates(_0x171488){return function(_0x4f4536){try{jsonpatch[_0x4c49('0x20')](_0x4f4536,_0x171488,!![]);}catch(_0x55b471){return BPromise[_0x4c49('0x21')](_0x55b471);}return _0x4f4536[_0x4c49('0x22')]();};}function saveUpdates(_0x23df02,_0x2cd50c){return function(_0x53814d){if(_0x53814d){return _0x53814d['update'](_0x23df02)[_0x4c49('0x23')](function(_0x25f6fc){return _0x25f6fc;});}return null;};}function removeEntity(_0x5083d0,_0x13e967){return function(_0x1684ce){if(_0x1684ce){return _0x1684ce[_0x4c49('0x24')]()[_0x4c49('0x23')](function(){var _0x3f5014=_0x1684ce[_0x4c49('0x25')]({'plain':!![]});var _0xd14722=_0x4c49('0x26');return db[_0x4c49('0x27')][_0x4c49('0x24')]({'where':{'type':_0xd14722,'resourceId':_0x3f5014['id']}})['then'](function(){return _0x1684ce;});})[_0x4c49('0x23')](function(){_0x5083d0[_0x4c49('0x18')](0xcc)[_0x4c49('0x19')]();});}};}function handleEntityNotFound(_0x3c8ba1,_0x248d92){return function(_0x108645){if(!_0x108645){_0x3c8ba1['sendStatus'](0x194);}return _0x108645;};}function handleError(_0x5a83fc,_0xbc61e0){_0xbc61e0=_0xbc61e0||0x1f4;return function(_0x554d23){logger['error'](_0x554d23['stack']);if(_0x554d23['name']){delete _0x554d23[_0x4c49('0x28')];}_0x5a83fc['status'](_0xbc61e0)[_0x4c49('0x29')](_0x554d23);};}exports[_0x4c49('0x2a')]=function(_0x4ee033,_0x14331b){var _0x53d1c9={},_0x1cdf7f={},_0x31679d={'count':0x0,'rows':[]};var _0x20c7f8=_[_0x4c49('0x2b')](db[_0x4c49('0x2c')][_0x4c49('0x2d')],function(_0x1b811f){return{'name':_0x1b811f[_0x4c49('0x2e')],'type':_0x1b811f['type'][_0x4c49('0x2f')]};});_0x1cdf7f['model']=_[_0x4c49('0x2b')](_0x20c7f8,_0x4c49('0x28'));_0x1cdf7f[_0x4c49('0x30')]=_[_0x4c49('0x31')](_0x4ee033[_0x4c49('0x30')]);_0x1cdf7f['filters']=_[_0x4c49('0x32')](_0x1cdf7f['model'],_0x1cdf7f[_0x4c49('0x30')]);_0x53d1c9[_0x4c49('0x33')]=_['intersection'](_0x1cdf7f[_0x4c49('0x34')],qs['fields'](_0x4ee033[_0x4c49('0x30')][_0x4c49('0x35')]));_0x53d1c9[_0x4c49('0x33')]=_0x53d1c9[_0x4c49('0x33')][_0x4c49('0x36')]?_0x53d1c9[_0x4c49('0x33')]:_0x1cdf7f[_0x4c49('0x34')];if(!_0x4ee033[_0x4c49('0x30')][_0x4c49('0x37')](_0x4c49('0x38'))){_0x53d1c9['limit']=qs[_0x4c49('0x1d')](_0x4ee033[_0x4c49('0x30')][_0x4c49('0x1d')]);_0x53d1c9[_0x4c49('0x1c')]=qs['offset'](_0x4ee033[_0x4c49('0x30')][_0x4c49('0x1c')]);}_0x53d1c9['order']=qs[_0x4c49('0x39')](_0x4ee033[_0x4c49('0x30')]['sort']);_0x53d1c9['where']=qs['filters'](_[_0x4c49('0x3a')](_0x4ee033['query'],_0x1cdf7f[_0x4c49('0x3b')]),_0x20c7f8);if(_0x4ee033[_0x4c49('0x30')][_0x4c49('0x3c')]){_0x53d1c9[_0x4c49('0x3d')]=_['merge'](_0x53d1c9[_0x4c49('0x3d')],{'$or':_[_0x4c49('0x2b')](_0x20c7f8,function(_0x3a334f){if(_0x3a334f[_0x4c49('0x3e')]!==_0x4c49('0x3f')){var _0x6ada21={};_0x6ada21[_0x3a334f[_0x4c49('0x28')]]={'$like':'%'+_0x4ee033[_0x4c49('0x30')][_0x4c49('0x3c')]+'%'};return _0x6ada21;}})});}_0x53d1c9=_[_0x4c49('0x40')]({},_0x53d1c9,_0x4ee033[_0x4c49('0x41')]);var _0x8844e4={'where':_0x53d1c9[_0x4c49('0x3d')]};return db[_0x4c49('0x2c')]['count'](_0x8844e4)['then'](function(_0x258f13){_0x31679d[_0x4c49('0x1b')]=_0x258f13;if(_0x4ee033[_0x4c49('0x30')][_0x4c49('0x42')]){_0x53d1c9['include']=[{'all':!![]}];}return db[_0x4c49('0x2c')]['findAll'](_0x53d1c9);})[_0x4c49('0x23')](function(_0x42279e){_0x31679d[_0x4c49('0x43')]=_0x42279e;return _0x31679d;})[_0x4c49('0x23')](respondWithFilteredResult(_0x14331b,_0x53d1c9))[_0x4c49('0x44')](handleError(_0x14331b,null));};exports[_0x4c49('0x45')]=function(_0x83907b,_0x3b720f){var _0x1476fe={'raw':!![],'where':{'id':_0x83907b[_0x4c49('0x46')]['id']}},_0x5519d8={};_0x5519d8[_0x4c49('0x34')]=_[_0x4c49('0x31')](db[_0x4c49('0x2c')][_0x4c49('0x2d')]);_0x5519d8[_0x4c49('0x30')]=_[_0x4c49('0x31')](_0x83907b['query']);_0x5519d8['filters']=_[_0x4c49('0x32')](_0x5519d8[_0x4c49('0x34')],_0x5519d8['query']);_0x1476fe[_0x4c49('0x33')]=_[_0x4c49('0x32')](_0x5519d8[_0x4c49('0x34')],qs[_0x4c49('0x35')](_0x83907b[_0x4c49('0x30')][_0x4c49('0x35')]));_0x1476fe[_0x4c49('0x33')]=_0x1476fe[_0x4c49('0x33')][_0x4c49('0x36')]?_0x1476fe[_0x4c49('0x33')]:_0x5519d8['model'];if(_0x83907b[_0x4c49('0x30')][_0x4c49('0x42')]){_0x1476fe[_0x4c49('0x47')]=[{'all':!![]}];}_0x1476fe=_['merge']({},_0x1476fe,_0x83907b[_0x4c49('0x41')]);return db[_0x4c49('0x2c')]['find'](_0x1476fe)[_0x4c49('0x23')](handleEntityNotFound(_0x3b720f,null))[_0x4c49('0x23')](respondWithResult(_0x3b720f,null))[_0x4c49('0x44')](handleError(_0x3b720f,null));};exports[_0x4c49('0x48')]=function(_0x49dbda,_0x23e552){return db[_0x4c49('0x2c')][_0x4c49('0x48')](_0x49dbda[_0x4c49('0x49')],{})[_0x4c49('0x23')](function(_0x2e3b19){var _0x1659ab=_0x49dbda['user'][_0x4c49('0x25')]({'plain':!![]});if(!_0x1659ab)throw new Error(_0x4c49('0x4a'));if(_0x1659ab[_0x4c49('0x4b')]===_0x4c49('0x4c')){var _0x4869f4=_0x2e3b19[_0x4c49('0x25')]({'plain':!![]});var _0x2deebc=_0x4c49('0x26');return db[_0x4c49('0x4d')][_0x4c49('0x4e')]({'where':{'name':_0x2deebc,'userProfileId':_0x1659ab['userProfileId']},'raw':!![]})[_0x4c49('0x23')](function(_0x281260){if(_0x281260&&_0x281260[_0x4c49('0x4f')]===0x0){return db[_0x4c49('0x27')]['create']({'name':_0x4869f4[_0x4c49('0x28')],'resourceId':_0x4869f4['id'],'type':_0x281260[_0x4c49('0x28')],'sectionId':_0x281260['id']},{})['then'](function(){return _0x2e3b19;});}else{return _0x2e3b19;}})['catch'](function(_0x39d4ee){logger['error'](_0x4c49('0x50'),_0x39d4ee);throw _0x39d4ee;});}return _0x2e3b19;})['then'](respondWithResult(_0x23e552,0xc9))[_0x4c49('0x44')](handleError(_0x23e552,null));};exports[_0x4c49('0x51')]=function(_0x2be41d,_0x18b1dc){if(_0x2be41d[_0x4c49('0x49')]['id']){delete _0x2be41d[_0x4c49('0x49')]['id'];}return db[_0x4c49('0x2c')]['find']({'where':{'id':_0x2be41d['params']['id']}})[_0x4c49('0x23')](handleEntityNotFound(_0x18b1dc,null))[_0x4c49('0x23')](saveUpdates(_0x2be41d['body'],null))[_0x4c49('0x23')](respondWithResult(_0x18b1dc,null))[_0x4c49('0x44')](handleError(_0x18b1dc,null));};exports[_0x4c49('0x24')]=function(_0x1f1a4f,_0x1edaa9){return db[_0x4c49('0x2c')][_0x4c49('0x4e')]({'where':{'id':_0x1f1a4f[_0x4c49('0x46')]['id']}})[_0x4c49('0x23')](handleEntityNotFound(_0x1edaa9,null))[_0x4c49('0x23')](removeEntity(_0x1edaa9,null))[_0x4c49('0x44')](handleError(_0x1edaa9,null));};exports[_0x4c49('0x52')]=function(_0x1853a6,_0x2d33dc,_0x229c9e){var _0x2a758f;return db[_0x4c49('0x2c')][_0x4c49('0x4e')]({'where':{'id':_0x1853a6[_0x4c49('0x46')]['id']},'attributes':['id',_0x4c49('0x53')]})[_0x4c49('0x23')](handleEntityNotFound(_0x2d33dc,null))[_0x4c49('0x23')](function(_0x12de92){if(_0x12de92){var _0x52b83a=require(_0x4c49('0x54'))();_0x52b83a[_0x4c49('0x55')](_0x12de92[_0x4c49('0x53')]);_0x52b83a[_0x4c49('0x56')]();return _0x12de92;}})[_0x4c49('0x23')](respondWithResult(_0x2d33dc,null))[_0x4c49('0x44')](handleError(_0x2d33dc,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index f9b3388..ec7c716 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 _0xabe7=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc'];(function(_0x1c4bf8,_0x1ad9cd){var _0x55f3a2=function(_0x252b16){while(--_0x252b16){_0x1c4bf8['push'](_0x1c4bf8['shift']());}};_0x55f3a2(++_0x1ad9cd);}(_0xabe7,0x1b0));var _0x7abe=function(_0x451a8f,_0x36614e){_0x451a8f=_0x451a8f-0x0;var _0x5ce95b=_0xabe7[_0x451a8f];return _0x5ce95b;};'use strict';var _=require(_0x7abe('0x0'));var util=require(_0x7abe('0x1'));var logger=require(_0x7abe('0x2'))('api');var moment=require(_0x7abe('0x3'));var BPromise=require(_0x7abe('0x4'));var rp=require(_0x7abe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7abe('0x6'));var config=require(_0x7abe('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x7abe('0x8')]=function(_0x2ed698,_0x56d6ae){return _0x2ed698[_0x7abe('0x9')](_0x7abe('0xa'),attributes,{'tableName':_0x7abe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe48f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','square_odbc'];(function(_0x1cc12c,_0x23f1dc){var _0x558fe3=function(_0x2f1462){while(--_0x2f1462){_0x1cc12c['push'](_0x1cc12c['shift']());}};_0x558fe3(++_0x23f1dc);}(_0xe48f,0x9c));var _0xfe48=function(_0x2c84e5,_0x58a7c7){_0x2c84e5=_0x2c84e5-0x0;var _0x4990ec=_0xe48f[_0x2c84e5];return _0x4990ec;};'use strict';var _=require(_0xfe48('0x0'));var util=require(_0xfe48('0x1'));var logger=require(_0xfe48('0x2'))(_0xfe48('0x3'));var moment=require('moment');var BPromise=require(_0xfe48('0x4'));var rp=require(_0xfe48('0x5'));var fs=require('fs');var path=require(_0xfe48('0x6'));var rimraf=require(_0xfe48('0x7'));var config=require(_0xfe48('0x8'));var attributes=require(_0xfe48('0x9'));module['exports']=function(_0x4d410c,_0x57e7ae){return _0x4d410c[_0xfe48('0xa')]('SquareOdbc',attributes,{'tableName':_0xfe48('0xb'),'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 88b9e2f..1a15df0 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x35b7ba,_0x155c7f){var _0x25ea5e=function(_0x4d16f6){while(--_0x4d16f6){_0x35b7ba['push'](_0x35b7ba['shift']());}};_0x25ea5e(++_0x155c7f);}(_0xe14b,0x93));var _0xbe14=function(_0x1a7938,_0x1a937c){_0x1a7938=_0x1a7938-0x0;var _0x4e8845=_0xe14b[_0x1a7938];return _0x4e8845;};'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);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x6d91a,_0x3c06dc){var _0x405faf=function(_0x4b157a){while(--_0x4b157a){_0x6d91a['push'](_0x6d91a['shift']());}};_0x405faf(++_0x3c06dc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x5fc3[_0x373096];return _0x14a6d0;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index cc2cc8e..c834633 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 _0x2547=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','post','/:id/users','addUsers','put','delete','destroy','removeUsers','exports','util'];(function(_0x165eb7,_0x4a5b9d){var _0x1b06bd=function(_0x55be7e){while(--_0x55be7e){_0x165eb7['push'](_0x165eb7['shift']());}};_0x1b06bd(++_0x4a5b9d);}(_0x2547,0x1cd));var _0x7254=function(_0x5d7349,_0x2591cd){_0x5d7349=_0x5d7349-0x0;var _0x48fee9=_0x2547[_0x5d7349];return _0x48fee9;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./squareProject.controller');router[_0x7254('0x8')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xa')]);router[_0x7254('0x8')]('/:id',auth[_0x7254('0x9')](),controller[_0x7254('0xb')]);router[_0x7254('0x8')]('/:id/users',auth[_0x7254('0x9')](),controller['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0x7254('0xc')]);router[_0x7254('0xd')](_0x7254('0xe'),auth[_0x7254('0x9')](),controller[_0x7254('0xf')]);router[_0x7254('0x10')]('/:id',auth[_0x7254('0x9')](),controller['update']);router[_0x7254('0x11')]('/:id',auth[_0x7254('0x9')](),controller[_0x7254('0x12')]);router[_0x7254('0x11')](_0x7254('0xe'),auth[_0x7254('0x9')](),controller[_0x7254('0x13')]);module[_0x7254('0x14')]=router; \ No newline at end of file +var _0xeb74=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','getUsers','post','create','/:id/users','addUsers','update','delete','destroy','removeUsers','multer','util','path'];(function(_0x138a32,_0x4009ff){var _0x31dcd3=function(_0x2682a6){while(--_0x2682a6){_0x138a32['push'](_0x138a32['shift']());}};_0x31dcd3(++_0x4009ff);}(_0xeb74,0xe3));var _0x4eb7=function(_0x180935,_0x2fb36b){_0x180935=_0x180935-0x0;var _0x4f4fbb=_0xeb74[_0x180935];return _0x4f4fbb;};'use strict';var multer=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var path=require(_0x4eb7('0x2'));var timeout=require(_0x4eb7('0x3'));var express=require(_0x4eb7('0x4'));var router=express[_0x4eb7('0x5')]();var auth=require(_0x4eb7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4eb7('0x7'));var controller=require(_0x4eb7('0x8'));router[_0x4eb7('0x9')]('/',auth[_0x4eb7('0xa')](),controller[_0x4eb7('0xb')]);router['get'](_0x4eb7('0xc'),auth['isAuthenticated'](),controller[_0x4eb7('0xd')]);router[_0x4eb7('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x4eb7('0xe')]);router[_0x4eb7('0xf')]('/',auth['isAuthenticated'](),controller[_0x4eb7('0x10')]);router['post'](_0x4eb7('0x11'),auth[_0x4eb7('0xa')](),controller[_0x4eb7('0x12')]);router['put'](_0x4eb7('0xc'),auth[_0x4eb7('0xa')](),controller[_0x4eb7('0x13')]);router[_0x4eb7('0x14')](_0x4eb7('0xc'),auth[_0x4eb7('0xa')](),controller[_0x4eb7('0x15')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x4eb7('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index db5abc9..4c31172 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 _0x5f86=['TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','exports','STRING'];(function(_0x2e152f,_0x2ead5e){var _0x242767=function(_0x237604){while(--_0x237604){_0x2e152f['push'](_0x2e152f['shift']());}};_0x242767(++_0x2ead5e);}(_0x5f86,0x152));var _0x65f8=function(_0x5ef658,_0x492562){_0x5ef658=_0x5ef658-0x0;var _0x5d51df=_0x5f86[_0x5ef658];return _0x5d51df;};'use strict';var Sequelize=require('sequelize');module[_0x65f8('0x0')]={'name':{'type':Sequelize[_0x65f8('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x65f8('0x1')]},'notes':{'type':Sequelize[_0x65f8('0x2')]},'preproduction':{'type':Sequelize[_0x65f8('0x3')](_0x65f8('0x4')),'get':function(){if(this[_0x65f8('0x5')](_0x65f8('0x6'))){return this['getDataValue'](_0x65f8('0x6'))[_0x65f8('0x7')](_0x65f8('0x8'));}}},'production':{'type':Sequelize[_0x65f8('0x3')](_0x65f8('0x4')),'get':function(){if(this[_0x65f8('0x5')](_0x65f8('0x9'))){return this['getDataValue'](_0x65f8('0x9'))[_0x65f8('0x7')](_0x65f8('0x8'));}}}}; \ No newline at end of file +var _0xb310=['BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x3f9631,_0x51ffcb){var _0x242d84=function(_0xfcd4f7){while(--_0xfcd4f7){_0x3f9631['push'](_0x3f9631['shift']());}};_0x242d84(++_0x51ffcb);}(_0xb310,0x1b2));var _0x0b31=function(_0x421cdf,_0x141e7d){_0x421cdf=_0x421cdf-0x0;var _0x1c8f3=_0xb310[_0x421cdf];return _0x1c8f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x0b31('0x0')](_0x0b31('0x1')),'get':function(){if(this[_0x0b31('0x2')](_0x0b31('0x3'))){return this[_0x0b31('0x2')]('preproduction')[_0x0b31('0x4')](_0x0b31('0x5'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x0b31('0x2')](_0x0b31('0x6'))){return this[_0x0b31('0x2')](_0x0b31('0x6'))[_0x0b31('0x4')]('utf8');}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5f187ab..a00c773 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 _0x8a03=['params','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','count','offset','limit','Content-Range','json','apply','update','destroy','get','SquareProjects','UserProfileResource','then','end','error','stack','name','index','map','SquareProject','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','include','options','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x50b634,_0x1a9974){var _0xcbb832=function(_0x13441b){while(--_0x13441b){_0x50b634['push'](_0x50b634['shift']());}};_0xcbb832(++_0x1a9974);}(_0x8a03,0xcb));var _0x38a0=function(_0x5d87f3,_0x989352){_0x5d87f3=_0x5d87f3-0x0;var _0x540dd7=_0x8a03[_0x5d87f3];return _0x540dd7;};'use strict';var pdf=require(_0x38a0('0x0'));var emlformat=require(_0x38a0('0x1'));var rimraf=require(_0x38a0('0x2'));var zipdir=require(_0x38a0('0x3'));var jsonpatch=require(_0x38a0('0x4'));var rp=require(_0x38a0('0x5'));var moment=require('moment');var BPromise=require(_0x38a0('0x6'));var Mustache=require(_0x38a0('0x7'));var util=require(_0x38a0('0x8'));var path=require(_0x38a0('0x9'));var sox=require(_0x38a0('0xa'));var csv=require(_0x38a0('0xb'));var ejs=require(_0x38a0('0xc'));var fs=require('fs');var _=require(_0x38a0('0xd'));var squel=require(_0x38a0('0xe'));var crypto=require(_0x38a0('0xf'));var jsforce=require(_0x38a0('0x10'));var deskjs=require(_0x38a0('0x11'));var toCsv=require(_0x38a0('0xb'));var querystring=require(_0x38a0('0x12'));var Papa=require(_0x38a0('0x13'));var Redis=require(_0x38a0('0x14'));var authService=require(_0x38a0('0x15'));var qs=require(_0x38a0('0x16'));var as=require(_0x38a0('0x17'));var hardwareService=require(_0x38a0('0x18'));var logger=require(_0x38a0('0x19'))(_0x38a0('0x1a'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x38a0('0x1b'))['db'];config['redis']=_[_0x38a0('0x1c')](config[_0x38a0('0x1d')],{'host':_0x38a0('0x1e'),'port':0x18eb});var socket=require(_0x38a0('0x1f'))(new Redis(config[_0x38a0('0x1d')]));require(_0x38a0('0x20'))[_0x38a0('0x21')](socket);function respondWithStatusCode(_0x333c14,_0x448bf8){_0x448bf8=_0x448bf8||0xcc;return function(_0x1f407b){if(_0x1f407b){return _0x333c14['sendStatus'](_0x448bf8);}return _0x333c14[_0x38a0('0x22')](_0x448bf8)['end']();};}function respondWithResult(_0x39e593,_0x56bcc9){_0x56bcc9=_0x56bcc9||0xc8;return function(_0x2adef9){if(_0x2adef9){return _0x39e593[_0x38a0('0x22')](_0x56bcc9)['json'](_0x2adef9);}};}function respondWithFilteredResult(_0x5b376a,_0x4ad5c2){return function(_0x2e5a9c){if(_0x2e5a9c){var _0x46249a=_0x2e5a9c[_0x38a0('0x23')],_0x3d2ed0=_0x4ad5c2[_0x38a0('0x24')],_0x34aa6e=_0x4ad5c2[_0x38a0('0x24')]+_0x4ad5c2[_0x38a0('0x25')],_0x15c9b6;if(_0x34aa6e>=_0x46249a){_0x34aa6e=_0x46249a;_0x15c9b6=0xc8;}else{_0x15c9b6=0xce;}_0x5b376a['status'](_0x15c9b6);return _0x5b376a['set'](_0x38a0('0x26'),_0x3d2ed0+'-'+_0x34aa6e+'/'+_0x46249a)[_0x38a0('0x27')](_0x2e5a9c);}return null;};}function patchUpdates(_0x8db257){return function(_0x3f9aff){try{jsonpatch[_0x38a0('0x28')](_0x3f9aff,_0x8db257,!![]);}catch(_0x3ba1e9){return BPromise['reject'](_0x3ba1e9);}return _0x3f9aff['save']();};}function saveUpdates(_0x1fbdb9,_0x1b0ee5){return function(_0x418198){if(_0x418198){return _0x418198[_0x38a0('0x29')](_0x1fbdb9)['then'](function(_0xfaa7aa){return _0xfaa7aa;});}return null;};}function removeEntity(_0x3d9757,_0x22c995){return function(_0x22bc3a){if(_0x22bc3a){return _0x22bc3a[_0x38a0('0x2a')]()['then'](function(){var _0x460634=_0x22bc3a[_0x38a0('0x2b')]({'plain':!![]});var _0x4593e9=_0x38a0('0x2c');return db[_0x38a0('0x2d')][_0x38a0('0x2a')]({'where':{'type':_0x4593e9,'resourceId':_0x460634['id']}})[_0x38a0('0x2e')](function(){return _0x22bc3a;});})[_0x38a0('0x2e')](function(){_0x3d9757['status'](0xcc)[_0x38a0('0x2f')]();});}};}function handleEntityNotFound(_0x21eb46,_0x34be76){return function(_0x3bff94){if(!_0x3bff94){_0x21eb46['sendStatus'](0x194);}return _0x3bff94;};}function handleError(_0x840a5c,_0x3e0f2e){_0x3e0f2e=_0x3e0f2e||0x1f4;return function(_0x29be0a){logger[_0x38a0('0x30')](_0x29be0a[_0x38a0('0x31')]);if(_0x29be0a[_0x38a0('0x32')]){delete _0x29be0a[_0x38a0('0x32')];}_0x840a5c[_0x38a0('0x22')](_0x3e0f2e)['send'](_0x29be0a);};}exports[_0x38a0('0x33')]=function(_0x5a4754,_0x25dd55){var _0x15a118={},_0x4cbac4={},_0x5f3c58={'count':0x0,'rows':[]};var _0x3c3606=_[_0x38a0('0x34')](db[_0x38a0('0x35')][_0x38a0('0x36')],function(_0x351652){return{'name':_0x351652['fieldName'],'type':_0x351652[_0x38a0('0x37')][_0x38a0('0x38')]};});_0x4cbac4['model']=_[_0x38a0('0x34')](_0x3c3606,_0x38a0('0x32'));_0x4cbac4[_0x38a0('0x39')]=_[_0x38a0('0x3a')](_0x5a4754[_0x38a0('0x39')]);_0x4cbac4[_0x38a0('0x3b')]=_[_0x38a0('0x3c')](_0x4cbac4[_0x38a0('0x3d')],_0x4cbac4[_0x38a0('0x39')]);_0x15a118[_0x38a0('0x3e')]=_[_0x38a0('0x3c')](_0x4cbac4['model'],qs[_0x38a0('0x3f')](_0x5a4754[_0x38a0('0x39')][_0x38a0('0x3f')]));_0x15a118[_0x38a0('0x3e')]=_0x15a118[_0x38a0('0x3e')][_0x38a0('0x40')]?_0x15a118['attributes']:_0x4cbac4['model'];if(!_0x5a4754[_0x38a0('0x39')][_0x38a0('0x41')](_0x38a0('0x42'))){_0x15a118[_0x38a0('0x25')]=qs[_0x38a0('0x25')](_0x5a4754[_0x38a0('0x39')]['limit']);_0x15a118[_0x38a0('0x24')]=qs['offset'](_0x5a4754[_0x38a0('0x39')][_0x38a0('0x24')]);}_0x15a118[_0x38a0('0x43')]=qs['sort'](_0x5a4754['query'][_0x38a0('0x44')]);_0x15a118['where']=qs[_0x38a0('0x3b')](_[_0x38a0('0x45')](_0x5a4754[_0x38a0('0x39')],_0x4cbac4['filters']),_0x3c3606);if(_0x5a4754['query'][_0x38a0('0x46')]){_0x15a118[_0x38a0('0x47')]=_[_0x38a0('0x48')](_0x15a118['where'],{'$or':_[_0x38a0('0x34')](_0x3c3606,function(_0x2f3bfc){if(_0x2f3bfc[_0x38a0('0x37')]!==_0x38a0('0x49')){var _0xc60bb0={};_0xc60bb0[_0x2f3bfc[_0x38a0('0x32')]]={'$like':'%'+_0x5a4754['query'][_0x38a0('0x46')]+'%'};return _0xc60bb0;}})});}_0x15a118=_[_0x38a0('0x48')]({},_0x15a118,_0x5a4754['options']);var _0x216202={'where':_0x15a118[_0x38a0('0x47')]};return db[_0x38a0('0x35')][_0x38a0('0x23')](_0x216202)['then'](function(_0xda3e45){_0x5f3c58[_0x38a0('0x23')]=_0xda3e45;if(_0x5a4754[_0x38a0('0x39')][_0x38a0('0x4a')]){_0x15a118['include']=[{'all':!![]}];}return db[_0x38a0('0x35')]['findAll'](_0x15a118);})[_0x38a0('0x2e')](function(_0x95321a){_0x5f3c58[_0x38a0('0x4b')]=_0x95321a;return _0x5f3c58;})[_0x38a0('0x2e')](respondWithFilteredResult(_0x25dd55,_0x15a118))[_0x38a0('0x4c')](handleError(_0x25dd55,null));};exports['show']=function(_0x503ff2,_0x2d8bfd){var _0x428540={'raw':![],'where':{'id':_0x503ff2['params']['id']}},_0x2fa75f={};_0x2fa75f[_0x38a0('0x3d')]=_[_0x38a0('0x3a')](db[_0x38a0('0x35')][_0x38a0('0x36')]);_0x2fa75f[_0x38a0('0x39')]=_[_0x38a0('0x3a')](_0x503ff2[_0x38a0('0x39')]);_0x2fa75f[_0x38a0('0x3b')]=_[_0x38a0('0x3c')](_0x2fa75f[_0x38a0('0x3d')],_0x2fa75f[_0x38a0('0x39')]);_0x428540[_0x38a0('0x3e')]=_[_0x38a0('0x3c')](_0x2fa75f['model'],qs[_0x38a0('0x3f')](_0x503ff2['query'][_0x38a0('0x3f')]));_0x428540[_0x38a0('0x3e')]=_0x428540[_0x38a0('0x3e')]['length']?_0x428540['attributes']:_0x2fa75f[_0x38a0('0x3d')];if(_0x503ff2[_0x38a0('0x39')][_0x38a0('0x4a')]){_0x428540[_0x38a0('0x4d')]=[{'all':!![]}];}_0x428540=_['merge']({},_0x428540,_0x503ff2[_0x38a0('0x4e')]);return db[_0x38a0('0x35')]['find'](_0x428540)['then'](handleEntityNotFound(_0x2d8bfd,null))['then'](respondWithResult(_0x2d8bfd,null))[_0x38a0('0x4c')](handleError(_0x2d8bfd,null));};exports[_0x38a0('0x4f')]=function(_0x276366,_0x24db19){return db[_0x38a0('0x35')][_0x38a0('0x4f')](_0x276366[_0x38a0('0x50')],{})[_0x38a0('0x2e')](function(_0x36acc7){var _0x364ae9=_0x276366['user'][_0x38a0('0x2b')]({'plain':!![]});if(!_0x364ae9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x364ae9[_0x38a0('0x51')]===_0x38a0('0x52')){var _0x11efc3=_0x36acc7['get']({'plain':!![]});var _0x45ec5e=_0x38a0('0x2c');return db[_0x38a0('0x53')][_0x38a0('0x54')]({'where':{'name':_0x45ec5e,'userProfileId':_0x364ae9[_0x38a0('0x55')]},'raw':!![]})[_0x38a0('0x2e')](function(_0x2ae362){if(_0x2ae362&&_0x2ae362[_0x38a0('0x56')]===0x0){return db['UserProfileResource'][_0x38a0('0x4f')]({'name':_0x11efc3['name'],'resourceId':_0x11efc3['id'],'type':_0x2ae362[_0x38a0('0x32')],'sectionId':_0x2ae362['id']},{})[_0x38a0('0x2e')](function(){return _0x36acc7;});}else{return _0x36acc7;}})[_0x38a0('0x4c')](function(_0x3ef65a){logger['error'](_0x38a0('0x57'),_0x3ef65a);throw _0x3ef65a;});}return _0x36acc7;})[_0x38a0('0x2e')](respondWithResult(_0x24db19,0xc9))[_0x38a0('0x4c')](handleError(_0x24db19,null));};exports[_0x38a0('0x29')]=function(_0x572b1e,_0x21958f){if(_0x572b1e[_0x38a0('0x50')]['id']){delete _0x572b1e[_0x38a0('0x50')]['id'];}return db['SquareProject'][_0x38a0('0x54')]({'where':{'id':_0x572b1e[_0x38a0('0x58')]['id']}})[_0x38a0('0x2e')](handleEntityNotFound(_0x21958f,null))['then'](saveUpdates(_0x572b1e[_0x38a0('0x50')],null))[_0x38a0('0x2e')](respondWithResult(_0x21958f,null))[_0x38a0('0x4c')](handleError(_0x21958f,null));};exports[_0x38a0('0x2a')]=function(_0x10d7d9,_0x28e80e){return db[_0x38a0('0x35')][_0x38a0('0x54')]({'where':{'id':_0x10d7d9[_0x38a0('0x58')]['id']}})[_0x38a0('0x2e')](handleEntityNotFound(_0x28e80e,null))[_0x38a0('0x2e')](removeEntity(_0x28e80e,null))[_0x38a0('0x4c')](handleError(_0x28e80e,null));};exports[_0x38a0('0x59')]=function(_0x3c5868,_0x1a46f2,_0x593fcb){return db[_0x38a0('0x35')]['find']({'where':{'id':_0x3c5868[_0x38a0('0x58')]['id']}})[_0x38a0('0x2e')](handleEntityNotFound(_0x1a46f2,null))['then'](function(_0x4056a3){if(_0x4056a3){return _0x4056a3['addUsers'](_0x3c5868[_0x38a0('0x50')][_0x38a0('0x5a')],_['omit'](_0x3c5868[_0x38a0('0x50')],[_0x38a0('0x5a'),'id'])||{});}})[_0x38a0('0x2e')](respondWithResult(_0x1a46f2,null))['catch'](handleError(_0x1a46f2,null));};exports['removeUsers']=function(_0x451199,_0x142bca,_0x2b8a6e){return db[_0x38a0('0x35')]['find']({'where':{'id':_0x451199['params']['id']}})[_0x38a0('0x2e')](handleEntityNotFound(_0x142bca,null))['then'](function(_0x3e7328){if(_0x3e7328){return _0x3e7328[_0x38a0('0x5b')](_0x451199['query'][_0x38a0('0x5a')])['then'](function(){if(_[_0x38a0('0x5c')](_0x451199[_0x38a0('0x39')][_0x38a0('0x5a')])){for(var _0x4c0fc8=0x0;_0x4c0fc8<_0x451199[_0x38a0('0x39')][_0x38a0('0x5a')][_0x38a0('0x40')];_0x4c0fc8+=0x1){socket[_0x38a0('0x5d')](_0x38a0('0x5e'),{'UserId':Number(_0x451199[_0x38a0('0x39')][_0x38a0('0x5a')][_0x4c0fc8]),'SquareProjectId':Number(_0x451199[_0x38a0('0x58')]['id'])});}}else{socket[_0x38a0('0x5d')]('userSquareProject:remove',{'UserId':Number(_0x451199[_0x38a0('0x39')][_0x38a0('0x5a')]),'SquareProjectId':Number(_0x451199[_0x38a0('0x58')]['id'])});}});}})[_0x38a0('0x2e')](respondWithStatusCode(_0x142bca,null))['catch'](handleError(_0x142bca,null));};exports[_0x38a0('0x5f')]=function(_0x6e80e4,_0xd8226c,_0x5bd805){var _0x23dd97={};var _0x407638={};var _0x2df272;var _0x3c708c;return db[_0x38a0('0x35')][_0x38a0('0x60')]({'where':{'id':_0x6e80e4[_0x38a0('0x58')]['id']}})[_0x38a0('0x2e')](handleEntityNotFound(_0xd8226c,null))['then'](function(_0x3c1dfd){if(_0x3c1dfd){_0x2df272=_0x3c1dfd;_0x407638[_0x38a0('0x3d')]=_[_0x38a0('0x3a')](db['User']['rawAttributes']);_0x407638[_0x38a0('0x39')]=_[_0x38a0('0x3a')](_0x6e80e4[_0x38a0('0x39')]);_0x407638[_0x38a0('0x3b')]=_[_0x38a0('0x3c')](_0x407638[_0x38a0('0x3d')],_0x407638[_0x38a0('0x39')]);_0x23dd97[_0x38a0('0x3e')]=_[_0x38a0('0x3c')](_0x407638[_0x38a0('0x3d')],qs['fields'](_0x6e80e4[_0x38a0('0x39')][_0x38a0('0x3f')]));_0x23dd97[_0x38a0('0x3e')]=_0x23dd97[_0x38a0('0x3e')]['length']?_0x23dd97[_0x38a0('0x3e')]:_0x407638[_0x38a0('0x3d')];_0x23dd97['order']=qs['sort'](_0x6e80e4[_0x38a0('0x39')]['sort']);_0x23dd97['where']=qs[_0x38a0('0x3b')](_[_0x38a0('0x45')](_0x6e80e4[_0x38a0('0x39')],_0x407638['filters']));if(_0x6e80e4[_0x38a0('0x39')][_0x38a0('0x46')]){_0x23dd97[_0x38a0('0x47')]=_[_0x38a0('0x48')](_0x23dd97[_0x38a0('0x47')],{'$or':_[_0x38a0('0x34')](_0x23dd97[_0x38a0('0x3e')],function(_0x29d305){var _0x23bcbc={};_0x23bcbc[_0x29d305]={'$like':'%'+_0x6e80e4['query'][_0x38a0('0x46')]+'%'};return _0x23bcbc;})});}_0x23dd97=_['merge']({},_0x23dd97,_0x6e80e4[_0x38a0('0x4e')]);return _0x2df272[_0x38a0('0x5f')](_0x23dd97);}})['then'](function(_0xa0c3fd){if(_0xa0c3fd){_0x3c708c=_0xa0c3fd['length'];if(!_0x6e80e4[_0x38a0('0x39')][_0x38a0('0x41')]('nolimit')){_0x23dd97[_0x38a0('0x25')]=qs[_0x38a0('0x25')](_0x6e80e4['query'][_0x38a0('0x25')]);_0x23dd97['offset']=qs[_0x38a0('0x24')](_0x6e80e4[_0x38a0('0x39')][_0x38a0('0x24')]);}return _0x2df272[_0x38a0('0x5f')](_0x23dd97);}})[_0x38a0('0x2e')](function(_0x446c16){if(_0x446c16){return _0x446c16?{'count':_0x3c708c,'rows':_0x446c16}:null;}})['then'](respondWithResult(_0xd8226c,null))[_0x38a0('0x4c')](handleError(_0xd8226c,null));}; \ No newline at end of file +var _0x01e5=['keys','filters','intersection','model','attributes','fields','length','sort','pick','filter','where','merge','options','SquareProject','includeAll','rows','catch','show','params','include','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','omit','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','order','hasOwnProperty','nolimit','html-pdf','fast-json-patch','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','SquareProjects','UserProfileResource','sendStatus','stack','name','rawAttributes','type','key','map','query'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x01e5,0x1e5));var _0x501e=function(_0x195e78,_0xf0c2ab){_0x195e78=_0x195e78-0x0;var _0x2048e8=_0x01e5[_0x195e78];return _0x2048e8;};'use strict';var pdf=require(_0x501e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x501e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x501e('0x2'));var util=require(_0x501e('0x3'));var path=require('path');var sox=require(_0x501e('0x4'));var csv=require('to-csv');var ejs=require(_0x501e('0x5'));var fs=require('fs');var _=require(_0x501e('0x6'));var squel=require(_0x501e('0x7'));var crypto=require(_0x501e('0x8'));var jsforce=require(_0x501e('0x9'));var deskjs=require(_0x501e('0xa'));var toCsv=require(_0x501e('0xb'));var querystring=require(_0x501e('0xc'));var Papa=require(_0x501e('0xd'));var Redis=require(_0x501e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x501e('0xf'));var as=require(_0x501e('0x10'));var hardwareService=require(_0x501e('0x11'));var logger=require('../../config/logger')(_0x501e('0x12'));var utils=require(_0x501e('0x13'));var config=require('../../config/environment');var db=require(_0x501e('0x14'))['db'];config[_0x501e('0x15')]=_['defaults'](config['redis'],{'host':_0x501e('0x16'),'port':0x18eb});var socket=require(_0x501e('0x17'))(new Redis(config['redis']));require('./squareProject.socket')[_0x501e('0x18')](socket);function respondWithStatusCode(_0xbe8d31,_0x19a334){_0x19a334=_0x19a334||0xcc;return function(_0x43590f){if(_0x43590f){return _0xbe8d31['sendStatus'](_0x19a334);}return _0xbe8d31[_0x501e('0x19')](_0x19a334)[_0x501e('0x1a')]();};}function respondWithResult(_0x40644f,_0x2ded16){_0x2ded16=_0x2ded16||0xc8;return function(_0x7c8fe4){if(_0x7c8fe4){return _0x40644f[_0x501e('0x19')](_0x2ded16)[_0x501e('0x1b')](_0x7c8fe4);}};}function respondWithFilteredResult(_0x6db7f5,_0x2bc81c){return function(_0x4bc774){if(_0x4bc774){var _0x44f7b6=_0x4bc774[_0x501e('0x1c')],_0x50d0ee=_0x2bc81c['offset'],_0x4a9206=_0x2bc81c[_0x501e('0x1d')]+_0x2bc81c[_0x501e('0x1e')],_0x26a015;if(_0x4a9206>=_0x44f7b6){_0x4a9206=_0x44f7b6;_0x26a015=0xc8;}else{_0x26a015=0xce;}_0x6db7f5['status'](_0x26a015);return _0x6db7f5[_0x501e('0x1f')](_0x501e('0x20'),_0x50d0ee+'-'+_0x4a9206+'/'+_0x44f7b6)[_0x501e('0x1b')](_0x4bc774);}return null;};}function patchUpdates(_0x54717e){return function(_0x4ff09c){try{jsonpatch[_0x501e('0x21')](_0x4ff09c,_0x54717e,!![]);}catch(_0x1e23f0){return BPromise[_0x501e('0x22')](_0x1e23f0);}return _0x4ff09c[_0x501e('0x23')]();};}function saveUpdates(_0x540c98,_0x1cf90b){return function(_0x506aaf){if(_0x506aaf){return _0x506aaf[_0x501e('0x24')](_0x540c98)['then'](function(_0x5334fa){return _0x5334fa;});}return null;};}function removeEntity(_0x57c341,_0x3cd8c7){return function(_0x46bc02){if(_0x46bc02){return _0x46bc02[_0x501e('0x25')]()[_0x501e('0x26')](function(){var _0x264558=_0x46bc02['get']({'plain':!![]});var _0x3e77de=_0x501e('0x27');return db[_0x501e('0x28')][_0x501e('0x25')]({'where':{'type':_0x3e77de,'resourceId':_0x264558['id']}})['then'](function(){return _0x46bc02;});})[_0x501e('0x26')](function(){_0x57c341[_0x501e('0x19')](0xcc)[_0x501e('0x1a')]();});}};}function handleEntityNotFound(_0x9dbf8b,_0x1b2219){return function(_0x2177a4){if(!_0x2177a4){_0x9dbf8b[_0x501e('0x29')](0x194);}return _0x2177a4;};}function handleError(_0x8541ea,_0x539eac){_0x539eac=_0x539eac||0x1f4;return function(_0x28253b){logger['error'](_0x28253b[_0x501e('0x2a')]);if(_0x28253b['name']){delete _0x28253b[_0x501e('0x2b')];}_0x8541ea[_0x501e('0x19')](_0x539eac)['send'](_0x28253b);};}exports['index']=function(_0x9b08b9,_0x2bd848){var _0xdc2f1b={},_0x5da796={},_0x399ff2={'count':0x0,'rows':[]};var _0x5982f3=_['map'](db['SquareProject'][_0x501e('0x2c')],function(_0x2abf15){return{'name':_0x2abf15['fieldName'],'type':_0x2abf15[_0x501e('0x2d')][_0x501e('0x2e')]};});_0x5da796['model']=_[_0x501e('0x2f')](_0x5982f3,_0x501e('0x2b'));_0x5da796[_0x501e('0x30')]=_[_0x501e('0x31')](_0x9b08b9[_0x501e('0x30')]);_0x5da796[_0x501e('0x32')]=_[_0x501e('0x33')](_0x5da796[_0x501e('0x34')],_0x5da796[_0x501e('0x30')]);_0xdc2f1b[_0x501e('0x35')]=_[_0x501e('0x33')](_0x5da796['model'],qs[_0x501e('0x36')](_0x9b08b9['query']['fields']));_0xdc2f1b[_0x501e('0x35')]=_0xdc2f1b['attributes'][_0x501e('0x37')]?_0xdc2f1b['attributes']:_0x5da796[_0x501e('0x34')];if(!_0x9b08b9[_0x501e('0x30')]['hasOwnProperty']('nolimit')){_0xdc2f1b[_0x501e('0x1e')]=qs['limit'](_0x9b08b9[_0x501e('0x30')][_0x501e('0x1e')]);_0xdc2f1b[_0x501e('0x1d')]=qs[_0x501e('0x1d')](_0x9b08b9[_0x501e('0x30')][_0x501e('0x1d')]);}_0xdc2f1b['order']=qs[_0x501e('0x38')](_0x9b08b9[_0x501e('0x30')]['sort']);_0xdc2f1b['where']=qs['filters'](_[_0x501e('0x39')](_0x9b08b9[_0x501e('0x30')],_0x5da796[_0x501e('0x32')]),_0x5982f3);if(_0x9b08b9['query'][_0x501e('0x3a')]){_0xdc2f1b[_0x501e('0x3b')]=_[_0x501e('0x3c')](_0xdc2f1b[_0x501e('0x3b')],{'$or':_[_0x501e('0x2f')](_0x5982f3,function(_0x2c72c8){if(_0x2c72c8['type']!=='VIRTUAL'){var _0x36b127={};_0x36b127[_0x2c72c8[_0x501e('0x2b')]]={'$like':'%'+_0x9b08b9[_0x501e('0x30')][_0x501e('0x3a')]+'%'};return _0x36b127;}})});}_0xdc2f1b=_[_0x501e('0x3c')]({},_0xdc2f1b,_0x9b08b9[_0x501e('0x3d')]);var _0x42a306={'where':_0xdc2f1b[_0x501e('0x3b')]};return db[_0x501e('0x3e')]['count'](_0x42a306)[_0x501e('0x26')](function(_0x31ea3d){_0x399ff2['count']=_0x31ea3d;if(_0x9b08b9['query'][_0x501e('0x3f')]){_0xdc2f1b['include']=[{'all':!![]}];}return db[_0x501e('0x3e')]['findAll'](_0xdc2f1b);})[_0x501e('0x26')](function(_0x10a71d){_0x399ff2[_0x501e('0x40')]=_0x10a71d;return _0x399ff2;})[_0x501e('0x26')](respondWithFilteredResult(_0x2bd848,_0xdc2f1b))[_0x501e('0x41')](handleError(_0x2bd848,null));};exports[_0x501e('0x42')]=function(_0x1c68d,_0x1f76cd){var _0x26c7be={'raw':![],'where':{'id':_0x1c68d[_0x501e('0x43')]['id']}},_0x51f025={};_0x51f025[_0x501e('0x34')]=_[_0x501e('0x31')](db[_0x501e('0x3e')][_0x501e('0x2c')]);_0x51f025[_0x501e('0x30')]=_[_0x501e('0x31')](_0x1c68d[_0x501e('0x30')]);_0x51f025[_0x501e('0x32')]=_[_0x501e('0x33')](_0x51f025['model'],_0x51f025[_0x501e('0x30')]);_0x26c7be['attributes']=_[_0x501e('0x33')](_0x51f025[_0x501e('0x34')],qs['fields'](_0x1c68d[_0x501e('0x30')]['fields']));_0x26c7be['attributes']=_0x26c7be[_0x501e('0x35')][_0x501e('0x37')]?_0x26c7be[_0x501e('0x35')]:_0x51f025[_0x501e('0x34')];if(_0x1c68d[_0x501e('0x30')][_0x501e('0x3f')]){_0x26c7be[_0x501e('0x44')]=[{'all':!![]}];}_0x26c7be=_[_0x501e('0x3c')]({},_0x26c7be,_0x1c68d[_0x501e('0x3d')]);return db['SquareProject'][_0x501e('0x45')](_0x26c7be)['then'](handleEntityNotFound(_0x1f76cd,null))[_0x501e('0x26')](respondWithResult(_0x1f76cd,null))[_0x501e('0x41')](handleError(_0x1f76cd,null));};exports['create']=function(_0xb33a5f,_0x4d2ca5){return db[_0x501e('0x3e')]['create'](_0xb33a5f[_0x501e('0x46')],{})[_0x501e('0x26')](function(_0x63ed2c){var _0x4253ad=_0xb33a5f[_0x501e('0x47')][_0x501e('0x48')]({'plain':!![]});if(!_0x4253ad)throw new Error(_0x501e('0x49'));if(_0x4253ad[_0x501e('0x4a')]==='user'){var _0xde2f17=_0x63ed2c[_0x501e('0x48')]({'plain':!![]});var _0x32ffe8=_0x501e('0x27');return db[_0x501e('0x4b')][_0x501e('0x45')]({'where':{'name':_0x32ffe8,'userProfileId':_0x4253ad[_0x501e('0x4c')]},'raw':!![]})[_0x501e('0x26')](function(_0x5906c3){if(_0x5906c3&&_0x5906c3[_0x501e('0x4d')]===0x0){return db[_0x501e('0x28')]['create']({'name':_0xde2f17['name'],'resourceId':_0xde2f17['id'],'type':_0x5906c3['name'],'sectionId':_0x5906c3['id']},{})[_0x501e('0x26')](function(){return _0x63ed2c;});}else{return _0x63ed2c;}})['catch'](function(_0x502c76){logger[_0x501e('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x502c76);throw _0x502c76;});}return _0x63ed2c;})[_0x501e('0x26')](respondWithResult(_0x4d2ca5,0xc9))[_0x501e('0x41')](handleError(_0x4d2ca5,null));};exports[_0x501e('0x24')]=function(_0x5698bc,_0x301cbd){if(_0x5698bc['body']['id']){delete _0x5698bc[_0x501e('0x46')]['id'];}return db[_0x501e('0x3e')][_0x501e('0x45')]({'where':{'id':_0x5698bc[_0x501e('0x43')]['id']}})[_0x501e('0x26')](handleEntityNotFound(_0x301cbd,null))[_0x501e('0x26')](saveUpdates(_0x5698bc[_0x501e('0x46')],null))[_0x501e('0x26')](respondWithResult(_0x301cbd,null))[_0x501e('0x41')](handleError(_0x301cbd,null));};exports[_0x501e('0x25')]=function(_0x286a15,_0x288ef2){return db[_0x501e('0x3e')][_0x501e('0x45')]({'where':{'id':_0x286a15[_0x501e('0x43')]['id']}})[_0x501e('0x26')](handleEntityNotFound(_0x288ef2,null))[_0x501e('0x26')](removeEntity(_0x288ef2,null))[_0x501e('0x41')](handleError(_0x288ef2,null));};exports['addUsers']=function(_0x479101,_0x31fac8,_0x223fca){return db['SquareProject'][_0x501e('0x45')]({'where':{'id':_0x479101[_0x501e('0x43')]['id']}})['then'](handleEntityNotFound(_0x31fac8,null))['then'](function(_0x274e28){if(_0x274e28){return _0x274e28['addUsers'](_0x479101[_0x501e('0x46')]['ids'],_[_0x501e('0x4f')](_0x479101[_0x501e('0x46')],[_0x501e('0x50'),'id'])||{});}})[_0x501e('0x26')](respondWithResult(_0x31fac8,null))['catch'](handleError(_0x31fac8,null));};exports[_0x501e('0x51')]=function(_0x36b717,_0x3720d1,_0x516013){return db[_0x501e('0x3e')]['find']({'where':{'id':_0x36b717[_0x501e('0x43')]['id']}})[_0x501e('0x26')](handleEntityNotFound(_0x3720d1,null))[_0x501e('0x26')](function(_0x3f107a){if(_0x3f107a){return _0x3f107a[_0x501e('0x51')](_0x36b717[_0x501e('0x30')][_0x501e('0x50')])[_0x501e('0x26')](function(){if(_['isArray'](_0x36b717[_0x501e('0x30')][_0x501e('0x50')])){for(var _0x70ac1d=0x0;_0x70ac1d<_0x36b717[_0x501e('0x30')][_0x501e('0x50')]['length'];_0x70ac1d+=0x1){socket[_0x501e('0x52')](_0x501e('0x53'),{'UserId':Number(_0x36b717[_0x501e('0x30')]['ids'][_0x70ac1d]),'SquareProjectId':Number(_0x36b717[_0x501e('0x43')]['id'])});}}else{socket[_0x501e('0x52')](_0x501e('0x53'),{'UserId':Number(_0x36b717[_0x501e('0x30')]['ids']),'SquareProjectId':Number(_0x36b717['params']['id'])});}});}})[_0x501e('0x26')](respondWithStatusCode(_0x3720d1,null))[_0x501e('0x41')](handleError(_0x3720d1,null));};exports[_0x501e('0x54')]=function(_0x3ad235,_0x3bb24c,_0x515156){var _0x499b09={};var _0x326778={};var _0x951d1;var _0x4ad394;return db[_0x501e('0x3e')][_0x501e('0x55')]({'where':{'id':_0x3ad235[_0x501e('0x43')]['id']}})[_0x501e('0x26')](handleEntityNotFound(_0x3bb24c,null))[_0x501e('0x26')](function(_0x550ad5){if(_0x550ad5){_0x951d1=_0x550ad5;_0x326778[_0x501e('0x34')]=_[_0x501e('0x31')](db['User'][_0x501e('0x2c')]);_0x326778[_0x501e('0x30')]=_[_0x501e('0x31')](_0x3ad235[_0x501e('0x30')]);_0x326778[_0x501e('0x32')]=_[_0x501e('0x33')](_0x326778[_0x501e('0x34')],_0x326778['query']);_0x499b09['attributes']=_['intersection'](_0x326778[_0x501e('0x34')],qs[_0x501e('0x36')](_0x3ad235[_0x501e('0x30')]['fields']));_0x499b09[_0x501e('0x35')]=_0x499b09[_0x501e('0x35')][_0x501e('0x37')]?_0x499b09[_0x501e('0x35')]:_0x326778[_0x501e('0x34')];_0x499b09[_0x501e('0x56')]=qs[_0x501e('0x38')](_0x3ad235[_0x501e('0x30')][_0x501e('0x38')]);_0x499b09['where']=qs['filters'](_[_0x501e('0x39')](_0x3ad235[_0x501e('0x30')],_0x326778[_0x501e('0x32')]));if(_0x3ad235[_0x501e('0x30')][_0x501e('0x3a')]){_0x499b09[_0x501e('0x3b')]=_['merge'](_0x499b09['where'],{'$or':_['map'](_0x499b09[_0x501e('0x35')],function(_0x356e99){var _0x9bd86={};_0x9bd86[_0x356e99]={'$like':'%'+_0x3ad235['query'][_0x501e('0x3a')]+'%'};return _0x9bd86;})});}_0x499b09=_[_0x501e('0x3c')]({},_0x499b09,_0x3ad235[_0x501e('0x3d')]);return _0x951d1[_0x501e('0x54')](_0x499b09);}})['then'](function(_0x523ad9){if(_0x523ad9){_0x4ad394=_0x523ad9[_0x501e('0x37')];if(!_0x3ad235[_0x501e('0x30')][_0x501e('0x57')](_0x501e('0x58'))){_0x499b09[_0x501e('0x1e')]=qs[_0x501e('0x1e')](_0x3ad235[_0x501e('0x30')][_0x501e('0x1e')]);_0x499b09[_0x501e('0x1d')]=qs['offset'](_0x3ad235[_0x501e('0x30')][_0x501e('0x1d')]);}return _0x951d1[_0x501e('0x54')](_0x499b09);}})[_0x501e('0x26')](function(_0x42415b){if(_0x42415b){return _0x42415b?{'count':_0x4ad394,'rows':_0x42415b}:null;}})[_0x501e('0x26')](respondWithResult(_0x3bb24c,null))[_0x501e('0x41')](handleError(_0x3bb24c,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index f3370eb..76e7a2f 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 _0x49fe=['events','../../mysqldb','SquareProject','update','emit','hasOwnProperty','hook','exports'];(function(_0x3cba1d,_0x2825ae){var _0x5f192b=function(_0x32ff5d){while(--_0x32ff5d){_0x3cba1d['push'](_0x3cba1d['shift']());}};_0x5f192b(++_0x2825ae);}(_0x49fe,0x100));var _0xe49f=function(_0x2b5aaa,_0x215e83){_0x2b5aaa=_0x2b5aaa-0x0;var _0x344a85=_0x49fe[_0x2b5aaa];return _0x344a85;};'use strict';var EventEmitter=require(_0xe49f('0x0'));var SquareProject=require(_0xe49f('0x1'))['db'][_0xe49f('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe49f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x195bcf){return function(_0x199a0b,_0xb0e197,_0x43c119){SquareProjectEvents['emit'](_0x195bcf+':'+_0x199a0b['id'],_0x199a0b);SquareProjectEvents[_0xe49f('0x4')](_0x195bcf,_0x199a0b);_0x43c119(null);};}for(var e in events){if(events[_0xe49f('0x5')](e)){var event=events[e];SquareProject[_0xe49f('0x6')](e,emitEvent(event));}}module[_0xe49f('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x3b34=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x5b6062,_0x3aade7){var _0x1354ea=function(_0x32db85){while(--_0x32db85){_0x5b6062['push'](_0x5b6062['shift']());}};_0x1354ea(++_0x3aade7);}(_0x3b34,0x108));var _0x43b3=function(_0x5ae2bd,_0x37c17a){_0x5ae2bd=_0x5ae2bd-0x0;var _0xd3aabe=_0x3b34[_0x5ae2bd];return _0xd3aabe;};'use strict';var EventEmitter=require(_0x43b3('0x0'));var SquareProject=require(_0x43b3('0x1'))['db'][_0x43b3('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x43b3('0x3')](0x0);var events={'afterCreate':_0x43b3('0x4'),'afterUpdate':_0x43b3('0x5'),'afterDestroy':_0x43b3('0x6')};function emitEvent(_0x5e41c9){return function(_0x3397ee,_0x395c6a,_0x26d89c){SquareProjectEvents[_0x43b3('0x7')](_0x5e41c9+':'+_0x3397ee['id'],_0x3397ee);SquareProjectEvents[_0x43b3('0x7')](_0x5e41c9,_0x3397ee);_0x26d89c(null);};}for(var e in events){if(events[_0x43b3('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x43b3('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 d03ffa8..e4b2f14 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 _0x1967=['path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x64fa5d,_0x4ba48d){var _0x39618c=function(_0x4e0672){while(--_0x4e0672){_0x64fa5d['push'](_0x64fa5d['shift']());}};_0x39618c(++_0x4ba48d);}(_0x1967,0x173));var _0x7196=function(_0x1ecb44,_0x72bc9e){_0x1ecb44=_0x1ecb44-0x0;var _0x56d879=_0x1967[_0x1ecb44];return _0x56d879;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a85=['moment','path','rimraf','../../config/environment','exports','SquareProject','square_projects','../../config/logger','api'];(function(_0x9b0431,_0x32542c){var _0x4b3886=function(_0x51da12){while(--_0x51da12){_0x9b0431['push'](_0x9b0431['shift']());}};_0x4b3886(++_0x32542c);}(_0x1a85,0x178));var _0x51a8=function(_0x82305a,_0x46a9fb){_0x82305a=_0x82305a-0x0;var _0x5b57e6=_0x1a85[_0x82305a];return _0x5b57e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./squareProject.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'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 69bc220..e30fdee 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 _0xc2ef=['../../config/environment','jayson/promise','client','http','redis','localhost','./squareProject.socket','request','then','info','request\x20sent','debug','error','code','message','SquareProject,\x20%s,\x20%s','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x342db7,_0x2f2fac){var _0x2742e1=function(_0x43c1b5){while(--_0x43c1b5){_0x342db7['push'](_0x342db7['shift']());}};_0x2742e1(++_0x2f2fac);}(_0xc2ef,0x1e5));var _0xfc2e=function(_0x4d193b,_0x3020a5){_0x4d193b=_0x4d193b-0x0;var _0x5357b1=_0xc2ef[_0x4d193b];return _0x5357b1;};'use strict';var _=require(_0xfc2e('0x0'));var util=require(_0xfc2e('0x1'));var moment=require(_0xfc2e('0x2'));var BPromise=require(_0xfc2e('0x3'));var rs=require(_0xfc2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc2e('0x5'))['db'];var utils=require(_0xfc2e('0x6'));var logger=require(_0xfc2e('0x7'))(_0xfc2e('0x8'));var config=require(_0xfc2e('0x9'));var jayson=require(_0xfc2e('0xa'));var client=jayson[_0xfc2e('0xb')][_0xfc2e('0xc')]({'port':0x232a});config[_0xfc2e('0xd')]=_['defaults'](config[_0xfc2e('0xd')],{'host':_0xfc2e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfc2e('0xf'))['register'](socket);function respondWithRpcPromise(_0x35cd4b,_0x43e92b,_0x29d054){return new BPromise(function(_0x1c29ce,_0x28ab1e){return client[_0xfc2e('0x10')](_0x35cd4b,_0x29d054)[_0xfc2e('0x11')](function(_0xd6afb0){logger[_0xfc2e('0x12')]('SquareProject,\x20%s,\x20%s',_0x43e92b,_0xfc2e('0x13'));logger[_0xfc2e('0x14')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x43e92b,_0xfc2e('0x13'),JSON['stringify'](_0xd6afb0));if(_0xd6afb0['error']){if(_0xd6afb0[_0xfc2e('0x15')][_0xfc2e('0x16')]===0x1f4){logger[_0xfc2e('0x15')]('SquareProject,\x20%s,\x20%s',_0x43e92b,_0xd6afb0[_0xfc2e('0x15')][_0xfc2e('0x17')]);return _0x28ab1e(_0xd6afb0[_0xfc2e('0x15')]['message']);}logger['error'](_0xfc2e('0x18'),_0x43e92b,_0xd6afb0[_0xfc2e('0x15')][_0xfc2e('0x17')]);return _0x1c29ce(_0xd6afb0[_0xfc2e('0x15')]['message']);}else{logger[_0xfc2e('0x12')]('SquareProject,\x20%s,\x20%s',_0x43e92b,_0xfc2e('0x13'));_0x1c29ce(_0xd6afb0[_0xfc2e('0x19')][_0xfc2e('0x17')]);}})[_0xfc2e('0x1a')](function(_0x393fe6){logger[_0xfc2e('0x15')](_0xfc2e('0x18'),_0x43e92b,_0x393fe6);_0x28ab1e(_0x393fe6);});});}exports[_0xfc2e('0x1b')]=function(_0x5a680a){var _0x522c8f=this;return new Promise(function(_0x6e554e,_0x1024b5){return db[_0xfc2e('0x1c')][_0xfc2e('0x1d')]({'raw':_0x5a680a['options']?_0x5a680a[_0xfc2e('0x1e')][_0xfc2e('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a680a['options']?_0x5a680a[_0xfc2e('0x1e')][_0xfc2e('0x20')]||null:null,'attributes':_0x5a680a[_0xfc2e('0x1e')]?_0x5a680a[_0xfc2e('0x1e')][_0xfc2e('0x21')]||null:null,'include':_0x5a680a['options']?_0x5a680a[_0xfc2e('0x1e')][_0xfc2e('0x22')]?_[_0xfc2e('0x23')](_0x5a680a[_0xfc2e('0x1e')]['include'],function(_0x4e8573){return{'model':db[_0x4e8573['model']],'as':_0x4e8573['as'],'attributes':_0x4e8573[_0xfc2e('0x21')],'include':_0x4e8573['include']?_[_0xfc2e('0x23')](_0x4e8573[_0xfc2e('0x22')],function(_0x4b7b9b){return{'model':db[_0x4b7b9b['model']],'as':_0x4b7b9b['as'],'attributes':_0x4b7b9b[_0xfc2e('0x21')],'include':_0x4b7b9b[_0xfc2e('0x22')]?_[_0xfc2e('0x23')](_0x4b7b9b['include'],function(_0x5d7735){return{'model':db[_0x5d7735[_0xfc2e('0x24')]],'as':_0x5d7735['as'],'attributes':_0x5d7735[_0xfc2e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c949c){logger[_0xfc2e('0x12')](_0xfc2e('0x1b'),_0x5a680a);logger['debug'](_0xfc2e('0x1b'),_0x5a680a,JSON[_0xfc2e('0x25')](_0x2c949c));_0x6e554e(_0x2c949c);})[_0xfc2e('0x1a')](function(_0x370d24){logger[_0xfc2e('0x15')]('ShowSquareProject',_0x370d24[_0xfc2e('0x17')],_0x5a680a);_0x1024b5(_0x522c8f[_0xfc2e('0x15')](0x1f4,_0x370d24[_0xfc2e('0x17')]));});});}; \ No newline at end of file +var _0x6a70=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','code','error','SquareProject,\x20%s,\x20%s','message','result','ShowSquareProject','SquareProject','options','raw','attributes','map','include','model','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x11dc4d,_0x45f353){var _0x125d12=function(_0x59c927){while(--_0x59c927){_0x11dc4d['push'](_0x11dc4d['shift']());}};_0x125d12(++_0x45f353);}(_0x6a70,0x120));var _0x06a7=function(_0x44f58c,_0x1c9df2){_0x44f58c=_0x44f58c-0x0;var _0x733b0a=_0x6a70[_0x44f58c];return _0x733b0a;};'use strict';var _=require(_0x06a7('0x0'));var util=require(_0x06a7('0x1'));var moment=require(_0x06a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x06a7('0x3'));var fs=require('fs');var Redis=require(_0x06a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x06a7('0x5'))(_0x06a7('0x6'));var config=require(_0x06a7('0x7'));var jayson=require(_0x06a7('0x8'));var client=jayson[_0x06a7('0x9')][_0x06a7('0xa')]({'port':0x232a});config[_0x06a7('0xb')]=_[_0x06a7('0xc')](config[_0x06a7('0xb')],{'host':_0x06a7('0xd'),'port':0x18eb});var socket=require(_0x06a7('0xe'))(new Redis(config['redis']));require(_0x06a7('0xf'))[_0x06a7('0x10')](socket);function respondWithRpcPromise(_0x40e4e8,_0x36afab,_0x3457b3){return new BPromise(function(_0xfff1cf,_0x5c3b24){return client[_0x06a7('0x11')](_0x40e4e8,_0x3457b3)[_0x06a7('0x12')](function(_0x7ba452){logger[_0x06a7('0x13')]('SquareProject,\x20%s,\x20%s',_0x36afab,_0x06a7('0x14'));logger['debug'](_0x06a7('0x15'),_0x36afab,_0x06a7('0x14'),JSON[_0x06a7('0x16')](_0x7ba452));if(_0x7ba452['error']){if(_0x7ba452['error'][_0x06a7('0x17')]===0x1f4){logger[_0x06a7('0x18')](_0x06a7('0x19'),_0x36afab,_0x7ba452[_0x06a7('0x18')][_0x06a7('0x1a')]);return _0x5c3b24(_0x7ba452[_0x06a7('0x18')][_0x06a7('0x1a')]);}logger[_0x06a7('0x18')](_0x06a7('0x19'),_0x36afab,_0x7ba452[_0x06a7('0x18')][_0x06a7('0x1a')]);return _0xfff1cf(_0x7ba452['error'][_0x06a7('0x1a')]);}else{logger['info'](_0x06a7('0x19'),_0x36afab,_0x06a7('0x14'));_0xfff1cf(_0x7ba452[_0x06a7('0x1b')][_0x06a7('0x1a')]);}})['catch'](function(_0x216876){logger[_0x06a7('0x18')](_0x06a7('0x19'),_0x36afab,_0x216876);_0x5c3b24(_0x216876);});});}exports[_0x06a7('0x1c')]=function(_0x453f43){var _0x3269d8=this;return new Promise(function(_0x2717a2,_0x564648){return db[_0x06a7('0x1d')]['find']({'raw':_0x453f43[_0x06a7('0x1e')]?_0x453f43[_0x06a7('0x1e')][_0x06a7('0x1f')]===undefined?!![]:![]:!![],'where':_0x453f43[_0x06a7('0x1e')]?_0x453f43['options']['where']||null:null,'attributes':_0x453f43[_0x06a7('0x1e')]?_0x453f43[_0x06a7('0x1e')][_0x06a7('0x20')]||null:null,'include':_0x453f43[_0x06a7('0x1e')]?_0x453f43[_0x06a7('0x1e')]['include']?_[_0x06a7('0x21')](_0x453f43['options'][_0x06a7('0x22')],function(_0x5381a2){return{'model':db[_0x5381a2[_0x06a7('0x23')]],'as':_0x5381a2['as'],'attributes':_0x5381a2[_0x06a7('0x20')],'include':_0x5381a2['include']?_[_0x06a7('0x21')](_0x5381a2['include'],function(_0xc501d2){return{'model':db[_0xc501d2[_0x06a7('0x23')]],'as':_0xc501d2['as'],'attributes':_0xc501d2[_0x06a7('0x20')],'include':_0xc501d2['include']?_['map'](_0xc501d2['include'],function(_0x2d0d4a){return{'model':db[_0x2d0d4a[_0x06a7('0x23')]],'as':_0x2d0d4a['as'],'attributes':_0x2d0d4a[_0x06a7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x06a7('0x12')](function(_0x52df39){logger[_0x06a7('0x13')]('ShowSquareProject',_0x453f43);logger['debug']('ShowSquareProject',_0x453f43,JSON[_0x06a7('0x16')](_0x52df39));_0x2717a2(_0x52df39);})[_0x06a7('0x24')](function(_0x2d2baf){logger[_0x06a7('0x18')]('ShowSquareProject',_0x2d2baf['message'],_0x453f43);_0x564648(_0x3269d8[_0x06a7('0x18')](0x1f4,_0x2d2baf[_0x06a7('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 50cdbc6..3e3b358 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 _0x6d38=['removeListener','length','squareProject:','save','remove','update'];(function(_0x53377b,_0x166f23){var _0x39cba9=function(_0x4be07d){while(--_0x4be07d){_0x53377b['push'](_0x53377b['shift']());}};_0x39cba9(++_0x166f23);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x86d3('0x0'),_0x86d3('0x1'),_0x86d3('0x2')];function createListener(_0x52d138,_0x5c0b77){return function(_0xd1c7c){_0x5c0b77['emit'](_0x52d138,_0xd1c7c);};}function removeListener(_0xe9198a,_0x455b9d){return function(){SquareProjectEvents[_0x86d3('0x3')](_0xe9198a,_0x455b9d);};}exports['register']=function(_0x2d8272){for(var _0xfbbc15=0x0,_0x33d4aa=events[_0x86d3('0x4')];_0xfbbc15<_0x33d4aa;_0xfbbc15++){var _0x47e654=events[_0xfbbc15];var _0x552b07=createListener(_0x86d3('0x5')+_0x47e654,_0x2d8272);SquareProjectEvents['on'](_0x47e654,_0x552b07);}}; \ No newline at end of file +var _0x4c60=['squareProject:','./squareProject.events','save','remove','update','removeListener','register','length'];(function(_0x37ad5b,_0x5d0322){var _0xb41db3=function(_0x5528af){while(--_0x5528af){_0x37ad5b['push'](_0x37ad5b['shift']());}};_0xb41db3(++_0x5d0322);}(_0x4c60,0xc1));var _0x04c6=function(_0x51b07a,_0x4d7206){_0x51b07a=_0x51b07a-0x0;var _0x1dd36e=_0x4c60[_0x51b07a];return _0x1dd36e;};'use strict';var SquareProjectEvents=require(_0x04c6('0x0'));var events=[_0x04c6('0x1'),_0x04c6('0x2'),_0x04c6('0x3')];function createListener(_0x5ba768,_0x2a1d36){return function(_0x5d9fa3){_0x2a1d36['emit'](_0x5ba768,_0x5d9fa3);};}function removeListener(_0x4ad4f1,_0x53ca7a){return function(){SquareProjectEvents[_0x04c6('0x4')](_0x4ad4f1,_0x53ca7a);};}exports[_0x04c6('0x5')]=function(_0x2054da){for(var _0x12bd5d=0x0,_0x2b9041=events[_0x04c6('0x6')];_0x12bd5d<_0x2b9041;_0x12bd5d++){var _0x8f9b13=events[_0x12bd5d];var _0x530a48=createListener(_0x04c6('0x7')+_0x8f9b13,_0x2054da);SquareProjectEvents['on'](_0x8f9b13,_0x530a48);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 2362043..8759ec1 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 _0xf891=['delete','/:id/delete','destroy','multer','util','express','Router','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','put','update'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xf891,0x93));var _0x1f89=function(_0x385bf3,_0x259ed3){_0x385bf3=_0x385bf3-0x0;var _0x5af14f=_0xf891[_0x385bf3];return _0x5af14f;};'use strict';var multer=require(_0x1f89('0x0'));var util=require(_0x1f89('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1f89('0x2'));var router=express[_0x1f89('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1f89('0x4'));var config=require('../../config/environment');var controller=require(_0x1f89('0x5'));router[_0x1f89('0x6')]('/',auth[_0x1f89('0x7')](),controller['index']);router[_0x1f89('0x6')](_0x1f89('0x8'),auth['isAuthenticated'](),controller[_0x1f89('0x9')]);router[_0x1f89('0x6')](_0x1f89('0xa'),auth[_0x1f89('0x7')](),controller[_0x1f89('0xb')]);router[_0x1f89('0xc')]('/',auth[_0x1f89('0x7')](),controller['create']);router[_0x1f89('0xd')](_0x1f89('0x8'),auth[_0x1f89('0x7')](),controller[_0x1f89('0xe')]);router[_0x1f89('0xf')](_0x1f89('0x10'),auth[_0x1f89('0x7')](),controller[_0x1f89('0x11')]);module['exports']=router; \ No newline at end of file +var _0xca2c=['multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports'];(function(_0x25408e,_0x457e2d){var _0xd3099d=function(_0x44fe35){while(--_0x44fe35){_0x25408e['push'](_0x25408e['shift']());}};_0xd3099d(++_0x457e2d);}(_0xca2c,0xd1));var _0xcca2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xca2c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xcca2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcca2('0x1'));var express=require(_0xcca2('0x2'));var router=express[_0xcca2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcca2('0x4'));var config=require(_0xcca2('0x5'));var controller=require(_0xcca2('0x6'));router['get']('/',auth[_0xcca2('0x7')](),controller['index']);router[_0xcca2('0x8')](_0xcca2('0x9'),auth[_0xcca2('0x7')](),controller['show']);router[_0xcca2('0x8')](_0xcca2('0xa'),auth['isAuthenticated'](),controller[_0xcca2('0xb')]);router[_0xcca2('0xc')]('/',auth['isAuthenticated'](),controller[_0xcca2('0xd')]);router[_0xcca2('0xe')](_0xcca2('0x9'),auth['isAuthenticated'](),controller[_0xcca2('0xf')]);router[_0xcca2('0x10')]('/:id/delete',auth[_0xcca2('0x7')](),controller[_0xcca2('0x11')]);module[_0xcca2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9aadac4..b9928dd 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 _0xb520=['VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x2290ae,_0xbbbf35){var _0x38bdd0=function(_0x4eb053){while(--_0x4eb053){_0x2290ae['push'](_0x2290ae['shift']());}};_0x38bdd0(++_0xbbbf35);}(_0xb520,0x162));var _0x0b52=function(_0x492432,_0x2cb758){_0x492432=_0x492432-0x0;var _0x5d1be8=_0xb520[_0x492432];return _0x5d1be8;};'use strict';var Sequelize=require(_0x0b52('0x0'));module[_0x0b52('0x1')]={'uniqueid':{'type':Sequelize[_0x0b52('0x2')]},'callerid':{'type':Sequelize[_0x0b52('0x2')]},'calleridname':{'type':Sequelize[_0x0b52('0x2')]},'context':{'type':Sequelize[_0x0b52('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0b52('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x0b52('0x2')]},'filename':{'type':Sequelize[_0x0b52('0x2')]},'savePath':{'type':Sequelize[_0x0b52('0x2')]},'format':{'type':Sequelize[_0x0b52('0x3')],'get':function(){var _0x33a6b6='';var _0x517665=this[_0x0b52('0x4')]('savePath');if(_0x517665){_0x33a6b6=_0x517665[_0x0b52('0x5')](_0x517665[_0x0b52('0x6')]('.'));}return _0x33a6b6;}}}; \ No newline at end of file +var _0xa3c4=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','exports','STRING'];(function(_0x33eaca,_0x488474){var _0x28a6ce=function(_0xfe2eab){while(--_0xfe2eab){_0x33eaca['push'](_0x33eaca['shift']());}};_0x28a6ce(++_0x488474);}(_0xa3c4,0xba));var _0x4a3c=function(_0x14d83a,_0x48aae2){_0x14d83a=_0x14d83a-0x0;var _0x383cd6=_0xa3c4[_0x14d83a];return _0x383cd6;};'use strict';var Sequelize=require(_0x4a3c('0x0'));module[_0x4a3c('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4a3c('0x2')]},'calleridname':{'type':Sequelize[_0x4a3c('0x2')]},'context':{'type':Sequelize[_0x4a3c('0x2')]},'extension':{'type':Sequelize[_0x4a3c('0x2')]},'priority':{'type':Sequelize[_0x4a3c('0x2')]},'accountcode':{'type':Sequelize[_0x4a3c('0x2')]},'dnid':{'type':Sequelize[_0x4a3c('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x4a3c('0x2')]},'format':{'type':Sequelize[_0x4a3c('0x3')],'get':function(){var _0x2c731a='';var _0x1e20ff=this[_0x4a3c('0x4')](_0x4a3c('0x5'));if(_0x1e20ff){_0x2c731a=_0x1e20ff['substring'](_0x1e20ff[_0x4a3c('0x6')]('.'));}return _0x2c731a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 6f85aad..7851c06 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 _0xe501=['../../mysqldb','sendStatus','status','json','count','offset','set','save','update','then','error','stack','name','send','index','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','ValidationError','SquareRecording\x20not\x20found','extname','unlink','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xe501,0x157));var _0x1e50=function(_0x10b213,_0x1f710f){_0x10b213=_0x10b213-0x0;var _0x263d5a=_0xe501[_0x10b213];return _0x263d5a;};'use strict';var pdf=require(_0x1e50('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1e50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e50('0x2'));var rp=require('request-promise');var moment=require(_0x1e50('0x3'));var BPromise=require(_0x1e50('0x4'));var Mustache=require(_0x1e50('0x5'));var util=require(_0x1e50('0x6'));var path=require(_0x1e50('0x7'));var sox=require('sox');var csv=require(_0x1e50('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1e50('0x9'));var squel=require(_0x1e50('0xa'));var crypto=require(_0x1e50('0xb'));var jsforce=require(_0x1e50('0xc'));var deskjs=require(_0x1e50('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e50('0xe'));var Redis=require(_0x1e50('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1e50('0x10'));var as=require(_0x1e50('0x11'));var hardwareService=require(_0x1e50('0x12'));var logger=require(_0x1e50('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1e50('0x14'));var db=require(_0x1e50('0x15'))['db'];function respondWithStatusCode(_0x16d5a5,_0xe8efb7){_0xe8efb7=_0xe8efb7||0xcc;return function(_0x242af2){if(_0x242af2){return _0x16d5a5[_0x1e50('0x16')](_0xe8efb7);}return _0x16d5a5[_0x1e50('0x17')](_0xe8efb7)['end']();};}function respondWithResult(_0x59298b,_0x49961c){_0x49961c=_0x49961c||0xc8;return function(_0x28d41d){if(_0x28d41d){return _0x59298b[_0x1e50('0x17')](_0x49961c)[_0x1e50('0x18')](_0x28d41d);}};}function respondWithFilteredResult(_0x59c0ef,_0x47299e){return function(_0x336e7a){if(_0x336e7a){var _0x57685c=_0x336e7a[_0x1e50('0x19')],_0x2aafcb=_0x47299e[_0x1e50('0x1a')],_0x229200=_0x47299e[_0x1e50('0x1a')]+_0x47299e['limit'],_0xc62162;if(_0x229200>=_0x57685c){_0x229200=_0x57685c;_0xc62162=0xc8;}else{_0xc62162=0xce;}_0x59c0ef['status'](_0xc62162);return _0x59c0ef[_0x1e50('0x1b')]('Content-Range',_0x2aafcb+'-'+_0x229200+'/'+_0x57685c)[_0x1e50('0x18')](_0x336e7a);}return null;};}function patchUpdates(_0x3a819e){return function(_0x4f276b){try{jsonpatch['apply'](_0x4f276b,_0x3a819e,!![]);}catch(_0x462ab7){return BPromise['reject'](_0x462ab7);}return _0x4f276b[_0x1e50('0x1c')]();};}function saveUpdates(_0x2a1788,_0x1b54c6){return function(_0x31437f){if(_0x31437f){return _0x31437f[_0x1e50('0x1d')](_0x2a1788)['then'](function(_0x571340){return _0x571340;});}return null;};}function removeEntity(_0xada6c3,_0x393508){return function(_0x3cf9c5){if(_0x3cf9c5){return _0x3cf9c5['destroy']()[_0x1e50('0x1e')](function(){_0xada6c3[_0x1e50('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37fb49,_0x5d7263){return function(_0x4c3ec3){if(!_0x4c3ec3){_0x37fb49[_0x1e50('0x16')](0x194);}return _0x4c3ec3;};}function handleError(_0x1315b9,_0x5cc990){_0x5cc990=_0x5cc990||0x1f4;return function(_0x5cc884){logger[_0x1e50('0x1f')](_0x5cc884[_0x1e50('0x20')]);if(_0x5cc884[_0x1e50('0x21')]){delete _0x5cc884['name'];}_0x1315b9[_0x1e50('0x17')](_0x5cc990)[_0x1e50('0x22')](_0x5cc884);};}exports[_0x1e50('0x23')]=function(_0x51beab,_0x9f8d9c){var _0x34eaa0={},_0x2b854d={},_0xf11cbb={'count':0x0,'rows':[]};var _0x10c484=_['map'](db[_0x1e50('0x24')][_0x1e50('0x25')],function(_0x56191b){return{'name':_0x56191b[_0x1e50('0x26')],'type':_0x56191b['type'][_0x1e50('0x27')]};});_0x2b854d[_0x1e50('0x28')]=_['map'](_0x10c484,_0x1e50('0x21'));_0x2b854d[_0x1e50('0x29')]=_[_0x1e50('0x2a')](_0x51beab[_0x1e50('0x29')]);_0x2b854d[_0x1e50('0x2b')]=_[_0x1e50('0x2c')](_0x2b854d['model'],_0x2b854d[_0x1e50('0x29')]);_0x34eaa0[_0x1e50('0x2d')]=_['intersection'](_0x2b854d[_0x1e50('0x28')],qs['fields'](_0x51beab[_0x1e50('0x29')][_0x1e50('0x2e')]));_0x34eaa0['attributes']=_0x34eaa0[_0x1e50('0x2d')][_0x1e50('0x2f')]?_0x34eaa0[_0x1e50('0x2d')]:_0x2b854d['model'];if(!_0x51beab[_0x1e50('0x29')][_0x1e50('0x30')](_0x1e50('0x31'))){_0x34eaa0[_0x1e50('0x32')]=qs[_0x1e50('0x32')](_0x51beab[_0x1e50('0x29')][_0x1e50('0x32')]);_0x34eaa0[_0x1e50('0x1a')]=qs[_0x1e50('0x1a')](_0x51beab['query']['offset']);}_0x34eaa0[_0x1e50('0x33')]=qs[_0x1e50('0x34')](_0x51beab[_0x1e50('0x29')][_0x1e50('0x34')]);_0x34eaa0[_0x1e50('0x35')]=qs['filters'](_['pick'](_0x51beab['query'],_0x2b854d[_0x1e50('0x2b')]),_0x10c484);if(_0x51beab[_0x1e50('0x29')]['filter']){_0x34eaa0['where']=_[_0x1e50('0x36')](_0x34eaa0[_0x1e50('0x35')],{'$or':_['map'](_0x10c484,function(_0x4c07e5){if(_0x4c07e5[_0x1e50('0x37')]!==_0x1e50('0x38')){var _0x4c3674={};_0x4c3674[_0x4c07e5['name']]={'$like':'%'+_0x51beab[_0x1e50('0x29')][_0x1e50('0x39')]+'%'};return _0x4c3674;}})});}_0x34eaa0=_[_0x1e50('0x36')]({},_0x34eaa0,_0x51beab['options']);var _0x178bab={'where':_0x34eaa0[_0x1e50('0x35')]};return db[_0x1e50('0x24')][_0x1e50('0x19')](_0x178bab)['then'](function(_0x4141c9){_0xf11cbb[_0x1e50('0x19')]=_0x4141c9;if(_0x51beab['query'][_0x1e50('0x3a')]){_0x34eaa0[_0x1e50('0x3b')]=[{'all':!![]}];}return db[_0x1e50('0x24')][_0x1e50('0x3c')](_0x34eaa0);})[_0x1e50('0x1e')](function(_0x2409df){_0xf11cbb[_0x1e50('0x3d')]=_0x2409df;return _0xf11cbb;})['then'](respondWithFilteredResult(_0x9f8d9c,_0x34eaa0))[_0x1e50('0x3e')](handleError(_0x9f8d9c,null));};exports['show']=function(_0x3c9d51,_0x122f5f){var _0x3dee74={'raw':!![],'where':{'id':_0x3c9d51[_0x1e50('0x3f')]['id']}},_0x36c118={};_0x36c118[_0x1e50('0x28')]=_[_0x1e50('0x2a')](db[_0x1e50('0x24')][_0x1e50('0x25')]);_0x36c118[_0x1e50('0x29')]=_[_0x1e50('0x2a')](_0x3c9d51[_0x1e50('0x29')]);_0x36c118[_0x1e50('0x2b')]=_[_0x1e50('0x2c')](_0x36c118[_0x1e50('0x28')],_0x36c118[_0x1e50('0x29')]);_0x3dee74[_0x1e50('0x2d')]=_[_0x1e50('0x2c')](_0x36c118[_0x1e50('0x28')],qs[_0x1e50('0x2e')](_0x3c9d51[_0x1e50('0x29')]['fields']));_0x3dee74['attributes']=_0x3dee74['attributes']['length']?_0x3dee74[_0x1e50('0x2d')]:_0x36c118['model'];if(_0x3c9d51[_0x1e50('0x29')][_0x1e50('0x3a')]){_0x3dee74['include']=[{'all':!![]}];}_0x3dee74=_['merge']({},_0x3dee74,_0x3c9d51[_0x1e50('0x40')]);return db[_0x1e50('0x24')][_0x1e50('0x41')](_0x3dee74)['then'](handleEntityNotFound(_0x122f5f,null))[_0x1e50('0x1e')](respondWithResult(_0x122f5f,null))[_0x1e50('0x3e')](handleError(_0x122f5f,null));};exports['create']=function(_0x61c33a,_0x35f6be){return db['SquareRecording'][_0x1e50('0x42')](_0x61c33a[_0x1e50('0x43')],{})[_0x1e50('0x1e')](respondWithResult(_0x35f6be,0xc9))['catch'](handleError(_0x35f6be,null));};exports[_0x1e50('0x1d')]=function(_0x224db2,_0x54249f){if(_0x224db2[_0x1e50('0x43')]['id']){delete _0x224db2[_0x1e50('0x43')]['id'];}return db[_0x1e50('0x24')]['find']({'where':{'id':_0x224db2[_0x1e50('0x3f')]['id']}})[_0x1e50('0x1e')](handleEntityNotFound(_0x54249f,null))['then'](saveUpdates(_0x224db2['body'],null))[_0x1e50('0x1e')](respondWithResult(_0x54249f,null))[_0x1e50('0x3e')](handleError(_0x54249f,null));};exports[_0x1e50('0x44')]=function(_0x1bac8f,_0x2de373,_0x14c135){var _0x4f6711=require(_0x1e50('0x45'));var _0x21fb69=![];var _0x159671={};if(_0x1bac8f[_0x1e50('0x29')][_0x1e50('0x37')]&&_0x1bac8f[_0x1e50('0x29')][_0x1e50('0x37')]===_0x1e50('0x46')){_0x159671[_0x1e50('0x46')]=_0x1bac8f[_0x1e50('0x3f')]['id'];}else{_0x159671['id']=_0x1bac8f[_0x1e50('0x3f')]['id'];}return db['SquareRecording'][_0x1e50('0x41')]({'where':_0x159671,'attributes':['id',_0x1e50('0x47'),_0x1e50('0x48')],'raw':!![]})[_0x1e50('0x1e')](handleEntityNotFound(_0x2de373,null))[_0x1e50('0x1e')](function(_0x430609){if(_0x430609){var _0x72dc04=_0x430609[_0x1e50('0x47')];var _0xda17b5=util[_0x1e50('0x49')](_0x1e50('0x4a'),_0x72dc04);if(fs[_0x1e50('0x4b')](_0xda17b5)){_0x21fb69=!![];return _0x4f6711[_0x1e50('0x4c')](_0xda17b5,_0x72dc04,config['secrets']['recording'])[_0x1e50('0x1e')](function(){return _0x430609;});}return _0x430609;}})['then'](function(_0xcc228d){if(_0xcc228d){var _0x12c111=_0xcc228d[_0x1e50('0x47')];if(!fs[_0x1e50('0x4b')](_0x12c111)){throw new db['Sequelize'][(_0x1e50('0x4d'))](_0x1e50('0x4e'));}if(_0xcc228d[_0x1e50('0x48')]){return _0x2de373['download'](_0x12c111,_0xcc228d['filename']+path[_0x1e50('0x4f')](_0x12c111),function(){if(_0x21fb69){fs[_0x1e50('0x50')](_0x12c111);}});}else{return _0x2de373[_0x1e50('0x44')](_0x12c111,function(_0x30702e){if(_0x21fb69){fs[_0x1e50('0x50')](_0x12c111);}});}}})[_0x1e50('0x3e')](function(_0xd1fbcb){if(_0xd1fbcb['message']===_0x1e50('0x4e')){_0x2de373[_0x1e50('0x17')](0x194)['send']('Not\x20found');}else{return handleError(_0x2de373,null);}});};exports[_0x1e50('0x51')]=function(_0x52be47,_0x39f933){return db[_0x1e50('0x24')][_0x1e50('0x41')]({'where':{'id':_0x52be47['params']['id']}})[_0x1e50('0x1e')](function(_0x2ad589){if(!_0x2ad589)throw new ReferenceError(_0x1e50('0x52'));return _0x2ad589;})[_0x1e50('0x1e')](function(_0x13c718){var _0x1bc20e=_0x13c718[_0x1e50('0x47')];logger[_0x1e50('0x53')](_0x1e50('0x54'),_0x1bc20e);if(!_[_0x1e50('0x55')](_0x13c718['savePath'])&&fs['existsSync'](_0x1bc20e)){logger['info'](_0x1e50('0x56')+_0x1bc20e+_0x1e50('0x57'));fs[_0x1e50('0x58')](_0x1bc20e);}_0x1bc20e=_0x1bc20e+_0x1e50('0x59');if(!_[_0x1e50('0x55')](_0x13c718['savePath'])&&fs[_0x1e50('0x4b')](_0x1bc20e)){logger[_0x1e50('0x53')](_0x1e50('0x56')+_0x1bc20e+_0x1e50('0x57'));fs[_0x1e50('0x58')](_0x1bc20e);}return _0x13c718;})[_0x1e50('0x1e')](function(_0x35ef0e){if(!_0x35ef0e)throw new InternalError();return _0x35ef0e[_0x1e50('0x51')]();})[_0x1e50('0x1e')](function(){_0x39f933[_0x1e50('0x17')](0xcc)[_0x1e50('0x5a')]();})['catch'](handleError(_0x39f933,null));}; \ No newline at end of file +var _0x6e9d=['filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','extname','unlink','download','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','type','filter','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','../../components/encryptor','uniqueid','savePath'];(function(_0x1ea853,_0x318901){var _0x4588f0=function(_0x1daa14){while(--_0x1daa14){_0x1ea853['push'](_0x1ea853['shift']());}};_0x4588f0(++_0x318901);}(_0x6e9d,0x71));var _0xd6e9=function(_0x5446e8,_0x5e7a96){_0x5446e8=_0x5446e8-0x0;var _0x43712f=_0x6e9d[_0x5446e8];return _0x43712f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd6e9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd6e9('0x1'));var moment=require('moment');var BPromise=require(_0xd6e9('0x2'));var Mustache=require(_0xd6e9('0x3'));var util=require(_0xd6e9('0x4'));var path=require(_0xd6e9('0x5'));var sox=require(_0xd6e9('0x6'));var csv=require(_0xd6e9('0x7'));var ejs=require(_0xd6e9('0x8'));var fs=require('fs');var _=require(_0xd6e9('0x9'));var squel=require(_0xd6e9('0xa'));var crypto=require('crypto');var jsforce=require(_0xd6e9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6e9('0xc'));var Papa=require(_0xd6e9('0xd'));var Redis=require(_0xd6e9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd6e9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6e9('0x10'))(_0xd6e9('0x11'));var utils=require(_0xd6e9('0x12'));var config=require(_0xd6e9('0x13'));var db=require(_0xd6e9('0x14'))['db'];function respondWithStatusCode(_0x3d29d9,_0x43d73c){_0x43d73c=_0x43d73c||0xcc;return function(_0x30f3bb){if(_0x30f3bb){return _0x3d29d9[_0xd6e9('0x15')](_0x43d73c);}return _0x3d29d9[_0xd6e9('0x16')](_0x43d73c)[_0xd6e9('0x17')]();};}function respondWithResult(_0x3ac047,_0x1ecfd4){_0x1ecfd4=_0x1ecfd4||0xc8;return function(_0x5cadf4){if(_0x5cadf4){return _0x3ac047[_0xd6e9('0x16')](_0x1ecfd4)[_0xd6e9('0x18')](_0x5cadf4);}};}function respondWithFilteredResult(_0x5328aa,_0x10aa46){return function(_0x200cf7){if(_0x200cf7){var _0x34bda1=_0x200cf7[_0xd6e9('0x19')],_0xb0a2d4=_0x10aa46['offset'],_0x176342=_0x10aa46['offset']+_0x10aa46[_0xd6e9('0x1a')],_0x2e27ac;if(_0x176342>=_0x34bda1){_0x176342=_0x34bda1;_0x2e27ac=0xc8;}else{_0x2e27ac=0xce;}_0x5328aa[_0xd6e9('0x16')](_0x2e27ac);return _0x5328aa[_0xd6e9('0x1b')]('Content-Range',_0xb0a2d4+'-'+_0x176342+'/'+_0x34bda1)['json'](_0x200cf7);}return null;};}function patchUpdates(_0x5ea4d0){return function(_0x1910fb){try{jsonpatch[_0xd6e9('0x1c')](_0x1910fb,_0x5ea4d0,!![]);}catch(_0x123c09){return BPromise[_0xd6e9('0x1d')](_0x123c09);}return _0x1910fb[_0xd6e9('0x1e')]();};}function saveUpdates(_0xef5eaa,_0x1d1fd3){return function(_0x109735){if(_0x109735){return _0x109735[_0xd6e9('0x1f')](_0xef5eaa)[_0xd6e9('0x20')](function(_0xe17941){return _0xe17941;});}return null;};}function removeEntity(_0xd1a50e,_0x202c8b){return function(_0x1a4774){if(_0x1a4774){return _0x1a4774[_0xd6e9('0x21')]()[_0xd6e9('0x20')](function(){_0xd1a50e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d585c,_0x344443){return function(_0x39cd85){if(!_0x39cd85){_0x5d585c[_0xd6e9('0x15')](0x194);}return _0x39cd85;};}function handleError(_0x469334,_0x49bdf5){_0x49bdf5=_0x49bdf5||0x1f4;return function(_0x87041b){logger[_0xd6e9('0x22')](_0x87041b['stack']);if(_0x87041b[_0xd6e9('0x23')]){delete _0x87041b[_0xd6e9('0x23')];}_0x469334[_0xd6e9('0x16')](_0x49bdf5)[_0xd6e9('0x24')](_0x87041b);};}exports[_0xd6e9('0x25')]=function(_0x29a78a,_0x247a30){var _0x41f579={},_0x211c65={},_0x542a58={'count':0x0,'rows':[]};var _0x274be4=_[_0xd6e9('0x26')](db[_0xd6e9('0x27')][_0xd6e9('0x28')],function(_0x4ad5e1){return{'name':_0x4ad5e1[_0xd6e9('0x29')],'type':_0x4ad5e1['type'][_0xd6e9('0x2a')]};});_0x211c65[_0xd6e9('0x2b')]=_[_0xd6e9('0x26')](_0x274be4,'name');_0x211c65[_0xd6e9('0x2c')]=_[_0xd6e9('0x2d')](_0x29a78a['query']);_0x211c65[_0xd6e9('0x2e')]=_['intersection'](_0x211c65[_0xd6e9('0x2b')],_0x211c65[_0xd6e9('0x2c')]);_0x41f579[_0xd6e9('0x2f')]=_[_0xd6e9('0x30')](_0x211c65['model'],qs[_0xd6e9('0x31')](_0x29a78a[_0xd6e9('0x2c')][_0xd6e9('0x31')]));_0x41f579['attributes']=_0x41f579[_0xd6e9('0x2f')][_0xd6e9('0x32')]?_0x41f579[_0xd6e9('0x2f')]:_0x211c65[_0xd6e9('0x2b')];if(!_0x29a78a['query'][_0xd6e9('0x33')](_0xd6e9('0x34'))){_0x41f579[_0xd6e9('0x1a')]=qs[_0xd6e9('0x1a')](_0x29a78a[_0xd6e9('0x2c')][_0xd6e9('0x1a')]);_0x41f579[_0xd6e9('0x35')]=qs[_0xd6e9('0x35')](_0x29a78a[_0xd6e9('0x2c')][_0xd6e9('0x35')]);}_0x41f579['order']=qs[_0xd6e9('0x36')](_0x29a78a['query']['sort']);_0x41f579[_0xd6e9('0x37')]=qs[_0xd6e9('0x2e')](_[_0xd6e9('0x38')](_0x29a78a[_0xd6e9('0x2c')],_0x211c65['filters']),_0x274be4);if(_0x29a78a[_0xd6e9('0x2c')]['filter']){_0x41f579[_0xd6e9('0x37')]=_['merge'](_0x41f579[_0xd6e9('0x37')],{'$or':_[_0xd6e9('0x26')](_0x274be4,function(_0x3caba9){if(_0x3caba9[_0xd6e9('0x39')]!=='VIRTUAL'){var _0xb7f34a={};_0xb7f34a[_0x3caba9[_0xd6e9('0x23')]]={'$like':'%'+_0x29a78a[_0xd6e9('0x2c')][_0xd6e9('0x3a')]+'%'};return _0xb7f34a;}})});}_0x41f579=_['merge']({},_0x41f579,_0x29a78a[_0xd6e9('0x3b')]);var _0x464da7={'where':_0x41f579[_0xd6e9('0x37')]};return db[_0xd6e9('0x27')][_0xd6e9('0x19')](_0x464da7)[_0xd6e9('0x20')](function(_0x24b0d0){_0x542a58[_0xd6e9('0x19')]=_0x24b0d0;if(_0x29a78a['query'][_0xd6e9('0x3c')]){_0x41f579[_0xd6e9('0x3d')]=[{'all':!![]}];}return db['SquareRecording'][_0xd6e9('0x3e')](_0x41f579);})[_0xd6e9('0x20')](function(_0x347454){_0x542a58['rows']=_0x347454;return _0x542a58;})[_0xd6e9('0x20')](respondWithFilteredResult(_0x247a30,_0x41f579))[_0xd6e9('0x3f')](handleError(_0x247a30,null));};exports[_0xd6e9('0x40')]=function(_0x342196,_0x4ba98a){var _0x36d74f={'raw':!![],'where':{'id':_0x342196[_0xd6e9('0x41')]['id']}},_0x2b40ee={};_0x2b40ee['model']=_[_0xd6e9('0x2d')](db[_0xd6e9('0x27')]['rawAttributes']);_0x2b40ee['query']=_['keys'](_0x342196[_0xd6e9('0x2c')]);_0x2b40ee[_0xd6e9('0x2e')]=_[_0xd6e9('0x30')](_0x2b40ee[_0xd6e9('0x2b')],_0x2b40ee[_0xd6e9('0x2c')]);_0x36d74f[_0xd6e9('0x2f')]=_[_0xd6e9('0x30')](_0x2b40ee[_0xd6e9('0x2b')],qs[_0xd6e9('0x31')](_0x342196[_0xd6e9('0x2c')][_0xd6e9('0x31')]));_0x36d74f[_0xd6e9('0x2f')]=_0x36d74f[_0xd6e9('0x2f')]['length']?_0x36d74f[_0xd6e9('0x2f')]:_0x2b40ee[_0xd6e9('0x2b')];if(_0x342196[_0xd6e9('0x2c')][_0xd6e9('0x3c')]){_0x36d74f[_0xd6e9('0x3d')]=[{'all':!![]}];}_0x36d74f=_[_0xd6e9('0x42')]({},_0x36d74f,_0x342196[_0xd6e9('0x3b')]);return db[_0xd6e9('0x27')][_0xd6e9('0x43')](_0x36d74f)['then'](handleEntityNotFound(_0x4ba98a,null))['then'](respondWithResult(_0x4ba98a,null))[_0xd6e9('0x3f')](handleError(_0x4ba98a,null));};exports['create']=function(_0x2834a6,_0x5f407b){return db['SquareRecording'][_0xd6e9('0x44')](_0x2834a6[_0xd6e9('0x45')],{})[_0xd6e9('0x20')](respondWithResult(_0x5f407b,0xc9))['catch'](handleError(_0x5f407b,null));};exports[_0xd6e9('0x1f')]=function(_0x4763cf,_0x1496b8){if(_0x4763cf['body']['id']){delete _0x4763cf[_0xd6e9('0x45')]['id'];}return db[_0xd6e9('0x27')][_0xd6e9('0x43')]({'where':{'id':_0x4763cf[_0xd6e9('0x41')]['id']}})[_0xd6e9('0x20')](handleEntityNotFound(_0x1496b8,null))[_0xd6e9('0x20')](saveUpdates(_0x4763cf['body'],null))['then'](respondWithResult(_0x1496b8,null))[_0xd6e9('0x3f')](handleError(_0x1496b8,null));};exports['download']=function(_0x36db8d,_0x16f56b,_0x48f602){var _0x3bc931=require(_0xd6e9('0x46'));var _0x451997=![];var _0x3b408c={};if(_0x36db8d['query'][_0xd6e9('0x39')]&&_0x36db8d[_0xd6e9('0x2c')][_0xd6e9('0x39')]===_0xd6e9('0x47')){_0x3b408c['uniqueid']=_0x36db8d[_0xd6e9('0x41')]['id'];}else{_0x3b408c['id']=_0x36db8d[_0xd6e9('0x41')]['id'];}return db['SquareRecording']['find']({'where':_0x3b408c,'attributes':['id',_0xd6e9('0x48'),_0xd6e9('0x49')],'raw':!![]})[_0xd6e9('0x20')](handleEntityNotFound(_0x16f56b,null))[_0xd6e9('0x20')](function(_0x5b2a4d){if(_0x5b2a4d){var _0x15fc11=_0x5b2a4d[_0xd6e9('0x48')];var _0x80923f=util[_0xd6e9('0x4a')](_0xd6e9('0x4b'),_0x15fc11);if(fs[_0xd6e9('0x4c')](_0x80923f)){_0x451997=!![];return _0x3bc931[_0xd6e9('0x4d')](_0x80923f,_0x15fc11,config[_0xd6e9('0x4e')][_0xd6e9('0x4f')])[_0xd6e9('0x20')](function(){return _0x5b2a4d;});}return _0x5b2a4d;}})['then'](function(_0x1710d5){if(_0x1710d5){var _0xaa3c00=_0x1710d5[_0xd6e9('0x48')];if(!fs['existsSync'](_0xaa3c00)){throw new db[(_0xd6e9('0x50'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x1710d5[_0xd6e9('0x49')]){return _0x16f56b['download'](_0xaa3c00,_0x1710d5[_0xd6e9('0x49')]+path[_0xd6e9('0x51')](_0xaa3c00),function(){if(_0x451997){fs[_0xd6e9('0x52')](_0xaa3c00);}});}else{return _0x16f56b[_0xd6e9('0x53')](_0xaa3c00,function(_0x1194b8){if(_0x451997){fs[_0xd6e9('0x52')](_0xaa3c00);}});}}})[_0xd6e9('0x3f')](function(_0x5476ab){if(_0x5476ab[_0xd6e9('0x54')]==='SquareRecording\x20not\x20found'){_0x16f56b['status'](0x194)[_0xd6e9('0x24')](_0xd6e9('0x55'));}else{return handleError(_0x16f56b,null);}});};exports[_0xd6e9('0x21')]=function(_0x2dcc4c,_0x5c1a78){return db[_0xd6e9('0x27')]['find']({'where':{'id':_0x2dcc4c[_0xd6e9('0x41')]['id']}})[_0xd6e9('0x20')](function(_0x540ff2){if(!_0x540ff2)throw new ReferenceError('Entity\x20not\x20found');return _0x540ff2;})[_0xd6e9('0x20')](function(_0x227277){var _0x2a9dd0=_0x227277[_0xd6e9('0x48')];logger['info'](_0xd6e9('0x56'),_0x2a9dd0);if(!_[_0xd6e9('0x57')](_0x227277[_0xd6e9('0x48')])&&fs[_0xd6e9('0x4c')](_0x2a9dd0)){logger[_0xd6e9('0x58')]('File:\x20\x22'+_0x2a9dd0+_0xd6e9('0x59'));fs[_0xd6e9('0x5a')](_0x2a9dd0);}_0x2a9dd0=_0x2a9dd0+_0xd6e9('0x5b');if(!_[_0xd6e9('0x57')](_0x227277[_0xd6e9('0x48')])&&fs[_0xd6e9('0x4c')](_0x2a9dd0)){logger[_0xd6e9('0x58')](_0xd6e9('0x5c')+_0x2a9dd0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd6e9('0x5a')](_0x2a9dd0);}return _0x227277;})[_0xd6e9('0x20')](function(_0x19c8ce){if(!_0x19c8ce)throw new InternalError();return _0x19c8ce[_0xd6e9('0x21')]();})['then'](function(){_0x5c1a78[_0xd6e9('0x16')](0xcc)[_0xd6e9('0x17')]();})[_0xd6e9('0x3f')](handleError(_0x5c1a78,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 67509f7..1e2ba8d 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 _0x331c=['request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x331c,0x1e9));var _0xc331=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x331c[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xc331('0x0'));var util=require(_0xc331('0x1'));var logger=require(_0xc331('0x2'))(_0xc331('0x3'));var moment=require(_0xc331('0x4'));var BPromise=require('bluebird');var rp=require(_0xc331('0x5'));var fs=require('fs');var path=require(_0xc331('0x6'));var rimraf=require(_0xc331('0x7'));var config=require(_0xc331('0x8'));var attributes=require(_0xc331('0x9'));module['exports']=function(_0x1a3db4,_0x140eb9){return _0x1a3db4[_0xc331('0xa')](_0xc331('0xb'),attributes,{'tableName':_0xc331('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6da=['request-promise','path','rimraf','../../config/environment','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x47823a,_0x4a49a7){var _0x215023=function(_0x285813){while(--_0x285813){_0x47823a['push'](_0x47823a['shift']());}};_0x215023(++_0x4a49a7);}(_0xc6da,0xe4));var _0xac6d=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xc6da[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xac6d('0x0'));var util=require(_0xac6d('0x1'));var logger=require(_0xac6d('0x2'))(_0xac6d('0x3'));var moment=require(_0xac6d('0x4'));var BPromise=require(_0xac6d('0x5'));var rp=require(_0xac6d('0x6'));var fs=require('fs');var path=require(_0xac6d('0x7'));var rimraf=require(_0xac6d('0x8'));var config=require(_0xac6d('0x9'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0xf9d23c,_0x1f1d1b){return _0xf9d23c[_0xac6d('0xa')](_0xac6d('0xb'),attributes,{'tableName':_0xac6d('0xc'),'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 d7093c9..29d0319 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 _0x83d4=['options','raw','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateSquareRecording','SquareRecording','body'];(function(_0x53777c,_0x320988){var _0x5a3f15=function(_0x5df142){while(--_0x5df142){_0x53777c['push'](_0x53777c['shift']());}};_0x5a3f15(++_0x320988);}(_0x83d4,0xb2));var _0x483d=function(_0x4b83eb,_0x220b02){_0x4b83eb=_0x4b83eb-0x0;var _0x3b69a5=_0x83d4[_0x4b83eb];return _0x3b69a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x483d('0x0'));var BPromise=require('bluebird');var rs=require(_0x483d('0x1'));var fs=require('fs');var Redis=require(_0x483d('0x2'));var db=require(_0x483d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x483d('0x4'))(_0x483d('0x5'));var config=require(_0x483d('0x6'));var jayson=require(_0x483d('0x7'));var client=jayson[_0x483d('0x8')][_0x483d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47a056,_0x5c4c69,_0x59bab9){return new BPromise(function(_0x17b395,_0x5bddb5){return client['request'](_0x47a056,_0x59bab9)[_0x483d('0xa')](function(_0x2dd014){logger[_0x483d('0xb')](_0x483d('0xc'),_0x5c4c69,_0x483d('0xd'));logger[_0x483d('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5c4c69,_0x483d('0xd'),JSON['stringify'](_0x2dd014));if(_0x2dd014['error']){if(_0x2dd014['error']['code']===0x1f4){logger['error'](_0x483d('0xc'),_0x5c4c69,_0x2dd014[_0x483d('0xf')][_0x483d('0x10')]);return _0x5bddb5(_0x2dd014[_0x483d('0xf')][_0x483d('0x10')]);}logger[_0x483d('0xf')](_0x483d('0xc'),_0x5c4c69,_0x2dd014[_0x483d('0xf')]['message']);return _0x17b395(_0x2dd014['error']['message']);}else{logger[_0x483d('0xb')]('SquareRecording,\x20%s,\x20%s',_0x5c4c69,_0x483d('0xd'));_0x17b395(_0x2dd014[_0x483d('0x11')][_0x483d('0x10')]);}})[_0x483d('0x12')](function(_0x1800c1){logger[_0x483d('0xf')](_0x483d('0xc'),_0x5c4c69,_0x1800c1);_0x5bddb5(_0x1800c1);});});}exports[_0x483d('0x13')]=function(_0x522faa){var _0x41baec=this;return new Promise(function(_0x42b340,_0x3998b5){return db[_0x483d('0x14')]['create'](_0x522faa[_0x483d('0x15')],{'raw':_0x522faa['options']?_0x522faa[_0x483d('0x16')][_0x483d('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x51856e){logger[_0x483d('0xb')]('CreateSquareRecording',_0x522faa);logger['debug']('CreateSquareRecording',_0x522faa,JSON[_0x483d('0x18')](_0x51856e));_0x42b340(_0x51856e);})[_0x483d('0x12')](function(_0x2b2b71){logger[_0x483d('0xf')]('CreateSquareRecording',_0x2b2b71[_0x483d('0x10')],_0x522faa);_0x3998b5(_0x41baec[_0x483d('0xf')](0x1f4,_0x2b2b71[_0x483d('0x10')]));});});}; \ No newline at end of file +var _0xbff1=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareRecording','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','jayson/promise','client','http'];(function(_0x4faf15,_0x367d4e){var _0x16c0b5=function(_0x2e55a5){while(--_0x2e55a5){_0x4faf15['push'](_0x4faf15['shift']());}};_0x16c0b5(++_0x367d4e);}(_0xbff1,0x1c4));var _0x1bff=function(_0x5cd66b,_0x456626){_0x5cd66b=_0x5cd66b-0x0;var _0x212c9e=_0xbff1[_0x5cd66b];return _0x212c9e;};'use strict';var _=require(_0x1bff('0x0'));var util=require('util');var moment=require(_0x1bff('0x1'));var BPromise=require(_0x1bff('0x2'));var rs=require(_0x1bff('0x3'));var fs=require('fs');var Redis=require(_0x1bff('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1bff('0x5'));var client=jayson[_0x1bff('0x6')][_0x1bff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33dac1,_0x129afd,_0x1c33f8){return new BPromise(function(_0x1cff03,_0x40d42b){return client['request'](_0x33dac1,_0x1c33f8)[_0x1bff('0x8')](function(_0x4c8331){logger[_0x1bff('0x9')](_0x1bff('0xa'),_0x129afd,_0x1bff('0xb'));logger[_0x1bff('0xc')](_0x1bff('0xd'),_0x129afd,_0x1bff('0xb'),JSON[_0x1bff('0xe')](_0x4c8331));if(_0x4c8331[_0x1bff('0xf')]){if(_0x4c8331['error'][_0x1bff('0x10')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x129afd,_0x4c8331[_0x1bff('0xf')][_0x1bff('0x11')]);return _0x40d42b(_0x4c8331['error'][_0x1bff('0x11')]);}logger[_0x1bff('0xf')](_0x1bff('0xa'),_0x129afd,_0x4c8331[_0x1bff('0xf')][_0x1bff('0x11')]);return _0x1cff03(_0x4c8331[_0x1bff('0xf')][_0x1bff('0x11')]);}else{logger[_0x1bff('0x9')](_0x1bff('0xa'),_0x129afd,_0x1bff('0xb'));_0x1cff03(_0x4c8331['result'][_0x1bff('0x11')]);}})['catch'](function(_0x5b2252){logger[_0x1bff('0xf')](_0x1bff('0xa'),_0x129afd,_0x5b2252);_0x40d42b(_0x5b2252);});});}exports[_0x1bff('0x12')]=function(_0x25d5c0){var _0x573cbf=this;return new Promise(function(_0x1da52d,_0x1b4307){return db['SquareRecording'][_0x1bff('0x13')](_0x25d5c0[_0x1bff('0x14')],{'raw':_0x25d5c0['options']?_0x25d5c0[_0x1bff('0x15')][_0x1bff('0x16')]===undefined?!![]:![]:!![]})[_0x1bff('0x8')](function(_0x588c4c){logger[_0x1bff('0x9')](_0x1bff('0x12'),_0x25d5c0);logger[_0x1bff('0xc')](_0x1bff('0x12'),_0x25d5c0,JSON[_0x1bff('0xe')](_0x588c4c));_0x1da52d(_0x588c4c);})['catch'](function(_0x1a8c65){logger[_0x1bff('0xf')](_0x1bff('0x12'),_0x1a8c65[_0x1bff('0x11')],_0x25d5c0);_0x1b4307(_0x573cbf[_0x1bff('0xf')](0x1f4,_0x1a8c65[_0x1bff('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 00957b1..90b8d8d 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 _0x6a3e=['put','update','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','describe','/:id','post','create'];(function(_0x201038,_0x46c979){var _0x1b61ca=function(_0xf55d2a){while(--_0xf55d2a){_0x201038['push'](_0x201038['shift']());}};_0x1b61ca(++_0x46c979);}(_0x6a3e,0x94));var _0xe6a3=function(_0x4026db,_0x24121c){_0x4026db=_0x4026db-0x0;var _0x5d4b2e=_0x6a3e[_0x4026db];return _0x5d4b2e;};'use strict';var multer=require(_0xe6a3('0x0'));var util=require(_0xe6a3('0x1'));var path=require(_0xe6a3('0x2'));var timeout=require('connect-timeout');var express=require(_0xe6a3('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe6a3('0x4'));var config=require(_0xe6a3('0x5'));var controller=require(_0xe6a3('0x6'));router[_0xe6a3('0x7')]('/',auth[_0xe6a3('0x8')](),controller[_0xe6a3('0x9')]);router[_0xe6a3('0x7')]('/describe',auth[_0xe6a3('0x8')](),controller[_0xe6a3('0xa')]);router[_0xe6a3('0x7')](_0xe6a3('0xb'),auth[_0xe6a3('0x8')](),controller['show']);router[_0xe6a3('0xc')]('/',auth[_0xe6a3('0x8')](),controller[_0xe6a3('0xd')]);router[_0xe6a3('0xe')](_0xe6a3('0xb'),auth[_0xe6a3('0x8')](),controller[_0xe6a3('0xf')]);router['delete']('/:id',auth[_0xe6a3('0x8')](),controller[_0xe6a3('0x10')]);module[_0xe6a3('0x11')]=router; \ No newline at end of file +var _0x3b0c=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareReport.controller','get','index','/describe','/:id','show','post','create','isAuthenticated','update','delete','destroy','exports'];(function(_0x49c699,_0x314403){var _0x2853ea=function(_0x68ceb9){while(--_0x68ceb9){_0x49c699['push'](_0x49c699['shift']());}};_0x2853ea(++_0x314403);}(_0x3b0c,0x1c8));var _0xc3b0=function(_0x37b159,_0x377c84){_0x37b159=_0x37b159-0x0;var _0x2fa2c3=_0x3b0c[_0x37b159];return _0x2fa2c3;};'use strict';var multer=require('multer');var util=require(_0xc3b0('0x0'));var path=require('path');var timeout=require(_0xc3b0('0x1'));var express=require(_0xc3b0('0x2'));var router=express[_0xc3b0('0x3')]();var auth=require(_0xc3b0('0x4'));var interaction=require(_0xc3b0('0x5'));var config=require('../../config/environment');var controller=require(_0xc3b0('0x6'));router[_0xc3b0('0x7')]('/',auth['isAuthenticated'](),controller[_0xc3b0('0x8')]);router[_0xc3b0('0x7')](_0xc3b0('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xc3b0('0x7')](_0xc3b0('0xa'),auth['isAuthenticated'](),controller[_0xc3b0('0xb')]);router[_0xc3b0('0xc')]('/',auth['isAuthenticated'](),controller[_0xc3b0('0xd')]);router['put'](_0xc3b0('0xa'),auth[_0xc3b0('0xe')](),controller[_0xc3b0('0xf')]);router[_0xc3b0('0x10')](_0xc3b0('0xa'),auth[_0xc3b0('0xe')](),controller[_0xc3b0('0x11')]);module[_0xc3b0('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 29162ef..42d5788 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 _0x77a1=['sequelize','STRING','DATE','BOOLEAN'];(function(_0x5c2663,_0x7782f7){var _0x52baef=function(_0x49b1e8){while(--_0x49b1e8){_0x5c2663['push'](_0x5c2663['shift']());}};_0x52baef(++_0x7782f7);}(_0x77a1,0x10c));var _0x177a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x77a1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x177a('0x0'));module['exports']={'network':{'type':Sequelize[_0x177a('0x1')]},'network_script':{'type':Sequelize[_0x177a('0x1')]},'request':{'type':Sequelize[_0x177a('0x1')]},'channel':{'type':Sequelize[_0x177a('0x1')]},'language':{'type':Sequelize[_0x177a('0x1')]},'type':{'type':Sequelize[_0x177a('0x1')]},'uniqueid':{'type':Sequelize[_0x177a('0x1')]},'version':{'type':Sequelize[_0x177a('0x1')]},'callerid':{'type':Sequelize[_0x177a('0x1')]},'calleridname':{'type':Sequelize[_0x177a('0x1')]},'callingpres':{'type':Sequelize[_0x177a('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x177a('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x177a('0x1')]},'rdnis':{'type':Sequelize[_0x177a('0x1')]},'context':{'type':Sequelize[_0x177a('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x177a('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x177a('0x1')]},'threadid':{'type':Sequelize[_0x177a('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x177a('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x177a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8873=['STRING','DATE'];(function(_0x49ee70,_0x115b1e){var _0x3a7254=function(_0x1bc688){while(--_0x1bc688){_0x49ee70['push'](_0x49ee70['shift']());}};_0x3a7254(++_0x115b1e);}(_0x8873,0x1e6));var _0x3887=function(_0x406fbb,_0x1093e5){_0x406fbb=_0x406fbb-0x0;var _0x8e921d=_0x8873[_0x406fbb];return _0x8e921d;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x3887('0x0')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3887('0x0')]},'language':{'type':Sequelize[_0x3887('0x0')]},'type':{'type':Sequelize[_0x3887('0x0')]},'uniqueid':{'type':Sequelize[_0x3887('0x0')]},'version':{'type':Sequelize[_0x3887('0x0')]},'callerid':{'type':Sequelize[_0x3887('0x0')]},'calleridname':{'type':Sequelize[_0x3887('0x0')]},'callingpres':{'type':Sequelize[_0x3887('0x0')]},'callingani2':{'type':Sequelize[_0x3887('0x0')]},'callington':{'type':Sequelize[_0x3887('0x0')]},'callingtns':{'type':Sequelize[_0x3887('0x0')]},'dnid':{'type':Sequelize[_0x3887('0x0')]},'rdnis':{'type':Sequelize[_0x3887('0x0')]},'context':{'type':Sequelize[_0x3887('0x0')]},'extension':{'type':Sequelize[_0x3887('0x0')]},'priority':{'type':Sequelize[_0x3887('0x0')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3887('0x0')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3887('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 32f544a..4c4c3b9 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 _0x7cc5=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SquareReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','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','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x47756d,_0x417eda){var _0x245985=function(_0x3123b0){while(--_0x3123b0){_0x47756d['push'](_0x47756d['shift']());}};_0x245985(++_0x417eda);}(_0x7cc5,0x18d));var _0x57cc=function(_0x21e31e,_0x451faf){_0x21e31e=_0x21e31e-0x0;var _0x3e5b20=_0x7cc5[_0x21e31e];return _0x3e5b20;};'use strict';var pdf=require(_0x57cc('0x0'));var emlformat=require(_0x57cc('0x1'));var rimraf=require(_0x57cc('0x2'));var zipdir=require(_0x57cc('0x3'));var jsonpatch=require(_0x57cc('0x4'));var rp=require('request-promise');var moment=require(_0x57cc('0x5'));var BPromise=require(_0x57cc('0x6'));var Mustache=require(_0x57cc('0x7'));var util=require('util');var path=require(_0x57cc('0x8'));var sox=require(_0x57cc('0x9'));var csv=require(_0x57cc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x57cc('0xb'));var squel=require(_0x57cc('0xc'));var crypto=require(_0x57cc('0xd'));var jsforce=require(_0x57cc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x57cc('0xa'));var querystring=require('querystring');var Papa=require(_0x57cc('0xf'));var Redis=require(_0x57cc('0x10'));var authService=require(_0x57cc('0x11'));var qs=require(_0x57cc('0x12'));var as=require(_0x57cc('0x13'));var hardwareService=require(_0x57cc('0x14'));var logger=require(_0x57cc('0x15'))(_0x57cc('0x16'));var utils=require('../../config/utils');var config=require(_0x57cc('0x17'));var db=require(_0x57cc('0x18'))['db'];function respondWithStatusCode(_0x8ba422,_0x444d7e){_0x444d7e=_0x444d7e||0xcc;return function(_0x499960){if(_0x499960){return _0x8ba422[_0x57cc('0x19')](_0x444d7e);}return _0x8ba422[_0x57cc('0x1a')](_0x444d7e)[_0x57cc('0x1b')]();};}function respondWithResult(_0x5d95c1,_0x3530f7){_0x3530f7=_0x3530f7||0xc8;return function(_0x19e828){if(_0x19e828){return _0x5d95c1[_0x57cc('0x1a')](_0x3530f7)[_0x57cc('0x1c')](_0x19e828);}};}function respondWithFilteredResult(_0x2bfdaf,_0x1b0938){return function(_0x35c27f){if(_0x35c27f){var _0x2dbfbb=_0x35c27f[_0x57cc('0x1d')],_0x3a540f=_0x1b0938[_0x57cc('0x1e')],_0x1f2814=_0x1b0938[_0x57cc('0x1e')]+_0x1b0938[_0x57cc('0x1f')],_0xe718b;if(_0x1f2814>=_0x2dbfbb){_0x1f2814=_0x2dbfbb;_0xe718b=0xc8;}else{_0xe718b=0xce;}_0x2bfdaf['status'](_0xe718b);return _0x2bfdaf['set'](_0x57cc('0x20'),_0x3a540f+'-'+_0x1f2814+'/'+_0x2dbfbb)[_0x57cc('0x1c')](_0x35c27f);}return null;};}function patchUpdates(_0x1e8e4a){return function(_0x131c47){try{jsonpatch[_0x57cc('0x21')](_0x131c47,_0x1e8e4a,!![]);}catch(_0x4cb614){return BPromise[_0x57cc('0x22')](_0x4cb614);}return _0x131c47[_0x57cc('0x23')]();};}function saveUpdates(_0x2b3611,_0x46cdae){return function(_0x556bc1){if(_0x556bc1){return _0x556bc1[_0x57cc('0x24')](_0x2b3611)[_0x57cc('0x25')](function(_0x1b07b1){return _0x1b07b1;});}return null;};}function removeEntity(_0x42d3e7,_0x991848){return function(_0x115637){if(_0x115637){return _0x115637['destroy']()[_0x57cc('0x25')](function(){_0x42d3e7[_0x57cc('0x1a')](0xcc)[_0x57cc('0x1b')]();});}};}function handleEntityNotFound(_0x2baebc,_0x195e5e){return function(_0x4dd410){if(!_0x4dd410){_0x2baebc[_0x57cc('0x19')](0x194);}return _0x4dd410;};}function handleError(_0xea9215,_0x1b5544){_0x1b5544=_0x1b5544||0x1f4;return function(_0x364451){logger[_0x57cc('0x26')](_0x364451[_0x57cc('0x27')]);if(_0x364451['name']){delete _0x364451[_0x57cc('0x28')];}_0xea9215['status'](_0x1b5544)[_0x57cc('0x29')](_0x364451);};}exports[_0x57cc('0x2a')]=function(_0x36b1da,_0xa14c1b){var _0x995d24={},_0x52aa39={},_0x189c4d={'count':0x0,'rows':[]};var _0x33460c=_[_0x57cc('0x2b')](db['SquareReport'][_0x57cc('0x2c')],function(_0x3c0203){return{'name':_0x3c0203['fieldName'],'type':_0x3c0203['type']['key']};});_0x52aa39[_0x57cc('0x2d')]=_[_0x57cc('0x2b')](_0x33460c,_0x57cc('0x28'));_0x52aa39[_0x57cc('0x2e')]=_[_0x57cc('0x2f')](_0x36b1da[_0x57cc('0x2e')]);_0x52aa39[_0x57cc('0x30')]=_[_0x57cc('0x31')](_0x52aa39['model'],_0x52aa39[_0x57cc('0x2e')]);_0x995d24[_0x57cc('0x32')]=_[_0x57cc('0x31')](_0x52aa39[_0x57cc('0x2d')],qs[_0x57cc('0x33')](_0x36b1da[_0x57cc('0x2e')][_0x57cc('0x33')]));_0x995d24['attributes']=_0x995d24[_0x57cc('0x32')][_0x57cc('0x34')]?_0x995d24[_0x57cc('0x32')]:_0x52aa39[_0x57cc('0x2d')];if(!_0x36b1da[_0x57cc('0x2e')]['hasOwnProperty'](_0x57cc('0x35'))){_0x995d24[_0x57cc('0x1f')]=qs[_0x57cc('0x1f')](_0x36b1da[_0x57cc('0x2e')][_0x57cc('0x1f')]);_0x995d24[_0x57cc('0x1e')]=qs[_0x57cc('0x1e')](_0x36b1da[_0x57cc('0x2e')][_0x57cc('0x1e')]);}_0x995d24[_0x57cc('0x36')]=qs['sort'](_0x36b1da['query'][_0x57cc('0x37')]);_0x995d24['where']=qs[_0x57cc('0x30')](_[_0x57cc('0x38')](_0x36b1da['query'],_0x52aa39[_0x57cc('0x30')]),_0x33460c);if(_0x36b1da['query'][_0x57cc('0x39')]){_0x995d24[_0x57cc('0x3a')]=_[_0x57cc('0x3b')](_0x995d24[_0x57cc('0x3a')],{'$or':_['map'](_0x33460c,function(_0x201d7c){if(_0x201d7c['type']!==_0x57cc('0x3c')){var _0x58b0a6={};_0x58b0a6[_0x201d7c['name']]={'$like':'%'+_0x36b1da[_0x57cc('0x2e')]['filter']+'%'};return _0x58b0a6;}})});}_0x995d24=_['merge']({},_0x995d24,_0x36b1da[_0x57cc('0x3d')]);var _0x599dff={'where':_0x995d24[_0x57cc('0x3a')]};return db[_0x57cc('0x3e')][_0x57cc('0x1d')](_0x599dff)[_0x57cc('0x25')](function(_0x18ee67){_0x189c4d[_0x57cc('0x1d')]=_0x18ee67;if(_0x36b1da[_0x57cc('0x2e')][_0x57cc('0x3f')]){_0x995d24['include']=[{'all':!![]}];}return db['SquareReport'][_0x57cc('0x40')](_0x995d24);})[_0x57cc('0x25')](function(_0x3f1cc1){_0x189c4d[_0x57cc('0x41')]=_0x3f1cc1;return _0x189c4d;})[_0x57cc('0x25')](respondWithFilteredResult(_0xa14c1b,_0x995d24))[_0x57cc('0x42')](handleError(_0xa14c1b,null));};exports[_0x57cc('0x43')]=function(_0x509068,_0x14fc30){var _0x1e6477={'raw':!![],'where':{'id':_0x509068[_0x57cc('0x44')]['id']}},_0xf93995={};_0xf93995['model']=_['keys'](db[_0x57cc('0x3e')][_0x57cc('0x2c')]);_0xf93995[_0x57cc('0x2e')]=_[_0x57cc('0x2f')](_0x509068[_0x57cc('0x2e')]);_0xf93995[_0x57cc('0x30')]=_[_0x57cc('0x31')](_0xf93995['model'],_0xf93995['query']);_0x1e6477[_0x57cc('0x32')]=_[_0x57cc('0x31')](_0xf93995[_0x57cc('0x2d')],qs[_0x57cc('0x33')](_0x509068[_0x57cc('0x2e')]['fields']));_0x1e6477[_0x57cc('0x32')]=_0x1e6477[_0x57cc('0x32')][_0x57cc('0x34')]?_0x1e6477[_0x57cc('0x32')]:_0xf93995[_0x57cc('0x2d')];if(_0x509068[_0x57cc('0x2e')][_0x57cc('0x3f')]){_0x1e6477[_0x57cc('0x45')]=[{'all':!![]}];}_0x1e6477=_['merge']({},_0x1e6477,_0x509068[_0x57cc('0x3d')]);return db[_0x57cc('0x3e')][_0x57cc('0x46')](_0x1e6477)[_0x57cc('0x25')](handleEntityNotFound(_0x14fc30,null))['then'](respondWithResult(_0x14fc30,null))[_0x57cc('0x42')](handleError(_0x14fc30,null));};exports[_0x57cc('0x47')]=function(_0x5c7531,_0x13c47c){return db['SquareReport'][_0x57cc('0x47')](_0x5c7531['body'],{})[_0x57cc('0x25')](respondWithResult(_0x13c47c,0xc9))[_0x57cc('0x42')](handleError(_0x13c47c,null));};exports[_0x57cc('0x24')]=function(_0x57bbbc,_0x48d5bd){if(_0x57bbbc[_0x57cc('0x48')]['id']){delete _0x57bbbc['body']['id'];}return db[_0x57cc('0x3e')][_0x57cc('0x46')]({'where':{'id':_0x57bbbc['params']['id']}})['then'](handleEntityNotFound(_0x48d5bd,null))[_0x57cc('0x25')](saveUpdates(_0x57bbbc[_0x57cc('0x48')],null))[_0x57cc('0x25')](respondWithResult(_0x48d5bd,null))[_0x57cc('0x42')](handleError(_0x48d5bd,null));};exports[_0x57cc('0x49')]=function(_0x4a7ad1,_0x316e63){return db[_0x57cc('0x3e')][_0x57cc('0x46')]({'where':{'id':_0x4a7ad1[_0x57cc('0x44')]['id']}})[_0x57cc('0x25')](handleEntityNotFound(_0x316e63,null))[_0x57cc('0x25')](removeEntity(_0x316e63,null))[_0x57cc('0x42')](handleError(_0x316e63,null));};exports['describe']=function(_0x45b9d5,_0x97bd4b){return db[_0x57cc('0x3e')][_0x57cc('0x4a')]()[_0x57cc('0x25')](respondWithResult(_0x97bd4b,null))[_0x57cc('0x42')](handleError(_0x97bd4b,null));}; \ No newline at end of file +var _0xead5=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','findAll','catch','params','filters','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4ca536,_0x57c8de){var _0x3bd35f=function(_0x26d91d){while(--_0x26d91d){_0x4ca536['push'](_0x4ca536['shift']());}};_0x3bd35f(++_0x57c8de);}(_0xead5,0xce));var _0x5ead=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0xead5[_0x8c1005];return _0x175354;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5ead('0x0'));var rimraf=require(_0x5ead('0x1'));var zipdir=require(_0x5ead('0x2'));var jsonpatch=require(_0x5ead('0x3'));var rp=require(_0x5ead('0x4'));var moment=require(_0x5ead('0x5'));var BPromise=require(_0x5ead('0x6'));var Mustache=require(_0x5ead('0x7'));var util=require(_0x5ead('0x8'));var path=require(_0x5ead('0x9'));var sox=require('sox');var csv=require(_0x5ead('0xa'));var ejs=require(_0x5ead('0xb'));var fs=require('fs');var _=require(_0x5ead('0xc'));var squel=require(_0x5ead('0xd'));var crypto=require(_0x5ead('0xe'));var jsforce=require(_0x5ead('0xf'));var deskjs=require(_0x5ead('0x10'));var toCsv=require(_0x5ead('0xa'));var querystring=require(_0x5ead('0x11'));var Papa=require(_0x5ead('0x12'));var Redis=require(_0x5ead('0x13'));var authService=require(_0x5ead('0x14'));var qs=require(_0x5ead('0x15'));var as=require(_0x5ead('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5ead('0x17'));var utils=require(_0x5ead('0x18'));var config=require(_0x5ead('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ccbd6,_0x3ddad6){_0x3ddad6=_0x3ddad6||0xcc;return function(_0x1a54f4){if(_0x1a54f4){return _0x4ccbd6[_0x5ead('0x1a')](_0x3ddad6);}return _0x4ccbd6[_0x5ead('0x1b')](_0x3ddad6)['end']();};}function respondWithResult(_0xec4010,_0x27095e){_0x27095e=_0x27095e||0xc8;return function(_0x3922e6){if(_0x3922e6){return _0xec4010[_0x5ead('0x1b')](_0x27095e)[_0x5ead('0x1c')](_0x3922e6);}};}function respondWithFilteredResult(_0x44a99d,_0x3fb79f){return function(_0x1b6f41){if(_0x1b6f41){var _0x2bab1c=_0x1b6f41[_0x5ead('0x1d')],_0x2a6152=_0x3fb79f[_0x5ead('0x1e')],_0x5a759c=_0x3fb79f[_0x5ead('0x1e')]+_0x3fb79f[_0x5ead('0x1f')],_0x112f8f;if(_0x5a759c>=_0x2bab1c){_0x5a759c=_0x2bab1c;_0x112f8f=0xc8;}else{_0x112f8f=0xce;}_0x44a99d[_0x5ead('0x1b')](_0x112f8f);return _0x44a99d[_0x5ead('0x20')](_0x5ead('0x21'),_0x2a6152+'-'+_0x5a759c+'/'+_0x2bab1c)[_0x5ead('0x1c')](_0x1b6f41);}return null;};}function patchUpdates(_0x14d7a0){return function(_0x39ca3c){try{jsonpatch[_0x5ead('0x22')](_0x39ca3c,_0x14d7a0,!![]);}catch(_0x1ce51f){return BPromise[_0x5ead('0x23')](_0x1ce51f);}return _0x39ca3c[_0x5ead('0x24')]();};}function saveUpdates(_0x457c3a,_0x2674df){return function(_0x3cd5a0){if(_0x3cd5a0){return _0x3cd5a0[_0x5ead('0x25')](_0x457c3a)['then'](function(_0x27d23f){return _0x27d23f;});}return null;};}function removeEntity(_0x4e7da7,_0x1e5aca){return function(_0x1367f3){if(_0x1367f3){return _0x1367f3[_0x5ead('0x26')]()[_0x5ead('0x27')](function(){_0x4e7da7[_0x5ead('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f6d8d,_0x3aa8cc){return function(_0x46223d){if(!_0x46223d){_0x4f6d8d['sendStatus'](0x194);}return _0x46223d;};}function handleError(_0x16532f,_0x33cffd){_0x33cffd=_0x33cffd||0x1f4;return function(_0x3b83b3){logger[_0x5ead('0x28')](_0x3b83b3[_0x5ead('0x29')]);if(_0x3b83b3[_0x5ead('0x2a')]){delete _0x3b83b3[_0x5ead('0x2a')];}_0x16532f[_0x5ead('0x1b')](_0x33cffd)[_0x5ead('0x2b')](_0x3b83b3);};}exports[_0x5ead('0x2c')]=function(_0x58ce9e,_0x26461c){var _0x676fbf={},_0x3ee343={},_0x59a4aa={'count':0x0,'rows':[]};var _0x187914=_[_0x5ead('0x2d')](db[_0x5ead('0x2e')][_0x5ead('0x2f')],function(_0x5bc8f7){return{'name':_0x5bc8f7['fieldName'],'type':_0x5bc8f7[_0x5ead('0x30')][_0x5ead('0x31')]};});_0x3ee343[_0x5ead('0x32')]=_[_0x5ead('0x2d')](_0x187914,_0x5ead('0x2a'));_0x3ee343['query']=_[_0x5ead('0x33')](_0x58ce9e[_0x5ead('0x34')]);_0x3ee343['filters']=_[_0x5ead('0x35')](_0x3ee343[_0x5ead('0x32')],_0x3ee343[_0x5ead('0x34')]);_0x676fbf[_0x5ead('0x36')]=_[_0x5ead('0x35')](_0x3ee343[_0x5ead('0x32')],qs[_0x5ead('0x37')](_0x58ce9e['query'][_0x5ead('0x37')]));_0x676fbf[_0x5ead('0x36')]=_0x676fbf[_0x5ead('0x36')][_0x5ead('0x38')]?_0x676fbf[_0x5ead('0x36')]:_0x3ee343[_0x5ead('0x32')];if(!_0x58ce9e['query'][_0x5ead('0x39')](_0x5ead('0x3a'))){_0x676fbf['limit']=qs[_0x5ead('0x1f')](_0x58ce9e[_0x5ead('0x34')]['limit']);_0x676fbf['offset']=qs[_0x5ead('0x1e')](_0x58ce9e['query'][_0x5ead('0x1e')]);}_0x676fbf[_0x5ead('0x3b')]=qs['sort'](_0x58ce9e[_0x5ead('0x34')]['sort']);_0x676fbf[_0x5ead('0x3c')]=qs['filters'](_[_0x5ead('0x3d')](_0x58ce9e[_0x5ead('0x34')],_0x3ee343['filters']),_0x187914);if(_0x58ce9e[_0x5ead('0x34')][_0x5ead('0x3e')]){_0x676fbf[_0x5ead('0x3c')]=_['merge'](_0x676fbf['where'],{'$or':_[_0x5ead('0x2d')](_0x187914,function(_0x3348ea){if(_0x3348ea[_0x5ead('0x30')]!==_0x5ead('0x3f')){var _0x56c599={};_0x56c599[_0x3348ea[_0x5ead('0x2a')]]={'$like':'%'+_0x58ce9e[_0x5ead('0x34')][_0x5ead('0x3e')]+'%'};return _0x56c599;}})});}_0x676fbf=_['merge']({},_0x676fbf,_0x58ce9e[_0x5ead('0x40')]);var _0x426b04={'where':_0x676fbf[_0x5ead('0x3c')]};return db[_0x5ead('0x2e')][_0x5ead('0x1d')](_0x426b04)[_0x5ead('0x27')](function(_0x7ef1e2){_0x59a4aa['count']=_0x7ef1e2;if(_0x58ce9e[_0x5ead('0x34')][_0x5ead('0x41')]){_0x676fbf['include']=[{'all':!![]}];}return db[_0x5ead('0x2e')][_0x5ead('0x42')](_0x676fbf);})[_0x5ead('0x27')](function(_0x1a2f6e){_0x59a4aa['rows']=_0x1a2f6e;return _0x59a4aa;})[_0x5ead('0x27')](respondWithFilteredResult(_0x26461c,_0x676fbf))[_0x5ead('0x43')](handleError(_0x26461c,null));};exports['show']=function(_0x1e0f18,_0x58949b){var _0x163182={'raw':!![],'where':{'id':_0x1e0f18[_0x5ead('0x44')]['id']}},_0x1b4101={};_0x1b4101[_0x5ead('0x32')]=_[_0x5ead('0x33')](db['SquareReport'][_0x5ead('0x2f')]);_0x1b4101[_0x5ead('0x34')]=_['keys'](_0x1e0f18[_0x5ead('0x34')]);_0x1b4101[_0x5ead('0x45')]=_[_0x5ead('0x35')](_0x1b4101[_0x5ead('0x32')],_0x1b4101['query']);_0x163182[_0x5ead('0x36')]=_[_0x5ead('0x35')](_0x1b4101[_0x5ead('0x32')],qs[_0x5ead('0x37')](_0x1e0f18[_0x5ead('0x34')][_0x5ead('0x37')]));_0x163182['attributes']=_0x163182[_0x5ead('0x36')]['length']?_0x163182[_0x5ead('0x36')]:_0x1b4101[_0x5ead('0x32')];if(_0x1e0f18[_0x5ead('0x34')][_0x5ead('0x41')]){_0x163182[_0x5ead('0x46')]=[{'all':!![]}];}_0x163182=_['merge']({},_0x163182,_0x1e0f18['options']);return db[_0x5ead('0x2e')][_0x5ead('0x47')](_0x163182)[_0x5ead('0x27')](handleEntityNotFound(_0x58949b,null))[_0x5ead('0x27')](respondWithResult(_0x58949b,null))[_0x5ead('0x43')](handleError(_0x58949b,null));};exports[_0x5ead('0x48')]=function(_0x305c5d,_0x3bf6b3){return db[_0x5ead('0x2e')][_0x5ead('0x48')](_0x305c5d['body'],{})[_0x5ead('0x27')](respondWithResult(_0x3bf6b3,0xc9))['catch'](handleError(_0x3bf6b3,null));};exports['update']=function(_0xe18c59,_0x24ed7b){if(_0xe18c59[_0x5ead('0x49')]['id']){delete _0xe18c59['body']['id'];}return db[_0x5ead('0x2e')][_0x5ead('0x47')]({'where':{'id':_0xe18c59[_0x5ead('0x44')]['id']}})[_0x5ead('0x27')](handleEntityNotFound(_0x24ed7b,null))[_0x5ead('0x27')](saveUpdates(_0xe18c59[_0x5ead('0x49')],null))['then'](respondWithResult(_0x24ed7b,null))[_0x5ead('0x43')](handleError(_0x24ed7b,null));};exports['destroy']=function(_0x4c1624,_0x1b7027){return db[_0x5ead('0x2e')][_0x5ead('0x47')]({'where':{'id':_0x4c1624[_0x5ead('0x44')]['id']}})[_0x5ead('0x27')](handleEntityNotFound(_0x1b7027,null))[_0x5ead('0x27')](removeEntity(_0x1b7027,null))[_0x5ead('0x43')](handleError(_0x1b7027,null));};exports[_0x5ead('0x4a')]=function(_0x25eefb,_0x5209c9){return db[_0x5ead('0x2e')][_0x5ead('0x4a')]()[_0x5ead('0x27')](respondWithResult(_0x5209c9,null))[_0x5ead('0x43')](handleError(_0x5209c9,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 2ddd164..e818bfb 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 _0x9804=['./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','moment','rimraf'];(function(_0x3a091f,_0x320915){var _0xd7413a=function(_0x19a6af){while(--_0x19a6af){_0x3a091f['push'](_0x3a091f['shift']());}};_0xd7413a(++_0x320915);}(_0x9804,0x1ab));var _0x4980=function(_0x9a62de,_0x127f28){_0x9a62de=_0x9a62de-0x0;var _0x14d7b3=_0x9804[_0x9a62de];return _0x14d7b3;};'use strict';var _=require(_0x4980('0x0'));var util=require(_0x4980('0x1'));var logger=require(_0x4980('0x2'))('api');var moment=require(_0x4980('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4980('0x4'));var config=require('../../config/environment');var attributes=require(_0x4980('0x5'));module['exports']=function(_0x137676,_0x370b63){return _0x137676[_0x4980('0x6')](_0x4980('0x7'),attributes,{'tableName':_0x4980('0x8'),'paranoid':![],'indexes':[{'name':_0x4980('0x9'),'fields':[_0x4980('0xa'),'project_name']},{'name':_0x4980('0xb'),'fields':[_0x4980('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x598c=['exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5adf5a,_0x290d54){var _0x35cb7f=function(_0x443c7c){while(--_0x443c7c){_0x5adf5a['push'](_0x5adf5a['shift']());}};_0x35cb7f(++_0x290d54);}(_0x598c,0xb7));var _0xc598=function(_0x3a6e53,_0x46c98c){_0x3a6e53=_0x3a6e53-0x0;var _0x2c63cc=_0x598c[_0x3a6e53];return _0x2c63cc;};'use strict';var _=require(_0xc598('0x0'));var util=require(_0xc598('0x1'));var logger=require(_0xc598('0x2'))(_0xc598('0x3'));var moment=require('moment');var BPromise=require(_0xc598('0x4'));var rp=require(_0xc598('0x5'));var fs=require('fs');var path=require(_0xc598('0x6'));var rimraf=require(_0xc598('0x7'));var config=require(_0xc598('0x8'));var attributes=require('./squareReport.attributes');module[_0xc598('0x9')]=function(_0x1564a1,_0x531516){return _0x1564a1[_0xc598('0xa')](_0xc598('0xb'),attributes,{'tableName':_0xc598('0xc'),'paranoid':![],'indexes':[{'name':_0xc598('0xd'),'fields':['uniqueid',_0xc598('0xe')]},{'name':_0xc598('0xf'),'fields':[_0xc598('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index f486505..5a6d816 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 _0x98bb=['then','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','where','limit','debug','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x48c886,_0x42607a){var _0x24a99c=function(_0x154743){while(--_0x154743){_0x48c886['push'](_0x48c886['shift']());}};_0x24a99c(++_0x42607a);}(_0x98bb,0x1d5));var _0xb98b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x98bb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb98b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb98b('0x1'));var rs=require(_0xb98b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb98b('0x3'));var logger=require(_0xb98b('0x4'))(_0xb98b('0x5'));var config=require(_0xb98b('0x6'));var jayson=require(_0xb98b('0x7'));var client=jayson[_0xb98b('0x8')][_0xb98b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4730cf,_0x1322ae,_0x4ad331){return new BPromise(function(_0x1ed2a2,_0x4b29d5){return client[_0xb98b('0xa')](_0x4730cf,_0x4ad331)[_0xb98b('0xb')](function(_0x4db0ff){logger[_0xb98b('0xc')](_0xb98b('0xd'),_0x1322ae,'request\x20sent');logger['debug'](_0xb98b('0xe'),_0x1322ae,'request\x20sent',JSON[_0xb98b('0xf')](_0x4db0ff));if(_0x4db0ff[_0xb98b('0x10')]){if(_0x4db0ff['error'][_0xb98b('0x11')]===0x1f4){logger[_0xb98b('0x10')](_0xb98b('0xd'),_0x1322ae,_0x4db0ff['error']['message']);return _0x4b29d5(_0x4db0ff[_0xb98b('0x10')]['message']);}logger[_0xb98b('0x10')](_0xb98b('0xd'),_0x1322ae,_0x4db0ff['error'][_0xb98b('0x12')]);return _0x1ed2a2(_0x4db0ff[_0xb98b('0x10')][_0xb98b('0x12')]);}else{logger[_0xb98b('0xc')](_0xb98b('0xd'),_0x1322ae,'request\x20sent');_0x1ed2a2(_0x4db0ff[_0xb98b('0x13')][_0xb98b('0x12')]);}})['catch'](function(_0x119895){logger[_0xb98b('0x10')](_0xb98b('0xd'),_0x1322ae,_0x119895);_0x4b29d5(_0x119895);});});}exports[_0xb98b('0x14')]=function(_0x19762f){var _0xb75ba6=this;return new Promise(function(_0x327758,_0x4771f4){return db[_0xb98b('0x15')][_0xb98b('0x16')](_0x19762f[_0xb98b('0x17')],{'raw':_0x19762f[_0xb98b('0x18')]?_0x19762f[_0xb98b('0x18')][_0xb98b('0x19')]===undefined?!![]:![]:!![]})[_0xb98b('0xb')](function(_0x35b08d){logger[_0xb98b('0xc')]('CreateSquareReport',_0x19762f);logger['debug'](_0xb98b('0x14'),_0x19762f,JSON[_0xb98b('0xf')](_0x35b08d));_0x327758(_0x35b08d);})[_0xb98b('0x1a')](function(_0xe7a511){logger[_0xb98b('0x10')](_0xb98b('0x14'),_0xe7a511['message'],_0x19762f);_0x4771f4(_0xb75ba6[_0xb98b('0x10')](0x1f4,_0xe7a511[_0xb98b('0x12')]));});});};exports[_0xb98b('0x1b')]=function(_0x426b67){var _0x151e0f=this;return new Promise(function(_0x18bb38,_0xcffacc){return db[_0xb98b('0x15')][_0xb98b('0x1c')](_0x426b67[_0xb98b('0x17')],{'raw':_0x426b67[_0xb98b('0x18')]?_0x426b67[_0xb98b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x426b67['options']?_0x426b67[_0xb98b('0x18')][_0xb98b('0x1d')]||null:null,'attributes':_0x426b67[_0xb98b('0x18')]?_0x426b67[_0xb98b('0x18')]['attributes']||null:null,'limit':_0x426b67[_0xb98b('0x18')]?_0x426b67[_0xb98b('0x18')][_0xb98b('0x1e')]||null:null})[_0xb98b('0xb')](function(_0x101853){logger[_0xb98b('0xc')](_0xb98b('0x1b'),_0x426b67);logger[_0xb98b('0x1f')]('UpdateSquareReport',_0x426b67,JSON[_0xb98b('0xf')](_0x101853));_0x18bb38(_0x101853);})[_0xb98b('0x1a')](function(_0x2032b7){logger['error'](_0xb98b('0x1b'),_0x2032b7['message'],_0x426b67);_0xcffacc(_0x151e0f['error'](0x1f4,_0x2032b7['message']));});});}; \ No newline at end of file +var _0x35b1=['options','raw','CreateSquareReport','UpdateSquareReport','update','where','attributes','limit','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareReport','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35b1,0x111));var _0x135b=function(_0x56500a,_0x5953c7){_0x56500a=_0x56500a-0x0;var _0x333977=_0x35b1[_0x56500a];return _0x333977;};'use strict';var _=require(_0x135b('0x0'));var util=require(_0x135b('0x1'));var moment=require('moment');var BPromise=require(_0x135b('0x2'));var rs=require(_0x135b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x135b('0x4'))['db'];var utils=require(_0x135b('0x5'));var logger=require(_0x135b('0x6'))(_0x135b('0x7'));var config=require(_0x135b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x135b('0x9')][_0x135b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x399e90,_0x1ad75d,_0x1b3c60){return new BPromise(function(_0xcb0912,_0x27e454){return client[_0x135b('0xb')](_0x399e90,_0x1b3c60)[_0x135b('0xc')](function(_0x2d1068){logger[_0x135b('0xd')](_0x135b('0xe'),_0x1ad75d,_0x135b('0xf'));logger['debug'](_0x135b('0x10'),_0x1ad75d,_0x135b('0xf'),JSON[_0x135b('0x11')](_0x2d1068));if(_0x2d1068[_0x135b('0x12')]){if(_0x2d1068[_0x135b('0x12')][_0x135b('0x13')]===0x1f4){logger['error'](_0x135b('0xe'),_0x1ad75d,_0x2d1068['error'][_0x135b('0x14')]);return _0x27e454(_0x2d1068[_0x135b('0x12')][_0x135b('0x14')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x1ad75d,_0x2d1068['error']['message']);return _0xcb0912(_0x2d1068[_0x135b('0x12')]['message']);}else{logger[_0x135b('0xd')](_0x135b('0xe'),_0x1ad75d,_0x135b('0xf'));_0xcb0912(_0x2d1068['result'][_0x135b('0x14')]);}})[_0x135b('0x15')](function(_0x19e24a){logger[_0x135b('0x12')](_0x135b('0xe'),_0x1ad75d,_0x19e24a);_0x27e454(_0x19e24a);});});}exports['CreateSquareReport']=function(_0x53f55e){var _0x321efa=this;return new Promise(function(_0x337f24,_0x250f6f){return db[_0x135b('0x16')]['create'](_0x53f55e[_0x135b('0x17')],{'raw':_0x53f55e[_0x135b('0x18')]?_0x53f55e['options'][_0x135b('0x19')]===undefined?!![]:![]:!![]})[_0x135b('0xc')](function(_0x54db12){logger[_0x135b('0xd')]('CreateSquareReport',_0x53f55e);logger['debug'](_0x135b('0x1a'),_0x53f55e,JSON[_0x135b('0x11')](_0x54db12));_0x337f24(_0x54db12);})[_0x135b('0x15')](function(_0x268219){logger[_0x135b('0x12')](_0x135b('0x1a'),_0x268219[_0x135b('0x14')],_0x53f55e);_0x250f6f(_0x321efa[_0x135b('0x12')](0x1f4,_0x268219[_0x135b('0x14')]));});});};exports[_0x135b('0x1b')]=function(_0x80f9a8){var _0x201918=this;return new Promise(function(_0x459e57,_0xe82c60){return db[_0x135b('0x16')][_0x135b('0x1c')](_0x80f9a8['body'],{'raw':_0x80f9a8[_0x135b('0x18')]?_0x80f9a8[_0x135b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x80f9a8[_0x135b('0x18')]?_0x80f9a8[_0x135b('0x18')][_0x135b('0x1d')]||null:null,'attributes':_0x80f9a8[_0x135b('0x18')]?_0x80f9a8['options'][_0x135b('0x1e')]||null:null,'limit':_0x80f9a8[_0x135b('0x18')]?_0x80f9a8[_0x135b('0x18')][_0x135b('0x1f')]||null:null})[_0x135b('0xc')](function(_0x8c0eca){logger[_0x135b('0xd')](_0x135b('0x1b'),_0x80f9a8);logger[_0x135b('0x20')](_0x135b('0x1b'),_0x80f9a8,JSON[_0x135b('0x11')](_0x8c0eca));_0x459e57(_0x8c0eca);})[_0x135b('0x15')](function(_0x376433){logger['error'](_0x135b('0x1b'),_0x376433[_0x135b('0x14')],_0x80f9a8);_0xe82c60(_0x201918[_0x135b('0x12')](0x1f4,_0x376433[_0x135b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 70d2568..1f206f2 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(_0x521258,_0x25ff14){var _0x4abddf=function(_0x5a81d9){while(--_0x5a81d9){_0x521258['push'](_0x521258['shift']());}};_0x4abddf(++_0x25ff14);}(_0x7a54,0x106));var _0x47a5=function(_0x2b533b,_0x59e41f){_0x2b533b=_0x2b533b-0x0;var _0x204c55=_0x7a54[_0x2b533b];return _0x204c55;};'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 _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x814b,0x1a2));var _0xb814=function(_0x16e9b5,_0x192142){_0x16e9b5=_0x16e9b5-0x0;var _0x206df0=_0x814b[_0x16e9b5];return _0x206df0;};'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['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index b609459..7a891b8 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 _0x6765=['STRING','TEXT','sequelize','exports'];(function(_0x192e7e,_0x4b446e){var _0x15205c=function(_0x4c30d1){while(--_0x4c30d1){_0x192e7e['push'](_0x192e7e['shift']());}};_0x15205c(++_0x4b446e);}(_0x6765,0x13a));var _0x5676=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x6765[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x5676('0x0'));module[_0x5676('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x5676('0x2')]},'application':{'type':Sequelize[_0x5676('0x2')]},'data':{'type':Sequelize[_0x5676('0x3')]},'project_name':{'type':Sequelize[_0x5676('0x2')]},'callerid':{'type':Sequelize[_0x5676('0x2')]}}; \ No newline at end of file +var _0x43f9=['STRING','TEXT','sequelize','exports'];(function(_0x2a11ec,_0x477d22){var _0x4bfd96=function(_0x4d09dc){while(--_0x4d09dc){_0x2a11ec['push'](_0x2a11ec['shift']());}};_0x4bfd96(++_0x477d22);}(_0x43f9,0x13e));var _0x943f=function(_0x2e5a94,_0x21870a){_0x2e5a94=_0x2e5a94-0x0;var _0x85f77f=_0x43f9[_0x2e5a94];return _0x85f77f;};'use strict';var Sequelize=require(_0x943f('0x0'));module[_0x943f('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x943f('0x2')]},'data':{'type':Sequelize[_0x943f('0x3')]},'project_name':{'type':Sequelize[_0x943f('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 86d0120..f760863 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 _0x1e4d=['rimraf','fast-json-patch','request-promise','util','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','SquareDetailsReport','rawAttributes','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','order','where','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','describe','html-pdf'];(function(_0xbb3935,_0x4fedd4){var _0x1d0806=function(_0x2c6611){while(--_0x2c6611){_0xbb3935['push'](_0xbb3935['shift']());}};_0x1d0806(++_0x4fedd4);}(_0x1e4d,0xfb));var _0xd1e4=function(_0xf72b47,_0x4596ee){_0xf72b47=_0xf72b47-0x0;var _0xd69d2d=_0x1e4d[_0xf72b47];return _0xd69d2d;};'use strict';var pdf=require(_0xd1e4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd1e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1e4('0x2'));var rp=require(_0xd1e4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd1e4('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xd1e4('0x5'));var ejs=require(_0xd1e4('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd1e4('0x7'));var deskjs=require(_0xd1e4('0x8'));var toCsv=require(_0xd1e4('0x5'));var querystring=require(_0xd1e4('0x9'));var Papa=require('papaparse');var Redis=require(_0xd1e4('0xa'));var authService=require('../../components/auth/service');var qs=require(_0xd1e4('0xb'));var as=require(_0xd1e4('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd1e4('0xd'));var utils=require(_0xd1e4('0xe'));var config=require(_0xd1e4('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b1106,_0x3e7235){_0x3e7235=_0x3e7235||0xcc;return function(_0x2f3a94){if(_0x2f3a94){return _0x1b1106['sendStatus'](_0x3e7235);}return _0x1b1106[_0xd1e4('0x10')](_0x3e7235)[_0xd1e4('0x11')]();};}function respondWithResult(_0x347b6f,_0xa514b3){_0xa514b3=_0xa514b3||0xc8;return function(_0x1bdf42){if(_0x1bdf42){return _0x347b6f[_0xd1e4('0x10')](_0xa514b3)[_0xd1e4('0x12')](_0x1bdf42);}};}function respondWithFilteredResult(_0x148f86,_0x40ded7){return function(_0x108b24){if(_0x108b24){var _0x2251a9=_0x108b24['count'],_0x31df7b=_0x40ded7[_0xd1e4('0x13')],_0x279504=_0x40ded7[_0xd1e4('0x13')]+_0x40ded7[_0xd1e4('0x14')],_0x25aa89;if(_0x279504>=_0x2251a9){_0x279504=_0x2251a9;_0x25aa89=0xc8;}else{_0x25aa89=0xce;}_0x148f86['status'](_0x25aa89);return _0x148f86[_0xd1e4('0x15')](_0xd1e4('0x16'),_0x31df7b+'-'+_0x279504+'/'+_0x2251a9)['json'](_0x108b24);}return null;};}function patchUpdates(_0x1a8b90){return function(_0xcce5c4){try{jsonpatch[_0xd1e4('0x17')](_0xcce5c4,_0x1a8b90,!![]);}catch(_0x1d265f){return BPromise['reject'](_0x1d265f);}return _0xcce5c4[_0xd1e4('0x18')]();};}function saveUpdates(_0xf6127f,_0x13318f){return function(_0xd81c56){if(_0xd81c56){return _0xd81c56[_0xd1e4('0x19')](_0xf6127f)[_0xd1e4('0x1a')](function(_0xb1ae59){return _0xb1ae59;});}return null;};}function removeEntity(_0x3a953a,_0x5479a9){return function(_0x73416a){if(_0x73416a){return _0x73416a[_0xd1e4('0x1b')]()['then'](function(){_0x3a953a[_0xd1e4('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2decad,_0x333bc8){return function(_0x4c5532){if(!_0x4c5532){_0x2decad[_0xd1e4('0x1c')](0x194);}return _0x4c5532;};}function handleError(_0xc40963,_0x314478){_0x314478=_0x314478||0x1f4;return function(_0x33d494){logger[_0xd1e4('0x1d')](_0x33d494['stack']);if(_0x33d494[_0xd1e4('0x1e')]){delete _0x33d494[_0xd1e4('0x1e')];}_0xc40963[_0xd1e4('0x10')](_0x314478)[_0xd1e4('0x1f')](_0x33d494);};}exports['index']=function(_0xc11dc3,_0x3c2894){var _0x1fc63e={},_0x3eedd1={},_0x5f5dcb={'count':0x0,'rows':[]};var _0x40438a=_['map'](db[_0xd1e4('0x20')][_0xd1e4('0x21')],function(_0x35765e){return{'name':_0x35765e['fieldName'],'type':_0x35765e[_0xd1e4('0x22')][_0xd1e4('0x23')]};});_0x3eedd1['model']=_[_0xd1e4('0x24')](_0x40438a,_0xd1e4('0x1e'));_0x3eedd1['query']=_[_0xd1e4('0x25')](_0xc11dc3['query']);_0x3eedd1[_0xd1e4('0x26')]=_[_0xd1e4('0x27')](_0x3eedd1[_0xd1e4('0x28')],_0x3eedd1[_0xd1e4('0x29')]);_0x1fc63e[_0xd1e4('0x2a')]=_[_0xd1e4('0x27')](_0x3eedd1[_0xd1e4('0x28')],qs[_0xd1e4('0x2b')](_0xc11dc3['query'][_0xd1e4('0x2b')]));_0x1fc63e[_0xd1e4('0x2a')]=_0x1fc63e[_0xd1e4('0x2a')][_0xd1e4('0x2c')]?_0x1fc63e['attributes']:_0x3eedd1[_0xd1e4('0x28')];if(!_0xc11dc3[_0xd1e4('0x29')]['hasOwnProperty']('nolimit')){_0x1fc63e[_0xd1e4('0x14')]=qs['limit'](_0xc11dc3[_0xd1e4('0x29')][_0xd1e4('0x14')]);_0x1fc63e[_0xd1e4('0x13')]=qs[_0xd1e4('0x13')](_0xc11dc3['query']['offset']);}_0x1fc63e[_0xd1e4('0x2d')]=qs['sort'](_0xc11dc3[_0xd1e4('0x29')]['sort']);_0x1fc63e[_0xd1e4('0x2e')]=qs[_0xd1e4('0x26')](_['pick'](_0xc11dc3[_0xd1e4('0x29')],_0x3eedd1[_0xd1e4('0x26')]),_0x40438a);if(_0xc11dc3[_0xd1e4('0x29')]['filter']){_0x1fc63e['where']=_[_0xd1e4('0x2f')](_0x1fc63e[_0xd1e4('0x2e')],{'$or':_[_0xd1e4('0x24')](_0x40438a,function(_0xfbf5ce){if(_0xfbf5ce[_0xd1e4('0x22')]!==_0xd1e4('0x30')){var _0xf415ef={};_0xf415ef[_0xfbf5ce[_0xd1e4('0x1e')]]={'$like':'%'+_0xc11dc3[_0xd1e4('0x29')][_0xd1e4('0x31')]+'%'};return _0xf415ef;}})});}_0x1fc63e=_[_0xd1e4('0x2f')]({},_0x1fc63e,_0xc11dc3['options']);var _0x3852df={'where':_0x1fc63e[_0xd1e4('0x2e')]};return db[_0xd1e4('0x20')][_0xd1e4('0x32')](_0x3852df)[_0xd1e4('0x1a')](function(_0x35c84b){_0x5f5dcb[_0xd1e4('0x32')]=_0x35c84b;if(_0xc11dc3[_0xd1e4('0x29')][_0xd1e4('0x33')]){_0x1fc63e[_0xd1e4('0x34')]=[{'all':!![]}];}return db[_0xd1e4('0x20')][_0xd1e4('0x35')](_0x1fc63e);})[_0xd1e4('0x1a')](function(_0x5f47f2){_0x5f5dcb[_0xd1e4('0x36')]=_0x5f47f2;return _0x5f5dcb;})[_0xd1e4('0x1a')](respondWithFilteredResult(_0x3c2894,_0x1fc63e))[_0xd1e4('0x37')](handleError(_0x3c2894,null));};exports[_0xd1e4('0x38')]=function(_0x6dbeee,_0x90d21f){var _0x173258={'raw':!![],'where':{'id':_0x6dbeee['params']['id']}},_0x3fa877={};_0x3fa877[_0xd1e4('0x28')]=_[_0xd1e4('0x25')](db['SquareDetailsReport'][_0xd1e4('0x21')]);_0x3fa877[_0xd1e4('0x29')]=_[_0xd1e4('0x25')](_0x6dbeee[_0xd1e4('0x29')]);_0x3fa877['filters']=_[_0xd1e4('0x27')](_0x3fa877[_0xd1e4('0x28')],_0x3fa877[_0xd1e4('0x29')]);_0x173258[_0xd1e4('0x2a')]=_[_0xd1e4('0x27')](_0x3fa877[_0xd1e4('0x28')],qs[_0xd1e4('0x2b')](_0x6dbeee[_0xd1e4('0x29')][_0xd1e4('0x2b')]));_0x173258['attributes']=_0x173258[_0xd1e4('0x2a')][_0xd1e4('0x2c')]?_0x173258[_0xd1e4('0x2a')]:_0x3fa877['model'];if(_0x6dbeee[_0xd1e4('0x29')][_0xd1e4('0x33')]){_0x173258[_0xd1e4('0x34')]=[{'all':!![]}];}_0x173258=_['merge']({},_0x173258,_0x6dbeee[_0xd1e4('0x39')]);return db[_0xd1e4('0x20')]['find'](_0x173258)[_0xd1e4('0x1a')](handleEntityNotFound(_0x90d21f,null))['then'](respondWithResult(_0x90d21f,null))[_0xd1e4('0x37')](handleError(_0x90d21f,null));};exports[_0xd1e4('0x3a')]=function(_0x56a739,_0x5bfcf4){return db['SquareDetailsReport'][_0xd1e4('0x3a')](_0x56a739[_0xd1e4('0x3b')],{})['then'](respondWithResult(_0x5bfcf4,0xc9))[_0xd1e4('0x37')](handleError(_0x5bfcf4,null));};exports['update']=function(_0xe4f30d,_0x307eef){if(_0xe4f30d[_0xd1e4('0x3b')]['id']){delete _0xe4f30d[_0xd1e4('0x3b')]['id'];}return db[_0xd1e4('0x20')][_0xd1e4('0x3c')]({'where':{'id':_0xe4f30d[_0xd1e4('0x3d')]['id']}})[_0xd1e4('0x1a')](handleEntityNotFound(_0x307eef,null))[_0xd1e4('0x1a')](saveUpdates(_0xe4f30d['body'],null))[_0xd1e4('0x1a')](respondWithResult(_0x307eef,null))[_0xd1e4('0x37')](handleError(_0x307eef,null));};exports[_0xd1e4('0x1b')]=function(_0xc82bca,_0x5b6ebc){return db['SquareDetailsReport'][_0xd1e4('0x3c')]({'where':{'id':_0xc82bca[_0xd1e4('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5b6ebc,null))[_0xd1e4('0x1a')](removeEntity(_0x5b6ebc,null))[_0xd1e4('0x37')](handleError(_0x5b6ebc,null));};exports[_0xd1e4('0x3e')]=function(_0x5ec6fc,_0x4fe39f){return db[_0xd1e4('0x20')][_0xd1e4('0x3e')]()[_0xd1e4('0x1a')](respondWithResult(_0x4fe39f,null))[_0xd1e4('0x37')](handleError(_0x4fe39f,null));}; \ No newline at end of file +var _0x6e2e=['body','update','destroy','describe','html-pdf','fast-json-patch','request-promise','moment','bluebird','sox','lodash','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','Content-Range','json','apply','reject','save','status','error','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','nolimit','order','pick','filter','where','merge','then','includeAll','findAll','catch','show','params','fields','length','include','options','find','create'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x6e2e,0x13a));var _0xe6e2=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x6e2e[_0x18cd5b];return _0x5eaa52;};'use strict';var pdf=require(_0xe6e2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6e2('0x1'));var rp=require(_0xe6e2('0x2'));var moment=require(_0xe6e2('0x3'));var BPromise=require(_0xe6e2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe6e2('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe6e2('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe6e2('0x7'));var toCsv=require(_0xe6e2('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe6e2('0x9'));var authService=require(_0xe6e2('0xa'));var qs=require(_0xe6e2('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe6e2('0xc'));var utils=require(_0xe6e2('0xd'));var config=require(_0xe6e2('0xe'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x435635,_0x1ef5e2){_0x1ef5e2=_0x1ef5e2||0xcc;return function(_0x44d038){if(_0x44d038){return _0x435635[_0xe6e2('0xf')](_0x1ef5e2);}return _0x435635['status'](_0x1ef5e2)[_0xe6e2('0x10')]();};}function respondWithResult(_0x4317e8,_0x1cdafe){_0x1cdafe=_0x1cdafe||0xc8;return function(_0x4e3b85){if(_0x4e3b85){return _0x4317e8['status'](_0x1cdafe)['json'](_0x4e3b85);}};}function respondWithFilteredResult(_0x34efa1,_0x71e2cb){return function(_0x3a898a){if(_0x3a898a){var _0x5af6b2=_0x3a898a[_0xe6e2('0x11')],_0x4e4b1f=_0x71e2cb[_0xe6e2('0x12')],_0x392ae2=_0x71e2cb['offset']+_0x71e2cb[_0xe6e2('0x13')],_0xe8a2f6;if(_0x392ae2>=_0x5af6b2){_0x392ae2=_0x5af6b2;_0xe8a2f6=0xc8;}else{_0xe8a2f6=0xce;}_0x34efa1['status'](_0xe8a2f6);return _0x34efa1['set'](_0xe6e2('0x14'),_0x4e4b1f+'-'+_0x392ae2+'/'+_0x5af6b2)[_0xe6e2('0x15')](_0x3a898a);}return null;};}function patchUpdates(_0x350025){return function(_0x37c29b){try{jsonpatch[_0xe6e2('0x16')](_0x37c29b,_0x350025,!![]);}catch(_0x137ad2){return BPromise[_0xe6e2('0x17')](_0x137ad2);}return _0x37c29b[_0xe6e2('0x18')]();};}function saveUpdates(_0x39badf,_0x311f74){return function(_0x26a2ca){if(_0x26a2ca){return _0x26a2ca['update'](_0x39badf)['then'](function(_0x2f3c21){return _0x2f3c21;});}return null;};}function removeEntity(_0x320a12,_0x4ce1bd){return function(_0x586b22){if(_0x586b22){return _0x586b22['destroy']()['then'](function(){_0x320a12[_0xe6e2('0x19')](0xcc)[_0xe6e2('0x10')]();});}};}function handleEntityNotFound(_0x49e835,_0x1231cf){return function(_0x1b197e){if(!_0x1b197e){_0x49e835[_0xe6e2('0xf')](0x194);}return _0x1b197e;};}function handleError(_0x17cd62,_0x2ec843){_0x2ec843=_0x2ec843||0x1f4;return function(_0x526b15){logger[_0xe6e2('0x1a')](_0x526b15['stack']);if(_0x526b15[_0xe6e2('0x1b')]){delete _0x526b15['name'];}_0x17cd62['status'](_0x2ec843)[_0xe6e2('0x1c')](_0x526b15);};}exports['index']=function(_0x1bd48b,_0x35b0b6){var _0x48c2a8={},_0x226644={},_0x2f58df={'count':0x0,'rows':[]};var _0x3b33c4=_[_0xe6e2('0x1d')](db[_0xe6e2('0x1e')][_0xe6e2('0x1f')],function(_0x46b691){return{'name':_0x46b691[_0xe6e2('0x20')],'type':_0x46b691[_0xe6e2('0x21')]['key']};});_0x226644[_0xe6e2('0x22')]=_[_0xe6e2('0x1d')](_0x3b33c4,_0xe6e2('0x1b'));_0x226644[_0xe6e2('0x23')]=_[_0xe6e2('0x24')](_0x1bd48b[_0xe6e2('0x23')]);_0x226644[_0xe6e2('0x25')]=_[_0xe6e2('0x26')](_0x226644['model'],_0x226644[_0xe6e2('0x23')]);_0x48c2a8[_0xe6e2('0x27')]=_[_0xe6e2('0x26')](_0x226644[_0xe6e2('0x22')],qs['fields'](_0x1bd48b[_0xe6e2('0x23')]['fields']));_0x48c2a8[_0xe6e2('0x27')]=_0x48c2a8['attributes']['length']?_0x48c2a8['attributes']:_0x226644[_0xe6e2('0x22')];if(!_0x1bd48b['query']['hasOwnProperty'](_0xe6e2('0x28'))){_0x48c2a8[_0xe6e2('0x13')]=qs[_0xe6e2('0x13')](_0x1bd48b[_0xe6e2('0x23')][_0xe6e2('0x13')]);_0x48c2a8[_0xe6e2('0x12')]=qs['offset'](_0x1bd48b[_0xe6e2('0x23')][_0xe6e2('0x12')]);}_0x48c2a8[_0xe6e2('0x29')]=qs['sort'](_0x1bd48b['query']['sort']);_0x48c2a8['where']=qs['filters'](_[_0xe6e2('0x2a')](_0x1bd48b[_0xe6e2('0x23')],_0x226644[_0xe6e2('0x25')]),_0x3b33c4);if(_0x1bd48b[_0xe6e2('0x23')][_0xe6e2('0x2b')]){_0x48c2a8[_0xe6e2('0x2c')]=_['merge'](_0x48c2a8[_0xe6e2('0x2c')],{'$or':_[_0xe6e2('0x1d')](_0x3b33c4,function(_0x283d39){if(_0x283d39['type']!=='VIRTUAL'){var _0x40e44f={};_0x40e44f[_0x283d39[_0xe6e2('0x1b')]]={'$like':'%'+_0x1bd48b[_0xe6e2('0x23')][_0xe6e2('0x2b')]+'%'};return _0x40e44f;}})});}_0x48c2a8=_[_0xe6e2('0x2d')]({},_0x48c2a8,_0x1bd48b['options']);var _0x170e7a={'where':_0x48c2a8[_0xe6e2('0x2c')]};return db[_0xe6e2('0x1e')][_0xe6e2('0x11')](_0x170e7a)[_0xe6e2('0x2e')](function(_0x26b17a){_0x2f58df['count']=_0x26b17a;if(_0x1bd48b[_0xe6e2('0x23')][_0xe6e2('0x2f')]){_0x48c2a8['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0xe6e2('0x30')](_0x48c2a8);})[_0xe6e2('0x2e')](function(_0x252361){_0x2f58df['rows']=_0x252361;return _0x2f58df;})[_0xe6e2('0x2e')](respondWithFilteredResult(_0x35b0b6,_0x48c2a8))[_0xe6e2('0x31')](handleError(_0x35b0b6,null));};exports[_0xe6e2('0x32')]=function(_0x6618ee,_0x7ae2b1){var _0x133dce={'raw':!![],'where':{'id':_0x6618ee[_0xe6e2('0x33')]['id']}},_0x25e6e5={};_0x25e6e5[_0xe6e2('0x22')]=_[_0xe6e2('0x24')](db[_0xe6e2('0x1e')][_0xe6e2('0x1f')]);_0x25e6e5[_0xe6e2('0x23')]=_[_0xe6e2('0x24')](_0x6618ee[_0xe6e2('0x23')]);_0x25e6e5[_0xe6e2('0x25')]=_[_0xe6e2('0x26')](_0x25e6e5['model'],_0x25e6e5[_0xe6e2('0x23')]);_0x133dce['attributes']=_[_0xe6e2('0x26')](_0x25e6e5[_0xe6e2('0x22')],qs['fields'](_0x6618ee[_0xe6e2('0x23')][_0xe6e2('0x34')]));_0x133dce['attributes']=_0x133dce[_0xe6e2('0x27')][_0xe6e2('0x35')]?_0x133dce['attributes']:_0x25e6e5['model'];if(_0x6618ee[_0xe6e2('0x23')][_0xe6e2('0x2f')]){_0x133dce[_0xe6e2('0x36')]=[{'all':!![]}];}_0x133dce=_[_0xe6e2('0x2d')]({},_0x133dce,_0x6618ee[_0xe6e2('0x37')]);return db[_0xe6e2('0x1e')][_0xe6e2('0x38')](_0x133dce)[_0xe6e2('0x2e')](handleEntityNotFound(_0x7ae2b1,null))['then'](respondWithResult(_0x7ae2b1,null))[_0xe6e2('0x31')](handleError(_0x7ae2b1,null));};exports[_0xe6e2('0x39')]=function(_0x5bfa13,_0x148a54){return db['SquareDetailsReport']['create'](_0x5bfa13[_0xe6e2('0x3a')],{})['then'](respondWithResult(_0x148a54,0xc9))[_0xe6e2('0x31')](handleError(_0x148a54,null));};exports[_0xe6e2('0x3b')]=function(_0x4c3c7d,_0x678b8f){if(_0x4c3c7d[_0xe6e2('0x3a')]['id']){delete _0x4c3c7d[_0xe6e2('0x3a')]['id'];}return db[_0xe6e2('0x1e')][_0xe6e2('0x38')]({'where':{'id':_0x4c3c7d['params']['id']}})['then'](handleEntityNotFound(_0x678b8f,null))['then'](saveUpdates(_0x4c3c7d[_0xe6e2('0x3a')],null))[_0xe6e2('0x2e')](respondWithResult(_0x678b8f,null))[_0xe6e2('0x31')](handleError(_0x678b8f,null));};exports[_0xe6e2('0x3c')]=function(_0x2f2865,_0x530f6e){return db['SquareDetailsReport'][_0xe6e2('0x38')]({'where':{'id':_0x2f2865[_0xe6e2('0x33')]['id']}})['then'](handleEntityNotFound(_0x530f6e,null))[_0xe6e2('0x2e')](removeEntity(_0x530f6e,null))[_0xe6e2('0x31')](handleError(_0x530f6e,null));};exports[_0xe6e2('0x3d')]=function(_0x15a708,_0x33e1a0){return db['SquareDetailsReport'][_0xe6e2('0x3d')]()['then'](respondWithResult(_0x33e1a0,null))['catch'](handleError(_0x33e1a0,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 080acf0..603f961 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 _0x81cc=['path','rimraf','./squareReportDetail.attributes','exports','report_square_details','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4cdcfb,_0x489c3b){var _0x5c240f=function(_0x1e6a75){while(--_0x1e6a75){_0x4cdcfb['push'](_0x4cdcfb['shift']());}};_0x5c240f(++_0x489c3b);}(_0x81cc,0x73));var _0xc81c=function(_0xf6f87b,_0x417bbc){_0xf6f87b=_0xf6f87b-0x0;var _0x19845b=_0x81cc[_0xf6f87b];return _0x19845b;};'use strict';var _=require(_0xc81c('0x0'));var util=require(_0xc81c('0x1'));var logger=require(_0xc81c('0x2'))(_0xc81c('0x3'));var moment=require('moment');var BPromise=require(_0xc81c('0x4'));var rp=require(_0xc81c('0x5'));var fs=require('fs');var path=require(_0xc81c('0x6'));var rimraf=require(_0xc81c('0x7'));var config=require('../../config/environment');var attributes=require(_0xc81c('0x8'));module[_0xc81c('0x9')]=function(_0x5ace93,_0x3cd394){return _0x5ace93['define']('SquareDetailsReport',attributes,{'tableName':_0xc81c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91ee=['../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x207794,_0x1f5a2f){var _0x5b5621=function(_0x3cd977){while(--_0x3cd977){_0x207794['push'](_0x207794['shift']());}};_0x5b5621(++_0x1f5a2f);}(_0x91ee,0xd7));var _0xe91e=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x91ee[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xe91e('0x0'));var util=require(_0xe91e('0x1'));var logger=require(_0xe91e('0x2'))(_0xe91e('0x3'));var moment=require(_0xe91e('0x4'));var BPromise=require(_0xe91e('0x5'));var rp=require(_0xe91e('0x6'));var fs=require('fs');var path=require(_0xe91e('0x7'));var rimraf=require(_0xe91e('0x8'));var config=require(_0xe91e('0x9'));var attributes=require(_0xe91e('0xa'));module[_0xe91e('0xb')]=function(_0x270a7f,_0x5a0f01){return _0x270a7f[_0xe91e('0xc')](_0xe91e('0xd'),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 8b3f929..5fb41ce 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 _0xc9a7=['catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x14e287,_0x41aedc){var _0x3f4c24=function(_0xaab3a3){while(--_0xaab3a3){_0x14e287['push'](_0x14e287['shift']());}};_0x3f4c24(++_0x41aedc);}(_0xc9a7,0xf9));var _0x7c9a=function(_0xdc004,_0x4e61ca){_0xdc004=_0xdc004-0x0;var _0x22e6a3=_0xc9a7[_0xdc004];return _0x22e6a3;};'use strict';var _=require(_0x7c9a('0x0'));var util=require(_0x7c9a('0x1'));var moment=require(_0x7c9a('0x2'));var BPromise=require(_0x7c9a('0x3'));var rs=require(_0x7c9a('0x4'));var fs=require('fs');var Redis=require(_0x7c9a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7c9a('0x6'));var config=require(_0x7c9a('0x7'));var jayson=require(_0x7c9a('0x8'));var client=jayson['client'][_0x7c9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b9f07,_0x12e3d9,_0x37ef41){return new BPromise(function(_0x1308a6,_0x1cafb8){return client[_0x7c9a('0xa')](_0x2b9f07,_0x37ef41)[_0x7c9a('0xb')](function(_0x480668){logger['info'](_0x7c9a('0xc'),_0x12e3d9,_0x7c9a('0xd'));logger[_0x7c9a('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x12e3d9,'request\x20sent',JSON[_0x7c9a('0xf')](_0x480668));if(_0x480668['error']){if(_0x480668[_0x7c9a('0x10')][_0x7c9a('0x11')]===0x1f4){logger[_0x7c9a('0x10')](_0x7c9a('0xc'),_0x12e3d9,_0x480668[_0x7c9a('0x10')][_0x7c9a('0x12')]);return _0x1cafb8(_0x480668['error'][_0x7c9a('0x12')]);}logger['error'](_0x7c9a('0xc'),_0x12e3d9,_0x480668[_0x7c9a('0x10')][_0x7c9a('0x12')]);return _0x1308a6(_0x480668[_0x7c9a('0x10')][_0x7c9a('0x12')]);}else{logger[_0x7c9a('0x13')](_0x7c9a('0xc'),_0x12e3d9,_0x7c9a('0xd'));_0x1308a6(_0x480668[_0x7c9a('0x14')]['message']);}})[_0x7c9a('0x15')](function(_0x4d0fe7){logger[_0x7c9a('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x12e3d9,_0x4d0fe7);_0x1cafb8(_0x4d0fe7);});});}exports[_0x7c9a('0x16')]=function(_0x32890e){var _0x255462=this;return new Promise(function(_0x481b1e,_0x509dfc){return db[_0x7c9a('0x17')]['create'](_0x32890e[_0x7c9a('0x18')],{'raw':_0x32890e['options']?_0x32890e[_0x7c9a('0x19')][_0x7c9a('0x1a')]===undefined?!![]:![]:!![]})[_0x7c9a('0xb')](function(_0x64cbd3){logger[_0x7c9a('0x13')](_0x7c9a('0x16'),_0x32890e);logger['debug'](_0x7c9a('0x16'),_0x32890e,JSON[_0x7c9a('0xf')](_0x64cbd3));_0x481b1e(_0x64cbd3);})[_0x7c9a('0x15')](function(_0x39ae6e){logger[_0x7c9a('0x10')](_0x7c9a('0x16'),_0x39ae6e['message'],_0x32890e);_0x509dfc(_0x255462['error'](0x1f4,_0x39ae6e['message']));});});}; \ No newline at end of file +var _0x6d9d=['catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6d9d,0x130));var _0xd6d9=function(_0x285016,_0x4fb6db){_0x285016=_0x285016-0x0;var _0x4646b5=_0x6d9d[_0x285016];return _0x4646b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6d9('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6d9('0x1'));var db=require(_0xd6d9('0x2'))['db'];var utils=require(_0xd6d9('0x3'));var logger=require(_0xd6d9('0x4'))(_0xd6d9('0x5'));var config=require(_0xd6d9('0x6'));var jayson=require(_0xd6d9('0x7'));var client=jayson[_0xd6d9('0x8')][_0xd6d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4301be,_0x5e210d,_0x4a69d8){return new BPromise(function(_0x1f4f9a,_0x53f390){return client[_0xd6d9('0xa')](_0x4301be,_0x4a69d8)[_0xd6d9('0xb')](function(_0xe91cb8){logger[_0xd6d9('0xc')](_0xd6d9('0xd'),_0x5e210d,_0xd6d9('0xe'));logger[_0xd6d9('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5e210d,_0xd6d9('0xe'),JSON['stringify'](_0xe91cb8));if(_0xe91cb8['error']){if(_0xe91cb8[_0xd6d9('0x10')][_0xd6d9('0x11')]===0x1f4){logger['error'](_0xd6d9('0xd'),_0x5e210d,_0xe91cb8[_0xd6d9('0x10')][_0xd6d9('0x12')]);return _0x53f390(_0xe91cb8[_0xd6d9('0x10')][_0xd6d9('0x12')]);}logger['error'](_0xd6d9('0xd'),_0x5e210d,_0xe91cb8['error']['message']);return _0x1f4f9a(_0xe91cb8[_0xd6d9('0x10')][_0xd6d9('0x12')]);}else{logger[_0xd6d9('0xc')](_0xd6d9('0xd'),_0x5e210d,_0xd6d9('0xe'));_0x1f4f9a(_0xe91cb8[_0xd6d9('0x13')][_0xd6d9('0x12')]);}})[_0xd6d9('0x14')](function(_0xf199ab){logger['error'](_0xd6d9('0xd'),_0x5e210d,_0xf199ab);_0x53f390(_0xf199ab);});});}exports[_0xd6d9('0x15')]=function(_0x1017dc){var _0x11b4d9=this;return new Promise(function(_0x5b83ec,_0x2de61f){return db[_0xd6d9('0x16')][_0xd6d9('0x17')](_0x1017dc[_0xd6d9('0x18')],{'raw':_0x1017dc[_0xd6d9('0x19')]?_0x1017dc[_0xd6d9('0x19')][_0xd6d9('0x1a')]===undefined?!![]:![]:!![]})[_0xd6d9('0xb')](function(_0x7ebdd8){logger[_0xd6d9('0xc')](_0xd6d9('0x15'),_0x1017dc);logger['debug']('CreateSquareDetailsReport',_0x1017dc,JSON['stringify'](_0x7ebdd8));_0x5b83ec(_0x7ebdd8);})[_0xd6d9('0x14')](function(_0x29e851){logger[_0xd6d9('0x10')](_0xd6d9('0x15'),_0x29e851['message'],_0x1017dc);_0x2de61f(_0x11b4d9['error'](0x1f4,_0x29e851['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index da3a7f9..3f86b55 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 _0x06f7=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','killProcess','express'];(function(_0x273422,_0x11abe1){var _0x144440=function(_0x257f41){while(--_0x257f41){_0x273422['push'](_0x273422['shift']());}};_0x144440(++_0x11abe1);}(_0x06f7,0xd7));var _0x706f=function(_0x4f32de,_0x5bd4a){_0x4f32de=_0x4f32de-0x0;var _0x149821=_0x06f7[_0x4f32de];return _0x149821;};'use strict';var express=require(_0x706f('0x0'));var router=express[_0x706f('0x1')]();var auth=require(_0x706f('0x2'));var controller=require(_0x706f('0x3'));router[_0x706f('0x4')]('/',auth[_0x706f('0x5')](),controller[_0x706f('0x6')]);router[_0x706f('0x4')]('/process/:pid/kill',auth[_0x706f('0x5')](),controller[_0x706f('0x7')]);module['exports']=router; \ No newline at end of file +var _0x5d2e=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports','express','Router','../../components/auth/service'];(function(_0x49fe6a,_0xa223e4){var _0x25249e=function(_0x4d75e8){while(--_0x4d75e8){_0x49fe6a['push'](_0x49fe6a['shift']());}};_0x25249e(++_0xa223e4);}(_0x5d2e,0x126));var _0xe5d2=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x5d2e[_0xb0f7c3];return _0x28ea68;};'use strict';var express=require(_0xe5d2('0x0'));var router=express[_0xe5d2('0x1')]();var auth=require(_0xe5d2('0x2'));var controller=require(_0xe5d2('0x3'));router[_0xe5d2('0x4')]('/',auth[_0xe5d2('0x5')](),controller[_0xe5d2('0x6')]);router[_0xe5d2('0x4')](_0xe5d2('0x7'),auth[_0xe5d2('0x5')](),controller['killProcess']);module[_0xe5d2('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 785aa65..6d3fe5b 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 _0x8549=['SIGINT','killProcess','../../config/logger','util','lodash','inspect','name','send','getAllData','then','status','catch','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8549,0x113));var _0x9854=function(_0x367bd3,_0x1f9027){_0x367bd3=_0x367bd3-0x0;var _0x4f0b13=_0x8549[_0x367bd3];return _0x4f0b13;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0x9854('0x0'))('api');var util=require(_0x9854('0x1'));var BPromise=require('bluebird');var _=require(_0x9854('0x2'));function handleError(_0x1ea948,_0x191f8c,_0x23fe5d){_0x191f8c=_0x191f8c||0x1f4;return function(_0xde3882){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x23fe5d,_0x191f8c,util[_0x9854('0x3')](_0xde3882,{'showHidden':![],'depth':null}));delete _0xde3882[_0x9854('0x4')];_0x1ea948['status'](_0x191f8c)[_0x9854('0x5')](_0xde3882);};}exports['index']=function(_0x10b11e,_0x46a3cc){return info[_0x9854('0x6')]()[_0x9854('0x7')](function(_0x28e8f2){return _0x46a3cc[_0x9854('0x8')](0xc8)['json'](_0x28e8f2);})[_0x9854('0x9')](function(_0x504875){return _0x46a3cc[_0x9854('0x8')](0x1f4)[_0x9854('0xa')](_0x504875);});};exports['killProcess']=function(_0x2cd512,_0x3047dd){var _0x1b9746=[_0x9854('0xb')];return new BPromise(function(_0x186b37,_0x9ff256){return exec(util[_0x9854('0xc')](_0x9854('0xd'),_0x2cd512['params'][_0x9854('0xe')]),function(_0x2116c2,_0x3e3d51,_0x3e4ca4){if(_0x2116c2){return _0x9ff256(_0x2116c2);}return _0x186b37(_0x3e3d51);});})[_0x9854('0x7')](function(_0x198e3a){var _0x14754f=![];var _0x23b553=_0x198e3a['split'](/\n/);for(var _0xe21422=0x0,_0x22890d=_0x1b9746['length'];_0xe21422<_0x22890d,_0x14754f===![];_0xe21422+=0x1){if(_0x198e3a[_0x9854('0xf')](_0x1b9746[_0xe21422])>=0x0){_0x14754f=!![];}}if(!_0x14754f){throw new Error(util['format'](_0x9854('0x10'),_0x2cd512[_0x9854('0x11')][_0x9854('0xe')]));}process[_0x9854('0x12')](_0x2cd512[_0x9854('0x11')]['pid'],_0x9854('0x13'));return _0x3047dd[_0x9854('0x8')](0xc8)[_0x9854('0xa')]({'message':util[_0x9854('0xc')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x2cd512[_0x9854('0x11')][_0x9854('0xe')])});})[_0x9854('0x9')](handleError(_0x3047dd,null,_0x9854('0x14')));}; \ No newline at end of file +var _0x71fd=['status','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then','split','length','indexOf','kill','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x71fd,0x1c1));var _0xd71f=function(_0x529e40,_0x48d6e6){_0x529e40=_0x529e40-0x0;var _0x22aecb=_0x71fd[_0x529e40];return _0x22aecb;};'use strict';var info=require('systeminformation');var exec=require(_0xd71f('0x0'))['exec'];var logger=require(_0xd71f('0x1'))('api');var util=require('util');var BPromise=require(_0xd71f('0x2'));var _=require('lodash');function handleError(_0x22b02e,_0x3d03f6,_0x4132ce){_0x3d03f6=_0x3d03f6||0x1f4;return function(_0x2b8520){logger[_0xd71f('0x3')](_0xd71f('0x4'),_0x4132ce,_0x3d03f6,util[_0xd71f('0x5')](_0x2b8520,{'showHidden':![],'depth':null}));delete _0x2b8520[_0xd71f('0x6')];_0x22b02e[_0xd71f('0x7')](_0x3d03f6)['send'](_0x2b8520);};}exports['index']=function(_0x5f283e,_0x5e88a2){return info[_0xd71f('0x8')]()['then'](function(_0x347f92){return _0x5e88a2[_0xd71f('0x7')](0xc8)[_0xd71f('0x9')](_0x347f92);})[_0xd71f('0xa')](function(_0x5f2ccf){return _0x5e88a2[_0xd71f('0x7')](0x1f4)['json'](_0x5f2ccf);});};exports[_0xd71f('0xb')]=function(_0xcd5619,_0x2a8375){var _0x493da4=[_0xd71f('0xc')];return new BPromise(function(_0x5f17e2,_0x5e60bf){return exec(util[_0xd71f('0xd')](_0xd71f('0xe'),_0xcd5619[_0xd71f('0xf')]['pid']),function(_0x1a571a,_0x970cc6,_0x223177){if(_0x1a571a){return _0x5e60bf(_0x1a571a);}return _0x5f17e2(_0x970cc6);});})[_0xd71f('0x10')](function(_0x13cecd){var _0x3e6be2=![];var _0x301aaa=_0x13cecd[_0xd71f('0x11')](/\n/);for(var _0x4d99e3=0x0,_0x4a40ad=_0x493da4[_0xd71f('0x12')];_0x4d99e3<_0x4a40ad,_0x3e6be2===![];_0x4d99e3+=0x1){if(_0x13cecd[_0xd71f('0x13')](_0x493da4[_0x4d99e3])>=0x0){_0x3e6be2=!![];}}if(!_0x3e6be2){throw new Error(util[_0xd71f('0xd')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0xcd5619[_0xd71f('0xf')]['pid']));}process[_0xd71f('0x14')](_0xcd5619[_0xd71f('0xf')][_0xd71f('0x15')],_0xd71f('0x16'));return _0x2a8375[_0xd71f('0x7')](0xc8)['json']({'message':util[_0xd71f('0xd')](_0xd71f('0x17'),_0xcd5619[_0xd71f('0xf')][_0xd71f('0x15')])});})['catch'](handleError(_0x2a8375,null,_0xd71f('0xb')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 592b150..4d9ccba 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 _0xdace=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','exports','multer'];(function(_0x1d1031,_0x4c8354){var _0x371d1b=function(_0x2a63bc){while(--_0x2a63bc){_0x1d1031['push'](_0x1d1031['shift']());}};_0x371d1b(++_0x4c8354);}(_0xdace,0xc5));var _0xedac=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xdace[_0x50f392];return _0x5926f2;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var auth=require(_0xedac('0x4'));var interaction=require(_0xedac('0x5'));var config=require(_0xedac('0x6'));var controller=require(_0xedac('0x7'));router['get']('/',auth[_0xedac('0x8')](),controller[_0xedac('0x9')]);router[_0xedac('0xa')]('/:id',auth[_0xedac('0x8')](),controller[_0xedac('0xb')]);router[_0xedac('0xc')]('/',auth['isAuthenticated'](),controller[_0xedac('0xd')]);router[_0xedac('0xe')](_0xedac('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xedac('0x10')](_0xedac('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xedac('0x11')]=router; \ No newline at end of file +var _0x5ff3=['/:id','show','create','put','delete','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x324fe7,_0x3f73c9){var _0xc41ef7=function(_0x49455a){while(--_0x49455a){_0x324fe7['push'](_0x324fe7['shift']());}};_0xc41ef7(++_0x3f73c9);}(_0x5ff3,0x17d));var _0x35ff=function(_0x54f136,_0x2b9f58){_0x54f136=_0x54f136-0x0;var _0x20a325=_0x5ff3[_0x54f136];return _0x20a325;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var auth=require(_0x35ff('0x3'));var interaction=require(_0x35ff('0x4'));var config=require(_0x35ff('0x5'));var controller=require('./tag.controller');router[_0x35ff('0x6')]('/',auth[_0x35ff('0x7')](),controller[_0x35ff('0x8')]);router[_0x35ff('0x6')](_0x35ff('0x9'),auth['isAuthenticated'](),controller[_0x35ff('0xa')]);router['post']('/',auth[_0x35ff('0x7')](),controller[_0x35ff('0xb')]);router[_0x35ff('0xc')]('/:id',auth[_0x35ff('0x7')](),controller['update']);router[_0x35ff('0xd')](_0x35ff('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x35ff('0xe')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9af69a8..6e7a26e 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 _0xac4a=['exports','STRING','name','#0091EA','sequelize'];(function(_0x259789,_0x6eb44f){var _0x74ad9f=function(_0x557349){while(--_0x557349){_0x259789['push'](_0x259789['shift']());}};_0x74ad9f(++_0x6eb44f);}(_0xac4a,0x13f));var _0xaac4=function(_0x5baa14,_0x2efc6a){_0x5baa14=_0x5baa14-0x0;var _0x52107c=_0xac4a[_0x5baa14];return _0x52107c;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'name':{'type':Sequelize[_0xaac4('0x2')],'unique':_0xaac4('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':_0xaac4('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe5b5=['exports','STRING','name','#0091EA','sequelize'];(function(_0x50c710,_0x504134){var _0x2d5f79=function(_0x73e66c){while(--_0x73e66c){_0x50c710['push'](_0x50c710['shift']());}};_0x2d5f79(++_0x504134);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0xe5b5[_0x5beda8];return _0x2aa042;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'name':{'type':Sequelize[_0x5e5b('0x2')],'unique':_0x5e5b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x4')},'description':{'type':Sequelize[_0x5e5b('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ebb83ea..f537337 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 _0xdfdc=['key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','where','pick','filters','filter','merge','type','options','Tag','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes'];(function(_0xe09b32,_0x9a33b9){var _0x611dfc=function(_0x1413cb){while(--_0x1413cb){_0xe09b32['push'](_0xe09b32['shift']());}};_0x611dfc(++_0x9a33b9);}(_0xdfdc,0x1e8));var _0xcdfd=function(_0x5388cb,_0x34c4e7){_0x5388cb=_0x5388cb-0x0;var _0x4c7d99=_0xdfdc[_0x5388cb];return _0x4c7d99;};'use strict';var pdf=require(_0xcdfd('0x0'));var emlformat=require(_0xcdfd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcdfd('0x2'));var jsonpatch=require(_0xcdfd('0x3'));var rp=require(_0xcdfd('0x4'));var moment=require(_0xcdfd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcdfd('0x6'));var util=require(_0xcdfd('0x7'));var path=require('path');var sox=require(_0xcdfd('0x8'));var csv=require('to-csv');var ejs=require(_0xcdfd('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcdfd('0xa'));var crypto=require(_0xcdfd('0xb'));var jsforce=require(_0xcdfd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcdfd('0xd'));var querystring=require(_0xcdfd('0xe'));var Papa=require(_0xcdfd('0xf'));var Redis=require(_0xcdfd('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcdfd('0x11'));var hardwareService=require(_0xcdfd('0x12'));var logger=require(_0xcdfd('0x13'))('api');var utils=require(_0xcdfd('0x14'));var config=require(_0xcdfd('0x15'));var db=require(_0xcdfd('0x16'))['db'];function respondWithStatusCode(_0x3d7761,_0x25321b){_0x25321b=_0x25321b||0xcc;return function(_0x423172){if(_0x423172){return _0x3d7761[_0xcdfd('0x17')](_0x25321b);}return _0x3d7761[_0xcdfd('0x18')](_0x25321b)[_0xcdfd('0x19')]();};}function respondWithResult(_0x3dae92,_0x54bb81){_0x54bb81=_0x54bb81||0xc8;return function(_0x3ad6bf){if(_0x3ad6bf){return _0x3dae92[_0xcdfd('0x18')](_0x54bb81)[_0xcdfd('0x1a')](_0x3ad6bf);}};}function respondWithFilteredResult(_0x30d65e,_0x4d50d0){return function(_0x316e19){if(_0x316e19){var _0xf22fa=_0x316e19[_0xcdfd('0x1b')],_0xf6df37=_0x4d50d0[_0xcdfd('0x1c')],_0x1d8d2f=_0x4d50d0['offset']+_0x4d50d0[_0xcdfd('0x1d')],_0x52be60;if(_0x1d8d2f>=_0xf22fa){_0x1d8d2f=_0xf22fa;_0x52be60=0xc8;}else{_0x52be60=0xce;}_0x30d65e[_0xcdfd('0x18')](_0x52be60);return _0x30d65e[_0xcdfd('0x1e')](_0xcdfd('0x1f'),_0xf6df37+'-'+_0x1d8d2f+'/'+_0xf22fa)[_0xcdfd('0x1a')](_0x316e19);}return null;};}function patchUpdates(_0xd8124d){return function(_0x5c746e){try{jsonpatch['apply'](_0x5c746e,_0xd8124d,!![]);}catch(_0x14cd77){return BPromise[_0xcdfd('0x20')](_0x14cd77);}return _0x5c746e['save']();};}function saveUpdates(_0x5bf7c1,_0x524b30){return function(_0x1c530f){if(_0x1c530f){return _0x1c530f['update'](_0x5bf7c1)[_0xcdfd('0x21')](function(_0x1247a4){return _0x1247a4;});}return null;};}function removeEntity(_0x10e3bd,_0x5e3ee3){return function(_0x28a833){if(_0x28a833){return _0x28a833['destroy']()['then'](function(){var _0x5094bf=_0x28a833[_0xcdfd('0x22')]({'plain':!![]});var _0x5402b8=_0xcdfd('0x23');return db[_0xcdfd('0x24')][_0xcdfd('0x25')]({'where':{'type':_0x5402b8,'resourceId':_0x5094bf['id']}})[_0xcdfd('0x21')](function(){return _0x28a833;});})[_0xcdfd('0x21')](function(){_0x10e3bd['status'](0xcc)[_0xcdfd('0x19')]();});}};}function handleEntityNotFound(_0x3a13ff,_0x5d6ee6){return function(_0x22d2f8){if(!_0x22d2f8){_0x3a13ff[_0xcdfd('0x17')](0x194);}return _0x22d2f8;};}function handleError(_0x106da5,_0x2ebaf1){_0x2ebaf1=_0x2ebaf1||0x1f4;return function(_0x531cb5){logger[_0xcdfd('0x26')](_0x531cb5[_0xcdfd('0x27')]);if(_0x531cb5[_0xcdfd('0x28')]){delete _0x531cb5[_0xcdfd('0x28')];}_0x106da5[_0xcdfd('0x18')](_0x2ebaf1)[_0xcdfd('0x29')](_0x531cb5);};}exports['index']=function(_0x5b9ff6,_0x8ae832){var _0x16ac9c={},_0x28f0b4={},_0x2191d1={'count':0x0,'rows':[]};var _0x2128fa=_[_0xcdfd('0x2a')](db['Tag'][_0xcdfd('0x2b')],function(_0x31be03){return{'name':_0x31be03['fieldName'],'type':_0x31be03['type'][_0xcdfd('0x2c')]};});_0x28f0b4[_0xcdfd('0x2d')]=_[_0xcdfd('0x2a')](_0x2128fa,'name');_0x28f0b4[_0xcdfd('0x2e')]=_[_0xcdfd('0x2f')](_0x5b9ff6['query']);_0x28f0b4['filters']=_['intersection'](_0x28f0b4[_0xcdfd('0x2d')],_0x28f0b4[_0xcdfd('0x2e')]);_0x16ac9c[_0xcdfd('0x30')]=_[_0xcdfd('0x31')](_0x28f0b4[_0xcdfd('0x2d')],qs[_0xcdfd('0x32')](_0x5b9ff6[_0xcdfd('0x2e')][_0xcdfd('0x32')]));_0x16ac9c[_0xcdfd('0x30')]=_0x16ac9c[_0xcdfd('0x30')]['length']?_0x16ac9c[_0xcdfd('0x30')]:_0x28f0b4[_0xcdfd('0x2d')];if(!_0x5b9ff6[_0xcdfd('0x2e')]['hasOwnProperty'](_0xcdfd('0x33'))){_0x16ac9c[_0xcdfd('0x1d')]=qs[_0xcdfd('0x1d')](_0x5b9ff6[_0xcdfd('0x2e')]['limit']);_0x16ac9c[_0xcdfd('0x1c')]=qs[_0xcdfd('0x1c')](_0x5b9ff6[_0xcdfd('0x2e')][_0xcdfd('0x1c')]);}_0x16ac9c[_0xcdfd('0x34')]=qs[_0xcdfd('0x35')](_0x5b9ff6['query']['sort']);_0x16ac9c[_0xcdfd('0x36')]=qs['filters'](_[_0xcdfd('0x37')](_0x5b9ff6[_0xcdfd('0x2e')],_0x28f0b4[_0xcdfd('0x38')]),_0x2128fa);if(_0x5b9ff6[_0xcdfd('0x2e')][_0xcdfd('0x39')]){_0x16ac9c[_0xcdfd('0x36')]=_[_0xcdfd('0x3a')](_0x16ac9c[_0xcdfd('0x36')],{'$or':_[_0xcdfd('0x2a')](_0x2128fa,function(_0x5c929a){if(_0x5c929a[_0xcdfd('0x3b')]!=='VIRTUAL'){var _0x9a4bee={};_0x9a4bee[_0x5c929a[_0xcdfd('0x28')]]={'$like':'%'+_0x5b9ff6[_0xcdfd('0x2e')][_0xcdfd('0x39')]+'%'};return _0x9a4bee;}})});}_0x16ac9c=_[_0xcdfd('0x3a')]({},_0x16ac9c,_0x5b9ff6[_0xcdfd('0x3c')]);var _0xbae3a1={'where':_0x16ac9c[_0xcdfd('0x36')]};return db[_0xcdfd('0x3d')]['count'](_0xbae3a1)[_0xcdfd('0x21')](function(_0x18abe){_0x2191d1[_0xcdfd('0x1b')]=_0x18abe;if(_0x5b9ff6[_0xcdfd('0x2e')][_0xcdfd('0x3e')]){_0x16ac9c[_0xcdfd('0x3f')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x16ac9c);})[_0xcdfd('0x21')](function(_0x5b4c4c){_0x2191d1[_0xcdfd('0x40')]=_0x5b4c4c;return _0x2191d1;})[_0xcdfd('0x21')](respondWithFilteredResult(_0x8ae832,_0x16ac9c))[_0xcdfd('0x41')](handleError(_0x8ae832,null));};exports[_0xcdfd('0x42')]=function(_0x3d3183,_0x5633d3){var _0x539d03={'raw':!![],'where':{'id':_0x3d3183[_0xcdfd('0x43')]['id']}},_0x43c372={};_0x43c372[_0xcdfd('0x2d')]=_['keys'](db[_0xcdfd('0x3d')][_0xcdfd('0x2b')]);_0x43c372[_0xcdfd('0x2e')]=_[_0xcdfd('0x2f')](_0x3d3183['query']);_0x43c372[_0xcdfd('0x38')]=_[_0xcdfd('0x31')](_0x43c372[_0xcdfd('0x2d')],_0x43c372[_0xcdfd('0x2e')]);_0x539d03[_0xcdfd('0x30')]=_[_0xcdfd('0x31')](_0x43c372['model'],qs[_0xcdfd('0x32')](_0x3d3183[_0xcdfd('0x2e')][_0xcdfd('0x32')]));_0x539d03[_0xcdfd('0x30')]=_0x539d03[_0xcdfd('0x30')]['length']?_0x539d03['attributes']:_0x43c372['model'];if(_0x3d3183[_0xcdfd('0x2e')][_0xcdfd('0x3e')]){_0x539d03['include']=[{'all':!![]}];}_0x539d03=_[_0xcdfd('0x3a')]({},_0x539d03,_0x3d3183[_0xcdfd('0x3c')]);return db[_0xcdfd('0x3d')][_0xcdfd('0x44')](_0x539d03)[_0xcdfd('0x21')](handleEntityNotFound(_0x5633d3,null))[_0xcdfd('0x21')](respondWithResult(_0x5633d3,null))['catch'](handleError(_0x5633d3,null));};exports[_0xcdfd('0x45')]=function(_0x1834da,_0x481698){return db[_0xcdfd('0x3d')][_0xcdfd('0x45')](_0x1834da[_0xcdfd('0x46')],{})[_0xcdfd('0x21')](function(_0x2ac025){var _0x3ecf07=_0x1834da[_0xcdfd('0x47')][_0xcdfd('0x22')]({'plain':!![]});if(!_0x3ecf07)throw new Error(_0xcdfd('0x48'));if(_0x3ecf07['role']===_0xcdfd('0x47')){var _0x1f3226=_0x2ac025[_0xcdfd('0x22')]({'plain':!![]});var _0x38f60e='Tags';return db[_0xcdfd('0x49')]['find']({'where':{'name':_0x38f60e,'userProfileId':_0x3ecf07[_0xcdfd('0x4a')]},'raw':!![]})[_0xcdfd('0x21')](function(_0x3e98c9){if(_0x3e98c9&&_0x3e98c9['autoAssociation']===0x0){return db[_0xcdfd('0x24')]['create']({'name':_0x1f3226[_0xcdfd('0x28')],'resourceId':_0x1f3226['id'],'type':_0x3e98c9[_0xcdfd('0x28')],'sectionId':_0x3e98c9['id']},{})['then'](function(){return _0x2ac025;});}else{return _0x2ac025;}})[_0xcdfd('0x41')](function(_0x3b8acb){logger[_0xcdfd('0x26')](_0xcdfd('0x4b'),_0x3b8acb);throw _0x3b8acb;});}return _0x2ac025;})['then'](respondWithResult(_0x481698,0xc9))[_0xcdfd('0x41')](handleError(_0x481698,null));};exports['update']=function(_0x4d4d47,_0x5c12db){if(_0x4d4d47[_0xcdfd('0x46')]['id']){delete _0x4d4d47[_0xcdfd('0x46')]['id'];}return db[_0xcdfd('0x3d')][_0xcdfd('0x44')]({'where':{'id':_0x4d4d47[_0xcdfd('0x43')]['id']}})[_0xcdfd('0x21')](handleEntityNotFound(_0x5c12db,null))[_0xcdfd('0x21')](saveUpdates(_0x4d4d47[_0xcdfd('0x46')],null))[_0xcdfd('0x21')](respondWithResult(_0x5c12db,null))[_0xcdfd('0x41')](handleError(_0x5c12db,null));};exports[_0xcdfd('0x25')]=function(_0x2bcad4,_0x3213a7){return db[_0xcdfd('0x3d')][_0xcdfd('0x44')]({'where':{'id':_0x2bcad4['params']['id']}})[_0xcdfd('0x21')](handleEntityNotFound(_0x3213a7,null))[_0xcdfd('0x21')](removeEntity(_0x3213a7,null))[_0xcdfd('0x41')](handleError(_0x3213a7,null));}; \ No newline at end of file +var _0xc9f6=['ejs','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','update','then','Tags','UserProfileResource','destroy','name','send','index','map','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','Tag','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox'];(function(_0x1876b2,_0x5d0225){var _0x9fb1e0=function(_0x29b099){while(--_0x29b099){_0x1876b2['push'](_0x1876b2['shift']());}};_0x9fb1e0(++_0x5d0225);}(_0xc9f6,0x98));var _0x6c9f=function(_0x51789c,_0x3d5847){_0x51789c=_0x51789c-0x0;var _0x30128a=_0xc9f6[_0x51789c];return _0x30128a;};'use strict';var pdf=require(_0x6c9f('0x0'));var emlformat=require(_0x6c9f('0x1'));var rimraf=require(_0x6c9f('0x2'));var zipdir=require(_0x6c9f('0x3'));var jsonpatch=require(_0x6c9f('0x4'));var rp=require('request-promise');var moment=require(_0x6c9f('0x5'));var BPromise=require(_0x6c9f('0x6'));var Mustache=require(_0x6c9f('0x7'));var util=require(_0x6c9f('0x8'));var path=require('path');var sox=require(_0x6c9f('0x9'));var csv=require('to-csv');var ejs=require(_0x6c9f('0xa'));var fs=require('fs');var _=require(_0x6c9f('0xb'));var squel=require('squel');var crypto=require(_0x6c9f('0xc'));var jsforce=require(_0x6c9f('0xd'));var deskjs=require(_0x6c9f('0xe'));var toCsv=require(_0x6c9f('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6c9f('0x10'));var authService=require(_0x6c9f('0x11'));var qs=require(_0x6c9f('0x12'));var as=require(_0x6c9f('0x13'));var hardwareService=require(_0x6c9f('0x14'));var logger=require(_0x6c9f('0x15'))(_0x6c9f('0x16'));var utils=require('../../config/utils');var config=require(_0x6c9f('0x17'));var db=require(_0x6c9f('0x18'))['db'];function respondWithStatusCode(_0x465d38,_0x157bdd){_0x157bdd=_0x157bdd||0xcc;return function(_0x477291){if(_0x477291){return _0x465d38[_0x6c9f('0x19')](_0x157bdd);}return _0x465d38[_0x6c9f('0x1a')](_0x157bdd)[_0x6c9f('0x1b')]();};}function respondWithResult(_0x441db3,_0x507787){_0x507787=_0x507787||0xc8;return function(_0x4c1810){if(_0x4c1810){return _0x441db3[_0x6c9f('0x1a')](_0x507787)['json'](_0x4c1810);}};}function respondWithFilteredResult(_0x20ab4a,_0xfec06e){return function(_0xc080e4){if(_0xc080e4){var _0x3cc214=_0xc080e4[_0x6c9f('0x1c')],_0x549523=_0xfec06e['offset'],_0x44881d=_0xfec06e[_0x6c9f('0x1d')]+_0xfec06e['limit'],_0x7f3d9f;if(_0x44881d>=_0x3cc214){_0x44881d=_0x3cc214;_0x7f3d9f=0xc8;}else{_0x7f3d9f=0xce;}_0x20ab4a[_0x6c9f('0x1a')](_0x7f3d9f);return _0x20ab4a['set'](_0x6c9f('0x1e'),_0x549523+'-'+_0x44881d+'/'+_0x3cc214)[_0x6c9f('0x1f')](_0xc080e4);}return null;};}function patchUpdates(_0x3ea1f9){return function(_0x31a522){try{jsonpatch[_0x6c9f('0x20')](_0x31a522,_0x3ea1f9,!![]);}catch(_0x4a1d07){return BPromise[_0x6c9f('0x21')](_0x4a1d07);}return _0x31a522['save']();};}function saveUpdates(_0x16286f,_0x2170de){return function(_0x1e8526){if(_0x1e8526){return _0x1e8526[_0x6c9f('0x22')](_0x16286f)[_0x6c9f('0x23')](function(_0x304f10){return _0x304f10;});}return null;};}function removeEntity(_0x5cc88a,_0x1c2d75){return function(_0x263380){if(_0x263380){return _0x263380['destroy']()[_0x6c9f('0x23')](function(){var _0x407227=_0x263380['get']({'plain':!![]});var _0x17bb15=_0x6c9f('0x24');return db[_0x6c9f('0x25')][_0x6c9f('0x26')]({'where':{'type':_0x17bb15,'resourceId':_0x407227['id']}})[_0x6c9f('0x23')](function(){return _0x263380;});})['then'](function(){_0x5cc88a[_0x6c9f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e37a6,_0x51b8c3){return function(_0x1cf369){if(!_0x1cf369){_0x5e37a6[_0x6c9f('0x19')](0x194);}return _0x1cf369;};}function handleError(_0x1d790b,_0x55f068){_0x55f068=_0x55f068||0x1f4;return function(_0x56a223){logger['error'](_0x56a223['stack']);if(_0x56a223[_0x6c9f('0x27')]){delete _0x56a223[_0x6c9f('0x27')];}_0x1d790b[_0x6c9f('0x1a')](_0x55f068)[_0x6c9f('0x28')](_0x56a223);};}exports[_0x6c9f('0x29')]=function(_0x35af0f,_0x3e0bae){var _0x47efaf={},_0xc36bea={},_0x1161b5={'count':0x0,'rows':[]};var _0x1c873a=_[_0x6c9f('0x2a')](db['Tag']['rawAttributes'],function(_0x1b25a6){return{'name':_0x1b25a6[_0x6c9f('0x2b')],'type':_0x1b25a6[_0x6c9f('0x2c')][_0x6c9f('0x2d')]};});_0xc36bea['model']=_[_0x6c9f('0x2a')](_0x1c873a,_0x6c9f('0x27'));_0xc36bea[_0x6c9f('0x2e')]=_['keys'](_0x35af0f[_0x6c9f('0x2e')]);_0xc36bea[_0x6c9f('0x2f')]=_[_0x6c9f('0x30')](_0xc36bea[_0x6c9f('0x31')],_0xc36bea['query']);_0x47efaf['attributes']=_[_0x6c9f('0x30')](_0xc36bea[_0x6c9f('0x31')],qs[_0x6c9f('0x32')](_0x35af0f[_0x6c9f('0x2e')][_0x6c9f('0x32')]));_0x47efaf['attributes']=_0x47efaf[_0x6c9f('0x33')][_0x6c9f('0x34')]?_0x47efaf[_0x6c9f('0x33')]:_0xc36bea[_0x6c9f('0x31')];if(!_0x35af0f[_0x6c9f('0x2e')]['hasOwnProperty'](_0x6c9f('0x35'))){_0x47efaf[_0x6c9f('0x36')]=qs['limit'](_0x35af0f[_0x6c9f('0x2e')][_0x6c9f('0x36')]);_0x47efaf[_0x6c9f('0x1d')]=qs[_0x6c9f('0x1d')](_0x35af0f[_0x6c9f('0x2e')][_0x6c9f('0x1d')]);}_0x47efaf[_0x6c9f('0x37')]=qs[_0x6c9f('0x38')](_0x35af0f[_0x6c9f('0x2e')][_0x6c9f('0x38')]);_0x47efaf[_0x6c9f('0x39')]=qs[_0x6c9f('0x2f')](_[_0x6c9f('0x3a')](_0x35af0f[_0x6c9f('0x2e')],_0xc36bea[_0x6c9f('0x2f')]),_0x1c873a);if(_0x35af0f['query']['filter']){_0x47efaf[_0x6c9f('0x39')]=_[_0x6c9f('0x3b')](_0x47efaf['where'],{'$or':_[_0x6c9f('0x2a')](_0x1c873a,function(_0x2abfb3){if(_0x2abfb3[_0x6c9f('0x2c')]!==_0x6c9f('0x3c')){var _0x18e6a8={};_0x18e6a8[_0x2abfb3['name']]={'$like':'%'+_0x35af0f['query'][_0x6c9f('0x3d')]+'%'};return _0x18e6a8;}})});}_0x47efaf=_[_0x6c9f('0x3b')]({},_0x47efaf,_0x35af0f[_0x6c9f('0x3e')]);var _0x22b389={'where':_0x47efaf[_0x6c9f('0x39')]};return db[_0x6c9f('0x3f')]['count'](_0x22b389)[_0x6c9f('0x23')](function(_0x5c6913){_0x1161b5[_0x6c9f('0x1c')]=_0x5c6913;if(_0x35af0f[_0x6c9f('0x2e')][_0x6c9f('0x40')]){_0x47efaf[_0x6c9f('0x41')]=[{'all':!![]}];}return db['Tag'][_0x6c9f('0x42')](_0x47efaf);})[_0x6c9f('0x23')](function(_0x2f63cc){_0x1161b5['rows']=_0x2f63cc;return _0x1161b5;})[_0x6c9f('0x23')](respondWithFilteredResult(_0x3e0bae,_0x47efaf))[_0x6c9f('0x43')](handleError(_0x3e0bae,null));};exports[_0x6c9f('0x44')]=function(_0x413395,_0x113d6c){var _0x5bb93b={'raw':!![],'where':{'id':_0x413395[_0x6c9f('0x45')]['id']}},_0x38edcf={};_0x38edcf['model']=_[_0x6c9f('0x46')](db[_0x6c9f('0x3f')][_0x6c9f('0x47')]);_0x38edcf['query']=_[_0x6c9f('0x46')](_0x413395[_0x6c9f('0x2e')]);_0x38edcf[_0x6c9f('0x2f')]=_[_0x6c9f('0x30')](_0x38edcf['model'],_0x38edcf[_0x6c9f('0x2e')]);_0x5bb93b[_0x6c9f('0x33')]=_[_0x6c9f('0x30')](_0x38edcf[_0x6c9f('0x31')],qs[_0x6c9f('0x32')](_0x413395['query'][_0x6c9f('0x32')]));_0x5bb93b[_0x6c9f('0x33')]=_0x5bb93b[_0x6c9f('0x33')][_0x6c9f('0x34')]?_0x5bb93b[_0x6c9f('0x33')]:_0x38edcf[_0x6c9f('0x31')];if(_0x413395[_0x6c9f('0x2e')][_0x6c9f('0x40')]){_0x5bb93b['include']=[{'all':!![]}];}_0x5bb93b=_[_0x6c9f('0x3b')]({},_0x5bb93b,_0x413395[_0x6c9f('0x3e')]);return db['Tag'][_0x6c9f('0x48')](_0x5bb93b)[_0x6c9f('0x23')](handleEntityNotFound(_0x113d6c,null))[_0x6c9f('0x23')](respondWithResult(_0x113d6c,null))[_0x6c9f('0x43')](handleError(_0x113d6c,null));};exports[_0x6c9f('0x49')]=function(_0x2dca83,_0x370966){return db[_0x6c9f('0x3f')][_0x6c9f('0x49')](_0x2dca83[_0x6c9f('0x4a')],{})[_0x6c9f('0x23')](function(_0x4ebe9e){var _0x7866d0=_0x2dca83[_0x6c9f('0x4b')]['get']({'plain':!![]});if(!_0x7866d0)throw new Error(_0x6c9f('0x4c'));if(_0x7866d0[_0x6c9f('0x4d')]===_0x6c9f('0x4b')){var _0x4dfd41=_0x4ebe9e['get']({'plain':!![]});var _0x2d452a=_0x6c9f('0x24');return db['UserProfileSection'][_0x6c9f('0x48')]({'where':{'name':_0x2d452a,'userProfileId':_0x7866d0[_0x6c9f('0x4e')]},'raw':!![]})[_0x6c9f('0x23')](function(_0x128027){if(_0x128027&&_0x128027['autoAssociation']===0x0){return db['UserProfileResource'][_0x6c9f('0x49')]({'name':_0x4dfd41[_0x6c9f('0x27')],'resourceId':_0x4dfd41['id'],'type':_0x128027[_0x6c9f('0x27')],'sectionId':_0x128027['id']},{})['then'](function(){return _0x4ebe9e;});}else{return _0x4ebe9e;}})[_0x6c9f('0x43')](function(_0x3d9e8a){logger[_0x6c9f('0x4f')](_0x6c9f('0x50'),_0x3d9e8a);throw _0x3d9e8a;});}return _0x4ebe9e;})[_0x6c9f('0x23')](respondWithResult(_0x370966,0xc9))[_0x6c9f('0x43')](handleError(_0x370966,null));};exports['update']=function(_0x473619,_0x1313f1){if(_0x473619[_0x6c9f('0x4a')]['id']){delete _0x473619[_0x6c9f('0x4a')]['id'];}return db[_0x6c9f('0x3f')][_0x6c9f('0x48')]({'where':{'id':_0x473619[_0x6c9f('0x45')]['id']}})[_0x6c9f('0x23')](handleEntityNotFound(_0x1313f1,null))['then'](saveUpdates(_0x473619[_0x6c9f('0x4a')],null))[_0x6c9f('0x23')](respondWithResult(_0x1313f1,null))['catch'](handleError(_0x1313f1,null));};exports['destroy']=function(_0x10caf4,_0xb70bfe){return db[_0x6c9f('0x3f')][_0x6c9f('0x48')]({'where':{'id':_0x10caf4[_0x6c9f('0x45')]['id']}})[_0x6c9f('0x23')](handleEntityNotFound(_0xb70bfe,null))[_0x6c9f('0x23')](removeEntity(_0xb70bfe,null))[_0x6c9f('0x43')](handleError(_0xb70bfe,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 784edf5..7e59941 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 _0xe9d5=['request-promise','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger','api','bluebird'];(function(_0x59734a,_0x1e96e3){var _0x4481a2=function(_0x4c6260){while(--_0x4c6260){_0x59734a['push'](_0x59734a['shift']());}};_0x4481a2(++_0x1e96e3);}(_0xe9d5,0x187));var _0x5e9d=function(_0x5acbef,_0x36b414){_0x5acbef=_0x5acbef-0x0;var _0x5e9742=_0xe9d5[_0x5acbef];return _0x5e9742;};'use strict';var _=require(_0x5e9d('0x0'));var util=require(_0x5e9d('0x1'));var logger=require(_0x5e9d('0x2'))(_0x5e9d('0x3'));var moment=require('moment');var BPromise=require(_0x5e9d('0x4'));var rp=require(_0x5e9d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5e9d('0x6'));var attributes=require(_0x5e9d('0x7'));module['exports']=function(_0x4ac3a9,_0x2455a1){return _0x4ac3a9[_0x5e9d('0x8')](_0x5e9d('0x9'),attributes,{'tableName':_0x5e9d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36eb=['Tag','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./tag.attributes','exports'];(function(_0x462cb9,_0x581639){var _0x58dd35=function(_0x42bf39){while(--_0x42bf39){_0x462cb9['push'](_0x462cb9['shift']());}};_0x58dd35(++_0x581639);}(_0x36eb,0xb5));var _0xb36e=function(_0x10d8fb,_0x176b83){_0x10d8fb=_0x10d8fb-0x0;var _0x1e9413=_0x36eb[_0x10d8fb];return _0x1e9413;};'use strict';var _=require('lodash');var util=require(_0xb36e('0x0'));var logger=require(_0xb36e('0x1'))(_0xb36e('0x2'));var moment=require(_0xb36e('0x3'));var BPromise=require(_0xb36e('0x4'));var rp=require(_0xb36e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb36e('0x6'));var config=require('../../config/environment');var attributes=require(_0xb36e('0x7'));module[_0xb36e('0x8')]=function(_0x201b33,_0x2cca2e){return _0x201b33['define'](_0xb36e('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 77255ec..d49be5a 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 _0x6f0d=['Tag,\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','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x44a573,_0x1481e8){var _0x37a4cc=function(_0x4d4384){while(--_0x4d4384){_0x44a573['push'](_0x44a573['shift']());}};_0x37a4cc(++_0x1481e8);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x144b4f,_0x34069c){_0x144b4f=_0x144b4f-0x0;var _0x5f5978=_0x6f0d[_0x144b4f];return _0x5f5978;};'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')]('Tag,\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 _0x7072=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x519a6f,_0x52cb04){var _0x221793=function(_0x2da616){while(--_0x2da616){_0x519a6f['push'](_0x519a6f['shift']());}};_0x221793(++_0x52cb04);}(_0x7072,0x138));var _0x2707=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x7072[_0xa8883];return _0x479426;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 56205f9..c8f6a89 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 _0x53d8=['update','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./team.controller','get','isAuthenticated','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','addQueues','put'];(function(_0x781d60,_0x368c4d){var _0x1baea8=function(_0x2675a8){while(--_0x2675a8){_0x781d60['push'](_0x781d60['shift']());}};_0x1baea8(++_0x368c4d);}(_0x53d8,0x119));var _0x853d=function(_0x2c1995,_0x11f775){_0x2c1995=_0x2c1995-0x0;var _0xa7e7e8=_0x53d8[_0x2c1995];return _0xa7e7e8;};'use strict';var multer=require(_0x853d('0x0'));var util=require(_0x853d('0x1'));var path=require(_0x853d('0x2'));var timeout=require(_0x853d('0x3'));var express=require(_0x853d('0x4'));var router=express[_0x853d('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x853d('0x6'));var controller=require(_0x853d('0x7'));router[_0x853d('0x8')]('/',auth[_0x853d('0x9')](),controller['index']);router[_0x853d('0x8')](_0x853d('0xa'),auth[_0x853d('0x9')](),controller[_0x853d('0xb')]);router[_0x853d('0x8')](_0x853d('0xc'),auth[_0x853d('0x9')](),controller[_0x853d('0xd')]);router[_0x853d('0x8')](_0x853d('0xe'),auth[_0x853d('0x9')](),controller[_0x853d('0xf')]);router[_0x853d('0x10')]('/',auth[_0x853d('0x9')](),controller['create']);router['post'](_0x853d('0xc'),auth[_0x853d('0x9')](),controller[_0x853d('0x11')]);router[_0x853d('0x10')](_0x853d('0xe'),auth[_0x853d('0x9')](),controller['addAgents']);router[_0x853d('0x12')](_0x853d('0xa'),auth[_0x853d('0x9')](),controller[_0x853d('0x13')]);router[_0x853d('0x14')](_0x853d('0xa'),auth[_0x853d('0x9')](),controller[_0x853d('0x15')]);router['delete'](_0x853d('0xc'),auth[_0x853d('0x9')](),controller[_0x853d('0x16')]);router[_0x853d('0x14')](_0x853d('0xe'),auth['isAuthenticated'](),controller[_0x853d('0x17')]);module[_0x853d('0x18')]=router; \ No newline at end of file +var _0xc74a=['isAuthenticated','getQueues','/:id/users','post','create','addQueues','addAgents','put','update','delete','removeQueues','removeAgents','exports','util','path','connect-timeout','express','Router','./team.controller','get','index','/:id','show','/:id/queues'];(function(_0x820827,_0x21b7f7){var _0x344e5a=function(_0x166f68){while(--_0x166f68){_0x820827['push'](_0x820827['shift']());}};_0x344e5a(++_0x21b7f7);}(_0xc74a,0xfd));var _0xac74=function(_0x18eb2a,_0x25b8fb){_0x18eb2a=_0x18eb2a-0x0;var _0x4c2a71=_0xc74a[_0x18eb2a];return _0x4c2a71;};'use strict';var multer=require('multer');var util=require(_0xac74('0x0'));var path=require(_0xac74('0x1'));var timeout=require(_0xac74('0x2'));var express=require(_0xac74('0x3'));var router=express[_0xac74('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac74('0x5'));router[_0xac74('0x6')]('/',auth['isAuthenticated'](),controller[_0xac74('0x7')]);router[_0xac74('0x6')](_0xac74('0x8'),auth['isAuthenticated'](),controller[_0xac74('0x9')]);router[_0xac74('0x6')](_0xac74('0xa'),auth[_0xac74('0xb')](),controller[_0xac74('0xc')]);router['get'](_0xac74('0xd'),auth[_0xac74('0xb')](),controller['getAgents']);router[_0xac74('0xe')]('/',auth[_0xac74('0xb')](),controller[_0xac74('0xf')]);router[_0xac74('0xe')](_0xac74('0xa'),auth['isAuthenticated'](),controller[_0xac74('0x10')]);router[_0xac74('0xe')](_0xac74('0xd'),auth[_0xac74('0xb')](),controller[_0xac74('0x11')]);router[_0xac74('0x12')](_0xac74('0x8'),auth[_0xac74('0xb')](),controller[_0xac74('0x13')]);router['delete'](_0xac74('0x8'),auth[_0xac74('0xb')](),controller['destroy']);router[_0xac74('0x14')](_0xac74('0xa'),auth[_0xac74('0xb')](),controller[_0xac74('0x15')]);router[_0xac74('0x14')](_0xac74('0xd'),auth[_0xac74('0xb')](),controller[_0xac74('0x16')]);module[_0xac74('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 ed742f2..4ad7230 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 _0xed9c=['STRING','name','sequelize','exports'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0xed9c,0x122));var _0xced9=function(_0x3299e8,_0x3ef8eb){_0x3299e8=_0x3299e8-0x0;var _0x4b3dc0=_0xed9c[_0x3299e8];return _0x4b3dc0;};'use strict';var Sequelize=require(_0xced9('0x0'));module[_0xced9('0x1')]={'name':{'type':Sequelize[_0xced9('0x2')],'allowNull':![],'unique':_0xced9('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd3d5=['sequelize','name','STRING'];(function(_0x246c60,_0x47c0de){var _0x2032da=function(_0x5fefa7){while(--_0x5fefa7){_0x246c60['push'](_0x246c60['shift']());}};_0x2032da(++_0x47c0de);}(_0xd3d5,0x123));var _0x5d3d=function(_0x4bb065,_0x5a3b0d){_0x4bb065=_0x4bb065-0x0;var _0x47bee6=_0xd3d5[_0x4bb065];return _0x47bee6;};'use strict';var Sequelize=require(_0x5d3d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5d3d('0x1')},'description':{'type':Sequelize[_0x5d3d('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 474b4f9..eaaea7a 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 _0xdab2=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','Teams','UserProfileResource','stack','name','send','index','map','Team','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getQueues','findOne','channel','Sequelize','Unknown\x20channel','toLowerCase','Queue','sort','get','capitalize','Queues','addQueues','isValidChannel','ValidationError','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Fax','Openchannel','each','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','omit','emit','userTeam:save','removeAgents','voice','chat','mail','sms','openchannel','whatsapp','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','querystring'];(function(_0x21f342,_0x38d943){var _0x8eb05b=function(_0x2be841){while(--_0x2be841){_0x21f342['push'](_0x21f342['shift']());}};_0x8eb05b(++_0x38d943);}(_0xdab2,0x17d));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2dab('0x0'));var emlformat=require(_0x2dab('0x1'));var rimraf=require(_0x2dab('0x2'));var zipdir=require(_0x2dab('0x3'));var jsonpatch=require(_0x2dab('0x4'));var rp=require(_0x2dab('0x5'));var moment=require(_0x2dab('0x6'));var BPromise=require(_0x2dab('0x7'));var Mustache=require(_0x2dab('0x8'));var util=require('util');var path=require(_0x2dab('0x9'));var sox=require(_0x2dab('0xa'));var csv=require(_0x2dab('0xb'));var ejs=require(_0x2dab('0xc'));var fs=require('fs');var _=require(_0x2dab('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2dab('0xb'));var querystring=require(_0x2dab('0xe'));var Papa=require(_0x2dab('0xf'));var Redis=require(_0x2dab('0x10'));var authService=require(_0x2dab('0x11'));var qs=require(_0x2dab('0x12'));var as=require(_0x2dab('0x13'));var hardwareService=require(_0x2dab('0x14'));var logger=require(_0x2dab('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2dab('0x16'));var db=require(_0x2dab('0x17'))['db'];config[_0x2dab('0x18')]=_['defaults'](config[_0x2dab('0x18')],{'host':_0x2dab('0x19'),'port':0x18eb});var socket=require(_0x2dab('0x1a'))(new Redis(config[_0x2dab('0x18')]));require(_0x2dab('0x1b'))['register'](socket);function respondWithStatusCode(_0x12dfd5,_0x468ec0){_0x468ec0=_0x468ec0||0xcc;return function(_0x5bd1d6){if(_0x5bd1d6){return _0x12dfd5[_0x2dab('0x1c')](_0x468ec0);}return _0x12dfd5[_0x2dab('0x1d')](_0x468ec0)[_0x2dab('0x1e')]();};}function respondWithResult(_0x3e0820,_0x2b9421){_0x2b9421=_0x2b9421||0xc8;return function(_0x5eb0f0){if(_0x5eb0f0){return _0x3e0820[_0x2dab('0x1d')](_0x2b9421)[_0x2dab('0x1f')](_0x5eb0f0);}};}function respondWithFilteredResult(_0x3c667e,_0x4a07ce){return function(_0x586d38){if(_0x586d38){var _0x5e6718=_0x586d38[_0x2dab('0x20')],_0x2f0c28=_0x4a07ce[_0x2dab('0x21')],_0x37d2ba=_0x4a07ce['offset']+_0x4a07ce[_0x2dab('0x22')],_0x1fbbd5;if(_0x37d2ba>=_0x5e6718){_0x37d2ba=_0x5e6718;_0x1fbbd5=0xc8;}else{_0x1fbbd5=0xce;}_0x3c667e['status'](_0x1fbbd5);return _0x3c667e[_0x2dab('0x23')](_0x2dab('0x24'),_0x2f0c28+'-'+_0x37d2ba+'/'+_0x5e6718)[_0x2dab('0x1f')](_0x586d38);}return null;};}function patchUpdates(_0x27e867){return function(_0x21e9e0){try{jsonpatch['apply'](_0x21e9e0,_0x27e867,!![]);}catch(_0x1b5a70){return BPromise[_0x2dab('0x25')](_0x1b5a70);}return _0x21e9e0[_0x2dab('0x26')]();};}function saveUpdates(_0x2f9eab,_0x1a929f){return function(_0x45b65a){if(_0x45b65a){return _0x45b65a['update'](_0x2f9eab)[_0x2dab('0x27')](function(_0x241987){return _0x241987;});}return null;};}function removeEntity(_0x57a597,_0x5015e4){return function(_0x3dcb3a){if(_0x3dcb3a){return _0x3dcb3a[_0x2dab('0x28')]()['then'](function(){var _0x410a82=_0x3dcb3a['get']({'plain':!![]});var _0x337dcd=_0x2dab('0x29');return db[_0x2dab('0x2a')]['destroy']({'where':{'type':_0x337dcd,'resourceId':_0x410a82['id']}})[_0x2dab('0x27')](function(){return _0x3dcb3a;});})[_0x2dab('0x27')](function(){_0x57a597[_0x2dab('0x1d')](0xcc)[_0x2dab('0x1e')]();});}};}function handleEntityNotFound(_0xac2b41,_0x238b3e){return function(_0x19cca2){if(!_0x19cca2){_0xac2b41[_0x2dab('0x1c')](0x194);}return _0x19cca2;};}function handleError(_0x234eba,_0x4300c8){_0x4300c8=_0x4300c8||0x1f4;return function(_0x4f93da){logger['error'](_0x4f93da[_0x2dab('0x2b')]);if(_0x4f93da[_0x2dab('0x2c')]){delete _0x4f93da[_0x2dab('0x2c')];}_0x234eba['status'](_0x4300c8)[_0x2dab('0x2d')](_0x4f93da);};}exports[_0x2dab('0x2e')]=function(_0x28dd23,_0x580cc7){var _0xe3d10b={},_0x4955f0={},_0x552c49={'count':0x0,'rows':[]};var _0x1e7d95=_[_0x2dab('0x2f')](db[_0x2dab('0x30')][_0x2dab('0x31')],function(_0x1acd71){return{'name':_0x1acd71[_0x2dab('0x32')],'type':_0x1acd71[_0x2dab('0x33')]['key']};});_0x4955f0['model']=_[_0x2dab('0x2f')](_0x1e7d95,_0x2dab('0x2c'));_0x4955f0[_0x2dab('0x34')]=_[_0x2dab('0x35')](_0x28dd23[_0x2dab('0x34')]);_0x4955f0[_0x2dab('0x36')]=_['intersection'](_0x4955f0[_0x2dab('0x37')],_0x4955f0['query']);_0xe3d10b['attributes']=_[_0x2dab('0x38')](_0x4955f0[_0x2dab('0x37')],qs[_0x2dab('0x39')](_0x28dd23[_0x2dab('0x34')][_0x2dab('0x39')]));_0xe3d10b[_0x2dab('0x3a')]=_0xe3d10b['attributes'][_0x2dab('0x3b')]?_0xe3d10b[_0x2dab('0x3a')]:_0x4955f0['model'];if(!_0x28dd23[_0x2dab('0x34')][_0x2dab('0x3c')](_0x2dab('0x3d'))){_0xe3d10b[_0x2dab('0x22')]=qs['limit'](_0x28dd23[_0x2dab('0x34')][_0x2dab('0x22')]);_0xe3d10b[_0x2dab('0x21')]=qs[_0x2dab('0x21')](_0x28dd23['query'][_0x2dab('0x21')]);}_0xe3d10b[_0x2dab('0x3e')]=qs['sort'](_0x28dd23[_0x2dab('0x34')]['sort']);_0xe3d10b['where']=qs[_0x2dab('0x36')](_[_0x2dab('0x3f')](_0x28dd23['query'],_0x4955f0['filters']),_0x1e7d95);if(_0x28dd23[_0x2dab('0x34')][_0x2dab('0x40')]){_0xe3d10b[_0x2dab('0x41')]=_[_0x2dab('0x42')](_0xe3d10b['where'],{'$or':_[_0x2dab('0x2f')](_0x1e7d95,function(_0x171f9f){if(_0x171f9f['type']!==_0x2dab('0x43')){var _0x5721b4={};_0x5721b4[_0x171f9f[_0x2dab('0x2c')]]={'$like':'%'+_0x28dd23[_0x2dab('0x34')][_0x2dab('0x40')]+'%'};return _0x5721b4;}})});}_0xe3d10b=_[_0x2dab('0x42')]({},_0xe3d10b,_0x28dd23[_0x2dab('0x44')]);var _0x181ed4={'where':_0xe3d10b[_0x2dab('0x41')]};return db['Team'][_0x2dab('0x20')](_0x181ed4)[_0x2dab('0x27')](function(_0x32fb3b){_0x552c49[_0x2dab('0x20')]=_0x32fb3b;if(_0x28dd23[_0x2dab('0x34')][_0x2dab('0x45')]){_0xe3d10b[_0x2dab('0x46')]=[{'all':!![]}];}return db[_0x2dab('0x30')][_0x2dab('0x47')](_0xe3d10b);})[_0x2dab('0x27')](function(_0x47915a){_0x552c49[_0x2dab('0x48')]=_0x47915a;return _0x552c49;})['then'](respondWithFilteredResult(_0x580cc7,_0xe3d10b))[_0x2dab('0x49')](handleError(_0x580cc7,null));};exports['show']=function(_0x30c646,_0x7949d4){var _0x318960={'raw':![],'where':{'id':_0x30c646['params']['id']}},_0xc6b8c5={};_0xc6b8c5[_0x2dab('0x37')]=_[_0x2dab('0x35')](db[_0x2dab('0x30')]['rawAttributes']);_0xc6b8c5[_0x2dab('0x34')]=_['keys'](_0x30c646['query']);_0xc6b8c5[_0x2dab('0x36')]=_[_0x2dab('0x38')](_0xc6b8c5[_0x2dab('0x37')],_0xc6b8c5['query']);_0x318960[_0x2dab('0x3a')]=_[_0x2dab('0x38')](_0xc6b8c5[_0x2dab('0x37')],qs[_0x2dab('0x39')](_0x30c646[_0x2dab('0x34')][_0x2dab('0x39')]));_0x318960[_0x2dab('0x3a')]=_0x318960[_0x2dab('0x3a')][_0x2dab('0x3b')]?_0x318960[_0x2dab('0x3a')]:_0xc6b8c5[_0x2dab('0x37')];if(_0x30c646['query'][_0x2dab('0x45')]){_0x318960[_0x2dab('0x46')]=[{'all':!![]}];}_0x318960=_[_0x2dab('0x42')]({},_0x318960,_0x30c646[_0x2dab('0x44')]);return db[_0x2dab('0x30')]['find'](_0x318960)[_0x2dab('0x27')](handleEntityNotFound(_0x7949d4,null))[_0x2dab('0x27')](respondWithResult(_0x7949d4,null))[_0x2dab('0x49')](handleError(_0x7949d4,null));};exports['create']=function(_0x220ae6,_0xa57e96){return db[_0x2dab('0x30')]['create'](_0x220ae6[_0x2dab('0x4a')],{})[_0x2dab('0x27')](function(_0x26d184){var _0x43f620=_0x220ae6[_0x2dab('0x4b')]['get']({'plain':!![]});if(!_0x43f620)throw new Error(_0x2dab('0x4c'));if(_0x43f620[_0x2dab('0x4d')]===_0x2dab('0x4b')){var _0x395805=_0x26d184['get']({'plain':!![]});var _0xa1fb1f=_0x2dab('0x29');return db[_0x2dab('0x4e')][_0x2dab('0x4f')]({'where':{'name':_0xa1fb1f,'userProfileId':_0x43f620[_0x2dab('0x50')]},'raw':!![]})[_0x2dab('0x27')](function(_0x7d8404){if(_0x7d8404&&_0x7d8404['autoAssociation']===0x0){return db[_0x2dab('0x2a')][_0x2dab('0x51')]({'name':_0x395805['name'],'resourceId':_0x395805['id'],'type':_0x7d8404[_0x2dab('0x2c')],'sectionId':_0x7d8404['id']},{})[_0x2dab('0x27')](function(){return _0x26d184;});}else{return _0x26d184;}})[_0x2dab('0x49')](function(_0x317418){logger[_0x2dab('0x52')](_0x2dab('0x53'),_0x317418);throw _0x317418;});}return _0x26d184;})[_0x2dab('0x27')](respondWithResult(_0xa57e96,0xc9))[_0x2dab('0x49')](handleError(_0xa57e96,null));};exports[_0x2dab('0x54')]=function(_0x42149c,_0x90c863){if(_0x42149c[_0x2dab('0x4a')]['id']){delete _0x42149c[_0x2dab('0x4a')]['id'];}return db['Team'][_0x2dab('0x4f')]({'where':{'id':_0x42149c['params']['id']}})[_0x2dab('0x27')](handleEntityNotFound(_0x90c863,null))['then'](saveUpdates(_0x42149c[_0x2dab('0x4a')],null))[_0x2dab('0x27')](respondWithResult(_0x90c863,null))[_0x2dab('0x49')](handleError(_0x90c863,null));};exports[_0x2dab('0x28')]=function(_0x429c4c,_0x135a5d){return db['Team'][_0x2dab('0x4f')]({'where':{'id':_0x429c4c[_0x2dab('0x55')]['id']}})[_0x2dab('0x27')](handleEntityNotFound(_0x135a5d,null))[_0x2dab('0x27')](removeEntity(_0x135a5d,null))[_0x2dab('0x49')](handleError(_0x135a5d,null));};exports[_0x2dab('0x56')]=function(_0x18ae1d,_0x42aa62,_0x247454){return db[_0x2dab('0x30')][_0x2dab('0x57')]({'where':{'id':_0x18ae1d['params']['id']}})[_0x2dab('0x27')](handleEntityNotFound(_0x42aa62,null))[_0x2dab('0x27')](function(_0x2cffb7){if(!_0x18ae1d[_0x2dab('0x34')][_0x2dab('0x58')]||!utils['isValidChannel'](_0x18ae1d['query'][_0x2dab('0x58')])){throw new db[(_0x2dab('0x59'))]['ValidationError'](_0x2dab('0x5a'));}var _0x2820fa={};var _0x5b4641={};_0x5b4641[_0x2dab('0x37')]=_[_0x2dab('0x35')](db[_['capitalize'](_0x18ae1d[_0x2dab('0x34')][_0x2dab('0x58')][_0x2dab('0x5b')]())+_0x2dab('0x5c')]['rawAttributes']);_0x5b4641[_0x2dab('0x34')]=_[_0x2dab('0x35')](_0x18ae1d['query']);_0x5b4641[_0x2dab('0x36')]=_['intersection'](_0x5b4641[_0x2dab('0x37')],_0x5b4641[_0x2dab('0x34')]);_0x2820fa[_0x2dab('0x3a')]=_[_0x2dab('0x38')](_0x5b4641[_0x2dab('0x37')],qs[_0x2dab('0x39')](_0x18ae1d[_0x2dab('0x34')][_0x2dab('0x39')]));_0x2820fa[_0x2dab('0x3a')]=_0x2820fa['attributes'][_0x2dab('0x3b')]?_0x2820fa['attributes']:_0x5b4641[_0x2dab('0x37')];_0x2820fa[_0x2dab('0x22')]=qs[_0x2dab('0x22')](_0x18ae1d[_0x2dab('0x34')][_0x2dab('0x22')]);_0x2820fa['offset']=qs['offset'](_0x18ae1d[_0x2dab('0x34')]['offset']);_0x2820fa[_0x2dab('0x3e')]=qs[_0x2dab('0x5d')](_0x18ae1d[_0x2dab('0x34')][_0x2dab('0x5d')]);_0x2820fa[_0x2dab('0x41')]=qs[_0x2dab('0x36')](_[_0x2dab('0x3f')](_0x18ae1d['query'],_0x5b4641['filters']));_0x2820fa=_[_0x2dab('0x42')]({},_0x2820fa,_0x18ae1d[_0x2dab('0x44')]);return _0x2cffb7[_0x2dab('0x5e')+_[_0x2dab('0x5f')](_0x18ae1d[_0x2dab('0x34')][_0x2dab('0x58')]['toLowerCase']())+_0x2dab('0x60')](_0x2820fa);})[_0x2dab('0x27')](respondWithResult(_0x42aa62,null))[_0x2dab('0x49')](handleError(_0x42aa62,null));};exports[_0x2dab('0x61')]=function(_0x561ab0,_0x3814bc,_0x282008){return db[_0x2dab('0x30')][_0x2dab('0x57')]({'where':{'id':_0x561ab0[_0x2dab('0x55')]['id']}})[_0x2dab('0x27')](function(_0x1c513d){if(_0x1c513d){if(!_0x561ab0[_0x2dab('0x4a')]['channel']||!utils[_0x2dab('0x62')](_0x561ab0[_0x2dab('0x4a')][_0x2dab('0x58')])){throw new db['Sequelize'][(_0x2dab('0x63'))](_0x2dab('0x5a'));}return _0x1c513d[_0x2dab('0x64')+_[_0x2dab('0x5f')](_0x561ab0['body']['channel'][_0x2dab('0x5b')]())+_0x2dab('0x60')](_0x561ab0[_0x2dab('0x4a')][_0x2dab('0x65')]);}return null;})['then'](handleEntityNotFound(_0x3814bc,null))[_0x2dab('0x27')](respondWithStatusCode(_0x3814bc,null))[_0x2dab('0x49')](handleError(_0x3814bc,null));};exports[_0x2dab('0x66')]=function(_0xed1b9c,_0x2886f1,_0x595a69){return db[_0x2dab('0x30')][_0x2dab('0x57')]({'where':{'id':_0xed1b9c[_0x2dab('0x55')]['id']}})[_0x2dab('0x27')](function(_0x232148){if(_0x232148){if(!_0xed1b9c['query'][_0x2dab('0x58')]||!utils[_0x2dab('0x62')](_0xed1b9c[_0x2dab('0x34')][_0x2dab('0x58')])){throw new db['Sequelize'][(_0x2dab('0x63'))](_0x2dab('0x5a'));}return _0x232148[_0x2dab('0x67')+_[_0x2dab('0x5f')](_0xed1b9c[_0x2dab('0x34')][_0x2dab('0x58')]['toLowerCase']())+_0x2dab('0x60')](_0xed1b9c['query']['ids']);}return null;})[_0x2dab('0x27')](handleEntityNotFound(_0x2886f1,null))[_0x2dab('0x27')](respondWithStatusCode(_0x2886f1,null))[_0x2dab('0x49')](handleError(_0x2886f1,null));};exports[_0x2dab('0x68')]=function(_0x2a2490,_0x20c01d,_0x3b31a2){return db['Team']['find']({'where':{'id':_0x2a2490[_0x2dab('0x55')]['id']}})[_0x2dab('0x27')](handleEntityNotFound(_0x20c01d,null))[_0x2dab('0x27')](function(_0x1462c1){if(_0x1462c1){var _0xffa6ec=[_0x2dab('0x69'),_0x2dab('0x6a'),_0x2dab('0x6b'),'Sms',_0x2dab('0x6c'),_0x2dab('0x6d'),'Whatsapp'];return BPromise[_0x2dab('0x6e')](_0xffa6ec,function(_0x589076){return _0x1462c1[_0x2dab('0x5e')+_0x589076+_0x2dab('0x60')]({'attributes':['id',_0x2dab('0x2c')]})[_0x2dab('0x27')](function(_0x7a2d28){return BPromise[_0x2dab('0x6e')](_0x7a2d28,function(_0x3a7963){return _0x3a7963['addAgents'](_0x2a2490[_0x2dab('0x4a')][_0x2dab('0x65')])[_0x2dab('0x27')](function(){if(_0x589076==='Voice'){return db['User'][_0x2dab('0x47')]({'where':{'id':_0x2a2490['body'][_0x2dab('0x65')]},'attributes':['id','name',_0x2dab('0x6f'),'voicePause',_0x2dab('0x70')],'raw':!![]})['then'](function(_0x34482a){return BPromise[_0x2dab('0x6e')](_[_0x2dab('0x40')](_0x34482a,{'online':0x1}),function(_0x2c04c2){return db[_0x2dab('0x71')][_0x2dab('0x72')]({'membername':_0x2c04c2[_0x2dab('0x2c')],'UserId':_0x2c04c2['id'],'queue_name':_0x3a7963[_0x2dab('0x2c')],'VoiceQueueId':_0x3a7963['id'],'interface':_[_0x2dab('0x73')](_0x2c04c2[_0x2dab('0x70')])?util[_0x2dab('0x74')](_0x2dab('0x75'),_0x2c04c2[_0x2dab('0x2c')]):_0x2c04c2[_0x2dab('0x70')],'paused':_0x2c04c2[_0x2dab('0x76')]||![],'penalty':0x0});});});}});});})[_0x2dab('0x27')](function(){return _0x1462c1;});})[_0x2dab('0x27')](function(){return _0x1462c1;});}})[_0x2dab('0x27')](function(_0x357e65){if(_0x357e65){return _0x357e65['addAgents'](_0x2a2490['body']['ids'],_[_0x2dab('0x77')](_0x2a2490['body'],[_0x2dab('0x65'),'id'])||{})['spread'](function(_0x5c0825){for(var _0x42819a=0x0;_0x42819a<_0x2a2490[_0x2dab('0x4a')][_0x2dab('0x65')][_0x2dab('0x3b')];_0x42819a+=0x1){socket[_0x2dab('0x78')](_0x2dab('0x79'),{'UserId':_0x2a2490[_0x2dab('0x4a')][_0x2dab('0x65')][_0x42819a],'TeamId':_0x2a2490['params']['id']});}return _0x5c0825;});}})['then'](respondWithResult(_0x20c01d,null))[_0x2dab('0x49')](handleError(_0x20c01d,null));};exports[_0x2dab('0x7a')]=function(_0x5401da,_0x4c35ad,_0x4a4166){return db['Team']['find']({'where':{'id':_0x5401da['params']['id']}})[_0x2dab('0x27')](handleEntityNotFound(_0x4c35ad,null))[_0x2dab('0x27')](function(_0x3ac831){if(_0x3ac831){return BPromise['each']([_0x2dab('0x7b'),_0x2dab('0x7c'),_0x2dab('0x7d'),_0x2dab('0x7e'),'fax',_0x2dab('0x7f'),_0x2dab('0x80')],function(_0x4fc28b){return _0x3ac831[_0x2dab('0x5e')+_['capitalize'](_0x4fc28b)+_0x2dab('0x60')]({'attributes':['id','name']})['then'](function(_0x267827){return BPromise[_0x2dab('0x6e')](_0x267827,function(_0x3728df){return _0x3728df[_0x2dab('0x7a')](_0x5401da[_0x2dab('0x34')][_0x2dab('0x65')])['then'](function(){if(_0x4fc28b===_0x2dab('0x7b')){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x3728df['id'],'UserId':_0x5401da[_0x2dab('0x34')][_0x2dab('0x65')]}});}});});})[_0x2dab('0x27')](function(){return _0x3ac831;});})[_0x2dab('0x27')](function(){return _0x3ac831;});}})['then'](function(_0x1ada30){if(_0x1ada30){return _0x1ada30['removeAgents'](_0x5401da['query']['ids'])['then'](function(){if(_[_0x2dab('0x81')](_0x5401da[_0x2dab('0x34')]['ids'])){for(var _0x1082ca=0x0;_0x1082ca<_0x5401da[_0x2dab('0x34')]['ids'][_0x2dab('0x3b')];_0x1082ca+=0x1){socket['emit'](_0x2dab('0x82'),{'UserId':Number(_0x5401da['query'][_0x2dab('0x65')][_0x1082ca]),'TeamId':Number(_0x5401da[_0x2dab('0x55')]['id'])});}}else{socket[_0x2dab('0x78')](_0x2dab('0x82'),{'UserId':Number(_0x5401da['query'][_0x2dab('0x65')]),'TeamId':Number(_0x5401da[_0x2dab('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x4c35ad,null))[_0x2dab('0x49')](handleError(_0x4c35ad,null));};exports[_0x2dab('0x83')]=function(_0x6ba844,_0x5f4205,_0x24a823){var _0x55d39e={};var _0x4e6b72={};var _0x4c4df0;var _0x3fe69b;return db[_0x2dab('0x30')][_0x2dab('0x57')]({'where':{'id':_0x6ba844[_0x2dab('0x55')]['id']}})[_0x2dab('0x27')](handleEntityNotFound(_0x5f4205,null))[_0x2dab('0x27')](function(_0x31e792){if(_0x31e792){_0x4c4df0=_0x31e792;_0x4e6b72[_0x2dab('0x37')]=_[_0x2dab('0x35')](db['User'][_0x2dab('0x31')]);_0x4e6b72[_0x2dab('0x34')]=_['keys'](_0x6ba844[_0x2dab('0x34')]);_0x4e6b72[_0x2dab('0x36')]=_['intersection'](_0x4e6b72[_0x2dab('0x37')],_0x4e6b72[_0x2dab('0x34')]);_0x55d39e[_0x2dab('0x3a')]=_[_0x2dab('0x38')](_0x4e6b72[_0x2dab('0x37')],qs[_0x2dab('0x39')](_0x6ba844[_0x2dab('0x34')][_0x2dab('0x39')]));_0x55d39e[_0x2dab('0x3a')]=_0x55d39e[_0x2dab('0x3a')]['length']?_0x55d39e[_0x2dab('0x3a')]:_0x4e6b72[_0x2dab('0x37')];_0x55d39e[_0x2dab('0x3e')]=qs[_0x2dab('0x5d')](_0x6ba844[_0x2dab('0x34')][_0x2dab('0x5d')]);_0x55d39e[_0x2dab('0x41')]=qs[_0x2dab('0x36')](_[_0x2dab('0x3f')](_0x6ba844['query'],_0x4e6b72[_0x2dab('0x36')]));if(_0x6ba844['query'][_0x2dab('0x40')]){_0x55d39e['where']=_[_0x2dab('0x42')](_0x55d39e[_0x2dab('0x41')],{'$or':_[_0x2dab('0x2f')](_0x55d39e[_0x2dab('0x3a')],function(_0x4ad0b7){var _0x26510e={};_0x26510e[_0x4ad0b7]={'$like':'%'+_0x6ba844['query'][_0x2dab('0x40')]+'%'};return _0x26510e;})});}_0x55d39e=_['merge']({},_0x55d39e,_0x6ba844[_0x2dab('0x44')]);return _0x4c4df0['getAgents'](_0x55d39e);}})['then'](function(_0xef6d7b){if(_0xef6d7b){_0x3fe69b=_0xef6d7b['length'];if(!_0x6ba844[_0x2dab('0x34')][_0x2dab('0x3c')](_0x2dab('0x3d'))){_0x55d39e[_0x2dab('0x22')]=qs[_0x2dab('0x22')](_0x6ba844['query'][_0x2dab('0x22')]);_0x55d39e['offset']=qs[_0x2dab('0x21')](_0x6ba844[_0x2dab('0x34')][_0x2dab('0x21')]);}return _0x4c4df0['getAgents'](_0x55d39e);}})[_0x2dab('0x27')](function(_0x127115){if(_0x127115){return _0x127115?{'count':_0x3fe69b,'rows':_0x127115}:null;}})[_0x2dab('0x27')](respondWithResult(_0x5f4205,null))['catch'](handleError(_0x5f4205,null));}; \ No newline at end of file +var _0x1b43=['params','add','removeQueues','ids','addAgents','Voice','Chat','Mail','Openchannel','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','spread','removeAgents','voice','chat','mail','sms','fax','openchannel','emit','userTeam:remove','getAgents','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','count','set','Content-Range','apply','save','then','destroy','get','Teams','UserProfileResource','end','stack','name','send','map','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','offset','sort','where','filter','VIRTUAL','options','Team','includeAll','include','findAll','catch','show','keys','rawAttributes','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','order','pick','Queues','addQueues'];(function(_0x275a9f,_0x52eb15){var _0x553971=function(_0x22d7b2){while(--_0x22d7b2){_0x275a9f['push'](_0x275a9f['shift']());}};_0x553971(++_0x52eb15);}(_0x1b43,0x19a));var _0x31b4=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x1b43[_0x2cf2e9];return _0xd3670d;};'use strict';var pdf=require(_0x31b4('0x0'));var emlformat=require(_0x31b4('0x1'));var rimraf=require(_0x31b4('0x2'));var zipdir=require(_0x31b4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31b4('0x4'));var moment=require(_0x31b4('0x5'));var BPromise=require(_0x31b4('0x6'));var Mustache=require('mustache');var util=require(_0x31b4('0x7'));var path=require(_0x31b4('0x8'));var sox=require(_0x31b4('0x9'));var csv=require(_0x31b4('0xa'));var ejs=require(_0x31b4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x31b4('0xc'));var jsforce=require(_0x31b4('0xd'));var deskjs=require(_0x31b4('0xe'));var toCsv=require(_0x31b4('0xa'));var querystring=require(_0x31b4('0xf'));var Papa=require(_0x31b4('0x10'));var Redis=require(_0x31b4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x31b4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31b4('0x13'));var logger=require('../../config/logger')(_0x31b4('0x14'));var utils=require(_0x31b4('0x15'));var config=require('../../config/environment');var db=require(_0x31b4('0x16'))['db'];config[_0x31b4('0x17')]=_[_0x31b4('0x18')](config[_0x31b4('0x17')],{'host':_0x31b4('0x19'),'port':0x18eb});var socket=require(_0x31b4('0x1a'))(new Redis(config[_0x31b4('0x17')]));require(_0x31b4('0x1b'))[_0x31b4('0x1c')](socket);function respondWithStatusCode(_0x488c28,_0x2cb4f3){_0x2cb4f3=_0x2cb4f3||0xcc;return function(_0x4d4e10){if(_0x4d4e10){return _0x488c28[_0x31b4('0x1d')](_0x2cb4f3);}return _0x488c28[_0x31b4('0x1e')](_0x2cb4f3)['end']();};}function respondWithResult(_0x1975e8,_0x12f42a){_0x12f42a=_0x12f42a||0xc8;return function(_0x133a8e){if(_0x133a8e){return _0x1975e8[_0x31b4('0x1e')](_0x12f42a)['json'](_0x133a8e);}};}function respondWithFilteredResult(_0x45787b,_0x29e181){return function(_0x2df1dd){if(_0x2df1dd){var _0x351925=_0x2df1dd[_0x31b4('0x1f')],_0x35c8cf=_0x29e181['offset'],_0x150019=_0x29e181['offset']+_0x29e181['limit'],_0x412a21;if(_0x150019>=_0x351925){_0x150019=_0x351925;_0x412a21=0xc8;}else{_0x412a21=0xce;}_0x45787b[_0x31b4('0x1e')](_0x412a21);return _0x45787b[_0x31b4('0x20')](_0x31b4('0x21'),_0x35c8cf+'-'+_0x150019+'/'+_0x351925)['json'](_0x2df1dd);}return null;};}function patchUpdates(_0x1608e1){return function(_0x2957bd){try{jsonpatch[_0x31b4('0x22')](_0x2957bd,_0x1608e1,!![]);}catch(_0x2464da){return BPromise['reject'](_0x2464da);}return _0x2957bd[_0x31b4('0x23')]();};}function saveUpdates(_0x378d6d,_0x1532af){return function(_0x4e676d){if(_0x4e676d){return _0x4e676d['update'](_0x378d6d)[_0x31b4('0x24')](function(_0x59f302){return _0x59f302;});}return null;};}function removeEntity(_0x23a67f,_0x5d9754){return function(_0x4de830){if(_0x4de830){return _0x4de830[_0x31b4('0x25')]()[_0x31b4('0x24')](function(){var _0x46c769=_0x4de830[_0x31b4('0x26')]({'plain':!![]});var _0x50517a=_0x31b4('0x27');return db[_0x31b4('0x28')][_0x31b4('0x25')]({'where':{'type':_0x50517a,'resourceId':_0x46c769['id']}})[_0x31b4('0x24')](function(){return _0x4de830;});})[_0x31b4('0x24')](function(){_0x23a67f[_0x31b4('0x1e')](0xcc)[_0x31b4('0x29')]();});}};}function handleEntityNotFound(_0x4d6f02,_0x54af40){return function(_0x934e2f){if(!_0x934e2f){_0x4d6f02[_0x31b4('0x1d')](0x194);}return _0x934e2f;};}function handleError(_0x3bf5d9,_0x55de5f){_0x55de5f=_0x55de5f||0x1f4;return function(_0x5d4835){logger['error'](_0x5d4835[_0x31b4('0x2a')]);if(_0x5d4835[_0x31b4('0x2b')]){delete _0x5d4835['name'];}_0x3bf5d9['status'](_0x55de5f)[_0x31b4('0x2c')](_0x5d4835);};}exports['index']=function(_0x37bb26,_0x48eec6){var _0x3db389={},_0x14714c={},_0x26335d={'count':0x0,'rows':[]};var _0x30a63d=_[_0x31b4('0x2d')](db['Team']['rawAttributes'],function(_0x7212d2){return{'name':_0x7212d2[_0x31b4('0x2e')],'type':_0x7212d2[_0x31b4('0x2f')]['key']};});_0x14714c[_0x31b4('0x30')]=_[_0x31b4('0x2d')](_0x30a63d,_0x31b4('0x2b'));_0x14714c[_0x31b4('0x31')]=_['keys'](_0x37bb26['query']);_0x14714c[_0x31b4('0x32')]=_['intersection'](_0x14714c[_0x31b4('0x30')],_0x14714c[_0x31b4('0x31')]);_0x3db389[_0x31b4('0x33')]=_[_0x31b4('0x34')](_0x14714c[_0x31b4('0x30')],qs[_0x31b4('0x35')](_0x37bb26['query'][_0x31b4('0x35')]));_0x3db389[_0x31b4('0x33')]=_0x3db389[_0x31b4('0x33')][_0x31b4('0x36')]?_0x3db389['attributes']:_0x14714c[_0x31b4('0x30')];if(!_0x37bb26['query'][_0x31b4('0x37')]('nolimit')){_0x3db389[_0x31b4('0x38')]=qs[_0x31b4('0x38')](_0x37bb26['query']['limit']);_0x3db389[_0x31b4('0x39')]=qs['offset'](_0x37bb26[_0x31b4('0x31')][_0x31b4('0x39')]);}_0x3db389['order']=qs[_0x31b4('0x3a')](_0x37bb26[_0x31b4('0x31')][_0x31b4('0x3a')]);_0x3db389[_0x31b4('0x3b')]=qs[_0x31b4('0x32')](_['pick'](_0x37bb26[_0x31b4('0x31')],_0x14714c[_0x31b4('0x32')]),_0x30a63d);if(_0x37bb26[_0x31b4('0x31')][_0x31b4('0x3c')]){_0x3db389[_0x31b4('0x3b')]=_['merge'](_0x3db389[_0x31b4('0x3b')],{'$or':_[_0x31b4('0x2d')](_0x30a63d,function(_0xbd9e97){if(_0xbd9e97[_0x31b4('0x2f')]!==_0x31b4('0x3d')){var _0x18f030={};_0x18f030[_0xbd9e97['name']]={'$like':'%'+_0x37bb26['query'][_0x31b4('0x3c')]+'%'};return _0x18f030;}})});}_0x3db389=_['merge']({},_0x3db389,_0x37bb26[_0x31b4('0x3e')]);var _0x21d904={'where':_0x3db389['where']};return db[_0x31b4('0x3f')][_0x31b4('0x1f')](_0x21d904)[_0x31b4('0x24')](function(_0xdd22e2){_0x26335d[_0x31b4('0x1f')]=_0xdd22e2;if(_0x37bb26[_0x31b4('0x31')][_0x31b4('0x40')]){_0x3db389[_0x31b4('0x41')]=[{'all':!![]}];}return db['Team'][_0x31b4('0x42')](_0x3db389);})[_0x31b4('0x24')](function(_0x201542){_0x26335d['rows']=_0x201542;return _0x26335d;})[_0x31b4('0x24')](respondWithFilteredResult(_0x48eec6,_0x3db389))[_0x31b4('0x43')](handleError(_0x48eec6,null));};exports[_0x31b4('0x44')]=function(_0x55574c,_0x1f0295){var _0x4c2ee8={'raw':![],'where':{'id':_0x55574c['params']['id']}},_0x5a9600={};_0x5a9600[_0x31b4('0x30')]=_[_0x31b4('0x45')](db[_0x31b4('0x3f')][_0x31b4('0x46')]);_0x5a9600['query']=_[_0x31b4('0x45')](_0x55574c[_0x31b4('0x31')]);_0x5a9600['filters']=_[_0x31b4('0x34')](_0x5a9600[_0x31b4('0x30')],_0x5a9600[_0x31b4('0x31')]);_0x4c2ee8[_0x31b4('0x33')]=_[_0x31b4('0x34')](_0x5a9600[_0x31b4('0x30')],qs[_0x31b4('0x35')](_0x55574c['query'][_0x31b4('0x35')]));_0x4c2ee8['attributes']=_0x4c2ee8[_0x31b4('0x33')][_0x31b4('0x36')]?_0x4c2ee8[_0x31b4('0x33')]:_0x5a9600['model'];if(_0x55574c['query'][_0x31b4('0x40')]){_0x4c2ee8[_0x31b4('0x41')]=[{'all':!![]}];}_0x4c2ee8=_[_0x31b4('0x47')]({},_0x4c2ee8,_0x55574c[_0x31b4('0x3e')]);return db[_0x31b4('0x3f')][_0x31b4('0x48')](_0x4c2ee8)['then'](handleEntityNotFound(_0x1f0295,null))[_0x31b4('0x24')](respondWithResult(_0x1f0295,null))[_0x31b4('0x43')](handleError(_0x1f0295,null));};exports[_0x31b4('0x49')]=function(_0x2c2cb8,_0x1d4dae){return db['Team'][_0x31b4('0x49')](_0x2c2cb8['body'],{})[_0x31b4('0x24')](function(_0xa88109){var _0x4bce54=_0x2c2cb8[_0x31b4('0x4a')]['get']({'plain':!![]});if(!_0x4bce54)throw new Error(_0x31b4('0x4b'));if(_0x4bce54[_0x31b4('0x4c')]==='user'){var _0x5afa08=_0xa88109['get']({'plain':!![]});var _0x43a1f1='Teams';return db[_0x31b4('0x4d')][_0x31b4('0x48')]({'where':{'name':_0x43a1f1,'userProfileId':_0x4bce54[_0x31b4('0x4e')]},'raw':!![]})[_0x31b4('0x24')](function(_0x41660d){if(_0x41660d&&_0x41660d[_0x31b4('0x4f')]===0x0){return db[_0x31b4('0x28')]['create']({'name':_0x5afa08[_0x31b4('0x2b')],'resourceId':_0x5afa08['id'],'type':_0x41660d[_0x31b4('0x2b')],'sectionId':_0x41660d['id']},{})['then'](function(){return _0xa88109;});}else{return _0xa88109;}})['catch'](function(_0xe83b90){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe83b90);throw _0xe83b90;});}return _0xa88109;})[_0x31b4('0x24')](respondWithResult(_0x1d4dae,0xc9))[_0x31b4('0x43')](handleError(_0x1d4dae,null));};exports[_0x31b4('0x50')]=function(_0x299463,_0x159613){if(_0x299463[_0x31b4('0x51')]['id']){delete _0x299463[_0x31b4('0x51')]['id'];}return db['Team']['find']({'where':{'id':_0x299463['params']['id']}})[_0x31b4('0x24')](handleEntityNotFound(_0x159613,null))[_0x31b4('0x24')](saveUpdates(_0x299463[_0x31b4('0x51')],null))[_0x31b4('0x24')](respondWithResult(_0x159613,null))[_0x31b4('0x43')](handleError(_0x159613,null));};exports[_0x31b4('0x25')]=function(_0x3810f9,_0x5e5059){return db[_0x31b4('0x3f')]['find']({'where':{'id':_0x3810f9['params']['id']}})[_0x31b4('0x24')](handleEntityNotFound(_0x5e5059,null))['then'](removeEntity(_0x5e5059,null))['catch'](handleError(_0x5e5059,null));};exports['getQueues']=function(_0x188a98,_0x3babe3,_0x2af164){return db[_0x31b4('0x3f')][_0x31b4('0x52')]({'where':{'id':_0x188a98['params']['id']}})[_0x31b4('0x24')](handleEntityNotFound(_0x3babe3,null))['then'](function(_0x4f3f41){if(!_0x188a98[_0x31b4('0x31')][_0x31b4('0x53')]||!utils[_0x31b4('0x54')](_0x188a98[_0x31b4('0x31')][_0x31b4('0x53')])){throw new db[(_0x31b4('0x55'))][(_0x31b4('0x56'))](_0x31b4('0x57'));}var _0x4b051a={};var _0xecdf38={};_0xecdf38[_0x31b4('0x30')]=_[_0x31b4('0x45')](db[_[_0x31b4('0x58')](_0x188a98[_0x31b4('0x31')][_0x31b4('0x53')][_0x31b4('0x59')]())+'Queue'][_0x31b4('0x46')]);_0xecdf38[_0x31b4('0x31')]=_[_0x31b4('0x45')](_0x188a98[_0x31b4('0x31')]);_0xecdf38[_0x31b4('0x32')]=_[_0x31b4('0x34')](_0xecdf38['model'],_0xecdf38[_0x31b4('0x31')]);_0x4b051a[_0x31b4('0x33')]=_[_0x31b4('0x34')](_0xecdf38[_0x31b4('0x30')],qs['fields'](_0x188a98[_0x31b4('0x31')][_0x31b4('0x35')]));_0x4b051a[_0x31b4('0x33')]=_0x4b051a['attributes'][_0x31b4('0x36')]?_0x4b051a[_0x31b4('0x33')]:_0xecdf38[_0x31b4('0x30')];_0x4b051a[_0x31b4('0x38')]=qs[_0x31b4('0x38')](_0x188a98[_0x31b4('0x31')][_0x31b4('0x38')]);_0x4b051a['offset']=qs[_0x31b4('0x39')](_0x188a98['query'][_0x31b4('0x39')]);_0x4b051a[_0x31b4('0x5a')]=qs[_0x31b4('0x3a')](_0x188a98[_0x31b4('0x31')][_0x31b4('0x3a')]);_0x4b051a[_0x31b4('0x3b')]=qs['filters'](_[_0x31b4('0x5b')](_0x188a98['query'],_0xecdf38['filters']));_0x4b051a=_[_0x31b4('0x47')]({},_0x4b051a,_0x188a98['options']);return _0x4f3f41[_0x31b4('0x26')+_[_0x31b4('0x58')](_0x188a98[_0x31b4('0x31')][_0x31b4('0x53')][_0x31b4('0x59')]())+_0x31b4('0x5c')](_0x4b051a);})[_0x31b4('0x24')](respondWithResult(_0x3babe3,null))[_0x31b4('0x43')](handleError(_0x3babe3,null));};exports[_0x31b4('0x5d')]=function(_0x5dd782,_0x5127aa,_0x295de0){return db[_0x31b4('0x3f')]['findOne']({'where':{'id':_0x5dd782[_0x31b4('0x5e')]['id']}})[_0x31b4('0x24')](function(_0x27930a){if(_0x27930a){if(!_0x5dd782[_0x31b4('0x51')][_0x31b4('0x53')]||!utils[_0x31b4('0x54')](_0x5dd782[_0x31b4('0x51')][_0x31b4('0x53')])){throw new db[(_0x31b4('0x55'))][(_0x31b4('0x56'))]('Unknown\x20channel');}return _0x27930a[_0x31b4('0x5f')+_[_0x31b4('0x58')](_0x5dd782[_0x31b4('0x51')][_0x31b4('0x53')]['toLowerCase']())+_0x31b4('0x5c')](_0x5dd782[_0x31b4('0x51')]['ids']);}return null;})[_0x31b4('0x24')](handleEntityNotFound(_0x5127aa,null))['then'](respondWithStatusCode(_0x5127aa,null))['catch'](handleError(_0x5127aa,null));};exports[_0x31b4('0x60')]=function(_0x48fa92,_0x2cfc12,_0x1080d3){return db[_0x31b4('0x3f')]['findOne']({'where':{'id':_0x48fa92[_0x31b4('0x5e')]['id']}})[_0x31b4('0x24')](function(_0x50e267){if(_0x50e267){if(!_0x48fa92[_0x31b4('0x31')]['channel']||!utils[_0x31b4('0x54')](_0x48fa92[_0x31b4('0x31')][_0x31b4('0x53')])){throw new db[(_0x31b4('0x55'))][(_0x31b4('0x56'))](_0x31b4('0x57'));}return _0x50e267['remove'+_[_0x31b4('0x58')](_0x48fa92['query']['channel']['toLowerCase']())+_0x31b4('0x5c')](_0x48fa92['query'][_0x31b4('0x61')]);}return null;})[_0x31b4('0x24')](handleEntityNotFound(_0x2cfc12,null))[_0x31b4('0x24')](respondWithStatusCode(_0x2cfc12,null))[_0x31b4('0x43')](handleError(_0x2cfc12,null));};exports[_0x31b4('0x62')]=function(_0x6336c,_0x504000,_0x2934dd){return db['Team'][_0x31b4('0x48')]({'where':{'id':_0x6336c[_0x31b4('0x5e')]['id']}})[_0x31b4('0x24')](handleEntityNotFound(_0x504000,null))['then'](function(_0x3b0cb9){if(_0x3b0cb9){var _0x487d97=[_0x31b4('0x63'),_0x31b4('0x64'),_0x31b4('0x65'),'Sms','Fax',_0x31b4('0x66'),'Whatsapp'];return BPromise[_0x31b4('0x67')](_0x487d97,function(_0x5daa03){return _0x3b0cb9[_0x31b4('0x26')+_0x5daa03+_0x31b4('0x5c')]({'attributes':['id','name']})[_0x31b4('0x24')](function(_0x5e586e){return BPromise[_0x31b4('0x67')](_0x5e586e,function(_0x1c1d3c){return _0x1c1d3c[_0x31b4('0x62')](_0x6336c[_0x31b4('0x51')][_0x31b4('0x61')])[_0x31b4('0x24')](function(){if(_0x5daa03==='Voice'){return db[_0x31b4('0x68')][_0x31b4('0x42')]({'where':{'id':_0x6336c[_0x31b4('0x51')][_0x31b4('0x61')]},'attributes':['id',_0x31b4('0x2b'),_0x31b4('0x69'),_0x31b4('0x6a'),_0x31b4('0x6b')],'raw':!![]})['then'](function(_0x315ded){return BPromise[_0x31b4('0x67')](_[_0x31b4('0x3c')](_0x315ded,{'online':0x1}),function(_0x39495b){return db[_0x31b4('0x6c')][_0x31b4('0x6d')]({'membername':_0x39495b[_0x31b4('0x2b')],'UserId':_0x39495b['id'],'queue_name':_0x1c1d3c[_0x31b4('0x2b')],'VoiceQueueId':_0x1c1d3c['id'],'interface':_[_0x31b4('0x6e')](_0x39495b[_0x31b4('0x6b')])?util[_0x31b4('0x6f')](_0x31b4('0x70'),_0x39495b['name']):_0x39495b['interface'],'paused':_0x39495b['voicePause']||![],'penalty':0x0});});});}});});})['then'](function(){return _0x3b0cb9;});})[_0x31b4('0x24')](function(){return _0x3b0cb9;});}})[_0x31b4('0x24')](function(_0x54f2c9){if(_0x54f2c9){return _0x54f2c9['addAgents'](_0x6336c[_0x31b4('0x51')][_0x31b4('0x61')],_[_0x31b4('0x71')](_0x6336c[_0x31b4('0x51')],['ids','id'])||{})[_0x31b4('0x72')](function(_0x2f56b1){for(var _0xe43f99=0x0;_0xe43f99<_0x6336c[_0x31b4('0x51')]['ids'][_0x31b4('0x36')];_0xe43f99+=0x1){socket['emit']('userTeam:save',{'UserId':_0x6336c[_0x31b4('0x51')][_0x31b4('0x61')][_0xe43f99],'TeamId':_0x6336c['params']['id']});}return _0x2f56b1;});}})[_0x31b4('0x24')](respondWithResult(_0x504000,null))['catch'](handleError(_0x504000,null));};exports[_0x31b4('0x73')]=function(_0x1387d4,_0x510879,_0x4f2cb0){return db['Team'][_0x31b4('0x48')]({'where':{'id':_0x1387d4['params']['id']}})[_0x31b4('0x24')](handleEntityNotFound(_0x510879,null))[_0x31b4('0x24')](function(_0x3cdd71){if(_0x3cdd71){return BPromise[_0x31b4('0x67')]([_0x31b4('0x74'),_0x31b4('0x75'),_0x31b4('0x76'),_0x31b4('0x77'),_0x31b4('0x78'),_0x31b4('0x79'),'whatsapp'],function(_0x5c35ca){return _0x3cdd71[_0x31b4('0x26')+_[_0x31b4('0x58')](_0x5c35ca)+_0x31b4('0x5c')]({'attributes':['id','name']})[_0x31b4('0x24')](function(_0x15826b){return BPromise[_0x31b4('0x67')](_0x15826b,function(_0x50bc7a){return _0x50bc7a[_0x31b4('0x73')](_0x1387d4[_0x31b4('0x31')][_0x31b4('0x61')])[_0x31b4('0x24')](function(){if(_0x5c35ca===_0x31b4('0x74')){return db[_0x31b4('0x6c')][_0x31b4('0x25')]({'where':{'VoiceQueueId':_0x50bc7a['id'],'UserId':_0x1387d4[_0x31b4('0x31')][_0x31b4('0x61')]}});}});});})[_0x31b4('0x24')](function(){return _0x3cdd71;});})['then'](function(){return _0x3cdd71;});}})[_0x31b4('0x24')](function(_0x22e2a1){if(_0x22e2a1){return _0x22e2a1[_0x31b4('0x73')](_0x1387d4['query'][_0x31b4('0x61')])['then'](function(){if(_['isArray'](_0x1387d4[_0x31b4('0x31')][_0x31b4('0x61')])){for(var _0x4763e3=0x0;_0x4763e3<_0x1387d4[_0x31b4('0x31')][_0x31b4('0x61')][_0x31b4('0x36')];_0x4763e3+=0x1){socket[_0x31b4('0x7a')](_0x31b4('0x7b'),{'UserId':Number(_0x1387d4[_0x31b4('0x31')][_0x31b4('0x61')][_0x4763e3]),'TeamId':Number(_0x1387d4[_0x31b4('0x5e')]['id'])});}}else{socket['emit'](_0x31b4('0x7b'),{'UserId':Number(_0x1387d4[_0x31b4('0x31')][_0x31b4('0x61')]),'TeamId':Number(_0x1387d4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x510879,null))[_0x31b4('0x43')](handleError(_0x510879,null));};exports[_0x31b4('0x7c')]=function(_0x461173,_0x42ed0b,_0x1dcfc1){var _0xd76a13={};var _0x4bb133={};var _0x3b3d1f;var _0x3a6230;return db[_0x31b4('0x3f')]['findOne']({'where':{'id':_0x461173[_0x31b4('0x5e')]['id']}})[_0x31b4('0x24')](handleEntityNotFound(_0x42ed0b,null))[_0x31b4('0x24')](function(_0x3a1c0e){if(_0x3a1c0e){_0x3b3d1f=_0x3a1c0e;_0x4bb133[_0x31b4('0x30')]=_[_0x31b4('0x45')](db[_0x31b4('0x68')]['rawAttributes']);_0x4bb133['query']=_[_0x31b4('0x45')](_0x461173[_0x31b4('0x31')]);_0x4bb133[_0x31b4('0x32')]=_[_0x31b4('0x34')](_0x4bb133[_0x31b4('0x30')],_0x4bb133[_0x31b4('0x31')]);_0xd76a13[_0x31b4('0x33')]=_['intersection'](_0x4bb133[_0x31b4('0x30')],qs['fields'](_0x461173[_0x31b4('0x31')]['fields']));_0xd76a13['attributes']=_0xd76a13[_0x31b4('0x33')][_0x31b4('0x36')]?_0xd76a13[_0x31b4('0x33')]:_0x4bb133['model'];_0xd76a13['order']=qs[_0x31b4('0x3a')](_0x461173[_0x31b4('0x31')][_0x31b4('0x3a')]);_0xd76a13['where']=qs[_0x31b4('0x32')](_[_0x31b4('0x5b')](_0x461173[_0x31b4('0x31')],_0x4bb133[_0x31b4('0x32')]));if(_0x461173[_0x31b4('0x31')]['filter']){_0xd76a13[_0x31b4('0x3b')]=_[_0x31b4('0x47')](_0xd76a13[_0x31b4('0x3b')],{'$or':_[_0x31b4('0x2d')](_0xd76a13[_0x31b4('0x33')],function(_0xeac2d9){var _0x21e046={};_0x21e046[_0xeac2d9]={'$like':'%'+_0x461173['query']['filter']+'%'};return _0x21e046;})});}_0xd76a13=_[_0x31b4('0x47')]({},_0xd76a13,_0x461173['options']);return _0x3b3d1f[_0x31b4('0x7c')](_0xd76a13);}})[_0x31b4('0x24')](function(_0x13efb5){if(_0x13efb5){_0x3a6230=_0x13efb5[_0x31b4('0x36')];if(!_0x461173[_0x31b4('0x31')][_0x31b4('0x37')](_0x31b4('0x7d'))){_0xd76a13[_0x31b4('0x38')]=qs[_0x31b4('0x38')](_0x461173['query'][_0x31b4('0x38')]);_0xd76a13[_0x31b4('0x39')]=qs[_0x31b4('0x39')](_0x461173['query'][_0x31b4('0x39')]);}return _0x3b3d1f['getAgents'](_0xd76a13);}})[_0x31b4('0x24')](function(_0x304254){if(_0x304254){return _0x304254?{'count':_0x3a6230,'rows':_0x304254}:null;}})[_0x31b4('0x24')](respondWithResult(_0x42ed0b,null))[_0x31b4('0x43')](handleError(_0x42ed0b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index fa6b43e..e47e658 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 _0x6405=['update','remove','emit','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x584510,_0x21c8b9){var _0x15d135=function(_0x2a8e80){while(--_0x2a8e80){_0x584510['push'](_0x584510['shift']());}};_0x15d135(++_0x21c8b9);}(_0x6405,0x13b));var _0x5640=function(_0x48807c,_0x298de8){_0x48807c=_0x48807c-0x0;var _0xdf5f2f=_0x6405[_0x48807c];return _0xdf5f2f;};'use strict';var EventEmitter=require(_0x5640('0x0'));var Team=require(_0x5640('0x1'))['db'][_0x5640('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x5640('0x3')](0x0);var events={'afterCreate':_0x5640('0x4'),'afterUpdate':_0x5640('0x5'),'afterDestroy':_0x5640('0x6')};function emitEvent(_0x3001d4){return function(_0xb82cab,_0x308a96,_0xcc710e){TeamEvents[_0x5640('0x7')](_0x3001d4+':'+_0xb82cab['id'],_0xb82cab);TeamEvents[_0x5640('0x7')](_0x3001d4,_0xb82cab);_0xcc710e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xe9c0=['../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x55072f,_0x1de6dc){var _0x39ed8c=function(_0x3b25b2){while(--_0x3b25b2){_0x55072f['push'](_0x55072f['shift']());}};_0x39ed8c(++_0x1de6dc);}(_0xe9c0,0xb7));var _0x0e9c=function(_0x5acb5c,_0xb2f845){_0x5acb5c=_0x5acb5c-0x0;var _0x359c2b=_0xe9c0[_0x5acb5c];return _0x359c2b;};'use strict';var EventEmitter=require(_0x0e9c('0x0'));var Team=require(_0x0e9c('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e9c('0x2'),'afterUpdate':'update','afterDestroy':_0x0e9c('0x3')};function emitEvent(_0x438da7){return function(_0xbaca88,_0x2bebd8,_0x3d26cf){TeamEvents[_0x0e9c('0x4')](_0x438da7+':'+_0xbaca88['id'],_0xbaca88);TeamEvents[_0x0e9c('0x4')](_0x438da7,_0xbaca88);_0x3d26cf(null);};}for(var e in events){if(events[_0x0e9c('0x5')](e)){var event=events[e];Team[_0x0e9c('0x6')](e,emitEvent(event));}}module[_0x0e9c('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 85cbea5..9a51d45 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 _0xbb4c=['../../config/logger','api','moment','request-promise','path','rimraf','./team.attributes','define','Team','teams','lodash'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xbb4c,0x1ac));var _0xcbb4=function(_0x25b314,_0x2af525){_0x25b314=_0x25b314-0x0;var _0x2f267f=_0xbb4c[_0x25b314];return _0x2f267f;};'use strict';var _=require(_0xcbb4('0x0'));var util=require('util');var logger=require(_0xcbb4('0x1'))(_0xcbb4('0x2'));var moment=require(_0xcbb4('0x3'));var BPromise=require('bluebird');var rp=require(_0xcbb4('0x4'));var fs=require('fs');var path=require(_0xcbb4('0x5'));var rimraf=require(_0xcbb4('0x6'));var config=require('../../config/environment');var attributes=require(_0xcbb4('0x7'));module['exports']=function(_0x23895b,_0x4c9545){return _0x23895b[_0xcbb4('0x8')](_0xcbb4('0x9'),attributes,{'tableName':_0xcbb4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e59=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Team','teams','util','../../config/logger'];(function(_0x588cbd,_0x43b872){var _0x571e75=function(_0x12de7b){while(--_0x12de7b){_0x588cbd['push'](_0x588cbd['shift']());}};_0x571e75(++_0x43b872);}(_0x5e59,0x1d2));var _0x95e5=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x5e59[_0x1e4360];return _0x31e6b4;};'use strict';var _=require('lodash');var util=require(_0x95e5('0x0'));var logger=require(_0x95e5('0x1'))(_0x95e5('0x2'));var moment=require('moment');var BPromise=require(_0x95e5('0x3'));var rp=require(_0x95e5('0x4'));var fs=require('fs');var path=require(_0x95e5('0x5'));var rimraf=require(_0x95e5('0x6'));var config=require(_0x95e5('0x7'));var attributes=require('./team.attributes');module[_0x95e5('0x8')]=function(_0x3c17e3,_0x19d8ca){return _0x3c17e3[_0x95e5('0x9')](_0x95e5('0xa'),attributes,{'tableName':_0x95e5('0xb'),'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 b19130a..0ed552d 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 _0x2ff6=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x386bbf,_0x29f394){var _0x2df2d3=function(_0x15db7b){while(--_0x15db7b){_0x386bbf['push'](_0x386bbf['shift']());}};_0x2df2d3(++_0x29f394);}(_0x2ff6,0x77));var _0x62ff=function(_0x5e65b8,_0x85529c){_0x5e65b8=_0x5e65b8-0x0;var _0x4a29df=_0x2ff6[_0x5e65b8];return _0x4a29df;};'use strict';var _=require(_0x62ff('0x0'));var util=require(_0x62ff('0x1'));var moment=require(_0x62ff('0x2'));var BPromise=require(_0x62ff('0x3'));var rs=require(_0x62ff('0x4'));var fs=require('fs');var Redis=require(_0x62ff('0x5'));var db=require(_0x62ff('0x6'))['db'];var utils=require(_0x62ff('0x7'));var logger=require(_0x62ff('0x8'))(_0x62ff('0x9'));var config=require(_0x62ff('0xa'));var jayson=require(_0x62ff('0xb'));var client=jayson[_0x62ff('0xc')][_0x62ff('0xd')]({'port':0x232a});config[_0x62ff('0xe')]=_[_0x62ff('0xf')](config[_0x62ff('0xe')],{'host':_0x62ff('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62ff('0xe')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x206efd,_0x72e652,_0x18ccc3){return new BPromise(function(_0x1ed2f8,_0x1e8ae9){return client[_0x62ff('0x11')](_0x206efd,_0x18ccc3)[_0x62ff('0x12')](function(_0x52d7d4){logger[_0x62ff('0x13')](_0x62ff('0x14'),_0x72e652,_0x62ff('0x15'));logger[_0x62ff('0x16')]('Team,\x20%s,\x20%s,\x20%s',_0x72e652,'request\x20sent',JSON[_0x62ff('0x17')](_0x52d7d4));if(_0x52d7d4[_0x62ff('0x18')]){if(_0x52d7d4[_0x62ff('0x18')][_0x62ff('0x19')]===0x1f4){logger['error'](_0x62ff('0x14'),_0x72e652,_0x52d7d4[_0x62ff('0x18')][_0x62ff('0x1a')]);return _0x1e8ae9(_0x52d7d4['error']['message']);}logger[_0x62ff('0x18')](_0x62ff('0x14'),_0x72e652,_0x52d7d4['error'][_0x62ff('0x1a')]);return _0x1ed2f8(_0x52d7d4[_0x62ff('0x18')][_0x62ff('0x1a')]);}else{logger[_0x62ff('0x13')](_0x62ff('0x14'),_0x72e652,'request\x20sent');_0x1ed2f8(_0x52d7d4[_0x62ff('0x1b')][_0x62ff('0x1a')]);}})[_0x62ff('0x1c')](function(_0x3ccd61){logger[_0x62ff('0x18')](_0x62ff('0x14'),_0x72e652,_0x3ccd61);_0x1e8ae9(_0x3ccd61);});});} \ No newline at end of file +var _0xeef6=['http','redis','defaults','localhost','request','then','info','request\x20sent','debug','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x120259,_0x32e9df){var _0x7a50a8=function(_0xb9b049){while(--_0xb9b049){_0x120259['push'](_0x120259['shift']());}};_0x7a50a8(++_0x32e9df);}(_0xeef6,0xa0));var _0x6eef=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xeef6[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x6eef('0x0'));var util=require(_0x6eef('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6eef('0x2'));var fs=require('fs');var Redis=require(_0x6eef('0x3'));var db=require(_0x6eef('0x4'))['db'];var utils=require(_0x6eef('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6eef('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6eef('0x7')][_0x6eef('0x8')]({'port':0x232a});config[_0x6eef('0x9')]=_[_0x6eef('0xa')](config[_0x6eef('0x9')],{'host':_0x6eef('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6eef('0x9')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x269b5c,_0x44e5e2,_0x3e7a05){return new BPromise(function(_0x258be5,_0x259e01){return client[_0x6eef('0xc')](_0x269b5c,_0x3e7a05)[_0x6eef('0xd')](function(_0x573447){logger[_0x6eef('0xe')]('Team,\x20%s,\x20%s',_0x44e5e2,_0x6eef('0xf'));logger[_0x6eef('0x10')]('Team,\x20%s,\x20%s,\x20%s',_0x44e5e2,'request\x20sent',JSON[_0x6eef('0x11')](_0x573447));if(_0x573447[_0x6eef('0x12')]){if(_0x573447[_0x6eef('0x12')][_0x6eef('0x13')]===0x1f4){logger[_0x6eef('0x12')](_0x6eef('0x14'),_0x44e5e2,_0x573447[_0x6eef('0x12')][_0x6eef('0x15')]);return _0x259e01(_0x573447['error'][_0x6eef('0x15')]);}logger['error'](_0x6eef('0x14'),_0x44e5e2,_0x573447[_0x6eef('0x12')]['message']);return _0x258be5(_0x573447[_0x6eef('0x12')][_0x6eef('0x15')]);}else{logger['info'](_0x6eef('0x14'),_0x44e5e2,_0x6eef('0xf'));_0x258be5(_0x573447[_0x6eef('0x16')][_0x6eef('0x15')]);}})[_0x6eef('0x17')](function(_0xe20a20){logger['error'](_0x6eef('0x14'),_0x44e5e2,_0xe20a20);_0x259e01(_0xe20a20);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index c63bb74..f052f8d 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 _0x6fc2=['save','remove','removeListener','length','./team.events'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0x6fc2,0x117));var _0x26fc=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6fc2[_0x4c12ec];return _0x3ae42c;};'use strict';var TeamEvents=require(_0x26fc('0x0'));var events=[_0x26fc('0x1'),_0x26fc('0x2'),'update'];function createListener(_0x294784,_0x574483){return function(_0x5d460c){_0x574483['emit'](_0x294784,_0x5d460c);};}function removeListener(_0x5bab33,_0x2cbf9b){return function(){TeamEvents[_0x26fc('0x3')](_0x5bab33,_0x2cbf9b);};}exports['register']=function(_0x12a41d){for(var _0x3018aa=0x0,_0x2f5258=events[_0x26fc('0x4')];_0x3018aa<_0x2f5258;_0x3018aa++){var _0x5c87f2=events[_0x3018aa];var _0x23c15a=createListener('team:'+_0x5c87f2,_0x12a41d);TeamEvents['on'](_0x5c87f2,_0x23c15a);}}; \ No newline at end of file +var _0x77a9=['remove','emit','removeListener','register','./team.events'];(function(_0x52aec5,_0x12af9f){var _0x5d0a76=function(_0x1e93d8){while(--_0x1e93d8){_0x52aec5['push'](_0x52aec5['shift']());}};_0x5d0a76(++_0x12af9f);}(_0x77a9,0x19e));var _0x977a=function(_0x27d29e,_0x46ddcc){_0x27d29e=_0x27d29e-0x0;var _0x174321=_0x77a9[_0x27d29e];return _0x174321;};'use strict';var TeamEvents=require(_0x977a('0x0'));var events=['save',_0x977a('0x1'),'update'];function createListener(_0x15eb44,_0x23a4e3){return function(_0x3807f1){_0x23a4e3[_0x977a('0x2')](_0x15eb44,_0x3807f1);};}function removeListener(_0x520cd7,_0x318fc8){return function(){TeamEvents[_0x977a('0x3')](_0x520cd7,_0x318fc8);};}exports[_0x977a('0x4')]=function(_0x2b4ba5){for(var _0x261e46=0x0,_0x579e03=events['length'];_0x261e46<_0x579e03;_0x261e46++){var _0x2e177f=events[_0x261e46];var _0x12fd82=createListener('team:'+_0x2e177f,_0x2b4ba5);TeamEvents['on'](_0x2e177f,_0x12fd82);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 0fe99c3..9d82ac3 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 _0x1575=['put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','create'];(function(_0x331b90,_0x340456){var _0x3a149b=function(_0x6be932){while(--_0x6be932){_0x331b90['push'](_0x331b90['shift']());}};_0x3a149b(++_0x340456);}(_0x1575,0xc3));var _0x5157=function(_0x29055f,_0x1694ca){_0x29055f=_0x29055f-0x0;var _0x218a7e=_0x1575[_0x29055f];return _0x218a7e;};'use strict';var multer=require(_0x5157('0x0'));var util=require(_0x5157('0x1'));var path=require(_0x5157('0x2'));var timeout=require(_0x5157('0x3'));var express=require(_0x5157('0x4'));var router=express[_0x5157('0x5')]();var auth=require(_0x5157('0x6'));var interaction=require(_0x5157('0x7'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x5157('0x8')]('/',auth[_0x5157('0x9')](),controller['index']);router[_0x5157('0x8')](_0x5157('0xa'),auth[_0x5157('0x9')](),controller['show']);router[_0x5157('0xb')]('/',auth[_0x5157('0x9')](),controller[_0x5157('0xc')]);router[_0x5157('0xd')]('/:id',auth[_0x5157('0x9')](),controller[_0x5157('0xe')]);router[_0x5157('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x228e=['../../components/auth/service','../../config/environment','./template.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','connect-timeout','express'];(function(_0x409add,_0x2c353a){var _0x3893d2=function(_0x20216b){while(--_0x20216b){_0x409add['push'](_0x409add['shift']());}};_0x3893d2(++_0x2c353a);}(_0x228e,0x64));var _0xe228=function(_0x217846,_0x52f3f1){_0x217846=_0x217846-0x0;var _0x2a044f=_0x228e[_0x217846];return _0x2a044f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe228('0x0'));var express=require(_0xe228('0x1'));var router=express['Router']();var auth=require(_0xe228('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xe228('0x3'));var controller=require(_0xe228('0x4'));router[_0xe228('0x5')]('/',auth['isAuthenticated'](),controller[_0xe228('0x6')]);router[_0xe228('0x5')](_0xe228('0x7'),auth[_0xe228('0x8')](),controller[_0xe228('0x9')]);router[_0xe228('0xa')]('/',auth[_0xe228('0x8')](),controller[_0xe228('0xb')]);router[_0xe228('0xc')](_0xe228('0x7'),auth[_0xe228('0x8')](),controller[_0xe228('0xd')]);router[_0xe228('0xe')](_0xe228('0x7'),auth[_0xe228('0x8')](),controller[_0xe228('0xf')]);module[_0xe228('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 19f8844..ccaf417 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 _0x95e2=['STRING','TEXT','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x95e2,0x1af));var _0x295e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x95e2[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x295e('0x0'));module['exports']={'name':{'type':Sequelize[_0x295e('0x1')]},'description':{'type':Sequelize[_0x295e('0x1')]},'html':{'type':Sequelize[_0x295e('0x2')]}}; \ No newline at end of file +var _0xd4a1=['exports','STRING','TEXT','sequelize'];(function(_0x4f5c39,_0x15f99a){var _0x11296f=function(_0x32103e){while(--_0x32103e){_0x4f5c39['push'](_0x4f5c39['shift']());}};_0x11296f(++_0x15f99a);}(_0xd4a1,0x157));var _0x1d4a=function(_0x44c573,_0xfde812){_0x44c573=_0x44c573-0x0;var _0x5dbbe8=_0xd4a1[_0x44c573];return _0x5dbbe8;};'use strict';var Sequelize=require(_0x1d4a('0x0'));module[_0x1d4a('0x1')]={'name':{'type':Sequelize[_0x1d4a('0x2')]},'description':{'type':Sequelize[_0x1d4a('0x2')]},'html':{'type':Sequelize[_0x1d4a('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index b674eec..8098e84 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 _0x56ee=['squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','reject','save','then','destroy','get','Templates','error','stack','name','index','map','Template','rawAttributes','fieldName','type','keys','intersection','query','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash'];(function(_0x2aa921,_0x3f0b6e){var _0x1e3f79=function(_0x2a152b){while(--_0x2a152b){_0x2aa921['push'](_0x2aa921['shift']());}};_0x1e3f79(++_0x3f0b6e);}(_0x56ee,0x1c9));var _0xe56e=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0x56ee[_0x39bc44];return _0x2916d8;};'use strict';var pdf=require(_0xe56e('0x0'));var emlformat=require(_0xe56e('0x1'));var rimraf=require(_0xe56e('0x2'));var zipdir=require(_0xe56e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe56e('0x4'));var moment=require(_0xe56e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe56e('0x6'));var util=require('util');var path=require(_0xe56e('0x7'));var sox=require(_0xe56e('0x8'));var csv=require('to-csv');var ejs=require(_0xe56e('0x9'));var fs=require('fs');var _=require(_0xe56e('0xa'));var squel=require(_0xe56e('0xb'));var crypto=require(_0xe56e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe56e('0xd'));var toCsv=require(_0xe56e('0xe'));var querystring=require(_0xe56e('0xf'));var Papa=require(_0xe56e('0x10'));var Redis=require(_0xe56e('0x11'));var authService=require(_0xe56e('0x12'));var qs=require(_0xe56e('0x13'));var as=require(_0xe56e('0x14'));var hardwareService=require(_0xe56e('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe56e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cc0f8,_0x28d1fc){_0x28d1fc=_0x28d1fc||0xcc;return function(_0x19632f){if(_0x19632f){return _0x1cc0f8[_0xe56e('0x17')](_0x28d1fc);}return _0x1cc0f8['status'](_0x28d1fc)[_0xe56e('0x18')]();};}function respondWithResult(_0x47f2e9,_0x3cd3ac){_0x3cd3ac=_0x3cd3ac||0xc8;return function(_0x372d32){if(_0x372d32){return _0x47f2e9['status'](_0x3cd3ac)[_0xe56e('0x19')](_0x372d32);}};}function respondWithFilteredResult(_0xcb922c,_0x480d35){return function(_0x325e6a){if(_0x325e6a){var _0x49a80e=_0x325e6a[_0xe56e('0x1a')],_0x421962=_0x480d35[_0xe56e('0x1b')],_0x2fe24d=_0x480d35[_0xe56e('0x1b')]+_0x480d35[_0xe56e('0x1c')],_0x3c77b4;if(_0x2fe24d>=_0x49a80e){_0x2fe24d=_0x49a80e;_0x3c77b4=0xc8;}else{_0x3c77b4=0xce;}_0xcb922c[_0xe56e('0x1d')](_0x3c77b4);return _0xcb922c[_0xe56e('0x1e')]('Content-Range',_0x421962+'-'+_0x2fe24d+'/'+_0x49a80e)[_0xe56e('0x19')](_0x325e6a);}return null;};}function patchUpdates(_0x3ab669){return function(_0x223043){try{jsonpatch['apply'](_0x223043,_0x3ab669,!![]);}catch(_0x297636){return BPromise[_0xe56e('0x1f')](_0x297636);}return _0x223043[_0xe56e('0x20')]();};}function saveUpdates(_0x3d0061,_0x271e65){return function(_0x61980c){if(_0x61980c){return _0x61980c['update'](_0x3d0061)[_0xe56e('0x21')](function(_0xa1a4fa){return _0xa1a4fa;});}return null;};}function removeEntity(_0xfaa4c3,_0x419c90){return function(_0xcf492d){if(_0xcf492d){return _0xcf492d[_0xe56e('0x22')]()[_0xe56e('0x21')](function(){var _0x23e7f1=_0xcf492d[_0xe56e('0x23')]({'plain':!![]});var _0x5ee5fa=_0xe56e('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x5ee5fa,'resourceId':_0x23e7f1['id']}})[_0xe56e('0x21')](function(){return _0xcf492d;});})[_0xe56e('0x21')](function(){_0xfaa4c3[_0xe56e('0x1d')](0xcc)[_0xe56e('0x18')]();});}};}function handleEntityNotFound(_0x2f2c94,_0x40a411){return function(_0x21d753){if(!_0x21d753){_0x2f2c94[_0xe56e('0x17')](0x194);}return _0x21d753;};}function handleError(_0x33e118,_0x3b6354){_0x3b6354=_0x3b6354||0x1f4;return function(_0x483e4f){logger[_0xe56e('0x25')](_0x483e4f[_0xe56e('0x26')]);if(_0x483e4f[_0xe56e('0x27')]){delete _0x483e4f[_0xe56e('0x27')];}_0x33e118[_0xe56e('0x1d')](_0x3b6354)['send'](_0x483e4f);};}exports[_0xe56e('0x28')]=function(_0x5e7c70,_0x38ccd5){var _0x4e53a0={},_0x5354ab={},_0x355bc6={'count':0x0,'rows':[]};var _0xa14edb=_[_0xe56e('0x29')](db[_0xe56e('0x2a')][_0xe56e('0x2b')],function(_0x4a761c){return{'name':_0x4a761c[_0xe56e('0x2c')],'type':_0x4a761c[_0xe56e('0x2d')]['key']};});_0x5354ab['model']=_[_0xe56e('0x29')](_0xa14edb,_0xe56e('0x27'));_0x5354ab['query']=_[_0xe56e('0x2e')](_0x5e7c70['query']);_0x5354ab['filters']=_[_0xe56e('0x2f')](_0x5354ab['model'],_0x5354ab[_0xe56e('0x30')]);_0x4e53a0[_0xe56e('0x31')]=_[_0xe56e('0x2f')](_0x5354ab['model'],qs[_0xe56e('0x32')](_0x5e7c70[_0xe56e('0x30')][_0xe56e('0x32')]));_0x4e53a0[_0xe56e('0x31')]=_0x4e53a0[_0xe56e('0x31')][_0xe56e('0x33')]?_0x4e53a0[_0xe56e('0x31')]:_0x5354ab[_0xe56e('0x34')];if(!_0x5e7c70[_0xe56e('0x30')][_0xe56e('0x35')](_0xe56e('0x36'))){_0x4e53a0['limit']=qs[_0xe56e('0x1c')](_0x5e7c70['query'][_0xe56e('0x1c')]);_0x4e53a0[_0xe56e('0x1b')]=qs['offset'](_0x5e7c70[_0xe56e('0x30')]['offset']);}_0x4e53a0['order']=qs[_0xe56e('0x37')](_0x5e7c70[_0xe56e('0x30')][_0xe56e('0x37')]);_0x4e53a0[_0xe56e('0x38')]=qs[_0xe56e('0x39')](_[_0xe56e('0x3a')](_0x5e7c70['query'],_0x5354ab['filters']),_0xa14edb);if(_0x5e7c70[_0xe56e('0x30')]['filter']){_0x4e53a0[_0xe56e('0x38')]=_['merge'](_0x4e53a0[_0xe56e('0x38')],{'$or':_[_0xe56e('0x29')](_0xa14edb,function(_0x48cb58){if(_0x48cb58[_0xe56e('0x2d')]!==_0xe56e('0x3b')){var _0x399456={};_0x399456[_0x48cb58['name']]={'$like':'%'+_0x5e7c70[_0xe56e('0x30')]['filter']+'%'};return _0x399456;}})});}_0x4e53a0=_[_0xe56e('0x3c')]({},_0x4e53a0,_0x5e7c70[_0xe56e('0x3d')]);var _0x430685={'where':_0x4e53a0['where']};return db[_0xe56e('0x2a')]['count'](_0x430685)[_0xe56e('0x21')](function(_0x5aa1d3){_0x355bc6[_0xe56e('0x1a')]=_0x5aa1d3;if(_0x5e7c70[_0xe56e('0x30')][_0xe56e('0x3e')]){_0x4e53a0['include']=[{'all':!![]}];}return db['Template'][_0xe56e('0x3f')](_0x4e53a0);})[_0xe56e('0x21')](function(_0x1d39ea){_0x355bc6[_0xe56e('0x40')]=_0x1d39ea;return _0x355bc6;})[_0xe56e('0x21')](respondWithFilteredResult(_0x38ccd5,_0x4e53a0))[_0xe56e('0x41')](handleError(_0x38ccd5,null));};exports[_0xe56e('0x42')]=function(_0x5ae93f,_0x21ca5a){var _0x52e8e5={'raw':!![],'where':{'id':_0x5ae93f['params']['id']}},_0x90f6cd={};_0x90f6cd['model']=_[_0xe56e('0x2e')](db['Template'][_0xe56e('0x2b')]);_0x90f6cd['query']=_[_0xe56e('0x2e')](_0x5ae93f[_0xe56e('0x30')]);_0x90f6cd[_0xe56e('0x39')]=_[_0xe56e('0x2f')](_0x90f6cd[_0xe56e('0x34')],_0x90f6cd['query']);_0x52e8e5[_0xe56e('0x31')]=_[_0xe56e('0x2f')](_0x90f6cd[_0xe56e('0x34')],qs[_0xe56e('0x32')](_0x5ae93f[_0xe56e('0x30')][_0xe56e('0x32')]));_0x52e8e5[_0xe56e('0x31')]=_0x52e8e5[_0xe56e('0x31')][_0xe56e('0x33')]?_0x52e8e5[_0xe56e('0x31')]:_0x90f6cd[_0xe56e('0x34')];if(_0x5ae93f[_0xe56e('0x30')][_0xe56e('0x3e')]){_0x52e8e5['include']=[{'all':!![]}];}_0x52e8e5=_[_0xe56e('0x3c')]({},_0x52e8e5,_0x5ae93f['options']);return db['Template'][_0xe56e('0x43')](_0x52e8e5)['then'](handleEntityNotFound(_0x21ca5a,null))[_0xe56e('0x21')](respondWithResult(_0x21ca5a,null))[_0xe56e('0x41')](handleError(_0x21ca5a,null));};exports[_0xe56e('0x44')]=function(_0x578b13,_0x1338e8){return db[_0xe56e('0x2a')][_0xe56e('0x44')](_0x578b13['body'],{})[_0xe56e('0x21')](function(_0xf91861){var _0x1f37ad=_0x578b13[_0xe56e('0x45')][_0xe56e('0x23')]({'plain':!![]});if(!_0x1f37ad)throw new Error(_0xe56e('0x46'));if(_0x1f37ad[_0xe56e('0x47')]===_0xe56e('0x45')){var _0x46fa8d=_0xf91861[_0xe56e('0x23')]({'plain':!![]});var _0x2cbaeb=_0xe56e('0x24');return db[_0xe56e('0x48')][_0xe56e('0x43')]({'where':{'name':_0x2cbaeb,'userProfileId':_0x1f37ad[_0xe56e('0x49')]},'raw':!![]})['then'](function(_0x1fe73d){if(_0x1fe73d&&_0x1fe73d[_0xe56e('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x46fa8d['name'],'resourceId':_0x46fa8d['id'],'type':_0x1fe73d[_0xe56e('0x27')],'sectionId':_0x1fe73d['id']},{})[_0xe56e('0x21')](function(){return _0xf91861;});}else{return _0xf91861;}})[_0xe56e('0x41')](function(_0x4ef0f2){logger['error'](_0xe56e('0x4b'),_0x4ef0f2);throw _0x4ef0f2;});}return _0xf91861;})[_0xe56e('0x21')](respondWithResult(_0x1338e8,0xc9))[_0xe56e('0x41')](handleError(_0x1338e8,null));};exports[_0xe56e('0x4c')]=function(_0x22b9d4,_0x1473a6){if(_0x22b9d4[_0xe56e('0x4d')]['id']){delete _0x22b9d4[_0xe56e('0x4d')]['id'];}return db['Template'][_0xe56e('0x43')]({'where':{'id':_0x22b9d4['params']['id']}})[_0xe56e('0x21')](handleEntityNotFound(_0x1473a6,null))['then'](saveUpdates(_0x22b9d4[_0xe56e('0x4d')],null))['then'](respondWithResult(_0x1473a6,null))['catch'](handleError(_0x1473a6,null));};exports['destroy']=function(_0x3b4acb,_0x395fb7){return db[_0xe56e('0x2a')][_0xe56e('0x43')]({'where':{'id':_0x3b4acb['params']['id']}})[_0xe56e('0x21')](handleEntityNotFound(_0x395fb7,null))['then'](removeEntity(_0x395fb7,null))['catch'](handleError(_0x395fb7,null));}; \ No newline at end of file +var _0x319f=['limit','set','Content-Range','apply','reject','save','update','then','destroy','Templates','UserProfileResource','error','name','send','map','Template','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x372c68,_0x46c3ff){var _0x29aea8=function(_0x5107df){while(--_0x5107df){_0x372c68['push'](_0x372c68['shift']());}};_0x29aea8(++_0x46c3ff);}(_0x319f,0xd7));var _0xf319=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x319f[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0xf319('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf319('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf319('0x2'));var rp=require(_0xf319('0x3'));var moment=require('moment');var BPromise=require(_0xf319('0x4'));var Mustache=require('mustache');var util=require(_0xf319('0x5'));var path=require('path');var sox=require(_0xf319('0x6'));var csv=require(_0xf319('0x7'));var ejs=require(_0xf319('0x8'));var fs=require('fs');var _=require(_0xf319('0x9'));var squel=require(_0xf319('0xa'));var crypto=require(_0xf319('0xb'));var jsforce=require(_0xf319('0xc'));var deskjs=require(_0xf319('0xd'));var toCsv=require(_0xf319('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf319('0xe'));var authService=require(_0xf319('0xf'));var qs=require(_0xf319('0x10'));var as=require(_0xf319('0x11'));var hardwareService=require(_0xf319('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf319('0x13'));var config=require(_0xf319('0x14'));var db=require(_0xf319('0x15'))['db'];function respondWithStatusCode(_0x23fd2e,_0x3b45d1){_0x3b45d1=_0x3b45d1||0xcc;return function(_0xf33522){if(_0xf33522){return _0x23fd2e[_0xf319('0x16')](_0x3b45d1);}return _0x23fd2e[_0xf319('0x17')](_0x3b45d1)[_0xf319('0x18')]();};}function respondWithResult(_0x1e843a,_0x21e35b){_0x21e35b=_0x21e35b||0xc8;return function(_0x17e1bf){if(_0x17e1bf){return _0x1e843a[_0xf319('0x17')](_0x21e35b)[_0xf319('0x19')](_0x17e1bf);}};}function respondWithFilteredResult(_0x8ed2b2,_0x3fa178){return function(_0x1594c1){if(_0x1594c1){var _0x703086=_0x1594c1[_0xf319('0x1a')],_0x2b5568=_0x3fa178['offset'],_0x2fed89=_0x3fa178[_0xf319('0x1b')]+_0x3fa178[_0xf319('0x1c')],_0x1bc848;if(_0x2fed89>=_0x703086){_0x2fed89=_0x703086;_0x1bc848=0xc8;}else{_0x1bc848=0xce;}_0x8ed2b2['status'](_0x1bc848);return _0x8ed2b2[_0xf319('0x1d')](_0xf319('0x1e'),_0x2b5568+'-'+_0x2fed89+'/'+_0x703086)['json'](_0x1594c1);}return null;};}function patchUpdates(_0x3d8dd5){return function(_0x48d97b){try{jsonpatch[_0xf319('0x1f')](_0x48d97b,_0x3d8dd5,!![]);}catch(_0x244845){return BPromise[_0xf319('0x20')](_0x244845);}return _0x48d97b[_0xf319('0x21')]();};}function saveUpdates(_0x490943,_0x567d51){return function(_0x39fe0e){if(_0x39fe0e){return _0x39fe0e[_0xf319('0x22')](_0x490943)[_0xf319('0x23')](function(_0x14b3d8){return _0x14b3d8;});}return null;};}function removeEntity(_0x1d878a,_0x4ed5d2){return function(_0x42be76){if(_0x42be76){return _0x42be76[_0xf319('0x24')]()['then'](function(){var _0x46d237=_0x42be76['get']({'plain':!![]});var _0x484b61=_0xf319('0x25');return db[_0xf319('0x26')][_0xf319('0x24')]({'where':{'type':_0x484b61,'resourceId':_0x46d237['id']}})[_0xf319('0x23')](function(){return _0x42be76;});})[_0xf319('0x23')](function(){_0x1d878a[_0xf319('0x17')](0xcc)[_0xf319('0x18')]();});}};}function handleEntityNotFound(_0xdf31ae,_0x1e1dc6){return function(_0x1b048c){if(!_0x1b048c){_0xdf31ae[_0xf319('0x16')](0x194);}return _0x1b048c;};}function handleError(_0xed9a0f,_0x25a7e5){_0x25a7e5=_0x25a7e5||0x1f4;return function(_0x548f55){logger[_0xf319('0x27')](_0x548f55['stack']);if(_0x548f55[_0xf319('0x28')]){delete _0x548f55['name'];}_0xed9a0f[_0xf319('0x17')](_0x25a7e5)[_0xf319('0x29')](_0x548f55);};}exports['index']=function(_0x3b3a77,_0x17aa59){var _0x43012f={},_0x468f95={},_0x5ed088={'count':0x0,'rows':[]};var _0x4d63d8=_[_0xf319('0x2a')](db[_0xf319('0x2b')]['rawAttributes'],function(_0x4188f1){return{'name':_0x4188f1[_0xf319('0x2c')],'type':_0x4188f1['type'][_0xf319('0x2d')]};});_0x468f95[_0xf319('0x2e')]=_[_0xf319('0x2a')](_0x4d63d8,_0xf319('0x28'));_0x468f95['query']=_[_0xf319('0x2f')](_0x3b3a77[_0xf319('0x30')]);_0x468f95[_0xf319('0x31')]=_[_0xf319('0x32')](_0x468f95['model'],_0x468f95[_0xf319('0x30')]);_0x43012f[_0xf319('0x33')]=_[_0xf319('0x32')](_0x468f95['model'],qs[_0xf319('0x34')](_0x3b3a77[_0xf319('0x30')]['fields']));_0x43012f[_0xf319('0x33')]=_0x43012f[_0xf319('0x33')][_0xf319('0x35')]?_0x43012f[_0xf319('0x33')]:_0x468f95[_0xf319('0x2e')];if(!_0x3b3a77[_0xf319('0x30')][_0xf319('0x36')]('nolimit')){_0x43012f[_0xf319('0x1c')]=qs[_0xf319('0x1c')](_0x3b3a77[_0xf319('0x30')]['limit']);_0x43012f['offset']=qs[_0xf319('0x1b')](_0x3b3a77[_0xf319('0x30')]['offset']);}_0x43012f[_0xf319('0x37')]=qs[_0xf319('0x38')](_0x3b3a77[_0xf319('0x30')][_0xf319('0x38')]);_0x43012f[_0xf319('0x39')]=qs[_0xf319('0x31')](_[_0xf319('0x3a')](_0x3b3a77['query'],_0x468f95['filters']),_0x4d63d8);if(_0x3b3a77[_0xf319('0x30')][_0xf319('0x3b')]){_0x43012f[_0xf319('0x39')]=_[_0xf319('0x3c')](_0x43012f['where'],{'$or':_[_0xf319('0x2a')](_0x4d63d8,function(_0x3fbad1){if(_0x3fbad1[_0xf319('0x3d')]!==_0xf319('0x3e')){var _0x45e700={};_0x45e700[_0x3fbad1['name']]={'$like':'%'+_0x3b3a77['query'][_0xf319('0x3b')]+'%'};return _0x45e700;}})});}_0x43012f=_['merge']({},_0x43012f,_0x3b3a77['options']);var _0x589062={'where':_0x43012f[_0xf319('0x39')]};return db['Template']['count'](_0x589062)[_0xf319('0x23')](function(_0x28024c){_0x5ed088[_0xf319('0x1a')]=_0x28024c;if(_0x3b3a77[_0xf319('0x30')][_0xf319('0x3f')]){_0x43012f[_0xf319('0x40')]=[{'all':!![]}];}return db[_0xf319('0x2b')]['findAll'](_0x43012f);})[_0xf319('0x23')](function(_0x544fb9){_0x5ed088[_0xf319('0x41')]=_0x544fb9;return _0x5ed088;})[_0xf319('0x23')](respondWithFilteredResult(_0x17aa59,_0x43012f))[_0xf319('0x42')](handleError(_0x17aa59,null));};exports[_0xf319('0x43')]=function(_0x2d8106,_0x3d19bd){var _0x580ae6={'raw':!![],'where':{'id':_0x2d8106[_0xf319('0x44')]['id']}},_0x4afc30={};_0x4afc30['model']=_[_0xf319('0x2f')](db[_0xf319('0x2b')][_0xf319('0x45')]);_0x4afc30[_0xf319('0x30')]=_[_0xf319('0x2f')](_0x2d8106['query']);_0x4afc30[_0xf319('0x31')]=_[_0xf319('0x32')](_0x4afc30[_0xf319('0x2e')],_0x4afc30['query']);_0x580ae6[_0xf319('0x33')]=_[_0xf319('0x32')](_0x4afc30['model'],qs[_0xf319('0x34')](_0x2d8106[_0xf319('0x30')][_0xf319('0x34')]));_0x580ae6['attributes']=_0x580ae6[_0xf319('0x33')][_0xf319('0x35')]?_0x580ae6[_0xf319('0x33')]:_0x4afc30[_0xf319('0x2e')];if(_0x2d8106['query'][_0xf319('0x3f')]){_0x580ae6[_0xf319('0x40')]=[{'all':!![]}];}_0x580ae6=_['merge']({},_0x580ae6,_0x2d8106[_0xf319('0x46')]);return db[_0xf319('0x2b')]['find'](_0x580ae6)[_0xf319('0x23')](handleEntityNotFound(_0x3d19bd,null))[_0xf319('0x23')](respondWithResult(_0x3d19bd,null))['catch'](handleError(_0x3d19bd,null));};exports[_0xf319('0x47')]=function(_0x3998f1,_0x120e51){return db['Template'][_0xf319('0x47')](_0x3998f1['body'],{})[_0xf319('0x23')](function(_0x39e09e){var _0x5effc1=_0x3998f1['user']['get']({'plain':!![]});if(!_0x5effc1)throw new Error(_0xf319('0x48'));if(_0x5effc1[_0xf319('0x49')]===_0xf319('0x4a')){var _0x31eccf=_0x39e09e[_0xf319('0x4b')]({'plain':!![]});var _0x6835e8=_0xf319('0x25');return db[_0xf319('0x4c')][_0xf319('0x4d')]({'where':{'name':_0x6835e8,'userProfileId':_0x5effc1['userProfileId']},'raw':!![]})['then'](function(_0x4d0f1d){if(_0x4d0f1d&&_0x4d0f1d[_0xf319('0x4e')]===0x0){return db[_0xf319('0x26')][_0xf319('0x47')]({'name':_0x31eccf[_0xf319('0x28')],'resourceId':_0x31eccf['id'],'type':_0x4d0f1d[_0xf319('0x28')],'sectionId':_0x4d0f1d['id']},{})[_0xf319('0x23')](function(){return _0x39e09e;});}else{return _0x39e09e;}})[_0xf319('0x42')](function(_0x4f6244){logger[_0xf319('0x27')](_0xf319('0x4f'),_0x4f6244);throw _0x4f6244;});}return _0x39e09e;})[_0xf319('0x23')](respondWithResult(_0x120e51,0xc9))[_0xf319('0x42')](handleError(_0x120e51,null));};exports[_0xf319('0x22')]=function(_0x324aa5,_0x10f0a0){if(_0x324aa5['body']['id']){delete _0x324aa5[_0xf319('0x50')]['id'];}return db[_0xf319('0x2b')][_0xf319('0x4d')]({'where':{'id':_0x324aa5['params']['id']}})[_0xf319('0x23')](handleEntityNotFound(_0x10f0a0,null))[_0xf319('0x23')](saveUpdates(_0x324aa5[_0xf319('0x50')],null))[_0xf319('0x23')](respondWithResult(_0x10f0a0,null))[_0xf319('0x42')](handleError(_0x10f0a0,null));};exports[_0xf319('0x24')]=function(_0x181df0,_0x519de7){return db[_0xf319('0x2b')]['find']({'where':{'id':_0x181df0['params']['id']}})[_0xf319('0x23')](handleEntityNotFound(_0x519de7,null))[_0xf319('0x23')](removeEntity(_0x519de7,null))['catch'](handleError(_0x519de7,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 86c3668..84f29a7 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 _0x430b=['path','../../config/environment','Template','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x118311,_0x900858){var _0x389ed9=function(_0x67b851){while(--_0x67b851){_0x118311['push'](_0x118311['shift']());}};_0x389ed9(++_0x900858);}(_0x430b,0x186));var _0xb430=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x430b[_0x35d4e9];return _0x5c2770;};'use strict';var _=require(_0xb430('0x0'));var util=require(_0xb430('0x1'));var logger=require(_0xb430('0x2'))(_0xb430('0x3'));var moment=require('moment');var BPromise=require(_0xb430('0x4'));var rp=require(_0xb430('0x5'));var fs=require('fs');var path=require(_0xb430('0x6'));var rimraf=require('rimraf');var config=require(_0xb430('0x7'));var attributes=require('./template.attributes');module['exports']=function(_0x328932,_0x4800c6){return _0x328932['define'](_0xb430('0x8'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3024=['tools_templates','lodash','util','api','moment','path','../../config/environment','./template.attributes','Template'];(function(_0x4b94b4,_0x174bbf){var _0x1597ce=function(_0x26fef1){while(--_0x26fef1){_0x4b94b4['push'](_0x4b94b4['shift']());}};_0x1597ce(++_0x174bbf);}(_0x3024,0x64));var _0x4302=function(_0x5ecfa3,_0x5b55db){_0x5ecfa3=_0x5ecfa3-0x0;var _0x31ec93=_0x3024[_0x5ecfa3];return _0x31ec93;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var logger=require('../../config/logger')(_0x4302('0x2'));var moment=require(_0x4302('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4302('0x4'));var rimraf=require('rimraf');var config=require(_0x4302('0x5'));var attributes=require(_0x4302('0x6'));module['exports']=function(_0x13d051,_0x5f20){return _0x13d051['define'](_0x4302('0x7'),attributes,{'tableName':_0x4302('0x8'),'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 0bd4ca3..8230e06 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 _0x6ab3=['Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x6ab3,0x16f));var _0x36ab=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x6ab3[_0x53ad58];return _0x554b03;};'use strict';var _=require(_0x36ab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x36ab('0x1'));var rs=require(_0x36ab('0x2'));var fs=require('fs');var Redis=require(_0x36ab('0x3'));var db=require(_0x36ab('0x4'))['db'];var utils=require(_0x36ab('0x5'));var logger=require(_0x36ab('0x6'))(_0x36ab('0x7'));var config=require(_0x36ab('0x8'));var jayson=require(_0x36ab('0x9'));var client=jayson[_0x36ab('0xa')][_0x36ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32437e,_0x568f0c,_0x325939){return new BPromise(function(_0x111e70,_0x689b89){return client[_0x36ab('0xc')](_0x32437e,_0x325939)[_0x36ab('0xd')](function(_0x1cedf5){logger[_0x36ab('0xe')](_0x36ab('0xf'),_0x568f0c,_0x36ab('0x10'));logger[_0x36ab('0x11')](_0x36ab('0x12'),_0x568f0c,'request\x20sent',JSON['stringify'](_0x1cedf5));if(_0x1cedf5['error']){if(_0x1cedf5[_0x36ab('0x13')][_0x36ab('0x14')]===0x1f4){logger[_0x36ab('0x13')]('Template,\x20%s,\x20%s',_0x568f0c,_0x1cedf5[_0x36ab('0x13')][_0x36ab('0x15')]);return _0x689b89(_0x1cedf5[_0x36ab('0x13')][_0x36ab('0x15')]);}logger[_0x36ab('0x13')](_0x36ab('0xf'),_0x568f0c,_0x1cedf5[_0x36ab('0x13')][_0x36ab('0x15')]);return _0x111e70(_0x1cedf5[_0x36ab('0x13')][_0x36ab('0x15')]);}else{logger['info'](_0x36ab('0xf'),_0x568f0c,_0x36ab('0x10'));_0x111e70(_0x1cedf5[_0x36ab('0x16')][_0x36ab('0x15')]);}})[_0x36ab('0x17')](function(_0x79251b){logger[_0x36ab('0x13')](_0x36ab('0xf'),_0x568f0c,_0x79251b);_0x689b89(_0x79251b);});});}exports[_0x36ab('0x18')]=function(_0x44035c){var _0x172b5e=this;return new Promise(function(_0x40f5b2,_0x35349a){return db[_0x36ab('0x19')]['findAll']({'raw':_0x44035c[_0x36ab('0x1a')]?_0x44035c['options'][_0x36ab('0x1b')]===undefined?!![]:![]:!![],'where':_0x44035c[_0x36ab('0x1a')]?_0x44035c[_0x36ab('0x1a')][_0x36ab('0x1c')]||null:null,'attributes':_0x44035c['options']?_0x44035c[_0x36ab('0x1a')][_0x36ab('0x1d')]||null:null,'limit':_0x44035c['options']?_0x44035c[_0x36ab('0x1a')][_0x36ab('0x1e')]||null:null,'include':_0x44035c['options']?_0x44035c[_0x36ab('0x1a')][_0x36ab('0x1f')]?_[_0x36ab('0x20')](_0x44035c[_0x36ab('0x1a')]['include'],function(_0x59841b){return{'model':db[_0x59841b[_0x36ab('0x21')]],'as':_0x59841b['as'],'attributes':_0x59841b['attributes'],'include':_0x59841b[_0x36ab('0x1f')]?_[_0x36ab('0x20')](_0x59841b[_0x36ab('0x1f')],function(_0xa72a98){return{'model':db[_0xa72a98[_0x36ab('0x21')]],'as':_0xa72a98['as'],'attributes':_0xa72a98[_0x36ab('0x1d')],'include':_0xa72a98[_0x36ab('0x1f')]?_[_0x36ab('0x20')](_0xa72a98['include'],function(_0xfc27ae){return{'model':db[_0xfc27ae[_0x36ab('0x21')]],'as':_0xfc27ae['as'],'attributes':_0xfc27ae['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bf16d){logger['info'](_0x36ab('0x18'),_0x44035c);logger[_0x36ab('0x11')](_0x36ab('0x18'),_0x44035c,JSON[_0x36ab('0x22')](_0x5bf16d));_0x40f5b2(_0x5bf16d);})[_0x36ab('0x17')](function(_0x5809dc){logger['error'](_0x36ab('0x18'),_0x5809dc[_0x36ab('0x15')],_0x44035c);_0x35349a(_0x172b5e[_0x36ab('0x13')](0x1f4,_0x5809dc[_0x36ab('0x15')]));});});}; \ No newline at end of file +var _0xbd46=['catch','GetTemplate','Template','options','raw','where','limit','map','include','attributes','model','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x5351e0,_0x2fca27){var _0x254a60=function(_0x31c7da){while(--_0x31c7da){_0x5351e0['push'](_0x5351e0['shift']());}};_0x254a60(++_0x2fca27);}(_0xbd46,0xb6));var _0x6bd4=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0xbd46[_0x1d426f];return _0x17f71a;};'use strict';var _=require(_0x6bd4('0x0'));var util=require(_0x6bd4('0x1'));var moment=require(_0x6bd4('0x2'));var BPromise=require('bluebird');var rs=require(_0x6bd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bd4('0x4'))['db'];var utils=require(_0x6bd4('0x5'));var logger=require(_0x6bd4('0x6'))('rpc');var config=require(_0x6bd4('0x7'));var jayson=require(_0x6bd4('0x8'));var client=jayson[_0x6bd4('0x9')][_0x6bd4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ff665,_0x1a116b,_0x156fbc){return new BPromise(function(_0x5ad25c,_0x222ab8){return client[_0x6bd4('0xb')](_0x3ff665,_0x156fbc)[_0x6bd4('0xc')](function(_0x1001ec){logger['info'](_0x6bd4('0xd'),_0x1a116b,_0x6bd4('0xe'));logger['debug'](_0x6bd4('0xf'),_0x1a116b,_0x6bd4('0xe'),JSON[_0x6bd4('0x10')](_0x1001ec));if(_0x1001ec[_0x6bd4('0x11')]){if(_0x1001ec[_0x6bd4('0x11')][_0x6bd4('0x12')]===0x1f4){logger[_0x6bd4('0x11')]('Template,\x20%s,\x20%s',_0x1a116b,_0x1001ec[_0x6bd4('0x11')][_0x6bd4('0x13')]);return _0x222ab8(_0x1001ec[_0x6bd4('0x11')][_0x6bd4('0x13')]);}logger[_0x6bd4('0x11')](_0x6bd4('0xd'),_0x1a116b,_0x1001ec['error']['message']);return _0x5ad25c(_0x1001ec['error'][_0x6bd4('0x13')]);}else{logger[_0x6bd4('0x14')](_0x6bd4('0xd'),_0x1a116b,_0x6bd4('0xe'));_0x5ad25c(_0x1001ec[_0x6bd4('0x15')][_0x6bd4('0x13')]);}})[_0x6bd4('0x16')](function(_0x52f2e1){logger[_0x6bd4('0x11')]('Template,\x20%s,\x20%s',_0x1a116b,_0x52f2e1);_0x222ab8(_0x52f2e1);});});}exports[_0x6bd4('0x17')]=function(_0x35f988){var _0x3df7e7=this;return new Promise(function(_0x1f705d,_0x19cf1a){return db[_0x6bd4('0x18')]['findAll']({'raw':_0x35f988['options']?_0x35f988[_0x6bd4('0x19')][_0x6bd4('0x1a')]===undefined?!![]:![]:!![],'where':_0x35f988[_0x6bd4('0x19')]?_0x35f988[_0x6bd4('0x19')][_0x6bd4('0x1b')]||null:null,'attributes':_0x35f988['options']?_0x35f988[_0x6bd4('0x19')]['attributes']||null:null,'limit':_0x35f988[_0x6bd4('0x19')]?_0x35f988[_0x6bd4('0x19')][_0x6bd4('0x1c')]||null:null,'include':_0x35f988[_0x6bd4('0x19')]?_0x35f988[_0x6bd4('0x19')]['include']?_[_0x6bd4('0x1d')](_0x35f988['options'][_0x6bd4('0x1e')],function(_0x1bb111){return{'model':db[_0x1bb111['model']],'as':_0x1bb111['as'],'attributes':_0x1bb111[_0x6bd4('0x1f')],'include':_0x1bb111[_0x6bd4('0x1e')]?_[_0x6bd4('0x1d')](_0x1bb111['include'],function(_0x36efdd){return{'model':db[_0x36efdd[_0x6bd4('0x20')]],'as':_0x36efdd['as'],'attributes':_0x36efdd[_0x6bd4('0x1f')],'include':_0x36efdd['include']?_[_0x6bd4('0x1d')](_0x36efdd[_0x6bd4('0x1e')],function(_0x130b35){return{'model':db[_0x130b35[_0x6bd4('0x20')]],'as':_0x130b35['as'],'attributes':_0x130b35[_0x6bd4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6bd4('0xc')](function(_0x33bc81){logger[_0x6bd4('0x14')](_0x6bd4('0x17'),_0x35f988);logger[_0x6bd4('0x21')](_0x6bd4('0x17'),_0x35f988,JSON[_0x6bd4('0x10')](_0x33bc81));_0x1f705d(_0x33bc81);})['catch'](function(_0x38a623){logger[_0x6bd4('0x11')]('GetTemplate',_0x38a623[_0x6bd4('0x13')],_0x35f988);_0x19cf1a(_0x3df7e7[_0x6bd4('0x11')](0x1f4,_0x38a623['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 2757657..bbb2567 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 _0x69d5=['update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','/:id/actions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','put'];(function(_0x3053a0,_0x2dff34){var _0x21b751=function(_0x2a266f){while(--_0x2a266f){_0x3053a0['push'](_0x3053a0['shift']());}};_0x21b751(++_0x2dff34);}(_0x69d5,0x1cd));var _0x569d=function(_0xcdfe89,_0x29e34b){_0xcdfe89=_0xcdfe89-0x0;var _0xdaef56=_0x69d5[_0xcdfe89];return _0xdaef56;};'use strict';var multer=require(_0x569d('0x0'));var util=require(_0x569d('0x1'));var path=require(_0x569d('0x2'));var timeout=require(_0x569d('0x3'));var express=require('express');var router=express[_0x569d('0x4')]();var auth=require(_0x569d('0x5'));var interaction=require(_0x569d('0x6'));var config=require('../../config/environment');var controller=require(_0x569d('0x7'));router[_0x569d('0x8')]('/',auth[_0x569d('0x9')](),controller[_0x569d('0xa')]);router[_0x569d('0x8')](_0x569d('0xb'),auth[_0x569d('0x9')](),controller[_0x569d('0xc')]);router[_0x569d('0x8')]('/:id/all_conditions',auth[_0x569d('0x9')](),controller[_0x569d('0xd')]);router[_0x569d('0x8')](_0x569d('0xe'),auth[_0x569d('0x9')](),controller['getAnyConditions']);router['get'](_0x569d('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0x569d('0x10')]('/',auth[_0x569d('0x9')](),controller[_0x569d('0x11')]);router[_0x569d('0x10')](_0x569d('0x12'),auth['isAuthenticated'](),controller[_0x569d('0x13')]);router['post']('/:id/any_conditions',auth[_0x569d('0x9')](),controller[_0x569d('0x14')]);router['post'](_0x569d('0xf'),auth[_0x569d('0x9')](),controller['addAction']);router[_0x569d('0x15')]('/:id',auth[_0x569d('0x9')](),controller[_0x569d('0x16')]);router['delete'](_0x569d('0xb'),auth[_0x569d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xea0f=['getActions','post','create','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','update','delete','/:id','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','/:id/all_conditions'];(function(_0x1bac43,_0x36d42d){var _0x633e2f=function(_0x950676){while(--_0x950676){_0x1bac43['push'](_0x1bac43['shift']());}};_0x633e2f(++_0x36d42d);}(_0xea0f,0x96));var _0xfea0=function(_0x4565fb,_0x338c60){_0x4565fb=_0x4565fb-0x0;var _0xdcdd88=_0xea0f[_0x4565fb];return _0xdcdd88;};'use strict';var multer=require(_0xfea0('0x0'));var util=require(_0xfea0('0x1'));var path=require(_0xfea0('0x2'));var timeout=require('connect-timeout');var express=require(_0xfea0('0x3'));var router=express[_0xfea0('0x4')]();var auth=require(_0xfea0('0x5'));var interaction=require(_0xfea0('0x6'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xfea0('0x7')]('/',auth[_0xfea0('0x8')](),controller['index']);router[_0xfea0('0x7')]('/:id',auth[_0xfea0('0x8')](),controller[_0xfea0('0x9')]);router[_0xfea0('0x7')](_0xfea0('0xa'),auth['isAuthenticated'](),controller['getAllConditions']);router['get']('/:id/any_conditions',auth[_0xfea0('0x8')](),controller['getAnyConditions']);router['get']('/:id/actions',auth[_0xfea0('0x8')](),controller[_0xfea0('0xb')]);router[_0xfea0('0xc')]('/',auth['isAuthenticated'](),controller[_0xfea0('0xd')]);router[_0xfea0('0xc')](_0xfea0('0xa'),auth[_0xfea0('0x8')](),controller['addAllCondition']);router[_0xfea0('0xc')](_0xfea0('0xe'),auth[_0xfea0('0x8')](),controller[_0xfea0('0xf')]);router[_0xfea0('0xc')](_0xfea0('0x10'),auth[_0xfea0('0x8')](),controller[_0xfea0('0x11')]);router[_0xfea0('0x12')]('/:id',auth[_0xfea0('0x8')](),controller[_0xfea0('0x13')]);router[_0xfea0('0x14')](_0xfea0('0x15'),auth['isAuthenticated'](),controller['destroy']);module[_0xfea0('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6d60fa5..9c2b384 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 _0x6ff3=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5116f0,_0x253c87){var _0x4a64e2=function(_0x49fd86){while(--_0x49fd86){_0x5116f0['push'](_0x5116f0['shift']());}};_0x4a64e2(++_0x253c87);}(_0x6ff3,0x7d));var _0x36ff=function(_0x3d6bb4,_0x2eeac8){_0x3d6bb4=_0x3d6bb4-0x0;var _0x3f19e2=_0x6ff3[_0x3d6bb4];return _0x3f19e2;};'use strict';var Sequelize=require(_0x36ff('0x0'));module[_0x36ff('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x36ff('0x2')]},'status':{'type':Sequelize[_0x36ff('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8dd7=['sequelize','STRING','BOOLEAN'];(function(_0x3e186f,_0x2eb7be){var _0x3595bf=function(_0x5cb578){while(--_0x5cb578){_0x3e186f['push'](_0x3e186f['shift']());}};_0x3595bf(++_0x2eb7be);}(_0x8dd7,0x6f));var _0x78dd=function(_0x50a45f,_0x428399){_0x50a45f=_0x50a45f-0x0;var _0x5279ef=_0x8dd7[_0x50a45f];return _0x5279ef;};'use strict';var Sequelize=require(_0x78dd('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x78dd('0x1')]},'description':{'type':Sequelize[_0x78dd('0x1')]},'status':{'type':Sequelize[_0x78dd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5be0cad..cb0bc19 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 _0x7b1b=['stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','Trigger','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','hasOwnProperty','nolimit','getAnyConditions','findOne','TriggerId','Action','getActions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','Triggers','UserProfileResource'];(function(_0x2eee25,_0x53460d){var _0x1cb8c4=function(_0x4dad56){while(--_0x4dad56){_0x2eee25['push'](_0x2eee25['shift']());}};_0x1cb8c4(++_0x53460d);}(_0x7b1b,0x149));var _0xb7b1=function(_0x24b12d,_0x24c4a2){_0x24b12d=_0x24b12d-0x0;var _0x442e40=_0x7b1b[_0x24b12d];return _0x442e40;};'use strict';var pdf=require(_0xb7b1('0x0'));var emlformat=require(_0xb7b1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb7b1('0x2'));var rp=require(_0xb7b1('0x3'));var moment=require(_0xb7b1('0x4'));var BPromise=require(_0xb7b1('0x5'));var Mustache=require(_0xb7b1('0x6'));var util=require(_0xb7b1('0x7'));var path=require('path');var sox=require(_0xb7b1('0x8'));var csv=require(_0xb7b1('0x9'));var ejs=require(_0xb7b1('0xa'));var fs=require('fs');var _=require(_0xb7b1('0xb'));var squel=require(_0xb7b1('0xc'));var crypto=require('crypto');var jsforce=require(_0xb7b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb7b1('0x9'));var querystring=require(_0xb7b1('0xe'));var Papa=require(_0xb7b1('0xf'));var Redis=require(_0xb7b1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb7b1('0x11'));var as=require(_0xb7b1('0x12'));var hardwareService=require(_0xb7b1('0x13'));var logger=require('../../config/logger')(_0xb7b1('0x14'));var utils=require(_0xb7b1('0x15'));var config=require(_0xb7b1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x145ea1,_0x15684a){_0x15684a=_0x15684a||0xcc;return function(_0x35adaa){if(_0x35adaa){return _0x145ea1[_0xb7b1('0x17')](_0x15684a);}return _0x145ea1['status'](_0x15684a)[_0xb7b1('0x18')]();};}function respondWithResult(_0xbecd1d,_0x4bde0d){_0x4bde0d=_0x4bde0d||0xc8;return function(_0x5bfd13){if(_0x5bfd13){return _0xbecd1d['status'](_0x4bde0d)[_0xb7b1('0x19')](_0x5bfd13);}};}function respondWithFilteredResult(_0x6072b7,_0xba95f0){return function(_0x470447){if(_0x470447){var _0x1f694a=_0x470447[_0xb7b1('0x1a')],_0x59214d=_0xba95f0[_0xb7b1('0x1b')],_0x231a6f=_0xba95f0['offset']+_0xba95f0[_0xb7b1('0x1c')],_0x41acb6;if(_0x231a6f>=_0x1f694a){_0x231a6f=_0x1f694a;_0x41acb6=0xc8;}else{_0x41acb6=0xce;}_0x6072b7[_0xb7b1('0x1d')](_0x41acb6);return _0x6072b7[_0xb7b1('0x1e')](_0xb7b1('0x1f'),_0x59214d+'-'+_0x231a6f+'/'+_0x1f694a)['json'](_0x470447);}return null;};}function patchUpdates(_0x553235){return function(_0x2ce9c9){try{jsonpatch['apply'](_0x2ce9c9,_0x553235,!![]);}catch(_0x38ee5){return BPromise[_0xb7b1('0x20')](_0x38ee5);}return _0x2ce9c9[_0xb7b1('0x21')]();};}function saveUpdates(_0x54190d,_0x6a3046){return function(_0x131cb7){if(_0x131cb7){return _0x131cb7[_0xb7b1('0x22')](_0x54190d)[_0xb7b1('0x23')](function(_0x56ea9e){return _0x56ea9e;});}return null;};}function removeEntity(_0x26a09d,_0x23f1ae){return function(_0x383151){if(_0x383151){return _0x383151[_0xb7b1('0x24')]()['then'](function(){var _0x152970=_0x383151['get']({'plain':!![]});var _0x2c464e=_0xb7b1('0x25');return db[_0xb7b1('0x26')][_0xb7b1('0x24')]({'where':{'type':_0x2c464e,'resourceId':_0x152970['id']}})[_0xb7b1('0x23')](function(){return _0x383151;});})[_0xb7b1('0x23')](function(){_0x26a09d[_0xb7b1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20b794,_0x3eeef3){return function(_0x2f5ea5){if(!_0x2f5ea5){_0x20b794['sendStatus'](0x194);}return _0x2f5ea5;};}function handleError(_0x5ce314,_0x27bc6c){_0x27bc6c=_0x27bc6c||0x1f4;return function(_0x121b15){logger['error'](_0x121b15[_0xb7b1('0x27')]);if(_0x121b15[_0xb7b1('0x28')]){delete _0x121b15[_0xb7b1('0x28')];}_0x5ce314[_0xb7b1('0x1d')](_0x27bc6c)[_0xb7b1('0x29')](_0x121b15);};}exports['index']=function(_0x31c1c0,_0x541b1a){var _0x3e7e47={},_0x564ebe={},_0x3837b9={'count':0x0,'rows':[]};var _0x387c70=_[_0xb7b1('0x2a')](db['Trigger'][_0xb7b1('0x2b')],function(_0xa0a888){return{'name':_0xa0a888[_0xb7b1('0x2c')],'type':_0xa0a888[_0xb7b1('0x2d')]['key']};});_0x564ebe[_0xb7b1('0x2e')]=_['map'](_0x387c70,_0xb7b1('0x28'));_0x564ebe[_0xb7b1('0x2f')]=_['keys'](_0x31c1c0['query']);_0x564ebe[_0xb7b1('0x30')]=_[_0xb7b1('0x31')](_0x564ebe[_0xb7b1('0x2e')],_0x564ebe['query']);_0x3e7e47[_0xb7b1('0x32')]=_['intersection'](_0x564ebe['model'],qs[_0xb7b1('0x33')](_0x31c1c0[_0xb7b1('0x2f')][_0xb7b1('0x33')]));_0x3e7e47['attributes']=_0x3e7e47['attributes'][_0xb7b1('0x34')]?_0x3e7e47[_0xb7b1('0x32')]:_0x564ebe['model'];if(!_0x31c1c0[_0xb7b1('0x2f')]['hasOwnProperty']('nolimit')){_0x3e7e47['limit']=qs[_0xb7b1('0x1c')](_0x31c1c0[_0xb7b1('0x2f')][_0xb7b1('0x1c')]);_0x3e7e47[_0xb7b1('0x1b')]=qs[_0xb7b1('0x1b')](_0x31c1c0[_0xb7b1('0x2f')]['offset']);}_0x3e7e47[_0xb7b1('0x35')]=qs[_0xb7b1('0x36')](_0x31c1c0['query']['sort']);_0x3e7e47['where']=qs[_0xb7b1('0x30')](_[_0xb7b1('0x37')](_0x31c1c0['query'],_0x564ebe[_0xb7b1('0x30')]),_0x387c70);if(_0x31c1c0[_0xb7b1('0x2f')][_0xb7b1('0x38')]){_0x3e7e47[_0xb7b1('0x39')]=_[_0xb7b1('0x3a')](_0x3e7e47['where'],{'$or':_[_0xb7b1('0x2a')](_0x387c70,function(_0x3af78f){if(_0x3af78f[_0xb7b1('0x2d')]!==_0xb7b1('0x3b')){var _0x4f7673={};_0x4f7673[_0x3af78f[_0xb7b1('0x28')]]={'$like':'%'+_0x31c1c0[_0xb7b1('0x2f')][_0xb7b1('0x38')]+'%'};return _0x4f7673;}})});}_0x3e7e47=_['merge']({},_0x3e7e47,_0x31c1c0['options']);var _0x30052e={'where':_0x3e7e47[_0xb7b1('0x39')]};return db[_0xb7b1('0x3c')][_0xb7b1('0x1a')](_0x30052e)[_0xb7b1('0x23')](function(_0x1b75a2){_0x3837b9['count']=_0x1b75a2;if(_0x31c1c0[_0xb7b1('0x2f')]['includeAll']){_0x3e7e47[_0xb7b1('0x3d')]=[{'all':!![]}];}return db[_0xb7b1('0x3c')][_0xb7b1('0x3e')](_0x3e7e47);})[_0xb7b1('0x23')](function(_0x13c12f){_0x3837b9[_0xb7b1('0x3f')]=_0x13c12f;return _0x3837b9;})[_0xb7b1('0x23')](respondWithFilteredResult(_0x541b1a,_0x3e7e47))[_0xb7b1('0x40')](handleError(_0x541b1a,null));};exports[_0xb7b1('0x41')]=function(_0xaa921f,_0xf6be39){var _0x2f56c0={'raw':![],'where':{'id':_0xaa921f['params']['id']}},_0x6b7407={};_0x6b7407[_0xb7b1('0x2e')]=_['keys'](db[_0xb7b1('0x3c')][_0xb7b1('0x2b')]);_0x6b7407['query']=_[_0xb7b1('0x42')](_0xaa921f['query']);_0x6b7407[_0xb7b1('0x30')]=_[_0xb7b1('0x31')](_0x6b7407[_0xb7b1('0x2e')],_0x6b7407[_0xb7b1('0x2f')]);_0x2f56c0[_0xb7b1('0x32')]=_[_0xb7b1('0x31')](_0x6b7407[_0xb7b1('0x2e')],qs['fields'](_0xaa921f['query'][_0xb7b1('0x33')]));_0x2f56c0[_0xb7b1('0x32')]=_0x2f56c0[_0xb7b1('0x32')]['length']?_0x2f56c0['attributes']:_0x6b7407[_0xb7b1('0x2e')];if(_0xaa921f[_0xb7b1('0x2f')][_0xb7b1('0x43')]){_0x2f56c0[_0xb7b1('0x3d')]=[{'all':!![]}];}_0x2f56c0=_[_0xb7b1('0x3a')]({},_0x2f56c0,_0xaa921f[_0xb7b1('0x44')]);return db[_0xb7b1('0x3c')][_0xb7b1('0x45')](_0x2f56c0)['then'](handleEntityNotFound(_0xf6be39,null))['then'](respondWithResult(_0xf6be39,null))[_0xb7b1('0x40')](handleError(_0xf6be39,null));};exports[_0xb7b1('0x46')]=function(_0x1c3604,_0x5a5377){return db[_0xb7b1('0x3c')][_0xb7b1('0x46')](_0x1c3604[_0xb7b1('0x47')],{})[_0xb7b1('0x23')](function(_0x3475be){var _0x3aacc1=_0x1c3604[_0xb7b1('0x48')]['get']({'plain':!![]});if(!_0x3aacc1)throw new Error(_0xb7b1('0x49'));if(_0x3aacc1[_0xb7b1('0x4a')]===_0xb7b1('0x48')){var _0x4acaeb=_0x3475be[_0xb7b1('0x4b')]({'plain':!![]});var _0x511d97=_0xb7b1('0x25');return db[_0xb7b1('0x4c')]['find']({'where':{'name':_0x511d97,'userProfileId':_0x3aacc1[_0xb7b1('0x4d')]},'raw':!![]})[_0xb7b1('0x23')](function(_0x1518eb){if(_0x1518eb&&_0x1518eb['autoAssociation']===0x0){return db[_0xb7b1('0x26')][_0xb7b1('0x46')]({'name':_0x4acaeb[_0xb7b1('0x28')],'resourceId':_0x4acaeb['id'],'type':_0x1518eb['name'],'sectionId':_0x1518eb['id']},{})['then'](function(){return _0x3475be;});}else{return _0x3475be;}})['catch'](function(_0x47c877){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47c877);throw _0x47c877;});}return _0x3475be;})[_0xb7b1('0x23')](respondWithResult(_0x5a5377,0xc9))[_0xb7b1('0x40')](handleError(_0x5a5377,null));};exports[_0xb7b1('0x22')]=function(_0xfead3c,_0x2914e9){if(_0xfead3c[_0xb7b1('0x47')]['id']){delete _0xfead3c['body']['id'];}return db[_0xb7b1('0x3c')]['find']({'where':{'id':_0xfead3c[_0xb7b1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2914e9,null))[_0xb7b1('0x23')](saveUpdates(_0xfead3c['body'],null))[_0xb7b1('0x23')](respondWithResult(_0x2914e9,null))[_0xb7b1('0x40')](handleError(_0x2914e9,null));};exports[_0xb7b1('0x24')]=function(_0x16a5d1,_0x3312f5){return db['Trigger'][_0xb7b1('0x45')]({'where':{'id':_0x16a5d1[_0xb7b1('0x4e')]['id']}})[_0xb7b1('0x23')](handleEntityNotFound(_0x3312f5,null))['then'](removeEntity(_0x3312f5,null))[_0xb7b1('0x40')](handleError(_0x3312f5,null));};exports[_0xb7b1('0x4f')]=function(_0x1fc9a0,_0xdeff4e,_0x538b03){if(_0x1fc9a0['body']['id']){delete _0x1fc9a0[_0xb7b1('0x47')]['id'];}return db['Trigger'][_0xb7b1('0x45')]({'where':{'id':_0x1fc9a0[_0xb7b1('0x4e')]['id']}})['then'](handleEntityNotFound(_0xdeff4e,null))[_0xb7b1('0x23')](function(_0x445187){if(_0x445187){_0x1fc9a0['body'][_0xb7b1('0x50')]=_0x445187['id'];return db[_0xb7b1('0x51')][_0xb7b1('0x46')](_0x1fc9a0[_0xb7b1('0x47')]);}})[_0xb7b1('0x23')](respondWithResult(_0xdeff4e,null))['catch'](handleError(_0xdeff4e,null));};exports[_0xb7b1('0x52')]=function(_0x49f21a,_0x73b6bf,_0x4653ed){if(_0x49f21a[_0xb7b1('0x47')]['id']){delete _0x49f21a['body']['id'];}return db['Trigger'][_0xb7b1('0x45')]({'where':{'id':_0x49f21a[_0xb7b1('0x4e')]['id']}})[_0xb7b1('0x23')](handleEntityNotFound(_0x73b6bf,null))[_0xb7b1('0x23')](function(_0x6bd72e){if(_0x6bd72e){_0x49f21a[_0xb7b1('0x47')][_0xb7b1('0x53')]=_0x6bd72e['id'];return db['Condition']['create'](_0x49f21a[_0xb7b1('0x47')]);}})['then'](respondWithResult(_0x73b6bf,null))[_0xb7b1('0x40')](handleError(_0x73b6bf,null));};exports[_0xb7b1('0x54')]=function(_0xd4e9ef,_0x45ba6d,_0x3d32e9){var _0x480008={};var _0x469c54={};var _0x398e48;var _0x5eeb5a;return db[_0xb7b1('0x3c')]['findOne']({'where':{'id':_0xd4e9ef['params']['id']}})[_0xb7b1('0x23')](handleEntityNotFound(_0x45ba6d,null))[_0xb7b1('0x23')](function(_0x505360){if(_0x505360){_0x398e48=_0x505360;_0x469c54['model']=_['keys'](db['Condition'][_0xb7b1('0x2b')]);_0x469c54[_0xb7b1('0x2f')]=_[_0xb7b1('0x42')](_0xd4e9ef[_0xb7b1('0x2f')]);_0x469c54[_0xb7b1('0x30')]=_[_0xb7b1('0x31')](_0x469c54[_0xb7b1('0x2e')],_0x469c54['query']);_0x480008['attributes']=_['intersection'](_0x469c54[_0xb7b1('0x2e')],qs[_0xb7b1('0x33')](_0xd4e9ef[_0xb7b1('0x2f')][_0xb7b1('0x33')]));_0x480008['attributes']=_0x480008[_0xb7b1('0x32')][_0xb7b1('0x34')]?_0x480008[_0xb7b1('0x32')]:_0x469c54[_0xb7b1('0x2e')];_0x480008[_0xb7b1('0x35')]=qs[_0xb7b1('0x36')](_0xd4e9ef[_0xb7b1('0x2f')][_0xb7b1('0x36')]);_0x480008[_0xb7b1('0x39')]=qs[_0xb7b1('0x30')](_['pick'](_0xd4e9ef[_0xb7b1('0x2f')],_0x469c54[_0xb7b1('0x30')]));if(_0xd4e9ef[_0xb7b1('0x2f')][_0xb7b1('0x38')]){_0x480008['where']=_[_0xb7b1('0x3a')](_0x480008[_0xb7b1('0x39')],{'$or':_['map'](_0x480008[_0xb7b1('0x32')],function(_0x42879c){var _0x4d867a={};_0x4d867a[_0x42879c]={'$like':'%'+_0xd4e9ef[_0xb7b1('0x2f')]['filter']+'%'};return _0x4d867a;})});}_0x480008=_[_0xb7b1('0x3a')]({},_0x480008,_0xd4e9ef[_0xb7b1('0x44')]);return _0x398e48[_0xb7b1('0x54')](_0x480008);}})['then'](function(_0x1751ab){if(_0x1751ab){_0x5eeb5a=_0x1751ab[_0xb7b1('0x34')];if(!_0xd4e9ef['query'][_0xb7b1('0x55')](_0xb7b1('0x56'))){_0x480008[_0xb7b1('0x1c')]=qs['limit'](_0xd4e9ef['query'][_0xb7b1('0x1c')]);_0x480008['offset']=qs[_0xb7b1('0x1b')](_0xd4e9ef['query'][_0xb7b1('0x1b')]);}return _0x398e48['getAllConditions'](_0x480008);}})[_0xb7b1('0x23')](function(_0x9e85f4){if(_0x9e85f4){return _0x9e85f4?{'count':_0x5eeb5a,'rows':_0x9e85f4}:null;}})[_0xb7b1('0x23')](respondWithResult(_0x45ba6d,null))['catch'](handleError(_0x45ba6d,null));};exports[_0xb7b1('0x57')]=function(_0x5dda9c,_0x2af121,_0x1c0fd7){var _0x1fa770={};var _0x51ed00={};var _0x51d008;var _0x4aef5f;return db[_0xb7b1('0x3c')][_0xb7b1('0x58')]({'where':{'id':_0x5dda9c[_0xb7b1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2af121,null))[_0xb7b1('0x23')](function(_0x1fdb0a){if(_0x1fdb0a){_0x51d008=_0x1fdb0a;_0x51ed00[_0xb7b1('0x2e')]=_['keys'](db[_0xb7b1('0x51')][_0xb7b1('0x2b')]);_0x51ed00['query']=_[_0xb7b1('0x42')](_0x5dda9c[_0xb7b1('0x2f')]);_0x51ed00['filters']=_[_0xb7b1('0x31')](_0x51ed00['model'],_0x51ed00[_0xb7b1('0x2f')]);_0x1fa770[_0xb7b1('0x32')]=_['intersection'](_0x51ed00[_0xb7b1('0x2e')],qs[_0xb7b1('0x33')](_0x5dda9c[_0xb7b1('0x2f')][_0xb7b1('0x33')]));_0x1fa770[_0xb7b1('0x32')]=_0x1fa770[_0xb7b1('0x32')][_0xb7b1('0x34')]?_0x1fa770[_0xb7b1('0x32')]:_0x51ed00[_0xb7b1('0x2e')];_0x1fa770[_0xb7b1('0x35')]=qs[_0xb7b1('0x36')](_0x5dda9c[_0xb7b1('0x2f')][_0xb7b1('0x36')]);_0x1fa770[_0xb7b1('0x39')]=qs[_0xb7b1('0x30')](_[_0xb7b1('0x37')](_0x5dda9c[_0xb7b1('0x2f')],_0x51ed00[_0xb7b1('0x30')]));if(_0x5dda9c[_0xb7b1('0x2f')]['filter']){_0x1fa770[_0xb7b1('0x39')]=_['merge'](_0x1fa770['where'],{'$or':_['map'](_0x1fa770[_0xb7b1('0x32')],function(_0x143609){var _0x4d125b={};_0x4d125b[_0x143609]={'$like':'%'+_0x5dda9c['query'][_0xb7b1('0x38')]+'%'};return _0x4d125b;})});}_0x1fa770=_[_0xb7b1('0x3a')]({},_0x1fa770,_0x5dda9c[_0xb7b1('0x44')]);return _0x51d008[_0xb7b1('0x57')](_0x1fa770);}})[_0xb7b1('0x23')](function(_0x2ea39c){if(_0x2ea39c){_0x4aef5f=_0x2ea39c[_0xb7b1('0x34')];if(!_0x5dda9c[_0xb7b1('0x2f')]['hasOwnProperty']('nolimit')){_0x1fa770['limit']=qs[_0xb7b1('0x1c')](_0x5dda9c[_0xb7b1('0x2f')][_0xb7b1('0x1c')]);_0x1fa770[_0xb7b1('0x1b')]=qs[_0xb7b1('0x1b')](_0x5dda9c[_0xb7b1('0x2f')][_0xb7b1('0x1b')]);}return _0x51d008[_0xb7b1('0x57')](_0x1fa770);}})['then'](function(_0x273c16){if(_0x273c16){return _0x273c16?{'count':_0x4aef5f,'rows':_0x273c16}:null;}})[_0xb7b1('0x23')](respondWithResult(_0x2af121,null))[_0xb7b1('0x40')](handleError(_0x2af121,null));};exports['addAction']=function(_0x4a11be,_0x9cf645,_0x59b155){if(_0x4a11be['body']['id']){delete _0x4a11be[_0xb7b1('0x47')]['id'];}return db[_0xb7b1('0x3c')][_0xb7b1('0x45')]({'where':{'id':_0x4a11be[_0xb7b1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x9cf645,null))[_0xb7b1('0x23')](function(_0x65ae7b){if(_0x65ae7b){_0x4a11be['body'][_0xb7b1('0x59')]=_0x65ae7b['id'];return db[_0xb7b1('0x5a')][_0xb7b1('0x46')](_0x4a11be[_0xb7b1('0x47')]);}})[_0xb7b1('0x23')](respondWithResult(_0x9cf645,null))[_0xb7b1('0x40')](handleError(_0x9cf645,null));};exports[_0xb7b1('0x5b')]=function(_0x35a936,_0x57e111,_0x27fd54){var _0x595678={};var _0x5eb7f9={};var _0x208da8;var _0x384b93;return db[_0xb7b1('0x3c')]['findOne']({'where':{'id':_0x35a936['params']['id']}})['then'](handleEntityNotFound(_0x57e111,null))[_0xb7b1('0x23')](function(_0x18185f){if(_0x18185f){_0x208da8=_0x18185f;_0x5eb7f9[_0xb7b1('0x2e')]=_[_0xb7b1('0x42')](db[_0xb7b1('0x5a')][_0xb7b1('0x2b')]);_0x5eb7f9[_0xb7b1('0x2f')]=_[_0xb7b1('0x42')](_0x35a936[_0xb7b1('0x2f')]);_0x5eb7f9[_0xb7b1('0x30')]=_[_0xb7b1('0x31')](_0x5eb7f9['model'],_0x5eb7f9[_0xb7b1('0x2f')]);_0x595678[_0xb7b1('0x32')]=_[_0xb7b1('0x31')](_0x5eb7f9['model'],qs[_0xb7b1('0x33')](_0x35a936[_0xb7b1('0x2f')][_0xb7b1('0x33')]));_0x595678[_0xb7b1('0x32')]=_0x595678[_0xb7b1('0x32')][_0xb7b1('0x34')]?_0x595678[_0xb7b1('0x32')]:_0x5eb7f9[_0xb7b1('0x2e')];_0x595678['order']=qs[_0xb7b1('0x36')](_0x35a936['query'][_0xb7b1('0x36')]);_0x595678['where']=qs[_0xb7b1('0x30')](_['pick'](_0x35a936['query'],_0x5eb7f9[_0xb7b1('0x30')]));if(_0x35a936[_0xb7b1('0x2f')][_0xb7b1('0x38')]){_0x595678[_0xb7b1('0x39')]=_['merge'](_0x595678[_0xb7b1('0x39')],{'$or':_[_0xb7b1('0x2a')](_0x595678[_0xb7b1('0x32')],function(_0xa122fe){var _0x117036={};_0x117036[_0xa122fe]={'$like':'%'+_0x35a936[_0xb7b1('0x2f')][_0xb7b1('0x38')]+'%'};return _0x117036;})});}_0x595678=_[_0xb7b1('0x3a')]({},_0x595678,_0x35a936['options']);return _0x208da8[_0xb7b1('0x5b')](_0x595678);}})[_0xb7b1('0x23')](function(_0x48f0bd){if(_0x48f0bd){_0x384b93=_0x48f0bd[_0xb7b1('0x34')];if(!_0x35a936['query'][_0xb7b1('0x55')](_0xb7b1('0x56'))){_0x595678[_0xb7b1('0x1c')]=qs[_0xb7b1('0x1c')](_0x35a936[_0xb7b1('0x2f')][_0xb7b1('0x1c')]);_0x595678[_0xb7b1('0x1b')]=qs[_0xb7b1('0x1b')](_0x35a936['query'][_0xb7b1('0x1b')]);}return _0x208da8[_0xb7b1('0x5b')](_0x595678);}})['then'](function(_0x521d5e){if(_0x521d5e){return _0x521d5e?{'count':_0x384b93,'rows':_0x521d5e}:null;}})[_0xb7b1('0x23')](respondWithResult(_0x57e111,null))[_0xb7b1('0x40')](handleError(_0x57e111,null));}; \ No newline at end of file +var _0xb6cf=['name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','Trigger','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','Triggers','UserProfileResource','sendStatus','error','stack'];(function(_0x5d5201,_0x38a5a1){var _0x229267=function(_0x6bb4f5){while(--_0x6bb4f5){_0x5d5201['push'](_0x5d5201['shift']());}};_0x229267(++_0x38a5a1);}(_0xb6cf,0xed));var _0xfb6c=function(_0x7b544a,_0x33c45a){_0x7b544a=_0x7b544a-0x0;var _0x33dcb4=_0xb6cf[_0x7b544a];return _0x33dcb4;};'use strict';var pdf=require(_0xfb6c('0x0'));var emlformat=require(_0xfb6c('0x1'));var rimraf=require(_0xfb6c('0x2'));var zipdir=require(_0xfb6c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfb6c('0x4'));var Mustache=require(_0xfb6c('0x5'));var util=require(_0xfb6c('0x6'));var path=require('path');var sox=require(_0xfb6c('0x7'));var csv=require(_0xfb6c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb6c('0x9'));var squel=require(_0xfb6c('0xa'));var crypto=require(_0xfb6c('0xb'));var jsforce=require(_0xfb6c('0xc'));var deskjs=require(_0xfb6c('0xd'));var toCsv=require(_0xfb6c('0x8'));var querystring=require(_0xfb6c('0xe'));var Papa=require(_0xfb6c('0xf'));var Redis=require(_0xfb6c('0x10'));var authService=require(_0xfb6c('0x11'));var qs=require(_0xfb6c('0x12'));var as=require(_0xfb6c('0x13'));var hardwareService=require(_0xfb6c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfb6c('0x15'));var config=require(_0xfb6c('0x16'));var db=require(_0xfb6c('0x17'))['db'];function respondWithStatusCode(_0x1831fd,_0x21cbe8){_0x21cbe8=_0x21cbe8||0xcc;return function(_0x174630){if(_0x174630){return _0x1831fd['sendStatus'](_0x21cbe8);}return _0x1831fd[_0xfb6c('0x18')](_0x21cbe8)[_0xfb6c('0x19')]();};}function respondWithResult(_0x34e254,_0x23dbc9){_0x23dbc9=_0x23dbc9||0xc8;return function(_0x51090d){if(_0x51090d){return _0x34e254[_0xfb6c('0x18')](_0x23dbc9)[_0xfb6c('0x1a')](_0x51090d);}};}function respondWithFilteredResult(_0x33d06c,_0x1c840d){return function(_0x3f22fb){if(_0x3f22fb){var _0x3b78eb=_0x3f22fb[_0xfb6c('0x1b')],_0x4d296b=_0x1c840d[_0xfb6c('0x1c')],_0x2fd6e0=_0x1c840d[_0xfb6c('0x1c')]+_0x1c840d[_0xfb6c('0x1d')],_0x317fb7;if(_0x2fd6e0>=_0x3b78eb){_0x2fd6e0=_0x3b78eb;_0x317fb7=0xc8;}else{_0x317fb7=0xce;}_0x33d06c[_0xfb6c('0x18')](_0x317fb7);return _0x33d06c[_0xfb6c('0x1e')](_0xfb6c('0x1f'),_0x4d296b+'-'+_0x2fd6e0+'/'+_0x3b78eb)['json'](_0x3f22fb);}return null;};}function patchUpdates(_0x5db396){return function(_0x28fb21){try{jsonpatch[_0xfb6c('0x20')](_0x28fb21,_0x5db396,!![]);}catch(_0x427e3d){return BPromise['reject'](_0x427e3d);}return _0x28fb21[_0xfb6c('0x21')]();};}function saveUpdates(_0x9c1ca,_0x46d933){return function(_0x53872c){if(_0x53872c){return _0x53872c[_0xfb6c('0x22')](_0x9c1ca)[_0xfb6c('0x23')](function(_0x3faf0c){return _0x3faf0c;});}return null;};}function removeEntity(_0x245208,_0xd14f79){return function(_0x3c7ab8){if(_0x3c7ab8){return _0x3c7ab8['destroy']()['then'](function(){var _0x3cac9d=_0x3c7ab8[_0xfb6c('0x24')]({'plain':!![]});var _0x492d2b=_0xfb6c('0x25');return db[_0xfb6c('0x26')]['destroy']({'where':{'type':_0x492d2b,'resourceId':_0x3cac9d['id']}})['then'](function(){return _0x3c7ab8;});})[_0xfb6c('0x23')](function(){_0x245208[_0xfb6c('0x18')](0xcc)[_0xfb6c('0x19')]();});}};}function handleEntityNotFound(_0x2d3366,_0xacad6e){return function(_0x3e44b3){if(!_0x3e44b3){_0x2d3366[_0xfb6c('0x27')](0x194);}return _0x3e44b3;};}function handleError(_0x30c3e5,_0x2da568){_0x2da568=_0x2da568||0x1f4;return function(_0x177371){logger[_0xfb6c('0x28')](_0x177371[_0xfb6c('0x29')]);if(_0x177371[_0xfb6c('0x2a')]){delete _0x177371[_0xfb6c('0x2a')];}_0x30c3e5[_0xfb6c('0x18')](_0x2da568)[_0xfb6c('0x2b')](_0x177371);};}exports[_0xfb6c('0x2c')]=function(_0x4c51af,_0x5f4cd2){var _0x35d7b1={},_0x211506={},_0x4ee69f={'count':0x0,'rows':[]};var _0x31831e=_[_0xfb6c('0x2d')](db['Trigger']['rawAttributes'],function(_0x477cc5){return{'name':_0x477cc5[_0xfb6c('0x2e')],'type':_0x477cc5[_0xfb6c('0x2f')][_0xfb6c('0x30')]};});_0x211506[_0xfb6c('0x31')]=_['map'](_0x31831e,_0xfb6c('0x2a'));_0x211506[_0xfb6c('0x32')]=_[_0xfb6c('0x33')](_0x4c51af[_0xfb6c('0x32')]);_0x211506[_0xfb6c('0x34')]=_['intersection'](_0x211506[_0xfb6c('0x31')],_0x211506['query']);_0x35d7b1['attributes']=_[_0xfb6c('0x35')](_0x211506[_0xfb6c('0x31')],qs[_0xfb6c('0x36')](_0x4c51af['query'][_0xfb6c('0x36')]));_0x35d7b1[_0xfb6c('0x37')]=_0x35d7b1[_0xfb6c('0x37')]['length']?_0x35d7b1['attributes']:_0x211506[_0xfb6c('0x31')];if(!_0x4c51af[_0xfb6c('0x32')]['hasOwnProperty'](_0xfb6c('0x38'))){_0x35d7b1['limit']=qs[_0xfb6c('0x1d')](_0x4c51af[_0xfb6c('0x32')]['limit']);_0x35d7b1[_0xfb6c('0x1c')]=qs[_0xfb6c('0x1c')](_0x4c51af[_0xfb6c('0x32')][_0xfb6c('0x1c')]);}_0x35d7b1[_0xfb6c('0x39')]=qs[_0xfb6c('0x3a')](_0x4c51af[_0xfb6c('0x32')][_0xfb6c('0x3a')]);_0x35d7b1[_0xfb6c('0x3b')]=qs[_0xfb6c('0x34')](_[_0xfb6c('0x3c')](_0x4c51af[_0xfb6c('0x32')],_0x211506['filters']),_0x31831e);if(_0x4c51af[_0xfb6c('0x32')][_0xfb6c('0x3d')]){_0x35d7b1[_0xfb6c('0x3b')]=_[_0xfb6c('0x3e')](_0x35d7b1[_0xfb6c('0x3b')],{'$or':_['map'](_0x31831e,function(_0x46c6f6){if(_0x46c6f6[_0xfb6c('0x2f')]!=='VIRTUAL'){var _0x3c5a98={};_0x3c5a98[_0x46c6f6[_0xfb6c('0x2a')]]={'$like':'%'+_0x4c51af['query']['filter']+'%'};return _0x3c5a98;}})});}_0x35d7b1=_[_0xfb6c('0x3e')]({},_0x35d7b1,_0x4c51af[_0xfb6c('0x3f')]);var _0x1b7014={'where':_0x35d7b1[_0xfb6c('0x3b')]};return db[_0xfb6c('0x40')][_0xfb6c('0x1b')](_0x1b7014)['then'](function(_0x570483){_0x4ee69f[_0xfb6c('0x1b')]=_0x570483;if(_0x4c51af[_0xfb6c('0x32')][_0xfb6c('0x41')]){_0x35d7b1[_0xfb6c('0x42')]=[{'all':!![]}];}return db[_0xfb6c('0x40')][_0xfb6c('0x43')](_0x35d7b1);})[_0xfb6c('0x23')](function(_0x382959){_0x4ee69f[_0xfb6c('0x44')]=_0x382959;return _0x4ee69f;})[_0xfb6c('0x23')](respondWithFilteredResult(_0x5f4cd2,_0x35d7b1))['catch'](handleError(_0x5f4cd2,null));};exports[_0xfb6c('0x45')]=function(_0x490e78,_0xcb0dd){var _0x374d52={'raw':![],'where':{'id':_0x490e78['params']['id']}},_0x5a13c2={};_0x5a13c2[_0xfb6c('0x31')]=_[_0xfb6c('0x33')](db[_0xfb6c('0x40')][_0xfb6c('0x46')]);_0x5a13c2[_0xfb6c('0x32')]=_[_0xfb6c('0x33')](_0x490e78[_0xfb6c('0x32')]);_0x5a13c2[_0xfb6c('0x34')]=_[_0xfb6c('0x35')](_0x5a13c2[_0xfb6c('0x31')],_0x5a13c2['query']);_0x374d52['attributes']=_[_0xfb6c('0x35')](_0x5a13c2[_0xfb6c('0x31')],qs['fields'](_0x490e78['query']['fields']));_0x374d52[_0xfb6c('0x37')]=_0x374d52[_0xfb6c('0x37')][_0xfb6c('0x47')]?_0x374d52[_0xfb6c('0x37')]:_0x5a13c2['model'];if(_0x490e78['query']['includeAll']){_0x374d52['include']=[{'all':!![]}];}_0x374d52=_[_0xfb6c('0x3e')]({},_0x374d52,_0x490e78[_0xfb6c('0x3f')]);return db[_0xfb6c('0x40')][_0xfb6c('0x48')](_0x374d52)[_0xfb6c('0x23')](handleEntityNotFound(_0xcb0dd,null))[_0xfb6c('0x23')](respondWithResult(_0xcb0dd,null))[_0xfb6c('0x49')](handleError(_0xcb0dd,null));};exports[_0xfb6c('0x4a')]=function(_0x1aab8e,_0x56f89a){return db[_0xfb6c('0x40')][_0xfb6c('0x4a')](_0x1aab8e[_0xfb6c('0x4b')],{})[_0xfb6c('0x23')](function(_0x5914d9){var _0x160bb1=_0x1aab8e[_0xfb6c('0x4c')][_0xfb6c('0x24')]({'plain':!![]});if(!_0x160bb1)throw new Error(_0xfb6c('0x4d'));if(_0x160bb1[_0xfb6c('0x4e')]===_0xfb6c('0x4c')){var _0x2ea714=_0x5914d9[_0xfb6c('0x24')]({'plain':!![]});var _0x3d6a37=_0xfb6c('0x25');return db[_0xfb6c('0x4f')]['find']({'where':{'name':_0x3d6a37,'userProfileId':_0x160bb1['userProfileId']},'raw':!![]})[_0xfb6c('0x23')](function(_0x47ff07){if(_0x47ff07&&_0x47ff07['autoAssociation']===0x0){return db[_0xfb6c('0x26')][_0xfb6c('0x4a')]({'name':_0x2ea714[_0xfb6c('0x2a')],'resourceId':_0x2ea714['id'],'type':_0x47ff07[_0xfb6c('0x2a')],'sectionId':_0x47ff07['id']},{})[_0xfb6c('0x23')](function(){return _0x5914d9;});}else{return _0x5914d9;}})[_0xfb6c('0x49')](function(_0xcc057c){logger[_0xfb6c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcc057c);throw _0xcc057c;});}return _0x5914d9;})[_0xfb6c('0x23')](respondWithResult(_0x56f89a,0xc9))[_0xfb6c('0x49')](handleError(_0x56f89a,null));};exports[_0xfb6c('0x22')]=function(_0xfb38f4,_0x43f52d){if(_0xfb38f4[_0xfb6c('0x4b')]['id']){delete _0xfb38f4['body']['id'];}return db['Trigger']['find']({'where':{'id':_0xfb38f4[_0xfb6c('0x50')]['id']}})['then'](handleEntityNotFound(_0x43f52d,null))[_0xfb6c('0x23')](saveUpdates(_0xfb38f4['body'],null))[_0xfb6c('0x23')](respondWithResult(_0x43f52d,null))[_0xfb6c('0x49')](handleError(_0x43f52d,null));};exports['destroy']=function(_0x495a0f,_0x450023){return db['Trigger'][_0xfb6c('0x48')]({'where':{'id':_0x495a0f[_0xfb6c('0x50')]['id']}})[_0xfb6c('0x23')](handleEntityNotFound(_0x450023,null))[_0xfb6c('0x23')](removeEntity(_0x450023,null))['catch'](handleError(_0x450023,null));};exports['addAllCondition']=function(_0x15e11a,_0x31c3bb,_0x3a88c6){if(_0x15e11a[_0xfb6c('0x4b')]['id']){delete _0x15e11a['body']['id'];}return db[_0xfb6c('0x40')][_0xfb6c('0x48')]({'where':{'id':_0x15e11a[_0xfb6c('0x50')]['id']}})[_0xfb6c('0x23')](handleEntityNotFound(_0x31c3bb,null))['then'](function(_0x2900d8){if(_0x2900d8){_0x15e11a[_0xfb6c('0x4b')][_0xfb6c('0x51')]=_0x2900d8['id'];return db[_0xfb6c('0x52')][_0xfb6c('0x4a')](_0x15e11a[_0xfb6c('0x4b')]);}})['then'](respondWithResult(_0x31c3bb,null))[_0xfb6c('0x49')](handleError(_0x31c3bb,null));};exports[_0xfb6c('0x53')]=function(_0x170398,_0x222a7c,_0x101c91){if(_0x170398[_0xfb6c('0x4b')]['id']){delete _0x170398[_0xfb6c('0x4b')]['id'];}return db[_0xfb6c('0x40')][_0xfb6c('0x48')]({'where':{'id':_0x170398[_0xfb6c('0x50')]['id']}})[_0xfb6c('0x23')](handleEntityNotFound(_0x222a7c,null))[_0xfb6c('0x23')](function(_0x1a230a){if(_0x1a230a){_0x170398[_0xfb6c('0x4b')][_0xfb6c('0x54')]=_0x1a230a['id'];return db[_0xfb6c('0x52')]['create'](_0x170398[_0xfb6c('0x4b')]);}})['then'](respondWithResult(_0x222a7c,null))[_0xfb6c('0x49')](handleError(_0x222a7c,null));};exports[_0xfb6c('0x55')]=function(_0x49fe2c,_0x1d727a,_0x27d99d){var _0x4845d3={};var _0x5de246={};var _0x3f7587;var _0x25203f;return db[_0xfb6c('0x40')][_0xfb6c('0x56')]({'where':{'id':_0x49fe2c[_0xfb6c('0x50')]['id']}})['then'](handleEntityNotFound(_0x1d727a,null))[_0xfb6c('0x23')](function(_0x911166){if(_0x911166){_0x3f7587=_0x911166;_0x5de246[_0xfb6c('0x31')]=_['keys'](db[_0xfb6c('0x52')][_0xfb6c('0x46')]);_0x5de246[_0xfb6c('0x32')]=_[_0xfb6c('0x33')](_0x49fe2c[_0xfb6c('0x32')]);_0x5de246[_0xfb6c('0x34')]=_[_0xfb6c('0x35')](_0x5de246[_0xfb6c('0x31')],_0x5de246[_0xfb6c('0x32')]);_0x4845d3[_0xfb6c('0x37')]=_['intersection'](_0x5de246['model'],qs[_0xfb6c('0x36')](_0x49fe2c[_0xfb6c('0x32')][_0xfb6c('0x36')]));_0x4845d3['attributes']=_0x4845d3[_0xfb6c('0x37')][_0xfb6c('0x47')]?_0x4845d3[_0xfb6c('0x37')]:_0x5de246[_0xfb6c('0x31')];_0x4845d3['order']=qs[_0xfb6c('0x3a')](_0x49fe2c[_0xfb6c('0x32')]['sort']);_0x4845d3[_0xfb6c('0x3b')]=qs[_0xfb6c('0x34')](_[_0xfb6c('0x3c')](_0x49fe2c[_0xfb6c('0x32')],_0x5de246[_0xfb6c('0x34')]));if(_0x49fe2c['query'][_0xfb6c('0x3d')]){_0x4845d3[_0xfb6c('0x3b')]=_['merge'](_0x4845d3[_0xfb6c('0x3b')],{'$or':_[_0xfb6c('0x2d')](_0x4845d3[_0xfb6c('0x37')],function(_0xde1dbd){var _0x3d9d3f={};_0x3d9d3f[_0xde1dbd]={'$like':'%'+_0x49fe2c['query'][_0xfb6c('0x3d')]+'%'};return _0x3d9d3f;})});}_0x4845d3=_[_0xfb6c('0x3e')]({},_0x4845d3,_0x49fe2c[_0xfb6c('0x3f')]);return _0x3f7587['getAllConditions'](_0x4845d3);}})[_0xfb6c('0x23')](function(_0x1ee6ec){if(_0x1ee6ec){_0x25203f=_0x1ee6ec['length'];if(!_0x49fe2c[_0xfb6c('0x32')][_0xfb6c('0x57')]('nolimit')){_0x4845d3['limit']=qs['limit'](_0x49fe2c['query'][_0xfb6c('0x1d')]);_0x4845d3[_0xfb6c('0x1c')]=qs[_0xfb6c('0x1c')](_0x49fe2c[_0xfb6c('0x32')][_0xfb6c('0x1c')]);}return _0x3f7587[_0xfb6c('0x55')](_0x4845d3);}})[_0xfb6c('0x23')](function(_0x508aa0){if(_0x508aa0){return _0x508aa0?{'count':_0x25203f,'rows':_0x508aa0}:null;}})[_0xfb6c('0x23')](respondWithResult(_0x1d727a,null))[_0xfb6c('0x49')](handleError(_0x1d727a,null));};exports[_0xfb6c('0x58')]=function(_0x1be20a,_0x36c7c6,_0x472385){var _0x1106d5={};var _0x165f5e={};var _0x3f3252;var _0x4efc64;return db[_0xfb6c('0x40')][_0xfb6c('0x56')]({'where':{'id':_0x1be20a['params']['id']}})[_0xfb6c('0x23')](handleEntityNotFound(_0x36c7c6,null))[_0xfb6c('0x23')](function(_0x5f10f0){if(_0x5f10f0){_0x3f3252=_0x5f10f0;_0x165f5e[_0xfb6c('0x31')]=_[_0xfb6c('0x33')](db[_0xfb6c('0x52')][_0xfb6c('0x46')]);_0x165f5e[_0xfb6c('0x32')]=_['keys'](_0x1be20a['query']);_0x165f5e[_0xfb6c('0x34')]=_['intersection'](_0x165f5e['model'],_0x165f5e['query']);_0x1106d5[_0xfb6c('0x37')]=_[_0xfb6c('0x35')](_0x165f5e['model'],qs[_0xfb6c('0x36')](_0x1be20a[_0xfb6c('0x32')]['fields']));_0x1106d5[_0xfb6c('0x37')]=_0x1106d5[_0xfb6c('0x37')]['length']?_0x1106d5['attributes']:_0x165f5e['model'];_0x1106d5[_0xfb6c('0x39')]=qs[_0xfb6c('0x3a')](_0x1be20a['query'][_0xfb6c('0x3a')]);_0x1106d5[_0xfb6c('0x3b')]=qs[_0xfb6c('0x34')](_[_0xfb6c('0x3c')](_0x1be20a[_0xfb6c('0x32')],_0x165f5e[_0xfb6c('0x34')]));if(_0x1be20a[_0xfb6c('0x32')][_0xfb6c('0x3d')]){_0x1106d5[_0xfb6c('0x3b')]=_[_0xfb6c('0x3e')](_0x1106d5[_0xfb6c('0x3b')],{'$or':_[_0xfb6c('0x2d')](_0x1106d5[_0xfb6c('0x37')],function(_0x140f17){var _0x5301e3={};_0x5301e3[_0x140f17]={'$like':'%'+_0x1be20a[_0xfb6c('0x32')]['filter']+'%'};return _0x5301e3;})});}_0x1106d5=_[_0xfb6c('0x3e')]({},_0x1106d5,_0x1be20a[_0xfb6c('0x3f')]);return _0x3f3252[_0xfb6c('0x58')](_0x1106d5);}})['then'](function(_0x57557d){if(_0x57557d){_0x4efc64=_0x57557d[_0xfb6c('0x47')];if(!_0x1be20a[_0xfb6c('0x32')][_0xfb6c('0x57')]('nolimit')){_0x1106d5[_0xfb6c('0x1d')]=qs[_0xfb6c('0x1d')](_0x1be20a[_0xfb6c('0x32')][_0xfb6c('0x1d')]);_0x1106d5[_0xfb6c('0x1c')]=qs['offset'](_0x1be20a[_0xfb6c('0x32')][_0xfb6c('0x1c')]);}return _0x3f3252[_0xfb6c('0x58')](_0x1106d5);}})[_0xfb6c('0x23')](function(_0x3aa46a){if(_0x3aa46a){return _0x3aa46a?{'count':_0x4efc64,'rows':_0x3aa46a}:null;}})['then'](respondWithResult(_0x36c7c6,null))[_0xfb6c('0x49')](handleError(_0x36c7c6,null));};exports[_0xfb6c('0x59')]=function(_0xee368e,_0x1141df,_0x34d996){if(_0xee368e['body']['id']){delete _0xee368e[_0xfb6c('0x4b')]['id'];}return db[_0xfb6c('0x40')][_0xfb6c('0x48')]({'where':{'id':_0xee368e[_0xfb6c('0x50')]['id']}})['then'](handleEntityNotFound(_0x1141df,null))[_0xfb6c('0x23')](function(_0x3d6902){if(_0x3d6902){_0xee368e[_0xfb6c('0x4b')][_0xfb6c('0x5a')]=_0x3d6902['id'];return db[_0xfb6c('0x5b')]['create'](_0xee368e[_0xfb6c('0x4b')]);}})[_0xfb6c('0x23')](respondWithResult(_0x1141df,null))[_0xfb6c('0x49')](handleError(_0x1141df,null));};exports[_0xfb6c('0x5c')]=function(_0xf14d28,_0x3c746d,_0x430e89){var _0x310cb3={};var _0x436422={};var _0x51d7f0;var _0x539c4c;return db['Trigger'][_0xfb6c('0x56')]({'where':{'id':_0xf14d28['params']['id']}})[_0xfb6c('0x23')](handleEntityNotFound(_0x3c746d,null))['then'](function(_0x5579d1){if(_0x5579d1){_0x51d7f0=_0x5579d1;_0x436422[_0xfb6c('0x31')]=_[_0xfb6c('0x33')](db[_0xfb6c('0x5b')][_0xfb6c('0x46')]);_0x436422[_0xfb6c('0x32')]=_[_0xfb6c('0x33')](_0xf14d28[_0xfb6c('0x32')]);_0x436422[_0xfb6c('0x34')]=_[_0xfb6c('0x35')](_0x436422['model'],_0x436422[_0xfb6c('0x32')]);_0x310cb3[_0xfb6c('0x37')]=_[_0xfb6c('0x35')](_0x436422[_0xfb6c('0x31')],qs[_0xfb6c('0x36')](_0xf14d28[_0xfb6c('0x32')][_0xfb6c('0x36')]));_0x310cb3[_0xfb6c('0x37')]=_0x310cb3[_0xfb6c('0x37')]['length']?_0x310cb3[_0xfb6c('0x37')]:_0x436422[_0xfb6c('0x31')];_0x310cb3[_0xfb6c('0x39')]=qs['sort'](_0xf14d28['query'][_0xfb6c('0x3a')]);_0x310cb3[_0xfb6c('0x3b')]=qs[_0xfb6c('0x34')](_[_0xfb6c('0x3c')](_0xf14d28['query'],_0x436422['filters']));if(_0xf14d28[_0xfb6c('0x32')][_0xfb6c('0x3d')]){_0x310cb3[_0xfb6c('0x3b')]=_[_0xfb6c('0x3e')](_0x310cb3[_0xfb6c('0x3b')],{'$or':_[_0xfb6c('0x2d')](_0x310cb3[_0xfb6c('0x37')],function(_0x3e3ffa){var _0x358e0e={};_0x358e0e[_0x3e3ffa]={'$like':'%'+_0xf14d28[_0xfb6c('0x32')][_0xfb6c('0x3d')]+'%'};return _0x358e0e;})});}_0x310cb3=_['merge']({},_0x310cb3,_0xf14d28[_0xfb6c('0x3f')]);return _0x51d7f0[_0xfb6c('0x5c')](_0x310cb3);}})['then'](function(_0x17dccf){if(_0x17dccf){_0x539c4c=_0x17dccf[_0xfb6c('0x47')];if(!_0xf14d28[_0xfb6c('0x32')][_0xfb6c('0x57')](_0xfb6c('0x38'))){_0x310cb3[_0xfb6c('0x1d')]=qs[_0xfb6c('0x1d')](_0xf14d28['query']['limit']);_0x310cb3[_0xfb6c('0x1c')]=qs[_0xfb6c('0x1c')](_0xf14d28['query'][_0xfb6c('0x1c')]);}return _0x51d7f0[_0xfb6c('0x5c')](_0x310cb3);}})[_0xfb6c('0x23')](function(_0x46f753){if(_0x46f753){return _0x46f753?{'count':_0x539c4c,'rows':_0x46f753}:null;}})['then'](respondWithResult(_0x3c746d,null))[_0xfb6c('0x49')](handleError(_0x3c746d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index fcae629..74d2e42 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util'];(function(_0x561c10,_0xe9cb){var _0x1c5d24=function(_0x566e57){while(--_0x566e57){_0x561c10['push'](_0x561c10['shift']());}};_0x1c5d24(++_0xe9cb);}(_0x7a54,0x106));var _0x47a5=function(_0x1fad0e,_0x59f521){_0x1fad0e=_0x1fad0e-0x0;var _0xded3b0=_0x7a54[_0x1fad0e];return _0xded3b0;};'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 +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util'];(function(_0x3ed430,_0x5fafab){var _0xae4a10=function(_0x53105d){while(--_0x53105d){_0x3ed430['push'](_0x3ed430['shift']());}};_0xae4a10(++_0x5fafab);}(_0x7a54,0x106));var _0x47a5=function(_0xb0b535,_0x25a2d0){_0xb0b535=_0xb0b535-0x0;var _0x168233=_0x7a54[_0xb0b535];return _0x168233;};'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/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 53a7652..341ca6e 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 _0x4b17=['http','request','then','info','request\x20sent','debug','stringify','error','message','Trigger,\x20%s,\x20%s','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','catch','ShowTrigger','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x47de9a,_0x40cf23){var _0x4b9d6c=function(_0x507054){while(--_0x507054){_0x47de9a['push'](_0x47de9a['shift']());}};_0x4b9d6c(++_0x40cf23);}(_0x4b17,0x10f));var _0x74b1=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x4b17[_0x4de877];return _0xb2cfeb;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var moment=require(_0x74b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b1('0x2'));var fs=require('fs');var Redis=require(_0x74b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b1('0x5'));var jayson=require(_0x74b1('0x6'));var client=jayson[_0x74b1('0x7')][_0x74b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x371c3b,_0x191d2b,_0x16761b){return new BPromise(function(_0x4c293c,_0x287e3e){return client[_0x74b1('0x9')](_0x371c3b,_0x16761b)[_0x74b1('0xa')](function(_0x25382b){logger[_0x74b1('0xb')]('Trigger,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'));logger[_0x74b1('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'),JSON[_0x74b1('0xe')](_0x25382b));if(_0x25382b[_0x74b1('0xf')]){if(_0x25382b[_0x74b1('0xf')]['code']===0x1f4){logger[_0x74b1('0xf')]('Trigger,\x20%s,\x20%s',_0x191d2b,_0x25382b['error'][_0x74b1('0x10')]);return _0x287e3e(_0x25382b[_0x74b1('0xf')]['message']);}logger['error']('Trigger,\x20%s,\x20%s',_0x191d2b,_0x25382b[_0x74b1('0xf')]['message']);return _0x4c293c(_0x25382b['error'][_0x74b1('0x10')]);}else{logger[_0x74b1('0xb')](_0x74b1('0x11'),_0x191d2b,_0x74b1('0xc'));_0x4c293c(_0x25382b[_0x74b1('0x12')][_0x74b1('0x10')]);}})['catch'](function(_0x6237be){logger[_0x74b1('0xf')](_0x74b1('0x11'),_0x191d2b,_0x6237be);_0x287e3e(_0x6237be);});});}exports[_0x74b1('0x13')]=function(_0xde2736){var _0x8c9510=this;return new Promise(function(_0x1ab838,_0x4bb3d2){return db[_0x74b1('0x14')][_0x74b1('0x15')]({'raw':_0xde2736['options']?_0xde2736[_0x74b1('0x16')][_0x74b1('0x17')]===undefined?!![]:![]:!![],'where':_0xde2736[_0x74b1('0x16')]?_0xde2736[_0x74b1('0x16')][_0x74b1('0x18')]||null:null,'attributes':_0xde2736[_0x74b1('0x16')]?_0xde2736[_0x74b1('0x16')][_0x74b1('0x19')]||null:null,'limit':_0xde2736['options']?_0xde2736[_0x74b1('0x16')]['limit']||null:null,'include':_0xde2736['options']?_0xde2736['options'][_0x74b1('0x1a')]?_[_0x74b1('0x1b')](_0xde2736[_0x74b1('0x16')][_0x74b1('0x1a')],function(_0x563781){return{'model':db[_0x563781['model']],'as':_0x563781['as'],'attributes':_0x563781[_0x74b1('0x19')],'include':_0x563781['include']?_[_0x74b1('0x1b')](_0x563781[_0x74b1('0x1a')],function(_0xb5af0){return{'model':db[_0xb5af0[_0x74b1('0x1c')]],'as':_0xb5af0['as'],'attributes':_0xb5af0[_0x74b1('0x19')],'include':_0xb5af0[_0x74b1('0x1a')]?_[_0x74b1('0x1b')](_0xb5af0[_0x74b1('0x1a')],function(_0x4c7f05){return{'model':db[_0x4c7f05[_0x74b1('0x1c')]],'as':_0x4c7f05['as'],'attributes':_0x4c7f05[_0x74b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x74b1('0xa')](function(_0x5c32d2){logger[_0x74b1('0xb')](_0x74b1('0x13'),_0xde2736);logger[_0x74b1('0xd')](_0x74b1('0x13'),_0xde2736,JSON[_0x74b1('0xe')](_0x5c32d2));_0x1ab838(_0x5c32d2);})[_0x74b1('0x1d')](function(_0x436eda){logger[_0x74b1('0xf')]('GetTrigger',_0x436eda[_0x74b1('0x10')],_0xde2736);_0x4bb3d2(_0x8c9510[_0x74b1('0xf')](0x1f4,_0x436eda['message']));});});};exports[_0x74b1('0x1e')]=function(_0x45404f){var _0x1ac433=this;return new Promise(function(_0x5f4d1b,_0x113300){return db[_0x74b1('0x14')]['find']({'raw':_0x45404f[_0x74b1('0x16')]?_0x45404f[_0x74b1('0x16')][_0x74b1('0x17')]===undefined?!![]:![]:!![],'where':_0x45404f[_0x74b1('0x16')]?_0x45404f[_0x74b1('0x16')][_0x74b1('0x18')]||null:null,'attributes':_0x45404f[_0x74b1('0x16')]?_0x45404f[_0x74b1('0x16')]['attributes']||null:null,'include':_0x45404f[_0x74b1('0x16')]?_0x45404f['options']['include']?_[_0x74b1('0x1b')](_0x45404f['options']['include'],function(_0x3fd43c){return{'model':db[_0x3fd43c[_0x74b1('0x1c')]],'as':_0x3fd43c['as'],'attributes':_0x3fd43c[_0x74b1('0x19')],'include':_0x3fd43c[_0x74b1('0x1a')]?_[_0x74b1('0x1b')](_0x3fd43c[_0x74b1('0x1a')],function(_0x171fa4){return{'model':db[_0x171fa4[_0x74b1('0x1c')]],'as':_0x171fa4['as'],'attributes':_0x171fa4['attributes'],'include':_0x171fa4['include']?_['map'](_0x171fa4[_0x74b1('0x1a')],function(_0x57f7b5){return{'model':db[_0x57f7b5['model']],'as':_0x57f7b5['as'],'attributes':_0x57f7b5[_0x74b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x74b1('0xa')](function(_0x222783){logger['info'](_0x74b1('0x1e'),_0x45404f);logger['debug'](_0x74b1('0x1e'),_0x45404f,JSON[_0x74b1('0xe')](_0x222783));_0x5f4d1b(_0x222783);})['catch'](function(_0x514d0e){logger[_0x74b1('0xf')](_0x74b1('0x1e'),_0x514d0e['message'],_0x45404f);_0x113300(_0x1ac433['error'](0x1f4,_0x514d0e[_0x74b1('0x10')]));});});}; \ No newline at end of file +var _0xf7b4=['request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','find','ShowTrigger','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x5e3dd7,_0x3e39be){var _0x570cf4=function(_0x2ed895){while(--_0x2ed895){_0x5e3dd7['push'](_0x5e3dd7['shift']());}};_0x570cf4(++_0x3e39be);}(_0xf7b4,0x152));var _0x4f7b=function(_0x1088dd,_0x497614){_0x1088dd=_0x1088dd-0x0;var _0x3fc2b6=_0xf7b4[_0x1088dd];return _0x3fc2b6;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('Trigger,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('Trigger,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['GetTrigger']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')]({'raw':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'limit':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1b')]||null:null,'include':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x24e5cf[_0x4f7b('0x17')]['include'],function(_0x150f57){return{'model':db[_0x150f57[_0x4f7b('0x1e')]],'as':_0x150f57['as'],'attributes':_0x150f57['attributes'],'include':_0x150f57[_0x4f7b('0x1c')]?_['map'](_0x150f57[_0x4f7b('0x1c')],function(_0x2429be){return{'model':db[_0x2429be[_0x4f7b('0x1e')]],'as':_0x2429be['as'],'attributes':_0x2429be[_0x4f7b('0x1a')],'include':_0x2429be[_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x2429be[_0x4f7b('0x1c')],function(_0x3ad769){return{'model':db[_0x3ad769['model']],'as':_0x3ad769['as'],'attributes':_0x3ad769[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x311675){logger['info'](_0x4f7b('0x20'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x20'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x311675));_0x519d90(_0x311675);})[_0x4f7b('0x14')](function(_0x4ebffa){logger[_0x4f7b('0x10')](_0x4f7b('0x20'),_0x4ebffa[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da['error'](0x1f4,_0x4ebffa[_0x4f7b('0x12')]));});});};exports['ShowTrigger']=function(_0x4e4828){var _0x1a2346=this;return new Promise(function(_0x52a5b1,_0x1aad4b){return db[_0x4f7b('0x15')][_0x4f7b('0x21')]({'raw':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'include':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')],function(_0x35f1ed){return{'model':db[_0x35f1ed[_0x4f7b('0x1e')]],'as':_0x35f1ed['as'],'attributes':_0x35f1ed[_0x4f7b('0x1a')],'include':_0x35f1ed[_0x4f7b('0x1c')]?_['map'](_0x35f1ed[_0x4f7b('0x1c')],function(_0x5127a2){return{'model':db[_0x5127a2[_0x4f7b('0x1e')]],'as':_0x5127a2['as'],'attributes':_0x5127a2[_0x4f7b('0x1a')],'include':_0x5127a2['include']?_[_0x4f7b('0x1d')](_0x5127a2[_0x4f7b('0x1c')],function(_0x1347b6){return{'model':db[_0x1347b6['model']],'as':_0x1347b6['as'],'attributes':_0x1347b6[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x446f6e){logger[_0x4f7b('0xb')](_0x4f7b('0x22'),_0x4e4828);logger[_0x4f7b('0xd')](_0x4f7b('0x22'),_0x4e4828,JSON['stringify'](_0x446f6e));_0x52a5b1(_0x446f6e);})[_0x4f7b('0x14')](function(_0x486187){logger[_0x4f7b('0x10')](_0x4f7b('0x22'),_0x486187[_0x4f7b('0x12')],_0x4e4828);_0x1aad4b(_0x1a2346['error'](0x1f4,_0x486187[_0x4f7b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5bb7c1d..a938457 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 _0xae24=['isAuthenticated','index','/:id','/:id/clone','post','put','update','destroy','multer','path','express','Router','../../config/environment','get'];(function(_0x258257,_0x32042d){var _0xafb58a=function(_0x506b5a){while(--_0x506b5a){_0x258257['push'](_0x258257['shift']());}};_0xafb58a(++_0x32042d);}(_0xae24,0x182));var _0x4ae2=function(_0x57deb3,_0x34fa5e){_0x57deb3=_0x57deb3-0x0;var _0x1d4d73=_0xae24[_0x57deb3];return _0x1d4d73;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ae2('0x4'));var controller=require('./trunk.controller');router[_0x4ae2('0x5')]('/',auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x7')]);router[_0x4ae2('0x5')](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller['show']);router['post'](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['clone']);router[_0x4ae2('0xa')]('/',auth[_0x4ae2('0x6')](),controller['create']);router[_0x4ae2('0xb')](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0xc')]);router['delete'](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0xd')]);module['exports']=router; \ No newline at end of file +var _0xed1f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','clone','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xed1f,0x6a));var _0xfed1=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xed1f[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var auth=require(_0xfed1('0x6'));var interaction=require(_0xfed1('0x7'));var config=require(_0xfed1('0x8'));var controller=require(_0xfed1('0x9'));router[_0xfed1('0xa')]('/',auth[_0xfed1('0xb')](),controller[_0xfed1('0xc')]);router[_0xfed1('0xa')](_0xfed1('0xd'),auth[_0xfed1('0xb')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xf')]('/:id/clone',auth[_0xfed1('0xb')](),controller[_0xfed1('0x10')]);router['post']('/',auth[_0xfed1('0xb')](),controller[_0xfed1('0x11')]);router['put'](_0xfed1('0xd'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);router[_0xfed1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xfed1('0x14')]);module[_0xfed1('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 448c46d..d8f3cd8 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 _0x816a=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','inband','auto','yes','update','outgoing','force_rport,comedia','nat','join','getDataValue','all','ulaw;alaw;gsm','allow','port,invite','insecure'];(function(_0x41667c,_0x5151be){var _0x4a2870=function(_0x2ff741){while(--_0x2ff741){_0x41667c['push'](_0x41667c['shift']());}};_0x4a2870(++_0x5151be);}(_0x816a,0x15f));var _0xa816=function(_0x204057,_0x2fa86e){_0x204057=_0x204057-0x0;var _0x25ce2c=_0x816a[_0x204057];return _0x25ce2c;};'use strict';var Sequelize=require(_0xa816('0x0'));module[_0xa816('0x1')]={'name':{'type':Sequelize[_0xa816('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x4'),_0xa816('0x5'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa816('0x2')],'allowNull':![],'defaultValue':_0xa816('0x6')},'callingpres':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x7'),_0xa816('0x8'),'ALLOWED_FAILED_SCREEN',_0xa816('0x9'),_0xa816('0xa'),_0xa816('0xb'),_0xa816('0xc'),_0xa816('0xd'))},'deny':{'type':Sequelize[_0xa816('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xa816('0x2')]},'md5secret':{'type':Sequelize[_0xa816('0x2')]},'remotesecret':{'type':Sequelize[_0xa816('0x2')]},'transport':{'type':Sequelize[_0xa816('0x2')],'defaultValue':_0xa816('0xe'),'set':function(_0x3b5b68){this[_0xa816('0xf')](_0xa816('0x10'),_0x3b5b68?_0x3b5b68['join'](','):null);},'get':function(){return this['getDataValue'](_0xa816('0x10'))?this['getDataValue'](_0xa816('0x10'))[_0xa816('0x11')](','):null;},'comment':_0xa816('0x12')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833','info','shortinfo',_0xa816('0x13'),_0xa816('0x14')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no','nonat',_0xa816('0x16'),_0xa816('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa816('0x2')]},'directmediadeny':{'type':Sequelize[_0xa816('0x2')]},'nat':{'type':Sequelize[_0xa816('0x2')],'defaultValue':_0xa816('0x18'),'set':function(_0x980ecf){this[_0xa816('0xf')](_0xa816('0x19'),_0x980ecf?_0x980ecf[_0xa816('0x1a')](','):null);},'get':function(){return this['getDataValue'](_0xa816('0x19'))?this[_0xa816('0x1b')](_0xa816('0x19'))[_0xa816('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xa816('0x2')]},'namedcallgroup':{'type':Sequelize[_0xa816('0x2')]},'pickupgroup':{'type':Sequelize[_0xa816('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa816('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xa816('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4dc150){this[_0xa816('0xf')]('allow',_0x4dc150?_0x4dc150['join'](';'):_0xa816('0x1d'));},'get':function(){return this[_0xa816('0x1b')](_0xa816('0x1e'))?this[_0xa816('0x1b')](_0xa816('0x1e'))[_0xa816('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xa816('0x15'),'no')},'insecure':{'type':Sequelize[_0xa816('0x2')],'defaultValue':_0xa816('0x1f'),'set':function(_0x17959e){this[_0xa816('0xf')](_0xa816('0x20'),_0x17959e?_0x17959e['join'](','):null);},'get':function(){return this[_0xa816('0x1b')](_0xa816('0x20'))?this[_0xa816('0x1b')](_0xa816('0x20'))[_0xa816('0x11')](','):null;},'comment':_0xa816('0x21')},'trustrpid':{'type':Sequelize[_0xa816('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xa816('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa816('0x3')]('yes','no',_0xa816('0x22'))},'promiscredir':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no')},'accountcode':{'type':Sequelize[_0xa816('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa816('0x2')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xa816('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xa816('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xa816('0x3')]('yes','no',_0xa816('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa816('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xa816('0x15'),'no')},'mailbox':{'type':Sequelize[_0xa816('0x2')]},'session_timers':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x25'),_0xa816('0x26'),_0xa816('0x27'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xa816('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x28'),_0xa816('0x29')),'defaultValue':_0xa816('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xa816('0x2')]},'fromdomain':{'type':Sequelize[_0xa816('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa816('0x23')](0x5)},'qualify':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xa816('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa816('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa816('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0xa816('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa816('0x2')]},'callbackextension':{'type':Sequelize[_0xa816('0x2')]},'timert1':{'type':Sequelize[_0xa816('0x23')](0xb)},'timerb':{'type':Sequelize[_0xa816('0x23')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xa816('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xa816('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xa816('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xa816('0x23')](0xb)},'encryption':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no')},'force_avp':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no')},'icesupport':{'type':Sequelize[_0xa816('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xa816('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa816('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xa816('0x2')]},'dtlscafile':{'type':Sequelize[_0xa816('0x2')]},'dtlscapath':{'type':Sequelize[_0xa816('0x2')]},'dtlssetup':{'type':Sequelize[_0xa816('0x3')]('active',_0xa816('0x2b'),_0xa816('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa816('0x2')]},'usereqphone':{'type':Sequelize[_0xa816('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa816('0x2')]},'recordofffeature':{'type':Sequelize[_0xa816('0x2')]},'call_limit':{'type':Sequelize[_0xa816('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xa816('0x15'),'no')},'vmexten':{'type':Sequelize[_0xa816('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xa816('0x2')]},'parkinglot':{'type':Sequelize[_0xa816('0x2')]},'description':{'type':Sequelize[_0xa816('0x2')]},'host':{'type':Sequelize[_0xa816('0x2')],'defaultValue':_0xa816('0x2d')},'canreinvite':{'type':Sequelize[_0xa816('0x3')](_0xa816('0x15'),'no','nonat','update',_0xa816('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa816('0x2')]},'otherFields':{'type':Sequelize[_0xa816('0x2')]},'active':{'type':Sequelize[_0xa816('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa816('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xb678=['ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','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','originate','uas','pai','fingerprint','certificate','passive','actpass','dynamic','nonat','update,nonat','sequelize','exports','STRING','ENUM','friend','user'];(function(_0x5bc69d,_0x25137d){var _0x154d9c=function(_0x10a8b0){while(--_0x10a8b0){_0x5bc69d['push'](_0x5bc69d['shift']());}};_0x154d9c(++_0x25137d);}(_0xb678,0x1ee));var _0x8b67=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb678[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x8b67('0x0'));module[_0x8b67('0x1')]={'name':{'type':Sequelize[_0x8b67('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x4'),_0x8b67('0x5'),'peer'),'allowNull':![],'defaultValue':_0x8b67('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x8b67('0x3')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x8b67('0x6'),_0x8b67('0x7'),_0x8b67('0x8'),_0x8b67('0x9'),'PROHIB')},'deny':{'type':Sequelize[_0x8b67('0x2')]},'permit':{'type':Sequelize[_0x8b67('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x8b67('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x8b67('0x2')],'defaultValue':_0x8b67('0xa'),'set':function(_0x30926f){this[_0x8b67('0xb')](_0x8b67('0xc'),_0x30926f?_0x30926f[_0x8b67('0xd')](','):null);},'get':function(){return this[_0x8b67('0xe')](_0x8b67('0xc'))?this[_0x8b67('0xe')](_0x8b67('0xc'))['split'](','):null;},'comment':_0x8b67('0xf')},'dtmfmode':{'type':Sequelize['ENUM'](_0x8b67('0x10'),_0x8b67('0x11'),_0x8b67('0x12'),_0x8b67('0x13'),_0x8b67('0x14')),'defaultValue':_0x8b67('0x10')},'directmedia':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no','nonat',_0x8b67('0x16'),_0x8b67('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8b67('0x2')]},'directmediadeny':{'type':Sequelize[_0x8b67('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x8b67('0x18'),'set':function(_0x5ebb81){this[_0x8b67('0xb')]('nat',_0x5ebb81?_0x5ebb81['join'](','):null);},'get':function(){return this[_0x8b67('0xe')](_0x8b67('0x19'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0x8b67('0x1a')},'callgroup':{'type':Sequelize[_0x8b67('0x2')]},'namedcallgroup':{'type':Sequelize[_0x8b67('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x8b67('0x2')]},'language':{'type':Sequelize[_0x8b67('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8b67('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8b67('0x2')],'defaultValue':_0x8b67('0x1b')},'allow':{'type':Sequelize[_0x8b67('0x2')],'allowNull':![],'defaultValue':_0x8b67('0x1c'),'set':function(_0x3f128a){this[_0x8b67('0xb')](_0x8b67('0x1d'),_0x3f128a?_0x3f128a[_0x8b67('0xd')](';'):_0x8b67('0x1c'));},'get':function(){return this[_0x8b67('0xe')](_0x8b67('0x1d'))?this[_0x8b67('0xe')](_0x8b67('0x1d'))[_0x8b67('0x1e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x8b67('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x8b67('0x2')],'defaultValue':_0x8b67('0x1f'),'set':function(_0xc841ba){this['setDataValue']('insecure',_0xc841ba?_0xc841ba[_0x8b67('0xd')](','):null);},'get':function(){return this[_0x8b67('0xe')](_0x8b67('0x20'))?this[_0x8b67('0xe')]('insecure')[_0x8b67('0x1e')](','):null;},'comment':_0x8b67('0x21')},'trustrpid':{'type':Sequelize['ENUM'](_0x8b67('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x8b67('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8b67('0x3')]('yes','no',_0x8b67('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0x8b67('0x15'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8b67('0x15'),'no')},'accountcode':{'type':Sequelize[_0x8b67('0x23')](0xb)},'setvar':{'type':Sequelize[_0x8b67('0x2')]},'callerid':{'type':Sequelize[_0x8b67('0x2')],'defaultValue':_0x8b67('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no'),'defaultValue':_0x8b67('0x15')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8b67('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x8b67('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no',_0x8b67('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8b67('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no')},'mailbox':{'type':Sequelize[_0x8b67('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x8b67('0x26'),_0x8b67('0x27'),_0x8b67('0x28'))},'session_expires':{'type':Sequelize[_0x8b67('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x8b67('0x3')]('uac',_0x8b67('0x29')),'defaultValue':_0x8b67('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x8b67('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x8b67('0x2')]},'fromuser':{'type':Sequelize[_0x8b67('0x2')]},'port':{'type':Sequelize[_0x8b67('0x23')](0x5)},'qualify':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x8b67('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x8b67('0x2')]},'defaultuser':{'type':Sequelize[_0x8b67('0x2')]},'rtptimeout':{'type':Sequelize[_0x8b67('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8b67('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x8b67('0x15'),'no',_0x8b67('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8b67('0x2')]},'callbackextension':{'type':Sequelize[_0x8b67('0x2')]},'timert1':{'type':Sequelize[_0x8b67('0x23')](0xb)},'timerb':{'type':Sequelize[_0x8b67('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8b67('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x8b67('0x2')]},'contactdeny':{'type':Sequelize[_0x8b67('0x2')]},'contactacl':{'type':Sequelize[_0x8b67('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x8b67('0x2')]},'maxforwards':{'type':Sequelize[_0x8b67('0x23')](0xb)},'encryption':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x8b67('0x15'),'no')},'icesupport':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x8b67('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x8b67('0x3')]('yes','no',_0x8b67('0x2b'),_0x8b67('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x8b67('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x8b67('0x2')]},'dtlscipher':{'type':Sequelize[_0x8b67('0x2')]},'dtlscafile':{'type':Sequelize[_0x8b67('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x8b67('0x3')]('active',_0x8b67('0x2d'),_0x8b67('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8b67('0x2')]},'recordofffeature':{'type':Sequelize[_0x8b67('0x2')]},'call_limit':{'type':Sequelize[_0x8b67('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x8b67('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no')},'vmexten':{'type':Sequelize[_0x8b67('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x8b67('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8b67('0x2')]},'host':{'type':Sequelize[_0x8b67('0x2')],'defaultValue':_0x8b67('0x2f')},'canreinvite':{'type':Sequelize[_0x8b67('0x3')](_0x8b67('0x15'),'no',_0x8b67('0x30'),_0x8b67('0x16'),_0x8b67('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8b67('0x2')]},'otherFields':{'type':Sequelize[_0x8b67('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 0a290ba..8d9431b 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 _0x263f=['Trunk','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','intersection','catch','clone','params','find','createdAt','updatedAt','body','omit','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','render','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','server/files/templates/registry.ejs','writeFileSync','Reload','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','client','http','test','ValidationError','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','then','name','send','index','map'];(function(_0x60dfb5,_0x1437a8){var _0x197bce=function(_0x4a5488){while(--_0x4a5488){_0x60dfb5['push'](_0x60dfb5['shift']());}};_0x197bce(++_0x1437a8);}(_0x263f,0x182));var _0xf263=function(_0x2372c7,_0xf20d07){_0x2372c7=_0x2372c7-0x0;var _0xaa8d12=_0x263f[_0x2372c7];return _0xaa8d12;};'use strict';var pdf=require(_0xf263('0x0'));var emlformat=require(_0xf263('0x1'));var rimraf=require(_0xf263('0x2'));var zipdir=require(_0xf263('0x3'));var jsonpatch=require(_0xf263('0x4'));var rp=require(_0xf263('0x5'));var moment=require('moment');var BPromise=require(_0xf263('0x6'));var Mustache=require(_0xf263('0x7'));var util=require(_0xf263('0x8'));var path=require('path');var sox=require(_0xf263('0x9'));var csv=require(_0xf263('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf263('0xb'));var crypto=require(_0xf263('0xc'));var jsforce=require(_0xf263('0xd'));var deskjs=require(_0xf263('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf263('0xf'));var Papa=require(_0xf263('0x10'));var Redis=require(_0xf263('0x11'));var authService=require(_0xf263('0x12'));var qs=require(_0xf263('0x13'));var as=require(_0xf263('0x14'));var hardwareService=require(_0xf263('0x15'));var logger=require('../../config/logger')(_0xf263('0x16'));var utils=require('../../config/utils');var config=require(_0xf263('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xf263('0x18')][_0xf263('0x19')]({'port':0x232a});function checkPasswordPattern(_0x17471d,_0xd7a907,_0x1037a4){if(_0x1037a4){var _0xc6a733=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc6a733[_0xf263('0x1a')](_0xd7a907)){return _0x17471d;}else{throw new db['Sequelize'][(_0xf263('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 _0x17471d;}}function respondWithRpcPromise(_0x2a79aa,_0x27b16a,_0x3ac432,_0x402739){return new BPromise(function(_0x16b4dd,_0xf45ebe){var _0x506789=_0x402739||client;return _0x506789['request'](_0x2a79aa,_0x3ac432)['then'](function(_0x2bbe2f){logger[_0xf263('0x1c')](_0xf263('0x1d'),_0x27b16a,_0xf263('0x1e'));logger[_0xf263('0x1f')]('Trunk,\x20%s,\x20%s,\x20%s',_0x27b16a,_0xf263('0x1e'),JSON['stringify'](_0x2bbe2f));if(_0x2bbe2f[_0xf263('0x20')]){if(_0x2bbe2f[_0xf263('0x20')][_0xf263('0x21')]===0x1f4){logger['error'](_0xf263('0x1d'),_0x27b16a,_0x2bbe2f[_0xf263('0x20')][_0xf263('0x22')]);return _0xf45ebe(_0x2bbe2f['error'][_0xf263('0x22')]);}logger[_0xf263('0x20')](_0xf263('0x1d'),_0x27b16a,_0x2bbe2f[_0xf263('0x20')][_0xf263('0x22')]);return _0x16b4dd(_0x2bbe2f[_0xf263('0x20')][_0xf263('0x22')]);}else{logger[_0xf263('0x1c')](_0xf263('0x1d'),_0x27b16a,_0xf263('0x1e'));_0x16b4dd(_0x2bbe2f[_0xf263('0x23')]['message']);}})['catch'](function(_0x5dc48f){logger[_0xf263('0x20')](_0xf263('0x1d'),_0x27b16a,_0x5dc48f);_0xf45ebe(_0x5dc48f);});});}function respondWithStatusCode(_0x231748,_0x1b3603){_0x1b3603=_0x1b3603||0xcc;return function(_0x36df8e){if(_0x36df8e){return _0x231748[_0xf263('0x24')](_0x1b3603);}return _0x231748[_0xf263('0x25')](_0x1b3603)[_0xf263('0x26')]();};}function respondWithResult(_0x3c44f1,_0xbeabe5){_0xbeabe5=_0xbeabe5||0xc8;return function(_0x2411a2){if(_0x2411a2){return _0x3c44f1['status'](_0xbeabe5)[_0xf263('0x27')](_0x2411a2);}};}function respondWithFilteredResult(_0x4ea2c4,_0x3f74ed){return function(_0x4f148c){if(_0x4f148c){var _0x368cfc=_0x4f148c[_0xf263('0x28')],_0x3500b2=_0x3f74ed[_0xf263('0x29')],_0x5a11bf=_0x3f74ed[_0xf263('0x29')]+_0x3f74ed[_0xf263('0x2a')],_0x57ae2f;if(_0x5a11bf>=_0x368cfc){_0x5a11bf=_0x368cfc;_0x57ae2f=0xc8;}else{_0x57ae2f=0xce;}_0x4ea2c4[_0xf263('0x25')](_0x57ae2f);return _0x4ea2c4[_0xf263('0x2b')](_0xf263('0x2c'),_0x3500b2+'-'+_0x5a11bf+'/'+_0x368cfc)[_0xf263('0x27')](_0x4f148c);}return null;};}function patchUpdates(_0x5383d8){return function(_0x302c81){try{jsonpatch[_0xf263('0x2d')](_0x302c81,_0x5383d8,!![]);}catch(_0x3d6f5e){return BPromise[_0xf263('0x2e')](_0x3d6f5e);}return _0x302c81[_0xf263('0x2f')]();};}function saveUpdates(_0x89770f,_0x213db9){return function(_0x1dcd5f){if(_0x1dcd5f){return _0x1dcd5f[_0xf263('0x30')](_0x89770f)['then'](function(_0x238623){return _0x238623;});}return null;};}function removeEntity(_0x5a202e,_0x48f260){return function(_0xac742e){if(_0xac742e){return _0xac742e[_0xf263('0x31')]()['then'](function(){var _0x36414b=_0xac742e[_0xf263('0x32')]({'plain':!![]});var _0x482251=_0xf263('0x33');return db[_0xf263('0x34')][_0xf263('0x31')]({'where':{'type':_0x482251,'resourceId':_0x36414b['id']}})[_0xf263('0x35')](function(){return _0xac742e;});})[_0xf263('0x35')](function(){_0x5a202e[_0xf263('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x385ba6,_0x13506b){return function(_0x53ac8b){if(!_0x53ac8b){_0x385ba6['sendStatus'](0x194);}return _0x53ac8b;};}function handleError(_0x15ba56,_0x42db2e){_0x42db2e=_0x42db2e||0x1f4;return function(_0x1b942e){logger[_0xf263('0x20')](_0x1b942e['stack']);if(_0x1b942e[_0xf263('0x36')]){delete _0x1b942e[_0xf263('0x36')];}_0x15ba56[_0xf263('0x25')](_0x42db2e)[_0xf263('0x37')](_0x1b942e);};}exports[_0xf263('0x38')]=function(_0x49c9a1,_0x100a45){var _0x3a6834={},_0x1600f8={},_0x4f6875={'count':0x0,'rows':[]};var _0x1ece85=_[_0xf263('0x39')](db[_0xf263('0x3a')][_0xf263('0x3b')],function(_0x3bbe13){return{'name':_0x3bbe13['fieldName'],'type':_0x3bbe13[_0xf263('0x3c')][_0xf263('0x3d')]};});_0x1600f8[_0xf263('0x3e')]=_['map'](_0x1ece85,_0xf263('0x36'));_0x1600f8[_0xf263('0x3f')]=_[_0xf263('0x40')](_0x49c9a1['query']);_0x1600f8[_0xf263('0x41')]=_['intersection'](_0x1600f8[_0xf263('0x3e')],_0x1600f8[_0xf263('0x3f')]);_0x3a6834[_0xf263('0x42')]=_['intersection'](_0x1600f8['model'],qs['fields'](_0x49c9a1[_0xf263('0x3f')][_0xf263('0x43')]));_0x3a6834['attributes']=_0x3a6834['attributes'][_0xf263('0x44')]?_0x3a6834[_0xf263('0x42')]:_0x1600f8[_0xf263('0x3e')];if(!_0x49c9a1[_0xf263('0x3f')][_0xf263('0x45')]('nolimit')){_0x3a6834[_0xf263('0x2a')]=qs[_0xf263('0x2a')](_0x49c9a1[_0xf263('0x3f')][_0xf263('0x2a')]);_0x3a6834[_0xf263('0x29')]=qs['offset'](_0x49c9a1[_0xf263('0x3f')][_0xf263('0x29')]);}_0x3a6834[_0xf263('0x46')]=qs['sort'](_0x49c9a1['query'][_0xf263('0x47')]);_0x3a6834['where']=qs['filters'](_[_0xf263('0x48')](_0x49c9a1[_0xf263('0x3f')],_0x1600f8[_0xf263('0x41')]),_0x1ece85);if(_0x49c9a1['query'][_0xf263('0x49')]){_0x3a6834[_0xf263('0x4a')]=_['merge'](_0x3a6834[_0xf263('0x4a')],{'$or':_[_0xf263('0x39')](_0x1ece85,function(_0x51db8f){if(_0x51db8f[_0xf263('0x3c')]!==_0xf263('0x4b')){var _0x545220={};_0x545220[_0x51db8f[_0xf263('0x36')]]={'$like':'%'+_0x49c9a1[_0xf263('0x3f')][_0xf263('0x49')]+'%'};return _0x545220;}})});}_0x3a6834=_[_0xf263('0x4c')]({},_0x3a6834,_0x49c9a1[_0xf263('0x4d')]);var _0x147e26={'where':_0x3a6834[_0xf263('0x4a')]};return db['Trunk'][_0xf263('0x28')](_0x147e26)[_0xf263('0x35')](function(_0x19e09c){_0x4f6875[_0xf263('0x28')]=_0x19e09c;if(_0x49c9a1[_0xf263('0x3f')][_0xf263('0x4e')]){_0x3a6834[_0xf263('0x4f')]=[{'all':!![]}];}return db[_0xf263('0x3a')]['findAll'](_0x3a6834);})[_0xf263('0x35')](function(_0x227ece){_0x4f6875[_0xf263('0x50')]=_0x227ece;return _0x4f6875;})[_0xf263('0x35')](respondWithFilteredResult(_0x100a45,_0x3a6834))['catch'](handleError(_0x100a45,null));};exports[_0xf263('0x51')]=function(_0x4a3f83,_0x773a03){var _0x159852={'raw':![],'where':{'id':_0x4a3f83['params']['id']}},_0x22f9bd={};_0x22f9bd['model']=_['keys'](db['Trunk']['rawAttributes']);_0x22f9bd[_0xf263('0x3f')]=_[_0xf263('0x40')](_0x4a3f83['query']);_0x22f9bd[_0xf263('0x41')]=_[_0xf263('0x52')](_0x22f9bd[_0xf263('0x3e')],_0x22f9bd[_0xf263('0x3f')]);_0x159852[_0xf263('0x42')]=_[_0xf263('0x52')](_0x22f9bd[_0xf263('0x3e')],qs[_0xf263('0x43')](_0x4a3f83[_0xf263('0x3f')][_0xf263('0x43')]));_0x159852[_0xf263('0x42')]=_0x159852[_0xf263('0x42')]['length']?_0x159852[_0xf263('0x42')]:_0x22f9bd['model'];if(_0x4a3f83['query'][_0xf263('0x4e')]){_0x159852['include']=[{'all':!![]}];}_0x159852=_['merge']({},_0x159852,_0x4a3f83[_0xf263('0x4d')]);return db[_0xf263('0x3a')]['find'](_0x159852)[_0xf263('0x35')](handleEntityNotFound(_0x773a03,null))['then'](respondWithResult(_0x773a03,null))[_0xf263('0x53')](handleError(_0x773a03,null));};exports[_0xf263('0x54')]=function(_0x5611fc,_0x3d5aa2){var _0x28700f={'where':{'id':_0x5611fc[_0xf263('0x55')]['id']}},_0x5b58e8={};_0x5b58e8['model']=_[_0xf263('0x40')](db[_0xf263('0x3a')][_0xf263('0x3b')]);_0x28700f[_0xf263('0x42')]=_[_0xf263('0x52')](_0x5b58e8[_0xf263('0x3e')],qs[_0xf263('0x43')](_0x5611fc[_0xf263('0x3f')][_0xf263('0x43')]));_0x28700f[_0xf263('0x42')]=_0x28700f[_0xf263('0x42')][_0xf263('0x44')]?_0x28700f[_0xf263('0x42')]:_0x5b58e8[_0xf263('0x3e')];if(_0x5611fc['query']['includeAll']){_0x28700f[_0xf263('0x4f')]=[{'all':!![]}];}_0x28700f=_['merge']({},_0x28700f,_0x5611fc[_0xf263('0x4d')]);return db[_0xf263('0x3a')][_0xf263('0x56')](_0x28700f)[_0xf263('0x35')](handleEntityNotFound(_0x3d5aa2,null))[_0xf263('0x35')](function(_0x6423f9){if(_0x6423f9){var _0x22285e=_0x6423f9[_0xf263('0x32')]({'plain':!![]});_0x22285e=qs['omit'](_0x22285e,['id',_0xf263('0x57'),_0xf263('0x58')]);_0x5611fc[_0xf263('0x59')]=_[_0xf263('0x5a')](_0x5611fc[_0xf263('0x59')],['id','createdAt',_0xf263('0x58')]);return db['Trunk'][_0xf263('0x5b')](_['merge'](_0x22285e,_0x5611fc[_0xf263('0x59')]),{'include':_0x5611fc[_0xf263('0x3f')]['includeAll']?[{'all':!![]}]:undefined})[_0xf263('0x35')](function(_0x38fff8){var _0x3d0691=_0x5611fc[_0xf263('0x5c')]['get']({'plain':!![]});if(!_0x3d0691)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d0691[_0xf263('0x5d')]===_0xf263('0x5c')){var _0x53f0be=_0x38fff8[_0xf263('0x32')]({'plain':!![]});var _0x8f88d0=_0xf263('0x33');return db['UserProfileSection']['find']({'where':{'name':_0x8f88d0,'userProfileId':_0x3d0691['userProfileId']},'raw':!![]})['then'](function(_0xfd77e2){if(_0xfd77e2&&_0xfd77e2[_0xf263('0x5e')]===0x0){return db['UserProfileResource'][_0xf263('0x5b')]({'name':_0x53f0be[_0xf263('0x36')],'resourceId':_0x53f0be['id'],'type':_0xfd77e2[_0xf263('0x36')],'sectionId':_0xfd77e2['id']},{})['then'](function(){return _0x38fff8;});}else{return _0x38fff8;}})[_0xf263('0x53')](function(_0x3bd5f2){logger[_0xf263('0x20')](_0xf263('0x5f'),_0x3bd5f2);throw _0x3bd5f2;});}return _0x38fff8;});}})[_0xf263('0x35')](respondWithResult(_0x3d5aa2,0xc9))[_0xf263('0x53')](handleError(_0x3d5aa2,null));};exports[_0xf263('0x5b')]=function(_0x390741,_0x4ba929,_0x40b6d5){var _0x1170c5;return db[_0xf263('0x3a')]['create'](_0x390741[_0xf263('0x59')],{'raw':!![]})[_0xf263('0x35')](function(_0x27a354){_0x1170c5=_0x27a354;return db[_0xf263('0x3a')][_0xf263('0x60')]({'raw':!![]});})[_0xf263('0x35')](function(_0x4a8813){var _0x2e20d1=fs['readFileSync'](path[_0xf263('0x61')](config[_0xf263('0x62')],_0xf263('0x63')),_0xf263('0x64'));var _0x299e52=fs[_0xf263('0x65')](path[_0xf263('0x61')](config[_0xf263('0x62')],'server/files/templates/registry.ejs'),_0xf263('0x64'));var _0x432b96=ejs[_0xf263('0x66')](_0x2e20d1,{'trunks':_0x4a8813||[]});fs['writeFileSync'](_0xf263('0x67'),_0x432b96);if(_0x1170c5['registry']){var _0xa3751c=ejs[_0xf263('0x66')](_0x299e52,{'trunks':_0x4a8813||[]});fs['writeFileSync'](_0xf263('0x68'),_0xa3751c);}})[_0xf263('0x35')](function(){return respondWithRpcPromise('Reload',_0xf263('0x5b'),{'module':_0xf263('0x69')});})[_0xf263('0x35')](function(){var _0x4e85fa=_0x390741['user']['get']({'plain':!![]});if(!_0x4e85fa)throw new Error(_0xf263('0x6a'));if(_0x4e85fa[_0xf263('0x5d')]===_0xf263('0x5c')){var _0x4b5575=_0x1170c5['get']({'plain':!![]});return db[_0xf263('0x6b')][_0xf263('0x56')]({'where':{'name':_0xf263('0x33'),'userProfileId':_0x4e85fa['userProfileId']},'raw':!![]})[_0xf263('0x35')](function(_0x4e574d){if(_0x4e574d&&_0x4e574d[_0xf263('0x5e')]===0x0){return db[_0xf263('0x34')][_0xf263('0x5b')]({'name':_0x4b5575[_0xf263('0x36')],'resourceId':_0x4b5575['id'],'type':_0x4e574d[_0xf263('0x36')],'sectionId':_0x4e574d['id']},{})['then'](function(){return _0x1170c5;});}else{return _0x1170c5;}})['catch'](function(_0x82a7e5){logger[_0xf263('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x82a7e5);throw _0x82a7e5;});}return _0x1170c5;})[_0xf263('0x35')](respondWithResult(_0x4ba929,0xc9))[_0xf263('0x53')](handleError(_0x4ba929,null));};exports[_0xf263('0x30')]=function(_0xbd0f4e,_0x13758d,_0x2ad3e4){var _0x2d4f74;return db['Trunk'][_0xf263('0x56')]({'where':{'id':_0xbd0f4e[_0xf263('0x55')]['id']}})[_0xf263('0x35')](handleEntityNotFound(_0x13758d,null))[_0xf263('0x35')](saveUpdates(_0xbd0f4e[_0xf263('0x59')],null))['then'](function(_0x10b1e9){if(_0x10b1e9){_0x2d4f74=_0x10b1e9;return db['Trunk'][_0xf263('0x60')]({'raw':!![]});}})[_0xf263('0x35')](function(_0x342a5f){if(_0x342a5f){var _0x35c536=fs[_0xf263('0x65')](path['join'](config[_0xf263('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x49f93d=fs['readFileSync'](path[_0xf263('0x61')](config[_0xf263('0x62')],_0xf263('0x6c')),_0xf263('0x64'));var _0x38c1a9=ejs[_0xf263('0x66')](_0x35c536,{'trunks':_0x342a5f||[]});fs[_0xf263('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x38c1a9);var _0x456749=ejs['render'](_0x49f93d,{'trunks':_0x342a5f||[]});fs[_0xf263('0x6d')](_0xf263('0x68'),_0x456749);return respondWithRpcPromise(_0xf263('0x6e'),_0xf263('0x30'),{'module':'chan_sip.so'});}return null;})[_0xf263('0x35')](function(_0x22f274){if(_0x22f274){return _0x2d4f74;}})[_0xf263('0x35')](respondWithResult(_0x13758d,null))[_0xf263('0x53')](handleError(_0x13758d,null));};exports[_0xf263('0x31')]=function(_0x523412,_0xd6d3a7,_0x3d5c09){var _0x174a4a;return db[_0xf263('0x3a')][_0xf263('0x56')]({'where':{'id':_0x523412[_0xf263('0x55')]['id']}})[_0xf263('0x35')](handleEntityNotFound(_0xd6d3a7,null))[_0xf263('0x35')](removeEntity(_0xd6d3a7,null))['then'](function(){return db['Trunk'][_0xf263('0x60')]({'raw':!![]});})[_0xf263('0x35')](function(_0x2a90f8){var _0x5645a8=fs[_0xf263('0x65')](path['join'](config[_0xf263('0x62')],_0xf263('0x63')),'utf8');var _0x178f6c=fs[_0xf263('0x65')](path[_0xf263('0x61')](config[_0xf263('0x62')],_0xf263('0x6c')),_0xf263('0x64'));var _0x18b979=ejs[_0xf263('0x66')](_0x5645a8,{'trunks':_0x2a90f8});var _0x432f2c=ejs[_0xf263('0x66')](_0x178f6c,{'trunks':_0x2a90f8});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x18b979);fs['writeFileSync'](_0xf263('0x68'),_0x432f2c);return respondWithRpcPromise(_0xf263('0x6e'),'destroy',{'module':_0xf263('0x69')});})['catch'](handleError(_0xd6d3a7,null));}; \ No newline at end of file +var _0x6947=['Reload','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','ValidationError','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','count','includeAll','include','rows','params','options','find','clone','get','createdAt','updatedAt','body','omit','user','role','create','findAll','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0x6947,0x72));var _0x7694=function(_0x1fa57e,_0x19c2f3){_0x1fa57e=_0x1fa57e-0x0;var _0x1111c6=_0x6947[_0x1fa57e];return _0x1111c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7694('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7694('0x1'));var jsonpatch=require(_0x7694('0x2'));var rp=require(_0x7694('0x3'));var moment=require(_0x7694('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7694('0x5'));var path=require(_0x7694('0x6'));var sox=require(_0x7694('0x7'));var csv=require(_0x7694('0x8'));var ejs=require(_0x7694('0x9'));var fs=require('fs');var _=require(_0x7694('0xa'));var squel=require('squel');var crypto=require(_0x7694('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7694('0xc'));var toCsv=require(_0x7694('0x8'));var querystring=require('querystring');var Papa=require(_0x7694('0xd'));var Redis=require(_0x7694('0xe'));var authService=require(_0x7694('0xf'));var qs=require(_0x7694('0x10'));var as=require(_0x7694('0x11'));var hardwareService=require(_0x7694('0x12'));var logger=require(_0x7694('0x13'))('api');var utils=require(_0x7694('0x14'));var config=require(_0x7694('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7694('0x16'));var client=jayson[_0x7694('0x17')][_0x7694('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4c3341,_0x5f4904,_0x3d285d){if(_0x3d285d){var _0x46612b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x46612b[_0x7694('0x19')](_0x5f4904)){return _0x4c3341;}else{throw new db['Sequelize'][(_0x7694('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 _0x4c3341;}}function respondWithRpcPromise(_0x3b46e6,_0x1e7706,_0x1bec84,_0x306c31){return new BPromise(function(_0x4298a2,_0x550c85){var _0x23432d=_0x306c31||client;return _0x23432d[_0x7694('0x1b')](_0x3b46e6,_0x1bec84)[_0x7694('0x1c')](function(_0xc7c0b4){logger['info'](_0x7694('0x1d'),_0x1e7706,_0x7694('0x1e'));logger[_0x7694('0x1f')](_0x7694('0x20'),_0x1e7706,_0x7694('0x1e'),JSON[_0x7694('0x21')](_0xc7c0b4));if(_0xc7c0b4['error']){if(_0xc7c0b4[_0x7694('0x22')]['code']===0x1f4){logger[_0x7694('0x22')](_0x7694('0x1d'),_0x1e7706,_0xc7c0b4[_0x7694('0x22')][_0x7694('0x23')]);return _0x550c85(_0xc7c0b4[_0x7694('0x22')]['message']);}logger[_0x7694('0x22')](_0x7694('0x1d'),_0x1e7706,_0xc7c0b4[_0x7694('0x22')][_0x7694('0x23')]);return _0x4298a2(_0xc7c0b4[_0x7694('0x22')]['message']);}else{logger[_0x7694('0x24')](_0x7694('0x1d'),_0x1e7706,_0x7694('0x1e'));_0x4298a2(_0xc7c0b4[_0x7694('0x25')]['message']);}})[_0x7694('0x26')](function(_0x51ce21){logger[_0x7694('0x22')]('Trunk,\x20%s,\x20%s',_0x1e7706,_0x51ce21);_0x550c85(_0x51ce21);});});}function respondWithStatusCode(_0x2d77b7,_0x4fd5ff){_0x4fd5ff=_0x4fd5ff||0xcc;return function(_0xd3be74){if(_0xd3be74){return _0x2d77b7[_0x7694('0x27')](_0x4fd5ff);}return _0x2d77b7[_0x7694('0x28')](_0x4fd5ff)[_0x7694('0x29')]();};}function respondWithResult(_0x27269b,_0x350102){_0x350102=_0x350102||0xc8;return function(_0x285114){if(_0x285114){return _0x27269b['status'](_0x350102)[_0x7694('0x2a')](_0x285114);}};}function respondWithFilteredResult(_0x3c09fa,_0x2d4a79){return function(_0x3522ce){if(_0x3522ce){var _0x5c3e18=_0x3522ce['count'],_0x292553=_0x2d4a79[_0x7694('0x2b')],_0x374130=_0x2d4a79[_0x7694('0x2b')]+_0x2d4a79[_0x7694('0x2c')],_0x2facc7;if(_0x374130>=_0x5c3e18){_0x374130=_0x5c3e18;_0x2facc7=0xc8;}else{_0x2facc7=0xce;}_0x3c09fa['status'](_0x2facc7);return _0x3c09fa[_0x7694('0x2d')](_0x7694('0x2e'),_0x292553+'-'+_0x374130+'/'+_0x5c3e18)[_0x7694('0x2a')](_0x3522ce);}return null;};}function patchUpdates(_0x3eb1f2){return function(_0x241d47){try{jsonpatch[_0x7694('0x2f')](_0x241d47,_0x3eb1f2,!![]);}catch(_0x9b5fe0){return BPromise[_0x7694('0x30')](_0x9b5fe0);}return _0x241d47[_0x7694('0x31')]();};}function saveUpdates(_0x54d39e,_0xa6cf7d){return function(_0x37475a){if(_0x37475a){return _0x37475a[_0x7694('0x32')](_0x54d39e)[_0x7694('0x1c')](function(_0x4a5680){return _0x4a5680;});}return null;};}function removeEntity(_0x96b982,_0xa37b54){return function(_0x1fd736){if(_0x1fd736){return _0x1fd736[_0x7694('0x33')]()[_0x7694('0x1c')](function(){var _0x3529c9=_0x1fd736['get']({'plain':!![]});var _0x26e9a4=_0x7694('0x34');return db[_0x7694('0x35')][_0x7694('0x33')]({'where':{'type':_0x26e9a4,'resourceId':_0x3529c9['id']}})[_0x7694('0x1c')](function(){return _0x1fd736;});})[_0x7694('0x1c')](function(){_0x96b982[_0x7694('0x28')](0xcc)[_0x7694('0x29')]();});}};}function handleEntityNotFound(_0x270494,_0x4ad731){return function(_0x312424){if(!_0x312424){_0x270494['sendStatus'](0x194);}return _0x312424;};}function handleError(_0x3d3712,_0x13f8ed){_0x13f8ed=_0x13f8ed||0x1f4;return function(_0xb828b9){logger[_0x7694('0x22')](_0xb828b9[_0x7694('0x36')]);if(_0xb828b9[_0x7694('0x37')]){delete _0xb828b9[_0x7694('0x37')];}_0x3d3712[_0x7694('0x28')](_0x13f8ed)['send'](_0xb828b9);};}exports['index']=function(_0x3b0e0d,_0x8192ac){var _0x264781={},_0x5553c9={},_0x13794b={'count':0x0,'rows':[]};var _0x1b69e5=_[_0x7694('0x38')](db[_0x7694('0x39')][_0x7694('0x3a')],function(_0x3979d1){return{'name':_0x3979d1[_0x7694('0x3b')],'type':_0x3979d1[_0x7694('0x3c')][_0x7694('0x3d')]};});_0x5553c9[_0x7694('0x3e')]=_[_0x7694('0x38')](_0x1b69e5,_0x7694('0x37'));_0x5553c9[_0x7694('0x3f')]=_[_0x7694('0x40')](_0x3b0e0d[_0x7694('0x3f')]);_0x5553c9[_0x7694('0x41')]=_[_0x7694('0x42')](_0x5553c9[_0x7694('0x3e')],_0x5553c9[_0x7694('0x3f')]);_0x264781[_0x7694('0x43')]=_[_0x7694('0x42')](_0x5553c9['model'],qs['fields'](_0x3b0e0d[_0x7694('0x3f')][_0x7694('0x44')]));_0x264781[_0x7694('0x43')]=_0x264781['attributes'][_0x7694('0x45')]?_0x264781[_0x7694('0x43')]:_0x5553c9[_0x7694('0x3e')];if(!_0x3b0e0d['query']['hasOwnProperty'](_0x7694('0x46'))){_0x264781[_0x7694('0x2c')]=qs[_0x7694('0x2c')](_0x3b0e0d['query'][_0x7694('0x2c')]);_0x264781['offset']=qs[_0x7694('0x2b')](_0x3b0e0d[_0x7694('0x3f')][_0x7694('0x2b')]);}_0x264781[_0x7694('0x47')]=qs[_0x7694('0x48')](_0x3b0e0d[_0x7694('0x3f')][_0x7694('0x48')]);_0x264781['where']=qs[_0x7694('0x41')](_[_0x7694('0x49')](_0x3b0e0d[_0x7694('0x3f')],_0x5553c9[_0x7694('0x41')]),_0x1b69e5);if(_0x3b0e0d[_0x7694('0x3f')]['filter']){_0x264781[_0x7694('0x4a')]=_[_0x7694('0x4b')](_0x264781[_0x7694('0x4a')],{'$or':_[_0x7694('0x38')](_0x1b69e5,function(_0x439965){if(_0x439965[_0x7694('0x3c')]!==_0x7694('0x4c')){var _0x3329b6={};_0x3329b6[_0x439965['name']]={'$like':'%'+_0x3b0e0d[_0x7694('0x3f')][_0x7694('0x4d')]+'%'};return _0x3329b6;}})});}_0x264781=_['merge']({},_0x264781,_0x3b0e0d['options']);var _0x3afd93={'where':_0x264781['where']};return db[_0x7694('0x39')][_0x7694('0x4e')](_0x3afd93)[_0x7694('0x1c')](function(_0x15c4dd){_0x13794b[_0x7694('0x4e')]=_0x15c4dd;if(_0x3b0e0d[_0x7694('0x3f')][_0x7694('0x4f')]){_0x264781[_0x7694('0x50')]=[{'all':!![]}];}return db[_0x7694('0x39')]['findAll'](_0x264781);})[_0x7694('0x1c')](function(_0x20117d){_0x13794b[_0x7694('0x51')]=_0x20117d;return _0x13794b;})['then'](respondWithFilteredResult(_0x8192ac,_0x264781))[_0x7694('0x26')](handleError(_0x8192ac,null));};exports['show']=function(_0x3a776b,_0x51757a){var _0x5a597b={'raw':![],'where':{'id':_0x3a776b[_0x7694('0x52')]['id']}},_0x266c60={};_0x266c60[_0x7694('0x3e')]=_[_0x7694('0x40')](db[_0x7694('0x39')]['rawAttributes']);_0x266c60[_0x7694('0x3f')]=_[_0x7694('0x40')](_0x3a776b[_0x7694('0x3f')]);_0x266c60['filters']=_[_0x7694('0x42')](_0x266c60[_0x7694('0x3e')],_0x266c60[_0x7694('0x3f')]);_0x5a597b['attributes']=_[_0x7694('0x42')](_0x266c60[_0x7694('0x3e')],qs[_0x7694('0x44')](_0x3a776b[_0x7694('0x3f')][_0x7694('0x44')]));_0x5a597b[_0x7694('0x43')]=_0x5a597b['attributes'][_0x7694('0x45')]?_0x5a597b['attributes']:_0x266c60['model'];if(_0x3a776b[_0x7694('0x3f')][_0x7694('0x4f')]){_0x5a597b[_0x7694('0x50')]=[{'all':!![]}];}_0x5a597b=_[_0x7694('0x4b')]({},_0x5a597b,_0x3a776b[_0x7694('0x53')]);return db[_0x7694('0x39')][_0x7694('0x54')](_0x5a597b)[_0x7694('0x1c')](handleEntityNotFound(_0x51757a,null))[_0x7694('0x1c')](respondWithResult(_0x51757a,null))[_0x7694('0x26')](handleError(_0x51757a,null));};exports[_0x7694('0x55')]=function(_0x5feb64,_0xef40fa){var _0x3d98f4={'where':{'id':_0x5feb64[_0x7694('0x52')]['id']}},_0x17a552={};_0x17a552[_0x7694('0x3e')]=_[_0x7694('0x40')](db['Trunk'][_0x7694('0x3a')]);_0x3d98f4[_0x7694('0x43')]=_['intersection'](_0x17a552[_0x7694('0x3e')],qs[_0x7694('0x44')](_0x5feb64['query'][_0x7694('0x44')]));_0x3d98f4[_0x7694('0x43')]=_0x3d98f4['attributes'][_0x7694('0x45')]?_0x3d98f4[_0x7694('0x43')]:_0x17a552['model'];if(_0x5feb64[_0x7694('0x3f')][_0x7694('0x4f')]){_0x3d98f4[_0x7694('0x50')]=[{'all':!![]}];}_0x3d98f4=_['merge']({},_0x3d98f4,_0x5feb64[_0x7694('0x53')]);return db['Trunk'][_0x7694('0x54')](_0x3d98f4)[_0x7694('0x1c')](handleEntityNotFound(_0xef40fa,null))[_0x7694('0x1c')](function(_0x3cf3cf){if(_0x3cf3cf){var _0x565b46=_0x3cf3cf[_0x7694('0x56')]({'plain':!![]});_0x565b46=qs['omit'](_0x565b46,['id',_0x7694('0x57'),_0x7694('0x58')]);_0x5feb64[_0x7694('0x59')]=_[_0x7694('0x5a')](_0x5feb64[_0x7694('0x59')],['id',_0x7694('0x57'),_0x7694('0x58')]);return db[_0x7694('0x39')]['create'](_[_0x7694('0x4b')](_0x565b46,_0x5feb64[_0x7694('0x59')]),{'include':_0x5feb64['query'][_0x7694('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x26e6a5){var _0x14c859=_0x5feb64[_0x7694('0x5b')][_0x7694('0x56')]({'plain':!![]});if(!_0x14c859)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14c859[_0x7694('0x5c')]===_0x7694('0x5b')){var _0x548718=_0x26e6a5[_0x7694('0x56')]({'plain':!![]});var _0x556863='Trunks';return db['UserProfileSection'][_0x7694('0x54')]({'where':{'name':_0x556863,'userProfileId':_0x14c859['userProfileId']},'raw':!![]})[_0x7694('0x1c')](function(_0x2f72f6){if(_0x2f72f6&&_0x2f72f6['autoAssociation']===0x0){return db[_0x7694('0x35')][_0x7694('0x5d')]({'name':_0x548718[_0x7694('0x37')],'resourceId':_0x548718['id'],'type':_0x2f72f6['name'],'sectionId':_0x2f72f6['id']},{})['then'](function(){return _0x26e6a5;});}else{return _0x26e6a5;}})['catch'](function(_0x2706fa){logger[_0x7694('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2706fa);throw _0x2706fa;});}return _0x26e6a5;});}})[_0x7694('0x1c')](respondWithResult(_0xef40fa,0xc9))[_0x7694('0x26')](handleError(_0xef40fa,null));};exports[_0x7694('0x5d')]=function(_0x541573,_0x415991,_0x409766){var _0x3c53aa;return db[_0x7694('0x39')][_0x7694('0x5d')](_0x541573['body'],{'raw':!![]})[_0x7694('0x1c')](function(_0x10adce){_0x3c53aa=_0x10adce;return db['Trunk'][_0x7694('0x5e')]({'raw':!![]});})['then'](function(_0x1dd773){var _0x2678a1=fs['readFileSync'](path[_0x7694('0x5f')](config[_0x7694('0x60')],_0x7694('0x61')),_0x7694('0x62'));var _0x158540=fs[_0x7694('0x63')](path[_0x7694('0x5f')](config['root'],_0x7694('0x64')),_0x7694('0x62'));var _0x648ae6=ejs['render'](_0x2678a1,{'trunks':_0x1dd773||[]});fs[_0x7694('0x65')](_0x7694('0x66'),_0x648ae6);if(_0x3c53aa[_0x7694('0x67')]){var _0x47a860=ejs[_0x7694('0x68')](_0x158540,{'trunks':_0x1dd773||[]});fs[_0x7694('0x65')](_0x7694('0x69'),_0x47a860);}})[_0x7694('0x1c')](function(){return respondWithRpcPromise('Reload',_0x7694('0x5d'),{'module':_0x7694('0x6a')});})[_0x7694('0x1c')](function(){var _0x517b68=_0x541573[_0x7694('0x5b')]['get']({'plain':!![]});if(!_0x517b68)throw new Error(_0x7694('0x6b'));if(_0x517b68[_0x7694('0x5c')]==='user'){var _0x2cfc72=_0x3c53aa[_0x7694('0x56')]({'plain':!![]});return db[_0x7694('0x6c')][_0x7694('0x54')]({'where':{'name':'Trunks','userProfileId':_0x517b68[_0x7694('0x6d')]},'raw':!![]})[_0x7694('0x1c')](function(_0xb78d8c){if(_0xb78d8c&&_0xb78d8c[_0x7694('0x6e')]===0x0){return db[_0x7694('0x35')][_0x7694('0x5d')]({'name':_0x2cfc72[_0x7694('0x37')],'resourceId':_0x2cfc72['id'],'type':_0xb78d8c[_0x7694('0x37')],'sectionId':_0xb78d8c['id']},{})[_0x7694('0x1c')](function(){return _0x3c53aa;});}else{return _0x3c53aa;}})[_0x7694('0x26')](function(_0x5d8675){logger[_0x7694('0x22')](_0x7694('0x6f'),_0x5d8675);throw _0x5d8675;});}return _0x3c53aa;})[_0x7694('0x1c')](respondWithResult(_0x415991,0xc9))[_0x7694('0x26')](handleError(_0x415991,null));};exports['update']=function(_0x1051c2,_0x1ebd6a,_0x1f01bd){var _0xec5fd7;return db[_0x7694('0x39')][_0x7694('0x54')]({'where':{'id':_0x1051c2[_0x7694('0x52')]['id']}})[_0x7694('0x1c')](handleEntityNotFound(_0x1ebd6a,null))['then'](saveUpdates(_0x1051c2['body'],null))[_0x7694('0x1c')](function(_0x122acf){if(_0x122acf){_0xec5fd7=_0x122acf;return db[_0x7694('0x39')][_0x7694('0x5e')]({'raw':!![]});}})[_0x7694('0x1c')](function(_0x8a3013){if(_0x8a3013){var _0x403f87=fs[_0x7694('0x63')](path[_0x7694('0x5f')](config[_0x7694('0x60')],'server/files/templates/trunk.ejs'),_0x7694('0x62'));var _0x5b2c89=fs[_0x7694('0x63')](path['join'](config[_0x7694('0x60')],'server/files/templates/registry.ejs'),_0x7694('0x62'));var _0x29c2e4=ejs[_0x7694('0x68')](_0x403f87,{'trunks':_0x8a3013||[]});fs[_0x7694('0x65')](_0x7694('0x66'),_0x29c2e4);var _0x396d09=ejs[_0x7694('0x68')](_0x5b2c89,{'trunks':_0x8a3013||[]});fs['writeFileSync'](_0x7694('0x69'),_0x396d09);return respondWithRpcPromise(_0x7694('0x70'),_0x7694('0x32'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x36d1bf){if(_0x36d1bf){return _0xec5fd7;}})[_0x7694('0x1c')](respondWithResult(_0x1ebd6a,null))['catch'](handleError(_0x1ebd6a,null));};exports[_0x7694('0x33')]=function(_0x58d4d9,_0x2edd31,_0xb3ea78){var _0x19583f;return db[_0x7694('0x39')][_0x7694('0x54')]({'where':{'id':_0x58d4d9[_0x7694('0x52')]['id']}})[_0x7694('0x1c')](handleEntityNotFound(_0x2edd31,null))[_0x7694('0x1c')](removeEntity(_0x2edd31,null))[_0x7694('0x1c')](function(){return db['Trunk'][_0x7694('0x5e')]({'raw':!![]});})['then'](function(_0x4975a5){var _0x2cd229=fs['readFileSync'](path[_0x7694('0x5f')](config[_0x7694('0x60')],_0x7694('0x61')),_0x7694('0x62'));var _0x39316a=fs['readFileSync'](path[_0x7694('0x5f')](config[_0x7694('0x60')],'server/files/templates/registry.ejs'),_0x7694('0x62'));var _0x12b306=ejs['render'](_0x2cd229,{'trunks':_0x4975a5});var _0x3cacbf=ejs[_0x7694('0x68')](_0x39316a,{'trunks':_0x4975a5});fs['writeFileSync'](_0x7694('0x66'),_0x12b306);fs[_0x7694('0x65')](_0x7694('0x69'),_0x3cacbf);return respondWithRpcPromise(_0x7694('0x70'),'destroy',{'module':_0x7694('0x6a')});})[_0x7694('0x26')](handleError(_0x2edd31,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index c9d5b7d..a21a55e 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 _0xcfe6=['bluebird','request-promise','../../config/environment','./trunk.attributes','exports','tools_trunks','util','api'];(function(_0x3d6785,_0x492ea3){var _0x39a624=function(_0x27d7db){while(--_0x27d7db){_0x3d6785['push'](_0x3d6785['shift']());}};_0x39a624(++_0x492ea3);}(_0xcfe6,0x12e));var _0x6cfe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfe6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6cfe('0x0'));var logger=require('../../config/logger')(_0x6cfe('0x1'));var moment=require('moment');var BPromise=require(_0x6cfe('0x2'));var rp=require(_0x6cfe('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6cfe('0x4'));var attributes=require(_0x6cfe('0x5'));module[_0x6cfe('0x6')]=function(_0xd076e2,_0x24de6e){return _0xd076e2['define']('Trunk',attributes,{'tableName':_0x6cfe('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9ed=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash'];(function(_0x19a4fe,_0x35458c){var _0x1f7234=function(_0x3245fc){while(--_0x3245fc){_0x19a4fe['push'](_0x19a4fe['shift']());}};_0x1f7234(++_0x35458c);}(_0xa9ed,0x187));var _0xda9e=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xa9ed[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xda9e('0x0'));var util=require(_0xda9e('0x1'));var logger=require(_0xda9e('0x2'))(_0xda9e('0x3'));var moment=require(_0xda9e('0x4'));var BPromise=require('bluebird');var rp=require(_0xda9e('0x5'));var fs=require('fs');var path=require(_0xda9e('0x6'));var rimraf=require(_0xda9e('0x7'));var config=require(_0xda9e('0x8'));var attributes=require(_0xda9e('0x9'));module[_0xda9e('0xa')]=function(_0x424183,_0xcf4678){return _0x424183[_0xda9e('0xb')](_0xda9e('0xc'),attributes,{'tableName':_0xda9e('0xd'),'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 048267d..0c7004f 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 _0x1a85=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','model','map','attributes','then','ShowTrunk','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x1a85,0x178));var _0x51a8=function(_0x44ca27,_0x81f0da){_0x44ca27=_0x44ca27-0x0;var _0x38bc17=_0x1a85[_0x44ca27];return _0x38bc17;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Trunk,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['Trunk'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowTrunk',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file +var _0xda2d=['../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetTrunk','Trunk','findAll','options','raw','attributes','include','map','model','catch','find','where','ShowTrunk','util','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x4c2bc5,_0x4984e2){var _0x487209=function(_0x3cabbf){while(--_0x3cabbf){_0x4c2bc5['push'](_0x4c2bc5['shift']());}};_0x487209(++_0x4984e2);}(_0xda2d,0x102));var _0xdda2=function(_0x399511,_0x25a2bf){_0x399511=_0x399511-0x0;var _0x1173b3=_0xda2d[_0x399511];return _0x1173b3;};'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']('Trunk,\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')]('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')]({'raw':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')][_0xdda2('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['where']||null:null,'attributes':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x19')]||null:null,'limit':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['limit']||null:null,'include':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x1a3b35['options'][_0xdda2('0x1a')],function(_0xfda248){return{'model':db[_0xfda248[_0xdda2('0x1c')]],'as':_0xfda248['as'],'attributes':_0xfda248[_0xdda2('0x19')],'include':_0xfda248[_0xdda2('0x1a')]?_['map'](_0xfda248[_0xdda2('0x1a')],function(_0x4be5ea){return{'model':db[_0x4be5ea[_0xdda2('0x1c')]],'as':_0x4be5ea['as'],'attributes':_0x4be5ea[_0xdda2('0x19')],'include':_0x4be5ea['include']?_['map'](_0x4be5ea[_0xdda2('0x1a')],function(_0x4567e7){return{'model':db[_0x4567e7[_0xdda2('0x1c')]],'as':_0x4567e7['as'],'attributes':_0x4567e7['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x5d26ae){logger[_0xdda2('0x12')](_0xdda2('0x14'),_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON['stringify'](_0x5d26ae));_0x2b6ee8(_0x5d26ae);})[_0xdda2('0x1d')](function(_0x255bbc){logger['error'](_0xdda2('0x14'),_0x255bbc[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5[_0xdda2('0x10')](0x1f4,_0x255bbc[_0xdda2('0x11')]));});});};exports['ShowTrunk']=function(_0x129eba){var _0x5e107f=this;return new Promise(function(_0x4b19b7,_0x1ca9f3){return db['Trunk'][_0xdda2('0x1e')]({'raw':_0x129eba['options']?_0x129eba['options']['raw']===undefined?!![]:![]:!![],'where':_0x129eba[_0xdda2('0x17')]?_0x129eba['options'][_0xdda2('0x1f')]||null:null,'attributes':_0x129eba['options']?_0x129eba['options']['attributes']||null:null,'include':_0x129eba[_0xdda2('0x17')]?_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')],function(_0x2bcfba){return{'model':db[_0x2bcfba[_0xdda2('0x1c')]],'as':_0x2bcfba['as'],'attributes':_0x2bcfba[_0xdda2('0x19')],'include':_0x2bcfba[_0xdda2('0x1a')]?_['map'](_0x2bcfba[_0xdda2('0x1a')],function(_0x4212da){return{'model':db[_0x4212da[_0xdda2('0x1c')]],'as':_0x4212da['as'],'attributes':_0x4212da[_0xdda2('0x19')],'include':_0x4212da[_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x4212da[_0xdda2('0x1a')],function(_0x5835cd){return{'model':db[_0x5835cd['model']],'as':_0x5835cd['as'],'attributes':_0x5835cd[_0xdda2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x40eb19){logger['info']('ShowTrunk',_0x129eba);logger[_0xdda2('0xd')](_0xdda2('0x20'),_0x129eba,JSON[_0xdda2('0xf')](_0x40eb19));_0x4b19b7(_0x40eb19);})[_0xdda2('0x1d')](function(_0x246001){logger['error'](_0xdda2('0x20'),_0x246001[_0xdda2('0x11')],_0x129eba);_0x1ca9f3(_0x5e107f['error'](0x1f4,_0x246001['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 7c3843e..ad17137 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 _0x972b=['/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions'];(function(_0x500f2d,_0x293f8d){var _0x222dd7=function(_0x484a05){while(--_0x484a05){_0x500f2d['push'](_0x500f2d['shift']());}};_0x222dd7(++_0x293f8d);}(_0x972b,0xc0));var _0xb972=function(_0x3afb39,_0x1713b5){_0x3afb39=_0x3afb39-0x0;var _0x405d89=_0x972b[_0x3afb39];return _0x405d89;};'use strict';var multer=require(_0xb972('0x0'));var util=require(_0xb972('0x1'));var path=require('path');var timeout=require(_0xb972('0x2'));var express=require(_0xb972('0x3'));var router=express[_0xb972('0x4')]();var auth=require(_0xb972('0x5'));var interaction=require(_0xb972('0x6'));var config=require(_0xb972('0x7'));var controller=require(_0xb972('0x8'));router[_0xb972('0x9')]('/',auth[_0xb972('0xa')](),controller[_0xb972('0xb')]);router[_0xb972('0x9')](_0xb972('0xc'),auth['isAuthenticated'](),controller[_0xb972('0xd')]);router[_0xb972('0x9')](_0xb972('0xe'),auth[_0xb972('0xa')](),controller['whoami']);router['get'](_0xb972('0xf'),auth[_0xb972('0xa')](),controller[_0xb972('0x10')]);router[_0xb972('0x9')](_0xb972('0x11'),controller[_0xb972('0x12')]);router[_0xb972('0x9')](_0xb972('0x13'),auth[_0xb972('0xa')](),controller[_0xb972('0x14')]);router['get'](_0xb972('0x15'),auth[_0xb972('0xa')](),controller[_0xb972('0x16')]);router[_0xb972('0x9')](_0xb972('0x17'),auth[_0xb972('0xa')](),controller[_0xb972('0x18')]);router['get'](_0xb972('0x19'),auth['isAuthenticated'](),controller['getGroups']);router['get'](_0xb972('0x1a'),auth[_0xb972('0xa')](),controller[_0xb972('0x1b')]);router[_0xb972('0x9')](_0xb972('0x1c'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0xb972('0x9')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0xb972('0x1d')]);router['get'](_0xb972('0x1e'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0xb972('0x9')](_0xb972('0x1f'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0xb972('0x9')]('/:id/sms/interactions',auth[_0xb972('0xa')](),controller['getSmsInteractions']);router[_0xb972('0x9')](_0xb972('0x20'),auth['isAuthenticated'](),controller[_0xb972('0x21')]);router['get']('/:id/whatsapp/interactions',auth[_0xb972('0xa')](),controller[_0xb972('0x22')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xb972('0x23'),auth[_0xb972('0xa')](),controller[_0xb972('0x24')]);router[_0xb972('0x9')](_0xb972('0x25'),auth['isAuthenticated'](),controller[_0xb972('0x26')]);router[_0xb972('0x9')](_0xb972('0x27'),auth['isAuthenticated'](),controller[_0xb972('0x28')]);router[_0xb972('0x9')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xb972('0x29')]);router[_0xb972('0x9')](_0xb972('0x2a'),auth[_0xb972('0xa')](),controller['getMailAccounts']);router[_0xb972('0x9')](_0xb972('0x2b'),auth['isAuthenticated'](),controller[_0xb972('0x2c')]);router[_0xb972('0x9')](_0xb972('0x2d'),auth[_0xb972('0xa')](),controller[_0xb972('0x2e')]);router[_0xb972('0x9')](_0xb972('0x2f'),auth['isAuthenticated'](),controller[_0xb972('0x30')]);router['get'](_0xb972('0x31'),auth['isAuthenticated'](),controller[_0xb972('0x32')]);router[_0xb972('0x9')](_0xb972('0x33'),auth[_0xb972('0xa')](),controller['getSquareProjects']);router[_0xb972('0x9')](_0xb972('0x34'),auth[_0xb972('0xa')](),controller[_0xb972('0x35')]);router['get'](_0xb972('0x36'),auth['isAuthenticated'](),controller[_0xb972('0x37')]);router[_0xb972('0x38')]('/create_many',auth[_0xb972('0xa')](),controller['bulkCreate']);router[_0xb972('0x38')](_0xb972('0x13'),auth[_0xb972('0xa')](),controller[_0xb972('0x39')]);router['post']('/',auth[_0xb972('0xa')](),controller[_0xb972('0x3a')]);router['post']('/:id/queues',auth[_0xb972('0xa')](),controller[_0xb972('0x3b')]);var upload=multer({'storage':multer[_0xb972('0x3c')]({'destination':function(_0x538c79,_0x5827fc,_0xc3bb4b){_0xc3bb4b(null,path[_0xb972('0x3d')](config[_0xb972('0x3e')],_0xb972('0x3f')));},'filename':function(_0x1d56d6,_0x26a0d0,_0x1cfbf7){_0x1cfbf7(null,util[_0xb972('0x40')](_0xb972('0x41'),Date[_0xb972('0x42')](),_0x26a0d0[_0xb972('0x43')]));}})});router[_0xb972('0x38')](_0xb972('0x11'),upload[_0xb972('0x44')]('file'),controller[_0xb972('0x45')]);router[_0xb972('0x38')](_0xb972('0x46'),auth[_0xb972('0xa')](),controller[_0xb972('0x47')]);router[_0xb972('0x38')](_0xb972('0x48'),auth[_0xb972('0xa')](),controller[_0xb972('0x49')]);router['post'](_0xb972('0x4a'),auth[_0xb972('0xa')](),controller[_0xb972('0x4b')]);router[_0xb972('0x38')](_0xb972('0x4c'),auth['isAuthenticated'](),controller['unpause']);router['post'](_0xb972('0x4d'),auth[_0xb972('0xa')](),controller[_0xb972('0x4e')]);router[_0xb972('0x38')](_0xb972('0x4f'),auth[_0xb972('0xa')](),controller['addChatInteractions']);router[_0xb972('0x38')](_0xb972('0x50'),auth[_0xb972('0xa')](),controller[_0xb972('0x51')]);router['post'](_0xb972('0x52'),auth[_0xb972('0xa')](),controller[_0xb972('0x53')]);router[_0xb972('0x38')](_0xb972('0x54'),auth[_0xb972('0xa')](),controller[_0xb972('0x55')]);router['post'](_0xb972('0x56'),auth[_0xb972('0xa')](),controller[_0xb972('0x57')]);router[_0xb972('0x38')](_0xb972('0x58'),auth[_0xb972('0xa')](),controller['addWhatsappInteractions']);router['post']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xb972('0x59')]);router[_0xb972('0x38')](_0xb972('0x2a'),auth[_0xb972('0xa')](),controller[_0xb972('0x5a')]);router[_0xb972('0x38')](_0xb972('0x2b'),auth[_0xb972('0xa')](),controller['addOpenchannelAccounts']);router[_0xb972('0x38')](_0xb972('0x2d'),auth[_0xb972('0xa')](),controller[_0xb972('0x5b')]);router[_0xb972('0x38')](_0xb972('0x2f'),auth['isAuthenticated'](),controller[_0xb972('0x5c')]);router[_0xb972('0x38')](_0xb972('0x31'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0xb972('0x38')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xb972('0x5d')]);router[_0xb972('0x38')]('/:id/api_key',auth[_0xb972('0xa')](),controller['createApiKey']);router[_0xb972('0x5e')](_0xb972('0xf'),auth[_0xb972('0xa')](),controller[_0xb972('0x5f')]);router[_0xb972('0x5e')](_0xb972('0x60'),auth['isAuthenticated'](),controller['changePassword']);router[_0xb972('0x61')]('/:id/queues',auth[_0xb972('0xa')](),controller[_0xb972('0x62')]);router[_0xb972('0x61')]('/:id/teams',auth[_0xb972('0xa')](),controller[_0xb972('0x63')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb972('0x64')]);router['delete'](_0xb972('0x4f'),auth[_0xb972('0xa')](),controller['removeChatInteractions']);router[_0xb972('0x61')](_0xb972('0x50'),auth[_0xb972('0xa')](),controller['removeMailInteractions']);router[_0xb972('0x61')](_0xb972('0x52'),auth['isAuthenticated'](),controller[_0xb972('0x65')]);router[_0xb972('0x61')](_0xb972('0x54'),auth[_0xb972('0xa')](),controller['removeSmsInteractions']);router[_0xb972('0x61')](_0xb972('0x56'),auth['isAuthenticated'](),controller[_0xb972('0x66')]);router[_0xb972('0x61')](_0xb972('0x58'),auth[_0xb972('0xa')](),controller[_0xb972('0x67')]);router[_0xb972('0x61')](_0xb972('0x68'),auth[_0xb972('0xa')](),controller[_0xb972('0x69')]);router[_0xb972('0x61')]('/:id/mail_accounts',auth[_0xb972('0xa')](),controller['removeMailAccounts']);router[_0xb972('0x61')](_0xb972('0x2b'),auth[_0xb972('0xa')](),controller[_0xb972('0x6a')]);router[_0xb972('0x61')](_0xb972('0x2d'),auth[_0xb972('0xa')](),controller[_0xb972('0x6b')]);router[_0xb972('0x61')](_0xb972('0x2f'),auth[_0xb972('0xa')](),controller[_0xb972('0x6c')]);router['delete'](_0xb972('0x31'),auth[_0xb972('0xa')](),controller[_0xb972('0x6d')]);router[_0xb972('0x61')](_0xb972('0x33'),auth['isAuthenticated'](),controller[_0xb972('0x6e')]);router['delete'](_0xb972('0x36'),auth[_0xb972('0xa')](),controller['removeApiKey']);module[_0xb972('0x6f')]=router; \ No newline at end of file +var _0x8a8e=['/:id/lists','getLists','/:id/agents','getAgents','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','/:id/contacts','addContacts','create','diskStorage','join','root','server/files/images/','format','now','originalname','/:id/avatar','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','/:id/mail_accounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id','show','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams'];(function(_0x24a85e,_0x371670){var _0x5321cd=function(_0x5a1663){while(--_0x5a1663){_0x24a85e['push'](_0x24a85e['shift']());}};_0x5321cd(++_0x371670);}(_0x8a8e,0x1a2));var _0xe8a8=function(_0x386574,_0x4f92e9){_0x386574=_0x386574-0x0;var _0x1f8da8=_0x8a8e[_0x386574];return _0x1f8da8;};'use strict';var multer=require(_0xe8a8('0x0'));var util=require(_0xe8a8('0x1'));var path=require(_0xe8a8('0x2'));var timeout=require(_0xe8a8('0x3'));var express=require(_0xe8a8('0x4'));var router=express[_0xe8a8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe8a8('0x6'));var config=require(_0xe8a8('0x7'));var controller=require(_0xe8a8('0x8'));router[_0xe8a8('0x9')]('/',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0xb')]);router['get'](_0xe8a8('0xc'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0xd')]);router[_0xe8a8('0x9')](_0xe8a8('0xe'),auth['isAuthenticated'](),controller[_0xe8a8('0xf')]);router[_0xe8a8('0x9')](_0xe8a8('0x10'),auth['isAuthenticated'](),controller[_0xe8a8('0x11')]);router[_0xe8a8('0x9')]('/:id/avatar',controller['getAvatar']);router[_0xe8a8('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xe8a8('0x12')]);router['get'](_0xe8a8('0x13'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x14')]);router['get'](_0xe8a8('0x15'),auth['isAuthenticated'](),controller[_0xe8a8('0x16')]);router[_0xe8a8('0x9')]('/:id/groups',auth['isAuthenticated'](),controller[_0xe8a8('0x17')]);router[_0xe8a8('0x9')]('/:id/recordings',auth[_0xe8a8('0xa')](),controller['getRecordings']);router[_0xe8a8('0x9')]('/:id/screen_recordings',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x18')]);router['get'](_0xe8a8('0x19'),auth['isAuthenticated'](),controller[_0xe8a8('0x1a')]);router[_0xe8a8('0x9')](_0xe8a8('0x1b'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x1c')]);router[_0xe8a8('0x9')](_0xe8a8('0x1d'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x1e')]);router[_0xe8a8('0x9')](_0xe8a8('0x1f'),auth['isAuthenticated'](),controller[_0xe8a8('0x20')]);router[_0xe8a8('0x9')](_0xe8a8('0x21'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x22')]);router[_0xe8a8('0x9')](_0xe8a8('0x23'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router['get'](_0xe8a8('0x24'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x25')]);router[_0xe8a8('0x9')](_0xe8a8('0x26'),auth['isAuthenticated'](),controller[_0xe8a8('0x27')]);router[_0xe8a8('0x9')](_0xe8a8('0x28'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x29')]);router[_0xe8a8('0x9')]('/:id/prefixes',auth[_0xe8a8('0xa')](),controller['getVoicePrefixes']);router[_0xe8a8('0x9')]('/:id/fax_accounts',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x2a')]);router[_0xe8a8('0x9')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xe8a8('0x2b')]);router[_0xe8a8('0x9')](_0xe8a8('0x2c'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x2d')]);router[_0xe8a8('0x9')](_0xe8a8('0x2e'),auth['isAuthenticated'](),controller[_0xe8a8('0x2f')]);router[_0xe8a8('0x9')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xe8a8('0x30')]);router[_0xe8a8('0x9')](_0xe8a8('0x31'),auth[_0xe8a8('0xa')](),controller['getWhatsappAccounts']);router['get'](_0xe8a8('0x32'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x33')]);router[_0xe8a8('0x9')](_0xe8a8('0x34'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x35')]);router['get'](_0xe8a8('0x36'),auth[_0xe8a8('0xa')](),controller['getApiKey']);router[_0xe8a8('0x37')](_0xe8a8('0x38'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x39')]);router[_0xe8a8('0x37')](_0xe8a8('0x3a'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x3b')]);router[_0xe8a8('0x37')]('/',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x3c')]);router[_0xe8a8('0x37')]('/:id/queues',auth[_0xe8a8('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0xe8a8('0x3d')]({'destination':function(_0x2bc0b3,_0x193bb5,_0x4a961a){_0x4a961a(null,path[_0xe8a8('0x3e')](config[_0xe8a8('0x3f')],_0xe8a8('0x40')));},'filename':function(_0x215d33,_0x3bc129,_0x5a93a5){_0x5a93a5(null,util[_0xe8a8('0x41')]('%s-%s',Date[_0xe8a8('0x42')](),_0x3bc129[_0xe8a8('0x43')]));}})});router[_0xe8a8('0x37')](_0xe8a8('0x44'),upload['single'](_0xe8a8('0x45')),controller[_0xe8a8('0x46')]);router['post'](_0xe8a8('0x47'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x48')]);router[_0xe8a8('0x37')](_0xe8a8('0x49'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x4a')]);router['post']('/:id/pause',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x4b')]);router[_0xe8a8('0x37')]('/:id/unpause',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x4c')]);router[_0xe8a8('0x37')](_0xe8a8('0x24'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x4d')]);router[_0xe8a8('0x37')](_0xe8a8('0x4e'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x4f')]);router[_0xe8a8('0x37')](_0xe8a8('0x50'),auth[_0xe8a8('0xa')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xe8a8('0x51')]);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xe8a8('0x52')]);router['post']('/:id/openchannel_interactions',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x53')]);router[_0xe8a8('0x37')]('/:id/whatsapp_interactions',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x54')]);router[_0xe8a8('0x37')](_0xe8a8('0x55'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x56')]);router[_0xe8a8('0x37')]('/:id/mail_accounts',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x57')]);router[_0xe8a8('0x37')](_0xe8a8('0x2c'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x58')]);router[_0xe8a8('0x37')](_0xe8a8('0x2e'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x59')]);router[_0xe8a8('0x37')](_0xe8a8('0x5a'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x5b')]);router[_0xe8a8('0x37')](_0xe8a8('0x31'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x5c')]);router['post']('/:id/square_projects',auth['isAuthenticated'](),controller['addSquareProjects']);router[_0xe8a8('0x37')](_0xe8a8('0x36'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x5d')]);router[_0xe8a8('0x5e')]('/:id',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x5f')]);router['put'](_0xe8a8('0x60'),auth['isAuthenticated'](),controller['changePassword']);router[_0xe8a8('0x61')]('/:id/queues',auth['isAuthenticated'](),controller['removeQueues']);router[_0xe8a8('0x61')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe8a8('0x62')]);router[_0xe8a8('0x61')](_0xe8a8('0x10'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x63')]);router['delete'](_0xe8a8('0x4e'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x64')]);router[_0xe8a8('0x61')](_0xe8a8('0x50'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x65')]);router[_0xe8a8('0x61')](_0xe8a8('0x66'),auth['isAuthenticated'](),controller[_0xe8a8('0x67')]);router[_0xe8a8('0x61')](_0xe8a8('0x68'),auth[_0xe8a8('0xa')](),controller['removeSmsInteractions']);router[_0xe8a8('0x61')]('/:id/openchannel_interactions',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x69')]);router[_0xe8a8('0x61')](_0xe8a8('0x6a'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x6b')]);router['delete'](_0xe8a8('0x55'),auth[_0xe8a8('0xa')](),controller['removeFaxAccounts']);router[_0xe8a8('0x61')](_0xe8a8('0x6c'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x6d')]);router[_0xe8a8('0x61')](_0xe8a8('0x2c'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x6e')]);router[_0xe8a8('0x61')](_0xe8a8('0x2e'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x6f')]);router['delete'](_0xe8a8('0x5a'),auth[_0xe8a8('0xa')](),controller['removeChatWebsites']);router[_0xe8a8('0x61')](_0xe8a8('0x31'),auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x70')]);router[_0xe8a8('0x61')]('/:id/square_projects',auth[_0xe8a8('0xa')](),controller[_0xe8a8('0x71')]);router['delete'](_0xe8a8('0x36'),auth[_0xe8a8('0xa')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index afdbebd..ea8713d 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 _0x7b56=['nonat','update,nonat','showWebBar','get','transport','isArray','wss','encryption','force_avp','dtlsenable','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','icesupport','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','join','split','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','all','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','refuse','originate','uac','uas','fingerprint','passive'];(function(_0x52fcbb,_0x374e6b){var _0x2cd70c=function(_0x10f787){while(--_0x10f787){_0x52fcbb['push'](_0x52fcbb['shift']());}};_0x2cd70c(++_0x374e6b);}(_0x7b56,0xc8));var _0x67b5=function(_0x4db3ce,_0x4a722e){_0x4db3ce=_0x4db3ce-0x0;var _0x293191=_0x7b56[_0x4db3ce];return _0x293191;};'use strict';var Sequelize=require(_0x67b5('0x0'));var moment=require(_0x67b5('0x1'));var util=require(_0x67b5('0x2'));var _=require(_0x67b5('0x3'));module['exports']={'name':{'type':Sequelize[_0x67b5('0x4')],'allowNull':![],'unique':_0x67b5('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3f0307){this[_0x67b5('0x6')]('name',_0x3f0307);this['setDataValue'](_0x67b5('0x7'),_0x3f0307);},'comment':_0x67b5('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x534f0a){this['setDataValue']('fullname',_0x534f0a);this['setDataValue'](_0x67b5('0x9'),util[_0x67b5('0xa')]('\x22%s\x22\x20<%s>',_0x534f0a,this[_0x67b5('0xb')](_0x67b5('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x67b5('0x4')],'allowNull':![],'unique':_0x67b5('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2bad09){if(_0x2bad09){this[_0x67b5('0x6')](_0x67b5('0xd'),_0x2bad09[_0x67b5('0xe')]());}}},'role':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x10'),_0x67b5('0x11'),_0x67b5('0x12'),_0x67b5('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x67b5('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x67b5('0x14')},'internal':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':![],'unique':_0x67b5('0xc'),'set':function(_0x394a6e){this[_0x67b5('0x6')](_0x67b5('0xc'),_0x394a6e);this[_0x67b5('0x6')]('accountcode',_0x394a6e);this[_0x67b5('0x6')](_0x67b5('0x9'),util[_0x67b5('0xa')]('\x22%s\x22\x20<%s>',this[_0x67b5('0xb')](_0x67b5('0x16')),_0x394a6e));}},'salt':{'type':Sequelize[_0x67b5('0x4')]},'phone':{'type':Sequelize[_0x67b5('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x67b5('0x4')]},'zipcode':{'type':Sequelize[_0x67b5('0x4')]},'userpic':{'type':Sequelize[_0x67b5('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x67b5('0x18')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x67b5('0x4')],'defaultValue':_0x67b5('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x67b5('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x67b5('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x67b5('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x67b5('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x67b5('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x67b5('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![],'defaultValue':_0x67b5('0x1a')},'ipaddr':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x1b'),_0x67b5('0x11'),_0x67b5('0x1c')),'allowNull':!![],'defaultValue':_0x67b5('0x1b')},'context':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x67b5('0xf')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x67b5('0x1d'),'ALLOWED',_0x67b5('0x1e'),'PROHIB_PASSED_SCREEN',_0x67b5('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![],'defaultValue':_0x67b5('0x20'),'set':function(_0x122b53){this[_0x67b5('0x6')]('transport',_0x122b53?_0x122b53[_0x67b5('0x21')](','):null);},'get':function(){return this[_0x67b5('0xb')]('transport')?this[_0x67b5('0xb')]('transport')[_0x67b5('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x23'),_0x67b5('0x24'),_0x67b5('0x25'),_0x67b5('0x26'),_0x67b5('0x27')),'allowNull':!![],'defaultValue':_0x67b5('0x23')},'directmedia':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no','nonat',_0x67b5('0x29'),_0x67b5('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x67b5('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![],'defaultValue':_0x67b5('0x2b'),'set':function(_0x46fd75){this[_0x67b5('0x6')]('nat',_0x46fd75?_0x46fd75[_0x67b5('0x21')](','):null);},'get':function(){return this[_0x67b5('0xb')](_0x67b5('0x2c'))?this[_0x67b5('0xb')]('nat')[_0x67b5('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x67b5('0x4')]},'pickupgroup':{'type':Sequelize[_0x67b5('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x67b5('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x67b5('0x4')]},'disallow':{'type':Sequelize[_0x67b5('0x4')],'allowNull':![],'defaultValue':_0x67b5('0x2d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x172028){this['setDataValue'](_0x67b5('0x2e'),_0x172028?_0x172028['join'](';'):_0x67b5('0x2f'));},'get':function(){return this[_0x67b5('0xb')](_0x67b5('0x2e'))?this[_0x67b5('0xb')]('allow')[_0x67b5('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![],'set':function(_0x29ef59){this['setDataValue'](_0x67b5('0x30'),_0x29ef59?_0x29ef59[_0x67b5('0x21')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x67b5('0xb')](_0x67b5('0x30'))[_0x67b5('0x22')](','):null;},'comment':_0x67b5('0x31')},'trustrpid':{'type':Sequelize[_0x67b5('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x67b5('0x28'),'no',_0x67b5('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x67b5('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x67b5('0x28')},'busylevel':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x67b5('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x67b5('0xf')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x67b5('0x28'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x67b5('0x33'),_0x67b5('0x34'),_0x67b5('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x67b5('0x36'),_0x67b5('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![],'defaultValue':_0x67b5('0x28')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x67b5('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x67b5('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x67b5('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no',_0x67b5('0x38'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x67b5('0x39'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x67b5('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x67b5('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x67b5('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no',_0x67b5('0x3a'),_0x67b5('0x29'),_0x67b5('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x67b5('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4963e5){this[_0x67b5('0x6')](_0x67b5('0x3c'),_0x4963e5);var _0x312b05=this[_0x67b5('0x3d')]({'plain':!![]});switch(_0x4963e5){case 0x0:case 0x1:var _0x30c7f2=_0x312b05[_0x67b5('0x3e')]?_[_0x67b5('0x3f')](_0x312b05[_0x67b5('0x3e')])?_0x312b05[_0x67b5('0x3e')]['join']():_0x312b05[_0x67b5('0x3e')]:_0x67b5('0x20');if(_0x30c7f2===_0x67b5('0x40')){_0x30c7f2=_0x67b5('0x20');}this[_0x67b5('0x6')](_0x67b5('0x3e'),_0x30c7f2);this[_0x67b5('0x6')](_0x67b5('0x41'),'no');this[_0x67b5('0x6')]('avpf',null);this['setDataValue'](_0x67b5('0x42'),null);this[_0x67b5('0x6')]('icesupport',null);this['setDataValue'](_0x67b5('0x43'),null);this[_0x67b5('0x6')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x67b5('0x44'),null);this[_0x67b5('0x6')](_0x67b5('0x45'),null);this[_0x67b5('0x6')](_0x67b5('0x46'),'no');break;case 0x2:this[_0x67b5('0x6')]('transport',_0x67b5('0x40'));this[_0x67b5('0x6')](_0x67b5('0x41'),_0x67b5('0x28'));this[_0x67b5('0x6')](_0x67b5('0x47'),'yes');this[_0x67b5('0x6')](_0x67b5('0x42'),'yes');this[_0x67b5('0x6')](_0x67b5('0x48'),_0x67b5('0x28'));this['setDataValue'](_0x67b5('0x43'),_0x67b5('0x28'));this[_0x67b5('0x6')](_0x67b5('0x49'),'no');this[_0x67b5('0x6')](_0x67b5('0x4a'),_0x67b5('0x4b'));this[_0x67b5('0x6')](_0x67b5('0x44'),_0x312b05[_0x67b5('0x44')]||_0x67b5('0x4c'));this[_0x67b5('0x6')](_0x67b5('0x45'),_0x312b05['dtlsprivatekey']||_0x67b5('0x4d'));this[_0x67b5('0x6')]('rtcp_mux',_0x67b5('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x67b5('0x4e')],'set':function(_0x30c5dd){this[_0x67b5('0x6')](_0x67b5('0x4f'),_0x30c5dd?_0x30c5dd[_0x67b5('0x21')](','):[]);},'get':function(){return this[_0x67b5('0xb')]('permissions')?_['map'](this[_0x67b5('0xb')](_0x67b5('0x4f'))['split'](','),function(_0x27d741){return parseInt(_0x27d741,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x67b5('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x67b5('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x67b5('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x67b5('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x67b5('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x67b5('0xf')](_0x67b5('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x67b5('0x4')]},'passwordResetAt':{'type':Sequelize[_0x67b5('0x18')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x67b5('0xb')](_0x67b5('0x50'))?this['getDataValue'](_0x67b5('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x67b5('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x67b5('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x572b68){if(typeof _0x572b68===_0x67b5('0x51')){var _0x540dc5=_0x572b68==='1'?!![]:_0x572b68==='0'?![]:_0x572b68===_0x67b5('0x52')?!![]:_0x572b68===_0x67b5('0x53')?![]:![];this['setDataValue'](_0x67b5('0x54'),_0x540dc5);}else{this[_0x67b5('0x6')](_0x67b5('0x54'),_0x572b68);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x31a068){this['setDataValue']('blocked',_0x31a068);if(_0x31a068===!![]){this[_0x67b5('0x6')](_0x67b5('0x55'),moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0x67b5('0x6')](_0x67b5('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x67b5('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x67b5('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x67b5('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0x5232=['always','accept','refuse','uac','fingerprint','certificate','active','passive','actpass','nonat','update,nonat','get','isArray','wss','encryption','avpf','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','callerid','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','local','INTEGER','format','getDataValue','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5232,0x1f0));var _0x2523=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0x5232[_0x211bc3];return _0x34c9a2;};'use strict';var Sequelize=require(_0x2523('0x0'));var moment=require(_0x2523('0x1'));var util=require(_0x2523('0x2'));var _=require('lodash');module[_0x2523('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2523('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4085f9){this[_0x2523('0x5')](_0x2523('0x4'),_0x4085f9);this[_0x2523('0x5')](_0x2523('0x6'),_0x4085f9);},'comment':_0x2523('0x7')},'fullname':{'type':Sequelize[_0x2523('0x8')],'allowNull':![],'set':function(_0x81711){this[_0x2523('0x5')]('fullname',_0x81711);this['setDataValue'](_0x2523('0x9'),util['format'](_0x2523('0xa'),_0x81711,this['getDataValue'](_0x2523('0xb'))));}},'alias':{'type':Sequelize[_0x2523('0x8')]},'email':{'type':Sequelize[_0x2523('0x8')],'allowNull':![],'unique':_0x2523('0xc'),'validate':{'isEmail':!![]},'set':function(_0x299aca){if(_0x299aca){this[_0x2523('0x5')](_0x2523('0xc'),_0x299aca['toLowerCase']());}}},'role':{'type':Sequelize[_0x2523('0xd')](_0x2523('0xe'),_0x2523('0xf'),_0x2523('0x10'),_0x2523('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x2523('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2523('0x8')],'defaultValue':_0x2523('0x12')},'internal':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':![],'unique':_0x2523('0xb'),'set':function(_0x7b05b8){this[_0x2523('0x5')]('internal',_0x7b05b8);this[_0x2523('0x5')]('accountcode',_0x7b05b8);this[_0x2523('0x5')](_0x2523('0x9'),util[_0x2523('0x14')](_0x2523('0xa'),this[_0x2523('0x15')](_0x2523('0x16')),_0x7b05b8));}},'salt':{'type':Sequelize[_0x2523('0x8')]},'phone':{'type':Sequelize[_0x2523('0x8')]},'mobile':{'type':Sequelize[_0x2523('0x8')]},'address':{'type':Sequelize[_0x2523('0x8')]},'zipcode':{'type':Sequelize[_0x2523('0x8')]},'userpic':{'type':Sequelize[_0x2523('0x8')]},'city':{'type':Sequelize[_0x2523('0x8')]},'country':{'type':Sequelize[_0x2523('0x8')]},'online':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2523('0x18')]},'voicePause':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2523('0x8')],'defaultValue':_0x2523('0x19')},'lastPauseAt':{'type':Sequelize[_0x2523('0x18')]},'chatCapacity':{'type':Sequelize[_0x2523('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2523('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2523('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2523('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2523('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2523('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2523('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2523('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![],'defaultValue':_0x2523('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x2523('0x1b'),_0x2523('0xf'),_0x2523('0x1c')),'allowNull':!![],'defaultValue':_0x2523('0x1b')},'context':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![],'defaultValue':_0x2523('0x1d')},'callingpres':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x1e'),_0x2523('0x1f'),_0x2523('0x20'),_0x2523('0x21'),_0x2523('0x22'),_0x2523('0x23'),_0x2523('0x24'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![],'defaultValue':_0x2523('0x25'),'set':function(_0x17fc23){this['setDataValue']('transport',_0x17fc23?_0x17fc23[_0x2523('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x2523('0x27'))?this['getDataValue'](_0x2523('0x27'))['split'](','):null;},'comment':_0x2523('0x28')},'dtmfmode':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x29'),'info','shortinfo',_0x2523('0x2a'),_0x2523('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat','update',_0x2523('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x53c2d5){this['setDataValue'](_0x2523('0x2e'),_0x53c2d5?_0x53c2d5[_0x2523('0x26')](','):null);},'get':function(){return this[_0x2523('0x15')]('nat')?this[_0x2523('0x15')]('nat')['split'](','):null;},'comment':_0x2523('0x2f')},'callgroup':{'type':Sequelize[_0x2523('0x8')]},'namedcallgroup':{'type':Sequelize[_0x2523('0x8')]},'pickupgroup':{'type':Sequelize[_0x2523('0x8')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2523('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2523('0x30')},'allow':{'type':Sequelize[_0x2523('0x8')],'allowNull':![],'defaultValue':_0x2523('0x31'),'set':function(_0x3d69e1){this[_0x2523('0x5')](_0x2523('0x32'),_0x3d69e1?_0x3d69e1[_0x2523('0x26')](';'):_0x2523('0x31'));},'get':function(){return this[_0x2523('0x15')](_0x2523('0x32'))?this[_0x2523('0x15')]('allow')[_0x2523('0x33')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3b42f5){this[_0x2523('0x5')]('insecure',_0x3b42f5?_0x3b42f5[_0x2523('0x26')](','):null);},'get':function(){return this[_0x2523('0x15')](_0x2523('0x34'))?this[_0x2523('0x15')](_0x2523('0x34'))[_0x2523('0x33')](','):null;},'comment':_0x2523('0x35')},'trustrpid':{'type':Sequelize[_0x2523('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no',_0x2523('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2523('0x37')},'amaflags':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x2523('0x2d')},'busylevel':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2523('0xd')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x2523('0x2d'),'no',_0x2523('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x39'),_0x2523('0x3a'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x3b'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2523('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x2523('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2523('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no',_0x2523('0x3c'),_0x2523('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x3e'),_0x2523('0x3f'),_0x2523('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2523('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2523('0xd')](_0x2523('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2523('0xd')]('yes','no',_0x2523('0x41'),'update',_0x2523('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2523('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0x2523('0x18')]},'showWebBar':{'type':Sequelize[_0x2523('0x13')],'defaultValue':0x0,'set':function(_0x1f59fb){this['setDataValue']('showWebBar',_0x1f59fb);var _0x33154a=this[_0x2523('0x43')]({'plain':!![]});switch(_0x1f59fb){case 0x0:case 0x1:var _0x1f85ff=_0x33154a[_0x2523('0x27')]?_[_0x2523('0x44')](_0x33154a['transport'])?_0x33154a['transport']['join']():_0x33154a[_0x2523('0x27')]:_0x2523('0x25');if(_0x1f85ff===_0x2523('0x45')){_0x1f85ff='udp';}this[_0x2523('0x5')](_0x2523('0x27'),_0x1f85ff);this[_0x2523('0x5')](_0x2523('0x46'),'no');this[_0x2523('0x5')](_0x2523('0x47'),null);this[_0x2523('0x5')]('force_avp',null);this[_0x2523('0x5')]('icesupport',null);this[_0x2523('0x5')](_0x2523('0x48'),null);this['setDataValue'](_0x2523('0x49'),null);this[_0x2523('0x5')](_0x2523('0x4a'),null);this[_0x2523('0x5')](_0x2523('0x4b'),null);this[_0x2523('0x5')](_0x2523('0x4c'),null);this[_0x2523('0x5')](_0x2523('0x4d'),'no');break;case 0x2:this[_0x2523('0x5')](_0x2523('0x27'),_0x2523('0x45'));this['setDataValue'](_0x2523('0x46'),_0x2523('0x2d'));this[_0x2523('0x5')](_0x2523('0x47'),_0x2523('0x2d'));this[_0x2523('0x5')](_0x2523('0x4e'),_0x2523('0x2d'));this[_0x2523('0x5')]('icesupport',_0x2523('0x2d'));this[_0x2523('0x5')](_0x2523('0x48'),_0x2523('0x2d'));this[_0x2523('0x5')](_0x2523('0x49'),'no');this[_0x2523('0x5')](_0x2523('0x4a'),_0x2523('0x40'));this[_0x2523('0x5')]('dtlscertfile',_0x33154a[_0x2523('0x4b')]||_0x2523('0x4f'));this[_0x2523('0x5')]('dtlsprivatekey',_0x33154a[_0x2523('0x4c')]||_0x2523('0x50'));this['setDataValue'](_0x2523('0x4d'),_0x2523('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x2523('0x51')],'set':function(_0x1d6371){this[_0x2523('0x5')]('permissions',_0x1d6371?_0x1d6371['join'](','):[]);},'get':function(){return this[_0x2523('0x15')]('permissions')?_[_0x2523('0x52')](this[_0x2523('0x15')]('permissions')[_0x2523('0x33')](','),function(_0x3470f2){return parseInt(_0x3470f2,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2523('0x8')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2523('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2523('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2523('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2523('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2523('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2523('0x8')]},'passwordResetAt':{'type':Sequelize[_0x2523('0x18')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2523('0x53')],'get':function(){return this[_0x2523('0x15')](_0x2523('0x54'))?this['getDataValue'](_0x2523('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2523('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![],'set':function(_0x4ed2b9){if(typeof _0x4ed2b9===_0x2523('0x55')){var _0x5d1728=_0x4ed2b9==='1'?!![]:_0x4ed2b9==='0'?![]:_0x4ed2b9===_0x2523('0x56')?!![]:_0x4ed2b9===_0x2523('0x57')?![]:![];this[_0x2523('0x5')]('screenrecording',_0x5d1728);}else{this['setDataValue'](_0x2523('0x58'),_0x4ed2b9);}}},'blocked':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![],'set':function(_0xb8e012){this[_0x2523('0x5')](_0x2523('0x59'),_0xb8e012);if(_0xb8e012===!![]){this[_0x2523('0x5')](_0x2523('0x5a'),moment());this[_0x2523('0x5')](_0x2523('0x5b'),0x0);}else{this[_0x2523('0x5')](_0x2523('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x2523('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2523('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2523('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index f67d6bb..b08dffa 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 _0x7969=['http','test','Sequelize','ValidationError','request','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','reject','save','update','then','destroy','get','user','Agents','agent','Telephones','ignore','map','value','includes','role','find','name','end','stack','send','rawAttributes','fieldName','type','key','differenceBy','password','salt','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','lower','col','sequelize','merge','options','User','include','rows','show','params','keys','length','includeAll','bulkCreate','body','describe','addContacts','ids','agent\x20role','telephone','getLicense','telephones','users','License\x20limit\x20reached','format','count\x20%s:\x20%s','internal','Setting','findById','securePassword','min_internal','max','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','from','mailbox','VoiceMail','email','permissions','101','103','113','104','105','106','100','111','114','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','findOne','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','channel','online','loginInPause','voicePause','interface','isValidChannel','add','toLowerCase','Queues','spread','capitalize','emit','Queue:save','voice','VoiceQueue','push','SIP/%s','penalty','each','UserVoiceQueueRt','upsert','removeQueues','remove','QueueId','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','CmContact','sort','CmList','Tag','Tags','tag','getQueues','Unknown\x20channel','Queue','Unknown\x20role','admin','findAll','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','all','getChannels','YYYY-MM-DD\x20HH:mm:ss','forEach','LOGIN','PAUSE','LOGININPAUSE','concat','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','faxPause','smsPause','whatsapppause','pauseType','lastPauseAt','mail','chat','fax','sms','whatsapp','manual','%s%s','getTeams','Team','addTeams','omit','setDataValue','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','Voice','removeTeams','removeAgent','getLists','getAgents','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','CmHopper','firstName','lastName','Contact','dialActive','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/environment','../../mysqldb','redis','defaults','register'];(function(_0x1a8912,_0xee1422){var _0x103677=function(_0x51ce3a){while(--_0x51ce3a){_0x1a8912['push'](_0x1a8912['shift']());}};_0x103677(++_0xee1422);}(_0x7969,0x157));var _0x9796=function(_0x166961,_0x22c918){_0x166961=_0x166961-0x0;var _0x5de736=_0x7969[_0x166961];return _0x5de736;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9796('0x0'));var rimraf=require(_0x9796('0x1'));var zipdir=require(_0x9796('0x2'));var jsonpatch=require(_0x9796('0x3'));var rp=require(_0x9796('0x4'));var moment=require('moment');var BPromise=require(_0x9796('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9796('0x6'));var csv=require(_0x9796('0x7'));var ejs=require(_0x9796('0x8'));var fs=require('fs');var _=require(_0x9796('0x9'));var squel=require(_0x9796('0xa'));var crypto=require(_0x9796('0xb'));var jsforce=require(_0x9796('0xc'));var deskjs=require(_0x9796('0xd'));var toCsv=require(_0x9796('0x7'));var querystring=require('querystring');var Papa=require(_0x9796('0xe'));var Redis=require(_0x9796('0xf'));var authService=require(_0x9796('0x10'));var qs=require(_0x9796('0x11'));var as=require(_0x9796('0x12'));var hardwareService=require(_0x9796('0x13'));var logger=require(_0x9796('0x14'))(_0x9796('0x15'));var utils=require('../../config/utils');var config=require(_0x9796('0x16'));var db=require(_0x9796('0x17'))['db'];config[_0x9796('0x18')]=_[_0x9796('0x19')](config[_0x9796('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0x9796('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9796('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1a08ff,_0x217d36,_0x13adb9){if(_0x13adb9){var _0x5a6b7b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a6b7b[_0x9796('0x1c')](_0x217d36)){return _0x1a08ff;}else{throw new db[(_0x9796('0x1d'))][(_0x9796('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 _0x1a08ff;}}function respondWithRpcPromise(_0x475d54,_0x2a6e27,_0x21c99f,_0x287ee4){return new BPromise(function(_0xd4a80,_0xe81311){var _0x5ec6ee=_0x287ee4||client;return _0x5ec6ee[_0x9796('0x1f')](_0x475d54,_0x21c99f)['then'](function(_0x3a84ed){logger[_0x9796('0x20')](_0x9796('0x21'),_0x2a6e27,_0x9796('0x22'));logger['debug'](_0x9796('0x23'),_0x2a6e27,'request\x20sent',JSON[_0x9796('0x24')](_0x3a84ed));if(_0x3a84ed[_0x9796('0x25')]){if(_0x3a84ed[_0x9796('0x25')]['code']===0x1f4){logger[_0x9796('0x25')](_0x9796('0x21'),_0x2a6e27,_0x3a84ed['error']['message']);return _0xe81311(_0x3a84ed[_0x9796('0x25')][_0x9796('0x26')]);}logger[_0x9796('0x25')](_0x9796('0x21'),_0x2a6e27,_0x3a84ed['error'][_0x9796('0x26')]);return _0xd4a80(_0x3a84ed['error']['message']);}else{logger[_0x9796('0x20')]('User,\x20%s,\x20%s',_0x2a6e27,'request\x20sent');_0xd4a80(_0x3a84ed[_0x9796('0x27')]['message']);}})[_0x9796('0x28')](function(_0x234c71){logger[_0x9796('0x25')](_0x9796('0x21'),_0x2a6e27,_0x234c71);_0xe81311(_0x234c71);});});}function respondWithStatusCode(_0x25dd36,_0x532289){_0x532289=_0x532289||0xcc;return function(_0x22451c){if(_0x22451c){return _0x25dd36[_0x9796('0x29')](_0x532289);}return _0x25dd36[_0x9796('0x2a')](_0x532289)['end']();};}function respondWithResult(_0x418f5e,_0xb9df86){_0xb9df86=_0xb9df86||0xc8;return function(_0x17a359){if(_0x17a359){return _0x418f5e['status'](_0xb9df86)[_0x9796('0x2b')](_0x17a359);}};}function respondWithFilteredResult(_0x110301,_0x51c00e){return function(_0x408cb8){if(_0x408cb8){var _0x1796f2=_0x408cb8[_0x9796('0x2c')],_0x467ed0=_0x51c00e[_0x9796('0x2d')],_0x2400eb=_0x51c00e[_0x9796('0x2d')]+_0x51c00e['limit'],_0x2dc682;if(_0x2400eb>=_0x1796f2){_0x2400eb=_0x1796f2;_0x2dc682=0xc8;}else{_0x2dc682=0xce;}_0x110301['status'](_0x2dc682);return _0x110301[_0x9796('0x2e')]('Content-Range',_0x467ed0+'-'+_0x2400eb+'/'+_0x1796f2)[_0x9796('0x2b')](_0x408cb8);}return null;};}function patchUpdates(_0x484d0a){return function(_0x31f450){try{jsonpatch['apply'](_0x31f450,_0x484d0a,!![]);}catch(_0x339cb2){return BPromise[_0x9796('0x2f')](_0x339cb2);}return _0x31f450[_0x9796('0x30')]();};}function saveUpdates(_0x3f2588,_0x3abc57){return function(_0x3c96ff){if(_0x3c96ff){return _0x3c96ff[_0x9796('0x31')](_0x3f2588)[_0x9796('0x32')](function(_0x3ca543){return _0x3ca543;});}return null;};}function removeEntity(_0x344cd8,_0x15c055){return function(_0x1bcfc7){if(_0x1bcfc7){return _0x1bcfc7[_0x9796('0x33')]()[_0x9796('0x32')](function(){var _0x197a32=_0x1bcfc7[_0x9796('0x34')]({'plain':!![]});var _0x7fa85f=[{'name':'Users','value':_0x9796('0x35'),'ignore':!![]},{'name':_0x9796('0x36'),'value':_0x9796('0x37'),'ignore':![]},{'name':_0x9796('0x38'),'value':'telephone','ignore':![]}];var _0x3fe18e=_(_0x7fa85f)['filter'](_0x9796('0x39'))[_0x9796('0x3a')]('value')[_0x9796('0x3b')]();if(_[_0x9796('0x3c')](_0x3fe18e,_0x197a32[_0x9796('0x3d')])){return;}var _0x365da5=_[_0x9796('0x3e')](_0x7fa85f,[_0x9796('0x3b'),_0x197a32[_0x9796('0x3d')]])[_0x9796('0x3f')];return db['UserProfileResource'][_0x9796('0x33')]({'where':{'type':_0x365da5,'resourceId':_0x197a32['id']}})['then'](function(){return _0x1bcfc7;});})[_0x9796('0x32')](function(){_0x344cd8[_0x9796('0x2a')](0xcc)[_0x9796('0x40')]();});}};}function handleEntityNotFound(_0x58c868,_0x1402c8){return function(_0x13ce4d){if(!_0x13ce4d){_0x58c868[_0x9796('0x29')](0x194);}return _0x13ce4d;};}function handleError(_0x10fc94,_0x5d8f65){_0x5d8f65=_0x5d8f65||0x1f4;return function(_0x3321ef){logger[_0x9796('0x25')](_0x3321ef[_0x9796('0x41')]);if(_0x3321ef[_0x9796('0x3f')]){delete _0x3321ef[_0x9796('0x3f')];}_0x10fc94[_0x9796('0x2a')](_0x5d8f65)[_0x9796('0x42')](_0x3321ef);};}exports['index']=function(_0x19e31d,_0x3303b2){var _0x564e79={},_0x4dfc93={},_0x37d409={'count':0x0,'rows':[]};var _0x1d2f2e=_[_0x9796('0x3a')](db['User'][_0x9796('0x43')],function(_0x65202b){return{'name':_0x65202b[_0x9796('0x44')],'type':_0x65202b[_0x9796('0x45')][_0x9796('0x46')]};});_0x4dfc93['model']=_[_0x9796('0x47')](_[_0x9796('0x3a')](_0x1d2f2e,'name'),[_0x9796('0x48'),_0x9796('0x49')]);_0x4dfc93['query']=_['keys'](_0x19e31d[_0x9796('0x4a')]);_0x4dfc93[_0x9796('0x4b')]=_[_0x9796('0x4c')](_0x4dfc93[_0x9796('0x4d')],_0x4dfc93[_0x9796('0x4a')]);_0x564e79[_0x9796('0x4e')]=_[_0x9796('0x4c')](_0x4dfc93[_0x9796('0x4d')],qs['fields'](_0x19e31d[_0x9796('0x4a')][_0x9796('0x4f')]));_0x564e79[_0x9796('0x4e')]=_0x564e79[_0x9796('0x4e')]['length']?_0x564e79[_0x9796('0x4e')]:_0x4dfc93['model'];if(!_0x19e31d[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x564e79[_0x9796('0x52')]=qs[_0x9796('0x52')](_0x19e31d[_0x9796('0x4a')][_0x9796('0x52')]);_0x564e79[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x19e31d[_0x9796('0x4a')][_0x9796('0x2d')]);}_0x564e79[_0x9796('0x53')]=qs['sort'](_0x19e31d[_0x9796('0x4a')]['sort']);_0x564e79[_0x9796('0x54')]=qs[_0x9796('0x4b')](_[_0x9796('0x55')](_0x19e31d[_0x9796('0x4a')],_0x4dfc93[_0x9796('0x4b')]),_0x1d2f2e);if(_0x19e31d[_0x9796('0x4a')][_0x9796('0x56')]){_0x564e79[_0x9796('0x54')]=_['merge'](_0x564e79[_0x9796('0x54')],{'$or':_[_0x9796('0x3a')](_0x1d2f2e,function(_0x2ee5f0){if(_0x2ee5f0[_0x9796('0x45')]!=='VIRTUAL'){return db['sequelize'][_0x9796('0x54')](db['sequelize']['fn'](_0x9796('0x57'),db['sequelize'][_0x9796('0x58')](_0x2ee5f0['name'])),{'$like':db[_0x9796('0x59')]['fn'](_0x9796('0x57'),'%'+_0x19e31d[_0x9796('0x4a')][_0x9796('0x56')]+'%')});}})});}_0x564e79=_[_0x9796('0x5a')]({},_0x564e79,_0x19e31d[_0x9796('0x5b')]);var _0x1ac760={'where':_0x564e79[_0x9796('0x54')]};return db[_0x9796('0x5c')][_0x9796('0x2c')](_0x1ac760)[_0x9796('0x32')](function(_0x45b76a){_0x37d409[_0x9796('0x2c')]=_0x45b76a;if(_0x19e31d['query']['includeAll']){_0x564e79[_0x9796('0x5d')]=[{'all':!![]}];}return db[_0x9796('0x5c')]['findAll'](_0x564e79);})['then'](function(_0x17a718){_0x37d409[_0x9796('0x5e')]=_0x17a718;return _0x37d409;})[_0x9796('0x32')](respondWithFilteredResult(_0x3303b2,_0x564e79))['catch'](handleError(_0x3303b2,null));};exports[_0x9796('0x5f')]=function(_0x2b488b,_0x18dc95){var _0x49f7da={'raw':![],'where':{'id':_0x2b488b[_0x9796('0x60')]['id']}},_0x66d42e={};_0x66d42e[_0x9796('0x4d')]=_['differenceBy'](_[_0x9796('0x61')](db[_0x9796('0x5c')][_0x9796('0x43')]),[_0x9796('0x48'),_0x9796('0x49')]);_0x66d42e['query']=_[_0x9796('0x61')](_0x2b488b[_0x9796('0x4a')]);_0x66d42e[_0x9796('0x4b')]=_['intersection'](_0x66d42e[_0x9796('0x4d')],_0x66d42e[_0x9796('0x4a')]);_0x49f7da[_0x9796('0x4e')]=_['intersection'](_0x66d42e['model'],qs['fields'](_0x2b488b[_0x9796('0x4a')]['fields']));_0x49f7da[_0x9796('0x4e')]=_0x49f7da[_0x9796('0x4e')][_0x9796('0x62')]?_0x49f7da[_0x9796('0x4e')]:_0x66d42e['model'];if(_0x2b488b[_0x9796('0x4a')][_0x9796('0x63')]){_0x49f7da[_0x9796('0x5d')]=[{'all':!![]}];}_0x49f7da=_[_0x9796('0x5a')]({},_0x49f7da,_0x2b488b[_0x9796('0x5b')]);return db[_0x9796('0x5c')][_0x9796('0x3e')](_0x49f7da)[_0x9796('0x32')](handleEntityNotFound(_0x18dc95,null))[_0x9796('0x32')](respondWithResult(_0x18dc95,null))['catch'](handleError(_0x18dc95,null));};exports[_0x9796('0x64')]=function(_0x3e6a89,_0x5903c5){return db['User'][_0x9796('0x64')](_0x3e6a89[_0x9796('0x65')],{'raw':![],'individualHooks':!![]})[_0x9796('0x32')](respondWithResult(_0x5903c5,0xc9))[_0x9796('0x28')](handleError(_0x5903c5,null));};exports['update']=function(_0x271ff0,_0x3f7050){if(_0x271ff0[_0x9796('0x65')]['id']){delete _0x271ff0['body']['id'];}delete _0x271ff0[_0x9796('0x65')][_0x9796('0x3d')];return db[_0x9796('0x5c')][_0x9796('0x3e')]({'where':{'id':_0x271ff0[_0x9796('0x60')]['id']}})['then'](handleEntityNotFound(_0x3f7050,null))[_0x9796('0x32')](saveUpdates(_0x271ff0['body'],null))[_0x9796('0x32')](respondWithResult(_0x3f7050,null))[_0x9796('0x28')](handleError(_0x3f7050,null));};exports[_0x9796('0x66')]=function(_0x30ae0f,_0x94c174){return db['User'][_0x9796('0x66')]()[_0x9796('0x32')](respondWithResult(_0x94c174,null))['catch'](handleError(_0x94c174,null));};exports[_0x9796('0x67')]=function(_0x323a05,_0x16fe82,_0x3f2ec1){return db['User'][_0x9796('0x3e')]({'where':{'id':_0x323a05[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x16fe82,null))['then'](function(_0x31c86d){if(_0x31c86d){return _0x31c86d['addContacts'](_0x323a05['body'][_0x9796('0x68')],_['omit'](_0x323a05[_0x9796('0x65')],[_0x9796('0x68'),'id'])||{});}})['then'](respondWithResult(_0x16fe82,null))[_0x9796('0x28')](handleError(_0x16fe82,null));};var getLicense=function(_0x5938c4){return new BPromise(function(_0x355c84,_0x482359){var _0x431197=0x0;_0x5938c4['body'][_0x9796('0x3d')]===_0x9796('0x37')&&_0x355c84(_0x9796('0x69'));return db[_0x9796('0x5c')][_0x9796('0x2c')]({'where':{'$or':[{'role':_0x5938c4[_0x9796('0x65')][_0x9796('0x3d')]===_0x9796('0x6a')?_0x9796('0x6a'):['admin',_0x9796('0x35')]}]}})['then'](function(_0x570118){_0x431197=_0x570118;return require('../../config/license/util')[_0x9796('0x6b')]();})[_0x9796('0x32')](function(_0x5267e5){var _0xe77c95=_0x5938c4[_0x9796('0x65')][_0x9796('0x3d')]===_0x9796('0x6a')?_0x9796('0x6c'):_0x9796('0x6d');if(!_['isNil'](_0x5267e5[_0xe77c95])&&_0x431197>=_0x5267e5[_0xe77c95]){return _0x482359({'message':_0x9796('0x6e')});}return _0x355c84(util[_0x9796('0x6f')](_0x9796('0x70'),_0xe77c95,_0x431197));})['catch'](function(_0x146232){return _0x482359(_0x146232);});});};exports['create']=function(_0x283dbd,_0x1edb72){return getLicense(_0x283dbd)[_0x9796('0x32')](function(_0x3b42c9){if(!_0x283dbd[_0x9796('0x65')][_0x9796('0x71')]){var _0x316772;return db[_0x9796('0x72')][_0x9796('0x73')](0x1)['then'](function(_0xba2b87){return checkPasswordPattern(_0xba2b87,_0x283dbd[_0x9796('0x65')][_0x9796('0x48')],_0xba2b87[_0x9796('0x74')]);})['then'](function(_0x10091b){_0x316772=_0x10091b[_0x9796('0x75')];return db[_0x9796('0x5c')][_0x9796('0x76')](_0x9796('0x71'));})[_0x9796('0x32')](function(_0x1806c3){if(_[_0x9796('0x77')](_0x1806c3)){if(_0x316772){_0x283dbd[_0x9796('0x65')]['internal']=_0x316772;}else{_0x283dbd[_0x9796('0x65')][_0x9796('0x71')]=0x1;}}else{if(_[_0x9796('0x77')](_0x316772)||_0x316772==_0x1806c3){_0x283dbd[_0x9796('0x65')]['internal']=_0x1806c3+0x1;}else if(_0x316772>_0x1806c3){_0x283dbd['body']['internal']=_0x316772;}else{return db[_0x9796('0x59')]['query'](_0x9796('0x78'),{'type':db[_0x9796('0x59')]['QueryTypes']['SELECT']})[_0x9796('0x32')](function(_0x5452bb){if(_0x5452bb&&_0x5452bb[_0x9796('0x62')]){for(var _0x25fe2f=0x0,_0x143d04=_0x5452bb[_0x9796('0x62')];_0x25fe2f<_0x143d04&&_[_0x9796('0x77')](_0x283dbd[_0x9796('0x65')][_0x9796('0x71')]);_0x25fe2f++){if(_0x316772<=_0x5452bb[_0x25fe2f][_0x9796('0x79')]){_0x283dbd[_0x9796('0x65')]['internal']=_0x5452bb[_0x25fe2f][_0x9796('0x79')];}else if(_0x316772>_0x5452bb[_0x25fe2f][_0x9796('0x79')]&&_0x316772<=_0x5452bb[_0x25fe2f]['to']){_0x283dbd[_0x9796('0x65')][_0x9796('0x71')]=_0x316772;}}}if(_['isNil'](_0x283dbd[_0x9796('0x65')]['internal'])){_0x283dbd['body']['internal']=_0x1806c3+0x1;}});}}});}})[_0x9796('0x32')](function(){if(_0x283dbd[_0x9796('0x65')]['voicemail']){_0x283dbd[_0x9796('0x65')][_0x9796('0x7a')]=_0x283dbd['body'][_0x9796('0x71')];_0x283dbd[_0x9796('0x65')][_0x9796('0x7b')]={'mailbox':_0x283dbd['body'][_0x9796('0x71')],'password':_0x283dbd['body'][_0x9796('0x48')],'fullname':_0x283dbd['body']['fullname'],'email':_0x283dbd[_0x9796('0x65')][_0x9796('0x7c')]};}if(_0x283dbd['body']&&_0x283dbd['body']['role']==='agent'){if(!_0x283dbd[_0x9796('0x65')][_0x9796('0x7d')]){_0x283dbd['body']['permissions']=[_0x9796('0x7e'),'102',_0x9796('0x7f'),_0x9796('0x80'),'110',_0x9796('0x81'),_0x9796('0x82'),_0x9796('0x83'),'107','108','109',_0x9796('0x84'),_0x9796('0x85'),_0x9796('0x86')];}}return db['User'][_0x9796('0x87')](_0x283dbd[_0x9796('0x65')],{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x9796('0x32')](function(_0x2ad22d){if(_0x283dbd[_0x9796('0x65')][_0x9796('0x3d')]===_0x9796('0x35'))return _0x2ad22d;var _0x22ef69=_0x283dbd[_0x9796('0x35')][_0x9796('0x34')]({'plain':!![]});if(!_0x22ef69)throw new Error(_0x9796('0x88'));if(_0x22ef69[_0x9796('0x3d')]===_0x9796('0x35')){var _0x31e623=_0x2ad22d['get']({'plain':!![]});var _0x16110f=[{'name':_0x9796('0x36'),'value':_0x9796('0x37')},{'name':'Telephones','value':_0x9796('0x6a')}];var _0x4e5a32=_[_0x9796('0x3e')](_0x16110f,[_0x9796('0x3b'),_0x31e623['role']])['name'];return db[_0x9796('0x89')][_0x9796('0x3e')]({'where':{'name':_0x4e5a32,'userProfileId':_0x22ef69['userProfileId']},'raw':!![]})[_0x9796('0x32')](function(_0x20949d){if(_0x20949d&&_0x20949d[_0x9796('0x8a')]===0x0){return db[_0x9796('0x8b')][_0x9796('0x87')]({'name':_0x31e623['name'],'resourceId':_0x31e623['id'],'type':_0x20949d[_0x9796('0x3f')],'sectionId':_0x20949d['id']},{})[_0x9796('0x32')](function(){return _0x2ad22d;});}else{return _0x2ad22d;}})[_0x9796('0x28')](function(_0x4c953e){logger['error'](_0x9796('0x8c'),_0x4c953e);throw _0x4c953e;});}return _0x2ad22d;})['then'](respondWithResult(_0x1edb72,0xc9))[_0x9796('0x28')](handleError(_0x1edb72,null));};exports[_0x9796('0x8d')]=function(_0x4bc834,_0x1d88d8,_0x41df08){var _0x19bc93=![];if(_0x4bc834[_0x9796('0x65')]['id']){delete _0x4bc834[_0x9796('0x65')]['id'];}return db[_0x9796('0x72')][_0x9796('0x8e')]({'attributes':['id',_0x9796('0x74')]})[_0x9796('0x32')](function(_0x54b641){_0x19bc93=_0x54b641[_0x9796('0x74')];return db['User'][_0x9796('0x3e')]({'where':{'id':_0x4bc834[_0x9796('0x60')]['id']}});})[_0x9796('0x32')](function(_0x3fb64f){if(_0x3fb64f){if(_0x3fb64f['id']==_0x4bc834[_0x9796('0x35')]['id']){if(!_0x4bc834[_0x9796('0x65')][_0x9796('0x8f')]||!_0x4bc834['body'][_0x9796('0x90')]){throw new db[(_0x9796('0x1d'))][(_0x9796('0x1e'))](_0x9796('0x91'));}if(!_0x3fb64f[_0x9796('0x92')](_0x4bc834[_0x9796('0x65')][_0x9796('0x8f')])){throw new db[(_0x9796('0x1d'))][(_0x9796('0x1e'))](_0x9796('0x93'));}if(_0x4bc834[_0x9796('0x65')][_0x9796('0x8f')]==_0x4bc834[_0x9796('0x65')][_0x9796('0x90')]){throw new db['Sequelize'][(_0x9796('0x1e'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x3fb64f;}else if(_0x4bc834[_0x9796('0x35')][_0x9796('0x3d')]=='admin'){if(!_0x4bc834[_0x9796('0x65')][_0x9796('0x90')]){throw new db[(_0x9796('0x1d'))][(_0x9796('0x1e'))](_0x9796('0x94'));}return _0x3fb64f;}else if(_0x4bc834['user'][_0x9796('0x3d')]==_0x9796('0x35')){if(!_0x4bc834[_0x9796('0x65')][_0x9796('0x90')]){throw new db[(_0x9796('0x1d'))][(_0x9796('0x1e'))](_0x9796('0x94'));}if(_0x3fb64f[_0x9796('0x3d')]!=_0x9796('0x37')){throw new db[(_0x9796('0x1d'))][(_0x9796('0x1e'))](_0x9796('0x95'));}return _0x3fb64f;}else{throw new db[(_0x9796('0x1d'))][(_0x9796('0x1e'))]('Unauthorized');}}return null;})[_0x9796('0x32')](handleEntityNotFound(_0x1d88d8,null))[_0x9796('0x32')](function(_0x252e84){return checkPasswordPattern(_0x252e84,_0x4bc834[_0x9796('0x65')][_0x9796('0x90')],_0x19bc93);})[_0x9796('0x32')](saveUpdates({'password':_0x4bc834['body'][_0x9796('0x90')],'passwordResetAt':_0x4bc834[_0x9796('0x35')]['id']==_0x4bc834[_0x9796('0x60')]['id']?moment():null},null))['then'](respondWithResult(_0x1d88d8,null))[_0x9796('0x28')](handleError(_0x1d88d8,null));};exports['addQueues']=function(_0xac8091,_0x223f3c,_0x2656da){var _0x39978f=_0xac8091[_0x9796('0x65')][_0x9796('0x96')];return db['User'][_0x9796('0x3e')]({'where':{'id':_0xac8091[_0x9796('0x60')]['id']},'attributes':['id',_0x9796('0x3f'),'role',_0x9796('0x97'),_0x9796('0x98'),_0x9796('0x99'),_0x9796('0x9a')]})[_0x9796('0x32')](handleEntityNotFound(_0x223f3c,null))[_0x9796('0x32')](function(_0x277841){if(_0x277841){if(!utils[_0x9796('0x9b')](_0x39978f)){throw new db[(_0x9796('0x1d'))][(_0x9796('0x1e'))]('Unknown\x20channel');}return _0x277841[_0x9796('0x9c')+_['capitalize'](_0x39978f[_0x9796('0x9d')]())+_0x9796('0x9e')](_0xac8091['body']['ids'],{'penalty':_0xac8091['body']['penalty']||0x0})[_0x9796('0x9f')](function(_0x2c63af){for(var _0x585672=0x0;_0x585672<_0xac8091['body'][_0x9796('0x68')][_0x9796('0x62')];_0x585672+=0x1){var _0x3a0d1c={'UserId':_0xac8091['params']['id']};_0x3a0d1c[_[_0x9796('0xa0')](_0x39978f['toLowerCase']())+'QueueId']=_0xac8091[_0x9796('0x65')][_0x9796('0x68')][_0x585672];socket[_0x9796('0xa1')](_0x9796('0x35')+_['capitalize'](_0x39978f[_0x9796('0x9d')]())+_0x9796('0xa2'),_0x3a0d1c);}return _0x2c63af;})['then'](function(){if(_0x39978f===_0x9796('0xa3')){return db[_0x9796('0xa4')]['findAll']({'where':{'id':_0xac8091['body'][_0x9796('0x68')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x9796('0x32')](function(_0x4c23e4){var _0x3428a8=_0x277841[_0x9796('0x34')]({'plain':!![]});var _0x1fc20d=[];if(_0x39978f===_0x9796('0xa3')&&_0x3428a8[_0x9796('0x3d')]===_0x9796('0x37')&&_0x3428a8[_0x9796('0x97')]){for(var _0x5f5900=0x0;_0x5f5900<_0x4c23e4[_0x9796('0x62')];_0x5f5900+=0x1){_0x1fc20d[_0x9796('0xa5')]({'membername':_0x3428a8[_0x9796('0x3f')],'UserId':_0x3428a8['id'],'queue_name':_0x4c23e4[_0x5f5900]['name'],'VoiceQueueId':_0x4c23e4[_0x5f5900]['id'],'interface':_[_0x9796('0x77')](_0x3428a8['interface'])?util[_0x9796('0x6f')](_0x9796('0xa6'),_0x3428a8[_0x9796('0x3f')]):_0x3428a8['interface'],'paused':_0x3428a8[_0x9796('0x99')]||![],'penalty':_0xac8091['body'][_0x9796('0xa7')]||0x0});}return BPromise[_0x9796('0xa8')](_0x1fc20d,function(_0x46adf1){return db[_0x9796('0xa9')][_0x9796('0xaa')](_0x46adf1);});}return _0x277841;});}})[_0x9796('0x32')](respondWithStatusCode(_0x223f3c,null))[_0x9796('0x28')](handleError(_0x223f3c,null));};exports[_0x9796('0xab')]=function(_0x407f3c,_0x40b014,_0x129306){var _0x2808ea;return db[_0x9796('0x5c')][_0x9796('0x3e')]({'where':{'id':_0x407f3c['params']['id']},'attributes':['id',_0x9796('0x3f'),'role']})['then'](handleEntityNotFound(_0x40b014,null))[_0x9796('0x32')](function(_0x56ac78){if(_0x56ac78){_0x2808ea=_0x56ac78;if(!_0x407f3c[_0x9796('0x4a')][_0x9796('0x96')]||!utils[_0x9796('0x9b')](_0x407f3c[_0x9796('0x4a')][_0x9796('0x96')])){throw new db[(_0x9796('0x1d'))]['ValidationError']('Unknown\x20channel');}return _0x56ac78[_0x9796('0xac')+_[_0x9796('0xa0')](_0x407f3c[_0x9796('0x4a')][_0x9796('0x96')][_0x9796('0x9d')]())+_0x9796('0x9e')](_0x407f3c[_0x9796('0x4a')][_0x9796('0x68')]);}})[_0x9796('0x32')](function(_0x571b94){for(var _0x4212f5=0x0;_0x4212f5<_0x407f3c[_0x9796('0x4a')][_0x9796('0x68')]['length'];_0x4212f5+=0x1){var _0x4f0d72={'UserId':_0x407f3c[_0x9796('0x60')]['id']};_0x4f0d72[_[_0x9796('0xa0')](_0x407f3c[_0x9796('0x4a')]['channel'][_0x9796('0x9d')]())+_0x9796('0xad')]=_0x407f3c['query'][_0x9796('0x68')][_0x4212f5];socket[_0x9796('0xa1')](_0x9796('0x35')+_[_0x9796('0xa0')](_0x407f3c['query'][_0x9796('0x96')][_0x9796('0x9d')]())+_0x9796('0xae'),_0x4f0d72);}return _0x571b94;})[_0x9796('0x32')](function(){if(_0x407f3c[_0x9796('0x4a')][_0x9796('0x96')]===_0x9796('0xa3')){return db[_0x9796('0xa9')]['destroy']({'where':{'UserId':_0x407f3c[_0x9796('0x60')]['id'],'VoiceQueueId':_0x407f3c[_0x9796('0x4a')][_0x9796('0x68')]},'individualHooks':!![]})[_0x9796('0x32')](function(){return _0x2808ea;});}return _0x2808ea;})[_0x9796('0x32')](respondWithStatusCode(_0x40b014,null))[_0x9796('0x28')](handleError(_0x40b014,null));};exports[_0x9796('0xaf')]=function(_0x4a486b,_0x2e2326,_0x583aaa){_0x4a486b[_0x9796('0x65')][_0x9796('0xb0')]=_0x4a486b[_0x9796('0xb1')][_0x9796('0xb2')];return db[_0x9796('0x5c')][_0x9796('0x3e')]({'where':{'id':_0x4a486b[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x2e2326,null))[_0x9796('0x32')](saveUpdates(_0x4a486b[_0x9796('0x65')],null))[_0x9796('0x32')](respondWithResult(_0x2e2326,null))[_0x9796('0x28')](handleError(_0x2e2326,null));};exports[_0x9796('0xb3')]=function(_0x430fc2,_0x35a6c6,_0x1184fb){var _0x2edd86=path[_0x9796('0xb4')](config[_0x9796('0xb5')],_0x9796('0xb6'));return db[_0x9796('0x5c')]['find']({'where':{'id':_0x430fc2[_0x9796('0x60')]['id']},'attributes':['id',_0x9796('0xb0')],'raw':!![]})[_0x9796('0x32')](handleEntityNotFound(_0x35a6c6,null))['then'](function(_0x4c65d2){if(_0x4c65d2){if(_[_0x9796('0x77')](_0x4c65d2[_0x9796('0xb0')])){return _0x35a6c6[_0x9796('0xb7')](_0x2edd86);}else{if(!fs[_0x9796('0xb8')](path['join'](config['root'],_0x9796('0xb9'),_0x4c65d2[_0x9796('0xb0')]))){return _0x35a6c6[_0x9796('0xb7')](_0x2edd86);}return _0x35a6c6[_0x9796('0xb7')](path['join'](config['root'],'server/files/images/',_0x4c65d2[_0x9796('0xb0')]));}}})[_0x9796('0x28')](handleError(_0x35a6c6,null));};exports[_0x9796('0xba')]=function(_0x150bf6,_0x4269ac,_0x472eb7){var _0x1e4809={};var _0x6c8de3={};var _0x54af15;var _0x5ce7ba;return db['User']['findOne']({'where':{'id':_0x150bf6[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x4269ac,null))[_0x9796('0x32')](function(_0x4bf175){if(_0x4bf175){_0x54af15=_0x4bf175;_0x6c8de3['model']=_[_0x9796('0x61')](db[_0x9796('0xbb')]['rawAttributes']);_0x6c8de3[_0x9796('0x4a')]=_['keys'](_0x150bf6[_0x9796('0x4a')]);_0x6c8de3['filters']=_[_0x9796('0x4c')](_0x6c8de3[_0x9796('0x4d')],_0x6c8de3[_0x9796('0x4a')]);_0x1e4809[_0x9796('0x4e')]=_['intersection'](_0x6c8de3[_0x9796('0x4d')],qs[_0x9796('0x4f')](_0x150bf6[_0x9796('0x4a')][_0x9796('0x4f')]));_0x1e4809[_0x9796('0x4e')]=_0x1e4809[_0x9796('0x4e')][_0x9796('0x62')]?_0x1e4809[_0x9796('0x4e')]:_0x6c8de3[_0x9796('0x4d')];_0x1e4809[_0x9796('0x53')]=qs['sort'](_0x150bf6[_0x9796('0x4a')][_0x9796('0xbc')]);_0x1e4809[_0x9796('0x54')]=qs[_0x9796('0x4b')](_[_0x9796('0x55')](_0x150bf6[_0x9796('0x4a')],_0x6c8de3['filters']));if(_0x150bf6[_0x9796('0x4a')][_0x9796('0x56')]){_0x1e4809[_0x9796('0x54')]=_[_0x9796('0x5a')](_0x1e4809['where'],{'$or':_[_0x9796('0x3a')](_0x1e4809[_0x9796('0x4e')],function(_0x2ad06c){var _0xd23475={};_0xd23475[_0x2ad06c]={'$like':'%'+_0x150bf6[_0x9796('0x4a')]['filter']+'%'};return _0xd23475;})});}_0x1e4809=_['merge']({},_0x1e4809,_0x150bf6[_0x9796('0x5b')]);return _0x54af15[_0x9796('0xba')](_0x1e4809);}})[_0x9796('0x32')](function(_0x36b880){if(_0x36b880){_0x5ce7ba=_0x36b880['length'];if(_0x150bf6['query'][_0x9796('0x50')](_0x9796('0x63'))){_0x1e4809[_0x9796('0x5d')]=[{'model':db[_0x9796('0xbd')],'as':'List','required':![]},{'model':db[_0x9796('0xbe')],'as':_0x9796('0xbf'),'attributes':['id',_0x9796('0x3f'),'color'],'where':_0x150bf6[_0x9796('0x4a')]['tag']?{'id':_0x150bf6[_0x9796('0x4a')][_0x9796('0xc0')]}:undefined,'required':_0x150bf6[_0x9796('0x4a')][_0x9796('0xc0')]?!![]:![]}];}if(!_0x150bf6[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x1e4809[_0x9796('0x52')]=qs['limit'](_0x150bf6[_0x9796('0x4a')][_0x9796('0x52')]);_0x1e4809[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x150bf6[_0x9796('0x4a')]['offset']);}return _0x54af15[_0x9796('0xba')](_0x1e4809);}})[_0x9796('0x32')](function(_0x4120d7){if(_0x4120d7){return _0x4120d7?{'count':_0x5ce7ba,'rows':_0x4120d7}:null;}})[_0x9796('0x32')](respondWithResult(_0x4269ac,null))['catch'](handleError(_0x4269ac,null));};exports[_0x9796('0xc1')]=function(_0xe29425,_0x5a4118,_0x275fa1){var _0x94d397;var _0x9ae2a4;var _0x3d4738={};var _0x40e20e;return db[_0x9796('0x5c')][_0x9796('0x8e')]({'where':{'id':_0xe29425[_0x9796('0x60')]['id']},'attributes':['id',_0x9796('0x3f'),_0x9796('0x3d')]})['then'](handleEntityNotFound(_0x5a4118,null))[_0x9796('0x32')](function(_0x3a7483){if(!utils[_0x9796('0x9b')](_0xe29425['query'][_0x9796('0x96')])){throw new db[(_0x9796('0x1d'))]['ValidationError'](_0x9796('0xc2'));}_0x94d397=_0x3a7483;var _0xd97c41={};_0xd97c41['model']=_[_0x9796('0x61')](db[_[_0x9796('0xa0')](_0xe29425[_0x9796('0x4a')][_0x9796('0x96')])+_0x9796('0xc3')][_0x9796('0x43')]);_0xd97c41['query']=_[_0x9796('0x61')](_0xe29425[_0x9796('0x4a')]);_0xd97c41[_0x9796('0x4b')]=_['intersection'](_0xd97c41[_0x9796('0x4d')],_0xd97c41[_0x9796('0x4a')]);_0x3d4738[_0x9796('0x4e')]=_[_0x9796('0x4c')](_0xd97c41[_0x9796('0x4d')],qs[_0x9796('0x4f')](_0xe29425[_0x9796('0x4a')][_0x9796('0x4f')]));_0x3d4738[_0x9796('0x4e')]=_0x3d4738[_0x9796('0x4e')][_0x9796('0x62')]?_0x3d4738['attributes']:_0xd97c41[_0x9796('0x4d')];_0x3d4738[_0x9796('0x53')]=qs['sort'](_0xe29425[_0x9796('0x4a')][_0x9796('0xbc')]);_0x3d4738[_0x9796('0x54')]=qs['filters'](_[_0x9796('0x55')](_0xe29425[_0x9796('0x4a')],_0xd97c41[_0x9796('0x4b')]));if(_0xe29425[_0x9796('0x4a')][_0x9796('0x56')]){_0x3d4738[_0x9796('0x54')]=_[_0x9796('0x5a')](_0x3d4738[_0x9796('0x54')],{'$or':_[_0x9796('0x3a')](_0x3d4738[_0x9796('0x4e')],function(_0x151cf0){var _0x312afd={};_0x312afd[_0x151cf0]={'$like':'%'+_0xe29425[_0x9796('0x4a')]['filter']+'%'};return _0x312afd;})});}_0x3d4738=_[_0x9796('0x5a')]({},_0x3d4738,_0xe29425[_0x9796('0x5b')]);switch(_0x94d397['role']){case'admin':return db[_['capitalize'](_0xe29425[_0x9796('0x4a')][_0x9796('0x96')])+'Queue']['findAll'](_0x3d4738);case'user':case _0x9796('0x37'):return _0x94d397[_0x9796('0x34')+_[_0x9796('0xa0')](_0xe29425[_0x9796('0x4a')][_0x9796('0x96')])+'Queues'](_0x3d4738);default:throw new db[(_0x9796('0x1d'))][(_0x9796('0x1e'))](_0x9796('0xc4'));}})[_0x9796('0x32')](function(_0x329d6a){_0x40e20e=_0x329d6a[_0x9796('0x62')];if(!_0xe29425['query'][_0x9796('0x50')](_0x9796('0x51'))){_0x3d4738[_0x9796('0x52')]=qs[_0x9796('0x52')](_0xe29425[_0x9796('0x4a')][_0x9796('0x52')]);_0x3d4738[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0xe29425[_0x9796('0x4a')][_0x9796('0x2d')]);}switch(_0x94d397['role']){case _0x9796('0xc5'):return db[_['capitalize'](_0xe29425['query'][_0x9796('0x96')])+_0x9796('0xc3')][_0x9796('0xc6')](_0x3d4738);case'user':case _0x9796('0x37'):return _0x94d397['get'+_['capitalize'](_0xe29425[_0x9796('0x4a')]['channel'])+'Queues'](_0x3d4738);}})['then'](function(_0x4d6d7b){return{'count':_0x40e20e,'rows':_0x4d6d7b};})[_0x9796('0x32')](respondWithResult(_0x5a4118,null))[_0x9796('0x28')](handleError(_0x5a4118,null));};exports['getVoiceQueuesRt']=function(_0x5a7b18,_0x21e83c,_0x1882c0){var _0x528549={};var _0x591cd8={};var _0x5d8fca;var _0x2e2e86;return db[_0x9796('0x5c')][_0x9796('0x8e')]({'where':{'id':_0x5a7b18[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x21e83c,null))[_0x9796('0x32')](function(_0x4c61ab){if(_0x4c61ab){_0x5d8fca=_0x4c61ab;_0x591cd8[_0x9796('0x4d')]=_[_0x9796('0x61')](db[_0x9796('0xa9')][_0x9796('0x43')]);_0x591cd8[_0x9796('0x4a')]=_[_0x9796('0x61')](_0x5a7b18[_0x9796('0x4a')]);_0x591cd8['filters']=_[_0x9796('0x4c')](_0x591cd8[_0x9796('0x4d')],_0x591cd8['query']);_0x528549['attributes']=_[_0x9796('0x4c')](_0x591cd8[_0x9796('0x4d')],qs['fields'](_0x5a7b18[_0x9796('0x4a')][_0x9796('0x4f')]));_0x528549[_0x9796('0x4e')]=_0x528549['attributes']['length']?_0x528549[_0x9796('0x4e')]:_0x591cd8[_0x9796('0x4d')];_0x528549[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x5a7b18[_0x9796('0x4a')][_0x9796('0xbc')]);_0x528549[_0x9796('0x54')]=qs['filters'](_['pick'](_0x5a7b18['query'],_0x591cd8[_0x9796('0x4b')]));if(_0x5a7b18[_0x9796('0x4a')][_0x9796('0x56')]){_0x528549[_0x9796('0x54')]=_['merge'](_0x528549[_0x9796('0x54')],{'$or':_[_0x9796('0x3a')](_0x528549[_0x9796('0x4e')],function(_0x10f1c1){var _0x93c431={};_0x93c431[_0x10f1c1]={'$like':'%'+_0x5a7b18['query']['filter']+'%'};return _0x93c431;})});}_0x528549=_[_0x9796('0x5a')]({},_0x528549,_0x5a7b18[_0x9796('0x5b')]);return _0x5d8fca[_0x9796('0xc7')](_0x528549);}})[_0x9796('0x32')](function(_0x53eae3){if(_0x53eae3){_0x2e2e86=_0x53eae3[_0x9796('0x62')];if(!_0x5a7b18[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x528549[_0x9796('0x52')]=qs[_0x9796('0x52')](_0x5a7b18[_0x9796('0x4a')][_0x9796('0x52')]);_0x528549[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x5a7b18[_0x9796('0x4a')][_0x9796('0x2d')]);}return _0x5d8fca[_0x9796('0xc7')](_0x528549);}})['then'](function(_0xa936ce){if(_0xa936ce){return _0xa936ce?{'count':_0x2e2e86,'rows':_0xa936ce}:null;}})[_0x9796('0x32')](respondWithResult(_0x21e83c,null))['catch'](handleError(_0x21e83c,null));};exports[_0x9796('0xc8')]=function(_0x254851,_0x19135f,_0x36564f){var _0x1bfab7={};var _0xfa99cb={};var _0x37d730;var _0x411895;return db[_0x9796('0x5c')][_0x9796('0x8e')]({'where':{'id':_0x254851[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x19135f,null))[_0x9796('0x32')](function(_0x251fed){if(_0x251fed){_0x37d730=_0x251fed;_0xfa99cb[_0x9796('0x4d')]=_[_0x9796('0x61')](db[_0x9796('0xc9')]['rawAttributes']);_0xfa99cb[_0x9796('0x4a')]=_['keys'](_0x254851[_0x9796('0x4a')]);_0xfa99cb[_0x9796('0x4b')]=_[_0x9796('0x4c')](_0xfa99cb['model'],_0xfa99cb['query']);_0x1bfab7['attributes']=_[_0x9796('0x4c')](_0xfa99cb[_0x9796('0x4d')],qs[_0x9796('0x4f')](_0x254851['query'][_0x9796('0x4f')]));_0x1bfab7[_0x9796('0x4e')]=_0x1bfab7[_0x9796('0x4e')][_0x9796('0x62')]?_0x1bfab7[_0x9796('0x4e')]:_0xfa99cb['model'];_0x1bfab7[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x254851['query'][_0x9796('0xbc')]);_0x1bfab7[_0x9796('0x54')]=qs[_0x9796('0x4b')](_[_0x9796('0x55')](_0x254851[_0x9796('0x4a')],_0xfa99cb[_0x9796('0x4b')]));if(_0x254851[_0x9796('0x4a')][_0x9796('0x56')]){_0x1bfab7[_0x9796('0x54')]=_[_0x9796('0x5a')](_0x1bfab7['where'],{'$or':_[_0x9796('0x3a')](_0x1bfab7[_0x9796('0x4e')],function(_0x190574){var _0x506344={};_0x506344[_0x190574]={'$like':'%'+_0x254851[_0x9796('0x4a')][_0x9796('0x56')]+'%'};return _0x506344;})});}_0x1bfab7=_[_0x9796('0x5a')]({},_0x1bfab7,_0x254851[_0x9796('0x5b')]);return _0x37d730[_0x9796('0xc8')](_0x1bfab7);}})[_0x9796('0x32')](function(_0x15ec06){if(_0x15ec06){_0x411895=_0x15ec06[_0x9796('0x62')];if(!_0x254851['query'][_0x9796('0x50')](_0x9796('0x51'))){_0x1bfab7[_0x9796('0x52')]=qs[_0x9796('0x52')](_0x254851[_0x9796('0x4a')][_0x9796('0x52')]);_0x1bfab7['offset']=qs[_0x9796('0x2d')](_0x254851[_0x9796('0x4a')]['offset']);}return _0x37d730[_0x9796('0xc8')](_0x1bfab7);}})[_0x9796('0x32')](function(_0x379f4b){if(_0x379f4b){return _0x379f4b?{'count':_0x411895,'rows':_0x379f4b}:null;}})[_0x9796('0x32')](respondWithResult(_0x19135f,null))[_0x9796('0x28')](handleError(_0x19135f,null));};exports[_0x9796('0xca')]=function(_0x4a7c68,_0x85d03e,_0x517f30){var _0x1c28de={'raw':!![],'where':{}};var _0x54b01f={};var _0x383ee1={'count':0x0,'rows':[]};return db[_0x9796('0x5c')]['findOne']({'where':{'id':_0x4a7c68[_0x9796('0x60')]['id']}})['then'](handleEntityNotFound(_0x85d03e,null))[_0x9796('0x32')](function(_0x196d51){if(_0x196d51){_0x54b01f[_0x9796('0x4d')]=_[_0x9796('0x61')](db[_0x9796('0xcb')][_0x9796('0x43')]);_0x54b01f[_0x9796('0x4a')]=_[_0x9796('0x61')](_0x4a7c68[_0x9796('0x4a')]);_0x54b01f['filters']=_[_0x9796('0x4c')](_0x54b01f[_0x9796('0x4d')],_0x54b01f['query']);_0x1c28de[_0x9796('0x4e')]=_[_0x9796('0x4c')](_0x54b01f[_0x9796('0x4d')],qs[_0x9796('0x4f')](_0x4a7c68[_0x9796('0x4a')]['fields']));_0x1c28de['attributes']=_0x1c28de[_0x9796('0x4e')]['length']?_0x1c28de[_0x9796('0x4e')]:_0x54b01f[_0x9796('0x4d')];if(!_0x4a7c68[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x1c28de[_0x9796('0x52')]=qs[_0x9796('0x52')](_0x4a7c68[_0x9796('0x4a')][_0x9796('0x52')]);_0x1c28de['offset']=qs['offset'](_0x4a7c68['query']['offset']);}_0x1c28de[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x4a7c68[_0x9796('0x4a')][_0x9796('0xbc')]);_0x1c28de[_0x9796('0x54')]=qs[_0x9796('0x4b')](_[_0x9796('0x55')](_0x4a7c68['query'],_0x54b01f[_0x9796('0x4b')]));_0x1c28de[_0x9796('0x54')][_0x9796('0xcc')]=_0x196d51['id'];if(_0x4a7c68[_0x9796('0x4a')][_0x9796('0x56')]){_0x1c28de[_0x9796('0x54')]=_[_0x9796('0x5a')](_0x1c28de[_0x9796('0x54')],{'$or':_[_0x9796('0x3a')](_0x1c28de[_0x9796('0x4e')],function(_0x3abaee){var _0x2048ac={};_0x2048ac[_0x3abaee]={'$like':'%'+_0x4a7c68[_0x9796('0x4a')][_0x9796('0x56')]+'%'};return _0x2048ac;})});}_0x1c28de=_[_0x9796('0x5a')]({},_0x1c28de,_0x4a7c68[_0x9796('0x5b')]);return db[_0x9796('0xcb')]['count']({'where':_0x1c28de['where']})[_0x9796('0x32')](function(_0x2b5964){_0x383ee1[_0x9796('0x2c')]=_0x2b5964;if(_0x4a7c68[_0x9796('0x4a')][_0x9796('0x63')]){_0x1c28de[_0x9796('0x5d')]=[{'all':!![]}];}return db[_0x9796('0xcb')][_0x9796('0xc6')](_0x1c28de);})[_0x9796('0x32')](function(_0x58727b){_0x383ee1[_0x9796('0x5e')]=_0x58727b;return _0x383ee1;});}})[_0x9796('0x32')](respondWithFilteredResult(_0x85d03e,_0x1c28de))[_0x9796('0x28')](handleError(_0x85d03e,null));};exports[_0x9796('0xcd')]=function(_0x254fed,_0x1ed38e,_0x3d4590){var _0x4bfd2b={'raw':!![],'where':{}};var _0x51a0dc={};var _0x26d755={'count':0x0,'rows':[]};return db[_0x9796('0x5c')]['findOne']({'where':{'id':_0x254fed[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x1ed38e,null))[_0x9796('0x32')](function(_0x3f99c1){if(_0x3f99c1){_0x51a0dc['model']=_[_0x9796('0x61')](db[_0x9796('0xce')][_0x9796('0x43')]);_0x51a0dc[_0x9796('0x4a')]=_[_0x9796('0x61')](_0x254fed[_0x9796('0x4a')]);_0x51a0dc[_0x9796('0x4b')]=_[_0x9796('0x4c')](_0x51a0dc[_0x9796('0x4d')],_0x51a0dc['query']);_0x4bfd2b[_0x9796('0x4e')]=_[_0x9796('0x4c')](_0x51a0dc['model'],qs['fields'](_0x254fed[_0x9796('0x4a')][_0x9796('0x4f')]));_0x4bfd2b[_0x9796('0x4e')]=_0x4bfd2b[_0x9796('0x4e')][_0x9796('0x62')]?_0x4bfd2b[_0x9796('0x4e')]:_0x51a0dc[_0x9796('0x4d')];if(!_0x254fed[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x4bfd2b[_0x9796('0x52')]=qs[_0x9796('0x52')](_0x254fed[_0x9796('0x4a')][_0x9796('0x52')]);_0x4bfd2b[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x254fed[_0x9796('0x4a')][_0x9796('0x2d')]);}_0x4bfd2b['order']=qs[_0x9796('0xbc')](_0x254fed[_0x9796('0x4a')][_0x9796('0xbc')]);_0x4bfd2b[_0x9796('0x54')]=qs[_0x9796('0x4b')](_[_0x9796('0x55')](_0x254fed['query'],_0x51a0dc[_0x9796('0x4b')]));_0x4bfd2b[_0x9796('0x54')][_0x9796('0xcc')]=_0x3f99c1['id'];if(_0x254fed[_0x9796('0x4a')][_0x9796('0x56')]){_0x4bfd2b[_0x9796('0x54')]=_[_0x9796('0x5a')](_0x4bfd2b[_0x9796('0x54')],{'$or':_[_0x9796('0x3a')](_0x4bfd2b[_0x9796('0x4e')],function(_0x22824a){var _0x1b33f4={};_0x1b33f4[_0x22824a]={'$like':'%'+_0x254fed[_0x9796('0x4a')][_0x9796('0x56')]+'%'};return _0x1b33f4;})});}_0x4bfd2b=_[_0x9796('0x5a')]({},_0x4bfd2b,_0x254fed[_0x9796('0x5b')]);return db['ScreenRecording']['count']({'where':_0x4bfd2b['where']})[_0x9796('0x32')](function(_0xca00ea){_0x26d755['count']=_0xca00ea;if(_0x254fed['query'][_0x9796('0x63')]){_0x4bfd2b['include']=[{'all':!![]}];}return db[_0x9796('0xce')]['findAll'](_0x4bfd2b);})['then'](function(_0x4eea46){_0x26d755[_0x9796('0x5e')]=_0x4eea46;return _0x26d755;});}})[_0x9796('0x32')](respondWithFilteredResult(_0x1ed38e,_0x4bfd2b))[_0x9796('0x28')](handleError(_0x1ed38e,null));};exports[_0x9796('0xcf')]=function(_0x83757b,_0x16a55a,_0x48de23){var _0x2f15fa={};var _0x1f6740={};var _0x4c3a34;var _0x5f3d78;return db['User'][_0x9796('0x8e')]({'where':{'id':_0x83757b[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x16a55a,null))[_0x9796('0x32')](function(_0x215fe0){if(_0x215fe0){_0x4c3a34=_0x215fe0;_0x1f6740['model']=_[_0x9796('0x61')](db['ChatInteraction']['rawAttributes']);_0x1f6740[_0x9796('0x4a')]=_[_0x9796('0x61')](_0x83757b[_0x9796('0x4a')]);_0x1f6740[_0x9796('0x4b')]=_[_0x9796('0x4c')](_0x1f6740['model'],_0x1f6740[_0x9796('0x4a')]);_0x2f15fa['attributes']=_['intersection'](_0x1f6740[_0x9796('0x4d')],qs['fields'](_0x83757b[_0x9796('0x4a')]['fields']));_0x2f15fa[_0x9796('0x4e')]=_0x2f15fa[_0x9796('0x4e')][_0x9796('0x62')]?_0x2f15fa[_0x9796('0x4e')]:_0x1f6740[_0x9796('0x4d')];_0x2f15fa[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x83757b[_0x9796('0x4a')]['sort']);_0x2f15fa[_0x9796('0x54')]=qs[_0x9796('0x4b')](_['pick'](_0x83757b[_0x9796('0x4a')],_0x1f6740[_0x9796('0x4b')]));if(_0x83757b[_0x9796('0x4a')][_0x9796('0x56')]){_0x2f15fa[_0x9796('0x54')]=_['merge'](_0x2f15fa[_0x9796('0x54')],{'$or':_['map'](_0x2f15fa[_0x9796('0x4e')],function(_0x5c2f45){var _0x462b44={};_0x462b44[_0x5c2f45]={'$like':'%'+_0x83757b[_0x9796('0x4a')][_0x9796('0x56')]+'%'};return _0x462b44;})});}_0x2f15fa=_[_0x9796('0x5a')]({},_0x2f15fa,_0x83757b[_0x9796('0x5b')]);return _0x4c3a34[_0x9796('0xcf')](_0x2f15fa);}})[_0x9796('0x32')](function(_0xba9dae){if(_0xba9dae){_0x5f3d78=_0xba9dae[_0x9796('0x62')];if(!_0x83757b[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x2f15fa[_0x9796('0x52')]=qs[_0x9796('0x52')](_0x83757b['query'][_0x9796('0x52')]);_0x2f15fa[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x83757b[_0x9796('0x4a')]['offset']);}return _0x4c3a34[_0x9796('0xcf')](_0x2f15fa);}})[_0x9796('0x32')](function(_0x2c51f2){if(_0x2c51f2){return _0x2c51f2?{'count':_0x5f3d78,'rows':_0x2c51f2}:null;}})[_0x9796('0x32')](respondWithResult(_0x16a55a,null))[_0x9796('0x28')](handleError(_0x16a55a,null));};exports[_0x9796('0xd0')]=function(_0x32dda6,_0x334711,_0x53e041){var _0x2c8175={};var _0x4ffbc2={};var _0x1655b2;var _0x11de69;return db[_0x9796('0x5c')][_0x9796('0x8e')]({'where':{'id':_0x32dda6['params']['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x334711,null))[_0x9796('0x32')](function(_0x3a53c8){if(_0x3a53c8){_0x1655b2=_0x3a53c8;_0x4ffbc2['model']=_[_0x9796('0x61')](db[_0x9796('0xd1')][_0x9796('0x43')]);_0x4ffbc2['query']=_[_0x9796('0x61')](_0x32dda6[_0x9796('0x4a')]);_0x4ffbc2[_0x9796('0x4b')]=_[_0x9796('0x4c')](_0x4ffbc2[_0x9796('0x4d')],_0x4ffbc2[_0x9796('0x4a')]);_0x2c8175[_0x9796('0x4e')]=_[_0x9796('0x4c')](_0x4ffbc2[_0x9796('0x4d')],qs[_0x9796('0x4f')](_0x32dda6[_0x9796('0x4a')][_0x9796('0x4f')]));_0x2c8175[_0x9796('0x4e')]=_0x2c8175[_0x9796('0x4e')][_0x9796('0x62')]?_0x2c8175[_0x9796('0x4e')]:_0x4ffbc2['model'];_0x2c8175[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x32dda6['query'][_0x9796('0xbc')]);_0x2c8175[_0x9796('0x54')]=qs[_0x9796('0x4b')](_[_0x9796('0x55')](_0x32dda6[_0x9796('0x4a')],_0x4ffbc2[_0x9796('0x4b')]));if(_0x32dda6[_0x9796('0x4a')][_0x9796('0x56')]){_0x2c8175[_0x9796('0x54')]=_['merge'](_0x2c8175['where'],{'$or':_[_0x9796('0x3a')](_0x2c8175[_0x9796('0x4e')],function(_0x4c5d23){var _0x427f2c={};_0x427f2c[_0x4c5d23]={'$like':'%'+_0x32dda6[_0x9796('0x4a')][_0x9796('0x56')]+'%'};return _0x427f2c;})});}_0x2c8175=_['merge']({},_0x2c8175,_0x32dda6[_0x9796('0x5b')]);return _0x1655b2[_0x9796('0xd0')](_0x2c8175);}})[_0x9796('0x32')](function(_0x28e1c8){if(_0x28e1c8){_0x11de69=_0x28e1c8['length'];if(!_0x32dda6[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x2c8175[_0x9796('0x52')]=qs[_0x9796('0x52')](_0x32dda6[_0x9796('0x4a')][_0x9796('0x52')]);_0x2c8175[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x32dda6[_0x9796('0x4a')][_0x9796('0x2d')]);}return _0x1655b2[_0x9796('0xd0')](_0x2c8175);}})[_0x9796('0x32')](function(_0x30c9c4){if(_0x30c9c4){return _0x30c9c4?{'count':_0x11de69,'rows':_0x30c9c4}:null;}})['then'](respondWithResult(_0x334711,null))[_0x9796('0x28')](handleError(_0x334711,null));};exports[_0x9796('0xd2')]=function(_0x122a51,_0x166d7f,_0x3babda){var _0x1b4982={'raw':!![],'where':{}};var _0xf8aaaf={};var _0x31d687={'count':0x0,'rows':[]};return db[_0x9796('0x5c')][_0x9796('0x8e')]({'where':{'id':_0x122a51['params']['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x166d7f,null))[_0x9796('0x32')](function(_0x5964c9){if(_0x5964c9){_0xf8aaaf[_0x9796('0x4d')]=_[_0x9796('0x61')](db['MailInteraction'][_0x9796('0x43')]);_0xf8aaaf['query']=_['keys'](_0x122a51[_0x9796('0x4a')]);_0xf8aaaf[_0x9796('0x4b')]=_[_0x9796('0x4c')](_0xf8aaaf['model'],_0xf8aaaf[_0x9796('0x4a')]);_0x1b4982[_0x9796('0x4e')]=_[_0x9796('0x4c')](_0xf8aaaf['model'],qs[_0x9796('0x4f')](_0x122a51[_0x9796('0x4a')][_0x9796('0x4f')]));_0x1b4982[_0x9796('0x4e')]=_0x1b4982[_0x9796('0x4e')][_0x9796('0x62')]?_0x1b4982[_0x9796('0x4e')]:_0xf8aaaf['model'];if(!_0x122a51[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x1b4982[_0x9796('0x52')]=qs[_0x9796('0x52')](_0x122a51[_0x9796('0x4a')][_0x9796('0x52')]);_0x1b4982[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x122a51[_0x9796('0x4a')][_0x9796('0x2d')]);}_0x1b4982[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x122a51[_0x9796('0x4a')][_0x9796('0xbc')]);_0x1b4982[_0x9796('0x54')]=qs[_0x9796('0x4b')](_[_0x9796('0x55')](_0x122a51[_0x9796('0x4a')],_0xf8aaaf[_0x9796('0x4b')]));_0x1b4982['where'][_0x9796('0xcc')]=_0x5964c9['id'];if(_0x122a51['query'][_0x9796('0x56')]){_0x1b4982[_0x9796('0x54')]=_[_0x9796('0x5a')](_0x1b4982[_0x9796('0x54')],{'$or':_['map'](_0x1b4982[_0x9796('0x4e')],function(_0x1f4ca6){var _0x4e3c40={};_0x4e3c40[_0x1f4ca6]={'$like':'%'+_0x122a51[_0x9796('0x4a')][_0x9796('0x56')]+'%'};return _0x4e3c40;})});}_0x1b4982=_['merge']({},_0x1b4982,_0x122a51[_0x9796('0x5b')]);return db[_0x9796('0xd3')][_0x9796('0x2c')]({'where':_0x1b4982['where']})['then'](function(_0x2b9973){_0x31d687[_0x9796('0x2c')]=_0x2b9973;if(_0x122a51[_0x9796('0x4a')][_0x9796('0x63')]){_0x1b4982[_0x9796('0x5d')]=[{'all':!![]}];}return db['MailInteraction'][_0x9796('0xc6')](_0x1b4982);})[_0x9796('0x32')](function(_0x1cf08b){_0x31d687['rows']=_0x1cf08b;return _0x31d687;});}})[_0x9796('0x32')](respondWithFilteredResult(_0x166d7f,_0x1b4982))[_0x9796('0x28')](handleError(_0x166d7f,null));};exports['getSmsInteractions']=function(_0x5abee6,_0xa1820c,_0x4c68d8){var _0x5b7e57={};var _0x21ca87={};var _0x47a5cc;var _0x1e4b1a;return db[_0x9796('0x5c')][_0x9796('0x8e')]({'where':{'id':_0x5abee6[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0xa1820c,null))[_0x9796('0x32')](function(_0x102032){if(_0x102032){_0x47a5cc=_0x102032;_0x21ca87[_0x9796('0x4d')]=_[_0x9796('0x61')](db[_0x9796('0xd4')][_0x9796('0x43')]);_0x21ca87[_0x9796('0x4a')]=_[_0x9796('0x61')](_0x5abee6[_0x9796('0x4a')]);_0x21ca87['filters']=_[_0x9796('0x4c')](_0x21ca87[_0x9796('0x4d')],_0x21ca87[_0x9796('0x4a')]);_0x5b7e57[_0x9796('0x4e')]=_[_0x9796('0x4c')](_0x21ca87[_0x9796('0x4d')],qs[_0x9796('0x4f')](_0x5abee6['query'][_0x9796('0x4f')]));_0x5b7e57[_0x9796('0x4e')]=_0x5b7e57[_0x9796('0x4e')][_0x9796('0x62')]?_0x5b7e57['attributes']:_0x21ca87[_0x9796('0x4d')];_0x5b7e57[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x5abee6[_0x9796('0x4a')][_0x9796('0xbc')]);_0x5b7e57[_0x9796('0x54')]=qs['filters'](_[_0x9796('0x55')](_0x5abee6[_0x9796('0x4a')],_0x21ca87[_0x9796('0x4b')]));if(_0x5abee6['query']['filter']){_0x5b7e57['where']=_[_0x9796('0x5a')](_0x5b7e57[_0x9796('0x54')],{'$or':_[_0x9796('0x3a')](_0x5b7e57['attributes'],function(_0x3a8e9b){var _0x436e23={};_0x436e23[_0x3a8e9b]={'$like':'%'+_0x5abee6[_0x9796('0x4a')]['filter']+'%'};return _0x436e23;})});}_0x5b7e57=_[_0x9796('0x5a')]({},_0x5b7e57,_0x5abee6[_0x9796('0x5b')]);return _0x47a5cc['getSmsInteractions'](_0x5b7e57);}})['then'](function(_0x1b891f){if(_0x1b891f){_0x1e4b1a=_0x1b891f[_0x9796('0x62')];if(!_0x5abee6[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x5b7e57['limit']=qs[_0x9796('0x52')](_0x5abee6[_0x9796('0x4a')][_0x9796('0x52')]);_0x5b7e57[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x5abee6[_0x9796('0x4a')]['offset']);}return _0x47a5cc[_0x9796('0xd5')](_0x5b7e57);}})[_0x9796('0x32')](function(_0x15c904){if(_0x15c904){return _0x15c904?{'count':_0x1e4b1a,'rows':_0x15c904}:null;}})[_0x9796('0x32')](respondWithResult(_0xa1820c,null))[_0x9796('0x28')](handleError(_0xa1820c,null));};exports[_0x9796('0xd6')]=function(_0x3f4ff7,_0x325fcd,_0x5818c5){var _0x8ea339={};var _0x2029cb={};var _0x240035;var _0x28cddc;return db[_0x9796('0x5c')][_0x9796('0x8e')]({'where':{'id':_0x3f4ff7[_0x9796('0x60')]['id']}})['then'](handleEntityNotFound(_0x325fcd,null))[_0x9796('0x32')](function(_0x2d95cc){if(_0x2d95cc){_0x240035=_0x2d95cc;_0x2029cb[_0x9796('0x4d')]=_[_0x9796('0x61')](db[_0x9796('0xd7')]['rawAttributes']);_0x2029cb[_0x9796('0x4a')]=_[_0x9796('0x61')](_0x3f4ff7[_0x9796('0x4a')]);_0x2029cb[_0x9796('0x4b')]=_[_0x9796('0x4c')](_0x2029cb[_0x9796('0x4d')],_0x2029cb[_0x9796('0x4a')]);_0x8ea339['attributes']=_[_0x9796('0x4c')](_0x2029cb[_0x9796('0x4d')],qs['fields'](_0x3f4ff7[_0x9796('0x4a')][_0x9796('0x4f')]));_0x8ea339[_0x9796('0x4e')]=_0x8ea339[_0x9796('0x4e')][_0x9796('0x62')]?_0x8ea339[_0x9796('0x4e')]:_0x2029cb[_0x9796('0x4d')];_0x8ea339[_0x9796('0x53')]=qs['sort'](_0x3f4ff7[_0x9796('0x4a')][_0x9796('0xbc')]);_0x8ea339[_0x9796('0x54')]=qs['filters'](_[_0x9796('0x55')](_0x3f4ff7[_0x9796('0x4a')],_0x2029cb[_0x9796('0x4b')]));if(_0x3f4ff7[_0x9796('0x4a')][_0x9796('0x56')]){_0x8ea339[_0x9796('0x54')]=_['merge'](_0x8ea339[_0x9796('0x54')],{'$or':_['map'](_0x8ea339[_0x9796('0x4e')],function(_0x311169){var _0x50dda7={};_0x50dda7[_0x311169]={'$like':'%'+_0x3f4ff7[_0x9796('0x4a')][_0x9796('0x56')]+'%'};return _0x50dda7;})});}_0x8ea339=_[_0x9796('0x5a')]({},_0x8ea339,_0x3f4ff7['options']);return _0x240035[_0x9796('0xd6')](_0x8ea339);}})[_0x9796('0x32')](function(_0x103407){if(_0x103407){_0x28cddc=_0x103407[_0x9796('0x62')];if(!_0x3f4ff7[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x8ea339[_0x9796('0x52')]=qs['limit'](_0x3f4ff7[_0x9796('0x4a')][_0x9796('0x52')]);_0x8ea339[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x3f4ff7[_0x9796('0x4a')][_0x9796('0x2d')]);}return _0x240035[_0x9796('0xd6')](_0x8ea339);}})[_0x9796('0x32')](function(_0x9b031a){if(_0x9b031a){return _0x9b031a?{'count':_0x28cddc,'rows':_0x9b031a}:null;}})[_0x9796('0x32')](respondWithResult(_0x325fcd,null))['catch'](handleError(_0x325fcd,null));};exports['getWhatsappInteractions']=function(_0x15d931,_0x3dea3a,_0x47c701){var _0x2877d8={};var _0x4ddd6e={};var _0x166938;var _0x12303c;return db['User'][_0x9796('0x8e')]({'where':{'id':_0x15d931[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x3dea3a,null))['then'](function(_0x3c3c8e){if(_0x3c3c8e){_0x166938=_0x3c3c8e;_0x4ddd6e['model']=_[_0x9796('0x61')](db[_0x9796('0xd8')]['rawAttributes']);_0x4ddd6e[_0x9796('0x4a')]=_[_0x9796('0x61')](_0x15d931[_0x9796('0x4a')]);_0x4ddd6e[_0x9796('0x4b')]=_[_0x9796('0x4c')](_0x4ddd6e[_0x9796('0x4d')],_0x4ddd6e[_0x9796('0x4a')]);_0x2877d8[_0x9796('0x4e')]=_[_0x9796('0x4c')](_0x4ddd6e[_0x9796('0x4d')],qs['fields'](_0x15d931[_0x9796('0x4a')][_0x9796('0x4f')]));_0x2877d8[_0x9796('0x4e')]=_0x2877d8[_0x9796('0x4e')][_0x9796('0x62')]?_0x2877d8[_0x9796('0x4e')]:_0x4ddd6e['model'];_0x2877d8[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x15d931[_0x9796('0x4a')]['sort']);_0x2877d8[_0x9796('0x54')]=qs[_0x9796('0x4b')](_['pick'](_0x15d931['query'],_0x4ddd6e[_0x9796('0x4b')]));if(_0x15d931['query'][_0x9796('0x56')]){_0x2877d8[_0x9796('0x54')]=_[_0x9796('0x5a')](_0x2877d8['where'],{'$or':_['map'](_0x2877d8['attributes'],function(_0x1917e3){var _0xef721c={};_0xef721c[_0x1917e3]={'$like':'%'+_0x15d931[_0x9796('0x4a')][_0x9796('0x56')]+'%'};return _0xef721c;})});}_0x2877d8=_['merge']({},_0x2877d8,_0x15d931['options']);return _0x166938[_0x9796('0xd9')](_0x2877d8);}})[_0x9796('0x32')](function(_0x59dad4){if(_0x59dad4){_0x12303c=_0x59dad4[_0x9796('0x62')];if(!_0x15d931[_0x9796('0x4a')][_0x9796('0x50')]('nolimit')){_0x2877d8['limit']=qs['limit'](_0x15d931[_0x9796('0x4a')]['limit']);_0x2877d8['offset']=qs[_0x9796('0x2d')](_0x15d931['query'][_0x9796('0x2d')]);}return _0x166938[_0x9796('0xd9')](_0x2877d8);}})[_0x9796('0x32')](function(_0x1dd402){if(_0x1dd402){return _0x1dd402?{'count':_0x12303c,'rows':_0x1dd402}:null;}})[_0x9796('0x32')](respondWithResult(_0x3dea3a,null))[_0x9796('0x28')](handleError(_0x3dea3a,null));};exports[_0x9796('0xda')]=function(_0x47cb8d,_0x8bd512,_0x46f43d){var _0x1e7954;var _0xed2747;var _0x46e229;var _0x475ed9=!_[_0x9796('0x77')](_0x47cb8d[_0x9796('0x60')]['id'])?_0x47cb8d[_0x9796('0x60')]['id']:!_[_0x9796('0x77')](_0x47cb8d[_0x9796('0x35')]['id'])?_0x47cb8d['user']['id']:null;return db[_0x9796('0x5c')][_0x9796('0x3e')]({'where':{'id':_0x475ed9,'role':{'$or':[_0x9796('0xc5'),'user',_0x9796('0x37')]}},'attributes':['id','name',_0x9796('0xdb'),_0x9796('0xdc'),_0x9796('0x3d'),'internal',_0x9796('0x98')]})['then'](function(_0x39b987){if(_0x39b987){if(_0x39b987[_0x9796('0x3d')]==='agent'){_0x1e7954=_0x39b987;if(_0x47cb8d['body'][_0x9796('0x9a')]){_0x46e229=util[_0x9796('0x6f')](_0x9796('0xdd'),_0x1e7954[_0x47cb8d[_0x9796('0x65')]['interface']]);}else if(_0x47cb8d[_0x9796('0x65')][_0x9796('0xde')]){_0x46e229=util[_0x9796('0x6f')]('SIP/%s',_0x47cb8d['body'][_0x9796('0xde')]);}else{_0x46e229=util[_0x9796('0x6f')](_0x9796('0xa6'),_0x1e7954[_0x9796('0x3f')]);}socket['to'](util[_0x9796('0x6f')](_0x9796('0xdf'),_0x1e7954[_0x9796('0x3f')]))[_0x9796('0xa1')](_0x9796('0xe0'),{'ip':_0x47cb8d[_0x9796('0xe1')][_0x9796('0xe2')]||_0x47cb8d['connection'][_0x9796('0xe3')]||_0x47cb8d[_0x9796('0xe4')][_0x9796('0xe3')]||_0x47cb8d[_0x9796('0xe5')][_0x9796('0xe4')]['remoteAddress']});return db[_0x9796('0xa9')][_0x9796('0x33')]({'where':{'membername':_0x1e7954[_0x9796('0x3f')]},'individualHooks':!![]});}}else{throw new db[(_0x9796('0x1d'))]['ValidationError'](_0x9796('0xe6'));}})[_0x9796('0x32')](function(){if(_0x1e7954){return _0x1e7954[_0x9796('0xe7')]({'raw':!![]});}})[_0x9796('0x32')](function(_0x40e68f){if(_0x1e7954){var _0x38462b=[];if(_0x40e68f){_0xed2747=_0x40e68f;if(_0xed2747[_0x9796('0x62')]){for(var _0x476d53=0x0;_0x476d53<_0xed2747['length'];_0x476d53++){_0x38462b[_0x9796('0xa5')]({'membername':_0x1e7954[_0x9796('0x3f')],'UserId':_0x1e7954['id'],'queue_name':_0xed2747[_0x476d53]['name'],'VoiceQueueId':_0xed2747[_0x476d53]['id'],'interface':_0x46e229,'paused':_0x1e7954[_0x9796('0x98')]||![],'penalty':_0xed2747[_0x476d53]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x9796('0xa8')](_0x38462b,function(_0xfc5619){return db['UserVoiceQueueRt']['upsert'](_0xfc5619);});}}}})[_0x9796('0x32')](function(){if(_0x1e7954){return db[_0x9796('0xe8')]['findAll']({'where':{'membername':_0x1e7954[_0x9796('0x3f')],'exitAt':null}});}})[_0x9796('0x32')](function(_0x870598){if(_0x1e7954){var _0x2a50f7=[];_0x870598['forEach'](function(_0x1ed859){_0x2a50f7[_0x9796('0xa5')](_0x1ed859['update']({'exitAt':moment()[_0x9796('0x6f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9796('0xe9')](_0x2a50f7);}})[_0x9796('0x32')](function(){if(_0x1e7954){var _0x1f34b8=[];var _0xc4a996=[];var _0x2f4038=utils[_0x9796('0xea')]();var _0x810c4c={'membername':_0x1e7954[_0x9796('0x3f')],'interface':_0x46e229,'enterAt':moment()[_0x9796('0x6f')](_0x9796('0xeb')),'role':_0x1e7954[_0x9796('0x3d')],'internal':_0x1e7954[_0x9796('0x71')]};_0x2f4038[_0x9796('0xec')](function(_0x28dfed){_0x1f34b8[_0x9796('0xa5')](_['merge']({'channel':_0x28dfed,'type':_0x9796('0xed'),'data1':_0x47cb8d['body']['device'],'data2':_0x46e229},_0x810c4c));if(_0x1e7954[_0x9796('0x98')]){_0xc4a996[_0x9796('0xa5')](_[_0x9796('0x5a')]({'channel':_0x28dfed,'type':_0x9796('0xee'),'data1':_0x9796('0xef')},_0x810c4c));}});return db[_0x9796('0xe8')][_0x9796('0x64')](_0x1f34b8[_0x9796('0xf0')](_0xc4a996),{'individualHooks':!![]});}})['then'](function(){if(_0x1e7954){return _0x1e7954[_0x9796('0x31')]({'online':!![],'lastLoginAt':moment()[_0x9796('0x6f')](_0x9796('0xeb')),'voicePause':_0x1e7954['loginInPause']||![],'mailPause':_0x1e7954['loginInPause']||![],'chatPause':_0x1e7954['loginInPause']||![],'faxPause':_0x1e7954['loginInPause']||![],'smsPause':_0x1e7954[_0x9796('0x98')]||![],'openchannelPause':_0x1e7954[_0x9796('0x98')]||![],'whatsappPause':_0x1e7954[_0x9796('0x98')]||![],'pauseType':_0x1e7954[_0x9796('0x98')]?_0x9796('0xef'):null,'interface':_0x46e229,'lastPauseAt':moment()[_0x9796('0x6f')](_0x9796('0xeb'))});}})['then'](function(_0x412a10){if(_0x47cb8d['isMiddleware']){return _0x46f43d();}else{return BPromise['resolve'](_0x412a10)[_0x9796('0x32')](respondWithResult(_0x8bd512,null));}})['catch'](handleError(_0x8bd512,null));};exports[_0x9796('0xf1')]=function(_0x21f067,_0x366c93,_0x4e4f75){var _0x15e005;return db[_0x9796('0x5c')][_0x9796('0x3e')]({'where':{'id':_0x21f067['params']['id'],'role':_0x9796('0x37')},'attributes':['id',_0x9796('0x3f'),_0x9796('0x3d')]})[_0x9796('0x32')](handleEntityNotFound(_0x366c93,null))[_0x9796('0x32')](function(_0x5664f3){if(_0x5664f3){_0x15e005=_0x5664f3;return db['UserVoiceQueueRt'][_0x9796('0x33')]({'where':{'membername':_0x15e005[_0x9796('0x3f')]},'individualHooks':!![]});}})[_0x9796('0x32')](function(){return db[_0x9796('0xe8')][_0x9796('0xc6')]({'where':{'membername':_0x15e005[_0x9796('0x3f')],'exitAt':null}});})['then'](function(_0x1ff854){var _0x50cb3c=[];_0x1ff854[_0x9796('0xec')](function(_0x6cc398){_0x50cb3c['push'](_0x6cc398[_0x9796('0x31')]({'exitAt':moment()[_0x9796('0x6f')](_0x9796('0xeb'))}));});return BPromise[_0x9796('0xe9')](_0x50cb3c);})[_0x9796('0x32')](function(){return _0x15e005[_0x9796('0x31')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x366c93,null))[_0x9796('0x28')](handleError(_0x366c93,null));};exports[_0x9796('0xf2')]=function(_0x3205b5,_0x371dc3,_0x145b9c){var _0x1bab2c;return db[_0x9796('0xa9')][_0x9796('0x31')]({'paused':0x1},{'where':{'UserId':_0x3205b5['params']['id']},'individualHooks':!![]})[_0x9796('0x32')](function(){return db[_0x9796('0x5c')][_0x9796('0x3e')]({'where':{'id':_0x3205b5[_0x9796('0x60')]['id'],'role':'agent'},'attributes':['id',_0x9796('0x3f'),_0x9796('0x3d'),_0x9796('0x71'),'interface']});})['then'](handleEntityNotFound(_0x371dc3,null))['then'](function(_0x28db4b){if(_0x28db4b){_0x1bab2c=_0x28db4b;return respondWithRpcPromise(_0x9796('0xf3'),_0x9796('0xf2'),{'id':_0x1bab2c['id'],'name':_0x1bab2c[_0x9796('0x3f')],'pause':!![]});}})[_0x9796('0x32')](function(){if(_0x1bab2c){return db[_0x9796('0xe8')][_0x9796('0xc6')]({'where':{'membername':_0x1bab2c['name'],'type':_0x9796('0xee'),'exitAt':null}});}})[_0x9796('0x32')](function(_0x7d46aa){if(_0x7d46aa[_0x9796('0x62')]){var _0x2b9ac2=moment()[_0x9796('0x6f')](_0x9796('0xeb'));for(var _0x1f1974=0x0,_0x4e8c22=_0x7d46aa['length'];_0x1f1974<_0x4e8c22;_0x1f1974++){_0x7d46aa[_0x1f1974][_0x9796('0xf4')]({'exitAt':_0x2b9ac2});}}})[_0x9796('0x32')](function(){var _0x1d4c2f=[];var _0x3269a5=utils[_0x9796('0xea')]();_0x3269a5[_0x9796('0xec')](function(_0x4e603c){_0x1d4c2f[_0x9796('0xa5')]({'channel':_0x4e603c,'membername':_0x1bab2c['name'],'interface':_[_0x9796('0x77')](_0x1bab2c[_0x9796('0x9a')])?util['format']('SIP/%s',_0x1bab2c[_0x9796('0x3f')]):_0x1bab2c[_0x9796('0x9a')],'type':_0x9796('0xee'),'enterAt':moment()[_0x9796('0x6f')](_0x9796('0xeb')),'data1':_0x3205b5[_0x9796('0x65')][_0x9796('0x45')]||_0x9796('0xf5'),'role':_0x1bab2c['role'],'internal':_0x1bab2c['internal']});});return db[_0x9796('0xe8')]['bulkCreate'](_0x1d4c2f,{'individualHooks':!![]});})[_0x9796('0x32')](function(){return _0x1bab2c[_0x9796('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3205b5[_0x9796('0x65')][_0x9796('0x45')]||_0x9796('0xf5'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x9796('0x32')](respondWithResult(_0x371dc3,null))[_0x9796('0x28')](handleError(_0x371dc3,null));};exports[_0x9796('0xf6')]=function(_0x4cdab2,_0x513597,_0x43f970){var _0x125a84;return db[_0x9796('0x5c')][_0x9796('0x3e')]({'where':{'id':_0x4cdab2[_0x9796('0x60')]['id']},'attributes':['id','name',_0x9796('0x3d'),_0x9796('0x99'),'mailPause','chatPause',_0x9796('0xf7'),'openchannelPause',_0x9796('0xf8'),_0x9796('0xf9'),_0x9796('0xfa'),_0x9796('0xfb')]})['then'](handleEntityNotFound(_0x513597,null))[_0x9796('0x32')](function(_0x242465){if(_0x242465){_0x125a84=_0x242465;if(_0x4cdab2[_0x9796('0x65')][_0x9796('0x96')]&&!utils[_0x9796('0x9b')](_0x4cdab2['body'][_0x9796('0x96')])){throw new db[(_0x9796('0x1d'))][(_0x9796('0x1e'))](_0x9796('0xc2'));}switch(_0x4cdab2[_0x9796('0x65')][_0x9796('0x96')]){case _0x9796('0xa3'):return respondWithRpcPromise(_0x9796('0xf3'),'unpause',{'id':_0x125a84['id'],'name':_0x125a84[_0x9796('0x3f')],'pause':![]})[_0x9796('0x32')](function(){return db['UserVoiceQueueRt'][_0x9796('0x31')]({'paused':0x0},{'where':{'UserId':_0x125a84['id']},'individualHooks':!![]});})[_0x9796('0x32')](function(){return db[_0x9796('0xe8')][_0x9796('0x3e')]({'where':{'channel':_0x4cdab2[_0x9796('0x65')][_0x9796('0x96')],'membername':_0x125a84['name'],'type':_0x9796('0xee'),'exitAt':null}});})[_0x9796('0x32')](function(_0x291c93){if(_0x291c93){return _0x291c93['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x9796('0x32')](function(){return _0x125a84[_0x9796('0x31')]({'voicePause':![]});});case _0x9796('0xfc'):case _0x9796('0xfd'):case _0x9796('0xfe'):case _0x9796('0xff'):case _0x9796('0x100'):case'openchannel':return db['MemberReport'][_0x9796('0x3e')]({'where':{'channel':_0x4cdab2[_0x9796('0x65')][_0x9796('0x96')],'membername':_0x125a84[_0x9796('0x3f')],'type':'PAUSE','exitAt':null}})[_0x9796('0x32')](function(_0x38db66){if(_0x38db66){return _0x38db66[_0x9796('0x31')]({'exitAt':moment()['format'](_0x9796('0xeb')),'data2':_0x9796('0x101')},{'individualHooks':!![]});}return null;})[_0x9796('0x32')](function(){var _0x339571={};_[_0x9796('0x2e')](_0x339571,util[_0x9796('0x6f')](_0x9796('0x102'),_0x4cdab2[_0x9796('0x65')]['channel'],'Pause'),![]);return _0x125a84['update'](_0x339571);});default:return respondWithRpcPromise(_0x9796('0xf3'),_0x9796('0xf6'),{'id':_0x125a84['id'],'name':_0x125a84['name'],'pause':![]})[_0x9796('0x32')](function(){return db[_0x9796('0xa9')][_0x9796('0x31')]({'paused':0x0},{'where':{'UserId':_0x125a84['id']}});})[_0x9796('0x32')](function(){return db[_0x9796('0xe8')][_0x9796('0xc6')]({'where':{'membername':_0x125a84[_0x9796('0x3f')],'type':_0x9796('0xee'),'exitAt':null}});})[_0x9796('0x32')](function(_0x27add4){var _0x1e37d1=[];_0x27add4[_0x9796('0xec')](function(_0x2dc888){_0x1e37d1[_0x9796('0xa5')](_0x2dc888[_0x9796('0x31')]({'exitAt':moment()[_0x9796('0x6f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9796('0x101')}));});return BPromise['all'](_0x1e37d1);})[_0x9796('0x32')](function(){return _0x125a84['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x9796('0x32')](respondWithResult(_0x513597,null))[_0x9796('0x28')](handleError(_0x513597,null));};exports[_0x9796('0x103')]=function(_0x4a5c05,_0x1fd195,_0x2cb1b8){var _0x18f892={};var _0x34f9b5={};var _0x15b08c;var _0x1701a0;return db[_0x9796('0x5c')]['findOne']({'where':{'id':_0x4a5c05['params']['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x1fd195,null))['then'](function(_0x30f077){if(_0x30f077){_0x15b08c=_0x30f077;_0x34f9b5[_0x9796('0x4d')]=_[_0x9796('0x61')](db[_0x9796('0x104')]['rawAttributes']);_0x34f9b5[_0x9796('0x4a')]=_['keys'](_0x4a5c05[_0x9796('0x4a')]);_0x34f9b5[_0x9796('0x4b')]=_[_0x9796('0x4c')](_0x34f9b5[_0x9796('0x4d')],_0x34f9b5[_0x9796('0x4a')]);_0x18f892[_0x9796('0x4e')]=_[_0x9796('0x4c')](_0x34f9b5[_0x9796('0x4d')],qs[_0x9796('0x4f')](_0x4a5c05[_0x9796('0x4a')]['fields']));_0x18f892[_0x9796('0x4e')]=_0x18f892[_0x9796('0x4e')][_0x9796('0x62')]?_0x18f892[_0x9796('0x4e')]:_0x34f9b5[_0x9796('0x4d')];_0x18f892[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x4a5c05[_0x9796('0x4a')][_0x9796('0xbc')]);_0x18f892[_0x9796('0x54')]=qs[_0x9796('0x4b')](_[_0x9796('0x55')](_0x4a5c05['query'],_0x34f9b5[_0x9796('0x4b')]));if(_0x4a5c05['query'][_0x9796('0x56')]){_0x18f892[_0x9796('0x54')]=_[_0x9796('0x5a')](_0x18f892[_0x9796('0x54')],{'$or':_[_0x9796('0x3a')](_0x18f892['attributes'],function(_0x19d0e5){var _0x2f73d5={};_0x2f73d5[_0x19d0e5]={'$like':'%'+_0x4a5c05[_0x9796('0x4a')][_0x9796('0x56')]+'%'};return _0x2f73d5;})});}_0x18f892=_[_0x9796('0x5a')]({},_0x18f892,_0x4a5c05[_0x9796('0x5b')]);return _0x15b08c[_0x9796('0x103')](_0x18f892);}})[_0x9796('0x32')](function(_0x2dfc3e){if(_0x2dfc3e){_0x1701a0=_0x2dfc3e[_0x9796('0x62')];if(!_0x4a5c05['query'][_0x9796('0x50')]('nolimit')){_0x18f892[_0x9796('0x52')]=qs['limit'](_0x4a5c05[_0x9796('0x4a')]['limit']);_0x18f892[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x4a5c05[_0x9796('0x4a')][_0x9796('0x2d')]);}return _0x15b08c[_0x9796('0x103')](_0x18f892);}})['then'](function(_0x51e6b3){if(_0x51e6b3){return _0x51e6b3?{'count':_0x1701a0,'rows':_0x51e6b3}:null;}})[_0x9796('0x32')](respondWithResult(_0x1fd195,null))[_0x9796('0x28')](handleError(_0x1fd195,null));};exports[_0x9796('0x105')]=function(_0x3ef20,_0x1fbc03){return db[_0x9796('0x5c')][_0x9796('0x3e')]({'where':{'id':_0x3ef20[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x1fbc03,null))[_0x9796('0x32')](function(_0x416949){if(_0x416949){var _0x2f3fd4=_0x416949[_0x9796('0x34')]({'plain':!![]});return _0x416949[_0x9796('0x105')](_0x3ef20[_0x9796('0x65')][_0x9796('0x68')],_[_0x9796('0x106')](_0x3ef20[_0x9796('0x65')],[_0x9796('0x68'),'id'])||{})['then'](function(){for(var _0x40ee0c=0x0;_0x40ee0c<_0x3ef20['body'][_0x9796('0x68')][_0x9796('0x62')];_0x40ee0c++){var _0xb86eb3=[];db[_0x9796('0x104')][_0x9796('0x8e')]({'where':{'id':_0x3ef20[_0x9796('0x65')]['ids'][_0x40ee0c]}})[_0x9796('0x32')](function(_0x118c0e){_0xb86eb3[_0x9796('0xa5')](_0x118c0e[_0x9796('0xe7')]()[_0x9796('0x32')](function(_0x1ab223){for(var _0x35f65b=0x0;_0x35f65b<_0x1ab223[_0x9796('0x62')];_0x35f65b++){_0x1ab223[_0x35f65b][_0x9796('0x107')](_0x9796('0x96'),'Voice');}return _0x1ab223;}));_0xb86eb3[_0x9796('0xa5')](_0x118c0e[_0x9796('0x108')]()['then'](function(_0x4d300){for(var _0x3ff426=0x0;_0x3ff426<_0x4d300[_0x9796('0x62')];_0x3ff426++){_0x4d300[_0x3ff426]['setDataValue'](_0x9796('0x96'),_0x9796('0x109'));}return _0x4d300;}));_0xb86eb3['push'](_0x118c0e[_0x9796('0x10a')]()['then'](function(_0x917f0){for(var _0x5a26a5=0x0;_0x5a26a5<_0x917f0[_0x9796('0x62')];_0x5a26a5++){_0x917f0[_0x5a26a5][_0x9796('0x107')]('channel',_0x9796('0x10b'));}return _0x917f0;}));_0xb86eb3[_0x9796('0xa5')](_0x118c0e[_0x9796('0x10c')]()['then'](function(_0x35f3eb){for(var _0x3d18a1=0x0;_0x3d18a1<_0x35f3eb['length'];_0x3d18a1++){_0x35f3eb[_0x3d18a1][_0x9796('0x107')]('channel',_0x9796('0x10d'));}return _0x35f3eb;}));_0xb86eb3['push'](_0x118c0e[_0x9796('0x10e')]()[_0x9796('0x32')](function(_0x4251b9){for(var _0x2108e4=0x0;_0x2108e4<_0x4251b9[_0x9796('0x62')];_0x2108e4++){_0x4251b9[_0x2108e4][_0x9796('0x107')](_0x9796('0x96'),_0x9796('0x10f'));}return _0x4251b9;}));_0xb86eb3[_0x9796('0xa5')](_0x118c0e[_0x9796('0x110')]()[_0x9796('0x32')](function(_0x372262){for(var _0x109006=0x0;_0x109006<_0x372262[_0x9796('0x62')];_0x109006++){_0x372262[_0x109006][_0x9796('0x107')](_0x9796('0x96'),_0x9796('0x111'));}return _0x372262;}));_0xb86eb3[_0x9796('0xa5')](_0x118c0e[_0x9796('0x112')]()[_0x9796('0x32')](function(_0x144c63){for(var _0x186262=0x0;_0x186262<_0x144c63[_0x9796('0x62')];_0x186262++){_0x144c63[_0x186262]['setDataValue'](_0x9796('0x96'),_0x9796('0x113'));}return _0x144c63;}));return BPromise[_0x9796('0xe9')](_0xb86eb3);})[_0x9796('0x32')](function(_0x5b29a6){var _0x51a375=_[_0x9796('0x114')](_0x5b29a6);_0xb86eb3=[];return db[_0x9796('0x59')][_0x9796('0x115')](function(_0x5e8b13){for(var _0x44e353=0x0;_0x44e353<_0x51a375[_0x9796('0x62')];_0x44e353++){_0xb86eb3[_0x9796('0xa5')](_0x51a375[_0x44e353][_0x9796('0x116')](_0x2f3fd4['id']),{'transaction':_0x5e8b13});}return BPromise[_0x9796('0xe9')](_0xb86eb3)['then'](function(){if(_0x2f3fd4['online']){return BPromise[_0x9796('0xa8')](_[_0x9796('0x56')](_0x51a375,function(_0x5df0ad){return _0x5df0ad[_0x9796('0x117')](_0x9796('0x96'))===_0x9796('0x118');}),function(_0xe7a5be){return db[_0x9796('0xa9')][_0x9796('0xaa')]({'membername':_0x2f3fd4['name'],'UserId':_0x2f3fd4['id'],'queue_name':_0xe7a5be[_0x9796('0x3f')],'VoiceQueueId':_0xe7a5be['id'],'interface':_[_0x9796('0x77')](_0x2f3fd4[_0x9796('0x9a')])?util[_0x9796('0x6f')](_0x9796('0xa6'),_0x2f3fd4['name']):_0x2f3fd4[_0x9796('0x9a')],'paused':_0x2f3fd4['voicePause']||![],'penalty':_0x2f3fd4['penalty']},{'transaction':_0x5e8b13});});}else{return;}})[_0x9796('0x32')](function(){for(var _0x180da0=0x0;_0x180da0<_0x51a375[_0x9796('0x62')];_0x180da0++){var _0x1dffbb=_0x51a375[_0x180da0]['getDataValue'](_0x9796('0x96'));var _0x14d269=_0x1dffbb+_0x9796('0xad');socket['emit'](_0x9796('0x35')+_0x1dffbb+_0x9796('0xa2'),{'UserId':_0x2f3fd4['id'],['queueField']:_0x51a375[_0x180da0]['id']});}});});});}});}})[_0x9796('0x32')](respondWithStatusCode(_0x1fbc03,null))['catch'](handleError(_0x1fbc03,null));};exports[_0x9796('0x119')]=function(_0x161bbb,_0x43de6d){return db['User'][_0x9796('0x8e')]({'where':{'id':_0x161bbb[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x43de6d,null))[_0x9796('0x32')](function(_0x541072){if(_0x541072){var _0x5067d3=_0x541072[_0x9796('0x34')]({'plain':!![]});var _0x128f60=_0x161bbb[_0x9796('0x4a')][_0x9796('0x68')];return _0x541072[_0x9796('0x119')](_0x128f60)[_0x9796('0x32')](function(){for(var _0x17a18c=0x0;_0x17a18c<_0x128f60['length'];_0x17a18c++){var _0xeef095=[];db['Team'][_0x9796('0x8e')]({'where':{'id':_0x128f60[_0x17a18c]}})[_0x9796('0x32')](function(_0x428af4){_0xeef095['push'](_0x428af4[_0x9796('0xe7')]()[_0x9796('0x32')](function(_0x5f0c81){for(var _0x515c58=0x0;_0x515c58<_0x5f0c81[_0x9796('0x62')];_0x515c58++){_0x5f0c81[_0x515c58][_0x9796('0x107')](_0x9796('0x96'),'Voice');}return _0x5f0c81;}));_0xeef095[_0x9796('0xa5')](_0x428af4[_0x9796('0x108')]()['then'](function(_0x3a9b7c){for(var _0x4a9c0f=0x0;_0x4a9c0f<_0x3a9b7c['length'];_0x4a9c0f++){_0x3a9b7c[_0x4a9c0f][_0x9796('0x107')](_0x9796('0x96'),_0x9796('0x109'));}return _0x3a9b7c;}));_0xeef095[_0x9796('0xa5')](_0x428af4['getMailQueues']()[_0x9796('0x32')](function(_0x3d421b){for(var _0x474bed=0x0;_0x474bed<_0x3d421b[_0x9796('0x62')];_0x474bed++){_0x3d421b[_0x474bed][_0x9796('0x107')](_0x9796('0x96'),_0x9796('0x10b'));}return _0x3d421b;}));_0xeef095[_0x9796('0xa5')](_0x428af4['getSmsQueues']()[_0x9796('0x32')](function(_0x5ca08e){for(var _0x385593=0x0;_0x385593<_0x5ca08e[_0x9796('0x62')];_0x385593++){_0x5ca08e[_0x385593]['setDataValue'](_0x9796('0x96'),_0x9796('0x10d'));}return _0x5ca08e;}));_0xeef095[_0x9796('0xa5')](_0x428af4[_0x9796('0x10e')]()[_0x9796('0x32')](function(_0x3c0c56){for(var _0x1c3b35=0x0;_0x1c3b35<_0x3c0c56[_0x9796('0x62')];_0x1c3b35++){_0x3c0c56[_0x1c3b35][_0x9796('0x107')](_0x9796('0x96'),_0x9796('0x10f'));}return _0x3c0c56;}));_0xeef095[_0x9796('0xa5')](_0x428af4[_0x9796('0x110')]()[_0x9796('0x32')](function(_0x497474){for(var _0x1a9756=0x0;_0x1a9756<_0x497474[_0x9796('0x62')];_0x1a9756++){_0x497474[_0x1a9756]['setDataValue'](_0x9796('0x96'),_0x9796('0x111'));}return _0x497474;}));_0xeef095['push'](_0x428af4[_0x9796('0x112')]()['then'](function(_0x328439){for(var _0x542357=0x0;_0x542357<_0x328439[_0x9796('0x62')];_0x542357++){_0x328439[_0x542357]['setDataValue'](_0x9796('0x96'),_0x9796('0x113'));}return _0x328439;}));return BPromise[_0x9796('0xe9')](_0xeef095);})['then'](function(_0x1d9448){var _0x459a9e=_[_0x9796('0x114')](_0x1d9448);_0xeef095=[];return db[_0x9796('0x59')][_0x9796('0x115')](function(_0x1f9160){for(var _0x3363e7=0x0;_0x3363e7<_0x459a9e['length'];_0x3363e7++){_0xeef095[_0x9796('0xa5')](_0x459a9e[_0x3363e7][_0x9796('0x11a')](_0x5067d3['id']),{'transaction':_0x1f9160});}return BPromise[_0x9796('0xe9')](_0xeef095)['then'](function(){if(_0x5067d3[_0x9796('0x97')]){return BPromise['each'](_[_0x9796('0x56')](_0x459a9e,function(_0x4c813b){return _0x4c813b[_0x9796('0x117')]('channel')===_0x9796('0x118');}),function(_0xb334f6){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xb334f6['id'],'UserId':_0x5067d3['id']},'transaction':_0x1f9160});});}else{return;}})[_0x9796('0x32')](function(){for(var _0x54ea9f=0x0;_0x54ea9f<_0x459a9e[_0x9796('0x62')];_0x54ea9f++){var _0x1f1344=_0x459a9e[_0x54ea9f][_0x9796('0x117')](_0x9796('0x96'));var _0x3463ea=_0x1f1344+'QueueId';socket[_0x9796('0xa1')](_0x9796('0x35')+_0x1f1344+_0x9796('0xae'),{'UserId':_0x5067d3['id'],['queueField']:_0x459a9e[_0x54ea9f]['id']});}});});});}});}})[_0x9796('0x32')](respondWithStatusCode(_0x43de6d,null))[_0x9796('0x28')](handleError(_0x43de6d,null));};exports[_0x9796('0x11b')]=function(_0x42a555,_0x2916c0,_0x5a8893){var _0x392617={};var _0x3d22d3={};var _0x3ba883;var _0x14c956;return db['User'][_0x9796('0x8e')]({'where':{'id':_0x42a555[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x2916c0,null))['then'](function(_0x56558c){if(_0x56558c){_0x3ba883=_0x56558c;_0x3d22d3['model']=_[_0x9796('0x61')](db['CmList'][_0x9796('0x43')]);_0x3d22d3[_0x9796('0x4a')]=_[_0x9796('0x61')](_0x42a555[_0x9796('0x4a')]);_0x3d22d3['filters']=_[_0x9796('0x4c')](_0x3d22d3[_0x9796('0x4d')],_0x3d22d3[_0x9796('0x4a')]);_0x392617['attributes']=_[_0x9796('0x4c')](_0x3d22d3[_0x9796('0x4d')],qs[_0x9796('0x4f')](_0x42a555[_0x9796('0x4a')][_0x9796('0x4f')]));_0x392617['attributes']=_0x392617[_0x9796('0x4e')][_0x9796('0x62')]?_0x392617[_0x9796('0x4e')]:_0x3d22d3[_0x9796('0x4d')];_0x392617[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x42a555[_0x9796('0x4a')][_0x9796('0xbc')]);_0x392617['where']=qs[_0x9796('0x4b')](_[_0x9796('0x55')](_0x42a555[_0x9796('0x4a')],_0x3d22d3[_0x9796('0x4b')]));if(_0x42a555['query'][_0x9796('0x56')]){_0x392617[_0x9796('0x54')]=_[_0x9796('0x5a')](_0x392617[_0x9796('0x54')],{'$or':_[_0x9796('0x3a')](_0x392617[_0x9796('0x4e')],function(_0x375e0c){var _0x51718c={};_0x51718c[_0x375e0c]={'$like':'%'+_0x42a555['query'][_0x9796('0x56')]+'%'};return _0x51718c;})});}_0x392617=_[_0x9796('0x5a')]({},_0x392617,_0x42a555['options']);return _0x3ba883[_0x9796('0x11b')](_0x392617);}})[_0x9796('0x32')](function(_0x9fe2ed){if(_0x9fe2ed){_0x14c956=_0x9fe2ed['length'];if(!_0x42a555[_0x9796('0x4a')][_0x9796('0x50')](_0x9796('0x51'))){_0x392617[_0x9796('0x52')]=qs[_0x9796('0x52')](_0x42a555['query'][_0x9796('0x52')]);_0x392617[_0x9796('0x2d')]=qs[_0x9796('0x2d')](_0x42a555[_0x9796('0x4a')][_0x9796('0x2d')]);}return _0x3ba883[_0x9796('0x11b')](_0x392617);}})[_0x9796('0x32')](function(_0x441d5a){if(_0x441d5a){return _0x441d5a?{'count':_0x14c956,'rows':_0x441d5a}:null;}})[_0x9796('0x32')](respondWithResult(_0x2916c0,null))[_0x9796('0x28')](handleError(_0x2916c0,null));};exports[_0x9796('0x11c')]=function(_0x4a9879,_0x552503,_0x45821a){var _0x49933e={};var _0x558bc8={};var _0x33a820;var _0x56b844;return db[_0x9796('0x5c')][_0x9796('0x8e')]({'where':{'id':_0x4a9879[_0x9796('0x60')]['id']}})[_0x9796('0x32')](handleEntityNotFound(_0x552503,null))[_0x9796('0x32')](function(_0x260596){if(_0x260596){_0x33a820=_0x260596;_0x558bc8[_0x9796('0x4d')]=_[_0x9796('0x61')](db['User'][_0x9796('0x43')]);_0x558bc8[_0x9796('0x4a')]=_[_0x9796('0x61')](_0x4a9879[_0x9796('0x4a')]);_0x558bc8[_0x9796('0x4b')]=_[_0x9796('0x4c')](_0x558bc8[_0x9796('0x4d')],_0x558bc8[_0x9796('0x4a')]);_0x49933e[_0x9796('0x4e')]=_[_0x9796('0x4c')](_0x558bc8[_0x9796('0x4d')],qs[_0x9796('0x4f')](_0x4a9879['query'][_0x9796('0x4f')]));_0x49933e['attributes']=_0x49933e[_0x9796('0x4e')][_0x9796('0x62')]?_0x49933e[_0x9796('0x4e')]:_0x558bc8[_0x9796('0x4d')];_0x49933e[_0x9796('0x53')]=qs[_0x9796('0xbc')](_0x4a9879['query'][_0x9796('0xbc')]);_0x49933e['where']=qs[_0x9796('0x4b')](_[_0x9796('0x55')](_0x4a9879[_0x9796('0x4a')],_0x558bc8['filters']));if(_0x4a9879[_0x9796('0x4a')]['filter']){_0x49933e['where']=_[_0x9796('0x5a')](_0x49933e[_0x9796('0x54')],{'$or':_[_0x9796('0x3a')](_0x49933e[_0x9796('0x4e')],function(_0x43e66a){var _0x4801b9={};_0x4801b9[_0x43e66a]={'$like':'%'+_0x4a9879[_0x9796('0x4a')][_0x9796('0x56')]+'%'};return _0x4801b9;})});}_0x49933e[_0x9796('0x4d')]=db['User'];_0x49933e['as']=_0x9796('0x36');_0x49933e=_[_0x9796('0x5a')]({},_0x49933e,_0x4a9879['options']);return _0x33a820['getVoiceQueues']({'include':[_0x49933e]});}})[_0x9796('0x32')](function(_0x30eb11){if(_0x30eb11){var _0x6c1b42={},_0x3b3ca4=[],_0x4e4f05=0x0;for(var _0x2ba44e=0x0;_0x2ba44e<_0x30eb11[_0x9796('0x62')];_0x2ba44e+=0x1){for(var _0x75884a=0x0,_0x94c6aa;_0x75884a<_0x30eb11[_0x2ba44e][_0x9796('0x36')][_0x9796('0x62')];_0x75884a+=0x1){_0x94c6aa=_0x30eb11[_0x2ba44e]['Agents'][_0x75884a][_0x9796('0x34')]({'plain':!![]});_0x6c1b42[_0x94c6aa['id']]=_0x94c6aa;}}_0x6c1b42=_['values'](_0x6c1b42);for(var _0x1a1cac=qs[_0x9796('0x2d')](_0x4a9879[_0x9796('0x4a')]['offset']);_0x1a1cac<_0x6c1b42['length']&&_0x3b3ca4['length']=_0xd3a8a3){_0x2b01e5=_0xd3a8a3;_0x3c55cc=0xc8;}else{_0x3c55cc=0xce;}_0x42cc46[_0xdb2a('0x26')](_0x3c55cc);return _0x42cc46[_0xdb2a('0x2c')](_0xdb2a('0x2d'),_0x134053+'-'+_0x2b01e5+'/'+_0xd3a8a3)[_0xdb2a('0x28')](_0x65b6c3);}return null;};}function patchUpdates(_0x1f033b){return function(_0x1053d0){try{jsonpatch[_0xdb2a('0x2e')](_0x1053d0,_0x1f033b,!![]);}catch(_0x506e1c){return BPromise[_0xdb2a('0x2f')](_0x506e1c);}return _0x1053d0[_0xdb2a('0x30')]();};}function saveUpdates(_0x36f9f7,_0x4a29e8){return function(_0x49ec05){if(_0x49ec05){return _0x49ec05[_0xdb2a('0x31')](_0x36f9f7)[_0xdb2a('0x32')](function(_0xac01e9){return _0xac01e9;});}return null;};}function removeEntity(_0x3bc30f,_0x234dc5){return function(_0x3f9110){if(_0x3f9110){return _0x3f9110[_0xdb2a('0x33')]()[_0xdb2a('0x32')](function(){var _0x185297=_0x3f9110[_0xdb2a('0x34')]({'plain':!![]});var _0x15e9db=[{'name':_0xdb2a('0x35'),'value':_0xdb2a('0x36'),'ignore':!![]},{'name':_0xdb2a('0x37'),'value':'agent','ignore':![]},{'name':_0xdb2a('0x38'),'value':'telephone','ignore':![]}];var _0x52f058=_(_0x15e9db)[_0xdb2a('0x39')](_0xdb2a('0x3a'))[_0xdb2a('0x3b')](_0xdb2a('0x3c'))[_0xdb2a('0x3c')]();if(_['includes'](_0x52f058,_0x185297['role'])){return;}var _0x472170=_['find'](_0x15e9db,['value',_0x185297[_0xdb2a('0x3d')]])[_0xdb2a('0x3e')];return db[_0xdb2a('0x3f')]['destroy']({'where':{'type':_0x472170,'resourceId':_0x185297['id']}})[_0xdb2a('0x32')](function(){return _0x3f9110;});})[_0xdb2a('0x32')](function(){_0x3bc30f[_0xdb2a('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ad7eb,_0x3dc539){return function(_0x4604af){if(!_0x4604af){_0x1ad7eb[_0xdb2a('0x25')](0x194);}return _0x4604af;};}function handleError(_0x1efcf8,_0x43ca76){_0x43ca76=_0x43ca76||0x1f4;return function(_0x1c3768){logger['error'](_0x1c3768[_0xdb2a('0x40')]);if(_0x1c3768[_0xdb2a('0x3e')]){delete _0x1c3768[_0xdb2a('0x3e')];}_0x1efcf8[_0xdb2a('0x26')](_0x43ca76)['send'](_0x1c3768);};}exports[_0xdb2a('0x41')]=function(_0xb7777e,_0x56e67f){var _0x44d762={},_0x39c387={},_0x1cb36e={'count':0x0,'rows':[]};var _0x232885=_['map'](db['User']['rawAttributes'],function(_0x2e56b6){return{'name':_0x2e56b6[_0xdb2a('0x42')],'type':_0x2e56b6[_0xdb2a('0x43')]['key']};});_0x39c387['model']=_['differenceBy'](_[_0xdb2a('0x3b')](_0x232885,'name'),[_0xdb2a('0x44'),_0xdb2a('0x45')]);_0x39c387[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0xb7777e['query']);_0x39c387[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0x39c387[_0xdb2a('0x4a')],_0x39c387['query']);_0x44d762[_0xdb2a('0x4b')]=_[_0xdb2a('0x49')](_0x39c387[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0xb7777e['query'][_0xdb2a('0x4c')]));_0x44d762['attributes']=_0x44d762[_0xdb2a('0x4b')]['length']?_0x44d762['attributes']:_0x39c387[_0xdb2a('0x4a')];if(!_0xb7777e[_0xdb2a('0x46')][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x44d762[_0xdb2a('0x2b')]=qs[_0xdb2a('0x2b')](_0xb7777e[_0xdb2a('0x46')]['limit']);_0x44d762[_0xdb2a('0x2a')]=qs[_0xdb2a('0x2a')](_0xb7777e[_0xdb2a('0x46')][_0xdb2a('0x2a')]);}_0x44d762['order']=qs[_0xdb2a('0x4f')](_0xb7777e[_0xdb2a('0x46')]['sort']);_0x44d762[_0xdb2a('0x50')]=qs[_0xdb2a('0x48')](_[_0xdb2a('0x51')](_0xb7777e[_0xdb2a('0x46')],_0x39c387['filters']),_0x232885);if(_0xb7777e['query'][_0xdb2a('0x39')]){_0x44d762['where']=_[_0xdb2a('0x52')](_0x44d762['where'],{'$or':_[_0xdb2a('0x3b')](_0x232885,function(_0x351393){if(_0x351393[_0xdb2a('0x43')]!=='VIRTUAL'){return db[_0xdb2a('0x53')][_0xdb2a('0x50')](db[_0xdb2a('0x53')]['fn']('lower',db[_0xdb2a('0x53')]['col'](_0x351393[_0xdb2a('0x3e')])),{'$like':db[_0xdb2a('0x53')]['fn']('lower','%'+_0xb7777e[_0xdb2a('0x46')][_0xdb2a('0x39')]+'%')});}})});}_0x44d762=_[_0xdb2a('0x52')]({},_0x44d762,_0xb7777e[_0xdb2a('0x54')]);var _0x4ef3bb={'where':_0x44d762[_0xdb2a('0x50')]};return db[_0xdb2a('0x55')][_0xdb2a('0x29')](_0x4ef3bb)[_0xdb2a('0x32')](function(_0x43def4){_0x1cb36e[_0xdb2a('0x29')]=_0x43def4;if(_0xb7777e[_0xdb2a('0x46')][_0xdb2a('0x56')]){_0x44d762['include']=[{'all':!![]}];}return db['User'][_0xdb2a('0x57')](_0x44d762);})[_0xdb2a('0x32')](function(_0x182733){_0x1cb36e[_0xdb2a('0x58')]=_0x182733;return _0x1cb36e;})[_0xdb2a('0x32')](respondWithFilteredResult(_0x56e67f,_0x44d762))[_0xdb2a('0x24')](handleError(_0x56e67f,null));};exports[_0xdb2a('0x59')]=function(_0x46def4,_0x41ec8d){var _0x18ef8a={'raw':![],'where':{'id':_0x46def4[_0xdb2a('0x5a')]['id']}},_0x141c03={};_0x141c03[_0xdb2a('0x4a')]=_[_0xdb2a('0x5b')](_['keys'](db[_0xdb2a('0x55')][_0xdb2a('0x5c')]),[_0xdb2a('0x44'),_0xdb2a('0x45')]);_0x141c03['query']=_[_0xdb2a('0x47')](_0x46def4[_0xdb2a('0x46')]);_0x141c03[_0xdb2a('0x48')]=_['intersection'](_0x141c03[_0xdb2a('0x4a')],_0x141c03['query']);_0x18ef8a['attributes']=_['intersection'](_0x141c03[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x46def4[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x18ef8a[_0xdb2a('0x4b')]=_0x18ef8a[_0xdb2a('0x4b')]['length']?_0x18ef8a['attributes']:_0x141c03['model'];if(_0x46def4[_0xdb2a('0x46')][_0xdb2a('0x56')]){_0x18ef8a['include']=[{'all':!![]}];}_0x18ef8a=_[_0xdb2a('0x52')]({},_0x18ef8a,_0x46def4['options']);return db['User'][_0xdb2a('0x5d')](_0x18ef8a)[_0xdb2a('0x32')](handleEntityNotFound(_0x41ec8d,null))[_0xdb2a('0x32')](respondWithResult(_0x41ec8d,null))[_0xdb2a('0x24')](handleError(_0x41ec8d,null));};exports[_0xdb2a('0x5e')]=function(_0x51a6b6,_0x5a8773){return db[_0xdb2a('0x55')][_0xdb2a('0x5e')](_0x51a6b6[_0xdb2a('0x5f')],{'raw':![],'individualHooks':!![]})[_0xdb2a('0x32')](respondWithResult(_0x5a8773,0xc9))[_0xdb2a('0x24')](handleError(_0x5a8773,null));};exports[_0xdb2a('0x31')]=function(_0x2cfc49,_0x36d655){if(_0x2cfc49[_0xdb2a('0x5f')]['id']){delete _0x2cfc49[_0xdb2a('0x5f')]['id'];}delete _0x2cfc49[_0xdb2a('0x5f')]['role'];return db['User'][_0xdb2a('0x5d')]({'where':{'id':_0x2cfc49[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x36d655,null))[_0xdb2a('0x32')](saveUpdates(_0x2cfc49[_0xdb2a('0x5f')],null))['then'](respondWithResult(_0x36d655,null))[_0xdb2a('0x24')](handleError(_0x36d655,null));};exports[_0xdb2a('0x60')]=function(_0x1eeeb3,_0x38a241){return db[_0xdb2a('0x55')][_0xdb2a('0x60')]()[_0xdb2a('0x32')](respondWithResult(_0x38a241,null))[_0xdb2a('0x24')](handleError(_0x38a241,null));};exports[_0xdb2a('0x61')]=function(_0x3416d6,_0x2d7448,_0x43825a){return db[_0xdb2a('0x55')][_0xdb2a('0x5d')]({'where':{'id':_0x3416d6[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x2d7448,null))[_0xdb2a('0x32')](function(_0x3aff54){if(_0x3aff54){return _0x3aff54[_0xdb2a('0x61')](_0x3416d6[_0xdb2a('0x5f')][_0xdb2a('0x62')],_[_0xdb2a('0x63')](_0x3416d6[_0xdb2a('0x5f')],[_0xdb2a('0x62'),'id'])||{});}})[_0xdb2a('0x32')](respondWithResult(_0x2d7448,null))[_0xdb2a('0x24')](handleError(_0x2d7448,null));};var getLicense=function(_0x423136){return new BPromise(function(_0x7a9589,_0x503010){var _0x332c4d=0x0;_0x423136[_0xdb2a('0x5f')][_0xdb2a('0x3d')]==='agent'&&_0x7a9589(_0xdb2a('0x64'));return db[_0xdb2a('0x55')][_0xdb2a('0x29')]({'where':{'$or':[{'role':_0x423136[_0xdb2a('0x5f')]['role']==='telephone'?_0xdb2a('0x65'):[_0xdb2a('0x66'),_0xdb2a('0x36')]}]}})[_0xdb2a('0x32')](function(_0x77f45){_0x332c4d=_0x77f45;return require(_0xdb2a('0x67'))[_0xdb2a('0x68')]();})[_0xdb2a('0x32')](function(_0x59d183){var _0x4c3d51=_0x423136[_0xdb2a('0x5f')][_0xdb2a('0x3d')]===_0xdb2a('0x65')?_0xdb2a('0x69'):_0xdb2a('0x6a');if(!_['isNil'](_0x59d183[_0x4c3d51])&&_0x332c4d>=_0x59d183[_0x4c3d51]){return _0x503010({'message':'License\x20limit\x20reached'});}return _0x7a9589(util[_0xdb2a('0x6b')](_0xdb2a('0x6c'),_0x4c3d51,_0x332c4d));})[_0xdb2a('0x24')](function(_0x4605d3){return _0x503010(_0x4605d3);});});};exports[_0xdb2a('0x6d')]=function(_0xffe016,_0x238f54){return getLicense(_0xffe016)[_0xdb2a('0x32')](function(_0x34d509){if(!_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x6e')]){var _0x463d42;return db[_0xdb2a('0x6f')][_0xdb2a('0x70')](0x1)[_0xdb2a('0x32')](function(_0x2deeff){return checkPasswordPattern(_0x2deeff,_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x44')],_0x2deeff[_0xdb2a('0x71')]);})['then'](function(_0x963a9e){_0x463d42=_0x963a9e[_0xdb2a('0x72')];return db['User'][_0xdb2a('0x73')](_0xdb2a('0x6e'));})[_0xdb2a('0x32')](function(_0x457e9d){if(_[_0xdb2a('0x74')](_0x457e9d)){if(_0x463d42){_0xffe016['body'][_0xdb2a('0x6e')]=_0x463d42;}else{_0xffe016['body'][_0xdb2a('0x6e')]=0x1;}}else{if(_['isNil'](_0x463d42)||_0x463d42==_0x457e9d){_0xffe016['body'][_0xdb2a('0x6e')]=_0x457e9d+0x1;}else if(_0x463d42>_0x457e9d){_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x6e')]=_0x463d42;}else{return db['sequelize']['query'](_0xdb2a('0x75'),{'type':db[_0xdb2a('0x53')]['QueryTypes'][_0xdb2a('0x76')]})['then'](function(_0x32004a){if(_0x32004a&&_0x32004a[_0xdb2a('0x77')]){for(var _0x2a29c6=0x0,_0x31d292=_0x32004a[_0xdb2a('0x77')];_0x2a29c6<_0x31d292&&_[_0xdb2a('0x74')](_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x6e')]);_0x2a29c6++){if(_0x463d42<=_0x32004a[_0x2a29c6]['from']){_0xffe016['body'][_0xdb2a('0x6e')]=_0x32004a[_0x2a29c6][_0xdb2a('0x78')];}else if(_0x463d42>_0x32004a[_0x2a29c6][_0xdb2a('0x78')]&&_0x463d42<=_0x32004a[_0x2a29c6]['to']){_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x6e')]=_0x463d42;}}}if(_[_0xdb2a('0x74')](_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x6e')])){_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x6e')]=_0x457e9d+0x1;}});}}});}})['then'](function(){if(_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x79')]){_0xffe016[_0xdb2a('0x5f')]['mailbox']=_0xffe016['body'][_0xdb2a('0x6e')];_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x7a')]={'mailbox':_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x6e')],'password':_0xffe016['body'][_0xdb2a('0x44')],'fullname':_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x7b')],'email':_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x7c')]};}if(_0xffe016[_0xdb2a('0x5f')]&&_0xffe016['body'][_0xdb2a('0x3d')]==='agent'){if(!_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x7d')]){_0xffe016[_0xdb2a('0x5f')]['permissions']=['101','102','103',_0xdb2a('0x7e'),_0xdb2a('0x7f'),_0xdb2a('0x80'),_0xdb2a('0x81'),_0xdb2a('0x82'),'107',_0xdb2a('0x83'),_0xdb2a('0x84'),_0xdb2a('0x85'),_0xdb2a('0x86'),_0xdb2a('0x87')];}}return db[_0xdb2a('0x55')][_0xdb2a('0x6d')](_0xffe016[_0xdb2a('0x5f')],{'include':[{'model':db[_0xdb2a('0x7a')],'as':'VoiceMail'}]});})[_0xdb2a('0x32')](function(_0x181c68){if(_0xffe016[_0xdb2a('0x5f')][_0xdb2a('0x3d')]==='user')return _0x181c68;var _0x3f57a4=_0xffe016[_0xdb2a('0x36')][_0xdb2a('0x34')]({'plain':!![]});if(!_0x3f57a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f57a4['role']===_0xdb2a('0x36')){var _0xf27dc0=_0x181c68[_0xdb2a('0x34')]({'plain':!![]});var _0x536441=[{'name':'Agents','value':_0xdb2a('0x88')},{'name':'Telephones','value':_0xdb2a('0x65')}];var _0x407317=_[_0xdb2a('0x5d')](_0x536441,['value',_0xf27dc0[_0xdb2a('0x3d')]])[_0xdb2a('0x3e')];return db['UserProfileSection']['find']({'where':{'name':_0x407317,'userProfileId':_0x3f57a4[_0xdb2a('0x89')]},'raw':!![]})[_0xdb2a('0x32')](function(_0x18b838){if(_0x18b838&&_0x18b838[_0xdb2a('0x8a')]===0x0){return db[_0xdb2a('0x3f')][_0xdb2a('0x6d')]({'name':_0xf27dc0[_0xdb2a('0x3e')],'resourceId':_0xf27dc0['id'],'type':_0x18b838[_0xdb2a('0x3e')],'sectionId':_0x18b838['id']},{})[_0xdb2a('0x32')](function(){return _0x181c68;});}else{return _0x181c68;}})[_0xdb2a('0x24')](function(_0x1636ff){logger[_0xdb2a('0x21')](_0xdb2a('0x8b'),_0x1636ff);throw _0x1636ff;});}return _0x181c68;})[_0xdb2a('0x32')](respondWithResult(_0x238f54,0xc9))['catch'](handleError(_0x238f54,null));};exports[_0xdb2a('0x8c')]=function(_0x11210d,_0xf818bd,_0x245913){var _0x47527e=![];if(_0x11210d[_0xdb2a('0x5f')]['id']){delete _0x11210d[_0xdb2a('0x5f')]['id'];}return db[_0xdb2a('0x6f')][_0xdb2a('0x8d')]({'attributes':['id',_0xdb2a('0x71')]})[_0xdb2a('0x32')](function(_0x4aa613){_0x47527e=_0x4aa613['securePassword'];return db['User']['find']({'where':{'id':_0x11210d['params']['id']}});})[_0xdb2a('0x32')](function(_0x31c1eb){if(_0x31c1eb){if(_0x31c1eb['id']==_0x11210d[_0xdb2a('0x36')]['id']){if(!_0x11210d[_0xdb2a('0x5f')][_0xdb2a('0x8e')]||!_0x11210d['body']['newPassword']){throw new db[(_0xdb2a('0x8f'))][(_0xdb2a('0x90'))](_0xdb2a('0x91'));}if(!_0x31c1eb[_0xdb2a('0x92')](_0x11210d['body'][_0xdb2a('0x8e')])){throw new db['Sequelize']['ValidationError'](_0xdb2a('0x93'));}if(_0x11210d[_0xdb2a('0x5f')][_0xdb2a('0x8e')]==_0x11210d[_0xdb2a('0x5f')][_0xdb2a('0x94')]){throw new db[(_0xdb2a('0x8f'))][(_0xdb2a('0x90'))](_0xdb2a('0x95'));}return _0x31c1eb;}else if(_0x11210d[_0xdb2a('0x36')][_0xdb2a('0x3d')]==_0xdb2a('0x66')){if(!_0x11210d[_0xdb2a('0x5f')][_0xdb2a('0x94')]){throw new db[(_0xdb2a('0x8f'))][(_0xdb2a('0x90'))](_0xdb2a('0x96'));}return _0x31c1eb;}else if(_0x11210d[_0xdb2a('0x36')][_0xdb2a('0x3d')]==_0xdb2a('0x36')){if(!_0x11210d[_0xdb2a('0x5f')]['newPassword']){throw new db[(_0xdb2a('0x8f'))][(_0xdb2a('0x90'))](_0xdb2a('0x96'));}if(_0x31c1eb[_0xdb2a('0x3d')]!='agent'){throw new db['Sequelize']['ValidationError'](_0xdb2a('0x97'));}return _0x31c1eb;}else{throw new db[(_0xdb2a('0x8f'))]['ValidationError'](_0xdb2a('0x97'));}}return null;})[_0xdb2a('0x32')](handleEntityNotFound(_0xf818bd,null))['then'](function(_0x331b99){return checkPasswordPattern(_0x331b99,_0x11210d['body'][_0xdb2a('0x94')],_0x47527e);})[_0xdb2a('0x32')](saveUpdates({'password':_0x11210d['body'][_0xdb2a('0x94')],'passwordResetAt':_0x11210d['user']['id']==_0x11210d[_0xdb2a('0x5a')]['id']?moment():null},null))['then'](respondWithResult(_0xf818bd,null))['catch'](handleError(_0xf818bd,null));};exports[_0xdb2a('0x98')]=function(_0x5575d9,_0x2a0f63,_0x45e3d5){var _0x3e2ee0=_0x5575d9['body'][_0xdb2a('0x99')];return db[_0xdb2a('0x55')][_0xdb2a('0x5d')]({'where':{'id':_0x5575d9[_0xdb2a('0x5a')]['id']},'attributes':['id',_0xdb2a('0x3e'),_0xdb2a('0x3d'),_0xdb2a('0x9a'),_0xdb2a('0x9b'),'voicePause',_0xdb2a('0x9c')]})[_0xdb2a('0x32')](handleEntityNotFound(_0x2a0f63,null))['then'](function(_0x367118){if(_0x367118){if(!utils['isValidChannel'](_0x3e2ee0)){throw new db[(_0xdb2a('0x8f'))][(_0xdb2a('0x90'))]('Unknown\x20channel');}return _0x367118[_0xdb2a('0x9d')+_[_0xdb2a('0x9e')](_0x3e2ee0['toLowerCase']())+_0xdb2a('0x9f')](_0x5575d9[_0xdb2a('0x5f')]['ids'],{'penalty':_0x5575d9[_0xdb2a('0x5f')][_0xdb2a('0xa0')]||0x0})['spread'](function(_0x30c03b){for(var _0x3e35f5=0x0;_0x3e35f5<_0x5575d9[_0xdb2a('0x5f')]['ids']['length'];_0x3e35f5+=0x1){var _0x5d6e7e={'UserId':_0x5575d9[_0xdb2a('0x5a')]['id']};_0x5d6e7e[_[_0xdb2a('0x9e')](_0x3e2ee0[_0xdb2a('0xa1')]())+_0xdb2a('0xa2')]=_0x5575d9['body'][_0xdb2a('0x62')][_0x3e35f5];socket[_0xdb2a('0xa3')](_0xdb2a('0x36')+_[_0xdb2a('0x9e')](_0x3e2ee0[_0xdb2a('0xa1')]())+_0xdb2a('0xa4'),_0x5d6e7e);}return _0x30c03b;})[_0xdb2a('0x32')](function(){if(_0x3e2ee0===_0xdb2a('0xa5')){return db[_0xdb2a('0xa6')][_0xdb2a('0x57')]({'where':{'id':_0x5575d9[_0xdb2a('0x5f')]['ids']||[]},'raw':!![],'attributes':['id',_0xdb2a('0x3e')]});}})[_0xdb2a('0x32')](function(_0x21b447){var _0x38ccca=_0x367118[_0xdb2a('0x34')]({'plain':!![]});var _0x5c5a50=[];if(_0x3e2ee0==='voice'&&_0x38ccca[_0xdb2a('0x3d')]===_0xdb2a('0x88')&&_0x38ccca[_0xdb2a('0x9a')]){for(var _0x399e26=0x0;_0x399e26<_0x21b447['length'];_0x399e26+=0x1){_0x5c5a50[_0xdb2a('0xa7')]({'membername':_0x38ccca[_0xdb2a('0x3e')],'UserId':_0x38ccca['id'],'queue_name':_0x21b447[_0x399e26][_0xdb2a('0x3e')],'VoiceQueueId':_0x21b447[_0x399e26]['id'],'interface':_[_0xdb2a('0x74')](_0x38ccca['interface'])?util['format'](_0xdb2a('0xa8'),_0x38ccca[_0xdb2a('0x3e')]):_0x38ccca[_0xdb2a('0x9c')],'paused':_0x38ccca[_0xdb2a('0xa9')]||![],'penalty':_0x5575d9[_0xdb2a('0x5f')][_0xdb2a('0xa0')]||0x0});}return BPromise[_0xdb2a('0xaa')](_0x5c5a50,function(_0x2d9934){return db['UserVoiceQueueRt'][_0xdb2a('0xab')](_0x2d9934);});}return _0x367118;});}})['then'](respondWithStatusCode(_0x2a0f63,null))[_0xdb2a('0x24')](handleError(_0x2a0f63,null));};exports[_0xdb2a('0xac')]=function(_0x4ed3df,_0x5a5028,_0xd83615){var _0x717ed1;return db[_0xdb2a('0x55')][_0xdb2a('0x5d')]({'where':{'id':_0x4ed3df[_0xdb2a('0x5a')]['id']},'attributes':['id',_0xdb2a('0x3e'),_0xdb2a('0x3d')]})[_0xdb2a('0x32')](handleEntityNotFound(_0x5a5028,null))[_0xdb2a('0x32')](function(_0x2b5f9e){if(_0x2b5f9e){_0x717ed1=_0x2b5f9e;if(!_0x4ed3df[_0xdb2a('0x46')][_0xdb2a('0x99')]||!utils[_0xdb2a('0xad')](_0x4ed3df[_0xdb2a('0x46')][_0xdb2a('0x99')])){throw new db[(_0xdb2a('0x8f'))]['ValidationError'](_0xdb2a('0xae'));}return _0x2b5f9e[_0xdb2a('0xaf')+_['capitalize'](_0x4ed3df[_0xdb2a('0x46')][_0xdb2a('0x99')][_0xdb2a('0xa1')]())+_0xdb2a('0x9f')](_0x4ed3df[_0xdb2a('0x46')]['ids']);}})[_0xdb2a('0x32')](function(_0x498eba){for(var _0x29d84e=0x0;_0x29d84e<_0x4ed3df[_0xdb2a('0x46')][_0xdb2a('0x62')][_0xdb2a('0x77')];_0x29d84e+=0x1){var _0x2fc8b9={'UserId':_0x4ed3df[_0xdb2a('0x5a')]['id']};_0x2fc8b9[_[_0xdb2a('0x9e')](_0x4ed3df[_0xdb2a('0x46')]['channel']['toLowerCase']())+'QueueId']=_0x4ed3df[_0xdb2a('0x46')]['ids'][_0x29d84e];socket['emit'](_0xdb2a('0x36')+_[_0xdb2a('0x9e')](_0x4ed3df[_0xdb2a('0x46')][_0xdb2a('0x99')][_0xdb2a('0xa1')]())+_0xdb2a('0xb0'),_0x2fc8b9);}return _0x498eba;})['then'](function(){if(_0x4ed3df[_0xdb2a('0x46')][_0xdb2a('0x99')]===_0xdb2a('0xa5')){return db[_0xdb2a('0xb1')][_0xdb2a('0x33')]({'where':{'UserId':_0x4ed3df[_0xdb2a('0x5a')]['id'],'VoiceQueueId':_0x4ed3df['query'][_0xdb2a('0x62')]},'individualHooks':!![]})[_0xdb2a('0x32')](function(){return _0x717ed1;});}return _0x717ed1;})['then'](respondWithStatusCode(_0x5a5028,null))[_0xdb2a('0x24')](handleError(_0x5a5028,null));};exports[_0xdb2a('0xb2')]=function(_0x472e2,_0x4b5540,_0xa1023e){_0x472e2[_0xdb2a('0x5f')][_0xdb2a('0xb3')]=_0x472e2[_0xdb2a('0xb4')][_0xdb2a('0xb5')];return db[_0xdb2a('0x55')][_0xdb2a('0x5d')]({'where':{'id':_0x472e2[_0xdb2a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4b5540,null))['then'](saveUpdates(_0x472e2[_0xdb2a('0x5f')],null))[_0xdb2a('0x32')](respondWithResult(_0x4b5540,null))['catch'](handleError(_0x4b5540,null));};exports[_0xdb2a('0xb6')]=function(_0x1086cf,_0x3020dd,_0x56b737){var _0x27aaf5=path[_0xdb2a('0xb7')](config['root'],_0xdb2a('0xb8'));return db['User'][_0xdb2a('0x5d')]({'where':{'id':_0x1086cf[_0xdb2a('0x5a')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x3020dd,null))[_0xdb2a('0x32')](function(_0x8e8b07){if(_0x8e8b07){if(_[_0xdb2a('0x74')](_0x8e8b07[_0xdb2a('0xb3')])){return _0x3020dd[_0xdb2a('0xb9')](_0x27aaf5);}else{if(!fs[_0xdb2a('0xba')](path[_0xdb2a('0xb7')](config[_0xdb2a('0xbb')],_0xdb2a('0xbc'),_0x8e8b07[_0xdb2a('0xb3')]))){return _0x3020dd[_0xdb2a('0xb9')](_0x27aaf5);}return _0x3020dd[_0xdb2a('0xb9')](path[_0xdb2a('0xb7')](config[_0xdb2a('0xbb')],'server/files/images/',_0x8e8b07['userpic']));}}})['catch'](handleError(_0x3020dd,null));};exports[_0xdb2a('0xbd')]=function(_0x158abb,_0x20dbe2,_0x5d6112){var _0x18ea83={};var _0x136980={};var _0x1a39a9;var _0x5c3caa;return db[_0xdb2a('0x55')][_0xdb2a('0x8d')]({'where':{'id':_0x158abb[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x20dbe2,null))['then'](function(_0x15cef8){if(_0x15cef8){_0x1a39a9=_0x15cef8;_0x136980[_0xdb2a('0x4a')]=_[_0xdb2a('0x47')](db[_0xdb2a('0xbe')][_0xdb2a('0x5c')]);_0x136980[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x158abb[_0xdb2a('0x46')]);_0x136980[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0x136980[_0xdb2a('0x4a')],_0x136980[_0xdb2a('0x46')]);_0x18ea83[_0xdb2a('0x4b')]=_[_0xdb2a('0x49')](_0x136980[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x158abb[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x18ea83[_0xdb2a('0x4b')]=_0x18ea83['attributes'][_0xdb2a('0x77')]?_0x18ea83['attributes']:_0x136980[_0xdb2a('0x4a')];_0x18ea83['order']=qs[_0xdb2a('0x4f')](_0x158abb[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x18ea83[_0xdb2a('0x50')]=qs['filters'](_[_0xdb2a('0x51')](_0x158abb['query'],_0x136980['filters']));if(_0x158abb['query'][_0xdb2a('0x39')]){_0x18ea83[_0xdb2a('0x50')]=_['merge'](_0x18ea83[_0xdb2a('0x50')],{'$or':_[_0xdb2a('0x3b')](_0x18ea83[_0xdb2a('0x4b')],function(_0x14b9b6){var _0x32fe2b={};_0x32fe2b[_0x14b9b6]={'$like':'%'+_0x158abb[_0xdb2a('0x46')][_0xdb2a('0x39')]+'%'};return _0x32fe2b;})});}_0x18ea83=_[_0xdb2a('0x52')]({},_0x18ea83,_0x158abb['options']);return _0x1a39a9[_0xdb2a('0xbd')](_0x18ea83);}})['then'](function(_0x1ffdbe){if(_0x1ffdbe){_0x5c3caa=_0x1ffdbe[_0xdb2a('0x77')];if(_0x158abb['query']['hasOwnProperty'](_0xdb2a('0x56'))){_0x18ea83[_0xdb2a('0xbf')]=[{'model':db['CmList'],'as':_0xdb2a('0xc0'),'required':![]},{'model':db['Tag'],'as':_0xdb2a('0xc1'),'attributes':['id',_0xdb2a('0x3e'),_0xdb2a('0xc2')],'where':_0x158abb[_0xdb2a('0x46')]['tag']?{'id':_0x158abb[_0xdb2a('0x46')]['tag']}:undefined,'required':_0x158abb['query'][_0xdb2a('0xc3')]?!![]:![]}];}if(!_0x158abb[_0xdb2a('0x46')][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x18ea83[_0xdb2a('0x2b')]=qs[_0xdb2a('0x2b')](_0x158abb['query'][_0xdb2a('0x2b')]);_0x18ea83['offset']=qs['offset'](_0x158abb[_0xdb2a('0x46')][_0xdb2a('0x2a')]);}return _0x1a39a9[_0xdb2a('0xbd')](_0x18ea83);}})['then'](function(_0x1526d7){if(_0x1526d7){return _0x1526d7?{'count':_0x5c3caa,'rows':_0x1526d7}:null;}})[_0xdb2a('0x32')](respondWithResult(_0x20dbe2,null))[_0xdb2a('0x24')](handleError(_0x20dbe2,null));};exports[_0xdb2a('0xc4')]=function(_0x5d8197,_0x5b680a,_0x3414ae){var _0x29fb2a;var _0x424c83;var _0x569698={};var _0x43d142;return db[_0xdb2a('0x55')][_0xdb2a('0x8d')]({'where':{'id':_0x5d8197[_0xdb2a('0x5a')]['id']},'attributes':['id',_0xdb2a('0x3e'),'role']})['then'](handleEntityNotFound(_0x5b680a,null))[_0xdb2a('0x32')](function(_0x246dd9){if(!utils['isValidChannel'](_0x5d8197[_0xdb2a('0x46')][_0xdb2a('0x99')])){throw new db[(_0xdb2a('0x8f'))][(_0xdb2a('0x90'))](_0xdb2a('0xae'));}_0x29fb2a=_0x246dd9;var _0x39dc3b={};_0x39dc3b[_0xdb2a('0x4a')]=_[_0xdb2a('0x47')](db[_[_0xdb2a('0x9e')](_0x5d8197[_0xdb2a('0x46')][_0xdb2a('0x99')])+_0xdb2a('0xc5')][_0xdb2a('0x5c')]);_0x39dc3b[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x5d8197['query']);_0x39dc3b[_0xdb2a('0x48')]=_['intersection'](_0x39dc3b[_0xdb2a('0x4a')],_0x39dc3b[_0xdb2a('0x46')]);_0x569698['attributes']=_[_0xdb2a('0x49')](_0x39dc3b['model'],qs[_0xdb2a('0x4c')](_0x5d8197[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x569698[_0xdb2a('0x4b')]=_0x569698[_0xdb2a('0x4b')][_0xdb2a('0x77')]?_0x569698[_0xdb2a('0x4b')]:_0x39dc3b[_0xdb2a('0x4a')];_0x569698['order']=qs['sort'](_0x5d8197[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x569698['where']=qs[_0xdb2a('0x48')](_['pick'](_0x5d8197[_0xdb2a('0x46')],_0x39dc3b[_0xdb2a('0x48')]));if(_0x5d8197['query'][_0xdb2a('0x39')]){_0x569698['where']=_[_0xdb2a('0x52')](_0x569698[_0xdb2a('0x50')],{'$or':_[_0xdb2a('0x3b')](_0x569698[_0xdb2a('0x4b')],function(_0x53826c){var _0x3915d1={};_0x3915d1[_0x53826c]={'$like':'%'+_0x5d8197[_0xdb2a('0x46')][_0xdb2a('0x39')]+'%'};return _0x3915d1;})});}_0x569698=_['merge']({},_0x569698,_0x5d8197[_0xdb2a('0x54')]);switch(_0x29fb2a[_0xdb2a('0x3d')]){case _0xdb2a('0x66'):return db[_['capitalize'](_0x5d8197[_0xdb2a('0x46')][_0xdb2a('0x99')])+'Queue'][_0xdb2a('0x57')](_0x569698);case _0xdb2a('0x36'):case'agent':return _0x29fb2a[_0xdb2a('0x34')+_[_0xdb2a('0x9e')](_0x5d8197[_0xdb2a('0x46')][_0xdb2a('0x99')])+'Queues'](_0x569698);default:throw new db[(_0xdb2a('0x8f'))][(_0xdb2a('0x90'))]('Unknown\x20role');}})[_0xdb2a('0x32')](function(_0x594c12){_0x43d142=_0x594c12['length'];if(!_0x5d8197[_0xdb2a('0x46')]['hasOwnProperty']('nolimit')){_0x569698[_0xdb2a('0x2b')]=qs['limit'](_0x5d8197[_0xdb2a('0x46')]['limit']);_0x569698[_0xdb2a('0x2a')]=qs[_0xdb2a('0x2a')](_0x5d8197['query'][_0xdb2a('0x2a')]);}switch(_0x29fb2a[_0xdb2a('0x3d')]){case _0xdb2a('0x66'):return db[_[_0xdb2a('0x9e')](_0x5d8197[_0xdb2a('0x46')]['channel'])+_0xdb2a('0xc5')][_0xdb2a('0x57')](_0x569698);case _0xdb2a('0x36'):case'agent':return _0x29fb2a[_0xdb2a('0x34')+_[_0xdb2a('0x9e')](_0x5d8197[_0xdb2a('0x46')][_0xdb2a('0x99')])+'Queues'](_0x569698);}})[_0xdb2a('0x32')](function(_0xe5d8d9){return{'count':_0x43d142,'rows':_0xe5d8d9};})['then'](respondWithResult(_0x5b680a,null))[_0xdb2a('0x24')](handleError(_0x5b680a,null));};exports['getVoiceQueuesRt']=function(_0x461f35,_0x3eaff3,_0x1dcdf4){var _0x2698df={};var _0x196d0a={};var _0x174c59;var _0x5bdde8;return db['User'][_0xdb2a('0x8d')]({'where':{'id':_0x461f35[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x3eaff3,null))[_0xdb2a('0x32')](function(_0x4addfb){if(_0x4addfb){_0x174c59=_0x4addfb;_0x196d0a[_0xdb2a('0x4a')]=_[_0xdb2a('0x47')](db['UserVoiceQueueRt'][_0xdb2a('0x5c')]);_0x196d0a[_0xdb2a('0x46')]=_['keys'](_0x461f35['query']);_0x196d0a[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0x196d0a[_0xdb2a('0x4a')],_0x196d0a[_0xdb2a('0x46')]);_0x2698df['attributes']=_['intersection'](_0x196d0a[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x461f35[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x2698df['attributes']=_0x2698df[_0xdb2a('0x4b')][_0xdb2a('0x77')]?_0x2698df['attributes']:_0x196d0a['model'];_0x2698df[_0xdb2a('0xc6')]=qs['sort'](_0x461f35[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x2698df[_0xdb2a('0x50')]=qs[_0xdb2a('0x48')](_[_0xdb2a('0x51')](_0x461f35['query'],_0x196d0a['filters']));if(_0x461f35[_0xdb2a('0x46')][_0xdb2a('0x39')]){_0x2698df[_0xdb2a('0x50')]=_[_0xdb2a('0x52')](_0x2698df[_0xdb2a('0x50')],{'$or':_[_0xdb2a('0x3b')](_0x2698df['attributes'],function(_0x2dee05){var _0x15e492={};_0x15e492[_0x2dee05]={'$like':'%'+_0x461f35[_0xdb2a('0x46')]['filter']+'%'};return _0x15e492;})});}_0x2698df=_[_0xdb2a('0x52')]({},_0x2698df,_0x461f35['options']);return _0x174c59['getVoiceQueuesRt'](_0x2698df);}})[_0xdb2a('0x32')](function(_0x3a268c){if(_0x3a268c){_0x5bdde8=_0x3a268c['length'];if(!_0x461f35[_0xdb2a('0x46')][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x2698df[_0xdb2a('0x2b')]=qs[_0xdb2a('0x2b')](_0x461f35[_0xdb2a('0x46')]['limit']);_0x2698df['offset']=qs[_0xdb2a('0x2a')](_0x461f35[_0xdb2a('0x46')][_0xdb2a('0x2a')]);}return _0x174c59['getVoiceQueuesRt'](_0x2698df);}})[_0xdb2a('0x32')](function(_0x313518){if(_0x313518){return _0x313518?{'count':_0x5bdde8,'rows':_0x313518}:null;}})[_0xdb2a('0x32')](respondWithResult(_0x3eaff3,null))[_0xdb2a('0x24')](handleError(_0x3eaff3,null));};exports[_0xdb2a('0xc7')]=function(_0x253aed,_0xc9def6,_0x1a7dd6){var _0x5e06ff={};var _0x228e56={};var _0x51355f;var _0x5806d2;return db[_0xdb2a('0x55')][_0xdb2a('0x8d')]({'where':{'id':_0x253aed[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0xc9def6,null))[_0xdb2a('0x32')](function(_0x42cb82){if(_0x42cb82){_0x51355f=_0x42cb82;_0x228e56['model']=_[_0xdb2a('0x47')](db[_0xdb2a('0xc8')][_0xdb2a('0x5c')]);_0x228e56[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x253aed[_0xdb2a('0x46')]);_0x228e56[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0x228e56[_0xdb2a('0x4a')],_0x228e56['query']);_0x5e06ff[_0xdb2a('0x4b')]=_['intersection'](_0x228e56['model'],qs[_0xdb2a('0x4c')](_0x253aed[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x5e06ff[_0xdb2a('0x4b')]=_0x5e06ff[_0xdb2a('0x4b')][_0xdb2a('0x77')]?_0x5e06ff[_0xdb2a('0x4b')]:_0x228e56[_0xdb2a('0x4a')];_0x5e06ff[_0xdb2a('0xc6')]=qs[_0xdb2a('0x4f')](_0x253aed[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x5e06ff[_0xdb2a('0x50')]=qs[_0xdb2a('0x48')](_['pick'](_0x253aed[_0xdb2a('0x46')],_0x228e56['filters']));if(_0x253aed[_0xdb2a('0x46')][_0xdb2a('0x39')]){_0x5e06ff[_0xdb2a('0x50')]=_['merge'](_0x5e06ff[_0xdb2a('0x50')],{'$or':_['map'](_0x5e06ff[_0xdb2a('0x4b')],function(_0x547711){var _0x53816a={};_0x53816a[_0x547711]={'$like':'%'+_0x253aed[_0xdb2a('0x46')]['filter']+'%'};return _0x53816a;})});}_0x5e06ff=_[_0xdb2a('0x52')]({},_0x5e06ff,_0x253aed[_0xdb2a('0x54')]);return _0x51355f[_0xdb2a('0xc7')](_0x5e06ff);}})[_0xdb2a('0x32')](function(_0x57e43c){if(_0x57e43c){_0x5806d2=_0x57e43c[_0xdb2a('0x77')];if(!_0x253aed[_0xdb2a('0x46')]['hasOwnProperty'](_0xdb2a('0x4e'))){_0x5e06ff[_0xdb2a('0x2b')]=qs[_0xdb2a('0x2b')](_0x253aed[_0xdb2a('0x46')][_0xdb2a('0x2b')]);_0x5e06ff[_0xdb2a('0x2a')]=qs[_0xdb2a('0x2a')](_0x253aed[_0xdb2a('0x46')][_0xdb2a('0x2a')]);}return _0x51355f[_0xdb2a('0xc7')](_0x5e06ff);}})['then'](function(_0x3548e7){if(_0x3548e7){return _0x3548e7?{'count':_0x5806d2,'rows':_0x3548e7}:null;}})[_0xdb2a('0x32')](respondWithResult(_0xc9def6,null))[_0xdb2a('0x24')](handleError(_0xc9def6,null));};exports[_0xdb2a('0xc9')]=function(_0x5c6dcd,_0x1d35e3,_0x4a01fc){var _0x313b80={'raw':!![],'where':{}};var _0xb9c621={};var _0x1fa347={'count':0x0,'rows':[]};return db['User'][_0xdb2a('0x8d')]({'where':{'id':_0x5c6dcd['params']['id']}})['then'](handleEntityNotFound(_0x1d35e3,null))[_0xdb2a('0x32')](function(_0x4b49f1){if(_0x4b49f1){_0xb9c621[_0xdb2a('0x4a')]=_[_0xdb2a('0x47')](db[_0xdb2a('0xca')][_0xdb2a('0x5c')]);_0xb9c621['query']=_['keys'](_0x5c6dcd[_0xdb2a('0x46')]);_0xb9c621[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0xb9c621[_0xdb2a('0x4a')],_0xb9c621[_0xdb2a('0x46')]);_0x313b80[_0xdb2a('0x4b')]=_['intersection'](_0xb9c621[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x5c6dcd[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x313b80[_0xdb2a('0x4b')]=_0x313b80[_0xdb2a('0x4b')][_0xdb2a('0x77')]?_0x313b80[_0xdb2a('0x4b')]:_0xb9c621[_0xdb2a('0x4a')];if(!_0x5c6dcd[_0xdb2a('0x46')][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x313b80[_0xdb2a('0x2b')]=qs[_0xdb2a('0x2b')](_0x5c6dcd['query'][_0xdb2a('0x2b')]);_0x313b80[_0xdb2a('0x2a')]=qs[_0xdb2a('0x2a')](_0x5c6dcd[_0xdb2a('0x46')]['offset']);}_0x313b80[_0xdb2a('0xc6')]=qs['sort'](_0x5c6dcd['query'][_0xdb2a('0x4f')]);_0x313b80[_0xdb2a('0x50')]=qs[_0xdb2a('0x48')](_['pick'](_0x5c6dcd[_0xdb2a('0x46')],_0xb9c621['filters']));_0x313b80[_0xdb2a('0x50')]['UserId']=_0x4b49f1['id'];if(_0x5c6dcd[_0xdb2a('0x46')]['filter']){_0x313b80[_0xdb2a('0x50')]=_['merge'](_0x313b80['where'],{'$or':_['map'](_0x313b80[_0xdb2a('0x4b')],function(_0x276a89){var _0x22e27b={};_0x22e27b[_0x276a89]={'$like':'%'+_0x5c6dcd['query'][_0xdb2a('0x39')]+'%'};return _0x22e27b;})});}_0x313b80=_[_0xdb2a('0x52')]({},_0x313b80,_0x5c6dcd[_0xdb2a('0x54')]);return db[_0xdb2a('0xca')][_0xdb2a('0x29')]({'where':_0x313b80[_0xdb2a('0x50')]})[_0xdb2a('0x32')](function(_0x5a6c83){_0x1fa347['count']=_0x5a6c83;if(_0x5c6dcd[_0xdb2a('0x46')]['includeAll']){_0x313b80[_0xdb2a('0xbf')]=[{'all':!![]}];}return db[_0xdb2a('0xca')][_0xdb2a('0x57')](_0x313b80);})[_0xdb2a('0x32')](function(_0x2a9b5b){_0x1fa347['rows']=_0x2a9b5b;return _0x1fa347;});}})['then'](respondWithFilteredResult(_0x1d35e3,_0x313b80))[_0xdb2a('0x24')](handleError(_0x1d35e3,null));};exports[_0xdb2a('0xcb')]=function(_0x5d8a91,_0xf1116a,_0x28a3c5){var _0x28f717={'raw':!![],'where':{}};var _0x7bd3e8={};var _0x2a1ae5={'count':0x0,'rows':[]};return db[_0xdb2a('0x55')]['findOne']({'where':{'id':_0x5d8a91[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0xf1116a,null))[_0xdb2a('0x32')](function(_0x1a7b95){if(_0x1a7b95){_0x7bd3e8[_0xdb2a('0x4a')]=_[_0xdb2a('0x47')](db['ScreenRecording']['rawAttributes']);_0x7bd3e8[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x5d8a91['query']);_0x7bd3e8[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0x7bd3e8[_0xdb2a('0x4a')],_0x7bd3e8[_0xdb2a('0x46')]);_0x28f717[_0xdb2a('0x4b')]=_[_0xdb2a('0x49')](_0x7bd3e8[_0xdb2a('0x4a')],qs['fields'](_0x5d8a91[_0xdb2a('0x46')]['fields']));_0x28f717[_0xdb2a('0x4b')]=_0x28f717['attributes'][_0xdb2a('0x77')]?_0x28f717[_0xdb2a('0x4b')]:_0x7bd3e8['model'];if(!_0x5d8a91[_0xdb2a('0x46')][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x28f717[_0xdb2a('0x2b')]=qs[_0xdb2a('0x2b')](_0x5d8a91[_0xdb2a('0x46')][_0xdb2a('0x2b')]);_0x28f717[_0xdb2a('0x2a')]=qs['offset'](_0x5d8a91[_0xdb2a('0x46')][_0xdb2a('0x2a')]);}_0x28f717[_0xdb2a('0xc6')]=qs[_0xdb2a('0x4f')](_0x5d8a91[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x28f717[_0xdb2a('0x50')]=qs[_0xdb2a('0x48')](_[_0xdb2a('0x51')](_0x5d8a91[_0xdb2a('0x46')],_0x7bd3e8['filters']));_0x28f717[_0xdb2a('0x50')][_0xdb2a('0xcc')]=_0x1a7b95['id'];if(_0x5d8a91[_0xdb2a('0x46')][_0xdb2a('0x39')]){_0x28f717['where']=_['merge'](_0x28f717[_0xdb2a('0x50')],{'$or':_['map'](_0x28f717[_0xdb2a('0x4b')],function(_0x3a92ce){var _0x5365f3={};_0x5365f3[_0x3a92ce]={'$like':'%'+_0x5d8a91[_0xdb2a('0x46')][_0xdb2a('0x39')]+'%'};return _0x5365f3;})});}_0x28f717=_['merge']({},_0x28f717,_0x5d8a91[_0xdb2a('0x54')]);return db['ScreenRecording'][_0xdb2a('0x29')]({'where':_0x28f717[_0xdb2a('0x50')]})[_0xdb2a('0x32')](function(_0x30d50b){_0x2a1ae5['count']=_0x30d50b;if(_0x5d8a91[_0xdb2a('0x46')]['includeAll']){_0x28f717[_0xdb2a('0xbf')]=[{'all':!![]}];}return db['ScreenRecording'][_0xdb2a('0x57')](_0x28f717);})[_0xdb2a('0x32')](function(_0x368b2f){_0x2a1ae5[_0xdb2a('0x58')]=_0x368b2f;return _0x2a1ae5;});}})[_0xdb2a('0x32')](respondWithFilteredResult(_0xf1116a,_0x28f717))[_0xdb2a('0x24')](handleError(_0xf1116a,null));};exports[_0xdb2a('0xcd')]=function(_0x497ee5,_0x5afa56,_0x1e44ad){var _0x3e146c={};var _0x4026bf={};var _0x65ba45;var _0xe76f68;return db[_0xdb2a('0x55')]['findOne']({'where':{'id':_0x497ee5[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x5afa56,null))[_0xdb2a('0x32')](function(_0x5a54bf){if(_0x5a54bf){_0x65ba45=_0x5a54bf;_0x4026bf[_0xdb2a('0x4a')]=_[_0xdb2a('0x47')](db[_0xdb2a('0xce')][_0xdb2a('0x5c')]);_0x4026bf[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x497ee5[_0xdb2a('0x46')]);_0x4026bf[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0x4026bf[_0xdb2a('0x4a')],_0x4026bf[_0xdb2a('0x46')]);_0x3e146c[_0xdb2a('0x4b')]=_[_0xdb2a('0x49')](_0x4026bf[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x497ee5['query']['fields']));_0x3e146c[_0xdb2a('0x4b')]=_0x3e146c[_0xdb2a('0x4b')][_0xdb2a('0x77')]?_0x3e146c[_0xdb2a('0x4b')]:_0x4026bf[_0xdb2a('0x4a')];_0x3e146c['order']=qs[_0xdb2a('0x4f')](_0x497ee5[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x3e146c['where']=qs[_0xdb2a('0x48')](_['pick'](_0x497ee5['query'],_0x4026bf[_0xdb2a('0x48')]));if(_0x497ee5[_0xdb2a('0x46')][_0xdb2a('0x39')]){_0x3e146c['where']=_[_0xdb2a('0x52')](_0x3e146c[_0xdb2a('0x50')],{'$or':_[_0xdb2a('0x3b')](_0x3e146c[_0xdb2a('0x4b')],function(_0x40d6a0){var _0xcfb3b3={};_0xcfb3b3[_0x40d6a0]={'$like':'%'+_0x497ee5[_0xdb2a('0x46')][_0xdb2a('0x39')]+'%'};return _0xcfb3b3;})});}_0x3e146c=_[_0xdb2a('0x52')]({},_0x3e146c,_0x497ee5[_0xdb2a('0x54')]);return _0x65ba45[_0xdb2a('0xcd')](_0x3e146c);}})[_0xdb2a('0x32')](function(_0x18a9f2){if(_0x18a9f2){_0xe76f68=_0x18a9f2[_0xdb2a('0x77')];if(!_0x497ee5['query'][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x3e146c['limit']=qs[_0xdb2a('0x2b')](_0x497ee5[_0xdb2a('0x46')][_0xdb2a('0x2b')]);_0x3e146c['offset']=qs[_0xdb2a('0x2a')](_0x497ee5[_0xdb2a('0x46')]['offset']);}return _0x65ba45['getChatInteractions'](_0x3e146c);}})[_0xdb2a('0x32')](function(_0x293e20){if(_0x293e20){return _0x293e20?{'count':_0xe76f68,'rows':_0x293e20}:null;}})[_0xdb2a('0x32')](respondWithResult(_0x5afa56,null))['catch'](handleError(_0x5afa56,null));};exports[_0xdb2a('0xcf')]=function(_0x51b45a,_0x361fe5,_0x24e1ab){var _0x357322={};var _0x275d62={};var _0x4899c9;var _0x874733;return db[_0xdb2a('0x55')][_0xdb2a('0x8d')]({'where':{'id':_0x51b45a[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x361fe5,null))['then'](function(_0x25937f){if(_0x25937f){_0x4899c9=_0x25937f;_0x275d62['model']=_[_0xdb2a('0x47')](db[_0xdb2a('0xd0')][_0xdb2a('0x5c')]);_0x275d62[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x51b45a['query']);_0x275d62['filters']=_['intersection'](_0x275d62[_0xdb2a('0x4a')],_0x275d62[_0xdb2a('0x46')]);_0x357322[_0xdb2a('0x4b')]=_[_0xdb2a('0x49')](_0x275d62[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x51b45a[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x357322[_0xdb2a('0x4b')]=_0x357322['attributes'][_0xdb2a('0x77')]?_0x357322[_0xdb2a('0x4b')]:_0x275d62['model'];_0x357322[_0xdb2a('0xc6')]=qs['sort'](_0x51b45a[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x357322['where']=qs[_0xdb2a('0x48')](_[_0xdb2a('0x51')](_0x51b45a[_0xdb2a('0x46')],_0x275d62['filters']));if(_0x51b45a[_0xdb2a('0x46')]['filter']){_0x357322[_0xdb2a('0x50')]=_['merge'](_0x357322[_0xdb2a('0x50')],{'$or':_[_0xdb2a('0x3b')](_0x357322['attributes'],function(_0x54d5bd){var _0x2b3f87={};_0x2b3f87[_0x54d5bd]={'$like':'%'+_0x51b45a['query']['filter']+'%'};return _0x2b3f87;})});}_0x357322=_[_0xdb2a('0x52')]({},_0x357322,_0x51b45a['options']);return _0x4899c9[_0xdb2a('0xcf')](_0x357322);}})[_0xdb2a('0x32')](function(_0x137a85){if(_0x137a85){_0x874733=_0x137a85[_0xdb2a('0x77')];if(!_0x51b45a[_0xdb2a('0x46')][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x357322[_0xdb2a('0x2b')]=qs['limit'](_0x51b45a[_0xdb2a('0x46')][_0xdb2a('0x2b')]);_0x357322[_0xdb2a('0x2a')]=qs[_0xdb2a('0x2a')](_0x51b45a[_0xdb2a('0x46')][_0xdb2a('0x2a')]);}return _0x4899c9['getOpenchannelInteractions'](_0x357322);}})[_0xdb2a('0x32')](function(_0x14c45e){if(_0x14c45e){return _0x14c45e?{'count':_0x874733,'rows':_0x14c45e}:null;}})[_0xdb2a('0x32')](respondWithResult(_0x361fe5,null))[_0xdb2a('0x24')](handleError(_0x361fe5,null));};exports[_0xdb2a('0xd1')]=function(_0x467c11,_0xd67f9e,_0x131838){var _0x295bfb={'raw':!![],'where':{}};var _0x2543d4={};var _0x21c298={'count':0x0,'rows':[]};return db[_0xdb2a('0x55')][_0xdb2a('0x8d')]({'where':{'id':_0x467c11[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0xd67f9e,null))['then'](function(_0x39fcdf){if(_0x39fcdf){_0x2543d4['model']=_[_0xdb2a('0x47')](db['MailInteraction'][_0xdb2a('0x5c')]);_0x2543d4[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x467c11['query']);_0x2543d4[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0x2543d4['model'],_0x2543d4[_0xdb2a('0x46')]);_0x295bfb[_0xdb2a('0x4b')]=_['intersection'](_0x2543d4[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x467c11[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x295bfb[_0xdb2a('0x4b')]=_0x295bfb[_0xdb2a('0x4b')][_0xdb2a('0x77')]?_0x295bfb[_0xdb2a('0x4b')]:_0x2543d4['model'];if(!_0x467c11[_0xdb2a('0x46')][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x295bfb[_0xdb2a('0x2b')]=qs['limit'](_0x467c11['query']['limit']);_0x295bfb[_0xdb2a('0x2a')]=qs[_0xdb2a('0x2a')](_0x467c11[_0xdb2a('0x46')][_0xdb2a('0x2a')]);}_0x295bfb[_0xdb2a('0xc6')]=qs[_0xdb2a('0x4f')](_0x467c11[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x295bfb[_0xdb2a('0x50')]=qs['filters'](_[_0xdb2a('0x51')](_0x467c11[_0xdb2a('0x46')],_0x2543d4[_0xdb2a('0x48')]));_0x295bfb[_0xdb2a('0x50')][_0xdb2a('0xcc')]=_0x39fcdf['id'];if(_0x467c11[_0xdb2a('0x46')][_0xdb2a('0x39')]){_0x295bfb[_0xdb2a('0x50')]=_[_0xdb2a('0x52')](_0x295bfb[_0xdb2a('0x50')],{'$or':_['map'](_0x295bfb[_0xdb2a('0x4b')],function(_0x357633){var _0x47f99f={};_0x47f99f[_0x357633]={'$like':'%'+_0x467c11[_0xdb2a('0x46')][_0xdb2a('0x39')]+'%'};return _0x47f99f;})});}_0x295bfb=_[_0xdb2a('0x52')]({},_0x295bfb,_0x467c11[_0xdb2a('0x54')]);return db['MailInteraction'][_0xdb2a('0x29')]({'where':_0x295bfb[_0xdb2a('0x50')]})[_0xdb2a('0x32')](function(_0x22842c){_0x21c298['count']=_0x22842c;if(_0x467c11['query'][_0xdb2a('0x56')]){_0x295bfb[_0xdb2a('0xbf')]=[{'all':!![]}];}return db[_0xdb2a('0xd2')][_0xdb2a('0x57')](_0x295bfb);})[_0xdb2a('0x32')](function(_0xd177ae){_0x21c298[_0xdb2a('0x58')]=_0xd177ae;return _0x21c298;});}})[_0xdb2a('0x32')](respondWithFilteredResult(_0xd67f9e,_0x295bfb))[_0xdb2a('0x24')](handleError(_0xd67f9e,null));};exports['getSmsInteractions']=function(_0x393b3a,_0x4e3502,_0x6fbbfc){var _0x434dd0={};var _0x10b87f={};var _0x5237b1;var _0x44b912;return db[_0xdb2a('0x55')][_0xdb2a('0x8d')]({'where':{'id':_0x393b3a['params']['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x4e3502,null))[_0xdb2a('0x32')](function(_0x2d8160){if(_0x2d8160){_0x5237b1=_0x2d8160;_0x10b87f[_0xdb2a('0x4a')]=_['keys'](db[_0xdb2a('0xd3')][_0xdb2a('0x5c')]);_0x10b87f[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x393b3a['query']);_0x10b87f[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0x10b87f['model'],_0x10b87f['query']);_0x434dd0[_0xdb2a('0x4b')]=_[_0xdb2a('0x49')](_0x10b87f[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x393b3a[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x434dd0[_0xdb2a('0x4b')]=_0x434dd0[_0xdb2a('0x4b')][_0xdb2a('0x77')]?_0x434dd0[_0xdb2a('0x4b')]:_0x10b87f['model'];_0x434dd0[_0xdb2a('0xc6')]=qs[_0xdb2a('0x4f')](_0x393b3a[_0xdb2a('0x46')]['sort']);_0x434dd0[_0xdb2a('0x50')]=qs[_0xdb2a('0x48')](_['pick'](_0x393b3a[_0xdb2a('0x46')],_0x10b87f['filters']));if(_0x393b3a['query'][_0xdb2a('0x39')]){_0x434dd0[_0xdb2a('0x50')]=_[_0xdb2a('0x52')](_0x434dd0['where'],{'$or':_['map'](_0x434dd0[_0xdb2a('0x4b')],function(_0x3543f1){var _0x58572a={};_0x58572a[_0x3543f1]={'$like':'%'+_0x393b3a[_0xdb2a('0x46')][_0xdb2a('0x39')]+'%'};return _0x58572a;})});}_0x434dd0=_[_0xdb2a('0x52')]({},_0x434dd0,_0x393b3a[_0xdb2a('0x54')]);return _0x5237b1[_0xdb2a('0xd4')](_0x434dd0);}})[_0xdb2a('0x32')](function(_0x162b9b){if(_0x162b9b){_0x44b912=_0x162b9b[_0xdb2a('0x77')];if(!_0x393b3a[_0xdb2a('0x46')][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x434dd0[_0xdb2a('0x2b')]=qs['limit'](_0x393b3a[_0xdb2a('0x46')][_0xdb2a('0x2b')]);_0x434dd0['offset']=qs['offset'](_0x393b3a[_0xdb2a('0x46')]['offset']);}return _0x5237b1['getSmsInteractions'](_0x434dd0);}})[_0xdb2a('0x32')](function(_0x46b848){if(_0x46b848){return _0x46b848?{'count':_0x44b912,'rows':_0x46b848}:null;}})[_0xdb2a('0x32')](respondWithResult(_0x4e3502,null))['catch'](handleError(_0x4e3502,null));};exports[_0xdb2a('0xd5')]=function(_0x145092,_0x5586a5,_0x186b59){var _0x81e281={};var _0x33e2b4={};var _0x195d05;var _0x597f5b;return db[_0xdb2a('0x55')][_0xdb2a('0x8d')]({'where':{'id':_0x145092[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x5586a5,null))[_0xdb2a('0x32')](function(_0x20bada){if(_0x20bada){_0x195d05=_0x20bada;_0x33e2b4['model']=_[_0xdb2a('0x47')](db[_0xdb2a('0xd6')][_0xdb2a('0x5c')]);_0x33e2b4[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x145092[_0xdb2a('0x46')]);_0x33e2b4[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0x33e2b4['model'],_0x33e2b4[_0xdb2a('0x46')]);_0x81e281[_0xdb2a('0x4b')]=_[_0xdb2a('0x49')](_0x33e2b4[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x145092[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x81e281['attributes']=_0x81e281[_0xdb2a('0x4b')][_0xdb2a('0x77')]?_0x81e281[_0xdb2a('0x4b')]:_0x33e2b4[_0xdb2a('0x4a')];_0x81e281[_0xdb2a('0xc6')]=qs[_0xdb2a('0x4f')](_0x145092['query'][_0xdb2a('0x4f')]);_0x81e281[_0xdb2a('0x50')]=qs[_0xdb2a('0x48')](_[_0xdb2a('0x51')](_0x145092[_0xdb2a('0x46')],_0x33e2b4[_0xdb2a('0x48')]));if(_0x145092[_0xdb2a('0x46')][_0xdb2a('0x39')]){_0x81e281[_0xdb2a('0x50')]=_[_0xdb2a('0x52')](_0x81e281[_0xdb2a('0x50')],{'$or':_[_0xdb2a('0x3b')](_0x81e281['attributes'],function(_0x5d31bf){var _0x232463={};_0x232463[_0x5d31bf]={'$like':'%'+_0x145092[_0xdb2a('0x46')]['filter']+'%'};return _0x232463;})});}_0x81e281=_[_0xdb2a('0x52')]({},_0x81e281,_0x145092[_0xdb2a('0x54')]);return _0x195d05[_0xdb2a('0xd5')](_0x81e281);}})[_0xdb2a('0x32')](function(_0x5cc0b4){if(_0x5cc0b4){_0x597f5b=_0x5cc0b4['length'];if(!_0x145092[_0xdb2a('0x46')]['hasOwnProperty']('nolimit')){_0x81e281['limit']=qs[_0xdb2a('0x2b')](_0x145092[_0xdb2a('0x46')][_0xdb2a('0x2b')]);_0x81e281['offset']=qs['offset'](_0x145092[_0xdb2a('0x46')][_0xdb2a('0x2a')]);}return _0x195d05[_0xdb2a('0xd5')](_0x81e281);}})[_0xdb2a('0x32')](function(_0x4fcd8d){if(_0x4fcd8d){return _0x4fcd8d?{'count':_0x597f5b,'rows':_0x4fcd8d}:null;}})[_0xdb2a('0x32')](respondWithResult(_0x5586a5,null))[_0xdb2a('0x24')](handleError(_0x5586a5,null));};exports['getWhatsappInteractions']=function(_0x489289,_0x590f7f,_0x244229){var _0x11add0={};var _0x1bbe17={};var _0xefa382;var _0x56f084;return db[_0xdb2a('0x55')][_0xdb2a('0x8d')]({'where':{'id':_0x489289[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x590f7f,null))[_0xdb2a('0x32')](function(_0x432968){if(_0x432968){_0xefa382=_0x432968;_0x1bbe17['model']=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x1bbe17[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x489289[_0xdb2a('0x46')]);_0x1bbe17['filters']=_[_0xdb2a('0x49')](_0x1bbe17[_0xdb2a('0x4a')],_0x1bbe17[_0xdb2a('0x46')]);_0x11add0[_0xdb2a('0x4b')]=_[_0xdb2a('0x49')](_0x1bbe17[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x489289[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x11add0[_0xdb2a('0x4b')]=_0x11add0[_0xdb2a('0x4b')]['length']?_0x11add0['attributes']:_0x1bbe17[_0xdb2a('0x4a')];_0x11add0['order']=qs['sort'](_0x489289[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x11add0[_0xdb2a('0x50')]=qs[_0xdb2a('0x48')](_[_0xdb2a('0x51')](_0x489289[_0xdb2a('0x46')],_0x1bbe17[_0xdb2a('0x48')]));if(_0x489289[_0xdb2a('0x46')][_0xdb2a('0x39')]){_0x11add0[_0xdb2a('0x50')]=_[_0xdb2a('0x52')](_0x11add0[_0xdb2a('0x50')],{'$or':_[_0xdb2a('0x3b')](_0x11add0['attributes'],function(_0x2686d2){var _0x41478a={};_0x41478a[_0x2686d2]={'$like':'%'+_0x489289[_0xdb2a('0x46')][_0xdb2a('0x39')]+'%'};return _0x41478a;})});}_0x11add0=_['merge']({},_0x11add0,_0x489289['options']);return _0xefa382[_0xdb2a('0xd7')](_0x11add0);}})[_0xdb2a('0x32')](function(_0x142149){if(_0x142149){_0x56f084=_0x142149[_0xdb2a('0x77')];if(!_0x489289[_0xdb2a('0x46')]['hasOwnProperty'](_0xdb2a('0x4e'))){_0x11add0[_0xdb2a('0x2b')]=qs[_0xdb2a('0x2b')](_0x489289[_0xdb2a('0x46')]['limit']);_0x11add0[_0xdb2a('0x2a')]=qs[_0xdb2a('0x2a')](_0x489289['query'][_0xdb2a('0x2a')]);}return _0xefa382['getWhatsappInteractions'](_0x11add0);}})['then'](function(_0x368c27){if(_0x368c27){return _0x368c27?{'count':_0x56f084,'rows':_0x368c27}:null;}})['then'](respondWithResult(_0x590f7f,null))[_0xdb2a('0x24')](handleError(_0x590f7f,null));};exports[_0xdb2a('0xd8')]=function(_0x5396eb,_0x517089,_0x38eed4){var _0x1d2171;var _0x1e7b94;var _0x46f859;var _0x5bcb5d=!_[_0xdb2a('0x74')](_0x5396eb[_0xdb2a('0x5a')]['id'])?_0x5396eb[_0xdb2a('0x5a')]['id']:!_[_0xdb2a('0x74')](_0x5396eb[_0xdb2a('0x36')]['id'])?_0x5396eb[_0xdb2a('0x36')]['id']:null;return db[_0xdb2a('0x55')]['find']({'where':{'id':_0x5bcb5d,'role':{'$or':[_0xdb2a('0x66'),_0xdb2a('0x36'),_0xdb2a('0x88')]}},'attributes':['id','name','phone',_0xdb2a('0xd9'),_0xdb2a('0x3d'),_0xdb2a('0x6e'),_0xdb2a('0x9b')]})[_0xdb2a('0x32')](function(_0x474e84){if(_0x474e84){if(_0x474e84[_0xdb2a('0x3d')]===_0xdb2a('0x88')){_0x1d2171=_0x474e84;if(_0x5396eb[_0xdb2a('0x5f')][_0xdb2a('0x9c')]){_0x46f859=util[_0xdb2a('0x6b')](_0xdb2a('0xda'),_0x1d2171[_0x5396eb[_0xdb2a('0x5f')][_0xdb2a('0x9c')]]);}else if(_0x5396eb[_0xdb2a('0x5f')][_0xdb2a('0xdb')]){_0x46f859=util['format'](_0xdb2a('0xa8'),_0x5396eb['body'][_0xdb2a('0xdb')]);}else{_0x46f859=util[_0xdb2a('0x6b')]('SIP/%s',_0x1d2171['name']);}socket['to'](util[_0xdb2a('0x6b')](_0xdb2a('0xdc'),_0x1d2171[_0xdb2a('0x3e')]))['emit'](_0xdb2a('0xdd'),{'ip':_0x5396eb[_0xdb2a('0xde')][_0xdb2a('0xdf')]||_0x5396eb[_0xdb2a('0xe0')][_0xdb2a('0xe1')]||_0x5396eb[_0xdb2a('0xe2')][_0xdb2a('0xe1')]||_0x5396eb[_0xdb2a('0xe0')][_0xdb2a('0xe2')][_0xdb2a('0xe1')]});return db[_0xdb2a('0xb1')][_0xdb2a('0x33')]({'where':{'membername':_0x1d2171[_0xdb2a('0x3e')]},'individualHooks':!![]});}}else{throw new db[(_0xdb2a('0x8f'))][(_0xdb2a('0x90'))](_0xdb2a('0xe3'));}})[_0xdb2a('0x32')](function(){if(_0x1d2171){return _0x1d2171['getVoiceQueues']({'raw':!![]});}})[_0xdb2a('0x32')](function(_0x3e68b6){if(_0x1d2171){var _0x4b9aa4=[];if(_0x3e68b6){_0x1e7b94=_0x3e68b6;if(_0x1e7b94[_0xdb2a('0x77')]){for(var _0x36262c=0x0;_0x36262c<_0x1e7b94['length'];_0x36262c++){_0x4b9aa4['push']({'membername':_0x1d2171['name'],'UserId':_0x1d2171['id'],'queue_name':_0x1e7b94[_0x36262c][_0xdb2a('0x3e')],'VoiceQueueId':_0x1e7b94[_0x36262c]['id'],'interface':_0x46f859,'paused':_0x1d2171['loginInPause']||![],'penalty':_0x1e7b94[_0x36262c][_0xdb2a('0xe4')]||0x0});}return BPromise[_0xdb2a('0xaa')](_0x4b9aa4,function(_0x122884){return db[_0xdb2a('0xb1')][_0xdb2a('0xab')](_0x122884);});}}}})[_0xdb2a('0x32')](function(){if(_0x1d2171){return db[_0xdb2a('0xe5')][_0xdb2a('0x57')]({'where':{'membername':_0x1d2171['name'],'exitAt':null}});}})[_0xdb2a('0x32')](function(_0x284754){if(_0x1d2171){var _0x20fd7e=[];_0x284754['forEach'](function(_0x33fdc4){_0x20fd7e[_0xdb2a('0xa7')](_0x33fdc4['update']({'exitAt':moment()[_0xdb2a('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x20fd7e);}})['then'](function(){if(_0x1d2171){var _0x2b4c08=[];var _0x438ced=[];var _0x57b6ce=utils[_0xdb2a('0xe6')]();var _0x50c366={'membername':_0x1d2171['name'],'interface':_0x46f859,'enterAt':moment()[_0xdb2a('0x6b')](_0xdb2a('0xe7')),'role':_0x1d2171[_0xdb2a('0x3d')],'internal':_0x1d2171['internal']};_0x57b6ce['forEach'](function(_0x1a02b4){_0x2b4c08[_0xdb2a('0xa7')](_[_0xdb2a('0x52')]({'channel':_0x1a02b4,'type':_0xdb2a('0xe8'),'data1':_0x5396eb[_0xdb2a('0x5f')][_0xdb2a('0xe9')],'data2':_0x46f859},_0x50c366));if(_0x1d2171[_0xdb2a('0x9b')]){_0x438ced[_0xdb2a('0xa7')](_[_0xdb2a('0x52')]({'channel':_0x1a02b4,'type':_0xdb2a('0xea'),'data1':_0xdb2a('0xeb')},_0x50c366));}});return db[_0xdb2a('0xe5')][_0xdb2a('0x5e')](_0x2b4c08[_0xdb2a('0xec')](_0x438ced),{'individualHooks':!![]});}})[_0xdb2a('0x32')](function(){if(_0x1d2171){return _0x1d2171['update']({'online':!![],'lastLoginAt':moment()[_0xdb2a('0x6b')](_0xdb2a('0xe7')),'voicePause':_0x1d2171['loginInPause']||![],'mailPause':_0x1d2171[_0xdb2a('0x9b')]||![],'chatPause':_0x1d2171['loginInPause']||![],'faxPause':_0x1d2171['loginInPause']||![],'smsPause':_0x1d2171[_0xdb2a('0x9b')]||![],'openchannelPause':_0x1d2171[_0xdb2a('0x9b')]||![],'whatsappPause':_0x1d2171[_0xdb2a('0x9b')]||![],'pauseType':_0x1d2171[_0xdb2a('0x9b')]?_0xdb2a('0xeb'):null,'interface':_0x46f859,'lastPauseAt':moment()[_0xdb2a('0x6b')](_0xdb2a('0xe7'))});}})[_0xdb2a('0x32')](function(_0x210f88){if(_0x5396eb[_0xdb2a('0xed')]){return _0x38eed4();}else{return BPromise[_0xdb2a('0xee')](_0x210f88)[_0xdb2a('0x32')](respondWithResult(_0x517089,null));}})[_0xdb2a('0x24')](handleError(_0x517089,null));};exports[_0xdb2a('0xef')]=function(_0x123b4e,_0x262e2f,_0xc64ee1){var _0x2bfdde;return db[_0xdb2a('0x55')][_0xdb2a('0x5d')]({'where':{'id':_0x123b4e[_0xdb2a('0x5a')]['id'],'role':_0xdb2a('0x88')},'attributes':['id',_0xdb2a('0x3e'),_0xdb2a('0x3d')]})['then'](handleEntityNotFound(_0x262e2f,null))[_0xdb2a('0x32')](function(_0x52cab8){if(_0x52cab8){_0x2bfdde=_0x52cab8;return db[_0xdb2a('0xb1')][_0xdb2a('0x33')]({'where':{'membername':_0x2bfdde[_0xdb2a('0x3e')]},'individualHooks':!![]});}})[_0xdb2a('0x32')](function(){return db[_0xdb2a('0xe5')]['findAll']({'where':{'membername':_0x2bfdde[_0xdb2a('0x3e')],'exitAt':null}});})[_0xdb2a('0x32')](function(_0x24b236){var _0x1f0552=[];_0x24b236[_0xdb2a('0xf0')](function(_0x3695a7){_0x1f0552[_0xdb2a('0xa7')](_0x3695a7[_0xdb2a('0x31')]({'exitAt':moment()[_0xdb2a('0x6b')](_0xdb2a('0xe7'))}));});return BPromise[_0xdb2a('0xf1')](_0x1f0552);})[_0xdb2a('0x32')](function(){return _0x2bfdde[_0xdb2a('0x31')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x262e2f,null))[_0xdb2a('0x24')](handleError(_0x262e2f,null));};exports[_0xdb2a('0xf2')]=function(_0x1b84a4,_0x78a3b5,_0x33f379){var _0x39f8dc;return db[_0xdb2a('0xb1')]['update']({'paused':0x1},{'where':{'UserId':_0x1b84a4[_0xdb2a('0x5a')]['id']},'individualHooks':!![]})[_0xdb2a('0x32')](function(){return db[_0xdb2a('0x55')][_0xdb2a('0x5d')]({'where':{'id':_0x1b84a4[_0xdb2a('0x5a')]['id'],'role':_0xdb2a('0x88')},'attributes':['id',_0xdb2a('0x3e'),_0xdb2a('0x3d'),_0xdb2a('0x6e'),'interface']});})[_0xdb2a('0x32')](handleEntityNotFound(_0x78a3b5,null))['then'](function(_0x12d098){if(_0x12d098){_0x39f8dc=_0x12d098;return respondWithRpcPromise(_0xdb2a('0xf3'),_0xdb2a('0xf2'),{'id':_0x39f8dc['id'],'name':_0x39f8dc['name'],'pause':!![]});}})[_0xdb2a('0x32')](function(){if(_0x39f8dc){return db[_0xdb2a('0xe5')]['findAll']({'where':{'membername':_0x39f8dc[_0xdb2a('0x3e')],'type':_0xdb2a('0xea'),'exitAt':null}});}})[_0xdb2a('0x32')](function(_0x5a1a11){if(_0x5a1a11[_0xdb2a('0x77')]){var _0x3721cf=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1f2d7f=0x0,_0x439a2a=_0x5a1a11[_0xdb2a('0x77')];_0x1f2d7f<_0x439a2a;_0x1f2d7f++){_0x5a1a11[_0x1f2d7f][_0xdb2a('0xf4')]({'exitAt':_0x3721cf});}}})[_0xdb2a('0x32')](function(){var _0x3683e7=[];var _0x577335=utils[_0xdb2a('0xe6')]();_0x577335['forEach'](function(_0x4793e){_0x3683e7['push']({'channel':_0x4793e,'membername':_0x39f8dc[_0xdb2a('0x3e')],'interface':_[_0xdb2a('0x74')](_0x39f8dc[_0xdb2a('0x9c')])?util[_0xdb2a('0x6b')]('SIP/%s',_0x39f8dc[_0xdb2a('0x3e')]):_0x39f8dc[_0xdb2a('0x9c')],'type':_0xdb2a('0xea'),'enterAt':moment()[_0xdb2a('0x6b')](_0xdb2a('0xe7')),'data1':_0x1b84a4[_0xdb2a('0x5f')][_0xdb2a('0x43')]||_0xdb2a('0xf5'),'role':_0x39f8dc['role'],'internal':_0x39f8dc[_0xdb2a('0x6e')]});});return db['MemberReport']['bulkCreate'](_0x3683e7,{'individualHooks':!![]});})[_0xdb2a('0x32')](function(){return _0x39f8dc[_0xdb2a('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1b84a4[_0xdb2a('0x5f')][_0xdb2a('0x43')]||_0xdb2a('0xf5'),'lastPauseAt':moment()[_0xdb2a('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xdb2a('0x32')](respondWithResult(_0x78a3b5,null))[_0xdb2a('0x24')](handleError(_0x78a3b5,null));};exports[_0xdb2a('0xf6')]=function(_0x3cecd2,_0x38cea4,_0x39a869){var _0x1b86b8;return db[_0xdb2a('0x55')]['find']({'where':{'id':_0x3cecd2['params']['id']},'attributes':['id','name',_0xdb2a('0x3d'),_0xdb2a('0xa9'),_0xdb2a('0xf7'),_0xdb2a('0xf8'),_0xdb2a('0xf9'),_0xdb2a('0xfa'),_0xdb2a('0xfb'),_0xdb2a('0xfc'),'pauseType',_0xdb2a('0xfd')]})[_0xdb2a('0x32')](handleEntityNotFound(_0x38cea4,null))[_0xdb2a('0x32')](function(_0x3a391b){if(_0x3a391b){_0x1b86b8=_0x3a391b;if(_0x3cecd2[_0xdb2a('0x5f')]['channel']&&!utils['isValidChannel'](_0x3cecd2['body'][_0xdb2a('0x99')])){throw new db[(_0xdb2a('0x8f'))][(_0xdb2a('0x90'))](_0xdb2a('0xae'));}switch(_0x3cecd2[_0xdb2a('0x5f')][_0xdb2a('0x99')]){case _0xdb2a('0xa5'):return respondWithRpcPromise(_0xdb2a('0xf3'),'unpause',{'id':_0x1b86b8['id'],'name':_0x1b86b8[_0xdb2a('0x3e')],'pause':![]})[_0xdb2a('0x32')](function(){return db[_0xdb2a('0xb1')][_0xdb2a('0x31')]({'paused':0x0},{'where':{'UserId':_0x1b86b8['id']},'individualHooks':!![]});})[_0xdb2a('0x32')](function(){return db[_0xdb2a('0xe5')][_0xdb2a('0x5d')]({'where':{'channel':_0x3cecd2[_0xdb2a('0x5f')]['channel'],'membername':_0x1b86b8['name'],'type':'PAUSE','exitAt':null}});})['then'](function(_0x390662){if(_0x390662){return _0x390662[_0xdb2a('0x31')]({'exitAt':moment()[_0xdb2a('0x6b')](_0xdb2a('0xe7')),'data2':_0xdb2a('0xfe')},{'individualHooks':!![]});}return null;})[_0xdb2a('0x32')](function(){return _0x1b86b8['update']({'voicePause':![]});});case _0xdb2a('0xff'):case'chat':case'fax':case'sms':case _0xdb2a('0x100'):case _0xdb2a('0x101'):return db['MemberReport'][_0xdb2a('0x5d')]({'where':{'channel':_0x3cecd2[_0xdb2a('0x5f')]['channel'],'membername':_0x1b86b8[_0xdb2a('0x3e')],'type':_0xdb2a('0xea'),'exitAt':null}})[_0xdb2a('0x32')](function(_0x393d67){if(_0x393d67){return _0x393d67[_0xdb2a('0x31')]({'exitAt':moment()[_0xdb2a('0x6b')](_0xdb2a('0xe7')),'data2':_0xdb2a('0xfe')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x33cad2={};_['set'](_0x33cad2,util[_0xdb2a('0x6b')](_0xdb2a('0x102'),_0x3cecd2[_0xdb2a('0x5f')]['channel'],_0xdb2a('0x103')),![]);return _0x1b86b8[_0xdb2a('0x31')](_0x33cad2);});default:return respondWithRpcPromise(_0xdb2a('0xf3'),_0xdb2a('0xf6'),{'id':_0x1b86b8['id'],'name':_0x1b86b8[_0xdb2a('0x3e')],'pause':![]})[_0xdb2a('0x32')](function(){return db[_0xdb2a('0xb1')]['update']({'paused':0x0},{'where':{'UserId':_0x1b86b8['id']}});})[_0xdb2a('0x32')](function(){return db[_0xdb2a('0xe5')]['findAll']({'where':{'membername':_0x1b86b8['name'],'type':_0xdb2a('0xea'),'exitAt':null}});})['then'](function(_0x53cd8b){var _0xa375b7=[];_0x53cd8b['forEach'](function(_0x2b6b0b){_0xa375b7['push'](_0x2b6b0b[_0xdb2a('0x31')]({'exitAt':moment()['format'](_0xdb2a('0xe7')),'data2':_0xdb2a('0xfe')}));});return BPromise[_0xdb2a('0xf1')](_0xa375b7);})[_0xdb2a('0x32')](function(){return _0x1b86b8[_0xdb2a('0x31')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x38cea4,null))['catch'](handleError(_0x38cea4,null));};exports[_0xdb2a('0x104')]=function(_0x59e146,_0x16d904,_0x48f345){var _0x4a42ee={};var _0x43cb65={};var _0x4d02e7;var _0x48e0bc;return db['User']['findOne']({'where':{'id':_0x59e146['params']['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x16d904,null))[_0xdb2a('0x32')](function(_0x75e474){if(_0x75e474){_0x4d02e7=_0x75e474;_0x43cb65[_0xdb2a('0x4a')]=_[_0xdb2a('0x47')](db['Team'][_0xdb2a('0x5c')]);_0x43cb65[_0xdb2a('0x46')]=_['keys'](_0x59e146[_0xdb2a('0x46')]);_0x43cb65[_0xdb2a('0x48')]=_['intersection'](_0x43cb65[_0xdb2a('0x4a')],_0x43cb65[_0xdb2a('0x46')]);_0x4a42ee[_0xdb2a('0x4b')]=_[_0xdb2a('0x49')](_0x43cb65[_0xdb2a('0x4a')],qs[_0xdb2a('0x4c')](_0x59e146[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x4a42ee[_0xdb2a('0x4b')]=_0x4a42ee[_0xdb2a('0x4b')][_0xdb2a('0x77')]?_0x4a42ee['attributes']:_0x43cb65[_0xdb2a('0x4a')];_0x4a42ee[_0xdb2a('0xc6')]=qs[_0xdb2a('0x4f')](_0x59e146[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x4a42ee[_0xdb2a('0x50')]=qs[_0xdb2a('0x48')](_['pick'](_0x59e146[_0xdb2a('0x46')],_0x43cb65[_0xdb2a('0x48')]));if(_0x59e146[_0xdb2a('0x46')][_0xdb2a('0x39')]){_0x4a42ee[_0xdb2a('0x50')]=_[_0xdb2a('0x52')](_0x4a42ee[_0xdb2a('0x50')],{'$or':_['map'](_0x4a42ee[_0xdb2a('0x4b')],function(_0x23cd6b){var _0x101719={};_0x101719[_0x23cd6b]={'$like':'%'+_0x59e146[_0xdb2a('0x46')][_0xdb2a('0x39')]+'%'};return _0x101719;})});}_0x4a42ee=_[_0xdb2a('0x52')]({},_0x4a42ee,_0x59e146[_0xdb2a('0x54')]);return _0x4d02e7[_0xdb2a('0x104')](_0x4a42ee);}})[_0xdb2a('0x32')](function(_0x27180b){if(_0x27180b){_0x48e0bc=_0x27180b[_0xdb2a('0x77')];if(!_0x59e146[_0xdb2a('0x46')][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x4a42ee[_0xdb2a('0x2b')]=qs[_0xdb2a('0x2b')](_0x59e146['query'][_0xdb2a('0x2b')]);_0x4a42ee[_0xdb2a('0x2a')]=qs['offset'](_0x59e146[_0xdb2a('0x46')][_0xdb2a('0x2a')]);}return _0x4d02e7[_0xdb2a('0x104')](_0x4a42ee);}})[_0xdb2a('0x32')](function(_0x5569ee){if(_0x5569ee){return _0x5569ee?{'count':_0x48e0bc,'rows':_0x5569ee}:null;}})[_0xdb2a('0x32')](respondWithResult(_0x16d904,null))[_0xdb2a('0x24')](handleError(_0x16d904,null));};exports['addTeams']=function(_0x38c741,_0x4ddd39){return db[_0xdb2a('0x55')][_0xdb2a('0x5d')]({'where':{'id':_0x38c741[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x4ddd39,null))['then'](function(_0x4cbcd6){if(_0x4cbcd6){var _0x276669=_0x4cbcd6[_0xdb2a('0x34')]({'plain':!![]});return _0x4cbcd6['addTeams'](_0x38c741[_0xdb2a('0x5f')][_0xdb2a('0x62')],_[_0xdb2a('0x63')](_0x38c741[_0xdb2a('0x5f')],['ids','id'])||{})[_0xdb2a('0x32')](function(){for(var _0x12c866=0x0;_0x12c866<_0x38c741[_0xdb2a('0x5f')][_0xdb2a('0x62')][_0xdb2a('0x77')];_0x12c866++){var _0x5c42ed=[];db[_0xdb2a('0x105')][_0xdb2a('0x8d')]({'where':{'id':_0x38c741[_0xdb2a('0x5f')]['ids'][_0x12c866]}})[_0xdb2a('0x32')](function(_0x4c25fe){_0x5c42ed[_0xdb2a('0xa7')](_0x4c25fe[_0xdb2a('0x106')]()[_0xdb2a('0x32')](function(_0x258d65){for(var _0x5f49d1=0x0;_0x5f49d1<_0x258d65[_0xdb2a('0x77')];_0x5f49d1++){_0x258d65[_0x5f49d1][_0xdb2a('0x107')]('channel',_0xdb2a('0x108'));}return _0x258d65;}));_0x5c42ed[_0xdb2a('0xa7')](_0x4c25fe[_0xdb2a('0x109')]()[_0xdb2a('0x32')](function(_0x375f00){for(var _0x3ba98a=0x0;_0x3ba98a<_0x375f00['length'];_0x3ba98a++){_0x375f00[_0x3ba98a][_0xdb2a('0x107')]('channel',_0xdb2a('0x10a'));}return _0x375f00;}));_0x5c42ed['push'](_0x4c25fe['getMailQueues']()['then'](function(_0x25cbc9){for(var _0x440aac=0x0;_0x440aac<_0x25cbc9[_0xdb2a('0x77')];_0x440aac++){_0x25cbc9[_0x440aac][_0xdb2a('0x107')](_0xdb2a('0x99'),_0xdb2a('0x10b'));}return _0x25cbc9;}));_0x5c42ed[_0xdb2a('0xa7')](_0x4c25fe[_0xdb2a('0x10c')]()[_0xdb2a('0x32')](function(_0x3d7bc4){for(var _0xc48310=0x0;_0xc48310<_0x3d7bc4[_0xdb2a('0x77')];_0xc48310++){_0x3d7bc4[_0xc48310][_0xdb2a('0x107')](_0xdb2a('0x99'),_0xdb2a('0x10d'));}return _0x3d7bc4;}));_0x5c42ed[_0xdb2a('0xa7')](_0x4c25fe[_0xdb2a('0x10e')]()[_0xdb2a('0x32')](function(_0x1f39dc){for(var _0x310c7e=0x0;_0x310c7e<_0x1f39dc[_0xdb2a('0x77')];_0x310c7e++){_0x1f39dc[_0x310c7e][_0xdb2a('0x107')]('channel',_0xdb2a('0x10f'));}return _0x1f39dc;}));_0x5c42ed['push'](_0x4c25fe[_0xdb2a('0x110')]()['then'](function(_0x25f7bd){for(var _0x4845b6=0x0;_0x4845b6<_0x25f7bd[_0xdb2a('0x77')];_0x4845b6++){_0x25f7bd[_0x4845b6]['setDataValue'](_0xdb2a('0x99'),_0xdb2a('0x111'));}return _0x25f7bd;}));_0x5c42ed[_0xdb2a('0xa7')](_0x4c25fe[_0xdb2a('0x112')]()[_0xdb2a('0x32')](function(_0x1b9674){for(var _0x559c0d=0x0;_0x559c0d<_0x1b9674['length'];_0x559c0d++){_0x1b9674[_0x559c0d]['setDataValue'](_0xdb2a('0x99'),_0xdb2a('0x113'));}return _0x1b9674;}));return BPromise[_0xdb2a('0xf1')](_0x5c42ed);})[_0xdb2a('0x32')](function(_0x20c602){var _0x317625=_['flatten'](_0x20c602);_0x5c42ed=[];return db[_0xdb2a('0x53')][_0xdb2a('0x114')](function(_0x3c278d){for(var _0x2b181a=0x0;_0x2b181a<_0x317625['length'];_0x2b181a++){_0x5c42ed[_0xdb2a('0xa7')](_0x317625[_0x2b181a][_0xdb2a('0x115')](_0x276669['id']),{'transaction':_0x3c278d});}return BPromise[_0xdb2a('0xf1')](_0x5c42ed)[_0xdb2a('0x32')](function(){if(_0x276669[_0xdb2a('0x9a')]){return BPromise[_0xdb2a('0xaa')](_['filter'](_0x317625,function(_0x238a59){return _0x238a59[_0xdb2a('0x116')](_0xdb2a('0x99'))===_0xdb2a('0x108');}),function(_0x1fbcc7){return db['UserVoiceQueueRt'][_0xdb2a('0xab')]({'membername':_0x276669[_0xdb2a('0x3e')],'UserId':_0x276669['id'],'queue_name':_0x1fbcc7['name'],'VoiceQueueId':_0x1fbcc7['id'],'interface':_[_0xdb2a('0x74')](_0x276669[_0xdb2a('0x9c')])?util['format'](_0xdb2a('0xa8'),_0x276669[_0xdb2a('0x3e')]):_0x276669['interface'],'paused':_0x276669[_0xdb2a('0xa9')]||![],'penalty':_0x276669[_0xdb2a('0xa0')]},{'transaction':_0x3c278d});});}else{return;}})[_0xdb2a('0x32')](function(){for(var _0x11170e=0x0;_0x11170e<_0x317625[_0xdb2a('0x77')];_0x11170e++){var _0x40caba=_0x317625[_0x11170e][_0xdb2a('0x116')](_0xdb2a('0x99'));var _0x2f8fc8=_0x40caba+_0xdb2a('0xa2');socket['emit'](_0xdb2a('0x36')+_0x40caba+'Queue:save',{'UserId':_0x276669['id'],['queueField']:_0x317625[_0x11170e]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x4ddd39,null))[_0xdb2a('0x24')](handleError(_0x4ddd39,null));};exports['removeTeams']=function(_0x146df3,_0x1426a5){return db[_0xdb2a('0x55')]['findOne']({'where':{'id':_0x146df3['params']['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x1426a5,null))[_0xdb2a('0x32')](function(_0x27d63b){if(_0x27d63b){var _0x318160=_0x27d63b['get']({'plain':!![]});var _0x16f2a2=_0x146df3['query']['ids'];return _0x27d63b[_0xdb2a('0x117')](_0x16f2a2)[_0xdb2a('0x32')](function(){for(var _0x3fe0e3=0x0;_0x3fe0e3<_0x16f2a2[_0xdb2a('0x77')];_0x3fe0e3++){var _0x1d1d2f=[];db['Team'][_0xdb2a('0x8d')]({'where':{'id':_0x16f2a2[_0x3fe0e3]}})[_0xdb2a('0x32')](function(_0x3ee821){_0x1d1d2f[_0xdb2a('0xa7')](_0x3ee821[_0xdb2a('0x106')]()[_0xdb2a('0x32')](function(_0x45e4f0){for(var _0x4650be=0x0;_0x4650be<_0x45e4f0['length'];_0x4650be++){_0x45e4f0[_0x4650be][_0xdb2a('0x107')](_0xdb2a('0x99'),_0xdb2a('0x108'));}return _0x45e4f0;}));_0x1d1d2f[_0xdb2a('0xa7')](_0x3ee821[_0xdb2a('0x109')]()['then'](function(_0x39f321){for(var _0x47f082=0x0;_0x47f082<_0x39f321[_0xdb2a('0x77')];_0x47f082++){_0x39f321[_0x47f082][_0xdb2a('0x107')](_0xdb2a('0x99'),_0xdb2a('0x10a'));}return _0x39f321;}));_0x1d1d2f[_0xdb2a('0xa7')](_0x3ee821[_0xdb2a('0x118')]()['then'](function(_0x575b7f){for(var _0x4d6931=0x0;_0x4d6931<_0x575b7f[_0xdb2a('0x77')];_0x4d6931++){_0x575b7f[_0x4d6931][_0xdb2a('0x107')](_0xdb2a('0x99'),'Mail');}return _0x575b7f;}));_0x1d1d2f[_0xdb2a('0xa7')](_0x3ee821['getSmsQueues']()[_0xdb2a('0x32')](function(_0x2bfc3f){for(var _0xf3d782=0x0;_0xf3d782<_0x2bfc3f[_0xdb2a('0x77')];_0xf3d782++){_0x2bfc3f[_0xf3d782][_0xdb2a('0x107')](_0xdb2a('0x99'),_0xdb2a('0x10d'));}return _0x2bfc3f;}));_0x1d1d2f[_0xdb2a('0xa7')](_0x3ee821[_0xdb2a('0x10e')]()['then'](function(_0x3748ac){for(var _0x234178=0x0;_0x234178<_0x3748ac['length'];_0x234178++){_0x3748ac[_0x234178][_0xdb2a('0x107')](_0xdb2a('0x99'),_0xdb2a('0x10f'));}return _0x3748ac;}));_0x1d1d2f[_0xdb2a('0xa7')](_0x3ee821[_0xdb2a('0x110')]()[_0xdb2a('0x32')](function(_0x662adf){for(var _0xc147b7=0x0;_0xc147b7<_0x662adf[_0xdb2a('0x77')];_0xc147b7++){_0x662adf[_0xc147b7]['setDataValue'](_0xdb2a('0x99'),_0xdb2a('0x111'));}return _0x662adf;}));_0x1d1d2f[_0xdb2a('0xa7')](_0x3ee821[_0xdb2a('0x112')]()[_0xdb2a('0x32')](function(_0x2a600a){for(var _0x2e25a6=0x0;_0x2e25a6<_0x2a600a[_0xdb2a('0x77')];_0x2e25a6++){_0x2a600a[_0x2e25a6][_0xdb2a('0x107')](_0xdb2a('0x99'),_0xdb2a('0x113'));}return _0x2a600a;}));return BPromise['all'](_0x1d1d2f);})[_0xdb2a('0x32')](function(_0x2932a5){var _0x14f0d9=_[_0xdb2a('0x119')](_0x2932a5);_0x1d1d2f=[];return db[_0xdb2a('0x53')]['transaction'](function(_0x1bcba7){for(var _0x166fc3=0x0;_0x166fc3<_0x14f0d9[_0xdb2a('0x77')];_0x166fc3++){_0x1d1d2f[_0xdb2a('0xa7')](_0x14f0d9[_0x166fc3][_0xdb2a('0x11a')](_0x318160['id']),{'transaction':_0x1bcba7});}return BPromise[_0xdb2a('0xf1')](_0x1d1d2f)['then'](function(){if(_0x318160[_0xdb2a('0x9a')]){return BPromise['each'](_[_0xdb2a('0x39')](_0x14f0d9,function(_0x1be467){return _0x1be467[_0xdb2a('0x116')](_0xdb2a('0x99'))==='Voice';}),function(_0x84b156){return db[_0xdb2a('0xb1')][_0xdb2a('0x33')]({'where':{'VoiceQueueId':_0x84b156['id'],'UserId':_0x318160['id']},'transaction':_0x1bcba7});});}else{return;}})['then'](function(){for(var _0x3a9de3=0x0;_0x3a9de3<_0x14f0d9[_0xdb2a('0x77')];_0x3a9de3++){var _0x2b2f79=_0x14f0d9[_0x3a9de3][_0xdb2a('0x116')](_0xdb2a('0x99'));var _0x1adb5d=_0x2b2f79+_0xdb2a('0xa2');socket[_0xdb2a('0xa3')](_0xdb2a('0x36')+_0x2b2f79+'Queue:remove',{'UserId':_0x318160['id'],['queueField']:_0x14f0d9[_0x3a9de3]['id']});}});});});}});}})[_0xdb2a('0x32')](respondWithStatusCode(_0x1426a5,null))[_0xdb2a('0x24')](handleError(_0x1426a5,null));};exports[_0xdb2a('0x11b')]=function(_0x50ece4,_0x35246b,_0x28e95d){var _0x171163={};var _0x568462={};var _0x486f40;var _0x5dab31;return db[_0xdb2a('0x55')][_0xdb2a('0x8d')]({'where':{'id':_0x50ece4[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x35246b,null))[_0xdb2a('0x32')](function(_0x388288){if(_0x388288){_0x486f40=_0x388288;_0x568462['model']=_[_0xdb2a('0x47')](db[_0xdb2a('0x11c')][_0xdb2a('0x5c')]);_0x568462[_0xdb2a('0x46')]=_[_0xdb2a('0x47')](_0x50ece4[_0xdb2a('0x46')]);_0x568462[_0xdb2a('0x48')]=_[_0xdb2a('0x49')](_0x568462[_0xdb2a('0x4a')],_0x568462['query']);_0x171163['attributes']=_[_0xdb2a('0x49')](_0x568462['model'],qs[_0xdb2a('0x4c')](_0x50ece4[_0xdb2a('0x46')]['fields']));_0x171163['attributes']=_0x171163[_0xdb2a('0x4b')][_0xdb2a('0x77')]?_0x171163['attributes']:_0x568462[_0xdb2a('0x4a')];_0x171163[_0xdb2a('0xc6')]=qs[_0xdb2a('0x4f')](_0x50ece4[_0xdb2a('0x46')]['sort']);_0x171163[_0xdb2a('0x50')]=qs[_0xdb2a('0x48')](_['pick'](_0x50ece4[_0xdb2a('0x46')],_0x568462[_0xdb2a('0x48')]));if(_0x50ece4[_0xdb2a('0x46')]['filter']){_0x171163['where']=_[_0xdb2a('0x52')](_0x171163['where'],{'$or':_['map'](_0x171163['attributes'],function(_0x56ea63){var _0xf72003={};_0xf72003[_0x56ea63]={'$like':'%'+_0x50ece4['query']['filter']+'%'};return _0xf72003;})});}_0x171163=_['merge']({},_0x171163,_0x50ece4['options']);return _0x486f40[_0xdb2a('0x11b')](_0x171163);}})[_0xdb2a('0x32')](function(_0x572e50){if(_0x572e50){_0x5dab31=_0x572e50[_0xdb2a('0x77')];if(!_0x50ece4[_0xdb2a('0x46')][_0xdb2a('0x4d')](_0xdb2a('0x4e'))){_0x171163[_0xdb2a('0x2b')]=qs[_0xdb2a('0x2b')](_0x50ece4[_0xdb2a('0x46')]['limit']);_0x171163[_0xdb2a('0x2a')]=qs[_0xdb2a('0x2a')](_0x50ece4[_0xdb2a('0x46')][_0xdb2a('0x2a')]);}return _0x486f40['getLists'](_0x171163);}})[_0xdb2a('0x32')](function(_0x4e7c05){if(_0x4e7c05){return _0x4e7c05?{'count':_0x5dab31,'rows':_0x4e7c05}:null;}})['then'](respondWithResult(_0x35246b,null))[_0xdb2a('0x24')](handleError(_0x35246b,null));};exports[_0xdb2a('0x11d')]=function(_0x38614e,_0x5bf0d5,_0x2a3cb5){var _0x53d380={};var _0x228d7b={};var _0x4f1bf7;var _0x5496ce;return db[_0xdb2a('0x55')][_0xdb2a('0x8d')]({'where':{'id':_0x38614e[_0xdb2a('0x5a')]['id']}})[_0xdb2a('0x32')](handleEntityNotFound(_0x5bf0d5,null))[_0xdb2a('0x32')](function(_0x1c9848){if(_0x1c9848){_0x4f1bf7=_0x1c9848;_0x228d7b['model']=_['keys'](db[_0xdb2a('0x55')][_0xdb2a('0x5c')]);_0x228d7b['query']=_['keys'](_0x38614e['query']);_0x228d7b['filters']=_[_0xdb2a('0x49')](_0x228d7b[_0xdb2a('0x4a')],_0x228d7b[_0xdb2a('0x46')]);_0x53d380[_0xdb2a('0x4b')]=_[_0xdb2a('0x49')](_0x228d7b['model'],qs[_0xdb2a('0x4c')](_0x38614e[_0xdb2a('0x46')][_0xdb2a('0x4c')]));_0x53d380['attributes']=_0x53d380[_0xdb2a('0x4b')]['length']?_0x53d380[_0xdb2a('0x4b')]:_0x228d7b[_0xdb2a('0x4a')];_0x53d380[_0xdb2a('0xc6')]=qs[_0xdb2a('0x4f')](_0x38614e[_0xdb2a('0x46')][_0xdb2a('0x4f')]);_0x53d380['where']=qs[_0xdb2a('0x48')](_['pick'](_0x38614e['query'],_0x228d7b[_0xdb2a('0x48')]));if(_0x38614e[_0xdb2a('0x46')][_0xdb2a('0x39')]){_0x53d380[_0xdb2a('0x50')]=_[_0xdb2a('0x52')](_0x53d380[_0xdb2a('0x50')],{'$or':_['map'](_0x53d380['attributes'],function(_0x23c40c){var _0xd6e362={};_0xd6e362[_0x23c40c]={'$like':'%'+_0x38614e[_0xdb2a('0x46')][_0xdb2a('0x39')]+'%'};return _0xd6e362;})});}_0x53d380['model']=db['User'];_0x53d380['as']='Agents';_0x53d380=_[_0xdb2a('0x52')]({},_0x53d380,_0x38614e[_0xdb2a('0x54')]);return _0x4f1bf7[_0xdb2a('0x106')]({'include':[_0x53d380]});}})[_0xdb2a('0x32')](function(_0x554bed){if(_0x554bed){var _0x1e3b58={},_0xfa603b=[],_0x2e9814=0x0;for(var _0x1893c0=0x0;_0x1893c0<_0x554bed['length'];_0x1893c0+=0x1){for(var _0x29bbf4=0x0,_0x4c5cf7;_0x29bbf4<_0x554bed[_0x1893c0]['Agents'][_0xdb2a('0x77')];_0x29bbf4+=0x1){_0x4c5cf7=_0x554bed[_0x1893c0][_0xdb2a('0x37')][_0x29bbf4][_0xdb2a('0x34')]({'plain':!![]});_0x1e3b58[_0x4c5cf7['id']]=_0x4c5cf7;}}_0x1e3b58=_[_0xdb2a('0x11e')](_0x1e3b58);for(var _0x26ff06=qs[_0xdb2a('0x2a')](_0x38614e[_0xdb2a('0x46')][_0xdb2a('0x2a')]);_0x26ff06<_0x1e3b58[_0xdb2a('0x77')]&&_0xfa603b['length']=_0x26b624[_0x23db('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x23db('0xd')](function(){if(_0x527024){return db[_0x23db('0x43')][_0x23db('0x46')]({'where':{'membername':_0x527024[_0x23db('0x27')]},'individualHooks':!![]});}})[_0x23db('0xd')](function(){if(_0x527024){return _0x527024[_0x23db('0x51')]({'raw':!![]});}})[_0x23db('0xd')](function(_0x5dce92){if(_0x527024){if(_0x5dce92){var _0x3f162d=[];_0xa9eef4=_0x5dce92;if(_0xa9eef4[_0x23db('0x2b')]){for(var _0x1c48e0=0x0;_0x1c48e0<_0xa9eef4['length'];_0x1c48e0++){_0x3f162d[_0x23db('0x31')](db[_0x23db('0x43')][_0x23db('0x52')]({'membername':_0x527024['name'],'UserId':_0x527024['id'],'queue_name':_0xa9eef4[_0x1c48e0][_0x23db('0x27')],'VoiceQueueId':_0xa9eef4[_0x1c48e0]['id'],'interface':_0x3490e8,'paused':_0x527024[_0x23db('0x4a')]||![],'penalty':_0xa9eef4[_0x1c48e0][_0x23db('0x53')]||0x0}));}return BPromise['all'](_0x3f162d);}}}})[_0x23db('0xd')](function(){if(_0x527024){return db[_0x23db('0x36')][_0x23db('0x18')]({'where':{'membername':_0x527024[_0x23db('0x27')],'exitAt':null}});}})[_0x23db('0xd')](function(_0x2620f9){if(_0x527024){if(_0x2620f9&&_0x2620f9[_0x23db('0x2b')]){var _0x20c682=[];_0x2620f9[_0x23db('0x30')](function(_0x4ae0f4){_0x20c682[_0x23db('0x31')](_0x4ae0f4['update']({'exitAt':moment()[_0x23db('0x2c')](_0x23db('0x2d'))}));});return BPromise[_0x23db('0x45')](_0x20c682);}}})[_0x23db('0xd')](function(_0x4e388e){if(_0x527024){var _0x1a7929=[];var _0x2c0def=[];var _0x548671=utils[_0x23db('0x2f')]();var _0x2712d9={'membername':_0x527024['name'],'interface':_0x3490e8,'enterAt':moment()[_0x23db('0x2c')](_0x23db('0x2d')),'role':_0x527024[_0x23db('0x35')],'internal':_0x527024['internal']};_0x548671[_0x23db('0x30')](function(_0x399416){_0x1a7929[_0x23db('0x31')](_[_0x23db('0x54')]({'channel':_0x399416,'type':'LOGIN','data1':_0x23db('0x55'),'data2':_0x3490e8},_0x2712d9));if(_0x527024[_0x23db('0x4a')]){_0x2c0def[_0x23db('0x31')](_[_0x23db('0x54')]({'channel':_0x399416,'type':'PAUSE','data1':_0x23db('0x56')},_0x2712d9));}});return db['MemberReport'][_0x23db('0x37')](_0x1a7929['concat'](_0x2c0def),{'individualHooks':!![]});}})[_0x23db('0xd')](function(){if(_0x527024){return _0x527024[_0x23db('0x29')]({'online':!![],'lastLoginAt':moment()[_0x23db('0x2c')](_0x23db('0x2d')),'voicePause':_0x527024[_0x23db('0x4a')]||![],'mailPause':_0x527024['loginInPause']||![],'chatPause':_0x527024[_0x23db('0x4a')]||![],'faxPause':_0x527024[_0x23db('0x4a')]||![],'smsPause':_0x527024['loginInPause']||![],'openchannelPause':_0x527024['loginInPause']||![],'pauseType':_0x527024[_0x23db('0x4a')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x23db('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3490e8});}})['then'](function(_0x36906b){_0x2e2b8b(_0x36906b);})[_0x23db('0x25')](function(_0x5a516d){_0x2fd98c(_0x1c97a1[_0x23db('0x13')](0x1f4,_0x5a516d[_0x23db('0x15')]));});});}; \ No newline at end of file +var _0xcc4a=['mobile','loginInPause','SIP/%s','agent','../../config/license/util','getLicense','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','getChannels','merge','LOGIN','LOGININPAUSE','concat','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./user.socket','request','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','findAll','options','raw','where','attributes','limit','include','map','model','then','User','find','ShowUser','internal','interface','update','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','forEach','push','name','body','type','role','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','findOne','isValidChannel','Unknown\x20channel','channel','voice','UserVoiceQueueRt','system','mail','chat','fax','sms','set','Pause','all','LogoutUser','LoginUser'];(function(_0x31680b,_0x3a82fe){var _0x28bd5c=function(_0x39f8d0){while(--_0x39f8d0){_0x31680b['push'](_0x31680b['shift']());}};_0x28bd5c(++_0x3a82fe);}(_0xcc4a,0xba));var _0xacc4=function(_0x3e665b,_0xc6e475){_0x3e665b=_0x3e665b-0x0;var _0x261ede=_0xcc4a[_0x3e665b];return _0x261ede;};'use strict';var _=require(_0xacc4('0x0'));var util=require(_0xacc4('0x1'));var moment=require(_0xacc4('0x2'));var BPromise=require('bluebird');var rs=require(_0xacc4('0x3'));var fs=require('fs');var Redis=require(_0xacc4('0x4'));var db=require(_0xacc4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xacc4('0x6'));var config=require(_0xacc4('0x7'));var jayson=require(_0xacc4('0x8'));var client=jayson[_0xacc4('0x9')][_0xacc4('0xa')]({'port':0x232a});config[_0xacc4('0xb')]=_['defaults'](config[_0xacc4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xacc4('0xc'))(new Redis(config[_0xacc4('0xb')]));require(_0xacc4('0xd'))['register'](socket);function respondWithRpcPromise(_0x557fd8,_0x1a1960,_0x333336){return new BPromise(function(_0x5dd9cb,_0x5b2c75){return client[_0xacc4('0xe')](_0x557fd8,_0x333336)['then'](function(_0x15e6d6){logger[_0xacc4('0xf')](_0xacc4('0x10'),_0x1a1960,_0xacc4('0x11'));logger['debug'](_0xacc4('0x12'),_0x1a1960,_0xacc4('0x11'),JSON[_0xacc4('0x13')](_0x15e6d6));if(_0x15e6d6[_0xacc4('0x14')]){if(_0x15e6d6[_0xacc4('0x14')][_0xacc4('0x15')]===0x1f4){logger['error'](_0xacc4('0x10'),_0x1a1960,_0x15e6d6[_0xacc4('0x14')][_0xacc4('0x16')]);return _0x5b2c75(_0x15e6d6[_0xacc4('0x14')][_0xacc4('0x16')]);}logger[_0xacc4('0x14')]('User,\x20%s,\x20%s',_0x1a1960,_0x15e6d6[_0xacc4('0x14')][_0xacc4('0x16')]);return _0x5dd9cb(_0x15e6d6[_0xacc4('0x14')][_0xacc4('0x16')]);}else{logger[_0xacc4('0xf')](_0xacc4('0x10'),_0x1a1960,_0xacc4('0x11'));_0x5dd9cb(_0x15e6d6[_0xacc4('0x17')][_0xacc4('0x16')]);}})[_0xacc4('0x18')](function(_0x542596){logger[_0xacc4('0x14')](_0xacc4('0x10'),_0x1a1960,_0x542596);_0x5b2c75(_0x542596);});});}exports[_0xacc4('0x19')]=function(_0x5893c3){var _0x241720=this;return new Promise(function(_0x5d95c1,_0x470ec9){return db['User'][_0xacc4('0x1a')]({'raw':_0x5893c3[_0xacc4('0x1b')]?_0x5893c3[_0xacc4('0x1b')][_0xacc4('0x1c')]===undefined?!![]:![]:!![],'where':_0x5893c3[_0xacc4('0x1b')]?_0x5893c3['options'][_0xacc4('0x1d')]||null:null,'attributes':_0x5893c3[_0xacc4('0x1b')]?_0x5893c3[_0xacc4('0x1b')][_0xacc4('0x1e')]||null:null,'limit':_0x5893c3[_0xacc4('0x1b')]?_0x5893c3['options'][_0xacc4('0x1f')]||null:null,'include':_0x5893c3['options']?_0x5893c3['options'][_0xacc4('0x20')]?_[_0xacc4('0x21')](_0x5893c3[_0xacc4('0x1b')][_0xacc4('0x20')],function(_0x940e14){return{'model':db[_0x940e14['model']],'as':_0x940e14['as'],'attributes':_0x940e14['attributes'],'include':_0x940e14[_0xacc4('0x20')]?_['map'](_0x940e14['include'],function(_0x45a297){return{'model':db[_0x45a297[_0xacc4('0x22')]],'as':_0x45a297['as'],'attributes':_0x45a297[_0xacc4('0x1e')],'include':_0x45a297[_0xacc4('0x20')]?_['map'](_0x45a297[_0xacc4('0x20')],function(_0x2cbead){return{'model':db[_0x2cbead[_0xacc4('0x22')]],'as':_0x2cbead['as'],'attributes':_0x2cbead['attributes']};}):[]};}):[]};}):[]:[]})[_0xacc4('0x23')](function(_0x403442){logger[_0xacc4('0xf')](_0xacc4('0x19'),_0x5893c3);logger['debug'](_0xacc4('0x19'),_0x5893c3,JSON[_0xacc4('0x13')](_0x403442));_0x5d95c1(_0x403442);})[_0xacc4('0x18')](function(_0x249ff0){logger[_0xacc4('0x14')](_0xacc4('0x19'),_0x249ff0[_0xacc4('0x16')],_0x5893c3);_0x470ec9(_0x241720[_0xacc4('0x14')](0x1f4,_0x249ff0[_0xacc4('0x16')]));});});};exports['ShowUser']=function(_0x262ff2){var _0x541784=this;return new Promise(function(_0x570d3c,_0x116e53){return db[_0xacc4('0x24')][_0xacc4('0x25')]({'raw':_0x262ff2[_0xacc4('0x1b')]?_0x262ff2['options'][_0xacc4('0x1c')]===undefined?!![]:![]:!![],'where':_0x262ff2[_0xacc4('0x1b')]?_0x262ff2[_0xacc4('0x1b')]['where']||null:null,'attributes':_0x262ff2[_0xacc4('0x1b')]?_0x262ff2[_0xacc4('0x1b')][_0xacc4('0x1e')]||null:null,'include':_0x262ff2[_0xacc4('0x1b')]?_0x262ff2[_0xacc4('0x1b')][_0xacc4('0x20')]?_[_0xacc4('0x21')](_0x262ff2['options'][_0xacc4('0x20')],function(_0x32bdec){return{'model':db[_0x32bdec[_0xacc4('0x22')]],'as':_0x32bdec['as'],'attributes':_0x32bdec[_0xacc4('0x1e')],'include':_0x32bdec[_0xacc4('0x20')]?_[_0xacc4('0x21')](_0x32bdec[_0xacc4('0x20')],function(_0x33b502){return{'model':db[_0x33b502[_0xacc4('0x22')]],'as':_0x33b502['as'],'attributes':_0x33b502[_0xacc4('0x1e')],'include':_0x33b502[_0xacc4('0x20')]?_[_0xacc4('0x21')](_0x33b502[_0xacc4('0x20')],function(_0xf0ba6e){return{'model':db[_0xf0ba6e[_0xacc4('0x22')]],'as':_0xf0ba6e['as'],'attributes':_0xf0ba6e['attributes']};}):[]};}):[]};}):[]:[]})[_0xacc4('0x23')](function(_0x5a0233){logger[_0xacc4('0xf')]('ShowUser',_0x262ff2);logger['debug'](_0xacc4('0x26'),_0x262ff2,JSON[_0xacc4('0x13')](_0x5a0233));_0x570d3c(_0x5a0233);})[_0xacc4('0x18')](function(_0x38cb64){logger[_0xacc4('0x14')](_0xacc4('0x26'),_0x38cb64[_0xacc4('0x16')],_0x262ff2);_0x116e53(_0x541784['error'](0x1f4,_0x38cb64['message']));});});};exports['PauseUser']=function(_0x4ae04d){var _0x428219=this;return new Promise(function(_0x51da1a,_0x3003a7){var _0x29badf;return db[_0xacc4('0x24')][_0xacc4('0x25')]({'where':_0x4ae04d[_0xacc4('0x1b')][_0xacc4('0x1d')]||{},'attributes':['id','name','role',_0xacc4('0x27'),_0xacc4('0x28')]})[_0xacc4('0x23')](function(_0x1b6701){if(_0x1b6701){_0x29badf=_0x1b6701;return db['UserVoiceQueueRt'][_0xacc4('0x29')]({'paused':0x1},{'where':{'UserId':_0x29badf['id']},'individualHooks':!![]});}})[_0xacc4('0x23')](function(){if(_0x29badf){return db[_0xacc4('0x2a')][_0xacc4('0x1a')]({'where':{'membername':_0x29badf['name'],'type':_0xacc4('0x2b'),'exitAt':null}});}})[_0xacc4('0x23')](function(_0x55e2b7){if(_0x29badf){if(_0x55e2b7&&_0x55e2b7['length']){var _0x3b2ed7=moment()[_0xacc4('0x2c')](_0xacc4('0x2d'));for(var _0x55dec3=0x0,_0x4aceb9=_0x55e2b7[_0xacc4('0x2e')];_0x55dec3<_0x4aceb9;_0x55dec3++){_0x55e2b7[_0x55dec3]['updateAttributes']({'exitAt':_0x3b2ed7});}}}})[_0xacc4('0x23')](function(){if(_0x29badf){var _0x2fa68a=[];var _0x176b1e=utils['getChannels']();_0x176b1e[_0xacc4('0x2f')](function(_0x15d644){_0x2fa68a[_0xacc4('0x30')]({'channel':_0x15d644,'membername':_0x29badf['name'],'interface':_['isNil'](_0x29badf[_0xacc4('0x28')])?util[_0xacc4('0x2c')]('SIP/%s',_0x29badf[_0xacc4('0x31')]):_0x29badf[_0xacc4('0x28')],'type':_0xacc4('0x2b'),'enterAt':moment()['format'](_0xacc4('0x2d')),'data1':_0x4ae04d[_0xacc4('0x32')][_0xacc4('0x33')]||'DEFAULT\x20PAUSE','role':_0x29badf[_0xacc4('0x34')],'internal':_0x29badf[_0xacc4('0x27')],'uniqueid':_0x4ae04d[_0xacc4('0x32')]['uniqueid']||null});});return db[_0xacc4('0x2a')][_0xacc4('0x35')](_0x2fa68a,{'individualHooks':!![]});}})['then'](function(){if(_0x29badf){return _0x29badf['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4ae04d[_0xacc4('0x32')][_0xacc4('0x33')]||_0xacc4('0x36'),'lastPauseAt':moment()[_0xacc4('0x2c')](_0xacc4('0x2d'))});}})[_0xacc4('0x23')](function(_0x54ce37){_0x51da1a(_0x54ce37);})['catch'](function(_0x3b07db){_0x3003a7(_0x428219[_0xacc4('0x14')](0x1f4,_0x3b07db[_0xacc4('0x16')]));});});};exports[_0xacc4('0x37')]=function(_0x126656){var _0x1e7ce4=this;return new Promise(function(_0xf6bbf1,_0x4f4cb5){var _0x2e6432;return db[_0xacc4('0x24')][_0xacc4('0x38')]({'where':_0x126656[_0xacc4('0x1b')][_0xacc4('0x1d')]||{},'attributes':['id',_0xacc4('0x31')]})[_0xacc4('0x23')](function(_0x2ebab6){if(_0x2ebab6){_0x2e6432=_0x2ebab6;if(_0x126656[_0xacc4('0x32')]['channel']&&!utils[_0xacc4('0x39')](_0x126656[_0xacc4('0x32')]['channel'])){throw new Error(_0xacc4('0x3a'));}switch(_0x126656[_0xacc4('0x32')][_0xacc4('0x3b')]){case _0xacc4('0x3c'):return db[_0xacc4('0x3d')][_0xacc4('0x29')]({'paused':0x0},{'where':{'UserId':_0x2e6432['id']}})[_0xacc4('0x23')](function(){return db[_0xacc4('0x2a')][_0xacc4('0x25')]({'where':{'channel':_0x126656[_0xacc4('0x32')][_0xacc4('0x3b')],'membername':_0x2e6432['name'],'type':_0xacc4('0x2b'),'exitAt':null}});})[_0xacc4('0x23')](function(_0x46095d){if(_0x46095d){return _0x46095d['update']({'exitAt':moment()[_0xacc4('0x2c')](_0xacc4('0x2d')),'data2':_0xacc4('0x3e')},{'individualHooks':!![]});}return null;})[_0xacc4('0x23')](function(){return _0x2e6432[_0xacc4('0x29')]({'voicePause':![]});});case _0xacc4('0x3f'):case _0xacc4('0x40'):case _0xacc4('0x41'):case _0xacc4('0x42'):case'openchannel':return db[_0xacc4('0x2a')][_0xacc4('0x25')]({'where':{'channel':_0x126656[_0xacc4('0x32')]['channel'],'membername':_0x2e6432[_0xacc4('0x31')],'type':_0xacc4('0x2b'),'exitAt':null}})[_0xacc4('0x23')](function(_0x2ae5a4){return _0x2ae5a4['update']({'exitAt':moment()[_0xacc4('0x2c')](_0xacc4('0x2d')),'data2':_0xacc4('0x3e')},{'individualHooks':!![]});})[_0xacc4('0x23')](function(){var _0x13be0e={};_[_0xacc4('0x43')](_0x13be0e,util[_0xacc4('0x2c')]('%s%s',_0x126656['body'][_0xacc4('0x3b')],_0xacc4('0x44')),![]);return _0x2e6432[_0xacc4('0x29')](_0x13be0e);});default:return db[_0xacc4('0x3d')][_0xacc4('0x29')]({'paused':0x0},{'where':{'UserId':_0x2e6432['id']}})[_0xacc4('0x23')](function(){return db[_0xacc4('0x2a')][_0xacc4('0x1a')]({'where':{'membername':_0x2e6432[_0xacc4('0x31')],'type':_0xacc4('0x2b'),'exitAt':null}});})[_0xacc4('0x23')](function(_0x17d9dc){var _0x83a2ea=[];_0x17d9dc[_0xacc4('0x2f')](function(_0x192ed2){_0x83a2ea[_0xacc4('0x30')](_0x192ed2[_0xacc4('0x29')]({'exitAt':moment()[_0xacc4('0x2c')](_0xacc4('0x2d')),'data2':_0xacc4('0x3e')}));});return BPromise[_0xacc4('0x45')](_0x83a2ea);})['then'](function(){return _0x2e6432[_0xacc4('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](function(_0x28bbcc){_0xf6bbf1(_0x28bbcc);})[_0xacc4('0x18')](function(_0x2bb362){_0x4f4cb5(_0x1e7ce4[_0xacc4('0x14')](0x1f4,_0x2bb362[_0xacc4('0x16')]));});});};exports[_0xacc4('0x46')]=function(_0x41e0b2){var _0x5b35bd=this;return new Promise(function(_0x2dd555,_0x5ee387){var _0xd0ecb3;return db[_0xacc4('0x24')][_0xacc4('0x38')]({'where':_0x41e0b2[_0xacc4('0x1b')][_0xacc4('0x1d')]||{},'attributes':['id',_0xacc4('0x31')]})[_0xacc4('0x23')](function(_0x3bd13e){if(_0x3bd13e){_0xd0ecb3=_0x3bd13e;return db[_0xacc4('0x3d')]['destroy']({'where':{'membername':_0xd0ecb3[_0xacc4('0x31')]},'individualHooks':!![]});}})['then'](function(){if(_0xd0ecb3){return db[_0xacc4('0x2a')][_0xacc4('0x1a')]({'where':{'membername':_0xd0ecb3[_0xacc4('0x31')],'exitAt':null}});}})[_0xacc4('0x23')](function(_0x2a505b){if(_0xd0ecb3){if(_0x2a505b&&_0x2a505b['length']){var _0x5cff7a=[];_0x2a505b['forEach'](function(_0x4ea7d4){_0x5cff7a[_0xacc4('0x30')](_0x4ea7d4[_0xacc4('0x29')]({'exitAt':moment()[_0xacc4('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xacc4('0x45')](_0x5cff7a);}}})[_0xacc4('0x23')](function(){if(_0xd0ecb3){return _0xd0ecb3[_0xacc4('0x29')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xacc4('0x23')](function(_0x5c0c01){_0x2dd555(_0x5c0c01);})[_0xacc4('0x18')](function(_0x127eae){_0x5ee387(_0x5b35bd[_0xacc4('0x14')](0x1f4,_0x127eae[_0xacc4('0x16')]));});});};exports[_0xacc4('0x47')]=function(_0xd650f2){var _0x3f5b47=this;return new Promise(function(_0x40b1e0,_0x44cea7){var _0x2754b9;var _0x222b9e;var _0x2150b3;var _0xbec5ac;return db['User'][_0xacc4('0x38')]({'where':_0xd650f2[_0xacc4('0x1b')][_0xacc4('0x1d')]||{},'attributes':['id',_0xacc4('0x31'),'role',_0xacc4('0x48'),'phone','internal',_0xacc4('0x49'),_0xacc4('0x28')]})[_0xacc4('0x23')](function(_0x55ecbe){if(_0x55ecbe){_0x2754b9=_0x55ecbe;_0xbec5ac=_0xd650f2[_0xacc4('0x32')]['interface']?_0xd650f2['body'][_0xacc4('0x28')]:util['format'](_0xacc4('0x4a'),_0x2754b9['name']);return db['User']['count']({'where':{'role':_0xacc4('0x4b'),'online':!![],'id':{'$ne':_0x2754b9['id']}}});}})[_0xacc4('0x23')](function(_0x59c2cc){if(_0x59c2cc){_0x2150b3=_0x59c2cc;return require(_0xacc4('0x4c'))[_0xacc4('0x4d')]();}})[_0xacc4('0x23')](function(_0x4d4a5b){if(_0x4d4a5b&&_0x4d4a5b['agents']&&_0x2150b3>=_0x4d4a5b['agents']){throw new Error(_0xacc4('0x4e'));}})[_0xacc4('0x23')](function(){if(_0x2754b9){return db[_0xacc4('0x3d')]['destroy']({'where':{'membername':_0x2754b9['name']},'individualHooks':!![]});}})[_0xacc4('0x23')](function(){if(_0x2754b9){return _0x2754b9[_0xacc4('0x4f')]({'raw':!![]});}})[_0xacc4('0x23')](function(_0x5a4993){if(_0x2754b9){if(_0x5a4993){var _0x533726=[];_0x222b9e=_0x5a4993;if(_0x222b9e[_0xacc4('0x2e')]){for(var _0x1c172f=0x0;_0x1c172f<_0x222b9e[_0xacc4('0x2e')];_0x1c172f++){_0x533726[_0xacc4('0x30')](db[_0xacc4('0x3d')][_0xacc4('0x50')]({'membername':_0x2754b9[_0xacc4('0x31')],'UserId':_0x2754b9['id'],'queue_name':_0x222b9e[_0x1c172f][_0xacc4('0x31')],'VoiceQueueId':_0x222b9e[_0x1c172f]['id'],'interface':_0xbec5ac,'paused':_0x2754b9[_0xacc4('0x49')]||![],'penalty':_0x222b9e[_0x1c172f]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x533726);}}}})[_0xacc4('0x23')](function(){if(_0x2754b9){return db[_0xacc4('0x2a')]['findAll']({'where':{'membername':_0x2754b9['name'],'exitAt':null}});}})[_0xacc4('0x23')](function(_0x1f6c3f){if(_0x2754b9){if(_0x1f6c3f&&_0x1f6c3f[_0xacc4('0x2e')]){var _0xcef1e8=[];_0x1f6c3f['forEach'](function(_0xf45853){_0xcef1e8[_0xacc4('0x30')](_0xf45853[_0xacc4('0x29')]({'exitAt':moment()[_0xacc4('0x2c')](_0xacc4('0x2d'))}));});return BPromise[_0xacc4('0x45')](_0xcef1e8);}}})[_0xacc4('0x23')](function(_0x1a8087){if(_0x2754b9){var _0x4d63f3=[];var _0x202629=[];var _0x2ab12c=utils[_0xacc4('0x51')]();var _0xa46cf3={'membername':_0x2754b9[_0xacc4('0x31')],'interface':_0xbec5ac,'enterAt':moment()[_0xacc4('0x2c')](_0xacc4('0x2d')),'role':_0x2754b9[_0xacc4('0x34')],'internal':_0x2754b9[_0xacc4('0x27')]};_0x2ab12c['forEach'](function(_0x13f5af){_0x4d63f3['push'](_[_0xacc4('0x52')]({'channel':_0x13f5af,'type':_0xacc4('0x53'),'data1':'callysquare','data2':_0xbec5ac},_0xa46cf3));if(_0x2754b9[_0xacc4('0x49')]){_0x202629[_0xacc4('0x30')](_[_0xacc4('0x52')]({'channel':_0x13f5af,'type':_0xacc4('0x2b'),'data1':_0xacc4('0x54')},_0xa46cf3));}});return db[_0xacc4('0x2a')][_0xacc4('0x35')](_0x4d63f3[_0xacc4('0x55')](_0x202629),{'individualHooks':!![]});}})[_0xacc4('0x23')](function(){if(_0x2754b9){return _0x2754b9[_0xacc4('0x29')]({'online':!![],'lastLoginAt':moment()['format'](_0xacc4('0x2d')),'voicePause':_0x2754b9[_0xacc4('0x49')]||![],'mailPause':_0x2754b9[_0xacc4('0x49')]||![],'chatPause':_0x2754b9[_0xacc4('0x49')]||![],'faxPause':_0x2754b9[_0xacc4('0x49')]||![],'smsPause':_0x2754b9[_0xacc4('0x49')]||![],'openchannelPause':_0x2754b9['loginInPause']||![],'pauseType':_0x2754b9[_0xacc4('0x49')]?_0xacc4('0x54'):null,'lastPauseAt':moment()[_0xacc4('0x2c')](_0xacc4('0x2d')),'interface':_0xbec5ac});}})['then'](function(_0x4894a7){_0x40b1e0(_0x4894a7);})[_0xacc4('0x18')](function(_0x1bf576){_0x44cea7(_0x3f5b47['error'](0x1f4,_0x1bf576[_0xacc4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 5eb3d8d..a4feb1b 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 _0x66f3=['emit','register','length','user:','./user.events','save','remove','update'];(function(_0x3dbb67,_0xc55005){var _0x2d1b74=function(_0x50f863){while(--_0x50f863){_0x3dbb67['push'](_0x3dbb67['shift']());}};_0x2d1b74(++_0xc55005);}(_0x66f3,0xbc));var _0x366f=function(_0x4a1835,_0xe4a237){_0x4a1835=_0x4a1835-0x0;var _0x203f1b=_0x66f3[_0x4a1835];return _0x203f1b;};'use strict';var UserEvents=require(_0x366f('0x0'));var events=[_0x366f('0x1'),_0x366f('0x2'),_0x366f('0x3')];function createListener(_0x11ac54,_0x2483b1){return function(_0x87b42c){_0x2483b1[_0x366f('0x4')](_0x11ac54,_0x87b42c);};}function removeListener(_0x4a3ecd,_0x983bda){return function(){UserEvents['removeListener'](_0x4a3ecd,_0x983bda);};}exports[_0x366f('0x5')]=function(_0x5caca6){for(var _0x25168e=0x0,_0x5fba18=events[_0x366f('0x6')];_0x25168e<_0x5fba18;_0x25168e++){var _0x4b9513=events[_0x25168e];var _0x3cfbda=createListener(_0x366f('0x7')+_0x4b9513,_0x5caca6);UserEvents['on'](_0x4b9513,_0x3cfbda);}}; \ No newline at end of file +var _0xba09=['removeListener','save','remove','update','emit'];(function(_0x283eef,_0x4972ab){var _0x2db2f7=function(_0x6e2654){while(--_0x6e2654){_0x283eef['push'](_0x283eef['shift']());}};_0x2db2f7(++_0x4972ab);}(_0xba09,0x137));var _0x9ba0=function(_0x4ffd20,_0x1e83b6){_0x4ffd20=_0x4ffd20-0x0;var _0x49b5e2=_0xba09[_0x4ffd20];return _0x49b5e2;};'use strict';var UserEvents=require('./user.events');var events=[_0x9ba0('0x0'),_0x9ba0('0x1'),_0x9ba0('0x2')];function createListener(_0x3ca857,_0x5db1be){return function(_0x59ee9f){_0x5db1be[_0x9ba0('0x3')](_0x3ca857,_0x59ee9f);};}function removeListener(_0xaaaf81,_0x19242b){return function(){UserEvents[_0x9ba0('0x4')](_0xaaaf81,_0x19242b);};}exports['register']=function(_0x1f3371){for(var _0x2ecf55=0x0,_0x28adf3=events['length'];_0x2ecf55<_0x28adf3;_0x2ecf55++){var _0x2fb5c3=events[_0x2ecf55];var _0x29a531=createListener('user:'+_0x2fb5c3,_0x1f3371);UserEvents['on'](_0x2fb5c3,_0x29a531);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c25cee2..fd915f8 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 _0x9976=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x5794a3,_0x13eb5d){var _0x534c7c=function(_0x4c6f91){while(--_0x4c6f91){_0x5794a3['push'](_0x5794a3['shift']());}};_0x534c7c(++_0x13eb5d);}(_0x9976,0x11f));var _0x6997=function(_0x757e65,_0x300f53){_0x757e65=_0x757e65-0x0;var _0x2e7d9b=_0x9976[_0x757e65];return _0x2e7d9b;};'use strict';var multer=require(_0x6997('0x0'));var util=require(_0x6997('0x1'));var path=require(_0x6997('0x2'));var timeout=require(_0x6997('0x3'));var express=require(_0x6997('0x4'));var router=express[_0x6997('0x5')]();var auth=require(_0x6997('0x6'));var interaction=require(_0x6997('0x7'));var config=require('../../config/environment');module[_0x6997('0x8')]=router; \ No newline at end of file +var _0xd983=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x41bb88,_0x721dee){var _0x1c76d1=function(_0x2ae743){while(--_0x2ae743){_0x41bb88['push'](_0x41bb88['shift']());}};_0x1c76d1(++_0x721dee);}(_0xd983,0x7d));var _0x3d98=function(_0x3a3420,_0x21c7b4){_0x3a3420=_0x3a3420-0x0;var _0x555706=_0xd983[_0x3a3420];return _0x555706;};'use strict';var multer=require(_0x3d98('0x0'));var util=require(_0x3d98('0x1'));var path=require(_0x3d98('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d98('0x3'));var router=express[_0x3d98('0x4')]();var auth=require(_0x3d98('0x5'));var interaction=require(_0x3d98('0x6'));var config=require(_0x3d98('0x7'));module[_0x3d98('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ed9aa91..218ab03 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(_0x42a206,_0x2b1612){var _0x35eb3b=function(_0x3e5c46){while(--_0x3e5c46){_0x42a206['push'](_0x42a206['shift']());}};_0x35eb3b(++_0x2b1612);}(_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 _0xb10b=['sequelize','INTEGER'];(function(_0x253a69,_0x2d1753){var _0x3f852c=function(_0x1056e6){while(--_0x1056e6){_0x253a69['push'](_0x253a69['shift']());}};_0x3f852c(++_0x2d1753);}(_0xb10b,0x12a));var _0xbb10=function(_0x58321f,_0x5730b9){_0x58321f=_0x58321f-0x0;var _0x3728ea=_0xb10b[_0x58321f];return _0x3728ea;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'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 3566797..f1bbd0c 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 _0xaef9=['UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xaef9,0x182));var _0x9aef=function(_0x27acd4,_0x2cb514){_0x27acd4=_0x27acd4-0x0;var _0xa64ff3=_0xaef9[_0x27acd4];return _0xa64ff3;};'use strict';var _=require('lodash');var util=require(_0x9aef('0x0'));var logger=require(_0x9aef('0x1'))(_0x9aef('0x2'));var moment=require(_0x9aef('0x3'));var BPromise=require(_0x9aef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9aef('0x5'));var rimraf=require(_0x9aef('0x6'));var config=require(_0x9aef('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x9aef('0x8')]=function(_0xff8ce7,_0x5eecf8){return _0xff8ce7[_0x9aef('0x9')](_0x9aef('0xa'),attributes,{'tableName':_0x9aef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaad5=['UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','define'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0xaad5,0x7a));var _0x5aad=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xaad5[_0x270adf];return _0x29eda9;};'use strict';var _=require('lodash');var util=require(_0x5aad('0x0'));var logger=require(_0x5aad('0x1'))(_0x5aad('0x2'));var moment=require(_0x5aad('0x3'));var BPromise=require(_0x5aad('0x4'));var rp=require(_0x5aad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5aad('0x6'));var config=require(_0x5aad('0x7'));var attributes=require(_0x5aad('0x8'));module['exports']=function(_0x1ef48a,_0x30f769){return _0x1ef48a[_0x5aad('0x9')](_0x5aad('0xa'),attributes,{'tableName':_0x5aad('0xb'),'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 7ff52b6..b794c08 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 _0x41b4=['jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0x41b4,0x150));var _0x441b=function(_0x568f96,_0x32d489){_0x568f96=_0x568f96-0x0;var _0x5a053a=_0x41b4[_0x568f96];return _0x5a053a;};'use strict';var _=require(_0x441b('0x0'));var util=require(_0x441b('0x1'));var moment=require(_0x441b('0x2'));var BPromise=require(_0x441b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x441b('0x4'));var db=require(_0x441b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x441b('0x6'))(_0x441b('0x7'));var config=require(_0x441b('0x8'));var jayson=require(_0x441b('0x9'));var client=jayson[_0x441b('0xa')][_0x441b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x518425,_0xa3c66d,_0x279f08){return new BPromise(function(_0x431129,_0x3d4db8){return client[_0x441b('0xc')](_0x518425,_0x279f08)[_0x441b('0xd')](function(_0x2c4e49){logger[_0x441b('0xe')](_0x441b('0xf'),_0xa3c66d,_0x441b('0x10'));logger['debug'](_0x441b('0x11'),_0xa3c66d,_0x441b('0x10'),JSON[_0x441b('0x12')](_0x2c4e49));if(_0x2c4e49[_0x441b('0x13')]){if(_0x2c4e49['error'][_0x441b('0x14')]===0x1f4){logger['error'](_0x441b('0xf'),_0xa3c66d,_0x2c4e49[_0x441b('0x13')]['message']);return _0x3d4db8(_0x2c4e49[_0x441b('0x13')][_0x441b('0x15')]);}logger[_0x441b('0x13')](_0x441b('0xf'),_0xa3c66d,_0x2c4e49[_0x441b('0x13')][_0x441b('0x15')]);return _0x431129(_0x2c4e49['error'][_0x441b('0x15')]);}else{logger[_0x441b('0xe')](_0x441b('0xf'),_0xa3c66d,_0x441b('0x10'));_0x431129(_0x2c4e49[_0x441b('0x16')][_0x441b('0x15')]);}})['catch'](function(_0x56e63a){logger[_0x441b('0x13')]('UserChatQueue,\x20%s,\x20%s',_0xa3c66d,_0x56e63a);_0x3d4db8(_0x56e63a);});});} \ No newline at end of file +var _0x0200=['request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','debug'];(function(_0x5a0747,_0x34789b){var _0x1a2b6d=function(_0x57dc6e){while(--_0x57dc6e){_0x5a0747['push'](_0x5a0747['shift']());}};_0x1a2b6d(++_0x34789b);}(_0x0200,0x66));var _0x0020=function(_0x1b3a09,_0x20c774){_0x1b3a09=_0x1b3a09-0x0;var _0x357bb8=_0x0200[_0x1b3a09];return _0x357bb8;};'use strict';var _=require(_0x0020('0x0'));var util=require(_0x0020('0x1'));var moment=require(_0x0020('0x2'));var BPromise=require(_0x0020('0x3'));var rs=require(_0x0020('0x4'));var fs=require('fs');var Redis=require(_0x0020('0x5'));var db=require(_0x0020('0x6'))['db'];var utils=require(_0x0020('0x7'));var logger=require(_0x0020('0x8'))(_0x0020('0x9'));var config=require(_0x0020('0xa'));var jayson=require(_0x0020('0xb'));var client=jayson[_0x0020('0xc')][_0x0020('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2dde88,_0x11a4ad,_0x3577f4){return new BPromise(function(_0x399fda,_0x5d9ba2){return client[_0x0020('0xe')](_0x2dde88,_0x3577f4)['then'](function(_0x3b057b){logger[_0x0020('0xf')](_0x0020('0x10'),_0x11a4ad,'request\x20sent');logger[_0x0020('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x11a4ad,_0x0020('0x12'),JSON[_0x0020('0x13')](_0x3b057b));if(_0x3b057b['error']){if(_0x3b057b[_0x0020('0x14')][_0x0020('0x15')]===0x1f4){logger[_0x0020('0x14')](_0x0020('0x10'),_0x11a4ad,_0x3b057b[_0x0020('0x14')]['message']);return _0x5d9ba2(_0x3b057b[_0x0020('0x14')][_0x0020('0x16')]);}logger[_0x0020('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x11a4ad,_0x3b057b[_0x0020('0x14')][_0x0020('0x16')]);return _0x399fda(_0x3b057b[_0x0020('0x14')]['message']);}else{logger[_0x0020('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x11a4ad,'request\x20sent');_0x399fda(_0x3b057b['result']['message']);}})[_0x0020('0x17')](function(_0x58e099){logger[_0x0020('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x11a4ad,_0x58e099);_0x5d9ba2(_0x58e099);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index fcf1d71..10e7e48 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 _0xeefe=['util','express','Router','../../components/interaction/service','../../config/environment','multer'];(function(_0x4dc539,_0x68f43c){var _0x48782b=function(_0x2a203b){while(--_0x2a203b){_0x4dc539['push'](_0x4dc539['shift']());}};_0x48782b(++_0x68f43c);}(_0xeefe,0x119));var _0xeeef=function(_0x46ec87,_0x527194){_0x46ec87=_0x46ec87-0x0;var _0x2ddae8=_0xeefe[_0x46ec87];return _0x2ddae8;};'use strict';var multer=require(_0xeeef('0x0'));var util=require(_0xeeef('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeeef('0x2'));var router=express[_0xeeef('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xeeef('0x4'));var config=require(_0xeeef('0x5'));module['exports']=router; \ No newline at end of file +var _0xc3eb=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path'];(function(_0xb32392,_0x2117d2){var _0x58b793=function(_0x457fb1){while(--_0x457fb1){_0xb32392['push'](_0xb32392['shift']());}};_0x58b793(++_0x2117d2);}(_0xc3eb,0x173));var _0xbc3e=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0xc3eb[_0x53e3de];return _0x7b905b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbc3e('0x0'));var timeout=require('connect-timeout');var express=require(_0xbc3e('0x1'));var router=express[_0xbc3e('0x2')]();var auth=require(_0xbc3e('0x3'));var interaction=require(_0xbc3e('0x4'));var config=require('../../config/environment');module[_0xbc3e('0x5')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 64a8e66..78bb3a8 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 _0x80ed=['INTEGER','STRING','sequelize'];(function(_0x25406d,_0xde26bf){var _0x20bfa2=function(_0x24e45e){while(--_0x24e45e){_0x25406d['push'](_0x25406d['shift']());}};_0x20bfa2(++_0xde26bf);}(_0x80ed,0x11c));var _0xd80e=function(_0x39d928,_0x572e72){_0x39d928=_0x39d928-0x0;var _0x2b26a8=_0x80ed[_0x39d928];return _0x2b26a8;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd80e('0x2')]}}; \ No newline at end of file +var _0x0abf=['sequelize','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e82de44..e850c27 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(_0x4d121d,_0x3fe733){var _0xffa031=function(_0x1fec1b){while(--_0x1fec1b){_0x4d121d['push'](_0x4d121d['shift']());}};_0xffa031(++_0x3fe733);}(_0xb10b,0x12a));var _0xbb10=function(_0xfc2644,_0x4a3b13){_0xfc2644=_0xfc2644-0x0;var _0x4873b7=_0xb10b[_0xfc2644];return _0x4873b7;};'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(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0xb10b,0x12a));var _0xbb10=function(_0x165ca9,_0x36e359){_0x165ca9=_0x165ca9-0x0;var _0x25f49a=_0xb10b[_0x165ca9];return _0x25f49a;};'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 a2ca691..323e552 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 _0x6e1c=['rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4c8b0e,_0x4bad2b){var _0x2e784e=function(_0x28ccc0){while(--_0x28ccc0){_0x4c8b0e['push'](_0x4c8b0e['shift']());}};_0x2e784e(++_0x4bad2b);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc6e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc6e1('0x1'));var rs=require(_0xc6e1('0x2'));var fs=require('fs');var Redis=require(_0xc6e1('0x3'));var db=require(_0xc6e1('0x4'))['db'];var utils=require(_0xc6e1('0x5'));var logger=require(_0xc6e1('0x6'))(_0xc6e1('0x7'));var config=require(_0xc6e1('0x8'));var jayson=require(_0xc6e1('0x9'));var client=jayson[_0xc6e1('0xa')][_0xc6e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5247f1,_0x3ff10c,_0x1242d5){return new BPromise(function(_0x39000a,_0x2ffee0){return client[_0xc6e1('0xc')](_0x5247f1,_0x1242d5)['then'](function(_0xa29af9){logger[_0xc6e1('0xd')](_0xc6e1('0xe'),_0x3ff10c,'request\x20sent');logger['debug'](_0xc6e1('0xf'),_0x3ff10c,_0xc6e1('0x10'),JSON['stringify'](_0xa29af9));if(_0xa29af9[_0xc6e1('0x11')]){if(_0xa29af9[_0xc6e1('0x11')][_0xc6e1('0x12')]===0x1f4){logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0xa29af9[_0xc6e1('0x11')]['message']);return _0x2ffee0(_0xa29af9[_0xc6e1('0x11')][_0xc6e1('0x13')]);}logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0xa29af9[_0xc6e1('0x11')]['message']);return _0x39000a(_0xa29af9['error'][_0xc6e1('0x13')]);}else{logger[_0xc6e1('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x3ff10c,_0xc6e1('0x10'));_0x39000a(_0xa29af9[_0xc6e1('0x14')][_0xc6e1('0x13')]);}})['catch'](function(_0x44ef6c){logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0x44ef6c);_0x2ffee0(_0x44ef6c);});});} \ No newline at end of file +var _0x6c2c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x6c2c,0x158));var _0xc6c2=function(_0x3097c7,_0x5adc02){_0x3097c7=_0x3097c7-0x0;var _0x3aff29=_0x6c2c[_0x3097c7];return _0x3aff29;};'use strict';var _=require('lodash');var util=require(_0xc6c2('0x0'));var moment=require(_0xc6c2('0x1'));var BPromise=require(_0xc6c2('0x2'));var rs=require(_0xc6c2('0x3'));var fs=require('fs');var Redis=require(_0xc6c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6c2('0x5'));var logger=require(_0xc6c2('0x6'))(_0xc6c2('0x7'));var config=require(_0xc6c2('0x8'));var jayson=require(_0xc6c2('0x9'));var client=jayson[_0xc6c2('0xa')][_0xc6c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x398313,_0x2d63d5,_0x27eaa4){return new BPromise(function(_0x490e12,_0x2f1609){return client[_0xc6c2('0xc')](_0x398313,_0x27eaa4)[_0xc6c2('0xd')](function(_0x2a5616){logger[_0xc6c2('0xe')](_0xc6c2('0xf'),_0x2d63d5,_0xc6c2('0x10'));logger[_0xc6c2('0x11')](_0xc6c2('0x12'),_0x2d63d5,_0xc6c2('0x10'),JSON[_0xc6c2('0x13')](_0x2a5616));if(_0x2a5616['error']){if(_0x2a5616[_0xc6c2('0x14')][_0xc6c2('0x15')]===0x1f4){logger['error'](_0xc6c2('0xf'),_0x2d63d5,_0x2a5616['error']['message']);return _0x2f1609(_0x2a5616[_0xc6c2('0x14')]['message']);}logger[_0xc6c2('0x14')](_0xc6c2('0xf'),_0x2d63d5,_0x2a5616[_0xc6c2('0x14')]['message']);return _0x490e12(_0x2a5616[_0xc6c2('0x14')][_0xc6c2('0x16')]);}else{logger[_0xc6c2('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x2d63d5,'request\x20sent');_0x490e12(_0x2a5616[_0xc6c2('0x17')][_0xc6c2('0x16')]);}})[_0xc6c2('0x18')](function(_0x26a352){logger['error'](_0xc6c2('0xf'),_0x2d63d5,_0x26a352);_0x2f1609(_0x26a352);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 59854c9..bd85c31 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 _0x10f3=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express'];(function(_0x52c9fa,_0x372fbf){var _0x4a4bbc=function(_0x68b742){while(--_0x68b742){_0x52c9fa['push'](_0x52c9fa['shift']());}};_0x4a4bbc(++_0x372fbf);}(_0x10f3,0xb1));var _0x310f=function(_0x4be431,_0x5b576a){_0x4be431=_0x4be431-0x0;var _0x347bca=_0x10f3[_0x4be431];return _0x347bca;};'use strict';var multer=require(_0x310f('0x0'));var util=require(_0x310f('0x1'));var path=require(_0x310f('0x2'));var timeout=require(_0x310f('0x3'));var express=require(_0x310f('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x310f('0x5'));var config=require('../../config/environment');module[_0x310f('0x6')]=router; \ No newline at end of file +var _0x4494=['../../components/auth/service','../../components/interaction/service','exports','path','Router'];(function(_0x475be2,_0xf0639){var _0x4ff8b1=function(_0x4bccc9){while(--_0x4bccc9){_0x475be2['push'](_0x475be2['shift']());}};_0x4ff8b1(++_0xf0639);}(_0x4494,0x8a));var _0x4449=function(_0x4d8695,_0x1c0dd0){_0x4d8695=_0x4d8695-0x0;var _0x14c650=_0x4494[_0x4d8695];return _0x14c650;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4449('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4449('0x1')]();var auth=require(_0x4449('0x2'));var interaction=require(_0x4449('0x3'));var config=require('../../config/environment');module[_0x4449('0x4')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 18e981f..cfd697c 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x5a5422,_0x485c4f){var _0x14cb82=function(_0x2bfc63){while(--_0x2bfc63){_0x5a5422['push'](_0x5a5422['shift']());}};_0x14cb82(++_0x485c4f);}(_0xe706,0xa3));var _0x6e70=function(_0x53b37c,_0x1e3dae){_0x53b37c=_0x53b37c-0x0;var _0x912a5=_0xe706[_0x53b37c];return _0x912a5;};'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(_0x3a1040,_0x5aef49){var _0xea943e=function(_0x3c98d){while(--_0x3c98d){_0x3a1040['push'](_0x3a1040['shift']());}};_0xea943e(++_0x5aef49);}(_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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 2f247b6..5036244 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(_0x128e71,_0x21eea8){var _0x938bdb=function(_0x386713){while(--_0x386713){_0x128e71['push'](_0x128e71['shift']());}};_0x938bdb(++_0x21eea8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x21dfde,_0x5797b7){var _0x5b65e9=function(_0x132585){while(--_0x132585){_0x21dfde['push'](_0x21dfde['shift']());}};_0x5b65e9(++_0x5797b7);}(_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 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 802f039..bbb3e4a 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 _0xc569=['then','request\x20sent','debug','error','code','UserMailQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xc569,0x159));var _0x9c56=function(_0x535a53,_0x542718){_0x535a53=_0x535a53-0x0;var _0x2919a3=_0xc569[_0x535a53];return _0x2919a3;};'use strict';var _=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var moment=require(_0x9c56('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c56('0x3'));var fs=require('fs');var Redis=require(_0x9c56('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c56('0x5'));var logger=require(_0x9c56('0x6'))(_0x9c56('0x7'));var config=require('../../config/environment');var jayson=require(_0x9c56('0x8'));var client=jayson[_0x9c56('0x9')][_0x9c56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38a9cf,_0x564e30,_0x15206f){return new BPromise(function(_0xaba9c7,_0x35baa0){return client[_0x9c56('0xb')](_0x38a9cf,_0x15206f)[_0x9c56('0xc')](function(_0x582e29){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x564e30,_0x9c56('0xd'));logger[_0x9c56('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x564e30,_0x9c56('0xd'),JSON['stringify'](_0x582e29));if(_0x582e29[_0x9c56('0xf')]){if(_0x582e29[_0x9c56('0xf')][_0x9c56('0x10')]===0x1f4){logger[_0x9c56('0xf')](_0x9c56('0x11'),_0x564e30,_0x582e29[_0x9c56('0xf')][_0x9c56('0x12')]);return _0x35baa0(_0x582e29['error'][_0x9c56('0x12')]);}logger[_0x9c56('0xf')](_0x9c56('0x11'),_0x564e30,_0x582e29[_0x9c56('0xf')][_0x9c56('0x12')]);return _0xaba9c7(_0x582e29['error'][_0x9c56('0x12')]);}else{logger['info'](_0x9c56('0x11'),_0x564e30,_0x9c56('0xd'));_0xaba9c7(_0x582e29[_0x9c56('0x13')][_0x9c56('0x12')]);}})[_0x9c56('0x14')](function(_0x20467d){logger[_0x9c56('0xf')](_0x9c56('0x11'),_0x564e30,_0x20467d);_0x35baa0(_0x20467d);});});} \ No newline at end of file +var _0x22ed=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x22ed,0x1a9));var _0xd22e=function(_0x1b5738,_0x5e6b11){_0x1b5738=_0x1b5738-0x0;var _0x4d8a1e=_0x22ed[_0x1b5738];return _0x4d8a1e;};'use strict';var _=require(_0xd22e('0x0'));var util=require(_0xd22e('0x1'));var moment=require(_0xd22e('0x2'));var BPromise=require(_0xd22e('0x3'));var rs=require(_0xd22e('0x4'));var fs=require('fs');var Redis=require(_0xd22e('0x5'));var db=require(_0xd22e('0x6'))['db'];var utils=require(_0xd22e('0x7'));var logger=require(_0xd22e('0x8'))(_0xd22e('0x9'));var config=require(_0xd22e('0xa'));var jayson=require(_0xd22e('0xb'));var client=jayson['client'][_0xd22e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3185f2,_0x5d99d5,_0x405361){return new BPromise(function(_0x3378a3,_0x5dd614){return client[_0xd22e('0xd')](_0x3185f2,_0x405361)['then'](function(_0x5444e8){logger[_0xd22e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x5d99d5,'request\x20sent');logger['debug'](_0xd22e('0xf'),_0x5d99d5,_0xd22e('0x10'),JSON[_0xd22e('0x11')](_0x5444e8));if(_0x5444e8[_0xd22e('0x12')]){if(_0x5444e8['error'][_0xd22e('0x13')]===0x1f4){logger[_0xd22e('0x12')](_0xd22e('0x14'),_0x5d99d5,_0x5444e8[_0xd22e('0x12')][_0xd22e('0x15')]);return _0x5dd614(_0x5444e8[_0xd22e('0x12')]['message']);}logger[_0xd22e('0x12')](_0xd22e('0x14'),_0x5d99d5,_0x5444e8[_0xd22e('0x12')]['message']);return _0x3378a3(_0x5444e8[_0xd22e('0x12')]['message']);}else{logger[_0xd22e('0xe')](_0xd22e('0x14'),_0x5d99d5,_0xd22e('0x10'));_0x3378a3(_0x5444e8[_0xd22e('0x16')][_0xd22e('0x15')]);}})[_0xd22e('0x17')](function(_0x3cbd14){logger[_0xd22e('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x5d99d5,_0x3cbd14);_0x5dd614(_0x3cbd14);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index ceb8ef7..07c11f4 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 _0xf8aa=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x168484,_0x3124ad){var _0x3af701=function(_0x552ef3){while(--_0x552ef3){_0x168484['push'](_0x168484['shift']());}};_0x3af701(++_0x3124ad);}(_0xf8aa,0x126));var _0xaf8a=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf8aa[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require(_0xaf8a('0x0'));var util=require(_0xaf8a('0x1'));var path=require(_0xaf8a('0x2'));var timeout=require(_0xaf8a('0x3'));var express=require('express');var router=express[_0xaf8a('0x4')]();var auth=require(_0xaf8a('0x5'));var interaction=require(_0xaf8a('0x6'));var config=require(_0xaf8a('0x7'));module[_0xaf8a('0x8')]=router; \ No newline at end of file +var _0xc015=['../../components/interaction/service','../../config/environment','exports','util','path','express','../../components/auth/service'];(function(_0x42f226,_0x409907){var _0x52debe=function(_0xa3666b){while(--_0xa3666b){_0x42f226['push'](_0x42f226['shift']());}};_0x52debe(++_0x409907);}(_0xc015,0x106));var _0x5c01=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xc015[_0x80d733];return _0x435868;};'use strict';var multer=require('multer');var util=require(_0x5c01('0x0'));var path=require(_0x5c01('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c01('0x2'));var router=express['Router']();var auth=require(_0x5c01('0x3'));var interaction=require(_0x5c01('0x4'));var config=require(_0x5c01('0x5'));module[_0x5c01('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 5b1d176..38c2793 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x4e13f6,_0x55677f){var _0x30a767=function(_0x496a6c){while(--_0x496a6c){_0x4e13f6['push'](_0x4e13f6['shift']());}};_0x30a767(++_0x55677f);}(_0xe706,0xa3));var _0x6e70=function(_0x150a67,_0x4406ca){_0x150a67=_0x150a67-0x0;var _0x505c8f=_0xe706[_0x150a67];return _0x505c8f;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x2382e2,_0x1c07e6){var _0x5e9fab=function(_0xfc8c77){while(--_0xfc8c77){_0x2382e2['push'](_0x2382e2['shift']());}};_0x5e9fab(++_0x1c07e6);}(_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 d0e482b..89b6f21 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 _0x4d2d=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x210b71,_0x46c412){var _0x2551a3=function(_0x1fce22){while(--_0x1fce22){_0x210b71['push'](_0x210b71['shift']());}};_0x2551a3(++_0x46c412);}(_0x4d2d,0x17a));var _0xd4d2=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x4d2d[_0x3f9584];return _0x9d54c;};'use strict';var _=require(_0xd4d2('0x0'));var util=require('util');var logger=require(_0xd4d2('0x1'))(_0xd4d2('0x2'));var moment=require('moment');var BPromise=require(_0xd4d2('0x3'));var rp=require(_0xd4d2('0x4'));var fs=require('fs');var path=require(_0xd4d2('0x5'));var rimraf=require('rimraf');var config=require(_0xd4d2('0x6'));var attributes=require(_0xd4d2('0x7'));module[_0xd4d2('0x8')]=function(_0x4ca991,_0x39b61c){return _0x4ca991[_0xd4d2('0x9')](_0xd4d2('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0490=['api','moment','request-promise','../../config/environment','exports','define','../../config/logger'];(function(_0x553fcf,_0x2944af){var _0xfaadf0=function(_0x5343e3){while(--_0x5343e3){_0x553fcf['push'](_0x553fcf['shift']());}};_0xfaadf0(++_0x2944af);}(_0x0490,0x172));var _0x0049=function(_0x3669aa,_0x20b3fd){_0x3669aa=_0x3669aa-0x0;var _0x29103d=_0x0490[_0x3669aa];return _0x29103d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0049('0x0'))(_0x0049('0x1'));var moment=require(_0x0049('0x2'));var BPromise=require('bluebird');var rp=require(_0x0049('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0049('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x0049('0x5')]=function(_0x3d13b6,_0x3db887){return _0x3d13b6[_0x0049('0x6')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','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 3bcfd52..be76f10 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 _0xba61=['request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2a4b27,_0x415629){var _0x22192b=function(_0x53b1a6){while(--_0x53b1a6){_0x2a4b27['push'](_0x2a4b27['shift']());}};_0x22192b(++_0x415629);}(_0xba61,0xf1));var _0x1ba6=function(_0x1cb2d,_0x1a35c7){_0x1cb2d=_0x1cb2d-0x0;var _0x1882e9=_0xba61[_0x1cb2d];return _0x1882e9;};'use strict';var _=require(_0x1ba6('0x0'));var util=require(_0x1ba6('0x1'));var moment=require(_0x1ba6('0x2'));var BPromise=require(_0x1ba6('0x3'));var rs=require(_0x1ba6('0x4'));var fs=require('fs');var Redis=require(_0x1ba6('0x5'));var db=require(_0x1ba6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ba6('0x7'))(_0x1ba6('0x8'));var config=require(_0x1ba6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1ba6('0xa')][_0x1ba6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26d90a,_0x14061d,_0x518494){return new BPromise(function(_0x2c81a4,_0x49226f){return client[_0x1ba6('0xc')](_0x26d90a,_0x518494)[_0x1ba6('0xd')](function(_0x174025){logger[_0x1ba6('0xe')](_0x1ba6('0xf'),_0x14061d,_0x1ba6('0x10'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x14061d,_0x1ba6('0x10'),JSON[_0x1ba6('0x11')](_0x174025));if(_0x174025[_0x1ba6('0x12')]){if(_0x174025[_0x1ba6('0x12')][_0x1ba6('0x13')]===0x1f4){logger[_0x1ba6('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x14061d,_0x174025[_0x1ba6('0x12')]['message']);return _0x49226f(_0x174025[_0x1ba6('0x12')]['message']);}logger[_0x1ba6('0x12')](_0x1ba6('0xf'),_0x14061d,_0x174025[_0x1ba6('0x12')][_0x1ba6('0x14')]);return _0x2c81a4(_0x174025[_0x1ba6('0x12')][_0x1ba6('0x14')]);}else{logger[_0x1ba6('0xe')](_0x1ba6('0xf'),_0x14061d,_0x1ba6('0x10'));_0x2c81a4(_0x174025[_0x1ba6('0x15')][_0x1ba6('0x14')]);}})[_0x1ba6('0x16')](function(_0x56777f){logger[_0x1ba6('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x14061d,_0x56777f);_0x49226f(_0x56777f);});});} \ No newline at end of file +var _0xc18a=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f0213,_0x3c3c9e){var _0x2048c4=function(_0x26d0c6){while(--_0x26d0c6){_0x1f0213['push'](_0x1f0213['shift']());}};_0x2048c4(++_0x3c3c9e);}(_0xc18a,0x1b7));var _0xac18=function(_0x4195e8,_0x202df1){_0x4195e8=_0x4195e8-0x0;var _0x29177a=_0xc18a[_0x4195e8];return _0x29177a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xac18('0x0'));var BPromise=require(_0xac18('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac18('0x2'))['db'];var utils=require(_0xac18('0x3'));var logger=require(_0xac18('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xac18('0x5')][_0xac18('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x196008,_0x16402e,_0x41ef48){return new BPromise(function(_0x14669d,_0x23a74f){return client['request'](_0x196008,_0x41ef48)[_0xac18('0x7')](function(_0x2dd46f){logger['info'](_0xac18('0x8'),_0x16402e,_0xac18('0x9'));logger[_0xac18('0xa')](_0xac18('0xb'),_0x16402e,_0xac18('0x9'),JSON[_0xac18('0xc')](_0x2dd46f));if(_0x2dd46f[_0xac18('0xd')]){if(_0x2dd46f[_0xac18('0xd')]['code']===0x1f4){logger['error'](_0xac18('0x8'),_0x16402e,_0x2dd46f[_0xac18('0xd')][_0xac18('0xe')]);return _0x23a74f(_0x2dd46f[_0xac18('0xd')][_0xac18('0xe')]);}logger[_0xac18('0xd')](_0xac18('0x8'),_0x16402e,_0x2dd46f[_0xac18('0xd')][_0xac18('0xe')]);return _0x14669d(_0x2dd46f[_0xac18('0xd')]['message']);}else{logger[_0xac18('0xf')](_0xac18('0x8'),_0x16402e,_0xac18('0x9'));_0x14669d(_0x2dd46f[_0xac18('0x10')][_0xac18('0xe')]);}})[_0xac18('0x11')](function(_0x153a8d){logger[_0xac18('0xd')](_0xac18('0x8'),_0x16402e,_0x153a8d);_0x23a74f(_0x153a8d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 45c34a5..83565ca 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 _0x267b=['/:id','update','delete','destroy','removeSections','/:id/resources','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/sections','post','create','clone','addSections','addResources'];(function(_0x4a104c,_0x31eb74){var _0x11f870=function(_0x3b18c3){while(--_0x3b18c3){_0x4a104c['push'](_0x4a104c['shift']());}};_0x11f870(++_0x31eb74);}(_0x267b,0x130));var _0xb267=function(_0x2d1fb2,_0x2640e4){_0x2d1fb2=_0x2d1fb2-0x0;var _0x4a484d=_0x267b[_0x2d1fb2];return _0x4a484d;};'use strict';var multer=require(_0xb267('0x0'));var util=require(_0xb267('0x1'));var path=require(_0xb267('0x2'));var timeout=require('connect-timeout');var express=require(_0xb267('0x3'));var router=express[_0xb267('0x4')]();var auth=require(_0xb267('0x5'));var interaction=require(_0xb267('0x6'));var config=require(_0xb267('0x7'));var controller=require('./userProfile.controller');router[_0xb267('0x8')]('/',auth['isAuthenticated'](),controller[_0xb267('0x9')]);router['get'](_0xb267('0xa'),auth[_0xb267('0xb')](),controller[_0xb267('0xc')]);router[_0xb267('0x8')]('/:id',auth[_0xb267('0xb')](),controller[_0xb267('0xd')]);router[_0xb267('0x8')](_0xb267('0xe'),auth[_0xb267('0xb')](),controller['getSections']);router[_0xb267('0x8')]('/:id/resources',auth[_0xb267('0xb')](),controller['getResources']);router[_0xb267('0xf')]('/',auth['isAuthenticated'](),controller[_0xb267('0x10')]);router[_0xb267('0xf')]('/:id/clone',auth[_0xb267('0xb')](),controller[_0xb267('0x11')]);router[_0xb267('0xf')](_0xb267('0xe'),auth[_0xb267('0xb')](),controller[_0xb267('0x12')]);router['post']('/:id/resources',auth[_0xb267('0xb')](),controller[_0xb267('0x13')]);router['put'](_0xb267('0x14'),auth[_0xb267('0xb')](),controller[_0xb267('0x15')]);router[_0xb267('0x16')]('/:id',auth[_0xb267('0xb')](),controller[_0xb267('0x17')]);router['delete'](_0xb267('0xe'),auth[_0xb267('0xb')](),controller[_0xb267('0x18')]);router[_0xb267('0x16')](_0xb267('0x19'),auth[_0xb267('0xb')](),controller['removeResources']);module[_0xb267('0x1a')]=router; \ No newline at end of file +var _0xe2b0=['express','Router','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','destroy','delete','multer','util','connect-timeout'];(function(_0x37fcf9,_0x352d89){var _0x1758f2=function(_0x2d8871){while(--_0x2d8871){_0x37fcf9['push'](_0x37fcf9['shift']());}};_0x1758f2(++_0x352d89);}(_0xe2b0,0x14d));var _0x0e2b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe2b0[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x0e2b('0x0'));var util=require(_0x0e2b('0x1'));var path=require('path');var timeout=require(_0x0e2b('0x2'));var express=require(_0x0e2b('0x3'));var router=express[_0x0e2b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0e2b('0x5'));var config=require('../../config/environment');var controller=require(_0x0e2b('0x6'));router[_0x0e2b('0x7')]('/',auth[_0x0e2b('0x8')](),controller[_0x0e2b('0x9')]);router[_0x0e2b('0x7')]('/describe',auth[_0x0e2b('0x8')](),controller[_0x0e2b('0xa')]);router[_0x0e2b('0x7')](_0x0e2b('0xb'),auth[_0x0e2b('0x8')](),controller[_0x0e2b('0xc')]);router[_0x0e2b('0x7')](_0x0e2b('0xd'),auth['isAuthenticated'](),controller[_0x0e2b('0xe')]);router[_0x0e2b('0x7')](_0x0e2b('0xf'),auth['isAuthenticated'](),controller[_0x0e2b('0x10')]);router[_0x0e2b('0x11')]('/',auth['isAuthenticated'](),controller[_0x0e2b('0x12')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x0e2b('0x13')]);router[_0x0e2b('0x11')]('/:id/sections',auth[_0x0e2b('0x8')](),controller[_0x0e2b('0x14')]);router[_0x0e2b('0x11')](_0x0e2b('0xf'),auth[_0x0e2b('0x8')](),controller[_0x0e2b('0x15')]);router['put'](_0x0e2b('0xb'),auth[_0x0e2b('0x8')](),controller['update']);router['delete'](_0x0e2b('0xb'),auth['isAuthenticated'](),controller[_0x0e2b('0x16')]);router[_0x0e2b('0x17')](_0x0e2b('0xd'),auth[_0x0e2b('0x8')](),controller['removeSections']);router[_0x0e2b('0x17')](_0x0e2b('0xf'),auth[_0x0e2b('0x8')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 72425f0..c243ca8 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 _0x505c=['sequelize','STRING','name','setDataValue','crudPermissions','getDataValue','split'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x505c,0x149));var _0xc505=function(_0x48f4c5,_0x56e4c3){_0x48f4c5=_0x48f4c5-0x0;var _0x40ab65=_0x505c[_0x48f4c5];return _0x40ab65;};'use strict';var Sequelize=require(_0xc505('0x0'));module['exports']={'name':{'type':Sequelize[_0xc505('0x1')],'allowNull':![],'unique':_0xc505('0x2')},'crudPermissions':{'type':Sequelize[_0xc505('0x1')],'set':function(_0x132a07){this[_0xc505('0x3')](_0xc505('0x4'),_0x132a07?_0x132a07['join'](''):[]);},'get':function(){return this[_0xc505('0x5')](_0xc505('0x4'))?this[_0xc505('0x5')]('crudPermissions')[_0xc505('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc505('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xaebe=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING'];(function(_0x2ca04a,_0x47eeb0){var _0x3bc72c=function(_0x432c59){while(--_0x432c59){_0x2ca04a['push'](_0x2ca04a['shift']());}};_0x3bc72c(++_0x47eeb0);}(_0xaebe,0xed));var _0xeaeb=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xaebe[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require(_0xeaeb('0x0'));module[_0xeaeb('0x1')]={'name':{'type':Sequelize[_0xeaeb('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x27ddc8){this[_0xeaeb('0x3')](_0xeaeb('0x4'),_0x27ddc8?_0x27ddc8[_0xeaeb('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xeaeb('0x4'))?this[_0xeaeb('0x6')](_0xeaeb('0x4'))[_0xeaeb('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xeaeb('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 62e17d7..cc6b412 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 _0xe728=['globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','create','body','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','destroy','describe','addSections','push','removeSections','ids','getSections','includes','isEmpty','enabled','subsections','findOne','Dashboard','forEach','userProfileId','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','Invalid\x20section\x20\x27','parentSections','all','ignore','nolimit','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','CustomReports','rows','CmContact','Tag','Tags','color','tag','ThroughTags','value','resourceId','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareRecording','projectName','JscriptyProject','contacts','lists','CmList','companies','CmCompany'];(function(_0x436194,_0x5bf22c){var _0x43fc99=function(_0xc3bf0f){while(--_0xc3bf0f){_0x436194['push'](_0x436194['shift']());}};_0x43fc99(++_0x5bf22c);}(_0xe728,0x14e));var _0x8e72=function(_0x339070,_0x58c633){_0x339070=_0x339070-0x0;var _0x1b94ea=_0xe728[_0x339070];return _0x1b94ea;};'use strict';var pdf=require(_0x8e72('0x0'));var emlformat=require(_0x8e72('0x1'));var rimraf=require(_0x8e72('0x2'));var zipdir=require(_0x8e72('0x3'));var jsonpatch=require(_0x8e72('0x4'));var rp=require('request-promise');var moment=require(_0x8e72('0x5'));var BPromise=require(_0x8e72('0x6'));var Mustache=require(_0x8e72('0x7'));var util=require('util');var path=require(_0x8e72('0x8'));var sox=require(_0x8e72('0x9'));var csv=require(_0x8e72('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8e72('0xb'));var squel=require(_0x8e72('0xc'));var crypto=require('crypto');var jsforce=require(_0x8e72('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e72('0xa'));var querystring=require(_0x8e72('0xe'));var Papa=require(_0x8e72('0xf'));var Redis=require(_0x8e72('0x10'));var authService=require(_0x8e72('0x11'));var qs=require(_0x8e72('0x12'));var as=require(_0x8e72('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e72('0x14'))(_0x8e72('0x15'));var utils=require('../../config/utils');var config=require(_0x8e72('0x16'));var db=require(_0x8e72('0x17'))['db'];config['redis']=_[_0x8e72('0x18')](config[_0x8e72('0x19')],{'host':_0x8e72('0x1a'),'port':0x18eb});var socket=require(_0x8e72('0x1b'))(new Redis(config['redis']));require('./userProfile.socket')[_0x8e72('0x1c')](socket);function respondWithStatusCode(_0x3ea6c7,_0x167fac){_0x167fac=_0x167fac||0xcc;return function(_0x2d90d1){if(_0x2d90d1){return _0x3ea6c7[_0x8e72('0x1d')](_0x167fac);}return _0x3ea6c7[_0x8e72('0x1e')](_0x167fac)[_0x8e72('0x1f')]();};}function respondWithResult(_0x453ecf,_0x3965f8){_0x3965f8=_0x3965f8||0xc8;return function(_0x9cf81f){if(_0x9cf81f){return _0x453ecf[_0x8e72('0x1e')](_0x3965f8)['json'](_0x9cf81f);}};}function respondWithFilteredResult(_0x3f8189,_0x415d17){return function(_0x141d67){if(_0x141d67){var _0x213c86=_0x141d67[_0x8e72('0x20')],_0xba90ea=_0x415d17[_0x8e72('0x21')],_0x358af0=_0x415d17[_0x8e72('0x21')]+_0x415d17[_0x8e72('0x22')],_0x4b2ac8;if(_0x358af0>=_0x213c86){_0x358af0=_0x213c86;_0x4b2ac8=0xc8;}else{_0x4b2ac8=0xce;}_0x3f8189[_0x8e72('0x1e')](_0x4b2ac8);return _0x3f8189[_0x8e72('0x23')](_0x8e72('0x24'),_0xba90ea+'-'+_0x358af0+'/'+_0x213c86)[_0x8e72('0x25')](_0x141d67);}return null;};}function patchUpdates(_0x1cf9fb){return function(_0x5c7daf){try{jsonpatch[_0x8e72('0x26')](_0x5c7daf,_0x1cf9fb,!![]);}catch(_0x1d7661){return BPromise[_0x8e72('0x27')](_0x1d7661);}return _0x5c7daf['save']();};}function saveUpdates(_0x55bfa7,_0x532e72){return function(_0x18eaa1){if(_0x18eaa1){return _0x18eaa1['update'](_0x55bfa7)[_0x8e72('0x28')](function(_0x1b0749){return _0x1b0749;});}return null;};}function removeEntity(_0x3a3263,_0x4f097c){return function(_0x544719){if(_0x544719){return _0x544719['destroy']()[_0x8e72('0x28')](function(){_0x3a3263[_0x8e72('0x1e')](0xcc)[_0x8e72('0x1f')]();});}};}function handleEntityNotFound(_0x2e25d1,_0x57ae51){return function(_0x43961e){if(!_0x43961e){_0x2e25d1['sendStatus'](0x194);}return _0x43961e;};}function handleError(_0x3f6d24,_0x116130){_0x116130=_0x116130||0x1f4;return function(_0x52b0c8){logger[_0x8e72('0x29')](_0x52b0c8[_0x8e72('0x2a')]);if(_0x52b0c8[_0x8e72('0x2b')]){delete _0x52b0c8['name'];}_0x3f6d24['status'](_0x116130)[_0x8e72('0x2c')](_0x52b0c8);};}exports[_0x8e72('0x2d')]=function(_0x269078,_0x236322){var _0x167eed={},_0x121051={},_0x2a241a={'count':0x0,'rows':[]};var _0x1acf23=_[_0x8e72('0x2e')](db[_0x8e72('0x2f')][_0x8e72('0x30')],function(_0x421884){return{'name':_0x421884[_0x8e72('0x31')],'type':_0x421884[_0x8e72('0x32')][_0x8e72('0x33')]};});_0x121051[_0x8e72('0x34')]=_[_0x8e72('0x2e')](_0x1acf23,_0x8e72('0x2b'));_0x121051[_0x8e72('0x35')]=_[_0x8e72('0x36')](_0x269078[_0x8e72('0x35')]);_0x121051[_0x8e72('0x37')]=_[_0x8e72('0x38')](_0x121051[_0x8e72('0x34')],_0x121051[_0x8e72('0x35')]);_0x167eed[_0x8e72('0x39')]=_[_0x8e72('0x38')](_0x121051['model'],qs['fields'](_0x269078[_0x8e72('0x35')][_0x8e72('0x3a')]));_0x167eed['attributes']=_0x167eed[_0x8e72('0x39')][_0x8e72('0x3b')]?_0x167eed['attributes']:_0x121051[_0x8e72('0x34')];if(!_0x269078[_0x8e72('0x35')][_0x8e72('0x3c')]('nolimit')){_0x167eed[_0x8e72('0x22')]=qs[_0x8e72('0x22')](_0x269078[_0x8e72('0x35')][_0x8e72('0x22')]);_0x167eed[_0x8e72('0x21')]=qs[_0x8e72('0x21')](_0x269078['query'][_0x8e72('0x21')]);}_0x167eed[_0x8e72('0x3d')]=qs[_0x8e72('0x3e')](_0x269078['query']['sort']);_0x167eed['where']=qs[_0x8e72('0x37')](_[_0x8e72('0x3f')](_0x269078[_0x8e72('0x35')],_0x121051['filters']),_0x1acf23);if(_0x269078['query'][_0x8e72('0x40')]){_0x167eed[_0x8e72('0x41')]=_[_0x8e72('0x42')](_0x167eed[_0x8e72('0x41')],{'$or':_[_0x8e72('0x2e')](_0x1acf23,function(_0x1fff2d){if(_0x1fff2d[_0x8e72('0x32')]!==_0x8e72('0x43')){var _0x21b87c={};_0x21b87c[_0x1fff2d[_0x8e72('0x2b')]]={'$like':'%'+_0x269078[_0x8e72('0x35')][_0x8e72('0x40')]+'%'};return _0x21b87c;}})});}_0x167eed=_[_0x8e72('0x42')]({},_0x167eed,_0x269078['options']);var _0x5e7bdc={'where':_0x167eed[_0x8e72('0x41')]};return db[_0x8e72('0x2f')][_0x8e72('0x20')](_0x5e7bdc)[_0x8e72('0x28')](function(_0x155cde){_0x2a241a['count']=_0x155cde;if(_0x269078['query']['includeAll']){_0x167eed[_0x8e72('0x44')]=[{'all':!![]}];}return db[_0x8e72('0x2f')][_0x8e72('0x45')](_0x167eed);})[_0x8e72('0x28')](function(_0x294d34){_0x2a241a['rows']=_0x294d34;return _0x2a241a;})[_0x8e72('0x28')](respondWithFilteredResult(_0x236322,_0x167eed))[_0x8e72('0x46')](handleError(_0x236322,null));};exports[_0x8e72('0x47')]=function(_0x16426b,_0x4cd273){var _0x3cbf1a={'raw':![],'where':{'id':_0x16426b[_0x8e72('0x48')]['id']}},_0x610731={};_0x610731[_0x8e72('0x34')]=_[_0x8e72('0x36')](db[_0x8e72('0x2f')]['rawAttributes']);_0x610731['query']=_[_0x8e72('0x36')](_0x16426b[_0x8e72('0x35')]);_0x610731[_0x8e72('0x37')]=_['intersection'](_0x610731['model'],_0x610731[_0x8e72('0x35')]);_0x3cbf1a[_0x8e72('0x39')]=_[_0x8e72('0x38')](_0x610731['model'],qs['fields'](_0x16426b[_0x8e72('0x35')]['fields']));_0x3cbf1a[_0x8e72('0x39')]=_0x3cbf1a[_0x8e72('0x39')][_0x8e72('0x3b')]?_0x3cbf1a[_0x8e72('0x39')]:_0x610731[_0x8e72('0x34')];if(_0x16426b['query'][_0x8e72('0x49')]){_0x3cbf1a[_0x8e72('0x44')]=[{'all':!![]}];}_0x3cbf1a=_[_0x8e72('0x42')]({},_0x3cbf1a,_0x16426b[_0x8e72('0x4a')]);return db[_0x8e72('0x2f')]['find'](_0x3cbf1a)['then'](handleEntityNotFound(_0x4cd273,null))[_0x8e72('0x28')](respondWithResult(_0x4cd273,null))[_0x8e72('0x46')](handleError(_0x4cd273,null));};exports[_0x8e72('0x4b')]=function(_0x38ec07,_0x31c39b){return db['UserProfile']['create'](_0x38ec07[_0x8e72('0x4c')],{})[_0x8e72('0x28')](respondWithResult(_0x31c39b,0xc9))[_0x8e72('0x46')](handleError(_0x31c39b,null));};exports[_0x8e72('0x4d')]=function(_0x37da7a,_0x11c6d8){var _0x358766={'where':{'id':_0x37da7a[_0x8e72('0x48')]['id']}},_0x407d48={};_0x407d48['model']=_[_0x8e72('0x36')](db[_0x8e72('0x2f')][_0x8e72('0x30')]);_0x358766[_0x8e72('0x39')]=_[_0x8e72('0x38')](_0x407d48['model'],qs[_0x8e72('0x3a')](_0x37da7a[_0x8e72('0x35')]['fields']));_0x358766[_0x8e72('0x39')]=_0x358766[_0x8e72('0x39')][_0x8e72('0x3b')]?_0x358766['attributes']:_0x407d48[_0x8e72('0x34')];if(_0x37da7a[_0x8e72('0x35')][_0x8e72('0x49')]){_0x358766[_0x8e72('0x44')]=[{'all':!![]}];}_0x358766=_[_0x8e72('0x42')]({},_0x358766,_0x37da7a['options']);return db['UserProfile'][_0x8e72('0x4e')](_0x358766)[_0x8e72('0x28')](handleEntityNotFound(_0x11c6d8,null))[_0x8e72('0x28')](function(_0x55b958){if(_0x55b958){var _0x50f6f1=_0x55b958[_0x8e72('0x4f')]({'plain':!![]});_0x50f6f1=qs[_0x8e72('0x50')](_0x50f6f1,['id',_0x8e72('0x51'),_0x8e72('0x52'),_0x8e72('0x53')]);_0x37da7a['body']=_[_0x8e72('0x50')](_0x37da7a['body'],['id',_0x8e72('0x51'),_0x8e72('0x52')]);return db[_0x8e72('0x54')][_0x8e72('0x55')](function(_0x3205f8){return db['UserProfile'][_0x8e72('0x4b')](_[_0x8e72('0x42')](_0x50f6f1,_0x37da7a[_0x8e72('0x4c')]),{'include':_0x37da7a[_0x8e72('0x35')][_0x8e72('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x3205f8})[_0x8e72('0x28')](function(_0x53ecb6){var _0xe805cc=_0x53ecb6[_0x8e72('0x4f')]({'plain':!![]});return db[_0x8e72('0x56')]['findAll']({'where':{'userProfileId':_0x37da7a[_0x8e72('0x48')]['id']},'raw':!![]})['then'](function(_0xde2d9){if(_0xde2d9){return BPromise[_0x8e72('0x57')](_0xde2d9,function(_0x443421){return new BPromise(function(_0x51baa4,_0x5c9337){if(_0x443421[_0x8e72('0x58')]===null||_0x443421['autoAssociation']===0x1)_0x51baa4(null);return db[_0x8e72('0x59')]['findAll']({'where':{'sectionId':_0x443421['id']},'raw':!![]})['then'](function(_0x22d135){var _0x371adc=_['map'](_0x22d135,function(_0x272374){return qs[_0x8e72('0x50')](_0x272374,['id',_0x8e72('0x51'),_0x8e72('0x52'),_0x8e72('0x5a')]);});_0x51baa4(_0x371adc);})[_0x8e72('0x46')](function(_0x4b30b6){_0x5c9337(_0x4b30b6);});})['then'](function(_0x5e2b49){var _0x85cece=qs[_0x8e72('0x50')](_0x443421,['id','createdAt',_0x8e72('0x52')]);_0x85cece['userProfileId']=_0xe805cc['id'];if(_0x5e2b49)_0x85cece['Resources']=_0x5e2b49;return _0x85cece;})[_0x8e72('0x28')](function(_0x3ad909){return db['UserProfileSection'][_0x8e72('0x4b')](_0x3ad909,{'include':[{'model':db[_0x8e72('0x59')],'as':_0x8e72('0x5b')}],'raw':!![],'transaction':_0x3205f8});});})[_0x8e72('0x28')](function(){return _0xe805cc;});}});});});}})[_0x8e72('0x28')](respondWithResult(_0x11c6d8,0xc9))[_0x8e72('0x46')](handleError(_0x11c6d8,null));};exports['update']=function(_0x54adac,_0x3bc2c8){if(_0x54adac[_0x8e72('0x4c')]['id']){delete _0x54adac['body']['id'];}return db[_0x8e72('0x2f')]['find']({'where':{'id':_0x54adac[_0x8e72('0x48')]['id']}})['then'](handleEntityNotFound(_0x3bc2c8,null))[_0x8e72('0x28')](saveUpdates(_0x54adac[_0x8e72('0x4c')],null))['then'](respondWithResult(_0x3bc2c8,null))[_0x8e72('0x46')](handleError(_0x3bc2c8,null));};exports[_0x8e72('0x5c')]=function(_0x17df07,_0x33d5c0){return db[_0x8e72('0x2f')]['find']({'where':{'id':_0x17df07[_0x8e72('0x48')]['id']}})[_0x8e72('0x28')](handleEntityNotFound(_0x33d5c0,null))[_0x8e72('0x28')](removeEntity(_0x33d5c0,null))[_0x8e72('0x46')](handleError(_0x33d5c0,null));};exports[_0x8e72('0x5d')]=function(_0x50fd6a,_0x59b7cb){return db[_0x8e72('0x2f')][_0x8e72('0x5d')]()[_0x8e72('0x28')](respondWithResult(_0x59b7cb,null))[_0x8e72('0x46')](handleError(_0x59b7cb,null));};exports[_0x8e72('0x5e')]=function(_0x108404,_0x476ead){var _0x57f889=_0x108404[_0x8e72('0x4c')];return db[_0x8e72('0x2f')]['find']({'where':{'id':_0x108404['params']['id']}})[_0x8e72('0x28')](handleEntityNotFound(_0x476ead,null))[_0x8e72('0x28')](function(_0x5a37d5){if(_0x5a37d5){return db['sequelize'][_0x8e72('0x55')](function(_0x5f477a){return db[_0x8e72('0x56')][_0x8e72('0x5c')]({'where':{'userProfileId':_0x108404[_0x8e72('0x48')]['id'],'sectionId':_[_0x8e72('0x2e')](_0x57f889,function(_0x53d51d){return _0x53d51d['sectionId'];})},'transaction':_0x5f477a})[_0x8e72('0x28')](function(){var _0xd1e82=_[_0x8e72('0x2e')](_0x57f889,function(_0x586f32){_0x586f32['userProfileId']=_0x108404[_0x8e72('0x48')]['id'];return _0x586f32;});var _0x4736bc=[];return BPromise[_0x8e72('0x57')](_0xd1e82,function(_0x2ef66e){return db['UserProfileSection'][_0x8e72('0x4b')](_0x2ef66e,{'include':[{'model':db[_0x8e72('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x5f477a})[_0x8e72('0x28')](function(_0x180d22){_0x4736bc[_0x8e72('0x5f')](_0x180d22[_0x8e72('0x4f')]({'plain':!![]}));});})[_0x8e72('0x28')](function(){return _0x4736bc;});});});}})['then'](function(_0x4b29d0){return _0x4b29d0;})[_0x8e72('0x28')](respondWithResult(_0x476ead,null))['catch'](handleError(_0x476ead,null));};exports[_0x8e72('0x60')]=function(_0x176c09,_0x2b886b){var _0x365d52;return db[_0x8e72('0x2f')][_0x8e72('0x4e')]({'where':{'id':_0x176c09[_0x8e72('0x48')]['id']},'attributes':['id',_0x8e72('0x2b')]})[_0x8e72('0x28')](handleEntityNotFound(_0x2b886b,null))['then'](function(_0x3c5535){if(_0x3c5535){_0x365d52=_0x3c5535;return db[_0x8e72('0x56')][_0x8e72('0x5c')]({'where':{'userProfileId':_0x176c09[_0x8e72('0x48')]['id'],'sectionId':_0x176c09[_0x8e72('0x35')][_0x8e72('0x61')]}});}})['then'](function(){return _0x365d52;})[_0x8e72('0x28')](respondWithStatusCode(_0x2b886b,null))[_0x8e72('0x46')](handleError(_0x2b886b,null));};exports[_0x8e72('0x62')]=function(_0x524775,_0x1dfc0c){var _0x196cf2=[];var _0xa8a30f=[];return db['UserProfileSection'][_0x8e72('0x45')]({'where':{'userProfileId':_0x524775[_0x8e72('0x48')]['id']},'raw':!![]})[_0x8e72('0x28')](function(_0x5bcfd2){_0x196cf2=_[_0x8e72('0x40')](_0x5bcfd2,function(_0x846856){return _0x846856['enabled']===0x1||_[_0x8e72('0x63')]([0x3eb,0x709],_0x846856[_0x8e72('0x5a')]);});if(!_[_0x8e72('0x64')](_0x196cf2)){return _[_0x8e72('0x2e')](_0x196cf2,function(_0xeae23d){return _0xeae23d[_0x8e72('0x5a')];});}else{return;}})['then'](function(_0x450a81){if(_0x450a81)_0xa8a30f=_0x450a81;if(_[_0x8e72('0x63')](_0xa8a30f,0x64)){var _0x51f53a=_[_0x8e72('0x4e')](_0x196cf2,{'sectionId':0x64});return hasDefaultDashboard(_0x51f53a)[_0x8e72('0x28')](function(_0x46c5d3){return _['map'](_0x196cf2,function(_0x3bda74){if(_0x3bda74[_0x8e72('0x5a')]===0x64){_0x3bda74['subsections']=_0x46c5d3;}return _0x3bda74;});});}else{return;}})['then'](function(_0x8399bc){if(_0x8399bc)_0x196cf2=_0x8399bc;if(_['includes'](_0xa8a30f,0x3eb)){var _0x3cbb1b=_['find'](_0x196cf2,{'sectionId':0x3eb});return getCustomDashboards(_0x3cbb1b)[_0x8e72('0x28')](function(_0x62d33f){return _[_0x8e72('0x2e')](_0x196cf2,function(_0x576c21){if(_0x3cbb1b[_0x8e72('0x65')]){if(_0x576c21[_0x8e72('0x5a')]===0x3eb){_0x576c21['subsections']=_0x62d33f;}}else{if(_0x576c21[_0x8e72('0x5a')]===0x64){_0x576c21[_0x8e72('0x66')]=_0x62d33f;}}return _0x576c21;});});}else{return;}})['then'](function(_0x47c4a1){if(_0x47c4a1)_0x196cf2=_0x47c4a1;if(_[_0x8e72('0x63')](_0xa8a30f,0x709)){var _0x3856ef=_[_0x8e72('0x4e')](_0x196cf2,{'sectionId':0x709});return getPlugins(_0x3856ef)[_0x8e72('0x28')](function(_0x442e30){if(_0x3856ef['enabled']){return _[_0x8e72('0x2e')](_0x196cf2,function(_0x51bdfe){if(_0x51bdfe[_0x8e72('0x5a')]===0x709){_0x51bdfe[_0x8e72('0x66')]=_0x442e30;}return _0x51bdfe;});}else{var _0x164a46={'sectionId':0x76c,'enabled':0x1,'subsections':_0x442e30};var _0x38b8da=_[_0x8e72('0x2e')](_0x196cf2);_0x38b8da[_0x8e72('0x5f')](_0x164a46);return _0x38b8da;}});}else{return;}})[_0x8e72('0x28')](function(_0x10e299){if(_0x10e299)_0x196cf2=_0x10e299;return _[_0x8e72('0x40')](_0x196cf2,[_0x8e72('0x65'),0x1]);})[_0x8e72('0x28')](respondWithResult(_0x1dfc0c,null))[_0x8e72('0x46')](handleError(_0x1dfc0c,null));};function hasDefaultDashboard(_0xb0558a){var _0x20e010=[0x65];return new BPromise(function(_0x579924,_0x4aaf79){try{if(_0xb0558a[_0x8e72('0x58')]){_0x579924(_0x20e010);}else{return db[_0x8e72('0x59')][_0x8e72('0x67')]({'where':{'sectionId':_0xb0558a['id']},'raw':!![]})[_0x8e72('0x28')](function(_0x21f07a){_0x21f07a?_0x579924(_0x20e010):_0x579924();});}}catch(_0x409c1d){_0x4aaf79(_0x409c1d);}});}function getCustomDashboards(_0x4b3ae7){var _0x5ab0ba=[];return new BPromise(function(_0x332119,_0x2a41ad){try{if(_0x4b3ae7[_0x8e72('0x58')]){return db[_0x8e72('0x68')]['findAll']({'raw':!![]})[_0x8e72('0x28')](function(_0x524ebd){_0x524ebd[_0x8e72('0x69')](function(_0x4d310e){_0x5ab0ba[_0x8e72('0x5f')](_0x4d310e['id']+0x1869f);});_0x332119(_0x5ab0ba);});}else{return db[_0x8e72('0x59')][_0x8e72('0x45')]({'where':{'sectionId':_0x4b3ae7['id']},'raw':!![]})[_0x8e72('0x28')](function(_0x50dac6){_0x50dac6[_0x8e72('0x69')](function(_0x4e64e6){_0x5ab0ba['push'](_0x4e64e6['resourceId']+0x1869f);});_0x332119(_0x5ab0ba);});}}catch(_0x5b3e15){_0x2a41ad(_0x5b3e15);}});}function getPlugins(_0x4bfe32){var _0x470dac=[];return new BPromise(function(_0x43c0e6,_0x349b11){try{if(_0x4bfe32[_0x8e72('0x58')]){return db['Plugin'][_0x8e72('0x45')]({'raw':!![]})[_0x8e72('0x28')](function(_0x32bfd7){_0x32bfd7[_0x8e72('0x69')](function(_0xd1e1d2){_0x470dac[_0x8e72('0x5f')](_0xd1e1d2['id']+0x15b38);});_0x43c0e6(_0x470dac);});}else{return db[_0x8e72('0x59')]['findAll']({'where':{'sectionId':_0x4bfe32['id']},'raw':!![]})[_0x8e72('0x28')](function(_0x2ffb52){_0x2ffb52[_0x8e72('0x69')](function(_0x4dbfcc){_0x470dac[_0x8e72('0x5f')](_0x4dbfcc['resourceId']+0x15b38);});_0x43c0e6(_0x470dac);});}}catch(_0x178329){_0x349b11(_0x178329);}});}exports['addResources']=function(_0x54b4ed,_0x1df021){return db[_0x8e72('0x2f')][_0x8e72('0x4e')]({'where':{'id':_0x54b4ed[_0x8e72('0x48')]['id']}})['then'](handleEntityNotFound(_0x1df021,null))[_0x8e72('0x28')](function(_0x1b90b0){if(_0x1b90b0){return db[_0x8e72('0x54')][_0x8e72('0x55')](function(_0x1ba19f){return db[_0x8e72('0x56')][_0x8e72('0x45')]({'where':{'userProfileId':_0x54b4ed[_0x8e72('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x8e72('0x28')](function(_0x397bb1){if(_0x397bb1){return db[_0x8e72('0x56')][_0x8e72('0x5c')]({'where':{'userProfileId':_0x54b4ed[_0x8e72('0x48')]['id'],'id':_[_0x8e72('0x2e')](_0x397bb1,function(_0x35bef8){return _0x35bef8['id'];})},'transaction':_0x1ba19f});}})[_0x8e72('0x28')](function(_0x513a59){var _0x3eda51=_['map'](_0x54b4ed[_0x8e72('0x4c')],function(_0x1065e2){_0x1065e2[_0x8e72('0x6a')]=_0x54b4ed['params']['id'];return _0x1065e2;});return db[_0x8e72('0x56')][_0x8e72('0x6b')](_0x3eda51,{'raw':!![],'transaction':_0x1ba19f});})[_0x8e72('0x28')](function(_0x2a8ba9){var _0x3202a2=_[_0x8e72('0x40')](_[_0x8e72('0x2e')](_0x2a8ba9,function(_0x390643){return _0x390643[_0x8e72('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x3202a2){return db[_0x8e72('0x56')][_0x8e72('0x45')]({'where':{'userProfileId':_0x54b4ed[_0x8e72('0x48')]['id'],'sectionId':_[_0x8e72('0x2e')](_0x3202a2,function(_0x539005){return _0x539005['sectionId'];})},'attributes':['id',_0x8e72('0x5a')],'raw':!![]})[_0x8e72('0x28')](function(_0x47d126){var _0x5318a2=_['map'](_0x54b4ed['body'],function(_0x49dd49){_0x49dd49['userProfileId']=_0x54b4ed[_0x8e72('0x48')]['id'];return _0x49dd49;});return db['UserProfileResource'][_0x8e72('0x6b')](_0x5318a2,{'raw':!![],'transaction':_0x1ba19f});});}})[_0x8e72('0x46')](handleError(_0x1df021,null));});}})[_0x8e72('0x28')](function(_0x1ec545){var _0x56d5d0=_[_0x8e72('0x2e')](_0x1ec545,function(_0x1700a0){return _0x1700a0['get']({'plain':!![]});});})[_0x8e72('0x28')](respondWithResult(_0x1df021,null))[_0x8e72('0x46')](handleError(_0x1df021,null));};exports[_0x8e72('0x6c')]=function(_0x34ee51,_0x4f1863,_0x10b436){return db['UserProfile']['find']({'where':{'id':_0x34ee51[_0x8e72('0x48')]['id']}})[_0x8e72('0x28')](handleEntityNotFound(_0x4f1863,null))[_0x8e72('0x28')](function(_0x394bfe){if(_0x394bfe){return _0x394bfe[_0x8e72('0x6c')](_0x34ee51[_0x8e72('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x4f1863,null))['catch'](handleError(_0x4f1863,null));};exports[_0x8e72('0x6d')]=function(_0xe7ad85,_0x453609){var _0x3a3be4={'raw':![],'where':{}};var _0x3a45f7={};var _0x582008={'count':0x0,'rows':[]};var _0x78e930=_0xe7ad85[_0x8e72('0x35')][_0x8e72('0x6e')];if(typeof _0x78e930==='undefined'){throw new db[(_0x8e72('0x6f'))][(_0x8e72('0x70'))](_0x8e72('0x71'));}var _0x478f5b=_0xe7ad85[_0x8e72('0x35')][_0x8e72('0x72')]||![];var _0x2edbee=getQueryModels(_0x78e930,_0x478f5b);if(typeof _0x2edbee[_0x8e72('0x73')]===_0x8e72('0x74')){throw new db['Sequelize'][(_0x8e72('0x70'))](_0x8e72('0x75')+_0x78e930+'\x27');}var _0x3adff4=[];if(!_[_0x8e72('0x64')](_0x2edbee[_0x8e72('0x76')])){_0x3adff4=_0x2edbee[_0x8e72('0x76')];}else{_0x3adff4=[{'name':_0x78e930}];}return db[_0x8e72('0x2f')]['findOne']({'where':{'id':_0xe7ad85[_0x8e72('0x48')]['id']}})[_0x8e72('0x28')](handleEntityNotFound(_0x453609,null))[_0x8e72('0x28')](function(_0x3c9d2e){if(_0x3c9d2e){var _0xd42673=[];for(var _0x3482ac=0x0;_0x3482ac<_0x3adff4[_0x8e72('0x3b')];_0x3482ac++){_0xd42673[_0x8e72('0x5f')](db['UserProfileSection'][_0x8e72('0x67')]({'where':{'userProfileId':_0x3c9d2e['id'],'name':_0x3adff4[_0x3482ac][_0x8e72('0x2b')]},'raw':!![]}));}return BPromise[_0x8e72('0x77')](_0xd42673);}})[_0x8e72('0x28')](function(_0x2e0edc){var _0x5224bf=_['filter'](_0x2e0edc,function(_0x319d9c){return _0x319d9c?_0x319d9c:undefined;});var _0xdc45ad=_['filter'](_0x3adff4,['ignore',!![]]);var _0x55cd81=_['isEmpty'](_0x5224bf)&&_[_0x8e72('0x64')](_0xdc45ad)?null:_['union'](_0xdc45ad,_0x5224bf);if(_0x55cd81){var _0x12081e=[];for(var _0x15af80=0x0;_0x15af80<_0x55cd81['length'];_0x15af80++){var _0x360a53=_[_0x8e72('0x4e')](_0x3adff4,function(_0x3d846a){return _0x55cd81[_0x15af80]?_0x3d846a[_0x8e72('0x2b')]===_0x55cd81[_0x15af80][_0x8e72('0x2b')]:null;});if(_0x360a53){if(_0x55cd81[_0x15af80][_0x8e72('0x78')]){_0x12081e[_0x8e72('0x5f')](getAllResources(_0x2edbee[_0x8e72('0x73')],_0x55cd81[_0x15af80]));}else{if(!_0x55cd81[_0x15af80][_0x8e72('0x58')]){_0x12081e[_0x8e72('0x5f')](getAllowedResources(_0x360a53,_0x55cd81[_0x15af80],_0x2edbee[_0x8e72('0x73')]));}else{if(_0x360a53[_0x8e72('0x34')]){_0x12081e[_0x8e72('0x5f')](getAllFilteredResources(_0x360a53,_0x55cd81[_0x15af80]));}}}}}return BPromise['all'](_0x12081e);}else{return null;}})[_0x8e72('0x28')](function(_0x46338c){var _0x160dc5=_0x46338c;var _0x6d048d=null;if(_0x160dc5){_0x6d048d=_0x160dc5[_0x8e72('0x3b')]===0x1?_0x160dc5[0x0]:null;}if(_0x6d048d||_0x160dc5){var _0x328fce=db[_0x2edbee[_0x8e72('0x73')]][_0x8e72('0x30')];_0x3a45f7[_0x8e72('0x34')]=_['keys'](_0x328fce);_0x3a45f7['query']=_[_0x8e72('0x36')](_0xe7ad85['query']);_0x3a45f7['filters']=_[_0x8e72('0x38')](_0x3a45f7['model'],_0x3a45f7[_0x8e72('0x35')]);_0x3a3be4[_0x8e72('0x39')]=_[_0x8e72('0x38')](_0x3a45f7[_0x8e72('0x34')],qs[_0x8e72('0x3a')](_0xe7ad85[_0x8e72('0x35')][_0x8e72('0x3a')]));_0x3a3be4[_0x8e72('0x39')]=_0x3a3be4[_0x8e72('0x39')][_0x8e72('0x3b')]?_0x3a3be4[_0x8e72('0x39')]:_0x3a45f7['model'];if(!_0xe7ad85['query'][_0x8e72('0x3c')](_0x8e72('0x79'))){_0x3a3be4['limit']=qs[_0x8e72('0x22')](_0xe7ad85[_0x8e72('0x35')][_0x8e72('0x22')]);_0x3a3be4[_0x8e72('0x21')]=qs[_0x8e72('0x21')](_0xe7ad85[_0x8e72('0x35')]['offset']);}_0x3a3be4[_0x8e72('0x3d')]=qs[_0x8e72('0x3e')](_0xe7ad85[_0x8e72('0x35')]['sort']);_0x3a3be4[_0x8e72('0x41')]=qs[_0x8e72('0x37')](_['pick'](_0xe7ad85[_0x8e72('0x35')],_0x3a45f7[_0x8e72('0x37')]));if(_0xe7ad85[_0x8e72('0x35')][_0x8e72('0x40')]){_0x3a3be4['where']=_[_0x8e72('0x42')](_0x3a3be4['where'],{'$or':_['map'](_0x328fce,function(_0x3bafce){if(_0x3bafce[_0x8e72('0x32')][_0x8e72('0x33')]!==_0x8e72('0x43')){var _0x492576={};_0x492576[_0x3bafce[_0x8e72('0x7a')]]={'$like':'%'+_0xe7ad85[_0x8e72('0x35')]['filter']+'%'};return _0x492576;}})});}var _0x374aaa=[];if(_0x6d048d){var _0x498e20=_[_0x8e72('0x4e')](_0x3adff4,[_0x8e72('0x2b'),_0x6d048d[_0x8e72('0x2b')]]);if(_0x498e20[_0x8e72('0x7a')]){var _0x57ff25={};if(_0x2edbee[_0x8e72('0x73')]===_0x8e72('0x7b')){_0x57ff25[_0x498e20[_0x8e72('0x7c')]]=_['map'](_0x6d048d[_0x8e72('0x7d')],'id');}else{_0x57ff25[_0x498e20[_0x8e72('0x7c')]]=_0x6d048d['associatedResources'];}_0x374aaa['push'](_0x57ff25);}else{_0x3a3be4[_0x8e72('0x41')]['id']=_0x6d048d[_0x8e72('0x7d')];}}else{for(var _0xb300dd=0x0;_0xb300dd<_0x160dc5[_0x8e72('0x3b')];_0xb300dd++){var _0x498e20=_[_0x8e72('0x4e')](_0x3adff4,[_0x8e72('0x2b'),_0x160dc5[_0xb300dd][_0x8e72('0x2b')]]);if(_0x498e20[_0x8e72('0x7a')]){var _0x57ff25={};_0x57ff25[_0x498e20['foreignKey']]=_0x160dc5[_0xb300dd][_0x8e72('0x7d')];_0x374aaa['push'](_0x57ff25);}else{if(!_0x3a3be4[_0x8e72('0x41')]['id'])_0x3a3be4[_0x8e72('0x41')]['id']=[];_0x160dc5[_0xb300dd][_0x8e72('0x7d')][_0x8e72('0x69')](function(_0x496898){_0x3a3be4[_0x8e72('0x41')]['id'][_0x8e72('0x5f')](_0x496898);});}}}if(!_[_0x8e72('0x64')](_0x374aaa)){_0x3a3be4[_0x8e72('0x41')]=_[_0x8e72('0x42')](_0x3a3be4[_0x8e72('0x41')],{'$and':{'$or':_0x374aaa}});}_0x3a3be4=_[_0x8e72('0x42')]({},_0x3a3be4,_0xe7ad85[_0x8e72('0x4a')]);if(_0x6d048d&&!_0x6d048d[_0x8e72('0x58')]&&_0x2edbee[_0x8e72('0x73')]===_0x8e72('0x7b')){if(_0xe7ad85[_0x8e72('0x35')]['includeAll']){_0x3a3be4[_0x8e72('0x44')]=[{'all':!![]}];}return db[_0x2edbee[_0x8e72('0x73')]][_0x8e72('0x45')](_0x3a3be4)[_0x8e72('0x28')](function(_0x5ea990){var _0x2f0810=[];_0x5ea990[_0x8e72('0x69')](function(_0x4c4e77){var _0x14830a;switch(_0x4c4e77[_0x8e72('0x7e')]){case _0x8e72('0x7f'):_0x14830a=_[_0x8e72('0x4e')](_0x6d048d[_0x8e72('0x7d')],function(_0x4901c0){return _0x4901c0['id']===_0x4c4e77['reportId']&&_0x4901c0['type']===_0x8e72('0x80');});break;case'custom':_0x14830a=_[_0x8e72('0x4e')](_0x6d048d[_0x8e72('0x7d')],function(_0x24a9cd){return _0x24a9cd['id']===_0x4c4e77['reportId']&&_0x24a9cd[_0x8e72('0x32')]===_0x8e72('0x81');});break;}if(_0x14830a)_0x2f0810[_0x8e72('0x5f')](_0x4c4e77);});_0x582008[_0x8e72('0x20')]=_0x2f0810[_0x8e72('0x3b')];_0x582008[_0x8e72('0x82')]=_0x2f0810;return _0x582008;});}else{return db[_0x2edbee['childModel']][_0x8e72('0x20')]({'where':_0x3a3be4[_0x8e72('0x41')]})[_0x8e72('0x28')](function(_0x52b2a8){_0x582008[_0x8e72('0x20')]=_0x52b2a8;if(_0xe7ad85[_0x8e72('0x35')]['includeAll']){if(_0x2edbee[_0x8e72('0x73')]===_0x8e72('0x83')){_0x3a3be4['include']=[{'model':db[_0x8e72('0x84')],'as':_0x8e72('0x85'),'attributes':['id',_0x8e72('0x2b'),_0x8e72('0x86')],'required':_0xe7ad85[_0x8e72('0x35')][_0x8e72('0x87')]?!![]:![]},{'model':db[_0x8e72('0x84')],'as':_0x8e72('0x88'),'attributes':['id',_0x8e72('0x2b'),_0x8e72('0x86')],'through':_0xe7ad85['query']['tag']?{'attributes':[],'where':{'TagId':_0xe7ad85[_0x8e72('0x35')][_0x8e72('0x87')]||undefined}}:{},'required':_0xe7ad85[_0x8e72('0x35')][_0x8e72('0x87')]?!![]:![]}];}else{_0x3a3be4[_0x8e72('0x44')]=[{'all':!![]}];}}return db[_0x2edbee[_0x8e72('0x73')]]['findAll'](_0x3a3be4);})[_0x8e72('0x28')](function(_0x1d0cf6){_0x582008[_0x8e72('0x82')]=_0x1d0cf6;return _0x582008;});}}else{return _0x582008;}})['then'](respondWithFilteredResult(_0x453609,_0x3a3be4))[_0x8e72('0x46')](handleError(_0x453609,null));};function getAllResources(_0x434c18,_0x2690d1){return new BPromise(function(_0x12c8b0,_0x239d01){if(_0x2690d1){var _0x34a6df=_0x2690d1[_0x8e72('0x40')]?{[_0x2690d1[_0x8e72('0x40')]['field']]:_0x2690d1[_0x8e72('0x40')][_0x8e72('0x89')]}:undefined;return db[_0x434c18][_0x8e72('0x45')]({'where':_0x34a6df,'raw':!![]})['then'](function(_0x934762){_0x2690d1['associatedResources']=_[_0x8e72('0x2e')](_0x934762,'id');_0x12c8b0(_0x2690d1);})[_0x8e72('0x46')](function(_0x99691b){_0x239d01(_0x99691b);});}else{_0x12c8b0(null);}});}function getAllFilteredResources(_0x5f492f,_0x5751ea){return new BPromise(function(_0x3ee746,_0x3db9ae){var _0x34c0e4=_0x5f492f[_0x8e72('0x40')]?{[_0x5f492f[_0x8e72('0x40')][_0x8e72('0x7a')]]:_0x5f492f[_0x8e72('0x40')][_0x8e72('0x89')]}:undefined;return db[_0x5f492f[_0x8e72('0x34')]]['findAll']({'where':_0x34c0e4,'raw':!![]})[_0x8e72('0x28')](function(_0x55eecc){_0x5751ea[_0x8e72('0x7d')]=_[_0x8e72('0x2e')](_0x55eecc,function(_0x1b0c65){return _0x1b0c65['name'];});_0x3ee746(_0x5751ea);})[_0x8e72('0x46')](function(_0x109a72){_0x3db9ae(_0x109a72);});});}function getAllowedResources(_0x47bca8,_0x369270,_0x5eefcb){return new BPromise(function(_0x2fa494,_0x14d652){if(_0x369270){return db[_0x8e72('0x59')][_0x8e72('0x45')]({'where':{'sectionId':_0x369270['id']},'raw':!![]})[_0x8e72('0x28')](function(_0x40b5f5){if(_0x47bca8[_0x8e72('0x7a')]&&_0x47bca8['field']!=='id'){_0x369270[_0x8e72('0x7d')]=_[_0x8e72('0x2e')](_0x40b5f5,function(_0xd2675e){return _0xd2675e[_0x47bca8[_0x8e72('0x7a')]];});}else{if(_0x5eefcb===_0x8e72('0x7b')){_0x369270[_0x8e72('0x7d')]=_['map'](_0x40b5f5,function(_0x514248){return{'id':_0x514248[_0x8e72('0x8a')],'type':_0x514248[_0x8e72('0x32')]};});}else{_0x369270[_0x8e72('0x7d')]=_[_0x8e72('0x2e')](_0x40b5f5,function(_0x43b3b1){return _0x43b3b1[_0x8e72('0x8a')];});}}_0x2fa494(_0x369270);})[_0x8e72('0x46')](function(_0x26915a){_0x14d652(_0x26915a);});}else{_0x2fa494(null);}});}function getQueryModels(_0x3cb884,_0x556a9b){var _0x276e20=_0x3cb884[_0x8e72('0x8b')]();var _0xf1a1ce={'childModel':undefined,'parentSections':[]};switch(_0x276e20){case _0x8e72('0x8c'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0x8d');break;case'odbc':_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0x8e');break;case _0x8e72('0x8f'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0x90');_0xf1a1ce[_0x8e72('0x76')]=[{'name':'SquareProjects','field':_0x8e72('0x2b'),'foreignKey':_0x8e72('0x91')}];break;case'projects':_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0x92');break;case _0x8e72('0x93'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0x83');_0xf1a1ce[_0x8e72('0x76')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x8e72('0x94'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0x95');break;case _0x8e72('0x96'):_0xf1a1ce['childModel']=_0x8e72('0x97');break;case _0x8e72('0x98'):_0xf1a1ce[_0x8e72('0x73')]='CmCustomField';break;case _0x8e72('0x99'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0x9a');break;case _0x8e72('0x9b'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0x9c');break;case'faxqueues':_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0x9d');break;case'faxaccounts':_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0x9e');break;case _0x8e72('0x9f'):case'internalroutes':case'outboundroutes':_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xa0');break;case _0x8e72('0xa1'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xa2');break;case _0x8e72('0xa3'):_0xf1a1ce[_0x8e72('0x73')]='VoiceMail';break;case _0x8e72('0xa4'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xa5');_0xf1a1ce[_0x8e72('0x76')]=[{'name':_0x8e72('0xa6'),'field':_0x8e72('0x2b'),'foreignKey':_0x8e72('0xa7'),'model':_0x8e72('0xa8'),'filter':{'field':'role','value':[_0x8e72('0xa9')]}},{'name':_0x8e72('0xaa'),'field':_0x8e72('0x2b'),'foreignKey':_0x8e72('0xa7'),'model':_0x8e72('0xa8'),'filter':{'field':_0x8e72('0xab'),'value':[_0x8e72('0xac')]}},{'name':_0x8e72('0xad'),'field':_0x8e72('0x2b'),'foreignKey':_0x8e72('0xae'),'model':_0x8e72('0xaf'),'filter':{'field':_0x8e72('0x32'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x8e72('0x2b'),'foreignKey':_0x8e72('0xae'),'model':_0x8e72('0xaf'),'filter':{'field':_0x8e72('0x32'),'value':[_0x8e72('0xb0')]}}];break;case _0x8e72('0xb1'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xb2');break;case _0x8e72('0xb3'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xb4');break;case _0x8e72('0xb5'):_0xf1a1ce[_0x8e72('0x73')]='VoicePrefix';break;case _0x8e72('0xb6'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xb7');break;case _0x8e72('0xb8'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xb9');break;case'mailaccounts':_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xba');break;case _0x8e72('0xbb'):_0xf1a1ce['childModel']='MailSubstatus';break;case'openchannelqueues':_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xbc');break;case _0x8e72('0xbd'):_0xf1a1ce[_0x8e72('0x73')]='OpenchannelAccount';break;case _0x8e72('0xbe'):_0xf1a1ce['childModel']=_0x8e72('0xbf');break;case _0x8e72('0xc0'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xc1');break;case _0x8e72('0xc2'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xc3');break;case _0x8e72('0xc4'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xc5');break;case _0x8e72('0xc6'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xc7');break;case _0x8e72('0xc8'):case'queuecampaigns':_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xaf');if(_0x556a9b){_0xf1a1ce[_0x8e72('0x76')]=[{'name':_0x8e72('0xad')},{'name':'QueueCampaigns'}];}break;case _0x8e72('0xc9'):case _0x8e72('0xca'):case _0x8e72('0xcb'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xa8');if(_0x556a9b){_0xf1a1ce[_0x8e72('0x76')]=[{'name':_0x8e72('0xcc'),'filter':{'field':_0x8e72('0xab'),'value':[_0x8e72('0xcd'),'user']},'ignore':!![]},{'name':_0x8e72('0xa6')},{'name':_0x8e72('0xaa')}];}break;case _0x8e72('0xce'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xcf');break;case'salesforceaccounts':_0xf1a1ce['childModel']=_0x8e72('0xd0');break;case _0x8e72('0xd1'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xd2');break;case _0x8e72('0xd3'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xd4');break;case _0x8e72('0xd5'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xd6');break;case _0x8e72('0xd7'):_0xf1a1ce['childModel']=_0x8e72('0xd8');break;case _0x8e72('0xd9'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xa8');break;case _0x8e72('0xda'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xdb');break;case _0x8e72('0xdc'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xdd');break;case _0x8e72('0xde'):_0xf1a1ce[_0x8e72('0x73')]='Dashboard';break;case _0x8e72('0xdf'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xe0');break;case _0x8e72('0xe1'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xe2');break;case _0x8e72('0xe3'):_0xf1a1ce['childModel']=_0x8e72('0xe4');break;case'sounds':_0xf1a1ce['childModel']=_0x8e72('0xe5');break;case'tags':_0xf1a1ce[_0x8e72('0x73')]='Tag';break;case'templates':_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xe6');break;case _0x8e72('0xe7'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xe8');break;case'trunks':_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xe9');break;case _0x8e72('0xea'):_0xf1a1ce['childModel']=_0x8e72('0xeb');break;case _0x8e72('0xec'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xed');break;case _0x8e72('0xee'):_0xf1a1ce['childModel']=_0x8e72('0x7b');_0xf1a1ce[_0x8e72('0x76')]=[{'name':_0x8e72('0xef'),'field':'id','foreignKey':_0x8e72('0xf0')}];break;case _0x8e72('0xf1'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xf2');break;case _0x8e72('0xc4'):_0xf1a1ce[_0x8e72('0x73')]=_0x8e72('0xc5');break;default:return _0xf1a1ce;}return _0xf1a1ce;} \ No newline at end of file +var _0xddf8=['userProfileId','Resources','UserProfileSection','describe','addSections','transaction','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','bulkCreate','removeResources','ids','getResources','section','undefined','Sequelize','ValidationError','mergeResources','parentSections','all','ignore','union','childModel','field','foreignKey','associatedResources','AnalyticExtractedReport','reportType','default','reportId','DefaultReports','custom','CustomReports','Tags','color','Tag','tag','value','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','contacts','CmContact','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','QueueCampaigns','users','agents','telephones','User','Users','admin','user','zendeskaccounts','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','Schedule','sounds','Sound','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','redis','localhost','./userProfile.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','UserProfile','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','clone','get','omit','updatedAt','crudPermissions','sequelize','each','autoAssociation','UserProfileResource','createdAt','sectionId'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xddf8,0x94));var _0x8ddf=function(_0x15a4c8,_0x1ad9f2){_0x15a4c8=_0x15a4c8-0x0;var _0x166023=_0xddf8[_0x15a4c8];return _0x166023;};'use strict';var pdf=require(_0x8ddf('0x0'));var emlformat=require(_0x8ddf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8ddf('0x2'));var jsonpatch=require(_0x8ddf('0x3'));var rp=require(_0x8ddf('0x4'));var moment=require(_0x8ddf('0x5'));var BPromise=require(_0x8ddf('0x6'));var Mustache=require('mustache');var util=require(_0x8ddf('0x7'));var path=require(_0x8ddf('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ddf('0x9'));var fs=require('fs');var _=require(_0x8ddf('0xa'));var squel=require(_0x8ddf('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8ddf('0xc'));var querystring=require(_0x8ddf('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8ddf('0xe'));var as=require(_0x8ddf('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ddf('0x10'))('api');var utils=require(_0x8ddf('0x11'));var config=require(_0x8ddf('0x12'));var db=require('../../mysqldb')['db'];config[_0x8ddf('0x13')]=_['defaults'](config['redis'],{'host':_0x8ddf('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8ddf('0x13')]));require(_0x8ddf('0x15'))[_0x8ddf('0x16')](socket);function respondWithStatusCode(_0x48c22c,_0x127833){_0x127833=_0x127833||0xcc;return function(_0x58b7f9){if(_0x58b7f9){return _0x48c22c[_0x8ddf('0x17')](_0x127833);}return _0x48c22c[_0x8ddf('0x18')](_0x127833)[_0x8ddf('0x19')]();};}function respondWithResult(_0xf61c56,_0x5261b8){_0x5261b8=_0x5261b8||0xc8;return function(_0x3b06e3){if(_0x3b06e3){return _0xf61c56['status'](_0x5261b8)[_0x8ddf('0x1a')](_0x3b06e3);}};}function respondWithFilteredResult(_0x3d2497,_0x103218){return function(_0x396da3){if(_0x396da3){var _0x1dca7a=_0x396da3[_0x8ddf('0x1b')],_0x160e75=_0x103218[_0x8ddf('0x1c')],_0x4fe8e4=_0x103218[_0x8ddf('0x1c')]+_0x103218['limit'],_0x18f78c;if(_0x4fe8e4>=_0x1dca7a){_0x4fe8e4=_0x1dca7a;_0x18f78c=0xc8;}else{_0x18f78c=0xce;}_0x3d2497[_0x8ddf('0x18')](_0x18f78c);return _0x3d2497['set'](_0x8ddf('0x1d'),_0x160e75+'-'+_0x4fe8e4+'/'+_0x1dca7a)[_0x8ddf('0x1a')](_0x396da3);}return null;};}function patchUpdates(_0x5e1cb5){return function(_0x2e9d8c){try{jsonpatch[_0x8ddf('0x1e')](_0x2e9d8c,_0x5e1cb5,!![]);}catch(_0x30e818){return BPromise[_0x8ddf('0x1f')](_0x30e818);}return _0x2e9d8c[_0x8ddf('0x20')]();};}function saveUpdates(_0x55357b,_0x4189c9){return function(_0xc605){if(_0xc605){return _0xc605[_0x8ddf('0x21')](_0x55357b)[_0x8ddf('0x22')](function(_0x2d0cbb){return _0x2d0cbb;});}return null;};}function removeEntity(_0x42f4bf,_0x47809d){return function(_0xb9705f){if(_0xb9705f){return _0xb9705f[_0x8ddf('0x23')]()[_0x8ddf('0x22')](function(){_0x42f4bf['status'](0xcc)[_0x8ddf('0x19')]();});}};}function handleEntityNotFound(_0x28b89e,_0x1794ee){return function(_0x375f37){if(!_0x375f37){_0x28b89e[_0x8ddf('0x17')](0x194);}return _0x375f37;};}function handleError(_0x3f94ae,_0x4bf443){_0x4bf443=_0x4bf443||0x1f4;return function(_0xc06ebb){logger['error'](_0xc06ebb[_0x8ddf('0x24')]);if(_0xc06ebb[_0x8ddf('0x25')]){delete _0xc06ebb['name'];}_0x3f94ae[_0x8ddf('0x18')](_0x4bf443)[_0x8ddf('0x26')](_0xc06ebb);};}exports[_0x8ddf('0x27')]=function(_0x3416c4,_0x5a1b16){var _0x312cc0={},_0x28eb71={},_0x3d75f4={'count':0x0,'rows':[]};var _0x2fd774=_[_0x8ddf('0x28')](db['UserProfile'][_0x8ddf('0x29')],function(_0x16e932){return{'name':_0x16e932['fieldName'],'type':_0x16e932[_0x8ddf('0x2a')][_0x8ddf('0x2b')]};});_0x28eb71[_0x8ddf('0x2c')]=_[_0x8ddf('0x28')](_0x2fd774,_0x8ddf('0x25'));_0x28eb71[_0x8ddf('0x2d')]=_['keys'](_0x3416c4['query']);_0x28eb71[_0x8ddf('0x2e')]=_[_0x8ddf('0x2f')](_0x28eb71[_0x8ddf('0x2c')],_0x28eb71['query']);_0x312cc0[_0x8ddf('0x30')]=_[_0x8ddf('0x2f')](_0x28eb71[_0x8ddf('0x2c')],qs['fields'](_0x3416c4['query'][_0x8ddf('0x31')]));_0x312cc0['attributes']=_0x312cc0[_0x8ddf('0x30')][_0x8ddf('0x32')]?_0x312cc0['attributes']:_0x28eb71[_0x8ddf('0x2c')];if(!_0x3416c4[_0x8ddf('0x2d')][_0x8ddf('0x33')](_0x8ddf('0x34'))){_0x312cc0[_0x8ddf('0x35')]=qs[_0x8ddf('0x35')](_0x3416c4[_0x8ddf('0x2d')][_0x8ddf('0x35')]);_0x312cc0[_0x8ddf('0x1c')]=qs[_0x8ddf('0x1c')](_0x3416c4[_0x8ddf('0x2d')][_0x8ddf('0x1c')]);}_0x312cc0['order']=qs[_0x8ddf('0x36')](_0x3416c4[_0x8ddf('0x2d')][_0x8ddf('0x36')]);_0x312cc0[_0x8ddf('0x37')]=qs[_0x8ddf('0x2e')](_[_0x8ddf('0x38')](_0x3416c4[_0x8ddf('0x2d')],_0x28eb71['filters']),_0x2fd774);if(_0x3416c4[_0x8ddf('0x2d')][_0x8ddf('0x39')]){_0x312cc0[_0x8ddf('0x37')]=_['merge'](_0x312cc0['where'],{'$or':_[_0x8ddf('0x28')](_0x2fd774,function(_0x5e99d4){if(_0x5e99d4[_0x8ddf('0x2a')]!==_0x8ddf('0x3a')){var _0xe22c0e={};_0xe22c0e[_0x5e99d4[_0x8ddf('0x25')]]={'$like':'%'+_0x3416c4[_0x8ddf('0x2d')][_0x8ddf('0x39')]+'%'};return _0xe22c0e;}})});}_0x312cc0=_[_0x8ddf('0x3b')]({},_0x312cc0,_0x3416c4['options']);var _0x29a71d={'where':_0x312cc0[_0x8ddf('0x37')]};return db[_0x8ddf('0x3c')][_0x8ddf('0x1b')](_0x29a71d)[_0x8ddf('0x22')](function(_0x218d76){_0x3d75f4[_0x8ddf('0x1b')]=_0x218d76;if(_0x3416c4[_0x8ddf('0x2d')][_0x8ddf('0x3d')]){_0x312cc0[_0x8ddf('0x3e')]=[{'all':!![]}];}return db[_0x8ddf('0x3c')][_0x8ddf('0x3f')](_0x312cc0);})[_0x8ddf('0x22')](function(_0x37ed98){_0x3d75f4[_0x8ddf('0x40')]=_0x37ed98;return _0x3d75f4;})[_0x8ddf('0x22')](respondWithFilteredResult(_0x5a1b16,_0x312cc0))[_0x8ddf('0x41')](handleError(_0x5a1b16,null));};exports['show']=function(_0x3c86d2,_0x35a8bf){var _0x1c5e22={'raw':![],'where':{'id':_0x3c86d2[_0x8ddf('0x42')]['id']}},_0x246a7f={};_0x246a7f[_0x8ddf('0x2c')]=_['keys'](db['UserProfile'][_0x8ddf('0x29')]);_0x246a7f['query']=_[_0x8ddf('0x43')](_0x3c86d2[_0x8ddf('0x2d')]);_0x246a7f[_0x8ddf('0x2e')]=_[_0x8ddf('0x2f')](_0x246a7f['model'],_0x246a7f['query']);_0x1c5e22['attributes']=_['intersection'](_0x246a7f[_0x8ddf('0x2c')],qs['fields'](_0x3c86d2[_0x8ddf('0x2d')]['fields']));_0x1c5e22[_0x8ddf('0x30')]=_0x1c5e22[_0x8ddf('0x30')][_0x8ddf('0x32')]?_0x1c5e22[_0x8ddf('0x30')]:_0x246a7f[_0x8ddf('0x2c')];if(_0x3c86d2[_0x8ddf('0x2d')][_0x8ddf('0x3d')]){_0x1c5e22[_0x8ddf('0x3e')]=[{'all':!![]}];}_0x1c5e22=_[_0x8ddf('0x3b')]({},_0x1c5e22,_0x3c86d2[_0x8ddf('0x44')]);return db[_0x8ddf('0x3c')][_0x8ddf('0x45')](_0x1c5e22)[_0x8ddf('0x22')](handleEntityNotFound(_0x35a8bf,null))[_0x8ddf('0x22')](respondWithResult(_0x35a8bf,null))['catch'](handleError(_0x35a8bf,null));};exports['create']=function(_0x1b11b0,_0x24da10){return db[_0x8ddf('0x3c')][_0x8ddf('0x46')](_0x1b11b0[_0x8ddf('0x47')],{})[_0x8ddf('0x22')](respondWithResult(_0x24da10,0xc9))[_0x8ddf('0x41')](handleError(_0x24da10,null));};exports[_0x8ddf('0x48')]=function(_0xc6d66,_0x19acad){var _0x387da7={'where':{'id':_0xc6d66[_0x8ddf('0x42')]['id']}},_0x57da3e={};_0x57da3e['model']=_[_0x8ddf('0x43')](db['UserProfile']['rawAttributes']);_0x387da7[_0x8ddf('0x30')]=_[_0x8ddf('0x2f')](_0x57da3e[_0x8ddf('0x2c')],qs['fields'](_0xc6d66['query'][_0x8ddf('0x31')]));_0x387da7[_0x8ddf('0x30')]=_0x387da7[_0x8ddf('0x30')][_0x8ddf('0x32')]?_0x387da7[_0x8ddf('0x30')]:_0x57da3e[_0x8ddf('0x2c')];if(_0xc6d66[_0x8ddf('0x2d')]['includeAll']){_0x387da7['include']=[{'all':!![]}];}_0x387da7=_[_0x8ddf('0x3b')]({},_0x387da7,_0xc6d66[_0x8ddf('0x44')]);return db[_0x8ddf('0x3c')][_0x8ddf('0x45')](_0x387da7)[_0x8ddf('0x22')](handleEntityNotFound(_0x19acad,null))['then'](function(_0x266856){if(_0x266856){var _0xc199cc=_0x266856[_0x8ddf('0x49')]({'plain':!![]});_0xc199cc=qs[_0x8ddf('0x4a')](_0xc199cc,['id','createdAt',_0x8ddf('0x4b'),_0x8ddf('0x4c')]);_0xc6d66[_0x8ddf('0x47')]=_[_0x8ddf('0x4a')](_0xc6d66[_0x8ddf('0x47')],['id','createdAt',_0x8ddf('0x4b')]);return db[_0x8ddf('0x4d')]['transaction'](function(_0x381568){return db[_0x8ddf('0x3c')]['create'](_[_0x8ddf('0x3b')](_0xc199cc,_0xc6d66[_0x8ddf('0x47')]),{'include':_0xc6d66['query'][_0x8ddf('0x3d')]?[{'all':!![]}]:undefined,'transaction':_0x381568})[_0x8ddf('0x22')](function(_0x234bae){var _0x5ad922=_0x234bae[_0x8ddf('0x49')]({'plain':!![]});return db['UserProfileSection'][_0x8ddf('0x3f')]({'where':{'userProfileId':_0xc6d66[_0x8ddf('0x42')]['id']},'raw':!![]})[_0x8ddf('0x22')](function(_0x5c2203){if(_0x5c2203){return BPromise[_0x8ddf('0x4e')](_0x5c2203,function(_0x4206fa){return new BPromise(function(_0x57fd22,_0x200a17){if(_0x4206fa[_0x8ddf('0x4f')]===null||_0x4206fa[_0x8ddf('0x4f')]===0x1)_0x57fd22(null);return db[_0x8ddf('0x50')][_0x8ddf('0x3f')]({'where':{'sectionId':_0x4206fa['id']},'raw':!![]})[_0x8ddf('0x22')](function(_0x2180d2){var _0xa5f297=_[_0x8ddf('0x28')](_0x2180d2,function(_0x4d027d){return qs['omit'](_0x4d027d,['id',_0x8ddf('0x51'),'updatedAt',_0x8ddf('0x52')]);});_0x57fd22(_0xa5f297);})[_0x8ddf('0x41')](function(_0xec456d){_0x200a17(_0xec456d);});})[_0x8ddf('0x22')](function(_0x265f57){var _0x197ec7=qs['omit'](_0x4206fa,['id',_0x8ddf('0x51'),'updatedAt']);_0x197ec7[_0x8ddf('0x53')]=_0x5ad922['id'];if(_0x265f57)_0x197ec7[_0x8ddf('0x54')]=_0x265f57;return _0x197ec7;})[_0x8ddf('0x22')](function(_0x2f53d8){return db[_0x8ddf('0x55')][_0x8ddf('0x46')](_0x2f53d8,{'include':[{'model':db[_0x8ddf('0x50')],'as':'Resources'}],'raw':!![],'transaction':_0x381568});});})['then'](function(){return _0x5ad922;});}});});});}})[_0x8ddf('0x22')](respondWithResult(_0x19acad,0xc9))['catch'](handleError(_0x19acad,null));};exports[_0x8ddf('0x21')]=function(_0x3afbe1,_0x4db371){if(_0x3afbe1[_0x8ddf('0x47')]['id']){delete _0x3afbe1['body']['id'];}return db[_0x8ddf('0x3c')][_0x8ddf('0x45')]({'where':{'id':_0x3afbe1['params']['id']}})[_0x8ddf('0x22')](handleEntityNotFound(_0x4db371,null))['then'](saveUpdates(_0x3afbe1[_0x8ddf('0x47')],null))['then'](respondWithResult(_0x4db371,null))['catch'](handleError(_0x4db371,null));};exports[_0x8ddf('0x23')]=function(_0x37d740,_0x3a3626){return db[_0x8ddf('0x3c')][_0x8ddf('0x45')]({'where':{'id':_0x37d740['params']['id']}})[_0x8ddf('0x22')](handleEntityNotFound(_0x3a3626,null))[_0x8ddf('0x22')](removeEntity(_0x3a3626,null))[_0x8ddf('0x41')](handleError(_0x3a3626,null));};exports[_0x8ddf('0x56')]=function(_0x459407,_0x28352a){return db[_0x8ddf('0x3c')]['describe']()[_0x8ddf('0x22')](respondWithResult(_0x28352a,null))[_0x8ddf('0x41')](handleError(_0x28352a,null));};exports[_0x8ddf('0x57')]=function(_0x42a226,_0x12a32f){var _0xce0740=_0x42a226[_0x8ddf('0x47')];return db[_0x8ddf('0x3c')]['find']({'where':{'id':_0x42a226['params']['id']}})['then'](handleEntityNotFound(_0x12a32f,null))['then'](function(_0x1d7fb5){if(_0x1d7fb5){return db['sequelize'][_0x8ddf('0x58')](function(_0x4c9905){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x42a226['params']['id'],'sectionId':_[_0x8ddf('0x28')](_0xce0740,function(_0x2eb128){return _0x2eb128[_0x8ddf('0x52')];})},'transaction':_0x4c9905})[_0x8ddf('0x22')](function(){var _0x55e5eb=_[_0x8ddf('0x28')](_0xce0740,function(_0x218e9f){_0x218e9f['userProfileId']=_0x42a226[_0x8ddf('0x42')]['id'];return _0x218e9f;});var _0xcdcda5=[];return BPromise[_0x8ddf('0x4e')](_0x55e5eb,function(_0x3a1c5f){return db['UserProfileSection'][_0x8ddf('0x46')](_0x3a1c5f,{'include':[{'model':db[_0x8ddf('0x50')],'as':_0x8ddf('0x54')}],'raw':!![],'transaction':_0x4c9905})['then'](function(_0x3b287d){_0xcdcda5[_0x8ddf('0x59')](_0x3b287d[_0x8ddf('0x49')]({'plain':!![]}));});})[_0x8ddf('0x22')](function(){return _0xcdcda5;});});});}})['then'](function(_0x318d8d){return _0x318d8d;})['then'](respondWithResult(_0x12a32f,null))['catch'](handleError(_0x12a32f,null));};exports[_0x8ddf('0x5a')]=function(_0x25aab4,_0x7161ef){var _0x50b1f9;return db[_0x8ddf('0x3c')][_0x8ddf('0x45')]({'where':{'id':_0x25aab4['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x7161ef,null))[_0x8ddf('0x22')](function(_0x311ee8){if(_0x311ee8){_0x50b1f9=_0x311ee8;return db[_0x8ddf('0x55')]['destroy']({'where':{'userProfileId':_0x25aab4[_0x8ddf('0x42')]['id'],'sectionId':_0x25aab4[_0x8ddf('0x2d')]['ids']}});}})[_0x8ddf('0x22')](function(){return _0x50b1f9;})[_0x8ddf('0x22')](respondWithStatusCode(_0x7161ef,null))[_0x8ddf('0x41')](handleError(_0x7161ef,null));};exports[_0x8ddf('0x5b')]=function(_0x1a18f0,_0x4995ea){var _0x2b12fb=[];var _0x29c42f=[];return db[_0x8ddf('0x55')][_0x8ddf('0x3f')]({'where':{'userProfileId':_0x1a18f0[_0x8ddf('0x42')]['id']},'raw':!![]})[_0x8ddf('0x22')](function(_0x5c022f){_0x2b12fb=_['filter'](_0x5c022f,function(_0x1370cf){return _0x1370cf[_0x8ddf('0x5c')]===0x1||_[_0x8ddf('0x5d')]([0x3eb,0x709],_0x1370cf[_0x8ddf('0x52')]);});if(!_[_0x8ddf('0x5e')](_0x2b12fb)){return _[_0x8ddf('0x28')](_0x2b12fb,function(_0x44ecad){return _0x44ecad[_0x8ddf('0x52')];});}else{return;}})[_0x8ddf('0x22')](function(_0x8f0ab9){if(_0x8f0ab9)_0x29c42f=_0x8f0ab9;if(_[_0x8ddf('0x5d')](_0x29c42f,0x64)){var _0x31a891=_[_0x8ddf('0x45')](_0x2b12fb,{'sectionId':0x64});return hasDefaultDashboard(_0x31a891)['then'](function(_0x479c78){return _[_0x8ddf('0x28')](_0x2b12fb,function(_0x338b49){if(_0x338b49[_0x8ddf('0x52')]===0x64){_0x338b49[_0x8ddf('0x5f')]=_0x479c78;}return _0x338b49;});});}else{return;}})['then'](function(_0x2d1f44){if(_0x2d1f44)_0x2b12fb=_0x2d1f44;if(_[_0x8ddf('0x5d')](_0x29c42f,0x3eb)){var _0x4e72ee=_[_0x8ddf('0x45')](_0x2b12fb,{'sectionId':0x3eb});return getCustomDashboards(_0x4e72ee)['then'](function(_0x101d38){return _['map'](_0x2b12fb,function(_0x582c5b){if(_0x4e72ee[_0x8ddf('0x5c')]){if(_0x582c5b[_0x8ddf('0x52')]===0x3eb){_0x582c5b[_0x8ddf('0x5f')]=_0x101d38;}}else{if(_0x582c5b[_0x8ddf('0x52')]===0x64){_0x582c5b[_0x8ddf('0x5f')]=_0x101d38;}}return _0x582c5b;});});}else{return;}})[_0x8ddf('0x22')](function(_0x37c32a){if(_0x37c32a)_0x2b12fb=_0x37c32a;if(_[_0x8ddf('0x5d')](_0x29c42f,0x709)){var _0x31e1c6=_['find'](_0x2b12fb,{'sectionId':0x709});return getPlugins(_0x31e1c6)[_0x8ddf('0x22')](function(_0x2e211a){if(_0x31e1c6[_0x8ddf('0x5c')]){return _[_0x8ddf('0x28')](_0x2b12fb,function(_0x2b7649){if(_0x2b7649[_0x8ddf('0x52')]===0x709){_0x2b7649[_0x8ddf('0x5f')]=_0x2e211a;}return _0x2b7649;});}else{var _0xdc7b39={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2e211a};var _0x5d8747=_['map'](_0x2b12fb);_0x5d8747['push'](_0xdc7b39);return _0x5d8747;}});}else{return;}})[_0x8ddf('0x22')](function(_0x4f04c9){if(_0x4f04c9)_0x2b12fb=_0x4f04c9;return _[_0x8ddf('0x39')](_0x2b12fb,['enabled',0x1]);})['then'](respondWithResult(_0x4995ea,null))['catch'](handleError(_0x4995ea,null));};function hasDefaultDashboard(_0x374dfc){var _0xcc452d=[0x65];return new BPromise(function(_0x5b8a0b,_0x3f47b3){try{if(_0x374dfc[_0x8ddf('0x4f')]){_0x5b8a0b(_0xcc452d);}else{return db[_0x8ddf('0x50')][_0x8ddf('0x60')]({'where':{'sectionId':_0x374dfc['id']},'raw':!![]})[_0x8ddf('0x22')](function(_0x463c5c){_0x463c5c?_0x5b8a0b(_0xcc452d):_0x5b8a0b();});}}catch(_0x77680e){_0x3f47b3(_0x77680e);}});}function getCustomDashboards(_0x5c1c2a){var _0x4c3568=[];return new BPromise(function(_0x58d0dd,_0x2de8dc){try{if(_0x5c1c2a[_0x8ddf('0x4f')]){return db['Dashboard'][_0x8ddf('0x3f')]({'raw':!![]})[_0x8ddf('0x22')](function(_0x444f27){_0x444f27[_0x8ddf('0x61')](function(_0x220e49){_0x4c3568[_0x8ddf('0x59')](_0x220e49['id']+0x1869f);});_0x58d0dd(_0x4c3568);});}else{return db['UserProfileResource'][_0x8ddf('0x3f')]({'where':{'sectionId':_0x5c1c2a['id']},'raw':!![]})[_0x8ddf('0x22')](function(_0xa444b7){_0xa444b7['forEach'](function(_0x9ed89a){_0x4c3568[_0x8ddf('0x59')](_0x9ed89a[_0x8ddf('0x62')]+0x1869f);});_0x58d0dd(_0x4c3568);});}}catch(_0x38eb13){_0x2de8dc(_0x38eb13);}});}function getPlugins(_0x2513d9){var _0x25e433=[];return new BPromise(function(_0x254804,_0x4f680d){try{if(_0x2513d9[_0x8ddf('0x4f')]){return db['Plugin']['findAll']({'raw':!![]})[_0x8ddf('0x22')](function(_0x21b2e2){_0x21b2e2[_0x8ddf('0x61')](function(_0x19290d){_0x25e433[_0x8ddf('0x59')](_0x19290d['id']+0x15b38);});_0x254804(_0x25e433);});}else{return db[_0x8ddf('0x50')][_0x8ddf('0x3f')]({'where':{'sectionId':_0x2513d9['id']},'raw':!![]})[_0x8ddf('0x22')](function(_0x4d9b0b){_0x4d9b0b['forEach'](function(_0x1dd55b){_0x25e433[_0x8ddf('0x59')](_0x1dd55b[_0x8ddf('0x62')]+0x15b38);});_0x254804(_0x25e433);});}}catch(_0x51576c){_0x4f680d(_0x51576c);}});}exports['addResources']=function(_0x27c6ca,_0x14a8f0){return db['UserProfile'][_0x8ddf('0x45')]({'where':{'id':_0x27c6ca['params']['id']}})[_0x8ddf('0x22')](handleEntityNotFound(_0x14a8f0,null))[_0x8ddf('0x22')](function(_0x1ba8c7){if(_0x1ba8c7){return db[_0x8ddf('0x4d')][_0x8ddf('0x58')](function(_0x278fc2){return db[_0x8ddf('0x55')][_0x8ddf('0x3f')]({'where':{'userProfileId':_0x27c6ca['params']['id']},'attributes':['id'],'raw':!![]})[_0x8ddf('0x22')](function(_0x25e27c){if(_0x25e27c){return db[_0x8ddf('0x55')][_0x8ddf('0x23')]({'where':{'userProfileId':_0x27c6ca[_0x8ddf('0x42')]['id'],'id':_['map'](_0x25e27c,function(_0x4b38ea){return _0x4b38ea['id'];})},'transaction':_0x278fc2});}})[_0x8ddf('0x22')](function(_0x6f4ee0){var _0x4bf3bb=_['map'](_0x27c6ca['body'],function(_0x37a017){_0x37a017['userProfileId']=_0x27c6ca['params']['id'];return _0x37a017;});return db['UserProfileSection']['bulkCreate'](_0x4bf3bb,{'raw':!![],'transaction':_0x278fc2});})[_0x8ddf('0x22')](function(_0x10026b){var _0x3392de=_[_0x8ddf('0x39')](_[_0x8ddf('0x28')](_0x10026b,function(_0x419092){return _0x419092[_0x8ddf('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x3392de){return db[_0x8ddf('0x55')][_0x8ddf('0x3f')]({'where':{'userProfileId':_0x27c6ca[_0x8ddf('0x42')]['id'],'sectionId':_[_0x8ddf('0x28')](_0x3392de,function(_0x40ef4f){return _0x40ef4f[_0x8ddf('0x52')];})},'attributes':['id',_0x8ddf('0x52')],'raw':!![]})[_0x8ddf('0x22')](function(_0x1463f3){var _0x474e67=_[_0x8ddf('0x28')](_0x27c6ca['body'],function(_0x2d5127){_0x2d5127[_0x8ddf('0x53')]=_0x27c6ca['params']['id'];return _0x2d5127;});return db['UserProfileResource'][_0x8ddf('0x63')](_0x474e67,{'raw':!![],'transaction':_0x278fc2});});}})[_0x8ddf('0x41')](handleError(_0x14a8f0,null));});}})['then'](function(_0x3b28b9){var _0x2c0fad=_[_0x8ddf('0x28')](_0x3b28b9,function(_0x552079){return _0x552079[_0x8ddf('0x49')]({'plain':!![]});});})[_0x8ddf('0x22')](respondWithResult(_0x14a8f0,null))[_0x8ddf('0x41')](handleError(_0x14a8f0,null));};exports[_0x8ddf('0x64')]=function(_0x504394,_0x1c4057,_0x5d8c50){return db['UserProfile'][_0x8ddf('0x45')]({'where':{'id':_0x504394[_0x8ddf('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c4057,null))[_0x8ddf('0x22')](function(_0x49434d){if(_0x49434d){return _0x49434d[_0x8ddf('0x64')](_0x504394['query'][_0x8ddf('0x65')]);}})['then'](respondWithStatusCode(_0x1c4057,null))[_0x8ddf('0x41')](handleError(_0x1c4057,null));};exports[_0x8ddf('0x66')]=function(_0x28a3a2,_0x220109){var _0x554548={'raw':![],'where':{}};var _0x245613={};var _0x420887={'count':0x0,'rows':[]};var _0x17483e=_0x28a3a2[_0x8ddf('0x2d')][_0x8ddf('0x67')];if(typeof _0x17483e===_0x8ddf('0x68')){throw new db[(_0x8ddf('0x69'))][(_0x8ddf('0x6a'))]('Unknown\x20section');}var _0x599f7b=_0x28a3a2[_0x8ddf('0x2d')][_0x8ddf('0x6b')]||![];var _0x1919a7=getQueryModels(_0x17483e,_0x599f7b);if(typeof _0x1919a7['childModel']==='undefined'){throw new db['Sequelize'][(_0x8ddf('0x6a'))]('Invalid\x20section\x20\x27'+_0x17483e+'\x27');}var _0x526aaf=[];if(!_['isEmpty'](_0x1919a7[_0x8ddf('0x6c')])){_0x526aaf=_0x1919a7[_0x8ddf('0x6c')];}else{_0x526aaf=[{'name':_0x17483e}];}return db[_0x8ddf('0x3c')][_0x8ddf('0x60')]({'where':{'id':_0x28a3a2['params']['id']}})[_0x8ddf('0x22')](handleEntityNotFound(_0x220109,null))[_0x8ddf('0x22')](function(_0x13e40f){if(_0x13e40f){var _0xde5968=[];for(var _0x32085a=0x0;_0x32085a<_0x526aaf[_0x8ddf('0x32')];_0x32085a++){_0xde5968[_0x8ddf('0x59')](db['UserProfileSection'][_0x8ddf('0x60')]({'where':{'userProfileId':_0x13e40f['id'],'name':_0x526aaf[_0x32085a][_0x8ddf('0x25')]},'raw':!![]}));}return BPromise[_0x8ddf('0x6d')](_0xde5968);}})[_0x8ddf('0x22')](function(_0xb37fa8){var _0x2c1c69=_[_0x8ddf('0x39')](_0xb37fa8,function(_0x5ca632){return _0x5ca632?_0x5ca632:undefined;});var _0x544ef6=_[_0x8ddf('0x39')](_0x526aaf,[_0x8ddf('0x6e'),!![]]);var _0x1cf855=_[_0x8ddf('0x5e')](_0x2c1c69)&&_[_0x8ddf('0x5e')](_0x544ef6)?null:_[_0x8ddf('0x6f')](_0x544ef6,_0x2c1c69);if(_0x1cf855){var _0x4bdf34=[];for(var _0xf808d4=0x0;_0xf808d4<_0x1cf855[_0x8ddf('0x32')];_0xf808d4++){var _0x373e5e=_[_0x8ddf('0x45')](_0x526aaf,function(_0x556ba9){return _0x1cf855[_0xf808d4]?_0x556ba9[_0x8ddf('0x25')]===_0x1cf855[_0xf808d4][_0x8ddf('0x25')]:null;});if(_0x373e5e){if(_0x1cf855[_0xf808d4]['ignore']){_0x4bdf34[_0x8ddf('0x59')](getAllResources(_0x1919a7[_0x8ddf('0x70')],_0x1cf855[_0xf808d4]));}else{if(!_0x1cf855[_0xf808d4][_0x8ddf('0x4f')]){_0x4bdf34[_0x8ddf('0x59')](getAllowedResources(_0x373e5e,_0x1cf855[_0xf808d4],_0x1919a7[_0x8ddf('0x70')]));}else{if(_0x373e5e[_0x8ddf('0x2c')]){_0x4bdf34['push'](getAllFilteredResources(_0x373e5e,_0x1cf855[_0xf808d4]));}}}}}return BPromise['all'](_0x4bdf34);}else{return null;}})[_0x8ddf('0x22')](function(_0x30a654){var _0x13d506=_0x30a654;var _0x2809bf=null;if(_0x13d506){_0x2809bf=_0x13d506[_0x8ddf('0x32')]===0x1?_0x13d506[0x0]:null;}if(_0x2809bf||_0x13d506){var _0x5b21d9=db[_0x1919a7['childModel']][_0x8ddf('0x29')];_0x245613[_0x8ddf('0x2c')]=_[_0x8ddf('0x43')](_0x5b21d9);_0x245613['query']=_[_0x8ddf('0x43')](_0x28a3a2[_0x8ddf('0x2d')]);_0x245613[_0x8ddf('0x2e')]=_[_0x8ddf('0x2f')](_0x245613[_0x8ddf('0x2c')],_0x245613[_0x8ddf('0x2d')]);_0x554548[_0x8ddf('0x30')]=_[_0x8ddf('0x2f')](_0x245613[_0x8ddf('0x2c')],qs[_0x8ddf('0x31')](_0x28a3a2[_0x8ddf('0x2d')][_0x8ddf('0x31')]));_0x554548['attributes']=_0x554548[_0x8ddf('0x30')][_0x8ddf('0x32')]?_0x554548['attributes']:_0x245613['model'];if(!_0x28a3a2[_0x8ddf('0x2d')][_0x8ddf('0x33')](_0x8ddf('0x34'))){_0x554548[_0x8ddf('0x35')]=qs[_0x8ddf('0x35')](_0x28a3a2['query']['limit']);_0x554548[_0x8ddf('0x1c')]=qs['offset'](_0x28a3a2[_0x8ddf('0x2d')][_0x8ddf('0x1c')]);}_0x554548['order']=qs['sort'](_0x28a3a2[_0x8ddf('0x2d')]['sort']);_0x554548[_0x8ddf('0x37')]=qs[_0x8ddf('0x2e')](_[_0x8ddf('0x38')](_0x28a3a2['query'],_0x245613[_0x8ddf('0x2e')]));if(_0x28a3a2[_0x8ddf('0x2d')][_0x8ddf('0x39')]){_0x554548['where']=_['merge'](_0x554548[_0x8ddf('0x37')],{'$or':_[_0x8ddf('0x28')](_0x5b21d9,function(_0x37229b){if(_0x37229b['type'][_0x8ddf('0x2b')]!==_0x8ddf('0x3a')){var _0x5d96cf={};_0x5d96cf[_0x37229b['field']]={'$like':'%'+_0x28a3a2[_0x8ddf('0x2d')]['filter']+'%'};return _0x5d96cf;}})});}var _0x58cb0b=[];if(_0x2809bf){var _0x307c0d=_['find'](_0x526aaf,[_0x8ddf('0x25'),_0x2809bf[_0x8ddf('0x25')]]);if(_0x307c0d[_0x8ddf('0x71')]){var _0x1aa791={};if(_0x1919a7[_0x8ddf('0x70')]==='AnalyticExtractedReport'){_0x1aa791[_0x307c0d[_0x8ddf('0x72')]]=_[_0x8ddf('0x28')](_0x2809bf['associatedResources'],'id');}else{_0x1aa791[_0x307c0d[_0x8ddf('0x72')]]=_0x2809bf[_0x8ddf('0x73')];}_0x58cb0b[_0x8ddf('0x59')](_0x1aa791);}else{_0x554548[_0x8ddf('0x37')]['id']=_0x2809bf[_0x8ddf('0x73')];}}else{for(var _0x3d4f02=0x0;_0x3d4f02<_0x13d506[_0x8ddf('0x32')];_0x3d4f02++){var _0x307c0d=_['find'](_0x526aaf,[_0x8ddf('0x25'),_0x13d506[_0x3d4f02][_0x8ddf('0x25')]]);if(_0x307c0d[_0x8ddf('0x71')]){var _0x1aa791={};_0x1aa791[_0x307c0d[_0x8ddf('0x72')]]=_0x13d506[_0x3d4f02][_0x8ddf('0x73')];_0x58cb0b['push'](_0x1aa791);}else{if(!_0x554548[_0x8ddf('0x37')]['id'])_0x554548['where']['id']=[];_0x13d506[_0x3d4f02][_0x8ddf('0x73')][_0x8ddf('0x61')](function(_0x544aaf){_0x554548[_0x8ddf('0x37')]['id'][_0x8ddf('0x59')](_0x544aaf);});}}}if(!_[_0x8ddf('0x5e')](_0x58cb0b)){_0x554548[_0x8ddf('0x37')]=_['merge'](_0x554548[_0x8ddf('0x37')],{'$and':{'$or':_0x58cb0b}});}_0x554548=_[_0x8ddf('0x3b')]({},_0x554548,_0x28a3a2[_0x8ddf('0x44')]);if(_0x2809bf&&!_0x2809bf[_0x8ddf('0x4f')]&&_0x1919a7[_0x8ddf('0x70')]===_0x8ddf('0x74')){if(_0x28a3a2[_0x8ddf('0x2d')]['includeAll']){_0x554548['include']=[{'all':!![]}];}return db[_0x1919a7[_0x8ddf('0x70')]][_0x8ddf('0x3f')](_0x554548)[_0x8ddf('0x22')](function(_0x51981e){var _0x4d785b=[];_0x51981e[_0x8ddf('0x61')](function(_0x35b06d){var _0x404aa1;switch(_0x35b06d[_0x8ddf('0x75')]){case _0x8ddf('0x76'):_0x404aa1=_[_0x8ddf('0x45')](_0x2809bf['associatedResources'],function(_0x155c8a){return _0x155c8a['id']===_0x35b06d[_0x8ddf('0x77')]&&_0x155c8a[_0x8ddf('0x2a')]===_0x8ddf('0x78');});break;case _0x8ddf('0x79'):_0x404aa1=_[_0x8ddf('0x45')](_0x2809bf['associatedResources'],function(_0x45813e){return _0x45813e['id']===_0x35b06d['reportId']&&_0x45813e['type']===_0x8ddf('0x7a');});break;}if(_0x404aa1)_0x4d785b[_0x8ddf('0x59')](_0x35b06d);});_0x420887['count']=_0x4d785b[_0x8ddf('0x32')];_0x420887['rows']=_0x4d785b;return _0x420887;});}else{return db[_0x1919a7[_0x8ddf('0x70')]]['count']({'where':_0x554548['where']})['then'](function(_0x2b86d8){_0x420887[_0x8ddf('0x1b')]=_0x2b86d8;if(_0x28a3a2[_0x8ddf('0x2d')][_0x8ddf('0x3d')]){if(_0x1919a7['childModel']==='CmContact'){_0x554548[_0x8ddf('0x3e')]=[{'model':db['Tag'],'as':_0x8ddf('0x7b'),'attributes':['id','name',_0x8ddf('0x7c')],'required':_0x28a3a2[_0x8ddf('0x2d')]['tag']?!![]:![]},{'model':db[_0x8ddf('0x7d')],'as':'ThroughTags','attributes':['id',_0x8ddf('0x25'),_0x8ddf('0x7c')],'through':_0x28a3a2[_0x8ddf('0x2d')][_0x8ddf('0x7e')]?{'attributes':[],'where':{'TagId':_0x28a3a2[_0x8ddf('0x2d')]['tag']||undefined}}:{},'required':_0x28a3a2[_0x8ddf('0x2d')][_0x8ddf('0x7e')]?!![]:![]}];}else{_0x554548['include']=[{'all':!![]}];}}return db[_0x1919a7[_0x8ddf('0x70')]][_0x8ddf('0x3f')](_0x554548);})[_0x8ddf('0x22')](function(_0x38cbfa){_0x420887[_0x8ddf('0x40')]=_0x38cbfa;return _0x420887;});}}else{return _0x420887;}})[_0x8ddf('0x22')](respondWithFilteredResult(_0x220109,_0x554548))[_0x8ddf('0x41')](handleError(_0x220109,null));};function getAllResources(_0x593971,_0x47533f){return new BPromise(function(_0xd01a4,_0x54aa28){if(_0x47533f){var _0x1a18fd=_0x47533f[_0x8ddf('0x39')]?{[_0x47533f['filter']['field']]:_0x47533f[_0x8ddf('0x39')][_0x8ddf('0x7f')]}:undefined;return db[_0x593971]['findAll']({'where':_0x1a18fd,'raw':!![]})[_0x8ddf('0x22')](function(_0x17c252){_0x47533f[_0x8ddf('0x73')]=_['map'](_0x17c252,'id');_0xd01a4(_0x47533f);})[_0x8ddf('0x41')](function(_0x4a6618){_0x54aa28(_0x4a6618);});}else{_0xd01a4(null);}});}function getAllFilteredResources(_0xb58b48,_0x29c734){return new BPromise(function(_0x4c3b28,_0x551e66){var _0x14d4d9=_0xb58b48[_0x8ddf('0x39')]?{[_0xb58b48[_0x8ddf('0x39')]['field']]:_0xb58b48['filter'][_0x8ddf('0x7f')]}:undefined;return db[_0xb58b48['model']][_0x8ddf('0x3f')]({'where':_0x14d4d9,'raw':!![]})[_0x8ddf('0x22')](function(_0x503709){_0x29c734[_0x8ddf('0x73')]=_[_0x8ddf('0x28')](_0x503709,function(_0x10f79d){return _0x10f79d[_0x8ddf('0x25')];});_0x4c3b28(_0x29c734);})['catch'](function(_0x105fa8){_0x551e66(_0x105fa8);});});}function getAllowedResources(_0x4b82d0,_0x4ca9aa,_0x5595c5){return new BPromise(function(_0x50f8e1,_0x41726b){if(_0x4ca9aa){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4ca9aa['id']},'raw':!![]})['then'](function(_0x4928d2){if(_0x4b82d0[_0x8ddf('0x71')]&&_0x4b82d0['field']!=='id'){_0x4ca9aa[_0x8ddf('0x73')]=_[_0x8ddf('0x28')](_0x4928d2,function(_0x4cd7cc){return _0x4cd7cc[_0x4b82d0[_0x8ddf('0x71')]];});}else{if(_0x5595c5==='AnalyticExtractedReport'){_0x4ca9aa[_0x8ddf('0x73')]=_[_0x8ddf('0x28')](_0x4928d2,function(_0x249a6d){return{'id':_0x249a6d[_0x8ddf('0x62')],'type':_0x249a6d[_0x8ddf('0x2a')]};});}else{_0x4ca9aa['associatedResources']=_[_0x8ddf('0x28')](_0x4928d2,function(_0x1c0423){return _0x1c0423['resourceId'];});}}_0x50f8e1(_0x4ca9aa);})[_0x8ddf('0x41')](function(_0x1c743a){_0x41726b(_0x1c743a);});}else{_0x50f8e1(null);}});}function getQueryModels(_0x3280e4,_0x28149f){var _0x946950=_0x3280e4['toLowerCase']();var _0x585c6f={'childModel':undefined,'parentSections':[]};switch(_0x946950){case _0x8ddf('0x80'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x81');break;case _0x8ddf('0x82'):_0x585c6f['childModel']=_0x8ddf('0x83');break;case _0x8ddf('0x84'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x85');_0x585c6f[_0x8ddf('0x6c')]=[{'name':'SquareProjects','field':'name','foreignKey':_0x8ddf('0x86')}];break;case _0x8ddf('0x87'):_0x585c6f['childModel']='JscriptyProject';break;case _0x8ddf('0x88'):_0x585c6f['childModel']=_0x8ddf('0x89');_0x585c6f[_0x8ddf('0x6c')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x8ddf('0x8a'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x8b');break;case _0x8ddf('0x8c'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x8d');break;case _0x8ddf('0x8e'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x8f');break;case'chatqueues':_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x90');break;case'chatwebsites':_0x585c6f[_0x8ddf('0x70')]='ChatWebsite';break;case'faxqueues':_0x585c6f['childModel']=_0x8ddf('0x91');break;case _0x8ddf('0x92'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x93');break;case'inboundroutes':case _0x8ddf('0x94'):case _0x8ddf('0x95'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x96');break;case _0x8ddf('0x97'):_0x585c6f[_0x8ddf('0x70')]='VoiceContext';break;case'voicemails':_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x98');break;case _0x8ddf('0x99'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x9a');_0x585c6f[_0x8ddf('0x6c')]=[{'name':_0x8ddf('0x9b'),'field':_0x8ddf('0x25'),'foreignKey':_0x8ddf('0x9c'),'model':'User','filter':{'field':_0x8ddf('0x9d'),'value':[_0x8ddf('0x9e')]}},{'name':_0x8ddf('0x9f'),'field':_0x8ddf('0x25'),'foreignKey':_0x8ddf('0x9c'),'model':'User','filter':{'field':_0x8ddf('0x9d'),'value':[_0x8ddf('0xa0')]}},{'name':_0x8ddf('0xa1'),'field':'name','foreignKey':_0x8ddf('0xa2'),'model':_0x8ddf('0xa3'),'filter':{'field':'type','value':[_0x8ddf('0xa4')]}},{'name':'QueueCampaigns','field':_0x8ddf('0x25'),'foreignKey':_0x8ddf('0xa2'),'model':'VoiceQueue','filter':{'field':_0x8ddf('0x2a'),'value':[_0x8ddf('0xa5')]}}];break;case'musiconholds':_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xa6');break;case _0x8ddf('0xa7'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xa8');break;case _0x8ddf('0xa9'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xaa');break;case'ivrcampaigns':_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xab');break;case _0x8ddf('0xac'):_0x585c6f['childModel']=_0x8ddf('0xad');break;case _0x8ddf('0xae'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xaf');break;case _0x8ddf('0xb0'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xb1');break;case _0x8ddf('0xb2'):_0x585c6f[_0x8ddf('0x70')]='OpenchannelQueue';break;case _0x8ddf('0xb3'):_0x585c6f['childModel']=_0x8ddf('0xb4');break;case _0x8ddf('0xb5'):_0x585c6f['childModel']=_0x8ddf('0xb6');break;case'smsaccounts':_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xb7');break;case _0x8ddf('0xb8'):_0x585c6f['childModel']=_0x8ddf('0xb9');break;case _0x8ddf('0xba'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xbb');break;case _0x8ddf('0xbc'):_0x585c6f[_0x8ddf('0x70')]='Team';break;case _0x8ddf('0xbd'):case'queuecampaigns':_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xa3');if(_0x28149f){_0x585c6f[_0x8ddf('0x6c')]=[{'name':'VoiceQueues'},{'name':_0x8ddf('0xbe')}];}break;case _0x8ddf('0xbf'):case _0x8ddf('0xc0'):case _0x8ddf('0xc1'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xc2');if(_0x28149f){_0x585c6f[_0x8ddf('0x6c')]=[{'name':_0x8ddf('0xc3'),'filter':{'field':_0x8ddf('0x9d'),'value':[_0x8ddf('0xc4'),_0x8ddf('0xc5')]},'ignore':!![]},{'name':'Agents'},{'name':_0x8ddf('0x9f')}];}break;case _0x8ddf('0xc6'):_0x585c6f[_0x8ddf('0x70')]='ZendeskAccount';break;case _0x8ddf('0xc7'):_0x585c6f[_0x8ddf('0x70')]='SalesforceAccount';break;case'freshdeskaccounts':_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xc8');break;case _0x8ddf('0xc9'):_0x585c6f['childModel']=_0x8ddf('0xca');break;case _0x8ddf('0xcb'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xcc');break;case _0x8ddf('0xcd'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xce');break;case _0x8ddf('0xcf'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xc2');break;case _0x8ddf('0xd0'):_0x585c6f[_0x8ddf('0x70')]='CannedAnswer';break;case _0x8ddf('0xd1'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xd2');break;case _0x8ddf('0xd3'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xd4');break;case _0x8ddf('0xd5'):_0x585c6f['childModel']='Interval';break;case _0x8ddf('0xd6'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xd7');break;case'scheduler':_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xd8');break;case _0x8ddf('0xd9'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xda');break;case'tags':_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x7d');break;case'templates':_0x585c6f['childModel']='Template';break;case _0x8ddf('0xdb'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xdc');break;case _0x8ddf('0xdd'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xde');break;case _0x8ddf('0xdf'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xe0');break;case _0x8ddf('0xe1'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0xe2');break;case _0x8ddf('0xe3'):_0x585c6f[_0x8ddf('0x70')]=_0x8ddf('0x74');_0x585c6f[_0x8ddf('0x6c')]=[{'name':_0x8ddf('0xe4'),'field':'id','foreignKey':'reportId'}];break;case _0x8ddf('0xe5'):_0x585c6f['childModel']=_0x8ddf('0xe6');break;case _0x8ddf('0xba'):_0x585c6f['childModel']=_0x8ddf('0xbb');break;default:return _0x585c6f;}return _0x585c6f;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 3dd68f6..728666d 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 _0x1a18=['save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x332357,_0x3e2e83){var _0x36dea0=function(_0x475113){while(--_0x475113){_0x332357['push'](_0x332357['shift']());}};_0x36dea0(++_0x3e2e83);}(_0x1a18,0x102));var _0x81a1=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0x1a18[_0x211bc3];return _0x34c9a2;};'use strict';var EventEmitter=require(_0x81a1('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x81a1('0x1'),'afterUpdate':'update','afterDestroy':_0x81a1('0x2')};function emitEvent(_0x4508fb){return function(_0x473703,_0x30c6c8,_0x29477a){UserProfileEvents[_0x81a1('0x3')](_0x4508fb+':'+_0x473703['id'],_0x473703);UserProfileEvents[_0x81a1('0x3')](_0x4508fb,_0x473703);_0x29477a(null);};}for(var e in events){if(events[_0x81a1('0x4')](e)){var event=events[e];UserProfile[_0x81a1('0x5')](e,emitEvent(event));}}module[_0x81a1('0x6')]=UserProfileEvents; \ No newline at end of file +var _0xec06=['UserProfile','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x435a6e,_0x2814d1){var _0x5bd249=function(_0x3a195a){while(--_0x3a195a){_0x435a6e['push'](_0x435a6e['shift']());}};_0x5bd249(++_0x2814d1);}(_0xec06,0x104));var _0x6ec0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xec06[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x6ec0('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x6ec0('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6ec0('0x2'),'afterUpdate':_0x6ec0('0x3'),'afterDestroy':_0x6ec0('0x4')};function emitEvent(_0x5654f0){return function(_0x4a1230,_0x454556,_0x17cd2c){UserProfileEvents[_0x6ec0('0x5')](_0x5654f0+':'+_0x4a1230['id'],_0x4a1230);UserProfileEvents[_0x6ec0('0x5')](_0x5654f0,_0x4a1230);_0x17cd2c(null);};}for(var e in events){if(events[_0x6ec0('0x6')](e)){var event=events[e];UserProfile[_0x6ec0('0x7')](e,emitEvent(event));}}module[_0x6ec0('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index fff459a..a6eb5b8 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 _0x887f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','define','UserProfile'];(function(_0x5258af,_0x1a7744){var _0x4ad327=function(_0x1b8bce){while(--_0x1b8bce){_0x5258af['push'](_0x5258af['shift']());}};_0x4ad327(++_0x1a7744);}(_0x887f,0x1a2));var _0xf887=function(_0x190a90,_0x188a70){_0x190a90=_0x190a90-0x0;var _0x12140f=_0x887f[_0x190a90];return _0x12140f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf887('0x0'))(_0xf887('0x1'));var moment=require(_0xf887('0x2'));var BPromise=require(_0xf887('0x3'));var rp=require(_0xf887('0x4'));var fs=require('fs');var path=require(_0xf887('0x5'));var rimraf=require(_0xf887('0x6'));var config=require(_0xf887('0x7'));var attributes=require(_0xf887('0x8'));module['exports']=function(_0x419315,_0x1050e0){return _0x419315[_0xf887('0x9')](_0xf887('0xa'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x031b=['user_profiles','util','path','rimraf','./userProfile.attributes','exports','define'];(function(_0x12ed40,_0x152286){var _0x2bd024=function(_0x12680a){while(--_0x12680a){_0x12ed40['push'](_0x12ed40['shift']());}};_0x2bd024(++_0x152286);}(_0x031b,0x151));var _0xb031=function(_0x5c124e,_0x4540ef){_0x5c124e=_0x5c124e-0x0;var _0x38079d=_0x031b[_0x5c124e];return _0x38079d;};'use strict';var _=require('lodash');var util=require(_0xb031('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb031('0x1'));var rimraf=require(_0xb031('0x2'));var config=require('../../config/environment');var attributes=require(_0xb031('0x3'));module[_0xb031('0x4')]=function(_0xb2782e,_0x49fe4b){return _0xb2782e[_0xb031('0x5')]('UserProfile',attributes,{'tableName':_0xb031('0x6'),'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 5066518..6d76de2 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 _0xbd51=['request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket'];(function(_0x13d0e6,_0x136cc8){var _0x4c62f0=function(_0x59655a){while(--_0x59655a){_0x13d0e6['push'](_0x13d0e6['shift']());}};_0x4c62f0(++_0x136cc8);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x89c375,_0x1b7328){_0x89c375=_0x89c375-0x0;var _0x23b702=_0xbd51[_0x89c375];return _0x23b702;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});config[_0x1bd5('0x8')]=_[_0x1bd5('0x9')](config[_0x1bd5('0x8')],{'host':_0x1bd5('0xa'),'port':0x18eb});var socket=require(_0x1bd5('0xb'))(new Redis(config['redis']));require(_0x1bd5('0xc'))['register'](socket);function respondWithRpcPromise(_0x2bd975,_0x28df8e,_0x3b868a){return new BPromise(function(_0x1fbc68,_0x2344e1){return client[_0x1bd5('0xd')](_0x2bd975,_0x3b868a)['then'](function(_0x456ef8){logger['info'](_0x1bd5('0xe'),_0x28df8e,_0x1bd5('0xf'));logger[_0x1bd5('0x10')](_0x1bd5('0x11'),_0x28df8e,_0x1bd5('0xf'),JSON[_0x1bd5('0x12')](_0x456ef8));if(_0x456ef8[_0x1bd5('0x13')]){if(_0x456ef8['error']['code']===0x1f4){logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);return _0x2344e1(_0x456ef8['error']['message']);}logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);return _0x1fbc68(_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);}else{logger[_0x1bd5('0x15')](_0x1bd5('0xe'),_0x28df8e,_0x1bd5('0xf'));_0x1fbc68(_0x456ef8['result']['message']);}})[_0x1bd5('0x16')](function(_0x260827){logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x260827);_0x2344e1(_0x260827);});});} \ No newline at end of file +var _0x6aa7=['client','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x48bda2,_0x3acde3){var _0x5ae22e=function(_0x3d14aa){while(--_0x3d14aa){_0x48bda2['push'](_0x48bda2['shift']());}};_0x5ae22e(++_0x3acde3);}(_0x6aa7,0x178));var _0x76aa=function(_0x5e6547,_0xd517cb){_0x5e6547=_0x5e6547-0x0;var _0x2ddb39=_0x6aa7[_0x5e6547];return _0x2ddb39;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});config[_0x76aa('0x9')]=_[_0x76aa('0xa')](config[_0x76aa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x76aa('0xb'))(new Redis(config[_0x76aa('0x9')]));require(_0x76aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xcd99aa,_0x25856d,_0x41643a){return new BPromise(function(_0x16cb50,_0x37f1ab){return client[_0x76aa('0xd')](_0xcd99aa,_0x41643a)[_0x76aa('0xe')](function(_0x8dc35c){logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,'request\x20sent');logger[_0x76aa('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x25856d,_0x76aa('0x12'),JSON[_0x76aa('0x13')](_0x8dc35c));if(_0x8dc35c[_0x76aa('0x14')]){if(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x15')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x25856d,_0x8dc35c[_0x76aa('0x14')]['message']);return _0x37f1ab(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x16')]);}logger['error'](_0x76aa('0x10'),_0x25856d,_0x8dc35c['error'][_0x76aa('0x16')]);return _0x16cb50(_0x8dc35c['error'][_0x76aa('0x16')]);}else{logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,_0x76aa('0x12'));_0x16cb50(_0x8dc35c[_0x76aa('0x17')][_0x76aa('0x16')]);}})['catch'](function(_0x5d6202){logger[_0x76aa('0x14')](_0x76aa('0x10'),_0x25856d,_0x5d6202);_0x37f1ab(_0x5d6202);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 4c05d45..72a3c87 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 _0xbe0d=['length','userProfile:','./userProfile.events','save','remove','removeListener'];(function(_0x157298,_0x2f1dd2){var _0x43368c=function(_0x5848ff){while(--_0x5848ff){_0x157298['push'](_0x157298['shift']());}};_0x43368c(++_0x2f1dd2);}(_0xbe0d,0xbc));var _0xdbe0=function(_0xf22ee8,_0x41b0c5){_0xf22ee8=_0xf22ee8-0x0;var _0x57bd7c=_0xbe0d[_0xf22ee8];return _0x57bd7c;};'use strict';var UserProfileEvents=require(_0xdbe0('0x0'));var events=[_0xdbe0('0x1'),_0xdbe0('0x2'),'update'];function createListener(_0x2ea02a,_0x378b58){return function(_0x1f5459){_0x378b58['emit'](_0x2ea02a,_0x1f5459);};}function removeListener(_0x184817,_0x3af08f){return function(){UserProfileEvents[_0xdbe0('0x3')](_0x184817,_0x3af08f);};}exports['register']=function(_0x2d9b65){for(var _0x64e108=0x0,_0x54ad00=events[_0xdbe0('0x4')];_0x64e108<_0x54ad00;_0x64e108++){var _0xf6705e=events[_0x64e108];var _0x281ca1=createListener(_0xdbe0('0x5')+_0xf6705e,_0x2d9b65);UserProfileEvents['on'](_0xf6705e,_0x281ca1);}}; \ No newline at end of file +var _0xeaeb=['removeListener','register','length','userProfile:','./userProfile.events','save','update'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xeaeb,0xcf));var _0xbeae=function(_0xe8b420,_0x1a892d){_0xe8b420=_0xe8b420-0x0;var _0x50f7b7=_0xeaeb[_0xe8b420];return _0x50f7b7;};'use strict';var UserProfileEvents=require(_0xbeae('0x0'));var events=[_0xbeae('0x1'),'remove',_0xbeae('0x2')];function createListener(_0x1e10a5,_0x277d58){return function(_0x24060a){_0x277d58['emit'](_0x1e10a5,_0x24060a);};}function removeListener(_0x1ba962,_0x1535e0){return function(){UserProfileEvents[_0xbeae('0x3')](_0x1ba962,_0x1535e0);};}exports[_0xbeae('0x4')]=function(_0x237835){for(var _0x4f2a84=0x0,_0x3d5f46=events[_0xbeae('0x5')];_0x4f2a84<_0x3d5f46;_0x4f2a84++){var _0x1b3d9e=events[_0x4f2a84];var _0x34ca57=createListener(_0xbeae('0x6')+_0x1b3d9e,_0x237835);UserProfileEvents['on'](_0x1b3d9e,_0x34ca57);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index ef82393..f9b5bd8 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 _0xaa2d=['./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','exports','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa2d,0x11c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdaa2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdaa2('0x1')]();var auth=require(_0xdaa2('0x2'));var interaction=require(_0xdaa2('0x3'));var config=require('../../config/environment');var controller=require(_0xdaa2('0x4'));router[_0xdaa2('0x5')]('/',auth[_0xdaa2('0x6')](),controller['index']);router['get'](_0xdaa2('0x7'),auth['isAuthenticated'](),controller[_0xdaa2('0x8')]);router[_0xdaa2('0x5')](_0xdaa2('0x9'),auth['isAuthenticated'](),controller[_0xdaa2('0xa')]);router[_0xdaa2('0xb')]('/',auth[_0xdaa2('0x6')](),controller[_0xdaa2('0xc')]);router[_0xdaa2('0xd')](_0xdaa2('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xdaa2('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdaa2('0xf')]=router; \ No newline at end of file +var _0xc171=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','post','put','update','delete','path','connect-timeout','express','Router'];(function(_0x55b9d1,_0x33354b){var _0x306008=function(_0x3ca843){while(--_0x3ca843){_0x55b9d1['push'](_0x55b9d1['shift']());}};_0x306008(++_0x33354b);}(_0xc171,0x6c));var _0x1c17=function(_0x133f69,_0x2d4632){_0x133f69=_0x133f69-0x0;var _0x3b67bb=_0xc171[_0x133f69];return _0x3b67bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c17('0x0'));var timeout=require(_0x1c17('0x1'));var express=require(_0x1c17('0x2'));var router=express[_0x1c17('0x3')]();var auth=require(_0x1c17('0x4'));var interaction=require(_0x1c17('0x5'));var config=require(_0x1c17('0x6'));var controller=require('./userProfileResource.controller');router[_0x1c17('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1c17('0x7')](_0x1c17('0x8'),auth[_0x1c17('0x9')](),controller[_0x1c17('0xa')]);router[_0x1c17('0x7')](_0x1c17('0xb'),auth[_0x1c17('0x9')](),controller['show']);router[_0x1c17('0xc')]('/',auth[_0x1c17('0x9')](),controller['create']);router[_0x1c17('0xd')](_0x1c17('0xb'),auth[_0x1c17('0x9')](),controller[_0x1c17('0xe')]);router[_0x1c17('0xf')]('/:id',auth[_0x1c17('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index b2ca2b7..3cbcc4f 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 _0xfd8c=['exports','STRING','sequelize'];(function(_0x487715,_0x3f6cc8){var _0x28b4b3=function(_0x5f87b6){while(--_0x5f87b6){_0x487715['push'](_0x487715['shift']());}};_0x28b4b3(++_0x3f6cc8);}(_0xfd8c,0x101));var _0xcfd8=function(_0x3fab8d,_0x3a43e0){_0x3fab8d=_0x3fab8d-0x0;var _0x652a13=_0xfd8c[_0x3fab8d];return _0x652a13;};'use strict';var Sequelize=require(_0xcfd8('0x0'));module[_0xcfd8('0x1')]={'name':{'type':Sequelize[_0xcfd8('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9772=['sequelize','exports','STRING'];(function(_0x442065,_0x561c4d){var _0x30a95a=function(_0x501d1c){while(--_0x501d1c){_0x442065['push'](_0x442065['shift']());}};_0x30a95a(++_0x561c4d);}(_0x9772,0x1da));var _0x2977=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x9772[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x2977('0x0'));module[_0x2977('0x1')]={'name':{'type':Sequelize[_0x2977('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x2977('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 3992141..a0dd50a 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 _0xac9d=['destroy','error','name','send','map','UserProfileResource','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','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','end','json','count','offset','status','set','apply','save','then'];(function(_0x420665,_0x538c27){var _0x3c85be=function(_0x28f63c){while(--_0x28f63c){_0x420665['push'](_0x420665['shift']());}};_0x3c85be(++_0x538c27);}(_0xac9d,0x14d));var _0xdac9=function(_0x22e101,_0x412840){_0x22e101=_0x22e101-0x0;var _0xa51f61=_0xac9d[_0x22e101];return _0xa51f61;};'use strict';var pdf=require(_0xdac9('0x0'));var emlformat=require(_0xdac9('0x1'));var rimraf=require(_0xdac9('0x2'));var zipdir=require(_0xdac9('0x3'));var jsonpatch=require(_0xdac9('0x4'));var rp=require(_0xdac9('0x5'));var moment=require(_0xdac9('0x6'));var BPromise=require(_0xdac9('0x7'));var Mustache=require('mustache');var util=require(_0xdac9('0x8'));var path=require('path');var sox=require(_0xdac9('0x9'));var csv=require(_0xdac9('0xa'));var ejs=require(_0xdac9('0xb'));var fs=require('fs');var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var db=require(_0xdac9('0x1a'))['db'];function respondWithStatusCode(_0x5a9bde,_0x3d8e97){_0x3d8e97=_0x3d8e97||0xcc;return function(_0xeddbc1){if(_0xeddbc1){return _0x5a9bde[_0xdac9('0x1b')](_0x3d8e97);}return _0x5a9bde['status'](_0x3d8e97)[_0xdac9('0x1c')]();};}function respondWithResult(_0x33ba20,_0x9e1bf6){_0x9e1bf6=_0x9e1bf6||0xc8;return function(_0x5f0bbd){if(_0x5f0bbd){return _0x33ba20['status'](_0x9e1bf6)[_0xdac9('0x1d')](_0x5f0bbd);}};}function respondWithFilteredResult(_0x3d9fcf,_0x50f9fe){return function(_0x76af7a){if(_0x76af7a){var _0x36cbe4=_0x76af7a[_0xdac9('0x1e')],_0x152ea5=_0x50f9fe[_0xdac9('0x1f')],_0x5b2f1b=_0x50f9fe[_0xdac9('0x1f')]+_0x50f9fe['limit'],_0x2221f8;if(_0x5b2f1b>=_0x36cbe4){_0x5b2f1b=_0x36cbe4;_0x2221f8=0xc8;}else{_0x2221f8=0xce;}_0x3d9fcf[_0xdac9('0x20')](_0x2221f8);return _0x3d9fcf[_0xdac9('0x21')]('Content-Range',_0x152ea5+'-'+_0x5b2f1b+'/'+_0x36cbe4)[_0xdac9('0x1d')](_0x76af7a);}return null;};}function patchUpdates(_0xa57f2d){return function(_0x171df1){try{jsonpatch[_0xdac9('0x22')](_0x171df1,_0xa57f2d,!![]);}catch(_0x522dc3){return BPromise['reject'](_0x522dc3);}return _0x171df1[_0xdac9('0x23')]();};}function saveUpdates(_0x20ece3,_0x2b9d91){return function(_0x395ec7){if(_0x395ec7){return _0x395ec7['update'](_0x20ece3)[_0xdac9('0x24')](function(_0x33cb7d){return _0x33cb7d;});}return null;};}function removeEntity(_0x27f473,_0xae680a){return function(_0xe7bd10){if(_0xe7bd10){return _0xe7bd10[_0xdac9('0x25')]()[_0xdac9('0x24')](function(){_0x27f473[_0xdac9('0x20')](0xcc)[_0xdac9('0x1c')]();});}};}function handleEntityNotFound(_0x33de5c,_0x5a0fa2){return function(_0x2943f5){if(!_0x2943f5){_0x33de5c[_0xdac9('0x1b')](0x194);}return _0x2943f5;};}function handleError(_0x3c942c,_0x34a255){_0x34a255=_0x34a255||0x1f4;return function(_0x5ca076){logger[_0xdac9('0x26')](_0x5ca076['stack']);if(_0x5ca076[_0xdac9('0x27')]){delete _0x5ca076[_0xdac9('0x27')];}_0x3c942c['status'](_0x34a255)[_0xdac9('0x28')](_0x5ca076);};}exports['index']=function(_0x450f91,_0x3743f7){var _0xeff4b2={},_0xfe4468={},_0x57d76a={'count':0x0,'rows':[]};var _0x4b87bc=_[_0xdac9('0x29')](db[_0xdac9('0x2a')]['rawAttributes'],function(_0x4c4e21){return{'name':_0x4c4e21[_0xdac9('0x2b')],'type':_0x4c4e21[_0xdac9('0x2c')][_0xdac9('0x2d')]};});_0xfe4468[_0xdac9('0x2e')]=_[_0xdac9('0x29')](_0x4b87bc,_0xdac9('0x27'));_0xfe4468[_0xdac9('0x2f')]=_[_0xdac9('0x30')](_0x450f91[_0xdac9('0x2f')]);_0xfe4468[_0xdac9('0x31')]=_[_0xdac9('0x32')](_0xfe4468[_0xdac9('0x2e')],_0xfe4468[_0xdac9('0x2f')]);_0xeff4b2[_0xdac9('0x33')]=_[_0xdac9('0x32')](_0xfe4468[_0xdac9('0x2e')],qs[_0xdac9('0x34')](_0x450f91[_0xdac9('0x2f')][_0xdac9('0x34')]));_0xeff4b2[_0xdac9('0x33')]=_0xeff4b2[_0xdac9('0x33')]['length']?_0xeff4b2['attributes']:_0xfe4468[_0xdac9('0x2e')];if(!_0x450f91[_0xdac9('0x2f')][_0xdac9('0x35')](_0xdac9('0x36'))){_0xeff4b2[_0xdac9('0x37')]=qs['limit'](_0x450f91[_0xdac9('0x2f')]['limit']);_0xeff4b2[_0xdac9('0x1f')]=qs[_0xdac9('0x1f')](_0x450f91['query'][_0xdac9('0x1f')]);}_0xeff4b2['order']=qs['sort'](_0x450f91[_0xdac9('0x2f')][_0xdac9('0x38')]);_0xeff4b2[_0xdac9('0x39')]=qs[_0xdac9('0x31')](_[_0xdac9('0x3a')](_0x450f91[_0xdac9('0x2f')],_0xfe4468['filters']),_0x4b87bc);if(_0x450f91[_0xdac9('0x2f')][_0xdac9('0x3b')]){_0xeff4b2['where']=_[_0xdac9('0x3c')](_0xeff4b2[_0xdac9('0x39')],{'$or':_[_0xdac9('0x29')](_0x4b87bc,function(_0x27bdfb){if(_0x27bdfb[_0xdac9('0x2c')]!==_0xdac9('0x3d')){var _0x3ac9ae={};_0x3ac9ae[_0x27bdfb['name']]={'$like':'%'+_0x450f91[_0xdac9('0x2f')][_0xdac9('0x3b')]+'%'};return _0x3ac9ae;}})});}_0xeff4b2=_[_0xdac9('0x3c')]({},_0xeff4b2,_0x450f91['options']);var _0x9c732e={'where':_0xeff4b2[_0xdac9('0x39')]};return db[_0xdac9('0x2a')][_0xdac9('0x1e')](_0x9c732e)['then'](function(_0x58fd14){_0x57d76a[_0xdac9('0x1e')]=_0x58fd14;if(_0x450f91[_0xdac9('0x2f')][_0xdac9('0x3e')]){_0xeff4b2[_0xdac9('0x3f')]=[{'all':!![]}];}return db[_0xdac9('0x2a')]['findAll'](_0xeff4b2);})[_0xdac9('0x24')](function(_0x482f4a){_0x57d76a[_0xdac9('0x40')]=_0x482f4a;return _0x57d76a;})[_0xdac9('0x24')](respondWithFilteredResult(_0x3743f7,_0xeff4b2))[_0xdac9('0x41')](handleError(_0x3743f7,null));};exports[_0xdac9('0x42')]=function(_0x2a50f0,_0x386b74){var _0x413fb1={'raw':![],'where':{'id':_0x2a50f0[_0xdac9('0x43')]['id']}},_0xb176e0={};_0xb176e0[_0xdac9('0x2e')]=_[_0xdac9('0x30')](db[_0xdac9('0x2a')][_0xdac9('0x44')]);_0xb176e0[_0xdac9('0x2f')]=_['keys'](_0x2a50f0[_0xdac9('0x2f')]);_0xb176e0[_0xdac9('0x31')]=_['intersection'](_0xb176e0[_0xdac9('0x2e')],_0xb176e0[_0xdac9('0x2f')]);_0x413fb1[_0xdac9('0x33')]=_[_0xdac9('0x32')](_0xb176e0[_0xdac9('0x2e')],qs[_0xdac9('0x34')](_0x2a50f0['query'][_0xdac9('0x34')]));_0x413fb1['attributes']=_0x413fb1[_0xdac9('0x33')][_0xdac9('0x45')]?_0x413fb1[_0xdac9('0x33')]:_0xb176e0[_0xdac9('0x2e')];if(_0x2a50f0['query']['includeAll']){_0x413fb1['include']=[{'all':!![]}];}_0x413fb1=_[_0xdac9('0x3c')]({},_0x413fb1,_0x2a50f0['options']);return db['UserProfileResource'][_0xdac9('0x46')](_0x413fb1)[_0xdac9('0x24')](handleEntityNotFound(_0x386b74,null))['then'](respondWithResult(_0x386b74,null))['catch'](handleError(_0x386b74,null));};exports[_0xdac9('0x47')]=function(_0x24f045,_0x2a31e8){return db[_0xdac9('0x2a')][_0xdac9('0x47')](_0x24f045[_0xdac9('0x48')],{})[_0xdac9('0x24')](respondWithResult(_0x2a31e8,0xc9))[_0xdac9('0x41')](handleError(_0x2a31e8,null));};exports['update']=function(_0x621cf,_0x3bd946){if(_0x621cf[_0xdac9('0x48')]['id']){delete _0x621cf[_0xdac9('0x48')]['id'];}return db[_0xdac9('0x2a')][_0xdac9('0x46')]({'where':{'id':_0x621cf[_0xdac9('0x43')]['id']}})[_0xdac9('0x24')](handleEntityNotFound(_0x3bd946,null))[_0xdac9('0x24')](saveUpdates(_0x621cf[_0xdac9('0x48')],null))[_0xdac9('0x24')](respondWithResult(_0x3bd946,null))[_0xdac9('0x41')](handleError(_0x3bd946,null));};exports[_0xdac9('0x25')]=function(_0x3f092d,_0x53b349){return db['UserProfileResource']['find']({'where':{'id':_0x3f092d[_0xdac9('0x43')]['id']}})[_0xdac9('0x24')](handleEntityNotFound(_0x53b349,null))['then'](removeEntity(_0x53b349,null))[_0xdac9('0x41')](handleError(_0x53b349,null));};exports[_0xdac9('0x49')]=function(_0x45c869,_0x4df45b){return db[_0xdac9('0x2a')][_0xdac9('0x49')]()['then'](respondWithResult(_0x4df45b,null))['catch'](handleError(_0x4df45b,null));}; \ No newline at end of file +var _0xae24=['then','error','stack','name','send','map','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','filter','options','UserProfileResource','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy'];(function(_0x5c7997,_0x5381dd){var _0x22ab38=function(_0x3d496f){while(--_0x3d496f){_0x5c7997['push'](_0x5c7997['shift']());}};_0x22ab38(++_0x5381dd);}(_0xae24,0x182));var _0x4ae2=function(_0x4fca4b,_0x4f78b1){_0x4fca4b=_0x4fca4b-0x0;var _0x2a6cef=_0xae24[_0x4fca4b];return _0x2a6cef;};'use strict';var pdf=require(_0x4ae2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ae2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ae2('0x2'));var rp=require(_0x4ae2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ae2('0x4'));var util=require('util');var path=require(_0x4ae2('0x5'));var sox=require(_0x4ae2('0x6'));var csv=require(_0x4ae2('0x7'));var ejs=require(_0x4ae2('0x8'));var fs=require('fs');var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var db=require(_0x4ae2('0x14'))['db'];function respondWithStatusCode(_0x4d7dc3,_0x25d2b4){_0x25d2b4=_0x25d2b4||0xcc;return function(_0x22ac1e){if(_0x22ac1e){return _0x4d7dc3[_0x4ae2('0x15')](_0x25d2b4);}return _0x4d7dc3[_0x4ae2('0x16')](_0x25d2b4)[_0x4ae2('0x17')]();};}function respondWithResult(_0x40954f,_0x145287){_0x145287=_0x145287||0xc8;return function(_0x3cabc9){if(_0x3cabc9){return _0x40954f[_0x4ae2('0x16')](_0x145287)['json'](_0x3cabc9);}};}function respondWithFilteredResult(_0x4ec027,_0x4d5cab){return function(_0x2f3936){if(_0x2f3936){var _0xf834a1=_0x2f3936[_0x4ae2('0x18')],_0x5f447a=_0x4d5cab[_0x4ae2('0x19')],_0x463765=_0x4d5cab[_0x4ae2('0x19')]+_0x4d5cab[_0x4ae2('0x1a')],_0x9fb8db;if(_0x463765>=_0xf834a1){_0x463765=_0xf834a1;_0x9fb8db=0xc8;}else{_0x9fb8db=0xce;}_0x4ec027[_0x4ae2('0x16')](_0x9fb8db);return _0x4ec027[_0x4ae2('0x1b')](_0x4ae2('0x1c'),_0x5f447a+'-'+_0x463765+'/'+_0xf834a1)[_0x4ae2('0x1d')](_0x2f3936);}return null;};}function patchUpdates(_0x4d5071){return function(_0x4a97af){try{jsonpatch[_0x4ae2('0x1e')](_0x4a97af,_0x4d5071,!![]);}catch(_0x2d910c){return BPromise['reject'](_0x2d910c);}return _0x4a97af[_0x4ae2('0x1f')]();};}function saveUpdates(_0x343db1,_0xccb3b){return function(_0x2ad222){if(_0x2ad222){return _0x2ad222[_0x4ae2('0x20')](_0x343db1)['then'](function(_0x2bf5fe){return _0x2bf5fe;});}return null;};}function removeEntity(_0x53c686,_0x522165){return function(_0x2ceec4){if(_0x2ceec4){return _0x2ceec4[_0x4ae2('0x21')]()[_0x4ae2('0x22')](function(){_0x53c686[_0x4ae2('0x16')](0xcc)[_0x4ae2('0x17')]();});}};}function handleEntityNotFound(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(!_0x4a0ddb){_0x526768[_0x4ae2('0x15')](0x194);}return _0x4a0ddb;};}function handleError(_0x12b5d2,_0x130239){_0x130239=_0x130239||0x1f4;return function(_0x57933b){logger[_0x4ae2('0x23')](_0x57933b[_0x4ae2('0x24')]);if(_0x57933b[_0x4ae2('0x25')]){delete _0x57933b[_0x4ae2('0x25')];}_0x12b5d2[_0x4ae2('0x16')](_0x130239)[_0x4ae2('0x26')](_0x57933b);};}exports['index']=function(_0x5962b0,_0x9508d7){var _0x3030f8={},_0x3fa514={},_0x329588={'count':0x0,'rows':[]};var _0x3a9b96=_[_0x4ae2('0x27')](db['UserProfileResource']['rawAttributes'],function(_0x3e2666){return{'name':_0x3e2666['fieldName'],'type':_0x3e2666['type']['key']};});_0x3fa514[_0x4ae2('0x28')]=_[_0x4ae2('0x27')](_0x3a9b96,'name');_0x3fa514[_0x4ae2('0x29')]=_[_0x4ae2('0x2a')](_0x5962b0[_0x4ae2('0x29')]);_0x3fa514[_0x4ae2('0x2b')]=_[_0x4ae2('0x2c')](_0x3fa514[_0x4ae2('0x28')],_0x3fa514[_0x4ae2('0x29')]);_0x3030f8[_0x4ae2('0x2d')]=_[_0x4ae2('0x2c')](_0x3fa514[_0x4ae2('0x28')],qs[_0x4ae2('0x2e')](_0x5962b0[_0x4ae2('0x29')][_0x4ae2('0x2e')]));_0x3030f8[_0x4ae2('0x2d')]=_0x3030f8[_0x4ae2('0x2d')][_0x4ae2('0x2f')]?_0x3030f8[_0x4ae2('0x2d')]:_0x3fa514['model'];if(!_0x5962b0[_0x4ae2('0x29')]['hasOwnProperty'](_0x4ae2('0x30'))){_0x3030f8[_0x4ae2('0x1a')]=qs['limit'](_0x5962b0[_0x4ae2('0x29')][_0x4ae2('0x1a')]);_0x3030f8[_0x4ae2('0x19')]=qs[_0x4ae2('0x19')](_0x5962b0['query'][_0x4ae2('0x19')]);}_0x3030f8[_0x4ae2('0x31')]=qs[_0x4ae2('0x32')](_0x5962b0[_0x4ae2('0x29')][_0x4ae2('0x32')]);_0x3030f8[_0x4ae2('0x33')]=qs[_0x4ae2('0x2b')](_[_0x4ae2('0x34')](_0x5962b0[_0x4ae2('0x29')],_0x3fa514['filters']),_0x3a9b96);if(_0x5962b0[_0x4ae2('0x29')]['filter']){_0x3030f8[_0x4ae2('0x33')]=_[_0x4ae2('0x35')](_0x3030f8[_0x4ae2('0x33')],{'$or':_[_0x4ae2('0x27')](_0x3a9b96,function(_0x771c14){if(_0x771c14[_0x4ae2('0x36')]!=='VIRTUAL'){var _0x38f12f={};_0x38f12f[_0x771c14[_0x4ae2('0x25')]]={'$like':'%'+_0x5962b0[_0x4ae2('0x29')][_0x4ae2('0x37')]+'%'};return _0x38f12f;}})});}_0x3030f8=_['merge']({},_0x3030f8,_0x5962b0[_0x4ae2('0x38')]);var _0x34a784={'where':_0x3030f8[_0x4ae2('0x33')]};return db[_0x4ae2('0x39')][_0x4ae2('0x18')](_0x34a784)[_0x4ae2('0x22')](function(_0x1fdc61){_0x329588[_0x4ae2('0x18')]=_0x1fdc61;if(_0x5962b0[_0x4ae2('0x29')][_0x4ae2('0x3a')]){_0x3030f8[_0x4ae2('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x4ae2('0x3c')](_0x3030f8);})[_0x4ae2('0x22')](function(_0x23f120){_0x329588[_0x4ae2('0x3d')]=_0x23f120;return _0x329588;})['then'](respondWithFilteredResult(_0x9508d7,_0x3030f8))['catch'](handleError(_0x9508d7,null));};exports[_0x4ae2('0x3e')]=function(_0x45527a,_0x2cbdcc){var _0x3cdf23={'raw':![],'where':{'id':_0x45527a[_0x4ae2('0x3f')]['id']}},_0x567371={};_0x567371[_0x4ae2('0x28')]=_['keys'](db[_0x4ae2('0x39')][_0x4ae2('0x40')]);_0x567371[_0x4ae2('0x29')]=_['keys'](_0x45527a[_0x4ae2('0x29')]);_0x567371[_0x4ae2('0x2b')]=_[_0x4ae2('0x2c')](_0x567371[_0x4ae2('0x28')],_0x567371[_0x4ae2('0x29')]);_0x3cdf23[_0x4ae2('0x2d')]=_[_0x4ae2('0x2c')](_0x567371[_0x4ae2('0x28')],qs['fields'](_0x45527a[_0x4ae2('0x29')][_0x4ae2('0x2e')]));_0x3cdf23['attributes']=_0x3cdf23[_0x4ae2('0x2d')][_0x4ae2('0x2f')]?_0x3cdf23['attributes']:_0x567371[_0x4ae2('0x28')];if(_0x45527a[_0x4ae2('0x29')]['includeAll']){_0x3cdf23[_0x4ae2('0x3b')]=[{'all':!![]}];}_0x3cdf23=_[_0x4ae2('0x35')]({},_0x3cdf23,_0x45527a[_0x4ae2('0x38')]);return db['UserProfileResource']['find'](_0x3cdf23)[_0x4ae2('0x22')](handleEntityNotFound(_0x2cbdcc,null))[_0x4ae2('0x22')](respondWithResult(_0x2cbdcc,null))[_0x4ae2('0x41')](handleError(_0x2cbdcc,null));};exports[_0x4ae2('0x42')]=function(_0x507f1d,_0x16a072){return db[_0x4ae2('0x39')][_0x4ae2('0x42')](_0x507f1d['body'],{})[_0x4ae2('0x22')](respondWithResult(_0x16a072,0xc9))[_0x4ae2('0x41')](handleError(_0x16a072,null));};exports[_0x4ae2('0x20')]=function(_0x4e9b6e,_0x16bf0b){if(_0x4e9b6e[_0x4ae2('0x43')]['id']){delete _0x4e9b6e[_0x4ae2('0x43')]['id'];}return db[_0x4ae2('0x39')][_0x4ae2('0x44')]({'where':{'id':_0x4e9b6e[_0x4ae2('0x3f')]['id']}})[_0x4ae2('0x22')](handleEntityNotFound(_0x16bf0b,null))[_0x4ae2('0x22')](saveUpdates(_0x4e9b6e[_0x4ae2('0x43')],null))[_0x4ae2('0x22')](respondWithResult(_0x16bf0b,null))['catch'](handleError(_0x16bf0b,null));};exports[_0x4ae2('0x21')]=function(_0x4a70c6,_0x10db30){return db[_0x4ae2('0x39')][_0x4ae2('0x44')]({'where':{'id':_0x4a70c6[_0x4ae2('0x3f')]['id']}})[_0x4ae2('0x22')](handleEntityNotFound(_0x10db30,null))[_0x4ae2('0x22')](removeEntity(_0x10db30,null))['catch'](handleError(_0x10db30,null));};exports[_0x4ae2('0x45')]=function(_0x2215eb,_0x57c9f4){return db[_0x4ae2('0x39')][_0x4ae2('0x45')]()['then'](respondWithResult(_0x57c9f4,null))[_0x4ae2('0x41')](handleError(_0x57c9f4,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 208151f..6c86b81 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 _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xee5b,0x1f4));var _0xbee5=function(_0x40905a,_0x1d0112){_0x40905a=_0x40905a-0x0;var _0x3a3c90=_0xee5b[_0x40905a];return _0x3a3c90;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa74f=['../../config/logger','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0xa74f,0x9a));var _0xfa74=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xa74f[_0x4bcf38];return _0x4a89be;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'paranoid':![],'indexes':[{'name':_0xfa74('0x9'),'fields':[_0xfa74('0xa'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index a5c6007..c2c73ad 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 _0xa786=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xa786,0x1ef));var _0x6a78=function(_0xc606,_0x4bfd52){_0xc606=_0xc606-0x0;var _0x2abd89=_0xa786[_0xc606];return _0x2abd89;};'use strict';var _=require(_0x6a78('0x0'));var util=require('util');var moment=require(_0x6a78('0x1'));var BPromise=require('bluebird');var rs=require(_0x6a78('0x2'));var fs=require('fs');var Redis=require(_0x6a78('0x3'));var db=require(_0x6a78('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a78('0x5'))(_0x6a78('0x6'));var config=require(_0x6a78('0x7'));var jayson=require(_0x6a78('0x8'));var client=jayson[_0x6a78('0x9')][_0x6a78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f50cd,_0x49ac4e,_0x521fdc){return new BPromise(function(_0x1a0f36,_0x55a167){return client[_0x6a78('0xb')](_0x1f50cd,_0x521fdc)[_0x6a78('0xc')](function(_0x5a7e77){logger[_0x6a78('0xd')](_0x6a78('0xe'),_0x49ac4e,_0x6a78('0xf'));logger[_0x6a78('0x10')](_0x6a78('0x11'),_0x49ac4e,_0x6a78('0xf'),JSON[_0x6a78('0x12')](_0x5a7e77));if(_0x5a7e77['error']){if(_0x5a7e77[_0x6a78('0x13')]['code']===0x1f4){logger[_0x6a78('0x13')](_0x6a78('0xe'),_0x49ac4e,_0x5a7e77[_0x6a78('0x13')]['message']);return _0x55a167(_0x5a7e77['error'][_0x6a78('0x14')]);}logger[_0x6a78('0x13')](_0x6a78('0xe'),_0x49ac4e,_0x5a7e77[_0x6a78('0x13')][_0x6a78('0x14')]);return _0x1a0f36(_0x5a7e77[_0x6a78('0x13')][_0x6a78('0x14')]);}else{logger[_0x6a78('0xd')](_0x6a78('0xe'),_0x49ac4e,_0x6a78('0xf'));_0x1a0f36(_0x5a7e77[_0x6a78('0x15')][_0x6a78('0x14')]);}})[_0x6a78('0x16')](function(_0x5b6a6d){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x49ac4e,_0x5b6a6d);_0x55a167(_0x5b6a6d);});});} \ No newline at end of file +var _0xe5ee=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','info'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe5ee,0x145));var _0xee5e=function(_0x4c32ae,_0x1a5de0){_0x4c32ae=_0x4c32ae-0x0;var _0x2da35c=_0xe5ee[_0x4c32ae];return _0x2da35c;};'use strict';var _=require(_0xee5e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee5e('0x1'));var rs=require(_0xee5e('0x2'));var fs=require('fs');var Redis=require(_0xee5e('0x3'));var db=require(_0xee5e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee5e('0x5'));var config=require('../../config/environment');var jayson=require(_0xee5e('0x6'));var client=jayson['client'][_0xee5e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x409f6b,_0x37de7f,_0x56e8c6){return new BPromise(function(_0x2e36db,_0x33ee77){return client[_0xee5e('0x8')](_0x409f6b,_0x56e8c6)['then'](function(_0x30a504){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x37de7f,_0xee5e('0x9'));logger['debug'](_0xee5e('0xa'),_0x37de7f,_0xee5e('0x9'),JSON[_0xee5e('0xb')](_0x30a504));if(_0x30a504[_0xee5e('0xc')]){if(_0x30a504[_0xee5e('0xc')][_0xee5e('0xd')]===0x1f4){logger[_0xee5e('0xc')](_0xee5e('0xe'),_0x37de7f,_0x30a504[_0xee5e('0xc')]['message']);return _0x33ee77(_0x30a504[_0xee5e('0xc')]['message']);}logger['error'](_0xee5e('0xe'),_0x37de7f,_0x30a504[_0xee5e('0xc')][_0xee5e('0xf')]);return _0x2e36db(_0x30a504[_0xee5e('0xc')]['message']);}else{logger[_0xee5e('0x10')](_0xee5e('0xe'),_0x37de7f,_0xee5e('0x9'));_0x2e36db(_0x30a504[_0xee5e('0x11')]['message']);}})[_0xee5e('0x12')](function(_0x5b5551){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x37de7f,_0x5b5551);_0x33ee77(_0x5b5551);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index eb62e21..f7f5e33 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 _0xcb83=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x11b55e,_0x47f1ff){var _0x268a13=function(_0x3dc694){while(--_0x3dc694){_0x11b55e['push'](_0x11b55e['shift']());}};_0x268a13(++_0x47f1ff);}(_0xcb83,0x1c5));var _0x3cb8=function(_0x42c581,_0x1c0689){_0x42c581=_0x42c581-0x0;var _0x1d09cd=_0xcb83[_0x42c581];return _0x1d09cd;};'use strict';var multer=require(_0x3cb8('0x0'));var util=require('util');var path=require(_0x3cb8('0x1'));var timeout=require(_0x3cb8('0x2'));var express=require(_0x3cb8('0x3'));var router=express[_0x3cb8('0x4')]();var auth=require(_0x3cb8('0x5'));var interaction=require(_0x3cb8('0x6'));var config=require(_0x3cb8('0x7'));var controller=require(_0x3cb8('0x8'));router[_0x3cb8('0x9')]('/',auth[_0x3cb8('0xa')](),controller['index']);router[_0x3cb8('0x9')](_0x3cb8('0xb'),auth[_0x3cb8('0xa')](),controller['describe']);router[_0x3cb8('0x9')](_0x3cb8('0xc'),auth[_0x3cb8('0xa')](),controller[_0x3cb8('0xd')]);router[_0x3cb8('0xe')]('/',auth[_0x3cb8('0xa')](),controller['create']);router['put'](_0x3cb8('0xc'),auth['isAuthenticated'](),controller[_0x3cb8('0xf')]);router[_0x3cb8('0x10')](_0x3cb8('0xc'),auth[_0x3cb8('0xa')](),controller[_0x3cb8('0x11')]);module[_0x3cb8('0x12')]=router; \ No newline at end of file +var _0x851d=['/describe','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x197b9d,_0x45a398){var _0x93e74d=function(_0x4b1a76){while(--_0x4b1a76){_0x197b9d['push'](_0x197b9d['shift']());}};_0x93e74d(++_0x45a398);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd851('0x0'));var util=require('util');var path=require(_0xd851('0x1'));var timeout=require(_0xd851('0x2'));var express=require('express');var router=express[_0xd851('0x3')]();var auth=require(_0xd851('0x4'));var interaction=require(_0xd851('0x5'));var config=require(_0xd851('0x6'));var controller=require(_0xd851('0x7'));router[_0xd851('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd851('0x8')](_0xd851('0x9'),auth[_0xd851('0xa')](),controller[_0xd851('0xb')]);router[_0xd851('0x8')](_0xd851('0xc'),auth['isAuthenticated'](),controller[_0xd851('0xd')]);router['post']('/',auth[_0xd851('0xa')](),controller[_0xd851('0xe')]);router['put'](_0xd851('0xc'),auth[_0xd851('0xa')](),controller[_0xd851('0xf')]);router[_0xd851('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd851('0x11')]);module[_0xd851('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index ea1a9a9..b71f5d0 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 _0xef1c=['BOOLEAN','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x259ce9,_0x1ab741){var _0x44207f=function(_0xa35d41){while(--_0xa35d41){_0x259ce9['push'](_0x259ce9['shift']());}};_0x44207f(++_0x1ab741);}(_0xef1c,0x176));var _0xcef1=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xef1c[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0xcef1('0x0'));module[_0xcef1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xcef1('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xcef1('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xcef1('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xcef1('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xcef1('0x2')],'set':function(_0x3872e2){this['setDataValue'](_0xcef1('0x5'),_0x3872e2?_0x3872e2[_0xcef1('0x6')](''):[]);},'get':function(){return this[_0xcef1('0x7')]('crudPermissions')?this[_0xcef1('0x7')]('crudPermissions')[_0xcef1('0x8')](''):[];}}}; \ No newline at end of file +var _0xa44a=['sequelize','STRING','INTEGER','BOOLEAN','join','getDataValue','split'];(function(_0x456ecc,_0x11df8d){var _0x4d666d=function(_0x335a03){while(--_0x335a03){_0x456ecc['push'](_0x456ecc['shift']());}};_0x4d666d(++_0x11df8d);}(_0xa44a,0x9a));var _0xaa44=function(_0x3ae69f,_0x5c6d6e){_0x3ae69f=_0x3ae69f-0x0;var _0x9175bc=_0xa44a[_0x3ae69f];return _0x9175bc;};'use strict';var Sequelize=require(_0xaa44('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xaa44('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa44('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaa44('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa44('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa44('0x1')],'set':function(_0x3427a1){this['setDataValue']('crudPermissions',_0x3427a1?_0x3427a1[_0xaa44('0x4')](''):[]);},'get':function(){return this[_0xaa44('0x5')]('crudPermissions')?this[_0xaa44('0x5')]('crudPermissions')[_0xaa44('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 312ebcf..b6d38ef 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 _0x9d0d=['offset','sort','where','filter','merge','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','create','body','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','UserProfileSection','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x24f4df,_0x562845){var _0xc070f4=function(_0x23ee55){while(--_0x23ee55){_0x24f4df['push'](_0x24f4df['shift']());}};_0xc070f4(++_0x562845);}(_0x9d0d,0xe7));var _0xd9d0=function(_0x52ac43,_0x33cddd){_0x52ac43=_0x52ac43-0x0;var _0x2cb1c5=_0x9d0d[_0x52ac43];return _0x2cb1c5;};'use strict';var pdf=require(_0xd9d0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd9d0('0x1'));var zipdir=require(_0xd9d0('0x2'));var jsonpatch=require(_0xd9d0('0x3'));var rp=require(_0xd9d0('0x4'));var moment=require(_0xd9d0('0x5'));var BPromise=require(_0xd9d0('0x6'));var Mustache=require(_0xd9d0('0x7'));var util=require(_0xd9d0('0x8'));var path=require(_0xd9d0('0x9'));var sox=require(_0xd9d0('0xa'));var csv=require(_0xd9d0('0xb'));var ejs=require(_0xd9d0('0xc'));var fs=require('fs');var _=require(_0xd9d0('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd9d0('0xe'));var deskjs=require(_0xd9d0('0xf'));var toCsv=require(_0xd9d0('0xb'));var querystring=require(_0xd9d0('0x10'));var Papa=require(_0xd9d0('0x11'));var Redis=require(_0xd9d0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9d0('0x13'));var logger=require('../../config/logger')(_0xd9d0('0x14'));var utils=require(_0xd9d0('0x15'));var config=require(_0xd9d0('0x16'));var db=require(_0xd9d0('0x17'))['db'];function respondWithStatusCode(_0xf1a169,_0x397e9f){_0x397e9f=_0x397e9f||0xcc;return function(_0x396376){if(_0x396376){return _0xf1a169[_0xd9d0('0x18')](_0x397e9f);}return _0xf1a169[_0xd9d0('0x19')](_0x397e9f)[_0xd9d0('0x1a')]();};}function respondWithResult(_0xb7a1b5,_0x43c898){_0x43c898=_0x43c898||0xc8;return function(_0x205d3f){if(_0x205d3f){return _0xb7a1b5[_0xd9d0('0x19')](_0x43c898)[_0xd9d0('0x1b')](_0x205d3f);}};}function respondWithFilteredResult(_0x55a341,_0x32194b){return function(_0x4e25e4){if(_0x4e25e4){var _0x3ba5eb=_0x4e25e4[_0xd9d0('0x1c')],_0x3c915c=_0x32194b['offset'],_0x171caa=_0x32194b['offset']+_0x32194b[_0xd9d0('0x1d')],_0x36ea53;if(_0x171caa>=_0x3ba5eb){_0x171caa=_0x3ba5eb;_0x36ea53=0xc8;}else{_0x36ea53=0xce;}_0x55a341[_0xd9d0('0x19')](_0x36ea53);return _0x55a341[_0xd9d0('0x1e')](_0xd9d0('0x1f'),_0x3c915c+'-'+_0x171caa+'/'+_0x3ba5eb)[_0xd9d0('0x1b')](_0x4e25e4);}return null;};}function patchUpdates(_0x3b4ec4){return function(_0x4a4db3){try{jsonpatch[_0xd9d0('0x20')](_0x4a4db3,_0x3b4ec4,!![]);}catch(_0x4419ae){return BPromise[_0xd9d0('0x21')](_0x4419ae);}return _0x4a4db3[_0xd9d0('0x22')]();};}function saveUpdates(_0x45b14b,_0x2c1157){return function(_0x4f516f){if(_0x4f516f){return _0x4f516f['update'](_0x45b14b)[_0xd9d0('0x23')](function(_0x184a1f){return _0x184a1f;});}return null;};}function removeEntity(_0x11dc2d,_0x11cf46){return function(_0x5aec94){if(_0x5aec94){return _0x5aec94[_0xd9d0('0x24')]()[_0xd9d0('0x23')](function(){_0x11dc2d[_0xd9d0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3996f0,_0x425410){return function(_0x58e8af){if(!_0x58e8af){_0x3996f0[_0xd9d0('0x18')](0x194);}return _0x58e8af;};}function handleError(_0x149971,_0x1b4989){_0x1b4989=_0x1b4989||0x1f4;return function(_0x105817){logger[_0xd9d0('0x25')](_0x105817[_0xd9d0('0x26')]);if(_0x105817[_0xd9d0('0x27')]){delete _0x105817[_0xd9d0('0x27')];}_0x149971[_0xd9d0('0x19')](_0x1b4989)[_0xd9d0('0x28')](_0x105817);};}exports['index']=function(_0x4a245b,_0x23ef9b){var _0x554071={},_0x1229fa={},_0x3d5a6a={'count':0x0,'rows':[]};var _0x5ab0c9=_[_0xd9d0('0x29')](db[_0xd9d0('0x2a')]['rawAttributes'],function(_0x35bd29){return{'name':_0x35bd29[_0xd9d0('0x2b')],'type':_0x35bd29['type'][_0xd9d0('0x2c')]};});_0x1229fa[_0xd9d0('0x2d')]=_['map'](_0x5ab0c9,_0xd9d0('0x27'));_0x1229fa[_0xd9d0('0x2e')]=_[_0xd9d0('0x2f')](_0x4a245b['query']);_0x1229fa[_0xd9d0('0x30')]=_[_0xd9d0('0x31')](_0x1229fa[_0xd9d0('0x2d')],_0x1229fa[_0xd9d0('0x2e')]);_0x554071[_0xd9d0('0x32')]=_[_0xd9d0('0x31')](_0x1229fa[_0xd9d0('0x2d')],qs[_0xd9d0('0x33')](_0x4a245b[_0xd9d0('0x2e')][_0xd9d0('0x33')]));_0x554071['attributes']=_0x554071['attributes']['length']?_0x554071[_0xd9d0('0x32')]:_0x1229fa[_0xd9d0('0x2d')];if(!_0x4a245b[_0xd9d0('0x2e')][_0xd9d0('0x34')]('nolimit')){_0x554071[_0xd9d0('0x1d')]=qs[_0xd9d0('0x1d')](_0x4a245b[_0xd9d0('0x2e')][_0xd9d0('0x1d')]);_0x554071['offset']=qs['offset'](_0x4a245b[_0xd9d0('0x2e')][_0xd9d0('0x35')]);}_0x554071['order']=qs[_0xd9d0('0x36')](_0x4a245b[_0xd9d0('0x2e')][_0xd9d0('0x36')]);_0x554071[_0xd9d0('0x37')]=qs['filters'](_['pick'](_0x4a245b[_0xd9d0('0x2e')],_0x1229fa['filters']),_0x5ab0c9);if(_0x4a245b[_0xd9d0('0x2e')][_0xd9d0('0x38')]){_0x554071['where']=_[_0xd9d0('0x39')](_0x554071[_0xd9d0('0x37')],{'$or':_['map'](_0x5ab0c9,function(_0x2cbbad){if(_0x2cbbad['type']!=='VIRTUAL'){var _0x1be62d={};_0x1be62d[_0x2cbbad[_0xd9d0('0x27')]]={'$like':'%'+_0x4a245b[_0xd9d0('0x2e')][_0xd9d0('0x38')]+'%'};return _0x1be62d;}})});}_0x554071=_[_0xd9d0('0x39')]({},_0x554071,_0x4a245b[_0xd9d0('0x3a')]);var _0x4b613d={'where':_0x554071[_0xd9d0('0x37')]};return db['UserProfileSection'][_0xd9d0('0x1c')](_0x4b613d)[_0xd9d0('0x23')](function(_0x524d94){_0x3d5a6a[_0xd9d0('0x1c')]=_0x524d94;if(_0x4a245b['query']['includeAll']){_0x554071[_0xd9d0('0x3b')]=[{'all':!![]}];}return db['UserProfileSection'][_0xd9d0('0x3c')](_0x554071);})[_0xd9d0('0x23')](function(_0x12d4e5){_0x3d5a6a[_0xd9d0('0x3d')]=_0x12d4e5;return _0x3d5a6a;})['then'](respondWithFilteredResult(_0x23ef9b,_0x554071))['catch'](handleError(_0x23ef9b,null));};exports[_0xd9d0('0x3e')]=function(_0x57fae5,_0x1cfa82){var _0x3a55f5={'raw':![],'where':{'id':_0x57fae5[_0xd9d0('0x3f')]['id']}},_0x4d61ba={};_0x4d61ba[_0xd9d0('0x2d')]=_['keys'](db['UserProfileSection'][_0xd9d0('0x40')]);_0x4d61ba['query']=_[_0xd9d0('0x2f')](_0x57fae5[_0xd9d0('0x2e')]);_0x4d61ba[_0xd9d0('0x30')]=_[_0xd9d0('0x31')](_0x4d61ba[_0xd9d0('0x2d')],_0x4d61ba[_0xd9d0('0x2e')]);_0x3a55f5[_0xd9d0('0x32')]=_[_0xd9d0('0x31')](_0x4d61ba[_0xd9d0('0x2d')],qs['fields'](_0x57fae5['query'][_0xd9d0('0x33')]));_0x3a55f5[_0xd9d0('0x32')]=_0x3a55f5[_0xd9d0('0x32')][_0xd9d0('0x41')]?_0x3a55f5[_0xd9d0('0x32')]:_0x4d61ba[_0xd9d0('0x2d')];if(_0x57fae5['query'][_0xd9d0('0x42')]){_0x3a55f5[_0xd9d0('0x3b')]=[{'all':!![]}];}_0x3a55f5=_[_0xd9d0('0x39')]({},_0x3a55f5,_0x57fae5[_0xd9d0('0x3a')]);return db[_0xd9d0('0x2a')][_0xd9d0('0x43')](_0x3a55f5)[_0xd9d0('0x23')](handleEntityNotFound(_0x1cfa82,null))[_0xd9d0('0x23')](respondWithResult(_0x1cfa82,null))['catch'](handleError(_0x1cfa82,null));};exports[_0xd9d0('0x44')]=function(_0x33c768,_0x22d020){return db['UserProfileSection']['create'](_0x33c768[_0xd9d0('0x45')],{})[_0xd9d0('0x23')](respondWithResult(_0x22d020,0xc9))[_0xd9d0('0x46')](handleError(_0x22d020,null));};exports['update']=function(_0x1534d2,_0x6268c5){if(_0x1534d2[_0xd9d0('0x45')]['id']){delete _0x1534d2['body']['id'];}return db[_0xd9d0('0x2a')][_0xd9d0('0x43')]({'where':{'id':_0x1534d2[_0xd9d0('0x3f')]['id']}})[_0xd9d0('0x23')](handleEntityNotFound(_0x6268c5,null))[_0xd9d0('0x23')](saveUpdates(_0x1534d2['body'],null))[_0xd9d0('0x23')](respondWithResult(_0x6268c5,null))[_0xd9d0('0x46')](handleError(_0x6268c5,null));};exports[_0xd9d0('0x24')]=function(_0x3dfef8,_0x2187a6){return db['UserProfileSection'][_0xd9d0('0x43')]({'where':{'id':_0x3dfef8[_0xd9d0('0x3f')]['id']}})[_0xd9d0('0x23')](handleEntityNotFound(_0x2187a6,null))[_0xd9d0('0x23')](removeEntity(_0x2187a6,null))[_0xd9d0('0x46')](handleError(_0x2187a6,null));};exports['describe']=function(_0x579ade,_0x84dac6){return db[_0xd9d0('0x2a')]['describe']()['then'](respondWithResult(_0x84dac6,null))[_0xd9d0('0x46')](handleError(_0x84dac6,null));}; \ No newline at end of file +var _0xe55c=['type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileSection'];(function(_0x4c4438,_0x1c2e5e){var _0x342c54=function(_0x335891){while(--_0x335891){_0x4c4438['push'](_0x4c4438['shift']());}};_0x342c54(++_0x1c2e5e);}(_0xe55c,0x1c8));var _0xce55=function(_0x211845,_0x721d77){_0x211845=_0x211845-0x0;var _0x285ce7=_0xe55c[_0x211845];return _0x285ce7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xce55('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce55('0x1'));var jsonpatch=require(_0xce55('0x2'));var rp=require(_0xce55('0x3'));var moment=require(_0xce55('0x4'));var BPromise=require(_0xce55('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xce55('0x6'));var csv=require(_0xce55('0x7'));var ejs=require(_0xce55('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xce55('0x9'));var crypto=require(_0xce55('0xa'));var jsforce=require(_0xce55('0xb'));var deskjs=require(_0xce55('0xc'));var toCsv=require(_0xce55('0x7'));var querystring=require('querystring');var Papa=require(_0xce55('0xd'));var Redis=require('ioredis');var authService=require(_0xce55('0xe'));var qs=require(_0xce55('0xf'));var as=require(_0xce55('0x10'));var hardwareService=require(_0xce55('0x11'));var logger=require(_0xce55('0x12'))(_0xce55('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xce55('0x14'))['db'];function respondWithStatusCode(_0x4c1c77,_0x6eecf5){_0x6eecf5=_0x6eecf5||0xcc;return function(_0x4d710a){if(_0x4d710a){return _0x4c1c77[_0xce55('0x15')](_0x6eecf5);}return _0x4c1c77[_0xce55('0x16')](_0x6eecf5)[_0xce55('0x17')]();};}function respondWithResult(_0x57d505,_0x2e5f6b){_0x2e5f6b=_0x2e5f6b||0xc8;return function(_0x41a30b){if(_0x41a30b){return _0x57d505[_0xce55('0x16')](_0x2e5f6b)[_0xce55('0x18')](_0x41a30b);}};}function respondWithFilteredResult(_0x4acfc7,_0x57b996){return function(_0x548306){if(_0x548306){var _0x1511a0=_0x548306['count'],_0x132eec=_0x57b996[_0xce55('0x19')],_0x48cb78=_0x57b996['offset']+_0x57b996[_0xce55('0x1a')],_0x11dfb5;if(_0x48cb78>=_0x1511a0){_0x48cb78=_0x1511a0;_0x11dfb5=0xc8;}else{_0x11dfb5=0xce;}_0x4acfc7[_0xce55('0x16')](_0x11dfb5);return _0x4acfc7[_0xce55('0x1b')](_0xce55('0x1c'),_0x132eec+'-'+_0x48cb78+'/'+_0x1511a0)[_0xce55('0x18')](_0x548306);}return null;};}function patchUpdates(_0x26a676){return function(_0x1044a2){try{jsonpatch[_0xce55('0x1d')](_0x1044a2,_0x26a676,!![]);}catch(_0x543d95){return BPromise[_0xce55('0x1e')](_0x543d95);}return _0x1044a2[_0xce55('0x1f')]();};}function saveUpdates(_0x431293,_0x45d06c){return function(_0x12edbc){if(_0x12edbc){return _0x12edbc[_0xce55('0x20')](_0x431293)[_0xce55('0x21')](function(_0x24c357){return _0x24c357;});}return null;};}function removeEntity(_0xd064da,_0x4ad841){return function(_0x444216){if(_0x444216){return _0x444216[_0xce55('0x22')]()[_0xce55('0x21')](function(){_0xd064da['status'](0xcc)[_0xce55('0x17')]();});}};}function handleEntityNotFound(_0x2eb621,_0x464282){return function(_0x52cd1a){if(!_0x52cd1a){_0x2eb621['sendStatus'](0x194);}return _0x52cd1a;};}function handleError(_0x2d36bf,_0x58b98f){_0x58b98f=_0x58b98f||0x1f4;return function(_0xd00dc4){logger[_0xce55('0x23')](_0xd00dc4[_0xce55('0x24')]);if(_0xd00dc4[_0xce55('0x25')]){delete _0xd00dc4[_0xce55('0x25')];}_0x2d36bf['status'](_0x58b98f)[_0xce55('0x26')](_0xd00dc4);};}exports['index']=function(_0x3e7232,_0x1c6424){var _0x4d5651={},_0x4596f7={},_0x28637d={'count':0x0,'rows':[]};var _0x3205b1=_[_0xce55('0x27')](db[_0xce55('0x28')]['rawAttributes'],function(_0x594bb7){return{'name':_0x594bb7['fieldName'],'type':_0x594bb7[_0xce55('0x29')][_0xce55('0x2a')]};});_0x4596f7[_0xce55('0x2b')]=_[_0xce55('0x27')](_0x3205b1,'name');_0x4596f7['query']=_[_0xce55('0x2c')](_0x3e7232[_0xce55('0x2d')]);_0x4596f7['filters']=_[_0xce55('0x2e')](_0x4596f7[_0xce55('0x2b')],_0x4596f7[_0xce55('0x2d')]);_0x4d5651['attributes']=_['intersection'](_0x4596f7[_0xce55('0x2b')],qs['fields'](_0x3e7232[_0xce55('0x2d')][_0xce55('0x2f')]));_0x4d5651[_0xce55('0x30')]=_0x4d5651['attributes']['length']?_0x4d5651[_0xce55('0x30')]:_0x4596f7[_0xce55('0x2b')];if(!_0x3e7232['query'][_0xce55('0x31')](_0xce55('0x32'))){_0x4d5651[_0xce55('0x1a')]=qs[_0xce55('0x1a')](_0x3e7232[_0xce55('0x2d')]['limit']);_0x4d5651[_0xce55('0x19')]=qs[_0xce55('0x19')](_0x3e7232[_0xce55('0x2d')][_0xce55('0x19')]);}_0x4d5651[_0xce55('0x33')]=qs['sort'](_0x3e7232[_0xce55('0x2d')][_0xce55('0x34')]);_0x4d5651[_0xce55('0x35')]=qs[_0xce55('0x36')](_[_0xce55('0x37')](_0x3e7232[_0xce55('0x2d')],_0x4596f7[_0xce55('0x36')]),_0x3205b1);if(_0x3e7232[_0xce55('0x2d')]['filter']){_0x4d5651[_0xce55('0x35')]=_[_0xce55('0x38')](_0x4d5651[_0xce55('0x35')],{'$or':_[_0xce55('0x27')](_0x3205b1,function(_0x12f2aa){if(_0x12f2aa[_0xce55('0x29')]!==_0xce55('0x39')){var _0x25fed9={};_0x25fed9[_0x12f2aa['name']]={'$like':'%'+_0x3e7232[_0xce55('0x2d')][_0xce55('0x3a')]+'%'};return _0x25fed9;}})});}_0x4d5651=_[_0xce55('0x38')]({},_0x4d5651,_0x3e7232[_0xce55('0x3b')]);var _0x116cf9={'where':_0x4d5651[_0xce55('0x35')]};return db[_0xce55('0x28')][_0xce55('0x3c')](_0x116cf9)['then'](function(_0x1204c2){_0x28637d[_0xce55('0x3c')]=_0x1204c2;if(_0x3e7232[_0xce55('0x2d')][_0xce55('0x3d')]){_0x4d5651[_0xce55('0x3e')]=[{'all':!![]}];}return db[_0xce55('0x28')][_0xce55('0x3f')](_0x4d5651);})['then'](function(_0x5b0ec7){_0x28637d[_0xce55('0x40')]=_0x5b0ec7;return _0x28637d;})[_0xce55('0x21')](respondWithFilteredResult(_0x1c6424,_0x4d5651))[_0xce55('0x41')](handleError(_0x1c6424,null));};exports['show']=function(_0x3d90cf,_0x7eb2ee){var _0xc27cc5={'raw':![],'where':{'id':_0x3d90cf[_0xce55('0x42')]['id']}},_0xc4c758={};_0xc4c758[_0xce55('0x2b')]=_[_0xce55('0x2c')](db[_0xce55('0x28')]['rawAttributes']);_0xc4c758['query']=_[_0xce55('0x2c')](_0x3d90cf['query']);_0xc4c758[_0xce55('0x36')]=_[_0xce55('0x2e')](_0xc4c758[_0xce55('0x2b')],_0xc4c758[_0xce55('0x2d')]);_0xc27cc5[_0xce55('0x30')]=_[_0xce55('0x2e')](_0xc4c758['model'],qs[_0xce55('0x2f')](_0x3d90cf[_0xce55('0x2d')]['fields']));_0xc27cc5[_0xce55('0x30')]=_0xc27cc5['attributes']['length']?_0xc27cc5['attributes']:_0xc4c758[_0xce55('0x2b')];if(_0x3d90cf[_0xce55('0x2d')][_0xce55('0x3d')]){_0xc27cc5['include']=[{'all':!![]}];}_0xc27cc5=_['merge']({},_0xc27cc5,_0x3d90cf['options']);return db['UserProfileSection'][_0xce55('0x43')](_0xc27cc5)[_0xce55('0x21')](handleEntityNotFound(_0x7eb2ee,null))[_0xce55('0x21')](respondWithResult(_0x7eb2ee,null))[_0xce55('0x41')](handleError(_0x7eb2ee,null));};exports['create']=function(_0x243f38,_0x255cae){return db[_0xce55('0x28')][_0xce55('0x44')](_0x243f38['body'],{})['then'](respondWithResult(_0x255cae,0xc9))[_0xce55('0x41')](handleError(_0x255cae,null));};exports['update']=function(_0x4a8dd2,_0x5a900e){if(_0x4a8dd2['body']['id']){delete _0x4a8dd2[_0xce55('0x45')]['id'];}return db[_0xce55('0x28')][_0xce55('0x43')]({'where':{'id':_0x4a8dd2[_0xce55('0x42')]['id']}})[_0xce55('0x21')](handleEntityNotFound(_0x5a900e,null))['then'](saveUpdates(_0x4a8dd2['body'],null))[_0xce55('0x21')](respondWithResult(_0x5a900e,null))[_0xce55('0x41')](handleError(_0x5a900e,null));};exports[_0xce55('0x22')]=function(_0x193184,_0x3dc7d9){return db[_0xce55('0x28')][_0xce55('0x43')]({'where':{'id':_0x193184[_0xce55('0x42')]['id']}})[_0xce55('0x21')](handleEntityNotFound(_0x3dc7d9,null))[_0xce55('0x21')](removeEntity(_0x3dc7d9,null))[_0xce55('0x41')](handleError(_0x3dc7d9,null));};exports[_0xce55('0x46')]=function(_0x47715e,_0x19a940){return db[_0xce55('0x28')][_0xce55('0x46')]()[_0xce55('0x21')](respondWithResult(_0x19a940,null))[_0xce55('0x41')](handleError(_0x19a940,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index bf6b8a5..3591eec 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 _0x818d=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x498279,_0x1063fe){var _0x89afa3=function(_0xf1c163){while(--_0xf1c163){_0x498279['push'](_0x498279['shift']());}};_0x89afa3(++_0x1063fe);}(_0x818d,0x87));var _0xd818=function(_0x12742e,_0x43f6fa){_0x12742e=_0x12742e-0x0;var _0x173452=_0x818d[_0x12742e];return _0x173452;};'use strict';var _=require('lodash');var util=require(_0xd818('0x0'));var logger=require(_0xd818('0x1'))('api');var moment=require(_0xd818('0x2'));var BPromise=require(_0xd818('0x3'));var rp=require(_0xd818('0x4'));var fs=require('fs');var path=require(_0xd818('0x5'));var rimraf=require('rimraf');var config=require(_0xd818('0x6'));var attributes=require(_0xd818('0x7'));module[_0xd818('0x8')]=function(_0x5ec6d0,_0x4c6f8a){return _0x5ec6d0[_0xd818('0x9')](_0xd818('0xa'),attributes,{'tableName':_0xd818('0xb'),'paranoid':![],'indexes':[{'name':_0xd818('0xc'),'fields':[_0xd818('0xd'),_0xd818('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa739=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa739,0x11d));var _0x9a73=function(_0x4a3a30,_0x11fcf2){_0x4a3a30=_0x4a3a30-0x0;var _0x342dff=_0xa739[_0x4a3a30];return _0x342dff;};'use strict';var _=require(_0x9a73('0x0'));var util=require(_0x9a73('0x1'));var logger=require(_0x9a73('0x2'))(_0x9a73('0x3'));var moment=require('moment');var BPromise=require(_0x9a73('0x4'));var rp=require(_0x9a73('0x5'));var fs=require('fs');var path=require(_0x9a73('0x6'));var rimraf=require(_0x9a73('0x7'));var config=require(_0x9a73('0x8'));var attributes=require(_0x9a73('0x9'));module[_0x9a73('0xa')]=function(_0x4ec62e,_0x1c4d95){return _0x4ec62e[_0x9a73('0xb')](_0x9a73('0xc'),attributes,{'tableName':_0x9a73('0xd'),'paranoid':![],'indexes':[{'name':_0x9a73('0xe'),'fields':[_0x9a73('0xf'),_0x9a73('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 3add84f..8ac8a98 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 _0x3902=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x1d572f,_0x1ab2fd){var _0x56a622=function(_0x4b1819){while(--_0x4b1819){_0x1d572f['push'](_0x1d572f['shift']());}};_0x56a622(++_0x1ab2fd);}(_0x3902,0xe4));var _0x2390=function(_0x1a104e,_0x1bce95){_0x1a104e=_0x1a104e-0x0;var _0x4ce390=_0x3902[_0x1a104e];return _0x4ce390;};'use strict';var _=require(_0x2390('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2390('0x1'));var fs=require('fs');var Redis=require(_0x2390('0x2'));var db=require(_0x2390('0x3'))['db'];var utils=require(_0x2390('0x4'));var logger=require(_0x2390('0x5'))(_0x2390('0x6'));var config=require(_0x2390('0x7'));var jayson=require(_0x2390('0x8'));var client=jayson[_0x2390('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x463d1d,_0x162754,_0x4bf268){return new BPromise(function(_0x3ff52e,_0x148ac8){return client[_0x2390('0xa')](_0x463d1d,_0x4bf268)[_0x2390('0xb')](function(_0x2a05d8){logger[_0x2390('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x162754,_0x2390('0xd'));logger['debug'](_0x2390('0xe'),_0x162754,'request\x20sent',JSON[_0x2390('0xf')](_0x2a05d8));if(_0x2a05d8[_0x2390('0x10')]){if(_0x2a05d8[_0x2390('0x10')][_0x2390('0x11')]===0x1f4){logger[_0x2390('0x10')](_0x2390('0x12'),_0x162754,_0x2a05d8[_0x2390('0x10')][_0x2390('0x13')]);return _0x148ac8(_0x2a05d8['error'][_0x2390('0x13')]);}logger[_0x2390('0x10')](_0x2390('0x12'),_0x162754,_0x2a05d8[_0x2390('0x10')][_0x2390('0x13')]);return _0x3ff52e(_0x2a05d8[_0x2390('0x10')]['message']);}else{logger[_0x2390('0xc')](_0x2390('0x12'),_0x162754,_0x2390('0xd'));_0x3ff52e(_0x2a05d8[_0x2390('0x14')][_0x2390('0x13')]);}})[_0x2390('0x15')](function(_0x390f28){logger[_0x2390('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x162754,_0x390f28);_0x148ac8(_0x390f28);});});} \ No newline at end of file +var _0x3d94=['code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5f3b02,_0x6b754f){var _0xbfec81=function(_0x3c2824){while(--_0x3c2824){_0x5f3b02['push'](_0x5f3b02['shift']());}};_0xbfec81(++_0x6b754f);}(_0x3d94,0x146));var _0x43d9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3d94[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x43d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x43d9('0x1'));var rs=require(_0x43d9('0x2'));var fs=require('fs');var Redis=require(_0x43d9('0x3'));var db=require(_0x43d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x43d9('0x5'))(_0x43d9('0x6'));var config=require(_0x43d9('0x7'));var jayson=require(_0x43d9('0x8'));var client=jayson[_0x43d9('0x9')][_0x43d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2252df,_0x52721d,_0x42b068){return new BPromise(function(_0x356491,_0x185085){return client[_0x43d9('0xb')](_0x2252df,_0x42b068)[_0x43d9('0xc')](function(_0x2a4bfc){logger[_0x43d9('0xd')](_0x43d9('0xe'),_0x52721d,_0x43d9('0xf'));logger['debug'](_0x43d9('0x10'),_0x52721d,'request\x20sent',JSON[_0x43d9('0x11')](_0x2a4bfc));if(_0x2a4bfc[_0x43d9('0x12')]){if(_0x2a4bfc['error'][_0x43d9('0x13')]===0x1f4){logger['error'](_0x43d9('0xe'),_0x52721d,_0x2a4bfc['error'][_0x43d9('0x14')]);return _0x185085(_0x2a4bfc[_0x43d9('0x12')][_0x43d9('0x14')]);}logger[_0x43d9('0x12')](_0x43d9('0xe'),_0x52721d,_0x2a4bfc[_0x43d9('0x12')]['message']);return _0x356491(_0x2a4bfc['error'][_0x43d9('0x14')]);}else{logger[_0x43d9('0xd')](_0x43d9('0xe'),_0x52721d,_0x43d9('0xf'));_0x356491(_0x2a4bfc[_0x43d9('0x15')][_0x43d9('0x14')]);}})[_0x43d9('0x16')](function(_0x1b180f){logger[_0x43d9('0x12')](_0x43d9('0xe'),_0x52721d,_0x1b180f);_0x185085(_0x1b180f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 0c093d6..1fe8c7c 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 _0x21e0=['../../config/environment','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x356bb0,_0x2acb60){var _0x188610=function(_0x14c53b){while(--_0x14c53b){_0x356bb0['push'](_0x356bb0['shift']());}};_0x188610(++_0x2acb60);}(_0x21e0,0x1ea));var _0x021e=function(_0x3ab11a,_0x8712cb){_0x3ab11a=_0x3ab11a-0x0;var _0x2f9373=_0x21e0[_0x3ab11a];return _0x2f9373;};'use strict';var multer=require(_0x021e('0x0'));var util=require('util');var path=require(_0x021e('0x1'));var timeout=require(_0x021e('0x2'));var express=require(_0x021e('0x3'));var router=express[_0x021e('0x4')]();var auth=require(_0x021e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x021e('0x6'));module[_0x021e('0x7')]=router; \ No newline at end of file +var _0x7bf2=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0xae8a5b,_0xdc0c91){var _0x13719c=function(_0x5015ef){while(--_0x5015ef){_0xae8a5b['push'](_0xae8a5b['shift']());}};_0x13719c(++_0xdc0c91);}(_0x7bf2,0x1b0));var _0x27bf=function(_0xef4cf,_0x525bf0){_0xef4cf=_0xef4cf-0x0;var _0x47481f=_0x7bf2[_0xef4cf];return _0x47481f;};'use strict';var multer=require(_0x27bf('0x0'));var util=require('util');var path=require(_0x27bf('0x1'));var timeout=require(_0x27bf('0x2'));var express=require(_0x27bf('0x3'));var router=express[_0x27bf('0x4')]();var auth=require(_0x27bf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x27bf('0x6'));module[_0x27bf('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 2a5a676..d70269c 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 _0xbaf0=['exports','INTEGER'];(function(_0x5bce33,_0x4a4b06){var _0x15bc20=function(_0x56c711){while(--_0x56c711){_0x5bce33['push'](_0x5bce33['shift']());}};_0x15bc20(++_0x4a4b06);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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(_0x23902e,_0x2bcb4e){var _0x28f007=function(_0x4005e9){while(--_0x4005e9){_0x23902e['push'](_0x23902e['shift']());}};_0x28f007(++_0x2bcb4e);}(_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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index e8d3abb..fe38bb7 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 _0x33a1=['exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','request-promise','path','rimraf','./userSmsQueue.attributes'];(function(_0x3bfd5c,_0x32a410){var _0x5507ff=function(_0x3911af){while(--_0x3911af){_0x3bfd5c['push'](_0x3bfd5c['shift']());}};_0x5507ff(++_0x32a410);}(_0x33a1,0x7c));var _0x133a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x33a1[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x133a('0x0'));var util=require(_0x133a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x133a('0x2'));var fs=require('fs');var path=require(_0x133a('0x3'));var rimraf=require(_0x133a('0x4'));var config=require('../../config/environment');var attributes=require(_0x133a('0x5'));module[_0x133a('0x6')]=function(_0x23c48d,_0x557b93){return _0x23c48d[_0x133a('0x7')](_0x133a('0x8'),attributes,{'tableName':_0x133a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3451=['path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x45da8d,_0x15cf7f){var _0x511da2=function(_0x3f5c65){while(--_0x3f5c65){_0x45da8d['push'](_0x45da8d['shift']());}};_0x511da2(++_0x15cf7f);}(_0x3451,0x19a));var _0x1345=function(_0x486236,_0x325e27){_0x486236=_0x486236-0x0;var _0x58d527=_0x3451[_0x486236];return _0x58d527;};'use strict';var _=require(_0x1345('0x0'));var util=require(_0x1345('0x1'));var logger=require('../../config/logger')(_0x1345('0x2'));var moment=require(_0x1345('0x3'));var BPromise=require(_0x1345('0x4'));var rp=require(_0x1345('0x5'));var fs=require('fs');var path=require(_0x1345('0x6'));var rimraf=require(_0x1345('0x7'));var config=require(_0x1345('0x8'));var attributes=require(_0x1345('0x9'));module[_0x1345('0xa')]=function(_0x30f76b,_0x1b67de){return _0x30f76b[_0x1345('0xb')]('UserSmsQueue',attributes,{'tableName':_0x1345('0xc'),'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 1be65d1..6a1ea65 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 _0x0c58=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0c58,0x161));var _0x80c5=function(_0xda8e73,_0x53e1b8){_0xda8e73=_0xda8e73-0x0;var _0x3495d6=_0x0c58[_0xda8e73];return _0x3495d6;};'use strict';var _=require(_0x80c5('0x0'));var util=require(_0x80c5('0x1'));var moment=require(_0x80c5('0x2'));var BPromise=require(_0x80c5('0x3'));var rs=require(_0x80c5('0x4'));var fs=require('fs');var Redis=require(_0x80c5('0x5'));var db=require(_0x80c5('0x6'))['db'];var utils=require(_0x80c5('0x7'));var logger=require(_0x80c5('0x8'))(_0x80c5('0x9'));var config=require('../../config/environment');var jayson=require(_0x80c5('0xa'));var client=jayson[_0x80c5('0xb')][_0x80c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa9a4be,_0x535950,_0xb87655){return new BPromise(function(_0xa39670,_0x559cfa){return client[_0x80c5('0xd')](_0xa9a4be,_0xb87655)[_0x80c5('0xe')](function(_0x507ebd){logger[_0x80c5('0xf')](_0x80c5('0x10'),_0x535950,_0x80c5('0x11'));logger[_0x80c5('0x12')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x535950,'request\x20sent',JSON[_0x80c5('0x13')](_0x507ebd));if(_0x507ebd[_0x80c5('0x14')]){if(_0x507ebd[_0x80c5('0x14')]['code']===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x535950,_0x507ebd[_0x80c5('0x14')][_0x80c5('0x15')]);return _0x559cfa(_0x507ebd[_0x80c5('0x14')]['message']);}logger[_0x80c5('0x14')](_0x80c5('0x10'),_0x535950,_0x507ebd[_0x80c5('0x14')]['message']);return _0xa39670(_0x507ebd[_0x80c5('0x14')][_0x80c5('0x15')]);}else{logger[_0x80c5('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x535950,_0x80c5('0x11'));_0xa39670(_0x507ebd[_0x80c5('0x16')][_0x80c5('0x15')]);}})[_0x80c5('0x17')](function(_0x470087){logger[_0x80c5('0x14')](_0x80c5('0x10'),_0x535950,_0x470087);_0x559cfa(_0x470087);});});} \ No newline at end of file +var _0xd044=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xfc8e58,_0x43d753){var _0x1be7b6=function(_0x20106f){while(--_0x20106f){_0xfc8e58['push'](_0xfc8e58['shift']());}};_0x1be7b6(++_0x43d753);}(_0xd044,0x1e7));var _0x4d04=function(_0x237ead,_0x1869d8){_0x237ead=_0x237ead-0x0;var _0x3f78bf=_0xd044[_0x237ead];return _0x3f78bf;};'use strict';var _=require(_0x4d04('0x0'));var util=require(_0x4d04('0x1'));var moment=require(_0x4d04('0x2'));var BPromise=require(_0x4d04('0x3'));var rs=require(_0x4d04('0x4'));var fs=require('fs');var Redis=require(_0x4d04('0x5'));var db=require(_0x4d04('0x6'))['db'];var utils=require(_0x4d04('0x7'));var logger=require(_0x4d04('0x8'))(_0x4d04('0x9'));var config=require(_0x4d04('0xa'));var jayson=require(_0x4d04('0xb'));var client=jayson[_0x4d04('0xc')][_0x4d04('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d9921,_0x2f0408,_0x13acdb){return new BPromise(function(_0x274294,_0x27a1e7){return client[_0x4d04('0xe')](_0x1d9921,_0x13acdb)['then'](function(_0x3f4f3e){logger['info'](_0x4d04('0xf'),_0x2f0408,'request\x20sent');logger[_0x4d04('0x10')](_0x4d04('0x11'),_0x2f0408,'request\x20sent',JSON[_0x4d04('0x12')](_0x3f4f3e));if(_0x3f4f3e[_0x4d04('0x13')]){if(_0x3f4f3e[_0x4d04('0x13')]['code']===0x1f4){logger['error'](_0x4d04('0xf'),_0x2f0408,_0x3f4f3e[_0x4d04('0x13')][_0x4d04('0x14')]);return _0x27a1e7(_0x3f4f3e[_0x4d04('0x13')]['message']);}logger['error'](_0x4d04('0xf'),_0x2f0408,_0x3f4f3e[_0x4d04('0x13')][_0x4d04('0x14')]);return _0x274294(_0x3f4f3e['error'][_0x4d04('0x14')]);}else{logger['info'](_0x4d04('0xf'),_0x2f0408,'request\x20sent');_0x274294(_0x3f4f3e['result']['message']);}})[_0x4d04('0x15')](function(_0x5b3d2c){logger[_0x4d04('0x13')](_0x4d04('0xf'),_0x2f0408,_0x5b3d2c);_0x27a1e7(_0x5b3d2c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 2dc3533..4d1f7fa 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 _0x9561=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x10c9be,_0x244d9f){var _0x48658d=function(_0x4a012f){while(--_0x4a012f){_0x10c9be['push'](_0x10c9be['shift']());}};_0x48658d(++_0x244d9f);}(_0x9561,0x122));var _0x1956=function(_0x296994,_0xa61895){_0x296994=_0x296994-0x0;var _0x3241ca=_0x9561[_0x296994];return _0x3241ca;};'use strict';var multer=require(_0x1956('0x0'));var util=require(_0x1956('0x1'));var path=require(_0x1956('0x2'));var timeout=require(_0x1956('0x3'));var express=require(_0x1956('0x4'));var router=express[_0x1956('0x5')]();var auth=require(_0x1956('0x6'));var interaction=require(_0x1956('0x7'));var config=require(_0x1956('0x8'));module[_0x1956('0x9')]=router; \ No newline at end of file +var _0x7307=['../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2fa27d,_0x1e48e7){var _0x380f28=function(_0x1244dc){while(--_0x1244dc){_0x2fa27d['push'](_0x2fa27d['shift']());}};_0x380f28(++_0x1e48e7);}(_0x7307,0x121));var _0x7730=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x7307[_0x59befa];return _0x1dd63d;};'use strict';var multer=require(_0x7730('0x0'));var util=require(_0x7730('0x1'));var path=require(_0x7730('0x2'));var timeout=require(_0x7730('0x3'));var express=require(_0x7730('0x4'));var router=express[_0x7730('0x5')]();var auth=require(_0x7730('0x6'));var interaction=require(_0x7730('0x7'));var config=require(_0x7730('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index faba492..944f95c 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 _0xbaf0=['exports','INTEGER'];(function(_0x34f7bb,_0x547eb3){var _0x2efee3=function(_0x1fc766){while(--_0x1fc766){_0x34f7bb['push'](_0x34f7bb['shift']());}};_0x2efee3(++_0x547eb3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x41cd6f,_0x28e0e0){var _0x2080a8=function(_0x2483a7){while(--_0x2483a7){_0x41cd6f['push'](_0x41cd6f['shift']());}};_0x2080a8(++_0x28e0e0);}(_0xe706,0xa3));var _0x6e70=function(_0x3c6c7c,_0x569b3e){_0x3c6c7c=_0x3c6c7c-0x0;var _0x56c812=_0xe706[_0x3c6c7c];return _0x56c812;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 94677db..fa21998 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 _0xcedc=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0xf9136d,_0x2358d6){var _0x1b9543=function(_0x480b90){while(--_0x480b90){_0xf9136d['push'](_0xf9136d['shift']());}};_0x1b9543(++_0x2358d6);}(_0xcedc,0x174));var _0xcced=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcedc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcced('0x0'));var util=require(_0xcced('0x1'));var logger=require('../../config/logger')(_0xcced('0x2'));var moment=require(_0xcced('0x3'));var BPromise=require(_0xcced('0x4'));var rp=require(_0xcced('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcced('0x6'));var attributes=require(_0xcced('0x7'));module[_0xcced('0x8')]=function(_0x4ec4b3,_0x24fdae){return _0x4ec4b3[_0xcced('0x9')](_0xcced('0xa'),attributes,{'tableName':_0xcced('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd19b=['UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2bdf13,_0x8bc589){var _0x412d41=function(_0x146658){while(--_0x146658){_0x2bdf13['push'](_0x2bdf13['shift']());}};_0x412d41(++_0x8bc589);}(_0xd19b,0x17e));var _0xbd19=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xd19b[_0x1ca9e9];return _0x309f3c;};'use strict';var _=require('lodash');var util=require(_0xbd19('0x0'));var logger=require(_0xbd19('0x1'))(_0xbd19('0x2'));var moment=require('moment');var BPromise=require(_0xbd19('0x3'));var rp=require(_0xbd19('0x4'));var fs=require('fs');var path=require(_0xbd19('0x5'));var rimraf=require(_0xbd19('0x6'));var config=require(_0xbd19('0x7'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x33ecc6,_0xfef502){return _0x33ecc6['define'](_0xbd19('0x8'),attributes,{'tableName':_0xbd19('0x9'),'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 a44435d..d9a26ca 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 _0xe653=['result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x542b14,_0x582941){var _0x58695c=function(_0x3ac352){while(--_0x3ac352){_0x542b14['push'](_0x542b14['shift']());}};_0x58695c(++_0x582941);}(_0xe653,0x1cd));var _0x3e65=function(_0x34f8ba,_0x2bb6a8){_0x34f8ba=_0x34f8ba-0x0;var _0xa5ed05=_0xe653[_0x34f8ba];return _0xa5ed05;};'use strict';var _=require('lodash');var util=require(_0x3e65('0x0'));var moment=require(_0x3e65('0x1'));var BPromise=require(_0x3e65('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e65('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e65('0x4'));var logger=require(_0x3e65('0x5'))(_0x3e65('0x6'));var config=require('../../config/environment');var jayson=require(_0x3e65('0x7'));var client=jayson[_0x3e65('0x8')][_0x3e65('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10a928,_0x31d0af,_0x278f1c){return new BPromise(function(_0x5f0f9e,_0x20ad0f){return client['request'](_0x10a928,_0x278f1c)[_0x3e65('0xa')](function(_0x174698){logger[_0x3e65('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x31d0af,'request\x20sent');logger['debug'](_0x3e65('0xc'),_0x31d0af,'request\x20sent',JSON[_0x3e65('0xd')](_0x174698));if(_0x174698[_0x3e65('0xe')]){if(_0x174698[_0x3e65('0xe')][_0x3e65('0xf')]===0x1f4){logger[_0x3e65('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x31d0af,_0x174698[_0x3e65('0xe')][_0x3e65('0x10')]);return _0x20ad0f(_0x174698[_0x3e65('0xe')][_0x3e65('0x10')]);}logger[_0x3e65('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x31d0af,_0x174698[_0x3e65('0xe')][_0x3e65('0x10')]);return _0x5f0f9e(_0x174698[_0x3e65('0xe')]['message']);}else{logger[_0x3e65('0xb')](_0x3e65('0x11'),_0x31d0af,_0x3e65('0x12'));_0x5f0f9e(_0x174698[_0x3e65('0x13')][_0x3e65('0x10')]);}})['catch'](function(_0x142768){logger['error'](_0x3e65('0x11'),_0x31d0af,_0x142768);_0x20ad0f(_0x142768);});});} \ No newline at end of file +var _0x66b7=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x19468a,_0x4216bb){var _0x55d9f0=function(_0x5a0493){while(--_0x5a0493){_0x19468a['push'](_0x19468a['shift']());}};_0x55d9f0(++_0x4216bb);}(_0x66b7,0xd7));var _0x766b=function(_0x392890,_0xb8d3dd){_0x392890=_0x392890-0x0;var _0x2b2e30=_0x66b7[_0x392890];return _0x2b2e30;};'use strict';var _=require(_0x766b('0x0'));var util=require(_0x766b('0x1'));var moment=require(_0x766b('0x2'));var BPromise=require(_0x766b('0x3'));var rs=require(_0x766b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x766b('0x5'))['db'];var utils=require(_0x766b('0x6'));var logger=require(_0x766b('0x7'))('rpc');var config=require(_0x766b('0x8'));var jayson=require(_0x766b('0x9'));var client=jayson[_0x766b('0xa')][_0x766b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5998fc,_0x17928d,_0x393b3d){return new BPromise(function(_0x3aba65,_0x439650){return client['request'](_0x5998fc,_0x393b3d)[_0x766b('0xc')](function(_0x4e91f0){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x17928d,_0x766b('0xd'));logger[_0x766b('0xe')](_0x766b('0xf'),_0x17928d,_0x766b('0xd'),JSON[_0x766b('0x10')](_0x4e91f0));if(_0x4e91f0['error']){if(_0x4e91f0[_0x766b('0x11')][_0x766b('0x12')]===0x1f4){logger[_0x766b('0x11')](_0x766b('0x13'),_0x17928d,_0x4e91f0[_0x766b('0x11')][_0x766b('0x14')]);return _0x439650(_0x4e91f0['error'][_0x766b('0x14')]);}logger[_0x766b('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x17928d,_0x4e91f0[_0x766b('0x11')][_0x766b('0x14')]);return _0x3aba65(_0x4e91f0[_0x766b('0x11')][_0x766b('0x14')]);}else{logger['info'](_0x766b('0x13'),_0x17928d,_0x766b('0xd'));_0x3aba65(_0x4e91f0[_0x766b('0x15')][_0x766b('0x14')]);}})['catch'](function(_0x2646a0){logger[_0x766b('0x11')](_0x766b('0x13'),_0x17928d,_0x2646a0);_0x439650(_0x2646a0);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index c8c6302..deb8ecc 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafb9=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x30fae8,_0x3e6842){var _0x5e0832=function(_0x5ad946){while(--_0x5ad946){_0x30fae8['push'](_0x30fae8['shift']());}};_0x5e0832(++_0x3e6842);}(_0xafb9,0x68));var _0x9afb=function(_0x49d80a,_0x46fc38){_0x49d80a=_0x49d80a-0x0;var _0x2bbafc=_0xafb9[_0x49d80a];return _0x2bbafc;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var auth=require(_0x9afb('0x6'));var interaction=require(_0x9afb('0x7'));var config=require(_0x9afb('0x8'));module['exports']=router; \ No newline at end of file +var _0xaa72=['../../config/environment','exports','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x369e31,_0x5f1558){var _0x33b750=function(_0x264483){while(--_0x264483){_0x369e31['push'](_0x369e31['shift']());}};_0x33b750(++_0x5f1558);}(_0xaa72,0x113));var _0x2aa7=function(_0xfd53c9,_0x278fd3){_0xfd53c9=_0xfd53c9-0x0;var _0x1f520b=_0xaa72[_0xfd53c9];return _0x1f520b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2aa7('0x0'));var timeout=require(_0x2aa7('0x1'));var express=require(_0x2aa7('0x2'));var router=express[_0x2aa7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2aa7('0x4'));var config=require(_0x2aa7('0x5'));module[_0x2aa7('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 3a9e529..fd487d7 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 _0x1c08=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x870bd,_0xaf1c4b){var _0x5ba5e5=function(_0x3b53a6){while(--_0x3b53a6){_0x870bd['push'](_0x870bd['shift']());}};_0x5ba5e5(++_0xaf1c4b);}(_0x1c08,0x11e));var _0x81c0=function(_0x2d33c7,_0x20e736){_0x2d33c7=_0x2d33c7-0x0;var _0x3f5a29=_0x1c08[_0x2d33c7];return _0x3f5a29;};'use strict';var Sequelize=require(_0x81c0('0x0'));module[_0x81c0('0x1')]={'uniqueid':{'type':Sequelize[_0x81c0('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x81c0('0x3')},'membername':{'type':Sequelize[_0x81c0('0x4')],'allowNull':![],'comment':_0x81c0('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x81c0('0x4')],'allowNull':![],'unique':_0x81c0('0x5'),'comment':_0x81c0('0x3')},'VoiceQueueId':{'type':Sequelize[_0x81c0('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x81c0('0x4')],'allowNull':![],'unique':_0x81c0('0x5'),'comment':_0x81c0('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x81c0('0x3')}}; \ No newline at end of file +var _0x7c14=['queue_interface','sequelize','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x25e37a,_0x3c9560){var _0x2a0e29=function(_0x20d6a5){while(--_0x20d6a5){_0x25e37a['push'](_0x25e37a['shift']());}};_0x2a0e29(++_0x3c9560);}(_0x7c14,0xec));var _0x47c1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7c14[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x47c1('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x47c1('0x1')},'membername':{'type':Sequelize[_0x47c1('0x2')],'allowNull':![],'comment':_0x47c1('0x1')},'UserId':{'type':Sequelize[_0x47c1('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x47c1('0x2')],'allowNull':![],'unique':_0x47c1('0x4'),'comment':_0x47c1('0x1')},'VoiceQueueId':{'type':Sequelize[_0x47c1('0x3')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x47c1('0x1')},'penalty':{'type':Sequelize[_0x47c1('0x3')](0xb),'defaultValue':0x0,'comment':_0x47c1('0x1')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x47c1('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 0b6bd43..149670e 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 _0xb662=['update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x4c7108,_0xb67906){var _0x3fb2c3=function(_0x3b29b6){while(--_0x3b29b6){_0x4c7108['push'](_0x4c7108['shift']());}};_0x3fb2c3(++_0xb67906);}(_0xb662,0x90));var _0x2b66=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xb662[_0x39c734];return _0xb2a2f9;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x2b66('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2b66('0x1'),'afterDestroy':_0x2b66('0x2')};function emitEvent(_0x5b9222){return function(_0x5bb06f,_0x23ec60,_0x121c6a){UserVoiceQueueRtEvents[_0x2b66('0x3')](_0x5b9222+':'+_0x5bb06f['id'],_0x5bb06f);UserVoiceQueueRtEvents['emit'](_0x5b9222,_0x5bb06f);_0x121c6a(null);};}for(var e in events){if(events[_0x2b66('0x4')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0d17=['hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x4841d4,_0x41ed37){var _0x22aaa1=function(_0x21f7ae){while(--_0x21f7ae){_0x4841d4['push'](_0x4841d4['shift']());}};_0x22aaa1(++_0x41ed37);}(_0x0d17,0x16a));var _0x70d1=function(_0x351bd4,_0x100125){_0x351bd4=_0x351bd4-0x0;var _0x391674=_0x0d17[_0x351bd4];return _0x391674;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x70d1('0x0'))['db'][_0x70d1('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x70d1('0x2')](0x0);var events={'afterCreate':_0x70d1('0x3'),'afterUpdate':'update','afterDestroy':_0x70d1('0x4')};function emitEvent(_0x567f3a){return function(_0x7703d7,_0x35f520,_0x1025d6){UserVoiceQueueRtEvents[_0x70d1('0x5')](_0x567f3a+':'+_0x7703d7['id'],_0x7703d7);UserVoiceQueueRtEvents['emit'](_0x567f3a,_0x7703d7);_0x1025d6(null);};}for(var e in events){if(events[_0x70d1('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x70d1('0x7')](e,emitEvent(event));}}module[_0x70d1('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 40aa27d..c7da92c 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 _0xd308=['bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xd308,0x1d8));var _0x8d30=function(_0x11f6d1,_0x47a9b7){_0x11f6d1=_0x11f6d1-0x0;var _0x2c3949=_0xd308[_0x11f6d1];return _0x2c3949;};'use strict';var _=require(_0x8d30('0x0'));var util=require(_0x8d30('0x1'));var logger=require(_0x8d30('0x2'))(_0x8d30('0x3'));var moment=require('moment');var BPromise=require(_0x8d30('0x4'));var rp=require(_0x8d30('0x5'));var fs=require('fs');var path=require(_0x8d30('0x6'));var rimraf=require(_0x8d30('0x7'));var config=require(_0x8d30('0x8'));var attributes=require(_0x8d30('0x9'));module[_0x8d30('0xa')]=function(_0x25b128,_0x59f50d){return _0x25b128[_0x8d30('0xb')](_0x8d30('0xc'),attributes,{'tableName':_0x8d30('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dcc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api'];(function(_0x2bb1c0,_0x2c15f4){var _0x55a993=function(_0x49871b){while(--_0x49871b){_0x2bb1c0['push'](_0x2bb1c0['shift']());}};_0x55a993(++_0x2c15f4);}(_0x3dcc,0x14c));var _0xc3dc=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0x3dcc[_0x10df1e];return _0x3e24fb;};'use strict';var _=require(_0xc3dc('0x0'));var util=require(_0xc3dc('0x1'));var logger=require(_0xc3dc('0x2'))(_0xc3dc('0x3'));var moment=require(_0xc3dc('0x4'));var BPromise=require(_0xc3dc('0x5'));var rp=require(_0xc3dc('0x6'));var fs=require('fs');var path=require(_0xc3dc('0x7'));var rimraf=require(_0xc3dc('0x8'));var config=require(_0xc3dc('0x9'));var attributes=require(_0xc3dc('0xa'));module[_0xc3dc('0xb')]=function(_0x4c4c08,_0x10b7ed){return _0x4c4c08['define'](_0xc3dc('0xc'),attributes,{'tableName':_0xc3dc('0xd'),'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 8b7942e..7296bf1 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 _0xeba8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x9cf14e,_0x57d04f){var _0x14877a=function(_0x35e94f){while(--_0x35e94f){_0x9cf14e['push'](_0x9cf14e['shift']());}};_0x14877a(++_0x57d04f);}(_0xeba8,0x133));var _0x8eba=function(_0x209f9c,_0x4ea385){_0x209f9c=_0x209f9c-0x0;var _0x13c1ef=_0xeba8[_0x209f9c];return _0x13c1ef;};'use strict';var _=require(_0x8eba('0x0'));var util=require(_0x8eba('0x1'));var moment=require(_0x8eba('0x2'));var BPromise=require(_0x8eba('0x3'));var rs=require(_0x8eba('0x4'));var fs=require('fs');var Redis=require(_0x8eba('0x5'));var db=require(_0x8eba('0x6'))['db'];var utils=require(_0x8eba('0x7'));var logger=require(_0x8eba('0x8'))(_0x8eba('0x9'));var config=require(_0x8eba('0xa'));var jayson=require(_0x8eba('0xb'));var client=jayson[_0x8eba('0xc')]['http']({'port':0x232a});config[_0x8eba('0xd')]=_[_0x8eba('0xe')](config[_0x8eba('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8eba('0xf'))(new Redis(config['redis']));require(_0x8eba('0x10'))[_0x8eba('0x11')](socket);function respondWithRpcPromise(_0x1fbdf4,_0x23a053,_0x13e772){return new BPromise(function(_0x24c837,_0x3a9608){return client['request'](_0x1fbdf4,_0x13e772)[_0x8eba('0x12')](function(_0x5a9bf7){logger[_0x8eba('0x13')](_0x8eba('0x14'),_0x23a053,'request\x20sent');logger[_0x8eba('0x15')](_0x8eba('0x16'),_0x23a053,_0x8eba('0x17'),JSON['stringify'](_0x5a9bf7));if(_0x5a9bf7[_0x8eba('0x18')]){if(_0x5a9bf7['error'][_0x8eba('0x19')]===0x1f4){logger[_0x8eba('0x18')](_0x8eba('0x14'),_0x23a053,_0x5a9bf7['error'][_0x8eba('0x1a')]);return _0x3a9608(_0x5a9bf7[_0x8eba('0x18')][_0x8eba('0x1a')]);}logger[_0x8eba('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x23a053,_0x5a9bf7['error'][_0x8eba('0x1a')]);return _0x24c837(_0x5a9bf7['error'][_0x8eba('0x1a')]);}else{logger[_0x8eba('0x13')](_0x8eba('0x14'),_0x23a053,_0x8eba('0x17'));_0x24c837(_0x5a9bf7['result'][_0x8eba('0x1a')]);}})['catch'](function(_0x2540dc){logger[_0x8eba('0x18')](_0x8eba('0x14'),_0x23a053,_0x2540dc);_0x3a9608(_0x2540dc);});});}exports[_0x8eba('0x1b')]=function(_0x3da278){var _0x489cbe=this;return new Promise(function(_0x1db13c,_0x2a5e5f){return db[_0x8eba('0x1c')][_0x8eba('0x1d')]({'raw':_0x3da278[_0x8eba('0x1e')]?_0x3da278[_0x8eba('0x1e')][_0x8eba('0x1f')]===undefined?!![]:![]:!![],'where':_0x3da278[_0x8eba('0x1e')]?_0x3da278[_0x8eba('0x1e')][_0x8eba('0x20')]||null:null,'attributes':[[db[_0x8eba('0x21')]['fn'](_0x8eba('0x22'),db['sequelize']['fn']('IF',db[_0x8eba('0x21')][_0x8eba('0x23')](_0x8eba('0x24')))),_0x8eba('0x25')]]})[_0x8eba('0x12')](function(_0x1d7b81){logger[_0x8eba('0x13')](_0x8eba('0x1b'),_0x3da278);logger[_0x8eba('0x15')](_0x8eba('0x1b'),_0x3da278,JSON[_0x8eba('0x26')](_0x1d7b81));_0x1db13c(_0x1d7b81);})['catch'](function(_0x2a1e72){logger['error'](_0x8eba('0x1b'),_0x2a1e72['message'],_0x3da278);_0x2a5e5f(_0x489cbe['error'](0x1f4,_0x2a1e72['message']));});});}; \ No newline at end of file +var _0xd7de=['./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x21f31f,_0x508d58){var _0xf3c92a=function(_0xec9c78){while(--_0xec9c78){_0x21f31f['push'](_0x21f31f['shift']());}};_0xf3c92a(++_0x508d58);}(_0xd7de,0x89));var _0xed7d=function(_0x473ea6,_0xc67499){_0x473ea6=_0x473ea6-0x0;var _0x50e462=_0xd7de[_0x473ea6];return _0x50e462;};'use strict';var _=require('lodash');var util=require(_0xed7d('0x0'));var moment=require(_0xed7d('0x1'));var BPromise=require(_0xed7d('0x2'));var rs=require(_0xed7d('0x3'));var fs=require('fs');var Redis=require(_0xed7d('0x4'));var db=require(_0xed7d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xed7d('0x6'))(_0xed7d('0x7'));var config=require('../../config/environment');var jayson=require(_0xed7d('0x8'));var client=jayson[_0xed7d('0x9')][_0xed7d('0xa')]({'port':0x232a});config[_0xed7d('0xb')]=_[_0xed7d('0xc')](config[_0xed7d('0xb')],{'host':_0xed7d('0xd'),'port':0x18eb});var socket=require(_0xed7d('0xe'))(new Redis(config[_0xed7d('0xb')]));require(_0xed7d('0xf'))[_0xed7d('0x10')](socket);function respondWithRpcPromise(_0x84c180,_0x519f88,_0x500e77){return new BPromise(function(_0x5ce3e0,_0x5bd122){return client['request'](_0x84c180,_0x500e77)['then'](function(_0x14e909){logger[_0xed7d('0x11')](_0xed7d('0x12'),_0x519f88,_0xed7d('0x13'));logger[_0xed7d('0x14')](_0xed7d('0x15'),_0x519f88,_0xed7d('0x13'),JSON['stringify'](_0x14e909));if(_0x14e909['error']){if(_0x14e909[_0xed7d('0x16')][_0xed7d('0x17')]===0x1f4){logger['error'](_0xed7d('0x12'),_0x519f88,_0x14e909[_0xed7d('0x16')]['message']);return _0x5bd122(_0x14e909[_0xed7d('0x16')][_0xed7d('0x18')]);}logger[_0xed7d('0x16')](_0xed7d('0x12'),_0x519f88,_0x14e909[_0xed7d('0x16')][_0xed7d('0x18')]);return _0x5ce3e0(_0x14e909[_0xed7d('0x16')][_0xed7d('0x18')]);}else{logger[_0xed7d('0x11')](_0xed7d('0x12'),_0x519f88,_0xed7d('0x13'));_0x5ce3e0(_0x14e909[_0xed7d('0x19')][_0xed7d('0x18')]);}})[_0xed7d('0x1a')](function(_0x3808ed){logger[_0xed7d('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x519f88,_0x3808ed);_0x5bd122(_0x3808ed);});});}exports['GetVoiceQueueRtPauses']=function(_0x52457d){var _0x577b09=this;return new Promise(function(_0x2fc2ad,_0x2a296f){return db[_0xed7d('0x1b')]['findAll']({'raw':_0x52457d['options']?_0x52457d[_0xed7d('0x1c')][_0xed7d('0x1d')]===undefined?!![]:![]:!![],'where':_0x52457d['options']?_0x52457d[_0xed7d('0x1c')][_0xed7d('0x1e')]||null:null,'attributes':[[db[_0xed7d('0x1f')]['fn'](_0xed7d('0x20'),db[_0xed7d('0x1f')]['fn']('IF',db[_0xed7d('0x1f')][_0xed7d('0x21')](_0xed7d('0x22')))),_0xed7d('0x23')]]})['then'](function(_0x183869){logger['info'](_0xed7d('0x24'),_0x52457d);logger[_0xed7d('0x14')](_0xed7d('0x24'),_0x52457d,JSON[_0xed7d('0x25')](_0x183869));_0x2fc2ad(_0x183869);})[_0xed7d('0x1a')](function(_0x2ea196){logger[_0xed7d('0x16')](_0xed7d('0x24'),_0x2ea196[_0xed7d('0x18')],_0x52457d);_0x2a296f(_0x577b09[_0xed7d('0x16')](0x1f4,_0x2ea196[_0xed7d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 335f5c7..1e54187 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 _0x7927=['userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update'];(function(_0x27089f,_0xccd301){var _0x40874f=function(_0x5a81e4){while(--_0x5a81e4){_0x27089f['push'](_0x27089f['shift']());}};_0x40874f(++_0xccd301);}(_0x7927,0x185));var _0x7792=function(_0x532ab7,_0x35a7be){_0x532ab7=_0x532ab7-0x0;var _0xa84ea=_0x7927[_0x532ab7];return _0xa84ea;};'use strict';var UserVoiceQueueRtEvents=require(_0x7792('0x0'));var events=['save',_0x7792('0x1'),_0x7792('0x2')];function createListener(_0x15005f,_0x248a1c){return function(_0x5e66b0){_0x248a1c['emit'](_0x15005f,_0x5e66b0);};}function removeListener(_0x3ed83a,_0x36027d){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3ed83a,_0x36027d);};}exports['register']=function(_0x511c2a){for(var _0x4d282b=0x0,_0xfb1c10=events['length'];_0x4d282b<_0xfb1c10;_0x4d282b++){var _0x358186=events[_0x4d282b];var _0x36c864=createListener(_0x7792('0x3')+_0x358186,_0x511c2a);UserVoiceQueueRtEvents['on'](_0x358186,_0x36c864);}}; \ No newline at end of file +var _0x7e4b=['./userVoiceQueueRt.events','save','remove','update','removeListener','register','userVoiceQueueRt:'];(function(_0x97501e,_0x48c8fd){var _0x5919c8=function(_0x4033bd){while(--_0x4033bd){_0x97501e['push'](_0x97501e['shift']());}};_0x5919c8(++_0x48c8fd);}(_0x7e4b,0x11f));var _0xb7e4=function(_0x46a10d,_0x26d9c2){_0x46a10d=_0x46a10d-0x0;var _0x49f73a=_0x7e4b[_0x46a10d];return _0x49f73a;};'use strict';var UserVoiceQueueRtEvents=require(_0xb7e4('0x0'));var events=[_0xb7e4('0x1'),_0xb7e4('0x2'),_0xb7e4('0x3')];function createListener(_0x1b4434,_0x408e68){return function(_0x49c67d){_0x408e68['emit'](_0x1b4434,_0x49c67d);};}function removeListener(_0x37799e,_0x3eae72){return function(){UserVoiceQueueRtEvents[_0xb7e4('0x4')](_0x37799e,_0x3eae72);};}exports[_0xb7e4('0x5')]=function(_0x1675a6){for(var _0x562216=0x0,_0xc08254=events['length'];_0x562216<_0xc08254;_0x562216++){var _0x1789f0=events[_0x562216];var _0x514fe4=createListener(_0xb7e4('0x6')+_0x1789f0,_0x1675a6);UserVoiceQueueRtEvents['on'](_0x1789f0,_0x514fe4);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1228fcc..6956088 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 _0x41f1=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x336b92,_0x4472ad){var _0xa2c5ef=function(_0x1a8c0d){while(--_0x1a8c0d){_0x336b92['push'](_0x336b92['shift']());}};_0xa2c5ef(++_0x4472ad);}(_0x41f1,0x15e));var _0x141f=function(_0x23b980,_0x57697f){_0x23b980=_0x23b980-0x0;var _0x475354=_0x41f1[_0x23b980];return _0x475354;};'use strict';var multer=require(_0x141f('0x0'));var util=require(_0x141f('0x1'));var path=require(_0x141f('0x2'));var timeout=require(_0x141f('0x3'));var express=require('express');var router=express[_0x141f('0x4')]();var auth=require(_0x141f('0x5'));var interaction=require(_0x141f('0x6'));var config=require(_0x141f('0x7'));module[_0x141f('0x8')]=router; \ No newline at end of file +var _0xd26f=['../../config/environment','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x43f8ff,_0x43374a){var _0x3768cb=function(_0x22e6e6){while(--_0x22e6e6){_0x43f8ff['push'](_0x43f8ff['shift']());}};_0x3768cb(++_0x43374a);}(_0xd26f,0xa2));var _0xfd26=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xd26f[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require(_0xfd26('0x0'));var path=require(_0xfd26('0x1'));var timeout=require(_0xfd26('0x2'));var express=require('express');var router=express[_0xfd26('0x3')]();var auth=require(_0xfd26('0x4'));var interaction=require(_0xfd26('0x5'));var config=require(_0xfd26('0x6'));module[_0xfd26('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 542614d..83c83ec 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(_0x44cb2d,_0x58ebd3){var _0x4d996a=function(_0x388b61){while(--_0x388b61){_0x44cb2d['push'](_0x44cb2d['shift']());}};_0x4d996a(++_0x58ebd3);}(_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 _0xd8b0=['exports','sequelize'];(function(_0x507e70,_0xffb184){var _0x2dee23=function(_0x3cd7c9){while(--_0x3cd7c9){_0x507e70['push'](_0x507e70['shift']());}};_0x2dee23(++_0xffb184);}(_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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index e12fc2b..bd48dc8 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 _0x423c=['define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x4297af,_0x2882f5){var _0x10ad5d=function(_0x452a2a){while(--_0x452a2a){_0x4297af['push'](_0x4297af['shift']());}};_0x10ad5d(++_0x2882f5);}(_0x423c,0x107));var _0xc423=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x423c[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0xc423('0x0'));var logger=require(_0xc423('0x1'))('api');var moment=require(_0xc423('0x2'));var BPromise=require(_0xc423('0x3'));var rp=require(_0xc423('0x4'));var fs=require('fs');var path=require(_0xc423('0x5'));var rimraf=require(_0xc423('0x6'));var config=require(_0xc423('0x7'));var attributes=require(_0xc423('0x8'));module[_0xc423('0x9')]=function(_0x56f8fe,_0x4c3df5){return _0x56f8fe[_0xc423('0xa')](_0xc423('0xb'),attributes,{'tableName':_0xc423('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe296=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0xdcba5e,_0x5c3c26){var _0x5c31ff=function(_0x30cf7d){while(--_0x30cf7d){_0xdcba5e['push'](_0xdcba5e['shift']());}};_0x5c31ff(++_0x5c3c26);}(_0xe296,0xb4));var _0x6e29=function(_0x152861,_0x2343d6){_0x152861=_0x152861-0x0;var _0x21367f=_0xe296[_0x152861];return _0x21367f;};'use strict';var _=require('lodash');var util=require(_0x6e29('0x0'));var logger=require(_0x6e29('0x1'))(_0x6e29('0x2'));var moment=require(_0x6e29('0x3'));var BPromise=require(_0x6e29('0x4'));var rp=require(_0x6e29('0x5'));var fs=require('fs');var path=require(_0x6e29('0x6'));var rimraf=require(_0x6e29('0x7'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x6e29('0x8')]=function(_0x5daa67,_0x22e9fb){return _0x5daa67[_0x6e29('0x9')](_0x6e29('0xa'),attributes,{'tableName':_0x6e29('0xb'),'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 9cda4b5..a33c48d 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(_0x5e2073,_0x660af8){var _0x248d1a=function(_0x5ab67c){while(--_0x5ab67c){_0x5e2073['push'](_0x5e2073['shift']());}};_0x248d1a(++_0x660af8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x11b8df,_0x41e72c){var _0x49aa80=function(_0x489cc4){while(--_0x489cc4){_0x11b8df['push'](_0x11b8df['shift']());}};_0x49aa80(++_0x41e72c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 72f19fa..df8f9a6 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 _0x6c95=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','put','update','/:id','destroy','exports','multer','util','path','express'];(function(_0x44fd52,_0x3a072a){var _0x511c38=function(_0x450383){while(--_0x450383){_0x44fd52['push'](_0x44fd52['shift']());}};_0x511c38(++_0x3a072a);}(_0x6c95,0x178));var _0x56c9=function(_0x3dade5,_0x56d6cb){_0x3dade5=_0x3dade5-0x0;var _0xd6b087=_0x6c95[_0x3dade5];return _0xd6b087;};'use strict';var multer=require(_0x56c9('0x0'));var util=require(_0x56c9('0x1'));var path=require(_0x56c9('0x2'));var timeout=require('connect-timeout');var express=require(_0x56c9('0x3'));var router=express[_0x56c9('0x4')]();var auth=require(_0x56c9('0x5'));var interaction=require(_0x56c9('0x6'));var config=require(_0x56c9('0x7'));var controller=require(_0x56c9('0x8'));router[_0x56c9('0x9')]('/',auth[_0x56c9('0xa')](),controller[_0x56c9('0xb')]);router[_0x56c9('0x9')]('/:id',auth[_0x56c9('0xa')](),controller[_0x56c9('0xc')]);router[_0x56c9('0xd')]('/',auth[_0x56c9('0xa')](),controller[_0x56c9('0xe')]);router[_0x56c9('0xf')]('/:id',auth[_0x56c9('0xa')](),controller[_0x56c9('0x10')]);router['delete'](_0x56c9('0x11'),auth[_0x56c9('0xa')](),controller[_0x56c9('0x12')]);module[_0x56c9('0x13')]=router; \ No newline at end of file +var _0x5103=['show','post','create','put','update','delete','exports','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','index','/:id','isAuthenticated'];(function(_0x185d9a,_0x25555f){var _0x3098ec=function(_0x3275a8){while(--_0x3275a8){_0x185d9a['push'](_0x185d9a['shift']());}};_0x3098ec(++_0x25555f);}(_0x5103,0x197));var _0x3510=function(_0x80b16b,_0x315606){_0x80b16b=_0x80b16b-0x0;var _0x46963b=_0x5103[_0x80b16b];return _0x46963b;};'use strict';var multer=require(_0x3510('0x0'));var util=require('util');var path=require(_0x3510('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x3510('0x2'));var interaction=require(_0x3510('0x3'));var config=require(_0x3510('0x4'));var controller=require(_0x3510('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x3510('0x6')]);router['get'](_0x3510('0x7'),auth[_0x3510('0x8')](),controller[_0x3510('0x9')]);router[_0x3510('0xa')]('/',auth[_0x3510('0x8')](),controller[_0x3510('0xb')]);router[_0x3510('0xc')](_0x3510('0x7'),auth['isAuthenticated'](),controller[_0x3510('0xd')]);router[_0x3510('0xe')](_0x3510('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x3510('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 7b80c65..03f09d0 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 _0xbc59=['exports','STRING','name'];(function(_0x46af0f,_0x13b316){var _0x458655=function(_0x371b5a){while(--_0x371b5a){_0x46af0f['push'](_0x46af0f['shift']());}};_0x458655(++_0x13b316);}(_0xbc59,0x123));var _0x9bc5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbc59[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x9bc5('0x0')]={'name':{'type':Sequelize[_0x9bc5('0x1')],'unique':_0x9bc5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x368b=['exports','STRING','name'];(function(_0x2c6991,_0x4b5775){var _0x4de9fa=function(_0x4ad213){while(--_0x4ad213){_0x2c6991['push'](_0x2c6991['shift']());}};_0x4de9fa(++_0x4b5775);}(_0x368b,0x19e));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb368('0x0')]={'name':{'type':Sequelize[_0xb368('0x1')],'unique':_0xb368('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb368('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2595c2c..2b91b6b 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 _0xc87f=['Variable','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','Variables','UserProfileResource','stack','name','index','map'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xc87f,0x169));var _0xfc87=function(_0x3da4c1,_0x6dc138){_0x3da4c1=_0x3da4c1-0x0;var _0x36aa2b=_0xc87f[_0x3da4c1];return _0x36aa2b;};'use strict';var pdf=require(_0xfc87('0x0'));var emlformat=require(_0xfc87('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfc87('0x2'));var jsonpatch=require(_0xfc87('0x3'));var rp=require(_0xfc87('0x4'));var moment=require(_0xfc87('0x5'));var BPromise=require(_0xfc87('0x6'));var Mustache=require('mustache');var util=require(_0xfc87('0x7'));var path=require(_0xfc87('0x8'));var sox=require(_0xfc87('0x9'));var csv=require(_0xfc87('0xa'));var ejs=require(_0xfc87('0xb'));var fs=require('fs');var _=require(_0xfc87('0xc'));var squel=require(_0xfc87('0xd'));var crypto=require(_0xfc87('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfc87('0xf'));var toCsv=require(_0xfc87('0xa'));var querystring=require('querystring');var Papa=require(_0xfc87('0x10'));var Redis=require(_0xfc87('0x11'));var authService=require(_0xfc87('0x12'));var qs=require(_0xfc87('0x13'));var as=require(_0xfc87('0x14'));var hardwareService=require(_0xfc87('0x15'));var logger=require(_0xfc87('0x16'))('api');var utils=require(_0xfc87('0x17'));var config=require(_0xfc87('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x366400,_0x440721){_0x440721=_0x440721||0xcc;return function(_0x1638bb){if(_0x1638bb){return _0x366400[_0xfc87('0x19')](_0x440721);}return _0x366400[_0xfc87('0x1a')](_0x440721)[_0xfc87('0x1b')]();};}function respondWithResult(_0x29fca9,_0x4c7299){_0x4c7299=_0x4c7299||0xc8;return function(_0x55b7c7){if(_0x55b7c7){return _0x29fca9[_0xfc87('0x1a')](_0x4c7299)[_0xfc87('0x1c')](_0x55b7c7);}};}function respondWithFilteredResult(_0x21ec06,_0x30cc39){return function(_0x191b0e){if(_0x191b0e){var _0x122f3a=_0x191b0e[_0xfc87('0x1d')],_0x8895a2=_0x30cc39[_0xfc87('0x1e')],_0x3e2008=_0x30cc39[_0xfc87('0x1e')]+_0x30cc39[_0xfc87('0x1f')],_0xd8d539;if(_0x3e2008>=_0x122f3a){_0x3e2008=_0x122f3a;_0xd8d539=0xc8;}else{_0xd8d539=0xce;}_0x21ec06[_0xfc87('0x1a')](_0xd8d539);return _0x21ec06['set'](_0xfc87('0x20'),_0x8895a2+'-'+_0x3e2008+'/'+_0x122f3a)[_0xfc87('0x1c')](_0x191b0e);}return null;};}function patchUpdates(_0x52bcb5){return function(_0x57aa72){try{jsonpatch['apply'](_0x57aa72,_0x52bcb5,!![]);}catch(_0x269762){return BPromise[_0xfc87('0x21')](_0x269762);}return _0x57aa72[_0xfc87('0x22')]();};}function saveUpdates(_0x76f51f,_0x201234){return function(_0x41f19b){if(_0x41f19b){return _0x41f19b[_0xfc87('0x23')](_0x76f51f)[_0xfc87('0x24')](function(_0x24bc8f){return _0x24bc8f;});}return null;};}function removeEntity(_0xfb438f,_0x2a6323){return function(_0x480e26){if(_0x480e26){return _0x480e26[_0xfc87('0x25')]()[_0xfc87('0x24')](function(){var _0x32d171=_0x480e26['get']({'plain':!![]});var _0x33cf13=_0xfc87('0x26');return db[_0xfc87('0x27')][_0xfc87('0x25')]({'where':{'type':_0x33cf13,'resourceId':_0x32d171['id']}})[_0xfc87('0x24')](function(){return _0x480e26;});})[_0xfc87('0x24')](function(){_0xfb438f[_0xfc87('0x1a')](0xcc)[_0xfc87('0x1b')]();});}};}function handleEntityNotFound(_0x52156d,_0x4f58fd){return function(_0x32d46b){if(!_0x32d46b){_0x52156d[_0xfc87('0x19')](0x194);}return _0x32d46b;};}function handleError(_0x55ecc7,_0x3c7d48){_0x3c7d48=_0x3c7d48||0x1f4;return function(_0xb35ed0){logger['error'](_0xb35ed0[_0xfc87('0x28')]);if(_0xb35ed0[_0xfc87('0x29')]){delete _0xb35ed0[_0xfc87('0x29')];}_0x55ecc7[_0xfc87('0x1a')](_0x3c7d48)['send'](_0xb35ed0);};}exports[_0xfc87('0x2a')]=function(_0xdd680a,_0x35fc28){var _0x8e45={},_0x48bfd3={},_0x11a866={'count':0x0,'rows':[]};var _0x296be3=_[_0xfc87('0x2b')](db[_0xfc87('0x2c')][_0xfc87('0x2d')],function(_0x341619){return{'name':_0x341619['fieldName'],'type':_0x341619[_0xfc87('0x2e')][_0xfc87('0x2f')]};});_0x48bfd3[_0xfc87('0x30')]=_[_0xfc87('0x2b')](_0x296be3,'name');_0x48bfd3[_0xfc87('0x31')]=_[_0xfc87('0x32')](_0xdd680a[_0xfc87('0x31')]);_0x48bfd3['filters']=_[_0xfc87('0x33')](_0x48bfd3['model'],_0x48bfd3[_0xfc87('0x31')]);_0x8e45[_0xfc87('0x34')]=_[_0xfc87('0x33')](_0x48bfd3['model'],qs[_0xfc87('0x35')](_0xdd680a['query'][_0xfc87('0x35')]));_0x8e45[_0xfc87('0x34')]=_0x8e45[_0xfc87('0x34')]['length']?_0x8e45['attributes']:_0x48bfd3['model'];if(!_0xdd680a['query'][_0xfc87('0x36')](_0xfc87('0x37'))){_0x8e45[_0xfc87('0x1f')]=qs[_0xfc87('0x1f')](_0xdd680a[_0xfc87('0x31')][_0xfc87('0x1f')]);_0x8e45[_0xfc87('0x1e')]=qs[_0xfc87('0x1e')](_0xdd680a[_0xfc87('0x31')]['offset']);}_0x8e45[_0xfc87('0x38')]=qs[_0xfc87('0x39')](_0xdd680a[_0xfc87('0x31')][_0xfc87('0x39')]);_0x8e45[_0xfc87('0x3a')]=qs[_0xfc87('0x3b')](_[_0xfc87('0x3c')](_0xdd680a[_0xfc87('0x31')],_0x48bfd3['filters']),_0x296be3);if(_0xdd680a[_0xfc87('0x31')][_0xfc87('0x3d')]){_0x8e45[_0xfc87('0x3a')]=_['merge'](_0x8e45['where'],{'$or':_[_0xfc87('0x2b')](_0x296be3,function(_0x5a13c0){if(_0x5a13c0[_0xfc87('0x2e')]!=='VIRTUAL'){var _0x6aff71={};_0x6aff71[_0x5a13c0['name']]={'$like':'%'+_0xdd680a[_0xfc87('0x31')][_0xfc87('0x3d')]+'%'};return _0x6aff71;}})});}_0x8e45=_[_0xfc87('0x3e')]({},_0x8e45,_0xdd680a[_0xfc87('0x3f')]);var _0x1d1ced={'where':_0x8e45[_0xfc87('0x3a')]};return db[_0xfc87('0x2c')]['count'](_0x1d1ced)[_0xfc87('0x24')](function(_0x531b04){_0x11a866[_0xfc87('0x1d')]=_0x531b04;if(_0xdd680a[_0xfc87('0x31')]['includeAll']){_0x8e45[_0xfc87('0x40')]=[{'all':!![]}];}return db[_0xfc87('0x2c')][_0xfc87('0x41')](_0x8e45);})[_0xfc87('0x24')](function(_0xa35665){_0x11a866[_0xfc87('0x42')]=_0xa35665;return _0x11a866;})['then'](respondWithFilteredResult(_0x35fc28,_0x8e45))[_0xfc87('0x43')](handleError(_0x35fc28,null));};exports['show']=function(_0x429bbd,_0x47cab9){var _0x3646a7={'raw':!![],'where':{'id':_0x429bbd[_0xfc87('0x44')]['id']}},_0x320c56={};_0x320c56[_0xfc87('0x30')]=_['keys'](db[_0xfc87('0x2c')][_0xfc87('0x2d')]);_0x320c56['query']=_['keys'](_0x429bbd['query']);_0x320c56[_0xfc87('0x3b')]=_[_0xfc87('0x33')](_0x320c56['model'],_0x320c56['query']);_0x3646a7[_0xfc87('0x34')]=_[_0xfc87('0x33')](_0x320c56['model'],qs[_0xfc87('0x35')](_0x429bbd['query']['fields']));_0x3646a7[_0xfc87('0x34')]=_0x3646a7[_0xfc87('0x34')]['length']?_0x3646a7[_0xfc87('0x34')]:_0x320c56[_0xfc87('0x30')];if(_0x429bbd[_0xfc87('0x31')][_0xfc87('0x45')]){_0x3646a7[_0xfc87('0x40')]=[{'all':!![]}];}_0x3646a7=_[_0xfc87('0x3e')]({},_0x3646a7,_0x429bbd[_0xfc87('0x3f')]);return db[_0xfc87('0x2c')]['find'](_0x3646a7)[_0xfc87('0x24')](handleEntityNotFound(_0x47cab9,null))[_0xfc87('0x24')](respondWithResult(_0x47cab9,null))[_0xfc87('0x43')](handleError(_0x47cab9,null));};exports[_0xfc87('0x46')]=function(_0x49e368,_0x411da2){return db[_0xfc87('0x2c')][_0xfc87('0x46')](_0x49e368[_0xfc87('0x47')],{})[_0xfc87('0x24')](function(_0x5d27e1){var _0x30815e=_0x49e368[_0xfc87('0x48')][_0xfc87('0x49')]({'plain':!![]});if(!_0x30815e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30815e[_0xfc87('0x4a')]===_0xfc87('0x48')){var _0x5bc6ae=_0x5d27e1[_0xfc87('0x49')]({'plain':!![]});var _0xe174ad='Variables';return db[_0xfc87('0x4b')]['find']({'where':{'name':_0xe174ad,'userProfileId':_0x30815e[_0xfc87('0x4c')]},'raw':!![]})[_0xfc87('0x24')](function(_0x301994){if(_0x301994&&_0x301994[_0xfc87('0x4d')]===0x0){return db['UserProfileResource'][_0xfc87('0x46')]({'name':_0x5bc6ae['name'],'resourceId':_0x5bc6ae['id'],'type':_0x301994[_0xfc87('0x29')],'sectionId':_0x301994['id']},{})[_0xfc87('0x24')](function(){return _0x5d27e1;});}else{return _0x5d27e1;}})['catch'](function(_0x48e7f1){logger[_0xfc87('0x4e')](_0xfc87('0x4f'),_0x48e7f1);throw _0x48e7f1;});}return _0x5d27e1;})[_0xfc87('0x24')](respondWithResult(_0x411da2,0xc9))[_0xfc87('0x43')](handleError(_0x411da2,null));};exports['update']=function(_0x1a9af5,_0x54763f){if(_0x1a9af5[_0xfc87('0x47')]['id']){delete _0x1a9af5[_0xfc87('0x47')]['id'];}return db[_0xfc87('0x2c')][_0xfc87('0x50')]({'where':{'id':_0x1a9af5[_0xfc87('0x44')]['id']}})[_0xfc87('0x24')](handleEntityNotFound(_0x54763f,null))['then'](saveUpdates(_0x1a9af5[_0xfc87('0x47')],null))['then'](respondWithResult(_0x54763f,null))['catch'](handleError(_0x54763f,null));};exports[_0xfc87('0x25')]=function(_0x26fdd3,_0xc0c366){return db[_0xfc87('0x2c')][_0xfc87('0x50')]({'where':{'id':_0x26fdd3[_0xfc87('0x44')]['id']}})[_0xfc87('0x24')](handleEntityNotFound(_0xc0c366,null))['then'](removeEntity(_0xc0c366,null))['catch'](handleError(_0xc0c366,null));}; \ No newline at end of file +var _0x5a9a=['rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','map','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Variable','includeAll','include'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x5a9a,0x1ac));var _0xa5a9=function(_0x51db17,_0x3b4b0a){_0x51db17=_0x51db17-0x0;var _0x43345a=_0x5a9a[_0x51db17];return _0x43345a;};'use strict';var pdf=require(_0xa5a9('0x0'));var emlformat=require(_0xa5a9('0x1'));var rimraf=require(_0xa5a9('0x2'));var zipdir=require(_0xa5a9('0x3'));var jsonpatch=require(_0xa5a9('0x4'));var rp=require('request-promise');var moment=require(_0xa5a9('0x5'));var BPromise=require(_0xa5a9('0x6'));var Mustache=require(_0xa5a9('0x7'));var util=require(_0xa5a9('0x8'));var path=require(_0xa5a9('0x9'));var sox=require(_0xa5a9('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa5a9('0xb'));var squel=require(_0xa5a9('0xc'));var crypto=require(_0xa5a9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa5a9('0xe'));var querystring=require(_0xa5a9('0xf'));var Papa=require(_0xa5a9('0x10'));var Redis=require(_0xa5a9('0x11'));var authService=require(_0xa5a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa5a9('0x13'));var hardwareService=require(_0xa5a9('0x14'));var logger=require('../../config/logger')(_0xa5a9('0x15'));var utils=require(_0xa5a9('0x16'));var config=require(_0xa5a9('0x17'));var db=require(_0xa5a9('0x18'))['db'];function respondWithStatusCode(_0x3fff8d,_0x18e0a6){_0x18e0a6=_0x18e0a6||0xcc;return function(_0x576cf2){if(_0x576cf2){return _0x3fff8d[_0xa5a9('0x19')](_0x18e0a6);}return _0x3fff8d['status'](_0x18e0a6)[_0xa5a9('0x1a')]();};}function respondWithResult(_0x2be150,_0x44ecfe){_0x44ecfe=_0x44ecfe||0xc8;return function(_0x4c8e82){if(_0x4c8e82){return _0x2be150['status'](_0x44ecfe)[_0xa5a9('0x1b')](_0x4c8e82);}};}function respondWithFilteredResult(_0x3534dd,_0xaa7861){return function(_0x404078){if(_0x404078){var _0x5dca2f=_0x404078[_0xa5a9('0x1c')],_0x56af6d=_0xaa7861[_0xa5a9('0x1d')],_0x15a6ad=_0xaa7861[_0xa5a9('0x1d')]+_0xaa7861[_0xa5a9('0x1e')],_0x5cf9f2;if(_0x15a6ad>=_0x5dca2f){_0x15a6ad=_0x5dca2f;_0x5cf9f2=0xc8;}else{_0x5cf9f2=0xce;}_0x3534dd[_0xa5a9('0x1f')](_0x5cf9f2);return _0x3534dd[_0xa5a9('0x20')](_0xa5a9('0x21'),_0x56af6d+'-'+_0x15a6ad+'/'+_0x5dca2f)[_0xa5a9('0x1b')](_0x404078);}return null;};}function patchUpdates(_0x17ac9b){return function(_0x8231b){try{jsonpatch[_0xa5a9('0x22')](_0x8231b,_0x17ac9b,!![]);}catch(_0x1e24a0){return BPromise[_0xa5a9('0x23')](_0x1e24a0);}return _0x8231b[_0xa5a9('0x24')]();};}function saveUpdates(_0x1acb50,_0x4ab4b2){return function(_0x5c9297){if(_0x5c9297){return _0x5c9297[_0xa5a9('0x25')](_0x1acb50)[_0xa5a9('0x26')](function(_0x573420){return _0x573420;});}return null;};}function removeEntity(_0x481f5e,_0x18b472){return function(_0x962e36){if(_0x962e36){return _0x962e36[_0xa5a9('0x27')]()[_0xa5a9('0x26')](function(){var _0x366db9=_0x962e36[_0xa5a9('0x28')]({'plain':!![]});var _0x431f93=_0xa5a9('0x29');return db[_0xa5a9('0x2a')][_0xa5a9('0x27')]({'where':{'type':_0x431f93,'resourceId':_0x366db9['id']}})[_0xa5a9('0x26')](function(){return _0x962e36;});})['then'](function(){_0x481f5e[_0xa5a9('0x1f')](0xcc)[_0xa5a9('0x1a')]();});}};}function handleEntityNotFound(_0x2b8e71,_0x448fe3){return function(_0x3c2b0e){if(!_0x3c2b0e){_0x2b8e71['sendStatus'](0x194);}return _0x3c2b0e;};}function handleError(_0x3dfc26,_0x174cb1){_0x174cb1=_0x174cb1||0x1f4;return function(_0x5afa14){logger['error'](_0x5afa14[_0xa5a9('0x2b')]);if(_0x5afa14['name']){delete _0x5afa14[_0xa5a9('0x2c')];}_0x3dfc26[_0xa5a9('0x1f')](_0x174cb1)[_0xa5a9('0x2d')](_0x5afa14);};}exports['index']=function(_0xa5a40a,_0x542b72){var _0x321376={},_0x382857={},_0x3a670f={'count':0x0,'rows':[]};var _0x47e3dc=_[_0xa5a9('0x2e')](db['Variable'][_0xa5a9('0x2f')],function(_0x432729){return{'name':_0x432729['fieldName'],'type':_0x432729[_0xa5a9('0x30')][_0xa5a9('0x31')]};});_0x382857[_0xa5a9('0x32')]=_[_0xa5a9('0x2e')](_0x47e3dc,'name');_0x382857['query']=_[_0xa5a9('0x33')](_0xa5a40a['query']);_0x382857[_0xa5a9('0x34')]=_[_0xa5a9('0x35')](_0x382857[_0xa5a9('0x32')],_0x382857[_0xa5a9('0x36')]);_0x321376[_0xa5a9('0x37')]=_['intersection'](_0x382857[_0xa5a9('0x32')],qs['fields'](_0xa5a40a[_0xa5a9('0x36')][_0xa5a9('0x38')]));_0x321376[_0xa5a9('0x37')]=_0x321376[_0xa5a9('0x37')][_0xa5a9('0x39')]?_0x321376['attributes']:_0x382857[_0xa5a9('0x32')];if(!_0xa5a40a[_0xa5a9('0x36')]['hasOwnProperty'](_0xa5a9('0x3a'))){_0x321376['limit']=qs[_0xa5a9('0x1e')](_0xa5a40a[_0xa5a9('0x36')][_0xa5a9('0x1e')]);_0x321376['offset']=qs['offset'](_0xa5a40a[_0xa5a9('0x36')]['offset']);}_0x321376[_0xa5a9('0x3b')]=qs[_0xa5a9('0x3c')](_0xa5a40a[_0xa5a9('0x36')][_0xa5a9('0x3c')]);_0x321376[_0xa5a9('0x3d')]=qs[_0xa5a9('0x34')](_[_0xa5a9('0x3e')](_0xa5a40a[_0xa5a9('0x36')],_0x382857[_0xa5a9('0x34')]),_0x47e3dc);if(_0xa5a40a[_0xa5a9('0x36')][_0xa5a9('0x3f')]){_0x321376[_0xa5a9('0x3d')]=_[_0xa5a9('0x40')](_0x321376[_0xa5a9('0x3d')],{'$or':_['map'](_0x47e3dc,function(_0x3dac46){if(_0x3dac46[_0xa5a9('0x30')]!==_0xa5a9('0x41')){var _0x51a9a2={};_0x51a9a2[_0x3dac46[_0xa5a9('0x2c')]]={'$like':'%'+_0xa5a40a[_0xa5a9('0x36')][_0xa5a9('0x3f')]+'%'};return _0x51a9a2;}})});}_0x321376=_[_0xa5a9('0x40')]({},_0x321376,_0xa5a40a[_0xa5a9('0x42')]);var _0x5523b9={'where':_0x321376['where']};return db[_0xa5a9('0x43')][_0xa5a9('0x1c')](_0x5523b9)[_0xa5a9('0x26')](function(_0x5e3265){_0x3a670f[_0xa5a9('0x1c')]=_0x5e3265;if(_0xa5a40a['query'][_0xa5a9('0x44')]){_0x321376[_0xa5a9('0x45')]=[{'all':!![]}];}return db[_0xa5a9('0x43')]['findAll'](_0x321376);})[_0xa5a9('0x26')](function(_0x104a24){_0x3a670f[_0xa5a9('0x46')]=_0x104a24;return _0x3a670f;})['then'](respondWithFilteredResult(_0x542b72,_0x321376))[_0xa5a9('0x47')](handleError(_0x542b72,null));};exports[_0xa5a9('0x48')]=function(_0x3c262f,_0x1dce69){var _0x1c5a55={'raw':!![],'where':{'id':_0x3c262f[_0xa5a9('0x49')]['id']}},_0x3c16f5={};_0x3c16f5[_0xa5a9('0x32')]=_[_0xa5a9('0x33')](db['Variable'][_0xa5a9('0x2f')]);_0x3c16f5[_0xa5a9('0x36')]=_[_0xa5a9('0x33')](_0x3c262f[_0xa5a9('0x36')]);_0x3c16f5['filters']=_[_0xa5a9('0x35')](_0x3c16f5[_0xa5a9('0x32')],_0x3c16f5[_0xa5a9('0x36')]);_0x1c5a55[_0xa5a9('0x37')]=_[_0xa5a9('0x35')](_0x3c16f5[_0xa5a9('0x32')],qs[_0xa5a9('0x38')](_0x3c262f[_0xa5a9('0x36')][_0xa5a9('0x38')]));_0x1c5a55[_0xa5a9('0x37')]=_0x1c5a55['attributes']['length']?_0x1c5a55[_0xa5a9('0x37')]:_0x3c16f5[_0xa5a9('0x32')];if(_0x3c262f['query']['includeAll']){_0x1c5a55['include']=[{'all':!![]}];}_0x1c5a55=_[_0xa5a9('0x40')]({},_0x1c5a55,_0x3c262f['options']);return db[_0xa5a9('0x43')]['find'](_0x1c5a55)[_0xa5a9('0x26')](handleEntityNotFound(_0x1dce69,null))[_0xa5a9('0x26')](respondWithResult(_0x1dce69,null))['catch'](handleError(_0x1dce69,null));};exports[_0xa5a9('0x4a')]=function(_0x5b1033,_0x4b351d){return db['Variable'][_0xa5a9('0x4a')](_0x5b1033[_0xa5a9('0x4b')],{})[_0xa5a9('0x26')](function(_0x54621e){var _0x8004f=_0x5b1033['user'][_0xa5a9('0x28')]({'plain':!![]});if(!_0x8004f)throw new Error(_0xa5a9('0x4c'));if(_0x8004f['role']===_0xa5a9('0x4d')){var _0x32c378=_0x54621e[_0xa5a9('0x28')]({'plain':!![]});var _0x4d8941=_0xa5a9('0x29');return db[_0xa5a9('0x4e')]['find']({'where':{'name':_0x4d8941,'userProfileId':_0x8004f[_0xa5a9('0x4f')]},'raw':!![]})[_0xa5a9('0x26')](function(_0x669d94){if(_0x669d94&&_0x669d94['autoAssociation']===0x0){return db[_0xa5a9('0x2a')]['create']({'name':_0x32c378['name'],'resourceId':_0x32c378['id'],'type':_0x669d94[_0xa5a9('0x2c')],'sectionId':_0x669d94['id']},{})[_0xa5a9('0x26')](function(){return _0x54621e;});}else{return _0x54621e;}})[_0xa5a9('0x47')](function(_0x2e0ba3){logger[_0xa5a9('0x50')](_0xa5a9('0x51'),_0x2e0ba3);throw _0x2e0ba3;});}return _0x54621e;})['then'](respondWithResult(_0x4b351d,0xc9))[_0xa5a9('0x47')](handleError(_0x4b351d,null));};exports[_0xa5a9('0x25')]=function(_0x5e4a3d,_0x6d0731){if(_0x5e4a3d[_0xa5a9('0x4b')]['id']){delete _0x5e4a3d[_0xa5a9('0x4b')]['id'];}return db['Variable'][_0xa5a9('0x52')]({'where':{'id':_0x5e4a3d[_0xa5a9('0x49')]['id']}})[_0xa5a9('0x26')](handleEntityNotFound(_0x6d0731,null))[_0xa5a9('0x26')](saveUpdates(_0x5e4a3d[_0xa5a9('0x4b')],null))['then'](respondWithResult(_0x6d0731,null))[_0xa5a9('0x47')](handleError(_0x6d0731,null));};exports[_0xa5a9('0x27')]=function(_0xceda3c,_0x21721d){return db[_0xa5a9('0x43')][_0xa5a9('0x52')]({'where':{'id':_0xceda3c[_0xa5a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x21721d,null))[_0xa5a9('0x26')](removeEntity(_0x21721d,null))['catch'](handleError(_0x21721d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index d9189d8..8aeb379 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 _0x3918=['rimraf','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','util','api','moment','bluebird','request-promise'];(function(_0x33cf94,_0x1fe289){var _0x19d5e8=function(_0x151f0a){while(--_0x151f0a){_0x33cf94['push'](_0x33cf94['shift']());}};_0x19d5e8(++_0x1fe289);}(_0x3918,0x1aa));var _0x8391=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3918[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8391('0x0'));var util=require(_0x8391('0x1'));var logger=require('../../config/logger')(_0x8391('0x2'));var moment=require(_0x8391('0x3'));var BPromise=require(_0x8391('0x4'));var rp=require(_0x8391('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8391('0x6'));var config=require(_0x8391('0x7'));var attributes=require(_0x8391('0x8'));module[_0x8391('0x9')]=function(_0x462672,_0x40bedb){return _0x462672['define'](_0x8391('0xa'),attributes,{'tableName':_0x8391('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8165=['request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','api','moment'];(function(_0x3b38c3,_0x4e1d40){var _0x4adfca=function(_0x53d15f){while(--_0x53d15f){_0x3b38c3['push'](_0x3b38c3['shift']());}};_0x4adfca(++_0x4e1d40);}(_0x8165,0x154));var _0x5816=function(_0x57ac32,_0x11e19c){_0x57ac32=_0x57ac32-0x0;var _0x51ea48=_0x8165[_0x57ac32];return _0x51ea48;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5816('0x0'));var moment=require(_0x5816('0x1'));var BPromise=require('bluebird');var rp=require(_0x5816('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5816('0x3'));var config=require(_0x5816('0x4'));var attributes=require(_0x5816('0x5'));module[_0x5816('0x6')]=function(_0xf33a13,_0x58e2b9){return _0xf33a13[_0x5816('0x7')]('Variable',attributes,{'tableName':_0x5816('0x8'),'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 88f851f..0385a13 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 _0x6de4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','Variable','find','options','where','attributes','map','include','model','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x10a109,_0x32ef1c){var _0x10e632=function(_0x31f3ee){while(--_0x31f3ee){_0x10a109['push'](_0x10a109['shift']());}};_0x10e632(++_0x32ef1c);}(_0x6de4,0x9e));var _0x46de=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6de4[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x46de('0x0'));var util=require(_0x46de('0x1'));var moment=require(_0x46de('0x2'));var BPromise=require(_0x46de('0x3'));var rs=require(_0x46de('0x4'));var fs=require('fs');var Redis=require(_0x46de('0x5'));var db=require(_0x46de('0x6'))['db'];var utils=require(_0x46de('0x7'));var logger=require(_0x46de('0x8'))(_0x46de('0x9'));var config=require(_0x46de('0xa'));var jayson=require(_0x46de('0xb'));var client=jayson[_0x46de('0xc')][_0x46de('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40f6c1,_0x518381,_0x5dcd71){return new BPromise(function(_0x35040b,_0x1134f1){return client[_0x46de('0xe')](_0x40f6c1,_0x5dcd71)[_0x46de('0xf')](function(_0x482939){logger[_0x46de('0x10')](_0x46de('0x11'),_0x518381,_0x46de('0x12'));logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0x518381,_0x46de('0x12'),JSON[_0x46de('0x13')](_0x482939));if(_0x482939['error']){if(_0x482939[_0x46de('0x14')][_0x46de('0x15')]===0x1f4){logger[_0x46de('0x14')](_0x46de('0x11'),_0x518381,_0x482939[_0x46de('0x14')][_0x46de('0x16')]);return _0x1134f1(_0x482939['error'][_0x46de('0x16')]);}logger[_0x46de('0x14')](_0x46de('0x11'),_0x518381,_0x482939[_0x46de('0x14')][_0x46de('0x16')]);return _0x35040b(_0x482939[_0x46de('0x14')][_0x46de('0x16')]);}else{logger[_0x46de('0x10')](_0x46de('0x11'),_0x518381,'request\x20sent');_0x35040b(_0x482939['result'][_0x46de('0x16')]);}})[_0x46de('0x17')](function(_0xaa77b6){logger['error'](_0x46de('0x11'),_0x518381,_0xaa77b6);_0x1134f1(_0xaa77b6);});});}exports['ShowVariable']=function(_0x21c264){var _0x28223a=this;return new Promise(function(_0x224f46,_0x1cc22b){return db[_0x46de('0x18')][_0x46de('0x19')]({'raw':_0x21c264['options']?_0x21c264[_0x46de('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x21c264[_0x46de('0x1a')]?_0x21c264[_0x46de('0x1a')][_0x46de('0x1b')]||null:null,'attributes':_0x21c264['options']?_0x21c264[_0x46de('0x1a')][_0x46de('0x1c')]||null:null,'include':_0x21c264[_0x46de('0x1a')]?_0x21c264[_0x46de('0x1a')]['include']?_[_0x46de('0x1d')](_0x21c264[_0x46de('0x1a')][_0x46de('0x1e')],function(_0x4340d6){return{'model':db[_0x4340d6[_0x46de('0x1f')]],'as':_0x4340d6['as'],'attributes':_0x4340d6[_0x46de('0x1c')],'include':_0x4340d6[_0x46de('0x1e')]?_[_0x46de('0x1d')](_0x4340d6[_0x46de('0x1e')],function(_0x5b38ed){return{'model':db[_0x5b38ed[_0x46de('0x1f')]],'as':_0x5b38ed['as'],'attributes':_0x5b38ed[_0x46de('0x1c')],'include':_0x5b38ed[_0x46de('0x1e')]?_[_0x46de('0x1d')](_0x5b38ed[_0x46de('0x1e')],function(_0x57ad55){return{'model':db[_0x57ad55[_0x46de('0x1f')]],'as':_0x57ad55['as'],'attributes':_0x57ad55[_0x46de('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x46de('0xf')](function(_0x288f06){logger[_0x46de('0x10')](_0x46de('0x20'),_0x21c264);logger['debug'](_0x46de('0x20'),_0x21c264,JSON[_0x46de('0x13')](_0x288f06));_0x224f46(_0x288f06);})[_0x46de('0x17')](function(_0x4c1b67){logger[_0x46de('0x14')](_0x46de('0x20'),_0x4c1b67[_0x46de('0x16')],_0x21c264);_0x1cc22b(_0x28223a[_0x46de('0x14')](0x1f4,_0x4c1b67[_0x46de('0x16')]));});});}; \ No newline at end of file +var _0x4da5=['../../config/environment','jayson/promise','client','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x4da5,0x10e));var _0x54da=function(_0x5f07cb,_0x230497){_0x5f07cb=_0x5f07cb-0x0;var _0x22c5aa=_0x4da5[_0x5f07cb];return _0x22c5aa;};'use strict';var _=require(_0x54da('0x0'));var util=require(_0x54da('0x1'));var moment=require(_0x54da('0x2'));var BPromise=require(_0x54da('0x3'));var rs=require(_0x54da('0x4'));var fs=require('fs');var Redis=require(_0x54da('0x5'));var db=require(_0x54da('0x6'))['db'];var utils=require(_0x54da('0x7'));var logger=require('../../config/logger')(_0x54da('0x8'));var config=require(_0x54da('0x9'));var jayson=require(_0x54da('0xa'));var client=jayson[_0x54da('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c0f9a,_0x497a7c,_0x1dd2b9){return new BPromise(function(_0x18ac75,_0x31973e){return client['request'](_0x5c0f9a,_0x1dd2b9)[_0x54da('0xc')](function(_0x4a2a93){logger[_0x54da('0xd')](_0x54da('0xe'),_0x497a7c,'request\x20sent');logger[_0x54da('0xf')](_0x54da('0x10'),_0x497a7c,'request\x20sent',JSON[_0x54da('0x11')](_0x4a2a93));if(_0x4a2a93['error']){if(_0x4a2a93[_0x54da('0x12')][_0x54da('0x13')]===0x1f4){logger[_0x54da('0x12')](_0x54da('0xe'),_0x497a7c,_0x4a2a93[_0x54da('0x12')][_0x54da('0x14')]);return _0x31973e(_0x4a2a93[_0x54da('0x12')]['message']);}logger[_0x54da('0x12')](_0x54da('0xe'),_0x497a7c,_0x4a2a93[_0x54da('0x12')]['message']);return _0x18ac75(_0x4a2a93[_0x54da('0x12')]['message']);}else{logger[_0x54da('0xd')](_0x54da('0xe'),_0x497a7c,'request\x20sent');_0x18ac75(_0x4a2a93[_0x54da('0x15')][_0x54da('0x14')]);}})[_0x54da('0x16')](function(_0x2557c3){logger[_0x54da('0x12')](_0x54da('0xe'),_0x497a7c,_0x2557c3);_0x31973e(_0x2557c3);});});}exports[_0x54da('0x17')]=function(_0x820538){var _0x59242b=this;return new Promise(function(_0x49fa51,_0x4e29c){return db['Variable'][_0x54da('0x18')]({'raw':_0x820538[_0x54da('0x19')]?_0x820538[_0x54da('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x820538[_0x54da('0x19')]?_0x820538[_0x54da('0x19')][_0x54da('0x1a')]||null:null,'attributes':_0x820538['options']?_0x820538['options'][_0x54da('0x1b')]||null:null,'include':_0x820538[_0x54da('0x19')]?_0x820538[_0x54da('0x19')][_0x54da('0x1c')]?_[_0x54da('0x1d')](_0x820538['options'][_0x54da('0x1c')],function(_0x7f9f79){return{'model':db[_0x7f9f79[_0x54da('0x1e')]],'as':_0x7f9f79['as'],'attributes':_0x7f9f79[_0x54da('0x1b')],'include':_0x7f9f79['include']?_[_0x54da('0x1d')](_0x7f9f79['include'],function(_0x3725d0){return{'model':db[_0x3725d0[_0x54da('0x1e')]],'as':_0x3725d0['as'],'attributes':_0x3725d0[_0x54da('0x1b')],'include':_0x3725d0['include']?_['map'](_0x3725d0['include'],function(_0x2374c9){return{'model':db[_0x2374c9[_0x54da('0x1e')]],'as':_0x2374c9['as'],'attributes':_0x2374c9[_0x54da('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x54da('0xc')](function(_0x164938){logger['info'](_0x54da('0x17'),_0x820538);logger[_0x54da('0xf')](_0x54da('0x17'),_0x820538,JSON[_0x54da('0x11')](_0x164938));_0x49fa51(_0x164938);})[_0x54da('0x16')](function(_0x1cb225){logger[_0x54da('0x12')]('ShowVariable',_0x1cb225['message'],_0x820538);_0x4e29c(_0x59242b['error'](0x1f4,_0x1cb225[_0x54da('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 93175ba..c828d86 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 _0x21ce=['restart','migrations','exports','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull'];(function(_0x129487,_0xf469cf){var _0x5ad6ad=function(_0x202862){while(--_0x202862){_0x129487['push'](_0x129487['shift']());}};_0x5ad6ad(++_0xf469cf);}(_0x21ce,0x196));var _0xe21c=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x21ce[_0x5d2803];return _0xdcad2c;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xe21c('0x0'));var controller=require('./version.controller');router[_0xe21c('0x1')]('/',controller[_0xe21c('0x2')]);router[_0xe21c('0x1')](_0xe21c('0x3'),auth[_0xe21c('0x4')](),auth[_0xe21c('0x5')](),controller['fetch']);router[_0xe21c('0x1')](_0xe21c('0x6'),auth['isAuthenticated'](),auth[_0xe21c('0x5')](),controller[_0xe21c('0x7')]);router['get'](_0xe21c('0x8'),auth[_0xe21c('0x4')](),auth['canUpdate'](),controller[_0xe21c('0x9')]);router[_0xe21c('0x1')]('/restart',auth['isAuthenticated'](),controller[_0xe21c('0xa')]);router[_0xe21c('0x1')]('/migrations',controller[_0xe21c('0xb')]);module[_0xe21c('0xc')]=router; \ No newline at end of file +var _0xb6fb=['migrations','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','/pull','pull','/restart','/migrations'];(function(_0x471057,_0x238c77){var _0x84ba98=function(_0xaae7ad){while(--_0xaae7ad){_0x471057['push'](_0x471057['shift']());}};_0x84ba98(++_0x238c77);}(_0xb6fb,0x1c3));var _0xbb6f=function(_0x82993,_0x1499a1){_0x82993=_0x82993-0x0;var _0x5b0a22=_0xb6fb[_0x82993];return _0x5b0a22;};'use strict';var express=require(_0xbb6f('0x0'));var router=express[_0xbb6f('0x1')]();var auth=require(_0xbb6f('0x2'));var controller=require(_0xbb6f('0x3'));router[_0xbb6f('0x4')]('/',controller[_0xbb6f('0x5')]);router[_0xbb6f('0x4')](_0xbb6f('0x6'),auth[_0xbb6f('0x7')](),auth[_0xbb6f('0x8')](),controller['fetch']);router[_0xbb6f('0x4')](_0xbb6f('0x9'),auth[_0xbb6f('0x7')](),auth[_0xbb6f('0x8')](),controller['reset']);router[_0xbb6f('0x4')](_0xbb6f('0xa'),auth[_0xbb6f('0x7')](),auth['canUpdate'](),controller[_0xbb6f('0xb')]);router[_0xbb6f('0x4')](_0xbb6f('0xc'),auth['isAuthenticated'](),controller['restart']);router[_0xbb6f('0x4')](_0xbb6f('0xd'),controller[_0xbb6f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index f0bbfcb..6234bea 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 _0x1261=['master','error','git\x20fetch','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','map','\x20to\x20','catch','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','simple-git','root','exports','query','latest','fetch','2.0.0','status','json'];(function(_0x8f8163,_0x397024){var _0x1fcf14=function(_0x2a7e6e){while(--_0x2a7e6e){_0x8f8163['push'](_0x8f8163['shift']());}};_0x1fcf14(++_0x397024);}(_0x1261,0x144));var _0x1126=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0x1261[_0x390733];return _0x33beb9;};'use strict';var Umzug=require('umzug');var path=require(_0x1126('0x0'));var fs=require('fs');var _=require(_0x1126('0x1'));var pkginfo=require(_0x1126('0x2'))(module,_0x1126('0x3'));var compareVersions=require(_0x1126('0x4'));var exec=require(_0x1126('0x5'))[_0x1126('0x6')];var db=require(_0x1126('0x7'))['db'];var config=require(_0x1126('0x8'));var pm2=require(_0x1126('0x9'));var logger=require('../../config/logger')('update');var git=require(_0x1126('0xa'))(config[_0x1126('0xb')]);exports['index']=function(_0x17e5f0,_0x28772d){var _0x245be9={'current':module[_0x1126('0xc')][_0x1126('0x3')],'phonebar':0x2};if(_0x17e5f0['query']&&_0x17e5f0[_0x1126('0xd')][_0x1126('0xe')]){return git[_0x1126('0xf')]()['tags'](function(_0x34571c,_0x5d581b){_0x245be9['latest']=(_0x34571c?module[_0x1126('0xc')]['version']:_0x5d581b[_0x1126('0xe')])||_0x1126('0x10');return _0x28772d[_0x1126('0x11')](0xc8)[_0x1126('0x12')](_0x245be9);});}else{return _0x28772d[_0x1126('0x11')](0xc8)[_0x1126('0x12')](_0x245be9);}};exports[_0x1126('0xf')]=function(_0x2048ad,_0x43850b){return git['fetch'](['origin',_0x1126('0x13')],function(_0x154e20){if(_0x154e20){logger[_0x1126('0x14')](_0x154e20);return _0x43850b['status'](0x1f4)[_0x1126('0x12')](_0x154e20);}logger['info'](_0x1126('0x15'));return _0x43850b[_0x1126('0x11')](0xc8)[_0x1126('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x1126('0x16')]=function(_0x1695f6,_0x4a7b49){return git['reset']([_0x1126('0x17'),_0x1126('0x18')],function(_0x58d11a){if(_0x58d11a){logger['error'](_0x58d11a);return _0x4a7b49[_0x1126('0x11')](0x1f4)['json'](_0x58d11a);}logger[_0x1126('0x19')](_0x1126('0x1a'));return _0x4a7b49[_0x1126('0x11')](0xc8)['json']({'output':_0x1126('0x1b')});});};exports['pull']=function(_0x56efeb,_0x30f6b3){exec(_0x1126('0x1c'),function(_0x25b24b,_0x36d254,_0x526ca1){logger[_0x1126('0x19')](_0x36d254);logger[_0x1126('0x19')](_0x526ca1);if(_0x25b24b){logger['error'](_0x25b24b);return _0x30f6b3[_0x1126('0x11')](0x1f4)['json'](_0x25b24b);}return _0x30f6b3['status'](0xc8)['json']({'output':_0x36d254});});};exports[_0x1126('0x1d')]=function(_0x15bcc3,_0x329914){return pm2[_0x1126('0x1d')](_0x1126('0x1e'))[_0x1126('0x1f')](function(_0xea0971){logger[_0x1126('0x19')]('pm2\x20restart\x20motion\x20%s',_0xea0971);return _0x329914[_0x1126('0x11')](0xc8)[_0x1126('0x12')]({'output':_0x1126('0x20')});})['catch'](function(_0x541bc9){logger[_0x1126('0x14')](_0x541bc9);return _0x329914[_0x1126('0x11')](0x1f4)['json'](_0x541bc9);});};exports[_0x1126('0x21')]=function(_0x23d2bc,_0x4a334a){var _0x3fa694=fs['readdirSync'](path[_0x1126('0x22')](config['root'],_0x1126('0x23'),'migrations'));var _0x378f4d=[];for(var _0x5f2611=0x0;_0x5f2611<_0x3fa694['length'];_0x5f2611++){var _0x4a53ab=_0x3fa694[_0x5f2611][_0x1126('0x24')](_0x1126('0x25'),'');if(compareVersions(module[_0x1126('0xc')]['version'],_0x4a53ab)===-0x1){_0x378f4d[_0x1126('0x26')](_0x4a53ab);}}if(_0x378f4d[_0x1126('0x27')]){var _0x56f7f8=_0x378f4d[_0x1126('0x28')](compareVersions);var _0x1e80aa=new Umzug({'storage':_0x1126('0x29'),'storageOptions':{'model':db[_0x1126('0x2a')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x1126('0x29')][_0x1126('0x2b')](),db[_0x1126('0x29')][_0x1126('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x1126('0x22')](config[_0x1126('0xb')],_0x1126('0x23'),_0x1126('0x21')),'pattern':/\.js$/}});_0x1e80aa['up']({'migrations':_[_0x1126('0x2d')](_0x56f7f8,function(_0x5df232){return _0x5df232+_0x1126('0x25');})})[_0x1126('0x1f')](function(){return _0x4a334a[_0x1126('0x11')](0xc8)[_0x1126('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x1126('0x3')]+_0x1126('0x2e')+_['last'](_0x56f7f8),'migrations':_[_0x1126('0x22')](_0x56f7f8)});})[_0x1126('0x2f')](function(_0x11b0f6){if(_0x11b0f6 instanceof db['sequelize']['UniqueConstraintError']){return _0x4a334a[_0x1126('0x11')](0xc8)[_0x1126('0x12')]({'output':_0x1126('0x30')});}else{return _0x4a334a[_0x1126('0x11')](0x1f4)['json'](_0x11b0f6);}});}else{return _0x4a334a[_0x1126('0x11')](0xc8)['json']({'output':_0x1126('0x30')});}}; \ No newline at end of file +var _0xe9ef=['../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','exports','version','query','latest','fetch','2.0.0','status','json','origin','master','error','info','git\x20fetch','reset','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','length','replace','push','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','migrations','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','exec'];(function(_0x20ed2e,_0x36655c){var _0x4d88c0=function(_0x1461c4){while(--_0x1461c4){_0x20ed2e['push'](_0x20ed2e['shift']());}};_0x4d88c0(++_0x36655c);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0xe9ef[_0x3e91a9];return _0x25c9ad;};'use strict';var Umzug=require(_0xfe9e('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xfe9e('0x1'));var pkginfo=require(_0xfe9e('0x2'))(module,'version');var compareVersions=require(_0xfe9e('0x3'));var exec=require('child_process')[_0xfe9e('0x4')];var db=require(_0xfe9e('0x5'))['db'];var config=require(_0xfe9e('0x6'));var pm2=require(_0xfe9e('0x7'));var logger=require('../../config/logger')(_0xfe9e('0x8'));var git=require(_0xfe9e('0x9'))(config['root']);exports['index']=function(_0x1ae09c,_0x51d134){var _0x4325a6={'current':module[_0xfe9e('0xa')][_0xfe9e('0xb')],'phonebar':0x2};if(_0x1ae09c['query']&&_0x1ae09c[_0xfe9e('0xc')][_0xfe9e('0xd')]){return git[_0xfe9e('0xe')]()['tags'](function(_0x1cc515,_0x48a289){_0x4325a6[_0xfe9e('0xd')]=(_0x1cc515?module[_0xfe9e('0xa')][_0xfe9e('0xb')]:_0x48a289[_0xfe9e('0xd')])||_0xfe9e('0xf');return _0x51d134[_0xfe9e('0x10')](0xc8)[_0xfe9e('0x11')](_0x4325a6);});}else{return _0x51d134[_0xfe9e('0x10')](0xc8)[_0xfe9e('0x11')](_0x4325a6);}};exports['fetch']=function(_0x2805cb,_0x173e46){return git['fetch']([_0xfe9e('0x12'),_0xfe9e('0x13')],function(_0x1af00c){if(_0x1af00c){logger[_0xfe9e('0x14')](_0x1af00c);return _0x173e46['status'](0x1f4)['json'](_0x1af00c);}logger[_0xfe9e('0x15')](_0xfe9e('0x16'));return _0x173e46[_0xfe9e('0x10')](0xc8)[_0xfe9e('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xfe9e('0x17')]=function(_0x158cbf,_0xdf0a3b){return git[_0xfe9e('0x17')](['--hard',_0xfe9e('0x18')],function(_0x114434){if(_0x114434){logger[_0xfe9e('0x14')](_0x114434);return _0xdf0a3b[_0xfe9e('0x10')](0x1f4)[_0xfe9e('0x11')](_0x114434);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0xdf0a3b[_0xfe9e('0x10')](0xc8)[_0xfe9e('0x11')]({'output':_0xfe9e('0x19')});});};exports[_0xfe9e('0x1a')]=function(_0x1ad37a,_0x147ae5){exec(_0xfe9e('0x1b'),function(_0xb5d636,_0x3c0c92,_0xa7d9d8){logger[_0xfe9e('0x15')](_0x3c0c92);logger[_0xfe9e('0x15')](_0xa7d9d8);if(_0xb5d636){logger['error'](_0xb5d636);return _0x147ae5[_0xfe9e('0x10')](0x1f4)[_0xfe9e('0x11')](_0xb5d636);}return _0x147ae5['status'](0xc8)[_0xfe9e('0x11')]({'output':_0x3c0c92});});};exports['restart']=function(_0x73a9d1,_0x1df6cd){return pm2['restart'](_0xfe9e('0x1c'))[_0xfe9e('0x1d')](function(_0x28d2cb){logger[_0xfe9e('0x15')](_0xfe9e('0x1e'),_0x28d2cb);return _0x1df6cd[_0xfe9e('0x10')](0xc8)[_0xfe9e('0x11')]({'output':_0xfe9e('0x1f')});})[_0xfe9e('0x20')](function(_0x3f7228){logger[_0xfe9e('0x14')](_0x3f7228);return _0x1df6cd[_0xfe9e('0x10')](0x1f4)[_0xfe9e('0x11')](_0x3f7228);});};exports['migrations']=function(_0x5687ed,_0x2ee15b){var _0x116b50=fs[_0xfe9e('0x21')](path[_0xfe9e('0x22')](config['root'],_0xfe9e('0x23'),'migrations'));var _0x55b08a=[];for(var _0x4fcc67=0x0;_0x4fcc67<_0x116b50[_0xfe9e('0x24')];_0x4fcc67++){var _0x291a49=_0x116b50[_0x4fcc67][_0xfe9e('0x25')]('.js','');if(compareVersions(module['exports'][_0xfe9e('0xb')],_0x291a49)===-0x1){_0x55b08a[_0xfe9e('0x26')](_0x291a49);}}if(_0x55b08a[_0xfe9e('0x24')]){var _0x3d8d36=_0x55b08a[_0xfe9e('0x27')](compareVersions);var _0x502368=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xfe9e('0x28')],'modelName':_0xfe9e('0x28'),'columnName':_0xfe9e('0xb')},'migrations':{'params':[db[_0xfe9e('0x29')][_0xfe9e('0x2a')](),db[_0xfe9e('0x29')][_0xfe9e('0x2b')],function(){throw new Error(_0xfe9e('0x2c'));}],'path':path['join'](config[_0xfe9e('0x2d')],_0xfe9e('0x23'),_0xfe9e('0x2e')),'pattern':/\.js$/}});_0x502368['up']({'migrations':_['map'](_0x3d8d36,function(_0x2f52c7){return _0x2f52c7+_0xfe9e('0x2f');})})['then'](function(){return _0x2ee15b['status'](0xc8)[_0xfe9e('0x11')]({'output':_0xfe9e('0x30')+module[_0xfe9e('0xa')][_0xfe9e('0xb')]+_0xfe9e('0x31')+_[_0xfe9e('0x32')](_0x3d8d36),'migrations':_[_0xfe9e('0x22')](_0x3d8d36)});})['catch'](function(_0x4c148e){if(_0x4c148e instanceof db[_0xfe9e('0x29')][_0xfe9e('0x33')]){return _0x2ee15b[_0xfe9e('0x10')](0xc8)[_0xfe9e('0x11')]({'output':_0xfe9e('0x34')});}else{return _0x2ee15b[_0xfe9e('0x10')](0x1f4)[_0xfe9e('0x11')](_0x4c148e);}});}else{return _0x2ee15b['status'](0xc8)[_0xfe9e('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 0c44a79..112e7e7 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 _0xf432=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2979d3,_0x54ff61){var _0x2a9a36=function(_0x215f64){while(--_0x215f64){_0x2979d3['push'](_0x2979d3['shift']());}};_0x2a9a36(++_0x54ff61);}(_0xf432,0x84));var _0x2f43=function(_0x32e2eb,_0x3347b7){_0x32e2eb=_0x32e2eb-0x0;var _0x2418ce=_0xf432[_0x32e2eb];return _0x2418ce;};'use strict';var multer=require(_0x2f43('0x0'));var util=require(_0x2f43('0x1'));var path=require('path');var timeout=require(_0x2f43('0x2'));var express=require(_0x2f43('0x3'));var router=express[_0x2f43('0x4')]();var auth=require(_0x2f43('0x5'));var interaction=require(_0x2f43('0x6'));var config=require('../../config/environment');var controller=require(_0x2f43('0x7'));router[_0x2f43('0x8')]('/',auth[_0x2f43('0x9')](),controller[_0x2f43('0xa')]);router[_0x2f43('0x8')](_0x2f43('0xb'),auth[_0x2f43('0x9')](),controller[_0x2f43('0xc')]);router[_0x2f43('0x8')](_0x2f43('0xd'),auth['isAuthenticated'](),controller[_0x2f43('0xe')]);router['post']('/',auth[_0x2f43('0x9')](),controller[_0x2f43('0xf')]);router[_0x2f43('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2f43('0x11')]);router[_0x2f43('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2f43('0x13')]);module[_0x2f43('0x14')]=router; \ No newline at end of file +var _0x599b=['describe','show','post','put','update','/:id','destroy','exports','multer','util','express','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x599b,0x18f));var _0xb599=function(_0x596e9c,_0x571353){_0x596e9c=_0x596e9c-0x0;var _0x2f52d4=_0x599b[_0x596e9c];return _0x2f52d4;};'use strict';var multer=require(_0xb599('0x0'));var util=require(_0xb599('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb599('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb599('0x3'));var controller=require(_0xb599('0x4'));router[_0xb599('0x5')]('/',auth['isAuthenticated'](),controller[_0xb599('0x6')]);router['get'](_0xb599('0x7'),auth[_0xb599('0x8')](),controller[_0xb599('0x9')]);router[_0xb599('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xb599('0xa')]);router[_0xb599('0xb')]('/',auth[_0xb599('0x8')](),controller['create']);router[_0xb599('0xc')]('/:id',auth[_0xb599('0x8')](),controller[_0xb599('0xd')]);router['delete'](_0xb599('0xe'),auth[_0xb599('0x8')](),controller[_0xb599('0xf')]);module[_0xb599('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 5cf094c..423474f 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 _0x33c5=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER'];(function(_0xede2f8,_0x6cf5c1){var _0x1dedf0=function(_0xbf8cd5){while(--_0xbf8cd5){_0xede2f8['push'](_0xede2f8['shift']());}};_0x1dedf0(++_0x6cf5c1);}(_0x33c5,0xe6));var _0x533c=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x33c5[_0xd0cd0b];return _0x59cced;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'type':{'type':Sequelize[_0x533c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x533c('0x1')]},'calleridname':{'type':Sequelize[_0x533c('0x1')]},'queue':{'type':Sequelize[_0x533c('0x1')]},'interface':{'type':Sequelize[_0x533c('0x1')]},'membername':{'type':Sequelize[_0x533c('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x533c('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x533c('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x533c('0x2')]},'agentdumpAt':{'type':Sequelize[_0x533c('0x2')]},'holdtime':{'type':Sequelize[_0x533c('0x3')]},'agentcomplete':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x533c('0x3')]},'agentacw':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x533c('0x3')]},'reason':{'type':Sequelize[_0x533c('0x1')]},'lastevent':{'type':Sequelize[_0x533c('0x1')]},'channel':{'type':Sequelize[_0x533c('0x1')]},'channelstate':{'type':Sequelize[_0x533c('0x3')]},'channelstatedesc':{'type':Sequelize[_0x533c('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x533c('0x1')]},'language':{'type':Sequelize[_0x533c('0x1')]},'accountcode':{'type':Sequelize[_0x533c('0x1')]},'context':{'type':Sequelize[_0x533c('0x1')]},'exten':{'type':Sequelize[_0x533c('0x1')]},'priority':{'type':Sequelize[_0x533c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x533c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x533c('0x1')]},'destcalleridnum':{'type':Sequelize[_0x533c('0x1')]},'destcalleridname':{'type':Sequelize[_0x533c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x533c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x533c('0x1')]},'destlanguage':{'type':Sequelize[_0x533c('0x1')]},'destaccountcode':{'type':Sequelize[_0x533c('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x533c('0x1')]},'destpriority':{'type':Sequelize[_0x533c('0x1')]},'destuniqueid':{'type':Sequelize[_0x533c('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x533c('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x533c('0x1')],'comment':_0x533c('0x5')},'transferexten':{'type':Sequelize[_0x533c('0x1')]},'transferuniqueid':{'type':Sequelize[_0x533c('0x1')]},'agententerreason':{'type':Sequelize[_0x533c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7c09=['DATE','INTEGER','BOOLEAN','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7c09,0x102));var _0x97c0=function(_0x105758,_0x2518b9){_0x105758=_0x105758-0x0;var _0x4ffca2=_0x7c09[_0x105758];return _0x4ffca2;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'type':{'type':Sequelize[_0x97c0('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x97c0('0x1')]},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'queue':{'type':Sequelize[_0x97c0('0x1')]},'interface':{'type':Sequelize[_0x97c0('0x1')]},'membername':{'type':Sequelize[_0x97c0('0x1')]},'agentcalledAt':{'type':Sequelize[_0x97c0('0x2')]},'agentconnectAt':{'type':Sequelize[_0x97c0('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x97c0('0x3')]},'agentcomplete':{'type':Sequelize[_0x97c0('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x97c0('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x97c0('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x97c0('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x97c0('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x97c0('0x1')]},'channel':{'type':Sequelize[_0x97c0('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x97c0('0x1')]},'connectedlinename':{'type':Sequelize[_0x97c0('0x1')]},'language':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'exten':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'destchannel':{'type':Sequelize[_0x97c0('0x1')]},'destchannelstate':{'type':Sequelize[_0x97c0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x97c0('0x1')]},'destcalleridnum':{'type':Sequelize[_0x97c0('0x1')]},'destcalleridname':{'type':Sequelize[_0x97c0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x97c0('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x97c0('0x1')]},'destaccountcode':{'type':Sequelize[_0x97c0('0x1')]},'destcontext':{'type':Sequelize[_0x97c0('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x97c0('0x1')]},'destuniqueid':{'type':Sequelize[_0x97c0('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x97c0('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x97c0('0x1')]},'transfer':{'type':Sequelize[_0x97c0('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x97c0('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x97c0('0x1')]},'transferuniqueid':{'type':Sequelize[_0x97c0('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 3b0273b..8cbd2d6 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 _0x1090=['zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','find','create','body','catch','describe','html-pdf','rimraf'];(function(_0x48df8d,_0x42fd50){var _0x3125bf=function(_0x2bd552){while(--_0x2bd552){_0x48df8d['push'](_0x48df8d['shift']());}};_0x3125bf(++_0x42fd50);}(_0x1090,0x1a2));var _0x0109=function(_0xcdd89b,_0x40b13f){_0xcdd89b=_0xcdd89b-0x0;var _0x1c525d=_0x1090[_0xcdd89b];return _0x1c525d;};'use strict';var pdf=require(_0x0109('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0109('0x1'));var zipdir=require(_0x0109('0x2'));var jsonpatch=require(_0x0109('0x3'));var rp=require(_0x0109('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0109('0x5'));var util=require(_0x0109('0x6'));var path=require(_0x0109('0x7'));var sox=require('sox');var csv=require(_0x0109('0x8'));var ejs=require(_0x0109('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0109('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0109('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0109('0xc'));var Papa=require('papaparse');var Redis=require(_0x0109('0xd'));var authService=require(_0x0109('0xe'));var qs=require(_0x0109('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0109('0x10'));var logger=require(_0x0109('0x11'))('api');var utils=require(_0x0109('0x12'));var config=require('../../config/environment');var db=require(_0x0109('0x13'))['db'];function respondWithStatusCode(_0x38c4d2,_0x263f0c){_0x263f0c=_0x263f0c||0xcc;return function(_0x2f9780){if(_0x2f9780){return _0x38c4d2[_0x0109('0x14')](_0x263f0c);}return _0x38c4d2[_0x0109('0x15')](_0x263f0c)[_0x0109('0x16')]();};}function respondWithResult(_0x3020d5,_0x304c5e){_0x304c5e=_0x304c5e||0xc8;return function(_0x58cb1f){if(_0x58cb1f){return _0x3020d5['status'](_0x304c5e)[_0x0109('0x17')](_0x58cb1f);}};}function respondWithFilteredResult(_0x1e1757,_0x409b93){return function(_0x4021fe){if(_0x4021fe){var _0x2b50b6=_0x4021fe[_0x0109('0x18')],_0x446314=_0x409b93[_0x0109('0x19')],_0x42b2ce=_0x409b93['offset']+_0x409b93['limit'],_0x44b637;if(_0x42b2ce>=_0x2b50b6){_0x42b2ce=_0x2b50b6;_0x44b637=0xc8;}else{_0x44b637=0xce;}_0x1e1757[_0x0109('0x15')](_0x44b637);return _0x1e1757[_0x0109('0x1a')]('Content-Range',_0x446314+'-'+_0x42b2ce+'/'+_0x2b50b6)[_0x0109('0x17')](_0x4021fe);}return null;};}function patchUpdates(_0x3343e4){return function(_0x22a092){try{jsonpatch['apply'](_0x22a092,_0x3343e4,!![]);}catch(_0x123733){return BPromise[_0x0109('0x1b')](_0x123733);}return _0x22a092[_0x0109('0x1c')]();};}function saveUpdates(_0x21cee2,_0xf63fc7){return function(_0x4c745f){if(_0x4c745f){return _0x4c745f[_0x0109('0x1d')](_0x21cee2)[_0x0109('0x1e')](function(_0x383890){return _0x383890;});}return null;};}function removeEntity(_0x35f956,_0x33fee3){return function(_0x168197){if(_0x168197){return _0x168197[_0x0109('0x1f')]()[_0x0109('0x1e')](function(){_0x35f956[_0x0109('0x15')](0xcc)[_0x0109('0x16')]();});}};}function handleEntityNotFound(_0xab68ed,_0x20ec21){return function(_0x333502){if(!_0x333502){_0xab68ed[_0x0109('0x14')](0x194);}return _0x333502;};}function handleError(_0xfbc253,_0x352843){_0x352843=_0x352843||0x1f4;return function(_0x1034cf){logger[_0x0109('0x20')](_0x1034cf[_0x0109('0x21')]);if(_0x1034cf[_0x0109('0x22')]){delete _0x1034cf[_0x0109('0x22')];}_0xfbc253[_0x0109('0x15')](_0x352843)[_0x0109('0x23')](_0x1034cf);};}exports['index']=function(_0x4ddb27,_0xc49c49){var _0x1d680b={},_0x21b99a={},_0x26c201={'count':0x0,'rows':[]};var _0x5ee15f=_[_0x0109('0x24')](db[_0x0109('0x25')][_0x0109('0x26')],function(_0x1ffe27){return{'name':_0x1ffe27[_0x0109('0x27')],'type':_0x1ffe27[_0x0109('0x28')][_0x0109('0x29')]};});_0x21b99a[_0x0109('0x2a')]=_[_0x0109('0x24')](_0x5ee15f,_0x0109('0x22'));_0x21b99a[_0x0109('0x2b')]=_[_0x0109('0x2c')](_0x4ddb27[_0x0109('0x2b')]);_0x21b99a[_0x0109('0x2d')]=_['intersection'](_0x21b99a[_0x0109('0x2a')],_0x21b99a[_0x0109('0x2b')]);_0x1d680b['attributes']=_[_0x0109('0x2e')](_0x21b99a[_0x0109('0x2a')],qs[_0x0109('0x2f')](_0x4ddb27[_0x0109('0x2b')][_0x0109('0x2f')]));_0x1d680b[_0x0109('0x30')]=_0x1d680b[_0x0109('0x30')][_0x0109('0x31')]?_0x1d680b[_0x0109('0x30')]:_0x21b99a[_0x0109('0x2a')];if(!_0x4ddb27[_0x0109('0x2b')]['hasOwnProperty'](_0x0109('0x32'))){_0x1d680b[_0x0109('0x33')]=qs[_0x0109('0x33')](_0x4ddb27[_0x0109('0x2b')][_0x0109('0x33')]);_0x1d680b[_0x0109('0x19')]=qs['offset'](_0x4ddb27[_0x0109('0x2b')][_0x0109('0x19')]);}_0x1d680b[_0x0109('0x34')]=qs[_0x0109('0x35')](_0x4ddb27[_0x0109('0x2b')][_0x0109('0x35')]);_0x1d680b[_0x0109('0x36')]=qs['filters'](_[_0x0109('0x37')](_0x4ddb27[_0x0109('0x2b')],_0x21b99a[_0x0109('0x2d')]),_0x5ee15f);if(_0x4ddb27['query']['filter']){_0x1d680b['where']=_['merge'](_0x1d680b[_0x0109('0x36')],{'$or':_[_0x0109('0x24')](_0x5ee15f,function(_0x33dcce){if(_0x33dcce[_0x0109('0x28')]!==_0x0109('0x38')){var _0x2dd018={};_0x2dd018[_0x33dcce[_0x0109('0x22')]]={'$like':'%'+_0x4ddb27[_0x0109('0x2b')][_0x0109('0x39')]+'%'};return _0x2dd018;}})});}_0x1d680b=_[_0x0109('0x3a')]({},_0x1d680b,_0x4ddb27[_0x0109('0x3b')]);var _0x439591={'where':_0x1d680b[_0x0109('0x36')]};return db[_0x0109('0x25')]['count'](_0x439591)[_0x0109('0x1e')](function(_0x246154){_0x26c201[_0x0109('0x18')]=_0x246154;if(_0x4ddb27[_0x0109('0x2b')][_0x0109('0x3c')]){_0x1d680b[_0x0109('0x3d')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0109('0x3e')](_0x1d680b);})['then'](function(_0x51de56){_0x26c201[_0x0109('0x3f')]=_0x51de56;return _0x26c201;})['then'](respondWithFilteredResult(_0xc49c49,_0x1d680b))['catch'](handleError(_0xc49c49,null));};exports['show']=function(_0x44a29d,_0x403796){var _0x1da824={'raw':![],'where':{'id':_0x44a29d[_0x0109('0x40')]['id']}},_0x582ab4={};_0x582ab4[_0x0109('0x2a')]=_[_0x0109('0x2c')](db[_0x0109('0x25')][_0x0109('0x26')]);_0x582ab4[_0x0109('0x2b')]=_[_0x0109('0x2c')](_0x44a29d[_0x0109('0x2b')]);_0x582ab4[_0x0109('0x2d')]=_[_0x0109('0x2e')](_0x582ab4['model'],_0x582ab4[_0x0109('0x2b')]);_0x1da824[_0x0109('0x30')]=_[_0x0109('0x2e')](_0x582ab4[_0x0109('0x2a')],qs['fields'](_0x44a29d[_0x0109('0x2b')]['fields']));_0x1da824['attributes']=_0x1da824[_0x0109('0x30')][_0x0109('0x31')]?_0x1da824[_0x0109('0x30')]:_0x582ab4[_0x0109('0x2a')];if(_0x44a29d[_0x0109('0x2b')][_0x0109('0x3c')]){_0x1da824['include']=[{'all':!![]}];}_0x1da824=_['merge']({},_0x1da824,_0x44a29d[_0x0109('0x3b')]);return db[_0x0109('0x25')][_0x0109('0x41')](_0x1da824)[_0x0109('0x1e')](handleEntityNotFound(_0x403796,null))[_0x0109('0x1e')](respondWithResult(_0x403796,null))['catch'](handleError(_0x403796,null));};exports[_0x0109('0x42')]=function(_0x4aaf2a,_0x4512c3){return db[_0x0109('0x25')][_0x0109('0x42')](_0x4aaf2a[_0x0109('0x43')],{})[_0x0109('0x1e')](respondWithResult(_0x4512c3,0xc9))[_0x0109('0x44')](handleError(_0x4512c3,null));};exports['update']=function(_0x51a42d,_0xbc0dc5){if(_0x51a42d[_0x0109('0x43')]['id']){delete _0x51a42d[_0x0109('0x43')]['id'];}return db[_0x0109('0x25')][_0x0109('0x41')]({'where':{'id':_0x51a42d[_0x0109('0x40')]['id']}})['then'](handleEntityNotFound(_0xbc0dc5,null))[_0x0109('0x1e')](saveUpdates(_0x51a42d[_0x0109('0x43')],null))[_0x0109('0x1e')](respondWithResult(_0xbc0dc5,null))[_0x0109('0x44')](handleError(_0xbc0dc5,null));};exports['destroy']=function(_0x350e34,_0x12de79){return db[_0x0109('0x25')]['find']({'where':{'id':_0x350e34[_0x0109('0x40')]['id']}})[_0x0109('0x1e')](handleEntityNotFound(_0x12de79,null))[_0x0109('0x1e')](removeEntity(_0x12de79,null))['catch'](handleError(_0x12de79,null));};exports[_0x0109('0x45')]=function(_0x4d692c,_0x122842){return db['VoiceAgentReport'][_0x0109('0x45')]()['then'](respondWithResult(_0x122842,null))[_0x0109('0x44')](handleError(_0x122842,null));}; \ No newline at end of file +var _0x3ff4=['send','VoiceAgentReport','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','params','rawAttributes','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','sendStatus','stack','name'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x3ff4,0xb5));var _0x43ff=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x3ff4[_0x1da527];return _0x40fc7c;};'use strict';var pdf=require(_0x43ff('0x0'));var emlformat=require(_0x43ff('0x1'));var rimraf=require(_0x43ff('0x2'));var zipdir=require(_0x43ff('0x3'));var jsonpatch=require(_0x43ff('0x4'));var rp=require(_0x43ff('0x5'));var moment=require(_0x43ff('0x6'));var BPromise=require(_0x43ff('0x7'));var Mustache=require(_0x43ff('0x8'));var util=require(_0x43ff('0x9'));var path=require(_0x43ff('0xa'));var sox=require('sox');var csv=require(_0x43ff('0xb'));var ejs=require(_0x43ff('0xc'));var fs=require('fs');var _=require(_0x43ff('0xd'));var squel=require(_0x43ff('0xe'));var crypto=require(_0x43ff('0xf'));var jsforce=require(_0x43ff('0x10'));var deskjs=require(_0x43ff('0x11'));var toCsv=require(_0x43ff('0xb'));var querystring=require(_0x43ff('0x12'));var Papa=require(_0x43ff('0x13'));var Redis=require('ioredis');var authService=require(_0x43ff('0x14'));var qs=require(_0x43ff('0x15'));var as=require(_0x43ff('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43ff('0x17'))('api');var utils=require(_0x43ff('0x18'));var config=require(_0x43ff('0x19'));var db=require(_0x43ff('0x1a'))['db'];function respondWithStatusCode(_0x265ed5,_0x1cfeaf){_0x1cfeaf=_0x1cfeaf||0xcc;return function(_0x4c9167){if(_0x4c9167){return _0x265ed5['sendStatus'](_0x1cfeaf);}return _0x265ed5[_0x43ff('0x1b')](_0x1cfeaf)[_0x43ff('0x1c')]();};}function respondWithResult(_0x24888d,_0x33fb0a){_0x33fb0a=_0x33fb0a||0xc8;return function(_0x55570a){if(_0x55570a){return _0x24888d[_0x43ff('0x1b')](_0x33fb0a)[_0x43ff('0x1d')](_0x55570a);}};}function respondWithFilteredResult(_0xd68b04,_0x122cb6){return function(_0x378c3d){if(_0x378c3d){var _0x362d39=_0x378c3d[_0x43ff('0x1e')],_0x203181=_0x122cb6['offset'],_0x11439d=_0x122cb6[_0x43ff('0x1f')]+_0x122cb6[_0x43ff('0x20')],_0x182d74;if(_0x11439d>=_0x362d39){_0x11439d=_0x362d39;_0x182d74=0xc8;}else{_0x182d74=0xce;}_0xd68b04['status'](_0x182d74);return _0xd68b04[_0x43ff('0x21')](_0x43ff('0x22'),_0x203181+'-'+_0x11439d+'/'+_0x362d39)[_0x43ff('0x1d')](_0x378c3d);}return null;};}function patchUpdates(_0x4d18b7){return function(_0x2b3e37){try{jsonpatch[_0x43ff('0x23')](_0x2b3e37,_0x4d18b7,!![]);}catch(_0xd3314f){return BPromise[_0x43ff('0x24')](_0xd3314f);}return _0x2b3e37['save']();};}function saveUpdates(_0x200022,_0x42df46){return function(_0x145b57){if(_0x145b57){return _0x145b57['update'](_0x200022)[_0x43ff('0x25')](function(_0x504be9){return _0x504be9;});}return null;};}function removeEntity(_0x4c42df,_0x3124fe){return function(_0x3b45b6){if(_0x3b45b6){return _0x3b45b6['destroy']()[_0x43ff('0x25')](function(){_0x4c42df[_0x43ff('0x1b')](0xcc)[_0x43ff('0x1c')]();});}};}function handleEntityNotFound(_0x256f19,_0x3e39f3){return function(_0x817a19){if(!_0x817a19){_0x256f19[_0x43ff('0x26')](0x194);}return _0x817a19;};}function handleError(_0x228452,_0x5f0565){_0x5f0565=_0x5f0565||0x1f4;return function(_0x3a5e6f){logger['error'](_0x3a5e6f[_0x43ff('0x27')]);if(_0x3a5e6f[_0x43ff('0x28')]){delete _0x3a5e6f[_0x43ff('0x28')];}_0x228452['status'](_0x5f0565)[_0x43ff('0x29')](_0x3a5e6f);};}exports['index']=function(_0x16ef20,_0x215ea0){var _0x4d2912={},_0x3debbc={},_0x9c79bc={'count':0x0,'rows':[]};var _0x448e8a=_['map'](db[_0x43ff('0x2a')]['rawAttributes'],function(_0x5cd271){return{'name':_0x5cd271[_0x43ff('0x2b')],'type':_0x5cd271['type'][_0x43ff('0x2c')]};});_0x3debbc[_0x43ff('0x2d')]=_[_0x43ff('0x2e')](_0x448e8a,_0x43ff('0x28'));_0x3debbc[_0x43ff('0x2f')]=_[_0x43ff('0x30')](_0x16ef20[_0x43ff('0x2f')]);_0x3debbc[_0x43ff('0x31')]=_[_0x43ff('0x32')](_0x3debbc[_0x43ff('0x2d')],_0x3debbc['query']);_0x4d2912[_0x43ff('0x33')]=_[_0x43ff('0x32')](_0x3debbc[_0x43ff('0x2d')],qs[_0x43ff('0x34')](_0x16ef20[_0x43ff('0x2f')][_0x43ff('0x34')]));_0x4d2912[_0x43ff('0x33')]=_0x4d2912[_0x43ff('0x33')][_0x43ff('0x35')]?_0x4d2912[_0x43ff('0x33')]:_0x3debbc[_0x43ff('0x2d')];if(!_0x16ef20[_0x43ff('0x2f')][_0x43ff('0x36')](_0x43ff('0x37'))){_0x4d2912[_0x43ff('0x20')]=qs[_0x43ff('0x20')](_0x16ef20[_0x43ff('0x2f')]['limit']);_0x4d2912[_0x43ff('0x1f')]=qs['offset'](_0x16ef20['query'][_0x43ff('0x1f')]);}_0x4d2912['order']=qs[_0x43ff('0x38')](_0x16ef20[_0x43ff('0x2f')][_0x43ff('0x38')]);_0x4d2912['where']=qs[_0x43ff('0x31')](_[_0x43ff('0x39')](_0x16ef20[_0x43ff('0x2f')],_0x3debbc[_0x43ff('0x31')]),_0x448e8a);if(_0x16ef20[_0x43ff('0x2f')]['filter']){_0x4d2912['where']=_[_0x43ff('0x3a')](_0x4d2912['where'],{'$or':_[_0x43ff('0x2e')](_0x448e8a,function(_0x158630){if(_0x158630[_0x43ff('0x3b')]!==_0x43ff('0x3c')){var _0x35cee1={};_0x35cee1[_0x158630[_0x43ff('0x28')]]={'$like':'%'+_0x16ef20[_0x43ff('0x2f')][_0x43ff('0x3d')]+'%'};return _0x35cee1;}})});}_0x4d2912=_['merge']({},_0x4d2912,_0x16ef20[_0x43ff('0x3e')]);var _0x23844f={'where':_0x4d2912['where']};return db['VoiceAgentReport']['count'](_0x23844f)[_0x43ff('0x25')](function(_0x3818b2){_0x9c79bc[_0x43ff('0x1e')]=_0x3818b2;if(_0x16ef20[_0x43ff('0x2f')][_0x43ff('0x3f')]){_0x4d2912['include']=[{'all':!![]}];}return db[_0x43ff('0x2a')][_0x43ff('0x40')](_0x4d2912);})['then'](function(_0x3bfb33){_0x9c79bc[_0x43ff('0x41')]=_0x3bfb33;return _0x9c79bc;})[_0x43ff('0x25')](respondWithFilteredResult(_0x215ea0,_0x4d2912))['catch'](handleError(_0x215ea0,null));};exports['show']=function(_0x261d4f,_0x176339){var _0x377e10={'raw':![],'where':{'id':_0x261d4f[_0x43ff('0x42')]['id']}},_0x1a01aa={};_0x1a01aa[_0x43ff('0x2d')]=_[_0x43ff('0x30')](db[_0x43ff('0x2a')][_0x43ff('0x43')]);_0x1a01aa[_0x43ff('0x2f')]=_[_0x43ff('0x30')](_0x261d4f[_0x43ff('0x2f')]);_0x1a01aa[_0x43ff('0x31')]=_['intersection'](_0x1a01aa[_0x43ff('0x2d')],_0x1a01aa[_0x43ff('0x2f')]);_0x377e10['attributes']=_['intersection'](_0x1a01aa[_0x43ff('0x2d')],qs[_0x43ff('0x34')](_0x261d4f[_0x43ff('0x2f')]['fields']));_0x377e10[_0x43ff('0x33')]=_0x377e10[_0x43ff('0x33')]['length']?_0x377e10[_0x43ff('0x33')]:_0x1a01aa[_0x43ff('0x2d')];if(_0x261d4f['query'][_0x43ff('0x3f')]){_0x377e10['include']=[{'all':!![]}];}_0x377e10=_['merge']({},_0x377e10,_0x261d4f[_0x43ff('0x3e')]);return db[_0x43ff('0x2a')][_0x43ff('0x44')](_0x377e10)[_0x43ff('0x25')](handleEntityNotFound(_0x176339,null))[_0x43ff('0x25')](respondWithResult(_0x176339,null))[_0x43ff('0x45')](handleError(_0x176339,null));};exports[_0x43ff('0x46')]=function(_0x23a974,_0x1b7c37){return db[_0x43ff('0x2a')][_0x43ff('0x46')](_0x23a974[_0x43ff('0x47')],{})['then'](respondWithResult(_0x1b7c37,0xc9))['catch'](handleError(_0x1b7c37,null));};exports['update']=function(_0x20c033,_0x3d5865){if(_0x20c033[_0x43ff('0x47')]['id']){delete _0x20c033[_0x43ff('0x47')]['id'];}return db[_0x43ff('0x2a')][_0x43ff('0x44')]({'where':{'id':_0x20c033['params']['id']}})[_0x43ff('0x25')](handleEntityNotFound(_0x3d5865,null))['then'](saveUpdates(_0x20c033[_0x43ff('0x47')],null))[_0x43ff('0x25')](respondWithResult(_0x3d5865,null))[_0x43ff('0x45')](handleError(_0x3d5865,null));};exports[_0x43ff('0x48')]=function(_0x4b9fe7,_0x15ccf6){return db[_0x43ff('0x2a')][_0x43ff('0x44')]({'where':{'id':_0x4b9fe7[_0x43ff('0x42')]['id']}})['then'](handleEntityNotFound(_0x15ccf6,null))[_0x43ff('0x25')](removeEntity(_0x15ccf6,null))['catch'](handleError(_0x15ccf6,null));};exports[_0x43ff('0x49')]=function(_0xb60a17,_0x49441b){return db['VoiceAgentReport'][_0x43ff('0x49')]()['then'](respondWithResult(_0x49441b,null))['catch'](handleError(_0x49441b,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 1c1c8a4..a7d9761 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 _0xa9e0=['define','VoiceAgentReport','destuniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['rimraf','./voiceAgentReport.attributes','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x301f00,_0x1687c4){var _0x3c372a=function(_0x38ff50){while(--_0x38ff50){_0x301f00['push'](_0x301f00['shift']());}};_0x3c372a(++_0x1687c4);}(_0x70e0,0x17b));var _0x070e=function(_0x424a11,_0x2ab828){_0x424a11=_0x424a11-0x0;var _0x50df57=_0x70e0[_0x424a11];return _0x50df57;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceAgentReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'fields':[_0x070e('0x9'),_0x070e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index ab65a62..defed5f 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 _0x6ba7=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','UpdateVoiceAgentReport','update','body','limit','catch','lodash','moment','randomstring','ioredis'];(function(_0x5b5027,_0x54ae4a){var _0x399a16=function(_0x233b0d){while(--_0x233b0d){_0x5b5027['push'](_0x5b5027['shift']());}};_0x399a16(++_0x54ae4a);}(_0x6ba7,0x146));var _0x76ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ba7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76ba('0x0'));var util=require('util');var moment=require(_0x76ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x76ba('0x2'));var fs=require('fs');var Redis=require(_0x76ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x76ba('0x4'));var logger=require('../../config/logger')(_0x76ba('0x5'));var config=require(_0x76ba('0x6'));var jayson=require(_0x76ba('0x7'));var client=jayson[_0x76ba('0x8')][_0x76ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x409562,_0x22342a,_0x52c0bd){return new BPromise(function(_0x1d916c,_0x2428db){return client['request'](_0x409562,_0x52c0bd)[_0x76ba('0xa')](function(_0x203312){logger[_0x76ba('0xb')](_0x76ba('0xc'),_0x22342a,'request\x20sent');logger[_0x76ba('0xd')](_0x76ba('0xe'),_0x22342a,_0x76ba('0xf'),JSON[_0x76ba('0x10')](_0x203312));if(_0x203312[_0x76ba('0x11')]){if(_0x203312['error'][_0x76ba('0x12')]===0x1f4){logger[_0x76ba('0x11')](_0x76ba('0xc'),_0x22342a,_0x203312[_0x76ba('0x11')]['message']);return _0x2428db(_0x203312[_0x76ba('0x11')]['message']);}logger[_0x76ba('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x22342a,_0x203312[_0x76ba('0x11')][_0x76ba('0x13')]);return _0x1d916c(_0x203312[_0x76ba('0x11')][_0x76ba('0x13')]);}else{logger[_0x76ba('0xb')](_0x76ba('0xc'),_0x22342a,_0x76ba('0xf'));_0x1d916c(_0x203312[_0x76ba('0x14')][_0x76ba('0x13')]);}})['catch'](function(_0x1a6c3b){logger['error'](_0x76ba('0xc'),_0x22342a,_0x1a6c3b);_0x2428db(_0x1a6c3b);});});}exports[_0x76ba('0x15')]=function(_0x36f8ee){var _0x2d95f9=this;return new Promise(function(_0xb369c1,_0x1e4066){return db[_0x76ba('0x16')][_0x76ba('0x17')](_0x36f8ee['body'],{'raw':_0x36f8ee[_0x76ba('0x18')]?_0x36f8ee[_0x76ba('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x76ba('0xa')](function(_0xeef85f){logger[_0x76ba('0xb')](_0x76ba('0x15'),_0x36f8ee);logger[_0x76ba('0xd')](_0x76ba('0x15'),_0x36f8ee,JSON[_0x76ba('0x10')](_0xeef85f));_0xb369c1(_0xeef85f);})['catch'](function(_0x53325e){logger[_0x76ba('0x11')](_0x76ba('0x15'),_0x53325e['message'],_0x36f8ee);_0x1e4066(_0x2d95f9[_0x76ba('0x11')](0x1f4,_0x53325e['message']));});});};exports[_0x76ba('0x19')]=function(_0x543db4){var _0x4034e9=this;return new Promise(function(_0x509d88,_0x229f01){return db[_0x76ba('0x16')][_0x76ba('0x1a')](_0x543db4[_0x76ba('0x1b')],{'raw':_0x543db4[_0x76ba('0x18')]?_0x543db4[_0x76ba('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x543db4[_0x76ba('0x18')]?_0x543db4['options']['where']||null:null,'attributes':_0x543db4[_0x76ba('0x18')]?_0x543db4['options']['attributes']||null:null,'limit':_0x543db4[_0x76ba('0x18')]?_0x543db4[_0x76ba('0x18')][_0x76ba('0x1c')]||null:null})[_0x76ba('0xa')](function(_0x47c25c){logger[_0x76ba('0xb')](_0x76ba('0x19'),_0x543db4);logger['debug'](_0x76ba('0x19'),_0x543db4,JSON[_0x76ba('0x10')](_0x47c25c));_0x509d88(_0x47c25c);})[_0x76ba('0x1d')](function(_0x3c530){logger[_0x76ba('0x11')](_0x76ba('0x19'),_0x3c530[_0x76ba('0x13')],_0x543db4);_0x229f01(_0x4034e9['error'](0x1f4,_0x3c530[_0x76ba('0x13')]));});});}; \ No newline at end of file +var _0x4269=['message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4e448b,_0x193ca0){var _0x273cf5=function(_0x32245d){while(--_0x32245d){_0x4e448b['push'](_0x4e448b['shift']());}};_0x273cf5(++_0x193ca0);}(_0x4269,0xcc));var _0x9426=function(_0x15fa77,_0x93eaff){_0x15fa77=_0x15fa77-0x0;var _0x1385ff=_0x4269[_0x15fa77];return _0x1385ff;};'use strict';var _=require(_0x9426('0x0'));var util=require('util');var moment=require(_0x9426('0x1'));var BPromise=require(_0x9426('0x2'));var rs=require(_0x9426('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9426('0x4'))['db'];var utils=require(_0x9426('0x5'));var logger=require('../../config/logger')(_0x9426('0x6'));var config=require(_0x9426('0x7'));var jayson=require(_0x9426('0x8'));var client=jayson['client'][_0x9426('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17f4a9,_0x28643d,_0x22a82e){return new BPromise(function(_0x47ba03,_0x4d7dca){return client[_0x9426('0xa')](_0x17f4a9,_0x22a82e)[_0x9426('0xb')](function(_0x854a6d){logger[_0x9426('0xc')](_0x9426('0xd'),_0x28643d,_0x9426('0xe'));logger[_0x9426('0xf')](_0x9426('0x10'),_0x28643d,'request\x20sent',JSON[_0x9426('0x11')](_0x854a6d));if(_0x854a6d[_0x9426('0x12')]){if(_0x854a6d[_0x9426('0x12')][_0x9426('0x13')]===0x1f4){logger['error'](_0x9426('0xd'),_0x28643d,_0x854a6d['error'][_0x9426('0x14')]);return _0x4d7dca(_0x854a6d[_0x9426('0x12')][_0x9426('0x14')]);}logger[_0x9426('0x12')](_0x9426('0xd'),_0x28643d,_0x854a6d[_0x9426('0x12')]['message']);return _0x47ba03(_0x854a6d[_0x9426('0x12')]['message']);}else{logger[_0x9426('0xc')](_0x9426('0xd'),_0x28643d,_0x9426('0xe'));_0x47ba03(_0x854a6d[_0x9426('0x15')]['message']);}})[_0x9426('0x16')](function(_0x934394){logger[_0x9426('0x12')](_0x9426('0xd'),_0x28643d,_0x934394);_0x4d7dca(_0x934394);});});}exports[_0x9426('0x17')]=function(_0x40257b){var _0x2a68fd=this;return new Promise(function(_0x208263,_0x3b0ca6){return db[_0x9426('0x18')][_0x9426('0x19')](_0x40257b['body'],{'raw':_0x40257b[_0x9426('0x1a')]?_0x40257b[_0x9426('0x1a')][_0x9426('0x1b')]===undefined?!![]:![]:!![]})[_0x9426('0xb')](function(_0x3c9463){logger[_0x9426('0xc')]('CreateVoiceAgentReport',_0x40257b);logger[_0x9426('0xf')](_0x9426('0x17'),_0x40257b,JSON[_0x9426('0x11')](_0x3c9463));_0x208263(_0x3c9463);})[_0x9426('0x16')](function(_0x582389){logger[_0x9426('0x12')](_0x9426('0x17'),_0x582389[_0x9426('0x14')],_0x40257b);_0x3b0ca6(_0x2a68fd[_0x9426('0x12')](0x1f4,_0x582389[_0x9426('0x14')]));});});};exports[_0x9426('0x1c')]=function(_0x55fc0e){var _0x31575d=this;return new Promise(function(_0x4cde0e,_0x1621aa){return db[_0x9426('0x18')][_0x9426('0x1d')](_0x55fc0e['body'],{'raw':_0x55fc0e[_0x9426('0x1a')]?_0x55fc0e['options'][_0x9426('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55fc0e[_0x9426('0x1a')]?_0x55fc0e[_0x9426('0x1a')][_0x9426('0x1e')]||null:null,'attributes':_0x55fc0e['options']?_0x55fc0e[_0x9426('0x1a')][_0x9426('0x1f')]||null:null,'limit':_0x55fc0e[_0x9426('0x1a')]?_0x55fc0e[_0x9426('0x1a')]['limit']||null:null})[_0x9426('0xb')](function(_0x45a813){logger[_0x9426('0xc')]('UpdateVoiceAgentReport',_0x55fc0e);logger[_0x9426('0xf')](_0x9426('0x1c'),_0x55fc0e,JSON[_0x9426('0x11')](_0x45a813));_0x4cde0e(_0x45a813);})['catch'](function(_0x2b9eb4){logger[_0x9426('0x12')](_0x9426('0x1c'),_0x2b9eb4[_0x9426('0x14')],_0x55fc0e);_0x1621aa(_0x31575d[_0x9426('0x12')](0x1f4,_0x2b9eb4[_0x9426('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d629889..afb730f 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 _0x1c4f=['/:id','show','create','put','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x1dd30c,_0x585158){var _0x491688=function(_0x56d0a0){while(--_0x56d0a0){_0x1dd30c['push'](_0x1dd30c['shift']());}};_0x491688(++_0x585158);}(_0x1c4f,0x1a4));var _0xf1c4=function(_0x22a4a3,_0xaaa808){_0x22a4a3=_0x22a4a3-0x0;var _0x306843=_0x1c4f[_0x22a4a3];return _0x306843;};'use strict';var multer=require(_0xf1c4('0x0'));var util=require('util');var path=require(_0xf1c4('0x1'));var timeout=require(_0xf1c4('0x2'));var express=require(_0xf1c4('0x3'));var router=express[_0xf1c4('0x4')]();var auth=require(_0xf1c4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf1c4('0x6'));var controller=require('./voiceCallReport.controller');router[_0xf1c4('0x7')]('/',auth[_0xf1c4('0x8')](),controller[_0xf1c4('0x9')]);router['get'](_0xf1c4('0xa'),auth[_0xf1c4('0x8')](),controller[_0xf1c4('0xb')]);router[_0xf1c4('0x7')](_0xf1c4('0xc'),auth['isAuthenticated'](),controller[_0xf1c4('0xd')]);router['post']('/',auth[_0xf1c4('0x8')](),controller[_0xf1c4('0xe')]);router[_0xf1c4('0xf')](_0xf1c4('0xc'),auth[_0xf1c4('0x8')](),controller[_0xf1c4('0x10')]);router['delete'](_0xf1c4('0xc'),auth[_0xf1c4('0x8')](),controller[_0xf1c4('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6e7c=['show','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x2f479d,_0x1d6836){var _0x300d48=function(_0x338a74){while(--_0x338a74){_0x2f479d['push'](_0x2f479d['shift']());}};_0x300d48(++_0x1d6836);}(_0x6e7c,0x9e));var _0xc6e7=function(_0x97765a,_0x4f9522){_0x97765a=_0x97765a-0x0;var _0x20b325=_0x6e7c[_0x97765a];return _0x20b325;};'use strict';var multer=require(_0xc6e7('0x0'));var util=require(_0xc6e7('0x1'));var path=require(_0xc6e7('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6e7('0x3'));var router=express[_0xc6e7('0x4')]();var auth=require(_0xc6e7('0x5'));var interaction=require(_0xc6e7('0x6'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router[_0xc6e7('0x7')]('/',auth['isAuthenticated'](),controller[_0xc6e7('0x8')]);router[_0xc6e7('0x7')](_0xc6e7('0x9'),auth[_0xc6e7('0xa')](),controller[_0xc6e7('0xb')]);router[_0xc6e7('0x7')](_0xc6e7('0xc'),auth[_0xc6e7('0xa')](),controller[_0xc6e7('0xd')]);router['post']('/',auth[_0xc6e7('0xa')](),controller[_0xc6e7('0xe')]);router[_0xc6e7('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc6e7('0x10')]);router['delete'](_0xc6e7('0xc'),auth[_0xc6e7('0xa')](),controller[_0xc6e7('0x11')]);module[_0xc6e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index a74ef26..ddbf7bd 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(_0x17c1bf,_0x3e50e8){var _0x51166c=function(_0x40651e){while(--_0x40651e){_0x17c1bf['push'](_0x17c1bf['shift']());}};_0x51166c(++_0x3e50e8);}(_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 +var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x313665,_0x5f5d32){var _0x40bc9e=function(_0x53309b){while(--_0x53309b){_0x313665['push'](_0x313665['shift']());}};_0x40bc9e(++_0x5f5d32);}(_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 4083621..eec301a 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 _0xc4b7=['mustache','util','sox','to-csv','lodash','crypto','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','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','end','error','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','include','fullname','alias','show','filters','includeAll','options','find','catch','create','body','destroy','params','describe','uniqueid','user','html-pdf','rimraf','fast-json-patch','moment'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xc4b7,0xdd));var _0x7c4b=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xc4b7[_0x49b207];return _0x2dc8fa;};'use strict';var pdf=require(_0x7c4b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7c4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c4b('0x2'));var rp=require('request-promise');var moment=require(_0x7c4b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7c4b('0x4'));var util=require(_0x7c4b('0x5'));var path=require('path');var sox=require(_0x7c4b('0x6'));var csv=require(_0x7c4b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c4b('0x8'));var squel=require('squel');var crypto=require(_0x7c4b('0x9'));var jsforce=require(_0x7c4b('0xa'));var deskjs=require(_0x7c4b('0xb'));var toCsv=require(_0x7c4b('0x7'));var querystring=require(_0x7c4b('0xc'));var Papa=require(_0x7c4b('0xd'));var Redis=require('ioredis');var authService=require(_0x7c4b('0xe'));var qs=require(_0x7c4b('0xf'));var as=require(_0x7c4b('0x10'));var hardwareService=require(_0x7c4b('0x11'));var logger=require(_0x7c4b('0x12'))(_0x7c4b('0x13'));var utils=require(_0x7c4b('0x14'));var config=require(_0x7c4b('0x15'));var db=require(_0x7c4b('0x16'))['db'];function respondWithStatusCode(_0xd9e614,_0x54480a){_0x54480a=_0x54480a||0xcc;return function(_0x3a6b01){if(_0x3a6b01){return _0xd9e614[_0x7c4b('0x17')](_0x54480a);}return _0xd9e614[_0x7c4b('0x18')](_0x54480a)['end']();};}function respondWithResult(_0x368f9e,_0x46aa1c){_0x46aa1c=_0x46aa1c||0xc8;return function(_0x4d69be){if(_0x4d69be){return _0x368f9e[_0x7c4b('0x18')](_0x46aa1c)[_0x7c4b('0x19')](_0x4d69be);}};}function respondWithFilteredResult(_0x31f96b,_0x2af5e9){return function(_0x574a97){if(_0x574a97){var _0x429789=_0x574a97[_0x7c4b('0x1a')],_0x36b2b8=_0x2af5e9[_0x7c4b('0x1b')],_0x31db3f=_0x2af5e9[_0x7c4b('0x1b')]+_0x2af5e9['limit'],_0x4507bb;if(_0x31db3f>=_0x429789){_0x31db3f=_0x429789;_0x4507bb=0xc8;}else{_0x4507bb=0xce;}_0x31f96b['status'](_0x4507bb);return _0x31f96b[_0x7c4b('0x1c')]('Content-Range',_0x36b2b8+'-'+_0x31db3f+'/'+_0x429789)['json'](_0x574a97);}return null;};}function patchUpdates(_0x39a0fe){return function(_0x1724a6){try{jsonpatch[_0x7c4b('0x1d')](_0x1724a6,_0x39a0fe,!![]);}catch(_0xb2c2e0){return BPromise[_0x7c4b('0x1e')](_0xb2c2e0);}return _0x1724a6[_0x7c4b('0x1f')]();};}function saveUpdates(_0x14cd74,_0x3f07e7){return function(_0x3ec1b0){if(_0x3ec1b0){return _0x3ec1b0[_0x7c4b('0x20')](_0x14cd74)[_0x7c4b('0x21')](function(_0x239619){return _0x239619;});}return null;};}function removeEntity(_0x5abd92,_0x279f00){return function(_0x3e2a3f){if(_0x3e2a3f){return _0x3e2a3f['destroy']()[_0x7c4b('0x21')](function(){_0x5abd92[_0x7c4b('0x18')](0xcc)[_0x7c4b('0x22')]();});}};}function handleEntityNotFound(_0x510739,_0x38b077){return function(_0x4859fb){if(!_0x4859fb){_0x510739[_0x7c4b('0x17')](0x194);}return _0x4859fb;};}function handleError(_0xc6298e,_0xdf145){_0xdf145=_0xdf145||0x1f4;return function(_0x56a4ed){logger[_0x7c4b('0x23')](_0x56a4ed['stack']);if(_0x56a4ed[_0x7c4b('0x24')]){delete _0x56a4ed[_0x7c4b('0x24')];}_0xc6298e[_0x7c4b('0x18')](_0xdf145)['send'](_0x56a4ed);};}exports[_0x7c4b('0x25')]=function(_0x3efad7,_0x5e1f23){var _0x145fee={},_0x24bd85={},_0x361343={'count':0x0,'rows':[]};var _0x347fe6=_[_0x7c4b('0x26')](db[_0x7c4b('0x27')][_0x7c4b('0x28')],function(_0x9d10d1){return{'name':_0x9d10d1[_0x7c4b('0x29')],'type':_0x9d10d1[_0x7c4b('0x2a')][_0x7c4b('0x2b')]};});_0x24bd85[_0x7c4b('0x2c')]=_[_0x7c4b('0x26')](_0x347fe6,_0x7c4b('0x24'));_0x24bd85[_0x7c4b('0x2d')]=_[_0x7c4b('0x2e')](_0x3efad7[_0x7c4b('0x2d')]);_0x24bd85['filters']=_[_0x7c4b('0x2f')](_0x24bd85[_0x7c4b('0x2c')],_0x24bd85[_0x7c4b('0x2d')]);_0x145fee[_0x7c4b('0x30')]=_['intersection'](_0x24bd85[_0x7c4b('0x2c')],qs[_0x7c4b('0x31')](_0x3efad7[_0x7c4b('0x2d')]['fields']));_0x145fee[_0x7c4b('0x30')]=_0x145fee['attributes'][_0x7c4b('0x32')]?_0x145fee[_0x7c4b('0x30')]:_0x24bd85['model'];if(!_0x3efad7[_0x7c4b('0x2d')][_0x7c4b('0x33')]('nolimit')){_0x145fee[_0x7c4b('0x34')]=qs[_0x7c4b('0x34')](_0x3efad7[_0x7c4b('0x2d')][_0x7c4b('0x34')]);_0x145fee[_0x7c4b('0x1b')]=qs[_0x7c4b('0x1b')](_0x3efad7[_0x7c4b('0x2d')][_0x7c4b('0x1b')]);}_0x145fee['order']=qs[_0x7c4b('0x35')](_0x3efad7['query'][_0x7c4b('0x35')]);_0x145fee[_0x7c4b('0x36')]=qs['filters'](_[_0x7c4b('0x37')](_0x3efad7[_0x7c4b('0x2d')],_0x24bd85['filters']),_0x347fe6);if(_0x3efad7[_0x7c4b('0x2d')][_0x7c4b('0x38')]){_0x145fee[_0x7c4b('0x36')]=_[_0x7c4b('0x39')](_0x145fee[_0x7c4b('0x36')],{'$or':_[_0x7c4b('0x26')](_0x347fe6,function(_0x173946){if(_0x173946[_0x7c4b('0x2a')]!==_0x7c4b('0x3a')){var _0x50fe8c={};_0x50fe8c[_0x173946[_0x7c4b('0x24')]]={'$like':'%'+_0x3efad7[_0x7c4b('0x2d')][_0x7c4b('0x38')]+'%'};return _0x50fe8c;}})});}_0x145fee=_[_0x7c4b('0x39')]({},_0x145fee,_0x3efad7['options']);var _0x4040aa={'where':_0x145fee['where']};return db[_0x7c4b('0x27')]['count'](_0x4040aa)[_0x7c4b('0x21')](function(_0x2ed8bf){_0x361343['count']=_0x2ed8bf;if(_0x3efad7[_0x7c4b('0x2d')]['includeAll']){_0x145fee[_0x7c4b('0x3b')]=[{'attributes':['id',_0x7c4b('0x24'),_0x7c4b('0x3c'),_0x7c4b('0x3d')],'model':db['User'],'as':'User'}];}return db['VoiceCallReport']['findAll'](_0x145fee);})['then'](function(_0x178c76){_0x361343['rows']=_0x178c76;return _0x361343;})['then'](respondWithFilteredResult(_0x5e1f23,_0x145fee))['catch'](handleError(_0x5e1f23,null));};exports[_0x7c4b('0x3e')]=function(_0x9edaff,_0x2ebf7d){var _0x4e435b={'raw':!![],'where':{'id':_0x9edaff['params']['id']}},_0x1e64e7={};_0x1e64e7[_0x7c4b('0x2c')]=_[_0x7c4b('0x2e')](db[_0x7c4b('0x27')][_0x7c4b('0x28')]);_0x1e64e7[_0x7c4b('0x2d')]=_['keys'](_0x9edaff[_0x7c4b('0x2d')]);_0x1e64e7[_0x7c4b('0x3f')]=_[_0x7c4b('0x2f')](_0x1e64e7[_0x7c4b('0x2c')],_0x1e64e7['query']);_0x4e435b[_0x7c4b('0x30')]=_[_0x7c4b('0x2f')](_0x1e64e7[_0x7c4b('0x2c')],qs[_0x7c4b('0x31')](_0x9edaff['query']['fields']));_0x4e435b[_0x7c4b('0x30')]=_0x4e435b[_0x7c4b('0x30')][_0x7c4b('0x32')]?_0x4e435b[_0x7c4b('0x30')]:_0x1e64e7[_0x7c4b('0x2c')];if(_0x9edaff['query'][_0x7c4b('0x40')]){_0x4e435b[_0x7c4b('0x3b')]=[{'all':!![]}];}_0x4e435b=_['merge']({},_0x4e435b,_0x9edaff[_0x7c4b('0x41')]);return db[_0x7c4b('0x27')][_0x7c4b('0x42')](_0x4e435b)['then'](handleEntityNotFound(_0x2ebf7d,null))[_0x7c4b('0x21')](respondWithResult(_0x2ebf7d,null))[_0x7c4b('0x43')](handleError(_0x2ebf7d,null));};exports[_0x7c4b('0x44')]=function(_0x4caa24,_0x5bfa6b){return db[_0x7c4b('0x27')][_0x7c4b('0x44')](_0x4caa24[_0x7c4b('0x45')],{})[_0x7c4b('0x21')](respondWithResult(_0x5bfa6b,0xc9))[_0x7c4b('0x43')](handleError(_0x5bfa6b,null));};exports[_0x7c4b('0x46')]=function(_0x5d50f1,_0x10f3bb){return db[_0x7c4b('0x27')][_0x7c4b('0x42')]({'where':{'id':_0x5d50f1[_0x7c4b('0x47')]['id']}})[_0x7c4b('0x21')](handleEntityNotFound(_0x10f3bb,null))[_0x7c4b('0x21')](removeEntity(_0x10f3bb,null))[_0x7c4b('0x43')](handleError(_0x10f3bb,null));};exports['describe']=function(_0x20c16d,_0x2115fc){return db['VoiceCallReport'][_0x7c4b('0x48')]()[_0x7c4b('0x21')](respondWithResult(_0x2115fc,null))[_0x7c4b('0x43')](handleError(_0x2115fc,null));};exports[_0x7c4b('0x20')]=function(_0x3a10e6,_0x238bef){if(_0x3a10e6[_0x7c4b('0x45')][_0x7c4b('0x49')]){delete _0x3a10e6[_0x7c4b('0x45')]['uniqueid'];}return db[_0x7c4b('0x27')][_0x7c4b('0x42')]({'where':{'uniqueid':_0x3a10e6[_0x7c4b('0x47')]['id'],'UserId':{'$or':[null,_0x3a10e6[_0x7c4b('0x4a')]['id']]}}})['then'](handleEntityNotFound(_0x238bef,null))[_0x7c4b('0x21')](saveUpdates(_0x3a10e6[_0x7c4b('0x45')],null))['then'](respondWithResult(_0x238bef,null))[_0x7c4b('0x43')](handleError(_0x238bef,null));}; \ No newline at end of file +var _0x1b91=['lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','count','offset','set','Content-Range','apply','reject','save','then','status','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VoiceCallReport','includeAll','alias','User','findAll','rows','catch','show','params','include','find','create','destroy','describe','update','body','uniqueid','user','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x19f98d,_0x3e1c0a){var _0x4f9a0d=function(_0x16dd54){while(--_0x16dd54){_0x19f98d['push'](_0x19f98d['shift']());}};_0x4f9a0d(++_0x3e1c0a);}(_0x1b91,0x12d));var _0x11b9=function(_0x3b2115,_0x3fbce1){_0x3b2115=_0x3b2115-0x0;var _0x2ef1c6=_0x1b91[_0x3b2115];return _0x2ef1c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x11b9('0x0'));var rimraf=require(_0x11b9('0x1'));var zipdir=require(_0x11b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11b9('0x3'));var moment=require('moment');var BPromise=require(_0x11b9('0x4'));var Mustache=require(_0x11b9('0x5'));var util=require(_0x11b9('0x6'));var path=require(_0x11b9('0x7'));var sox=require(_0x11b9('0x8'));var csv=require(_0x11b9('0x9'));var ejs=require(_0x11b9('0xa'));var fs=require('fs');var _=require(_0x11b9('0xb'));var squel=require(_0x11b9('0xc'));var crypto=require(_0x11b9('0xd'));var jsforce=require(_0x11b9('0xe'));var deskjs=require(_0x11b9('0xf'));var toCsv=require(_0x11b9('0x9'));var querystring=require('querystring');var Papa=require(_0x11b9('0x10'));var Redis=require('ioredis');var authService=require(_0x11b9('0x11'));var qs=require(_0x11b9('0x12'));var as=require(_0x11b9('0x13'));var hardwareService=require(_0x11b9('0x14'));var logger=require(_0x11b9('0x15'))('api');var utils=require(_0x11b9('0x16'));var config=require('../../config/environment');var db=require(_0x11b9('0x17'))['db'];function respondWithStatusCode(_0x3a4c6f,_0x2bd3ce){_0x2bd3ce=_0x2bd3ce||0xcc;return function(_0x2f9034){if(_0x2f9034){return _0x3a4c6f[_0x11b9('0x18')](_0x2bd3ce);}return _0x3a4c6f['status'](_0x2bd3ce)[_0x11b9('0x19')]();};}function respondWithResult(_0x166f57,_0x367faf){_0x367faf=_0x367faf||0xc8;return function(_0xb47a3a){if(_0xb47a3a){return _0x166f57['status'](_0x367faf)['json'](_0xb47a3a);}};}function respondWithFilteredResult(_0x365595,_0x5e0ce0){return function(_0x173334){if(_0x173334){var _0xca2792=_0x173334[_0x11b9('0x1a')],_0x33cb92=_0x5e0ce0[_0x11b9('0x1b')],_0x1f675a=_0x5e0ce0['offset']+_0x5e0ce0['limit'],_0x26e9f3;if(_0x1f675a>=_0xca2792){_0x1f675a=_0xca2792;_0x26e9f3=0xc8;}else{_0x26e9f3=0xce;}_0x365595['status'](_0x26e9f3);return _0x365595[_0x11b9('0x1c')](_0x11b9('0x1d'),_0x33cb92+'-'+_0x1f675a+'/'+_0xca2792)['json'](_0x173334);}return null;};}function patchUpdates(_0x4d8369){return function(_0x51a582){try{jsonpatch[_0x11b9('0x1e')](_0x51a582,_0x4d8369,!![]);}catch(_0x2ade0d){return BPromise[_0x11b9('0x1f')](_0x2ade0d);}return _0x51a582[_0x11b9('0x20')]();};}function saveUpdates(_0x4b49e9,_0xd85734){return function(_0x13b7a0){if(_0x13b7a0){return _0x13b7a0['update'](_0x4b49e9)[_0x11b9('0x21')](function(_0x2faac0){return _0x2faac0;});}return null;};}function removeEntity(_0x5b505f,_0x360f80){return function(_0x51b2d2){if(_0x51b2d2){return _0x51b2d2['destroy']()[_0x11b9('0x21')](function(){_0x5b505f[_0x11b9('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549810,_0x1d4274){return function(_0x33c4a7){if(!_0x33c4a7){_0x549810[_0x11b9('0x18')](0x194);}return _0x33c4a7;};}function handleError(_0x49e9d8,_0x3ed6b2){_0x3ed6b2=_0x3ed6b2||0x1f4;return function(_0xc4797){logger[_0x11b9('0x23')](_0xc4797[_0x11b9('0x24')]);if(_0xc4797[_0x11b9('0x25')]){delete _0xc4797[_0x11b9('0x25')];}_0x49e9d8[_0x11b9('0x22')](_0x3ed6b2)[_0x11b9('0x26')](_0xc4797);};}exports[_0x11b9('0x27')]=function(_0x31d93d,_0x1ba302){var _0x22f61d={},_0x2bfa5e={},_0x175cf5={'count':0x0,'rows':[]};var _0x48f9e0=_[_0x11b9('0x28')](db['VoiceCallReport'][_0x11b9('0x29')],function(_0x17f87e){return{'name':_0x17f87e['fieldName'],'type':_0x17f87e[_0x11b9('0x2a')][_0x11b9('0x2b')]};});_0x2bfa5e[_0x11b9('0x2c')]=_[_0x11b9('0x28')](_0x48f9e0,_0x11b9('0x25'));_0x2bfa5e[_0x11b9('0x2d')]=_[_0x11b9('0x2e')](_0x31d93d[_0x11b9('0x2d')]);_0x2bfa5e[_0x11b9('0x2f')]=_['intersection'](_0x2bfa5e[_0x11b9('0x2c')],_0x2bfa5e[_0x11b9('0x2d')]);_0x22f61d[_0x11b9('0x30')]=_[_0x11b9('0x31')](_0x2bfa5e[_0x11b9('0x2c')],qs[_0x11b9('0x32')](_0x31d93d[_0x11b9('0x2d')][_0x11b9('0x32')]));_0x22f61d['attributes']=_0x22f61d[_0x11b9('0x30')][_0x11b9('0x33')]?_0x22f61d['attributes']:_0x2bfa5e[_0x11b9('0x2c')];if(!_0x31d93d[_0x11b9('0x2d')][_0x11b9('0x34')](_0x11b9('0x35'))){_0x22f61d[_0x11b9('0x36')]=qs['limit'](_0x31d93d[_0x11b9('0x2d')]['limit']);_0x22f61d[_0x11b9('0x1b')]=qs[_0x11b9('0x1b')](_0x31d93d[_0x11b9('0x2d')][_0x11b9('0x1b')]);}_0x22f61d[_0x11b9('0x37')]=qs[_0x11b9('0x38')](_0x31d93d[_0x11b9('0x2d')][_0x11b9('0x38')]);_0x22f61d[_0x11b9('0x39')]=qs[_0x11b9('0x2f')](_['pick'](_0x31d93d[_0x11b9('0x2d')],_0x2bfa5e[_0x11b9('0x2f')]),_0x48f9e0);if(_0x31d93d[_0x11b9('0x2d')][_0x11b9('0x3a')]){_0x22f61d[_0x11b9('0x39')]=_['merge'](_0x22f61d['where'],{'$or':_[_0x11b9('0x28')](_0x48f9e0,function(_0x5eb215){if(_0x5eb215[_0x11b9('0x2a')]!=='VIRTUAL'){var _0x3e5a41={};_0x3e5a41[_0x5eb215[_0x11b9('0x25')]]={'$like':'%'+_0x31d93d['query'][_0x11b9('0x3a')]+'%'};return _0x3e5a41;}})});}_0x22f61d=_[_0x11b9('0x3b')]({},_0x22f61d,_0x31d93d['options']);var _0x1cb069={'where':_0x22f61d['where']};return db[_0x11b9('0x3c')][_0x11b9('0x1a')](_0x1cb069)['then'](function(_0x29f22e){_0x175cf5[_0x11b9('0x1a')]=_0x29f22e;if(_0x31d93d[_0x11b9('0x2d')][_0x11b9('0x3d')]){_0x22f61d['include']=[{'attributes':['id','name','fullname',_0x11b9('0x3e')],'model':db['User'],'as':_0x11b9('0x3f')}];}return db['VoiceCallReport'][_0x11b9('0x40')](_0x22f61d);})['then'](function(_0x25f0ca){_0x175cf5[_0x11b9('0x41')]=_0x25f0ca;return _0x175cf5;})[_0x11b9('0x21')](respondWithFilteredResult(_0x1ba302,_0x22f61d))[_0x11b9('0x42')](handleError(_0x1ba302,null));};exports[_0x11b9('0x43')]=function(_0x130467,_0x4219c6){var _0x335c9b={'raw':!![],'where':{'id':_0x130467[_0x11b9('0x44')]['id']}},_0x13e38c={};_0x13e38c[_0x11b9('0x2c')]=_['keys'](db[_0x11b9('0x3c')][_0x11b9('0x29')]);_0x13e38c[_0x11b9('0x2d')]=_['keys'](_0x130467[_0x11b9('0x2d')]);_0x13e38c['filters']=_['intersection'](_0x13e38c[_0x11b9('0x2c')],_0x13e38c['query']);_0x335c9b[_0x11b9('0x30')]=_[_0x11b9('0x31')](_0x13e38c[_0x11b9('0x2c')],qs[_0x11b9('0x32')](_0x130467[_0x11b9('0x2d')]['fields']));_0x335c9b[_0x11b9('0x30')]=_0x335c9b[_0x11b9('0x30')]['length']?_0x335c9b['attributes']:_0x13e38c[_0x11b9('0x2c')];if(_0x130467[_0x11b9('0x2d')][_0x11b9('0x3d')]){_0x335c9b[_0x11b9('0x45')]=[{'all':!![]}];}_0x335c9b=_[_0x11b9('0x3b')]({},_0x335c9b,_0x130467['options']);return db[_0x11b9('0x3c')][_0x11b9('0x46')](_0x335c9b)[_0x11b9('0x21')](handleEntityNotFound(_0x4219c6,null))[_0x11b9('0x21')](respondWithResult(_0x4219c6,null))[_0x11b9('0x42')](handleError(_0x4219c6,null));};exports['create']=function(_0x24d907,_0x1ceb7e){return db[_0x11b9('0x3c')][_0x11b9('0x47')](_0x24d907['body'],{})[_0x11b9('0x21')](respondWithResult(_0x1ceb7e,0xc9))[_0x11b9('0x42')](handleError(_0x1ceb7e,null));};exports[_0x11b9('0x48')]=function(_0x16dd3e,_0x2c8377){return db[_0x11b9('0x3c')][_0x11b9('0x46')]({'where':{'id':_0x16dd3e[_0x11b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c8377,null))['then'](removeEntity(_0x2c8377,null))[_0x11b9('0x42')](handleError(_0x2c8377,null));};exports['describe']=function(_0x2c1818,_0x335a5b){return db['VoiceCallReport'][_0x11b9('0x49')]()[_0x11b9('0x21')](respondWithResult(_0x335a5b,null))[_0x11b9('0x42')](handleError(_0x335a5b,null));};exports[_0x11b9('0x4a')]=function(_0x488387,_0x29b1cc){if(_0x488387[_0x11b9('0x4b')][_0x11b9('0x4c')]){delete _0x488387[_0x11b9('0x4b')]['uniqueid'];}return db[_0x11b9('0x3c')]['find']({'where':{'uniqueid':_0x488387[_0x11b9('0x44')]['id'],'UserId':{'$or':[null,_0x488387[_0x11b9('0x4d')]['id']]}}})[_0x11b9('0x21')](handleEntityNotFound(_0x29b1cc,null))[_0x11b9('0x21')](saveUpdates(_0x488387[_0x11b9('0x4b')],null))['then'](respondWithResult(_0x29b1cc,null))[_0x11b9('0x42')](handleError(_0x29b1cc,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index e04ef3f..c54c642 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 _0xc759=['api','moment','bluebird','request-promise','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','util','../../config/logger'];(function(_0x43d874,_0x589981){var _0xc1e168=function(_0x4e2aef){while(--_0x4e2aef){_0x43d874['push'](_0x43d874['shift']());}};_0xc1e168(++_0x589981);}(_0xc759,0xa6));var _0x9c75=function(_0x2e45b6,_0x1df2b1){_0x2e45b6=_0x2e45b6-0x0;var _0x33b662=_0xc759[_0x2e45b6];return _0x33b662;};'use strict';var _=require('lodash');var util=require(_0x9c75('0x0'));var logger=require(_0x9c75('0x1'))(_0x9c75('0x2'));var moment=require(_0x9c75('0x3'));var BPromise=require(_0x9c75('0x4'));var rp=require(_0x9c75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c75('0x6'));var config=require('../../config/environment');var attributes=require(_0x9c75('0x7'));module[_0x9c75('0x8')]=function(_0x494e5f,_0x110bcd){return _0x494e5f[_0x9c75('0x9')](_0x9c75('0xa'),attributes,{'tableName':_0x9c75('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb858=['bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','report_call','lodash','util','api'];(function(_0x403633,_0x328fdc){var _0x416df6=function(_0x56c491){while(--_0x56c491){_0x403633['push'](_0x403633['shift']());}};_0x416df6(++_0x328fdc);}(_0xb858,0x9f));var _0x8b85=function(_0x5f84b4,_0x190e19){_0x5f84b4=_0x5f84b4-0x0;var _0x2c1c3e=_0xb858[_0x5f84b4];return _0x2c1c3e;};'use strict';var _=require(_0x8b85('0x0'));var util=require(_0x8b85('0x1'));var logger=require('../../config/logger')(_0x8b85('0x2'));var moment=require('moment');var BPromise=require(_0x8b85('0x3'));var rp=require(_0x8b85('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b85('0x5'));var config=require(_0x8b85('0x6'));var attributes=require(_0x8b85('0x7'));module['exports']=function(_0x21e72d,_0x25d09a){return _0x21e72d['define']('VoiceCallReport',attributes,{'tableName':_0x8b85('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index cd4134f..bb99b6e 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 _0x32ce=['VoiceCallReport','options','where','attributes','include','map','model','info','GetVoiceCallReport','debug','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4e24a6,_0x1a7f44){var _0x235d8e=function(_0x590bd6){while(--_0x590bd6){_0x4e24a6['push'](_0x4e24a6['shift']());}};_0x235d8e(++_0x1a7f44);}(_0x32ce,0x1eb));var _0xe32c=function(_0x42d1cc,_0x515c4a){_0x42d1cc=_0x42d1cc-0x0;var _0x1adc04=_0x32ce[_0x42d1cc];return _0x1adc04;};'use strict';var _=require(_0xe32c('0x0'));var util=require('util');var moment=require(_0xe32c('0x1'));var BPromise=require(_0xe32c('0x2'));var rs=require(_0xe32c('0x3'));var fs=require('fs');var Redis=require(_0xe32c('0x4'));var db=require(_0xe32c('0x5'))['db'];var utils=require(_0xe32c('0x6'));var logger=require(_0xe32c('0x7'))(_0xe32c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe32c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbb007,_0x2b61f4,_0x2763ae){return new BPromise(function(_0x47f8f7,_0x264835){return client[_0xe32c('0xa')](_0xbb007,_0x2763ae)[_0xe32c('0xb')](function(_0x3b2632){logger['info'](_0xe32c('0xc'),_0x2b61f4,'request\x20sent');logger['debug'](_0xe32c('0xd'),_0x2b61f4,'request\x20sent',JSON[_0xe32c('0xe')](_0x3b2632));if(_0x3b2632[_0xe32c('0xf')]){if(_0x3b2632['error'][_0xe32c('0x10')]===0x1f4){logger[_0xe32c('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x2b61f4,_0x3b2632[_0xe32c('0xf')][_0xe32c('0x11')]);return _0x264835(_0x3b2632['error'][_0xe32c('0x11')]);}logger['error'](_0xe32c('0xc'),_0x2b61f4,_0x3b2632[_0xe32c('0xf')][_0xe32c('0x11')]);return _0x47f8f7(_0x3b2632[_0xe32c('0xf')][_0xe32c('0x11')]);}else{logger['info'](_0xe32c('0xc'),_0x2b61f4,'request\x20sent');_0x47f8f7(_0x3b2632['result'][_0xe32c('0x11')]);}})[_0xe32c('0x12')](function(_0x3eb689){logger[_0xe32c('0xf')](_0xe32c('0xc'),_0x2b61f4,_0x3eb689);_0x264835(_0x3eb689);});});}exports['GetVoiceCallReport']=function(_0x2f1b0e){var _0x1bce4a=this;return new Promise(function(_0x4d5f10,_0x423dbc){return db[_0xe32c('0x13')]['findAll']({'raw':_0x2f1b0e['options']?_0x2f1b0e[_0xe32c('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2f1b0e[_0xe32c('0x14')]?_0x2f1b0e[_0xe32c('0x14')][_0xe32c('0x15')]||null:null,'attributes':_0x2f1b0e[_0xe32c('0x14')]?_0x2f1b0e[_0xe32c('0x14')][_0xe32c('0x16')]||null:null,'limit':_0x2f1b0e[_0xe32c('0x14')]?_0x2f1b0e[_0xe32c('0x14')]['limit']||null:null,'include':_0x2f1b0e['options']?_0x2f1b0e[_0xe32c('0x14')][_0xe32c('0x17')]?_[_0xe32c('0x18')](_0x2f1b0e[_0xe32c('0x14')]['include'],function(_0x352fc5){return{'model':db[_0x352fc5[_0xe32c('0x19')]],'as':_0x352fc5['as'],'attributes':_0x352fc5[_0xe32c('0x16')],'include':_0x352fc5[_0xe32c('0x17')]?_[_0xe32c('0x18')](_0x352fc5['include'],function(_0x5e01ee){return{'model':db[_0x5e01ee['model']],'as':_0x5e01ee['as'],'attributes':_0x5e01ee['attributes'],'include':_0x5e01ee[_0xe32c('0x17')]?_[_0xe32c('0x18')](_0x5e01ee[_0xe32c('0x17')],function(_0x5cf543){return{'model':db[_0x5cf543[_0xe32c('0x19')]],'as':_0x5cf543['as'],'attributes':_0x5cf543[_0xe32c('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b2b94){logger[_0xe32c('0x1a')](_0xe32c('0x1b'),_0x2f1b0e);logger[_0xe32c('0x1c')](_0xe32c('0x1b'),_0x2f1b0e,JSON[_0xe32c('0xe')](_0x5b2b94));_0x4d5f10(_0x5b2b94);})[_0xe32c('0x12')](function(_0x44bfc6){logger['error'](_0xe32c('0x1b'),_0x44bfc6[_0xe32c('0x11')],_0x2f1b0e);_0x423dbc(_0x1bce4a[_0xe32c('0xf')](0x1f4,_0x44bfc6['message']));});});};exports[_0xe32c('0x1d')]=function(_0x1cb5e7){var _0xf00c81=this;return new Promise(function(_0x1a0d2a,_0x5081a8){return db[_0xe32c('0x13')][_0xe32c('0x1e')](_0x1cb5e7['body'],{'raw':_0x1cb5e7[_0xe32c('0x14')]?_0x1cb5e7['options']['raw']===undefined?!![]:![]:!![]})[_0xe32c('0xb')](function(_0x5ebe79){logger[_0xe32c('0x1a')](_0xe32c('0x1d'),_0x1cb5e7);logger[_0xe32c('0x1c')]('CreateVoiceCallReport',_0x1cb5e7,JSON[_0xe32c('0xe')](_0x5ebe79));_0x1a0d2a(_0x5ebe79);})['catch'](function(_0x27ca25){logger[_0xe32c('0xf')]('CreateVoiceCallReport',_0x27ca25[_0xe32c('0x11')],_0x1cb5e7);_0x5081a8(_0xf00c81[_0xe32c('0xf')](0x1f4,_0x27ca25[_0xe32c('0x11')]));});});};exports[_0xe32c('0x1f')]=function(_0x561492){var _0x397300=this;return new Promise(function(_0x23b231,_0x286ef3){return db[_0xe32c('0x13')][_0xe32c('0x20')](_0x561492['body'],{'raw':_0x561492[_0xe32c('0x14')]?_0x561492[_0xe32c('0x14')][_0xe32c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x561492[_0xe32c('0x14')]?_0x561492[_0xe32c('0x14')][_0xe32c('0x15')]||null:null,'attributes':_0x561492[_0xe32c('0x14')]?_0x561492['options']['attributes']||null:null,'limit':_0x561492['options']?_0x561492[_0xe32c('0x14')]['limit']||null:null})[_0xe32c('0xb')](function(_0xf42734){logger[_0xe32c('0x1a')](_0xe32c('0x1f'),_0x561492);logger[_0xe32c('0x1c')](_0xe32c('0x1f'),_0x561492,JSON[_0xe32c('0xe')](_0xf42734));_0x23b231(_0xf42734);})[_0xe32c('0x12')](function(_0x24f493){logger[_0xe32c('0xf')](_0xe32c('0x1f'),_0x24f493[_0xe32c('0x11')],_0x561492);_0x286ef3(_0x397300[_0xe32c('0xf')](0x1f4,_0x24f493[_0xe32c('0x11')]));});});}; \ No newline at end of file +var _0x694a=['UpdateVoiceCallReport','update','body','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','limit','include','attributes','map','model','CreateVoiceCallReport','create'];(function(_0x39649f,_0x4e0e87){var _0x4edf8a=function(_0x502901){while(--_0x502901){_0x39649f['push'](_0x39649f['shift']());}};_0x4edf8a(++_0x4e0e87);}(_0x694a,0x76));var _0xa694=function(_0x1ef8c2,_0x53bd14){_0x1ef8c2=_0x1ef8c2-0x0;var _0x394a67=_0x694a[_0x1ef8c2];return _0x394a67;};'use strict';var _=require(_0xa694('0x0'));var util=require(_0xa694('0x1'));var moment=require(_0xa694('0x2'));var BPromise=require(_0xa694('0x3'));var rs=require(_0xa694('0x4'));var fs=require('fs');var Redis=require(_0xa694('0x5'));var db=require(_0xa694('0x6'))['db'];var utils=require(_0xa694('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa694('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa694('0x9')][_0xa694('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x278377,_0x23a91f,_0x4f947c){return new BPromise(function(_0x2e19ee,_0x818d5d){return client[_0xa694('0xb')](_0x278377,_0x4f947c)[_0xa694('0xc')](function(_0x27fa0b){logger[_0xa694('0xd')](_0xa694('0xe'),_0x23a91f,_0xa694('0xf'));logger[_0xa694('0x10')](_0xa694('0x11'),_0x23a91f,_0xa694('0xf'),JSON[_0xa694('0x12')](_0x27fa0b));if(_0x27fa0b[_0xa694('0x13')]){if(_0x27fa0b[_0xa694('0x13')]['code']===0x1f4){logger[_0xa694('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x23a91f,_0x27fa0b['error'][_0xa694('0x14')]);return _0x818d5d(_0x27fa0b['error'][_0xa694('0x14')]);}logger['error'](_0xa694('0xe'),_0x23a91f,_0x27fa0b[_0xa694('0x13')][_0xa694('0x14')]);return _0x2e19ee(_0x27fa0b['error'][_0xa694('0x14')]);}else{logger[_0xa694('0xd')](_0xa694('0xe'),_0x23a91f,_0xa694('0xf'));_0x2e19ee(_0x27fa0b[_0xa694('0x15')][_0xa694('0x14')]);}})[_0xa694('0x16')](function(_0x1449cc){logger[_0xa694('0x13')](_0xa694('0xe'),_0x23a91f,_0x1449cc);_0x818d5d(_0x1449cc);});});}exports[_0xa694('0x17')]=function(_0x19da3a){var _0x90e379=this;return new Promise(function(_0x2d4256,_0x16c745){return db[_0xa694('0x18')]['findAll']({'raw':_0x19da3a[_0xa694('0x19')]?_0x19da3a[_0xa694('0x19')][_0xa694('0x1a')]===undefined?!![]:![]:!![],'where':_0x19da3a[_0xa694('0x19')]?_0x19da3a[_0xa694('0x19')]['where']||null:null,'attributes':_0x19da3a['options']?_0x19da3a['options']['attributes']||null:null,'limit':_0x19da3a[_0xa694('0x19')]?_0x19da3a[_0xa694('0x19')][_0xa694('0x1b')]||null:null,'include':_0x19da3a[_0xa694('0x19')]?_0x19da3a['options'][_0xa694('0x1c')]?_['map'](_0x19da3a['options'][_0xa694('0x1c')],function(_0x4090a6){return{'model':db[_0x4090a6['model']],'as':_0x4090a6['as'],'attributes':_0x4090a6[_0xa694('0x1d')],'include':_0x4090a6['include']?_[_0xa694('0x1e')](_0x4090a6[_0xa694('0x1c')],function(_0x163813){return{'model':db[_0x163813[_0xa694('0x1f')]],'as':_0x163813['as'],'attributes':_0x163813[_0xa694('0x1d')],'include':_0x163813['include']?_[_0xa694('0x1e')](_0x163813[_0xa694('0x1c')],function(_0x22190b){return{'model':db[_0x22190b[_0xa694('0x1f')]],'as':_0x22190b['as'],'attributes':_0x22190b['attributes']};}):[]};}):[]};}):[]:[]})[_0xa694('0xc')](function(_0x3891de){logger[_0xa694('0xd')](_0xa694('0x17'),_0x19da3a);logger['debug'](_0xa694('0x17'),_0x19da3a,JSON[_0xa694('0x12')](_0x3891de));_0x2d4256(_0x3891de);})[_0xa694('0x16')](function(_0x43ed4f){logger[_0xa694('0x13')]('GetVoiceCallReport',_0x43ed4f[_0xa694('0x14')],_0x19da3a);_0x16c745(_0x90e379[_0xa694('0x13')](0x1f4,_0x43ed4f[_0xa694('0x14')]));});});};exports[_0xa694('0x20')]=function(_0x59cbc4){var _0x3f4135=this;return new Promise(function(_0x408cc5,_0x5b0d02){return db[_0xa694('0x18')][_0xa694('0x21')](_0x59cbc4['body'],{'raw':_0x59cbc4[_0xa694('0x19')]?_0x59cbc4[_0xa694('0x19')][_0xa694('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x71c8ab){logger[_0xa694('0xd')](_0xa694('0x20'),_0x59cbc4);logger[_0xa694('0x10')](_0xa694('0x20'),_0x59cbc4,JSON[_0xa694('0x12')](_0x71c8ab));_0x408cc5(_0x71c8ab);})[_0xa694('0x16')](function(_0x4759b5){logger[_0xa694('0x13')]('CreateVoiceCallReport',_0x4759b5[_0xa694('0x14')],_0x59cbc4);_0x5b0d02(_0x3f4135[_0xa694('0x13')](0x1f4,_0x4759b5[_0xa694('0x14')]));});});};exports[_0xa694('0x22')]=function(_0x58ee20){var _0x42bd6f=this;return new Promise(function(_0x534cc0,_0x14d243){return db[_0xa694('0x18')][_0xa694('0x23')](_0x58ee20[_0xa694('0x24')],{'raw':_0x58ee20['options']?_0x58ee20['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58ee20[_0xa694('0x19')]?_0x58ee20[_0xa694('0x19')][_0xa694('0x25')]||null:null,'attributes':_0x58ee20[_0xa694('0x19')]?_0x58ee20[_0xa694('0x19')][_0xa694('0x1d')]||null:null,'limit':_0x58ee20['options']?_0x58ee20[_0xa694('0x19')][_0xa694('0x1b')]||null:null})[_0xa694('0xc')](function(_0xfd9eb7){logger[_0xa694('0xd')](_0xa694('0x22'),_0x58ee20);logger[_0xa694('0x10')](_0xa694('0x22'),_0x58ee20,JSON[_0xa694('0x12')](_0xfd9eb7));_0x534cc0(_0xfd9eb7);})[_0xa694('0x16')](function(_0x4d7c2d){logger[_0xa694('0x13')]('UpdateVoiceCallReport',_0x4d7c2d['message'],_0x58ee20);_0x14d243(_0x42bd6f[_0xa694('0x13')](0x1f4,_0x4d7c2d[_0xa694('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e6f3c1e..fd78aeb 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 _0xfc03=['post','create','put','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceChanSpy.controller','get','/:id','isAuthenticated'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0xfc03,0x103));var _0x3fc0=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xfc03[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0x3fc0('0x0'));var util=require(_0x3fc0('0x1'));var path=require(_0x3fc0('0x2'));var timeout=require(_0x3fc0('0x3'));var express=require(_0x3fc0('0x4'));var router=express[_0x3fc0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3fc0('0x6'));var config=require('../../config/environment');var controller=require(_0x3fc0('0x7'));router[_0x3fc0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3fc0('0x8')](_0x3fc0('0x9'),auth[_0x3fc0('0xa')](),controller['show']);router[_0x3fc0('0xb')]('/',auth['isAuthenticated'](),controller[_0x3fc0('0xc')]);router[_0x3fc0('0xd')](_0x3fc0('0x9'),auth[_0x3fc0('0xa')](),controller['update']);router[_0x3fc0('0xe')](_0x3fc0('0x9'),auth[_0x3fc0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2c8f=['destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x438fea,_0x3444e8){var _0x4069a5=function(_0x1595ee){while(--_0x1595ee){_0x438fea['push'](_0x438fea['shift']());}};_0x4069a5(++_0x3444e8);}(_0x2c8f,0x192));var _0xf2c8=function(_0x408287,_0x37512d){_0x408287=_0x408287-0x0;var _0x40715c=_0x2c8f[_0x408287];return _0x40715c;};'use strict';var multer=require('multer');var util=require(_0xf2c8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf2c8('0x1')]();var auth=require(_0xf2c8('0x2'));var interaction=require(_0xf2c8('0x3'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0xf2c8('0x4')]('/',auth[_0xf2c8('0x5')](),controller[_0xf2c8('0x6')]);router[_0xf2c8('0x4')](_0xf2c8('0x7'),auth['isAuthenticated'](),controller[_0xf2c8('0x8')]);router[_0xf2c8('0x9')]('/',auth[_0xf2c8('0x5')](),controller[_0xf2c8('0xa')]);router[_0xf2c8('0xb')](_0xf2c8('0x7'),auth['isAuthenticated'](),controller[_0xf2c8('0xc')]);router[_0xf2c8('0xd')](_0xf2c8('0x7'),auth[_0xf2c8('0x5')](),controller[_0xf2c8('0xe')]);module[_0xf2c8('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 665fb31..0f3480b 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 _0xbd54=['getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name','join'];(function(_0x2f31b1,_0x17daa8){var _0x448988=function(_0x540f6b){while(--_0x540f6b){_0x2f31b1['push'](_0x2f31b1['shift']());}};_0x448988(++_0x17daa8);}(_0xbd54,0x67));var _0x4bd5=function(_0x583b14,_0x59fe86){_0x583b14=_0x583b14-0x0;var _0x8214dc=_0xbd54[_0x583b14];return _0x8214dc;};'use strict';var Sequelize=require(_0x4bd5('0x0'));module[_0x4bd5('0x1')]={'name':{'type':Sequelize[_0x4bd5('0x2')]},'prefix':{'type':Sequelize[_0x4bd5('0x2')],'unique':_0x4bd5('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x4bd5('0x2')],'set':function(_0x436531){this['setDataValue']('options',_0x436531?_0x436531[_0x4bd5('0x4')](''):[]);},'get':function(){return this[_0x4bd5('0x5')](_0x4bd5('0x6'))?this[_0x4bd5('0x5')](_0x4bd5('0x6'))[_0x4bd5('0x7')](''):[];}},'auth':{'type':Sequelize[_0x4bd5('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x4bd5('0x2')]},'record':{'type':Sequelize[_0x4bd5('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4bd5('0x2')]},'description':{'type':Sequelize[_0x4bd5('0x2')]}}; \ No newline at end of file +var _0x9181=['name','setDataValue','options','getDataValue','BOOLEAN','sequelize','STRING'];(function(_0x103a35,_0x530953){var _0x6a3143=function(_0x241e84){while(--_0x241e84){_0x103a35['push'](_0x103a35['shift']());}};_0x6a3143(++_0x530953);}(_0x9181,0xa6));var _0x1918=function(_0x180928,_0x5277ff){_0x180928=_0x180928-0x0;var _0x519412=_0x9181[_0x180928];return _0x519412;};'use strict';var Sequelize=require(_0x1918('0x0'));module['exports']={'name':{'type':Sequelize[_0x1918('0x1')]},'prefix':{'type':Sequelize[_0x1918('0x1')],'unique':_0x1918('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x1918('0x1')],'set':function(_0x555dca){this[_0x1918('0x3')](_0x1918('0x4'),_0x555dca?_0x555dca['join'](''):[]);},'get':function(){return this[_0x1918('0x5')](_0x1918('0x4'))?this['getDataValue'](_0x1918('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x1918('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x1918('0x1')]},'record':{'type':Sequelize[_0x1918('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1918('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2563813..c2105f7 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 _0x3f6d=['mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','count','offset','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3f6d,0x1da));var _0xd3f6=function(_0x3526a5,_0x56825d){_0x3526a5=_0x3526a5-0x0;var _0x44f869=_0x3f6d[_0x3526a5];return _0x44f869;};'use strict';var pdf=require(_0xd3f6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd3f6('0x1'));var jsonpatch=require(_0xd3f6('0x2'));var rp=require(_0xd3f6('0x3'));var moment=require(_0xd3f6('0x4'));var BPromise=require(_0xd3f6('0x5'));var Mustache=require(_0xd3f6('0x6'));var util=require(_0xd3f6('0x7'));var path=require(_0xd3f6('0x8'));var sox=require(_0xd3f6('0x9'));var csv=require(_0xd3f6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd3f6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd3f6('0xc'));var deskjs=require(_0xd3f6('0xd'));var toCsv=require(_0xd3f6('0xa'));var querystring=require('querystring');var Papa=require(_0xd3f6('0xe'));var Redis=require(_0xd3f6('0xf'));var authService=require(_0xd3f6('0x10'));var qs=require(_0xd3f6('0x11'));var as=require(_0xd3f6('0x12'));var hardwareService=require(_0xd3f6('0x13'));var logger=require(_0xd3f6('0x14'))(_0xd3f6('0x15'));var utils=require('../../config/utils');var config=require(_0xd3f6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb549,_0x1fc584){_0x1fc584=_0x1fc584||0xcc;return function(_0x2e4541){if(_0x2e4541){return _0x3eb549[_0xd3f6('0x17')](_0x1fc584);}return _0x3eb549['status'](_0x1fc584)[_0xd3f6('0x18')]();};}function respondWithResult(_0x1492ca,_0x40c3b4){_0x40c3b4=_0x40c3b4||0xc8;return function(_0xea6e23){if(_0xea6e23){return _0x1492ca[_0xd3f6('0x19')](_0x40c3b4)['json'](_0xea6e23);}};}function respondWithFilteredResult(_0x383e6e,_0x2e07a1){return function(_0x45297b){if(_0x45297b){var _0x4fad75=_0x45297b[_0xd3f6('0x1a')],_0x3ff280=_0x2e07a1[_0xd3f6('0x1b')],_0x36b01=_0x2e07a1[_0xd3f6('0x1b')]+_0x2e07a1['limit'],_0x3d8399;if(_0x36b01>=_0x4fad75){_0x36b01=_0x4fad75;_0x3d8399=0xc8;}else{_0x3d8399=0xce;}_0x383e6e[_0xd3f6('0x19')](_0x3d8399);return _0x383e6e['set']('Content-Range',_0x3ff280+'-'+_0x36b01+'/'+_0x4fad75)['json'](_0x45297b);}return null;};}function patchUpdates(_0x210dbc){return function(_0x425c2b){try{jsonpatch[_0xd3f6('0x1c')](_0x425c2b,_0x210dbc,!![]);}catch(_0x46aefc){return BPromise[_0xd3f6('0x1d')](_0x46aefc);}return _0x425c2b[_0xd3f6('0x1e')]();};}function saveUpdates(_0x588218,_0x3abe54){return function(_0x5d79a0){if(_0x5d79a0){return _0x5d79a0[_0xd3f6('0x1f')](_0x588218)['then'](function(_0x2fa62e){return _0x2fa62e;});}return null;};}function removeEntity(_0x5087de,_0x197685){return function(_0x52eb64){if(_0x52eb64){return _0x52eb64[_0xd3f6('0x20')]()[_0xd3f6('0x21')](function(){var _0x1e33bd=_0x52eb64[_0xd3f6('0x22')]({'plain':!![]});var _0x3579fe='ChanSpies';return db[_0xd3f6('0x23')][_0xd3f6('0x20')]({'where':{'type':_0x3579fe,'resourceId':_0x1e33bd['id']}})[_0xd3f6('0x21')](function(){return _0x52eb64;});})[_0xd3f6('0x21')](function(){_0x5087de[_0xd3f6('0x19')](0xcc)[_0xd3f6('0x18')]();});}};}function handleEntityNotFound(_0x58b0e5,_0x51b013){return function(_0x2d2b86){if(!_0x2d2b86){_0x58b0e5['sendStatus'](0x194);}return _0x2d2b86;};}function handleError(_0x352d88,_0x1570a8){_0x1570a8=_0x1570a8||0x1f4;return function(_0x29b78b){logger['error'](_0x29b78b[_0xd3f6('0x24')]);if(_0x29b78b[_0xd3f6('0x25')]){delete _0x29b78b['name'];}_0x352d88['status'](_0x1570a8)[_0xd3f6('0x26')](_0x29b78b);};}exports[_0xd3f6('0x27')]=function(_0x40cdc8,_0x5a4458){var _0x43bff1={},_0x385ea9={},_0x4989c1={'count':0x0,'rows':[]};var _0x34de82=_[_0xd3f6('0x28')](db[_0xd3f6('0x29')]['rawAttributes'],function(_0x48cb0d){return{'name':_0x48cb0d[_0xd3f6('0x2a')],'type':_0x48cb0d[_0xd3f6('0x2b')][_0xd3f6('0x2c')]};});_0x385ea9[_0xd3f6('0x2d')]=_[_0xd3f6('0x28')](_0x34de82,_0xd3f6('0x25'));_0x385ea9[_0xd3f6('0x2e')]=_[_0xd3f6('0x2f')](_0x40cdc8[_0xd3f6('0x2e')]);_0x385ea9[_0xd3f6('0x30')]=_[_0xd3f6('0x31')](_0x385ea9['model'],_0x385ea9[_0xd3f6('0x2e')]);_0x43bff1[_0xd3f6('0x32')]=_[_0xd3f6('0x31')](_0x385ea9[_0xd3f6('0x2d')],qs[_0xd3f6('0x33')](_0x40cdc8[_0xd3f6('0x2e')][_0xd3f6('0x33')]));_0x43bff1[_0xd3f6('0x32')]=_0x43bff1[_0xd3f6('0x32')][_0xd3f6('0x34')]?_0x43bff1['attributes']:_0x385ea9['model'];if(!_0x40cdc8[_0xd3f6('0x2e')]['hasOwnProperty']('nolimit')){_0x43bff1[_0xd3f6('0x35')]=qs['limit'](_0x40cdc8[_0xd3f6('0x2e')][_0xd3f6('0x35')]);_0x43bff1[_0xd3f6('0x1b')]=qs['offset'](_0x40cdc8[_0xd3f6('0x2e')]['offset']);}_0x43bff1[_0xd3f6('0x36')]=qs[_0xd3f6('0x37')](_0x40cdc8['query'][_0xd3f6('0x37')]);_0x43bff1[_0xd3f6('0x38')]=qs[_0xd3f6('0x30')](_[_0xd3f6('0x39')](_0x40cdc8['query'],_0x385ea9[_0xd3f6('0x30')]),_0x34de82);if(_0x40cdc8[_0xd3f6('0x2e')][_0xd3f6('0x3a')]){_0x43bff1[_0xd3f6('0x38')]=_[_0xd3f6('0x3b')](_0x43bff1['where'],{'$or':_[_0xd3f6('0x28')](_0x34de82,function(_0x2e9893){if(_0x2e9893[_0xd3f6('0x2b')]!==_0xd3f6('0x3c')){var _0xc8e997={};_0xc8e997[_0x2e9893['name']]={'$like':'%'+_0x40cdc8[_0xd3f6('0x2e')][_0xd3f6('0x3a')]+'%'};return _0xc8e997;}})});}_0x43bff1=_[_0xd3f6('0x3b')]({},_0x43bff1,_0x40cdc8[_0xd3f6('0x3d')]);var _0xe61af8={'where':_0x43bff1['where']};return db['VoiceChanSpy'][_0xd3f6('0x1a')](_0xe61af8)[_0xd3f6('0x21')](function(_0x4de058){_0x4989c1['count']=_0x4de058;if(_0x40cdc8[_0xd3f6('0x2e')]['includeAll']){_0x43bff1[_0xd3f6('0x3e')]=[{'all':!![]}];}return db[_0xd3f6('0x29')]['findAll'](_0x43bff1);})[_0xd3f6('0x21')](function(_0x2d3020){_0x4989c1[_0xd3f6('0x3f')]=_0x2d3020;return _0x4989c1;})[_0xd3f6('0x21')](respondWithFilteredResult(_0x5a4458,_0x43bff1))[_0xd3f6('0x40')](handleError(_0x5a4458,null));};exports['show']=function(_0x3df6f2,_0x1c28ce){var _0x407a3e={'raw':![],'where':{'id':_0x3df6f2['params']['id']}},_0x1a1b2b={};_0x1a1b2b['model']=_[_0xd3f6('0x2f')](db['VoiceChanSpy'][_0xd3f6('0x41')]);_0x1a1b2b[_0xd3f6('0x2e')]=_[_0xd3f6('0x2f')](_0x3df6f2[_0xd3f6('0x2e')]);_0x1a1b2b['filters']=_[_0xd3f6('0x31')](_0x1a1b2b['model'],_0x1a1b2b[_0xd3f6('0x2e')]);_0x407a3e[_0xd3f6('0x32')]=_[_0xd3f6('0x31')](_0x1a1b2b[_0xd3f6('0x2d')],qs['fields'](_0x3df6f2[_0xd3f6('0x2e')][_0xd3f6('0x33')]));_0x407a3e[_0xd3f6('0x32')]=_0x407a3e[_0xd3f6('0x32')]['length']?_0x407a3e[_0xd3f6('0x32')]:_0x1a1b2b[_0xd3f6('0x2d')];if(_0x3df6f2[_0xd3f6('0x2e')][_0xd3f6('0x42')]){_0x407a3e['include']=[{'all':!![]}];}_0x407a3e=_['merge']({},_0x407a3e,_0x3df6f2[_0xd3f6('0x3d')]);return db[_0xd3f6('0x29')][_0xd3f6('0x43')](_0x407a3e)[_0xd3f6('0x21')](handleEntityNotFound(_0x1c28ce,null))[_0xd3f6('0x21')](respondWithResult(_0x1c28ce,null))['catch'](handleError(_0x1c28ce,null));};exports[_0xd3f6('0x44')]=function(_0x2f7a42,_0x1ffa3e){return db[_0xd3f6('0x29')][_0xd3f6('0x44')](_0x2f7a42[_0xd3f6('0x45')],{})['then'](function(_0x3a0e88){var _0x53c1b7=_0x2f7a42[_0xd3f6('0x46')][_0xd3f6('0x22')]({'plain':!![]});if(!_0x53c1b7)throw new Error(_0xd3f6('0x47'));if(_0x53c1b7[_0xd3f6('0x48')]===_0xd3f6('0x46')){var _0x180738=_0x3a0e88[_0xd3f6('0x22')]({'plain':!![]});var _0xa794d6=_0xd3f6('0x49');return db[_0xd3f6('0x4a')]['find']({'where':{'name':_0xa794d6,'userProfileId':_0x53c1b7[_0xd3f6('0x4b')]},'raw':!![]})[_0xd3f6('0x21')](function(_0x1c0ed0){if(_0x1c0ed0&&_0x1c0ed0[_0xd3f6('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x180738[_0xd3f6('0x25')],'resourceId':_0x180738['id'],'type':_0x1c0ed0[_0xd3f6('0x25')],'sectionId':_0x1c0ed0['id']},{})['then'](function(){return _0x3a0e88;});}else{return _0x3a0e88;}})[_0xd3f6('0x40')](function(_0x149b4b){logger[_0xd3f6('0x4d')](_0xd3f6('0x4e'),_0x149b4b);throw _0x149b4b;});}return _0x3a0e88;})[_0xd3f6('0x21')](respondWithResult(_0x1ffa3e,0xc9))['catch'](handleError(_0x1ffa3e,null));};exports[_0xd3f6('0x1f')]=function(_0x38f71f,_0x5aceb2){if(_0x38f71f['body']['id']){delete _0x38f71f[_0xd3f6('0x45')]['id'];}return db[_0xd3f6('0x29')][_0xd3f6('0x43')]({'where':{'id':_0x38f71f[_0xd3f6('0x4f')]['id']}})[_0xd3f6('0x21')](handleEntityNotFound(_0x5aceb2,null))[_0xd3f6('0x21')](saveUpdates(_0x38f71f[_0xd3f6('0x45')],null))['then'](respondWithResult(_0x5aceb2,null))[_0xd3f6('0x40')](handleError(_0x5aceb2,null));};exports[_0xd3f6('0x20')]=function(_0x486a3b,_0x17163e){return db[_0xd3f6('0x29')][_0xd3f6('0x43')]({'where':{'id':_0x486a3b['params']['id']}})[_0xd3f6('0x21')](handleEntityNotFound(_0x17163e,null))[_0xd3f6('0x21')](removeEntity(_0x17163e,null))[_0xd3f6('0x40')](handleError(_0x17163e,null));}; \ No newline at end of file +var _0x6bb2=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','ChanSpies','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','VIRTUAL','filter','merge','options','findAll','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x5e7388,_0x2ac0a4){var _0x52adb3=function(_0x36429f){while(--_0x36429f){_0x5e7388['push'](_0x5e7388['shift']());}};_0x52adb3(++_0x2ac0a4);}(_0x6bb2,0x1c7));var _0x26bb=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x6bb2[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x26bb('0x0'));var emlformat=require(_0x26bb('0x1'));var rimraf=require(_0x26bb('0x2'));var zipdir=require(_0x26bb('0x3'));var jsonpatch=require(_0x26bb('0x4'));var rp=require(_0x26bb('0x5'));var moment=require(_0x26bb('0x6'));var BPromise=require(_0x26bb('0x7'));var Mustache=require(_0x26bb('0x8'));var util=require(_0x26bb('0x9'));var path=require(_0x26bb('0xa'));var sox=require(_0x26bb('0xb'));var csv=require(_0x26bb('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x26bb('0xd'));var squel=require(_0x26bb('0xe'));var crypto=require(_0x26bb('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x26bb('0x10'));var toCsv=require('to-csv');var querystring=require(_0x26bb('0x11'));var Papa=require(_0x26bb('0x12'));var Redis=require(_0x26bb('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x26bb('0x14'));var as=require(_0x26bb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26bb('0x16'))(_0x26bb('0x17'));var utils=require(_0x26bb('0x18'));var config=require(_0x26bb('0x19'));var db=require(_0x26bb('0x1a'))['db'];function respondWithStatusCode(_0x15f1ba,_0x171a9b){_0x171a9b=_0x171a9b||0xcc;return function(_0x3db8e1){if(_0x3db8e1){return _0x15f1ba[_0x26bb('0x1b')](_0x171a9b);}return _0x15f1ba[_0x26bb('0x1c')](_0x171a9b)[_0x26bb('0x1d')]();};}function respondWithResult(_0xa825,_0x29826e){_0x29826e=_0x29826e||0xc8;return function(_0x57b056){if(_0x57b056){return _0xa825['status'](_0x29826e)[_0x26bb('0x1e')](_0x57b056);}};}function respondWithFilteredResult(_0x28a1e8,_0x15e219){return function(_0x196d59){if(_0x196d59){var _0x483fbb=_0x196d59[_0x26bb('0x1f')],_0x2d677a=_0x15e219[_0x26bb('0x20')],_0x46a75a=_0x15e219[_0x26bb('0x20')]+_0x15e219[_0x26bb('0x21')],_0xcc2c8c;if(_0x46a75a>=_0x483fbb){_0x46a75a=_0x483fbb;_0xcc2c8c=0xc8;}else{_0xcc2c8c=0xce;}_0x28a1e8[_0x26bb('0x1c')](_0xcc2c8c);return _0x28a1e8[_0x26bb('0x22')]('Content-Range',_0x2d677a+'-'+_0x46a75a+'/'+_0x483fbb)[_0x26bb('0x1e')](_0x196d59);}return null;};}function patchUpdates(_0x36473d){return function(_0x164c97){try{jsonpatch[_0x26bb('0x23')](_0x164c97,_0x36473d,!![]);}catch(_0x5950fd){return BPromise[_0x26bb('0x24')](_0x5950fd);}return _0x164c97[_0x26bb('0x25')]();};}function saveUpdates(_0x217022,_0x35c3b5){return function(_0x406207){if(_0x406207){return _0x406207[_0x26bb('0x26')](_0x217022)[_0x26bb('0x27')](function(_0x7f562){return _0x7f562;});}return null;};}function removeEntity(_0x203978,_0x52fe63){return function(_0x23bb95){if(_0x23bb95){return _0x23bb95['destroy']()[_0x26bb('0x27')](function(){var _0x449b28=_0x23bb95[_0x26bb('0x28')]({'plain':!![]});var _0x3cc0dc=_0x26bb('0x29');return db[_0x26bb('0x2a')]['destroy']({'where':{'type':_0x3cc0dc,'resourceId':_0x449b28['id']}})[_0x26bb('0x27')](function(){return _0x23bb95;});})[_0x26bb('0x27')](function(){_0x203978[_0x26bb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28fc85,_0x1f871e){return function(_0x8c087){if(!_0x8c087){_0x28fc85[_0x26bb('0x1b')](0x194);}return _0x8c087;};}function handleError(_0x146e3f,_0x1107c2){_0x1107c2=_0x1107c2||0x1f4;return function(_0x184ec4){logger['error'](_0x184ec4[_0x26bb('0x2b')]);if(_0x184ec4[_0x26bb('0x2c')]){delete _0x184ec4[_0x26bb('0x2c')];}_0x146e3f[_0x26bb('0x1c')](_0x1107c2)[_0x26bb('0x2d')](_0x184ec4);};}exports[_0x26bb('0x2e')]=function(_0x46973e,_0x16e487){var _0x9260d4={},_0x233fbc={},_0x299cbe={'count':0x0,'rows':[]};var _0x360ed3=_[_0x26bb('0x2f')](db[_0x26bb('0x30')][_0x26bb('0x31')],function(_0x3bf093){return{'name':_0x3bf093[_0x26bb('0x32')],'type':_0x3bf093[_0x26bb('0x33')]['key']};});_0x233fbc[_0x26bb('0x34')]=_['map'](_0x360ed3,_0x26bb('0x2c'));_0x233fbc[_0x26bb('0x35')]=_[_0x26bb('0x36')](_0x46973e[_0x26bb('0x35')]);_0x233fbc[_0x26bb('0x37')]=_[_0x26bb('0x38')](_0x233fbc[_0x26bb('0x34')],_0x233fbc['query']);_0x9260d4[_0x26bb('0x39')]=_[_0x26bb('0x38')](_0x233fbc[_0x26bb('0x34')],qs[_0x26bb('0x3a')](_0x46973e[_0x26bb('0x35')][_0x26bb('0x3a')]));_0x9260d4['attributes']=_0x9260d4['attributes'][_0x26bb('0x3b')]?_0x9260d4[_0x26bb('0x39')]:_0x233fbc[_0x26bb('0x34')];if(!_0x46973e[_0x26bb('0x35')]['hasOwnProperty'](_0x26bb('0x3c'))){_0x9260d4['limit']=qs['limit'](_0x46973e[_0x26bb('0x35')][_0x26bb('0x21')]);_0x9260d4[_0x26bb('0x20')]=qs[_0x26bb('0x20')](_0x46973e[_0x26bb('0x35')][_0x26bb('0x20')]);}_0x9260d4['order']=qs[_0x26bb('0x3d')](_0x46973e[_0x26bb('0x35')][_0x26bb('0x3d')]);_0x9260d4[_0x26bb('0x3e')]=qs[_0x26bb('0x37')](_['pick'](_0x46973e['query'],_0x233fbc[_0x26bb('0x37')]),_0x360ed3);if(_0x46973e[_0x26bb('0x35')]['filter']){_0x9260d4[_0x26bb('0x3e')]=_['merge'](_0x9260d4[_0x26bb('0x3e')],{'$or':_[_0x26bb('0x2f')](_0x360ed3,function(_0x48ec6b){if(_0x48ec6b[_0x26bb('0x33')]!==_0x26bb('0x3f')){var _0x29a4b8={};_0x29a4b8[_0x48ec6b[_0x26bb('0x2c')]]={'$like':'%'+_0x46973e['query'][_0x26bb('0x40')]+'%'};return _0x29a4b8;}})});}_0x9260d4=_[_0x26bb('0x41')]({},_0x9260d4,_0x46973e[_0x26bb('0x42')]);var _0x49abd4={'where':_0x9260d4[_0x26bb('0x3e')]};return db['VoiceChanSpy'][_0x26bb('0x1f')](_0x49abd4)[_0x26bb('0x27')](function(_0x434fb9){_0x299cbe[_0x26bb('0x1f')]=_0x434fb9;if(_0x46973e['query']['includeAll']){_0x9260d4['include']=[{'all':!![]}];}return db[_0x26bb('0x30')][_0x26bb('0x43')](_0x9260d4);})[_0x26bb('0x27')](function(_0x48bb4a){_0x299cbe['rows']=_0x48bb4a;return _0x299cbe;})[_0x26bb('0x27')](respondWithFilteredResult(_0x16e487,_0x9260d4))['catch'](handleError(_0x16e487,null));};exports[_0x26bb('0x44')]=function(_0x436518,_0x1b571d){var _0x503035={'raw':![],'where':{'id':_0x436518[_0x26bb('0x45')]['id']}},_0x4e27a6={};_0x4e27a6[_0x26bb('0x34')]=_[_0x26bb('0x36')](db[_0x26bb('0x30')]['rawAttributes']);_0x4e27a6[_0x26bb('0x35')]=_[_0x26bb('0x36')](_0x436518[_0x26bb('0x35')]);_0x4e27a6[_0x26bb('0x37')]=_['intersection'](_0x4e27a6['model'],_0x4e27a6[_0x26bb('0x35')]);_0x503035[_0x26bb('0x39')]=_[_0x26bb('0x38')](_0x4e27a6['model'],qs[_0x26bb('0x3a')](_0x436518[_0x26bb('0x35')][_0x26bb('0x3a')]));_0x503035['attributes']=_0x503035['attributes'][_0x26bb('0x3b')]?_0x503035[_0x26bb('0x39')]:_0x4e27a6[_0x26bb('0x34')];if(_0x436518['query']['includeAll']){_0x503035[_0x26bb('0x46')]=[{'all':!![]}];}_0x503035=_[_0x26bb('0x41')]({},_0x503035,_0x436518[_0x26bb('0x42')]);return db[_0x26bb('0x30')][_0x26bb('0x47')](_0x503035)['then'](handleEntityNotFound(_0x1b571d,null))[_0x26bb('0x27')](respondWithResult(_0x1b571d,null))[_0x26bb('0x48')](handleError(_0x1b571d,null));};exports[_0x26bb('0x49')]=function(_0x1792b9,_0x5e3239){return db[_0x26bb('0x30')][_0x26bb('0x49')](_0x1792b9[_0x26bb('0x4a')],{})[_0x26bb('0x27')](function(_0x29250d){var _0x5e28ab=_0x1792b9[_0x26bb('0x4b')]['get']({'plain':!![]});if(!_0x5e28ab)throw new Error(_0x26bb('0x4c'));if(_0x5e28ab['role']===_0x26bb('0x4b')){var _0x52bf6b=_0x29250d[_0x26bb('0x28')]({'plain':!![]});var _0x536570=_0x26bb('0x29');return db['UserProfileSection'][_0x26bb('0x47')]({'where':{'name':_0x536570,'userProfileId':_0x5e28ab[_0x26bb('0x4d')]},'raw':!![]})['then'](function(_0x30ff15){if(_0x30ff15&&_0x30ff15['autoAssociation']===0x0){return db['UserProfileResource'][_0x26bb('0x49')]({'name':_0x52bf6b[_0x26bb('0x2c')],'resourceId':_0x52bf6b['id'],'type':_0x30ff15[_0x26bb('0x2c')],'sectionId':_0x30ff15['id']},{})[_0x26bb('0x27')](function(){return _0x29250d;});}else{return _0x29250d;}})['catch'](function(_0x43b3ec){logger[_0x26bb('0x4e')](_0x26bb('0x4f'),_0x43b3ec);throw _0x43b3ec;});}return _0x29250d;})[_0x26bb('0x27')](respondWithResult(_0x5e3239,0xc9))[_0x26bb('0x48')](handleError(_0x5e3239,null));};exports[_0x26bb('0x26')]=function(_0x59ef3a,_0x58eaa2){if(_0x59ef3a['body']['id']){delete _0x59ef3a['body']['id'];}return db[_0x26bb('0x30')][_0x26bb('0x47')]({'where':{'id':_0x59ef3a[_0x26bb('0x45')]['id']}})[_0x26bb('0x27')](handleEntityNotFound(_0x58eaa2,null))[_0x26bb('0x27')](saveUpdates(_0x59ef3a[_0x26bb('0x4a')],null))[_0x26bb('0x27')](respondWithResult(_0x58eaa2,null))['catch'](handleError(_0x58eaa2,null));};exports['destroy']=function(_0xfc7137,_0x1e9d0c){return db[_0x26bb('0x30')][_0x26bb('0x47')]({'where':{'id':_0xfc7137['params']['id']}})[_0x26bb('0x27')](handleEntityNotFound(_0x1e9d0c,null))[_0x26bb('0x27')](removeEntity(_0x1e9d0c,null))[_0x26bb('0x48')](handleError(_0x1e9d0c,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 53e6ed3..480e8e4 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 _0x847d=['options','record','StopMixMonitor','length','internal','concat','agent','then','catch','exports','models','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name'];(function(_0x142b47,_0x2355cd){var _0x2904b1=function(_0xb4dcf7){while(--_0xb4dcf7){_0x142b47['push'](_0x142b47['shift']());}};_0x2904b1(++_0x2355cd);}(_0x847d,0x14a));var _0xd847=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0x847d[_0x16dbfd];return _0x382254;};'use strict';var _=require('lodash');var util=require(_0xd847('0x0'));var BPromise=require(_0xd847('0x1'));var attributes=require(_0xd847('0x2'));var getUserApplications=function(_0x4f2500,_0x202b1c,_0x4a85d8){var _0x116caa=0x1;var _0x18051f=[];var _0x5258c0={'context':_0x202b1c[_0xd847('0x3')]||_0xd847('0x4'),'exten':util[_0xd847('0x5')](_0xd847('0x6'),_0x4f2500['prefix'],_0x4a85d8),'type':_0xd847('0x7'),'isApp':![],'ChanSpyId':_0x4f2500['id'],'UserId':_0x202b1c['id']};_0x18051f[_0xd847('0x8')](_[_0xd847('0x9')]({'app':_0xd847('0xa'),'appdata':util[_0xd847('0x5')](_0xd847('0xb'),_0xd847('0xc')),'priority':_0x116caa++},_0x5258c0));if(_0x4f2500['record']){_0x18051f['push'](_['merge']({'app':'MixMonitor','appdata':util[_0xd847('0x5')](_0xd847('0xd'),_0x4f2500[_0xd847('0xe')]),'priority':_0x116caa++},_0x5258c0));}if(_0x4f2500['auth']){_0x18051f['push'](_[_0xd847('0x9')]({'app':_0xd847('0xf'),'appdata':_0x4f2500[_0xd847('0x10')],'priority':_0x116caa++},_0x5258c0));}_0x18051f[_0xd847('0x8')](_[_0xd847('0x9')]({'app':_0xd847('0x11'),'appdata':util[_0xd847('0x5')](_0xd847('0x12'),_0x202b1c[_0xd847('0x13')],_0x4f2500[_0xd847('0x14')]?_0x4f2500[_0xd847('0x14')]['join'](''):''),'priority':_0x116caa++},_0x5258c0));if(_0x4f2500[_0xd847('0x15')]){_0x18051f[_0xd847('0x8')](_[_0xd847('0x9')]({'app':_0xd847('0x16'),'priority':_0x116caa++},_0x5258c0));}return _0x18051f;};var getChanSpyApplications=function(_0x16c79a,_0x586c6e){var _0x39e11b=[];for(var _0x3e1e1c=0x0,_0xfa297d=0x1;_0x3e1e1c<_0x586c6e[_0xd847('0x17')];_0x3e1e1c++,_0xfa297d=0x1){_0x39e11b=_0x39e11b['concat'](getUserApplications(_0x16c79a,_0x586c6e[_0x3e1e1c],_0x586c6e[_0x3e1e1c][_0xd847('0x18')]));if(_0x586c6e[_0x3e1e1c]['internal']!=_0x586c6e[_0x3e1e1c][_0xd847('0x13')]){_0x39e11b=_0x39e11b[_0xd847('0x19')](getUserApplications(_0x16c79a,_0x586c6e[_0x3e1e1c],_0x586c6e[_0x3e1e1c][_0xd847('0x13')]));}}return _0x39e11b;};var getChanSpyPromise=function(_0xf6e434,_0x3905b8){return new BPromise(function(_0x5a58f3,_0x6e91ab){return _0xf6e434['User']['findAll']({'attributes':['id',_0xd847('0x13'),_0xd847('0x18')],'where':{'role':_0xd847('0x1a'),'chanspy':!![]},'raw':!![]})[_0xd847('0x1b')](function(_0x43edca){if(_0x43edca){return _0x5a58f3(getChanSpyApplications(_0x3905b8,_0x43edca));}return _0x5a58f3([]);})[_0xd847('0x1c')](function(_0x1490a1){_0x6e91ab(_0x1490a1);});});};module[_0xd847('0x1d')]=function(_0x1eaf08,_0x27c9f2){var _0x351ffb=_0x1eaf08[_0xd847('0x1e')];return _0x1eaf08['define']('VoiceChanSpy',attributes,{'tableName':_0xd847('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1312ce,_0x388f58,_0x5075a2){return getChanSpyPromise(_0x351ffb,_0x1312ce)[_0xd847('0x1b')](function(_0x246920){if(_0x246920&&_0x246920[_0xd847('0x17')]){return _0x351ffb[_0xd847('0x20')][_0xd847('0x21')](_0x246920);}})[_0xd847('0x1b')](function(){_0x5075a2();})[_0xd847('0x1c')](function(_0x460eba){_0x5075a2(_0x460eba);});},'afterUpdate':function(_0x1b80a2,_0x59296b,_0x46b213){return _0x351ffb[_0xd847('0x20')][_0xd847('0x22')]({'where':{'ChanSpyId':_0x1b80a2['id']}})[_0xd847('0x1b')](function(){return getChanSpyPromise(_0x351ffb,_0x1b80a2);})[_0xd847('0x1b')](function(_0x3301cd){if(_0x3301cd&&_0x3301cd['length']){return _0x351ffb[_0xd847('0x20')]['bulkCreate'](_0x3301cd);}})['then'](function(){_0x46b213();})['catch'](function(_0x184513){_0x46b213(_0x184513);});},'afterDestroy':function(_0x3654e8,_0x2678dc,_0x18d162){return _0x351ffb[_0xd847('0x20')][_0xd847('0x22')]({'where':{'ChanSpyId':_0x3654e8['id']}})[_0xd847('0x1b')](function(){_0x18d162();})[_0xd847('0x1c')](function(_0x3d7082){_0x18d162(_0x3d7082);});}}});}; \ No newline at end of file +var _0x377e=['length','internal','concat','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','merge','format','CDR(type)=%s','chanspy','record','push','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join'];(function(_0xa0d332,_0xcd956f){var _0x50fd0c=function(_0x35f2b0){while(--_0x35f2b0){_0xa0d332['push'](_0xa0d332['shift']());}};_0x50fd0c(++_0xcd956f);}(_0x377e,0x1e2));var _0xe377=function(_0x13a61c,_0x17c53a){_0x13a61c=_0x13a61c-0x0;var _0x2d0c84=_0x377e[_0x13a61c];return _0x2d0c84;};'use strict';var _=require(_0xe377('0x0'));var util=require(_0xe377('0x1'));var BPromise=require('bluebird');var attributes=require(_0xe377('0x2'));var getUserApplications=function(_0x538d8a,_0x2d6646,_0x1c0062){var _0x167b11=0x1;var _0x344eea=[];var _0x156973={'context':_0x2d6646['context']||_0xe377('0x3'),'exten':util['format'](_0xe377('0x4'),_0x538d8a[_0xe377('0x5')],_0x1c0062),'type':_0xe377('0x6'),'isApp':![],'ChanSpyId':_0x538d8a['id'],'UserId':_0x2d6646['id']};_0x344eea['push'](_[_0xe377('0x7')]({'app':'Set','appdata':util[_0xe377('0x8')](_0xe377('0x9'),_0xe377('0xa')),'priority':_0x167b11++},_0x156973));if(_0x538d8a[_0xe377('0xb')]){_0x344eea[_0xe377('0xc')](_[_0xe377('0x7')]({'app':'MixMonitor','appdata':util[_0xe377('0x8')](_0xe377('0xd'),_0x538d8a[_0xe377('0xe')]),'priority':_0x167b11++},_0x156973));}if(_0x538d8a[_0xe377('0xf')]){_0x344eea['push'](_[_0xe377('0x7')]({'app':'Authenticate','appdata':_0x538d8a[_0xe377('0x10')],'priority':_0x167b11++},_0x156973));}_0x344eea[_0xe377('0xc')](_[_0xe377('0x7')]({'app':_0xe377('0x11'),'appdata':util['format'](_0xe377('0x12'),_0x2d6646[_0xe377('0x13')],_0x538d8a[_0xe377('0x14')]?_0x538d8a[_0xe377('0x14')][_0xe377('0x15')](''):''),'priority':_0x167b11++},_0x156973));if(_0x538d8a[_0xe377('0xb')]){_0x344eea[_0xe377('0xc')](_['merge']({'app':'StopMixMonitor','priority':_0x167b11++},_0x156973));}return _0x344eea;};var getChanSpyApplications=function(_0x4b1578,_0x2e610f){var _0x472784=[];for(var _0x373853=0x0,_0x134f2e=0x1;_0x373853<_0x2e610f[_0xe377('0x16')];_0x373853++,_0x134f2e=0x1){_0x472784=_0x472784['concat'](getUserApplications(_0x4b1578,_0x2e610f[_0x373853],_0x2e610f[_0x373853]['internal']));if(_0x2e610f[_0x373853][_0xe377('0x17')]!=_0x2e610f[_0x373853]['name']){_0x472784=_0x472784[_0xe377('0x18')](getUserApplications(_0x4b1578,_0x2e610f[_0x373853],_0x2e610f[_0x373853]['name']));}}return _0x472784;};var getChanSpyPromise=function(_0x1ff8f5,_0x4558ed){return new BPromise(function(_0x67849,_0x26c811){return _0x1ff8f5[_0xe377('0x19')][_0xe377('0x1a')]({'attributes':['id',_0xe377('0x13'),'internal'],'where':{'role':_0xe377('0x1b'),'chanspy':!![]},'raw':!![]})[_0xe377('0x1c')](function(_0x128547){if(_0x128547){return _0x67849(getChanSpyApplications(_0x4558ed,_0x128547));}return _0x67849([]);})[_0xe377('0x1d')](function(_0x25295d){_0x26c811(_0x25295d);});});};module[_0xe377('0x1e')]=function(_0x3fab11,_0x5cb27f){var _0x45b4e5=_0x3fab11[_0xe377('0x1f')];return _0x3fab11['define'](_0xe377('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x515d82,_0x19e75f,_0x50d45c){return getChanSpyPromise(_0x45b4e5,_0x515d82)[_0xe377('0x1c')](function(_0x270e7d){if(_0x270e7d&&_0x270e7d[_0xe377('0x16')]){return _0x45b4e5[_0xe377('0x21')][_0xe377('0x22')](_0x270e7d);}})['then'](function(){_0x50d45c();})['catch'](function(_0x509a7d){_0x50d45c(_0x509a7d);});},'afterUpdate':function(_0x11c9c1,_0x371bd5,_0x59827a){return _0x45b4e5['VoiceExtension'][_0xe377('0x23')]({'where':{'ChanSpyId':_0x11c9c1['id']}})['then'](function(){return getChanSpyPromise(_0x45b4e5,_0x11c9c1);})[_0xe377('0x1c')](function(_0x216f47){if(_0x216f47&&_0x216f47['length']){return _0x45b4e5[_0xe377('0x21')][_0xe377('0x22')](_0x216f47);}})[_0xe377('0x1c')](function(){_0x59827a();})[_0xe377('0x1d')](function(_0x51abb9){_0x59827a(_0x51abb9);});},'afterDestroy':function(_0x55a3a9,_0xf0045f,_0x274d20){return _0x45b4e5[_0xe377('0x21')][_0xe377('0x23')]({'where':{'ChanSpyId':_0x55a3a9['id']}})[_0xe377('0x1c')](function(){_0x274d20();})['catch'](function(_0x2d6822){_0x274d20(_0x2d6822);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 399590f..1754665 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 _0x0291=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x198b73,_0x3edf54){var _0x48f220=function(_0x5ebee7){while(--_0x5ebee7){_0x198b73['push'](_0x198b73['shift']());}};_0x48f220(++_0x3edf54);}(_0x0291,0xde));var _0x1029=function(_0x300884,_0x4b19d1){_0x300884=_0x300884-0x0;var _0xbdd533=_0x0291[_0x300884];return _0xbdd533;};'use strict';var _=require(_0x1029('0x0'));var util=require(_0x1029('0x1'));var moment=require(_0x1029('0x2'));var BPromise=require(_0x1029('0x3'));var rs=require(_0x1029('0x4'));var fs=require('fs');var Redis=require(_0x1029('0x5'));var db=require(_0x1029('0x6'))['db'];var utils=require(_0x1029('0x7'));var logger=require('../../config/logger')(_0x1029('0x8'));var config=require(_0x1029('0x9'));var jayson=require(_0x1029('0xa'));var client=jayson[_0x1029('0xb')][_0x1029('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x562cc4,_0x11d300,_0x32aa56){return new BPromise(function(_0x58f2ba,_0x3b63cc){return client['request'](_0x562cc4,_0x32aa56)[_0x1029('0xd')](function(_0x596f24){logger[_0x1029('0xe')](_0x1029('0xf'),_0x11d300,_0x1029('0x10'));logger[_0x1029('0x11')](_0x1029('0x12'),_0x11d300,_0x1029('0x10'),JSON[_0x1029('0x13')](_0x596f24));if(_0x596f24[_0x1029('0x14')]){if(_0x596f24['error'][_0x1029('0x15')]===0x1f4){logger['error'](_0x1029('0xf'),_0x11d300,_0x596f24[_0x1029('0x14')][_0x1029('0x16')]);return _0x3b63cc(_0x596f24['error'][_0x1029('0x16')]);}logger['error'](_0x1029('0xf'),_0x11d300,_0x596f24[_0x1029('0x14')][_0x1029('0x16')]);return _0x58f2ba(_0x596f24[_0x1029('0x14')][_0x1029('0x16')]);}else{logger[_0x1029('0xe')](_0x1029('0xf'),_0x11d300,'request\x20sent');_0x58f2ba(_0x596f24[_0x1029('0x17')]['message']);}})[_0x1029('0x18')](function(_0x5be6e0){logger[_0x1029('0x14')](_0x1029('0xf'),_0x11d300,_0x5be6e0);_0x3b63cc(_0x5be6e0);});});} \ No newline at end of file +var _0x66a2=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x13972c,_0x16ddf9){var _0x5d5d7e=function(_0x1f7073){while(--_0x1f7073){_0x13972c['push'](_0x13972c['shift']());}};_0x5d5d7e(++_0x16ddf9);}(_0x66a2,0x12e));var _0x266a=function(_0x831a64,_0x505c25){_0x831a64=_0x831a64-0x0;var _0x4eb0c7=_0x66a2[_0x831a64];return _0x4eb0c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x266a('0x0'));var BPromise=require(_0x266a('0x1'));var rs=require(_0x266a('0x2'));var fs=require('fs');var Redis=require(_0x266a('0x3'));var db=require(_0x266a('0x4'))['db'];var utils=require(_0x266a('0x5'));var logger=require(_0x266a('0x6'))('rpc');var config=require(_0x266a('0x7'));var jayson=require(_0x266a('0x8'));var client=jayson[_0x266a('0x9')][_0x266a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15fa5d,_0x38d9ea,_0x3e6b99){return new BPromise(function(_0xbe292,_0xd6aa5a){return client[_0x266a('0xb')](_0x15fa5d,_0x3e6b99)[_0x266a('0xc')](function(_0x2e1f95){logger['info'](_0x266a('0xd'),_0x38d9ea,_0x266a('0xe'));logger[_0x266a('0xf')](_0x266a('0x10'),_0x38d9ea,'request\x20sent',JSON[_0x266a('0x11')](_0x2e1f95));if(_0x2e1f95[_0x266a('0x12')]){if(_0x2e1f95[_0x266a('0x12')][_0x266a('0x13')]===0x1f4){logger[_0x266a('0x12')](_0x266a('0xd'),_0x38d9ea,_0x2e1f95[_0x266a('0x12')][_0x266a('0x14')]);return _0xd6aa5a(_0x2e1f95[_0x266a('0x12')]['message']);}logger[_0x266a('0x12')](_0x266a('0xd'),_0x38d9ea,_0x2e1f95['error'][_0x266a('0x14')]);return _0xbe292(_0x2e1f95[_0x266a('0x12')][_0x266a('0x14')]);}else{logger['info'](_0x266a('0xd'),_0x38d9ea,'request\x20sent');_0xbe292(_0x2e1f95[_0x266a('0x15')][_0x266a('0x14')]);}})[_0x266a('0x16')](function(_0x3d9295){logger[_0x266a('0x12')](_0x266a('0xd'),_0x38d9ea,_0x3d9295);_0xd6aa5a(_0x3d9295);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f8126ab..a7afa5c 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 _0x4fa7=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','post','create','/:id','delete','destroy','exports'];(function(_0x3033ca,_0x2f1643){var _0x1ef9a1=function(_0x338c2a){while(--_0x338c2a){_0x3033ca['push'](_0x3033ca['shift']());}};_0x1ef9a1(++_0x2f1643);}(_0x4fa7,0xd2));var _0x74fa=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0x4fa7[_0x48e1ec];return _0x3b33eb;};'use strict';var multer=require('multer');var util=require(_0x74fa('0x0'));var path=require(_0x74fa('0x1'));var timeout=require(_0x74fa('0x2'));var express=require(_0x74fa('0x3'));var router=express[_0x74fa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x74fa('0x5'));var config=require(_0x74fa('0x6'));var controller=require(_0x74fa('0x7'));router['get']('/',auth[_0x74fa('0x8')](),controller['index']);router['get']('/:id',auth[_0x74fa('0x8')](),controller['show']);router[_0x74fa('0x9')]('/',auth[_0x74fa('0x8')](),controller[_0x74fa('0xa')]);router['put'](_0x74fa('0xb'),auth[_0x74fa('0x8')](),controller['update']);router[_0x74fa('0xc')](_0x74fa('0xb'),auth[_0x74fa('0x8')](),controller[_0x74fa('0xd')]);module[_0x74fa('0xe')]=router; \ No newline at end of file +var _0xefbd=['../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x3f76d0,_0x541ba3){var _0x2cfa91=function(_0x27c0cf){while(--_0x27c0cf){_0x3f76d0['push'](_0x3f76d0['shift']());}};_0x2cfa91(++_0x541ba3);}(_0xefbd,0x11b));var _0xdefb=function(_0x41ae4e,_0x55d1c9){_0x41ae4e=_0x41ae4e-0x0;var _0x2c26ef=_0xefbd[_0x41ae4e];return _0x2c26ef;};'use strict';var multer=require(_0xdefb('0x0'));var util=require(_0xdefb('0x1'));var path=require(_0xdefb('0x2'));var timeout=require(_0xdefb('0x3'));var express=require('express');var router=express[_0xdefb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdefb('0x5'));var config=require(_0xdefb('0x6'));var controller=require(_0xdefb('0x7'));router[_0xdefb('0x8')]('/',auth[_0xdefb('0x9')](),controller['index']);router['get'](_0xdefb('0xa'),auth['isAuthenticated'](),controller[_0xdefb('0xb')]);router[_0xdefb('0xc')]('/',auth[_0xdefb('0x9')](),controller[_0xdefb('0xd')]);router[_0xdefb('0xe')](_0xdefb('0xa'),auth[_0xdefb('0x9')](),controller[_0xdefb('0xf')]);router[_0xdefb('0x10')](_0xdefb('0xa'),auth[_0xdefb('0x9')](),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 699d093..8814474 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 _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x4870c0,_0xbdef87){var _0x14e716=function(_0x3e43d0){while(--_0x3e43d0){_0x4870c0['push'](_0x4870c0['shift']());}};_0x14e716(++_0xbdef87);}(_0x34e8,0x12c));var _0x834e=function(_0x12babd,_0x14b607){_0x12babd=_0x12babd-0x0;var _0x29102b=_0x34e8[_0x12babd];return _0x29102b;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x673e91,_0x5066f8){var _0x3ee5cb=function(_0x2b30d2){while(--_0x2b30d2){_0x673e91['push'](_0x673e91['shift']());}};_0x3ee5cb(++_0x5066f8);}(_0x3e74,0x175));var _0x43e7=function(_0x2620d4,_0x58876a){_0x2620d4=_0x2620d4-0x0;var _0x5e9789=_0x3e74[_0x2620d4];return _0x5e9789;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 16eecb8..21bd55b 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(_0x2ac6e5,_0x2749ea){var _0xdf0f6=function(_0x58a645){while(--_0x58a645){_0x2ac6e5['push'](_0x2ac6e5['shift']());}};_0xdf0f6(++_0x2749ea);}(_0x3e74,0x175));var _0x43e7=function(_0x589a07,_0x2d3519){_0x589a07=_0x589a07-0x0;var _0x71c639=_0x3e74[_0x589a07];return _0x71c639;};'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 _0x7217=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../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~!@#$%^&-_=+[{]}.','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','get','Contexts','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceContext','includeAll','include','findAll','show','params','length','options','find','create','body','join','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','role','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','root','server/files/templates/context.ejs','utf8','chan_sip.so','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'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0x7217,0x19e));var _0x7721=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7217[_0x110c3d];return _0x226d67;};'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 jayson=require(_0x7721('0x1b'));var client=jayson['client'][_0x7721('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x199930,_0x57ff6d,_0x109900){if(_0x109900){var _0x30da54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30da54[_0x7721('0x1d')](_0x57ff6d)){return _0x199930;}else{throw new db[(_0x7721('0x1e'))]['ValidationError'](_0x7721('0x1f'));}}else{return _0x199930;}}function respondWithRpcPromise(_0x25b1c0,_0x534f1b,_0x4e199a,_0x4b183e){return new BPromise(function(_0x5ed54,_0x25a628){var _0x3cc909=_0x4b183e||client;return _0x3cc909[_0x7721('0x20')](_0x25b1c0,_0x4e199a)['then'](function(_0x20f669){logger['info'](_0x7721('0x21'),_0x534f1b,'request\x20sent');logger[_0x7721('0x22')](_0x7721('0x23'),_0x534f1b,_0x7721('0x24'),JSON[_0x7721('0x25')](_0x20f669));if(_0x20f669[_0x7721('0x26')]){if(_0x20f669[_0x7721('0x26')][_0x7721('0x27')]===0x1f4){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669[_0x7721('0x26')]['message']);return _0x25a628(_0x20f669[_0x7721('0x26')][_0x7721('0x28')]);}logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669['error'][_0x7721('0x28')]);return _0x5ed54(_0x20f669['error'][_0x7721('0x28')]);}else{logger[_0x7721('0x29')](_0x7721('0x21'),_0x534f1b,_0x7721('0x24'));_0x5ed54(_0x20f669[_0x7721('0x2a')][_0x7721('0x28')]);}})[_0x7721('0x2b')](function(_0x5b4d74){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x5b4d74);_0x25a628(_0x5b4d74);});});}function respondWithStatusCode(_0x125564,_0x1f67c7){_0x1f67c7=_0x1f67c7||0xcc;return function(_0x40d550){if(_0x40d550){return _0x125564[_0x7721('0x2c')](_0x1f67c7);}return _0x125564[_0x7721('0x2d')](_0x1f67c7)[_0x7721('0x2e')]();};}function respondWithResult(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0xc8;return function(_0x258ddf){if(_0x258ddf){return _0x40f367['status'](_0x52316e)['json'](_0x258ddf);}};}function respondWithFilteredResult(_0x315202,_0x343c19){return function(_0x53c904){if(_0x53c904){var _0x158d98=_0x53c904[_0x7721('0x2f')],_0x1ea4d=_0x343c19['offset'],_0x37b9f0=_0x343c19[_0x7721('0x30')]+_0x343c19[_0x7721('0x31')],_0xd7d703;if(_0x37b9f0>=_0x158d98){_0x37b9f0=_0x158d98;_0xd7d703=0xc8;}else{_0xd7d703=0xce;}_0x315202['status'](_0xd7d703);return _0x315202['set'](_0x7721('0x32'),_0x1ea4d+'-'+_0x37b9f0+'/'+_0x158d98)[_0x7721('0x33')](_0x53c904);}return null;};}function patchUpdates(_0x48f329){return function(_0x46f772){try{jsonpatch[_0x7721('0x34')](_0x46f772,_0x48f329,!![]);}catch(_0x382821){return BPromise['reject'](_0x382821);}return _0x46f772[_0x7721('0x35')]();};}function saveUpdates(_0x1ff31b,_0x1492d4){return function(_0x3f15e2){if(_0x3f15e2){return _0x3f15e2[_0x7721('0x36')](_0x1ff31b)['then'](function(_0x195ffb){return _0x195ffb;});}return null;};}function removeEntity(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(_0x5c5b33){return _0x5c5b33[_0x7721('0x37')]()[_0x7721('0x38')](function(){var _0x498654=_0x5c5b33[_0x7721('0x39')]({'plain':!![]});var _0x5ce026=_0x7721('0x3a');return db[_0x7721('0x3b')][_0x7721('0x37')]({'where':{'type':_0x5ce026,'resourceId':_0x498654['id']}})[_0x7721('0x38')](function(){return _0x5c5b33;});})[_0x7721('0x38')](function(){_0x3e4e56[_0x7721('0x2d')](0xcc)[_0x7721('0x2e')]();});}};}function handleEntityNotFound(_0x15545a,_0x25bdd9){return function(_0x3a2eb7){if(!_0x3a2eb7){_0x15545a[_0x7721('0x2c')](0x194);}return _0x3a2eb7;};}function handleError(_0x5c806d,_0xd1df68){_0xd1df68=_0xd1df68||0x1f4;return function(_0x5e6663){logger[_0x7721('0x26')](_0x5e6663[_0x7721('0x3c')]);if(_0x5e6663[_0x7721('0x3d')]){delete _0x5e6663[_0x7721('0x3d')];}_0x5c806d[_0x7721('0x2d')](_0xd1df68)[_0x7721('0x3e')](_0x5e6663);};}exports['index']=function(_0x557c34,_0x4cadef){var _0x539560={},_0x18001c={},_0x1b3f8d={'count':0x0,'rows':[]};var _0x1acc72=_[_0x7721('0x3f')](db['VoiceContext'][_0x7721('0x40')],function(_0x4cf659){return{'name':_0x4cf659[_0x7721('0x41')],'type':_0x4cf659[_0x7721('0x42')]['key']};});_0x18001c[_0x7721('0x43')]=_[_0x7721('0x3f')](_0x1acc72,'name');_0x18001c['query']=_[_0x7721('0x44')](_0x557c34[_0x7721('0x45')]);_0x18001c[_0x7721('0x46')]=_[_0x7721('0x47')](_0x18001c['model'],_0x18001c[_0x7721('0x45')]);_0x539560[_0x7721('0x48')]=_[_0x7721('0x47')](_0x18001c[_0x7721('0x43')],qs[_0x7721('0x49')](_0x557c34['query'][_0x7721('0x49')]));_0x539560['attributes']=_0x539560[_0x7721('0x48')]['length']?_0x539560[_0x7721('0x48')]:_0x18001c[_0x7721('0x43')];if(!_0x557c34[_0x7721('0x45')]['hasOwnProperty'](_0x7721('0x4a'))){_0x539560[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x557c34['query'][_0x7721('0x31')]);_0x539560[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x557c34[_0x7721('0x45')][_0x7721('0x30')]);}_0x539560[_0x7721('0x4b')]=qs[_0x7721('0x4c')](_0x557c34['query']['sort']);_0x539560[_0x7721('0x4d')]=qs[_0x7721('0x46')](_[_0x7721('0x4e')](_0x557c34[_0x7721('0x45')],_0x18001c[_0x7721('0x46')]),_0x1acc72);if(_0x557c34[_0x7721('0x45')][_0x7721('0x4f')]){_0x539560[_0x7721('0x4d')]=_[_0x7721('0x50')](_0x539560[_0x7721('0x4d')],{'$or':_['map'](_0x1acc72,function(_0x578867){if(_0x578867[_0x7721('0x42')]!==_0x7721('0x51')){var _0x151f69={};_0x151f69[_0x578867[_0x7721('0x3d')]]={'$like':'%'+_0x557c34['query'][_0x7721('0x4f')]+'%'};return _0x151f69;}})});}_0x539560=_[_0x7721('0x50')]({},_0x539560,_0x557c34['options']);var _0x330fac={'where':_0x539560['where']};return db[_0x7721('0x52')]['count'](_0x330fac)[_0x7721('0x38')](function(_0x196be4){_0x1b3f8d[_0x7721('0x2f')]=_0x196be4;if(_0x557c34['query'][_0x7721('0x53')]){_0x539560[_0x7721('0x54')]=[{'all':!![]}];}return db['VoiceContext'][_0x7721('0x55')](_0x539560);})[_0x7721('0x38')](function(_0xf88e8c){_0x1b3f8d['rows']=_0xf88e8c;return _0x1b3f8d;})[_0x7721('0x38')](respondWithFilteredResult(_0x4cadef,_0x539560))['catch'](handleError(_0x4cadef,null));};exports[_0x7721('0x56')]=function(_0x310549,_0x4738ef){var _0x443503={'raw':![],'where':{'id':_0x310549[_0x7721('0x57')]['id']}},_0x1c95d8={};_0x1c95d8[_0x7721('0x43')]=_[_0x7721('0x44')](db[_0x7721('0x52')][_0x7721('0x40')]);_0x1c95d8[_0x7721('0x45')]=_[_0x7721('0x44')](_0x310549[_0x7721('0x45')]);_0x1c95d8[_0x7721('0x46')]=_[_0x7721('0x47')](_0x1c95d8['model'],_0x1c95d8[_0x7721('0x45')]);_0x443503[_0x7721('0x48')]=_[_0x7721('0x47')](_0x1c95d8[_0x7721('0x43')],qs[_0x7721('0x49')](_0x310549[_0x7721('0x45')][_0x7721('0x49')]));_0x443503['attributes']=_0x443503[_0x7721('0x48')][_0x7721('0x58')]?_0x443503[_0x7721('0x48')]:_0x1c95d8[_0x7721('0x43')];if(_0x310549[_0x7721('0x45')][_0x7721('0x53')]){_0x443503[_0x7721('0x54')]=[{'all':!![]}];}_0x443503=_[_0x7721('0x50')]({},_0x443503,_0x310549[_0x7721('0x59')]);return db[_0x7721('0x52')][_0x7721('0x5a')](_0x443503)['then'](handleEntityNotFound(_0x4738ef,null))[_0x7721('0x38')](respondWithResult(_0x4738ef,null))[_0x7721('0x2b')](handleError(_0x4738ef,null));};exports[_0x7721('0x5b')]=function(_0x2ee3c0,_0x15ed3b,_0x3e7918){var _0x41644f;return db[_0x7721('0x52')][_0x7721('0x5b')](_0x2ee3c0[_0x7721('0x5c')],{'raw':!![]})[_0x7721('0x38')](function(_0x2e5c28){_0x41644f=_0x2e5c28;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});})[_0x7721('0x38')](function(_0x577f47){var _0x50e9e9=fs['readFileSync'](path[_0x7721('0x5d')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x5d7036=ejs[_0x7721('0x5e')](_0x50e9e9,{'contexts':_0x577f47||[]});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x5d7036);})['then'](function(){return respondWithRpcPromise(_0x7721('0x61'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x24d1dc=_0x2ee3c0['user']['get']({'plain':!![]});if(!_0x24d1dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d1dc[_0x7721('0x62')]===_0x7721('0x63')){var _0x1ff090=_0x41644f['get']({'plain':!![]});return db[_0x7721('0x64')][_0x7721('0x5a')]({'where':{'name':_0x7721('0x3a'),'userProfileId':_0x24d1dc[_0x7721('0x65')]},'raw':!![]})[_0x7721('0x38')](function(_0x16e80b){if(_0x16e80b&&_0x16e80b[_0x7721('0x66')]===0x0){return db[_0x7721('0x3b')][_0x7721('0x5b')]({'name':_0x1ff090[_0x7721('0x3d')],'resourceId':_0x1ff090['id'],'type':_0x16e80b[_0x7721('0x3d')],'sectionId':_0x16e80b['id']},{})[_0x7721('0x38')](function(){return _0x41644f;});}else{return _0x41644f;}})[_0x7721('0x2b')](function(_0x211d27){logger[_0x7721('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211d27);throw _0x211d27;});}return _0x41644f;})[_0x7721('0x38')](respondWithResult(_0x15ed3b,0xc9))[_0x7721('0x2b')](handleError(_0x15ed3b,null));};exports[_0x7721('0x36')]=function(_0xb6db23,_0x542e30,_0x103009){var _0x104f05;return db['VoiceContext'][_0x7721('0x5a')]({'where':{'id':_0xb6db23['params']['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x542e30,null))[_0x7721('0x38')](saveUpdates(_0xb6db23[_0x7721('0x5c')],null))[_0x7721('0x38')](function(_0x3d2b7d){if(_0x3d2b7d){_0x104f05=_0x3d2b7d;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});}})[_0x7721('0x38')](function(_0x4727b0){var _0x57759a=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),_0x7721('0x6a'));var _0x3ed425=ejs[_0x7721('0x5e')](_0x57759a,{'contexts':_0x4727b0||[]});fs['writeFileSync'](_0x7721('0x60'),_0x3ed425);})[_0x7721('0x38')](function(){return respondWithRpcPromise('Reload',_0x7721('0x36'),{'module':'chan_sip.so'});})[_0x7721('0x38')](function(){return _0x104f05;})[_0x7721('0x38')](respondWithResult(_0x542e30,null))[_0x7721('0x2b')](handleError(_0x542e30,null));};exports[_0x7721('0x37')]=function(_0x1e2436,_0x2bab14,_0x258c57){var _0x5dca04;return db[_0x7721('0x52')][_0x7721('0x5a')]({'where':{'id':_0x1e2436[_0x7721('0x57')]['id']}})['then'](handleEntityNotFound(_0x2bab14,null))['then'](removeEntity(_0x2bab14,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x7721('0x38')](function(_0x2645dd){var _0x580473=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),'utf8');var _0x275b25=ejs[_0x7721('0x5e')](_0x580473,{'contexts':_0x2645dd});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x275b25);return respondWithRpcPromise(_0x7721('0x61'),'destroy',{'module':_0x7721('0x6b')});})[_0x7721('0x2b')](handleError(_0x2bab14,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index cda0d92..13bf28b 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(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_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 diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 53c22a9..1fd04b0 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 _0x84be=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash'];(function(_0x2806f7,_0x188414){var _0x1ba2d8=function(_0x5ee87e){while(--_0x5ee87e){_0x2806f7['push'](_0x2806f7['shift']());}};_0x1ba2d8(++_0x188414);}(_0x84be,0xc7));var _0xe84b=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x84be[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xe84b('0x0'));var util=require(_0xe84b('0x1'));var moment=require(_0xe84b('0x2'));var BPromise=require(_0xe84b('0x3'));var rs=require(_0xe84b('0x4'));var fs=require('fs');var Redis=require(_0xe84b('0x5'));var db=require(_0xe84b('0x6'))['db'];var utils=require(_0xe84b('0x7'));var logger=require(_0xe84b('0x8'))('rpc');var config=require(_0xe84b('0x9'));var jayson=require(_0xe84b('0xa'));var client=jayson[_0xe84b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e3a2,_0x545154,_0x11409){return new BPromise(function(_0x200b7f,_0x223d97){return client[_0xe84b('0xc')](_0x56e3a2,_0x11409)[_0xe84b('0xd')](function(_0x3ac04f){logger[_0xe84b('0xe')]('VoiceContext,\x20%s,\x20%s',_0x545154,_0xe84b('0xf'));logger[_0xe84b('0x10')](_0xe84b('0x11'),_0x545154,'request\x20sent',JSON[_0xe84b('0x12')](_0x3ac04f));if(_0x3ac04f[_0xe84b('0x13')]){if(_0x3ac04f[_0xe84b('0x13')][_0xe84b('0x14')]===0x1f4){logger[_0xe84b('0x13')]('VoiceContext,\x20%s,\x20%s',_0x545154,_0x3ac04f[_0xe84b('0x13')][_0xe84b('0x15')]);return _0x223d97(_0x3ac04f[_0xe84b('0x13')][_0xe84b('0x15')]);}logger[_0xe84b('0x13')](_0xe84b('0x16'),_0x545154,_0x3ac04f[_0xe84b('0x13')]['message']);return _0x200b7f(_0x3ac04f[_0xe84b('0x13')][_0xe84b('0x15')]);}else{logger[_0xe84b('0xe')](_0xe84b('0x16'),_0x545154,_0xe84b('0xf'));_0x200b7f(_0x3ac04f[_0xe84b('0x17')][_0xe84b('0x15')]);}})[_0xe84b('0x18')](function(_0x11dc65){logger['error'](_0xe84b('0x16'),_0x545154,_0x11dc65);_0x223d97(_0x11dc65);});});} \ No newline at end of file +var _0xd6d5=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','error','code','message','catch','lodash','bluebird'];(function(_0x3bc7c6,_0x37d687){var _0x47ee95=function(_0x58140a){while(--_0x58140a){_0x3bc7c6['push'](_0x3bc7c6['shift']());}};_0x47ee95(++_0x37d687);}(_0xd6d5,0x1de));var _0x5d6d=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xd6d5[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x5d6d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5d6d('0x1'));var rs=require(_0x5d6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d6d('0x3'))['db'];var utils=require(_0x5d6d('0x4'));var logger=require(_0x5d6d('0x5'))(_0x5d6d('0x6'));var config=require(_0x5d6d('0x7'));var jayson=require(_0x5d6d('0x8'));var client=jayson[_0x5d6d('0x9')][_0x5d6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25e4a9,_0x3a3fcb,_0x91cfe2){return new BPromise(function(_0xda13f6,_0x1991ff){return client[_0x5d6d('0xb')](_0x25e4a9,_0x91cfe2)[_0x5d6d('0xc')](function(_0x2114ed){logger[_0x5d6d('0xd')](_0x5d6d('0xe'),_0x3a3fcb,'request\x20sent');logger[_0x5d6d('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3a3fcb,'request\x20sent',JSON['stringify'](_0x2114ed));if(_0x2114ed[_0x5d6d('0x10')]){if(_0x2114ed[_0x5d6d('0x10')][_0x5d6d('0x11')]===0x1f4){logger[_0x5d6d('0x10')](_0x5d6d('0xe'),_0x3a3fcb,_0x2114ed[_0x5d6d('0x10')]['message']);return _0x1991ff(_0x2114ed['error'][_0x5d6d('0x12')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x3a3fcb,_0x2114ed[_0x5d6d('0x10')][_0x5d6d('0x12')]);return _0xda13f6(_0x2114ed[_0x5d6d('0x10')][_0x5d6d('0x12')]);}else{logger[_0x5d6d('0xd')](_0x5d6d('0xe'),_0x3a3fcb,'request\x20sent');_0xda13f6(_0x2114ed['result'][_0x5d6d('0x12')]);}})[_0x5d6d('0x13')](function(_0x1b3074){logger[_0x5d6d('0x10')]('VoiceContext,\x20%s,\x20%s',_0x3a3fcb,_0x1b3074);_0x1991ff(_0x1b3074);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 6119013..6ed8183 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 _0x6fda=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','describe','/:id','post','create','put','update','delete'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0x6fda,0x1ce));var _0xa6fd=function(_0x44e9b1,_0x24243b){_0x44e9b1=_0x44e9b1-0x0;var _0x5d6eb2=_0x6fda[_0x44e9b1];return _0x5d6eb2;};'use strict';var multer=require(_0xa6fd('0x0'));var util=require(_0xa6fd('0x1'));var path=require(_0xa6fd('0x2'));var timeout=require(_0xa6fd('0x3'));var express=require(_0xa6fd('0x4'));var router=express[_0xa6fd('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa6fd('0x6'));var config=require(_0xa6fd('0x7'));var controller=require(_0xa6fd('0x8'));router['get']('/',auth[_0xa6fd('0x9')](),controller['index']);router[_0xa6fd('0xa')]('/describe',auth[_0xa6fd('0x9')](),controller[_0xa6fd('0xb')]);router[_0xa6fd('0xa')](_0xa6fd('0xc'),auth[_0xa6fd('0x9')](),controller['show']);router[_0xa6fd('0xd')]('/',auth['isAuthenticated'](),controller[_0xa6fd('0xe')]);router[_0xa6fd('0xf')](_0xa6fd('0xc'),auth[_0xa6fd('0x9')](),controller[_0xa6fd('0x10')]);router[_0xa6fd('0x11')](_0xa6fd('0xc'),auth[_0xa6fd('0x9')](),controller[_0xa6fd('0x12')]);module[_0xa6fd('0x13')]=router; \ No newline at end of file +var _0xa453=['../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','/:id','show','post','put','update','delete','multer','util','path','connect-timeout'];(function(_0x51f959,_0x110165){var _0x554986=function(_0x4c4c03){while(--_0x4c4c03){_0x51f959['push'](_0x51f959['shift']());}};_0x554986(++_0x110165);}(_0xa453,0x1dc));var _0x3a45=function(_0x321806,_0xd6d342){_0x321806=_0x321806-0x0;var _0x1b21b4=_0xa453[_0x321806];return _0x1b21b4;};'use strict';var multer=require(_0x3a45('0x0'));var util=require(_0x3a45('0x1'));var path=require(_0x3a45('0x2'));var timeout=require(_0x3a45('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3a45('0x4'));var controller=require(_0x3a45('0x5'));router[_0x3a45('0x6')]('/',auth['isAuthenticated'](),controller[_0x3a45('0x7')]);router[_0x3a45('0x6')]('/describe',auth[_0x3a45('0x8')](),controller['describe']);router[_0x3a45('0x6')](_0x3a45('0x9'),auth[_0x3a45('0x8')](),controller[_0x3a45('0xa')]);router[_0x3a45('0xb')]('/',auth[_0x3a45('0x8')](),controller['create']);router[_0x3a45('0xc')](_0x3a45('0x9'),auth['isAuthenticated'](),controller[_0x3a45('0xd')]);router[_0x3a45('0xe')]('/:id',auth[_0x3a45('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7991266..2dea50c 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 _0x4d31=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4d31,0x188));var _0x14d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4d31[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x14d3('0x0'));module[_0x14d3('0x1')]={'privilege':{'type':Sequelize[_0x14d3('0x2')]},'channel':{'type':Sequelize[_0x14d3('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x14d3('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x14d3('0x2')]},'connectedlinenum':{'type':Sequelize[_0x14d3('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x14d3('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x14d3('0x2')]},'exten':{'type':Sequelize[_0x14d3('0x2')]},'priority':{'type':Sequelize[_0x14d3('0x3')]},'uniqueid':{'type':Sequelize[_0x14d3('0x2')]},'linkedid':{'type':Sequelize[_0x14d3('0x2')]},'destchannel':{'type':Sequelize[_0x14d3('0x2')]},'destchannelstate':{'type':Sequelize[_0x14d3('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x14d3('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x14d3('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x14d3('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x14d3('0x2')]},'destexten':{'type':Sequelize[_0x14d3('0x2')]},'destpriority':{'type':Sequelize[_0x14d3('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x14d3('0x2')]},'dialstring':{'type':Sequelize[_0x14d3('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x14d3('0x4')]},'answertime':{'type':Sequelize[_0x14d3('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':_0x14d3('0x5')},'routeId':{'type':Sequelize[_0x14d3('0x3')]},'duration':{'type':Sequelize[_0x14d3('0x3')]},'holdtime':{'type':Sequelize[_0x14d3('0x3')]},'billableseconds':{'type':Sequelize[_0x14d3('0x3')]}}; \ No newline at end of file +var _0xf99e=['INTEGER','DATE','called,connect,complete','exports','STRING'];(function(_0x172544,_0x5b1077){var _0x5313cb=function(_0x21d529){while(--_0x21d529){_0x172544['push'](_0x172544['shift']());}};_0x5313cb(++_0x5b1077);}(_0xf99e,0x189));var _0xef99=function(_0x2b9847,_0x5b5294){_0x2b9847=_0x2b9847-0x0;var _0x4e393f=_0xf99e[_0x2b9847];return _0x4e393f;};'use strict';var Sequelize=require('sequelize');module[_0xef99('0x0')]={'privilege':{'type':Sequelize[_0xef99('0x1')]},'channel':{'type':Sequelize[_0xef99('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xef99('0x1')]},'calleridnum':{'type':Sequelize[_0xef99('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xef99('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xef99('0x1')]},'accountcode':{'type':Sequelize[_0xef99('0x1')]},'context':{'type':Sequelize[_0xef99('0x1')]},'exten':{'type':Sequelize[_0xef99('0x1')]},'priority':{'type':Sequelize[_0xef99('0x2')]},'uniqueid':{'type':Sequelize[_0xef99('0x1')]},'linkedid':{'type':Sequelize[_0xef99('0x1')]},'destchannel':{'type':Sequelize[_0xef99('0x1')]},'destchannelstate':{'type':Sequelize[_0xef99('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xef99('0x1')]},'destcalleridnum':{'type':Sequelize[_0xef99('0x1')]},'destcalleridname':{'type':Sequelize[_0xef99('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xef99('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xef99('0x1')]},'destlanguage':{'type':Sequelize[_0xef99('0x1')]},'destaccountcode':{'type':Sequelize[_0xef99('0x1')]},'destcontext':{'type':Sequelize[_0xef99('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xef99('0x2')]},'destuniqueid':{'type':Sequelize[_0xef99('0x1')]},'destlinkedid':{'type':Sequelize[_0xef99('0x1')]},'dialstring':{'type':Sequelize[_0xef99('0x1')]},'dialstatus':{'type':Sequelize[_0xef99('0x1')]},'starttime':{'type':Sequelize[_0xef99('0x3')]},'answertime':{'type':Sequelize[_0xef99('0x3')]},'endtime':{'type':Sequelize[_0xef99('0x3')]},'lastevent':{'type':Sequelize[_0xef99('0x1')],'comment':_0xef99('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xef99('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xef99('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index dc284df..fcfdc9e 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 _0xda49=['rows','catch','show','params','options','find','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x47ea4d,_0x483a90){var _0x21136d=function(_0x54fe97){while(--_0x54fe97){_0x47ea4d['push'](_0x47ea4d['shift']());}};_0x21136d(++_0x483a90);}(_0xda49,0x1b3));var _0x9da4=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xda49[_0x28aea5];return _0x6a55f9;};'use strict';var pdf=require(_0x9da4('0x0'));var emlformat=require(_0x9da4('0x1'));var rimraf=require(_0x9da4('0x2'));var zipdir=require(_0x9da4('0x3'));var jsonpatch=require(_0x9da4('0x4'));var rp=require('request-promise');var moment=require(_0x9da4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9da4('0x6'));var util=require(_0x9da4('0x7'));var path=require(_0x9da4('0x8'));var sox=require('sox');var csv=require(_0x9da4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9da4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9da4('0x9'));var querystring=require(_0x9da4('0xb'));var Papa=require(_0x9da4('0xc'));var Redis=require(_0x9da4('0xd'));var authService=require(_0x9da4('0xe'));var qs=require(_0x9da4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9da4('0x10'));var logger=require(_0x9da4('0x11'))(_0x9da4('0x12'));var utils=require(_0x9da4('0x13'));var config=require('../../config/environment');var db=require(_0x9da4('0x14'))['db'];function respondWithStatusCode(_0x481cb2,_0xf7faae){_0xf7faae=_0xf7faae||0xcc;return function(_0xb2c76a){if(_0xb2c76a){return _0x481cb2[_0x9da4('0x15')](_0xf7faae);}return _0x481cb2[_0x9da4('0x16')](_0xf7faae)[_0x9da4('0x17')]();};}function respondWithResult(_0x1ec8ee,_0x5bbcd8){_0x5bbcd8=_0x5bbcd8||0xc8;return function(_0x253af1){if(_0x253af1){return _0x1ec8ee[_0x9da4('0x16')](_0x5bbcd8)[_0x9da4('0x18')](_0x253af1);}};}function respondWithFilteredResult(_0x37159e,_0x473927){return function(_0x2675d1){if(_0x2675d1){var _0x1685c4=_0x2675d1[_0x9da4('0x19')],_0x72909c=_0x473927[_0x9da4('0x1a')],_0x146b17=_0x473927[_0x9da4('0x1a')]+_0x473927[_0x9da4('0x1b')],_0x38a5e2;if(_0x146b17>=_0x1685c4){_0x146b17=_0x1685c4;_0x38a5e2=0xc8;}else{_0x38a5e2=0xce;}_0x37159e[_0x9da4('0x16')](_0x38a5e2);return _0x37159e[_0x9da4('0x1c')](_0x9da4('0x1d'),_0x72909c+'-'+_0x146b17+'/'+_0x1685c4)[_0x9da4('0x18')](_0x2675d1);}return null;};}function patchUpdates(_0x1d3d53){return function(_0xdfb622){try{jsonpatch[_0x9da4('0x1e')](_0xdfb622,_0x1d3d53,!![]);}catch(_0x24ef41){return BPromise['reject'](_0x24ef41);}return _0xdfb622[_0x9da4('0x1f')]();};}function saveUpdates(_0x3baaa6,_0x4a1753){return function(_0x5a4f92){if(_0x5a4f92){return _0x5a4f92['update'](_0x3baaa6)[_0x9da4('0x20')](function(_0x40f4a5){return _0x40f4a5;});}return null;};}function removeEntity(_0x577ab4,_0x2b561c){return function(_0x1658e0){if(_0x1658e0){return _0x1658e0[_0x9da4('0x21')]()[_0x9da4('0x20')](function(){_0x577ab4[_0x9da4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee6081,_0x401ec2){return function(_0x33fed8){if(!_0x33fed8){_0xee6081[_0x9da4('0x15')](0x194);}return _0x33fed8;};}function handleError(_0x3dc54c,_0x4cf793){_0x4cf793=_0x4cf793||0x1f4;return function(_0x39c404){logger[_0x9da4('0x22')](_0x39c404[_0x9da4('0x23')]);if(_0x39c404[_0x9da4('0x24')]){delete _0x39c404[_0x9da4('0x24')];}_0x3dc54c[_0x9da4('0x16')](_0x4cf793)[_0x9da4('0x25')](_0x39c404);};}exports[_0x9da4('0x26')]=function(_0x3dea12,_0x40aaef){var _0x39f0d6={},_0x4a6b88={},_0x5ad1e7={'count':0x0,'rows':[]};var _0x15e6c0=_[_0x9da4('0x27')](db[_0x9da4('0x28')][_0x9da4('0x29')],function(_0x498fe8){return{'name':_0x498fe8['fieldName'],'type':_0x498fe8[_0x9da4('0x2a')]['key']};});_0x4a6b88[_0x9da4('0x2b')]=_[_0x9da4('0x27')](_0x15e6c0,_0x9da4('0x24'));_0x4a6b88['query']=_[_0x9da4('0x2c')](_0x3dea12[_0x9da4('0x2d')]);_0x4a6b88[_0x9da4('0x2e')]=_[_0x9da4('0x2f')](_0x4a6b88[_0x9da4('0x2b')],_0x4a6b88[_0x9da4('0x2d')]);_0x39f0d6[_0x9da4('0x30')]=_[_0x9da4('0x2f')](_0x4a6b88[_0x9da4('0x2b')],qs[_0x9da4('0x31')](_0x3dea12[_0x9da4('0x2d')][_0x9da4('0x31')]));_0x39f0d6[_0x9da4('0x30')]=_0x39f0d6[_0x9da4('0x30')][_0x9da4('0x32')]?_0x39f0d6[_0x9da4('0x30')]:_0x4a6b88[_0x9da4('0x2b')];if(!_0x3dea12[_0x9da4('0x2d')][_0x9da4('0x33')]('nolimit')){_0x39f0d6[_0x9da4('0x1b')]=qs[_0x9da4('0x1b')](_0x3dea12[_0x9da4('0x2d')][_0x9da4('0x1b')]);_0x39f0d6[_0x9da4('0x1a')]=qs[_0x9da4('0x1a')](_0x3dea12['query'][_0x9da4('0x1a')]);}_0x39f0d6[_0x9da4('0x34')]=qs[_0x9da4('0x35')](_0x3dea12[_0x9da4('0x2d')]['sort']);_0x39f0d6[_0x9da4('0x36')]=qs[_0x9da4('0x2e')](_[_0x9da4('0x37')](_0x3dea12[_0x9da4('0x2d')],_0x4a6b88['filters']),_0x15e6c0);if(_0x3dea12[_0x9da4('0x2d')][_0x9da4('0x38')]){_0x39f0d6['where']=_[_0x9da4('0x39')](_0x39f0d6['where'],{'$or':_[_0x9da4('0x27')](_0x15e6c0,function(_0x3bc912){if(_0x3bc912['type']!==_0x9da4('0x3a')){var _0x5dc920={};_0x5dc920[_0x3bc912[_0x9da4('0x24')]]={'$like':'%'+_0x3dea12[_0x9da4('0x2d')][_0x9da4('0x38')]+'%'};return _0x5dc920;}})});}_0x39f0d6=_[_0x9da4('0x39')]({},_0x39f0d6,_0x3dea12['options']);var _0x202580={'where':_0x39f0d6[_0x9da4('0x36')]};return db['VoiceDialReport'][_0x9da4('0x19')](_0x202580)[_0x9da4('0x20')](function(_0x589906){_0x5ad1e7[_0x9da4('0x19')]=_0x589906;if(_0x3dea12[_0x9da4('0x2d')][_0x9da4('0x3b')]){_0x39f0d6[_0x9da4('0x3c')]=[{'all':!![]}];}return db[_0x9da4('0x28')][_0x9da4('0x3d')](_0x39f0d6);})[_0x9da4('0x20')](function(_0xb8016c){_0x5ad1e7[_0x9da4('0x3e')]=_0xb8016c;return _0x5ad1e7;})['then'](respondWithFilteredResult(_0x40aaef,_0x39f0d6))[_0x9da4('0x3f')](handleError(_0x40aaef,null));};exports[_0x9da4('0x40')]=function(_0x206726,_0x80df4b){var _0x595fc4={'raw':!![],'where':{'id':_0x206726[_0x9da4('0x41')]['id']}},_0x12f775={};_0x12f775[_0x9da4('0x2b')]=_[_0x9da4('0x2c')](db['VoiceDialReport'][_0x9da4('0x29')]);_0x12f775['query']=_[_0x9da4('0x2c')](_0x206726[_0x9da4('0x2d')]);_0x12f775[_0x9da4('0x2e')]=_[_0x9da4('0x2f')](_0x12f775[_0x9da4('0x2b')],_0x12f775[_0x9da4('0x2d')]);_0x595fc4[_0x9da4('0x30')]=_[_0x9da4('0x2f')](_0x12f775[_0x9da4('0x2b')],qs[_0x9da4('0x31')](_0x206726['query'][_0x9da4('0x31')]));_0x595fc4[_0x9da4('0x30')]=_0x595fc4['attributes'][_0x9da4('0x32')]?_0x595fc4[_0x9da4('0x30')]:_0x12f775[_0x9da4('0x2b')];if(_0x206726[_0x9da4('0x2d')][_0x9da4('0x3b')]){_0x595fc4[_0x9da4('0x3c')]=[{'all':!![]}];}_0x595fc4=_[_0x9da4('0x39')]({},_0x595fc4,_0x206726[_0x9da4('0x42')]);return db['VoiceDialReport'][_0x9da4('0x43')](_0x595fc4)[_0x9da4('0x20')](handleEntityNotFound(_0x80df4b,null))['then'](respondWithResult(_0x80df4b,null))[_0x9da4('0x3f')](handleError(_0x80df4b,null));};exports['create']=function(_0x516020,_0x198842){return db[_0x9da4('0x28')]['create'](_0x516020['body'],{})[_0x9da4('0x20')](respondWithResult(_0x198842,0xc9))[_0x9da4('0x3f')](handleError(_0x198842,null));};exports[_0x9da4('0x44')]=function(_0x2b2b14,_0xd36cc){if(_0x2b2b14[_0x9da4('0x45')]['id']){delete _0x2b2b14['body']['id'];}return db['VoiceDialReport'][_0x9da4('0x43')]({'where':{'id':_0x2b2b14[_0x9da4('0x41')]['id']}})[_0x9da4('0x20')](handleEntityNotFound(_0xd36cc,null))['then'](saveUpdates(_0x2b2b14[_0x9da4('0x45')],null))[_0x9da4('0x20')](respondWithResult(_0xd36cc,null))['catch'](handleError(_0xd36cc,null));};exports[_0x9da4('0x21')]=function(_0x9de6ff,_0xb134ea){return db[_0x9da4('0x28')][_0x9da4('0x43')]({'where':{'id':_0x9de6ff[_0x9da4('0x41')]['id']}})['then'](handleEntityNotFound(_0xb134ea,null))[_0x9da4('0x20')](removeEntity(_0xb134ea,null))['catch'](handleError(_0xb134ea,null));};exports[_0x9da4('0x46')]=function(_0x462adc,_0x48e5b2){return db[_0x9da4('0x28')]['describe']()[_0x9da4('0x20')](respondWithResult(_0x48e5b2,null))[_0x9da4('0x3f')](handleError(_0x48e5b2,null));}; \ No newline at end of file +var _0x6be5=['name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','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','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','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','count','offset','limit','set','apply','save','update','destroy','then','error'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x6be5,0x71));var _0x56be=function(_0x2772f1,_0x370888){_0x2772f1=_0x2772f1-0x0;var _0x5cee94=_0x6be5[_0x2772f1];return _0x5cee94;};'use strict';var pdf=require(_0x56be('0x0'));var emlformat=require(_0x56be('0x1'));var rimraf=require(_0x56be('0x2'));var zipdir=require(_0x56be('0x3'));var jsonpatch=require(_0x56be('0x4'));var rp=require(_0x56be('0x5'));var moment=require(_0x56be('0x6'));var BPromise=require(_0x56be('0x7'));var Mustache=require(_0x56be('0x8'));var util=require(_0x56be('0x9'));var path=require(_0x56be('0xa'));var sox=require(_0x56be('0xb'));var csv=require('to-csv');var ejs=require(_0x56be('0xc'));var fs=require('fs');var _=require(_0x56be('0xd'));var squel=require('squel');var crypto=require(_0x56be('0xe'));var jsforce=require(_0x56be('0xf'));var deskjs=require(_0x56be('0x10'));var toCsv=require(_0x56be('0x11'));var querystring=require(_0x56be('0x12'));var Papa=require(_0x56be('0x13'));var Redis=require('ioredis');var authService=require(_0x56be('0x14'));var qs=require(_0x56be('0x15'));var as=require(_0x56be('0x16'));var hardwareService=require(_0x56be('0x17'));var logger=require(_0x56be('0x18'))(_0x56be('0x19'));var utils=require(_0x56be('0x1a'));var config=require(_0x56be('0x1b'));var db=require(_0x56be('0x1c'))['db'];function respondWithStatusCode(_0x4ae430,_0x58a9d2){_0x58a9d2=_0x58a9d2||0xcc;return function(_0x2df7b4){if(_0x2df7b4){return _0x4ae430[_0x56be('0x1d')](_0x58a9d2);}return _0x4ae430[_0x56be('0x1e')](_0x58a9d2)[_0x56be('0x1f')]();};}function respondWithResult(_0x135b46,_0x9b2f52){_0x9b2f52=_0x9b2f52||0xc8;return function(_0x388256){if(_0x388256){return _0x135b46[_0x56be('0x1e')](_0x9b2f52)[_0x56be('0x20')](_0x388256);}};}function respondWithFilteredResult(_0x2dd99d,_0x576bd7){return function(_0x47bd5b){if(_0x47bd5b){var _0x3dc1b3=_0x47bd5b[_0x56be('0x21')],_0x2e6ab7=_0x576bd7[_0x56be('0x22')],_0x19b451=_0x576bd7['offset']+_0x576bd7[_0x56be('0x23')],_0xeb5c8d;if(_0x19b451>=_0x3dc1b3){_0x19b451=_0x3dc1b3;_0xeb5c8d=0xc8;}else{_0xeb5c8d=0xce;}_0x2dd99d[_0x56be('0x1e')](_0xeb5c8d);return _0x2dd99d[_0x56be('0x24')]('Content-Range',_0x2e6ab7+'-'+_0x19b451+'/'+_0x3dc1b3)[_0x56be('0x20')](_0x47bd5b);}return null;};}function patchUpdates(_0x47ba05){return function(_0x473d67){try{jsonpatch[_0x56be('0x25')](_0x473d67,_0x47ba05,!![]);}catch(_0x5178d8){return BPromise['reject'](_0x5178d8);}return _0x473d67[_0x56be('0x26')]();};}function saveUpdates(_0x44891c,_0xe8ac97){return function(_0x407a3a){if(_0x407a3a){return _0x407a3a[_0x56be('0x27')](_0x44891c)['then'](function(_0x144e65){return _0x144e65;});}return null;};}function removeEntity(_0x402b21,_0x55a087){return function(_0x13800d){if(_0x13800d){return _0x13800d[_0x56be('0x28')]()[_0x56be('0x29')](function(){_0x402b21['status'](0xcc)[_0x56be('0x1f')]();});}};}function handleEntityNotFound(_0x4e42db,_0x559b26){return function(_0x23293b){if(!_0x23293b){_0x4e42db[_0x56be('0x1d')](0x194);}return _0x23293b;};}function handleError(_0x4fd183,_0x68f5f7){_0x68f5f7=_0x68f5f7||0x1f4;return function(_0x38502d){logger[_0x56be('0x2a')](_0x38502d['stack']);if(_0x38502d[_0x56be('0x2b')]){delete _0x38502d[_0x56be('0x2b')];}_0x4fd183[_0x56be('0x1e')](_0x68f5f7)['send'](_0x38502d);};}exports[_0x56be('0x2c')]=function(_0x665ea5,_0x45d4f0){var _0x19d433={},_0x52344a={},_0x177d4c={'count':0x0,'rows':[]};var _0x4e7e07=_[_0x56be('0x2d')](db[_0x56be('0x2e')][_0x56be('0x2f')],function(_0x3101d9){return{'name':_0x3101d9[_0x56be('0x30')],'type':_0x3101d9[_0x56be('0x31')][_0x56be('0x32')]};});_0x52344a[_0x56be('0x33')]=_[_0x56be('0x2d')](_0x4e7e07,'name');_0x52344a[_0x56be('0x34')]=_[_0x56be('0x35')](_0x665ea5[_0x56be('0x34')]);_0x52344a[_0x56be('0x36')]=_[_0x56be('0x37')](_0x52344a[_0x56be('0x33')],_0x52344a[_0x56be('0x34')]);_0x19d433[_0x56be('0x38')]=_['intersection'](_0x52344a[_0x56be('0x33')],qs[_0x56be('0x39')](_0x665ea5[_0x56be('0x34')]['fields']));_0x19d433['attributes']=_0x19d433['attributes'][_0x56be('0x3a')]?_0x19d433[_0x56be('0x38')]:_0x52344a[_0x56be('0x33')];if(!_0x665ea5['query']['hasOwnProperty'](_0x56be('0x3b'))){_0x19d433[_0x56be('0x23')]=qs['limit'](_0x665ea5[_0x56be('0x34')][_0x56be('0x23')]);_0x19d433[_0x56be('0x22')]=qs['offset'](_0x665ea5[_0x56be('0x34')][_0x56be('0x22')]);}_0x19d433[_0x56be('0x3c')]=qs[_0x56be('0x3d')](_0x665ea5[_0x56be('0x34')]['sort']);_0x19d433['where']=qs[_0x56be('0x36')](_[_0x56be('0x3e')](_0x665ea5[_0x56be('0x34')],_0x52344a[_0x56be('0x36')]),_0x4e7e07);if(_0x665ea5[_0x56be('0x34')][_0x56be('0x3f')]){_0x19d433[_0x56be('0x40')]=_[_0x56be('0x41')](_0x19d433[_0x56be('0x40')],{'$or':_['map'](_0x4e7e07,function(_0x21286b){if(_0x21286b[_0x56be('0x31')]!==_0x56be('0x42')){var _0x106c9f={};_0x106c9f[_0x21286b['name']]={'$like':'%'+_0x665ea5['query'][_0x56be('0x3f')]+'%'};return _0x106c9f;}})});}_0x19d433=_[_0x56be('0x41')]({},_0x19d433,_0x665ea5[_0x56be('0x43')]);var _0x522274={'where':_0x19d433[_0x56be('0x40')]};return db[_0x56be('0x2e')][_0x56be('0x21')](_0x522274)[_0x56be('0x29')](function(_0x368fc1){_0x177d4c[_0x56be('0x21')]=_0x368fc1;if(_0x665ea5[_0x56be('0x34')][_0x56be('0x44')]){_0x19d433['include']=[{'all':!![]}];}return db[_0x56be('0x2e')][_0x56be('0x45')](_0x19d433);})[_0x56be('0x29')](function(_0x56d9c1){_0x177d4c[_0x56be('0x46')]=_0x56d9c1;return _0x177d4c;})[_0x56be('0x29')](respondWithFilteredResult(_0x45d4f0,_0x19d433))[_0x56be('0x47')](handleError(_0x45d4f0,null));};exports[_0x56be('0x48')]=function(_0x441fa8,_0xed2702){var _0x5a105d={'raw':!![],'where':{'id':_0x441fa8['params']['id']}},_0x42ea0b={};_0x42ea0b[_0x56be('0x33')]=_['keys'](db[_0x56be('0x2e')][_0x56be('0x2f')]);_0x42ea0b['query']=_[_0x56be('0x35')](_0x441fa8[_0x56be('0x34')]);_0x42ea0b[_0x56be('0x36')]=_[_0x56be('0x37')](_0x42ea0b[_0x56be('0x33')],_0x42ea0b[_0x56be('0x34')]);_0x5a105d['attributes']=_[_0x56be('0x37')](_0x42ea0b[_0x56be('0x33')],qs[_0x56be('0x39')](_0x441fa8['query']['fields']));_0x5a105d[_0x56be('0x38')]=_0x5a105d[_0x56be('0x38')]['length']?_0x5a105d[_0x56be('0x38')]:_0x42ea0b[_0x56be('0x33')];if(_0x441fa8[_0x56be('0x34')]['includeAll']){_0x5a105d['include']=[{'all':!![]}];}_0x5a105d=_['merge']({},_0x5a105d,_0x441fa8[_0x56be('0x43')]);return db[_0x56be('0x2e')][_0x56be('0x49')](_0x5a105d)['then'](handleEntityNotFound(_0xed2702,null))[_0x56be('0x29')](respondWithResult(_0xed2702,null))['catch'](handleError(_0xed2702,null));};exports[_0x56be('0x4a')]=function(_0x273f26,_0x3a75ce){return db[_0x56be('0x2e')][_0x56be('0x4a')](_0x273f26[_0x56be('0x4b')],{})['then'](respondWithResult(_0x3a75ce,0xc9))[_0x56be('0x47')](handleError(_0x3a75ce,null));};exports[_0x56be('0x27')]=function(_0x58746d,_0x551082){if(_0x58746d[_0x56be('0x4b')]['id']){delete _0x58746d[_0x56be('0x4b')]['id'];}return db['VoiceDialReport'][_0x56be('0x49')]({'where':{'id':_0x58746d[_0x56be('0x4c')]['id']}})[_0x56be('0x29')](handleEntityNotFound(_0x551082,null))[_0x56be('0x29')](saveUpdates(_0x58746d[_0x56be('0x4b')],null))['then'](respondWithResult(_0x551082,null))[_0x56be('0x47')](handleError(_0x551082,null));};exports[_0x56be('0x28')]=function(_0x24ac4a,_0x1ef15d){return db['VoiceDialReport']['find']({'where':{'id':_0x24ac4a[_0x56be('0x4c')]['id']}})[_0x56be('0x29')](handleEntityNotFound(_0x1ef15d,null))[_0x56be('0x29')](removeEntity(_0x1ef15d,null))[_0x56be('0x47')](handleError(_0x1ef15d,null));};exports[_0x56be('0x4d')]=function(_0x11b054,_0x46ff24){return db[_0x56be('0x2e')][_0x56be('0x4d')]()[_0x56be('0x29')](respondWithResult(_0x46ff24,null))['catch'](handleError(_0x46ff24,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2f80217..154f182 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 _0x1971=['rimraf','exports','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x1971,0x102));var _0x1197=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x1971[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x1197('0x0'));var util=require('util');var logger=require(_0x1197('0x1'))('api');var moment=require(_0x1197('0x2'));var BPromise=require(_0x1197('0x3'));var rp=require(_0x1197('0x4'));var fs=require('fs');var path=require(_0x1197('0x5'));var rimraf=require(_0x1197('0x6'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x1197('0x7')]=function(_0x259b76,_0x44c6cd){return _0x259b76['define'](_0x1197('0x8'),attributes,{'tableName':_0x1197('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1197('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd991=['define','uniqueid','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3e539b,_0x43e11b){var _0x3434f9=function(_0x5d7c5f){while(--_0x5d7c5f){_0x3e539b['push'](_0x3e539b['shift']());}};_0x3434f9(++_0x43e11b);}(_0xd991,0x6a));var _0x1d99=function(_0x196615,_0x582da9){_0x196615=_0x196615-0x0;var _0x593cc6=_0xd991[_0x196615];return _0x593cc6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1d99('0x0'))(_0x1d99('0x1'));var moment=require('moment');var BPromise=require(_0x1d99('0x2'));var rp=require(_0x1d99('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d99('0x4'));var config=require(_0x1d99('0x5'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x31cd03,_0x3b8e08){return _0x31cd03[_0x1d99('0x6')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x1d99('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index dac63e3..5646789 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 _0xf00e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','VoiceDialReport,\x20%s,\x20%s','message','error','result','catch','body','options','raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','update','where','limit','lodash','util','moment'];(function(_0x40f639,_0x2f9df4){var _0x549354=function(_0x5478fa){while(--_0x5478fa){_0x40f639['push'](_0x40f639['shift']());}};_0x549354(++_0x2f9df4);}(_0xf00e,0x12f));var _0xef00=function(_0x224e96,_0x4dcd36){_0x224e96=_0x224e96-0x0;var _0x210e15=_0xf00e[_0x224e96];return _0x210e15;};'use strict';var _=require(_0xef00('0x0'));var util=require(_0xef00('0x1'));var moment=require(_0xef00('0x2'));var BPromise=require(_0xef00('0x3'));var rs=require(_0xef00('0x4'));var fs=require('fs');var Redis=require(_0xef00('0x5'));var db=require(_0xef00('0x6'))['db'];var utils=require(_0xef00('0x7'));var logger=require(_0xef00('0x8'))(_0xef00('0x9'));var config=require(_0xef00('0xa'));var jayson=require(_0xef00('0xb'));var client=jayson[_0xef00('0xc')][_0xef00('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x254f2e,_0x17ec9e,_0x2245a3){return new BPromise(function(_0xdfd1bd,_0x543859){return client[_0xef00('0xe')](_0x254f2e,_0x2245a3)['then'](function(_0x50e9c9){logger[_0xef00('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x17ec9e,'request\x20sent');logger[_0xef00('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x17ec9e,_0xef00('0x11'),JSON[_0xef00('0x12')](_0x50e9c9));if(_0x50e9c9['error']){if(_0x50e9c9['error']['code']===0x1f4){logger['error'](_0xef00('0x13'),_0x17ec9e,_0x50e9c9['error'][_0xef00('0x14')]);return _0x543859(_0x50e9c9['error'][_0xef00('0x14')]);}logger[_0xef00('0x15')](_0xef00('0x13'),_0x17ec9e,_0x50e9c9[_0xef00('0x15')][_0xef00('0x14')]);return _0xdfd1bd(_0x50e9c9['error'][_0xef00('0x14')]);}else{logger[_0xef00('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x17ec9e,_0xef00('0x11'));_0xdfd1bd(_0x50e9c9[_0xef00('0x16')][_0xef00('0x14')]);}})[_0xef00('0x17')](function(_0x581008){logger[_0xef00('0x15')](_0xef00('0x13'),_0x17ec9e,_0x581008);_0x543859(_0x581008);});});}exports['CreateVoiceDialReport']=function(_0x45a9d4){var _0x387453=this;return new Promise(function(_0x242658,_0x5e266d){return db['VoiceDialReport']['create'](_0x45a9d4[_0xef00('0x18')],{'raw':_0x45a9d4[_0xef00('0x19')]?_0x45a9d4['options'][_0xef00('0x1a')]===undefined?!![]:![]:!![]})[_0xef00('0x1b')](function(_0x4e4157){logger['info'](_0xef00('0x1c'),_0x45a9d4);logger[_0xef00('0x10')]('CreateVoiceDialReport',_0x45a9d4,JSON[_0xef00('0x12')](_0x4e4157));_0x242658(_0x4e4157);})[_0xef00('0x17')](function(_0x54cd84){logger[_0xef00('0x15')]('CreateVoiceDialReport',_0x54cd84['message'],_0x45a9d4);_0x5e266d(_0x387453[_0xef00('0x15')](0x1f4,_0x54cd84['message']));});});};exports[_0xef00('0x1d')]=function(_0x1f6b50){var _0x2118b8=this;return new Promise(function(_0x332195,_0x57f4eb){return db[_0xef00('0x1e')][_0xef00('0x1f')](_0x1f6b50[_0xef00('0x18')],{'raw':_0x1f6b50['options']?_0x1f6b50[_0xef00('0x19')][_0xef00('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f6b50[_0xef00('0x19')]?_0x1f6b50[_0xef00('0x19')][_0xef00('0x20')]||null:null,'attributes':_0x1f6b50[_0xef00('0x19')]?_0x1f6b50[_0xef00('0x19')]['attributes']||null:null,'limit':_0x1f6b50['options']?_0x1f6b50[_0xef00('0x19')][_0xef00('0x21')]||null:null})[_0xef00('0x1b')](function(_0x5c6eb1){logger[_0xef00('0xf')](_0xef00('0x1d'),_0x1f6b50);logger[_0xef00('0x10')](_0xef00('0x1d'),_0x1f6b50,JSON[_0xef00('0x12')](_0x5c6eb1));_0x332195(_0x5c6eb1);})['catch'](function(_0x26f3c0){logger[_0xef00('0x15')]('UpdateVoiceDialReport',_0x26f3c0[_0xef00('0x14')],_0x1f6b50);_0x57f4eb(_0x2118b8[_0xef00('0x15')](0x1f4,_0x26f3c0[_0xef00('0x14')]));});});}; \ No newline at end of file +var _0xe3c5=['../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','options','then','CreateVoiceDialReport','UpdateVoiceDialReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5a4b4c,_0x2c504f){var _0x500540=function(_0x383e00){while(--_0x383e00){_0x5a4b4c['push'](_0x5a4b4c['shift']());}};_0x500540(++_0x2c504f);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x1dd2cc,_0x36ddfe){_0x1dd2cc=_0x1dd2cc-0x0;var _0x305d8e=_0xe3c5[_0x1dd2cc];return _0x305d8e;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var moment=require(_0x5e3c('0x2'));var BPromise=require(_0x5e3c('0x3'));var rs=require(_0x5e3c('0x4'));var fs=require('fs');var Redis=require(_0x5e3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e3c('0x6'));var logger=require(_0x5e3c('0x7'))(_0x5e3c('0x8'));var config=require(_0x5e3c('0x9'));var jayson=require(_0x5e3c('0xa'));var client=jayson[_0x5e3c('0xb')][_0x5e3c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d6b68,_0xc8c788,_0x17076a){return new BPromise(function(_0x3139da,_0x3068c6){return client['request'](_0x2d6b68,_0x17076a)['then'](function(_0x32942e){logger[_0x5e3c('0xd')](_0x5e3c('0xe'),_0xc8c788,_0x5e3c('0xf'));logger[_0x5e3c('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xc8c788,_0x5e3c('0xf'),JSON[_0x5e3c('0x11')](_0x32942e));if(_0x32942e['error']){if(_0x32942e[_0x5e3c('0x12')]['code']===0x1f4){logger['error'](_0x5e3c('0xe'),_0xc8c788,_0x32942e[_0x5e3c('0x12')][_0x5e3c('0x13')]);return _0x3068c6(_0x32942e[_0x5e3c('0x12')][_0x5e3c('0x13')]);}logger[_0x5e3c('0x12')](_0x5e3c('0xe'),_0xc8c788,_0x32942e[_0x5e3c('0x12')]['message']);return _0x3139da(_0x32942e['error'][_0x5e3c('0x13')]);}else{logger[_0x5e3c('0xd')](_0x5e3c('0xe'),_0xc8c788,'request\x20sent');_0x3139da(_0x32942e['result'][_0x5e3c('0x13')]);}})[_0x5e3c('0x14')](function(_0x321487){logger[_0x5e3c('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0xc8c788,_0x321487);_0x3068c6(_0x321487);});});}exports['CreateVoiceDialReport']=function(_0xc3635a){var _0x5e4a11=this;return new Promise(function(_0x4c8267,_0x17e973){return db['VoiceDialReport']['create'](_0xc3635a['body'],{'raw':_0xc3635a[_0x5e3c('0x15')]?_0xc3635a[_0x5e3c('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x5e3c('0x16')](function(_0x55a5e8){logger[_0x5e3c('0xd')](_0x5e3c('0x17'),_0xc3635a);logger[_0x5e3c('0x10')](_0x5e3c('0x17'),_0xc3635a,JSON[_0x5e3c('0x11')](_0x55a5e8));_0x4c8267(_0x55a5e8);})[_0x5e3c('0x14')](function(_0xf2a06c){logger['error']('CreateVoiceDialReport',_0xf2a06c['message'],_0xc3635a);_0x17e973(_0x5e4a11['error'](0x1f4,_0xf2a06c[_0x5e3c('0x13')]));});});};exports[_0x5e3c('0x18')]=function(_0x418994){var _0x1cf57f=this;return new Promise(function(_0x1a74ab,_0x41d7cd){return db['VoiceDialReport'][_0x5e3c('0x19')](_0x418994[_0x5e3c('0x1a')],{'raw':_0x418994[_0x5e3c('0x15')]?_0x418994[_0x5e3c('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x418994['options']?_0x418994[_0x5e3c('0x15')][_0x5e3c('0x1b')]||null:null,'attributes':_0x418994['options']?_0x418994[_0x5e3c('0x15')][_0x5e3c('0x1c')]||null:null,'limit':_0x418994[_0x5e3c('0x15')]?_0x418994[_0x5e3c('0x15')][_0x5e3c('0x1d')]||null:null})['then'](function(_0x2a61ab){logger['info']('UpdateVoiceDialReport',_0x418994);logger[_0x5e3c('0x10')](_0x5e3c('0x18'),_0x418994,JSON[_0x5e3c('0x11')](_0x2a61ab));_0x1a74ab(_0x2a61ab);})[_0x5e3c('0x14')](function(_0x488cc3){logger[_0x5e3c('0x12')](_0x5e3c('0x18'),_0x488cc3[_0x5e3c('0x13')],_0x418994);_0x41d7cd(_0x1cf57f[_0x5e3c('0x12')](0x1f4,_0x488cc3['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f36319f..0a6ec15 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 _0x0a1f=['util','path','express','Router','../../components/auth/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','put','update','delete','exports'];(function(_0x4dd2e4,_0x5a1252){var _0x166758=function(_0x26e508){while(--_0x26e508){_0x4dd2e4['push'](_0x4dd2e4['shift']());}};_0x166758(++_0x5a1252);}(_0x0a1f,0x88));var _0xf0a1=function(_0x1a2ea6,_0x135188){_0x1a2ea6=_0x1a2ea6-0x0;var _0x5e08ac=_0x0a1f[_0x1a2ea6];return _0x5e08ac;};'use strict';var multer=require('multer');var util=require(_0xf0a1('0x0'));var path=require(_0xf0a1('0x1'));var timeout=require('connect-timeout');var express=require(_0xf0a1('0x2'));var router=express[_0xf0a1('0x3')]();var auth=require(_0xf0a1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf0a1('0x5'));router[_0xf0a1('0x6')]('/',auth[_0xf0a1('0x7')](),controller[_0xf0a1('0x8')]);router[_0xf0a1('0x6')](_0xf0a1('0x9'),auth[_0xf0a1('0x7')](),controller['show']);router[_0xf0a1('0xa')]('/',auth[_0xf0a1('0x7')](),controller[_0xf0a1('0xb')]);router[_0xf0a1('0xa')](_0xf0a1('0xc'),auth[_0xf0a1('0x7')](),controller['addApplications']);router[_0xf0a1('0xd')](_0xf0a1('0x9'),auth[_0xf0a1('0x7')](),controller[_0xf0a1('0xe')]);router[_0xf0a1('0xf')](_0xf0a1('0x9'),auth[_0xf0a1('0x7')](),controller['destroy']);module[_0xf0a1('0x10')]=router; \ No newline at end of file +var _0xe43b=['create','/:id/applications','addApplications','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id'];(function(_0x2b1bb9,_0x3f85cc){var _0x59f401=function(_0x14ac15){while(--_0x14ac15){_0x2b1bb9['push'](_0x2b1bb9['shift']());}};_0x59f401(++_0x3f85cc);}(_0xe43b,0x1ed));var _0xbe43=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0xe43b[_0x25bca6];return _0x3f8d02;};'use strict';var multer=require(_0xbe43('0x0'));var util=require(_0xbe43('0x1'));var path=require(_0xbe43('0x2'));var timeout=require(_0xbe43('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbe43('0x4'));var config=require(_0xbe43('0x5'));var controller=require(_0xbe43('0x6'));router[_0xbe43('0x7')]('/',auth[_0xbe43('0x8')](),controller[_0xbe43('0x9')]);router[_0xbe43('0x7')](_0xbe43('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xbe43('0x8')](),controller[_0xbe43('0xb')]);router['post'](_0xbe43('0xc'),auth[_0xbe43('0x8')](),controller[_0xbe43('0xd')]);router[_0xbe43('0xe')](_0xbe43('0xa'),auth['isAuthenticated'](),controller[_0xbe43('0xf')]);router[_0xbe43('0x10')](_0xbe43('0xa'),auth[_0xbe43('0x8')](),controller[_0xbe43('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 03bbbd0..1377dde 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(_0x209255,_0x15e90d){var _0xf98aa5=function(_0x412555){while(--_0x412555){_0x209255['push'](_0x209255['shift']());}};_0xf98aa5(++_0x15e90d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x18e47e,_0x2accac){var _0x4721c9=function(_0x3d65ea){while(--_0x3d65ea){_0x18e47e['push'](_0x18e47e['shift']());}};_0x4721c9(++_0x2accac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 16a3631..c83e236 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 _0x2542=['includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','create','body','startsWith','exten','role','user','OutboundRoutes','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','cutdigits','mandatoryDisposition','sequelize','transaction','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','destroy','then','get','InboundRoutes','outbound','internal','filter','ignore','map','value'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2542,0x169));var _0x2254=function(_0x141a31,_0x3ab263){_0x141a31=_0x141a31-0x0;var _0x44b4e3=_0x2542[_0x141a31];return _0x44b4e3;};'use strict';var pdf=require(_0x2254('0x0'));var emlformat=require(_0x2254('0x1'));var rimraf=require(_0x2254('0x2'));var zipdir=require(_0x2254('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2254('0x4'));var moment=require('moment');var BPromise=require(_0x2254('0x5'));var Mustache=require(_0x2254('0x6'));var util=require(_0x2254('0x7'));var path=require(_0x2254('0x8'));var sox=require(_0x2254('0x9'));var csv=require('to-csv');var ejs=require(_0x2254('0xa'));var fs=require('fs');var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x10'));var querystring=require(_0x2254('0x11'));var Papa=require(_0x2254('0x12'));var Redis=require(_0x2254('0x13'));var authService=require(_0x2254('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x15'));var hardwareService=require(_0x2254('0x16'));var logger=require(_0x2254('0x17'))(_0x2254('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2254('0x19'))['db'];config[_0x2254('0x1a')]=_[_0x2254('0x1b')](config[_0x2254('0x1a')],{'host':_0x2254('0x1c'),'port':0x18eb});var socket=require(_0x2254('0x1d'))(new Redis(config['redis']));require(_0x2254('0x1e'))[_0x2254('0x1f')](socket);function respondWithStatusCode(_0x504749,_0x2f4de){_0x2f4de=_0x2f4de||0xcc;return function(_0x1e582d){if(_0x1e582d){return _0x504749[_0x2254('0x20')](_0x2f4de);}return _0x504749[_0x2254('0x21')](_0x2f4de)[_0x2254('0x22')]();};}function respondWithResult(_0xbc5548,_0x50f137){_0x50f137=_0x50f137||0xc8;return function(_0x18baf4){if(_0x18baf4){return _0xbc5548['status'](_0x50f137)[_0x2254('0x23')](_0x18baf4);}};}function respondWithFilteredResult(_0x2a2470,_0x170ffa){return function(_0x25f8b2){if(_0x25f8b2){var _0x1ae11e=_0x25f8b2['count'],_0x34f90e=_0x170ffa[_0x2254('0x24')],_0x497724=_0x170ffa[_0x2254('0x24')]+_0x170ffa[_0x2254('0x25')],_0x51b395;if(_0x497724>=_0x1ae11e){_0x497724=_0x1ae11e;_0x51b395=0xc8;}else{_0x51b395=0xce;}_0x2a2470[_0x2254('0x21')](_0x51b395);return _0x2a2470[_0x2254('0x26')](_0x2254('0x27'),_0x34f90e+'-'+_0x497724+'/'+_0x1ae11e)['json'](_0x25f8b2);}return null;};}function patchUpdates(_0x28381e){return function(_0x16148d){try{jsonpatch[_0x2254('0x28')](_0x16148d,_0x28381e,!![]);}catch(_0x576369){return BPromise['reject'](_0x576369);}return _0x16148d['save']();};}function saveUpdates(_0x1e8a98,_0x559af4){return function(_0xf88b56){if(_0xf88b56){return _0xf88b56['update'](_0x1e8a98)['then'](function(_0x4d8faf){return _0x4d8faf;});}return null;};}function removeEntity(_0x540020,_0x5e5edb){return function(_0x4f797d){if(_0x4f797d){return _0x4f797d[_0x2254('0x29')]()[_0x2254('0x2a')](function(){var _0x2f3037=_0x4f797d[_0x2254('0x2b')]({'plain':!![]});var _0x13522d=[{'name':_0x2254('0x2c'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x2254('0x2d'),'ignore':![]},{'name':'InternalRoutes','value':_0x2254('0x2e'),'ignore':![]}];var _0x141dc5=_(_0x13522d)[_0x2254('0x2f')](_0x2254('0x30'))[_0x2254('0x31')]('value')[_0x2254('0x32')]();if(_[_0x2254('0x33')](_0x141dc5,_0x2f3037[_0x2254('0x34')])){return;}var _0x37af8b=_[_0x2254('0x35')](_0x13522d,[_0x2254('0x32'),_0x2f3037[_0x2254('0x34')]])[_0x2254('0x36')];return db[_0x2254('0x37')][_0x2254('0x29')]({'where':{'type':_0x37af8b,'resourceId':_0x2f3037['id']}})[_0x2254('0x2a')](function(){return _0x4f797d;});})[_0x2254('0x2a')](function(){_0x540020[_0x2254('0x21')](0xcc)[_0x2254('0x22')]();});}};}function handleEntityNotFound(_0x4577f4,_0x1b16c8){return function(_0x2c929f){if(!_0x2c929f){_0x4577f4[_0x2254('0x20')](0x194);}return _0x2c929f;};}function handleError(_0x2f32f8,_0x4e3658){_0x4e3658=_0x4e3658||0x1f4;return function(_0xe29526){logger[_0x2254('0x38')](_0xe29526[_0x2254('0x39')]);if(_0xe29526[_0x2254('0x36')]){delete _0xe29526[_0x2254('0x36')];}_0x2f32f8[_0x2254('0x21')](_0x4e3658)[_0x2254('0x3a')](_0xe29526);};}exports[_0x2254('0x3b')]=function(_0x5b84ce,_0x59c6c9){var _0x835a0e={},_0x3aa0bb={},_0x503540={'count':0x0,'rows':[]};var _0x240d4e=_[_0x2254('0x31')](db[_0x2254('0x3c')][_0x2254('0x3d')],function(_0x538e7b){return{'name':_0x538e7b['fieldName'],'type':_0x538e7b[_0x2254('0x34')]['key']};});_0x3aa0bb[_0x2254('0x3e')]=_[_0x2254('0x31')](_0x240d4e,_0x2254('0x36'));_0x3aa0bb[_0x2254('0x3f')]=_[_0x2254('0x40')](_0x5b84ce[_0x2254('0x3f')]);_0x3aa0bb[_0x2254('0x41')]=_['intersection'](_0x3aa0bb[_0x2254('0x3e')],_0x3aa0bb[_0x2254('0x3f')]);_0x835a0e[_0x2254('0x42')]=_[_0x2254('0x43')](_0x3aa0bb[_0x2254('0x3e')],qs[_0x2254('0x44')](_0x5b84ce[_0x2254('0x3f')][_0x2254('0x44')]));_0x835a0e[_0x2254('0x42')]=_0x835a0e[_0x2254('0x42')]['length']?_0x835a0e[_0x2254('0x42')]:_0x3aa0bb[_0x2254('0x3e')];if(!_0x5b84ce[_0x2254('0x3f')][_0x2254('0x45')]('nolimit')){_0x835a0e[_0x2254('0x25')]=qs[_0x2254('0x25')](_0x5b84ce[_0x2254('0x3f')][_0x2254('0x25')]);_0x835a0e[_0x2254('0x24')]=qs[_0x2254('0x24')](_0x5b84ce[_0x2254('0x3f')][_0x2254('0x24')]);}_0x835a0e['order']=qs[_0x2254('0x46')](_0x5b84ce['query'][_0x2254('0x46')]);_0x835a0e[_0x2254('0x47')]=qs[_0x2254('0x41')](_[_0x2254('0x48')](_0x5b84ce[_0x2254('0x3f')],_0x3aa0bb[_0x2254('0x41')]),_0x240d4e);if(_0x5b84ce[_0x2254('0x3f')]['filter']){_0x835a0e[_0x2254('0x47')]=_[_0x2254('0x49')](_0x835a0e[_0x2254('0x47')],{'$or':_[_0x2254('0x31')](_0x240d4e,function(_0x40d4da){if(_0x40d4da['type']!==_0x2254('0x4a')){var _0x1dec43={};_0x1dec43[_0x40d4da[_0x2254('0x36')]]={'$like':'%'+_0x5b84ce[_0x2254('0x3f')][_0x2254('0x2f')]+'%'};return _0x1dec43;}})});}_0x835a0e=_['merge']({},_0x835a0e,_0x5b84ce[_0x2254('0x4b')]);var _0x47c933={'where':_0x835a0e[_0x2254('0x47')]};return db[_0x2254('0x3c')][_0x2254('0x4c')](_0x47c933)[_0x2254('0x2a')](function(_0x362562){_0x503540[_0x2254('0x4c')]=_0x362562;if(_0x5b84ce[_0x2254('0x3f')][_0x2254('0x4d')]){_0x835a0e[_0x2254('0x4e')]=[{'all':!![]}];}return db[_0x2254('0x3c')][_0x2254('0x4f')](_0x835a0e);})[_0x2254('0x2a')](function(_0x83f44b){_0x503540['rows']=_0x83f44b;return _0x503540;})[_0x2254('0x2a')](respondWithFilteredResult(_0x59c6c9,_0x835a0e))[_0x2254('0x50')](handleError(_0x59c6c9,null));};exports[_0x2254('0x51')]=function(_0x5cc8fc,_0x94f5be){var _0x1c087b={'raw':![],'where':{'id':_0x5cc8fc[_0x2254('0x52')]['id']}},_0x400bb3={};_0x400bb3[_0x2254('0x3e')]=_[_0x2254('0x40')](db[_0x2254('0x3c')][_0x2254('0x3d')]);_0x400bb3[_0x2254('0x3f')]=_['keys'](_0x5cc8fc[_0x2254('0x3f')]);_0x400bb3[_0x2254('0x41')]=_[_0x2254('0x43')](_0x400bb3[_0x2254('0x3e')],_0x400bb3[_0x2254('0x3f')]);_0x1c087b[_0x2254('0x42')]=_[_0x2254('0x43')](_0x400bb3[_0x2254('0x3e')],qs[_0x2254('0x44')](_0x5cc8fc[_0x2254('0x3f')]['fields']));_0x1c087b[_0x2254('0x42')]=_0x1c087b[_0x2254('0x42')]['length']?_0x1c087b[_0x2254('0x42')]:_0x400bb3[_0x2254('0x3e')];if(_0x5cc8fc[_0x2254('0x3f')][_0x2254('0x4d')]){_0x1c087b['include']=[{'all':!![]}];}_0x1c087b=_[_0x2254('0x49')]({},_0x1c087b,_0x5cc8fc[_0x2254('0x4b')]);return db['VoiceExtension'][_0x2254('0x35')](_0x1c087b)[_0x2254('0x2a')](handleEntityNotFound(_0x94f5be,null))[_0x2254('0x2a')](respondWithResult(_0x94f5be,null))[_0x2254('0x50')](handleError(_0x94f5be,null));};exports['destroy']=function(_0x166d56,_0x106282){return db[_0x2254('0x3c')]['find']({'where':{'id':_0x166d56['params']['id']}})[_0x2254('0x2a')](handleEntityNotFound(_0x106282,null))[_0x2254('0x2a')](removeEntity(_0x106282,null))['catch'](handleError(_0x106282,null));};exports[_0x2254('0x53')]=function(_0x5bc29a,_0x4addb0){if(_0x5bc29a[_0x2254('0x54')][_0x2254('0x34')]===_0x2254('0x2d')&&!_[_0x2254('0x55')](_0x5bc29a[_0x2254('0x54')]['exten'],'_')){_0x5bc29a['body'][_0x2254('0x56')]='_'['concat'](_0x5bc29a[_0x2254('0x54')][_0x2254('0x56')]);}return db[_0x2254('0x3c')][_0x2254('0x53')](_0x5bc29a['body'],{'raw':![]})[_0x2254('0x2a')](function(_0x240716){var _0x49fe68=_0x5bc29a['user'][_0x2254('0x2b')]({'plain':!![]});if(!_0x49fe68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49fe68[_0x2254('0x57')]===_0x2254('0x58')){var _0x2ef4a0=_0x240716[_0x2254('0x2b')]({'plain':!![]});var _0x301a12=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x2254('0x59'),'value':'outbound'},{'name':_0x2254('0x5a'),'value':'internal'}];var _0x4da493=_['find'](_0x301a12,[_0x2254('0x32'),_0x2ef4a0[_0x2254('0x34')]])[_0x2254('0x36')];return db[_0x2254('0x5b')][_0x2254('0x35')]({'where':{'name':_0x4da493,'userProfileId':_0x49fe68[_0x2254('0x5c')]},'raw':!![]})[_0x2254('0x2a')](function(_0x25137c){if(_0x25137c&&_0x25137c[_0x2254('0x5d')]===0x0){return db[_0x2254('0x37')][_0x2254('0x53')]({'name':_0x2ef4a0[_0x2254('0x36')],'resourceId':_0x2ef4a0['id'],'type':_0x25137c[_0x2254('0x36')],'sectionId':_0x25137c['id']},{})[_0x2254('0x2a')](function(){return _0x240716;});}else{return _0x240716;}})[_0x2254('0x50')](function(_0x3b81bb){logger[_0x2254('0x38')](_0x2254('0x5e'),_0x3b81bb);throw _0x3b81bb;});}return _0x240716;})[_0x2254('0x2a')](respondWithResult(_0x4addb0,0xc9))['catch'](handleError(_0x4addb0,null));};exports[_0x2254('0x5f')]=function(_0xae171c,_0x3b1aae){if(_0xae171c[_0x2254('0x54')]['id']){delete _0xae171c['body']['id'];}return db['VoiceExtension'][_0x2254('0x35')]({'where':{'id':_0xae171c[_0x2254('0x52')]['id']}})[_0x2254('0x2a')](handleEntityNotFound(_0x3b1aae,null))[_0x2254('0x2a')](function(_0x1021b2){if(_0x1021b2){return db['VoiceExtension'][_0x2254('0x5f')](_[_0x2254('0x48')](_0xae171c[_0x2254('0x54')],['exten','context',_0x2254('0x60'),'recordingFormat',_0x2254('0x61'),_0x2254('0x62')]),{'where':{'context':_0x1021b2['context'],'exten':_0x1021b2[_0x2254('0x56')]},'individualHooks':!![]})[_0x2254('0x2a')](function(_0x4d30a5){return _0x4d30a5;});}return null;})[_0x2254('0x2a')](respondWithStatusCode(_0x3b1aae,null))[_0x2254('0x50')](handleError(_0x3b1aae,null));};exports['addApplications']=function(_0x5cc6bd,_0xde4e7,_0xa159a4){return db['VoiceExtension']['findOne']({'where':{'id':_0x5cc6bd[_0x2254('0x52')]['id']}})['then'](handleEntityNotFound(_0xde4e7,null))[_0x2254('0x2a')](function(_0x5d0229){if(_0x5d0229){return db[_0x2254('0x63')][_0x2254('0x64')](function(_0xaa9767){return db[_0x2254('0x3c')]['destroy']({'where':{'VoiceExtensionId':_0x5cc6bd[_0x2254('0x52')]['id']},'transaction':_0xaa9767})['then'](function(_0x1c2158){var _0x33cab6=_['map'](_0x5cc6bd[_0x2254('0x54')],function(_0x23a889){_0x23a889['VoiceExtensionId']=_0x5cc6bd[_0x2254('0x52')]['id'];return _0x23a889;});return db[_0x2254('0x3c')][_0x2254('0x65')](_0x33cab6,{'transaction':_0xaa9767});});})[_0x2254('0x2a')](function(){return db['VoiceExtension'][_0x2254('0x66')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5cc6bd[_0x2254('0x52')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x2254('0x2a')](respondWithResult(_0xde4e7,null))[_0x2254('0x50')](handleError(_0xde4e7,null));}; \ No newline at end of file +var _0xdb28=['nolimit','order','sort','where','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','destroy','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','description','cutdigits','addApplications','findOne','sequelize','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./voiceExtension.socket','register','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','map','value','includes','type','find','UserProfileResource','stack','name','send','index','VoiceExtension','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x136a44,_0x407967){var _0x503b59=function(_0x10ad81){while(--_0x10ad81){_0x136a44['push'](_0x136a44['shift']());}};_0x503b59(++_0x407967);}(_0xdb28,0x106));var _0x8db2=function(_0x15cd8e,_0xf2b46c){_0x15cd8e=_0x15cd8e-0x0;var _0x185ac8=_0xdb28[_0x15cd8e];return _0x185ac8;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var db=require(_0x8db2('0x17'))['db'];config[_0x8db2('0x18')]=_[_0x8db2('0x19')](config[_0x8db2('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0x18')]));require(_0x8db2('0x1a'))[_0x8db2('0x1b')](socket);function respondWithStatusCode(_0x1d6a15,_0x227355){_0x227355=_0x227355||0xcc;return function(_0xfa285b){if(_0xfa285b){return _0x1d6a15[_0x8db2('0x1c')](_0x227355);}return _0x1d6a15[_0x8db2('0x1d')](_0x227355)[_0x8db2('0x1e')]();};}function respondWithResult(_0x16c8c2,_0x5489a9){_0x5489a9=_0x5489a9||0xc8;return function(_0x13b0f5){if(_0x13b0f5){return _0x16c8c2[_0x8db2('0x1d')](_0x5489a9)['json'](_0x13b0f5);}};}function respondWithFilteredResult(_0x2b3f73,_0x44957d){return function(_0x21db8c){if(_0x21db8c){var _0x3fddc2=_0x21db8c['count'],_0x2efd06=_0x44957d[_0x8db2('0x1f')],_0x46ce14=_0x44957d[_0x8db2('0x1f')]+_0x44957d[_0x8db2('0x20')],_0x51d60d;if(_0x46ce14>=_0x3fddc2){_0x46ce14=_0x3fddc2;_0x51d60d=0xc8;}else{_0x51d60d=0xce;}_0x2b3f73[_0x8db2('0x1d')](_0x51d60d);return _0x2b3f73['set'](_0x8db2('0x21'),_0x2efd06+'-'+_0x46ce14+'/'+_0x3fddc2)[_0x8db2('0x22')](_0x21db8c);}return null;};}function patchUpdates(_0x260940){return function(_0x297ba3){try{jsonpatch[_0x8db2('0x23')](_0x297ba3,_0x260940,!![]);}catch(_0x597260){return BPromise[_0x8db2('0x24')](_0x597260);}return _0x297ba3[_0x8db2('0x25')]();};}function saveUpdates(_0x18f69c,_0x125be2){return function(_0x2260d8){if(_0x2260d8){return _0x2260d8[_0x8db2('0x26')](_0x18f69c)[_0x8db2('0x27')](function(_0x5c6614){return _0x5c6614;});}return null;};}function removeEntity(_0x256202,_0x4f6516){return function(_0x5725f0){if(_0x5725f0){return _0x5725f0['destroy']()['then'](function(){var _0xec8cd2=_0x5725f0[_0x8db2('0x28')]({'plain':!![]});var _0x3be281=[{'name':_0x8db2('0x29'),'value':_0x8db2('0x2a'),'ignore':![]},{'name':_0x8db2('0x2b'),'value':'outbound','ignore':![]},{'name':_0x8db2('0x2c'),'value':_0x8db2('0x2d'),'ignore':![]}];var _0x430dd5=_(_0x3be281)[_0x8db2('0x2e')]('ignore')[_0x8db2('0x2f')](_0x8db2('0x30'))[_0x8db2('0x30')]();if(_[_0x8db2('0x31')](_0x430dd5,_0xec8cd2[_0x8db2('0x32')])){return;}var _0x21bae5=_[_0x8db2('0x33')](_0x3be281,[_0x8db2('0x30'),_0xec8cd2[_0x8db2('0x32')]])['name'];return db[_0x8db2('0x34')]['destroy']({'where':{'type':_0x21bae5,'resourceId':_0xec8cd2['id']}})['then'](function(){return _0x5725f0;});})[_0x8db2('0x27')](function(){_0x256202[_0x8db2('0x1d')](0xcc)[_0x8db2('0x1e')]();});}};}function handleEntityNotFound(_0x49b2b3,_0x42b272){return function(_0x56b71a){if(!_0x56b71a){_0x49b2b3[_0x8db2('0x1c')](0x194);}return _0x56b71a;};}function handleError(_0x2b653b,_0x14bd12){_0x14bd12=_0x14bd12||0x1f4;return function(_0x4d9e26){logger['error'](_0x4d9e26[_0x8db2('0x35')]);if(_0x4d9e26[_0x8db2('0x36')]){delete _0x4d9e26['name'];}_0x2b653b['status'](_0x14bd12)[_0x8db2('0x37')](_0x4d9e26);};}exports[_0x8db2('0x38')]=function(_0xc884a,_0x2a2d65){var _0x17ad44={},_0xd39848={},_0x101711={'count':0x0,'rows':[]};var _0xae31b7=_[_0x8db2('0x2f')](db[_0x8db2('0x39')]['rawAttributes'],function(_0x1ab5eb){return{'name':_0x1ab5eb[_0x8db2('0x3a')],'type':_0x1ab5eb['type'][_0x8db2('0x3b')]};});_0xd39848[_0x8db2('0x3c')]=_['map'](_0xae31b7,'name');_0xd39848[_0x8db2('0x3d')]=_['keys'](_0xc884a[_0x8db2('0x3d')]);_0xd39848[_0x8db2('0x3e')]=_[_0x8db2('0x3f')](_0xd39848[_0x8db2('0x3c')],_0xd39848['query']);_0x17ad44[_0x8db2('0x40')]=_['intersection'](_0xd39848[_0x8db2('0x3c')],qs[_0x8db2('0x41')](_0xc884a[_0x8db2('0x3d')][_0x8db2('0x41')]));_0x17ad44['attributes']=_0x17ad44['attributes'][_0x8db2('0x42')]?_0x17ad44[_0x8db2('0x40')]:_0xd39848['model'];if(!_0xc884a[_0x8db2('0x3d')][_0x8db2('0x43')](_0x8db2('0x44'))){_0x17ad44['limit']=qs[_0x8db2('0x20')](_0xc884a[_0x8db2('0x3d')][_0x8db2('0x20')]);_0x17ad44[_0x8db2('0x1f')]=qs[_0x8db2('0x1f')](_0xc884a[_0x8db2('0x3d')][_0x8db2('0x1f')]);}_0x17ad44[_0x8db2('0x45')]=qs[_0x8db2('0x46')](_0xc884a[_0x8db2('0x3d')][_0x8db2('0x46')]);_0x17ad44[_0x8db2('0x47')]=qs[_0x8db2('0x3e')](_['pick'](_0xc884a[_0x8db2('0x3d')],_0xd39848[_0x8db2('0x3e')]),_0xae31b7);if(_0xc884a['query']['filter']){_0x17ad44[_0x8db2('0x47')]=_['merge'](_0x17ad44[_0x8db2('0x47')],{'$or':_[_0x8db2('0x2f')](_0xae31b7,function(_0x313130){if(_0x313130[_0x8db2('0x32')]!==_0x8db2('0x48')){var _0x30d606={};_0x30d606[_0x313130[_0x8db2('0x36')]]={'$like':'%'+_0xc884a['query'][_0x8db2('0x2e')]+'%'};return _0x30d606;}})});}_0x17ad44=_[_0x8db2('0x49')]({},_0x17ad44,_0xc884a[_0x8db2('0x4a')]);var _0x4a0b56={'where':_0x17ad44['where']};return db[_0x8db2('0x39')][_0x8db2('0x4b')](_0x4a0b56)[_0x8db2('0x27')](function(_0x2c47cc){_0x101711['count']=_0x2c47cc;if(_0xc884a[_0x8db2('0x3d')]['includeAll']){_0x17ad44[_0x8db2('0x4c')]=[{'all':!![]}];}return db[_0x8db2('0x39')][_0x8db2('0x4d')](_0x17ad44);})['then'](function(_0x4b0e72){_0x101711[_0x8db2('0x4e')]=_0x4b0e72;return _0x101711;})['then'](respondWithFilteredResult(_0x2a2d65,_0x17ad44))[_0x8db2('0x4f')](handleError(_0x2a2d65,null));};exports[_0x8db2('0x50')]=function(_0x27b8eb,_0x3a0c1b){var _0x2244b9={'raw':![],'where':{'id':_0x27b8eb[_0x8db2('0x51')]['id']}},_0x40c6e6={};_0x40c6e6[_0x8db2('0x3c')]=_[_0x8db2('0x52')](db[_0x8db2('0x39')][_0x8db2('0x53')]);_0x40c6e6[_0x8db2('0x3d')]=_['keys'](_0x27b8eb[_0x8db2('0x3d')]);_0x40c6e6[_0x8db2('0x3e')]=_[_0x8db2('0x3f')](_0x40c6e6[_0x8db2('0x3c')],_0x40c6e6['query']);_0x2244b9['attributes']=_[_0x8db2('0x3f')](_0x40c6e6[_0x8db2('0x3c')],qs[_0x8db2('0x41')](_0x27b8eb['query']['fields']));_0x2244b9['attributes']=_0x2244b9[_0x8db2('0x40')][_0x8db2('0x42')]?_0x2244b9[_0x8db2('0x40')]:_0x40c6e6[_0x8db2('0x3c')];if(_0x27b8eb[_0x8db2('0x3d')][_0x8db2('0x54')]){_0x2244b9[_0x8db2('0x4c')]=[{'all':!![]}];}_0x2244b9=_['merge']({},_0x2244b9,_0x27b8eb['options']);return db[_0x8db2('0x39')][_0x8db2('0x33')](_0x2244b9)[_0x8db2('0x27')](handleEntityNotFound(_0x3a0c1b,null))[_0x8db2('0x27')](respondWithResult(_0x3a0c1b,null))[_0x8db2('0x4f')](handleError(_0x3a0c1b,null));};exports[_0x8db2('0x55')]=function(_0x1f0f7c,_0x3ca2a7){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'where':{'id':_0x1f0f7c[_0x8db2('0x51')]['id']}})[_0x8db2('0x27')](handleEntityNotFound(_0x3ca2a7,null))[_0x8db2('0x27')](removeEntity(_0x3ca2a7,null))[_0x8db2('0x4f')](handleError(_0x3ca2a7,null));};exports[_0x8db2('0x56')]=function(_0x55ad51,_0x2ded23){if(_0x55ad51[_0x8db2('0x57')]['type']===_0x8db2('0x58')&&!_[_0x8db2('0x59')](_0x55ad51[_0x8db2('0x57')]['exten'],'_')){_0x55ad51[_0x8db2('0x57')][_0x8db2('0x5a')]='_'[_0x8db2('0x5b')](_0x55ad51[_0x8db2('0x57')][_0x8db2('0x5a')]);}return db['VoiceExtension'][_0x8db2('0x56')](_0x55ad51[_0x8db2('0x57')],{'raw':![]})[_0x8db2('0x27')](function(_0x58bb60){var _0x1e7d1a=_0x55ad51[_0x8db2('0x5c')][_0x8db2('0x28')]({'plain':!![]});if(!_0x1e7d1a)throw new Error(_0x8db2('0x5d'));if(_0x1e7d1a[_0x8db2('0x5e')]===_0x8db2('0x5c')){var _0x12a81a=_0x58bb60['get']({'plain':!![]});var _0x39ff90=[{'name':_0x8db2('0x29'),'value':'inbound'},{'name':_0x8db2('0x2b'),'value':_0x8db2('0x58')},{'name':'InternalRoutes','value':_0x8db2('0x2d')}];var _0x927c01=_[_0x8db2('0x33')](_0x39ff90,[_0x8db2('0x30'),_0x12a81a[_0x8db2('0x32')]])[_0x8db2('0x36')];return db[_0x8db2('0x5f')][_0x8db2('0x33')]({'where':{'name':_0x927c01,'userProfileId':_0x1e7d1a[_0x8db2('0x60')]},'raw':!![]})[_0x8db2('0x27')](function(_0x12fd12){if(_0x12fd12&&_0x12fd12[_0x8db2('0x61')]===0x0){return db[_0x8db2('0x34')][_0x8db2('0x56')]({'name':_0x12a81a[_0x8db2('0x36')],'resourceId':_0x12a81a['id'],'type':_0x12fd12[_0x8db2('0x36')],'sectionId':_0x12fd12['id']},{})['then'](function(){return _0x58bb60;});}else{return _0x58bb60;}})[_0x8db2('0x4f')](function(_0x2a0309){logger[_0x8db2('0x62')](_0x8db2('0x63'),_0x2a0309);throw _0x2a0309;});}return _0x58bb60;})[_0x8db2('0x27')](respondWithResult(_0x2ded23,0xc9))['catch'](handleError(_0x2ded23,null));};exports[_0x8db2('0x26')]=function(_0x2c3087,_0x3ab670){if(_0x2c3087[_0x8db2('0x57')]['id']){delete _0x2c3087[_0x8db2('0x57')]['id'];}return db[_0x8db2('0x39')][_0x8db2('0x33')]({'where':{'id':_0x2c3087[_0x8db2('0x51')]['id']}})[_0x8db2('0x27')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x27')](function(_0x10f42a){if(_0x10f42a){return db[_0x8db2('0x39')][_0x8db2('0x26')](_[_0x8db2('0x64')](_0x2c3087[_0x8db2('0x57')],[_0x8db2('0x5a'),_0x8db2('0x65'),_0x8db2('0x66'),'recordingFormat',_0x8db2('0x67'),'mandatoryDisposition']),{'where':{'context':_0x10f42a[_0x8db2('0x65')],'exten':_0x10f42a['exten']},'individualHooks':!![]})[_0x8db2('0x27')](function(_0x39330c){return _0x39330c;});}return null;})[_0x8db2('0x27')](respondWithStatusCode(_0x3ab670,null))[_0x8db2('0x4f')](handleError(_0x3ab670,null));};exports[_0x8db2('0x68')]=function(_0x59a32e,_0x50c5fb,_0x3d1128){return db[_0x8db2('0x39')][_0x8db2('0x69')]({'where':{'id':_0x59a32e[_0x8db2('0x51')]['id']}})[_0x8db2('0x27')](handleEntityNotFound(_0x50c5fb,null))[_0x8db2('0x27')](function(_0x3e3de3){if(_0x3e3de3){return db[_0x8db2('0x6a')]['transaction'](function(_0x2bde16){return db[_0x8db2('0x39')][_0x8db2('0x55')]({'where':{'VoiceExtensionId':_0x59a32e[_0x8db2('0x51')]['id']},'transaction':_0x2bde16})[_0x8db2('0x27')](function(_0x382c75){var _0x451746=_[_0x8db2('0x2f')](_0x59a32e['body'],function(_0x54318c){_0x54318c[_0x8db2('0x6b')]=_0x59a32e[_0x8db2('0x51')]['id'];return _0x54318c;});return db[_0x8db2('0x39')][_0x8db2('0x6c')](_0x451746,{'transaction':_0x2bde16});});})[_0x8db2('0x27')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x59a32e[_0x8db2('0x51')]['id']},'order':_0x8db2('0x6d')});});}})['then'](respondWithResult(_0x50c5fb,null))[_0x8db2('0x4f')](handleError(_0x50c5fb,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 0f39982..406ee72 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 _0x5007=['setMaxListeners','save','update','remove','emit','exports','events','VoiceExtension'];(function(_0x27398c,_0x4ea33f){var _0x155fc5=function(_0x1e1c53){while(--_0x1e1c53){_0x27398c['push'](_0x27398c['shift']());}};_0x155fc5(++_0x4ea33f);}(_0x5007,0xfe));var _0x7500=function(_0x5dfcc2,_0x318559){_0x5dfcc2=_0x5dfcc2-0x0;var _0x101cdf=_0x5007[_0x5dfcc2];return _0x101cdf;};'use strict';var EventEmitter=require(_0x7500('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x7500('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7500('0x2')](0x0);var events={'afterCreate':_0x7500('0x3'),'afterUpdate':_0x7500('0x4'),'afterDestroy':_0x7500('0x5')};function emitEvent(_0x1b636e){return function(_0x55fd27,_0x5b4a79,_0x1b2057){VoiceExtensionEvents[_0x7500('0x6')](_0x1b636e+':'+_0x55fd27['id'],_0x55fd27);VoiceExtensionEvents[_0x7500('0x6')](_0x1b636e,_0x55fd27);_0x1b2057(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x7500('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xc62a=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','save','remove','emit'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xc62a,0x123));var _0xac62=function(_0x11d746,_0x45facb){_0x11d746=_0x11d746-0x0;var _0x47bebb=_0xc62a[_0x11d746];return _0x47bebb;};'use strict';var EventEmitter=require(_0xac62('0x0'));var VoiceExtension=require(_0xac62('0x1'))['db'][_0xac62('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xac62('0x3'),'afterUpdate':'update','afterDestroy':_0xac62('0x4')};function emitEvent(_0x3c6a7b){return function(_0x54f4f5,_0x82ed71,_0x4972cb){VoiceExtensionEvents[_0xac62('0x5')](_0x3c6a7b+':'+_0x54f4f5['id'],_0x54f4f5);VoiceExtensionEvents[_0xac62('0x5')](_0x3c6a7b,_0x54f4f5);_0x4972cb(null);};}for(var e in events){if(events[_0xac62('0x6')](e)){var event=events[e];VoiceExtension[_0xac62('0x7')](e,emitEvent(event));}}module[_0xac62('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index d7eaacb..106b11f 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 _0x5f66=['request-promise','path','../../config/environment','exports','VoiceExtension','voice_extensions','util','api','moment','bluebird'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_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 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('./voiceExtension.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 _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','VoiceExtension','voice_extensions','util','api','moment'];(function(_0x4b4554,_0x146431){var _0x5c1d12=function(_0x172065){while(--_0x172065){_0x4b4554['push'](_0x4b4554['shift']());}};_0x5c1d12(++_0x146431);}(_0xadb5,0xad));var _0x5adb=function(_0x3bd776,_0x14dc09){_0x3bd776=_0x3bd776-0x0;var _0x42992e=_0xadb5[_0x3bd776];return _0x42992e;};'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('./voiceExtension.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 diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index a41103e..ce73f41 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 _0x4bc5=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','where','limit','include','map','model','attributes','then','info','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x4bc5,0x1bb));var _0x54bc=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x4bc5[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x54bc('0x0'));var util=require(_0x54bc('0x1'));var moment=require(_0x54bc('0x2'));var BPromise=require(_0x54bc('0x3'));var rs=require(_0x54bc('0x4'));var fs=require('fs');var Redis=require(_0x54bc('0x5'));var db=require(_0x54bc('0x6'))['db'];var utils=require(_0x54bc('0x7'));var logger=require(_0x54bc('0x8'))(_0x54bc('0x9'));var config=require(_0x54bc('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x54bc('0xb')][_0x54bc('0xc')]({'port':0x232a});config[_0x54bc('0xd')]=_[_0x54bc('0xe')](config[_0x54bc('0xd')],{'host':_0x54bc('0xf'),'port':0x18eb});var socket=require(_0x54bc('0x10'))(new Redis(config['redis']));require(_0x54bc('0x11'))[_0x54bc('0x12')](socket);function respondWithRpcPromise(_0x39cfc7,_0x2e768a,_0x2e1f32){return new BPromise(function(_0xb2d61a,_0xc1b837){return client[_0x54bc('0x13')](_0x39cfc7,_0x2e1f32)['then'](function(_0x1fd211){logger['info'](_0x54bc('0x14'),_0x2e768a,'request\x20sent');logger['debug'](_0x54bc('0x15'),_0x2e768a,_0x54bc('0x16'),JSON[_0x54bc('0x17')](_0x1fd211));if(_0x1fd211[_0x54bc('0x18')]){if(_0x1fd211[_0x54bc('0x18')][_0x54bc('0x19')]===0x1f4){logger[_0x54bc('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x2e768a,_0x1fd211[_0x54bc('0x18')]['message']);return _0xc1b837(_0x1fd211['error'][_0x54bc('0x1a')]);}logger[_0x54bc('0x18')](_0x54bc('0x14'),_0x2e768a,_0x1fd211[_0x54bc('0x18')][_0x54bc('0x1a')]);return _0xb2d61a(_0x1fd211[_0x54bc('0x18')][_0x54bc('0x1a')]);}else{logger['info'](_0x54bc('0x14'),_0x2e768a,_0x54bc('0x16'));_0xb2d61a(_0x1fd211[_0x54bc('0x1b')][_0x54bc('0x1a')]);}})[_0x54bc('0x1c')](function(_0x47368e){logger['error'](_0x54bc('0x14'),_0x2e768a,_0x47368e);_0xc1b837(_0x47368e);});});}exports[_0x54bc('0x1d')]=function(_0x16ad36){var _0x255fe2=this;return new Promise(function(_0x5a0a8d,_0x196af3){return db[_0x54bc('0x1e')]['findAll']({'raw':_0x16ad36['options']?_0x16ad36[_0x54bc('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x16ad36[_0x54bc('0x1f')]?_0x16ad36[_0x54bc('0x1f')][_0x54bc('0x20')]||null:null,'attributes':_0x16ad36[_0x54bc('0x1f')]?_0x16ad36[_0x54bc('0x1f')]['attributes']||null:null,'limit':_0x16ad36['options']?_0x16ad36[_0x54bc('0x1f')][_0x54bc('0x21')]||null:null,'include':_0x16ad36['options']?_0x16ad36[_0x54bc('0x1f')][_0x54bc('0x22')]?_[_0x54bc('0x23')](_0x16ad36[_0x54bc('0x1f')][_0x54bc('0x22')],function(_0x1d1bfb){return{'model':db[_0x1d1bfb[_0x54bc('0x24')]],'as':_0x1d1bfb['as'],'attributes':_0x1d1bfb[_0x54bc('0x25')],'include':_0x1d1bfb[_0x54bc('0x22')]?_[_0x54bc('0x23')](_0x1d1bfb[_0x54bc('0x22')],function(_0x5498bd){return{'model':db[_0x5498bd['model']],'as':_0x5498bd['as'],'attributes':_0x5498bd[_0x54bc('0x25')],'include':_0x5498bd['include']?_['map'](_0x5498bd[_0x54bc('0x22')],function(_0x5a1ae9){return{'model':db[_0x5a1ae9[_0x54bc('0x24')]],'as':_0x5a1ae9['as'],'attributes':_0x5a1ae9['attributes']};}):[]};}):[]};}):[]:[]})[_0x54bc('0x26')](function(_0x291247){logger[_0x54bc('0x27')](_0x54bc('0x1d'),_0x16ad36);logger[_0x54bc('0x28')]('GetVoiceExtension',_0x16ad36,JSON[_0x54bc('0x17')](_0x291247));_0x5a0a8d(_0x291247);})[_0x54bc('0x1c')](function(_0x26d835){logger['error'](_0x54bc('0x1d'),_0x26d835[_0x54bc('0x1a')],_0x16ad36);_0x196af3(_0x255fe2[_0x54bc('0x18')](0x1f4,_0x26d835['message']));});});}; \ No newline at end of file +var _0x23ab=['then','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','map','include','model','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x23ab,0x88));var _0xb23a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x23ab[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xb23a('0x0'));var util=require('util');var moment=require(_0xb23a('0x1'));var BPromise=require(_0xb23a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb23a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb23a('0x4'));var logger=require(_0xb23a('0x5'))(_0xb23a('0x6'));var config=require(_0xb23a('0x7'));var jayson=require(_0xb23a('0x8'));var client=jayson[_0xb23a('0x9')]['http']({'port':0x232a});config[_0xb23a('0xa')]=_[_0xb23a('0xb')](config[_0xb23a('0xa')],{'host':_0xb23a('0xc'),'port':0x18eb});var socket=require(_0xb23a('0xd'))(new Redis(config[_0xb23a('0xa')]));require(_0xb23a('0xe'))[_0xb23a('0xf')](socket);function respondWithRpcPromise(_0x1bb402,_0x3bf60d,_0x491dc5){return new BPromise(function(_0x335ffe,_0xb77fcf){return client['request'](_0x1bb402,_0x491dc5)[_0xb23a('0x10')](function(_0x133b53){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x3bf60d,_0xb23a('0x11'));logger[_0xb23a('0x12')](_0xb23a('0x13'),_0x3bf60d,_0xb23a('0x11'),JSON[_0xb23a('0x14')](_0x133b53));if(_0x133b53[_0xb23a('0x15')]){if(_0x133b53[_0xb23a('0x15')][_0xb23a('0x16')]===0x1f4){logger[_0xb23a('0x15')](_0xb23a('0x17'),_0x3bf60d,_0x133b53[_0xb23a('0x15')][_0xb23a('0x18')]);return _0xb77fcf(_0x133b53[_0xb23a('0x15')]['message']);}logger[_0xb23a('0x15')](_0xb23a('0x17'),_0x3bf60d,_0x133b53[_0xb23a('0x15')][_0xb23a('0x18')]);return _0x335ffe(_0x133b53[_0xb23a('0x15')][_0xb23a('0x18')]);}else{logger[_0xb23a('0x19')](_0xb23a('0x17'),_0x3bf60d,_0xb23a('0x11'));_0x335ffe(_0x133b53[_0xb23a('0x1a')][_0xb23a('0x18')]);}})[_0xb23a('0x1b')](function(_0x4861a7){logger['error'](_0xb23a('0x17'),_0x3bf60d,_0x4861a7);_0xb77fcf(_0x4861a7);});});}exports[_0xb23a('0x1c')]=function(_0x2621fc){var _0x362b3f=this;return new Promise(function(_0x28e0df,_0x206533){return db[_0xb23a('0x1d')][_0xb23a('0x1e')]({'raw':_0x2621fc[_0xb23a('0x1f')]?_0x2621fc[_0xb23a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2621fc[_0xb23a('0x1f')]?_0x2621fc[_0xb23a('0x1f')][_0xb23a('0x20')]||null:null,'attributes':_0x2621fc[_0xb23a('0x1f')]?_0x2621fc['options'][_0xb23a('0x21')]||null:null,'limit':_0x2621fc[_0xb23a('0x1f')]?_0x2621fc[_0xb23a('0x1f')][_0xb23a('0x22')]||null:null,'include':_0x2621fc['options']?_0x2621fc['options']['include']?_[_0xb23a('0x23')](_0x2621fc[_0xb23a('0x1f')][_0xb23a('0x24')],function(_0x141ac8){return{'model':db[_0x141ac8[_0xb23a('0x25')]],'as':_0x141ac8['as'],'attributes':_0x141ac8['attributes'],'include':_0x141ac8[_0xb23a('0x24')]?_[_0xb23a('0x23')](_0x141ac8[_0xb23a('0x24')],function(_0x35957c){return{'model':db[_0x35957c['model']],'as':_0x35957c['as'],'attributes':_0x35957c[_0xb23a('0x21')],'include':_0x35957c[_0xb23a('0x24')]?_[_0xb23a('0x23')](_0x35957c[_0xb23a('0x24')],function(_0x52e683){return{'model':db[_0x52e683[_0xb23a('0x25')]],'as':_0x52e683['as'],'attributes':_0x52e683['attributes']};}):[]};}):[]};}):[]:[]})[_0xb23a('0x10')](function(_0x5a3c1e){logger[_0xb23a('0x19')](_0xb23a('0x1c'),_0x2621fc);logger[_0xb23a('0x12')](_0xb23a('0x1c'),_0x2621fc,JSON['stringify'](_0x5a3c1e));_0x28e0df(_0x5a3c1e);})[_0xb23a('0x1b')](function(_0x5e83be){logger[_0xb23a('0x15')]('GetVoiceExtension',_0x5e83be[_0xb23a('0x18')],_0x2621fc);_0x206533(_0x362b3f[_0xb23a('0x15')](0x1f4,_0x5e83be['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0be2b1e..0a613bf 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 _0x5919=['remove','update','emit','register','length','./voiceExtension.events','save'];(function(_0x442d04,_0x39bab6){var _0x18c8c7=function(_0x23a331){while(--_0x23a331){_0x442d04['push'](_0x442d04['shift']());}};_0x18c8c7(++_0x39bab6);}(_0x5919,0x1be));var _0x9591=function(_0x5b04ac,_0x14b9b5){_0x5b04ac=_0x5b04ac-0x0;var _0x106281=_0x5919[_0x5b04ac];return _0x106281;};'use strict';var VoiceExtensionEvents=require(_0x9591('0x0'));var events=[_0x9591('0x1'),_0x9591('0x2'),_0x9591('0x3')];function createListener(_0x215511,_0x1b4839){return function(_0x2338e1){_0x1b4839[_0x9591('0x4')](_0x215511,_0x2338e1);};}function removeListener(_0x16a412,_0x4cdd4c){return function(){VoiceExtensionEvents['removeListener'](_0x16a412,_0x4cdd4c);};}exports[_0x9591('0x5')]=function(_0x4bf9a9){for(var _0x4cc192=0x0,_0x24d21a=events[_0x9591('0x6')];_0x4cc192<_0x24d21a;_0x4cc192++){var _0x144b87=events[_0x4cc192];var _0x13b251=createListener('voiceExtension:'+_0x144b87,_0x4bf9a9);VoiceExtensionEvents['on'](_0x144b87,_0x13b251);}}; \ No newline at end of file +var _0x1266=['voiceExtension:','./voiceExtension.events','remove','update','length'];(function(_0x4ddc7e,_0xcb9b8){var _0xfbf0ec=function(_0x32b673){while(--_0x32b673){_0x4ddc7e['push'](_0x4ddc7e['shift']());}};_0xfbf0ec(++_0xcb9b8);}(_0x1266,0x13c));var _0x6126=function(_0x12697c,_0x2ff8d6){_0x12697c=_0x12697c-0x0;var _0x1b3e7e=_0x1266[_0x12697c];return _0x1b3e7e;};'use strict';var VoiceExtensionEvents=require(_0x6126('0x0'));var events=['save',_0x6126('0x1'),_0x6126('0x2')];function createListener(_0x176eea,_0x493c50){return function(_0xecbf55){_0x493c50['emit'](_0x176eea,_0xecbf55);};}function removeListener(_0x41f779,_0x16ecc7){return function(){VoiceExtensionEvents['removeListener'](_0x41f779,_0x16ecc7);};}exports['register']=function(_0x483e10){for(var _0x137027=0x0,_0x19008c=events[_0x6126('0x3')];_0x137027<_0x19008c;_0x137027++){var _0x374a3f=events[_0x137027];var _0x4d5da4=createListener(_0x6126('0x4')+_0x374a3f,_0x483e10);VoiceExtensionEvents['on'](_0x374a3f,_0x4d5da4);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 3b74fda..19bba92 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 _0x0b1a=['/:id','isAuthenticated','show','getMessages','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get'];(function(_0x32f3bc,_0x2b5218){var _0x3f8cc2=function(_0x5dca80){while(--_0x5dca80){_0x32f3bc['push'](_0x32f3bc['shift']());}};_0x3f8cc2(++_0x2b5218);}(_0x0b1a,0x10c));var _0xa0b1=function(_0x322e1b,_0xfac9f9){_0x322e1b=_0x322e1b-0x0;var _0x4f9e63=_0x0b1a[_0x322e1b];return _0x4f9e63;};'use strict';var multer=require(_0xa0b1('0x0'));var util=require(_0xa0b1('0x1'));var path=require(_0xa0b1('0x2'));var timeout=require(_0xa0b1('0x3'));var express=require(_0xa0b1('0x4'));var router=express[_0xa0b1('0x5')]();var auth=require(_0xa0b1('0x6'));var interaction=require(_0xa0b1('0x7'));var config=require(_0xa0b1('0x8'));var controller=require(_0xa0b1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xa0b1('0xa')]);router[_0xa0b1('0xb')](_0xa0b1('0xc'),auth[_0xa0b1('0xd')](),controller[_0xa0b1('0xe')]);router['get']('/:id/messages',auth[_0xa0b1('0xd')](),controller[_0xa0b1('0xf')]);router['post']('/',auth[_0xa0b1('0xd')](),controller[_0xa0b1('0x10')]);router[_0xa0b1('0x11')](_0xa0b1('0xc'),auth[_0xa0b1('0xd')](),controller['update']);router['delete'](_0xa0b1('0xc'),auth[_0xa0b1('0xd')](),controller[_0xa0b1('0x12')]);module[_0xa0b1('0x13')]=router; \ No newline at end of file +var _0x2885=['./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x279cc6,_0xe42918){var _0x12453a=function(_0x47b0b2){while(--_0x47b0b2){_0x279cc6['push'](_0x279cc6['shift']());}};_0x12453a(++_0xe42918);}(_0x2885,0x162));var _0x5288=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x2885[_0xd09668];return _0x68726;};'use strict';var multer=require(_0x5288('0x0'));var util=require(_0x5288('0x1'));var path=require('path');var timeout=require(_0x5288('0x2'));var express=require('express');var router=express[_0x5288('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5288('0x4'));var config=require(_0x5288('0x5'));var controller=require(_0x5288('0x6'));router[_0x5288('0x7')]('/',auth[_0x5288('0x8')](),controller[_0x5288('0x9')]);router[_0x5288('0x7')](_0x5288('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x5288('0x7')](_0x5288('0xb'),auth[_0x5288('0x8')](),controller['getMessages']);router[_0x5288('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5288('0xd')](_0x5288('0xa'),auth[_0x5288('0x8')](),controller[_0x5288('0xe')]);router[_0x5288('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5288('0x10')]);module[_0x5288('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index b104d0e..c80b936 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 _0x3423=['email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x275c6e,_0x476557){var _0x269d2b=function(_0x3259a7){while(--_0x3259a7){_0x275c6e['push'](_0x275c6e['shift']());}};_0x269d2b(++_0x476557);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x3342('0x0')]},'context':{'type':Sequelize[_0x3342('0x0')],'defaultValue':_0x3342('0x1'),'unique':_0x3342('0x2')},'mailbox':{'type':Sequelize[_0x3342('0x0')],'defaultValue':'','allowNull':![],'unique':_0x3342('0x2')},'password':{'type':Sequelize[_0x3342('0x0')]},'fullname':{'type':Sequelize[_0x3342('0x0')]},'email':{'type':Sequelize[_0x3342('0x0')],'validate':{'isEmail':!![]},'set':function(_0x19206f){this[_0x3342('0x3')](_0x3342('0x4'),typeof _0x19206f===_0x3342('0x5')&&_0x19206f[_0x3342('0x6')]()?_0x19206f[_0x3342('0x6')]():null);}},'pager':{'type':Sequelize[_0x3342('0x0')]},'tz':{'type':Sequelize[_0x3342('0x0')],'defaultValue':_0x3342('0x7')},'attach':{'type':Sequelize[_0x3342('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x3342('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3342('0x8')](_0x3342('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x3342('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x3342('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3342('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3342('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3342('0x8')](_0x3342('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3342('0x8')](_0x3342('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3342('0x8')](_0x3342('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x3342('0x8')](_0x3342('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x3342('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3342('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x3342('0xb')},'emailsubject':{'type':Sequelize[_0x3342('0x0')]},'emailbody':{'type':Sequelize[_0x3342('0x0')]},'maxsecs':{'type':Sequelize[_0x3342('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3342('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3342('0xd')],'get':function(){return this[_0x3342('0xe')](_0x3342('0xf'))+_0x3342('0x10')+this['getDataValue'](_0x3342('0x11'));}}}; \ No newline at end of file +var _0x9ffd=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x59f4bf,_0xf43438){_0x59f4bf=_0x59f4bf-0x0;var _0x2ca445=_0x9ffd[_0x59f4bf];return _0x2ca445;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'customer_id':{'type':Sequelize[_0xd9ff('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xd9ff('0x3'),'unique':_0xd9ff('0x4')},'mailbox':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':'','allowNull':![],'unique':_0xd9ff('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xd9ff('0x2')]},'email':{'type':Sequelize[_0xd9ff('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5b8b99){this[_0xd9ff('0x5')](_0xd9ff('0x6'),typeof _0x5b8b99===_0xd9ff('0x7')&&_0x5b8b99[_0xd9ff('0x8')]()?_0x5b8b99[_0xd9ff('0x8')]():null);}},'pager':{'type':Sequelize[_0xd9ff('0x2')]},'tz':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':_0xd9ff('0x9')},'attach':{'type':Sequelize[_0xd9ff('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xd9ff('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd9ff('0x2')]},'callback':{'type':Sequelize[_0xd9ff('0x2')]},'review':{'type':Sequelize[_0xd9ff('0xa')](_0xd9ff('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd9ff('0xa')](_0xd9ff('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd9ff('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xd9ff('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xd9ff('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xd9ff('0xa')](_0xd9ff('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd9ff('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd9ff('0xa')](_0xd9ff('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xd9ff('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xd9ff('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xd9ff('0xd')},'emailsubject':{'type':Sequelize[_0xd9ff('0x2')]},'emailbody':{'type':Sequelize[_0xd9ff('0x2')]},'maxsecs':{'type':Sequelize[_0xd9ff('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd9ff('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd9ff('0xf')],'get':function(){return this[_0xd9ff('0x10')](_0xd9ff('0x11'))+_0xd9ff('0x12')+this[_0xd9ff('0x10')](_0xd9ff('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 5b95849..7ce8eab 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 _0x6415=['reject','save','destroy','get','Voicemails','UserProfileResource','then','end','error','name','send','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','count','offset','limit','set','Content-Range','json','apply'];(function(_0x56f239,_0xebb908){var _0x1636fc=function(_0x29d2c3){while(--_0x29d2c3){_0x56f239['push'](_0x56f239['shift']());}};_0x1636fc(++_0xebb908);}(_0x6415,0x1ef));var _0x5641=function(_0x2fdac0,_0x17b486){_0x2fdac0=_0x2fdac0-0x0;var _0x5c12ac=_0x6415[_0x2fdac0];return _0x5c12ac;};'use strict';var pdf=require(_0x5641('0x0'));var emlformat=require(_0x5641('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5641('0x2'));var jsonpatch=require(_0x5641('0x3'));var rp=require(_0x5641('0x4'));var moment=require(_0x5641('0x5'));var BPromise=require(_0x5641('0x6'));var Mustache=require(_0x5641('0x7'));var util=require(_0x5641('0x8'));var path=require(_0x5641('0x9'));var sox=require('sox');var csv=require(_0x5641('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5641('0xb'));var squel=require(_0x5641('0xc'));var crypto=require(_0x5641('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5641('0xa'));var querystring=require(_0x5641('0xe'));var Papa=require(_0x5641('0xf'));var Redis=require(_0x5641('0x10'));var authService=require(_0x5641('0x11'));var qs=require(_0x5641('0x12'));var as=require(_0x5641('0x13'));var hardwareService=require(_0x5641('0x14'));var logger=require(_0x5641('0x15'))(_0x5641('0x16'));var utils=require(_0x5641('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf830aa,_0x267028){_0x267028=_0x267028||0xcc;return function(_0x2d5428){if(_0x2d5428){return _0xf830aa[_0x5641('0x18')](_0x267028);}return _0xf830aa['status'](_0x267028)['end']();};}function respondWithResult(_0x4dee0d,_0x52c09d){_0x52c09d=_0x52c09d||0xc8;return function(_0x5c6053){if(_0x5c6053){return _0x4dee0d[_0x5641('0x19')](_0x52c09d)['json'](_0x5c6053);}};}function respondWithFilteredResult(_0x5b7308,_0x252540){return function(_0x4de08f){if(_0x4de08f){var _0x35387e=_0x4de08f[_0x5641('0x1a')],_0x5a0abc=_0x252540[_0x5641('0x1b')],_0x2772fd=_0x252540[_0x5641('0x1b')]+_0x252540[_0x5641('0x1c')],_0x516494;if(_0x2772fd>=_0x35387e){_0x2772fd=_0x35387e;_0x516494=0xc8;}else{_0x516494=0xce;}_0x5b7308[_0x5641('0x19')](_0x516494);return _0x5b7308[_0x5641('0x1d')](_0x5641('0x1e'),_0x5a0abc+'-'+_0x2772fd+'/'+_0x35387e)[_0x5641('0x1f')](_0x4de08f);}return null;};}function patchUpdates(_0x1fafa4){return function(_0x24ec97){try{jsonpatch[_0x5641('0x20')](_0x24ec97,_0x1fafa4,!![]);}catch(_0xae8a37){return BPromise[_0x5641('0x21')](_0xae8a37);}return _0x24ec97[_0x5641('0x22')]();};}function saveUpdates(_0x351637,_0x660f5){return function(_0x25a906){if(_0x25a906){return _0x25a906['update'](_0x351637)['then'](function(_0x74a5c5){return _0x74a5c5;});}return null;};}function removeEntity(_0x106196,_0x45d012){return function(_0x4232c4){if(_0x4232c4){return _0x4232c4[_0x5641('0x23')]()['then'](function(){var _0x1fb05c=_0x4232c4[_0x5641('0x24')]({'plain':!![]});var _0x7ea4c6=_0x5641('0x25');return db[_0x5641('0x26')][_0x5641('0x23')]({'where':{'type':_0x7ea4c6,'resourceId':_0x1fb05c['id']}})[_0x5641('0x27')](function(){return _0x4232c4;});})['then'](function(){_0x106196['status'](0xcc)[_0x5641('0x28')]();});}};}function handleEntityNotFound(_0x153587,_0x1a6d7a){return function(_0x3e0f75){if(!_0x3e0f75){_0x153587['sendStatus'](0x194);}return _0x3e0f75;};}function handleError(_0x48fb51,_0x43ce06){_0x43ce06=_0x43ce06||0x1f4;return function(_0xb4a28a){logger[_0x5641('0x29')](_0xb4a28a['stack']);if(_0xb4a28a['name']){delete _0xb4a28a[_0x5641('0x2a')];}_0x48fb51[_0x5641('0x19')](_0x43ce06)[_0x5641('0x2b')](_0xb4a28a);};}exports[_0x5641('0x2c')]=function(_0x1ce1e8,_0x1051a3){var _0x70eadd={},_0xd6084f={},_0x39abdc={'count':0x0,'rows':[]};var _0x45402d=_['map'](db[_0x5641('0x2d')][_0x5641('0x2e')],function(_0x449b73){return{'name':_0x449b73[_0x5641('0x2f')],'type':_0x449b73[_0x5641('0x30')][_0x5641('0x31')]};});_0xd6084f[_0x5641('0x32')]=_[_0x5641('0x33')](_0x45402d,_0x5641('0x2a'));_0xd6084f[_0x5641('0x34')]=_[_0x5641('0x35')](_0x1ce1e8[_0x5641('0x34')]);_0xd6084f[_0x5641('0x36')]=_[_0x5641('0x37')](_0xd6084f[_0x5641('0x32')],_0xd6084f[_0x5641('0x34')]);_0x70eadd[_0x5641('0x38')]=_[_0x5641('0x37')](_0xd6084f[_0x5641('0x32')],qs['fields'](_0x1ce1e8[_0x5641('0x34')][_0x5641('0x39')]));_0x70eadd[_0x5641('0x38')]=_0x70eadd[_0x5641('0x38')][_0x5641('0x3a')]?_0x70eadd[_0x5641('0x38')]:_0xd6084f[_0x5641('0x32')];if(!_0x1ce1e8['query'][_0x5641('0x3b')](_0x5641('0x3c'))){_0x70eadd[_0x5641('0x1c')]=qs['limit'](_0x1ce1e8[_0x5641('0x34')][_0x5641('0x1c')]);_0x70eadd[_0x5641('0x1b')]=qs[_0x5641('0x1b')](_0x1ce1e8[_0x5641('0x34')]['offset']);}_0x70eadd[_0x5641('0x3d')]=qs[_0x5641('0x3e')](_0x1ce1e8[_0x5641('0x34')][_0x5641('0x3e')]);_0x70eadd[_0x5641('0x3f')]=qs['filters'](_[_0x5641('0x40')](_0x1ce1e8[_0x5641('0x34')],_0xd6084f[_0x5641('0x36')]),_0x45402d);if(_0x1ce1e8['query'][_0x5641('0x41')]){_0x70eadd[_0x5641('0x3f')]=_[_0x5641('0x42')](_0x70eadd[_0x5641('0x3f')],{'$or':_['map'](_0x45402d,function(_0x33665b){if(_0x33665b[_0x5641('0x30')]!==_0x5641('0x43')){var _0x463633={};_0x463633[_0x33665b['name']]={'$like':'%'+_0x1ce1e8[_0x5641('0x34')][_0x5641('0x41')]+'%'};return _0x463633;}})});}_0x70eadd=_[_0x5641('0x42')]({},_0x70eadd,_0x1ce1e8[_0x5641('0x44')]);var _0x228483={'where':_0x70eadd['where']};return db[_0x5641('0x2d')]['count'](_0x228483)[_0x5641('0x27')](function(_0x54e165){_0x39abdc['count']=_0x54e165;if(_0x1ce1e8['query'][_0x5641('0x45')]){_0x70eadd[_0x5641('0x46')]=[{'all':!![]}];}return db['VoiceMail'][_0x5641('0x47')](_0x70eadd);})[_0x5641('0x27')](function(_0xbf94ff){_0x39abdc['rows']=_0xbf94ff;return _0x39abdc;})[_0x5641('0x27')](respondWithFilteredResult(_0x1051a3,_0x70eadd))[_0x5641('0x48')](handleError(_0x1051a3,null));};exports[_0x5641('0x49')]=function(_0x6d39c8,_0x318fac){var _0x419485={'raw':!![],'where':{'id':_0x6d39c8[_0x5641('0x4a')]['id']}},_0x5c5732={};_0x5c5732[_0x5641('0x32')]=_['keys'](db[_0x5641('0x2d')][_0x5641('0x2e')]);_0x5c5732[_0x5641('0x34')]=_[_0x5641('0x35')](_0x6d39c8[_0x5641('0x34')]);_0x5c5732[_0x5641('0x36')]=_[_0x5641('0x37')](_0x5c5732[_0x5641('0x32')],_0x5c5732['query']);_0x419485[_0x5641('0x38')]=_[_0x5641('0x37')](_0x5c5732[_0x5641('0x32')],qs[_0x5641('0x39')](_0x6d39c8[_0x5641('0x34')]['fields']));_0x419485['attributes']=_0x419485['attributes'][_0x5641('0x3a')]?_0x419485[_0x5641('0x38')]:_0x5c5732[_0x5641('0x32')];if(_0x6d39c8[_0x5641('0x34')][_0x5641('0x45')]){_0x419485[_0x5641('0x46')]=[{'all':!![]}];}_0x419485=_[_0x5641('0x42')]({},_0x419485,_0x6d39c8['options']);return db[_0x5641('0x2d')][_0x5641('0x4b')](_0x419485)[_0x5641('0x27')](handleEntityNotFound(_0x318fac,null))[_0x5641('0x27')](respondWithResult(_0x318fac,null))[_0x5641('0x48')](handleError(_0x318fac,null));};exports[_0x5641('0x4c')]=function(_0xaf120d,_0x542578){return db[_0x5641('0x2d')][_0x5641('0x4c')](_0xaf120d['body'],{})['then'](function(_0x478808){var _0x25f0c7=_0xaf120d['user']['get']({'plain':!![]});if(!_0x25f0c7)throw new Error(_0x5641('0x4d'));if(_0x25f0c7[_0x5641('0x4e')]===_0x5641('0x4f')){var _0x30b1ed=_0x478808['get']({'plain':!![]});var _0x528a75=_0x5641('0x25');return db[_0x5641('0x50')][_0x5641('0x4b')]({'where':{'name':_0x528a75,'userProfileId':_0x25f0c7[_0x5641('0x51')]},'raw':!![]})['then'](function(_0x316309){if(_0x316309&&_0x316309['autoAssociation']===0x0){return db[_0x5641('0x26')][_0x5641('0x4c')]({'name':_0x30b1ed[_0x5641('0x2a')],'resourceId':_0x30b1ed['id'],'type':_0x316309[_0x5641('0x2a')],'sectionId':_0x316309['id']},{})[_0x5641('0x27')](function(){return _0x478808;});}else{return _0x478808;}})[_0x5641('0x48')](function(_0x1ddc57){logger['error'](_0x5641('0x52'),_0x1ddc57);throw _0x1ddc57;});}return _0x478808;})[_0x5641('0x27')](respondWithResult(_0x542578,0xc9))[_0x5641('0x48')](handleError(_0x542578,null));};exports['update']=function(_0x544d0c,_0x559a0c){if(_0x544d0c['body']['id']){delete _0x544d0c[_0x5641('0x53')]['id'];}return db[_0x5641('0x2d')][_0x5641('0x4b')]({'where':{'id':_0x544d0c[_0x5641('0x4a')]['id']}})[_0x5641('0x27')](handleEntityNotFound(_0x559a0c,null))[_0x5641('0x27')](saveUpdates(_0x544d0c['body'],null))[_0x5641('0x27')](respondWithResult(_0x559a0c,null))['catch'](handleError(_0x559a0c,null));};exports[_0x5641('0x23')]=function(_0x30f569,_0x3cf0dc){return db[_0x5641('0x2d')][_0x5641('0x4b')]({'where':{'id':_0x30f569[_0x5641('0x4a')]['id']}})[_0x5641('0x27')](handleEntityNotFound(_0x3cf0dc,null))[_0x5641('0x27')](removeEntity(_0x3cf0dc,null))[_0x5641('0x48')](handleError(_0x3cf0dc,null));};exports[_0x5641('0x54')]=function(_0x29d93c,_0xaed48c,_0xf189ee){return db[_0x5641('0x2d')][_0x5641('0x55')]({'where':{'id':_0x29d93c[_0x5641('0x4a')]['id']}})['then'](handleEntityNotFound(_0xaed48c,null))[_0x5641('0x27')](function(_0x5a19f5){var _0x45e71d;var _0x5dd1b2={},_0x100c75={};_0x100c75['model']=_[_0x5641('0x35')](db[_0x5641('0x56')][_0x5641('0x2e')]);_0x100c75['query']=_[_0x5641('0x35')](_0x29d93c[_0x5641('0x34')]);_0x100c75[_0x5641('0x36')]=_[_0x5641('0x37')](_0x100c75[_0x5641('0x32')],_0x100c75[_0x5641('0x34')]);_0x5dd1b2[_0x5641('0x38')]=_['intersection'](_0x100c75[_0x5641('0x32')],qs[_0x5641('0x39')](_0x29d93c[_0x5641('0x34')][_0x5641('0x39')]));_0x5dd1b2[_0x5641('0x38')]=_0x5dd1b2[_0x5641('0x38')]['length']?_0x5dd1b2['attributes']:_0x100c75[_0x5641('0x32')];if(!_0x29d93c[_0x5641('0x34')][_0x5641('0x3b')](_0x5641('0x3c'))){_0x5dd1b2[_0x5641('0x1c')]=qs[_0x5641('0x1c')](_0x29d93c[_0x5641('0x34')][_0x5641('0x1c')]);_0x5dd1b2[_0x5641('0x1b')]=qs[_0x5641('0x1b')](_0x29d93c[_0x5641('0x34')][_0x5641('0x1b')]);}_0x5dd1b2[_0x5641('0x3d')]=qs[_0x5641('0x3e')](_0x29d93c[_0x5641('0x34')]['sort']);_0x5dd1b2[_0x5641('0x3f')]=qs['filters'](_[_0x5641('0x40')](_0x29d93c[_0x5641('0x34')],_0x100c75[_0x5641('0x36')]));if(_0x29d93c[_0x5641('0x34')][_0x5641('0x41')]){_0x5dd1b2['where']=_['merge'](_0x5dd1b2[_0x5641('0x3f')],{'$or':_[_0x5641('0x33')](_0x5dd1b2[_0x5641('0x38')],function(_0x53754e){var _0x375ef8={};_0x375ef8[_0x53754e]={'$like':'%'+_0x29d93c[_0x5641('0x34')]['filter']+'%'};return _0x375ef8;})});}_0x5dd1b2[_0x5641('0x3f')]=_[_0x5641('0x42')](_0x5dd1b2[_0x5641('0x3f')],{'mailboxuser':_0x5a19f5['mailbox']});_0x5dd1b2=_[_0x5641('0x42')]({},_0x5dd1b2,_0x29d93c['options']);return db[_0x5641('0x56')][_0x5641('0x57')](_0x5dd1b2)[_0x5641('0x27')](respondWithFilteredResult(_0xaed48c,_0x5dd1b2));})['catch'](handleError(_0xaed48c,null));}; \ No newline at end of file +var _0xa459=['sort','filters','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','params','fields','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','mailbox','findAndCountAll','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','save','update','then','destroy','Voicemails','error','stack','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','name','keys','intersection','model','query','attributes','length','hasOwnProperty','nolimit','limit','order'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa459,0x114));var _0x9a45=function(_0x366272,_0x1f11a6){_0x366272=_0x366272-0x0;var _0x3ee038=_0xa459[_0x366272];return _0x3ee038;};'use strict';var pdf=require(_0x9a45('0x0'));var emlformat=require(_0x9a45('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9a45('0x2'));var rp=require(_0x9a45('0x3'));var moment=require(_0x9a45('0x4'));var BPromise=require(_0x9a45('0x5'));var Mustache=require(_0x9a45('0x6'));var util=require(_0x9a45('0x7'));var path=require('path');var sox=require(_0x9a45('0x8'));var csv=require(_0x9a45('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9a45('0xa'));var crypto=require(_0x9a45('0xb'));var jsforce=require(_0x9a45('0xc'));var deskjs=require(_0x9a45('0xd'));var toCsv=require(_0x9a45('0x9'));var querystring=require(_0x9a45('0xe'));var Papa=require(_0x9a45('0xf'));var Redis=require(_0x9a45('0x10'));var authService=require(_0x9a45('0x11'));var qs=require(_0x9a45('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a45('0x13'));var logger=require(_0x9a45('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9a45('0x15'));var db=require(_0x9a45('0x16'))['db'];function respondWithStatusCode(_0x321636,_0x36d251){_0x36d251=_0x36d251||0xcc;return function(_0x5b8bb4){if(_0x5b8bb4){return _0x321636['sendStatus'](_0x36d251);}return _0x321636[_0x9a45('0x17')](_0x36d251)[_0x9a45('0x18')]();};}function respondWithResult(_0x110893,_0x2f580a){_0x2f580a=_0x2f580a||0xc8;return function(_0x32eb4e){if(_0x32eb4e){return _0x110893[_0x9a45('0x17')](_0x2f580a)[_0x9a45('0x19')](_0x32eb4e);}};}function respondWithFilteredResult(_0x35dc41,_0x2ea6b6){return function(_0x1cdfa8){if(_0x1cdfa8){var _0x1c7f2a=_0x1cdfa8[_0x9a45('0x1a')],_0x1d01b9=_0x2ea6b6[_0x9a45('0x1b')],_0x42daf1=_0x2ea6b6['offset']+_0x2ea6b6['limit'],_0xd05657;if(_0x42daf1>=_0x1c7f2a){_0x42daf1=_0x1c7f2a;_0xd05657=0xc8;}else{_0xd05657=0xce;}_0x35dc41[_0x9a45('0x17')](_0xd05657);return _0x35dc41[_0x9a45('0x1c')](_0x9a45('0x1d'),_0x1d01b9+'-'+_0x42daf1+'/'+_0x1c7f2a)[_0x9a45('0x19')](_0x1cdfa8);}return null;};}function patchUpdates(_0x14c07c){return function(_0x2518ac){try{jsonpatch['apply'](_0x2518ac,_0x14c07c,!![]);}catch(_0x2d3fc2){return BPromise['reject'](_0x2d3fc2);}return _0x2518ac[_0x9a45('0x1e')]();};}function saveUpdates(_0x1495d0,_0x2692f4){return function(_0x1d0982){if(_0x1d0982){return _0x1d0982[_0x9a45('0x1f')](_0x1495d0)[_0x9a45('0x20')](function(_0x337a46){return _0x337a46;});}return null;};}function removeEntity(_0x5820f4,_0x506512){return function(_0x3c4e1e){if(_0x3c4e1e){return _0x3c4e1e[_0x9a45('0x21')]()[_0x9a45('0x20')](function(){var _0x2ad8c6=_0x3c4e1e['get']({'plain':!![]});var _0x5ae056=_0x9a45('0x22');return db['UserProfileResource'][_0x9a45('0x21')]({'where':{'type':_0x5ae056,'resourceId':_0x2ad8c6['id']}})[_0x9a45('0x20')](function(){return _0x3c4e1e;});})['then'](function(){_0x5820f4[_0x9a45('0x17')](0xcc)[_0x9a45('0x18')]();});}};}function handleEntityNotFound(_0x3695c8,_0x3a567d){return function(_0x48e50d){if(!_0x48e50d){_0x3695c8['sendStatus'](0x194);}return _0x48e50d;};}function handleError(_0x28ea5f,_0x546618){_0x546618=_0x546618||0x1f4;return function(_0xf09580){logger[_0x9a45('0x23')](_0xf09580[_0x9a45('0x24')]);if(_0xf09580['name']){delete _0xf09580['name'];}_0x28ea5f[_0x9a45('0x17')](_0x546618)[_0x9a45('0x25')](_0xf09580);};}exports[_0x9a45('0x26')]=function(_0x4766ff,_0x766e9){var _0x5b56b8={},_0x303e3f={},_0xadb6={'count':0x0,'rows':[]};var _0x5dbef2=_[_0x9a45('0x27')](db[_0x9a45('0x28')][_0x9a45('0x29')],function(_0x40c27e){return{'name':_0x40c27e[_0x9a45('0x2a')],'type':_0x40c27e[_0x9a45('0x2b')][_0x9a45('0x2c')]};});_0x303e3f['model']=_[_0x9a45('0x27')](_0x5dbef2,_0x9a45('0x2d'));_0x303e3f['query']=_[_0x9a45('0x2e')](_0x4766ff['query']);_0x303e3f['filters']=_[_0x9a45('0x2f')](_0x303e3f[_0x9a45('0x30')],_0x303e3f[_0x9a45('0x31')]);_0x5b56b8[_0x9a45('0x32')]=_[_0x9a45('0x2f')](_0x303e3f[_0x9a45('0x30')],qs['fields'](_0x4766ff[_0x9a45('0x31')]['fields']));_0x5b56b8[_0x9a45('0x32')]=_0x5b56b8[_0x9a45('0x32')][_0x9a45('0x33')]?_0x5b56b8[_0x9a45('0x32')]:_0x303e3f[_0x9a45('0x30')];if(!_0x4766ff[_0x9a45('0x31')][_0x9a45('0x34')](_0x9a45('0x35'))){_0x5b56b8[_0x9a45('0x36')]=qs[_0x9a45('0x36')](_0x4766ff[_0x9a45('0x31')]['limit']);_0x5b56b8[_0x9a45('0x1b')]=qs[_0x9a45('0x1b')](_0x4766ff[_0x9a45('0x31')][_0x9a45('0x1b')]);}_0x5b56b8[_0x9a45('0x37')]=qs[_0x9a45('0x38')](_0x4766ff[_0x9a45('0x31')][_0x9a45('0x38')]);_0x5b56b8['where']=qs[_0x9a45('0x39')](_['pick'](_0x4766ff['query'],_0x303e3f['filters']),_0x5dbef2);if(_0x4766ff['query'][_0x9a45('0x3a')]){_0x5b56b8[_0x9a45('0x3b')]=_[_0x9a45('0x3c')](_0x5b56b8[_0x9a45('0x3b')],{'$or':_[_0x9a45('0x27')](_0x5dbef2,function(_0x162ec7){if(_0x162ec7['type']!==_0x9a45('0x3d')){var _0x2dd433={};_0x2dd433[_0x162ec7[_0x9a45('0x2d')]]={'$like':'%'+_0x4766ff['query']['filter']+'%'};return _0x2dd433;}})});}_0x5b56b8=_[_0x9a45('0x3c')]({},_0x5b56b8,_0x4766ff[_0x9a45('0x3e')]);var _0x1f9f09={'where':_0x5b56b8['where']};return db[_0x9a45('0x28')][_0x9a45('0x1a')](_0x1f9f09)[_0x9a45('0x20')](function(_0x2b384e){_0xadb6[_0x9a45('0x1a')]=_0x2b384e;if(_0x4766ff[_0x9a45('0x31')][_0x9a45('0x3f')]){_0x5b56b8['include']=[{'all':!![]}];}return db[_0x9a45('0x28')]['findAll'](_0x5b56b8);})[_0x9a45('0x20')](function(_0x5af57d){_0xadb6[_0x9a45('0x40')]=_0x5af57d;return _0xadb6;})[_0x9a45('0x20')](respondWithFilteredResult(_0x766e9,_0x5b56b8))[_0x9a45('0x41')](handleError(_0x766e9,null));};exports['show']=function(_0x448ede,_0x532b4c){var _0x1a7338={'raw':!![],'where':{'id':_0x448ede[_0x9a45('0x42')]['id']}},_0x5fa12={};_0x5fa12[_0x9a45('0x30')]=_[_0x9a45('0x2e')](db[_0x9a45('0x28')][_0x9a45('0x29')]);_0x5fa12[_0x9a45('0x31')]=_[_0x9a45('0x2e')](_0x448ede['query']);_0x5fa12[_0x9a45('0x39')]=_[_0x9a45('0x2f')](_0x5fa12[_0x9a45('0x30')],_0x5fa12['query']);_0x1a7338[_0x9a45('0x32')]=_[_0x9a45('0x2f')](_0x5fa12[_0x9a45('0x30')],qs[_0x9a45('0x43')](_0x448ede[_0x9a45('0x31')]['fields']));_0x1a7338['attributes']=_0x1a7338['attributes']['length']?_0x1a7338[_0x9a45('0x32')]:_0x5fa12[_0x9a45('0x30')];if(_0x448ede[_0x9a45('0x31')]['includeAll']){_0x1a7338[_0x9a45('0x44')]=[{'all':!![]}];}_0x1a7338=_[_0x9a45('0x3c')]({},_0x1a7338,_0x448ede[_0x9a45('0x3e')]);return db[_0x9a45('0x28')][_0x9a45('0x45')](_0x1a7338)['then'](handleEntityNotFound(_0x532b4c,null))[_0x9a45('0x20')](respondWithResult(_0x532b4c,null))[_0x9a45('0x41')](handleError(_0x532b4c,null));};exports[_0x9a45('0x46')]=function(_0x34bb0c,_0xaa581){return db[_0x9a45('0x28')]['create'](_0x34bb0c[_0x9a45('0x47')],{})['then'](function(_0x1f6232){var _0xf1d6d2=_0x34bb0c['user'][_0x9a45('0x48')]({'plain':!![]});if(!_0xf1d6d2)throw new Error(_0x9a45('0x49'));if(_0xf1d6d2['role']===_0x9a45('0x4a')){var _0x51f612=_0x1f6232['get']({'plain':!![]});var _0x401d6e='Voicemails';return db[_0x9a45('0x4b')][_0x9a45('0x45')]({'where':{'name':_0x401d6e,'userProfileId':_0xf1d6d2['userProfileId']},'raw':!![]})[_0x9a45('0x20')](function(_0xdb3911){if(_0xdb3911&&_0xdb3911[_0x9a45('0x4c')]===0x0){return db[_0x9a45('0x4d')][_0x9a45('0x46')]({'name':_0x51f612[_0x9a45('0x2d')],'resourceId':_0x51f612['id'],'type':_0xdb3911['name'],'sectionId':_0xdb3911['id']},{})['then'](function(){return _0x1f6232;});}else{return _0x1f6232;}})[_0x9a45('0x41')](function(_0x1ee7da){logger[_0x9a45('0x23')](_0x9a45('0x4e'),_0x1ee7da);throw _0x1ee7da;});}return _0x1f6232;})[_0x9a45('0x20')](respondWithResult(_0xaa581,0xc9))['catch'](handleError(_0xaa581,null));};exports['update']=function(_0x36a9f7,_0x5ceb76){if(_0x36a9f7['body']['id']){delete _0x36a9f7[_0x9a45('0x47')]['id'];}return db[_0x9a45('0x28')][_0x9a45('0x45')]({'where':{'id':_0x36a9f7[_0x9a45('0x42')]['id']}})[_0x9a45('0x20')](handleEntityNotFound(_0x5ceb76,null))[_0x9a45('0x20')](saveUpdates(_0x36a9f7[_0x9a45('0x47')],null))[_0x9a45('0x20')](respondWithResult(_0x5ceb76,null))[_0x9a45('0x41')](handleError(_0x5ceb76,null));};exports[_0x9a45('0x21')]=function(_0x402e4b,_0x1c51df){return db[_0x9a45('0x28')]['find']({'where':{'id':_0x402e4b[_0x9a45('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c51df,null))[_0x9a45('0x20')](removeEntity(_0x1c51df,null))['catch'](handleError(_0x1c51df,null));};exports[_0x9a45('0x4f')]=function(_0x51da36,_0x1f2a29,_0x2379fc){return db[_0x9a45('0x28')][_0x9a45('0x50')]({'where':{'id':_0x51da36['params']['id']}})['then'](handleEntityNotFound(_0x1f2a29,null))[_0x9a45('0x20')](function(_0x153b83){var _0x4046c6;var _0x2bffe9={},_0x41fa69={};_0x41fa69[_0x9a45('0x30')]=_[_0x9a45('0x2e')](db['VoiceMailMessage']['rawAttributes']);_0x41fa69[_0x9a45('0x31')]=_[_0x9a45('0x2e')](_0x51da36[_0x9a45('0x31')]);_0x41fa69[_0x9a45('0x39')]=_[_0x9a45('0x2f')](_0x41fa69[_0x9a45('0x30')],_0x41fa69[_0x9a45('0x31')]);_0x2bffe9['attributes']=_[_0x9a45('0x2f')](_0x41fa69[_0x9a45('0x30')],qs[_0x9a45('0x43')](_0x51da36[_0x9a45('0x31')]['fields']));_0x2bffe9[_0x9a45('0x32')]=_0x2bffe9[_0x9a45('0x32')][_0x9a45('0x33')]?_0x2bffe9['attributes']:_0x41fa69['model'];if(!_0x51da36['query'][_0x9a45('0x34')](_0x9a45('0x35'))){_0x2bffe9[_0x9a45('0x36')]=qs[_0x9a45('0x36')](_0x51da36[_0x9a45('0x31')][_0x9a45('0x36')]);_0x2bffe9[_0x9a45('0x1b')]=qs[_0x9a45('0x1b')](_0x51da36['query'][_0x9a45('0x1b')]);}_0x2bffe9[_0x9a45('0x37')]=qs[_0x9a45('0x38')](_0x51da36['query'][_0x9a45('0x38')]);_0x2bffe9['where']=qs[_0x9a45('0x39')](_['pick'](_0x51da36[_0x9a45('0x31')],_0x41fa69['filters']));if(_0x51da36['query'][_0x9a45('0x3a')]){_0x2bffe9[_0x9a45('0x3b')]=_[_0x9a45('0x3c')](_0x2bffe9[_0x9a45('0x3b')],{'$or':_[_0x9a45('0x27')](_0x2bffe9[_0x9a45('0x32')],function(_0x6d9fb1){var _0x3180cc={};_0x3180cc[_0x6d9fb1]={'$like':'%'+_0x51da36['query']['filter']+'%'};return _0x3180cc;})});}_0x2bffe9[_0x9a45('0x3b')]=_[_0x9a45('0x3c')](_0x2bffe9[_0x9a45('0x3b')],{'mailboxuser':_0x153b83[_0x9a45('0x51')]});_0x2bffe9=_[_0x9a45('0x3c')]({},_0x2bffe9,_0x51da36[_0x9a45('0x3e')]);return db['VoiceMailMessage'][_0x9a45('0x52')](_0x2bffe9)[_0x9a45('0x20')](respondWithFilteredResult(_0x1f2a29,_0x2bffe9));})[_0x9a45('0x41')](handleError(_0x1f2a29,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 162d02a..ec13d94 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 _0x631f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','voice_voicemail','mailbox_context','mailbox','util','../../config/logger'];(function(_0x3c007e,_0x2e6adc){var _0x851f31=function(_0x12bf84){while(--_0x12bf84){_0x3c007e['push'](_0x3c007e['shift']());}};_0x851f31(++_0x2e6adc);}(_0x631f,0x191));var _0xf631=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0x631f[_0x44b7d6];return _0x5346f0;};'use strict';var _=require('lodash');var util=require(_0xf631('0x0'));var logger=require(_0xf631('0x1'))('api');var moment=require(_0xf631('0x2'));var BPromise=require(_0xf631('0x3'));var rp=require(_0xf631('0x4'));var fs=require('fs');var path=require(_0xf631('0x5'));var rimraf=require(_0xf631('0x6'));var config=require(_0xf631('0x7'));var attributes=require(_0xf631('0x8'));module[_0xf631('0x9')]=function(_0x4a1fd5,_0x37b3a8){return _0x4a1fd5['define']('VoiceMail',attributes,{'tableName':_0xf631('0xa'),'paranoid':![],'indexes':[{'name':_0xf631('0xb'),'fields':[_0xf631('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdecb=['mailbox','context','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x3a5993,_0x5b405c){var _0x3ca50c=function(_0x5ad9f8){while(--_0x5ad9f8){_0x3a5993['push'](_0x3a5993['shift']());}};_0x3ca50c(++_0x5b405c);}(_0xdecb,0xe2));var _0xbdec=function(_0x142329,_0x2a3d2c){_0x142329=_0x142329-0x0;var _0x5aa41e=_0xdecb[_0x142329];return _0x5aa41e;};'use strict';var _=require('lodash');var util=require(_0xbdec('0x0'));var logger=require(_0xbdec('0x1'))(_0xbdec('0x2'));var moment=require('moment');var BPromise=require(_0xbdec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdec('0x4'));var rimraf=require(_0xbdec('0x5'));var config=require(_0xbdec('0x6'));var attributes=require(_0xbdec('0x7'));module[_0xbdec('0x8')]=function(_0x26fef3,_0x13d9f8){return _0x26fef3['define'](_0xbdec('0x9'),attributes,{'tableName':_0xbdec('0xa'),'paranoid':![],'indexes':[{'name':_0xbdec('0xb'),'fields':[_0xbdec('0xc'),_0xbdec('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c1856aa..b3accc6 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 _0xe346=['error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1cfdc3,_0x1222e3){var _0x37799f=function(_0x69ba0f){while(--_0x69ba0f){_0x1cfdc3['push'](_0x1cfdc3['shift']());}};_0x37799f(++_0x1222e3);}(_0xe346,0xb7));var _0x6e34=function(_0x50d588,_0x38c604){_0x50d588=_0x50d588-0x0;var _0x501c28=_0xe346[_0x50d588];return _0x501c28;};'use strict';var _=require(_0x6e34('0x0'));var util=require('util');var moment=require(_0x6e34('0x1'));var BPromise=require(_0x6e34('0x2'));var rs=require(_0x6e34('0x3'));var fs=require('fs');var Redis=require(_0x6e34('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e34('0x5'));var logger=require(_0x6e34('0x6'))(_0x6e34('0x7'));var config=require(_0x6e34('0x8'));var jayson=require(_0x6e34('0x9'));var client=jayson[_0x6e34('0xa')][_0x6e34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x163226,_0x46c347,_0x2ed31d){return new BPromise(function(_0x2290df,_0x2a92b1){return client['request'](_0x163226,_0x2ed31d)['then'](function(_0x124ede){logger[_0x6e34('0xc')](_0x6e34('0xd'),_0x46c347,_0x6e34('0xe'));logger[_0x6e34('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x46c347,_0x6e34('0xe'),JSON[_0x6e34('0x10')](_0x124ede));if(_0x124ede[_0x6e34('0x11')]){if(_0x124ede['error']['code']===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x46c347,_0x124ede[_0x6e34('0x11')][_0x6e34('0x12')]);return _0x2a92b1(_0x124ede[_0x6e34('0x11')][_0x6e34('0x12')]);}logger[_0x6e34('0x11')]('VoiceMail,\x20%s,\x20%s',_0x46c347,_0x124ede[_0x6e34('0x11')][_0x6e34('0x12')]);return _0x2290df(_0x124ede[_0x6e34('0x11')]['message']);}else{logger[_0x6e34('0xc')](_0x6e34('0xd'),_0x46c347,_0x6e34('0xe'));_0x2290df(_0x124ede['result']['message']);}})[_0x6e34('0x13')](function(_0x198cb4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x46c347,_0x198cb4);_0x2a92b1(_0x198cb4);});});} \ No newline at end of file +var _0x6031=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x6031,0x197));var _0x1603=function(_0x16b8b4,_0x4a7aad){_0x16b8b4=_0x16b8b4-0x0;var _0x33f004=_0x6031[_0x16b8b4];return _0x33f004;};'use strict';var _=require(_0x1603('0x0'));var util=require(_0x1603('0x1'));var moment=require(_0x1603('0x2'));var BPromise=require(_0x1603('0x3'));var rs=require(_0x1603('0x4'));var fs=require('fs');var Redis=require(_0x1603('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1603('0x6'));var logger=require(_0x1603('0x7'))(_0x1603('0x8'));var config=require(_0x1603('0x9'));var jayson=require(_0x1603('0xa'));var client=jayson[_0x1603('0xb')][_0x1603('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x63c143,_0x3a024d,_0x196d45){return new BPromise(function(_0x1c79ce,_0x12ef08){return client['request'](_0x63c143,_0x196d45)[_0x1603('0xd')](function(_0x3c8a19){logger[_0x1603('0xe')]('VoiceMail,\x20%s,\x20%s',_0x3a024d,_0x1603('0xf'));logger[_0x1603('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3a024d,_0x1603('0xf'),JSON[_0x1603('0x11')](_0x3c8a19));if(_0x3c8a19['error']){if(_0x3c8a19[_0x1603('0x12')]['code']===0x1f4){logger['error'](_0x1603('0x13'),_0x3a024d,_0x3c8a19[_0x1603('0x12')][_0x1603('0x14')]);return _0x12ef08(_0x3c8a19[_0x1603('0x12')][_0x1603('0x14')]);}logger[_0x1603('0x12')](_0x1603('0x13'),_0x3a024d,_0x3c8a19[_0x1603('0x12')][_0x1603('0x14')]);return _0x1c79ce(_0x3c8a19[_0x1603('0x12')]['message']);}else{logger[_0x1603('0xe')]('VoiceMail,\x20%s,\x20%s',_0x3a024d,_0x1603('0xf'));_0x1c79ce(_0x3c8a19[_0x1603('0x15')][_0x1603('0x14')]);}})[_0x1603('0x16')](function(_0x35bcb5){logger[_0x1603('0x12')](_0x1603('0x13'),_0x3a024d,_0x35bcb5);_0x12ef08(_0x35bcb5);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index fc6342b..b8e8d9e 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 _0x31f0=['get','/:id','show','/:id/download','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller'];(function(_0x323577,_0x2843ca){var _0x29254b=function(_0x3bd754){while(--_0x3bd754){_0x323577['push'](_0x323577['shift']());}};_0x29254b(++_0x2843ca);}(_0x31f0,0xb7));var _0x031f=function(_0x21904a,_0x3e9ae1){_0x21904a=_0x21904a-0x0;var _0x255d61=_0x31f0[_0x21904a];return _0x255d61;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x031f('0x8'),auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0x7')](_0x031f('0xa'),auth[_0x031f('0xb')](),controller['download']);router[_0x031f('0xc')]('/',auth[_0x031f('0xb')](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xf')]);router[_0x031f('0x10')]('/:id',auth[_0x031f('0xb')](),controller[_0x031f('0x11')]);module[_0x031f('0x12')]=router; \ No newline at end of file +var _0x3f8a=['download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x595f49,_0x21bb13){var _0x3da2bb=function(_0x34009b){while(--_0x34009b){_0x595f49['push'](_0x595f49['shift']());}};_0x3da2bb(++_0x21bb13);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1af093,_0x427db0){_0x1af093=_0x1af093-0x0;var _0x39b91d=_0x3f8a[_0x1af093];return _0x39b91d;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0x9')](_0xa3f8('0xe'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')]('/',auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['update']);router[_0xa3f8('0x13')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x14')]);module[_0xa3f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 2bce6c2..fce8144 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 _0x8085=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','sequelize','exports'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x8085,0x1ce));var _0x5808=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x8085[_0x5a79e2];return _0x266c45;};'use strict';var Sequelize=require(_0x5808('0x0'));module[_0x5808('0x1')]={'name':{'type':Sequelize[_0x5808('0x2')],'get':function(_0x3e44e6){return this[_0x5808('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x5808('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5808('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x5808('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5808('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5808('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5808('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x5808('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5808('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5808('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x5808('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x5808('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5808('0x5')],'defaultValue':''},'stamp':{'type':_0x5808('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0x8bd6=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','sequelize','exports'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x8bd6,0x146));var _0x68bd=function(_0x56f346,_0x241b2b){_0x56f346=_0x56f346-0x0;var _0x4caa2f=_0x8bd6[_0x56f346];return _0x4caa2f;};'use strict';var Sequelize=require(_0x68bd('0x0'));module[_0x68bd('0x1')]={'name':{'type':Sequelize[_0x68bd('0x2')],'get':function(_0x113a03){return this[_0x68bd('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x68bd('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x68bd('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x68bd('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x68bd('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x68bd('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x68bd('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x68bd('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x68bd('0x6')](_0x68bd('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x68bd('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 2b8b4e8..bc94a6a 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 _0xd52a=['then','stack','name','send','index','map','VoiceMailMessage','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','catch','create','body','destroy','download','recording','Sequelize','audio/wav','attachment','msg_id','Content-Disposition','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','update'];(function(_0x70bcda,_0x4305b6){var _0xdc765=function(_0x359921){while(--_0x359921){_0x70bcda['push'](_0x70bcda['shift']());}};_0xdc765(++_0x4305b6);}(_0xd52a,0xca));var _0xad52=function(_0x28ac6b,_0x2011f4){_0x28ac6b=_0x28ac6b-0x0;var _0x2dd56c=_0xd52a[_0x28ac6b];return _0x2dd56c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xad52('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad52('0x1'));var jsonpatch=require(_0xad52('0x2'));var rp=require(_0xad52('0x3'));var moment=require('moment');var BPromise=require(_0xad52('0x4'));var Mustache=require(_0xad52('0x5'));var util=require(_0xad52('0x6'));var path=require(_0xad52('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xad52('0x8'));var squel=require('squel');var crypto=require(_0xad52('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad52('0xa'));var toCsv=require(_0xad52('0xb'));var querystring=require('querystring');var Papa=require(_0xad52('0xc'));var Redis=require('ioredis');var authService=require(_0xad52('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xad52('0xe'));var hardwareService=require(_0xad52('0xf'));var logger=require(_0xad52('0x10'))(_0xad52('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c86a,_0x79b1e7){_0x79b1e7=_0x79b1e7||0xcc;return function(_0x378b0c){if(_0x378b0c){return _0x25c86a[_0xad52('0x12')](_0x79b1e7);}return _0x25c86a[_0xad52('0x13')](_0x79b1e7)[_0xad52('0x14')]();};}function respondWithResult(_0x16e0f7,_0xd04cde){_0xd04cde=_0xd04cde||0xc8;return function(_0x3d2df6){if(_0x3d2df6){return _0x16e0f7['status'](_0xd04cde)[_0xad52('0x15')](_0x3d2df6);}};}function respondWithFilteredResult(_0x139305,_0x3bc8f6){return function(_0x42eb20){if(_0x42eb20){var _0x38be7e=_0x42eb20[_0xad52('0x16')],_0xcb6cd5=_0x3bc8f6['offset'],_0x2bbaad=_0x3bc8f6['offset']+_0x3bc8f6[_0xad52('0x17')],_0x3aed76;if(_0x2bbaad>=_0x38be7e){_0x2bbaad=_0x38be7e;_0x3aed76=0xc8;}else{_0x3aed76=0xce;}_0x139305[_0xad52('0x13')](_0x3aed76);return _0x139305[_0xad52('0x18')](_0xad52('0x19'),_0xcb6cd5+'-'+_0x2bbaad+'/'+_0x38be7e)[_0xad52('0x15')](_0x42eb20);}return null;};}function patchUpdates(_0x59a5e4){return function(_0x5696a4){try{jsonpatch['apply'](_0x5696a4,_0x59a5e4,!![]);}catch(_0x164ffd){return BPromise[_0xad52('0x1a')](_0x164ffd);}return _0x5696a4[_0xad52('0x1b')]();};}function saveUpdates(_0x5f2bea,_0x24fb52){return function(_0x593dfd){if(_0x593dfd){return _0x593dfd[_0xad52('0x1c')](_0x5f2bea)[_0xad52('0x1d')](function(_0x3262e4){return _0x3262e4;});}return null;};}function removeEntity(_0x23cfee,_0x2c182f){return function(_0x2f1526){if(_0x2f1526){return _0x2f1526['destroy']()[_0xad52('0x1d')](function(){_0x23cfee['status'](0xcc)[_0xad52('0x14')]();});}};}function handleEntityNotFound(_0x2acbb4,_0x2fa90c){return function(_0x5bce67){if(!_0x5bce67){_0x2acbb4[_0xad52('0x12')](0x194);}return _0x5bce67;};}function handleError(_0x579b9d,_0x5437e3){_0x5437e3=_0x5437e3||0x1f4;return function(_0x2809f7){logger['error'](_0x2809f7[_0xad52('0x1e')]);if(_0x2809f7[_0xad52('0x1f')]){delete _0x2809f7['name'];}_0x579b9d['status'](_0x5437e3)[_0xad52('0x20')](_0x2809f7);};}exports[_0xad52('0x21')]=function(_0x42db69,_0x50431e){var _0x132e94={},_0x5771ce={},_0x18c819={'count':0x0,'rows':[]};var _0x3b5613=_[_0xad52('0x22')](db[_0xad52('0x23')]['rawAttributes'],function(_0x426106){return{'name':_0x426106[_0xad52('0x24')],'type':_0x426106['type'][_0xad52('0x25')]};});_0x5771ce[_0xad52('0x26')]=_[_0xad52('0x27')](_[_0xad52('0x22')](_0x3b5613,_0xad52('0x1f')),['name']);_0x5771ce['query']=_['keys'](_0x42db69[_0xad52('0x28')]);_0x5771ce[_0xad52('0x29')]=_[_0xad52('0x2a')](_0x5771ce['model'],_0x5771ce['query']);_0x132e94[_0xad52('0x2b')]=_[_0xad52('0x2a')](_0x5771ce[_0xad52('0x26')],qs[_0xad52('0x2c')](_0x42db69[_0xad52('0x28')][_0xad52('0x2c')]));_0x132e94['attributes']=_0x132e94[_0xad52('0x2b')][_0xad52('0x2d')]?_0x132e94[_0xad52('0x2b')]:_0x5771ce[_0xad52('0x26')];if(!_0x42db69[_0xad52('0x28')][_0xad52('0x2e')](_0xad52('0x2f'))){_0x132e94[_0xad52('0x17')]=qs[_0xad52('0x17')](_0x42db69[_0xad52('0x28')][_0xad52('0x17')]);_0x132e94['offset']=qs[_0xad52('0x30')](_0x42db69[_0xad52('0x28')][_0xad52('0x30')]);}_0x132e94[_0xad52('0x31')]=qs[_0xad52('0x32')](_0x42db69[_0xad52('0x28')]['sort']);_0x132e94[_0xad52('0x33')]=qs[_0xad52('0x29')](_[_0xad52('0x34')](_0x42db69['query'],_0x5771ce[_0xad52('0x29')]),_0x3b5613);if(_0x42db69[_0xad52('0x28')][_0xad52('0x35')]){_0x132e94['where']=_[_0xad52('0x36')](_0x132e94[_0xad52('0x33')],{'$or':_[_0xad52('0x22')](_0x3b5613,function(_0x49260f){if(_0x49260f[_0xad52('0x37')]!==_0xad52('0x38')){var _0xe562e4={};_0xe562e4[_0x49260f[_0xad52('0x1f')]]={'$like':'%'+_0x42db69[_0xad52('0x28')][_0xad52('0x35')]+'%'};return _0xe562e4;}})});}_0x132e94=_['merge']({},_0x132e94,_0x42db69[_0xad52('0x39')]);var _0x5775b4={'where':_0x132e94[_0xad52('0x33')]};return db[_0xad52('0x23')][_0xad52('0x16')](_0x5775b4)[_0xad52('0x1d')](function(_0x1d5e8a){_0x18c819['count']=_0x1d5e8a;if(_0x42db69[_0xad52('0x28')][_0xad52('0x3a')]){_0x132e94[_0xad52('0x3b')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xad52('0x3c')](_0x132e94);})[_0xad52('0x1d')](function(_0x17ef03){_0x18c819['rows']=_0x17ef03;return _0x18c819;})[_0xad52('0x1d')](respondWithFilteredResult(_0x50431e,_0x132e94))['catch'](handleError(_0x50431e,null));};exports[_0xad52('0x3d')]=function(_0x355381,_0x272907){var _0xa1c4a9={'raw':!![],'where':{'id':_0x355381[_0xad52('0x3e')]['id']}},_0x52aa18={};_0x52aa18[_0xad52('0x26')]=_[_0xad52('0x3f')](db[_0xad52('0x23')][_0xad52('0x40')]);_0x52aa18[_0xad52('0x28')]=_[_0xad52('0x3f')](_0x355381[_0xad52('0x28')]);_0x52aa18['filters']=_[_0xad52('0x2a')](_0x52aa18['model'],_0x52aa18[_0xad52('0x28')]);_0xa1c4a9[_0xad52('0x2b')]=_[_0xad52('0x2a')](_0x52aa18[_0xad52('0x26')],qs[_0xad52('0x2c')](_0x355381[_0xad52('0x28')][_0xad52('0x2c')]));_0xa1c4a9[_0xad52('0x2b')]=_0xa1c4a9[_0xad52('0x2b')][_0xad52('0x2d')]?_0xa1c4a9[_0xad52('0x2b')]:_0x52aa18[_0xad52('0x26')];if(_0x355381[_0xad52('0x28')][_0xad52('0x3a')]){_0xa1c4a9[_0xad52('0x3b')]=[{'all':!![]}];}_0xa1c4a9=_[_0xad52('0x36')]({},_0xa1c4a9,_0x355381[_0xad52('0x39')]);return db[_0xad52('0x23')][_0xad52('0x41')](_0xa1c4a9)[_0xad52('0x1d')](handleEntityNotFound(_0x272907,null))['then'](respondWithResult(_0x272907,null))[_0xad52('0x42')](handleError(_0x272907,null));};exports[_0xad52('0x43')]=function(_0x14b87b,_0x5cb877){return db[_0xad52('0x23')]['create'](_0x14b87b[_0xad52('0x44')],{})['then'](respondWithResult(_0x5cb877,0xc9))['catch'](handleError(_0x5cb877,null));};exports[_0xad52('0x1c')]=function(_0x1746b0,_0x4554da){if(_0x1746b0[_0xad52('0x44')]['id']){delete _0x1746b0['body']['id'];}return db['VoiceMailMessage'][_0xad52('0x41')]({'where':{'id':_0x1746b0['params']['id']}})[_0xad52('0x1d')](handleEntityNotFound(_0x4554da,null))['then'](saveUpdates(_0x1746b0[_0xad52('0x44')],null))[_0xad52('0x1d')](respondWithResult(_0x4554da,null))[_0xad52('0x42')](handleError(_0x4554da,null));};exports[_0xad52('0x45')]=function(_0x12880f,_0x382b60){return db['VoiceMailMessage'][_0xad52('0x41')]({'where':{'id':_0x12880f[_0xad52('0x3e')]['id']}})[_0xad52('0x1d')](handleEntityNotFound(_0x382b60,null))[_0xad52('0x1d')](removeEntity(_0x382b60,null))['catch'](handleError(_0x382b60,null));};exports[_0xad52('0x46')]=function(_0x413338,_0x406a8f,_0x5a6ab3){return db[_0xad52('0x23')][_0xad52('0x41')]({'where':{'id':_0x413338[_0xad52('0x3e')]['id']},'attributes':['id',_0xad52('0x47'),'msg_id']})[_0xad52('0x1d')](handleEntityNotFound(_0x406a8f,null))[_0xad52('0x1d')](function(_0x15533a){if(_0x15533a){if(!_0x15533a[_0xad52('0x47')]){throw new db[(_0xad52('0x48'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x5d0cbb={'Content-Type':_0xad52('0x49'),'Content-Disposition':_0xad52('0x4a')};if(_0x15533a[_0xad52('0x4b')]){_0x5d0cbb[_0xad52('0x4c')]='attachment;\x20filename=\x22'+_0x15533a[_0xad52('0x4b')]+'.wav\x22';}_0x406a8f[_0xad52('0x18')](_0x5d0cbb);return _0x406a8f[_0xad52('0x20')](new Buffer(_0x15533a[_0xad52('0x47')]));}})['catch'](handleError(_0x406a8f,null));}; \ No newline at end of file +var _0x2504=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','name','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VoiceMailMessage','count','includeAll','include','findAll','catch','show','find','create','body','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','html-pdf','eml-format'];(function(_0x2bbb55,_0xf4e783){var _0x4fc50b=function(_0x21ae27){while(--_0x21ae27){_0x2bbb55['push'](_0x2bbb55['shift']());}};_0x4fc50b(++_0xf4e783);}(_0x2504,0xee));var _0x4250=function(_0x301a5b,_0x58d858){_0x301a5b=_0x301a5b-0x0;var _0x31f03e=_0x2504[_0x301a5b];return _0x31f03e;};'use strict';var pdf=require(_0x4250('0x0'));var emlformat=require(_0x4250('0x1'));var rimraf=require(_0x4250('0x2'));var zipdir=require(_0x4250('0x3'));var jsonpatch=require(_0x4250('0x4'));var rp=require(_0x4250('0x5'));var moment=require(_0x4250('0x6'));var BPromise=require(_0x4250('0x7'));var Mustache=require(_0x4250('0x8'));var util=require(_0x4250('0x9'));var path=require(_0x4250('0xa'));var sox=require(_0x4250('0xb'));var csv=require('to-csv');var ejs=require(_0x4250('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4250('0xd'));var jsforce=require(_0x4250('0xe'));var deskjs=require(_0x4250('0xf'));var toCsv=require(_0x4250('0x10'));var querystring=require(_0x4250('0x11'));var Papa=require('papaparse');var Redis=require(_0x4250('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4250('0x13'));var as=require(_0x4250('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4250('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4250('0x16'));var db=require(_0x4250('0x17'))['db'];function respondWithStatusCode(_0x208e8c,_0x3c1e7e){_0x3c1e7e=_0x3c1e7e||0xcc;return function(_0x2a496b){if(_0x2a496b){return _0x208e8c['sendStatus'](_0x3c1e7e);}return _0x208e8c[_0x4250('0x18')](_0x3c1e7e)[_0x4250('0x19')]();};}function respondWithResult(_0x25b79b,_0x2c8a75){_0x2c8a75=_0x2c8a75||0xc8;return function(_0xfa4d8a){if(_0xfa4d8a){return _0x25b79b[_0x4250('0x18')](_0x2c8a75)['json'](_0xfa4d8a);}};}function respondWithFilteredResult(_0x9aa450,_0x46ba15){return function(_0x1b0c66){if(_0x1b0c66){var _0x3cff02=_0x1b0c66['count'],_0x2979cd=_0x46ba15[_0x4250('0x1a')],_0x9907b4=_0x46ba15[_0x4250('0x1a')]+_0x46ba15[_0x4250('0x1b')],_0x3d9a6d;if(_0x9907b4>=_0x3cff02){_0x9907b4=_0x3cff02;_0x3d9a6d=0xc8;}else{_0x3d9a6d=0xce;}_0x9aa450[_0x4250('0x18')](_0x3d9a6d);return _0x9aa450[_0x4250('0x1c')](_0x4250('0x1d'),_0x2979cd+'-'+_0x9907b4+'/'+_0x3cff02)[_0x4250('0x1e')](_0x1b0c66);}return null;};}function patchUpdates(_0x508bc3){return function(_0x31d0fc){try{jsonpatch['apply'](_0x31d0fc,_0x508bc3,!![]);}catch(_0x5aa26e){return BPromise[_0x4250('0x1f')](_0x5aa26e);}return _0x31d0fc[_0x4250('0x20')]();};}function saveUpdates(_0x5b7e7f,_0x42c331){return function(_0x242cf1){if(_0x242cf1){return _0x242cf1[_0x4250('0x21')](_0x5b7e7f)[_0x4250('0x22')](function(_0x2985f8){return _0x2985f8;});}return null;};}function removeEntity(_0x309745,_0x3818c0){return function(_0x728862){if(_0x728862){return _0x728862[_0x4250('0x23')]()['then'](function(){_0x309745[_0x4250('0x18')](0xcc)[_0x4250('0x19')]();});}};}function handleEntityNotFound(_0x1feb98,_0x523053){return function(_0x5d1a74){if(!_0x5d1a74){_0x1feb98[_0x4250('0x24')](0x194);}return _0x5d1a74;};}function handleError(_0x91c0d6,_0x1c1294){_0x1c1294=_0x1c1294||0x1f4;return function(_0x3f8750){logger[_0x4250('0x25')](_0x3f8750['stack']);if(_0x3f8750[_0x4250('0x26')]){delete _0x3f8750[_0x4250('0x26')];}_0x91c0d6[_0x4250('0x18')](_0x1c1294)['send'](_0x3f8750);};}exports['index']=function(_0x2dcd72,_0x5d0fa2){var _0x3e8b4d={},_0x1c4fa5={},_0x105206={'count':0x0,'rows':[]};var _0x2cdfdf=_[_0x4250('0x27')](db['VoiceMailMessage'][_0x4250('0x28')],function(_0x11ca22){return{'name':_0x11ca22['fieldName'],'type':_0x11ca22[_0x4250('0x29')]['key']};});_0x1c4fa5[_0x4250('0x2a')]=_['differenceBy'](_['map'](_0x2cdfdf,_0x4250('0x26')),['name']);_0x1c4fa5[_0x4250('0x2b')]=_[_0x4250('0x2c')](_0x2dcd72['query']);_0x1c4fa5[_0x4250('0x2d')]=_[_0x4250('0x2e')](_0x1c4fa5['model'],_0x1c4fa5[_0x4250('0x2b')]);_0x3e8b4d[_0x4250('0x2f')]=_['intersection'](_0x1c4fa5[_0x4250('0x2a')],qs[_0x4250('0x30')](_0x2dcd72[_0x4250('0x2b')][_0x4250('0x30')]));_0x3e8b4d[_0x4250('0x2f')]=_0x3e8b4d[_0x4250('0x2f')][_0x4250('0x31')]?_0x3e8b4d[_0x4250('0x2f')]:_0x1c4fa5[_0x4250('0x2a')];if(!_0x2dcd72[_0x4250('0x2b')][_0x4250('0x32')](_0x4250('0x33'))){_0x3e8b4d[_0x4250('0x1b')]=qs['limit'](_0x2dcd72[_0x4250('0x2b')]['limit']);_0x3e8b4d[_0x4250('0x1a')]=qs[_0x4250('0x1a')](_0x2dcd72['query'][_0x4250('0x1a')]);}_0x3e8b4d[_0x4250('0x34')]=qs[_0x4250('0x35')](_0x2dcd72[_0x4250('0x2b')]['sort']);_0x3e8b4d['where']=qs['filters'](_[_0x4250('0x36')](_0x2dcd72[_0x4250('0x2b')],_0x1c4fa5['filters']),_0x2cdfdf);if(_0x2dcd72[_0x4250('0x2b')][_0x4250('0x37')]){_0x3e8b4d[_0x4250('0x38')]=_[_0x4250('0x39')](_0x3e8b4d[_0x4250('0x38')],{'$or':_['map'](_0x2cdfdf,function(_0x16f3f3){if(_0x16f3f3['type']!=='VIRTUAL'){var _0xb15c48={};_0xb15c48[_0x16f3f3['name']]={'$like':'%'+_0x2dcd72[_0x4250('0x2b')][_0x4250('0x37')]+'%'};return _0xb15c48;}})});}_0x3e8b4d=_[_0x4250('0x39')]({},_0x3e8b4d,_0x2dcd72['options']);var _0x344aa9={'where':_0x3e8b4d[_0x4250('0x38')]};return db[_0x4250('0x3a')][_0x4250('0x3b')](_0x344aa9)[_0x4250('0x22')](function(_0x4c98f0){_0x105206[_0x4250('0x3b')]=_0x4c98f0;if(_0x2dcd72[_0x4250('0x2b')][_0x4250('0x3c')]){_0x3e8b4d[_0x4250('0x3d')]=[{'all':!![]}];}return db[_0x4250('0x3a')][_0x4250('0x3e')](_0x3e8b4d);})['then'](function(_0x3a340a){_0x105206['rows']=_0x3a340a;return _0x105206;})[_0x4250('0x22')](respondWithFilteredResult(_0x5d0fa2,_0x3e8b4d))[_0x4250('0x3f')](handleError(_0x5d0fa2,null));};exports[_0x4250('0x40')]=function(_0x2a10b9,_0xbe81c0){var _0x363a13={'raw':!![],'where':{'id':_0x2a10b9['params']['id']}},_0x4f1b8c={};_0x4f1b8c['model']=_[_0x4250('0x2c')](db[_0x4250('0x3a')][_0x4250('0x28')]);_0x4f1b8c['query']=_[_0x4250('0x2c')](_0x2a10b9[_0x4250('0x2b')]);_0x4f1b8c[_0x4250('0x2d')]=_['intersection'](_0x4f1b8c[_0x4250('0x2a')],_0x4f1b8c[_0x4250('0x2b')]);_0x363a13[_0x4250('0x2f')]=_[_0x4250('0x2e')](_0x4f1b8c['model'],qs['fields'](_0x2a10b9[_0x4250('0x2b')][_0x4250('0x30')]));_0x363a13[_0x4250('0x2f')]=_0x363a13[_0x4250('0x2f')][_0x4250('0x31')]?_0x363a13['attributes']:_0x4f1b8c[_0x4250('0x2a')];if(_0x2a10b9['query'][_0x4250('0x3c')]){_0x363a13[_0x4250('0x3d')]=[{'all':!![]}];}_0x363a13=_[_0x4250('0x39')]({},_0x363a13,_0x2a10b9['options']);return db[_0x4250('0x3a')][_0x4250('0x41')](_0x363a13)[_0x4250('0x22')](handleEntityNotFound(_0xbe81c0,null))['then'](respondWithResult(_0xbe81c0,null))['catch'](handleError(_0xbe81c0,null));};exports['create']=function(_0x222070,_0x2edff0){return db[_0x4250('0x3a')][_0x4250('0x42')](_0x222070[_0x4250('0x43')],{})[_0x4250('0x22')](respondWithResult(_0x2edff0,0xc9))['catch'](handleError(_0x2edff0,null));};exports[_0x4250('0x21')]=function(_0x3bfe2e,_0x462b99){if(_0x3bfe2e['body']['id']){delete _0x3bfe2e[_0x4250('0x43')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x3bfe2e[_0x4250('0x44')]['id']}})[_0x4250('0x22')](handleEntityNotFound(_0x462b99,null))[_0x4250('0x22')](saveUpdates(_0x3bfe2e[_0x4250('0x43')],null))[_0x4250('0x22')](respondWithResult(_0x462b99,null))[_0x4250('0x3f')](handleError(_0x462b99,null));};exports['destroy']=function(_0x1d6fe7,_0x566664){return db[_0x4250('0x3a')][_0x4250('0x41')]({'where':{'id':_0x1d6fe7[_0x4250('0x44')]['id']}})['then'](handleEntityNotFound(_0x566664,null))[_0x4250('0x22')](removeEntity(_0x566664,null))[_0x4250('0x3f')](handleError(_0x566664,null));};exports['download']=function(_0x481e95,_0x495a0c,_0xffe341){return db['VoiceMailMessage']['find']({'where':{'id':_0x481e95[_0x4250('0x44')]['id']},'attributes':['id',_0x4250('0x45'),_0x4250('0x46')]})[_0x4250('0x22')](handleEntityNotFound(_0x495a0c,null))[_0x4250('0x22')](function(_0x49324b){if(_0x49324b){if(!_0x49324b[_0x4250('0x45')]){throw new db[(_0x4250('0x47'))][(_0x4250('0x48'))](_0x4250('0x49'));}var _0x5cd88c={'Content-Type':_0x4250('0x4a'),'Content-Disposition':_0x4250('0x4b')};if(_0x49324b['msg_id']){_0x5cd88c[_0x4250('0x4c')]=_0x4250('0x4d')+_0x49324b['msg_id']+_0x4250('0x4e');}_0x495a0c[_0x4250('0x1c')](_0x5cd88c);return _0x495a0c[_0x4250('0x4f')](new Buffer(_0x49324b[_0x4250('0x45')]));}})[_0x4250('0x3f')](handleError(_0x495a0c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 913c0fc..c641b4f 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 _0x7a40=['exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes'];(function(_0x4ef77b,_0x6a3df){var _0x58d1a6=function(_0x3b7e29){while(--_0x3b7e29){_0x4ef77b['push'](_0x4ef77b['shift']());}};_0x58d1a6(++_0x6a3df);}(_0x7a40,0x197));var _0x07a4=function(_0x14a283,_0x39964c){_0x14a283=_0x14a283-0x0;var _0x4db6a5=_0x7a40[_0x14a283];return _0x4db6a5;};'use strict';var _=require(_0x07a4('0x0'));var util=require(_0x07a4('0x1'));var logger=require(_0x07a4('0x2'))('api');var moment=require(_0x07a4('0x3'));var BPromise=require(_0x07a4('0x4'));var rp=require(_0x07a4('0x5'));var fs=require('fs');var path=require(_0x07a4('0x6'));var rimraf=require(_0x07a4('0x7'));var config=require('../../config/environment');var attributes=require(_0x07a4('0x8'));module[_0x07a4('0x9')]=function(_0x3a53fb,_0x399d0f){return _0x3a53fb[_0x07a4('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x07a4('0xb'),'paranoid':![],'indexes':[{'name':_0x07a4('0xc'),'fields':[_0x07a4('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc893=['dir','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x14ec75,_0x56a3d4){var _0x40b9e9=function(_0x4d2f39){while(--_0x4d2f39){_0x14ec75['push'](_0x14ec75['shift']());}};_0x40b9e9(++_0x56a3d4);}(_0xc893,0x194));var _0x3c89=function(_0x4bcc12,_0x5da7ea){_0x4bcc12=_0x4bcc12-0x0;var _0x511c1e=_0xc893[_0x4bcc12];return _0x511c1e;};'use strict';var _=require('lodash');var util=require(_0x3c89('0x0'));var logger=require(_0x3c89('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3c89('0x2'));var rp=require(_0x3c89('0x3'));var fs=require('fs');var path=require(_0x3c89('0x4'));var rimraf=require(_0x3c89('0x5'));var config=require(_0x3c89('0x6'));var attributes=require(_0x3c89('0x7'));module[_0x3c89('0x8')]=function(_0x5f2803,_0x2e156d){return _0x5f2803[_0x3c89('0x9')](_0x3c89('0xa'),attributes,{'tableName':_0x3c89('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x3c89('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a58a910..d4dd739 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(_0x3ddf73,_0x17fb51){var _0x5930e5=function(_0x41d4f9){while(--_0x41d4f9){_0x3ddf73['push'](_0x3ddf73['shift']());}};_0x5930e5(++_0x17fb51);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e7067,_0xf44954){_0x2e7067=_0x2e7067-0x0;var _0x45dfe0=_0x2ef3[_0x2e7067];return _0x45dfe0;};'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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x355e39,_0xc76ae3){var _0x263123=function(_0x4d5aee){while(--_0x4d5aee){_0x355e39['push'](_0x355e39['shift']());}};_0x263123(++_0xc76ae3);}(_0x2032,0xd9));var _0x2203=function(_0x208d50,_0x15cfe0){_0x208d50=_0x208d50-0x0;var _0x229053=_0x2032[_0x208d50];return _0x229053;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 6d715a0..f9fef3e 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 _0x1bc6=['post','create','addSound','update','destroy','delete','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds'];(function(_0x19ae88,_0xa7d7bf){var _0x397856=function(_0x55d1b3){while(--_0x55d1b3){_0x19ae88['push'](_0x19ae88['shift']());}};_0x397856(++_0xa7d7bf);}(_0x1bc6,0x1b8));var _0x61bc=function(_0x39d51c,_0x2a7da4){_0x39d51c=_0x39d51c-0x0;var _0x1419ca=_0x1bc6[_0x39d51c];return _0x1419ca;};'use strict';var multer=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var path=require(_0x61bc('0x2'));var timeout=require(_0x61bc('0x3'));var express=require(_0x61bc('0x4'));var router=express[_0x61bc('0x5')]();var auth=require(_0x61bc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x61bc('0x7'));var controller=require(_0x61bc('0x8'));router[_0x61bc('0x9')]('/',auth[_0x61bc('0xa')](),controller[_0x61bc('0xb')]);router['get'](_0x61bc('0xc'),auth['isAuthenticated'](),controller[_0x61bc('0xd')]);router[_0x61bc('0x9')](_0x61bc('0xe'),auth[_0x61bc('0xa')](),controller[_0x61bc('0xf')]);router[_0x61bc('0x10')]('/',auth[_0x61bc('0xa')](),controller[_0x61bc('0x11')]);router[_0x61bc('0x10')](_0x61bc('0xe'),auth[_0x61bc('0xa')](),controller[_0x61bc('0x12')]);router['put'](_0x61bc('0xc'),auth['isAuthenticated'](),controller[_0x61bc('0x13')]);router['delete'](_0x61bc('0xc'),auth[_0x61bc('0xa')](),controller[_0x61bc('0x14')]);router[_0x61bc('0x15')](_0x61bc('0x16'),auth[_0x61bc('0xa')](),controller['removeSound']);module[_0x61bc('0x17')]=router; \ No newline at end of file +var _0xe581=['index','/:id','show','/:id/sounds','getSounds','post','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0xe581,0xd5));var _0x1e58=function(_0x1c41e6,_0x52fca1){_0x1c41e6=_0x1c41e6-0x0;var _0x10995d=_0xe581[_0x1c41e6];return _0x10995d;};'use strict';var multer=require(_0x1e58('0x0'));var util=require(_0x1e58('0x1'));var path=require(_0x1e58('0x2'));var timeout=require(_0x1e58('0x3'));var express=require(_0x1e58('0x4'));var router=express[_0x1e58('0x5')]();var auth=require(_0x1e58('0x6'));var interaction=require(_0x1e58('0x7'));var config=require(_0x1e58('0x8'));var controller=require(_0x1e58('0x9'));router[_0x1e58('0xa')]('/',auth[_0x1e58('0xb')](),controller[_0x1e58('0xc')]);router[_0x1e58('0xa')](_0x1e58('0xd'),auth[_0x1e58('0xb')](),controller[_0x1e58('0xe')]);router[_0x1e58('0xa')](_0x1e58('0xf'),auth[_0x1e58('0xb')](),controller[_0x1e58('0x10')]);router[_0x1e58('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e58('0x11')](_0x1e58('0xf'),auth[_0x1e58('0xb')](),controller['addSound']);router[_0x1e58('0x12')](_0x1e58('0xd'),auth['isAuthenticated'](),controller[_0x1e58('0x13')]);router[_0x1e58('0x14')](_0x1e58('0xd'),auth[_0x1e58('0xb')](),controller[_0x1e58('0x15')]);router[_0x1e58('0x14')](_0x1e58('0x16'),auth[_0x1e58('0xb')](),controller[_0x1e58('0x17')]);module[_0x1e58('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4e9601e..870639f 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 _0x69f6=['name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x4b839d,_0x4c1a4a){var _0x1ac602=function(_0x3ee5c9){while(--_0x3ee5c9){_0x4b839d['push'](_0x4b839d['shift']());}};_0x1ac602(++_0x4c1a4a);}(_0x69f6,0xcd));var _0x669f=function(_0x31e489,_0x24a27a){_0x31e489=_0x31e489-0x0;var _0x133200=_0x69f6[_0x31e489];return _0x133200;};'use strict';var Sequelize=require(_0x669f('0x0'));module[_0x669f('0x1')]={'name':{'type':Sequelize[_0x669f('0x2')],'allowNull':![],'unique':_0x669f('0x3')},'mode':{'type':Sequelize[_0x669f('0x4')](_0x669f('0x5'),_0x669f('0x6'),_0x669f('0x7'),_0x669f('0x8'),_0x669f('0x9'),_0x669f('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x669f('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x669f('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x669f('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x669f('0x2')],'allowNull':!![]},'stamp':{'type':_0x669f('0xb')},'defaultEntry':{'type':Sequelize[_0x669f('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0881=['custom','files','mp3nb','STRING','alpha','TIMESTAMP','sequelize','exports','name'];(function(_0x58e7ed,_0xcc369f){var _0x282127=function(_0x199ce7){while(--_0x199ce7){_0x58e7ed['push'](_0x58e7ed['shift']());}};_0x282127(++_0xcc369f);}(_0x0881,0x9f));var _0x1088=function(_0x4186c3,_0x1c0521){_0x4186c3=_0x4186c3-0x0;var _0x23ff6c=_0x0881[_0x4186c3];return _0x23ff6c;};'use strict';var Sequelize=require(_0x1088('0x0'));module[_0x1088('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1088('0x2')},'mode':{'type':Sequelize['ENUM'](_0x1088('0x3'),_0x1088('0x4'),_0x1088('0x5'),'quietmp3nb','quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x1088('0x6')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x1088('0x6')],'allowNull':!![],'defaultValue':_0x1088('0x7')},'format':{'type':Sequelize[_0x1088('0x6')],'allowNull':!![]},'stamp':{'type':_0x1088('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index f5e3104..d5fc214 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 _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x1f0dce,_0x1d50a){var _0x1ae63a=function(_0x1c1e6a){while(--_0x1c1e6a){_0x1f0dce['push'](_0x1f0dce['shift']());}};_0x1ae63a(++_0x1d50a);}(_0xb10b,0x12a));var _0xbb10=function(_0x1fc82b,_0x5150a6){_0x1fc82b=_0x1fc82b-0x0;var _0x4c6679=_0xb10b[_0x1fc82b];return _0x4c6679;};'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'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,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(_0x23b5af,_0x1ef483){var _0x17726b=function(_0x5bdc8a){while(--_0x5bdc8a){_0x23b5af['push'](_0x23b5af['shift']());}};_0x17726b(++_0x1ef483);}(_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 7d8d181..7e55b84 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 _0x718a=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment'];(function(_0x54b730,_0x501ff7){var _0x444deb=function(_0x5cdffe){while(--_0x5cdffe){_0x54b730['push'](_0x54b730['shift']());}};_0x444deb(++_0x501ff7);}(_0x718a,0x7a));var _0xa718=function(_0x5e5123,_0x47bfeb){_0x5e5123=_0x5e5123-0x0;var _0x31c641=_0x718a[_0x5e5123];return _0x31c641;};'use strict';var _=require(_0xa718('0x0'));var util=require(_0xa718('0x1'));var logger=require(_0xa718('0x2'))('api');var moment=require(_0xa718('0x3'));var BPromise=require(_0xa718('0x4'));var rp=require(_0xa718('0x5'));var fs=require('fs');var path=require(_0xa718('0x6'));var rimraf=require(_0xa718('0x7'));var config=require(_0xa718('0x8'));var attributes=require(_0xa718('0x9'));module[_0xa718('0xa')]=function(_0x329dc1,_0x34aa62){return _0x329dc1[_0xa718('0xb')](_0xa718('0xc'),attributes,{'tableName':_0xa718('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dc7=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x8dc7,0xf7));var _0x78dc=function(_0x4c6619,_0x24303a){_0x4c6619=_0x4c6619-0x0;var _0x3a28b2=_0x8dc7[_0x4c6619];return _0x3a28b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x78dc('0x0'))(_0x78dc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x78dc('0x2'));var fs=require('fs');var path=require(_0x78dc('0x3'));var rimraf=require(_0x78dc('0x4'));var config=require(_0x78dc('0x5'));var attributes=require(_0x78dc('0x6'));module[_0x78dc('0x7')]=function(_0x325c87,_0x4e7131){return _0x325c87[_0x78dc('0x8')](_0x78dc('0x9'),attributes,{'tableName':_0x78dc('0xa'),'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 7cf72c4..e5917ce 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 _0xf449=['../../config/environment','jayson/promise','client','request','VoiceMusicOnHold,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','randomstring','ioredis','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf449,0x6b));var _0x9f44=function(_0x162f01,_0x5d03ca){_0x162f01=_0x162f01-0x0;var _0x38e64a=_0xf449[_0x162f01];return _0x38e64a;};'use strict';var _=require(_0x9f44('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f44('0x1'));var fs=require('fs');var Redis=require(_0x9f44('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f44('0x3'));var logger=require('../../config/logger')(_0x9f44('0x4'));var config=require(_0x9f44('0x5'));var jayson=require(_0x9f44('0x6'));var client=jayson[_0x9f44('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x121947,_0x15231a,_0xde2318){return new BPromise(function(_0x31fef8,_0x297126){return client[_0x9f44('0x8')](_0x121947,_0xde2318)['then'](function(_0x31bbb7){logger['info'](_0x9f44('0x9'),_0x15231a,'request\x20sent');logger[_0x9f44('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x15231a,_0x9f44('0xb'),JSON['stringify'](_0x31bbb7));if(_0x31bbb7[_0x9f44('0xc')]){if(_0x31bbb7[_0x9f44('0xc')][_0x9f44('0xd')]===0x1f4){logger[_0x9f44('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x15231a,_0x31bbb7[_0x9f44('0xc')][_0x9f44('0xe')]);return _0x297126(_0x31bbb7[_0x9f44('0xc')][_0x9f44('0xe')]);}logger[_0x9f44('0xc')](_0x9f44('0x9'),_0x15231a,_0x31bbb7[_0x9f44('0xc')]['message']);return _0x31fef8(_0x31bbb7[_0x9f44('0xc')]['message']);}else{logger['info'](_0x9f44('0x9'),_0x15231a,'request\x20sent');_0x31fef8(_0x31bbb7[_0x9f44('0xf')]['message']);}})['catch'](function(_0x4591bc){logger[_0x9f44('0xc')](_0x9f44('0x9'),_0x15231a,_0x4591bc);_0x297126(_0x4591bc);});});} \ No newline at end of file +var _0x748e=['VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x748e,0x77));var _0xe748=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x748e[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require('lodash');var util=require(_0xe748('0x0'));var moment=require('moment');var BPromise=require(_0xe748('0x1'));var rs=require(_0xe748('0x2'));var fs=require('fs');var Redis=require(_0xe748('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe748('0x4'));var logger=require('../../config/logger')(_0xe748('0x5'));var config=require(_0xe748('0x6'));var jayson=require(_0xe748('0x7'));var client=jayson['client'][_0xe748('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x267bcf,_0x4f09e7,_0x1ffd56){return new BPromise(function(_0x3f70a6,_0xdf2657){return client['request'](_0x267bcf,_0x1ffd56)[_0xe748('0x9')](function(_0x5d4c46){logger[_0xe748('0xa')](_0xe748('0xb'),_0x4f09e7,_0xe748('0xc'));logger[_0xe748('0xd')](_0xe748('0xe'),_0x4f09e7,_0xe748('0xc'),JSON[_0xe748('0xf')](_0x5d4c46));if(_0x5d4c46[_0xe748('0x10')]){if(_0x5d4c46[_0xe748('0x10')]['code']===0x1f4){logger[_0xe748('0x10')](_0xe748('0xb'),_0x4f09e7,_0x5d4c46['error']['message']);return _0xdf2657(_0x5d4c46[_0xe748('0x10')]['message']);}logger[_0xe748('0x10')](_0xe748('0xb'),_0x4f09e7,_0x5d4c46[_0xe748('0x10')]['message']);return _0x3f70a6(_0x5d4c46[_0xe748('0x10')][_0xe748('0x11')]);}else{logger[_0xe748('0xa')](_0xe748('0xb'),_0x4f09e7,_0xe748('0xc'));_0x3f70a6(_0x5d4c46['result'][_0xe748('0x11')]);}})[_0xe748('0x12')](function(_0x35656f){logger[_0xe748('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4f09e7,_0x35656f);_0xdf2657(_0x35656f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index ca6639e..50b5942 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 _0xa71c=['destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','/describe','describe','isAuthenticated','show','getAgents','create','post','/:id/users','addAgents','put','/:id','update','delete'];(function(_0x3132e8,_0x499a0e){var _0x43eb8c=function(_0x2321e1){while(--_0x2321e1){_0x3132e8['push'](_0x3132e8['shift']());}};_0x43eb8c(++_0x499a0e);}(_0xa71c,0x155));var _0xca71=function(_0x31d833,_0x9590c2){_0x31d833=_0x31d833-0x0;var _0x2927a2=_0xa71c[_0x31d833];return _0x2927a2;};'use strict';var multer=require(_0xca71('0x0'));var util=require(_0xca71('0x1'));var path=require(_0xca71('0x2'));var timeout=require(_0xca71('0x3'));var express=require('express');var router=express[_0xca71('0x4')]();var auth=require(_0xca71('0x5'));var interaction=require(_0xca71('0x6'));var config=require(_0xca71('0x7'));var controller=require(_0xca71('0x8'));router[_0xca71('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xca71('0x9')](_0xca71('0xa'),auth['isAuthenticated'](),controller[_0xca71('0xb')]);router[_0xca71('0x9')]('/:id',auth[_0xca71('0xc')](),controller[_0xca71('0xd')]);router[_0xca71('0x9')]('/:id/users',auth[_0xca71('0xc')](),controller[_0xca71('0xe')]);router['post']('/',auth[_0xca71('0xc')](),controller[_0xca71('0xf')]);router[_0xca71('0x10')](_0xca71('0x11'),auth['isAuthenticated'](),controller[_0xca71('0x12')]);router[_0xca71('0x13')](_0xca71('0x14'),auth[_0xca71('0xc')](),controller[_0xca71('0x15')]);router[_0xca71('0x16')](_0xca71('0x14'),auth[_0xca71('0xc')](),controller[_0xca71('0x17')]);router[_0xca71('0x16')](_0xca71('0x11'),auth[_0xca71('0xc')](),controller[_0xca71('0x18')]);module[_0xca71('0x19')]=router; \ No newline at end of file +var _0x44c0=['/:id','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe'];(function(_0x750842,_0x479757){var _0x5b162b=function(_0x5bbaaf){while(--_0x5bbaaf){_0x750842['push'](_0x750842['shift']());}};_0x5b162b(++_0x479757);}(_0x44c0,0x1a4));var _0x044c=function(_0x28c9b9,_0x5d6f79){_0x28c9b9=_0x28c9b9-0x0;var _0xb69ae0=_0x44c0[_0x28c9b9];return _0xb69ae0;};'use strict';var multer=require(_0x044c('0x0'));var util=require(_0x044c('0x1'));var path=require(_0x044c('0x2'));var timeout=require('connect-timeout');var express=require(_0x044c('0x3'));var router=express[_0x044c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x044c('0x5'));var config=require(_0x044c('0x6'));var controller=require(_0x044c('0x7'));router[_0x044c('0x8')]('/',auth[_0x044c('0x9')](),controller[_0x044c('0xa')]);router['get'](_0x044c('0xb'),auth[_0x044c('0x9')](),controller['describe']);router[_0x044c('0x8')](_0x044c('0xc'),auth[_0x044c('0x9')](),controller['show']);router[_0x044c('0x8')](_0x044c('0xd'),auth['isAuthenticated'](),controller[_0x044c('0xe')]);router[_0x044c('0xf')]('/',auth[_0x044c('0x9')](),controller[_0x044c('0x10')]);router[_0x044c('0xf')]('/:id/users',auth[_0x044c('0x9')](),controller[_0x044c('0x11')]);router[_0x044c('0x12')](_0x044c('0xc'),auth[_0x044c('0x9')](),controller[_0x044c('0x13')]);router['delete']('/:id',auth[_0x044c('0x9')](),controller[_0x044c('0x14')]);router[_0x044c('0x15')](_0x044c('0xd'),auth[_0x044c('0x9')](),controller[_0x044c('0x16')]);module[_0x044c('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 4a4ab92..69e5c83 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 _0x4cc9=['sequelize','STRING','VIRTUAL','system-','getDataValue','name','INTEGER'];(function(_0x4d3e08,_0x535f74){var _0x3d256d=function(_0x4b09a2){while(--_0x4b09a2){_0x4d3e08['push'](_0x4d3e08['shift']());}};_0x3d256d(++_0x535f74);}(_0x4cc9,0x173));var _0x94cc=function(_0xae8b55,_0x228972){_0xae8b55=_0xae8b55-0x0;var _0x14e982=_0x4cc9[_0xae8b55];return _0x14e982;};'use strict';var Sequelize=require(_0x94cc('0x0'));module['exports']={'name':{'type':Sequelize[_0x94cc('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x94cc('0x2')],'get':function(_0x44fbff){return _0x94cc('0x3')+this[_0x94cc('0x4')](_0x94cc('0x5'))+'-';}},'description':{'type':Sequelize[_0x94cc('0x1')]},'callerIdAll':{'type':Sequelize[_0x94cc('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x94cc('0x6')]}}; \ No newline at end of file +var _0x0502=['getDataValue','name','INTEGER','sequelize','exports','STRING','VIRTUAL','system-'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x0502,0x1eb));var _0x2050=function(_0xc82d98,_0x7487b5){_0xc82d98=_0xc82d98-0x0;var _0x1cfdc4=_0x0502[_0xc82d98];return _0x1cfdc4;};'use strict';var Sequelize=require(_0x2050('0x0'));module[_0x2050('0x1')]={'name':{'type':Sequelize[_0x2050('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x2050('0x3')],'get':function(_0x21869a){return _0x2050('0x4')+this[_0x2050('0x5')](_0x2050('0x6'))+'-';}},'description':{'type':Sequelize[_0x2050('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x2050('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 1ed9218..1c868d9 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 _0x2ce2=['CDR(prefix)=','Set','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','body','system-','addAgents','ids','omit','spread','emit','userVoicePrefix:save','userVoicePrefix:remove','getAgents','findOne','User','nolimit','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','localhost','./voicePrefix.socket','sendStatus','status','json','count','offset','limit','set','apply','reject','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','map','VoicePrefix','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','options','includeAll','include','findAll','rows','catch','params','merge','find','describe','create','sequelize','transaction','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','NoOp','VoicePrefixId','VoiceExtensionId','Extensions\x20creation\x20failed','prefix','push'];(function(_0x510a15,_0x10679b){var _0x283f38=function(_0x19079f){while(--_0x19079f){_0x510a15['push'](_0x510a15['shift']());}};_0x283f38(++_0x10679b);}(_0x2ce2,0xfd));var _0x22ce=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x2ce2[_0x340380];return _0x49ce1c;};'use strict';var pdf=require(_0x22ce('0x0'));var emlformat=require(_0x22ce('0x1'));var rimraf=require(_0x22ce('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22ce('0x3'));var rp=require(_0x22ce('0x4'));var moment=require(_0x22ce('0x5'));var BPromise=require(_0x22ce('0x6'));var Mustache=require(_0x22ce('0x7'));var util=require('util');var path=require(_0x22ce('0x8'));var sox=require(_0x22ce('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x22ce('0xa'));var squel=require(_0x22ce('0xb'));var crypto=require(_0x22ce('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x22ce('0xd'));var toCsv=require(_0x22ce('0xe'));var querystring=require('querystring');var Papa=require(_0x22ce('0xf'));var Redis=require(_0x22ce('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x22ce('0x11'));var as=require(_0x22ce('0x12'));var hardwareService=require(_0x22ce('0x13'));var logger=require(_0x22ce('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x22ce('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x22ce('0x16')],{'host':_0x22ce('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x22ce('0x16')]));require(_0x22ce('0x18'))['register'](socket);function respondWithStatusCode(_0x10ada1,_0x2b7f40){_0x2b7f40=_0x2b7f40||0xcc;return function(_0x24129e){if(_0x24129e){return _0x10ada1[_0x22ce('0x19')](_0x2b7f40);}return _0x10ada1['status'](_0x2b7f40)['end']();};}function respondWithResult(_0x498a66,_0x3077e7){_0x3077e7=_0x3077e7||0xc8;return function(_0x2710fd){if(_0x2710fd){return _0x498a66[_0x22ce('0x1a')](_0x3077e7)[_0x22ce('0x1b')](_0x2710fd);}};}function respondWithFilteredResult(_0x31b053,_0x43ebfc){return function(_0x147b3f){if(_0x147b3f){var _0x10a1e6=_0x147b3f[_0x22ce('0x1c')],_0x22492e=_0x43ebfc[_0x22ce('0x1d')],_0x235c27=_0x43ebfc[_0x22ce('0x1d')]+_0x43ebfc[_0x22ce('0x1e')],_0x3cbacc;if(_0x235c27>=_0x10a1e6){_0x235c27=_0x10a1e6;_0x3cbacc=0xc8;}else{_0x3cbacc=0xce;}_0x31b053[_0x22ce('0x1a')](_0x3cbacc);return _0x31b053[_0x22ce('0x1f')]('Content-Range',_0x22492e+'-'+_0x235c27+'/'+_0x10a1e6)[_0x22ce('0x1b')](_0x147b3f);}return null;};}function patchUpdates(_0x484c03){return function(_0x521e4d){try{jsonpatch[_0x22ce('0x20')](_0x521e4d,_0x484c03,!![]);}catch(_0x2691d0){return BPromise[_0x22ce('0x21')](_0x2691d0);}return _0x521e4d['save']();};}function saveUpdates(_0x4818ab,_0x208af0){return function(_0x2cdb2a){if(_0x2cdb2a){return _0x2cdb2a['update'](_0x4818ab)[_0x22ce('0x22')](function(_0x52e735){return _0x52e735;});}return null;};}function removeEntity(_0x479921,_0x547bf8){return function(_0x91833d){if(_0x91833d){return _0x91833d[_0x22ce('0x23')]()[_0x22ce('0x22')](function(){var _0x25e196=_0x91833d[_0x22ce('0x24')]({'plain':!![]});var _0x4fad41=_0x22ce('0x25');return db[_0x22ce('0x26')]['destroy']({'where':{'type':_0x4fad41,'resourceId':_0x25e196['id']}})['then'](function(){return _0x91833d;});})[_0x22ce('0x22')](function(){_0x479921['status'](0xcc)[_0x22ce('0x27')]();});}};}function handleEntityNotFound(_0x454a63,_0xa8e5c3){return function(_0x5c24d6){if(!_0x5c24d6){_0x454a63[_0x22ce('0x19')](0x194);}return _0x5c24d6;};}function handleError(_0x32db96,_0x3797d6){_0x3797d6=_0x3797d6||0x1f4;return function(_0xc1d94f){logger[_0x22ce('0x28')](_0xc1d94f[_0x22ce('0x29')]);if(_0xc1d94f[_0x22ce('0x2a')]){delete _0xc1d94f['name'];}_0x32db96['status'](_0x3797d6)['send'](_0xc1d94f);};}exports['index']=function(_0x4792b7,_0xfb84b3){var _0xfe7520={},_0x4883a6={},_0x8fb91f={'count':0x0,'rows':[]};var _0x2b3f2b=_[_0x22ce('0x2b')](db[_0x22ce('0x2c')][_0x22ce('0x2d')],function(_0xce4709){return{'name':_0xce4709['fieldName'],'type':_0xce4709[_0x22ce('0x2e')][_0x22ce('0x2f')]};});_0x4883a6[_0x22ce('0x30')]=_[_0x22ce('0x2b')](_0x2b3f2b,'name');_0x4883a6[_0x22ce('0x31')]=_[_0x22ce('0x32')](_0x4792b7[_0x22ce('0x31')]);_0x4883a6[_0x22ce('0x33')]=_[_0x22ce('0x34')](_0x4883a6['model'],_0x4883a6[_0x22ce('0x31')]);_0xfe7520[_0x22ce('0x35')]=_[_0x22ce('0x34')](_0x4883a6['model'],qs['fields'](_0x4792b7[_0x22ce('0x31')][_0x22ce('0x36')]));_0xfe7520[_0x22ce('0x35')]=_0xfe7520['attributes'][_0x22ce('0x37')]?_0xfe7520[_0x22ce('0x35')]:_0x4883a6['model'];if(!_0x4792b7[_0x22ce('0x31')][_0x22ce('0x38')]('nolimit')){_0xfe7520[_0x22ce('0x1e')]=qs[_0x22ce('0x1e')](_0x4792b7[_0x22ce('0x31')][_0x22ce('0x1e')]);_0xfe7520[_0x22ce('0x1d')]=qs[_0x22ce('0x1d')](_0x4792b7['query'][_0x22ce('0x1d')]);}_0xfe7520[_0x22ce('0x39')]=qs[_0x22ce('0x3a')](_0x4792b7[_0x22ce('0x31')][_0x22ce('0x3a')]);_0xfe7520[_0x22ce('0x3b')]=qs[_0x22ce('0x33')](_['pick'](_0x4792b7[_0x22ce('0x31')],_0x4883a6['filters']),_0x2b3f2b);if(_0x4792b7[_0x22ce('0x31')][_0x22ce('0x3c')]){_0xfe7520[_0x22ce('0x3b')]=_['merge'](_0xfe7520['where'],{'$or':_[_0x22ce('0x2b')](_0x2b3f2b,function(_0x2579e9){if(_0x2579e9[_0x22ce('0x2e')]!=='VIRTUAL'){var _0x5a0ac5={};_0x5a0ac5[_0x2579e9[_0x22ce('0x2a')]]={'$like':'%'+_0x4792b7[_0x22ce('0x31')][_0x22ce('0x3c')]+'%'};return _0x5a0ac5;}})});}_0xfe7520=_['merge']({},_0xfe7520,_0x4792b7[_0x22ce('0x3d')]);var _0x5ed743={'where':_0xfe7520[_0x22ce('0x3b')]};return db[_0x22ce('0x2c')][_0x22ce('0x1c')](_0x5ed743)[_0x22ce('0x22')](function(_0xab3f65){_0x8fb91f['count']=_0xab3f65;if(_0x4792b7[_0x22ce('0x31')][_0x22ce('0x3e')]){_0xfe7520[_0x22ce('0x3f')]=[{'all':!![]}];}return db[_0x22ce('0x2c')][_0x22ce('0x40')](_0xfe7520);})[_0x22ce('0x22')](function(_0x2200e2){_0x8fb91f[_0x22ce('0x41')]=_0x2200e2;return _0x8fb91f;})[_0x22ce('0x22')](respondWithFilteredResult(_0xfb84b3,_0xfe7520))[_0x22ce('0x42')](handleError(_0xfb84b3,null));};exports['show']=function(_0x3f545c,_0x3bdf2a){var _0x4bdaba={'raw':![],'where':{'id':_0x3f545c[_0x22ce('0x43')]['id']}},_0x4d7ead={};_0x4d7ead['model']=_[_0x22ce('0x32')](db['VoicePrefix'][_0x22ce('0x2d')]);_0x4d7ead[_0x22ce('0x31')]=_['keys'](_0x3f545c[_0x22ce('0x31')]);_0x4d7ead[_0x22ce('0x33')]=_[_0x22ce('0x34')](_0x4d7ead[_0x22ce('0x30')],_0x4d7ead['query']);_0x4bdaba[_0x22ce('0x35')]=_[_0x22ce('0x34')](_0x4d7ead[_0x22ce('0x30')],qs[_0x22ce('0x36')](_0x3f545c[_0x22ce('0x31')][_0x22ce('0x36')]));_0x4bdaba[_0x22ce('0x35')]=_0x4bdaba[_0x22ce('0x35')]['length']?_0x4bdaba[_0x22ce('0x35')]:_0x4d7ead[_0x22ce('0x30')];if(_0x3f545c[_0x22ce('0x31')][_0x22ce('0x3e')]){_0x4bdaba[_0x22ce('0x3f')]=[{'all':!![]}];}_0x4bdaba=_[_0x22ce('0x44')]({},_0x4bdaba,_0x3f545c[_0x22ce('0x3d')]);return db[_0x22ce('0x2c')][_0x22ce('0x45')](_0x4bdaba)[_0x22ce('0x22')](handleEntityNotFound(_0x3bdf2a,null))['then'](respondWithResult(_0x3bdf2a,null))['catch'](handleError(_0x3bdf2a,null));};exports[_0x22ce('0x23')]=function(_0x606a79,_0x375d9e){return db[_0x22ce('0x2c')][_0x22ce('0x45')]({'where':{'id':_0x606a79[_0x22ce('0x43')]['id']}})['then'](handleEntityNotFound(_0x375d9e,null))[_0x22ce('0x22')](removeEntity(_0x375d9e,null))[_0x22ce('0x42')](handleError(_0x375d9e,null));};exports[_0x22ce('0x46')]=function(_0x27f4d3,_0x164a6b){return db[_0x22ce('0x2c')][_0x22ce('0x46')]()[_0x22ce('0x22')](respondWithResult(_0x164a6b,null))[_0x22ce('0x42')](handleError(_0x164a6b,null));};exports[_0x22ce('0x47')]=function(_0x4a8877,_0x5dee63){var _0xbcf728;return db[_0x22ce('0x48')][_0x22ce('0x49')](function(_0x83224c){return db[_0x22ce('0x2c')]['create'](_0x4a8877['body'],{'transaction':_0x83224c})['then'](function(_0x158078){_0xbcf728=_0x158078[_0x22ce('0x24')]({'plain':!![]});return db[_0x22ce('0x4a')][_0x22ce('0x45')]({'where':{'id':_0xbcf728['VoiceExtensionId']},'raw':!![]})['then'](function(_0x4f8662){return createVoicePrefixExtensions(_0xbcf728,_0x4f8662,_0x83224c);});});})[_0x22ce('0x22')](function(){var _0x56d22e=_0x4a8877[_0x22ce('0x4b')]['get']({'plain':!![]});if(!_0x56d22e)throw new Error(_0x22ce('0x4c'));if(_0x56d22e[_0x22ce('0x4d')]===_0x22ce('0x4b')){var _0x5b07fc=_0xbcf728;return db[_0x22ce('0x4e')][_0x22ce('0x45')]({'where':{'name':_0x22ce('0x25'),'userProfileId':_0x56d22e[_0x22ce('0x4f')]},'raw':!![]})[_0x22ce('0x22')](function(_0x16af46){if(_0x16af46&&_0x16af46[_0x22ce('0x50')]===0x0){return db[_0x22ce('0x26')][_0x22ce('0x47')]({'name':_0x5b07fc[_0x22ce('0x2a')],'resourceId':_0x5b07fc['id'],'type':_0x16af46[_0x22ce('0x2a')],'sectionId':_0x16af46['id']},{})['then'](function(){return _0xbcf728;});}else{return _0xbcf728;}})[_0x22ce('0x42')](function(_0x218411){logger[_0x22ce('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x218411);throw _0x218411;});}return _0xbcf728;})[_0x22ce('0x22')](respondWithResult(_0x5dee63,null))[_0x22ce('0x42')](handleError(_0x5dee63,null));};function Extension(_0x190f61,_0x30f0f4,_0x2e8caa,_0x2a58a2){this[_0x22ce('0x51')]=_0x22ce('0x52');this[_0x22ce('0x53')]=_0x190f61;this[_0x22ce('0x54')]=_0x2e8caa;this[_0x22ce('0x2e')]=_0x22ce('0x55');this[_0x22ce('0x56')]=_0x22ce('0x57');this['priority']=_0x30f0f4;this[_0x22ce('0x58')]=_0x2a58a2;}function createVoicePrefixExtensions(_0x5487b3,_0x2e8ac3,_0x590beb){return new BPromise(function(_0x77884f,_0x2f7723){var _0x4206ce=new Extension(formatPrefixName(_0x5487b3['prefix']),0x1,_0x22ce('0x59'),'Voice\x20Prefix');_0x4206ce[_0x22ce('0x5a')]=_0x5487b3['id'];return db['VoiceExtension'][_0x22ce('0x47')](_0x4206ce,{'transaction':_0x590beb})[_0x22ce('0x22')](function(_0x169495){var _0x474a3b=_0x169495[_0x22ce('0x24')]({'plain':!![]});var _0x809c05=_[_0x22ce('0x2b')](addVoicePrefixExtensions(_0x5487b3,_0x2e8ac3),function(_0x23e576){_0x23e576[_0x22ce('0x5b')]=_0x474a3b['id'];_0x23e576[_0x22ce('0x5a')]=_0x5487b3['id'];return _0x23e576;});return db[_0x22ce('0x4a')]['bulkCreate'](_0x809c05,{'transaction':_0x590beb})[_0x22ce('0x22')](function(_0x2f759d){if(!_0x2f759d){return _0x2f7723(_0x22ce('0x5c'));}else{return _0x77884f(_0x2f759d);}})[_0x22ce('0x42')](function(_0x1bc23d){return _0x2f7723(_0x1bc23d);});});;});};function addVoicePrefixExtensions(_0x314d33,_0xfdd7c4){var _0xd720b8=[];var _0x4fd80c=formatPrefixName(_0x314d33[_0x22ce('0x5d')]);_0xd720b8[_0x22ce('0x5e')](new Extension(_0x4fd80c,0x2,'Set',_0x22ce('0x5f')+_0x314d33[_0x22ce('0x2a')]));if(_0x314d33['callerIdAll']){_0xd720b8[_0x22ce('0x5e')](new Extension(_0x4fd80c,0x3,_0x22ce('0x60'),'PREFIX-CALLERIDALL='+_0x314d33[_0x22ce('0x61')]));}else{_0xd720b8[_0x22ce('0x5e')](new Extension(_0x4fd80c,0x3,_0x22ce('0x59'),_0x22ce('0x62')));}_0xd720b8[_0x22ce('0x5e')](new Extension(_0x4fd80c,0x4,_0x22ce('0x63'),_0xfdd7c4[_0x22ce('0x51')]+','+_0x22ce('0x64')+(0x8+_0x314d33['name']['length'])+'}'+','+0x1));return _0xd720b8;}function formatPrefixName(_0x45a80a){var _0x306991='_';for(var _0x3eb91f=0x0;_0x3eb91f<_0x45a80a[_0x22ce('0x37')];_0x3eb91f++){if(_0x45a80a[_0x22ce('0x65')](_0x3eb91f)=='-'){_0x306991+=_0x45a80a[_0x22ce('0x65')](_0x3eb91f);}else{_0x306991+='['+_0x45a80a[_0x22ce('0x65')](_0x3eb91f)+']';}}_0x306991+='.';return _0x306991;}exports[_0x22ce('0x66')]=function(_0x127ca7,_0x19f9da,_0x31f56f){var _0x1155ef=_0x127ca7[_0x22ce('0x67')];_0x1155ef['prefix']=_0x22ce('0x68')+_0x1155ef[_0x22ce('0x2a')]+'-';return db[_0x22ce('0x48')][_0x22ce('0x49')](function(_0x296247){return db['VoicePrefix']['update'](_0x1155ef,{'where':{'id':_0x1155ef['id']},'transaction':_0x296247})[_0x22ce('0x22')](function(){return db[_0x22ce('0x4a')]['destroy']({'where':{'VoicePrefixId':_0x1155ef['id']},'transaction':_0x296247})[_0x22ce('0x22')](function(){return db[_0x22ce('0x4a')][_0x22ce('0x45')]({'where':{'id':_0x1155ef[_0x22ce('0x5b')]},'raw':!![]})[_0x22ce('0x22')](function(_0x52ebe5){return createVoicePrefixExtensions(_0x1155ef,_0x52ebe5,_0x296247);});});});})[_0x22ce('0x22')](function(){return db[_0x22ce('0x2c')]['findById'](_0x1155ef['id']);})['then'](respondWithResult(_0x19f9da,null))[_0x22ce('0x42')](handleError(_0x19f9da,null));};exports[_0x22ce('0x69')]=function(_0x31d6f7,_0x1b68f9,_0x569e72){return db['VoicePrefix'][_0x22ce('0x45')]({'where':{'id':_0x31d6f7[_0x22ce('0x43')]['id']}})[_0x22ce('0x22')](handleEntityNotFound(_0x1b68f9,null))[_0x22ce('0x22')](function(_0x46aff9){if(_0x46aff9){return _0x46aff9['addAgents'](_0x31d6f7['body'][_0x22ce('0x6a')],_[_0x22ce('0x6b')](_0x31d6f7[_0x22ce('0x67')],[_0x22ce('0x6a'),'id'])||{})[_0x22ce('0x6c')](function(_0x27d7af){for(var _0x1a2eb1=0x0;_0x1a2eb1<_0x31d6f7[_0x22ce('0x67')]['ids'][_0x22ce('0x37')];_0x1a2eb1+=0x1){socket[_0x22ce('0x6d')](_0x22ce('0x6e'),{'UserId':_0x31d6f7[_0x22ce('0x67')][_0x22ce('0x6a')][_0x1a2eb1],'VoicePrefixId':_0x31d6f7[_0x22ce('0x43')]['id']});}return _0x27d7af;});}})[_0x22ce('0x22')](respondWithResult(_0x1b68f9,null))['catch'](handleError(_0x1b68f9,null));};exports['removeAgents']=function(_0x1488fa,_0x45ff05,_0x76ac33){return db[_0x22ce('0x2c')]['find']({'where':{'id':_0x1488fa['params']['id']}})[_0x22ce('0x22')](handleEntityNotFound(_0x45ff05,null))[_0x22ce('0x22')](function(_0x477e0f){if(_0x477e0f){return _0x477e0f['removeAgents'](_0x1488fa[_0x22ce('0x31')]['ids'])[_0x22ce('0x22')](function(){if(_['isArray'](_0x1488fa['query'][_0x22ce('0x6a')])){for(var _0x5a6716=0x0;_0x5a6716<_0x1488fa[_0x22ce('0x31')][_0x22ce('0x6a')][_0x22ce('0x37')];_0x5a6716+=0x1){socket['emit'](_0x22ce('0x6f'),{'UserId':Number(_0x1488fa['query'][_0x22ce('0x6a')][_0x5a6716]),'VoicePrefixId':Number(_0x1488fa[_0x22ce('0x43')]['id'])});}}else{socket[_0x22ce('0x6d')](_0x22ce('0x6f'),{'UserId':Number(_0x1488fa[_0x22ce('0x31')][_0x22ce('0x6a')]),'VoicePrefixId':Number(_0x1488fa['params']['id'])});}});}})[_0x22ce('0x22')](respondWithStatusCode(_0x45ff05,null))[_0x22ce('0x42')](handleError(_0x45ff05,null));};exports[_0x22ce('0x70')]=function(_0xd02191,_0x2f92fb,_0x3f72c5){var _0x273215={};var _0x1e58f6={};var _0xdb0e2b;var _0x5516e5;return db[_0x22ce('0x2c')][_0x22ce('0x71')]({'where':{'id':_0xd02191[_0x22ce('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f92fb,null))[_0x22ce('0x22')](function(_0x2d14a2){if(_0x2d14a2){_0xdb0e2b=_0x2d14a2;_0x1e58f6[_0x22ce('0x30')]=_[_0x22ce('0x32')](db[_0x22ce('0x72')]['rawAttributes']);_0x1e58f6[_0x22ce('0x31')]=_[_0x22ce('0x32')](_0xd02191['query']);_0x1e58f6[_0x22ce('0x33')]=_[_0x22ce('0x34')](_0x1e58f6[_0x22ce('0x30')],_0x1e58f6[_0x22ce('0x31')]);_0x273215[_0x22ce('0x35')]=_[_0x22ce('0x34')](_0x1e58f6['model'],qs[_0x22ce('0x36')](_0xd02191['query'][_0x22ce('0x36')]));_0x273215[_0x22ce('0x35')]=_0x273215[_0x22ce('0x35')][_0x22ce('0x37')]?_0x273215[_0x22ce('0x35')]:_0x1e58f6[_0x22ce('0x30')];_0x273215[_0x22ce('0x39')]=qs['sort'](_0xd02191[_0x22ce('0x31')][_0x22ce('0x3a')]);_0x273215['where']=qs[_0x22ce('0x33')](_['pick'](_0xd02191['query'],_0x1e58f6['filters']));if(_0xd02191[_0x22ce('0x31')]['filter']){_0x273215[_0x22ce('0x3b')]=_['merge'](_0x273215[_0x22ce('0x3b')],{'$or':_[_0x22ce('0x2b')](_0x273215[_0x22ce('0x35')],function(_0x6a8642){var _0x393bf2={};_0x393bf2[_0x6a8642]={'$like':'%'+_0xd02191[_0x22ce('0x31')][_0x22ce('0x3c')]+'%'};return _0x393bf2;})});}_0x273215=_['merge']({},_0x273215,_0xd02191[_0x22ce('0x3d')]);return _0xdb0e2b[_0x22ce('0x70')](_0x273215);}})[_0x22ce('0x22')](function(_0x5ead78){if(_0x5ead78){_0x5516e5=_0x5ead78[_0x22ce('0x37')];if(!_0xd02191[_0x22ce('0x31')][_0x22ce('0x38')](_0x22ce('0x73'))){_0x273215[_0x22ce('0x1e')]=qs[_0x22ce('0x1e')](_0xd02191[_0x22ce('0x31')][_0x22ce('0x1e')]);_0x273215['offset']=qs['offset'](_0xd02191[_0x22ce('0x31')][_0x22ce('0x1d')]);}return _0xdb0e2b[_0x22ce('0x70')](_0x273215);}})[_0x22ce('0x22')](function(_0x7903d){if(_0x7903d){return _0x7903d?{'count':_0x5516e5,'rows':_0x7903d}:null;}})['then'](respondWithResult(_0x2f92fb,null))[_0x22ce('0x42')](handleError(_0x2f92fb,null));}; \ No newline at end of file +var _0xf0d1=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','get','destroy','error','stack','send','index','VoicePrefix','rawAttributes','fieldName','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','find','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','role','UserProfileSection','VoicePrefixes','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','description','priority','appdata','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','nolimit','eml-format'];(function(_0xefd0a,_0x23217f){var _0x177326=function(_0xd5cb86){while(--_0xd5cb86){_0xefd0a['push'](_0xefd0a['shift']());}};_0x177326(++_0x23217f);}(_0xf0d1,0x170));var _0x1f0d=function(_0x24b897,_0x38df26){_0x24b897=_0x24b897-0x0;var _0x522698=_0xf0d1[_0x24b897];return _0x522698;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1f0d('0x0'));var rimraf=require(_0x1f0d('0x1'));var zipdir=require(_0x1f0d('0x2'));var jsonpatch=require(_0x1f0d('0x3'));var rp=require(_0x1f0d('0x4'));var moment=require('moment');var BPromise=require(_0x1f0d('0x5'));var Mustache=require(_0x1f0d('0x6'));var util=require(_0x1f0d('0x7'));var path=require(_0x1f0d('0x8'));var sox=require('sox');var csv=require(_0x1f0d('0x9'));var ejs=require(_0x1f0d('0xa'));var fs=require('fs');var _=require(_0x1f0d('0xb'));var squel=require(_0x1f0d('0xc'));var crypto=require(_0x1f0d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f0d('0xe'));var toCsv=require(_0x1f0d('0x9'));var querystring=require(_0x1f0d('0xf'));var Papa=require(_0x1f0d('0x10'));var Redis=require('ioredis');var authService=require(_0x1f0d('0x11'));var qs=require(_0x1f0d('0x12'));var as=require(_0x1f0d('0x13'));var hardwareService=require(_0x1f0d('0x14'));var logger=require(_0x1f0d('0x15'))(_0x1f0d('0x16'));var utils=require('../../config/utils');var config=require(_0x1f0d('0x17'));var db=require('../../mysqldb')['db'];config[_0x1f0d('0x18')]=_[_0x1f0d('0x19')](config['redis'],{'host':_0x1f0d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f0d('0x18')]));require(_0x1f0d('0x1b'))[_0x1f0d('0x1c')](socket);function respondWithStatusCode(_0x3c52aa,_0x3542c6){_0x3542c6=_0x3542c6||0xcc;return function(_0x3350c4){if(_0x3350c4){return _0x3c52aa[_0x1f0d('0x1d')](_0x3542c6);}return _0x3c52aa[_0x1f0d('0x1e')](_0x3542c6)[_0x1f0d('0x1f')]();};}function respondWithResult(_0x36e69b,_0x48582f){_0x48582f=_0x48582f||0xc8;return function(_0x4f4a4b){if(_0x4f4a4b){return _0x36e69b[_0x1f0d('0x1e')](_0x48582f)[_0x1f0d('0x20')](_0x4f4a4b);}};}function respondWithFilteredResult(_0x360656,_0x2d61e2){return function(_0x3083b3){if(_0x3083b3){var _0x41e869=_0x3083b3[_0x1f0d('0x21')],_0x2adad0=_0x2d61e2[_0x1f0d('0x22')],_0x27f58c=_0x2d61e2['offset']+_0x2d61e2[_0x1f0d('0x23')],_0x4678e5;if(_0x27f58c>=_0x41e869){_0x27f58c=_0x41e869;_0x4678e5=0xc8;}else{_0x4678e5=0xce;}_0x360656[_0x1f0d('0x1e')](_0x4678e5);return _0x360656[_0x1f0d('0x24')]('Content-Range',_0x2adad0+'-'+_0x27f58c+'/'+_0x41e869)[_0x1f0d('0x20')](_0x3083b3);}return null;};}function patchUpdates(_0x17547e){return function(_0x19e6aa){try{jsonpatch['apply'](_0x19e6aa,_0x17547e,!![]);}catch(_0x3d99db){return BPromise[_0x1f0d('0x25')](_0x3d99db);}return _0x19e6aa[_0x1f0d('0x26')]();};}function saveUpdates(_0x483a7a,_0x46e831){return function(_0x267861){if(_0x267861){return _0x267861[_0x1f0d('0x27')](_0x483a7a)[_0x1f0d('0x28')](function(_0x48bee6){return _0x48bee6;});}return null;};}function removeEntity(_0x530c16,_0x2d578a){return function(_0x320f6e){if(_0x320f6e){return _0x320f6e['destroy']()['then'](function(){var _0x5b835b=_0x320f6e[_0x1f0d('0x29')]({'plain':!![]});var _0x31a191='VoicePrefixes';return db['UserProfileResource'][_0x1f0d('0x2a')]({'where':{'type':_0x31a191,'resourceId':_0x5b835b['id']}})[_0x1f0d('0x28')](function(){return _0x320f6e;});})[_0x1f0d('0x28')](function(){_0x530c16[_0x1f0d('0x1e')](0xcc)[_0x1f0d('0x1f')]();});}};}function handleEntityNotFound(_0x25fe07,_0x2fcc41){return function(_0x5d3d51){if(!_0x5d3d51){_0x25fe07[_0x1f0d('0x1d')](0x194);}return _0x5d3d51;};}function handleError(_0x47ef12,_0xe06a19){_0xe06a19=_0xe06a19||0x1f4;return function(_0x390ec0){logger[_0x1f0d('0x2b')](_0x390ec0[_0x1f0d('0x2c')]);if(_0x390ec0['name']){delete _0x390ec0['name'];}_0x47ef12[_0x1f0d('0x1e')](_0xe06a19)[_0x1f0d('0x2d')](_0x390ec0);};}exports[_0x1f0d('0x2e')]=function(_0x3d1738,_0x25f4c3){var _0x2c4cf8={},_0x1359a0={},_0x179f05={'count':0x0,'rows':[]};var _0x5f3dd6=_['map'](db[_0x1f0d('0x2f')][_0x1f0d('0x30')],function(_0x3b5fc2){return{'name':_0x3b5fc2[_0x1f0d('0x31')],'type':_0x3b5fc2['type']['key']};});_0x1359a0[_0x1f0d('0x32')]=_[_0x1f0d('0x33')](_0x5f3dd6,_0x1f0d('0x34'));_0x1359a0['query']=_[_0x1f0d('0x35')](_0x3d1738[_0x1f0d('0x36')]);_0x1359a0[_0x1f0d('0x37')]=_[_0x1f0d('0x38')](_0x1359a0['model'],_0x1359a0[_0x1f0d('0x36')]);_0x2c4cf8[_0x1f0d('0x39')]=_[_0x1f0d('0x38')](_0x1359a0[_0x1f0d('0x32')],qs['fields'](_0x3d1738['query'][_0x1f0d('0x3a')]));_0x2c4cf8[_0x1f0d('0x39')]=_0x2c4cf8[_0x1f0d('0x39')][_0x1f0d('0x3b')]?_0x2c4cf8[_0x1f0d('0x39')]:_0x1359a0[_0x1f0d('0x32')];if(!_0x3d1738[_0x1f0d('0x36')][_0x1f0d('0x3c')]('nolimit')){_0x2c4cf8[_0x1f0d('0x23')]=qs[_0x1f0d('0x23')](_0x3d1738[_0x1f0d('0x36')][_0x1f0d('0x23')]);_0x2c4cf8[_0x1f0d('0x22')]=qs['offset'](_0x3d1738['query'][_0x1f0d('0x22')]);}_0x2c4cf8['order']=qs[_0x1f0d('0x3d')](_0x3d1738[_0x1f0d('0x36')]['sort']);_0x2c4cf8[_0x1f0d('0x3e')]=qs[_0x1f0d('0x37')](_[_0x1f0d('0x3f')](_0x3d1738[_0x1f0d('0x36')],_0x1359a0[_0x1f0d('0x37')]),_0x5f3dd6);if(_0x3d1738['query'][_0x1f0d('0x40')]){_0x2c4cf8[_0x1f0d('0x3e')]=_['merge'](_0x2c4cf8[_0x1f0d('0x3e')],{'$or':_[_0x1f0d('0x33')](_0x5f3dd6,function(_0x2049f7){if(_0x2049f7[_0x1f0d('0x41')]!=='VIRTUAL'){var _0x40d2e4={};_0x40d2e4[_0x2049f7['name']]={'$like':'%'+_0x3d1738[_0x1f0d('0x36')]['filter']+'%'};return _0x40d2e4;}})});}_0x2c4cf8=_[_0x1f0d('0x42')]({},_0x2c4cf8,_0x3d1738[_0x1f0d('0x43')]);var _0x184bd1={'where':_0x2c4cf8['where']};return db[_0x1f0d('0x2f')][_0x1f0d('0x21')](_0x184bd1)['then'](function(_0x19e2c5){_0x179f05[_0x1f0d('0x21')]=_0x19e2c5;if(_0x3d1738[_0x1f0d('0x36')][_0x1f0d('0x44')]){_0x2c4cf8[_0x1f0d('0x45')]=[{'all':!![]}];}return db[_0x1f0d('0x2f')][_0x1f0d('0x46')](_0x2c4cf8);})[_0x1f0d('0x28')](function(_0x53a48d){_0x179f05[_0x1f0d('0x47')]=_0x53a48d;return _0x179f05;})[_0x1f0d('0x28')](respondWithFilteredResult(_0x25f4c3,_0x2c4cf8))[_0x1f0d('0x48')](handleError(_0x25f4c3,null));};exports[_0x1f0d('0x49')]=function(_0x4ed658,_0x24ac24){var _0x4b1962={'raw':![],'where':{'id':_0x4ed658[_0x1f0d('0x4a')]['id']}},_0x5e5828={};_0x5e5828['model']=_[_0x1f0d('0x35')](db[_0x1f0d('0x2f')][_0x1f0d('0x30')]);_0x5e5828[_0x1f0d('0x36')]=_[_0x1f0d('0x35')](_0x4ed658[_0x1f0d('0x36')]);_0x5e5828[_0x1f0d('0x37')]=_[_0x1f0d('0x38')](_0x5e5828[_0x1f0d('0x32')],_0x5e5828['query']);_0x4b1962[_0x1f0d('0x39')]=_[_0x1f0d('0x38')](_0x5e5828[_0x1f0d('0x32')],qs[_0x1f0d('0x3a')](_0x4ed658[_0x1f0d('0x36')][_0x1f0d('0x3a')]));_0x4b1962[_0x1f0d('0x39')]=_0x4b1962[_0x1f0d('0x39')]['length']?_0x4b1962[_0x1f0d('0x39')]:_0x5e5828[_0x1f0d('0x32')];if(_0x4ed658['query'][_0x1f0d('0x44')]){_0x4b1962[_0x1f0d('0x45')]=[{'all':!![]}];}_0x4b1962=_['merge']({},_0x4b1962,_0x4ed658[_0x1f0d('0x43')]);return db[_0x1f0d('0x2f')][_0x1f0d('0x4b')](_0x4b1962)[_0x1f0d('0x28')](handleEntityNotFound(_0x24ac24,null))[_0x1f0d('0x28')](respondWithResult(_0x24ac24,null))[_0x1f0d('0x48')](handleError(_0x24ac24,null));};exports[_0x1f0d('0x2a')]=function(_0x5bfb24,_0x2ae6a9){return db[_0x1f0d('0x2f')][_0x1f0d('0x4b')]({'where':{'id':_0x5bfb24['params']['id']}})[_0x1f0d('0x28')](handleEntityNotFound(_0x2ae6a9,null))[_0x1f0d('0x28')](removeEntity(_0x2ae6a9,null))['catch'](handleError(_0x2ae6a9,null));};exports[_0x1f0d('0x4c')]=function(_0x391e9b,_0x1feb85){return db[_0x1f0d('0x2f')]['describe']()[_0x1f0d('0x28')](respondWithResult(_0x1feb85,null))[_0x1f0d('0x48')](handleError(_0x1feb85,null));};exports[_0x1f0d('0x4d')]=function(_0xdaebbd,_0x135de4){var _0x255bd4;return db['sequelize'][_0x1f0d('0x4e')](function(_0x556a82){return db[_0x1f0d('0x2f')][_0x1f0d('0x4d')](_0xdaebbd[_0x1f0d('0x4f')],{'transaction':_0x556a82})['then'](function(_0x1a890a){_0x255bd4=_0x1a890a[_0x1f0d('0x29')]({'plain':!![]});return db[_0x1f0d('0x50')][_0x1f0d('0x4b')]({'where':{'id':_0x255bd4[_0x1f0d('0x51')]},'raw':!![]})[_0x1f0d('0x28')](function(_0x132385){return createVoicePrefixExtensions(_0x255bd4,_0x132385,_0x556a82);});});})['then'](function(){var _0x54f476=_0xdaebbd['user'][_0x1f0d('0x29')]({'plain':!![]});if(!_0x54f476)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54f476[_0x1f0d('0x52')]==='user'){var _0x3f7048=_0x255bd4;return db[_0x1f0d('0x53')]['find']({'where':{'name':_0x1f0d('0x54'),'userProfileId':_0x54f476[_0x1f0d('0x55')]},'raw':!![]})['then'](function(_0x57d0b7){if(_0x57d0b7&&_0x57d0b7['autoAssociation']===0x0){return db[_0x1f0d('0x56')][_0x1f0d('0x4d')]({'name':_0x3f7048['name'],'resourceId':_0x3f7048['id'],'type':_0x57d0b7[_0x1f0d('0x34')],'sectionId':_0x57d0b7['id']},{})[_0x1f0d('0x28')](function(){return _0x255bd4;});}else{return _0x255bd4;}})[_0x1f0d('0x48')](function(_0xa76314){logger[_0x1f0d('0x2b')](_0x1f0d('0x57'),_0xa76314);throw _0xa76314;});}return _0x255bd4;})[_0x1f0d('0x28')](respondWithResult(_0x135de4,null))[_0x1f0d('0x48')](handleError(_0x135de4,null));};function Extension(_0x2711b4,_0x30705c,_0x109ec6,_0x4bce5d){this['context']=_0x1f0d('0x58');this[_0x1f0d('0x59')]=_0x2711b4;this[_0x1f0d('0x5a')]=_0x109ec6;this[_0x1f0d('0x41')]='system';this[_0x1f0d('0x5b')]='Voice\x20Prefix\x20Extension';this[_0x1f0d('0x5c')]=_0x30705c;this[_0x1f0d('0x5d')]=_0x4bce5d;}function createVoicePrefixExtensions(_0x5ca828,_0x10cb1f,_0x447279){return new BPromise(function(_0x59d8f3,_0x53712a){var _0x20f113=new Extension(formatPrefixName(_0x5ca828['prefix']),0x1,_0x1f0d('0x5e'),'Voice\x20Prefix');_0x20f113[_0x1f0d('0x5f')]=_0x5ca828['id'];return db[_0x1f0d('0x50')]['create'](_0x20f113,{'transaction':_0x447279})[_0x1f0d('0x28')](function(_0x589d96){var _0x5e1de9=_0x589d96[_0x1f0d('0x29')]({'plain':!![]});var _0x15b1f4=_[_0x1f0d('0x33')](addVoicePrefixExtensions(_0x5ca828,_0x10cb1f),function(_0x207ea0){_0x207ea0['VoiceExtensionId']=_0x5e1de9['id'];_0x207ea0[_0x1f0d('0x5f')]=_0x5ca828['id'];return _0x207ea0;});return db[_0x1f0d('0x50')][_0x1f0d('0x60')](_0x15b1f4,{'transaction':_0x447279})[_0x1f0d('0x28')](function(_0x341220){if(!_0x341220){return _0x53712a(_0x1f0d('0x61'));}else{return _0x59d8f3(_0x341220);}})[_0x1f0d('0x48')](function(_0x2a6bbf){return _0x53712a(_0x2a6bbf);});});;});};function addVoicePrefixExtensions(_0x3f72ac,_0x4f33df){var _0x1a9bbc=[];var _0xca2d0c=formatPrefixName(_0x3f72ac[_0x1f0d('0x62')]);_0x1a9bbc[_0x1f0d('0x63')](new Extension(_0xca2d0c,0x2,_0x1f0d('0x64'),_0x1f0d('0x65')+_0x3f72ac['name']));if(_0x3f72ac[_0x1f0d('0x66')]){_0x1a9bbc[_0x1f0d('0x63')](new Extension(_0xca2d0c,0x3,'Set',_0x1f0d('0x67')+_0x3f72ac[_0x1f0d('0x66')]));}else{_0x1a9bbc[_0x1f0d('0x63')](new Extension(_0xca2d0c,0x3,'NoOp',_0x1f0d('0x68')));}_0x1a9bbc[_0x1f0d('0x63')](new Extension(_0xca2d0c,0x4,_0x1f0d('0x69'),_0x4f33df[_0x1f0d('0x6a')]+','+_0x1f0d('0x6b')+(0x8+_0x3f72ac[_0x1f0d('0x34')][_0x1f0d('0x3b')])+'}'+','+0x1));return _0x1a9bbc;}function formatPrefixName(_0x569c90){var _0x2bbd97='_';for(var _0x368b88=0x0;_0x368b88<_0x569c90[_0x1f0d('0x3b')];_0x368b88++){if(_0x569c90[_0x1f0d('0x6c')](_0x368b88)=='-'){_0x2bbd97+=_0x569c90[_0x1f0d('0x6c')](_0x368b88);}else{_0x2bbd97+='['+_0x569c90[_0x1f0d('0x6c')](_0x368b88)+']';}}_0x2bbd97+='.';return _0x2bbd97;}exports[_0x1f0d('0x27')]=function(_0x346474,_0x226669,_0x4dcc89){var _0x445068=_0x346474['body'];_0x445068[_0x1f0d('0x62')]=_0x1f0d('0x6d')+_0x445068[_0x1f0d('0x34')]+'-';return db['sequelize'][_0x1f0d('0x4e')](function(_0x59ee23){return db['VoicePrefix'][_0x1f0d('0x27')](_0x445068,{'where':{'id':_0x445068['id']},'transaction':_0x59ee23})['then'](function(){return db[_0x1f0d('0x50')][_0x1f0d('0x2a')]({'where':{'VoicePrefixId':_0x445068['id']},'transaction':_0x59ee23})[_0x1f0d('0x28')](function(){return db[_0x1f0d('0x50')][_0x1f0d('0x4b')]({'where':{'id':_0x445068[_0x1f0d('0x51')]},'raw':!![]})[_0x1f0d('0x28')](function(_0x49bad7){return createVoicePrefixExtensions(_0x445068,_0x49bad7,_0x59ee23);});});});})['then'](function(){return db[_0x1f0d('0x2f')][_0x1f0d('0x6e')](_0x445068['id']);})[_0x1f0d('0x28')](respondWithResult(_0x226669,null))[_0x1f0d('0x48')](handleError(_0x226669,null));};exports[_0x1f0d('0x6f')]=function(_0x4fb944,_0x2e3a31,_0x2c2071){return db[_0x1f0d('0x2f')][_0x1f0d('0x4b')]({'where':{'id':_0x4fb944['params']['id']}})[_0x1f0d('0x28')](handleEntityNotFound(_0x2e3a31,null))['then'](function(_0x11c8a9){if(_0x11c8a9){return _0x11c8a9[_0x1f0d('0x6f')](_0x4fb944[_0x1f0d('0x4f')][_0x1f0d('0x70')],_[_0x1f0d('0x71')](_0x4fb944[_0x1f0d('0x4f')],['ids','id'])||{})['spread'](function(_0x20af56){for(var _0x5ee57e=0x0;_0x5ee57e<_0x4fb944['body'][_0x1f0d('0x70')][_0x1f0d('0x3b')];_0x5ee57e+=0x1){socket[_0x1f0d('0x72')](_0x1f0d('0x73'),{'UserId':_0x4fb944[_0x1f0d('0x4f')][_0x1f0d('0x70')][_0x5ee57e],'VoicePrefixId':_0x4fb944['params']['id']});}return _0x20af56;});}})[_0x1f0d('0x28')](respondWithResult(_0x2e3a31,null))[_0x1f0d('0x48')](handleError(_0x2e3a31,null));};exports[_0x1f0d('0x74')]=function(_0x4999cd,_0x5666b6,_0x43be2a){return db[_0x1f0d('0x2f')][_0x1f0d('0x4b')]({'where':{'id':_0x4999cd['params']['id']}})[_0x1f0d('0x28')](handleEntityNotFound(_0x5666b6,null))[_0x1f0d('0x28')](function(_0x320395){if(_0x320395){return _0x320395[_0x1f0d('0x74')](_0x4999cd[_0x1f0d('0x36')][_0x1f0d('0x70')])[_0x1f0d('0x28')](function(){if(_[_0x1f0d('0x75')](_0x4999cd['query'][_0x1f0d('0x70')])){for(var _0x48c3d6=0x0;_0x48c3d6<_0x4999cd['query'][_0x1f0d('0x70')][_0x1f0d('0x3b')];_0x48c3d6+=0x1){socket[_0x1f0d('0x72')](_0x1f0d('0x76'),{'UserId':Number(_0x4999cd[_0x1f0d('0x36')][_0x1f0d('0x70')][_0x48c3d6]),'VoicePrefixId':Number(_0x4999cd[_0x1f0d('0x4a')]['id'])});}}else{socket[_0x1f0d('0x72')](_0x1f0d('0x76'),{'UserId':Number(_0x4999cd[_0x1f0d('0x36')]['ids']),'VoicePrefixId':Number(_0x4999cd[_0x1f0d('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x5666b6,null))['catch'](handleError(_0x5666b6,null));};exports[_0x1f0d('0x77')]=function(_0x289e65,_0x5db5ff,_0x1d520d){var _0x126e59={};var _0x2b371c={};var _0x99821d;var _0x53ca84;return db['VoicePrefix'][_0x1f0d('0x78')]({'where':{'id':_0x289e65[_0x1f0d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5db5ff,null))[_0x1f0d('0x28')](function(_0x4057f9){if(_0x4057f9){_0x99821d=_0x4057f9;_0x2b371c['model']=_[_0x1f0d('0x35')](db[_0x1f0d('0x79')][_0x1f0d('0x30')]);_0x2b371c[_0x1f0d('0x36')]=_['keys'](_0x289e65[_0x1f0d('0x36')]);_0x2b371c[_0x1f0d('0x37')]=_[_0x1f0d('0x38')](_0x2b371c[_0x1f0d('0x32')],_0x2b371c['query']);_0x126e59['attributes']=_[_0x1f0d('0x38')](_0x2b371c[_0x1f0d('0x32')],qs['fields'](_0x289e65[_0x1f0d('0x36')]['fields']));_0x126e59[_0x1f0d('0x39')]=_0x126e59[_0x1f0d('0x39')]['length']?_0x126e59[_0x1f0d('0x39')]:_0x2b371c[_0x1f0d('0x32')];_0x126e59['order']=qs['sort'](_0x289e65['query'][_0x1f0d('0x3d')]);_0x126e59['where']=qs['filters'](_[_0x1f0d('0x3f')](_0x289e65[_0x1f0d('0x36')],_0x2b371c[_0x1f0d('0x37')]));if(_0x289e65[_0x1f0d('0x36')]['filter']){_0x126e59['where']=_[_0x1f0d('0x42')](_0x126e59['where'],{'$or':_[_0x1f0d('0x33')](_0x126e59[_0x1f0d('0x39')],function(_0x5d0fcc){var _0x94072e={};_0x94072e[_0x5d0fcc]={'$like':'%'+_0x289e65[_0x1f0d('0x36')][_0x1f0d('0x40')]+'%'};return _0x94072e;})});}_0x126e59=_[_0x1f0d('0x42')]({},_0x126e59,_0x289e65[_0x1f0d('0x43')]);return _0x99821d[_0x1f0d('0x77')](_0x126e59);}})[_0x1f0d('0x28')](function(_0x41ca91){if(_0x41ca91){_0x53ca84=_0x41ca91[_0x1f0d('0x3b')];if(!_0x289e65[_0x1f0d('0x36')]['hasOwnProperty'](_0x1f0d('0x7a'))){_0x126e59[_0x1f0d('0x23')]=qs[_0x1f0d('0x23')](_0x289e65[_0x1f0d('0x36')]['limit']);_0x126e59['offset']=qs[_0x1f0d('0x22')](_0x289e65[_0x1f0d('0x36')][_0x1f0d('0x22')]);}return _0x99821d[_0x1f0d('0x77')](_0x126e59);}})[_0x1f0d('0x28')](function(_0x32e0e2){if(_0x32e0e2){return _0x32e0e2?{'count':_0x53ca84,'rows':_0x32e0e2}:null;}})['then'](respondWithResult(_0x5db5ff,null))[_0x1f0d('0x48')](handleError(_0x5db5ff,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6a24ba0..afe4a95 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x34e8,0x12c));var _0x834e=function(_0x13b161,_0x977373){_0x13b161=_0x13b161-0x0;var _0xab2cba=_0x34e8[_0x13b161];return _0xab2cba;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 220beea..b4228eb 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 _0xa790=['../../config/logger','moment','bluebird','path','rimraf','./voicePrefix.attributes','VoicePrefix'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa790,0x181));var _0x0a79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa790[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0a79('0x0'))('api');var moment=require(_0x0a79('0x1'));var BPromise=require(_0x0a79('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a79('0x3'));var rimraf=require(_0x0a79('0x4'));var config=require('../../config/environment');var attributes=require(_0x0a79('0x5'));module['exports']=function(_0x226b26,_0x37b7a4){return _0x226b26['define'](_0x0a79('0x6'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ccf=['./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x6ccf,0x1d3));var _0xf6cc=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x6ccf[_0x1992f1];return _0x413dfe;};'use strict';var _=require(_0xf6cc('0x0'));var util=require(_0xf6cc('0x1'));var logger=require(_0xf6cc('0x2'))(_0xf6cc('0x3'));var moment=require(_0xf6cc('0x4'));var BPromise=require(_0xf6cc('0x5'));var rp=require(_0xf6cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6cc('0x7'));var config=require(_0xf6cc('0x8'));var attributes=require(_0xf6cc('0x9'));module[_0xf6cc('0xa')]=function(_0x66e31c,_0x200b44){return _0x66e31c[_0xf6cc('0xb')](_0xf6cc('0xc'),attributes,{'tableName':_0xf6cc('0xd'),'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 44757af..6290514 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 _0x2c70=['VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5ce033,_0x279d25){var _0xf8dc80=function(_0xaa3ddb){while(--_0xaa3ddb){_0x5ce033['push'](_0x5ce033['shift']());}};_0xf8dc80(++_0x279d25);}(_0x2c70,0x19f));var _0x02c7=function(_0x157c7b,_0x199a92){_0x157c7b=_0x157c7b-0x0;var _0x37b43e=_0x2c70[_0x157c7b];return _0x37b43e;};'use strict';var _=require(_0x02c7('0x0'));var util=require('util');var moment=require(_0x02c7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02c7('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x02c7('0x3'))(_0x02c7('0x4'));var config=require('../../config/environment');var jayson=require(_0x02c7('0x5'));var client=jayson[_0x02c7('0x6')][_0x02c7('0x7')]({'port':0x232a});config[_0x02c7('0x8')]=_[_0x02c7('0x9')](config[_0x02c7('0x8')],{'host':_0x02c7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x02c7('0x8')]));require('./voicePrefix.socket')[_0x02c7('0xb')](socket);function respondWithRpcPromise(_0x1c9028,_0x1b1d1e,_0xc867db){return new BPromise(function(_0x2fb929,_0x504316){return client['request'](_0x1c9028,_0xc867db)[_0x02c7('0xc')](function(_0x38b03d){logger[_0x02c7('0xd')](_0x02c7('0xe'),_0x1b1d1e,_0x02c7('0xf'));logger[_0x02c7('0x10')](_0x02c7('0x11'),_0x1b1d1e,_0x02c7('0xf'),JSON[_0x02c7('0x12')](_0x38b03d));if(_0x38b03d[_0x02c7('0x13')]){if(_0x38b03d[_0x02c7('0x13')][_0x02c7('0x14')]===0x1f4){logger[_0x02c7('0x13')](_0x02c7('0xe'),_0x1b1d1e,_0x38b03d['error'][_0x02c7('0x15')]);return _0x504316(_0x38b03d[_0x02c7('0x13')][_0x02c7('0x15')]);}logger[_0x02c7('0x13')](_0x02c7('0xe'),_0x1b1d1e,_0x38b03d[_0x02c7('0x13')][_0x02c7('0x15')]);return _0x2fb929(_0x38b03d['error']['message']);}else{logger[_0x02c7('0xd')](_0x02c7('0xe'),_0x1b1d1e,_0x02c7('0xf'));_0x2fb929(_0x38b03d[_0x02c7('0x16')][_0x02c7('0x15')]);}})[_0x02c7('0x17')](function(_0x610e89){logger[_0x02c7('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x1b1d1e,_0x610e89);_0x504316(_0x610e89);});});} \ No newline at end of file +var _0xf4d2=['rpc','../../config/environment','client','http','localhost','socket.io-emitter','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x10b1d1,_0x39ce24){var _0x520b5d=function(_0x6e8552){while(--_0x6e8552){_0x10b1d1['push'](_0x10b1d1['shift']());}};_0x520b5d(++_0x39ce24);}(_0xf4d2,0x130));var _0x2f4d=function(_0x356afd,_0x1552ed){_0x356afd=_0x356afd-0x0;var _0x111e01=_0xf4d2[_0x356afd];return _0x111e01;};'use strict';var _=require(_0x2f4d('0x0'));var util=require(_0x2f4d('0x1'));var moment=require(_0x2f4d('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f4d('0x3'));var fs=require('fs');var Redis=require(_0x2f4d('0x4'));var db=require(_0x2f4d('0x5'))['db'];var utils=require(_0x2f4d('0x6'));var logger=require(_0x2f4d('0x7'))(_0x2f4d('0x8'));var config=require(_0x2f4d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2f4d('0xa')][_0x2f4d('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2f4d('0xc'),'port':0x18eb});var socket=require(_0x2f4d('0xd'))(new Redis(config['redis']));require(_0x2f4d('0xe'))[_0x2f4d('0xf')](socket);function respondWithRpcPromise(_0x1cec5b,_0x224e8e,_0x535085){return new BPromise(function(_0x4c2105,_0x6cc709){return client['request'](_0x1cec5b,_0x535085)[_0x2f4d('0x10')](function(_0x2fdea2){logger['info'](_0x2f4d('0x11'),_0x224e8e,_0x2f4d('0x12'));logger['debug'](_0x2f4d('0x13'),_0x224e8e,_0x2f4d('0x12'),JSON['stringify'](_0x2fdea2));if(_0x2fdea2['error']){if(_0x2fdea2['error']['code']===0x1f4){logger[_0x2f4d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x224e8e,_0x2fdea2[_0x2f4d('0x14')][_0x2f4d('0x15')]);return _0x6cc709(_0x2fdea2[_0x2f4d('0x14')]['message']);}logger[_0x2f4d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x224e8e,_0x2fdea2[_0x2f4d('0x14')][_0x2f4d('0x15')]);return _0x4c2105(_0x2fdea2[_0x2f4d('0x14')][_0x2f4d('0x15')]);}else{logger[_0x2f4d('0x16')](_0x2f4d('0x11'),_0x224e8e,'request\x20sent');_0x4c2105(_0x2fdea2[_0x2f4d('0x17')][_0x2f4d('0x15')]);}})['catch'](function(_0x37407e){logger['error'](_0x2f4d('0x11'),_0x224e8e,_0x37407e);_0x6cc709(_0x37407e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 45ff49e..a8778ff 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 _0xfe48=['register','length','voicePrefix:','./voicePrefix.events','save','update','emit','removeListener'];(function(_0xb5bd62,_0x1b6d62){var _0x2d5e4d=function(_0x450d73){while(--_0x450d73){_0xb5bd62['push'](_0xb5bd62['shift']());}};_0x2d5e4d(++_0x1b6d62);}(_0xfe48,0xcb));var _0x8fe4=function(_0x443089,_0x1e0b97){_0x443089=_0x443089-0x0;var _0xecbe89=_0xfe48[_0x443089];return _0xecbe89;};'use strict';var VoicePrefixEvents=require(_0x8fe4('0x0'));var events=[_0x8fe4('0x1'),'remove',_0x8fe4('0x2')];function createListener(_0x5e701b,_0x181a3e){return function(_0xf55789){_0x181a3e[_0x8fe4('0x3')](_0x5e701b,_0xf55789);};}function removeListener(_0x582f00,_0x16de95){return function(){VoicePrefixEvents[_0x8fe4('0x4')](_0x582f00,_0x16de95);};}exports[_0x8fe4('0x5')]=function(_0x1c2cef){for(var _0x174d7d=0x0,_0x11cd8f=events[_0x8fe4('0x6')];_0x174d7d<_0x11cd8f;_0x174d7d++){var _0xb259e0=events[_0x174d7d];var _0x148188=createListener(_0x8fe4('0x7')+_0xb259e0,_0x1c2cef);VoicePrefixEvents['on'](_0xb259e0,_0x148188);}}; \ No newline at end of file +var _0xbaad=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','register'];(function(_0x5028c8,_0x5a7ffe){var _0x4d08bc=function(_0x125652){while(--_0x125652){_0x5028c8['push'](_0x5028c8['shift']());}};_0x4d08bc(++_0x5a7ffe);}(_0xbaad,0x11a));var _0xdbaa=function(_0x471706,_0x4066c1){_0x471706=_0x471706-0x0;var _0xb46646=_0xbaad[_0x471706];return _0xb46646;};'use strict';var VoicePrefixEvents=require(_0xdbaa('0x0'));var events=[_0xdbaa('0x1'),_0xdbaa('0x2'),_0xdbaa('0x3')];function createListener(_0x3d64e0,_0x121753){return function(_0x54050f){_0x121753[_0xdbaa('0x4')](_0x3d64e0,_0x54050f);};}function removeListener(_0x2b7994,_0x45268b){return function(){VoicePrefixEvents['removeListener'](_0x2b7994,_0x45268b);};}exports[_0xdbaa('0x5')]=function(_0x5f27cb){for(var _0x30ace8=0x0,_0x2c1f26=events[_0xdbaa('0x6')];_0x30ace8<_0x2c1f26;_0x30ace8++){var _0x536cad=events[_0x30ace8];var _0x35a96b=createListener(_0xdbaa('0x7')+_0x536cad,_0x5f27cb);VoicePrefixEvents['on'](_0x536cad,_0x35a96b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 810827d..329c3bf 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 _0x6a87=['../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone','addAgents','addLists','addBlackLists','put','/:id','update','destroy','removeTeams','/:id/users','delete','removeLists','removeBlackLists','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x426dde,_0xb910a3){var _0x43d3ec=function(_0x643340){while(--_0x643340){_0x426dde['push'](_0x426dde['shift']());}};_0x43d3ec(++_0xb910a3);}(_0x6a87,0xf0));var _0x76a8=function(_0x54a7a0,_0x27095e){_0x54a7a0=_0x54a7a0-0x0;var _0x1ea5fc=_0x6a87[_0x54a7a0];return _0x1ea5fc;};'use strict';var multer=require('multer');var util=require(_0x76a8('0x0'));var path=require(_0x76a8('0x1'));var timeout=require(_0x76a8('0x2'));var express=require(_0x76a8('0x3'));var router=express[_0x76a8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76a8('0x5'));var config=require(_0x76a8('0x6'));var controller=require(_0x76a8('0x7'));router[_0x76a8('0x8')]('/',auth['isAuthenticated'](),controller[_0x76a8('0x9')]);router[_0x76a8('0x8')]('/:id',auth[_0x76a8('0xa')](),controller[_0x76a8('0xb')]);router[_0x76a8('0x8')](_0x76a8('0xc'),auth[_0x76a8('0xa')](),controller[_0x76a8('0xd')]);router['get'](_0x76a8('0xe'),auth[_0x76a8('0xa')](),controller[_0x76a8('0xf')]);router[_0x76a8('0x8')](_0x76a8('0x10'),auth['isAuthenticated'](),controller[_0x76a8('0x11')]);router[_0x76a8('0x8')](_0x76a8('0x12'),auth[_0x76a8('0xa')](),controller[_0x76a8('0x13')]);router[_0x76a8('0x8')](_0x76a8('0x14'),auth['isAuthenticated'](),controller['getTeams']);router[_0x76a8('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x76a8('0x15')]);router[_0x76a8('0x8')](_0x76a8('0x16'),auth[_0x76a8('0xa')](),controller['getMembers']);router['get'](_0x76a8('0x17'),auth[_0x76a8('0xa')](),controller[_0x76a8('0x18')]);router[_0x76a8('0x8')](_0x76a8('0x19'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x76a8('0x1a')](_0x76a8('0x1b'),auth[_0x76a8('0xa')](),controller[_0x76a8('0x1c')]);router[_0x76a8('0x1a')](_0x76a8('0x14'),auth[_0x76a8('0xa')](),controller['addTeams']);router[_0x76a8('0x1a')]('/:id/users',auth[_0x76a8('0xa')](),controller[_0x76a8('0x1d')]);router['post'](_0x76a8('0x17'),auth['isAuthenticated'](),controller[_0x76a8('0x1e')]);router['post'](_0x76a8('0x19'),auth['isAuthenticated'](),controller[_0x76a8('0x1f')]);router[_0x76a8('0x20')](_0x76a8('0x21'),auth['isAuthenticated'](),controller[_0x76a8('0x22')]);router['delete'](_0x76a8('0x21'),auth[_0x76a8('0xa')](),controller[_0x76a8('0x23')]);router['delete']('/:id/teams',auth[_0x76a8('0xa')](),controller[_0x76a8('0x24')]);router['delete'](_0x76a8('0x25'),auth[_0x76a8('0xa')](),controller['removeAgents']);router[_0x76a8('0x26')](_0x76a8('0x17'),auth[_0x76a8('0xa')](),controller[_0x76a8('0x27')]);router[_0x76a8('0x26')](_0x76a8('0x19'),auth[_0x76a8('0xa')](),controller[_0x76a8('0x28')]);module['exports']=router; \ No newline at end of file +var _0x0f47=['getLists','create','post','/:id/clone','clone','/:id/teams','/:id/lists','addLists','/:id/blacklists','put','delete','destroy','removeTeams','removeLists','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getTeams','/:id/users','/:id/members','getMembers'];(function(_0x1894c8,_0x4ffbcc){var _0x13c192=function(_0x2e3ab9){while(--_0x2e3ab9){_0x1894c8['push'](_0x1894c8['shift']());}};_0x13c192(++_0x4ffbcc);}(_0x0f47,0x137));var _0x70f4=function(_0x9016ef,_0xa973e1){_0x9016ef=_0x9016ef-0x0;var _0x3e0652=_0x0f47[_0x9016ef];return _0x3e0652;};'use strict';var multer=require(_0x70f4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x70f4('0x1'));var express=require(_0x70f4('0x2'));var router=express[_0x70f4('0x3')]();var auth=require(_0x70f4('0x4'));var interaction=require(_0x70f4('0x5'));var config=require(_0x70f4('0x6'));var controller=require(_0x70f4('0x7'));router[_0x70f4('0x8')]('/',auth[_0x70f4('0x9')](),controller[_0x70f4('0xa')]);router[_0x70f4('0x8')](_0x70f4('0xb'),auth[_0x70f4('0x9')](),controller[_0x70f4('0xc')]);router[_0x70f4('0x8')]('/:id/hoppers',auth[_0x70f4('0x9')](),controller[_0x70f4('0xd')]);router[_0x70f4('0x8')](_0x70f4('0xe'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x70f4('0x8')](_0x70f4('0xf'),auth['isAuthenticated'](),controller[_0x70f4('0x10')]);router[_0x70f4('0x8')]('/:id/hopper_black',auth[_0x70f4('0x9')](),controller[_0x70f4('0x11')]);router[_0x70f4('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x70f4('0x12')]);router[_0x70f4('0x8')](_0x70f4('0x13'),auth[_0x70f4('0x9')](),controller['getAgents']);router[_0x70f4('0x8')](_0x70f4('0x14'),auth['isAuthenticated'](),controller[_0x70f4('0x15')]);router[_0x70f4('0x8')]('/:id/lists',auth[_0x70f4('0x9')](),controller[_0x70f4('0x16')]);router[_0x70f4('0x8')]('/:id/blacklists',auth[_0x70f4('0x9')](),controller['getBlackLists']);router['post']('/',auth[_0x70f4('0x9')](),controller[_0x70f4('0x17')]);router[_0x70f4('0x18')](_0x70f4('0x19'),auth[_0x70f4('0x9')](),controller[_0x70f4('0x1a')]);router['post'](_0x70f4('0x1b'),auth[_0x70f4('0x9')](),controller['addTeams']);router[_0x70f4('0x18')](_0x70f4('0x13'),auth[_0x70f4('0x9')](),controller['addAgents']);router['post'](_0x70f4('0x1c'),auth[_0x70f4('0x9')](),controller[_0x70f4('0x1d')]);router['post'](_0x70f4('0x1e'),auth[_0x70f4('0x9')](),controller['addBlackLists']);router[_0x70f4('0x1f')](_0x70f4('0xb'),auth[_0x70f4('0x9')](),controller['update']);router[_0x70f4('0x20')](_0x70f4('0xb'),auth['isAuthenticated'](),controller[_0x70f4('0x21')]);router[_0x70f4('0x20')](_0x70f4('0x1b'),auth[_0x70f4('0x9')](),controller[_0x70f4('0x22')]);router['delete'](_0x70f4('0x13'),auth[_0x70f4('0x9')](),controller['removeAgents']);router['delete'](_0x70f4('0x1c'),auth[_0x70f4('0x9')](),controller[_0x70f4('0x23')]);router[_0x70f4('0x20')](_0x70f4('0x1e'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x70f4('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 5d28292..bd3a0c4 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(_0x5e343c,_0x5d5c6a){var _0x497243=function(_0x49bcda){while(--_0x49bcda){_0x5e343c['push'](_0x5e343c['shift']());}};_0x497243(++_0x5d5c6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x27ffa0,_0x3e6c4a){var _0x37c18b=function(_0x3accb1){while(--_0x3accb1){_0x27ffa0['push'](_0x27ffa0['shift']());}};_0x37c18b(++_0x3e6c4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 4a66f14..8099e84 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 _0x646e=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','bluebird','util','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','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','status','json','offset','limit','Content-Range','reject','save','update','then','get','VoiceQueues','inbound','outbound','filter','value','includes','type','find','name','UserProfileResource','destroy','end','sendStatus','stack','send','index','map','VoiceQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','options','count','findAll','rows','catch','params','keys','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','nolimit','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','each','UserVoiceQueue','isNil','format','SIP/%s','emit','userVoiceQueue:save','ids','field','tq.TeamId','from','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','TeamId','all','union','compact','transaction','removeTeams','removeAgents','UserVoiceQueueRt','addAgents','spread','isEmpty','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','NOW()','CmListId','cm_contacts'];(function(_0x17d92b,_0x28d893){var _0x7054b6=function(_0xe55dee){while(--_0xe55dee){_0x17d92b['push'](_0x17d92b['shift']());}};_0x7054b6(++_0x28d893);}(_0x646e,0xc2));var _0xe646=function(_0x5170dc,_0x1b8cde){_0x5170dc=_0x5170dc-0x0;var _0x1dff10=_0x646e[_0x5170dc];return _0x1dff10;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe646('0x0'));var rimraf=require(_0xe646('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe646('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe646('0x3'));var Mustache=require('mustache');var util=require(_0xe646('0x4'));var path=require(_0xe646('0x5'));var sox=require(_0xe646('0x6'));var csv=require(_0xe646('0x7'));var ejs=require(_0xe646('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe646('0x9'));var crypto=require(_0xe646('0xa'));var jsforce=require(_0xe646('0xb'));var deskjs=require(_0xe646('0xc'));var toCsv=require(_0xe646('0x7'));var querystring=require(_0xe646('0xd'));var Papa=require(_0xe646('0xe'));var Redis=require(_0xe646('0xf'));var authService=require(_0xe646('0x10'));var qs=require(_0xe646('0x11'));var as=require(_0xe646('0x12'));var hardwareService=require(_0xe646('0x13'));var logger=require(_0xe646('0x14'))('api');var utils=require(_0xe646('0x15'));var config=require(_0xe646('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe646('0x17')](config[_0xe646('0x18')],{'host':_0xe646('0x19'),'port':0x18eb});var socket=require(_0xe646('0x1a'))(new Redis(config[_0xe646('0x18')]));require(_0xe646('0x1b'))[_0xe646('0x1c')](socket);function respondWithStatusCode(_0x51fc6f,_0x597e4e){_0x597e4e=_0x597e4e||0xcc;return function(_0x1aa76){if(_0x1aa76){return _0x51fc6f['sendStatus'](_0x597e4e);}return _0x51fc6f[_0xe646('0x1d')](_0x597e4e)['end']();};}function respondWithResult(_0x1e48c8,_0x454db5){_0x454db5=_0x454db5||0xc8;return function(_0x9112b5){if(_0x9112b5){return _0x1e48c8[_0xe646('0x1d')](_0x454db5)[_0xe646('0x1e')](_0x9112b5);}};}function respondWithFilteredResult(_0xbf4e41,_0x3980aa){return function(_0x28fb04){if(_0x28fb04){var _0x4394ea=_0x28fb04['count'],_0x4589f7=_0x3980aa[_0xe646('0x1f')],_0x119bdd=_0x3980aa[_0xe646('0x1f')]+_0x3980aa[_0xe646('0x20')],_0x453da7;if(_0x119bdd>=_0x4394ea){_0x119bdd=_0x4394ea;_0x453da7=0xc8;}else{_0x453da7=0xce;}_0xbf4e41[_0xe646('0x1d')](_0x453da7);return _0xbf4e41['set'](_0xe646('0x21'),_0x4589f7+'-'+_0x119bdd+'/'+_0x4394ea)[_0xe646('0x1e')](_0x28fb04);}return null;};}function patchUpdates(_0x37d0cd){return function(_0x4ff5da){try{jsonpatch['apply'](_0x4ff5da,_0x37d0cd,!![]);}catch(_0x4d0ff4){return BPromise[_0xe646('0x22')](_0x4d0ff4);}return _0x4ff5da[_0xe646('0x23')]();};}function saveUpdates(_0x481788,_0x1cabad){return function(_0x43cc00){if(_0x43cc00){return _0x43cc00[_0xe646('0x24')](_0x481788)[_0xe646('0x25')](function(_0x3179b3){return _0x3179b3;});}return null;};}function removeEntity(_0x51dee7,_0x18d727){return function(_0x2e893b){if(_0x2e893b){return _0x2e893b['destroy']()['then'](function(){var _0x4c11dd=_0x2e893b[_0xe646('0x26')]({'plain':!![]});var _0x232857=[{'name':_0xe646('0x27'),'value':_0xe646('0x28'),'ignore':![]},{'name':'QueueCampaigns','value':_0xe646('0x29'),'ignore':![]}];var _0x5a5060=_(_0x232857)[_0xe646('0x2a')]('ignore')['map'](_0xe646('0x2b'))['value']();if(_[_0xe646('0x2c')](_0x5a5060,_0x4c11dd[_0xe646('0x2d')])){return;}var _0x46b226=_[_0xe646('0x2e')](_0x232857,[_0xe646('0x2b'),_0x4c11dd[_0xe646('0x2d')]])[_0xe646('0x2f')];return db[_0xe646('0x30')][_0xe646('0x31')]({'where':{'type':_0x46b226,'resourceId':_0x4c11dd['id']}})[_0xe646('0x25')](function(){return _0x2e893b;});})[_0xe646('0x25')](function(){_0x51dee7[_0xe646('0x1d')](0xcc)[_0xe646('0x32')]();});}};}function handleEntityNotFound(_0x351ac7,_0x168908){return function(_0x49e4c5){if(!_0x49e4c5){_0x351ac7[_0xe646('0x33')](0x194);}return _0x49e4c5;};}function handleError(_0x45ab51,_0x4e2475){_0x4e2475=_0x4e2475||0x1f4;return function(_0x16167b){logger['error'](_0x16167b[_0xe646('0x34')]);if(_0x16167b[_0xe646('0x2f')]){delete _0x16167b[_0xe646('0x2f')];}_0x45ab51[_0xe646('0x1d')](_0x4e2475)[_0xe646('0x35')](_0x16167b);};}exports[_0xe646('0x36')]=function(_0x2e431e,_0x57c618){var _0x39744e={},_0x58b12e={},_0x53fcb9={'count':0x0,'rows':[]};var _0x31e665=_[_0xe646('0x37')](db[_0xe646('0x38')][_0xe646('0x39')],function(_0x4a7563){return{'name':_0x4a7563[_0xe646('0x3a')],'type':_0x4a7563[_0xe646('0x2d')][_0xe646('0x3b')]};});_0x58b12e[_0xe646('0x3c')]=_['map'](_0x31e665,_0xe646('0x2f'));_0x58b12e[_0xe646('0x3d')]=_['keys'](_0x2e431e[_0xe646('0x3d')]);_0x58b12e[_0xe646('0x3e')]=_[_0xe646('0x3f')](_0x58b12e[_0xe646('0x3c')],_0x58b12e[_0xe646('0x3d')]);_0x39744e[_0xe646('0x40')]=_['intersection'](_0x58b12e[_0xe646('0x3c')],qs[_0xe646('0x41')](_0x2e431e['query'][_0xe646('0x41')]));_0x39744e[_0xe646('0x40')]=_0x39744e[_0xe646('0x40')][_0xe646('0x42')]?_0x39744e['attributes']:_0x58b12e[_0xe646('0x3c')];if(!_0x2e431e['query'][_0xe646('0x43')]('nolimit')){_0x39744e['limit']=qs[_0xe646('0x20')](_0x2e431e['query'][_0xe646('0x20')]);_0x39744e[_0xe646('0x1f')]=qs[_0xe646('0x1f')](_0x2e431e[_0xe646('0x3d')]['offset']);}_0x39744e[_0xe646('0x44')]=qs[_0xe646('0x45')](_0x2e431e[_0xe646('0x3d')][_0xe646('0x45')]);_0x39744e[_0xe646('0x46')]=qs['filters'](_['pick'](_0x2e431e['query'],_0x58b12e[_0xe646('0x3e')]),_0x31e665);if(_0x2e431e['query'][_0xe646('0x2a')]){_0x39744e[_0xe646('0x46')]=_['merge'](_0x39744e[_0xe646('0x46')],{'$or':_[_0xe646('0x37')](_0x31e665,function(_0x2a3e9a){if(_0x2a3e9a[_0xe646('0x2d')]!==_0xe646('0x47')){var _0x28ece0={};_0x28ece0[_0x2a3e9a[_0xe646('0x2f')]]={'$like':'%'+_0x2e431e[_0xe646('0x3d')][_0xe646('0x2a')]+'%'};return _0x28ece0;}})});}_0x39744e=_['merge']({},_0x39744e,_0x2e431e[_0xe646('0x48')]);var _0x461e42={'where':_0x39744e['where']};return db[_0xe646('0x38')][_0xe646('0x49')](_0x461e42)['then'](function(_0x264db4){_0x53fcb9[_0xe646('0x49')]=_0x264db4;if(_0x2e431e['query']['includeAll']){_0x39744e['include']=[{'all':!![]}];}return db[_0xe646('0x38')][_0xe646('0x4a')](_0x39744e);})[_0xe646('0x25')](function(_0x50a3ba){_0x53fcb9[_0xe646('0x4b')]=_0x50a3ba;return _0x53fcb9;})[_0xe646('0x25')](respondWithFilteredResult(_0x57c618,_0x39744e))[_0xe646('0x4c')](handleError(_0x57c618,null));};exports['show']=function(_0x282512,_0x3192a1){var _0x226b89={'raw':![],'where':{'id':_0x282512[_0xe646('0x4d')]['id']}},_0x4f0fe6={};_0x4f0fe6[_0xe646('0x3c')]=_[_0xe646('0x4e')](db[_0xe646('0x38')][_0xe646('0x39')]);_0x4f0fe6['query']=_[_0xe646('0x4e')](_0x282512[_0xe646('0x3d')]);_0x4f0fe6['filters']=_[_0xe646('0x3f')](_0x4f0fe6[_0xe646('0x3c')],_0x4f0fe6[_0xe646('0x3d')]);_0x226b89['attributes']=_[_0xe646('0x3f')](_0x4f0fe6[_0xe646('0x3c')],qs['fields'](_0x282512['query'][_0xe646('0x41')]));_0x226b89[_0xe646('0x40')]=_0x226b89[_0xe646('0x40')]['length']?_0x226b89['attributes']:_0x4f0fe6['model'];if(_0x282512['query'][_0xe646('0x4f')]){_0x226b89['include']=[{'all':!![]}];}_0x226b89=_[_0xe646('0x50')]({},_0x226b89,_0x282512[_0xe646('0x48')]);return db[_0xe646('0x38')][_0xe646('0x2e')](_0x226b89)[_0xe646('0x25')](handleEntityNotFound(_0x3192a1,null))[_0xe646('0x25')](respondWithResult(_0x3192a1,null))[_0xe646('0x4c')](handleError(_0x3192a1,null));};exports[_0xe646('0x51')]=function(_0xe5321d,_0x5e17eb){return db[_0xe646('0x38')][_0xe646('0x51')](_0xe5321d[_0xe646('0x52')],{})[_0xe646('0x25')](function(_0x4b5a18){var _0x485848=_0xe5321d[_0xe646('0x53')][_0xe646('0x26')]({'plain':!![]});if(!_0x485848)throw new Error(_0xe646('0x54'));if(_0x485848[_0xe646('0x55')]===_0xe646('0x53')){var _0x47a231=_0x4b5a18[_0xe646('0x26')]({'plain':!![]});var _0x7a4847=[{'name':_0xe646('0x27'),'value':_0xe646('0x28')},{'name':_0xe646('0x56'),'value':_0xe646('0x29')}];var _0x3c0dd1=_['find'](_0x7a4847,[_0xe646('0x2b'),_0x47a231[_0xe646('0x2d')]])[_0xe646('0x2f')];return db[_0xe646('0x57')][_0xe646('0x2e')]({'where':{'name':_0x3c0dd1,'userProfileId':_0x485848[_0xe646('0x58')]},'raw':!![]})[_0xe646('0x25')](function(_0x52051b){if(_0x52051b&&_0x52051b['autoAssociation']===0x0){return db[_0xe646('0x30')]['create']({'name':_0x47a231['name'],'resourceId':_0x47a231['id'],'type':_0x52051b[_0xe646('0x2f')],'sectionId':_0x52051b['id']},{})[_0xe646('0x25')](function(){return _0x4b5a18;});}else{return _0x4b5a18;}})['catch'](function(_0x49b814){logger[_0xe646('0x59')](_0xe646('0x5a'),_0x49b814);throw _0x49b814;});}return _0x4b5a18;})[_0xe646('0x25')](respondWithResult(_0x5e17eb,0xc9))[_0xe646('0x4c')](handleError(_0x5e17eb,null));};exports[_0xe646('0x5b')]=function(_0x17071d,_0x327d4d){var _0x1b1cbb={'where':{'id':_0x17071d[_0xe646('0x4d')]['id']}},_0x561188={};_0x561188['model']=_[_0xe646('0x4e')](db[_0xe646('0x38')][_0xe646('0x39')]);_0x1b1cbb[_0xe646('0x40')]=_[_0xe646('0x3f')](_0x561188['model'],qs[_0xe646('0x41')](_0x17071d[_0xe646('0x3d')][_0xe646('0x41')]));_0x1b1cbb[_0xe646('0x40')]=_0x1b1cbb['attributes']['length']?_0x1b1cbb[_0xe646('0x40')]:_0x561188[_0xe646('0x3c')];if(_0x17071d[_0xe646('0x3d')][_0xe646('0x4f')]){_0x1b1cbb[_0xe646('0x5c')]=[{'all':!![]}];}_0x1b1cbb=_[_0xe646('0x50')]({},_0x1b1cbb,_0x17071d['options']);return db[_0xe646('0x38')][_0xe646('0x2e')](_0x1b1cbb)['then'](handleEntityNotFound(_0x327d4d,null))[_0xe646('0x25')](function(_0x265f66){if(_0x265f66){var _0x377819=_0x265f66[_0xe646('0x26')]({'plain':!![]});_0x377819=qs[_0xe646('0x5d')](_0x377819,['id',_0xe646('0x5e'),_0xe646('0x5f')]);_0x17071d['body']=_[_0xe646('0x5d')](_0x17071d['body'],['id',_0xe646('0x5e'),_0xe646('0x5f')]);return db['VoiceQueue']['create'](_['merge'](_0x377819,_0x17071d[_0xe646('0x52')]),{'include':_0x17071d[_0xe646('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xe646('0x25')](function(_0x5bb9c2){var _0x4f7e30=_0x17071d[_0xe646('0x53')]['get']({'plain':!![]});if(!_0x4f7e30)throw new Error(_0xe646('0x54'));if(_0x4f7e30['role']==='user'){var _0x4179ca=_0x5bb9c2[_0xe646('0x26')]({'plain':!![]});var _0x307e74=[{'name':'VoiceQueues','value':_0xe646('0x28')},{'name':_0xe646('0x56'),'value':_0xe646('0x29')}];var _0x33c4e9=_[_0xe646('0x2e')](_0x307e74,[_0xe646('0x2b'),_0x4179ca[_0xe646('0x2d')]])[_0xe646('0x2f')];return db[_0xe646('0x57')]['find']({'where':{'name':_0x33c4e9,'userProfileId':_0x4f7e30[_0xe646('0x58')]},'raw':!![]})[_0xe646('0x25')](function(_0x13c5e4){if(_0x13c5e4&&_0x13c5e4[_0xe646('0x60')]===0x0){return db[_0xe646('0x30')][_0xe646('0x51')]({'name':_0x4179ca[_0xe646('0x2f')],'resourceId':_0x4179ca['id'],'type':_0x13c5e4[_0xe646('0x2f')],'sectionId':_0x13c5e4['id']},{})[_0xe646('0x25')](function(){return _0x5bb9c2;});}else{return _0x5bb9c2;}})[_0xe646('0x4c')](function(_0x8e5c08){logger['error'](_0xe646('0x5a'),_0x8e5c08);throw _0x8e5c08;});}return _0x5bb9c2;});}})['then'](respondWithResult(_0x327d4d,0xc9))[_0xe646('0x4c')](handleError(_0x327d4d,null));};exports[_0xe646('0x24')]=function(_0x955356,_0x2b5ef0){if(_0x955356[_0xe646('0x52')]['id']){delete _0x955356['body']['id'];}return db[_0xe646('0x38')][_0xe646('0x2e')]({'where':{'id':_0x955356['params']['id']}})['then'](handleEntityNotFound(_0x2b5ef0,null))[_0xe646('0x25')](saveUpdates(_0x955356[_0xe646('0x52')],null))[_0xe646('0x25')](respondWithResult(_0x2b5ef0,null))[_0xe646('0x4c')](handleError(_0x2b5ef0,null));};exports[_0xe646('0x31')]=function(_0x211624,_0x28879b){return db[_0xe646('0x38')][_0xe646('0x2e')]({'where':{'id':_0x211624['params']['id']}})['then'](handleEntityNotFound(_0x28879b,null))[_0xe646('0x25')](removeEntity(_0x28879b,null))[_0xe646('0x4c')](handleError(_0x28879b,null));};exports[_0xe646('0x61')]=function(_0xfb4e69,_0x47e4e5,_0x1a19d0){var _0xe1ad7={'raw':![],'where':{}};var _0x159c16={};var _0x4c8944={'count':0x0,'rows':[]};return db[_0xe646('0x38')][_0xe646('0x62')]({'where':{'id':_0xfb4e69[_0xe646('0x4d')]['id']}})[_0xe646('0x25')](handleEntityNotFound(_0x47e4e5,null))[_0xe646('0x25')](function(_0x56afba){if(_0x56afba){_0x159c16[_0xe646('0x3c')]=_[_0xe646('0x4e')](db[_0xe646('0x63')][_0xe646('0x39')]);_0x159c16[_0xe646('0x3d')]=_[_0xe646('0x4e')](_0xfb4e69[_0xe646('0x3d')]);_0x159c16[_0xe646('0x3e')]=_['intersection'](_0x159c16[_0xe646('0x3c')],_0x159c16['query']);_0xe1ad7[_0xe646('0x40')]=_[_0xe646('0x3f')](_0x159c16[_0xe646('0x3c')],qs[_0xe646('0x41')](_0xfb4e69[_0xe646('0x3d')][_0xe646('0x41')]));_0xe1ad7[_0xe646('0x40')]=_0xe1ad7[_0xe646('0x40')][_0xe646('0x42')]?_0xe1ad7[_0xe646('0x40')]:_0x159c16[_0xe646('0x3c')];if(!_0xfb4e69[_0xe646('0x3d')][_0xe646('0x43')]('nolimit')){_0xe1ad7[_0xe646('0x20')]=qs[_0xe646('0x20')](_0xfb4e69[_0xe646('0x3d')][_0xe646('0x20')]);_0xe1ad7[_0xe646('0x1f')]=qs[_0xe646('0x1f')](_0xfb4e69[_0xe646('0x3d')][_0xe646('0x1f')]);}_0xe1ad7[_0xe646('0x44')]=qs[_0xe646('0x45')](_0xfb4e69[_0xe646('0x3d')]['sort']);_0xe1ad7[_0xe646('0x46')]=qs[_0xe646('0x3e')](_[_0xe646('0x64')](_0xfb4e69[_0xe646('0x3d')],_0x159c16[_0xe646('0x3e')]));_0xe1ad7[_0xe646('0x46')][_0xe646('0x65')]=_0x56afba['id'];if(_0xfb4e69[_0xe646('0x3d')][_0xe646('0x2a')]){_0xe1ad7['where']=_[_0xe646('0x50')](_0xe1ad7[_0xe646('0x46')],{'$or':_[_0xe646('0x37')](_0xe1ad7[_0xe646('0x40')],function(_0x20e6ab){var _0x24d065={};_0x24d065[_0x20e6ab]={'$like':'%'+_0xfb4e69[_0xe646('0x3d')][_0xe646('0x2a')]+'%'};return _0x24d065;})});}_0xe1ad7=_['merge']({},_0xe1ad7,_0xfb4e69[_0xe646('0x48')]);return db[_0xe646('0x63')][_0xe646('0x49')]({'where':_0xe1ad7[_0xe646('0x46')]})['then'](function(_0x5030f2){_0x4c8944[_0xe646('0x49')]=_0x5030f2;if(_0xfb4e69[_0xe646('0x3d')][_0xe646('0x4f')]){_0xe1ad7['include']=[{'all':!![]}];}return db['CmHopper'][_0xe646('0x4a')](_0xe1ad7);})['then'](function(_0x195700){_0x4c8944[_0xe646('0x4b')]=_0x195700;return _0x4c8944;});}})[_0xe646('0x25')](respondWithFilteredResult(_0x47e4e5,_0xe1ad7))[_0xe646('0x4c')](handleError(_0x47e4e5,null));};exports[_0xe646('0x66')]=function(_0x31e34d,_0x3ec453,_0x5a3264){var _0x383f81={'raw':!![],'where':{}};var _0x1e5ded={};var _0x3899c2={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe646('0x62')]({'where':{'id':_0x31e34d[_0xe646('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ec453,null))['then'](function(_0x574bab){if(_0x574bab){_0x1e5ded['model']=_[_0xe646('0x4e')](db[_0xe646('0x67')][_0xe646('0x39')]);_0x1e5ded[_0xe646('0x3d')]=_[_0xe646('0x4e')](_0x31e34d['query']);_0x1e5ded[_0xe646('0x3e')]=_[_0xe646('0x3f')](_0x1e5ded[_0xe646('0x3c')],_0x1e5ded[_0xe646('0x3d')]);_0x383f81[_0xe646('0x40')]=_[_0xe646('0x3f')](_0x1e5ded[_0xe646('0x3c')],qs[_0xe646('0x41')](_0x31e34d[_0xe646('0x3d')]['fields']));_0x383f81[_0xe646('0x40')]=_0x383f81['attributes'][_0xe646('0x42')]?_0x383f81[_0xe646('0x40')]:_0x1e5ded[_0xe646('0x3c')];if(!_0x31e34d[_0xe646('0x3d')][_0xe646('0x43')]('nolimit')){_0x383f81[_0xe646('0x20')]=qs[_0xe646('0x20')](_0x31e34d[_0xe646('0x3d')][_0xe646('0x20')]);_0x383f81[_0xe646('0x1f')]=qs['offset'](_0x31e34d[_0xe646('0x3d')][_0xe646('0x1f')]);}_0x383f81['order']=qs[_0xe646('0x45')](_0x31e34d['query'][_0xe646('0x45')]);_0x383f81[_0xe646('0x46')]=qs['filters'](_['pick'](_0x31e34d['query'],_0x1e5ded[_0xe646('0x3e')]));_0x383f81[_0xe646('0x46')][_0xe646('0x65')]=_0x574bab['id'];if(_0x31e34d[_0xe646('0x3d')][_0xe646('0x2a')]){_0x383f81['where']=_['merge'](_0x383f81['where'],{'$or':_[_0xe646('0x37')](_0x383f81[_0xe646('0x40')],function(_0x16873d){var _0x449c03={};_0x449c03[_0x16873d]={'$like':'%'+_0x31e34d['query'][_0xe646('0x2a')]+'%'};return _0x449c03;})});}_0x383f81=_[_0xe646('0x50')]({},_0x383f81,_0x31e34d['options']);return db[_0xe646('0x67')][_0xe646('0x49')]({'where':_0x383f81[_0xe646('0x46')]})['then'](function(_0x59a6db){_0x3899c2[_0xe646('0x49')]=_0x59a6db;if(_0x31e34d['query'][_0xe646('0x4f')]){_0x383f81[_0xe646('0x5c')]=[{'all':!![]}];}return db[_0xe646('0x67')][_0xe646('0x4a')](_0x383f81);})['then'](function(_0x3e2294){_0x3899c2[_0xe646('0x4b')]=_0x3e2294;return _0x3899c2;});}})[_0xe646('0x25')](respondWithFilteredResult(_0x3ec453,_0x383f81))[_0xe646('0x4c')](handleError(_0x3ec453,null));};exports['getHopperFinals']=function(_0x44952b,_0x5527c2,_0x4176a9){var _0x1bd09e={'raw':!![],'where':{}};var _0x380271={};var _0x44411b={'count':0x0,'rows':[]};return db[_0xe646('0x38')]['findOne']({'where':{'id':_0x44952b[_0xe646('0x4d')]['id']}})[_0xe646('0x25')](handleEntityNotFound(_0x5527c2,null))['then'](function(_0x3cbfff){if(_0x3cbfff){_0x380271[_0xe646('0x3c')]=_[_0xe646('0x4e')](db['CmHopperFinal'][_0xe646('0x39')]);_0x380271[_0xe646('0x3d')]=_[_0xe646('0x4e')](_0x44952b[_0xe646('0x3d')]);_0x380271[_0xe646('0x3e')]=_[_0xe646('0x3f')](_0x380271[_0xe646('0x3c')],_0x380271[_0xe646('0x3d')]);_0x1bd09e[_0xe646('0x40')]=_['intersection'](_0x380271['model'],qs['fields'](_0x44952b[_0xe646('0x3d')][_0xe646('0x41')]));_0x1bd09e[_0xe646('0x40')]=_0x1bd09e['attributes'][_0xe646('0x42')]?_0x1bd09e[_0xe646('0x40')]:_0x380271[_0xe646('0x3c')];if(!_0x44952b[_0xe646('0x3d')][_0xe646('0x43')](_0xe646('0x68'))){_0x1bd09e[_0xe646('0x20')]=qs[_0xe646('0x20')](_0x44952b[_0xe646('0x3d')][_0xe646('0x20')]);_0x1bd09e['offset']=qs[_0xe646('0x1f')](_0x44952b[_0xe646('0x3d')][_0xe646('0x1f')]);}_0x1bd09e[_0xe646('0x44')]=qs[_0xe646('0x45')](_0x44952b[_0xe646('0x3d')]['sort']);_0x1bd09e[_0xe646('0x46')]=qs[_0xe646('0x3e')](_[_0xe646('0x64')](_0x44952b[_0xe646('0x3d')],_0x380271[_0xe646('0x3e')]));_0x1bd09e[_0xe646('0x46')][_0xe646('0x65')]=_0x3cbfff['id'];if(_0x44952b['query']['filter']){_0x1bd09e[_0xe646('0x46')]=_[_0xe646('0x50')](_0x1bd09e[_0xe646('0x46')],{'$or':_[_0xe646('0x37')](_0x1bd09e[_0xe646('0x40')],function(_0x20eba7){var _0x5791bc={};_0x5791bc[_0x20eba7]={'$like':'%'+_0x44952b[_0xe646('0x3d')][_0xe646('0x2a')]+'%'};return _0x5791bc;})});}_0x1bd09e=_[_0xe646('0x50')]({},_0x1bd09e,_0x44952b['options']);return db[_0xe646('0x69')][_0xe646('0x49')]({'where':_0x1bd09e['where']})[_0xe646('0x25')](function(_0x51fa39){_0x44411b[_0xe646('0x49')]=_0x51fa39;if(_0x44952b['query'][_0xe646('0x4f')]){_0x1bd09e[_0xe646('0x5c')]=[{'all':!![]}];}return db[_0xe646('0x69')][_0xe646('0x4a')](_0x1bd09e);})[_0xe646('0x25')](function(_0x47ee02){_0x44411b[_0xe646('0x4b')]=_0x47ee02;return _0x44411b;});}})[_0xe646('0x25')](respondWithFilteredResult(_0x5527c2,_0x1bd09e))[_0xe646('0x4c')](handleError(_0x5527c2,null));};exports['getHopperBlacks']=function(_0x6f54ab,_0x3acf87,_0x13500b){var _0x52a504={'raw':!![],'where':{}};var _0x61705f={};var _0x299f98={'count':0x0,'rows':[]};return db[_0xe646('0x38')]['findOne']({'where':{'id':_0x6f54ab[_0xe646('0x4d')]['id']}})[_0xe646('0x25')](handleEntityNotFound(_0x3acf87,null))[_0xe646('0x25')](function(_0xaf7804){if(_0xaf7804){_0x61705f[_0xe646('0x3c')]=_['keys'](db[_0xe646('0x6a')][_0xe646('0x39')]);_0x61705f[_0xe646('0x3d')]=_[_0xe646('0x4e')](_0x6f54ab[_0xe646('0x3d')]);_0x61705f['filters']=_[_0xe646('0x3f')](_0x61705f[_0xe646('0x3c')],_0x61705f[_0xe646('0x3d')]);_0x52a504[_0xe646('0x40')]=_['intersection'](_0x61705f[_0xe646('0x3c')],qs[_0xe646('0x41')](_0x6f54ab[_0xe646('0x3d')]['fields']));_0x52a504[_0xe646('0x40')]=_0x52a504[_0xe646('0x40')][_0xe646('0x42')]?_0x52a504[_0xe646('0x40')]:_0x61705f[_0xe646('0x3c')];if(!_0x6f54ab['query'][_0xe646('0x43')]('nolimit')){_0x52a504['limit']=qs[_0xe646('0x20')](_0x6f54ab[_0xe646('0x3d')][_0xe646('0x20')]);_0x52a504[_0xe646('0x1f')]=qs[_0xe646('0x1f')](_0x6f54ab[_0xe646('0x3d')]['offset']);}_0x52a504[_0xe646('0x44')]=qs[_0xe646('0x45')](_0x6f54ab[_0xe646('0x3d')]['sort']);_0x52a504[_0xe646('0x46')]=qs[_0xe646('0x3e')](_[_0xe646('0x64')](_0x6f54ab['query'],_0x61705f['filters']));_0x52a504['where'][_0xe646('0x65')]=_0xaf7804['id'];if(_0x6f54ab[_0xe646('0x3d')][_0xe646('0x2a')]){_0x52a504[_0xe646('0x46')]=_[_0xe646('0x50')](_0x52a504['where'],{'$or':_['map'](_0x52a504[_0xe646('0x40')],function(_0x104269){var _0x58bfa8={};_0x58bfa8[_0x104269]={'$like':'%'+_0x6f54ab[_0xe646('0x3d')][_0xe646('0x2a')]+'%'};return _0x58bfa8;})});}_0x52a504=_['merge']({},_0x52a504,_0x6f54ab[_0xe646('0x48')]);return db['CmHopperBlack'][_0xe646('0x49')]({'where':_0x52a504[_0xe646('0x46')]})[_0xe646('0x25')](function(_0x8cfb91){_0x299f98['count']=_0x8cfb91;if(_0x6f54ab[_0xe646('0x3d')][_0xe646('0x4f')]){_0x52a504['include']=[{'all':!![]}];}return db[_0xe646('0x6a')][_0xe646('0x4a')](_0x52a504);})['then'](function(_0x18e62a){_0x299f98[_0xe646('0x4b')]=_0x18e62a;return _0x299f98;});}})[_0xe646('0x25')](respondWithFilteredResult(_0x3acf87,_0x52a504))[_0xe646('0x4c')](handleError(_0x3acf87,null));};exports[_0xe646('0x6b')]=function(_0x3c9ea5,_0x4f2124,_0x5a5408){var _0x334e69={};var _0xe1ce43={};var _0x3054d4;var _0x580dd2;return db[_0xe646('0x38')][_0xe646('0x62')]({'where':{'id':_0x3c9ea5[_0xe646('0x4d')]['id']}})[_0xe646('0x25')](handleEntityNotFound(_0x4f2124,null))[_0xe646('0x25')](function(_0x226392){if(_0x226392){_0x3054d4=_0x226392;_0xe1ce43['model']=_[_0xe646('0x4e')](db[_0xe646('0x6c')][_0xe646('0x39')]);_0xe1ce43[_0xe646('0x3d')]=_[_0xe646('0x4e')](_0x3c9ea5[_0xe646('0x3d')]);_0xe1ce43[_0xe646('0x3e')]=_['intersection'](_0xe1ce43['model'],_0xe1ce43[_0xe646('0x3d')]);_0x334e69[_0xe646('0x40')]=_[_0xe646('0x3f')](_0xe1ce43[_0xe646('0x3c')],qs[_0xe646('0x41')](_0x3c9ea5[_0xe646('0x3d')]['fields']));_0x334e69[_0xe646('0x40')]=_0x334e69[_0xe646('0x40')][_0xe646('0x42')]?_0x334e69['attributes']:_0xe1ce43['model'];_0x334e69[_0xe646('0x44')]=qs[_0xe646('0x45')](_0x3c9ea5['query'][_0xe646('0x45')]);_0x334e69['where']=qs[_0xe646('0x3e')](_[_0xe646('0x64')](_0x3c9ea5[_0xe646('0x3d')],_0xe1ce43['filters']));if(_0x3c9ea5[_0xe646('0x3d')][_0xe646('0x2a')]){_0x334e69[_0xe646('0x46')]=_[_0xe646('0x50')](_0x334e69[_0xe646('0x46')],{'$or':_['map'](_0x334e69[_0xe646('0x40')],function(_0x37559c){var _0x1f4b67={};_0x1f4b67[_0x37559c]={'$like':'%'+_0x3c9ea5['query'][_0xe646('0x2a')]+'%'};return _0x1f4b67;})});}_0x334e69=_[_0xe646('0x50')]({},_0x334e69,_0x3c9ea5[_0xe646('0x48')]);return _0x3054d4[_0xe646('0x6b')](_0x334e69);}})[_0xe646('0x25')](function(_0x39e359){if(_0x39e359){_0x580dd2=_0x39e359[_0xe646('0x42')];if(!_0x3c9ea5[_0xe646('0x3d')][_0xe646('0x43')](_0xe646('0x68'))){_0x334e69[_0xe646('0x20')]=qs[_0xe646('0x20')](_0x3c9ea5['query'][_0xe646('0x20')]);_0x334e69[_0xe646('0x1f')]=qs[_0xe646('0x1f')](_0x3c9ea5[_0xe646('0x3d')][_0xe646('0x1f')]);}return _0x3054d4[_0xe646('0x6b')](_0x334e69);}})[_0xe646('0x25')](function(_0xf38c98){if(_0xf38c98){return _0xf38c98?{'count':_0x580dd2,'rows':_0xf38c98}:null;}})[_0xe646('0x25')](respondWithResult(_0x4f2124,null))[_0xe646('0x4c')](handleError(_0x4f2124,null));};exports[_0xe646('0x6d')]=function(_0x33e3f4,_0xf7442c,_0x5a5b5a){var _0x2ba79b=_0x33e3f4[_0xe646('0x52')][_0xe646('0x6e')];var _0x4f37de=_['map'](_0x2ba79b,'id');return db[_0xe646('0x6c')][_0xe646('0x4a')]({'where':{'id':_0x4f37de},'attributes':['id'],'include':[{'model':db[_0xe646('0x6f')],'as':_0xe646('0x70'),'attributes':['id',_0xe646('0x2f'),_0xe646('0x71'),_0xe646('0x72'),_0xe646('0x73')],'raw':!![]}]})[_0xe646('0x25')](function(_0x523bf3){if(_0x523bf3){var _0x57682e=_[_0xe646('0x74')](_0x523bf3,function(_0x55abed){var _0x2caef4=_0x55abed[_0xe646('0x26')]({'plain':!![]});_0x2caef4[_0xe646('0x70')][_0xe646('0x75')](function(_0x4d054b){_0x4d054b[_0xe646('0x76')]=_[_0xe646('0x2e')](_0x2ba79b,{'id':_0x2caef4['id']})[_0xe646('0x76')];});return _0x2caef4['Agents'];});return db[_0xe646('0x38')][_0xe646('0x2e')]({'where':{'id':_0x33e3f4[_0xe646('0x4d')]['id']}})[_0xe646('0x25')](function(_0x3bc07e){return db['sequelize']['transaction'](function(_0x3ed24b){return _0x3bc07e[_0xe646('0x6d')](_0x4f37de,{'transaction':_0x3ed24b})[_0xe646('0x25')](function(){return BPromise[_0xe646('0x77')](_0x57682e,function(_0x998fd9){return db[_0xe646('0x78')]['findOrCreate']({'where':{'UserId':_0x998fd9['id'],'VoiceQueueId':_0x33e3f4[_0xe646('0x4d')]['id']},'defaults':{'penalty':_0x998fd9[_0xe646('0x76')]},'transaction':_0x3ed24b});});})[_0xe646('0x25')](function(){return BPromise['each'](_[_0xe646('0x2a')](_0x57682e,{'online':!![]}),function(_0xdede8c){return db['UserVoiceQueueRt']['upsert']({'membername':_0xdede8c['name'],'UserId':_0xdede8c['id'],'queue_name':_0x3bc07e[_0xe646('0x2f')],'VoiceQueueId':_0x3bc07e['id'],'interface':_[_0xe646('0x79')](_0xdede8c['interface'])?util[_0xe646('0x7a')](_0xe646('0x7b'),_0xdede8c[_0xe646('0x2f')]):_0xdede8c[_0xe646('0x73')],'paused':_0xdede8c['voicePause']||![],'penalty':_0xdede8c['penalty']},{'transaction':_0x3ed24b});});})['then'](function(){_0x57682e['forEach'](function(_0x1ac18c){socket[_0xe646('0x7c')](_0xe646('0x7d'),{'UserId':_0x1ac18c['id'],'VoiceQueueId':_0x3bc07e['id']});});});});});}})[_0xe646('0x25')](respondWithStatusCode(_0xf7442c,null))[_0xe646('0x4c')](handleError(_0xf7442c,null));};exports['removeTeams']=function(_0x1644f7,_0x20def0,_0xe484f1){return db[_0xe646('0x6c')][_0xe646('0x4a')]({'where':{'id':_0x1644f7[_0xe646('0x3d')][_0xe646('0x7e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe646('0x70'),'attributes':['id'],'raw':!![]}]})[_0xe646('0x25')](handleEntityNotFound(_0x20def0,null))[_0xe646('0x25')](function(_0xff3073){var _0x1c3d8f=_['map'](_0xff3073,'id');var _0x1a359e=[];var _0x2413d8=[];var _0x525be4=squel['select']();_0x525be4[_0xe646('0x7f')](_0xe646('0x80'))[_0xe646('0x81')]('team_has_voice_queues','tq')[_0xe646('0x82')](_0xe646('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe646('0x46')](_0xe646('0x84'),_0x1644f7[_0xe646('0x4d')]['id']);for(var _0xf076e8=0x0;_0xf076e8<_0xff3073[_0xe646('0x42')];_0xf076e8+=0x1){let _0x2f86fc=_0xff3073[_0xf076e8];for(var _0xb4d47f=0x0;_0xb4d47f<_0x2f86fc[_0xe646('0x70')][_0xe646('0x42')];_0xb4d47f+=0x1){let _0xbd9e3d=_0x2f86fc[_0xe646('0x70')][_0xb4d47f];var _0x3098a5=_0x525be4[_0xe646('0x5b')]();_0x3098a5[_0xe646('0x46')](_0xe646('0x85'),_0xbd9e3d['id']);_0x2413d8[_0xe646('0x86')](db[_0xe646('0x87')]['query'](_0x3098a5[_0xe646('0x88')](),{'type':db[_0xe646('0x87')]['QueryTypes']['SELECT']})[_0xe646('0x25')](function(_0x55cf6d){if(_0x55cf6d[_0xe646('0x42')]===0x1){return _0xbd9e3d['id'];}else{var _0x14f768=_['every'](_[_0xe646('0x37')](_0x55cf6d,_0xe646('0x89')),function(_0x12a914){return _['includes'](_0x1c3d8f,_0x12a914);});if(_0x14f768){return _0xbd9e3d['id'];}}}));}}return BPromise[_0xe646('0x8a')](_0x2413d8)[_0xe646('0x25')](function(_0x2744b1){_0x1a359e=_(_0x1a359e)[_0xe646('0x8b')](_0x2744b1)[_0xe646('0x8c')]()[_0xe646('0x2b')]();return db[_0xe646('0x38')][_0xe646('0x2e')]({'where':{'id':_0x1644f7[_0xe646('0x4d')]['id']}})['then'](function(_0x507065){return db[_0xe646('0x87')][_0xe646('0x8d')](function(_0x57a866){return _0x507065[_0xe646('0x8e')](_0x1644f7[_0xe646('0x3d')]['ids'],{'transaction':_0x57a866})[_0xe646('0x25')](function(){if(!_['isEmpty'](_0x1a359e)){return _0x507065[_0xe646('0x8f')](_0x1a359e,{'transaction':_0x57a866})['then'](function(){return db[_0xe646('0x90')][_0xe646('0x31')]({'where':{'VoiceQueueId':_0x1644f7[_0xe646('0x4d')]['id'],'UserId':_0x1a359e},'transaction':_0x57a866});});}})['then'](function(){_0x1a359e[_0xe646('0x75')](function(_0x1253e0){socket[_0xe646('0x7c')]('userVoiceQueue:remove',{'UserId':_0x1253e0,'VoiceQueueId':_0x507065['id']});});});});});});})[_0xe646('0x25')](respondWithStatusCode(_0x20def0,null))['catch'](handleError(_0x20def0,null));};exports[_0xe646('0x91')]=function(_0x5a3896,_0xa26c27,_0x2c373f){var _0x3476aa,_0x3c92c0;return db[_0xe646('0x38')][_0xe646('0x2e')]({'where':{'id':_0x5a3896['params']['id']}})['then'](handleEntityNotFound(_0xa26c27,null))['then'](function(_0x5b9a98){if(_0x5b9a98){_0x3c92c0=_0x5b9a98;return _0x5b9a98[_0xe646('0x91')](_0x5a3896[_0xe646('0x52')][_0xe646('0x7e')],_['omit'](_0x5a3896['body'],[_0xe646('0x7e'),'id'])||{})[_0xe646('0x92')](function(_0x211ad8){for(var _0x55407b=0x0;_0x55407b<_0x5a3896['body']['ids']['length'];_0x55407b+=0x1){socket[_0xe646('0x7c')](_0xe646('0x7d'),{'UserId':_0x5a3896[_0xe646('0x52')][_0xe646('0x7e')][_0x55407b],'VoiceQueueId':_0x5a3896[_0xe646('0x4d')]['id']});}return _0x211ad8;});}})[_0xe646('0x25')](function(_0x31920b){_0x3476aa=_0x31920b||[];if(_0x3c92c0){return db[_0xe646('0x6f')]['findAll']({'where':{'id':_0x5a3896[_0xe646('0x52')]['ids']},'attributes':['id',_0xe646('0x2f'),'online',_0xe646('0x72'),_0xe646('0x73')],'raw':!![]});}})[_0xe646('0x25')](function(_0x330b9a){if(!_[_0xe646('0x93')](_0x330b9a)){var _0x404a4f=[];for(var _0x104a73=0x0;_0x104a73<_0x330b9a['length'];_0x104a73++){if(_0x330b9a[_0x104a73]['online']){_0x404a4f[_0xe646('0x86')](db[_0xe646('0x90')]['upsert']({'membername':_0x330b9a[_0x104a73]['name'],'UserId':_0x330b9a[_0x104a73]['id'],'queue_name':_0x3c92c0['name'],'VoiceQueueId':_0x3c92c0['id'],'interface':_['isNil'](_0x330b9a[_0x104a73][_0xe646('0x73')])?util[_0xe646('0x7a')]('SIP/%s',_0x330b9a[_0x104a73][_0xe646('0x2f')]):_0x330b9a[_0x104a73][_0xe646('0x73')],'paused':_0x330b9a[_0x104a73][_0xe646('0x72')]||![],'penalty':_0x5a3896[_0xe646('0x52')][_0xe646('0x76')]||0x0}));}}return BPromise[_0xe646('0x8a')](_0x404a4f);}})[_0xe646('0x25')](function(){return _0x3476aa;})[_0xe646('0x25')](respondWithResult(_0xa26c27,null))[_0xe646('0x4c')](handleError(_0xa26c27,null));};exports[_0xe646('0x8f')]=function(_0x36e799,_0x5ddcb4,_0x21d12f){return db['VoiceQueue'][_0xe646('0x2e')]({'where':{'id':_0x36e799[_0xe646('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ddcb4,null))[_0xe646('0x25')](function(_0x1d6b81){if(_0x1d6b81){return _0x1d6b81[_0xe646('0x8f')](_0x36e799['query'][_0xe646('0x7e')])['then'](function(){if(_[_0xe646('0x94')](_0x36e799[_0xe646('0x3d')][_0xe646('0x7e')])){for(var _0x150d74=0x0;_0x150d74<_0x36e799[_0xe646('0x3d')][_0xe646('0x7e')][_0xe646('0x42')];_0x150d74+=0x1){socket[_0xe646('0x7c')](_0xe646('0x95'),{'UserId':Number(_0x36e799[_0xe646('0x3d')][_0xe646('0x7e')][_0x150d74]),'VoiceQueueId':Number(_0x36e799[_0xe646('0x4d')]['id'])});}}else{socket['emit'](_0xe646('0x95'),{'UserId':Number(_0x36e799[_0xe646('0x3d')][_0xe646('0x7e')]),'VoiceQueueId':Number(_0x36e799[_0xe646('0x4d')]['id'])});}});}})[_0xe646('0x25')](function(_0x1c5b7e){return db['UserVoiceQueueRt'][_0xe646('0x31')]({'where':{'VoiceQueueId':_0x36e799[_0xe646('0x4d')]['id'],'UserId':_0x36e799['query']['ids']}})[_0xe646('0x25')](function(){return _0x1c5b7e;});})[_0xe646('0x25')](respondWithStatusCode(_0x5ddcb4,null))[_0xe646('0x4c')](handleError(_0x5ddcb4,null));};exports['getAgents']=function(_0x3f4d2e,_0x4f953e,_0x1335fc){var _0x15e5c8={};var _0x271b90={};var _0x4703e1;var _0x224ce6;return db['VoiceQueue']['findOne']({'where':{'id':_0x3f4d2e['params']['id']}})['then'](handleEntityNotFound(_0x4f953e,null))['then'](function(_0x5f4ec3){if(_0x5f4ec3){_0x4703e1=_0x5f4ec3;_0x271b90[_0xe646('0x3c')]=_['keys'](db[_0xe646('0x6f')][_0xe646('0x39')]);_0x271b90[_0xe646('0x3d')]=_['keys'](_0x3f4d2e[_0xe646('0x3d')]);_0x271b90[_0xe646('0x3e')]=_[_0xe646('0x3f')](_0x271b90[_0xe646('0x3c')],_0x271b90[_0xe646('0x3d')]);_0x15e5c8['attributes']=_[_0xe646('0x3f')](_0x271b90[_0xe646('0x3c')],qs[_0xe646('0x41')](_0x3f4d2e[_0xe646('0x3d')][_0xe646('0x41')]));_0x15e5c8[_0xe646('0x40')]=_0x15e5c8[_0xe646('0x40')][_0xe646('0x42')]?_0x15e5c8[_0xe646('0x40')]:_0x271b90['model'];_0x15e5c8[_0xe646('0x44')]=qs['sort'](_0x3f4d2e['query'][_0xe646('0x45')]);_0x15e5c8[_0xe646('0x46')]=qs[_0xe646('0x3e')](_[_0xe646('0x64')](_0x3f4d2e[_0xe646('0x3d')],_0x271b90[_0xe646('0x3e')]));if(_0x3f4d2e['query'][_0xe646('0x2a')]){_0x15e5c8['where']=_[_0xe646('0x50')](_0x15e5c8[_0xe646('0x46')],{'$or':_[_0xe646('0x37')](_0x15e5c8[_0xe646('0x40')],function(_0x523d13){var _0x2f9fbf={};_0x2f9fbf[_0x523d13]={'$like':'%'+_0x3f4d2e[_0xe646('0x3d')][_0xe646('0x2a')]+'%'};return _0x2f9fbf;})});}_0x15e5c8=_['merge']({},_0x15e5c8,_0x3f4d2e[_0xe646('0x48')]);return _0x4703e1['getAgents'](_0x15e5c8);}})[_0xe646('0x25')](function(_0x327b34){if(_0x327b34){_0x224ce6=_0x327b34['length'];if(!_0x3f4d2e[_0xe646('0x3d')][_0xe646('0x43')](_0xe646('0x68'))){_0x15e5c8[_0xe646('0x20')]=qs[_0xe646('0x20')](_0x3f4d2e[_0xe646('0x3d')][_0xe646('0x20')]);_0x15e5c8['offset']=qs[_0xe646('0x1f')](_0x3f4d2e[_0xe646('0x3d')][_0xe646('0x1f')]);}return _0x4703e1[_0xe646('0x96')](_0x15e5c8);}})[_0xe646('0x25')](function(_0x2970b2){if(_0x2970b2){return _0x2970b2?{'count':_0x224ce6,'rows':_0x2970b2}:null;}})[_0xe646('0x25')](respondWithResult(_0x4f953e,null))[_0xe646('0x4c')](handleError(_0x4f953e,null));};exports[_0xe646('0x97')]=function(_0x327ab6,_0xe6c3bf,_0x509305){var _0x3a5b20={};var _0x19ccd5={};var _0x273a02;var _0x32f8c3;return db[_0xe646('0x38')][_0xe646('0x62')]({'where':{'id':_0x327ab6[_0xe646('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe6c3bf,null))[_0xe646('0x25')](function(_0x29d022){if(_0x29d022){_0x273a02=_0x29d022;_0x19ccd5[_0xe646('0x3c')]=_[_0xe646('0x4e')](db[_0xe646('0x90')][_0xe646('0x39')]);_0x19ccd5[_0xe646('0x3d')]=_[_0xe646('0x4e')](_0x327ab6[_0xe646('0x3d')]);_0x19ccd5[_0xe646('0x3e')]=_[_0xe646('0x3f')](_0x19ccd5[_0xe646('0x3c')],_0x19ccd5[_0xe646('0x3d')]);_0x3a5b20[_0xe646('0x40')]=_[_0xe646('0x3f')](_0x19ccd5[_0xe646('0x3c')],qs['fields'](_0x327ab6[_0xe646('0x3d')][_0xe646('0x41')]));_0x3a5b20[_0xe646('0x40')]=_0x3a5b20['attributes']['length']?_0x3a5b20[_0xe646('0x40')]:_0x19ccd5[_0xe646('0x3c')];_0x3a5b20[_0xe646('0x44')]=qs['sort'](_0x327ab6['query'][_0xe646('0x45')]);_0x3a5b20['where']=qs[_0xe646('0x3e')](_['pick'](_0x327ab6[_0xe646('0x3d')],_0x19ccd5['filters']));if(_0x327ab6['query']['filter']){_0x3a5b20['where']=_[_0xe646('0x50')](_0x3a5b20[_0xe646('0x46')],{'$or':_[_0xe646('0x37')](_0x3a5b20[_0xe646('0x40')],function(_0x35ebb1){var _0xe64e7c={};_0xe64e7c[_0x35ebb1]={'$like':'%'+_0x327ab6[_0xe646('0x3d')]['filter']+'%'};return _0xe64e7c;})});}_0x3a5b20=_[_0xe646('0x50')]({},_0x3a5b20,_0x327ab6['options']);return _0x273a02[_0xe646('0x97')](_0x3a5b20);}})[_0xe646('0x25')](function(_0x4c2b53){if(_0x4c2b53){_0x32f8c3=_0x4c2b53['length'];if(!_0x327ab6[_0xe646('0x3d')][_0xe646('0x43')](_0xe646('0x68'))){_0x3a5b20[_0xe646('0x20')]=qs[_0xe646('0x20')](_0x327ab6[_0xe646('0x3d')][_0xe646('0x20')]);_0x3a5b20[_0xe646('0x1f')]=qs[_0xe646('0x1f')](_0x327ab6[_0xe646('0x3d')][_0xe646('0x1f')]);}return _0x273a02[_0xe646('0x97')](_0x3a5b20);}})[_0xe646('0x25')](function(_0x3a00ab){return _0x3a00ab?{'count':_0x32f8c3,'rows':_0x3a00ab}:null;})[_0xe646('0x25')](respondWithResult(_0xe6c3bf,null))['catch'](handleError(_0xe6c3bf,null));};exports['getLists']=function(_0x551edf,_0x47dec3,_0x5c531d){var _0x521d40={};var _0x5298df={};var _0x220b7d;var _0x21e4f9;return db[_0xe646('0x38')][_0xe646('0x62')]({'where':{'id':_0x551edf[_0xe646('0x4d')]['id']}})[_0xe646('0x25')](handleEntityNotFound(_0x47dec3,null))[_0xe646('0x25')](function(_0x187cf0){if(_0x187cf0){_0x220b7d=_0x187cf0;_0x5298df['model']=_[_0xe646('0x4e')](db[_0xe646('0x98')]['rawAttributes']);_0x5298df[_0xe646('0x3d')]=_[_0xe646('0x4e')](_0x551edf[_0xe646('0x3d')]);_0x5298df['filters']=_['intersection'](_0x5298df['model'],_0x5298df[_0xe646('0x3d')]);_0x521d40[_0xe646('0x40')]=_['intersection'](_0x5298df['model'],qs[_0xe646('0x41')](_0x551edf[_0xe646('0x3d')][_0xe646('0x41')]));_0x521d40[_0xe646('0x40')]=_0x521d40[_0xe646('0x40')]['length']?_0x521d40[_0xe646('0x40')]:_0x5298df[_0xe646('0x3c')];_0x521d40['order']=qs[_0xe646('0x45')](_0x551edf[_0xe646('0x3d')][_0xe646('0x45')]);_0x521d40[_0xe646('0x46')]=qs[_0xe646('0x3e')](_[_0xe646('0x64')](_0x551edf['query'],_0x5298df[_0xe646('0x3e')]));if(_0x551edf[_0xe646('0x3d')][_0xe646('0x2a')]){_0x521d40[_0xe646('0x46')]=_['merge'](_0x521d40[_0xe646('0x46')],{'$or':_[_0xe646('0x37')](_0x521d40[_0xe646('0x40')],function(_0x5322a9){var _0x5b486d={};_0x5b486d[_0x5322a9]={'$like':'%'+_0x551edf[_0xe646('0x3d')]['filter']+'%'};return _0x5b486d;})});}_0x521d40=_[_0xe646('0x50')]({},_0x521d40,_0x551edf[_0xe646('0x48')]);return _0x220b7d['getLists'](_0x521d40);}})[_0xe646('0x25')](function(_0x499179){if(_0x499179){_0x21e4f9=_0x499179[_0xe646('0x42')];if(!_0x551edf['query']['hasOwnProperty']('nolimit')){_0x521d40[_0xe646('0x20')]=qs[_0xe646('0x20')](_0x551edf[_0xe646('0x3d')][_0xe646('0x20')]);_0x521d40['offset']=qs[_0xe646('0x1f')](_0x551edf[_0xe646('0x3d')][_0xe646('0x1f')]);}return _0x220b7d['getLists'](_0x521d40);}})[_0xe646('0x25')](function(_0x5cad57){if(_0x5cad57){return _0x5cad57?{'count':_0x21e4f9,'rows':_0x5cad57}:null;}})[_0xe646('0x25')](respondWithResult(_0x47dec3,null))[_0xe646('0x4c')](handleError(_0x47dec3,null));};exports[_0xe646('0x99')]=function(_0x4eafb5,_0xe2da24,_0xaa403){var _0x5a2d85,_0x13ff37;return db['VoiceQueue'][_0xe646('0x2e')]({'where':{'id':_0x4eafb5[_0xe646('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe2da24,null))[_0xe646('0x25')](function(_0xeea719){if(_0xeea719){_0x13ff37=_0xeea719;return _0xeea719['addLists'](_0x4eafb5[_0xe646('0x52')][_0xe646('0x7e')],_[_0xe646('0x5d')](_0x4eafb5[_0xe646('0x52')],[_0xe646('0x7e'),'id'])||{});}return null;})[_0xe646('0x92')](function(_0x480bb0){var _0x26f127;_0x5a2d85=_0x480bb0||[];var _0xfbcfc1=[];if(_0x480bb0){for(var _0x4059a6=0x0;_0x4059a6<_0x480bb0['length'];_0x4059a6+=0x1){var _0x33cc98=_0x480bb0[_0x4059a6][_0xe646('0x26')]({'plain':!![]});_0x13ff37[_0xe646('0x9a')]=_0x4eafb5['body'][_0xe646('0x9a')]?_0x4eafb5[_0xe646('0x52')][_0xe646('0x9a')]:_0x13ff37[_0xe646('0x9a')];switch(_0x13ff37[_0xe646('0x9a')]){case _0xe646('0x9b'):_0x26f127=squel[_0xe646('0x9c')]()[_0xe646('0x9d')](_0xe646('0x9e'))[_0xe646('0x9f')]([_0xe646('0xa0'),_0xe646('0xa1'),_0xe646('0xa2'),_0xe646('0xa3'),_0xe646('0x65'),'createdAt',_0xe646('0x5f')],squel[_0xe646('0xa4')]()[_0xe646('0x7f')]('phone',_0xe646('0xa0'))[_0xe646('0x7f')](_0xe646('0xa5'),_0xe646('0xa1'))[_0xe646('0x7f')]('id',_0xe646('0xa2'))[_0xe646('0x7f')](_0x33cc98[_0xe646('0xa6')]['toString'](),'ListId')['field'](_0x4eafb5['params']['id'][_0xe646('0x88')](),'VoiceQueueId')[_0xe646('0x7f')]('NOW()','createdAt')[_0xe646('0x7f')](_0xe646('0xa5'),'updatedAt')[_0xe646('0x81')](_0xe646('0xa7'))[_0xe646('0x46')]('deletedAt\x20IS\x20NULL')[_0xe646('0x46')](_0xe646('0xa8'),_0x33cc98[_0xe646('0xa6')][_0xe646('0x88')]())['where'](_0xe646('0xa9'))['where'](_0xe646('0xaa'),squel[_0xe646('0xa4')]()[_0xe646('0x7f')](_0xe646('0xab'))['from'](_0xe646('0xac'))['where'](_0xe646('0x84'),_0x4eafb5[_0xe646('0x4d')]['id'][_0xe646('0x88')]()))['where'](_0xe646('0xaa'),squel[_0xe646('0xa4')]()[_0xe646('0x7f')](_0xe646('0xad'))['from'](_0xe646('0x9e'))[_0xe646('0x46')]('VoiceQueueId\x20=\x20?',_0x4eafb5[_0xe646('0x4d')]['id'][_0xe646('0x88')]())))[_0xe646('0x88')]();break;case _0xe646('0xae'):_0x26f127=squel[_0xe646('0x9c')]()['into'](_0xe646('0x9e'))[_0xe646('0x9f')]([_0xe646('0xa0'),_0xe646('0xa1'),_0xe646('0xa2'),_0xe646('0xa3'),_0xe646('0x65'),_0xe646('0x5e'),'updatedAt'],squel['select']()['field'](_0xe646('0xa0'),_0xe646('0xa0'))[_0xe646('0x7f')](_0xe646('0xa5'),_0xe646('0xa1'))['field']('id','ContactId')[_0xe646('0x7f')](_0x33cc98[_0xe646('0xa6')][_0xe646('0x88')](),_0xe646('0xa3'))[_0xe646('0x7f')](_0x4eafb5['params']['id'][_0xe646('0x88')](),_0xe646('0x65'))[_0xe646('0x7f')]('NOW()',_0xe646('0x5e'))['field']('NOW()',_0xe646('0x5f'))[_0xe646('0x81')](_0xe646('0xa7'))[_0xe646('0x46')](_0xe646('0xaf'))['where'](_0xe646('0xa8'),_0x33cc98[_0xe646('0xa6')][_0xe646('0x88')]())[_0xe646('0x46')](_0xe646('0xa9'))[_0xe646('0x46')](_0xe646('0xaa'),squel[_0xe646('0xa4')]()['field'](_0xe646('0xad'))[_0xe646('0x81')](_0xe646('0x9e'))['where'](_0xe646('0x84'),_0x4eafb5[_0xe646('0x4d')]['id']['toString']())))[_0xe646('0x88')]();break;default:_0x26f127=squel[_0xe646('0x9c')]()[_0xe646('0x9d')](_0xe646('0x9e'))[_0xe646('0x9f')]([_0xe646('0xa0'),_0xe646('0xa1'),_0xe646('0xa2'),'ListId',_0xe646('0x65'),_0xe646('0x5e'),_0xe646('0x5f')],squel[_0xe646('0xa4')]()['field'](_0xe646('0xa0'),_0xe646('0xa0'))[_0xe646('0x7f')](_0xe646('0xa5'),_0xe646('0xa1'))[_0xe646('0x7f')]('id',_0xe646('0xa2'))[_0xe646('0x7f')](_0x33cc98[_0xe646('0xa6')][_0xe646('0x88')](),'ListId')['field'](_0x4eafb5[_0xe646('0x4d')]['id'][_0xe646('0x88')](),'VoiceQueueId')['field']('NOW()','createdAt')[_0xe646('0x7f')](_0xe646('0xa5'),_0xe646('0x5f'))[_0xe646('0x81')](_0xe646('0xa7'))[_0xe646('0x46')]('deletedAt\x20IS\x20NULL')[_0xe646('0x46')](_0xe646('0xa8'),_0x33cc98[_0xe646('0xa6')][_0xe646('0x88')]())[_0xe646('0x46')](_0xe646('0xa9')))[_0xe646('0x88')]();}_0xfbcfc1[_0xe646('0x86')](db[_0xe646('0x87')][_0xe646('0x3d')](_0x26f127));}return BPromise[_0xe646('0x8a')](_0xfbcfc1);}})['then'](function(){return _0x5a2d85;})[_0xe646('0x25')](respondWithResult(_0xe2da24,null))[_0xe646('0x4c')](handleError(_0xe2da24,null));};exports['removeLists']=function(_0x54e428,_0x51b793,_0x4933a4){return db['VoiceQueue']['find']({'where':{'id':_0x54e428[_0xe646('0x4d')]['id']}})[_0xe646('0x25')](handleEntityNotFound(_0x51b793,null))[_0xe646('0x25')](function(_0xfbe1a0){if(_0xfbe1a0){return _0xfbe1a0[_0xe646('0xb0')](_0x54e428['query'][_0xe646('0x7e')]);}})[_0xe646('0x25')](function(_0x127bc3){if(_0x127bc3){return db[_0xe646('0x63')]['destroy']({'where':{'ListId':_0x54e428[_0xe646('0x3d')][_0xe646('0x7e')],'VoiceQueueId':_0x54e428['params']['id']}})['then'](function(){return _0x127bc3;});}})[_0xe646('0x25')](respondWithStatusCode(_0x51b793,null))[_0xe646('0x4c')](handleError(_0x51b793,null));};exports[_0xe646('0xb1')]=function(_0x58039e,_0x3adb32,_0x35bd6d){var _0x3abc82={};var _0x42908f={};var _0x2005a9;var _0x2549e9;return db[_0xe646('0x38')][_0xe646('0x62')]({'where':{'id':_0x58039e[_0xe646('0x4d')]['id']}})[_0xe646('0x25')](handleEntityNotFound(_0x3adb32,null))[_0xe646('0x25')](function(_0x2dfa28){if(_0x2dfa28){_0x2005a9=_0x2dfa28;_0x42908f['model']=_[_0xe646('0x4e')](db[_0xe646('0x98')][_0xe646('0x39')]);_0x42908f[_0xe646('0x3d')]=_[_0xe646('0x4e')](_0x58039e[_0xe646('0x3d')]);_0x42908f[_0xe646('0x3e')]=_[_0xe646('0x3f')](_0x42908f['model'],_0x42908f[_0xe646('0x3d')]);_0x3abc82['attributes']=_[_0xe646('0x3f')](_0x42908f[_0xe646('0x3c')],qs[_0xe646('0x41')](_0x58039e[_0xe646('0x3d')][_0xe646('0x41')]));_0x3abc82[_0xe646('0x40')]=_0x3abc82[_0xe646('0x40')]['length']?_0x3abc82[_0xe646('0x40')]:_0x42908f['model'];_0x3abc82[_0xe646('0x44')]=qs['sort'](_0x58039e['query'][_0xe646('0x45')]);_0x3abc82[_0xe646('0x46')]=qs[_0xe646('0x3e')](_[_0xe646('0x64')](_0x58039e[_0xe646('0x3d')],_0x42908f[_0xe646('0x3e')]));if(_0x58039e[_0xe646('0x3d')][_0xe646('0x2a')]){_0x3abc82['where']=_['merge'](_0x3abc82['where'],{'$or':_[_0xe646('0x37')](_0x3abc82[_0xe646('0x40')],function(_0xa95f73){var _0x59401d={};_0x59401d[_0xa95f73]={'$like':'%'+_0x58039e['query'][_0xe646('0x2a')]+'%'};return _0x59401d;})});}_0x3abc82=_[_0xe646('0x50')]({},_0x3abc82,_0x58039e[_0xe646('0x48')]);return _0x2005a9[_0xe646('0xb1')](_0x3abc82);}})[_0xe646('0x25')](function(_0x1581f4){if(_0x1581f4){_0x2549e9=_0x1581f4['length'];if(!_0x58039e[_0xe646('0x3d')]['hasOwnProperty'](_0xe646('0x68'))){_0x3abc82['limit']=qs[_0xe646('0x20')](_0x58039e[_0xe646('0x3d')]['limit']);_0x3abc82[_0xe646('0x1f')]=qs['offset'](_0x58039e[_0xe646('0x3d')][_0xe646('0x1f')]);}return _0x2005a9[_0xe646('0xb1')](_0x3abc82);}})[_0xe646('0x25')](function(_0x1eb7c7){if(_0x1eb7c7){return _0x1eb7c7?{'count':_0x2549e9,'rows':_0x1eb7c7}:null;}})['then'](respondWithResult(_0x3adb32,null))['catch'](handleError(_0x3adb32,null));};exports[_0xe646('0xb2')]=function(_0x137eb9,_0x32d4f0,_0x91c4ea){var _0x205553,_0x549fc5;return db['VoiceQueue'][_0xe646('0x2e')]({'where':{'id':_0x137eb9[_0xe646('0x4d')]['id']}})['then'](handleEntityNotFound(_0x32d4f0,null))[_0xe646('0x25')](function(_0x1ba840){if(_0x1ba840){_0x549fc5=_0x1ba840;return _0x1ba840[_0xe646('0xb2')](_0x137eb9[_0xe646('0x52')][_0xe646('0x7e')],_[_0xe646('0x5d')](_0x137eb9[_0xe646('0x52')],['ids','id'])||{});}return null;})['spread'](function(_0x554a49){var _0x42ec2e;_0x205553=_0x554a49||[];var _0x41582a=[];if(_0x554a49){for(var _0x116289=0x0;_0x116289<_0x554a49[_0xe646('0x42')];_0x116289+=0x1){var _0xd055d2=_0x554a49[_0x116289]['get']({'plain':!![]});_0x42ec2e=squel[_0xe646('0x9c')]()[_0xe646('0x9d')](_0xe646('0xb3'))['fromQuery']([_0xe646('0xa0'),'ContactId',_0xe646('0xa3'),_0xe646('0x65'),_0xe646('0x5e'),_0xe646('0x5f')],squel['select']()[_0xe646('0x7f')](_0xe646('0xa0'),_0xe646('0xa0'))['field']('id',_0xe646('0xa2'))[_0xe646('0x7f')](_0xd055d2[_0xe646('0xa6')][_0xe646('0x88')](),'ListId')[_0xe646('0x7f')](_0x137eb9[_0xe646('0x4d')]['id']['toString'](),_0xe646('0x65'))[_0xe646('0x7f')]('NOW()',_0xe646('0x5e'))[_0xe646('0x7f')](_0xe646('0xa5'),'updatedAt')[_0xe646('0x81')](_0xe646('0xa7'))[_0xe646('0x46')](_0xe646('0xaf'))['where'](_0xe646('0xa8'),_0xd055d2[_0xe646('0xa6')][_0xe646('0x88')]())[_0xe646('0x46')](_0xe646('0xa9')))[_0xe646('0x88')]();_0x41582a[_0xe646('0x86')](db[_0xe646('0x87')]['query'](_0x42ec2e));}return BPromise[_0xe646('0x8a')](_0x41582a);}})[_0xe646('0x25')](function(){return _0x205553;})[_0xe646('0x25')](respondWithResult(_0x32d4f0,null))[_0xe646('0x4c')](handleError(_0x32d4f0,null));};exports[_0xe646('0xb4')]=function(_0x5ca124,_0x3d2acc,_0x39d1b2){return db[_0xe646('0x38')][_0xe646('0x2e')]({'where':{'id':_0x5ca124[_0xe646('0x4d')]['id']}})[_0xe646('0x25')](handleEntityNotFound(_0x3d2acc,null))['then'](function(_0x5c0ed9){if(_0x5c0ed9){return _0x5c0ed9[_0xe646('0xb4')](_0x5ca124[_0xe646('0x3d')][_0xe646('0x7e')]);}})[_0xe646('0x25')](function(_0x4bdbcf){if(_0x4bdbcf){return db[_0xe646('0x6a')][_0xe646('0x31')]({'where':{'ListId':_0x5ca124['query'][_0xe646('0x7e')],'VoiceQueueId':_0x5ca124['params']['id']}})['then'](function(){return _0x4bdbcf;});}})[_0xe646('0x25')](respondWithStatusCode(_0x3d2acc,null))[_0xe646('0x4c')](handleError(_0x3d2acc,null));}; \ No newline at end of file +var _0x8bcb=['insert','phone','ContactId','select','field','NOW()','CmListId','ListId','from','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','into','fromQuery','scheduledAt','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','body','user','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','findOne','CmHopper','pick','VoiceQueueId','CmHopperHistory','getHopperFinals','hasOwnProperty','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','flatMap','forEach','penalty','sequelize','each','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','interface','voicePause','emit','userVoiceQueue:save','ids','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','union','transaction','removeTeams','addAgents','spread','isEmpty','SIP/%s','removeAgents','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always'];(function(_0x58214b,_0x5c8973){var _0x1d4b6b=function(_0x3cd030){while(--_0x3cd030){_0x58214b['push'](_0x58214b['shift']());}};_0x1d4b6b(++_0x5c8973);}(_0x8bcb,0xcf));var _0xb8bc=function(_0x1cb17b,_0x2b7991){_0x1cb17b=_0x1cb17b-0x0;var _0x41d1a7=_0x8bcb[_0x1cb17b];return _0x41d1a7;};'use strict';var pdf=require(_0xb8bc('0x0'));var emlformat=require(_0xb8bc('0x1'));var rimraf=require(_0xb8bc('0x2'));var zipdir=require(_0xb8bc('0x3'));var jsonpatch=require(_0xb8bc('0x4'));var rp=require(_0xb8bc('0x5'));var moment=require(_0xb8bc('0x6'));var BPromise=require(_0xb8bc('0x7'));var Mustache=require(_0xb8bc('0x8'));var util=require('util');var path=require(_0xb8bc('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb8bc('0xa'));var fs=require('fs');var _=require(_0xb8bc('0xb'));var squel=require(_0xb8bc('0xc'));var crypto=require(_0xb8bc('0xd'));var jsforce=require(_0xb8bc('0xe'));var deskjs=require(_0xb8bc('0xf'));var toCsv=require(_0xb8bc('0x10'));var querystring=require(_0xb8bc('0x11'));var Papa=require(_0xb8bc('0x12'));var Redis=require('ioredis');var authService=require(_0xb8bc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb8bc('0x14'));var hardwareService=require(_0xb8bc('0x15'));var logger=require('../../config/logger')(_0xb8bc('0x16'));var utils=require(_0xb8bc('0x17'));var config=require(_0xb8bc('0x18'));var db=require(_0xb8bc('0x19'))['db'];config[_0xb8bc('0x1a')]=_[_0xb8bc('0x1b')](config['redis'],{'host':_0xb8bc('0x1c'),'port':0x18eb});var socket=require(_0xb8bc('0x1d'))(new Redis(config[_0xb8bc('0x1a')]));require(_0xb8bc('0x1e'))['register'](socket);function respondWithStatusCode(_0x2c7d95,_0x459f3f){_0x459f3f=_0x459f3f||0xcc;return function(_0x924525){if(_0x924525){return _0x2c7d95[_0xb8bc('0x1f')](_0x459f3f);}return _0x2c7d95[_0xb8bc('0x20')](_0x459f3f)['end']();};}function respondWithResult(_0x5cafec,_0x123a16){_0x123a16=_0x123a16||0xc8;return function(_0xb951a6){if(_0xb951a6){return _0x5cafec['status'](_0x123a16)[_0xb8bc('0x21')](_0xb951a6);}};}function respondWithFilteredResult(_0x3d5143,_0x2d4fe4){return function(_0x157eaa){if(_0x157eaa){var _0x84e371=_0x157eaa[_0xb8bc('0x22')],_0x548e06=_0x2d4fe4[_0xb8bc('0x23')],_0x378dec=_0x2d4fe4[_0xb8bc('0x23')]+_0x2d4fe4[_0xb8bc('0x24')],_0x1aa092;if(_0x378dec>=_0x84e371){_0x378dec=_0x84e371;_0x1aa092=0xc8;}else{_0x1aa092=0xce;}_0x3d5143[_0xb8bc('0x20')](_0x1aa092);return _0x3d5143[_0xb8bc('0x25')](_0xb8bc('0x26'),_0x548e06+'-'+_0x378dec+'/'+_0x84e371)[_0xb8bc('0x21')](_0x157eaa);}return null;};}function patchUpdates(_0x39b81b){return function(_0x29bb23){try{jsonpatch['apply'](_0x29bb23,_0x39b81b,!![]);}catch(_0x30d110){return BPromise[_0xb8bc('0x27')](_0x30d110);}return _0x29bb23[_0xb8bc('0x28')]();};}function saveUpdates(_0x10be90,_0x2fc0fb){return function(_0x1dd89e){if(_0x1dd89e){return _0x1dd89e[_0xb8bc('0x29')](_0x10be90)['then'](function(_0x587f94){return _0x587f94;});}return null;};}function removeEntity(_0x3229a6,_0x9ef3b3){return function(_0x620dc8){if(_0x620dc8){return _0x620dc8[_0xb8bc('0x2a')]()[_0xb8bc('0x2b')](function(){var _0xa298e7=_0x620dc8[_0xb8bc('0x2c')]({'plain':!![]});var _0x36d9e4=[{'name':_0xb8bc('0x2d'),'value':_0xb8bc('0x2e'),'ignore':![]},{'name':_0xb8bc('0x2f'),'value':_0xb8bc('0x30'),'ignore':![]}];var _0x3324a0=_(_0x36d9e4)[_0xb8bc('0x31')](_0xb8bc('0x32'))[_0xb8bc('0x33')](_0xb8bc('0x34'))['value']();if(_[_0xb8bc('0x35')](_0x3324a0,_0xa298e7[_0xb8bc('0x36')])){return;}var _0x1a2ab7=_['find'](_0x36d9e4,[_0xb8bc('0x34'),_0xa298e7[_0xb8bc('0x36')]])[_0xb8bc('0x37')];return db[_0xb8bc('0x38')]['destroy']({'where':{'type':_0x1a2ab7,'resourceId':_0xa298e7['id']}})['then'](function(){return _0x620dc8;});})[_0xb8bc('0x2b')](function(){_0x3229a6[_0xb8bc('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x103e19,_0x2957fc){return function(_0x5488ec){if(!_0x5488ec){_0x103e19[_0xb8bc('0x1f')](0x194);}return _0x5488ec;};}function handleError(_0x5a9b36,_0xac04b8){_0xac04b8=_0xac04b8||0x1f4;return function(_0x1d4758){logger[_0xb8bc('0x39')](_0x1d4758[_0xb8bc('0x3a')]);if(_0x1d4758[_0xb8bc('0x37')]){delete _0x1d4758[_0xb8bc('0x37')];}_0x5a9b36['status'](_0xac04b8)[_0xb8bc('0x3b')](_0x1d4758);};}exports[_0xb8bc('0x3c')]=function(_0x1ea75e,_0x2b9454){var _0x15fa1a={},_0x34f3a3={},_0xdf259a={'count':0x0,'rows':[]};var _0x201c68=_[_0xb8bc('0x33')](db[_0xb8bc('0x3d')][_0xb8bc('0x3e')],function(_0x5ca776){return{'name':_0x5ca776['fieldName'],'type':_0x5ca776['type'][_0xb8bc('0x3f')]};});_0x34f3a3[_0xb8bc('0x40')]=_[_0xb8bc('0x33')](_0x201c68,'name');_0x34f3a3[_0xb8bc('0x41')]=_[_0xb8bc('0x42')](_0x1ea75e['query']);_0x34f3a3[_0xb8bc('0x43')]=_[_0xb8bc('0x44')](_0x34f3a3['model'],_0x34f3a3[_0xb8bc('0x41')]);_0x15fa1a[_0xb8bc('0x45')]=_['intersection'](_0x34f3a3[_0xb8bc('0x40')],qs[_0xb8bc('0x46')](_0x1ea75e[_0xb8bc('0x41')][_0xb8bc('0x46')]));_0x15fa1a[_0xb8bc('0x45')]=_0x15fa1a[_0xb8bc('0x45')][_0xb8bc('0x47')]?_0x15fa1a[_0xb8bc('0x45')]:_0x34f3a3[_0xb8bc('0x40')];if(!_0x1ea75e[_0xb8bc('0x41')]['hasOwnProperty'](_0xb8bc('0x48'))){_0x15fa1a[_0xb8bc('0x24')]=qs[_0xb8bc('0x24')](_0x1ea75e[_0xb8bc('0x41')][_0xb8bc('0x24')]);_0x15fa1a[_0xb8bc('0x23')]=qs['offset'](_0x1ea75e[_0xb8bc('0x41')][_0xb8bc('0x23')]);}_0x15fa1a[_0xb8bc('0x49')]=qs[_0xb8bc('0x4a')](_0x1ea75e['query']['sort']);_0x15fa1a[_0xb8bc('0x4b')]=qs['filters'](_['pick'](_0x1ea75e[_0xb8bc('0x41')],_0x34f3a3['filters']),_0x201c68);if(_0x1ea75e['query'][_0xb8bc('0x31')]){_0x15fa1a[_0xb8bc('0x4b')]=_[_0xb8bc('0x4c')](_0x15fa1a[_0xb8bc('0x4b')],{'$or':_[_0xb8bc('0x33')](_0x201c68,function(_0x4d5c10){if(_0x4d5c10[_0xb8bc('0x36')]!==_0xb8bc('0x4d')){var _0x1efe11={};_0x1efe11[_0x4d5c10[_0xb8bc('0x37')]]={'$like':'%'+_0x1ea75e[_0xb8bc('0x41')][_0xb8bc('0x31')]+'%'};return _0x1efe11;}})});}_0x15fa1a=_[_0xb8bc('0x4c')]({},_0x15fa1a,_0x1ea75e['options']);var _0x36d708={'where':_0x15fa1a[_0xb8bc('0x4b')]};return db[_0xb8bc('0x3d')][_0xb8bc('0x22')](_0x36d708)[_0xb8bc('0x2b')](function(_0x5504b0){_0xdf259a['count']=_0x5504b0;if(_0x1ea75e[_0xb8bc('0x41')][_0xb8bc('0x4e')]){_0x15fa1a[_0xb8bc('0x4f')]=[{'all':!![]}];}return db[_0xb8bc('0x3d')][_0xb8bc('0x50')](_0x15fa1a);})['then'](function(_0x5388a5){_0xdf259a[_0xb8bc('0x51')]=_0x5388a5;return _0xdf259a;})['then'](respondWithFilteredResult(_0x2b9454,_0x15fa1a))[_0xb8bc('0x52')](handleError(_0x2b9454,null));};exports[_0xb8bc('0x53')]=function(_0x15e34c,_0x1822b0){var _0x59045a={'raw':![],'where':{'id':_0x15e34c[_0xb8bc('0x54')]['id']}},_0x2a385d={};_0x2a385d['model']=_[_0xb8bc('0x42')](db[_0xb8bc('0x3d')]['rawAttributes']);_0x2a385d[_0xb8bc('0x41')]=_[_0xb8bc('0x42')](_0x15e34c[_0xb8bc('0x41')]);_0x2a385d[_0xb8bc('0x43')]=_['intersection'](_0x2a385d[_0xb8bc('0x40')],_0x2a385d[_0xb8bc('0x41')]);_0x59045a['attributes']=_[_0xb8bc('0x44')](_0x2a385d[_0xb8bc('0x40')],qs[_0xb8bc('0x46')](_0x15e34c[_0xb8bc('0x41')][_0xb8bc('0x46')]));_0x59045a[_0xb8bc('0x45')]=_0x59045a[_0xb8bc('0x45')][_0xb8bc('0x47')]?_0x59045a['attributes']:_0x2a385d[_0xb8bc('0x40')];if(_0x15e34c[_0xb8bc('0x41')]['includeAll']){_0x59045a['include']=[{'all':!![]}];}_0x59045a=_[_0xb8bc('0x4c')]({},_0x59045a,_0x15e34c['options']);return db['VoiceQueue']['find'](_0x59045a)['then'](handleEntityNotFound(_0x1822b0,null))['then'](respondWithResult(_0x1822b0,null))[_0xb8bc('0x52')](handleError(_0x1822b0,null));};exports['create']=function(_0x10f4e2,_0x559e44){return db['VoiceQueue']['create'](_0x10f4e2[_0xb8bc('0x55')],{})[_0xb8bc('0x2b')](function(_0xb7a50d){var _0x1658cb=_0x10f4e2[_0xb8bc('0x56')][_0xb8bc('0x2c')]({'plain':!![]});if(!_0x1658cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1658cb['role']===_0xb8bc('0x56')){var _0x2cd209=_0xb7a50d[_0xb8bc('0x2c')]({'plain':!![]});var _0x4ac9f8=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0xb8bc('0x30')}];var _0x5689d9=_['find'](_0x4ac9f8,['value',_0x2cd209['type']])[_0xb8bc('0x37')];return db['UserProfileSection'][_0xb8bc('0x57')]({'where':{'name':_0x5689d9,'userProfileId':_0x1658cb[_0xb8bc('0x58')]},'raw':!![]})[_0xb8bc('0x2b')](function(_0x17575f){if(_0x17575f&&_0x17575f['autoAssociation']===0x0){return db[_0xb8bc('0x38')][_0xb8bc('0x59')]({'name':_0x2cd209[_0xb8bc('0x37')],'resourceId':_0x2cd209['id'],'type':_0x17575f[_0xb8bc('0x37')],'sectionId':_0x17575f['id']},{})['then'](function(){return _0xb7a50d;});}else{return _0xb7a50d;}})['catch'](function(_0x5d2162){logger[_0xb8bc('0x39')](_0xb8bc('0x5a'),_0x5d2162);throw _0x5d2162;});}return _0xb7a50d;})[_0xb8bc('0x2b')](respondWithResult(_0x559e44,0xc9))[_0xb8bc('0x52')](handleError(_0x559e44,null));};exports[_0xb8bc('0x5b')]=function(_0x546829,_0x1e23d8){var _0x39a937={'where':{'id':_0x546829[_0xb8bc('0x54')]['id']}},_0x253169={};_0x253169[_0xb8bc('0x40')]=_[_0xb8bc('0x42')](db[_0xb8bc('0x3d')][_0xb8bc('0x3e')]);_0x39a937['attributes']=_[_0xb8bc('0x44')](_0x253169['model'],qs[_0xb8bc('0x46')](_0x546829[_0xb8bc('0x41')][_0xb8bc('0x46')]));_0x39a937[_0xb8bc('0x45')]=_0x39a937[_0xb8bc('0x45')][_0xb8bc('0x47')]?_0x39a937[_0xb8bc('0x45')]:_0x253169[_0xb8bc('0x40')];if(_0x546829['query'][_0xb8bc('0x4e')]){_0x39a937['include']=[{'all':!![]}];}_0x39a937=_[_0xb8bc('0x4c')]({},_0x39a937,_0x546829[_0xb8bc('0x5c')]);return db['VoiceQueue'][_0xb8bc('0x57')](_0x39a937)[_0xb8bc('0x2b')](handleEntityNotFound(_0x1e23d8,null))[_0xb8bc('0x2b')](function(_0x56732e){if(_0x56732e){var _0x5560dc=_0x56732e[_0xb8bc('0x2c')]({'plain':!![]});_0x5560dc=qs[_0xb8bc('0x5d')](_0x5560dc,['id',_0xb8bc('0x5e'),_0xb8bc('0x5f')]);_0x546829['body']=_[_0xb8bc('0x5d')](_0x546829[_0xb8bc('0x55')],['id','createdAt',_0xb8bc('0x5f')]);return db['VoiceQueue'][_0xb8bc('0x59')](_[_0xb8bc('0x4c')](_0x5560dc,_0x546829[_0xb8bc('0x55')]),{'include':_0x546829[_0xb8bc('0x41')][_0xb8bc('0x4e')]?[{'all':!![]}]:undefined})[_0xb8bc('0x2b')](function(_0x5c9c7e){var _0x4a2eb5=_0x546829[_0xb8bc('0x56')][_0xb8bc('0x2c')]({'plain':!![]});if(!_0x4a2eb5)throw new Error(_0xb8bc('0x60'));if(_0x4a2eb5[_0xb8bc('0x61')]===_0xb8bc('0x56')){var _0x931c24=_0x5c9c7e[_0xb8bc('0x2c')]({'plain':!![]});var _0x5e256c=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xb8bc('0x2f'),'value':_0xb8bc('0x30')}];var _0xf3552c=_['find'](_0x5e256c,[_0xb8bc('0x34'),_0x931c24['type']])['name'];return db[_0xb8bc('0x62')][_0xb8bc('0x57')]({'where':{'name':_0xf3552c,'userProfileId':_0x4a2eb5[_0xb8bc('0x58')]},'raw':!![]})[_0xb8bc('0x2b')](function(_0x359c79){if(_0x359c79&&_0x359c79[_0xb8bc('0x63')]===0x0){return db[_0xb8bc('0x38')][_0xb8bc('0x59')]({'name':_0x931c24[_0xb8bc('0x37')],'resourceId':_0x931c24['id'],'type':_0x359c79[_0xb8bc('0x37')],'sectionId':_0x359c79['id']},{})[_0xb8bc('0x2b')](function(){return _0x5c9c7e;});}else{return _0x5c9c7e;}})[_0xb8bc('0x52')](function(_0x533797){logger[_0xb8bc('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x533797);throw _0x533797;});}return _0x5c9c7e;});}})[_0xb8bc('0x2b')](respondWithResult(_0x1e23d8,0xc9))[_0xb8bc('0x52')](handleError(_0x1e23d8,null));};exports['update']=function(_0x76bb62,_0x57d069){if(_0x76bb62[_0xb8bc('0x55')]['id']){delete _0x76bb62[_0xb8bc('0x55')]['id'];}return db[_0xb8bc('0x3d')][_0xb8bc('0x57')]({'where':{'id':_0x76bb62[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x57d069,null))[_0xb8bc('0x2b')](saveUpdates(_0x76bb62[_0xb8bc('0x55')],null))['then'](respondWithResult(_0x57d069,null))[_0xb8bc('0x52')](handleError(_0x57d069,null));};exports[_0xb8bc('0x2a')]=function(_0x4239a5,_0x970eee){return db[_0xb8bc('0x3d')][_0xb8bc('0x57')]({'where':{'id':_0x4239a5[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x970eee,null))[_0xb8bc('0x2b')](removeEntity(_0x970eee,null))['catch'](handleError(_0x970eee,null));};exports['getHoppers']=function(_0x149516,_0x97c0de,_0x2e374b){var _0x14b8d4={'raw':![],'where':{}};var _0x177245={};var _0x640b7d={'count':0x0,'rows':[]};return db[_0xb8bc('0x3d')][_0xb8bc('0x64')]({'where':{'id':_0x149516[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x97c0de,null))[_0xb8bc('0x2b')](function(_0x5578ad){if(_0x5578ad){_0x177245[_0xb8bc('0x40')]=_[_0xb8bc('0x42')](db[_0xb8bc('0x65')]['rawAttributes']);_0x177245[_0xb8bc('0x41')]=_['keys'](_0x149516['query']);_0x177245[_0xb8bc('0x43')]=_['intersection'](_0x177245[_0xb8bc('0x40')],_0x177245[_0xb8bc('0x41')]);_0x14b8d4[_0xb8bc('0x45')]=_['intersection'](_0x177245[_0xb8bc('0x40')],qs[_0xb8bc('0x46')](_0x149516[_0xb8bc('0x41')][_0xb8bc('0x46')]));_0x14b8d4[_0xb8bc('0x45')]=_0x14b8d4['attributes']['length']?_0x14b8d4[_0xb8bc('0x45')]:_0x177245[_0xb8bc('0x40')];if(!_0x149516[_0xb8bc('0x41')]['hasOwnProperty'](_0xb8bc('0x48'))){_0x14b8d4[_0xb8bc('0x24')]=qs[_0xb8bc('0x24')](_0x149516[_0xb8bc('0x41')][_0xb8bc('0x24')]);_0x14b8d4[_0xb8bc('0x23')]=qs['offset'](_0x149516['query'][_0xb8bc('0x23')]);}_0x14b8d4[_0xb8bc('0x49')]=qs[_0xb8bc('0x4a')](_0x149516[_0xb8bc('0x41')]['sort']);_0x14b8d4['where']=qs['filters'](_[_0xb8bc('0x66')](_0x149516[_0xb8bc('0x41')],_0x177245['filters']));_0x14b8d4[_0xb8bc('0x4b')][_0xb8bc('0x67')]=_0x5578ad['id'];if(_0x149516['query'][_0xb8bc('0x31')]){_0x14b8d4[_0xb8bc('0x4b')]=_[_0xb8bc('0x4c')](_0x14b8d4[_0xb8bc('0x4b')],{'$or':_[_0xb8bc('0x33')](_0x14b8d4['attributes'],function(_0x20f173){var _0x102617={};_0x102617[_0x20f173]={'$like':'%'+_0x149516[_0xb8bc('0x41')]['filter']+'%'};return _0x102617;})});}_0x14b8d4=_[_0xb8bc('0x4c')]({},_0x14b8d4,_0x149516['options']);return db[_0xb8bc('0x65')][_0xb8bc('0x22')]({'where':_0x14b8d4['where']})[_0xb8bc('0x2b')](function(_0x502221){_0x640b7d[_0xb8bc('0x22')]=_0x502221;if(_0x149516[_0xb8bc('0x41')][_0xb8bc('0x4e')]){_0x14b8d4[_0xb8bc('0x4f')]=[{'all':!![]}];}return db[_0xb8bc('0x65')][_0xb8bc('0x50')](_0x14b8d4);})[_0xb8bc('0x2b')](function(_0x217327){_0x640b7d[_0xb8bc('0x51')]=_0x217327;return _0x640b7d;});}})[_0xb8bc('0x2b')](respondWithFilteredResult(_0x97c0de,_0x14b8d4))[_0xb8bc('0x52')](handleError(_0x97c0de,null));};exports['getHopperHistories']=function(_0x3a2e5b,_0x24e503,_0x44095d){var _0x1557f7={'raw':!![],'where':{}};var _0x30d138={};var _0x2930d6={'count':0x0,'rows':[]};return db[_0xb8bc('0x3d')][_0xb8bc('0x64')]({'where':{'id':_0x3a2e5b[_0xb8bc('0x54')]['id']}})['then'](handleEntityNotFound(_0x24e503,null))[_0xb8bc('0x2b')](function(_0x2b0278){if(_0x2b0278){_0x30d138['model']=_['keys'](db[_0xb8bc('0x68')]['rawAttributes']);_0x30d138[_0xb8bc('0x41')]=_[_0xb8bc('0x42')](_0x3a2e5b[_0xb8bc('0x41')]);_0x30d138[_0xb8bc('0x43')]=_[_0xb8bc('0x44')](_0x30d138[_0xb8bc('0x40')],_0x30d138[_0xb8bc('0x41')]);_0x1557f7[_0xb8bc('0x45')]=_[_0xb8bc('0x44')](_0x30d138[_0xb8bc('0x40')],qs['fields'](_0x3a2e5b[_0xb8bc('0x41')][_0xb8bc('0x46')]));_0x1557f7[_0xb8bc('0x45')]=_0x1557f7[_0xb8bc('0x45')]['length']?_0x1557f7['attributes']:_0x30d138[_0xb8bc('0x40')];if(!_0x3a2e5b['query']['hasOwnProperty'](_0xb8bc('0x48'))){_0x1557f7[_0xb8bc('0x24')]=qs['limit'](_0x3a2e5b[_0xb8bc('0x41')]['limit']);_0x1557f7[_0xb8bc('0x23')]=qs[_0xb8bc('0x23')](_0x3a2e5b[_0xb8bc('0x41')][_0xb8bc('0x23')]);}_0x1557f7[_0xb8bc('0x49')]=qs[_0xb8bc('0x4a')](_0x3a2e5b[_0xb8bc('0x41')][_0xb8bc('0x4a')]);_0x1557f7[_0xb8bc('0x4b')]=qs[_0xb8bc('0x43')](_['pick'](_0x3a2e5b[_0xb8bc('0x41')],_0x30d138[_0xb8bc('0x43')]));_0x1557f7['where'][_0xb8bc('0x67')]=_0x2b0278['id'];if(_0x3a2e5b[_0xb8bc('0x41')]['filter']){_0x1557f7[_0xb8bc('0x4b')]=_[_0xb8bc('0x4c')](_0x1557f7[_0xb8bc('0x4b')],{'$or':_[_0xb8bc('0x33')](_0x1557f7[_0xb8bc('0x45')],function(_0x4a404b){var _0x5250fd={};_0x5250fd[_0x4a404b]={'$like':'%'+_0x3a2e5b[_0xb8bc('0x41')][_0xb8bc('0x31')]+'%'};return _0x5250fd;})});}_0x1557f7=_['merge']({},_0x1557f7,_0x3a2e5b['options']);return db[_0xb8bc('0x68')]['count']({'where':_0x1557f7[_0xb8bc('0x4b')]})[_0xb8bc('0x2b')](function(_0x5766df){_0x2930d6['count']=_0x5766df;if(_0x3a2e5b[_0xb8bc('0x41')][_0xb8bc('0x4e')]){_0x1557f7[_0xb8bc('0x4f')]=[{'all':!![]}];}return db[_0xb8bc('0x68')][_0xb8bc('0x50')](_0x1557f7);})[_0xb8bc('0x2b')](function(_0x2b5128){_0x2930d6['rows']=_0x2b5128;return _0x2930d6;});}})[_0xb8bc('0x2b')](respondWithFilteredResult(_0x24e503,_0x1557f7))[_0xb8bc('0x52')](handleError(_0x24e503,null));};exports[_0xb8bc('0x69')]=function(_0x45d584,_0x1232b8,_0x252da7){var _0x119571={'raw':!![],'where':{}};var _0x7cbe99={};var _0x1fd9eb={'count':0x0,'rows':[]};return db[_0xb8bc('0x3d')]['findOne']({'where':{'id':_0x45d584['params']['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x1232b8,null))[_0xb8bc('0x2b')](function(_0xabd171){if(_0xabd171){_0x7cbe99[_0xb8bc('0x40')]=_[_0xb8bc('0x42')](db['CmHopperFinal'][_0xb8bc('0x3e')]);_0x7cbe99['query']=_['keys'](_0x45d584[_0xb8bc('0x41')]);_0x7cbe99[_0xb8bc('0x43')]=_[_0xb8bc('0x44')](_0x7cbe99[_0xb8bc('0x40')],_0x7cbe99[_0xb8bc('0x41')]);_0x119571[_0xb8bc('0x45')]=_['intersection'](_0x7cbe99[_0xb8bc('0x40')],qs[_0xb8bc('0x46')](_0x45d584[_0xb8bc('0x41')][_0xb8bc('0x46')]));_0x119571[_0xb8bc('0x45')]=_0x119571[_0xb8bc('0x45')][_0xb8bc('0x47')]?_0x119571[_0xb8bc('0x45')]:_0x7cbe99[_0xb8bc('0x40')];if(!_0x45d584[_0xb8bc('0x41')][_0xb8bc('0x6a')](_0xb8bc('0x48'))){_0x119571[_0xb8bc('0x24')]=qs['limit'](_0x45d584['query']['limit']);_0x119571[_0xb8bc('0x23')]=qs['offset'](_0x45d584[_0xb8bc('0x41')][_0xb8bc('0x23')]);}_0x119571[_0xb8bc('0x49')]=qs[_0xb8bc('0x4a')](_0x45d584[_0xb8bc('0x41')][_0xb8bc('0x4a')]);_0x119571[_0xb8bc('0x4b')]=qs[_0xb8bc('0x43')](_[_0xb8bc('0x66')](_0x45d584[_0xb8bc('0x41')],_0x7cbe99[_0xb8bc('0x43')]));_0x119571['where'][_0xb8bc('0x67')]=_0xabd171['id'];if(_0x45d584['query'][_0xb8bc('0x31')]){_0x119571[_0xb8bc('0x4b')]=_[_0xb8bc('0x4c')](_0x119571['where'],{'$or':_[_0xb8bc('0x33')](_0x119571[_0xb8bc('0x45')],function(_0x39528b){var _0x299ec6={};_0x299ec6[_0x39528b]={'$like':'%'+_0x45d584[_0xb8bc('0x41')][_0xb8bc('0x31')]+'%'};return _0x299ec6;})});}_0x119571=_[_0xb8bc('0x4c')]({},_0x119571,_0x45d584[_0xb8bc('0x5c')]);return db[_0xb8bc('0x6b')][_0xb8bc('0x22')]({'where':_0x119571[_0xb8bc('0x4b')]})[_0xb8bc('0x2b')](function(_0x5b9a7e){_0x1fd9eb[_0xb8bc('0x22')]=_0x5b9a7e;if(_0x45d584['query'][_0xb8bc('0x4e')]){_0x119571['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xb8bc('0x50')](_0x119571);})[_0xb8bc('0x2b')](function(_0x4fe6b4){_0x1fd9eb[_0xb8bc('0x51')]=_0x4fe6b4;return _0x1fd9eb;});}})['then'](respondWithFilteredResult(_0x1232b8,_0x119571))[_0xb8bc('0x52')](handleError(_0x1232b8,null));};exports['getHopperBlacks']=function(_0x48a64c,_0x3fa00,_0x21b277){var _0x256287={'raw':!![],'where':{}};var _0x41d607={};var _0x2212ec={'count':0x0,'rows':[]};return db[_0xb8bc('0x3d')]['findOne']({'where':{'id':_0x48a64c['params']['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x3fa00,null))[_0xb8bc('0x2b')](function(_0x6ac246){if(_0x6ac246){_0x41d607[_0xb8bc('0x40')]=_[_0xb8bc('0x42')](db[_0xb8bc('0x6c')][_0xb8bc('0x3e')]);_0x41d607[_0xb8bc('0x41')]=_[_0xb8bc('0x42')](_0x48a64c['query']);_0x41d607[_0xb8bc('0x43')]=_[_0xb8bc('0x44')](_0x41d607[_0xb8bc('0x40')],_0x41d607['query']);_0x256287['attributes']=_['intersection'](_0x41d607[_0xb8bc('0x40')],qs['fields'](_0x48a64c[_0xb8bc('0x41')]['fields']));_0x256287[_0xb8bc('0x45')]=_0x256287[_0xb8bc('0x45')]['length']?_0x256287[_0xb8bc('0x45')]:_0x41d607[_0xb8bc('0x40')];if(!_0x48a64c[_0xb8bc('0x41')][_0xb8bc('0x6a')](_0xb8bc('0x48'))){_0x256287[_0xb8bc('0x24')]=qs['limit'](_0x48a64c[_0xb8bc('0x41')][_0xb8bc('0x24')]);_0x256287[_0xb8bc('0x23')]=qs[_0xb8bc('0x23')](_0x48a64c['query'][_0xb8bc('0x23')]);}_0x256287[_0xb8bc('0x49')]=qs[_0xb8bc('0x4a')](_0x48a64c[_0xb8bc('0x41')][_0xb8bc('0x4a')]);_0x256287[_0xb8bc('0x4b')]=qs[_0xb8bc('0x43')](_['pick'](_0x48a64c['query'],_0x41d607['filters']));_0x256287[_0xb8bc('0x4b')]['VoiceQueueId']=_0x6ac246['id'];if(_0x48a64c[_0xb8bc('0x41')][_0xb8bc('0x31')]){_0x256287['where']=_[_0xb8bc('0x4c')](_0x256287[_0xb8bc('0x4b')],{'$or':_[_0xb8bc('0x33')](_0x256287['attributes'],function(_0x5e19f7){var _0x2a170a={};_0x2a170a[_0x5e19f7]={'$like':'%'+_0x48a64c['query'][_0xb8bc('0x31')]+'%'};return _0x2a170a;})});}_0x256287=_[_0xb8bc('0x4c')]({},_0x256287,_0x48a64c['options']);return db['CmHopperBlack'][_0xb8bc('0x22')]({'where':_0x256287['where']})[_0xb8bc('0x2b')](function(_0x330236){_0x2212ec['count']=_0x330236;if(_0x48a64c[_0xb8bc('0x41')][_0xb8bc('0x4e')]){_0x256287[_0xb8bc('0x4f')]=[{'all':!![]}];}return db[_0xb8bc('0x6c')][_0xb8bc('0x50')](_0x256287);})['then'](function(_0x123bb8){_0x2212ec[_0xb8bc('0x51')]=_0x123bb8;return _0x2212ec;});}})[_0xb8bc('0x2b')](respondWithFilteredResult(_0x3fa00,_0x256287))[_0xb8bc('0x52')](handleError(_0x3fa00,null));};exports[_0xb8bc('0x6d')]=function(_0x2e281f,_0x4cca54,_0x313240){var _0x3e5ee4={};var _0x40d66f={};var _0x1d7fe9;var _0xb4f7e7;return db[_0xb8bc('0x3d')]['findOne']({'where':{'id':_0x2e281f[_0xb8bc('0x54')]['id']}})['then'](handleEntityNotFound(_0x4cca54,null))[_0xb8bc('0x2b')](function(_0x36ea4b){if(_0x36ea4b){_0x1d7fe9=_0x36ea4b;_0x40d66f[_0xb8bc('0x40')]=_[_0xb8bc('0x42')](db[_0xb8bc('0x6e')]['rawAttributes']);_0x40d66f['query']=_[_0xb8bc('0x42')](_0x2e281f[_0xb8bc('0x41')]);_0x40d66f[_0xb8bc('0x43')]=_[_0xb8bc('0x44')](_0x40d66f[_0xb8bc('0x40')],_0x40d66f[_0xb8bc('0x41')]);_0x3e5ee4[_0xb8bc('0x45')]=_[_0xb8bc('0x44')](_0x40d66f[_0xb8bc('0x40')],qs['fields'](_0x2e281f[_0xb8bc('0x41')][_0xb8bc('0x46')]));_0x3e5ee4[_0xb8bc('0x45')]=_0x3e5ee4[_0xb8bc('0x45')][_0xb8bc('0x47')]?_0x3e5ee4['attributes']:_0x40d66f[_0xb8bc('0x40')];_0x3e5ee4['order']=qs[_0xb8bc('0x4a')](_0x2e281f[_0xb8bc('0x41')][_0xb8bc('0x4a')]);_0x3e5ee4[_0xb8bc('0x4b')]=qs[_0xb8bc('0x43')](_['pick'](_0x2e281f[_0xb8bc('0x41')],_0x40d66f[_0xb8bc('0x43')]));if(_0x2e281f[_0xb8bc('0x41')]['filter']){_0x3e5ee4['where']=_[_0xb8bc('0x4c')](_0x3e5ee4[_0xb8bc('0x4b')],{'$or':_[_0xb8bc('0x33')](_0x3e5ee4[_0xb8bc('0x45')],function(_0x20cbc0){var _0x7d7a11={};_0x7d7a11[_0x20cbc0]={'$like':'%'+_0x2e281f[_0xb8bc('0x41')][_0xb8bc('0x31')]+'%'};return _0x7d7a11;})});}_0x3e5ee4=_[_0xb8bc('0x4c')]({},_0x3e5ee4,_0x2e281f[_0xb8bc('0x5c')]);return _0x1d7fe9[_0xb8bc('0x6d')](_0x3e5ee4);}})[_0xb8bc('0x2b')](function(_0x207bda){if(_0x207bda){_0xb4f7e7=_0x207bda[_0xb8bc('0x47')];if(!_0x2e281f[_0xb8bc('0x41')][_0xb8bc('0x6a')](_0xb8bc('0x48'))){_0x3e5ee4[_0xb8bc('0x24')]=qs[_0xb8bc('0x24')](_0x2e281f[_0xb8bc('0x41')][_0xb8bc('0x24')]);_0x3e5ee4[_0xb8bc('0x23')]=qs[_0xb8bc('0x23')](_0x2e281f['query'][_0xb8bc('0x23')]);}return _0x1d7fe9['getTeams'](_0x3e5ee4);}})[_0xb8bc('0x2b')](function(_0x29f821){if(_0x29f821){return _0x29f821?{'count':_0xb4f7e7,'rows':_0x29f821}:null;}})[_0xb8bc('0x2b')](respondWithResult(_0x4cca54,null))[_0xb8bc('0x52')](handleError(_0x4cca54,null));};exports[_0xb8bc('0x6f')]=function(_0x3e3ff4,_0x133d16,_0x48f730){var _0x389548=_0x3e3ff4['body'][_0xb8bc('0x70')];var _0x386089=_[_0xb8bc('0x33')](_0x389548,'id');return db[_0xb8bc('0x6e')][_0xb8bc('0x50')]({'where':{'id':_0x386089},'attributes':['id'],'include':[{'model':db[_0xb8bc('0x71')],'as':_0xb8bc('0x72'),'attributes':['id','name',_0xb8bc('0x73'),'voicePause','interface'],'raw':!![]}]})[_0xb8bc('0x2b')](function(_0x354032){if(_0x354032){var _0xaa8a39=_[_0xb8bc('0x74')](_0x354032,function(_0x5aa732){var _0x287243=_0x5aa732[_0xb8bc('0x2c')]({'plain':!![]});_0x287243[_0xb8bc('0x72')][_0xb8bc('0x75')](function(_0x201124){_0x201124['penalty']=_[_0xb8bc('0x57')](_0x389548,{'id':_0x287243['id']})[_0xb8bc('0x76')];});return _0x287243[_0xb8bc('0x72')];});return db['VoiceQueue']['find']({'where':{'id':_0x3e3ff4[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](function(_0x4b63a){return db[_0xb8bc('0x77')]['transaction'](function(_0x3274ca){return _0x4b63a[_0xb8bc('0x6f')](_0x386089,{'transaction':_0x3274ca})[_0xb8bc('0x2b')](function(){return BPromise[_0xb8bc('0x78')](_0xaa8a39,function(_0x5f365a){return db['UserVoiceQueue'][_0xb8bc('0x79')]({'where':{'UserId':_0x5f365a['id'],'VoiceQueueId':_0x3e3ff4['params']['id']},'defaults':{'penalty':_0x5f365a[_0xb8bc('0x76')]},'transaction':_0x3274ca});});})['then'](function(){return BPromise['each'](_['filter'](_0xaa8a39,{'online':!![]}),function(_0x1d597d){return db[_0xb8bc('0x7a')][_0xb8bc('0x7b')]({'membername':_0x1d597d[_0xb8bc('0x37')],'UserId':_0x1d597d['id'],'queue_name':_0x4b63a[_0xb8bc('0x37')],'VoiceQueueId':_0x4b63a['id'],'interface':_[_0xb8bc('0x7c')](_0x1d597d['interface'])?util[_0xb8bc('0x7d')]('SIP/%s',_0x1d597d[_0xb8bc('0x37')]):_0x1d597d[_0xb8bc('0x7e')],'paused':_0x1d597d[_0xb8bc('0x7f')]||![],'penalty':_0x1d597d[_0xb8bc('0x76')]},{'transaction':_0x3274ca});});})[_0xb8bc('0x2b')](function(){_0xaa8a39[_0xb8bc('0x75')](function(_0x31a60a){socket[_0xb8bc('0x80')](_0xb8bc('0x81'),{'UserId':_0x31a60a['id'],'VoiceQueueId':_0x4b63a['id']});});});});});}})[_0xb8bc('0x2b')](respondWithStatusCode(_0x133d16,null))['catch'](handleError(_0x133d16,null));};exports['removeTeams']=function(_0x390c65,_0x16a43d,_0x3e26fd){return db[_0xb8bc('0x6e')][_0xb8bc('0x50')]({'where':{'id':_0x390c65['query'][_0xb8bc('0x82')]},'attributes':['id'],'include':[{'model':db[_0xb8bc('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb8bc('0x2b')](handleEntityNotFound(_0x16a43d,null))[_0xb8bc('0x2b')](function(_0x33ef37){var _0x48710d=_[_0xb8bc('0x33')](_0x33ef37,'id');var _0x110dfa=[];var _0x4b77ad=[];var _0x568be5=squel['select']();_0x568be5['field']('tq.TeamId')['from']('team_has_voice_queues','tq')[_0xb8bc('0x83')]('user_has_teams','ut',_0xb8bc('0x84'))[_0xb8bc('0x4b')](_0xb8bc('0x85'),_0x390c65['params']['id']);for(var _0x3a52d3=0x0;_0x3a52d3<_0x33ef37['length'];_0x3a52d3+=0x1){let _0x834777=_0x33ef37[_0x3a52d3];for(var _0x4c7fc0=0x0;_0x4c7fc0<_0x834777[_0xb8bc('0x72')][_0xb8bc('0x47')];_0x4c7fc0+=0x1){let _0x358480=_0x834777[_0xb8bc('0x72')][_0x4c7fc0];var _0x34597e=_0x568be5['clone']();_0x34597e[_0xb8bc('0x4b')](_0xb8bc('0x86'),_0x358480['id']);_0x4b77ad[_0xb8bc('0x87')](db[_0xb8bc('0x77')][_0xb8bc('0x41')](_0x34597e[_0xb8bc('0x88')](),{'type':db[_0xb8bc('0x77')][_0xb8bc('0x89')][_0xb8bc('0x8a')]})[_0xb8bc('0x2b')](function(_0x4fa686){if(_0x4fa686[_0xb8bc('0x47')]===0x1){return _0x358480['id'];}else{var _0x4ee025=_['every'](_[_0xb8bc('0x33')](_0x4fa686,'TeamId'),function(_0x5488fe){return _[_0xb8bc('0x35')](_0x48710d,_0x5488fe);});if(_0x4ee025){return _0x358480['id'];}}}));}}return BPromise['all'](_0x4b77ad)['then'](function(_0x1f7753){_0x110dfa=_(_0x110dfa)[_0xb8bc('0x8b')](_0x1f7753)['compact']()['value']();return db[_0xb8bc('0x3d')][_0xb8bc('0x57')]({'where':{'id':_0x390c65[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](function(_0x482f3e){return db[_0xb8bc('0x77')][_0xb8bc('0x8c')](function(_0x5b4344){return _0x482f3e[_0xb8bc('0x8d')](_0x390c65[_0xb8bc('0x41')][_0xb8bc('0x82')],{'transaction':_0x5b4344})[_0xb8bc('0x2b')](function(){if(!_['isEmpty'](_0x110dfa)){return _0x482f3e['removeAgents'](_0x110dfa,{'transaction':_0x5b4344})[_0xb8bc('0x2b')](function(){return db[_0xb8bc('0x7a')][_0xb8bc('0x2a')]({'where':{'VoiceQueueId':_0x390c65[_0xb8bc('0x54')]['id'],'UserId':_0x110dfa},'transaction':_0x5b4344});});}})['then'](function(){_0x110dfa['forEach'](function(_0x18add0){socket[_0xb8bc('0x80')]('userVoiceQueue:remove',{'UserId':_0x18add0,'VoiceQueueId':_0x482f3e['id']});});});});});});})[_0xb8bc('0x2b')](respondWithStatusCode(_0x16a43d,null))[_0xb8bc('0x52')](handleError(_0x16a43d,null));};exports[_0xb8bc('0x8e')]=function(_0x4d9bcf,_0x31e11f,_0x5e5761){var _0x518b7a,_0x118890;return db[_0xb8bc('0x3d')][_0xb8bc('0x57')]({'where':{'id':_0x4d9bcf[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x31e11f,null))[_0xb8bc('0x2b')](function(_0x47f943){if(_0x47f943){_0x118890=_0x47f943;return _0x47f943[_0xb8bc('0x8e')](_0x4d9bcf[_0xb8bc('0x55')]['ids'],_[_0xb8bc('0x5d')](_0x4d9bcf[_0xb8bc('0x55')],[_0xb8bc('0x82'),'id'])||{})[_0xb8bc('0x8f')](function(_0x1a709d){for(var _0x39ee18=0x0;_0x39ee18<_0x4d9bcf[_0xb8bc('0x55')][_0xb8bc('0x82')][_0xb8bc('0x47')];_0x39ee18+=0x1){socket[_0xb8bc('0x80')](_0xb8bc('0x81'),{'UserId':_0x4d9bcf[_0xb8bc('0x55')][_0xb8bc('0x82')][_0x39ee18],'VoiceQueueId':_0x4d9bcf[_0xb8bc('0x54')]['id']});}return _0x1a709d;});}})[_0xb8bc('0x2b')](function(_0x380f47){_0x518b7a=_0x380f47||[];if(_0x118890){return db[_0xb8bc('0x71')]['findAll']({'where':{'id':_0x4d9bcf[_0xb8bc('0x55')]['ids']},'attributes':['id',_0xb8bc('0x37'),_0xb8bc('0x73'),_0xb8bc('0x7f'),_0xb8bc('0x7e')],'raw':!![]});}})[_0xb8bc('0x2b')](function(_0x40eaa8){if(!_[_0xb8bc('0x90')](_0x40eaa8)){var _0x510445=[];for(var _0x1b55b3=0x0;_0x1b55b3<_0x40eaa8[_0xb8bc('0x47')];_0x1b55b3++){if(_0x40eaa8[_0x1b55b3][_0xb8bc('0x73')]){_0x510445['push'](db[_0xb8bc('0x7a')][_0xb8bc('0x7b')]({'membername':_0x40eaa8[_0x1b55b3][_0xb8bc('0x37')],'UserId':_0x40eaa8[_0x1b55b3]['id'],'queue_name':_0x118890['name'],'VoiceQueueId':_0x118890['id'],'interface':_[_0xb8bc('0x7c')](_0x40eaa8[_0x1b55b3][_0xb8bc('0x7e')])?util['format'](_0xb8bc('0x91'),_0x40eaa8[_0x1b55b3]['name']):_0x40eaa8[_0x1b55b3][_0xb8bc('0x7e')],'paused':_0x40eaa8[_0x1b55b3][_0xb8bc('0x7f')]||![],'penalty':_0x4d9bcf[_0xb8bc('0x55')]['penalty']||0x0}));}}return BPromise['all'](_0x510445);}})[_0xb8bc('0x2b')](function(){return _0x518b7a;})['then'](respondWithResult(_0x31e11f,null))['catch'](handleError(_0x31e11f,null));};exports['removeAgents']=function(_0x20e285,_0x4176a8,_0x386c60){return db[_0xb8bc('0x3d')][_0xb8bc('0x57')]({'where':{'id':_0x20e285[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x4176a8,null))['then'](function(_0x9f7ed7){if(_0x9f7ed7){return _0x9f7ed7[_0xb8bc('0x92')](_0x20e285[_0xb8bc('0x41')]['ids'])[_0xb8bc('0x2b')](function(){if(_[_0xb8bc('0x93')](_0x20e285[_0xb8bc('0x41')][_0xb8bc('0x82')])){for(var _0x8953e9=0x0;_0x8953e9<_0x20e285[_0xb8bc('0x41')]['ids']['length'];_0x8953e9+=0x1){socket[_0xb8bc('0x80')](_0xb8bc('0x94'),{'UserId':Number(_0x20e285[_0xb8bc('0x41')]['ids'][_0x8953e9]),'VoiceQueueId':Number(_0x20e285['params']['id'])});}}else{socket[_0xb8bc('0x80')](_0xb8bc('0x94'),{'UserId':Number(_0x20e285[_0xb8bc('0x41')]['ids']),'VoiceQueueId':Number(_0x20e285['params']['id'])});}});}})[_0xb8bc('0x2b')](function(_0x3d1179){return db['UserVoiceQueueRt'][_0xb8bc('0x2a')]({'where':{'VoiceQueueId':_0x20e285[_0xb8bc('0x54')]['id'],'UserId':_0x20e285[_0xb8bc('0x41')][_0xb8bc('0x82')]}})[_0xb8bc('0x2b')](function(){return _0x3d1179;});})[_0xb8bc('0x2b')](respondWithStatusCode(_0x4176a8,null))[_0xb8bc('0x52')](handleError(_0x4176a8,null));};exports[_0xb8bc('0x95')]=function(_0x5add6b,_0x322a5e,_0xe1f62b){var _0x413555={};var _0x4f6194={};var _0xe56c18;var _0x4f30b2;return db[_0xb8bc('0x3d')][_0xb8bc('0x64')]({'where':{'id':_0x5add6b[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x322a5e,null))[_0xb8bc('0x2b')](function(_0x12741a){if(_0x12741a){_0xe56c18=_0x12741a;_0x4f6194[_0xb8bc('0x40')]=_['keys'](db['User'][_0xb8bc('0x3e')]);_0x4f6194[_0xb8bc('0x41')]=_[_0xb8bc('0x42')](_0x5add6b['query']);_0x4f6194[_0xb8bc('0x43')]=_['intersection'](_0x4f6194['model'],_0x4f6194[_0xb8bc('0x41')]);_0x413555[_0xb8bc('0x45')]=_[_0xb8bc('0x44')](_0x4f6194['model'],qs[_0xb8bc('0x46')](_0x5add6b[_0xb8bc('0x41')]['fields']));_0x413555['attributes']=_0x413555['attributes'][_0xb8bc('0x47')]?_0x413555[_0xb8bc('0x45')]:_0x4f6194[_0xb8bc('0x40')];_0x413555[_0xb8bc('0x49')]=qs[_0xb8bc('0x4a')](_0x5add6b[_0xb8bc('0x41')][_0xb8bc('0x4a')]);_0x413555[_0xb8bc('0x4b')]=qs[_0xb8bc('0x43')](_[_0xb8bc('0x66')](_0x5add6b[_0xb8bc('0x41')],_0x4f6194[_0xb8bc('0x43')]));if(_0x5add6b[_0xb8bc('0x41')]['filter']){_0x413555[_0xb8bc('0x4b')]=_[_0xb8bc('0x4c')](_0x413555['where'],{'$or':_[_0xb8bc('0x33')](_0x413555[_0xb8bc('0x45')],function(_0x35837c){var _0x477960={};_0x477960[_0x35837c]={'$like':'%'+_0x5add6b[_0xb8bc('0x41')][_0xb8bc('0x31')]+'%'};return _0x477960;})});}_0x413555=_[_0xb8bc('0x4c')]({},_0x413555,_0x5add6b[_0xb8bc('0x5c')]);return _0xe56c18[_0xb8bc('0x95')](_0x413555);}})[_0xb8bc('0x2b')](function(_0x344ad4){if(_0x344ad4){_0x4f30b2=_0x344ad4[_0xb8bc('0x47')];if(!_0x5add6b[_0xb8bc('0x41')][_0xb8bc('0x6a')](_0xb8bc('0x48'))){_0x413555[_0xb8bc('0x24')]=qs['limit'](_0x5add6b[_0xb8bc('0x41')][_0xb8bc('0x24')]);_0x413555[_0xb8bc('0x23')]=qs[_0xb8bc('0x23')](_0x5add6b[_0xb8bc('0x41')]['offset']);}return _0xe56c18['getAgents'](_0x413555);}})['then'](function(_0x152e8c){if(_0x152e8c){return _0x152e8c?{'count':_0x4f30b2,'rows':_0x152e8c}:null;}})[_0xb8bc('0x2b')](respondWithResult(_0x322a5e,null))[_0xb8bc('0x52')](handleError(_0x322a5e,null));};exports[_0xb8bc('0x96')]=function(_0x146e4e,_0x4c4f06,_0x5884ec){var _0x53e9d6={};var _0x3e0fd3={};var _0x2bdf3d;var _0xb89324;return db[_0xb8bc('0x3d')]['findOne']({'where':{'id':_0x146e4e[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x4c4f06,null))[_0xb8bc('0x2b')](function(_0x461ab0){if(_0x461ab0){_0x2bdf3d=_0x461ab0;_0x3e0fd3[_0xb8bc('0x40')]=_[_0xb8bc('0x42')](db[_0xb8bc('0x7a')][_0xb8bc('0x3e')]);_0x3e0fd3[_0xb8bc('0x41')]=_[_0xb8bc('0x42')](_0x146e4e[_0xb8bc('0x41')]);_0x3e0fd3[_0xb8bc('0x43')]=_[_0xb8bc('0x44')](_0x3e0fd3[_0xb8bc('0x40')],_0x3e0fd3[_0xb8bc('0x41')]);_0x53e9d6['attributes']=_[_0xb8bc('0x44')](_0x3e0fd3[_0xb8bc('0x40')],qs['fields'](_0x146e4e[_0xb8bc('0x41')][_0xb8bc('0x46')]));_0x53e9d6[_0xb8bc('0x45')]=_0x53e9d6[_0xb8bc('0x45')]['length']?_0x53e9d6[_0xb8bc('0x45')]:_0x3e0fd3[_0xb8bc('0x40')];_0x53e9d6[_0xb8bc('0x49')]=qs[_0xb8bc('0x4a')](_0x146e4e[_0xb8bc('0x41')]['sort']);_0x53e9d6['where']=qs[_0xb8bc('0x43')](_[_0xb8bc('0x66')](_0x146e4e[_0xb8bc('0x41')],_0x3e0fd3[_0xb8bc('0x43')]));if(_0x146e4e[_0xb8bc('0x41')]['filter']){_0x53e9d6[_0xb8bc('0x4b')]=_[_0xb8bc('0x4c')](_0x53e9d6[_0xb8bc('0x4b')],{'$or':_[_0xb8bc('0x33')](_0x53e9d6[_0xb8bc('0x45')],function(_0x16c57f){var _0xd7d7d6={};_0xd7d7d6[_0x16c57f]={'$like':'%'+_0x146e4e['query']['filter']+'%'};return _0xd7d7d6;})});}_0x53e9d6=_['merge']({},_0x53e9d6,_0x146e4e[_0xb8bc('0x5c')]);return _0x2bdf3d[_0xb8bc('0x96')](_0x53e9d6);}})[_0xb8bc('0x2b')](function(_0x589320){if(_0x589320){_0xb89324=_0x589320[_0xb8bc('0x47')];if(!_0x146e4e[_0xb8bc('0x41')]['hasOwnProperty'](_0xb8bc('0x48'))){_0x53e9d6[_0xb8bc('0x24')]=qs['limit'](_0x146e4e[_0xb8bc('0x41')]['limit']);_0x53e9d6[_0xb8bc('0x23')]=qs[_0xb8bc('0x23')](_0x146e4e[_0xb8bc('0x41')][_0xb8bc('0x23')]);}return _0x2bdf3d[_0xb8bc('0x96')](_0x53e9d6);}})[_0xb8bc('0x2b')](function(_0x2085ed){return _0x2085ed?{'count':_0xb89324,'rows':_0x2085ed}:null;})[_0xb8bc('0x2b')](respondWithResult(_0x4c4f06,null))[_0xb8bc('0x52')](handleError(_0x4c4f06,null));};exports[_0xb8bc('0x97')]=function(_0x3ea6e6,_0x34cd81,_0x58f1b5){var _0x584938={};var _0x3d7877={};var _0x2eb55c;var _0x53be52;return db['VoiceQueue']['findOne']({'where':{'id':_0x3ea6e6[_0xb8bc('0x54')]['id']}})['then'](handleEntityNotFound(_0x34cd81,null))[_0xb8bc('0x2b')](function(_0x1546c4){if(_0x1546c4){_0x2eb55c=_0x1546c4;_0x3d7877[_0xb8bc('0x40')]=_[_0xb8bc('0x42')](db[_0xb8bc('0x98')][_0xb8bc('0x3e')]);_0x3d7877[_0xb8bc('0x41')]=_[_0xb8bc('0x42')](_0x3ea6e6[_0xb8bc('0x41')]);_0x3d7877['filters']=_[_0xb8bc('0x44')](_0x3d7877['model'],_0x3d7877[_0xb8bc('0x41')]);_0x584938[_0xb8bc('0x45')]=_[_0xb8bc('0x44')](_0x3d7877[_0xb8bc('0x40')],qs[_0xb8bc('0x46')](_0x3ea6e6['query'][_0xb8bc('0x46')]));_0x584938[_0xb8bc('0x45')]=_0x584938[_0xb8bc('0x45')]['length']?_0x584938['attributes']:_0x3d7877[_0xb8bc('0x40')];_0x584938[_0xb8bc('0x49')]=qs[_0xb8bc('0x4a')](_0x3ea6e6[_0xb8bc('0x41')][_0xb8bc('0x4a')]);_0x584938[_0xb8bc('0x4b')]=qs[_0xb8bc('0x43')](_[_0xb8bc('0x66')](_0x3ea6e6[_0xb8bc('0x41')],_0x3d7877[_0xb8bc('0x43')]));if(_0x3ea6e6[_0xb8bc('0x41')][_0xb8bc('0x31')]){_0x584938[_0xb8bc('0x4b')]=_[_0xb8bc('0x4c')](_0x584938[_0xb8bc('0x4b')],{'$or':_[_0xb8bc('0x33')](_0x584938[_0xb8bc('0x45')],function(_0x1bd7c7){var _0x3068d3={};_0x3068d3[_0x1bd7c7]={'$like':'%'+_0x3ea6e6[_0xb8bc('0x41')]['filter']+'%'};return _0x3068d3;})});}_0x584938=_[_0xb8bc('0x4c')]({},_0x584938,_0x3ea6e6[_0xb8bc('0x5c')]);return _0x2eb55c[_0xb8bc('0x97')](_0x584938);}})[_0xb8bc('0x2b')](function(_0x5a41f3){if(_0x5a41f3){_0x53be52=_0x5a41f3['length'];if(!_0x3ea6e6['query'][_0xb8bc('0x6a')](_0xb8bc('0x48'))){_0x584938['limit']=qs[_0xb8bc('0x24')](_0x3ea6e6[_0xb8bc('0x41')][_0xb8bc('0x24')]);_0x584938[_0xb8bc('0x23')]=qs['offset'](_0x3ea6e6['query'][_0xb8bc('0x23')]);}return _0x2eb55c['getLists'](_0x584938);}})[_0xb8bc('0x2b')](function(_0x11f1ab){if(_0x11f1ab){return _0x11f1ab?{'count':_0x53be52,'rows':_0x11f1ab}:null;}})[_0xb8bc('0x2b')](respondWithResult(_0x34cd81,null))[_0xb8bc('0x52')](handleError(_0x34cd81,null));};exports['addLists']=function(_0x1c912f,_0x40a248,_0x15d501){var _0x1053b6,_0x36abf6;return db[_0xb8bc('0x3d')]['find']({'where':{'id':_0x1c912f['params']['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x40a248,null))[_0xb8bc('0x2b')](function(_0x367740){if(_0x367740){_0x36abf6=_0x367740;return _0x367740['addLists'](_0x1c912f[_0xb8bc('0x55')]['ids'],_[_0xb8bc('0x5d')](_0x1c912f[_0xb8bc('0x55')],['ids','id'])||{});}return null;})[_0xb8bc('0x8f')](function(_0x33b0d6){var _0x4cfcbb;_0x1053b6=_0x33b0d6||[];var _0xf23a47=[];if(_0x33b0d6){for(var _0x3c9f0d=0x0;_0x3c9f0d<_0x33b0d6['length'];_0x3c9f0d+=0x1){var _0x15288b=_0x33b0d6[_0x3c9f0d][_0xb8bc('0x2c')]({'plain':!![]});_0x36abf6[_0xb8bc('0x99')]=_0x1c912f[_0xb8bc('0x55')][_0xb8bc('0x99')]?_0x1c912f[_0xb8bc('0x55')][_0xb8bc('0x99')]:_0x36abf6[_0xb8bc('0x99')];switch(_0x36abf6[_0xb8bc('0x99')]){case _0xb8bc('0x9a'):_0x4cfcbb=squel[_0xb8bc('0x9b')]()['into']('cm_hopper')['fromQuery']([_0xb8bc('0x9c'),'scheduledAt',_0xb8bc('0x9d'),'ListId',_0xb8bc('0x67'),_0xb8bc('0x5e'),_0xb8bc('0x5f')],squel[_0xb8bc('0x9e')]()[_0xb8bc('0x9f')](_0xb8bc('0x9c'),_0xb8bc('0x9c'))['field'](_0xb8bc('0xa0'),'scheduledAt')[_0xb8bc('0x9f')]('id','ContactId')[_0xb8bc('0x9f')](_0x15288b[_0xb8bc('0xa1')][_0xb8bc('0x88')](),_0xb8bc('0xa2'))[_0xb8bc('0x9f')](_0x1c912f[_0xb8bc('0x54')]['id'][_0xb8bc('0x88')](),_0xb8bc('0x67'))[_0xb8bc('0x9f')](_0xb8bc('0xa0'),_0xb8bc('0x5e'))['field'](_0xb8bc('0xa0'),'updatedAt')[_0xb8bc('0xa3')](_0xb8bc('0xa4'))[_0xb8bc('0x4b')]('deletedAt\x20IS\x20NULL')[_0xb8bc('0x4b')](_0xb8bc('0xa5'),_0x15288b['CmListId'][_0xb8bc('0x88')]())[_0xb8bc('0x4b')]('phone\x20IS\x20NOT\x20NULL')[_0xb8bc('0x4b')](_0xb8bc('0xa6'),squel[_0xb8bc('0x9e')]()[_0xb8bc('0x9f')](_0xb8bc('0xa7'))[_0xb8bc('0xa3')](_0xb8bc('0xa8'))[_0xb8bc('0x4b')](_0xb8bc('0x85'),_0x1c912f[_0xb8bc('0x54')]['id'][_0xb8bc('0x88')]()))[_0xb8bc('0x4b')](_0xb8bc('0xa6'),squel[_0xb8bc('0x9e')]()[_0xb8bc('0x9f')](_0xb8bc('0xa9'))[_0xb8bc('0xa3')](_0xb8bc('0xaa'))[_0xb8bc('0x4b')]('VoiceQueueId\x20=\x20?',_0x1c912f['params']['id']['toString']())))[_0xb8bc('0x88')]();break;case'onlyIfOpen':_0x4cfcbb=squel[_0xb8bc('0x9b')]()[_0xb8bc('0xab')](_0xb8bc('0xaa'))[_0xb8bc('0xac')](['phone',_0xb8bc('0xad'),_0xb8bc('0x9d'),'ListId',_0xb8bc('0x67'),_0xb8bc('0x5e'),_0xb8bc('0x5f')],squel['select']()[_0xb8bc('0x9f')]('phone',_0xb8bc('0x9c'))[_0xb8bc('0x9f')](_0xb8bc('0xa0'),'scheduledAt')[_0xb8bc('0x9f')]('id',_0xb8bc('0x9d'))[_0xb8bc('0x9f')](_0x15288b[_0xb8bc('0xa1')][_0xb8bc('0x88')](),_0xb8bc('0xa2'))[_0xb8bc('0x9f')](_0x1c912f[_0xb8bc('0x54')]['id']['toString'](),_0xb8bc('0x67'))[_0xb8bc('0x9f')]('NOW()',_0xb8bc('0x5e'))[_0xb8bc('0x9f')](_0xb8bc('0xa0'),_0xb8bc('0x5f'))['from']('cm_contacts')[_0xb8bc('0x4b')]('deletedAt\x20IS\x20NULL')[_0xb8bc('0x4b')](_0xb8bc('0xa5'),_0x15288b[_0xb8bc('0xa1')][_0xb8bc('0x88')]())[_0xb8bc('0x4b')](_0xb8bc('0xae'))[_0xb8bc('0x4b')](_0xb8bc('0xa6'),squel[_0xb8bc('0x9e')]()[_0xb8bc('0x9f')](_0xb8bc('0xa9'))[_0xb8bc('0xa3')](_0xb8bc('0xaa'))['where']('VoiceQueueId\x20=\x20?',_0x1c912f[_0xb8bc('0x54')]['id'][_0xb8bc('0x88')]())))[_0xb8bc('0x88')]();break;default:_0x4cfcbb=squel['insert']()[_0xb8bc('0xab')]('cm_hopper')[_0xb8bc('0xac')]([_0xb8bc('0x9c'),_0xb8bc('0xad'),_0xb8bc('0x9d'),_0xb8bc('0xa2'),_0xb8bc('0x67'),'createdAt',_0xb8bc('0x5f')],squel[_0xb8bc('0x9e')]()[_0xb8bc('0x9f')]('phone','phone')[_0xb8bc('0x9f')](_0xb8bc('0xa0'),'scheduledAt')[_0xb8bc('0x9f')]('id',_0xb8bc('0x9d'))['field'](_0x15288b[_0xb8bc('0xa1')]['toString'](),_0xb8bc('0xa2'))[_0xb8bc('0x9f')](_0x1c912f[_0xb8bc('0x54')]['id'][_0xb8bc('0x88')](),_0xb8bc('0x67'))[_0xb8bc('0x9f')]('NOW()','createdAt')[_0xb8bc('0x9f')](_0xb8bc('0xa0'),_0xb8bc('0x5f'))[_0xb8bc('0xa3')](_0xb8bc('0xa4'))[_0xb8bc('0x4b')](_0xb8bc('0xaf'))['where'](_0xb8bc('0xa5'),_0x15288b['CmListId']['toString']())['where'](_0xb8bc('0xae')))[_0xb8bc('0x88')]();}_0xf23a47['push'](db[_0xb8bc('0x77')][_0xb8bc('0x41')](_0x4cfcbb));}return BPromise[_0xb8bc('0xb0')](_0xf23a47);}})['then'](function(){return _0x1053b6;})['then'](respondWithResult(_0x40a248,null))['catch'](handleError(_0x40a248,null));};exports['removeLists']=function(_0x1c68b9,_0x379d96,_0x5b38ed){return db['VoiceQueue'][_0xb8bc('0x57')]({'where':{'id':_0x1c68b9[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x379d96,null))[_0xb8bc('0x2b')](function(_0x110bc6){if(_0x110bc6){return _0x110bc6[_0xb8bc('0xb1')](_0x1c68b9['query'][_0xb8bc('0x82')]);}})[_0xb8bc('0x2b')](function(_0x5f3edd){if(_0x5f3edd){return db['CmHopper'][_0xb8bc('0x2a')]({'where':{'ListId':_0x1c68b9[_0xb8bc('0x41')]['ids'],'VoiceQueueId':_0x1c68b9[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](function(){return _0x5f3edd;});}})[_0xb8bc('0x2b')](respondWithStatusCode(_0x379d96,null))[_0xb8bc('0x52')](handleError(_0x379d96,null));};exports[_0xb8bc('0xb2')]=function(_0x185dcd,_0x2a387d,_0x16d1b6){var _0x58c10e={};var _0xdc4bc5={};var _0x1c1bd1;var _0x3043d2;return db[_0xb8bc('0x3d')][_0xb8bc('0x64')]({'where':{'id':_0x185dcd[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x2a387d,null))[_0xb8bc('0x2b')](function(_0x2b36b1){if(_0x2b36b1){_0x1c1bd1=_0x2b36b1;_0xdc4bc5[_0xb8bc('0x40')]=_['keys'](db['CmList'][_0xb8bc('0x3e')]);_0xdc4bc5[_0xb8bc('0x41')]=_[_0xb8bc('0x42')](_0x185dcd['query']);_0xdc4bc5[_0xb8bc('0x43')]=_[_0xb8bc('0x44')](_0xdc4bc5[_0xb8bc('0x40')],_0xdc4bc5[_0xb8bc('0x41')]);_0x58c10e[_0xb8bc('0x45')]=_[_0xb8bc('0x44')](_0xdc4bc5[_0xb8bc('0x40')],qs[_0xb8bc('0x46')](_0x185dcd[_0xb8bc('0x41')][_0xb8bc('0x46')]));_0x58c10e['attributes']=_0x58c10e[_0xb8bc('0x45')][_0xb8bc('0x47')]?_0x58c10e[_0xb8bc('0x45')]:_0xdc4bc5[_0xb8bc('0x40')];_0x58c10e[_0xb8bc('0x49')]=qs['sort'](_0x185dcd[_0xb8bc('0x41')][_0xb8bc('0x4a')]);_0x58c10e['where']=qs[_0xb8bc('0x43')](_[_0xb8bc('0x66')](_0x185dcd[_0xb8bc('0x41')],_0xdc4bc5[_0xb8bc('0x43')]));if(_0x185dcd[_0xb8bc('0x41')][_0xb8bc('0x31')]){_0x58c10e[_0xb8bc('0x4b')]=_[_0xb8bc('0x4c')](_0x58c10e['where'],{'$or':_[_0xb8bc('0x33')](_0x58c10e['attributes'],function(_0x51dbf8){var _0x1f2537={};_0x1f2537[_0x51dbf8]={'$like':'%'+_0x185dcd[_0xb8bc('0x41')][_0xb8bc('0x31')]+'%'};return _0x1f2537;})});}_0x58c10e=_[_0xb8bc('0x4c')]({},_0x58c10e,_0x185dcd[_0xb8bc('0x5c')]);return _0x1c1bd1[_0xb8bc('0xb2')](_0x58c10e);}})[_0xb8bc('0x2b')](function(_0x36c8f3){if(_0x36c8f3){_0x3043d2=_0x36c8f3[_0xb8bc('0x47')];if(!_0x185dcd[_0xb8bc('0x41')][_0xb8bc('0x6a')](_0xb8bc('0x48'))){_0x58c10e[_0xb8bc('0x24')]=qs[_0xb8bc('0x24')](_0x185dcd[_0xb8bc('0x41')][_0xb8bc('0x24')]);_0x58c10e[_0xb8bc('0x23')]=qs[_0xb8bc('0x23')](_0x185dcd[_0xb8bc('0x41')][_0xb8bc('0x23')]);}return _0x1c1bd1[_0xb8bc('0xb2')](_0x58c10e);}})[_0xb8bc('0x2b')](function(_0x481a40){if(_0x481a40){return _0x481a40?{'count':_0x3043d2,'rows':_0x481a40}:null;}})[_0xb8bc('0x2b')](respondWithResult(_0x2a387d,null))[_0xb8bc('0x52')](handleError(_0x2a387d,null));};exports[_0xb8bc('0xb3')]=function(_0x2bdf6b,_0x4235ae,_0x789d01){var _0x761259,_0x160345;return db[_0xb8bc('0x3d')]['find']({'where':{'id':_0x2bdf6b['params']['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x4235ae,null))[_0xb8bc('0x2b')](function(_0x2bf480){if(_0x2bf480){_0x160345=_0x2bf480;return _0x2bf480[_0xb8bc('0xb3')](_0x2bdf6b[_0xb8bc('0x55')][_0xb8bc('0x82')],_[_0xb8bc('0x5d')](_0x2bdf6b[_0xb8bc('0x55')],['ids','id'])||{});}return null;})[_0xb8bc('0x8f')](function(_0x423136){var _0x4c389f;_0x761259=_0x423136||[];var _0x58a34f=[];if(_0x423136){for(var _0x449773=0x0;_0x449773<_0x423136['length'];_0x449773+=0x1){var _0x2b6ea8=_0x423136[_0x449773][_0xb8bc('0x2c')]({'plain':!![]});_0x4c389f=squel['insert']()[_0xb8bc('0xab')](_0xb8bc('0xb4'))[_0xb8bc('0xac')]([_0xb8bc('0x9c'),_0xb8bc('0x9d'),_0xb8bc('0xa2'),_0xb8bc('0x67'),'createdAt','updatedAt'],squel[_0xb8bc('0x9e')]()[_0xb8bc('0x9f')]('phone','phone')[_0xb8bc('0x9f')]('id',_0xb8bc('0x9d'))[_0xb8bc('0x9f')](_0x2b6ea8[_0xb8bc('0xa1')]['toString'](),_0xb8bc('0xa2'))[_0xb8bc('0x9f')](_0x2bdf6b[_0xb8bc('0x54')]['id']['toString'](),_0xb8bc('0x67'))['field'](_0xb8bc('0xa0'),'createdAt')[_0xb8bc('0x9f')](_0xb8bc('0xa0'),_0xb8bc('0x5f'))['from'](_0xb8bc('0xa4'))[_0xb8bc('0x4b')](_0xb8bc('0xaf'))['where']('ListId\x20=\x20?',_0x2b6ea8[_0xb8bc('0xa1')][_0xb8bc('0x88')]())[_0xb8bc('0x4b')](_0xb8bc('0xae')))['toString']();_0x58a34f['push'](db[_0xb8bc('0x77')][_0xb8bc('0x41')](_0x4c389f));}return BPromise[_0xb8bc('0xb0')](_0x58a34f);}})[_0xb8bc('0x2b')](function(){return _0x761259;})[_0xb8bc('0x2b')](respondWithResult(_0x4235ae,null))[_0xb8bc('0x52')](handleError(_0x4235ae,null));};exports['removeBlackLists']=function(_0xbdd021,_0x3a5cf0,_0x19a363){return db[_0xb8bc('0x3d')][_0xb8bc('0x57')]({'where':{'id':_0xbdd021[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](handleEntityNotFound(_0x3a5cf0,null))['then'](function(_0x4a5932){if(_0x4a5932){return _0x4a5932['removeBlackLists'](_0xbdd021['query'][_0xb8bc('0x82')]);}})['then'](function(_0x552e49){if(_0x552e49){return db['CmHopperBlack'][_0xb8bc('0x2a')]({'where':{'ListId':_0xbdd021[_0xb8bc('0x41')][_0xb8bc('0x82')],'VoiceQueueId':_0xbdd021[_0xb8bc('0x54')]['id']}})[_0xb8bc('0x2b')](function(){return _0x552e49;});}})[_0xb8bc('0x2b')](respondWithStatusCode(_0x3a5cf0,null))['catch'](handleError(_0x3a5cf0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index da88bff..2a46243 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 _0x17ae=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove'];(function(_0x22f17b,_0x42051b){var _0x77e8b1=function(_0x59ebc2){while(--_0x59ebc2){_0x22f17b['push'](_0x22f17b['shift']());}};_0x77e8b1(++_0x42051b);}(_0x17ae,0x1e9));var _0xe17a=function(_0x2946cb,_0x1aed1e){_0x2946cb=_0x2946cb-0x0;var _0xae7041=_0x17ae[_0x2946cb];return _0xae7041;};'use strict';var EventEmitter=require(_0xe17a('0x0'));var VoiceQueue=require(_0xe17a('0x1'))['db'][_0xe17a('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe17a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe17a('0x4'),'afterDestroy':_0xe17a('0x5')};function emitEvent(_0x58818d){return function(_0x4ce3f1,_0x17cdcf,_0x5ca90e){VoiceQueueEvents[_0xe17a('0x6')](_0x58818d+':'+_0x4ce3f1['id'],_0x4ce3f1);VoiceQueueEvents[_0xe17a('0x6')](_0x58818d,_0x4ce3f1);_0x5ca90e(null);};}for(var e in events){if(events[_0xe17a('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xe17a('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xf0b4=['../../mysqldb','VoiceQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3fef4c,_0x4c6076){var _0xc4f172=function(_0x3ffc5b){while(--_0x3ffc5b){_0x3fef4c['push'](_0x3fef4c['shift']());}};_0xc4f172(++_0x4c6076);}(_0xf0b4,0x194));var _0x4f0b=function(_0x57cefa,_0xea48f2){_0x57cefa=_0x57cefa-0x0;var _0x254cd7=_0xf0b4[_0x57cefa];return _0x254cd7;};'use strict';var EventEmitter=require(_0x4f0b('0x0'));var VoiceQueue=require(_0x4f0b('0x1'))['db'][_0x4f0b('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4f0b('0x3'),'afterUpdate':_0x4f0b('0x4'),'afterDestroy':_0x4f0b('0x5')};function emitEvent(_0x1535c9){return function(_0x4c59aa,_0x104282,_0x466c04){VoiceQueueEvents[_0x4f0b('0x6')](_0x1535c9+':'+_0x4c59aa['id'],_0x4c59aa);VoiceQueueEvents[_0x4f0b('0x6')](_0x1535c9,_0x4c59aa);_0x466c04(null);};}for(var e in events){if(events[_0x4f0b('0x7')](e)){var event=events[e];VoiceQueue[_0x4f0b('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 2257c86..d463eb7 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 _0x7401=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','util'];(function(_0x1c9616,_0x3c2df0){var _0x950b78=function(_0x1099a5){while(--_0x1099a5){_0x1c9616['push'](_0x1c9616['shift']());}};_0x950b78(++_0x3c2df0);}(_0x7401,0xf5));var _0x1740=function(_0x1e1c71,_0x22e136){_0x1e1c71=_0x1e1c71-0x0;var _0x395717=_0x7401[_0x1e1c71];return _0x395717;};'use strict';var _=require(_0x1740('0x0'));var util=require(_0x1740('0x1'));var logger=require(_0x1740('0x2'))(_0x1740('0x3'));var moment=require(_0x1740('0x4'));var BPromise=require('bluebird');var rp=require(_0x1740('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1740('0x6'));var config=require(_0x1740('0x7'));var attributes=require(_0x1740('0x8'));module[_0x1740('0x9')]=function(_0x5bb0ff,_0x3b1e5){return _0x5bb0ff[_0x1740('0xa')](_0x1740('0xb'),attributes,{'tableName':_0x1740('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3948=['./voiceQueue.attributes','exports','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xc86f3f,_0x1ca047){var _0x3075eb=function(_0x2df091){while(--_0x2df091){_0xc86f3f['push'](_0xc86f3f['shift']());}};_0x3075eb(++_0x1ca047);}(_0x3948,0x122));var _0x8394=function(_0x53e8c3,_0x3dab85){_0x53e8c3=_0x53e8c3-0x0;var _0x4cde42=_0x3948[_0x53e8c3];return _0x4cde42;};'use strict';var _=require(_0x8394('0x0'));var util=require(_0x8394('0x1'));var logger=require(_0x8394('0x2'))(_0x8394('0x3'));var moment=require(_0x8394('0x4'));var BPromise=require(_0x8394('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8394('0x6'));var rimraf=require(_0x8394('0x7'));var config=require(_0x8394('0x8'));var attributes=require(_0x8394('0x9'));module[_0x8394('0xa')]=function(_0x1d4d73,_0x7d46bc){return _0x1d4d73['define'](_0x8394('0xb'),attributes,{'tableName':_0x8394('0xc'),'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 436370a..be5334b 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 _0x92a6=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetVoiceQueue','findAll','options','raw','attributes','include','map','model','then','stringify','ShowVoiceQueue','VoiceQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3cef48,_0x4b8910){var _0x25b578=function(_0xe33e9e){while(--_0xe33e9e){_0x3cef48['push'](_0x3cef48['shift']());}};_0x25b578(++_0x4b8910);}(_0x92a6,0xa4));var _0x692a=function(_0x5b323a,_0x17f67f){_0x5b323a=_0x5b323a-0x0;var _0x1c2826=_0x92a6[_0x5b323a];return _0x1c2826;};'use strict';var _=require(_0x692a('0x0'));var util=require(_0x692a('0x1'));var moment=require(_0x692a('0x2'));var BPromise=require(_0x692a('0x3'));var rs=require(_0x692a('0x4'));var fs=require('fs');var Redis=require(_0x692a('0x5'));var db=require(_0x692a('0x6'))['db'];var utils=require(_0x692a('0x7'));var logger=require(_0x692a('0x8'))(_0x692a('0x9'));var config=require(_0x692a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x692a('0xb')][_0x692a('0xc')]({'port':0x232a});config[_0x692a('0xd')]=_[_0x692a('0xe')](config[_0x692a('0xd')],{'host':_0x692a('0xf'),'port':0x18eb});var socket=require(_0x692a('0x10'))(new Redis(config['redis']));require(_0x692a('0x11'))[_0x692a('0x12')](socket);function respondWithRpcPromise(_0x2d4ae3,_0xda3fa3,_0x418635){return new BPromise(function(_0x375afc,_0x12220f){return client[_0x692a('0x13')](_0x2d4ae3,_0x418635)['then'](function(_0x140acc){logger[_0x692a('0x14')](_0x692a('0x15'),_0xda3fa3,'request\x20sent');logger[_0x692a('0x16')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xda3fa3,_0x692a('0x17'),JSON['stringify'](_0x140acc));if(_0x140acc['error']){if(_0x140acc[_0x692a('0x18')][_0x692a('0x19')]===0x1f4){logger[_0x692a('0x18')](_0x692a('0x15'),_0xda3fa3,_0x140acc[_0x692a('0x18')][_0x692a('0x1a')]);return _0x12220f(_0x140acc[_0x692a('0x18')]['message']);}logger['error'](_0x692a('0x15'),_0xda3fa3,_0x140acc[_0x692a('0x18')]['message']);return _0x375afc(_0x140acc[_0x692a('0x18')][_0x692a('0x1a')]);}else{logger[_0x692a('0x14')](_0x692a('0x15'),_0xda3fa3,_0x692a('0x17'));_0x375afc(_0x140acc[_0x692a('0x1b')][_0x692a('0x1a')]);}})[_0x692a('0x1c')](function(_0x57c4e1){logger[_0x692a('0x18')]('VoiceQueue,\x20%s,\x20%s',_0xda3fa3,_0x57c4e1);_0x12220f(_0x57c4e1);});});}exports[_0x692a('0x1d')]=function(_0xde407b){var _0x283928=this;return new Promise(function(_0x89524c,_0xabe7e0){return db['VoiceQueue'][_0x692a('0x1e')]({'raw':_0xde407b[_0x692a('0x1f')]?_0xde407b[_0x692a('0x1f')][_0x692a('0x20')]===undefined?!![]:![]:!![],'where':_0xde407b[_0x692a('0x1f')]?_0xde407b['options']['where']||null:null,'attributes':_0xde407b[_0x692a('0x1f')]?_0xde407b['options'][_0x692a('0x21')]||null:null,'limit':_0xde407b['options']?_0xde407b[_0x692a('0x1f')]['limit']||null:null,'include':_0xde407b['options']?_0xde407b[_0x692a('0x1f')][_0x692a('0x22')]?_[_0x692a('0x23')](_0xde407b[_0x692a('0x1f')]['include'],function(_0x5a7c8c){return{'model':db[_0x5a7c8c[_0x692a('0x24')]],'as':_0x5a7c8c['as'],'attributes':_0x5a7c8c[_0x692a('0x21')],'include':_0x5a7c8c['include']?_[_0x692a('0x23')](_0x5a7c8c[_0x692a('0x22')],function(_0x22b8c9){return{'model':db[_0x22b8c9[_0x692a('0x24')]],'as':_0x22b8c9['as'],'attributes':_0x22b8c9[_0x692a('0x21')],'include':_0x22b8c9[_0x692a('0x22')]?_['map'](_0x22b8c9[_0x692a('0x22')],function(_0x1374ed){return{'model':db[_0x1374ed[_0x692a('0x24')]],'as':_0x1374ed['as'],'attributes':_0x1374ed[_0x692a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x692a('0x25')](function(_0x1c90dc){logger['info']('GetVoiceQueue',_0xde407b);logger[_0x692a('0x16')](_0x692a('0x1d'),_0xde407b,JSON[_0x692a('0x26')](_0x1c90dc));_0x89524c(_0x1c90dc);})[_0x692a('0x1c')](function(_0x1f80c3){logger[_0x692a('0x18')](_0x692a('0x1d'),_0x1f80c3[_0x692a('0x1a')],_0xde407b);_0xabe7e0(_0x283928['error'](0x1f4,_0x1f80c3['message']));});});};exports[_0x692a('0x27')]=function(_0x4171b7){var _0xef1d7a=this;return new Promise(function(_0x20a8c4,_0x4742ee){return db[_0x692a('0x28')][_0x692a('0x29')]({'raw':_0x4171b7[_0x692a('0x1f')]?_0x4171b7[_0x692a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4171b7[_0x692a('0x1f')]?_0x4171b7[_0x692a('0x1f')][_0x692a('0x2a')]||null:null,'attributes':_0x4171b7[_0x692a('0x1f')]?_0x4171b7[_0x692a('0x1f')]['attributes']||null:null,'include':_0x4171b7[_0x692a('0x1f')]?_0x4171b7[_0x692a('0x1f')]['include']?_[_0x692a('0x23')](_0x4171b7[_0x692a('0x1f')][_0x692a('0x22')],function(_0x1dab59){return{'model':db[_0x1dab59[_0x692a('0x24')]],'as':_0x1dab59['as'],'attributes':_0x1dab59['attributes'],'include':_0x1dab59[_0x692a('0x22')]?_[_0x692a('0x23')](_0x1dab59[_0x692a('0x22')],function(_0x209b30){return{'model':db[_0x209b30[_0x692a('0x24')]],'as':_0x209b30['as'],'attributes':_0x209b30['attributes'],'include':_0x209b30['include']?_['map'](_0x209b30['include'],function(_0x3b2aef){return{'model':db[_0x3b2aef[_0x692a('0x24')]],'as':_0x3b2aef['as'],'attributes':_0x3b2aef['attributes']};}):[]};}):[]};}):[]:[]})[_0x692a('0x25')](function(_0x1e8fe4){logger[_0x692a('0x14')](_0x692a('0x27'),_0x4171b7);logger[_0x692a('0x16')](_0x692a('0x27'),_0x4171b7,JSON[_0x692a('0x26')](_0x1e8fe4));_0x20a8c4(_0x1e8fe4);})[_0x692a('0x1c')](function(_0x47b319){logger['error'](_0x692a('0x27'),_0x47b319[_0x692a('0x1a')],_0x4171b7);_0x4742ee(_0xef1d7a[_0x692a('0x18')](0x1f4,_0x47b319[_0x692a('0x1a')]));});});}; \ No newline at end of file +var _0xfd75=['options','raw','where','attributes','include','map','model','ShowVoiceQueue','stringify','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetVoiceQueue','VoiceQueue'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0xfd75,0xa1));var _0x5fd7=function(_0x1dfa55,_0x1d2007){_0x1dfa55=_0x1dfa55-0x0;var _0x893d0e=_0xfd75[_0x1dfa55];return _0x893d0e;};'use strict';var _=require(_0x5fd7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5fd7('0x1'));var fs=require('fs');var Redis=require(_0x5fd7('0x2'));var db=require(_0x5fd7('0x3'))['db'];var utils=require(_0x5fd7('0x4'));var logger=require(_0x5fd7('0x5'))(_0x5fd7('0x6'));var config=require(_0x5fd7('0x7'));var jayson=require(_0x5fd7('0x8'));var client=jayson[_0x5fd7('0x9')][_0x5fd7('0xa')]({'port':0x232a});config[_0x5fd7('0xb')]=_[_0x5fd7('0xc')](config[_0x5fd7('0xb')],{'host':_0x5fd7('0xd'),'port':0x18eb});var socket=require(_0x5fd7('0xe'))(new Redis(config['redis']));require(_0x5fd7('0xf'))[_0x5fd7('0x10')](socket);function respondWithRpcPromise(_0x587d04,_0x3b976e,_0x5d83dd){return new BPromise(function(_0x504299,_0x47698e){return client[_0x5fd7('0x11')](_0x587d04,_0x5d83dd)[_0x5fd7('0x12')](function(_0x5efde8){logger['info'](_0x5fd7('0x13'),_0x3b976e,_0x5fd7('0x14'));logger[_0x5fd7('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x3b976e,_0x5fd7('0x14'),JSON['stringify'](_0x5efde8));if(_0x5efde8[_0x5fd7('0x16')]){if(_0x5efde8[_0x5fd7('0x16')]['code']===0x1f4){logger[_0x5fd7('0x16')](_0x5fd7('0x13'),_0x3b976e,_0x5efde8[_0x5fd7('0x16')][_0x5fd7('0x17')]);return _0x47698e(_0x5efde8['error'][_0x5fd7('0x17')]);}logger[_0x5fd7('0x16')](_0x5fd7('0x13'),_0x3b976e,_0x5efde8[_0x5fd7('0x16')][_0x5fd7('0x17')]);return _0x504299(_0x5efde8['error'][_0x5fd7('0x17')]);}else{logger[_0x5fd7('0x18')](_0x5fd7('0x13'),_0x3b976e,_0x5fd7('0x14'));_0x504299(_0x5efde8[_0x5fd7('0x19')][_0x5fd7('0x17')]);}})[_0x5fd7('0x1a')](function(_0x3e217a){logger[_0x5fd7('0x16')](_0x5fd7('0x13'),_0x3b976e,_0x3e217a);_0x47698e(_0x3e217a);});});}exports[_0x5fd7('0x1b')]=function(_0x55b0b6){var _0x4da7e4=this;return new Promise(function(_0x581002,_0x47ed0b){return db[_0x5fd7('0x1c')]['findAll']({'raw':_0x55b0b6[_0x5fd7('0x1d')]?_0x55b0b6[_0x5fd7('0x1d')][_0x5fd7('0x1e')]===undefined?!![]:![]:!![],'where':_0x55b0b6[_0x5fd7('0x1d')]?_0x55b0b6['options'][_0x5fd7('0x1f')]||null:null,'attributes':_0x55b0b6[_0x5fd7('0x1d')]?_0x55b0b6[_0x5fd7('0x1d')][_0x5fd7('0x20')]||null:null,'limit':_0x55b0b6[_0x5fd7('0x1d')]?_0x55b0b6[_0x5fd7('0x1d')]['limit']||null:null,'include':_0x55b0b6['options']?_0x55b0b6['options'][_0x5fd7('0x21')]?_['map'](_0x55b0b6[_0x5fd7('0x1d')][_0x5fd7('0x21')],function(_0x49e7d1){return{'model':db[_0x49e7d1['model']],'as':_0x49e7d1['as'],'attributes':_0x49e7d1[_0x5fd7('0x20')],'include':_0x49e7d1[_0x5fd7('0x21')]?_[_0x5fd7('0x22')](_0x49e7d1[_0x5fd7('0x21')],function(_0x5441bf){return{'model':db[_0x5441bf[_0x5fd7('0x23')]],'as':_0x5441bf['as'],'attributes':_0x5441bf[_0x5fd7('0x20')],'include':_0x5441bf['include']?_[_0x5fd7('0x22')](_0x5441bf[_0x5fd7('0x21')],function(_0x371adf){return{'model':db[_0x371adf[_0x5fd7('0x23')]],'as':_0x371adf['as'],'attributes':_0x371adf[_0x5fd7('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bb1c5){logger[_0x5fd7('0x18')](_0x5fd7('0x1b'),_0x55b0b6);logger[_0x5fd7('0x15')](_0x5fd7('0x1b'),_0x55b0b6,JSON['stringify'](_0x5bb1c5));_0x581002(_0x5bb1c5);})[_0x5fd7('0x1a')](function(_0x3faad7){logger[_0x5fd7('0x16')]('GetVoiceQueue',_0x3faad7['message'],_0x55b0b6);_0x47ed0b(_0x4da7e4[_0x5fd7('0x16')](0x1f4,_0x3faad7[_0x5fd7('0x17')]));});});};exports[_0x5fd7('0x24')]=function(_0x2f829c){var _0x2c723d=this;return new Promise(function(_0x58ffa3,_0x11a51a){return db[_0x5fd7('0x1c')]['find']({'raw':_0x2f829c[_0x5fd7('0x1d')]?_0x2f829c[_0x5fd7('0x1d')][_0x5fd7('0x1e')]===undefined?!![]:![]:!![],'where':_0x2f829c['options']?_0x2f829c[_0x5fd7('0x1d')][_0x5fd7('0x1f')]||null:null,'attributes':_0x2f829c[_0x5fd7('0x1d')]?_0x2f829c[_0x5fd7('0x1d')][_0x5fd7('0x20')]||null:null,'include':_0x2f829c['options']?_0x2f829c['options'][_0x5fd7('0x21')]?_[_0x5fd7('0x22')](_0x2f829c[_0x5fd7('0x1d')]['include'],function(_0x4e93aa){return{'model':db[_0x4e93aa[_0x5fd7('0x23')]],'as':_0x4e93aa['as'],'attributes':_0x4e93aa['attributes'],'include':_0x4e93aa[_0x5fd7('0x21')]?_[_0x5fd7('0x22')](_0x4e93aa['include'],function(_0x351d43){return{'model':db[_0x351d43[_0x5fd7('0x23')]],'as':_0x351d43['as'],'attributes':_0x351d43[_0x5fd7('0x20')],'include':_0x351d43['include']?_[_0x5fd7('0x22')](_0x351d43[_0x5fd7('0x21')],function(_0x492b41){return{'model':db[_0x492b41[_0x5fd7('0x23')]],'as':_0x492b41['as'],'attributes':_0x492b41[_0x5fd7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5fd7('0x12')](function(_0x72538f){logger['info'](_0x5fd7('0x24'),_0x2f829c);logger[_0x5fd7('0x15')]('ShowVoiceQueue',_0x2f829c,JSON[_0x5fd7('0x25')](_0x72538f));_0x58ffa3(_0x72538f);})[_0x5fd7('0x1a')](function(_0x36f86a){logger[_0x5fd7('0x16')](_0x5fd7('0x24'),_0x36f86a[_0x5fd7('0x17')],_0x2f829c);_0x11a51a(_0x2c723d['error'](0x1f4,_0x36f86a[_0x5fd7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f3861d5..0ee8545 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 _0x6215=['./voiceQueue.events','save','remove','emit','length','voiceQueue:'];(function(_0x2d16c5,_0x15675c){var _0x29b9f0=function(_0x35408f){while(--_0x35408f){_0x2d16c5['push'](_0x2d16c5['shift']());}};_0x29b9f0(++_0x15675c);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueEvents=require(_0x5621('0x0'));var events=[_0x5621('0x1'),_0x5621('0x2'),'update'];function createListener(_0x944eb2,_0x2304a6){return function(_0x24464a){_0x2304a6[_0x5621('0x3')](_0x944eb2,_0x24464a);};}function removeListener(_0x204284,_0x13397a){return function(){VoiceQueueEvents['removeListener'](_0x204284,_0x13397a);};}exports['register']=function(_0x52f3c6){for(var _0x5ae3af=0x0,_0x431e77=events[_0x5621('0x4')];_0x5ae3af<_0x431e77;_0x5ae3af++){var _0x2b7275=events[_0x5ae3af];var _0x253c0b=createListener(_0x5621('0x5')+_0x2b7275,_0x52f3c6);VoiceQueueEvents['on'](_0x2b7275,_0x253c0b);}}; \ No newline at end of file +var _0x3440=['./voiceQueue.events','save','update','emit','removeListener','register','length'];(function(_0x10bb2a,_0x56b6b3){var _0x1b3d33=function(_0x1fdb5f){while(--_0x1fdb5f){_0x10bb2a['push'](_0x10bb2a['shift']());}};_0x1b3d33(++_0x56b6b3);}(_0x3440,0x9a));var _0x0344=function(_0x221e70,_0x3b8f57){_0x221e70=_0x221e70-0x0;var _0x42ebb8=_0x3440[_0x221e70];return _0x42ebb8;};'use strict';var VoiceQueueEvents=require(_0x0344('0x0'));var events=[_0x0344('0x1'),'remove',_0x0344('0x2')];function createListener(_0x50db8f,_0x4cc8c9){return function(_0x2cd023){_0x4cc8c9[_0x0344('0x3')](_0x50db8f,_0x2cd023);};}function removeListener(_0x1499e3,_0x1787a1){return function(){VoiceQueueEvents[_0x0344('0x4')](_0x1499e3,_0x1787a1);};}exports[_0x0344('0x5')]=function(_0x6cb14c){for(var _0x2f8343=0x0,_0x513bf8=events[_0x0344('0x6')];_0x2f8343<_0x513bf8;_0x2f8343++){var _0x19f9fd=events[_0x2f8343];var _0x171d9d=createListener('voiceQueue:'+_0x19f9fd,_0x6cb14c);VoiceQueueEvents['on'](_0x19f9fd,_0x171d9d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index cf8641f..5d23f4c 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 _0xd101=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0xd101,0xc1));var _0x1d10=function(_0x5227ae,_0x3e11cc){_0x5227ae=_0x5227ae-0x0;var _0x32e03e=_0xd101[_0x5227ae];return _0x32e03e;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var auth=require(_0x1d10('0x5'));var interaction=require(_0x1d10('0x6'));var config=require(_0x1d10('0x7'));var controller=require(_0x1d10('0x8'));router['get']('/',auth[_0x1d10('0x9')](),controller[_0x1d10('0xa')]);router[_0x1d10('0xb')](_0x1d10('0xc'),auth[_0x1d10('0x9')](),controller[_0x1d10('0xd')]);router[_0x1d10('0xb')](_0x1d10('0xe'),auth[_0x1d10('0x9')](),controller[_0x1d10('0xf')]);router[_0x1d10('0xb')](_0x1d10('0x10'),auth[_0x1d10('0x9')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')]('/',auth[_0x1d10('0x9')](),controller[_0x1d10('0x13')]);router['put'](_0x1d10('0x10'),auth[_0x1d10('0x9')](),controller[_0x1d10('0x14')]);router[_0x1d10('0x15')](_0x1d10('0x10'),auth['isAuthenticated'](),controller[_0x1d10('0x16')]);module[_0x1d10('0x17')]=router; \ No newline at end of file +var _0xef17=['index','/describe','/index','getVoiceQueuesReport','/:id','isAuthenticated','show','post','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2c48e1,_0xa89096){var _0x440f67=function(_0x5045b1){while(--_0x5045b1){_0x2c48e1['push'](_0x2c48e1['shift']());}};_0x440f67(++_0xa89096);}(_0xef17,0x136));var _0x7ef1=function(_0x5810e4,_0x47e784){_0x5810e4=_0x5810e4-0x0;var _0x57a636=_0xef17[_0x5810e4];return _0x57a636;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var auth=require(_0x7ef1('0x6'));var interaction=require(_0x7ef1('0x7'));var config=require(_0x7ef1('0x8'));var controller=require('./voiceQueueReport.controller');router[_0x7ef1('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ef1('0xa')]);router['get'](_0x7ef1('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7ef1('0x9')](_0x7ef1('0xc'),auth['isAuthenticated'](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0x9')](_0x7ef1('0xe'),auth[_0x7ef1('0xf')](),controller[_0x7ef1('0x10')]);router[_0x7ef1('0x11')]('/',auth[_0x7ef1('0xf')](),controller['create']);router['put'](_0x7ef1('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7ef1('0xe'),auth['isAuthenticated'](),controller[_0x7ef1('0x12')]);module[_0x7ef1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 9ec303d..be87147 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 _0xf65d=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0xfa63c4,_0x146b06){var _0x5bd378=function(_0x36bf9b){while(--_0x36bf9b){_0xfa63c4['push'](_0xfa63c4['shift']());}};_0x5bd378(++_0x146b06);}(_0xf65d,0x13a));var _0xdf65=function(_0x24f04d,_0x198dc7){_0x24f04d=_0x24f04d-0x0;var _0x2930f0=_0xf65d[_0x24f04d];return _0x2930f0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xdf65('0x0')]},'uniqueid':{'type':Sequelize[_0xdf65('0x0')]},'calleridnum':{'type':Sequelize[_0xdf65('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xdf65('0x0')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xdf65('0x1')],'set':function(_0x4fc8da){var _0xe502d1=moment(_0x4fc8da);var _0x14446d=moment(this[_0xdf65('0x2')](_0xdf65('0x3')))[_0xdf65('0x4')](_0xdf65('0x5'));var _0x915d4=_0xe502d1['diff'](_0x14446d,'seconds');this[_0xdf65('0x6')](_0xdf65('0x7'),_0x4fc8da);this[_0xdf65('0x6')](_0xdf65('0x8'),_0x915d4||null);}},'position':{'type':Sequelize[_0xdf65('0x9')]},'count':{'type':Sequelize[_0xdf65('0x9')]},'queuecallerabandon':{'type':Sequelize[_0xdf65('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xdf65('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xdf65('0x1')]},'queuecallerexit':{'type':Sequelize[_0xdf65('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xdf65('0x0')],'comment':_0xdf65('0xb')},'originalposition':{'type':Sequelize[_0xdf65('0x9')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xdf65('0x0')]},'connectedlinename':{'type':Sequelize[_0xdf65('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xdf65('0x0')]},'exten':{'type':Sequelize[_0xdf65('0x0')]},'priority':{'type':Sequelize[_0xdf65('0x0')]},'holdtime':{'type':Sequelize[_0xdf65('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdf65('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xdf65('0x0')]},'transfer':{'type':Sequelize[_0xdf65('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xdf65('0x0')],'comment':_0xdf65('0xc')},'transferexten':{'type':Sequelize[_0xdf65('0x0')]},'transferuniqueid':{'type':Sequelize[_0xdf65('0x0')]},'disposition':{'type':Sequelize[_0xdf65('0x0')]},'queuecallerenterreason':{'type':Sequelize[_0xdf65('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x96f5=['format','YYYY-MM-DD\x20HH:mm:ss','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0x10092e,_0x36be0b){var _0x3133e2=function(_0x8c182e){while(--_0x8c182e){_0x10092e['push'](_0x10092e['shift']());}};_0x3133e2(++_0x36be0b);}(_0x96f5,0x133));var _0x596f=function(_0x5e39dd,_0x1c914d){_0x5e39dd=_0x5e39dd-0x0;var _0x3ae379=_0x96f5[_0x5e39dd];return _0x3ae379;};'use strict';var Sequelize=require(_0x596f('0x0'));var moment=require(_0x596f('0x1'));module[_0x596f('0x2')]={'type':{'type':Sequelize[_0x596f('0x3')]},'uniqueid':{'type':Sequelize[_0x596f('0x3')]},'calleridnum':{'type':Sequelize[_0x596f('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x596f('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x596f('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x11a7bb){var _0x28d853=moment(_0x11a7bb);var _0x50f446=moment(this['getDataValue']('queuecallerjoinAt'))[_0x596f('0x5')](_0x596f('0x6'));var _0x392f78=_0x28d853['diff'](_0x50f446,'seconds');this['setDataValue'](_0x596f('0x7'),_0x11a7bb);this['setDataValue'](_0x596f('0x8'),_0x392f78||null);}},'position':{'type':Sequelize[_0x596f('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x596f('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x596f('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x596f('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x596f('0x4')]},'queuecallerexit':{'type':Sequelize[_0x596f('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x596f('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x596f('0x3')]},'connectedlinenum':{'type':Sequelize[_0x596f('0x3')]},'connectedlinename':{'type':Sequelize[_0x596f('0x3')]},'accountcode':{'type':Sequelize[_0x596f('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x596f('0x3')]},'priority':{'type':Sequelize[_0x596f('0x3')]},'holdtime':{'type':Sequelize[_0x596f('0x9')]},'mohtime':{'type':Sequelize[_0x596f('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x596f('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x596f('0x3')]},'transfer':{'type':Sequelize[_0x596f('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x596f('0x3')],'comment':_0x596f('0xb')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x596f('0x3')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x596f('0x9')],'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 d5f046a..7762adc 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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x25c25b,_0x35b945){_0x25c25b=_0x25c25b-0x0;var _0x2ce5f0=_0x7a54[_0x25c25b];return _0x2ce5f0;};'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 _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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0xfe553a,_0x2e3727){_0xfe553a=_0xfe553a-0x0;var _0xea3440=_0x7a54[_0xfe553a];return _0xea3440;};'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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 4769ac7..78f591c 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 _0xf4d7=['../../mysqldb','VoiceQueueReport','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x112d38,_0x1ca311){var _0x5cf717=function(_0x5a625c){while(--_0x5a625c){_0x112d38['push'](_0x112d38['shift']());}};_0x5cf717(++_0x1ca311);}(_0xf4d7,0xd7));var _0x7f4d=function(_0x20bf83,_0x269f57){_0x20bf83=_0x20bf83-0x0;var _0x23cbc7=_0xf4d7[_0x20bf83];return _0x23cbc7;};'use strict';var EventEmitter=require(_0x7f4d('0x0'));var VoiceQueueReport=require(_0x7f4d('0x1'))['db'][_0x7f4d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7f4d('0x3'),'afterUpdate':_0x7f4d('0x4'),'afterDestroy':_0x7f4d('0x5')};function emitEvent(_0xfa1133){return function(_0x34f6f6,_0x1047c1,_0x5384ec){VoiceQueueReportEvents[_0x7f4d('0x6')](_0xfa1133+':'+_0x34f6f6['id'],_0x34f6f6);VoiceQueueReportEvents['emit'](_0xfa1133,_0x34f6f6);_0x5384ec(null);};}for(var e in events){if(events[_0x7f4d('0x7')](e)){var event=events[e];VoiceQueueReport[_0x7f4d('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x5142=['VoiceQueueReport','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x108c04,_0x52fac3){var _0x4bdd87=function(_0x382186){while(--_0x382186){_0x108c04['push'](_0x108c04['shift']());}};_0x4bdd87(++_0x52fac3);}(_0x5142,0xbb));var _0x2514=function(_0xff3d27,_0x2323a0){_0xff3d27=_0xff3d27-0x0;var _0x3f8710=_0x5142[_0xff3d27];return _0x3f8710;};'use strict';var EventEmitter=require(_0x2514('0x0'));var VoiceQueueReport=require(_0x2514('0x1'))['db'][_0x2514('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2514('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2514('0x4')};function emitEvent(_0x1a3874){return function(_0x3a6065,_0x4eaa1e,_0x525710){VoiceQueueReportEvents['emit'](_0x1a3874+':'+_0x3a6065['id'],_0x3a6065);VoiceQueueReportEvents[_0x2514('0x5')](_0x1a3874,_0x3a6065);_0x525710(null);};}for(var e in events){if(events[_0x2514('0x6')](e)){var event=events[e];VoiceQueueReport[_0x2514('0x7')](e,emitEvent(event));}}module[_0x2514('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9aa832a..5d8ae45 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 _0xc42a=['moment','bluebird','request-promise','rimraf','../../config/environment','VoiceQueueReport','report_queue','uniqueid','lodash','api'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc42a,0x17a));var _0xac42=function(_0x1b9ee6,_0x5db9f4){_0x1b9ee6=_0x1b9ee6-0x0;var _0x38a508=_0xc42a[_0x1b9ee6];return _0x38a508;};'use strict';var _=require(_0xac42('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xac42('0x1'));var moment=require(_0xac42('0x2'));var BPromise=require(_0xac42('0x3'));var rp=require(_0xac42('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac42('0x5'));var config=require(_0xac42('0x6'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x8f713,_0x5b2f1e){return _0x8f713['define'](_0xac42('0x7'),attributes,{'tableName':_0xac42('0x8'),'paranoid':![],'indexes':[{'fields':[_0xac42('0x9')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa69e=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash'];(function(_0x523ccb,_0x2a9266){var _0x120c09=function(_0x4d9f20){while(--_0x4d9f20){_0x523ccb['push'](_0x523ccb['shift']());}};_0x120c09(++_0x2a9266);}(_0xa69e,0x176));var _0xea69=function(_0x1d23c6,_0x22d45b){_0x1d23c6=_0x1d23c6-0x0;var _0x2e25ac=_0xa69e[_0x1d23c6];return _0x2e25ac;};'use strict';var _=require(_0xea69('0x0'));var util=require(_0xea69('0x1'));var logger=require('../../config/logger')(_0xea69('0x2'));var moment=require(_0xea69('0x3'));var BPromise=require(_0xea69('0x4'));var rp=require(_0xea69('0x5'));var fs=require('fs');var path=require(_0xea69('0x6'));var rimraf=require(_0xea69('0x7'));var config=require(_0xea69('0x8'));var attributes=require(_0xea69('0x9'));module[_0xea69('0xa')]=function(_0x14d22f,_0x158ca7){return _0x14d22f[_0xea69('0xb')]('VoiceQueueReport',attributes,{'tableName':_0xea69('0xc'),'paranoid':![],'indexes':[{'fields':[_0xea69('0xd')]},{'fields':[_0xea69('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 5b96a5f..5d83356 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 _0xec60=['request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x5ea819,_0x25ca6c){var _0x2cac78=function(_0x503a5d){while(--_0x503a5d){_0x5ea819['push'](_0x5ea819['shift']());}};_0x2cac78(++_0x25ca6c);}(_0xec60,0x11f));var _0x0ec6=function(_0x16743c,_0x4ed346){_0x16743c=_0x16743c-0x0;var _0x32ddba=_0xec60[_0x16743c];return _0x32ddba;};'use strict';var _=require(_0x0ec6('0x0'));var util=require(_0x0ec6('0x1'));var moment=require(_0x0ec6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ec6('0x3'));var fs=require('fs');var Redis=require(_0x0ec6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ec6('0x5'));var logger=require(_0x0ec6('0x6'))(_0x0ec6('0x7'));var config=require(_0x0ec6('0x8'));var jayson=require(_0x0ec6('0x9'));var client=jayson[_0x0ec6('0xa')][_0x0ec6('0xb')]({'port':0x232a});config[_0x0ec6('0xc')]=_[_0x0ec6('0xd')](config['redis'],{'host':_0x0ec6('0xe'),'port':0x18eb});var socket=require(_0x0ec6('0xf'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x0ec6('0x10')](socket);function respondWithRpcPromise(_0x2d52bd,_0x22590b,_0x35a166){return new BPromise(function(_0x57597f,_0x5834db){return client['request'](_0x2d52bd,_0x35a166)['then'](function(_0x151016){logger[_0x0ec6('0x11')](_0x0ec6('0x12'),_0x22590b,'request\x20sent');logger[_0x0ec6('0x13')](_0x0ec6('0x14'),_0x22590b,_0x0ec6('0x15'),JSON[_0x0ec6('0x16')](_0x151016));if(_0x151016[_0x0ec6('0x17')]){if(_0x151016[_0x0ec6('0x17')][_0x0ec6('0x18')]===0x1f4){logger[_0x0ec6('0x17')](_0x0ec6('0x12'),_0x22590b,_0x151016[_0x0ec6('0x17')][_0x0ec6('0x19')]);return _0x5834db(_0x151016[_0x0ec6('0x17')]['message']);}logger[_0x0ec6('0x17')](_0x0ec6('0x12'),_0x22590b,_0x151016['error'][_0x0ec6('0x19')]);return _0x57597f(_0x151016[_0x0ec6('0x17')][_0x0ec6('0x19')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x22590b,_0x0ec6('0x15'));_0x57597f(_0x151016[_0x0ec6('0x1a')]['message']);}})[_0x0ec6('0x1b')](function(_0x172e67){logger[_0x0ec6('0x17')](_0x0ec6('0x12'),_0x22590b,_0x172e67);_0x5834db(_0x172e67);});});}exports[_0x0ec6('0x1c')]=function(_0x525441){var _0x5beefb=this;return new Promise(function(_0x5bd844,_0x35adb2){return db[_0x0ec6('0x1d')][_0x0ec6('0x1e')]({'raw':_0x525441['options']?_0x525441[_0x0ec6('0x1f')][_0x0ec6('0x20')]===undefined?!![]:![]:!![],'where':_0x525441[_0x0ec6('0x1f')]?_0x525441[_0x0ec6('0x1f')][_0x0ec6('0x21')]||null:null,'attributes':_0x525441[_0x0ec6('0x1f')]?_0x525441['options'][_0x0ec6('0x22')]||null:null,'limit':_0x525441[_0x0ec6('0x1f')]?_0x525441[_0x0ec6('0x1f')][_0x0ec6('0x23')]||null:null,'include':_0x525441['options']?_0x525441[_0x0ec6('0x1f')][_0x0ec6('0x24')]?_[_0x0ec6('0x25')](_0x525441['options']['include'],function(_0x582477){return{'model':db[_0x582477[_0x0ec6('0x26')]],'as':_0x582477['as'],'attributes':_0x582477['attributes'],'include':_0x582477[_0x0ec6('0x24')]?_[_0x0ec6('0x25')](_0x582477[_0x0ec6('0x24')],function(_0x50de99){return{'model':db[_0x50de99[_0x0ec6('0x26')]],'as':_0x50de99['as'],'attributes':_0x50de99[_0x0ec6('0x22')],'include':_0x50de99['include']?_[_0x0ec6('0x25')](_0x50de99[_0x0ec6('0x24')],function(_0x4829c3){return{'model':db[_0x4829c3[_0x0ec6('0x26')]],'as':_0x4829c3['as'],'attributes':_0x4829c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ec6('0x27')](function(_0x218489){logger[_0x0ec6('0x11')](_0x0ec6('0x1c'),_0x525441);logger['debug'](_0x0ec6('0x1c'),_0x525441,JSON[_0x0ec6('0x16')](_0x218489));_0x5bd844(_0x218489);})[_0x0ec6('0x1b')](function(_0x451047){logger[_0x0ec6('0x17')](_0x0ec6('0x1c'),_0x451047['message'],_0x525441);_0x35adb2(_0x5beefb[_0x0ec6('0x17')](0x1f4,_0x451047[_0x0ec6('0x19')]));});});};exports[_0x0ec6('0x28')]=function(_0x5287e8){var _0xe10da3=this;return new Promise(function(_0xf4af73,_0x277284){return db[_0x0ec6('0x1d')][_0x0ec6('0x29')](_0x5287e8[_0x0ec6('0x2a')],{'raw':_0x5287e8[_0x0ec6('0x1f')]?_0x5287e8['options'][_0x0ec6('0x20')]===undefined?!![]:![]:!![]})[_0x0ec6('0x27')](function(_0x6aefdb){logger[_0x0ec6('0x11')](_0x0ec6('0x28'),_0x5287e8);logger[_0x0ec6('0x13')](_0x0ec6('0x28'),_0x5287e8,JSON[_0x0ec6('0x16')](_0x6aefdb));_0xf4af73(_0x6aefdb);})[_0x0ec6('0x1b')](function(_0x2beda8){logger['error']('CreateVoiceQueueReport',_0x2beda8['message'],_0x5287e8);_0x277284(_0xe10da3[_0x0ec6('0x17')](0x1f4,_0x2beda8[_0x0ec6('0x19')]));});});};exports[_0x0ec6('0x2b')]=function(_0x4bb510){var _0x36f653=this;return new Promise(function(_0x480609,_0x4e91ed){return db['VoiceQueueReport']['update'](_0x4bb510['body'],{'raw':_0x4bb510[_0x0ec6('0x1f')]?_0x4bb510[_0x0ec6('0x1f')][_0x0ec6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb510[_0x0ec6('0x1f')]?_0x4bb510['options'][_0x0ec6('0x21')]||null:null,'attributes':_0x4bb510[_0x0ec6('0x1f')]?_0x4bb510[_0x0ec6('0x1f')][_0x0ec6('0x22')]||null:null,'limit':_0x4bb510[_0x0ec6('0x1f')]?_0x4bb510[_0x0ec6('0x1f')][_0x0ec6('0x23')]||null:null})[_0x0ec6('0x27')](function(_0x31fcc2){logger['info'](_0x0ec6('0x2b'),_0x4bb510);logger[_0x0ec6('0x13')](_0x0ec6('0x2b'),_0x4bb510,JSON['stringify'](_0x31fcc2));_0x480609(_0x31fcc2);})[_0x0ec6('0x1b')](function(_0x66288e){logger[_0x0ec6('0x17')](_0x0ec6('0x2b'),_0x66288e[_0x0ec6('0x19')],_0x4bb510);_0x4e91ed(_0x36f653['error'](0x1f4,_0x66288e[_0x0ec6('0x19')]));});});}; \ No newline at end of file +var _0xc22c=['model','then','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','map'];(function(_0x54bb33,_0x15fb65){var _0x5ac2a9=function(_0x3e2b4f){while(--_0x3e2b4f){_0x54bb33['push'](_0x54bb33['shift']());}};_0x5ac2a9(++_0x15fb65);}(_0xc22c,0x7f));var _0xcc22=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0xc22c[_0x589f71];return _0x5763bd;};'use strict';var _=require(_0xcc22('0x0'));var util=require(_0xcc22('0x1'));var moment=require('moment');var BPromise=require(_0xcc22('0x2'));var rs=require(_0xcc22('0x3'));var fs=require('fs');var Redis=require(_0xcc22('0x4'));var db=require(_0xcc22('0x5'))['db'];var utils=require(_0xcc22('0x6'));var logger=require(_0xcc22('0x7'))('rpc');var config=require(_0xcc22('0x8'));var jayson=require(_0xcc22('0x9'));var client=jayson[_0xcc22('0xa')]['http']({'port':0x232a});config[_0xcc22('0xb')]=_[_0xcc22('0xc')](config[_0xcc22('0xb')],{'host':_0xcc22('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc22('0xb')]));require('./voiceQueueReport.socket')[_0xcc22('0xe')](socket);function respondWithRpcPromise(_0x1b1831,_0x7f71a7,_0x290c9d){return new BPromise(function(_0x518223,_0x50689c){return client['request'](_0x1b1831,_0x290c9d)['then'](function(_0x1ae685){logger[_0xcc22('0xf')](_0xcc22('0x10'),_0x7f71a7,'request\x20sent');logger[_0xcc22('0x11')](_0xcc22('0x12'),_0x7f71a7,'request\x20sent',JSON['stringify'](_0x1ae685));if(_0x1ae685[_0xcc22('0x13')]){if(_0x1ae685[_0xcc22('0x13')]['code']===0x1f4){logger[_0xcc22('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x7f71a7,_0x1ae685[_0xcc22('0x13')]['message']);return _0x50689c(_0x1ae685['error'][_0xcc22('0x14')]);}logger[_0xcc22('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x7f71a7,_0x1ae685['error'][_0xcc22('0x14')]);return _0x518223(_0x1ae685[_0xcc22('0x13')][_0xcc22('0x14')]);}else{logger[_0xcc22('0xf')](_0xcc22('0x10'),_0x7f71a7,_0xcc22('0x15'));_0x518223(_0x1ae685[_0xcc22('0x16')][_0xcc22('0x14')]);}})[_0xcc22('0x17')](function(_0x4c1a01){logger[_0xcc22('0x13')](_0xcc22('0x10'),_0x7f71a7,_0x4c1a01);_0x50689c(_0x4c1a01);});});}exports[_0xcc22('0x18')]=function(_0x1fed32){var _0x2074bb=this;return new Promise(function(_0x53fbe9,_0x5e0861){return db[_0xcc22('0x19')]['findAll']({'raw':_0x1fed32['options']?_0x1fed32[_0xcc22('0x1a')][_0xcc22('0x1b')]===undefined?!![]:![]:!![],'where':_0x1fed32[_0xcc22('0x1a')]?_0x1fed32[_0xcc22('0x1a')][_0xcc22('0x1c')]||null:null,'attributes':_0x1fed32['options']?_0x1fed32[_0xcc22('0x1a')][_0xcc22('0x1d')]||null:null,'limit':_0x1fed32[_0xcc22('0x1a')]?_0x1fed32[_0xcc22('0x1a')][_0xcc22('0x1e')]||null:null,'include':_0x1fed32[_0xcc22('0x1a')]?_0x1fed32['options'][_0xcc22('0x1f')]?_[_0xcc22('0x20')](_0x1fed32[_0xcc22('0x1a')]['include'],function(_0x5cf877){return{'model':db[_0x5cf877[_0xcc22('0x21')]],'as':_0x5cf877['as'],'attributes':_0x5cf877['attributes'],'include':_0x5cf877[_0xcc22('0x1f')]?_['map'](_0x5cf877[_0xcc22('0x1f')],function(_0x5edc72){return{'model':db[_0x5edc72[_0xcc22('0x21')]],'as':_0x5edc72['as'],'attributes':_0x5edc72[_0xcc22('0x1d')],'include':_0x5edc72[_0xcc22('0x1f')]?_[_0xcc22('0x20')](_0x5edc72[_0xcc22('0x1f')],function(_0xb4309e){return{'model':db[_0xb4309e[_0xcc22('0x21')]],'as':_0xb4309e['as'],'attributes':_0xb4309e['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc22('0x22')](function(_0x230c2c){logger[_0xcc22('0xf')]('GetVoiceQueueReport',_0x1fed32);logger['debug'](_0xcc22('0x18'),_0x1fed32,JSON['stringify'](_0x230c2c));_0x53fbe9(_0x230c2c);})['catch'](function(_0x57f8b0){logger[_0xcc22('0x13')](_0xcc22('0x18'),_0x57f8b0[_0xcc22('0x14')],_0x1fed32);_0x5e0861(_0x2074bb['error'](0x1f4,_0x57f8b0[_0xcc22('0x14')]));});});};exports[_0xcc22('0x23')]=function(_0x2dcb88){var _0x4036c5=this;return new Promise(function(_0x3bde1d,_0x4c6a2d){return db[_0xcc22('0x19')]['create'](_0x2dcb88['body'],{'raw':_0x2dcb88[_0xcc22('0x1a')]?_0x2dcb88['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3f45b3){logger[_0xcc22('0xf')](_0xcc22('0x23'),_0x2dcb88);logger['debug'](_0xcc22('0x23'),_0x2dcb88,JSON['stringify'](_0x3f45b3));_0x3bde1d(_0x3f45b3);})[_0xcc22('0x17')](function(_0x53ccd9){logger['error']('CreateVoiceQueueReport',_0x53ccd9['message'],_0x2dcb88);_0x4c6a2d(_0x4036c5['error'](0x1f4,_0x53ccd9['message']));});});};exports[_0xcc22('0x24')]=function(_0x8a346f){var _0x40dc09=this;return new Promise(function(_0x443fcf,_0x251af4){return db[_0xcc22('0x19')][_0xcc22('0x25')](_0x8a346f[_0xcc22('0x26')],{'raw':_0x8a346f[_0xcc22('0x1a')]?_0x8a346f['options'][_0xcc22('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a346f[_0xcc22('0x1a')]?_0x8a346f['options']['where']||null:null,'attributes':_0x8a346f[_0xcc22('0x1a')]?_0x8a346f[_0xcc22('0x1a')][_0xcc22('0x1d')]||null:null,'limit':_0x8a346f[_0xcc22('0x1a')]?_0x8a346f[_0xcc22('0x1a')][_0xcc22('0x1e')]||null:null})['then'](function(_0x38744e){logger[_0xcc22('0xf')](_0xcc22('0x24'),_0x8a346f);logger[_0xcc22('0x11')](_0xcc22('0x24'),_0x8a346f,JSON[_0xcc22('0x27')](_0x38744e));_0x443fcf(_0x38744e);})[_0xcc22('0x17')](function(_0x5f3a5c){logger[_0xcc22('0x13')](_0xcc22('0x24'),_0x5f3a5c[_0xcc22('0x14')],_0x8a346f);_0x251af4(_0x40dc09[_0xcc22('0x13')](0x1f4,_0x5f3a5c[_0xcc22('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index fef6e8a..fa0184c 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 _0xe054=['length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','register'];(function(_0x5d8b92,_0x1cbd6f){var _0x1e9863=function(_0x49465e){while(--_0x49465e){_0x5d8b92['push'](_0x5d8b92['shift']());}};_0x1e9863(++_0x1cbd6f);}(_0xe054,0xd4));var _0x4e05=function(_0x509239,_0x4fab00){_0x509239=_0x509239-0x0;var _0x39eae0=_0xe054[_0x509239];return _0x39eae0;};'use strict';var VoiceQueueReportEvents=require(_0x4e05('0x0'));var events=['save',_0x4e05('0x1'),_0x4e05('0x2')];function createListener(_0x5e677c,_0x5da77e){return function(_0x11d32d){_0x5da77e[_0x4e05('0x3')](_0x5e677c,_0x11d32d);};}function removeListener(_0x21fa0c,_0x199471){return function(){VoiceQueueReportEvents['removeListener'](_0x21fa0c,_0x199471);};}exports[_0x4e05('0x4')]=function(_0x470380){for(var _0x94d5c3=0x0,_0x14318d=events[_0x4e05('0x5')];_0x94d5c3<_0x14318d;_0x94d5c3++){var _0x215f81=events[_0x94d5c3];var _0x5c2fd0=createListener(_0x4e05('0x6')+_0x215f81,_0x470380);VoiceQueueReportEvents['on'](_0x215f81,_0x5c2fd0);}}; \ No newline at end of file +var _0xc4f6=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','emit','register'];(function(_0x47f8ba,_0x53ed87){var _0x4eb6cf=function(_0x4a88da){while(--_0x4a88da){_0x47f8ba['push'](_0x47f8ba['shift']());}};_0x4eb6cf(++_0x53ed87);}(_0xc4f6,0x64));var _0x6c4f=function(_0x1ff923,_0x3fba56){_0x1ff923=_0x1ff923-0x0;var _0x211ab9=_0xc4f6[_0x1ff923];return _0x211ab9;};'use strict';var VoiceQueueReportEvents=require(_0x6c4f('0x0'));var events=[_0x6c4f('0x1'),'remove',_0x6c4f('0x2')];function createListener(_0x46612a,_0x2bc29a){return function(_0x4192e4){_0x2bc29a[_0x6c4f('0x3')](_0x46612a,_0x4192e4);};}function removeListener(_0x1f342e,_0x4df593){return function(){VoiceQueueReportEvents['removeListener'](_0x1f342e,_0x4df593);};}exports[_0x6c4f('0x4')]=function(_0x36b51b){for(var _0x34fbd8=0x0,_0x36882d=events[_0x6c4f('0x5')];_0x34fbd8<_0x36882d;_0x34fbd8++){var _0x163215=events[_0x34fbd8];var _0x14f99c=createListener(_0x6c4f('0x6')+_0x163215,_0x36b51b);VoiceQueueReportEvents['on'](_0x163215,_0x14f99c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 6a77773..9cd5d8d 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 _0x8135=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0x8135,0xdb));var _0x5813=function(_0xe3ec36,_0x509f67){_0xe3ec36=_0xe3ec36-0x0;var _0x53115c=_0x8135[_0xe3ec36];return _0x53115c;};'use strict';var multer=require(_0x5813('0x0'));var util=require('util');var path=require(_0x5813('0x1'));var timeout=require(_0x5813('0x2'));var express=require(_0x5813('0x3'));var router=express[_0x5813('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5813('0x5'));var config=require(_0x5813('0x6'));var controller=require(_0x5813('0x7'));router[_0x5813('0x8')]('/',auth[_0x5813('0x9')](),controller['index']);router[_0x5813('0x8')](_0x5813('0xa'),auth[_0x5813('0x9')](),controller[_0x5813('0xb')]);router['post']('/',auth[_0x5813('0x9')](),controller['create']);router['put'](_0x5813('0xa'),auth[_0x5813('0x9')](),controller[_0x5813('0xc')]);router[_0x5813('0xd')](_0x5813('0xa'),auth[_0x5813('0x9')](),controller[_0x5813('0xe')]);module[_0x5813('0xf')]=router; \ No newline at end of file +var _0x3912=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xb02e98,_0x1291e3){var _0x1de2cf=function(_0xe3d2e0){while(--_0xe3d2e0){_0xb02e98['push'](_0xb02e98['shift']());}};_0x1de2cf(++_0x1291e3);}(_0x3912,0xdc));var _0x2391=function(_0x2dad13,_0xc198f2){_0x2dad13=_0x2dad13-0x0;var _0x3b3417=_0x3912[_0x2dad13];return _0x3b3417;};'use strict';var multer=require(_0x2391('0x0'));var util=require('util');var path=require(_0x2391('0x1'));var timeout=require(_0x2391('0x2'));var express=require(_0x2391('0x3'));var router=express[_0x2391('0x4')]();var auth=require(_0x2391('0x5'));var interaction=require(_0x2391('0x6'));var config=require(_0x2391('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x2391('0x8')]('/',auth[_0x2391('0x9')](),controller[_0x2391('0xa')]);router[_0x2391('0x8')](_0x2391('0xb'),auth['isAuthenticated'](),controller[_0x2391('0xc')]);router[_0x2391('0xd')]('/',auth[_0x2391('0x9')](),controller[_0x2391('0xe')]);router[_0x2391('0xf')](_0x2391('0xb'),auth[_0x2391('0x9')](),controller[_0x2391('0x10')]);router[_0x2391('0x11')](_0x2391('0xb'),auth[_0x2391('0x9')](),controller[_0x2391('0x12')]);module[_0x2391('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 55f86db..cb92f3a 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 _0xb1ef=['YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING','format'];(function(_0x45578f,_0x11c97e){var _0x4461bc=function(_0x2e67ad){while(--_0x2e67ad){_0x45578f['push'](_0x45578f['shift']());}};_0x4461bc(++_0x11c97e);}(_0xb1ef,0x146));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xfb1e('0x0'));var moment=require('moment');module[_0xfb1e('0x1')]={'time':{'type':Sequelize[_0xfb1e('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfb1e('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfb1e('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfb1e('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfb1e('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfb1e('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xfb1e('0x3')](_0xfb1e('0x4'))}}; \ No newline at end of file +var _0xc2b0=['sequelize','moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x164974,_0x32e0f8){var _0xd609c8=function(_0x4422a7){while(--_0x4422a7){_0x164974['push'](_0x164974['shift']());}};_0xd609c8(++_0x32e0f8);}(_0xc2b0,0x66));var _0x0c2b=function(_0xce1a87,_0x372c44){_0xce1a87=_0xce1a87-0x0;var _0x26669d=_0xc2b0[_0xce1a87];return _0x26669d;};'use strict';var Sequelize=require(_0x0c2b('0x0'));var moment=require(_0x0c2b('0x1'));module[_0x0c2b('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x0c2b('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0c2b('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0c2b('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0c2b('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0c2b('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0c2b('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x0c2b('0x4')](_0x0c2b('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4cfabb1..f5c3b73 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 _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x3602d4,_0x127c1a){var _0x360b73=function(_0xc374b5){while(--_0xc374b5){_0x3602d4['push'](_0x3602d4['shift']());}};_0x360b73(++_0x127c1a);}(_0xb10b,0x12a));var _0xbb10=function(_0x554b96,_0xa7f28){_0x554b96=_0x554b96-0x0;var _0xe445a8=_0xb10b[_0x554b96];return _0xe445a8;};'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'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file +var _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x50c02d,_0x582cf8){var _0x3089ea=function(_0x495af9){while(--_0x495af9){_0x50c02d['push'](_0x50c02d['shift']());}};_0x3089ea(++_0x582cf8);}(_0xb10b,0x12a));var _0xbb10=function(_0x406b98,_0x3dea6d){_0x406b98=_0x406b98-0x0;var _0x10545f=_0xb10b[_0x406b98];return _0x10545f;};'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'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 94c2d0e..26ec651 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 _0x3f8a=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2e30ad,_0x3a4619){var _0x50bb7e=function(_0x19c68c){while(--_0x19c68c){_0x2e30ad['push'](_0x2e30ad['shift']());}};_0x50bb7e(++_0x3a4619);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x45db29,_0x31f6e6){_0x45db29=_0x45db29-0x0;var _0x5f4881=_0x3f8a[_0x45db29];return _0x5f4881;};'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('0xf'),_0xa3f8('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4fb4=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20d0b6,_0xc58c6){var _0x89a852=function(_0x155e62){while(--_0x155e62){_0x20d0b6['push'](_0x20d0b6['shift']());}};_0x89a852(++_0xc58c6);}(_0x4fb4,0x190));var _0x44fb=function(_0x31a9aa,_0x508000){_0x31a9aa=_0x31a9aa-0x0;var _0x976b22=_0x4fb4[_0x31a9aa];return _0x976b22;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var logger=require(_0x44fb('0x1'))(_0x44fb('0x2'));var moment=require(_0x44fb('0x3'));var BPromise=require(_0x44fb('0x4'));var rp=require(_0x44fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var attributes=require(_0x44fb('0x8'));module[_0x44fb('0x9')]=function(_0x375d33,_0x173e70){return _0x375d33[_0x44fb('0xa')](_0x44fb('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x44fb('0xc'),'fields':[_0x44fb('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 233e682..f1d2a22 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 _0xa699=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3c9b8b,_0x2861a9){var _0x5325ae=function(_0x206748){while(--_0x206748){_0x3c9b8b['push'](_0x3c9b8b['shift']());}};_0x5325ae(++_0x2861a9);}(_0xa699,0x6b));var _0x9a69=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0xa699[_0x1c9c24];return _0x349c69;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var moment=require(_0x9a69('0x2'));var BPromise=require(_0x9a69('0x3'));var rs=require(_0x9a69('0x4'));var fs=require('fs');var Redis=require(_0x9a69('0x5'));var db=require(_0x9a69('0x6'))['db'];var utils=require(_0x9a69('0x7'));var logger=require(_0x9a69('0x8'))(_0x9a69('0x9'));var config=require(_0x9a69('0xa'));var jayson=require(_0x9a69('0xb'));var client=jayson[_0x9a69('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b842,_0x3f9bce,_0x3bb021){return new BPromise(function(_0x4665a9,_0x5031b0){return client[_0x9a69('0xd')](_0x26b842,_0x3bb021)[_0x9a69('0xe')](function(_0x3fb953){logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,'request\x20sent');logger['debug'](_0x9a69('0x11'),_0x3f9bce,'request\x20sent',JSON[_0x9a69('0x12')](_0x3fb953));if(_0x3fb953[_0x9a69('0x13')]){if(_0x3fb953['error'][_0x9a69('0x14')]===0x1f4){logger[_0x9a69('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x5031b0(_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);}logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x4665a9(_0x3fb953[_0x9a69('0x13')]['message']);}else{logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,_0x9a69('0x16'));_0x4665a9(_0x3fb953['result'][_0x9a69('0x15')]);}})[_0x9a69('0x17')](function(_0x380e46){logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x380e46);_0x5031b0(_0x380e46);});});} \ No newline at end of file +var _0x34b7=['stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x5aeb9b,_0x25fa2a){var _0x166300=function(_0x4ef23c){while(--_0x4ef23c){_0x5aeb9b['push'](_0x5aeb9b['shift']());}};_0x166300(++_0x25fa2a);}(_0x34b7,0x196));var _0x734b=function(_0xbb146,_0x1b3260){_0xbb146=_0xbb146-0x0;var _0x5094d0=_0x34b7[_0xbb146];return _0x5094d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 9f5cd85..c544db5 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(_0x5da1f5,_0x5d5afe){var _0x51e6e6=function(_0x3005ce){while(--_0x3005ce){_0x5da1f5['push'](_0x5da1f5['shift']());}};_0x51e6e6(++_0x5d5afe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x131776,_0x8b1dc7){var _0x15a4e2=function(_0x428008){while(--_0x428008){_0x131776['push'](_0x131776['shift']());}};_0x15a4e2(++_0x8b1dc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 728ed3a..0fa19b7 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 _0xa71f=['TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xa71f,0x111));var _0xfa71=function(_0x451f29,_0x3fae69){_0x451f29=_0x451f29-0x0;var _0x3ff282=_0xa71f[_0x451f29];return _0x3ff282;};'use strict';var Sequelize=require(_0xfa71('0x0'));var moment=require(_0xfa71('0x1'));var path=require(_0xfa71('0x2'));module['exports']={'format':{'type':Sequelize[_0xfa71('0x3')],'get':function(){return this[_0xfa71('0x4')](_0xfa71('0x5'))?path[_0xfa71('0x6')](this[_0xfa71('0x4')](_0xfa71('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xfa71('0x7')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x3b16e3){if(_0x3b16e3){this[_0xfa71('0x8')](_0xfa71('0x9'),_0x3b16e3);this['setDataValue'](_0xfa71('0xa'),_0x3b16e3[_0xfa71('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xfa71('0x7')]},'calleridnum':{'type':Sequelize[_0xfa71('0x7')]},'calleridname':{'type':Sequelize[_0xfa71('0x7')]},'connectedlinenum':{'type':Sequelize[_0xfa71('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xfa71('0x7')]},'context':{'type':Sequelize[_0xfa71('0x7')]},'exten':{'type':Sequelize[_0xfa71('0x7')]},'value':{'type':Sequelize[_0xfa71('0x7')]},'type':{'type':Sequelize[_0xfa71('0x7')]},'rating':{'type':Sequelize[_0xfa71('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xfa71('0x7')]},'location':{'type':Sequelize[_0xfa71('0xd')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0xfa71('0x7')],'defaultValue':_0xfa71('0xe')},'fileUri':{'type':Sequelize[_0xfa71('0xd')]},'fileText':{'type':Sequelize[_0xfa71('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0xfa71('0x7')]},'sPositive':{'type':Sequelize[_0xfa71('0xf')]},'sNegative':{'type':Sequelize[_0xfa71('0xf')]},'sNeutral':{'type':Sequelize[_0xfa71('0xf')]},'sMixed':{'type':Sequelize[_0xfa71('0xf')]},'tempSentiment':{'type':Sequelize[_0xfa71('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xfa71('0x11')],'get':function(){return moment(this[_0xfa71('0x4')](_0xfa71('0x12')))[_0xfa71('0x13')](_0xfa71('0x14'))[_0xfa71('0x15')]();}},'updatedAt':{'type':Sequelize[_0xfa71('0x11')],'get':function(){return moment(this[_0xfa71('0x4')]('updatedAt'))[_0xfa71('0x13')](_0xfa71('0x14'))[_0xfa71('0x15')]();}}}; \ No newline at end of file +var _0xa05a=['channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue'];(function(_0x5e5c64,_0x19b9fb){var _0x1bf287=function(_0x19fb98){while(--_0x19fb98){_0x5e5c64['push'](_0x5e5c64['shift']());}};_0x1bf287(++_0x19b9fb);}(_0xa05a,0x91));var _0xaa05=function(_0x43191d,_0x39b148){_0x43191d=_0x43191d-0x0;var _0x5bde49=_0xa05a[_0x43191d];return _0x5bde49;};'use strict';var Sequelize=require(_0xaa05('0x0'));var moment=require(_0xaa05('0x1'));var path=require('path');module[_0xaa05('0x2')]={'format':{'type':Sequelize[_0xaa05('0x3')],'get':function(){return this[_0xaa05('0x4')](_0xaa05('0x5'))?path[_0xaa05('0x6')](this[_0xaa05('0x4')](_0xaa05('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xaa05('0x7')]},'channel':{'type':Sequelize[_0xaa05('0x7')],'set':function(_0x51cdad){if(_0x51cdad){this[_0xaa05('0x8')](_0xaa05('0x9'),_0x51cdad);this[_0xaa05('0x8')](_0xaa05('0xa'),_0x51cdad[_0xaa05('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xaa05('0x7')]},'calleridname':{'type':Sequelize[_0xaa05('0x7')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaa05('0x7')]},'context':{'type':Sequelize[_0xaa05('0x7')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xaa05('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xaa05('0x7')]},'userDisposition':{'type':Sequelize[_0xaa05('0x7')]},'location':{'type':Sequelize[_0xaa05('0xd')]},'transcribeName':{'type':Sequelize[_0xaa05('0x7')]},'transcribeStatus':{'type':Sequelize[_0xaa05('0x7')],'defaultValue':_0xaa05('0xe')},'fileUri':{'type':Sequelize[_0xaa05('0xd')]},'fileText':{'type':Sequelize[_0xaa05('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0xaa05('0x7')]},'sPositive':{'type':Sequelize[_0xaa05('0xf')]},'sNegative':{'type':Sequelize[_0xaa05('0xf')]},'sNeutral':{'type':Sequelize[_0xaa05('0xf')]},'sMixed':{'type':Sequelize[_0xaa05('0xf')]},'tempSentiment':{'type':Sequelize[_0xaa05('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xaa05('0x11')],'get':function(){return moment(this[_0xaa05('0x4')]('createdAt'))[_0xaa05('0x12')](_0xaa05('0x13'))[_0xaa05('0x14')]();}},'updatedAt':{'type':Sequelize[_0xaa05('0x11')],'get':function(){return moment(this[_0xaa05('0x4')](_0xaa05('0x15')))['format'](_0xaa05('0x13'))[_0xaa05('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index f72a81c..c760c48 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 _0x8076=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','VoiceRecording','fieldName','type','key','differenceBy','map','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','rows','catch','params','rawAttributes','include','options','find','create','body','describe','download','../../components/encryptor','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','send','Not\x20found','downloads','sequelize','MD5','col','token','uniqueid','$and','push','extname','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','info','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis'];(function(_0x131f2e,_0x495832){var _0x548acf=function(_0xe1c41c){while(--_0xe1c41c){_0x131f2e['push'](_0x131f2e['shift']());}};_0x548acf(++_0x495832);}(_0x8076,0x86));var _0x6807=function(_0x379397,_0x37fbf4){_0x379397=_0x379397-0x0;var _0x289867=_0x8076[_0x379397];return _0x289867;};'use strict';var pdf=require(_0x6807('0x0'));var emlformat=require(_0x6807('0x1'));var rimraf=require(_0x6807('0x2'));var zipdir=require(_0x6807('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6807('0x4'));var Mustache=require('mustache');var util=require(_0x6807('0x5'));var path=require('path');var sox=require(_0x6807('0x6'));var csv=require('to-csv');var ejs=require(_0x6807('0x7'));var fs=require('fs');var _=require(_0x6807('0x8'));var squel=require(_0x6807('0x9'));var crypto=require(_0x6807('0xa'));var jsforce=require(_0x6807('0xb'));var deskjs=require(_0x6807('0xc'));var toCsv=require(_0x6807('0xd'));var querystring=require(_0x6807('0xe'));var Papa=require(_0x6807('0xf'));var AWS=require(_0x6807('0x10'));var uuidv4=require(_0x6807('0x11'));var Redis=require(_0x6807('0x12'));var authService=require(_0x6807('0x13'));var qs=require(_0x6807('0x14'));var as=require(_0x6807('0x15'));var hardwareService=require(_0x6807('0x16'));var logger=require(_0x6807('0x17'))(_0x6807('0x18'));var utils=require(_0x6807('0x19'));var config=require('../../config/environment');var db=require(_0x6807('0x1a'))['db'];function respondWithStatusCode(_0x3f9275,_0x105c68){_0x105c68=_0x105c68||0xcc;return function(_0x3fd1be){if(_0x3fd1be){return _0x3f9275['sendStatus'](_0x105c68);}return _0x3f9275[_0x6807('0x1b')](_0x105c68)[_0x6807('0x1c')]();};}function respondWithResult(_0x5ce17c,_0x4305a3){_0x4305a3=_0x4305a3||0xc8;return function(_0x4c3609){if(_0x4c3609){return _0x5ce17c[_0x6807('0x1b')](_0x4305a3)[_0x6807('0x1d')](_0x4c3609);}};}function respondWithFilteredResult(_0xe5efdc,_0x2e23fb){return function(_0x5baedd){if(_0x5baedd){var _0x414b7a=_0x5baedd[_0x6807('0x1e')],_0x334ae4=_0x2e23fb[_0x6807('0x1f')],_0x3b32ca=_0x2e23fb[_0x6807('0x1f')]+_0x2e23fb[_0x6807('0x20')],_0x100d92;if(_0x3b32ca>=_0x414b7a){_0x3b32ca=_0x414b7a;_0x100d92=0xc8;}else{_0x100d92=0xce;}_0xe5efdc[_0x6807('0x1b')](_0x100d92);return _0xe5efdc[_0x6807('0x21')]('Content-Range',_0x334ae4+'-'+_0x3b32ca+'/'+_0x414b7a)[_0x6807('0x1d')](_0x5baedd);}return null;};}function patchUpdates(_0x2b74ae){return function(_0x4ee9ee){try{jsonpatch[_0x6807('0x22')](_0x4ee9ee,_0x2b74ae,!![]);}catch(_0x598769){return BPromise[_0x6807('0x23')](_0x598769);}return _0x4ee9ee[_0x6807('0x24')]();};}function saveUpdates(_0x468f01,_0x4f9573){return function(_0x455654){if(_0x455654){return _0x455654[_0x6807('0x25')](_0x468f01)[_0x6807('0x26')](function(_0x42faba){return _0x42faba;});}return null;};}function removeEntity(_0x3c4a60,_0x1f41f5){return function(_0x494baf){if(_0x494baf){return _0x494baf[_0x6807('0x27')]()['then'](function(){_0x3c4a60['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd366,_0xcb6d8){return function(_0x56ebd2){if(!_0x56ebd2){_0x1bd366[_0x6807('0x28')](0x194);}return _0x56ebd2;};}function handleError(_0x2683e4,_0x3ecb2d){_0x3ecb2d=_0x3ecb2d||0x1f4;return function(_0x321eca){logger[_0x6807('0x29')](_0x321eca[_0x6807('0x2a')]);if(_0x321eca[_0x6807('0x2b')]){delete _0x321eca[_0x6807('0x2b')];}_0x2683e4[_0x6807('0x1b')](_0x3ecb2d)['send'](_0x321eca);};}exports[_0x6807('0x2c')]=function(_0x2436cc,_0x48c795){var _0x46921e={},_0x4c7485={},_0x358c38={'count':0x0,'rows':[]};var _0x539a78=_['map'](db[_0x6807('0x2d')]['rawAttributes'],function(_0x26ec23){return{'name':_0x26ec23[_0x6807('0x2e')],'type':_0x26ec23[_0x6807('0x2f')][_0x6807('0x30')]};});_0x4c7485['model']=_[_0x6807('0x31')](_[_0x6807('0x32')](_0x539a78,'name'),['format']);_0x4c7485[_0x6807('0x33')]=_[_0x6807('0x34')](_0x2436cc[_0x6807('0x33')]);_0x4c7485['filters']=_[_0x6807('0x35')](_0x4c7485[_0x6807('0x36')],_0x4c7485['query']);_0x46921e[_0x6807('0x37')]=_[_0x6807('0x35')](_0x4c7485[_0x6807('0x36')],qs['fields'](_0x2436cc[_0x6807('0x33')][_0x6807('0x38')]));_0x46921e[_0x6807('0x37')]=_0x46921e['attributes'][_0x6807('0x39')]?_0x46921e[_0x6807('0x37')]:_0x4c7485[_0x6807('0x36')];if(!_0x2436cc[_0x6807('0x33')]['hasOwnProperty'](_0x6807('0x3a'))){_0x46921e[_0x6807('0x20')]=qs[_0x6807('0x20')](_0x2436cc[_0x6807('0x33')][_0x6807('0x20')]);_0x46921e['offset']=qs['offset'](_0x2436cc[_0x6807('0x33')][_0x6807('0x1f')]);}_0x46921e['order']=qs[_0x6807('0x3b')](_0x2436cc['query'][_0x6807('0x3b')]);_0x46921e[_0x6807('0x3c')]=qs[_0x6807('0x3d')](_['pick'](_0x2436cc['query'],_0x4c7485[_0x6807('0x3d')]),_0x539a78);if(_0x2436cc['query'][_0x6807('0x3e')]){_0x46921e[_0x6807('0x3c')]=_[_0x6807('0x3f')](_0x46921e['where'],{'$or':_[_0x6807('0x32')](_0x539a78,function(_0x3dd57f){if(_0x3dd57f[_0x6807('0x2f')]!==_0x6807('0x40')){var _0xbdab2b={};_0xbdab2b[_0x3dd57f[_0x6807('0x2b')]]={'$like':'%'+_0x2436cc[_0x6807('0x33')][_0x6807('0x3e')]+'%'};return _0xbdab2b;}})});}_0x46921e=_[_0x6807('0x3f')]({},_0x46921e,_0x2436cc['options']);var _0x2b3f01={'where':_0x46921e[_0x6807('0x3c')]};return db[_0x6807('0x2d')]['count'](_0x2b3f01)[_0x6807('0x26')](function(_0x5273ea){_0x358c38[_0x6807('0x1e')]=_0x5273ea;if(_0x2436cc[_0x6807('0x33')]['includeAll']){_0x46921e['include']=[{'all':!![]}];}return db[_0x6807('0x2d')]['findAll'](_0x46921e);})[_0x6807('0x26')](function(_0x446223){_0x358c38[_0x6807('0x41')]=_0x446223;return _0x358c38;})[_0x6807('0x26')](respondWithFilteredResult(_0x48c795,_0x46921e))[_0x6807('0x42')](handleError(_0x48c795,null));};exports['show']=function(_0x224271,_0x14e4db){var _0xc58de6={'raw':![],'where':{'id':_0x224271[_0x6807('0x43')]['id']}},_0x38d43b={};_0x38d43b['model']=_[_0x6807('0x34')](db['VoiceRecording'][_0x6807('0x44')]);_0x38d43b['query']=_[_0x6807('0x34')](_0x224271[_0x6807('0x33')]);_0x38d43b[_0x6807('0x3d')]=_['intersection'](_0x38d43b[_0x6807('0x36')],_0x38d43b[_0x6807('0x33')]);_0xc58de6[_0x6807('0x37')]=_[_0x6807('0x35')](_0x38d43b[_0x6807('0x36')],qs[_0x6807('0x38')](_0x224271['query'][_0x6807('0x38')]));_0xc58de6['attributes']=_0xc58de6[_0x6807('0x37')][_0x6807('0x39')]?_0xc58de6['attributes']:_0x38d43b[_0x6807('0x36')];if(_0x224271['query']['includeAll']){_0xc58de6[_0x6807('0x45')]=[{'all':!![]}];}_0xc58de6=_[_0x6807('0x3f')]({},_0xc58de6,_0x224271[_0x6807('0x46')]);return db[_0x6807('0x2d')][_0x6807('0x47')](_0xc58de6)[_0x6807('0x26')](handleEntityNotFound(_0x14e4db,null))[_0x6807('0x26')](respondWithResult(_0x14e4db,null))[_0x6807('0x42')](handleError(_0x14e4db,null));};exports[_0x6807('0x48')]=function(_0x403bce,_0x1f0096){return db['VoiceRecording'][_0x6807('0x48')](_0x403bce[_0x6807('0x49')],{})[_0x6807('0x26')](respondWithResult(_0x1f0096,0xc9))[_0x6807('0x42')](handleError(_0x1f0096,null));};exports[_0x6807('0x25')]=function(_0x3283d8,_0x131160){if(_0x3283d8[_0x6807('0x49')]['id']){delete _0x3283d8[_0x6807('0x49')]['id'];}return db['VoiceRecording'][_0x6807('0x47')]({'where':{'id':_0x3283d8[_0x6807('0x43')]['id']}})[_0x6807('0x26')](handleEntityNotFound(_0x131160,null))['then'](saveUpdates(_0x3283d8[_0x6807('0x49')],null))[_0x6807('0x26')](respondWithResult(_0x131160,null))[_0x6807('0x42')](handleError(_0x131160,null));};exports[_0x6807('0x4a')]=function(_0x2001f2,_0x489094){return db[_0x6807('0x2d')][_0x6807('0x4a')]()[_0x6807('0x26')](respondWithResult(_0x489094,null))['catch'](handleError(_0x489094,null));};exports[_0x6807('0x4b')]=function(_0x4fa1b1,_0xa915ce,_0x2ee706){var _0x16efed=require(_0x6807('0x4c'));var _0x354096=![];var _0xaf1fd8={};if(_0x4fa1b1[_0x6807('0x33')]['type']&&_0x4fa1b1['query'][_0x6807('0x2f')]==='uniqueid'){_0xaf1fd8['uniqueid']=_0x4fa1b1[_0x6807('0x43')]['id'];}else{_0xaf1fd8['id']=_0x4fa1b1[_0x6807('0x43')]['id'];}return db[_0x6807('0x2d')][_0x6807('0x47')]({'where':_0xaf1fd8,'attributes':['id',_0x6807('0x4d')],'raw':!![]})[_0x6807('0x26')](handleEntityNotFound(_0xa915ce,null))[_0x6807('0x26')](function(_0x207ba8){if(_0x207ba8){var _0x4dfe78=_0x207ba8[_0x6807('0x4d')];var _0x110f4f=util[_0x6807('0x4e')](_0x6807('0x4f'),_0x4dfe78);if(fs[_0x6807('0x50')](_0x110f4f)){_0x354096=!![];return _0x16efed[_0x6807('0x51')](_0x110f4f,_0x4dfe78,config[_0x6807('0x52')][_0x6807('0x53')])[_0x6807('0x26')](function(){return _0x207ba8;});}return _0x207ba8;}})[_0x6807('0x26')](function(_0x162a2e){if(_0x162a2e){var _0x3b3d0c=_0x162a2e[_0x6807('0x4d')];if(!fs['existsSync'](_0x3b3d0c)){throw new db[(_0x6807('0x54'))][(_0x6807('0x55'))](_0x6807('0x56'));}if(_0x162a2e[_0x6807('0x57')]){return _0xa915ce['download'](_0x3b3d0c,_0x162a2e[_0x6807('0x57')]+path['extname'](_0x3b3d0c),function(){if(_0x354096){fs[_0x6807('0x58')](_0x3b3d0c);}});}else{return _0xa915ce['download'](_0x3b3d0c,function(_0x445323){if(_0x354096){fs[_0x6807('0x58')](_0x3b3d0c);}});}}})[_0x6807('0x42')](function(_0xd0e24a){if(_0xd0e24a[_0x6807('0x59')]===_0x6807('0x56')){_0xa915ce[_0x6807('0x1b')](0x194)[_0x6807('0x5a')](_0x6807('0x5b'));}else{return handleError(_0xa915ce,null);}});};exports[_0x6807('0x5c')]=function(_0x240ba3,_0x5cea5b,_0x39f1ba){var _0x281e73=require(_0x6807('0x4c'));var _0x59b51b=![];var _0x1b6d6c={'$and':[db[_0x6807('0x5d')][_0x6807('0x3c')](db['sequelize']['fn'](_0x6807('0x5e'),db['sequelize'][_0x6807('0x5f')]('uniqueid')),_0x240ba3[_0x6807('0x33')][_0x6807('0x60')])]};if(_0x240ba3[_0x6807('0x33')]['type']&&_0x240ba3[_0x6807('0x33')][_0x6807('0x2f')]===_0x6807('0x61')){_0x1b6d6c['$and']['push']({'uniqueid':_0x240ba3[_0x6807('0x43')]['id']});}else{_0x1b6d6c[_0x6807('0x62')][_0x6807('0x63')]({'id':_0x240ba3['params']['id']});}return db['VoiceRecording'][_0x6807('0x47')]({'where':_0x1b6d6c,'attributes':['id',_0x6807('0x4d')],'raw':!![]})[_0x6807('0x26')](handleEntityNotFound(_0x5cea5b,null))['then'](function(_0x3faea3){if(_0x3faea3){var _0xd7f841=util['format'](_0x6807('0x4f'),_0x3faea3[_0x6807('0x4d')]);if(fs[_0x6807('0x50')](_0xd7f841)){_0x59b51b=!![];return _0x281e73[_0x6807('0x51')](_0xd7f841,_0x3faea3[_0x6807('0x4d')],config['secrets'][_0x6807('0x53')])[_0x6807('0x26')](function(){return _0x3faea3;});}return _0x3faea3;}})['then'](function(_0x210670){if(_0x210670){if(!fs['existsSync'](_0x210670[_0x6807('0x4d')])){throw new db['Sequelize'][(_0x6807('0x55'))](_0x6807('0x56'));}if(_0x210670['filename']){return _0x5cea5b[_0x6807('0x4b')](_0x210670['value'],_0x210670[_0x6807('0x57')]+path[_0x6807('0x64')](_0x210670[_0x6807('0x4d')]),function(){if(_0x59b51b){fs[_0x6807('0x58')](_0x210670['value']);}});}else{return _0x5cea5b['download'](_0x210670[_0x6807('0x4d')],function(_0x181614){if(_0x59b51b){fs[_0x6807('0x58')](_0x210670['value']);}});}}})[_0x6807('0x42')](handleError(_0x5cea5b,null));};exports[_0x6807('0x27')]=function(_0x352d3c,_0x2bafa9){return db[_0x6807('0x2d')][_0x6807('0x47')]({'where':{'id':_0x352d3c[_0x6807('0x43')]['id']}})['then'](function(_0x3e56f5){if(!_0x3e56f5)throw new ReferenceError('Entity\x20not\x20found');return _0x3e56f5;})[_0x6807('0x26')](function(_0x57207b){var _0x18891a=_0x57207b[_0x6807('0x4d')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x18891a);if(!_[_0x6807('0x65')](_0x57207b[_0x6807('0x4d')])&&fs['existsSync'](_0x18891a)){logger['info'](_0x6807('0x66')+_0x18891a+_0x6807('0x67'));fs[_0x6807('0x68')](_0x18891a);}_0x18891a=_0x18891a+_0x6807('0x69');if(!_['isNil'](_0x57207b['value'])&&fs[_0x6807('0x50')](_0x18891a)){logger['info'](_0x6807('0x66')+_0x18891a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x18891a);}return _0x57207b;})[_0x6807('0x26')](function(_0x54d3f7){if(!_0x54d3f7)throw new InternalError();return _0x54d3f7['destroy']();})[_0x6807('0x26')](function(){_0x2bafa9[_0x6807('0x1b')](0xcc)[_0x6807('0x1c')]();})[_0x6807('0x42')](handleError(_0x2bafa9,null));};function getBucketslist(_0x32f984,_0x1d979f,_0x15f22e){return new Promise(function(_0x4da98a,_0xcdf95f){var _0x5d4729=new AWS['S3']({'accessKeyId':_0x1d979f,'secretAccessKey':_0x32f984,'region':_0x15f22e});_0x5d4729[_0x6807('0x6a')]({},function(_0x479be0,_0x32822b){if(_0x479be0){return _0xcdf95f(_0x479be0);}else{return _0x4da98a(_0x32822b);}});});}function createBucket(_0xff86d1,_0x142e28,_0x4ef63d,_0x40659b){return new Promise(function(_0xb5348d,_0x42597d){var _0x5f3063=new AWS['S3']({'accessKeyId':_0x142e28,'secretAccessKey':_0xff86d1,'region':_0x4ef63d});_0x5f3063[_0x6807('0x6b')]({'Bucket':_0x40659b},function(_0x43a6a9,_0x589470){if(_0x43a6a9){return _0x42597d(_0x43a6a9);}else{return _0xb5348d(_0x589470);}});});}function uploadFile(_0x12028e,_0x37bc8c,_0x284b8c,_0x565cc3,_0x464423,_0x50325d){return new Promise(function(_0x52e727,_0xca6203){var _0x58756c=new AWS['S3']({'accessKeyId':_0x37bc8c,'secretAccessKey':_0x12028e,'region':_0x284b8c});_0x58756c['upload']({'Bucket':_0x565cc3,'Key':_0x464423,'Body':_0x50325d},function(_0x31a656,_0x1f9d44){if(_0x31a656){return _0xca6203(_0x31a656);}else{return _0x52e727(_0x1f9d44);}});});}function startTranscribe(_0x4d5fb7,_0x401e5c,_0x43698a,_0x482d0c,_0x42a5db,_0x3b9d40){return new Promise(function(_0x3abd9d,_0x47fe1a){var _0x484baf=new AWS[(_0x6807('0x6c'))]({'accessKeyId':_0x401e5c,'secretAccessKey':_0x4d5fb7,'region':_0x43698a});_0x484baf[_0x6807('0x6d')]({'TranscriptionJobName':_0x482d0c,'LanguageCode':_0x42a5db,'Media':{'MediaFileUri':_0x3b9d40}},function(_0x1f6e3e,_0x322acc){if(_0x1f6e3e){return _0x47fe1a(_0x1f6e3e);}else{return _0x3abd9d(_0x322acc);}});});}function transcribe(_0x311c7a,_0x248d24,_0x5544b5,_0x15ff6b,_0xb025ad,_0x5b0b7f,_0x375493){return new Promise(function(_0x3246cb,_0x203b60){var _0x4aadc3={};logger[_0x6807('0x6e')](util['format'](_0x6807('0x6f'),_0x311c7a,_0xb025ad));return uploadFile(_0x248d24,_0x5544b5,_0x15ff6b,_0xb025ad,path['basename'](_0x5b0b7f),fs[_0x6807('0x70')](_0x5b0b7f))[_0x6807('0x26')](function(_0x1381eb){logger[_0x6807('0x6e')](util[_0x6807('0x4e')](_0x6807('0x71'),_0x311c7a,_0xb025ad,_0x1381eb[_0x6807('0x72')]));_0x4aadc3[_0x6807('0x73')]=_0x1381eb['Bucket'];_0x4aadc3[_0x6807('0x74')]=_0x1381eb[_0x6807('0x72')];logger[_0x6807('0x6e')](util[_0x6807('0x4e')](_0x6807('0x75'),_0x311c7a));return startTranscribe(_0x248d24,_0x5544b5,_0x15ff6b,uuidv4(),_0x375493,_0x1381eb[_0x6807('0x72')]);})[_0x6807('0x26')](function(_0x30a408){logger[_0x6807('0x6e')](util[_0x6807('0x4e')](_0x6807('0x76'),_0x311c7a,_0x30a408[_0x6807('0x77')][_0x6807('0x78')]));_0x4aadc3[_0x6807('0x79')]=_0x30a408[_0x6807('0x77')][_0x6807('0x78')];_0x4aadc3[_0x6807('0x7a')]=_0x30a408['TranscriptionJob'][_0x6807('0x7b')];return _0x3246cb(_0x4aadc3);})[_0x6807('0x42')](function(_0x4675cb){return _0x203b60(_0x4675cb);});});}exports[_0x6807('0x7c')]=function(_0x4712be,_0x31aead,_0x33037c){var _0x187cad;var _0x10e3c0;var _0x379cea;var _0x3118c1=require(_0x6807('0x4c'));return db['VoiceRecording'][_0x6807('0x7d')]({'where':{'id':_0x4712be['params']['id']}})['then'](function(_0x584f56){if(_0x584f56){var _0x4c2225=util[_0x6807('0x4e')](_0x6807('0x4f'),_0x584f56[_0x6807('0x4d')]);if(fs[_0x6807('0x50')](_0x4c2225)){cypher=!![];return _0x3118c1[_0x6807('0x51')](_0x4c2225,_0x584f56['value'],config['secrets'][_0x6807('0x53')])[_0x6807('0x26')](function(){return _0x584f56;});}return _0x584f56;}})[_0x6807('0x26')](function(_0xdc896f){if(!_0xdc896f){throw new db['Sequelize']['ValidationError'](_0x6807('0x7e'));}_0x10e3c0=_0xdc896f;return db[_0x6807('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x6807('0x26')](handleEntityNotFound(_0x31aead,null))[_0x6807('0x26')](function(_0x275f37){if(_0x275f37){_0x187cad=_0x275f37;if(!_0x187cad[_0x6807('0x80')]||!_0x187cad[_0x6807('0x81')]||!_0x187cad['transcribeRegion']||!_0x187cad[_0x6807('0x82')]||!_0x187cad[_0x6807('0x73')]){throw new db[(_0x6807('0x54'))]['ValidationError'](_0x6807('0x83'));}if(_0x4712be[_0x6807('0x49')]['runSentiment']&&(!_0x187cad['sentiment']||!_0x187cad[_0x6807('0x84')]||!_0x187cad[_0x6807('0x85')]||!_0x187cad[_0x6807('0x82')]||!_0x187cad[_0x6807('0x73')])){throw new db['Sequelize']['ValidationError'](_0x6807('0x86'));}return db['CloudProvider']['findOne']({'where':{'id':_0x187cad[_0x6807('0x81')]}});}})[_0x6807('0x26')](function(_0x460b58){if(!_0x460b58){throw new db[(_0x6807('0x54'))][(_0x6807('0x55'))](_0x6807('0x87'));}if(!_0x460b58[_0x6807('0x88')]||!_0x460b58[_0x6807('0x89')]){throw new db['Sequelize'][(_0x6807('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x379cea=_0x460b58;return getBucketslist(_0x379cea['data1'],_0x379cea[_0x6807('0x89')],_0x187cad[_0x6807('0x8a')]);})[_0x6807('0x26')](function(_0x222bf0){if(_0x222bf0&&_0x222bf0[_0x6807('0x8b')]){var _0x10b486=_[_0x6807('0x47')](_0x222bf0[_0x6807('0x8b')],function(_0x5c3f17){return _0x5c3f17['Name']===_0x187cad['bucket'];});if(!_0x10b486){logger['info'](util[_0x6807('0x4e')](_0x6807('0x8c'),_0x4712be['params']['id'],_0x187cad[_0x6807('0x73')]));return createBucket(_0x379cea[_0x6807('0x88')],_0x379cea[_0x6807('0x89')],_0x187cad[_0x6807('0x8a')],_0x187cad[_0x6807('0x73')]);}logger[_0x6807('0x6e')](util[_0x6807('0x4e')](_0x6807('0x8d'),_0x4712be[_0x6807('0x43')]['id'],_0x187cad[_0x6807('0x73')]));return;}})[_0x6807('0x26')](function(_0x2adfcc){if(_0x10e3c0[_0x6807('0x7a')]===_0x6807('0x8e')){return transcribe(_0x4712be[_0x6807('0x43')]['id'],_0x379cea[_0x6807('0x88')],_0x379cea[_0x6807('0x89')],_0x187cad[_0x6807('0x8a')],_0x187cad[_0x6807('0x73')],_0x10e3c0[_0x6807('0x4d')],_0x187cad[_0x6807('0x82')]);}else{logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4712be[_0x6807('0x43')]['id']));return{'transcribeStatus':_0x6807('0x8f')};}})[_0x6807('0x26')](function(_0x5b88c5){if(_0x5b88c5){_0x5b88c5['tempSentiment']=_0x4712be['body'][_0x6807('0x90')];return _0x10e3c0[_0x6807('0x91')](_0x5b88c5);}})[_0x6807('0x26')](respondWithResult(_0x31aead,null))[_0x6807('0x42')](handleError(_0x31aead,null));};function writeFile(_0x4f58e8,_0x30e5ee){return new Promise(function(_0x58a5d6,_0x1c481a){fs[_0x6807('0x92')](_0x30e5ee,_0x4f58e8,function(_0x2209c3,_0x4cf1b1){if(_0x2209c3){return _0x1c481a(_0x2209c3);}else{return _0x58a5d6(_0x4cf1b1);}});});}exports[_0x6807('0x93')]=function(_0x217716,_0x4ccd2a,_0xf8415f){return db[_0x6807('0x2d')][_0x6807('0x7d')]({'where':{'id':_0x217716[_0x6807('0x43')]['id']}})[_0x6807('0x26')](handleEntityNotFound(_0x4ccd2a))['then'](function(_0x557e4d){if(_0x557e4d&&_0x557e4d[_0x6807('0x94')]){var _0x12a7f9=_0x557e4d[_0x6807('0x94')];var _0x3e2279=config[_0x6807('0x95')]+_0x6807('0x96')+_0x557e4d['id']+_0x6807('0x97');if(fs['existsSync'](_0x3e2279)){return _0x3e2279;}return writeFile(_0x12a7f9,_0x3e2279)[_0x6807('0x26')](function(){return _0x3e2279;});}else{throw new db[(_0x6807('0x54'))][(_0x6807('0x55'))](_0x6807('0x98'));}})[_0x6807('0x26')](function(_0x29046e){return _0x4ccd2a[_0x6807('0x4b')](_0x29046e);})[_0x6807('0x42')](handleError(_0x4ccd2a));}; \ No newline at end of file +var _0x81f0=['Setting','findOne','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','count','offset','limit','status','set','json','apply','save','destroy','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','params','catch','create','body','update','find','describe','download','../../components/encryptor','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','secrets','VoiceRecording\x20not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found'];(function(_0x18aae7,_0xec78c6){var _0x214ce4=function(_0x20b492){while(--_0x20b492){_0x18aae7['push'](_0x18aae7['shift']());}};_0x214ce4(++_0xec78c6);}(_0x81f0,0xaf));var _0x081f=function(_0xcba9ca,_0x32f7e6){_0xcba9ca=_0xcba9ca-0x0;var _0x5743ff=_0x81f0[_0xcba9ca];return _0x5743ff;};'use strict';var pdf=require(_0x081f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x081f('0x1'));var jsonpatch=require(_0x081f('0x2'));var rp=require('request-promise');var moment=require(_0x081f('0x3'));var BPromise=require(_0x081f('0x4'));var Mustache=require(_0x081f('0x5'));var util=require('util');var path=require(_0x081f('0x6'));var sox=require(_0x081f('0x7'));var csv=require(_0x081f('0x8'));var ejs=require(_0x081f('0x9'));var fs=require('fs');var _=require(_0x081f('0xa'));var squel=require(_0x081f('0xb'));var crypto=require(_0x081f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x081f('0xd'));var toCsv=require(_0x081f('0x8'));var querystring=require(_0x081f('0xe'));var Papa=require(_0x081f('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x081f('0x10'));var Redis=require(_0x081f('0x11'));var authService=require(_0x081f('0x12'));var qs=require(_0x081f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x081f('0x14'));var logger=require(_0x081f('0x15'))(_0x081f('0x16'));var utils=require(_0x081f('0x17'));var config=require(_0x081f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x257496,_0x1cb226){_0x1cb226=_0x1cb226||0xcc;return function(_0xf7bcea){if(_0xf7bcea){return _0x257496[_0x081f('0x19')](_0x1cb226);}return _0x257496['status'](_0x1cb226)['end']();};}function respondWithResult(_0x1ae477,_0x310551){_0x310551=_0x310551||0xc8;return function(_0x11fca6){if(_0x11fca6){return _0x1ae477['status'](_0x310551)['json'](_0x11fca6);}};}function respondWithFilteredResult(_0xd306fc,_0x35f8f0){return function(_0xba877b){if(_0xba877b){var _0x514bba=_0xba877b[_0x081f('0x1a')],_0x566f90=_0x35f8f0['offset'],_0x48637b=_0x35f8f0[_0x081f('0x1b')]+_0x35f8f0[_0x081f('0x1c')],_0x36aaa6;if(_0x48637b>=_0x514bba){_0x48637b=_0x514bba;_0x36aaa6=0xc8;}else{_0x36aaa6=0xce;}_0xd306fc[_0x081f('0x1d')](_0x36aaa6);return _0xd306fc[_0x081f('0x1e')]('Content-Range',_0x566f90+'-'+_0x48637b+'/'+_0x514bba)[_0x081f('0x1f')](_0xba877b);}return null;};}function patchUpdates(_0x18cf6a){return function(_0x5bcdb0){try{jsonpatch[_0x081f('0x20')](_0x5bcdb0,_0x18cf6a,!![]);}catch(_0x437775){return BPromise['reject'](_0x437775);}return _0x5bcdb0[_0x081f('0x21')]();};}function saveUpdates(_0x8b4b09,_0x1b77db){return function(_0x4eef8d){if(_0x4eef8d){return _0x4eef8d['update'](_0x8b4b09)['then'](function(_0x2af0e7){return _0x2af0e7;});}return null;};}function removeEntity(_0x24abc4,_0x3d6c8f){return function(_0x47ba6c){if(_0x47ba6c){return _0x47ba6c[_0x081f('0x22')]()[_0x081f('0x23')](function(){_0x24abc4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2826e2,_0x57ab56){return function(_0x5891a1){if(!_0x5891a1){_0x2826e2[_0x081f('0x19')](0x194);}return _0x5891a1;};}function handleError(_0x17c7bb,_0x1267e1){_0x1267e1=_0x1267e1||0x1f4;return function(_0x1f590c){logger[_0x081f('0x24')](_0x1f590c[_0x081f('0x25')]);if(_0x1f590c[_0x081f('0x26')]){delete _0x1f590c['name'];}_0x17c7bb[_0x081f('0x1d')](_0x1267e1)[_0x081f('0x27')](_0x1f590c);};}exports[_0x081f('0x28')]=function(_0x2cf93c,_0x577179){var _0x4252c3={},_0x4d2c89={},_0x4850ef={'count':0x0,'rows':[]};var _0x5a8888=_[_0x081f('0x29')](db[_0x081f('0x2a')][_0x081f('0x2b')],function(_0x7789a0){return{'name':_0x7789a0[_0x081f('0x2c')],'type':_0x7789a0[_0x081f('0x2d')][_0x081f('0x2e')]};});_0x4d2c89[_0x081f('0x2f')]=_['differenceBy'](_[_0x081f('0x29')](_0x5a8888,_0x081f('0x26')),[_0x081f('0x30')]);_0x4d2c89['query']=_[_0x081f('0x31')](_0x2cf93c[_0x081f('0x32')]);_0x4d2c89[_0x081f('0x33')]=_[_0x081f('0x34')](_0x4d2c89[_0x081f('0x2f')],_0x4d2c89[_0x081f('0x32')]);_0x4252c3[_0x081f('0x35')]=_[_0x081f('0x34')](_0x4d2c89[_0x081f('0x2f')],qs['fields'](_0x2cf93c[_0x081f('0x32')][_0x081f('0x36')]));_0x4252c3[_0x081f('0x35')]=_0x4252c3['attributes']['length']?_0x4252c3['attributes']:_0x4d2c89[_0x081f('0x2f')];if(!_0x2cf93c[_0x081f('0x32')][_0x081f('0x37')](_0x081f('0x38'))){_0x4252c3[_0x081f('0x1c')]=qs[_0x081f('0x1c')](_0x2cf93c[_0x081f('0x32')][_0x081f('0x1c')]);_0x4252c3[_0x081f('0x1b')]=qs[_0x081f('0x1b')](_0x2cf93c['query'][_0x081f('0x1b')]);}_0x4252c3[_0x081f('0x39')]=qs[_0x081f('0x3a')](_0x2cf93c[_0x081f('0x32')][_0x081f('0x3a')]);_0x4252c3['where']=qs['filters'](_[_0x081f('0x3b')](_0x2cf93c[_0x081f('0x32')],_0x4d2c89[_0x081f('0x33')]),_0x5a8888);if(_0x2cf93c[_0x081f('0x32')][_0x081f('0x3c')]){_0x4252c3[_0x081f('0x3d')]=_[_0x081f('0x3e')](_0x4252c3['where'],{'$or':_[_0x081f('0x29')](_0x5a8888,function(_0x4c53fc){if(_0x4c53fc[_0x081f('0x2d')]!==_0x081f('0x3f')){var _0x5e62d2={};_0x5e62d2[_0x4c53fc[_0x081f('0x26')]]={'$like':'%'+_0x2cf93c['query'][_0x081f('0x3c')]+'%'};return _0x5e62d2;}})});}_0x4252c3=_[_0x081f('0x3e')]({},_0x4252c3,_0x2cf93c[_0x081f('0x40')]);var _0x521db6={'where':_0x4252c3[_0x081f('0x3d')]};return db['VoiceRecording']['count'](_0x521db6)[_0x081f('0x23')](function(_0x47d638){_0x4850ef[_0x081f('0x1a')]=_0x47d638;if(_0x2cf93c[_0x081f('0x32')]['includeAll']){_0x4252c3[_0x081f('0x41')]=[{'all':!![]}];}return db[_0x081f('0x2a')]['findAll'](_0x4252c3);})[_0x081f('0x23')](function(_0xc6f0a4){_0x4850ef[_0x081f('0x42')]=_0xc6f0a4;return _0x4850ef;})[_0x081f('0x23')](respondWithFilteredResult(_0x577179,_0x4252c3))['catch'](handleError(_0x577179,null));};exports['show']=function(_0x230e1a,_0x35ed84){var _0x4dc39b={'raw':![],'where':{'id':_0x230e1a[_0x081f('0x43')]['id']}},_0x29357b={};_0x29357b[_0x081f('0x2f')]=_['keys'](db[_0x081f('0x2a')][_0x081f('0x2b')]);_0x29357b[_0x081f('0x32')]=_[_0x081f('0x31')](_0x230e1a[_0x081f('0x32')]);_0x29357b[_0x081f('0x33')]=_['intersection'](_0x29357b[_0x081f('0x2f')],_0x29357b['query']);_0x4dc39b[_0x081f('0x35')]=_['intersection'](_0x29357b[_0x081f('0x2f')],qs['fields'](_0x230e1a[_0x081f('0x32')]['fields']));_0x4dc39b[_0x081f('0x35')]=_0x4dc39b[_0x081f('0x35')]['length']?_0x4dc39b[_0x081f('0x35')]:_0x29357b[_0x081f('0x2f')];if(_0x230e1a['query']['includeAll']){_0x4dc39b[_0x081f('0x41')]=[{'all':!![]}];}_0x4dc39b=_['merge']({},_0x4dc39b,_0x230e1a['options']);return db[_0x081f('0x2a')]['find'](_0x4dc39b)['then'](handleEntityNotFound(_0x35ed84,null))[_0x081f('0x23')](respondWithResult(_0x35ed84,null))[_0x081f('0x44')](handleError(_0x35ed84,null));};exports[_0x081f('0x45')]=function(_0x41718a,_0x3c55dc){return db[_0x081f('0x2a')][_0x081f('0x45')](_0x41718a[_0x081f('0x46')],{})[_0x081f('0x23')](respondWithResult(_0x3c55dc,0xc9))[_0x081f('0x44')](handleError(_0x3c55dc,null));};exports[_0x081f('0x47')]=function(_0x8ff96,_0x5e4b19){if(_0x8ff96[_0x081f('0x46')]['id']){delete _0x8ff96['body']['id'];}return db[_0x081f('0x2a')][_0x081f('0x48')]({'where':{'id':_0x8ff96[_0x081f('0x43')]['id']}})[_0x081f('0x23')](handleEntityNotFound(_0x5e4b19,null))[_0x081f('0x23')](saveUpdates(_0x8ff96[_0x081f('0x46')],null))[_0x081f('0x23')](respondWithResult(_0x5e4b19,null))[_0x081f('0x44')](handleError(_0x5e4b19,null));};exports[_0x081f('0x49')]=function(_0x1d6184,_0x122313){return db[_0x081f('0x2a')]['describe']()[_0x081f('0x23')](respondWithResult(_0x122313,null))[_0x081f('0x44')](handleError(_0x122313,null));};exports[_0x081f('0x4a')]=function(_0x30075e,_0x5f0902,_0x586612){var _0x5f0679=require(_0x081f('0x4b'));var _0x555636=![];var _0x837065={};if(_0x30075e['query'][_0x081f('0x2d')]&&_0x30075e['query']['type']==='uniqueid'){_0x837065['uniqueid']=_0x30075e[_0x081f('0x43')]['id'];}else{_0x837065['id']=_0x30075e[_0x081f('0x43')]['id'];}return db['VoiceRecording']['find']({'where':_0x837065,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5f0902,null))[_0x081f('0x23')](function(_0x5c850a){if(_0x5c850a){var _0xaae21b=_0x5c850a[_0x081f('0x4c')];var _0x58d9e7=util[_0x081f('0x30')](_0x081f('0x4d'),_0xaae21b);if(fs[_0x081f('0x4e')](_0x58d9e7)){_0x555636=!![];return _0x5f0679[_0x081f('0x4f')](_0x58d9e7,_0xaae21b,config['secrets'][_0x081f('0x50')])[_0x081f('0x23')](function(){return _0x5c850a;});}return _0x5c850a;}})[_0x081f('0x23')](function(_0x579ce6){if(_0x579ce6){var _0x341297=_0x579ce6[_0x081f('0x4c')];if(!fs[_0x081f('0x4e')](_0x341297)){throw new db[(_0x081f('0x51'))][(_0x081f('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x579ce6[_0x081f('0x53')]){return _0x5f0902[_0x081f('0x4a')](_0x341297,_0x579ce6[_0x081f('0x53')]+path[_0x081f('0x54')](_0x341297),function(){if(_0x555636){fs[_0x081f('0x55')](_0x341297);}});}else{return _0x5f0902[_0x081f('0x4a')](_0x341297,function(_0x255eec){if(_0x555636){fs[_0x081f('0x55')](_0x341297);}});}}})[_0x081f('0x44')](function(_0x176357){if(_0x176357[_0x081f('0x56')]==='VoiceRecording\x20not\x20found'){_0x5f0902['status'](0x194)[_0x081f('0x27')](_0x081f('0x57'));}else{return handleError(_0x5f0902,null);}});};exports['downloads']=function(_0x5aeb92,_0xa984c5,_0x1cd1a5){var _0x5dd0e0=require(_0x081f('0x4b'));var _0x240711=![];var _0x306f3a={'$and':[db[_0x081f('0x58')][_0x081f('0x3d')](db['sequelize']['fn'](_0x081f('0x59'),db[_0x081f('0x58')][_0x081f('0x5a')]('uniqueid')),_0x5aeb92[_0x081f('0x32')][_0x081f('0x5b')])]};if(_0x5aeb92[_0x081f('0x32')][_0x081f('0x2d')]&&_0x5aeb92[_0x081f('0x32')][_0x081f('0x2d')]==='uniqueid'){_0x306f3a[_0x081f('0x5c')][_0x081f('0x5d')]({'uniqueid':_0x5aeb92[_0x081f('0x43')]['id']});}else{_0x306f3a[_0x081f('0x5c')][_0x081f('0x5d')]({'id':_0x5aeb92[_0x081f('0x43')]['id']});}return db[_0x081f('0x2a')][_0x081f('0x48')]({'where':_0x306f3a,'attributes':['id',_0x081f('0x4c')],'raw':!![]})[_0x081f('0x23')](handleEntityNotFound(_0xa984c5,null))[_0x081f('0x23')](function(_0x1e77eb){if(_0x1e77eb){var _0x1d5f2e=util[_0x081f('0x30')]('%s.cypher',_0x1e77eb[_0x081f('0x4c')]);if(fs[_0x081f('0x4e')](_0x1d5f2e)){_0x240711=!![];return _0x5dd0e0['decryptFile'](_0x1d5f2e,_0x1e77eb[_0x081f('0x4c')],config[_0x081f('0x5e')][_0x081f('0x50')])[_0x081f('0x23')](function(){return _0x1e77eb;});}return _0x1e77eb;}})[_0x081f('0x23')](function(_0x367267){if(_0x367267){if(!fs[_0x081f('0x4e')](_0x367267['value'])){throw new db[(_0x081f('0x51'))][(_0x081f('0x52'))](_0x081f('0x5f'));}if(_0x367267['filename']){return _0xa984c5[_0x081f('0x4a')](_0x367267[_0x081f('0x4c')],_0x367267[_0x081f('0x53')]+path['extname'](_0x367267[_0x081f('0x4c')]),function(){if(_0x240711){fs['unlink'](_0x367267[_0x081f('0x4c')]);}});}else{return _0xa984c5['download'](_0x367267['value'],function(_0x1a8991){if(_0x240711){fs['unlink'](_0x367267[_0x081f('0x4c')]);}});}}})[_0x081f('0x44')](handleError(_0xa984c5,null));};exports[_0x081f('0x22')]=function(_0x4d007e,_0x39ca11){return db['VoiceRecording'][_0x081f('0x48')]({'where':{'id':_0x4d007e['params']['id']}})[_0x081f('0x23')](function(_0x4fa877){if(!_0x4fa877)throw new ReferenceError(_0x081f('0x60'));return _0x4fa877;})[_0x081f('0x23')](function(_0x3b994d){var _0x289d1e=_0x3b994d[_0x081f('0x4c')];logger[_0x081f('0x61')]('cancellazione\x20fisica\x20documento\x20%s',_0x289d1e);if(!_[_0x081f('0x62')](_0x3b994d[_0x081f('0x4c')])&&fs[_0x081f('0x4e')](_0x289d1e)){logger['info']('File:\x20\x22'+_0x289d1e+_0x081f('0x63'));fs[_0x081f('0x64')](_0x289d1e);}_0x289d1e=_0x289d1e+_0x081f('0x65');if(!_[_0x081f('0x62')](_0x3b994d[_0x081f('0x4c')])&&fs[_0x081f('0x4e')](_0x289d1e)){logger['info'](_0x081f('0x66')+_0x289d1e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x081f('0x64')](_0x289d1e);}return _0x3b994d;})[_0x081f('0x23')](function(_0x2c03fc){if(!_0x2c03fc)throw new InternalError();return _0x2c03fc['destroy']();})[_0x081f('0x23')](function(){_0x39ca11['status'](0xcc)['end']();})[_0x081f('0x44')](handleError(_0x39ca11,null));};function getBucketslist(_0x576c13,_0x2e2c58,_0x3029a6){return new Promise(function(_0x6b2233,_0x44a380){var _0x15c414=new AWS['S3']({'accessKeyId':_0x2e2c58,'secretAccessKey':_0x576c13,'region':_0x3029a6});_0x15c414['listBuckets']({},function(_0x3e90b4,_0x3a85e1){if(_0x3e90b4){return _0x44a380(_0x3e90b4);}else{return _0x6b2233(_0x3a85e1);}});});}function createBucket(_0x333994,_0x342fdd,_0x220535,_0x3bacfb){return new Promise(function(_0xc1469a,_0x2c9f4f){var _0x562cd7=new AWS['S3']({'accessKeyId':_0x342fdd,'secretAccessKey':_0x333994,'region':_0x220535});_0x562cd7[_0x081f('0x67')]({'Bucket':_0x3bacfb},function(_0x140917,_0x38bc5d){if(_0x140917){return _0x2c9f4f(_0x140917);}else{return _0xc1469a(_0x38bc5d);}});});}function uploadFile(_0x3a6969,_0x43bbaf,_0x2dde0c,_0x370678,_0x2fb8a1,_0x2cdc68){return new Promise(function(_0x4cb645,_0x3493a5){var _0x411ed3=new AWS['S3']({'accessKeyId':_0x43bbaf,'secretAccessKey':_0x3a6969,'region':_0x2dde0c});_0x411ed3[_0x081f('0x68')]({'Bucket':_0x370678,'Key':_0x2fb8a1,'Body':_0x2cdc68},function(_0x99e8e9,_0x3e492d){if(_0x99e8e9){return _0x3493a5(_0x99e8e9);}else{return _0x4cb645(_0x3e492d);}});});}function startTranscribe(_0x5dda17,_0x5ef94c,_0xaec1f4,_0x492059,_0x3867c0,_0x2ccc7a){return new Promise(function(_0xbe1279,_0x368804){var _0x487f52=new AWS[(_0x081f('0x69'))]({'accessKeyId':_0x5ef94c,'secretAccessKey':_0x5dda17,'region':_0xaec1f4});_0x487f52[_0x081f('0x6a')]({'TranscriptionJobName':_0x492059,'LanguageCode':_0x3867c0,'Media':{'MediaFileUri':_0x2ccc7a}},function(_0x4a5e8b,_0x216bd4){if(_0x4a5e8b){return _0x368804(_0x4a5e8b);}else{return _0xbe1279(_0x216bd4);}});});}function transcribe(_0x1009dd,_0x444634,_0x44daa5,_0x5873c1,_0x3c2862,_0x46c564,_0x3f953b){return new Promise(function(_0x325f8c,_0x48d77a){var _0x482724={};logger[_0x081f('0x61')](util['format'](_0x081f('0x6b'),_0x1009dd,_0x3c2862));return uploadFile(_0x444634,_0x44daa5,_0x5873c1,_0x3c2862,path[_0x081f('0x6c')](_0x46c564),fs[_0x081f('0x6d')](_0x46c564))[_0x081f('0x23')](function(_0x33cf7c){logger[_0x081f('0x61')](util[_0x081f('0x30')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x1009dd,_0x3c2862,_0x33cf7c[_0x081f('0x6e')]));_0x482724[_0x081f('0x6f')]=_0x33cf7c[_0x081f('0x70')];_0x482724[_0x081f('0x71')]=_0x33cf7c[_0x081f('0x6e')];logger['info'](util[_0x081f('0x30')](_0x081f('0x72'),_0x1009dd));return startTranscribe(_0x444634,_0x44daa5,_0x5873c1,uuidv4(),_0x3f953b,_0x33cf7c[_0x081f('0x6e')]);})['then'](function(_0x524fcd){logger['info'](util[_0x081f('0x30')](_0x081f('0x73'),_0x1009dd,_0x524fcd[_0x081f('0x74')][_0x081f('0x75')]));_0x482724['transcribeName']=_0x524fcd[_0x081f('0x74')]['TranscriptionJobName'];_0x482724[_0x081f('0x76')]=_0x524fcd[_0x081f('0x74')][_0x081f('0x77')];return _0x325f8c(_0x482724);})['catch'](function(_0x471429){return _0x48d77a(_0x471429);});});}exports['runTranscribe']=function(_0x5bac51,_0x2b20cc,_0x139cf6){var _0x195308;var _0x3518e6;var _0x2e2eaf;var _0x51f8c5=require(_0x081f('0x4b'));return db[_0x081f('0x2a')]['findOne']({'where':{'id':_0x5bac51['params']['id']}})[_0x081f('0x23')](function(_0x412087){if(_0x412087){var _0x3855b1=util['format']('%s.cypher',_0x412087[_0x081f('0x4c')]);if(fs['existsSync'](_0x3855b1)){cypher=!![];return _0x51f8c5[_0x081f('0x4f')](_0x3855b1,_0x412087[_0x081f('0x4c')],config['secrets'][_0x081f('0x50')])[_0x081f('0x23')](function(){return _0x412087;});}return _0x412087;}})[_0x081f('0x23')](function(_0x16958c){if(!_0x16958c){throw new db[(_0x081f('0x51'))]['ValidationError'](_0x081f('0x78'));}_0x3518e6=_0x16958c;return db[_0x081f('0x79')][_0x081f('0x7a')]({'where':{'id':0x1}});})[_0x081f('0x23')](handleEntityNotFound(_0x2b20cc,null))[_0x081f('0x23')](function(_0x2546d6){if(_0x2546d6){_0x195308=_0x2546d6;if(!_0x195308[_0x081f('0x7b')]||!_0x195308['transcribeAccountId']||!_0x195308[_0x081f('0x7c')]||!_0x195308[_0x081f('0x7d')]||!_0x195308['bucket']){throw new db[(_0x081f('0x51'))][(_0x081f('0x52'))](_0x081f('0x7e'));}if(_0x5bac51[_0x081f('0x46')][_0x081f('0x7f')]&&(!_0x195308[_0x081f('0x80')]||!_0x195308[_0x081f('0x81')]||!_0x195308[_0x081f('0x82')]||!_0x195308[_0x081f('0x7d')]||!_0x195308['bucket'])){throw new db[(_0x081f('0x51'))][(_0x081f('0x52'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x081f('0x83')][_0x081f('0x7a')]({'where':{'id':_0x195308[_0x081f('0x84')]}});}})[_0x081f('0x23')](function(_0x4743d3){if(!_0x4743d3){throw new db['Sequelize'][(_0x081f('0x52'))](_0x081f('0x85'));}if(!_0x4743d3[_0x081f('0x86')]||!_0x4743d3[_0x081f('0x87')]){throw new db[(_0x081f('0x51'))][(_0x081f('0x52'))]('Cloud\x20Provider\x20not\x20configured');}_0x2e2eaf=_0x4743d3;return getBucketslist(_0x2e2eaf[_0x081f('0x86')],_0x2e2eaf[_0x081f('0x87')],_0x195308[_0x081f('0x7c')]);})['then'](function(_0x2c1734){if(_0x2c1734&&_0x2c1734[_0x081f('0x88')]){var _0x38d117=_[_0x081f('0x48')](_0x2c1734['Buckets'],function(_0x360ecb){return _0x360ecb['Name']===_0x195308[_0x081f('0x6f')];});if(!_0x38d117){logger[_0x081f('0x61')](util[_0x081f('0x30')](_0x081f('0x89'),_0x5bac51[_0x081f('0x43')]['id'],_0x195308[_0x081f('0x6f')]));return createBucket(_0x2e2eaf[_0x081f('0x86')],_0x2e2eaf[_0x081f('0x87')],_0x195308['transcribeRegion'],_0x195308['bucket']);}logger[_0x081f('0x61')](util[_0x081f('0x30')](_0x081f('0x8a'),_0x5bac51[_0x081f('0x43')]['id'],_0x195308[_0x081f('0x6f')]));return;}})[_0x081f('0x23')](function(_0x48e2e2){if(_0x3518e6[_0x081f('0x76')]===_0x081f('0x8b')){return transcribe(_0x5bac51[_0x081f('0x43')]['id'],_0x2e2eaf[_0x081f('0x86')],_0x2e2eaf[_0x081f('0x87')],_0x195308['transcribeRegion'],_0x195308[_0x081f('0x6f')],_0x3518e6[_0x081f('0x4c')],_0x195308[_0x081f('0x7d')]);}else{logger[_0x081f('0x61')](util[_0x081f('0x30')](_0x081f('0x8c'),_0x5bac51[_0x081f('0x43')]['id']));return{'transcribeStatus':_0x081f('0x8d')};}})[_0x081f('0x23')](function(_0x1914ab){if(_0x1914ab){_0x1914ab[_0x081f('0x8e')]=_0x5bac51[_0x081f('0x46')][_0x081f('0x7f')];return _0x3518e6['updateAttributes'](_0x1914ab);}})[_0x081f('0x23')](respondWithResult(_0x2b20cc,null))[_0x081f('0x44')](handleError(_0x2b20cc,null));};function writeFile(_0xc83cdb,_0x2489f4){return new Promise(function(_0x23cf0,_0x144f06){fs['writeFile'](_0x2489f4,_0xc83cdb,function(_0xd4664b,_0x130c72){if(_0xd4664b){return _0x144f06(_0xd4664b);}else{return _0x23cf0(_0x130c72);}});});}exports[_0x081f('0x8f')]=function(_0x50e7d6,_0x1b0d9a,_0x4b2d3c){return db[_0x081f('0x2a')]['findOne']({'where':{'id':_0x50e7d6[_0x081f('0x43')]['id']}})[_0x081f('0x23')](handleEntityNotFound(_0x1b0d9a))['then'](function(_0x562de7){if(_0x562de7&&_0x562de7[_0x081f('0x90')]){var _0x1d735c=_0x562de7[_0x081f('0x90')];var _0x37d0e3=config[_0x081f('0x91')]+_0x081f('0x92')+_0x562de7['id']+_0x081f('0x93');if(fs[_0x081f('0x4e')](_0x37d0e3)){return _0x37d0e3;}return writeFile(_0x1d735c,_0x37d0e3)[_0x081f('0x23')](function(){return _0x37d0e3;});}else{throw new db['Sequelize'][(_0x081f('0x52'))]('Transcript\x20not\x20available');}})['then'](function(_0x19befe){return _0x1b0d9a[_0x081f('0x4a')](_0x19befe);})[_0x081f('0x44')](handleError(_0x1b0d9a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 7f64aaf..9d9d327 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 _0x2e65=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0x2e65,0x193));var _0x52e6=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x2e65[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var logger=require(_0x52e6('0x2'))(_0x52e6('0x3'));var moment=require(_0x52e6('0x4'));var BPromise=require(_0x52e6('0x5'));var rp=require(_0x52e6('0x6'));var fs=require('fs');var path=require(_0x52e6('0x7'));var rimraf=require('rimraf');var config=require(_0x52e6('0x8'));var attributes=require(_0x52e6('0x9'));module[_0x52e6('0xa')]=function(_0xe67caa,_0x1cf6d2){return _0xe67caa[_0x52e6('0xb')](_0x52e6('0xc'),attributes,{'tableName':_0x52e6('0xd'),'paranoid':![],'indexes':[{'name':_0x52e6('0xe'),'fields':[_0x52e6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid'];(function(_0x5b68b3,_0x2ed81a){var _0x49d158=function(_0xb2531d){while(--_0xb2531d){_0x5b68b3['push'](_0x5b68b3['shift']());}};_0x49d158(++_0x2ed81a);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0xfcf0[_0x2dc7c9];return _0x3e6536;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('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 240ac35..d0b44cb 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(_0x197837,_0x439ae2){var _0x3eed5f=function(_0x4cb7da){while(--_0x4cb7da){_0x197837['push'](_0x197837['shift']());}};_0x3eed5f(++_0x439ae2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x22dbd1,_0x47e0bb){var _0x50a4fd=function(_0x5cadf4){while(--_0x5cadf4){_0x22dbd1['push'](_0x22dbd1['shift']());}};_0x50a4fd(++_0x47e0bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 e9796d1..2f23c8e 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 _0xdbf5=['index','/:id','show','put','update','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x417534,_0x59d401){var _0xfe2f8a=function(_0x2b9286){while(--_0x2b9286){_0x417534['push'](_0x417534['shift']());}};_0xfe2f8a(++_0x59d401);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4c11b0,_0x347de0){_0x4c11b0=_0x4c11b0-0x0;var _0x58c3b4=_0xdbf5[_0x4c11b0];return _0x58c3b4;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['post']('/',auth[_0x5dbf('0x8')](),controller['create']);router[_0x5dbf('0xc')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xd')]);router['delete'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5dbf('0xe')]=router; \ No newline at end of file +var _0x01d9=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5e2c70,_0x108e64){var _0x1e6cbc=function(_0x46e5fd){while(--_0x46e5fd){_0x5e2c70['push'](_0x5e2c70['shift']());}};_0x1e6cbc(++_0x108e64);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var auth=require(_0x901d('0x5'));var interaction=require(_0x901d('0x6'));var config=require(_0x901d('0x7'));var controller=require(_0x901d('0x8'));router[_0x901d('0x9')]('/',auth[_0x901d('0xa')](),controller['index']);router[_0x901d('0x9')](_0x901d('0xb'),auth[_0x901d('0xa')](),controller[_0x901d('0xc')]);router[_0x901d('0xd')]('/',auth[_0x901d('0xa')](),controller[_0x901d('0xe')]);router[_0x901d('0xf')](_0x901d('0xb'),auth[_0x901d('0xa')](),controller[_0x901d('0x10')]);router[_0x901d('0x11')](_0x901d('0xb'),auth['isAuthenticated'](),controller[_0x901d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 3b520cc..75bf267 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 _0xe54c=['exports','ENUM','attended','STRING','Yes','moment'];(function(_0x42c939,_0x2a2e64){var _0x21cd7f=function(_0x5481da){while(--_0x5481da){_0x42c939['push'](_0x42c939['shift']());}};_0x21cd7f(++_0x2a2e64);}(_0xe54c,0x11f));var _0xce54=function(_0x2ca0cf,_0x2f56c3){_0x2ca0cf=_0x2ca0cf-0x0;var _0x12e852=_0xe54c[_0x2ca0cf];return _0x12e852;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xce54('0x0'));module[_0xce54('0x1')]={'type':{'type':Sequelize[_0xce54('0x2')]('blind',_0xce54('0x3'))},'result':{'type':Sequelize[_0xce54('0x4')]},'transfererchannel':{'type':Sequelize[_0xce54('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xce54('0x4')]},'transferercalleridname':{'type':Sequelize[_0xce54('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xce54('0x4')]},'transfererexten':{'type':Sequelize[_0xce54('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xce54('0x4')]},'transfereechannel':{'type':Sequelize[_0xce54('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xce54('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xce54('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xce54('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xce54('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xce54('0x4')]},'transfereecontext':{'type':Sequelize[_0xce54('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xce54('0x4')]},'isexternal':{'type':Sequelize[_0xce54('0x2')](_0xce54('0x5'),'No')},'context':{'type':Sequelize[_0xce54('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc2fb=['attended','STRING','Yes','sequelize','moment','ENUM','blind'];(function(_0x382797,_0x5f3579){var _0x433e49=function(_0x4dea7d){while(--_0x4dea7d){_0x382797['push'](_0x382797['shift']());}};_0x433e49(++_0x5f3579);}(_0xc2fb,0xab));var _0xbc2f=function(_0x45c05c,_0x4ec2ab){_0x45c05c=_0x45c05c-0x0;var _0x46e5d5=_0xc2fb[_0x45c05c];return _0x46e5d5;};'use strict';var Sequelize=require(_0xbc2f('0x0'));var moment=require(_0xbc2f('0x1'));module['exports']={'type':{'type':Sequelize[_0xbc2f('0x2')](_0xbc2f('0x3'),_0xbc2f('0x4'))},'result':{'type':Sequelize[_0xbc2f('0x5')]},'transfererchannel':{'type':Sequelize[_0xbc2f('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xbc2f('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xbc2f('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xbc2f('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xbc2f('0x5')]},'transfererexten':{'type':Sequelize[_0xbc2f('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xbc2f('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xbc2f('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbc2f('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xbc2f('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xbc2f('0x5')]},'transfereecontext':{'type':Sequelize[_0xbc2f('0x5')]},'transfereeexten':{'type':Sequelize[_0xbc2f('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0xbc2f('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xbc2f('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index b540b47..29e4772 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 _0xfdec=['sort','where','filters','pick','filter','merge','options','include','catch','params','length','includeAll','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','json','apply','update','then','error','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','limit','order'];(function(_0x32ef38,_0x126f8f){var _0x552e43=function(_0x36ec91){while(--_0x36ec91){_0x32ef38['push'](_0x32ef38['shift']());}};_0x552e43(++_0x126f8f);}(_0xfdec,0x98));var _0xcfde=function(_0xa89c3e,_0x144268){_0xa89c3e=_0xa89c3e-0x0;var _0x48072f=_0xfdec[_0xa89c3e];return _0x48072f;};'use strict';var pdf=require(_0xcfde('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcfde('0x1'));var zipdir=require(_0xcfde('0x2'));var jsonpatch=require(_0xcfde('0x3'));var rp=require('request-promise');var moment=require(_0xcfde('0x4'));var BPromise=require(_0xcfde('0x5'));var Mustache=require(_0xcfde('0x6'));var util=require(_0xcfde('0x7'));var path=require(_0xcfde('0x8'));var sox=require(_0xcfde('0x9'));var csv=require(_0xcfde('0xa'));var ejs=require(_0xcfde('0xb'));var fs=require('fs');var _=require(_0xcfde('0xc'));var squel=require(_0xcfde('0xd'));var crypto=require(_0xcfde('0xe'));var jsforce=require(_0xcfde('0xf'));var deskjs=require(_0xcfde('0x10'));var toCsv=require(_0xcfde('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcfde('0x11'));var authService=require(_0xcfde('0x12'));var qs=require(_0xcfde('0x13'));var as=require(_0xcfde('0x14'));var hardwareService=require(_0xcfde('0x15'));var logger=require(_0xcfde('0x16'))('api');var utils=require(_0xcfde('0x17'));var config=require('../../config/environment');var db=require(_0xcfde('0x18'))['db'];function respondWithStatusCode(_0x5a9f8f,_0x52ee92){_0x52ee92=_0x52ee92||0xcc;return function(_0x1abb88){if(_0x1abb88){return _0x5a9f8f[_0xcfde('0x19')](_0x52ee92);}return _0x5a9f8f['status'](_0x52ee92)[_0xcfde('0x1a')]();};}function respondWithResult(_0x2613b1,_0x1259e0){_0x1259e0=_0x1259e0||0xc8;return function(_0x1a3512){if(_0x1a3512){return _0x2613b1[_0xcfde('0x1b')](_0x1259e0)['json'](_0x1a3512);}};}function respondWithFilteredResult(_0x4421e4,_0x31f385){return function(_0x3871f6){if(_0x3871f6){var _0x3b3be4=_0x3871f6[_0xcfde('0x1c')],_0x4b83ab=_0x31f385[_0xcfde('0x1d')],_0x2e7924=_0x31f385['offset']+_0x31f385['limit'],_0xb4959;if(_0x2e7924>=_0x3b3be4){_0x2e7924=_0x3b3be4;_0xb4959=0xc8;}else{_0xb4959=0xce;}_0x4421e4['status'](_0xb4959);return _0x4421e4['set'](_0xcfde('0x1e'),_0x4b83ab+'-'+_0x2e7924+'/'+_0x3b3be4)[_0xcfde('0x1f')](_0x3871f6);}return null;};}function patchUpdates(_0x547566){return function(_0x5e5625){try{jsonpatch[_0xcfde('0x20')](_0x5e5625,_0x547566,!![]);}catch(_0xf6b3f3){return BPromise['reject'](_0xf6b3f3);}return _0x5e5625['save']();};}function saveUpdates(_0x3e2f76,_0x23c5fe){return function(_0x160a2c){if(_0x160a2c){return _0x160a2c[_0xcfde('0x21')](_0x3e2f76)[_0xcfde('0x22')](function(_0x30deb5){return _0x30deb5;});}return null;};}function removeEntity(_0x301fde,_0x50f496){return function(_0x2ed64b){if(_0x2ed64b){return _0x2ed64b['destroy']()[_0xcfde('0x22')](function(){_0x301fde[_0xcfde('0x1b')](0xcc)[_0xcfde('0x1a')]();});}};}function handleEntityNotFound(_0xb1f304,_0x36e125){return function(_0x503375){if(!_0x503375){_0xb1f304[_0xcfde('0x19')](0x194);}return _0x503375;};}function handleError(_0x559a8b,_0x183632){_0x183632=_0x183632||0x1f4;return function(_0x4a347c){logger[_0xcfde('0x23')](_0x4a347c['stack']);if(_0x4a347c[_0xcfde('0x24')]){delete _0x4a347c[_0xcfde('0x24')];}_0x559a8b[_0xcfde('0x1b')](_0x183632)[_0xcfde('0x25')](_0x4a347c);};}exports['index']=function(_0x36c864,_0x4fe081){var _0x46901e={},_0x578761={},_0x53f967={'count':0x0,'rows':[]};var _0x2005b4=_[_0xcfde('0x26')](db[_0xcfde('0x27')][_0xcfde('0x28')],function(_0x4882a8){return{'name':_0x4882a8[_0xcfde('0x29')],'type':_0x4882a8[_0xcfde('0x2a')]['key']};});_0x578761['model']=_[_0xcfde('0x26')](_0x2005b4,_0xcfde('0x24'));_0x578761[_0xcfde('0x2b')]=_[_0xcfde('0x2c')](_0x36c864['query']);_0x578761['filters']=_[_0xcfde('0x2d')](_0x578761[_0xcfde('0x2e')],_0x578761[_0xcfde('0x2b')]);_0x46901e[_0xcfde('0x2f')]=_['intersection'](_0x578761[_0xcfde('0x2e')],qs[_0xcfde('0x30')](_0x36c864['query']['fields']));_0x46901e[_0xcfde('0x2f')]=_0x46901e[_0xcfde('0x2f')]['length']?_0x46901e['attributes']:_0x578761['model'];if(!_0x36c864[_0xcfde('0x2b')][_0xcfde('0x31')]('nolimit')){_0x46901e[_0xcfde('0x32')]=qs[_0xcfde('0x32')](_0x36c864['query'][_0xcfde('0x32')]);_0x46901e[_0xcfde('0x1d')]=qs['offset'](_0x36c864[_0xcfde('0x2b')][_0xcfde('0x1d')]);}_0x46901e[_0xcfde('0x33')]=qs[_0xcfde('0x34')](_0x36c864[_0xcfde('0x2b')][_0xcfde('0x34')]);_0x46901e[_0xcfde('0x35')]=qs[_0xcfde('0x36')](_[_0xcfde('0x37')](_0x36c864['query'],_0x578761['filters']),_0x2005b4);if(_0x36c864[_0xcfde('0x2b')][_0xcfde('0x38')]){_0x46901e[_0xcfde('0x35')]=_['merge'](_0x46901e[_0xcfde('0x35')],{'$or':_[_0xcfde('0x26')](_0x2005b4,function(_0x42b277){if(_0x42b277[_0xcfde('0x2a')]!=='VIRTUAL'){var _0x2c0487={};_0x2c0487[_0x42b277[_0xcfde('0x24')]]={'$like':'%'+_0x36c864[_0xcfde('0x2b')][_0xcfde('0x38')]+'%'};return _0x2c0487;}})});}_0x46901e=_[_0xcfde('0x39')]({},_0x46901e,_0x36c864[_0xcfde('0x3a')]);var _0x4033f7={'where':_0x46901e[_0xcfde('0x35')]};return db[_0xcfde('0x27')][_0xcfde('0x1c')](_0x4033f7)[_0xcfde('0x22')](function(_0x4330db){_0x53f967[_0xcfde('0x1c')]=_0x4330db;if(_0x36c864[_0xcfde('0x2b')]['includeAll']){_0x46901e[_0xcfde('0x3b')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x46901e);})[_0xcfde('0x22')](function(_0x231f11){_0x53f967['rows']=_0x231f11;return _0x53f967;})[_0xcfde('0x22')](respondWithFilteredResult(_0x4fe081,_0x46901e))[_0xcfde('0x3c')](handleError(_0x4fe081,null));};exports['show']=function(_0x4c0f5c,_0x80cf6a){var _0x51b7f7={'raw':!![],'where':{'id':_0x4c0f5c[_0xcfde('0x3d')]['id']}},_0xb6ea92={};_0xb6ea92[_0xcfde('0x2e')]=_['keys'](db[_0xcfde('0x27')][_0xcfde('0x28')]);_0xb6ea92[_0xcfde('0x2b')]=_['keys'](_0x4c0f5c[_0xcfde('0x2b')]);_0xb6ea92['filters']=_[_0xcfde('0x2d')](_0xb6ea92[_0xcfde('0x2e')],_0xb6ea92['query']);_0x51b7f7['attributes']=_[_0xcfde('0x2d')](_0xb6ea92[_0xcfde('0x2e')],qs['fields'](_0x4c0f5c[_0xcfde('0x2b')][_0xcfde('0x30')]));_0x51b7f7[_0xcfde('0x2f')]=_0x51b7f7[_0xcfde('0x2f')][_0xcfde('0x3e')]?_0x51b7f7[_0xcfde('0x2f')]:_0xb6ea92[_0xcfde('0x2e')];if(_0x4c0f5c[_0xcfde('0x2b')][_0xcfde('0x3f')]){_0x51b7f7['include']=[{'all':!![]}];}_0x51b7f7=_[_0xcfde('0x39')]({},_0x51b7f7,_0x4c0f5c[_0xcfde('0x3a')]);return db[_0xcfde('0x27')][_0xcfde('0x40')](_0x51b7f7)['then'](handleEntityNotFound(_0x80cf6a,null))['then'](respondWithResult(_0x80cf6a,null))['catch'](handleError(_0x80cf6a,null));};exports[_0xcfde('0x41')]=function(_0x11fd9d,_0x3219f9){return db['VoiceTransferReport'][_0xcfde('0x41')](_0x11fd9d[_0xcfde('0x42')],{})['then'](respondWithResult(_0x3219f9,0xc9))['catch'](handleError(_0x3219f9,null));};exports[_0xcfde('0x21')]=function(_0x389c4e,_0x9b0ddd){if(_0x389c4e[_0xcfde('0x42')]['id']){delete _0x389c4e['body']['id'];}return db[_0xcfde('0x27')][_0xcfde('0x40')]({'where':{'id':_0x389c4e[_0xcfde('0x3d')]['id']}})['then'](handleEntityNotFound(_0x9b0ddd,null))[_0xcfde('0x22')](saveUpdates(_0x389c4e[_0xcfde('0x42')],null))[_0xcfde('0x22')](respondWithResult(_0x9b0ddd,null))['catch'](handleError(_0x9b0ddd,null));};exports[_0xcfde('0x43')]=function(_0x3ffd55,_0x35b9d9){return db['VoiceTransferReport']['find']({'where':{'id':_0x3ffd55['params']['id']}})[_0xcfde('0x22')](handleEntityNotFound(_0x35b9d9,null))[_0xcfde('0x22')](removeEntity(_0x35b9d9,null))[_0xcfde('0x3c')](handleError(_0x35b9d9,null));}; \ No newline at end of file +var _0x0b02=['find','catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','count','limit','status','Content-Range','apply','save','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','options','includeAll','include','VoiceTransferReport','rows','show','params'];(function(_0x4dc408,_0x491304){var _0x531dda=function(_0x44ae0d){while(--_0x44ae0d){_0x4dc408['push'](_0x4dc408['shift']());}};_0x531dda(++_0x491304);}(_0x0b02,0x1c4));var _0x20b0=function(_0x5c330e,_0x2f79b0){_0x5c330e=_0x5c330e-0x0;var _0x115de5=_0x0b02[_0x5c330e];return _0x115de5;};'use strict';var pdf=require(_0x20b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x20b0('0x1'));var zipdir=require(_0x20b0('0x2'));var jsonpatch=require(_0x20b0('0x3'));var rp=require('request-promise');var moment=require(_0x20b0('0x4'));var BPromise=require(_0x20b0('0x5'));var Mustache=require(_0x20b0('0x6'));var util=require('util');var path=require('path');var sox=require(_0x20b0('0x7'));var csv=require(_0x20b0('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x20b0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x20b0('0xa'));var toCsv=require('to-csv');var querystring=require(_0x20b0('0xb'));var Papa=require('papaparse');var Redis=require(_0x20b0('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x20b0('0xd'));var as=require(_0x20b0('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20b0('0xf'))('api');var utils=require(_0x20b0('0x10'));var config=require(_0x20b0('0x11'));var db=require(_0x20b0('0x12'))['db'];function respondWithStatusCode(_0x34c80b,_0x695585){_0x695585=_0x695585||0xcc;return function(_0x150bb4){if(_0x150bb4){return _0x34c80b['sendStatus'](_0x695585);}return _0x34c80b['status'](_0x695585)[_0x20b0('0x13')]();};}function respondWithResult(_0x3446e8,_0x2f2d5c){_0x2f2d5c=_0x2f2d5c||0xc8;return function(_0x37314){if(_0x37314){return _0x3446e8['status'](_0x2f2d5c)[_0x20b0('0x14')](_0x37314);}};}function respondWithFilteredResult(_0x2459e9,_0x2f223a){return function(_0x253f3c){if(_0x253f3c){var _0x3471e7=_0x253f3c[_0x20b0('0x15')],_0x19294b=_0x2f223a['offset'],_0x23feb5=_0x2f223a['offset']+_0x2f223a[_0x20b0('0x16')],_0x1a07e3;if(_0x23feb5>=_0x3471e7){_0x23feb5=_0x3471e7;_0x1a07e3=0xc8;}else{_0x1a07e3=0xce;}_0x2459e9[_0x20b0('0x17')](_0x1a07e3);return _0x2459e9['set'](_0x20b0('0x18'),_0x19294b+'-'+_0x23feb5+'/'+_0x3471e7)[_0x20b0('0x14')](_0x253f3c);}return null;};}function patchUpdates(_0x14698e){return function(_0xbb344c){try{jsonpatch[_0x20b0('0x19')](_0xbb344c,_0x14698e,!![]);}catch(_0x1ac9dd){return BPromise['reject'](_0x1ac9dd);}return _0xbb344c[_0x20b0('0x1a')]();};}function saveUpdates(_0x2bd61c,_0x5a5436){return function(_0x18741e){if(_0x18741e){return _0x18741e['update'](_0x2bd61c)[_0x20b0('0x1b')](function(_0x3474e9){return _0x3474e9;});}return null;};}function removeEntity(_0x57c199,_0x31a01d){return function(_0xcdf50e){if(_0xcdf50e){return _0xcdf50e['destroy']()[_0x20b0('0x1b')](function(){_0x57c199['status'](0xcc)[_0x20b0('0x13')]();});}};}function handleEntityNotFound(_0x1ea54c,_0x3ee4af){return function(_0x50470d){if(!_0x50470d){_0x1ea54c[_0x20b0('0x1c')](0x194);}return _0x50470d;};}function handleError(_0x2a1b79,_0x18816e){_0x18816e=_0x18816e||0x1f4;return function(_0x30e5bb){logger[_0x20b0('0x1d')](_0x30e5bb['stack']);if(_0x30e5bb[_0x20b0('0x1e')]){delete _0x30e5bb['name'];}_0x2a1b79[_0x20b0('0x17')](_0x18816e)[_0x20b0('0x1f')](_0x30e5bb);};}exports[_0x20b0('0x20')]=function(_0x390d9a,_0x22a99d){var _0x2d3cd1={},_0x47f255={},_0x1b5df1={'count':0x0,'rows':[]};var _0x3faa61=_[_0x20b0('0x21')](db['VoiceTransferReport'][_0x20b0('0x22')],function(_0x5d07be){return{'name':_0x5d07be[_0x20b0('0x23')],'type':_0x5d07be['type']['key']};});_0x47f255[_0x20b0('0x24')]=_[_0x20b0('0x21')](_0x3faa61,_0x20b0('0x1e'));_0x47f255[_0x20b0('0x25')]=_[_0x20b0('0x26')](_0x390d9a[_0x20b0('0x25')]);_0x47f255[_0x20b0('0x27')]=_[_0x20b0('0x28')](_0x47f255[_0x20b0('0x24')],_0x47f255[_0x20b0('0x25')]);_0x2d3cd1[_0x20b0('0x29')]=_[_0x20b0('0x28')](_0x47f255[_0x20b0('0x24')],qs['fields'](_0x390d9a[_0x20b0('0x25')][_0x20b0('0x2a')]));_0x2d3cd1[_0x20b0('0x29')]=_0x2d3cd1[_0x20b0('0x29')][_0x20b0('0x2b')]?_0x2d3cd1[_0x20b0('0x29')]:_0x47f255['model'];if(!_0x390d9a[_0x20b0('0x25')][_0x20b0('0x2c')](_0x20b0('0x2d'))){_0x2d3cd1[_0x20b0('0x16')]=qs[_0x20b0('0x16')](_0x390d9a[_0x20b0('0x25')][_0x20b0('0x16')]);_0x2d3cd1[_0x20b0('0x2e')]=qs['offset'](_0x390d9a[_0x20b0('0x25')][_0x20b0('0x2e')]);}_0x2d3cd1[_0x20b0('0x2f')]=qs[_0x20b0('0x30')](_0x390d9a['query'][_0x20b0('0x30')]);_0x2d3cd1[_0x20b0('0x31')]=qs[_0x20b0('0x27')](_[_0x20b0('0x32')](_0x390d9a[_0x20b0('0x25')],_0x47f255[_0x20b0('0x27')]),_0x3faa61);if(_0x390d9a['query']['filter']){_0x2d3cd1['where']=_[_0x20b0('0x33')](_0x2d3cd1[_0x20b0('0x31')],{'$or':_[_0x20b0('0x21')](_0x3faa61,function(_0x173f90){if(_0x173f90['type']!=='VIRTUAL'){var _0xcf28ac={};_0xcf28ac[_0x173f90[_0x20b0('0x1e')]]={'$like':'%'+_0x390d9a[_0x20b0('0x25')][_0x20b0('0x34')]+'%'};return _0xcf28ac;}})});}_0x2d3cd1=_[_0x20b0('0x33')]({},_0x2d3cd1,_0x390d9a[_0x20b0('0x35')]);var _0x3d458a={'where':_0x2d3cd1[_0x20b0('0x31')]};return db['VoiceTransferReport'][_0x20b0('0x15')](_0x3d458a)[_0x20b0('0x1b')](function(_0x1c08f5){_0x1b5df1[_0x20b0('0x15')]=_0x1c08f5;if(_0x390d9a[_0x20b0('0x25')][_0x20b0('0x36')]){_0x2d3cd1[_0x20b0('0x37')]=[{'all':!![]}];}return db[_0x20b0('0x38')]['findAll'](_0x2d3cd1);})['then'](function(_0x125223){_0x1b5df1[_0x20b0('0x39')]=_0x125223;return _0x1b5df1;})[_0x20b0('0x1b')](respondWithFilteredResult(_0x22a99d,_0x2d3cd1))['catch'](handleError(_0x22a99d,null));};exports[_0x20b0('0x3a')]=function(_0x3a4439,_0x59dc95){var _0x522dc4={'raw':!![],'where':{'id':_0x3a4439[_0x20b0('0x3b')]['id']}},_0x2f0daa={};_0x2f0daa[_0x20b0('0x24')]=_[_0x20b0('0x26')](db[_0x20b0('0x38')]['rawAttributes']);_0x2f0daa[_0x20b0('0x25')]=_[_0x20b0('0x26')](_0x3a4439[_0x20b0('0x25')]);_0x2f0daa[_0x20b0('0x27')]=_[_0x20b0('0x28')](_0x2f0daa[_0x20b0('0x24')],_0x2f0daa[_0x20b0('0x25')]);_0x522dc4[_0x20b0('0x29')]=_[_0x20b0('0x28')](_0x2f0daa[_0x20b0('0x24')],qs[_0x20b0('0x2a')](_0x3a4439[_0x20b0('0x25')][_0x20b0('0x2a')]));_0x522dc4[_0x20b0('0x29')]=_0x522dc4[_0x20b0('0x29')][_0x20b0('0x2b')]?_0x522dc4[_0x20b0('0x29')]:_0x2f0daa[_0x20b0('0x24')];if(_0x3a4439['query'][_0x20b0('0x36')]){_0x522dc4['include']=[{'all':!![]}];}_0x522dc4=_[_0x20b0('0x33')]({},_0x522dc4,_0x3a4439['options']);return db['VoiceTransferReport'][_0x20b0('0x3c')](_0x522dc4)[_0x20b0('0x1b')](handleEntityNotFound(_0x59dc95,null))[_0x20b0('0x1b')](respondWithResult(_0x59dc95,null))[_0x20b0('0x3d')](handleError(_0x59dc95,null));};exports[_0x20b0('0x3e')]=function(_0x1ed364,_0x25c641){return db[_0x20b0('0x38')]['create'](_0x1ed364[_0x20b0('0x3f')],{})[_0x20b0('0x1b')](respondWithResult(_0x25c641,0xc9))[_0x20b0('0x3d')](handleError(_0x25c641,null));};exports['update']=function(_0x487c24,_0x246df1){if(_0x487c24['body']['id']){delete _0x487c24[_0x20b0('0x3f')]['id'];}return db[_0x20b0('0x38')]['find']({'where':{'id':_0x487c24['params']['id']}})[_0x20b0('0x1b')](handleEntityNotFound(_0x246df1,null))[_0x20b0('0x1b')](saveUpdates(_0x487c24[_0x20b0('0x3f')],null))[_0x20b0('0x1b')](respondWithResult(_0x246df1,null))[_0x20b0('0x3d')](handleError(_0x246df1,null));};exports['destroy']=function(_0x1e0aec,_0x46e375){return db[_0x20b0('0x38')][_0x20b0('0x3c')]({'where':{'id':_0x1e0aec[_0x20b0('0x3b')]['id']}})[_0x20b0('0x1b')](handleEntityNotFound(_0x46e375,null))['then'](removeEntity(_0x46e375,null))[_0x20b0('0x3d')](handleError(_0x46e375,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ad0c086..ee2b3cb 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 _0x0699=['report_call_transfer','../../config/logger','api','moment','path','rimraf','../../config/environment','define'];(function(_0x36ae06,_0x57da2d){var _0x25ffc7=function(_0x38be3a){while(--_0x38be3a){_0x36ae06['push'](_0x36ae06['shift']());}};_0x25ffc7(++_0x57da2d);}(_0x0699,0x129));var _0x9069=function(_0x19e6bd,_0x15a963){_0x19e6bd=_0x19e6bd-0x0;var _0x4d0e8e=_0x0699[_0x19e6bd];return _0x4d0e8e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9069('0x0'))(_0x9069('0x1'));var moment=require(_0x9069('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9069('0x3'));var rimraf=require(_0x9069('0x4'));var config=require(_0x9069('0x5'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x452690,_0x28cdc9){return _0x452690[_0x9069('0x6')]('VoiceTransferReport',attributes,{'tableName':_0x9069('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa25=['path','rimraf','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x248c9d,_0x327180){var _0x5a2265=function(_0x215ade){while(--_0x215ade){_0x248c9d['push'](_0x248c9d['shift']());}};_0x5a2265(++_0x327180);}(_0xfa25,0x14f));var _0x5fa2=function(_0x248494,_0x100821){_0x248494=_0x248494-0x0;var _0x55856f=_0xfa25[_0x248494];return _0x55856f;};'use strict';var _=require(_0x5fa2('0x0'));var util=require(_0x5fa2('0x1'));var logger=require(_0x5fa2('0x2'))(_0x5fa2('0x3'));var moment=require(_0x5fa2('0x4'));var BPromise=require('bluebird');var rp=require(_0x5fa2('0x5'));var fs=require('fs');var path=require(_0x5fa2('0x6'));var rimraf=require(_0x5fa2('0x7'));var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x3e6403,_0x3cda81){return _0x3e6403[_0x5fa2('0x8')](_0x5fa2('0x9'),attributes,{'tableName':_0x5fa2('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 2e6398f..178bda5 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 _0x09e4=['message','catch','VoiceTransferReport,\x20%s,\x20%s','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','info','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','stringify','error'];(function(_0xaf2425,_0xbb7aa3){var _0x1a2890=function(_0x2fb53a){while(--_0x2fb53a){_0xaf2425['push'](_0xaf2425['shift']());}};_0x1a2890(++_0xbb7aa3);}(_0x09e4,0x177));var _0x409e=function(_0x4f79b8,_0x3f14f5){_0x4f79b8=_0x4f79b8-0x0;var _0x458dfe=_0x09e4[_0x4f79b8];return _0x458dfe;};'use strict';var _=require(_0x409e('0x0'));var util=require(_0x409e('0x1'));var moment=require(_0x409e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x409e('0x3'));var db=require(_0x409e('0x4'))['db'];var utils=require(_0x409e('0x5'));var logger=require(_0x409e('0x6'))('rpc');var config=require(_0x409e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x409e('0x8')][_0x409e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x357ef7,_0x5b892c,_0x1a0e3d){return new BPromise(function(_0x366004,_0xd87d83){return client[_0x409e('0xa')](_0x357ef7,_0x1a0e3d)[_0x409e('0xb')](function(_0x5ceb38){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5b892c,_0x409e('0xc'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5b892c,'request\x20sent',JSON[_0x409e('0xd')](_0x5ceb38));if(_0x5ceb38[_0x409e('0xe')]){if(_0x5ceb38['error']['code']===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x5b892c,_0x5ceb38[_0x409e('0xe')][_0x409e('0xf')]);return _0xd87d83(_0x5ceb38['error'][_0x409e('0xf')]);}logger[_0x409e('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x5b892c,_0x5ceb38[_0x409e('0xe')]['message']);return _0x366004(_0x5ceb38[_0x409e('0xe')][_0x409e('0xf')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5b892c,_0x409e('0xc'));_0x366004(_0x5ceb38['result']['message']);}})[_0x409e('0x10')](function(_0x3480fd){logger['error'](_0x409e('0x11'),_0x5b892c,_0x3480fd);_0xd87d83(_0x3480fd);});});}exports[_0x409e('0x12')]=function(_0x824155){var _0x332820=this;return new Promise(function(_0x2babd7,_0x58599d){return db[_0x409e('0x13')][_0x409e('0x14')](_0x824155[_0x409e('0x15')],{'raw':_0x824155[_0x409e('0x16')]?_0x824155[_0x409e('0x16')][_0x409e('0x17')]===undefined?!![]:![]:!![]})[_0x409e('0xb')](function(_0x342925){logger[_0x409e('0x18')](_0x409e('0x12'),_0x824155);logger[_0x409e('0x19')](_0x409e('0x12'),_0x824155,JSON[_0x409e('0xd')](_0x342925));_0x2babd7(_0x342925);})[_0x409e('0x10')](function(_0x2f0af6){logger[_0x409e('0xe')](_0x409e('0x12'),_0x2f0af6[_0x409e('0xf')],_0x824155);_0x58599d(_0x332820['error'](0x1f4,_0x2f0af6[_0x409e('0xf')]));});});}; \ No newline at end of file +var _0x7421=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','CreateVoiceTransferReport','create','body','options','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7421,0x1aa));var _0x1742=function(_0x5d3d59,_0x20e288){_0x5d3d59=_0x5d3d59-0x0;var _0x278def=_0x7421[_0x5d3d59];return _0x278def;};'use strict';var _=require('lodash');var util=require(_0x1742('0x0'));var moment=require(_0x1742('0x1'));var BPromise=require(_0x1742('0x2'));var rs=require(_0x1742('0x3'));var fs=require('fs');var Redis=require(_0x1742('0x4'));var db=require(_0x1742('0x5'))['db'];var utils=require(_0x1742('0x6'));var logger=require(_0x1742('0x7'))('rpc');var config=require(_0x1742('0x8'));var jayson=require(_0x1742('0x9'));var client=jayson[_0x1742('0xa')][_0x1742('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cbdf8,_0x9b31b4,_0x312e3f){return new BPromise(function(_0x103835,_0x180461){return client[_0x1742('0xc')](_0x4cbdf8,_0x312e3f)[_0x1742('0xd')](function(_0x57ebd3){logger[_0x1742('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x9b31b4,_0x1742('0xf'));logger[_0x1742('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x9b31b4,_0x1742('0xf'),JSON[_0x1742('0x11')](_0x57ebd3));if(_0x57ebd3[_0x1742('0x12')]){if(_0x57ebd3['error'][_0x1742('0x13')]===0x1f4){logger[_0x1742('0x12')](_0x1742('0x14'),_0x9b31b4,_0x57ebd3[_0x1742('0x12')][_0x1742('0x15')]);return _0x180461(_0x57ebd3['error'][_0x1742('0x15')]);}logger['error'](_0x1742('0x14'),_0x9b31b4,_0x57ebd3[_0x1742('0x12')][_0x1742('0x15')]);return _0x103835(_0x57ebd3['error']['message']);}else{logger[_0x1742('0xe')](_0x1742('0x14'),_0x9b31b4,'request\x20sent');_0x103835(_0x57ebd3['result']['message']);}})['catch'](function(_0x167e54){logger[_0x1742('0x12')](_0x1742('0x14'),_0x9b31b4,_0x167e54);_0x180461(_0x167e54);});});}exports[_0x1742('0x16')]=function(_0x224859){var _0x155396=this;return new Promise(function(_0x48f68d,_0x2ef763){return db['VoiceTransferReport'][_0x1742('0x17')](_0x224859[_0x1742('0x18')],{'raw':_0x224859['options']?_0x224859[_0x1742('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2f2ee6){logger[_0x1742('0xe')](_0x1742('0x16'),_0x224859);logger[_0x1742('0x10')]('CreateVoiceTransferReport',_0x224859,JSON[_0x1742('0x11')](_0x2f2ee6));_0x48f68d(_0x2f2ee6);})[_0x1742('0x1a')](function(_0x16f9d5){logger[_0x1742('0x12')](_0x1742('0x16'),_0x16f9d5[_0x1742('0x15')],_0x224859);_0x2ef763(_0x155396[_0x1742('0x12')](0x1f4,_0x16f9d5[_0x1742('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a0d54d8..968b6d9 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 _0x4f17=['./webbar.controller','/originate','isAuthenticated','canUpdate','originate','post','answer','/hold','/unhold','unhold','/calls','calls','/transfer','exports','express','../../components/auth/service'];(function(_0x576bbf,_0x37b324){var _0x46e1fb=function(_0x575565){while(--_0x575565){_0x576bbf['push'](_0x576bbf['shift']());}};_0x46e1fb(++_0x37b324);}(_0x4f17,0x9e));var _0x74f1=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0x4f17[_0x3902c1];return _0x1266cc;};'use strict';var express=require(_0x74f1('0x0'));var router=express['Router']();var auth=require(_0x74f1('0x1'));var controller=require(_0x74f1('0x2'));router['post'](_0x74f1('0x3'),auth[_0x74f1('0x4')](),auth[_0x74f1('0x5')](),controller[_0x74f1('0x6')]);router[_0x74f1('0x7')]('/hangup',auth['isAuthenticated'](),auth[_0x74f1('0x5')](),controller['hangup']);router[_0x74f1('0x7')]('/answer',auth[_0x74f1('0x4')](),auth[_0x74f1('0x5')](),controller[_0x74f1('0x8')]);router['post'](_0x74f1('0x9'),auth['isAuthenticated'](),auth[_0x74f1('0x5')](),controller['hold']);router[_0x74f1('0x7')](_0x74f1('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x74f1('0xb')]);router[_0x74f1('0x7')](_0x74f1('0xc'),auth[_0x74f1('0x4')](),auth[_0x74f1('0x5')](),controller[_0x74f1('0xd')]);router[_0x74f1('0x7')](_0x74f1('0xe'),auth[_0x74f1('0x4')](),auth[_0x74f1('0x5')](),controller['transfer']);module[_0x74f1('0xf')]=router; \ No newline at end of file +var _0x40ca=['/answer','answer','/hold','hold','/unhold','unhold','calls','/transfer','exports','express','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','canUpdate'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x40ca,0x1a1));var _0xa40c=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x40ca[_0x5783f4];return _0x28e380;};'use strict';var express=require(_0xa40c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xa40c('0x1'));router[_0xa40c('0x2')](_0xa40c('0x3'),auth[_0xa40c('0x4')](),auth['canUpdate'](),controller[_0xa40c('0x5')]);router['post'](_0xa40c('0x6'),auth['isAuthenticated'](),auth[_0xa40c('0x7')](),controller['hangup']);router[_0xa40c('0x2')](_0xa40c('0x8'),auth[_0xa40c('0x4')](),auth[_0xa40c('0x7')](),controller[_0xa40c('0x9')]);router['post'](_0xa40c('0xa'),auth[_0xa40c('0x4')](),auth[_0xa40c('0x7')](),controller[_0xa40c('0xb')]);router[_0xa40c('0x2')](_0xa40c('0xc'),auth[_0xa40c('0x4')](),auth[_0xa40c('0x7')](),controller[_0xa40c('0xd')]);router[_0xa40c('0x2')]('/calls',auth[_0xa40c('0x4')](),auth['canUpdate'](),controller[_0xa40c('0xe')]);router[_0xa40c('0x2')](_0xa40c('0xf'),auth[_0xa40c('0x4')](),auth[_0xa40c('0x7')](),controller['transfer']);module[_0xa40c('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 0637e13..ccf61db 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 _0xdeb3=['unhold\x20fired:','webbar:unhold','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','log','stack','name','status','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','\x20not\x20found!','originate','originate\x20fired:','body','validate','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','answer','answer\x20fired:','webbar:answer','hold','webbar:hold','unhold'];(function(_0x44aa40,_0x5946eb){var _0x16ddac=function(_0x4124a5){while(--_0x4124a5){_0x44aa40['push'](_0x44aa40['shift']());}};_0x16ddac(++_0x5946eb);}(_0xdeb3,0xeb));var _0x3deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb3[_0x2641f9];return _0x585741;};'use strict';var path=require(_0x3deb('0x0'));var fs=require('fs');var _=require(_0x3deb('0x1'));var db=require(_0x3deb('0x2'))['db'];var config=require(_0x3deb('0x3'));var util=require(_0x3deb('0x4'));var BPromise=require(_0x3deb('0x5'));var jayson=require(_0x3deb('0x6'));var amiClient=jayson[_0x3deb('0x7')][_0x3deb('0x8')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require('ioredis');config[_0x3deb('0x9')]=_[_0x3deb('0xa')](config[_0x3deb('0x9')],{'host':_0x3deb('0xb'),'port':0x18eb});var io=require(_0x3deb('0xc'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x3deb('0xd'),'required':[!![],_0x3deb('0xe')]},'callNumber':{'type':_0x3deb('0xf'),'required':[!![],_0x3deb('0x10')]},'callerId':{'type':_0x3deb('0xf')},'callbackUrl':{'type':_0x3deb('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x3deb('0xd'),'required':[!![],_0x3deb('0xe')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3deb('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3deb('0xe')]},'sessionId':{'type':_0x3deb('0xf'),'required':[!![],_0x3deb('0x11')]},'transferNumber':{'type':_0x3deb('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x3deb('0xd'),'required':[!![],_0x3deb('0xe')]},'sessionId':{'type':_0x3deb('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3deb('0xd'),'required':[!![],_0x3deb('0xe')]},'sessionId':{'type':_0x3deb('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3deb('0xd'),'required':[!![],_0x3deb('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3deb('0xe')]}});function emit(_0xa45605,_0x5f2d6c,_0x201ca8){logger[_0x3deb('0x12')](_0xa45605,_0x5f2d6c,JSON['stringify'](_0x201ca8));io['to'](_0xa45605)['emit'](_0x5f2d6c,_0x201ca8);}function handleError(_0x4ae786){return function(_0x2a8ec4){console[_0x3deb('0x13')]('handleError:',_0x2a8ec4,_0x2a8ec4 instanceof RangeError);logger['error'](_0x2a8ec4[_0x3deb('0x14')]);if(_0x2a8ec4 instanceof RangeError){if(_0x2a8ec4[_0x3deb('0x15')]){delete _0x2a8ec4[_0x3deb('0x15')];}_0x4ae786[_0x3deb('0x16')](0x194)['send'](_0x2a8ec4);}else{if(_0x2a8ec4[_0x3deb('0x15')]){delete _0x2a8ec4[_0x3deb('0x15')];}_0x4ae786[_0x3deb('0x16')](0x1f4)['send'](_0x2a8ec4);}};}function checkError(){return function(_0x1e4cea){if(!_0x1e4cea){throw new RangeError(_0x3deb('0x17'));}return _0x1e4cea;};}function respondWithRpcPromise(_0x403c0b,_0x5fbec4){return new BPromise(function(_0x22ea80,_0x543014){var _0x35843b=amiClient;return _0x35843b[_0x3deb('0x18')](_0x403c0b,_0x5fbec4)[_0x3deb('0x19')](function(_0x428869){if(_0x428869[_0x3deb('0x1a')]){if(_0x428869[_0x3deb('0x1a')][_0x3deb('0x1b')]===0x1f4){return _0x543014(_0x428869[_0x3deb('0x1a')]['message']);}return _0x22ea80(_0x428869[_0x3deb('0x1a')][_0x3deb('0x1c')]);}else{_0x22ea80(_0x428869[_0x3deb('0x1d')]);}})[_0x3deb('0x1e')](function(_0x472a46){_0x543014(_0x472a46);});});}function getAgent(_0x4a5b3e){return db[_0x3deb('0x1f')][_0x3deb('0x20')]({'where':{'id':_0x4a5b3e,'role':_0x3deb('0x21')}})[_0x3deb('0x19')](checkError());}function getAgentCheckSession(_0xec30ee,_0x331065){return new BPromise(function(_0xff692b,_0x541c87){var _0x56b62c=respondWithRpcPromise(_0x3deb('0x22'));var _0x520f24=getAgent(_0xec30ee);Promise[_0x3deb('0x23')]([_0x56b62c,_0x520f24])[_0x3deb('0x19')](function(_0x2bd20f){var _0x492ca0=_0x2bd20f[0x0];var _0x460512=_0x2bd20f[0x1];var _0x55c960=_['filter'](_0x492ca0[_0x3deb('0x24')],function(_0x205c22){return _0x205c22[_0x3deb('0x25')]==_0x460512['id']&&_0x205c22[_0x3deb('0x26')]==_0x331065;});if(_0x55c960['length']==0x1){_0xff692b(_0x460512);}else{_0x541c87(new RangeError('sessionId\x20'+_0x331065+_0x3deb('0x27')));}});});}exports[_0x3deb('0x28')]=function(_0x543927,_0x5bcac3){logger[_0x3deb('0x12')](_0x3deb('0x29'),_0x543927[_0x3deb('0x2a')]);var _0x511143=originateValidation[_0x3deb('0x2b')](_0x543927['body']);if(_0x511143[_0x3deb('0x2c')]>0x0){return _0x5bcac3[_0x3deb('0x16')](0x190)[_0x3deb('0x2d')](_0x511143);}var _0x2e5995=_0x543927[_0x3deb('0x2a')][_0x3deb('0x2e')];var _0x189ec3=_0x543927[_0x3deb('0x2a')][_0x3deb('0x2f')];var _0x2e5b89=_0x543927['body'][_0x3deb('0x30')];var _0x1eac90=_0x543927[_0x3deb('0x2a')][_0x3deb('0x31')];return getAgent(_0x2e5995)[_0x3deb('0x19')](function(_0x345544){logger[_0x3deb('0x12')](_0x3deb('0x32'),_0x345544[_0x3deb('0x15')]);emit(util[_0x3deb('0x33')](_0x3deb('0x34'),_0x345544[_0x3deb('0x15')]),_0x3deb('0x35'),{'callNumber':_0x189ec3,'callerId':_0x2e5b89,'callbackUrl':_0x1eac90});return _0x5bcac3[_0x3deb('0x16')](0xc8)[_0x3deb('0x2d')]({'error':![],'message':_0x3deb('0x36')});})['catch'](handleError(_0x5bcac3));};exports['hangup']=function(_0x2ccfa8,_0x173696){logger[_0x3deb('0x12')]('hangup\x20fired:',_0x2ccfa8[_0x3deb('0x2a')]);var _0x5b99ca=hangupValidation[_0x3deb('0x2b')](_0x2ccfa8['body']);if(_0x5b99ca[_0x3deb('0x2c')]>0x0){return _0x173696['status'](0x190)[_0x3deb('0x2d')](_0x5b99ca);}var _0x3c2342=_0x2ccfa8[_0x3deb('0x2a')][_0x3deb('0x2e')];var _0x553069=_0x2ccfa8[_0x3deb('0x2a')]['sessionId'];return getAgent(_0x3c2342)[_0x3deb('0x19')](function(_0x30ed7c){logger[_0x3deb('0x12')](_0x3deb('0x32'),_0x30ed7c[_0x3deb('0x15')]);emit(util[_0x3deb('0x33')](_0x3deb('0x34'),_0x30ed7c[_0x3deb('0x15')]),'webbar:hangup',{'sessionId':_0x553069});return _0x173696[_0x3deb('0x16')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x173696));};exports[_0x3deb('0x37')]=function(_0x2a8aa2,_0x2e9cb1){logger[_0x3deb('0x12')](_0x3deb('0x38'),_0x2a8aa2[_0x3deb('0x2a')]);var _0x2e2c03=answerValidation['validate'](_0x2a8aa2['body']);if(_0x2e2c03[_0x3deb('0x2c')]>0x0){return _0x2e9cb1[_0x3deb('0x16')](0x190)[_0x3deb('0x2d')](_0x2e2c03);}var _0x1e8979=_0x2a8aa2[_0x3deb('0x2a')]['userId'];var _0x1fa3ca=_0x2a8aa2[_0x3deb('0x2a')][_0x3deb('0x26')];return getAgent(_0x1e8979)['then'](function(_0x20685c){logger[_0x3deb('0x12')](_0x3deb('0x32'),_0x20685c[_0x3deb('0x15')]);emit(util[_0x3deb('0x33')]('user:%s',_0x20685c[_0x3deb('0x15')]),_0x3deb('0x39'),{'sessionId':_0x1fa3ca});return _0x2e9cb1[_0x3deb('0x16')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x3deb('0x1e')](handleError(_0x2e9cb1));};exports[_0x3deb('0x3a')]=function(_0x391504,_0xa68027){logger[_0x3deb('0x12')]('hold\x20fired:',_0x391504[_0x3deb('0x2a')]);var _0x318dac=holdValidation[_0x3deb('0x2b')](_0x391504[_0x3deb('0x2a')]);if(_0x318dac[_0x3deb('0x2c')]>0x0){return _0xa68027[_0x3deb('0x16')](0x190)[_0x3deb('0x2d')](_0x318dac);}var _0x384788=_0x391504[_0x3deb('0x2a')]['userId'];var _0x44c177=_0x391504[_0x3deb('0x2a')][_0x3deb('0x26')];return getAgent(_0x384788)[_0x3deb('0x19')](function(_0x448505){logger['info'](_0x3deb('0x32'),_0x448505[_0x3deb('0x15')]);emit(util['format']('user:%s',_0x448505['name']),_0x3deb('0x3b'),{'sessionId':_0x44c177});return _0xa68027[_0x3deb('0x16')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x3deb('0x1e')](handleError(_0xa68027));};exports[_0x3deb('0x3c')]=function(_0x8aabc0,_0x3b4688){logger['info'](_0x3deb('0x3d'),_0x8aabc0[_0x3deb('0x2a')]);var _0xc3f8d3=unholdValidation[_0x3deb('0x2b')](_0x8aabc0[_0x3deb('0x2a')]);if(_0xc3f8d3[_0x3deb('0x2c')]>0x0){return _0x3b4688[_0x3deb('0x16')](0x190)[_0x3deb('0x2d')](_0xc3f8d3);}var _0x5099ee=_0x8aabc0['body'][_0x3deb('0x2e')];var _0x375851=_0x8aabc0[_0x3deb('0x2a')][_0x3deb('0x26')];return getAgent(_0x5099ee)[_0x3deb('0x19')](function(_0x20e0f2){logger[_0x3deb('0x12')](_0x3deb('0x32'),_0x20e0f2[_0x3deb('0x15')]);emit(util[_0x3deb('0x33')](_0x3deb('0x34'),_0x20e0f2[_0x3deb('0x15')]),_0x3deb('0x3e'),{'sessionId':_0x375851});return _0x3b4688[_0x3deb('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x3deb('0x1e')](handleError(_0x3b4688));};exports['calls']=function(_0x5e7ec8,_0x2007bd){logger[_0x3deb('0x12')](_0x3deb('0x3f'),_0x2007bd[_0x3deb('0x2a')]);var _0x59a3c0=callsValidation[_0x3deb('0x2b')](_0x5e7ec8[_0x3deb('0x2a')]);if(_0x59a3c0[_0x3deb('0x2c')]>0x0){return _0x2007bd[_0x3deb('0x16')](0x190)[_0x3deb('0x2d')](_0x59a3c0);}var _0x20b877=_0x5e7ec8[_0x3deb('0x2a')][_0x3deb('0x2e')];var _0x3f7a3b=respondWithRpcPromise(_0x3deb('0x22'));var _0x12ac44=getAgent(_0x20b877);return Promise[_0x3deb('0x23')]([_0x3f7a3b,_0x12ac44])[_0x3deb('0x19')](function(_0x3fc40e){var _0x2274b2=_0x3fc40e[0x0];var _0x44a950=_0x3fc40e[0x1];var _0x4b95c0=_[_0x3deb('0x40')](_0x2274b2[_0x3deb('0x24')],function(_0xf26b46){return _0xf26b46[_0x3deb('0x25')]==_0x44a950['id'];});return _0x2007bd[_0x3deb('0x16')](0xc8)['json']({'count':_0x4b95c0[_0x3deb('0x2c')],'rows':_0x4b95c0});})['catch'](handleError(_0x2007bd));};exports[_0x3deb('0x41')]=function(_0x43508c,_0xad0f7b){logger[_0x3deb('0x12')](_0x3deb('0x42'),_0x43508c[_0x3deb('0x2a')]);var _0x4efd88=conferenceValidation[_0x3deb('0x2b')](_0x43508c[_0x3deb('0x2a')]);if(_0x4efd88[_0x3deb('0x2c')]>0x0){return _0xad0f7b[_0x3deb('0x16')](0x190)[_0x3deb('0x2d')](_0x4efd88);}var _0x140cfc=_0x43508c[_0x3deb('0x2a')][_0x3deb('0x2e')];return getAgent(_0x140cfc)[_0x3deb('0x19')](function(_0x26db83){logger[_0x3deb('0x12')](_0x3deb('0x32'),_0x26db83['name']);emit(util['format'](_0x3deb('0x34'),_0x26db83[_0x3deb('0x15')]),_0x3deb('0x43'));return _0xad0f7b[_0x3deb('0x16')](0xc8)[_0x3deb('0x2d')]({'error':![],'message':_0x3deb('0x44')});})['catch'](handleError(_0xad0f7b));};exports[_0x3deb('0x45')]=function(_0x50575a,_0xc6c09f){logger[_0x3deb('0x12')](_0x3deb('0x46'),_0x50575a[_0x3deb('0x2a')]);var _0x82aab9=transferValidation[_0x3deb('0x2b')](_0x50575a['body']);if(_0x82aab9[_0x3deb('0x2c')]>0x0){return _0xc6c09f[_0x3deb('0x16')](0x190)[_0x3deb('0x2d')](_0x82aab9);}var _0x143693=_0x50575a[_0x3deb('0x2a')][_0x3deb('0x2e')];var _0x14ea25=_0x50575a['body'][_0x3deb('0x26')];var _0x354803=_0x50575a[_0x3deb('0x2a')][_0x3deb('0x47')];return getAgent(_0x143693)[_0x3deb('0x19')](function(_0x53af4b){logger[_0x3deb('0x12')](_0x3deb('0x32'),_0x53af4b[_0x3deb('0x15')]);emit(util[_0x3deb('0x33')](_0x3deb('0x34'),_0x53af4b[_0x3deb('0x15')]),_0x3deb('0x48'),{'sessionId':_0x14ea25,'transferNumber':_0x354803});return _0xc6c09f[_0x3deb('0x16')](0xc8)[_0x3deb('0x2d')]({'error':![],'message':_0x3deb('0x49')});})[_0x3deb('0x1e')](handleError(_0xc6c09f));}; \ No newline at end of file +var _0x25b0=['answer','webbar:answer','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','calls','calls\x20fired:','rows','UserId','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','webbar:originate','entityFound:','format','user:%s','webbar:hangup'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x25b0,0x140));var _0x025b=function(_0x36fe46,_0x40010c){_0x36fe46=_0x36fe46-0x0;var _0x4d2e9c=_0x25b0[_0x36fe46];return _0x4d2e9c;};'use strict';var path=require(_0x025b('0x0'));var fs=require('fs');var _=require(_0x025b('0x1'));var db=require(_0x025b('0x2'))['db'];var config=require(_0x025b('0x3'));var util=require(_0x025b('0x4'));var BPromise=require(_0x025b('0x5'));var jayson=require(_0x025b('0x6'));var amiClient=jayson[_0x025b('0x7')][_0x025b('0x8')]({'port':0x232a});var logger=require(_0x025b('0x9'))('webbarapi');var Redis=require(_0x025b('0xa'));config[_0x025b('0xb')]=_[_0x025b('0xc')](config['redis'],{'host':_0x025b('0xd'),'port':0x18eb});var io=require(_0x025b('0xe'))(new Redis(config[_0x025b('0xb')]));var Schema=require(_0x025b('0xf'));var originateValidation=new Schema({'userId':{'type':_0x025b('0x10'),'required':[!![],_0x025b('0x11')]},'callNumber':{'type':_0x025b('0x12'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x025b('0x12')},'callbackUrl':{'type':_0x025b('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x025b('0x10'),'required':[!![],_0x025b('0x11')]},'sessionId':{'type':_0x025b('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x025b('0x10'),'required':[!![],_0x025b('0x11')]},'sessionId':{'type':_0x025b('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x025b('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x025b('0x12'),'required':[!![],_0x025b('0x13')]},'transferNumber':{'type':_0x025b('0x12'),'required':[!![],_0x025b('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x025b('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x025b('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x025b('0x10'),'required':[!![],_0x025b('0x11')]},'sessionId':{'type':_0x025b('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x025b('0x10'),'required':[!![],_0x025b('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x025b('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x242be4,_0x360856,_0x34b8b1){logger[_0x025b('0x15')](_0x242be4,_0x360856,JSON[_0x025b('0x16')](_0x34b8b1));io['to'](_0x242be4)[_0x025b('0x17')](_0x360856,_0x34b8b1);}function handleError(_0xf43f34){return function(_0x525651){console[_0x025b('0x18')](_0x025b('0x19'),_0x525651,_0x525651 instanceof RangeError);logger[_0x025b('0x1a')](_0x525651[_0x025b('0x1b')]);if(_0x525651 instanceof RangeError){if(_0x525651[_0x025b('0x1c')]){delete _0x525651[_0x025b('0x1c')];}_0xf43f34[_0x025b('0x1d')](0x194)[_0x025b('0x1e')](_0x525651);}else{if(_0x525651[_0x025b('0x1c')]){delete _0x525651[_0x025b('0x1c')];}_0xf43f34['status'](0x1f4)[_0x025b('0x1e')](_0x525651);}};}function checkError(){return function(_0x3e84d4){if(!_0x3e84d4){throw new RangeError(_0x025b('0x1f'));}return _0x3e84d4;};}function respondWithRpcPromise(_0x6ed27e,_0x5d3e63){return new BPromise(function(_0x4c712a,_0x1a519d){var _0x415655=amiClient;return _0x415655[_0x025b('0x20')](_0x6ed27e,_0x5d3e63)[_0x025b('0x21')](function(_0x4edb56){if(_0x4edb56[_0x025b('0x1a')]){if(_0x4edb56[_0x025b('0x1a')][_0x025b('0x22')]===0x1f4){return _0x1a519d(_0x4edb56[_0x025b('0x1a')][_0x025b('0x23')]);}return _0x4c712a(_0x4edb56[_0x025b('0x1a')][_0x025b('0x23')]);}else{_0x4c712a(_0x4edb56[_0x025b('0x24')]);}})[_0x025b('0x25')](function(_0x352f69){_0x1a519d(_0x352f69);});});}function getAgent(_0xca561c){return db[_0x025b('0x26')][_0x025b('0x27')]({'where':{'id':_0xca561c,'role':_0x025b('0x28')}})['then'](checkError());}function getAgentCheckSession(_0x227e6b,_0x3a4e03){return new BPromise(function(_0x11521d,_0x2f8a74){var _0x5c9614=respondWithRpcPromise(_0x025b('0x29'));var _0x503aaf=getAgent(_0x227e6b);Promise[_0x025b('0x2a')]([_0x5c9614,_0x503aaf])[_0x025b('0x21')](function(_0x296de2){var _0x229e6d=_0x296de2[0x0];var _0x2d074f=_0x296de2[0x1];var _0x2f02bc=_[_0x025b('0x2b')](_0x229e6d['rows'],function(_0x41d26e){return _0x41d26e['UserId']==_0x2d074f['id']&&_0x41d26e[_0x025b('0x2c')]==_0x3a4e03;});if(_0x2f02bc[_0x025b('0x2d')]==0x1){_0x11521d(_0x2d074f);}else{_0x2f8a74(new RangeError(_0x025b('0x2e')+_0x3a4e03+_0x025b('0x2f')));}});});}exports['originate']=function(_0x2459d3,_0x2d8ffe){logger[_0x025b('0x15')](_0x025b('0x30'),_0x2459d3[_0x025b('0x31')]);var _0x2743e5=originateValidation[_0x025b('0xf')](_0x2459d3[_0x025b('0x31')]);if(_0x2743e5['length']>0x0){return _0x2d8ffe[_0x025b('0x1d')](0x190)[_0x025b('0x32')](_0x2743e5);}var _0x507b89=_0x2459d3[_0x025b('0x31')][_0x025b('0x33')];var _0x15b54d=_0x2459d3[_0x025b('0x31')][_0x025b('0x34')];var _0x4f1715=_0x2459d3['body'][_0x025b('0x35')];var _0xadab9=_0x2459d3[_0x025b('0x31')][_0x025b('0x36')];return getAgent(_0x507b89)[_0x025b('0x21')](function(_0x39e25a){logger[_0x025b('0x15')]('entityFound:',_0x39e25a['name']);emit(util['format']('user:%s',_0x39e25a['name']),_0x025b('0x37'),{'callNumber':_0x15b54d,'callerId':_0x4f1715,'callbackUrl':_0xadab9});return _0x2d8ffe[_0x025b('0x1d')](0xc8)[_0x025b('0x32')]({'error':![],'message':'originate\x20executed!'});})[_0x025b('0x25')](handleError(_0x2d8ffe));};exports['hangup']=function(_0x51de97,_0x3c0ba9){logger[_0x025b('0x15')]('hangup\x20fired:',_0x51de97[_0x025b('0x31')]);var _0xb8e90=hangupValidation[_0x025b('0xf')](_0x51de97['body']);if(_0xb8e90[_0x025b('0x2d')]>0x0){return _0x3c0ba9['status'](0x190)[_0x025b('0x32')](_0xb8e90);}var _0x442bac=_0x51de97[_0x025b('0x31')][_0x025b('0x33')];var _0x5f52db=_0x51de97[_0x025b('0x31')]['sessionId'];return getAgent(_0x442bac)[_0x025b('0x21')](function(_0x5dbf2e){logger[_0x025b('0x15')](_0x025b('0x38'),_0x5dbf2e[_0x025b('0x1c')]);emit(util[_0x025b('0x39')](_0x025b('0x3a'),_0x5dbf2e['name']),_0x025b('0x3b'),{'sessionId':_0x5f52db});return _0x3c0ba9[_0x025b('0x1d')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x025b('0x25')](handleError(_0x3c0ba9));};exports[_0x025b('0x3c')]=function(_0x314d64,_0x39336e){logger[_0x025b('0x15')]('answer\x20fired:',_0x314d64[_0x025b('0x31')]);var _0x4b59df=answerValidation[_0x025b('0xf')](_0x314d64[_0x025b('0x31')]);if(_0x4b59df[_0x025b('0x2d')]>0x0){return _0x39336e[_0x025b('0x1d')](0x190)[_0x025b('0x32')](_0x4b59df);}var _0x57bd80=_0x314d64[_0x025b('0x31')][_0x025b('0x33')];var _0xf2b103=_0x314d64[_0x025b('0x31')][_0x025b('0x2c')];return getAgent(_0x57bd80)[_0x025b('0x21')](function(_0x250c02){logger[_0x025b('0x15')](_0x025b('0x38'),_0x250c02[_0x025b('0x1c')]);emit(util[_0x025b('0x39')](_0x025b('0x3a'),_0x250c02[_0x025b('0x1c')]),_0x025b('0x3d'),{'sessionId':_0xf2b103});return _0x39336e[_0x025b('0x1d')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x39336e));};exports['hold']=function(_0x23cd60,_0x12bf43){logger[_0x025b('0x15')](_0x025b('0x3e'),_0x23cd60[_0x025b('0x31')]);var _0x16c244=holdValidation['validate'](_0x23cd60[_0x025b('0x31')]);if(_0x16c244[_0x025b('0x2d')]>0x0){return _0x12bf43['status'](0x190)[_0x025b('0x32')](_0x16c244);}var _0x39ce38=_0x23cd60['body'][_0x025b('0x33')];var _0x10a081=_0x23cd60[_0x025b('0x31')][_0x025b('0x2c')];return getAgent(_0x39ce38)[_0x025b('0x21')](function(_0x5489c0){logger[_0x025b('0x15')](_0x025b('0x38'),_0x5489c0[_0x025b('0x1c')]);emit(util[_0x025b('0x39')]('user:%s',_0x5489c0[_0x025b('0x1c')]),_0x025b('0x3f'),{'sessionId':_0x10a081});return _0x12bf43[_0x025b('0x1d')](0xc8)[_0x025b('0x32')]({'error':![],'message':_0x025b('0x40')});})[_0x025b('0x25')](handleError(_0x12bf43));};exports['unhold']=function(_0x317001,_0xc216ff){logger[_0x025b('0x15')]('unhold\x20fired:',_0x317001[_0x025b('0x31')]);var _0x11feb3=unholdValidation[_0x025b('0xf')](_0x317001['body']);if(_0x11feb3['length']>0x0){return _0xc216ff[_0x025b('0x1d')](0x190)['json'](_0x11feb3);}var _0x29c44b=_0x317001[_0x025b('0x31')][_0x025b('0x33')];var _0x5d6cbc=_0x317001[_0x025b('0x31')][_0x025b('0x2c')];return getAgent(_0x29c44b)[_0x025b('0x21')](function(_0x193932){logger['info']('entityFound:',_0x193932[_0x025b('0x1c')]);emit(util[_0x025b('0x39')](_0x025b('0x3a'),_0x193932[_0x025b('0x1c')]),_0x025b('0x41'),{'sessionId':_0x5d6cbc});return _0xc216ff[_0x025b('0x1d')](0xc8)[_0x025b('0x32')]({'error':![],'message':'unhold\x20executed!'});})[_0x025b('0x25')](handleError(_0xc216ff));};exports[_0x025b('0x42')]=function(_0x4d39fb,_0xa54811){logger[_0x025b('0x15')](_0x025b('0x43'),_0xa54811[_0x025b('0x31')]);var _0x4298a7=callsValidation[_0x025b('0xf')](_0x4d39fb[_0x025b('0x31')]);if(_0x4298a7['length']>0x0){return _0xa54811[_0x025b('0x1d')](0x190)['json'](_0x4298a7);}var _0x42a1ad=_0x4d39fb[_0x025b('0x31')][_0x025b('0x33')];var _0x3c8733=respondWithRpcPromise('VoiceChannels');var _0x5a3b73=getAgent(_0x42a1ad);return Promise[_0x025b('0x2a')]([_0x3c8733,_0x5a3b73])[_0x025b('0x21')](function(_0x840d96){var _0x595e2e=_0x840d96[0x0];var _0x2655a8=_0x840d96[0x1];var _0x3c2208=_[_0x025b('0x2b')](_0x595e2e[_0x025b('0x44')],function(_0x110716){return _0x110716[_0x025b('0x45')]==_0x2655a8['id'];});return _0xa54811[_0x025b('0x1d')](0xc8)['json']({'count':_0x3c2208['length'],'rows':_0x3c2208});})['catch'](handleError(_0xa54811));};exports[_0x025b('0x46')]=function(_0x391246,_0x556fb9){logger['info'](_0x025b('0x47'),_0x391246['body']);var _0x4bad94=conferenceValidation[_0x025b('0xf')](_0x391246[_0x025b('0x31')]);if(_0x4bad94[_0x025b('0x2d')]>0x0){return _0x556fb9['status'](0x190)['json'](_0x4bad94);}var _0x10af4a=_0x391246[_0x025b('0x31')][_0x025b('0x33')];return getAgent(_0x10af4a)[_0x025b('0x21')](function(_0x1386e6){logger[_0x025b('0x15')](_0x025b('0x38'),_0x1386e6[_0x025b('0x1c')]);emit(util[_0x025b('0x39')](_0x025b('0x3a'),_0x1386e6[_0x025b('0x1c')]),_0x025b('0x48'));return _0x556fb9['status'](0xc8)[_0x025b('0x32')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x556fb9));};exports['transfer']=function(_0x2eb97e,_0x331297){logger[_0x025b('0x15')](_0x025b('0x49'),_0x2eb97e[_0x025b('0x31')]);var _0x2a8ef0=transferValidation[_0x025b('0xf')](_0x2eb97e['body']);if(_0x2a8ef0[_0x025b('0x2d')]>0x0){return _0x331297[_0x025b('0x1d')](0x190)[_0x025b('0x32')](_0x2a8ef0);}var _0x5f1be7=_0x2eb97e[_0x025b('0x31')][_0x025b('0x33')];var _0x365ba3=_0x2eb97e[_0x025b('0x31')]['sessionId'];var _0x5e4400=_0x2eb97e[_0x025b('0x31')][_0x025b('0x4a')];return getAgent(_0x5f1be7)[_0x025b('0x21')](function(_0x5b6ce6){logger[_0x025b('0x15')](_0x025b('0x38'),_0x5b6ce6[_0x025b('0x1c')]);emit(util['format'](_0x025b('0x3a'),_0x5b6ce6['name']),'webbar:transfer',{'sessionId':_0x365ba3,'transferNumber':_0x5e4400});return _0x331297[_0x025b('0x1d')](0xc8)[_0x025b('0x32')]({'error':![],'message':_0x025b('0x4b')});})[_0x025b('0x25')](handleError(_0x331297));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index a47bd5b..8bed916 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 _0xf9ba=['../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','post','create','addDisposition','/:id/applications','/:id/notify','notify','send','put','/:id','update','delete','destroy','removeDispositions','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x32ad33,_0xa276f4){var _0x1d21f9=function(_0x488871){while(--_0x488871){_0x32ad33['push'](_0x32ad33['shift']());}};_0x1d21f9(++_0xa276f4);}(_0xf9ba,0x135));var _0xaf9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9ba[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xaf9b('0x0'));var path=require(_0xaf9b('0x1'));var timeout=require(_0xaf9b('0x2'));var express=require(_0xaf9b('0x3'));var router=express[_0xaf9b('0x4')]();var auth=require(_0xaf9b('0x5'));var interaction=require(_0xaf9b('0x6'));var config=require(_0xaf9b('0x7'));var controller=require(_0xaf9b('0x8'));router[_0xaf9b('0x9')]('/',auth[_0xaf9b('0xa')](),controller[_0xaf9b('0xb')]);router[_0xaf9b('0x9')](_0xaf9b('0xc'),auth[_0xaf9b('0xa')](),controller[_0xaf9b('0xd')]);router[_0xaf9b('0x9')]('/:id',auth[_0xaf9b('0xa')](),controller[_0xaf9b('0xe')]);router[_0xaf9b('0x9')](_0xaf9b('0xf'),auth[_0xaf9b('0xa')](),controller[_0xaf9b('0x10')]);router[_0xaf9b('0x9')](_0xaf9b('0x11'),auth[_0xaf9b('0xa')](),controller[_0xaf9b('0x12')]);router[_0xaf9b('0x9')](_0xaf9b('0x13'),auth[_0xaf9b('0xa')](),controller[_0xaf9b('0x14')]);router[_0xaf9b('0x9')]('/:id/applications',auth[_0xaf9b('0xa')](),controller['getApplications']);router[_0xaf9b('0x15')]('/',auth[_0xaf9b('0xa')](),controller[_0xaf9b('0x16')]);router['post'](_0xaf9b('0xf'),auth['isAuthenticated'](),controller[_0xaf9b('0x17')]);router[_0xaf9b('0x15')]('/:id/canned_answers',auth[_0xaf9b('0xa')](),controller['addAnswer']);router['post']('/:id/users',auth[_0xaf9b('0xa')](),controller['addAgents']);router[_0xaf9b('0x15')](_0xaf9b('0x18'),auth[_0xaf9b('0xa')](),controller['addApplications']);router['post'](_0xaf9b('0x19'),controller[_0xaf9b('0x1a')]);router[_0xaf9b('0x15')]('/:id/send',auth[_0xaf9b('0xa')](),controller[_0xaf9b('0x1b')]);router[_0xaf9b('0x1c')](_0xaf9b('0x1d'),auth['isAuthenticated'](),controller[_0xaf9b('0x1e')]);router[_0xaf9b('0x1f')](_0xaf9b('0x1d'),auth[_0xaf9b('0xa')](),controller[_0xaf9b('0x20')]);router[_0xaf9b('0x1f')](_0xaf9b('0xf'),auth[_0xaf9b('0xa')](),controller[_0xaf9b('0x21')]);router['delete']('/:id/canned_answers',auth[_0xaf9b('0xa')](),controller['removeAnswers']);router[_0xaf9b('0x1f')](_0xaf9b('0x13'),auth[_0xaf9b('0xa')](),controller[_0xaf9b('0x22')]);module['exports']=router; \ No newline at end of file +var _0x9f4f=['/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','connect-timeout','express','Router','../../config/environment','./whatsappAccount.controller','index','get','isAuthenticated','describe','/:id','show'];(function(_0x1fa544,_0x5b24e2){var _0x1fdbaf=function(_0x414287){while(--_0x414287){_0x1fa544['push'](_0x1fa544['shift']());}};_0x1fdbaf(++_0x5b24e2);}(_0x9f4f,0x1af));var _0xf9f4=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0x9f4f[_0x31eb67];return _0x2a8cb8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf9f4('0x0'));var express=require(_0xf9f4('0x1'));var router=express[_0xf9f4('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf9f4('0x3'));var controller=require(_0xf9f4('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xf9f4('0x5')]);router[_0xf9f4('0x6')]('/describe',auth[_0xf9f4('0x7')](),controller[_0xf9f4('0x8')]);router['get'](_0xf9f4('0x9'),auth[_0xf9f4('0x7')](),controller[_0xf9f4('0xa')]);router[_0xf9f4('0x6')](_0xf9f4('0xb'),auth[_0xf9f4('0x7')](),controller['getDispositions']);router[_0xf9f4('0x6')](_0xf9f4('0xc'),auth[_0xf9f4('0x7')](),controller[_0xf9f4('0xd')]);router['get'](_0xf9f4('0xe'),auth['isAuthenticated'](),controller[_0xf9f4('0xf')]);router[_0xf9f4('0x6')](_0xf9f4('0x10'),auth[_0xf9f4('0x7')](),controller[_0xf9f4('0x11')]);router['post']('/',auth[_0xf9f4('0x7')](),controller[_0xf9f4('0x12')]);router['post'](_0xf9f4('0xb'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xf9f4('0x13')]('/:id/canned_answers',auth[_0xf9f4('0x7')](),controller[_0xf9f4('0x14')]);router[_0xf9f4('0x13')](_0xf9f4('0xe'),auth[_0xf9f4('0x7')](),controller[_0xf9f4('0x15')]);router[_0xf9f4('0x13')](_0xf9f4('0x10'),auth['isAuthenticated'](),controller[_0xf9f4('0x16')]);router['post'](_0xf9f4('0x17'),controller[_0xf9f4('0x18')]);router[_0xf9f4('0x13')](_0xf9f4('0x19'),auth['isAuthenticated'](),controller[_0xf9f4('0x1a')]);router[_0xf9f4('0x1b')](_0xf9f4('0x9'),auth['isAuthenticated'](),controller[_0xf9f4('0x1c')]);router[_0xf9f4('0x1d')](_0xf9f4('0x9'),auth[_0xf9f4('0x7')](),controller[_0xf9f4('0x1e')]);router[_0xf9f4('0x1d')](_0xf9f4('0xb'),auth[_0xf9f4('0x7')](),controller[_0xf9f4('0x1f')]);router[_0xf9f4('0x1d')](_0xf9f4('0xc'),auth[_0xf9f4('0x7')](),controller[_0xf9f4('0x20')]);router[_0xf9f4('0x1d')](_0xf9f4('0xe'),auth[_0xf9f4('0x7')](),controller[_0xf9f4('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index f3862e6..1d1a17f 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 _0x1d5b=['randomstring','exports','STRING','name','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x614ef4,_0x28a060){var _0x35e8e2=function(_0x55e81b){while(--_0x55e81b){_0x614ef4['push'](_0x614ef4['shift']());}};_0x35e8e2(++_0x28a060);}(_0x1d5b,0x125));var _0xb1d5=function(_0x5541e0,_0x1f7de2){_0x5541e0=_0x5541e0-0x0;var _0x392fa6=_0x1d5b[_0x5541e0];return _0x392fa6;};'use strict';var Sequelize=require(_0xb1d5('0x0'));var rs=require(_0xb1d5('0x1'));module[_0xb1d5('0x2')]={'name':{'type':Sequelize[_0xb1d5('0x3')],'unique':_0xb1d5('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb1d5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb1d5('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xb1d5('0x3')]},'type':{'type':Sequelize[_0xb1d5('0x5')]('twilio')},'accountSid':{'type':Sequelize[_0xb1d5('0x3')]},'authToken':{'type':Sequelize[_0xb1d5('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb1d5('0x6')],'defaultValue':function(){return _0xb1d5('0x7');}},'notificationSound':{'type':Sequelize[_0xb1d5('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb1d5('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb1d5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb1d5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb1d5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb1d5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb1d5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb1d5('0x9')],'comment':_0xb1d5('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb1d5('0xb'),'set':function(_0x46f6b1){if(!_0x46f6b1){this[_0xb1d5('0xc')](_0xb1d5('0xd'),null);}this[_0xb1d5('0xc')]('mandatoryDisposition',_0x46f6b1);}},'description':{'type':Sequelize[_0xb1d5('0x3')]}}; \ No newline at end of file +var _0xbfd9=['STRING','name','generate','twilio','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','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfd9,0x6f));var _0x9bfd=function(_0x5410d0,_0x1a5e94){_0x5410d0=_0x5410d0-0x0;var _0x474456=_0xbfd9[_0x5410d0];return _0x474456;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9bfd('0x0'));module['exports']={'name':{'type':Sequelize[_0x9bfd('0x1')],'unique':_0x9bfd('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x9bfd('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x9bfd('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x9bfd('0x1')],'defaultValue':function(){return rs[_0x9bfd('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x9bfd('0x4'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x9bfd('0x1')]},'notificationTemplate':{'type':Sequelize[_0x9bfd('0x5')],'defaultValue':function(){return _0x9bfd('0x6');}},'notificationSound':{'type':Sequelize[_0x9bfd('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x9bfd('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9bfd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9bfd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9bfd('0x8')],'comment':_0x9bfd('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x9bfd('0x7')],'defaultValue':![],'comment':_0x9bfd('0xa'),'set':function(_0x5192f8){if(!_0x5192f8){this[_0x9bfd('0xb')](_0x9bfd('0xc'),null);}this[_0x9bfd('0xb')](_0x9bfd('0xd'),_0x5192f8);}},'description':{'type':Sequelize[_0x9bfd('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 98868ad..9d40f93 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 _0xde2c=['update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','type','VIRTUAL','count','include','findAll','rows','catch','params','intersection','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','sort','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','transaction','WhatsappApplication','priority','getApplications','notify','Applications','account','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','updatedAt','DESC','list','Contacts','contact','WhatsappInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','stringify','Content-Type','text/xml','\x0a','List','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','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','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','code','error','message','info','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x454564,_0x2a5ea6){var _0x3bdfea=function(_0x265436){while(--_0x265436){_0x454564['push'](_0x454564['shift']());}};_0x3bdfea(++_0x2a5ea6);}(_0xde2c,0x7f));var _0xcde2=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0xde2c[_0x3dea7d];return _0x53919a;};'use strict';var pdf=require(_0xcde2('0x0'));var emlformat=require(_0xcde2('0x1'));var rimraf=require(_0xcde2('0x2'));var zipdir=require(_0xcde2('0x3'));var jsonpatch=require(_0xcde2('0x4'));var rp=require(_0xcde2('0x5'));var moment=require(_0xcde2('0x6'));var BPromise=require(_0xcde2('0x7'));var Mustache=require('mustache');var util=require(_0xcde2('0x8'));var path=require(_0xcde2('0x9'));var sox=require(_0xcde2('0xa'));var csv=require(_0xcde2('0xb'));var ejs=require(_0xcde2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var db=require(_0xcde2('0x18'))['db'];config[_0xcde2('0x19')]=_[_0xcde2('0x1a')](config[_0xcde2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xcde2('0x1b'))(new Redis(config['redis']));require(_0xcde2('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xcde2('0x1d')][_0xcde2('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x417505,_0x19b54b,_0x11665c){if(_0x11665c){var _0x5312c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5312c7[_0xcde2('0x1f')](_0x19b54b)){return _0x417505;}else{throw new db['Sequelize'][(_0xcde2('0x20'))](_0xcde2('0x21'));}}else{return _0x417505;}}function respondWithRpcPromise(_0xbade43,_0x1f1858,_0x5223f1,_0x4fd5aa){return new BPromise(function(_0x4fe586,_0x2b4468){var _0x582e84=_0x4fd5aa||client;return _0x582e84[_0xcde2('0x22')](_0xbade43,_0x5223f1)[_0xcde2('0x23')](function(_0x252372){logger['info'](_0xcde2('0x24'),_0x1f1858,_0xcde2('0x25'));logger[_0xcde2('0x26')](_0xcde2('0x27'),_0x1f1858,_0xcde2('0x25'),JSON['stringify'](_0x252372));if(_0x252372['error']){if(_0x252372['error'][_0xcde2('0x28')]===0x1f4){logger[_0xcde2('0x29')](_0xcde2('0x24'),_0x1f1858,_0x252372[_0xcde2('0x29')][_0xcde2('0x2a')]);return _0x2b4468(_0x252372['error'][_0xcde2('0x2a')]);}logger['error'](_0xcde2('0x24'),_0x1f1858,_0x252372[_0xcde2('0x29')][_0xcde2('0x2a')]);return _0x4fe586(_0x252372['error']['message']);}else{logger[_0xcde2('0x2b')](_0xcde2('0x24'),_0x1f1858,_0xcde2('0x25'));_0x4fe586(_0x252372[_0xcde2('0x2c')][_0xcde2('0x2a')]);}})['catch'](function(_0x2d1d17){logger[_0xcde2('0x29')](_0xcde2('0x24'),_0x1f1858,_0x2d1d17);_0x2b4468(_0x2d1d17);});});}function respondWithStatusCode(_0x513965,_0x2487eb){_0x2487eb=_0x2487eb||0xcc;return function(_0x348ca1){if(_0x348ca1){return _0x513965[_0xcde2('0x2d')](_0x2487eb);}return _0x513965[_0xcde2('0x2e')](_0x2487eb)[_0xcde2('0x2f')]();};}function respondWithResult(_0x5b2b7,_0x40b12c){_0x40b12c=_0x40b12c||0xc8;return function(_0x3e492f){if(_0x3e492f){return _0x5b2b7['status'](_0x40b12c)[_0xcde2('0x30')](_0x3e492f);}};}function respondWithFilteredResult(_0x4a0826,_0x141072){return function(_0xb87851){if(_0xb87851){var _0x43706c=_0xb87851['count'],_0x49cb58=_0x141072[_0xcde2('0x31')],_0xae46dc=_0x141072[_0xcde2('0x31')]+_0x141072[_0xcde2('0x32')],_0x28fedd;if(_0xae46dc>=_0x43706c){_0xae46dc=_0x43706c;_0x28fedd=0xc8;}else{_0x28fedd=0xce;}_0x4a0826[_0xcde2('0x2e')](_0x28fedd);return _0x4a0826[_0xcde2('0x33')](_0xcde2('0x34'),_0x49cb58+'-'+_0xae46dc+'/'+_0x43706c)[_0xcde2('0x30')](_0xb87851);}return null;};}function patchUpdates(_0x41fdac){return function(_0x5c08f0){try{jsonpatch[_0xcde2('0x35')](_0x5c08f0,_0x41fdac,!![]);}catch(_0x6fda22){return BPromise[_0xcde2('0x36')](_0x6fda22);}return _0x5c08f0[_0xcde2('0x37')]();};}function saveUpdates(_0x4e2c3a,_0x2ae8e0){return function(_0x42a21b){if(_0x42a21b){return _0x42a21b[_0xcde2('0x38')](_0x4e2c3a)[_0xcde2('0x23')](function(_0x498339){return _0x498339;});}return null;};}function removeEntity(_0x1b56cc,_0x452816){return function(_0x29e3e0){if(_0x29e3e0){return _0x29e3e0[_0xcde2('0x39')]()['then'](function(){var _0xb9c8d2=_0x29e3e0[_0xcde2('0x3a')]({'plain':!![]});var _0xbde4f4=_0xcde2('0x3b');return db[_0xcde2('0x3c')]['destroy']({'where':{'type':_0xbde4f4,'resourceId':_0xb9c8d2['id']}})[_0xcde2('0x23')](function(){return _0x29e3e0;});})[_0xcde2('0x23')](function(){_0x1b56cc[_0xcde2('0x2e')](0xcc)[_0xcde2('0x2f')]();});}};}function handleEntityNotFound(_0x4a64c1,_0x542246){return function(_0x1fc8a6){if(!_0x1fc8a6){_0x4a64c1[_0xcde2('0x2d')](0x194);}return _0x1fc8a6;};}function handleError(_0x40e1e2,_0x4463d1){_0x4463d1=_0x4463d1||0x1f4;return function(_0x10c494){logger[_0xcde2('0x29')](_0x10c494[_0xcde2('0x3d')]);if(_0x10c494[_0xcde2('0x3e')]){delete _0x10c494[_0xcde2('0x3e')];}_0x40e1e2['status'](_0x4463d1)[_0xcde2('0x3f')](_0x10c494);};}exports[_0xcde2('0x40')]=function(_0x30f843,_0x51a0a6){var _0x2a73df={'include':[{'model':db[_0xcde2('0x41')],'as':_0xcde2('0x42')}]},_0x47b6ee={},_0x5c0991={'count':0x0,'rows':[]};var _0x20dfad=_[_0xcde2('0x43')](db[_0xcde2('0x44')][_0xcde2('0x45')],function(_0x4cb808){return{'name':_0x4cb808['fieldName'],'type':_0x4cb808['type'][_0xcde2('0x46')]};});_0x47b6ee[_0xcde2('0x47')]=_[_0xcde2('0x43')](_0x20dfad,_0xcde2('0x3e'));_0x47b6ee[_0xcde2('0x48')]=_[_0xcde2('0x49')](_0x30f843[_0xcde2('0x48')]);_0x47b6ee['filters']=_['intersection'](_0x47b6ee[_0xcde2('0x47')],_0x47b6ee['query']);_0x2a73df[_0xcde2('0x4a')]=_['intersection'](_0x47b6ee[_0xcde2('0x47')],qs[_0xcde2('0x4b')](_0x30f843[_0xcde2('0x48')]['fields']));_0x2a73df[_0xcde2('0x4a')]=_0x2a73df['attributes'][_0xcde2('0x4c')]?_0x2a73df[_0xcde2('0x4a')]:_0x47b6ee[_0xcde2('0x47')];if(!_0x30f843[_0xcde2('0x48')][_0xcde2('0x4d')](_0xcde2('0x4e'))){_0x2a73df['limit']=qs['limit'](_0x30f843[_0xcde2('0x48')]['limit']);_0x2a73df['offset']=qs[_0xcde2('0x31')](_0x30f843['query'][_0xcde2('0x31')]);}_0x2a73df[_0xcde2('0x4f')]=qs['sort'](_0x30f843[_0xcde2('0x48')]['sort']);_0x2a73df['where']=qs[_0xcde2('0x50')](_[_0xcde2('0x51')](_0x30f843['query'],_0x47b6ee[_0xcde2('0x50')]),_0x20dfad);if(_0x30f843['query'][_0xcde2('0x52')]){_0x2a73df[_0xcde2('0x53')]=_[_0xcde2('0x54')](_0x2a73df[_0xcde2('0x53')],{'$or':_[_0xcde2('0x43')](_0x20dfad,function(_0x4b66d6){if(_0x4b66d6[_0xcde2('0x55')]!==_0xcde2('0x56')){var _0x40d14b={};_0x40d14b[_0x4b66d6[_0xcde2('0x3e')]]={'$like':'%'+_0x30f843['query']['filter']+'%'};return _0x40d14b;}})});}_0x2a73df=_[_0xcde2('0x54')]({},_0x2a73df,_0x30f843['options']);var _0x3c87b6={'where':_0x2a73df[_0xcde2('0x53')]};return db[_0xcde2('0x44')][_0xcde2('0x57')](_0x3c87b6)[_0xcde2('0x23')](function(_0x3b7862){_0x5c0991['count']=_0x3b7862;if(_0x30f843[_0xcde2('0x48')]['includeAll']){_0x2a73df[_0xcde2('0x58')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xcde2('0x59')](_0x2a73df);})[_0xcde2('0x23')](function(_0x3d10c8){_0x5c0991[_0xcde2('0x5a')]=_0x3d10c8;return _0x5c0991;})[_0xcde2('0x23')](respondWithFilteredResult(_0x51a0a6,_0x2a73df))[_0xcde2('0x5b')](handleError(_0x51a0a6,null));};exports['show']=function(_0x3adc5b,_0x5aa54f){var _0x138c58={'raw':![],'where':{'id':_0x3adc5b[_0xcde2('0x5c')]['id']},'include':[{'model':db[_0xcde2('0x41')],'as':_0xcde2('0x42')}]},_0x184005={};_0x184005[_0xcde2('0x47')]=_[_0xcde2('0x49')](db[_0xcde2('0x44')][_0xcde2('0x45')]);_0x184005[_0xcde2('0x48')]=_[_0xcde2('0x49')](_0x3adc5b[_0xcde2('0x48')]);_0x184005['filters']=_['intersection'](_0x184005['model'],_0x184005[_0xcde2('0x48')]);_0x138c58['attributes']=_[_0xcde2('0x5d')](_0x184005[_0xcde2('0x47')],qs[_0xcde2('0x4b')](_0x3adc5b['query'][_0xcde2('0x4b')]));_0x138c58['attributes']=_0x138c58[_0xcde2('0x4a')]['length']?_0x138c58[_0xcde2('0x4a')]:_0x184005[_0xcde2('0x47')];if(_0x3adc5b['query'][_0xcde2('0x5e')]){_0x138c58['include']=[{'all':!![]}];}_0x138c58=_['merge']({},_0x138c58,_0x3adc5b[_0xcde2('0x5f')]);return db[_0xcde2('0x44')][_0xcde2('0x60')](_0x138c58)[_0xcde2('0x23')](handleEntityNotFound(_0x5aa54f,null))[_0xcde2('0x23')](respondWithResult(_0x5aa54f,null))[_0xcde2('0x5b')](handleError(_0x5aa54f,null));};exports['create']=function(_0x47329f,_0x44b3fb){return db[_0xcde2('0x44')][_0xcde2('0x61')](_0x47329f[_0xcde2('0x62')],{})[_0xcde2('0x23')](function(_0x50892c){var _0x5775bb=_0x47329f[_0xcde2('0x63')][_0xcde2('0x3a')]({'plain':!![]});if(!_0x5775bb)throw new Error(_0xcde2('0x64'));if(_0x5775bb[_0xcde2('0x65')]==='user'){var _0x446765=_0x50892c[_0xcde2('0x3a')]({'plain':!![]});var _0x41e902=_0xcde2('0x3b');return db[_0xcde2('0x66')][_0xcde2('0x60')]({'where':{'name':_0x41e902,'userProfileId':_0x5775bb['userProfileId']},'raw':!![]})[_0xcde2('0x23')](function(_0x3b9e2d){if(_0x3b9e2d&&_0x3b9e2d['autoAssociation']===0x0){return db[_0xcde2('0x3c')][_0xcde2('0x61')]({'name':_0x446765[_0xcde2('0x3e')],'resourceId':_0x446765['id'],'type':_0x3b9e2d[_0xcde2('0x3e')],'sectionId':_0x3b9e2d['id']},{})[_0xcde2('0x23')](function(){return _0x50892c;});}else{return _0x50892c;}})[_0xcde2('0x5b')](function(_0x7e9fba){logger[_0xcde2('0x29')](_0xcde2('0x67'),_0x7e9fba);throw _0x7e9fba;});}return _0x50892c;})[_0xcde2('0x23')](respondWithResult(_0x44b3fb,0xc9))['catch'](handleError(_0x44b3fb,null));};exports[_0xcde2('0x38')]=function(_0x33d76a,_0x5eaeab){if(_0x33d76a[_0xcde2('0x62')]['id']){delete _0x33d76a[_0xcde2('0x62')]['id'];}return db[_0xcde2('0x44')]['find']({'where':{'id':_0x33d76a[_0xcde2('0x5c')]['id']},'include':[{'model':db[_0xcde2('0x41')],'as':_0xcde2('0x42')}]})[_0xcde2('0x23')](handleEntityNotFound(_0x5eaeab,null))[_0xcde2('0x23')](saveUpdates(_0x33d76a[_0xcde2('0x62')],null))[_0xcde2('0x23')](respondWithResult(_0x5eaeab,null))[_0xcde2('0x5b')](handleError(_0x5eaeab,null));};exports[_0xcde2('0x39')]=function(_0x34e72a,_0x3b0961){return db['WhatsappAccount']['find']({'where':{'id':_0x34e72a[_0xcde2('0x5c')]['id']}})[_0xcde2('0x23')](handleEntityNotFound(_0x3b0961,null))[_0xcde2('0x23')](removeEntity(_0x3b0961,null))['catch'](handleError(_0x3b0961,null));};exports['describe']=function(_0x5652a7,_0x1341d0){return db[_0xcde2('0x44')][_0xcde2('0x68')]()[_0xcde2('0x23')](respondWithResult(_0x1341d0,null))[_0xcde2('0x5b')](handleError(_0x1341d0,null));};exports[_0xcde2('0x69')]=function(_0x5d9964,_0x4ad98c,_0x165ec4){if(_0x5d9964[_0xcde2('0x62')]['id']){delete _0x5d9964[_0xcde2('0x62')]['id'];}return db[_0xcde2('0x44')][_0xcde2('0x60')]({'where':{'id':_0x5d9964[_0xcde2('0x5c')]['id']}})[_0xcde2('0x23')](handleEntityNotFound(_0x4ad98c,null))[_0xcde2('0x23')](function(_0x3f0b7c){if(_0x3f0b7c){_0x5d9964[_0xcde2('0x62')][_0xcde2('0x6a')]=_0x3f0b7c['id'];return db[_0xcde2('0x6b')][_0xcde2('0x61')](_0x5d9964[_0xcde2('0x62')]);}})[_0xcde2('0x23')](respondWithResult(_0x4ad98c,null))[_0xcde2('0x5b')](handleError(_0x4ad98c,null));};exports[_0xcde2('0x6c')]=function(_0x97db81,_0x278c00,_0x38d44b){var _0x5ee070={'raw':![],'where':{}};var _0x3b0fce={};var _0x162ebd={'count':0x0,'rows':[]};return db[_0xcde2('0x44')][_0xcde2('0x6d')]({'where':{'id':_0x97db81[_0xcde2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x278c00,null))[_0xcde2('0x23')](function(_0x4db99f){if(_0x4db99f){_0x3b0fce[_0xcde2('0x47')]=_[_0xcde2('0x49')](db[_0xcde2('0x6b')][_0xcde2('0x45')]);_0x3b0fce[_0xcde2('0x48')]=_[_0xcde2('0x49')](_0x97db81[_0xcde2('0x48')]);_0x3b0fce['filters']=_['intersection'](_0x3b0fce[_0xcde2('0x47')],_0x3b0fce['query']);_0x5ee070[_0xcde2('0x4a')]=_[_0xcde2('0x5d')](_0x3b0fce[_0xcde2('0x47')],qs[_0xcde2('0x4b')](_0x97db81[_0xcde2('0x48')][_0xcde2('0x4b')]));_0x5ee070[_0xcde2('0x4a')]=_0x5ee070['attributes'][_0xcde2('0x4c')]?_0x5ee070[_0xcde2('0x4a')]:_0x3b0fce[_0xcde2('0x47')];if(!_0x97db81[_0xcde2('0x48')]['hasOwnProperty'](_0xcde2('0x4e'))){_0x5ee070[_0xcde2('0x32')]=qs[_0xcde2('0x32')](_0x97db81[_0xcde2('0x48')][_0xcde2('0x32')]);_0x5ee070[_0xcde2('0x31')]=qs[_0xcde2('0x31')](_0x97db81[_0xcde2('0x48')][_0xcde2('0x31')]);}_0x5ee070[_0xcde2('0x4f')]=qs[_0xcde2('0x6e')](_0x97db81[_0xcde2('0x48')][_0xcde2('0x6e')]);_0x5ee070['where']=qs[_0xcde2('0x50')](_[_0xcde2('0x51')](_0x97db81[_0xcde2('0x48')],_0x3b0fce[_0xcde2('0x50')]));_0x5ee070[_0xcde2('0x53')][_0xcde2('0x6a')]=_0x4db99f['id'];if(_0x97db81[_0xcde2('0x48')][_0xcde2('0x52')]){_0x5ee070[_0xcde2('0x53')]=_[_0xcde2('0x54')](_0x5ee070[_0xcde2('0x53')],{'$or':_[_0xcde2('0x43')](_0x5ee070[_0xcde2('0x4a')],function(_0x2ff2f2){var _0x248e55={};_0x248e55[_0x2ff2f2]={'$like':'%'+_0x97db81[_0xcde2('0x48')]['filter']+'%'};return _0x248e55;})});}_0x5ee070=_['merge']({},_0x5ee070,_0x97db81[_0xcde2('0x5f')]);return db[_0xcde2('0x6b')][_0xcde2('0x57')]({'where':_0x5ee070[_0xcde2('0x53')]})['then'](function(_0x9afade){_0x162ebd['count']=_0x9afade;if(_0x97db81[_0xcde2('0x48')]['includeAll']){_0x5ee070[_0xcde2('0x58')]=[{'all':!![]}];}return db[_0xcde2('0x6b')]['findAll'](_0x5ee070);})[_0xcde2('0x23')](function(_0x3a6f1b){_0x162ebd[_0xcde2('0x5a')]=_0x3a6f1b;return _0x162ebd;});}})['then'](respondWithFilteredResult(_0x278c00,_0x5ee070))[_0xcde2('0x5b')](handleError(_0x278c00,null));};exports[_0xcde2('0x6f')]=function(_0x35db40,_0x39d97a,_0x4b7e5f){return db['WhatsappAccount'][_0xcde2('0x60')]({'where':{'id':_0x35db40[_0xcde2('0x5c')]['id']}})[_0xcde2('0x23')](handleEntityNotFound(_0x39d97a,null))[_0xcde2('0x23')](function(_0x335a54){if(_0x335a54){return _0x335a54[_0xcde2('0x6f')](_0x35db40['query'][_0xcde2('0x70')]);}})[_0xcde2('0x23')](respondWithStatusCode(_0x39d97a,null))[_0xcde2('0x5b')](handleError(_0x39d97a,null));};exports[_0xcde2('0x71')]=function(_0x24e5cf,_0x1a32c1,_0x113478){if(_0x24e5cf['body']['id']){delete _0x24e5cf[_0xcde2('0x62')]['id'];}return db[_0xcde2('0x44')]['find']({'where':{'id':_0x24e5cf[_0xcde2('0x5c')]['id']}})[_0xcde2('0x23')](handleEntityNotFound(_0x1a32c1,null))[_0xcde2('0x23')](function(_0x55c35f){if(_0x55c35f){_0x24e5cf[_0xcde2('0x62')][_0xcde2('0x6a')]=_0x55c35f['id'];return db['CannedAnswer']['create'](_0x24e5cf['body']);}})[_0xcde2('0x23')](respondWithResult(_0x1a32c1,null))[_0xcde2('0x5b')](handleError(_0x1a32c1,null));};exports['getAnswers']=function(_0x12b989,_0x5e5437,_0x4c753a){var _0x2bea8a={'raw':![],'where':{}};var _0x243504={};var _0x3e6111={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xcde2('0x6d')]({'where':{'id':_0x12b989[_0xcde2('0x5c')]['id']}})[_0xcde2('0x23')](handleEntityNotFound(_0x5e5437,null))[_0xcde2('0x23')](function(_0x372567){if(_0x372567){_0x243504[_0xcde2('0x47')]=_[_0xcde2('0x49')](db['CannedAnswer']['rawAttributes']);_0x243504[_0xcde2('0x48')]=_[_0xcde2('0x49')](_0x12b989[_0xcde2('0x48')]);_0x243504[_0xcde2('0x50')]=_[_0xcde2('0x5d')](_0x243504['model'],_0x243504[_0xcde2('0x48')]);_0x2bea8a['attributes']=_['intersection'](_0x243504[_0xcde2('0x47')],qs['fields'](_0x12b989['query'][_0xcde2('0x4b')]));_0x2bea8a[_0xcde2('0x4a')]=_0x2bea8a[_0xcde2('0x4a')][_0xcde2('0x4c')]?_0x2bea8a[_0xcde2('0x4a')]:_0x243504['model'];if(!_0x12b989[_0xcde2('0x48')]['hasOwnProperty'](_0xcde2('0x4e'))){_0x2bea8a[_0xcde2('0x32')]=qs[_0xcde2('0x32')](_0x12b989[_0xcde2('0x48')]['limit']);_0x2bea8a['offset']=qs['offset'](_0x12b989[_0xcde2('0x48')]['offset']);}_0x2bea8a['order']=qs[_0xcde2('0x6e')](_0x12b989[_0xcde2('0x48')][_0xcde2('0x6e')]);_0x2bea8a[_0xcde2('0x53')]=qs[_0xcde2('0x50')](_[_0xcde2('0x51')](_0x12b989[_0xcde2('0x48')],_0x243504['filters']));_0x2bea8a[_0xcde2('0x53')][_0xcde2('0x6a')]=_0x372567['id'];if(_0x12b989[_0xcde2('0x48')][_0xcde2('0x52')]){_0x2bea8a[_0xcde2('0x53')]=_[_0xcde2('0x54')](_0x2bea8a[_0xcde2('0x53')],{'$or':_['map'](_0x2bea8a[_0xcde2('0x4a')],function(_0x51bdb2){var _0x4ce362={};_0x4ce362[_0x51bdb2]={'$like':'%'+_0x12b989[_0xcde2('0x48')][_0xcde2('0x52')]+'%'};return _0x4ce362;})});}_0x2bea8a=_[_0xcde2('0x54')]({},_0x2bea8a,_0x12b989[_0xcde2('0x5f')]);return db[_0xcde2('0x72')][_0xcde2('0x57')]({'where':_0x2bea8a[_0xcde2('0x53')]})['then'](function(_0x13eaad){_0x3e6111[_0xcde2('0x57')]=_0x13eaad;if(_0x12b989[_0xcde2('0x48')]['includeAll']){_0x2bea8a[_0xcde2('0x58')]=[{'all':!![]}];}return db[_0xcde2('0x72')]['findAll'](_0x2bea8a);})['then'](function(_0x44268c){_0x3e6111[_0xcde2('0x5a')]=_0x44268c;return _0x3e6111;});}})[_0xcde2('0x23')](respondWithFilteredResult(_0x5e5437,_0x2bea8a))[_0xcde2('0x5b')](handleError(_0x5e5437,null));};exports[_0xcde2('0x73')]=function(_0x490e21,_0x5a78ad,_0x2c7414){return db['WhatsappAccount'][_0xcde2('0x60')]({'where':{'id':_0x490e21[_0xcde2('0x5c')]['id']}})[_0xcde2('0x23')](handleEntityNotFound(_0x5a78ad,null))[_0xcde2('0x23')](function(_0x9f9338){if(_0x9f9338){return _0x9f9338['removeAnswers'](_0x490e21[_0xcde2('0x48')][_0xcde2('0x70')]);}})[_0xcde2('0x23')](respondWithStatusCode(_0x5a78ad,null))['catch'](handleError(_0x5a78ad,null));};exports['addAgents']=function(_0x117fa4,_0x4dedce,_0x126ca6){return db[_0xcde2('0x44')][_0xcde2('0x60')]({'where':{'id':_0x117fa4[_0xcde2('0x5c')]['id']}})[_0xcde2('0x23')](handleEntityNotFound(_0x4dedce,null))[_0xcde2('0x23')](function(_0x427d7a){if(_0x427d7a){return _0x427d7a['addAgents'](_0x117fa4['body'][_0xcde2('0x70')],_[_0xcde2('0x74')](_0x117fa4[_0xcde2('0x62')],['ids','id'])||{})['spread'](function(_0x12293b){for(var _0x39143c=0x0;_0x39143c<_0x117fa4[_0xcde2('0x62')]['ids'][_0xcde2('0x4c')];_0x39143c+=0x1){socket[_0xcde2('0x75')]('userWhatsappAccount:save',{'UserId':_0x117fa4[_0xcde2('0x62')][_0xcde2('0x70')][_0x39143c],'WhatsappAccountId':_0x117fa4[_0xcde2('0x5c')]['id']});}return _0x12293b;});}})[_0xcde2('0x23')](respondWithResult(_0x4dedce,null))[_0xcde2('0x5b')](handleError(_0x4dedce,null));};exports[_0xcde2('0x76')]=function(_0xdd6253,_0x2a4f1b,_0x48c169){return db[_0xcde2('0x44')][_0xcde2('0x60')]({'where':{'id':_0xdd6253[_0xcde2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2a4f1b,null))[_0xcde2('0x23')](function(_0x29c1c1){if(_0x29c1c1){return _0x29c1c1[_0xcde2('0x76')](_0xdd6253[_0xcde2('0x48')]['ids'])[_0xcde2('0x23')](function(){if(_[_0xcde2('0x77')](_0xdd6253[_0xcde2('0x48')][_0xcde2('0x70')])){for(var _0x223a08=0x0;_0x223a08<_0xdd6253['query']['ids']['length'];_0x223a08+=0x1){socket[_0xcde2('0x75')](_0xcde2('0x78'),{'UserId':Number(_0xdd6253['query'][_0xcde2('0x70')][_0x223a08]),'WhatsappAccountId':Number(_0xdd6253[_0xcde2('0x5c')]['id'])});}}else{socket[_0xcde2('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0xdd6253[_0xcde2('0x48')][_0xcde2('0x70')]),'WhatsappAccountId':Number(_0xdd6253[_0xcde2('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a4f1b,null))[_0xcde2('0x5b')](handleError(_0x2a4f1b,null));};exports[_0xcde2('0x79')]=function(_0x19d948,_0x474e31,_0xec2942){var _0x40dfd0={};var _0x418733={};var _0xe2855f;var _0x3473c3;return db[_0xcde2('0x44')][_0xcde2('0x6d')]({'where':{'id':_0x19d948[_0xcde2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x474e31,null))[_0xcde2('0x23')](function(_0x571e05){if(_0x571e05){_0xe2855f=_0x571e05;_0x418733[_0xcde2('0x47')]=_['keys'](db[_0xcde2('0x7a')]['rawAttributes']);_0x418733['query']=_[_0xcde2('0x49')](_0x19d948[_0xcde2('0x48')]);_0x418733[_0xcde2('0x50')]=_[_0xcde2('0x5d')](_0x418733[_0xcde2('0x47')],_0x418733[_0xcde2('0x48')]);_0x40dfd0['attributes']=_[_0xcde2('0x5d')](_0x418733[_0xcde2('0x47')],qs[_0xcde2('0x4b')](_0x19d948[_0xcde2('0x48')][_0xcde2('0x4b')]));_0x40dfd0[_0xcde2('0x4a')]=_0x40dfd0[_0xcde2('0x4a')][_0xcde2('0x4c')]?_0x40dfd0[_0xcde2('0x4a')]:_0x418733[_0xcde2('0x47')];_0x40dfd0['order']=qs[_0xcde2('0x6e')](_0x19d948[_0xcde2('0x48')][_0xcde2('0x6e')]);_0x40dfd0[_0xcde2('0x53')]=qs[_0xcde2('0x50')](_[_0xcde2('0x51')](_0x19d948['query'],_0x418733[_0xcde2('0x50')]));if(_0x19d948[_0xcde2('0x48')][_0xcde2('0x52')]){_0x40dfd0[_0xcde2('0x53')]=_[_0xcde2('0x54')](_0x40dfd0[_0xcde2('0x53')],{'$or':_[_0xcde2('0x43')](_0x40dfd0[_0xcde2('0x4a')],function(_0x4ee3d6){var _0x5785bf={};_0x5785bf[_0x4ee3d6]={'$like':'%'+_0x19d948[_0xcde2('0x48')][_0xcde2('0x52')]+'%'};return _0x5785bf;})});}_0x40dfd0=_[_0xcde2('0x54')]({},_0x40dfd0,_0x19d948[_0xcde2('0x5f')]);return _0xe2855f[_0xcde2('0x79')](_0x40dfd0);}})[_0xcde2('0x23')](function(_0x425d36){if(_0x425d36){_0x3473c3=_0x425d36[_0xcde2('0x4c')];if(!_0x19d948[_0xcde2('0x48')][_0xcde2('0x4d')]('nolimit')){_0x40dfd0[_0xcde2('0x32')]=qs[_0xcde2('0x32')](_0x19d948[_0xcde2('0x48')][_0xcde2('0x32')]);_0x40dfd0[_0xcde2('0x31')]=qs[_0xcde2('0x31')](_0x19d948['query'][_0xcde2('0x31')]);}return _0xe2855f['getAgents'](_0x40dfd0);}})[_0xcde2('0x23')](function(_0x14c9cb){if(_0x14c9cb){return _0x14c9cb?{'count':_0x3473c3,'rows':_0x14c9cb}:null;}})[_0xcde2('0x23')](respondWithResult(_0x474e31,null))[_0xcde2('0x5b')](handleError(_0x474e31,null));};exports['addApplications']=function(_0x3f3654,_0x2c736c,_0x3ab370){return db[_0xcde2('0x44')][_0xcde2('0x6d')]({'where':{'id':_0x3f3654['params']['id']}})[_0xcde2('0x23')](handleEntityNotFound(_0x2c736c,null))[_0xcde2('0x23')](function(_0xd7106a){if(_0xd7106a){return db['sequelize'][_0xcde2('0x7b')](function(_0xd119e){return db[_0xcde2('0x7c')]['destroy']({'where':{'WhatsappAccountId':_0x3f3654['params']['id']},'transaction':_0xd119e})[_0xcde2('0x23')](function(_0x28e5c1){var _0xc6c213=_[_0xcde2('0x43')](_0x3f3654['body'],function(_0x2cd4f2){_0x2cd4f2['WhatsappAccountId']=_0x3f3654[_0xcde2('0x5c')]['id'];return _0x2cd4f2;});return db[_0xcde2('0x7c')]['bulkCreate'](_0xc6c213,{'transaction':_0xd119e});});})[_0xcde2('0x23')](function(){return db[_0xcde2('0x7c')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x3f3654[_0xcde2('0x5c')]['id']},'order':_0xcde2('0x7d')});});}})['then'](respondWithResult(_0x2c736c,null))['catch'](handleError(_0x2c736c,null));};exports['getApplications']=function(_0x4c2011,_0x139eb9,_0x2e2a78){var _0x4d432b={};var _0x5701b1={};var _0x3dae1c;var _0x274e80;return db[_0xcde2('0x44')][_0xcde2('0x6d')]({'where':{'id':_0x4c2011[_0xcde2('0x5c')]['id']}})[_0xcde2('0x23')](handleEntityNotFound(_0x139eb9,null))[_0xcde2('0x23')](function(_0x51a939){if(_0x51a939){_0x3dae1c=_0x51a939;_0x5701b1[_0xcde2('0x47')]=_[_0xcde2('0x49')](db[_0xcde2('0x7c')][_0xcde2('0x45')]);_0x5701b1[_0xcde2('0x48')]=_[_0xcde2('0x49')](_0x4c2011[_0xcde2('0x48')]);_0x5701b1[_0xcde2('0x50')]=_['intersection'](_0x5701b1['model'],_0x5701b1[_0xcde2('0x48')]);_0x4d432b[_0xcde2('0x4a')]=_[_0xcde2('0x5d')](_0x5701b1['model'],qs['fields'](_0x4c2011['query'][_0xcde2('0x4b')]));_0x4d432b[_0xcde2('0x4a')]=_0x4d432b[_0xcde2('0x4a')][_0xcde2('0x4c')]?_0x4d432b[_0xcde2('0x4a')]:_0x5701b1['model'];_0x4d432b[_0xcde2('0x4f')]=qs[_0xcde2('0x6e')](_0x4c2011[_0xcde2('0x48')][_0xcde2('0x6e')]);_0x4d432b[_0xcde2('0x53')]=qs[_0xcde2('0x50')](_['pick'](_0x4c2011[_0xcde2('0x48')],_0x5701b1['filters']));if(_0x4c2011[_0xcde2('0x48')]['filter']){_0x4d432b['where']=_['merge'](_0x4d432b[_0xcde2('0x53')],{'$or':_['map'](_0x4d432b['attributes'],function(_0x40b413){var _0x50c5c9={};_0x50c5c9[_0x40b413]={'$like':'%'+_0x4c2011[_0xcde2('0x48')][_0xcde2('0x52')]+'%'};return _0x50c5c9;})});}_0x4d432b=_[_0xcde2('0x54')]({},_0x4d432b,_0x4c2011[_0xcde2('0x5f')]);return _0x3dae1c[_0xcde2('0x7e')](_0x4d432b);}})[_0xcde2('0x23')](function(_0x13149d){if(_0x13149d){_0x274e80=_0x13149d[_0xcde2('0x4c')];if(!_0x4c2011['query']['hasOwnProperty'](_0xcde2('0x4e'))){_0x4d432b['limit']=qs['limit'](_0x4c2011[_0xcde2('0x48')][_0xcde2('0x32')]);_0x4d432b[_0xcde2('0x31')]=qs['offset'](_0x4c2011[_0xcde2('0x48')][_0xcde2('0x31')]);}return _0x3dae1c[_0xcde2('0x7e')](_0x4d432b);}})['then'](function(_0x14c44d){if(_0x14c44d){return _0x14c44d?{'count':_0x274e80,'rows':_0x14c44d}:null;}})[_0xcde2('0x23')](respondWithResult(_0x139eb9,null))['catch'](handleError(_0x139eb9,null));};exports[_0xcde2('0x7f')]=function(_0x1784cc,_0x4d3b17,_0x59a4f7){var _0x41148b={'channel':'whatsapp'};var _0x36d0c3=[];var _0x2921e6=[];var _0x36a33a={};return db['WhatsappAccount'][_0xcde2('0x60')]({'where':{'id':_0x1784cc['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xcde2('0x80')}]})[_0xcde2('0x23')](handleEntityNotFound(_0x4d3b17,null))[_0xcde2('0x23')](function(_0x2bffff){_0x41148b[_0xcde2('0x81')]=_0x2bffff;_0x41148b['applications']=_['orderBy'](_0x2bffff[_0xcde2('0x80')],[_0xcde2('0x7d')],['asc']);if(_0x41148b['account'][_0xcde2('0x80')]){delete _0x41148b[_0xcde2('0x81')]['Applications'];}return db[_0xcde2('0x82')][_0xcde2('0x68')]();})[_0xcde2('0x23')](function(_0x28c661){if(!_0x28c661){throw new db[(_0xcde2('0x83'))][(_0xcde2('0x20'))](_0xcde2('0x84'));}_0x36d0c3=_[_0xcde2('0x85')](_[_0xcde2('0x49')](_0x28c661),[_0xcde2('0x86'),'updatedAt']);_0x2921e6=_[_0xcde2('0x85')](_[_0xcde2('0x49')](_0x28c661),[_0xcde2('0x86'),'updatedAt','CompanyId',_0xcde2('0x87')]);_0x41148b[_0xcde2('0x62')]={'mapKey':'mobile'};if(_0x41148b[_0xcde2('0x81')]['type']&&_0x41148b[_0xcde2('0x81')]['type']===_0xcde2('0x88')){_0x41148b[_0xcde2('0x62')][_0xcde2('0x89')]=_0x1784cc['body'][_0xcde2('0x8a')][_0xcde2('0x8b')](_0xcde2('0x8c'),'');_0x41148b[_0xcde2('0x62')][_0xcde2('0x62')]=_0x1784cc[_0xcde2('0x62')][_0xcde2('0x8d')];_0x41148b[_0xcde2('0x62')][_0xcde2('0x8e')]=_0x1784cc[_0xcde2('0x62')]['MessageSid'];}if(_0x41148b['body']['id']){delete _0x41148b[_0xcde2('0x62')]['id'];}if(_[_0xcde2('0x8f')](_0x41148b[_0xcde2('0x62')][_0xcde2('0x89')])){throw new db['Sequelize']['ValidationError'](_0xcde2('0x90'));}if(_['isNil'](_0x41148b[_0xcde2('0x62')]['body'])||_0x41148b[_0xcde2('0x62')][_0xcde2('0x62')]===''){throw new db['Sequelize'][(_0xcde2('0x20'))](_0xcde2('0x91'));}if(_[_0xcde2('0x8f')](_0x41148b[_0xcde2('0x62')][_0xcde2('0x92')])){throw new db[(_0xcde2('0x83'))][(_0xcde2('0x20'))](_0xcde2('0x93')+_0x2921e6);}if(!_[_0xcde2('0x94')](_0x2921e6,_0x41148b[_0xcde2('0x62')][_0xcde2('0x92')])){throw new db[(_0xcde2('0x83'))]['ValidationError'](_0xcde2('0x95')+_0x2921e6);}_0x36a33a[_0x41148b[_0xcde2('0x62')][_0xcde2('0x92')]]=_0x41148b[_0xcde2('0x62')]['from'];return db[_0xcde2('0x96')][_0xcde2('0x60')]({'where':{'id':_0x41148b[_0xcde2('0x81')][_0xcde2('0x87')]},'include':[{'model':db[_0xcde2('0x82')],'as':'Contacts','where':_0x36a33a,'limit':0x1,'order':[[_0xcde2('0x97'),_0xcde2('0x98')]]}]});})[_0xcde2('0x23')](handleEntityNotFound(_0x4d3b17,null))[_0xcde2('0x23')](function(_0x139d0e){if(_0x139d0e){_0x41148b[_0xcde2('0x99')]=_[_0xcde2('0x74')](_0x139d0e,['Contacts']);if(_0x139d0e['Contacts'][_0xcde2('0x4c')]){return _0x139d0e[_0xcde2('0x9a')][0x0];}var _0x42c6cf=_[_0xcde2('0x1a')](_0x41148b[_0xcde2('0x62')],{'firstName':_0x41148b[_0xcde2('0x62')]['from'],'ListId':_0x139d0e['id']});_0x42c6cf[_0x41148b[_0xcde2('0x62')][_0xcde2('0x92')]]=_0x41148b[_0xcde2('0x62')]['from'];return db[_0xcde2('0x82')]['create'](_0x42c6cf,{'fields':_0x36d0c3,'raw':!![]});}})[_0xcde2('0x23')](handleEntityNotFound(_0x4d3b17,null))['then'](function(_0x3337bd){if(_0x3337bd){_0x41148b[_0xcde2('0x9b')]=_0x3337bd;var _0x21fc21={'ContactId':_0x3337bd['id'],'phone':_0x41148b[_0xcde2('0x62')]['from'],'WhatsappAccountId':_0x1784cc[_0xcde2('0x5c')]['id']};var _0x5c0e33={'ContactId':_0x3337bd['id'],'WhatsappAccountId':_0x1784cc[_0xcde2('0x5c')]['id'],'closed':![]};return db[_0xcde2('0x9c')][_0xcde2('0x60')]({'where':_0x5c0e33})[_0xcde2('0x23')](function(_0x2e5274){if(_0x2e5274){return[_0x2e5274,![]];}return db[_0xcde2('0x9c')][_0xcde2('0x61')](_0x21fc21)[_0xcde2('0x23')](function(_0x5aeef6){return[_0x5aeef6,!![]];});});}})[_0xcde2('0x9d')](function(_0x1670dc,_0x566bd2){_0x41148b['interaction']=_0x1670dc[_0xcde2('0x3a')]({'plain':!![]});_0x41148b[_0xcde2('0x9e')][_0xcde2('0x9f')]=![];if(_0x566bd2){if(_0x41148b['account'][_0xcde2('0xa0')]){_0x41148b[_0xcde2('0xa1')][_0xcde2('0xa2')]({'id':0x0,'priority':_0x41148b[_0xcde2('0xa1')][_0xcde2('0x4c')]+0x1,'app':_0xcde2('0xa3'),'appdata':_0xcde2('0xa4'),'interval':_0xcde2('0xa5')});}_0x41148b[_0xcde2('0x9e')][_0xcde2('0x9f')]=!![];}return db[_0xcde2('0xa6')]['create']({'phone':_0x41148b[_0xcde2('0x62')]['from'],'messageId':_0x41148b[_0xcde2('0x62')]['messageId'],'body':_0x41148b['body'][_0xcde2('0x62')],'WhatsappAccountId':_0x1784cc[_0xcde2('0x5c')]['id'],'WhatsappInteractionId':_0x1670dc['id'],'direction':'in','ContactId':_0x1670dc[_0xcde2('0xa7')],'AttachmentId':_0x41148b[_0xcde2('0x62')][_0xcde2('0xa8')]});})[_0xcde2('0x23')](function(_0x50cacc){_0x41148b[_0xcde2('0x2a')]=_0x50cacc;if(_0x41148b['interaction']['UserId']){return db['User'][_0xcde2('0x60')]({'attributes':['id','name'],'where':{'id':_0x41148b[_0xcde2('0x9e')]['UserId']}})[_0xcde2('0x23')](function(_0x21778f){if(_0x21778f){_0x41148b[_0xcde2('0xa1')][_0xcde2('0xa9')]({'id':0x0,'priority':0x0,'app':_0xcde2('0xaa'),'appdata':_0x21778f[_0xcde2('0x3e')]+','+(_0x41148b[_0xcde2('0x81')][_0xcde2('0xab')]||0xa),'interval':_0xcde2('0xa5')});}return respondWithRpcPromise(_0xcde2('0xac'),_0xcde2('0xad'),_0x41148b);});}return respondWithRpcPromise(_0xcde2('0xac'),'startRouting',_0x41148b);})[_0xcde2('0x23')](function(_0x920f5a){if(_0x920f5a){var _0xf755cd=0xc8;var _0xafc45c='receiveMessage';logger['info'](_0xcde2('0x27'),_0xafc45c,_0xf755cd,_0xcde2('0xae'));logger[_0xcde2('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xafc45c,_0xf755cd,_0xcde2('0xae'),JSON[_0xcde2('0xaf')](_0x920f5a));if(_0x41148b['account'][_0xcde2('0x55')]===_0xcde2('0x88')){return _0x4d3b17[_0xcde2('0x2e')](_0xf755cd)['set'](_0xcde2('0xb0'),_0xcde2('0xb1'))[_0xcde2('0x3f')](_0xcde2('0xb2'));}else{return _0x4d3b17[_0xcde2('0x2e')](_0xf755cd)['json'](_0x920f5a);}}})[_0xcde2('0x5b')](handleError(_0x4d3b17,null));};exports[_0xcde2('0x3f')]=function(_0xd91eb2,_0x56f0f6,_0x25be34){var _0x28a233,_0x1bc393,_0x40844c;if(_[_0xcde2('0x8f')](_0xd91eb2['body'][_0xcde2('0x62')])||_0xd91eb2[_0xcde2('0x62')]['body']===''){throw new db[(_0xcde2('0x83'))][(_0xcde2('0x20'))](_0xcde2('0x91'));}if(_[_0xcde2('0x8f')](_0xd91eb2['body']['to'])){throw new db[(_0xcde2('0x83'))][(_0xcde2('0x20'))]('to\x20is\x20mandatory');}_0x28a233=_0xd91eb2[_0xcde2('0x62')]['to'];return db[_0xcde2('0x44')]['find']({'where':{'id':_0xd91eb2['params']['id']},'include':[{'model':db[_0xcde2('0x96')],'as':_0xcde2('0xb3'),'include':[{'model':db[_0xcde2('0x82')],'as':'Contacts','where':{'mobile':_0x28a233},'limit':0x1,'order':[[_0xcde2('0x97'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x56f0f6,null))['then'](function(_0x444671){if(_0x444671&&_0x444671[_0xcde2('0xb3')]){_0x1bc393=_0x444671[_0xcde2('0x3a')]({'plain':!![]});if(_0x1bc393['List']&&_0x1bc393[_0xcde2('0xb3')][_0xcde2('0x9a')][_0xcde2('0x4c')]){return _0x1bc393[_0xcde2('0xb3')][_0xcde2('0x9a')][0x0];}return db[_0xcde2('0x82')][_0xcde2('0x61')](_[_0xcde2('0x1a')](_0xd91eb2[_0xcde2('0x62')],{'firstName':_0x28a233,'mobile':_0x28a233,'phone':_0x28a233,'ListId':_0x1bc393[_0xcde2('0x87')]}));}})['then'](handleEntityNotFound(_0x56f0f6,null))[_0xcde2('0x23')](function(_0x18adba){if(_0x18adba){_0x40844c=_0x18adba;return db[_0xcde2('0x9c')][_0xcde2('0x60')]({'where':{'ContactId':_0x40844c['id'],'closed':![],'WhatsappAccountId':_0x1bc393['id']}})[_0xcde2('0x23')](function(_0x90f088){if(_0x90f088){return[_0x90f088,![]];}return db[_0xcde2('0x9c')][_0xcde2('0x61')]({'UserId':_0xd91eb2[_0xcde2('0x63')]['id'],'ContactId':_0x40844c['id'],'WhatsappAccountId':_0x1bc393['id'],'phone':_0x28a233,'firstMsgDirection':_0xcde2('0xb4'),'Messages':[_[_0xcde2('0x54')](_0xd91eb2['body'],{'read':![],'body':_0xd91eb2[_0xcde2('0x62')][_0xcde2('0x62')],'phone':_0x28a233,'WhatsappAccountId':_0x1bc393['id'],'UserId':_0xd91eb2[_0xcde2('0x63')]['id'],'ContactId':_0x40844c['id']})]},{'include':[{'model':db[_0xcde2('0xa6')],'as':_0xcde2('0xb5')}]})[_0xcde2('0x23')](function(_0x529c1b){return[_0x529c1b,!![]];});});}})[_0xcde2('0x9d')](function(_0x45500d,_0x59cebd){if(_0x59cebd){return _0x45500d;}return db[_0xcde2('0xa6')][_0xcde2('0x61')](_[_0xcde2('0x54')](_0xd91eb2[_0xcde2('0x62')],{'read':![],'body':_0xd91eb2[_0xcde2('0x62')][_0xcde2('0x62')],'phone':_0x28a233,'WhatsappAccountId':_0x1bc393['id'],'WhatsappInteractionId':_0x45500d['id'],'UserId':_0xd91eb2[_0xcde2('0x63')]['id'],'ContactId':_0x40844c['id']}))[_0xcde2('0x23')](function(_0x2de3d3){_0x45500d[_0xcde2('0xb6')][_0xcde2('0xb5')]=[];_0x45500d[_0xcde2('0xb6')][_0xcde2('0xb5')][_0xcde2('0xa2')](_0x2de3d3[_0xcde2('0xb6')]);return _0x45500d;});})[_0xcde2('0x23')](respondWithResult(_0x56f0f6,null))[_0xcde2('0x5b')](handleError(_0x56f0f6,null));}; \ No newline at end of file +var _0x373d=['Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','options','includeAll','WhatsappAccount','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','order','map','include','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','applications','asc','account','CmContact','createdAt','difference','CompanyId','ListId','mobile','from','From','replace','MessageSid','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','updatedAt','DESC','Contacts','defaults','contact','WhatsappInteraction','interaction','autoclose','close','unmanaged','created','WhatsappMessage','messageId','ContactId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','send','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','./whatsappAccount.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~!@#$%^&-_=+[{]}.','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','index'];(function(_0x48efbf,_0xd1ec2d){var _0x36a0da=function(_0x16f94e){while(--_0x16f94e){_0x48efbf['push'](_0x48efbf['shift']());}};_0x36a0da(++_0xd1ec2d);}(_0x373d,0x1e2));var _0xd373=function(_0x4d1f59,_0x4483ec){_0x4d1f59=_0x4d1f59-0x0;var _0x468441=_0x373d[_0x4d1f59];return _0x468441;};'use strict';var pdf=require(_0xd373('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd373('0x1'));var zipdir=require(_0xd373('0x2'));var jsonpatch=require(_0xd373('0x3'));var rp=require(_0xd373('0x4'));var moment=require('moment');var BPromise=require(_0xd373('0x5'));var Mustache=require(_0xd373('0x6'));var util=require(_0xd373('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd373('0x8'));var ejs=require(_0xd373('0x9'));var fs=require('fs');var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var db=require(_0xd373('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd373('0x15'),'port':0x18eb});var socket=require(_0xd373('0x16'))(new Redis(config['redis']));require(_0xd373('0x17'))[_0xd373('0x18')](socket);var jayson=require(_0xd373('0x19'));var client=jayson[_0xd373('0x1a')][_0xd373('0x1b')]({'port':0x232c});function checkPasswordPattern(_0x1a9df9,_0x20aca5,_0x2eacb1){if(_0x2eacb1){var _0x5a286a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a286a[_0xd373('0x1c')](_0x20aca5)){return _0x1a9df9;}else{throw new db[(_0xd373('0x1d'))][(_0xd373('0x1e'))](_0xd373('0x1f'));}}else{return _0x1a9df9;}}function respondWithRpcPromise(_0x4e5768,_0x1e26cf,_0x5eab00,_0x460259){return new BPromise(function(_0x36d47a,_0x55c5c7){var _0x1bbdbd=_0x460259||client;return _0x1bbdbd['request'](_0x4e5768,_0x5eab00)['then'](function(_0x23fada){logger[_0xd373('0x20')](_0xd373('0x21'),_0x1e26cf,_0xd373('0x22'));logger[_0xd373('0x23')](_0xd373('0x24'),_0x1e26cf,'request\x20sent',JSON[_0xd373('0x25')](_0x23fada));if(_0x23fada[_0xd373('0x26')]){if(_0x23fada[_0xd373('0x26')][_0xd373('0x27')]===0x1f4){logger[_0xd373('0x26')](_0xd373('0x21'),_0x1e26cf,_0x23fada['error'][_0xd373('0x28')]);return _0x55c5c7(_0x23fada[_0xd373('0x26')][_0xd373('0x28')]);}logger[_0xd373('0x26')](_0xd373('0x21'),_0x1e26cf,_0x23fada[_0xd373('0x26')][_0xd373('0x28')]);return _0x36d47a(_0x23fada[_0xd373('0x26')][_0xd373('0x28')]);}else{logger[_0xd373('0x20')](_0xd373('0x21'),_0x1e26cf,_0xd373('0x22'));_0x36d47a(_0x23fada[_0xd373('0x29')][_0xd373('0x28')]);}})[_0xd373('0x2a')](function(_0x38ba50){logger[_0xd373('0x26')](_0xd373('0x21'),_0x1e26cf,_0x38ba50);_0x55c5c7(_0x38ba50);});});}function respondWithStatusCode(_0x3e657b,_0x470612){_0x470612=_0x470612||0xcc;return function(_0x45ee58){if(_0x45ee58){return _0x3e657b[_0xd373('0x2b')](_0x470612);}return _0x3e657b[_0xd373('0x2c')](_0x470612)[_0xd373('0x2d')]();};}function respondWithResult(_0xf85ca8,_0x2869e5){_0x2869e5=_0x2869e5||0xc8;return function(_0x158825){if(_0x158825){return _0xf85ca8[_0xd373('0x2c')](_0x2869e5)[_0xd373('0x2e')](_0x158825);}};}function respondWithFilteredResult(_0x7dad3e,_0x5287e7){return function(_0x7ca56e){if(_0x7ca56e){var _0x490842=_0x7ca56e[_0xd373('0x2f')],_0x498aaa=_0x5287e7[_0xd373('0x30')],_0xedc8f3=_0x5287e7[_0xd373('0x30')]+_0x5287e7['limit'],_0x15da6c;if(_0xedc8f3>=_0x490842){_0xedc8f3=_0x490842;_0x15da6c=0xc8;}else{_0x15da6c=0xce;}_0x7dad3e[_0xd373('0x2c')](_0x15da6c);return _0x7dad3e[_0xd373('0x31')]('Content-Range',_0x498aaa+'-'+_0xedc8f3+'/'+_0x490842)[_0xd373('0x2e')](_0x7ca56e);}return null;};}function patchUpdates(_0x8e4884){return function(_0x146e24){try{jsonpatch[_0xd373('0x32')](_0x146e24,_0x8e4884,!![]);}catch(_0x26538a){return BPromise[_0xd373('0x33')](_0x26538a);}return _0x146e24[_0xd373('0x34')]();};}function saveUpdates(_0x470d6e,_0x42faaa){return function(_0x52ff26){if(_0x52ff26){return _0x52ff26[_0xd373('0x35')](_0x470d6e)[_0xd373('0x36')](function(_0x420c73){return _0x420c73;});}return null;};}function removeEntity(_0x2cb761,_0x2da192){return function(_0x28da03){if(_0x28da03){return _0x28da03[_0xd373('0x37')]()[_0xd373('0x36')](function(){var _0xaa62aa=_0x28da03[_0xd373('0x38')]({'plain':!![]});var _0x38e0ea=_0xd373('0x39');return db[_0xd373('0x3a')][_0xd373('0x37')]({'where':{'type':_0x38e0ea,'resourceId':_0xaa62aa['id']}})[_0xd373('0x36')](function(){return _0x28da03;});})['then'](function(){_0x2cb761[_0xd373('0x2c')](0xcc)[_0xd373('0x2d')]();});}};}function handleEntityNotFound(_0x186e39,_0x3b4382){return function(_0x4b1080){if(!_0x4b1080){_0x186e39[_0xd373('0x2b')](0x194);}return _0x4b1080;};}function handleError(_0x470d91,_0x109fb2){_0x109fb2=_0x109fb2||0x1f4;return function(_0x3af9f7){logger[_0xd373('0x26')](_0x3af9f7[_0xd373('0x3b')]);if(_0x3af9f7['name']){delete _0x3af9f7['name'];}_0x470d91[_0xd373('0x2c')](_0x109fb2)['send'](_0x3af9f7);};}exports[_0xd373('0x3c')]=function(_0xe19d5b,_0x1d9b7a){var _0x51ba69={'include':[{'model':db[_0xd373('0x3d')],'as':_0xd373('0x3e')}]},_0x287136={},_0x14db16={'count':0x0,'rows':[]};var _0x504450=_['map'](db['WhatsappAccount'][_0xd373('0x3f')],function(_0x5b6385){return{'name':_0x5b6385[_0xd373('0x40')],'type':_0x5b6385[_0xd373('0x41')]['key']};});_0x287136['model']=_['map'](_0x504450,_0xd373('0x42'));_0x287136[_0xd373('0x43')]=_[_0xd373('0x44')](_0xe19d5b['query']);_0x287136['filters']=_[_0xd373('0x45')](_0x287136[_0xd373('0x46')],_0x287136['query']);_0x51ba69[_0xd373('0x47')]=_[_0xd373('0x45')](_0x287136[_0xd373('0x46')],qs[_0xd373('0x48')](_0xe19d5b[_0xd373('0x43')]['fields']));_0x51ba69['attributes']=_0x51ba69[_0xd373('0x47')][_0xd373('0x49')]?_0x51ba69[_0xd373('0x47')]:_0x287136[_0xd373('0x46')];if(!_0xe19d5b['query'][_0xd373('0x4a')]('nolimit')){_0x51ba69[_0xd373('0x4b')]=qs[_0xd373('0x4b')](_0xe19d5b[_0xd373('0x43')][_0xd373('0x4b')]);_0x51ba69[_0xd373('0x30')]=qs['offset'](_0xe19d5b[_0xd373('0x43')][_0xd373('0x30')]);}_0x51ba69['order']=qs[_0xd373('0x4c')](_0xe19d5b[_0xd373('0x43')][_0xd373('0x4c')]);_0x51ba69[_0xd373('0x4d')]=qs[_0xd373('0x4e')](_[_0xd373('0x4f')](_0xe19d5b[_0xd373('0x43')],_0x287136[_0xd373('0x4e')]),_0x504450);if(_0xe19d5b[_0xd373('0x43')][_0xd373('0x50')]){_0x51ba69['where']=_['merge'](_0x51ba69[_0xd373('0x4d')],{'$or':_['map'](_0x504450,function(_0x313963){if(_0x313963['type']!=='VIRTUAL'){var _0x5cbc16={};_0x5cbc16[_0x313963[_0xd373('0x42')]]={'$like':'%'+_0xe19d5b[_0xd373('0x43')][_0xd373('0x50')]+'%'};return _0x5cbc16;}})});}_0x51ba69=_[_0xd373('0x51')]({},_0x51ba69,_0xe19d5b[_0xd373('0x52')]);var _0x2fd07a={'where':_0x51ba69[_0xd373('0x4d')]};return db['WhatsappAccount'][_0xd373('0x2f')](_0x2fd07a)['then'](function(_0x4076e0){_0x14db16[_0xd373('0x2f')]=_0x4076e0;if(_0xe19d5b['query'][_0xd373('0x53')]){_0x51ba69['include']=[{'all':!![]}];}return db[_0xd373('0x54')][_0xd373('0x55')](_0x51ba69);})[_0xd373('0x36')](function(_0x1e97aa){_0x14db16[_0xd373('0x56')]=_0x1e97aa;return _0x14db16;})['then'](respondWithFilteredResult(_0x1d9b7a,_0x51ba69))['catch'](handleError(_0x1d9b7a,null));};exports['show']=function(_0x3a2192,_0x384e23){var _0x5b0801={'raw':![],'where':{'id':_0x3a2192[_0xd373('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xd373('0x3e')}]},_0x359bca={};_0x359bca[_0xd373('0x46')]=_[_0xd373('0x44')](db[_0xd373('0x54')][_0xd373('0x3f')]);_0x359bca[_0xd373('0x43')]=_[_0xd373('0x44')](_0x3a2192[_0xd373('0x43')]);_0x359bca[_0xd373('0x4e')]=_[_0xd373('0x45')](_0x359bca[_0xd373('0x46')],_0x359bca['query']);_0x5b0801['attributes']=_['intersection'](_0x359bca['model'],qs['fields'](_0x3a2192['query'][_0xd373('0x48')]));_0x5b0801[_0xd373('0x47')]=_0x5b0801['attributes']['length']?_0x5b0801['attributes']:_0x359bca[_0xd373('0x46')];if(_0x3a2192[_0xd373('0x43')]['includeAll']){_0x5b0801['include']=[{'all':!![]}];}_0x5b0801=_[_0xd373('0x51')]({},_0x5b0801,_0x3a2192[_0xd373('0x52')]);return db[_0xd373('0x54')][_0xd373('0x58')](_0x5b0801)[_0xd373('0x36')](handleEntityNotFound(_0x384e23,null))['then'](respondWithResult(_0x384e23,null))[_0xd373('0x2a')](handleError(_0x384e23,null));};exports[_0xd373('0x59')]=function(_0x386e4c,_0x213da6){return db[_0xd373('0x54')][_0xd373('0x59')](_0x386e4c[_0xd373('0x5a')],{})[_0xd373('0x36')](function(_0x10fffb){var _0x558aaf=_0x386e4c[_0xd373('0x5b')][_0xd373('0x38')]({'plain':!![]});if(!_0x558aaf)throw new Error(_0xd373('0x5c'));if(_0x558aaf[_0xd373('0x5d')]===_0xd373('0x5b')){var _0x4cb143=_0x10fffb[_0xd373('0x38')]({'plain':!![]});var _0x1f775c=_0xd373('0x39');return db['UserProfileSection'][_0xd373('0x58')]({'where':{'name':_0x1f775c,'userProfileId':_0x558aaf['userProfileId']},'raw':!![]})[_0xd373('0x36')](function(_0x4bf666){if(_0x4bf666&&_0x4bf666[_0xd373('0x5e')]===0x0){return db[_0xd373('0x3a')][_0xd373('0x59')]({'name':_0x4cb143[_0xd373('0x42')],'resourceId':_0x4cb143['id'],'type':_0x4bf666[_0xd373('0x42')],'sectionId':_0x4bf666['id']},{})[_0xd373('0x36')](function(){return _0x10fffb;});}else{return _0x10fffb;}})[_0xd373('0x2a')](function(_0xaaf7fa){logger[_0xd373('0x26')](_0xd373('0x5f'),_0xaaf7fa);throw _0xaaf7fa;});}return _0x10fffb;})[_0xd373('0x36')](respondWithResult(_0x213da6,0xc9))[_0xd373('0x2a')](handleError(_0x213da6,null));};exports[_0xd373('0x35')]=function(_0x1f496e,_0x2e3266){if(_0x1f496e[_0xd373('0x5a')]['id']){delete _0x1f496e[_0xd373('0x5a')]['id'];}return db[_0xd373('0x54')][_0xd373('0x58')]({'where':{'id':_0x1f496e[_0xd373('0x57')]['id']},'include':[{'model':db[_0xd373('0x3d')],'as':_0xd373('0x3e')}]})[_0xd373('0x36')](handleEntityNotFound(_0x2e3266,null))[_0xd373('0x36')](saveUpdates(_0x1f496e[_0xd373('0x5a')],null))[_0xd373('0x36')](respondWithResult(_0x2e3266,null))['catch'](handleError(_0x2e3266,null));};exports[_0xd373('0x37')]=function(_0x1f92bb,_0x5fdc16){return db['WhatsappAccount'][_0xd373('0x58')]({'where':{'id':_0x1f92bb[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x5fdc16,null))[_0xd373('0x36')](removeEntity(_0x5fdc16,null))[_0xd373('0x2a')](handleError(_0x5fdc16,null));};exports[_0xd373('0x60')]=function(_0x284730,_0x51f71f){return db[_0xd373('0x54')][_0xd373('0x60')]()[_0xd373('0x36')](respondWithResult(_0x51f71f,null))[_0xd373('0x2a')](handleError(_0x51f71f,null));};exports[_0xd373('0x61')]=function(_0x208233,_0x3fd90e,_0x2cf09){if(_0x208233['body']['id']){delete _0x208233[_0xd373('0x5a')]['id'];}return db['WhatsappAccount'][_0xd373('0x58')]({'where':{'id':_0x208233[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x3fd90e,null))[_0xd373('0x36')](function(_0x36e7cc){if(_0x36e7cc){_0x208233[_0xd373('0x5a')][_0xd373('0x62')]=_0x36e7cc['id'];return db[_0xd373('0x63')]['create'](_0x208233[_0xd373('0x5a')]);}})['then'](respondWithResult(_0x3fd90e,null))[_0xd373('0x2a')](handleError(_0x3fd90e,null));};exports[_0xd373('0x64')]=function(_0x310a65,_0x3ce679,_0x30fcd6){var _0x267e66={'raw':![],'where':{}};var _0x1f9a5a={};var _0x4cd326={'count':0x0,'rows':[]};return db[_0xd373('0x54')][_0xd373('0x65')]({'where':{'id':_0x310a65[_0xd373('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ce679,null))[_0xd373('0x36')](function(_0x1d5b48){if(_0x1d5b48){_0x1f9a5a[_0xd373('0x46')]=_[_0xd373('0x44')](db[_0xd373('0x63')][_0xd373('0x3f')]);_0x1f9a5a[_0xd373('0x43')]=_[_0xd373('0x44')](_0x310a65[_0xd373('0x43')]);_0x1f9a5a[_0xd373('0x4e')]=_[_0xd373('0x45')](_0x1f9a5a[_0xd373('0x46')],_0x1f9a5a['query']);_0x267e66[_0xd373('0x47')]=_[_0xd373('0x45')](_0x1f9a5a[_0xd373('0x46')],qs['fields'](_0x310a65[_0xd373('0x43')][_0xd373('0x48')]));_0x267e66[_0xd373('0x47')]=_0x267e66['attributes'][_0xd373('0x49')]?_0x267e66['attributes']:_0x1f9a5a[_0xd373('0x46')];if(!_0x310a65[_0xd373('0x43')][_0xd373('0x4a')](_0xd373('0x66'))){_0x267e66['limit']=qs[_0xd373('0x4b')](_0x310a65['query'][_0xd373('0x4b')]);_0x267e66[_0xd373('0x30')]=qs[_0xd373('0x30')](_0x310a65[_0xd373('0x43')][_0xd373('0x30')]);}_0x267e66[_0xd373('0x67')]=qs['sort'](_0x310a65[_0xd373('0x43')]['sort']);_0x267e66[_0xd373('0x4d')]=qs['filters'](_['pick'](_0x310a65[_0xd373('0x43')],_0x1f9a5a[_0xd373('0x4e')]));_0x267e66[_0xd373('0x4d')][_0xd373('0x62')]=_0x1d5b48['id'];if(_0x310a65['query']['filter']){_0x267e66[_0xd373('0x4d')]=_[_0xd373('0x51')](_0x267e66[_0xd373('0x4d')],{'$or':_[_0xd373('0x68')](_0x267e66[_0xd373('0x47')],function(_0x1a30eb){var _0x16e708={};_0x16e708[_0x1a30eb]={'$like':'%'+_0x310a65[_0xd373('0x43')][_0xd373('0x50')]+'%'};return _0x16e708;})});}_0x267e66=_[_0xd373('0x51')]({},_0x267e66,_0x310a65['options']);return db[_0xd373('0x63')][_0xd373('0x2f')]({'where':_0x267e66[_0xd373('0x4d')]})[_0xd373('0x36')](function(_0x9bdd39){_0x4cd326[_0xd373('0x2f')]=_0x9bdd39;if(_0x310a65[_0xd373('0x43')]['includeAll']){_0x267e66[_0xd373('0x69')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x267e66);})[_0xd373('0x36')](function(_0x43f4a7){_0x4cd326[_0xd373('0x56')]=_0x43f4a7;return _0x4cd326;});}})[_0xd373('0x36')](respondWithFilteredResult(_0x3ce679,_0x267e66))[_0xd373('0x2a')](handleError(_0x3ce679,null));};exports[_0xd373('0x6a')]=function(_0x578a5e,_0x30732e,_0x19eb94){return db[_0xd373('0x54')]['find']({'where':{'id':_0x578a5e[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x30732e,null))[_0xd373('0x36')](function(_0x47ae4c){if(_0x47ae4c){return _0x47ae4c[_0xd373('0x6a')](_0x578a5e[_0xd373('0x43')][_0xd373('0x6b')]);}})['then'](respondWithStatusCode(_0x30732e,null))[_0xd373('0x2a')](handleError(_0x30732e,null));};exports[_0xd373('0x6c')]=function(_0x2059c4,_0x33ca89,_0x715eca){if(_0x2059c4[_0xd373('0x5a')]['id']){delete _0x2059c4[_0xd373('0x5a')]['id'];}return db[_0xd373('0x54')][_0xd373('0x58')]({'where':{'id':_0x2059c4[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x33ca89,null))[_0xd373('0x36')](function(_0x406f52){if(_0x406f52){_0x2059c4['body'][_0xd373('0x62')]=_0x406f52['id'];return db[_0xd373('0x6d')][_0xd373('0x59')](_0x2059c4['body']);}})[_0xd373('0x36')](respondWithResult(_0x33ca89,null))[_0xd373('0x2a')](handleError(_0x33ca89,null));};exports['getAnswers']=function(_0x476501,_0x578096,_0xf93f6b){var _0x473cf1={'raw':![],'where':{}};var _0x2a00e8={};var _0x3bc47a={'count':0x0,'rows':[]};return db[_0xd373('0x54')][_0xd373('0x65')]({'where':{'id':_0x476501['params']['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x578096,null))['then'](function(_0x18e009){if(_0x18e009){_0x2a00e8[_0xd373('0x46')]=_[_0xd373('0x44')](db[_0xd373('0x6d')][_0xd373('0x3f')]);_0x2a00e8['query']=_[_0xd373('0x44')](_0x476501[_0xd373('0x43')]);_0x2a00e8[_0xd373('0x4e')]=_[_0xd373('0x45')](_0x2a00e8[_0xd373('0x46')],_0x2a00e8[_0xd373('0x43')]);_0x473cf1['attributes']=_[_0xd373('0x45')](_0x2a00e8[_0xd373('0x46')],qs[_0xd373('0x48')](_0x476501['query'][_0xd373('0x48')]));_0x473cf1[_0xd373('0x47')]=_0x473cf1['attributes'][_0xd373('0x49')]?_0x473cf1['attributes']:_0x2a00e8[_0xd373('0x46')];if(!_0x476501['query']['hasOwnProperty'](_0xd373('0x66'))){_0x473cf1[_0xd373('0x4b')]=qs[_0xd373('0x4b')](_0x476501[_0xd373('0x43')][_0xd373('0x4b')]);_0x473cf1['offset']=qs[_0xd373('0x30')](_0x476501['query'][_0xd373('0x30')]);}_0x473cf1[_0xd373('0x67')]=qs[_0xd373('0x4c')](_0x476501['query'][_0xd373('0x4c')]);_0x473cf1['where']=qs[_0xd373('0x4e')](_[_0xd373('0x4f')](_0x476501[_0xd373('0x43')],_0x2a00e8[_0xd373('0x4e')]));_0x473cf1[_0xd373('0x4d')]['WhatsappAccountId']=_0x18e009['id'];if(_0x476501[_0xd373('0x43')][_0xd373('0x50')]){_0x473cf1[_0xd373('0x4d')]=_[_0xd373('0x51')](_0x473cf1[_0xd373('0x4d')],{'$or':_[_0xd373('0x68')](_0x473cf1[_0xd373('0x47')],function(_0x4859be){var _0x35e083={};_0x35e083[_0x4859be]={'$like':'%'+_0x476501[_0xd373('0x43')][_0xd373('0x50')]+'%'};return _0x35e083;})});}_0x473cf1=_[_0xd373('0x51')]({},_0x473cf1,_0x476501[_0xd373('0x52')]);return db[_0xd373('0x6d')][_0xd373('0x2f')]({'where':_0x473cf1[_0xd373('0x4d')]})[_0xd373('0x36')](function(_0xbe4347){_0x3bc47a[_0xd373('0x2f')]=_0xbe4347;if(_0x476501[_0xd373('0x43')][_0xd373('0x53')]){_0x473cf1[_0xd373('0x69')]=[{'all':!![]}];}return db[_0xd373('0x6d')][_0xd373('0x55')](_0x473cf1);})[_0xd373('0x36')](function(_0x53644a){_0x3bc47a[_0xd373('0x56')]=_0x53644a;return _0x3bc47a;});}})[_0xd373('0x36')](respondWithFilteredResult(_0x578096,_0x473cf1))['catch'](handleError(_0x578096,null));};exports['removeAnswers']=function(_0x280166,_0x3e7e7c,_0x4bcc80){return db[_0xd373('0x54')][_0xd373('0x58')]({'where':{'id':_0x280166[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x3e7e7c,null))[_0xd373('0x36')](function(_0x4870ca){if(_0x4870ca){return _0x4870ca[_0xd373('0x6e')](_0x280166[_0xd373('0x43')][_0xd373('0x6b')]);}})[_0xd373('0x36')](respondWithStatusCode(_0x3e7e7c,null))[_0xd373('0x2a')](handleError(_0x3e7e7c,null));};exports['addAgents']=function(_0x4e8b06,_0x147e3f,_0x19aed9){return db['WhatsappAccount'][_0xd373('0x58')]({'where':{'id':_0x4e8b06[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x147e3f,null))[_0xd373('0x36')](function(_0x1a3969){if(_0x1a3969){return _0x1a3969[_0xd373('0x6f')](_0x4e8b06['body'][_0xd373('0x6b')],_[_0xd373('0x70')](_0x4e8b06[_0xd373('0x5a')],['ids','id'])||{})[_0xd373('0x71')](function(_0x10b35e){for(var _0x698bd=0x0;_0x698bd<_0x4e8b06['body'][_0xd373('0x6b')][_0xd373('0x49')];_0x698bd+=0x1){socket['emit'](_0xd373('0x72'),{'UserId':_0x4e8b06[_0xd373('0x5a')]['ids'][_0x698bd],'WhatsappAccountId':_0x4e8b06[_0xd373('0x57')]['id']});}return _0x10b35e;});}})['then'](respondWithResult(_0x147e3f,null))[_0xd373('0x2a')](handleError(_0x147e3f,null));};exports[_0xd373('0x73')]=function(_0x3b6ba5,_0x54fef0,_0x585e5b){return db['WhatsappAccount'][_0xd373('0x58')]({'where':{'id':_0x3b6ba5['params']['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x54fef0,null))[_0xd373('0x36')](function(_0x57c629){if(_0x57c629){return _0x57c629[_0xd373('0x73')](_0x3b6ba5['query'][_0xd373('0x6b')])[_0xd373('0x36')](function(){if(_[_0xd373('0x74')](_0x3b6ba5[_0xd373('0x43')][_0xd373('0x6b')])){for(var _0x415d80=0x0;_0x415d80<_0x3b6ba5['query'][_0xd373('0x6b')]['length'];_0x415d80+=0x1){socket[_0xd373('0x75')](_0xd373('0x76'),{'UserId':Number(_0x3b6ba5[_0xd373('0x43')][_0xd373('0x6b')][_0x415d80]),'WhatsappAccountId':Number(_0x3b6ba5[_0xd373('0x57')]['id'])});}}else{socket[_0xd373('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x3b6ba5[_0xd373('0x43')][_0xd373('0x6b')]),'WhatsappAccountId':Number(_0x3b6ba5[_0xd373('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x54fef0,null))[_0xd373('0x2a')](handleError(_0x54fef0,null));};exports[_0xd373('0x77')]=function(_0x3edaa5,_0x2f1dc0,_0x132a55){var _0x783928={};var _0x5ae777={};var _0x1d4551;var _0x59c27d;return db[_0xd373('0x54')][_0xd373('0x65')]({'where':{'id':_0x3edaa5[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x2f1dc0,null))['then'](function(_0x5ccc0e){if(_0x5ccc0e){_0x1d4551=_0x5ccc0e;_0x5ae777[_0xd373('0x46')]=_[_0xd373('0x44')](db[_0xd373('0x78')][_0xd373('0x3f')]);_0x5ae777[_0xd373('0x43')]=_[_0xd373('0x44')](_0x3edaa5['query']);_0x5ae777[_0xd373('0x4e')]=_[_0xd373('0x45')](_0x5ae777['model'],_0x5ae777[_0xd373('0x43')]);_0x783928[_0xd373('0x47')]=_[_0xd373('0x45')](_0x5ae777['model'],qs[_0xd373('0x48')](_0x3edaa5[_0xd373('0x43')]['fields']));_0x783928['attributes']=_0x783928[_0xd373('0x47')][_0xd373('0x49')]?_0x783928[_0xd373('0x47')]:_0x5ae777[_0xd373('0x46')];_0x783928[_0xd373('0x67')]=qs[_0xd373('0x4c')](_0x3edaa5[_0xd373('0x43')]['sort']);_0x783928[_0xd373('0x4d')]=qs[_0xd373('0x4e')](_[_0xd373('0x4f')](_0x3edaa5[_0xd373('0x43')],_0x5ae777[_0xd373('0x4e')]));if(_0x3edaa5['query'][_0xd373('0x50')]){_0x783928[_0xd373('0x4d')]=_['merge'](_0x783928[_0xd373('0x4d')],{'$or':_['map'](_0x783928[_0xd373('0x47')],function(_0xead65e){var _0x1816a7={};_0x1816a7[_0xead65e]={'$like':'%'+_0x3edaa5[_0xd373('0x43')][_0xd373('0x50')]+'%'};return _0x1816a7;})});}_0x783928=_[_0xd373('0x51')]({},_0x783928,_0x3edaa5[_0xd373('0x52')]);return _0x1d4551[_0xd373('0x77')](_0x783928);}})['then'](function(_0x3f98d4){if(_0x3f98d4){_0x59c27d=_0x3f98d4[_0xd373('0x49')];if(!_0x3edaa5[_0xd373('0x43')][_0xd373('0x4a')](_0xd373('0x66'))){_0x783928[_0xd373('0x4b')]=qs['limit'](_0x3edaa5[_0xd373('0x43')][_0xd373('0x4b')]);_0x783928[_0xd373('0x30')]=qs[_0xd373('0x30')](_0x3edaa5[_0xd373('0x43')][_0xd373('0x30')]);}return _0x1d4551[_0xd373('0x77')](_0x783928);}})[_0xd373('0x36')](function(_0x442c3b){if(_0x442c3b){return _0x442c3b?{'count':_0x59c27d,'rows':_0x442c3b}:null;}})['then'](respondWithResult(_0x2f1dc0,null))[_0xd373('0x2a')](handleError(_0x2f1dc0,null));};exports[_0xd373('0x79')]=function(_0x2df849,_0x536c81,_0x14181d){return db['WhatsappAccount']['findOne']({'where':{'id':_0x2df849[_0xd373('0x57')]['id']}})['then'](handleEntityNotFound(_0x536c81,null))[_0xd373('0x36')](function(_0x528ea0){if(_0x528ea0){return db['sequelize']['transaction'](function(_0x570e1e){return db['WhatsappApplication'][_0xd373('0x37')]({'where':{'WhatsappAccountId':_0x2df849[_0xd373('0x57')]['id']},'transaction':_0x570e1e})[_0xd373('0x36')](function(_0x267dbd){var _0x4c7f62=_[_0xd373('0x68')](_0x2df849[_0xd373('0x5a')],function(_0x39cfbf){_0x39cfbf[_0xd373('0x62')]=_0x2df849[_0xd373('0x57')]['id'];return _0x39cfbf;});return db[_0xd373('0x7a')][_0xd373('0x7b')](_0x4c7f62,{'transaction':_0x570e1e});});})[_0xd373('0x36')](function(){return db[_0xd373('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2df849[_0xd373('0x57')]['id']},'order':_0xd373('0x7c')});});}})[_0xd373('0x36')](respondWithResult(_0x536c81,null))['catch'](handleError(_0x536c81,null));};exports[_0xd373('0x7d')]=function(_0x116a86,_0x4fbfbd,_0x4f50fd){var _0x389f22={};var _0x59e7d9={};var _0x435f3e;var _0x4152c6;return db[_0xd373('0x54')][_0xd373('0x65')]({'where':{'id':_0x116a86[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x4fbfbd,null))['then'](function(_0x4b3764){if(_0x4b3764){_0x435f3e=_0x4b3764;_0x59e7d9[_0xd373('0x46')]=_[_0xd373('0x44')](db[_0xd373('0x7a')][_0xd373('0x3f')]);_0x59e7d9['query']=_['keys'](_0x116a86[_0xd373('0x43')]);_0x59e7d9[_0xd373('0x4e')]=_[_0xd373('0x45')](_0x59e7d9[_0xd373('0x46')],_0x59e7d9[_0xd373('0x43')]);_0x389f22['attributes']=_['intersection'](_0x59e7d9[_0xd373('0x46')],qs['fields'](_0x116a86[_0xd373('0x43')][_0xd373('0x48')]));_0x389f22[_0xd373('0x47')]=_0x389f22['attributes'][_0xd373('0x49')]?_0x389f22[_0xd373('0x47')]:_0x59e7d9['model'];_0x389f22[_0xd373('0x67')]=qs[_0xd373('0x4c')](_0x116a86[_0xd373('0x43')]['sort']);_0x389f22[_0xd373('0x4d')]=qs[_0xd373('0x4e')](_[_0xd373('0x4f')](_0x116a86['query'],_0x59e7d9['filters']));if(_0x116a86[_0xd373('0x43')][_0xd373('0x50')]){_0x389f22[_0xd373('0x4d')]=_[_0xd373('0x51')](_0x389f22[_0xd373('0x4d')],{'$or':_[_0xd373('0x68')](_0x389f22[_0xd373('0x47')],function(_0xbceb23){var _0x558917={};_0x558917[_0xbceb23]={'$like':'%'+_0x116a86[_0xd373('0x43')][_0xd373('0x50')]+'%'};return _0x558917;})});}_0x389f22=_[_0xd373('0x51')]({},_0x389f22,_0x116a86[_0xd373('0x52')]);return _0x435f3e['getApplications'](_0x389f22);}})[_0xd373('0x36')](function(_0x53d182){if(_0x53d182){_0x4152c6=_0x53d182[_0xd373('0x49')];if(!_0x116a86[_0xd373('0x43')]['hasOwnProperty'](_0xd373('0x66'))){_0x389f22[_0xd373('0x4b')]=qs[_0xd373('0x4b')](_0x116a86[_0xd373('0x43')][_0xd373('0x4b')]);_0x389f22[_0xd373('0x30')]=qs[_0xd373('0x30')](_0x116a86[_0xd373('0x43')]['offset']);}return _0x435f3e['getApplications'](_0x389f22);}})[_0xd373('0x36')](function(_0x35c0f8){if(_0x35c0f8){return _0x35c0f8?{'count':_0x4152c6,'rows':_0x35c0f8}:null;}})[_0xd373('0x36')](respondWithResult(_0x4fbfbd,null))['catch'](handleError(_0x4fbfbd,null));};exports[_0xd373('0x7e')]=function(_0x2e8acd,_0x5961e6,_0x765bf4){var _0x39d4de={'channel':_0xd373('0x7f')};var _0x442774=[];var _0x170502=[];var _0x1e18a3={};return db[_0xd373('0x54')][_0xd373('0x58')]({'where':{'id':_0x2e8acd[_0xd373('0x57')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xd373('0x80')}]})[_0xd373('0x36')](handleEntityNotFound(_0x5961e6,null))[_0xd373('0x36')](function(_0x8cb4da){_0x39d4de['account']=_0x8cb4da;_0x39d4de[_0xd373('0x81')]=_['orderBy'](_0x8cb4da[_0xd373('0x80')],[_0xd373('0x7c')],[_0xd373('0x82')]);if(_0x39d4de[_0xd373('0x83')][_0xd373('0x80')]){delete _0x39d4de['account']['Applications'];}return db[_0xd373('0x84')][_0xd373('0x60')]();})[_0xd373('0x36')](function(_0x54b879){if(!_0x54b879){throw new db[(_0xd373('0x1d'))][(_0xd373('0x1e'))]('no\x20available\x20attributes');}_0x442774=_['difference'](_['keys'](_0x54b879),[_0xd373('0x85'),'updatedAt']);_0x170502=_[_0xd373('0x86')](_[_0xd373('0x44')](_0x54b879),[_0xd373('0x85'),'updatedAt',_0xd373('0x87'),_0xd373('0x88')]);_0x39d4de[_0xd373('0x5a')]={'mapKey':_0xd373('0x89')};if(_0x39d4de[_0xd373('0x83')][_0xd373('0x41')]&&_0x39d4de['account'][_0xd373('0x41')]==='twilio'){_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')]=_0x2e8acd[_0xd373('0x5a')][_0xd373('0x8b')][_0xd373('0x8c')]('whatsapp:','');_0x39d4de[_0xd373('0x5a')][_0xd373('0x5a')]=_0x2e8acd[_0xd373('0x5a')]['Body'];_0x39d4de[_0xd373('0x5a')]['messageId']=_0x2e8acd['body'][_0xd373('0x8d')];}if(_0x39d4de[_0xd373('0x5a')]['id']){delete _0x39d4de[_0xd373('0x5a')]['id'];}if(_[_0xd373('0x8e')](_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')])){throw new db[(_0xd373('0x1d'))][(_0xd373('0x1e'))](_0xd373('0x8f'));}if(_[_0xd373('0x8e')](_0x39d4de[_0xd373('0x5a')]['body'])||_0x39d4de[_0xd373('0x5a')][_0xd373('0x5a')]===''){throw new db[(_0xd373('0x1d'))]['ValidationError'](_0xd373('0x90'));}if(_[_0xd373('0x8e')](_0x39d4de[_0xd373('0x5a')][_0xd373('0x91')])){throw new db[(_0xd373('0x1d'))][(_0xd373('0x1e'))](_0xd373('0x92')+_0x170502);}if(!_[_0xd373('0x93')](_0x170502,_0x39d4de[_0xd373('0x5a')]['mapKey'])){throw new db[(_0xd373('0x1d'))]['ValidationError'](_0xd373('0x94')+_0x170502);}_0x1e18a3[_0x39d4de['body'][_0xd373('0x91')]]=_0x39d4de[_0xd373('0x5a')]['from'];return db['CmList'][_0xd373('0x58')]({'where':{'id':_0x39d4de['account']['ListId']},'include':[{'model':db[_0xd373('0x84')],'as':'Contacts','where':_0x1e18a3,'limit':0x1,'order':[[_0xd373('0x95'),_0xd373('0x96')]]}]});})[_0xd373('0x36')](handleEntityNotFound(_0x5961e6,null))[_0xd373('0x36')](function(_0x1fe2e1){if(_0x1fe2e1){_0x39d4de['list']=_[_0xd373('0x70')](_0x1fe2e1,[_0xd373('0x97')]);if(_0x1fe2e1[_0xd373('0x97')][_0xd373('0x49')]){return _0x1fe2e1['Contacts'][0x0];}var _0xd93aba=_[_0xd373('0x98')](_0x39d4de[_0xd373('0x5a')],{'firstName':_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')],'ListId':_0x1fe2e1['id']});_0xd93aba[_0x39d4de[_0xd373('0x5a')][_0xd373('0x91')]]=_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')];return db[_0xd373('0x84')][_0xd373('0x59')](_0xd93aba,{'fields':_0x442774,'raw':!![]});}})[_0xd373('0x36')](handleEntityNotFound(_0x5961e6,null))[_0xd373('0x36')](function(_0x38dc69){if(_0x38dc69){_0x39d4de[_0xd373('0x99')]=_0x38dc69;var _0x48bd60={'ContactId':_0x38dc69['id'],'phone':_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')],'WhatsappAccountId':_0x2e8acd[_0xd373('0x57')]['id']};var _0x151771={'ContactId':_0x38dc69['id'],'WhatsappAccountId':_0x2e8acd[_0xd373('0x57')]['id'],'closed':![]};return db[_0xd373('0x9a')][_0xd373('0x58')]({'where':_0x151771})[_0xd373('0x36')](function(_0x3a0df2){if(_0x3a0df2){return[_0x3a0df2,![]];}return db[_0xd373('0x9a')][_0xd373('0x59')](_0x48bd60)[_0xd373('0x36')](function(_0x4dc083){return[_0x4dc083,!![]];});});}})[_0xd373('0x71')](function(_0xb70252,_0x49333f){_0x39d4de[_0xd373('0x9b')]=_0xb70252[_0xd373('0x38')]({'plain':!![]});_0x39d4de[_0xd373('0x9b')]['created']=![];if(_0x49333f){if(_0x39d4de[_0xd373('0x83')][_0xd373('0x9c')]){_0x39d4de[_0xd373('0x81')]['push']({'id':0x0,'priority':_0x39d4de[_0xd373('0x81')][_0xd373('0x49')]+0x1,'app':_0xd373('0x9d'),'appdata':_0xd373('0x9e'),'interval':'*,*,*,*'});}_0x39d4de[_0xd373('0x9b')][_0xd373('0x9f')]=!![];}return db[_0xd373('0xa0')][_0xd373('0x59')]({'phone':_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')],'messageId':_0x39d4de['body'][_0xd373('0xa1')],'body':_0x39d4de[_0xd373('0x5a')][_0xd373('0x5a')],'WhatsappAccountId':_0x2e8acd[_0xd373('0x57')]['id'],'WhatsappInteractionId':_0xb70252['id'],'direction':'in','ContactId':_0xb70252[_0xd373('0xa2')],'AttachmentId':_0x39d4de['body']['AttachmentId']});})[_0xd373('0x36')](function(_0x3bab9c){_0x39d4de['message']=_0x3bab9c;if(_0x39d4de[_0xd373('0x9b')][_0xd373('0xa3')]){return db[_0xd373('0x78')][_0xd373('0x58')]({'attributes':['id',_0xd373('0x42')],'where':{'id':_0x39d4de[_0xd373('0x9b')][_0xd373('0xa3')]}})[_0xd373('0x36')](function(_0x1bbf63){if(_0x1bbf63){_0x39d4de['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xd373('0xa4'),'appdata':_0x1bbf63[_0xd373('0x42')]+','+(_0x39d4de['account'][_0xd373('0xa5')]||0xa),'interval':_0xd373('0xa6')});}return respondWithRpcPromise(_0xd373('0xa7'),_0xd373('0xa8'),_0x39d4de);});}return respondWithRpcPromise(_0xd373('0xa7'),_0xd373('0xa8'),_0x39d4de);})['then'](function(_0x29029b){if(_0x29029b){var _0x42ee7c=0xc8;var _0x221a31=_0xd373('0xa9');logger[_0xd373('0x20')](_0xd373('0x24'),_0x221a31,_0x42ee7c,_0xd373('0xaa'));logger[_0xd373('0x23')](_0xd373('0xab'),_0x221a31,_0x42ee7c,_0xd373('0xaa'),JSON['stringify'](_0x29029b));if(_0x39d4de[_0xd373('0x83')][_0xd373('0x41')]===_0xd373('0xac')){return _0x5961e6[_0xd373('0x2c')](_0x42ee7c)[_0xd373('0x31')]('Content-Type',_0xd373('0xad'))[_0xd373('0xae')](_0xd373('0xaf'));}else{return _0x5961e6[_0xd373('0x2c')](_0x42ee7c)[_0xd373('0x2e')](_0x29029b);}}})[_0xd373('0x2a')](handleError(_0x5961e6,null));};exports[_0xd373('0xae')]=function(_0x23743f,_0x5d6c98,_0x13fe0c){var _0xe5660f,_0x8b94d9,_0x16126a;if(_['isNil'](_0x23743f[_0xd373('0x5a')][_0xd373('0x5a')])||_0x23743f['body'][_0xd373('0x5a')]===''){throw new db[(_0xd373('0x1d'))][(_0xd373('0x1e'))](_0xd373('0x90'));}if(_[_0xd373('0x8e')](_0x23743f[_0xd373('0x5a')]['to'])){throw new db['Sequelize'][(_0xd373('0x1e'))](_0xd373('0xb0'));}_0xe5660f=_0x23743f[_0xd373('0x5a')]['to'];return db[_0xd373('0x54')]['find']({'where':{'id':_0x23743f['params']['id']},'include':[{'model':db['CmList'],'as':_0xd373('0xb1'),'include':[{'model':db[_0xd373('0x84')],'as':_0xd373('0x97'),'where':{'mobile':_0xe5660f},'limit':0x1,'order':[['updatedAt',_0xd373('0x96')]]}]}]})[_0xd373('0x36')](handleEntityNotFound(_0x5d6c98,null))['then'](function(_0x471916){if(_0x471916&&_0x471916[_0xd373('0xb1')]){_0x8b94d9=_0x471916['get']({'plain':!![]});if(_0x8b94d9[_0xd373('0xb1')]&&_0x8b94d9[_0xd373('0xb1')][_0xd373('0x97')][_0xd373('0x49')]){return _0x8b94d9[_0xd373('0xb1')][_0xd373('0x97')][0x0];}return db[_0xd373('0x84')]['create'](_['defaults'](_0x23743f[_0xd373('0x5a')],{'firstName':_0xe5660f,'mobile':_0xe5660f,'phone':_0xe5660f,'ListId':_0x8b94d9['ListId']}));}})[_0xd373('0x36')](handleEntityNotFound(_0x5d6c98,null))['then'](function(_0x1a9169){if(_0x1a9169){_0x16126a=_0x1a9169;return db['WhatsappInteraction'][_0xd373('0x58')]({'where':{'ContactId':_0x16126a['id'],'closed':![],'WhatsappAccountId':_0x8b94d9['id']}})['then'](function(_0x8d4995){if(_0x8d4995){return[_0x8d4995,![]];}return db[_0xd373('0x9a')]['create']({'UserId':_0x23743f[_0xd373('0x5b')]['id'],'ContactId':_0x16126a['id'],'WhatsappAccountId':_0x8b94d9['id'],'phone':_0xe5660f,'firstMsgDirection':_0xd373('0xb2'),'Messages':[_['merge'](_0x23743f[_0xd373('0x5a')],{'read':![],'body':_0x23743f[_0xd373('0x5a')][_0xd373('0x5a')],'phone':_0xe5660f,'WhatsappAccountId':_0x8b94d9['id'],'UserId':_0x23743f[_0xd373('0x5b')]['id'],'ContactId':_0x16126a['id']})]},{'include':[{'model':db[_0xd373('0xa0')],'as':'Messages'}]})[_0xd373('0x36')](function(_0x5b8844){return[_0x5b8844,!![]];});});}})['spread'](function(_0x1851c7,_0x5b1887){if(_0x5b1887){return _0x1851c7;}return db['WhatsappMessage'][_0xd373('0x59')](_[_0xd373('0x51')](_0x23743f[_0xd373('0x5a')],{'read':![],'body':_0x23743f[_0xd373('0x5a')][_0xd373('0x5a')],'phone':_0xe5660f,'WhatsappAccountId':_0x8b94d9['id'],'WhatsappInteractionId':_0x1851c7['id'],'UserId':_0x23743f[_0xd373('0x5b')]['id'],'ContactId':_0x16126a['id']}))[_0xd373('0x36')](function(_0x1bd6f6){_0x1851c7[_0xd373('0xb3')]['Messages']=[];_0x1851c7['dataValues'][_0xd373('0xb4')]['push'](_0x1bd6f6[_0xd373('0xb3')]);return _0x1851c7;});})[_0xd373('0x36')](respondWithResult(_0x5d6c98,null))['catch'](handleError(_0x5d6c98,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 14f6a76..4eed78f 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 _0x3a6d=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a6d,0x143));var _0xd3a6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3a6d[_0x4b055c];return _0x4b62bb;};'use strict';var EventEmitter=require(_0xd3a6('0x0'));var WhatsappAccount=require(_0xd3a6('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd3a6('0x2')](0x0);var events={'afterCreate':_0xd3a6('0x3'),'afterUpdate':_0xd3a6('0x4'),'afterDestroy':_0xd3a6('0x5')};function emitEvent(_0x3d37ff){return function(_0x585473,_0x1cb966,_0x27d641){WhatsappAccountEvents[_0xd3a6('0x6')](_0x3d37ff+':'+_0x585473['id'],_0x585473);WhatsappAccountEvents[_0xd3a6('0x6')](_0x3d37ff,_0x585473);_0x27d641(null);};}for(var e in events){if(events[_0xd3a6('0x7')](e)){var event=events[e];WhatsappAccount[_0xd3a6('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x41d0=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','update'];(function(_0x9f005d,_0x33165a){var _0x74b899=function(_0x3caf5d){while(--_0x3caf5d){_0x9f005d['push'](_0x9f005d['shift']());}};_0x74b899(++_0x33165a);}(_0x41d0,0x1c6));var _0x041d=function(_0x5cc35f,_0x5acd94){_0x5cc35f=_0x5cc35f-0x0;var _0x3f33eb=_0x41d0[_0x5cc35f];return _0x3f33eb;};'use strict';var EventEmitter=require(_0x041d('0x0'));var WhatsappAccount=require(_0x041d('0x1'))['db'][_0x041d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x041d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x041d('0x4'),'afterDestroy':_0x041d('0x5')};function emitEvent(_0x12e55d){return function(_0x397dad,_0x41e587,_0x3a22a4){WhatsappAccountEvents[_0x041d('0x6')](_0x12e55d+':'+_0x397dad['id'],_0x397dad);WhatsappAccountEvents[_0x041d('0x6')](_0x12e55d,_0x397dad);_0x3a22a4(null);};}for(var e in events){if(events[_0x041d('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x041d('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 9e30cea..a27132a 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 _0x5d70=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x7faa88,_0x2c1749){var _0x36366d=function(_0x5164de){while(--_0x5164de){_0x7faa88['push'](_0x7faa88['shift']());}};_0x36366d(++_0x2c1749);}(_0x5d70,0x178));var _0x05d7=function(_0x55a2a5,_0x69abee){_0x55a2a5=_0x55a2a5-0x0;var _0x4c9817=_0x5d70[_0x55a2a5];return _0x4c9817;};'use strict';var _=require(_0x05d7('0x0'));var util=require(_0x05d7('0x1'));var logger=require('../../config/logger')(_0x05d7('0x2'));var moment=require(_0x05d7('0x3'));var BPromise=require(_0x05d7('0x4'));var rp=require(_0x05d7('0x5'));var fs=require('fs');var path=require(_0x05d7('0x6'));var rimraf=require(_0x05d7('0x7'));var config=require(_0x05d7('0x8'));var attributes=require(_0x05d7('0x9'));module[_0x05d7('0xa')]=function(_0xea36c9,_0x3dc15a){return _0xea36c9[_0x05d7('0xb')](_0x05d7('0xc'),attributes,{'tableName':_0x05d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cc8=['WhatsappAccount','lodash','util','../../config/logger','bluebird','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x5d76c0,_0x362f06){var _0x15cb7e=function(_0x91bf70){while(--_0x91bf70){_0x5d76c0['push'](_0x5d76c0['shift']());}};_0x15cb7e(++_0x362f06);}(_0x6cc8,0x169));var _0x86cc=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x6cc8[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x86cc('0x0'));var util=require(_0x86cc('0x1'));var logger=require(_0x86cc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x86cc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x86cc('0x4'));var attributes=require(_0x86cc('0x5'));module[_0x86cc('0x6')]=function(_0x4886b3,_0x258cbd){return _0x4886b3[_0x86cc('0x7')](_0x86cc('0x8'),attributes,{'tableName':'whatsapp_accounts','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 604a4cd..dcd3e7c 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 _0x7e37=['then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','model','map','info','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','request'];(function(_0x4e733,_0x141980){var _0x3b37d3=function(_0x3eaa7d){while(--_0x3eaa7d){_0x4e733['push'](_0x4e733['shift']());}};_0x3b37d3(++_0x141980);}(_0x7e37,0xf3));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x77e3('0x0'));var util=require(_0x77e3('0x1'));var moment=require(_0x77e3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77e3('0x3'));var db=require(_0x77e3('0x4'))['db'];var utils=require(_0x77e3('0x5'));var logger=require(_0x77e3('0x6'))(_0x77e3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x77e3('0x8')][_0x77e3('0x9')]({'port':0x232a});config[_0x77e3('0xa')]=_[_0x77e3('0xb')](config[_0x77e3('0xa')],{'host':_0x77e3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77e3('0xa')]));require(_0x77e3('0xd'))[_0x77e3('0xe')](socket);function respondWithRpcPromise(_0x4921a6,_0x3b0237,_0x1881e4){return new BPromise(function(_0x376ebe,_0xa7f512){return client[_0x77e3('0xf')](_0x4921a6,_0x1881e4)[_0x77e3('0x10')](function(_0x44ee78){logger['info'](_0x77e3('0x11'),_0x3b0237,_0x77e3('0x12'));logger[_0x77e3('0x13')](_0x77e3('0x14'),_0x3b0237,_0x77e3('0x12'),JSON[_0x77e3('0x15')](_0x44ee78));if(_0x44ee78[_0x77e3('0x16')]){if(_0x44ee78[_0x77e3('0x16')][_0x77e3('0x17')]===0x1f4){logger[_0x77e3('0x16')](_0x77e3('0x11'),_0x3b0237,_0x44ee78['error']['message']);return _0xa7f512(_0x44ee78[_0x77e3('0x16')]['message']);}logger['error'](_0x77e3('0x11'),_0x3b0237,_0x44ee78[_0x77e3('0x16')][_0x77e3('0x18')]);return _0x376ebe(_0x44ee78[_0x77e3('0x16')]['message']);}else{logger['info'](_0x77e3('0x11'),_0x3b0237,_0x77e3('0x12'));_0x376ebe(_0x44ee78[_0x77e3('0x19')]['message']);}})[_0x77e3('0x1a')](function(_0x14545c){logger[_0x77e3('0x16')](_0x77e3('0x11'),_0x3b0237,_0x14545c);_0xa7f512(_0x14545c);});});}exports[_0x77e3('0x1b')]=function(_0x4311d1){var _0x3f3562=this;return new Promise(function(_0x3bce45,_0x10dcfb){return db[_0x77e3('0x1c')][_0x77e3('0x1d')]({'raw':_0x4311d1['options']?_0x4311d1[_0x77e3('0x1e')][_0x77e3('0x1f')]===undefined?!![]:![]:!![],'where':_0x4311d1[_0x77e3('0x1e')]?_0x4311d1[_0x77e3('0x1e')]['where']||null:null,'attributes':_0x4311d1['options']?_0x4311d1[_0x77e3('0x1e')][_0x77e3('0x20')]||null:null,'include':_0x4311d1[_0x77e3('0x1e')]?_0x4311d1[_0x77e3('0x1e')][_0x77e3('0x21')]?_['map'](_0x4311d1[_0x77e3('0x1e')][_0x77e3('0x21')],function(_0x2b4ed5){return{'model':db[_0x2b4ed5[_0x77e3('0x22')]],'as':_0x2b4ed5['as'],'attributes':_0x2b4ed5[_0x77e3('0x20')],'include':_0x2b4ed5[_0x77e3('0x21')]?_[_0x77e3('0x23')](_0x2b4ed5[_0x77e3('0x21')],function(_0x40df0d){return{'model':db[_0x40df0d[_0x77e3('0x22')]],'as':_0x40df0d['as'],'attributes':_0x40df0d[_0x77e3('0x20')],'include':_0x40df0d[_0x77e3('0x21')]?_[_0x77e3('0x23')](_0x40df0d[_0x77e3('0x21')],function(_0x12ea20){return{'model':db[_0x12ea20[_0x77e3('0x22')]],'as':_0x12ea20['as'],'attributes':_0x12ea20[_0x77e3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9b3d3f){logger[_0x77e3('0x24')](_0x77e3('0x1b'),_0x4311d1);logger['debug'](_0x77e3('0x1b'),_0x4311d1,JSON['stringify'](_0x9b3d3f));_0x3bce45(_0x9b3d3f);})[_0x77e3('0x1a')](function(_0x2be6e4){logger[_0x77e3('0x16')](_0x77e3('0x1b'),_0x2be6e4[_0x77e3('0x18')],_0x4311d1);_0x10dcfb(_0x3f3562[_0x77e3('0x16')](0x1f4,_0x2be6e4[_0x77e3('0x18')]));});});}; \ No newline at end of file +var _0x16e8=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','defaults','redis','localhost','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1ad759,_0x534529){var _0x553a8e=function(_0x16f8ec){while(--_0x16f8ec){_0x1ad759['push'](_0x1ad759['shift']());}};_0x553a8e(++_0x534529);}(_0x16e8,0x106));var _0x816e=function(_0x30b49c,_0x4dcce5){_0x30b49c=_0x30b49c-0x0;var _0x2b2f63=_0x16e8[_0x30b49c];return _0x2b2f63;};'use strict';var _=require('lodash');var util=require(_0x816e('0x0'));var moment=require(_0x816e('0x1'));var BPromise=require(_0x816e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x816e('0x3'));var db=require(_0x816e('0x4'))['db'];var utils=require(_0x816e('0x5'));var logger=require('../../config/logger')(_0x816e('0x6'));var config=require('../../config/environment');var jayson=require(_0x816e('0x7'));var client=jayson['client'][_0x816e('0x8')]({'port':0x232a});config['redis']=_[_0x816e('0x9')](config[_0x816e('0xa')],{'host':_0x816e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x816e('0xa')]));require('./whatsappAccount.socket')[_0x816e('0xc')](socket);function respondWithRpcPromise(_0x49a325,_0x58b814,_0x2210fe){return new BPromise(function(_0x337372,_0x3e355d){return client[_0x816e('0xd')](_0x49a325,_0x2210fe)[_0x816e('0xe')](function(_0x38e4cd){logger[_0x816e('0xf')](_0x816e('0x10'),_0x58b814,_0x816e('0x11'));logger[_0x816e('0x12')](_0x816e('0x13'),_0x58b814,_0x816e('0x11'),JSON[_0x816e('0x14')](_0x38e4cd));if(_0x38e4cd[_0x816e('0x15')]){if(_0x38e4cd[_0x816e('0x15')][_0x816e('0x16')]===0x1f4){logger[_0x816e('0x15')](_0x816e('0x10'),_0x58b814,_0x38e4cd[_0x816e('0x15')][_0x816e('0x17')]);return _0x3e355d(_0x38e4cd['error'][_0x816e('0x17')]);}logger['error'](_0x816e('0x10'),_0x58b814,_0x38e4cd[_0x816e('0x15')][_0x816e('0x17')]);return _0x337372(_0x38e4cd[_0x816e('0x15')][_0x816e('0x17')]);}else{logger[_0x816e('0xf')](_0x816e('0x10'),_0x58b814,'request\x20sent');_0x337372(_0x38e4cd[_0x816e('0x18')][_0x816e('0x17')]);}})[_0x816e('0x19')](function(_0x3d471b){logger[_0x816e('0x15')](_0x816e('0x10'),_0x58b814,_0x3d471b);_0x3e355d(_0x3d471b);});});}exports[_0x816e('0x1a')]=function(_0x5020b2){var _0x156b25=this;return new Promise(function(_0x353d0b,_0x435f49){return db[_0x816e('0x1b')]['find']({'raw':_0x5020b2[_0x816e('0x1c')]?_0x5020b2[_0x816e('0x1c')][_0x816e('0x1d')]===undefined?!![]:![]:!![],'where':_0x5020b2['options']?_0x5020b2[_0x816e('0x1c')][_0x816e('0x1e')]||null:null,'attributes':_0x5020b2[_0x816e('0x1c')]?_0x5020b2[_0x816e('0x1c')][_0x816e('0x1f')]||null:null,'include':_0x5020b2[_0x816e('0x1c')]?_0x5020b2[_0x816e('0x1c')][_0x816e('0x20')]?_[_0x816e('0x21')](_0x5020b2[_0x816e('0x1c')][_0x816e('0x20')],function(_0x3f9c82){return{'model':db[_0x3f9c82[_0x816e('0x22')]],'as':_0x3f9c82['as'],'attributes':_0x3f9c82[_0x816e('0x1f')],'include':_0x3f9c82[_0x816e('0x20')]?_[_0x816e('0x21')](_0x3f9c82[_0x816e('0x20')],function(_0xd57ebf){return{'model':db[_0xd57ebf[_0x816e('0x22')]],'as':_0xd57ebf['as'],'attributes':_0xd57ebf[_0x816e('0x1f')],'include':_0xd57ebf[_0x816e('0x20')]?_[_0x816e('0x21')](_0xd57ebf[_0x816e('0x20')],function(_0x2ad4b4){return{'model':db[_0x2ad4b4['model']],'as':_0x2ad4b4['as'],'attributes':_0x2ad4b4[_0x816e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x816e('0xe')](function(_0x23c280){logger[_0x816e('0xf')](_0x816e('0x1a'),_0x5020b2);logger[_0x816e('0x12')](_0x816e('0x1a'),_0x5020b2,JSON[_0x816e('0x14')](_0x23c280));_0x353d0b(_0x23c280);})['catch'](function(_0x1fc66e){logger['error'](_0x816e('0x1a'),_0x1fc66e[_0x816e('0x17')],_0x5020b2);_0x435f49(_0x156b25[_0x816e('0x15')](0x1f4,_0x1fc66e[_0x816e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 009b078..28118ae 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 _0xf629=['remove','update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x995b86,_0x10fe93){var _0x93fae=function(_0x4316c5){while(--_0x4316c5){_0x995b86['push'](_0x995b86['shift']());}};_0x93fae(++_0x10fe93);}(_0xf629,0xc7));var _0x9f62=function(_0x30e225,_0x669769){_0x30e225=_0x30e225-0x0;var _0x489d21=_0xf629[_0x30e225];return _0x489d21;};'use strict';var WhatsappAccountEvents=require(_0x9f62('0x0'));var events=['save',_0x9f62('0x1'),_0x9f62('0x2')];function createListener(_0x12140d,_0x4cef49){return function(_0x125642){_0x4cef49[_0x9f62('0x3')](_0x12140d,_0x125642);};}function removeListener(_0x4320fd,_0x1b9786){return function(){WhatsappAccountEvents[_0x9f62('0x4')](_0x4320fd,_0x1b9786);};}exports[_0x9f62('0x5')]=function(_0xe87962){for(var _0x53f1c1=0x0,_0x1b36e0=events[_0x9f62('0x6')];_0x53f1c1<_0x1b36e0;_0x53f1c1++){var _0x3ff563=events[_0x53f1c1];var _0x3b059a=createListener(_0x9f62('0x7')+_0x3ff563,_0xe87962);WhatsappAccountEvents['on'](_0x3ff563,_0x3b059a);}}; \ No newline at end of file +var _0x2e9b=['emit','register','length','whatsappAccount:','remove','update'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x2e9b,0xd0));var _0xb2e9=function(_0x50a627,_0xb78c80){_0x50a627=_0x50a627-0x0;var _0x1677cf=_0x2e9b[_0x50a627];return _0x1677cf;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xb2e9('0x0'),_0xb2e9('0x1')];function createListener(_0x340341,_0x458202){return function(_0x549970){_0x458202[_0xb2e9('0x2')](_0x340341,_0x549970);};}function removeListener(_0x46b974,_0x7bcfe2){return function(){WhatsappAccountEvents['removeListener'](_0x46b974,_0x7bcfe2);};}exports[_0xb2e9('0x3')]=function(_0x5b85cc){for(var _0x191f76=0x0,_0x29e339=events[_0xb2e9('0x4')];_0x191f76<_0x29e339;_0x191f76++){var _0xeb22e8=events[_0x191f76];var _0x5eb854=createListener(_0xb2e9('0x5')+_0xeb22e8,_0x5b85cc);WhatsappAccountEvents['on'](_0xeb22e8,_0x5eb854);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 6f962bd..e3a7f23 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 _0xc125=['isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./whatsappApplication.controller','get'];(function(_0x15f430,_0x4e86ee){var _0x36dfa3=function(_0x5bed94){while(--_0x5bed94){_0x15f430['push'](_0x15f430['shift']());}};_0x36dfa3(++_0x4e86ee);}(_0xc125,0x195));var _0x5c12=function(_0x4e31d0,_0x3ca476){_0x4e31d0=_0x4e31d0-0x0;var _0x224e9b=_0xc125[_0x4e31d0];return _0x224e9b;};'use strict';var multer=require(_0x5c12('0x0'));var util=require(_0x5c12('0x1'));var path=require(_0x5c12('0x2'));var timeout=require(_0x5c12('0x3'));var express=require(_0x5c12('0x4'));var router=express[_0x5c12('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5c12('0x6'));var config=require('../../config/environment');var controller=require(_0x5c12('0x7'));router[_0x5c12('0x8')]('/',auth[_0x5c12('0x9')](),controller[_0x5c12('0xa')]);router[_0x5c12('0x8')](_0x5c12('0xb'),auth[_0x5c12('0x9')](),controller[_0x5c12('0xc')]);router[_0x5c12('0xd')]('/',auth[_0x5c12('0x9')](),controller['create']);router['put']('/:id',auth[_0x5c12('0x9')](),controller[_0x5c12('0xe')]);router[_0x5c12('0xf')](_0x5c12('0xb'),auth[_0x5c12('0x9')](),controller[_0x5c12('0x10')]);module[_0x5c12('0x11')]=router; \ No newline at end of file +var _0x711b=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x8f4439,_0x52fc0f){var _0x21aabc=function(_0x34c8a5){while(--_0x34c8a5){_0x8f4439['push'](_0x8f4439['shift']());}};_0x21aabc(++_0x52fc0f);}(_0x711b,0x16a));var _0xb711=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x711b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb711('0x0'));var util=require(_0xb711('0x1'));var path=require(_0xb711('0x2'));var timeout=require(_0xb711('0x3'));var express=require(_0xb711('0x4'));var router=express[_0xb711('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb711('0x6'));var config=require(_0xb711('0x7'));var controller=require(_0xb711('0x8'));router[_0xb711('0x9')]('/',auth['isAuthenticated'](),controller[_0xb711('0xa')]);router['get'](_0xb711('0xb'),auth[_0xb711('0xc')](),controller[_0xb711('0xd')]);router[_0xb711('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb711('0xf')](_0xb711('0xb'),auth[_0xb711('0xc')](),controller[_0xb711('0x10')]);router[_0xb711('0x11')](_0xb711('0xb'),auth[_0xb711('0xc')](),controller['destroy']);module[_0xb711('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 0f9fe38..51da5ff 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 _0x8d57=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d57,0xaf));var _0x78d5=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x8d57[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require('sequelize');module[_0x78d5('0x0')]={'priority':{'type':Sequelize[_0x78d5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x78d5('0x2')],'allowNull':![],'defaultValue':_0x78d5('0x3')},'appdata':{'type':Sequelize[_0x78d5('0x4')]()},'description':{'type':Sequelize[_0x78d5('0x2')]},'interval':{'type':Sequelize[_0x78d5('0x2')],'defaultValue':_0x78d5('0x5')}}; \ No newline at end of file +var _0x7a98=['noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x2edd3f,_0x514bee){var _0x1026b3=function(_0x11a8ec){while(--_0x11a8ec){_0x2edd3f['push'](_0x2edd3f['shift']());}};_0x1026b3(++_0x514bee);}(_0x7a98,0x190));var _0x87a9=function(_0x197415,_0x166cd0){_0x197415=_0x197415-0x0;var _0x55d65c=_0x7a98[_0x197415];return _0x55d65c;};'use strict';var Sequelize=require(_0x87a9('0x0'));module[_0x87a9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x87a9('0x2')},'appdata':{'type':Sequelize[_0x87a9('0x3')]()},'description':{'type':Sequelize[_0x87a9('0x4')]},'interval':{'type':Sequelize[_0x87a9('0x4')],'defaultValue':_0x87a9('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index da2abba..e08ce15 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 _0xb544=['../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','WhatsappApplication','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','includeAll','include','findAll','catch','params','keys','options','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xb544,0xc4));var _0x4b54=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xb544[_0x36884e];return _0x1cc367;};'use strict';var pdf=require(_0x4b54('0x0'));var emlformat=require(_0x4b54('0x1'));var rimraf=require(_0x4b54('0x2'));var zipdir=require(_0x4b54('0x3'));var jsonpatch=require(_0x4b54('0x4'));var rp=require(_0x4b54('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4b54('0x6'));var util=require(_0x4b54('0x7'));var path=require(_0x4b54('0x8'));var sox=require(_0x4b54('0x9'));var csv=require(_0x4b54('0xa'));var ejs=require(_0x4b54('0xb'));var fs=require('fs');var _=require(_0x4b54('0xc'));var squel=require(_0x4b54('0xd'));var crypto=require(_0x4b54('0xe'));var jsforce=require(_0x4b54('0xf'));var deskjs=require(_0x4b54('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4b54('0x11'));var Redis=require('ioredis');var authService=require(_0x4b54('0x12'));var qs=require(_0x4b54('0x13'));var as=require(_0x4b54('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b54('0x15'))(_0x4b54('0x16'));var utils=require(_0x4b54('0x17'));var config=require('../../config/environment');var db=require(_0x4b54('0x18'))['db'];function respondWithStatusCode(_0x15198a,_0x5ce7e5){_0x5ce7e5=_0x5ce7e5||0xcc;return function(_0x1da139){if(_0x1da139){return _0x15198a[_0x4b54('0x19')](_0x5ce7e5);}return _0x15198a[_0x4b54('0x1a')](_0x5ce7e5)[_0x4b54('0x1b')]();};}function respondWithResult(_0x3ea995,_0x1d6393){_0x1d6393=_0x1d6393||0xc8;return function(_0x53cb27){if(_0x53cb27){return _0x3ea995[_0x4b54('0x1a')](_0x1d6393)[_0x4b54('0x1c')](_0x53cb27);}};}function respondWithFilteredResult(_0x49af64,_0x210033){return function(_0x1ad05d){if(_0x1ad05d){var _0x1e8dd8=_0x1ad05d[_0x4b54('0x1d')],_0x22fdfb=_0x210033[_0x4b54('0x1e')],_0x9c59fd=_0x210033[_0x4b54('0x1e')]+_0x210033[_0x4b54('0x1f')],_0x440f4a;if(_0x9c59fd>=_0x1e8dd8){_0x9c59fd=_0x1e8dd8;_0x440f4a=0xc8;}else{_0x440f4a=0xce;}_0x49af64[_0x4b54('0x1a')](_0x440f4a);return _0x49af64[_0x4b54('0x20')]('Content-Range',_0x22fdfb+'-'+_0x9c59fd+'/'+_0x1e8dd8)[_0x4b54('0x1c')](_0x1ad05d);}return null;};}function patchUpdates(_0x568c61){return function(_0x57191d){try{jsonpatch[_0x4b54('0x21')](_0x57191d,_0x568c61,!![]);}catch(_0x1923dc){return BPromise[_0x4b54('0x22')](_0x1923dc);}return _0x57191d[_0x4b54('0x23')]();};}function saveUpdates(_0x5476f0,_0x38a0d5){return function(_0x28b2e8){if(_0x28b2e8){return _0x28b2e8['update'](_0x5476f0)[_0x4b54('0x24')](function(_0x1237b1){return _0x1237b1;});}return null;};}function removeEntity(_0xc22567,_0x5a09e5){return function(_0x563d48){if(_0x563d48){return _0x563d48[_0x4b54('0x25')]()['then'](function(){_0xc22567['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31fdfa,_0xd30210){return function(_0x27012b){if(!_0x27012b){_0x31fdfa[_0x4b54('0x19')](0x194);}return _0x27012b;};}function handleError(_0x914944,_0x2118fb){_0x2118fb=_0x2118fb||0x1f4;return function(_0x50f5d3){logger[_0x4b54('0x26')](_0x50f5d3[_0x4b54('0x27')]);if(_0x50f5d3[_0x4b54('0x28')]){delete _0x50f5d3[_0x4b54('0x28')];}_0x914944[_0x4b54('0x1a')](_0x2118fb)[_0x4b54('0x29')](_0x50f5d3);};}exports['index']=function(_0x405caa,_0x5e4e7d){var _0x5dc1bc={},_0x9b67f6={},_0xa440df={'count':0x0,'rows':[]};var _0x390b6f=_['map'](db[_0x4b54('0x2a')][_0x4b54('0x2b')],function(_0x388d24){return{'name':_0x388d24['fieldName'],'type':_0x388d24[_0x4b54('0x2c')][_0x4b54('0x2d')]};});_0x9b67f6[_0x4b54('0x2e')]=_[_0x4b54('0x2f')](_0x390b6f,'name');_0x9b67f6[_0x4b54('0x30')]=_['keys'](_0x405caa[_0x4b54('0x30')]);_0x9b67f6[_0x4b54('0x31')]=_[_0x4b54('0x32')](_0x9b67f6[_0x4b54('0x2e')],_0x9b67f6[_0x4b54('0x30')]);_0x5dc1bc[_0x4b54('0x33')]=_[_0x4b54('0x32')](_0x9b67f6[_0x4b54('0x2e')],qs[_0x4b54('0x34')](_0x405caa[_0x4b54('0x30')][_0x4b54('0x34')]));_0x5dc1bc[_0x4b54('0x33')]=_0x5dc1bc[_0x4b54('0x33')][_0x4b54('0x35')]?_0x5dc1bc[_0x4b54('0x33')]:_0x9b67f6[_0x4b54('0x2e')];if(!_0x405caa[_0x4b54('0x30')][_0x4b54('0x36')](_0x4b54('0x37'))){_0x5dc1bc[_0x4b54('0x1f')]=qs['limit'](_0x405caa['query'][_0x4b54('0x1f')]);_0x5dc1bc['offset']=qs[_0x4b54('0x1e')](_0x405caa[_0x4b54('0x30')][_0x4b54('0x1e')]);}_0x5dc1bc[_0x4b54('0x38')]=qs[_0x4b54('0x39')](_0x405caa['query'][_0x4b54('0x39')]);_0x5dc1bc['where']=qs[_0x4b54('0x31')](_[_0x4b54('0x3a')](_0x405caa[_0x4b54('0x30')],_0x9b67f6['filters']),_0x390b6f);if(_0x405caa[_0x4b54('0x30')]['filter']){_0x5dc1bc[_0x4b54('0x3b')]=_[_0x4b54('0x3c')](_0x5dc1bc[_0x4b54('0x3b')],{'$or':_[_0x4b54('0x2f')](_0x390b6f,function(_0x2fc166){if(_0x2fc166[_0x4b54('0x2c')]!==_0x4b54('0x3d')){var _0x1a899a={};_0x1a899a[_0x2fc166[_0x4b54('0x28')]]={'$like':'%'+_0x405caa[_0x4b54('0x30')]['filter']+'%'};return _0x1a899a;}})});}_0x5dc1bc=_[_0x4b54('0x3c')]({},_0x5dc1bc,_0x405caa['options']);var _0x2927fc={'where':_0x5dc1bc[_0x4b54('0x3b')]};return db[_0x4b54('0x2a')]['count'](_0x2927fc)[_0x4b54('0x24')](function(_0x200154){_0xa440df[_0x4b54('0x1d')]=_0x200154;if(_0x405caa[_0x4b54('0x30')][_0x4b54('0x3e')]){_0x5dc1bc[_0x4b54('0x3f')]=[{'all':!![]}];}return db[_0x4b54('0x2a')][_0x4b54('0x40')](_0x5dc1bc);})[_0x4b54('0x24')](function(_0x1533d8){_0xa440df['rows']=_0x1533d8;return _0xa440df;})[_0x4b54('0x24')](respondWithFilteredResult(_0x5e4e7d,_0x5dc1bc))[_0x4b54('0x41')](handleError(_0x5e4e7d,null));};exports['show']=function(_0x29e927,_0x7ac083){var _0x498271={'raw':!![],'where':{'id':_0x29e927[_0x4b54('0x42')]['id']}},_0x66414e={};_0x66414e[_0x4b54('0x2e')]=_[_0x4b54('0x43')](db[_0x4b54('0x2a')][_0x4b54('0x2b')]);_0x66414e['query']=_[_0x4b54('0x43')](_0x29e927[_0x4b54('0x30')]);_0x66414e[_0x4b54('0x31')]=_[_0x4b54('0x32')](_0x66414e['model'],_0x66414e[_0x4b54('0x30')]);_0x498271[_0x4b54('0x33')]=_[_0x4b54('0x32')](_0x66414e[_0x4b54('0x2e')],qs['fields'](_0x29e927[_0x4b54('0x30')][_0x4b54('0x34')]));_0x498271[_0x4b54('0x33')]=_0x498271[_0x4b54('0x33')]['length']?_0x498271[_0x4b54('0x33')]:_0x66414e[_0x4b54('0x2e')];if(_0x29e927[_0x4b54('0x30')][_0x4b54('0x3e')]){_0x498271['include']=[{'all':!![]}];}_0x498271=_[_0x4b54('0x3c')]({},_0x498271,_0x29e927[_0x4b54('0x44')]);return db[_0x4b54('0x2a')][_0x4b54('0x45')](_0x498271)[_0x4b54('0x24')](handleEntityNotFound(_0x7ac083,null))[_0x4b54('0x24')](respondWithResult(_0x7ac083,null))[_0x4b54('0x41')](handleError(_0x7ac083,null));};exports[_0x4b54('0x46')]=function(_0xaa45ad,_0x3ef890){return db[_0x4b54('0x2a')][_0x4b54('0x46')](_0xaa45ad[_0x4b54('0x47')],{})[_0x4b54('0x24')](respondWithResult(_0x3ef890,0xc9))[_0x4b54('0x41')](handleError(_0x3ef890,null));};exports[_0x4b54('0x48')]=function(_0x1ffa2c,_0x23be0e){if(_0x1ffa2c[_0x4b54('0x47')]['id']){delete _0x1ffa2c[_0x4b54('0x47')]['id'];}return db[_0x4b54('0x2a')][_0x4b54('0x45')]({'where':{'id':_0x1ffa2c['params']['id']}})[_0x4b54('0x24')](handleEntityNotFound(_0x23be0e,null))[_0x4b54('0x24')](saveUpdates(_0x1ffa2c[_0x4b54('0x47')],null))[_0x4b54('0x24')](respondWithResult(_0x23be0e,null))[_0x4b54('0x41')](handleError(_0x23be0e,null));};exports['destroy']=function(_0x4690ad,_0x2182a8){return db[_0x4b54('0x2a')][_0x4b54('0x45')]({'where':{'id':_0x4690ad[_0x4b54('0x42')]['id']}})['then'](handleEntityNotFound(_0x2182a8,null))[_0x4b54('0x24')](removeEntity(_0x2182a8,null))['catch'](handleError(_0x2182a8,null));}; \ No newline at end of file +var _0x1efa=['sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../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','update','then','error','name','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path'];(function(_0x20ea89,_0x1bfce6){var _0x1f06a8=function(_0xc541ce){while(--_0xc541ce){_0x20ea89['push'](_0x20ea89['shift']());}};_0x1f06a8(++_0x1bfce6);}(_0x1efa,0x10c));var _0xa1ef=function(_0x3fa96e,_0x577a78){_0x3fa96e=_0x3fa96e-0x0;var _0x3067ae=_0x1efa[_0x3fa96e];return _0x3067ae;};'use strict';var pdf=require(_0xa1ef('0x0'));var emlformat=require(_0xa1ef('0x1'));var rimraf=require(_0xa1ef('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1ef('0x3'));var rp=require(_0xa1ef('0x4'));var moment=require('moment');var BPromise=require(_0xa1ef('0x5'));var Mustache=require('mustache');var util=require(_0xa1ef('0x6'));var path=require(_0xa1ef('0x7'));var sox=require(_0xa1ef('0x8'));var csv=require(_0xa1ef('0x9'));var ejs=require(_0xa1ef('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa1ef('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa1ef('0xc'));var toCsv=require(_0xa1ef('0x9'));var querystring=require(_0xa1ef('0xd'));var Papa=require(_0xa1ef('0xe'));var Redis=require('ioredis');var authService=require(_0xa1ef('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa1ef('0x10'));var hardwareService=require(_0xa1ef('0x11'));var logger=require(_0xa1ef('0x12'))(_0xa1ef('0x13'));var utils=require(_0xa1ef('0x14'));var config=require(_0xa1ef('0x15'));var db=require(_0xa1ef('0x16'))['db'];function respondWithStatusCode(_0x42afaf,_0x35780b){_0x35780b=_0x35780b||0xcc;return function(_0x35ffc8){if(_0x35ffc8){return _0x42afaf[_0xa1ef('0x17')](_0x35780b);}return _0x42afaf[_0xa1ef('0x18')](_0x35780b)[_0xa1ef('0x19')]();};}function respondWithResult(_0x4e115c,_0xe91a49){_0xe91a49=_0xe91a49||0xc8;return function(_0x29e7c4){if(_0x29e7c4){return _0x4e115c[_0xa1ef('0x18')](_0xe91a49)[_0xa1ef('0x1a')](_0x29e7c4);}};}function respondWithFilteredResult(_0x5dfefd,_0x3d3689){return function(_0x1a8d8e){if(_0x1a8d8e){var _0x6dc80d=_0x1a8d8e[_0xa1ef('0x1b')],_0x246ff5=_0x3d3689['offset'],_0x1f149a=_0x3d3689[_0xa1ef('0x1c')]+_0x3d3689[_0xa1ef('0x1d')],_0x2bec70;if(_0x1f149a>=_0x6dc80d){_0x1f149a=_0x6dc80d;_0x2bec70=0xc8;}else{_0x2bec70=0xce;}_0x5dfefd[_0xa1ef('0x18')](_0x2bec70);return _0x5dfefd[_0xa1ef('0x1e')](_0xa1ef('0x1f'),_0x246ff5+'-'+_0x1f149a+'/'+_0x6dc80d)[_0xa1ef('0x1a')](_0x1a8d8e);}return null;};}function patchUpdates(_0xc2546a){return function(_0x4b5545){try{jsonpatch['apply'](_0x4b5545,_0xc2546a,!![]);}catch(_0x560a6c){return BPromise['reject'](_0x560a6c);}return _0x4b5545['save']();};}function saveUpdates(_0x73c015,_0x8e9a91){return function(_0xc8d2df){if(_0xc8d2df){return _0xc8d2df[_0xa1ef('0x20')](_0x73c015)[_0xa1ef('0x21')](function(_0xf66bb3){return _0xf66bb3;});}return null;};}function removeEntity(_0x123798,_0x57404f){return function(_0x4698b3){if(_0x4698b3){return _0x4698b3['destroy']()['then'](function(){_0x123798[_0xa1ef('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21466c,_0x12a4e2){return function(_0x886e2f){if(!_0x886e2f){_0x21466c[_0xa1ef('0x17')](0x194);}return _0x886e2f;};}function handleError(_0x4b2452,_0x3c1cdd){_0x3c1cdd=_0x3c1cdd||0x1f4;return function(_0x243b30){logger[_0xa1ef('0x22')](_0x243b30['stack']);if(_0x243b30[_0xa1ef('0x23')]){delete _0x243b30[_0xa1ef('0x23')];}_0x4b2452[_0xa1ef('0x18')](_0x3c1cdd)['send'](_0x243b30);};}exports['index']=function(_0x19526f,_0x5ca5c7){var _0x4bd053={},_0xd16215={},_0x4c8a79={'count':0x0,'rows':[]};var _0x5e3ed1=_[_0xa1ef('0x24')](db[_0xa1ef('0x25')][_0xa1ef('0x26')],function(_0x1e30c7){return{'name':_0x1e30c7[_0xa1ef('0x27')],'type':_0x1e30c7[_0xa1ef('0x28')][_0xa1ef('0x29')]};});_0xd16215[_0xa1ef('0x2a')]=_['map'](_0x5e3ed1,'name');_0xd16215[_0xa1ef('0x2b')]=_[_0xa1ef('0x2c')](_0x19526f[_0xa1ef('0x2b')]);_0xd16215[_0xa1ef('0x2d')]=_[_0xa1ef('0x2e')](_0xd16215[_0xa1ef('0x2a')],_0xd16215[_0xa1ef('0x2b')]);_0x4bd053[_0xa1ef('0x2f')]=_[_0xa1ef('0x2e')](_0xd16215[_0xa1ef('0x2a')],qs[_0xa1ef('0x30')](_0x19526f['query'][_0xa1ef('0x30')]));_0x4bd053[_0xa1ef('0x2f')]=_0x4bd053[_0xa1ef('0x2f')]['length']?_0x4bd053[_0xa1ef('0x2f')]:_0xd16215['model'];if(!_0x19526f[_0xa1ef('0x2b')][_0xa1ef('0x31')]('nolimit')){_0x4bd053[_0xa1ef('0x1d')]=qs[_0xa1ef('0x1d')](_0x19526f[_0xa1ef('0x2b')]['limit']);_0x4bd053['offset']=qs[_0xa1ef('0x1c')](_0x19526f[_0xa1ef('0x2b')][_0xa1ef('0x1c')]);}_0x4bd053[_0xa1ef('0x32')]=qs['sort'](_0x19526f[_0xa1ef('0x2b')][_0xa1ef('0x33')]);_0x4bd053['where']=qs[_0xa1ef('0x2d')](_[_0xa1ef('0x34')](_0x19526f[_0xa1ef('0x2b')],_0xd16215[_0xa1ef('0x2d')]),_0x5e3ed1);if(_0x19526f[_0xa1ef('0x2b')][_0xa1ef('0x35')]){_0x4bd053[_0xa1ef('0x36')]=_[_0xa1ef('0x37')](_0x4bd053[_0xa1ef('0x36')],{'$or':_[_0xa1ef('0x24')](_0x5e3ed1,function(_0x125b98){if(_0x125b98[_0xa1ef('0x28')]!=='VIRTUAL'){var _0x215f20={};_0x215f20[_0x125b98['name']]={'$like':'%'+_0x19526f['query'][_0xa1ef('0x35')]+'%'};return _0x215f20;}})});}_0x4bd053=_[_0xa1ef('0x37')]({},_0x4bd053,_0x19526f[_0xa1ef('0x38')]);var _0x3dbee2={'where':_0x4bd053[_0xa1ef('0x36')]};return db[_0xa1ef('0x25')][_0xa1ef('0x1b')](_0x3dbee2)[_0xa1ef('0x21')](function(_0x2f08e7){_0x4c8a79[_0xa1ef('0x1b')]=_0x2f08e7;if(_0x19526f[_0xa1ef('0x2b')]['includeAll']){_0x4bd053[_0xa1ef('0x39')]=[{'all':!![]}];}return db[_0xa1ef('0x25')][_0xa1ef('0x3a')](_0x4bd053);})[_0xa1ef('0x21')](function(_0x5c6551){_0x4c8a79[_0xa1ef('0x3b')]=_0x5c6551;return _0x4c8a79;})[_0xa1ef('0x21')](respondWithFilteredResult(_0x5ca5c7,_0x4bd053))[_0xa1ef('0x3c')](handleError(_0x5ca5c7,null));};exports[_0xa1ef('0x3d')]=function(_0x1175e6,_0x3ff011){var _0x37b6c2={'raw':!![],'where':{'id':_0x1175e6[_0xa1ef('0x3e')]['id']}},_0x3bbbbf={};_0x3bbbbf[_0xa1ef('0x2a')]=_[_0xa1ef('0x2c')](db[_0xa1ef('0x25')]['rawAttributes']);_0x3bbbbf[_0xa1ef('0x2b')]=_['keys'](_0x1175e6['query']);_0x3bbbbf[_0xa1ef('0x2d')]=_['intersection'](_0x3bbbbf[_0xa1ef('0x2a')],_0x3bbbbf[_0xa1ef('0x2b')]);_0x37b6c2[_0xa1ef('0x2f')]=_[_0xa1ef('0x2e')](_0x3bbbbf[_0xa1ef('0x2a')],qs['fields'](_0x1175e6[_0xa1ef('0x2b')]['fields']));_0x37b6c2['attributes']=_0x37b6c2['attributes'][_0xa1ef('0x3f')]?_0x37b6c2[_0xa1ef('0x2f')]:_0x3bbbbf[_0xa1ef('0x2a')];if(_0x1175e6['query'][_0xa1ef('0x40')]){_0x37b6c2[_0xa1ef('0x39')]=[{'all':!![]}];}_0x37b6c2=_['merge']({},_0x37b6c2,_0x1175e6[_0xa1ef('0x38')]);return db['WhatsappApplication']['find'](_0x37b6c2)[_0xa1ef('0x21')](handleEntityNotFound(_0x3ff011,null))[_0xa1ef('0x21')](respondWithResult(_0x3ff011,null))[_0xa1ef('0x3c')](handleError(_0x3ff011,null));};exports['create']=function(_0x3df2fd,_0x4a0af0){return db['WhatsappApplication'][_0xa1ef('0x41')](_0x3df2fd[_0xa1ef('0x42')],{})[_0xa1ef('0x21')](respondWithResult(_0x4a0af0,0xc9))[_0xa1ef('0x3c')](handleError(_0x4a0af0,null));};exports[_0xa1ef('0x20')]=function(_0x3c9064,_0x6b80b6){if(_0x3c9064[_0xa1ef('0x42')]['id']){delete _0x3c9064['body']['id'];}return db[_0xa1ef('0x25')][_0xa1ef('0x43')]({'where':{'id':_0x3c9064[_0xa1ef('0x3e')]['id']}})['then'](handleEntityNotFound(_0x6b80b6,null))['then'](saveUpdates(_0x3c9064[_0xa1ef('0x42')],null))['then'](respondWithResult(_0x6b80b6,null))[_0xa1ef('0x3c')](handleError(_0x6b80b6,null));};exports[_0xa1ef('0x44')]=function(_0x2c26e3,_0x1a32d2){return db[_0xa1ef('0x25')]['find']({'where':{'id':_0x2c26e3[_0xa1ef('0x3e')]['id']}})[_0xa1ef('0x21')](handleEntityNotFound(_0x1a32d2,null))[_0xa1ef('0x21')](removeEntity(_0x1a32d2,null))[_0xa1ef('0x3c')](handleError(_0x1a32d2,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index db480e0..c735d62 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 _0x2deb=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','whatsapp_applications','utf8mb4','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var logger=require(_0xb2de('0x2'))(_0xb2de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb2de('0x4'));var fs=require('fs');var path=require(_0xb2de('0x5'));var rimraf=require(_0xb2de('0x6'));var config=require(_0xb2de('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x201fcc,_0x2ed8ec){return _0x201fcc[_0xb2de('0x8')]('WhatsappApplication',attributes,{'tableName':_0xb2de('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb2de('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb9be=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0x1f713b,_0x1e789f){var _0x534b7f=function(_0x8b7189){while(--_0x8b7189){_0x1f713b['push'](_0x1f713b['shift']());}};_0x534b7f(++_0x1e789f);}(_0xb9be,0xc5));var _0xeb9b=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0xb9be[_0x22e9fe];return _0x47cd19;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var logger=require(_0xeb9b('0x2'))(_0xeb9b('0x3'));var moment=require(_0xeb9b('0x4'));var BPromise=require(_0xeb9b('0x5'));var rp=require(_0xeb9b('0x6'));var fs=require('fs');var path=require(_0xeb9b('0x7'));var rimraf=require(_0xeb9b('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xeb9b('0x9')]=function(_0x181810,_0x2529cb){return _0x181810['define'](_0xeb9b('0xa'),attributes,{'tableName':_0xeb9b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb9b('0xc'),'collate':_0xeb9b('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index d8d2d7b..fec4255 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 _0x9a5a=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x135ee2,_0x3dca87){var _0x560132=function(_0x4fb1d4){while(--_0x4fb1d4){_0x135ee2['push'](_0x135ee2['shift']());}};_0x560132(++_0x3dca87);}(_0x9a5a,0x194));var _0xa9a5=function(_0x5cb939,_0x37fad3){_0x5cb939=_0x5cb939-0x0;var _0x394f18=_0x9a5a[_0x5cb939];return _0x394f18;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var moment=require(_0xa9a5('0x2'));var BPromise=require(_0xa9a5('0x3'));var rs=require(_0xa9a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9a5('0x5'))['db'];var utils=require(_0xa9a5('0x6'));var logger=require(_0xa9a5('0x7'))(_0xa9a5('0x8'));var config=require(_0xa9a5('0x9'));var jayson=require(_0xa9a5('0xa'));var client=jayson['client'][_0xa9a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37e93b,_0x20bbe8,_0x1eafa6){return new BPromise(function(_0x24e1bd,_0x5f2e83){return client['request'](_0x37e93b,_0x1eafa6)['then'](function(_0xc95120){logger[_0xa9a5('0xc')](_0xa9a5('0xd'),_0x20bbe8,_0xa9a5('0xe'));logger[_0xa9a5('0xf')](_0xa9a5('0x10'),_0x20bbe8,_0xa9a5('0xe'),JSON['stringify'](_0xc95120));if(_0xc95120['error']){if(_0xc95120['error'][_0xa9a5('0x11')]===0x1f4){logger[_0xa9a5('0x12')](_0xa9a5('0xd'),_0x20bbe8,_0xc95120[_0xa9a5('0x12')][_0xa9a5('0x13')]);return _0x5f2e83(_0xc95120['error'][_0xa9a5('0x13')]);}logger[_0xa9a5('0x12')](_0xa9a5('0xd'),_0x20bbe8,_0xc95120[_0xa9a5('0x12')][_0xa9a5('0x13')]);return _0x24e1bd(_0xc95120[_0xa9a5('0x12')]['message']);}else{logger[_0xa9a5('0xc')](_0xa9a5('0xd'),_0x20bbe8,_0xa9a5('0xe'));_0x24e1bd(_0xc95120[_0xa9a5('0x14')]['message']);}})[_0xa9a5('0x15')](function(_0x106cbf){logger[_0xa9a5('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x20bbe8,_0x106cbf);_0x5f2e83(_0x106cbf);});});} \ No newline at end of file +var _0xec46=['jayson/promise','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1c13f1,_0x108f31){var _0x5db4a6=function(_0x27fcaf){while(--_0x27fcaf){_0x1c13f1['push'](_0x1c13f1['shift']());}};_0x5db4a6(++_0x108f31);}(_0xec46,0x19c));var _0x6ec4=function(_0x389b98,_0x58b439){_0x389b98=_0x389b98-0x0;var _0x65b7c6=_0xec46[_0x389b98];return _0x65b7c6;};'use strict';var _=require(_0x6ec4('0x0'));var util=require(_0x6ec4('0x1'));var moment=require(_0x6ec4('0x2'));var BPromise=require(_0x6ec4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ec4('0x4'))['db'];var utils=require(_0x6ec4('0x5'));var logger=require(_0x6ec4('0x6'))('rpc');var config=require(_0x6ec4('0x7'));var jayson=require(_0x6ec4('0x8'));var client=jayson['client'][_0x6ec4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d260,_0x1f6d1a,_0x391ed9){return new BPromise(function(_0x42b81b,_0xe47f57){return client[_0x6ec4('0xa')](_0x55d260,_0x391ed9)[_0x6ec4('0xb')](function(_0x384cf){logger[_0x6ec4('0xc')](_0x6ec4('0xd'),_0x1f6d1a,_0x6ec4('0xe'));logger[_0x6ec4('0xf')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1f6d1a,'request\x20sent',JSON[_0x6ec4('0x10')](_0x384cf));if(_0x384cf[_0x6ec4('0x11')]){if(_0x384cf[_0x6ec4('0x11')]['code']===0x1f4){logger[_0x6ec4('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x1f6d1a,_0x384cf[_0x6ec4('0x11')]['message']);return _0xe47f57(_0x384cf[_0x6ec4('0x11')][_0x6ec4('0x12')]);}logger[_0x6ec4('0x11')](_0x6ec4('0xd'),_0x1f6d1a,_0x384cf[_0x6ec4('0x11')]['message']);return _0x42b81b(_0x384cf[_0x6ec4('0x11')][_0x6ec4('0x12')]);}else{logger[_0x6ec4('0xc')](_0x6ec4('0xd'),_0x1f6d1a,_0x6ec4('0xe'));_0x42b81b(_0x384cf[_0x6ec4('0x13')][_0x6ec4('0x12')]);}})[_0x6ec4('0x14')](function(_0x19ffc8){logger[_0x6ec4('0x11')](_0x6ec4('0xd'),_0x1f6d1a,_0x19ffc8);_0xe47f57(_0x19ffc8);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d778d23..214d8fa 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 _0x0af7=['../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1101c6,_0x121cca){var _0x49b9ea=function(_0x132f14){while(--_0x132f14){_0x1101c6['push'](_0x1101c6['shift']());}};_0x49b9ea(++_0x121cca);}(_0x0af7,0x17b));var _0x70af=function(_0x33ca9d,_0x34ea92){_0x33ca9d=_0x33ca9d-0x0;var _0x1767e2=_0x0af7[_0x33ca9d];return _0x1767e2;};'use strict';var multer=require(_0x70af('0x0'));var util=require('util');var path=require(_0x70af('0x1'));var timeout=require(_0x70af('0x2'));var express=require(_0x70af('0x3'));var router=express[_0x70af('0x4')]();var auth=require(_0x70af('0x5'));var interaction=require(_0x70af('0x6'));var config=require('../../config/environment');var controller=require(_0x70af('0x7'));router[_0x70af('0x8')]('/',auth[_0x70af('0x9')](),controller[_0x70af('0xa')]);router['get'](_0x70af('0xb'),auth[_0x70af('0x9')](),controller[_0x70af('0xc')]);router['get'](_0x70af('0xd'),auth['isAuthenticated'](),controller[_0x70af('0xe')]);router[_0x70af('0x8')](_0x70af('0xf'),auth['isAuthenticated'](),controller[_0x70af('0x10')]);router[_0x70af('0x8')](_0x70af('0x11'),auth[_0x70af('0x9')](),controller[_0x70af('0x12')]);router[_0x70af('0x13')]('/',auth[_0x70af('0x9')](),controller[_0x70af('0x14')]);router[_0x70af('0x13')]('/:id/messages',auth[_0x70af('0x9')](),controller[_0x70af('0x15')]);router[_0x70af('0x13')]('/:id/tags',auth[_0x70af('0x9')](),interaction[_0x70af('0x16')](_0x70af('0x17'),_0x70af('0x18')),controller[_0x70af('0x19')]);router[_0x70af('0x1a')](_0x70af('0xd'),auth['isAuthenticated'](),interaction[_0x70af('0x16')](_0x70af('0x17'),_0x70af('0x1b')),controller[_0x70af('0x1c')]);router[_0x70af('0x1d')](_0x70af('0xd'),auth[_0x70af('0x9')](),interaction[_0x70af('0x16')](_0x70af('0x17'),_0x70af('0x1e')),controller[_0x70af('0x1f')]);router[_0x70af('0x1d')](_0x70af('0x20'),auth['isAuthenticated'](),controller[_0x70af('0x21')]);module[_0x70af('0x22')]=router; \ No newline at end of file +var _0x10d3=['whatsappinteraction:addtags','tracked','whatsapp','update','delete','whatsappinteraction:destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x10d3,0x7e));var _0x310d=function(_0x384b96,_0x5163f1){_0x384b96=_0x384b96-0x0;var _0x1c1468=_0x10d3[_0x384b96];return _0x1c1468;};'use strict';var multer=require('multer');var util=require(_0x310d('0x0'));var path=require(_0x310d('0x1'));var timeout=require(_0x310d('0x2'));var express=require('express');var router=express[_0x310d('0x3')]();var auth=require(_0x310d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x310d('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x310d('0x6')]('/',auth[_0x310d('0x7')](),controller[_0x310d('0x8')]);router[_0x310d('0x6')](_0x310d('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x310d('0x6')](_0x310d('0xa'),auth[_0x310d('0x7')](),controller[_0x310d('0xb')]);router[_0x310d('0x6')](_0x310d('0xc'),auth['isAuthenticated'](),controller[_0x310d('0xd')]);router['get'](_0x310d('0xe'),auth[_0x310d('0x7')](),controller['download']);router[_0x310d('0xf')]('/',auth[_0x310d('0x7')](),controller[_0x310d('0x10')]);router[_0x310d('0xf')](_0x310d('0xc'),auth[_0x310d('0x7')](),controller['addMessage']);router[_0x310d('0xf')](_0x310d('0x11'),auth[_0x310d('0x7')](),interaction['tracked']('whatsapp',_0x310d('0x12')),controller['addTags']);router['put'](_0x310d('0xa'),auth['isAuthenticated'](),interaction[_0x310d('0x13')](_0x310d('0x14'),'whatsappinteraction:update'),controller[_0x310d('0x15')]);router[_0x310d('0x16')](_0x310d('0xa'),auth['isAuthenticated'](),interaction[_0x310d('0x13')](_0x310d('0x14'),_0x310d('0x17')),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 957a90a..9d0f42b 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 _0x698d=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x5a611f,_0x12b98b){var _0x458388=function(_0x291ec9){while(--_0x291ec9){_0x5a611f['push'](_0x5a611f['shift']());}};_0x458388(++_0x12b98b);}(_0x698d,0x9f));var _0xd698=function(_0x340c51,_0x4c4fc1){_0x340c51=_0x340c51-0x0;var _0x4b265c=_0x698d[_0x340c51];return _0x4b265c;};'use strict';var Sequelize=require(_0xd698('0x0'));var moment=require(_0xd698('0x1'));module['exports']={'closed':{'type':Sequelize[_0xd698('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd698('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd698('0x4')]},'phone':{'type':Sequelize[_0xd698('0x4')]},'read1stAt':{'type':Sequelize[_0xd698('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd698('0x5')]('in',_0xd698('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x191a=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x36ad8d,_0x104e69){var _0x5da06e=function(_0x1ff03c){while(--_0x1ff03c){_0x36ad8d['push'](_0x36ad8d['shift']());}};_0x5da06e(++_0x104e69);}(_0x191a,0x1b6));var _0xa191=function(_0x43b6da,_0x5f52fc){_0x43b6da=_0x43b6da-0x0;var _0x3ad946=_0x191a[_0x43b6da];return _0x3ad946;};'use strict';var Sequelize=require(_0xa191('0x0'));var moment=require('moment');module[_0xa191('0x1')]={'closed':{'type':Sequelize[_0xa191('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa191('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa191('0x4')]},'phone':{'type':Sequelize[_0xa191('0x4')]},'read1stAt':{'type':Sequelize[_0xa191('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa191('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa191('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'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 4a05fa1..84f2ae2 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 _0xadb5=['field','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','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','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','find','UserId','buildExpression','start','body','keys','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','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?','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.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','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','N.A.','closed','disposition','basename','createReadStream','createWriteStream','direction','out','System','renderFile','views','downloadInteraction.html','toFile','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','attributes','fields','length','limit','order','sort','filters','pick','select'];(function(_0x49f37b,_0x5b6832){var _0x32b34c=function(_0x4c7bab){while(--_0x4c7bab){_0x49f37b['push'](_0x49f37b['shift']());}};_0x32b34c(++_0x5b6832);}(_0xadb5,0xad));var _0x5adb=function(_0x30351b,_0x129e0b){_0x30351b=_0x30351b-0x0;var _0x2b82f8=_0xadb5[_0x30351b];return _0x2b82f8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];config['redis']=_[_0x5adb('0x18')](config['redis'],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config[_0x5adb('0x1b')]));require('./whatsappInteraction.socket')[_0x5adb('0x1c')](socket);function respondWithStatusCode(_0x34af2c,_0xf82f72){_0xf82f72=_0xf82f72||0xcc;return function(_0x5263ec){if(_0x5263ec){return _0x34af2c[_0x5adb('0x1d')](_0xf82f72);}return _0x34af2c['status'](_0xf82f72)[_0x5adb('0x1e')]();};}function respondWithResult(_0x42a482,_0x30614e){_0x30614e=_0x30614e||0xc8;return function(_0x304784){if(_0x304784){return _0x42a482[_0x5adb('0x1f')](_0x30614e)[_0x5adb('0x20')](_0x304784);}};}function respondWithFilteredResult(_0xa29dc,_0x42f4c6){return function(_0xb953a6){if(_0xb953a6){var _0x529b65=_0xb953a6['count'],_0x3fff62=_0x42f4c6[_0x5adb('0x21')],_0x5de028=_0x42f4c6['offset']+_0x42f4c6['limit'],_0x1d9e86;if(_0x5de028>=_0x529b65){_0x5de028=_0x529b65;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xa29dc[_0x5adb('0x1f')](_0x1d9e86);return _0xa29dc[_0x5adb('0x22')](_0x5adb('0x23'),_0x3fff62+'-'+_0x5de028+'/'+_0x529b65)[_0x5adb('0x20')](_0xb953a6);}return null;};}function patchUpdates(_0x99bc6c){return function(_0x5af69d){try{jsonpatch[_0x5adb('0x24')](_0x5af69d,_0x99bc6c,!![]);}catch(_0x5c296e){return BPromise['reject'](_0x5c296e);}return _0x5af69d[_0x5adb('0x25')]();};}function saveUpdates(_0x379b33,_0x1a38d3){return function(_0x1a8014){if(_0x1a8014){return _0x1a8014[_0x5adb('0x26')](_0x379b33)[_0x5adb('0x27')](function(_0xfd9bb9){return _0xfd9bb9;});}return null;};}function removeEntity(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){return _0x373cc3[_0x5adb('0x28')]()[_0x5adb('0x27')](function(){_0x4ca150[_0x5adb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fee18,_0x2e1e63){return function(_0x5aed76){if(!_0x5aed76){_0x2fee18[_0x5adb('0x1d')](0x194);}return _0x5aed76;};}function handleError(_0x1ded9f,_0x1a0acd){_0x1a0acd=_0x1a0acd||0x1f4;return function(_0x55b40a){logger[_0x5adb('0x29')](_0x55b40a[_0x5adb('0x2a')]);if(_0x55b40a[_0x5adb('0x2b')]){delete _0x55b40a[_0x5adb('0x2b')];}_0x1ded9f[_0x5adb('0x1f')](_0x1a0acd)[_0x5adb('0x2c')](_0x55b40a);};}function getInteractionUsers(_0x4a5d46,_0x49992e){return new BPromise(function(_0x5d457e,_0x39bddd){try{if(_0x49992e[_0x4a5d46['id']]){_0x4a5d46[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x49992e[_0x4a5d46['id']],function(_0x512bab){return{'id':_0x512bab['id'],'fullname':_0x512bab[_0x5adb('0x2f')]};});}}catch(_0x4de310){_0x39bddd(_0x4de310);}_0x5d457e(_0x4a5d46);});}function getInteractionTags(_0x11ec2a,_0x34b793){return new BPromise(function(_0x372da1,_0x3b1fed){try{if(_0x11ec2a[_0x5adb('0x30')]){_0x11ec2a[_0x5adb('0x31')]=[];_0x11ec2a[_0x5adb('0x30')][_0x5adb('0x32')](',')[_0x5adb('0x33')](function(_0x260295){_0x11ec2a['Tags'][_0x5adb('0x34')](_0x34b793[_0x260295]);});}delete _0x11ec2a['TagIds'];}catch(_0x12424d){_0x3b1fed(_0x12424d);}_0x372da1(_0x11ec2a);});}function updateWhatsappInteraction(_0x20cde6,_0x5d1441,_0x226390){return new BPromise(function(_0xe389ca,_0x461a39){return getInteractionUsers(_0x20cde6,_0x226390)['then'](function(_0x173789){return getInteractionTags(_0x173789,_0x5d1441);})[_0x5adb('0x27')](function(_0x4b5887){_0xe389ca(_0x4b5887);})['catch'](function(_0x1ed9ea){_0x461a39(_0x1ed9ea);});});}exports['index']=function(_0x663ea0,_0x222568){var _0x3c2b07={},_0x2da912={},_0x9bdece={'count':0x0,'rows':[]};var _0x5ece39=_[_0x5adb('0x2e')](db[_0x5adb('0x35')][_0x5adb('0x36')],function(_0x54851b){return{'name':_0x54851b['fieldName'],'type':_0x54851b[_0x5adb('0x37')][_0x5adb('0x38')]};});_0x2da912['model']=_[_0x5adb('0x2e')](_0x5ece39,'name');_0x2da912[_0x5adb('0x39')]=_['keys'](_0x663ea0[_0x5adb('0x39')]);_0x2da912['filters']=_[_0x5adb('0x3a')](_0x2da912[_0x5adb('0x3b')],_0x2da912['query']);_0x3c2b07[_0x5adb('0x3c')]=_['intersection'](_0x2da912[_0x5adb('0x3b')],qs[_0x5adb('0x3d')](_0x663ea0[_0x5adb('0x39')]['fields']));_0x3c2b07[_0x5adb('0x3c')]=_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x3c2b07[_0x5adb('0x3c')]:_0x2da912[_0x5adb('0x3b')];if(!_0x663ea0['query']['hasOwnProperty']('nolimit')){_0x3c2b07['limit']=qs[_0x5adb('0x3f')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3f')]);_0x3c2b07[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x3c2b07[_0x5adb('0x40')]=qs['sort'](_0x663ea0['query'][_0x5adb('0x41')]);_0x3c2b07['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x663ea0[_0x5adb('0x39')],_0x2da912[_0x5adb('0x42')]),_0x5ece39);var _0xdfecfd=[];var _0x522ee5=squel[_0x5adb('0x44')]()[_0x5adb('0x45')]('id')['field'](_0x5adb('0x2b'))[_0x5adb('0x45')]('color')[_0x5adb('0x46')](_0x5adb('0x47'));var _0x1d6bef=squel[_0x5adb('0x44')]()[_0x5adb('0x45')](_0x5adb('0x48'))[_0x5adb('0x45')]('u.fullname')['field'](_0x5adb('0x49'))[_0x5adb('0x46')](_0x5adb('0x4a'),'ui')[_0x5adb('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0xaa32e4=squel[_0x5adb('0x44')]()[_0x5adb('0x46')](_0x5adb('0x4c'),'i')[_0x5adb('0x4b')]('cm_contacts','c',_0x5adb('0x4d'))[_0x5adb('0x4b')]('users','o',_0x5adb('0x4e'))[_0x5adb('0x4b')](_0x5adb('0x4f'),'a',_0x5adb('0x50'))[_0x5adb('0x4b')](_0x5adb('0x51'),'me',_0x5adb('0x52'))[_0x5adb('0x4b')]('whatsapp_interaction_has_tags','it',_0x5adb('0x53'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3cd211=squel[_0x5adb('0x54')]();var _0x207a81=[];var _0x4ba0b5=squel[_0x5adb('0x54')]();var _0x5cbab5;if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x55')]){_0x5cbab5=as[_0x5adb('0x56')](_0x663ea0['query'][_0x5adb('0x55')]);var _0x560bac=_0x5cbab5[_0x5adb('0x57')];for(var _0x6dc067=0x0;_0x6dc067<_0x5cbab5['conditions'][_0x5adb('0x3e')];_0x6dc067++){var _0x1ab97b=_0x5cbab5[_0x5adb('0x58')][_0x6dc067];var _0x101008='i';var _0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x1ab97b[_0x5adb('0x45')]]);if(!_0x372734){switch(_0x1ab97b[_0x5adb('0x45')]){case _0x5adb('0x59'):if(_0x1ab97b['value']==0x1){_0xaa32e4[_0x5adb('0x5a')]('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5b'));}else{_0xaa32e4['having']('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5c'));}break;case _0x5adb('0x5d'):if(_0x1ab97b[_0x5adb('0x5e')]==='$substring'){if(_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')]('\x20')[_0x5adb('0x3e')]>0x1){_0x3cd211[_0x560bac](_0x5adb('0x60'),qs[_0x5adb('0x61')](_0x1ab97b['value']),null);}else{var _0x378938='%'+_0x1ab97b['value']+'%';_0x3cd211[_0x560bac](_0x5adb('0x62'),_0x378938,_0x378938,_0x378938);}}else{_0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x63')]);_0x1ab97b[_0x5adb('0x45')]=_0x5adb('0x63');_0x836b91=as['buildExpression'](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')]['start'],_0x836b91['value']['end']);}break;case _0x5adb('0x65'):var _0x31a1f9=_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')](',')[_0x5adb('0x2e')](function(_0xb06bee){return Number(_0xb06bee);});_0x31a1f9[_0x5adb('0x33')](function(_0x8d7810){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x8d7810+',%');});_0x207a81=_[_0x5adb('0x67')](_0x207a81,_0x31a1f9);break;case _0x5adb('0x68'):if(_0x1ab97b[_0x5adb('0x5e')]===_0x5adb('0x69')){_0x3cd211[_0x560bac]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1ab97b['value']+'%',null);}else{_0x372734=_[_0x5adb('0x6a')](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x6b')]);_0x1ab97b[_0x5adb('0x45')]='UserId';_0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}break;case _0x5adb('0x6e'):_0x836b91=as[_0x5adb('0x6c')]('me',null,_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);break;}}else{var _0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}}}else{var _0x7287ac=_(_0x663ea0['query'])[_0x5adb('0x6f')]()[_0x5adb('0x2e')](function(_0x24e1ab){return _['some'](_0x5ece39,[_0x5adb('0x2b'),_0x24e1ab])?_0x24e1ab:undefined;})[_0x5adb('0x70')]()['value']();if(!_[_0x5adb('0x71')](_0x7287ac)){_0x7287ac[_0x5adb('0x33')](function(_0x248739){if(_0x248739===_0x5adb('0x72')){_0xaa32e4['where'](_0x5adb('0x73'),[][_0x5adb('0x74')](_0x663ea0[_0x5adb('0x39')][_0x248739]));}else if(_0x248739===_0x5adb('0x75')){var _0x5b7556=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])['$gte'];var _0x4d635f=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])[_0x5adb('0x76')];_0xaa32e4['where'](_0x5adb('0x77'),_0x5b7556,_0x4d635f);}else{if(_0x663ea0[_0x5adb('0x39')][_0x248739]===_0x5adb('0x78')){_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7a'));}else{_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7b'),_0x663ea0[_0x5adb('0x39')][_0x248739]);}}});}if(_0x663ea0['query']['read']){if(_0x663ea0['query'][_0x5adb('0x7c')]==0x1){_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7d'));}else{_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7e'));}}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]){_0x207a81=_[_0x5adb('0x80')](_0x663ea0['query']['tag'])?_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]:new Array(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]);_0x207a81[_0x5adb('0x33')](function(_0x335de5){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x335de5+',%');});}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x81')]){var _0x3b5ecf=_0x663ea0['query'][_0x5adb('0x81')][_0x5adb('0x82')]('\x5c','\x5c\x5c')[_0x5adb('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5adb('0x83')](_0x3b5ecf)){_0x3cd211['or'](_0x5adb('0x84'),_0x3b5ecf+'%')['or']('i.phone\x20LIKE\x20?',_0x3b5ecf+'%');}else{_0x3cd211['or'](_0x5adb('0x85'),qs['getFullTextValue'](_0x3b5ecf))['or'](_0x5adb('0x86'),_0x3b5ecf+'%');}}}_0xaa32e4[_0x5adb('0x79')](_0x3cd211);_0xaa32e4['group'](_0x5adb('0x87'));var _0x1ceb72={'type':db[_0x5adb('0x88')][_0x5adb('0x89')][_0x5adb('0x8a')],'raw':!![]};var _0x10f54a=_0xaa32e4[_0x5adb('0x8b')]();_0x10f54a[_0x5adb('0x45')]('i.id');_0x10f54a[_0x5adb('0x45')](_0x5adb('0x8c'),_0x5adb('0x59'));if(_0x3c2b07['order']){_0x3c2b07['order'][_0x5adb('0x33')](function(_0x4fd8f7){_0xaa32e4[_0x5adb('0x40')]('i.'+_0x4fd8f7[0x0],_0x4fd8f7[0x1]===_0x5adb('0x8d')?![]:!![]);});}if(!_[_0x5adb('0x71')](_0x207a81)){_0xaa32e4['having'](_0x4ba0b5);_0x10f54a[_0x5adb('0x79')](_0x5adb('0x8e'),_0x207a81);}BPromise[_0x5adb('0x8f')]()[_0x5adb('0x27')](function(){if(!_0x5cbab5){if(_0x663ea0[_0x5adb('0x39')]['WhatsappAccountId']||_0x663ea0[_0x5adb('0x39')][_0x5adb('0x90')])return;_0x10f54a[_0x5adb('0x79')](_0x5adb('0x91'));_0xaa32e4['where'](_0x5adb('0x91'));return;}return _0x663ea0[_0x5adb('0x92')][_0x5adb('0x93')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x27')](function(_0x15d4f1){if(_[_0x5adb('0x71')](_0x15d4f1)){_0x10f54a[_0x5adb('0x79')]('i.WhatsappAccountId\x20IS\x20NULL');_0xaa32e4[_0x5adb('0x79')](_0x5adb('0x94'));}else{_0x10f54a['where'](_0x5adb('0x73'),_[_0x5adb('0x2e')](_0x15d4f1,'id'));_0xaa32e4['where'](_0x5adb('0x73'),_['map'](_0x15d4f1,'id'));}});})[_0x5adb('0x27')](function(){db[_0x5adb('0x95')]['query'](_0x10f54a[_0x5adb('0x96')](),_0x1ceb72)['then'](function(_0x2f6415){_0x9bdece[_0x5adb('0x97')]=_0x2f6415[_0x5adb('0x3e')];if(_0x9bdece[_0x5adb('0x97')]===0x0)return[];return db[_0x5adb('0x95')]['query'](_0x522ee5[_0x5adb('0x96')](),_0x1ceb72)[_0x5adb('0x27')](function(_0x3f33c0){_0xdfecfd=_[_0x5adb('0x98')](_0x3f33c0,'id');_0x1ceb72=_['merge'](_0x1ceb72,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3d')]){_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x33')](function(_0x277668){_0xaa32e4[_0x5adb('0x45')]('i.'+_0x277668);});}else{_0xaa32e4[_0x5adb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5adb('0x59'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x99'),_0x5adb('0x9a'));_0xaa32e4['field'](_0x5adb('0x9b'),_0x5adb('0x9c'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9d'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9e'),_0x5adb('0x9f'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa0'),'Contact.lastName');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa1'),'Contact.email');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa2'),_0x5adb('0xa3'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa4'),_0x5adb('0xa5'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa6'),'Contact.fax');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa7'),'Owner.fullname');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa8'),_0x5adb('0xa9'));_0xaa32e4['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5adb('0x30'));}if(_0x3c2b07[_0x5adb('0x3f')])_0xaa32e4[_0x5adb('0x3f')](_0x3c2b07['limit']);if(_0x3c2b07[_0x5adb('0x21')])_0xaa32e4[_0x5adb('0x21')](_0x3c2b07[_0x5adb('0x21')]);return db[_0x5adb('0x95')][_0x5adb('0x39')](_0xaa32e4[_0x5adb('0x96')](),_0x1ceb72);})[_0x5adb('0x27')](function(_0x463e84){_0x1d6bef[_0x5adb('0x79')](_0x5adb('0xaa'),_[_0x5adb('0x2e')](_0x463e84,'id'));return db[_0x5adb('0x95')]['query'](_0x1d6bef['toString'](),_0x1ceb72)[_0x5adb('0x27')](function(_0x44756a){var _0x5c4053=_[_0x5adb('0xab')](_0x44756a,_0x5adb('0xac'));var _0x38acde=[];_0x463e84[_0x5adb('0x33')](function(_0x13426e){_0x38acde[_0x5adb('0x34')](updateWhatsappInteraction(_0x13426e,_0xdfecfd,_0x5c4053));});return BPromise[_0x5adb('0xad')](_0x38acde);});});})[_0x5adb('0x27')](function(_0x42dddf){_0x9bdece['rows']=_0x42dddf;return _0x9bdece;})[_0x5adb('0x27')](respondWithFilteredResult(_0x222568,_0x3c2b07));})[_0x5adb('0xae')](handleError(_0x222568,null));};exports[_0x5adb('0xaf')]=function(_0x4f0261,_0x312a90){var _0x284f79={'raw':![],'where':{'id':_0x4f0261[_0x5adb('0xb0')]['id']}},_0x2b6e56={};_0x2b6e56[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db['WhatsappInteraction'][_0x5adb('0x36')]);_0x2b6e56[_0x5adb('0x39')]=_[_0x5adb('0x6f')](_0x4f0261[_0x5adb('0x39')]);_0x2b6e56[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x2b6e56[_0x5adb('0x3b')],_0x2b6e56[_0x5adb('0x39')]);_0x284f79[_0x5adb('0x3c')]=_[_0x5adb('0x3a')](_0x2b6e56['model'],qs[_0x5adb('0x3d')](_0x4f0261['query'][_0x5adb('0x3d')]));_0x284f79[_0x5adb('0x3c')]=_0x284f79[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x284f79[_0x5adb('0x3c')]:_0x2b6e56['model'];if(_0x4f0261['query'][_0x5adb('0xb1')]){_0x284f79[_0x5adb('0xb2')]=[{'all':!![]}];}_0x284f79=_[_0x5adb('0xb3')]({},_0x284f79,_0x4f0261[_0x5adb('0xb4')]);return db[_0x5adb('0x35')][_0x5adb('0x6a')](_0x284f79)['then'](handleEntityNotFound(_0x312a90,null))['then'](respondWithResult(_0x312a90,null))[_0x5adb('0xae')](handleError(_0x312a90,null));};exports[_0x5adb('0xb5')]=function(_0x9d80fd,_0x4f5721){return db['WhatsappInteraction'][_0x5adb('0xb5')](_0x9d80fd['body'],{})[_0x5adb('0x27')](respondWithResult(_0x4f5721,0xc9))[_0x5adb('0xae')](handleError(_0x4f5721,null));};exports['update']=function(_0x498ecc,_0x43b91c){if(_0x498ecc['body']['id']){delete _0x498ecc['body']['id'];}return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x498ecc[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x43b91c,null))[_0x5adb('0x27')](saveUpdates(_0x498ecc[_0x5adb('0x6e')],null))[_0x5adb('0x27')](respondWithResult(_0x43b91c,null))[_0x5adb('0xae')](handleError(_0x43b91c,null));};exports[_0x5adb('0x28')]=function(_0x31b696,_0x44cf6a){return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x31b696['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x44cf6a,null))['then'](removeEntity(_0x44cf6a,null))[_0x5adb('0xae')](handleError(_0x44cf6a,null));};exports[_0x5adb('0xb6')]=function(_0x280f30,_0xad6905){return db[_0x5adb('0x35')][_0x5adb('0xb6')]()[_0x5adb('0x27')](respondWithResult(_0xad6905,null))[_0x5adb('0xae')](handleError(_0xad6905,null));};exports[_0x5adb('0xb7')]=function(_0x36a8f0,_0x41fa3c,_0x18fc00){return db['WhatsappMessage'][_0x5adb('0x6a')]({'where':{'id':_0x36a8f0[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x41fa3c,null))[_0x5adb('0x27')](function(_0x1da6bc){if(_0x1da6bc){return _0x1da6bc[_0x5adb('0xb7')](_0x36a8f0[_0x5adb('0x6e')][_0x5adb('0xb8')],_['omit'](_0x36a8f0[_0x5adb('0x6e')],[_0x5adb('0xb8'),'id'])||{});}})[_0x5adb('0x27')](respondWithResult(_0x41fa3c,null))['catch'](handleError(_0x41fa3c,null));};exports[_0x5adb('0xb9')]=function(_0x4ae211,_0x74065,_0x50c3a3){var _0x54da7c={'raw':![],'where':{}};var _0x173ead={};var _0x3796b7={'count':0x0,'rows':[]};return db[_0x5adb('0x35')][_0x5adb('0xba')]({'where':{'id':_0x4ae211[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x74065,null))[_0x5adb('0x27')](function(_0xa1911a){if(_0xa1911a){_0x173ead[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db[_0x5adb('0xbb')][_0x5adb('0x36')]);_0x173ead['query']=_[_0x5adb('0x6f')](_0x4ae211['query']);_0x173ead[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x173ead['model'],_0x173ead[_0x5adb('0x39')]);_0x54da7c[_0x5adb('0x3c')]=_['intersection'](_0x173ead['model'],qs[_0x5adb('0x3d')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x3d')]));_0x54da7c[_0x5adb('0x3c')]=_0x54da7c[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x54da7c['attributes']:_0x173ead[_0x5adb('0x3b')];if(!_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbc')](_0x5adb('0xbd'))){_0x54da7c[_0x5adb('0x3f')]=qs['limit'](_0x4ae211['query'][_0x5adb('0x3f')]);_0x54da7c[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x54da7c[_0x5adb('0x40')]=qs[_0x5adb('0x41')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x41')]);_0x54da7c['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x4ae211['query'],_0x173ead['filters']));_0x54da7c['where'][_0x5adb('0xac')]=_0xa1911a['id'];if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0x81')]){_0x54da7c['where']=_['merge'](_0x54da7c[_0x5adb('0x79')],{'$or':_[_0x5adb('0x2e')](_0x54da7c[_0x5adb('0x3c')],function(_0x3d2a5b){var _0x3b367f={};_0x3b367f[_0x3d2a5b]={'$like':'%'+_0x4ae211[_0x5adb('0x39')]['filter']+'%'};return _0x3b367f;})});}if(_0x4ae211['query'][_0x5adb('0xbe')]){var _0x5a9e55=_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbe')]['split'](',');var _0x7151b8={};_0x7151b8[_0x5a9e55[0x0]]={'$gte':moment(_0x5a9e55[0x1])[_0x5adb('0xbf')](_0x5adb('0xc0'))};_0x54da7c[_0x5adb('0x79')]=_['merge'](_0x54da7c[_0x5adb('0x79')],_0x7151b8);}_0x54da7c=_[_0x5adb('0xb3')]({},_0x54da7c,_0x4ae211[_0x5adb('0xb4')]);return db[_0x5adb('0xbb')]['count']({'where':_0x54da7c[_0x5adb('0x79')]})['then'](function(_0x29cc2f){_0x3796b7[_0x5adb('0x97')]=_0x29cc2f;if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0xb1')]){_0x54da7c[_0x5adb('0xb2')]=[{'all':!![]}];}return db[_0x5adb('0xbb')]['findAll'](_0x54da7c);})[_0x5adb('0x27')](function(_0x49e908){_0x3796b7[_0x5adb('0xc1')]=_0x49e908;return _0x3796b7;});}})[_0x5adb('0x27')](respondWithFilteredResult(_0x74065,_0x54da7c))['catch'](handleError(_0x74065,null));};exports[_0x5adb('0xc2')]=function(_0x52e44f,_0x5a517a,_0x4d50f7){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x52e44f['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5a517a,null))[_0x5adb('0x27')](function(_0x325f86){if(_0x325f86){return _0x325f86[_0x5adb('0xc3')](_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')],_[_0x5adb('0xc4')](_0x52e44f['body'],[_0x5adb('0xb8'),'id'])||{})[_0x5adb('0xc5')](function(){return db['Tag'][_0x5adb('0xc6')]({'attributes':['id',_0x5adb('0x2b'),_0x5adb('0xc7')],'where':{'id':_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')]}});})[_0x5adb('0x27')](function(_0x3a88ab){socket[_0x5adb('0xc8')](_0x5adb('0xc9'),{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]});return{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]};});}})[_0x5adb('0x27')](respondWithResult(_0x5a517a,null))['catch'](handleError(_0x5a517a,null));};exports['removeTags']=function(_0x2376a6,_0x282c11,_0x35a718){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x2376a6[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x282c11,null))[_0x5adb('0x27')](function(_0xb9ac38){if(_0xb9ac38){return _0xb9ac38[_0x5adb('0xca')](_0x2376a6['query']['ids']);}})[_0x5adb('0x27')](respondWithStatusCode(_0x282c11,null))['catch'](handleError(_0x282c11,null));};exports[_0x5adb('0xcb')]=function(_0x64fae1,_0x3ad256){var _0x2b4228=moment()[_0x5adb('0xcc')]()[_0x5adb('0x96')]();var _0x5e17ea=path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xd0'),_0x5adb('0xd1'));var _0xabc1ee=path[_0x5adb('0xcd')](config['root'],'server','files',_0x5adb('0xd2'));var _0x5ae730=path[_0x5adb('0xcd')](_0x5e17ea,_0x2b4228);var _0x5983ef=util['format'](_0x5adb('0xd3'),_0x64fae1[_0x5adb('0xb0')]['id'],_0x2b4228);var _0x5e74dc=path['join'](_0x5e17ea,_0x5983ef);var _0x3612c=[];_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0x68')],'as':'User','attributes':['id',_0x5adb('0x2f')],'raw':!![]});_0x3612c['push']({'model':db['CmContact'],'as':_0x5adb('0x5d'),'attributes':['id',_0x5adb('0xd4'),_0x5adb('0xd5')],'raw':!![]});if(_0x64fae1['query']['attachments']){_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0xd6')],'as':'Attachment','raw':!![]});}var _0x5366d4=[{'model':db[_0x5adb('0xbb')],'as':_0x5adb('0xd7'),'attributes':['id','body',_0x5adb('0x75'),'direction',_0x5adb('0xd8'),'read'],'include':_0x3612c}];_0x5366d4[_0x5adb('0x34')]({'model':db[_0x5adb('0xd9')],'as':_0x5adb('0xda'),'attributes':['id',_0x5adb('0x2b')]});_0x5366d4[_0x5adb('0x34')]({'model':db['User'],'as':_0x5adb('0xdb'),'attributes':['id',_0x5adb('0x2f')]});return db[_0x5adb('0x35')]['find']({'where':{'id':_0x64fae1[_0x5adb('0xb0')]['id']},'include':_0x5366d4})[_0x5adb('0x27')](handleEntityNotFound(_0x3ad256,null))[_0x5adb('0x27')](function(_0x45526a){if(_0x45526a){var _0x57607e=_0x45526a[_0x5adb('0xdc')]({'plain':!![]});fs[_0x5adb('0xdd')](_0x5ae730);var _0x3bbe7c={'format':'A4','border':'10px','header':{'height':_0x5adb('0xde'),'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':_0x5adb('0xdf'),'contents':{'default':util[_0x5adb('0xbf')](_0x5adb('0xe0'),util[_0x5adb('0xbf')](_0x5adb('0xe1'),'Whatsapp',_0x57607e['id']),moment()['format']('YYYY-MM-DD')[_0x5adb('0x96')]())}}};var _0x4a1b54={'channel':'Whatsapp','account':_0x57607e[_0x5adb('0xda')][_0x5adb('0x2b')],'agent':_0x57607e[_0x5adb('0xdb')]?_0x57607e[_0x5adb('0xdb')][_0x5adb('0x2f')]:_0x5adb('0xe2'),'createdAt':moment(_0x57607e[_0x5adb('0x75')])[_0x5adb('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5adb('0x96')](),'closedAt':_0x57607e[_0x5adb('0xe3')]?moment(_0x57607e['closedAt'])[_0x5adb('0xbf')](_0x5adb('0xc0'))['toString']():'','disposition':_0x57607e[_0x5adb('0xe4')],'messages':_(_0x57607e['Messages'])[_0x5adb('0x81')]({'secret':![]})[_0x5adb('0x2e')](function(_0x3d782b){if(_0x3d782b[_0x5adb('0xd6')]){var _0x651279=path[_0x5adb('0xcd')](_0xabc1ee,_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]);if(fs['existsSync'](_0x651279)){fs[_0x5adb('0xe6')](_0x651279)['pipe'](fs[_0x5adb('0xe7')](path['join'](_0x5ae730,_0x3d782b[_0x5adb('0xd6')]['basename'])));}}return{'date':moment(_0x3d782b[_0x5adb('0x75')])[_0x5adb('0xbf')](_0x5adb('0xc0'))[_0x5adb('0x96')](),'sender':_0x3d782b[_0x5adb('0xe8')]===_0x5adb('0xe9')?_0x3d782b[_0x5adb('0x68')]?_0x3d782b[_0x5adb('0x68')][_0x5adb('0x2f')]:_0x5adb('0xea'):_0x3d782b[_0x5adb('0x5d')][_0x5adb('0xd4')]+(_0x3d782b[_0x5adb('0x5d')]['lastName']?'\x20'+_0x3d782b[_0x5adb('0x5d')]['lastName']:''),'body':_0x3d782b[_0x5adb('0xd6')]?_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]:_0x3d782b['body'],'direction':_0x3d782b['direction']==='out'?'A':'C','secret':_0x3d782b['secret'],'read':_0x3d782b[_0x5adb('0x7c')],'attachment':_0x3d782b[_0x5adb('0xd6')]};})[_0x5adb('0x5f')]()};return ejs[_0x5adb('0xeb')](path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xec'),_0x5adb('0xed')),{'interaction':_0x4a1b54})['then'](function(_0x39bf82){return new BPromise(function(_0x197b7f,_0x171fb9){pdf[_0x5adb('0xb5')](_0x39bf82,_0x3bbe7c)[_0x5adb('0xee')](path[_0x5adb('0xcd')](_0x5ae730,'transcript-'+_0x57607e['id']+'-'+_0x2b4228+'.pdf'),function(_0x4edb9e,_0x25f1f7){if(_0x4edb9e)return _0x171fb9(_0x4edb9e);_0x197b7f(_0x25f1f7);});});})[_0x5adb('0x27')](function(){return new BPromise(function(_0xb81dd2,_0x2b753d){zipdir(_0x5ae730,{'saveTo':_0x5e74dc},function(_0x27eb1e,_0x5eef55){if(_0x27eb1e)return _0x2b753d(_0x27eb1e);return _0xb81dd2(_0x5eef55);});})[_0x5adb('0x27')](function(){return new BPromise(function(_0x2cb713,_0x2034d7){rimraf(_0x5ae730,function(_0x3dd67b){if(_0x3dd67b)_0x2034d7(_0x3dd67b);return _0x2cb713();});});})[_0x5adb('0x27')](function(){return _0x3ad256[_0x5adb('0xcb')](_0x5e74dc,_0x5983ef,function(_0x38c24d){if(_0x38c24d){console[_0x5adb('0xef')](_0x5adb('0xf0'),_0x38c24d);}else{fs[_0x5adb('0xf1')](_0x5e74dc);}});});});}else{return _0x3ad256[_0x5adb('0x1d')](0xc8);}})[_0x5adb('0xae')](handleError(_0x3ad256,null));}; \ No newline at end of file +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(_0x2c85a2,_0x3dafc5){var _0x4b9da0=function(_0x2822bf){while(--_0x2822bf){_0x2c85a2['push'](_0x2c85a2['shift']());}};_0x4b9da0(++_0x3dafc5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5216bf1..1d35d6e 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 _0x75da=['exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x47aa4b,_0x1dc3ea){var _0x2ae9bb=function(_0x3b3879){while(--_0x3b3879){_0x47aa4b['push'](_0x47aa4b['shift']());}};_0x2ae9bb(++_0x1dc3ea);}(_0x75da,0xd2));var _0xa75d=function(_0x8f15dd,_0x1b132c){_0x8f15dd=_0x8f15dd-0x0;var _0x6a2868=_0x75da[_0x8f15dd];return _0x6a2868;};'use strict';var EventEmitter=require(_0xa75d('0x0'));var WhatsappInteraction=require(_0xa75d('0x1'))['db'][_0xa75d('0x2')];var WhatsappMessage=require(_0xa75d('0x1'))['db'][_0xa75d('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa75d('0x4')](0x0);var events={'afterCreate':_0xa75d('0x5'),'afterUpdate':_0xa75d('0x6'),'afterDestroy':_0xa75d('0x7')};function emitEvent(_0x4b4903){return function(_0x44af9a,_0x26fa14,_0xb9c32b){_0x44af9a[_0xa75d('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1b2860){_0x44af9a[_0xa75d('0x9')](_0xa75d('0xa'),_0x1b2860[_0xa75d('0xb')](function(_0x164f51){return{'id':_0x164f51['id']};}));return WhatsappMessage[_0xa75d('0xc')]({'where':{'WhatsappInteractionId':_0x44af9a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa75d('0xd')](function(_0x2a7951){_0x44af9a[_0xa75d('0x9')](_0xa75d('0xe'),_0x2a7951['length']);WhatsappInteractionEvents[_0xa75d('0xf')](_0x4b4903+':'+_0x44af9a['id'],_0x44af9a);WhatsappInteractionEvents[_0xa75d('0xf')](_0x4b4903,_0x44af9a);_0xb9c32b(null);})[_0xa75d('0x10')](_0xb9c32b(null));};}for(var e in events){if(events[_0xa75d('0x11')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xa75d('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x73be=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then','Users','map','findAll','setDataValue','emit','catch','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1bd9fa,_0x182b0c){var _0x21032e=function(_0x7db43e){while(--_0x7db43e){_0x1bd9fa['push'](_0x1bd9fa['shift']());}};_0x21032e(++_0x182b0c);}(_0x73be,0x163));var _0xe73b=function(_0x1422c2,_0x55aa95){_0x1422c2=_0x1422c2-0x0;var _0x5e0276=_0x73be[_0x1422c2];return _0x5e0276;};'use strict';var EventEmitter=require(_0xe73b('0x0'));var WhatsappInteraction=require(_0xe73b('0x1'))['db'][_0xe73b('0x2')];var WhatsappMessage=require(_0xe73b('0x1'))['db'][_0xe73b('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe73b('0x4')](0x0);var events={'afterCreate':_0xe73b('0x5'),'afterUpdate':'update','afterDestroy':_0xe73b('0x6')};function emitEvent(_0x1145e0){return function(_0x52ba44,_0x498a3c,_0x2d1a2c){_0x52ba44[_0xe73b('0x7')]({'attributes':['id'],'raw':!![]})[_0xe73b('0x8')](function(_0x4773a4){_0x52ba44['setDataValue'](_0xe73b('0x9'),_0x4773a4[_0xe73b('0xa')](function(_0xe024d1){return{'id':_0xe024d1['id']};}));return WhatsappMessage[_0xe73b('0xb')]({'where':{'WhatsappInteractionId':_0x52ba44['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2e5208){_0x52ba44[_0xe73b('0xc')]('unreadMessages',_0x2e5208['length']);WhatsappInteractionEvents[_0xe73b('0xd')](_0x1145e0+':'+_0x52ba44['id'],_0x52ba44);WhatsappInteractionEvents[_0xe73b('0xd')](_0x1145e0,_0x52ba44);_0x2d1a2c(null);})[_0xe73b('0xe')](_0x2d1a2c(null));};}for(var e in events){if(events[_0xe73b('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xe73b('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f0cc335..56c6398 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(_0x557389,_0x92c7e1){var _0x43fc59=function(_0x15300c){while(--_0x15300c){_0x557389['push'](_0x557389['shift']());}};_0x43fc59(++_0x92c7e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x4365ca,_0x4c3ef2){var _0x506f4d=function(_0x195ff6){while(--_0x195ff6){_0x4365ca['push'](_0x4365ca['shift']());}};_0x506f4d(++_0x4c3ef2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 afd2d94..e7a205f 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 _0x604a=['request','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes','then','catch','where','addTags','ids','body','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0xe2fd39,_0x436fb5){var _0x141872=function(_0x6ff74b){while(--_0x6ff74b){_0xe2fd39['push'](_0xe2fd39['shift']());}};_0x141872(++_0x436fb5);}(_0x604a,0x11a));var _0xa604=function(_0x5a3e4b,_0x5eaa8a){_0x5a3e4b=_0x5a3e4b-0x0;var _0x218910=_0x604a[_0x5a3e4b];return _0x218910;};'use strict';var _=require(_0xa604('0x0'));var util=require(_0xa604('0x1'));var moment=require(_0xa604('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa604('0x3'))['db'];var utils=require(_0xa604('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa604('0x5'));var jayson=require(_0xa604('0x6'));var client=jayson[_0xa604('0x7')][_0xa604('0x8')]({'port':0x232a});config['redis']=_[_0xa604('0x9')](config[_0xa604('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa604('0xb'))(new Redis(config[_0xa604('0xa')]));require(_0xa604('0xc'))[_0xa604('0xd')](socket);function respondWithRpcPromise(_0x168247,_0x1e9fe3,_0x8d508b){return new BPromise(function(_0x4081bd,_0x5b80cd){return client[_0xa604('0xe')](_0x168247,_0x8d508b)['then'](function(_0x453fbd){logger[_0xa604('0xf')](_0xa604('0x10'),_0x1e9fe3,'request\x20sent');logger[_0xa604('0x11')](_0xa604('0x12'),_0x1e9fe3,_0xa604('0x13'),JSON[_0xa604('0x14')](_0x453fbd));if(_0x453fbd[_0xa604('0x15')]){if(_0x453fbd[_0xa604('0x15')][_0xa604('0x16')]===0x1f4){logger['error'](_0xa604('0x10'),_0x1e9fe3,_0x453fbd['error'][_0xa604('0x17')]);return _0x5b80cd(_0x453fbd['error'][_0xa604('0x17')]);}logger[_0xa604('0x15')](_0xa604('0x10'),_0x1e9fe3,_0x453fbd[_0xa604('0x15')][_0xa604('0x17')]);return _0x4081bd(_0x453fbd['error'][_0xa604('0x17')]);}else{logger[_0xa604('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x1e9fe3,'request\x20sent');_0x4081bd(_0x453fbd['result'][_0xa604('0x17')]);}})['catch'](function(_0x5ec258){logger[_0xa604('0x15')](_0xa604('0x10'),_0x1e9fe3,_0x5ec258);_0x5b80cd(_0x5ec258);});});}exports[_0xa604('0x18')]=function(_0x5ea0df){var _0x33c47e=this;return new Promise(function(_0x37f26b,_0x2ba3da){return db[_0xa604('0x19')][_0xa604('0x1a')](_0x5ea0df['body'],{'raw':_0x5ea0df[_0xa604('0x1b')]?_0x5ea0df['options'][_0xa604('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ea0df[_0xa604('0x1b')]?_0x5ea0df[_0xa604('0x1b')]['where']||null:null,'attributes':_0x5ea0df[_0xa604('0x1b')]?_0x5ea0df['options'][_0xa604('0x1d')]||null:null,'limit':_0x5ea0df[_0xa604('0x1b')]?_0x5ea0df[_0xa604('0x1b')]['limit']||null:null})[_0xa604('0x1e')](function(_0x33df26){logger['info']('UpdateWhatsappInteraction',_0x5ea0df);logger[_0xa604('0x11')](_0xa604('0x18'),_0x5ea0df,JSON['stringify'](_0x33df26));_0x37f26b(_0x33df26);})[_0xa604('0x1f')](function(_0x5ae0dd){logger[_0xa604('0x15')]('UpdateWhatsappInteraction',_0x5ae0dd['message'],_0x5ea0df);_0x2ba3da(_0x33c47e['error'](0x1f4,_0x5ae0dd[_0xa604('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x1d5a28){return new Promise(function(_0x4731ea,_0x5b850e){return db[_0xa604('0x19')]['find']({'where':_0x1d5a28[_0xa604('0x1b')]?_0x1d5a28['options'][_0xa604('0x20')]||null:null})[_0xa604('0x1e')](function(_0xe070ff){if(_0xe070ff){return _0xe070ff[_0xa604('0x21')](_0x1d5a28['body'][_0xa604('0x22')],_['omit'](_0x1d5a28[_0xa604('0x23')],[_0xa604('0x22'),'id'])||{});}})['spread'](function(_0x286339){logger[_0xa604('0xf')]('AddTags',_0x1d5a28);logger[_0xa604('0x11')](_0xa604('0x24'),_0x1d5a28,JSON[_0xa604('0x14')](_0x286339));_0x4731ea(_0x286339);})['catch'](function(_0x37dbc0){logger[_0xa604('0x15')]('AddTags',_0x37dbc0[_0xa604('0x17')],_0x1d5a28);_0x5b850e(_this[_0xa604('0x15')](0x1f4,_0x37dbc0[_0xa604('0x17')]));});});}; \ No newline at end of file +var _0xc485=['body','omit','ids','spread','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','./whatsappInteraction.socket','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateWhatsappInteraction','update','options','where','attributes','limit','then','catch','WhatsappInteraction','find','addTags'];(function(_0xe781c3,_0x2086ad){var _0x51391b=function(_0x594034){while(--_0x594034){_0xe781c3['push'](_0xe781c3['shift']());}};_0x51391b(++_0x2086ad);}(_0xc485,0x1c0));var _0x5c48=function(_0x23b946,_0x2653e1){_0x23b946=_0x23b946-0x0;var _0xcfad4f=_0xc485[_0x23b946];return _0xcfad4f;};'use strict';var _=require(_0x5c48('0x0'));var util=require(_0x5c48('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5c48('0x2'));var fs=require('fs');var Redis=require(_0x5c48('0x3'));var db=require(_0x5c48('0x4'))['db'];var utils=require(_0x5c48('0x5'));var logger=require(_0x5c48('0x6'))('rpc');var config=require(_0x5c48('0x7'));var jayson=require(_0x5c48('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x5c48('0x9')]=_[_0x5c48('0xa')](config[_0x5c48('0x9')],{'host':_0x5c48('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c48('0x9')]));require(_0x5c48('0xc'))['register'](socket);function respondWithRpcPromise(_0x5699ff,_0x4d3845,_0x7e6680){return new BPromise(function(_0x1e4e55,_0x57c90e){return client['request'](_0x5699ff,_0x7e6680)['then'](function(_0x19fd67){logger[_0x5c48('0xd')](_0x5c48('0xe'),_0x4d3845,_0x5c48('0xf'));logger[_0x5c48('0x10')](_0x5c48('0x11'),_0x4d3845,_0x5c48('0xf'),JSON[_0x5c48('0x12')](_0x19fd67));if(_0x19fd67[_0x5c48('0x13')]){if(_0x19fd67[_0x5c48('0x13')]['code']===0x1f4){logger['error'](_0x5c48('0xe'),_0x4d3845,_0x19fd67[_0x5c48('0x13')][_0x5c48('0x14')]);return _0x57c90e(_0x19fd67['error'][_0x5c48('0x14')]);}logger[_0x5c48('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x4d3845,_0x19fd67[_0x5c48('0x13')][_0x5c48('0x14')]);return _0x1e4e55(_0x19fd67[_0x5c48('0x13')][_0x5c48('0x14')]);}else{logger[_0x5c48('0xd')]('WhatsappInteraction,\x20%s,\x20%s',_0x4d3845,'request\x20sent');_0x1e4e55(_0x19fd67[_0x5c48('0x15')][_0x5c48('0x14')]);}})['catch'](function(_0x29590a){logger[_0x5c48('0x13')](_0x5c48('0xe'),_0x4d3845,_0x29590a);_0x57c90e(_0x29590a);});});}exports[_0x5c48('0x16')]=function(_0x27e01c){var _0x46252c=this;return new Promise(function(_0x5cdd0,_0x3a3d2a){return db['WhatsappInteraction'][_0x5c48('0x17')](_0x27e01c['body'],{'raw':_0x27e01c['options']?_0x27e01c[_0x5c48('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27e01c['options']?_0x27e01c['options'][_0x5c48('0x19')]||null:null,'attributes':_0x27e01c[_0x5c48('0x18')]?_0x27e01c['options'][_0x5c48('0x1a')]||null:null,'limit':_0x27e01c[_0x5c48('0x18')]?_0x27e01c[_0x5c48('0x18')][_0x5c48('0x1b')]||null:null})[_0x5c48('0x1c')](function(_0x46113e){logger[_0x5c48('0xd')](_0x5c48('0x16'),_0x27e01c);logger[_0x5c48('0x10')](_0x5c48('0x16'),_0x27e01c,JSON[_0x5c48('0x12')](_0x46113e));_0x5cdd0(_0x46113e);})[_0x5c48('0x1d')](function(_0x4f1911){logger[_0x5c48('0x13')](_0x5c48('0x16'),_0x4f1911[_0x5c48('0x14')],_0x27e01c);_0x3a3d2a(_0x46252c[_0x5c48('0x13')](0x1f4,_0x4f1911[_0x5c48('0x14')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x292f96){return new Promise(function(_0x268ab2,_0xec5ee2){return db[_0x5c48('0x1e')][_0x5c48('0x1f')]({'where':_0x292f96[_0x5c48('0x18')]?_0x292f96[_0x5c48('0x18')][_0x5c48('0x19')]||null:null})[_0x5c48('0x1c')](function(_0x224780){if(_0x224780){return _0x224780[_0x5c48('0x20')](_0x292f96[_0x5c48('0x21')]['ids'],_[_0x5c48('0x22')](_0x292f96[_0x5c48('0x21')],[_0x5c48('0x23'),'id'])||{});}})[_0x5c48('0x24')](function(_0x217819){logger[_0x5c48('0xd')]('AddTags',_0x292f96);logger[_0x5c48('0x10')]('AddTags',_0x292f96,JSON[_0x5c48('0x12')](_0x217819));_0x268ab2(_0x217819);})[_0x5c48('0x1d')](function(_0x28accc){logger[_0x5c48('0x13')]('AddTags',_0x28accc[_0x5c48('0x14')],_0x292f96);_0xec5ee2(_this[_0x5c48('0x13')](0x1f4,_0x28accc[_0x5c48('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 67e4fce..cae1529 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 _0x08cd=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x4f13a8,_0x28c4f2){var _0x3cba2f=function(_0x2ce466){while(--_0x2ce466){_0x4f13a8['push'](_0x4f13a8['shift']());}};_0x3cba2f(++_0x28c4f2);}(_0x08cd,0x126));var _0xd08c=function(_0x19ce3e,_0xf5efba){_0x19ce3e=_0x19ce3e-0x0;var _0x45a5ca=_0x08cd[_0x19ce3e];return _0x45a5ca;};'use strict';var WhatsappInteractionEvents=require(_0xd08c('0x0'));var events=[_0xd08c('0x1'),'remove',_0xd08c('0x2')];function createListener(_0x1714e5,_0x33aa79){return function(_0x5485ba){_0x33aa79[_0xd08c('0x3')](_0x1714e5,_0x5485ba);};}function removeListener(_0x404870,_0x562b53){return function(){WhatsappInteractionEvents[_0xd08c('0x4')](_0x404870,_0x562b53);};}exports[_0xd08c('0x5')]=function(_0x6fb4da){for(var _0x10bfd4=0x0,_0x2c205c=events[_0xd08c('0x6')];_0x10bfd4<_0x2c205c;_0x10bfd4++){var _0x4ded46=events[_0x10bfd4];var _0x40818a=createListener(_0xd08c('0x7')+_0x4ded46,_0x6fb4da);WhatsappInteractionEvents['on'](_0x4ded46,_0x40818a);}}; \ No newline at end of file +var _0x838b=['register','./whatsappInteraction.events','save','remove','emit'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x838b,0x196));var _0xb838=function(_0x8f6080,_0x5ad41a){_0x8f6080=_0x8f6080-0x0;var _0x3e6746=_0x838b[_0x8f6080];return _0x3e6746;};'use strict';var WhatsappInteractionEvents=require(_0xb838('0x0'));var events=[_0xb838('0x1'),_0xb838('0x2'),'update'];function createListener(_0x3d0aee,_0x499a41){return function(_0x3a25b4){_0x499a41[_0xb838('0x3')](_0x3d0aee,_0x3a25b4);};}function removeListener(_0x4ece8f,_0x5d650e){return function(){WhatsappInteractionEvents['removeListener'](_0x4ece8f,_0x5d650e);};}exports[_0xb838('0x4')]=function(_0x2239d4){for(var _0x2d6242=0x0,_0x4df560=events['length'];_0x2d6242<_0x4df560;_0x2d6242++){var _0x3b2624=events[_0x2d6242];var _0x347fa3=createListener('whatsappInteraction:'+_0x3b2624,_0x2239d4);WhatsappInteractionEvents['on'](_0x3b2624,_0x347fa3);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b0c4547..2bc677b 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 _0xa037=['index','/describe','describe','/:id','post','tracked','whatsapp','create','/:id/status','status','update','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated'];(function(_0x1334df,_0x15f6cf){var _0x240b99=function(_0x1d2f71){while(--_0x1d2f71){_0x1334df['push'](_0x1334df['shift']());}};_0x240b99(++_0x15f6cf);}(_0xa037,0xd6));var _0x7a03=function(_0x294f10,_0x594a67){_0x294f10=_0x294f10-0x0;var _0x12b23b=_0xa037[_0x294f10];return _0x12b23b;};'use strict';var multer=require(_0x7a03('0x0'));var util=require(_0x7a03('0x1'));var path=require(_0x7a03('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a03('0x3'));var router=express[_0x7a03('0x4')]();var auth=require(_0x7a03('0x5'));var interaction=require(_0x7a03('0x6'));var config=require(_0x7a03('0x7'));var controller=require(_0x7a03('0x8'));router['get']('/',auth[_0x7a03('0x9')](),controller[_0x7a03('0xa')]);router['get'](_0x7a03('0xb'),auth[_0x7a03('0x9')](),controller[_0x7a03('0xc')]);router['get'](_0x7a03('0xd'),auth[_0x7a03('0x9')](),controller['show']);router[_0x7a03('0xe')]('/',auth['isAuthenticated'](),interaction[_0x7a03('0xf')](_0x7a03('0x10'),'whatsappmessage:create'),controller[_0x7a03('0x11')]);router[_0x7a03('0xe')](_0x7a03('0x12'),controller[_0x7a03('0x13')]);router['put'](_0x7a03('0xd'),auth[_0x7a03('0x9')](),controller[_0x7a03('0x14')]);router[_0x7a03('0x15')](_0x7a03('0x16'),auth[_0x7a03('0x9')](),controller[_0x7a03('0x17')]);router['put']('/:id/reject',auth[_0x7a03('0x9')](),controller[_0x7a03('0x18')]);router[_0x7a03('0x19')](_0x7a03('0xd'),auth[_0x7a03('0x9')](),controller[_0x7a03('0x1a')]);module[_0x7a03('0x1b')]=router; \ No newline at end of file +var _0xe631=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','isAuthenticated','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe631,0x197));var _0x1e63=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xe631[_0x5c9307];return _0x373e29;};'use strict';var multer=require(_0x1e63('0x0'));var util=require(_0x1e63('0x1'));var path=require(_0x1e63('0x2'));var timeout=require(_0x1e63('0x3'));var express=require(_0x1e63('0x4'));var router=express['Router']();var auth=require(_0x1e63('0x5'));var interaction=require(_0x1e63('0x6'));var config=require(_0x1e63('0x7'));var controller=require(_0x1e63('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1e63('0x9')]);router[_0x1e63('0xa')]('/describe',auth[_0x1e63('0xb')](),controller['describe']);router[_0x1e63('0xa')](_0x1e63('0xc'),auth[_0x1e63('0xb')](),controller[_0x1e63('0xd')]);router[_0x1e63('0xe')]('/',auth[_0x1e63('0xb')](),interaction[_0x1e63('0xf')](_0x1e63('0x10'),_0x1e63('0x11')),controller[_0x1e63('0x12')]);router[_0x1e63('0xe')](_0x1e63('0x13'),controller[_0x1e63('0x14')]);router[_0x1e63('0x15')]('/:id',auth[_0x1e63('0xb')](),controller['update']);router[_0x1e63('0x15')](_0x1e63('0x16'),auth[_0x1e63('0xb')](),controller[_0x1e63('0x17')]);router['put'](_0x1e63('0x18'),auth[_0x1e63('0xb')](),controller[_0x1e63('0x19')]);router[_0x1e63('0x1a')](_0x1e63('0xc'),auth[_0x1e63('0xb')](),controller[_0x1e63('0x1b')]);module[_0x1e63('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 46bb660..ddd6e99 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 _0xac55=['medium','ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xac55,0x1c8));var _0x5ac5=function(_0x387d8a,_0x31e565){_0x387d8a=_0x387d8a-0x0;var _0x45e09b=_0xac55[_0x387d8a];return _0x45e09b;};'use strict';var Sequelize=require(_0x5ac5('0x0'));module[_0x5ac5('0x1')]={'body':{'type':Sequelize[_0x5ac5('0x2')](_0x5ac5('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5ac5('0x4')]('in',_0x5ac5('0x5')),'defaultValue':_0x5ac5('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5ac5('0x6')](0xbe)},'phone':{'type':Sequelize[_0x5ac5('0x6')]},'readAt':{'type':Sequelize[_0x5ac5('0x7')]},'secret':{'type':Sequelize[_0x5ac5('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x27df=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x169dad,_0x3f495e){var _0x573abf=function(_0x830ba0){while(--_0x830ba0){_0x169dad['push'](_0x169dad['shift']());}};_0x573abf(++_0x3f495e);}(_0x27df,0x16a));var _0xf27d=function(_0x3ad8d3,_0xa9525e){_0x3ad8d3=_0x3ad8d3-0x0;var _0x4ebec5=_0x27df[_0x3ad8d3];return _0x4ebec5;};'use strict';var Sequelize=require(_0xf27d('0x0'));module[_0xf27d('0x1')]={'body':{'type':Sequelize[_0xf27d('0x2')](_0xf27d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf27d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf27d('0x5')),'defaultValue':_0xf27d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf27d('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xf27d('0x7')]},'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 3ec1cf9..ac38ef0 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 _0x102d=['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','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','end','status','json','count','offset','set','Content-Range','reject','save','update','destroy','sendStatus','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filters','create','body','catch','find','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','whatsapp','agent','get','rejectMessage','interface','EventManager','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x102d,0x1f2));var _0xd102=function(_0x92fbde,_0x4ab681){_0x92fbde=_0x92fbde-0x0;var _0x5c791b=_0x102d[_0x92fbde];return _0x5c791b;};'use strict';var pdf=require(_0xd102('0x0'));var emlformat=require(_0xd102('0x1'));var rimraf=require(_0xd102('0x2'));var zipdir=require(_0xd102('0x3'));var jsonpatch=require(_0xd102('0x4'));var rp=require(_0xd102('0x5'));var moment=require(_0xd102('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd102('0x7'));var util=require(_0xd102('0x8'));var path=require(_0xd102('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd102('0xa'));var fs=require('fs');var _=require(_0xd102('0xb'));var squel=require('squel');var crypto=require(_0xd102('0xc'));var jsforce=require(_0xd102('0xd'));var deskjs=require(_0xd102('0xe'));var toCsv=require(_0xd102('0xf'));var querystring=require(_0xd102('0x10'));var Papa=require('papaparse');var Redis=require(_0xd102('0x11'));var authService=require(_0xd102('0x12'));var qs=require(_0xd102('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd102('0x14'));var logger=require(_0xd102('0x15'))('api');var utils=require(_0xd102('0x16'));var config=require('../../config/environment');var db=require(_0xd102('0x17'))['db'];config[_0xd102('0x18')]=_[_0xd102('0x19')](config[_0xd102('0x18')],{'host':_0xd102('0x1a'),'port':0x18eb});var socket=require(_0xd102('0x1b'))(new Redis(config[_0xd102('0x18')]));require(_0xd102('0x1c'))[_0xd102('0x1d')](socket);var jayson=require(_0xd102('0x1e'));var client=jayson[_0xd102('0x1f')][_0xd102('0x20')]({'port':0x232c});var client9002=jayson[_0xd102('0x1f')][_0xd102('0x20')]({'port':0x232a});function checkPasswordPattern(_0x594cd2,_0x4c8658,_0x2fafc5){if(_0x2fafc5){var _0x3abaef=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3abaef['test'](_0x4c8658)){return _0x594cd2;}else{throw new db[(_0xd102('0x21'))][(_0xd102('0x22'))](_0xd102('0x23'));}}else{return _0x594cd2;}}function respondWithRpcPromise(_0x597dbe,_0xc98aff,_0x481b60,_0x48e2fd){return new BPromise(function(_0x25011a,_0xb05567){var _0x4f0da2=_0x48e2fd||client;return _0x4f0da2[_0xd102('0x24')](_0x597dbe,_0x481b60)[_0xd102('0x25')](function(_0x407ea5){logger[_0xd102('0x26')](_0xd102('0x27'),_0xc98aff,_0xd102('0x28'));logger[_0xd102('0x29')](_0xd102('0x2a'),_0xc98aff,_0xd102('0x28'),JSON['stringify'](_0x407ea5));if(_0x407ea5[_0xd102('0x2b')]){if(_0x407ea5[_0xd102('0x2b')]['code']===0x1f4){logger[_0xd102('0x2b')](_0xd102('0x27'),_0xc98aff,_0x407ea5[_0xd102('0x2b')][_0xd102('0x2c')]);return _0xb05567(_0x407ea5[_0xd102('0x2b')][_0xd102('0x2c')]);}logger[_0xd102('0x2b')](_0xd102('0x27'),_0xc98aff,_0x407ea5['error']['message']);return _0x25011a(_0x407ea5[_0xd102('0x2b')][_0xd102('0x2c')]);}else{logger[_0xd102('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0xc98aff,_0xd102('0x28'));_0x25011a(_0x407ea5['result'][_0xd102('0x2c')]);}})['catch'](function(_0xf683be){logger[_0xd102('0x2b')](_0xd102('0x27'),_0xc98aff,_0xf683be);_0xb05567(_0xf683be);});});}function respondWithStatusCode(_0x6f5929,_0x9314d2){_0x9314d2=_0x9314d2||0xcc;return function(_0x3f68a7){if(_0x3f68a7){return _0x6f5929['sendStatus'](_0x9314d2);}return _0x6f5929['status'](_0x9314d2)[_0xd102('0x2d')]();};}function respondWithResult(_0x3c92a6,_0x4b308c){_0x4b308c=_0x4b308c||0xc8;return function(_0x5657cd){if(_0x5657cd){return _0x3c92a6[_0xd102('0x2e')](_0x4b308c)[_0xd102('0x2f')](_0x5657cd);}};}function respondWithFilteredResult(_0x2f091d,_0x52bc88){return function(_0x2939f9){if(_0x2939f9){var _0xc21d31=_0x2939f9[_0xd102('0x30')],_0x575d8c=_0x52bc88[_0xd102('0x31')],_0x168174=_0x52bc88[_0xd102('0x31')]+_0x52bc88['limit'],_0x29ba69;if(_0x168174>=_0xc21d31){_0x168174=_0xc21d31;_0x29ba69=0xc8;}else{_0x29ba69=0xce;}_0x2f091d[_0xd102('0x2e')](_0x29ba69);return _0x2f091d[_0xd102('0x32')](_0xd102('0x33'),_0x575d8c+'-'+_0x168174+'/'+_0xc21d31)[_0xd102('0x2f')](_0x2939f9);}return null;};}function patchUpdates(_0x3b6aad){return function(_0x20dfb9){try{jsonpatch['apply'](_0x20dfb9,_0x3b6aad,!![]);}catch(_0x5b1252){return BPromise[_0xd102('0x34')](_0x5b1252);}return _0x20dfb9[_0xd102('0x35')]();};}function saveUpdates(_0x57ff47,_0x7a6422){return function(_0x31fa7a){if(_0x31fa7a){return _0x31fa7a[_0xd102('0x36')](_0x57ff47)[_0xd102('0x25')](function(_0x113018){return _0x113018;});}return null;};}function removeEntity(_0x499531,_0x400a70){return function(_0x1ba517){if(_0x1ba517){return _0x1ba517[_0xd102('0x37')]()['then'](function(){_0x499531[_0xd102('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57406e,_0x5170a0){return function(_0xb945ac){if(!_0xb945ac){_0x57406e[_0xd102('0x38')](0x194);}return _0xb945ac;};}function handleError(_0x22e6fc,_0x50f98d){_0x50f98d=_0x50f98d||0x1f4;return function(_0x52d75a){logger['error'](_0x52d75a['stack']);if(_0x52d75a['name']){delete _0x52d75a['name'];}_0x22e6fc[_0xd102('0x2e')](_0x50f98d)[_0xd102('0x39')](_0x52d75a);};}exports[_0xd102('0x3a')]=function(_0x5bb1ad,_0x13ce9e){var _0x383760={},_0x3aff1c={},_0x51af3f={'count':0x0,'rows':[]};var _0x5ef2c5=_[_0xd102('0x3b')](db[_0xd102('0x3c')][_0xd102('0x3d')],function(_0x12b2b0){return{'name':_0x12b2b0[_0xd102('0x3e')],'type':_0x12b2b0[_0xd102('0x3f')][_0xd102('0x40')]};});_0x3aff1c['model']=_[_0xd102('0x3b')](_0x5ef2c5,_0xd102('0x41'));_0x3aff1c[_0xd102('0x42')]=_[_0xd102('0x43')](_0x5bb1ad[_0xd102('0x42')]);_0x3aff1c['filters']=_[_0xd102('0x44')](_0x3aff1c[_0xd102('0x45')],_0x3aff1c[_0xd102('0x42')]);_0x383760[_0xd102('0x46')]=_[_0xd102('0x44')](_0x3aff1c[_0xd102('0x45')],qs['fields'](_0x5bb1ad[_0xd102('0x42')][_0xd102('0x47')]));_0x383760[_0xd102('0x46')]=_0x383760['attributes'][_0xd102('0x48')]?_0x383760['attributes']:_0x3aff1c[_0xd102('0x45')];if(!_0x5bb1ad['query']['hasOwnProperty']('nolimit')){_0x383760[_0xd102('0x49')]=qs[_0xd102('0x49')](_0x5bb1ad['query'][_0xd102('0x49')]);_0x383760['offset']=qs[_0xd102('0x31')](_0x5bb1ad[_0xd102('0x42')]['offset']);}_0x383760[_0xd102('0x4a')]=qs[_0xd102('0x4b')](_0x5bb1ad[_0xd102('0x42')][_0xd102('0x4b')]);_0x383760[_0xd102('0x4c')]=qs['filters'](_[_0xd102('0x4d')](_0x5bb1ad[_0xd102('0x42')],_0x3aff1c['filters']),_0x5ef2c5);if(_0x5bb1ad['query'][_0xd102('0x4e')]){_0x383760['where']=_[_0xd102('0x4f')](_0x383760[_0xd102('0x4c')],{'$or':_[_0xd102('0x3b')](_0x5ef2c5,function(_0x1b175f){if(_0x1b175f[_0xd102('0x3f')]!==_0xd102('0x50')){var _0x105c3c={};_0x105c3c[_0x1b175f[_0xd102('0x41')]]={'$like':'%'+_0x5bb1ad[_0xd102('0x42')]['filter']+'%'};return _0x105c3c;}})});}_0x383760=_[_0xd102('0x4f')]({},_0x383760,_0x5bb1ad[_0xd102('0x51')]);var _0x2c9c57={'where':_0x383760[_0xd102('0x4c')]};return db[_0xd102('0x3c')][_0xd102('0x30')](_0x2c9c57)[_0xd102('0x25')](function(_0x5d094c){_0x51af3f[_0xd102('0x30')]=_0x5d094c;if(_0x5bb1ad[_0xd102('0x42')][_0xd102('0x52')]){_0x383760[_0xd102('0x53')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xd102('0x54')](_0x383760);})['then'](function(_0x345fbf){_0x51af3f[_0xd102('0x55')]=_0x345fbf;return _0x51af3f;})[_0xd102('0x25')](respondWithFilteredResult(_0x13ce9e,_0x383760))['catch'](handleError(_0x13ce9e,null));};exports[_0xd102('0x56')]=function(_0x2cb781,_0x313d1f){var _0x162c3c={'raw':!![],'where':{'id':_0x2cb781[_0xd102('0x57')]['id']}},_0x2ac485={};_0x2ac485[_0xd102('0x45')]=_[_0xd102('0x43')](db[_0xd102('0x3c')][_0xd102('0x3d')]);_0x2ac485[_0xd102('0x42')]=_[_0xd102('0x43')](_0x2cb781[_0xd102('0x42')]);_0x2ac485[_0xd102('0x58')]=_[_0xd102('0x44')](_0x2ac485[_0xd102('0x45')],_0x2ac485[_0xd102('0x42')]);_0x162c3c[_0xd102('0x46')]=_[_0xd102('0x44')](_0x2ac485[_0xd102('0x45')],qs[_0xd102('0x47')](_0x2cb781[_0xd102('0x42')]['fields']));_0x162c3c[_0xd102('0x46')]=_0x162c3c[_0xd102('0x46')][_0xd102('0x48')]?_0x162c3c['attributes']:_0x2ac485[_0xd102('0x45')];if(_0x2cb781[_0xd102('0x42')][_0xd102('0x52')]){_0x162c3c[_0xd102('0x53')]=[{'all':!![]}];}_0x162c3c=_[_0xd102('0x4f')]({},_0x162c3c,_0x2cb781[_0xd102('0x51')]);return db['WhatsappMessage']['find'](_0x162c3c)[_0xd102('0x25')](handleEntityNotFound(_0x313d1f,null))['then'](respondWithResult(_0x313d1f,null))['catch'](handleError(_0x313d1f,null));};exports[_0xd102('0x59')]=function(_0x73530f,_0x3d1ef5){return db['WhatsappMessage'][_0xd102('0x59')](_0x73530f[_0xd102('0x5a')],{})['then'](respondWithResult(_0x3d1ef5,0xc9))[_0xd102('0x5b')](handleError(_0x3d1ef5,null));};exports[_0xd102('0x36')]=function(_0x25a931,_0xa0f495){if(_0x25a931[_0xd102('0x5a')]['id']){delete _0x25a931[_0xd102('0x5a')]['id'];}return db['WhatsappMessage'][_0xd102('0x5c')]({'where':{'id':_0x25a931[_0xd102('0x57')]['id']}})[_0xd102('0x25')](handleEntityNotFound(_0xa0f495,null))[_0xd102('0x25')](saveUpdates(_0x25a931['body'],null))[_0xd102('0x25')](respondWithResult(_0xa0f495,null))[_0xd102('0x5b')](handleError(_0xa0f495,null));};exports[_0xd102('0x37')]=function(_0x1db5c5,_0x2f9dd3){return db[_0xd102('0x3c')][_0xd102('0x5c')]({'where':{'id':_0x1db5c5[_0xd102('0x57')]['id']}})[_0xd102('0x25')](handleEntityNotFound(_0x2f9dd3,null))['then'](removeEntity(_0x2f9dd3,null))['catch'](handleError(_0x2f9dd3,null));};exports[_0xd102('0x5d')]=function(_0x3c61a7,_0x38d9a8){return db[_0xd102('0x3c')]['describe']()['then'](respondWithResult(_0x38d9a8,null))[_0xd102('0x5b')](handleError(_0x38d9a8,null));};var interaction_log=require(_0xd102('0x15'))(_0xd102('0x5e'));exports[_0xd102('0x5f')]=function(_0x53e982,_0x20e5f7,_0x2b47cd){var _0x38aa94={'channel':'whatsapp'};if(_0x53e982[_0xd102('0x5a')]['id']){delete _0x53e982[_0xd102('0x5a')]['id'];}_0x53e982[_0xd102('0x5a')][_0xd102('0x60')]=!![];_0x53e982[_0xd102('0x5a')][_0xd102('0x61')]=moment()[_0xd102('0x62')](_0xd102('0x63'));_0x53e982[_0xd102('0x5a')][_0xd102('0x64')]=_0x53e982[_0xd102('0x5a')][_0xd102('0x64')]||_0x53e982[_0xd102('0x65')]['id'];return db[_0xd102('0x3c')]['find']({'where':{'id':_0x53e982['params']['id'],'UserId':null},'include':[{'model':db[_0xd102('0x66')],'as':_0xd102('0x67')}]})[_0xd102('0x25')](handleEntityNotFound(_0x20e5f7,null))['then'](saveUpdates(_0x53e982[_0xd102('0x5a')],null))[_0xd102('0x25')](function(_0x3a34ae){if(_0x3a34ae){_0x38aa94['message']=_0x3a34ae['get']({'plain':!![]});return db[_0xd102('0x68')][_0xd102('0x5c')]({'where':{'id':_0x3a34ae[_0xd102('0x69')]}});}return null;})[_0xd102('0x25')](handleEntityNotFound(_0x20e5f7,null))[_0xd102('0x25')](function(_0x460de3){if(_0x460de3){return _0x460de3['update']({'UserId':_0x53e982[_0xd102('0x5a')][_0xd102('0x64')],'read1stAt':_[_0xd102('0x6a')](_0x460de3[_0xd102('0x6b')])?moment()['format'](_0xd102('0x63')):undefined});}return null;})['then'](function(_0xdc1555){if(_0xdc1555){_0x38aa94[_0xd102('0x6c')]=_0xdc1555['get']({'plain':!![]});interaction_log['info'](_0xd102('0x6d'),_0x53e982[_0xd102('0x65')]['id'],_0x53e982['user']['name'],_0x53e982['user']['role'],_0x38aa94['interaction']['id'],_0x53e982['body']?JSON[_0xd102('0x6e')](_0x53e982[_0xd102('0x5a')]):_0xd102('0x6f'));return respondWithRpcPromise(_0xd102('0x70'),_0xd102('0x71'),_0x38aa94);}return null;})[_0xd102('0x25')](function(_0x27e77d){if(_0x27e77d){if(_0x53e982[_0xd102('0x5a')][_0xd102('0x72')]){_0x38aa94[_0xd102('0x2c')]['interface']=util[_0xd102('0x62')](_0xd102('0x73'),_0x53e982[_0xd102('0x65')][_0xd102('0x41')]);_0x38aa94['message'][_0xd102('0x74')]=_0x38aa94[_0xd102('0x74')];_0x38aa94[_0xd102('0x2c')][_0xd102('0x75')]=_0xd102('0x5f');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x38aa94[_0xd102('0x2c')]},client9002)[_0xd102('0x25')](function(){return _0x38aa94;});}return _0x38aa94;}return null;})[_0xd102('0x25')](respondWithResult(_0x20e5f7,null))[_0xd102('0x5b')](handleError(_0x20e5f7,null));};var interaction_log=require(_0xd102('0x15'))(_0xd102('0x5e'));exports[_0xd102('0x34')]=function(_0x223cac,_0x236a08,_0xc9054d){var _0x65628b={'agent':{},'channel':_0xd102('0x76')};if(_0x223cac[_0xd102('0x5a')]['id']){delete _0x223cac[_0xd102('0x5a')]['id'];}_0x223cac['body']['UserId']=_0x223cac[_0xd102('0x5a')][_0xd102('0x64')]||_0x223cac[_0xd102('0x65')]['id'];_0x65628b[_0xd102('0x77')]['id']=_0x223cac[_0xd102('0x5a')][_0xd102('0x64')];return db[_0xd102('0x3c')]['find']({'where':{'id':_0x223cac[_0xd102('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x236a08,null))['then'](function(_0x272913){if(_0x272913){_0x65628b[_0xd102('0x2c')]=_0x272913[_0xd102('0x78')]({'plain':!![]});return db[_0xd102('0x68')][_0xd102('0x5c')]({'where':{'id':_0x272913[_0xd102('0x69')]}});}return null;})[_0xd102('0x25')](handleEntityNotFound(_0x236a08,null))[_0xd102('0x25')](function(_0x5a2470){if(_0x5a2470){_0x65628b['interaction']=_0x5a2470['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x223cac[_0xd102('0x65')]['id'],_0x223cac[_0xd102('0x65')][_0xd102('0x41')],_0x223cac[_0xd102('0x65')]['role'],_0x65628b[_0xd102('0x6c')]['id'],_0x223cac[_0xd102('0x5a')]?JSON[_0xd102('0x6e')](_0x223cac[_0xd102('0x5a')]):_0xd102('0x6f'));return respondWithRpcPromise('RejectMessage',_0xd102('0x79'),_0x65628b);}return null;})[_0xd102('0x25')](function(_0x38b8cd){if(_0x38b8cd){_0x38b8cd['message'][_0xd102('0x7a')]=util[_0xd102('0x62')](_0xd102('0x73'),_0x223cac[_0xd102('0x65')]['name']);_0x38b8cd['message'][_0xd102('0x74')]=_0x65628b[_0xd102('0x74')];_0x38b8cd[_0xd102('0x2c')][_0xd102('0x75')]='reject';respondWithRpcPromise(_0xd102('0x7b'),_0xd102('0x7b'),{'event':_0xd102('0x7c'),'message':_0x38b8cd['message']},client9002);return _0x65628b;}return null;})['then'](respondWithResult(_0x236a08,null))[_0xd102('0x5b')](handleError(_0x236a08,null));};exports[_0xd102('0x2e')]=function(_0x171d46,_0x508ab2,_0x234111){if(_0x171d46['body']['id']){delete _0x171d46[_0xd102('0x5a')]['id'];}var _0x538541;return db[_0xd102('0x3c')][_0xd102('0x5c')]({'where':{'id':_0x171d46[_0xd102('0x57')]['id']}})['then'](handleEntityNotFound(_0x508ab2,null))['then'](function(_0x5efe35){if(_0x5efe35){_0x538541=_0x5efe35;return db[_0xd102('0x7d')]['find']({'where':{'id':_0x5efe35['WhatsappAccountId']}});}})[_0xd102('0x25')](handleEntityNotFound(_0x508ab2,null))['then'](function(_0x11f9bb){if(_0x11f9bb){logger['debug'](_0xd102('0x7e'),'status','received\x20delivery\x20report\x20from',_0x11f9bb[_0xd102('0x3f')],util[_0xd102('0x7f')](_0x171d46[_0xd102('0x5a')],{'showHidden':![],'depth':null}));switch(_0x11f9bb[_0xd102('0x3f')]){case _0xd102('0x80'):if(_0x171d46[_0xd102('0x5a')][_0xd102('0x81')]&&_0x171d46[_0xd102('0x5a')]['MessageSid']===_0x538541['messageId']&&_0x171d46[_0xd102('0x5a')][_0xd102('0x82')]&&_0x171d46[_0xd102('0x5a')][_0xd102('0x82')]===_0xd102('0x60')){return _0x538541[_0xd102('0x36')]({'read':!![]});}else{logger[_0xd102('0x2b')](_0xd102('0x83'),'status',_0xd102('0x80'),util['inspect'](_0x171d46[_0xd102('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x538541;}})['then'](respondWithResult(_0x508ab2,null))[_0xd102('0x5b')](handleError(_0x508ab2,null));}; \ No newline at end of file +var _0xefc6=['index','map','WhatsappMessage','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','interaction','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','role','RejectMessage','rejectMessage','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','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','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','ValidationError','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send'];(function(_0x47c7eb,_0x3e3655){var _0x148991=function(_0x52dc2d){while(--_0x52dc2d){_0x47c7eb['push'](_0x47c7eb['shift']());}};_0x148991(++_0x3e3655);}(_0xefc6,0xc8));var _0x6efc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xefc6[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6efc('0x0'));var jsonpatch=require(_0x6efc('0x1'));var rp=require(_0x6efc('0x2'));var moment=require(_0x6efc('0x3'));var BPromise=require(_0x6efc('0x4'));var Mustache=require(_0x6efc('0x5'));var util=require(_0x6efc('0x6'));var path=require('path');var sox=require(_0x6efc('0x7'));var csv=require(_0x6efc('0x8'));var ejs=require(_0x6efc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6efc('0xa'));var crypto=require(_0x6efc('0xb'));var jsforce=require(_0x6efc('0xc'));var deskjs=require(_0x6efc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6efc('0xe'));var Papa=require(_0x6efc('0xf'));var Redis=require(_0x6efc('0x10'));var authService=require(_0x6efc('0x11'));var qs=require(_0x6efc('0x12'));var as=require(_0x6efc('0x13'));var hardwareService=require(_0x6efc('0x14'));var logger=require('../../config/logger')(_0x6efc('0x15'));var utils=require(_0x6efc('0x16'));var config=require(_0x6efc('0x17'));var db=require('../../mysqldb')['db'];config[_0x6efc('0x18')]=_[_0x6efc('0x19')](config[_0x6efc('0x18')],{'host':_0x6efc('0x1a'),'port':0x18eb});var socket=require(_0x6efc('0x1b'))(new Redis(config[_0x6efc('0x18')]));require(_0x6efc('0x1c'))[_0x6efc('0x1d')](socket);var jayson=require(_0x6efc('0x1e'));var client=jayson[_0x6efc('0x1f')][_0x6efc('0x20')]({'port':0x232c});var client9002=jayson[_0x6efc('0x1f')][_0x6efc('0x20')]({'port':0x232a});function checkPasswordPattern(_0x328c1d,_0x382291,_0x17e962){if(_0x17e962){var _0x1b238c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b238c['test'](_0x382291)){return _0x328c1d;}else{throw new db['Sequelize'][(_0x6efc('0x21'))]('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 _0x328c1d;}}function respondWithRpcPromise(_0x8ff10c,_0x273b00,_0x44eed4,_0xc84a9){return new BPromise(function(_0x2e673d,_0x45602d){var _0x6f1e5c=_0xc84a9||client;return _0x6f1e5c['request'](_0x8ff10c,_0x44eed4)[_0x6efc('0x22')](function(_0x54c20e){logger[_0x6efc('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x273b00,_0x6efc('0x24'));logger[_0x6efc('0x25')](_0x6efc('0x26'),_0x273b00,_0x6efc('0x24'),JSON[_0x6efc('0x27')](_0x54c20e));if(_0x54c20e[_0x6efc('0x28')]){if(_0x54c20e['error'][_0x6efc('0x29')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x273b00,_0x54c20e[_0x6efc('0x28')]['message']);return _0x45602d(_0x54c20e[_0x6efc('0x28')]['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x273b00,_0x54c20e[_0x6efc('0x28')]['message']);return _0x2e673d(_0x54c20e[_0x6efc('0x28')][_0x6efc('0x2a')]);}else{logger['info'](_0x6efc('0x2b'),_0x273b00,_0x6efc('0x24'));_0x2e673d(_0x54c20e[_0x6efc('0x2c')][_0x6efc('0x2a')]);}})[_0x6efc('0x2d')](function(_0x147c00){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x273b00,_0x147c00);_0x45602d(_0x147c00);});});}function respondWithStatusCode(_0x19c974,_0x1fc7b8){_0x1fc7b8=_0x1fc7b8||0xcc;return function(_0x126459){if(_0x126459){return _0x19c974[_0x6efc('0x2e')](_0x1fc7b8);}return _0x19c974[_0x6efc('0x2f')](_0x1fc7b8)[_0x6efc('0x30')]();};}function respondWithResult(_0x47f60f,_0x3bb658){_0x3bb658=_0x3bb658||0xc8;return function(_0x5d0d3b){if(_0x5d0d3b){return _0x47f60f['status'](_0x3bb658)[_0x6efc('0x31')](_0x5d0d3b);}};}function respondWithFilteredResult(_0x9af85b,_0x235c0f){return function(_0x10745d){if(_0x10745d){var _0x14fd71=_0x10745d[_0x6efc('0x32')],_0xfdc4be=_0x235c0f['offset'],_0x413fdf=_0x235c0f[_0x6efc('0x33')]+_0x235c0f[_0x6efc('0x34')],_0x3df212;if(_0x413fdf>=_0x14fd71){_0x413fdf=_0x14fd71;_0x3df212=0xc8;}else{_0x3df212=0xce;}_0x9af85b[_0x6efc('0x2f')](_0x3df212);return _0x9af85b[_0x6efc('0x35')](_0x6efc('0x36'),_0xfdc4be+'-'+_0x413fdf+'/'+_0x14fd71)[_0x6efc('0x31')](_0x10745d);}return null;};}function patchUpdates(_0x9afdb8){return function(_0x4d60cd){try{jsonpatch[_0x6efc('0x37')](_0x4d60cd,_0x9afdb8,!![]);}catch(_0x5afde1){return BPromise[_0x6efc('0x38')](_0x5afde1);}return _0x4d60cd[_0x6efc('0x39')]();};}function saveUpdates(_0x1e16e6,_0x370a6d){return function(_0x41c093){if(_0x41c093){return _0x41c093[_0x6efc('0x3a')](_0x1e16e6)[_0x6efc('0x22')](function(_0x101291){return _0x101291;});}return null;};}function removeEntity(_0x376a95,_0x3292d0){return function(_0x5cc3d3){if(_0x5cc3d3){return _0x5cc3d3['destroy']()[_0x6efc('0x22')](function(){_0x376a95[_0x6efc('0x2f')](0xcc)[_0x6efc('0x30')]();});}};}function handleEntityNotFound(_0x249f59,_0x4aa1fc){return function(_0x356f00){if(!_0x356f00){_0x249f59['sendStatus'](0x194);}return _0x356f00;};}function handleError(_0x1dc733,_0x418671){_0x418671=_0x418671||0x1f4;return function(_0x533873){logger[_0x6efc('0x28')](_0x533873[_0x6efc('0x3b')]);if(_0x533873[_0x6efc('0x3c')]){delete _0x533873[_0x6efc('0x3c')];}_0x1dc733[_0x6efc('0x2f')](_0x418671)[_0x6efc('0x3d')](_0x533873);};}exports[_0x6efc('0x3e')]=function(_0x57e9cb,_0x2f86a0){var _0x2b98ae={},_0x57821c={},_0x2f455c={'count':0x0,'rows':[]};var _0x2da020=_[_0x6efc('0x3f')](db[_0x6efc('0x40')]['rawAttributes'],function(_0x15464e){return{'name':_0x15464e[_0x6efc('0x41')],'type':_0x15464e['type'][_0x6efc('0x42')]};});_0x57821c['model']=_['map'](_0x2da020,'name');_0x57821c['query']=_[_0x6efc('0x43')](_0x57e9cb[_0x6efc('0x44')]);_0x57821c[_0x6efc('0x45')]=_[_0x6efc('0x46')](_0x57821c[_0x6efc('0x47')],_0x57821c[_0x6efc('0x44')]);_0x2b98ae['attributes']=_[_0x6efc('0x46')](_0x57821c['model'],qs[_0x6efc('0x48')](_0x57e9cb[_0x6efc('0x44')][_0x6efc('0x48')]));_0x2b98ae[_0x6efc('0x49')]=_0x2b98ae['attributes'][_0x6efc('0x4a')]?_0x2b98ae[_0x6efc('0x49')]:_0x57821c['model'];if(!_0x57e9cb[_0x6efc('0x44')][_0x6efc('0x4b')]('nolimit')){_0x2b98ae[_0x6efc('0x34')]=qs['limit'](_0x57e9cb['query'][_0x6efc('0x34')]);_0x2b98ae[_0x6efc('0x33')]=qs['offset'](_0x57e9cb[_0x6efc('0x44')][_0x6efc('0x33')]);}_0x2b98ae[_0x6efc('0x4c')]=qs[_0x6efc('0x4d')](_0x57e9cb[_0x6efc('0x44')][_0x6efc('0x4d')]);_0x2b98ae[_0x6efc('0x4e')]=qs[_0x6efc('0x45')](_[_0x6efc('0x4f')](_0x57e9cb[_0x6efc('0x44')],_0x57821c['filters']),_0x2da020);if(_0x57e9cb[_0x6efc('0x44')][_0x6efc('0x50')]){_0x2b98ae[_0x6efc('0x4e')]=_['merge'](_0x2b98ae[_0x6efc('0x4e')],{'$or':_[_0x6efc('0x3f')](_0x2da020,function(_0x156e8d){if(_0x156e8d[_0x6efc('0x51')]!==_0x6efc('0x52')){var _0x3294b0={};_0x3294b0[_0x156e8d['name']]={'$like':'%'+_0x57e9cb['query'][_0x6efc('0x50')]+'%'};return _0x3294b0;}})});}_0x2b98ae=_[_0x6efc('0x53')]({},_0x2b98ae,_0x57e9cb[_0x6efc('0x54')]);var _0x58cce6={'where':_0x2b98ae[_0x6efc('0x4e')]};return db[_0x6efc('0x40')]['count'](_0x58cce6)[_0x6efc('0x22')](function(_0xfb240f){_0x2f455c['count']=_0xfb240f;if(_0x57e9cb[_0x6efc('0x44')][_0x6efc('0x55')]){_0x2b98ae[_0x6efc('0x56')]=[{'all':!![]}];}return db[_0x6efc('0x40')][_0x6efc('0x57')](_0x2b98ae);})[_0x6efc('0x22')](function(_0x2f6f22){_0x2f455c['rows']=_0x2f6f22;return _0x2f455c;})[_0x6efc('0x22')](respondWithFilteredResult(_0x2f86a0,_0x2b98ae))[_0x6efc('0x2d')](handleError(_0x2f86a0,null));};exports[_0x6efc('0x58')]=function(_0x1382c3,_0x1bf6c7){var _0x42fa0a={'raw':!![],'where':{'id':_0x1382c3[_0x6efc('0x59')]['id']}},_0x4ee80d={};_0x4ee80d['model']=_[_0x6efc('0x43')](db['WhatsappMessage'][_0x6efc('0x5a')]);_0x4ee80d[_0x6efc('0x44')]=_[_0x6efc('0x43')](_0x1382c3[_0x6efc('0x44')]);_0x4ee80d[_0x6efc('0x45')]=_[_0x6efc('0x46')](_0x4ee80d[_0x6efc('0x47')],_0x4ee80d['query']);_0x42fa0a[_0x6efc('0x49')]=_[_0x6efc('0x46')](_0x4ee80d[_0x6efc('0x47')],qs[_0x6efc('0x48')](_0x1382c3[_0x6efc('0x44')]['fields']));_0x42fa0a[_0x6efc('0x49')]=_0x42fa0a['attributes'][_0x6efc('0x4a')]?_0x42fa0a[_0x6efc('0x49')]:_0x4ee80d[_0x6efc('0x47')];if(_0x1382c3[_0x6efc('0x44')][_0x6efc('0x55')]){_0x42fa0a[_0x6efc('0x56')]=[{'all':!![]}];}_0x42fa0a=_[_0x6efc('0x53')]({},_0x42fa0a,_0x1382c3[_0x6efc('0x54')]);return db['WhatsappMessage'][_0x6efc('0x5b')](_0x42fa0a)[_0x6efc('0x22')](handleEntityNotFound(_0x1bf6c7,null))[_0x6efc('0x22')](respondWithResult(_0x1bf6c7,null))['catch'](handleError(_0x1bf6c7,null));};exports[_0x6efc('0x5c')]=function(_0x6fa86f,_0x3609b8){return db[_0x6efc('0x40')][_0x6efc('0x5c')](_0x6fa86f[_0x6efc('0x5d')],{})[_0x6efc('0x22')](respondWithResult(_0x3609b8,0xc9))[_0x6efc('0x2d')](handleError(_0x3609b8,null));};exports[_0x6efc('0x3a')]=function(_0x428372,_0x292bdb){if(_0x428372[_0x6efc('0x5d')]['id']){delete _0x428372['body']['id'];}return db[_0x6efc('0x40')][_0x6efc('0x5b')]({'where':{'id':_0x428372[_0x6efc('0x59')]['id']}})[_0x6efc('0x22')](handleEntityNotFound(_0x292bdb,null))[_0x6efc('0x22')](saveUpdates(_0x428372['body'],null))[_0x6efc('0x22')](respondWithResult(_0x292bdb,null))[_0x6efc('0x2d')](handleError(_0x292bdb,null));};exports['destroy']=function(_0x39c7c3,_0x2f4e46){return db[_0x6efc('0x40')][_0x6efc('0x5b')]({'where':{'id':_0x39c7c3['params']['id']}})['then'](handleEntityNotFound(_0x2f4e46,null))[_0x6efc('0x22')](removeEntity(_0x2f4e46,null))[_0x6efc('0x2d')](handleError(_0x2f4e46,null));};exports[_0x6efc('0x5e')]=function(_0x251e8c,_0x1f8224){return db[_0x6efc('0x40')][_0x6efc('0x5e')]()['then'](respondWithResult(_0x1f8224,null))['catch'](handleError(_0x1f8224,null));};var interaction_log=require(_0x6efc('0x5f'))(_0x6efc('0x60'));exports[_0x6efc('0x61')]=function(_0x352526,_0x1a71e8,_0x36adf4){var _0x321a91={'channel':_0x6efc('0x62')};if(_0x352526['body']['id']){delete _0x352526[_0x6efc('0x5d')]['id'];}_0x352526['body']['read']=!![];_0x352526[_0x6efc('0x5d')]['readAt']=moment()[_0x6efc('0x63')](_0x6efc('0x64'));_0x352526[_0x6efc('0x5d')]['UserId']=_0x352526[_0x6efc('0x5d')][_0x6efc('0x65')]||_0x352526[_0x6efc('0x66')]['id'];return db[_0x6efc('0x40')][_0x6efc('0x5b')]({'where':{'id':_0x352526[_0x6efc('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x6efc('0x67')],'as':_0x6efc('0x68')}]})[_0x6efc('0x22')](handleEntityNotFound(_0x1a71e8,null))[_0x6efc('0x22')](saveUpdates(_0x352526[_0x6efc('0x5d')],null))[_0x6efc('0x22')](function(_0x1a5ed2){if(_0x1a5ed2){_0x321a91[_0x6efc('0x2a')]=_0x1a5ed2[_0x6efc('0x69')]({'plain':!![]});return db[_0x6efc('0x6a')][_0x6efc('0x5b')]({'where':{'id':_0x1a5ed2[_0x6efc('0x6b')]}});}return null;})[_0x6efc('0x22')](handleEntityNotFound(_0x1a71e8,null))[_0x6efc('0x22')](function(_0x501189){if(_0x501189){return _0x501189['update']({'UserId':_0x352526[_0x6efc('0x5d')][_0x6efc('0x65')],'read1stAt':_['isNil'](_0x501189['read1stAt'])?moment()[_0x6efc('0x63')](_0x6efc('0x64')):undefined});}return null;})[_0x6efc('0x22')](function(_0x2ef55f){if(_0x2ef55f){_0x321a91[_0x6efc('0x6c')]=_0x2ef55f[_0x6efc('0x69')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x352526[_0x6efc('0x66')]['id'],_0x352526['user'][_0x6efc('0x3c')],_0x352526[_0x6efc('0x66')]['role'],_0x321a91[_0x6efc('0x6c')]['id'],_0x352526['body']?JSON[_0x6efc('0x27')](_0x352526[_0x6efc('0x5d')]):_0x6efc('0x6d'));return respondWithRpcPromise(_0x6efc('0x6e'),'acceptMessage',_0x321a91);}return null;})[_0x6efc('0x22')](function(_0x4f1aa8){if(_0x4f1aa8){if(_0x352526[_0x6efc('0x5d')][_0x6efc('0x6f')]){_0x321a91[_0x6efc('0x2a')][_0x6efc('0x70')]=util['format'](_0x6efc('0x71'),_0x352526[_0x6efc('0x66')]['name']);_0x321a91[_0x6efc('0x2a')][_0x6efc('0x72')]=_0x321a91[_0x6efc('0x72')];_0x321a91[_0x6efc('0x2a')][_0x6efc('0x73')]=_0x6efc('0x61');return respondWithRpcPromise(_0x6efc('0x74'),_0x6efc('0x74'),{'event':'acceptmessage','message':_0x321a91[_0x6efc('0x2a')]},client9002)['then'](function(){return _0x321a91;});}return _0x321a91;}return null;})[_0x6efc('0x22')](respondWithResult(_0x1a71e8,null))[_0x6efc('0x2d')](handleError(_0x1a71e8,null));};var interaction_log=require(_0x6efc('0x5f'))(_0x6efc('0x60'));exports[_0x6efc('0x38')]=function(_0x23350e,_0x1bef2f,_0x215da4){var _0x36e61f={'agent':{},'channel':_0x6efc('0x62')};if(_0x23350e['body']['id']){delete _0x23350e[_0x6efc('0x5d')]['id'];}_0x23350e[_0x6efc('0x5d')][_0x6efc('0x65')]=_0x23350e[_0x6efc('0x5d')][_0x6efc('0x65')]||_0x23350e[_0x6efc('0x66')]['id'];_0x36e61f[_0x6efc('0x75')]['id']=_0x23350e[_0x6efc('0x5d')][_0x6efc('0x65')];return db['WhatsappMessage'][_0x6efc('0x5b')]({'where':{'id':_0x23350e['params']['id'],'UserId':null}})[_0x6efc('0x22')](handleEntityNotFound(_0x1bef2f,null))[_0x6efc('0x22')](function(_0x1d33a0){if(_0x1d33a0){_0x36e61f[_0x6efc('0x2a')]=_0x1d33a0['get']({'plain':!![]});return db[_0x6efc('0x6a')]['find']({'where':{'id':_0x1d33a0[_0x6efc('0x6b')]}});}return null;})[_0x6efc('0x22')](handleEntityNotFound(_0x1bef2f,null))[_0x6efc('0x22')](function(_0xcbec57){if(_0xcbec57){_0x36e61f[_0x6efc('0x6c')]=_0xcbec57[_0x6efc('0x69')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x23350e['user']['id'],_0x23350e[_0x6efc('0x66')][_0x6efc('0x3c')],_0x23350e[_0x6efc('0x66')][_0x6efc('0x76')],_0x36e61f[_0x6efc('0x6c')]['id'],_0x23350e[_0x6efc('0x5d')]?JSON[_0x6efc('0x27')](_0x23350e[_0x6efc('0x5d')]):_0x6efc('0x6d'));return respondWithRpcPromise(_0x6efc('0x77'),_0x6efc('0x78'),_0x36e61f);}return null;})[_0x6efc('0x22')](function(_0x1a08d1){if(_0x1a08d1){_0x1a08d1[_0x6efc('0x2a')][_0x6efc('0x70')]=util[_0x6efc('0x63')](_0x6efc('0x71'),_0x23350e[_0x6efc('0x66')][_0x6efc('0x3c')]);_0x1a08d1[_0x6efc('0x2a')][_0x6efc('0x72')]=_0x36e61f[_0x6efc('0x72')];_0x1a08d1[_0x6efc('0x2a')][_0x6efc('0x73')]='reject';respondWithRpcPromise(_0x6efc('0x74'),'EventManager',{'event':_0x6efc('0x79'),'message':_0x1a08d1[_0x6efc('0x2a')]},client9002);return _0x36e61f;}return null;})[_0x6efc('0x22')](respondWithResult(_0x1bef2f,null))[_0x6efc('0x2d')](handleError(_0x1bef2f,null));};exports['status']=function(_0x50096d,_0x1750af,_0x96c4c3){if(_0x50096d[_0x6efc('0x5d')]['id']){delete _0x50096d['body']['id'];}var _0x136095;return db[_0x6efc('0x40')][_0x6efc('0x5b')]({'where':{'id':_0x50096d[_0x6efc('0x59')]['id']}})[_0x6efc('0x22')](handleEntityNotFound(_0x1750af,null))[_0x6efc('0x22')](function(_0x4a368d){if(_0x4a368d){_0x136095=_0x4a368d;return db['WhatsappAccount'][_0x6efc('0x5b')]({'where':{'id':_0x4a368d[_0x6efc('0x7a')]}});}})[_0x6efc('0x22')](handleEntityNotFound(_0x1750af,null))['then'](function(_0x28e552){if(_0x28e552){logger[_0x6efc('0x25')](_0x6efc('0x7b'),_0x6efc('0x2f'),_0x6efc('0x7c'),_0x28e552[_0x6efc('0x51')],util[_0x6efc('0x7d')](_0x50096d[_0x6efc('0x5d')],{'showHidden':![],'depth':null}));switch(_0x28e552[_0x6efc('0x51')]){case _0x6efc('0x7e'):if(_0x50096d[_0x6efc('0x5d')]['MessageSid']&&_0x50096d[_0x6efc('0x5d')][_0x6efc('0x7f')]===_0x136095[_0x6efc('0x80')]&&_0x50096d[_0x6efc('0x5d')]['MessageStatus']&&_0x50096d[_0x6efc('0x5d')]['MessageStatus']===_0x6efc('0x81')){return _0x136095[_0x6efc('0x3a')]({'read':!![]});}else{logger[_0x6efc('0x28')](_0x6efc('0x82'),_0x6efc('0x2f'),_0x6efc('0x7e'),util['inspect'](_0x50096d[_0x6efc('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x136095;}})[_0x6efc('0x22')](respondWithResult(_0x1750af,null))[_0x6efc('0x2d')](handleError(_0x1750af,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 98d68e6..5601b3f 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x16367c,_0x1b3975){var _0x35270d=function(_0x20d72f){while(--_0x20d72f){_0x16367c['push'](_0x16367c['shift']());}};_0x35270d(++_0x1b3975);}(_0x5f2f,0x73));var _0xf5f2=function(_0x553857,_0x4951cb){_0x553857=_0x553857-0x0;var _0x205ca1=_0x5f2f[_0x553857];return _0x205ca1;};'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 +var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x69ad69,_0x5060b7){var _0xde56ca=function(_0x28fefe){while(--_0x28fefe){_0x69ad69['push'](_0x69ad69['shift']());}};_0xde56ca(++_0x5060b7);}(_0x7a54,0x106));var _0x47a5=function(_0x4cf779,_0x13e983){_0x4cf779=_0x4cf779-0x0;var _0x2adc5e=_0x7a54[_0x4cf779];return _0x2adc5e;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0f807d0..7d02b54 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 _0x146c=['phone','remote','/status?token=','token','sid','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','create','whatsapp:'];(function(_0x5827b5,_0x5bce22){var _0x2ed4b5=function(_0x5aa8ad){while(--_0x5aa8ad){_0x5827b5['push'](_0x5827b5['shift']());}};_0x2ed4b5(++_0x5bce22);}(_0x146c,0x6a));var _0xc146=function(_0x1a4701,_0x179298){_0x1a4701=_0x1a4701-0x0;var _0x18fce0=_0x146c[_0x1a4701];return _0x18fce0;};'use strict';var _=require(_0xc146('0x0'));var util=require(_0xc146('0x1'));var logger=require(_0xc146('0x2'))(_0xc146('0x3'));var moment=require(_0xc146('0x4'));var BPromise=require('bluebird');var rp=require(_0xc146('0x5'));var fs=require('fs');var path=require(_0xc146('0x6'));var rimraf=require(_0xc146('0x7'));var config=require(_0xc146('0x8'));var attributes=require(_0xc146('0x9'));module['exports']=function(_0x112ca1,_0x23eb0){return _0x112ca1[_0xc146('0xa')](_0xc146('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xc146('0xc'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0xc146('0xd')],'type':_0xc146('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3208f9,_0x5668e8,_0x550d07){var _0x3ee14a=_0x112ca1[_0xc146('0xf')];var _0x6618e6=_0x3208f9[_0xc146('0x10')]({'plain':!![]});if(_0x6618e6['direction']['toLowerCase']()==='in'||_0x6618e6[_0xc146('0x11')][_0xc146('0x12')]()===_0xc146('0x13')&&!_0x6618e6[_0xc146('0x14')]&&!_['isNil'](_0x6618e6[_0xc146('0x15')])){_0x3ee14a[_0xc146('0x16')]['findOne']({'where':{'id':_0x6618e6[_0xc146('0x17')]}})[_0xc146('0x18')](function(_0x2a1e23){if(_0x2a1e23){_0x2a1e23[_0xc146('0x19')]({'lastMsgAt':_0x6618e6[_0xc146('0x1a')],'lastMsgDirection':_0x6618e6[_0xc146('0x11')][_0xc146('0x12')]()});}})[_0xc146('0x1b')](function(_0x52c58b){console[_0xc146('0x1c')](_0x52c58b);});}if(_0x6618e6[_0xc146('0x11')]===_0xc146('0x13')&&!_0x6618e6[_0xc146('0x14')]){var _0x526667;_0x3ee14a[_0xc146('0x1d')][_0xc146('0x1e')]({'where':{'id':_0x6618e6[_0xc146('0x1f')]},'raw':!![]})['then'](function(_0x268a61){_0x526667=_0x268a61;if(_0x526667&&_0x526667[_0xc146('0x20')]){switch(_0x526667[_0xc146('0x20')]){case _0xc146('0x21'):var _0x2ae2a8=require(_0xc146('0x21'));if(_0x526667[_0xc146('0x22')]&&_0x526667[_0xc146('0x23')]&&_0x526667['phone']){var _0x41c452=new _0x2ae2a8(_0x526667[_0xc146('0x22')],_0x526667[_0xc146('0x23')]);_0x41c452['messages'][_0xc146('0x24')]({'body':_0x6618e6['body'],'to':_0xc146('0x25')+_0x6618e6[_0xc146('0x26')],'from':_0xc146('0x25')+_0x526667[_0xc146('0x26')],'statusCallback':_0x526667[_0xc146('0x27')]+'/api/whatsapp/messages/'+_0x6618e6['id']+_0xc146('0x28')+_0x526667[_0xc146('0x29')]})[_0xc146('0x18')](function(_0x23e827){if(_0x23e827[_0xc146('0x2a')]){return _0x3208f9[_0xc146('0x19')]({'messageId':_0x23e827['sid']});}})[_0xc146('0x1b')](function(_0x4ff7d8){logger[_0xc146('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc146('0x2b'),_0xc146('0x21'),util[_0xc146('0x2c')](_0x4ff7d8,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc146('0x2b'),_0xc146('0x21'),_0xc146('0x2d'));}break;}}})['finally'](function(){_0x550d07();});}else{_0x550d07();}}},'charset':_0xc146('0x2e'),'collate':_0xc146('0x2f')});}; \ No newline at end of file +var _0x5c13=['UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','create','whatsapp:','/api/whatsapp/messages/','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','toLowerCase','direction','out','secret','isNil'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5c13,0x1db));var _0x35c1=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x5c13[_0x247fa1];return _0x244f35;};'use strict';var _=require('lodash');var util=require(_0x35c1('0x0'));var logger=require('../../config/logger')(_0x35c1('0x1'));var moment=require(_0x35c1('0x2'));var BPromise=require(_0x35c1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35c1('0x4'));var rimraf=require(_0x35c1('0x5'));var config=require('../../config/environment');var attributes=require(_0x35c1('0x6'));module[_0x35c1('0x7')]=function(_0x1c6231,_0x463154){return _0x1c6231[_0x35c1('0x8')](_0x35c1('0x9'),attributes,{'tableName':_0x35c1('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x35c1('0xb')]},{'name':_0x35c1('0xc'),'fields':[_0x35c1('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b02ee,_0x5260db,_0x79da9a){var _0x15563c=_0x1c6231[_0x35c1('0xe')];var _0x50144a=_0x5b02ee['get']({'plain':!![]});if(_0x50144a['direction'][_0x35c1('0xf')]()==='in'||_0x50144a[_0x35c1('0x10')][_0x35c1('0xf')]()===_0x35c1('0x11')&&!_0x50144a[_0x35c1('0x12')]&&!_[_0x35c1('0x13')](_0x50144a[_0x35c1('0x14')])){_0x15563c[_0x35c1('0x15')][_0x35c1('0x16')]({'where':{'id':_0x50144a[_0x35c1('0x17')]}})[_0x35c1('0x18')](function(_0x52b098){if(_0x52b098){_0x52b098[_0x35c1('0x19')]({'lastMsgAt':_0x50144a['createdAt'],'lastMsgDirection':_0x50144a[_0x35c1('0x10')]['toLowerCase']()});}})[_0x35c1('0x1a')](function(_0x59218f){console[_0x35c1('0x1b')](_0x59218f);});}if(_0x50144a[_0x35c1('0x10')]==='out'&&!_0x50144a[_0x35c1('0x12')]){var _0x334a54;_0x15563c[_0x35c1('0x1c')][_0x35c1('0x1d')]({'where':{'id':_0x50144a[_0x35c1('0x1e')]},'raw':!![]})[_0x35c1('0x18')](function(_0x1a9a00){_0x334a54=_0x1a9a00;if(_0x334a54&&_0x334a54[_0x35c1('0x1f')]){switch(_0x334a54[_0x35c1('0x1f')]){case'twilio':var _0x202a0b=require(_0x35c1('0x20'));if(_0x334a54['accountSid']&&_0x334a54[_0x35c1('0x21')]&&_0x334a54[_0x35c1('0x22')]){var _0x11ca56=new _0x202a0b(_0x334a54[_0x35c1('0x23')],_0x334a54[_0x35c1('0x21')]);_0x11ca56['messages'][_0x35c1('0x24')]({'body':_0x50144a[_0x35c1('0xd')],'to':'whatsapp:'+_0x50144a['phone'],'from':_0x35c1('0x25')+_0x334a54['phone'],'statusCallback':_0x334a54['remote']+_0x35c1('0x26')+_0x50144a['id']+'/status?token='+_0x334a54['token']})[_0x35c1('0x18')](function(_0x3e8326){if(_0x3e8326[_0x35c1('0x27')]){return _0x5b02ee[_0x35c1('0x19')]({'messageId':_0x3e8326[_0x35c1('0x27')]});}})['catch'](function(_0x3774ec){logger[_0x35c1('0x1b')](_0x35c1('0x28'),_0x35c1('0x29'),'twilio',util[_0x35c1('0x2a')](_0x3774ec,{'showHidden':![],'depth':null}));});}else{logger[_0x35c1('0x1b')](_0x35c1('0x28'),_0x35c1('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x79da9a();});}else{_0x79da9a();}}},'charset':_0x35c1('0x2b'),'collate':_0x35c1('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 66fac0d..7a095ee 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 _0xe9e6=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateWhatsappMessage','create','body','options','raw','debug','stringify','lodash'];(function(_0xbeb8a,_0x291392){var _0x573257=function(_0x4f0138){while(--_0x4f0138){_0xbeb8a['push'](_0xbeb8a['shift']());}};_0x573257(++_0x291392);}(_0xe9e6,0x9a));var _0x6e9e=function(_0xefb4e,_0xe56689){_0xefb4e=_0xefb4e-0x0;var _0x36c78c=_0xe9e6[_0xefb4e];return _0x36c78c;};'use strict';var _=require(_0x6e9e('0x0'));var util=require(_0x6e9e('0x1'));var moment=require(_0x6e9e('0x2'));var BPromise=require(_0x6e9e('0x3'));var rs=require(_0x6e9e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e9e('0x5'));var logger=require(_0x6e9e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6e9e('0x7'));var client=jayson[_0x6e9e('0x8')][_0x6e9e('0x9')]({'port':0x232a});config[_0x6e9e('0xa')]=_[_0x6e9e('0xb')](config[_0x6e9e('0xa')],{'host':_0x6e9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e9e('0xa')]));require(_0x6e9e('0xd'))[_0x6e9e('0xe')](socket);function respondWithRpcPromise(_0x211c19,_0x2687eb,_0xbfd760){return new BPromise(function(_0x15c327,_0x51df6e){return client[_0x6e9e('0xf')](_0x211c19,_0xbfd760)[_0x6e9e('0x10')](function(_0x3d24a9){logger[_0x6e9e('0x11')](_0x6e9e('0x12'),_0x2687eb,'request\x20sent');logger['debug'](_0x6e9e('0x13'),_0x2687eb,_0x6e9e('0x14'),JSON['stringify'](_0x3d24a9));if(_0x3d24a9[_0x6e9e('0x15')]){if(_0x3d24a9[_0x6e9e('0x15')]['code']===0x1f4){logger[_0x6e9e('0x15')](_0x6e9e('0x12'),_0x2687eb,_0x3d24a9[_0x6e9e('0x15')][_0x6e9e('0x16')]);return _0x51df6e(_0x3d24a9[_0x6e9e('0x15')][_0x6e9e('0x16')]);}logger[_0x6e9e('0x15')](_0x6e9e('0x12'),_0x2687eb,_0x3d24a9[_0x6e9e('0x15')]['message']);return _0x15c327(_0x3d24a9[_0x6e9e('0x15')]['message']);}else{logger['info'](_0x6e9e('0x12'),_0x2687eb,'request\x20sent');_0x15c327(_0x3d24a9['result'][_0x6e9e('0x16')]);}})[_0x6e9e('0x17')](function(_0x2b0be6){logger[_0x6e9e('0x15')](_0x6e9e('0x12'),_0x2687eb,_0x2b0be6);_0x51df6e(_0x2b0be6);});});}exports[_0x6e9e('0x18')]=function(_0x22371c){var _0x2ab8f0=this;return new Promise(function(_0x342b61,_0x2e9e35){return db['WhatsappMessage'][_0x6e9e('0x19')](_0x22371c[_0x6e9e('0x1a')],{'raw':_0x22371c[_0x6e9e('0x1b')]?_0x22371c['options'][_0x6e9e('0x1c')]===undefined?!![]:![]:!![]})[_0x6e9e('0x10')](function(_0x287861){logger['info'](_0x6e9e('0x18'),_0x22371c);logger[_0x6e9e('0x1d')](_0x6e9e('0x18'),_0x22371c,JSON[_0x6e9e('0x1e')](_0x287861));_0x342b61(_0x287861);})['catch'](function(_0x5a84db){logger['error'](_0x6e9e('0x18'),_0x5a84db[_0x6e9e('0x16')],_0x22371c);_0x2e9e35(_0x2ab8f0['error'](0x1f4,_0x5a84db[_0x6e9e('0x16')]));});});}; \ No newline at end of file +var _0x4a87=['./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','options','CreateWhatsappMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4a87,0x75));var _0x74a8=function(_0x5c200d,_0x2a3288){_0x5c200d=_0x5c200d-0x0;var _0x318549=_0x4a87[_0x5c200d];return _0x318549;};'use strict';var _=require(_0x74a8('0x0'));var util=require(_0x74a8('0x1'));var moment=require(_0x74a8('0x2'));var BPromise=require(_0x74a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74a8('0x4'));var db=require(_0x74a8('0x5'))['db'];var utils=require(_0x74a8('0x6'));var logger=require('../../config/logger')(_0x74a8('0x7'));var config=require(_0x74a8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x74a8('0x9')][_0x74a8('0xa')]({'port':0x232a});config[_0x74a8('0xb')]=_[_0x74a8('0xc')](config[_0x74a8('0xb')],{'host':_0x74a8('0xd'),'port':0x18eb});var socket=require(_0x74a8('0xe'))(new Redis(config[_0x74a8('0xb')]));require(_0x74a8('0xf'))[_0x74a8('0x10')](socket);function respondWithRpcPromise(_0x37b43,_0x24dc76,_0x3ae591){return new BPromise(function(_0x4f52a1,_0x43c96c){return client[_0x74a8('0x11')](_0x37b43,_0x3ae591)[_0x74a8('0x12')](function(_0x10840c){logger['info'](_0x74a8('0x13'),_0x24dc76,_0x74a8('0x14'));logger[_0x74a8('0x15')](_0x74a8('0x16'),_0x24dc76,_0x74a8('0x14'),JSON[_0x74a8('0x17')](_0x10840c));if(_0x10840c[_0x74a8('0x18')]){if(_0x10840c[_0x74a8('0x18')][_0x74a8('0x19')]===0x1f4){logger[_0x74a8('0x18')](_0x74a8('0x13'),_0x24dc76,_0x10840c[_0x74a8('0x18')][_0x74a8('0x1a')]);return _0x43c96c(_0x10840c[_0x74a8('0x18')]['message']);}logger[_0x74a8('0x18')](_0x74a8('0x13'),_0x24dc76,_0x10840c[_0x74a8('0x18')][_0x74a8('0x1a')]);return _0x4f52a1(_0x10840c[_0x74a8('0x18')][_0x74a8('0x1a')]);}else{logger[_0x74a8('0x1b')]('WhatsappMessage,\x20%s,\x20%s',_0x24dc76,_0x74a8('0x14'));_0x4f52a1(_0x10840c[_0x74a8('0x1c')][_0x74a8('0x1a')]);}})[_0x74a8('0x1d')](function(_0x27b141){logger[_0x74a8('0x18')](_0x74a8('0x13'),_0x24dc76,_0x27b141);_0x43c96c(_0x27b141);});});}exports['CreateWhatsappMessage']=function(_0x5a81ac){var _0xe71abb=this;return new Promise(function(_0x13e844,_0x25db86){return db['WhatsappMessage'][_0x74a8('0x1e')](_0x5a81ac['body'],{'raw':_0x5a81ac[_0x74a8('0x1f')]?_0x5a81ac['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x324236){logger[_0x74a8('0x1b')](_0x74a8('0x20'),_0x5a81ac);logger[_0x74a8('0x15')](_0x74a8('0x20'),_0x5a81ac,JSON[_0x74a8('0x17')](_0x324236));_0x13e844(_0x324236);})['catch'](function(_0x4606d1){logger['error'](_0x74a8('0x20'),_0x4606d1[_0x74a8('0x1a')],_0x5a81ac);_0x25db86(_0xe71abb['error'](0x1f4,_0x4606d1['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 448ac42..38f79bb 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 _0x476f=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x314e6e,_0x457122){var _0x4571b1=function(_0x3eed04){while(--_0x3eed04){_0x314e6e['push'](_0x314e6e['shift']());}};_0x4571b1(++_0x457122);}(_0x476f,0xf5));var _0xf476=function(_0xca9a19,_0x1d23c5){_0xca9a19=_0xca9a19-0x0;var _0x38f747=_0x476f[_0xca9a19];return _0x38f747;};'use strict';var WhatsappMessageEvents=require(_0xf476('0x0'));var events=['save','remove',_0xf476('0x1')];function createListener(_0x43e47f,_0x257d81){return function(_0x1bf2aa){_0x257d81[_0xf476('0x2')](_0x43e47f,_0x1bf2aa);};}function removeListener(_0x5855c3,_0x3bca05){return function(){WhatsappMessageEvents['removeListener'](_0x5855c3,_0x3bca05);};}exports[_0xf476('0x3')]=function(_0x32ac66){for(var _0x24bb3c=0x0,_0x4ea59c=events[_0xf476('0x4')];_0x24bb3c<_0x4ea59c;_0x24bb3c++){var _0x417a40=events[_0x24bb3c];var _0x593552=createListener(_0xf476('0x5')+_0x417a40,_0x32ac66);WhatsappMessageEvents['on'](_0x417a40,_0x593552);}}; \ No newline at end of file +var _0xc8b0=['emit','removeListener','register','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x549ba1,_0xadc20){var _0x550011=function(_0x27a255){while(--_0x27a255){_0x549ba1['push'](_0x549ba1['shift']());}};_0x550011(++_0xadc20);}(_0xc8b0,0x1cc));var _0x0c8b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc8b0[_0x397e5f];return _0x5302b8;};'use strict';var WhatsappMessageEvents=require(_0x0c8b('0x0'));var events=[_0x0c8b('0x1'),_0x0c8b('0x2'),_0x0c8b('0x3')];function createListener(_0x126c9b,_0x36b99b){return function(_0x2f1c1f){_0x36b99b[_0x0c8b('0x4')](_0x126c9b,_0x2f1c1f);};}function removeListener(_0xd3ef38,_0x3d1cc9){return function(){WhatsappMessageEvents[_0x0c8b('0x5')](_0xd3ef38,_0x3d1cc9);};}exports[_0x0c8b('0x6')]=function(_0x1c6dfe){for(var _0x2ac705=0x0,_0x17b93d=events['length'];_0x2ac705<_0x17b93d;_0x2ac705++){var _0xcbeca9=events[_0x2ac705];var _0x5cf70f=createListener(_0x0c8b('0x7')+_0xcbeca9,_0x1c6dfe);WhatsappMessageEvents['on'](_0xcbeca9,_0x5cf70f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 2ec07ad..98194b2 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 _0x976a=['index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','delete','destroy','exports','multer','path','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated'];(function(_0x57939d,_0x46ddbe){var _0xba66a1=function(_0x381754){while(--_0x381754){_0x57939d['push'](_0x57939d['shift']());}};_0xba66a1(++_0x46ddbe);}(_0x976a,0x1f1));var _0xa976=function(_0x49279c,_0x56da65){_0x49279c=_0x49279c-0x0;var _0x472c04=_0x976a[_0x49279c];return _0x472c04;};'use strict';var multer=require(_0xa976('0x0'));var util=require('util');var path=require(_0xa976('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa976('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xa976('0x3'));var controller=require(_0xa976('0x4'));router[_0xa976('0x5')]('/',auth[_0xa976('0x6')](),controller[_0xa976('0x7')]);router['get'](_0xa976('0x8'),auth[_0xa976('0x6')](),controller[_0xa976('0x9')]);router[_0xa976('0x5')](_0xa976('0xa'),auth['isAuthenticated'](),controller[_0xa976('0xb')]);router[_0xa976('0x5')](_0xa976('0xc'),auth['isAuthenticated'](),controller[_0xa976('0xd')]);router['get'](_0xa976('0xe'),auth[_0xa976('0x6')](),controller[_0xa976('0xf')]);router[_0xa976('0x5')](_0xa976('0x10'),auth[_0xa976('0x6')](),controller[_0xa976('0x11')]);router[_0xa976('0x12')]('/',auth[_0xa976('0x6')](),controller[_0xa976('0x13')]);router['post'](_0xa976('0xe'),auth[_0xa976('0x6')](),controller[_0xa976('0x14')]);router['post'](_0xa976('0x10'),auth[_0xa976('0x6')](),controller['addAgents']);router['put'](_0xa976('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xa976('0x15')](_0xa976('0xa'),auth[_0xa976('0x6')](),controller[_0xa976('0x16')]);router['delete'](_0xa976('0xe'),auth[_0xa976('0x6')](),controller['removeTeams']);router[_0xa976('0x15')](_0xa976('0x10'),auth[_0xa976('0x6')](),controller['removeAgents']);module[_0xa976('0x17')]=router; \ No newline at end of file +var _0x4a09=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members'];(function(_0x36eafc,_0x23fc6e){var _0x412f49=function(_0x2cdf16){while(--_0x2cdf16){_0x36eafc['push'](_0x36eafc['shift']());}};_0x412f49(++_0x23fc6e);}(_0x4a09,0x112));var _0x94a0=function(_0x2fd1ae,_0x5af591){_0x2fd1ae=_0x2fd1ae-0x0;var _0x462bee=_0x4a09[_0x2fd1ae];return _0x462bee;};'use strict';var multer=require(_0x94a0('0x0'));var util=require(_0x94a0('0x1'));var path=require(_0x94a0('0x2'));var timeout=require(_0x94a0('0x3'));var express=require('express');var router=express[_0x94a0('0x4')]();var auth=require(_0x94a0('0x5'));var interaction=require(_0x94a0('0x6'));var config=require(_0x94a0('0x7'));var controller=require(_0x94a0('0x8'));router[_0x94a0('0x9')]('/',auth[_0x94a0('0xa')](),controller[_0x94a0('0xb')]);router[_0x94a0('0x9')](_0x94a0('0xc'),auth['isAuthenticated'](),controller[_0x94a0('0xd')]);router[_0x94a0('0x9')]('/:id',auth[_0x94a0('0xa')](),controller[_0x94a0('0xe')]);router[_0x94a0('0x9')](_0x94a0('0xf'),auth['isAuthenticated'](),controller[_0x94a0('0x10')]);router[_0x94a0('0x9')](_0x94a0('0x11'),auth['isAuthenticated'](),controller[_0x94a0('0x12')]);router[_0x94a0('0x9')](_0x94a0('0x13'),auth[_0x94a0('0xa')](),controller[_0x94a0('0x14')]);router['post']('/',auth[_0x94a0('0xa')](),controller[_0x94a0('0x15')]);router['post'](_0x94a0('0x11'),auth[_0x94a0('0xa')](),controller[_0x94a0('0x16')]);router['post'](_0x94a0('0x13'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x94a0('0x17'),auth[_0x94a0('0xa')](),controller[_0x94a0('0x18')]);router[_0x94a0('0x19')]('/:id',auth[_0x94a0('0xa')](),controller[_0x94a0('0x1a')]);router[_0x94a0('0x19')](_0x94a0('0x11'),auth[_0x94a0('0xa')](),controller[_0x94a0('0x1b')]);router[_0x94a0('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x94a0('0x1c')]);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 8006b7d..989f454 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 _0x5007=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4072e9,_0x4a0528){var _0x48a322=function(_0x1aa217){while(--_0x1aa217){_0x4072e9['push'](_0x4072e9['shift']());}};_0x48a322(++_0x4a0528);}(_0x5007,0x1d0));var _0x7500=function(_0xe4a57e,_0x204fce){_0xe4a57e=_0xe4a57e-0x0;var _0x47ba3e=_0x5007[_0xe4a57e];return _0x47ba3e;};'use strict';var Sequelize=require(_0x7500('0x0'));module['exports']={'name':{'type':Sequelize[_0x7500('0x1')],'unique':_0x7500('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7500('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7500('0x4')](_0x7500('0x5'),_0x7500('0x6'),_0x7500('0x7'))},'description':{'type':Sequelize[_0x7500('0x1')]}}; \ No newline at end of file +var _0xad05=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x4da008,_0x1e853a){var _0x15ceb1=function(_0x4a58fb){while(--_0x4a58fb){_0x4da008['push'](_0x4da008['shift']());}};_0x15ceb1(++_0x1e853a);}(_0xad05,0x1cc));var _0x5ad0=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xad05[_0x57add2];return _0x4e3670;};'use strict';var Sequelize=require(_0x5ad0('0x0'));module[_0x5ad0('0x1')]={'name':{'type':Sequelize[_0x5ad0('0x2')],'unique':_0x5ad0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5ad0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5ad0('0x5')](_0x5ad0('0x6'),_0x5ad0('0x7'),_0x5ad0('0x8'))},'description':{'type':Sequelize[_0x5ad0('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a7855f8..3c5a82e 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 _0x2242=['agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getMembers','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x2242,0x1d6));var _0x2224=function(_0x2499ee,_0x1e62fc){_0x2499ee=_0x2499ee-0x0;var _0x9b487b=_0x2242[_0x2499ee];return _0x9b487b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2224('0x0'));var jsonpatch=require(_0x2224('0x1'));var rp=require(_0x2224('0x2'));var moment=require(_0x2224('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2224('0x4'));var util=require('util');var path=require(_0x2224('0x5'));var sox=require(_0x2224('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2224('0x7'));var squel=require(_0x2224('0x8'));var crypto=require(_0x2224('0x9'));var jsforce=require(_0x2224('0xa'));var deskjs=require(_0x2224('0xb'));var toCsv=require(_0x2224('0xc'));var querystring=require(_0x2224('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2224('0xe'));var qs=require(_0x2224('0xf'));var as=require(_0x2224('0x10'));var hardwareService=require(_0x2224('0x11'));var logger=require(_0x2224('0x12'))(_0x2224('0x13'));var utils=require(_0x2224('0x14'));var config=require(_0x2224('0x15'));var db=require(_0x2224('0x16'))['db'];config[_0x2224('0x17')]=_[_0x2224('0x18')](config[_0x2224('0x17')],{'host':_0x2224('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2224('0x17')]));require(_0x2224('0x1a'))[_0x2224('0x1b')](socket);function respondWithStatusCode(_0x65d001,_0x524999){_0x524999=_0x524999||0xcc;return function(_0x45cf91){if(_0x45cf91){return _0x65d001[_0x2224('0x1c')](_0x524999);}return _0x65d001[_0x2224('0x1d')](_0x524999)[_0x2224('0x1e')]();};}function respondWithResult(_0x5b8c6e,_0x57314c){_0x57314c=_0x57314c||0xc8;return function(_0x1d4c17){if(_0x1d4c17){return _0x5b8c6e[_0x2224('0x1d')](_0x57314c)[_0x2224('0x1f')](_0x1d4c17);}};}function respondWithFilteredResult(_0x30ca32,_0x5e72d1){return function(_0x587625){if(_0x587625){var _0x25ea60=_0x587625[_0x2224('0x20')],_0x3497c7=_0x5e72d1['offset'],_0x38acce=_0x5e72d1[_0x2224('0x21')]+_0x5e72d1[_0x2224('0x22')],_0x216f06;if(_0x38acce>=_0x25ea60){_0x38acce=_0x25ea60;_0x216f06=0xc8;}else{_0x216f06=0xce;}_0x30ca32[_0x2224('0x1d')](_0x216f06);return _0x30ca32[_0x2224('0x23')](_0x2224('0x24'),_0x3497c7+'-'+_0x38acce+'/'+_0x25ea60)[_0x2224('0x1f')](_0x587625);}return null;};}function patchUpdates(_0x99dd80){return function(_0x46fffc){try{jsonpatch['apply'](_0x46fffc,_0x99dd80,!![]);}catch(_0x432d8b){return BPromise[_0x2224('0x25')](_0x432d8b);}return _0x46fffc[_0x2224('0x26')]();};}function saveUpdates(_0x1d3c77,_0x3148a4){return function(_0xb67fc7){if(_0xb67fc7){return _0xb67fc7[_0x2224('0x27')](_0x1d3c77)[_0x2224('0x28')](function(_0x2539f7){return _0x2539f7;});}return null;};}function removeEntity(_0x2b9b7f,_0x359c5a){return function(_0x50f007){if(_0x50f007){return _0x50f007['destroy']()[_0x2224('0x28')](function(){var _0x5019b6=_0x50f007[_0x2224('0x29')]({'plain':!![]});var _0x2e2375='WhatsappQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x2e2375,'resourceId':_0x5019b6['id']}})[_0x2224('0x28')](function(){return _0x50f007;});})[_0x2224('0x28')](function(){_0x2b9b7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bab89,_0x50b846){return function(_0x338652){if(!_0x338652){_0x3bab89['sendStatus'](0x194);}return _0x338652;};}function handleError(_0x30c9fc,_0x511419){_0x511419=_0x511419||0x1f4;return function(_0x5432a6){logger[_0x2224('0x2a')](_0x5432a6[_0x2224('0x2b')]);if(_0x5432a6[_0x2224('0x2c')]){delete _0x5432a6[_0x2224('0x2c')];}_0x30c9fc[_0x2224('0x1d')](_0x511419)[_0x2224('0x2d')](_0x5432a6);};}exports[_0x2224('0x2e')]=function(_0x3ca3d8,_0x566cdf){var _0x3f4306={},_0x5d3904={},_0x170a3b={'count':0x0,'rows':[]};var _0x583a66=_[_0x2224('0x2f')](db[_0x2224('0x30')]['rawAttributes'],function(_0xe65f42){return{'name':_0xe65f42[_0x2224('0x31')],'type':_0xe65f42[_0x2224('0x32')][_0x2224('0x33')]};});_0x5d3904[_0x2224('0x34')]=_[_0x2224('0x2f')](_0x583a66,_0x2224('0x2c'));_0x5d3904[_0x2224('0x35')]=_[_0x2224('0x36')](_0x3ca3d8[_0x2224('0x35')]);_0x5d3904['filters']=_[_0x2224('0x37')](_0x5d3904['model'],_0x5d3904[_0x2224('0x35')]);_0x3f4306[_0x2224('0x38')]=_['intersection'](_0x5d3904[_0x2224('0x34')],qs['fields'](_0x3ca3d8['query'][_0x2224('0x39')]));_0x3f4306[_0x2224('0x38')]=_0x3f4306['attributes'][_0x2224('0x3a')]?_0x3f4306[_0x2224('0x38')]:_0x5d3904[_0x2224('0x34')];if(!_0x3ca3d8[_0x2224('0x35')][_0x2224('0x3b')](_0x2224('0x3c'))){_0x3f4306[_0x2224('0x22')]=qs[_0x2224('0x22')](_0x3ca3d8[_0x2224('0x35')]['limit']);_0x3f4306[_0x2224('0x21')]=qs[_0x2224('0x21')](_0x3ca3d8[_0x2224('0x35')][_0x2224('0x21')]);}_0x3f4306[_0x2224('0x3d')]=qs['sort'](_0x3ca3d8[_0x2224('0x35')][_0x2224('0x3e')]);_0x3f4306[_0x2224('0x3f')]=qs[_0x2224('0x40')](_['pick'](_0x3ca3d8[_0x2224('0x35')],_0x5d3904[_0x2224('0x40')]),_0x583a66);if(_0x3ca3d8[_0x2224('0x35')][_0x2224('0x41')]){_0x3f4306['where']=_[_0x2224('0x42')](_0x3f4306[_0x2224('0x3f')],{'$or':_[_0x2224('0x2f')](_0x583a66,function(_0x493f99){if(_0x493f99[_0x2224('0x32')]!==_0x2224('0x43')){var _0xc9242a={};_0xc9242a[_0x493f99['name']]={'$like':'%'+_0x3ca3d8[_0x2224('0x35')][_0x2224('0x41')]+'%'};return _0xc9242a;}})});}_0x3f4306=_[_0x2224('0x42')]({},_0x3f4306,_0x3ca3d8[_0x2224('0x44')]);var _0x2a8cda={'where':_0x3f4306['where']};return db['WhatsappQueue'][_0x2224('0x20')](_0x2a8cda)[_0x2224('0x28')](function(_0x5af508){_0x170a3b[_0x2224('0x20')]=_0x5af508;if(_0x3ca3d8['query']['includeAll']){_0x3f4306[_0x2224('0x45')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x2224('0x46')](_0x3f4306);})[_0x2224('0x28')](function(_0x25102f){_0x170a3b[_0x2224('0x47')]=_0x25102f;return _0x170a3b;})[_0x2224('0x28')](respondWithFilteredResult(_0x566cdf,_0x3f4306))['catch'](handleError(_0x566cdf,null));};exports[_0x2224('0x48')]=function(_0x10194d,_0x1f93c1){var _0x5064bf={'raw':!![],'where':{'id':_0x10194d[_0x2224('0x49')]['id']}},_0x412046={};_0x412046[_0x2224('0x34')]=_[_0x2224('0x36')](db[_0x2224('0x30')][_0x2224('0x4a')]);_0x412046[_0x2224('0x35')]=_[_0x2224('0x36')](_0x10194d[_0x2224('0x35')]);_0x412046[_0x2224('0x40')]=_[_0x2224('0x37')](_0x412046['model'],_0x412046['query']);_0x5064bf[_0x2224('0x38')]=_[_0x2224('0x37')](_0x412046[_0x2224('0x34')],qs[_0x2224('0x39')](_0x10194d[_0x2224('0x35')][_0x2224('0x39')]));_0x5064bf['attributes']=_0x5064bf[_0x2224('0x38')][_0x2224('0x3a')]?_0x5064bf[_0x2224('0x38')]:_0x412046[_0x2224('0x34')];if(_0x10194d['query'][_0x2224('0x4b')]){_0x5064bf[_0x2224('0x45')]=[{'all':!![]}];}_0x5064bf=_[_0x2224('0x42')]({},_0x5064bf,_0x10194d[_0x2224('0x44')]);return db['WhatsappQueue'][_0x2224('0x4c')](_0x5064bf)['then'](handleEntityNotFound(_0x1f93c1,null))[_0x2224('0x28')](respondWithResult(_0x1f93c1,null))[_0x2224('0x4d')](handleError(_0x1f93c1,null));};exports[_0x2224('0x4e')]=function(_0x2f3366,_0x29c764){return db[_0x2224('0x30')][_0x2224('0x4e')](_0x2f3366[_0x2224('0x4f')],{})[_0x2224('0x28')](function(_0x46e1d5){var _0x187bf8=_0x2f3366[_0x2224('0x50')][_0x2224('0x29')]({'plain':!![]});if(!_0x187bf8)throw new Error(_0x2224('0x51'));if(_0x187bf8['role']===_0x2224('0x50')){var _0x1c68c0=_0x46e1d5[_0x2224('0x29')]({'plain':!![]});var _0x30b47a=_0x2224('0x52');return db[_0x2224('0x53')][_0x2224('0x4c')]({'where':{'name':_0x30b47a,'userProfileId':_0x187bf8[_0x2224('0x54')]},'raw':!![]})[_0x2224('0x28')](function(_0x58854f){if(_0x58854f&&_0x58854f['autoAssociation']===0x0){return db[_0x2224('0x55')][_0x2224('0x4e')]({'name':_0x1c68c0[_0x2224('0x2c')],'resourceId':_0x1c68c0['id'],'type':_0x58854f[_0x2224('0x2c')],'sectionId':_0x58854f['id']},{})[_0x2224('0x28')](function(){return _0x46e1d5;});}else{return _0x46e1d5;}})[_0x2224('0x4d')](function(_0x3e2da8){logger[_0x2224('0x2a')](_0x2224('0x56'),_0x3e2da8);throw _0x3e2da8;});}return _0x46e1d5;})[_0x2224('0x28')](respondWithResult(_0x29c764,0xc9))[_0x2224('0x4d')](handleError(_0x29c764,null));};exports[_0x2224('0x27')]=function(_0x16b7dd,_0x2827de){if(_0x16b7dd[_0x2224('0x4f')]['id']){delete _0x16b7dd[_0x2224('0x4f')]['id'];}return db[_0x2224('0x30')][_0x2224('0x4c')]({'where':{'id':_0x16b7dd[_0x2224('0x49')]['id']}})['then'](handleEntityNotFound(_0x2827de,null))[_0x2224('0x28')](saveUpdates(_0x16b7dd[_0x2224('0x4f')],null))[_0x2224('0x28')](respondWithResult(_0x2827de,null))[_0x2224('0x4d')](handleError(_0x2827de,null));};exports[_0x2224('0x57')]=function(_0x4425ba,_0x803e77){return db[_0x2224('0x30')][_0x2224('0x4c')]({'where':{'id':_0x4425ba['params']['id']}})[_0x2224('0x28')](handleEntityNotFound(_0x803e77,null))[_0x2224('0x28')](removeEntity(_0x803e77,null))[_0x2224('0x4d')](handleError(_0x803e77,null));};exports['describe']=function(_0x17b062,_0x329f4b){return db[_0x2224('0x30')]['describe']()['then'](respondWithResult(_0x329f4b,null))[_0x2224('0x4d')](handleError(_0x329f4b,null));};exports[_0x2224('0x58')]=function(_0x160392,_0x35c754,_0x47895b){var _0x9a072b={'raw':!![],'where':{}},_0x256f87={},_0x189426;return db['WhatsappQueue']['findOne']({'where':{'id':_0x160392['params']['id']}})['then'](handleEntityNotFound(_0x35c754,null))[_0x2224('0x28')](function(_0x4ce84a){if(_0x4ce84a){_0x189426=_0x4ce84a[_0x2224('0x29')]({'plain':!![]});_0x256f87[_0x2224('0x34')]=_[_0x2224('0x36')](db['UserWhatsappQueue'][_0x2224('0x4a')]);_0x256f87[_0x2224('0x35')]=_[_0x2224('0x36')](_0x160392[_0x2224('0x35')]);_0x256f87[_0x2224('0x40')]=_['intersection'](_0x256f87['model'],_0x256f87[_0x2224('0x35')]);_0x9a072b[_0x2224('0x38')]=_[_0x2224('0x37')](_0x256f87[_0x2224('0x34')],qs[_0x2224('0x39')](_0x160392['query'][_0x2224('0x39')]));_0x9a072b[_0x2224('0x38')]=_0x9a072b[_0x2224('0x38')]['length']?_0x9a072b[_0x2224('0x38')]:_0x256f87[_0x2224('0x34')];if(!_0x160392[_0x2224('0x35')][_0x2224('0x3b')]('nolimit')){_0x9a072b['limit']=qs[_0x2224('0x22')](_0x160392[_0x2224('0x35')]['limit']);_0x9a072b[_0x2224('0x21')]=qs[_0x2224('0x21')](_0x160392['query'][_0x2224('0x21')]);}_0x9a072b[_0x2224('0x3d')]=qs[_0x2224('0x3e')](_0x160392['query'][_0x2224('0x3e')]);_0x9a072b[_0x2224('0x3f')]=qs[_0x2224('0x40')](_['pick'](_0x160392['query'],_0x256f87[_0x2224('0x40')]));_0x9a072b[_0x2224('0x3f')][_0x2224('0x59')]=_0x4ce84a['id'];if(_0x160392['query']['filter']){_0x9a072b[_0x2224('0x3f')]=_[_0x2224('0x42')](_0x9a072b['where'],{'$or':_[_0x2224('0x2f')](_0x9a072b[_0x2224('0x38')],function(_0x257c27){var _0x2c602a={};_0x2c602a[_0x257c27]={'$like':'%'+_0x160392[_0x2224('0x35')][_0x2224('0x41')]+'%'};return _0x2c602a;})});}_0x9a072b=_[_0x2224('0x42')]({},_0x9a072b,_0x160392[_0x2224('0x44')]);return db[_0x2224('0x5a')][_0x2224('0x46')](_0x9a072b);}})[_0x2224('0x28')](function(_0xe4fe73){if(_0xe4fe73){return db[_0x2224('0x5b')][_0x2224('0x5c')]({'where':{'id':_[_0x2224('0x2f')](_0xe4fe73,_0x2224('0x5d')),'role':_0x2224('0x5e')},'attributes':['id','name',_0x2224('0x5f'),_0x2224('0x60'),_0x2224('0x61')]});}})['then'](function(_0x31e147){if(_0x31e147){return{'count':_0x31e147[_0x2224('0x20')],'rows':_[_0x2224('0x2f')](_0x31e147['rows'],function(_0x5231f4){return{'membername':_0x5231f4[_0x2224('0x2c')],'UserId':_0x5231f4['id'],'queue_name':_0x189426['name'],'WhatsappQueueId':_0x189426['id'],'interface':util[_0x2224('0x62')](_0x2224('0x63'),_0x2224('0x64'),_0x5231f4[_0x2224('0x2c')]),'penalty':0x0,'paused':_0x5231f4['whatsappPause'],'createdAt':_0x5231f4[_0x2224('0x61')],'updatedAt':_0x5231f4[_0x2224('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2224('0x28')](respondWithFilteredResult(_0x35c754,_0x9a072b))[_0x2224('0x4d')](handleError(_0x35c754,null));};exports['getTeams']=function(_0x51809b,_0x5a2543,_0x5e1cb7){var _0x536b78={};var _0x21415d={};var _0x5cec34;var _0x5de9bb;return db[_0x2224('0x30')]['findOne']({'where':{'id':_0x51809b[_0x2224('0x49')]['id']}})[_0x2224('0x28')](handleEntityNotFound(_0x5a2543,null))[_0x2224('0x28')](function(_0x5b60a0){if(_0x5b60a0){_0x5cec34=_0x5b60a0;_0x21415d['model']=_[_0x2224('0x36')](db[_0x2224('0x65')][_0x2224('0x4a')]);_0x21415d[_0x2224('0x35')]=_[_0x2224('0x36')](_0x51809b[_0x2224('0x35')]);_0x21415d['filters']=_['intersection'](_0x21415d[_0x2224('0x34')],_0x21415d[_0x2224('0x35')]);_0x536b78[_0x2224('0x38')]=_['intersection'](_0x21415d['model'],qs[_0x2224('0x39')](_0x51809b[_0x2224('0x35')][_0x2224('0x39')]));_0x536b78[_0x2224('0x38')]=_0x536b78['attributes']['length']?_0x536b78[_0x2224('0x38')]:_0x21415d[_0x2224('0x34')];_0x536b78[_0x2224('0x3d')]=qs[_0x2224('0x3e')](_0x51809b[_0x2224('0x35')][_0x2224('0x3e')]);_0x536b78[_0x2224('0x3f')]=qs[_0x2224('0x40')](_['pick'](_0x51809b['query'],_0x21415d[_0x2224('0x40')]));if(_0x51809b[_0x2224('0x35')][_0x2224('0x41')]){_0x536b78[_0x2224('0x3f')]=_[_0x2224('0x42')](_0x536b78[_0x2224('0x3f')],{'$or':_[_0x2224('0x2f')](_0x536b78[_0x2224('0x38')],function(_0x1c5b42){var _0x5ad440={};_0x5ad440[_0x1c5b42]={'$like':'%'+_0x51809b['query'][_0x2224('0x41')]+'%'};return _0x5ad440;})});}_0x536b78=_[_0x2224('0x42')]({},_0x536b78,_0x51809b[_0x2224('0x44')]);return _0x5cec34[_0x2224('0x66')](_0x536b78);}})[_0x2224('0x28')](function(_0x2e7e9d){if(_0x2e7e9d){_0x5de9bb=_0x2e7e9d[_0x2224('0x3a')];if(!_0x51809b['query'][_0x2224('0x3b')](_0x2224('0x3c'))){_0x536b78[_0x2224('0x22')]=qs['limit'](_0x51809b['query'][_0x2224('0x22')]);_0x536b78['offset']=qs[_0x2224('0x21')](_0x51809b[_0x2224('0x35')]['offset']);}return _0x5cec34[_0x2224('0x66')](_0x536b78);}})[_0x2224('0x28')](function(_0x5f337f){if(_0x5f337f){return _0x5f337f?{'count':_0x5de9bb,'rows':_0x5f337f}:null;}})[_0x2224('0x28')](respondWithResult(_0x5a2543,null))[_0x2224('0x4d')](handleError(_0x5a2543,null));};exports[_0x2224('0x67')]=function(_0x3cafdc,_0x2e0d6e,_0x35be23){var _0x14d734=_0x3cafdc[_0x2224('0x4f')][_0x2224('0x68')];return db['Team']['findAll']({'where':{'id':_0x14d734},'attributes':['id'],'include':[{'model':db[_0x2224('0x5b')],'as':_0x2224('0x69'),'attributes':['id','name',_0x2224('0x6a'),_0x2224('0x6b'),_0x2224('0x6c')],'raw':!![]}]})[_0x2224('0x28')](function(_0x3f8253){if(_0x3f8253){var _0x418841=_[_0x2224('0x6d')](_0x3f8253,function(_0x1675a2){var _0x4886de=_0x1675a2[_0x2224('0x29')]({'plain':!![]});return _0x4886de[_0x2224('0x69')];});return db['WhatsappQueue'][_0x2224('0x4c')]({'where':{'id':_0x3cafdc['params']['id']}})[_0x2224('0x28')](function(_0x2ec2b3){return db['sequelize'][_0x2224('0x6e')](function(_0x561671){return _0x2ec2b3[_0x2224('0x67')](_0x14d734,{'transaction':_0x561671})[_0x2224('0x28')](function(){return BPromise[_0x2224('0x6f')](_0x418841,function(_0x32d74d){return db['UserWhatsappQueue'][_0x2224('0x70')]({'where':{'UserId':_0x32d74d['id'],'WhatsappQueueId':_0x3cafdc['params']['id']},'transaction':_0x561671});});})[_0x2224('0x28')](function(){_0x418841['forEach'](function(_0x192192){socket[_0x2224('0x71')](_0x2224('0x72'),{'UserId':_0x192192['id'],'WhatsappQueueId':_0x2ec2b3['id']});});});});});}})[_0x2224('0x28')](respondWithStatusCode(_0x2e0d6e,null))[_0x2224('0x4d')](handleError(_0x2e0d6e,null));};exports[_0x2224('0x73')]=function(_0x36591f,_0x9220d6,_0x196769){return db[_0x2224('0x65')][_0x2224('0x46')]({'where':{'id':_0x36591f[_0x2224('0x35')][_0x2224('0x68')]},'attributes':['id'],'include':[{'model':db[_0x2224('0x5b')],'as':_0x2224('0x69'),'attributes':['id'],'raw':!![]}]})[_0x2224('0x28')](handleEntityNotFound(_0x9220d6,null))[_0x2224('0x28')](function(_0x94af93){var _0x37ad57=_['map'](_0x94af93,'id');var _0x53462a=[];var _0x3fa3be=[];var _0x2d0ff5=squel['select']();_0x2d0ff5[_0x2224('0x74')](_0x2224('0x75'))['from']('team_has_whatsapp_queues','tq')[_0x2224('0x76')](_0x2224('0x77'),'ut',_0x2224('0x78'))[_0x2224('0x3f')](_0x2224('0x79'),_0x36591f[_0x2224('0x49')]['id']);for(var _0x2ceb94=0x0;_0x2ceb94<_0x94af93[_0x2224('0x3a')];_0x2ceb94+=0x1){let _0x17f9ce=_0x94af93[_0x2ceb94];for(var _0xa6c469=0x0;_0xa6c469<_0x17f9ce[_0x2224('0x69')][_0x2224('0x3a')];_0xa6c469+=0x1){let _0x387754=_0x17f9ce[_0x2224('0x69')][_0xa6c469];var _0x3c4a7e=_0x2d0ff5[_0x2224('0x7a')]();_0x3c4a7e['where']('ut.UserId\x20=\x20?',_0x387754['id']);_0x3fa3be[_0x2224('0x7b')](db['sequelize'][_0x2224('0x35')](_0x3c4a7e['toString'](),{'type':db[_0x2224('0x7c')][_0x2224('0x7d')][_0x2224('0x7e')]})[_0x2224('0x28')](function(_0x343493){if(_0x343493['length']===0x1){return _0x387754['id'];}else{var _0x44cddc=_[_0x2224('0x7f')](_[_0x2224('0x2f')](_0x343493,_0x2224('0x80')),function(_0x2d77b5){return _['includes'](_0x37ad57,_0x2d77b5);});if(_0x44cddc){return _0x387754['id'];}}}));}}return BPromise[_0x2224('0x81')](_0x3fa3be)[_0x2224('0x28')](function(_0x34c2ac){_0x53462a=_(_0x53462a)[_0x2224('0x82')](_0x34c2ac)[_0x2224('0x83')]()[_0x2224('0x84')]();return db[_0x2224('0x30')]['find']({'where':{'id':_0x36591f[_0x2224('0x49')]['id']}})['then'](function(_0x20620f){return db[_0x2224('0x7c')][_0x2224('0x6e')](function(_0x2111af){return _0x20620f[_0x2224('0x73')](_0x36591f[_0x2224('0x35')][_0x2224('0x68')],{'transaction':_0x2111af})['then'](function(){if(!_[_0x2224('0x85')](_0x53462a)){return _0x20620f[_0x2224('0x86')](_0x53462a,{'transaction':_0x2111af});}})['then'](function(){_0x53462a[_0x2224('0x87')](function(_0x372e3c){socket[_0x2224('0x71')](_0x2224('0x88'),{'UserId':_0x372e3c,'WhatsappQueueId':_0x20620f['id']});});});});});});})[_0x2224('0x28')](respondWithStatusCode(_0x9220d6,null))[_0x2224('0x4d')](handleError(_0x9220d6,null));};exports[_0x2224('0x89')]=function(_0x5c6663,_0x510bda,_0x3f1d27){return db[_0x2224('0x30')][_0x2224('0x4c')]({'where':{'id':_0x5c6663['params']['id']}})[_0x2224('0x28')](handleEntityNotFound(_0x510bda,null))[_0x2224('0x28')](function(_0x4db073){if(_0x4db073){return _0x4db073[_0x2224('0x89')](_0x5c6663[_0x2224('0x4f')][_0x2224('0x68')],_['omit'](_0x5c6663['body'],[_0x2224('0x68'),'id'])||{})[_0x2224('0x8a')](function(_0x341e2d){for(var _0x405822=0x0;_0x405822<_0x5c6663[_0x2224('0x4f')][_0x2224('0x68')]['length'];_0x405822+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':_0x5c6663[_0x2224('0x4f')]['ids'][_0x405822],'WhatsappQueueId':_0x5c6663[_0x2224('0x49')]['id']});}return _0x341e2d;});}})[_0x2224('0x28')](respondWithResult(_0x510bda,null))[_0x2224('0x4d')](handleError(_0x510bda,null));};exports[_0x2224('0x86')]=function(_0x1b568b,_0x3ce7c4,_0x40d12c){return db['WhatsappQueue'][_0x2224('0x4c')]({'where':{'id':_0x1b568b[_0x2224('0x49')]['id']}})[_0x2224('0x28')](handleEntityNotFound(_0x3ce7c4,null))['then'](function(_0x552d2e){if(_0x552d2e){return _0x552d2e['removeAgents'](_0x1b568b['query']['ids'])[_0x2224('0x28')](function(){if(_[_0x2224('0x8b')](_0x1b568b['query'][_0x2224('0x68')])){for(var _0x48f05c=0x0;_0x48f05c<_0x1b568b[_0x2224('0x35')][_0x2224('0x68')][_0x2224('0x3a')];_0x48f05c+=0x1){socket[_0x2224('0x71')](_0x2224('0x88'),{'UserId':Number(_0x1b568b['query'][_0x2224('0x68')][_0x48f05c]),'WhatsappQueueId':Number(_0x1b568b[_0x2224('0x49')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x1b568b[_0x2224('0x35')][_0x2224('0x68')]),'WhatsappQueueId':Number(_0x1b568b[_0x2224('0x49')]['id'])});}});}})[_0x2224('0x28')](respondWithStatusCode(_0x3ce7c4,null))['catch'](handleError(_0x3ce7c4,null));};exports[_0x2224('0x8c')]=function(_0x57d3df,_0xaa11ca,_0x752951){var _0x25d10b={};var _0x2d32b5={};var _0x1d36d7;var _0x4bcdcf;return db[_0x2224('0x30')]['findOne']({'where':{'id':_0x57d3df[_0x2224('0x49')]['id']}})[_0x2224('0x28')](handleEntityNotFound(_0xaa11ca,null))[_0x2224('0x28')](function(_0x50432d){if(_0x50432d){_0x1d36d7=_0x50432d;_0x2d32b5[_0x2224('0x34')]=_[_0x2224('0x36')](db[_0x2224('0x5b')][_0x2224('0x4a')]);_0x2d32b5[_0x2224('0x35')]=_[_0x2224('0x36')](_0x57d3df[_0x2224('0x35')]);_0x2d32b5[_0x2224('0x40')]=_['intersection'](_0x2d32b5['model'],_0x2d32b5[_0x2224('0x35')]);_0x25d10b[_0x2224('0x38')]=_['intersection'](_0x2d32b5[_0x2224('0x34')],qs[_0x2224('0x39')](_0x57d3df[_0x2224('0x35')]['fields']));_0x25d10b[_0x2224('0x38')]=_0x25d10b['attributes'][_0x2224('0x3a')]?_0x25d10b[_0x2224('0x38')]:_0x2d32b5['model'];_0x25d10b[_0x2224('0x3d')]=qs['sort'](_0x57d3df['query']['sort']);_0x25d10b[_0x2224('0x3f')]=qs[_0x2224('0x40')](_['pick'](_0x57d3df[_0x2224('0x35')],_0x2d32b5[_0x2224('0x40')]));if(_0x57d3df[_0x2224('0x35')][_0x2224('0x41')]){_0x25d10b[_0x2224('0x3f')]=_['merge'](_0x25d10b[_0x2224('0x3f')],{'$or':_['map'](_0x25d10b[_0x2224('0x38')],function(_0xf146e2){var _0x2c7430={};_0x2c7430[_0xf146e2]={'$like':'%'+_0x57d3df[_0x2224('0x35')][_0x2224('0x41')]+'%'};return _0x2c7430;})});}_0x25d10b=_[_0x2224('0x42')]({},_0x25d10b,_0x57d3df[_0x2224('0x44')]);return _0x1d36d7[_0x2224('0x8c')](_0x25d10b);}})[_0x2224('0x28')](function(_0x2d7d01){if(_0x2d7d01){_0x4bcdcf=_0x2d7d01[_0x2224('0x3a')];if(!_0x57d3df['query']['hasOwnProperty'](_0x2224('0x3c'))){_0x25d10b[_0x2224('0x22')]=qs[_0x2224('0x22')](_0x57d3df['query']['limit']);_0x25d10b['offset']=qs[_0x2224('0x21')](_0x57d3df['query'][_0x2224('0x21')]);}return _0x1d36d7['getAgents'](_0x25d10b);}})['then'](function(_0x4ca4b3){if(_0x4ca4b3){return _0x4ca4b3?{'count':_0x4bcdcf,'rows':_0x4ca4b3}:null;}})[_0x2224('0x28')](respondWithResult(_0xaa11ca,null))['catch'](handleError(_0xaa11ca,null));}; \ No newline at end of file +var _0x8fd7=['count','offset','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','error','send','index','map','WhatsappQueue','type','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','rows','show','params','merge','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','pick','findAll','User','UserId','agent','whatsappPause','createdAt','%s/%s','updatedAt','addTeams','Team','online','interface','flatMap','sequelize','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','ids','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x8fd7,0xec));var _0x78fd=function(_0xfcca6,_0x5cf278){_0xfcca6=_0xfcca6-0x0;var _0x217b37=_0x8fd7[_0xfcca6];return _0x217b37;};'use strict';var pdf=require(_0x78fd('0x0'));var emlformat=require(_0x78fd('0x1'));var rimraf=require(_0x78fd('0x2'));var zipdir=require(_0x78fd('0x3'));var jsonpatch=require(_0x78fd('0x4'));var rp=require(_0x78fd('0x5'));var moment=require(_0x78fd('0x6'));var BPromise=require(_0x78fd('0x7'));var Mustache=require('mustache');var util=require(_0x78fd('0x8'));var path=require(_0x78fd('0x9'));var sox=require(_0x78fd('0xa'));var csv=require(_0x78fd('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x78fd('0xc'));var squel=require(_0x78fd('0xd'));var crypto=require('crypto');var jsforce=require(_0x78fd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x78fd('0xb'));var querystring=require(_0x78fd('0xf'));var Papa=require(_0x78fd('0x10'));var Redis=require(_0x78fd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x78fd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x78fd('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x78fd('0x14'))['db'];config[_0x78fd('0x15')]=_[_0x78fd('0x16')](config[_0x78fd('0x15')],{'host':_0x78fd('0x17'),'port':0x18eb});var socket=require(_0x78fd('0x18'))(new Redis(config[_0x78fd('0x15')]));require(_0x78fd('0x19'))[_0x78fd('0x1a')](socket);function respondWithStatusCode(_0x20d833,_0x590217){_0x590217=_0x590217||0xcc;return function(_0x55b222){if(_0x55b222){return _0x20d833[_0x78fd('0x1b')](_0x590217);}return _0x20d833['status'](_0x590217)[_0x78fd('0x1c')]();};}function respondWithResult(_0x17629c,_0x3be05e){_0x3be05e=_0x3be05e||0xc8;return function(_0x7bc406){if(_0x7bc406){return _0x17629c[_0x78fd('0x1d')](_0x3be05e)['json'](_0x7bc406);}};}function respondWithFilteredResult(_0xf0ca40,_0x4bbc7d){return function(_0x402789){if(_0x402789){var _0x30bcc4=_0x402789[_0x78fd('0x1e')],_0x8c2318=_0x4bbc7d[_0x78fd('0x1f')],_0x598e7d=_0x4bbc7d[_0x78fd('0x1f')]+_0x4bbc7d[_0x78fd('0x20')],_0xeff6f7;if(_0x598e7d>=_0x30bcc4){_0x598e7d=_0x30bcc4;_0xeff6f7=0xc8;}else{_0xeff6f7=0xce;}_0xf0ca40['status'](_0xeff6f7);return _0xf0ca40[_0x78fd('0x21')](_0x78fd('0x22'),_0x8c2318+'-'+_0x598e7d+'/'+_0x30bcc4)['json'](_0x402789);}return null;};}function patchUpdates(_0x50c726){return function(_0x16f6fa){try{jsonpatch[_0x78fd('0x23')](_0x16f6fa,_0x50c726,!![]);}catch(_0x2e46a9){return BPromise['reject'](_0x2e46a9);}return _0x16f6fa[_0x78fd('0x24')]();};}function saveUpdates(_0x44b834,_0x5cb24c){return function(_0x274c89){if(_0x274c89){return _0x274c89[_0x78fd('0x25')](_0x44b834)['then'](function(_0x29e1df){return _0x29e1df;});}return null;};}function removeEntity(_0x1a3492,_0x38e6e7){return function(_0x513256){if(_0x513256){return _0x513256['destroy']()[_0x78fd('0x26')](function(){var _0x88aced=_0x513256[_0x78fd('0x27')]({'plain':!![]});var _0x45c217='WhatsappQueues';return db[_0x78fd('0x28')]['destroy']({'where':{'type':_0x45c217,'resourceId':_0x88aced['id']}})[_0x78fd('0x26')](function(){return _0x513256;});})[_0x78fd('0x26')](function(){_0x1a3492[_0x78fd('0x1d')](0xcc)[_0x78fd('0x1c')]();});}};}function handleEntityNotFound(_0xeba1ac,_0x363fc0){return function(_0x19f80b){if(!_0x19f80b){_0xeba1ac['sendStatus'](0x194);}return _0x19f80b;};}function handleError(_0x286193,_0x38afc1){_0x38afc1=_0x38afc1||0x1f4;return function(_0x3d0139){logger[_0x78fd('0x29')](_0x3d0139['stack']);if(_0x3d0139['name']){delete _0x3d0139['name'];}_0x286193['status'](_0x38afc1)[_0x78fd('0x2a')](_0x3d0139);};}exports[_0x78fd('0x2b')]=function(_0x53e812,_0x36fa40){var _0x4482ab={},_0x5708c1={},_0x214b88={'count':0x0,'rows':[]};var _0x38d7ab=_[_0x78fd('0x2c')](db[_0x78fd('0x2d')]['rawAttributes'],function(_0x1d7f72){return{'name':_0x1d7f72['fieldName'],'type':_0x1d7f72[_0x78fd('0x2e')]['key']};});_0x5708c1[_0x78fd('0x2f')]=_['map'](_0x38d7ab,_0x78fd('0x30'));_0x5708c1[_0x78fd('0x31')]=_[_0x78fd('0x32')](_0x53e812['query']);_0x5708c1['filters']=_['intersection'](_0x5708c1['model'],_0x5708c1[_0x78fd('0x31')]);_0x4482ab[_0x78fd('0x33')]=_[_0x78fd('0x34')](_0x5708c1[_0x78fd('0x2f')],qs[_0x78fd('0x35')](_0x53e812[_0x78fd('0x31')][_0x78fd('0x35')]));_0x4482ab[_0x78fd('0x33')]=_0x4482ab['attributes'][_0x78fd('0x36')]?_0x4482ab['attributes']:_0x5708c1['model'];if(!_0x53e812['query'][_0x78fd('0x37')](_0x78fd('0x38'))){_0x4482ab[_0x78fd('0x20')]=qs[_0x78fd('0x20')](_0x53e812[_0x78fd('0x31')][_0x78fd('0x20')]);_0x4482ab[_0x78fd('0x1f')]=qs[_0x78fd('0x1f')](_0x53e812['query']['offset']);}_0x4482ab[_0x78fd('0x39')]=qs[_0x78fd('0x3a')](_0x53e812[_0x78fd('0x31')][_0x78fd('0x3a')]);_0x4482ab[_0x78fd('0x3b')]=qs[_0x78fd('0x3c')](_['pick'](_0x53e812[_0x78fd('0x31')],_0x5708c1['filters']),_0x38d7ab);if(_0x53e812[_0x78fd('0x31')][_0x78fd('0x3d')]){_0x4482ab['where']=_['merge'](_0x4482ab[_0x78fd('0x3b')],{'$or':_[_0x78fd('0x2c')](_0x38d7ab,function(_0x3f47e4){if(_0x3f47e4['type']!==_0x78fd('0x3e')){var _0x476c16={};_0x476c16[_0x3f47e4[_0x78fd('0x30')]]={'$like':'%'+_0x53e812[_0x78fd('0x31')][_0x78fd('0x3d')]+'%'};return _0x476c16;}})});}_0x4482ab=_['merge']({},_0x4482ab,_0x53e812[_0x78fd('0x3f')]);var _0x23ebe7={'where':_0x4482ab[_0x78fd('0x3b')]};return db[_0x78fd('0x2d')]['count'](_0x23ebe7)[_0x78fd('0x26')](function(_0x4460d4){_0x214b88[_0x78fd('0x1e')]=_0x4460d4;if(_0x53e812[_0x78fd('0x31')][_0x78fd('0x40')]){_0x4482ab[_0x78fd('0x41')]=[{'all':!![]}];}return db[_0x78fd('0x2d')]['findAll'](_0x4482ab);})[_0x78fd('0x26')](function(_0x43a21d){_0x214b88[_0x78fd('0x42')]=_0x43a21d;return _0x214b88;})['then'](respondWithFilteredResult(_0x36fa40,_0x4482ab))['catch'](handleError(_0x36fa40,null));};exports[_0x78fd('0x43')]=function(_0x56e24d,_0x2d6a78){var _0x1ad9fd={'raw':!![],'where':{'id':_0x56e24d[_0x78fd('0x44')]['id']}},_0x3ee6ad={};_0x3ee6ad['model']=_[_0x78fd('0x32')](db[_0x78fd('0x2d')]['rawAttributes']);_0x3ee6ad[_0x78fd('0x31')]=_[_0x78fd('0x32')](_0x56e24d[_0x78fd('0x31')]);_0x3ee6ad['filters']=_['intersection'](_0x3ee6ad[_0x78fd('0x2f')],_0x3ee6ad[_0x78fd('0x31')]);_0x1ad9fd[_0x78fd('0x33')]=_[_0x78fd('0x34')](_0x3ee6ad[_0x78fd('0x2f')],qs['fields'](_0x56e24d[_0x78fd('0x31')][_0x78fd('0x35')]));_0x1ad9fd[_0x78fd('0x33')]=_0x1ad9fd[_0x78fd('0x33')]['length']?_0x1ad9fd['attributes']:_0x3ee6ad[_0x78fd('0x2f')];if(_0x56e24d[_0x78fd('0x31')]['includeAll']){_0x1ad9fd[_0x78fd('0x41')]=[{'all':!![]}];}_0x1ad9fd=_[_0x78fd('0x45')]({},_0x1ad9fd,_0x56e24d[_0x78fd('0x3f')]);return db[_0x78fd('0x2d')]['find'](_0x1ad9fd)[_0x78fd('0x26')](handleEntityNotFound(_0x2d6a78,null))[_0x78fd('0x26')](respondWithResult(_0x2d6a78,null))[_0x78fd('0x46')](handleError(_0x2d6a78,null));};exports['create']=function(_0x51754b,_0x33eca1){return db[_0x78fd('0x2d')][_0x78fd('0x47')](_0x51754b[_0x78fd('0x48')],{})[_0x78fd('0x26')](function(_0x429641){var _0x289afd=_0x51754b[_0x78fd('0x49')][_0x78fd('0x27')]({'plain':!![]});if(!_0x289afd)throw new Error(_0x78fd('0x4a'));if(_0x289afd[_0x78fd('0x4b')]===_0x78fd('0x49')){var _0x24850e=_0x429641[_0x78fd('0x27')]({'plain':!![]});var _0x24a15e='WhatsappQueues';return db[_0x78fd('0x4c')][_0x78fd('0x4d')]({'where':{'name':_0x24a15e,'userProfileId':_0x289afd['userProfileId']},'raw':!![]})[_0x78fd('0x26')](function(_0x11a8c0){if(_0x11a8c0&&_0x11a8c0[_0x78fd('0x4e')]===0x0){return db['UserProfileResource'][_0x78fd('0x47')]({'name':_0x24850e[_0x78fd('0x30')],'resourceId':_0x24850e['id'],'type':_0x11a8c0[_0x78fd('0x30')],'sectionId':_0x11a8c0['id']},{})[_0x78fd('0x26')](function(){return _0x429641;});}else{return _0x429641;}})[_0x78fd('0x46')](function(_0x2ed41a){logger[_0x78fd('0x29')](_0x78fd('0x4f'),_0x2ed41a);throw _0x2ed41a;});}return _0x429641;})['then'](respondWithResult(_0x33eca1,0xc9))[_0x78fd('0x46')](handleError(_0x33eca1,null));};exports['update']=function(_0x18207d,_0x425708){if(_0x18207d['body']['id']){delete _0x18207d[_0x78fd('0x48')]['id'];}return db[_0x78fd('0x2d')][_0x78fd('0x4d')]({'where':{'id':_0x18207d[_0x78fd('0x44')]['id']}})[_0x78fd('0x26')](handleEntityNotFound(_0x425708,null))[_0x78fd('0x26')](saveUpdates(_0x18207d['body'],null))['then'](respondWithResult(_0x425708,null))[_0x78fd('0x46')](handleError(_0x425708,null));};exports[_0x78fd('0x50')]=function(_0x1530d0,_0xf50c8c){return db['WhatsappQueue'][_0x78fd('0x4d')]({'where':{'id':_0x1530d0[_0x78fd('0x44')]['id']}})[_0x78fd('0x26')](handleEntityNotFound(_0xf50c8c,null))[_0x78fd('0x26')](removeEntity(_0xf50c8c,null))[_0x78fd('0x46')](handleError(_0xf50c8c,null));};exports[_0x78fd('0x51')]=function(_0x1f50e0,_0x22b0dc){return db[_0x78fd('0x2d')][_0x78fd('0x51')]()['then'](respondWithResult(_0x22b0dc,null))[_0x78fd('0x46')](handleError(_0x22b0dc,null));};exports[_0x78fd('0x52')]=function(_0x561b05,_0x3387f5,_0x375e72){var _0x440c6c={'raw':!![],'where':{}},_0x11fd3b={},_0x1485da;return db[_0x78fd('0x2d')][_0x78fd('0x53')]({'where':{'id':_0x561b05[_0x78fd('0x44')]['id']}})[_0x78fd('0x26')](handleEntityNotFound(_0x3387f5,null))[_0x78fd('0x26')](function(_0x26922f){if(_0x26922f){_0x1485da=_0x26922f[_0x78fd('0x27')]({'plain':!![]});_0x11fd3b['model']=_[_0x78fd('0x32')](db[_0x78fd('0x54')][_0x78fd('0x55')]);_0x11fd3b[_0x78fd('0x31')]=_['keys'](_0x561b05[_0x78fd('0x31')]);_0x11fd3b['filters']=_[_0x78fd('0x34')](_0x11fd3b['model'],_0x11fd3b['query']);_0x440c6c[_0x78fd('0x33')]=_[_0x78fd('0x34')](_0x11fd3b['model'],qs[_0x78fd('0x35')](_0x561b05[_0x78fd('0x31')][_0x78fd('0x35')]));_0x440c6c[_0x78fd('0x33')]=_0x440c6c[_0x78fd('0x33')][_0x78fd('0x36')]?_0x440c6c[_0x78fd('0x33')]:_0x11fd3b[_0x78fd('0x2f')];if(!_0x561b05[_0x78fd('0x31')]['hasOwnProperty'](_0x78fd('0x38'))){_0x440c6c[_0x78fd('0x20')]=qs[_0x78fd('0x20')](_0x561b05['query']['limit']);_0x440c6c[_0x78fd('0x1f')]=qs[_0x78fd('0x1f')](_0x561b05['query'][_0x78fd('0x1f')]);}_0x440c6c[_0x78fd('0x39')]=qs[_0x78fd('0x3a')](_0x561b05[_0x78fd('0x31')][_0x78fd('0x3a')]);_0x440c6c[_0x78fd('0x3b')]=qs[_0x78fd('0x3c')](_[_0x78fd('0x56')](_0x561b05['query'],_0x11fd3b[_0x78fd('0x3c')]));_0x440c6c[_0x78fd('0x3b')]['WhatsappQueueId']=_0x26922f['id'];if(_0x561b05['query']['filter']){_0x440c6c[_0x78fd('0x3b')]=_[_0x78fd('0x45')](_0x440c6c[_0x78fd('0x3b')],{'$or':_[_0x78fd('0x2c')](_0x440c6c['attributes'],function(_0x5e950c){var _0x1f989e={};_0x1f989e[_0x5e950c]={'$like':'%'+_0x561b05[_0x78fd('0x31')]['filter']+'%'};return _0x1f989e;})});}_0x440c6c=_[_0x78fd('0x45')]({},_0x440c6c,_0x561b05[_0x78fd('0x3f')]);return db[_0x78fd('0x54')][_0x78fd('0x57')](_0x440c6c);}})[_0x78fd('0x26')](function(_0x5120de){if(_0x5120de){return db[_0x78fd('0x58')]['findAndCountAll']({'where':{'id':_[_0x78fd('0x2c')](_0x5120de,_0x78fd('0x59')),'role':_0x78fd('0x5a')},'attributes':['id',_0x78fd('0x30'),_0x78fd('0x5b'),'updatedAt',_0x78fd('0x5c')]});}})['then'](function(_0x7f9727){if(_0x7f9727){return{'count':_0x7f9727[_0x78fd('0x1e')],'rows':_[_0x78fd('0x2c')](_0x7f9727['rows'],function(_0x526af4){return{'membername':_0x526af4[_0x78fd('0x30')],'UserId':_0x526af4['id'],'queue_name':_0x1485da[_0x78fd('0x30')],'WhatsappQueueId':_0x1485da['id'],'interface':util['format'](_0x78fd('0x5d'),'SIP',_0x526af4['name']),'penalty':0x0,'paused':_0x526af4[_0x78fd('0x5b')],'createdAt':_0x526af4[_0x78fd('0x5c')],'updatedAt':_0x526af4[_0x78fd('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x78fd('0x26')](respondWithFilteredResult(_0x3387f5,_0x440c6c))[_0x78fd('0x46')](handleError(_0x3387f5,null));};exports['getTeams']=function(_0x17d83e,_0x53c6b4,_0x4e9bc6){var _0x429efa={};var _0x2c0616={};var _0x4f7b1e;var _0x222020;return db['WhatsappQueue']['findOne']({'where':{'id':_0x17d83e[_0x78fd('0x44')]['id']}})[_0x78fd('0x26')](handleEntityNotFound(_0x53c6b4,null))[_0x78fd('0x26')](function(_0xc0e594){if(_0xc0e594){_0x4f7b1e=_0xc0e594;_0x2c0616[_0x78fd('0x2f')]=_[_0x78fd('0x32')](db['Team'][_0x78fd('0x55')]);_0x2c0616[_0x78fd('0x31')]=_['keys'](_0x17d83e[_0x78fd('0x31')]);_0x2c0616[_0x78fd('0x3c')]=_[_0x78fd('0x34')](_0x2c0616['model'],_0x2c0616[_0x78fd('0x31')]);_0x429efa[_0x78fd('0x33')]=_[_0x78fd('0x34')](_0x2c0616['model'],qs[_0x78fd('0x35')](_0x17d83e[_0x78fd('0x31')]['fields']));_0x429efa[_0x78fd('0x33')]=_0x429efa[_0x78fd('0x33')][_0x78fd('0x36')]?_0x429efa[_0x78fd('0x33')]:_0x2c0616[_0x78fd('0x2f')];_0x429efa[_0x78fd('0x39')]=qs['sort'](_0x17d83e[_0x78fd('0x31')][_0x78fd('0x3a')]);_0x429efa[_0x78fd('0x3b')]=qs['filters'](_[_0x78fd('0x56')](_0x17d83e[_0x78fd('0x31')],_0x2c0616[_0x78fd('0x3c')]));if(_0x17d83e[_0x78fd('0x31')]['filter']){_0x429efa[_0x78fd('0x3b')]=_[_0x78fd('0x45')](_0x429efa[_0x78fd('0x3b')],{'$or':_['map'](_0x429efa[_0x78fd('0x33')],function(_0x1b2c24){var _0x1e3558={};_0x1e3558[_0x1b2c24]={'$like':'%'+_0x17d83e[_0x78fd('0x31')][_0x78fd('0x3d')]+'%'};return _0x1e3558;})});}_0x429efa=_[_0x78fd('0x45')]({},_0x429efa,_0x17d83e[_0x78fd('0x3f')]);return _0x4f7b1e['getTeams'](_0x429efa);}})[_0x78fd('0x26')](function(_0x45da1b){if(_0x45da1b){_0x222020=_0x45da1b[_0x78fd('0x36')];if(!_0x17d83e[_0x78fd('0x31')][_0x78fd('0x37')]('nolimit')){_0x429efa['limit']=qs[_0x78fd('0x20')](_0x17d83e[_0x78fd('0x31')][_0x78fd('0x20')]);_0x429efa[_0x78fd('0x1f')]=qs[_0x78fd('0x1f')](_0x17d83e[_0x78fd('0x31')][_0x78fd('0x1f')]);}return _0x4f7b1e['getTeams'](_0x429efa);}})[_0x78fd('0x26')](function(_0x2a4f0a){if(_0x2a4f0a){return _0x2a4f0a?{'count':_0x222020,'rows':_0x2a4f0a}:null;}})['then'](respondWithResult(_0x53c6b4,null))[_0x78fd('0x46')](handleError(_0x53c6b4,null));};exports[_0x78fd('0x5f')]=function(_0x1799a8,_0xb1ae44,_0x5c6d60){var _0x451a4b=_0x1799a8[_0x78fd('0x48')]['ids'];return db[_0x78fd('0x60')][_0x78fd('0x57')]({'where':{'id':_0x451a4b},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x78fd('0x30'),_0x78fd('0x61'),'voicePause',_0x78fd('0x62')],'raw':!![]}]})['then'](function(_0xbfa5ea){if(_0xbfa5ea){var _0x5b9227=_[_0x78fd('0x63')](_0xbfa5ea,function(_0xf50ef9){var _0x376145=_0xf50ef9[_0x78fd('0x27')]({'plain':!![]});return _0x376145['Agents'];});return db[_0x78fd('0x2d')][_0x78fd('0x4d')]({'where':{'id':_0x1799a8[_0x78fd('0x44')]['id']}})[_0x78fd('0x26')](function(_0x382b77){return db[_0x78fd('0x64')]['transaction'](function(_0x2bec07){return _0x382b77[_0x78fd('0x5f')](_0x451a4b,{'transaction':_0x2bec07})[_0x78fd('0x26')](function(){return BPromise[_0x78fd('0x65')](_0x5b9227,function(_0xddb1f4){return db['UserWhatsappQueue'][_0x78fd('0x66')]({'where':{'UserId':_0xddb1f4['id'],'WhatsappQueueId':_0x1799a8[_0x78fd('0x44')]['id']},'transaction':_0x2bec07});});})[_0x78fd('0x26')](function(){_0x5b9227['forEach'](function(_0x3072fa){socket[_0x78fd('0x67')](_0x78fd('0x68'),{'UserId':_0x3072fa['id'],'WhatsappQueueId':_0x382b77['id']});});});});});}})[_0x78fd('0x26')](respondWithStatusCode(_0xb1ae44,null))[_0x78fd('0x46')](handleError(_0xb1ae44,null));};exports[_0x78fd('0x69')]=function(_0x5afaf7,_0xe5e560,_0x7d1d74){return db[_0x78fd('0x60')][_0x78fd('0x57')]({'where':{'id':_0x5afaf7[_0x78fd('0x31')][_0x78fd('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x78fd('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xe5e560,null))[_0x78fd('0x26')](function(_0x41fd47){var _0x25edf8=_[_0x78fd('0x2c')](_0x41fd47,'id');var _0x1bb4a6=[];var _0x41d47e=[];var _0x4e09bb=squel['select']();_0x4e09bb['field'](_0x78fd('0x6b'))[_0x78fd('0x6c')]('team_has_whatsapp_queues','tq')['join'](_0x78fd('0x6d'),'ut',_0x78fd('0x6e'))['where'](_0x78fd('0x6f'),_0x5afaf7[_0x78fd('0x44')]['id']);for(var _0x4f0808=0x0;_0x4f0808<_0x41fd47[_0x78fd('0x36')];_0x4f0808+=0x1){let _0xf04a06=_0x41fd47[_0x4f0808];for(var _0x36180a=0x0;_0x36180a<_0xf04a06[_0x78fd('0x70')][_0x78fd('0x36')];_0x36180a+=0x1){let _0x34a2a7=_0xf04a06[_0x78fd('0x70')][_0x36180a];var _0x49be91=_0x4e09bb[_0x78fd('0x71')]();_0x49be91[_0x78fd('0x3b')](_0x78fd('0x72'),_0x34a2a7['id']);_0x41d47e['push'](db['sequelize'][_0x78fd('0x31')](_0x49be91['toString'](),{'type':db[_0x78fd('0x64')][_0x78fd('0x73')][_0x78fd('0x74')]})[_0x78fd('0x26')](function(_0x2c0185){if(_0x2c0185['length']===0x1){return _0x34a2a7['id'];}else{var _0xa968a2=_[_0x78fd('0x75')](_[_0x78fd('0x2c')](_0x2c0185,_0x78fd('0x76')),function(_0x3b43dd){return _[_0x78fd('0x77')](_0x25edf8,_0x3b43dd);});if(_0xa968a2){return _0x34a2a7['id'];}}}));}}return BPromise[_0x78fd('0x78')](_0x41d47e)['then'](function(_0x262fcb){_0x1bb4a6=_(_0x1bb4a6)[_0x78fd('0x79')](_0x262fcb)['compact']()[_0x78fd('0x7a')]();return db[_0x78fd('0x2d')]['find']({'where':{'id':_0x5afaf7[_0x78fd('0x44')]['id']}})[_0x78fd('0x26')](function(_0x5e8039){return db[_0x78fd('0x64')][_0x78fd('0x7b')](function(_0x3c9038){return _0x5e8039[_0x78fd('0x69')](_0x5afaf7[_0x78fd('0x31')]['ids'],{'transaction':_0x3c9038})[_0x78fd('0x26')](function(){if(!_[_0x78fd('0x7c')](_0x1bb4a6)){return _0x5e8039[_0x78fd('0x7d')](_0x1bb4a6,{'transaction':_0x3c9038});}})[_0x78fd('0x26')](function(){_0x1bb4a6[_0x78fd('0x7e')](function(_0x39bd55){socket[_0x78fd('0x67')](_0x78fd('0x7f'),{'UserId':_0x39bd55,'WhatsappQueueId':_0x5e8039['id']});});});});});});})[_0x78fd('0x26')](respondWithStatusCode(_0xe5e560,null))[_0x78fd('0x46')](handleError(_0xe5e560,null));};exports[_0x78fd('0x80')]=function(_0x17ca8f,_0xf220db,_0x365e2d){return db[_0x78fd('0x2d')]['find']({'where':{'id':_0x17ca8f[_0x78fd('0x44')]['id']}})[_0x78fd('0x26')](handleEntityNotFound(_0xf220db,null))['then'](function(_0x68954c){if(_0x68954c){return _0x68954c[_0x78fd('0x80')](_0x17ca8f[_0x78fd('0x48')][_0x78fd('0x6a')],_[_0x78fd('0x81')](_0x17ca8f['body'],['ids','id'])||{})[_0x78fd('0x82')](function(_0xbcf838){for(var _0x1776b3=0x0;_0x1776b3<_0x17ca8f[_0x78fd('0x48')]['ids'][_0x78fd('0x36')];_0x1776b3+=0x1){socket[_0x78fd('0x67')](_0x78fd('0x68'),{'UserId':_0x17ca8f['body'][_0x78fd('0x6a')][_0x1776b3],'WhatsappQueueId':_0x17ca8f[_0x78fd('0x44')]['id']});}return _0xbcf838;});}})[_0x78fd('0x26')](respondWithResult(_0xf220db,null))[_0x78fd('0x46')](handleError(_0xf220db,null));};exports[_0x78fd('0x7d')]=function(_0x14c9b3,_0x1ea562,_0x2e6450){return db['WhatsappQueue'][_0x78fd('0x4d')]({'where':{'id':_0x14c9b3[_0x78fd('0x44')]['id']}})[_0x78fd('0x26')](handleEntityNotFound(_0x1ea562,null))[_0x78fd('0x26')](function(_0x4eb930){if(_0x4eb930){return _0x4eb930[_0x78fd('0x7d')](_0x14c9b3[_0x78fd('0x31')][_0x78fd('0x6a')])['then'](function(){if(_[_0x78fd('0x83')](_0x14c9b3[_0x78fd('0x31')][_0x78fd('0x6a')])){for(var _0x5455ae=0x0;_0x5455ae<_0x14c9b3[_0x78fd('0x31')][_0x78fd('0x6a')][_0x78fd('0x36')];_0x5455ae+=0x1){socket[_0x78fd('0x67')](_0x78fd('0x7f'),{'UserId':Number(_0x14c9b3[_0x78fd('0x31')]['ids'][_0x5455ae]),'WhatsappQueueId':Number(_0x14c9b3[_0x78fd('0x44')]['id'])});}}else{socket['emit'](_0x78fd('0x7f'),{'UserId':Number(_0x14c9b3['query'][_0x78fd('0x6a')]),'WhatsappQueueId':Number(_0x14c9b3[_0x78fd('0x44')]['id'])});}});}})[_0x78fd('0x26')](respondWithStatusCode(_0x1ea562,null))[_0x78fd('0x46')](handleError(_0x1ea562,null));};exports[_0x78fd('0x84')]=function(_0x1eb408,_0x1dcfe9,_0x3b8a95){var _0xc004b9={};var _0xb67ab9={};var _0x5837cc;var _0x58ed74;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1eb408[_0x78fd('0x44')]['id']}})[_0x78fd('0x26')](handleEntityNotFound(_0x1dcfe9,null))[_0x78fd('0x26')](function(_0x386442){if(_0x386442){_0x5837cc=_0x386442;_0xb67ab9[_0x78fd('0x2f')]=_[_0x78fd('0x32')](db[_0x78fd('0x58')][_0x78fd('0x55')]);_0xb67ab9['query']=_['keys'](_0x1eb408[_0x78fd('0x31')]);_0xb67ab9[_0x78fd('0x3c')]=_[_0x78fd('0x34')](_0xb67ab9['model'],_0xb67ab9[_0x78fd('0x31')]);_0xc004b9[_0x78fd('0x33')]=_['intersection'](_0xb67ab9[_0x78fd('0x2f')],qs[_0x78fd('0x35')](_0x1eb408[_0x78fd('0x31')][_0x78fd('0x35')]));_0xc004b9[_0x78fd('0x33')]=_0xc004b9[_0x78fd('0x33')][_0x78fd('0x36')]?_0xc004b9[_0x78fd('0x33')]:_0xb67ab9['model'];_0xc004b9[_0x78fd('0x39')]=qs[_0x78fd('0x3a')](_0x1eb408[_0x78fd('0x31')]['sort']);_0xc004b9[_0x78fd('0x3b')]=qs[_0x78fd('0x3c')](_['pick'](_0x1eb408[_0x78fd('0x31')],_0xb67ab9[_0x78fd('0x3c')]));if(_0x1eb408[_0x78fd('0x31')]['filter']){_0xc004b9['where']=_['merge'](_0xc004b9[_0x78fd('0x3b')],{'$or':_[_0x78fd('0x2c')](_0xc004b9['attributes'],function(_0x30efc5){var _0x23a0fa={};_0x23a0fa[_0x30efc5]={'$like':'%'+_0x1eb408[_0x78fd('0x31')]['filter']+'%'};return _0x23a0fa;})});}_0xc004b9=_[_0x78fd('0x45')]({},_0xc004b9,_0x1eb408[_0x78fd('0x3f')]);return _0x5837cc['getAgents'](_0xc004b9);}})[_0x78fd('0x26')](function(_0x225ac9){if(_0x225ac9){_0x58ed74=_0x225ac9[_0x78fd('0x36')];if(!_0x1eb408[_0x78fd('0x31')][_0x78fd('0x37')]('nolimit')){_0xc004b9[_0x78fd('0x20')]=qs[_0x78fd('0x20')](_0x1eb408[_0x78fd('0x31')]['limit']);_0xc004b9[_0x78fd('0x1f')]=qs[_0x78fd('0x1f')](_0x1eb408['query'][_0x78fd('0x1f')]);}return _0x5837cc[_0x78fd('0x84')](_0xc004b9);}})[_0x78fd('0x26')](function(_0xa8cbd5){if(_0xa8cbd5){return _0xa8cbd5?{'count':_0x58ed74,'rows':_0xa8cbd5}:null;}})['then'](respondWithResult(_0x1dcfe9,null))[_0x78fd('0x46')](handleError(_0x1dcfe9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 98bd188..a180764 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 _0x836b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x104c7b,_0x789096){var _0x937283=function(_0x54e392){while(--_0x54e392){_0x104c7b['push'](_0x104c7b['shift']());}};_0x937283(++_0x789096);}(_0x836b,0xc1));var _0xb836=function(_0x29ec4c,_0x531369){_0x29ec4c=_0x29ec4c-0x0;var _0x53f08c=_0x836b[_0x29ec4c];return _0x53f08c;};'use strict';var EventEmitter=require(_0xb836('0x0'));var WhatsappQueue=require(_0xb836('0x1'))['db'][_0xb836('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb836('0x3')](0x0);var events={'afterCreate':_0xb836('0x4'),'afterUpdate':_0xb836('0x5'),'afterDestroy':_0xb836('0x6')};function emitEvent(_0xd23ad8){return function(_0xa5acd7,_0x584a1b,_0x21d19){WhatsappQueueEvents[_0xb836('0x7')](_0xd23ad8+':'+_0xa5acd7['id'],_0xa5acd7);WhatsappQueueEvents[_0xb836('0x7')](_0xd23ad8,_0xa5acd7);_0x21d19(null);};}for(var e in events){if(events[_0xb836('0x8')](e)){var event=events[e];WhatsappQueue[_0xb836('0x9')](e,emitEvent(event));}}module[_0xb836('0xa')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf151=['save','update','remove','emit','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf151,0x1b5));var _0x1f15=function(_0x21e696,_0x2340f8){_0x21e696=_0x21e696-0x0;var _0x609e55=_0xf151[_0x21e696];return _0x609e55;};'use strict';var EventEmitter=require(_0x1f15('0x0'));var WhatsappQueue=require(_0x1f15('0x1'))['db'][_0x1f15('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1f15('0x3')](0x0);var events={'afterCreate':_0x1f15('0x4'),'afterUpdate':_0x1f15('0x5'),'afterDestroy':_0x1f15('0x6')};function emitEvent(_0x1911ce){return function(_0x1f3a50,_0x180732,_0x196cbc){WhatsappQueueEvents[_0x1f15('0x7')](_0x1911ce+':'+_0x1f3a50['id'],_0x1f3a50);WhatsappQueueEvents[_0x1f15('0x7')](_0x1911ce,_0x1f3a50);_0x196cbc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x1f15('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 4cd3323..b6b4cb3 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 _0x8658=['request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x53b6c5,_0x36a685){var _0x3d1b0a=function(_0x10052b){while(--_0x10052b){_0x53b6c5['push'](_0x53b6c5['shift']());}};_0x3d1b0a(++_0x36a685);}(_0x8658,0xe5));var _0x8865=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8658[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x8865('0x0'));var util=require(_0x8865('0x1'));var logger=require(_0x8865('0x2'))(_0x8865('0x3'));var moment=require('moment');var BPromise=require(_0x8865('0x4'));var rp=require(_0x8865('0x5'));var fs=require('fs');var path=require(_0x8865('0x6'));var rimraf=require(_0x8865('0x7'));var config=require('../../config/environment');var attributes=require(_0x8865('0x8'));module[_0x8865('0x9')]=function(_0x1c198d,_0x42e993){return _0x1c198d[_0x8865('0xa')](_0x8865('0xb'),attributes,{'tableName':_0x8865('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1deb=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','whatsapp_queues'];(function(_0x96b6a,_0x12471d){var _0x3e16f3=function(_0xa1fc4b){while(--_0xa1fc4b){_0x96b6a['push'](_0x96b6a['shift']());}};_0x3e16f3(++_0x12471d);}(_0x1deb,0x160));var _0xb1de=function(_0x2f9115,_0x2c9097){_0x2f9115=_0x2f9115-0x0;var _0x18eb73=_0x1deb[_0x2f9115];return _0x18eb73;};'use strict';var _=require('lodash');var util=require(_0xb1de('0x0'));var logger=require(_0xb1de('0x1'))(_0xb1de('0x2'));var moment=require(_0xb1de('0x3'));var BPromise=require(_0xb1de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1de('0x5'));var rimraf=require(_0xb1de('0x6'));var config=require(_0xb1de('0x7'));var attributes=require(_0xb1de('0x8'));module['exports']=function(_0x87748d,_0x484ce5){return _0x87748d[_0xb1de('0x9')]('WhatsappQueue',attributes,{'tableName':_0xb1de('0xa'),'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 ecbf181..2e40647 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 _0x0d0a=['debug','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','raw','options','where','attributes','limit','include','model','map','ShowWhatsappQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x324f7a,_0x5b3aac){var _0x3100b5=function(_0x3e49b5){while(--_0x3e49b5){_0x324f7a['push'](_0x324f7a['shift']());}};_0x3100b5(++_0x5b3aac);}(_0x0d0a,0x1ae));var _0xa0d0=function(_0x3a0d5d,_0x389560){_0x3a0d5d=_0x3a0d5d-0x0;var _0x2fff6c=_0x0d0a[_0x3a0d5d];return _0x2fff6c;};'use strict';var _=require(_0xa0d0('0x0'));var util=require('util');var moment=require(_0xa0d0('0x1'));var BPromise=require(_0xa0d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0d0('0x3'));var db=require(_0xa0d0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0d0('0x5'))(_0xa0d0('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0d0('0x7'));var client=jayson[_0xa0d0('0x8')][_0xa0d0('0x9')]({'port':0x232a});config[_0xa0d0('0xa')]=_[_0xa0d0('0xb')](config['redis'],{'host':_0xa0d0('0xc'),'port':0x18eb});var socket=require(_0xa0d0('0xd'))(new Redis(config[_0xa0d0('0xa')]));require(_0xa0d0('0xe'))[_0xa0d0('0xf')](socket);function respondWithRpcPromise(_0x326665,_0x5655d3,_0x4d6e64){return new BPromise(function(_0x41c321,_0x18f589){return client[_0xa0d0('0x10')](_0x326665,_0x4d6e64)[_0xa0d0('0x11')](function(_0x193a11){logger[_0xa0d0('0x12')](_0xa0d0('0x13'),_0x5655d3,_0xa0d0('0x14'));logger[_0xa0d0('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5655d3,'request\x20sent',JSON[_0xa0d0('0x16')](_0x193a11));if(_0x193a11[_0xa0d0('0x17')]){if(_0x193a11[_0xa0d0('0x17')][_0xa0d0('0x18')]===0x1f4){logger[_0xa0d0('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x5655d3,_0x193a11[_0xa0d0('0x17')][_0xa0d0('0x19')]);return _0x18f589(_0x193a11[_0xa0d0('0x17')][_0xa0d0('0x19')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x5655d3,_0x193a11[_0xa0d0('0x17')][_0xa0d0('0x19')]);return _0x41c321(_0x193a11[_0xa0d0('0x17')][_0xa0d0('0x19')]);}else{logger['info'](_0xa0d0('0x13'),_0x5655d3,_0xa0d0('0x14'));_0x41c321(_0x193a11[_0xa0d0('0x1a')][_0xa0d0('0x19')]);}})[_0xa0d0('0x1b')](function(_0x37100b){logger['error'](_0xa0d0('0x13'),_0x5655d3,_0x37100b);_0x18f589(_0x37100b);});});}exports[_0xa0d0('0x1c')]=function(_0x1ef717){var _0x59a641=this;return new Promise(function(_0x9aec1d,_0x4bbbdb){return db[_0xa0d0('0x1d')][_0xa0d0('0x1e')]({'raw':_0x1ef717['options']?_0x1ef717['options'][_0xa0d0('0x1f')]===undefined?!![]:![]:!![],'where':_0x1ef717[_0xa0d0('0x20')]?_0x1ef717['options'][_0xa0d0('0x21')]||null:null,'attributes':_0x1ef717[_0xa0d0('0x20')]?_0x1ef717[_0xa0d0('0x20')][_0xa0d0('0x22')]||null:null,'limit':_0x1ef717[_0xa0d0('0x20')]?_0x1ef717[_0xa0d0('0x20')][_0xa0d0('0x23')]||null:null,'include':_0x1ef717[_0xa0d0('0x20')]?_0x1ef717[_0xa0d0('0x20')][_0xa0d0('0x24')]?_['map'](_0x1ef717['options'][_0xa0d0('0x24')],function(_0x1bb88d){return{'model':db[_0x1bb88d[_0xa0d0('0x25')]],'as':_0x1bb88d['as'],'attributes':_0x1bb88d[_0xa0d0('0x22')],'include':_0x1bb88d[_0xa0d0('0x24')]?_['map'](_0x1bb88d[_0xa0d0('0x24')],function(_0x490f42){return{'model':db[_0x490f42[_0xa0d0('0x25')]],'as':_0x490f42['as'],'attributes':_0x490f42[_0xa0d0('0x22')],'include':_0x490f42['include']?_[_0xa0d0('0x26')](_0x490f42[_0xa0d0('0x24')],function(_0x102fed){return{'model':db[_0x102fed[_0xa0d0('0x25')]],'as':_0x102fed['as'],'attributes':_0x102fed[_0xa0d0('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x309467){logger[_0xa0d0('0x12')](_0xa0d0('0x1c'),_0x1ef717);logger['debug'](_0xa0d0('0x1c'),_0x1ef717,JSON[_0xa0d0('0x16')](_0x309467));_0x9aec1d(_0x309467);})[_0xa0d0('0x1b')](function(_0x52f68d){logger['error'](_0xa0d0('0x1c'),_0x52f68d[_0xa0d0('0x19')],_0x1ef717);_0x4bbbdb(_0x59a641[_0xa0d0('0x17')](0x1f4,_0x52f68d[_0xa0d0('0x19')]));});});};exports[_0xa0d0('0x27')]=function(_0x23c91a){var _0x4071a5=this;return new Promise(function(_0x5e21ae,_0x2c2a19){return db[_0xa0d0('0x1d')][_0xa0d0('0x28')]({'raw':_0x23c91a[_0xa0d0('0x20')]?_0x23c91a[_0xa0d0('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x23c91a[_0xa0d0('0x20')]?_0x23c91a[_0xa0d0('0x20')]['where']||null:null,'attributes':_0x23c91a[_0xa0d0('0x20')]?_0x23c91a[_0xa0d0('0x20')]['attributes']||null:null,'include':_0x23c91a['options']?_0x23c91a[_0xa0d0('0x20')][_0xa0d0('0x24')]?_[_0xa0d0('0x26')](_0x23c91a[_0xa0d0('0x20')]['include'],function(_0x5203c0){return{'model':db[_0x5203c0[_0xa0d0('0x25')]],'as':_0x5203c0['as'],'attributes':_0x5203c0[_0xa0d0('0x22')],'include':_0x5203c0[_0xa0d0('0x24')]?_[_0xa0d0('0x26')](_0x5203c0[_0xa0d0('0x24')],function(_0x2f1e22){return{'model':db[_0x2f1e22[_0xa0d0('0x25')]],'as':_0x2f1e22['as'],'attributes':_0x2f1e22[_0xa0d0('0x22')],'include':_0x2f1e22[_0xa0d0('0x24')]?_[_0xa0d0('0x26')](_0x2f1e22[_0xa0d0('0x24')],function(_0x462dfa){return{'model':db[_0x462dfa[_0xa0d0('0x25')]],'as':_0x462dfa['as'],'attributes':_0x462dfa[_0xa0d0('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa0d0('0x11')](function(_0x43890a){logger[_0xa0d0('0x12')]('ShowWhatsappQueue',_0x23c91a);logger['debug'](_0xa0d0('0x27'),_0x23c91a,JSON[_0xa0d0('0x16')](_0x43890a));_0x5e21ae(_0x43890a);})[_0xa0d0('0x1b')](function(_0x3db50f){logger[_0xa0d0('0x17')](_0xa0d0('0x27'),_0x3db50f[_0xa0d0('0x19')],_0x23c91a);_0x2c2a19(_0x4071a5[_0xa0d0('0x17')](0x1f4,_0x3db50f[_0xa0d0('0x19')]));});});}; \ No newline at end of file +var _0x3a39=['error','code','message','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','map','model','include','stringify','ShowWhatsappQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x3a39,0x179));var _0x93a3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3a39[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0x93a3('0x0'));var moment=require(_0x93a3('0x1'));var BPromise=require(_0x93a3('0x2'));var rs=require(_0x93a3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93a3('0x4'))['db'];var utils=require(_0x93a3('0x5'));var logger=require(_0x93a3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x93a3('0x7'));var client=jayson[_0x93a3('0x8')][_0x93a3('0x9')]({'port':0x232a});config[_0x93a3('0xa')]=_[_0x93a3('0xb')](config[_0x93a3('0xa')],{'host':_0x93a3('0xc'),'port':0x18eb});var socket=require(_0x93a3('0xd'))(new Redis(config[_0x93a3('0xa')]));require(_0x93a3('0xe'))[_0x93a3('0xf')](socket);function respondWithRpcPromise(_0x4e3428,_0x230fe2,_0x2bb7e7){return new BPromise(function(_0x2c9fd3,_0x173d6a){return client[_0x93a3('0x10')](_0x4e3428,_0x2bb7e7)[_0x93a3('0x11')](function(_0x2c9c72){logger[_0x93a3('0x12')](_0x93a3('0x13'),_0x230fe2,_0x93a3('0x14'));logger[_0x93a3('0x15')](_0x93a3('0x16'),_0x230fe2,'request\x20sent',JSON['stringify'](_0x2c9c72));if(_0x2c9c72['error']){if(_0x2c9c72[_0x93a3('0x17')][_0x93a3('0x18')]===0x1f4){logger[_0x93a3('0x17')](_0x93a3('0x13'),_0x230fe2,_0x2c9c72[_0x93a3('0x17')][_0x93a3('0x19')]);return _0x173d6a(_0x2c9c72['error'][_0x93a3('0x19')]);}logger['error'](_0x93a3('0x13'),_0x230fe2,_0x2c9c72[_0x93a3('0x17')][_0x93a3('0x19')]);return _0x2c9fd3(_0x2c9c72[_0x93a3('0x17')][_0x93a3('0x19')]);}else{logger[_0x93a3('0x12')](_0x93a3('0x13'),_0x230fe2,_0x93a3('0x14'));_0x2c9fd3(_0x2c9c72['result'][_0x93a3('0x19')]);}})[_0x93a3('0x1a')](function(_0x323234){logger[_0x93a3('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x230fe2,_0x323234);_0x173d6a(_0x323234);});});}exports[_0x93a3('0x1b')]=function(_0x22378a){var _0x41c93c=this;return new Promise(function(_0x587ca3,_0x29947d){return db[_0x93a3('0x1c')]['findAll']({'raw':_0x22378a[_0x93a3('0x1d')]?_0x22378a[_0x93a3('0x1d')][_0x93a3('0x1e')]===undefined?!![]:![]:!![],'where':_0x22378a['options']?_0x22378a[_0x93a3('0x1d')][_0x93a3('0x1f')]||null:null,'attributes':_0x22378a[_0x93a3('0x1d')]?_0x22378a[_0x93a3('0x1d')][_0x93a3('0x20')]||null:null,'limit':_0x22378a[_0x93a3('0x1d')]?_0x22378a[_0x93a3('0x1d')][_0x93a3('0x21')]||null:null,'include':_0x22378a[_0x93a3('0x1d')]?_0x22378a['options']['include']?_[_0x93a3('0x22')](_0x22378a[_0x93a3('0x1d')]['include'],function(_0x20016d){return{'model':db[_0x20016d[_0x93a3('0x23')]],'as':_0x20016d['as'],'attributes':_0x20016d[_0x93a3('0x20')],'include':_0x20016d[_0x93a3('0x24')]?_[_0x93a3('0x22')](_0x20016d[_0x93a3('0x24')],function(_0x34e05c){return{'model':db[_0x34e05c[_0x93a3('0x23')]],'as':_0x34e05c['as'],'attributes':_0x34e05c['attributes'],'include':_0x34e05c['include']?_[_0x93a3('0x22')](_0x34e05c['include'],function(_0x426a55){return{'model':db[_0x426a55[_0x93a3('0x23')]],'as':_0x426a55['as'],'attributes':_0x426a55[_0x93a3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b2be9){logger['info'](_0x93a3('0x1b'),_0x22378a);logger[_0x93a3('0x15')](_0x93a3('0x1b'),_0x22378a,JSON[_0x93a3('0x25')](_0x5b2be9));_0x587ca3(_0x5b2be9);})[_0x93a3('0x1a')](function(_0x3e1640){logger['error'](_0x93a3('0x1b'),_0x3e1640['message'],_0x22378a);_0x29947d(_0x41c93c[_0x93a3('0x17')](0x1f4,_0x3e1640['message']));});});};exports[_0x93a3('0x26')]=function(_0x4fa659){var _0x2567fd=this;return new Promise(function(_0x331e94,_0x1c714d){return db[_0x93a3('0x1c')][_0x93a3('0x27')]({'raw':_0x4fa659['options']?_0x4fa659['options'][_0x93a3('0x1e')]===undefined?!![]:![]:!![],'where':_0x4fa659[_0x93a3('0x1d')]?_0x4fa659[_0x93a3('0x1d')]['where']||null:null,'attributes':_0x4fa659[_0x93a3('0x1d')]?_0x4fa659[_0x93a3('0x1d')][_0x93a3('0x20')]||null:null,'include':_0x4fa659['options']?_0x4fa659['options'][_0x93a3('0x24')]?_['map'](_0x4fa659[_0x93a3('0x1d')]['include'],function(_0x58b135){return{'model':db[_0x58b135['model']],'as':_0x58b135['as'],'attributes':_0x58b135[_0x93a3('0x20')],'include':_0x58b135['include']?_['map'](_0x58b135[_0x93a3('0x24')],function(_0x472bd5){return{'model':db[_0x472bd5[_0x93a3('0x23')]],'as':_0x472bd5['as'],'attributes':_0x472bd5[_0x93a3('0x20')],'include':_0x472bd5['include']?_['map'](_0x472bd5[_0x93a3('0x24')],function(_0x4b041f){return{'model':db[_0x4b041f['model']],'as':_0x4b041f['as'],'attributes':_0x4b041f[_0x93a3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5aba92){logger[_0x93a3('0x12')](_0x93a3('0x26'),_0x4fa659);logger[_0x93a3('0x15')]('ShowWhatsappQueue',_0x4fa659,JSON[_0x93a3('0x25')](_0x5aba92));_0x331e94(_0x5aba92);})[_0x93a3('0x1a')](function(_0x407564){logger[_0x93a3('0x17')]('ShowWhatsappQueue',_0x407564[_0x93a3('0x19')],_0x4fa659);_0x1c714d(_0x2567fd['error'](0x1f4,_0x407564[_0x93a3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 770b5cd..5bc7566 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 _0x03a6=['save','remove','update','emit','removeListener','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x26e8a6,_0x5eee2b){var _0xb23ba6=function(_0x45cea5){while(--_0x45cea5){_0x26e8a6['push'](_0x26e8a6['shift']());}};_0xb23ba6(++_0x5eee2b);}(_0x03a6,0x1af));var _0x603a=function(_0x5ece75,_0x286fad){_0x5ece75=_0x5ece75-0x0;var _0x430b6f=_0x03a6[_0x5ece75];return _0x430b6f;};'use strict';var WhatsappQueueEvents=require(_0x603a('0x0'));var events=[_0x603a('0x1'),_0x603a('0x2'),_0x603a('0x3')];function createListener(_0x335884,_0x3eb86d){return function(_0x5569e8){_0x3eb86d[_0x603a('0x4')](_0x335884,_0x5569e8);};}function removeListener(_0x4921da,_0x30bec5){return function(){WhatsappQueueEvents[_0x603a('0x5')](_0x4921da,_0x30bec5);};}exports['register']=function(_0x57f841){for(var _0x297d3d=0x0,_0x32674e=events[_0x603a('0x6')];_0x297d3d<_0x32674e;_0x297d3d++){var _0x19aacf=events[_0x297d3d];var _0x3fb550=createListener(_0x603a('0x7')+_0x19aacf,_0x57f841);WhatsappQueueEvents['on'](_0x19aacf,_0x3fb550);}}; \ No newline at end of file +var _0xb776=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','emit'];(function(_0x5a56c6,_0x2bb453){var _0x3a9491=function(_0x37e861){while(--_0x37e861){_0x5a56c6['push'](_0x5a56c6['shift']());}};_0x3a9491(++_0x2bb453);}(_0xb776,0x1cc));var _0x6b77=function(_0x5b6a4e,_0x31b107){_0x5b6a4e=_0x5b6a4e-0x0;var _0x31a041=_0xb776[_0x5b6a4e];return _0x31a041;};'use strict';var WhatsappQueueEvents=require(_0x6b77('0x0'));var events=[_0x6b77('0x1'),_0x6b77('0x2'),'update'];function createListener(_0x261829,_0x389ccf){return function(_0x25ad61){_0x389ccf[_0x6b77('0x3')](_0x261829,_0x25ad61);};}function removeListener(_0x3663c7,_0xb8ebde){return function(){WhatsappQueueEvents[_0x6b77('0x4')](_0x3663c7,_0xb8ebde);};}exports[_0x6b77('0x5')]=function(_0x586afd){for(var _0x573554=0x0,_0x18baf5=events[_0x6b77('0x6')];_0x573554<_0x18baf5;_0x573554++){var _0x462c6b=events[_0x573554];var _0x646210=createListener(_0x6b77('0x7')+_0x462c6b,_0x586afd);WhatsappQueueEvents['on'](_0x462c6b,_0x646210);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8bfe471..abf4bca 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 _0x8ac5=['get','/describe','describe','/:id','show','post','create','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index'];(function(_0x37a2af,_0xc3a752){var _0x484899=function(_0x66d054){while(--_0x66d054){_0x37a2af['push'](_0x37a2af['shift']());}};_0x484899(++_0xc3a752);}(_0x8ac5,0x105));var _0x58ac=function(_0x487cbd,_0x235f86){_0x487cbd=_0x487cbd-0x0;var _0x42f5d7=_0x8ac5[_0x487cbd];return _0x42f5d7;};'use strict';var multer=require(_0x58ac('0x0'));var util=require(_0x58ac('0x1'));var path=require(_0x58ac('0x2'));var timeout=require(_0x58ac('0x3'));var express=require(_0x58ac('0x4'));var router=express[_0x58ac('0x5')]();var auth=require(_0x58ac('0x6'));var interaction=require(_0x58ac('0x7'));var config=require(_0x58ac('0x8'));var controller=require(_0x58ac('0x9'));router['get']('/',auth[_0x58ac('0xa')](),controller[_0x58ac('0xb')]);router[_0x58ac('0xc')](_0x58ac('0xd'),auth[_0x58ac('0xa')](),controller[_0x58ac('0xe')]);router[_0x58ac('0xc')](_0x58ac('0xf'),auth[_0x58ac('0xa')](),controller[_0x58ac('0x10')]);router[_0x58ac('0x11')]('/',auth[_0x58ac('0xa')](),controller[_0x58ac('0x12')]);router['put'](_0x58ac('0xf'),auth[_0x58ac('0xa')](),controller['update']);router['delete'](_0x58ac('0xf'),auth[_0x58ac('0xa')](),controller[_0x58ac('0x13')]);module[_0x58ac('0x14')]=router; \ No newline at end of file +var _0x8ebd=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x43e53c,_0x113013){var _0x281074=function(_0x510fe8){while(--_0x510fe8){_0x43e53c['push'](_0x43e53c['shift']());}};_0x281074(++_0x113013);}(_0x8ebd,0x16d));var _0xd8eb=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8ebd[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0xd8eb('0x0'));var util=require(_0xd8eb('0x1'));var path=require(_0xd8eb('0x2'));var timeout=require('connect-timeout');var express=require(_0xd8eb('0x3'));var router=express['Router']();var auth=require(_0xd8eb('0x4'));var interaction=require(_0xd8eb('0x5'));var config=require(_0xd8eb('0x6'));var controller=require(_0xd8eb('0x7'));router[_0xd8eb('0x8')]('/',auth[_0xd8eb('0x9')](),controller[_0xd8eb('0xa')]);router[_0xd8eb('0x8')](_0xd8eb('0xb'),auth[_0xd8eb('0x9')](),controller[_0xd8eb('0xc')]);router[_0xd8eb('0x8')](_0xd8eb('0xd'),auth[_0xd8eb('0x9')](),controller[_0xd8eb('0xe')]);router[_0xd8eb('0xf')]('/',auth[_0xd8eb('0x9')](),controller[_0xd8eb('0x10')]);router[_0xd8eb('0x11')](_0xd8eb('0xd'),auth[_0xd8eb('0x9')](),controller[_0xd8eb('0x12')]);router[_0xd8eb('0x13')](_0xd8eb('0xd'),auth['isAuthenticated'](),controller[_0xd8eb('0x14')]);module[_0xd8eb('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index c4eb7e0..a3f89d0 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 _0x7217=['sequelize','STRING','DATE'];(function(_0x575385,_0x6a7ec){var _0x3fafda=function(_0x45b25b){while(--_0x45b25b){_0x575385['push'](_0x575385['shift']());}};_0x3fafda(++_0x6a7ec);}(_0x7217,0x19e));var _0x7721=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x7217[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7721('0x1')]},'joinAt':{'type':Sequelize[_0x7721('0x2')]},'leaveAt':{'type':Sequelize[_0x7721('0x2')]},'acceptAt':{'type':Sequelize[_0x7721('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x2b2ef8,_0x216e72){var _0x369d9a=function(_0x5cb9fc){while(--_0x5cb9fc){_0x2b2ef8['push'](_0x2b2ef8['shift']());}};_0x369d9a(++_0x216e72);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1218c5,_0x3cf770){_0x1218c5=_0x1218c5-0x0;var _0x221890=_0x8ef6[_0x1218c5];return _0x221890;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x68ef('0x2')]},'joinAt':{'type':Sequelize[_0x68ef('0x3')]},'leaveAt':{'type':Sequelize[_0x68ef('0x3')]},'acceptAt':{'type':Sequelize[_0x68ef('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x68ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 448a2ae..e92981a 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 _0x046b=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','count','offset','limit','Content-Range','json','save','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0xf24f30,_0x77205b){var _0x364bea=function(_0x562a10){while(--_0x562a10){_0xf24f30['push'](_0xf24f30['shift']());}};_0x364bea(++_0x77205b);}(_0x046b,0x1ba));var _0xb046=function(_0x272e71,_0x3aeff4){_0x272e71=_0x272e71-0x0;var _0x2f1ff3=_0x046b[_0x272e71];return _0x2f1ff3;};'use strict';var pdf=require(_0xb046('0x0'));var emlformat=require(_0xb046('0x1'));var rimraf=require(_0xb046('0x2'));var zipdir=require(_0xb046('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb046('0x4'));var moment=require(_0xb046('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb046('0x6'));var util=require(_0xb046('0x7'));var path=require(_0xb046('0x8'));var sox=require(_0xb046('0x9'));var csv=require(_0xb046('0xa'));var ejs=require(_0xb046('0xb'));var fs=require('fs');var _=require(_0xb046('0xc'));var squel=require(_0xb046('0xd'));var crypto=require(_0xb046('0xe'));var jsforce=require(_0xb046('0xf'));var deskjs=require(_0xb046('0x10'));var toCsv=require(_0xb046('0xa'));var querystring=require(_0xb046('0x11'));var Papa=require('papaparse');var Redis=require(_0xb046('0x12'));var authService=require(_0xb046('0x13'));var qs=require(_0xb046('0x14'));var as=require(_0xb046('0x15'));var hardwareService=require(_0xb046('0x16'));var logger=require('../../config/logger')(_0xb046('0x17'));var utils=require(_0xb046('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dfff1,_0x9fda4b){_0x9fda4b=_0x9fda4b||0xcc;return function(_0x2ff4f3){if(_0x2ff4f3){return _0x3dfff1[_0xb046('0x19')](_0x9fda4b);}return _0x3dfff1[_0xb046('0x1a')](_0x9fda4b)[_0xb046('0x1b')]();};}function respondWithResult(_0x3246b2,_0x1d97b0){_0x1d97b0=_0x1d97b0||0xc8;return function(_0x36e91f){if(_0x36e91f){return _0x3246b2[_0xb046('0x1a')](_0x1d97b0)['json'](_0x36e91f);}};}function respondWithFilteredResult(_0x2688bb,_0x3a8109){return function(_0x4fd90c){if(_0x4fd90c){var _0x2b0d1e=_0x4fd90c[_0xb046('0x1c')],_0x5e54c6=_0x3a8109[_0xb046('0x1d')],_0x3880da=_0x3a8109[_0xb046('0x1d')]+_0x3a8109[_0xb046('0x1e')],_0xe9da83;if(_0x3880da>=_0x2b0d1e){_0x3880da=_0x2b0d1e;_0xe9da83=0xc8;}else{_0xe9da83=0xce;}_0x2688bb['status'](_0xe9da83);return _0x2688bb['set'](_0xb046('0x1f'),_0x5e54c6+'-'+_0x3880da+'/'+_0x2b0d1e)[_0xb046('0x20')](_0x4fd90c);}return null;};}function patchUpdates(_0x37ca7b){return function(_0x4cd3c1){try{jsonpatch['apply'](_0x4cd3c1,_0x37ca7b,!![]);}catch(_0x1d617c){return BPromise['reject'](_0x1d617c);}return _0x4cd3c1[_0xb046('0x21')]();};}function saveUpdates(_0x49781d,_0x9456ce){return function(_0x3e9a1f){if(_0x3e9a1f){return _0x3e9a1f[_0xb046('0x22')](_0x49781d)[_0xb046('0x23')](function(_0x48768c){return _0x48768c;});}return null;};}function removeEntity(_0x57adaa,_0x505294){return function(_0x2dbdde){if(_0x2dbdde){return _0x2dbdde[_0xb046('0x24')]()[_0xb046('0x23')](function(){_0x57adaa[_0xb046('0x1a')](0xcc)[_0xb046('0x1b')]();});}};}function handleEntityNotFound(_0x433526,_0x51c65d){return function(_0x2750f8){if(!_0x2750f8){_0x433526['sendStatus'](0x194);}return _0x2750f8;};}function handleError(_0x52984a,_0x41841e){_0x41841e=_0x41841e||0x1f4;return function(_0x377ada){logger[_0xb046('0x25')](_0x377ada[_0xb046('0x26')]);if(_0x377ada[_0xb046('0x27')]){delete _0x377ada[_0xb046('0x27')];}_0x52984a[_0xb046('0x1a')](_0x41841e)[_0xb046('0x28')](_0x377ada);};}exports['index']=function(_0x5820f7,_0x1f8522){var _0x4e35d0={},_0x2ff57c={},_0xf57ee2={'count':0x0,'rows':[]};var _0x114f08=_[_0xb046('0x29')](db[_0xb046('0x2a')][_0xb046('0x2b')],function(_0x180f77){return{'name':_0x180f77[_0xb046('0x2c')],'type':_0x180f77[_0xb046('0x2d')][_0xb046('0x2e')]};});_0x2ff57c[_0xb046('0x2f')]=_[_0xb046('0x29')](_0x114f08,_0xb046('0x27'));_0x2ff57c['query']=_[_0xb046('0x30')](_0x5820f7['query']);_0x2ff57c[_0xb046('0x31')]=_[_0xb046('0x32')](_0x2ff57c[_0xb046('0x2f')],_0x2ff57c[_0xb046('0x33')]);_0x4e35d0[_0xb046('0x34')]=_['intersection'](_0x2ff57c['model'],qs[_0xb046('0x35')](_0x5820f7[_0xb046('0x33')][_0xb046('0x35')]));_0x4e35d0[_0xb046('0x34')]=_0x4e35d0['attributes'][_0xb046('0x36')]?_0x4e35d0[_0xb046('0x34')]:_0x2ff57c[_0xb046('0x2f')];if(!_0x5820f7['query'][_0xb046('0x37')](_0xb046('0x38'))){_0x4e35d0[_0xb046('0x1e')]=qs[_0xb046('0x1e')](_0x5820f7[_0xb046('0x33')][_0xb046('0x1e')]);_0x4e35d0['offset']=qs['offset'](_0x5820f7[_0xb046('0x33')][_0xb046('0x1d')]);}_0x4e35d0[_0xb046('0x39')]=qs[_0xb046('0x3a')](_0x5820f7[_0xb046('0x33')]['sort']);_0x4e35d0[_0xb046('0x3b')]=qs['filters'](_[_0xb046('0x3c')](_0x5820f7[_0xb046('0x33')],_0x2ff57c[_0xb046('0x31')]),_0x114f08);if(_0x5820f7[_0xb046('0x33')][_0xb046('0x3d')]){_0x4e35d0[_0xb046('0x3b')]=_[_0xb046('0x3e')](_0x4e35d0[_0xb046('0x3b')],{'$or':_['map'](_0x114f08,function(_0x33b89d){if(_0x33b89d[_0xb046('0x2d')]!==_0xb046('0x3f')){var _0x520210={};_0x520210[_0x33b89d['name']]={'$like':'%'+_0x5820f7['query']['filter']+'%'};return _0x520210;}})});}_0x4e35d0=_[_0xb046('0x3e')]({},_0x4e35d0,_0x5820f7[_0xb046('0x40')]);var _0x4c3329={'where':_0x4e35d0[_0xb046('0x3b')]};return db[_0xb046('0x2a')][_0xb046('0x1c')](_0x4c3329)[_0xb046('0x23')](function(_0x4efbf1){_0xf57ee2[_0xb046('0x1c')]=_0x4efbf1;if(_0x5820f7['query'][_0xb046('0x41')]){_0x4e35d0[_0xb046('0x42')]=[{'all':!![]}];}return db[_0xb046('0x2a')][_0xb046('0x43')](_0x4e35d0);})[_0xb046('0x23')](function(_0x45b738){_0xf57ee2[_0xb046('0x44')]=_0x45b738;return _0xf57ee2;})[_0xb046('0x23')](respondWithFilteredResult(_0x1f8522,_0x4e35d0))[_0xb046('0x45')](handleError(_0x1f8522,null));};exports[_0xb046('0x46')]=function(_0x445d9f,_0x8a54a0){var _0x88825={'raw':!![],'where':{'id':_0x445d9f['params']['id']}},_0x475828={};_0x475828[_0xb046('0x2f')]=_[_0xb046('0x30')](db[_0xb046('0x2a')][_0xb046('0x2b')]);_0x475828[_0xb046('0x33')]=_[_0xb046('0x30')](_0x445d9f['query']);_0x475828['filters']=_[_0xb046('0x32')](_0x475828[_0xb046('0x2f')],_0x475828[_0xb046('0x33')]);_0x88825[_0xb046('0x34')]=_[_0xb046('0x32')](_0x475828[_0xb046('0x2f')],qs[_0xb046('0x35')](_0x445d9f['query'][_0xb046('0x35')]));_0x88825[_0xb046('0x34')]=_0x88825['attributes'][_0xb046('0x36')]?_0x88825[_0xb046('0x34')]:_0x475828['model'];if(_0x445d9f[_0xb046('0x33')]['includeAll']){_0x88825[_0xb046('0x42')]=[{'all':!![]}];}_0x88825=_[_0xb046('0x3e')]({},_0x88825,_0x445d9f[_0xb046('0x40')]);return db['WhatsappQueueReport'][_0xb046('0x47')](_0x88825)[_0xb046('0x23')](handleEntityNotFound(_0x8a54a0,null))[_0xb046('0x23')](respondWithResult(_0x8a54a0,null))[_0xb046('0x45')](handleError(_0x8a54a0,null));};exports[_0xb046('0x48')]=function(_0x507e58,_0x5e71d7){return db['WhatsappQueueReport'][_0xb046('0x48')](_0x507e58[_0xb046('0x49')],{})[_0xb046('0x23')](respondWithResult(_0x5e71d7,0xc9))[_0xb046('0x45')](handleError(_0x5e71d7,null));};exports[_0xb046('0x22')]=function(_0xdea490,_0x485898){if(_0xdea490[_0xb046('0x49')]['id']){delete _0xdea490[_0xb046('0x49')]['id'];}return db[_0xb046('0x2a')][_0xb046('0x47')]({'where':{'id':_0xdea490[_0xb046('0x4a')]['id']}})[_0xb046('0x23')](handleEntityNotFound(_0x485898,null))[_0xb046('0x23')](saveUpdates(_0xdea490[_0xb046('0x49')],null))['then'](respondWithResult(_0x485898,null))[_0xb046('0x45')](handleError(_0x485898,null));};exports[_0xb046('0x24')]=function(_0x45fd46,_0x1a4a36){return db[_0xb046('0x2a')]['find']({'where':{'id':_0x45fd46[_0xb046('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a4a36,null))[_0xb046('0x23')](removeEntity(_0x1a4a36,null))[_0xb046('0x45')](handleError(_0x1a4a36,null));};exports[_0xb046('0x4b')]=function(_0x33d1c2,_0x51654b){return db[_0xb046('0x2a')][_0xb046('0x4b')]()[_0xb046('0x23')](respondWithResult(_0x51654b,null))['catch'](handleError(_0x51654b,null));}; \ No newline at end of file +var _0xe635=['then','destroy','end','error','name','send','map','WhatsappQueueReport','rawAttributes','type','model','query','keys','intersection','fields','attributes','nolimit','sort','where','filters','filter','merge','options','includeAll','rows','catch','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update'];(function(_0xdff253,_0x437916){var _0x399988=function(_0xe0d3b2){while(--_0xe0d3b2){_0xdff253['push'](_0xdff253['shift']());}};_0x399988(++_0x437916);}(_0xe635,0x1be));var _0x5e63=function(_0x30ecf2,_0x2d3bf8){_0x30ecf2=_0x30ecf2-0x0;var _0x2aef2f=_0xe635[_0x30ecf2];return _0x2aef2f;};'use strict';var pdf=require(_0x5e63('0x0'));var emlformat=require(_0x5e63('0x1'));var rimraf=require(_0x5e63('0x2'));var zipdir=require(_0x5e63('0x3'));var jsonpatch=require(_0x5e63('0x4'));var rp=require(_0x5e63('0x5'));var moment=require(_0x5e63('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e63('0x7'));var path=require(_0x5e63('0x8'));var sox=require(_0x5e63('0x9'));var csv=require(_0x5e63('0xa'));var ejs=require(_0x5e63('0xb'));var fs=require('fs');var _=require(_0x5e63('0xc'));var squel=require(_0x5e63('0xd'));var crypto=require(_0x5e63('0xe'));var jsforce=require(_0x5e63('0xf'));var deskjs=require(_0x5e63('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5e63('0x11'));var Papa=require(_0x5e63('0x12'));var Redis=require(_0x5e63('0x13'));var authService=require(_0x5e63('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5e63('0x15'));var hardwareService=require(_0x5e63('0x16'));var logger=require('../../config/logger')(_0x5e63('0x17'));var utils=require(_0x5e63('0x18'));var config=require('../../config/environment');var db=require(_0x5e63('0x19'))['db'];function respondWithStatusCode(_0x52b256,_0x1dcbf4){_0x1dcbf4=_0x1dcbf4||0xcc;return function(_0x23c833){if(_0x23c833){return _0x52b256[_0x5e63('0x1a')](_0x1dcbf4);}return _0x52b256[_0x5e63('0x1b')](_0x1dcbf4)['end']();};}function respondWithResult(_0x57a086,_0x560fee){_0x560fee=_0x560fee||0xc8;return function(_0x187e2e){if(_0x187e2e){return _0x57a086[_0x5e63('0x1b')](_0x560fee)['json'](_0x187e2e);}};}function respondWithFilteredResult(_0x1c6728,_0x1f7149){return function(_0x3c5d47){if(_0x3c5d47){var _0x491e27=_0x3c5d47[_0x5e63('0x1c')],_0x42a714=_0x1f7149[_0x5e63('0x1d')],_0xe0b567=_0x1f7149['offset']+_0x1f7149[_0x5e63('0x1e')],_0x4715f9;if(_0xe0b567>=_0x491e27){_0xe0b567=_0x491e27;_0x4715f9=0xc8;}else{_0x4715f9=0xce;}_0x1c6728[_0x5e63('0x1b')](_0x4715f9);return _0x1c6728[_0x5e63('0x1f')](_0x5e63('0x20'),_0x42a714+'-'+_0xe0b567+'/'+_0x491e27)[_0x5e63('0x21')](_0x3c5d47);}return null;};}function patchUpdates(_0x4a6013){return function(_0x3d5b23){try{jsonpatch['apply'](_0x3d5b23,_0x4a6013,!![]);}catch(_0x5d5cb4){return BPromise[_0x5e63('0x22')](_0x5d5cb4);}return _0x3d5b23[_0x5e63('0x23')]();};}function saveUpdates(_0x318047,_0x2ba2f0){return function(_0x239d37){if(_0x239d37){return _0x239d37[_0x5e63('0x24')](_0x318047)[_0x5e63('0x25')](function(_0x29ed92){return _0x29ed92;});}return null;};}function removeEntity(_0x2a3f12,_0x3fdabb){return function(_0x4c52f9){if(_0x4c52f9){return _0x4c52f9[_0x5e63('0x26')]()['then'](function(){_0x2a3f12['status'](0xcc)[_0x5e63('0x27')]();});}};}function handleEntityNotFound(_0x3ff002,_0x2d9387){return function(_0x9dc630){if(!_0x9dc630){_0x3ff002[_0x5e63('0x1a')](0x194);}return _0x9dc630;};}function handleError(_0x270236,_0x283bba){_0x283bba=_0x283bba||0x1f4;return function(_0x4eab9d){logger[_0x5e63('0x28')](_0x4eab9d['stack']);if(_0x4eab9d[_0x5e63('0x29')]){delete _0x4eab9d[_0x5e63('0x29')];}_0x270236['status'](_0x283bba)[_0x5e63('0x2a')](_0x4eab9d);};}exports['index']=function(_0x57235e,_0x1e2a52){var _0x548718={},_0x4e0a86={},_0x1f2eff={'count':0x0,'rows':[]};var _0x14434d=_[_0x5e63('0x2b')](db[_0x5e63('0x2c')][_0x5e63('0x2d')],function(_0x25c635){return{'name':_0x25c635['fieldName'],'type':_0x25c635[_0x5e63('0x2e')]['key']};});_0x4e0a86[_0x5e63('0x2f')]=_[_0x5e63('0x2b')](_0x14434d,_0x5e63('0x29'));_0x4e0a86[_0x5e63('0x30')]=_[_0x5e63('0x31')](_0x57235e[_0x5e63('0x30')]);_0x4e0a86['filters']=_[_0x5e63('0x32')](_0x4e0a86[_0x5e63('0x2f')],_0x4e0a86[_0x5e63('0x30')]);_0x548718['attributes']=_[_0x5e63('0x32')](_0x4e0a86[_0x5e63('0x2f')],qs[_0x5e63('0x33')](_0x57235e[_0x5e63('0x30')]['fields']));_0x548718['attributes']=_0x548718['attributes']['length']?_0x548718[_0x5e63('0x34')]:_0x4e0a86[_0x5e63('0x2f')];if(!_0x57235e[_0x5e63('0x30')]['hasOwnProperty'](_0x5e63('0x35'))){_0x548718[_0x5e63('0x1e')]=qs['limit'](_0x57235e[_0x5e63('0x30')][_0x5e63('0x1e')]);_0x548718[_0x5e63('0x1d')]=qs[_0x5e63('0x1d')](_0x57235e['query'][_0x5e63('0x1d')]);}_0x548718['order']=qs['sort'](_0x57235e[_0x5e63('0x30')][_0x5e63('0x36')]);_0x548718[_0x5e63('0x37')]=qs[_0x5e63('0x38')](_['pick'](_0x57235e[_0x5e63('0x30')],_0x4e0a86[_0x5e63('0x38')]),_0x14434d);if(_0x57235e[_0x5e63('0x30')][_0x5e63('0x39')]){_0x548718[_0x5e63('0x37')]=_[_0x5e63('0x3a')](_0x548718[_0x5e63('0x37')],{'$or':_[_0x5e63('0x2b')](_0x14434d,function(_0x48da95){if(_0x48da95[_0x5e63('0x2e')]!=='VIRTUAL'){var _0x115d26={};_0x115d26[_0x48da95['name']]={'$like':'%'+_0x57235e[_0x5e63('0x30')][_0x5e63('0x39')]+'%'};return _0x115d26;}})});}_0x548718=_['merge']({},_0x548718,_0x57235e[_0x5e63('0x3b')]);var _0x351ef0={'where':_0x548718[_0x5e63('0x37')]};return db[_0x5e63('0x2c')]['count'](_0x351ef0)['then'](function(_0x2d5c35){_0x1f2eff[_0x5e63('0x1c')]=_0x2d5c35;if(_0x57235e[_0x5e63('0x30')][_0x5e63('0x3c')]){_0x548718['include']=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x548718);})[_0x5e63('0x25')](function(_0x45373f){_0x1f2eff[_0x5e63('0x3d')]=_0x45373f;return _0x1f2eff;})[_0x5e63('0x25')](respondWithFilteredResult(_0x1e2a52,_0x548718))[_0x5e63('0x3e')](handleError(_0x1e2a52,null));};exports['show']=function(_0x7215a9,_0x364329){var _0x51b36c={'raw':!![],'where':{'id':_0x7215a9['params']['id']}},_0x1fb614={};_0x1fb614[_0x5e63('0x2f')]=_['keys'](db[_0x5e63('0x2c')][_0x5e63('0x2d')]);_0x1fb614[_0x5e63('0x30')]=_['keys'](_0x7215a9[_0x5e63('0x30')]);_0x1fb614[_0x5e63('0x38')]=_[_0x5e63('0x32')](_0x1fb614[_0x5e63('0x2f')],_0x1fb614[_0x5e63('0x30')]);_0x51b36c[_0x5e63('0x34')]=_['intersection'](_0x1fb614[_0x5e63('0x2f')],qs[_0x5e63('0x33')](_0x7215a9[_0x5e63('0x30')][_0x5e63('0x33')]));_0x51b36c[_0x5e63('0x34')]=_0x51b36c['attributes'][_0x5e63('0x3f')]?_0x51b36c[_0x5e63('0x34')]:_0x1fb614['model'];if(_0x7215a9['query'][_0x5e63('0x3c')]){_0x51b36c['include']=[{'all':!![]}];}_0x51b36c=_[_0x5e63('0x3a')]({},_0x51b36c,_0x7215a9['options']);return db['WhatsappQueueReport'][_0x5e63('0x40')](_0x51b36c)[_0x5e63('0x25')](handleEntityNotFound(_0x364329,null))[_0x5e63('0x25')](respondWithResult(_0x364329,null))[_0x5e63('0x3e')](handleError(_0x364329,null));};exports[_0x5e63('0x41')]=function(_0x9dc236,_0x402729){return db[_0x5e63('0x2c')][_0x5e63('0x41')](_0x9dc236[_0x5e63('0x42')],{})[_0x5e63('0x25')](respondWithResult(_0x402729,0xc9))[_0x5e63('0x3e')](handleError(_0x402729,null));};exports[_0x5e63('0x24')]=function(_0x571e6d,_0x3e4969){if(_0x571e6d[_0x5e63('0x42')]['id']){delete _0x571e6d[_0x5e63('0x42')]['id'];}return db[_0x5e63('0x2c')][_0x5e63('0x40')]({'where':{'id':_0x571e6d[_0x5e63('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e4969,null))[_0x5e63('0x25')](saveUpdates(_0x571e6d['body'],null))[_0x5e63('0x25')](respondWithResult(_0x3e4969,null))['catch'](handleError(_0x3e4969,null));};exports[_0x5e63('0x26')]=function(_0x2b51c7,_0x53df5e){return db['WhatsappQueueReport']['find']({'where':{'id':_0x2b51c7[_0x5e63('0x43')]['id']}})['then'](handleEntityNotFound(_0x53df5e,null))[_0x5e63('0x25')](removeEntity(_0x53df5e,null))['catch'](handleError(_0x53df5e,null));};exports[_0x5e63('0x44')]=function(_0x3268f7,_0x453009){return db['WhatsappQueueReport']['describe']()[_0x5e63('0x25')](respondWithResult(_0x453009,null))['catch'](handleError(_0x453009,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 68149f7..2fec862 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 _0x8f5b=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x8f5b,0x129));var _0xb8f5=function(_0x37768b,_0xedcc5a){_0x37768b=_0x37768b-0x0;var _0x1f3c43=_0x8f5b[_0x37768b];return _0x1f3c43;};'use strict';var _=require(_0xb8f5('0x0'));var util=require(_0xb8f5('0x1'));var logger=require(_0xb8f5('0x2'))(_0xb8f5('0x3'));var moment=require(_0xb8f5('0x4'));var BPromise=require('bluebird');var rp=require(_0xb8f5('0x5'));var fs=require('fs');var path=require(_0xb8f5('0x6'));var rimraf=require(_0xb8f5('0x7'));var config=require(_0xb8f5('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0xb8f5('0x9')]=function(_0x5b7d29,_0x18bfe8){return _0x5b7d29[_0xb8f5('0xa')](_0xb8f5('0xb'),attributes,{'tableName':_0xb8f5('0xc'),'paranoid':![],'indexes':[{'name':_0xb8f5('0xd'),'fields':[_0xb8f5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac60=['define','WhatsappQueueReport','uniqueid','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x4e7306,_0x51515f){var _0x403bbe=function(_0x311e60){while(--_0x311e60){_0x4e7306['push'](_0x4e7306['shift']());}};_0x403bbe(++_0x51515f);}(_0xac60,0x137));var _0x0ac6=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xac60[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0ac6('0x0'))(_0x0ac6('0x1'));var moment=require(_0x0ac6('0x2'));var BPromise=require(_0x0ac6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ac6('0x4'));var config=require(_0x0ac6('0x5'));var attributes=require(_0x0ac6('0x6'));module[_0x0ac6('0x7')]=function(_0x49360e,_0x15d308){return _0x49360e[_0x0ac6('0x8')](_0x0ac6('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x0ac6('0xa'),'fields':[_0x0ac6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 57cc133..a4ee107 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 _0xa7d8=['catch','CreateWhatsappQueueReport','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa7d8,0x94));var _0x8a7d=function(_0x2d1755,_0x15724a){_0x2d1755=_0x2d1755-0x0;var _0x479df7=_0xa7d8[_0x2d1755];return _0x479df7;};'use strict';var _=require(_0x8a7d('0x0'));var util=require('util');var moment=require(_0x8a7d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a7d('0x2'));var fs=require('fs');var Redis=require(_0x8a7d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a7d('0x4'));var logger=require(_0x8a7d('0x5'))(_0x8a7d('0x6'));var config=require(_0x8a7d('0x7'));var jayson=require(_0x8a7d('0x8'));var client=jayson[_0x8a7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3821fb,_0x391cbf,_0x500943){return new BPromise(function(_0x1f4767,_0x5f5d25){return client[_0x8a7d('0xa')](_0x3821fb,_0x500943)[_0x8a7d('0xb')](function(_0x367687){logger[_0x8a7d('0xc')](_0x8a7d('0xd'),_0x391cbf,'request\x20sent');logger[_0x8a7d('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x391cbf,_0x8a7d('0xf'),JSON[_0x8a7d('0x10')](_0x367687));if(_0x367687[_0x8a7d('0x11')]){if(_0x367687[_0x8a7d('0x11')]['code']===0x1f4){logger[_0x8a7d('0x11')](_0x8a7d('0xd'),_0x391cbf,_0x367687[_0x8a7d('0x11')][_0x8a7d('0x12')]);return _0x5f5d25(_0x367687['error'][_0x8a7d('0x12')]);}logger[_0x8a7d('0x11')](_0x8a7d('0xd'),_0x391cbf,_0x367687[_0x8a7d('0x11')][_0x8a7d('0x12')]);return _0x1f4767(_0x367687[_0x8a7d('0x11')][_0x8a7d('0x12')]);}else{logger[_0x8a7d('0xc')](_0x8a7d('0xd'),_0x391cbf,_0x8a7d('0xf'));_0x1f4767(_0x367687[_0x8a7d('0x13')][_0x8a7d('0x12')]);}})[_0x8a7d('0x14')](function(_0x4cd0ca){logger[_0x8a7d('0x11')](_0x8a7d('0xd'),_0x391cbf,_0x4cd0ca);_0x5f5d25(_0x4cd0ca);});});}exports[_0x8a7d('0x15')]=function(_0x1d44a4){var _0x20d3f6=this;return new Promise(function(_0x4ec7f2,_0x22bf3a){return db['WhatsappQueueReport']['create'](_0x1d44a4['body'],{'raw':_0x1d44a4[_0x8a7d('0x16')]?_0x1d44a4[_0x8a7d('0x16')][_0x8a7d('0x17')]===undefined?!![]:![]:!![]})[_0x8a7d('0xb')](function(_0x1333e5){logger[_0x8a7d('0xc')](_0x8a7d('0x15'),_0x1d44a4);logger[_0x8a7d('0xe')](_0x8a7d('0x15'),_0x1d44a4,JSON[_0x8a7d('0x10')](_0x1333e5));_0x4ec7f2(_0x1333e5);})[_0x8a7d('0x14')](function(_0x34d247){logger[_0x8a7d('0x11')]('CreateWhatsappQueueReport',_0x34d247[_0x8a7d('0x12')],_0x1d44a4);_0x22bf3a(_0x20d3f6['error'](0x1f4,_0x34d247[_0x8a7d('0x12')]));});});};exports[_0x8a7d('0x18')]=function(_0x12707b){var _0x213d4d=this;return new Promise(function(_0x5d4233,_0x16eeba){return db[_0x8a7d('0x19')][_0x8a7d('0x1a')](_0x12707b['body'],{'raw':_0x12707b[_0x8a7d('0x16')]?_0x12707b[_0x8a7d('0x16')][_0x8a7d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12707b[_0x8a7d('0x16')]?_0x12707b[_0x8a7d('0x16')][_0x8a7d('0x1b')]||null:null,'attributes':_0x12707b[_0x8a7d('0x16')]?_0x12707b[_0x8a7d('0x16')]['attributes']||null:null,'limit':_0x12707b[_0x8a7d('0x16')]?_0x12707b[_0x8a7d('0x16')]['limit']||null:null})['then'](function(_0x54dbbf){logger[_0x8a7d('0xc')](_0x8a7d('0x18'),_0x12707b);logger[_0x8a7d('0xe')]('UpdateWhatsappQueueReport',_0x12707b,JSON[_0x8a7d('0x10')](_0x54dbbf));_0x5d4233(_0x54dbbf);})['catch'](function(_0x24b211){logger[_0x8a7d('0x11')]('UpdateWhatsappQueueReport',_0x24b211[_0x8a7d('0x12')],_0x12707b);_0x16eeba(_0x213d4d[_0x8a7d('0x11')](0x1f4,_0x24b211[_0x8a7d('0x12')]));});});}; \ No newline at end of file +var _0x1845=['update','body','attributes','limit','UpdateWhatsappQueueReport','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw'];(function(_0x197dab,_0x42d8da){var _0xa24a56=function(_0x210d3a){while(--_0x210d3a){_0x197dab['push'](_0x197dab['shift']());}};_0xa24a56(++_0x42d8da);}(_0x1845,0x128));var _0x5184=function(_0x18fbc7,_0x8d43a){_0x18fbc7=_0x18fbc7-0x0;var _0xca4d34=_0x1845[_0x18fbc7];return _0xca4d34;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5184('0x0'));var BPromise=require(_0x5184('0x1'));var rs=require(_0x5184('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5184('0x3'))['db'];var utils=require(_0x5184('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5184('0x5'));var client=jayson[_0x5184('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xeab124,_0x1f0949,_0x16330d){return new BPromise(function(_0x1a9f8d,_0x5b02bc){return client[_0x5184('0x7')](_0xeab124,_0x16330d)[_0x5184('0x8')](function(_0x52fe64){logger[_0x5184('0x9')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1f0949,'request\x20sent');logger[_0x5184('0xa')](_0x5184('0xb'),_0x1f0949,_0x5184('0xc'),JSON['stringify'](_0x52fe64));if(_0x52fe64[_0x5184('0xd')]){if(_0x52fe64['error'][_0x5184('0xe')]===0x1f4){logger[_0x5184('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1f0949,_0x52fe64[_0x5184('0xd')][_0x5184('0xf')]);return _0x5b02bc(_0x52fe64['error'][_0x5184('0xf')]);}logger['error'](_0x5184('0x10'),_0x1f0949,_0x52fe64[_0x5184('0xd')][_0x5184('0xf')]);return _0x1a9f8d(_0x52fe64[_0x5184('0xd')][_0x5184('0xf')]);}else{logger[_0x5184('0x9')](_0x5184('0x10'),_0x1f0949,'request\x20sent');_0x1a9f8d(_0x52fe64['result'][_0x5184('0xf')]);}})[_0x5184('0x11')](function(_0x2cb42b){logger[_0x5184('0xd')](_0x5184('0x10'),_0x1f0949,_0x2cb42b);_0x5b02bc(_0x2cb42b);});});}exports[_0x5184('0x12')]=function(_0xcfe0c1){var _0x1c279a=this;return new Promise(function(_0x1c1b97,_0x3b5a3d){return db[_0x5184('0x13')][_0x5184('0x14')](_0xcfe0c1['body'],{'raw':_0xcfe0c1[_0x5184('0x15')]?_0xcfe0c1['options'][_0x5184('0x16')]===undefined?!![]:![]:!![]})[_0x5184('0x8')](function(_0x52c94a){logger[_0x5184('0x9')](_0x5184('0x12'),_0xcfe0c1);logger['debug'](_0x5184('0x12'),_0xcfe0c1,JSON['stringify'](_0x52c94a));_0x1c1b97(_0x52c94a);})[_0x5184('0x11')](function(_0x4f3bd2){logger[_0x5184('0xd')](_0x5184('0x12'),_0x4f3bd2['message'],_0xcfe0c1);_0x3b5a3d(_0x1c279a['error'](0x1f4,_0x4f3bd2[_0x5184('0xf')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1fb6e7){var _0x33afee=this;return new Promise(function(_0x4f46c6,_0x2f1823){return db[_0x5184('0x13')][_0x5184('0x17')](_0x1fb6e7[_0x5184('0x18')],{'raw':_0x1fb6e7[_0x5184('0x15')]?_0x1fb6e7['options'][_0x5184('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fb6e7[_0x5184('0x15')]?_0x1fb6e7[_0x5184('0x15')]['where']||null:null,'attributes':_0x1fb6e7['options']?_0x1fb6e7[_0x5184('0x15')][_0x5184('0x19')]||null:null,'limit':_0x1fb6e7[_0x5184('0x15')]?_0x1fb6e7[_0x5184('0x15')][_0x5184('0x1a')]||null:null})[_0x5184('0x8')](function(_0x56c097){logger['info'](_0x5184('0x1b'),_0x1fb6e7);logger[_0x5184('0xa')](_0x5184('0x1b'),_0x1fb6e7,JSON[_0x5184('0x1c')](_0x56c097));_0x4f46c6(_0x56c097);})[_0x5184('0x11')](function(_0x14bd4a){logger[_0x5184('0xd')](_0x5184('0x1b'),_0x14bd4a[_0x5184('0xf')],_0x1fb6e7);_0x2f1823(_0x33afee[_0x5184('0xd')](0x1f4,_0x14bd4a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index aad7be5..9dd5056 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 _0xf271=['show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x32746e,_0x32d5c3){var _0x585821=function(_0x2543ce){while(--_0x2543ce){_0x32746e['push'](_0x32746e['shift']());}};_0x585821(++_0x32d5c3);}(_0xf271,0x10b));var _0x1f27=function(_0x480193,_0x3e1ce7){_0x480193=_0x480193-0x0;var _0x3eb05f=_0xf271[_0x480193];return _0x3eb05f;};'use strict';var multer=require(_0x1f27('0x0'));var util=require('util');var path=require(_0x1f27('0x1'));var timeout=require(_0x1f27('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x1f27('0x3'));var interaction=require(_0x1f27('0x4'));var config=require(_0x1f27('0x5'));var controller=require(_0x1f27('0x6'));router[_0x1f27('0x7')]('/',auth[_0x1f27('0x8')](),controller[_0x1f27('0x9')]);router[_0x1f27('0x7')](_0x1f27('0xa'),auth[_0x1f27('0x8')](),controller[_0x1f27('0xb')]);router[_0x1f27('0x7')](_0x1f27('0xc'),auth[_0x1f27('0x8')](),controller[_0x1f27('0xd')]);router[_0x1f27('0xe')]('/',auth[_0x1f27('0x8')](),controller[_0x1f27('0xf')]);router[_0x1f27('0x10')]('/:id',auth[_0x1f27('0x8')](),controller['update']);router[_0x1f27('0x11')](_0x1f27('0xc'),auth[_0x1f27('0x8')](),controller[_0x1f27('0x12')]);module[_0x1f27('0x13')]=router; \ No newline at end of file +var _0xb0e5=['post','create','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','describe','get','/:id','show'];(function(_0x5e127b,_0x4dc0d1){var _0x4f46d2=function(_0x137ba7){while(--_0x137ba7){_0x5e127b['push'](_0x5e127b['shift']());}};_0x4f46d2(++_0x4dc0d1);}(_0xb0e5,0x1ad));var _0x5b0e=function(_0x2c56bb,_0x59bfc2){_0x2c56bb=_0x2c56bb-0x0;var _0x1479a9=_0xb0e5[_0x2c56bb];return _0x1479a9;};'use strict';var multer=require(_0x5b0e('0x0'));var util=require(_0x5b0e('0x1'));var path=require(_0x5b0e('0x2'));var timeout=require(_0x5b0e('0x3'));var express=require(_0x5b0e('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5b0e('0x5'));var config=require('../../config/environment');var controller=require(_0x5b0e('0x6'));router['get']('/',auth[_0x5b0e('0x7')](),controller[_0x5b0e('0x8')]);router['get']('/describe',auth[_0x5b0e('0x7')](),controller[_0x5b0e('0x9')]);router[_0x5b0e('0xa')](_0x5b0e('0xb'),auth[_0x5b0e('0x7')](),controller[_0x5b0e('0xc')]);router[_0x5b0e('0xd')]('/',auth[_0x5b0e('0x7')](),controller[_0x5b0e('0xe')]);router['put'](_0x5b0e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5b0e('0xf')](_0x5b0e('0xb'),auth[_0x5b0e('0x7')](),controller['destroy']);module[_0x5b0e('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index be8c8ef..3f0461d 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d7686,_0x5d11b1){_0x5d7686=_0x5d7686-0x0;var _0x408ab4=_0xb10b[_0x5d7686];return _0x408ab4;};'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 _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4d7379,_0x4b4e63){_0x4d7379=_0x4d7379-0x0;var _0x46d7cf=_0x0b0e[_0x4d7379];return _0x46d7cf;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 17940fe..9067959 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 _0x70da=['lodash','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','status','end','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','WhatsappTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','rawAttributes','length','options','find','catch','body','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x1fbafd,_0x1ba0a5){var _0x2ccceb=function(_0x1b71cf){while(--_0x1b71cf){_0x1fbafd['push'](_0x1fbafd['shift']());}};_0x2ccceb(++_0x1ba0a5);}(_0x70da,0x1a5));var _0xa70d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x70da[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require(_0xa70d('0x0'));var emlformat=require(_0xa70d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa70d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa70d('0x3'));var moment=require('moment');var BPromise=require(_0xa70d('0x4'));var Mustache=require(_0xa70d('0x5'));var util=require(_0xa70d('0x6'));var path=require(_0xa70d('0x7'));var sox=require(_0xa70d('0x8'));var csv=require(_0xa70d('0x9'));var ejs=require(_0xa70d('0xa'));var fs=require('fs');var _=require(_0xa70d('0xb'));var squel=require('squel');var crypto=require(_0xa70d('0xc'));var jsforce=require(_0xa70d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa70d('0x9'));var querystring=require(_0xa70d('0xe'));var Papa=require(_0xa70d('0xf'));var Redis=require(_0xa70d('0x10'));var authService=require(_0xa70d('0x11'));var qs=require(_0xa70d('0x12'));var as=require(_0xa70d('0x13'));var hardwareService=require(_0xa70d('0x14'));var logger=require(_0xa70d('0x15'))(_0xa70d('0x16'));var utils=require(_0xa70d('0x17'));var config=require(_0xa70d('0x18'));var db=require(_0xa70d('0x19'))['db'];function respondWithStatusCode(_0x398539,_0x1aad9d){_0x1aad9d=_0x1aad9d||0xcc;return function(_0x2ebe7f){if(_0x2ebe7f){return _0x398539['sendStatus'](_0x1aad9d);}return _0x398539[_0xa70d('0x1a')](_0x1aad9d)[_0xa70d('0x1b')]();};}function respondWithResult(_0x1128c1,_0x38032a){_0x38032a=_0x38032a||0xc8;return function(_0x510e93){if(_0x510e93){return _0x1128c1[_0xa70d('0x1a')](_0x38032a)['json'](_0x510e93);}};}function respondWithFilteredResult(_0x397060,_0x388a3d){return function(_0x29f865){if(_0x29f865){var _0x75a1f1=_0x29f865[_0xa70d('0x1c')],_0x384c17=_0x388a3d['offset'],_0x56dde5=_0x388a3d[_0xa70d('0x1d')]+_0x388a3d[_0xa70d('0x1e')],_0xf939e1;if(_0x56dde5>=_0x75a1f1){_0x56dde5=_0x75a1f1;_0xf939e1=0xc8;}else{_0xf939e1=0xce;}_0x397060['status'](_0xf939e1);return _0x397060['set'](_0xa70d('0x1f'),_0x384c17+'-'+_0x56dde5+'/'+_0x75a1f1)['json'](_0x29f865);}return null;};}function patchUpdates(_0x10888d){return function(_0x5b0e87){try{jsonpatch[_0xa70d('0x20')](_0x5b0e87,_0x10888d,!![]);}catch(_0x310403){return BPromise[_0xa70d('0x21')](_0x310403);}return _0x5b0e87[_0xa70d('0x22')]();};}function saveUpdates(_0x4a83c5,_0x48b5ce){return function(_0x6ce211){if(_0x6ce211){return _0x6ce211[_0xa70d('0x23')](_0x4a83c5)[_0xa70d('0x24')](function(_0x163c60){return _0x163c60;});}return null;};}function removeEntity(_0x410e3b,_0x3f04cd){return function(_0x421f5c){if(_0x421f5c){return _0x421f5c[_0xa70d('0x25')]()[_0xa70d('0x24')](function(){_0x410e3b[_0xa70d('0x1a')](0xcc)[_0xa70d('0x1b')]();});}};}function handleEntityNotFound(_0x16a6b9,_0x295787){return function(_0x51e14d){if(!_0x51e14d){_0x16a6b9[_0xa70d('0x26')](0x194);}return _0x51e14d;};}function handleError(_0x202851,_0x5af1b1){_0x5af1b1=_0x5af1b1||0x1f4;return function(_0x4cdf1f){logger['error'](_0x4cdf1f[_0xa70d('0x27')]);if(_0x4cdf1f[_0xa70d('0x28')]){delete _0x4cdf1f[_0xa70d('0x28')];}_0x202851[_0xa70d('0x1a')](_0x5af1b1)[_0xa70d('0x29')](_0x4cdf1f);};}exports['index']=function(_0x326743,_0x2450e5){var _0x7916ca={},_0x7efb3a={},_0x129576={'count':0x0,'rows':[]};var _0x193954=_['map'](db[_0xa70d('0x2a')]['rawAttributes'],function(_0x4960c1){return{'name':_0x4960c1[_0xa70d('0x2b')],'type':_0x4960c1[_0xa70d('0x2c')][_0xa70d('0x2d')]};});_0x7efb3a[_0xa70d('0x2e')]=_[_0xa70d('0x2f')](_0x193954,'name');_0x7efb3a[_0xa70d('0x30')]=_[_0xa70d('0x31')](_0x326743[_0xa70d('0x30')]);_0x7efb3a[_0xa70d('0x32')]=_[_0xa70d('0x33')](_0x7efb3a[_0xa70d('0x2e')],_0x7efb3a['query']);_0x7916ca[_0xa70d('0x34')]=_['intersection'](_0x7efb3a[_0xa70d('0x2e')],qs['fields'](_0x326743['query'][_0xa70d('0x35')]));_0x7916ca[_0xa70d('0x34')]=_0x7916ca[_0xa70d('0x34')]['length']?_0x7916ca[_0xa70d('0x34')]:_0x7efb3a[_0xa70d('0x2e')];if(!_0x326743['query'][_0xa70d('0x36')]('nolimit')){_0x7916ca[_0xa70d('0x1e')]=qs[_0xa70d('0x1e')](_0x326743[_0xa70d('0x30')][_0xa70d('0x1e')]);_0x7916ca['offset']=qs[_0xa70d('0x1d')](_0x326743[_0xa70d('0x30')][_0xa70d('0x1d')]);}_0x7916ca['order']=qs['sort'](_0x326743[_0xa70d('0x30')][_0xa70d('0x37')]);_0x7916ca[_0xa70d('0x38')]=qs['filters'](_[_0xa70d('0x39')](_0x326743[_0xa70d('0x30')],_0x7efb3a['filters']),_0x193954);if(_0x326743[_0xa70d('0x30')]['filter']){_0x7916ca[_0xa70d('0x38')]=_[_0xa70d('0x3a')](_0x7916ca['where'],{'$or':_[_0xa70d('0x2f')](_0x193954,function(_0x3df75d){if(_0x3df75d['type']!=='VIRTUAL'){var _0x4751e5={};_0x4751e5[_0x3df75d['name']]={'$like':'%'+_0x326743[_0xa70d('0x30')][_0xa70d('0x3b')]+'%'};return _0x4751e5;}})});}_0x7916ca=_[_0xa70d('0x3a')]({},_0x7916ca,_0x326743['options']);var _0x437ebf={'where':_0x7916ca[_0xa70d('0x38')]};return db[_0xa70d('0x2a')][_0xa70d('0x1c')](_0x437ebf)['then'](function(_0x1278d7){_0x129576[_0xa70d('0x1c')]=_0x1278d7;if(_0x326743[_0xa70d('0x30')][_0xa70d('0x3c')]){_0x7916ca[_0xa70d('0x3d')]=[{'all':!![]}];}return db[_0xa70d('0x2a')][_0xa70d('0x3e')](_0x7916ca);})[_0xa70d('0x24')](function(_0x332b14){_0x129576[_0xa70d('0x3f')]=_0x332b14;return _0x129576;})[_0xa70d('0x24')](respondWithFilteredResult(_0x2450e5,_0x7916ca))['catch'](handleError(_0x2450e5,null));};exports[_0xa70d('0x40')]=function(_0x1d0395,_0x29242a){var _0x24a635={'raw':!![],'where':{'id':_0x1d0395['params']['id']}},_0x347ed9={};_0x347ed9[_0xa70d('0x2e')]=_[_0xa70d('0x31')](db['WhatsappTransferReport'][_0xa70d('0x41')]);_0x347ed9[_0xa70d('0x30')]=_[_0xa70d('0x31')](_0x1d0395[_0xa70d('0x30')]);_0x347ed9[_0xa70d('0x32')]=_['intersection'](_0x347ed9[_0xa70d('0x2e')],_0x347ed9[_0xa70d('0x30')]);_0x24a635[_0xa70d('0x34')]=_[_0xa70d('0x33')](_0x347ed9[_0xa70d('0x2e')],qs[_0xa70d('0x35')](_0x1d0395['query']['fields']));_0x24a635[_0xa70d('0x34')]=_0x24a635[_0xa70d('0x34')][_0xa70d('0x42')]?_0x24a635['attributes']:_0x347ed9[_0xa70d('0x2e')];if(_0x1d0395['query']['includeAll']){_0x24a635[_0xa70d('0x3d')]=[{'all':!![]}];}_0x24a635=_[_0xa70d('0x3a')]({},_0x24a635,_0x1d0395[_0xa70d('0x43')]);return db[_0xa70d('0x2a')][_0xa70d('0x44')](_0x24a635)[_0xa70d('0x24')](handleEntityNotFound(_0x29242a,null))[_0xa70d('0x24')](respondWithResult(_0x29242a,null))[_0xa70d('0x45')](handleError(_0x29242a,null));};exports['create']=function(_0x2d7137,_0x48fde5){return db[_0xa70d('0x2a')]['create'](_0x2d7137['body'],{})[_0xa70d('0x24')](respondWithResult(_0x48fde5,0xc9))[_0xa70d('0x45')](handleError(_0x48fde5,null));};exports['update']=function(_0x32f960,_0x53323d){if(_0x32f960[_0xa70d('0x46')]['id']){delete _0x32f960[_0xa70d('0x46')]['id'];}return db[_0xa70d('0x2a')][_0xa70d('0x44')]({'where':{'id':_0x32f960['params']['id']}})[_0xa70d('0x24')](handleEntityNotFound(_0x53323d,null))[_0xa70d('0x24')](saveUpdates(_0x32f960[_0xa70d('0x46')],null))[_0xa70d('0x24')](respondWithResult(_0x53323d,null))['catch'](handleError(_0x53323d,null));};exports[_0xa70d('0x25')]=function(_0x504476,_0x2c6158){return db[_0xa70d('0x2a')][_0xa70d('0x44')]({'where':{'id':_0x504476['params']['id']}})[_0xa70d('0x24')](handleEntityNotFound(_0x2c6158,null))[_0xa70d('0x24')](removeEntity(_0x2c6158,null))[_0xa70d('0x45')](handleError(_0x2c6158,null));};exports['describe']=function(_0x2c04a9,_0x413ae6){return db[_0xa70d('0x2a')][_0xa70d('0x47')]()[_0xa70d('0x24')](respondWithResult(_0x413ae6,null))[_0xa70d('0x45')](handleError(_0x413ae6,null));}; \ No newline at end of file +var _0x7114=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','include','rows','catch','params','includeAll','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type'];(function(_0x5a8484,_0x467a59){var _0x49af1e=function(_0x32ca85){while(--_0x32ca85){_0x5a8484['push'](_0x5a8484['shift']());}};_0x49af1e(++_0x467a59);}(_0x7114,0xab));var _0x4711=function(_0x482b63,_0x1d2869){_0x482b63=_0x482b63-0x0;var _0x20a0ff=_0x7114[_0x482b63];return _0x20a0ff;};'use strict';var pdf=require(_0x4711('0x0'));var emlformat=require(_0x4711('0x1'));var rimraf=require(_0x4711('0x2'));var zipdir=require(_0x4711('0x3'));var jsonpatch=require(_0x4711('0x4'));var rp=require('request-promise');var moment=require(_0x4711('0x5'));var BPromise=require(_0x4711('0x6'));var Mustache=require(_0x4711('0x7'));var util=require(_0x4711('0x8'));var path=require(_0x4711('0x9'));var sox=require(_0x4711('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4711('0xb'));var crypto=require(_0x4711('0xc'));var jsforce=require(_0x4711('0xd'));var deskjs=require(_0x4711('0xe'));var toCsv=require(_0x4711('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4711('0x10'));var qs=require(_0x4711('0x11'));var as=require(_0x4711('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4711('0x13'))(_0x4711('0x14'));var utils=require(_0x4711('0x15'));var config=require(_0x4711('0x16'));var db=require(_0x4711('0x17'))['db'];function respondWithStatusCode(_0x364d91,_0x319733){_0x319733=_0x319733||0xcc;return function(_0x34161d){if(_0x34161d){return _0x364d91[_0x4711('0x18')](_0x319733);}return _0x364d91[_0x4711('0x19')](_0x319733)['end']();};}function respondWithResult(_0x3f326d,_0x21bc30){_0x21bc30=_0x21bc30||0xc8;return function(_0x866acd){if(_0x866acd){return _0x3f326d[_0x4711('0x19')](_0x21bc30)[_0x4711('0x1a')](_0x866acd);}};}function respondWithFilteredResult(_0x4b9d8c,_0x5b279f){return function(_0x18c487){if(_0x18c487){var _0x380858=_0x18c487[_0x4711('0x1b')],_0x4793b7=_0x5b279f[_0x4711('0x1c')],_0x9e931b=_0x5b279f[_0x4711('0x1c')]+_0x5b279f[_0x4711('0x1d')],_0x127ec7;if(_0x9e931b>=_0x380858){_0x9e931b=_0x380858;_0x127ec7=0xc8;}else{_0x127ec7=0xce;}_0x4b9d8c['status'](_0x127ec7);return _0x4b9d8c[_0x4711('0x1e')](_0x4711('0x1f'),_0x4793b7+'-'+_0x9e931b+'/'+_0x380858)[_0x4711('0x1a')](_0x18c487);}return null;};}function patchUpdates(_0x14f0eb){return function(_0x182b5c){try{jsonpatch[_0x4711('0x20')](_0x182b5c,_0x14f0eb,!![]);}catch(_0x1ab792){return BPromise[_0x4711('0x21')](_0x1ab792);}return _0x182b5c[_0x4711('0x22')]();};}function saveUpdates(_0x383356,_0x31f6c1){return function(_0x449102){if(_0x449102){return _0x449102[_0x4711('0x23')](_0x383356)[_0x4711('0x24')](function(_0xd1f8b4){return _0xd1f8b4;});}return null;};}function removeEntity(_0x189d50,_0x30667c){return function(_0x57d0f4){if(_0x57d0f4){return _0x57d0f4['destroy']()[_0x4711('0x24')](function(){_0x189d50[_0x4711('0x19')](0xcc)[_0x4711('0x25')]();});}};}function handleEntityNotFound(_0x2eac6c,_0x1d39b4){return function(_0x3f4239){if(!_0x3f4239){_0x2eac6c['sendStatus'](0x194);}return _0x3f4239;};}function handleError(_0x523cd4,_0xa3d871){_0xa3d871=_0xa3d871||0x1f4;return function(_0x193fa0){logger[_0x4711('0x26')](_0x193fa0[_0x4711('0x27')]);if(_0x193fa0[_0x4711('0x28')]){delete _0x193fa0[_0x4711('0x28')];}_0x523cd4['status'](_0xa3d871)[_0x4711('0x29')](_0x193fa0);};}exports[_0x4711('0x2a')]=function(_0x30a097,_0x54f02a){var _0x327096={},_0x95de13={},_0x17e5a6={'count':0x0,'rows':[]};var _0x31d7c6=_[_0x4711('0x2b')](db[_0x4711('0x2c')][_0x4711('0x2d')],function(_0x929b){return{'name':_0x929b[_0x4711('0x2e')],'type':_0x929b[_0x4711('0x2f')]['key']};});_0x95de13[_0x4711('0x30')]=_[_0x4711('0x2b')](_0x31d7c6,_0x4711('0x28'));_0x95de13[_0x4711('0x31')]=_[_0x4711('0x32')](_0x30a097[_0x4711('0x31')]);_0x95de13['filters']=_[_0x4711('0x33')](_0x95de13[_0x4711('0x30')],_0x95de13[_0x4711('0x31')]);_0x327096[_0x4711('0x34')]=_[_0x4711('0x33')](_0x95de13[_0x4711('0x30')],qs[_0x4711('0x35')](_0x30a097['query'][_0x4711('0x35')]));_0x327096[_0x4711('0x34')]=_0x327096[_0x4711('0x34')][_0x4711('0x36')]?_0x327096[_0x4711('0x34')]:_0x95de13[_0x4711('0x30')];if(!_0x30a097[_0x4711('0x31')][_0x4711('0x37')]('nolimit')){_0x327096[_0x4711('0x1d')]=qs[_0x4711('0x1d')](_0x30a097[_0x4711('0x31')][_0x4711('0x1d')]);_0x327096[_0x4711('0x1c')]=qs[_0x4711('0x1c')](_0x30a097[_0x4711('0x31')][_0x4711('0x1c')]);}_0x327096[_0x4711('0x38')]=qs['sort'](_0x30a097['query'][_0x4711('0x39')]);_0x327096[_0x4711('0x3a')]=qs['filters'](_['pick'](_0x30a097[_0x4711('0x31')],_0x95de13[_0x4711('0x3b')]),_0x31d7c6);if(_0x30a097['query'][_0x4711('0x3c')]){_0x327096['where']=_[_0x4711('0x3d')](_0x327096[_0x4711('0x3a')],{'$or':_['map'](_0x31d7c6,function(_0x46eb3b){if(_0x46eb3b[_0x4711('0x2f')]!=='VIRTUAL'){var _0x403352={};_0x403352[_0x46eb3b[_0x4711('0x28')]]={'$like':'%'+_0x30a097[_0x4711('0x31')]['filter']+'%'};return _0x403352;}})});}_0x327096=_['merge']({},_0x327096,_0x30a097[_0x4711('0x3e')]);var _0x15c118={'where':_0x327096[_0x4711('0x3a')]};return db['WhatsappTransferReport'][_0x4711('0x1b')](_0x15c118)[_0x4711('0x24')](function(_0x268545){_0x17e5a6[_0x4711('0x1b')]=_0x268545;if(_0x30a097[_0x4711('0x31')]['includeAll']){_0x327096[_0x4711('0x3f')]=[{'all':!![]}];}return db[_0x4711('0x2c')]['findAll'](_0x327096);})['then'](function(_0x1e5096){_0x17e5a6[_0x4711('0x40')]=_0x1e5096;return _0x17e5a6;})[_0x4711('0x24')](respondWithFilteredResult(_0x54f02a,_0x327096))[_0x4711('0x41')](handleError(_0x54f02a,null));};exports['show']=function(_0x10dbdf,_0x241eb8){var _0x1cafa9={'raw':!![],'where':{'id':_0x10dbdf[_0x4711('0x42')]['id']}},_0x1ac38a={};_0x1ac38a[_0x4711('0x30')]=_[_0x4711('0x32')](db['WhatsappTransferReport']['rawAttributes']);_0x1ac38a[_0x4711('0x31')]=_[_0x4711('0x32')](_0x10dbdf[_0x4711('0x31')]);_0x1ac38a[_0x4711('0x3b')]=_['intersection'](_0x1ac38a['model'],_0x1ac38a[_0x4711('0x31')]);_0x1cafa9[_0x4711('0x34')]=_['intersection'](_0x1ac38a[_0x4711('0x30')],qs[_0x4711('0x35')](_0x10dbdf[_0x4711('0x31')]['fields']));_0x1cafa9[_0x4711('0x34')]=_0x1cafa9[_0x4711('0x34')][_0x4711('0x36')]?_0x1cafa9[_0x4711('0x34')]:_0x1ac38a['model'];if(_0x10dbdf[_0x4711('0x31')][_0x4711('0x43')]){_0x1cafa9['include']=[{'all':!![]}];}_0x1cafa9=_[_0x4711('0x3d')]({},_0x1cafa9,_0x10dbdf[_0x4711('0x3e')]);return db[_0x4711('0x2c')][_0x4711('0x44')](_0x1cafa9)['then'](handleEntityNotFound(_0x241eb8,null))['then'](respondWithResult(_0x241eb8,null))[_0x4711('0x41')](handleError(_0x241eb8,null));};exports[_0x4711('0x45')]=function(_0x4627dc,_0x154c39){return db[_0x4711('0x2c')]['create'](_0x4627dc[_0x4711('0x46')],{})['then'](respondWithResult(_0x154c39,0xc9))[_0x4711('0x41')](handleError(_0x154c39,null));};exports['update']=function(_0x19a255,_0x45bf29){if(_0x19a255[_0x4711('0x46')]['id']){delete _0x19a255[_0x4711('0x46')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x19a255[_0x4711('0x42')]['id']}})[_0x4711('0x24')](handleEntityNotFound(_0x45bf29,null))[_0x4711('0x24')](saveUpdates(_0x19a255[_0x4711('0x46')],null))[_0x4711('0x24')](respondWithResult(_0x45bf29,null))[_0x4711('0x41')](handleError(_0x45bf29,null));};exports[_0x4711('0x47')]=function(_0x203a7a,_0x28dca6){return db[_0x4711('0x2c')][_0x4711('0x44')]({'where':{'id':_0x203a7a[_0x4711('0x42')]['id']}})[_0x4711('0x24')](handleEntityNotFound(_0x28dca6,null))[_0x4711('0x24')](removeEntity(_0x28dca6,null))[_0x4711('0x41')](handleError(_0x28dca6,null));};exports[_0x4711('0x48')]=function(_0x2b9e44,_0x3d2a68){return db['WhatsappTransferReport'][_0x4711('0x48')]()[_0x4711('0x24')](respondWithResult(_0x3d2a68,null))[_0x4711('0x41')](handleError(_0x3d2a68,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 9dcf81e..b8b8468 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 _0x7b54=['./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x981700,_0x34e289){var _0x2319eb=function(_0x1e63b5){while(--_0x1e63b5){_0x981700['push'](_0x981700['shift']());}};_0x2319eb(++_0x34e289);}(_0x7b54,0x1cb));var _0x47b5=function(_0x983dc2,_0x5cca11){_0x983dc2=_0x983dc2-0x0;var _0x4b0315=_0x7b54[_0x983dc2];return _0x4b0315;};'use strict';var _=require('lodash');var util=require(_0x47b5('0x0'));var logger=require(_0x47b5('0x1'))(_0x47b5('0x2'));var moment=require(_0x47b5('0x3'));var BPromise=require(_0x47b5('0x4'));var rp=require(_0x47b5('0x5'));var fs=require('fs');var path=require(_0x47b5('0x6'));var rimraf=require(_0x47b5('0x7'));var config=require(_0x47b5('0x8'));var attributes=require(_0x47b5('0x9'));module[_0x47b5('0xa')]=function(_0x70477f,_0x39cd3d){return _0x70477f['define'](_0x47b5('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x47b5('0xc'),'fields':[_0x47b5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2bc=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x5b6b43,_0x5fd9d7){var _0x3ac8c4=function(_0x259629){while(--_0x259629){_0x5b6b43['push'](_0x5b6b43['shift']());}};_0x3ac8c4(++_0x5fd9d7);}(_0xe2bc,0x1ec));var _0xce2b=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xe2bc[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0xce2b('0x0'));var util=require(_0xce2b('0x1'));var logger=require(_0xce2b('0x2'))('api');var moment=require(_0xce2b('0x3'));var BPromise=require(_0xce2b('0x4'));var rp=require(_0xce2b('0x5'));var fs=require('fs');var path=require(_0xce2b('0x6'));var rimraf=require(_0xce2b('0x7'));var config=require(_0xce2b('0x8'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x10f5eb,_0x1bb814){return _0x10f5eb[_0xce2b('0x9')](_0xce2b('0xa'),attributes,{'tableName':_0xce2b('0xb'),'paranoid':![],'indexes':[{'name':_0xce2b('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 8aaef6d..6cf8d1f 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(_0x12abfd,_0x8d19b9){var _0x1c6d24=function(_0x503373){while(--_0x503373){_0x12abfd['push'](_0x12abfd['shift']());}};_0x1c6d24(++_0x8d19b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x49c24b,_0x227abe){var _0x385b6d=function(_0x4b3a95){while(--_0x4b3a95){_0x49c24b['push'](_0x49c24b['shift']());}};_0x385b6d(++_0x227abe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 65ba516..d2c2bed 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6a0=['join','status','None','seedDB','default','catch','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2/config','./config/schedule','sync','then','listen','info','start','Online\x20apps:','map','online','name'];(function(_0x5d6814,_0x1dfdc5){var _0x271a00=function(_0xf9c87c){while(--_0xf9c87c){_0x5d6814['push'](_0x5d6814['shift']());}};_0x271a00(++_0x1dfdc5);}(_0xc6a0,0x1d0));var _0x0c6a=function(_0x1af902,_0x222f11){_0x1af902=_0x1af902-0x0;var _0x4dd69d=_0xc6a0[_0x1af902];return _0x4dd69d;};'use strict';var _=require(_0x0c6a('0x0'));var mysqldb=require(_0x0c6a('0x1'));var rpc=require(_0x0c6a('0x2'));var config=require(_0x0c6a('0x3'));var logger=require(_0x0c6a('0x4'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x0c6a('0x5'));var schedule=require(_0x0c6a('0x6'));var chat=require('./config/schedule/chat');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0x0c6a('0x7')]()[_0x0c6a('0x8')](function(){return rpc[_0x0c6a('0x9')]();})[_0x0c6a('0x8')](function(_0x409240){logger[_0x0c6a('0xa')](_0x409240);return chat[_0x0c6a('0xb')]();})[_0x0c6a('0x8')](function(){return schedule[_0x0c6a('0xb')]();})[_0x0c6a('0x8')](function(){return transcribe['start']();})[_0x0c6a('0x8')](function(_0x3b54de){logger[_0x0c6a('0xa')](_0x3b54de);return pm2[_0x0c6a('0xb')](pm2Config);})[_0x0c6a('0x8')](function(_0x4cdf8e){logger[_0x0c6a('0xa')](_0x0c6a('0xc'),_[_0x0c6a('0xd')](_['filter'](_0x4cdf8e,{'status':_0x0c6a('0xe')}),_0x0c6a('0xf'))[_0x0c6a('0x10')]());logger['info']('Offline\x20apps:',_[_0x0c6a('0xd')](_['filter'](_0x4cdf8e,function(_0x23cf26){return _0x23cf26[_0x0c6a('0x11')]!==_0x0c6a('0xe');}),'name')[_0x0c6a('0x10')]()||_0x0c6a('0x12'));config[_0x0c6a('0x13')]&&require('./config/seedDB')[_0x0c6a('0x14')]();require('./config/license')[_0x0c6a('0x14')]();})[_0x0c6a('0x15')](function(_0x17be07){logger[_0x0c6a('0x16')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x17be07);process[_0x0c6a('0x17')](0x1);});}main(); \ No newline at end of file +var _0xe22c=['listen','info','start','Online\x20apps:','map','name','join','filter','status','online','None','seedDB','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then'];(function(_0x1eb66e,_0x18d805){var _0x2b198d=function(_0x5a1bb9){while(--_0x5a1bb9){_0x1eb66e['push'](_0x1eb66e['shift']());}};_0x2b198d(++_0x18d805);}(_0xe22c,0x102));var _0xce22=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe22c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xce22('0x0'));var mysqldb=require(_0xce22('0x1'));var rpc=require('./rpc');var config=require(_0xce22('0x2'));var logger=require(_0xce22('0x3'))(_0xce22('0x4'));var pm2=require(_0xce22('0x5'));var pm2Config=require(_0xce22('0x6'));var schedule=require(_0xce22('0x7'));var chat=require(_0xce22('0x8'));var transcribe=require(_0xce22('0x9'));function main(){return mysqldb['db'][_0xce22('0xa')]['sync']()[_0xce22('0xb')](function(){return rpc[_0xce22('0xc')]();})[_0xce22('0xb')](function(_0x4e8120){logger[_0xce22('0xd')](_0x4e8120);return chat[_0xce22('0xe')]();})[_0xce22('0xb')](function(){return schedule[_0xce22('0xe')]();})[_0xce22('0xb')](function(){return transcribe[_0xce22('0xe')]();})[_0xce22('0xb')](function(_0x321c37){logger[_0xce22('0xd')](_0x321c37);return pm2[_0xce22('0xe')](pm2Config);})[_0xce22('0xb')](function(_0x2e6380){logger['info'](_0xce22('0xf'),_[_0xce22('0x10')](_['filter'](_0x2e6380,{'status':'online'}),_0xce22('0x11'))[_0xce22('0x12')]());logger[_0xce22('0xd')]('Offline\x20apps:',_[_0xce22('0x10')](_[_0xce22('0x13')](_0x2e6380,function(_0x25f8bd){return _0x25f8bd[_0xce22('0x14')]!==_0xce22('0x15');}),_0xce22('0x11'))[_0xce22('0x12')]()||_0xce22('0x16'));config[_0xce22('0x17')]&&require('./config/seedDB')['default']();require('./config/license')[_0xce22('0x18')]();})[_0xce22('0x19')](function(_0x1b572a){logger['error'](_0xce22('0x1a'),_0x1b572a);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a197830..bda8094 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 _0xeb92=['regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','payload','verify','toString','now','../../config/environment','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','internal','email','md5secret','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','use','authorization','startsWith','headers','Basic','User','find','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','../../config/license/util','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xeb92,0xc3));var _0x2eb9=function(_0xbb3c7b,_0x5749da){_0xbb3c7b=_0xbb3c7b-0x0;var _0x140f19=_0xeb92[_0xbb3c7b];return _0x140f19;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x2eb9('0x0'));var hardwareConf=require('../../config/license/hardware');var _=require('lodash');var jwt=require(_0x2eb9('0x1'));var expressJwt=require('express-jwt');var compose=require(_0x2eb9('0x2'));var basicAuth=require(_0x2eb9('0x3'));var crypto=require(_0x2eb9('0x4'));var BPromise=require(_0x2eb9('0x5'));var validateJwt=expressJwt({'secret':config[_0x2eb9('0x6')][_0x2eb9('0x7')]});var userAttributes=['id',_0x2eb9('0x8'),_0x2eb9('0x9'),_0x2eb9('0xa'),_0x2eb9('0xb'),_0x2eb9('0xc'),'userpic','permissions',_0x2eb9('0xd'),'voicePause',_0x2eb9('0xe'),_0x2eb9('0xf'),'faxPause',_0x2eb9('0x10'),_0x2eb9('0x11'),_0x2eb9('0x12'),_0x2eb9('0x13'),_0x2eb9('0x14'),_0x2eb9('0x15'),_0x2eb9('0x16'),_0x2eb9('0x17'),_0x2eb9('0x18'),'alias',_0x2eb9('0x19'),'phoneBarAutoAnswerDelay',_0x2eb9('0x1a'),_0x2eb9('0x1b'),_0x2eb9('0x1c'),_0x2eb9('0x1d'),'phoneBarExpires',_0x2eb9('0x1e'),_0x2eb9('0x1f'),_0x2eb9('0x20'),_0x2eb9('0x21'),_0x2eb9('0x22'),_0x2eb9('0x23')];exports[_0x2eb9('0x24')]=function(){return this[_0x2eb9('0x25')](!![])['use'](function(_0x34994a,_0x17f99f,_0x5c8a06){if(_0x34994a[_0x2eb9('0x26')]){_0x5c8a06();}else{return db[_0x2eb9('0x27')][_0x2eb9('0x28')]({'where':{'id':_0x34994a[_0x2eb9('0x29')]['id']},'attributes':['id',_0x2eb9('0x2a'),_0x2eb9('0x2b')],'raw':!![]})[_0x2eb9('0x2c')](function(_0x33f5f8){if(_0x33f5f8&&_0x33f5f8[_0x2eb9('0x2a')]){return _0x17f99f['status'](_0x33f5f8['disposition']===_0x2eb9('0x2d')?0x195:0x193)[_0x2eb9('0x2e')]({'message':_0x33f5f8[_0x2eb9('0x2b')]===_0x2eb9('0x2d')?_0x2eb9('0x2f'):_0x2eb9('0x30')});}else{_0x5c8a06();}})[_0x2eb9('0x31')](function(_0x1c2f51){_0x5c8a06(_0x1c2f51);});}});};exports['isAuthenticated']=function isAuthenticated(_0x108c1c){return compose()[_0x2eb9('0x32')](function(_0x3cd5de,_0xfacf6a,_0x31cf9a){if(_0x3cd5de['headers'][_0x2eb9('0x33')]){if(_[_0x2eb9('0x34')](_0x3cd5de[_0x2eb9('0x35')][_0x2eb9('0x33')],_0x2eb9('0x36'))){var _0x40796d=basicAuth(_0x3cd5de);db[_0x2eb9('0x37')][_0x2eb9('0x38')]({'where':{'name':_0x40796d[_0x2eb9('0xa')]}})[_0x2eb9('0x2c')](function(_0x2c1e66){if(!_0x2c1e66||!_0x2c1e66['authenticate'](_0x40796d[_0x2eb9('0x39')])){return _0xfacf6a[_0x2eb9('0x3a')](0x191)['json']({'message':_0x2eb9('0x3b')});}_0x3cd5de[_0x2eb9('0x26')]={'id':_0x2c1e66['id']};_0x31cf9a();})[_0x2eb9('0x31')](function(_0x431f16){_0x31cf9a(_0x431f16);});}else if(_[_0x2eb9('0x34')](_0x3cd5de[_0x2eb9('0x35')][_0x2eb9('0x33')],_0x2eb9('0x3c'))){validateJwt(_0x3cd5de,_0xfacf6a,_0x31cf9a);}else{if(_0x108c1c){_0x31cf9a();}else{return _0xfacf6a[_0x2eb9('0x3a')](0x193)[_0x2eb9('0x2e')]({'message':_0x2eb9('0x3d')});}}}else if(_0x3cd5de[_0x2eb9('0x3e')][_0x2eb9('0x3f')]){try{var _0x5de545={'audience':hardwareConf[_0x2eb9('0x40')](),'issuer':hardwareConf[_0x2eb9('0x40')]()};verifyJwt(_0x3cd5de[_0x2eb9('0x3e')][_0x2eb9('0x3f')],_0x5de545)[_0x2eb9('0x2c')](function(_0x1846ac){return db['User']['find']({'where':{'id':_0x1846ac[_0x2eb9('0x41')]}})[_0x2eb9('0x2c')](function(_0x36fb0a){if(!_0x36fb0a||!_[_0x2eb9('0x42')](_0x36fb0a[_0x2eb9('0x43')],_0x1846ac[_0x2eb9('0x44')])){return _0xfacf6a[_0x2eb9('0x3a')](0x191)[_0x2eb9('0x2e')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x3cd5de[_0x2eb9('0x26')]={'id':_0x36fb0a['id']};_0x31cf9a();});})['catch'](function(){return _0xfacf6a[_0x2eb9('0x3a')](0x191)[_0x2eb9('0x2e')]({'message':_0x2eb9('0x45')});});}catch(_0x4cd9a0){_0x31cf9a(_0x4cd9a0);}}else if(_0x108c1c){_0x31cf9a();}else{return _0xfacf6a['status'](0x193)[_0x2eb9('0x2e')]({'message':_0x2eb9('0x3d')});}})['use'](function(_0x3d0419,_0x10d6a8,_0x189766){if(_0x3d0419[_0x2eb9('0x26')]){db[_0x2eb9('0x37')][_0x2eb9('0x38')]({'where':{'id':_0x3d0419['user']['id']},'attributes':userAttributes})[_0x2eb9('0x2c')](function(_0x11bdc4){if(!_0x11bdc4){return _0x10d6a8['status'](0x194)[_0x2eb9('0x2e')]({'message':_0x2eb9('0x46')});}_0x3d0419[_0x2eb9('0x26')]=_0x11bdc4;_0x189766();})[_0x2eb9('0x31')](function(_0x23e581){_0x189766(_0x23e581);});}else if(_0x108c1c){_0x189766();}else{return _0x10d6a8[_0x2eb9('0x3a')](0x194)[_0x2eb9('0x2e')]({'message':_0x2eb9('0x47')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x2eb9('0x32')](function(_0x2c4b10,_0x466a8d,_0x5c779d){return require(_0x2eb9('0x48'))['getLicense']()[_0x2eb9('0x2c')](function(_0x3e7e86){if(_0x3e7e86['update']){_0x5c779d();}else{return _0x466a8d['status'](0x193)[_0x2eb9('0x2e')]({'message':'Forbidden'});}})[_0x2eb9('0x31')](function(_0xf727de){_0x5c779d(_0xf727de);});});};exports['isMiddleware']=function(_0x5c45f2,_0x5d8aaa,_0x209c4c){_0x5c45f2[_0x2eb9('0x49')]=!![];return _0x209c4c();};exports[_0x2eb9('0x4a')]=function signToken(_0x351dad){return signJwt(_0x351dad);};exports[_0x2eb9('0x4b')]=function(_0xa3be0e,_0x11c4d0){if(!_0xa3be0e[_0x2eb9('0x26')]){return _0x11c4d0['status'](0x194)['json']({'message':_0x2eb9('0x4c')});}var _0x322c9e={'payload':{'id':_0xa3be0e[_0x2eb9('0x26')]['id'],'role':_0xa3be0e[_0x2eb9('0x26')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x322c9e)['then'](function(_0x3fb458){_0x11c4d0[_0x2eb9('0x4d')](_0x2eb9('0x4e'),_0x3fb458);_0x11c4d0[_0x2eb9('0x4f')](_0x2eb9('0x50'));})['catch'](function(_0xd49bcf){return _0x11c4d0['status'](0x1f4)[_0x2eb9('0x51')](_0xd49bcf);});};exports[_0x2eb9('0x52')]=function(_0x235f05){if(_['isNil'](_0x235f05[_0x2eb9('0x43')])||_['isNil'](_0x235f05['apiKeyIat'])){return null;}else{return createJwt(_0x235f05);}};exports['generateApiKey']=function(_0x376da1){_0x376da1[_0x2eb9('0x43')]=generateNonce();_0x376da1[_0x2eb9('0x53')]=generateIssuedAt();return createJwt(_0x376da1);};exports[_0x2eb9('0x54')]=function(_0x52dccd,_0x3e306d){var _0x10ba05=_0x52dccd['query'][_0x2eb9('0x3f')];if(_0x10ba05){var _0x329b97={'nonce':_0x3e306d[_0x2eb9('0x43')],'iat':_0x3e306d[_0x2eb9('0x53')],'audience':hardwareConf[_0x2eb9('0x40')](),'issuer':hardwareConf[_0x2eb9('0x40')]()};return verifyJwt(_0x10ba05,_0x329b97)[_0x2eb9('0x2c')](function(){return generateApiKey(_0x3e306d);});}else{throw{'message':_0x2eb9('0x55')};}};function signJwt(_0x5b2f26){var _0x115e52=BPromise[_0x2eb9('0x56')](jwt[_0x2eb9('0x57')],{'context':jwt});var _0x4c71f4=_0x5b2f26[_0x2eb9('0x58')]||config[_0x2eb9('0x6')]['session'];return new BPromise(function(_0x13eb7a,_0x54b3e2){_0x115e52(_0x5b2f26[_0x2eb9('0x59')],_0x4c71f4,_0x5b2f26['options'])['then'](function(_0x379dd1){_0x13eb7a(_0x379dd1);})[_0x2eb9('0x31')](function(_0x20fafa){_0x54b3e2(_0x20fafa);});});}function verifyJwt(_0x2d762a,_0x687b23,_0x41e375){var _0x46d341=BPromise[_0x2eb9('0x56')](jwt[_0x2eb9('0x5a')],{'context':jwt});var _0x55cd4b=_0x41e375||config[_0x2eb9('0x6')][_0x2eb9('0x7')];return new BPromise(function(_0xb03ce8,_0x135af8){_0x46d341(_0x2d762a,_0x55cd4b,_0x687b23)['then'](function(_0x3e4b86){_0xb03ce8(_0x3e4b86);})['catch'](function(_0x11250c){_0x135af8(_0x11250c);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x2eb9('0x5b')]('hex');}function generateIssuedAt(){return Math['floor'](Date[_0x2eb9('0x5c')]()/0x3e8)[_0x2eb9('0x5b')]();}function createJwt(_0x14348f){var _0x44258b={'payload':{'iat':_0x14348f[_0x2eb9('0x53')],'nonce':_0x14348f[_0x2eb9('0x43')]},'options':{'algorithm':'HS512','subject':_0x14348f['id'][_0x2eb9('0x5b')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x44258b)['then'](function(_0x552851){return{'iat':_0x14348f['apiKeyIat'],'nonce':_0x14348f['apiKeyNonce'],'token':_0x552851};});} \ No newline at end of file +var _0xa930=['signToken','setTokenCookie','motion.token','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','lodash','jsonwebtoken','express-jwt','composable-middleware','bluebird','secrets','session','role','fullname','name','internal','email','userpic','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','then','status','disposition','json','Unmanaged.','Forbidden.','catch','headers','authorization','Basic','User','find','authenticate','pass','Wrong\x20credentials.','startsWith','Bearer','query','apikey','getUuid','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware'];(function(_0x6ae11,_0x545fae){var _0x480623=function(_0xfd865f){while(--_0xfd865f){_0x6ae11['push'](_0x6ae11['shift']());}};_0x480623(++_0x545fae);}(_0xa930,0x73));var _0x0a93=function(_0x4e4e28,_0x346cd1){_0x4e4e28=_0x4e4e28-0x0;var _0x3bfeff=_0xa930[_0x4e4e28];return _0x3bfeff;};'use strict';var db=require(_0x0a93('0x0'))['db'];var config=require(_0x0a93('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require(_0x0a93('0x2'));var jwt=require(_0x0a93('0x3'));var expressJwt=require(_0x0a93('0x4'));var compose=require(_0x0a93('0x5'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x0a93('0x6'));var validateJwt=expressJwt({'secret':config[_0x0a93('0x7')][_0x0a93('0x8')]});var userAttributes=['id',_0x0a93('0x9'),_0x0a93('0xa'),_0x0a93('0xb'),_0x0a93('0xc'),_0x0a93('0xd'),_0x0a93('0xe'),'permissions','md5secret',_0x0a93('0xf'),_0x0a93('0x10'),_0x0a93('0x11'),_0x0a93('0x12'),_0x0a93('0x13'),_0x0a93('0x14'),_0x0a93('0x15'),_0x0a93('0x16'),_0x0a93('0x17'),'lastPauseAt',_0x0a93('0x18'),_0x0a93('0x19'),_0x0a93('0x1a'),_0x0a93('0x1b'),_0x0a93('0x1c'),_0x0a93('0x1d'),_0x0a93('0x1e'),'phoneBarEnableRecording',_0x0a93('0x1f'),_0x0a93('0x20'),'phoneBarExpires',_0x0a93('0x21'),_0x0a93('0x22'),_0x0a93('0x23'),_0x0a93('0x24'),_0x0a93('0x25'),_0x0a93('0x26')];exports['isChatInteractionAuthorized']=function(){return this[_0x0a93('0x27')](!![])[_0x0a93('0x28')](function(_0x3c40c8,_0x27d5fe,_0x4d54b5){if(_0x3c40c8[_0x0a93('0x29')]){_0x4d54b5();}else{return db[_0x0a93('0x2a')][_0x0a93('0x2b')]({'where':{'id':_0x3c40c8[_0x0a93('0x2c')]['id']},'attributes':['id',_0x0a93('0x2d'),'disposition'],'raw':!![]})[_0x0a93('0x2e')](function(_0x4d2804){if(_0x4d2804&&_0x4d2804[_0x0a93('0x2d')]){return _0x27d5fe[_0x0a93('0x2f')](_0x4d2804[_0x0a93('0x30')]==='unmanaged'?0x195:0x193)[_0x0a93('0x31')]({'message':_0x4d2804[_0x0a93('0x30')]==='unmanaged'?_0x0a93('0x32'):_0x0a93('0x33')});}else{_0x4d54b5();}})[_0x0a93('0x34')](function(_0x42a848){_0x4d54b5(_0x42a848);});}});};exports['isAuthenticated']=function isAuthenticated(_0x52b863){return compose()['use'](function(_0x1ce96d,_0x5793e4,_0x1aa301){if(_0x1ce96d[_0x0a93('0x35')][_0x0a93('0x36')]){if(_['startsWith'](_0x1ce96d['headers'][_0x0a93('0x36')],_0x0a93('0x37'))){var _0x209161=basicAuth(_0x1ce96d);db[_0x0a93('0x38')][_0x0a93('0x39')]({'where':{'name':_0x209161[_0x0a93('0xb')]}})[_0x0a93('0x2e')](function(_0x3d9af6){if(!_0x3d9af6||!_0x3d9af6[_0x0a93('0x3a')](_0x209161[_0x0a93('0x3b')])){return _0x5793e4[_0x0a93('0x2f')](0x191)['json']({'message':_0x0a93('0x3c')});}_0x1ce96d[_0x0a93('0x29')]={'id':_0x3d9af6['id']};_0x1aa301();})[_0x0a93('0x34')](function(_0x36b9af){_0x1aa301(_0x36b9af);});}else if(_[_0x0a93('0x3d')](_0x1ce96d[_0x0a93('0x35')][_0x0a93('0x36')],_0x0a93('0x3e'))){validateJwt(_0x1ce96d,_0x5793e4,_0x1aa301);}else{if(_0x52b863){_0x1aa301();}else{return _0x5793e4[_0x0a93('0x2f')](0x193)[_0x0a93('0x31')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1ce96d[_0x0a93('0x3f')][_0x0a93('0x40')]){try{var _0x57fe60={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x0a93('0x41')]()};verifyJwt(_0x1ce96d[_0x0a93('0x3f')][_0x0a93('0x40')],_0x57fe60)[_0x0a93('0x2e')](function(_0x2eaa53){return db[_0x0a93('0x38')][_0x0a93('0x39')]({'where':{'id':_0x2eaa53['sub']}})[_0x0a93('0x2e')](function(_0x11f04d){if(!_0x11f04d||!_['isEqual'](_0x11f04d[_0x0a93('0x42')],_0x2eaa53[_0x0a93('0x43')])){return _0x5793e4['status'](0x191)[_0x0a93('0x31')]({'message':_0x0a93('0x44')});}_0x1ce96d[_0x0a93('0x29')]={'id':_0x11f04d['id']};_0x1aa301();});})[_0x0a93('0x34')](function(){return _0x5793e4['status'](0x191)[_0x0a93('0x31')]({'message':_0x0a93('0x45')});});}catch(_0x230968){_0x1aa301(_0x230968);}}else if(_0x52b863){_0x1aa301();}else{return _0x5793e4['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x0a93('0x28')](function(_0x31cc2c,_0x20b391,_0x108e78){if(_0x31cc2c[_0x0a93('0x29')]){db[_0x0a93('0x38')][_0x0a93('0x39')]({'where':{'id':_0x31cc2c[_0x0a93('0x29')]['id']},'attributes':userAttributes})[_0x0a93('0x2e')](function(_0x512b5f){if(!_0x512b5f){return _0x20b391[_0x0a93('0x2f')](0x194)[_0x0a93('0x31')]({'message':'User\x20not\x20found.'});}_0x31cc2c[_0x0a93('0x29')]=_0x512b5f;_0x108e78();})[_0x0a93('0x34')](function(_0x4e445c){_0x108e78(_0x4e445c);});}else if(_0x52b863){_0x108e78();}else{return _0x20b391[_0x0a93('0x2f')](0x194)[_0x0a93('0x31')]({'message':_0x0a93('0x46')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x0a93('0x28')](function(_0x4d598e,_0x238738,_0x4911f0){return require('../../config/license/util')[_0x0a93('0x47')]()[_0x0a93('0x2e')](function(_0x48c080){if(_0x48c080[_0x0a93('0x48')]){_0x4911f0();}else{return _0x238738['status'](0x193)['json']({'message':_0x0a93('0x49')});}})[_0x0a93('0x34')](function(_0x1ef1e9){_0x4911f0(_0x1ef1e9);});});};exports[_0x0a93('0x4a')]=function(_0xbfa6fc,_0x432a49,_0x7424fe){_0xbfa6fc['isMiddleware']=!![];return _0x7424fe();};exports[_0x0a93('0x4b')]=function signToken(_0x6c8c9f){return signJwt(_0x6c8c9f);};exports[_0x0a93('0x4c')]=function(_0x3d3a62,_0xb01a9b){if(!_0x3d3a62[_0x0a93('0x29')]){return _0xb01a9b[_0x0a93('0x2f')](0x194)[_0x0a93('0x31')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3fd4a3={'payload':{'id':_0x3d3a62['user']['id'],'role':_0x3d3a62[_0x0a93('0x29')][_0x0a93('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3fd4a3)[_0x0a93('0x2e')](function(_0x56d840){_0xb01a9b['cookie'](_0x0a93('0x4d'),_0x56d840);_0xb01a9b['redirect'](_0x0a93('0x4e'));})[_0x0a93('0x34')](function(_0x34bc82){return _0xb01a9b['status'](0x1f4)[_0x0a93('0x4f')](_0x34bc82);});};exports['retrieveApiKey']=function(_0x4a6ded){if(_[_0x0a93('0x50')](_0x4a6ded['apiKeyNonce'])||_[_0x0a93('0x50')](_0x4a6ded[_0x0a93('0x51')])){return null;}else{return createJwt(_0x4a6ded);}};exports[_0x0a93('0x52')]=function(_0x34df0b){_0x34df0b[_0x0a93('0x42')]=generateNonce();_0x34df0b[_0x0a93('0x51')]=generateIssuedAt();return createJwt(_0x34df0b);};exports[_0x0a93('0x53')]=function(_0x592cd6,_0x3c031f){var _0x20d222=_0x592cd6[_0x0a93('0x3f')][_0x0a93('0x40')];if(_0x20d222){var _0x24c9e7={'nonce':_0x3c031f[_0x0a93('0x42')],'iat':_0x3c031f['apiKeyIat'],'audience':hardwareConf[_0x0a93('0x41')](),'issuer':hardwareConf[_0x0a93('0x41')]()};return verifyJwt(_0x20d222,_0x24c9e7)[_0x0a93('0x2e')](function(){return generateApiKey(_0x3c031f);});}else{throw{'message':_0x0a93('0x54')};}};function signJwt(_0x3f573d){var _0x5a0018=BPromise[_0x0a93('0x55')](jwt[_0x0a93('0x56')],{'context':jwt});var _0x4d7db5=_0x3f573d[_0x0a93('0x57')]||config[_0x0a93('0x7')][_0x0a93('0x8')];return new BPromise(function(_0x325486,_0x34f55b){_0x5a0018(_0x3f573d['payload'],_0x4d7db5,_0x3f573d[_0x0a93('0x58')])[_0x0a93('0x2e')](function(_0x1ff430){_0x325486(_0x1ff430);})[_0x0a93('0x34')](function(_0x1c405f){_0x34f55b(_0x1c405f);});});}function verifyJwt(_0x488fca,_0x5f38dd,_0x3192c4){var _0x5e9af2=BPromise['promisify'](jwt[_0x0a93('0x59')],{'context':jwt});var _0x22a5bb=_0x3192c4||config[_0x0a93('0x7')][_0x0a93('0x8')];return new BPromise(function(_0x2fb871,_0x4f4af9){_0x5e9af2(_0x488fca,_0x22a5bb,_0x5f38dd)[_0x0a93('0x2e')](function(_0x3b0ccc){_0x2fb871(_0x3b0ccc);})[_0x0a93('0x34')](function(_0x34ebbc){_0x4f4af9(_0x34ebbc);});});}function generateNonce(){return crypto[_0x0a93('0x5a')](0x10)[_0x0a93('0x5b')](_0x0a93('0x5c'));}function generateIssuedAt(){return Math[_0x0a93('0x5d')](Date[_0x0a93('0x5e')]()/0x3e8)[_0x0a93('0x5b')]();}function createJwt(_0x2b6f68){var _0x110fd6={'payload':{'iat':_0x2b6f68[_0x0a93('0x51')],'nonce':_0x2b6f68[_0x0a93('0x42')]},'options':{'algorithm':'HS512','subject':_0x2b6f68['id']['toString'](),'issuer':hardwareConf[_0x0a93('0x41')](),'audience':hardwareConf[_0x0a93('0x41')]()}};return signJwt(_0x110fd6)[_0x0a93('0x2e')](function(_0x542062){return{'iat':_0x2b6f68[_0x0a93('0x51')],'nonce':_0x2b6f68[_0x0a93('0x42')],'token':_0x542062};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 4d5c9c5..73bd874 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 _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x10d973,_0x4c60dc){var _0x26a88a=function(_0x3ea918){while(--_0x3ea918){_0x10d973['push'](_0x10d973['shift']());}};_0x26a88a(++_0x4c60dc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x3071('0x0')};function combineOptions(_0x2afa91){var _0x27405a={};for(var _0x305d85 in defaultOptions){if(defaultOptions[_0x3071('0x1')](_0x305d85)){_0x27405a[_0x305d85]=defaultOptions[_0x305d85];}}if(_0x2afa91){for(var _0x52b5fb in _0x2afa91){if(_0x2afa91[_0x3071('0x1')](_0x52b5fb)){_0x27405a[_0x52b5fb]=_0x2afa91[_0x52b5fb];}}}return _0x27405a;}exports[_0x3071('0x2')]=function(_0x33a70c,_0x3137c8,_0xabd7b6,_0x41cf76){return new BPromise(function(_0x1d3dd6,_0x2f1e87){_0x41cf76=combineOptions(_0x41cf76);var _0xbd737f=new Buffer(_0xabd7b6);var _0x22274c=fs[_0x3071('0x3')](_0x33a70c);var _0x2fce7a=fs[_0x3071('0x4')](_0x3137c8);var _0x4a36ec=crypto[_0x3071('0x5')](_0x41cf76[_0x3071('0x6')],_0xbd737f);_0x22274c['on'](_0x3071('0x7'),function(_0xff9a29){var _0x1ce844=new Buffer(_0x4a36ec['update'](_0xff9a29),_0x3071('0x8'));_0x2fce7a[_0x3071('0x9')](_0x1ce844);});_0x22274c['on'](_0x3071('0xa'),function(){try{var _0x3ed4a0=new Buffer(_0x4a36ec[_0x3071('0xb')]('binary'),'binary');_0x2fce7a[_0x3071('0x9')](_0x3ed4a0);_0x2fce7a['end']();_0x2fce7a['on'](_0x3071('0xc'),function(){return _0x1d3dd6(_0x3137c8);});}catch(_0x44fbae){fs['unlink'](_0x3137c8);return _0x2f1e87(_0x44fbae);}});});};exports[_0x3071('0xd')]=function(_0x4e1219,_0x2fc15d,_0x45c93b,_0x1271d0){return new BPromise(function(_0x1f14e1,_0x1caa5d){_0x1271d0=combineOptions(_0x1271d0);var _0x2a6a4b=new Buffer(_0x45c93b);var _0x157a47=fs[_0x3071('0x3')](_0x4e1219);var _0x21aad3=fs[_0x3071('0x4')](_0x2fc15d);var _0x5f3c22=crypto[_0x3071('0xe')](_0x1271d0[_0x3071('0x6')],_0x2a6a4b);_0x157a47['on'](_0x3071('0x7'),function(_0x108a83){var _0x3acf0e=new Buffer(_0x5f3c22[_0x3071('0xf')](_0x108a83),_0x3071('0x8'));_0x21aad3[_0x3071('0x9')](_0x3acf0e);});_0x157a47['on']('end',function(){try{var _0x359e66=new Buffer(_0x5f3c22[_0x3071('0xb')](_0x3071('0x8')),'binary');_0x21aad3[_0x3071('0x9')](_0x359e66);_0x21aad3['end']();_0x21aad3['on'](_0x3071('0xc'),function(){return _0x1f14e1(_0x2fc15d);});}catch(_0x43128c){fs[_0x3071('0x10')](_0x2fc15d);return _0x1caa5d(_0x43128c);}});});}; \ No newline at end of file +var _0xcb91=['unlink','createReadStream','createWriteStream','createDecipher','update','aes192','hasOwnProperty','createCipher','algorithm','data','binary','write','end','final','close'];(function(_0xea4838,_0x3d802e){var _0xda5fe5=function(_0x13f122){while(--_0x13f122){_0xea4838['push'](_0xea4838['shift']());}};_0xda5fe5(++_0x3d802e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1de4b8,_0x529b41){_0x1de4b8=_0x1de4b8-0x0;var _0x557699=_0xcb91[_0x1de4b8];return _0x557699;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x1cb9('0x0')};function combineOptions(_0xe4a5bf){var _0x17d4ec={};for(var _0x22c4b8 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x22c4b8)){_0x17d4ec[_0x22c4b8]=defaultOptions[_0x22c4b8];}}if(_0xe4a5bf){for(var _0x8c392f in _0xe4a5bf){if(_0xe4a5bf[_0x1cb9('0x1')](_0x8c392f)){_0x17d4ec[_0x8c392f]=_0xe4a5bf[_0x8c392f];}}}return _0x17d4ec;}exports['encryptFile']=function(_0x13d5fd,_0x1b26cd,_0x53ffbd,_0x226b69){return new BPromise(function(_0x3f7deb,_0x4ffe20){_0x226b69=combineOptions(_0x226b69);var _0x38737d=new Buffer(_0x53ffbd);var _0x12567c=fs['createReadStream'](_0x13d5fd);var _0x3ae0f1=fs['createWriteStream'](_0x1b26cd);var _0x567139=crypto[_0x1cb9('0x2')](_0x226b69[_0x1cb9('0x3')],_0x38737d);_0x12567c['on'](_0x1cb9('0x4'),function(_0x1f0eca){var _0x2fc627=new Buffer(_0x567139['update'](_0x1f0eca),_0x1cb9('0x5'));_0x3ae0f1[_0x1cb9('0x6')](_0x2fc627);});_0x12567c['on'](_0x1cb9('0x7'),function(){try{var _0x3fdd83=new Buffer(_0x567139[_0x1cb9('0x8')]('binary'),'binary');_0x3ae0f1['write'](_0x3fdd83);_0x3ae0f1[_0x1cb9('0x7')]();_0x3ae0f1['on'](_0x1cb9('0x9'),function(){return _0x3f7deb(_0x1b26cd);});}catch(_0x384496){fs[_0x1cb9('0xa')](_0x1b26cd);return _0x4ffe20(_0x384496);}});});};exports['decryptFile']=function(_0x397727,_0x6ef389,_0x1b3cd7,_0x8dfa55){return new BPromise(function(_0x3e2d11,_0x5806d8){_0x8dfa55=combineOptions(_0x8dfa55);var _0x5572cb=new Buffer(_0x1b3cd7);var _0xd446a3=fs[_0x1cb9('0xb')](_0x397727);var _0x3904b7=fs[_0x1cb9('0xc')](_0x6ef389);var _0x3e21e0=crypto[_0x1cb9('0xd')](_0x8dfa55[_0x1cb9('0x3')],_0x5572cb);_0xd446a3['on']('data',function(_0x479d43){var _0x1b2fa6=new Buffer(_0x3e21e0[_0x1cb9('0xe')](_0x479d43),_0x1cb9('0x5'));_0x3904b7[_0x1cb9('0x6')](_0x1b2fa6);});_0xd446a3['on'](_0x1cb9('0x7'),function(){try{var _0x4014de=new Buffer(_0x3e21e0[_0x1cb9('0x8')]('binary'),'binary');_0x3904b7[_0x1cb9('0x6')](_0x4014de);_0x3904b7['end']();_0x3904b7['on'](_0x1cb9('0x9'),function(){return _0x3e2d11(_0x6ef389);});}catch(_0x2265ea){fs['unlink'](_0x6ef389);return _0x5806d8(_0x2265ea);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f292e5c..2a281e1 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 _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(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a63d9,_0x1dfe31){_0x5a63d9=_0x5a63d9-0x0;var _0x3428b3=_0xedd9[_0x5a63d9];return _0x3428b3;};'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 +var _0xb903=['each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','info','inspect','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','query','sequelize','QueryTypes','num','Empty','push','format','SELECT','dirname','basename','length','existsSync','join'];(function(_0x477a47,_0x3fbbc1){var _0x41657a=function(_0x4abe4c){while(--_0x4abe4c){_0x477a47['push'](_0x477a47['shift']());}};_0x41657a(++_0x3fbbc1);}(_0xb903,0x185));var _0x3b90=function(_0x2f847f,_0x171405){_0x2f847f=_0x2f847f-0x0;var _0x456b8e=_0xb903[_0x2f847f];return _0x456b8e;};'use strict';var util=require(_0x3b90('0x0'));var path=require(_0x3b90('0x1'));var _=require(_0x3b90('0x2'));var csv=require(_0x3b90('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x3b90('0x4'));var rimraf=require(_0x3b90('0x5'));var db=require(_0x3b90('0x6'))['db'];var dbH=require(_0x3b90('0x6'))[_0x3b90('0x7')];var logger=require(_0x3b90('0x8'))(_0x3b90('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3b90('0xa')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x55792c,_0x153283){var _0x2e4c06={'status':_0x55792c};var _0x42efe8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x153283){_0x2e4c06[_0x3b90('0xb')]=_0x153283;}return db['AnalyticExtractedReport']['update'](_0x2e4c06,_0x42efe8);}function main(){var _0x52401e=0x1388;var _0x51f916;logger['info'](util['format'](_0x3b90('0xc'),EXTRACTED_REPORT_ID,_0x3b90('0xd')));return db['Setting'][_0x3b90('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3b90('0xf'),'splitSizeCsv']})[_0x3b90('0x10')](function(_0x174c0d){if(_0x174c0d){_0x51f916=_0x174c0d;_0x52401e=_0x51f916[_0x3b90('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x3b90('0x12')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3b90('0x13')][_0x3b90('0x14')]['SELECT']});})['then'](function(_0x3725b9){if(!_0x3725b9[0x0][_0x3b90('0x15')]){return analyticExtractedReport(_0x3b90('0x16'));}var _0x1af265=[];var _0x1efe01=0x0;var _0x529421=!![];if(_0x3725b9&&_0x3725b9['length']){var _0xd83280=_0x3725b9[0x0][_0x3b90('0x15')]%(_0x1efe01+_0x52401e);if(_0x51f916['split']){for(;_0x529421;_0x1efe01+=_0x52401e,_0xd83280=_0x3725b9[0x0][_0x3b90('0x15')]%(_0x1efe01+_0x52401e)){if(_0xd83280==0x0||_0xd83280==_0x3725b9[0x0][_0x3b90('0x15')]){_0x529421=![];}_0x1af265[_0x3b90('0x17')](dbH[_0x3b90('0x13')]['query'](util[_0x3b90('0x18')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x52401e,_0x1efe01),{'type':dbH[_0x3b90('0x13')][_0x3b90('0x14')]['SELECT']}));}}else{_0x1af265[_0x3b90('0x17')](dbH[_0x3b90('0x13')][_0x3b90('0x12')](QUERY,{'type':dbH[_0x3b90('0x13')][_0x3b90('0x14')][_0x3b90('0x19')]}));}}var _0x3bc7d5=path[_0x3b90('0x1a')](PATH);var _0xa98414=path[_0x3b90('0x1b')](PATH,'.csv');var _0x20b06a=_0x51f916[_0x3b90('0xf')]&&_0x1af265[_0x3b90('0x1c')]>0x1;var _0x7faee=[];if(!fs[_0x3b90('0x1d')](path[_0x3b90('0x1e')](_0x3bc7d5,_0xa98414))&&_0x20b06a){fs['mkdirSync'](path['join'](_0x3bc7d5,_0xa98414));}return BPromise[_0x3b90('0x1f')](_0x1af265,function(_0x29d472){_0x7faee[_0x3b90('0x17')](_0x29d472);})[_0x3b90('0x10')](function(){for(var _0x583523=0x0;_0x583523<_0x7faee[_0x3b90('0x1c')];_0x583523+=0x1){var _0x2936d7;var _0x1787d1=_0x7faee[_0x583523];if(_0x20b06a){_0x2936d7=path['join'](_0x3bc7d5,_0xa98414,util[_0x3b90('0x18')](_0x3b90('0x20'),_0xa98414,_0x583523,_0x3b90('0x21')));}else{_0x2936d7=path[_0x3b90('0x1e')](_0x3bc7d5,util[_0x3b90('0x18')](_0x3b90('0x22'),_0xa98414,'csv'));}fs[_0x3b90('0x23')](_0x2936d7,csv(_0x1787d1));}})['then'](function(){if(_0x20b06a){zipdir(path[_0x3b90('0x1e')](_0x3bc7d5,_0xa98414),{'saveTo':path[_0x3b90('0x1e')](_0x3bc7d5,util[_0x3b90('0x18')](_0x3b90('0x22'),_0xa98414,_0x3b90('0x24')))},function(_0x6704f,_0x290283){});rimraf(path[_0x3b90('0x1e')](_0x3bc7d5,_0xa98414),function(){});}})['then'](function(){logger['info'](util[_0x3b90('0x18')](_0x3b90('0x25'),EXTRACTED_REPORT_ID,_0x3b90('0xd')));return analyticExtractedReport(_0x3b90('0x26'),_0x20b06a?util['format']('%s.%s',_0xa98414,_0x20b06a?_0x3b90('0x24'):_0x3b90('0x21')):null);});})[_0x3b90('0x27')](function(_0x4f3ab5){logger[_0x3b90('0x28')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3b90('0xd')),util[_0x3b90('0x29')](_0x4f3ab5,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 742454b..423a608 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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x16bc1f,_0x11a31c){var _0x29e4f0=function(_0x4c52f9){while(--_0x4c52f9){_0x16bc1f['push'](_0x16bc1f['shift']());}};_0x29e4f0(++_0x11a31c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}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(_0x22da52,_0x2f124e){var _0x55fc4f=function(_0x4fb5cb){while(--_0x4fb5cb){_0x22da52['push'](_0x22da52['shift']());}};_0x55fc4f(++_0x2f124e);}(_0xb10b,0x12a));var _0xbb10=function(_0x18b0a1,_0x535aac){_0x18b0a1=_0x18b0a1-0x0;var _0x55005a=_0xb10b[_0x18b0a1];return _0x55005a;};'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 2576cd4..11b47b9 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 _0x3a98=['json2xls','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','split','length','num','push','sequelize','dirname','basename','.xlsx','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','util','path','lodash'];(function(_0x5455aa,_0x43f969){var _0x683e42=function(_0x174bae){while(--_0x174bae){_0x5455aa['push'](_0x5455aa['shift']());}};_0x683e42(++_0x43f969);}(_0x3a98,0x84));var _0x83a9=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0x3a98[_0x37b7b6];return _0x10c4c3;};'use strict';var util=require(_0x83a9('0x0'));var path=require(_0x83a9('0x1'));var _=require(_0x83a9('0x2'));var fs=require('fs');var json2xls=require(_0x83a9('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x83a9('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x83a9('0x5'))[_0x83a9('0x6')];var logger=require(_0x83a9('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x83a9('0x8')][0x2]);var QUERY=process[_0x83a9('0x8')][0x3];var PATH=process[_0x83a9('0x8')][0x4];function analyticExtractedReport(_0x37268e,_0x1eeb84){var _0x814235={'status':_0x37268e};var _0x198987={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1eeb84){_0x814235[_0x83a9('0x9')]=_0x1eeb84;}return db[_0x83a9('0xa')]['update'](_0x814235,_0x198987);}function main(){var _0x2f7eaa=0x1388;var _0x118919;logger['info'](util[_0x83a9('0xb')](_0x83a9('0xc'),EXTRACTED_REPORT_ID,_0x83a9('0xd')));return db[_0x83a9('0xe')][_0x83a9('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x83a9('0x10')]})[_0x83a9('0x11')](function(_0x26ffa0){if(_0x26ffa0){_0x118919=_0x26ffa0;_0x2f7eaa=_0x118919[_0x83a9('0x10')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x83a9('0x12')](util[_0x83a9('0xb')](_0x83a9('0x13'),QUERY),{'type':dbH['sequelize'][_0x83a9('0x14')][_0x83a9('0x15')]});})[_0x83a9('0x11')](function(_0xf7870){if(!_0xf7870[0x0]['num']){return analyticExtractedReport(_0x83a9('0x16'));}var _0x1c9361=[];var _0x3a7ef6=0x0;var _0x50da15=!![];if(_0x118919[_0x83a9('0x17')]){if(_0xf7870&&_0xf7870[_0x83a9('0x18')]){var _0x23d5ca=_0xf7870[0x0]['num']%(_0x3a7ef6+_0x2f7eaa);for(;_0x50da15;_0x3a7ef6+=_0x2f7eaa,_0x23d5ca=_0xf7870[0x0][_0x83a9('0x19')]%(_0x3a7ef6+_0x2f7eaa)){if(_0x23d5ca==0x0||_0x23d5ca==_0xf7870[0x0][_0x83a9('0x19')]){_0x50da15=![];}_0x1c9361[_0x83a9('0x1a')](dbH[_0x83a9('0x1b')][_0x83a9('0x12')](util[_0x83a9('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2f7eaa,_0x3a7ef6),{'type':dbH['sequelize'][_0x83a9('0x14')][_0x83a9('0x15')]}));}}}else{_0x1c9361[_0x83a9('0x1a')](dbH['sequelize'][_0x83a9('0x12')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x83a9('0x15')]}));}var _0x3a161e=path[_0x83a9('0x1c')](PATH);var _0x205b9f=path[_0x83a9('0x1d')](PATH,_0x83a9('0x1e'));var _0x11bd18=_0x118919[_0x83a9('0x17')]&&_0x1c9361[_0x83a9('0x18')]>0x1;var _0x1a0366=[];if(!fs['existsSync'](path[_0x83a9('0x1f')](_0x3a161e,_0x205b9f))&&_0x11bd18){fs[_0x83a9('0x20')](path[_0x83a9('0x1f')](_0x3a161e,_0x205b9f));}return BPromise[_0x83a9('0x21')](_0x1c9361,function(_0x1a680d){_0x1a0366[_0x83a9('0x1a')](_0x1a680d);})[_0x83a9('0x11')](function(){for(var _0x4cf2d3=0x0;_0x4cf2d3<_0x1a0366[_0x83a9('0x18')];_0x4cf2d3+=0x1){var _0x443bae;var _0x195c1d=_0x1a0366[_0x4cf2d3];if(_0x11bd18){_0x443bae=path[_0x83a9('0x1f')](_0x3a161e,_0x205b9f,util[_0x83a9('0xb')](_0x83a9('0x22'),_0x205b9f,_0x4cf2d3,_0x83a9('0x23')));}else{_0x443bae=path[_0x83a9('0x1f')](_0x3a161e,util[_0x83a9('0xb')](_0x83a9('0x24'),_0x205b9f,'xlsx'));}fs[_0x83a9('0x25')](_0x443bae,json2xls(_0x195c1d),'binary');}})[_0x83a9('0x11')](function(){if(_0x11bd18){zipdir(path['join'](_0x3a161e,_0x205b9f),{'saveTo':path[_0x83a9('0x1f')](_0x3a161e,util[_0x83a9('0xb')](_0x83a9('0x24'),_0x205b9f,_0x83a9('0x26')))},function(_0x51edd2,_0x363914){});rimraf(path[_0x83a9('0x1f')](_0x3a161e,_0x205b9f),function(){});}})['then'](function(){logger[_0x83a9('0x27')](util[_0x83a9('0xb')](_0x83a9('0x28'),EXTRACTED_REPORT_ID,_0x83a9('0xd')));return analyticExtractedReport(_0x83a9('0x29'),_0x11bd18?util[_0x83a9('0xb')](_0x83a9('0x24'),_0x205b9f,_0x11bd18?_0x83a9('0x26'):_0x83a9('0x23')):null);});})[_0x83a9('0x2a')](function(_0x542e1c){logger[_0x83a9('0x27')](util[_0x83a9('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x83a9('0xd')),util[_0x83a9('0x2b')](_0x542e1c,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x83a9('0x2c'));});}main(); \ No newline at end of file +var _0xcd26=['rimraf','../../mysqldb','dbH','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','length','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','Failed','path','json2xls','bluebird','zip-dir'];(function(_0x1fbef0,_0x5ca5e8){var _0x30a572=function(_0x170bc6){while(--_0x170bc6){_0x1fbef0['push'](_0x1fbef0['shift']());}};_0x30a572(++_0x5ca5e8);}(_0xcd26,0x77));var _0x6cd2=function(_0x227c55,_0x49db56){_0x227c55=_0x227c55-0x0;var _0x49e02b=_0xcd26[_0x227c55];return _0x49e02b;};'use strict';var util=require('util');var path=require(_0x6cd2('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x6cd2('0x1'));var BPromise=require(_0x6cd2('0x2'));var zipdir=require(_0x6cd2('0x3'));var rimraf=require(_0x6cd2('0x4'));var db=require(_0x6cd2('0x5'))['db'];var dbH=require(_0x6cd2('0x5'))[_0x6cd2('0x6')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6cd2('0x7')][0x2]);var QUERY=process[_0x6cd2('0x7')][0x3];var PATH=process[_0x6cd2('0x7')][0x4];function analyticExtractedReport(_0x2edd3a,_0x253b73){var _0x53d18d={'status':_0x2edd3a};var _0x8a4d42={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x253b73){_0x53d18d['savename']=_0x253b73;}return db[_0x6cd2('0x8')][_0x6cd2('0x9')](_0x53d18d,_0x8a4d42);}function main(){var _0x7b8046=0x1388;var _0x4884a3;logger[_0x6cd2('0xa')](util['format'](_0x6cd2('0xb'),EXTRACTED_REPORT_ID,_0x6cd2('0xc')));return db['Setting'][_0x6cd2('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6cd2('0xe'),_0x6cd2('0xf')]})[_0x6cd2('0x10')](function(_0x2200eb){if(_0x2200eb){_0x4884a3=_0x2200eb;_0x7b8046=_0x4884a3[_0x6cd2('0xf')]||0x1388;}})['then'](function(){return dbH[_0x6cd2('0x11')]['query'](util[_0x6cd2('0x12')](_0x6cd2('0x13'),QUERY),{'type':dbH['sequelize'][_0x6cd2('0x14')][_0x6cd2('0x15')]});})[_0x6cd2('0x10')](function(_0x34b88b){if(!_0x34b88b[0x0][_0x6cd2('0x16')]){return analyticExtractedReport(_0x6cd2('0x17'));}var _0x4afede=[];var _0x2b5b69=0x0;var _0x6da57e=!![];if(_0x4884a3[_0x6cd2('0xe')]){if(_0x34b88b&&_0x34b88b['length']){var _0x3edea0=_0x34b88b[0x0][_0x6cd2('0x16')]%(_0x2b5b69+_0x7b8046);for(;_0x6da57e;_0x2b5b69+=_0x7b8046,_0x3edea0=_0x34b88b[0x0][_0x6cd2('0x16')]%(_0x2b5b69+_0x7b8046)){if(_0x3edea0==0x0||_0x3edea0==_0x34b88b[0x0][_0x6cd2('0x16')]){_0x6da57e=![];}_0x4afede[_0x6cd2('0x18')](dbH[_0x6cd2('0x11')][_0x6cd2('0x19')](util[_0x6cd2('0x12')](_0x6cd2('0x1a'),QUERY,_0x7b8046,_0x2b5b69),{'type':dbH['sequelize'][_0x6cd2('0x14')][_0x6cd2('0x15')]}));}}}else{_0x4afede['push'](dbH[_0x6cd2('0x11')]['query'](QUERY,{'type':dbH['sequelize'][_0x6cd2('0x14')][_0x6cd2('0x15')]}));}var _0x3d3f46=path[_0x6cd2('0x1b')](PATH);var _0x4ac31d=path[_0x6cd2('0x1c')](PATH,'.xlsx');var _0x2fb0cd=_0x4884a3[_0x6cd2('0xe')]&&_0x4afede[_0x6cd2('0x1d')]>0x1;var _0xd21d30=[];if(!fs[_0x6cd2('0x1e')](path['join'](_0x3d3f46,_0x4ac31d))&&_0x2fb0cd){fs['mkdirSync'](path[_0x6cd2('0x1f')](_0x3d3f46,_0x4ac31d));}return BPromise[_0x6cd2('0x20')](_0x4afede,function(_0x2ee01f){_0xd21d30['push'](_0x2ee01f);})['then'](function(){for(var _0x178e60=0x0;_0x178e60<_0xd21d30[_0x6cd2('0x1d')];_0x178e60+=0x1){var _0x16dcad;var _0x648823=_0xd21d30[_0x178e60];if(_0x2fb0cd){_0x16dcad=path[_0x6cd2('0x1f')](_0x3d3f46,_0x4ac31d,util[_0x6cd2('0x12')](_0x6cd2('0x21'),_0x4ac31d,_0x178e60,_0x6cd2('0x22')));}else{_0x16dcad=path[_0x6cd2('0x1f')](_0x3d3f46,util[_0x6cd2('0x12')](_0x6cd2('0x23'),_0x4ac31d,_0x6cd2('0x22')));}fs[_0x6cd2('0x24')](_0x16dcad,json2xls(_0x648823),'binary');}})[_0x6cd2('0x10')](function(){if(_0x2fb0cd){zipdir(path[_0x6cd2('0x1f')](_0x3d3f46,_0x4ac31d),{'saveTo':path[_0x6cd2('0x1f')](_0x3d3f46,util[_0x6cd2('0x12')](_0x6cd2('0x23'),_0x4ac31d,'zip'))},function(_0x2670f7,_0x9fa1e3){});rimraf(path[_0x6cd2('0x1f')](_0x3d3f46,_0x4ac31d),function(){});}})[_0x6cd2('0x10')](function(){logger[_0x6cd2('0xa')](util[_0x6cd2('0x12')](_0x6cd2('0x25'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x6cd2('0x26'),_0x2fb0cd?util[_0x6cd2('0x12')]('%s.%s',_0x4ac31d,_0x2fb0cd?'zip':_0x6cd2('0x22')):null);});})['catch'](function(_0x14f123){logger['info'](util[_0x6cd2('0x12')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x6cd2('0x27')](_0x14f123,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6cd2('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c77a85b..943de1e 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 _0x4559=['Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','extension','extensions','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','util','models','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','filter','playback','hasOwnProperty','priority','push','type'];(function(_0x381aca,_0x3784a1){var _0x17b285=function(_0x5c6b08){while(--_0x5c6b08){_0x381aca['push'](_0x381aca['shift']());}};_0x17b285(++_0x3784a1);}(_0x4559,0x18f));var _0x9455=function(_0x53e0f9,_0x2c84f0){_0x53e0f9=_0x53e0f9-0x0;var _0x46afe5=_0x4559[_0x53e0f9];return _0x46afe5;};'use strict';var _=require('lodash');var util=require(_0x9455('0x0'));function rewrite(_0x51930f,_0x2b7693){var _0x23d5da=this;return _0x51930f[_0x9455('0x1')]['Interval'][_0x9455('0x2')]({'raw':!![]})[_0x9455('0x3')](function(_0x591b2d){_0x23d5da['intervals']=_0x591b2d;return _0x51930f[_0x9455('0x1')][_0x9455('0x4')][_0x9455('0x2')]({'where':{'IntervalId':_0x2b7693[_0x9455('0x5')]},'raw':!![]});})['then'](function(_0x596ee9){return _0x51930f[_0x9455('0x1')][_0x9455('0x4')][_0x9455('0x2')]({'where':{'exten':{'$in':_[_0x9455('0x6')](_[_0x9455('0x7')](_0x596ee9,_0x9455('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x9455('0x3')](function(_0x3e60d1){var _0x5e6b9d=_['filter'](_0x3e60d1,{'priority':'1'});var _0x3f15ad=_[_0x9455('0x9')](_0x3e60d1,{'isApp':0x1});var _0x5c38f8=_['groupBy'](_0x3f15ad,_0x9455('0x8'));var _0x4619f1=['queue',_0x9455('0xa')];var _0xee7d87=[];var _0x4bcdce=[];for(var _0x1d2967 in _0x5c38f8){if(_0x5c38f8[_0x9455('0xb')](_0x1d2967)){_0x23d5da[_0x9455('0xc')]=0x2;_0x23d5da['extensions']=[];_0x23d5da['extension']=_['find'](_0x5e6b9d,{'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')]});_0x23d5da['extensions'][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0][_0x9455('0xe')],'app':_0x9455('0xf'),'appdata':util[_0x9455('0x10')](_0x9455('0x11'),_0x5c38f8[_0x1d2967][0x0][_0x9455('0xe')]),'context':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x12')],'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')],'priority':_0x23d5da[_0x9455('0xc')]++,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')]});if(_0x5c38f8[_0x1d2967][0x0][_0x9455('0xe')]===_0x9455('0x14')){if(_0x23d5da[_0x9455('0x15')]){_0x23d5da[_0x9455('0x16')][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0]['type'],'app':_0x9455('0xf'),'appdata':_0x9455('0x17')+(_0x23d5da['extension'][_0x9455('0x18')]?'${EXTEN:'+_0x23d5da[_0x9455('0x15')][_0x9455('0x18')]+'}':_0x9455('0x19')),'context':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x12')],'exten':_0x5c38f8[_0x1d2967][0x0]['exten'],'priority':_0x23d5da[_0x9455('0xc')]++,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')]});}_0x23d5da[_0x9455('0x16')][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0][_0x9455('0xe')],'app':_0x9455('0xf'),'appdata':_0x9455('0x1a')+_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')],'context':_0x5c38f8[_0x1d2967][0x0]['context'],'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')],'priority':_0x23d5da[_0x9455('0xc')]++,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')]});var _0x44f4d9=_0x23d5da['priority']++;_0x23d5da[_0x9455('0x16')][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0][_0x9455('0xe')],'app':_0x9455('0x1b'),'appdata':_0x9455('0x1c')+(_0x44f4d9+0x2)+'):Goto('+(_0x44f4d9+0x1)+')','context':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x12')],'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')],'priority':_0x44f4d9,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0]['VoiceExtensionId']});if(_0x23d5da['extension']){_0x23d5da[_0x9455('0x16')][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0][_0x9455('0xe')],'app':_0x9455('0xf'),'appdata':_0x23d5da[_0x9455('0x15')]['cutdigits']?_0x9455('0x1d')+_0x23d5da[_0x9455('0x15')][_0x9455('0x18')]+'}':'CDR(prefix)=noprefix','context':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x12')],'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')],'priority':_0x23d5da[_0x9455('0xc')]++,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')]});}_0x23d5da[_0x9455('0x16')][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0]['type'],'app':_0x9455('0xf'),'appdata':_0x9455('0x1e')+_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')],'context':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x12')],'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')],'priority':_0x23d5da['priority']++,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0]['VoiceExtensionId']});if(_0x23d5da[_0x9455('0x15')]&&_0x23d5da[_0x9455('0x15')]['hasOwnProperty']('recordingFormat')&&_0x23d5da[_0x9455('0x15')][_0x9455('0x1f')]!==_0x9455('0x20')){_0x23d5da[_0x9455('0x16')][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0][_0x9455('0xe')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x12')],'exten':_0x5c38f8[_0x1d2967][0x0]['exten'],'priority':_0x23d5da['priority']++,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')]});_0x23d5da['extensions'][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0][_0x9455('0xe')],'app':_0x9455('0xf'),'appdata':_0x9455('0x21')+_0x23d5da[_0x9455('0x15')][_0x9455('0x1f')]||_0x9455('0x22'),'context':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x12')],'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')],'priority':_0x23d5da[_0x9455('0xc')]++,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0]['VoiceExtensionId']});}}_0x23d5da[_0x9455('0x16')][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0][_0x9455('0xe')],'app':_0x9455('0xf'),'appdata':_0x9455('0x23'),'context':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x12')],'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')],'priority':_0x23d5da[_0x9455('0xc')]++,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')]});_0x23d5da[_0x9455('0x16')][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0][_0x9455('0xe')],'app':_0x9455('0xf'),'appdata':_0x9455('0x24'),'context':_0x5c38f8[_0x1d2967][0x0]['context'],'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')],'priority':_0x23d5da[_0x9455('0xc')]++,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')]});_0x23d5da[_0x9455('0x16')]['push']({'type':_0x5c38f8[_0x1d2967][0x0]['type'],'app':_0x9455('0xf'),'appdata':_0x9455('0x25'),'context':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x12')],'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')],'priority':_0x23d5da[_0x9455('0xc')]++,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')]});for(var _0x528186=0x0,_0x3df362=0x0;_0x528186<_0x5c38f8[_0x1d2967][_0x9455('0x26')];_0x528186+=0x1,_0x3df362=0x0){var _0x4bea4c=_0x5c38f8[_0x1d2967][_0x528186];if(_0x4bea4c[_0x9455('0xe')]){_0x4bea4c[_0x9455('0xe')]=_0x4bea4c[_0x9455('0xe')][_0x9455('0x27')]();}var _0x41e22c=[];var _0x1d24f5=[];delete _0x4bea4c['id'];delete _0x4bea4c[_0x9455('0x28')];delete _0x4bea4c[_0x9455('0x29')];var _0x21f016=_0x4bea4c[_0x9455('0x2a')]!==_0x9455('0x2b')?[_0x4bea4c[_0x9455('0x2a')]]:_0x4bea4c['IntervalId']?_[_0x9455('0x7')](_[_0x9455('0x9')](_0x23d5da[_0x9455('0x2c')],{'IntervalId':_0x4bea4c[_0x9455('0x5')]}),_0x9455('0x2a')):[];if(_0x4bea4c[_0x9455('0xb')](_0x9455('0x2d'))){if(_0x4bea4c['tag']&&_0x4bea4c[_0x9455('0x2d')]!=='--'){_0x41e22c[_0x9455('0xd')]({'type':_0x4bea4c[_0x9455('0xe')],'app':_0x9455('0xf'),'appdata':_0x9455('0x2e')+_0x4bea4c['tag'],'context':_0x4bea4c[_0x9455('0x12')],'exten':_0x4bea4c[_0x9455('0x8')],'priority':_0x21f016['length']+_0x23d5da[_0x9455('0xc')]+_0x3df362++,'VoiceExtensionId':_0x4bea4c[_0x9455('0x13')]});}}if(_0x4bea4c[_0x9455('0xe')]===_0x9455('0x14')&&_0x4bea4c[_0x9455('0xb')](_0x9455('0x2f'))){if(_0x4bea4c[_0x9455('0x2f')]){_0x41e22c['push']({'type':_0x4bea4c[_0x9455('0xe')],'app':_0x9455('0x1b'),'appdata':_0x9455('0x30')+_0x4bea4c[_0x9455('0x2f')]+')','context':_0x4bea4c['context'],'exten':_0x4bea4c['exten'],'priority':_0x21f016[_0x9455('0x26')]+_0x23d5da[_0x9455('0xc')]+_0x3df362++,'VoiceExtensionId':_0x4bea4c[_0x9455('0x13')]});}else{_0x41e22c[_0x9455('0xd')]({'type':_0x4bea4c['type'],'app':_0x9455('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x4bea4c['context'],'exten':_0x4bea4c['exten'],'priority':_0x21f016[_0x9455('0x26')]+_0x23d5da[_0x9455('0xc')]+_0x3df362++,'VoiceExtensionId':_0x4bea4c['VoiceExtensionId']});}}if(_0x4bea4c[_0x9455('0xb')](_0x9455('0x31'))){if(_0x4619f1[_0x9455('0x32')](_0x4bea4c[_0x9455('0x33')][_0x9455('0x27')]())>=0x0&&_0x4bea4c['appType']!==_0x9455('0x34')){if(_0x4bea4c[_0x9455('0x31')]){_0x41e22c['push']({'type':_0x4bea4c[_0x9455('0xe')],'app':_0x9455('0x1b'),'appdata':_0x9455('0x35'),'context':_0x4bea4c[_0x9455('0x12')],'exten':_0x4bea4c[_0x9455('0x8')],'priority':_0x21f016[_0x9455('0x26')]+_0x23d5da['priority']+_0x3df362++,'VoiceExtensionId':_0x4bea4c[_0x9455('0x13')]});_0x41e22c['push']({'type':_0x4bea4c['type'],'app':_0x9455('0xf'),'appdata':_0x9455('0x36'),'context':_0x4bea4c[_0x9455('0x12')],'exten':_0x4bea4c[_0x9455('0x8')],'priority':_0x21f016['length']+_0x23d5da[_0x9455('0xc')]+_0x3df362++,'VoiceExtensionId':_0x4bea4c['VoiceExtensionId']});}else{_0x41e22c['push']({'type':_0x4bea4c['type'],'app':_0x9455('0x1b'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4bea4c['context'],'exten':_0x4bea4c[_0x9455('0x8')],'priority':_0x21f016[_0x9455('0x26')]+_0x23d5da[_0x9455('0xc')]+_0x3df362++,'VoiceExtensionId':_0x4bea4c[_0x9455('0x13')]});_0x41e22c[_0x9455('0xd')]({'type':_0x4bea4c[_0x9455('0xe')],'app':'Set','appdata':_0x9455('0x37'),'context':_0x4bea4c[_0x9455('0x12')],'exten':_0x4bea4c[_0x9455('0x8')],'priority':_0x21f016[_0x9455('0x26')]+_0x23d5da[_0x9455('0xc')]+_0x3df362++,'VoiceExtensionId':_0x4bea4c[_0x9455('0x13')]});}}}for(var _0x2a34f3=0x0;_0x2a34f3<_0x21f016[_0x9455('0x26')];_0x2a34f3+=0x1){var _0x31404c=_0x23d5da[_0x9455('0xc')]+_0x21f016[_0x9455('0x26')];var _0x552b7d=_0x2a34f3===_0x21f016['length']-0x1?_0x23d5da[_0x9455('0xc')]+_0x41e22c[_0x9455('0x26')]+_0x1d24f5[_0x9455('0x26')]+0x2:_0x23d5da['priority']+_0x2a34f3+0x1;_0x41e22c[_0x9455('0x38')](_0x2a34f3,0x0,{'type':_0x4bea4c[_0x9455('0xe')],'app':_0x9455('0x39'),'appdata':_0x21f016[_0x2a34f3]+'?'+_0x4bea4c[_0x9455('0x12')]+_0x9455('0x3a')+_0x31404c+':'+_0x4bea4c[_0x9455('0x12')]+_0x9455('0x3a')+_0x552b7d,'exten':_0x4bea4c['exten'],'context':_0x4bea4c['context'],'priority':_0x23d5da[_0x9455('0xc')]+_0x2a34f3,'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0]['VoiceExtensionId']});}_0x4bea4c[_0x9455('0xc')]=_0x41e22c[_0x9455('0x26')]?_[_0x9455('0x3b')](_0x41e22c)[_0x9455('0xc')]+0x1:_0x23d5da[_0x9455('0xc')];_0x23d5da[_0x9455('0xc')]=(_0x1d24f5['length']?_[_0x9455('0x3b')](_0x1d24f5)[_0x9455('0xc')]:_0x4bea4c[_0x9455('0xc')])+0x1;_0x23d5da[_0x9455('0x16')]=_[_0x9455('0x3c')](_0x23d5da[_0x9455('0x16')],_0x41e22c,[_0x4bea4c],_0x1d24f5);}_0x23d5da[_0x9455('0x16')][_0x9455('0xd')]({'type':_0x5c38f8[_0x1d2967][0x0]['type'],'app':_0x9455('0x3d'),'exten':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x8')],'context':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x12')],'priority':_0x23d5da[_0x9455('0xc')],'VoiceExtensionId':_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')]});_0xee7d87[_0x9455('0xd')](_0x5c38f8[_0x1d2967][0x0][_0x9455('0x13')]);_0x4bcdce=_[_0x9455('0x3c')](_0x4bcdce,_0x23d5da[_0x9455('0x16')]);}}return _0x51930f[_0x9455('0x3e')](function(_0x588c16){return _0x51930f['models'][_0x9455('0x4')][_0x9455('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0xee7d87}},'transaction':_0x588c16})[_0x9455('0x3')](function(_0x5f5173){return _0x51930f['models'][_0x9455('0x4')][_0x9455('0x40')](_[_0x9455('0x41')](_0x4bcdce,'priority'),{'transaction':_0x588c16});});});})[_0x9455('0x42')](function(_0x56a4bb){console[_0x9455('0x43')](_0x56a4bb);});}exports[_0x9455('0x44')]=rewrite; \ No newline at end of file +var _0xb584=['none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','interval','IntervalId','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','Interval','findAll','then','intervals','models','VoiceExtension','map','exten','filter','groupBy','playback','hasOwnProperty','priority','extensions','find','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','push','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat'];(function(_0x56cd70,_0x3cc19d){var _0x34007e=function(_0x51a586){while(--_0x51a586){_0x56cd70['push'](_0x56cd70['shift']());}};_0x34007e(++_0x3cc19d);}(_0xb584,0x1c1));var _0x4b58=function(_0xdcdae9,_0x5ecdf7){_0xdcdae9=_0xdcdae9-0x0;var _0x363215=_0xb584[_0xdcdae9];return _0x363215;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x39a445,_0x479d36){var _0x1bf6e1=this;return _0x39a445['models'][_0x4b58('0x0')][_0x4b58('0x1')]({'raw':!![]})[_0x4b58('0x2')](function(_0x3f6983){_0x1bf6e1[_0x4b58('0x3')]=_0x3f6983;return _0x39a445[_0x4b58('0x4')][_0x4b58('0x5')][_0x4b58('0x1')]({'where':{'IntervalId':_0x479d36['IntervalId']},'raw':!![]});})['then'](function(_0x3a969b){return _0x39a445[_0x4b58('0x4')][_0x4b58('0x5')][_0x4b58('0x1')]({'where':{'exten':{'$in':_['uniq'](_[_0x4b58('0x6')](_0x3a969b,_0x4b58('0x7')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x4b58('0x2')](function(_0x2a3fdd){var _0x1c9887=_[_0x4b58('0x8')](_0x2a3fdd,{'priority':'1'});var _0x218c44=_['filter'](_0x2a3fdd,{'isApp':0x1});var _0x13708e=_[_0x4b58('0x9')](_0x218c44,_0x4b58('0x7'));var _0xc60643=['queue',_0x4b58('0xa')];var _0x4d0b79=[];var _0x4a6a6a=[];for(var _0x480268 in _0x13708e){if(_0x13708e[_0x4b58('0xb')](_0x480268)){_0x1bf6e1[_0x4b58('0xc')]=0x2;_0x1bf6e1[_0x4b58('0xd')]=[];_0x1bf6e1['extension']=_[_0x4b58('0xe')](_0x1c9887,{'exten':_0x13708e[_0x480268][0x0][_0x4b58('0x7')]});_0x1bf6e1[_0x4b58('0xd')]['push']({'type':_0x13708e[_0x480268][0x0]['type'],'app':_0x4b58('0xf'),'appdata':util[_0x4b58('0x10')](_0x4b58('0x11'),_0x13708e[_0x480268][0x0][_0x4b58('0x12')]),'context':_0x13708e[_0x480268][0x0][_0x4b58('0x13')],'exten':_0x13708e[_0x480268][0x0]['exten'],'priority':_0x1bf6e1[_0x4b58('0xc')]++,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});if(_0x13708e[_0x480268][0x0][_0x4b58('0x12')]===_0x4b58('0x15')){if(_0x1bf6e1[_0x4b58('0x16')]){_0x1bf6e1[_0x4b58('0xd')]['push']({'type':_0x13708e[_0x480268][0x0][_0x4b58('0x12')],'app':_0x4b58('0xf'),'appdata':_0x4b58('0x17')+(_0x1bf6e1[_0x4b58('0x16')][_0x4b58('0x18')]?_0x4b58('0x19')+_0x1bf6e1[_0x4b58('0x16')]['cutdigits']+'}':_0x4b58('0x1a')),'context':_0x13708e[_0x480268][0x0]['context'],'exten':_0x13708e[_0x480268][0x0]['exten'],'priority':_0x1bf6e1[_0x4b58('0xc')]++,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});}_0x1bf6e1['extensions']['push']({'type':_0x13708e[_0x480268][0x0][_0x4b58('0x12')],'app':_0x4b58('0xf'),'appdata':_0x4b58('0x1b')+_0x13708e[_0x480268][0x0][_0x4b58('0x14')],'context':_0x13708e[_0x480268][0x0][_0x4b58('0x13')],'exten':_0x13708e[_0x480268][0x0][_0x4b58('0x7')],'priority':_0x1bf6e1['priority']++,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});var _0x42eff5=_0x1bf6e1[_0x4b58('0xc')]++;_0x1bf6e1[_0x4b58('0xd')][_0x4b58('0x1c')]({'type':_0x13708e[_0x480268][0x0]['type'],'app':_0x4b58('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x42eff5+0x2)+'):Goto('+(_0x42eff5+0x1)+')','context':_0x13708e[_0x480268][0x0][_0x4b58('0x13')],'exten':_0x13708e[_0x480268][0x0][_0x4b58('0x7')],'priority':_0x42eff5,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});if(_0x1bf6e1['extension']){_0x1bf6e1[_0x4b58('0xd')]['push']({'type':_0x13708e[_0x480268][0x0][_0x4b58('0x12')],'app':'Set','appdata':_0x1bf6e1[_0x4b58('0x16')][_0x4b58('0x18')]?_0x4b58('0x1e')+_0x1bf6e1[_0x4b58('0x16')]['cutdigits']+'}':_0x4b58('0x1f'),'context':_0x13708e[_0x480268][0x0][_0x4b58('0x13')],'exten':_0x13708e[_0x480268][0x0]['exten'],'priority':_0x1bf6e1['priority']++,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});}_0x1bf6e1[_0x4b58('0xd')][_0x4b58('0x1c')]({'type':_0x13708e[_0x480268][0x0]['type'],'app':_0x4b58('0xf'),'appdata':_0x4b58('0x20')+_0x13708e[_0x480268][0x0][_0x4b58('0x14')],'context':_0x13708e[_0x480268][0x0]['context'],'exten':_0x13708e[_0x480268][0x0][_0x4b58('0x7')],'priority':_0x1bf6e1[_0x4b58('0xc')]++,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});if(_0x1bf6e1[_0x4b58('0x16')]&&_0x1bf6e1[_0x4b58('0x16')][_0x4b58('0xb')](_0x4b58('0x21'))&&_0x1bf6e1['extension'][_0x4b58('0x21')]!==_0x4b58('0x22')){_0x1bf6e1[_0x4b58('0xd')][_0x4b58('0x1c')]({'type':_0x13708e[_0x480268][0x0][_0x4b58('0x12')],'app':_0x4b58('0xf'),'appdata':_0x4b58('0x23'),'context':_0x13708e[_0x480268][0x0]['context'],'exten':_0x13708e[_0x480268][0x0]['exten'],'priority':_0x1bf6e1[_0x4b58('0xc')]++,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});_0x1bf6e1[_0x4b58('0xd')]['push']({'type':_0x13708e[_0x480268][0x0][_0x4b58('0x12')],'app':_0x4b58('0xf'),'appdata':_0x4b58('0x24')+_0x1bf6e1[_0x4b58('0x16')][_0x4b58('0x21')]||_0x4b58('0x25'),'context':_0x13708e[_0x480268][0x0][_0x4b58('0x13')],'exten':_0x13708e[_0x480268][0x0][_0x4b58('0x7')],'priority':_0x1bf6e1[_0x4b58('0xc')]++,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});}}_0x1bf6e1[_0x4b58('0xd')][_0x4b58('0x1c')]({'type':_0x13708e[_0x480268][0x0][_0x4b58('0x12')],'app':_0x4b58('0xf'),'appdata':_0x4b58('0x26'),'context':_0x13708e[_0x480268][0x0][_0x4b58('0x13')],'exten':_0x13708e[_0x480268][0x0][_0x4b58('0x7')],'priority':_0x1bf6e1[_0x4b58('0xc')]++,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});_0x1bf6e1[_0x4b58('0xd')][_0x4b58('0x1c')]({'type':_0x13708e[_0x480268][0x0][_0x4b58('0x12')],'app':'Set','appdata':_0x4b58('0x27'),'context':_0x13708e[_0x480268][0x0][_0x4b58('0x13')],'exten':_0x13708e[_0x480268][0x0][_0x4b58('0x7')],'priority':_0x1bf6e1['priority']++,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});_0x1bf6e1['extensions'][_0x4b58('0x1c')]({'type':_0x13708e[_0x480268][0x0][_0x4b58('0x12')],'app':_0x4b58('0xf'),'appdata':_0x4b58('0x28'),'context':_0x13708e[_0x480268][0x0]['context'],'exten':_0x13708e[_0x480268][0x0][_0x4b58('0x7')],'priority':_0x1bf6e1[_0x4b58('0xc')]++,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});for(var _0x96d531=0x0,_0x11ffd6=0x0;_0x96d531<_0x13708e[_0x480268][_0x4b58('0x29')];_0x96d531+=0x1,_0x11ffd6=0x0){var _0x4de802=_0x13708e[_0x480268][_0x96d531];if(_0x4de802['type']){_0x4de802[_0x4b58('0x12')]=_0x4de802[_0x4b58('0x12')][_0x4b58('0x2a')]();}var _0x1bb25b=[];var _0x27ab66=[];delete _0x4de802['id'];delete _0x4de802['createdAt'];delete _0x4de802['updatedAt'];var _0x5925b2=_0x4de802[_0x4b58('0x2b')]!=='*,*,*,*'?[_0x4de802[_0x4b58('0x2b')]]:_0x4de802[_0x4b58('0x2c')]?_['map'](_[_0x4b58('0x8')](_0x1bf6e1['intervals'],{'IntervalId':_0x4de802[_0x4b58('0x2c')]}),_0x4b58('0x2b')):[];if(_0x4de802[_0x4b58('0xb')](_0x4b58('0x2d'))){if(_0x4de802[_0x4b58('0x2d')]&&_0x4de802['tag']!=='--'){_0x1bb25b['push']({'type':_0x4de802[_0x4b58('0x12')],'app':'Set','appdata':_0x4b58('0x2e')+_0x4de802[_0x4b58('0x2d')],'context':_0x4de802[_0x4b58('0x13')],'exten':_0x4de802['exten'],'priority':_0x5925b2['length']+_0x1bf6e1[_0x4b58('0xc')]+_0x11ffd6++,'VoiceExtensionId':_0x4de802[_0x4b58('0x14')]});}}if(_0x4de802['type']===_0x4b58('0x15')&&_0x4de802['hasOwnProperty'](_0x4b58('0x2f'))){if(_0x4de802[_0x4b58('0x2f')]){_0x1bb25b[_0x4b58('0x1c')]({'type':_0x4de802['type'],'app':'ExecIf','appdata':_0x4b58('0x30')+_0x4de802[_0x4b58('0x2f')]+')','context':_0x4de802['context'],'exten':_0x4de802['exten'],'priority':_0x5925b2[_0x4b58('0x29')]+_0x1bf6e1[_0x4b58('0xc')]+_0x11ffd6++,'VoiceExtensionId':_0x4de802[_0x4b58('0x14')]});}else{_0x1bb25b[_0x4b58('0x1c')]({'type':_0x4de802[_0x4b58('0x12')],'app':_0x4b58('0x1d'),'appdata':_0x4b58('0x31'),'context':_0x4de802['context'],'exten':_0x4de802[_0x4b58('0x7')],'priority':_0x5925b2[_0x4b58('0x29')]+_0x1bf6e1[_0x4b58('0xc')]+_0x11ffd6++,'VoiceExtensionId':_0x4de802[_0x4b58('0x14')]});}}if(_0x4de802['hasOwnProperty'](_0x4b58('0x32'))){if(_0xc60643[_0x4b58('0x33')](_0x4de802[_0x4b58('0x34')][_0x4b58('0x2a')]())>=0x0&&_0x4de802[_0x4b58('0x35')]!==_0x4b58('0x36')){if(_0x4de802[_0x4b58('0x32')]){_0x1bb25b[_0x4b58('0x1c')]({'type':_0x4de802[_0x4b58('0x12')],'app':_0x4b58('0x1d'),'appdata':_0x4b58('0x37'),'context':_0x4de802[_0x4b58('0x13')],'exten':_0x4de802[_0x4b58('0x7')],'priority':_0x5925b2[_0x4b58('0x29')]+_0x1bf6e1['priority']+_0x11ffd6++,'VoiceExtensionId':_0x4de802['VoiceExtensionId']});_0x1bb25b[_0x4b58('0x1c')]({'type':_0x4de802[_0x4b58('0x12')],'app':_0x4b58('0xf'),'appdata':_0x4b58('0x38'),'context':_0x4de802[_0x4b58('0x13')],'exten':_0x4de802[_0x4b58('0x7')],'priority':_0x5925b2['length']+_0x1bf6e1[_0x4b58('0xc')]+_0x11ffd6++,'VoiceExtensionId':_0x4de802[_0x4b58('0x14')]});}else{_0x1bb25b[_0x4b58('0x1c')]({'type':_0x4de802[_0x4b58('0x12')],'app':_0x4b58('0x1d'),'appdata':_0x4b58('0x39'),'context':_0x4de802[_0x4b58('0x13')],'exten':_0x4de802[_0x4b58('0x7')],'priority':_0x5925b2[_0x4b58('0x29')]+_0x1bf6e1[_0x4b58('0xc')]+_0x11ffd6++,'VoiceExtensionId':_0x4de802[_0x4b58('0x14')]});_0x1bb25b[_0x4b58('0x1c')]({'type':_0x4de802[_0x4b58('0x12')],'app':'Set','appdata':_0x4b58('0x3a'),'context':_0x4de802[_0x4b58('0x13')],'exten':_0x4de802[_0x4b58('0x7')],'priority':_0x5925b2[_0x4b58('0x29')]+_0x1bf6e1[_0x4b58('0xc')]+_0x11ffd6++,'VoiceExtensionId':_0x4de802[_0x4b58('0x14')]});}}}for(var _0x47f7c6=0x0;_0x47f7c6<_0x5925b2['length'];_0x47f7c6+=0x1){var _0x2f2f6b=_0x1bf6e1[_0x4b58('0xc')]+_0x5925b2[_0x4b58('0x29')];var _0x477c13=_0x47f7c6===_0x5925b2['length']-0x1?_0x1bf6e1[_0x4b58('0xc')]+_0x1bb25b[_0x4b58('0x29')]+_0x27ab66[_0x4b58('0x29')]+0x2:_0x1bf6e1['priority']+_0x47f7c6+0x1;_0x1bb25b[_0x4b58('0x3b')](_0x47f7c6,0x0,{'type':_0x4de802['type'],'app':_0x4b58('0x3c'),'appdata':_0x5925b2[_0x47f7c6]+'?'+_0x4de802[_0x4b58('0x13')]+',${EXTEN},'+_0x2f2f6b+':'+_0x4de802[_0x4b58('0x13')]+',${EXTEN},'+_0x477c13,'exten':_0x4de802[_0x4b58('0x7')],'context':_0x4de802[_0x4b58('0x13')],'priority':_0x1bf6e1[_0x4b58('0xc')]+_0x47f7c6,'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});}_0x4de802[_0x4b58('0xc')]=_0x1bb25b[_0x4b58('0x29')]?_[_0x4b58('0x3d')](_0x1bb25b)['priority']+0x1:_0x1bf6e1[_0x4b58('0xc')];_0x1bf6e1[_0x4b58('0xc')]=(_0x27ab66['length']?_[_0x4b58('0x3d')](_0x27ab66)[_0x4b58('0xc')]:_0x4de802['priority'])+0x1;_0x1bf6e1[_0x4b58('0xd')]=_[_0x4b58('0x3e')](_0x1bf6e1[_0x4b58('0xd')],_0x1bb25b,[_0x4de802],_0x27ab66);}_0x1bf6e1[_0x4b58('0xd')][_0x4b58('0x1c')]({'type':_0x13708e[_0x480268][0x0][_0x4b58('0x12')],'app':_0x4b58('0x3f'),'exten':_0x13708e[_0x480268][0x0]['exten'],'context':_0x13708e[_0x480268][0x0][_0x4b58('0x13')],'priority':_0x1bf6e1[_0x4b58('0xc')],'VoiceExtensionId':_0x13708e[_0x480268][0x0][_0x4b58('0x14')]});_0x4d0b79['push'](_0x13708e[_0x480268][0x0][_0x4b58('0x14')]);_0x4a6a6a=_[_0x4b58('0x3e')](_0x4a6a6a,_0x1bf6e1[_0x4b58('0xd')]);}}return _0x39a445[_0x4b58('0x40')](function(_0x6ad66e){return _0x39a445[_0x4b58('0x4')][_0x4b58('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x4d0b79}},'transaction':_0x6ad66e})['then'](function(_0x1e80f9){return _0x39a445['models'][_0x4b58('0x5')][_0x4b58('0x41')](_[_0x4b58('0x42')](_0x4a6a6a,_0x4b58('0xc')),{'transaction':_0x6ad66e});});});})[_0x4b58('0x43')](function(_0x59c65d){console[_0x4b58('0x44')](_0x59c65d);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index fd60aac..cb4af85 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 _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x49b632,_0x4157bc){var _0x481b93=function(_0x4fc3f8){while(--_0x4fc3f8){_0x49b632['push'](_0x49b632['shift']());}};_0x481b93(++_0x4157bc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);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(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){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))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +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(_0x262d7b,_0x3ec3e8){var _0x582939=function(_0x565e2a){while(--_0x565e2a){_0x262d7b['push'](_0x262d7b['shift']());}};_0x582939(++_0x3ec3e8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index ea46b46..3876f26 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 _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x524be8,_0x17d4a8){var _0x462bc6=function(_0x36e483){while(--_0x36e483){_0x524be8['push'](_0x524be8['shift']());}};_0x462bc6(++_0x17d4a8);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));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'](_0x7995('0xe'));function isEmail(_0x3116fb){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))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x167ee5,_0x3f216a){var _0x3b3b04=function(_0x246431){while(--_0x246431){_0x167ee5['push'](_0x167ee5['shift']());}};_0x3b3b04(++_0x3f216a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));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'](_0x7995('0xe'));function isEmail(_0x3116fb){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))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),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 90cabb1..ba09d33 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 _0x3a50=['CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','into','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_contact_has_items.updatedAt','cm_hopper_additional_phones','fromQuery','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','errors','code','stringify','send','start','clone','socket_timestamp','root','.csv','ContactItemType','name','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','isValid','firstName','\x20not\x20specified','SystemRow','contact:import:','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','exit','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','format','cm_contacts_temp_','select','field','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','all','then','catch','message','split','filter','CmContactHasItem','findOne','create','PHONE','inserted'];(function(_0x3e4e78,_0x501418){var _0x11b1aa=function(_0x411b48){while(--_0x411b48){_0x3e4e78['push'](_0x3e4e78['shift']());}};_0x11b1aa(++_0x501418);}(_0x3a50,0x1ab));var _0x03a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a50[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0x03a5('0x0'));var _=require('lodash');var Papa=require(_0x03a5('0x1'));var util=require(_0x03a5('0x2'));var BPromise=require('bluebird');var moment=require(_0x03a5('0x3'));var squel=require(_0x03a5('0x4'));var Redis=require(_0x03a5('0x5'));var db=require(_0x03a5('0x6'))['db'];var config=require(_0x03a5('0x7'));var logger=require('../../../config/logger')(_0x03a5('0x8'));config[_0x03a5('0x9')]=_[_0x03a5('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03a5('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()[_0x03a5('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x03a5('0xc')+moment()[_0x03a5('0xb')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x4d2c9a){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'](_0x4d2c9a);}function selectNotIn(_0x35d907,_0x326ac3,_0x155af7,_0x2b5925,_0xb025f2){return squel[_0x03a5('0xd')]()[_0x03a5('0xe')]('phone')[_0x03a5('0xf')](_0x2b5925)['join'](_0x326ac3,null,_0x326ac3+_0x03a5('0x10')+_0x2b5925+'.'+_0x155af7)[_0x03a5('0x11')](_0x2b5925+'.'+_0x155af7+_0x03a5('0x12')+_0x35d907+'.'+_0x155af7)[_0x03a5('0x11')](_0x326ac3+_0x03a5('0x13')+_0xb025f2[_0x03a5('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x34aa45,_0x5c625e){promisesAdditionalPhones=[];promisesContact=[];return db[_0x03a5('0x15')][_0x03a5('0x16')](_0x03a5('0x17')+tempTableName)[_0x03a5('0x18')](function(_0x1e79f8){if(_0x1e79f8!==null){var _0x388baf=[];for(var _0x86da3e=0x0;_0x86da3e<_0x1e79f8[_0x03a5('0x19')];_0x86da3e++){var _0x2a323e=_0x1e79f8[_0x86da3e];if(!_[_0x03a5('0x1a')](_0x2a323e[_0x03a5('0x1b')])){if(!_[_0x03a5('0x1a')](_0x2a323e[_0x03a5('0x1c')]))_0x388baf[_0x03a5('0x1d')](insertAdditionalPhones(_0x2a323e));promisesContact[_0x03a5('0x1d')]({'contact':_0x2a323e});}}}Promise[_0x03a5('0x1e')](_0x388baf)[_0x03a5('0x1f')](function(){_0x34aa45({'val':0x1});});})[_0x03a5('0x20')](function(_0x2cb7fa){logger['error'](_0x2cb7fa[_0x03a5('0x21')]);});});}function insertAdditionalPhones(_0x447e23){return new Promise(function(_0x21bab3,_0x4a6c44){var _0x3b2207=_0x447e23[_0x03a5('0x1c')];if(_[_0x03a5('0x1a')](_0x3b2207))_0x4a6c44({'val':0x0});else{var _0x4f0ad8=_0x3b2207[_0x03a5('0x22')](';');var _0x52dbdc=[];orderBy=0x0;for(var _0x4da30d=0x0;_0x4da30d<_0x4f0ad8['length'];_0x4da30d++){_0x52dbdc['push'](splitAdditionalPhone(_0x447e23['id'],_0x4f0ad8[_0x4da30d]));}Promise[_0x03a5('0x1e')](_0x52dbdc)[_0x03a5('0x1f')](function(){_0x21bab3({'val':_0x4f0ad8[_0x03a5('0x19')]});});}});}function splitAdditionalPhone(_0xacfffb,_0x4227d8){return new Promise(function(_0x179abe,_0xd443b8){var _0x3bfe8d=_0x4227d8[_0x03a5('0x22')](':');var _0x50f760=_0x3bfe8d[0x0];var _0x27b71a=_0x3bfe8d[0x1];if(_0x27b71a!==''){var _0x185db3=_0x27b71a[_0x03a5('0x22')]('|');var _0x4a6265=[];for(var _0x4a0fc0=0x0;_0x4a0fc0<_0x185db3[_0x03a5('0x19')];_0x4a0fc0++){if(_0x185db3[_0x4a0fc0]!==''){var _0xb71da7=_[_0x03a5('0x23')](promisesAdditionalPhones,{'contactId':_0xacfffb,'phone':_0x185db3[_0x4a0fc0]});if(_0xb71da7[_0x03a5('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x03a5('0x1d')]({'contactId':_0xacfffb,'contactTypeId':_0x50f760,'phone':_0x185db3[_0x4a0fc0],'orderBy':orderBy});}}}_0x179abe({'ok':0x1});}else _0x179abe({'res':0x0});});}function createAdditionalPhone(_0x2457ea,_0x2cef87,_0x5c267c,_0x2057e8){return new Promise(function(_0x4f22ee,_0x4615ad){return db[_0x03a5('0x24')][_0x03a5('0x25')]({'where':{'CmContactId':_0x2457ea,'item':_0x5c267c}})[_0x03a5('0x1f')](function(_0x51f928){if(_0x51f928){return db['CmContactHasItem']['update']({'ItemTypeId':_0x2cef87,'OrderBy':_0x2057e8},{'where':{'CmContactId':_0x2457ea,'item':_0x5c267c}})[_0x03a5('0x1f')](function(_0x3127ac){_0x4f22ee({'res':'updated'});});}else{return db[_0x03a5('0x24')][_0x03a5('0x26')]({'CmContactId':_0x2457ea,'item':_0x5c267c,'ItemTypeId':_0x2cef87,'OrderBy':_0x2057e8,'ItemClass':_0x03a5('0x27')})[_0x03a5('0x1f')](function(_0x391728){_0x4f22ee({'res':_0x03a5('0x28')});});}});});}function updateContact(_0x28f6d9){return new Promise(function(_0x56ba1b,_0x2b693b){var _0x2ba740=_0x28f6d9['id'];delete _0x28f6d9['id'];return db[_0x03a5('0x29')][_0x03a5('0x2a')](_0x28f6d9,{'where':{'id':_0x2ba740}})[_0x03a5('0x1f')](function(_0x1e3dda){updatedRows+=0x1;return db[_0x03a5('0x2b')][_0x03a5('0x2a')]({'phone':_0x28f6d9['phone']},{'where':{'ContactId':_0x2ba740}})[_0x03a5('0x1f')](function(_0x28a380){_0x56ba1b({'ret':'OK'});});});});}function insertCmHopper(_0x13c52e,_0x41e103,_0x4b10d3,_0x120795,_0xf7c57b){var _0x1de473=[_0x03a5('0x2c'),'cm_contacts.scheduledat',_0x03a5('0x2d'),'cm_contacts.ListId',_0x41e103+'.'+_0x120795,_0x03a5('0x2e'),'cm_contacts.updatedAt',_0x03a5('0x2f'),_0x03a5('0x30'),'\x22'+_0xf7c57b+'\x22'];return squel[_0x03a5('0x31')]()['into'](_0x03a5('0x32'))['fromQuery']([_0x03a5('0x1b'),_0x03a5('0x33'),_0x03a5('0x34'),'ListId',_0x120795,_0x03a5('0x35'),_0x03a5('0x36'),_0x03a5('0x37'),'UserId',_0x03a5('0x38')],squel[_0x03a5('0xd')]()[_0x03a5('0x39')](_0x1de473)['from'](_0x41e103)[_0x03a5('0x14')](_0x03a5('0x3a'),null,_0x03a5('0x3b')+_0x41e103+_0x03a5('0x3c'))['join'](_0x4b10d3,null,_0x4b10d3+_0x03a5('0x10')+_0x41e103+'.'+_0x120795)['where'](_0x41e103+_0x03a5('0x3d'),_0x13c52e)['where'](_0x03a5('0x3e'),NOW)[_0x03a5('0x11')](_0x03a5('0x3f'),selectNotIn(_0x41e103,_0x4b10d3,_0x120795,_0x03a5('0x32'),[_0x03a5('0x40'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x41e103,_0x4b10d3,_0x120795,_0x03a5('0x32'),['\x22always\x22'])))[_0x03a5('0x41')]();}function insertCmHopperBlack(_0x3786da,_0x42fe9,_0xc6d48f,_0x3505b6){var _0x388151=[_0x03a5('0x2c'),'cm_contacts.id',_0x03a5('0x42'),_0x42fe9+'.'+_0x3505b6,_0x03a5('0x2e'),'cm_contacts.updatedAt'];return squel[_0x03a5('0x31')]()[_0x03a5('0x43')](_0x03a5('0x44'))['fromQuery']([_0x03a5('0x1b'),'ContactId',_0x03a5('0x45'),_0x3505b6,_0x03a5('0x35'),_0x03a5('0x36')],squel[_0x03a5('0xd')]()[_0x03a5('0x39')](_0x388151)[_0x03a5('0xf')](_0x42fe9)[_0x03a5('0x14')](_0x03a5('0x3a'),null,_0x03a5('0x3b')+_0x42fe9+_0x03a5('0x3c'))['join'](_0xc6d48f,null,_0xc6d48f+_0x03a5('0x10')+_0x42fe9+'.'+_0x3505b6)[_0x03a5('0x11')](_0x42fe9+'.CmListId\x20=\x20?',_0x3786da)[_0x03a5('0x11')](_0x03a5('0x3e'),NOW)[_0x03a5('0x11')](_0x03a5('0x3f'),squel['select']()[_0x03a5('0xe')](_0x03a5('0x1b'))[_0x03a5('0xf')](_0x03a5('0x44'))[_0x03a5('0x11')]('ListId\x20=\x20?',_0x3786da)[_0x03a5('0x11')](_0x3505b6+_0x03a5('0x46'),_0x42fe9+'.'+_0x3505b6)))[_0x03a5('0x41')]();}function insertCmHopperAdditionalPhones(_0x4a381b){var _0x4e4766=[_0x03a5('0x47'),_0x03a5('0x48'),_0x03a5('0x49'),_0x03a5('0x4a'),_0x03a5('0x4b')];return squel[_0x03a5('0x31')]()['into'](_0x03a5('0x4c'))[_0x03a5('0x4d')]([_0x03a5('0x4e'),_0x03a5('0x1b'),_0x03a5('0x4f'),_0x03a5('0x35'),_0x03a5('0x36')],squel[_0x03a5('0xd')]()[_0x03a5('0x39')](_0x4e4766)[_0x03a5('0xf')]('cm_hopper')[_0x03a5('0x14')](_0x03a5('0x3a'),null,_0x03a5('0x50'))[_0x03a5('0x14')](_0x03a5('0x51'),null,_0x03a5('0x52'))[_0x03a5('0x11')]('cm_hopper.ListId\x20=\x20?',_0x4a381b)[_0x03a5('0x11')](_0x03a5('0x3e'),NOW))[_0x03a5('0x41')]();}function insertCmContact(_0x1ddab7,_0xfa05a,_0x201e83,_0x449e84){var _0x406654=_['concat'](_[_0x03a5('0x53')](_0x449e84),[_0x03a5('0x45'),_0x03a5('0x54'),_0x03a5('0x35'),'updatedAt']);return squel['insert']()[_0x03a5('0x43')](_0x03a5('0x3a'))['fromQuery'](_0x406654,squel[_0x03a5('0xd')]()[_0x03a5('0x39')](_0x406654)[_0x03a5('0xf')](_0xfa05a)[_0x03a5('0x11')]('('+_0x201e83[_0x03a5('0x14')](',')+_0x03a5('0x55'),squel[_0x03a5('0xd')]()[_0x03a5('0x39')](_0x201e83)['from'](_0x03a5('0x3a'))[_0x03a5('0x11')](_0x03a5('0x56'),_0x1ddab7))[_0x03a5('0x11')](_0x03a5('0x57'),squel[_0x03a5('0xd')]()[_0x03a5('0xe')](_0x03a5('0x58'),_0x03a5('0x59'))[_0x03a5('0xf')](_0xfa05a)[_0x03a5('0x5a')](_0x201e83[_0x03a5('0x14')](','))))[_0x03a5('0x41')]();}function handleStop(){logger[_0x03a5('0x5b')](_0x03a5('0x5c'));stopped=!![];}function handleUncaughtException(_0x3497ef){logger[_0x03a5('0x5d')](_0x3497ef[_0x03a5('0x21')]);process['exit'](0x1);}function handleError(_0x332c40,_0x9d08){stats[_0x03a5('0x5e')][_0x03a5('0x1d')]({'name':_0x9d08[_0x03a5('0x5f')],'message':_0x9d08['message'],'row':_0x332c40});}function handleQuery(_0x70d6f9){logger[_0x03a5('0x5b')](_0x70d6f9);return db['sequelize'][_0x03a5('0x16')](_0x70d6f9)[_0x03a5('0x18')](function(_0xbd794a){results[_0x03a5('0x1d')](_0xbd794a);})[_0x03a5('0x20')](function(_0x49ae25){logger[_0x03a5('0x5d')](_0x49ae25['message']);});}function main(_0x509579,_0x2c20dd,_0xf983bb,_0x1c59b0){logger[_0x03a5('0x5b')]('main',_0x509579,JSON[_0x03a5('0x60')](_0x2c20dd));process[_0x03a5('0x61')](_0x03a5('0x62'));var _0x1cabce=_0x2c20dd['binding'];var _0x43914f=_[_0x03a5('0x63')](_0x1cabce);var _0x460193=_0x2c20dd[_0x03a5('0x64')];var _0x42a683=path[_0x03a5('0x14')](config[_0x03a5('0x65')],'server/files/tmp',_0x460193+_0x03a5('0x66'));logger['info']('body',_0x2c20dd);db[_0x03a5('0x67')]['findAll']({'raw':!![],'attributes':['id',_0x03a5('0x68')]})[_0x03a5('0x1f')](function(_0x338021){for(var _0x2a9a7e=0x0;_0x2a9a7e<_0x338021[_0x03a5('0x19')];_0x2a9a7e++){if(_0x338021[_0x2a9a7e][_0x03a5('0x68')]in _0x1cabce){contactItemTypes[_0x03a5('0x1d')](_0x338021[_0x2a9a7e]);delete _0x43914f[_0x338021[_0x2a9a7e][_0x03a5('0x68')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x43914f['AdditionalPhones']='';var _0x5dbc73=_['keys'](_0x43914f)[_0x03a5('0x14')]();logger[_0x03a5('0x5b')](_0x03a5('0x69'),_0x5dbc73);fs[_0x03a5('0x6a')](_0x42a683,_0x5dbc73+'\x0a');Papa[_0x03a5('0x6b')](fs[_0x03a5('0x6c')](_0x509579),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2f269d,_0x450559){try{for(var _0x2726e1=0x0,_0x4e8cd5=[];_0x2726e1<_0x2f269d[_0x03a5('0x6d')]['length'];_0x2726e1++){stats[_0x03a5('0x6e')]+=0x1;if(_0x2f269d[_0x03a5('0x5e')][_0x2726e1]){handleError(_0x2f269d[_0x03a5('0x6d')][_0x2726e1],_0x2f269d[_0x03a5('0x5e')][_0x2726e1]);}else{var _0x5aef2d=[];var _0x599089=[];for(var _0x193248 in _0x1cabce){let _0x2550fc=contactItemTypes[_0x03a5('0x6f')](_0x4066eb=>_0x4066eb[_0x03a5('0x68')]===_0x193248);if(_[_0x03a5('0x1a')](_0x2550fc)){if(_0x1cabce[_0x03a5('0x70')](_0x193248)){if(_0x2f269d['data'][_0x2726e1][_0x1cabce[_0x193248]]){var _0x464223=_[_0x03a5('0x71')](_0x2f269d[_0x03a5('0x6d')][_0x2726e1][_0x1cabce[_0x193248]][_0x03a5('0x72')](/"/g,'\x27'));switch(_0x193248){case _0x03a5('0x33'):var _0x5b0f2b=moment(_0x464223,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5b0f2b['isValid']()){_0x4e8cd5[_0x03a5('0x1d')]('\x22'+_0x464223+'\x22');}else{_0x5aef2d['push'](_0x03a5('0x73'));}break;case _0x03a5('0x37'):var _0x701468=parseInt(_0x464223);_0x464223=_[_0x03a5('0x74')](_0x701468)||_0x701468<0x0||_0x701468>0x4?_0x1c59b0?0x3:0x2:_0x701468;_0x4e8cd5[_0x03a5('0x1d')]('\x22'+_0x464223+'\x22');break;case _0x03a5('0x75'):var _0x32d00d=parseInt(_0x464223);if(_[_0x03a5('0x76')](_0x32d00d)&&_[_0x03a5('0x77')](_0xf983bb,_0x32d00d)){_0x4e8cd5[_0x03a5('0x1d')]('\x22'+_0x32d00d+'\x22');}else{_0x5aef2d[_0x03a5('0x1d')](_0x03a5('0x78'));}break;case _0x03a5('0x79'):if(isEmail(_0x464223)){_0x4e8cd5[_0x03a5('0x1d')]('\x22'+_0x464223+'\x22');}else{_0x5aef2d[_0x03a5('0x1d')](_0x03a5('0x7a'));}break;case'dateOfBirth':var _0x2a2371=moment(_0x464223,'YYYY-MM-DD',!![]);if(_0x2a2371[_0x03a5('0x7b')]()){_0x4e8cd5[_0x03a5('0x1d')]('\x22'+_0x464223+'\x22');}else{_0x5aef2d[_0x03a5('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x4e8cd5[_0x03a5('0x1d')]('\x22'+_0x464223+'\x22');}}else{switch(_0x193248){case _0x03a5('0x7c'):case _0x03a5('0x1b'):_0x5aef2d[_0x03a5('0x1d')](_0x193248+_0x03a5('0x7d'));break;default:_0x4e8cd5['push']('\x22\x22');}}}}else{var _0x3d4a62='';for(var _0x4433d1=0x0;_0x4433d1<_0x1cabce[_0x193248][_0x03a5('0x19')];_0x4433d1++){var _0x464223=_[_0x03a5('0x71')](_0x2f269d['data'][_0x2726e1][_0x1cabce[_0x193248][_0x4433d1]][_0x03a5('0x72')](/"/g,'\x27'));if(_0x3d4a62=='')_0x3d4a62=_0x464223;else _0x3d4a62+='|'+_0x464223;}_0x599089[_0x03a5('0x1d')](_0x2550fc['id']+':'+_0x3d4a62);}}if(hasAdditionalPhones){_0x4e8cd5[_0x03a5('0x1d')]('\x22'+_0x599089[_0x03a5('0x14')](';')+'\x22');}if(_0x5aef2d[_0x03a5('0x19')]){handleError(_0x2f269d['data'][_0x2726e1],{'code':_0x03a5('0x7e'),'message':_0x5aef2d[_0x03a5('0x14')]()});}else{fs['appendFileSync'](_0x42a683,_0x4e8cd5[_0x03a5('0x14')]()+'\x0a');}_0x4e8cd5=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x03a5('0x7f')+_0x460193,stats);stats[_0x03a5('0x5e')]=[];}}if(stopped){logger[_0x03a5('0x5b')](_0x03a5('0x80'));_0x450559['abort']();}}catch(_0x2a52a8){handleError(_0x2f269d[_0x03a5('0x6d')][_0x2726e1],{'code':_0x03a5('0x81'),'message':_0x2a52a8[_0x03a5('0x21')]});logger[_0x03a5('0x5d')](_0x03a5('0x82'),_0x2a52a8[_0x03a5('0x21')]);}},'complete':function(){try{var _0x380ee4=[];var _0x57859f=tempTableName;_0x380ee4[_0x03a5('0x1d')](_0x03a5('0x83')+_0x57859f+_0x03a5('0x84'));logger['info'](_0x03a5('0x85'),contactItemTypes[_0x03a5('0x19')]);var _0x22bc84=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x42a683,_0x57859f,_0x5dbc73,_0x2c20dd[_0x03a5('0x45')],_0x2c20dd[_0x03a5('0x54')]||null,NOW,NOW);if(_[_0x03a5('0x1a')](_0x1cabce['scheduledat'])){_0x22bc84+=_0x03a5('0x86');}_0x380ee4[_0x03a5('0x1d')](_0x22bc84);BPromise[_0x03a5('0x87')](_0x380ee4,handleQuery)[_0x03a5('0x1f')](function(_0x36db15){BPromise[_0x03a5('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x380ee4=[];for(var _0x2ba6b9=0x0;_0x2ba6b9\x20\x20');}var _0x4ab5d0=path['join'](config['root'],_0x03a5('0x93'),process[_0x03a5('0x92')][0x2]);if(!fs[_0x03a5('0x94')](_0x4ab5d0)){throw new Error(_0x03a5('0x95'));}var _0xb55d7b={};try{_0xb55d7b=JSON[_0x03a5('0x6b')](process[_0x03a5('0x92')][0x3]);if(!_0xb55d7b[_0x03a5('0x96')]){throw new Error(_0x03a5('0x97'));}var _0x5e9ddf=0x0;if(_0xb55d7b['binding'][_0x03a5('0x75')]){_0x5e9ddf=0x1;}if(!_0xb55d7b['ListId']){throw new Error(_0x03a5('0x98'));}}catch(_0x157baf){throw new Error(_0x03a5('0x99'));}var _0x13a90e=[];try{_0x13a90e=_['map'](JSON[_0x03a5('0x6b')](process[_0x03a5('0x92')][0x4]),'id');}catch(_0xcbaf1b){logger[_0x03a5('0x5b')](_0x03a5('0x9a'));}main(_0x4ab5d0,_0xb55d7b,_0x13a90e,_0x5e9ddf);}validate();process['on']('SIGINT',handleStop);process['on'](_0x03a5('0x9b'),handleUncaughtException); \ No newline at end of file +var _0x6556=['firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','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','contact','contactTypeId','orderBy','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','squel','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','format','cm_contacts_temp_','test','select','field','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','updatedAt','priority','recallme','fields','from','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','fromQuery','createdAt','cm_contacts.ListId\x20=\x20','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','message','exit','errors','code','sequelize','query','stringify','start','binding','socket_timestamp','root','.csv','ContactItemType','findAll','name','writeFileSync','parse','createReadStream','data','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD'];(function(_0x4a4106,_0x4bf078){var _0x40ca88=function(_0x1af475){while(--_0x1af475){_0x4a4106['push'](_0x4a4106['shift']());}};_0x40ca88(++_0x4bf078);}(_0x6556,0xc1));var _0x6655=function(_0x2f6097,_0x24d316){_0x2f6097=_0x2f6097-0x0;var _0x1a0ff0=_0x6556[_0x2f6097];return _0x1a0ff0;};'use strict';var fs=require('fs');var path=require(_0x6655('0x0'));var _=require('lodash');var Papa=require(_0x6655('0x1'));var util=require('util');var BPromise=require(_0x6655('0x2'));var moment=require('moment');var squel=require(_0x6655('0x3'));var Redis=require('ioredis');var db=require(_0x6655('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x6655('0x5'))(_0x6655('0x6'));config[_0x6655('0x7')]=_[_0x6655('0x8')](config[_0x6655('0x7')],{'host':_0x6655('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6655('0x7')]));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()[_0x6655('0xa')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x6655('0xb')+moment()[_0x6655('0xa')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x1bd59b){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))*$/[_0x6655('0xc')](_0x1bd59b);}function selectNotIn(_0x22724a,_0x195bf7,_0xfbe93f,_0x4d4360,_0x3790c2){return squel[_0x6655('0xd')]()[_0x6655('0xe')]('phone')['from'](_0x4d4360)[_0x6655('0xf')](_0x195bf7,null,_0x195bf7+_0x6655('0x10')+_0x4d4360+'.'+_0xfbe93f)['where'](_0x4d4360+'.'+_0xfbe93f+_0x6655('0x11')+_0x22724a+'.'+_0xfbe93f)[_0x6655('0x12')](_0x195bf7+_0x6655('0x13')+_0x3790c2[_0x6655('0xf')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x155ebb,_0x45b604){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query'](_0x6655('0x14')+tempTableName)[_0x6655('0x15')](function(_0x1c416c){if(_0x1c416c!==null){var _0x1d7721=[];for(var _0x52e32f=0x0;_0x52e32f<_0x1c416c[_0x6655('0x16')];_0x52e32f++){var _0x330730=_0x1c416c[_0x52e32f];if(!_[_0x6655('0x17')](_0x330730[_0x6655('0x18')])){if(!_[_0x6655('0x17')](_0x330730[_0x6655('0x19')]))_0x1d7721[_0x6655('0x1a')](insertAdditionalPhones(_0x330730));promisesContact[_0x6655('0x1a')]({'contact':_0x330730});}}}Promise[_0x6655('0x1b')](_0x1d7721)[_0x6655('0x1c')](function(){_0x155ebb({'val':0x1});});})[_0x6655('0x1d')](function(_0x975cbd){logger[_0x6655('0x1e')](_0x975cbd['message']);});});}function insertAdditionalPhones(_0x5a6e87){return new Promise(function(_0x2b7823,_0x45a885){var _0x47fdcc=_0x5a6e87[_0x6655('0x19')];if(_['isNil'](_0x47fdcc))_0x45a885({'val':0x0});else{var _0x8fb12a=_0x47fdcc[_0x6655('0x1f')](';');var _0x439eee=[];orderBy=0x0;for(var _0x18233f=0x0;_0x18233f<_0x8fb12a['length'];_0x18233f++){_0x439eee[_0x6655('0x1a')](splitAdditionalPhone(_0x5a6e87['id'],_0x8fb12a[_0x18233f]));}Promise[_0x6655('0x1b')](_0x439eee)[_0x6655('0x1c')](function(){_0x2b7823({'val':_0x8fb12a[_0x6655('0x16')]});});}});}function splitAdditionalPhone(_0x128e0f,_0x353692){return new Promise(function(_0x11a33f,_0x19421d){var _0x313eaf=_0x353692[_0x6655('0x1f')](':');var _0x4fef79=_0x313eaf[0x0];var _0x4a6b07=_0x313eaf[0x1];if(_0x4a6b07!==''){var _0x3d79fc=_0x4a6b07['split']('|');var _0x320dcd=[];for(var _0xf1f07a=0x0;_0xf1f07a<_0x3d79fc[_0x6655('0x16')];_0xf1f07a++){if(_0x3d79fc[_0xf1f07a]!==''){var _0x1f0f4e=_[_0x6655('0x20')](promisesAdditionalPhones,{'contactId':_0x128e0f,'phone':_0x3d79fc[_0xf1f07a]});if(_0x1f0f4e['length']==0x0){orderBy++;promisesAdditionalPhones[_0x6655('0x1a')]({'contactId':_0x128e0f,'contactTypeId':_0x4fef79,'phone':_0x3d79fc[_0xf1f07a],'orderBy':orderBy});}}}_0x11a33f({'ok':0x1});}else _0x11a33f({'res':0x0});});}function createAdditionalPhone(_0x525b15,_0x5cbeb1,_0x29234d,_0x3f2af5){return new Promise(function(_0x5dcfbd,_0x4bf22e){return db[_0x6655('0x21')][_0x6655('0x22')]({'where':{'CmContactId':_0x525b15,'item':_0x29234d}})[_0x6655('0x1c')](function(_0x4f47fd){if(_0x4f47fd){return db[_0x6655('0x21')][_0x6655('0x23')]({'ItemTypeId':_0x5cbeb1,'OrderBy':_0x3f2af5},{'where':{'CmContactId':_0x525b15,'item':_0x29234d}})[_0x6655('0x1c')](function(_0x196b88){_0x5dcfbd({'res':_0x6655('0x24')});});}else{return db[_0x6655('0x21')][_0x6655('0x25')]({'CmContactId':_0x525b15,'item':_0x29234d,'ItemTypeId':_0x5cbeb1,'OrderBy':_0x3f2af5,'ItemClass':_0x6655('0x26')})[_0x6655('0x1c')](function(_0x29a0dc){_0x5dcfbd({'res':'inserted'});});}});});}function updateContact(_0x873efe){return new Promise(function(_0x238741,_0x20d18f){var _0x2ca1fe=_0x873efe['id'];delete _0x873efe['id'];return db['CmContact']['update'](_0x873efe,{'where':{'id':_0x2ca1fe}})['then'](function(_0x280704){updatedRows+=0x1;return db[_0x6655('0x27')]['update']({'phone':_0x873efe['phone']},{'where':{'ContactId':_0x2ca1fe}})[_0x6655('0x1c')](function(_0x321d24){_0x238741({'ret':'OK'});});});});}function insertCmHopper(_0x462832,_0x167c42,_0x2a0068,_0xa49958,_0x1a8368){var _0xc7293d=['cm_contacts.phone',_0x6655('0x28'),_0x6655('0x29'),_0x6655('0x2a'),_0x167c42+'.'+_0xa49958,_0x6655('0x2b'),_0x6655('0x2c'),_0x6655('0x2d'),_0x6655('0x2e'),'\x22'+_0x1a8368+'\x22'];return squel[_0x6655('0x2f')]()[_0x6655('0x30')](_0x6655('0x31'))['fromQuery']([_0x6655('0x18'),_0x6655('0x32'),_0x6655('0x33'),_0x6655('0x34'),_0xa49958,'createdAt',_0x6655('0x35'),_0x6655('0x36'),'UserId',_0x6655('0x37')],squel[_0x6655('0xd')]()[_0x6655('0x38')](_0xc7293d)[_0x6655('0x39')](_0x167c42)[_0x6655('0xf')](_0x6655('0x3a'),null,'cm_contacts.ListId\x20=\x20'+_0x167c42+_0x6655('0x3b'))[_0x6655('0xf')](_0x2a0068,null,_0x2a0068+_0x6655('0x10')+_0x167c42+'.'+_0xa49958)['where'](_0x167c42+_0x6655('0x3c'),_0x462832)[_0x6655('0x12')](_0x6655('0x3d'),NOW)['where'](_0x6655('0x3e'),selectNotIn(_0x167c42,_0x2a0068,_0xa49958,_0x6655('0x31'),[_0x6655('0x3f'),_0x6655('0x40')]))[_0x6655('0x12')](_0x6655('0x3e'),selectNotIn(_0x167c42,_0x2a0068,_0xa49958,_0x6655('0x31'),[_0x6655('0x3f')])))[_0x6655('0x41')]();}function insertCmHopperBlack(_0x311768,_0x477bfb,_0x507b64,_0x44398d){var _0x371d49=[_0x6655('0x42'),_0x6655('0x29'),_0x6655('0x2a'),_0x477bfb+'.'+_0x44398d,_0x6655('0x2b'),_0x6655('0x2c')];return squel[_0x6655('0x2f')]()[_0x6655('0x30')]('cm_hopper_black')[_0x6655('0x43')]([_0x6655('0x18'),_0x6655('0x33'),_0x6655('0x34'),_0x44398d,_0x6655('0x44'),_0x6655('0x35')],squel[_0x6655('0xd')]()[_0x6655('0x38')](_0x371d49)[_0x6655('0x39')](_0x477bfb)['join'](_0x6655('0x3a'),null,_0x6655('0x45')+_0x477bfb+_0x6655('0x3b'))[_0x6655('0xf')](_0x507b64,null,_0x507b64+'.id\x20=\x20'+_0x477bfb+'.'+_0x44398d)[_0x6655('0x12')](_0x477bfb+_0x6655('0x3c'),_0x311768)[_0x6655('0x12')](_0x6655('0x3d'),NOW)['where'](_0x6655('0x3e'),squel['select']()[_0x6655('0xe')](_0x6655('0x18'))[_0x6655('0x39')](_0x6655('0x46'))['where'](_0x6655('0x47'),_0x311768)[_0x6655('0x12')](_0x44398d+_0x6655('0x48'),_0x477bfb+'.'+_0x44398d)))['toString']();}function insertCmHopperAdditionalPhones(_0x4afad7){var _0x23a756=[_0x6655('0x49'),_0x6655('0x4a'),_0x6655('0x4b'),'cm_contact_has_items.createdAt',_0x6655('0x4c')];return squel[_0x6655('0x2f')]()[_0x6655('0x30')](_0x6655('0x4d'))[_0x6655('0x43')]([_0x6655('0x4e'),_0x6655('0x18'),_0x6655('0x4f'),_0x6655('0x44'),_0x6655('0x35')],squel[_0x6655('0xd')]()['fields'](_0x23a756)[_0x6655('0x39')](_0x6655('0x31'))['join'](_0x6655('0x3a'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6655('0xf')]('cm_contact_has_items',null,_0x6655('0x50'))[_0x6655('0x12')](_0x6655('0x51'),_0x4afad7)[_0x6655('0x12')](_0x6655('0x3d'),NOW))[_0x6655('0x41')]();}function insertCmContact(_0x2d907b,_0x5d3c51,_0x18f6ed,_0x1ab739){var _0x4e271a=_['concat'](_[_0x6655('0x52')](_0x1ab739),[_0x6655('0x34'),'CompanyId',_0x6655('0x44'),_0x6655('0x35')]);return squel['insert']()['into']('cm_contacts')[_0x6655('0x43')](_0x4e271a,squel[_0x6655('0xd')]()[_0x6655('0x38')](_0x4e271a)[_0x6655('0x39')](_0x5d3c51)[_0x6655('0x12')]('('+_0x18f6ed[_0x6655('0xf')](',')+_0x6655('0x53'),squel[_0x6655('0xd')]()[_0x6655('0x38')](_0x18f6ed)['from'](_0x6655('0x3a'))[_0x6655('0x12')](_0x6655('0x47'),_0x2d907b))[_0x6655('0x12')]('id\x20IN\x20?',squel[_0x6655('0xd')]()[_0x6655('0xe')](_0x6655('0x54'),_0x6655('0x55'))[_0x6655('0x39')](_0x5d3c51)[_0x6655('0x56')](_0x18f6ed['join'](','))))['toString']();}function handleStop(){logger[_0x6655('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4413f5){logger[_0x6655('0x1e')](_0x4413f5[_0x6655('0x58')]);process[_0x6655('0x59')](0x1);}function handleError(_0x158b4f,_0x3da9a1){stats[_0x6655('0x5a')][_0x6655('0x1a')]({'name':_0x3da9a1[_0x6655('0x5b')],'message':_0x3da9a1['message'],'row':_0x158b4f});}function handleQuery(_0x2dffc2){logger[_0x6655('0x57')](_0x2dffc2);return db[_0x6655('0x5c')][_0x6655('0x5d')](_0x2dffc2)[_0x6655('0x15')](function(_0x154ac9){results[_0x6655('0x1a')](_0x154ac9);})[_0x6655('0x1d')](function(_0x41aca7){logger[_0x6655('0x1e')](_0x41aca7['message']);});}function main(_0x518c76,_0x3f12bb,_0x3ae8e3,_0x3e6b4b){logger[_0x6655('0x57')]('main',_0x518c76,JSON[_0x6655('0x5e')](_0x3f12bb));process['send'](_0x6655('0x5f'));var _0x19726a=_0x3f12bb[_0x6655('0x60')];var _0x76b565=_['clone'](_0x19726a);var _0xff9512=_0x3f12bb[_0x6655('0x61')];var _0x4dc455=path[_0x6655('0xf')](config[_0x6655('0x62')],'server/files/tmp',_0xff9512+_0x6655('0x63'));logger[_0x6655('0x57')]('body',_0x3f12bb);db[_0x6655('0x64')][_0x6655('0x65')]({'raw':!![],'attributes':['id',_0x6655('0x66')]})[_0x6655('0x1c')](function(_0x172dbe){for(var _0x453d99=0x0;_0x453d99<_0x172dbe[_0x6655('0x16')];_0x453d99++){if(_0x172dbe[_0x453d99]['name']in _0x19726a){contactItemTypes[_0x6655('0x1a')](_0x172dbe[_0x453d99]);delete _0x76b565[_0x172dbe[_0x453d99][_0x6655('0x66')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x76b565['AdditionalPhones']='';var _0x133c4c=_[_0x6655('0x52')](_0x76b565)[_0x6655('0xf')]();logger[_0x6655('0x57')]('header',_0x133c4c);fs[_0x6655('0x67')](_0x4dc455,_0x133c4c+'\x0a');Papa[_0x6655('0x68')](fs[_0x6655('0x69')](_0x518c76),{'header':!![],'skipEmptyLines':!![],'step':function(_0x30b403,_0x324c30){try{for(var _0x571ef2=0x0,_0x20782b=[];_0x571ef2<_0x30b403[_0x6655('0x6a')][_0x6655('0x16')];_0x571ef2++){stats['rows']+=0x1;if(_0x30b403[_0x6655('0x5a')][_0x571ef2]){handleError(_0x30b403['data'][_0x571ef2],_0x30b403[_0x6655('0x5a')][_0x571ef2]);}else{var _0x59cf03=[];var _0x5677de=[];for(var _0x20a744 in _0x19726a){let _0x819adf=contactItemTypes['find'](_0x4c5629=>_0x4c5629[_0x6655('0x66')]===_0x20a744);if(_[_0x6655('0x17')](_0x819adf)){if(_0x19726a[_0x6655('0x6b')](_0x20a744)){if(_0x30b403[_0x6655('0x6a')][_0x571ef2][_0x19726a[_0x20a744]]){var _0x2413a8=_['trim'](_0x30b403['data'][_0x571ef2][_0x19726a[_0x20a744]][_0x6655('0x6c')](/"/g,'\x27'));switch(_0x20a744){case _0x6655('0x32'):var _0x2faa59=moment(_0x2413a8,_0x6655('0x6d'),!![]);if(_0x2faa59[_0x6655('0x6e')]()){_0x20782b[_0x6655('0x1a')]('\x22'+_0x2413a8+'\x22');}else{_0x59cf03['push'](_0x6655('0x6f'));}break;case'priority':var _0x26d6ad=parseInt(_0x2413a8);_0x2413a8=_[_0x6655('0x70')](_0x26d6ad)||_0x26d6ad<0x0||_0x26d6ad>0x4?_0x3e6b4b?0x3:0x2:_0x26d6ad;_0x20782b[_0x6655('0x1a')]('\x22'+_0x2413a8+'\x22');break;case _0x6655('0x71'):var _0x431958=parseInt(_0x2413a8);if(_[_0x6655('0x72')](_0x431958)&&_[_0x6655('0x73')](_0x3ae8e3,_0x431958)){_0x20782b[_0x6655('0x1a')]('\x22'+_0x431958+'\x22');}else{_0x59cf03[_0x6655('0x1a')](_0x6655('0x74'));}break;case _0x6655('0x75'):if(isEmail(_0x2413a8)){_0x20782b[_0x6655('0x1a')]('\x22'+_0x2413a8+'\x22');}else{_0x59cf03[_0x6655('0x1a')](_0x6655('0x76'));}break;case _0x6655('0x77'):var _0x407f89=moment(_0x2413a8,_0x6655('0x78'),!![]);if(_0x407f89[_0x6655('0x6e')]()){_0x20782b[_0x6655('0x1a')]('\x22'+_0x2413a8+'\x22');}else{_0x59cf03[_0x6655('0x1a')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x20782b[_0x6655('0x1a')]('\x22'+_0x2413a8+'\x22');}}else{switch(_0x20a744){case _0x6655('0x79'):case _0x6655('0x18'):_0x59cf03[_0x6655('0x1a')](_0x20a744+_0x6655('0x7a'));break;default:_0x20782b[_0x6655('0x1a')]('\x22\x22');}}}}else{var _0x1d5df9='';for(var _0x232ec4=0x0;_0x232ec4<_0x19726a[_0x20a744]['length'];_0x232ec4++){var _0x2413a8=_['trim'](_0x30b403[_0x6655('0x6a')][_0x571ef2][_0x19726a[_0x20a744][_0x232ec4]]['replace'](/"/g,'\x27'));if(_0x1d5df9=='')_0x1d5df9=_0x2413a8;else _0x1d5df9+='|'+_0x2413a8;}_0x5677de['push'](_0x819adf['id']+':'+_0x1d5df9);}}if(hasAdditionalPhones){_0x20782b[_0x6655('0x1a')]('\x22'+_0x5677de['join'](';')+'\x22');}if(_0x59cf03[_0x6655('0x16')]){handleError(_0x30b403[_0x6655('0x6a')][_0x571ef2],{'code':_0x6655('0x7b'),'message':_0x59cf03[_0x6655('0xf')]()});}else{fs[_0x6655('0x7c')](_0x4dc455,_0x20782b[_0x6655('0xf')]()+'\x0a');}_0x20782b=[];}if(!(stats[_0x6655('0x7d')]%0xc8)){socket[_0x6655('0x7e')](_0x6655('0x7f')+_0xff9512,stats);stats[_0x6655('0x5a')]=[];}}if(stopped){logger[_0x6655('0x57')](_0x6655('0x80'));_0x324c30[_0x6655('0x81')]();}}catch(_0x4aa254){handleError(_0x30b403[_0x6655('0x6a')][_0x571ef2],{'code':_0x6655('0x82'),'message':_0x4aa254[_0x6655('0x58')]});logger[_0x6655('0x1e')](_0x6655('0x83'),_0x4aa254[_0x6655('0x58')]);}},'complete':function(){try{var _0x245c3f=[];var _0x46bcfc=tempTableName;_0x245c3f[_0x6655('0x1a')](_0x6655('0x84')+_0x46bcfc+_0x6655('0x85'));logger[_0x6655('0x57')](_0x6655('0x86'),contactItemTypes[_0x6655('0x16')]);var _0x4cac50=util['format'](_0x6655('0x87'),_0x4dc455,_0x46bcfc,_0x133c4c,_0x3f12bb['ListId'],_0x3f12bb[_0x6655('0x88')]||null,NOW,NOW);if(_['isNil'](_0x19726a['scheduledat'])){_0x4cac50+=_0x6655('0x89');}_0x245c3f[_0x6655('0x1a')](_0x4cac50);BPromise[_0x6655('0x8a')](_0x245c3f,handleQuery)[_0x6655('0x1c')](function(_0xab6738){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x245c3f=[];for(var _0x177900=0x0;_0x177900=_0x20dc32){return _0x29b36b['status'](0x193)[_0xc037('0x15')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x4317bf)});}_0x53d11f();})['catch'](function(_0x4bfffc){_0x53d11f(_0x4bfffc);});});}function isUserLimit(){return isLimit(_0xc037('0x16'),0x1,db[_0xc037('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0xc037('0x18')}]}});}exports[_0xc037('0x19')]=isUserLimit; \ No newline at end of file +var _0x4ca1=['use','License','findOne','then','count','json','catch','User','admin','user','util','composable-middleware','../../mysqldb','../../config/environment','license','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0x4ca1,0xca));var _0x14ca=function(_0x4b1b3a,_0x239438){_0x4b1b3a=_0x4b1b3a-0x0;var _0x203002=_0x4ca1[_0x4b1b3a];return _0x203002;};'use strict';var crypto=require('crypto');var util=require(_0x14ca('0x0'));var compose=require(_0x14ca('0x1'));var db=require(_0x14ca('0x2'))['db'];var config=require(_0x14ca('0x3'));function getValueFromLicense(_0x12d1d1,_0x552ed9){if(_0x12d1d1&&_0x552ed9){if(_0x552ed9['data1']&&_0x552ed9[_0x14ca('0x4')]){var _0x4cc474=_0x552ed9['data1'];var _0x12dc42=_0x552ed9[_0x14ca('0x4')];var _0x2e2faf=_0x4cc474['split']('-')[0x4];var _0x3b49f7=_0x4cc474['split']('-')[0x0];var _0x4faa4=crypto[_0x14ca('0x5')]('aes-256-ctr',util[_0x14ca('0x6')](_0x14ca('0x7'),_0x2e2faf,_0x4cc474,_0x3b49f7));var _0x5cf0ec=_0x4faa4[_0x14ca('0x8')](_0x12dc42,_0x14ca('0x9'),_0x14ca('0xa'));_0x5cf0ec+=_0x4faa4[_0x14ca('0xb')](_0x14ca('0xa'));var _0x103f34=JSON[_0x14ca('0xc')](_0x5cf0ec);return _0x103f34[_0x14ca('0xd')](_0x12d1d1)?_0x103f34[_0x12d1d1]:null;}}return null;}function isLimit(_0x483374,_0x108c39,_0x567828,_0x3770b0){var _0x3a1dae=_0x108c39;return compose()[_0x14ca('0xe')](function(_0x2fea0c,_0x511ad0,_0x3bea46){return db[_0x14ca('0xf')][_0x14ca('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3e39df){var _0x5b189f=getValueFromLicense(_0x483374,_0x3e39df);return _0x5b189f?_0x5b189f:_0x3a1dae;})[_0x14ca('0x11')](function(_0x1bfaee){_0x3a1dae=_0x1bfaee;return _0x567828[_0x14ca('0x12')](_0x3770b0);})[_0x14ca('0x11')](function(_0x1f9eb9){if(_0x1f9eb9>=_0x3a1dae){return _0x511ad0['status'](0x193)[_0x14ca('0x13')]({'message':util[_0x14ca('0x6')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x483374)});}_0x3bea46();})[_0x14ca('0x14')](function(_0x430020){_0x3bea46(_0x430020);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x14ca('0x15')],{'where':{'$or':[{'role':_0x14ca('0x16')},{'role':_0x14ca('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index adee58f..9d79f41 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 _0xafd8=['days','format','castTo','CAST(','field','\x20AS\x20','text','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','$ne','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$lte','$gte','>=\x20?','$substring','start','shift','pop','utcOffset','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','split','match','forEach','filter','indexOf','conditions','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add'];(function(_0x3784ab,_0x4a422e){var _0x3df9c7=function(_0x5e890d){while(--_0x5e890d){_0x3784ab['push'](_0x3784ab['shift']());}};_0x3df9c7(++_0x4a422e);}(_0xafd8,0x116));var _0x8afd=function(_0x22b2be,_0x4b164c){_0x22b2be=_0x22b2be-0x0;var _0x213c31=_0xafd8[_0x22b2be];return _0x213c31;};'use strict';var _=require('lodash');var moment=require(_0x8afd('0x0'));exports[_0x8afd('0x1')]=function(_0x31bdfc){var _0x181f21={'conditions':[]};_0x181f21[_0x8afd('0x2')]=_[_0x8afd('0x3')](_0x31bdfc,'[$or]')?'or':_0x8afd('0x4');var _0x44c354=_0x31bdfc[_0x8afd('0x5')](_0x8afd('0x6'),'')[_0x8afd('0x5')]('[$or]','')[_0x8afd('0x7')]('||');for(var _0x4e23db=0x0;_0x4e23db<_0x44c354['length'];_0x4e23db++){var _0x4cb66e=_0x44c354[_0x4e23db][_0x8afd('0x7')](':=');var _0x56c39d=_0x4cb66e[0x0];var _0x313c5f=_0x4cb66e['slice'](0x1);_0x313c5f['forEach'](function(_0x49fcc3){var _0x7fae69=_0x49fcc3[_0x8afd('0x7')]('[')['shift']();var _0x21000e=_0x49fcc3[_0x8afd('0x8')](/\[(.*?)\]/g);_0x21000e[_0x8afd('0x9')](function(_0x120acf){var _0x36e50c=_0x120acf[_0x8afd('0x7')]('[')[_0x8afd('0xa')](function(_0x3ec191){return _0x3ec191[_0x8afd('0xb')](']')>-0x1;})['map'](function(_0xabd642){return _0xabd642[_0x8afd('0x7')](']')[0x0];})[0x0];_0x181f21[_0x8afd('0xc')]['push']({'field':_0x56c39d,'operator':_0x7fae69,'value':_0x36e50c});});});}return _0x181f21;};exports[_0x8afd('0xd')]=function(_0x18303c,_0x2ea287,_0x2e11c5){var _0x4b8c35={};if(_0x2ea287===_0x8afd('0xe')){if(_0x2e11c5[_0x8afd('0xf')]===_0x8afd('0x10')){_0x2e11c5['operator']=_0x8afd('0x11');_0x2e11c5['value']+=','+_0x2e11c5[_0x8afd('0x12')];}else if(_[_0x8afd('0x13')]([_0x8afd('0x14'),'$lte'],_0x2e11c5[_0x8afd('0xf')])){_0x2e11c5['value']=moment(_0x2e11c5['value'])[_0x8afd('0x15')](0x1,_0x8afd('0x16'))[_0x8afd('0x17')]('YYYY-MM-DD');}}if(_0x2e11c5['castTo']){_0x2ea287=_0x2e11c5[_0x8afd('0x18')];_0x4b8c35['text']=_0x8afd('0x19')+_0x18303c+'.'+_0x2e11c5[_0x8afd('0x1a')]+_0x8afd('0x1b')+_0x2e11c5[_0x8afd('0x18')]+')\x20'+parseOperator(_0x2e11c5['operator']);}else{_0x4b8c35[_0x8afd('0x1c')]=_0x18303c+'.'+_0x2e11c5[_0x8afd('0x1a')]+'\x20'+parseOperator(_0x2e11c5[_0x8afd('0xf')]);}if(_['includes'](['$ne',_0x8afd('0x1d')],_0x2e11c5['operator']))_0x4b8c35[_0x8afd('0x1c')]='('+_0x4b8c35[_0x8afd('0x1c')]+_0x8afd('0x1e')+_0x18303c+'.'+_0x2e11c5[_0x8afd('0x1a')]+'\x20IS\x20NULL)';_0x4b8c35[_0x8afd('0x12')]=parseValue(_0x2ea287,_0x2e11c5[_0x8afd('0xf')],_0x2e11c5[_0x8afd('0x12')]);return _0x4b8c35;};function parseOperator(_0x10a052){var _0x1371c9;switch(_0x10a052){case _0x8afd('0x1f'):_0x1371c9=_0x8afd('0x20');break;case _0x8afd('0x1d'):_0x1371c9=_0x8afd('0x21');break;case'$eq':_0x1371c9='=\x20?';break;case _0x8afd('0x22'):_0x1371c9='<>\x20?';break;case'$substring':case _0x8afd('0x23'):case _0x8afd('0x24'):_0x1371c9='LIKE\x20?';break;case _0x8afd('0x25'):_0x1371c9=_0x8afd('0x26');break;case'$gt':_0x1371c9=_0x8afd('0x27');break;case _0x8afd('0x28'):_0x1371c9='<=\x20?';break;case _0x8afd('0x29'):_0x1371c9=_0x8afd('0x2a');break;case _0x8afd('0x11'):_0x1371c9='BETWEEN\x20?\x20AND\x20?';break;}return _0x1371c9;}function parseValue(_0x2ec4c8,_0x52bb62,_0x3997d8){var _0x54f544={'start':undefined,'end':undefined};switch(_0x52bb62){case'$in':case _0x8afd('0x1d'):_0x54f544['start']=_0x3997d8[_0x8afd('0x7')](',');break;case _0x8afd('0x2b'):_0x54f544[_0x8afd('0x2c')]='%'+_0x3997d8+'%';break;case'$startsWith':_0x54f544[_0x8afd('0x2c')]=_0x3997d8+'%';break;case _0x8afd('0x24'):_0x54f544[_0x8afd('0x2c')]='%'+_0x3997d8;break;case'$between':var _0x2690e9=_0x3997d8[_0x8afd('0x7')](',');var _0x3997d8=_0x2690e9[_0x8afd('0x2d')]();var _0x568f89=_0x2690e9[_0x8afd('0x2e')]();if(_0x2ec4c8===_0x8afd('0xe')){_0x3997d8=moment(_0x3997d8)[_0x8afd('0x2f')](0x0,!![])[_0x8afd('0x17')]();_0x568f89=moment(_0x568f89)[_0x8afd('0x2f')](0x0,!![])[_0x8afd('0x15')](0x17,'hours')[_0x8afd('0x15')](0x3b,_0x8afd('0x30'))[_0x8afd('0x15')](0x3b,_0x8afd('0x31'))[_0x8afd('0x17')]();}_0x54f544={'start':_0x3997d8,'end':_0x568f89};break;default:_0x54f544[_0x8afd('0x2c')]=_0x3997d8;break;}return _0x54f544;} \ No newline at end of file +var _0x1dab=['DATE','utcOffset','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','length','split','slice','shift','forEach','filter','map','push','buildExpression','operator','$between','value','$gt','$lte','days','format','castTo','text','CAST(','includes','\x20OR\x20','field','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$endsWith','$lt','<\x20?','>\x20?','$gte','start','$startsWith','pop'];(function(_0xa74d52,_0x430427){var _0x1e1247=function(_0x5128be){while(--_0x5128be){_0xa74d52['push'](_0xa74d52['shift']());}};_0x1e1247(++_0x430427);}(_0x1dab,0x13d));var _0xb1da=function(_0x5db018,_0x504f94){_0x5db018=_0x5db018-0x0;var _0xe48a05=_0x1dab[_0x5db018];return _0xe48a05;};'use strict';var _=require(_0xb1da('0x0'));var moment=require(_0xb1da('0x1'));exports[_0xb1da('0x2')]=function(_0x127a9a){var _0x32919f={'conditions':[]};_0x32919f[_0xb1da('0x3')]=_[_0xb1da('0x4')](_0x127a9a,'[$or]')?'or':_0xb1da('0x5');var _0x5afbac=_0x127a9a[_0xb1da('0x6')](_0xb1da('0x7'),'')[_0xb1da('0x6')](_0xb1da('0x8'),'')['split']('||');for(var _0x5078ce=0x0;_0x5078ce<_0x5afbac[_0xb1da('0x9')];_0x5078ce++){var _0x464b59=_0x5afbac[_0x5078ce][_0xb1da('0xa')](':=');var _0x155b2c=_0x464b59[0x0];var _0x287e31=_0x464b59[_0xb1da('0xb')](0x1);_0x287e31['forEach'](function(_0x55d22b){var _0x55c7f3=_0x55d22b[_0xb1da('0xa')]('[')[_0xb1da('0xc')]();var _0x220f63=_0x55d22b['match'](/\[(.*?)\]/g);_0x220f63[_0xb1da('0xd')](function(_0x2327c5){var _0x2b9f0a=_0x2327c5[_0xb1da('0xa')]('[')[_0xb1da('0xe')](function(_0xd1426c){return _0xd1426c['indexOf'](']')>-0x1;})[_0xb1da('0xf')](function(_0x9d26e){return _0x9d26e[_0xb1da('0xa')](']')[0x0];})[0x0];_0x32919f['conditions'][_0xb1da('0x10')]({'field':_0x155b2c,'operator':_0x55c7f3,'value':_0x2b9f0a});});});}return _0x32919f;};exports[_0xb1da('0x11')]=function(_0x24e168,_0x4bf115,_0xe0870a){var _0x1ca856={};if(_0x4bf115==='DATE'){if(_0xe0870a[_0xb1da('0x12')]==='$eq'){_0xe0870a['operator']=_0xb1da('0x13');_0xe0870a['value']+=','+_0xe0870a[_0xb1da('0x14')];}else if(_['includes']([_0xb1da('0x15'),_0xb1da('0x16')],_0xe0870a[_0xb1da('0x12')])){_0xe0870a[_0xb1da('0x14')]=moment(_0xe0870a['value'])['add'](0x1,_0xb1da('0x17'))[_0xb1da('0x18')]('YYYY-MM-DD');}}if(_0xe0870a[_0xb1da('0x19')]){_0x4bf115=_0xe0870a['castTo'];_0x1ca856[_0xb1da('0x1a')]=_0xb1da('0x1b')+_0x24e168+'.'+_0xe0870a['field']+'\x20AS\x20'+_0xe0870a[_0xb1da('0x19')]+')\x20'+parseOperator(_0xe0870a[_0xb1da('0x12')]);}else{_0x1ca856[_0xb1da('0x1a')]=_0x24e168+'.'+_0xe0870a['field']+'\x20'+parseOperator(_0xe0870a['operator']);}if(_[_0xb1da('0x1c')](['$ne','$notIn'],_0xe0870a[_0xb1da('0x12')]))_0x1ca856[_0xb1da('0x1a')]='('+_0x1ca856[_0xb1da('0x1a')]+_0xb1da('0x1d')+_0x24e168+'.'+_0xe0870a[_0xb1da('0x1e')]+'\x20IS\x20NULL)';_0x1ca856[_0xb1da('0x14')]=parseValue(_0x4bf115,_0xe0870a['operator'],_0xe0870a['value']);return _0x1ca856;};function parseOperator(_0x3ae3da){var _0x4a2391;switch(_0x3ae3da){case _0xb1da('0x1f'):_0x4a2391=_0xb1da('0x20');break;case _0xb1da('0x21'):_0x4a2391=_0xb1da('0x22');break;case _0xb1da('0x23'):_0x4a2391=_0xb1da('0x24');break;case'$ne':_0x4a2391=_0xb1da('0x25');break;case _0xb1da('0x26'):case'$startsWith':case _0xb1da('0x27'):_0x4a2391='LIKE\x20?';break;case _0xb1da('0x28'):_0x4a2391=_0xb1da('0x29');break;case _0xb1da('0x15'):_0x4a2391=_0xb1da('0x2a');break;case _0xb1da('0x16'):_0x4a2391='<=\x20?';break;case _0xb1da('0x2b'):_0x4a2391='>=\x20?';break;case _0xb1da('0x13'):_0x4a2391='BETWEEN\x20?\x20AND\x20?';break;}return _0x4a2391;}function parseValue(_0x555847,_0x5e8f14,_0x268600){var _0x3fb914={'start':undefined,'end':undefined};switch(_0x5e8f14){case _0xb1da('0x1f'):case _0xb1da('0x21'):_0x3fb914[_0xb1da('0x2c')]=_0x268600['split'](',');break;case _0xb1da('0x26'):_0x3fb914[_0xb1da('0x2c')]='%'+_0x268600+'%';break;case _0xb1da('0x2d'):_0x3fb914['start']=_0x268600+'%';break;case'$endsWith':_0x3fb914[_0xb1da('0x2c')]='%'+_0x268600;break;case'$between':var _0xeb6137=_0x268600[_0xb1da('0xa')](',');var _0x268600=_0xeb6137[_0xb1da('0xc')]();var _0x136f77=_0xeb6137[_0xb1da('0x2e')]();if(_0x555847===_0xb1da('0x2f')){_0x268600=moment(_0x268600)[_0xb1da('0x30')](0x0,!![])[_0xb1da('0x18')]();_0x136f77=moment(_0x136f77)['utcOffset'](0x0,!![])[_0xb1da('0x31')](0x17,'hours')[_0xb1da('0x31')](0x3b,_0xb1da('0x32'))['add'](0x3b,_0xb1da('0x33'))[_0xb1da('0x18')]();}_0x3fb914={'start':_0x268600,'end':_0x136f77};break;default:_0x3fb914[_0xb1da('0x2c')]=_0x268600;break;}return _0x3fb914;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ce040c7..b7b6a20 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 _0x8c0c=['push','toString','join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','isPlainObject','parse','$gte','format','utc','YYYY-MM-DD','subtract','isArray','map','priority','unsigned','substr','DESC','cast','ASC','omit','isString','length','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue'];(function(_0x13c254,_0x5d5241){var _0xe928da=function(_0x178d50){while(--_0x178d50){_0x13c254['push'](_0x13c254['shift']());}};_0xe928da(++_0x5d5241);}(_0x8c0c,0x11b));var _0xc8c0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8c0c[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xc8c0('0x0'));var sequelize=require(_0xc8c0('0x1'));var moment=require(_0xc8c0('0x2'));var LIMIT_VALUE=0xfa;exports[_0xc8c0('0x3')]=function(_0x45f7ea){var _0x429f94=null;if(_0x45f7ea){_0x429f94=_0x45f7ea[_0xc8c0('0x4')](',');}return _0x429f94;};exports[_0xc8c0('0x5')]=function(_0x334f52,_0x313416){var _0x5aeccb={};if(!_[_0xc8c0('0x6')](_0x334f52)){_[_0xc8c0('0x7')](_0x334f52,function(_0x3f117e,_0x3eebae){try{if(_0x313416){var _0x73954c=_[_0xc8c0('0x8')](_0x313416,{'name':_0x3eebae})||{};if(_0x73954c['type']==='DATE'&&_[_0xc8c0('0x9')](_0x3f117e)){var _0x233485=JSON[_0xc8c0('0xa')](_0x3f117e);var _0x2d24d3={'$gte':moment(moment(_0x233485[_0xc8c0('0xb')])[_0xc8c0('0xc')]('YYYY-MM-DD'))[_0xc8c0('0xd')]()[_0xc8c0('0xc')](),'$lte':moment(moment(_0x233485['$lte'])[_0xc8c0('0xc')](_0xc8c0('0xe')))['utc']()[_0xc8c0('0xf')](0x1,'s')[_0xc8c0('0xc')]()};_0x5aeccb[_0x3eebae]=_0x2d24d3;}else{_0x5aeccb[_0x3eebae]=_[_0xc8c0('0x10')](_0x3f117e)?_0x3f117e:JSON['parse'](_0x3f117e);}}else{_0x5aeccb[_0x3eebae]=_[_0xc8c0('0x10')](_0x3f117e)?_0x3f117e:JSON[_0xc8c0('0xa')](_0x3f117e);}}catch(_0x478a01){_0x5aeccb[_0x3eebae]=_0x3f117e['split'](',');}});}return _0x5aeccb;};exports['limit']=function(_0x359fa3){_0x359fa3=parseInt(_0x359fa3,0xa);if(!_0x359fa3||_0x359fa3<0x0){_0x359fa3=LIMIT_VALUE;}return _0x359fa3;};exports['offset']=function(_0x3428f4){_0x3428f4=parseInt(_0x3428f4,0xa);if(!_0x3428f4||_0x3428f4<0x0){_0x3428f4=0x0;}return _0x3428f4;};exports['sort']=function(_0x1d6d51){var _0x328d34,_0x388441=null;if(_0x1d6d51){_0x328d34=_0x1d6d51[_0xc8c0('0x4')](',');_0x388441=_[_0xc8c0('0x11')](_0x328d34,function(_0x4da80d){if(_0x4da80d['indexOf']('-')===0x0){return[_0x4da80d===_0xc8c0('0x12')?sequelize['cast'](sequelize['col']('priority'),_0xc8c0('0x13')):_0x4da80d[_0xc8c0('0x14')](0x1),_0xc8c0('0x15')];}else{return[_0x4da80d===_0xc8c0('0x12')?sequelize[_0xc8c0('0x16')](sequelize['col'](_0xc8c0('0x12')),_0xc8c0('0x13')):_0x4da80d,_0xc8c0('0x17')];}});}return _0x388441;};exports[_0xc8c0('0x18')]=function(_0x59dadf,_0x1ef88c){if(_[_0xc8c0('0x6')](_0x59dadf)){return _0x59dadf;}if(_[_0xc8c0('0x10')](_0x59dadf)){for(var _0x4253b4=0x0;_0x4253b4<_0x59dadf['length'];_0x4253b4+=0x1){_0x59dadf[_0x4253b4]=this['omit'](_0x59dadf[_0x4253b4],_0x1ef88c);}return _0x59dadf;}if(!_['isObject'](_0x59dadf)){return _0x59dadf;}if(_[_0xc8c0('0x19')](_0x1ef88c)){_0x1ef88c=[_0x1ef88c];}if(!_[_0xc8c0('0x10')](_0x1ef88c)){return _0x59dadf;}for(var _0x5bf378=0x0;_0x5bf378<_0x1ef88c[_0xc8c0('0x1a')];_0x5bf378+=0x1){_['unset'](_0x59dadf,_0x1ef88c[_0x5bf378]);}for(var _0x4b66ae in _0x59dadf){if(_0x59dadf[_0xc8c0('0x1b')](_0x4b66ae)){_0x59dadf[_0x4b66ae]=this[_0xc8c0('0x18')](_0x59dadf[_0x4b66ae],_0x1ef88c);}}return _0x59dadf;};exports[_0xc8c0('0x1c')]=function(_0x3f3272){return _0x3f3272[_0xc8c0('0x1d')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0xc8c0('0x1e')]=function(_0x1e4473){return _0x1e4473[_0xc8c0('0x1d')](/^\S+@\S+$/)?!![]:![];};exports[_0xc8c0('0x1f')]=function(_0x1cedfd){var _0x1d01b0=[];_0x1cedfd[_0xc8c0('0x4')]('\x20')['forEach'](function(_0x389501){_0x1d01b0[_0xc8c0('0x20')]('+'+_0x389501[_0xc8c0('0x21')]()+'*');});return _0x1d01b0[_0xc8c0('0x22')]('\x20');}; \ No newline at end of file +var _0xb488=['getFullTextValue','toString','join','lodash','moment','fields','split','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','subtract','isArray','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','omit','isEmpty','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[0-9]*$','isEmail','match'];(function(_0x4ce7fc,_0x13f5ad){var _0x56a972=function(_0x408699){while(--_0x408699){_0x4ce7fc['push'](_0x4ce7fc['shift']());}};_0x56a972(++_0x13f5ad);}(_0xb488,0xe7));var _0x8b48=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb488[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x8b48('0x0'));var sequelize=require('sequelize');var moment=require(_0x8b48('0x1'));var LIMIT_VALUE=0xfa;exports[_0x8b48('0x2')]=function(_0x2282dc){var _0x2ca7b9=null;if(_0x2282dc){_0x2ca7b9=_0x2282dc[_0x8b48('0x3')](',');}return _0x2ca7b9;};exports['filters']=function(_0x4fd174,_0x4ac3e3){var _0x4d873e={};if(!_['isEmpty'](_0x4fd174)){_['forOwn'](_0x4fd174,function(_0x59294b,_0x2d031c){try{if(_0x4ac3e3){var _0x5828bf=_[_0x8b48('0x4')](_0x4ac3e3,{'name':_0x2d031c})||{};if(_0x5828bf[_0x8b48('0x5')]===_0x8b48('0x6')&&_[_0x8b48('0x7')](_0x59294b)){var _0xaea3a8=JSON[_0x8b48('0x8')](_0x59294b);var _0x284fae={'$gte':moment(moment(_0xaea3a8[_0x8b48('0x9')])[_0x8b48('0xa')](_0x8b48('0xb')))[_0x8b48('0xc')]()['format'](),'$lte':moment(moment(_0xaea3a8['$lte'])['format']('YYYY-MM-DD'))[_0x8b48('0xc')]()[_0x8b48('0xd')](0x1,'s')[_0x8b48('0xa')]()};_0x4d873e[_0x2d031c]=_0x284fae;}else{_0x4d873e[_0x2d031c]=_[_0x8b48('0xe')](_0x59294b)?_0x59294b:JSON[_0x8b48('0x8')](_0x59294b);}}else{_0x4d873e[_0x2d031c]=_[_0x8b48('0xe')](_0x59294b)?_0x59294b:JSON['parse'](_0x59294b);}}catch(_0xd49bb7){_0x4d873e[_0x2d031c]=_0x59294b[_0x8b48('0x3')](',');}});}return _0x4d873e;};exports[_0x8b48('0xf')]=function(_0x4130a0){_0x4130a0=parseInt(_0x4130a0,0xa);if(!_0x4130a0||_0x4130a0<0x0){_0x4130a0=LIMIT_VALUE;}return _0x4130a0;};exports[_0x8b48('0x10')]=function(_0x3884a3){_0x3884a3=parseInt(_0x3884a3,0xa);if(!_0x3884a3||_0x3884a3<0x0){_0x3884a3=0x0;}return _0x3884a3;};exports[_0x8b48('0x11')]=function(_0x1cc933){var _0x22515e,_0x527274=null;if(_0x1cc933){_0x22515e=_0x1cc933[_0x8b48('0x3')](',');_0x527274=_[_0x8b48('0x12')](_0x22515e,function(_0x4875d5){if(_0x4875d5[_0x8b48('0x13')]('-')===0x0){return[_0x4875d5===_0x8b48('0x14')?sequelize['cast'](sequelize[_0x8b48('0x15')](_0x8b48('0x14')),_0x8b48('0x16')):_0x4875d5[_0x8b48('0x17')](0x1),'DESC'];}else{return[_0x4875d5===_0x8b48('0x14')?sequelize['cast'](sequelize[_0x8b48('0x15')](_0x8b48('0x14')),'unsigned'):_0x4875d5,'ASC'];}});}return _0x527274;};exports[_0x8b48('0x18')]=function(_0x1f7b0f,_0x5e5474){if(_[_0x8b48('0x19')](_0x1f7b0f)){return _0x1f7b0f;}if(_['isArray'](_0x1f7b0f)){for(var _0x403487=0x0;_0x403487<_0x1f7b0f[_0x8b48('0x1a')];_0x403487+=0x1){_0x1f7b0f[_0x403487]=this['omit'](_0x1f7b0f[_0x403487],_0x5e5474);}return _0x1f7b0f;}if(!_[_0x8b48('0x1b')](_0x1f7b0f)){return _0x1f7b0f;}if(_[_0x8b48('0x1c')](_0x5e5474)){_0x5e5474=[_0x5e5474];}if(!_[_0x8b48('0xe')](_0x5e5474)){return _0x1f7b0f;}for(var _0x17a782=0x0;_0x17a782<_0x5e5474[_0x8b48('0x1a')];_0x17a782+=0x1){_[_0x8b48('0x1d')](_0x1f7b0f,_0x5e5474[_0x17a782]);}for(var _0x27c85a in _0x1f7b0f){if(_0x1f7b0f[_0x8b48('0x1e')](_0x27c85a)){_0x1f7b0f[_0x27c85a]=this[_0x8b48('0x18')](_0x1f7b0f[_0x27c85a],_0x5e5474);}}return _0x1f7b0f;};exports[_0x8b48('0x1f')]=function(_0x4530a1){return _0x4530a1['match'](RegExp(_0x8b48('0x20')))?!![]:![];};exports[_0x8b48('0x21')]=function(_0x34c4cf){return _0x34c4cf[_0x8b48('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x8b48('0x23')]=function(_0x3b579c){var _0x58a45a=[];_0x3b579c[_0x8b48('0x3')]('\x20')['forEach'](function(_0x12a560){_0x58a45a['push']('+'+_0x12a560[_0x8b48('0x24')]()+'*');});return _0x58a45a[_0x8b48('0x25')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a28cbd8..13f1aa4 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a0c=['/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','initialize','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','default','production','appPath','join','root','public','development','test','set','client','use','json\x20replacer','toISOString','split','get','views'];(function(_0x43579b,_0x5d6da0){var _0x3073c8=function(_0x28a5a6){while(--_0x28a5a6){_0x43579b['push'](_0x43579b['shift']());}};_0x3073c8(++_0x5d6da0);}(_0x6a0c,0xb8));var _0xc6a0=function(_0x49bb93,_0x1321d5){_0x49bb93=_0x49bb93-0x0;var _0x3eb625=_0x6a0c[_0x49bb93];return _0x3eb625;};'use strict';var express=require('express');var favicon=require(_0xc6a0('0x0'));var bodyParser=require(_0xc6a0('0x1'));var methodOverride=require(_0xc6a0('0x2'));var cookieParser=require(_0xc6a0('0x3'));var errorHandler=require(_0xc6a0('0x4'));var path=require(_0xc6a0('0x5'));var passport=require(_0xc6a0('0x6'));var cors=require(_0xc6a0('0x7'));var moment=require(_0xc6a0('0x8'));var config=require(_0xc6a0('0x9'));var db=require('../mysqldb')['db'];exports[_0xc6a0('0xa')]=function(_0x5056b3){var _0x568ee6=_0x5056b3['get']('env');if(_0x568ee6===_0xc6a0('0xb')){_0x5056b3['set'](_0xc6a0('0xc'),path[_0xc6a0('0xd')](config[_0xc6a0('0xe')],_0xc6a0('0xf')));}if(_0x568ee6===_0xc6a0('0x10')||_0x568ee6===_0xc6a0('0x11')){_0x5056b3[_0xc6a0('0x12')](_0xc6a0('0xc'),path[_0xc6a0('0xd')](config[_0xc6a0('0xe')],_0xc6a0('0x13')));_0x5056b3[_0xc6a0('0x14')](errorHandler());}_0x5056b3['set'](_0xc6a0('0x15'),function(_0x1252c4,_0x3183bb){if(this[_0x1252c4]instanceof Date){_0x3183bb=this[_0x1252c4][_0xc6a0('0x16')]()[_0xc6a0('0x17')]('.')[0x0]+'Z';}return _0x3183bb;});_0x5056b3[_0xc6a0('0x14')](express['static'](_0x5056b3[_0xc6a0('0x18')](_0xc6a0('0xc'))));_0x5056b3['set'](_0xc6a0('0x19'),config['root']+_0xc6a0('0x1a'));_0x5056b3[_0xc6a0('0x1b')](_0xc6a0('0x1c'),require(_0xc6a0('0x1d'))[_0xc6a0('0x1e')]);_0x5056b3['set'](_0xc6a0('0x1f'),_0xc6a0('0x1c'));_0x5056b3['use'](bodyParser[_0xc6a0('0x20')]({'limit':_0xc6a0('0x21'),'extended':!![]}));_0x5056b3['use'](bodyParser['json']({'limit':'50mb'}));_0x5056b3[_0xc6a0('0x14')](cors());_0x5056b3['use'](methodOverride());_0x5056b3[_0xc6a0('0x14')](cookieParser());_0x5056b3[_0xc6a0('0x14')](passport[_0xc6a0('0x22')]());}; \ No newline at end of file +var _0x6cec=['engine','html','renderFile','view\x20engine','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','default','get','env','root','public','development','set','appPath','join','use','json\x20replacer','toISOString','split','static','views'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x6cec,0xee));var _0xc6ce=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0x6cec[_0x47e309];return _0x2e1900;};'use strict';var express=require(_0xc6ce('0x0'));var favicon=require(_0xc6ce('0x1'));var bodyParser=require(_0xc6ce('0x2'));var methodOverride=require(_0xc6ce('0x3'));var cookieParser=require(_0xc6ce('0x4'));var errorHandler=require(_0xc6ce('0x5'));var path=require(_0xc6ce('0x6'));var passport=require(_0xc6ce('0x7'));var cors=require(_0xc6ce('0x8'));var moment=require(_0xc6ce('0x9'));var config=require('./environment');var db=require(_0xc6ce('0xa'))['db'];exports[_0xc6ce('0xb')]=function(_0x27c310){var _0x286611=_0x27c310[_0xc6ce('0xc')](_0xc6ce('0xd'));if(_0x286611==='production'){_0x27c310['set']('appPath',path['join'](config[_0xc6ce('0xe')],_0xc6ce('0xf')));}if(_0x286611===_0xc6ce('0x10')||_0x286611==='test'){_0x27c310[_0xc6ce('0x11')](_0xc6ce('0x12'),path[_0xc6ce('0x13')](config[_0xc6ce('0xe')],'client'));_0x27c310[_0xc6ce('0x14')](errorHandler());}_0x27c310[_0xc6ce('0x11')](_0xc6ce('0x15'),function(_0x515ede,_0x3677d1){if(this[_0x515ede]instanceof Date){_0x3677d1=this[_0x515ede][_0xc6ce('0x16')]()[_0xc6ce('0x17')]('.')[0x0]+'Z';}return _0x3677d1;});_0x27c310[_0xc6ce('0x14')](express[_0xc6ce('0x18')](_0x27c310['get'](_0xc6ce('0x12'))));_0x27c310['set'](_0xc6ce('0x19'),config[_0xc6ce('0xe')]+'/server/views');_0x27c310[_0xc6ce('0x1a')](_0xc6ce('0x1b'),require('ejs')[_0xc6ce('0x1c')]);_0x27c310['set'](_0xc6ce('0x1d'),_0xc6ce('0x1b'));_0x27c310[_0xc6ce('0x14')](bodyParser['urlencoded']({'limit':_0xc6ce('0x1e'),'extended':!![]}));_0x27c310[_0xc6ce('0x14')](bodyParser[_0xc6ce('0x1f')]({'limit':_0xc6ce('0x1e')}));_0x27c310[_0xc6ce('0x14')](cors());_0x27c310['use'](methodOverride());_0x27c310[_0xc6ce('0x14')](cookieParser());_0x27c310[_0xc6ce('0x14')](passport[_0xc6ce('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 1ef995e..b38741d 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 _0x4fd7=['crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','update','digest','substring','lodash'];(function(_0x595f1f,_0x53676e){var _0x515ca2=function(_0x250957){while(--_0x250957){_0x595f1f['push'](_0x595f1f['shift']());}};_0x515ca2(++_0x53676e);}(_0x4fd7,0xe6));var _0x74fd=function(_0x517756,_0x2efb52){_0x517756=_0x517756-0x0;var _0x13a912=_0x4fd7[_0x517756];return _0x13a912;};'use strict';var _=require(_0x74fd('0x0'));var os=require('os');var crypto=require(_0x74fd('0x1'));var machine=require(_0x74fd('0x2'));var exec=require(_0x74fd('0x3'))['execSync'];function getInterfaces(){var _0x4fba38=[];var _0xfa6318=os[_0x74fd('0x4')]();var _0x59e3f1=_[_0x74fd('0x5')](_['keys'](_0xfa6318));for(var _0xae1ea5=0x0;_0xae1ea5<_0x59e3f1['length'];_0xae1ea5++){var _0x1959e1=_0xfa6318[_0x59e3f1[_0xae1ea5]][_0x74fd('0x6')](function(_0x566a59){return _0x566a59[_0x74fd('0x7')]===_0x74fd('0x8')&&_0x566a59['internal']===![];});_0x4fba38=_0x4fba38[_0x74fd('0x9')](_0x1959e1);}return _0x4fba38;}function getFirstInterface(){var _0x2e20c2=_[_0x74fd('0xa')](getInterfaces());return{'macAddress':_0x2e20c2&&_0x2e20c2[_0x74fd('0xb')]?_0x2e20c2[_0x74fd('0xb')]:_0x74fd('0xc'),'ipAddress':_0x2e20c2&&_0x2e20c2[_0x74fd('0xd')]?_0x2e20c2[_0x74fd('0xd')]:_0x74fd('0xe')};}exports[_0x74fd('0xf')]=getFirstInterface;function getCPUhash(){var _0x321921=_[_0x74fd('0x5')](os[_0x74fd('0x10')]()[_0x74fd('0x11')](function(_0x3fd552){return _0x3fd552[_0x74fd('0x12')];}))['join'](':');return crypto[_0x74fd('0x13')](_0x74fd('0x14'))['update'](_0x321921)['digest'](_0x74fd('0x15'));}exports[_0x74fd('0x16')]=function(){switch(os[_0x74fd('0x17')]()){case _0x74fd('0x18'):return exec(_0x74fd('0x19'),{'encoding':_0x74fd('0x1a')})[_0x74fd('0x1b')]('\x0d\x0a','');default:var _0x127353=getFirstInterface();var _0x57a832=getCPUhash();var _0x4301a7=_0x57a832+'|'+os[_0x74fd('0x1c')]()+'|'+_0x127353['macAddress']+'|'+_0x127353[_0x74fd('0x1d')];var _0x2a166b=crypto['createHash'](_0x74fd('0x14'))[_0x74fd('0x1e')](_0x4301a7)[_0x74fd('0x1f')](_0x74fd('0x15'));return _0x2a166b[_0x74fd('0x20')](0x0,0x8)+'-'+_0x2a166b[_0x74fd('0x20')](0x8,0xc)+'-'+_0x2a166b[_0x74fd('0x20')](0xc,0x10)+'-'+_0x2a166b[_0x74fd('0x20')](0x10,0x14)+'-'+_0x2a166b[_0x74fd('0x20')](0x14);}}; \ No newline at end of file +var _0x972c=['getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','substring','bimedia-machine-uuid','child_process','orderBy','keys','family','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','digest','hex'];(function(_0x3929a4,_0x3221ae){var _0x2e9c54=function(_0x320cfd){while(--_0x320cfd){_0x3929a4['push'](_0x3929a4['shift']());}};_0x2e9c54(++_0x3221ae);}(_0x972c,0xf2));var _0xc972=function(_0x4c2d92,_0x3ee395){_0x4c2d92=_0x4c2d92-0x0;var _0x24b2f4=_0x972c[_0x4c2d92];return _0x24b2f4;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0xc972('0x0'));var exec=require(_0xc972('0x1'))['execSync'];function getInterfaces(){var _0x3c04a5=[];var _0x1a41f9=os['networkInterfaces']();var _0x511ad4=_[_0xc972('0x2')](_[_0xc972('0x3')](_0x1a41f9));for(var _0x29b5d1=0x0;_0x29b5d1<_0x511ad4['length'];_0x29b5d1++){var _0xd70261=_0x1a41f9[_0x511ad4[_0x29b5d1]]['filter'](function(_0x1c1a16){return _0x1c1a16[_0xc972('0x4')]===_0xc972('0x5')&&_0x1c1a16['internal']===![];});_0x3c04a5=_0x3c04a5['concat'](_0xd70261);}return _0x3c04a5;}function getFirstInterface(){var _0x48fe12=_[_0xc972('0x6')](getInterfaces());return{'macAddress':_0x48fe12&&_0x48fe12['mac']?_0x48fe12[_0xc972('0x7')]:_0xc972('0x8'),'ipAddress':_0x48fe12&&_0x48fe12[_0xc972('0x9')]?_0x48fe12[_0xc972('0x9')]:_0xc972('0xa')};}exports[_0xc972('0xb')]=getFirstInterface;function getCPUhash(){var _0x233d36=_['orderBy'](os[_0xc972('0xc')]()[_0xc972('0xd')](function(_0x27851c){return _0x27851c['model'];}))[_0xc972('0xe')](':');return crypto[_0xc972('0xf')](_0xc972('0x10'))['update'](_0x233d36)[_0xc972('0x11')](_0xc972('0x12'));}exports[_0xc972('0x13')]=function(){switch(os[_0xc972('0x14')]()){case'win32':return exec(_0xc972('0x15'),{'encoding':_0xc972('0x16')})[_0xc972('0x17')]('\x0d\x0a','');default:var _0x341564=getFirstInterface();var _0x40217e=getCPUhash();var _0x268f04=_0x40217e+'|'+os[_0xc972('0x18')]()+'|'+_0x341564[_0xc972('0x19')]+'|'+_0x341564[_0xc972('0x1a')];var _0x9c986f=crypto[_0xc972('0xf')](_0xc972('0x10'))[_0xc972('0x1b')](_0x268f04)[_0xc972('0x11')](_0xc972('0x12'));return _0x9c986f[_0xc972('0x1c')](0x0,0x8)+'-'+_0x9c986f['substring'](0x8,0xc)+'-'+_0x9c986f[_0xc972('0x1c')](0xc,0x10)+'-'+_0x9c986f[_0xc972('0x1c')](0x10,0x14)+'-'+_0x9c986f[_0xc972('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 224cd79..deee258 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 _0x0d91=['../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','createCipher','aes-256-ctr','session','update','utf8','base64','final','createDecipher','secrets','User','findOne','email','|reason|','|machineUuid|','|name|','fullname','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','info','data2','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','crypto','moment','request-promise','pkginfo','version'];(function(_0x9bcc0b,_0x120f6c){var _0x195399=function(_0x5be8b9){while(--_0x5be8b9){_0x9bcc0b['push'](_0x9bcc0b['shift']());}};_0x195399(++_0x120f6c);}(_0x0d91,0x76));var _0x10d9=function(_0x166310,_0x49c9f4){_0x166310=_0x166310-0x0;var _0xd24eb8=_0x0d91[_0x166310];return _0xd24eb8;};'use strict';var util=require(_0x10d9('0x0'));var crypto=require(_0x10d9('0x1'));var moment=require(_0x10d9('0x2'));var rp=require(_0x10d9('0x3'));var BPromise=require('bluebird');var pkginfo=require(_0x10d9('0x4'))(module,_0x10d9('0x5'));var db=require(_0x10d9('0x6'))['db'];var config=require('../environment');var hardware=require(_0x10d9('0x7'));var logger=require(_0x10d9('0x8'))(_0x10d9('0x9'));var jira=require('../../api/jira/jira.controller');var HOST=_0x10d9('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x3a49ab){return new BPromise(function(_0x946fc7,_0x26b6cf){var _0x2558bb=util[_0x10d9('0xb')](_0x10d9('0xc'),HOST,_0x3a49ab,module[_0x10d9('0xd')][_0x10d9('0x5')]);if(oldToken){_0x2558bb=util[_0x10d9('0xb')](_0x10d9('0xe'),HOST,_0x3a49ab,module[_0x10d9('0xd')][_0x10d9('0x5')],oldToken);}var _0x2332c7={'uri':_0x2558bb,'method':_0x10d9('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x2332c7)[_0x10d9('0x10')](function(_0x273a4c){_0x946fc7(_0x273a4c);})['catch'](function(_0x2e327c){_0x26b6cf(_0x2e327c);});});}function encryptDate(_0x23f582){var _0x12a2b4=crypto[_0x10d9('0x11')](_0x10d9('0x12'),config['secrets'][_0x10d9('0x13')]);var _0x5b3be6=_0x12a2b4[_0x10d9('0x14')](_0x23f582,_0x10d9('0x15'),_0x10d9('0x16'));_0x5b3be6+=_0x12a2b4[_0x10d9('0x17')](_0x10d9('0x16'));return _0x5b3be6;}function decryptDate(_0x198778){var _0x211df6=crypto[_0x10d9('0x18')](_0x10d9('0x12'),config[_0x10d9('0x19')]['session']);var _0x5658b5=_0x211df6[_0x10d9('0x14')](_0x198778,_0x10d9('0x16'),_0x10d9('0x15'));_0x5658b5+=_0x211df6[_0x10d9('0x17')]('utf8');return _0x5658b5;}function sendJiraAlert(_0x3f5819,_0x206045,_0x1cff55){var _0x8441a5='||FIELD||VALUE||\x0a';return db[_0x10d9('0x1a')][_0x10d9('0x1b')]({'where':{'role':'admin'},'attributes':['fullname',_0x10d9('0x1c')],'raw':!![]})['then'](function(_0x11be56){ADMIN=_0x11be56;_0x8441a5+=_0x10d9('0x1d')+_0x1cff55+'|\x0a';_0x8441a5+='|uuid|'+_0x3f5819+'|\x0a';_0x8441a5+=_0x10d9('0x1e')+_0x206045+'|\x0a';_0x8441a5+=_0x10d9('0x1f')+ADMIN[_0x10d9('0x20')]+'|\x0a';_0x8441a5+=_0x10d9('0x21')+ADMIN[_0x10d9('0x1c')]+'|\x0a';return _0x8441a5;})[_0x10d9('0x10')](function(_0x26ff84){var _0x3a2e97=hardware[_0x10d9('0x22')]()[_0x10d9('0x23')];return jira[_0x10d9('0x24')]({'key':_0x10d9('0x25'),'summary':_0x10d9('0x26'),'description':_0x26ff84,'issuetype':_0x10d9('0x27'),'oldToken':_0x3f5819,'newToken':_0x206045,'email':ADMIN[_0x10d9('0x1c')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x3a2e97});});}function manageLicense(_0x14c4ec,_0x295489){var _0xce87ca=_0x295489[_0x10d9('0x28')]({'plain':!![]});httpRequest(_0x14c4ec)['then'](function(_0x3ba01f){if(oldToken){oldToken=undefined;}if(_0x3ba01f[_0x10d9('0x29')]){if(!_0xce87ca[_0x10d9('0x9')]&&_0xce87ca[_0x10d9('0x9')]!=_0x3ba01f[_0x10d9('0x9')]||_0xce87ca[_0x10d9('0x9')]&&_0xce87ca['data2']){logger[_0x10d9('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xce87ca[_0x10d9('0x9')]&&!_0xce87ca[_0x10d9('0x2b')]&&_0xce87ca[_0x10d9('0x9')]!=_0x3ba01f[_0x10d9('0x9')]){logger[_0x10d9('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xce87ca['license']&&!_0xce87ca[_0x10d9('0x2b')]&&_0xce87ca[_0x10d9('0x9')]==_0x3ba01f['license']){return _0x295489;}return _0x295489['update']({'data1':_0x14c4ec,'data2':null,'license':_0x3ba01f[_0x10d9('0x9')]});}else{if(_0x3ba01f[_0x10d9('0x9')]||_0xce87ca[_0x10d9('0x9')]){if(!_0xce87ca['data2']){if(_0xce87ca[_0x10d9('0x2c')]==_0x14c4ec){GRAY_PERIOD_REASON='Disabled';logger[_0x10d9('0x2a')](_0x10d9('0x2d'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0xce87ca['data1'];logger[_0x10d9('0x2a')](_0x10d9('0x2e'),_0xce87ca['data1'],_0x14c4ec);}sendJiraAlert(_0xce87ca[_0x10d9('0x2c')],_0x3ba01f[_0x10d9('0x2f')],GRAY_PERIOD_REASON);logger['info'](_0x10d9('0x30'),GRAY_PERIOD_REASON[_0x10d9('0x31')](),moment()[_0x10d9('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x295489[_0x10d9('0x14')]({'data2':encryptDate(moment()[_0x10d9('0xb')](_0x10d9('0x32')))});}else{if(moment()['diff'](decryptDate(_0xce87ca[_0x10d9('0x2b')]),_0x10d9('0x33'))>DAYS){logger['info'](_0x10d9('0x34'),moment()[_0x10d9('0xb')](_0x10d9('0x32')));return _0x295489[_0x10d9('0x14')]({'data1':_0x14c4ec,'data2':null,'license':null});}}}else{if(_0xce87ca[_0x10d9('0x2c')]!=_0x14c4ec){logger[_0x10d9('0x2a')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xce87ca['data1'],_0x14c4ec);return _0x295489['update']({'data1':_0x14c4ec,'data2':null,'license':null});}}}return _0x295489;})[_0x10d9('0x10')](function(_0x3d4ee8){_0x295489=_0x3d4ee8;})[_0x10d9('0x35')](function(_0x3bc4ab){logger[_0x10d9('0x36')](_0x3bc4ab['message']);})[_0x10d9('0x37')](function(){setTimeout(function(){manageLicense(hardware[_0x10d9('0x38')](),_0x295489);},TIME);});}function defaultLicense(){var _0x24e998=hardware[_0x10d9('0x38')]();if(_0x24e998){return db['License'][_0x10d9('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x24e998}})[_0x10d9('0x3a')](function(_0xdd2c0d,_0x36a13f){logger[_0x10d9('0x2a')](_0x10d9('0x3b'),_0x24e998);manageLicense(_0x24e998,_0xdd2c0d);})['catch'](function(_0x1eebad){logger[_0x10d9('0x36')](_0x1eebad[_0x10d9('0x3c')]);});}}exports[_0x10d9('0x3d')]=defaultLicense; \ No newline at end of file +var _0x1623=['YYYY-MM-DD\x20HH:mm','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../logger','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','aes-256-ctr','session','base64','final','createDecipher','update','utf8','||FIELD||VALUE||\x0a','findOne','email','|machineUuid|','|name|','fullname','|email|','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','license','data2','info','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','diff','days','DEMO\x20START\x20AT\x20%s'];(function(_0x57f86d,_0x30f34c){var _0x116a10=function(_0xd9b64b){while(--_0xd9b64b){_0x57f86d['push'](_0x57f86d['shift']());}};_0x116a10(++_0x30f34c);}(_0x1623,0xab));var _0x3162=function(_0x25854f,_0x5dfb5e){_0x25854f=_0x25854f-0x0;var _0x2b899e=_0x1623[_0x25854f];return _0x2b899e;};'use strict';var util=require(_0x3162('0x0'));var crypto=require('crypto');var moment=require('moment');var rp=require(_0x3162('0x1'));var BPromise=require(_0x3162('0x2'));var pkginfo=require(_0x3162('0x3'))(module,_0x3162('0x4'));var db=require(_0x3162('0x5'))['db'];var config=require('../environment');var hardware=require('./hardware');var logger=require(_0x3162('0x6'))('license');var jira=require(_0x3162('0x7'));var HOST=_0x3162('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x53260d){return new BPromise(function(_0xffe9b6,_0x2dc07e){var _0x26ee32=util[_0x3162('0x9')](_0x3162('0xa'),HOST,_0x53260d,module[_0x3162('0xb')][_0x3162('0x4')]);if(oldToken){_0x26ee32=util[_0x3162('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x53260d,module['exports'][_0x3162('0x4')],oldToken);}var _0x3106d5={'uri':_0x26ee32,'method':_0x3162('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3106d5)[_0x3162('0xd')](function(_0x813d62){_0xffe9b6(_0x813d62);})[_0x3162('0xe')](function(_0x458a05){_0x2dc07e(_0x458a05);});});}function encryptDate(_0x38da60){var _0x157ab8=crypto['createCipher'](_0x3162('0xf'),config['secrets'][_0x3162('0x10')]);var _0x143c5a=_0x157ab8['update'](_0x38da60,'utf8',_0x3162('0x11'));_0x143c5a+=_0x157ab8[_0x3162('0x12')](_0x3162('0x11'));return _0x143c5a;}function decryptDate(_0x4b8a3b){var _0x15e348=crypto[_0x3162('0x13')](_0x3162('0xf'),config['secrets'][_0x3162('0x10')]);var _0x42cf7d=_0x15e348[_0x3162('0x14')](_0x4b8a3b,_0x3162('0x11'),_0x3162('0x15'));_0x42cf7d+=_0x15e348[_0x3162('0x12')](_0x3162('0x15'));return _0x42cf7d;}function sendJiraAlert(_0x4b2bf3,_0x42f283,_0x1e3d75){var _0x460b7b=_0x3162('0x16');return db['User'][_0x3162('0x17')]({'where':{'role':'admin'},'attributes':['fullname',_0x3162('0x18')],'raw':!![]})[_0x3162('0xd')](function(_0x31946d){ADMIN=_0x31946d;_0x460b7b+='|reason|'+_0x1e3d75+'|\x0a';_0x460b7b+='|uuid|'+_0x4b2bf3+'|\x0a';_0x460b7b+=_0x3162('0x19')+_0x42f283+'|\x0a';_0x460b7b+=_0x3162('0x1a')+ADMIN[_0x3162('0x1b')]+'|\x0a';_0x460b7b+=_0x3162('0x1c')+ADMIN[_0x3162('0x18')]+'|\x0a';return _0x460b7b;})[_0x3162('0xd')](function(_0x52ae25){var _0x1b2713=hardware['getFirstInterface']()[_0x3162('0x1d')];return jira[_0x3162('0x1e')]({'key':_0x3162('0x1f'),'summary':_0x3162('0x20'),'description':_0x52ae25,'issuetype':_0x3162('0x21'),'oldToken':_0x4b2bf3,'newToken':_0x42f283,'email':ADMIN[_0x3162('0x18')],'name':ADMIN[_0x3162('0x1b')],'reason':GRAY_PERIOD_REASON,'ip':_0x1b2713});});}function manageLicense(_0x5f8f7,_0x2a09ad){var _0x356c5d=_0x2a09ad[_0x3162('0x22')]({'plain':!![]});httpRequest(_0x5f8f7)[_0x3162('0xd')](function(_0x1c03a4){if(oldToken){oldToken=undefined;}if(_0x1c03a4['active']){if(!_0x356c5d[_0x3162('0x23')]&&_0x356c5d['license']!=_0x1c03a4[_0x3162('0x23')]||_0x356c5d[_0x3162('0x23')]&&_0x356c5d[_0x3162('0x24')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x356c5d[_0x3162('0x23')]&&!_0x356c5d[_0x3162('0x24')]&&_0x356c5d[_0x3162('0x23')]!=_0x1c03a4[_0x3162('0x23')]){logger[_0x3162('0x25')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x356c5d[_0x3162('0x23')]&&!_0x356c5d['data2']&&_0x356c5d[_0x3162('0x23')]==_0x1c03a4[_0x3162('0x23')]){return _0x2a09ad;}return _0x2a09ad[_0x3162('0x14')]({'data1':_0x5f8f7,'data2':null,'license':_0x1c03a4[_0x3162('0x23')]});}else{if(_0x1c03a4[_0x3162('0x23')]||_0x356c5d[_0x3162('0x23')]){if(!_0x356c5d[_0x3162('0x24')]){if(_0x356c5d[_0x3162('0x26')]==_0x5f8f7){GRAY_PERIOD_REASON='Disabled';logger[_0x3162('0x25')](_0x3162('0x27'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x356c5d[_0x3162('0x26')];logger[_0x3162('0x25')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x356c5d['data1'],_0x5f8f7);}sendJiraAlert(_0x356c5d[_0x3162('0x26')],_0x1c03a4['uuid'],GRAY_PERIOD_REASON);logger[_0x3162('0x25')](_0x3162('0x28'),GRAY_PERIOD_REASON[_0x3162('0x29')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x2a09ad[_0x3162('0x14')]({'data2':encryptDate(moment()[_0x3162('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x3162('0x2a')](decryptDate(_0x356c5d['data2']),_0x3162('0x2b'))>DAYS){logger[_0x3162('0x25')](_0x3162('0x2c'),moment()[_0x3162('0x9')](_0x3162('0x2d')));return _0x2a09ad[_0x3162('0x14')]({'data1':_0x5f8f7,'data2':null,'license':null});}}}else{if(_0x356c5d[_0x3162('0x26')]!=_0x5f8f7){logger[_0x3162('0x25')](_0x3162('0x2e'),_0x356c5d[_0x3162('0x26')],_0x5f8f7);return _0x2a09ad[_0x3162('0x14')]({'data1':_0x5f8f7,'data2':null,'license':null});}}}return _0x2a09ad;})['then'](function(_0x149571){_0x2a09ad=_0x149571;})[_0x3162('0xe')](function(_0x41d93b){logger['error'](_0x41d93b['message']);})[_0x3162('0x2f')](function(){setTimeout(function(){manageLicense(hardware[_0x3162('0x30')](),_0x2a09ad);},TIME);});}function defaultLicense(){var _0x2e1ab5=hardware[_0x3162('0x30')]();if(_0x2e1ab5){return db['License'][_0x3162('0x31')]({'where':{'id':0x1},'defaults':{'data1':_0x2e1ab5}})['spread'](function(_0x59e049,_0x5dee49){logger[_0x3162('0x25')](_0x3162('0x32'),_0x2e1ab5);manageLicense(_0x2e1ab5,_0x59e049);})[_0x3162('0xe')](function(_0x49829f){logger[_0x3162('0x33')](_0x49829f[_0x3162('0x34')]);});}}exports[_0x3162('0x35')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index fc3c629..ecafbac 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 _0x37a7=['../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','demo','uuid','machineUuid','getUuid','secrets','session','gray','deadline','days','grayReason','changed','2027-01-01T00:00:00.000Z','Breaking\x20license','message','getLicense','License','find','defaults','then','checkLicense','crypto','util','../environment'];(function(_0x1f4dd9,_0x4f3ab4){var _0x31eb65=function(_0x1a47d2){while(--_0x1a47d2){_0x1f4dd9['push'](_0x1f4dd9['shift']());}};_0x31eb65(++_0x4f3ab4);}(_0x37a7,0x6f));var _0x737a=function(_0x3f8e8c,_0x30ecbb){_0x3f8e8c=_0x3f8e8c-0x0;var _0x4ff56b=_0x37a7[_0x3f8e8c];return _0x4ff56b;};'use strict';var crypto=require(_0x737a('0x0'));var util=require(_0x737a('0x1'));var _=require('lodash');var moment=require('moment');var hardware=require('./hardware');var config=require(_0x737a('0x2'));var db=require(_0x737a('0x3'))['db'];function checkLicense(_0x53a261,_0x524516){if(_0x53a261){try{var _0x4af128=_0x524516||_0x53a261[_0x737a('0x4')];if(_[_0x737a('0x5')](_0x4af128)){throw new Error(_0x737a('0x6'));}var _0x11109c=_0x53a261[_0x737a('0x7')];var _0x5cc52c=_0x53a261[_0x737a('0x8')];var _0x249898=_0x11109c[_0x737a('0x9')]('-')[0x4];var _0x29c3e5=_0x11109c['split']('-')[0x0];var _0x303f55=crypto[_0x737a('0xa')]('aes-256-ctr',util[_0x737a('0xb')](_0x737a('0xc'),_0x249898,_0x11109c,_0x29c3e5));var _0x27a721=_0x303f55[_0x737a('0xd')](_0x4af128,_0x737a('0xe'),_0x737a('0xf'));_0x27a721+=_0x303f55[_0x737a('0x10')]('utf8');var _0x6b6a2=JSON[_0x737a('0x11')](_0x27a721);_0x6b6a2[_0x737a('0x12')]=![];_0x6b6a2[_0x737a('0x13')]=_0x11109c;_0x6b6a2[_0x737a('0x14')]=hardware[_0x737a('0x15')]();if(_0x5cc52c){var _0x1210f3=crypto[_0x737a('0xa')]('aes-256-ctr',config[_0x737a('0x16')][_0x737a('0x17')]);var _0x5ac00d=_0x1210f3['update'](_0x5cc52c,_0x737a('0xe'),_0x737a('0xf'));_0x5ac00d+=_0x1210f3[_0x737a('0x10')](_0x737a('0xf'));_0x6b6a2[_0x737a('0x18')]=_0x5ac00d;_0x6b6a2[_0x737a('0x19')]=moment(_0x5ac00d)['add'](0x7,_0x737a('0x1a'))['format']();_0x6b6a2[_0x737a('0x1b')]=_0x6b6a2[_0x737a('0x13')]!=_0x6b6a2['machineUuid']?_0x737a('0x1c'):'disabled';}return _0x6b6a2;}catch(_0x4bf188){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x737a('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x737a('0x1e'),'uuid':_0x53a261['data1'],'machineUuid':hardware[_0x737a('0x15')](),'message':_0x4bf188[_0x737a('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x737a('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x53a261[_0x737a('0x7')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x737a('0x20')]=function(_0x5423ba){return db[_0x737a('0x21')][_0x737a('0x22')](_[_0x737a('0x23')](_0x5423ba,{'raw':!![],'where':{'id':0x1}}))[_0x737a('0x24')](function(_0x2926bd){return checkLicense(_0x2926bd,null);});};exports[_0x737a('0x25')]=checkLicense; \ No newline at end of file +var _0xc94e=['utf8','parse','uuid','secrets','update','final','gray','deadline','add','days','machineUuid','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','data1','getUuid','Demo\x20license','getLicense','find','defaults','then','checkLicense','crypto','lodash','moment','./hardware','isEmpty','License\x20key\x20value\x20not\x20found','split','aes-256-ctr','format','base64'];(function(_0x1b14f0,_0x45bfd7){var _0x3a5f7f=function(_0x36d208){while(--_0x36d208){_0x1b14f0['push'](_0x1b14f0['shift']());}};_0x3a5f7f(++_0x45bfd7);}(_0xc94e,0x76));var _0xec94=function(_0x23b283,_0x1640d3){_0x23b283=_0x23b283-0x0;var _0x1be7cd=_0xc94e[_0x23b283];return _0x1be7cd;};'use strict';var crypto=require(_0xec94('0x0'));var util=require('util');var _=require(_0xec94('0x1'));var moment=require(_0xec94('0x2'));var hardware=require(_0xec94('0x3'));var config=require('../environment');var db=require('../../mysqldb')['db'];function checkLicense(_0x557bd4,_0xb55fb){if(_0x557bd4){try{var _0x26e57e=_0xb55fb||_0x557bd4['license'];if(_[_0xec94('0x4')](_0x26e57e)){throw new Error(_0xec94('0x5'));}var _0x3af09f=_0x557bd4['data1'];var _0x5e7a4d=_0x557bd4['data2'];var _0x5a1fa0=_0x3af09f[_0xec94('0x6')]('-')[0x4];var _0x5b19e6=_0x3af09f[_0xec94('0x6')]('-')[0x0];var _0x2763e0=crypto['createDecipher'](_0xec94('0x7'),util[_0xec94('0x8')]('%s:%s:%s',_0x5a1fa0,_0x3af09f,_0x5b19e6));var _0x556725=_0x2763e0['update'](_0x26e57e,_0xec94('0x9'),_0xec94('0xa'));_0x556725+=_0x2763e0['final'](_0xec94('0xa'));var _0x4dad86=JSON[_0xec94('0xb')](_0x556725);_0x4dad86['demo']=![];_0x4dad86[_0xec94('0xc')]=_0x3af09f;_0x4dad86['machineUuid']=hardware['getUuid']();if(_0x5e7a4d){var _0x34b7ec=crypto['createDecipher']('aes-256-ctr',config[_0xec94('0xd')]['session']);var _0x495648=_0x34b7ec[_0xec94('0xe')](_0x5e7a4d,'base64',_0xec94('0xa'));_0x495648+=_0x34b7ec[_0xec94('0xf')](_0xec94('0xa'));_0x4dad86[_0xec94('0x10')]=_0x495648;_0x4dad86[_0xec94('0x11')]=moment(_0x495648)[_0xec94('0x12')](0x7,_0xec94('0x13'))[_0xec94('0x8')]();_0x4dad86['grayReason']=_0x4dad86[_0xec94('0xc')]!=_0x4dad86[_0xec94('0x14')]?'changed':_0xec94('0x15');}return _0x4dad86;}catch(_0x4e9bd1){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xec94('0x16'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xec94('0x17'),'uuid':_0x557bd4[_0xec94('0x18')],'machineUuid':hardware[_0xec94('0x19')](),'message':_0x4e9bd1['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'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':![],'description':_0xec94('0x1a'),'uuid':_0x557bd4[_0xec94('0x18')],'machineUuid':hardware[_0xec94('0x19')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0xec94('0x1b')]=function(_0x49c83d){return db['License'][_0xec94('0x1c')](_[_0xec94('0x1d')](_0x49c83d,{'raw':!![],'where':{'id':0x1}}))[_0xec94('0x1e')](function(_0x4fc2c8){return checkLicense(_0x4fc2c8,null);});};exports[_0xec94('0x1f')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 8782725..ea1f5d7 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 _0x6ced=['secret','exports','http://localhost:9000','app-id'];(function(_0x2a31e5,_0x45e1be){var _0x1e0291=function(_0x3b8807){while(--_0x3b8807){_0x2a31e5['push'](_0x2a31e5['shift']());}};_0x1e0291(++_0x45e1be);}(_0x6ced,0x6d));var _0xd6ce=function(_0x13b747,_0x1916cd){_0x13b747=_0x13b747-0x0;var _0x6c5ca5=_0x6ced[_0x13b747];return _0x6c5ca5;};'use strict';module[_0xd6ce('0x0')]={'DOMAIN':_0xd6ce('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xd6ce('0x2'),'GOOGLE_SECRET':_0xd6ce('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x4490=['app-id','http://localhost:9000','myappanuglar-secret'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x4490,0x112));var _0x0449=function(_0x493c9b,_0x51f993){_0x493c9b=_0x493c9b-0x0;var _0x1333c5=_0x4490[_0x493c9b];return _0x1333c5;};'use strict';module['exports']={'DOMAIN':_0x0449('0x0'),'SESSION_SECRET':_0x0449('0x1'),'GOOGLE_ID':_0x0449('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 61e01e5..d2e22ba 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe21f=['util','INFO','join','/var','log','xcally','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','exports','Logger','transports','File','%s-%s','error','info','debugLevel','winston'];(function(_0x29af7c,_0x587ff9){var _0x5518df=function(_0xe40acf){while(--_0xe40acf){_0x29af7c['push'](_0x29af7c['shift']());}};_0x5518df(++_0x587ff9);}(_0xe21f,0xef));var _0xfe21=function(_0x100a96,_0x2d1bab){_0x100a96=_0x100a96-0x0;var _0x501c30=_0xe21f[_0x100a96];return _0x501c30;};'use strict';var moment=require('moment');var winston=require(_0xfe21('0x0'));var util=require(_0xfe21('0x1'));var path=require('path');var debugLevel=_0xfe21('0x2');function filename(_0x4f240e,_0x533309){return path[_0xfe21('0x3')](_0xfe21('0x4'),_0xfe21('0x5'),_0xfe21('0x6'),util[_0xfe21('0x7')](_0xfe21('0x8'),_0x4f240e,_0x533309));}function formatter(_0x5432bc,_0x448c3d){return util[_0xfe21('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xfe21('0x7')](_0xfe21('0x9')),_0x448c3d['level'][_0xfe21('0xa')](),_0x5432bc,_0x448c3d[_0xfe21('0xb')]);}module[_0xfe21('0xc')]=function(_0x3fd1df){return new winston[(_0xfe21('0xd'))]({'transports':[new winston[(_0xfe21('0xe'))][(_0xfe21('0xf'))]({'name':util[_0xfe21('0x7')](_0xfe21('0x10'),_0x3fd1df,_0xfe21('0x11')),'filename':filename(_0x3fd1df,_0xfe21('0x11')),'level':_0xfe21('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5e162d){return formatter(_0x3fd1df,_0x5e162d);}}),new winston[(_0xfe21('0xe'))][(_0xfe21('0xf'))]({'name':util['format'](_0xfe21('0x10'),_0x3fd1df,_0xfe21('0x12')),'filename':filename(_0x3fd1df,_0xfe21('0x12')),'level':_0xfe21('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x30e807){return formatter(_0x3fd1df,_0x30e807);}}),new winston['transports']['Console']({'level':process['env'][_0xfe21('0x13')]||debugLevel,'json':![],'formatter':function(_0x4381dc){return formatter(_0x3fd1df,_0x4381dc);}})]});}; \ No newline at end of file +var _0xed75=['toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','debugLevel','moment','winston','util','INFO','join','/var','log','xcally','format','%s-%s.log'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xed75,0x15e));var _0x5ed7=function(_0x471a67,_0x4a1847){_0x471a67=_0x471a67-0x0;var _0x3ef86e=_0xed75[_0x471a67];return _0x3ef86e;};'use strict';var moment=require(_0x5ed7('0x0'));var winston=require(_0x5ed7('0x1'));var util=require(_0x5ed7('0x2'));var path=require('path');var debugLevel=_0x5ed7('0x3');function filename(_0x1e310d,_0x41b86a){return path[_0x5ed7('0x4')](_0x5ed7('0x5'),_0x5ed7('0x6'),_0x5ed7('0x7'),util[_0x5ed7('0x8')](_0x5ed7('0x9'),_0x1e310d,_0x41b86a));}function formatter(_0xf1581d,_0x1d4007){return util[_0x5ed7('0x8')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x1d4007['level'][_0x5ed7('0xa')](),_0xf1581d,_0x1d4007['message']);}module[_0x5ed7('0xb')]=function(_0x389980){return new winston[(_0x5ed7('0xc'))]({'transports':[new winston[(_0x5ed7('0xd'))][(_0x5ed7('0xe'))]({'name':util[_0x5ed7('0x8')](_0x5ed7('0xf'),_0x389980,_0x5ed7('0x10')),'filename':filename(_0x389980,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1fc3fb){return formatter(_0x389980,_0x1fc3fb);}}),new winston[(_0x5ed7('0xd'))][(_0x5ed7('0xe'))]({'name':util[_0x5ed7('0x8')](_0x5ed7('0xf'),_0x389980,'info'),'filename':filename(_0x389980,_0x5ed7('0x11')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x26a1b3){return formatter(_0x389980,_0x26a1b3);}}),new winston['transports'][(_0x5ed7('0x12'))]({'level':process['env'][_0x5ed7('0x13')]||debugLevel,'json':![],'formatter':function(_0x3b2ff4){return formatter(_0x389980,_0x3b2ff4);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index be9fbfd..0c39402 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 _0x5813=['../../services/email/index.js','routing','../../services/xdr/index.js','exports','express','join','ami','agi','../../services/agi/index.js'];(function(_0x272a46,_0x12b300){var _0x2bfd12=function(_0x4a3d5f){while(--_0x4a3d5f){_0x272a46['push'](_0x272a46['shift']());}};_0x2bfd12(++_0x12b300);}(_0x5813,0x17e));var _0x3581=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5813[_0x321bb2];return _0x9c12ed;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x3581('0x0'),'script':path[_0x3581('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x3581('0x2'),'script':path[_0x3581('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0x3581('0x3'),'script':path[_0x3581('0x1')](__dirname,_0x3581('0x4'))},{'name':'email','script':path['join'](__dirname,_0x3581('0x5'))},{'name':_0x3581('0x6'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x3581('0x1')](__dirname,_0x3581('0x7'))}]};module[_0x3581('0x8')]=config; \ No newline at end of file +var _0x625b=['routing','../../services/routing/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x831f40,_0x5964d9){var _0x6a3ce8=function(_0x3e0b59){while(--_0x3e0b59){_0x831f40['push'](_0x831f40['shift']());}};_0x6a3ce8(++_0x5964d9);}(_0x625b,0x121));var _0xb625=function(_0x18fc56,_0x4e0fc1){_0x18fc56=_0x18fc56-0x0;var _0x58302a=_0x625b[_0x18fc56];return _0x58302a;};'use strict';var path=require(_0xb625('0x0'));var os=require('os');var config={'apps':[{'name':_0xb625('0x1'),'script':path[_0xb625('0x2')](__dirname,_0xb625('0x3'))},{'name':_0xb625('0x4'),'script':path[_0xb625('0x2')](__dirname,_0xb625('0x5'))},{'name':_0xb625('0x6'),'script':path[_0xb625('0x2')](__dirname,_0xb625('0x7'))},{'name':_0xb625('0x8'),'script':path[_0xb625('0x2')](__dirname,_0xb625('0x9'))},{'name':_0xb625('0xa'),'script':path[_0xb625('0x2')](__dirname,_0xb625('0xb'))},{'name':'xdr','script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0xb625('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 58f5d48..5b49722 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 _0xafa5=['connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','bluebird','./config','connect'];(function(_0x284acc,_0x5d1917){var _0xbc724d=function(_0x3ac571){while(--_0x3ac571){_0x284acc['push'](_0x284acc['shift']());}};_0xbc724d(++_0x5d1917);}(_0xafa5,0x1af));var _0x5afa=function(_0x2b79e3,_0x1aec9c){_0x2b79e3=_0x2b79e3-0x0;var _0x3d9d86=_0xafa5[_0x2b79e3];return _0x3d9d86;};'use strict';var pm2=require('pm2');var BPromise=require(_0x5afa('0x0'));var config=require(_0x5afa('0x1'));function connect(){return new BPromise(function(_0x2ee5d6,_0x2deb15){return pm2[_0x5afa('0x2')](function(_0x5e59cf){if(_0x5e59cf){return _0x2deb15(_0x5e59cf);}return _0x2ee5d6(_0x5afa('0x3'));});});};exports[_0x5afa('0x4')]=function(_0xac7ca5){return connect()[_0x5afa('0x5')](function(){return new BPromise(function(_0x8dbbe0,_0x58998c){return pm2[_0x5afa('0x4')](_0xac7ca5,function(_0x43488f,_0x129da7){if(_0x43488f){return _0x58998c(_0x43488f);}pm2[_0x5afa('0x6')]();return _0x8dbbe0(_0x129da7);});});});};exports[_0x5afa('0x7')]=function(_0x3154d5){return connect()[_0x5afa('0x5')](function(){return new BPromise(function(_0x2e9ae4,_0x2bfaff){return pm2['stop'](_0x3154d5,function(_0x503e78,_0x22cc13){if(_0x503e78){return _0x2bfaff(_0x503e78);}pm2[_0x5afa('0x6')]();return _0x2e9ae4(_0x22cc13);});});});};exports[_0x5afa('0x8')]=function(_0x295807){return connect()[_0x5afa('0x5')](function(){return new BPromise(function(_0x3128a2,_0x825e64){return pm2[_0x5afa('0x8')](_0x295807,function(_0x57fd0f,_0x408d92){if(_0x57fd0f){return _0x825e64(_0x57fd0f);}pm2[_0x5afa('0x6')]();return _0x3128a2(_0x408d92);});});});};exports[_0x5afa('0x9')]=function(){return connect()[_0x5afa('0x5')](function(){return new BPromise(function(_0x142b61,_0x31ab67){return pm2['list'](function(_0x1674eb,_0x41b7a1){if(_0x1674eb){return _0x31ab67(_0x1674eb);}pm2[_0x5afa('0x6')]();return _0x142b61(_0x41b7a1);});});});};exports[_0x5afa('0xa')]=function(_0xfcb0a2){return connect()[_0x5afa('0x5')](function(){return new BPromise(function(_0x2fc20b,_0x47ba31){return pm2[_0x5afa('0xa')](_0xfcb0a2,function(_0x105c16,_0x5d57e6){if(_0x105c16){return _0x47ba31(_0x105c16);}pm2[_0x5afa('0x6')]();return _0x2fc20b(_0x5d57e6);});});});};exports[_0x5afa('0xb')]=function(_0x292b57){return connect()[_0x5afa('0x5')](function(){return new BPromise(function(_0xe51af9,_0xaef03b){return pm2[_0x5afa('0xb')](_0x292b57,function(_0x56e9b6,_0x276787){if(_0x56e9b6){return _0xaef03b(_0x56e9b6);}pm2[_0x5afa('0x6')]();return _0xe51af9(_0x276787);});});});};exports[_0x5afa('0xc')]=function(){return connect()[_0x5afa('0x5')](function(){return new BPromise(function(_0x24302a,_0xff5b77){return pm2[_0x5afa('0xc')](function(_0x13c38b){if(_0x13c38b){return _0xff5b77(_0x13c38b);}return _0x24302a(_0x5afa('0xd'));});});});}; \ No newline at end of file +var _0x71ad=['connect','start','disconnect','stop','then','restart','list','describe','delete','dump','pm2','bluebird'];(function(_0x3eac74,_0x300383){var _0x365ec9=function(_0xd70261){while(--_0xd70261){_0x3eac74['push'](_0x3eac74['shift']());}};_0x365ec9(++_0x300383);}(_0x71ad,0xee));var _0xd71a=function(_0x474f1c,_0x15cb4a){_0x474f1c=_0x474f1c-0x0;var _0x429e8f=_0x71ad[_0x474f1c];return _0x429e8f;};'use strict';var pm2=require(_0xd71a('0x0'));var BPromise=require(_0xd71a('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x30838f,_0x5932b5){return pm2[_0xd71a('0x2')](function(_0x1f5c49){if(_0x1f5c49){return _0x5932b5(_0x1f5c49);}return _0x30838f('connected');});});};exports[_0xd71a('0x3')]=function(_0x5192c5){return connect()['then'](function(){return new BPromise(function(_0x42ddcc,_0x5ec697){return pm2[_0xd71a('0x3')](_0x5192c5,function(_0x371653,_0x1f603d){if(_0x371653){return _0x5ec697(_0x371653);}pm2[_0xd71a('0x4')]();return _0x42ddcc(_0x1f603d);});});});};exports[_0xd71a('0x5')]=function(_0x1591a7){return connect()[_0xd71a('0x6')](function(){return new BPromise(function(_0x4c8d66,_0x26102d){return pm2['stop'](_0x1591a7,function(_0x52aff1,_0x1364b4){if(_0x52aff1){return _0x26102d(_0x52aff1);}pm2[_0xd71a('0x4')]();return _0x4c8d66(_0x1364b4);});});});};exports[_0xd71a('0x7')]=function(_0x2832b3){return connect()[_0xd71a('0x6')](function(){return new BPromise(function(_0x19294e,_0x396c5e){return pm2[_0xd71a('0x7')](_0x2832b3,function(_0x266da5,_0x3a0162){if(_0x266da5){return _0x396c5e(_0x266da5);}pm2['disconnect']();return _0x19294e(_0x3a0162);});});});};exports[_0xd71a('0x8')]=function(){return connect()[_0xd71a('0x6')](function(){return new BPromise(function(_0x3bdeea,_0xc47ea8){return pm2[_0xd71a('0x8')](function(_0x3f6938,_0x10c0de){if(_0x3f6938){return _0xc47ea8(_0x3f6938);}pm2[_0xd71a('0x4')]();return _0x3bdeea(_0x10c0de);});});});};exports[_0xd71a('0x9')]=function(_0xfdcc6d){return connect()[_0xd71a('0x6')](function(){return new BPromise(function(_0x15fd57,_0x2c54c5){return pm2[_0xd71a('0x9')](_0xfdcc6d,function(_0xd16472,_0x53904e){if(_0xd16472){return _0x2c54c5(_0xd16472);}pm2[_0xd71a('0x4')]();return _0x15fd57(_0x53904e);});});});};exports[_0xd71a('0xa')]=function(_0x6abf4f){return connect()['then'](function(){return new BPromise(function(_0x50cceb,_0x4e3832){return pm2[_0xd71a('0xa')](_0x6abf4f,function(_0x139bc8,_0x1aaec8){if(_0x139bc8){return _0x4e3832(_0x139bc8);}pm2[_0xd71a('0x4')]();return _0x50cceb(_0x1aaec8);});});});};exports[_0xd71a('0xb')]=function(){return connect()[_0xd71a('0x6')](function(){return new BPromise(function(_0x5b61a8,_0x408c0d){return pm2[_0xd71a('0xb')](function(_0x4f1eb7){if(_0x4f1eb7){return _0x408c0d(_0x4f1eb7);}return _0x5b61a8('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index aca1048..2488ea8 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 _0xd0ea=['findAll','subtract','minutes','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','start','lodash','moment','../../mysqldb','../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction'];(function(_0x1a37b2,_0x584b3b){var _0x130c75=function(_0x268407){while(--_0x268407){_0x1a37b2['push'](_0x1a37b2['shift']());}};_0x130c75(++_0x584b3b);}(_0xd0ea,0x1d4));var _0xad0e=function(_0x2b0074,_0x42d50b){_0x2b0074=_0x2b0074-0x0;var _0x25b012=_0xd0ea[_0x2b0074];return _0x25b012;};'use strict';var _=require(_0xad0e('0x0'));var moment=require(_0xad0e('0x1'));var Redis=require('ioredis');var db=require(_0xad0e('0x2'))['db'];var config=require(_0xad0e('0x3'));config[_0xad0e('0x4')]=_['defaults'](config[_0xad0e('0x4')],{'host':_0xad0e('0x5'),'port':0x18eb});var io=require(_0xad0e('0x6'))(new Redis(config[_0xad0e('0x4')]));function closeInteractions(){var _0x5a15fc=0x0;var _0xc7a6d4=[];return db[_0xad0e('0x7')][_0xad0e('0x8')]({'raw':!![],'attributes':['id',_0xad0e('0x9')],'where':{'id':0x1}})[_0xad0e('0xa')](function(_0x101c74){_0x5a15fc=_0x101c74[_0xad0e('0x9')];if(_0x5a15fc){return db[_0xad0e('0xb')][_0xad0e('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xad0e('0xd')](_0x101c74[_0xad0e('0x9')],_0xad0e('0xe'))}}});}else{return[];}})[_0xad0e('0xa')](function(_0x4f5415){_0xc7a6d4=_0x4f5415;if(_0x5a15fc){return db[_0xad0e('0xb')]['update']({'closeReason':_0xad0e('0xf'),'disposition':_0xad0e('0x10'),'closed':!![],'closedAt':moment()[_0xad0e('0x11')](_0xad0e('0x12'))},{'where':{'id':_['map'](_0xc7a6d4||[],'id')}});}})[_0xad0e('0xa')](function(_0x19983d){for(var _0x31bebc=0x0;_0x31bebc<_0xc7a6d4['length'];_0x31bebc++){io[_0xad0e('0x13')](_0xad0e('0x14'),{'id':_0xc7a6d4[_0x31bebc]['id'],'closed':!![]});}})[_0xad0e('0x15')](function(_0x454c05){console[_0xad0e('0x16')](_0x454c05);});}exports[_0xad0e('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x24fd=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','then','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','catch','error','start','lodash','moment','ioredis'];(function(_0x167926,_0x2e5e15){var _0x56c689=function(_0x937dba){while(--_0x937dba){_0x167926['push'](_0x167926['shift']());}};_0x56c689(++_0x2e5e15);}(_0x24fd,0x1c5));var _0xd24f=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x24fd[_0x17928f];return _0x500b63;};'use strict';var _=require(_0xd24f('0x0'));var moment=require(_0xd24f('0x1'));var Redis=require(_0xd24f('0x2'));var db=require(_0xd24f('0x3'))['db'];var config=require('../../config/environment');config[_0xd24f('0x4')]=_[_0xd24f('0x5')](config[_0xd24f('0x4')],{'host':_0xd24f('0x6'),'port':0x18eb});var io=require(_0xd24f('0x7'))(new Redis(config[_0xd24f('0x4')]));function closeInteractions(){var _0x2c3298=0x0;var _0x3a791e=[];return db[_0xd24f('0x8')][_0xd24f('0x9')]({'raw':!![],'attributes':['id',_0xd24f('0xa')],'where':{'id':0x1}})['then'](function(_0x800cc1){_0x2c3298=_0x800cc1['chatTimeout'];if(_0x2c3298){return db[_0xd24f('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xd24f('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x800cc1[_0xd24f('0xa')],'minutes')}}});}else{return[];}})[_0xd24f('0xd')](function(_0x1b6bc6){_0x3a791e=_0x1b6bc6;if(_0x2c3298){return db[_0xd24f('0xb')][_0xd24f('0xe')]({'closeReason':_0xd24f('0xf'),'disposition':_0xd24f('0x10'),'closed':!![],'closedAt':moment()[_0xd24f('0x11')](_0xd24f('0x12'))},{'where':{'id':_[_0xd24f('0x13')](_0x3a791e||[],'id')}});}})['then'](function(_0x51c770){for(var _0x1dc769=0x0;_0x1dc769<_0x3a791e[_0xd24f('0x14')];_0x1dc769++){io['emit']('chatInteraction:update',{'id':_0x3a791e[_0x1dc769]['id'],'closed':!![]});}})[_0xd24f('0x15')](function(_0x32b07e){console[_0xd24f('0x16')](_0x32b07e);});}exports[_0xd24f('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 1e4c35e..0b4fe28 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 _0xb962=['update\x20cron','run','start','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','auth','user','pass','name','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','attachments','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','message','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','keys','jobs','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','active','update'];(function(_0x492e9a,_0x32b6ff){var _0x2dde77=function(_0x1bc688){while(--_0x1bc688){_0x492e9a['push'](_0x492e9a['shift']());}};_0x2dde77(++_0x32b6ff);}(_0xb962,0x108));var _0x2b96=function(_0x5633ea,_0x104154){_0x5633ea=_0x5633ea-0x0;var _0x55b7b2=_0xb962[_0x5633ea];return _0x55b7b2;};'use strict';var fs=require('fs');var util=require(_0x2b96('0x0'));var path=require('path');var _=require(_0x2b96('0x1'));var moment=require(_0x2b96('0x2'));var CronJobManager=require(_0x2b96('0x3'));var jayson=require(_0x2b96('0x4'));var BPromise=require(_0x2b96('0x5'));var logger=require('../logger')(_0x2b96('0x6'));var db=require(_0x2b96('0x7'))['db'];var analyticCustomReportController=require(_0x2b96('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x2b96('0x9')][_0x2b96('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2c06c7,_0x5336c9){return function(){logger[_0x2b96('0xb')](_0x2b96('0xc'),_0x2c06c7[_0x2b96('0xd')]);var _0x2390a2=!![];var _0x4028e3={'tls':{'rejectUnauthorized':![]}};if(_0x2c06c7[_0x2b96('0xe')]['Smtp']['service']){_0x4028e3[_0x2b96('0xf')]=_0x2c06c7['MailAccount'][_0x2b96('0x10')]['service'];}else{_0x4028e3[_0x2b96('0x11')]=_0x2c06c7['MailAccount']['Smtp'][_0x2b96('0x11')];_0x4028e3[_0x2b96('0x12')]=_0x2c06c7['MailAccount']['Smtp']['port'];_0x4028e3['secure']=_0x2c06c7[_0x2b96('0xe')][_0x2b96('0x10')][_0x2b96('0x13')];}if(_0x2c06c7[_0x2b96('0xe')]['Smtp']['authentication']){_0x4028e3[_0x2b96('0x14')]={'user':_0x2c06c7[_0x2b96('0xe')][_0x2b96('0x10')][_0x2b96('0x15')],'pass':_0x2c06c7['MailAccount']['Smtp'][_0x2b96('0x16')]};}var _0x4ceeac={'account':_0x4028e3,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2c06c7[_0x2b96('0xe')][_0x2b96('0x17')],_0x2c06c7[_0x2b96('0xe')][_0x2b96('0xd')]||_0x2c06c7['MailAccount'][_0x2b96('0x10')][_0x2b96('0x15')]),'to':_0x2c06c7[_0x2b96('0xd')],'cc':_0x2c06c7['cc'],'bcc':_0x2c06c7[_0x2b96('0x18')],'subject':util[_0x2b96('0x19')](_0x2b96('0x1a'),_0x5336c9[_0x2b96('0x17')],_0x2c06c7[_0x2b96('0x1b')],_0x2c06c7[_0x2b96('0x1c')])}};var _0x5d3570=path[_0x2b96('0x1d')](__dirname,_0x2b96('0x1e'));var _0x4f15c1=_0x5336c9[_0x2b96('0x1f')];var _0x470755=util[_0x2b96('0x19')](_0x2b96('0x20'),path[_0x2b96('0x21')](_0x5336c9[_0x2b96('0x1f')],path[_0x2b96('0x22')](_0x5336c9['savename'])),'zip');var _0x5dd0ff=path[_0x2b96('0x1d')](_0x5d3570,_0x4f15c1);var _0x2e9f73=path[_0x2b96('0x1d')](_0x5d3570,_0x470755);if(fs[_0x2b96('0x23')](_0x5dd0ff)){_0x5336c9[_0x2b96('0x24')]='Sent';_0x4ceeac['message'][_0x2b96('0x25')]=[{'filename':_0x4f15c1,'path':_0x5dd0ff}];_0x4ceeac['message'][_0x2b96('0x26')]=util['format'](_0x2b96('0x27'),JSON[_0x2b96('0x28')](_0x5336c9,null,0x2));}else if(fs['existsSync'](_0x2e9f73)){_0x5336c9[_0x2b96('0x24')]='Sent';_0x4ceeac[_0x2b96('0x29')]['attachments']=[{'filename':_0x470755,'path':_0x2e9f73}];}else{_0x4ceeac['message'][_0x2b96('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2c06c7[_0x2b96('0x2a')]){_0x2390a2=![];logger[_0x2b96('0xb')](_0x2b96('0x2b'));}}if(_0x2390a2){return client['request'](_0x2b96('0x2c'),_0x4ceeac)[_0x2b96('0x2d')](function(_0x42f3a8){if(_0x42f3a8[_0x2b96('0x2e')]){return logger[_0x2b96('0x2e')](_0x2b96('0x2f'),JSON['stringify'](_0x42f3a8));}return logger['info'](_0x2b96('0x30'));})[_0x2b96('0x31')](function(_0x5753cf){return logger['error'](_0x2b96('0x2f'),JSON[_0x2b96('0x28')](_0x5753cf));});}};}function handleError(){return function(_0x1635bc){return logger['error'](JSON[_0x2b96('0x28')](_0x1635bc));};}function handleResult(_0x5a19c8){return function(_0x2d4864){logger[_0x2b96('0xb')](_0x2b96('0x32'),JSON[_0x2b96('0x28')](_0x2d4864));if(_0x5a19c8[_0x2b96('0xe')]&&_0x5a19c8[_0x2b96('0xe')][_0x2b96('0x10')]&&!_[_0x2b96('0x33')](_0x5a19c8[_0x2b96('0xd')])){setTimeout(handleSendEmail(_0x5a19c8,_0x2d4864),0x3c*0x3e8);}};}function handleJob(_0x34adfa){return function(){try{if(_['isNil'](_0x34adfa['subtractNumber'])){return logger[_0x2b96('0xb')](_0x2b96('0x34'));}if(_[_0x2b96('0x33')](_0x34adfa[_0x2b96('0x1c')])){return logger[_0x2b96('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x2ee12e={'startDate':moment()['subtract'](_0x34adfa[_0x2b96('0x1b')],_0x34adfa['subtractUnit'])[_0x2b96('0x19')](_0x2b96('0x35')),'endDate':moment()[_0x2b96('0x19')](_0x2b96('0x35')),'type':'scheduled','output':_0x34adfa[_0x2b96('0x36')],'name':_0x34adfa[_0x2b96('0x17')]};if(!_[_0x2b96('0x33')](_0x34adfa[_0x2b96('0x37')])){logger[_0x2b96('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x34adfa[_0x2b96('0x37')]);return analyticDefaultReportController[_0x2b96('0x38')]({'id':_0x34adfa[_0x2b96('0x37')]},_0x2ee12e)['then'](handleResult(_0x34adfa))['catch'](handleError());}if(!_['isNil'](_0x34adfa[_0x2b96('0x39')])){logger[_0x2b96('0xb')]('exec\x20custom\x20report\x20id:%s',_0x34adfa[_0x2b96('0x39')]);return analyticCustomReportController[_0x2b96('0x38')]({'id':_0x34adfa[_0x2b96('0x39')]},_0x2ee12e)[_0x2b96('0x2d')](handleResult(_0x34adfa))[_0x2b96('0x31')](handleError());}}catch(_0x424ca4){logger[_0x2b96('0x2e')](JSON[_0x2b96('0x28')](_0x424ca4));}return logger['info'](_0x2b96('0x3a'));};}function getJobs(_0x57d00a){var _0x5cb73d={};if(_0x57d00a){_0x5cb73d['id']=_0x57d00a;}return db[_0x2b96('0x3b')]['findAll']({'where':_0x5cb73d,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0x2b96('0x10')}]}]})[_0x2b96('0x2d')](function(_0x41790e){var _0x392b9c=_[_0x2b96('0x3c')](manager[_0x2b96('0x3d')]);var _0x392768=_['map'](_0x41790e,function(_0x5cb19f){return _0x5cb19f['id'][_0x2b96('0x3e')]();});var _0x4dc882=_[_0x2b96('0x3f')](_0x41790e,function(_0x304b40){return _0x304b40['id']['toString']();});var _0x99ac55=_0x57d00a?_0x392768:_[_0x2b96('0x40')](_0x392768,_0x392b9c);var _0x448143=_['intersection'](_0x392768,_0x392b9c);var _0x3a7c7b=_['difference'](_0x392b9c,_0x392768);var _0x307b13;var _0x3642c5;for(_0x307b13=0x0;_0x307b13<_0x3a7c7b[_0x2b96('0x41')]&&!_0x57d00a;_0x307b13+=0x1){_0x3642c5=_0x3a7c7b[_0x307b13][_0x2b96('0x3e')]();if(manager[_0x2b96('0x42')](_0x3642c5)){manager[_0x2b96('0x43')](_0x3642c5);manager[_0x2b96('0x44')](_0x3642c5);logger[_0x2b96('0xb')](_0x2b96('0x45'),_0x3642c5);}}logger[_0x2b96('0xb')](_0x2b96('0x46'),JSON[_0x2b96('0x28')](_0x99ac55));for(_0x307b13=0x0;_0x307b13<_0x99ac55[_0x2b96('0x41')];_0x307b13+=0x1){_0x3642c5=_0x99ac55[_0x307b13][_0x2b96('0x3e')]();logger[_0x2b96('0xb')](_0x2b96('0x47'),_0x3642c5);if(_0x57d00a){logger['info'](_0x2b96('0x48'),_0x57d00a);logger[_0x2b96('0xb')](JSON['stringify'](_0x4dc882[_0x3642c5]));BPromise[_0x2b96('0x49')]()[_0x2b96('0x2d')](handleJob(_0x4dc882[_0x3642c5]));logger[_0x2b96('0xb')](_0x2b96('0x4a'),_0x4dc882[_0x3642c5][_0x2b96('0x17')],_0x4dc882[_0x3642c5][_0x2b96('0x4b')]);}else if(_0x4dc882[_0x3642c5][_0x2b96('0x4b')]&&_0x4dc882[_0x3642c5]['active']&&moment()[_0x2b96('0x4c')](_0x4dc882[_0x3642c5][_0x2b96('0x4d')],_0x4dc882[_0x3642c5][_0x2b96('0x4e')])){manager[_0x2b96('0x4f')](_0x3642c5,_0x4dc882[_0x3642c5][_0x2b96('0x4b')],handleJob(_0x4dc882[_0x3642c5]));manager['start'](_0x3642c5);logger[_0x2b96('0xb')](_0x2b96('0x50'),_0x4dc882[_0x3642c5]['name'],_0x4dc882[_0x3642c5][_0x2b96('0x4b')]);}else if(manager[_0x2b96('0x42')](_0x3642c5)){manager['stop'](_0x3642c5);manager[_0x2b96('0x44')](_0x3642c5);logger['info'](_0x2b96('0x51'),_0x4dc882[_0x3642c5][_0x2b96('0x17')],_0x4dc882[_0x3642c5][_0x2b96('0x4b')]);}}for(_0x307b13=0x0,_0x3642c5;_0x307b13<_0x448143[_0x2b96('0x41')]&&!_0x57d00a;_0x307b13+=0x1){_0x3642c5=_0x448143[_0x307b13][_0x2b96('0x3e')]();if(manager[_0x2b96('0x42')](_0x3642c5)){if(_0x4dc882[_0x3642c5][_0x2b96('0x4b')]&&_0x4dc882[_0x3642c5][_0x2b96('0x52')]&&moment()['isBetween'](_0x4dc882[_0x3642c5]['startAt'],_0x4dc882[_0x3642c5]['endAt'])){manager[_0x2b96('0x53')](_0x3642c5,_0x4dc882[_0x3642c5][_0x2b96('0x4b')],handleJob(_0x4dc882[_0x3642c5]));logger[_0x2b96('0xb')](_0x2b96('0x54'),_0x4dc882[_0x3642c5][_0x2b96('0x17')],_0x4dc882[_0x3642c5][_0x2b96('0x4b')]);}else{manager['stop'](_0x3642c5);manager[_0x2b96('0x44')](_0x3642c5);logger[_0x2b96('0xb')](_0x2b96('0x51'),_0x4dc882[_0x3642c5]['name'],_0x4dc882[_0x3642c5]['cron']);}}}})[_0x2b96('0x31')](function(_0x565728){logger[_0x2b96('0x2e')](JSON[_0x2b96('0x28')](_0x565728));});}exports[_0x2b96('0x55')]=function(_0x29548e){return getJobs(_0x29548e);};exports[_0x2b96('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x69b7=['port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','basename','zip','join','status','Sent','message','attachments','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','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','keys','jobs','map','intersection','difference','length','toString','exists','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','start','stop','deleteJob','stop\x20cron','endAt','run','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','host','MailAccount'];(function(_0x290b68,_0x1f82af){var _0x2f23af=function(_0x5efc22){while(--_0x5efc22){_0x290b68['push'](_0x290b68['shift']());}};_0x2f23af(++_0x1f82af);}(_0x69b7,0x15b));var _0x769b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x69b7[_0x17d9e3];return _0x14192d;};'use strict';var fs=require('fs');var util=require(_0x769b('0x0'));var path=require(_0x769b('0x1'));var _=require(_0x769b('0x2'));var moment=require(_0x769b('0x3'));var CronJobManager=require(_0x769b('0x4'));var jayson=require(_0x769b('0x5'));var BPromise=require('bluebird');var logger=require(_0x769b('0x6'))(_0x769b('0x7'));var db=require(_0x769b('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x769b('0x9'));var client=jayson['client'][_0x769b('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x18e5ec,_0x5c8042){return function(){logger['info'](_0x769b('0xb'),_0x18e5ec[_0x769b('0xc')]);var _0x4ce7a2=!![];var _0x353daa={'tls':{'rejectUnauthorized':![]}};if(_0x18e5ec['MailAccount'][_0x769b('0xd')]['service']){_0x353daa[_0x769b('0xe')]=_0x18e5ec['MailAccount'][_0x769b('0xd')][_0x769b('0xe')];}else{_0x353daa[_0x769b('0xf')]=_0x18e5ec[_0x769b('0x10')][_0x769b('0xd')]['host'];_0x353daa[_0x769b('0x11')]=_0x18e5ec[_0x769b('0x10')][_0x769b('0xd')][_0x769b('0x11')];_0x353daa['secure']=_0x18e5ec[_0x769b('0x10')][_0x769b('0xd')][_0x769b('0x12')];}if(_0x18e5ec[_0x769b('0x10')][_0x769b('0xd')][_0x769b('0x13')]){_0x353daa[_0x769b('0x14')]={'user':_0x18e5ec[_0x769b('0x10')][_0x769b('0xd')][_0x769b('0x15')],'pass':_0x18e5ec[_0x769b('0x10')][_0x769b('0xd')][_0x769b('0x16')]};}var _0x22ffb2={'account':_0x353daa,'message':{'from':util[_0x769b('0x17')](_0x769b('0x18'),_0x18e5ec['MailAccount'][_0x769b('0x19')],_0x18e5ec['MailAccount'][_0x769b('0xc')]||_0x18e5ec[_0x769b('0x10')][_0x769b('0xd')][_0x769b('0x15')]),'to':_0x18e5ec[_0x769b('0xc')],'cc':_0x18e5ec['cc'],'bcc':_0x18e5ec[_0x769b('0x1a')],'subject':util[_0x769b('0x17')](_0x769b('0x1b'),_0x5c8042['name'],_0x18e5ec['subtractNumber'],_0x18e5ec[_0x769b('0x1c')])}};var _0x1502d3=path['join'](__dirname,_0x769b('0x1d'));var _0x564956=_0x5c8042[_0x769b('0x1e')];var _0x360dfb=util[_0x769b('0x17')]('%s.%s',path[_0x769b('0x1f')](_0x5c8042[_0x769b('0x1e')],path['extname'](_0x5c8042[_0x769b('0x1e')])),_0x769b('0x20'));var _0x121d21=path[_0x769b('0x21')](_0x1502d3,_0x564956);var _0x47ae14=path[_0x769b('0x21')](_0x1502d3,_0x360dfb);if(fs['existsSync'](_0x121d21)){_0x5c8042[_0x769b('0x22')]=_0x769b('0x23');_0x22ffb2[_0x769b('0x24')][_0x769b('0x25')]=[{'filename':_0x564956,'path':_0x121d21}];_0x22ffb2['message'][_0x769b('0x26')]=util[_0x769b('0x17')](_0x769b('0x27'),JSON[_0x769b('0x28')](_0x5c8042,null,0x2));}else if(fs[_0x769b('0x29')](_0x47ae14)){_0x5c8042['status']=_0x769b('0x23');_0x22ffb2[_0x769b('0x24')][_0x769b('0x25')]=[{'filename':_0x360dfb,'path':_0x47ae14}];}else{_0x22ffb2['message'][_0x769b('0x26')]=_0x769b('0x2a');if(!_0x18e5ec[_0x769b('0x2b')]){_0x4ce7a2=![];logger[_0x769b('0x2c')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x4ce7a2){return client[_0x769b('0x2d')](_0x769b('0x2e'),_0x22ffb2)[_0x769b('0x2f')](function(_0x563bc5){if(_0x563bc5[_0x769b('0x30')]){return logger[_0x769b('0x30')](_0x769b('0x31'),JSON['stringify'](_0x563bc5));}return logger['info'](_0x769b('0x32'));})[_0x769b('0x33')](function(_0x4a0c26){return logger['error']('error\x20mail',JSON[_0x769b('0x28')](_0x4a0c26));});}};}function handleError(){return function(_0x9c7f32){return logger[_0x769b('0x30')](JSON['stringify'](_0x9c7f32));};}function handleResult(_0x51d4b1){return function(_0x2bfb53){logger['info']('data',JSON['stringify'](_0x2bfb53));if(_0x51d4b1[_0x769b('0x10')]&&_0x51d4b1[_0x769b('0x10')][_0x769b('0xd')]&&!_[_0x769b('0x34')](_0x51d4b1['email'])){setTimeout(handleSendEmail(_0x51d4b1,_0x2bfb53),0x3c*0x3e8);}};}function handleJob(_0xe11c46){return function(){try{if(_[_0x769b('0x34')](_0xe11c46['subtractNumber'])){return logger[_0x769b('0x2c')](_0x769b('0x35'));}if(_['isNil'](_0xe11c46[_0x769b('0x1c')])){return logger[_0x769b('0x2c')](_0x769b('0x36'));}var _0xa13ed2={'startDate':moment()['subtract'](_0xe11c46['subtractNumber'],_0xe11c46[_0x769b('0x1c')])[_0x769b('0x17')](_0x769b('0x37')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x769b('0x38'),'output':_0xe11c46[_0x769b('0x39')],'name':_0xe11c46[_0x769b('0x19')]};if(!_[_0x769b('0x34')](_0xe11c46[_0x769b('0x3a')])){logger['info'](_0x769b('0x3b'),_0xe11c46['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0xe11c46['DefaultReportId']},_0xa13ed2)[_0x769b('0x2f')](handleResult(_0xe11c46))[_0x769b('0x33')](handleError());}if(!_[_0x769b('0x34')](_0xe11c46[_0x769b('0x3c')])){logger[_0x769b('0x2c')](_0x769b('0x3d'),_0xe11c46['CustomReportId']);return analyticCustomReportController[_0x769b('0x3e')]({'id':_0xe11c46[_0x769b('0x3c')]},_0xa13ed2)[_0x769b('0x2f')](handleResult(_0xe11c46))[_0x769b('0x33')](handleError());}}catch(_0x42e09d){logger[_0x769b('0x30')](JSON[_0x769b('0x28')](_0x42e09d));}return logger['info'](_0x769b('0x3f'));};}function getJobs(_0xaa0ff6){var _0x7b503e={};if(_0xaa0ff6){_0x7b503e['id']=_0xaa0ff6;}return db[_0x769b('0x40')][_0x769b('0x41')]({'where':_0x7b503e,'include':[{'model':db[_0x769b('0x10')],'attributes':['id',_0x769b('0x19'),_0x769b('0xc')],'include':[{'model':db['MailServerOut'],'as':_0x769b('0xd')}]}]})[_0x769b('0x2f')](function(_0x33522c){var _0x17e2f6=_[_0x769b('0x42')](manager[_0x769b('0x43')]);var _0x8978f6=_[_0x769b('0x44')](_0x33522c,function(_0x5b8b23){return _0x5b8b23['id']['toString']();});var _0x56e2c7=_['keyBy'](_0x33522c,function(_0x195112){return _0x195112['id']['toString']();});var _0x19cec2=_0xaa0ff6?_0x8978f6:_['difference'](_0x8978f6,_0x17e2f6);var _0x215cfd=_[_0x769b('0x45')](_0x8978f6,_0x17e2f6);var _0x54864e=_[_0x769b('0x46')](_0x17e2f6,_0x8978f6);var _0x1b7e88;var _0x594779;for(_0x1b7e88=0x0;_0x1b7e88<_0x54864e[_0x769b('0x47')]&&!_0xaa0ff6;_0x1b7e88+=0x1){_0x594779=_0x54864e[_0x1b7e88][_0x769b('0x48')]();if(manager[_0x769b('0x49')](_0x594779)){manager['stop'](_0x594779);manager['deleteJob'](_0x594779);logger[_0x769b('0x2c')](_0x769b('0x4a'),_0x594779);}}logger['info'](_0x769b('0x4b'),JSON[_0x769b('0x28')](_0x19cec2));for(_0x1b7e88=0x0;_0x1b7e88<_0x19cec2[_0x769b('0x47')];_0x1b7e88+=0x1){_0x594779=_0x19cec2[_0x1b7e88][_0x769b('0x48')]();logger[_0x769b('0x2c')](_0x769b('0x4c'),_0x594779);if(_0xaa0ff6){logger[_0x769b('0x2c')](_0x769b('0x4d'),_0xaa0ff6);logger[_0x769b('0x2c')](JSON[_0x769b('0x28')](_0x56e2c7[_0x594779]));BPromise[_0x769b('0x4e')]()[_0x769b('0x2f')](handleJob(_0x56e2c7[_0x594779]));logger[_0x769b('0x2c')](_0x769b('0x4f'),_0x56e2c7[_0x594779][_0x769b('0x19')],_0x56e2c7[_0x594779][_0x769b('0x50')]);}else if(_0x56e2c7[_0x594779][_0x769b('0x50')]&&_0x56e2c7[_0x594779][_0x769b('0x51')]&&moment()[_0x769b('0x52')](_0x56e2c7[_0x594779][_0x769b('0x53')],_0x56e2c7[_0x594779]['endAt'])){manager[_0x769b('0x54')](_0x594779,_0x56e2c7[_0x594779][_0x769b('0x50')],handleJob(_0x56e2c7[_0x594779]));manager[_0x769b('0x55')](_0x594779);logger['info']('add\x20cron',_0x56e2c7[_0x594779][_0x769b('0x19')],_0x56e2c7[_0x594779][_0x769b('0x50')]);}else if(manager[_0x769b('0x49')](_0x594779)){manager[_0x769b('0x56')](_0x594779);manager[_0x769b('0x57')](_0x594779);logger[_0x769b('0x2c')](_0x769b('0x58'),_0x56e2c7[_0x594779][_0x769b('0x19')],_0x56e2c7[_0x594779][_0x769b('0x50')]);}}for(_0x1b7e88=0x0,_0x594779;_0x1b7e88<_0x215cfd[_0x769b('0x47')]&&!_0xaa0ff6;_0x1b7e88+=0x1){_0x594779=_0x215cfd[_0x1b7e88][_0x769b('0x48')]();if(manager[_0x769b('0x49')](_0x594779)){if(_0x56e2c7[_0x594779][_0x769b('0x50')]&&_0x56e2c7[_0x594779][_0x769b('0x51')]&&moment()['isBetween'](_0x56e2c7[_0x594779]['startAt'],_0x56e2c7[_0x594779][_0x769b('0x59')])){manager['update'](_0x594779,_0x56e2c7[_0x594779][_0x769b('0x50')],handleJob(_0x56e2c7[_0x594779]));logger[_0x769b('0x2c')]('update\x20cron',_0x56e2c7[_0x594779][_0x769b('0x19')],_0x56e2c7[_0x594779]['cron']);}else{manager[_0x769b('0x56')](_0x594779);manager[_0x769b('0x57')](_0x594779);logger['info']('stop\x20cron',_0x56e2c7[_0x594779][_0x769b('0x19')],_0x56e2c7[_0x594779][_0x769b('0x50')]);}}}})[_0x769b('0x33')](function(_0xdeb927){logger[_0x769b('0x30')](JSON[_0x769b('0x28')](_0xdeb927));});}exports[_0x769b('0x5a')]=function(_0x48b902){return getJobs(_0x48b902);};exports[_0x769b('0x55')]=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 a52ccf5..deee3ab 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 _0x7532=['length','transcript','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0x1bba91,_0x3bce8e){var _0x10c192=function(_0x4ed5e7){while(--_0x4ed5e7){_0x1bba91['push'](_0x1bba91['shift']());}};_0x10c192(++_0x3bce8e);}(_0x7532,0x193));var _0x2753=function(_0x3b9570,_0x4ead31){_0x3b9570=_0x3b9570-0x0;var _0x28acdd=_0x7532[_0x3b9570];return _0x28acdd;};var _=require(_0x2753('0x0'));var AWS=require(_0x2753('0x1'));var rp=require(_0x2753('0x2'));var util=require(_0x2753('0x3'));var BPromise=require(_0x2753('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x2753('0x5'))(_0x2753('0x6'));function getTranscriptionJob(_0x3fc40d,_0xd14f4e,_0x361c24,_0x4ef7f3){return new Promise(function(_0xc326c2,_0x334292){var _0xc347c1=new AWS[(_0x2753('0x7'))]({'accessKeyId':_0xd14f4e,'secretAccessKey':_0x3fc40d,'region':_0x361c24});_0xc347c1[_0x2753('0x8')]({'TranscriptionJobName':_0x4ef7f3},function(_0x3f8b60,_0x3eb83f){if(_0x3f8b60){return _0x334292(_0x3f8b60);}else{return _0xc326c2(_0x3eb83f);}});});}function sentiment(_0xf5f0e8,_0x441fb1,_0x1b26b8,_0xe51720,_0x40cdcc){return new Promise(function(_0x3ba957,_0x90af0d){var _0x139cfe=new AWS[(_0x2753('0x9'))]({'accessKeyId':_0x441fb1,'secretAccessKey':_0xf5f0e8,'region':_0x1b26b8});_0x139cfe[_0x2753('0xa')]({'Text':_0xe51720,'LanguageCode':_0x40cdcc['substring'](0x0,0x2)},function(_0x45cdf0,_0x15acd6){if(_0x45cdf0){return _0x90af0d(_0x45cdf0);}else{return _0x3ba957(_0x15acd6);}});});}function checkTranscribeJob(_0x5aedbe,_0x197764,_0x4e2da2){var _0x4c3221;return new BPromise(function(_0x4aff1c,_0x51f71d){logger[_0x2753('0xb')](util[_0x2753('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5aedbe['id'],_0x5aedbe[_0x2753('0xd')]));return getTranscriptionJob(_0x4e2da2[_0x2753('0xe')],_0x4e2da2[_0x2753('0xf')],_0x197764[_0x2753('0x10')],_0x5aedbe[_0x2753('0xd')])[_0x2753('0x11')](function(_0x3bc016){logger[_0x2753('0xb')](util[_0x2753('0xc')](_0x2753('0x12'),_0x5aedbe['id'],_0x5aedbe[_0x2753('0xd')],_0x3bc016['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x5aedbe[_0x2753('0x13')]){switch(_0x3bc016[_0x2753('0x14')][_0x2753('0x15')]){case _0x2753('0x16'):var _0x4ee863={'transcribeStatus':_0x3bc016[_0x2753('0x14')][_0x2753('0x15')],'fileUri':_0x3bc016[_0x2753('0x14')][_0x2753('0x17')][_0x2753('0x18')]};logger['info'](util[_0x2753('0xc')](_0x2753('0x19'),_0x5aedbe['id']));return rp({'uri':_0x3bc016[_0x2753('0x14')][_0x2753('0x17')][_0x2753('0x18')],'json':!![]})[_0x2753('0x11')](function(_0x160aec){logger['info'](util[_0x2753('0xc')](_0x2753('0x1a'),_0x5aedbe['id']));if(_0x160aec&&_0x160aec[_0x2753('0x1b')]&&_0x160aec['results'][_0x2753('0x1c')]&&_0x160aec['results'][_0x2753('0x1c')]['length']){_0x4ee863[_0x2753('0x13')]='';for(var _0x39fc54=0x0;_0x39fc54<_0x160aec[_0x2753('0x1b')][_0x2753('0x1c')][_0x2753('0x1d')];_0x39fc54++){_0x4ee863[_0x2753('0x13')]+=_0x160aec[_0x2753('0x1b')][_0x2753('0x1c')][_0x39fc54][_0x2753('0x1e')]+'';}}return _0x5aedbe['update'](_0x4ee863);})[_0x2753('0x11')](function(){logger[_0x2753('0xb')](util[_0x2753('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5aedbe['id']));if(!_0x5aedbe[_0x2753('0x1f')]){throw new db['Sequelize']['ValidationError'](_0x2753('0x20'));}if(!_0x197764[_0x2753('0x21')]||!_0x197764['sentimentAccountId']||!_0x197764[_0x2753('0x22')]||!_0x197764[_0x2753('0x23')]||!_0x197764['bucket']){throw new db['Sequelize'][(_0x2753('0x24'))](_0x2753('0x25'));}if(!_0x4ee863[_0x2753('0x13')]){throw new Error(_0x2753('0x26'));}if(_0x197764[_0x2753('0x27')]===_0x4e2da2['id']){return _0x4e2da2;}else{return db[_0x2753('0x28')][_0x2753('0x29')]({'where':{'id':_settings[_0x2753('0x27')]}});}})[_0x2753('0x11')](function(_0x27e372){if(!_0x27e372){throw new db[(_0x2753('0x2a'))][(_0x2753('0x24'))](_0x2753('0x2b'));}if(!_0x27e372[_0x2753('0xe')]||!_0x27e372[_0x2753('0xf')]){throw new db[(_0x2753('0x2a'))][(_0x2753('0x24'))](_0x2753('0x2c'));}_0x4c3221=_0x27e372;logger[_0x2753('0xb')](util[_0x2753('0xc')](_0x2753('0x2d'),_0x5aedbe['id']));return sentiment(_0x4c3221['data1'],_0x4c3221['data2'],_0x197764[_0x2753('0x22')],_0x4ee863[_0x2753('0x13')],_0x197764[_0x2753('0x23')]);})[_0x2753('0x11')](function(_0x505878){logger['info'](util[_0x2753('0xc')](_0x2753('0x2e'),_0x5aedbe['id']));return _0x5aedbe[_0x2753('0x2f')]({'sentiment':_0x505878[_0x2753('0x30')],'sPositive':_0x505878[_0x2753('0x31')][_0x2753('0x32')],'sNegative':_0x505878[_0x2753('0x31')][_0x2753('0x33')],'sMixed':_0x505878[_0x2753('0x31')][_0x2753('0x34')],'sNeutral':_0x505878[_0x2753('0x31')][_0x2753('0x35')]});})['then'](function(){logger[_0x2753('0xb')](util['format'](_0x2753('0x36'),_0x5aedbe['id']));_0x4aff1c();});case _0x2753('0x37'):return _0x5aedbe['update']({'transcribeStatus':_0x2753('0x37'),'failureReason':_0x3bc016[_0x2753('0x14')]['FailureReason']})[_0x2753('0x11')](function(){logger[_0x2753('0xb')](util[_0x2753('0xc')](_0x2753('0x36'),_0x5aedbe['id']));_0x4aff1c();});default:logger[_0x2753('0xb')](util[_0x2753('0xc')](_0x2753('0x38'),_0x5aedbe['id']));break;}}else{return BPromise['resolve']()[_0x2753('0x11')](function(){if(!_0x5aedbe[_0x2753('0x1f')]){throw new db[(_0x2753('0x2a'))][(_0x2753('0x24'))](_0x2753('0x20'));}if(!_0x197764[_0x2753('0x21')]||!_0x197764['sentimentAccountId']||!_0x197764[_0x2753('0x22')]||!_0x197764[_0x2753('0x23')]||!_0x197764[_0x2753('0x39')]){throw new db['Sequelize'][(_0x2753('0x24'))](_0x2753('0x25'));}if(!_0x5aedbe['fileText']){throw new Error(_0x2753('0x26'));}if(_0x197764[_0x2753('0x27')]===_0x4e2da2['id']){return _0x4e2da2;}else{return db[_0x2753('0x28')][_0x2753('0x29')]({'where':{'id':_settings[_0x2753('0x27')]}});}})[_0x2753('0x11')](function(_0x1bc3ef){if(!_0x1bc3ef){throw new db[(_0x2753('0x2a'))][(_0x2753('0x24'))](_0x2753('0x2b'));}if(!_0x1bc3ef[_0x2753('0xe')]||!_0x1bc3ef[_0x2753('0xf')]){throw new db[(_0x2753('0x2a'))][(_0x2753('0x24'))](_0x2753('0x2c'));}_0x4c3221=_0x1bc3ef;logger[_0x2753('0xb')](util[_0x2753('0xc')](_0x2753('0x2d'),_0x5aedbe['id']));return sentiment(_0x4c3221[_0x2753('0xe')],_0x4c3221[_0x2753('0xf')],_0x197764[_0x2753('0x22')],_0x5aedbe[_0x2753('0x13')],_0x197764[_0x2753('0x23')]);})[_0x2753('0x11')](function(_0x1e6c5d){logger[_0x2753('0xb')](util[_0x2753('0xc')](_0x2753('0x2e'),_0x5aedbe['id']));return _0x5aedbe[_0x2753('0x2f')]({'sentiment':_0x1e6c5d[_0x2753('0x30')],'sPositive':_0x1e6c5d[_0x2753('0x31')][_0x2753('0x32')],'sNegative':_0x1e6c5d[_0x2753('0x31')]['Negative'],'sMixed':_0x1e6c5d[_0x2753('0x31')][_0x2753('0x34')],'sNeutral':_0x1e6c5d[_0x2753('0x31')][_0x2753('0x35')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x2753('0xb')](util[_0x2753('0xc')](_0x2753('0x36'),_0x5aedbe['id']));_0x4aff1c();});}})[_0x2753('0x3a')](function(_0x4ee5a5){if(_0x4ee5a5){if(!_0x4ee5a5[_0x2753('0x3b')]||_0x4ee5a5[_0x2753('0x3b')]!==_0x2753('0x3c')){logger[_0x2753('0x3d')](util[_0x2753('0xc')](_0x2753('0x3e'),_0x5aedbe['id']),util['inspect'](_0x4ee5a5,{'showHidden':![],'depth':null}));}}_0x4aff1c();});});}function checkTranscribe(){var _0x5da1f3;var _0x336791;var _0x15ab21;return db[_0x2753('0x3f')][_0x2753('0x40')]({'where':{'transcribeStatus':_0x2753('0x41')}})[_0x2753('0x11')](function(_0x500008){if(!_0x500008||!_0x500008[_0x2753('0x1d')]){throw new db[(_0x2753('0x2a'))][(_0x2753('0x24'))]('No\x20transcribe\x20job\x20to\x20check');}_0x5da1f3=_0x500008;return db['Setting'][_0x2753('0x29')]({'where':{'id':0x1}});})[_0x2753('0x11')](function(_0xbdd82d){if(!_0xbdd82d){throw new db[(_0x2753('0x2a'))][(_0x2753('0x24'))](_0x2753('0x42'));}_0x336791=_0xbdd82d;if(!_0x336791[_0x2753('0x6')]||!_0x336791[_0x2753('0x43')]||!_0x336791[_0x2753('0x10')]||!_0x336791[_0x2753('0x23')]||!_0x336791['bucket']){throw new db[(_0x2753('0x2a'))]['ValidationError'](_0x2753('0x44'));}return db[_0x2753('0x28')][_0x2753('0x29')]({'where':{'id':_0x336791[_0x2753('0x43')]}});})[_0x2753('0x11')](function(_0x13cfa3){if(!_0x13cfa3){throw new db[(_0x2753('0x2a'))][(_0x2753('0x24'))](_0x2753('0x2b'));}if(!_0x13cfa3[_0x2753('0xe')]||!_0x13cfa3[_0x2753('0xf')]){throw new db[(_0x2753('0x2a'))][(_0x2753('0x24'))](_0x2753('0x2c'));}_0x15ab21=_0x13cfa3;var _0x599ab1=[];_0x5da1f3['forEach'](function(_0x3f7676){_0x599ab1[_0x2753('0x45')](checkTranscribeJob(_0x3f7676,_0x336791,_0x15ab21));});return BPromise[_0x2753('0x46')](_0x599ab1);})[_0x2753('0x3a')](function(_0x1428d6){if(_0x1428d6){if(!_0x1428d6[_0x2753('0x3b')]||_0x1428d6['name']!==_0x2753('0x3c')){logger[_0x2753('0x3d')](util['inspect'](_0x1428d6,{'showHidden':![],'depth':null}));}}});}exports[_0x2753('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb81b=['../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[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','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','Negative','COMPLETED','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','forEach','push','all','start','lodash','request-promise','util','bluebird'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xb81b,0x1be));var _0xbb81=function(_0x3a9d35,_0x1c60d6){_0x3a9d35=_0x3a9d35-0x0;var _0x2a7d47=_0xb81b[_0x3a9d35];return _0x2a7d47;};var _=require(_0xbb81('0x0'));var AWS=require('aws-sdk');var rp=require(_0xbb81('0x1'));var util=require(_0xbb81('0x2'));var BPromise=require(_0xbb81('0x3'));var db=require(_0xbb81('0x4'))['db'];var logger=require('../../config/logger')(_0xbb81('0x5'));function getTranscriptionJob(_0x27868f,_0x1ce31e,_0x9f5a23,_0x41ec2){return new Promise(function(_0x372910,_0x5e2ac6){var _0x33864d=new AWS[(_0xbb81('0x6'))]({'accessKeyId':_0x1ce31e,'secretAccessKey':_0x27868f,'region':_0x9f5a23});_0x33864d[_0xbb81('0x7')]({'TranscriptionJobName':_0x41ec2},function(_0x3236c3,_0x13bdeb){if(_0x3236c3){return _0x5e2ac6(_0x3236c3);}else{return _0x372910(_0x13bdeb);}});});}function sentiment(_0x2ee201,_0x166997,_0x2839ec,_0x256999,_0x393f7e){return new Promise(function(_0x4788c4,_0x47a6ad){var _0x5bb6a1=new AWS[(_0xbb81('0x8'))]({'accessKeyId':_0x166997,'secretAccessKey':_0x2ee201,'region':_0x2839ec});_0x5bb6a1[_0xbb81('0x9')]({'Text':_0x256999,'LanguageCode':_0x393f7e[_0xbb81('0xa')](0x0,0x2)},function(_0x57bb47,_0x34e650){if(_0x57bb47){return _0x47a6ad(_0x57bb47);}else{return _0x4788c4(_0x34e650);}});});}function checkTranscribeJob(_0x3c9a16,_0x2a2784,_0x5939f6){var _0x57dedf;return new BPromise(function(_0x5bc168,_0x1e7497){logger['info'](util[_0xbb81('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3c9a16['id'],_0x3c9a16[_0xbb81('0xc')]));return getTranscriptionJob(_0x5939f6[_0xbb81('0xd')],_0x5939f6[_0xbb81('0xe')],_0x2a2784[_0xbb81('0xf')],_0x3c9a16[_0xbb81('0xc')])[_0xbb81('0x10')](function(_0x3c55ce){logger[_0xbb81('0x11')](util[_0xbb81('0xb')](_0xbb81('0x12'),_0x3c9a16['id'],_0x3c9a16[_0xbb81('0xc')],_0x3c55ce[_0xbb81('0x13')][_0xbb81('0x14')]));if(!_0x3c9a16['fileText']){switch(_0x3c55ce['TranscriptionJob'][_0xbb81('0x14')]){case'COMPLETED':var _0x321f83={'transcribeStatus':_0x3c55ce[_0xbb81('0x13')][_0xbb81('0x14')],'fileUri':_0x3c55ce[_0xbb81('0x13')][_0xbb81('0x15')][_0xbb81('0x16')]};logger[_0xbb81('0x11')](util[_0xbb81('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x3c9a16['id']));return rp({'uri':_0x3c55ce[_0xbb81('0x13')][_0xbb81('0x15')][_0xbb81('0x16')],'json':!![]})['then'](function(_0x26bbef){logger['info'](util[_0xbb81('0xb')](_0xbb81('0x17'),_0x3c9a16['id']));if(_0x26bbef&&_0x26bbef[_0xbb81('0x18')]&&_0x26bbef[_0xbb81('0x18')][_0xbb81('0x19')]&&_0x26bbef[_0xbb81('0x18')][_0xbb81('0x19')]['length']){_0x321f83[_0xbb81('0x1a')]='';for(var _0x43feec=0x0;_0x43feec<_0x26bbef[_0xbb81('0x18')][_0xbb81('0x19')][_0xbb81('0x1b')];_0x43feec++){_0x321f83[_0xbb81('0x1a')]+=_0x26bbef[_0xbb81('0x18')][_0xbb81('0x19')][_0x43feec]['transcript']+'';}}return _0x3c9a16['update'](_0x321f83);})[_0xbb81('0x10')](function(){logger['info'](util[_0xbb81('0xb')](_0xbb81('0x1c'),_0x3c9a16['id']));if(!_0x3c9a16['tempSentiment']){throw new db['Sequelize'][(_0xbb81('0x1d'))](_0xbb81('0x1e'));}if(!_0x2a2784[_0xbb81('0x1f')]||!_0x2a2784[_0xbb81('0x20')]||!_0x2a2784[_0xbb81('0x21')]||!_0x2a2784[_0xbb81('0x22')]||!_0x2a2784[_0xbb81('0x23')]){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x321f83['fileText']){throw new Error(_0xbb81('0x25'));}if(_0x2a2784[_0xbb81('0x20')]===_0x5939f6['id']){return _0x5939f6;}else{return db['CloudProvider'][_0xbb81('0x26')]({'where':{'id':_settings[_0xbb81('0x20')]}});}})[_0xbb81('0x10')](function(_0x363e2a){if(!_0x363e2a){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))](_0xbb81('0x27'));}if(!_0x363e2a[_0xbb81('0xd')]||!_0x363e2a['data2']){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))](_0xbb81('0x28'));}_0x57dedf=_0x363e2a;logger[_0xbb81('0x11')](util[_0xbb81('0xb')](_0xbb81('0x29'),_0x3c9a16['id']));return sentiment(_0x57dedf['data1'],_0x57dedf['data2'],_0x2a2784[_0xbb81('0x21')],_0x321f83[_0xbb81('0x1a')],_0x2a2784[_0xbb81('0x22')]);})[_0xbb81('0x10')](function(_0x4836e2){logger[_0xbb81('0x11')](util['format'](_0xbb81('0x2a'),_0x3c9a16['id']));return _0x3c9a16[_0xbb81('0x2b')]({'sentiment':_0x4836e2[_0xbb81('0x2c')],'sPositive':_0x4836e2[_0xbb81('0x2d')][_0xbb81('0x2e')],'sNegative':_0x4836e2[_0xbb81('0x2d')]['Negative'],'sMixed':_0x4836e2['SentimentScore'][_0xbb81('0x2f')],'sNeutral':_0x4836e2[_0xbb81('0x2d')][_0xbb81('0x30')]});})[_0xbb81('0x10')](function(){logger['info'](util[_0xbb81('0xb')](_0xbb81('0x1c'),_0x3c9a16['id']));_0x5bc168();});case _0xbb81('0x31'):return _0x3c9a16[_0xbb81('0x2b')]({'transcribeStatus':_0xbb81('0x31'),'failureReason':_0x3c55ce[_0xbb81('0x13')][_0xbb81('0x32')]})[_0xbb81('0x10')](function(){logger[_0xbb81('0x11')](util[_0xbb81('0xb')](_0xbb81('0x1c'),_0x3c9a16['id']));_0x5bc168();});default:logger[_0xbb81('0x11')](util[_0xbb81('0xb')](_0xbb81('0x33'),_0x3c9a16['id']));break;}}else{return BPromise[_0xbb81('0x34')]()[_0xbb81('0x10')](function(){if(!_0x3c9a16[_0xbb81('0x35')]){throw new db['Sequelize'][(_0xbb81('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2a2784[_0xbb81('0x1f')]||!_0x2a2784['sentimentAccountId']||!_0x2a2784[_0xbb81('0x21')]||!_0x2a2784['language']||!_0x2a2784[_0xbb81('0x23')]){throw new db[(_0xbb81('0x24'))]['ValidationError'](_0xbb81('0x36'));}if(!_0x3c9a16[_0xbb81('0x1a')]){throw new Error('Transcript\x20not\x20available');}if(_0x2a2784[_0xbb81('0x20')]===_0x5939f6['id']){return _0x5939f6;}else{return db['CloudProvider'][_0xbb81('0x26')]({'where':{'id':_settings[_0xbb81('0x20')]}});}})[_0xbb81('0x10')](function(_0xf7b134){if(!_0xf7b134){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))](_0xbb81('0x27'));}if(!_0xf7b134[_0xbb81('0xd')]||!_0xf7b134[_0xbb81('0xe')]){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))](_0xbb81('0x28'));}_0x57dedf=_0xf7b134;logger[_0xbb81('0x11')](util['format'](_0xbb81('0x29'),_0x3c9a16['id']));return sentiment(_0x57dedf[_0xbb81('0xd')],_0x57dedf[_0xbb81('0xe')],_0x2a2784[_0xbb81('0x21')],_0x3c9a16['fileText'],_0x2a2784[_0xbb81('0x22')]);})[_0xbb81('0x10')](function(_0x51b433){logger[_0xbb81('0x11')](util[_0xbb81('0xb')](_0xbb81('0x2a'),_0x3c9a16['id']));return _0x3c9a16[_0xbb81('0x2b')]({'sentiment':_0x51b433['Sentiment'],'sPositive':_0x51b433[_0xbb81('0x2d')][_0xbb81('0x2e')],'sNegative':_0x51b433['SentimentScore'][_0xbb81('0x37')],'sMixed':_0x51b433[_0xbb81('0x2d')][_0xbb81('0x2f')],'sNeutral':_0x51b433[_0xbb81('0x2d')][_0xbb81('0x30')],'transcribeStatus':_0xbb81('0x38')});})['then'](function(){logger['info'](util[_0xbb81('0xb')](_0xbb81('0x1c'),_0x3c9a16['id']));_0x5bc168();});}})[_0xbb81('0x39')](function(_0x475674){if(_0x475674){if(!_0x475674[_0xbb81('0x3a')]||_0x475674[_0xbb81('0x3a')]!==_0xbb81('0x3b')){logger[_0xbb81('0x3c')](util[_0xbb81('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3c9a16['id']),util[_0xbb81('0x3d')](_0x475674,{'showHidden':![],'depth':null}));}}_0x5bc168();});});}function checkTranscribe(){var _0x17b5c2;var _0x15bea8;var _0x4d3119;return db[_0xbb81('0x3e')][_0xbb81('0x3f')]({'where':{'transcribeStatus':_0xbb81('0x40')}})['then'](function(_0x47d4cd){if(!_0x47d4cd||!_0x47d4cd[_0xbb81('0x1b')]){throw new db['Sequelize'][(_0xbb81('0x1d'))](_0xbb81('0x41'));}_0x17b5c2=_0x47d4cd;return db[_0xbb81('0x42')]['findOne']({'where':{'id':0x1}});})[_0xbb81('0x10')](function(_0x2229f8){if(!_0x2229f8){throw new db['Sequelize'][(_0xbb81('0x1d'))](_0xbb81('0x43'));}_0x15bea8=_0x2229f8;if(!_0x15bea8[_0xbb81('0x5')]||!_0x15bea8[_0xbb81('0x44')]||!_0x15bea8['transcribeRegion']||!_0x15bea8['language']||!_0x15bea8['bucket']){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))](_0xbb81('0x45'));}return db[_0xbb81('0x46')][_0xbb81('0x26')]({'where':{'id':_0x15bea8[_0xbb81('0x44')]}});})[_0xbb81('0x10')](function(_0x2b4a02){if(!_0x2b4a02){throw new db[(_0xbb81('0x24'))][(_0xbb81('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2b4a02[_0xbb81('0xd')]||!_0x2b4a02[_0xbb81('0xe')]){throw new db[(_0xbb81('0x24'))]['ValidationError'](_0xbb81('0x28'));}_0x4d3119=_0x2b4a02;var _0x547843=[];_0x17b5c2[_0xbb81('0x47')](function(_0x195436){_0x547843[_0xbb81('0x48')](checkTranscribeJob(_0x195436,_0x15bea8,_0x4d3119));});return BPromise[_0xbb81('0x49')](_0x547843);})[_0xbb81('0x39')](function(_0xfa294){if(_0xfa294){if(!_0xfa294[_0xbb81('0x3a')]||_0xfa294[_0xbb81('0x3a')]!==_0xbb81('0x3b')){logger[_0xbb81('0x3c')](util[_0xbb81('0x3d')](_0xfa294,{'showHidden':![],'depth':null}));}}});}exports[_0xbb81('0x4a')]=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 2d2570b..7264ce9 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefc0=['CmHopper','bulkCreate','finished\x20populating','hopper1','contacts2','hopper2','catch','util','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','log'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xefc0,0x139));var _0x0efc=function(_0x16dce4,_0x533b15){_0x16dce4=_0x16dce4-0x0;var _0x11f549=_0xefc0[_0x16dce4];return _0x11f549;};'use strict';var util=require(_0x0efc('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x0efc('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x0efc('0x2')+i,'phone':0xf879fb460+i,'email':_0x0efc('0x3')+i+_0x0efc('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0efc('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x0efc('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0efc('0x5')](),'updatedAt':Date[_0x0efc('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0efc('0x1')]({'id':i,'firstName':_0x0efc('0x6')+i,'lastName':_0x0efc('0x2')+i,'phone':0xf879fb460+i,'email':_0x0efc('0x3')+i+_0x0efc('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0efc('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x0efc('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0efc('0x5')](),'updatedAt':Date['now']()});}db[_0x0efc('0x7')][_0x0efc('0x8')]({'where':{}})[_0x0efc('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0x0efc('0x9')](function(){console[_0x0efc('0xa')]('finished\x20populating','contacts1');return db[_0x0efc('0xb')]['destroy']({'where':{}});})['then'](function(){return db[_0x0efc('0xb')][_0x0efc('0xc')](hopper);})[_0x0efc('0x9')](function(){console[_0x0efc('0xa')](_0x0efc('0xd'),_0x0efc('0xe'));return db[_0x0efc('0x7')][_0x0efc('0xc')](contacts2);})[_0x0efc('0x9')](function(){console['log'](_0x0efc('0xd'),_0x0efc('0xf'));return db[_0x0efc('0xb')][_0x0efc('0xc')](hopper2);})[_0x0efc('0x9')](function(){console[_0x0efc('0xa')](_0x0efc('0xd'),_0x0efc('0x10'));})[_0x0efc('0x11')](function(_0x58ad98){console['log'](_0x58ad98);}); \ No newline at end of file +var _0x1cb8=['catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','hopper2'];(function(_0x698698,_0x5ebb81){var _0x3e6726=function(_0x290afe){while(--_0x290afe){_0x698698['push'](_0x698698['shift']());}};_0x3e6726(++_0x5ebb81);}(_0x1cb8,0xac));var _0x81cb=function(_0x3b47b8,_0x1ca4f3){_0x3b47b8=_0x3b47b8-0x0;var _0x5227ed=_0x1cb8[_0x3b47b8];return _0x5227ed;};'use strict';var util=require(_0x81cb('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x81cb('0x1')]({'id':i,'firstName':_0x81cb('0x2')+i,'lastName':_0x81cb('0x3')+i,'phone':0xf879fb460+i,'email':_0x81cb('0x4')+i+_0x81cb('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x81cb('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x81cb('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x81cb('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x81cb('0x1')]({'id':i,'firstName':_0x81cb('0x2')+i,'lastName':_0x81cb('0x3')+i,'phone':0xf879fb460+i,'email':_0x81cb('0x4')+i+_0x81cb('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x81cb('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x81cb('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x81cb('0x6')](),'updatedAt':Date[_0x81cb('0x6')]()});}db[_0x81cb('0x7')][_0x81cb('0x8')]({'where':{}})['then'](function(){return db[_0x81cb('0x7')]['bulkCreate'](contacts);})[_0x81cb('0x9')](function(){console[_0x81cb('0xa')](_0x81cb('0xb'),_0x81cb('0xc'));return db[_0x81cb('0xd')][_0x81cb('0x8')]({'where':{}});})[_0x81cb('0x9')](function(){return db[_0x81cb('0xd')][_0x81cb('0xe')](hopper);})[_0x81cb('0x9')](function(){console[_0x81cb('0xa')]('finished\x20populating',_0x81cb('0xf'));return db[_0x81cb('0x7')][_0x81cb('0xe')](contacts2);})['then'](function(){console[_0x81cb('0xa')](_0x81cb('0xb'),_0x81cb('0x10'));return db[_0x81cb('0xd')][_0x81cb('0xe')](hopper2);})[_0x81cb('0x9')](function(){console[_0x81cb('0xa')](_0x81cb('0xb'),_0x81cb('0x11'));})[_0x81cb('0x12')](function(_0x31face){console['log'](_0x31face);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 5982b62..dfe674a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1dc4=['format','%s%s','agent','%s%s@xcally.com','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','push'];(function(_0x3be951,_0x9d9eed){var _0x53e527=function(_0x483a9f){while(--_0x483a9f){_0x3be951['push'](_0x3be951['shift']());}};_0x53e527(++_0x9d9eed);}(_0x1dc4,0x186));var _0x41dc=function(_0x12c137,_0x170b68){_0x12c137=_0x12c137-0x0;var _0x2a06ad=_0x1dc4[_0x12c137];return _0x2a06ad;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x41dc('0x0')]({'name':util[_0x41dc('0x1')](_0x41dc('0x2'),'agent',i),'fullname':util[_0x41dc('0x1')](_0x41dc('0x2'),_0x41dc('0x3'),i),'email':util['format'](_0x41dc('0x4'),'agent',i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x41dc('0x5'),'transport':['udp','ws',_0x41dc('0x6')],'disallow':[_0x41dc('0x7')],'allow':[_0x41dc('0x8')],'defaultuser':util['format'](_0x41dc('0x2'),_0x41dc('0x3'),i),'encryption':'yes','avpf':_0x41dc('0x9'),'force_avp':_0x41dc('0x9'),'icesupport':_0x41dc('0x9'),'dtlsenable':_0x41dc('0x9'),'dtlsverify':'no','dtlscertfile':_0x41dc('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x41dc('0xb'),'callerid':util['format'](_0x41dc('0xc'),util[_0x41dc('0x1')](_0x41dc('0x2'),_0x41dc('0x3'),i),0xfa0+i)});}db['User'][_0x41dc('0xd')](users)[_0x41dc('0xe')](function(){console[_0x41dc('0xf')](_0x41dc('0x10'));})['catch'](function(_0x15da32){console[_0x41dc('0xf')](_0x15da32);}); \ No newline at end of file +var _0xd7b3=['password','friend','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x14e0b9,_0x3e044d){var _0x147352=function(_0x427c51){while(--_0x427c51){_0x14e0b9['push'](_0x14e0b9['shift']());}};_0x147352(++_0x3e044d);}(_0xd7b3,0x1c7));var _0x3d7b=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0xd7b3[_0x145b3c];return _0x1b6e36;};'use strict';var util=require(_0x3d7b('0x0'));var db=require(_0x3d7b('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3d7b('0x2')]({'name':util[_0x3d7b('0x3')](_0x3d7b('0x4'),_0x3d7b('0x5'),i),'fullname':util[_0x3d7b('0x3')](_0x3d7b('0x4'),_0x3d7b('0x5'),i),'email':util[_0x3d7b('0x3')](_0x3d7b('0x6'),'agent',i),'role':_0x3d7b('0x5'),'password':_0x3d7b('0x7'),'internal':0xfa0+i,'type':_0x3d7b('0x8'),'transport':['udp','ws',_0x3d7b('0x9')],'disallow':[_0x3d7b('0xa')],'allow':[_0x3d7b('0xb')],'defaultuser':util[_0x3d7b('0x3')](_0x3d7b('0x4'),_0x3d7b('0x5'),i),'encryption':_0x3d7b('0xc'),'avpf':_0x3d7b('0xc'),'force_avp':'yes','icesupport':_0x3d7b('0xc'),'dtlsenable':_0x3d7b('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x3d7b('0xd'),'dtlssetup':_0x3d7b('0xe'),'callerid':util['format'](_0x3d7b('0xf'),util['format'](_0x3d7b('0x4'),_0x3d7b('0x5'),i),0xfa0+i)});}db[_0x3d7b('0x10')]['bulkCreate'](users)[_0x3d7b('0x11')](function(){console[_0x3d7b('0x12')](_0x3d7b('0x13'));})[_0x3d7b('0x14')](function(_0x322824){console[_0x3d7b('0x12')](_0x322824);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index db10d60..386ae3f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ca4=['fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','address','DISCONNECTED','lodash','util','bluebird','../mysqldb','Agents','User','role','agent','name','telephone','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','then','map','where','Campaign','type','format','%s:queue:%s','query','find','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','userProfileId','ChatQueue','FaxQueues','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','chat'];(function(_0x28b9b5,_0x520aaf){var _0xd7b59b=function(_0x22de68){while(--_0x22de68){_0x28b9b5['push'](_0x28b9b5['shift']());}};_0xd7b59b(++_0x520aaf);}(_0x6ca4,0x86));var _0x46ca=function(_0x5a7900,_0x3561d2){_0x5a7900=_0x5a7900-0x0;var _0x511116=_0x6ca4[_0x5a7900];return _0x511116;};'use strict';var _=require(_0x46ca('0x0'));var util=require(_0x46ca('0x1'));var BPromise=require(_0x46ca('0x2'));var db=require(_0x46ca('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x46ca('0x4'),'model':db[_0x46ca('0x5')],'attributes':['id','name',_0x46ca('0x6')],'raw':!![],'where':{'role':_0x46ca('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x46ca('0x8')],'where':{'role':_0x46ca('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x46ca('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x46ca('0x8'),'type'],'where':{'type':_0x46ca('0xa')}};function getAssociatedResources(_0x67c67a,_0x2e9bf5,_0x2b77b5){return db['UserProfileSection'][_0x46ca('0xb')]({'where':{'name':_0x67c67a,'userProfileId':_0x2e9bf5},'raw':!![]})['then'](function(_0x31a35a){if(_0x31a35a){if(_0x31a35a[_0x46ca('0xc')]){switch(_0x67c67a){case _0x46ca('0xd'):case _0x46ca('0xe'):case'FaxQueues':case _0x46ca('0xf'):case _0x46ca('0x10'):case _0x46ca('0x11'):case _0x46ca('0x12'):return db[_0x2b77b5][_0x46ca('0x13')](queryQueues);case _0x46ca('0x14'):return db[_0x2b77b5]['findAll'](queryTelephones);case _0x46ca('0x15'):return db[_0x2b77b5][_0x46ca('0x13')](queryTrunks);case _0x46ca('0x16'):return db[_0x2b77b5][_0x46ca('0x13')](queryCampaigns);}}else{return db[_0x46ca('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x31a35a['id']},'raw':!![]})[_0x46ca('0x18')](function(_0x43b59a){if(_0x43b59a){var _0xbfadfd={'where':{'id':_[_0x46ca('0x19')](_0x43b59a,'resourceId')},'raw':!![]};switch(_0x2b77b5){case _0x46ca('0x5'):_0xbfadfd[_0x46ca('0x1a')][_0x46ca('0x6')]=_0x46ca('0x9');break;case _0x46ca('0x1b'):_0xbfadfd[_0x46ca('0x1a')][_0x46ca('0x1c')]=_0x46ca('0xa');break;}return db[_0x2b77b5][_0x46ca('0x13')](_0xbfadfd);}else{return[];}});}}else{return[];}})['then'](function(_0x213f96){return _0x213f96;});}function joinOrLeaveQueues(_0x54f4d3,_0x554b67,_0x47e155,_0x2212d0){_0x54f4d3[_0x554b67](util[_0x46ca('0x1d')](_0x46ca('0x1e'),_0x47e155,_0x2212d0[_0x46ca('0x8')]));if(_0x2212d0[_0x46ca('0x4')]){for(var _0x1e1e58=0x0;_0x1e1e58<_0x2212d0[_0x46ca('0x4')]['length'];_0x1e1e58+=0x1){_0x54f4d3[_0x554b67](util[_0x46ca('0x1d')]('user:%s',_0x2212d0[_0x46ca('0x4')][_0x1e1e58][_0x46ca('0x8')]));}}}function joinOrLeave(_0x16a24e,_0x2bc29c,_0x4b0eb7){var _0x15bc50;if(_0x16a24e['handshake'][_0x46ca('0x1f')]['id']){db['User'][_0x46ca('0x20')]({'attributes':['id','name',_0x46ca('0x6'),'userProfileId'],'where':{'id':_0x16a24e[_0x46ca('0x21')][_0x46ca('0x1f')]['id']},'include':[{'model':db[_0x46ca('0x22')],'as':_0x46ca('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x46ca('0x24')],'as':_0x46ca('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x46ca('0x26')],'as':_0x46ca('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x46ca('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x46ca('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x493873){if(_0x493873){_0x15bc50=_0x493873;_0x16a24e[_0x2bc29c](util[_0x46ca('0x1d')]('user:%s',_0x493873['name']));var _0x39dab1=[];switch(_0x493873[_0x46ca('0x6')]){case _0x46ca('0x2a'):_0x16a24e[_0x2bc29c](_0x46ca('0x2b'));_0x16a24e[_0x2bc29c](_0x46ca('0x2c'));if(queryQueues[_0x46ca('0x2d')](_0x46ca('0x2e'))){delete queryQueues['include'];}_0x39dab1[_0x46ca('0x2f')](db[_0x46ca('0x30')][_0x46ca('0x13')](queryQueues));_0x39dab1[_0x46ca('0x2f')](db['ChatQueue'][_0x46ca('0x13')](queryQueues));_0x39dab1[_0x46ca('0x2f')](db[_0x46ca('0x31')][_0x46ca('0x13')](queryQueues));_0x39dab1[_0x46ca('0x2f')](db[_0x46ca('0x32')][_0x46ca('0x13')](queryQueues));_0x39dab1[_0x46ca('0x2f')](db[_0x46ca('0x33')][_0x46ca('0x13')](queryQueues));_0x39dab1[_0x46ca('0x2f')](db[_0x46ca('0x34')][_0x46ca('0x13')](queryQueues));_0x39dab1[_0x46ca('0x2f')](db[_0x46ca('0x35')]['findAll'](queryQueues));_0x39dab1[_0x46ca('0x2f')](db[_0x46ca('0x5')][_0x46ca('0x13')](queryTelephones));_0x39dab1[_0x46ca('0x2f')](db['Trunk'][_0x46ca('0x13')](queryTrunks));_0x39dab1[_0x46ca('0x2f')](db[_0x46ca('0x1b')][_0x46ca('0x13')](queryCampaigns));_0x39dab1[_0x46ca('0x2f')](db[_0x46ca('0x5')][_0x46ca('0x13')](queryAgents));break;case'user':_0x16a24e[_0x2bc29c]('voice:inbound');_0x16a24e[_0x2bc29c](_0x46ca('0x2c'));_0x39dab1[_0x46ca('0x2f')](getAssociatedResources(_0x46ca('0xd'),_0x493873['userProfileId'],_0x46ca('0x30')));_0x39dab1[_0x46ca('0x2f')](getAssociatedResources(_0x46ca('0xe'),_0x493873[_0x46ca('0x36')],_0x46ca('0x37')));_0x39dab1['push'](getAssociatedResources(_0x46ca('0x38'),_0x493873['userProfileId'],_0x46ca('0x31')));_0x39dab1[_0x46ca('0x2f')](getAssociatedResources('SmsQueues',_0x493873[_0x46ca('0x36')],_0x46ca('0x32')));_0x39dab1[_0x46ca('0x2f')](getAssociatedResources(_0x46ca('0x10'),_0x493873[_0x46ca('0x36')],'MailQueue'));_0x39dab1['push'](getAssociatedResources('OpenchannelQueues',_0x493873['userProfileId'],'OpenchannelQueue'));_0x39dab1['push'](getAssociatedResources(_0x46ca('0x12'),_0x493873[_0x46ca('0x36')],_0x46ca('0x35')));_0x39dab1[_0x46ca('0x2f')](getAssociatedResources(_0x46ca('0x14'),_0x493873[_0x46ca('0x36')],_0x46ca('0x5')));_0x39dab1['push'](getAssociatedResources('Trunks',_0x493873[_0x46ca('0x36')],_0x46ca('0x39')));_0x39dab1['push'](getAssociatedResources(_0x46ca('0x16'),_0x493873['userProfileId'],'Campaign'));_0x39dab1[_0x46ca('0x2f')](db[_0x46ca('0x5')]['findAll'](queryAgents));break;case'agent':_0x16a24e[_0x2bc29c](_0x46ca('0x2b'));_0x16a24e[_0x2bc29c](_0x46ca('0x2c'));_0x39dab1[_0x46ca('0x2f')](_0x493873[_0x46ca('0x3a')]({'attributes':['id',_0x46ca('0x8')]}));_0x39dab1[_0x46ca('0x2f')](_0x493873[_0x46ca('0x3b')]({'attributes':['id',_0x46ca('0x8')]}));_0x39dab1[_0x46ca('0x2f')](_0x493873[_0x46ca('0x3c')]({'attributes':['id',_0x46ca('0x8')]}));_0x39dab1['push'](_0x493873[_0x46ca('0x3d')]({'attributes':['id','name']}));_0x39dab1[_0x46ca('0x2f')](_0x493873[_0x46ca('0x3e')]({'attributes':['id',_0x46ca('0x8')]}));_0x39dab1['push'](_0x493873[_0x46ca('0x3f')]({'attributes':['id',_0x46ca('0x8')]}));_0x39dab1[_0x46ca('0x2f')](_0x493873['getWhatsappQueues']({'attributes':['id',_0x46ca('0x8')]}));break;}return BPromise['all'](_0x39dab1);}})['then'](function(_0x47df07){if(_0x47df07&&_0x47df07[_0x46ca('0x40')]){for(var _0x2d407e=0x0;_0x2d407e<_0x47df07[_0x46ca('0x40')];_0x2d407e+=0x1){for(var _0x3111a4=0x0;_0x3111a4<_0x47df07[_0x2d407e][_0x46ca('0x40')];_0x3111a4+=0x1){switch(_0x2d407e){case 0x0:joinOrLeaveQueues(_0x16a24e,_0x2bc29c,'voice',_0x47df07[_0x2d407e][_0x3111a4]);break;case 0x1:joinOrLeaveQueues(_0x16a24e,_0x2bc29c,_0x46ca('0x41'),_0x47df07[_0x2d407e][_0x3111a4]);break;case 0x2:joinOrLeaveQueues(_0x16a24e,_0x2bc29c,_0x46ca('0x42'),_0x47df07[_0x2d407e][_0x3111a4]);break;case 0x3:joinOrLeaveQueues(_0x16a24e,_0x2bc29c,_0x46ca('0x43'),_0x47df07[_0x2d407e][_0x3111a4]);break;case 0x4:joinOrLeaveQueues(_0x16a24e,_0x2bc29c,_0x46ca('0x44'),_0x47df07[_0x2d407e][_0x3111a4]);break;case 0x5:joinOrLeaveQueues(_0x16a24e,_0x2bc29c,_0x46ca('0x45'),_0x47df07[_0x2d407e][_0x3111a4]);break;case 0x6:joinOrLeaveQueues(_0x16a24e,_0x2bc29c,_0x46ca('0x46'),_0x47df07[_0x2d407e][_0x3111a4]);break;case 0x7:_0x16a24e[_0x2bc29c](util[_0x46ca('0x1d')](_0x46ca('0x47'),_0x47df07[_0x2d407e][_0x3111a4]['name']));break;case 0x8:_0x16a24e[_0x2bc29c](util[_0x46ca('0x1d')](_0x46ca('0x48'),_0x47df07[_0x2d407e][_0x3111a4]['name']));break;case 0x9:_0x16a24e[_0x2bc29c](util[_0x46ca('0x1d')](_0x46ca('0x49'),_0x47df07[_0x2d407e][_0x3111a4][_0x46ca('0x1c')],_0x47df07[_0x2d407e][_0x3111a4]['name']));break;case 0xa:_0x16a24e[_0x2bc29c](util['format'](_0x46ca('0x4a'),_0x47df07[_0x2d407e][_0x3111a4][_0x46ca('0x8')]));break;}}}}})[_0x46ca('0x18')](function(){if(_0x2bc29c===_0x46ca('0x4b')){var _0x2d2a8d=_['map'](_0x15bc50['ChatInteractions'],'id');return _0x15bc50[_0x46ca('0x4c')](_0x2d2a8d)['then'](function(){for(var _0x30d5ed=0x0;_0x30d5ed<_0x2d2a8d[_0x46ca('0x40')];_0x30d5ed+=0x1){_0x4b0eb7[_0x46ca('0x4d')](_0x46ca('0x4e'),{'ChatInteractionId':Number(_0x2d2a8d[_0x30d5ed]),'UserId':Number(_0x15bc50['id'])});}});}})[_0x46ca('0x18')](function(){if(_0x2bc29c===_0x46ca('0x4b')){var _0x7ce27c=_['map'](_0x15bc50[_0x46ca('0x25')],'id');return _0x15bc50['removeMailInteractions'](_0x7ce27c)[_0x46ca('0x18')](function(){for(var _0x432ce4=0x0;_0x432ce4<_0x7ce27c[_0x46ca('0x40')];_0x432ce4+=0x1){_0x4b0eb7[_0x46ca('0x4d')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x7ce27c[_0x432ce4]),'UserId':Number(_0x15bc50['id'])});}});}})[_0x46ca('0x18')](function(){if(_0x2bc29c===_0x46ca('0x4b')){var _0x506f0f=_[_0x46ca('0x19')](_0x15bc50[_0x46ca('0x27')],'id');return _0x15bc50['removeFaxInteractions'](_0x506f0f)['then'](function(){for(var _0x26d30b=0x0;_0x26d30b<_0x506f0f[_0x46ca('0x40')];_0x26d30b+=0x1){_0x4b0eb7[_0x46ca('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x506f0f[_0x26d30b]),'UserId':Number(_0x15bc50['id'])});}});}})['then'](function(){if(_0x2bc29c==='leave'){var _0x2b5daf=_[_0x46ca('0x19')](_0x15bc50[_0x46ca('0x4f')],'id');return _0x15bc50['removeSmsInteractions'](_0x2b5daf)[_0x46ca('0x18')](function(){for(var _0x753311=0x0;_0x753311<_0x2b5daf['length'];_0x753311+=0x1){_0x4b0eb7[_0x46ca('0x4d')](_0x46ca('0x50'),{'SmsInteractionId':Number(_0x2b5daf[_0x753311]),'UserId':Number(_0x15bc50['id'])});}});}})['then'](function(){if(_0x2bc29c===_0x46ca('0x4b')){var _0x176faa=_[_0x46ca('0x19')](_0x15bc50[_0x46ca('0x51')],'id');return _0x15bc50[_0x46ca('0x52')](_0x176faa)[_0x46ca('0x18')](function(){for(var _0x2609cb=0x0;_0x2609cb<_0x176faa['length'];_0x2609cb+=0x1){_0x4b0eb7[_0x46ca('0x4d')](_0x46ca('0x53'),{'OpenchannelInteractionId':Number(_0x176faa[_0x2609cb]),'UserId':Number(_0x15bc50['id'])});}});}})[_0x46ca('0x18')](function(){if(_0x2bc29c===_0x46ca('0x4b')){var _0x5b3a0c=_[_0x46ca('0x19')](_0x15bc50[_0x46ca('0x54')],'id');return _0x15bc50[_0x46ca('0x55')](_0x5b3a0c)[_0x46ca('0x18')](function(){for(var _0x5929b9=0x0;_0x5929b9<_0x5b3a0c[_0x46ca('0x40')];_0x5929b9+=0x1){_0x4b0eb7[_0x46ca('0x4d')](_0x46ca('0x56'),{'WhatsappInteractionId':Number(_0x5b3a0c[_0x5929b9]),'UserId':Number(_0x15bc50['id'])});}});}})[_0x46ca('0x57')](function(_0x4ab733){_0x16a24e[_0x46ca('0x58')](_0x4ab733);});}}function onDisconnect(_0xe6d14c,_0x5166fd){joinOrLeave(_0xe6d14c,_0x46ca('0x4b'),_0x5166fd);}function onConnect(_0x171e02){joinOrLeave(_0x171e02,_0x46ca('0x59'));}exports['default']=function(_0x1a05f5){_0x1a05f5['on'](_0x46ca('0x5a'),function(_0x28c9cd){_0x28c9cd[_0x46ca('0x5b')](0x0);_0x28c9cd['address']=_0x28c9cd['request'][_0x46ca('0x5a')][_0x46ca('0x5c')]+':'+_0x28c9cd[_0x46ca('0x5d')][_0x46ca('0x5a')][_0x46ca('0x5e')];_0x28c9cd[_0x46ca('0x5f')]=new Date();_0x28c9cd[_0x46ca('0x58')]=function(_0x8d8a3e){console[_0x46ca('0x58')](_0x46ca('0x60')+_0x28c9cd[_0x46ca('0x61')][_0x46ca('0x8')]+'['+_0x28c9cd[_0x46ca('0x62')]+']',_0x8d8a3e);};_0x28c9cd['on']('disconnect',function(){onDisconnect(_0x28c9cd,_0x1a05f5);_0x28c9cd['log'](_0x46ca('0x63'));});onConnect(_0x28c9cd);_0x28c9cd[_0x46ca('0x58')]('CONNECTED');});}; \ No newline at end of file +var _0x48bd=['length','format','user:%s','query','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','Trunk','User','user','ChatQueues','FaxQueue','MailQueue','OpenchannelQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','removeMailInteractions','FaxInteractions','SmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','type','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','where','Campaign','%s:queue:%s'];(function(_0x521d4c,_0x2eb55e){var _0x138487=function(_0x1a0f60){while(--_0x1a0f60){_0x521d4c['push'](_0x521d4c['shift']());}};_0x138487(++_0x2eb55e);}(_0x48bd,0xfd));var _0xd48b=function(_0xe4ecfe,_0x325e02){_0xe4ecfe=_0xe4ecfe-0x0;var _0x251a95=_0x48bd[_0xe4ecfe];return _0x251a95;};'use strict';var _=require(_0xd48b('0x0'));var util=require('util');var BPromise=require(_0xd48b('0x1'));var db=require(_0xd48b('0x2'))['db'];var config=require(_0xd48b('0x3'));var queryQueues={'attributes':['id',_0xd48b('0x4')],'include':[{'as':_0xd48b('0x5'),'model':db['User'],'attributes':['id',_0xd48b('0x4'),_0xd48b('0x6')],'raw':!![],'where':{'role':_0xd48b('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd48b('0x4')],'where':{'role':_0xd48b('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd48b('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xd48b('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xd48b('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x277d85,_0x30755c,_0x2c6216){return db['UserProfileSection'][_0xd48b('0xa')]({'where':{'name':_0x277d85,'userProfileId':_0x30755c},'raw':!![]})[_0xd48b('0xb')](function(_0x64af3f){if(_0x64af3f){if(_0x64af3f[_0xd48b('0xc')]){switch(_0x277d85){case _0xd48b('0xd'):case'ChatQueues':case _0xd48b('0xe'):case _0xd48b('0xf'):case'MailQueues':case _0xd48b('0x10'):case'WhatsappQueues':return db[_0x2c6216][_0xd48b('0x11')](queryQueues);case _0xd48b('0x12'):return db[_0x2c6216][_0xd48b('0x11')](queryTelephones);case _0xd48b('0x13'):return db[_0x2c6216][_0xd48b('0x11')](queryTrunks);case _0xd48b('0x14'):return db[_0x2c6216]['findAll'](queryCampaigns);}}else{return db[_0xd48b('0x15')][_0xd48b('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x64af3f['id']},'raw':!![]})[_0xd48b('0xb')](function(_0x14e2e5){if(_0x14e2e5){var _0x48810b={'where':{'id':_[_0xd48b('0x16')](_0x14e2e5,'resourceId')},'raw':!![]};switch(_0x2c6216){case'User':_0x48810b[_0xd48b('0x17')]['role']=_0xd48b('0x8');break;case _0xd48b('0x18'):_0x48810b[_0xd48b('0x17')][_0xd48b('0x9')]='ivr';break;}return db[_0x2c6216]['findAll'](_0x48810b);}else{return[];}});}}else{return[];}})['then'](function(_0x5bc18b){return _0x5bc18b;});}function joinOrLeaveQueues(_0x5e3862,_0x574724,_0x5afd88,_0x959b30){_0x5e3862[_0x574724](util['format'](_0xd48b('0x19'),_0x5afd88,_0x959b30['name']));if(_0x959b30['Agents']){for(var _0x573e98=0x0;_0x573e98<_0x959b30[_0xd48b('0x5')][_0xd48b('0x1a')];_0x573e98+=0x1){_0x5e3862[_0x574724](util[_0xd48b('0x1b')](_0xd48b('0x1c'),_0x959b30['Agents'][_0x573e98][_0xd48b('0x4')]));}}}function joinOrLeave(_0x5d8874,_0x20db91,_0x4451db){var _0x87776;if(_0x5d8874['handshake'][_0xd48b('0x1d')]['id']){db['User']['find']({'attributes':['id',_0xd48b('0x4'),_0xd48b('0x6'),_0xd48b('0x1e')],'where':{'id':_0x5d8874[_0xd48b('0x1f')][_0xd48b('0x1d')]['id']},'include':[{'model':db[_0xd48b('0x20')],'as':_0xd48b('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xd48b('0x22')],'as':_0xd48b('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xd48b('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd48b('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd48b('0x26')],'as':_0xd48b('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xd48b('0x28')],'as':_0xd48b('0x29'),'attributes':['id'],'raw':!![]}]})[_0xd48b('0xb')](function(_0x72b78b){if(_0x72b78b){_0x87776=_0x72b78b;_0x5d8874[_0x20db91](util['format'](_0xd48b('0x1c'),_0x72b78b[_0xd48b('0x4')]));var _0x5174d0=[];switch(_0x72b78b['role']){case _0xd48b('0x2a'):_0x5d8874[_0x20db91](_0xd48b('0x2b'));_0x5d8874[_0x20db91](_0xd48b('0x2c'));if(queryQueues[_0xd48b('0x2d')]('include')){delete queryQueues[_0xd48b('0x2e')];}_0x5174d0['push'](db['VoiceQueue'][_0xd48b('0x11')](queryQueues));_0x5174d0[_0xd48b('0x2f')](db[_0xd48b('0x30')][_0xd48b('0x11')](queryQueues));_0x5174d0[_0xd48b('0x2f')](db['FaxQueue'][_0xd48b('0x11')](queryQueues));_0x5174d0[_0xd48b('0x2f')](db[_0xd48b('0x31')][_0xd48b('0x11')](queryQueues));_0x5174d0[_0xd48b('0x2f')](db['MailQueue'][_0xd48b('0x11')](queryQueues));_0x5174d0[_0xd48b('0x2f')](db['OpenchannelQueue']['findAll'](queryQueues));_0x5174d0[_0xd48b('0x2f')](db['WhatsappQueue'][_0xd48b('0x11')](queryQueues));_0x5174d0[_0xd48b('0x2f')](db['User'][_0xd48b('0x11')](queryTelephones));_0x5174d0[_0xd48b('0x2f')](db[_0xd48b('0x32')][_0xd48b('0x11')](queryTrunks));_0x5174d0['push'](db['Campaign'][_0xd48b('0x11')](queryCampaigns));_0x5174d0[_0xd48b('0x2f')](db[_0xd48b('0x33')][_0xd48b('0x11')](queryAgents));break;case _0xd48b('0x34'):_0x5d8874[_0x20db91](_0xd48b('0x2b'));_0x5d8874[_0x20db91]('voice:outbound');_0x5174d0[_0xd48b('0x2f')](getAssociatedResources(_0xd48b('0xd'),_0x72b78b[_0xd48b('0x1e')],'VoiceQueue'));_0x5174d0[_0xd48b('0x2f')](getAssociatedResources(_0xd48b('0x35'),_0x72b78b[_0xd48b('0x1e')],_0xd48b('0x30')));_0x5174d0[_0xd48b('0x2f')](getAssociatedResources(_0xd48b('0xe'),_0x72b78b[_0xd48b('0x1e')],_0xd48b('0x36')));_0x5174d0[_0xd48b('0x2f')](getAssociatedResources(_0xd48b('0xf'),_0x72b78b['userProfileId'],_0xd48b('0x31')));_0x5174d0[_0xd48b('0x2f')](getAssociatedResources('MailQueues',_0x72b78b[_0xd48b('0x1e')],_0xd48b('0x37')));_0x5174d0['push'](getAssociatedResources(_0xd48b('0x10'),_0x72b78b['userProfileId'],_0xd48b('0x38')));_0x5174d0['push'](getAssociatedResources('WhatsappQueues',_0x72b78b['userProfileId'],'WhatsappQueue'));_0x5174d0[_0xd48b('0x2f')](getAssociatedResources(_0xd48b('0x12'),_0x72b78b[_0xd48b('0x1e')],_0xd48b('0x33')));_0x5174d0['push'](getAssociatedResources('Trunks',_0x72b78b['userProfileId'],'Trunk'));_0x5174d0[_0xd48b('0x2f')](getAssociatedResources('IvrCampaigns',_0x72b78b[_0xd48b('0x1e')],_0xd48b('0x18')));_0x5174d0[_0xd48b('0x2f')](db[_0xd48b('0x33')]['findAll'](queryAgents));break;case _0xd48b('0x7'):_0x5d8874[_0x20db91](_0xd48b('0x2b'));_0x5d8874[_0x20db91]('voice:outbound');_0x5174d0[_0xd48b('0x2f')](_0x72b78b[_0xd48b('0x39')]({'attributes':['id',_0xd48b('0x4')]}));_0x5174d0[_0xd48b('0x2f')](_0x72b78b[_0xd48b('0x3a')]({'attributes':['id',_0xd48b('0x4')]}));_0x5174d0[_0xd48b('0x2f')](_0x72b78b[_0xd48b('0x3b')]({'attributes':['id',_0xd48b('0x4')]}));_0x5174d0[_0xd48b('0x2f')](_0x72b78b[_0xd48b('0x3c')]({'attributes':['id',_0xd48b('0x4')]}));_0x5174d0['push'](_0x72b78b[_0xd48b('0x3d')]({'attributes':['id',_0xd48b('0x4')]}));_0x5174d0['push'](_0x72b78b['getOpenchannelQueues']({'attributes':['id',_0xd48b('0x4')]}));_0x5174d0[_0xd48b('0x2f')](_0x72b78b[_0xd48b('0x3e')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x5174d0);}})[_0xd48b('0xb')](function(_0x38663b){if(_0x38663b&&_0x38663b[_0xd48b('0x1a')]){for(var _0x26dc76=0x0;_0x26dc76<_0x38663b[_0xd48b('0x1a')];_0x26dc76+=0x1){for(var _0x3c4f6d=0x0;_0x3c4f6d<_0x38663b[_0x26dc76]['length'];_0x3c4f6d+=0x1){switch(_0x26dc76){case 0x0:joinOrLeaveQueues(_0x5d8874,_0x20db91,_0xd48b('0x3f'),_0x38663b[_0x26dc76][_0x3c4f6d]);break;case 0x1:joinOrLeaveQueues(_0x5d8874,_0x20db91,'chat',_0x38663b[_0x26dc76][_0x3c4f6d]);break;case 0x2:joinOrLeaveQueues(_0x5d8874,_0x20db91,_0xd48b('0x40'),_0x38663b[_0x26dc76][_0x3c4f6d]);break;case 0x3:joinOrLeaveQueues(_0x5d8874,_0x20db91,_0xd48b('0x41'),_0x38663b[_0x26dc76][_0x3c4f6d]);break;case 0x4:joinOrLeaveQueues(_0x5d8874,_0x20db91,'mail',_0x38663b[_0x26dc76][_0x3c4f6d]);break;case 0x5:joinOrLeaveQueues(_0x5d8874,_0x20db91,_0xd48b('0x42'),_0x38663b[_0x26dc76][_0x3c4f6d]);break;case 0x6:joinOrLeaveQueues(_0x5d8874,_0x20db91,_0xd48b('0x43'),_0x38663b[_0x26dc76][_0x3c4f6d]);break;case 0x7:_0x5d8874[_0x20db91](util[_0xd48b('0x1b')](_0xd48b('0x44'),_0x38663b[_0x26dc76][_0x3c4f6d][_0xd48b('0x4')]));break;case 0x8:_0x5d8874[_0x20db91](util[_0xd48b('0x1b')](_0xd48b('0x45'),_0x38663b[_0x26dc76][_0x3c4f6d][_0xd48b('0x4')]));break;case 0x9:_0x5d8874[_0x20db91](util[_0xd48b('0x1b')]('campaign:%s:%s',_0x38663b[_0x26dc76][_0x3c4f6d][_0xd48b('0x9')],_0x38663b[_0x26dc76][_0x3c4f6d][_0xd48b('0x4')]));break;case 0xa:_0x5d8874[_0x20db91](util[_0xd48b('0x1b')](_0xd48b('0x1c'),_0x38663b[_0x26dc76][_0x3c4f6d][_0xd48b('0x4')]));break;}}}}})['then'](function(){if(_0x20db91===_0xd48b('0x46')){var _0x386d2d=_[_0xd48b('0x16')](_0x87776[_0xd48b('0x21')],'id');return _0x87776[_0xd48b('0x47')](_0x386d2d)[_0xd48b('0xb')](function(){for(var _0xb07912=0x0;_0xb07912<_0x386d2d['length'];_0xb07912+=0x1){_0x4451db[_0xd48b('0x48')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x386d2d[_0xb07912]),'UserId':Number(_0x87776['id'])});}});}})[_0xd48b('0xb')](function(){if(_0x20db91===_0xd48b('0x46')){var _0x494d23=_[_0xd48b('0x16')](_0x87776[_0xd48b('0x23')],'id');return _0x87776[_0xd48b('0x49')](_0x494d23)['then'](function(){for(var _0x565c56=0x0;_0x565c56<_0x494d23[_0xd48b('0x1a')];_0x565c56+=0x1){_0x4451db[_0xd48b('0x48')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x494d23[_0x565c56]),'UserId':Number(_0x87776['id'])});}});}})[_0xd48b('0xb')](function(){if(_0x20db91==='leave'){var _0x3dcab3=_[_0xd48b('0x16')](_0x87776[_0xd48b('0x4a')],'id');return _0x87776['removeFaxInteractions'](_0x3dcab3)[_0xd48b('0xb')](function(){for(var _0x2a4f79=0x0;_0x2a4f79<_0x3dcab3[_0xd48b('0x1a')];_0x2a4f79+=0x1){_0x4451db['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3dcab3[_0x2a4f79]),'UserId':Number(_0x87776['id'])});}});}})[_0xd48b('0xb')](function(){if(_0x20db91==='leave'){var _0x3c218c=_['map'](_0x87776[_0xd48b('0x4b')],'id');return _0x87776['removeSmsInteractions'](_0x3c218c)[_0xd48b('0xb')](function(){for(var _0x154f59=0x0;_0x154f59<_0x3c218c[_0xd48b('0x1a')];_0x154f59+=0x1){_0x4451db[_0xd48b('0x48')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3c218c[_0x154f59]),'UserId':Number(_0x87776['id'])});}});}})['then'](function(){if(_0x20db91==='leave'){var _0x247650=_[_0xd48b('0x16')](_0x87776[_0xd48b('0x27')],'id');return _0x87776[_0xd48b('0x4c')](_0x247650)[_0xd48b('0xb')](function(){for(var _0xf67ffe=0x0;_0xf67ffe<_0x247650[_0xd48b('0x1a')];_0xf67ffe+=0x1){_0x4451db[_0xd48b('0x48')](_0xd48b('0x4d'),{'OpenchannelInteractionId':Number(_0x247650[_0xf67ffe]),'UserId':Number(_0x87776['id'])});}});}})[_0xd48b('0xb')](function(){if(_0x20db91===_0xd48b('0x46')){var _0x192cce=_['map'](_0x87776['WhatsappInteractions'],'id');return _0x87776[_0xd48b('0x4e')](_0x192cce)[_0xd48b('0xb')](function(){for(var _0x5b6431=0x0;_0x5b6431<_0x192cce[_0xd48b('0x1a')];_0x5b6431+=0x1){_0x4451db[_0xd48b('0x48')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x192cce[_0x5b6431]),'UserId':Number(_0x87776['id'])});}});}})[_0xd48b('0x4f')](function(_0x2a230e){_0x5d8874[_0xd48b('0x50')](_0x2a230e);});}}function onDisconnect(_0x1c3a4e,_0x11a568){joinOrLeave(_0x1c3a4e,'leave',_0x11a568);}function onConnect(_0x442fec){joinOrLeave(_0x442fec,'join');}exports[_0xd48b('0x51')]=function(_0x3297d9){_0x3297d9['on'](_0xd48b('0x52'),function(_0x488dc6){_0x488dc6[_0xd48b('0x53')](0x0);_0x488dc6[_0xd48b('0x54')]=_0x488dc6[_0xd48b('0x55')][_0xd48b('0x52')][_0xd48b('0x56')]+':'+_0x488dc6[_0xd48b('0x55')][_0xd48b('0x52')][_0xd48b('0x57')];_0x488dc6[_0xd48b('0x58')]=new Date();_0x488dc6['log']=function(_0x5dce1d){console[_0xd48b('0x50')](_0xd48b('0x59')+_0x488dc6['nsp'][_0xd48b('0x4')]+'['+_0x488dc6[_0xd48b('0x54')]+']',_0x5dce1d);};_0x488dc6['on'](_0xd48b('0x5a'),function(){onDisconnect(_0x488dc6,_0x3297d9);_0x488dc6[_0xd48b('0x50')](_0xd48b('0x5b'));});onConnect(_0x488dc6);_0x488dc6[_0xd48b('0x50')](_0xd48b('0x5c'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index feb0fa6..37bb735 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 _0x3998=['MailMessage','Openchannel','OpenchannelInteraction','request','then','info','error','Trigger,\x20%s','EventManager','catch','get','channel','direction','UserId','User','find','name','interface','SIP/%s','incomingmessage','outgoingmessage','changed','closed','event','format','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','jayson/promise','triggers','client','http','Chat','newinteraction','ChatInteraction','closedinteraction','ChatMessage','afterCreate','newmessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','afterUpdate','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x3998,0x139));var _0x8399=function(_0x3b5824,_0x3415ab){_0x3b5824=_0x3b5824-0x0;var _0x3c3c6f=_0x3998[_0x3b5824];return _0x3c3c6f;};'use strict';var util=require(_0x8399('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8399('0x1'));var logger=require('../logger')(_0x8399('0x2'));var client=jayson[_0x8399('0x3')][_0x8399('0x4')]({'port':0x232a});var triggers=[{'channel':_0x8399('0x5'),'model':'ChatInteraction','event':'afterCreate','condition':_0x8399('0x6'),'callback':afterCreate},{'channel':_0x8399('0x5'),'model':_0x8399('0x7'),'event':'afterUpdate','condition':_0x8399('0x8'),'callback':afterUpdate},{'channel':_0x8399('0x5'),'model':_0x8399('0x9'),'event':_0x8399('0xa'),'condition':_0x8399('0xb'),'callback':afterCreateMessage},{'channel':'Sms','model':_0x8399('0xc'),'event':_0x8399('0xa'),'condition':_0x8399('0x6'),'callback':afterCreate},{'channel':_0x8399('0xd'),'model':_0x8399('0xc'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x8399('0xd'),'model':_0x8399('0xe'),'event':_0x8399('0xa'),'condition':_0x8399('0xb'),'callback':afterCreateMessage},{'channel':_0x8399('0xf'),'model':'WhatsappInteraction','event':_0x8399('0xa'),'condition':_0x8399('0x6'),'callback':afterCreate},{'channel':_0x8399('0xf'),'model':_0x8399('0x10'),'event':_0x8399('0x11'),'condition':_0x8399('0x8'),'callback':afterUpdate},{'channel':_0x8399('0xf'),'model':_0x8399('0x12'),'event':_0x8399('0xa'),'condition':_0x8399('0xb'),'callback':afterCreateMessage},{'channel':_0x8399('0x13'),'model':_0x8399('0x14'),'event':'afterCreate','condition':_0x8399('0x6'),'callback':afterCreate},{'channel':_0x8399('0x13'),'model':_0x8399('0x14'),'event':_0x8399('0x11'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x8399('0x13'),'model':'FaxMessage','event':_0x8399('0xa'),'condition':_0x8399('0xb'),'callback':afterCreateMessage},{'channel':_0x8399('0x15'),'model':'MailInteraction','event':_0x8399('0xa'),'condition':_0x8399('0x6'),'callback':afterCreate},{'channel':_0x8399('0x15'),'model':_0x8399('0x16'),'event':_0x8399('0x11'),'condition':_0x8399('0x8'),'callback':afterUpdate},{'channel':_0x8399('0x15'),'model':_0x8399('0x17'),'event':_0x8399('0xa'),'condition':_0x8399('0xb'),'callback':afterCreateMessage},{'channel':_0x8399('0x18'),'model':_0x8399('0x19'),'event':_0x8399('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8399('0x18'),'model':'OpenchannelInteraction','event':_0x8399('0x11'),'condition':_0x8399('0x8'),'callback':afterUpdate},{'channel':_0x8399('0x18'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0x8399('0xb'),'callback':afterCreateMessage}];function request(_0x43d464){return client[_0x8399('0x1a')]('EventManager',_0x43d464)[_0x8399('0x1b')](function(_0x3d5209){logger[_0x8399('0x1c')]('Trigger,\x20%s','EventManager',_0x3d5209);if(_0x3d5209[_0x8399('0x1d')]){if(_0x3d5209[_0x8399('0x1d')]['code']===0x1f4){logger[_0x8399('0x1d')](_0x8399('0x1e'),_0x8399('0x1f'),_0x3d5209[_0x8399('0x1d')]);}}})[_0x8399('0x20')](function(_0x4bd5a7){logger[_0x8399('0x1d')](_0x8399('0x1e'),_0x8399('0x1f'),_0x4bd5a7);});}function afterCreateMessage(_0x5d24ed,_0x33fe9f){return function(_0x320db4,_0x343d5b){_0x320db4=_0x320db4[_0x8399('0x21')]({'plain':!![]});_0x320db4[_0x8399('0x22')]=_0x5d24ed;_0x320db4['event']=_0x320db4[_0x8399('0x23')];if(_0x320db4[_0x8399('0x24')]){return db[_0x8399('0x25')][_0x8399('0x26')]({'where':{'id':_0x320db4[_0x8399('0x24')]},'attributes':['id',_0x8399('0x27')],'raw':!![]})[_0x8399('0x1b')](function(_0x379ac2){_0x320db4[_0x8399('0x28')]=util['format'](_0x8399('0x29'),_0x379ac2[_0x8399('0x27')]);_0x320db4[_0x8399('0x22')]=_0x5d24ed;return request({'event':_0x8399('0x2a'),'message':_0x320db4});})[_0x8399('0x20')](function(_0x533580){console[_0x8399('0x1d')](_0x533580);});}else{return request({'event':_0x8399('0x2b'),'message':_0x320db4});}};}function afterCreate(_0x4e9d8a,_0x15ae9f){return function(_0x1f96c1,_0x1d4054){_0x1f96c1=_0x1f96c1[_0x8399('0x21')]({'plain':!![]});_0x1f96c1['channel']=_0x4e9d8a;_0x1f96c1['event']='opened';return request({'event':_0x15ae9f,'message':_0x1f96c1});};}function afterUpdate(_0x3a0629,_0x448915){return function(_0x3111ad,_0x19bfe9){if(_0x3111ad[_0x8399('0x2c')](_0x8399('0x2d'))&&_0x3111ad['closed']){_0x3111ad=_0x3111ad['get']({'plain':!![]});_0x3111ad[_0x8399('0x22')]=_0x3a0629;_0x3111ad[_0x8399('0x2e')]=_0x8399('0x2d');if(_0x3111ad[_0x8399('0x24')]){return db[_0x8399('0x25')][_0x8399('0x26')]({'where':{'id':_0x3111ad[_0x8399('0x24')]},'attributes':['id',_0x8399('0x27')],'raw':!![]})[_0x8399('0x1b')](function(_0x1e0a9b){_0x3111ad['interface']=util[_0x8399('0x2f')](_0x8399('0x29'),_0x1e0a9b['name']);return request({'event':_0x448915,'message':_0x3111ad});})[_0x8399('0x20')](function(_0x13c0f4){console[_0x8399('0x1d')](_0x13c0f4);});}else{return request({'event':_0x448915,'message':_0x3111ad});}}};}exports[_0x8399('0x30')]=function(){for(var _0x65963=0x0;_0x65963=_0x4c990d[_0x51d5('0x14')]){throw Error(_0x51d5('0x15'));}_0x3ccd7c(_0x3fb8b8);})[_0x51d5('0x16')](function(_0x54b72e){_0x53cd53(_0x54b72e);});});}; \ No newline at end of file +var _0x144a=['count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','blockedAt','updateAttributes','getLicense','role','agent'];(function(_0x1c8087,_0x2300c1){var _0x27c725=function(_0x4ed72c){while(--_0x4ed72c){_0x1c8087['push'](_0x1c8087['shift']());}};_0x27c725(++_0x2300c1);}(_0x144a,0xf5));var _0xa144=function(_0x10da0b,_0x435cd5){_0x10da0b=_0x10da0b-0x0;var _0x428c98=_0x144a[_0x10da0b];return _0x428c98;};'use strict';var _=require(_0xa144('0x0'));var BPromise=require(_0xa144('0x1'));var db=require(_0xa144('0x2'))['db'];var util=require(_0xa144('0x3'));var channels=[_0xa144('0x4'),_0xa144('0x5'),'chat',_0xa144('0x6'),_0xa144('0x7'),_0xa144('0x8'),_0xa144('0x9')];exports[_0xa144('0xa')]=function(){return channels;};exports[_0xa144('0xb')]=function(_0x51700e){_0x51700e=_0x51700e[_0xa144('0xc')]();return _[_0xa144('0xd')](channels,_0x51700e);};exports['clearBlockUser']=function(_0x1c2202,_0x94d776,_0x4520c9,_0x5366fa){var _0x110b54={'loginAttempts':_0x94d776,'blocked':_0x4520c9};if(!_['isUndefined'](_0x5366fa)){_0x110b54[_0xa144('0xe')]=_0x5366fa;}return _0x1c2202[_0xa144('0xf')](_0x110b54);};exports[_0xa144('0x10')]=function(_0x13abf1){return new BPromise(function(_0x20fd75,_0x3e7126){var _0xfb1cef=0x0;if(_0x13abf1[_0xa144('0x11')]!==_0xa144('0x12')){_0x20fd75(_0x13abf1);}db['User'][_0xa144('0x13')]({'where':{'role':_0xa144('0x12'),'online':!![],'id':{'$ne':_0x13abf1['id']}}})[_0xa144('0x14')](function(_0xe119e9){_0xfb1cef=_0xe119e9;return util[_0xa144('0x10')]();})[_0xa144('0x14')](function(_0x52baf1){if(_0x52baf1&&_0x52baf1[_0xa144('0x15')]&&_0xfb1cef>=_0x52baf1[_0xa144('0x15')]){throw Error(_0xa144('0x16'));}_0x20fd75(_0x13abf1);})[_0xa144('0x17')](function(_0x5d300f){_0x3e7126(_0x5d300f);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 8634041..ad9df7f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc27f=['status','json','send','exports','404'];(function(_0x2d95aa,_0x221a87){var _0x11611c=function(_0x47d917){while(--_0x47d917){_0x2d95aa['push'](_0x2d95aa['shift']());}};_0x11611c(++_0x221a87);}(_0xc27f,0xe9));var _0xfc27=function(_0x29d1f0,_0x2f8428){_0x29d1f0=_0x29d1f0-0x0;var _0x3c439e=_0xc27f[_0x29d1f0];return _0x3c439e;};'use strict';module[_0xfc27('0x0')][0x194]=function pageNotFound(_0xc34d56,_0xf34805){var _0x3c75e6=_0xfc27('0x1');var _0x2ee104=0x194;var _0x5f3005={'status':_0x2ee104};_0xf34805[_0xfc27('0x2')](_0x5f3005['status']);_0xf34805['render'](_0x3c75e6,{},function(_0x308de0,_0x12b3ab){if(_0x308de0){return _0xf34805[_0xfc27('0x2')](_0x5f3005['status'])[_0xfc27('0x3')](_0x5f3005);}_0xf34805[_0xfc27('0x4')](_0x12b3ab);});}; \ No newline at end of file +var _0x9178=['exports','render','status','json'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9178,0xe0));var _0x8917=function(_0x13aefe,_0x35e364){_0x13aefe=_0x13aefe-0x0;var _0x108c9f=_0x9178[_0x13aefe];return _0x108c9f;};'use strict';module[_0x8917('0x0')][0x194]=function pageNotFound(_0x148518,_0x40c7ed){var _0x1332b8='404';var _0x22b67a=0x194;var _0x4a50c1={'status':_0x22b67a};_0x40c7ed['status'](_0x4a50c1['status']);_0x40c7ed[_0x8917('0x1')](_0x1332b8,{},function(_0xef914,_0x532d09){if(_0xef914){return _0x40c7ed[_0x8917('0x2')](_0x4a50c1['status'])[_0x8917('0x3')](_0x4a50c1);}_0x40c7ed['send'](_0x532d09);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 87db36e..b5b731d 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa751=['../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','hasMany','UserId','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsToMany','ChatGroup','Groups','chat_group_has_users','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','OpenchannelInteraction','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','UserChatQueue','SmsQueues','WhatsappQueues','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperHistory','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackup','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceCallReport','VoiceAgentReport','AgentReports','ContactId','MailAccountId','Imap','MailServerOut','Smtp','Disposition','CannedAnswer','List','ListId','TemplateId','Agents','user_has_mail_accounts','UserMailQueue','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Interaction','restrict','TagId','MailQueueReport','Dashboard','DashboardItem','Items','FaxAccountId','FaxApplication','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','Dispositions','SmsAccountId','Answers','Interactions','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','OpenchannelQueueReport','Agent','Queue','ChatQueueId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Website','Contacts','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','VoiceMusicOnHold','Mohs','openchannel_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticDefaultReport','AnalyticMetric','MetricId','Configurations','Subjects','SubjectId','Descriptions','AccountId','DescriptionId','Field','FieldId','VariableId','SugarcrmAccount','Subject','Description','DeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','Dynamics365Account','FreshsalesConfiguration','FromId','SessionId','SmsQueueReport','ProjectId','team_has_voice_queues','FaxQueues','OpenchannelQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','CustomFields','HopperHistory','voice_queues_has_cm_lists','userProfileId','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','path','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','xcall','username','password','sequelizeHistory','database','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/disposition/disposition.model','Condition'];(function(_0x129f2f,_0x15dc9c){var _0x3132ac=function(_0x3e6b2f){while(--_0x3e6b2f){_0x129f2f['push'](_0x129f2f['shift']());}};_0x3132ac(++_0x15dc9c);}(_0xa751,0x175));var _0x1a75=function(_0x5829a1,_0x31ebdd){_0x5829a1=_0x5829a1-0x0;var _0x58bf54=_0xa751[_0x5829a1];return _0x58bf54;};'use strict';var path=require(_0x1a75('0x0'));var config=require(_0x1a75('0x1'));var Sequelize=require(_0x1a75('0x2'));var _=require(_0x1a75('0x3'));var jstz=require('jstz');var timezone=jstz[_0x1a75('0x4')]();config['sequelize']=_[_0x1a75('0x5')](config[_0x1a75('0x2')],{'database':_0x1a75('0x6'),'username':'xcall','password':_0x1a75('0x7'),'options':{'host':_0x1a75('0x8'),'port':0xcea,'dialect':_0x1a75('0x9'),'dialectOptions':{'charset':_0x1a75('0xa')},'logging':![],'timezone':timezone[_0x1a75('0xb')](),'define':{'charset':_0x1a75('0xc'),'collate':_0x1a75('0xd')}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x1a75('0x6'),'username':_0x1a75('0xe'),'password':_0x1a75('0x7'),'options':{'host':_0x1a75('0x8'),'port':0xcea,'dialect':_0x1a75('0x9'),'dialectOptions':{'charset':_0x1a75('0xa')},'logging':![],'timezone':timezone[_0x1a75('0xb')](),'define':{'charset':_0x1a75('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x1a75('0x2')][_0x1a75('0xf')],config[_0x1a75('0x2')][_0x1a75('0x10')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a75('0x11')][_0x1a75('0x12')],config['sequelizeHistory'][_0x1a75('0xf')],config[_0x1a75('0x11')]['password'],config[_0x1a75('0x11')][_0x1a75('0x13')])};db[_0x1a75('0x14')]=db['sequelize']['import']('../api/user/user.model');db[_0x1a75('0x15')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x17'));db[_0x1a75('0x18')]=db[_0x1a75('0x2')]['import'](_0x1a75('0x19'));db['VoiceExtension']=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x1a'));db['VoiceMusicOnHold']=db[_0x1a75('0x2')]['import'](_0x1a75('0x1b'));db[_0x1a75('0x1c')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x1d'));db[_0x1a75('0x1e')]=db['sequelize'][_0x1a75('0x16')]('../api/voiceRecording/voiceRecording.model');db[_0x1a75('0x1f')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/screenRecording/screenRecording.model');db[_0x1a75('0x20')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x21'));db[_0x1a75('0x22')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x23'));db['VoiceCallReport']=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/voiceCallReport/voiceCallReport.model');db[_0x1a75('0x24')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x25'));db['VoiceAgentReport']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x26'));db[_0x1a75('0x27')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x28'));db[_0x1a75('0x29')]=db['sequelize']['import'](_0x1a75('0x2a'));db[_0x1a75('0x2b')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x2c'));db[_0x1a75('0x2d')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x2e'));db[_0x1a75('0x2f')]=db[_0x1a75('0x2')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x1a75('0x2')]['import'](_0x1a75('0x30'));db[_0x1a75('0x31')]=db[_0x1a75('0x2')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x1a75('0x32')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x33'));db[_0x1a75('0x34')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x35'));db[_0x1a75('0x36')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x37'));db[_0x1a75('0x38')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x39'));db['MailServerOut']=db[_0x1a75('0x2')]['import']('../api/mailServerOut/mailServerOut.model');db[_0x1a75('0x3a')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x3b'));db[_0x1a75('0x3c')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x3d'));db[_0x1a75('0x3e')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/mailSubstatus/mailSubstatus.model');db[_0x1a75('0x3f')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x40'));db[_0x1a75('0x41')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x42'));db[_0x1a75('0x43')]=db['sequelize']['import'](_0x1a75('0x44'));db['MailQueueReport']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x45'));db['Dashboard']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x46'));db['DashboardItem']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x47'));db[_0x1a75('0x48')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x49'));db['FaxApplication']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x4a'));db[_0x1a75('0x4b')]=db[_0x1a75('0x2')]['import'](_0x1a75('0x4c'));db[_0x1a75('0x4d')]=db['sequelize'][_0x1a75('0x16')]('../api/faxMessage/faxMessage.model');db[_0x1a75('0x4e')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x4f'));db[_0x1a75('0x50')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x51'));db[_0x1a75('0x52')]=db['sequelize'][_0x1a75('0x16')]('../api/smsAccount/smsAccount.model');db[_0x1a75('0x53')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x54'));db[_0x1a75('0x55')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x56'));db['SmsMessage']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x57'));db[_0x1a75('0x58')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x59'));db[_0x1a75('0x5a')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x5b'));db[_0x1a75('0x5c')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x5d'));db['OpenchannelInteraction']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x5e'));db[_0x1a75('0x5f')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x60'));db[_0x1a75('0x61')]=db['sequelize'][_0x1a75('0x16')]('../api/openchannelQueue/openchannelQueue.model');db[_0x1a75('0x62')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x63'));db[_0x1a75('0x64')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/chatApplication/chatApplication.model');db[_0x1a75('0x65')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x66'));db[_0x1a75('0x67')]=db[_0x1a75('0x2')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x68'));db['ChatQueue']=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x69'));db['ChatGroup']=db[_0x1a75('0x2')]['import']('../api/chatGroup/chatGroup.model');db[_0x1a75('0x6a')]=db[_0x1a75('0x2')]['import'](_0x1a75('0x6b'));db[_0x1a75('0x6c')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x6d'));db[_0x1a75('0x6e')]=db['sequelize'][_0x1a75('0x16')]('../api/cmContact/cmContact.model');db[_0x1a75('0x6f')]=db[_0x1a75('0x2')]['import'](_0x1a75('0x70'));db[_0x1a75('0x71')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x1a75('0x72')]=db[_0x1a75('0x2')]['import'](_0x1a75('0x73'));db['CmHopperHistory']=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x1a75('0x74')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x75'));db[_0x1a75('0x76')]=db[_0x1a75('0x2')]['import'](_0x1a75('0x77'));db[_0x1a75('0x78')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x79'));db[_0x1a75('0x7a')]=db[_0x1a75('0x2')]['import'](_0x1a75('0x7b'));db['CannedAnswer']=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x7c'));db[_0x1a75('0x7d')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x7e'));db[_0x1a75('0x7f')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x80'));db['Pause']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x81'));db[_0x1a75('0x82')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x83'));db[_0x1a75('0x84')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x85'));db['Schedule']=db['sequelize']['import']('../api/schedule/schedule.model');db[_0x1a75('0x86')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x87'));db[_0x1a75('0x88')]=db[_0x1a75('0x2')]['import'](_0x1a75('0x89'));db[_0x1a75('0x8a')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/template/template.model');db[_0x1a75('0x8b')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x8c'));db[_0x1a75('0x8d')]=db[_0x1a75('0x2')]['import'](_0x1a75('0x8e'));db[_0x1a75('0x8f')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x90'));db['IntegrationReport']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x91'));db[_0x1a75('0x92')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x93'));db['AnalyticDefaultReport']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x94'));db[_0x1a75('0x95')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db['sequelize'][_0x1a75('0x16')]('../api/analyticMetric/analyticMetric.model');db[_0x1a75('0x96')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x97'));db[_0x1a75('0x98')]=db[_0x1a75('0x2')]['import'](_0x1a75('0x99'));db[_0x1a75('0x9a')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x9b'));db[_0x1a75('0x9c')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x9d'));db[_0x1a75('0x9e')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x9f'));db['SugarcrmAccount']=db[_0x1a75('0x2')]['import'](_0x1a75('0xa0'));db[_0x1a75('0xa1')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xa2'));db[_0x1a75('0xa3')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xa4'));db[_0x1a75('0xa5')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0xa6'));db['DeskConfiguration']=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x1a75('0xa7')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/intDeskField/intDeskField.model');db[_0x1a75('0xa8')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xa9'));db[_0x1a75('0xaa')]=db[_0x1a75('0x2')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x1a75('0xab')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xac'));db[_0x1a75('0xad')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xae'));db[_0x1a75('0xaf')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xb0'));db[_0x1a75('0xb1')]=db[_0x1a75('0x2')]['import'](_0x1a75('0xb2'));db[_0x1a75('0xb3')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xb4'));db['FreshdeskConfiguration']=db['sequelize']['import'](_0x1a75('0xb5'));db['FreshdeskField']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xb6'));db['VtigerAccount']=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x1a75('0xb7')]=db['sequelize'][_0x1a75('0x16')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xb8'));db[_0x1a75('0xb9')]=db[_0x1a75('0x2')]['import'](_0x1a75('0xba'));db[_0x1a75('0xbb')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xbc'));db[_0x1a75('0xbd')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xbe'));db['Dynamics365Account']=db['sequelize']['import'](_0x1a75('0xbf'));db[_0x1a75('0xc0')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x1a75('0xc1')]=db[_0x1a75('0x2')]['import'](_0x1a75('0xc2'));db[_0x1a75('0xc3')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xc4'));db['FreshsalesConfiguration']=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x1a75('0xc5')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xc6'));db[_0x1a75('0x8f')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x90'));db[_0x1a75('0xc7')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0xc8'));db[_0x1a75('0xc9')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xca'));db['ChatInternalMessage']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xcb'));db[_0x1a75('0xcc')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0xcd'));db[_0x1a75('0xce')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xcf'));db[_0x1a75('0xd0')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xd1'));db[_0x1a75('0xd2')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0xd3'));db[_0x1a75('0xd4')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xd5'));db[_0x1a75('0xd6')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xd7'));db[_0x1a75('0xd8')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xd9'));db[_0x1a75('0xda')]=db['sequelize']['import'](_0x1a75('0xdb'));db[_0x1a75('0xdc')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0xdd'));db['SquareRecording']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xde'));db['SquareMessage']=db[_0x1a75('0x2')]['import'](_0x1a75('0xdf'));db[_0x1a75('0xe0')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xe1'));db[_0x1a75('0xe2')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xe3'));db[_0x1a75('0xe4')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xe5'));db[_0x1a75('0xe6')]=db[_0x1a75('0x2')]['import'](_0x1a75('0xe7'));db[_0x1a75('0xe8')]=db[_0x1a75('0x2')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xe9'));db[_0x1a75('0xea')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xeb'));db[_0x1a75('0xec')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db['sequelize'][_0x1a75('0x16')](_0x1a75('0xed'));db['CmList']=db['sequelize'][_0x1a75('0x16')](_0x1a75('0xee'));db[_0x1a75('0xef')]=db['sequelize'][_0x1a75('0x16')]('../api/voicePrefix/voicePrefix.model');db[_0x1a75('0xf0')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xf1'));db['UserProfileSection']=db['sequelize'][_0x1a75('0x16')](_0x1a75('0xf2'));db[_0x1a75('0xf3')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0xf4'));db[_0x1a75('0xf5')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xf6'));db[_0x1a75('0xf7')]=db['sequelize']['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x1a75('0xf8')]=db[_0x1a75('0x2')]['import'](_0x1a75('0xf9'));db[_0x1a75('0xfa')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x1a75('0xfb')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0xfc'));db['WhatsappQueueReport']=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0xfd'));db[_0x1a75('0xfe')]=db[_0x1a75('0x2')][_0x1a75('0x16')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x1a75('0xff')]=db['sequelize'][_0x1a75('0x16')](_0x1a75('0x100'));db[_0x1a75('0x101')]=db[_0x1a75('0x2')][_0x1a75('0x16')](_0x1a75('0x102'));db[_0x1a75('0x14')][_0x1a75('0x103')](db['VoiceMail'],{'as':_0x1a75('0x20'),'onDelete':_0x1a75('0x104'),'foreignKey':'UserId'});db[_0x1a75('0x14')][_0x1a75('0x105')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x1a75('0x106')});db[_0x1a75('0x14')][_0x1a75('0x105')](db[_0x1a75('0x107')],{'as':_0x1a75('0x108'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x14')]['hasMany'](db[_0x1a75('0x109')],{'as':_0x1a75('0x10a'),'onDelete':'cascade','hooks':!![]});db[_0x1a75('0x14')]['hasMany'](db['CmHopperFinal'],{'as':_0x1a75('0x10b'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x14')][_0x1a75('0x105')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x1a75('0x106')});db[_0x1a75('0x14')][_0x1a75('0x105')](db[_0x1a75('0x74')],{'as':_0x1a75('0x74'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x14')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x1a75('0x10c'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x14')][_0x1a75('0x105')](db[_0x1a75('0x65')],{'as':_0x1a75('0x10d'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x14')][_0x1a75('0x105')](db[_0x1a75('0x55')],{'as':_0x1a75('0x10e'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x14')]['hasMany'](db['FaxInteraction'],{'as':_0x1a75('0x10f'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x14')][_0x1a75('0x105')](db[_0x1a75('0x3f')],{'as':_0x1a75('0x110'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x14')]['hasMany'](db[_0x1a75('0xfa')],{'as':_0x1a75('0x111'),'foreignKey':_0x1a75('0x106')});db['User'][_0x1a75('0x105')](db[_0x1a75('0xf5')],{'as':_0x1a75('0x112'),'foreignKey':_0x1a75('0x113')});db['User']['belongsTo'](db['UserProfile'],{'as':_0x1a75('0xf0'),'foreignKey':'userProfileId'});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x115')],{'as':_0x1a75('0x116'),'through':_0x1a75('0x117')});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x6e')],{'as':'Contacts','through':_0x1a75('0x118')});db[_0x1a75('0x14')]['belongsToMany'](db[_0x1a75('0x119')],{'as':_0x1a75('0x11a'),'through':_0x1a75('0x11b')});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0xe0')],{'through':_0x1a75('0x11c')});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x3f')],{'as':_0x1a75('0x110'),'through':_0x1a75('0x11d')});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x65')],{'as':_0x1a75('0x10d'),'through':_0x1a75('0x11e')});db['User'][_0x1a75('0x114')](db['FaxInteraction'],{'as':_0x1a75('0x10f'),'through':'user_has_fax_interactions'});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x55')],{'as':_0x1a75('0x10e'),'through':'user_has_sms_interactions'});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x11f')],{'as':_0x1a75('0x10c'),'through':_0x1a75('0x120')});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0xfa')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x1a75('0x14')][_0x1a75('0x114')](db['VoiceQueue'],{'as':_0x1a75('0x121'),'through':_0x1a75('0x2f'),'required':![]});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x3c')],{'as':_0x1a75('0x122'),'through':'UserMailQueue','required':![]});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x123')],{'as':_0x1a75('0x124'),'through':_0x1a75('0x125'),'required':![],'hooks':!![]});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x4e')],{'as':'FaxQueues','through':_0x1a75('0x31'),'required':![]});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x58')],{'as':_0x1a75('0x126'),'through':'UserSmsQueue','required':![]});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x61')],{'as':'OpenchannelQueues','through':_0x1a75('0x34'),'required':![]});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0xff')],{'as':_0x1a75('0x127'),'through':_0x1a75('0x36'),'required':![]});db[_0x1a75('0x14')]['belongsToMany'](db['CmList'],{'through':'cm_user_has_lists'});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0xef')],{'as':'VoicePrefixes','through':_0x1a75('0x128'),'required':![]});db['User'][_0x1a75('0x114')](db[_0x1a75('0x62')],{'as':_0x1a75('0x129'),'through':_0x1a75('0x12a')});db['User'][_0x1a75('0x114')](db['FaxAccount'],{'as':_0x1a75('0x12b'),'through':'user_has_fax_accounts'});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x3a')],{'as':_0x1a75('0x12c'),'through':'user_has_mail_accounts'});db[_0x1a75('0x14')]['belongsToMany'](db[_0x1a75('0x5a')],{'as':'OpenchannelAccounts','through':_0x1a75('0x12d')});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0x52')],{'as':_0x1a75('0x12e'),'through':_0x1a75('0x12f')});db[_0x1a75('0x14')][_0x1a75('0x114')](db[_0x1a75('0xf7')],{'as':_0x1a75('0x130'),'through':_0x1a75('0x131')});db['User'][_0x1a75('0x114')](db[_0x1a75('0xdc')],{'as':_0x1a75('0x132'),'through':_0x1a75('0x133')});db['VoiceChanSpy'][_0x1a75('0x105')](db[_0x1a75('0x109')],{'as':_0x1a75('0x134'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x135')});db[_0x1a75('0x18')]['hasMany'](db['VoiceExtension'],{'onDelete':_0x1a75('0x104')});db[_0x1a75('0x109')][_0x1a75('0x105')](db[_0x1a75('0x109')],{'as':_0x1a75('0x136'),'onDelete':'cascade'});db['VoiceMusicOnHold']['belongsToMany'](db[_0x1a75('0x86')],{'as':_0x1a75('0x137'),'through':_0x1a75('0x138')});db[_0x1a75('0x1c')][_0x1a75('0x105')](db['UserVoiceQueueRt'],{'as':_0x1a75('0x139'),'foreignKey':_0x1a75('0x13a')});db['VoiceQueue']['hasMany'](db[_0x1a75('0x6f')],{'as':_0x1a75('0x13b'),'foreignKey':'VoiceQueueId'});db[_0x1a75('0x1c')][_0x1a75('0x105')](db[_0x1a75('0x72')],{'as':_0x1a75('0x10b'),'foreignKey':_0x1a75('0x13a')});db['VoiceQueue']['hasMany'](db[_0x1a75('0x13c')],{'as':_0x1a75('0x13d'),'foreignKey':'VoiceQueueId'});db[_0x1a75('0x1c')][_0x1a75('0x105')](db['ReportAgentPreview'],{'as':_0x1a75('0x74'),'foreignKey':_0x1a75('0x13a')});db[_0x1a75('0x1c')][_0x1a75('0x105')](db[_0x1a75('0x71')],{'as':_0x1a75('0x13e'),'foreignKey':'VoiceQueueId'});db[_0x1a75('0x1c')][_0x1a75('0x105')](db[_0x1a75('0xd0')],{'as':_0x1a75('0x13f'),'foreignKey':_0x1a75('0x13a')});db[_0x1a75('0x1c')][_0x1a75('0x140')](db['Trunk'],{'as':_0x1a75('0x2b'),'foreignKey':_0x1a75('0x141')});db['VoiceQueue'][_0x1a75('0x140')](db[_0x1a75('0x2b')],{'as':_0x1a75('0x142'),'foreignKey':'TrunkBackupId'});db[_0x1a75('0x1c')][_0x1a75('0x140')](db[_0x1a75('0x7f')],{'as':_0x1a75('0x7f'),'foreignKey':_0x1a75('0x143')});db[_0x1a75('0x1c')][_0x1a75('0x140')](db[_0x1a75('0x144')],{'as':_0x1a75('0x145'),'foreignKey':_0x1a75('0x146')});db[_0x1a75('0x1c')][_0x1a75('0x114')](db[_0x1a75('0x119')],{'as':_0x1a75('0x11a'),'through':'voice_queues_has_cm_lists'});db[_0x1a75('0x1c')]['belongsToMany'](db[_0x1a75('0x14')],{'as':'Agents','through':'UserVoiceQueue'});db['VoiceQueue'][_0x1a75('0x114')](db[_0x1a75('0xe0')],{'as':_0x1a75('0x147'),'through':'team_has_voice_queues'});db[_0x1a75('0x1c')]['belongsToMany'](db[_0x1a75('0x119')],{'as':_0x1a75('0x148'),'through':_0x1a75('0x149')});db[_0x1a75('0x1e')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':_0x1a75('0x14'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x1f')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':_0x1a75('0x14'),'foreignKey':_0x1a75('0x106')});db['VoiceMail'][_0x1a75('0x105')](db[_0x1a75('0x22')],{'as':_0x1a75('0x14a'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x14b'),'sourceKey':_0x1a75('0x14c')});db['VoiceMailMessage'][_0x1a75('0x140')](db[_0x1a75('0x20')],{'foreignKey':'mailboxuser','targetKey':_0x1a75('0x14c')});db['VoiceCallReport'][_0x1a75('0x105')](db['VoiceQueueReport'],{'as':_0x1a75('0x14d'),'foreignKey':_0x1a75('0x14e'),'constraints':![]});db[_0x1a75('0x14f')]['hasMany'](db[_0x1a75('0x150')],{'as':_0x1a75('0x151'),'foreignKey':_0x1a75('0x14e'),'constraints':![]});db['VoiceCallReport'][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':_0x1a75('0x14'),'foreignKey':'UserId'});db[_0x1a75('0x14f')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'as':'Contact','foreignKey':_0x1a75('0x152')});db[_0x1a75('0x38')]['belongsTo'](db[_0x1a75('0x3a')],{'as':_0x1a75('0x3a'),'foreignKey':'MailAccountId'});db['MailServerOut']['belongsTo'](db[_0x1a75('0x3a')],{'as':_0x1a75('0x3a'),'foreignKey':_0x1a75('0x153')});db['MailAccount'][_0x1a75('0x103')](db['MailServerIn'],{'as':_0x1a75('0x154'),'onDelete':_0x1a75('0x104')});db[_0x1a75('0x3a')]['hasOne'](db[_0x1a75('0x155')],{'as':_0x1a75('0x156'),'onDelete':_0x1a75('0x104')});db['MailAccount']['hasMany'](db[_0x1a75('0x157')],{'as':'Dispositions','foreignKey':'MailAccountId'});db['MailAccount'][_0x1a75('0x105')](db[_0x1a75('0x158')],{'as':'Answers','foreignKey':_0x1a75('0x153')});db['MailAccount'][_0x1a75('0x105')](db[_0x1a75('0x41')],{'as':'Messages','foreignKey':_0x1a75('0x153')});db[_0x1a75('0x3a')][_0x1a75('0x105')](db[_0x1a75('0x3f')],{'as':'Interactions'});db[_0x1a75('0x3a')]['hasMany'](db['MailApplication'],{'as':_0x1a75('0x136')});db[_0x1a75('0x3a')][_0x1a75('0x140')](db[_0x1a75('0x119')],{'as':_0x1a75('0x159'),'foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x3a')][_0x1a75('0x140')](db[_0x1a75('0x8a')],{'as':_0x1a75('0x8a'),'foreignKey':_0x1a75('0x15b')});db[_0x1a75('0x3a')][_0x1a75('0x140')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x1a75('0x146')});db[_0x1a75('0x3a')]['belongsToMany'](db[_0x1a75('0x14')],{'as':_0x1a75('0x15c'),'through':_0x1a75('0x15d')});db['MailQueue'][_0x1a75('0x114')](db['User'],{'as':_0x1a75('0x15c'),'through':_0x1a75('0x15e')});db[_0x1a75('0x3c')]['belongsToMany'](db[_0x1a75('0xe0')],{'through':_0x1a75('0x15f'),'as':_0x1a75('0x147')});db['MailInteraction'][_0x1a75('0x105')](db[_0x1a75('0x41')],{'as':'Messages','onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x160')});db[_0x1a75('0x3f')]['belongsTo'](db[_0x1a75('0x3a')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x153')});db['MailInteraction'][_0x1a75('0x140')](db['CmContact'],{'as':_0x1a75('0x162'),'foreignKey':_0x1a75('0x152')});db[_0x1a75('0x3f')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':_0x1a75('0x163'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x3f')][_0x1a75('0x114')](db[_0x1a75('0x88')],{'through':'mail_interaction_has_tags','as':_0x1a75('0x164')});db['MailInteraction'][_0x1a75('0x114')](db[_0x1a75('0x88')],{'through':_0x1a75('0x165'),'as':_0x1a75('0x166')});db[_0x1a75('0x3f')]['belongsToMany'](db[_0x1a75('0x14')],{'as':_0x1a75('0x167'),'through':_0x1a75('0x11d'),'foreignKey':'MailInteractionId'});db[_0x1a75('0x41')][_0x1a75('0x105')](db[_0x1a75('0xe8')],{'as':'Attachments','onDelete':_0x1a75('0x104')});db['MailMessage'][_0x1a75('0x140')](db['User'],{'as':_0x1a75('0x14')});db[_0x1a75('0x41')][_0x1a75('0x140')](db['CmContact'],{'onDelete':_0x1a75('0x104'),'as':'Contact'});db[_0x1a75('0x41')][_0x1a75('0x140')](db[_0x1a75('0x3f')],{'as':_0x1a75('0x168'),'foreignKey':_0x1a75('0x160')});db['MailMessage'][_0x1a75('0x140')](db[_0x1a75('0x3a')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x153')});db[_0x1a75('0x43')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'onDelete':_0x1a75('0x169')});db['MailApplication'][_0x1a75('0x140')](db[_0x1a75('0x3c')],{'onDelete':_0x1a75('0x169')});db[_0x1a75('0x43')][_0x1a75('0x140')](db[_0x1a75('0x3a')],{'onDelete':_0x1a75('0x169')});db[_0x1a75('0x43')]['belongsTo'](db[_0x1a75('0x7f')],{'onDelete':'restrict','foreignKey':_0x1a75('0x143')});db['MailApplication'][_0x1a75('0x140')](db['Tag'],{'onDelete':_0x1a75('0x169'),'foreignKey':_0x1a75('0x16a')});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x1a75('0x16b')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x16b')]['belongsTo'](db[_0x1a75('0x6e')],{'as':'Contact','foreignKey':_0x1a75('0x152')});db[_0x1a75('0x16b')][_0x1a75('0x140')](db[_0x1a75('0x3f')],{});db[_0x1a75('0x16b')][_0x1a75('0x140')](db['MailMessage'],{});db['MailQueueReport'][_0x1a75('0x140')](db[_0x1a75('0x14')],{});db['MailQueueReport'][_0x1a75('0x140')](db[_0x1a75('0x3c')],{});db[_0x1a75('0x16c')][_0x1a75('0x105')](db[_0x1a75('0x16d')],{'as':_0x1a75('0x16e'),'onDelete':_0x1a75('0x104')});db[_0x1a75('0x48')][_0x1a75('0x105')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x1a75('0x16f')});db[_0x1a75('0x48')]['hasMany'](db[_0x1a75('0x158')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x1a75('0x48')][_0x1a75('0x105')](db[_0x1a75('0x4b')],{'as':'Interactions'});db[_0x1a75('0x48')][_0x1a75('0x105')](db[_0x1a75('0x170')],{'as':_0x1a75('0x136')});db[_0x1a75('0x48')][_0x1a75('0x105')](db[_0x1a75('0x109')],{'as':'Exntensions','onDelete':'cascade'});db[_0x1a75('0x48')]['hasMany'](db['FaxMessage'],{'as':_0x1a75('0x14a')});db[_0x1a75('0x48')][_0x1a75('0x140')](db[_0x1a75('0x2b')],{'as':'Trunk'});db[_0x1a75('0x48')][_0x1a75('0x140')](db[_0x1a75('0x119')],{'as':'List','foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x48')][_0x1a75('0x140')](db['Pause'],{'as':_0x1a75('0x145'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1a75('0x48')][_0x1a75('0x114')](db['User'],{'as':_0x1a75('0x15c'),'through':'user_has_fax_accounts'});db[_0x1a75('0x170')][_0x1a75('0x140')](db['User'],{'onDelete':'restrict'});db[_0x1a75('0x170')][_0x1a75('0x140')](db[_0x1a75('0x4e')],{'onDelete':_0x1a75('0x169')});db[_0x1a75('0x170')][_0x1a75('0x140')](db[_0x1a75('0x48')],{'onDelete':_0x1a75('0x169')});db['FaxApplication'][_0x1a75('0x140')](db['Tag'],{'onDelete':_0x1a75('0x169'),'foreignKey':_0x1a75('0x16a')});db[_0x1a75('0x4b')][_0x1a75('0x105')](db['FaxMessage'],{'as':_0x1a75('0x14a'),'onDelete':_0x1a75('0x104'),'foreignKey':'FaxInteractionId'});db[_0x1a75('0x4b')][_0x1a75('0x140')](db[_0x1a75('0x48')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x16f')});db['FaxInteraction']['belongsTo'](db[_0x1a75('0x6e')],{'as':_0x1a75('0x162'),'foreignKey':_0x1a75('0x152')});db[_0x1a75('0x4b')]['belongsTo'](db['User'],{'as':_0x1a75('0x163'),'foreignKey':'UserId'});db[_0x1a75('0x4b')][_0x1a75('0x114')](db['Tag'],{'through':_0x1a75('0x171'),'as':_0x1a75('0x164')});db['FaxInteraction'][_0x1a75('0x114')](db[_0x1a75('0x88')],{'through':_0x1a75('0x171'),'as':_0x1a75('0x166')});db[_0x1a75('0x4b')]['belongsToMany'](db[_0x1a75('0x14')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x1a75('0x172')});db[_0x1a75('0x4d')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'onDelete':_0x1a75('0x104'),'as':_0x1a75('0x14')});db['FaxMessage'][_0x1a75('0x140')](db[_0x1a75('0x4b')],{'as':_0x1a75('0x168'),'foreignKey':_0x1a75('0x172')});db[_0x1a75('0x4d')]['belongsTo'](db[_0x1a75('0x6e')],{'onDelete':_0x1a75('0x104'),'as':_0x1a75('0x162')});db[_0x1a75('0x4d')]['belongsTo'](db[_0x1a75('0xe8')],{'as':_0x1a75('0xe8'),'foreignKey':'AttachmentId'});db[_0x1a75('0x4d')][_0x1a75('0x140')](db[_0x1a75('0x48')],{'as':'Account','foreignKey':_0x1a75('0x16f')});db[_0x1a75('0x4e')]['belongsToMany'](db['User'],{'as':_0x1a75('0x15c'),'through':'UserFaxQueue'});db[_0x1a75('0x4e')][_0x1a75('0x114')](db[_0x1a75('0xe0')],{'through':_0x1a75('0x173'),'as':_0x1a75('0x147')});db[_0x1a75('0x50')][_0x1a75('0x140')](db[_0x1a75('0x48')],{});db[_0x1a75('0x50')]['belongsTo'](db[_0x1a75('0x119')],{'as':_0x1a75('0x159'),'foreignKey':'ListId'});db[_0x1a75('0x50')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db[_0x1a75('0x50')]['belongsTo'](db[_0x1a75('0x4b')],{});db[_0x1a75('0x50')][_0x1a75('0x140')](db['FaxMessage'],{});db[_0x1a75('0x50')][_0x1a75('0x140')](db[_0x1a75('0x14')],{});db[_0x1a75('0x50')][_0x1a75('0x140')](db[_0x1a75('0x4e')],{});db[_0x1a75('0x52')][_0x1a75('0x105')](db[_0x1a75('0x157')],{'as':_0x1a75('0x174'),'foreignKey':_0x1a75('0x175')});db[_0x1a75('0x52')][_0x1a75('0x105')](db[_0x1a75('0x158')],{'as':_0x1a75('0x176'),'foreignKey':_0x1a75('0x175')});db[_0x1a75('0x52')]['hasMany'](db['SmsMessage'],{'as':_0x1a75('0x14a'),'foreignKey':'SmsAccountId'});db[_0x1a75('0x52')]['hasMany'](db['SmsInteraction'],{'as':_0x1a75('0x177')});db[_0x1a75('0x52')][_0x1a75('0x105')](db[_0x1a75('0x53')],{'as':'Applications'});db[_0x1a75('0x52')][_0x1a75('0x140')](db[_0x1a75('0x119')],{'as':'List','foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x52')][_0x1a75('0x140')](db[_0x1a75('0x144')],{'as':'mandatoryDispositionPause','foreignKey':_0x1a75('0x146')});db[_0x1a75('0x52')][_0x1a75('0x114')](db['User'],{'as':'Agents','through':_0x1a75('0x12f')});db[_0x1a75('0x53')][_0x1a75('0x140')](db['User'],{'onDelete':_0x1a75('0x169')});db[_0x1a75('0x53')][_0x1a75('0x140')](db[_0x1a75('0x58')],{'onDelete':_0x1a75('0x169')});db[_0x1a75('0x53')]['belongsTo'](db[_0x1a75('0x52')],{'onDelete':_0x1a75('0x169')});db[_0x1a75('0x53')][_0x1a75('0x140')](db['Interval'],{'onDelete':_0x1a75('0x169'),'foreignKey':_0x1a75('0x143')});db[_0x1a75('0x53')][_0x1a75('0x140')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x1a75('0x16a')});db[_0x1a75('0x55')][_0x1a75('0x105')](db[_0x1a75('0x178')],{'as':'Messages','onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x179')});db[_0x1a75('0x55')][_0x1a75('0x140')](db[_0x1a75('0x52')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x175')});db[_0x1a75('0x55')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'as':_0x1a75('0x162'),'foreignKey':_0x1a75('0x152')});db[_0x1a75('0x55')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':_0x1a75('0x163'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x55')]['belongsToMany'](db[_0x1a75('0x88')],{'through':_0x1a75('0x17a'),'as':'Tags'});db['SmsInteraction'][_0x1a75('0x114')](db[_0x1a75('0x88')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0x1a75('0x55')][_0x1a75('0x114')](db['User'],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0x1a75('0x179')});db[_0x1a75('0x178')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':_0x1a75('0x14')});db[_0x1a75('0x178')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'onDelete':_0x1a75('0x104'),'as':'Contact'});db['SmsMessage']['belongsTo'](db[_0x1a75('0x55')],{'onDelete':'cascade','as':_0x1a75('0x168'),'foreignKey':_0x1a75('0x179')});db[_0x1a75('0x178')][_0x1a75('0x140')](db['SmsAccount'],{'as':'Account','foreignKey':_0x1a75('0x175')});db['SmsQueue'][_0x1a75('0x114')](db[_0x1a75('0x14')],{'as':'Agents','through':_0x1a75('0x32'),'foreignKey':_0x1a75('0x17b')});db[_0x1a75('0x58')][_0x1a75('0x114')](db[_0x1a75('0xe0')],{'through':'team_has_sms_queues','as':_0x1a75('0x147')});db[_0x1a75('0x5a')][_0x1a75('0x105')](db['Disposition'],{'as':_0x1a75('0x174'),'foreignKey':'OpenchannelAccountId'});db[_0x1a75('0x5a')][_0x1a75('0x105')](db[_0x1a75('0x158')],{'as':_0x1a75('0x176'),'foreignKey':_0x1a75('0x17c')});db['OpenchannelAccount']['hasMany'](db[_0x1a75('0x11f')],{'as':_0x1a75('0x177'),'foreignKey':_0x1a75('0x17c')});db[_0x1a75('0x5a')][_0x1a75('0x105')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x1a75('0x17c')});db[_0x1a75('0x5a')][_0x1a75('0x105')](db[_0x1a75('0x5c')],{'as':_0x1a75('0x136'),'foreignKey':_0x1a75('0x17c')});db[_0x1a75('0x5a')]['belongsTo'](db[_0x1a75('0x119')],{'as':_0x1a75('0x159'),'foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x5a')]['belongsTo'](db[_0x1a75('0x144')],{'as':'mandatoryDispositionPause','foreignKey':_0x1a75('0x146')});db['OpenchannelAccount']['belongsToMany'](db[_0x1a75('0x14')],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x1a75('0x140')](db[_0x1a75('0x14')],{'onDelete':_0x1a75('0x169')});db['OpenchannelApplication'][_0x1a75('0x140')](db[_0x1a75('0x61')],{'onDelete':_0x1a75('0x169'),'foreignKey':_0x1a75('0x17d')});db[_0x1a75('0x5c')][_0x1a75('0x140')](db[_0x1a75('0x5a')],{'onDelete':_0x1a75('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0x1a75('0x5c')][_0x1a75('0x140')](db['Interval'],{'onDelete':_0x1a75('0x169'),'foreignKey':_0x1a75('0x143')});db[_0x1a75('0x5c')][_0x1a75('0x140')](db[_0x1a75('0x88')],{'onDelete':_0x1a75('0x169'),'foreignKey':'TagId'});db[_0x1a75('0x11f')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x17e')});db[_0x1a75('0x11f')][_0x1a75('0x140')](db[_0x1a75('0x5a')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x17c')});db[_0x1a75('0x11f')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'as':_0x1a75('0x162'),'foreignKey':'ContactId'});db[_0x1a75('0x11f')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':_0x1a75('0x163'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x11f')][_0x1a75('0x114')](db[_0x1a75('0x88')],{'through':'openchannel_interaction_has_tags','as':_0x1a75('0x164')});db[_0x1a75('0x11f')][_0x1a75('0x114')](db[_0x1a75('0x88')],{'through':'openchannel_interaction_has_tags','as':_0x1a75('0x166')});db[_0x1a75('0x11f')][_0x1a75('0x114')](db['User'],{'as':_0x1a75('0x167'),'through':_0x1a75('0x120'),'foreignKey':_0x1a75('0x17e')});db['OpenchannelMessage']['belongsTo'](db['User'],{'onDelete':_0x1a75('0x104'),'as':_0x1a75('0x14')});db['OpenchannelMessage'][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'onDelete':_0x1a75('0x104'),'as':_0x1a75('0x162')});db['OpenchannelMessage'][_0x1a75('0x140')](db[_0x1a75('0x11f')],{'onDelete':_0x1a75('0x104'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0x1a75('0x5f')][_0x1a75('0x140')](db[_0x1a75('0xe8')],{'as':'Attachment','foreignKey':_0x1a75('0x17f')});db['OpenchannelMessage'][_0x1a75('0x140')](db[_0x1a75('0x5a')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x17c')});db[_0x1a75('0x61')][_0x1a75('0x114')](db[_0x1a75('0x14')],{'as':_0x1a75('0x15c'),'through':_0x1a75('0x34'),'foreignKey':_0x1a75('0x17d')});db[_0x1a75('0x61')][_0x1a75('0x114')](db[_0x1a75('0xe0')],{'through':_0x1a75('0x180'),'as':_0x1a75('0x147')});db[_0x1a75('0x62')]['hasMany'](db[_0x1a75('0x157')],{'as':'Dispositions','foreignKey':_0x1a75('0x181')});db['ChatWebsite']['hasMany'](db['CannedAnswer'],{'as':_0x1a75('0x176'),'foreignKey':_0x1a75('0x181')});db[_0x1a75('0x62')][_0x1a75('0x105')](db[_0x1a75('0x6a')],{'as':'ProactiveActions'});db[_0x1a75('0x62')][_0x1a75('0x105')](db[_0x1a75('0x65')],{'as':_0x1a75('0x177')});db[_0x1a75('0x62')]['hasMany'](db[_0x1a75('0x64')],{'as':'Applications'});db[_0x1a75('0x62')][_0x1a75('0x105')](db[_0x1a75('0x67')],{'as':_0x1a75('0x14a')});db[_0x1a75('0x62')][_0x1a75('0x140')](db[_0x1a75('0x119')],{'as':_0x1a75('0x159'),'foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x62')]['belongsTo'](db[_0x1a75('0x7f')],{'as':_0x1a75('0x7f'),'foreignKey':_0x1a75('0x143')});db[_0x1a75('0x62')]['belongsTo'](db[_0x1a75('0x144')],{'as':'mandatoryDispositionPause','foreignKey':_0x1a75('0x146')});db[_0x1a75('0x62')][_0x1a75('0x114')](db[_0x1a75('0x14')],{'as':_0x1a75('0x15c'),'through':_0x1a75('0x12a')});db['OpenchannelQueueReport'][_0x1a75('0x140')](db[_0x1a75('0x5a')],{});db[_0x1a75('0x182')][_0x1a75('0x140')](db['CmList'],{'as':'List','foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x182')][_0x1a75('0x140')](db['CmContact'],{'as':_0x1a75('0x162'),'foreignKey':_0x1a75('0x152')});db[_0x1a75('0x182')][_0x1a75('0x140')](db['OpenchannelInteraction'],{});db[_0x1a75('0x182')][_0x1a75('0x140')](db[_0x1a75('0x5f')],{});db['OpenchannelQueueReport']['belongsTo'](db['User'],{});db[_0x1a75('0x182')]['belongsTo'](db[_0x1a75('0x61')],{});db[_0x1a75('0x64')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':_0x1a75('0x183'),'foreignKey':_0x1a75('0x106'),'onDelete':'restrict'});db['ChatApplication'][_0x1a75('0x140')](db[_0x1a75('0x123')],{'as':_0x1a75('0x184'),'foreignKey':_0x1a75('0x185'),'onDelete':_0x1a75('0x169')});db[_0x1a75('0x64')][_0x1a75('0x140')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x1a75('0x181'),'onDelete':_0x1a75('0x169')});db[_0x1a75('0x64')]['belongsTo'](db[_0x1a75('0x88')],{'onDelete':'restrict','foreignKey':_0x1a75('0x16a')});db['ChatInteraction'][_0x1a75('0x105')](db[_0x1a75('0x67')],{'as':_0x1a75('0x14a'),'onDelete':_0x1a75('0x104'),'foreignKey':'ChatInteractionId'});db[_0x1a75('0x65')][_0x1a75('0x140')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x1a75('0x65')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'as':'Contact','foreignKey':_0x1a75('0x152')});db[_0x1a75('0x65')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':_0x1a75('0x163'),'foreignKey':_0x1a75('0x106')});db[_0x1a75('0x65')][_0x1a75('0x114')](db['Tag'],{'through':_0x1a75('0x186'),'as':_0x1a75('0x164')});db[_0x1a75('0x65')][_0x1a75('0x114')](db[_0x1a75('0x88')],{'through':'chat_interaction_has_tags','as':_0x1a75('0x166')});db[_0x1a75('0x65')][_0x1a75('0x114')](db[_0x1a75('0x14')],{'as':_0x1a75('0x167'),'through':_0x1a75('0x11e'),'foreignKey':'ChatInteractionId'});db[_0x1a75('0x67')][_0x1a75('0x140')](db['User'],{'onDelete':_0x1a75('0x104'),'as':'User'});db[_0x1a75('0x67')][_0x1a75('0x140')](db['CmContact'],{'onDelete':_0x1a75('0x104'),'as':_0x1a75('0x162'),'foreignKey':_0x1a75('0x152')});db[_0x1a75('0x67')][_0x1a75('0x140')](db[_0x1a75('0x65')],{'onDelete':_0x1a75('0x104'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x1a75('0x67')][_0x1a75('0x140')](db['Attachment'],{'as':_0x1a75('0xe8'),'foreignKey':_0x1a75('0x17f')});db[_0x1a75('0x67')]['belongsTo'](db[_0x1a75('0x62')],{'as':'Account','foreignKey':_0x1a75('0x181')});db[_0x1a75('0x187')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'onDelete':'cascade','as':_0x1a75('0x162'),'foreignKey':'ContactId'});db[_0x1a75('0x187')]['belongsTo'](db[_0x1a75('0x62')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x181')});db[_0x1a75('0x123')]['belongsToMany'](db[_0x1a75('0x14')],{'as':_0x1a75('0x15c'),'through':_0x1a75('0x125'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x1a75('0xe0')],{'through':_0x1a75('0x188'),'as':'Teams'});db[_0x1a75('0x115')][_0x1a75('0x105')](db[_0x1a75('0x189')],{'as':_0x1a75('0x14a'),'foreignKey':_0x1a75('0x18a'),'onDelete':'cascade'});db[_0x1a75('0x115')][_0x1a75('0x114')](db[_0x1a75('0x14')],{'as':_0x1a75('0x139'),'through':_0x1a75('0x117')});db[_0x1a75('0x6a')]['belongsTo'](db[_0x1a75('0x62')],{'as':_0x1a75('0x18b'),'foreignKey':_0x1a75('0x181')});db[_0x1a75('0x6c')][_0x1a75('0x105')](db['CmContact'],{'as':_0x1a75('0x18c'),'foreignKey':'CompanyId'});db['CmContact'][_0x1a75('0x105')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x1a75('0x6e')][_0x1a75('0x105')](db[_0x1a75('0x72')],{'as':_0x1a75('0x10b'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db['CmHopperHistory'],{'as':_0x1a75('0x13d'),'foreignKey':_0x1a75('0x152')});db[_0x1a75('0x6e')][_0x1a75('0x105')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x1a75('0x152')});db[_0x1a75('0x6e')][_0x1a75('0x105')](db[_0x1a75('0xd0')],{'as':_0x1a75('0x13f'),'foreignKey':_0x1a75('0x152')});db[_0x1a75('0x6e')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x1a75('0x10c'),'foreignKey':_0x1a75('0x152'),'onDelete':_0x1a75('0x169')});db[_0x1a75('0x6e')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x1a75('0x152'),'onDelete':_0x1a75('0x169')});db[_0x1a75('0x6e')]['hasMany'](db[_0x1a75('0x55')],{'as':_0x1a75('0x10e'),'foreignKey':_0x1a75('0x152'),'onDelete':_0x1a75('0x169')});db[_0x1a75('0x6e')][_0x1a75('0x105')](db[_0x1a75('0x4b')],{'as':_0x1a75('0x10f'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x1a75('0x6e')][_0x1a75('0x105')](db[_0x1a75('0x3f')],{'as':_0x1a75('0x110'),'foreignKey':'ContactId','onDelete':_0x1a75('0x169')});db[_0x1a75('0x6e')][_0x1a75('0x140')](db[_0x1a75('0x6c')],{'as':'Company','foreignKey':_0x1a75('0x18d')});db[_0x1a75('0x6e')][_0x1a75('0x140')](db[_0x1a75('0x119')],{'as':_0x1a75('0x159'),'foreignKey':_0x1a75('0x15a'),'onDelete':_0x1a75('0x104')});db[_0x1a75('0x6e')]['belongsToMany'](db[_0x1a75('0x14')],{'as':_0x1a75('0x167'),'through':'cm_user_has_contacts'});db[_0x1a75('0x6e')][_0x1a75('0x114')](db['Tag'],{'as':_0x1a75('0x164'),'through':_0x1a75('0x18e')});db['CmContact'][_0x1a75('0x114')](db[_0x1a75('0x88')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x1a75('0x6f')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x1a75('0x6f')][_0x1a75('0x140')](db['CmList'],{'as':_0x1a75('0x159'),'foreignKey':_0x1a75('0x15a'),'onDelete':_0x1a75('0x104')});db['CmHopper'][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':_0x1a75('0x183'),'foreignKey':'UserId'});db['CmHopper'][_0x1a75('0x140')](db[_0x1a75('0x1c')],{'as':_0x1a75('0x184'),'foreignKey':_0x1a75('0x13a'),'onDelete':_0x1a75('0x104')});db[_0x1a75('0x6f')]['belongsTo'](db[_0x1a75('0xe4')],{'as':_0x1a75('0xe4'),'foreignKey':_0x1a75('0x18f'),'onDelete':_0x1a75('0x104')});db['CmHopper'][_0x1a75('0x140')](db['User'],{'as':_0x1a75('0x163'),'foreignKey':_0x1a75('0x190')});db[_0x1a75('0x71')][_0x1a75('0x140')](db['CmContact'],{'as':_0x1a75('0x162'),'foreignKey':'ContactId','onDelete':_0x1a75('0x104')});db[_0x1a75('0x71')][_0x1a75('0x140')](db[_0x1a75('0x119')],{'as':_0x1a75('0x159'),'foreignKey':_0x1a75('0x15a'),'onDelete':_0x1a75('0x104')});db[_0x1a75('0x71')][_0x1a75('0x140')](db['VoiceQueue'],{'as':_0x1a75('0x184'),'foreignKey':_0x1a75('0x13a'),'onDelete':_0x1a75('0x104')});db[_0x1a75('0x71')][_0x1a75('0x140')](db[_0x1a75('0xe4')],{'as':_0x1a75('0xe4'),'foreignKey':_0x1a75('0x18f'),'onDelete':_0x1a75('0x104')});db[_0x1a75('0x7a')][_0x1a75('0x105')](db[_0x1a75('0x7d')],{'as':{'plural':_0x1a75('0x191'),'singular':_0x1a75('0x192')},'foreignKey':_0x1a75('0x193'),'onDelete':_0x1a75('0x104'),'hooks':!![]});db['Automation'][_0x1a75('0x105')](db[_0x1a75('0x7d')],{'as':{'plural':'Any','singular':_0x1a75('0x194')},'foreignKey':'AutomationAnyId','onDelete':_0x1a75('0x104'),'hooks':!![]});db[_0x1a75('0x7a')][_0x1a75('0x105')](db[_0x1a75('0x78')],{'as':_0x1a75('0x195'),'foreignKey':_0x1a75('0x196'),'onDelete':_0x1a75('0x104'),'hooks':!![]});db['Interval'][_0x1a75('0x105')](db[_0x1a75('0x7f')],{'as':_0x1a75('0x197'),'foreignKey':'IntervalId','onDelete':_0x1a75('0x104'),'hooks':!![],'required':![]});db[_0x1a75('0x7f')][_0x1a75('0x105')](db[_0x1a75('0x109')],{'as':_0x1a75('0x10a'),'foreignKey':_0x1a75('0x143'),'onDelete':_0x1a75('0x169')});db[_0x1a75('0x7f')][_0x1a75('0x105')](db[_0x1a75('0x43')],{'as':_0x1a75('0x198'),'foreignKey':_0x1a75('0x143')});db['Interval'][_0x1a75('0x105')](db[_0x1a75('0x64')],{'as':_0x1a75('0x199'),'foreignKey':_0x1a75('0x143')});db[_0x1a75('0x7f')][_0x1a75('0x105')](db['FaxApplication'],{'as':_0x1a75('0x19a'),'foreignKey':'IntervalId'});db['Interval'][_0x1a75('0x105')](db[_0x1a75('0x53')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x1a75('0x19b')][_0x1a75('0x140')](db[_0x1a75('0x3a')],{});db['Schedule'][_0x1a75('0x140')](db['AnalyticDefaultReport'],{'foreignKey':_0x1a75('0x19c')});db[_0x1a75('0x19b')][_0x1a75('0x140')](db['AnalyticCustomReport'],{'foreignKey':_0x1a75('0x19d')});db[_0x1a75('0x86')][_0x1a75('0x114')](db[_0x1a75('0x19e')],{'as':_0x1a75('0x19f'),'through':_0x1a75('0x138'),'onDelete':_0x1a75('0x169')});db[_0x1a75('0x88')][_0x1a75('0x114')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x1a75('0x88')][_0x1a75('0x114')](db[_0x1a75('0x65')],{'through':_0x1a75('0x186')});db['Tag']['belongsToMany'](db[_0x1a75('0x3f')],{'through':'mail_interaction_has_tags'});db[_0x1a75('0x88')][_0x1a75('0x114')](db['SmsInteraction'],{'through':_0x1a75('0x17a')});db[_0x1a75('0x88')][_0x1a75('0x114')](db[_0x1a75('0x4b')],{'through':_0x1a75('0x171')});db['Tag'][_0x1a75('0x114')](db[_0x1a75('0x11f')],{'through':_0x1a75('0x1a0')});db[_0x1a75('0x88')][_0x1a75('0x114')](db[_0x1a75('0xfa')],{'through':'whatsapp_interaction_has_tags'});db[_0x1a75('0x8b')]['hasMany'](db[_0x1a75('0x7d')],{'as':{'plural':_0x1a75('0x1a1'),'singular':_0x1a75('0x1a2')},'foreignKey':_0x1a75('0x1a3'),'onDelete':_0x1a75('0x104'),'hooks':!![]});db[_0x1a75('0x8b')][_0x1a75('0x105')](db[_0x1a75('0x7d')],{'as':{'plural':_0x1a75('0x1a4'),'singular':_0x1a75('0x1a5')},'foreignKey':_0x1a75('0x1a6'),'onDelete':_0x1a75('0x104'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x1a75('0x78')],{'as':_0x1a75('0x195'),'foreignKey':_0x1a75('0x1a7'),'onDelete':_0x1a75('0x104'),'hooks':!![]});db['AnalyticCustomReport'][_0x1a75('0x105')](db[_0x1a75('0x96')],{'as':_0x1a75('0x1a8'),'onDelete':'cascade','foreignKey':_0x1a75('0x19d'),'hooks':!![]});db[_0x1a75('0x1a9')][_0x1a75('0x105')](db['AnalyticFieldReport'],{'as':_0x1a75('0x1a8'),'onDelete':_0x1a75('0x104'),'foreignKey':'DefaultReportId'});db[_0x1a75('0x1aa')][_0x1a75('0x105')](db[_0x1a75('0x96')],{'as':_0x1a75('0x1a8'),'onDelete':'cascade','foreignKey':_0x1a75('0x1ab')});db['AnalyticFieldReport'][_0x1a75('0x140')](db[_0x1a75('0x1aa')],{'foreignKey':'MetricId'});db[_0x1a75('0x9a')]['hasMany'](db[_0x1a75('0x9c')],{'as':_0x1a75('0x1ac'),'onDelete':_0x1a75('0x104'),'foreignKey':'AccountId'});db[_0x1a75('0x9c')]['hasMany'](db[_0x1a75('0x9e')],{'as':_0x1a75('0x1ad'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1ae')});db['SalesforceConfiguration']['hasMany'](db[_0x1a75('0x9e')],{'as':_0x1a75('0x1af'),'onDelete':_0x1a75('0x104'),'foreignKey':'DescriptionId'});db[_0x1a75('0x9c')][_0x1a75('0x105')](db['SalesforceField'],{'as':_0x1a75('0x1a8'),'onDelete':_0x1a75('0x104'),'foreignKey':'FieldId'});db[_0x1a75('0x9c')][_0x1a75('0x140')](db[_0x1a75('0x9a')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x1b0')});db['SalesforceField']['hasMany'](db[_0x1a75('0x9e')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x1a75('0x9e')]['hasMany'](db[_0x1a75('0x9e')],{'as':'Description','foreignKey':_0x1a75('0x1b1')});db['SalesforceField'][_0x1a75('0x105')](db[_0x1a75('0x9e')],{'as':_0x1a75('0x1b2'),'foreignKey':_0x1a75('0x1b3')});db['SalesforceField'][_0x1a75('0x140')](db[_0x1a75('0x8d')],{'as':_0x1a75('0x8d'),'foreignKey':_0x1a75('0x1b4')});db[_0x1a75('0x1b5')][_0x1a75('0x105')](db[_0x1a75('0xa1')],{'as':_0x1a75('0x1ac'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1b0')});db[_0x1a75('0xa1')][_0x1a75('0x105')](db[_0x1a75('0xa3')],{'as':_0x1a75('0x1ad'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1ae')});db['SugarcrmConfiguration'][_0x1a75('0x105')](db[_0x1a75('0xa3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x1a75('0x1b1')});db['SugarcrmConfiguration'][_0x1a75('0x105')](db[_0x1a75('0xa3')],{'as':_0x1a75('0x1a8'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1b3')});db['SugarcrmConfiguration'][_0x1a75('0x140')](db['SugarcrmAccount'],{'as':_0x1a75('0x161'),'foreignKey':'AccountId'});db[_0x1a75('0xa3')]['hasMany'](db[_0x1a75('0xa3')],{'as':_0x1a75('0x1b6'),'foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0xa3')][_0x1a75('0x105')](db[_0x1a75('0xa3')],{'as':_0x1a75('0x1b7'),'foreignKey':'DescriptionId'});db[_0x1a75('0xa3')]['hasMany'](db[_0x1a75('0xa3')],{'as':_0x1a75('0x1b2'),'foreignKey':_0x1a75('0x1b3')});db[_0x1a75('0xa3')]['belongsTo'](db[_0x1a75('0x8d')],{'as':'Variable','foreignKey':_0x1a75('0x1b4')});db[_0x1a75('0xa5')][_0x1a75('0x105')](db[_0x1a75('0x1b8')],{'as':_0x1a75('0x1ac'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1b0')});db[_0x1a75('0x1b8')][_0x1a75('0x105')](db[_0x1a75('0xa7')],{'as':_0x1a75('0x1ad'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0x1b8')][_0x1a75('0x105')](db[_0x1a75('0xa7')],{'as':_0x1a75('0x1af'),'onDelete':'cascade','foreignKey':_0x1a75('0x1b1')});db[_0x1a75('0x1b8')][_0x1a75('0x105')](db[_0x1a75('0xa7')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x1a75('0x1b3')});db['DeskConfiguration'][_0x1a75('0x140')](db['DeskAccount'],{'as':_0x1a75('0x161'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x1a75('0x114')](db[_0x1a75('0x88')],{'through':'int_desk_configuration_has_tags'});db[_0x1a75('0xa7')][_0x1a75('0x105')](db[_0x1a75('0xa7')],{'as':_0x1a75('0x1b6'),'foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0xa7')][_0x1a75('0x105')](db[_0x1a75('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x1a75('0xa7')][_0x1a75('0x105')](db[_0x1a75('0xa7')],{'as':_0x1a75('0x1b2'),'foreignKey':'FieldId'});db[_0x1a75('0xa7')][_0x1a75('0x140')](db[_0x1a75('0x8d')],{'as':_0x1a75('0x8d'),'foreignKey':_0x1a75('0x1b4')});db[_0x1a75('0xa8')]['hasMany'](db[_0x1a75('0xaa')],{'as':_0x1a75('0x1ac'),'onDelete':_0x1a75('0x104'),'foreignKey':'AccountId'});db[_0x1a75('0xaa')][_0x1a75('0x105')](db['ZohoField'],{'as':_0x1a75('0x1ad'),'onDelete':'cascade','foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0xaa')]['hasMany'](db[_0x1a75('0xab')],{'as':_0x1a75('0x1af'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1b1')});db[_0x1a75('0xaa')][_0x1a75('0x105')](db['ZohoField'],{'as':'Fields','onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1b3')});db[_0x1a75('0xaa')][_0x1a75('0x140')](db[_0x1a75('0xa8')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x1b0')});db[_0x1a75('0xab')][_0x1a75('0x105')](db['ZohoField'],{'as':_0x1a75('0x1b6'),'foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0xab')]['hasMany'](db[_0x1a75('0xab')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x1a75('0xab')][_0x1a75('0x105')](db[_0x1a75('0xab')],{'as':'Field','foreignKey':'FieldId'});db[_0x1a75('0xab')][_0x1a75('0x140')](db[_0x1a75('0x8d')],{'as':_0x1a75('0x8d'),'foreignKey':_0x1a75('0x1b4')});db[_0x1a75('0xad')][_0x1a75('0x105')](db[_0x1a75('0xaf')],{'as':_0x1a75('0x1ac'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1b0')});db[_0x1a75('0xaf')]['hasMany'](db[_0x1a75('0xb1')],{'as':_0x1a75('0x1ad'),'foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0xaf')][_0x1a75('0x105')](db[_0x1a75('0xb1')],{'as':_0x1a75('0x1af'),'foreignKey':_0x1a75('0x1b1')});db[_0x1a75('0xaf')]['hasMany'](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x1a75('0x140')](db['ZendeskAccount'],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x1b0')});db['ZendeskConfiguration'][_0x1a75('0x114')](db['Tag'],{'through':_0x1a75('0x1b9')});db[_0x1a75('0xb1')][_0x1a75('0x105')](db['ZendeskField'],{'as':_0x1a75('0x1b6'),'foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0xb1')][_0x1a75('0x105')](db[_0x1a75('0xb1')],{'as':'Description','foreignKey':_0x1a75('0x1b1')});db[_0x1a75('0xb1')]['hasMany'](db['ZendeskField'],{'as':'Field','foreignKey':_0x1a75('0x1b3')});db[_0x1a75('0xb1')][_0x1a75('0x140')](db[_0x1a75('0x8d')],{'as':_0x1a75('0x8d'),'foreignKey':_0x1a75('0x1b4')});db['FreshdeskAccount'][_0x1a75('0x105')](db['FreshdeskConfiguration'],{'as':_0x1a75('0x1ac'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x1a75('0x1ba')]['hasMany'](db[_0x1a75('0x1bb')],{'as':'Subjects','onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0x1ba')][_0x1a75('0x105')](db[_0x1a75('0x1bb')],{'as':_0x1a75('0x1af'),'onDelete':_0x1a75('0x104'),'foreignKey':'DescriptionId'});db[_0x1a75('0x1ba')][_0x1a75('0x105')](db[_0x1a75('0x1bb')],{'as':_0x1a75('0x1a8'),'onDelete':'cascade','foreignKey':_0x1a75('0x1b3')});db[_0x1a75('0x1ba')]['belongsTo'](db[_0x1a75('0xb3')],{'as':'Account','foreignKey':'AccountId'});db[_0x1a75('0x1ba')]['belongsToMany'](db[_0x1a75('0x88')],{'through':_0x1a75('0x1bc')});db[_0x1a75('0x1bb')][_0x1a75('0x105')](db['FreshdeskField'],{'as':_0x1a75('0x1b6'),'foreignKey':_0x1a75('0x1ae')});db['FreshdeskField'][_0x1a75('0x105')](db[_0x1a75('0x1bb')],{'as':_0x1a75('0x1b7'),'foreignKey':_0x1a75('0x1b1')});db[_0x1a75('0x1bb')][_0x1a75('0x105')](db['FreshdeskField'],{'as':'Field','foreignKey':_0x1a75('0x1b3')});db[_0x1a75('0x1bb')][_0x1a75('0x140')](db[_0x1a75('0x8d')],{'as':_0x1a75('0x8d'),'foreignKey':'VariableId'});db[_0x1a75('0x1bd')]['hasMany'](db[_0x1a75('0xb7')],{'as':_0x1a75('0x1ac'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1b0')});db['VtigerConfiguration']['hasMany'](db[_0x1a75('0x1be')],{'as':'Subjects','foreignKey':_0x1a75('0x1ae')});db['VtigerConfiguration']['hasMany'](db[_0x1a75('0x1be')],{'as':_0x1a75('0x1af'),'foreignKey':'DescriptionId'});db[_0x1a75('0xb7')][_0x1a75('0x105')](db[_0x1a75('0x1be')],{'as':_0x1a75('0x1a8'),'foreignKey':_0x1a75('0x1b3')});db[_0x1a75('0xb7')]['belongsTo'](db['VtigerAccount'],{'as':_0x1a75('0x161'),'foreignKey':'AccountId'});db[_0x1a75('0x1be')][_0x1a75('0x105')](db[_0x1a75('0x1be')],{'as':_0x1a75('0x1b6'),'foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0x1be')][_0x1a75('0x105')](db['VtigerField'],{'as':_0x1a75('0x1b7'),'foreignKey':'DescriptionId'});db[_0x1a75('0x1be')][_0x1a75('0x105')](db[_0x1a75('0x1be')],{'as':_0x1a75('0x1b2'),'foreignKey':_0x1a75('0x1b3')});db[_0x1a75('0x1be')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x1a75('0xb9')]['hasMany'](db[_0x1a75('0xbb')],{'as':_0x1a75('0x1ac'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1b0')});db[_0x1a75('0xbb')]['hasMany'](db[_0x1a75('0xbd')],{'as':_0x1a75('0x1ad'),'foreignKey':_0x1a75('0x1ae')});db['ServicenowConfiguration'][_0x1a75('0x105')](db['ServicenowField'],{'as':_0x1a75('0x1af'),'foreignKey':_0x1a75('0x1b1')});db[_0x1a75('0xbb')][_0x1a75('0x105')](db[_0x1a75('0xbd')],{'as':'Fields','foreignKey':_0x1a75('0x1b3')});db[_0x1a75('0xbb')][_0x1a75('0x140')](db[_0x1a75('0xb9')],{'as':'Account','foreignKey':'AccountId'});db[_0x1a75('0xbd')][_0x1a75('0x105')](db[_0x1a75('0xbd')],{'as':_0x1a75('0x1b6'),'foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0xbd')][_0x1a75('0x105')](db[_0x1a75('0xbd')],{'as':_0x1a75('0x1b7'),'foreignKey':_0x1a75('0x1b1')});db[_0x1a75('0xbd')][_0x1a75('0x105')](db[_0x1a75('0xbd')],{'as':_0x1a75('0x1b2'),'foreignKey':'FieldId'});db[_0x1a75('0xbd')]['belongsTo'](db[_0x1a75('0x8d')],{'as':_0x1a75('0x8d'),'foreignKey':_0x1a75('0x1b4')});db[_0x1a75('0x1bf')][_0x1a75('0x105')](db[_0x1a75('0xc0')],{'as':_0x1a75('0x1ac'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1b0')});db['Dynamics365Configuration'][_0x1a75('0x105')](db[_0x1a75('0xc1')],{'as':_0x1a75('0x1ad'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0xc0')]['hasMany'](db['Dynamics365Field'],{'as':'Descriptions','onDelete':_0x1a75('0x104'),'foreignKey':'DescriptionId'});db[_0x1a75('0xc0')][_0x1a75('0x105')](db[_0x1a75('0xc1')],{'as':_0x1a75('0x1a8'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x1a75('0xc0')]['belongsTo'](db[_0x1a75('0x1bf')],{'as':'Account','foreignKey':'AccountId'});db[_0x1a75('0xc1')]['hasMany'](db['Dynamics365Field'],{'as':_0x1a75('0x1b6'),'foreignKey':_0x1a75('0x1ae')});db['Dynamics365Field'][_0x1a75('0x105')](db[_0x1a75('0xc1')],{'as':_0x1a75('0x1b7'),'foreignKey':_0x1a75('0x1b1')});db[_0x1a75('0xc1')][_0x1a75('0x105')](db[_0x1a75('0xc1')],{'as':_0x1a75('0x1b2'),'foreignKey':_0x1a75('0x1b3')});db['Dynamics365Field'][_0x1a75('0x140')](db[_0x1a75('0x8d')],{'as':_0x1a75('0x8d'),'foreignKey':_0x1a75('0x1b4')});db['FreshsalesAccount'][_0x1a75('0x105')](db[_0x1a75('0x1c0')],{'as':_0x1a75('0x1ac'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1b0')});db[_0x1a75('0x1c0')]['hasMany'](db[_0x1a75('0xc5')],{'as':'Subjects','foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0x1c0')]['hasMany'](db[_0x1a75('0xc5')],{'as':_0x1a75('0x1af'),'foreignKey':_0x1a75('0x1b1')});db['FreshsalesConfiguration'][_0x1a75('0x105')](db['FreshsalesField'],{'as':_0x1a75('0x1a8'),'foreignKey':_0x1a75('0x1b3')});db[_0x1a75('0x1c0')]['belongsTo'](db[_0x1a75('0xc3')],{'as':_0x1a75('0x161'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x1a75('0x105')](db[_0x1a75('0xc5')],{'as':'Subject','foreignKey':_0x1a75('0x1ae')});db[_0x1a75('0xc5')][_0x1a75('0x105')](db['FreshsalesField'],{'as':_0x1a75('0x1b7'),'foreignKey':_0x1a75('0x1b1')});db[_0x1a75('0xc5')][_0x1a75('0x105')](db[_0x1a75('0xc5')],{'as':_0x1a75('0x1b2'),'foreignKey':_0x1a75('0x1b3')});db[_0x1a75('0xc5')][_0x1a75('0x140')](db[_0x1a75('0x8d')],{'as':'Variable','foreignKey':'VariableId'});db[_0x1a75('0xc9')]['belongsTo'](db[_0x1a75('0x62')],{});db[_0x1a75('0xc9')][_0x1a75('0x140')](db[_0x1a75('0x119')],{'as':_0x1a75('0x159'),'foreignKey':_0x1a75('0x15a')});db[_0x1a75('0xc9')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'as':_0x1a75('0x162'),'foreignKey':'ContactId'});db[_0x1a75('0xc9')][_0x1a75('0x140')](db['ChatInteraction'],{});db[_0x1a75('0xc9')][_0x1a75('0x140')](db[_0x1a75('0x67')],{});db[_0x1a75('0xc9')][_0x1a75('0x140')](db[_0x1a75('0x14')],{});db[_0x1a75('0xc9')][_0x1a75('0x140')](db[_0x1a75('0x123')],{});db[_0x1a75('0x189')][_0x1a75('0x140')](db['User'],{'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1c1')});db[_0x1a75('0x189')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'onDelete':_0x1a75('0x104'),'foreignKey':'ToId'});db[_0x1a75('0xd0')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x1a75('0x1c2'),'onDelete':_0x1a75('0x104')});db[_0x1a75('0xd0')][_0x1a75('0x105')](db[_0x1a75('0xcc')],{'foreignKey':_0x1a75('0x1c2'),'onDelete':_0x1a75('0x104')});db['SmsQueueReport'][_0x1a75('0x140')](db[_0x1a75('0x52')],{});db['SmsQueueReport'][_0x1a75('0x140')](db[_0x1a75('0x119')],{'as':_0x1a75('0x159'),'foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x1c3')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'as':_0x1a75('0x162'),'foreignKey':'ContactId'});db[_0x1a75('0x1c3')][_0x1a75('0x140')](db[_0x1a75('0x55')],{});db['SmsQueueReport'][_0x1a75('0x140')](db[_0x1a75('0x178')],{});db[_0x1a75('0x1c3')][_0x1a75('0x140')](db[_0x1a75('0x14')],{});db[_0x1a75('0x1c3')][_0x1a75('0x140')](db[_0x1a75('0x58')],{});db[_0x1a75('0xd6')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x1a75('0x105')](db[_0x1a75('0xce')],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db[_0x1a75('0xcc')],{'foreignKey':_0x1a75('0x1c4')});db[_0x1a75('0xdc')][_0x1a75('0x114')](db['User'],{'as':_0x1a75('0x167'),'through':_0x1a75('0x133')});db['Team']['belongsToMany'](db[_0x1a75('0x14')],{'as':_0x1a75('0x15c'),'through':_0x1a75('0x11c')});db[_0x1a75('0xe0')][_0x1a75('0x114')](db[_0x1a75('0x1c')],{'through':_0x1a75('0x1c5'),'as':_0x1a75('0x121')});db[_0x1a75('0xe0')][_0x1a75('0x114')](db[_0x1a75('0x3c')],{'through':_0x1a75('0x15f'),'as':_0x1a75('0x122')});db[_0x1a75('0xe0')][_0x1a75('0x114')](db['ChatQueue'],{'through':_0x1a75('0x188'),'as':_0x1a75('0x124')});db[_0x1a75('0xe0')][_0x1a75('0x114')](db['FaxQueue'],{'through':_0x1a75('0x173'),'as':_0x1a75('0x1c6')});db['Team'][_0x1a75('0x114')](db[_0x1a75('0x58')],{'through':'team_has_sms_queues','as':_0x1a75('0x126')});db[_0x1a75('0xe0')][_0x1a75('0x114')](db[_0x1a75('0x61')],{'through':_0x1a75('0x180'),'as':_0x1a75('0x1c7')});db['Team'][_0x1a75('0x114')](db[_0x1a75('0xff')],{'through':_0x1a75('0x1c8'),'as':_0x1a75('0x127')});db[_0x1a75('0xe4')][_0x1a75('0x105')](db[_0x1a75('0x6f')],{'as':_0x1a75('0x13b'),'foreignKey':_0x1a75('0x18f')});db[_0x1a75('0xe4')][_0x1a75('0x105')](db[_0x1a75('0x72')],{'as':_0x1a75('0x10b'),'foreignKey':_0x1a75('0x18f')});db[_0x1a75('0xe4')][_0x1a75('0x105')](db[_0x1a75('0x13c')],{'as':_0x1a75('0x13d'),'foreignKey':_0x1a75('0x18f')});db[_0x1a75('0xe4')][_0x1a75('0x105')](db[_0x1a75('0x71')],{'as':_0x1a75('0x13e'),'foreignKey':_0x1a75('0x18f')});db[_0x1a75('0xe4')]['belongsTo'](db[_0x1a75('0x2b')],{'as':_0x1a75('0x2b'),'foreignKey':'TrunkId'});db[_0x1a75('0xe4')][_0x1a75('0x140')](db[_0x1a75('0x2b')],{'as':_0x1a75('0x142'),'foreignKey':_0x1a75('0x1c9')});db[_0x1a75('0xe4')]['belongsTo'](db[_0x1a75('0x7f')],{'as':_0x1a75('0x7f'),'foreignKey':'IntervalId'});db['Campaign'][_0x1a75('0x140')](db[_0x1a75('0xdc')],{'as':'SquareProject','foreignKey':_0x1a75('0x1ca')});db[_0x1a75('0xe4')][_0x1a75('0x114')](db[_0x1a75('0x119')],{'as':'Lists','through':_0x1a75('0x1cb')});db[_0x1a75('0xe4')][_0x1a75('0x114')](db[_0x1a75('0x119')],{'as':'BlackLists','through':_0x1a75('0x1cc')});db['MailTransferReport']['belongsTo'](db[_0x1a75('0x41')],{});db[_0x1a75('0xea')]['belongsTo'](db['MailInteraction'],{});db[_0x1a75('0xea')][_0x1a75('0x140')](db[_0x1a75('0x3a')],{'foreignKey':_0x1a75('0x1cd'),'as':_0x1a75('0x1ce')});db['MailTransferReport'][_0x1a75('0x140')](db[_0x1a75('0x14')],{'foreignKey':_0x1a75('0x1cf'),'as':_0x1a75('0x1d0')});db['MailTransferReport'][_0x1a75('0x140')](db[_0x1a75('0x14')],{'foreignKey':_0x1a75('0x1d1'),'as':_0x1a75('0x1d2')});db[_0x1a75('0xea')][_0x1a75('0x140')](db['MailQueue'],{'foreignKey':_0x1a75('0x1d3'),'as':_0x1a75('0x1d4')});db[_0x1a75('0xea')][_0x1a75('0x140')](db[_0x1a75('0x3a')],{'foreignKey':_0x1a75('0x1d5'),'as':_0x1a75('0x1d6')});db[_0x1a75('0x1d7')]['belongsTo'](db[_0x1a75('0x67')],{});db[_0x1a75('0x1d7')][_0x1a75('0x140')](db[_0x1a75('0x65')],{});db[_0x1a75('0x1d7')][_0x1a75('0x140')](db[_0x1a75('0x62')],{'foreignKey':_0x1a75('0x1d8'),'as':_0x1a75('0x1ce')});db[_0x1a75('0x1d7')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'foreignKey':_0x1a75('0x1cf'),'as':'FromAgent'});db['ChatTransferReport'][_0x1a75('0x140')](db[_0x1a75('0x14')],{'foreignKey':_0x1a75('0x1d1'),'as':_0x1a75('0x1d2')});db[_0x1a75('0x1d7')][_0x1a75('0x140')](db['ChatQueue'],{'foreignKey':_0x1a75('0x1d9'),'as':_0x1a75('0x1d4')});db[_0x1a75('0x1d7')][_0x1a75('0x140')](db['ChatWebsite'],{'foreignKey':_0x1a75('0x1da'),'as':'ToAccount'});db[_0x1a75('0xec')][_0x1a75('0x140')](db[_0x1a75('0x4d')],{});db[_0x1a75('0xec')][_0x1a75('0x140')](db['FaxInteraction'],{});db[_0x1a75('0xec')][_0x1a75('0x140')](db[_0x1a75('0x48')],{'foreignKey':_0x1a75('0x1db'),'as':_0x1a75('0x1ce')});db[_0x1a75('0xec')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'foreignKey':'FromUserId','as':_0x1a75('0x1d0')});db[_0x1a75('0xec')][_0x1a75('0x140')](db['User'],{'foreignKey':_0x1a75('0x1d1'),'as':'ToAgent'});db[_0x1a75('0xec')][_0x1a75('0x140')](db[_0x1a75('0x4e')],{'foreignKey':_0x1a75('0x1dc'),'as':_0x1a75('0x1d4')});db['FaxTransferReport'][_0x1a75('0x140')](db[_0x1a75('0x48')],{'foreignKey':_0x1a75('0x1dd'),'as':_0x1a75('0x1d6')});db['OpenchannelTransferReport']['belongsTo'](db[_0x1a75('0x5f')],{});db[_0x1a75('0x1de')][_0x1a75('0x140')](db[_0x1a75('0x11f')],{});db['OpenchannelTransferReport'][_0x1a75('0x140')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x1a75('0x1ce')});db[_0x1a75('0x1de')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'foreignKey':'FromUserId','as':_0x1a75('0x1d0')});db[_0x1a75('0x1de')][_0x1a75('0x140')](db['User'],{'foreignKey':_0x1a75('0x1d1'),'as':'ToAgent'});db[_0x1a75('0x1de')][_0x1a75('0x140')](db[_0x1a75('0x61')],{'foreignKey':_0x1a75('0x1df'),'as':_0x1a75('0x1d4')});db[_0x1a75('0x1de')][_0x1a75('0x140')](db[_0x1a75('0x5a')],{'foreignKey':_0x1a75('0x1e0'),'as':'ToAccount'});db[_0x1a75('0x1e1')][_0x1a75('0x140')](db[_0x1a75('0x178')],{});db[_0x1a75('0x1e1')][_0x1a75('0x140')](db['SmsInteraction'],{});db[_0x1a75('0x1e1')]['belongsTo'](db[_0x1a75('0x52')],{'foreignKey':'FromSmsAccountId','as':_0x1a75('0x1ce')});db[_0x1a75('0x1e1')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'foreignKey':_0x1a75('0x1cf'),'as':_0x1a75('0x1d0')});db[_0x1a75('0x1e1')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'foreignKey':_0x1a75('0x1d1'),'as':'ToAgent'});db[_0x1a75('0x1e1')][_0x1a75('0x140')](db[_0x1a75('0x58')],{'foreignKey':_0x1a75('0x1e2'),'as':_0x1a75('0x1d4')});db[_0x1a75('0x1e1')][_0x1a75('0x140')](db[_0x1a75('0x52')],{'foreignKey':'ToSmsAccountId','as':_0x1a75('0x1d6')});db[_0x1a75('0x119')]['hasMany'](db[_0x1a75('0x157')],{'as':_0x1a75('0x174'),'foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x119')][_0x1a75('0x105')](db[_0x1a75('0x76')],{'as':_0x1a75('0x1e3'),'foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x119')][_0x1a75('0x105')](db['CmContact'],{'as':_0x1a75('0x18c'),'onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x15a')});db['CmList'][_0x1a75('0x105')](db[_0x1a75('0x72')],{'as':'HopperFinals','foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x119')]['hasMany'](db[_0x1a75('0x13c')],{'as':_0x1a75('0x1e4'),'foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x119')]['hasMany'](db['ReportAgentPreview'],{'as':_0x1a75('0x74'),'foreignKey':'ListId'});db[_0x1a75('0x119')][_0x1a75('0x114')](db[_0x1a75('0x1c')],{'as':'Queues','through':_0x1a75('0x1e5')});db[_0x1a75('0x119')]['belongsToMany'](db[_0x1a75('0x14')],{'as':'Agents','through':'cm_user_has_lists'});db[_0x1a75('0xef')][_0x1a75('0x105')](db[_0x1a75('0x109')],{'as':'Extensions','onDelete':_0x1a75('0x104')});db[_0x1a75('0xef')]['belongsToMany'](db[_0x1a75('0x14')],{'as':_0x1a75('0x15c'),'through':_0x1a75('0x128')});db['UserProfile']['hasMany'](db[_0x1a75('0x14')],{'as':'Users','foreignKey':_0x1a75('0x1e6')});db[_0x1a75('0xf0')][_0x1a75('0x105')](db[_0x1a75('0x1e7')],{'as':'UserProfileSections','foreignKey':_0x1a75('0x1e6'),'onDelete':_0x1a75('0x104')});db[_0x1a75('0x1e7')][_0x1a75('0x105')](db[_0x1a75('0xf3')],{'as':_0x1a75('0x1e8'),'foreignKey':_0x1a75('0x1e9'),'onDelete':'cascade'});db[_0x1a75('0xf7')][_0x1a75('0x105')](db[_0x1a75('0x157')],{'as':_0x1a75('0x174'),'foreignKey':_0x1a75('0x1ea')});db[_0x1a75('0xf7')][_0x1a75('0x105')](db['CannedAnswer'],{'as':_0x1a75('0x176'),'foreignKey':_0x1a75('0x1ea')});db[_0x1a75('0xf7')][_0x1a75('0x105')](db[_0x1a75('0xfb')],{'as':_0x1a75('0x14a'),'foreignKey':_0x1a75('0x1ea')});db[_0x1a75('0xf7')]['hasMany'](db['WhatsappInteraction'],{'as':'Interactions'});db['WhatsappAccount'][_0x1a75('0x105')](db[_0x1a75('0xf8')],{'as':_0x1a75('0x136')});db['WhatsappAccount'][_0x1a75('0x140')](db['CmList'],{'as':_0x1a75('0x159'),'foreignKey':_0x1a75('0x15a')});db[_0x1a75('0xf7')][_0x1a75('0x140')](db[_0x1a75('0x144')],{'as':'mandatoryDispositionPause','foreignKey':_0x1a75('0x146')});db[_0x1a75('0xf7')][_0x1a75('0x114')](db[_0x1a75('0x14')],{'as':_0x1a75('0x15c'),'through':_0x1a75('0x131')});db[_0x1a75('0xf8')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'onDelete':_0x1a75('0x169')});db['WhatsappApplication']['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x1a75('0x169')});db[_0x1a75('0xf8')]['belongsTo'](db[_0x1a75('0xf7')],{'onDelete':_0x1a75('0x169')});db['WhatsappApplication'][_0x1a75('0x140')](db[_0x1a75('0x7f')],{'onDelete':_0x1a75('0x169'),'foreignKey':_0x1a75('0x143')});db[_0x1a75('0xf8')]['belongsTo'](db[_0x1a75('0x88')],{'onDelete':_0x1a75('0x169'),'foreignKey':_0x1a75('0x16a')});db[_0x1a75('0xfa')][_0x1a75('0x105')](db[_0x1a75('0xfb')],{'as':'Messages','onDelete':_0x1a75('0x104'),'foreignKey':_0x1a75('0x1eb')});db['WhatsappInteraction']['belongsTo'](db[_0x1a75('0xf7')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x1ea')});db[_0x1a75('0xfa')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'as':_0x1a75('0x162'),'foreignKey':'ContactId'});db[_0x1a75('0xfa')][_0x1a75('0x140')](db[_0x1a75('0x14')],{'as':'Owner','foreignKey':_0x1a75('0x106')});db[_0x1a75('0xfa')][_0x1a75('0x114')](db['Tag'],{'through':_0x1a75('0x1ec'),'as':_0x1a75('0x164')});db[_0x1a75('0xfa')][_0x1a75('0x114')](db[_0x1a75('0x88')],{'through':'whatsapp_interaction_has_tags','as':_0x1a75('0x166')});db[_0x1a75('0xfa')]['belongsToMany'](db['User'],{'as':'Users','through':_0x1a75('0x1ed'),'foreignKey':_0x1a75('0x1eb')});db[_0x1a75('0xfb')][_0x1a75('0x140')](db['User'],{'as':_0x1a75('0x14')});db[_0x1a75('0xfb')][_0x1a75('0x140')](db[_0x1a75('0x6e')],{'onDelete':_0x1a75('0x104'),'as':_0x1a75('0x162')});db[_0x1a75('0xfb')]['belongsTo'](db[_0x1a75('0xfa')],{'onDelete':_0x1a75('0x104'),'as':'Interaction','foreignKey':_0x1a75('0x1eb')});db[_0x1a75('0xfb')]['belongsTo'](db[_0x1a75('0xf7')],{'as':_0x1a75('0x161'),'foreignKey':_0x1a75('0x1ea')});db[_0x1a75('0x1ee')]['belongsTo'](db[_0x1a75('0xf7')],{});db['WhatsappQueueReport'][_0x1a75('0x140')](db[_0x1a75('0x119')],{'as':_0x1a75('0x159'),'foreignKey':_0x1a75('0x15a')});db[_0x1a75('0x1ee')][_0x1a75('0x140')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x1a75('0x1ee')][_0x1a75('0x140')](db[_0x1a75('0xfa')],{});db[_0x1a75('0x1ee')][_0x1a75('0x140')](db[_0x1a75('0xff')],{});db[_0x1a75('0x1ee')]['belongsTo'](db[_0x1a75('0xfb')],{});db[_0x1a75('0x1ee')][_0x1a75('0x140')](db[_0x1a75('0x14')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x1a75('0xfb')],{});db[_0x1a75('0xfe')][_0x1a75('0x140')](db['WhatsappInteraction'],{});db[_0x1a75('0xfe')][_0x1a75('0x140')](db[_0x1a75('0xf7')],{'foreignKey':_0x1a75('0x1ef'),'as':_0x1a75('0x1ce')});db[_0x1a75('0xfe')][_0x1a75('0x140')](db[_0x1a75('0xf7')],{'foreignKey':_0x1a75('0x1f0'),'as':_0x1a75('0x1d6')});db[_0x1a75('0xfe')][_0x1a75('0x140')](db[_0x1a75('0xff')],{'foreignKey':_0x1a75('0x1f1'),'as':_0x1a75('0x1d4')});db[_0x1a75('0xfe')][_0x1a75('0x140')](db['User'],{'foreignKey':_0x1a75('0x1cf'),'as':_0x1a75('0x1d0')});db[_0x1a75('0xfe')][_0x1a75('0x140')](db['User'],{'foreignKey':'ToUserId','as':_0x1a75('0x1d2')});db[_0x1a75('0xff')][_0x1a75('0x114')](db[_0x1a75('0x14')],{'as':_0x1a75('0x15c'),'through':'UserWhatsappQueue','foreignKey':_0x1a75('0x1f2')});db[_0x1a75('0xff')][_0x1a75('0x114')](db[_0x1a75('0xe0')],{'through':_0x1a75('0x1c8'),'as':_0x1a75('0x147')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xab3f=['FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','Interactions','user_has_sms_accounts','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelQueueId','ChatWebsiteId','ProactiveActions','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','cm_contact_has_tags','Agent','Queue','Campaign','CampaignId','OwnerId','CmHopperBlack','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','Subject','Description','Variable','SubjectId','Field','DeskConfiguration','int_desk_configuration_has_tags','VariableId','ZendeskField','int_zendesk_configuration_has_tags','VtigerAccount','Dynamics365Configuration','SessionId','SmsQueueReport','ProjectId','team_has_voice_queues','team_has_mail_queues','FaxQueues','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToQueue','ToAccount','FromChatWebsiteId','ToAgent','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','team_has_whatsapp_queues','exports','path','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','mysql','password','options','username','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','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/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.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','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareProject/squareProject.model','SquareRecording','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','cascade','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteractions','Notifications','SenderId','belongsTo','userProfileId','ChatGroup','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','FaxInteractions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','UserChatQueue','FaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperFinal','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','Imap','Dispositions','Answers','List','ListId','TemplateId','Agents','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','restrict','Interval','TagId','Items','Disposition','FaxAccountId'];(function(_0x16dbb2,_0x4be2bf){var _0x3b58ed=function(_0x296fe7){while(--_0x296fe7){_0x16dbb2['push'](_0x16dbb2['shift']());}};_0x3b58ed(++_0x4be2bf);}(_0xab3f,0x72));var _0xfab3=function(_0xf97a4,_0x65e8c6){_0xf97a4=_0xf97a4-0x0;var _0x2bef0a=_0xab3f[_0xf97a4];return _0x2bef0a;};'use strict';var path=require(_0xfab3('0x0'));var config=require('../config/environment');var Sequelize=require(_0xfab3('0x1'));var _=require(_0xfab3('0x2'));var jstz=require(_0xfab3('0x3'));var timezone=jstz[_0xfab3('0x4')]();config[_0xfab3('0x1')]=_[_0xfab3('0x5')](config[_0xfab3('0x1')],{'database':_0xfab3('0x6'),'username':_0xfab3('0x7'),'password':_0xfab3('0x8'),'options':{'host':_0xfab3('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xfab3('0xa')},'logging':![],'timezone':timezone[_0xfab3('0xb')](),'define':{'charset':_0xfab3('0xc'),'collate':_0xfab3('0xd')}}});config[_0xfab3('0xe')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0xfab3('0x6'),'username':'xcall','password':_0xfab3('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xfab3('0xf'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xfab3('0xb')](),'define':{'charset':_0xfab3('0xc'),'collate':_0xfab3('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfab3('0x1')]['database'],config['sequelize']['username'],config[_0xfab3('0x1')][_0xfab3('0x10')],config[_0xfab3('0x1')][_0xfab3('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0xfab3('0xe')][_0xfab3('0x12')],config[_0xfab3('0xe')][_0xfab3('0x10')],config[_0xfab3('0xe')][_0xfab3('0x11')])};db[_0xfab3('0x13')]=db[_0xfab3('0x1')]['import']('../api/user/user.model');db[_0xfab3('0x14')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x16'));db[_0xfab3('0x17')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x18'));db[_0xfab3('0x19')]=db['sequelize']['import'](_0xfab3('0x1a'));db[_0xfab3('0x1b')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x1c'));db[_0xfab3('0x1d')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x1e'));db['VoiceRecording']=db['sequelize']['import'](_0xfab3('0x1f'));db[_0xfab3('0x20')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/screenRecording/screenRecording.model');db[_0xfab3('0x21')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x22'));db[_0xfab3('0x23')]=db['sequelize']['import'](_0xfab3('0x24'));db[_0xfab3('0x25')]=db['sequelize']['import'](_0xfab3('0x26'));db[_0xfab3('0x27')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x28'));db[_0xfab3('0x29')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xfab3('0x2a')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x2b'));db[_0xfab3('0x2c')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/memberReport/memberReport.model');db[_0xfab3('0x2d')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x2e'));db[_0xfab3('0x2f')]=db['sequelize'][_0xfab3('0x15')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xfab3('0x30')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x31'));db[_0xfab3('0x32')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x33'));db['UserChatQueue']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x34'));db[_0xfab3('0x35')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x36'));db[_0xfab3('0x37')]=db[_0xfab3('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xfab3('0x38')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x39'));db[_0xfab3('0x3a')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x3b'));db['UserWhatsappQueue']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x3c'));db['MailServerIn']=db['sequelize']['import']('../api/mailServerIn/mailServerIn.model');db[_0xfab3('0x3d')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x3e'));db[_0xfab3('0x3f')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x40'));db[_0xfab3('0x41')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x42'));db[_0xfab3('0x43')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x44'));db[_0xfab3('0x45')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x46'));db[_0xfab3('0x47')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x48'));db[_0xfab3('0x49')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x4a'));db[_0xfab3('0x4b')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x4c'));db[_0xfab3('0x4d')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0x4e'));db[_0xfab3('0x4f')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x50'));db[_0xfab3('0x51')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x52'));db[_0xfab3('0x53')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0x54'));db['FaxInteraction']=db['sequelize']['import']('../api/faxInteraction/faxInteraction.model');db[_0xfab3('0x55')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x56'));db['FaxQueue']=db['sequelize'][_0xfab3('0x15')](_0xfab3('0x57'));db[_0xfab3('0x58')]=db['sequelize']['import'](_0xfab3('0x59'));db[_0xfab3('0x5a')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x5b'));db[_0xfab3('0x5c')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x5d'));db[_0xfab3('0x5e')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0xfab3('0x5f')]=db['sequelize'][_0xfab3('0x15')]('../api/smsMessage/smsMessage.model');db[_0xfab3('0x60')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x61'));db[_0xfab3('0x62')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x63'));db['OpenchannelApplication']=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db[_0xfab3('0x64')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x65'));db[_0xfab3('0x66')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x67'));db[_0xfab3('0x68')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x69'));db['ChatWebsite']=db[_0xfab3('0x1')]['import'](_0xfab3('0x6a'));db[_0xfab3('0x6b')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x6c'));db[_0xfab3('0x6d')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0x6e'));db[_0xfab3('0x6f')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/chatInteraction/chatInteraction.model');db[_0xfab3('0x70')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0x71'));db[_0xfab3('0x72')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x73'));db['ChatQueue']=db['sequelize'][_0xfab3('0x15')](_0xfab3('0x74'));db['ChatGroup']=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/chatGroup/chatGroup.model');db[_0xfab3('0x75')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x76'));db[_0xfab3('0x77')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x78'));db[_0xfab3('0x79')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0x7a'));db[_0xfab3('0x7b')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x7c'));db['CmHopperFinal']=db[_0xfab3('0x1')]['import'](_0xfab3('0x7d'));db[_0xfab3('0x7e')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x7f'));db[_0xfab3('0x80')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x81'));db[_0xfab3('0x82')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0xfab3('0x83')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x84'));db[_0xfab3('0x85')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x86'));db[_0xfab3('0x87')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x88'));db['Disposition']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x89'));db[_0xfab3('0x8a')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x8b'));db['Interval']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x8c'));db[_0xfab3('0x8d')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x8e'));db[_0xfab3('0x8f')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x90'));db[_0xfab3('0x91')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x92'));db[_0xfab3('0x93')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/schedule/schedule.model');db['Sound']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x94'));db[_0xfab3('0x95')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0x96'));db[_0xfab3('0x97')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0x98'));db[_0xfab3('0x99')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x9a'));db['Variable']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x9b'));db[_0xfab3('0x9c')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x9d'));db[_0xfab3('0x9e')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x9f'));db['AnalyticCustomReport']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xa0'));db[_0xfab3('0xa1')]=db[_0xfab3('0x1')]['import'](_0xfab3('0xa2'));db['AnalyticExtractedReport']=db[_0xfab3('0x1')]['import'](_0xfab3('0xa3'));db[_0xfab3('0xa4')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0xa5'));db[_0xfab3('0xa6')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xa7'));db[_0xfab3('0xa8')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xfab3('0xa9')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xaa'));db['SalesforceField']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xab'));db[_0xfab3('0xac')]=db[_0xfab3('0x1')]['import'](_0xfab3('0xad'));db[_0xfab3('0xae')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xaf'));db[_0xfab3('0xb0')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xb1'));db[_0xfab3('0xb2')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xb3'));db['DeskConfiguration']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xb4'));db[_0xfab3('0xb5')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/intDeskField/intDeskField.model');db[_0xfab3('0xb6')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/intZohoAccount/intZohoAccount.model');db[_0xfab3('0xb7')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0xb8'));db[_0xfab3('0xb9')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xba'));db[_0xfab3('0xbb')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0xbc'));db[_0xfab3('0xbd')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xbe'));db['ZendeskField']=db[_0xfab3('0x1')]['import']('../api/intZendeskField/intZendeskField.model');db[_0xfab3('0xbf')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xfab3('0xc0')]=db[_0xfab3('0x1')]['import'](_0xfab3('0xc1'));db[_0xfab3('0xc2')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xc3'));db['VtigerAccount']=db[_0xfab3('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xfab3('0xc4')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xc5'));db[_0xfab3('0xc6')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0xc7'));db[_0xfab3('0xc8')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xc9'));db[_0xfab3('0xca')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xcb'));db[_0xfab3('0xcc')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xcd'));db[_0xfab3('0xce')]=db[_0xfab3('0x1')]['import'](_0xfab3('0xcf'));db['Dynamics365Configuration']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xd0'));db[_0xfab3('0xd1')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xd2'));db[_0xfab3('0xd3')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xd4'));db[_0xfab3('0xd5')]=db[_0xfab3('0x1')]['import'](_0xfab3('0xd6'));db[_0xfab3('0xd7')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xd8'));db[_0xfab3('0x9c')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x9d'));db[_0xfab3('0xd9')]=db['sequelize']['import'](_0xfab3('0xda'));db[_0xfab3('0xdb')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xdc'));db[_0xfab3('0xdd')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xde'));db[_0xfab3('0xdf')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xe0'));db[_0xfab3('0xe1')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xe2'));db[_0xfab3('0xe3')]=db['sequelize'][_0xfab3('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xe4'));db[_0xfab3('0xe5')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0xe6'));db[_0xfab3('0xe7')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/squareReportDetail/squareReportDetail.model');db[_0xfab3('0xe8')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0xe9'));db['Setting']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xea'));db[_0xfab3('0xeb')]=db[_0xfab3('0x1')]['import']('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xec'));db[_0xfab3('0xed')]=db['sequelize'][_0xfab3('0x15')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/squareMessage/squareMessage.model');db[_0xfab3('0xee')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0xef'));db[_0xfab3('0xf0')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xf1'));db['Campaign']=db[_0xfab3('0x1')]['import'](_0xfab3('0xf2'));db[_0xfab3('0xf3')]=db[_0xfab3('0x1')]['import'](_0xfab3('0xf4'));db[_0xfab3('0xf5')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/attachment/attachment.model');db[_0xfab3('0xf6')]=db[_0xfab3('0x1')]['import'](_0xfab3('0xf7'));db[_0xfab3('0xf8')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xf9'));db[_0xfab3('0xfa')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xfb'));db[_0xfab3('0xfc')]=db[_0xfab3('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xfab3('0xfd')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0xfe'));db[_0xfab3('0xff')]=db['sequelize'][_0xfab3('0x15')]('../api/smsTransferReport/smsTransferReport.model');db[_0xfab3('0x100')]=db['sequelize'][_0xfab3('0x15')](_0xfab3('0x101'));db[_0xfab3('0x102')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x103'));db[_0xfab3('0x104')]=db['sequelize']['import']('../api/userProfile/userProfile.model');db[_0xfab3('0x105')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x106'));db[_0xfab3('0x107')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x108'));db[_0xfab3('0x109')]=db['sequelize']['import'](_0xfab3('0x10a'));db[_0xfab3('0x10b')]=db[_0xfab3('0x1')][_0xfab3('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0xfab3('0x10c')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x10d'));db[_0xfab3('0x10e')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x10f'));db[_0xfab3('0x110')]=db[_0xfab3('0x1')]['import'](_0xfab3('0x111'));db[_0xfab3('0x112')]=db[_0xfab3('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xfab3('0x113')]=db[_0xfab3('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xfab3('0x114')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x115'));db[_0xfab3('0x116')]=db[_0xfab3('0x1')][_0xfab3('0x15')](_0xfab3('0x117'));db[_0xfab3('0x13')][_0xfab3('0x118')](db['VoiceMail'],{'as':_0xfab3('0x21'),'onDelete':'cascade','foreignKey':_0xfab3('0x119')});db[_0xfab3('0x13')][_0xfab3('0x11a')](db[_0xfab3('0x11b')],{'as':_0xfab3('0x11c'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x13')]['hasMany'](db[_0xfab3('0x30')],{'as':_0xfab3('0x11d'),'foreignKey':'UserId'});db[_0xfab3('0x13')][_0xfab3('0x11a')](db[_0xfab3('0x19')],{'as':_0xfab3('0x11e'),'onDelete':_0xfab3('0x11f'),'hooks':!![]});db['User'][_0xfab3('0x11a')](db['CmHopperFinal'],{'as':_0xfab3('0x120'),'foreignKey':'UserId'});db[_0xfab3('0x13')][_0xfab3('0x11a')](db[_0xfab3('0x7e')],{'as':_0xfab3('0x121'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x13')][_0xfab3('0x11a')](db[_0xfab3('0x80')],{'as':'ReportAgentPreview','foreignKey':_0xfab3('0x119')});db[_0xfab3('0x13')]['hasMany'](db[_0xfab3('0x64')],{'as':_0xfab3('0x122'),'foreignKey':'UserId'});db['User'][_0xfab3('0x11a')](db[_0xfab3('0x6f')],{'as':_0xfab3('0x123'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x13')]['hasMany'](db['SmsInteraction'],{'as':_0xfab3('0x124'),'foreignKey':_0xfab3('0x119')});db['User'][_0xfab3('0x11a')](db[_0xfab3('0x125')],{'as':'FaxInteractions','foreignKey':_0xfab3('0x119')});db[_0xfab3('0x13')]['hasMany'](db['MailInteraction'],{'as':_0xfab3('0x126'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x13')][_0xfab3('0x11a')](db[_0xfab3('0x10e')],{'as':'WhatsappInteractions','foreignKey':_0xfab3('0x119')});db[_0xfab3('0x13')][_0xfab3('0x11a')](db[_0xfab3('0x109')],{'as':_0xfab3('0x127'),'foreignKey':_0xfab3('0x128')});db[_0xfab3('0x13')][_0xfab3('0x129')](db[_0xfab3('0x104')],{'as':_0xfab3('0x104'),'foreignKey':_0xfab3('0x12a')});db['User']['belongsToMany'](db[_0xfab3('0x12b')],{'as':_0xfab3('0x12c'),'through':_0xfab3('0x12d')});db['User'][_0xfab3('0x12e')](db['CmContact'],{'as':'Contacts','through':_0xfab3('0x12f')});db['User']['belongsToMany'](db[_0xfab3('0x100')],{'as':_0xfab3('0x130'),'through':_0xfab3('0x131')});db['User'][_0xfab3('0x12e')](db[_0xfab3('0xee')],{'through':_0xfab3('0x132')});db[_0xfab3('0x13')][_0xfab3('0x12e')](db['MailInteraction'],{'as':_0xfab3('0x126'),'through':'user_has_mail_interactions'});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x6f')],{'as':_0xfab3('0x123'),'through':_0xfab3('0x133')});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x125')],{'as':_0xfab3('0x134'),'through':'user_has_fax_interactions'});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x5e')],{'as':_0xfab3('0x124'),'through':_0xfab3('0x135')});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x64')],{'as':_0xfab3('0x122'),'through':_0xfab3('0x136')});db[_0xfab3('0x13')][_0xfab3('0x12e')](db['WhatsappInteraction'],{'as':_0xfab3('0x137'),'through':_0xfab3('0x138')});db[_0xfab3('0x13')]['belongsToMany'](db[_0xfab3('0x1d')],{'as':_0xfab3('0x139'),'through':_0xfab3('0x32'),'required':![]});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x41')],{'as':_0xfab3('0x13a'),'through':_0xfab3('0x35'),'required':![]});db[_0xfab3('0x13')]['belongsToMany'](db[_0xfab3('0x13b')],{'as':_0xfab3('0x13c'),'through':_0xfab3('0x13d'),'required':![],'hooks':!![]});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x13e')],{'as':'FaxQueues','through':_0xfab3('0x37'),'required':![]});db['User'][_0xfab3('0x12e')](db[_0xfab3('0x60')],{'as':_0xfab3('0x13f'),'through':'UserSmsQueue','required':![]});db[_0xfab3('0x13')][_0xfab3('0x12e')](db['OpenchannelQueue'],{'as':_0xfab3('0x140'),'through':'UserOpenchannelQueue','required':![]});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x114')],{'as':_0xfab3('0x141'),'through':_0xfab3('0x142'),'required':![]});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x100')],{'through':_0xfab3('0x131')});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x102')],{'as':_0xfab3('0x143'),'through':_0xfab3('0x144'),'required':![]});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x145')],{'as':'ChatWebsites','through':_0xfab3('0x146')});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x51')],{'as':_0xfab3('0x147'),'through':_0xfab3('0x148')});db[_0xfab3('0x13')][_0xfab3('0x12e')](db['MailAccount'],{'as':_0xfab3('0x149'),'through':_0xfab3('0x14a')});db[_0xfab3('0x13')][_0xfab3('0x12e')](db['OpenchannelAccount'],{'as':_0xfab3('0x14b'),'through':_0xfab3('0x14c')});db['User'][_0xfab3('0x12e')](db[_0xfab3('0x5a')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0xfab3('0x13')][_0xfab3('0x12e')](db['WhatsappAccount'],{'as':_0xfab3('0x14d'),'through':_0xfab3('0x14e')});db[_0xfab3('0x13')][_0xfab3('0x12e')](db[_0xfab3('0x14f')],{'as':_0xfab3('0x150'),'through':_0xfab3('0x151')});db['VoiceChanSpy']['hasMany'](db['VoiceExtension'],{'as':_0xfab3('0x152'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x153')});db['VoiceContext'][_0xfab3('0x11a')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0xfab3('0x19')][_0xfab3('0x11a')](db[_0xfab3('0x19')],{'as':_0xfab3('0x154'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0xfab3('0x12e')](db['Sound'],{'as':_0xfab3('0x155'),'through':_0xfab3('0x156')});db['VoiceQueue'][_0xfab3('0x11a')](db[_0xfab3('0x30')],{'as':_0xfab3('0x157'),'foreignKey':_0xfab3('0x158')});db[_0xfab3('0x1d')][_0xfab3('0x11a')](db[_0xfab3('0x7b')],{'as':_0xfab3('0x159'),'foreignKey':_0xfab3('0x158')});db[_0xfab3('0x1d')][_0xfab3('0x11a')](db[_0xfab3('0x15a')],{'as':_0xfab3('0x120'),'foreignKey':_0xfab3('0x158')});db[_0xfab3('0x1d')][_0xfab3('0x11a')](db['CmHopperHistory'],{'as':_0xfab3('0x15b'),'foreignKey':_0xfab3('0x158')});db[_0xfab3('0x1d')][_0xfab3('0x11a')](db[_0xfab3('0x80')],{'as':_0xfab3('0x80'),'foreignKey':_0xfab3('0x158')});db['VoiceQueue'][_0xfab3('0x11a')](db['CmHopperBlack'],{'as':_0xfab3('0x15c'),'foreignKey':'VoiceQueueId'});db[_0xfab3('0x1d')][_0xfab3('0x11a')](db['JscriptySessionReport'],{'as':_0xfab3('0x15d'),'foreignKey':_0xfab3('0x158')});db[_0xfab3('0x1d')][_0xfab3('0x129')](db[_0xfab3('0x2d')],{'as':_0xfab3('0x2d'),'foreignKey':_0xfab3('0x15e')});db[_0xfab3('0x1d')][_0xfab3('0x129')](db[_0xfab3('0x2d')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xfab3('0x1d')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0xfab3('0x15f')});db[_0xfab3('0x1d')][_0xfab3('0x129')](db[_0xfab3('0x8d')],{'as':_0xfab3('0x160'),'foreignKey':_0xfab3('0x161')});db[_0xfab3('0x1d')][_0xfab3('0x12e')](db[_0xfab3('0x100')],{'as':_0xfab3('0x130'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':'Agents','through':_0xfab3('0x32')});db[_0xfab3('0x1d')][_0xfab3('0x12e')](db[_0xfab3('0xee')],{'as':_0xfab3('0x162'),'through':'team_has_voice_queues'});db[_0xfab3('0x1d')][_0xfab3('0x12e')](db['CmList'],{'as':_0xfab3('0x163'),'through':_0xfab3('0x164')});db[_0xfab3('0x11b')]['belongsTo'](db[_0xfab3('0x13')],{'as':_0xfab3('0x13'),'foreignKey':'UserId'});db['ScreenRecording'][_0xfab3('0x129')](db['User'],{'as':_0xfab3('0x13'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x21')][_0xfab3('0x11a')](db['VoiceMailMessage'],{'as':_0xfab3('0x165'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x166'),'sourceKey':_0xfab3('0x167')});db[_0xfab3('0x23')][_0xfab3('0x129')](db['VoiceMail'],{'foreignKey':_0xfab3('0x166'),'targetKey':'mailbox'});db['VoiceCallReport'][_0xfab3('0x11a')](db['VoiceQueueReport'],{'as':_0xfab3('0x168'),'foreignKey':_0xfab3('0x169'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0xfab3('0x29')],{'as':_0xfab3('0x16a'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0xfab3('0x13')],{'as':_0xfab3('0x13'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x25')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'as':_0xfab3('0x16b'),'foreignKey':_0xfab3('0x16c')});db[_0xfab3('0x16d')][_0xfab3('0x129')](db[_0xfab3('0x3f')],{'as':_0xfab3('0x3f'),'foreignKey':_0xfab3('0x16e')});db['MailServerOut']['belongsTo'](db[_0xfab3('0x3f')],{'as':_0xfab3('0x3f'),'foreignKey':_0xfab3('0x16e')});db[_0xfab3('0x3f')]['hasOne'](db['MailServerIn'],{'as':_0xfab3('0x16f'),'onDelete':_0xfab3('0x11f')});db[_0xfab3('0x3f')][_0xfab3('0x118')](db[_0xfab3('0x3d')],{'as':'Smtp','onDelete':_0xfab3('0x11f')});db[_0xfab3('0x3f')][_0xfab3('0x11a')](db['Disposition'],{'as':_0xfab3('0x170'),'foreignKey':'MailAccountId'});db[_0xfab3('0x3f')][_0xfab3('0x11a')](db['CannedAnswer'],{'as':_0xfab3('0x171'),'foreignKey':_0xfab3('0x16e')});db[_0xfab3('0x3f')][_0xfab3('0x11a')](db['MailMessage'],{'as':_0xfab3('0x165'),'foreignKey':_0xfab3('0x16e')});db[_0xfab3('0x3f')][_0xfab3('0x11a')](db[_0xfab3('0x45')],{'as':'Interactions'});db['MailAccount'][_0xfab3('0x11a')](db[_0xfab3('0x49')],{'as':'Applications'});db['MailAccount'][_0xfab3('0x129')](db['CmList'],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0x3f')][_0xfab3('0x129')](db['Template'],{'as':_0xfab3('0x97'),'foreignKey':_0xfab3('0x174')});db[_0xfab3('0x3f')][_0xfab3('0x129')](db[_0xfab3('0x8d')],{'as':_0xfab3('0x160'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x175'),'through':_0xfab3('0x14a')});db[_0xfab3('0x41')][_0xfab3('0x12e')](db['User'],{'as':_0xfab3('0x175'),'through':_0xfab3('0x35')});db[_0xfab3('0x41')][_0xfab3('0x12e')](db[_0xfab3('0xee')],{'through':'team_has_mail_queues','as':_0xfab3('0x162')});db['MailInteraction']['hasMany'](db[_0xfab3('0x47')],{'as':_0xfab3('0x165'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x176')});db['MailInteraction'][_0xfab3('0x129')](db[_0xfab3('0x3f')],{'as':_0xfab3('0x177'),'foreignKey':'MailAccountId'});db[_0xfab3('0x45')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'as':'Contact','foreignKey':_0xfab3('0x16c')});db[_0xfab3('0x45')]['belongsTo'](db[_0xfab3('0x13')],{'as':_0xfab3('0x178'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x45')]['belongsToMany'](db[_0xfab3('0x95')],{'through':_0xfab3('0x179'),'as':_0xfab3('0x17a')});db[_0xfab3('0x45')]['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xfab3('0x17b')});db[_0xfab3('0x45')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x17c'),'through':_0xfab3('0x17d'),'foreignKey':_0xfab3('0x176')});db[_0xfab3('0x47')][_0xfab3('0x11a')](db['Attachment'],{'as':_0xfab3('0x17e'),'onDelete':_0xfab3('0x11f')});db[_0xfab3('0x47')]['belongsTo'](db[_0xfab3('0x13')],{'as':_0xfab3('0x13')});db[_0xfab3('0x47')][_0xfab3('0x129')](db['CmContact'],{'onDelete':_0xfab3('0x11f'),'as':_0xfab3('0x16b')});db[_0xfab3('0x47')][_0xfab3('0x129')](db[_0xfab3('0x45')],{'as':'Interaction','foreignKey':_0xfab3('0x176')});db[_0xfab3('0x47')][_0xfab3('0x129')](db[_0xfab3('0x3f')],{'as':_0xfab3('0x177'),'foreignKey':_0xfab3('0x16e')});db[_0xfab3('0x49')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'onDelete':'restrict'});db[_0xfab3('0x49')][_0xfab3('0x129')](db[_0xfab3('0x41')],{'onDelete':_0xfab3('0x17f')});db['MailApplication'][_0xfab3('0x129')](db[_0xfab3('0x3f')],{'onDelete':_0xfab3('0x17f')});db[_0xfab3('0x49')][_0xfab3('0x129')](db[_0xfab3('0x180')],{'onDelete':_0xfab3('0x17f'),'foreignKey':_0xfab3('0x15f')});db[_0xfab3('0x49')][_0xfab3('0x129')](db[_0xfab3('0x95')],{'onDelete':_0xfab3('0x17f'),'foreignKey':_0xfab3('0x181')});db['MailQueueReport'][_0xfab3('0x129')](db[_0xfab3('0x3f')],{});db['MailQueueReport'][_0xfab3('0x129')](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0x4b')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'as':_0xfab3('0x16b'),'foreignKey':_0xfab3('0x16c')});db[_0xfab3('0x4b')][_0xfab3('0x129')](db['MailInteraction'],{});db[_0xfab3('0x4b')][_0xfab3('0x129')](db[_0xfab3('0x47')],{});db[_0xfab3('0x4b')][_0xfab3('0x129')](db[_0xfab3('0x13')],{});db[_0xfab3('0x4b')][_0xfab3('0x129')](db['MailQueue'],{});db[_0xfab3('0x4d')]['hasMany'](db[_0xfab3('0x4f')],{'as':_0xfab3('0x182'),'onDelete':_0xfab3('0x11f')});db[_0xfab3('0x51')][_0xfab3('0x11a')](db[_0xfab3('0x183')],{'as':_0xfab3('0x170'),'foreignKey':_0xfab3('0x184')});db[_0xfab3('0x51')][_0xfab3('0x11a')](db['CannedAnswer'],{'as':_0xfab3('0x171'),'foreignKey':_0xfab3('0x184')});db[_0xfab3('0x51')]['hasMany'](db[_0xfab3('0x125')],{'as':'Interactions'});db[_0xfab3('0x51')][_0xfab3('0x11a')](db[_0xfab3('0x53')],{'as':_0xfab3('0x154')});db[_0xfab3('0x51')]['hasMany'](db[_0xfab3('0x19')],{'as':'Exntensions','onDelete':_0xfab3('0x11f')});db['FaxAccount']['hasMany'](db[_0xfab3('0x55')],{'as':_0xfab3('0x165')});db['FaxAccount'][_0xfab3('0x129')](db[_0xfab3('0x2d')],{'as':_0xfab3('0x2d')});db[_0xfab3('0x51')][_0xfab3('0x129')](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0x51')]['belongsTo'](db['Pause'],{'as':_0xfab3('0x160'),'foreignKey':_0xfab3('0x161')});db[_0xfab3('0x51')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x175'),'through':_0xfab3('0x148')});db[_0xfab3('0x53')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db['FaxQueue'],{'onDelete':_0xfab3('0x17f')});db['FaxApplication'][_0xfab3('0x129')](db[_0xfab3('0x51')],{'onDelete':'restrict'});db['FaxApplication'][_0xfab3('0x129')](db[_0xfab3('0x95')],{'onDelete':_0xfab3('0x17f'),'foreignKey':_0xfab3('0x181')});db['FaxInteraction']['hasMany'](db[_0xfab3('0x55')],{'as':'Messages','onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x185')});db[_0xfab3('0x125')]['belongsTo'](db[_0xfab3('0x51')],{'as':_0xfab3('0x177'),'foreignKey':_0xfab3('0x184')});db[_0xfab3('0x125')][_0xfab3('0x129')](db['CmContact'],{'as':_0xfab3('0x16b'),'foreignKey':_0xfab3('0x16c')});db[_0xfab3('0x125')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'as':_0xfab3('0x178'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x125')][_0xfab3('0x12e')](db[_0xfab3('0x95')],{'through':_0xfab3('0x186'),'as':_0xfab3('0x17a')});db['FaxInteraction']['belongsToMany'](db[_0xfab3('0x95')],{'through':_0xfab3('0x186'),'as':_0xfab3('0x17b')});db[_0xfab3('0x125')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x17c'),'through':_0xfab3('0x187'),'foreignKey':'FaxInteractionId'});db[_0xfab3('0x55')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'onDelete':_0xfab3('0x11f'),'as':_0xfab3('0x13')});db[_0xfab3('0x55')][_0xfab3('0x129')](db['FaxInteraction'],{'as':_0xfab3('0x188'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0xfab3('0x129')](db[_0xfab3('0x79')],{'onDelete':_0xfab3('0x11f'),'as':_0xfab3('0x16b')});db[_0xfab3('0x55')][_0xfab3('0x129')](db[_0xfab3('0xf5')],{'as':_0xfab3('0xf5'),'foreignKey':_0xfab3('0x189')});db[_0xfab3('0x55')][_0xfab3('0x129')](db[_0xfab3('0x51')],{'as':_0xfab3('0x177'),'foreignKey':_0xfab3('0x184')});db[_0xfab3('0x13e')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':'Agents','through':'UserFaxQueue'});db[_0xfab3('0x13e')][_0xfab3('0x12e')](db[_0xfab3('0xee')],{'through':_0xfab3('0x18a'),'as':_0xfab3('0x162')});db[_0xfab3('0x58')]['belongsTo'](db[_0xfab3('0x51')],{});db[_0xfab3('0x58')][_0xfab3('0x129')](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0x58')]['belongsTo'](db[_0xfab3('0x79')],{'as':_0xfab3('0x16b'),'foreignKey':'ContactId'});db['FaxQueueReport']['belongsTo'](db[_0xfab3('0x125')],{});db[_0xfab3('0x58')]['belongsTo'](db['FaxMessage'],{});db[_0xfab3('0x58')][_0xfab3('0x129')](db[_0xfab3('0x13')],{});db['FaxQueueReport'][_0xfab3('0x129')](db[_0xfab3('0x13e')],{});db['SmsAccount']['hasMany'](db[_0xfab3('0x183')],{'as':_0xfab3('0x170'),'foreignKey':_0xfab3('0x18b')});db['SmsAccount'][_0xfab3('0x11a')](db[_0xfab3('0x87')],{'as':'Answers','foreignKey':_0xfab3('0x18b')});db[_0xfab3('0x5a')]['hasMany'](db[_0xfab3('0x5f')],{'as':'Messages','foreignKey':_0xfab3('0x18b')});db['SmsAccount'][_0xfab3('0x11a')](db[_0xfab3('0x5e')],{'as':_0xfab3('0x18c')});db['SmsAccount'][_0xfab3('0x11a')](db[_0xfab3('0x5c')],{'as':'Applications'});db[_0xfab3('0x5a')][_0xfab3('0x129')](db['CmList'],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173')});db['SmsAccount'][_0xfab3('0x129')](db[_0xfab3('0x8d')],{'as':_0xfab3('0x160'),'foreignKey':_0xfab3('0x161')});db[_0xfab3('0x5a')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':'Agents','through':_0xfab3('0x18d')});db[_0xfab3('0x5c')][_0xfab3('0x129')](db['User'],{'onDelete':_0xfab3('0x17f')});db[_0xfab3('0x5c')]['belongsTo'](db['SmsQueue'],{'onDelete':'restrict'});db['SmsApplication'][_0xfab3('0x129')](db[_0xfab3('0x5a')],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db[_0xfab3('0x180')],{'onDelete':_0xfab3('0x17f'),'foreignKey':_0xfab3('0x15f')});db[_0xfab3('0x5c')]['belongsTo'](db[_0xfab3('0x95')],{'onDelete':'restrict','foreignKey':_0xfab3('0x181')});db['SmsInteraction'][_0xfab3('0x11a')](db[_0xfab3('0x5f')],{'as':_0xfab3('0x165'),'onDelete':_0xfab3('0x11f'),'foreignKey':'SmsInteractionId'});db[_0xfab3('0x5e')][_0xfab3('0x129')](db[_0xfab3('0x5a')],{'as':_0xfab3('0x177'),'foreignKey':_0xfab3('0x18b')});db['SmsInteraction'][_0xfab3('0x129')](db['CmContact'],{'as':_0xfab3('0x16b'),'foreignKey':_0xfab3('0x16c')});db[_0xfab3('0x5e')][_0xfab3('0x129')](db['User'],{'as':_0xfab3('0x178'),'foreignKey':_0xfab3('0x119')});db['SmsInteraction'][_0xfab3('0x12e')](db[_0xfab3('0x95')],{'through':_0xfab3('0x18e'),'as':'Tags'});db[_0xfab3('0x5e')][_0xfab3('0x12e')](db[_0xfab3('0x95')],{'through':_0xfab3('0x18e'),'as':_0xfab3('0x17b')});db['SmsInteraction']['belongsToMany'](db[_0xfab3('0x13')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0xfab3('0x18f')});db[_0xfab3('0x5f')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'as':_0xfab3('0x13')});db['SmsMessage'][_0xfab3('0x129')](db[_0xfab3('0x79')],{'onDelete':_0xfab3('0x11f'),'as':_0xfab3('0x16b')});db['SmsMessage'][_0xfab3('0x129')](db[_0xfab3('0x5e')],{'onDelete':_0xfab3('0x11f'),'as':_0xfab3('0x188'),'foreignKey':_0xfab3('0x18f')});db['SmsMessage'][_0xfab3('0x129')](db[_0xfab3('0x5a')],{'as':'Account','foreignKey':_0xfab3('0x18b')});db['SmsQueue']['belongsToMany'](db['User'],{'as':_0xfab3('0x175'),'through':_0xfab3('0x38'),'foreignKey':'SmsQueueId'});db['SmsQueue'][_0xfab3('0x12e')](db[_0xfab3('0xee')],{'through':_0xfab3('0x190'),'as':_0xfab3('0x162')});db[_0xfab3('0x62')][_0xfab3('0x11a')](db[_0xfab3('0x183')],{'as':_0xfab3('0x170'),'foreignKey':_0xfab3('0x191')});db['OpenchannelAccount'][_0xfab3('0x11a')](db[_0xfab3('0x87')],{'as':_0xfab3('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0xfab3('0x62')][_0xfab3('0x11a')](db[_0xfab3('0x64')],{'as':_0xfab3('0x18c'),'foreignKey':_0xfab3('0x191')});db['OpenchannelAccount'][_0xfab3('0x11a')](db['OpenchannelMessage'],{'as':_0xfab3('0x165'),'foreignKey':'OpenchannelAccountId'});db[_0xfab3('0x62')][_0xfab3('0x11a')](db[_0xfab3('0x192')],{'as':_0xfab3('0x154'),'foreignKey':'OpenchannelAccountId'});db[_0xfab3('0x62')][_0xfab3('0x129')](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0x62')]['belongsTo'](db[_0xfab3('0x8d')],{'as':_0xfab3('0x160'),'foreignKey':_0xfab3('0x161')});db[_0xfab3('0x62')][_0xfab3('0x12e')](db['User'],{'as':'Agents','through':_0xfab3('0x14c')});db[_0xfab3('0x192')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'onDelete':_0xfab3('0x17f')});db['OpenchannelApplication'][_0xfab3('0x129')](db[_0xfab3('0x68')],{'onDelete':_0xfab3('0x17f'),'foreignKey':'OpenchannelQueueId'});db[_0xfab3('0x192')][_0xfab3('0x129')](db[_0xfab3('0x62')],{'onDelete':_0xfab3('0x17f'),'foreignKey':_0xfab3('0x191')});db['OpenchannelApplication'][_0xfab3('0x129')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xfab3('0x192')][_0xfab3('0x129')](db[_0xfab3('0x95')],{'onDelete':_0xfab3('0x17f'),'foreignKey':_0xfab3('0x181')});db[_0xfab3('0x64')][_0xfab3('0x11a')](db[_0xfab3('0x66')],{'as':_0xfab3('0x165'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xfab3('0x64')][_0xfab3('0x129')](db[_0xfab3('0x62')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xfab3('0x64')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'as':_0xfab3('0x16b'),'foreignKey':_0xfab3('0x16c')});db[_0xfab3('0x64')][_0xfab3('0x129')](db['User'],{'as':_0xfab3('0x178'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x64')]['belongsToMany'](db[_0xfab3('0x95')],{'through':_0xfab3('0x193'),'as':_0xfab3('0x17a')});db[_0xfab3('0x64')][_0xfab3('0x12e')](db['Tag'],{'through':_0xfab3('0x193'),'as':_0xfab3('0x17b')});db['OpenchannelInteraction']['belongsToMany'](db[_0xfab3('0x13')],{'as':_0xfab3('0x17c'),'through':_0xfab3('0x136'),'foreignKey':'OpenchannelInteractionId'});db[_0xfab3('0x66')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'onDelete':_0xfab3('0x11f'),'as':'User'});db[_0xfab3('0x66')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'onDelete':_0xfab3('0x11f'),'as':'Contact'});db[_0xfab3('0x66')][_0xfab3('0x129')](db['OpenchannelInteraction'],{'onDelete':_0xfab3('0x11f'),'as':_0xfab3('0x188'),'foreignKey':_0xfab3('0x194')});db['OpenchannelMessage'][_0xfab3('0x129')](db['Attachment'],{'as':_0xfab3('0xf5'),'foreignKey':_0xfab3('0x189')});db[_0xfab3('0x66')]['belongsTo'](db[_0xfab3('0x62')],{'as':_0xfab3('0x177'),'foreignKey':'OpenchannelAccountId'});db[_0xfab3('0x68')][_0xfab3('0x12e')](db['User'],{'as':_0xfab3('0x175'),'through':'UserOpenchannelQueue','foreignKey':_0xfab3('0x195')});db['OpenchannelQueue'][_0xfab3('0x12e')](db[_0xfab3('0xee')],{'through':'team_has_openchannel_queues','as':_0xfab3('0x162')});db[_0xfab3('0x145')][_0xfab3('0x11a')](db[_0xfab3('0x183')],{'as':'Dispositions','foreignKey':_0xfab3('0x196')});db[_0xfab3('0x145')][_0xfab3('0x11a')](db[_0xfab3('0x87')],{'as':_0xfab3('0x171'),'foreignKey':_0xfab3('0x196')});db[_0xfab3('0x145')][_0xfab3('0x11a')](db[_0xfab3('0x75')],{'as':_0xfab3('0x197')});db[_0xfab3('0x145')][_0xfab3('0x11a')](db[_0xfab3('0x6f')],{'as':_0xfab3('0x18c')});db[_0xfab3('0x145')][_0xfab3('0x11a')](db[_0xfab3('0x6d')],{'as':'Applications'});db[_0xfab3('0x145')][_0xfab3('0x11a')](db['ChatMessage'],{'as':'Messages'});db[_0xfab3('0x145')]['belongsTo'](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0x145')][_0xfab3('0x129')](db['Interval'],{'as':_0xfab3('0x180'),'foreignKey':_0xfab3('0x15f')});db[_0xfab3('0x145')][_0xfab3('0x129')](db['Pause'],{'as':_0xfab3('0x160'),'foreignKey':_0xfab3('0x161')});db[_0xfab3('0x145')][_0xfab3('0x12e')](db['User'],{'as':_0xfab3('0x175'),'through':_0xfab3('0x146')});db[_0xfab3('0x6b')][_0xfab3('0x129')](db[_0xfab3('0x62')],{});db[_0xfab3('0x6b')][_0xfab3('0x129')](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0x6b')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'as':_0xfab3('0x16b'),'foreignKey':'ContactId'});db[_0xfab3('0x6b')]['belongsTo'](db[_0xfab3('0x64')],{});db[_0xfab3('0x6b')]['belongsTo'](db[_0xfab3('0x66')],{});db[_0xfab3('0x6b')][_0xfab3('0x129')](db[_0xfab3('0x13')],{});db['OpenchannelQueueReport'][_0xfab3('0x129')](db[_0xfab3('0x68')],{});db[_0xfab3('0x6d')]['belongsTo'](db[_0xfab3('0x13')],{'as':'Agent','foreignKey':_0xfab3('0x119'),'onDelete':_0xfab3('0x17f')});db['ChatApplication'][_0xfab3('0x129')](db['ChatQueue'],{'as':'Queue','foreignKey':_0xfab3('0x198'),'onDelete':_0xfab3('0x17f')});db['ChatApplication'][_0xfab3('0x129')](db[_0xfab3('0x145')],{'as':_0xfab3('0x199'),'foreignKey':'ChatWebsiteId','onDelete':_0xfab3('0x17f')});db[_0xfab3('0x6d')][_0xfab3('0x129')](db[_0xfab3('0x95')],{'onDelete':_0xfab3('0x17f'),'foreignKey':_0xfab3('0x181')});db[_0xfab3('0x6f')]['hasMany'](db[_0xfab3('0x70')],{'as':_0xfab3('0x165'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x19a')});db['ChatInteraction'][_0xfab3('0x129')](db[_0xfab3('0x145')],{'as':_0xfab3('0x177'),'foreignKey':'ChatWebsiteId'});db[_0xfab3('0x6f')][_0xfab3('0x129')](db['CmContact'],{'as':'Contact','foreignKey':_0xfab3('0x16c')});db['ChatInteraction']['belongsTo'](db['User'],{'as':_0xfab3('0x178'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x6f')][_0xfab3('0x12e')](db['Tag'],{'through':_0xfab3('0x19b'),'as':_0xfab3('0x17a')});db[_0xfab3('0x6f')][_0xfab3('0x12e')](db[_0xfab3('0x95')],{'through':_0xfab3('0x19b'),'as':_0xfab3('0x17b')});db[_0xfab3('0x6f')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x17c'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xfab3('0x129')](db[_0xfab3('0x13')],{'onDelete':_0xfab3('0x11f'),'as':_0xfab3('0x13')});db[_0xfab3('0x70')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'onDelete':'cascade','as':_0xfab3('0x16b'),'foreignKey':'ContactId'});db[_0xfab3('0x70')][_0xfab3('0x129')](db[_0xfab3('0x6f')],{'onDelete':_0xfab3('0x11f'),'as':_0xfab3('0x188'),'foreignKey':_0xfab3('0x19a')});db[_0xfab3('0x70')][_0xfab3('0x129')](db[_0xfab3('0xf5')],{'as':_0xfab3('0xf5'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0xfab3('0x129')](db['ChatWebsite'],{'as':_0xfab3('0x177'),'foreignKey':_0xfab3('0x196')});db[_0xfab3('0x72')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'onDelete':_0xfab3('0x11f'),'as':'Contact','foreignKey':'ContactId'});db[_0xfab3('0x72')][_0xfab3('0x129')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xfab3('0x196')});db[_0xfab3('0x13b')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x175'),'through':_0xfab3('0x13d'),'hooks':!![]});db[_0xfab3('0x13b')][_0xfab3('0x12e')](db[_0xfab3('0xee')],{'through':_0xfab3('0x19c'),'as':_0xfab3('0x162')});db['ChatGroup'][_0xfab3('0x11a')](db[_0xfab3('0xdd')],{'as':'Messages','foreignKey':_0xfab3('0x19d'),'onDelete':_0xfab3('0x11f')});db[_0xfab3('0x12b')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x157'),'through':'chat_group_has_users'});db[_0xfab3('0x75')]['belongsTo'](db[_0xfab3('0x145')],{'as':'Website','foreignKey':_0xfab3('0x196')});db[_0xfab3('0x77')][_0xfab3('0x11a')](db[_0xfab3('0x79')],{'as':_0xfab3('0x19e'),'foreignKey':_0xfab3('0x19f')});db['CmContact'][_0xfab3('0x11a')](db[_0xfab3('0x7b')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0xfab3('0x79')][_0xfab3('0x11a')](db['CmHopperFinal'],{'as':_0xfab3('0x120'),'foreignKey':_0xfab3('0x16c')});db['CmContact'][_0xfab3('0x11a')](db['CmHopperHistory'],{'as':_0xfab3('0x15b'),'foreignKey':_0xfab3('0x16c')});db['CmContact'][_0xfab3('0x11a')](db[_0xfab3('0x80')],{'as':'ReportAgentPreview','foreignKey':_0xfab3('0x16c')});db[_0xfab3('0x79')][_0xfab3('0x11a')](db[_0xfab3('0xe3')],{'as':_0xfab3('0x15d'),'foreignKey':_0xfab3('0x16c')});db['CmContact']['hasMany'](db[_0xfab3('0x64')],{'as':_0xfab3('0x122'),'foreignKey':_0xfab3('0x16c'),'onDelete':_0xfab3('0x17f')});db['CmContact']['hasMany'](db['ChatInteraction'],{'as':_0xfab3('0x123'),'foreignKey':_0xfab3('0x16c'),'onDelete':_0xfab3('0x17f')});db['CmContact'][_0xfab3('0x11a')](db[_0xfab3('0x5e')],{'as':_0xfab3('0x124'),'foreignKey':_0xfab3('0x16c'),'onDelete':_0xfab3('0x17f')});db['CmContact'][_0xfab3('0x11a')](db[_0xfab3('0x125')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0xfab3('0x17f')});db[_0xfab3('0x79')]['hasMany'](db[_0xfab3('0x45')],{'as':_0xfab3('0x126'),'foreignKey':'ContactId','onDelete':_0xfab3('0x17f')});db[_0xfab3('0x79')][_0xfab3('0x129')](db[_0xfab3('0x77')],{'as':'Company','foreignKey':_0xfab3('0x19f')});db[_0xfab3('0x79')][_0xfab3('0x129')](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173'),'onDelete':_0xfab3('0x11f')});db[_0xfab3('0x79')][_0xfab3('0x12e')](db['User'],{'as':'Users','through':'cm_user_has_contacts'});db[_0xfab3('0x79')]['belongsToMany'](db[_0xfab3('0x95')],{'as':_0xfab3('0x17a'),'through':_0xfab3('0x1a0')});db[_0xfab3('0x79')][_0xfab3('0x12e')](db[_0xfab3('0x95')],{'through':_0xfab3('0x1a0'),'as':_0xfab3('0x17b')});db[_0xfab3('0x7b')][_0xfab3('0x129')](db['CmContact'],{'as':'Contact','foreignKey':_0xfab3('0x16c'),'onDelete':'cascade'});db[_0xfab3('0x7b')][_0xfab3('0x129')](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173'),'onDelete':_0xfab3('0x11f')});db[_0xfab3('0x7b')]['belongsTo'](db[_0xfab3('0x13')],{'as':_0xfab3('0x1a1'),'foreignKey':_0xfab3('0x119')});db[_0xfab3('0x7b')][_0xfab3('0x129')](db[_0xfab3('0x1d')],{'as':_0xfab3('0x1a2'),'foreignKey':_0xfab3('0x158'),'onDelete':_0xfab3('0x11f')});db['CmHopper'][_0xfab3('0x129')](db[_0xfab3('0x1a3')],{'as':'Campaign','foreignKey':_0xfab3('0x1a4'),'onDelete':_0xfab3('0x11f')});db['CmHopper'][_0xfab3('0x129')](db[_0xfab3('0x13')],{'as':_0xfab3('0x178'),'foreignKey':_0xfab3('0x1a5')});db['CmHopperBlack'][_0xfab3('0x129')](db['CmContact'],{'as':_0xfab3('0x16b'),'foreignKey':_0xfab3('0x16c'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':'ListId','onDelete':_0xfab3('0x11f')});db[_0xfab3('0x1a6')][_0xfab3('0x129')](db[_0xfab3('0x1d')],{'as':_0xfab3('0x1a2'),'foreignKey':_0xfab3('0x158'),'onDelete':_0xfab3('0x11f')});db[_0xfab3('0x1a6')]['belongsTo'](db[_0xfab3('0x1a3')],{'as':'Campaign','foreignKey':_0xfab3('0x1a4'),'onDelete':_0xfab3('0x11f')});db['Automation'][_0xfab3('0x11a')](db['Condition'],{'as':{'plural':_0xfab3('0x1a7'),'singular':_0xfab3('0x1a8')},'foreignKey':_0xfab3('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0xfab3('0x85')][_0xfab3('0x11a')](db[_0xfab3('0x8a')],{'as':{'plural':_0xfab3('0x1aa'),'singular':_0xfab3('0x1ab')},'foreignKey':_0xfab3('0x1ac'),'onDelete':_0xfab3('0x11f'),'hooks':!![]});db[_0xfab3('0x85')][_0xfab3('0x11a')](db[_0xfab3('0x83')],{'as':_0xfab3('0x1ad'),'foreignKey':_0xfab3('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0xfab3('0x180')][_0xfab3('0x11a')](db[_0xfab3('0x180')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0xfab3('0x11f'),'hooks':!![],'required':![]});db[_0xfab3('0x180')][_0xfab3('0x11a')](db[_0xfab3('0x19')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0xfab3('0x17f')});db[_0xfab3('0x180')][_0xfab3('0x11a')](db['MailApplication'],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0xfab3('0x180')][_0xfab3('0x11a')](db[_0xfab3('0x6d')],{'as':_0xfab3('0x1af'),'foreignKey':_0xfab3('0x15f')});db[_0xfab3('0x180')][_0xfab3('0x11a')](db[_0xfab3('0x53')],{'as':_0xfab3('0x1b0'),'foreignKey':_0xfab3('0x15f')});db[_0xfab3('0x180')][_0xfab3('0x11a')](db[_0xfab3('0x5c')],{'as':_0xfab3('0x1b1'),'foreignKey':_0xfab3('0x15f')});db['Schedule'][_0xfab3('0x129')](db[_0xfab3('0x3f')],{});db[_0xfab3('0x93')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0xfab3('0x1b2')});db[_0xfab3('0x93')][_0xfab3('0x129')](db[_0xfab3('0x1b3')],{'foreignKey':_0xfab3('0x1b4')});db['Sound'][_0xfab3('0x12e')](db[_0xfab3('0x1b')],{'as':'Mohs','through':_0xfab3('0x156'),'onDelete':_0xfab3('0x17f')});db[_0xfab3('0x95')][_0xfab3('0x12e')](db['CmContact'],{'through':_0xfab3('0x1a0')});db[_0xfab3('0x95')][_0xfab3('0x12e')](db[_0xfab3('0x6f')],{'through':'chat_interaction_has_tags'});db[_0xfab3('0x95')][_0xfab3('0x12e')](db[_0xfab3('0x45')],{'through':_0xfab3('0x179')});db[_0xfab3('0x95')][_0xfab3('0x12e')](db[_0xfab3('0x5e')],{'through':_0xfab3('0x18e')});db['Tag']['belongsToMany'](db[_0xfab3('0x125')],{'through':_0xfab3('0x186')});db['Tag'][_0xfab3('0x12e')](db[_0xfab3('0x64')],{'through':_0xfab3('0x193')});db['Tag'][_0xfab3('0x12e')](db[_0xfab3('0x10e')],{'through':'whatsapp_interaction_has_tags'});db[_0xfab3('0x99')][_0xfab3('0x11a')](db['Condition'],{'as':{'plural':_0xfab3('0x1b5'),'singular':_0xfab3('0x1b6')},'foreignKey':_0xfab3('0x1b7'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0xfab3('0x11a')](db[_0xfab3('0x8a')],{'as':{'plural':_0xfab3('0x1b8'),'singular':_0xfab3('0x1b9')},'foreignKey':'TriggerAnyId','onDelete':_0xfab3('0x11f'),'hooks':!![]});db[_0xfab3('0x99')][_0xfab3('0x11a')](db[_0xfab3('0x83')],{'as':_0xfab3('0x1ad'),'foreignKey':_0xfab3('0x1ba'),'onDelete':_0xfab3('0x11f'),'hooks':!![]});db[_0xfab3('0x1b3')][_0xfab3('0x11a')](db['AnalyticFieldReport'],{'as':_0xfab3('0x1bb'),'onDelete':'cascade','foreignKey':_0xfab3('0x1b4'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0xfab3('0xa6')],{'as':'Fields','onDelete':_0xfab3('0x11f'),'foreignKey':'DefaultReportId'});db[_0xfab3('0xa4')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1bc')});db[_0xfab3('0xa6')][_0xfab3('0x129')](db[_0xfab3('0xa4')],{'foreignKey':_0xfab3('0x1bc')});db[_0xfab3('0xa9')]['hasMany'](db[_0xfab3('0x1bd')],{'as':_0xfab3('0x1be'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1bf')});db[_0xfab3('0x1bd')]['hasMany'](db[_0xfab3('0x1c0')],{'as':_0xfab3('0x1c1'),'onDelete':_0xfab3('0x11f'),'foreignKey':'SubjectId'});db[_0xfab3('0x1bd')][_0xfab3('0x11a')](db[_0xfab3('0x1c0')],{'as':_0xfab3('0x1c2'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0x1bd')][_0xfab3('0x11a')](db['SalesforceField'],{'as':_0xfab3('0x1bb'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0x1bd')][_0xfab3('0x129')](db[_0xfab3('0xa9')],{'as':'Account','foreignKey':_0xfab3('0x1bf')});db[_0xfab3('0x1c0')][_0xfab3('0x11a')](db[_0xfab3('0x1c0')],{'as':_0xfab3('0x1c5'),'foreignKey':'SubjectId'});db[_0xfab3('0x1c0')][_0xfab3('0x11a')](db[_0xfab3('0x1c0')],{'as':_0xfab3('0x1c6'),'foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0x1c0')][_0xfab3('0x11a')](db[_0xfab3('0x1c0')],{'as':'Field','foreignKey':_0xfab3('0x1c4')});db['SalesforceField'][_0xfab3('0x129')](db['Variable'],{'as':_0xfab3('0x1c7'),'foreignKey':'VariableId'});db[_0xfab3('0xac')][_0xfab3('0x11a')](db[_0xfab3('0xae')],{'as':_0xfab3('0x1be'),'onDelete':'cascade','foreignKey':_0xfab3('0x1bf')});db[_0xfab3('0xae')][_0xfab3('0x11a')](db[_0xfab3('0xb0')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xfab3('0x1c8')});db[_0xfab3('0xae')][_0xfab3('0x11a')](db[_0xfab3('0xb0')],{'as':_0xfab3('0x1c2'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0xfab3('0x11a')](db[_0xfab3('0xb0')],{'as':_0xfab3('0x1bb'),'onDelete':_0xfab3('0x11f'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0xfab3('0x129')](db['SugarcrmAccount'],{'as':_0xfab3('0x177'),'foreignKey':_0xfab3('0x1bf')});db[_0xfab3('0xb0')][_0xfab3('0x11a')](db[_0xfab3('0xb0')],{'as':'Subject','foreignKey':_0xfab3('0x1c8')});db[_0xfab3('0xb0')][_0xfab3('0x11a')](db[_0xfab3('0xb0')],{'as':_0xfab3('0x1c6'),'foreignKey':_0xfab3('0x1c3')});db['SugarcrmField'][_0xfab3('0x11a')](db[_0xfab3('0xb0')],{'as':_0xfab3('0x1c9'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xfab3('0x129')](db[_0xfab3('0x1c7')],{'as':_0xfab3('0x1c7'),'foreignKey':'VariableId'});db[_0xfab3('0xb2')]['hasMany'](db[_0xfab3('0x1ca')],{'as':_0xfab3('0x1be'),'onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration'][_0xfab3('0x11a')](db[_0xfab3('0xb5')],{'as':_0xfab3('0x1c1'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1c8')});db['DeskConfiguration'][_0xfab3('0x11a')](db[_0xfab3('0xb5')],{'as':'Descriptions','onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1c3')});db['DeskConfiguration'][_0xfab3('0x11a')](db['DeskField'],{'as':_0xfab3('0x1bb'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0x1ca')][_0xfab3('0x129')](db[_0xfab3('0xb2')],{'as':_0xfab3('0x177'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xfab3('0x12e')](db[_0xfab3('0x95')],{'through':_0xfab3('0x1cb')});db['DeskField'][_0xfab3('0x11a')](db[_0xfab3('0xb5')],{'as':'Subject','foreignKey':_0xfab3('0x1c8')});db[_0xfab3('0xb5')]['hasMany'](db[_0xfab3('0xb5')],{'as':_0xfab3('0x1c6'),'foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0xb5')][_0xfab3('0x11a')](db['DeskField'],{'as':_0xfab3('0x1c9'),'foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0xb5')][_0xfab3('0x129')](db[_0xfab3('0x1c7')],{'as':_0xfab3('0x1c7'),'foreignKey':_0xfab3('0x1cc')});db['ZohoAccount'][_0xfab3('0x11a')](db[_0xfab3('0xb7')],{'as':_0xfab3('0x1be'),'onDelete':_0xfab3('0x11f'),'foreignKey':'AccountId'});db[_0xfab3('0xb7')][_0xfab3('0x11a')](db[_0xfab3('0xb9')],{'as':_0xfab3('0x1c1'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1c8')});db['ZohoConfiguration'][_0xfab3('0x11a')](db[_0xfab3('0xb9')],{'as':_0xfab3('0x1c2'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xfab3('0x11a')](db[_0xfab3('0xb9')],{'as':_0xfab3('0x1bb'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0xb7')]['belongsTo'](db['ZohoAccount'],{'as':_0xfab3('0x177'),'foreignKey':_0xfab3('0x1bf')});db[_0xfab3('0xb9')][_0xfab3('0x11a')](db[_0xfab3('0xb9')],{'as':'Subject','foreignKey':_0xfab3('0x1c8')});db[_0xfab3('0xb9')][_0xfab3('0x11a')](db[_0xfab3('0xb9')],{'as':_0xfab3('0x1c6'),'foreignKey':_0xfab3('0x1c3')});db['ZohoField'][_0xfab3('0x11a')](db[_0xfab3('0xb9')],{'as':_0xfab3('0x1c9'),'foreignKey':'FieldId'});db['ZohoField'][_0xfab3('0x129')](db[_0xfab3('0x1c7')],{'as':'Variable','foreignKey':_0xfab3('0x1cc')});db['ZendeskAccount']['hasMany'](db[_0xfab3('0xbd')],{'as':_0xfab3('0x1be'),'onDelete':_0xfab3('0x11f'),'foreignKey':'AccountId'});db[_0xfab3('0xbd')][_0xfab3('0x11a')](db[_0xfab3('0x1cd')],{'as':_0xfab3('0x1c1'),'foreignKey':_0xfab3('0x1c8')});db['ZendeskConfiguration'][_0xfab3('0x11a')](db[_0xfab3('0x1cd')],{'as':_0xfab3('0x1c2'),'foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0xbd')]['hasMany'](db[_0xfab3('0x1cd')],{'as':_0xfab3('0x1bb'),'foreignKey':'FieldId'});db[_0xfab3('0xbd')][_0xfab3('0x129')](db[_0xfab3('0xbb')],{'as':'Account','foreignKey':'AccountId'});db[_0xfab3('0xbd')][_0xfab3('0x12e')](db[_0xfab3('0x95')],{'through':_0xfab3('0x1ce')});db[_0xfab3('0x1cd')][_0xfab3('0x11a')](db[_0xfab3('0x1cd')],{'as':_0xfab3('0x1c5'),'foreignKey':_0xfab3('0x1c8')});db[_0xfab3('0x1cd')][_0xfab3('0x11a')](db[_0xfab3('0x1cd')],{'as':_0xfab3('0x1c6'),'foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0x1cd')][_0xfab3('0x11a')](db['ZendeskField'],{'as':_0xfab3('0x1c9'),'foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0x1cd')][_0xfab3('0x129')](db[_0xfab3('0x1c7')],{'as':_0xfab3('0x1c7'),'foreignKey':'VariableId'});db[_0xfab3('0xbf')]['hasMany'](db[_0xfab3('0xc0')],{'as':_0xfab3('0x1be'),'onDelete':'cascade','foreignKey':_0xfab3('0x1bf')});db[_0xfab3('0xc0')]['hasMany'](db[_0xfab3('0xc2')],{'as':_0xfab3('0x1c1'),'onDelete':'cascade','foreignKey':_0xfab3('0x1c8')});db[_0xfab3('0xc0')][_0xfab3('0x11a')](db[_0xfab3('0xc2')],{'as':_0xfab3('0x1c2'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1c3')});db['FreshdeskConfiguration']['hasMany'](db[_0xfab3('0xc2')],{'as':_0xfab3('0x1bb'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0xc0')]['belongsTo'](db[_0xfab3('0xbf')],{'as':_0xfab3('0x177'),'foreignKey':'AccountId'});db[_0xfab3('0xc0')][_0xfab3('0x12e')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0xfab3('0xc2')][_0xfab3('0x11a')](db[_0xfab3('0xc2')],{'as':_0xfab3('0x1c5'),'foreignKey':'SubjectId'});db['FreshdeskField']['hasMany'](db[_0xfab3('0xc2')],{'as':_0xfab3('0x1c6'),'foreignKey':'DescriptionId'});db[_0xfab3('0xc2')][_0xfab3('0x11a')](db[_0xfab3('0xc2')],{'as':_0xfab3('0x1c9'),'foreignKey':_0xfab3('0x1c4')});db['FreshdeskField'][_0xfab3('0x129')](db[_0xfab3('0x1c7')],{'as':'Variable','foreignKey':_0xfab3('0x1cc')});db[_0xfab3('0x1cf')][_0xfab3('0x11a')](db[_0xfab3('0xc4')],{'as':'Configurations','onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1bf')});db[_0xfab3('0xc4')][_0xfab3('0x11a')](db[_0xfab3('0xc6')],{'as':_0xfab3('0x1c1'),'foreignKey':'SubjectId'});db[_0xfab3('0xc4')][_0xfab3('0x11a')](db['VtigerField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xfab3('0xc4')][_0xfab3('0x11a')](db[_0xfab3('0xc6')],{'as':_0xfab3('0x1bb'),'foreignKey':'FieldId'});db['VtigerConfiguration']['belongsTo'](db[_0xfab3('0x1cf')],{'as':_0xfab3('0x177'),'foreignKey':_0xfab3('0x1bf')});db[_0xfab3('0xc6')][_0xfab3('0x11a')](db[_0xfab3('0xc6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xfab3('0xc6')]['hasMany'](db[_0xfab3('0xc6')],{'as':_0xfab3('0x1c6'),'foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0xc6')][_0xfab3('0x11a')](db[_0xfab3('0xc6')],{'as':_0xfab3('0x1c9'),'foreignKey':_0xfab3('0x1c4')});db['VtigerField'][_0xfab3('0x129')](db[_0xfab3('0x1c7')],{'as':_0xfab3('0x1c7'),'foreignKey':_0xfab3('0x1cc')});db['ServicenowAccount']['hasMany'](db[_0xfab3('0xca')],{'as':_0xfab3('0x1be'),'onDelete':_0xfab3('0x11f'),'foreignKey':'AccountId'});db[_0xfab3('0xca')][_0xfab3('0x11a')](db[_0xfab3('0xcc')],{'as':'Subjects','foreignKey':_0xfab3('0x1c8')});db[_0xfab3('0xca')][_0xfab3('0x11a')](db[_0xfab3('0xcc')],{'as':_0xfab3('0x1c2'),'foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0xca')][_0xfab3('0x11a')](db[_0xfab3('0xcc')],{'as':_0xfab3('0x1bb'),'foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0xca')]['belongsTo'](db['ServicenowAccount'],{'as':_0xfab3('0x177'),'foreignKey':'AccountId'});db[_0xfab3('0xcc')]['hasMany'](db[_0xfab3('0xcc')],{'as':_0xfab3('0x1c5'),'foreignKey':_0xfab3('0x1c8')});db[_0xfab3('0xcc')][_0xfab3('0x11a')](db[_0xfab3('0xcc')],{'as':'Description','foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0xcc')][_0xfab3('0x11a')](db['ServicenowField'],{'as':_0xfab3('0x1c9'),'foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0xcc')][_0xfab3('0x129')](db[_0xfab3('0x1c7')],{'as':_0xfab3('0x1c7'),'foreignKey':_0xfab3('0x1cc')});db[_0xfab3('0xce')][_0xfab3('0x11a')](db[_0xfab3('0x1d0')],{'as':'Configurations','onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1bf')});db[_0xfab3('0x1d0')]['hasMany'](db[_0xfab3('0xd1')],{'as':_0xfab3('0x1c1'),'onDelete':'cascade','foreignKey':_0xfab3('0x1c8')});db['Dynamics365Configuration'][_0xfab3('0x11a')](db[_0xfab3('0xd1')],{'as':_0xfab3('0x1c2'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1c3')});db['Dynamics365Configuration'][_0xfab3('0x11a')](db[_0xfab3('0xd1')],{'as':_0xfab3('0x1bb'),'onDelete':'cascade','foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0x1d0')]['belongsTo'](db[_0xfab3('0xce')],{'as':_0xfab3('0x177'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0xfab3('0x11a')](db[_0xfab3('0xd1')],{'as':'Subject','foreignKey':_0xfab3('0x1c8')});db[_0xfab3('0xd1')]['hasMany'](db[_0xfab3('0xd1')],{'as':_0xfab3('0x1c6'),'foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0xd1')][_0xfab3('0x11a')](db[_0xfab3('0xd1')],{'as':_0xfab3('0x1c9'),'foreignKey':_0xfab3('0x1c4')});db['Dynamics365Field']['belongsTo'](db[_0xfab3('0x1c7')],{'as':'Variable','foreignKey':_0xfab3('0x1cc')});db[_0xfab3('0xd3')][_0xfab3('0x11a')](db[_0xfab3('0xd5')],{'as':_0xfab3('0x1be'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x1bf')});db[_0xfab3('0xd5')][_0xfab3('0x11a')](db[_0xfab3('0xd7')],{'as':_0xfab3('0x1c1'),'foreignKey':_0xfab3('0x1c8')});db[_0xfab3('0xd5')][_0xfab3('0x11a')](db[_0xfab3('0xd7')],{'as':_0xfab3('0x1c2'),'foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0xd5')]['hasMany'](db[_0xfab3('0xd7')],{'as':_0xfab3('0x1bb'),'foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0xd5')][_0xfab3('0x129')](db['FreshsalesAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xfab3('0xd7')]['hasMany'](db[_0xfab3('0xd7')],{'as':_0xfab3('0x1c5'),'foreignKey':'SubjectId'});db[_0xfab3('0xd7')][_0xfab3('0x11a')](db[_0xfab3('0xd7')],{'as':_0xfab3('0x1c6'),'foreignKey':_0xfab3('0x1c3')});db[_0xfab3('0xd7')][_0xfab3('0x11a')](db[_0xfab3('0xd7')],{'as':'Field','foreignKey':_0xfab3('0x1c4')});db[_0xfab3('0xd7')][_0xfab3('0x129')](db[_0xfab3('0x1c7')],{'as':_0xfab3('0x1c7'),'foreignKey':_0xfab3('0x1cc')});db['ChatQueueReport']['belongsTo'](db['ChatWebsite'],{});db[_0xfab3('0xdb')][_0xfab3('0x129')](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0xdb')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'as':'Contact','foreignKey':_0xfab3('0x16c')});db[_0xfab3('0xdb')]['belongsTo'](db[_0xfab3('0x6f')],{});db[_0xfab3('0xdb')][_0xfab3('0x129')](db[_0xfab3('0x70')],{});db[_0xfab3('0xdb')][_0xfab3('0x129')](db[_0xfab3('0x13')],{});db[_0xfab3('0xdb')]['belongsTo'](db[_0xfab3('0x13b')],{});db[_0xfab3('0xdd')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'onDelete':_0xfab3('0x11f'),'foreignKey':'FromId'});db[_0xfab3('0xdd')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'onDelete':_0xfab3('0x11f'),'foreignKey':'ToId'});db['JscriptySessionReport']['hasMany'](db[_0xfab3('0xe1')],{'foreignKey':_0xfab3('0x1d1'),'onDelete':'cascade'});db['JscriptySessionReport'][_0xfab3('0x11a')](db[_0xfab3('0xdf')],{'foreignKey':_0xfab3('0x1d1'),'onDelete':_0xfab3('0x11f')});db[_0xfab3('0x1d2')][_0xfab3('0x129')](db[_0xfab3('0x5a')],{});db[_0xfab3('0x1d2')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xfab3('0x173')});db[_0xfab3('0x1d2')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'as':_0xfab3('0x16b'),'foreignKey':_0xfab3('0x16c')});db['SmsQueueReport'][_0xfab3('0x129')](db[_0xfab3('0x5e')],{});db['SmsQueueReport'][_0xfab3('0x129')](db[_0xfab3('0x5f')],{});db['SmsQueueReport']['belongsTo'](db[_0xfab3('0x13')],{});db[_0xfab3('0x1d2')][_0xfab3('0x129')](db[_0xfab3('0x60')],{});db['JscriptyProject'][_0xfab3('0x11a')](db[_0xfab3('0xe3')],{'foreignKey':_0xfab3('0x1d3')});db[_0xfab3('0xe8')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xfab3('0x1d3')});db[_0xfab3('0xe8')][_0xfab3('0x11a')](db[_0xfab3('0xdf')],{'foreignKey':'ProjectId'});db['SquareProject'][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x17c'),'through':_0xfab3('0x151')});db[_0xfab3('0xee')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':'Agents','through':_0xfab3('0x132')});db[_0xfab3('0xee')]['belongsToMany'](db[_0xfab3('0x1d')],{'through':_0xfab3('0x1d4'),'as':_0xfab3('0x139')});db[_0xfab3('0xee')][_0xfab3('0x12e')](db[_0xfab3('0x41')],{'through':_0xfab3('0x1d5'),'as':_0xfab3('0x13a')});db[_0xfab3('0xee')][_0xfab3('0x12e')](db[_0xfab3('0x13b')],{'through':_0xfab3('0x19c'),'as':_0xfab3('0x13c')});db[_0xfab3('0xee')][_0xfab3('0x12e')](db['FaxQueue'],{'through':_0xfab3('0x18a'),'as':_0xfab3('0x1d6')});db[_0xfab3('0xee')][_0xfab3('0x12e')](db[_0xfab3('0x60')],{'through':_0xfab3('0x190'),'as':_0xfab3('0x13f')});db['Team'][_0xfab3('0x12e')](db[_0xfab3('0x68')],{'through':'team_has_openchannel_queues','as':_0xfab3('0x140')});db[_0xfab3('0xee')][_0xfab3('0x12e')](db[_0xfab3('0x114')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0xfab3('0x1a3')][_0xfab3('0x11a')](db[_0xfab3('0x7b')],{'as':'Hoppers','foreignKey':_0xfab3('0x1a4')});db['Campaign']['hasMany'](db[_0xfab3('0x15a')],{'as':_0xfab3('0x120'),'foreignKey':_0xfab3('0x1a4')});db[_0xfab3('0x1a3')][_0xfab3('0x11a')](db[_0xfab3('0x7e')],{'as':_0xfab3('0x15b'),'foreignKey':_0xfab3('0x1a4')});db['Campaign']['hasMany'](db[_0xfab3('0x1a6')],{'as':_0xfab3('0x15c'),'foreignKey':_0xfab3('0x1a4')});db[_0xfab3('0x1a3')][_0xfab3('0x129')](db[_0xfab3('0x2d')],{'as':_0xfab3('0x2d'),'foreignKey':_0xfab3('0x15e')});db[_0xfab3('0x1a3')][_0xfab3('0x129')](db[_0xfab3('0x2d')],{'as':_0xfab3('0x1d7'),'foreignKey':_0xfab3('0x1d8')});db['Campaign'][_0xfab3('0x129')](db[_0xfab3('0x180')],{'as':_0xfab3('0x180'),'foreignKey':_0xfab3('0x15f')});db['Campaign'][_0xfab3('0x129')](db['SquareProject'],{'as':_0xfab3('0x14f'),'foreignKey':_0xfab3('0x1d9')});db['Campaign'][_0xfab3('0x12e')](db[_0xfab3('0x100')],{'as':'Lists','through':_0xfab3('0x1da')});db[_0xfab3('0x1a3')][_0xfab3('0x12e')](db['CmList'],{'as':_0xfab3('0x163'),'through':_0xfab3('0x1db')});db[_0xfab3('0xf8')][_0xfab3('0x129')](db[_0xfab3('0x47')],{});db['MailTransferReport'][_0xfab3('0x129')](db['MailInteraction'],{});db[_0xfab3('0xf8')][_0xfab3('0x129')](db[_0xfab3('0x3f')],{'foreignKey':_0xfab3('0x1dc'),'as':_0xfab3('0x1dd')});db[_0xfab3('0xf8')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'foreignKey':_0xfab3('0x1de'),'as':_0xfab3('0x1df')});db[_0xfab3('0xf8')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'foreignKey':_0xfab3('0x1e0'),'as':'ToAgent'});db[_0xfab3('0xf8')][_0xfab3('0x129')](db[_0xfab3('0x41')],{'foreignKey':'ToMailQueueId','as':_0xfab3('0x1e1')});db[_0xfab3('0xf8')][_0xfab3('0x129')](db[_0xfab3('0x3f')],{'foreignKey':'ToMailAccountId','as':_0xfab3('0x1e2')});db[_0xfab3('0xfa')]['belongsTo'](db['ChatMessage'],{});db[_0xfab3('0xfa')][_0xfab3('0x129')](db[_0xfab3('0x6f')],{});db[_0xfab3('0xfa')][_0xfab3('0x129')](db[_0xfab3('0x145')],{'foreignKey':_0xfab3('0x1e3'),'as':'FromAccount'});db[_0xfab3('0xfa')][_0xfab3('0x129')](db['User'],{'foreignKey':_0xfab3('0x1de'),'as':'FromAgent'});db['ChatTransferReport']['belongsTo'](db[_0xfab3('0x13')],{'foreignKey':_0xfab3('0x1e0'),'as':_0xfab3('0x1e4')});db[_0xfab3('0xfa')][_0xfab3('0x129')](db[_0xfab3('0x13b')],{'foreignKey':'ToChatQueueId','as':_0xfab3('0x1e1')});db[_0xfab3('0xfa')][_0xfab3('0x129')](db[_0xfab3('0x145')],{'foreignKey':_0xfab3('0x1e5'),'as':_0xfab3('0x1e2')});db[_0xfab3('0xfc')][_0xfab3('0x129')](db['FaxMessage'],{});db[_0xfab3('0xfc')][_0xfab3('0x129')](db[_0xfab3('0x125')],{});db[_0xfab3('0xfc')][_0xfab3('0x129')](db[_0xfab3('0x51')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db['FaxTransferReport'][_0xfab3('0x129')](db[_0xfab3('0x13')],{'foreignKey':'FromUserId','as':_0xfab3('0x1df')});db['FaxTransferReport'][_0xfab3('0x129')](db[_0xfab3('0x13')],{'foreignKey':_0xfab3('0x1e0'),'as':_0xfab3('0x1e4')});db[_0xfab3('0xfc')][_0xfab3('0x129')](db[_0xfab3('0x13e')],{'foreignKey':_0xfab3('0x1e6'),'as':'ToQueue'});db[_0xfab3('0xfc')][_0xfab3('0x129')](db[_0xfab3('0x51')],{'foreignKey':_0xfab3('0x1e7'),'as':_0xfab3('0x1e2')});db[_0xfab3('0xfd')][_0xfab3('0x129')](db[_0xfab3('0x66')],{});db[_0xfab3('0xfd')][_0xfab3('0x129')](db['OpenchannelInteraction'],{});db[_0xfab3('0xfd')][_0xfab3('0x129')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0xfab3('0x1dd')});db[_0xfab3('0xfd')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'foreignKey':_0xfab3('0x1de'),'as':_0xfab3('0x1df')});db[_0xfab3('0xfd')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'foreignKey':_0xfab3('0x1e0'),'as':_0xfab3('0x1e4')});db[_0xfab3('0xfd')][_0xfab3('0x129')](db[_0xfab3('0x68')],{'foreignKey':_0xfab3('0x1e8'),'as':_0xfab3('0x1e1')});db[_0xfab3('0xfd')][_0xfab3('0x129')](db[_0xfab3('0x62')],{'foreignKey':_0xfab3('0x1e9'),'as':_0xfab3('0x1e2')});db['SmsTransferReport'][_0xfab3('0x129')](db[_0xfab3('0x5f')],{});db[_0xfab3('0xff')][_0xfab3('0x129')](db[_0xfab3('0x5e')],{});db[_0xfab3('0xff')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xfab3('0x1ea'),'as':_0xfab3('0x1dd')});db[_0xfab3('0xff')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'foreignKey':_0xfab3('0x1de'),'as':_0xfab3('0x1df')});db[_0xfab3('0xff')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'foreignKey':_0xfab3('0x1e0'),'as':_0xfab3('0x1e4')});db[_0xfab3('0xff')]['belongsTo'](db[_0xfab3('0x60')],{'foreignKey':_0xfab3('0x1eb'),'as':_0xfab3('0x1e1')});db[_0xfab3('0xff')][_0xfab3('0x129')](db[_0xfab3('0x5a')],{'foreignKey':_0xfab3('0x1ec'),'as':'ToAccount'});db[_0xfab3('0x100')][_0xfab3('0x11a')](db[_0xfab3('0x183')],{'as':'Dispositions','foreignKey':'ListId'});db[_0xfab3('0x100')][_0xfab3('0x11a')](db[_0xfab3('0x82')],{'as':_0xfab3('0x1ed'),'foreignKey':_0xfab3('0x173')});db['CmList'][_0xfab3('0x11a')](db[_0xfab3('0x79')],{'as':_0xfab3('0x19e'),'onDelete':_0xfab3('0x11f'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0x100')][_0xfab3('0x11a')](db[_0xfab3('0x15a')],{'as':_0xfab3('0x120'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0x100')][_0xfab3('0x11a')](db[_0xfab3('0x7e')],{'as':'HopperHistory','foreignKey':_0xfab3('0x173')});db[_0xfab3('0x100')][_0xfab3('0x11a')](db['ReportAgentPreview'],{'as':_0xfab3('0x80'),'foreignKey':'ListId'});db[_0xfab3('0x100')][_0xfab3('0x12e')](db[_0xfab3('0x1d')],{'as':_0xfab3('0x1ee'),'through':_0xfab3('0x1ef')});db[_0xfab3('0x100')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':'Agents','through':_0xfab3('0x131')});db[_0xfab3('0x102')][_0xfab3('0x11a')](db['VoiceExtension'],{'as':_0xfab3('0x11e'),'onDelete':'cascade'});db[_0xfab3('0x102')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x175'),'through':_0xfab3('0x144')});db['UserProfile'][_0xfab3('0x11a')](db[_0xfab3('0x13')],{'as':_0xfab3('0x17c'),'foreignKey':_0xfab3('0x12a')});db[_0xfab3('0x104')]['hasMany'](db['UserProfileSection'],{'as':_0xfab3('0x1f0'),'foreignKey':'userProfileId','onDelete':_0xfab3('0x11f')});db[_0xfab3('0x105')][_0xfab3('0x11a')](db[_0xfab3('0x107')],{'as':'Resources','foreignKey':_0xfab3('0x1f1'),'onDelete':'cascade'});db[_0xfab3('0x10b')][_0xfab3('0x11a')](db['Disposition'],{'as':_0xfab3('0x170'),'foreignKey':_0xfab3('0x1f2')});db[_0xfab3('0x10b')][_0xfab3('0x11a')](db[_0xfab3('0x87')],{'as':_0xfab3('0x171'),'foreignKey':_0xfab3('0x1f2')});db[_0xfab3('0x10b')][_0xfab3('0x11a')](db[_0xfab3('0x110')],{'as':_0xfab3('0x165'),'foreignKey':_0xfab3('0x1f2')});db[_0xfab3('0x10b')][_0xfab3('0x11a')](db['WhatsappInteraction'],{'as':_0xfab3('0x18c')});db[_0xfab3('0x10b')]['hasMany'](db['WhatsappApplication'],{'as':_0xfab3('0x154')});db[_0xfab3('0x10b')]['belongsTo'](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':'ListId'});db[_0xfab3('0x10b')][_0xfab3('0x129')](db[_0xfab3('0x8d')],{'as':_0xfab3('0x160'),'foreignKey':_0xfab3('0x161')});db[_0xfab3('0x10b')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x175'),'through':'user_has_whatsapp_accounts'});db[_0xfab3('0x10c')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'onDelete':_0xfab3('0x17f')});db[_0xfab3('0x10c')][_0xfab3('0x129')](db['WhatsappQueue'],{'onDelete':_0xfab3('0x17f')});db[_0xfab3('0x10c')]['belongsTo'](db[_0xfab3('0x10b')],{'onDelete':_0xfab3('0x17f')});db[_0xfab3('0x10c')]['belongsTo'](db['Interval'],{'onDelete':_0xfab3('0x17f'),'foreignKey':_0xfab3('0x15f')});db[_0xfab3('0x10c')]['belongsTo'](db[_0xfab3('0x95')],{'onDelete':'restrict','foreignKey':_0xfab3('0x181')});db[_0xfab3('0x10e')]['hasMany'](db['WhatsappMessage'],{'as':_0xfab3('0x165'),'onDelete':'cascade','foreignKey':_0xfab3('0x1f3')});db[_0xfab3('0x10e')][_0xfab3('0x129')](db[_0xfab3('0x10b')],{'as':_0xfab3('0x177'),'foreignKey':_0xfab3('0x1f2')});db[_0xfab3('0x10e')]['belongsTo'](db[_0xfab3('0x79')],{'as':_0xfab3('0x16b'),'foreignKey':_0xfab3('0x16c')});db[_0xfab3('0x10e')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'as':'Owner','foreignKey':_0xfab3('0x119')});db[_0xfab3('0x10e')][_0xfab3('0x12e')](db[_0xfab3('0x95')],{'through':_0xfab3('0x1f4'),'as':_0xfab3('0x17a')});db[_0xfab3('0x10e')][_0xfab3('0x12e')](db[_0xfab3('0x95')],{'through':_0xfab3('0x1f4'),'as':_0xfab3('0x17b')});db[_0xfab3('0x10e')][_0xfab3('0x12e')](db['User'],{'as':_0xfab3('0x17c'),'through':_0xfab3('0x138'),'foreignKey':_0xfab3('0x1f3')});db[_0xfab3('0x110')][_0xfab3('0x129')](db[_0xfab3('0x13')],{'as':_0xfab3('0x13')});db[_0xfab3('0x110')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'onDelete':'cascade','as':_0xfab3('0x16b')});db[_0xfab3('0x110')][_0xfab3('0x129')](db[_0xfab3('0x10e')],{'onDelete':_0xfab3('0x11f'),'as':_0xfab3('0x188'),'foreignKey':'WhatsappInteractionId'});db[_0xfab3('0x110')]['belongsTo'](db[_0xfab3('0x10b')],{'as':'Account','foreignKey':_0xfab3('0x1f2')});db[_0xfab3('0x112')][_0xfab3('0x129')](db[_0xfab3('0x10b')],{});db[_0xfab3('0x112')][_0xfab3('0x129')](db[_0xfab3('0x100')],{'as':_0xfab3('0x172'),'foreignKey':_0xfab3('0x173')});db[_0xfab3('0x112')][_0xfab3('0x129')](db[_0xfab3('0x79')],{'as':_0xfab3('0x16b'),'foreignKey':_0xfab3('0x16c')});db[_0xfab3('0x112')][_0xfab3('0x129')](db['WhatsappInteraction'],{});db[_0xfab3('0x112')][_0xfab3('0x129')](db[_0xfab3('0x114')],{});db[_0xfab3('0x112')][_0xfab3('0x129')](db[_0xfab3('0x110')],{});db[_0xfab3('0x112')][_0xfab3('0x129')](db[_0xfab3('0x13')],{});db['WhatsappTransferReport'][_0xfab3('0x129')](db[_0xfab3('0x110')],{});db[_0xfab3('0x113')][_0xfab3('0x129')](db['WhatsappInteraction'],{});db[_0xfab3('0x113')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0xfab3('0x1dd')});db['WhatsappTransferReport'][_0xfab3('0x129')](db[_0xfab3('0x10b')],{'foreignKey':'ToWhatsappAccountId','as':_0xfab3('0x1e2')});db['WhatsappTransferReport'][_0xfab3('0x129')](db[_0xfab3('0x114')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0xfab3('0x113')]['belongsTo'](db[_0xfab3('0x13')],{'foreignKey':'FromUserId','as':_0xfab3('0x1df')});db[_0xfab3('0x113')][_0xfab3('0x129')](db['User'],{'foreignKey':_0xfab3('0x1e0'),'as':'ToAgent'});db[_0xfab3('0x114')][_0xfab3('0x12e')](db[_0xfab3('0x13')],{'as':_0xfab3('0x175'),'through':_0xfab3('0x142'),'foreignKey':'WhatsappQueueId'});db[_0xfab3('0x114')][_0xfab3('0x12e')](db[_0xfab3('0xee')],{'through':_0xfab3('0x1f5'),'as':_0xfab3('0x162')});module[_0xfab3('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ee9fbea..21337bb 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9251=['./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxQueue','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','join','/www','root','/demo','static','snippet','1.0.16','/plugins','route','get','sendFile','appPath','/index.html','express-winston','util','./errors','./config/environment','./config/logger','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','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)','format','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x9251,0xe0));var _0x1925=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0x9251[_0x1385dc];return _0x2f6469;};'use strict';var path=require('path');var express=require('express');var ewinston=require(_0x1925('0x0'));var util=require(_0x1925('0x1'));var errors=require(_0x1925('0x2'));var config=require(_0x1925('0x3'));var logger=require(_0x1925('0x4'))(_0x1925('0x5'));var authLogger=require('./config/logger')(_0x1925('0x6'));exports['default']=function(_0x48cc49){_0x48cc49[_0x1925('0x7')](ewinston[_0x1925('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x520800,_0x426db5){return util['format'](_0x1925('0x9'),_0x520800[_0x1925('0xa')],_0x520800['headers'][_0x1925('0xb')]?_0x520800[_0x1925('0xc')][_0x1925('0xb')]:_0x520800[_0x1925('0xd')][_0x1925('0xe')]||_0x520800['ip'],_0x520800[_0x1925('0xf')],_0x426db5[_0x1925('0x10')],_0x426db5[_0x1925('0x11')],_0x520800[_0x1925('0x12')]?_0x520800['user']['id']:null,_0x520800[_0x1925('0x12')]?_0x520800[_0x1925('0x12')][_0x1925('0x13')]:null,_0x520800[_0x1925('0x12')]?_0x520800[_0x1925('0x12')][_0x1925('0x14')]:null);}}));_0x48cc49['use'](ewinston[_0x1925('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1ef889,_0x2df930){var _0x39a99c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x1ef889[_0x1925('0x15')]&&_0x1ef889[_0x1925('0x15')][_0x1925('0x16')]&&_0x1ef889[_0x1925('0x15')][_0x1925('0x17')]){_0x39a99c=_0x1925('0x18');}return util[_0x1925('0x19')](_0x39a99c,_0x1ef889['method'],_0x1ef889[_0x1925('0xc')][_0x1925('0xb')]?_0x1ef889['headers'][_0x1925('0xb')]:_0x1ef889['connection'][_0x1925('0xe')]||_0x1ef889['ip'],_0x1ef889[_0x1925('0xf')],_0x2df930['statusCode'],_0x2df930[_0x1925('0x11')],_0x1ef889[_0x1925('0x12')]?_0x1ef889['user']['id']:null,_0x1ef889[_0x1925('0x12')]?_0x1ef889[_0x1925('0x12')]['name']:null,_0x1ef889[_0x1925('0x12')]?_0x1ef889['user'][_0x1925('0x14')]:null,_0x1ef889['body']&&_0x1ef889[_0x1925('0x15')][_0x1925('0x16')]?_0x1ef889[_0x1925('0x15')][_0x1925('0x16')]:_0x1925('0x1a'),_0x1ef889['body']&&_0x1ef889[_0x1925('0x15')]['agent_id']?_0x1ef889[_0x1925('0x15')][_0x1925('0x17')]:'',_0x1ef889['body']&&_0x1ef889[_0x1925('0x15')]['agent_name']?_0x1ef889['body'][_0x1925('0x1b')]:'');},'ignoreRoute':function(_0x3a2a4b){var _0x18d416=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x18d416[_0x1925('0x1c')](_0x3a2a4b[_0x1925('0xf')]);}}));_0x48cc49['use'](_0x1925('0x1d'),require(_0x1925('0x1e')));_0x48cc49[_0x1925('0x7')](_0x1925('0x1f'),require(_0x1925('0x20')));_0x48cc49[_0x1925('0x7')]('/api/voice/contexts',require(_0x1925('0x21')));_0x48cc49[_0x1925('0x7')](_0x1925('0x22'),require(_0x1925('0x23')));_0x48cc49['use']('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x48cc49[_0x1925('0x7')](_0x1925('0x24'),require(_0x1925('0x25')));_0x48cc49[_0x1925('0x7')]('/api/voice/recordings',require(_0x1925('0x26')));_0x48cc49[_0x1925('0x7')](_0x1925('0x27'),require(_0x1925('0x28')));_0x48cc49[_0x1925('0x7')]('/api/voice/mails',require(_0x1925('0x29')));_0x48cc49[_0x1925('0x7')](_0x1925('0x2a'),require(_0x1925('0x2b')));_0x48cc49[_0x1925('0x7')]('/api/voice/calls/reports',require(_0x1925('0x2c')));_0x48cc49[_0x1925('0x7')](_0x1925('0x2d'),require('./api/voiceDialReport'));_0x48cc49['use'](_0x1925('0x2e'),require('./api/voiceAgentReport'));_0x48cc49[_0x1925('0x7')](_0x1925('0x2f'),require(_0x1925('0x30')));_0x48cc49[_0x1925('0x7')](_0x1925('0x31'),require(_0x1925('0x32')));_0x48cc49[_0x1925('0x7')](_0x1925('0x33'),require(_0x1925('0x34')));_0x48cc49[_0x1925('0x7')](_0x1925('0x35'),require(_0x1925('0x36')));_0x48cc49[_0x1925('0x7')]('/api/mail/out_servers',require(_0x1925('0x37')));_0x48cc49[_0x1925('0x7')](_0x1925('0x38'),require(_0x1925('0x39')));_0x48cc49[_0x1925('0x7')](_0x1925('0x3a'),require('./api/mailQueue'));_0x48cc49[_0x1925('0x7')](_0x1925('0x3b'),require(_0x1925('0x3c')));_0x48cc49['use']('/api/mail/interactions',require(_0x1925('0x3d')));_0x48cc49[_0x1925('0x7')](_0x1925('0x3e'),require(_0x1925('0x3f')));_0x48cc49[_0x1925('0x7')]('/api/mail/applications',require(_0x1925('0x40')));_0x48cc49['use'](_0x1925('0x41'),require(_0x1925('0x42')));_0x48cc49[_0x1925('0x7')](_0x1925('0x43'),require(_0x1925('0x44')));_0x48cc49[_0x1925('0x7')](_0x1925('0x45'),require(_0x1925('0x46')));_0x48cc49['use']('/api/fax/accounts',require(_0x1925('0x47')));_0x48cc49[_0x1925('0x7')](_0x1925('0x48'),require(_0x1925('0x49')));_0x48cc49['use'](_0x1925('0x4a'),require('./api/faxInteraction'));_0x48cc49['use'](_0x1925('0x4b'),require('./api/faxMessage'));_0x48cc49[_0x1925('0x7')]('/api/fax/queues',require(_0x1925('0x4c')));_0x48cc49['use']('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x48cc49[_0x1925('0x7')]('/api/sms/accounts',require('./api/smsAccount'));_0x48cc49[_0x1925('0x7')](_0x1925('0x4d'),require(_0x1925('0x4e')));_0x48cc49[_0x1925('0x7')](_0x1925('0x4f'),require(_0x1925('0x50')));_0x48cc49['use'](_0x1925('0x51'),require(_0x1925('0x52')));_0x48cc49[_0x1925('0x7')]('/api/sms/queues',require('./api/smsQueue'));_0x48cc49[_0x1925('0x7')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x48cc49[_0x1925('0x7')]('/api/openchannel/applications',require(_0x1925('0x53')));_0x48cc49[_0x1925('0x7')](_0x1925('0x54'),require(_0x1925('0x55')));_0x48cc49[_0x1925('0x7')](_0x1925('0x56'),require(_0x1925('0x57')));_0x48cc49[_0x1925('0x7')](_0x1925('0x58'),require('./api/openchannelQueue'));_0x48cc49[_0x1925('0x7')](_0x1925('0x59'),require('./api/chatWebsite'));_0x48cc49[_0x1925('0x7')](_0x1925('0x5a'),require(_0x1925('0x5b')));_0x48cc49[_0x1925('0x7')](_0x1925('0x5c'),require('./api/chatApplication'));_0x48cc49[_0x1925('0x7')]('/api/chat/interactions',require(_0x1925('0x5d')));_0x48cc49[_0x1925('0x7')](_0x1925('0x5e'),require(_0x1925('0x5f')));_0x48cc49[_0x1925('0x7')]('/api/chat/offline_messages',require(_0x1925('0x60')));_0x48cc49[_0x1925('0x7')](_0x1925('0x61'),require(_0x1925('0x62')));_0x48cc49['use'](_0x1925('0x63'),require(_0x1925('0x64')));_0x48cc49[_0x1925('0x7')]('/api/chat/proactive_actions',require(_0x1925('0x65')));_0x48cc49['use'](_0x1925('0x66'),require('./api/cmCompany'));_0x48cc49[_0x1925('0x7')](_0x1925('0x67'),require('./api/cmContact'));_0x48cc49[_0x1925('0x7')](_0x1925('0x68'),require(_0x1925('0x69')));_0x48cc49['use']('/api/cm/hopper_black',require(_0x1925('0x6a')));_0x48cc49[_0x1925('0x7')](_0x1925('0x6b'),require('./api/cmHopperFinal'));_0x48cc49[_0x1925('0x7')](_0x1925('0x6c'),require(_0x1925('0x6d')));_0x48cc49[_0x1925('0x7')](_0x1925('0x6e'),require(_0x1925('0x6f')));_0x48cc49[_0x1925('0x7')](_0x1925('0x70'),require(_0x1925('0x71')));_0x48cc49['use']('/api/automations',require('./api/automation'));_0x48cc49[_0x1925('0x7')](_0x1925('0x72'),require(_0x1925('0x73')));_0x48cc49[_0x1925('0x7')](_0x1925('0x74'),require(_0x1925('0x75')));_0x48cc49[_0x1925('0x7')](_0x1925('0x76'),require(_0x1925('0x77')));_0x48cc49[_0x1925('0x7')](_0x1925('0x78'),require('./api/interval'));_0x48cc49[_0x1925('0x7')]('/api/pauses',require(_0x1925('0x79')));_0x48cc49[_0x1925('0x7')]('/api/cdr',require('./api/cdr'));_0x48cc49[_0x1925('0x7')](_0x1925('0x7a'),require(_0x1925('0x7b')));_0x48cc49[_0x1925('0x7')](_0x1925('0x7c'),require(_0x1925('0x7d')));_0x48cc49['use'](_0x1925('0x7e'),require(_0x1925('0x7f')));_0x48cc49[_0x1925('0x7')](_0x1925('0x80'),require('./api/tag'));_0x48cc49[_0x1925('0x7')](_0x1925('0x81'),require('./api/template'));_0x48cc49[_0x1925('0x7')]('/api/triggers',require(_0x1925('0x82')));_0x48cc49[_0x1925('0x7')](_0x1925('0x83'),require(_0x1925('0x84')));_0x48cc49['use']('/api/integrations',require(_0x1925('0x85')));_0x48cc49[_0x1925('0x7')](_0x1925('0x86'),require(_0x1925('0x87')));_0x48cc49[_0x1925('0x7')](_0x1925('0x88'),require('./api/analyticCustomReport'));_0x48cc49['use'](_0x1925('0x89'),require('./api/analyticDefaultReport'));_0x48cc49['use']('/api/analytics/extracted_reports',require(_0x1925('0x8a')));_0x48cc49[_0x1925('0x7')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x48cc49[_0x1925('0x7')](_0x1925('0x8b'),require(_0x1925('0x8c')));_0x48cc49[_0x1925('0x7')](_0x1925('0x8d'),require(_0x1925('0x8e')));_0x48cc49[_0x1925('0x7')]('/api/integrations/salesforce/accounts',require(_0x1925('0x8f')));_0x48cc49[_0x1925('0x7')]('/api/integrations/salesforce/configurations',require(_0x1925('0x90')));_0x48cc49['use'](_0x1925('0x91'),require(_0x1925('0x92')));_0x48cc49['use'](_0x1925('0x93'),require(_0x1925('0x94')));_0x48cc49['use'](_0x1925('0x95'),require('./api/intSugarcrmConfiguration'));_0x48cc49[_0x1925('0x7')](_0x1925('0x96'),require(_0x1925('0x97')));_0x48cc49['use']('/api/integrations/desk/accounts',require(_0x1925('0x98')));_0x48cc49['use'](_0x1925('0x99'),require(_0x1925('0x9a')));_0x48cc49['use']('/api/integrations/desk/fields',require(_0x1925('0x9b')));_0x48cc49[_0x1925('0x7')]('/api/integrations/zoho/accounts',require(_0x1925('0x9c')));_0x48cc49[_0x1925('0x7')](_0x1925('0x9d'),require('./api/intZohoConfiguration'));_0x48cc49[_0x1925('0x7')](_0x1925('0x9e'),require('./api/intZohoField'));_0x48cc49[_0x1925('0x7')]('/api/integrations/zendesk/accounts',require(_0x1925('0x9f')));_0x48cc49[_0x1925('0x7')](_0x1925('0xa0'),require(_0x1925('0xa1')));_0x48cc49[_0x1925('0x7')](_0x1925('0xa2'),require(_0x1925('0xa3')));_0x48cc49[_0x1925('0x7')](_0x1925('0xa4'),require(_0x1925('0xa5')));_0x48cc49[_0x1925('0x7')](_0x1925('0xa6'),require(_0x1925('0xa7')));_0x48cc49['use'](_0x1925('0xa8'),require(_0x1925('0xa9')));_0x48cc49[_0x1925('0x7')](_0x1925('0xaa'),require(_0x1925('0xab')));_0x48cc49[_0x1925('0x7')](_0x1925('0xac'),require('./api/intVtigerConfiguration'));_0x48cc49['use']('/api/integrations/vtiger/fields',require(_0x1925('0xad')));_0x48cc49[_0x1925('0x7')]('/api/integrations/servicenow/accounts',require(_0x1925('0xae')));_0x48cc49[_0x1925('0x7')](_0x1925('0xaf'),require('./api/intServicenowConfiguration'));_0x48cc49[_0x1925('0x7')](_0x1925('0xb0'),require(_0x1925('0xb1')));_0x48cc49[_0x1925('0x7')](_0x1925('0xb2'),require(_0x1925('0xb3')));_0x48cc49[_0x1925('0x7')](_0x1925('0xb4'),require('./api/intDynamics365Configuration'));_0x48cc49[_0x1925('0x7')](_0x1925('0xb5'),require(_0x1925('0xb6')));_0x48cc49['use'](_0x1925('0xb7'),require(_0x1925('0xb8')));_0x48cc49[_0x1925('0x7')](_0x1925('0xb9'),require('./api/intFreshsalesConfiguration'));_0x48cc49['use']('/api/integrations/freshsales/fields',require(_0x1925('0xba')));_0x48cc49['use'](_0x1925('0xbb'),require(_0x1925('0xbc')));_0x48cc49['use'](_0x1925('0xbd'),require(_0x1925('0xbe')));_0x48cc49[_0x1925('0x7')]('/api/chat/internal/messages',require(_0x1925('0xbf')));_0x48cc49[_0x1925('0x7')](_0x1925('0xc0'),require(_0x1925('0xc1')));_0x48cc49['use'](_0x1925('0xc2'),require(_0x1925('0xc3')));_0x48cc49[_0x1925('0x7')](_0x1925('0xc4'),require(_0x1925('0xc5')));_0x48cc49[_0x1925('0x7')](_0x1925('0xc6'),require(_0x1925('0xc7')));_0x48cc49[_0x1925('0x7')](_0x1925('0xc8'),require(_0x1925('0xc9')));_0x48cc49[_0x1925('0x7')](_0x1925('0xca'),require(_0x1925('0xcb')));_0x48cc49['use'](_0x1925('0xcc'),require(_0x1925('0xcd')));_0x48cc49['use'](_0x1925('0xce'),require(_0x1925('0xcf')));_0x48cc49[_0x1925('0x7')]('/api/square/odbc',require('./api/squareOdbc'));_0x48cc49[_0x1925('0x7')]('/api/square/projects',require(_0x1925('0xd0')));_0x48cc49['use']('/api/square/recordings',require(_0x1925('0xd1')));_0x48cc49[_0x1925('0x7')](_0x1925('0xd2'),require(_0x1925('0xd3')));_0x48cc49[_0x1925('0x7')](_0x1925('0xd4'),require(_0x1925('0xd5')));_0x48cc49[_0x1925('0x7')](_0x1925('0xd6'),require(_0x1925('0xd7')));_0x48cc49[_0x1925('0x7')](_0x1925('0xd8'),require(_0x1925('0xd9')));_0x48cc49[_0x1925('0x7')](_0x1925('0xda'),require(_0x1925('0xdb')));_0x48cc49['use']('/api/attachments',require('./api/attachment'));_0x48cc49['use'](_0x1925('0xdc'),require(_0x1925('0xdd')));_0x48cc49[_0x1925('0x7')](_0x1925('0xde'),require(_0x1925('0xdf')));_0x48cc49['use'](_0x1925('0xe0'),require(_0x1925('0xe1')));_0x48cc49[_0x1925('0x7')](_0x1925('0xe2'),require(_0x1925('0xe3')));_0x48cc49[_0x1925('0x7')](_0x1925('0xe4'),require('./api/openchannelTransferReport'));_0x48cc49[_0x1925('0x7')](_0x1925('0xe5'),require(_0x1925('0xe6')));_0x48cc49[_0x1925('0x7')](_0x1925('0xe7'),require(_0x1925('0xe8')));_0x48cc49[_0x1925('0x7')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x48cc49['use']('/api/userProfiles',require(_0x1925('0xe9')));_0x48cc49[_0x1925('0x7')](_0x1925('0xea'),require(_0x1925('0xeb')));_0x48cc49['use']('/api/userProfile/resources',require(_0x1925('0xec')));_0x48cc49[_0x1925('0x7')](_0x1925('0xed'),require(_0x1925('0xee')));_0x48cc49[_0x1925('0x7')](_0x1925('0xef'),require(_0x1925('0xf0')));_0x48cc49[_0x1925('0x7')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x48cc49[_0x1925('0x7')](_0x1925('0xf1'),require(_0x1925('0xf2')));_0x48cc49[_0x1925('0x7')]('/api/whatsapp/messages',require(_0x1925('0xf3')));_0x48cc49['use'](_0x1925('0xf4'),require(_0x1925('0xf5')));_0x48cc49[_0x1925('0x7')](_0x1925('0xf6'),require('./api/whatsappTransferReport'));_0x48cc49[_0x1925('0x7')](_0x1925('0xf7'),require(_0x1925('0xf8')));_0x48cc49[_0x1925('0x7')](_0x1925('0xf9'),require(_0x1925('0xfa')));_0x48cc49[_0x1925('0x7')]('/api/auth/local',require(_0x1925('0xfb')));_0x48cc49[_0x1925('0x7')](_0x1925('0xfc'),require(_0x1925('0xfd')));_0x48cc49[_0x1925('0x7')](_0x1925('0xfe'),require(_0x1925('0xff')));_0x48cc49[_0x1925('0x7')](_0x1925('0x100'),require('./api/rpc'));_0x48cc49[_0x1925('0x7')](_0x1925('0x101'),require(_0x1925('0x102')));_0x48cc49['use'](_0x1925('0x103'),require(_0x1925('0x104')));_0x48cc49[_0x1925('0x7')](_0x1925('0x105'),require('./api/pm2'));_0x48cc49[_0x1925('0x7')](_0x1925('0x106'),require(_0x1925('0x107')));_0x48cc49[_0x1925('0x7')](_0x1925('0x108'),express['static'](path[_0x1925('0x109')](config['root'],_0x1925('0x108'))));_0x48cc49['use'](_0x1925('0x10a'),express['static'](path[_0x1925('0x109')](config[_0x1925('0x10b')],_0x1925('0x10a'))));_0x48cc49[_0x1925('0x7')](_0x1925('0x10c'),express[_0x1925('0x10d')](path[_0x1925('0x109')](config[_0x1925('0x10b')],_0x1925('0x10c'))));_0x48cc49[_0x1925('0x7')]('/snippet',express[_0x1925('0x10d')](path[_0x1925('0x109')](config[_0x1925('0x10b')],_0x1925('0x10e'),_0x1925('0x10f'))));_0x48cc49[_0x1925('0x7')](_0x1925('0x110'),express[_0x1925('0x10d')](path[_0x1925('0x109')](config[_0x1925('0x10b')],'/server/files/plugins')));_0x48cc49[_0x1925('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x1925('0x112')](errors[0x194]);_0x48cc49[_0x1925('0x111')]('/*')[_0x1925('0x112')](function(_0x24b698,_0x1c4d96){_0x1c4d96[_0x1925('0x113')](path['resolve'](_0x48cc49['get'](_0x1925('0x114'))+_0x1925('0x115')));});}; \ No newline at end of file +var _0xfb58=['./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./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/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/campaign','./api/migration','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','/api/whatsapp/accounts','./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/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','static','root','/apidoc','/demo','snippet','1.0.16','/plugins','join','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','express-winston','util','./config/logger','api','auth','default','logger','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','agent_id','remoteAddress','device','other','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsApplication','/api/sms/interactions'];(function(_0x2db4c1,_0x3d87fd){var _0x3fe1c3=function(_0x85a2d2){while(--_0x85a2d2){_0x2db4c1['push'](_0x2db4c1['shift']());}};_0x3fe1c3(++_0x3d87fd);}(_0xfb58,0xcc));var _0x8fb5=function(_0x149f3a,_0xf89e6a){_0x149f3a=_0x149f3a-0x0;var _0x534f64=_0xfb58[_0x149f3a];return _0x534f64;};'use strict';var path=require(_0x8fb5('0x0'));var express=require('express');var ewinston=require(_0x8fb5('0x1'));var util=require(_0x8fb5('0x2'));var errors=require('./errors');var config=require('./config/environment');var logger=require(_0x8fb5('0x3'))(_0x8fb5('0x4'));var authLogger=require(_0x8fb5('0x3'))(_0x8fb5('0x5'));exports[_0x8fb5('0x6')]=function(_0x31bf10){_0x31bf10['use'](ewinston[_0x8fb5('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4100c2,_0x1c8de2){return util[_0x8fb5('0x8')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x4100c2[_0x8fb5('0x9')],_0x4100c2[_0x8fb5('0xa')][_0x8fb5('0xb')]?_0x4100c2[_0x8fb5('0xa')][_0x8fb5('0xb')]:_0x4100c2[_0x8fb5('0xc')]['remoteAddress']||_0x4100c2['ip'],_0x4100c2[_0x8fb5('0xd')],_0x1c8de2[_0x8fb5('0xe')],_0x1c8de2[_0x8fb5('0xf')],_0x4100c2[_0x8fb5('0x10')]?_0x4100c2['user']['id']:null,_0x4100c2['user']?_0x4100c2[_0x8fb5('0x10')][_0x8fb5('0x11')]:null,_0x4100c2[_0x8fb5('0x10')]?_0x4100c2[_0x8fb5('0x10')][_0x8fb5('0x12')]:null);}}));_0x31bf10[_0x8fb5('0x13')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x6bfebb,_0x55c101){var _0x3d8f40=_0x8fb5('0x14');if(_0x6bfebb['body']&&_0x6bfebb[_0x8fb5('0x15')]['device']&&_0x6bfebb['body'][_0x8fb5('0x16')]){_0x3d8f40='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x8fb5('0x8')](_0x3d8f40,_0x6bfebb[_0x8fb5('0x9')],_0x6bfebb['headers'][_0x8fb5('0xb')]?_0x6bfebb[_0x8fb5('0xa')][_0x8fb5('0xb')]:_0x6bfebb[_0x8fb5('0xc')][_0x8fb5('0x17')]||_0x6bfebb['ip'],_0x6bfebb[_0x8fb5('0xd')],_0x55c101[_0x8fb5('0xe')],_0x55c101['responseTime'],_0x6bfebb['user']?_0x6bfebb[_0x8fb5('0x10')]['id']:null,_0x6bfebb[_0x8fb5('0x10')]?_0x6bfebb['user'][_0x8fb5('0x11')]:null,_0x6bfebb[_0x8fb5('0x10')]?_0x6bfebb[_0x8fb5('0x10')][_0x8fb5('0x12')]:null,_0x6bfebb[_0x8fb5('0x15')]&&_0x6bfebb[_0x8fb5('0x15')][_0x8fb5('0x18')]?_0x6bfebb['body'][_0x8fb5('0x18')]:_0x8fb5('0x19'),_0x6bfebb['body']&&_0x6bfebb[_0x8fb5('0x15')][_0x8fb5('0x16')]?_0x6bfebb[_0x8fb5('0x15')][_0x8fb5('0x16')]:'',_0x6bfebb[_0x8fb5('0x15')]&&_0x6bfebb[_0x8fb5('0x15')][_0x8fb5('0x1a')]?_0x6bfebb[_0x8fb5('0x15')][_0x8fb5('0x1a')]:'');},'ignoreRoute':function(_0x1fdcec){var _0x55467b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x55467b[_0x8fb5('0x1b')](_0x1fdcec[_0x8fb5('0xd')]);}}));_0x31bf10[_0x8fb5('0x13')]('/api/users',require(_0x8fb5('0x1c')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x1d'),require('./api/voiceChanSpy'));_0x31bf10[_0x8fb5('0x13')]('/api/voice/contexts',require(_0x8fb5('0x1e')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x1f'),require(_0x8fb5('0x20')));_0x31bf10['use']('/api/voice/mohs',require(_0x8fb5('0x21')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x22'),require(_0x8fb5('0x23')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x24'),require(_0x8fb5('0x25')));_0x31bf10['use'](_0x8fb5('0x26'),require(_0x8fb5('0x27')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x28'),require('./api/voiceMail'));_0x31bf10[_0x8fb5('0x13')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x31bf10[_0x8fb5('0x13')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x29'),require(_0x8fb5('0x2a')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x2b'),require(_0x8fb5('0x2c')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x2d'),require('./api/voiceQueueReport'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x2e'),require(_0x8fb5('0x2f')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x30'),require(_0x8fb5('0x31')));_0x31bf10['use']('/api/voice/transfers/reports',require(_0x8fb5('0x32')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x33'),require(_0x8fb5('0x34')));_0x31bf10[_0x8fb5('0x13')]('/api/mail/accounts',require(_0x8fb5('0x35')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x36'),require('./api/mailQueue'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x37'),require(_0x8fb5('0x38')));_0x31bf10[_0x8fb5('0x13')]('/api/mail/interactions',require(_0x8fb5('0x39')));_0x31bf10[_0x8fb5('0x13')]('/api/mail/messages',require(_0x8fb5('0x3a')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x3b'),require(_0x8fb5('0x3c')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x3d'),require(_0x8fb5('0x3e')));_0x31bf10['use']('/api/dashboards',require(_0x8fb5('0x3f')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x40'),require(_0x8fb5('0x41')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x42'),require(_0x8fb5('0x43')));_0x31bf10[_0x8fb5('0x13')]('/api/fax/applications',require(_0x8fb5('0x44')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x45'),require('./api/faxInteraction'));_0x31bf10[_0x8fb5('0x13')]('/api/fax/messages',require(_0x8fb5('0x46')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x47'),require(_0x8fb5('0x48')));_0x31bf10[_0x8fb5('0x13')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x49'),require('./api/smsAccount'));_0x31bf10[_0x8fb5('0x13')]('/api/sms/applications',require(_0x8fb5('0x4a')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x4b'),require(_0x8fb5('0x4c')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x4d'),require(_0x8fb5('0x4e')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x4f'),require(_0x8fb5('0x50')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x51'),require('./api/openchannelAccount'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x52'),require(_0x8fb5('0x53')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x54'),require(_0x8fb5('0x55')));_0x31bf10['use'](_0x8fb5('0x56'),require(_0x8fb5('0x57')));_0x31bf10['use'](_0x8fb5('0x58'),require(_0x8fb5('0x59')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x5a'),require(_0x8fb5('0x5b')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x5c'),require(_0x8fb5('0x5d')));_0x31bf10[_0x8fb5('0x13')]('/api/chat/applications',require(_0x8fb5('0x5e')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x5f'),require(_0x8fb5('0x60')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x61'),require(_0x8fb5('0x62')));_0x31bf10[_0x8fb5('0x13')]('/api/chat/offline_messages',require(_0x8fb5('0x63')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x64'),require(_0x8fb5('0x65')));_0x31bf10['use'](_0x8fb5('0x66'),require(_0x8fb5('0x67')));_0x31bf10['use']('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x31bf10['use'](_0x8fb5('0x68'),require('./api/cmCompany'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x69'),require(_0x8fb5('0x6a')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x6b'),require(_0x8fb5('0x6c')));_0x31bf10['use']('/api/cm/hopper_black',require(_0x8fb5('0x6d')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x6e'),require('./api/cmHopperFinal'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x6f'),require('./api/cmHopperHistory'));_0x31bf10['use']('/api/cm/custom_fields',require(_0x8fb5('0x70')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x71'),require(_0x8fb5('0x72')));_0x31bf10['use'](_0x8fb5('0x73'),require(_0x8fb5('0x74')));_0x31bf10[_0x8fb5('0x13')]('/api/canned_answers',require(_0x8fb5('0x75')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x76'),require(_0x8fb5('0x77')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x78'),require(_0x8fb5('0x79')));_0x31bf10['use']('/api/intervals',require(_0x8fb5('0x7a')));_0x31bf10['use'](_0x8fb5('0x7b'),require('./api/pause'));_0x31bf10['use']('/api/cdr',require('./api/cdr'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x7c'),require(_0x8fb5('0x7d')));_0x31bf10['use'](_0x8fb5('0x7e'),require(_0x8fb5('0x7f')));_0x31bf10['use'](_0x8fb5('0x80'),require(_0x8fb5('0x81')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x82'),require(_0x8fb5('0x83')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x84'),require('./api/template'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x85'),require(_0x8fb5('0x86')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x87'),require('./api/variable'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x88'),require('./api/integration'));_0x31bf10['use'](_0x8fb5('0x89'),require(_0x8fb5('0x8a')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x8b'),require('./api/analyticCustomReport'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x8c'),require(_0x8fb5('0x8d')));_0x31bf10[_0x8fb5('0x13')]('/api/analytics/extracted_reports',require(_0x8fb5('0x8e')));_0x31bf10['use'](_0x8fb5('0x8f'),require(_0x8fb5('0x90')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x91'),require(_0x8fb5('0x92')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x93'),require(_0x8fb5('0x94')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x95'),require('./api/intSalesforceAccount'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x96'),require(_0x8fb5('0x97')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x98'),require(_0x8fb5('0x99')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x9a'),require(_0x8fb5('0x9b')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x9c'),require(_0x8fb5('0x9d')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x9e'),require(_0x8fb5('0x9f')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xa0'),require('./api/intDeskAccount'));_0x31bf10['use'](_0x8fb5('0xa1'),require('./api/intDeskConfiguration'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xa2'),require('./api/intDeskField'));_0x31bf10['use'](_0x8fb5('0xa3'),require(_0x8fb5('0xa4')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xa5'),require(_0x8fb5('0xa6')));_0x31bf10['use']('/api/integrations/zoho/fields',require(_0x8fb5('0xa7')));_0x31bf10['use'](_0x8fb5('0xa8'),require(_0x8fb5('0xa9')));_0x31bf10['use'](_0x8fb5('0xaa'),require(_0x8fb5('0xab')));_0x31bf10[_0x8fb5('0x13')]('/api/integrations/zendesk/fields',require(_0x8fb5('0xac')));_0x31bf10['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x31bf10[_0x8fb5('0x13')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x31bf10['use']('/api/integrations/freshdesk/fields',require(_0x8fb5('0xad')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xae'),require(_0x8fb5('0xaf')));_0x31bf10[_0x8fb5('0x13')]('/api/integrations/vtiger/configurations',require(_0x8fb5('0xb0')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xb1'),require(_0x8fb5('0xb2')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xb3'),require('./api/intServicenowAccount'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xb4'),require(_0x8fb5('0xb5')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xb6'),require(_0x8fb5('0xb7')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xb8'),require('./api/intDynamics365Account'));_0x31bf10['use'](_0x8fb5('0xb9'),require('./api/intDynamics365Configuration'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xba'),require('./api/intDynamics365Field'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xbb'),require(_0x8fb5('0xbc')));_0x31bf10['use'](_0x8fb5('0xbd'),require(_0x8fb5('0xbe')));_0x31bf10['use'](_0x8fb5('0xbf'),require(_0x8fb5('0xc0')));_0x31bf10[_0x8fb5('0x13')]('/api/networks',require(_0x8fb5('0xc1')));_0x31bf10[_0x8fb5('0x13')]('/api/chat/reports/queue',require(_0x8fb5('0xc2')));_0x31bf10[_0x8fb5('0x13')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xc3'),require(_0x8fb5('0xc4')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xc5'),require(_0x8fb5('0xc6')));_0x31bf10[_0x8fb5('0x13')]('/api/jscripty/sessions/reports',require(_0x8fb5('0xc7')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xc8'),require(_0x8fb5('0xc9')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xca'),require('./api/squareReport'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xcb'),require('./api/squareReportDetail'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xcc'),require(_0x8fb5('0xcd')));_0x31bf10['use'](_0x8fb5('0xce'),require(_0x8fb5('0xcf')));_0x31bf10[_0x8fb5('0x13')]('/api/square/odbc',require(_0x8fb5('0xd0')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xd1'),require('./api/squareProject'));_0x31bf10['use'](_0x8fb5('0xd2'),require(_0x8fb5('0xd3')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xd4'),require(_0x8fb5('0xd5')));_0x31bf10[_0x8fb5('0x13')]('/api/teams',require(_0x8fb5('0xd6')));_0x31bf10['use'](_0x8fb5('0xd7'),require('./api/license'));_0x31bf10[_0x8fb5('0x13')]('/api/campaigns',require(_0x8fb5('0xd8')));_0x31bf10['use']('/api/migrations',require(_0x8fb5('0xd9')));_0x31bf10['use']('/api/attachments',require('./api/attachment'));_0x31bf10['use'](_0x8fb5('0xda'),require(_0x8fb5('0xdb')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xdc'),require(_0x8fb5('0xdd')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xde'),require('./api/chatTransferReport'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xdf'),require(_0x8fb5('0xe0')));_0x31bf10['use'](_0x8fb5('0xe1'),require(_0x8fb5('0xe2')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xe3'),require(_0x8fb5('0xe4')));_0x31bf10['use'](_0x8fb5('0xe5'),require(_0x8fb5('0xe6')));_0x31bf10[_0x8fb5('0x13')]('/api/voice/prefixes',require(_0x8fb5('0xe7')));_0x31bf10[_0x8fb5('0x13')]('/api/userProfiles',require(_0x8fb5('0xe8')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xe9'),require(_0x8fb5('0xea')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xeb'),require(_0x8fb5('0xec')));_0x31bf10['use'](_0x8fb5('0xed'),require('./api/notification'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xee'),require(_0x8fb5('0xef')));_0x31bf10['use'](_0x8fb5('0xf0'),require(_0x8fb5('0xf1')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xf2'),require(_0x8fb5('0xf3')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xf4'),require(_0x8fb5('0xf5')));_0x31bf10['use'](_0x8fb5('0xf6'),require(_0x8fb5('0xf7')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xf8'),require(_0x8fb5('0xf9')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xfa'),require('./api/whatsappQueue'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xfb'),require(_0x8fb5('0xfc')));_0x31bf10['use']('/api/auth/local',require('./api/authLocal'));_0x31bf10[_0x8fb5('0x13')]('/api/auth/google',require(_0x8fb5('0xfd')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0xfe'),require(_0x8fb5('0xff')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x100'),require(_0x8fb5('0x101')));_0x31bf10['use'](_0x8fb5('0x102'),require(_0x8fb5('0x103')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x104'),require(_0x8fb5('0x105')));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x106'),require('./api/pm2'));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x107'),require(_0x8fb5('0x108')));_0x31bf10[_0x8fb5('0x13')]('/apidoc',express[_0x8fb5('0x109')](path['join'](config[_0x8fb5('0x10a')],_0x8fb5('0x10b'))));_0x31bf10[_0x8fb5('0x13')]('/www',express[_0x8fb5('0x109')](path['join'](config[_0x8fb5('0x10a')],'/www')));_0x31bf10[_0x8fb5('0x13')]('/demo',express[_0x8fb5('0x109')](path['join'](config[_0x8fb5('0x10a')],_0x8fb5('0x10c'))));_0x31bf10[_0x8fb5('0x13')]('/snippet',express[_0x8fb5('0x109')](path['join'](config[_0x8fb5('0x10a')],_0x8fb5('0x10d'),_0x8fb5('0x10e'))));_0x31bf10[_0x8fb5('0x13')](_0x8fb5('0x10f'),express['static'](path[_0x8fb5('0x110')](config[_0x8fb5('0x10a')],_0x8fb5('0x111'))));_0x31bf10[_0x8fb5('0x112')](_0x8fb5('0x113'))['get'](errors[0x194]);_0x31bf10[_0x8fb5('0x112')]('/*')[_0x8fb5('0x114')](function(_0x2b24ab,_0x59bf5b){_0x59bf5b[_0x8fb5('0x115')](path['resolve'](_0x31bf10['get'](_0x8fb5('0x116'))+_0x8fb5('0x117')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 5b4945a..dd748be 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x804b=['../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/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','error','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.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/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc'];(function(_0x21ce2b,_0x5d7e90){var _0x1ac2be=function(_0x4219c6){while(--_0x4219c6){_0x21ce2b['push'](_0x21ce2b['shift']());}};_0x1ac2be(++_0x5d7e90);}(_0x804b,0x12f));var _0xb804=function(_0x54d28f,_0x55165c){_0x54d28f=_0x54d28f-0x0;var _0x5c0a99=_0x804b[_0x54d28f];return _0x5c0a99;};'use strict';var jayson=require(_0xb804('0x0'));var BPromise=require(_0xb804('0x1'));var _=require('lodash');var config=require(_0xb804('0x2'));exports[_0xb804('0x3')]=function(){return new BPromise(function(_0x842fe1,_0x448198){var _0x6c9554={};_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x4')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x5')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x7')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require('../api/voiceRecording/voiceRecording.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x8')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x6c9554=_['merge'](_0x6c9554,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x9')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0xa')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0xb')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0xc')));_0x6c9554=_['merge'](_0x6c9554,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0xd')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0xe')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0xf')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x10')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x11')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x12')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x13')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x14')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x15')));_0x6c9554=_['merge'](_0x6c9554,require('../api/faxInteraction/faxInteraction.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x16')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x17')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x18')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require('../api/smsAccount/smsAccount.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x19')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x1a')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x1b')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x6c9554=_['merge'](_0x6c9554,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x1c')));_0x6c9554=_['merge'](_0x6c9554,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x1d')));_0x6c9554=_['merge'](_0x6c9554,require('../api/chatInteraction/chatInteraction.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x1e')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x1f')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x20')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x21')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x22')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x23')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x24')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x25')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x26')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x27')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require('../api/sound/sound.rpc'));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x28')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x29')));_0x6c9554=_['merge'](_0x6c9554,require('../api/variable/variable.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x2a')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x2b')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x2c')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x2d')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x2e')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x2f')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x30')));_0x6c9554=_['merge'](_0x6c9554,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x31')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x32')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x33')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x34')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x35')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x36')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x37')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x38')));_0x6c9554=_['merge'](_0x6c9554,require(_0xb804('0x39')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x3a')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x3b')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x3c')));_0x6c9554=_[_0xb804('0x6')](_0x6c9554,require(_0xb804('0x3d')));_0x6c9554=_['merge'](_0x6c9554,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x4ce418=jayson['server'](_0x6c9554)[_0xb804('0x3e')]();var _0x355088=config[_0xb804('0x3f')][_0xb804('0x40')]||config[_0xb804('0x40')]+0x1;var _0x573648=config[_0xb804('0x3f')]['ip']||_0xb804('0x41');_0x4ce418['on'](_0xb804('0x42'),function(_0x22683f){return _0x448198(_0x22683f);});_0x4ce418[_0xb804('0x3')](_0x355088,_0x573648,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x573648,_0x355088);require('../config/triggers')[_0xb804('0x43')]();return _0x842fe1(_0xb804('0x44')+_0x573648+':'+_0x355088);});});}; \ No newline at end of file +var _0x8e9a=['../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.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/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc'];(function(_0x1e8183,_0x26eae8){var _0xc2a839=function(_0x3dc673){while(--_0x3dc673){_0x1e8183['push'](_0x1e8183['shift']());}};_0xc2a839(++_0x26eae8);}(_0x8e9a,0x1ac));var _0xa8e9=function(_0x126590,_0x3d616f){_0x126590=_0x126590-0x0;var _0x31d849=_0x8e9a[_0x126590];return _0x31d849;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa8e9('0x0'));var _=require(_0xa8e9('0x1'));var config=require(_0xa8e9('0x2'));exports[_0xa8e9('0x3')]=function(){return new BPromise(function(_0x19ee42,_0x1c83d2){var _0x1ad2dc={};_0x1ad2dc=_['merge'](_0x1ad2dc,require(_0xa8e9('0x4')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x6')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/voiceQueue/voiceQueue.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x7')));_0x1ad2dc=_['merge'](_0x1ad2dc,require(_0xa8e9('0x8')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x9')));_0x1ad2dc=_['merge'](_0x1ad2dc,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0xa')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0xb')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0xc')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1ad2dc=_['merge'](_0x1ad2dc,require(_0xa8e9('0xd')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0xe')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0xf')));_0x1ad2dc=_['merge'](_0x1ad2dc,require('../api/mailQueue/mailQueue.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x10')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/mailMessage/mailMessage.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x11')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x12')));_0x1ad2dc=_['merge'](_0x1ad2dc,require('../api/faxAccount/faxAccount.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x13')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x14')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/faxMessage/faxMessage.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x15')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x16')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x17')));_0x1ad2dc=_['merge'](_0x1ad2dc,require(_0xa8e9('0x18')));_0x1ad2dc=_['merge'](_0x1ad2dc,require('../api/smsMessage/smsMessage.rpc'));_0x1ad2dc=_['merge'](_0x1ad2dc,require(_0xa8e9('0x19')));_0x1ad2dc=_['merge'](_0x1ad2dc,require(_0xa8e9('0x1a')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x1b')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x1c')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x1d')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x1e')));_0x1ad2dc=_['merge'](_0x1ad2dc,require('../api/cmContact/cmContact.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x1f')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x20')));_0x1ad2dc=_['merge'](_0x1ad2dc,require(_0xa8e9('0x21')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x22')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x23')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/interval/interval.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x24')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x25')));_0x1ad2dc=_['merge'](_0x1ad2dc,require('../api/template/template.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/trigger/trigger.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x26')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x27')));_0x1ad2dc=_['merge'](_0x1ad2dc,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1ad2dc=_['merge'](_0x1ad2dc,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x28')));_0x1ad2dc=_['merge'](_0x1ad2dc,require(_0xa8e9('0x29')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x2a')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1ad2dc=_['merge'](_0x1ad2dc,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x2b')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x2c')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x2d')));_0x1ad2dc=_['merge'](_0x1ad2dc,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x2e')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x2f')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x30')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x31')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x32')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x33')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/campaign/campaign.rpc'));_0x1ad2dc=_['merge'](_0x1ad2dc,require(_0xa8e9('0x34')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x35')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x36')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x37')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x38')));_0x1ad2dc=_[_0xa8e9('0x5')](_0x1ad2dc,require(_0xa8e9('0x39')));var _0x151734=jayson[_0xa8e9('0x3a')](_0x1ad2dc)[_0xa8e9('0x3b')]();var _0x244125=config['rpc'][_0xa8e9('0x3c')]||config['port']+0x1;var _0x49dab5=config[_0xa8e9('0x3d')]['ip']||_0xa8e9('0x3e');_0x151734['on'](_0xa8e9('0x3f'),function(_0x1dedee){return _0x1c83d2(_0x1dedee);});_0x151734[_0xa8e9('0x3')](_0x244125,_0x49dab5,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x49dab5,_0x244125);require(_0xa8e9('0x40'))[_0xa8e9('0x41')]();return _0x19ee42(_0xa8e9('0x42')+_0x49dab5+':'+_0x244125);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 604eb92..e23822a 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 _0xbf07=['toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','result=','indexOf','substr','startsWith','split','length','E_AGI_SOCKET_ERROR','code','close','emit','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','command=','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','log','recordFile','streamFile','agi','AGI','wait','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','events','call','setEncoding','utf8','setTimeout','headers'];(function(_0x4dddad,_0x42dfdf){var _0xc0a464=function(_0x37b2a9){while(--_0x37b2a9){_0x4dddad['push'](_0x4dddad['shift']());}};_0xc0a464(++_0x42dfdf);}(_0xbf07,0x1b5));var _0x7bf0=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xbf07[_0x8c43de];return _0xa6591b;};'use strict';var util=require(_0x7bf0('0x0'));var _=require('lodash');var EventEmitter=require(_0x7bf0('0x1'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x56ddca){var _0x456676=this,_0x3b5442=new AGIReply(),_0x440a7d=![],_0x5ad204={};EventEmitter[_0x7bf0('0x2')](_0x456676);_0x56ddca[_0x7bf0('0x3')](_0x7bf0('0x4'));_0x56ddca[_0x7bf0('0x5')](0x8*0x3c*0x3c*0x3e8);_0x3b5442[_0x7bf0('0x3')](_0x7bf0('0x4'));_0x3b5442['on'](_0x7bf0('0x6'),function(_0x3a2f8a){for(var _0x2dadb2 in _0x3a2f8a){_0x456676[_0x2dadb2]=_0x3a2f8a[_0x2dadb2];}_0x456676['emit']('ready');});_0x3b5442['on']('line',function(_0x387ca1){if(_0x387ca1[_0x7bf0('0x7')]()=='hangup'){_0x456676['emit'](_0x7bf0('0x8'));return;}if(_0x387ca1[_0x7bf0('0x9')](0x0,0xb)==_0x7bf0('0xa')){_0x440a7d=!![];}if(_0x440a7d){_0x5ad204['rx']+=_0x387ca1+'\x0a';if(_0x387ca1[_0x7bf0('0xb')]('520\x20End\x20of\x20proper')!=-0x1){_0x440a7d=![];}}else{_0x5ad204['rx']=_0x387ca1;}if(_0x440a7d){return;}if(typeof _0x5ad204['cb']==_0x7bf0('0xc')){var _0x3b7d62=_0x5ad204['rx'][_0x7bf0('0x9')](0x0,0x3),_0x3c5a48=null,_0x1beebd=null;_0x3b7d62=parseInt(_0x3b7d62);if(isNaN(_0x3b7d62)){_0x5ad204['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7bf0('0xd')});return;}if(_0x3b7d62!=0xc8){_0x5ad204['cb'](null,{'code':_0x3b7d62,'result':-0x1,'extra':'KO'});return;}_0x3c5a48=_0x5ad204['rx'][_0x7bf0('0x9')](0x4)['replace'](_0x7bf0('0xe'),'');if(_0x3c5a48[_0x7bf0('0xf')]('\x20')!=-0x1){_0x3c5a48=_0x3c5a48[_0x7bf0('0x10')](0x0,_0x3c5a48[_0x7bf0('0xf')]('\x20'));}if(_[_0x7bf0('0x11')](_0x3c5a48,'-1')){_0x3c5a48=parseInt(_0x3c5a48);}_0x1beebd=_0x5ad204['rx'][_0x7bf0('0x12')]('\x20');if(_0x1beebd[_0x7bf0('0x13')]==0x3){_0x1beebd=_0x1beebd[0x2]['substring'](0x1,_0x1beebd[0x2][_0x7bf0('0x13')]-0x1);}else if(_0x1beebd[_0x7bf0('0x13')]>0x3){var _0x1827b4=/\((.+)\)/;var _0x208f23=_0x5ad204['rx']['match'](_0x1827b4);if(_0x208f23){_0x1beebd=_0x208f23[0x1];}else{_0x1beebd=null;}}else{_0x1beebd=null;}_0x5ad204['cb'](null,{'code':_0x3b7d62,'result':_0x3c5a48,'extra':_0x1beebd});}});_0x56ddca['on']('error',function(_0x2b1c95){_0x456676['emit']('error',new AGIError(_0x7bf0('0x14'),_0x2b1c95[_0x7bf0('0x15')]));});_0x56ddca['on'](_0x7bf0('0x16'),function(){_0x456676[_0x7bf0('0x17')](_0x7bf0('0x16'),new AGIError(_0x7bf0('0x18')));});_0x56ddca['on'](_0x7bf0('0x19'),function(){_0x456676[_0x7bf0('0x17')]('timeout',new AGIError(_0x7bf0('0x1a')));_0x56ddca[_0x7bf0('0x1b')]();});_0x56ddca['pipe'](_0x3b5442);this[_0x7bf0('0x1c')]=function(_0x1faf3b,_0x2a0ebf){console['log'](_0x7bf0('0x1d'),_0x1faf3b);var _0x1faf3b=_0x1faf3b||'',_0x2a0ebf=typeof _0x2a0ebf==_0x7bf0('0xc')?_0x2a0ebf:new Function();_0x5ad204={'tx':_0x1faf3b,'rx':'','cb':_0x2a0ebf};_0x56ddca[_0x7bf0('0x1e')](_0x1faf3b+'\x0a');},this[_0x7bf0('0x16')]=function(){_0x56ddca[_0x7bf0('0x1b')]();};}util[_0x7bf0('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x21')]=function(_0x6f88c6){return this[_0x7bf0('0x1c')][_0x7bf0('0x22')](this,_0x6f88c6);};AGIChannel['prototype'][_0x7bf0('0x23')]=function(){return this[_0x7bf0('0x21')](_0x7bf0('0x24'));};AGIChannel['prototype'][_0x7bf0('0x25')]=function(_0x2460c2,_0x14dc41,_0x136771){_0x2460c2=_0x2460c2===undefined?_0x7bf0('0x26'):_0x2460c2;_0x14dc41=_0x14dc41===undefined?'5':_0x14dc41;_0x136771=_0x136771===undefined?'1':_0x136771;return this[_0x7bf0('0x21')](util[_0x7bf0('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2460c2,_0x14dc41*0x3e8,_0x136771));};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x28')]=function(_0x568be0){_0x568be0=_0x568be0||_0x7bf0('0x29');return this[_0x7bf0('0x21')](util[_0x7bf0('0x27')](_0x7bf0('0x2a'),_0x568be0));};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x2b')]=function(_0x17f448,_0x2ac33d){if(_[_0x7bf0('0x2c')](_0x2ac33d)){return this[_0x7bf0('0x21')](util[_0x7bf0('0x27')](_0x7bf0('0x2d'),_0x17f448,_0x2ac33d[_0x7bf0('0x2e')](',')));}return this[_0x7bf0('0x21')](util[_0x7bf0('0x27')]('EXEC\x20%s\x20%s',_0x17f448,_0x2ac33d));};AGIChannel[_0x7bf0('0x20')]['setContext']=function(_0x37978b){return this[_0x7bf0('0x21')](util['format']('SET\x20CONTEXT\x20%s',_0x37978b));};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x2f')]=function(_0x52858f){return this['sendRequest'](util[_0x7bf0('0x27')](_0x7bf0('0x30'),_0x52858f));};AGIChannel['prototype'][_0x7bf0('0x31')]=function(_0x2b3b87){return this['sendRequest'](util[_0x7bf0('0x27')](_0x7bf0('0x32'),_0x2b3b87));};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x8')]=function(){return this[_0x7bf0('0x21')](_0x7bf0('0x33'));};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x34')]=function(_0x5c976a,_0x2cab73){var _0x54f5af=_[_0x7bf0('0x35')](_0x2cab73)||_['isNumber'](_0x2cab73)?_0x2cab73[_0x7bf0('0x36')]():_0x2cab73;return this[_0x7bf0('0x21')](util[_0x7bf0('0x27')](_0x7bf0('0x37'),_0x5c976a,_0x54f5af?_0x54f5af[_0x7bf0('0x36')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x38')]=function(_0x488b13,_0xd8b39e){return this[_0x7bf0('0x21')](util[_0x7bf0('0x27')](_0x7bf0('0x39'),_0x488b13,_0xd8b39e));};AGIChannel['prototype'][_0x7bf0('0x3a')]=function(_0x1ff2f9,_0x48e49d){return this[_0x7bf0('0x21')](util[_0x7bf0('0x27')](_0x7bf0('0x3b'),_0x1ff2f9,_0x48e49d));};AGIChannel['prototype'][_0x7bf0('0x3c')]=function(_0x1012c8,_0x138453){return this['sendRequest'](util['format'](_0x7bf0('0x3d'),_0x1012c8,_0x138453));};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x3e')]=function(_0xb355a2,_0x545b40,_0x19e1bd){_0x545b40=_0x545b40||this['extension'];_0x19e1bd=_0x19e1bd||0x1;this[_0x7bf0('0x3f')](_0xb355a2);this['setExtension'](_0x545b40);this['setPriority'](_0x19e1bd);return this['noop'](util['format']('GOTO\x20%s\x20%s\x20%s',_0xb355a2,_0x545b40,_0x19e1bd));};AGIChannel['prototype']['getVariable']=function(_0x4f27f0){console[_0x7bf0('0x40')]('getvariable',_0x4f27f0);return this[_0x7bf0('0x21')](util[_0x7bf0('0x27')]('GET\x20VARIABLE\x20\x22%s\x22',_0x4f27f0));};AGIChannel['prototype'][_0x7bf0('0x41')]=function(_0x21fbac,_0x54c885,_0xfe09df,_0x3b3d98,_0x559516,_0x4910af){_0x54c885=_0x54c885||'wav';_0xfe09df=_0xfe09df||'';_0x3b3d98=_0x3b3d98===undefined?-0x1:_0x3b3d98==='-1'?-0x1:_0x3b3d98*0x3e8;_0x559516=_0x559516===undefined?'':'s='+_0x559516;_0x4910af=_0x4910af?'BEEP':'';return this['sendRequest'](util[_0x7bf0('0x27')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x21fbac,_0x54c885,_0xfe09df,_0x3b3d98,_0x4910af,_0x559516));};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x42')]=function(_0x24144d,_0x7500f7){_0x7500f7=_0x7500f7||'';return this[_0x7bf0('0x21')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x24144d,_0x7500f7));};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x43')]=function(_0x435add){return this[_0x7bf0('0x2b')](_0x7bf0('0x44'),_0x435add);};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x45')]=function(_0x52b38b){return this[_0x7bf0('0x2b')](_0x7bf0('0x46'),_0x52b38b);};AGIChannel[_0x7bf0('0x20')][_0x7bf0('0x47')]=function(_0x16da2b,_0x2ee557){this[_0x7bf0('0x28')](util[_0x7bf0('0x27')](_0x7bf0('0x48'),_0x16da2b['id'],_0x16da2b['label'],_0x2ee557));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7bf0('0x49')]=AGIChannel; \ No newline at end of file +var _0xadf1=['function','no\x20code','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','command=','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','noop','exec','isArray','format','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setContext','getVariable','log','getvariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','exports','events','./reply','./error','utf8','setTimeout','headers','ready','line','toLowerCase','emit','hangup','substring','520-Invalid','520\x20End\x20of\x20proper'];(function(_0x34134f,_0x467b97){var _0x40e107=function(_0x310d6e){while(--_0x310d6e){_0x34134f['push'](_0x34134f['shift']());}};_0x40e107(++_0x467b97);}(_0xadf1,0x84));var _0x1adf=function(_0x3d7231,_0x2c2f06){_0x3d7231=_0x3d7231-0x0;var _0x84ae01=_0xadf1[_0x3d7231];return _0x84ae01;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1adf('0x0'))['EventEmitter'];var AGIReply=require(_0x1adf('0x1'));var AGIError=require(_0x1adf('0x2'));function AGIChannel(_0x27ad38){var _0x318146=this,_0x18e4d8=new AGIReply(),_0x61d49f=![],_0x509f07={};EventEmitter['call'](_0x318146);_0x27ad38['setEncoding'](_0x1adf('0x3'));_0x27ad38[_0x1adf('0x4')](0x8*0x3c*0x3c*0x3e8);_0x18e4d8['setEncoding'](_0x1adf('0x3'));_0x18e4d8['on'](_0x1adf('0x5'),function(_0x258f4e){for(var _0x5b00f1 in _0x258f4e){_0x318146[_0x5b00f1]=_0x258f4e[_0x5b00f1];}_0x318146['emit'](_0x1adf('0x6'));});_0x18e4d8['on'](_0x1adf('0x7'),function(_0xa9279a){if(_0xa9279a[_0x1adf('0x8')]()=='hangup'){_0x318146[_0x1adf('0x9')](_0x1adf('0xa'));return;}if(_0xa9279a[_0x1adf('0xb')](0x0,0xb)==_0x1adf('0xc')){_0x61d49f=!![];}if(_0x61d49f){_0x509f07['rx']+=_0xa9279a+'\x0a';if(_0xa9279a['search'](_0x1adf('0xd'))!=-0x1){_0x61d49f=![];}}else{_0x509f07['rx']=_0xa9279a;}if(_0x61d49f){return;}if(typeof _0x509f07['cb']==_0x1adf('0xe')){var _0x3db2b9=_0x509f07['rx'][_0x1adf('0xb')](0x0,0x3),_0x28f5ef=null,_0x43aedd=null;_0x3db2b9=parseInt(_0x3db2b9);if(isNaN(_0x3db2b9)){_0x509f07['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1adf('0xf')});return;}if(_0x3db2b9!=0xc8){_0x509f07['cb'](null,{'code':_0x3db2b9,'result':-0x1,'extra':'KO'});return;}_0x28f5ef=_0x509f07['rx'][_0x1adf('0xb')](0x4)['replace'](_0x1adf('0x10'),'');if(_0x28f5ef[_0x1adf('0x11')]('\x20')!=-0x1){_0x28f5ef=_0x28f5ef[_0x1adf('0x12')](0x0,_0x28f5ef['indexOf']('\x20'));}if(_[_0x1adf('0x13')](_0x28f5ef,'-1')){_0x28f5ef=parseInt(_0x28f5ef);}_0x43aedd=_0x509f07['rx'][_0x1adf('0x14')]('\x20');if(_0x43aedd[_0x1adf('0x15')]==0x3){_0x43aedd=_0x43aedd[0x2][_0x1adf('0xb')](0x1,_0x43aedd[0x2][_0x1adf('0x15')]-0x1);}else if(_0x43aedd[_0x1adf('0x15')]>0x3){var _0x2a4d06=/\((.+)\)/;var _0x4278bc=_0x509f07['rx']['match'](_0x2a4d06);if(_0x4278bc){_0x43aedd=_0x4278bc[0x1];}else{_0x43aedd=null;}}else{_0x43aedd=null;}_0x509f07['cb'](null,{'code':_0x3db2b9,'result':_0x28f5ef,'extra':_0x43aedd});}});_0x27ad38['on'](_0x1adf('0x16'),function(_0x3a592b){_0x318146[_0x1adf('0x9')](_0x1adf('0x16'),new AGIError(_0x1adf('0x17'),_0x3a592b['code']));});_0x27ad38['on'](_0x1adf('0x18'),function(){_0x318146['emit'](_0x1adf('0x18'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x27ad38['on']('timeout',function(){_0x318146['emit'](_0x1adf('0x19'),new AGIError(_0x1adf('0x1a')));_0x27ad38[_0x1adf('0x1b')]();});_0x27ad38[_0x1adf('0x1c')](_0x18e4d8);this[_0x1adf('0x1d')]=function(_0x4320c8,_0x978385){console['log'](_0x1adf('0x1e'),_0x4320c8);var _0x4320c8=_0x4320c8||'',_0x978385=typeof _0x978385==_0x1adf('0xe')?_0x978385:new Function();_0x509f07={'tx':_0x4320c8,'rx':'','cb':_0x978385};_0x27ad38[_0x1adf('0x1f')](_0x4320c8+'\x0a');},this[_0x1adf('0x18')]=function(){_0x27ad38[_0x1adf('0x1b')]();};}util[_0x1adf('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x1adf('0x21')][_0x1adf('0x22')]=function(_0x573eaf){return this[_0x1adf('0x1d')][_0x1adf('0x23')](this,_0x573eaf);};AGIChannel[_0x1adf('0x21')][_0x1adf('0x24')]=function(){return this[_0x1adf('0x22')](_0x1adf('0x25'));};AGIChannel[_0x1adf('0x21')][_0x1adf('0x26')]=function(_0x42ab59,_0x3ce979,_0x4241e6){_0x42ab59=_0x42ab59===undefined?_0x1adf('0x27'):_0x42ab59;_0x3ce979=_0x3ce979===undefined?'5':_0x3ce979;_0x4241e6=_0x4241e6===undefined?'1':_0x4241e6;return this[_0x1adf('0x22')](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x42ab59,_0x3ce979*0x3e8,_0x4241e6));};AGIChannel[_0x1adf('0x21')][_0x1adf('0x28')]=function(_0x5593b8){_0x5593b8=_0x5593b8||'NO\x20MESSAGE';return this[_0x1adf('0x22')](util['format']('VERBOSE\x20\x22%s\x22',_0x5593b8));};AGIChannel['prototype'][_0x1adf('0x29')]=function(_0x21a79c,_0xfb1295){if(_[_0x1adf('0x2a')](_0xfb1295)){return this[_0x1adf('0x22')](util[_0x1adf('0x2b')]('EXEC\x20%s\x20%s',_0x21a79c,_0xfb1295['join'](',')));}return this['sendRequest'](util[_0x1adf('0x2b')](_0x1adf('0x2c'),_0x21a79c,_0xfb1295));};AGIChannel[_0x1adf('0x21')]['setContext']=function(_0x268f9a){return this[_0x1adf('0x22')](util[_0x1adf('0x2b')]('SET\x20CONTEXT\x20%s',_0x268f9a));};AGIChannel['prototype'][_0x1adf('0x2d')]=function(_0x5d0cdf){return this['sendRequest'](util[_0x1adf('0x2b')](_0x1adf('0x2e'),_0x5d0cdf));};AGIChannel[_0x1adf('0x21')][_0x1adf('0x2f')]=function(_0x5755b4){return this[_0x1adf('0x22')](util[_0x1adf('0x2b')](_0x1adf('0x30'),_0x5755b4));};AGIChannel['prototype']['hangup']=function(){return this[_0x1adf('0x22')](_0x1adf('0x31'));};AGIChannel[_0x1adf('0x21')]['setVariable']=function(_0x142375,_0x3c311d){var _0x3dbccd=_[_0x1adf('0x32')](_0x3c311d)||_[_0x1adf('0x33')](_0x3c311d)?_0x3c311d[_0x1adf('0x34')]():_0x3c311d;return this[_0x1adf('0x22')](util[_0x1adf('0x2b')](_0x1adf('0x35'),_0x142375,_0x3dbccd?_0x3dbccd['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1adf('0x21')]['sayNumber']=function(_0x45c58d,_0x399787){return this[_0x1adf('0x22')](util[_0x1adf('0x2b')](_0x1adf('0x36'),_0x45c58d,_0x399787));};AGIChannel[_0x1adf('0x21')]['sayDigits']=function(_0x49a9ac,_0x1a3062){return this['sendRequest'](util['format'](_0x1adf('0x37'),_0x49a9ac,_0x1a3062));};AGIChannel[_0x1adf('0x21')][_0x1adf('0x38')]=function(_0x2225bf,_0x1df1e6){return this[_0x1adf('0x22')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2225bf,_0x1df1e6));};AGIChannel['prototype'][_0x1adf('0x39')]=function(_0x39799a,_0x1d9d05,_0x20e237){_0x1d9d05=_0x1d9d05||this[_0x1adf('0x3a')];_0x20e237=_0x20e237||0x1;this[_0x1adf('0x3b')](_0x39799a);this[_0x1adf('0x2d')](_0x1d9d05);this[_0x1adf('0x2f')](_0x20e237);return this[_0x1adf('0x28')](util[_0x1adf('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x39799a,_0x1d9d05,_0x20e237));};AGIChannel['prototype'][_0x1adf('0x3c')]=function(_0x5e9992){console[_0x1adf('0x3d')](_0x1adf('0x3e'),_0x5e9992);return this[_0x1adf('0x22')](util[_0x1adf('0x2b')](_0x1adf('0x3f'),_0x5e9992));};AGIChannel['prototype'][_0x1adf('0x40')]=function(_0x16255e,_0x1c8241,_0x8df757,_0xa3ced6,_0x12faa8,_0xd4aa04){_0x1c8241=_0x1c8241||_0x1adf('0x41');_0x8df757=_0x8df757||'';_0xa3ced6=_0xa3ced6===undefined?-0x1:_0xa3ced6==='-1'?-0x1:_0xa3ced6*0x3e8;_0x12faa8=_0x12faa8===undefined?'':'s='+_0x12faa8;_0xd4aa04=_0xd4aa04?_0x1adf('0x42'):'';return this[_0x1adf('0x22')](util[_0x1adf('0x2b')](_0x1adf('0x43'),_0x16255e,_0x1c8241,_0x8df757,_0xa3ced6,_0xd4aa04,_0x12faa8));};AGIChannel['prototype']['streamFile']=function(_0x373ba7,_0xf2ac53){_0xf2ac53=_0xf2ac53||'';return this[_0x1adf('0x22')](util[_0x1adf('0x2b')](_0x1adf('0x44'),_0x373ba7,_0xf2ac53));};AGIChannel['prototype'][_0x1adf('0x45')]=function(_0x1bacf5){return this[_0x1adf('0x29')]('AGI',_0x1bacf5);};AGIChannel[_0x1adf('0x21')][_0x1adf('0x46')]=function(_0x95d7f9){return this[_0x1adf('0x29')](_0x1adf('0x47'),_0x95d7f9);};AGIChannel[_0x1adf('0x21')]['error']=function(_0x44ef56,_0x56ba8b){this['noop'](util[_0x1adf('0x2b')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x44ef56['id'],_0x44ef56['label'],_0x56ba8b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1adf('0x48')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0ab8347..81a740d 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 _0x238f=['E_AGI_UNDEFINED','push','apply','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x238f,0x1d4));var _0xf238=function(_0x2d267c,_0x4185d1){_0x2d267c=_0x2d267c-0x0;var _0x5394bc=_0x238f[_0x2d267c];return _0x5394bc;};'use strict';var util=require(_0xf238('0x0'));var error={'E_AGI_UNDEFINED':_0xf238('0x1'),'E_AGI_ARGUMENT_PORT':_0xf238('0x2'),'E_AGI_SERVER_ERROR':_0xf238('0x3'),'E_AGI_SERVER_CLOSE':_0xf238('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xf238('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xf238('0x6'),'E_AGI_SOCKET_ERROR':_0xf238('0x7'),'E_AGI_SOCKET_CLOSE':_0xf238('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xf238('0x9'),'E_AGI_COMMAND_EMPTY':_0xf238('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xf238('0xb')};function AGIError(_0x47ff7b){var _0x47ff7b=_0x47ff7b||null,_0x5334d4=_0x5334d4||[],_0xbf4b15=0x1,_0x167c84='';if(!error[_0x47ff7b]){_0x47ff7b=_0xf238('0xc');}_0x5334d4['push'](error[_0x47ff7b]);while(arguments[_0xbf4b15]){_0x5334d4[_0xf238('0xd')](arguments[_0xbf4b15]);_0xbf4b15++;}_0x167c84=util['format'][_0xf238('0xe')](util,_0x5334d4);this['message']=_0x167c84;this['name']=_0x47ff7b;}module[_0xf238('0xf')]=AGIError; \ No newline at end of file +var _0xcabc=['format','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xcabc,0x16a));var _0xccab=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xcabc[_0x40a045];return _0x1a687c;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xccab('0x0'),'E_AGI_ARGUMENT_PORT':_0xccab('0x1'),'E_AGI_SERVER_ERROR':_0xccab('0x2'),'E_AGI_SERVER_CLOSE':_0xccab('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xccab('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xccab('0x5'),'E_AGI_SOCKET_CLOSE':_0xccab('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xccab('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xccab('0x8'),'E_AGI_IVR_ENTRY':_0xccab('0x9')};function AGIError(_0x492d75){var _0x492d75=_0x492d75||null,_0x29f877=_0x29f877||[],_0x24b95c=0x1,_0x4a6f3c='';if(!error[_0x492d75]){_0x492d75=_0xccab('0xa');}_0x29f877[_0xccab('0xb')](error[_0x492d75]);while(arguments[_0x24b95c]){_0x29f877['push'](arguments[_0x24b95c]);_0x24b95c++;}_0x4a6f3c=util[_0xccab('0xc')][_0xccab('0xd')](util,_0x29f877);this[_0xccab('0xe')]=_0x4a6f3c;this[_0xccab('0xf')]=_0x492d75;}module[_0xccab('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 eceb229..d4a616b 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 _0xfef3=['lodash','agi','getdigits','getsecretdigits','edges','numberOfEdges','addVertex','prototype','addEdge','push','size','vertices','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','menu','max\x20retry\x20reach','condition\x20not\x20found','exports'];(function(_0x3a28e2,_0x58325a){var _0xfd325a=function(_0xf77ee7){while(--_0xf77ee7){_0x3a28e2['push'](_0x3a28e2['shift']());}};_0xfd325a(++_0x58325a);}(_0xfef3,0x118));var _0x3fef=function(_0x57f1bc,_0x103651){_0x57f1bc=_0x57f1bc-0x0;var _0x57649d=_0xfef3[_0x57f1bc];return _0x57649d;};'use strict';var _=require(_0x3fef('0x0'));var logger=require('../../../config/logger')(_0x3fef('0x1'));var verticesWithRetry=['menu',_0x3fef('0x2'),_0x3fef('0x3')];var Graph=function(){this['vertices']={};this[_0x3fef('0x4')]={};this[_0x3fef('0x5')]=0x0;};Graph['prototype'][_0x3fef('0x6')]=function(_0x1351b1){this['vertices'][_0x1351b1['id']]=_0x1351b1;this[_0x3fef('0x4')][_0x1351b1['id']]=[];};Graph[_0x3fef('0x7')][_0x3fef('0x8')]=function(_0x33e00a,_0x1fffc5,_0x41960c){this[_0x3fef('0x4')][_0x33e00a][_0x3fef('0x9')]({'target':_0x1fffc5,'condition':_0x41960c});this[_0x3fef('0x5')]+=0x1;};Graph[_0x3fef('0x7')][_0x3fef('0xa')]=function(){return _[_0x3fef('0xa')](this[_0x3fef('0xb')]);};Graph[_0x3fef('0x7')]['relations']=function(){return this[_0x3fef('0x5')];};Graph[_0x3fef('0x7')][_0x3fef('0xc')]=function(_0x49d216){return this[_0x3fef('0xb')][_0x49d216];};Graph['prototype'][_0x3fef('0xd')]=function(_0x3d2c2d,_0x2da64b){if(!this['vertices'][_0x3d2c2d]){return logger[_0x3fef('0xe')]('no\x20vertex\x20found');}var _0x15b757=_0x2da64b(this[_0x3fef('0xb')][_0x3d2c2d]);if(!_0x15b757){return logger['info'](_0x3fef('0xf'));}if(this[_0x3fef('0x4')][_0x3d2c2d][_0x3fef('0x10')]===0x0){return logger[_0x3fef('0xe')](_0x3fef('0x11'));}for(var _0x2af1ba=0x0,_0x5c899f=[],_0x1cbdbb=![];_0x2af1ba\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','SQUAREROOT','start','stringify','YYYY-MM-DD\x20HH:mm:ss','omit','LOOP\x20through\x20graph','traverseBFS','clear','VERTEX','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','result','isUndefined','toString','agicommand\x20not\x20found','stack','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','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','connection','xml2json','lodash','syncho','moment','../../config/logger','../../config/license/util','./rpc','./vertices','defaults','agi','127.0.0.1','nextTick','error','log','port','info','format','name','message','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','source','target','addEdge','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fce,0xdc));var _0xe7fc=function(_0x1eb5b7,_0x4f7be1){_0x1eb5b7=_0x1eb5b7-0x0;var _0x460761=_0x7fce[_0x1eb5b7];return _0x460761;};'use strict';var parser=require(_0xe7fc('0x0'));var _=require(_0xe7fc('0x1'));var syncho=require(_0xe7fc('0x2'));var util=require('util');var moment=require(_0xe7fc('0x3'));var config=require('../../config/environment');var logger=require(_0xe7fc('0x4'))('agi');var utilLicense=require(_0xe7fc('0x5'));var rpc=require(_0xe7fc('0x6'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xe7fc('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xe7fc('0x8')](config[_0xe7fc('0x9')],{'ip':_0xe7fc('0xa'),'port':0x11dd});function connectionHandler(_0x19eeef){process[_0xe7fc('0xb')](function(){syncho(function(){try{setChannelVariables(_0x19eeef);agiHandler(_0x19eeef);}catch(_0x525bfd){logger[_0xe7fc('0xc')](_0x525bfd['stack']);}});});}function listeningHandler(){console[_0xe7fc('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe7fc('0x9')][_0xe7fc('0xe')]);logger[_0xe7fc('0xf')](util[_0xe7fc('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xe7fc('0x9')]['ip'],config[_0xe7fc('0x9')]['port']));}function errorHandler(_0x4b8500){if(_0x4b8500&&_0x4b8500[_0xe7fc('0x11')]&&_0x4b8500['message']){logger[_0xe7fc('0xc')](util['format']('[%s]\x20%s',_0x4b8500[_0xe7fc('0x11')],_0x4b8500[_0xe7fc('0x12')]));}else{logger[_0xe7fc('0xc')](util[_0xe7fc('0x10')](_0xe7fc('0x13'),_0x4b8500['stack']));}}function closeHandler(){logger[_0xe7fc('0xf')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe7fc('0x14')],this[_0xe7fc('0x15')],this[_0xe7fc('0x16')],this[_0xe7fc('0x17')],this['uniqueid']));try{createSquareReport(this);}catch(_0x552429){logger['error'](_0x552429['stack']);}}function timeoutHandler(){logger['info'](util['format'](_0xe7fc('0x18'),this['arg_1'],this[_0xe7fc('0x15')],this[_0xe7fc('0x16')],this[_0xe7fc('0x17')],this[_0xe7fc('0x19')]));}function hangupHandler(){logger[_0xe7fc('0xf')](util[_0xe7fc('0x10')](_0xe7fc('0x1a'),this[_0xe7fc('0x14')],this['calleridname'],this[_0xe7fc('0x16')],this[_0xe7fc('0x17')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x35bb53){return parser[_0xe7fc('0x1b')](_0x35bb53,{'object':!![]})[_0xe7fc('0x1c')][_0xe7fc('0x1d')];}function addVertex(_0x26977a,_0x11c5a3,_0x3f850f){_0x11c5a3[_0xe7fc('0x1e')]=_0x3f850f;if(_0x11c5a3[_0xe7fc('0x1f')](_0xe7fc('0x20'))){_0x11c5a3[_0xe7fc('0x21')]=parseInt(_0x11c5a3[_0xe7fc('0x20')],0xa);}_0x26977a[_0xe7fc('0x22')](_['omit'](_0x11c5a3,_0xe7fc('0x23')));}function initGraph(_0x158d6e,_0x416464){var _0x3be1fd=new Graph();for(var _0x2249ed in _0x158d6e){if(_0x158d6e[_0xe7fc('0x1f')](_0x2249ed)){if(_['isArray'](_0x158d6e[_0x2249ed])){for(var _0x1a82e8=0x0;_0x1a82e8<_0x158d6e[_0x2249ed][_0xe7fc('0x24')];_0x1a82e8+=0x1){addVertex(_0x3be1fd,_0x158d6e[_0x2249ed][_0x1a82e8],_0x2249ed);}}else{addVertex(_0x3be1fd,_0x158d6e[_0x2249ed],_0x2249ed);}}}for(var _0x3966ac=0x0;_0x3966ac<_0x416464[_0xe7fc('0x24')];_0x3966ac+=0x1){if(_0x416464[_0x3966ac][_0xe7fc('0x25')]&&_0x416464[_0x3966ac][_0xe7fc('0x26')]){_0x3be1fd[_0xe7fc('0x27')](_0x416464[_0x3966ac]['source'],_0x416464[_0x3966ac][_0xe7fc('0x26')],_0x416464[_0x3966ac][_0xe7fc('0x28')]);}}return _0x3be1fd;}function getSquareProject(_0x512518,_0x37ab14){rpc['getSquareProject'](_0x512518)[_0xe7fc('0x29')](function(_0x27255a){_0x37ab14(null,_0x27255a);})['catch'](function(_0x2b3830){_0x37ab14(null,_0x2b3830);});}function createSquareReport(_0x4fe326,_0x245965){rpc[_0xe7fc('0x2a')](_0x4fe326)[_0xe7fc('0x29')](function(_0x48389c){if(_0x245965){_0x245965(null,_0x48389c);}})[_0xe7fc('0x2b')](function(_0x4e780c){if(_0x245965){_0x245965(null,_0x4e780c);}});}function setChannelVariables(_0x214f9c){for(var _0x24dc00 in _0x214f9c){if(_0x214f9c['hasOwnProperty'](_0x24dc00)){if(_0x24dc00['indexOf']('agi_')===0x0){_0x214f9c[_0x24dc00['substring'](0x4)]=_0x214f9c[_0x24dc00];delete _0x214f9c[_0x24dc00];}}}}function getLogFromObject(_0x419d3f){return util[_0xe7fc('0x2c')](_0x419d3f,{'showHidden':![],'depth':null});}function agiHandler(_0x3ce757){var _0x27d8e2,_0x406782,_0x412abb,_0x31f060,_0x2339da;logger[_0xe7fc('0x2d')](_0xe7fc('0x2e'),JSON['stringify'](_0x3ce757,null,0x2));logger[_0xe7fc('0xf')](util[_0xe7fc('0x10')](_0xe7fc('0x2f'),_0x3ce757[_0xe7fc('0x14')],_0x3ce757[_0xe7fc('0x15')],_0x3ce757['callerid'],_0x3ce757[_0xe7fc('0x17')],_0x3ce757[_0xe7fc('0x19')]));_0x3ce757['on'](_0xe7fc('0xc'),errorHandler);_0x3ce757['on'](_0xe7fc('0x30'),closeHandler);_0x3ce757['on'](_0xe7fc('0x31'),timeoutHandler);_0x3ce757[_0xe7fc('0x32')]=![];_0x3ce757['on'](_0xe7fc('0x33'),hangupHandler);var _0x41045d=getSquareProject[_0xe7fc('0x34')](null,_0x3ce757[_0xe7fc('0x14')]);if(_0x41045d){if(_0x41045d[_0xe7fc('0x35')]){_0x27d8e2=getRoot(_0x41045d[_0xe7fc('0x35')]);console['log'](_0xe7fc('0x36'),_0x27d8e2);if(_0x27d8e2&&_0x27d8e2[_0xe7fc('0x37')]){logger[_0xe7fc('0x2d')](_0xe7fc('0x1d'),JSON[_0xe7fc('0x38')](_0x27d8e2,null,0x2));_0x3ce757['joinAt']=moment()[_0xe7fc('0x10')](_0xe7fc('0x39'));_0x406782=initGraph(_[_0xe7fc('0x3a')](_0x27d8e2,_0xe7fc('0x23')),_0x27d8e2[_0xe7fc('0x23')]);_0x412abb=new Vertices(_0x3ce757,rpc,mailRpc);console[_0xe7fc('0xd')]('vertices',_0x412abb);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3ce757['arg_1'],_0x3ce757[_0xe7fc('0x15')],_0x3ce757[_0xe7fc('0x16')],_0x3ce757['dnid'],_0x3ce757[_0xe7fc('0x19')]));console['log'](_0xe7fc('0x3b'));_0x406782[_0xe7fc('0x3c')](_0x27d8e2[_0xe7fc('0x37')]['id'],function(_0x233180){try{_0x233180=_0x412abb[_0xe7fc('0x3d')](_0x233180);logger[_0xe7fc('0x2d')]('vertex',JSON[_0xe7fc('0x38')](_0x233180,null,0x2));console['log'](_0xe7fc('0x3e'),_0x233180);if(_0x233180[_0xe7fc('0x1e')]==='gotoc'){logger[_0xe7fc('0xf')](_0xe7fc('0x3f'));_0x3ce757[_0xe7fc('0x40')]=_0x233180[_0xe7fc('0x40')]||_0x3ce757[_0xe7fc('0x40')];_0x3ce757[_0xe7fc('0x41')]=_0x233180[_0xe7fc('0x41')];_0x3ce757[_0xe7fc('0x42')]=_0x233180[_0xe7fc('0x42')]?_0x233180[_0xe7fc('0x42')]-0x1:0x1;return null;}else if(_0x233180&&_0x412abb[_0x233180[_0xe7fc('0x1e')]]){_0x2339da=_0x412abb[_0x233180[_0xe7fc('0x1e')]](_0x233180);console[_0xe7fc('0xd')](_0xe7fc('0x43'),_0x2339da);logger[_0xe7fc('0xf')](_0xe7fc('0x44'),JSON[_0xe7fc('0x38')](_0x2339da,null,0x2));if(_0x2339da&&_0x2339da['code']===AGI_CODE_SUCCESS&&_0x2339da[_0xe7fc('0x45')]!==AGI_RESULT_ERROR&&!_0x3ce757[_0xe7fc('0x32')]){logger[_0xe7fc('0x2d')]('response',getLogFromObject(_0x2339da));return _[_0xe7fc('0x46')](_0x2339da[_0xe7fc('0x45')])?null:_0x2339da[_0xe7fc('0x45')][_0xe7fc('0x47')]();}else{logger[_0xe7fc('0xc')]('response',getLogFromObject(_0x2339da));return null;}}else{logger['error'](_0xe7fc('0x48'));return null;}}catch(_0x3e9a67){logger[_0xe7fc('0xc')](_0x3e9a67[_0xe7fc('0x49')]);return null;}});if(_0x27d8e2[_0xe7fc('0x4a')]){logger['info'](util[_0xe7fc('0x10')](_0xe7fc('0x4b'),_0x3ce757[_0xe7fc('0x14')],_0x3ce757[_0xe7fc('0x15')],_0x3ce757[_0xe7fc('0x16')],_0x3ce757[_0xe7fc('0x17')],_0x3ce757[_0xe7fc('0x19')]));_0x406782[_0xe7fc('0x3c')](_0x27d8e2[_0xe7fc('0x4a')]['id'],function(_0x45edbf){try{_0x45edbf=_0x412abb['clear'](_0x45edbf);logger[_0xe7fc('0x2d')]('vertex',JSON[_0xe7fc('0x38')](_0x45edbf,null,0x2));if(_0x45edbf&&_0x412abb[_0x45edbf[_0xe7fc('0x1e')]]){_0x2339da=_0x412abb[_0x45edbf[_0xe7fc('0x1e')]](_0x45edbf);if(_0x2339da){logger[_0xe7fc('0x2d')](_0xe7fc('0x44'),getLogFromObject(_0x2339da));return _[_0xe7fc('0x46')](_0x2339da[_0xe7fc('0x45')])?null:_0x2339da[_0xe7fc('0x45')][_0xe7fc('0x47')]();}else{logger['error'](_0xe7fc('0x44'),getLogFromObject(_0x2339da));return null;}}else{logger[_0xe7fc('0xc')](_0xe7fc('0x48'));return null;}}catch(_0x2e7748){logger[_0xe7fc('0xc')](_0x2e7748[_0xe7fc('0x49')]);return null;}});}logger['info'](util[_0xe7fc('0x10')](_0xe7fc('0x4c'),_0x3ce757[_0xe7fc('0x14')],_0x3ce757[_0xe7fc('0x15')],_0x3ce757[_0xe7fc('0x16')],_0x3ce757[_0xe7fc('0x17')],_0x3ce757['uniqueid']));logger['info'](util[_0xe7fc('0x10')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x3ce757['context'],_0x3ce757[_0xe7fc('0x41')],parseInt(_0x3ce757[_0xe7fc('0x42')],0xa)+0x1));_0x3ce757[_0xe7fc('0x4d')](_0x3ce757[_0xe7fc('0x40')],_0x3ce757[_0xe7fc('0x41')],parseInt(_0x3ce757[_0xe7fc('0x42')],0xa)+0x1);_0x3ce757[_0xe7fc('0x30')]();}}else{logger[_0xe7fc('0xc')](util[_0xe7fc('0x10')](_0xe7fc('0x4e'),_0x3ce757[_0xe7fc('0x14')]));_0x3ce757['continueAt'](_0x3ce757[_0xe7fc('0x40')],_0x3ce757['extension'],parseInt(_0x3ce757[_0xe7fc('0x42')],0xa)+0x1);_0x3ce757[_0xe7fc('0x30')]();}}else{logger[_0xe7fc('0xc')](util[_0xe7fc('0x10')](_0xe7fc('0x4f'),_0x3ce757[_0xe7fc('0x14')]));_0x3ce757[_0xe7fc('0x4d')](_0x3ce757[_0xe7fc('0x40')],_0x3ce757['extension'],parseInt(_0x3ce757[_0xe7fc('0x42')],0xa)+0x1);_0x3ce757[_0xe7fc('0x30')]();}}function main(){var _0x568db4;return utilLicense[_0xe7fc('0x50')]()[_0xe7fc('0x29')](function(_0xc24f66){if(_0xc24f66){if(_0xc24f66[_0xe7fc('0x51')]){if(_0xc24f66[_0xe7fc('0x52')]&&_0xc24f66['callysquare']>0x0){logger[_0xe7fc('0xf')](util[_0xe7fc('0x10')](_0xe7fc('0x53'),_0xc24f66[_0xe7fc('0x52')]));_0x568db4=_0xc24f66['callysquare'];}else{logger[_0xe7fc('0xf')](_0xe7fc('0x54'));}}else{logger[_0xe7fc('0xf')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x568db4=-0x1;}}})['catch'](function(_0x323c66){logger[_0xe7fc('0xc')](_0xe7fc('0x55'),_0x323c66[_0xe7fc('0x49')]);})[_0xe7fc('0x4a')](function(){var _0xb35f53=require('./server')(config[_0xe7fc('0x9')][_0xe7fc('0xe')],config[_0xe7fc('0x9')]['ip'],_0x568db4);_0xb35f53['on'](_0xe7fc('0xc'),errorHandler);_0xb35f53['on']('listening',listeningHandler);_0xb35f53['on'](_0xe7fc('0x56'),connectionHandler);_0xb35f53['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x1abc=['./server','connection','xml2json','lodash','syncho','moment','../../config/environment','agi','../../config/license/util','./graph','./vertices','defaults','127.0.0.1','nextTick','log','format','name','message','[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','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','catch','createSquareReport','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','SQUAREROOT','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','code','result','isUndefined','toString','error','finally','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','then','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]'];(function(_0x4df0ac,_0x18f735){var _0x1683d7=function(_0x2994eb){while(--_0x2994eb){_0x4df0ac['push'](_0x4df0ac['shift']());}};_0x1683d7(++_0x18f735);}(_0x1abc,0x107));var _0xc1ab=function(_0x54bb5e,_0xc9513a){_0x54bb5e=_0x54bb5e-0x0;var _0x2cfe75=_0x1abc[_0x54bb5e];return _0x2cfe75;};'use strict';var parser=require(_0xc1ab('0x0'));var _=require(_0xc1ab('0x1'));var syncho=require(_0xc1ab('0x2'));var util=require('util');var moment=require(_0xc1ab('0x3'));var config=require(_0xc1ab('0x4'));var logger=require('../../config/logger')(_0xc1ab('0x5'));var utilLicense=require(_0xc1ab('0x6'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xc1ab('0x7'));var Vertices=require(_0xc1ab('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xc1ab('0x5')]=_[_0xc1ab('0x9')](config[_0xc1ab('0x5')],{'ip':_0xc1ab('0xa'),'port':0x11dd});function connectionHandler(_0x5fc15){process[_0xc1ab('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5fc15);agiHandler(_0x5fc15);}catch(_0x23dadd){logger['error'](_0x23dadd['stack']);}});});}function listeningHandler(){console[_0xc1ab('0xc')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xc1ab('0x5')]['port']);logger['info'](util[_0xc1ab('0xd')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xc1ab('0x5')]['ip'],config[_0xc1ab('0x5')]['port']));}function errorHandler(_0xb74a85){if(_0xb74a85&&_0xb74a85[_0xc1ab('0xe')]&&_0xb74a85[_0xc1ab('0xf')]){logger['error'](util['format']('[%s]\x20%s',_0xb74a85[_0xc1ab('0xe')],_0xb74a85[_0xc1ab('0xf')]));}else{logger['error'](util[_0xc1ab('0xd')](_0xc1ab('0x10'),_0xb74a85[_0xc1ab('0x11')]));}}function closeHandler(){logger[_0xc1ab('0x12')](util[_0xc1ab('0xd')](_0xc1ab('0x13'),this[_0xc1ab('0x14')],this['calleridname'],this[_0xc1ab('0x15')],this[_0xc1ab('0x16')],this[_0xc1ab('0x17')]));try{createSquareReport(this);}catch(_0x3a0f43){logger['error'](_0x3a0f43['stack']);}}function timeoutHandler(){logger['info'](util[_0xc1ab('0xd')](_0xc1ab('0x18'),this[_0xc1ab('0x14')],this[_0xc1ab('0x19')],this[_0xc1ab('0x15')],this[_0xc1ab('0x16')],this[_0xc1ab('0x17')]));}function hangupHandler(){logger['info'](util[_0xc1ab('0xd')](_0xc1ab('0x1a'),this['arg_1'],this['calleridname'],this[_0xc1ab('0x15')],this[_0xc1ab('0x16')],this[_0xc1ab('0x17')]));this[_0xc1ab('0x1b')]=!![];}function getRoot(_0x51908e){return parser[_0xc1ab('0x1c')](_0x51908e,{'object':!![]})['mxGraphModel'][_0xc1ab('0x1d')];}function addVertex(_0x43be55,_0x53e441,_0x54eeb0){_0x53e441[_0xc1ab('0x1e')]=_0x54eeb0;if(_0x53e441[_0xc1ab('0x1f')](_0xc1ab('0x20'))){_0x53e441['maxRetry']=parseInt(_0x53e441[_0xc1ab('0x20')],0xa);}_0x43be55[_0xc1ab('0x21')](_[_0xc1ab('0x22')](_0x53e441,_0xc1ab('0x23')));}function initGraph(_0x28620c,_0xb870bf){var _0x305f3d=new Graph();for(var _0x226df4 in _0x28620c){if(_0x28620c[_0xc1ab('0x1f')](_0x226df4)){if(_[_0xc1ab('0x24')](_0x28620c[_0x226df4])){for(var _0x2f9942=0x0;_0x2f9942<_0x28620c[_0x226df4][_0xc1ab('0x25')];_0x2f9942+=0x1){addVertex(_0x305f3d,_0x28620c[_0x226df4][_0x2f9942],_0x226df4);}}else{addVertex(_0x305f3d,_0x28620c[_0x226df4],_0x226df4);}}}for(var _0x427d35=0x0;_0x427d35<_0xb870bf[_0xc1ab('0x25')];_0x427d35+=0x1){if(_0xb870bf[_0x427d35][_0xc1ab('0x26')]&&_0xb870bf[_0x427d35]['target']){_0x305f3d[_0xc1ab('0x27')](_0xb870bf[_0x427d35][_0xc1ab('0x26')],_0xb870bf[_0x427d35][_0xc1ab('0x28')],_0xb870bf[_0x427d35][_0xc1ab('0x29')]);}}return _0x305f3d;}function getSquareProject(_0x1fed17,_0x7396b9){rpc['getSquareProject'](_0x1fed17)['then'](function(_0x295466){_0x7396b9(null,_0x295466);})[_0xc1ab('0x2a')](function(_0x21ce61){_0x7396b9(null,_0x21ce61);});}function createSquareReport(_0xa60cfd,_0x2810c2){rpc[_0xc1ab('0x2b')](_0xa60cfd)['then'](function(_0x357e43){if(_0x2810c2){_0x2810c2(null,_0x357e43);}})[_0xc1ab('0x2a')](function(_0xb922dc){if(_0x2810c2){_0x2810c2(null,_0xb922dc);}});}function setChannelVariables(_0x269db4){for(var _0x527fb1 in _0x269db4){if(_0x269db4[_0xc1ab('0x1f')](_0x527fb1)){if(_0x527fb1['indexOf'](_0xc1ab('0x2c'))===0x0){_0x269db4[_0x527fb1[_0xc1ab('0x2d')](0x4)]=_0x269db4[_0x527fb1];delete _0x269db4[_0x527fb1];}}}}function getLogFromObject(_0x116824){return util[_0xc1ab('0x2e')](_0x116824,{'showHidden':![],'depth':null});}function agiHandler(_0x3dc1c0){var _0x57c704,_0x156f18,_0x4a269a,_0x3b8480,_0x257aad;logger[_0xc1ab('0x2f')](_0xc1ab('0x30'),JSON[_0xc1ab('0x31')](_0x3dc1c0,null,0x2));logger['info'](util[_0xc1ab('0xd')](_0xc1ab('0x32'),_0x3dc1c0['arg_1'],_0x3dc1c0[_0xc1ab('0x19')],_0x3dc1c0[_0xc1ab('0x15')],_0x3dc1c0['dnid'],_0x3dc1c0[_0xc1ab('0x17')]));_0x3dc1c0['on']('error',errorHandler);_0x3dc1c0['on'](_0xc1ab('0x33'),closeHandler);_0x3dc1c0['on'](_0xc1ab('0x34'),timeoutHandler);_0x3dc1c0[_0xc1ab('0x1b')]=![];_0x3dc1c0['on'](_0xc1ab('0x35'),hangupHandler);var _0x54427c=getSquareProject[_0xc1ab('0x36')](null,_0x3dc1c0[_0xc1ab('0x14')]);if(_0x54427c){if(_0x54427c[_0xc1ab('0x37')]){_0x57c704=getRoot(_0x54427c[_0xc1ab('0x37')]);console[_0xc1ab('0xc')](_0xc1ab('0x38'),_0x57c704);if(_0x57c704&&_0x57c704[_0xc1ab('0x39')]){logger[_0xc1ab('0x2f')](_0xc1ab('0x1d'),JSON[_0xc1ab('0x31')](_0x57c704,null,0x2));_0x3dc1c0[_0xc1ab('0x3a')]=moment()['format'](_0xc1ab('0x3b'));_0x156f18=initGraph(_[_0xc1ab('0x22')](_0x57c704,_0xc1ab('0x23')),_0x57c704['mxCell']);_0x4a269a=new Vertices(_0x3dc1c0,rpc,mailRpc);console[_0xc1ab('0xc')](_0xc1ab('0x3c'),_0x4a269a);logger[_0xc1ab('0x12')](util[_0xc1ab('0xd')](_0xc1ab('0x3d'),_0x3dc1c0[_0xc1ab('0x14')],_0x3dc1c0['calleridname'],_0x3dc1c0[_0xc1ab('0x15')],_0x3dc1c0[_0xc1ab('0x16')],_0x3dc1c0[_0xc1ab('0x17')]));console[_0xc1ab('0xc')](_0xc1ab('0x3e'));_0x156f18['traverseBFS'](_0x57c704[_0xc1ab('0x39')]['id'],function(_0x20d2a3){try{_0x20d2a3=_0x4a269a[_0xc1ab('0x3f')](_0x20d2a3);logger[_0xc1ab('0x2f')](_0xc1ab('0x40'),JSON[_0xc1ab('0x31')](_0x20d2a3,null,0x2));console['log']('VERTEX',_0x20d2a3);if(_0x20d2a3['agicommand']===_0xc1ab('0x41')){logger[_0xc1ab('0x12')](_0xc1ab('0x42'));_0x3dc1c0['context']=_0x20d2a3['context']||_0x3dc1c0[_0xc1ab('0x43')];_0x3dc1c0[_0xc1ab('0x44')]=_0x20d2a3[_0xc1ab('0x44')];_0x3dc1c0[_0xc1ab('0x45')]=_0x20d2a3[_0xc1ab('0x45')]?_0x20d2a3['priority']-0x1:0x1;return null;}else if(_0x20d2a3&&_0x4a269a[_0x20d2a3[_0xc1ab('0x1e')]]){_0x257aad=_0x4a269a[_0x20d2a3[_0xc1ab('0x1e')]](_0x20d2a3);console[_0xc1ab('0xc')](_0xc1ab('0x46'),_0x257aad);logger['info'](_0xc1ab('0x47'),JSON['stringify'](_0x257aad,null,0x2));if(_0x257aad&&_0x257aad[_0xc1ab('0x48')]===AGI_CODE_SUCCESS&&_0x257aad[_0xc1ab('0x49')]!==AGI_RESULT_ERROR&&!_0x3dc1c0[_0xc1ab('0x1b')]){logger['debug'](_0xc1ab('0x47'),getLogFromObject(_0x257aad));return _[_0xc1ab('0x4a')](_0x257aad['result'])?null:_0x257aad[_0xc1ab('0x49')][_0xc1ab('0x4b')]();}else{logger[_0xc1ab('0x4c')](_0xc1ab('0x47'),getLogFromObject(_0x257aad));return null;}}else{logger[_0xc1ab('0x4c')]('agicommand\x20not\x20found');return null;}}catch(_0x1f7d31){logger[_0xc1ab('0x4c')](_0x1f7d31[_0xc1ab('0x11')]);return null;}});if(_0x57c704[_0xc1ab('0x4d')]){logger['info'](util[_0xc1ab('0xd')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3dc1c0[_0xc1ab('0x14')],_0x3dc1c0[_0xc1ab('0x19')],_0x3dc1c0[_0xc1ab('0x15')],_0x3dc1c0['dnid'],_0x3dc1c0['uniqueid']));_0x156f18['traverseBFS'](_0x57c704[_0xc1ab('0x4d')]['id'],function(_0x2dcdb6){try{_0x2dcdb6=_0x4a269a['clear'](_0x2dcdb6);logger[_0xc1ab('0x2f')](_0xc1ab('0x40'),JSON[_0xc1ab('0x31')](_0x2dcdb6,null,0x2));if(_0x2dcdb6&&_0x4a269a[_0x2dcdb6['agicommand']]){_0x257aad=_0x4a269a[_0x2dcdb6[_0xc1ab('0x1e')]](_0x2dcdb6);if(_0x257aad){logger[_0xc1ab('0x2f')](_0xc1ab('0x47'),getLogFromObject(_0x257aad));return _[_0xc1ab('0x4a')](_0x257aad['result'])?null:_0x257aad[_0xc1ab('0x49')][_0xc1ab('0x4b')]();}else{logger[_0xc1ab('0x4c')]('response',getLogFromObject(_0x257aad));return null;}}else{logger[_0xc1ab('0x4c')]('agicommand\x20not\x20found');return null;}}catch(_0xd86d46){logger[_0xc1ab('0x4c')](_0xd86d46[_0xc1ab('0x11')]);return null;}});}logger['info'](util[_0xc1ab('0xd')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3dc1c0[_0xc1ab('0x14')],_0x3dc1c0[_0xc1ab('0x19')],_0x3dc1c0[_0xc1ab('0x15')],_0x3dc1c0[_0xc1ab('0x16')],_0x3dc1c0[_0xc1ab('0x17')]));logger[_0xc1ab('0x12')](util[_0xc1ab('0xd')](_0xc1ab('0x4e'),_0x3dc1c0[_0xc1ab('0x43')],_0x3dc1c0[_0xc1ab('0x44')],parseInt(_0x3dc1c0[_0xc1ab('0x45')],0xa)+0x1));_0x3dc1c0['continueAt'](_0x3dc1c0['context'],_0x3dc1c0['extension'],parseInt(_0x3dc1c0[_0xc1ab('0x45')],0xa)+0x1);_0x3dc1c0[_0xc1ab('0x33')]();}}else{logger[_0xc1ab('0x4c')](util['format']('Project\x20%s\x20not\x20published',_0x3dc1c0[_0xc1ab('0x14')]));_0x3dc1c0[_0xc1ab('0x4f')](_0x3dc1c0[_0xc1ab('0x43')],_0x3dc1c0[_0xc1ab('0x44')],parseInt(_0x3dc1c0[_0xc1ab('0x45')],0xa)+0x1);_0x3dc1c0[_0xc1ab('0x33')]();}}else{logger[_0xc1ab('0x4c')](util[_0xc1ab('0xd')]('Project\x20%s\x20not\x20found',_0x3dc1c0[_0xc1ab('0x14')]));_0x3dc1c0[_0xc1ab('0x4f')](_0x3dc1c0[_0xc1ab('0x43')],_0x3dc1c0[_0xc1ab('0x44')],parseInt(_0x3dc1c0[_0xc1ab('0x45')],0xa)+0x1);_0x3dc1c0[_0xc1ab('0x33')]();}}function main(){var _0x5690cf;return utilLicense['getLicense']()[_0xc1ab('0x50')](function(_0x4fbe9c){if(_0x4fbe9c){if(_0x4fbe9c['voice']){if(_0x4fbe9c[_0xc1ab('0x51')]&&_0x4fbe9c['callysquare']>0x0){logger['info'](util[_0xc1ab('0xd')](_0xc1ab('0x52'),_0x4fbe9c[_0xc1ab('0x51')]));_0x5690cf=_0x4fbe9c['callysquare'];}else{logger[_0xc1ab('0x12')](_0xc1ab('0x53'));}}else{logger[_0xc1ab('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x5690cf=-0x1;}}})[_0xc1ab('0x2a')](function(_0x3f6c73){logger[_0xc1ab('0x4c')](_0xc1ab('0x54'),_0x3f6c73[_0xc1ab('0x11')]);})[_0xc1ab('0x4d')](function(){var _0x8b9660=require(_0xc1ab('0x55'))(config[_0xc1ab('0x5')]['port'],config[_0xc1ab('0x5')]['ip'],_0x5690cf);_0x8b9660['on'](_0xc1ab('0x4c'),errorHandler);_0x8b9660['on']('listening',listeningHandler);_0x8b9660['on'](_0xc1ab('0x56'),connectionHandler);_0x8b9660['on'](_0xc1ab('0x33'),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 95958a9..f725544 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x2fdf79,_0x32e753){var _0xea58da=function(_0x1a60cd){while(--_0x1a60cd){_0x2fdf79['push'](_0x2fdf79['shift']());}};_0xea58da(++_0x32e753);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x4b4e0,_0x265692){var _0x2f6d41=function(_0x48cbbf){while(--_0x48cbbf){_0x4b4e0['push'](_0x4b4e0['shift']());}};_0x2f6d41(++_0x265692);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 262c83f..83df71d 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(_0x594e1d,_0x4432fe){var _0x427b34=function(_0x21324d){while(--_0x21324d){_0x594e1d['push'](_0x594e1d['shift']());}};_0x427b34(++_0x4432fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3cfe5a,_0x1f3594){_0x3cfe5a=_0x3cfe5a-0x0;var _0x3c731e=_0x5f2f[_0x3cfe5a];return _0x3c731e;};'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 _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x400766,_0x368660){var _0x3ae58b=function(_0x4c6a6e){while(--_0x4c6a6e){_0x400766['push'](_0x400766['shift']());}};_0x3ae58b(++_0x368660);}(_0xb10b,0x12a));var _0xbb10=function(_0x699200,_0x39c101){_0x699200=_0x699200-0x0;var _0x266fd1=_0xb10b[_0x699200];return _0x266fd1;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index dce5834..5109657 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 _0x57e5=['name','email','getSquareProjectById','ShowVoiceQueue','ShowVariable','dsn','getUserById','ShowUser','getContactByPhone','log','rpcreq','getTrunkById','ShowTrunk','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','then','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','moment','lodash','jayson/promise','client','error','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','Smtp'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x57e5,0x8e));var _0x557e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x57e5[_0x465028];return _0xb783d4;};'use strict';var BPromise=require('bluebird');var moment=require(_0x557e('0x0'));var _=require(_0x557e('0x1'));var util=require('util');var jayson=require(_0x557e('0x2'));var client=jayson[_0x557e('0x3')]['http']({'port':0x2329});function request(_0x2429f9,_0x30bbc7){return new BPromise(function(_0x1b93a3,_0x37aeb4){return client['request'](_0x2429f9,_0x30bbc7)['then'](function(_0x127ae9){if(_0x127ae9['error']){return _0x37aeb4(_0x127ae9[_0x557e('0x4')]['message']);}else{return _0x1b93a3(_0x127ae9['result']);}})[_0x557e('0x5')](function(_0x4369e4){return _0x37aeb4(_0x4369e4);});});}exports[_0x557e('0x6')]=function(_0x109ec8){return request(_0x557e('0x7'),{'options':{'raw':![],'where':{'name':_0x109ec8},'attributes':[_0x557e('0x8')]}});};exports['getMailAccountById']=function(_0x4a71ea){return request(_0x557e('0x9'),{'options':{'raw':![],'where':{'id':_0x4a71ea},'include':[{'model':'MailServerOut','as':_0x557e('0xa')}],'attributes':['id',_0x557e('0xb'),_0x557e('0xc')]}});};exports[_0x557e('0xd')]=function(_0x177df0){return request('ShowSquareProject',{'options':{'where':{'id':_0x177df0},'attributes':[_0x557e('0xb')]}});};exports['getVoiceQueueById']=function(_0x21770b){return request(_0x557e('0xe'),{'options':{'where':{'id':_0x21770b},'attributes':[_0x557e('0xb')]}});};exports['getVariableById']=function(_0x199f5f){return request(_0x557e('0xf'),{'options':{'where':{'id':_0x199f5f},'attributes':[_0x557e('0xb')]}});};exports['getSquareOdbcById']=function(_0x2aa742){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2aa742},'attributes':[_0x557e('0x10')]}});};exports[_0x557e('0x11')]=function(_0x2d24fd){return request(_0x557e('0x12'),{'options':{'where':{'id':_0x2d24fd},'attributes':[_0x557e('0xb')]}});};exports[_0x557e('0x13')]=function(_0x8a10c9){console[_0x557e('0x14')](_0x557e('0x15'),_0x8a10c9);return request('GetContactByPhone',{'options':{'where':{'phone':_0x8a10c9['phone']},'attributes':['id']}});};exports[_0x557e('0x16')]=function(_0x4e6a33){return request(_0x557e('0x17'),{'options':{'where':{'id':_0x4e6a33},'attributes':[_0x557e('0xb')]}});};exports['getSoundById']=function(_0x1aac5b){return request('ShowSound',{'options':{'where':{'id':_0x1aac5b},'attributes':[_0x557e('0x18')]}});};exports[_0x557e('0x19')]=function(_0x3df14d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3df14d},'include':[{'model':_0x557e('0x1a'),'as':_0x557e('0x1b')}]}});};exports[_0x557e('0x1c')]=function(_0x48ba52){return request('ShowSmsAccount',{'options':{'where':{'id':_0x48ba52},'attributes':['id',_0x557e('0xb')]}});};exports[_0x557e('0x1d')]=function(_0x23c498){return request(_0x557e('0x1e'),{'body':_0x23c498});};exports['createSquareDetailsReport']=function(_0x496f5c){return request('CreateSquareDetailsReport',{'body':_0x496f5c});};exports['createSquareReport']=function(_0x2218ca){return request('CreateSquareReport',{'body':_['merge'](_0x2218ca,{'project_name':_0x2218ca[_0x557e('0x1f')],'prev_project_name':_0x2218ca['arg_2']||'','is_subproject':_0x2218ca[_0x557e('0x20')]?!![]:![],'leaveAt':moment()[_0x557e('0x21')](_0x557e('0x22'))})});};exports['createSquareRecording']=function(_0x3129a0){return request(_0x557e('0x23'),{'body':_0x3129a0});};exports[_0x557e('0x24')]=function(_0x15a38f){return request(_0x557e('0x25'),{'body':_0x15a38f});};exports[_0x557e('0x26')]=function(_0x589f07){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x589f07[_0x557e('0x27')],'ListId':_0x589f07[_0x557e('0x28')]}}})[_0x557e('0x29')](function(_0x27e793){if(_0x27e793){return _0x27e793;}return request('CreateCmContact',{'body':_0x589f07});});};exports[_0x557e('0x2a')]=function(_0x4e7b98){return request(_0x557e('0x2b'),{'options':{'where':{'id':_0x4e7b98},'attributes':[_0x557e('0xb')]}});};exports[_0x557e('0x2c')]=function(_0x1d78ce,_0x27c166){return request(_0x557e('0x2d'),{'body':{'interface':_0x27c166},'options':{'where':_0x1d78ce}});};exports[_0x557e('0x2e')]=function(_0x270423,_0x205a8f,_0x581633){return request(_0x557e('0x2f'),{'body':{'type':_0x205a8f,'uniqueid':_0x581633},'options':{'where':_0x270423}});};exports[_0x557e('0x30')]=function(_0x1a93b4){return request('UnpauseUser',{'body':{},'options':{'where':_0x1a93b4}});};exports[_0x557e('0x31')]=function(_0x525861){return request(_0x557e('0x32'),{'body':{},'options':{'where':_0x525861}});}; \ No newline at end of file +var _0xf958=['util','jayson/promise','client','http','request','then','error','message','result','catch','production','getMailAccountById','ShowMailAccount','Smtp','name','getSquareProjectById','ShowSquareProject','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','log','rpcreq','GetContactByPhone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser'];(function(_0x249e5c,_0x35cf37){var _0x59a706=function(_0x14b673){while(--_0x14b673){_0x249e5c['push'](_0x249e5c['shift']());}};_0x59a706(++_0x35cf37);}(_0xf958,0x1c0));var _0x8f95=function(_0x5e7617,_0x3a10e1){_0x5e7617=_0x5e7617-0x0;var _0x341f5d=_0xf958[_0x5e7617];return _0x341f5d;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require(_0x8f95('0x0'));var jayson=require(_0x8f95('0x1'));var client=jayson[_0x8f95('0x2')][_0x8f95('0x3')]({'port':0x2329});function request(_0x375fac,_0x37eb35){return new BPromise(function(_0x5e82fc,_0x2a4dcd){return client[_0x8f95('0x4')](_0x375fac,_0x37eb35)[_0x8f95('0x5')](function(_0x25f498){if(_0x25f498[_0x8f95('0x6')]){return _0x2a4dcd(_0x25f498[_0x8f95('0x6')][_0x8f95('0x7')]);}else{return _0x5e82fc(_0x25f498[_0x8f95('0x8')]);}})[_0x8f95('0x9')](function(_0x29055f){return _0x2a4dcd(_0x29055f);});});}exports['getSquareProject']=function(_0x2cce47){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x2cce47},'attributes':[_0x8f95('0xa')]}});};exports[_0x8f95('0xb')]=function(_0x21ad34){return request(_0x8f95('0xc'),{'options':{'raw':![],'where':{'id':_0x21ad34},'include':[{'model':'MailServerOut','as':_0x8f95('0xd')}],'attributes':['id',_0x8f95('0xe'),'email']}});};exports[_0x8f95('0xf')]=function(_0x95ece9){return request(_0x8f95('0x10'),{'options':{'where':{'id':_0x95ece9},'attributes':[_0x8f95('0xe')]}});};exports['getVoiceQueueById']=function(_0x381fa2){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x381fa2},'attributes':[_0x8f95('0xe')]}});};exports['getVariableById']=function(_0x19d0fc){return request(_0x8f95('0x11'),{'options':{'where':{'id':_0x19d0fc},'attributes':['name']}});};exports[_0x8f95('0x12')]=function(_0x4af84f){return request(_0x8f95('0x13'),{'options':{'where':{'id':_0x4af84f},'attributes':['dsn']}});};exports[_0x8f95('0x14')]=function(_0xe7a992){return request(_0x8f95('0x15'),{'options':{'where':{'id':_0xe7a992},'attributes':[_0x8f95('0xe')]}});};exports['getContactByPhone']=function(_0x242b26){console[_0x8f95('0x16')](_0x8f95('0x17'),_0x242b26);return request(_0x8f95('0x18'),{'options':{'where':{'phone':_0x242b26['phone']},'attributes':['id']}});};exports[_0x8f95('0x19')]=function(_0x216e53){return request('ShowTrunk',{'options':{'where':{'id':_0x216e53},'attributes':[_0x8f95('0xe')]}});};exports[_0x8f95('0x1a')]=function(_0x5e4deb){return request(_0x8f95('0x1b'),{'options':{'where':{'id':_0x5e4deb},'attributes':[_0x8f95('0x1c')]}});};exports[_0x8f95('0x1d')]=function(_0x353c14){return request(_0x8f95('0x1e'),{'options':{'raw':![],'where':{'id':_0x353c14},'include':[{'model':_0x8f95('0x1f'),'as':'Intervals'}]}});};exports[_0x8f95('0x20')]=function(_0xc99d55){return request(_0x8f95('0x21'),{'options':{'where':{'id':_0xc99d55},'attributes':['id',_0x8f95('0xe')]}});};exports[_0x8f95('0x22')]=function(_0x587520){return request(_0x8f95('0x23'),{'body':_0x587520});};exports[_0x8f95('0x24')]=function(_0x3f083d){return request(_0x8f95('0x25'),{'body':_0x3f083d});};exports[_0x8f95('0x26')]=function(_0x32b4b7){return request(_0x8f95('0x27'),{'body':_[_0x8f95('0x28')](_0x32b4b7,{'project_name':_0x32b4b7['arg_1'],'prev_project_name':_0x32b4b7[_0x8f95('0x29')]||'','is_subproject':_0x32b4b7[_0x8f95('0x29')]?!![]:![],'leaveAt':moment()['format'](_0x8f95('0x2a'))})});};exports['createSquareRecording']=function(_0x2df6bd){return request('CreateSquareRecording',{'body':_0x2df6bd});};exports[_0x8f95('0x2b')]=function(_0x65a61d){return request(_0x8f95('0x2c'),{'body':_0x65a61d});};exports[_0x8f95('0x2d')]=function(_0x129117){return request(_0x8f95('0x2e'),{'options':{'raw':![],'where':{'phone':_0x129117['phone'],'ListId':_0x129117[_0x8f95('0x2f')]}}})[_0x8f95('0x5')](function(_0x3062d8){if(_0x3062d8){return _0x3062d8;}return request('CreateCmContact',{'body':_0x129117});});};exports[_0x8f95('0x30')]=function(_0x243adc){return request(_0x8f95('0x31'),{'options':{'where':{'id':_0x243adc},'attributes':['name']}});};exports['agentLogin']=function(_0x4958b3,_0x3c5589){return request(_0x8f95('0x32'),{'body':{'interface':_0x3c5589},'options':{'where':_0x4958b3}});};exports['agentPause']=function(_0x3fb7db,_0x4eb2a7,_0x267a30){return request(_0x8f95('0x33'),{'body':{'type':_0x4eb2a7,'uniqueid':_0x267a30},'options':{'where':_0x3fb7db}});};exports[_0x8f95('0x34')]=function(_0xf9ecd){return request(_0x8f95('0x35'),{'body':{},'options':{'where':_0xf9ecd}});};exports[_0x8f95('0x36')]=function(_0x6c75b5){return request(_0x8f95('0x37'),{'body':{},'options':{'where':_0x6c75b5}});}; \ 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 3754e50..5abc735 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 _0x5db8=['exports','./polly','./lex'];(function(_0x246018,_0x116a00){var _0x40bc7d=function(_0x4ed867){while(--_0x4ed867){_0x246018['push'](_0x246018['shift']());}};_0x40bc7d(++_0x116a00);}(_0x5db8,0xbb));var _0x85db=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x5db8[_0x3cae69];return _0x3128eb;};var polly=require(_0x85db('0x0'));var lex=require(_0x85db('0x1'));module[_0x85db('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x68fc=['./polly','./lex','exports'];(function(_0x1c7a2c,_0x7d7ad3){var _0x57b3cd=function(_0x353958){while(--_0x353958){_0x1c7a2c['push'](_0x1c7a2c['shift']());}};_0x57b3cd(++_0x7d7ad3);}(_0x68fc,0xa5));var _0xc68f=function(_0x5807b4,_0x2d2bdc){_0x5807b4=_0x5807b4-0x0;var _0x34806e=_0x68fc[_0x5807b4];return _0x34806e;};var polly=require(_0xc68f('0x0'));var lex=require(_0xc68f('0x1'));module[_0xc68f('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index ade9301..3e1ebdd 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 _0x0cfa=['exports','./lib/api'];(function(_0x26d731,_0x1f08f9){var _0x4d71bd=function(_0x20c146){while(--_0x20c146){_0x26d731['push'](_0x26d731['shift']());}};_0x4d71bd(++_0x1f08f9);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x4d3aa1,_0x54bb3c){_0x4d3aa1=_0x4d3aa1-0x0;var _0x495b44=_0x0cfa[_0x4d3aa1];return _0x495b44;};'use strict';var lex=require(_0xa0cf('0x0'));module[_0xa0cf('0x1')]=function(_0x336e19,_0x166ba2,_0x4d6a1c,_0x525629,_0x4d8758,_0x37c4e1){return lex(_0x336e19,_0x166ba2,_0x4d6a1c,_0x525629,_0x4d8758,_0x37c4e1);}; \ No newline at end of file +var _0x8c25=['./lib/api','exports'];(function(_0x3c136f,_0x907e4a){var _0x312c40=function(_0x4cd013){while(--_0x4cd013){_0x3c136f['push'](_0x3c136f['shift']());}};_0x312c40(++_0x907e4a);}(_0x8c25,0x15e));var _0x58c2=function(_0x22206a,_0x427496){_0x22206a=_0x22206a-0x0;var _0x38c2b3=_0x8c25[_0x22206a];return _0x38c2b3;};'use strict';var lex=require(_0x58c2('0x0'));module[_0x58c2('0x1')]=function(_0x2c2f26,_0x163893,_0x30dc2c,_0x38dd7c,_0x4e657d,_0x2808d9){return lex(_0x2c2f26,_0x163893,_0x30dc2c,_0x38dd7c,_0x4e657d,_0x2808d9);}; \ 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 a655c43..029950e 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 _0xf5b2=['hasOwnProperty','slot_','exports','$LATEST','aws-sdk','postText','slots'];(function(_0x1082b1,_0x53db01){var _0x4f425f=function(_0x741f06){while(--_0x741f06){_0x1082b1['push'](_0x1082b1['shift']());}};_0x4f425f(++_0x53db01);}(_0xf5b2,0x146));var _0x2f5b=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0xf5b2[_0x4a0e68];return _0x4fb274;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x2f5b('0x0'));function lexResult(_0x142b39,_0x4c81a6){return new BPromise(function(_0x239aa3,_0x50cb11){_0x142b39[_0x2f5b('0x1')](_0x4c81a6,function(_0x5bfae4,_0x38d7a8){if(_0x5bfae4){_0x50cb11(_0x5bfae4);}if(_0x38d7a8['slots']){for(const _0x1c4de4 in _0x38d7a8[_0x2f5b('0x2')]){if(_0x38d7a8[_0x2f5b('0x2')][_0x2f5b('0x3')](_0x1c4de4)){var _0x53422a=_0x38d7a8['slots'][_0x1c4de4];_0x38d7a8[_0x2f5b('0x4')+_0x1c4de4]=_0x53422a;}}}_0x239aa3(_0x38d7a8);});});}module[_0x2f5b('0x5')]=function(_0x88e9ad,_0x280298,_0x28ed71,_0x368584,_0x40a585,_0x1dd522){var _0x1e1354=new AWS['LexRuntime']({'accessKeyId':_0x280298,'secretAccessKey':_0x28ed71,'region':_0x368584});var _0x93341e={'botAlias':_0x2f5b('0x6'),'botName':_0x1dd522,'inputText':_0x40a585,'userId':_0x88e9ad};return lexResult(_0x1e1354,_0x93341e);}; \ No newline at end of file +var _0x420b=['postText','slots','hasOwnProperty','exports','LexRuntime','$LATEST'];(function(_0x226cac,_0x1262c6){var _0x517c5b=function(_0xe198b1){while(--_0xe198b1){_0x226cac['push'](_0x226cac['shift']());}};_0x517c5b(++_0x1262c6);}(_0x420b,0x72));var _0xb420=function(_0x2fe62e,_0x5194a9){_0x2fe62e=_0x2fe62e-0x0;var _0x5744f=_0x420b[_0x2fe62e];return _0x5744f;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x5b0f79,_0x5ce28c){return new BPromise(function(_0xbcbd75,_0x48433f){_0x5b0f79[_0xb420('0x0')](_0x5ce28c,function(_0x12c2d9,_0x45c8e9){if(_0x12c2d9){_0x48433f(_0x12c2d9);}if(_0x45c8e9[_0xb420('0x1')]){for(const _0x279a79 in _0x45c8e9[_0xb420('0x1')]){if(_0x45c8e9['slots'][_0xb420('0x2')](_0x279a79)){var _0x4b596c=_0x45c8e9[_0xb420('0x1')][_0x279a79];_0x45c8e9['slot_'+_0x279a79]=_0x4b596c;}}}_0xbcbd75(_0x45c8e9);});});}module[_0xb420('0x3')]=function(_0x1fbe22,_0x220d80,_0x42d7b0,_0x2d6feb,_0xcd00ac,_0x25fa09){var _0xfc6bc7=new AWS[(_0xb420('0x4'))]({'accessKeyId':_0x220d80,'secretAccessKey':_0x42d7b0,'region':_0x2d6feb});var _0x243eee={'botAlias':_0xb420('0x5'),'botName':_0x25fa09,'inputText':_0xcd00ac,'userId':_0x1fbe22};return lexResult(_0xfc6bc7,_0x243eee);}; \ 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 9b3f0b7..28a8bf1 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 _0xbfae=['./lib/api','exports'];(function(_0x23991c,_0x307ed1){var _0x21fcde=function(_0xcf53aa){while(--_0xcf53aa){_0x23991c['push'](_0x23991c['shift']());}};_0x21fcde(++_0x307ed1);}(_0xbfae,0xc0));var _0xebfa=function(_0x3c61a8,_0x287fb7){_0x3c61a8=_0x3c61a8-0x0;var _0xa348c=_0xbfae[_0x3c61a8];return _0xa348c;};'use strict';var polly=require(_0xebfa('0x0'));module[_0xebfa('0x1')]=function(_0x2affb0,_0x189848,_0x26df31,_0x2fb8e5,_0x41d34c,_0x4ee48c,_0x6022bc){return polly(_0x2affb0,_0x189848,_0x26df31,_0x2fb8e5,_0x41d34c,_0x4ee48c,_0x6022bc);}; \ No newline at end of file +var _0xa881=['./lib/api','exports'];(function(_0x1a3448,_0x599ec3){var _0x310730=function(_0x32b956){while(--_0x32b956){_0x1a3448['push'](_0x1a3448['shift']());}};_0x310730(++_0x599ec3);}(_0xa881,0x1da));var _0x1a88=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa881[_0x20a584];return _0x4b41a8;};'use strict';var polly=require(_0x1a88('0x0'));module[_0x1a88('0x1')]=function(_0x723009,_0x244cf0,_0x3cf74f,_0x2170bd,_0x33120c,_0x29180e,_0x55c246){return polly(_0x723009,_0x244cf0,_0x3cf74f,_0x2170bd,_0x33120c,_0x29180e,_0x55c246);}; \ 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 c588e4b..a8901c1 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 _0x7cbd=['writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','aws-sdk','synthesizeSpeech'];(function(_0x4e1267,_0x1dd001){var _0x6ccaab=function(_0x53d429){while(--_0x53d429){_0x4e1267['push'](_0x4e1267['shift']());}};_0x6ccaab(++_0x1dd001);}(_0x7cbd,0x9f));var _0xd7cb=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x7cbd[_0x295314];return _0x584b0c;};'use strict';var fs=require('fs');var path=require(_0xd7cb('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0xd7cb('0x1'));function pollyResult(_0x29be5d,_0x1d403b,_0x2615a6){return new BPromise(function(_0x4a64d8,_0x3fcd56){_0x29be5d[_0xd7cb('0x2')](_0x1d403b,function(_0x38ec02,_0x1aa46e){if(_0x38ec02){_0x3fcd56(_0x38ec02);}else if(_0x1aa46e){if(_0x1aa46e['AudioStream']instanceof Buffer){fs[_0xd7cb('0x3')](_0x2615a6,_0x1aa46e[_0xd7cb('0x4')],function(_0x500be6){if(_0x500be6){_0x3fcd56(_0x500be6);}else{_0x4a64d8();}});}else{_0x3fcd56(new Error(_0xd7cb('0x5')));}}else{_0x3fcd56(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xd7cb('0x6')]=function(_0x42e0ca,_0x2630ee,_0x468a97,_0xee2fe1,_0x551d25,_0x42474c,_0x766336){var _0x1284e1=new AWS[(_0xd7cb('0x7'))]({'accessKeyId':_0x42e0ca,'secretAccessKey':_0x2630ee,'region':_0x468a97});var _0x436159={'Text':_0x551d25,'TextType':_0x42474c||'text','OutputFormat':_0xd7cb('0x8'),'VoiceId':_0xee2fe1};return pollyResult(_0x1284e1,_0x436159,_0x766336);}; \ No newline at end of file +var _0xc133=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','randomstring','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0xb5e222,_0x431ee4){var _0xb8501a=function(_0x60a936){while(--_0x60a936){_0xb5e222['push'](_0xb5e222['shift']());}};_0xb8501a(++_0x431ee4);}(_0xc133,0x152));var _0x3c13=function(_0x4dae04,_0x59b969){_0x4dae04=_0x4dae04-0x0;var _0x41674b=_0xc133[_0x4dae04];return _0x41674b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x3c13('0x0'));var AWS=require('aws-sdk');function pollyResult(_0xb9cbd6,_0x5a399d,_0x203612){return new BPromise(function(_0x401e8b,_0x2c3641){_0xb9cbd6['synthesizeSpeech'](_0x5a399d,function(_0x242a11,_0x24e687){if(_0x242a11){_0x2c3641(_0x242a11);}else if(_0x24e687){if(_0x24e687['AudioStream']instanceof Buffer){fs[_0x3c13('0x1')](_0x203612,_0x24e687[_0x3c13('0x2')],function(_0x27dfda){if(_0x27dfda){_0x2c3641(_0x27dfda);}else{_0x401e8b();}});}else{_0x2c3641(new Error(_0x3c13('0x3')));}}else{_0x2c3641(new Error(_0x3c13('0x4')));}});});}module[_0x3c13('0x5')]=function(_0xf615c1,_0x464444,_0xeef8b2,_0x359fd9,_0x281750,_0x57c9d2,_0xf3042d){var _0x155f9e=new AWS[(_0x3c13('0x6'))]({'accessKeyId':_0xf615c1,'secretAccessKey':_0x464444,'region':_0xeef8b2});var _0x5aa856={'Text':_0x281750,'TextType':_0x57c9d2||_0x3c13('0x7'),'OutputFormat':_0x3c13('0x8'),'VoiceId':_0x359fd9};return pollyResult(_0x155f9e,_0x5aa856,_0xf3042d);}; \ 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 db12264..62f62d0 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 _0x1eb4=['exports'];(function(_0x500e9a,_0x1719e4){var _0x512c5a=function(_0xa5ef57){while(--_0xa5ef57){_0x500e9a['push'](_0x500e9a['shift']());}};_0x512c5a(++_0x1719e4);}(_0x1eb4,0x1d5));var _0x41eb=function(_0x2179eb,_0x5ad3b6){_0x2179eb=_0x2179eb-0x0;var _0x39e0be=_0x1eb4[_0x2179eb];return _0x39e0be;};'use strict';var asr=require('./lib/api');module[_0x41eb('0x0')]=function(_0xf1b009,_0x161ffb,_0x4280f2,_0x5ac147){return asr(_0xf1b009,_0x161ffb,_0x4280f2);}; \ No newline at end of file +var _0xf212=['./lib/api','exports'];(function(_0x59c289,_0x56bf13){var _0x2c1c2e=function(_0x3143ac){while(--_0x3143ac){_0x59c289['push'](_0x59c289['shift']());}};_0x2c1c2e(++_0x56bf13);}(_0xf212,0x1c2));var _0x2f21=function(_0xbd6a78,_0x4e99c2){_0xbd6a78=_0xbd6a78-0x0;var _0x3801f5=_0xf212[_0xbd6a78];return _0x3801f5;};'use strict';var asr=require(_0x2f21('0x0'));module[_0x2f21('0x1')]=function(_0x3f200c,_0x732c3,_0x43e9e1,_0x49247e){return asr(_0x3f200c,_0x732c3,_0x43e9e1);}; \ 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 95398f8..7a23791 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 _0x0008=['https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird'];(function(_0x22cc4,_0x1178d6){var _0x267a6a=function(_0x11250f){while(--_0x11250f){_0x22cc4['push'](_0x22cc4['shift']());}};_0x267a6a(++_0x1178d6);}(_0x0008,0x1ed));var _0x8000=function(_0x3f2855,_0x220576){_0x3f2855=_0x3f2855-0x0;var _0x20c16f=_0x0008[_0x3f2855];return _0x20c16f;};'use strict';var url=require(_0x8000('0x0'));var BPromise=require(_0x8000('0x1'));var fs=require('fs');var host=_0x8000('0x2');module[_0x8000('0x3')]=function(_0x1983dc,_0x3a506c,_0x295e34){return new BPromise(function(_0x450823,_0x4a0dfc){var _0xc660ea;if(typeof _0x1983dc!==_0x8000('0x4')||_0x1983dc['length']===0x0){return _0x4a0dfc(_0x8000('0x5'));}if(typeof _0x3a506c!==_0x8000('0x4')||_0x3a506c['length']===0x0){return _0x4a0dfc(_0x8000('0x6'));}if(typeof _0x295e34!==_0x8000('0x7')&&(typeof _0x295e34!==_0x8000('0x4')||_0x295e34[_0x8000('0x8')]===0x0)){return _0x4a0dfc(_0x8000('0x9'));}try{_0xc660ea=fs['readFileSync'](_0x1983dc)[_0x8000('0xa')](_0x8000('0xb'));}catch(_0x2f1a25){return _0x4a0dfc(_0x2f1a25);}return _0x450823({'method':_0x8000('0xc'),'uri':host+_0x8000('0xd')+_0x3a506c,'body':{'config':{'encoding':_0x8000('0xe'),'sampleRateHertz':'8000','languageCode':_0x295e34},'audio':{'content':_0xc660ea}},'json':!![]});});}; \ No newline at end of file +var _0x1cf4=['/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64'];(function(_0x5e1f05,_0x156f00){var _0x578dc6=function(_0x4aa21f){while(--_0x4aa21f){_0x5e1f05['push'](_0x5e1f05['shift']());}};_0x578dc6(++_0x156f00);}(_0x1cf4,0x73));var _0x41cf=function(_0x2d2d50,_0x4c0459){_0x2d2d50=_0x2d2d50-0x0;var _0xe78bee=_0x1cf4[_0x2d2d50];return _0xe78bee;};'use strict';var url=require(_0x41cf('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x41cf('0x1');module['exports']=function(_0x24e406,_0x3cbda2,_0x5e4646){return new BPromise(function(_0x408aae,_0x4c2dc8){var _0x2c351d;if(typeof _0x24e406!=='string'||_0x24e406[_0x41cf('0x2')]===0x0){return _0x4c2dc8(_0x41cf('0x3'));}if(typeof _0x3cbda2!==_0x41cf('0x4')||_0x3cbda2[_0x41cf('0x2')]===0x0){return _0x4c2dc8(_0x41cf('0x5'));}if(typeof _0x5e4646!==_0x41cf('0x6')&&(typeof _0x5e4646!==_0x41cf('0x4')||_0x5e4646[_0x41cf('0x2')]===0x0)){return _0x4c2dc8(_0x41cf('0x7'));}try{_0x2c351d=fs[_0x41cf('0x8')](_0x24e406)[_0x41cf('0x9')](_0x41cf('0xa'));}catch(_0x5050d7){return _0x4c2dc8(_0x5050d7);}return _0x408aae({'method':'POST','uri':host+_0x41cf('0xb')+_0x3cbda2,'body':{'config':{'encoding':_0x41cf('0xc'),'sampleRateHertz':_0x41cf('0xd'),'languageCode':_0x5e4646},'audio':{'content':_0x2c351d}},'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 e396477..d0ff447 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 _0x2dd8=['exports','./asr'];(function(_0x149e3d,_0xd7a07){var _0x3c4caf=function(_0x4507bc){while(--_0x4507bc){_0x149e3d['push'](_0x149e3d['shift']());}};_0x3c4caf(++_0xd7a07);}(_0x2dd8,0x143));var _0x82dd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2dd8[_0x19e35c];return _0x3e1fe8;};var asr=require(_0x82dd('0x0'));module[_0x82dd('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf094=['./asr'];(function(_0x3d6626,_0x59da5f){var _0x11fe1e=function(_0x331a4e){while(--_0x331a4e){_0x3d6626['push'](_0x3d6626['shift']());}};_0x11fe1e(++_0x59da5f);}(_0xf094,0x1ee));var _0x4f09=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xf094[_0x5311e8];return _0x582ad8;};var asr=require(_0x4f09('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 39d682d..e97cb8e 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 _0x83d9=['model=%s','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','url','parse','bluebird','randomstring','request-promise','querystring','apiai-promise','./google','./aws','./tilde','./sestek','agi','https://api.ispeech.org/api/rest','protocol','https:','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','error','download\x20error','pipe','end','WHAT_EVER','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','then','777','split','?key=','ssml','input','voice','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','chmodSync','googleTTS','asr','uri','results','transcript','alternatives','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','stringify','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR'];(function(_0x2ef12d,_0x103abb){var _0x9d49ce=function(_0x3cf8b8){while(--_0x3cf8b8){_0x2ef12d['push'](_0x2ef12d['shift']());}};_0x9d49ce(++_0x103abb);}(_0x83d9,0xd2));var _0x983d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x83d9[_0x432682];return _0x463d05;};'use strict';var fs=require('fs');var path=require(_0x983d('0x0'));var http=require('http');var https=require('https');var urlParse=require(_0x983d('0x1'))[_0x983d('0x2')];var BPromise=require(_0x983d('0x3'));var rs=require(_0x983d('0x4'));var sox=require('sox');var rp=require(_0x983d('0x5'));var util=require('util');var querystring=require(_0x983d('0x6'));var tts=require('google-tts-api');var apiai=require(_0x983d('0x7'));var md5=require('md5');var google=require(_0x983d('0x8'));var aws=require(_0x983d('0x9'));var tilde=require(_0x983d('0xa'));var sestek=require(_0x983d('0xb'));var logger=require('../../../config/logger')(_0x983d('0xc'));var ISPEECH_API=_0x983d('0xd');function downloadFile(_0x301fd9,_0xc5c277){return new BPromise(function(_0x221bc9,_0x511768){var _0x512ccc=urlParse(_0x301fd9);var _0x235897=_0x512ccc[_0x983d('0xe')]===_0x983d('0xf')?https:http;var _0xc92ee={'host':_0x512ccc['host'],'path':_0x512ccc['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x235897[_0x983d('0x10')](_0xc92ee,function(_0x378610){if(_0x378610[_0x983d('0x11')]!==0xc8){logger['error'](_0x983d('0x12')+_0x301fd9+_0x983d('0x13')+_0x378610[_0x983d('0x11')]+'\x20('+_0x378610[_0x983d('0x14')]+')');_0x511768(new Error('request\x20to\x20'+_0x301fd9+'\x20failed,\x20status\x20code\x20=\x20'+_0x378610[_0x983d('0x11')]+'\x20('+_0x378610[_0x983d('0x14')]+')'));return;}var _0x3fd2ca=fs[_0x983d('0x15')](_0xc5c277);_0x3fd2ca['on'](_0x983d('0x16'),function(){logger[_0x983d('0x17')]('finish\x20download\x20file');_0x3fd2ca[_0x983d('0x18')](_0x221bc9);});_0x3fd2ca['on']('error',function(_0x4d5e63){fs[_0x983d('0x19')](_0xc5c277);logger[_0x983d('0x1a')](_0x983d('0x1b'),_0x4d5e63);_0x511768(_0x4d5e63);});_0x378610[_0x983d('0x1c')](_0x3fd2ca);})['on'](_0x983d('0x1a'),function(_0x9ba32e){logger[_0x983d('0x1a')](_0x9ba32e);_0x511768(_0x9ba32e);})[_0x983d('0x1d')]();});}function uploadFile(_0x19e97a){return new BPromise(function(_0x36b6fa,_0x3c4268){var _0x56d2d7=urlParse(_0x19e97a);var _0x13dcea=_0x56d2d7[_0x983d('0xe')]===_0x983d('0xf')?https:http;var _0x46a32f={'host':_0x56d2d7['host'],'path':_0x56d2d7[_0x983d('0x0')],'headers':{'user-agent':_0x983d('0x1e')}};_0x13dcea[_0x983d('0x10')](_0x46a32f,function(_0x461878){if(_0x461878['statusCode']!==0xc8){_0x3c4268(new Error(_0x983d('0x12')+_0x19e97a+_0x983d('0x13')+_0x461878[_0x983d('0x11')]+'\x20('+_0x461878['statusMessage']+')'));return;}var _0x535853='';_0x461878['on'](_0x983d('0x1f'),function(_0x585d9a){_0x535853+=_0x585d9a;});_0x461878['on'](_0x983d('0x1d'),function(){_0x36b6fa(_0x535853);});})['on'](_0x983d('0x1a'),function(_0x1ceab5){_0x3c4268(_0x1ceab5);})['end']();});}function convertFile(_0x4092ab,_0x9fd4df){return new BPromise(function(_0x4d4a65,_0x48dd36){var _0x12ebe2=sox[_0x983d('0x20')](_0x4092ab,_0x9fd4df,{'sampleRate':0x1f40,'format':_0x983d('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x12ebe2['on'](_0x983d('0x1a'),function(_0x57004e){logger[_0x983d('0x1a')](_0x983d('0x22'),_0x57004e);_0x48dd36(_0x57004e);});_0x12ebe2['on'](_0x983d('0x1d'),function(){logger['info'](_0x983d('0x23'));_0x4d4a65();});_0x12ebe2[_0x983d('0x24')]();});}function base64Decode(_0x596e6c,_0xc3ab2b){var _0x2ebf2a=path[_0x983d('0x25')](__dirname,_0x983d('0x26'),rs[_0x983d('0x27')](0x4)+_0x983d('0x28'));fs['writeFileSync'](_0x2ebf2a,_0x596e6c,'base64');return convertFile(_0x2ebf2a,_0xc3ab2b)[_0x983d('0x29')](function(){try{fs[_0x983d('0x19')](_0x2ebf2a);fs['chmodSync'](_0xc3ab2b,_0x983d('0x2a'));}catch(_0x57bbdc){logger[_0x983d('0x1a')](_0x57bbdc);}return _0xc3ab2b[_0x983d('0x2b')]('.')[0x0];});}function base64Encode(_0x4fb9d1){var _0x5ed9dd=fs['readFileSync'](_0x4fb9d1);return new Buffer(_0x5ed9dd)['toString']('base64');}exports['googleCloudTTS']=function(_0x510023,_0x5eb47f,_0x4ea294,_0x38f4d9,_0x50ff63,_0x188696){var _0x32e7e4,_0x1d98eb;var _0x382a8b='https://texttospeech.googleapis.com/v1/';var _0x37e8ec=_0x983d('0x2c')+_0x510023;var _0x250ceb={};if(_0x5eb47f===_0x983d('0x2d')){_0x250ceb[_0x983d('0x2e')]={'ssml':_0x4ea294};}else{_0x250ceb[_0x983d('0x2e')]={'text':_0x4ea294};};_0x250ceb[_0x983d('0x2f')]={'languageCode':_0x38f4d9,'ssmlGender':_0x50ff63};_0x250ceb['audioConfig']={'audioEncoding':_0x983d('0x30'),'sampleRateHertz':0x1f40};var _0x47bcc0={'url':_0x382a8b+_0x983d('0x31')+_0x37e8ec,'method':_0x983d('0x32'),'json':!![],'body':_0x250ceb};return rp(_0x47bcc0)[_0x983d('0x29')](function(_0x513f22){return new BPromise(function(_0x370ffe,_0x1ed1a1){_0x32e7e4=path['resolve'](__dirname,_0x983d('0x26'),rs['generate'](0x4)+_0x983d('0x33'));var _0x41a16d=Buffer[_0x983d('0x34')](_0x513f22[_0x983d('0x35')],'base64');return fs[_0x983d('0x36')](_0x32e7e4,_0x41a16d,function(_0x6b3f81){_0x1ed1a1(_0x6b3f81);},function(_0x5ba17a){fs[_0x983d('0x37')](_0x32e7e4,_0x983d('0x2a'));_0x370ffe(_0x5ba17a);});});})[_0x983d('0x29')](function(_0x200517){_0x1d98eb=path['resolve'](__dirname,_0x983d('0x26'),rs[_0x983d('0x27')](0x4)+'.wav');return convertFile(_0x32e7e4,_0x1d98eb);})[_0x983d('0x29')](function(){try{fs['unlink'](_0x32e7e4);fs[_0x983d('0x37')](_0x1d98eb,_0x983d('0x2a'));}catch(_0x250f10){logger[_0x983d('0x1a')](_0x250f10);}logger[_0x983d('0x17')]('googleCloudTTS\x20path',_0x1d98eb[_0x983d('0x2b')]('.')[0x0]);return _0x1d98eb[_0x983d('0x2b')]('.')[0x0];});};exports[_0x983d('0x38')]=function(_0x3d1367,_0x3d36ab){var _0x1ae2af,_0xf5e277;return tts(_0x3d1367,_0x3d36ab||'en',0x1)['then'](function(_0x145007){logger['info'](_0x145007);_0x1ae2af=path['resolve'](__dirname,_0x983d('0x26'),rs[_0x983d('0x27')](0x4)+_0x983d('0x33'));return downloadFile(_0x145007,_0x1ae2af);})[_0x983d('0x29')](function(){_0xf5e277=path[_0x983d('0x25')](__dirname,'tmp',rs[_0x983d('0x27')](0x4)+_0x983d('0x28'));return convertFile(_0x1ae2af,_0xf5e277);})[_0x983d('0x29')](function(){try{fs[_0x983d('0x19')](_0x1ae2af);fs[_0x983d('0x37')](_0xf5e277,_0x983d('0x2a'));}catch(_0x400cba){logger['error'](_0x400cba);}logger[_0x983d('0x17')]('goggleTTS\x20path',_0xf5e277[_0x983d('0x2b')]('.')[0x0]);return _0xf5e277['split']('.')[0x0];});};exports['googleASR']=function(_0x373db4,_0x382837,_0x182ba0){return google[_0x983d('0x39')](_0x373db4,_0x382837,_0x182ba0)[_0x983d('0x29')](function(_0x4f10cc){logger[_0x983d('0x17')](_0x4f10cc[_0x983d('0x3a')]);return rp(_0x4f10cc);})[_0x983d('0x29')](function(_0x4d7fe6){var _0x4c1db5='';var _0x2af552=0x0;try{fs[_0x983d('0x19')](_0x373db4);}catch(_0x5919eb){logger[_0x983d('0x1a')](_0x5919eb);}if(_0x4d7fe6&&_0x4d7fe6[_0x983d('0x3b')]){_0x4c1db5=_0x4d7fe6['results']['map'](function(_0x12ecf7){return _0x12ecf7&&_0x12ecf7['alternatives'][0x0]&&_0x12ecf7['alternatives'][0x0][_0x983d('0x3c')]?_0x12ecf7[_0x983d('0x3d')][0x0]['transcript']:'';})[_0x983d('0x3e')]('\x0a');_0x2af552=_0x4d7fe6['results'][_0x983d('0x3f')](function(_0x1e5bdf){return _0x1e5bdf&&_0x1e5bdf['alternatives'][0x0]&&_0x1e5bdf[_0x983d('0x3d')][0x0][_0x983d('0x40')]?_0x1e5bdf[_0x983d('0x3d')][0x0]['confidence']:0x0;})[_0x983d('0x3e')]('\x0a');}logger[_0x983d('0x17')](_0x983d('0x41'),_0x4c1db5);logger[_0x983d('0x17')](_0x983d('0x42'),_0x2af552);return{'transcript':_0x4c1db5,'confidence':_0x2af552};})[_0x983d('0x43')](function(_0x41af96){logger['error'](_0x983d('0x44'),_0x41af96[_0x983d('0x11')],_0x41af96['name'],_0x41af96[_0x983d('0x45')]);});};exports[_0x983d('0x46')]=function(_0xbc1a92,_0x56c25b,_0x5554a2,_0x52a7bf){var _0x55d264=apiai(_0x56c25b,{'language':_0x52a7bf||'en'});return _0x55d264['textRequest'](_0x5554a2,{'sessionId':md5(_0xbc1a92)})[_0x983d('0x29')](function(_0x5e390c){logger[_0x983d('0x17')](JSON[_0x983d('0x47')](_0x5e390c));return{'source':_0x5e390c['result']['source'],'resolvedQuery':_0x5e390c[_0x983d('0x48')][_0x983d('0x49')],'action':_0x5e390c[_0x983d('0x48')][_0x983d('0x4a')],'actionIncomplete':_0x5e390c[_0x983d('0x48')][_0x983d('0x4b')],'speech':_0x5e390c['result'][_0x983d('0x4c')][_0x983d('0x4d')],'score':_0x5e390c[_0x983d('0x48')][_0x983d('0x4e')],'statusCode':_0x5e390c['status'][_0x983d('0x4f')],'endConversation':_0x5e390c['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x5e390c[_0x983d('0x48')][_0x983d('0x50')]['isFallbackIntent']};});};exports[_0x983d('0x51')]=function(_0x490b37,_0x55cca1,_0x4343ac,_0x24b037){return tilde['asr'](_0x490b37,_0x55cca1,_0x4343ac,_0x24b037)[_0x983d('0x29')](function(_0x4f0227){try{fs[_0x983d('0x19')](_0x490b37);}catch(_0x1bc7fd){logger[_0x983d('0x1a')](_0x1bc7fd);}logger[_0x983d('0x17')](_0x983d('0x52'),_0x4f0227[_0x983d('0x3c')]);logger[_0x983d('0x17')](_0x983d('0x53'),_0x4f0227[_0x983d('0x40')]);return _0x4f0227;});};exports[_0x983d('0x54')]=function(_0x504f9b,_0x1af534,_0x119153,_0x17b53e,_0x538945,_0x4e5cf5){var _0x4c2fb0=path[_0x983d('0x25')](__dirname,_0x983d('0x26'),rs[_0x983d('0x27')](0x4)+_0x983d('0x33'));var _0x3d8a89;return aws['polly'](_0x504f9b,_0x1af534,_0x119153,_0x17b53e,_0x538945,_0x4e5cf5,_0x4c2fb0)[_0x983d('0x29')](function(){_0x3d8a89=path[_0x983d('0x25')](__dirname,_0x983d('0x26'),rs['generate'](0x4)+_0x983d('0x28'));return convertFile(_0x4c2fb0,_0x3d8a89);})[_0x983d('0x29')](function(){try{fs[_0x983d('0x19')](_0x4c2fb0);fs[_0x983d('0x37')](_0x3d8a89,'777');}catch(_0x516277){logger[_0x983d('0x1a')](_0x516277);}return _0x3d8a89[_0x983d('0x2b')]('.')[0x0];});};exports['awsLex']=function(_0x24020a,_0x5185bd,_0x458d83,_0x3b19a8,_0x3bdac7,_0x1c2d09){return aws[_0x983d('0x55')](_0x24020a,_0x5185bd,_0x458d83,_0x3b19a8,_0x3bdac7,_0x1c2d09)[_0x983d('0x29')](function(_0x54b0d4){logger[_0x983d('0x17')](JSON[_0x983d('0x47')](_0x54b0d4));return _0x54b0d4;});};exports[_0x983d('0x56')]=function(_0x54cc91,_0x248003,_0x5ea1fe,_0x213967){var _0x3236df=util[_0x983d('0x57')](_0x983d('0x58'),ISPEECH_API,_0x54cc91,encodeURIComponent(_0x248003),_0x5ea1fe,_0x213967);var _0x22b63a=path[_0x983d('0x25')](__dirname,_0x983d('0x26'),rs[_0x983d('0x27')](0x4)+_0x983d('0x33'));var _0x2c93fe;return downloadFile(_0x3236df,_0x22b63a)[_0x983d('0x29')](function(){_0x2c93fe=path['resolve'](__dirname,_0x983d('0x26'),rs[_0x983d('0x27')](0x4)+_0x983d('0x28'));return convertFile(_0x22b63a,_0x2c93fe);})['then'](function(){try{fs['unlink'](_0x22b63a);fs[_0x983d('0x37')](_0x2c93fe,_0x983d('0x2a'));}catch(_0x5e5c14){logger['error'](_0x5e5c14);}return _0x2c93fe[_0x983d('0x2b')]('.')[0x0];});};exports[_0x983d('0x59')]=function(_0x4efcb8,_0x4ee7a9,_0x43826a,_0x247b4c){var _0x4f709c=util[_0x983d('0x57')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x4ee7a9,_0x43826a,base64Encode(_0x4efcb8),_0x247b4c?util[_0x983d('0x57')](_0x983d('0x5a'),encodeURIComponent(_0x247b4c)):'freeform=3');return uploadFile(_0x4f709c)[_0x983d('0x29')](function(_0x599cf9){return querystring[_0x983d('0x2')](_0x599cf9);});};exports['sestekNDA']=function(_0x1f497c,_0x40a30d){return sestek[_0x983d('0x5b')](_0x1f497c,_0x40a30d)[_0x983d('0x29')](function(_0x55500e){logger[_0x983d('0x17')](JSON[_0x983d('0x47')](_0x55500e));var _0x59810a={'speech':_0x55500e[_0x983d('0x5c')],'action':_0x55500e[_0x983d('0x5d')]?_0x55500e[_0x983d('0x5d')][_0x983d('0x5e')]:undefined,'actiondata':_0x55500e[_0x983d('0x5d')]?_0x55500e[_0x983d('0x5d')][_0x983d('0x5f')]:undefined};if(_0x55500e[_0x983d('0x5d')]&&_0x55500e['channelData'][_0x983d('0x60')]){return base64Decode(_0x55500e[_0x983d('0x5d')][_0x983d('0x60')][_0x983d('0x61')],path[_0x983d('0x25')](__dirname,_0x983d('0x26'),rs[_0x983d('0x27')](0x4)+'.wav'))[_0x983d('0x29')](function(_0x177149){_0x59810a[_0x983d('0x62')]=_0x177149;return _0x59810a;});}return _0x59810a;});};exports[_0x983d('0x63')]=function(){return __dirname;}; \ No newline at end of file +var _0x092d=['lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','stringify','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','http','https','parse','bluebird','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','path','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish\x20download\x20file','close','unlink','https:','data','end','wav','info','finish\x20to\x20convert','generate','base64','then','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','resolve','.mp3','audioContent','writeFile','777','tmp','chmodSync','split','googleTTS','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','transcript','join','alternatives','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','message','googleDialogflow','textRequest','result','actionIncomplete','fulfillment','speech','score','status','code','metadata','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly'];(function(_0x1298fb,_0x54aed3){var _0x221b9d=function(_0x45aecc){while(--_0x45aecc){_0x1298fb['push'](_0x1298fb['shift']());}};_0x221b9d(++_0x54aed3);}(_0x092d,0xdc));var _0xd092=function(_0x13d153,_0x3edda1){_0x13d153=_0x13d153-0x0;var _0x508a08=_0x092d[_0x13d153];return _0x508a08;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0xd092('0x0'));var https=require(_0xd092('0x1'));var urlParse=require('url')[_0xd092('0x2')];var BPromise=require(_0xd092('0x3'));var rs=require(_0xd092('0x4'));var sox=require(_0xd092('0x5'));var rp=require(_0xd092('0x6'));var util=require(_0xd092('0x7'));var querystring=require(_0xd092('0x8'));var tts=require(_0xd092('0x9'));var apiai=require(_0xd092('0xa'));var md5=require(_0xd092('0xb'));var google=require(_0xd092('0xc'));var aws=require(_0xd092('0xd'));var tilde=require(_0xd092('0xe'));var sestek=require('./sestek');var logger=require(_0xd092('0xf'))('agi');var ISPEECH_API=_0xd092('0x10');function downloadFile(_0xab88ec,_0x16a745){return new BPromise(function(_0xacb98,_0xd74ac5){var _0xde3a69=urlParse(_0xab88ec);var _0x4ab8a3=_0xde3a69[_0xd092('0x11')]==='https:'?https:http;var _0x4570e8={'host':_0xde3a69[_0xd092('0x12')],'path':_0xde3a69[_0xd092('0x13')],'headers':{'user-agent':_0xd092('0x14')}};_0x4ab8a3['get'](_0x4570e8,function(_0x349c5a){if(_0x349c5a[_0xd092('0x15')]!==0xc8){logger[_0xd092('0x16')](_0xd092('0x17')+_0xab88ec+_0xd092('0x18')+_0x349c5a[_0xd092('0x15')]+'\x20('+_0x349c5a[_0xd092('0x19')]+')');_0xd74ac5(new Error(_0xd092('0x17')+_0xab88ec+_0xd092('0x18')+_0x349c5a[_0xd092('0x15')]+'\x20('+_0x349c5a[_0xd092('0x19')]+')'));return;}var _0x464711=fs['createWriteStream'](_0x16a745);_0x464711['on']('finish',function(){logger['info'](_0xd092('0x1a'));_0x464711[_0xd092('0x1b')](_0xacb98);});_0x464711['on'](_0xd092('0x16'),function(_0x496564){fs[_0xd092('0x1c')](_0x16a745);logger[_0xd092('0x16')]('download\x20error',_0x496564);_0xd74ac5(_0x496564);});_0x349c5a['pipe'](_0x464711);})['on'](_0xd092('0x16'),function(_0x4b4ecf){logger[_0xd092('0x16')](_0x4b4ecf);_0xd74ac5(_0x4b4ecf);})['end']();});}function uploadFile(_0x46d427){return new BPromise(function(_0xe58926,_0x133f6d){var _0x4eb729=urlParse(_0x46d427);var _0x5d64a4=_0x4eb729['protocol']===_0xd092('0x1d')?https:http;var _0x4d123c={'host':_0x4eb729[_0xd092('0x12')],'path':_0x4eb729['path'],'headers':{'user-agent':_0xd092('0x14')}};_0x5d64a4['get'](_0x4d123c,function(_0x4df2a0){if(_0x4df2a0[_0xd092('0x15')]!==0xc8){_0x133f6d(new Error(_0xd092('0x17')+_0x46d427+_0xd092('0x18')+_0x4df2a0[_0xd092('0x15')]+'\x20('+_0x4df2a0['statusMessage']+')'));return;}var _0x22262c='';_0x4df2a0['on'](_0xd092('0x1e'),function(_0xfa0e24){_0x22262c+=_0xfa0e24;});_0x4df2a0['on'](_0xd092('0x1f'),function(){_0xe58926(_0x22262c);});})['on'](_0xd092('0x16'),function(_0x3a0da1){_0x133f6d(_0x3a0da1);})[_0xd092('0x1f')]();});}function convertFile(_0x3310d6,_0x278886){return new BPromise(function(_0x1d8e18,_0x469527){var _0x486cdd=sox['transcode'](_0x3310d6,_0x278886,{'sampleRate':0x1f40,'format':_0xd092('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x486cdd['on'](_0xd092('0x16'),function(_0x410b39){logger[_0xd092('0x16')]('error\x20convert',_0x410b39);_0x469527(_0x410b39);});_0x486cdd['on']('end',function(){logger[_0xd092('0x21')](_0xd092('0x22'));_0x1d8e18();});_0x486cdd['start']();});}function base64Decode(_0x4a04ca,_0x13e186){var _0xd59fa6=path['resolve'](__dirname,'tmp',rs[_0xd092('0x23')](0x4)+'.wav');fs['writeFileSync'](_0xd59fa6,_0x4a04ca,_0xd092('0x24'));return convertFile(_0xd59fa6,_0x13e186)[_0xd092('0x25')](function(){try{fs[_0xd092('0x1c')](_0xd59fa6);fs['chmodSync'](_0x13e186,'777');}catch(_0x2b9fa7){logger[_0xd092('0x16')](_0x2b9fa7);}return _0x13e186['split']('.')[0x0];});}function base64Encode(_0x5980d5){var _0x314406=fs[_0xd092('0x26')](_0x5980d5);return new Buffer(_0x314406)['toString'](_0xd092('0x24'));}exports[_0xd092('0x27')]=function(_0x57274e,_0x7741cd,_0x59c44d,_0x326450,_0x5a103c,_0x3ff21){var _0x4ea8f5,_0x483871;var _0x5984fc=_0xd092('0x28');var _0x17f110=_0xd092('0x29')+_0x57274e;var _0x30b493={};if(_0x7741cd===_0xd092('0x2a')){_0x30b493[_0xd092('0x2b')]={'ssml':_0x59c44d};}else{_0x30b493[_0xd092('0x2b')]={'text':_0x59c44d};};_0x30b493[_0xd092('0x2c')]={'languageCode':_0x326450,'ssmlGender':_0x5a103c};_0x30b493[_0xd092('0x2d')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x31dc02={'url':_0x5984fc+_0xd092('0x2e')+_0x17f110,'method':_0xd092('0x2f'),'json':!![],'body':_0x30b493};return rp(_0x31dc02)[_0xd092('0x25')](function(_0x3a188e){return new BPromise(function(_0x1aee9d,_0x5d86ef){_0x4ea8f5=path[_0xd092('0x30')](__dirname,'tmp',rs[_0xd092('0x23')](0x4)+_0xd092('0x31'));var _0xb64726=Buffer['from'](_0x3a188e[_0xd092('0x32')],'base64');return fs[_0xd092('0x33')](_0x4ea8f5,_0xb64726,function(_0x29b6fe){_0x5d86ef(_0x29b6fe);},function(_0x3d3a3){fs['chmodSync'](_0x4ea8f5,_0xd092('0x34'));_0x1aee9d(_0x3d3a3);});});})[_0xd092('0x25')](function(_0x5e106e){_0x483871=path[_0xd092('0x30')](__dirname,_0xd092('0x35'),rs[_0xd092('0x23')](0x4)+'.wav');return convertFile(_0x4ea8f5,_0x483871);})['then'](function(){try{fs[_0xd092('0x1c')](_0x4ea8f5);fs[_0xd092('0x36')](_0x483871,'777');}catch(_0x22c803){logger[_0xd092('0x16')](_0x22c803);}logger[_0xd092('0x21')]('googleCloudTTS\x20path',_0x483871[_0xd092('0x37')]('.')[0x0]);return _0x483871[_0xd092('0x37')]('.')[0x0];});};exports[_0xd092('0x38')]=function(_0x5e9844,_0x421480){var _0x651192,_0x158892;return tts(_0x5e9844,_0x421480||'en',0x1)[_0xd092('0x25')](function(_0x506172){logger[_0xd092('0x21')](_0x506172);_0x651192=path[_0xd092('0x30')](__dirname,_0xd092('0x35'),rs[_0xd092('0x23')](0x4)+_0xd092('0x31'));return downloadFile(_0x506172,_0x651192);})['then'](function(){_0x158892=path['resolve'](__dirname,_0xd092('0x35'),rs[_0xd092('0x23')](0x4)+_0xd092('0x39'));return convertFile(_0x651192,_0x158892);})[_0xd092('0x25')](function(){try{fs['unlink'](_0x651192);fs[_0xd092('0x36')](_0x158892,'777');}catch(_0x78204e){logger[_0xd092('0x16')](_0x78204e);}logger['info'](_0xd092('0x3a'),_0x158892['split']('.')[0x0]);return _0x158892[_0xd092('0x37')]('.')[0x0];});};exports[_0xd092('0x3b')]=function(_0x15544c,_0x50b91a,_0x470a6c){return google[_0xd092('0x3c')](_0x15544c,_0x50b91a,_0x470a6c)[_0xd092('0x25')](function(_0x401769){logger[_0xd092('0x21')](_0x401769[_0xd092('0x3d')]);return rp(_0x401769);})['then'](function(_0x4e8be2){var _0x2de1fd='';var _0x234d78=0x0;try{fs[_0xd092('0x1c')](_0x15544c);}catch(_0x3b39dd){logger[_0xd092('0x16')](_0x3b39dd);}if(_0x4e8be2&&_0x4e8be2[_0xd092('0x3e')]){_0x2de1fd=_0x4e8be2[_0xd092('0x3e')][_0xd092('0x3f')](function(_0x1912e4){return _0x1912e4&&_0x1912e4['alternatives'][0x0]&&_0x1912e4['alternatives'][0x0][_0xd092('0x40')]?_0x1912e4['alternatives'][0x0]['transcript']:'';})[_0xd092('0x41')]('\x0a');_0x234d78=_0x4e8be2[_0xd092('0x3e')][_0xd092('0x3f')](function(_0x3b77a7){return _0x3b77a7&&_0x3b77a7[_0xd092('0x42')][0x0]&&_0x3b77a7[_0xd092('0x42')][0x0][_0xd092('0x43')]?_0x3b77a7[_0xd092('0x42')][0x0][_0xd092('0x43')]:0x0;})['join']('\x0a');}logger[_0xd092('0x21')](_0xd092('0x44'),_0x2de1fd);logger['info'](_0xd092('0x45'),_0x234d78);return{'transcript':_0x2de1fd,'confidence':_0x234d78};})[_0xd092('0x46')](function(_0xac3c30){logger[_0xd092('0x16')]('[%s]\x20%s:%s',_0xac3c30[_0xd092('0x15')],_0xac3c30['name'],_0xac3c30[_0xd092('0x47')]);});};exports[_0xd092('0x48')]=function(_0x22222a,_0x29ddc3,_0x43a9c2,_0x539e06){var _0x1c8d51=apiai(_0x29ddc3,{'language':_0x539e06||'en'});return _0x1c8d51[_0xd092('0x49')](_0x43a9c2,{'sessionId':md5(_0x22222a)})['then'](function(_0x10511d){logger['info'](JSON['stringify'](_0x10511d));return{'source':_0x10511d[_0xd092('0x4a')]['source'],'resolvedQuery':_0x10511d[_0xd092('0x4a')]['resolvedQuery'],'action':_0x10511d[_0xd092('0x4a')]['action'],'actionIncomplete':_0x10511d[_0xd092('0x4a')][_0xd092('0x4b')],'speech':_0x10511d[_0xd092('0x4a')][_0xd092('0x4c')][_0xd092('0x4d')],'score':_0x10511d[_0xd092('0x4a')][_0xd092('0x4e')],'statusCode':_0x10511d[_0xd092('0x4f')][_0xd092('0x50')],'endConversation':_0x10511d[_0xd092('0x4a')][_0xd092('0x51')]['endConversation']||![],'isFallbackIntent':_0x10511d['result'][_0xd092('0x51')]['isFallbackIntent']};});};exports[_0xd092('0x52')]=function(_0x430087,_0x4eb21d,_0x4e081c,_0x23a466){return tilde[_0xd092('0x3c')](_0x430087,_0x4eb21d,_0x4e081c,_0x23a466)[_0xd092('0x25')](function(_0x38354f){try{fs['unlink'](_0x430087);}catch(_0x359213){logger['error'](_0x359213);}logger[_0xd092('0x21')](_0xd092('0x53'),_0x38354f[_0xd092('0x40')]);logger[_0xd092('0x21')](_0xd092('0x54'),_0x38354f[_0xd092('0x43')]);return _0x38354f;});};exports['awsPolly']=function(_0x51d79f,_0x3e21c7,_0x38fe64,_0x4fc7bd,_0x1914d7,_0x58c254){var _0x5d06e8=path[_0xd092('0x30')](__dirname,_0xd092('0x35'),rs[_0xd092('0x23')](0x4)+_0xd092('0x31'));var _0x1fff8e;return aws[_0xd092('0x55')](_0x51d79f,_0x3e21c7,_0x38fe64,_0x4fc7bd,_0x1914d7,_0x58c254,_0x5d06e8)[_0xd092('0x25')](function(){_0x1fff8e=path[_0xd092('0x30')](__dirname,_0xd092('0x35'),rs[_0xd092('0x23')](0x4)+_0xd092('0x39'));return convertFile(_0x5d06e8,_0x1fff8e);})[_0xd092('0x25')](function(){try{fs[_0xd092('0x1c')](_0x5d06e8);fs[_0xd092('0x36')](_0x1fff8e,_0xd092('0x34'));}catch(_0x2e6e2e){logger[_0xd092('0x16')](_0x2e6e2e);}return _0x1fff8e['split']('.')[0x0];});};exports['awsLex']=function(_0x1f727c,_0x3e6a7e,_0x416fe3,_0x3b09b2,_0x2cea91,_0x6231bb){return aws[_0xd092('0x56')](_0x1f727c,_0x3e6a7e,_0x416fe3,_0x3b09b2,_0x2cea91,_0x6231bb)['then'](function(_0x12e0db){logger[_0xd092('0x21')](JSON['stringify'](_0x12e0db));return _0x12e0db;});};exports[_0xd092('0x57')]=function(_0x4a02a0,_0x561a66,_0x37d471,_0x585889){var _0x5eb22e=util[_0xd092('0x58')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4a02a0,encodeURIComponent(_0x561a66),_0x37d471,_0x585889);var _0x217968=path[_0xd092('0x30')](__dirname,_0xd092('0x35'),rs[_0xd092('0x23')](0x4)+_0xd092('0x31'));var _0x3636b9;return downloadFile(_0x5eb22e,_0x217968)[_0xd092('0x25')](function(){_0x3636b9=path[_0xd092('0x30')](__dirname,_0xd092('0x35'),rs[_0xd092('0x23')](0x4)+_0xd092('0x39'));return convertFile(_0x217968,_0x3636b9);})[_0xd092('0x25')](function(){try{fs[_0xd092('0x1c')](_0x217968);fs[_0xd092('0x36')](_0x3636b9,'777');}catch(_0x56688a){logger[_0xd092('0x16')](_0x56688a);}return _0x3636b9[_0xd092('0x37')]('.')[0x0];});};exports[_0xd092('0x59')]=function(_0x1148a1,_0x3ac4b6,_0x1f4354,_0x524ed2){var _0x773596=util[_0xd092('0x58')](_0xd092('0x5a'),ISPEECH_API,_0x3ac4b6,_0x1f4354,base64Encode(_0x1148a1),_0x524ed2?util[_0xd092('0x58')]('model=%s',encodeURIComponent(_0x524ed2)):_0xd092('0x5b'));return uploadFile(_0x773596)[_0xd092('0x25')](function(_0x3f4440){return querystring[_0xd092('0x2')](_0x3f4440);});};exports[_0xd092('0x5c')]=function(_0x3dc175,_0x2536c7){return sestek[_0xd092('0x5d')](_0x3dc175,_0x2536c7)[_0xd092('0x25')](function(_0x148814){logger[_0xd092('0x21')](JSON[_0xd092('0x5e')](_0x148814));var _0x3ff145={'speech':_0x148814['text'],'action':_0x148814['channelData']?_0x148814[_0xd092('0x5f')][_0xd092('0x60')]:undefined,'actiondata':_0x148814[_0xd092('0x5f')]?_0x148814[_0xd092('0x5f')][_0xd092('0x61')]:undefined};if(_0x148814[_0xd092('0x5f')]&&_0x148814[_0xd092('0x5f')][_0xd092('0x62')]){return base64Decode(_0x148814['channelData'][_0xd092('0x62')][_0xd092('0x63')],path[_0xd092('0x30')](__dirname,'tmp',rs[_0xd092('0x23')](0x4)+_0xd092('0x39')))[_0xd092('0x25')](function(_0xf76058){_0x3ff145[_0xd092('0x64')]=_0xf76058;return _0x3ff145;});}return _0x3ff145;});};exports[_0xd092('0x65')]=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 9b2f055..2c29b3d 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 _0xc4ab=['./nda'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0xc4ab,0xe8));var _0xbc4a=function(_0x17dd62,_0x40e5e4){_0x17dd62=_0x17dd62-0x0;var _0x42a9ea=_0xc4ab[_0x17dd62];return _0x42a9ea;};var nda=require(_0xbc4a('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x6063=['exports'];(function(_0x55faa5,_0x5ab290){var _0x10b2a2=function(_0x38f672){while(--_0x38f672){_0x55faa5['push'](_0x55faa5['shift']());}};_0x10b2a2(++_0x5ab290);}(_0x6063,0xea));var _0x3606=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6063[_0x167cc1];return _0x10bc4b;};var nda=require('./nda');module[_0x3606('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 6c45459..edb27bc 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 _0x6b9c=['agi','exports','/token','username','password','then','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','extension','text','access_token','project','channelData','ndagenerate_audio','audio/wav','custom_action','body','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x6b9c,0x133));var _0xc6b9=function(_0x4c2636,_0x103c16){_0x4c2636=_0x4c2636-0x0;var _0x24bd0f=_0x6b9c[_0x4c2636];return _0x24bd0f;};'use strict';var rp=require(_0xc6b9('0x0'));var url=require(_0xc6b9('0x1'));var logger=require(_0xc6b9('0x2'))(_0xc6b9('0x3'));module[_0xc6b9('0x4')]=function(_0x55d850,_0x24b2fa){var _0x55e591={'method':'POST','uri':url['resolve'](_0x24b2fa['ndauth_url'],_0xc6b9('0x5')),'form':{'grant_type':'password','username':_0x24b2fa[_0xc6b9('0x6')],'password':_0x24b2fa[_0xc6b9('0x7')]},'json':!![]};return rp(_0x55e591)[_0xc6b9('0x8')](function(_0x276fd4){var _0x549e32={'method':_0xc6b9('0x9'),'uri':url[_0xc6b9('0xa')](_0x24b2fa[_0xc6b9('0xb')],_0xc6b9('0xc')),'body':{'type':_0x24b2fa[_0xc6b9('0xd')]||_0xc6b9('0xe'),'channelId':_0xc6b9('0xf'),'conversation':{'id':_0x55d850['uniqueid']},'from':{'id':_0x55d850[_0xc6b9('0x10')],'name':_0x55d850[_0xc6b9('0x11')]},'recipient':{'id':_0x55d850['dnid'],'name':_0x55d850[_0xc6b9('0x12')]},'text':_0x24b2fa[_0xc6b9('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x276fd4[_0xc6b9('0x14')]},'json':!![]};if(_0x24b2fa[_0xc6b9('0x15')]){_0x549e32['body'][_0xc6b9('0x16')]['ProjectName']=_0x24b2fa[_0xc6b9('0x15')];}if(_0x24b2fa[_0xc6b9('0x17')]=='1'){_0x549e32['body']['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc6b9('0x18')};}if(_0x24b2fa[_0xc6b9('0x19')]){_0x549e32[_0xc6b9('0x1a')]['channelData'][_0xc6b9('0x1b')]=_0x24b2fa[_0xc6b9('0x19')];if(_0x24b2fa[_0xc6b9('0x1c')]){_0x549e32[_0xc6b9('0x1a')][_0xc6b9('0x16')][_0xc6b9('0x1d')]=_0x24b2fa[_0xc6b9('0x1c')];}}logger[_0xc6b9('0x1e')](JSON['stringify'](_0x549e32));return rp(_0x549e32);});}; \ No newline at end of file +var _0xbd13=['project','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','body','CustomAction','info','stringify','request-promise','url','agi','POST','/token','username','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','uniqueid','callerid','calleridname','dnid','extension','text','access_token'];(function(_0x3d6cc3,_0x4ec3af){var _0x15fff7=function(_0x1ad672){while(--_0x1ad672){_0x3d6cc3['push'](_0x3d6cc3['shift']());}};_0x15fff7(++_0x4ec3af);}(_0xbd13,0x1a0));var _0x3bd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd13[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x3bd1('0x0'));var url=require(_0x3bd1('0x1'));var logger=require('../../../../../config/logger')(_0x3bd1('0x2'));module['exports']=function(_0x2ee471,_0x437fbb){var _0x556198={'method':_0x3bd1('0x3'),'uri':url['resolve'](_0x437fbb['ndauth_url'],_0x3bd1('0x4')),'form':{'grant_type':'password','username':_0x437fbb[_0x3bd1('0x5')],'password':_0x437fbb[_0x3bd1('0x6')]},'json':!![]};return rp(_0x556198)[_0x3bd1('0x7')](function(_0x5c8699){var _0x5a1c0c={'method':_0x3bd1('0x3'),'uri':url[_0x3bd1('0x8')](_0x437fbb[_0x3bd1('0x9')],_0x3bd1('0xa')),'body':{'type':_0x437fbb['ndaactivity_type']||_0x3bd1('0xb'),'channelId':'Nda','conversation':{'id':_0x2ee471[_0x3bd1('0xc')]},'from':{'id':_0x2ee471[_0x3bd1('0xd')],'name':_0x2ee471[_0x3bd1('0xe')]},'recipient':{'id':_0x2ee471[_0x3bd1('0xf')],'name':_0x2ee471[_0x3bd1('0x10')]},'text':_0x437fbb[_0x3bd1('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5c8699[_0x3bd1('0x12')]},'json':!![]};if(_0x437fbb[_0x3bd1('0x13')]){_0x5a1c0c['body']['channelData']['ProjectName']=_0x437fbb['project'];}if(_0x437fbb[_0x3bd1('0x14')]=='1'){_0x5a1c0c['body'][_0x3bd1('0x15')][_0x3bd1('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3bd1('0x17')};}if(_0x437fbb[_0x3bd1('0x18')]){_0x5a1c0c[_0x3bd1('0x19')][_0x3bd1('0x15')][_0x3bd1('0x1a')]=_0x437fbb['custom_action'];if(_0x437fbb['custom_action_data']){_0x5a1c0c[_0x3bd1('0x19')][_0x3bd1('0x15')]['CustomActionData']=_0x437fbb['custom_action_data'];}}logger[_0x3bd1('0x1b')](JSON[_0x3bd1('0x1c')](_0x5a1c0c));return rp(_0x5a1c0c);});}; \ 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 07bc142..c7eb8b2 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 _0xa1d7=['exports','./lib/api'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0xa1d7,0x1c9));var _0x7a1d=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0xa1d7[_0x297c55];return _0x120389;};'use strict';var asr=require(_0x7a1d('0x0'));module[_0x7a1d('0x1')]=function(_0x82a555,_0x2da41b,_0x415aef,_0x974d55){return asr(_0x82a555,_0x2da41b,_0x415aef,_0x974d55);}; \ No newline at end of file +var _0x1310=['./lib/api'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1310,0x1b3));var _0x0131=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1310[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require(_0x0131('0x0'));module['exports']=function(_0xbbd1c7,_0x17c779,_0x22eee8,_0x12e9e0){return asr(_0xbbd1c7,_0x17c779,_0x22eee8,_0x12e9e0);}; \ 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 fa194ad..a125edb 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 _0x5c99=['Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','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'];(function(_0x3878bd,_0x51e3e5){var _0x359e60=function(_0xe70276){while(--_0xe70276){_0x3878bd['push'](_0x3878bd['shift']());}};_0x359e60(++_0x51e3e5);}(_0x5c99,0xb1));var _0x95c9=function(_0x13dd37,_0x1a62d7){_0x13dd37=_0x13dd37-0x0;var _0x4018ef=_0x5c99[_0x13dd37];return _0x4018ef;};'use strict';var BPromise=require(_0x95c9('0x0'));var _=require(_0x95c9('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x95c9('0x2'));var crypto=require(_0x95c9('0x3'));var logger=require(_0x95c9('0x4'))(_0x95c9('0x5'));module[_0x95c9('0x6')]=function(_0x151526,_0x450f8d,_0x1f8022,_0x4417d7){return new BPromise(function(_0x285950,_0x5772ae){logger['info'](_0x95c9('0x7'),_0x4417d7||_0x95c9('0x8'));var _0x35c26a=new WebSocket(_0x4417d7||_0x95c9('0x8'),{'perMessageDeflate':![]});var _0x489f95='';var _0x3e18ad='0';var _0x5cb811='1';var _0x3c91dd='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x586475(_0x2ad34c){var _0x219fc0=crypto[_0x95c9('0x9')](_0x95c9('0xa'));_0x219fc0[_0x95c9('0xb')](_0x2ad34c);return _0x219fc0[_0x95c9('0xc')](_0x95c9('0xd'));}function _0x339009(){try{logger[_0x95c9('0xe')](_0x95c9('0xf'));var _0x18c29b=moment()[_0x95c9('0x10')]();var _0xb6822a=_0x586475(_0x18c29b+_0x450f8d+_0x1f8022);_0x35c26a['send'](JSON[_0x95c9('0x11')]({'appID':_0x450f8d,'timestamp':_0x18c29b,'appKey':_0xb6822a}));var _0x18a11d=fs['createReadStream'](_0x151526);_0x18a11d['on'](_0x95c9('0x12'),function(_0x46e956){_0x35c26a[_0x95c9('0x13')](_0x46e956);});_0x18a11d['on'](_0x95c9('0x14'),function(){_0x35c26a[_0x95c9('0x13')](_0x95c9('0x15'));});}catch(_0x3e4a0a){logger[_0x95c9('0x16')](_0x95c9('0x17'),JSON[_0x95c9('0x11')](_0x3e4a0a));_0x35c26a[_0x95c9('0x18')]();}}function _0x52f47f(_0x540b06){try{if(_0x540b06){var _0x11882a=JSON[_0x95c9('0x19')](_0x540b06);switch(_0x11882a[_0x95c9('0x1a')]){case 0x0:if(_0x11882a[_0x95c9('0x1b')]){if(_0x11882a['result']['final']){logger[_0x95c9('0xe')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x11882a[_0x95c9('0x1b')][_0x95c9('0x1c')]));_0x489f95=_0x11882a[_0x95c9('0x1b')][_0x95c9('0x1c')][0x0][_0x95c9('0x1d')];_0x3e18ad=_0x11882a[_0x95c9('0x1b')][_0x95c9('0x1c')][0x0][_0x95c9('0x1e')];_0x5cb811='0';_0x3c91dd=_0x95c9('0x1f');_0x35c26a[_0x95c9('0x18')]();}}break;case 0x1:logger[_0x95c9('0xe')](_0x95c9('0x20'));_0x5cb811='1';_0x3c91dd=_0x95c9('0x20');break;case 0x2:logger['info'](_0x95c9('0x21'));_0x5cb811='2';_0x3c91dd=_0x95c9('0x21');break;case 0x9:logger[_0x95c9('0xe')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5cb811='9';_0x3c91dd='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x95c9('0xe')]('Authentication\x20failed.');_0x5cb811='10';_0x3c91dd=_0x95c9('0x22');break;case 0xb:logger['info'](_0x95c9('0x23'));_0x5cb811='11';_0x3c91dd=_0x95c9('0x23');}}}catch(_0x41f87c){logger[_0x95c9('0x16')](_0x95c9('0x24'),JSON[_0x95c9('0x11')](_0x41f87c));_0x35c26a[_0x95c9('0x18')]();}}function _0x412a08(){logger['info'](_0x95c9('0x25'));_0x285950({'transcript':_0x489f95,'confidence':_0x3e18ad,'status':_0x5cb811,'status_message':_0x3c91dd});}function _0x1a5db8(_0x151635){logger[_0x95c9('0x16')](_0x95c9('0x26'));if(!_[_0x95c9('0x27')](_0x151635)){logger['error'](_[_0x95c9('0x28')](_0x151635)?JSON[_0x95c9('0x11')](_0x151635):_0x151635);}}_0x35c26a['on'](_0x95c9('0x29'),_0x339009);_0x35c26a['on'](_0x95c9('0x2a'),_0x52f47f);_0x35c26a['on'](_0x95c9('0x14'),_0x412a08);_0x35c26a['on'](_0x95c9('0x16'),_0x1a5db8);});}; \ No newline at end of file +var _0x6222=['status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','lodash','moment','crypto','agi','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','sha1','digest','unix','send','stringify','createReadStream','data','close','error','terminate','parse'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6222,0xe2));var _0x2622=function(_0x3b5f05,_0x377f4b){_0x3b5f05=_0x3b5f05-0x0;var _0x16441b=_0x6222[_0x3b5f05];return _0x16441b;};'use strict';var BPromise=require('bluebird');var _=require(_0x2622('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2622('0x1'));var crypto=require(_0x2622('0x2'));var logger=require('../../../../../../config/logger')(_0x2622('0x3'));module['exports']=function(_0x29e7f6,_0x28bcda,_0x59704e,_0x594a87){return new BPromise(function(_0x19d017,_0x1b877a){logger[_0x2622('0x4')](_0x2622('0x5'),_0x594a87||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x223a1d=new WebSocket(_0x594a87||_0x2622('0x6'),{'perMessageDeflate':![]});var _0x34a4f0='';var _0x306ba9='0';var _0xf477ce='1';var _0x382497=_0x2622('0x7');function _0x5ace74(_0x5d6c0f){var _0xa43355=crypto['createHash'](_0x2622('0x8'));_0xa43355['update'](_0x5d6c0f);return _0xa43355[_0x2622('0x9')]('hex');}function _0x4c0dd9(){try{logger[_0x2622('0x4')]('Open\x20Tilde\x20ASR\x20socket');var _0x184ff9=moment()[_0x2622('0xa')]();var _0x28bd7d=_0x5ace74(_0x184ff9+_0x28bcda+_0x59704e);_0x223a1d[_0x2622('0xb')](JSON[_0x2622('0xc')]({'appID':_0x28bcda,'timestamp':_0x184ff9,'appKey':_0x28bd7d}));var _0x216c70=fs[_0x2622('0xd')](_0x29e7f6);_0x216c70['on'](_0x2622('0xe'),function(_0x3b6ef1){_0x223a1d[_0x2622('0xb')](_0x3b6ef1);});_0x216c70['on'](_0x2622('0xf'),function(){_0x223a1d[_0x2622('0xb')]('EOS');});}catch(_0x179528){logger[_0x2622('0x10')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x179528));_0x223a1d[_0x2622('0x11')]();}}function _0x18e85c(_0x247a34){try{if(_0x247a34){var _0x279143=JSON[_0x2622('0x12')](_0x247a34);switch(_0x279143[_0x2622('0x13')]){case 0x0:if(_0x279143['result']){if(_0x279143['result'][_0x2622('0x14')]){logger['info'](_0x2622('0x15'),JSON[_0x2622('0xc')](_0x279143[_0x2622('0x16')][_0x2622('0x17')]));_0x34a4f0=_0x279143[_0x2622('0x16')][_0x2622('0x17')][0x0][_0x2622('0x18')];_0x306ba9=_0x279143[_0x2622('0x16')][_0x2622('0x17')][0x0][_0x2622('0x19')];_0xf477ce='0';_0x382497=_0x2622('0x1a');_0x223a1d[_0x2622('0x11')]();}}break;case 0x1:logger['info'](_0x2622('0x7'));_0xf477ce='1';_0x382497=_0x2622('0x7');break;case 0x2:logger[_0x2622('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0xf477ce='2';_0x382497=_0x2622('0x1b');break;case 0x9:logger[_0x2622('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0xf477ce='9';_0x382497='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x2622('0x4')](_0x2622('0x1c'));_0xf477ce='10';_0x382497='Authentication\x20failed.';break;case 0xb:logger[_0x2622('0x4')](_0x2622('0x1d'));_0xf477ce='11';_0x382497=_0x2622('0x1d');}}}catch(_0x3e84b1){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x2622('0xc')](_0x3e84b1));_0x223a1d['terminate']();}}function _0x16f1c8(){logger[_0x2622('0x4')](_0x2622('0x1e'));_0x19d017({'transcript':_0x34a4f0,'confidence':_0x306ba9,'status':_0xf477ce,'status_message':_0x382497});}function _0x3956bd(_0x1bf298){logger[_0x2622('0x10')](_0x2622('0x1f'));if(!_[_0x2622('0x20')](_0x1bf298)){logger[_0x2622('0x10')](_[_0x2622('0x21')](_0x1bf298)?JSON[_0x2622('0xc')](_0x1bf298):_0x1bf298);}}_0x223a1d['on']('open',_0x4c0dd9);_0x223a1d['on'](_0x2622('0x22'),_0x18e85c);_0x223a1d['on'](_0x2622('0xf'),_0x16f1c8);_0x223a1d['on'](_0x2622('0x10'),_0x3956bd);});}; \ 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 45093e2..a996a20 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 _0x1943=['./asr','exports'];(function(_0x1e4392,_0x5b2de3){var _0x3b4819=function(_0x4814d6){while(--_0x4814d6){_0x1e4392['push'](_0x1e4392['shift']());}};_0x3b4819(++_0x5b2de3);}(_0x1943,0x124));var _0x3194=function(_0x898275,_0x108173){_0x898275=_0x898275-0x0;var _0x2610ce=_0x1943[_0x898275];return _0x2610ce;};var asr=require(_0x3194('0x0'));module[_0x3194('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe005=['./asr','exports'];(function(_0x51a6fe,_0x43bb1b){var _0x5f15a0=function(_0x1408aa){while(--_0x1408aa){_0x51a6fe['push'](_0x51a6fe['shift']());}};_0x5f15a0(++_0x43bb1b);}(_0xe005,0x17a));var _0x5e00=function(_0x11afeb,_0x5999be){_0x11afeb=_0x11afeb-0x0;var _0x24cca6=_0xe005[_0x11afeb];return _0x24cca6;};var asr=require(_0x5e00('0x0'));module[_0x5e00('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 0abe7f3..327ee9b 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 _0x32ff=['error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','connection','code','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','emit'];(function(_0x78bee0,_0x497ec6){var _0x3543de=function(_0x10a470){while(--_0x10a470){_0x78bee0['push'](_0x78bee0['shift']());}};_0x3543de(++_0x497ec6);}(_0x32ff,0xc7));var _0xf32f=function(_0x89cad4,_0x285549){_0x89cad4=_0x89cad4-0x0;var _0x5b0f84=_0x32ff[_0x89cad4];return _0x5b0f84;};'use strict';var util=require(_0xf32f('0x0'));var net=require(_0xf32f('0x1'));var EventEmitter=require(_0xf32f('0x2'))[_0xf32f('0x3')];var AGIError=require(_0xf32f('0x4'));var AGIChannel=require(_0xf32f('0x5'));var AGIServer=function(_0x2af467,_0x3ee77b,_0x1f96f0){var _0x397240=this,_0x2af467=_0x2af467||0x11dd,_0x3ee77b=_0x3ee77b||_0xf32f('0x6'),_0x2a209f=null,_0x5e5080=0x0;EventEmitter['call'](_0x397240);function _0x40f495(){if(!_0x2af467){_0x397240[_0xf32f('0x7')](_0xf32f('0x8'),new AGIError(_0xf32f('0x9')));return![];}_0x2a209f=net[_0xf32f('0xa')]();_0x2a209f[_0xf32f('0xb')](_0x2af467,_0x3ee77b);_0x2a209f['on'](_0xf32f('0xc'),function(){_0x397240[_0xf32f('0x7')]('listening');});_0x2a209f['on']('connection',function(_0x41e023){_0x2a209f['getConnections'](function(_0x5491ba,_0x1449a4){if(_0x5491ba){_0x397240[_0xf32f('0x7')](_0xf32f('0x8'),new AGIError(_0xf32f('0xd'),_0x5491ba));}else if(_0x1f96f0&&_0x1f96f0<0x0){_0x397240[_0xf32f('0x7')](_0xf32f('0x8'),new AGIError(_0xf32f('0xe')));_0x41e023[_0xf32f('0xf')]();}else if(_0x1f96f0&&_0x1f96f0>0x0&&_0x1f96f0<_0x1449a4){_0x5e5080+=0x1;_0x397240[_0xf32f('0x7')]('error',new AGIError(_0xf32f('0x10'),_0x5e5080));_0x41e023[_0xf32f('0xf')]();}else{var _0x174efc=new AGIChannel(_0x41e023);_0x174efc['on']('ready',function(){_0x397240[_0xf32f('0x7')](_0xf32f('0x11'),_0x174efc);});}});});_0x2a209f['on'](_0xf32f('0x8'),function(_0x160ba1){_0x397240[_0xf32f('0x7')](_0xf32f('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x160ba1[_0xf32f('0x12')]));});_0x2a209f['on']('close',function(){_0x397240[_0xf32f('0x7')]('close',new AGIError(_0xf32f('0x13')));});}process[_0xf32f('0x14')](function(){_0x40f495();});};util[_0xf32f('0x15')](AGIServer,EventEmitter);module[_0xf32f('0x16')]=function(_0x494442,_0x45be10,_0x181d12){return new AGIServer(_0x494442,_0x45be10,_0x181d12);}; \ No newline at end of file +var _0x4a81=['net','events','EventEmitter','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','ready','code','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util'];(function(_0x2939ff,_0x49c7ad){var _0x1384dc=function(_0xc53aa1){while(--_0xc53aa1){_0x2939ff['push'](_0x2939ff['shift']());}};_0x1384dc(++_0x49c7ad);}(_0x4a81,0x1b7));var _0x14a8=function(_0x8ae2dd,_0x26ed96){_0x8ae2dd=_0x8ae2dd-0x0;var _0x594010=_0x4a81[_0x8ae2dd];return _0x594010;};'use strict';var util=require(_0x14a8('0x0'));var net=require(_0x14a8('0x1'));var EventEmitter=require(_0x14a8('0x2'))[_0x14a8('0x3')];var AGIError=require('./error');var AGIChannel=require('./channel');var AGIServer=function(_0x45869b,_0x53309b,_0x39c3d4){var _0x3363f8=this,_0x45869b=_0x45869b||0x11dd,_0x53309b=_0x53309b||_0x14a8('0x4'),_0x2cd6d2=null,_0x4aa19e=0x0;EventEmitter['call'](_0x3363f8);function _0x26e442(){if(!_0x45869b){_0x3363f8[_0x14a8('0x5')](_0x14a8('0x6'),new AGIError(_0x14a8('0x7')));return![];}_0x2cd6d2=net[_0x14a8('0x8')]();_0x2cd6d2['listen'](_0x45869b,_0x53309b);_0x2cd6d2['on']('listening',function(){_0x3363f8[_0x14a8('0x5')](_0x14a8('0x9'));});_0x2cd6d2['on'](_0x14a8('0xa'),function(_0x5673b7){_0x2cd6d2[_0x14a8('0xb')](function(_0x34f6e1,_0x357bb6){if(_0x34f6e1){_0x3363f8[_0x14a8('0x5')](_0x14a8('0x6'),new AGIError(_0x14a8('0xc'),_0x34f6e1));}else if(_0x39c3d4&&_0x39c3d4<0x0){_0x3363f8[_0x14a8('0x5')](_0x14a8('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5673b7['destroy']();}else if(_0x39c3d4&&_0x39c3d4>0x0&&_0x39c3d4<_0x357bb6){_0x4aa19e+=0x1;_0x3363f8[_0x14a8('0x5')](_0x14a8('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x4aa19e));_0x5673b7[_0x14a8('0xd')]();}else{var _0x54223b=new AGIChannel(_0x5673b7);_0x54223b['on'](_0x14a8('0xe'),function(){_0x3363f8[_0x14a8('0x5')](_0x14a8('0xa'),_0x54223b);});}});});_0x2cd6d2['on'](_0x14a8('0x6'),function(_0x31ce02){_0x3363f8[_0x14a8('0x5')]('error',new AGIError(_0x14a8('0xc'),_0x31ce02[_0x14a8('0xf')]));});_0x2cd6d2['on']('close',function(){_0x3363f8[_0x14a8('0x5')]('close',new AGIError(_0x14a8('0x10')));});}process[_0x14a8('0x11')](function(){_0x26e442();});};util[_0x14a8('0x12')](AGIServer,EventEmitter);module[_0x14a8('0x13')]=function(_0x2534e0,_0x1e9433,_0x4a87f7){return new AGIServer(_0x2534e0,_0x1e9433,_0x4a87f7);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index eeb36fb..dd46f03 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 _0xa1e8=['map','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','log','in\x20createcmcontact\x20callback','isEmpty','isNil','callback_','random','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','has','dialTimezone','VALUE\x20TZ','CALLERID(dialTimezone)','phone','RES1','dialtimezone','timezones','utcOffset','scheduledat\x20before','add','minutes','insertContact','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','googleTTS','url','method','timeout','number','includes','POST','toUpperCase','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','stringify','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','format','%s.%s','replaceall\x20init','split','nextbracket','replaceAll','getVariable','extra','replaceall\x20end','info','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','result','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','before\x20createcmcontact','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','createSquareMessage','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','bot','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','beep','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','QUEUE','gosub','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','Smtp','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','google_cloud_tts','no\x20apiKey\x20configured','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','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','VOICEMAIL','mailbox','vswitch','join','exports','path','lodash','shelljs','odbc','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','mailRpc','getVariableById','then','name','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval'];(function(_0x3f9aeb,_0x231e27){var _0x1772b4=function(_0x54bd7e){while(--_0x54bd7e){_0x3f9aeb['push'](_0x3f9aeb['shift']());}};_0x1772b4(++_0x231e27);}(_0xa1e8,0x1af));var _0x8a1e=function(_0x327e41,_0x25dfe4){_0x327e41=_0x327e41-0x0;var _0x12e822=_0xa1e8[_0x327e41];return _0x12e822;};'use strict';var fs=require('fs');var path=require(_0x8a1e('0x0'));var util=require('util');var _=require(_0x8a1e('0x1'));var sh=require(_0x8a1e('0x2'));var odbc=require(_0x8a1e('0x3'))();var rs=require('randomstring');var moment=require(_0x8a1e('0x4'));var Mustache=require('mustache');var rp=require(_0x8a1e('0x5'));var logger=require(_0x8a1e('0x6'))(_0x8a1e('0x7'));var config=require(_0x8a1e('0x8'));var shared=require('../../config/environment/shared');var scripts=require(_0x8a1e('0x9'));var FILES_PATH=_0x8a1e('0xa');var recursiveMapAttributes=[_0x8a1e('0xb'),_0x8a1e('0xc')];var verticesWithRetry=['menu',_0x8a1e('0xd'),_0x8a1e('0xe')];var AGIVertices=function(_0x22d916,_0x537de3,_0x31afa4){this['channel']=_0x22d916;this[_0x8a1e('0xf')]=_0x537de3;this[_0x8a1e('0x10')]=_0x31afa4;};AGIVertices['prototype']['getVariable']=function(_0x2a700b,_0x46cddc){this[_0x8a1e('0xf')][_0x8a1e('0x11')](_0x2a700b)[_0x8a1e('0x12')](function(_0x8aebf4){_0x46cddc(null,_0x8aebf4?_0x8aebf4[_0x8a1e('0x13')]:![]);})['catch'](function(_0x25d23d){_0x46cddc(_0x25d23d);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x15')]=function(_0x50f242,_0x39eeec){this[_0x8a1e('0xf')][_0x8a1e('0x16')](_0x50f242)['then'](function(_0x3b3c83){_0x39eeec(null,_0x3b3c83?_0x3b3c83[_0x8a1e('0x13')]:![]);})[_0x8a1e('0x17')](function(_0x4a31d0){_0x39eeec(_0x4a31d0);});};AGIVertices['prototype']['getSquareProject']=function(_0x3d7dc0,_0x2fcc32){this['rpc'][_0x8a1e('0x18')](_0x3d7dc0)[_0x8a1e('0x12')](function(_0x7af78d){_0x2fcc32(null,_0x7af78d?_0x7af78d[_0x8a1e('0x13')]:![]);})[_0x8a1e('0x17')](function(_0x13670e){_0x2fcc32(_0x13670e);});};AGIVertices['prototype'][_0x8a1e('0x19')]=function(_0xa87f47,_0x574c88){this[_0x8a1e('0xf')][_0x8a1e('0x1a')](_0xa87f47)[_0x8a1e('0x12')](function(_0x27c3cd){_0x574c88(null,_0x27c3cd?_0x27c3cd['dsn']:![]);})['catch'](function(_0x1a241c){_0x574c88(_0x1a241c);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1b')]=function(_0x1f5c7b,_0x6adaed){this[_0x8a1e('0xf')][_0x8a1e('0x1c')](_0x1f5c7b)[_0x8a1e('0x12')](function(_0x399361){_0x6adaed(null,_0x399361?_0x399361[_0x8a1e('0x13')]:![]);})[_0x8a1e('0x17')](function(_0x48b39a){_0x6adaed(_0x48b39a);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1d')]=function(_0x2c7584,_0x59de36){this[_0x8a1e('0xf')][_0x8a1e('0x1e')](_0x2c7584)[_0x8a1e('0x12')](function(_0x79849d){_0x59de36(null,_0x79849d?_0x79849d['name']:![]);})[_0x8a1e('0x17')](function(_0x1d8929){_0x59de36(_0x1d8929);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1f')]=function(_0x4107f5,_0x3c2636){var _0x4c7f91=this;this[_0x8a1e('0xf')][_0x8a1e('0x20')](_0x4107f5)[_0x8a1e('0x12')](function(_0x2ec304){_0x3c2636(null,_0x2ec304?_0x4c7f91[_0x8a1e('0x21')](_0x2ec304['save_name']):![]);})['catch'](function(_0x2d1c86){_0x3c2636(_0x2d1c86);});};AGIVertices[_0x8a1e('0x14')]['getMailAccount']=function(_0xf39c6d,_0x1e8b4c){this[_0x8a1e('0xf')][_0x8a1e('0x22')](_0xf39c6d)[_0x8a1e('0x12')](function(_0xc2048b){_0x1e8b4c(null,_0xc2048b?_0xc2048b:![]);})[_0x8a1e('0x17')](function(_0x5d08e0){_0x1e8b4c(_0x5d08e0);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x23')]=function(_0x4ae021,_0x5c9b14,_0x4fcd0e){this['mailRpc'][_0x8a1e('0x23')](_0x4ae021,_0x5c9b14)[_0x8a1e('0x12')](function(){_0x4fcd0e(null);})[_0x8a1e('0x17')](function(_0x4ee496){_0x4fcd0e(_0x4ee496);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x24')]=function(_0x1859b1,_0x5e4dcc){this['rpc']['getIntervalById'](_0x1859b1)[_0x8a1e('0x12')](function(_0x5f4d59){if(_0x5f4d59){if(_0x5f4d59[_0x8a1e('0x25')]){_0x5e4dcc(null,[_0x5f4d59[_0x8a1e('0x26')]]);}else{_0x5e4dcc(null,_[_0x8a1e('0x27')](_0x5f4d59[_0x8a1e('0x28')],_0x8a1e('0x26')));}}else{_0x5e4dcc(null,![]);}})[_0x8a1e('0x17')](function(_0x2d6788){_0x5e4dcc(_0x2d6788);});};AGIVertices['prototype'][_0x8a1e('0x21')]=function(_0x8bb1d6){return util['format'](_0x8a1e('0x29'),FILES_PATH,_0x8bb1d6);};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x2a')]=function(_0x2fd3a1,_0x12d915,_0x238e26){odbc['open'](_0x2fd3a1,function(_0x4f5a3f){if(_0x4f5a3f){logger[_0x8a1e('0x2b')](_0x8a1e('0x2c'),_0x4f5a3f);_0x238e26(_0x4f5a3f);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x8a1e('0x2d')](_0x12d915,function(_0x412eb9,_0x58edb7){if(_0x412eb9){logger['info']('Error\x20executing\x20query\x20%s',_0x12d915);_0x238e26(_0x412eb9);}else{logger['info'](_0x8a1e('0x2e'),_0x12d915);odbc[_0x8a1e('0x2f')](function(_0x2f885c){if(_0x2f885c){logger[_0x8a1e('0x2b')](_0x8a1e('0x30'),_0x2f885c);}_0x238e26(null,_0x58edb7);});}});}});};AGIVertices['prototype'][_0x8a1e('0x31')]=function(_0x420162,_0x3ae5ba){this[_0x8a1e('0xf')][_0x8a1e('0x32')](_0x420162)[_0x8a1e('0x12')](function(_0x41a261){_0x3ae5ba(null,_0x41a261?_0x41a261:![]);})[_0x8a1e('0x17')](function(_0x1961f6){_0x3ae5ba(_0x1961f6);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x33')]=function(_0x348efb,_0x40a71f){this[_0x8a1e('0xf')]['createSmsMessage'](_0x348efb)[_0x8a1e('0x12')](function(_0x369595){_0x40a71f(null,_0x369595);})['catch'](function(_0x6bea04){_0x40a71f(_0x6bea04);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x34')]=function(_0x110de2,_0x58dcdf,_0xac2158){this[_0x8a1e('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0x8a1e('0x35')][_0x8a1e('0x36')],'node':_0x110de2['label'],'application':_0x110de2[_0x8a1e('0x37')],'data':_0x58dcdf||null,'project_name':this[_0x8a1e('0x35')][_0x8a1e('0x38')],'callerid':this[_0x8a1e('0x35')][_0x8a1e('0x39')]})[_0x8a1e('0x12')](function(_0x11ed8d){if(_0xac2158){_0xac2158(null,_0x11ed8d);}})[_0x8a1e('0x17')](function(_0x11f7a6){if(_0xac2158){_0xac2158(_0x11f7a6);}});};AGIVertices[_0x8a1e('0x14')]['createSquareRecording']=function(_0x462798,_0x4b540d,_0x530276,_0x43fe87){this[_0x8a1e('0xf')][_0x8a1e('0x3a')]({'uniqueid':this[_0x8a1e('0x35')]['uniqueid'],'callerid':this['channel']['callerid'],'calleridname':this[_0x8a1e('0x35')][_0x8a1e('0x3b')],'context':this[_0x8a1e('0x35')][_0x8a1e('0x3c')],'extension':this[_0x8a1e('0x35')][_0x8a1e('0x3d')],'priority':this['channel'][_0x8a1e('0x3e')],'accountcode':this[_0x8a1e('0x35')]['accountcode'],'dnid':this[_0x8a1e('0x35')][_0x8a1e('0x3f')],'projectName':this['channel']['arg_1'],'saveName':_0x4b540d,'filename':_0x462798['file']||_0x4b540d,'savePath':_0x530276})[_0x8a1e('0x12')](function(_0x4a060d){_0x43fe87(null,_0x4a060d);})[_0x8a1e('0x17')](function(_0x2dc4b3){_0x43fe87(_0x2dc4b3);});};AGIVertices['prototype']['createSquareMessage']=function(_0x443c9a,_0x107d69,_0x4243b6){this[_0x8a1e('0xf')]['createSquareMessage']({'uniqueid':this[_0x8a1e('0x35')][_0x8a1e('0x36')],'body':_0x443c9a,'direction':_0x107d69})[_0x8a1e('0x12')](function(_0x2343de){if(_0x4243b6){_0x4243b6(null,_0x2343de);}})[_0x8a1e('0x17')](function(_0x2f149e){if(_0x4243b6){_0x4243b6(_0x2f149e);}});};AGIVertices[_0x8a1e('0x14')]['createCmContact']=function(_0x9487b1,_0x328c8c){console[_0x8a1e('0x40')]('in\x20createcmcontact',_0x9487b1);console['log'](_0x8a1e('0x41'),_0x328c8c);var _0x4c0fa2=0x0;var _0x3e5acf={'firstName':_[_0x8a1e('0x42')](_0x9487b1[_0x8a1e('0x13')])||_[_0x8a1e('0x43')](_0x9487b1[_0x8a1e('0x13')])?_0x8a1e('0x44')+Math[_0x8a1e('0x45')]():_0x9487b1[_0x8a1e('0x13')],'lastName':_[_0x8a1e('0x42')](_0x9487b1[_0x8a1e('0x46')])||_[_0x8a1e('0x43')](_0x9487b1['lastName'])?null:_0x9487b1[_0x8a1e('0x46')],'phone':_0x9487b1['phone'],'ListId':_0x9487b1[_0x8a1e('0x47')],'scheduledat':_0x9487b1['scheduledAt'],'callbackUniqueid':this[_0x8a1e('0x35')][_0x8a1e('0x36')],'tags':_0x8a1e('0x48'),'description':_0x8a1e('0x49')+_0x9487b1[_0x8a1e('0x4a')][_0x8a1e('0x4b')](),'priority':_0x9487b1[_0x8a1e('0x4c')]};if(_[_0x8a1e('0x4d')](_0x9487b1,_0x8a1e('0x4e'))){if(!_[_0x8a1e('0x43')](_0x9487b1[_0x8a1e('0x4e')])){var _0x11780c=_0x9487b1[_0x8a1e('0x4e')];console[_0x8a1e('0x40')](_0x8a1e('0x4f'),_0x11780c);if(_0x9487b1[_0x8a1e('0x4e')]==_0x8a1e('0x50')){this[_0x8a1e('0xf')]['getContactByPhone']({'phone':_0x9487b1[_0x8a1e('0x51')]})['then'](function(_0x4dd7e2){console[_0x8a1e('0x40')](_0x8a1e('0x52'),_0x4dd7e2);var _0x5d51b0=_0x4dd7e2[_0x8a1e('0x4e')];console['log'](_0x8a1e('0x53'),_0x5d51b0);if(!_['isNil'](_0x5d51b0)){var _0x57b0f6=shared[_0x8a1e('0x54')][_0x5d51b0];console[_0x8a1e('0x40')]('tz',_0x57b0f6);if(!_['isNil'](_0x57b0f6)){var _0x2a4344=-0x1*_0x57b0f6[_0x8a1e('0x55')];console[_0x8a1e('0x40')]('minutestoadd',_0x2a4344);console[_0x8a1e('0x40')](_0x8a1e('0x56'),_0x3e5acf[_0x8a1e('0x4a')]);_0x3e5acf['scheduledAt']=moment(_0x9487b1['scheduledAt'])[_0x8a1e('0x57')](_0x2a4344,_0x8a1e('0x58'));console[_0x8a1e('0x40')]('scheduledat\x20after',_0x3e5acf[_0x8a1e('0x4a')]);this[_0x8a1e('0xf')]['insertContact'](_0x3e5acf,_0x9487b1,_0x328c8c)[_0x8a1e('0x12')](function(_0x1079c2){_0x328c8c(null,_0x1079c2);})['catch'](function(_0x3f875e){_0x328c8c(_0x3f875e);});}else{this[_0x8a1e('0xf')][_0x8a1e('0x59')](_0x3e5acf,_0x9487b1,_0x328c8c)['then'](function(_0x3e34fb){_0x328c8c(null,_0x3e34fb);})[_0x8a1e('0x17')](function(_0x980d6e){_0x328c8c(_0x980d6e);});}}else{this[_0x8a1e('0xf')][_0x8a1e('0x59')](_0x3e5acf,_0x9487b1,_0x328c8c)[_0x8a1e('0x12')](function(_0x5defc2){_0x328c8c(null,_0x5defc2);})['catch'](function(_0x1d96ad){_0x328c8c(_0x1d96ad);});}});}else{var _0x4c0fa2=shared[_0x8a1e('0x54')][_0x11780c];if(!_[_0x8a1e('0x43')](_0x4c0fa2)){var _0x44f6b1=-0x1*_0x4c0fa2[_0x8a1e('0x55')];_0x3e5acf[_0x8a1e('0x4a')]=moment(_0x9487b1[_0x8a1e('0x4a')])[_0x8a1e('0x57')](_0x44f6b1,'minutes');this[_0x8a1e('0xf')][_0x8a1e('0x59')](_0x3e5acf,_0x9487b1,_0x328c8c)[_0x8a1e('0x12')](function(_0x1d1bee){_0x328c8c(null,_0x1d1bee);})[_0x8a1e('0x17')](function(_0x24ea06){_0x328c8c(_0x24ea06);});}else{this[_0x8a1e('0xf')][_0x8a1e('0x59')](_0x3e5acf,_0x9487b1,_0x328c8c)[_0x8a1e('0x12')](function(_0x36b948){_0x328c8c(null,_0x36b948);})[_0x8a1e('0x17')](function(_0x4cb3ea){_0x328c8c(_0x4cb3ea);});}}}else{this[_0x8a1e('0xf')][_0x8a1e('0x59')](_0x3e5acf,_0x9487b1,_0x328c8c)[_0x8a1e('0x12')](function(_0x48fbe3){_0x328c8c(null,_0x48fbe3);})[_0x8a1e('0x17')](function(_0x3ce23c){_0x328c8c(_0x3ce23c);});}}else{this[_0x8a1e('0xf')][_0x8a1e('0x59')](_0x3e5acf,_0x9487b1,_0x328c8c)[_0x8a1e('0x12')](function(_0x320c38){_0x328c8c(null,_0x320c38);})['catch'](function(_0x5dd94d){_0x328c8c(_0x5dd94d);});}};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x59')]=function(_0x102200,_0x2ffb83,_0x420d1e){this[_0x8a1e('0xf')]['createCmContact'](_0x102200)[_0x8a1e('0x12')](function(_0x1891dc){_0x420d1e(null,_0x1891dc);})[_0x8a1e('0x17')](function(_0x446b71){_0x420d1e(_0x446b71);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x5a')]=function(_0x4bf6e1,_0x45c686){this['rpc'][_0x8a1e('0x5b')](_0x4bf6e1)[_0x8a1e('0x12')](function(_0x4b13e8){_0x45c686(null,_0x4b13e8?_0x4b13e8['name']:![]);})[_0x8a1e('0x17')](function(_0x147ec5){_0x45c686(_0x147ec5);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x5c')]=function(_0x509230,_0x3cc727,_0x277604){var _0x38b9f5={'role':_0x8a1e('0x5d')};_0x38b9f5[_0x509230]=this[_0x8a1e('0x35')][_0x8a1e('0x39')];this[_0x8a1e('0xf')][_0x8a1e('0x5c')](_0x38b9f5,_0x3cc727,this['channel'][_0x8a1e('0x36')])[_0x8a1e('0x12')](function(_0x382966){_0x277604(null,_[_0x8a1e('0x43')](_0x382966)?![]:!![]);})['catch'](function(_0x55e3f0){logger[_0x8a1e('0x2b')](_0x55e3f0);_0x277604(null,![]);});};AGIVertices['prototype'][_0x8a1e('0x5e')]=function(_0x4b7ee5,_0x903f1d){var _0x54d7b1={'role':'agent'};_0x54d7b1[_0x4b7ee5]=this[_0x8a1e('0x35')][_0x8a1e('0x39')];this[_0x8a1e('0xf')][_0x8a1e('0x5e')](_0x54d7b1)[_0x8a1e('0x12')](function(_0x2ccf1d){_0x903f1d(null,_[_0x8a1e('0x43')](_0x2ccf1d)?![]:!![]);})[_0x8a1e('0x17')](function(_0x1e0ae2){logger[_0x8a1e('0x2b')](_0x1e0ae2);_0x903f1d(null,![]);});};AGIVertices[_0x8a1e('0x14')]['agentLogout']=function(_0x3ba6a7,_0x14cb79){var _0x4fe4ee={'role':_0x8a1e('0x5d')};_0x4fe4ee[_0x3ba6a7]=this[_0x8a1e('0x35')][_0x8a1e('0x39')];this['rpc'][_0x8a1e('0x5f')](_0x4fe4ee)[_0x8a1e('0x12')](function(_0x2578f4){_0x14cb79(null,_[_0x8a1e('0x43')](_0x2578f4)?![]:!![]);})['catch'](function(_0x131948){logger[_0x8a1e('0x2b')](_0x131948);_0x14cb79(null,![]);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x60')]=function(_0x5bfefe,_0x588e1b){var _0x42c57e={'role':_0x8a1e('0x5d')};_0x42c57e[_0x5bfefe]=this[_0x8a1e('0x35')][_0x8a1e('0x39')];var _0x4d6840=_0x5bfefe!=_0x8a1e('0x61')?util['format'](_0x8a1e('0x62'),_0x8a1e('0x63'),this[_0x8a1e('0x35')][_0x8a1e('0x39')]):undefined;this[_0x8a1e('0xf')][_0x8a1e('0x60')](_0x42c57e,_0x4d6840)[_0x8a1e('0x12')](function(_0x1e95e6){_0x588e1b(null,_[_0x8a1e('0x43')](_0x1e95e6)?![]:!![]);})[_0x8a1e('0x17')](function(_0xcbc51){logger[_0x8a1e('0x2b')](_0xcbc51);_0x588e1b(null,![]);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x64')]=function(_0x520d39,_0x47391d){sh['exec'](_[_0x8a1e('0x65')](_0x520d39),function(_0x362339,_0xf08db2){var _0xea0160=_0xf08db2[_0x8a1e('0x66')](/(\r\n|\n|\r)/gm,'');_0x47391d(null,_0xea0160);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x67')]=function(_0x2b9ec3,_0x437731){scripts['googleCloudTTS'](_0x2b9ec3[_0x8a1e('0x68')],_0x2b9ec3[_0x8a1e('0x69')]||'text',_0x2b9ec3[_0x8a1e('0x6a')],_0x2b9ec3[_0x8a1e('0x6b')]||_0x8a1e('0x6c'),_0x2b9ec3[_0x8a1e('0x6d')]||'MALE',_0x2b9ec3[_0x8a1e('0x6e')]||'MP3')[_0x8a1e('0x12')](function(_0x3a3c06){_0x437731(null,_0x3a3c06);})[_0x8a1e('0x17')](function(_0x198fa2){_0x437731(_0x198fa2);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x6f')]=function(_0x5d911f,_0x469f99){scripts[_0x8a1e('0x6f')](_0x5d911f[_0x8a1e('0x6a')],_0x5d911f['google_tts_language']||'en',0x1)[_0x8a1e('0x12')](function(_0x3bbcbc){_0x469f99(null,_0x3bbcbc);})[_0x8a1e('0x17')](function(_0x46a3db){_0x469f99(_0x46a3db);});};AGIVertices[_0x8a1e('0x14')]['restAPI']=function(_0x2a5603,_0x59ca37){var _0x42e0b4={'uri':_0x2a5603[_0x8a1e('0x70')],'method':_0x2a5603[_0x8a1e('0x71')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2a5603[_0x8a1e('0x72')])===_0x8a1e('0x73')&&parseInt(_0x2a5603[_0x8a1e('0x72')])>=0x1?parseInt(_0x2a5603[_0x8a1e('0x72')])*0x3e8:0x5*0x3e8};if(_[_0x8a1e('0x74')]([_0x8a1e('0x75'),'PUT'],_0x42e0b4[_0x8a1e('0x71')][_0x8a1e('0x76')]())){try{_0x42e0b4[_0x8a1e('0x77')]=_0x2a5603[_0x8a1e('0xc')]?JSON[_0x8a1e('0x78')](_0x2a5603[_0x8a1e('0xc')]):{};}catch(_0x5d85b6){logger[_0x8a1e('0x2b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5d85b6);}}try{_0x42e0b4[_0x8a1e('0x79')]=_0x2a5603['rawHeaders']?JSON[_0x8a1e('0x78')](_0x2a5603[_0x8a1e('0xb')]):{};}catch(_0x2856e0){logger[_0x8a1e('0x2b')](_0x8a1e('0x7a'),_0x2856e0);}if(_0x2a5603[_0x8a1e('0x7b')]){try{var _0x385022=require(_0x2a5603[_0x8a1e('0x7b')])['sync'](this,_0x42e0b4);_0x42e0b4[_0x8a1e('0x7c')]=Mustache['render'](_0x2a5603[_0x8a1e('0x70')],_0x385022,{},['$$','$$']);if(_0x42e0b4[_0x8a1e('0x79')]){_0x42e0b4[_0x8a1e('0x79')]=JSON[_0x8a1e('0x78')](Mustache['render'](JSON[_0x8a1e('0x7d')](_0x42e0b4[_0x8a1e('0x79')]),_0x385022,{},['$$','$$']));}if(_0x42e0b4[_0x8a1e('0x77')]){_0x42e0b4[_0x8a1e('0x77')]=JSON[_0x8a1e('0x78')](Mustache[_0x8a1e('0x7e')](JSON[_0x8a1e('0x7d')](_0x42e0b4['body']),_0x385022,{},['$$','$$']));}}catch(_0x52ea91){logger[_0x8a1e('0x2b')](_0x8a1e('0x7f'),_0x52ea91);}}rp(_0x42e0b4)['then'](function(_0x22c6b3){var _0x3e77e5={'statusCode':_0x22c6b3[_0x8a1e('0x80')]||0xc8,'statusMessage':_0x22c6b3['statusMessage']||'OK','headers':_0x22c6b3[_0x8a1e('0x79')]||{},'body':_0x22c6b3[_0x8a1e('0x77')]||{}};_0x59ca37(null,_0x3e77e5);})[_0x8a1e('0x17')](function(_0x61adb2){var _0x4522b3={'statusCode':_0x61adb2[_0x8a1e('0x80')]||0x1f4,'statusMessage':_0x61adb2[_0x8a1e('0x81')]||_0x8a1e('0x82'),'headers':_0x61adb2[_0x8a1e('0x83')][_0x8a1e('0x79')]||{},'body':_0x61adb2['options'][_0x8a1e('0x77')]||{}};_0x59ca37(null,_0x4522b3);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x84')]=function(_0x2d0132,_0x1bfa45){scripts[_0x8a1e('0x84')](this[_0x8a1e('0x35')]['uniqueid'],_0x2d0132[_0x8a1e('0x85')],_0x2d0132[_0x8a1e('0x6a')],_0x2d0132[_0x8a1e('0x86')]||'en')['then'](function(_0x2e5634){_0x1bfa45(null,_0x2e5634);})[_0x8a1e('0x17')](function(_0x17c5ac){_0x1bfa45(_0x17c5ac);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x87')]=function(_0x534ba7,_0x2c641d){scripts[_0x8a1e('0x87')](this['channel'],_0x534ba7)[_0x8a1e('0x12')](function(_0x3dc47e){_0x2c641d(null,_0x3dc47e);})[_0x8a1e('0x17')](function(_0x26a0fd){_0x2c641d(_0x26a0fd);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x88')]=function(_0xbe59ff,_0x226d21){scripts['ispeechTTS'](_0xbe59ff[_0x8a1e('0x85')],_0xbe59ff[_0x8a1e('0x6a')],_0xbe59ff[_0x8a1e('0x89')]||_0x8a1e('0x6c'),_0xbe59ff[_0x8a1e('0x8a')])[_0x8a1e('0x12')](function(_0x4fe85c){_0x226d21(null,_0x4fe85c);})['catch'](function(_0x176ee9){_0x226d21(_0x176ee9);});};AGIVertices['prototype'][_0x8a1e('0x8b')]=function(_0xf53b26,_0x505e9d,_0x2b85c7){scripts[_0x8a1e('0x8b')](_0x505e9d,_0xf53b26['key'],_0xf53b26[_0x8a1e('0x8c')]||'en-US',this[_0x8a1e('0x8d')](_0xf53b26[_0x8a1e('0x8e')])?_0xf53b26[_0x8a1e('0x8e')]:undefined)[_0x8a1e('0x12')](function(_0x194e37){_0x2b85c7(null,_0x194e37);})[_0x8a1e('0x17')](function(_0x48d3c1){_0x2b85c7(_0x48d3c1);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x8f')]=function(_0x3a9856,_0x21d1a1){scripts[_0x8a1e('0x8f')](_0x3a9856['aws_access_key_id'],_0x3a9856[_0x8a1e('0x90')],_0x3a9856[_0x8a1e('0x91')],_0x3a9856['aws_polly_voice']||_0x8a1e('0x92'),_0x3a9856['text'],_0x3a9856[_0x8a1e('0x93')]||_0x8a1e('0x6a'))['then'](function(_0x4e51f9){_0x21d1a1(null,_0x4e51f9);})['catch'](function(_0x473292){_0x21d1a1(_0x473292);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x94')]=function(_0x48ca92,_0x8693b0){scripts[_0x8a1e('0x94')](this['channel'][_0x8a1e('0x36')],_0x48ca92[_0x8a1e('0x95')],_0x48ca92[_0x8a1e('0x90')],_0x48ca92[_0x8a1e('0x96')],_0x48ca92[_0x8a1e('0x6a')],_0x48ca92['aws_bot_name'])[_0x8a1e('0x12')](function(_0x14777f){_0x8693b0(null,_0x14777f);})['catch'](function(_0x2e2f4a){_0x8693b0(_0x2e2f4a);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x97')]=function(_0x1bd51a,_0x28fc4a,_0x358478){scripts[_0x8a1e('0x97')](_0x28fc4a,_0x1bd51a[_0x8a1e('0x85')],_0x1bd51a[_0x8a1e('0x98')]||_0x8a1e('0x6c'))['then'](function(_0x29b923){_0x358478(null,_0x29b923);})[_0x8a1e('0x17')](function(_0x540306){_0x358478(_0x540306);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x99')]=function(_0x28677e,_0x556ca2,_0x4bb5f9){scripts[_0x8a1e('0x99')](_0x556ca2,_0x28677e[_0x8a1e('0x9a')],_0x28677e[_0x8a1e('0x9b')],_0x28677e['uri'])[_0x8a1e('0x12')](function(_0x3215f3){_0x4bb5f9(null,_0x3215f3);})[_0x8a1e('0x17')](function(_0x5ed1d6){_0x4bb5f9(_0x5ed1d6);});};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x9c')]=function(_0xdb34f0){var _0x4232d1=_['includes'](verticesWithRetry,_0xdb34f0[_0x8a1e('0x37')])?_0xdb34f0:_[_0x8a1e('0x9d')](_0xdb34f0);for(var _0x45d159 in _0x4232d1){if(_0x4232d1[_0x8a1e('0x9e')](_0x45d159)){if(_0x4232d1[_0x45d159]&&_[_0x8a1e('0x9f')](_0x4232d1[_0x45d159])){if(_[_0x8a1e('0x74')](recursiveMapAttributes,_0x45d159)){_0x4232d1[_0x45d159]=this[_0x8a1e('0xa0')](_0x4232d1[_0x45d159]);}else{_0x4232d1[_0x45d159]=this[_0x8a1e('0xa1')](_0x4232d1[_0x45d159]);}}}}return _0x4232d1;};AGIVertices['prototype'][_0x8a1e('0xa2')]=function(_0x137f65){for(var _0x28ff66 in _0x137f65){if(_0x137f65[_0x8a1e('0x9e')](_0x28ff66)){if(_[_0x8a1e('0xa3')](_0x137f65[_0x28ff66])){this[_0x8a1e('0xa2')](_0x137f65[_0x28ff66]);}else if(_[_0x8a1e('0xa4')](_0x137f65[_0x28ff66])){for(var _0x48a246=0x0;_0x48a246<_0x137f65[_0x28ff66][_0x8a1e('0xa5')];_0x48a246++){this[_0x8a1e('0xa2')](_0x137f65[_0x28ff66][_0x48a246]);}}else if(_[_0x8a1e('0x9f')](_0x137f65[_0x28ff66])){_0x137f65[_0x28ff66]=this[_0x8a1e('0xa1')](_0x137f65[_0x28ff66]);}}}};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0xa6')]=function(_0x2bf15c,_0x4059dc){for(var _0x592014 in _0x2bf15c){if(_0x2bf15c['hasOwnProperty'](_0x592014)){if(_['isPlainObject'](_0x2bf15c[_0x592014])){if(!_[_0x8a1e('0x42')](_0x2bf15c[_0x592014])){this[_0x8a1e('0xa6')](_0x2bf15c[_0x592014],util[_0x8a1e('0xa7')](_0x8a1e('0xa8'),_0x4059dc,_0x592014));}}else if(_[_0x8a1e('0xa4')](_0x2bf15c[_0x592014])){for(var _0x168041=0x0;_0x168041<_0x2bf15c[_0x592014][_0x8a1e('0xa5')];_0x168041++){this['saveRestApiResult'](_0x2bf15c[_0x592014][_0x168041],util[_0x8a1e('0xa7')]('%s.%s',_0x4059dc,_0x592014+'['+_0x168041+']'));}}else{if(!_[_0x8a1e('0x43')](_0x2bf15c[_0x592014])){this[_0x8a1e('0x35')]['setVariable'](util[_0x8a1e('0xa7')]('%s.%s',_0x4059dc,_0x592014),_0x2bf15c[_0x592014]);}}}}};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0xa0')]=function(_0x598adf){try{var _0x338a57=JSON[_0x8a1e('0x78')](_0x598adf);this['recursiveNodeIndex'](_0x338a57);return JSON[_0x8a1e('0x7d')](_0x338a57);}catch(_0x51adad){return this[_0x8a1e('0xa1')](_0x598adf);}};AGIVertices[_0x8a1e('0x14')]['replaceAllVariables']=function(_0x4bef08){console[_0x8a1e('0x40')](_0x8a1e('0xa9'),_0x4bef08);var _0x2bd5f9=_0x4bef08['split']('{');for(var _0x5b52f5=0x1;_0x5b52f5<_0x2bd5f9[_0x8a1e('0xa5')];_0x5b52f5+=0x1){var _0x30dda2=_0x2bd5f9[_0x5b52f5][_0x8a1e('0xaa')]('}');console[_0x8a1e('0x40')](_0x8a1e('0xab'),_0x30dda2);if(_0x30dda2[_0x8a1e('0xa5')]>0x1){_0x4bef08=_0x4bef08[_0x8a1e('0xac')]('{'+_0x30dda2[0x0]+'}',this[_0x8a1e('0x35')][_0x8a1e('0xad')](_0x30dda2[0x0])[_0x8a1e('0xae')]||_0x30dda2[0x0]);}}if(_0x2bd5f9[_0x8a1e('0xa5')]===0x1){return _0x4bef08[_0x8a1e('0x4b')]();}console[_0x8a1e('0x40')](_0x8a1e('0xaf'),_0x4bef08);return this['replaceAllVariables'](_0x4bef08);};AGIVertices[_0x8a1e('0x14')]['getAndSetVariable']=function(_0x32f3ec,_0x5f1929){var _0x8ec72c=this['channel'][_0x8a1e('0xad')](_0x32f3ec);if(_0x8ec72c['result']===-0x1){return _0x8ec72c;}logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0xb1'),_0x5f1929,_0x8ec72c[_0x8a1e('0xae')]));return this[_0x8a1e('0x35')]['setVariable'](_0x5f1929,_0x8ec72c[_0x8a1e('0xae')]);};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x8d')]=function(_0x363067){return _0x363067&&_0x363067!=='0'&&_0x363067!=='-1'&&_0x363067!=='';};AGIVertices['prototype'][_0x8a1e('0xb2')]=function(_0x4af948){this[_0x8a1e('0x34')][_0x8a1e('0xb3')](this,_0x4af948,'-');_0x4af948[_0x8a1e('0xb4')]=_0x4af948[_0x8a1e('0xb2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x2ae0bd){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0xb5'),_0x2ae0bd[_0x8a1e('0xb6')]));if(!this['isConfigured'](_0x2ae0bd[_0x8a1e('0x6a')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0xb8'));}var _0x367e61='\x22'+_0x2ae0bd[_0x8a1e('0x6a')]+'\x22';if(this[_0x8a1e('0x8d')](_0x2ae0bd[_0x8a1e('0x83')])){_0x367e61+=','+_0x2ae0bd['options'];}var _0x4d038c=this['channel'][_0x8a1e('0xb9')](_0x8a1e('0xba'),_0x367e61);if(_0x4d038c['result']===-0x1){return _0x4d038c;}return this[_0x8a1e('0x35')]['noop'](util['format'](_0x8a1e('0xbb'),_0x367e61));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0xbc')]=function(_0x168555){logger['info'](util[_0x8a1e('0xa7')](_0x8a1e('0xbd'),_0x168555[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x168555['grammar'])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')]('no\x20grammar\x20configured');}var _0x1e46a8=_0x168555['grammar'];if(this[_0x8a1e('0x8d')](_0x168555[_0x8a1e('0x83')])){_0x1e46a8+=','+_0x168555[_0x8a1e('0x83')];}var _0x5d981c=this[_0x8a1e('0x35')][_0x8a1e('0xb9')](_0x8a1e('0xbe'),_0x1e46a8);if(_0x5d981c['result']===-0x1){return _0x5d981c;}var _0x37e8a2=this['getAndSetVariable'](_0x8a1e('0xbf'),_0x8a1e('0xc0'));if(_0x37e8a2['result']===-0x1){return _0x37e8a2;}var _0x7ba111=this[_0x8a1e('0xc1')](_0x8a1e('0xc2'),'MRCP_RECOG_TRANSCRIPT');if(_0x7ba111[_0x8a1e('0xc3')]===-0x1){return _0x7ba111;}var _0x19b4f8=this['getAndSetVariable'](_0x8a1e('0xc4'),_0x8a1e('0xc5'));if(_0x19b4f8[_0x8a1e('0xc3')]===-0x1){return _0x19b4f8;}return this['channel'][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0xc6'),_0x1e46a8));};AGIVertices[_0x8a1e('0x14')]['agi']=function(_0xd96287){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0xc7'),_0xd96287[_0x8a1e('0xb6')]));return this[_0x8a1e('0x35')][_0x8a1e('0x7')]([_0xd96287[_0x8a1e('0xc8')],_0xd96287['args']]);};AGIVertices['prototype'][_0x8a1e('0xc9')]=function(_0xa9b102){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0xca'),_0xa9b102[_0x8a1e('0xb6')]));if(this['isConfigured'](_0xa9b102['timeout'])){logger[_0x8a1e('0xb0')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0xa9b102['timeout']));var _0x4ff3fa=this['channel']['wait'](_0xa9b102[_0x8a1e('0x72')]);if(_0x4ff3fa['result']===-0x1){return _0x4ff3fa;}}return this[_0x8a1e('0x35')]['answer']();};AGIVertices[_0x8a1e('0x14')]['callback']=function(_0x1cc89e){console[_0x8a1e('0x40')](_0x8a1e('0xcb'),_0x1cc89e);logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0xcc'),_0x1cc89e[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x1cc89e[_0x8a1e('0x47')])){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x1cc89e,_0x8a1e('0xcd'));}_0x1cc89e[_0x8a1e('0x4a')]=moment();if(this[_0x8a1e('0x8d')](_0x1cc89e['delay'])){_0x1cc89e[_0x8a1e('0x4a')]=moment()[_0x8a1e('0x57')](_0x1cc89e[_0x8a1e('0xce')],_0x8a1e('0x58'));}if(!this[_0x8a1e('0x8d')](_0x1cc89e[_0x8a1e('0x4c')])){_0x1cc89e[_0x8a1e('0x4c')]=0x2;}console[_0x8a1e('0x40')](_0x8a1e('0xcf'),_0x1cc89e);this[_0x8a1e('0xd0')]['sync'](this,_0x1cc89e);return this[_0x8a1e('0x35')]['noop'](util[_0x8a1e('0xa7')](_0x8a1e('0xd1'),_0x1cc89e[_0x8a1e('0x51')],_0x1cc89e[_0x8a1e('0x47')],_0x1cc89e[_0x8a1e('0x4a')]));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0xd2')]=function(_0x215806){logger[_0x8a1e('0xb0')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x215806[_0x8a1e('0xb6')]));var _0x5cedfb=this[_0x8a1e('0x35')][_0x8a1e('0xb9')](_0x215806[_0x8a1e('0xd3')],_0x215806[_0x8a1e('0x83')]);if(_0x5cedfb[_0x8a1e('0xc3')]===-0x1){return _0x5cedfb;}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0xd4'),_0x215806[_0x8a1e('0xd3')],_0x215806[_0x8a1e('0x83')]));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0xd5')]=function(_0x259419){logger['info'](util[_0x8a1e('0xa7')](_0x8a1e('0xd6'),_0x259419[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x259419['text'])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0xb8'));}var _0x4bc9cb='\x22'+_0x259419[_0x8a1e('0x6a')]+'\x22';if(this[_0x8a1e('0x8d')](_0x259419[_0x8a1e('0x83')])){_0x4bc9cb+=','+_0x259419[_0x8a1e('0x83')];}var _0xd80318=this[_0x8a1e('0x35')][_0x8a1e('0xb9')]('MRCPSynth',_0x4bc9cb);if(_0xd80318[_0x8a1e('0xc3')]===-0x1){return _0xd80318;}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0xbb'),_0x4bc9cb));};AGIVertices['prototype'][_0x8a1e('0xd7')]=function(_0x51f9e4){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0xd8'),_0x51f9e4['label']));if(!this[_0x8a1e('0x8d')](_0x51f9e4[_0x8a1e('0x6a')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')]('no\x20text\x20configured');}var _0x40173d='\x22'+_0x51f9e4[_0x8a1e('0x6a')]+'\x22';if(this['isConfigured'](_0x51f9e4['options'])){_0x40173d+=','+_0x51f9e4[_0x8a1e('0x83')];}var _0x332d67=this[_0x8a1e('0x35')][_0x8a1e('0xb9')]('MRCPSynth',_0x40173d);if(_0x332d67[_0x8a1e('0xc3')]===-0x1){return _0x332d67;}return this['channel'][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0xbb'),_0x40173d));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0xd9')]=function(_0x1a1761){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0xda'),_0x1a1761[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x1a1761[_0x8a1e('0xdb')])){return this['channel'][_0x8a1e('0xb7')]('no\x20grammar\x20configured');}var _0xc200d2=_0x1a1761[_0x8a1e('0xdb')];if(this[_0x8a1e('0x8d')](_0x1a1761[_0x8a1e('0x83')])){_0xc200d2+=','+_0x1a1761[_0x8a1e('0x83')];}var _0x2a54be=this[_0x8a1e('0x35')][_0x8a1e('0xb9')]('MRCPRecog',_0xc200d2);if(_0x2a54be[_0x8a1e('0xc3')]===-0x1){return _0x2a54be;}var _0x165fd7=this[_0x8a1e('0xc1')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x165fd7[_0x8a1e('0xc3')]===-0x1){return _0x165fd7;}var _0x1d686e=this[_0x8a1e('0xc1')](_0x8a1e('0xc2'),_0x8a1e('0xdc'));if(_0x1d686e['result']===-0x1){return _0x1d686e;}var _0x3f8254=this[_0x8a1e('0xc1')]('RECOG_INSTANCE()',_0x8a1e('0xdd'));if(_0x3f8254[_0x8a1e('0xc3')]===-0x1){return _0x3f8254;}return this[_0x8a1e('0x35')]['noop'](util[_0x8a1e('0xa7')]('Executed\x20command\x20MRCPRecog\x20%s',_0xc200d2));};AGIVertices[_0x8a1e('0x14')]['sestekasr']=function(_0x15e16a){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x15e16a[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x15e16a[_0x8a1e('0xdb')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')]('no\x20grammar\x20configured');}var _0x2b6d6a=_0x15e16a['grammar'];if(this['isConfigured'](_0x15e16a[_0x8a1e('0x83')])){_0x2b6d6a+=','+_0x15e16a[_0x8a1e('0x83')];}var _0x3c7b13=this[_0x8a1e('0x35')][_0x8a1e('0xb9')](_0x8a1e('0xbe'),_0x2b6d6a);if(_0x3c7b13[_0x8a1e('0xc3')]===-0x1){return _0x3c7b13;}var _0x40dd63=this[_0x8a1e('0xc1')](_0x8a1e('0xbf'),_0x8a1e('0xde'));if(_0x40dd63[_0x8a1e('0xc3')]===-0x1){return _0x40dd63;}var _0x244378=this[_0x8a1e('0xc1')](_0x8a1e('0xc2'),_0x8a1e('0xdf'));if(_0x244378['result']===-0x1){return _0x244378;}var _0x15c00c=this[_0x8a1e('0xc1')](_0x8a1e('0xc4'),'SESTEK_ASR_INSTANCE');if(_0x15c00c[_0x8a1e('0xc3')]===-0x1){return _0x15c00c;}return this[_0x8a1e('0x35')]['noop'](util[_0x8a1e('0xa7')](_0x8a1e('0xc6'),_0x2b6d6a));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0xe0')]=function(_0x550947){logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0xe1'),_0x550947[_0x8a1e('0xb6')]));if(!this['isConfigured'](_0x550947['odbc_id'])){return this['channel'][_0x8a1e('0x2b')](_0x550947,_0x8a1e('0xe2'));}var _0x57743e=this[_0x8a1e('0x19')]['sync'](this,_0x550947[_0x8a1e('0xe3')]);if(!_0x57743e){return this['channel'][_0x8a1e('0x2b')](_0x550947,'no\x20odbc\x20database\x20found');}if(!this[_0x8a1e('0x8d')](_0x550947[_0x8a1e('0x2d')])){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x550947,_0x8a1e('0xe4'));}var _0x4a76fe=_0x550947[_0x8a1e('0x2d')][_0x8a1e('0x66')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8a1e('0x35')]['noop'](util[_0x8a1e('0xa7')](_0x8a1e('0xe5'),_0x4a76fe));var _0x48c74d=this[_0x8a1e('0x2a')][_0x8a1e('0xb3')](this,_0x57743e,_0x4a76fe);this[_0x8a1e('0x34')][_0x8a1e('0xb3')](this,_0x550947,_0x4a76fe);if(!this['isConfigured'](_0x550947[_0x8a1e('0xe6')])){return this[_0x8a1e('0x35')]['noop'](_0x8a1e('0xe7'));}var _0x2120a9=this[_0x8a1e('0xad')][_0x8a1e('0xb3')](this,_0x550947['variable_id']);if(!_0x2120a9){return this[_0x8a1e('0x35')]['error'](_0x550947,_0x8a1e('0xe8'));}var _0x15a37a=this;_0x48c74d[_0x8a1e('0xe9')](function(_0x3cda44,_0x1dea50){Object[_0x8a1e('0xea')](_0x3cda44)[_0x8a1e('0xe9')](function(_0x32b9ad){_0x15a37a['channel'][_0x8a1e('0xeb')](util['format'](_0x8a1e('0xec'),_0x2120a9,_0x1dea50,_0x32b9ad),_0x3cda44[_0x32b9ad]);});});this[_0x8a1e('0x35')][_0x8a1e('0xeb')](util[_0x8a1e('0xa7')](_0x8a1e('0xed'),_0x2120a9),_0x48c74d[_0x8a1e('0xa5')]);return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')]('variable\x20%s\x20set',_0x2120a9));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0xee')]=function(_0x4bd152){logger[_0x8a1e('0xef')](util[_0x8a1e('0xa7')](_0x8a1e('0xf0'),_0x4bd152[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x4bd152[_0x8a1e('0xf1')])){return this['channel']['error'](_0x4bd152,'no\x20user\x20selected');}var _0x3cae3d=this[_0x8a1e('0x1b')][_0x8a1e('0xb3')](this,_0x4bd152[_0x8a1e('0xf1')]);if(!_0x3cae3d){return this[_0x8a1e('0x35')]['error'](_0x4bd152,_0x8a1e('0xf2'));}var _0x66d008=this[_0x8a1e('0x35')]['exec'](_0x8a1e('0xf3'),[util[_0x8a1e('0xa7')](_0x8a1e('0xf4'),_0x3cae3d),_0x4bd152[_0x8a1e('0x72')],_0x4bd152[_0x8a1e('0xf5')],_0x4bd152[_0x8a1e('0x70')]]);if(_0x66d008['result']===-0x1){return _0x66d008;}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0xf6'),_0x8a1e('0xf3')));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0xf7')]=function(_0x1cbfe0){logger['info'](util['format'](_0x8a1e('0xf8'),_0x1cbfe0[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x1cbfe0[_0x8a1e('0x85')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')]('no\x20key\x20configured');}if(!this[_0x8a1e('0x8d')](_0x1cbfe0['text'])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')]('no\x20text\x20configured');}this[_0x8a1e('0x35')]['bot']=!![];this[_0x8a1e('0x34')](_0x1cbfe0);this[_0x8a1e('0xf9')](_0x1cbfe0[_0x8a1e('0x6a')],'in');this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0xfa'),_0x1cbfe0[_0x8a1e('0x6a')]));var _0x5864b4=this['googleDialogflow']['sync'](this,_0x1cbfe0);if(_0x5864b4){for(var _0x1f4056 in _0x5864b4){if(_0x5864b4[_0x8a1e('0x9e')](_0x1f4056)){this[_0x8a1e('0x35')][_0x8a1e('0xeb')](util[_0x8a1e('0xa7')](_0x8a1e('0xfb'),_0x1f4056[_0x8a1e('0x76')]()),_0x5864b4[_0x1f4056]);}}this[_0x8a1e('0xf9')](_0x5864b4[_0x8a1e('0xfc')],_0x8a1e('0xfd'));return this['channel'][_0x8a1e('0xb7')](util['format'](_0x8a1e('0xfe'),_0x5864b4[_0x8a1e('0xfc')]));}return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x1cbfe0,_0x8a1e('0xff'));};AGIVertices['prototype']['sesteknda']=function(_0x16a555){logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0x100'),_0x16a555[_0x8a1e('0xb6')]));if(!this['isConfigured'](_0x16a555[_0x8a1e('0x101')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x16a555['username'])){return this['channel'][_0x8a1e('0xb7')](_0x8a1e('0x102'));}if(!this['isConfigured'](_0x16a555[_0x8a1e('0x103')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0x104'));}if(!this[_0x8a1e('0x8d')](_0x16a555[_0x8a1e('0x105')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x8a1e('0x35')]['bot']=!![];this[_0x8a1e('0x34')](_0x16a555);this[_0x8a1e('0xf9')](_0x16a555['text'],'in');this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x106'),_0x16a555[_0x8a1e('0x6a')]));var _0x52a761=this[_0x8a1e('0x87')][_0x8a1e('0xb3')](this,_0x16a555);if(_0x52a761){for(var _0xd88407 in _0x52a761){if(_0x52a761[_0x8a1e('0x9e')](_0xd88407)){this[_0x8a1e('0x35')]['setVariable'](util[_0x8a1e('0xa7')](_0x8a1e('0x107'),_0xd88407[_0x8a1e('0x76')]()),_0x52a761[_0xd88407]);}}this['createSquareMessage'](_0x52a761[_0x8a1e('0xfc')],'out');if(_0x52a761['audiofile']){this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x52a761[_0x8a1e('0x108')]));var _0x3f31ba=this[_0x8a1e('0x35')][_0x8a1e('0x109')](_0x52a761[_0x8a1e('0x108')]);try{fs[_0x8a1e('0x10a')](_0x52a761['audiofile']+'.wav');}catch(_0x180795){logger['error'](_0x180795);}return _0x3f31ba;}else{return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x10b'),_0x52a761[_0x8a1e('0xfc')]));}}return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x16a555,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x8a1e('0x10c')]=function(_0x1a2416){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x10d'),_0x1a2416['label']));return this['channel'][_0x8a1e('0xb7')](_0x8a1e('0x10c'));};AGIVertices['prototype'][_0x8a1e('0x10e')]=function(_0x5d20e1){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x10f'),_0x5d20e1['label']));var _0x37ed69='';if(_0x5d20e1[_0x8a1e('0x110')]){if(!this[_0x8a1e('0x8d')](_0x5d20e1[_0x8a1e('0x110')])){return this['channel'][_0x8a1e('0x2b')](_0x5d20e1,_0x8a1e('0x111'));}else{var _0x3a6816=parseInt(_0x5d20e1[_0x8a1e('0x110')],0xa);if(isNaN(_0x3a6816)){_0x37ed69=_0x5d20e1['trunk_id'];}else{_0x37ed69=this[_0x8a1e('0x1d')][_0x8a1e('0xb3')](this,_0x5d20e1['trunk_id']);if(!_0x37ed69){return this['channel'][_0x8a1e('0x2b')](_0x5d20e1,_0x8a1e('0x112'));}}}}else if(_0x5d20e1[_0x8a1e('0x113')]){_0x37ed69=_0x5d20e1[_0x8a1e('0x113')];}else{return this[_0x8a1e('0x35')]['error'](_0x5d20e1,_0x8a1e('0x111'));}var _0x497a27=this[_0x8a1e('0x35')][_0x8a1e('0xb9')](_0x8a1e('0xf3'),[util[_0x8a1e('0xa7')](_0x8a1e('0x114'),_0x37ed69,_0x5d20e1[_0x8a1e('0x51')]),_0x5d20e1[_0x8a1e('0x72')],_0x5d20e1[_0x8a1e('0xf5')],_0x5d20e1[_0x8a1e('0x70')]]);if(_0x497a27[_0x8a1e('0xc3')]===-0x1){return _0x497a27;}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util['format']('Executed\x20command\x20%s',_0x8a1e('0xf3')));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x115')]=function(_0x3854c3){logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0x116'),_0x3854c3[_0x8a1e('0xb6')]));return this[_0x8a1e('0x35')]['noop'](_0x8a1e('0x115'));};AGIVertices[_0x8a1e('0x14')]['getdigits']=function(_0x42efd8){logger['info'](util[_0x8a1e('0xa7')](_0x8a1e('0x117'),_0x42efd8['label']));if(_0x42efd8[_0x8a1e('0xb4')]===0x0){return this[_0x8a1e('0xb2')](_0x42efd8);}_0x42efd8[_0x8a1e('0xb4')]-=0x1;if(!this[_0x8a1e('0x8d')](_0x42efd8[_0x8a1e('0x118')])){return this['channel'][_0x8a1e('0x2b')](_0x42efd8,_0x8a1e('0x119'));}var _0x8992da=this[_0x8a1e('0x1f')]['sync'](this,_0x42efd8['file_id']);if(!_0x8992da){return this['channel']['error'](_0x42efd8,'no\x20file\x20audio\x20found');}if(!this[_0x8a1e('0x8d')](_0x42efd8[_0x8a1e('0xe6')])){return this[_0x8a1e('0x35')]['error'](_0x8a1e('0xe7'));}var _0x3e3335=this[_0x8a1e('0x35')][_0x8a1e('0x11a')](_0x8992da,_0x42efd8[_0x8a1e('0x11b')],_0x42efd8[_0x8a1e('0x11c')]);var _0x3d343c=_0x3e3335['result']?_0x3e3335[_0x8a1e('0xc3')][_0x8a1e('0x4b')]():'';logger[_0x8a1e('0xb0')](_0x8a1e('0x11d'),JSON[_0x8a1e('0x7d')](_0x3e3335));if(_0x3e3335['result']===-0x1){this[_0x8a1e('0x34')][_0x8a1e('0xb3')](this,_0x42efd8,_0x3d343c);return _0x3e3335;}else if(_0x3e3335[_0x8a1e('0xae')]==='timeout'){_0x3e3335['result']=_0x3d343c['length']>=parseInt(_0x42efd8[_0x8a1e('0x11e')])?'x':'i';}else{_0x3e3335['result']=_0x3d343c[_0x8a1e('0xa5')]>=parseInt(_0x42efd8['mindigit'])&&_0x3d343c[_0x8a1e('0xa5')]<=parseInt(_0x42efd8['maxdigit'])?'x':'i';}var _0x280664=this['getVariable'][_0x8a1e('0xb3')](this,_0x42efd8[_0x8a1e('0xe6')]);if(!_0x280664){return this['channel'][_0x8a1e('0x2b')](_0x42efd8,_0x8a1e('0xe8'));}this[_0x8a1e('0x35')][_0x8a1e('0xeb')](_0x280664,_0x3d343c);if(this[_0x8a1e('0x8d')](_0x42efd8[_0x8a1e('0x11f')])){var _0x59dd74=parseInt(_0x42efd8['hiddendigitsnum'],0xa);var _0x54ba5e=rs[_0x8a1e('0x120')]({'charset':'*','length':_0x59dd74});var _0x97dbe2=_0x3d343c[_0x8a1e('0xa5')];if(_0x97dbe2>0x0){if(_0x97dbe2>_0x59dd74){this['createSquareDetailsReport'][_0x8a1e('0xb3')](this,_0x42efd8,_0x42efd8['hiddendigitspos']===_0x8a1e('0x121')?_0x54ba5e+_0x3d343c['substr'](_0x59dd74):_0x3d343c['substr'](0x0,_0x97dbe2-_0x59dd74)+_0x54ba5e);}else{this[_0x8a1e('0x34')][_0x8a1e('0xb3')](this,_0x42efd8,rs['generate']({'charset':'*','length':_0x97dbe2}));}}else{this[_0x8a1e('0x34')]['sync'](this,_0x42efd8,'');}}else{this[_0x8a1e('0x34')]['sync'](this,_0x42efd8,_0x3d343c);}return _0x3e3335;};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0xe')]=function(_0x2609d1){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x122'),_0x2609d1[_0x8a1e('0xb6')]));return this[_0x8a1e('0xd')](_0x2609d1);};AGIVertices[_0x8a1e('0x14')]['goal']=function(_0x283fb8){logger['info'](util[_0x8a1e('0xa7')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x283fb8['label']));this['createSquareDetailsReport'][_0x8a1e('0xb3')](this,_0x283fb8,_0x283fb8[_0x8a1e('0x123')]);return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util['format'](_0x8a1e('0x124'),_0x283fb8['goalname']));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x125')]=function(_0x237f19){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x126'),_0x237f19[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x237f19['aws_access_key_id'])||!this[_0x8a1e('0x8d')](_0x237f19[_0x8a1e('0x90')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0x127'));}if(!this['isConfigured'](_0x237f19['text'])){return this[_0x8a1e('0x35')]['noop'](_0x8a1e('0xb8'));}this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')]('Trying\x20aws\x20Polly\x20%s',_0x237f19[_0x8a1e('0x6a')]));var _0x5c344b=this[_0x8a1e('0x8f')][_0x8a1e('0xb3')](this,_0x237f19);if(_0x5c344b){this[_0x8a1e('0x35')]['noop'](util[_0x8a1e('0xa7')](_0x8a1e('0x128'),_0x5c344b));var _0x1476c8=this[_0x8a1e('0x35')][_0x8a1e('0x109')](_0x5c344b);try{fs[_0x8a1e('0x10a')](_0x5c344b+_0x8a1e('0x129'));}catch(_0x2c5a78){logger['error'](_0x2c5a78);}return _0x1476c8;}return this['channel'][_0x8a1e('0x2b')](_0x237f19,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x8a1e('0x12a')]=function(_0x2ebc56){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x12b'),_0x2ebc56['label']));if(!this[_0x8a1e('0x8d')](_0x2ebc56[_0x8a1e('0x95')])||!this[_0x8a1e('0x8d')](_0x2ebc56[_0x8a1e('0x90')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0x127'));}if(!this[_0x8a1e('0x8d')](_0x2ebc56[_0x8a1e('0x12c')])){return this[_0x8a1e('0x35')]['noop'](_0x8a1e('0x12d'));}if(!this[_0x8a1e('0x8d')](_0x2ebc56[_0x8a1e('0x6a')])){return this['channel']['noop'](_0x8a1e('0xb8'));}this[_0x8a1e('0x35')][_0x8a1e('0x12e')]=!![];this[_0x8a1e('0x34')](_0x2ebc56);this[_0x8a1e('0xf9')](_0x2ebc56[_0x8a1e('0x6a')],'in');this['channel'][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x12f'),_0x2ebc56[_0x8a1e('0x6a')]));var _0x49b61a=this['awsLex']['sync'](this,_0x2ebc56);if(_0x49b61a){for(var _0x39da7a in _0x49b61a){if(_0x49b61a[_0x8a1e('0x9e')](_0x39da7a)&&_[_0x8a1e('0x9f')](_0x49b61a[_0x39da7a])){this[_0x8a1e('0x35')][_0x8a1e('0xeb')](util[_0x8a1e('0xa7')](_0x8a1e('0x130'),_0x39da7a['toUpperCase']()),_0x49b61a[_0x39da7a]);}}if(_[_0x8a1e('0x43')](_0x49b61a[_0x8a1e('0x81')])){return this[_0x8a1e('0x35')]['noop'](_0x8a1e('0x131'));}else{this[_0x8a1e('0xf9')](_0x49b61a[_0x8a1e('0x81')],'out');return this[_0x8a1e('0x35')]['noop'](util[_0x8a1e('0xa7')](_0x8a1e('0x132'),_0x49b61a[_0x8a1e('0x81')]));}}return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x2ebc56,_0x8a1e('0x133'));};AGIVertices[_0x8a1e('0x14')]['googleasr']=function(_0x56e918){logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0x134'),_0x56e918[_0x8a1e('0xb6')],_0x56e918[_0x8a1e('0x72')]));if(!this[_0x8a1e('0x8d')](_0x56e918[_0x8a1e('0x85')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0x135'));}var _0x26121e=_0x8a1e('0x136');var _0x1cd708=util[_0x8a1e('0xa7')]('%s/recordings/%s',FILES_PATH,rs[_0x8a1e('0x120')](0x4));var _0x47ef58=util['format']('%s.%s',_0x1cd708,_0x26121e);var _0xeb67e3=!![];if(_0x56e918['beep']==='NOBEEP'){_0xeb67e3=![];}var _0x55caef=this[_0x8a1e('0x35')][_0x8a1e('0x137')](_0x1cd708,_0x26121e,_0x56e918[_0x8a1e('0x138')],_0x56e918[_0x8a1e('0x72')],undefined,_0xeb67e3);if(_0x55caef['result']!==-0x1){this['channel']['noop'](util['format']('google\x20%s\x20file\x20created',_0x47ef58));var _0x23cef1=this[_0x8a1e('0x97')][_0x8a1e('0xb3')](this,_0x56e918,_0x47ef58);if(_0x23cef1){for(var _0x1ec4ba in _0x23cef1){if(_0x23cef1[_0x8a1e('0x9e')](_0x1ec4ba)){this['channel'][_0x8a1e('0xeb')](util[_0x8a1e('0xa7')](_0x8a1e('0x139'),_0x1ec4ba['toUpperCase']()),_0x23cef1[_0x1ec4ba]);}}return this[_0x8a1e('0x35')]['noop'](util[_0x8a1e('0xa7')](_0x8a1e('0x13a'),JSON[_0x8a1e('0x7d')](_0x23cef1)));}}return _0x55caef;};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x13b')]=function(_0x27fefd){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x27fefd[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x27fefd['appid'])){return this['channel'][_0x8a1e('0xb7')](_0x8a1e('0x13c'));}if(!this[_0x8a1e('0x8d')](_0x27fefd[_0x8a1e('0x9b')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0x13d'));}var _0x67a0a=_0x8a1e('0x136');var _0x711c4a=util[_0x8a1e('0xa7')](_0x8a1e('0x13e'),FILES_PATH,rs['generate'](0x4));var _0x263a46=util[_0x8a1e('0xa7')](_0x8a1e('0xa8'),_0x711c4a,_0x67a0a);var _0x4828ff=!![];if(_0x27fefd[_0x8a1e('0x13f')]===_0x8a1e('0x140')){_0x4828ff=![];}var _0x512a6e=this['channel']['recordFile'](_0x711c4a,_0x67a0a,_0x27fefd[_0x8a1e('0x138')],_0x27fefd[_0x8a1e('0x72')],undefined,_0x4828ff);if(_0x512a6e[_0x8a1e('0xc3')]!==-0x1){this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x141'),_0x263a46));var _0x5794bc=this[_0x8a1e('0x99')]['sync'](this,_0x27fefd,_0x263a46);if(_0x5794bc){for(var _0x378b09 in _0x5794bc){if(_0x5794bc[_0x8a1e('0x9e')](_0x378b09)){this[_0x8a1e('0x35')][_0x8a1e('0xeb')](util['format'](_0x8a1e('0x142'),_0x378b09[_0x8a1e('0x76')]()),_0x5794bc[_0x378b09]);}}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x143'),JSON[_0x8a1e('0x7d')](_0x5794bc)));}}return _0x512a6e;};AGIVertices['prototype'][_0x8a1e('0x144')]=function(_0x5b3faa){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5b3faa[_0x8a1e('0xb6')]));return this[_0x8a1e('0x35')][_0x8a1e('0x145')](_0x5b3faa['context'],_0x5b3faa['extension'],_0x5b3faa[_0x8a1e('0x3e')]);};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x146')]=function(_0x2c5752){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x147'),_0x2c5752[_0x8a1e('0xb6')]));if(!this['isConfigured'](_0x2c5752[_0x8a1e('0x148')])){return this[_0x8a1e('0x35')]['error'](_0x2c5752,_0x8a1e('0x149'));}try{var _0x2928d7=eval(_0x2c5752[_0x8a1e('0x148')])?_0x8a1e('0x14a'):_0x8a1e('0x14b');this['channel'][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2c5752[_0x8a1e('0x148')],_0x2928d7));return{'code':0xc8,'result':_0x2928d7};}catch(_0xa734ab){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x14c')]=function(_0x27724b){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x14d'),_0x27724b['label']));if(!this[_0x8a1e('0x8d')](_0x27724b[_0x8a1e('0x14e')])){return this['channel'][_0x8a1e('0x2b')](_0x27724b,_0x8a1e('0x14f'));}var _0x2b39b1=this['getIntervals'][_0x8a1e('0xb3')](this,_0x27724b[_0x8a1e('0x14e')]);if(!_0x2b39b1){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x27724b,_0x8a1e('0x150'));}for(var _0x57f721=0x0;_0x57f721<_0x2b39b1['length'];_0x57f721+=0x1){var _0x2b3893=this[_0x8a1e('0x35')][_0x8a1e('0xad')](util['format'](_0x8a1e('0x151'),_0x2b39b1[_0x57f721]));if(_0x2b3893[_0x8a1e('0xc3')]===-0x1){return _0x2b3893;}logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')]('IFTIME\x20%s\x20%s',_0x2b39b1[_0x57f721],_0x2b3893[_0x8a1e('0xae')]));if(_0x2b3893['extra']===_0x8a1e('0x14a')){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x152'),_0x2b39b1[_0x57f721],_0x8a1e('0x14a')));this['channel'][_0x8a1e('0xb7')](util['format'](_0x8a1e('0x152'),_0x2b39b1[_0x57f721],'true'));return{'code':0xc8,'result':_0x8a1e('0x14a')};}else{logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x152'),_0x2b39b1[_0x57f721],_0x8a1e('0x14b')));this['channel'][_0x8a1e('0xb7')](util['format'](_0x8a1e('0x152'),_0x2b39b1[_0x57f721],_0x8a1e('0x14b')));}}return{'code':0xc8,'result':_0x8a1e('0x14b')};};AGIVertices['prototype'][_0x8a1e('0x153')]=function(_0x1aad20){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1aad20[_0x8a1e('0xb6')]));return this['channel'][_0x8a1e('0x153')]();};AGIVertices[_0x8a1e('0x14')]['ispeechasr']=function(_0x2cc44a){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x154'),_0x2cc44a[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x2cc44a[_0x8a1e('0x85')])){return this['channel'][_0x8a1e('0xb7')](_0x8a1e('0x135'));}var _0x56b406=_0x8a1e('0x136');var _0x321979=util[_0x8a1e('0xa7')](_0x8a1e('0x13e'),FILES_PATH,rs[_0x8a1e('0x120')](0x4));var _0x1c53ac=util[_0x8a1e('0xa7')](_0x8a1e('0xa8'),_0x321979,_0x56b406);var _0x20f73a=!![];if(_0x2cc44a['beep']===_0x8a1e('0x140')){_0x20f73a=![];}var _0xf03a30=this['channel'][_0x8a1e('0x137')](_0x321979,_0x56b406,_0x2cc44a[_0x8a1e('0x138')],_0x2cc44a[_0x8a1e('0x72')],undefined,_0x20f73a);if(_0xf03a30['result']!==-0x1){this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util['format'](_0x8a1e('0x155'),_0x1c53ac));var _0x67f7de=this[_0x8a1e('0x8b')][_0x8a1e('0xb3')](this,_0x2cc44a,_0x1c53ac);if(_0x67f7de){for(var _0x5a4af4 in _0x67f7de){if(_0x67f7de[_0x8a1e('0x9e')](_0x5a4af4)){this[_0x8a1e('0x35')][_0x8a1e('0xeb')](util['format'](_0x8a1e('0x156'),_0x5a4af4[_0x8a1e('0x76')]()),_0x67f7de[_0x5a4af4]);}}return this['channel'][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x157'),JSON[_0x8a1e('0x7d')](_0x67f7de)));}}return _0xf03a30;};AGIVertices['prototype']['ispeechtts']=function(_0xa3ef29){logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0x158'),_0xa3ef29[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0xa3ef29[_0x8a1e('0x85')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0x135'));}if(!this[_0x8a1e('0x8d')](_0xa3ef29[_0x8a1e('0x6a')])){return this['channel']['noop'](_0x8a1e('0xb8'));}this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x159'),_0xa3ef29['text']));var _0x4fc473=this['ispeechTTS'][_0x8a1e('0xb3')](this,_0xa3ef29);if(_0x4fc473){this['channel']['noop'](util[_0x8a1e('0xa7')]('ispeech\x20%s\x20file\x20created',_0x4fc473));var _0x565436=this[_0x8a1e('0x35')]['streamFile'](_0x4fc473,_0xa3ef29[_0x8a1e('0x138')]);try{fs[_0x8a1e('0x10a')](_0x4fc473+_0x8a1e('0x129'));}catch(_0x2002cb){logger[_0x8a1e('0x2b')](_0x2002cb);}return _0x565436;}return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0xa3ef29,_0x8a1e('0x15a'));};AGIVertices['prototype'][_0x8a1e('0x15b')]=function(_0x1c1e1d){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x15c'),_0x1c1e1d[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x1c1e1d[_0x8a1e('0x15d')])){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x1c1e1d,_0x8a1e('0x15e'));}logger['info'](util[_0x8a1e('0xa7')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a1e('0x35')][_0x8a1e('0x39')],_0x1c1e1d['findBy']));var _0x9bce9d=this[_0x8a1e('0x60')][_0x8a1e('0xb3')](this,_0x1c1e1d[_0x8a1e('0x15d')]);if(_0x9bce9d){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x8a1e('0x39')],_0x1c1e1d[_0x8a1e('0x15d')]));this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x15f'),this[_0x8a1e('0x35')]['callerid'],_0x1c1e1d['findBy']));return{'code':0xc8,'result':_0x8a1e('0x160')};}else{logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0x161'),this['channel'][_0x8a1e('0x39')],_0x1c1e1d[_0x8a1e('0x15d')]));this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8a1e('0x35')][_0x8a1e('0x39')],_0x1c1e1d['findBy']));return{'code':0xc8,'result':_0x8a1e('0x162')};}};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x163')]=function(_0x4c3728){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x164'),_0x4c3728[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x4c3728[_0x8a1e('0x15d')])){return this['channel'][_0x8a1e('0x2b')](_0x4c3728,_0x8a1e('0x15e'));}logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x165'),this['channel'][_0x8a1e('0x39')],_0x4c3728[_0x8a1e('0x15d')]));var _0x15132b=this[_0x8a1e('0x5f')][_0x8a1e('0xb3')](this,_0x4c3728['findBy']);if(_0x15132b){logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0x15f'),this[_0x8a1e('0x35')][_0x8a1e('0x39')],_0x4c3728[_0x8a1e('0x15d')]));this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util['format'](_0x8a1e('0x15f'),this[_0x8a1e('0x35')][_0x8a1e('0x39')],_0x4c3728['findBy']));return{'code':0xc8,'result':_0x8a1e('0x160')};}else{logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x161'),this['channel']['callerid'],_0x4c3728[_0x8a1e('0x15d')]));this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x161'),this[_0x8a1e('0x35')]['callerid'],_0x4c3728[_0x8a1e('0x15d')]));return{'code':0xc8,'result':_0x8a1e('0x162')};}};AGIVertices['prototype'][_0x8a1e('0x166')]=function(_0x1e3c4f){logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0x167'),_0x1e3c4f[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x1e3c4f['operation'])){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x1e3c4f,_0x8a1e('0x168'));}this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x169'),_0x1e3c4f['operation']));var _0x17ae8b=eval(_0x1e3c4f[_0x8a1e('0x16a')]);if(!this[_0x8a1e('0x8d')](_0x1e3c4f[_0x8a1e('0xe6')])){return this['channel'][_0x8a1e('0xb7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xf585c6=this['getVariable']['sync'](this,_0x1e3c4f[_0x8a1e('0xe6')]);if(!_0xf585c6){return this[_0x8a1e('0x35')]['error'](_0x1e3c4f,_0x8a1e('0xe8'));}if(_[_0x8a1e('0xa4')](_0x17ae8b)){var _0x1be73a=this;_0x17ae8b[_0x8a1e('0xe9')](function(_0x5a9c9a,_0x162408){_0x1be73a[_0x8a1e('0x35')]['setVariable'](util[_0x8a1e('0xa7')]('%s[%s]',_0xf585c6,_0x162408),_0x5a9c9a);});return this['channel'][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x16b'),_0xf585c6));}else{return this[_0x8a1e('0x35')][_0x8a1e('0xeb')](_0xf585c6,_0x17ae8b);}};AGIVertices['prototype']['menu']=function(_0x2b0106){logger['info'](util['format'](_0x8a1e('0x16c'),_0x2b0106[_0x8a1e('0xb6')]));if(_0x2b0106[_0x8a1e('0xb4')]===0x0){return this[_0x8a1e('0xb2')](_0x2b0106);}_0x2b0106[_0x8a1e('0xb4')]-=0x1;if(!this[_0x8a1e('0x8d')](_0x2b0106[_0x8a1e('0x118')])){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x2b0106,_0x8a1e('0x119'));}var _0x51c89c=this[_0x8a1e('0x1f')][_0x8a1e('0xb3')](this,_0x2b0106[_0x8a1e('0x118')]);if(!_0x51c89c){return this['channel'][_0x8a1e('0x2b')](_0x2b0106,'no\x20file\x20audio\x20found');}var _0x106df9=this['channel'][_0x8a1e('0x11a')](_0x51c89c,_0x2b0106['response'],_0x2b0106[_0x8a1e('0x16d')]);var _0x5b990a=_0x106df9[_0x8a1e('0xc3')];if(_0x106df9[_0x8a1e('0xc3')]===-0x1){this['createSquareDetailsReport'][_0x8a1e('0xb3')](this,_0x2b0106,'-1');return _0x106df9;}else if(_0x106df9[_0x8a1e('0xae')]===_0x8a1e('0x72')){_0x106df9[_0x8a1e('0xc3')]=_0x106df9['result'][_0x8a1e('0xa5')]>0x0?_0x106df9[_0x8a1e('0xc3')]:'t';}else if(_[_0x8a1e('0x42')](_0x106df9[_0x8a1e('0xc3')])){_0x106df9[_0x8a1e('0xc3')]='#';_0x5b990a='#';}if(!this[_0x8a1e('0x8d')](_0x2b0106['variable_id'])){this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0xe7'));}else{var _0x2dfd54=this['getVariable'][_0x8a1e('0xb3')](this,_0x2b0106[_0x8a1e('0xe6')]);if(!_0x2dfd54){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x2b0106,_0x8a1e('0xe8'));}this['channel'][_0x8a1e('0xeb')](_0x2dfd54,_0x5b990a);}this[_0x8a1e('0x34')][_0x8a1e('0xb3')](this,_0x2b0106,_0x5b990a);return _0x106df9;};AGIVertices[_0x8a1e('0x14')]['noop']=function(_0xb76a75){logger['info'](util[_0x8a1e('0xa7')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xb76a75['label']));return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0xb76a75[_0x8a1e('0x16e')]||_0xb76a75[_0x8a1e('0xb6')]);};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x16f')]=function(_0x203aa5){logger['info'](util[_0x8a1e('0xa7')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x203aa5['label']));if(!this['isConfigured'](_0x203aa5[_0x8a1e('0x15d')])){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x203aa5,_0x8a1e('0x15e'));}logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x165'),this[_0x8a1e('0x35')][_0x8a1e('0x39')],_0x203aa5[_0x8a1e('0x15d')]));var _0x4a60e1=this['getPause'][_0x8a1e('0xb3')](this,_0x203aa5[_0x8a1e('0x170')]);var _0x2787d7=this[_0x8a1e('0x5c')][_0x8a1e('0xb3')](this,_0x203aa5['findBy'],_0x4a60e1);if(_0x2787d7){logger['info'](util['format'](_0x8a1e('0x15f'),this['channel'][_0x8a1e('0x39')],_0x203aa5[_0x8a1e('0x15d')]));this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8a1e('0x35')][_0x8a1e('0x39')],_0x203aa5[_0x8a1e('0x15d')]));return{'code':0xc8,'result':_0x8a1e('0x160')};}else{logger['info'](util[_0x8a1e('0xa7')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8a1e('0x35')][_0x8a1e('0x39')],_0x203aa5[_0x8a1e('0x15d')]));this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8a1e('0x35')][_0x8a1e('0x39')],_0x203aa5[_0x8a1e('0x15d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x171')]=function(_0x4f1665){logger['info'](util[_0x8a1e('0xa7')](_0x8a1e('0x172'),_0x4f1665[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x4f1665[_0x8a1e('0x118')])){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x4f1665,_0x8a1e('0x119'));}var _0x3ade8d=this[_0x8a1e('0x1f')]['sync'](this,_0x4f1665['file_id']);if(!_0x3ade8d){return this['channel'][_0x8a1e('0x2b')](_0x4f1665,_0x8a1e('0x173'));}var _0x9968ed=this[_0x8a1e('0x35')][_0x8a1e('0xb9')](_0x8a1e('0x174'),[_0x3ade8d,_0x4f1665[_0x8a1e('0xf5')]]);if(_0x9968ed[_0x8a1e('0xc3')]===-0x1){return _0x9968ed;}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0xd4'),_0x8a1e('0x174'),_0x3ade8d));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x175')]=function(_0x48e2e6){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x176'),_0x48e2e6[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x48e2e6[_0x8a1e('0x177')])){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x48e2e6,'no\x20queue\x20selected');}var _0x1600e0='';var _0x699419=parseInt(_0x48e2e6[_0x8a1e('0x177')],0xa);if(isNaN(_0x699419)){_0x1600e0=_0x48e2e6[_0x8a1e('0x177')];}else{_0x1600e0=this[_0x8a1e('0x15')]['sync'](this,_0x48e2e6[_0x8a1e('0x177')]);if(!_0x1600e0){return this['channel'][_0x8a1e('0x2b')](_0x48e2e6,_0x8a1e('0x178'));}}var _0x1b28f8='';if(this['isConfigured'](_0x48e2e6[_0x8a1e('0x118')])){var _0x4acf52=this['getSound']['sync'](this,_0x48e2e6[_0x8a1e('0x118')]);if(_0x4acf52){_0x1b28f8=_0x4acf52;}}this['createSquareDetailsReport'][_0x8a1e('0xb3')](this,_0x48e2e6,_0x1600e0);if(_0x48e2e6[_0x8a1e('0xf5')]['indexOf']('x')<0x0){_0x48e2e6[_0x8a1e('0xf5')]+='x';}if(_0x48e2e6['opts'][_0x8a1e('0x179')]('X')<0x0){_0x48e2e6[_0x8a1e('0xf5')]+='X';}this['channel'][_0x8a1e('0xeb')]('XMCS-QUEUE',_0x1600e0?_0x1600e0['toLowerCase']():'');var _0x4b8b94=this['channel'][_0x8a1e('0xb9')](_0x8a1e('0x17a'),[_0x1600e0,_0x48e2e6[_0x8a1e('0xf5')],_0x48e2e6[_0x8a1e('0x70')],_0x1b28f8,_0x48e2e6[_0x8a1e('0x72')],_0x48e2e6[_0x8a1e('0x7')],_0x48e2e6['macro'],_0x48e2e6[_0x8a1e('0x17b')],'',_0x48e2e6['position']]);if(_0x4b8b94[_0x8a1e('0xc3')]===-0x1){return _0x4b8b94;}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0xd4'),_0x8a1e('0x17a'),_0x1600e0));};AGIVertices[_0x8a1e('0x14')]['record']=function(_0x13a2c7){logger['info'](util[_0x8a1e('0xa7')](_0x8a1e('0x17c'),_0x13a2c7[_0x8a1e('0xb6')]));var _0x304dfe=_0x13a2c7['recordingFormat']||'wav';var _0x123d70=util[_0x8a1e('0xa7')](_0x8a1e('0x17d'),this['channel']['uniqueid'],rs[_0x8a1e('0x120')](0x5));var _0x5becb6=util[_0x8a1e('0xa7')](_0x8a1e('0x17e'),FILES_PATH,_0x123d70,_0x304dfe);var _0x22df2d=util[_0x8a1e('0xa7')](_0x8a1e('0x13e'),FILES_PATH,_0x123d70);this[_0x8a1e('0x3a')][_0x8a1e('0xb3')](this,_0x13a2c7,_0x123d70,_0x5becb6);this[_0x8a1e('0x35')][_0x8a1e('0xeb')]('RECORDING_SAVENAME',_0x123d70);logger[_0x8a1e('0xb0')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x22df2d,_0x304dfe,_0x13a2c7['escape_digits'],_0x13a2c7[_0x8a1e('0x72')]);return this[_0x8a1e('0x35')][_0x8a1e('0x137')](_0x22df2d,_0x304dfe,_0x13a2c7['escape_digits'],_0x13a2c7[_0x8a1e('0x72')],undefined,!![]);};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x17f')]=function(_0x53885d){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x180'),_0x53885d[_0x8a1e('0xb6')]));if(!this['isConfigured'](_0x53885d[_0x8a1e('0x70')])){return this[_0x8a1e('0x35')]['noop'](_0x8a1e('0x181'));}var _0x329596=this[_0x8a1e('0x182')][_0x8a1e('0xb3')](this,_0x53885d);logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x183'),util[_0x8a1e('0x184')](_0x329596,{'showHidden':![],'depth':null})));if(!this[_0x8a1e('0x8d')](_0x53885d[_0x8a1e('0xe6')])){return this['channel'][_0x8a1e('0xb7')](_0x8a1e('0x185'));}var _0x5e536d=this[_0x8a1e('0xad')][_0x8a1e('0xb3')](this,_0x53885d[_0x8a1e('0xe6')]);if(!_0x5e536d){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x53885d,_0x8a1e('0xe8'));}this[_0x8a1e('0x35')][_0x8a1e('0xeb')](util[_0x8a1e('0xa7')]('%s_STATUS_CODE',_0x5e536d),_0x329596[_0x8a1e('0x80')]?_0x329596[_0x8a1e('0x80')]:_0x8a1e('0x186'));this[_0x8a1e('0x35')]['setVariable'](util[_0x8a1e('0xa7')](_0x8a1e('0x187'),_0x5e536d),_0x329596[_0x8a1e('0x188')]?_0x329596['statusMessage']:'OK');if(_0x329596['body']){try{this[_0x8a1e('0xa6')](_0x329596['body'],_0x5e536d);}catch(_0xc6846){logger[_0x8a1e('0x2b')](util[_0x8a1e('0xa7')](_0x8a1e('0x189'),_0x5e536d));}}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x18a'),_0x5e536d));};AGIVertices['prototype'][_0x8a1e('0x18b')]=function(_0x1b648f){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1b648f['label']));return this['channel'][_0x8a1e('0x18c')](_0x1b648f[_0x8a1e('0x18d')][_0x8a1e('0x66')](/\s+/g,''),_0x1b648f[_0x8a1e('0x18e')]);};AGIVertices['prototype'][_0x8a1e('0x18f')]=function(_0x543d18){logger['info'](util[_0x8a1e('0xa7')](_0x8a1e('0x190'),_0x543d18[_0x8a1e('0xb6')]));return this[_0x8a1e('0x35')][_0x8a1e('0x191')](_0x543d18[_0x8a1e('0x73')]['replace'](/\s+/g,''),_0x543d18[_0x8a1e('0x18e')]);};AGIVertices['prototype'][_0x8a1e('0x192')]=function(_0x120511){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x193'),_0x120511[_0x8a1e('0xb6')]));return this[_0x8a1e('0x35')][_0x8a1e('0x194')](_0x120511[_0x8a1e('0x6a')],_0x120511[_0x8a1e('0x18e')]);};AGIVertices[_0x8a1e('0x14')]['sendMail']=function(_0x3e0038){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x195'),_0x3e0038[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x3e0038[_0x8a1e('0x196')])){return this['channel'][_0x8a1e('0xb7')](_0x8a1e('0x197'));}var _0x1aa63f=this['getMailAccount'][_0x8a1e('0xb3')](this,_0x3e0038[_0x8a1e('0x196')]);if(!_0x1aa63f||!_0x1aa63f['Smtp']){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x3e0038,'no\x20mail\x20account\x20found');}var _0x4300cd={'from':util[_0x8a1e('0xa7')](_0x8a1e('0x198'),_0x1aa63f[_0x8a1e('0x13')],_0x1aa63f['email']||_0x1aa63f[_0x8a1e('0x199')][_0x8a1e('0x19a')]),'to':_0x3e0038['to']||'','cc':_0x3e0038['cc']||'','bcc':_0x3e0038[_0x8a1e('0x19b')]||'','subject':_0x3e0038[_0x8a1e('0x19c')],'html':_0x3e0038[_0x8a1e('0x6a')],'text':_0x3e0038[_0x8a1e('0x6a')]};var _0x1deaa1={'tls':{'rejectUnauthorized':![]}};if(_0x1aa63f['Smtp'][_0x8a1e('0x19d')]){_0x1deaa1[_0x8a1e('0x19d')]=_0x1aa63f['Smtp'][_0x8a1e('0x19d')];}else{_0x1deaa1[_0x8a1e('0x19e')]=_0x1aa63f[_0x8a1e('0x199')][_0x8a1e('0x19e')];_0x1deaa1[_0x8a1e('0x19f')]=_0x1aa63f[_0x8a1e('0x199')][_0x8a1e('0x19f')];_0x1deaa1[_0x8a1e('0x1a0')]=_0x1aa63f[_0x8a1e('0x199')]['secure'];}if(_0x1aa63f['Smtp'][_0x8a1e('0x1a1')]){_0x1deaa1[_0x8a1e('0x1a2')]={'user':_0x1aa63f[_0x8a1e('0x199')][_0x8a1e('0x19a')],'pass':_0x1aa63f[_0x8a1e('0x199')][_0x8a1e('0x1a3')]};}if(this['isConfigured'](_0x3e0038[_0x8a1e('0x1a4')])){}logger[_0x8a1e('0xef')](_0x8a1e('0x1a5'),JSON[_0x8a1e('0x7d')](_0x4300cd));this[_0x8a1e('0x34')][_0x8a1e('0xb3')](this,_0x3e0038,_0x3e0038[_0x8a1e('0x196')]);this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x1a6'),_0x1aa63f[_0x8a1e('0x13')]));this['sendMailMessage'][_0x8a1e('0xb3')](this,_0x1deaa1,_0x4300cd);return this['channel'][_0x8a1e('0xb7')](_0x8a1e('0x1a7'));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1a8')]=function(_0x38ed30){logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0x1a9'),_0x38ed30[_0x8a1e('0xb6')]));return this['channel'][_0x8a1e('0xb7')](_0x8a1e('0x1aa'));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1ab')]=function(_0x5cb006){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x1ac'),_0x5cb006['label']));if(!this[_0x8a1e('0x8d')](_0x5cb006[_0x8a1e('0x1ad')])){return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0x1ae'));}var _0x205e6e=this[_0x8a1e('0x31')][_0x8a1e('0xb3')](this,_0x5cb006['sms_account_id']);if(!_0x205e6e){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x5cb006,'no\x20sms\x20account\x20found');}var _0x170c0d={'body':_0x5cb006[_0x8a1e('0x1af')],'phone':_0x5cb006['to']||'','SmsAccountId':_0x205e6e['id']};logger[_0x8a1e('0xef')](_0x8a1e('0x1b0'),JSON[_0x8a1e('0x7d')](_0x170c0d));this[_0x8a1e('0x34')]['sync'](this,_0x5cb006,_0x5cb006[_0x8a1e('0x1ad')]);this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util['format'](_0x8a1e('0x1b1'),_0x205e6e['name']));this['createSmsMessage'][_0x8a1e('0xb3')](this,_0x170c0d);return this[_0x8a1e('0x35')]['noop'](_0x8a1e('0x1b2'));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1b3')]=function(_0x474fd1){logger['info'](util['format'](_0x8a1e('0x1b4'),_0x474fd1['label']));if(!this[_0x8a1e('0x8d')](_0x474fd1[_0x8a1e('0xe6')])){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x474fd1,_0x8a1e('0x1b5'));}var _0x28f481=this[_0x8a1e('0xad')][_0x8a1e('0xb3')](this,_0x474fd1[_0x8a1e('0xe6')]);if(!_0x28f481){return this[_0x8a1e('0x35')]['error'](_0x474fd1,_0x8a1e('0xe8'));}return this[_0x8a1e('0x35')][_0x8a1e('0xeb')](_0x28f481,_0x474fd1['variable_value']);};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1b6')]=function(_0x2955ff){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x1b7'),_0x2955ff[_0x8a1e('0xb6')]));this['channel'][_0x8a1e('0xb7')](_0x8a1e('0x1b8'));if(_0x2955ff['answer']===_0x8a1e('0x1b9')){this[_0x8a1e('0x35')]['noop'](_0x8a1e('0x1ba'));return this['channel'][_0x8a1e('0xc9')]();}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](_0x8a1e('0x1bb'));};AGIVertices['prototype']['subproject']=function(_0x24ee1f){logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0x1bc'),_0x24ee1f['label']));if(!this[_0x8a1e('0x8d')](_0x24ee1f[_0x8a1e('0x1bd')])){return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x24ee1f,_0x8a1e('0x1be'));}var _0x4178a9=this[_0x8a1e('0x1bf')]['sync'](this,_0x24ee1f['project_id']);if(!this[_0x8a1e('0x8d')](_0x4178a9)){return this['channel'][_0x8a1e('0x2b')](_0x24ee1f,util[_0x8a1e('0xa7')](_0x8a1e('0x1c0'),_0x24ee1f[_0x8a1e('0x1bd')]));}if(_0x4178a9===this[_0x8a1e('0x35')][_0x8a1e('0x38')]){return this['channel'][_0x8a1e('0x2b')](_0x24ee1f,_0x8a1e('0x1c1'));}this[_0x8a1e('0x34')]['sync'](this,_0x24ee1f,_0x4178a9);var _0x10f5d9=this['channel'][_0x8a1e('0xb9')]('AGI',util['format'](_0x8a1e('0x1c2'),config['agi']['host']||_0x8a1e('0x1c3'),_0x4178a9,this['channel']['arg_1']));if(_0x10f5d9[_0x8a1e('0xc3')]===-0x1){return _0x10f5d9;}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0xd4'),_0x8a1e('0x1c4'),_0x4178a9));};AGIVertices['prototype']['system']=function(_0x3b50b0){logger[_0x8a1e('0xb0')](util['format'](_0x8a1e('0x1c5'),_0x3b50b0[_0x8a1e('0xb6')]));var _0x3f3d70=this[_0x8a1e('0x64')]['sync'](this,_0x3b50b0[_0x8a1e('0xc8')]);this[_0x8a1e('0x34')][_0x8a1e('0xb3')](this,_0x3b50b0,_0x3b50b0['command']);if(this['isConfigured'](_0x3b50b0['variable_id'])){var _0x389c94=this[_0x8a1e('0xad')]['sync'](this,_0x3b50b0[_0x8a1e('0xe6')]);if(_0x389c94){this[_0x8a1e('0x35')][_0x8a1e('0xeb')](_0x389c94,_0x3f3d70);return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3b50b0[_0x8a1e('0xc8')],_0x389c94));}}return this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x3b50b0[_0x8a1e('0xc8')]));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1c6')]=function(_0x595643){logger[_0x8a1e('0xb0')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x595643[_0x8a1e('0xb6')]));_0x595643[_0x8a1e('0x6a')]=_0x595643[_0x8a1e('0x6a')][_0x8a1e('0x66')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8a1e('0x8d')](_0x595643[_0x8a1e('0x68')])){return this['channel'][_0x8a1e('0xb7')](_0x8a1e('0x1c7'));}if(!this[_0x8a1e('0x8d')](_0x595643[_0x8a1e('0x6a')])){return this['channel'][_0x8a1e('0xb7')](_0x8a1e('0xb8'));}this['channel']['noop'](util['format'](_0x8a1e('0x1c8'),_0x595643[_0x8a1e('0x6a')]));var _0x584990=this['googleCloudTTS'][_0x8a1e('0xb3')](this,_0x595643);if(_0x584990){this['channel'][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x1c9'),_0x584990));var _0x2b48c8=this[_0x8a1e('0x35')][_0x8a1e('0x109')](_0x584990);try{fs[_0x8a1e('0x10a')](_0x584990+_0x8a1e('0x129'));}catch(_0x226fc7){logger[_0x8a1e('0x2b')](_0x226fc7);}return _0x2b48c8;}return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x595643,_0x8a1e('0x1ca'));};AGIVertices['prototype'][_0x8a1e('0x1cb')]=function(_0x38b485){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x1cc'),_0x38b485[_0x8a1e('0xb6')]));_0x38b485[_0x8a1e('0x6a')]=_0x38b485[_0x8a1e('0x6a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8a1e('0x8d')](_0x38b485[_0x8a1e('0x6a')])){return this[_0x8a1e('0x35')]['noop'](_0x8a1e('0xb8'));}this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')](_0x8a1e('0x1cd'),_0x38b485['text']));var _0x165538=this['googleTTS'][_0x8a1e('0xb3')](this,_0x38b485);if(_0x165538){this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')]('Google\x20TTS\x20%s\x20file\x20created',_0x165538));var _0x15b014=this[_0x8a1e('0x35')][_0x8a1e('0x109')](_0x165538);try{fs[_0x8a1e('0x10a')](_0x165538+_0x8a1e('0x129'));}catch(_0x1377e2){logger['error'](_0x1377e2);}return _0x15b014;}return this[_0x8a1e('0x35')][_0x8a1e('0x2b')](_0x38b485,_0x8a1e('0x1ce'));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1cf')]=function(_0x2d3c39){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x2d3c39['label']));if(!this[_0x8a1e('0x8d')](_0x2d3c39[_0x8a1e('0x15d')])){return this[_0x8a1e('0x35')]['error'](_0x2d3c39,_0x8a1e('0x15e'));}logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')](_0x8a1e('0x165'),this[_0x8a1e('0x35')][_0x8a1e('0x39')],_0x2d3c39['findBy']));var _0x1c06ab=this['agentUnpause'][_0x8a1e('0xb3')](this,_0x2d3c39[_0x8a1e('0x15d')]);if(_0x1c06ab){logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x2d3c39[_0x8a1e('0x15d')]));this[_0x8a1e('0x35')][_0x8a1e('0xb7')](util[_0x8a1e('0xa7')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x2d3c39[_0x8a1e('0x15d')]));return{'code':0xc8,'result':_0x8a1e('0x160')};}else{logger[_0x8a1e('0xb0')](util[_0x8a1e('0xa7')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8a1e('0x35')][_0x8a1e('0x39')],_0x2d3c39[_0x8a1e('0x15d')]));this[_0x8a1e('0x35')]['noop'](util[_0x8a1e('0xa7')](_0x8a1e('0x161'),this['channel'][_0x8a1e('0x39')],_0x2d3c39['findBy']));return{'code':0xc8,'result':_0x8a1e('0x162')};}};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1d0')]=function(_0x3eae26){logger['info'](util[_0x8a1e('0xa7')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x3eae26[_0x8a1e('0xb6')]));var _0x30fb4a=this['channel']['exec']('VOICEMAIL',[_0x3eae26['mailbox'],_0x3eae26[_0x8a1e('0x83')]]);if(_0x30fb4a[_0x8a1e('0xc3')]===-0x1){return _0x30fb4a;}return this[_0x8a1e('0x35')]['noop'](util[_0x8a1e('0xa7')]('Executed\x20command\x20%s\x20%s',_0x8a1e('0x1d1'),_0x3eae26[_0x8a1e('0x1d2')]));};AGIVertices[_0x8a1e('0x14')][_0x8a1e('0x1d3')]=function(_0x5b7dab){logger[_0x8a1e('0xb0')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x5b7dab[_0x8a1e('0xb6')]));if(!this[_0x8a1e('0x8d')](_0x5b7dab[_0x8a1e('0xe6')])){return this[_0x8a1e('0x35')]['error'](_0x5b7dab,_0x8a1e('0x1b5'));}var _0x44d634=this['getVariable']['sync'](this,_0x5b7dab['variable_id']);if(!_0x44d634){return this[_0x8a1e('0x35')]['error'](_0x5b7dab,_0x8a1e('0xe8'));}var _0x36f0b6=this[_0x8a1e('0x35')]['getVariable'](_0x44d634);return{'code':0xc8,'result':_0x36f0b6[_0x8a1e('0xae')]?_0x36f0b6[_0x8a1e('0xae')]:'-'};};String[_0x8a1e('0x14')][_0x8a1e('0xac')]=function(_0x208470,_0x4797c9){return this[_0x8a1e('0xaa')](_0x208470)[_0x8a1e('0x1d4')](_0x4797c9);};module[_0x8a1e('0x1d5')]=AGIVertices; \ No newline at end of file +var _0x91fa=['no\x20trunk\x20selected','trunk_name','url','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appsecret\x20configured','wav','NOBEEP','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','pass','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','lodash','shelljs','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','prototype','getVariable','getVariableById','getVoiceQueue','getVoiceQueueById','name','catch','getSquareProject','getSquareProjectById','then','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','save_name','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','isEmpty','isNil','callback_','random','lastName','list_id','uniqueid','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','has','dialTimezone','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','phone','RES1','dialtimezone','timezones','scheduledat\x20before','add','minutes','scheduledat\x20after','insertContact','utcOffset','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','method','timeout','number','includes','POST','PUT','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clear','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','nextbracket','extra','replaceall\x20end','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','label','noop','no\x20text\x20configured','MRCPSynth','result','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id'];(function(_0x420972,_0x57e343){var _0x445598=function(_0x4e4db4){while(--_0x4e4db4){_0x420972['push'](_0x420972['shift']());}};_0x445598(++_0x57e343);}(_0x91fa,0xc2));var _0xa91f=function(_0x2860ab,_0x27440f){_0x2860ab=_0x2860ab-0x0;var _0x3037c4=_0x91fa[_0x2860ab];return _0x3037c4;};'use strict';var fs=require('fs');var path=require(_0xa91f('0x0'));var util=require('util');var _=require(_0xa91f('0x1'));var sh=require(_0xa91f('0x2'));var odbc=require('odbc')();var rs=require(_0xa91f('0x3'));var moment=require(_0xa91f('0x4'));var Mustache=require('mustache');var rp=require(_0xa91f('0x5'));var logger=require(_0xa91f('0x6'))(_0xa91f('0x7'));var config=require(_0xa91f('0x8'));var shared=require(_0xa91f('0x9'));var scripts=require(_0xa91f('0xa'));var FILES_PATH=_0xa91f('0xb');var recursiveMapAttributes=[_0xa91f('0xc'),_0xa91f('0xd')];var verticesWithRetry=['menu',_0xa91f('0xe'),_0xa91f('0xf')];var AGIVertices=function(_0x42ec02,_0x58f3ba,_0x566dc0){this['channel']=_0x42ec02;this[_0xa91f('0x10')]=_0x58f3ba;this['mailRpc']=_0x566dc0;};AGIVertices[_0xa91f('0x11')][_0xa91f('0x12')]=function(_0xa32fea,_0x4f1a2b){this['rpc'][_0xa91f('0x13')](_0xa32fea)['then'](function(_0x2fcdd1){_0x4f1a2b(null,_0x2fcdd1?_0x2fcdd1['name']:![]);})['catch'](function(_0x1dd41a){_0x4f1a2b(_0x1dd41a);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x14')]=function(_0x8e2cf4,_0x3e1e18){this[_0xa91f('0x10')][_0xa91f('0x15')](_0x8e2cf4)['then'](function(_0x3d7855){_0x3e1e18(null,_0x3d7855?_0x3d7855[_0xa91f('0x16')]:![]);})[_0xa91f('0x17')](function(_0x46285a){_0x3e1e18(_0x46285a);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x18')]=function(_0x3ed06d,_0x3ad37b){this[_0xa91f('0x10')][_0xa91f('0x19')](_0x3ed06d)[_0xa91f('0x1a')](function(_0x343750){_0x3ad37b(null,_0x343750?_0x343750[_0xa91f('0x16')]:![]);})['catch'](function(_0x23e7d4){_0x3ad37b(_0x23e7d4);});};AGIVertices['prototype'][_0xa91f('0x1b')]=function(_0x269d55,_0x4988d3){this[_0xa91f('0x10')][_0xa91f('0x1c')](_0x269d55)[_0xa91f('0x1a')](function(_0x342b6f){_0x4988d3(null,_0x342b6f?_0x342b6f[_0xa91f('0x1d')]:![]);})[_0xa91f('0x17')](function(_0x49c271){_0x4988d3(_0x49c271);});};AGIVertices['prototype'][_0xa91f('0x1e')]=function(_0x59cb06,_0x30b02b){this[_0xa91f('0x10')]['getUserById'](_0x59cb06)[_0xa91f('0x1a')](function(_0x21c28d){_0x30b02b(null,_0x21c28d?_0x21c28d[_0xa91f('0x16')]:![]);})['catch'](function(_0x1efd4f){_0x30b02b(_0x1efd4f);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x1f')]=function(_0x2a64ce,_0x715fc1){this[_0xa91f('0x10')][_0xa91f('0x20')](_0x2a64ce)[_0xa91f('0x1a')](function(_0x26aa26){_0x715fc1(null,_0x26aa26?_0x26aa26[_0xa91f('0x16')]:![]);})[_0xa91f('0x17')](function(_0x103744){_0x715fc1(_0x103744);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x21')]=function(_0x3285d6,_0x32b55e){var _0x1b9877=this;this[_0xa91f('0x10')][_0xa91f('0x22')](_0x3285d6)[_0xa91f('0x1a')](function(_0x292644){_0x32b55e(null,_0x292644?_0x1b9877['getSoundPath'](_0x292644[_0xa91f('0x23')]):![]);})[_0xa91f('0x17')](function(_0x18f65e){_0x32b55e(_0x18f65e);});};AGIVertices[_0xa91f('0x11')]['getMailAccount']=function(_0x22a763,_0x20502e){this[_0xa91f('0x10')]['getMailAccountById'](_0x22a763)[_0xa91f('0x1a')](function(_0x3ce87d){_0x20502e(null,_0x3ce87d?_0x3ce87d:![]);})['catch'](function(_0x410d42){_0x20502e(_0x410d42);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x24')]=function(_0x4daba7,_0x43c6bf,_0x18daae){this[_0xa91f('0x25')][_0xa91f('0x24')](_0x4daba7,_0x43c6bf)['then'](function(){_0x18daae(null);})[_0xa91f('0x17')](function(_0xe78ff1){_0x18daae(_0xe78ff1);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x26')]=function(_0x1ae319,_0x4cc851){this[_0xa91f('0x10')][_0xa91f('0x27')](_0x1ae319)[_0xa91f('0x1a')](function(_0x34d0f2){if(_0x34d0f2){if(_0x34d0f2[_0xa91f('0x28')]){_0x4cc851(null,[_0x34d0f2['interval']]);}else{_0x4cc851(null,_['map'](_0x34d0f2[_0xa91f('0x29')],'interval'));}}else{_0x4cc851(null,![]);}})[_0xa91f('0x17')](function(_0x30e152){_0x4cc851(_0x30e152);});};AGIVertices[_0xa91f('0x11')]['getSoundPath']=function(_0x1a5925){return util[_0xa91f('0x2a')](_0xa91f('0x2b'),FILES_PATH,_0x1a5925);};AGIVertices[_0xa91f('0x11')][_0xa91f('0x2c')]=function(_0x47d4c9,_0x4f5248,_0x12cddf){odbc[_0xa91f('0x2d')](_0x47d4c9,function(_0x5c1aa6){if(_0x5c1aa6){logger[_0xa91f('0x2e')](_0xa91f('0x2f'),_0x5c1aa6);_0x12cddf(_0x5c1aa6);}else{logger[_0xa91f('0x30')]('ODBC\x20connection\x20successfully');odbc[_0xa91f('0x31')](_0x4f5248,function(_0xc5f2fb,_0x3ea46a){if(_0xc5f2fb){logger[_0xa91f('0x30')](_0xa91f('0x32'),_0x4f5248);_0x12cddf(_0xc5f2fb);}else{logger[_0xa91f('0x30')]('Query\x20executed\x20correctly\x20%s',_0x4f5248);odbc[_0xa91f('0x33')](function(_0x31df9b){if(_0x31df9b){logger[_0xa91f('0x2e')](_0xa91f('0x34'),_0x31df9b);}_0x12cddf(null,_0x3ea46a);});}});}});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x35')]=function(_0x34088d,_0x5c0aa0){this[_0xa91f('0x10')]['getSmsAccountById'](_0x34088d)['then'](function(_0x2ee2db){_0x5c0aa0(null,_0x2ee2db?_0x2ee2db:![]);})[_0xa91f('0x17')](function(_0x12f6f3){_0x5c0aa0(_0x12f6f3);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x36')]=function(_0x42d112,_0x4a0684){this[_0xa91f('0x10')][_0xa91f('0x36')](_0x42d112)[_0xa91f('0x1a')](function(_0x3c7d0a){_0x4a0684(null,_0x3c7d0a);})[_0xa91f('0x17')](function(_0x35f80f){_0x4a0684(_0x35f80f);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x37')]=function(_0x3aa806,_0x4bdbd4,_0x414905){this['rpc'][_0xa91f('0x37')]({'uniqueid':this[_0xa91f('0x38')]['uniqueid'],'node':_0x3aa806['label'],'application':_0x3aa806[_0xa91f('0x39')],'data':_0x4bdbd4||null,'project_name':this[_0xa91f('0x38')][_0xa91f('0x3a')],'callerid':this[_0xa91f('0x38')][_0xa91f('0x3b')]})[_0xa91f('0x1a')](function(_0x5d6d14){if(_0x414905){_0x414905(null,_0x5d6d14);}})[_0xa91f('0x17')](function(_0x258ba0){if(_0x414905){_0x414905(_0x258ba0);}});};AGIVertices['prototype'][_0xa91f('0x3c')]=function(_0x49a805,_0x2b8f93,_0x24ecbf,_0x4a2727){this[_0xa91f('0x10')][_0xa91f('0x3c')]({'uniqueid':this[_0xa91f('0x38')]['uniqueid'],'callerid':this['channel'][_0xa91f('0x3b')],'calleridname':this['channel'][_0xa91f('0x3d')],'context':this[_0xa91f('0x38')][_0xa91f('0x3e')],'extension':this['channel'][_0xa91f('0x3f')],'priority':this[_0xa91f('0x38')][_0xa91f('0x40')],'accountcode':this[_0xa91f('0x38')]['accountcode'],'dnid':this[_0xa91f('0x38')][_0xa91f('0x41')],'projectName':this[_0xa91f('0x38')]['arg_1'],'saveName':_0x2b8f93,'filename':_0x49a805[_0xa91f('0x42')]||_0x2b8f93,'savePath':_0x24ecbf})[_0xa91f('0x1a')](function(_0x47043c){_0x4a2727(null,_0x47043c);})['catch'](function(_0x479faa){_0x4a2727(_0x479faa);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x43')]=function(_0x566057,_0x54d29a,_0x3f3314){this['rpc'][_0xa91f('0x43')]({'uniqueid':this['channel']['uniqueid'],'body':_0x566057,'direction':_0x54d29a})[_0xa91f('0x1a')](function(_0x399359){if(_0x3f3314){_0x3f3314(null,_0x399359);}})[_0xa91f('0x17')](function(_0x2edc49){if(_0x3f3314){_0x3f3314(_0x2edc49);}});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x44')]=function(_0x4bff15,_0x114d37){console[_0xa91f('0x45')](_0xa91f('0x46'),_0x4bff15);console['log']('in\x20createcmcontact\x20callback',_0x114d37);var _0x4e508a=this;var _0x5f322b=0x0;var _0xa82f54={'firstName':_[_0xa91f('0x47')](_0x4bff15['name'])||_[_0xa91f('0x48')](_0x4bff15[_0xa91f('0x16')])?_0xa91f('0x49')+Math[_0xa91f('0x4a')]():_0x4bff15[_0xa91f('0x16')],'lastName':_[_0xa91f('0x47')](_0x4bff15['lastName'])||_['isNil'](_0x4bff15['lastName'])?null:_0x4bff15[_0xa91f('0x4b')],'phone':_0x4bff15['phone'],'ListId':_0x4bff15[_0xa91f('0x4c')],'scheduledat':_0x4bff15['scheduledAt'],'callbackUniqueid':this[_0xa91f('0x38')][_0xa91f('0x4d')],'tags':_0xa91f('0x4e'),'description':_0xa91f('0x4f')+_0x4bff15[_0xa91f('0x50')][_0xa91f('0x51')](),'priority':_0x4bff15[_0xa91f('0x52')]};if(_[_0xa91f('0x53')](_0x4bff15,_0xa91f('0x54'))){if(!_[_0xa91f('0x48')](_0x4bff15[_0xa91f('0x54')])){var _0x18d721=_0x4bff15['dialTimezone'];console[_0xa91f('0x45')](_0xa91f('0x55'),_0x18d721);if(_0x4bff15[_0xa91f('0x54')]==_0xa91f('0x56')){this[_0xa91f('0x10')][_0xa91f('0x57')]({'phone':_0x4bff15[_0xa91f('0x58')]})['then'](function(_0x38490f){console[_0xa91f('0x45')](_0xa91f('0x59'),_0x38490f);var _0x57e3fd=_0x38490f[_0xa91f('0x54')];console['log'](_0xa91f('0x5a'),_0x57e3fd);if(!_[_0xa91f('0x48')](_0x57e3fd)){var _0x2c8da1=shared[_0xa91f('0x5b')][_0x57e3fd];console[_0xa91f('0x45')]('tz',_0x2c8da1);if(!_[_0xa91f('0x48')](_0x2c8da1)){var _0x43af3e=-0x1*_0x2c8da1['utcOffset'];console[_0xa91f('0x45')]('minutestoadd',_0x43af3e);console[_0xa91f('0x45')](_0xa91f('0x5c'),_0xa82f54[_0xa91f('0x50')]);_0xa82f54[_0xa91f('0x50')]=moment(_0x4bff15[_0xa91f('0x50')])[_0xa91f('0x5d')](_0x43af3e,_0xa91f('0x5e'));console[_0xa91f('0x45')](_0xa91f('0x5f'),_0xa82f54[_0xa91f('0x50')]);_0x4e508a['rpc'][_0xa91f('0x60')](_0xa82f54,_0x4bff15,_0x114d37)[_0xa91f('0x1a')](function(_0x90a647){_0x114d37(null,_0x90a647);})['catch'](function(_0x3cd3df){_0x114d37(_0x3cd3df);});}else{_0x4e508a[_0xa91f('0x10')]['insertContact'](_0xa82f54,_0x4bff15,_0x114d37)['then'](function(_0x1154e7){_0x114d37(null,_0x1154e7);})[_0xa91f('0x17')](function(_0x4f9531){_0x114d37(_0x4f9531);});}}else{_0x4e508a[_0xa91f('0x10')][_0xa91f('0x60')](_0xa82f54,_0x4bff15,_0x114d37)[_0xa91f('0x1a')](function(_0x20b8db){_0x114d37(null,_0x20b8db);})[_0xa91f('0x17')](function(_0xf9e818){_0x114d37(_0xf9e818);});}});}else{var _0x5f322b=shared[_0xa91f('0x5b')][_0x18d721];if(!_[_0xa91f('0x48')](_0x5f322b)){var _0x4bb2e0=-0x1*_0x5f322b[_0xa91f('0x61')];_0xa82f54[_0xa91f('0x50')]=moment(_0x4bff15['scheduledAt'])[_0xa91f('0x5d')](_0x4bb2e0,_0xa91f('0x5e'));_0x4e508a[_0xa91f('0x10')]['insertContact'](_0xa82f54,_0x4bff15,_0x114d37)[_0xa91f('0x1a')](function(_0x235697){_0x114d37(null,_0x235697);})[_0xa91f('0x17')](function(_0x27b9a2){_0x114d37(_0x27b9a2);});}else{_0x4e508a[_0xa91f('0x10')][_0xa91f('0x60')](_0xa82f54,_0x4bff15,_0x114d37)[_0xa91f('0x1a')](function(_0x406561){_0x114d37(null,_0x406561);})[_0xa91f('0x17')](function(_0x247b53){_0x114d37(_0x247b53);});}}}else{_0x4e508a[_0xa91f('0x10')][_0xa91f('0x60')](_0xa82f54,_0x4bff15,_0x114d37)[_0xa91f('0x1a')](function(_0x4d42ca){_0x114d37(null,_0x4d42ca);})['catch'](function(_0x116f90){_0x114d37(_0x116f90);});}}else{_0x4e508a['rpc']['insertContact'](_0xa82f54,_0x4bff15,_0x114d37)[_0xa91f('0x1a')](function(_0x44890f){_0x114d37(null,_0x44890f);})[_0xa91f('0x17')](function(_0x3792b3){_0x114d37(_0x3792b3);});}};AGIVertices[_0xa91f('0x11')][_0xa91f('0x60')]=function(_0x5797a5,_0x618ba8,_0x2dff47){this['rpc'][_0xa91f('0x44')](_0x5797a5)[_0xa91f('0x1a')](function(_0x492205){_0x2dff47(null,_0x492205);})['catch'](function(_0x14d6c1){_0x2dff47(_0x14d6c1);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x62')]=function(_0x27b0f4,_0x1f2dd5){this[_0xa91f('0x10')][_0xa91f('0x63')](_0x27b0f4)[_0xa91f('0x1a')](function(_0x74221f){_0x1f2dd5(null,_0x74221f?_0x74221f['name']:![]);})[_0xa91f('0x17')](function(_0x28a444){_0x1f2dd5(_0x28a444);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x64')]=function(_0x5dfacc,_0x3e7178,_0x16a63d){var _0x3e10ef={'role':_0xa91f('0x65')};_0x3e10ef[_0x5dfacc]=this[_0xa91f('0x38')][_0xa91f('0x3b')];this[_0xa91f('0x10')]['agentPause'](_0x3e10ef,_0x3e7178,this[_0xa91f('0x38')][_0xa91f('0x4d')])[_0xa91f('0x1a')](function(_0x27567f){_0x16a63d(null,_['isNil'](_0x27567f)?![]:!![]);})['catch'](function(_0x927bfa){logger[_0xa91f('0x2e')](_0x927bfa);_0x16a63d(null,![]);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x66')]=function(_0x8c5a6d,_0x45169f){var _0x3e1e4c={'role':_0xa91f('0x65')};_0x3e1e4c[_0x8c5a6d]=this[_0xa91f('0x38')][_0xa91f('0x3b')];this[_0xa91f('0x10')][_0xa91f('0x66')](_0x3e1e4c)[_0xa91f('0x1a')](function(_0x2e7194){_0x45169f(null,_['isNil'](_0x2e7194)?![]:!![]);})[_0xa91f('0x17')](function(_0x26a7fe){logger['error'](_0x26a7fe);_0x45169f(null,![]);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x67')]=function(_0x14702f,_0x17685e){var _0x55bd04={'role':_0xa91f('0x65')};_0x55bd04[_0x14702f]=this['channel'][_0xa91f('0x3b')];this['rpc'][_0xa91f('0x67')](_0x55bd04)['then'](function(_0xc93d59){_0x17685e(null,_[_0xa91f('0x48')](_0xc93d59)?![]:!![]);})['catch'](function(_0x5b2e7d){logger[_0xa91f('0x2e')](_0x5b2e7d);_0x17685e(null,![]);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x68')]=function(_0x2635af,_0x1388b9){var _0x167ff3={'role':_0xa91f('0x65')};_0x167ff3[_0x2635af]=this[_0xa91f('0x38')][_0xa91f('0x3b')];var _0x11c451=_0x2635af!=_0xa91f('0x69')?util[_0xa91f('0x2a')]('%s/%s@from-sip/n',_0xa91f('0x6a'),this[_0xa91f('0x38')][_0xa91f('0x3b')]):undefined;this[_0xa91f('0x10')]['agentLogin'](_0x167ff3,_0x11c451)[_0xa91f('0x1a')](function(_0x26f4a6){_0x1388b9(null,_['isNil'](_0x26f4a6)?![]:!![]);})[_0xa91f('0x17')](function(_0x26d920){logger[_0xa91f('0x2e')](_0x26d920);_0x1388b9(null,![]);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x6b')]=function(_0x52bdee,_0x3caa10){sh[_0xa91f('0x6c')](_[_0xa91f('0x6d')](_0x52bdee),function(_0x2c19f3,_0x1976ed){var _0x1734af=_0x1976ed[_0xa91f('0x6e')](/(\r\n|\n|\r)/gm,'');_0x3caa10(null,_0x1734af);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x6f')]=function(_0x5df620,_0x1c0c2e){scripts[_0xa91f('0x6f')](_0x5df620['apiKey'],_0x5df620[_0xa91f('0x70')]||_0xa91f('0x71'),_0x5df620[_0xa91f('0x71')],_0x5df620[_0xa91f('0x72')]||_0xa91f('0x73'),_0x5df620[_0xa91f('0x74')]||_0xa91f('0x75'),_0x5df620[_0xa91f('0x76')]||_0xa91f('0x77'))[_0xa91f('0x1a')](function(_0x4b8b26){_0x1c0c2e(null,_0x4b8b26);})['catch'](function(_0x4f0e58){_0x1c0c2e(_0x4f0e58);});};AGIVertices['prototype'][_0xa91f('0x78')]=function(_0x2f53a2,_0x27906f){scripts['googleTTS'](_0x2f53a2[_0xa91f('0x71')],_0x2f53a2['google_tts_language']||'en',0x1)[_0xa91f('0x1a')](function(_0x216c1a){_0x27906f(null,_0x216c1a);})[_0xa91f('0x17')](function(_0x1b2a82){_0x27906f(_0x1b2a82);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x79')]=function(_0x6bf76a,_0x33434d){var _0x42a5ce={'uri':_0x6bf76a['url'],'method':_0x6bf76a[_0xa91f('0x7a')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x6bf76a[_0xa91f('0x7b')])===_0xa91f('0x7c')&&parseInt(_0x6bf76a[_0xa91f('0x7b')])>=0x1?parseInt(_0x6bf76a['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xa91f('0x7d')]([_0xa91f('0x7e'),_0xa91f('0x7f')],_0x42a5ce[_0xa91f('0x7a')][_0xa91f('0x80')]())){try{_0x42a5ce['body']=_0x6bf76a[_0xa91f('0xd')]?JSON['parse'](_0x6bf76a['rawBody']):{};}catch(_0x350314){logger['error'](_0xa91f('0x81'),_0x350314);}}try{_0x42a5ce[_0xa91f('0x82')]=_0x6bf76a[_0xa91f('0xc')]?JSON[_0xa91f('0x83')](_0x6bf76a[_0xa91f('0xc')]):{};}catch(_0x1b07e7){logger[_0xa91f('0x2e')](_0xa91f('0x84'),_0x1b07e7);}if(_0x6bf76a[_0xa91f('0x85')]){try{var _0x19d1bb=require(_0x6bf76a['computedVariables'])[_0xa91f('0x86')](this,_0x42a5ce);_0x42a5ce[_0xa91f('0x87')]=Mustache['render'](_0x6bf76a['url'],_0x19d1bb,{},['$$','$$']);if(_0x42a5ce[_0xa91f('0x82')]){_0x42a5ce[_0xa91f('0x82')]=JSON[_0xa91f('0x83')](Mustache['render'](JSON[_0xa91f('0x88')](_0x42a5ce[_0xa91f('0x82')]),_0x19d1bb,{},['$$','$$']));}if(_0x42a5ce[_0xa91f('0x89')]){_0x42a5ce['body']=JSON[_0xa91f('0x83')](Mustache['render'](JSON[_0xa91f('0x88')](_0x42a5ce[_0xa91f('0x89')]),_0x19d1bb,{},['$$','$$']));}}catch(_0x2df952){logger['error'](_0xa91f('0x8a'),_0x2df952);}}rp(_0x42a5ce)[_0xa91f('0x1a')](function(_0x2db082){var _0x12084d={'statusCode':_0x2db082[_0xa91f('0x8b')]||0xc8,'statusMessage':_0x2db082[_0xa91f('0x8c')]||'OK','headers':_0x2db082[_0xa91f('0x82')]||{},'body':_0x2db082[_0xa91f('0x89')]||{}};_0x33434d(null,_0x12084d);})[_0xa91f('0x17')](function(_0x1ff78e){var _0x274a41={'statusCode':_0x1ff78e[_0xa91f('0x8b')]||0x1f4,'statusMessage':_0x1ff78e[_0xa91f('0x8d')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1ff78e[_0xa91f('0x8e')][_0xa91f('0x82')]||{},'body':_0x1ff78e[_0xa91f('0x8e')][_0xa91f('0x89')]||{}};_0x33434d(null,_0x274a41);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x8f')]=function(_0xfc853f,_0x4258ad){scripts[_0xa91f('0x8f')](this['channel'][_0xa91f('0x4d')],_0xfc853f[_0xa91f('0x90')],_0xfc853f[_0xa91f('0x71')],_0xfc853f['dialogflow_language']||'en')['then'](function(_0x5abe43){_0x4258ad(null,_0x5abe43);})[_0xa91f('0x17')](function(_0xfc0c31){_0x4258ad(_0xfc0c31);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x91')]=function(_0xa3ff58,_0x35f89f){scripts[_0xa91f('0x91')](this[_0xa91f('0x38')],_0xa3ff58)[_0xa91f('0x1a')](function(_0x2e6135){_0x35f89f(null,_0x2e6135);})[_0xa91f('0x17')](function(_0x16cce6){_0x35f89f(_0x16cce6);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x92')]=function(_0x1b6af9,_0x49842c){scripts[_0xa91f('0x92')](_0x1b6af9[_0xa91f('0x90')],_0x1b6af9[_0xa91f('0x71')],_0x1b6af9[_0xa91f('0x93')]||_0xa91f('0x73'),_0x1b6af9[_0xa91f('0x94')])[_0xa91f('0x1a')](function(_0x114d68){_0x49842c(null,_0x114d68);})['catch'](function(_0x468e56){_0x49842c(_0x468e56);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x95')]=function(_0x32f927,_0x5a078d,_0x23277d){scripts[_0xa91f('0x95')](_0x5a078d,_0x32f927[_0xa91f('0x90')],_0x32f927['ispeech_asr_language']||'en-US',this[_0xa91f('0x96')](_0x32f927[_0xa91f('0x97')])?_0x32f927['model']:undefined)[_0xa91f('0x1a')](function(_0x21a23b){_0x23277d(null,_0x21a23b);})[_0xa91f('0x17')](function(_0xf89906){_0x23277d(_0xf89906);});};AGIVertices[_0xa91f('0x11')]['awsPolly']=function(_0x3aaf5b,_0x50d5e6){scripts[_0xa91f('0x98')](_0x3aaf5b[_0xa91f('0x99')],_0x3aaf5b['aws_secret_access_key'],_0x3aaf5b[_0xa91f('0x9a')],_0x3aaf5b[_0xa91f('0x9b')]||_0xa91f('0x9c'),_0x3aaf5b[_0xa91f('0x71')],_0x3aaf5b[_0xa91f('0x9d')]||_0xa91f('0x71'))['then'](function(_0x1ad605){_0x50d5e6(null,_0x1ad605);})[_0xa91f('0x17')](function(_0x6ca13e){_0x50d5e6(_0x6ca13e);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0x9e')]=function(_0x3944cb,_0x3871a5){scripts[_0xa91f('0x9e')](this[_0xa91f('0x38')][_0xa91f('0x4d')],_0x3944cb['aws_access_key_id'],_0x3944cb[_0xa91f('0x9f')],_0x3944cb[_0xa91f('0xa0')],_0x3944cb[_0xa91f('0x71')],_0x3944cb[_0xa91f('0xa1')])[_0xa91f('0x1a')](function(_0x54ee81){_0x3871a5(null,_0x54ee81);})[_0xa91f('0x17')](function(_0x2f70e5){_0x3871a5(_0x2f70e5);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0xa2')]=function(_0x509412,_0x1dbd9e,_0x145fc1){scripts[_0xa91f('0xa2')](_0x1dbd9e,_0x509412[_0xa91f('0x90')],_0x509412['google_asr_language']||'en-US')[_0xa91f('0x1a')](function(_0x30abc4){_0x145fc1(null,_0x30abc4);})[_0xa91f('0x17')](function(_0x5b722e){_0x145fc1(_0x5b722e);});};AGIVertices[_0xa91f('0x11')]['tildeASR']=function(_0x5b9068,_0x38cc3e,_0x5834d7){scripts[_0xa91f('0xa3')](_0x38cc3e,_0x5b9068['appid'],_0x5b9068[_0xa91f('0xa4')],_0x5b9068[_0xa91f('0x87')])[_0xa91f('0x1a')](function(_0x505daa){_0x5834d7(null,_0x505daa);})[_0xa91f('0x17')](function(_0x4a613b){_0x5834d7(_0x4a613b);});};AGIVertices[_0xa91f('0x11')][_0xa91f('0xa5')]=function(_0x464fd6){var _0x435596=_[_0xa91f('0x7d')](verticesWithRetry,_0x464fd6[_0xa91f('0x39')])?_0x464fd6:_['clone'](_0x464fd6);for(var _0x22eeb0 in _0x435596){if(_0x435596[_0xa91f('0xa6')](_0x22eeb0)){if(_0x435596[_0x22eeb0]&&_['isString'](_0x435596[_0x22eeb0])){if(_[_0xa91f('0x7d')](recursiveMapAttributes,_0x22eeb0)){_0x435596[_0x22eeb0]=this[_0xa91f('0xa7')](_0x435596[_0x22eeb0]);}else{_0x435596[_0x22eeb0]=this[_0xa91f('0xa8')](_0x435596[_0x22eeb0]);}}}}return _0x435596;};AGIVertices['prototype'][_0xa91f('0xa9')]=function(_0x203154){for(var _0x63549d in _0x203154){if(_0x203154[_0xa91f('0xa6')](_0x63549d)){if(_[_0xa91f('0xaa')](_0x203154[_0x63549d])){this[_0xa91f('0xa9')](_0x203154[_0x63549d]);}else if(_[_0xa91f('0xab')](_0x203154[_0x63549d])){for(var _0x181f59=0x0;_0x181f59<_0x203154[_0x63549d][_0xa91f('0xac')];_0x181f59++){this[_0xa91f('0xa9')](_0x203154[_0x63549d][_0x181f59]);}}else if(_[_0xa91f('0xad')](_0x203154[_0x63549d])){_0x203154[_0x63549d]=this['replaceAllVariables'](_0x203154[_0x63549d]);}}}};AGIVertices[_0xa91f('0x11')][_0xa91f('0xae')]=function(_0x5782d1,_0x3a6cec){for(var _0x192919 in _0x5782d1){if(_0x5782d1[_0xa91f('0xa6')](_0x192919)){if(_['isPlainObject'](_0x5782d1[_0x192919])){if(!_[_0xa91f('0x47')](_0x5782d1[_0x192919])){this['saveRestApiResult'](_0x5782d1[_0x192919],util[_0xa91f('0x2a')]('%s.%s',_0x3a6cec,_0x192919));}}else if(_[_0xa91f('0xab')](_0x5782d1[_0x192919])){for(var _0x2bd126=0x0;_0x2bd126<_0x5782d1[_0x192919][_0xa91f('0xac')];_0x2bd126++){this[_0xa91f('0xae')](_0x5782d1[_0x192919][_0x2bd126],util['format'](_0xa91f('0xaf'),_0x3a6cec,_0x192919+'['+_0x2bd126+']'));}}else{if(!_[_0xa91f('0x48')](_0x5782d1[_0x192919])){this['channel'][_0xa91f('0xb0')](util[_0xa91f('0x2a')](_0xa91f('0xaf'),_0x3a6cec,_0x192919),_0x5782d1[_0x192919]);}}}}};AGIVertices[_0xa91f('0x11')]['replaceObjectAllVariables']=function(_0x5b0c53){try{var _0x38fb1c=JSON[_0xa91f('0x83')](_0x5b0c53);this['recursiveNodeIndex'](_0x38fb1c);return JSON[_0xa91f('0x88')](_0x38fb1c);}catch(_0xff22fb){return this['replaceAllVariables'](_0x5b0c53);}};AGIVertices[_0xa91f('0x11')]['replaceAllVariables']=function(_0x13482a){console[_0xa91f('0x45')]('replaceall\x20init',_0x13482a);var _0x2c5877=_0x13482a[_0xa91f('0xb1')]('{');for(var _0x5222d2=0x1;_0x5222d2<_0x2c5877[_0xa91f('0xac')];_0x5222d2+=0x1){var _0xbd0927=_0x2c5877[_0x5222d2][_0xa91f('0xb1')]('}');console[_0xa91f('0x45')](_0xa91f('0xb2'),_0xbd0927);if(_0xbd0927[_0xa91f('0xac')]>0x1){_0x13482a=_0x13482a['replaceAll']('{'+_0xbd0927[0x0]+'}',this[_0xa91f('0x38')][_0xa91f('0x12')](_0xbd0927[0x0])[_0xa91f('0xb3')]||_0xbd0927[0x0]);}}if(_0x2c5877[_0xa91f('0xac')]===0x1){return _0x13482a[_0xa91f('0x51')]();}console['log'](_0xa91f('0xb4'),_0x13482a);return this[_0xa91f('0xa8')](_0x13482a);};AGIVertices[_0xa91f('0x11')]['getAndSetVariable']=function(_0x307306,_0x149796){var _0x18b14a=this[_0xa91f('0x38')][_0xa91f('0x12')](_0x307306);if(_0x18b14a['result']===-0x1){return _0x18b14a;}logger[_0xa91f('0x30')](util['format'](_0xa91f('0xb5'),_0x149796,_0x18b14a[_0xa91f('0xb3')]));return this['channel'][_0xa91f('0xb0')](_0x149796,_0x18b14a[_0xa91f('0xb3')]);};AGIVertices[_0xa91f('0x11')][_0xa91f('0x96')]=function(_0x13a4f2){return _0x13a4f2&&_0x13a4f2!=='0'&&_0x13a4f2!=='-1'&&_0x13a4f2!=='';};AGIVertices[_0xa91f('0x11')][_0xa91f('0xb6')]=function(_0x193155){this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x193155,'-');_0x193155[_0xa91f('0xb7')]=_0x193155[_0xa91f('0xb6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa91f('0x11')]['mrcpsynth']=function(_0x1e825b){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x1e825b[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x1e825b[_0xa91f('0x71')])){return this['channel'][_0xa91f('0xb9')](_0xa91f('0xba'));}var _0x33e6d1='\x22'+_0x1e825b['text']+'\x22';if(this[_0xa91f('0x96')](_0x1e825b[_0xa91f('0x8e')])){_0x33e6d1+=','+_0x1e825b[_0xa91f('0x8e')];}var _0x210b8c=this[_0xa91f('0x38')]['exec'](_0xa91f('0xbb'),_0x33e6d1);if(_0x210b8c[_0xa91f('0xbc')]===-0x1){return _0x210b8c;}return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x33e6d1));};AGIVertices[_0xa91f('0x11')][_0xa91f('0xbd')]=function(_0x291ebc){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x291ebc[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x291ebc[_0xa91f('0xbe')])){return this[_0xa91f('0x38')]['noop'](_0xa91f('0xbf'));}var _0x32b6ff=_0x291ebc['grammar'];if(this[_0xa91f('0x96')](_0x291ebc[_0xa91f('0x8e')])){_0x32b6ff+=','+_0x291ebc[_0xa91f('0x8e')];}var _0x5212a6=this[_0xa91f('0x38')]['exec'](_0xa91f('0xc0'),_0x32b6ff);if(_0x5212a6[_0xa91f('0xbc')]===-0x1){return _0x5212a6;}var _0x5b4cfa=this[_0xa91f('0xc1')](_0xa91f('0xc2'),_0xa91f('0xc3'));if(_0x5b4cfa[_0xa91f('0xbc')]===-0x1){return _0x5b4cfa;}var _0x4dea69=this[_0xa91f('0xc1')](_0xa91f('0xc4'),_0xa91f('0xc5'));if(_0x4dea69['result']===-0x1){return _0x4dea69;}var _0x1128c2=this[_0xa91f('0xc1')]('RECOG_INSTANCE()',_0xa91f('0xc6'));if(_0x1128c2['result']===-0x1){return _0x1128c2;}return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x32b6ff));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x7')]=function(_0x4c20a7){logger['info'](util[_0xa91f('0x2a')](_0xa91f('0xc7'),_0x4c20a7[_0xa91f('0xb8')]));return this[_0xa91f('0x38')][_0xa91f('0x7')]([_0x4c20a7[_0xa91f('0xc8')],_0x4c20a7[_0xa91f('0xc9')]]);};AGIVertices['prototype'][_0xa91f('0xca')]=function(_0x536a0f){logger['info'](util[_0xa91f('0x2a')](_0xa91f('0xcb'),_0x536a0f[_0xa91f('0xb8')]));if(this['isConfigured'](_0x536a0f[_0xa91f('0x7b')])){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0xcc'),_0x536a0f['timeout']));var _0x360319=this[_0xa91f('0x38')][_0xa91f('0xcd')](_0x536a0f[_0xa91f('0x7b')]);if(_0x360319[_0xa91f('0xbc')]===-0x1){return _0x360319;}}return this[_0xa91f('0x38')][_0xa91f('0xca')]();};AGIVertices[_0xa91f('0x11')][_0xa91f('0x4e')]=function(_0x19584f){console['log'](_0xa91f('0xce'),_0x19584f);logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0xcf'),_0x19584f[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x19584f[_0xa91f('0x4c')])){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x19584f,_0xa91f('0xd0'));}_0x19584f[_0xa91f('0x50')]=moment();if(this[_0xa91f('0x96')](_0x19584f[_0xa91f('0xd1')])){_0x19584f['scheduledAt']=moment()[_0xa91f('0x5d')](_0x19584f[_0xa91f('0xd1')],_0xa91f('0x5e'));}if(!this[_0xa91f('0x96')](_0x19584f['callback_priority'])){_0x19584f[_0xa91f('0x52')]=0x2;}console['log'](_0xa91f('0xd2'),_0x19584f);this[_0xa91f('0x44')][_0xa91f('0x86')](this,_0x19584f);return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0xd3'),_0x19584f[_0xa91f('0x58')],_0x19584f[_0xa91f('0x4c')],_0x19584f[_0xa91f('0x50')]));};AGIVertices['prototype'][_0xa91f('0xd4')]=function(_0x23ca9d){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x23ca9d[_0xa91f('0xb8')]));var _0x4b792f=this[_0xa91f('0x38')][_0xa91f('0x6c')](_0x23ca9d[_0xa91f('0xd5')],_0x23ca9d[_0xa91f('0x8e')]);if(_0x4b792f['result']===-0x1){return _0x4b792f;}return this[_0xa91f('0x38')]['noop'](util[_0xa91f('0x2a')](_0xa91f('0xd6'),_0x23ca9d['application'],_0x23ca9d[_0xa91f('0x8e')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x1ce317){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0xd7'),_0x1ce317['label']));if(!this['isConfigured'](_0x1ce317[_0xa91f('0x71')])){return this[_0xa91f('0x38')][_0xa91f('0xb9')]('no\x20text\x20configured');}var _0x2ee99b='\x22'+_0x1ce317['text']+'\x22';if(this[_0xa91f('0x96')](_0x1ce317[_0xa91f('0x8e')])){_0x2ee99b+=','+_0x1ce317[_0xa91f('0x8e')];}var _0xd86efe=this[_0xa91f('0x38')]['exec']('MRCPSynth',_0x2ee99b);if(_0xd86efe[_0xa91f('0xbc')]===-0x1){return _0xd86efe;}return this['channel'][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0xd8'),_0x2ee99b));};AGIVertices[_0xa91f('0x11')][_0xa91f('0xd9')]=function(_0x349a14){logger['info'](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x349a14['label']));if(!this[_0xa91f('0x96')](_0x349a14[_0xa91f('0x71')])){return this['channel'][_0xa91f('0xb9')](_0xa91f('0xba'));}var _0x1c6501='\x22'+_0x349a14[_0xa91f('0x71')]+'\x22';if(this[_0xa91f('0x96')](_0x349a14['options'])){_0x1c6501+=','+_0x349a14[_0xa91f('0x8e')];}var _0x342122=this[_0xa91f('0x38')][_0xa91f('0x6c')](_0xa91f('0xbb'),_0x1c6501);if(_0x342122[_0xa91f('0xbc')]===-0x1){return _0x342122;}return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0xd8'),_0x1c6501));};AGIVertices[_0xa91f('0x11')][_0xa91f('0xda')]=function(_0x59e272){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x59e272['label']));if(!this['isConfigured'](_0x59e272[_0xa91f('0xbe')])){return this[_0xa91f('0x38')]['noop'](_0xa91f('0xbf'));}var _0x42a488=_0x59e272[_0xa91f('0xbe')];if(this[_0xa91f('0x96')](_0x59e272[_0xa91f('0x8e')])){_0x42a488+=','+_0x59e272[_0xa91f('0x8e')];}var _0x35af5a=this[_0xa91f('0x38')][_0xa91f('0x6c')](_0xa91f('0xc0'),_0x42a488);if(_0x35af5a[_0xa91f('0xbc')]===-0x1){return _0x35af5a;}var _0x2ae13e=this['getAndSetVariable'](_0xa91f('0xc2'),_0xa91f('0xdb'));if(_0x2ae13e['result']===-0x1){return _0x2ae13e;}var _0x424ccb=this[_0xa91f('0xc1')]('RECOG_INPUT()',_0xa91f('0xdc'));if(_0x424ccb['result']===-0x1){return _0x424ccb;}var _0xd8d101=this[_0xa91f('0xc1')](_0xa91f('0xdd'),_0xa91f('0xde'));if(_0xd8d101['result']===-0x1){return _0xd8d101;}return this['channel']['noop'](util['format'](_0xa91f('0xdf'),_0x42a488));};AGIVertices[_0xa91f('0x11')]['sestekasr']=function(_0x26765a){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x26765a[_0xa91f('0xb8')]));if(!this['isConfigured'](_0x26765a[_0xa91f('0xbe')])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0xbf'));}var _0x55c077=_0x26765a[_0xa91f('0xbe')];if(this['isConfigured'](_0x26765a[_0xa91f('0x8e')])){_0x55c077+=','+_0x26765a[_0xa91f('0x8e')];}var _0x49f09b=this[_0xa91f('0x38')][_0xa91f('0x6c')](_0xa91f('0xc0'),_0x55c077);if(_0x49f09b[_0xa91f('0xbc')]===-0x1){return _0x49f09b;}var _0x4998e4=this[_0xa91f('0xc1')](_0xa91f('0xc2'),_0xa91f('0xe0'));if(_0x4998e4[_0xa91f('0xbc')]===-0x1){return _0x4998e4;}var _0x28f3a0=this[_0xa91f('0xc1')](_0xa91f('0xc4'),'SESTEK_ASR_TRANSCRIPT');if(_0x28f3a0[_0xa91f('0xbc')]===-0x1){return _0x28f3a0;}var _0x5c4934=this[_0xa91f('0xc1')](_0xa91f('0xdd'),_0xa91f('0xe1'));if(_0x5c4934[_0xa91f('0xbc')]===-0x1){return _0x5c4934;}return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0xdf'),_0x55c077));};AGIVertices[_0xa91f('0x11')][_0xa91f('0xe2')]=function(_0x4dbd6a){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0xe3'),_0x4dbd6a[_0xa91f('0xb8')]));if(!this['isConfigured'](_0x4dbd6a['odbc_id'])){return this[_0xa91f('0x38')]['error'](_0x4dbd6a,_0xa91f('0xe4'));}var _0x5646e9=this[_0xa91f('0x1b')][_0xa91f('0x86')](this,_0x4dbd6a[_0xa91f('0xe5')]);if(!_0x5646e9){return this[_0xa91f('0x38')]['error'](_0x4dbd6a,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x4dbd6a[_0xa91f('0x31')])){return this['channel'][_0xa91f('0x2e')](_0x4dbd6a,_0xa91f('0xe6'));}var _0x58ea2e=_0x4dbd6a['query'][_0xa91f('0x6e')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa91f('0x38')]['noop'](util['format'](_0xa91f('0xe7'),_0x58ea2e));var _0x3b34e5=this[_0xa91f('0x2c')][_0xa91f('0x86')](this,_0x5646e9,_0x58ea2e);this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x4dbd6a,_0x58ea2e);if(!this[_0xa91f('0x96')](_0x4dbd6a[_0xa91f('0xe8')])){return this['channel'][_0xa91f('0xb9')](_0xa91f('0xe9'));}var _0x2c2fae=this[_0xa91f('0x12')][_0xa91f('0x86')](this,_0x4dbd6a[_0xa91f('0xe8')]);if(!_0x2c2fae){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x4dbd6a,_0xa91f('0xea'));}var _0x278dc6=this;_0x3b34e5[_0xa91f('0xeb')](function(_0xac9acd,_0x27a743){Object[_0xa91f('0xec')](_0xac9acd)[_0xa91f('0xeb')](function(_0x21332e){_0x278dc6[_0xa91f('0x38')]['setVariable'](util[_0xa91f('0x2a')]('%s[%s][%s]',_0x2c2fae,_0x27a743,_0x21332e),_0xac9acd[_0x21332e]);});});this[_0xa91f('0x38')][_0xa91f('0xb0')](util['format'](_0xa91f('0xed'),_0x2c2fae),_0x3b34e5[_0xa91f('0xac')]);return this['channel'][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0xee'),_0x2c2fae));};AGIVertices['prototype']['dial']=function(_0x2a7eed){logger[_0xa91f('0xef')](util[_0xa91f('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2a7eed['label']));if(!this[_0xa91f('0x96')](_0x2a7eed[_0xa91f('0xf0')])){return this['channel'][_0xa91f('0x2e')](_0x2a7eed,'no\x20user\x20selected');}var _0x1c4173=this[_0xa91f('0x1e')]['sync'](this,_0x2a7eed[_0xa91f('0xf0')]);if(!_0x1c4173){return this[_0xa91f('0x38')]['error'](_0x2a7eed,_0xa91f('0xf1'));}var _0x302c1d=this['channel']['exec'](_0xa91f('0xf2'),[util[_0xa91f('0x2a')]('SIP/%s',_0x1c4173),_0x2a7eed[_0xa91f('0x7b')],_0x2a7eed[_0xa91f('0xf3')],_0x2a7eed['url']]);if(_0x302c1d[_0xa91f('0xbc')]===-0x1){return _0x302c1d;}return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0xf4'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x4c4d0a){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0xf5'),_0x4c4d0a['label']));if(!this[_0xa91f('0x96')](_0x4c4d0a[_0xa91f('0x90')])){return this[_0xa91f('0x38')][_0xa91f('0xb9')]('no\x20key\x20configured');}if(!this[_0xa91f('0x96')](_0x4c4d0a[_0xa91f('0x71')])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0xba'));}this[_0xa91f('0x38')][_0xa91f('0xf6')]=!![];this[_0xa91f('0x37')](_0x4c4d0a);this['createSquareMessage'](_0x4c4d0a[_0xa91f('0x71')],'in');this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')]('Trying\x20Dialogflow:\x20%s',_0x4c4d0a[_0xa91f('0x71')]));var _0x275b42=this[_0xa91f('0x8f')][_0xa91f('0x86')](this,_0x4c4d0a);if(_0x275b42){for(var _0xad2971 in _0x275b42){if(_0x275b42[_0xa91f('0xa6')](_0xad2971)){this[_0xa91f('0x38')][_0xa91f('0xb0')](util['format'](_0xa91f('0xf7'),_0xad2971['toUpperCase']()),_0x275b42[_0xad2971]);}}this[_0xa91f('0x43')](_0x275b42[_0xa91f('0xf8')],_0xa91f('0xf9'));return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0xfa'),_0x275b42['speech']));}return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x4c4d0a,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xa91f('0x11')]['sesteknda']=function(_0x7a03c8){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0xfb'),_0x7a03c8[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x7a03c8[_0xa91f('0xfc')])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0xfd'));}if(!this[_0xa91f('0x96')](_0x7a03c8[_0xa91f('0xfe')])){return this['channel'][_0xa91f('0xb9')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x7a03c8[_0xa91f('0xff')])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0x100'));}if(!this['isConfigured'](_0x7a03c8[_0xa91f('0x101')])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0xba'));}this[_0xa91f('0x38')][_0xa91f('0xf6')]=!![];this[_0xa91f('0x37')](_0x7a03c8);this[_0xa91f('0x43')](_0x7a03c8['text'],'in');this['channel'][_0xa91f('0xb9')](util['format'](_0xa91f('0x102'),_0x7a03c8[_0xa91f('0x71')]));var _0x1bbc0f=this['sestekNDA'][_0xa91f('0x86')](this,_0x7a03c8);if(_0x1bbc0f){for(var _0x563003 in _0x1bbc0f){if(_0x1bbc0f[_0xa91f('0xa6')](_0x563003)){this['channel']['setVariable'](util[_0xa91f('0x2a')](_0xa91f('0x103'),_0x563003['toUpperCase']()),_0x1bbc0f[_0x563003]);}}this[_0xa91f('0x43')](_0x1bbc0f[_0xa91f('0xf8')],_0xa91f('0xf9'));if(_0x1bbc0f['audiofile']){this['channel']['noop'](util[_0xa91f('0x2a')](_0xa91f('0x104'),_0x1bbc0f['audiofile']));var _0xb5b8b2=this[_0xa91f('0x38')][_0xa91f('0x105')](_0x1bbc0f[_0xa91f('0x106')]);try{fs[_0xa91f('0x107')](_0x1bbc0f[_0xa91f('0x106')]+_0xa91f('0x108'));}catch(_0x4eb986){logger[_0xa91f('0x2e')](_0x4eb986);}return _0xb5b8b2;}else{return this[_0xa91f('0x38')][_0xa91f('0xb9')](util['format']('SestekNDA\x20Result\x20%s',_0x1bbc0f[_0xa91f('0xf8')]));}}return this['channel'][_0xa91f('0x2e')](_0x7a03c8,_0xa91f('0x109'));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x10a')]=function(_0x507522){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x10b'),_0x507522[_0xa91f('0xb8')]));return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0x10a'));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x10c')]=function(_0x1c283e){logger[_0xa91f('0x30')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x1c283e['label']));var _0x5ef66e='';if(_0x1c283e[_0xa91f('0x10d')]){if(!this[_0xa91f('0x96')](_0x1c283e[_0xa91f('0x10d')])){return this[_0xa91f('0x38')]['error'](_0x1c283e,_0xa91f('0x10e'));}else{var _0x17752e=parseInt(_0x1c283e[_0xa91f('0x10d')],0xa);if(isNaN(_0x17752e)){_0x5ef66e=_0x1c283e['trunk_id'];}else{_0x5ef66e=this[_0xa91f('0x1f')][_0xa91f('0x86')](this,_0x1c283e[_0xa91f('0x10d')]);if(!_0x5ef66e){return this['channel'][_0xa91f('0x2e')](_0x1c283e,'no\x20trunk\x20found');}}}}else if(_0x1c283e[_0xa91f('0x10f')]){_0x5ef66e=_0x1c283e[_0xa91f('0x10f')];}else{return this[_0xa91f('0x38')]['error'](_0x1c283e,_0xa91f('0x10e'));}var _0x52c177=this['channel'][_0xa91f('0x6c')]('DIAL',[util[_0xa91f('0x2a')]('SIP/%s/%s',_0x5ef66e,_0x1c283e[_0xa91f('0x58')]),_0x1c283e[_0xa91f('0x7b')],_0x1c283e['opts'],_0x1c283e[_0xa91f('0x110')]]);if(_0x52c177[_0xa91f('0xbc')]===-0x1){return _0x52c177;}return this[_0xa91f('0x38')]['noop'](util[_0xa91f('0x2a')]('Executed\x20command\x20%s',_0xa91f('0xf2')));};AGIVertices['prototype'][_0xa91f('0x111')]=function(_0x3a89ea){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x112'),_0x3a89ea['label']));return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0x111'));};AGIVertices['prototype'][_0xa91f('0xe')]=function(_0x7fccd8){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x113'),_0x7fccd8['label']));if(_0x7fccd8['retry']===0x0){return this[_0xa91f('0xb6')](_0x7fccd8);}_0x7fccd8[_0xa91f('0xb7')]-=0x1;if(!this['isConfigured'](_0x7fccd8[_0xa91f('0x114')])){return this[_0xa91f('0x38')]['error'](_0x7fccd8,_0xa91f('0x115'));}var _0x52153f=this[_0xa91f('0x21')][_0xa91f('0x86')](this,_0x7fccd8[_0xa91f('0x114')]);if(!_0x52153f){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x7fccd8,_0xa91f('0x116'));}if(!this[_0xa91f('0x96')](_0x7fccd8[_0xa91f('0xe8')])){return this[_0xa91f('0x38')][_0xa91f('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x153cf4=this['channel'][_0xa91f('0x117')](_0x52153f,_0x7fccd8[_0xa91f('0x118')],_0x7fccd8[_0xa91f('0x119')]);var _0x2a1fd2=_0x153cf4['result']?_0x153cf4[_0xa91f('0xbc')]['toString']():'';logger[_0xa91f('0x30')](_0xa91f('0x11a'),JSON[_0xa91f('0x88')](_0x153cf4));if(_0x153cf4[_0xa91f('0xbc')]===-0x1){this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x7fccd8,_0x2a1fd2);return _0x153cf4;}else if(_0x153cf4[_0xa91f('0xb3')]===_0xa91f('0x7b')){_0x153cf4[_0xa91f('0xbc')]=_0x2a1fd2[_0xa91f('0xac')]>=parseInt(_0x7fccd8[_0xa91f('0x11b')])?'x':'i';}else{_0x153cf4['result']=_0x2a1fd2['length']>=parseInt(_0x7fccd8[_0xa91f('0x11b')])&&_0x2a1fd2[_0xa91f('0xac')]<=parseInt(_0x7fccd8[_0xa91f('0x119')])?'x':'i';}var _0x217f10=this['getVariable']['sync'](this,_0x7fccd8[_0xa91f('0xe8')]);if(!_0x217f10){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x7fccd8,_0xa91f('0xea'));}this[_0xa91f('0x38')][_0xa91f('0xb0')](_0x217f10,_0x2a1fd2);if(this['isConfigured'](_0x7fccd8[_0xa91f('0x11c')])){var _0x355dae=parseInt(_0x7fccd8[_0xa91f('0x11c')],0xa);var _0x4e1e3a=rs[_0xa91f('0x11d')]({'charset':'*','length':_0x355dae});var _0xea14ba=_0x2a1fd2[_0xa91f('0xac')];if(_0xea14ba>0x0){if(_0xea14ba>_0x355dae){this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x7fccd8,_0x7fccd8[_0xa91f('0x11e')]==='first'?_0x4e1e3a+_0x2a1fd2['substr'](_0x355dae):_0x2a1fd2[_0xa91f('0x11f')](0x0,_0xea14ba-_0x355dae)+_0x4e1e3a);}else{this['createSquareDetailsReport'][_0xa91f('0x86')](this,_0x7fccd8,rs[_0xa91f('0x11d')]({'charset':'*','length':_0xea14ba}));}}else{this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x7fccd8,'');}}else{this['createSquareDetailsReport'][_0xa91f('0x86')](this,_0x7fccd8,_0x2a1fd2);}return _0x153cf4;};AGIVertices[_0xa91f('0x11')]['getsecretdigits']=function(_0x1d85f8){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x120'),_0x1d85f8[_0xa91f('0xb8')]));return this[_0xa91f('0xe')](_0x1d85f8);};AGIVertices[_0xa91f('0x11')][_0xa91f('0x121')]=function(_0x524e83){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x122'),_0x524e83[_0xa91f('0xb8')]));this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x524e83,_0x524e83[_0xa91f('0x123')]);return this['channel']['noop'](util[_0xa91f('0x2a')](_0xa91f('0x124'),_0x524e83[_0xa91f('0x123')]));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x125')]=function(_0x227ae4){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x126'),_0x227ae4[_0xa91f('0xb8')]));if(!this['isConfigured'](_0x227ae4[_0xa91f('0x99')])||!this[_0xa91f('0x96')](_0x227ae4[_0xa91f('0x9f')])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xa91f('0x96')](_0x227ae4['text'])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0xba'));}this[_0xa91f('0x38')]['noop'](util[_0xa91f('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0x227ae4[_0xa91f('0x71')]));var _0x1a180e=this['awsPolly'][_0xa91f('0x86')](this,_0x227ae4);if(_0x1a180e){this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x127'),_0x1a180e));var _0x380cda=this[_0xa91f('0x38')][_0xa91f('0x105')](_0x1a180e);try{fs[_0xa91f('0x107')](_0x1a180e+_0xa91f('0x108'));}catch(_0x5e8852){logger['error'](_0x5e8852);}return _0x380cda;}return this['channel'][_0xa91f('0x2e')](_0x227ae4,_0xa91f('0x128'));};AGIVertices['prototype'][_0xa91f('0x129')]=function(_0x161de7){logger['info'](util[_0xa91f('0x2a')](_0xa91f('0x12a'),_0x161de7[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x161de7['aws_access_key_id'])||!this['isConfigured'](_0x161de7['aws_secret_access_key'])){return this[_0xa91f('0x38')][_0xa91f('0xb9')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xa91f('0x96')](_0x161de7['aws_bot_name'])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0x12b'));}if(!this['isConfigured'](_0x161de7[_0xa91f('0x71')])){return this['channel'][_0xa91f('0xb9')]('no\x20text\x20configured');}this[_0xa91f('0x38')]['bot']=!![];this[_0xa91f('0x37')](_0x161de7);this[_0xa91f('0x43')](_0x161de7[_0xa91f('0x71')],'in');this[_0xa91f('0x38')][_0xa91f('0xb9')](util['format'](_0xa91f('0x12c'),_0x161de7[_0xa91f('0x71')]));var _0x53bbc4=this[_0xa91f('0x9e')][_0xa91f('0x86')](this,_0x161de7);if(_0x53bbc4){for(var _0x50659d in _0x53bbc4){if(_0x53bbc4[_0xa91f('0xa6')](_0x50659d)&&_[_0xa91f('0xad')](_0x53bbc4[_0x50659d])){this[_0xa91f('0x38')][_0xa91f('0xb0')](util[_0xa91f('0x2a')]('AWS_LEX_%s',_0x50659d['toUpperCase']()),_0x53bbc4[_0x50659d]);}}if(_[_0xa91f('0x48')](_0x53bbc4[_0xa91f('0x8d')])){return this['channel']['noop'](_0xa91f('0x12d'));}else{this['createSquareMessage'](_0x53bbc4['message'],_0xa91f('0xf9'));return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x12e'),_0x53bbc4[_0xa91f('0x8d')]));}}return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x161de7,_0xa91f('0x12f'));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x130')]=function(_0x1276e9){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x131'),_0x1276e9[_0xa91f('0xb8')],_0x1276e9[_0xa91f('0x7b')]));if(!this[_0xa91f('0x96')](_0x1276e9[_0xa91f('0x90')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x18efbd='wav';var _0x5c2642=util['format'](_0xa91f('0x132'),FILES_PATH,rs[_0xa91f('0x11d')](0x4));var _0xab358b=util['format'](_0xa91f('0xaf'),_0x5c2642,_0x18efbd);var _0x55683e=!![];if(_0x1276e9[_0xa91f('0x133')]==='NOBEEP'){_0x55683e=![];}var _0x4d74e6=this[_0xa91f('0x38')][_0xa91f('0x134')](_0x5c2642,_0x18efbd,_0x1276e9['intKey'],_0x1276e9[_0xa91f('0x7b')],undefined,_0x55683e);if(_0x4d74e6[_0xa91f('0xbc')]!==-0x1){this[_0xa91f('0x38')]['noop'](util[_0xa91f('0x2a')]('google\x20%s\x20file\x20created',_0xab358b));var _0x50dd24=this[_0xa91f('0xa2')][_0xa91f('0x86')](this,_0x1276e9,_0xab358b);if(_0x50dd24){for(var _0x4fd228 in _0x50dd24){if(_0x50dd24[_0xa91f('0xa6')](_0x4fd228)){this['channel'][_0xa91f('0xb0')](util['format'](_0xa91f('0x135'),_0x4fd228[_0xa91f('0x80')]()),_0x50dd24[_0x4fd228]);}}return this[_0xa91f('0x38')]['noop'](util['format'](_0xa91f('0x136'),JSON[_0xa91f('0x88')](_0x50dd24)));}}return _0x4d74e6;};AGIVertices['prototype'][_0xa91f('0x137')]=function(_0x5e0883){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x138'),_0x5e0883['label']));if(!this[_0xa91f('0x96')](_0x5e0883[_0xa91f('0x139')])){return this[_0xa91f('0x38')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x5e0883['appsecret'])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0x13a'));}var _0x3a3ee9=_0xa91f('0x13b');var _0x5f5676=util[_0xa91f('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x3b67b5=util[_0xa91f('0x2a')](_0xa91f('0xaf'),_0x5f5676,_0x3a3ee9);var _0x32422d=!![];if(_0x5e0883[_0xa91f('0x133')]===_0xa91f('0x13c')){_0x32422d=![];}var _0xfa27f3=this[_0xa91f('0x38')]['recordFile'](_0x5f5676,_0x3a3ee9,_0x5e0883['intKey'],_0x5e0883[_0xa91f('0x7b')],undefined,_0x32422d);if(_0xfa27f3[_0xa91f('0xbc')]!==-0x1){this['channel'][_0xa91f('0xb9')](util[_0xa91f('0x2a')]('tilde\x20%s\x20file\x20created',_0x3b67b5));var _0x4a8363=this[_0xa91f('0xa3')][_0xa91f('0x86')](this,_0x5e0883,_0x3b67b5);if(_0x4a8363){for(var _0x3e75f0 in _0x4a8363){if(_0x4a8363[_0xa91f('0xa6')](_0x3e75f0)){this[_0xa91f('0x38')]['setVariable'](util['format'](_0xa91f('0x13d'),_0x3e75f0[_0xa91f('0x80')]()),_0x4a8363[_0x3e75f0]);}}return this['channel'][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x13e'),JSON[_0xa91f('0x88')](_0x4a8363)));}}return _0xfa27f3;};AGIVertices[_0xa91f('0x11')][_0xa91f('0x13f')]=function(_0x4446c5){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x140'),_0x4446c5['label']));return this['channel'][_0xa91f('0x141')](_0x4446c5[_0xa91f('0x3e')],_0x4446c5[_0xa91f('0x3f')],_0x4446c5['priority']);};AGIVertices[_0xa91f('0x11')][_0xa91f('0x142')]=function(_0x3d7f28){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x143'),_0x3d7f28[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x3d7f28[_0xa91f('0x144')])){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x3d7f28,_0xa91f('0x145'));}try{var _0x2644a2=eval(_0x3d7f28[_0xa91f('0x144')])?_0xa91f('0x146'):_0xa91f('0x147');this['channel'][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x148'),_0x3d7f28[_0xa91f('0x144')],_0x2644a2));return{'code':0xc8,'result':_0x2644a2};}catch(_0x3bcdc1){return{'code':0xc8,'result':_0xa91f('0x147')};}};AGIVertices[_0xa91f('0x11')][_0xa91f('0x149')]=function(_0x58533d){logger['info'](util['format'](_0xa91f('0x14a'),_0x58533d[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x58533d[_0xa91f('0x14b')])){return this[_0xa91f('0x38')]['error'](_0x58533d,_0xa91f('0x14c'));}var _0x3e1fb7=this[_0xa91f('0x26')][_0xa91f('0x86')](this,_0x58533d[_0xa91f('0x14b')]);if(!_0x3e1fb7){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x58533d,'no\x20intervals\x20found');}for(var _0x50b5cd=0x0;_0x50b5cd<_0x3e1fb7[_0xa91f('0xac')];_0x50b5cd+=0x1){var _0x358aee=this[_0xa91f('0x38')][_0xa91f('0x12')](util[_0xa91f('0x2a')](_0xa91f('0x14d'),_0x3e1fb7[_0x50b5cd]));if(_0x358aee[_0xa91f('0xbc')]===-0x1){return _0x358aee;}logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x14e'),_0x3e1fb7[_0x50b5cd],_0x358aee['extra']));if(_0x358aee[_0xa91f('0xb3')]===_0xa91f('0x146')){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x14e'),_0x3e1fb7[_0x50b5cd],'true'));this[_0xa91f('0x38')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x3e1fb7[_0x50b5cd],_0xa91f('0x146')));return{'code':0xc8,'result':'true'};}else{logger[_0xa91f('0x30')](util['format'](_0xa91f('0x14e'),_0x3e1fb7[_0x50b5cd],_0xa91f('0x147')));this['channel'][_0xa91f('0xb9')](util['format']('IFTIME\x20%s\x20%s',_0x3e1fb7[_0x50b5cd],_0xa91f('0x147')));}}return{'code':0xc8,'result':_0xa91f('0x147')};};AGIVertices[_0xa91f('0x11')][_0xa91f('0x14f')]=function(_0x4df3b1){logger['info'](util[_0xa91f('0x2a')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x4df3b1[_0xa91f('0xb8')]));return this[_0xa91f('0x38')][_0xa91f('0x14f')]();};AGIVertices['prototype']['ispeechasr']=function(_0x5ce639){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x150'),_0x5ce639[_0xa91f('0xb8')]));if(!this['isConfigured'](_0x5ce639[_0xa91f('0x90')])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0x151'));}var _0x597659='wav';var _0x2120c5=util[_0xa91f('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x41fd84=util[_0xa91f('0x2a')](_0xa91f('0xaf'),_0x2120c5,_0x597659);var _0x5ae79b=!![];if(_0x5ce639[_0xa91f('0x133')]==='NOBEEP'){_0x5ae79b=![];}var _0x5abde3=this[_0xa91f('0x38')][_0xa91f('0x134')](_0x2120c5,_0x597659,_0x5ce639[_0xa91f('0x152')],_0x5ce639[_0xa91f('0x7b')],undefined,_0x5ae79b);if(_0x5abde3[_0xa91f('0xbc')]!==-0x1){this['channel'][_0xa91f('0xb9')](util['format'](_0xa91f('0x153'),_0x41fd84));var _0x52e974=this[_0xa91f('0x95')][_0xa91f('0x86')](this,_0x5ce639,_0x41fd84);if(_0x52e974){for(var _0x212c19 in _0x52e974){if(_0x52e974[_0xa91f('0xa6')](_0x212c19)){this[_0xa91f('0x38')][_0xa91f('0xb0')](util['format'](_0xa91f('0x154'),_0x212c19[_0xa91f('0x80')]()),_0x52e974[_0x212c19]);}}return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x155'),JSON['stringify'](_0x52e974)));}}return _0x5abde3;};AGIVertices[_0xa91f('0x11')][_0xa91f('0x156')]=function(_0x3f3175){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x157'),_0x3f3175['label']));if(!this['isConfigured'](_0x3f3175[_0xa91f('0x90')])){return this[_0xa91f('0x38')]['noop'](_0xa91f('0x151'));}if(!this[_0xa91f('0x96')](_0x3f3175[_0xa91f('0x71')])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0xba'));}this[_0xa91f('0x38')]['noop'](util[_0xa91f('0x2a')](_0xa91f('0x158'),_0x3f3175[_0xa91f('0x71')]));var _0x313e7f=this[_0xa91f('0x92')]['sync'](this,_0x3f3175);if(_0x313e7f){this[_0xa91f('0x38')]['noop'](util[_0xa91f('0x2a')](_0xa91f('0x153'),_0x313e7f));var _0x20b71f=this[_0xa91f('0x38')][_0xa91f('0x105')](_0x313e7f,_0x3f3175[_0xa91f('0x152')]);try{fs[_0xa91f('0x107')](_0x313e7f+_0xa91f('0x108'));}catch(_0x593cb8){logger[_0xa91f('0x2e')](_0x593cb8);}return _0x20b71f;}return this['channel'][_0xa91f('0x2e')](_0x3f3175,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xa91f('0x159')]=function(_0x254a30){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x15a'),_0x254a30[_0xa91f('0xb8')]));if(!this['isConfigured'](_0x254a30[_0xa91f('0x15b')])){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x254a30,_0xa91f('0x15c'));}logger['info'](util[_0xa91f('0x2a')](_0xa91f('0x15d'),this[_0xa91f('0x38')]['callerid'],_0x254a30[_0xa91f('0x15b')]));var _0xfd66d1=this['agentLogin'][_0xa91f('0x86')](this,_0x254a30[_0xa91f('0x15b')]);if(_0xfd66d1){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x15e'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x254a30[_0xa91f('0x15b')]));this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x15e'),this[_0xa91f('0x38')]['callerid'],_0x254a30[_0xa91f('0x15b')]));return{'code':0xc8,'result':_0xa91f('0x15f')};}else{logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x160'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x254a30[_0xa91f('0x15b')]));this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x160'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x254a30[_0xa91f('0x15b')]));return{'code':0xc8,'result':_0xa91f('0x161')};}};AGIVertices['prototype'][_0xa91f('0x162')]=function(_0x103888){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x163'),_0x103888['label']));if(!this[_0xa91f('0x96')](_0x103888[_0xa91f('0x15b')])){return this['channel'][_0xa91f('0x2e')](_0x103888,_0xa91f('0x15c'));}logger[_0xa91f('0x30')](util['format'](_0xa91f('0x15d'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x103888[_0xa91f('0x15b')]));var _0x2fe2d3=this['agentLogout']['sync'](this,_0x103888['findBy']);if(_0x2fe2d3){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x103888[_0xa91f('0x15b')]));this['channel'][_0xa91f('0xb9')](util[_0xa91f('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xa91f('0x3b')],_0x103888[_0xa91f('0x15b')]));return{'code':0xc8,'result':_0xa91f('0x15f')};}else{logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x160'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x103888[_0xa91f('0x15b')]));this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa91f('0x38')]['callerid'],_0x103888[_0xa91f('0x15b')]));return{'code':0xc8,'result':_0xa91f('0x161')};}};AGIVertices[_0xa91f('0x11')][_0xa91f('0x164')]=function(_0x1d3a31){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x1d3a31['label']));if(!this[_0xa91f('0x96')](_0x1d3a31[_0xa91f('0x165')])){return this['channel']['error'](_0x1d3a31,'no\x20operation\x20configured');}this['channel']['noop'](util[_0xa91f('0x2a')]('math\x20%s',_0x1d3a31[_0xa91f('0x165')]));var _0xe679f=eval(_0x1d3a31['operation']);if(!this['isConfigured'](_0x1d3a31[_0xa91f('0xe8')])){return this['channel'][_0xa91f('0xb9')](_0xa91f('0xe9'));}var _0x5d3fea=this['getVariable'][_0xa91f('0x86')](this,_0x1d3a31[_0xa91f('0xe8')]);if(!_0x5d3fea){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x1d3a31,_0xa91f('0xea'));}if(_['isArray'](_0xe679f)){var _0x2d746a=this;_0xe679f[_0xa91f('0xeb')](function(_0x4de60e,_0x5049c8){_0x2d746a[_0xa91f('0x38')][_0xa91f('0xb0')](util[_0xa91f('0x2a')](_0xa91f('0x166'),_0x5d3fea,_0x5049c8),_0x4de60e);});return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x167'),_0x5d3fea));}else{return this['channel'][_0xa91f('0xb0')](_0x5d3fea,_0xe679f);}};AGIVertices[_0xa91f('0x11')]['menu']=function(_0x31fe83){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x168'),_0x31fe83[_0xa91f('0xb8')]));if(_0x31fe83['retry']===0x0){return this[_0xa91f('0xb6')](_0x31fe83);}_0x31fe83[_0xa91f('0xb7')]-=0x1;if(!this[_0xa91f('0x96')](_0x31fe83[_0xa91f('0x114')])){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x31fe83,'no\x20file\x20audio\x20selected');}var _0x5e0b72=this[_0xa91f('0x21')]['sync'](this,_0x31fe83[_0xa91f('0x114')]);if(!_0x5e0b72){return this[_0xa91f('0x38')]['error'](_0x31fe83,_0xa91f('0x116'));}var _0x28a2a0=this['channel'][_0xa91f('0x117')](_0x5e0b72,_0x31fe83[_0xa91f('0x118')],_0x31fe83[_0xa91f('0x169')]);var _0x3117cc=_0x28a2a0[_0xa91f('0xbc')];if(_0x28a2a0['result']===-0x1){this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x31fe83,'-1');return _0x28a2a0;}else if(_0x28a2a0[_0xa91f('0xb3')]==='timeout'){_0x28a2a0[_0xa91f('0xbc')]=_0x28a2a0[_0xa91f('0xbc')][_0xa91f('0xac')]>0x0?_0x28a2a0[_0xa91f('0xbc')]:'t';}else if(_[_0xa91f('0x47')](_0x28a2a0[_0xa91f('0xbc')])){_0x28a2a0[_0xa91f('0xbc')]='#';_0x3117cc='#';}if(!this[_0xa91f('0x96')](_0x31fe83[_0xa91f('0xe8')])){this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0xe9'));}else{var _0x34e605=this[_0xa91f('0x12')][_0xa91f('0x86')](this,_0x31fe83['variable_id']);if(!_0x34e605){return this[_0xa91f('0x38')]['error'](_0x31fe83,_0xa91f('0xea'));}this[_0xa91f('0x38')]['setVariable'](_0x34e605,_0x3117cc);}this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x31fe83,_0x3117cc);return _0x28a2a0;};AGIVertices[_0xa91f('0x11')][_0xa91f('0xb9')]=function(_0x3b539e){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x16a'),_0x3b539e[_0xa91f('0xb8')]));return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0x3b539e[_0xa91f('0x16b')]||_0x3b539e['label']);};AGIVertices['prototype'][_0xa91f('0x16c')]=function(_0x2f6a86){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x16d'),_0x2f6a86[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x2f6a86[_0xa91f('0x15b')])){return this['channel'][_0xa91f('0x2e')](_0x2f6a86,'no\x20find\x20by\x20configured');}logger['info'](util[_0xa91f('0x2a')](_0xa91f('0x15d'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x2f6a86[_0xa91f('0x15b')]));var _0x49aedb=this[_0xa91f('0x62')][_0xa91f('0x86')](this,_0x2f6a86[_0xa91f('0x16e')]);var _0x4d339a=this['agentPause'][_0xa91f('0x86')](this,_0x2f6a86[_0xa91f('0x15b')],_0x49aedb);if(_0x4d339a){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa91f('0x38')]['callerid'],_0x2f6a86['findBy']));this['channel']['noop'](util[_0xa91f('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa91f('0x38')]['callerid'],_0x2f6a86[_0xa91f('0x15b')]));return{'code':0xc8,'result':_0xa91f('0x15f')};}else{logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x160'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x2f6a86['findBy']));this[_0xa91f('0x38')]['noop'](util[_0xa91f('0x2a')](_0xa91f('0x15e'),this['channel'][_0xa91f('0x3b')],_0x2f6a86[_0xa91f('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xa91f('0x16f')]=function(_0x367199){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x367199[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x367199['file_id'])){return this[_0xa91f('0x38')]['error'](_0x367199,'no\x20file\x20audio\x20selected');}var _0x434352=this[_0xa91f('0x21')][_0xa91f('0x86')](this,_0x367199[_0xa91f('0x114')]);if(!_0x434352){return this[_0xa91f('0x38')]['error'](_0x367199,_0xa91f('0x116'));}var _0x3aef29=this['channel'][_0xa91f('0x6c')]('PLAYBACK',[_0x434352,_0x367199[_0xa91f('0xf3')]]);if(_0x3aef29[_0xa91f('0xbc')]===-0x1){return _0x3aef29;}return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0xd6'),_0xa91f('0x170'),_0x434352));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x171')]=function(_0x5f4f93){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x172'),_0x5f4f93[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x5f4f93[_0xa91f('0x173')])){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x5f4f93,'no\x20queue\x20selected');}var _0x15983c='';var _0xd10bf9=parseInt(_0x5f4f93[_0xa91f('0x173')],0xa);if(isNaN(_0xd10bf9)){_0x15983c=_0x5f4f93[_0xa91f('0x173')];}else{_0x15983c=this['getVoiceQueue']['sync'](this,_0x5f4f93[_0xa91f('0x173')]);if(!_0x15983c){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x5f4f93,'no\x20queue\x20found');}}var _0x4a8eb4='';if(this[_0xa91f('0x96')](_0x5f4f93[_0xa91f('0x114')])){var _0x3c297b=this['getSound']['sync'](this,_0x5f4f93[_0xa91f('0x114')]);if(_0x3c297b){_0x4a8eb4=_0x3c297b;}}this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x5f4f93,_0x15983c);if(_0x5f4f93[_0xa91f('0xf3')][_0xa91f('0x174')]('x')<0x0){_0x5f4f93[_0xa91f('0xf3')]+='x';}if(_0x5f4f93[_0xa91f('0xf3')][_0xa91f('0x174')]('X')<0x0){_0x5f4f93['opts']+='X';}this[_0xa91f('0x38')][_0xa91f('0xb0')](_0xa91f('0x175'),_0x15983c?_0x15983c['toLowerCase']():'');var _0x2aa75c=this[_0xa91f('0x38')][_0xa91f('0x6c')](_0xa91f('0x176'),[_0x15983c,_0x5f4f93[_0xa91f('0xf3')],_0x5f4f93[_0xa91f('0x110')],_0x4a8eb4,_0x5f4f93[_0xa91f('0x7b')],_0x5f4f93['agi'],_0x5f4f93[_0xa91f('0x177')],_0x5f4f93[_0xa91f('0x178')],'',_0x5f4f93['position']]);if(_0x2aa75c['result']===-0x1){return _0x2aa75c;}return this['channel']['noop'](util[_0xa91f('0x2a')](_0xa91f('0xd6'),_0xa91f('0x176'),_0x15983c));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x179')]=function(_0x3f7ab6){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x17a'),_0x3f7ab6[_0xa91f('0xb8')]));var _0x5730b0=_0x3f7ab6[_0xa91f('0x17b')]||_0xa91f('0x13b');var _0x4c45e3=util['format']('%s_%s',this[_0xa91f('0x38')][_0xa91f('0x4d')],rs['generate'](0x5));var _0x5688aa=util[_0xa91f('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x4c45e3,_0x5730b0);var _0x241226=util['format'](_0xa91f('0x132'),FILES_PATH,_0x4c45e3);this[_0xa91f('0x3c')][_0xa91f('0x86')](this,_0x3f7ab6,_0x4c45e3,_0x5688aa);this[_0xa91f('0x38')]['setVariable']('RECORDING_SAVENAME',_0x4c45e3);logger[_0xa91f('0x30')](_0xa91f('0x17c'),_0x241226,_0x5730b0,_0x3f7ab6['escape_digits'],_0x3f7ab6[_0xa91f('0x7b')]);return this[_0xa91f('0x38')][_0xa91f('0x134')](_0x241226,_0x5730b0,_0x3f7ab6[_0xa91f('0x17d')],_0x3f7ab6[_0xa91f('0x7b')],undefined,!![]);};AGIVertices[_0xa91f('0x11')]['restapi']=function(_0x5151f0){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x17e'),_0x5151f0['label']));if(!this[_0xa91f('0x96')](_0x5151f0['url'])){return this[_0xa91f('0x38')][_0xa91f('0xb9')]('no\x20url\x20configured');}var _0x1aad69=this[_0xa91f('0x79')][_0xa91f('0x86')](this,_0x5151f0);logger['info'](util[_0xa91f('0x2a')]('Response:',util[_0xa91f('0x17f')](_0x1aad69,{'showHidden':![],'depth':null})));if(!this[_0xa91f('0x96')](_0x5151f0['variable_id'])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0x180'));}var _0x44be9c=this[_0xa91f('0x12')][_0xa91f('0x86')](this,_0x5151f0[_0xa91f('0xe8')]);if(!_0x44be9c){return this['channel'][_0xa91f('0x2e')](_0x5151f0,_0xa91f('0xea'));}this[_0xa91f('0x38')][_0xa91f('0xb0')](util[_0xa91f('0x2a')](_0xa91f('0x181'),_0x44be9c),_0x1aad69[_0xa91f('0x8b')]?_0x1aad69[_0xa91f('0x8b')]:_0xa91f('0x182'));this[_0xa91f('0x38')][_0xa91f('0xb0')](util[_0xa91f('0x2a')]('%s_STATUS_MESSAGE',_0x44be9c),_0x1aad69[_0xa91f('0x8c')]?_0x1aad69[_0xa91f('0x8c')]:'OK');if(_0x1aad69[_0xa91f('0x89')]){try{this[_0xa91f('0xae')](_0x1aad69[_0xa91f('0x89')],_0x44be9c);}catch(_0x395c1d){logger[_0xa91f('0x2e')](util['format'](_0xa91f('0x183'),_0x44be9c));}}return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0xee'),_0x44be9c));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x184')]=function(_0x15e352){logger['info'](util[_0xa91f('0x2a')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x15e352[_0xa91f('0xb8')]));return this[_0xa91f('0x38')][_0xa91f('0x185')](_0x15e352[_0xa91f('0x186')]['replace'](/\s+/g,''),_0x15e352[_0xa91f('0x17d')]);};AGIVertices[_0xa91f('0x11')][_0xa91f('0x187')]=function(_0x3feca9){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x188'),_0x3feca9[_0xa91f('0xb8')]));return this[_0xa91f('0x38')][_0xa91f('0x189')](_0x3feca9['number'][_0xa91f('0x6e')](/\s+/g,''),_0x3feca9[_0xa91f('0x17d')]);};AGIVertices['prototype'][_0xa91f('0x18a')]=function(_0x16062f){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x18b'),_0x16062f[_0xa91f('0xb8')]));return this[_0xa91f('0x38')][_0xa91f('0x18c')](_0x16062f['text'],_0x16062f['escape_digits']);};AGIVertices['prototype'][_0xa91f('0x18d')]=function(_0x590fd2){logger[_0xa91f('0x30')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x590fd2['label']));if(!this['isConfigured'](_0x590fd2[_0xa91f('0x18e')])){return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0x18f'));}var _0xac2d35=this[_0xa91f('0x190')]['sync'](this,_0x590fd2[_0xa91f('0x18e')]);if(!_0xac2d35||!_0xac2d35['Smtp']){return this['channel']['error'](_0x590fd2,_0xa91f('0x191'));}var _0x50d1e8={'from':util[_0xa91f('0x2a')](_0xa91f('0x192'),_0xac2d35[_0xa91f('0x16')],_0xac2d35[_0xa91f('0x193')]||_0xac2d35[_0xa91f('0x194')][_0xa91f('0x195')]),'to':_0x590fd2['to']||'','cc':_0x590fd2['cc']||'','bcc':_0x590fd2[_0xa91f('0x196')]||'','subject':_0x590fd2[_0xa91f('0x197')],'html':_0x590fd2['text'],'text':_0x590fd2[_0xa91f('0x71')]};var _0x195603={'tls':{'rejectUnauthorized':![]}};if(_0xac2d35[_0xa91f('0x194')][_0xa91f('0x198')]){_0x195603[_0xa91f('0x198')]=_0xac2d35['Smtp'][_0xa91f('0x198')];}else{_0x195603[_0xa91f('0x199')]=_0xac2d35[_0xa91f('0x194')][_0xa91f('0x199')];_0x195603[_0xa91f('0x19a')]=_0xac2d35['Smtp']['port'];_0x195603[_0xa91f('0x19b')]=_0xac2d35[_0xa91f('0x194')]['secure'];}if(_0xac2d35['Smtp'][_0xa91f('0x19c')]){_0x195603['auth']={'user':_0xac2d35[_0xa91f('0x194')][_0xa91f('0x195')],'pass':_0xac2d35['Smtp'][_0xa91f('0x19d')]};}if(this[_0xa91f('0x96')](_0x590fd2['template_id'])){}logger[_0xa91f('0xef')](_0xa91f('0x19e'),JSON['stringify'](_0x50d1e8));this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x590fd2,_0x590fd2[_0xa91f('0x18e')]);this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')]('Trying\x20SendMail\x20with\x20account\x20%s',_0xac2d35[_0xa91f('0x16')]));this[_0xa91f('0x24')][_0xa91f('0x86')](this,_0x195603,_0x50d1e8);return this['channel'][_0xa91f('0xb9')](_0xa91f('0x19f'));};AGIVertices['prototype'][_0xa91f('0x1a0')]=function(_0x34f521){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x1a1'),_0x34f521[_0xa91f('0xb8')]));return this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0x1a2'));};AGIVertices[_0xa91f('0x11')]['sendSMS']=function(_0x22c66b){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x1a3'),_0x22c66b[_0xa91f('0xb8')]));if(!this['isConfigured'](_0x22c66b[_0xa91f('0x1a4')])){return this[_0xa91f('0x38')]['noop']('no\x20sms\x20account\x20configured');}var _0x3fa9d1=this[_0xa91f('0x35')][_0xa91f('0x86')](this,_0x22c66b['sms_account_id']);if(!_0x3fa9d1){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x22c66b,_0xa91f('0x1a5'));}var _0x4b866c={'body':_0x22c66b[_0xa91f('0x1a6')],'phone':_0x22c66b['to']||'','SmsAccountId':_0x3fa9d1['id']};logger[_0xa91f('0xef')]('sendSMS\x20message',JSON[_0xa91f('0x88')](_0x4b866c));this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x22c66b,_0x22c66b['sms_account_id']);this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x1a7'),_0x3fa9d1[_0xa91f('0x16')]));this[_0xa91f('0x36')][_0xa91f('0x86')](this,_0x4b866c);return this[_0xa91f('0x38')]['noop'](_0xa91f('0x1a8'));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x1a9')]=function(_0x434571){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x1aa'),_0x434571[_0xa91f('0xb8')]));if(!this[_0xa91f('0x96')](_0x434571[_0xa91f('0xe8')])){return this['channel']['error'](_0x434571,'no\x20variable\x20selected');}var _0x277036=this[_0xa91f('0x12')][_0xa91f('0x86')](this,_0x434571[_0xa91f('0xe8')]);if(!_0x277036){return this['channel']['error'](_0x434571,_0xa91f('0xea'));}return this[_0xa91f('0x38')][_0xa91f('0xb0')](_0x277036,_0x434571[_0xa91f('0x1ab')]);};AGIVertices[_0xa91f('0x11')][_0xa91f('0x1ac')]=function(_0x26ae17){logger['info'](util[_0xa91f('0x2a')](_0xa91f('0x1ad'),_0x26ae17[_0xa91f('0xb8')]));this[_0xa91f('0x38')][_0xa91f('0xb9')](_0xa91f('0x1ae'));if(_0x26ae17[_0xa91f('0xca')]===_0xa91f('0x1af')){this['channel']['noop'](_0xa91f('0x1b0'));return this[_0xa91f('0x38')]['answer']();}return this[_0xa91f('0x38')]['noop']('Skipped\x20Answer');};AGIVertices[_0xa91f('0x11')][_0xa91f('0x1b1')]=function(_0x4efa10){logger['info'](util[_0xa91f('0x2a')](_0xa91f('0x1b2'),_0x4efa10[_0xa91f('0xb8')]));if(!this['isConfigured'](_0x4efa10[_0xa91f('0x1b3')])){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x4efa10,_0xa91f('0x1b4'));}var _0x16ee6e=this[_0xa91f('0x18')][_0xa91f('0x86')](this,_0x4efa10[_0xa91f('0x1b3')]);if(!this['isConfigured'](_0x16ee6e)){return this[_0xa91f('0x38')]['error'](_0x4efa10,util[_0xa91f('0x2a')](_0xa91f('0x1b5'),_0x4efa10[_0xa91f('0x1b3')]));}if(_0x16ee6e===this[_0xa91f('0x38')][_0xa91f('0x3a')]){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x4efa10,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x4efa10,_0x16ee6e);var _0xafde22=this[_0xa91f('0x38')]['exec'](_0xa91f('0x1b6'),util['format'](_0xa91f('0x1b7'),config[_0xa91f('0x7')]['host']||_0xa91f('0x1b8'),_0x16ee6e,this[_0xa91f('0x38')][_0xa91f('0x3a')]));if(_0xafde22['result']===-0x1){return _0xafde22;}return this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0xd6'),_0xa91f('0x1b6'),_0x16ee6e));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x1b9')]=function(_0x1ed506){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x1ba'),_0x1ed506[_0xa91f('0xb8')]));var _0x42f0fd=this[_0xa91f('0x6b')][_0xa91f('0x86')](this,_0x1ed506[_0xa91f('0xc8')]);this[_0xa91f('0x37')][_0xa91f('0x86')](this,_0x1ed506,_0x1ed506[_0xa91f('0xc8')]);if(this[_0xa91f('0x96')](_0x1ed506[_0xa91f('0xe8')])){var _0x36bd6f=this[_0xa91f('0x12')][_0xa91f('0x86')](this,_0x1ed506[_0xa91f('0xe8')]);if(_0x36bd6f){this['channel'][_0xa91f('0xb0')](_0x36bd6f,_0x42f0fd);return this['channel'][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x1bb'),_0x1ed506[_0xa91f('0xc8')],_0x36bd6f));}}return this['channel'][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x1bc'),_0x1ed506[_0xa91f('0xc8')]));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x1bd')]=function(_0x1f48a4){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1f48a4[_0xa91f('0xb8')]));_0x1f48a4[_0xa91f('0x71')]=_0x1f48a4[_0xa91f('0x71')][_0xa91f('0x6e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa91f('0x96')](_0x1f48a4[_0xa91f('0x1be')])){return this['channel'][_0xa91f('0xb9')](_0xa91f('0x1bf'));}if(!this[_0xa91f('0x96')](_0x1f48a4['text'])){return this['channel']['noop']('no\x20text\x20configured');}this['channel'][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x1c0'),_0x1f48a4['text']));var _0x315a1c=this[_0xa91f('0x6f')][_0xa91f('0x86')](this,_0x1f48a4);if(_0x315a1c){this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x1c1'),_0x315a1c));var _0x596c15=this[_0xa91f('0x38')][_0xa91f('0x105')](_0x315a1c);try{fs[_0xa91f('0x107')](_0x315a1c+_0xa91f('0x108'));}catch(_0x168916){logger['error'](_0x168916);}return _0x596c15;}return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x1f48a4,_0xa91f('0x1c2'));};AGIVertices[_0xa91f('0x11')]['tts']=function(_0x26c708){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x26c708[_0xa91f('0xb8')]));_0x26c708[_0xa91f('0x71')]=_0x26c708['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa91f('0x96')](_0x26c708[_0xa91f('0x71')])){return this['channel'][_0xa91f('0xb9')](_0xa91f('0xba'));}this[_0xa91f('0x38')]['noop'](util[_0xa91f('0x2a')](_0xa91f('0x1c3'),_0x26c708[_0xa91f('0x71')]));var _0x2ed3a3=this[_0xa91f('0x78')][_0xa91f('0x86')](this,_0x26c708);if(_0x2ed3a3){this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')]('Google\x20TTS\x20%s\x20file\x20created',_0x2ed3a3));var _0x344306=this[_0xa91f('0x38')]['streamFile'](_0x2ed3a3);try{fs[_0xa91f('0x107')](_0x2ed3a3+_0xa91f('0x108'));}catch(_0x3fb609){logger['error'](_0x3fb609);}return _0x344306;}return this[_0xa91f('0x38')]['error'](_0x26c708,_0xa91f('0x1c4'));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x1c5')]=function(_0x39d108){logger[_0xa91f('0x30')](util['format'](_0xa91f('0x1c6'),_0x39d108[_0xa91f('0xb8')]));if(!this['isConfigured'](_0x39d108[_0xa91f('0x15b')])){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x39d108,_0xa91f('0x15c'));}logger['info'](util[_0xa91f('0x2a')](_0xa91f('0x15d'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x39d108[_0xa91f('0x15b')]));var _0x27f805=this[_0xa91f('0x66')]['sync'](this,_0x39d108[_0xa91f('0x15b')]);if(_0x27f805){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x15e'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x39d108[_0xa91f('0x15b')]));this['channel'][_0xa91f('0xb9')](util[_0xa91f('0x2a')](_0xa91f('0x15e'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x39d108['findBy']));return{'code':0xc8,'result':_0xa91f('0x15f')};}else{logger['info'](util[_0xa91f('0x2a')](_0xa91f('0x160'),this[_0xa91f('0x38')][_0xa91f('0x3b')],_0x39d108['findBy']));this[_0xa91f('0x38')][_0xa91f('0xb9')](util[_0xa91f('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa91f('0x38')]['callerid'],_0x39d108[_0xa91f('0x15b')]));return{'code':0xc8,'result':_0xa91f('0x161')};}};AGIVertices[_0xa91f('0x11')][_0xa91f('0x1c7')]=function(_0xa792b){logger[_0xa91f('0x30')](util[_0xa91f('0x2a')](_0xa91f('0x1c8'),_0xa792b[_0xa91f('0xb8')]));var _0x391233=this[_0xa91f('0x38')][_0xa91f('0x6c')]('VOICEMAIL',[_0xa792b[_0xa91f('0x1c9')],_0xa792b[_0xa91f('0x8e')]]);if(_0x391233[_0xa91f('0xbc')]===-0x1){return _0x391233;}return this[_0xa91f('0x38')][_0xa91f('0xb9')](util['format'](_0xa91f('0xd6'),_0xa91f('0x1ca'),_0xa792b[_0xa91f('0x1c9')]));};AGIVertices[_0xa91f('0x11')][_0xa91f('0x1cb')]=function(_0x5588a2){logger['info'](util[_0xa91f('0x2a')](_0xa91f('0x1cc'),_0x5588a2[_0xa91f('0xb8')]));if(!this['isConfigured'](_0x5588a2['variable_id'])){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x5588a2,_0xa91f('0x1cd'));}var _0x33dcfc=this[_0xa91f('0x12')][_0xa91f('0x86')](this,_0x5588a2['variable_id']);if(!_0x33dcfc){return this[_0xa91f('0x38')][_0xa91f('0x2e')](_0x5588a2,_0xa91f('0xea'));}var _0x3ab64e=this[_0xa91f('0x38')][_0xa91f('0x12')](_0x33dcfc);return{'code':0xc8,'result':_0x3ab64e[_0xa91f('0xb3')]?_0x3ab64e[_0xa91f('0xb3')]:'-'};};String[_0xa91f('0x11')]['replaceAll']=function(_0x2d6617,_0x1bbd64){return this[_0xa91f('0xb1')](_0x2d6617)[_0xa91f('0x1ce')](_0x1bbd64);};module[_0xa91f('0x1cf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index f8e68b7..4ca329a 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 _0x7bae=['stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','uniqueid','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','destlinkedid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer'];(function(_0x12b359,_0x2ee638){var _0x12c15c=function(_0x36be12){while(--_0x36be12){_0x12b359['push'](_0x12b359['shift']());}};_0x12c15c(++_0x2ee638);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7bae[_0x5608a3];return _0x1ed50a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe7ba('0x0'));var ami=require(_0xe7ba('0x1'));var logger=require('../../../config/logger')(_0xe7ba('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xe7ba('0x3'));function Acw(_0x10908b){this[_0xe7ba('0x4')]=_0x10908b[_0xe7ba('0x4')];this[_0xe7ba('0x5')]=_0x10908b[_0xe7ba('0x5')];this[_0xe7ba('0x6')]=_0x10908b[_0xe7ba('0x6')];this[_0xe7ba('0x7')]={};ami['on'](_0xe7ba('0x8'),this[_0xe7ba('0x9')][_0xe7ba('0xa')](this));ami['on'](_0xe7ba('0xb'),this[_0xe7ba('0xc')]['bind'](this));ami['on'](_0xe7ba('0xd'),this[_0xe7ba('0xe')][_0xe7ba('0xa')](this));ami['on'](_0xe7ba('0xf'),this[_0xe7ba('0x10')][_0xe7ba('0xa')](this));ami['on'](_0xe7ba('0x11'),this[_0xe7ba('0x12')][_0xe7ba('0xa')](this));ami['on']('blindtransfer',this[_0xe7ba('0x13')]['bind'](this));ami['on'](_0xe7ba('0x14'),this[_0xe7ba('0x15')][_0xe7ba('0xa')](this));}function getDiff(_0x17e4e6){var _0x15d018=moment()[_0xe7ba('0x16')](0x0);var _0x561dbb=moment(_0x17e4e6)['milliseconds'](0x0);return _0x15d018[_0xe7ba('0x17')](_0x561dbb,_0xe7ba('0x18'));}Acw[_0xe7ba('0x19')]['startAcw']=function(_0x4390e3){try{var _0x4b20fd=this;var _0x590bab=this['channels'][_0x4390e3][_0xe7ba('0x1a')];var _0x4e87f5=this[_0xe7ba('0x7')][_0x4390e3]['queue'];var _0x4e3021=this['voiceQueues'][_0x4e87f5];var _0x3f326a=![];var _0x30086c=_0xe7ba('0x1b');if(_0x4e3021[_0xe7ba('0x1c')]){if(_0x4e3021[_0xe7ba('0x1d')]['name']){_0x3f326a=!![];_0x30086c=_0x4e3021[_0xe7ba('0x1d')][_0xe7ba('0x1e')];}}ami[_0xe7ba('0x1f')]({'action':_0xe7ba('0x20'),'interface':_0x590bab,'paused':!![],'reason':_0x30086c})['then'](function(_0x1076c5){if(_0x4b20fd[_0xe7ba('0x5')][_0x590bab]){return RpcUser['getAgent'](_0x4b20fd[_0xe7ba('0x5')][_0x590bab]['id'])[_0xe7ba('0x21')](function(_0x27c882){if(_0x27c882&&!_0x27c882[_0xe7ba('0x22')]){logger[_0xe7ba('0x23')](_0xe7ba('0x24'),_0x4390e3,_0x590bab,_0x4e87f5);var _0x293b14=_0x4b20fd[_0xe7ba('0x7')][_0x4390e3][_0xe7ba('0x25')]&&_0x4b20fd[_0xe7ba('0x7')][_0x4390e3]['destlinkedid']?_0x4b20fd['channels'][_0x4390e3]['destlinkedid']:_0x4390e3;return RpcUser['savePause'](_0x4b20fd[_0xe7ba('0x5')][_0x590bab],_0x30086c,_0x293b14)['then'](function(_0x4ecc0d){if(!_0x3f326a){_0x4b20fd['timers'][_0x590bab]={};logger[_0xe7ba('0x23')](_0xe7ba('0x26'),_0x4390e3,_0x4b20fd[_0xe7ba('0x4')][_0x4e87f5][_0xe7ba('0x27')],_0x590bab,_0x4e87f5);_0x4b20fd[_0xe7ba('0x6')][_0x590bab][_0xe7ba('0x28')]=setTimeout(_0x4b20fd[_0xe7ba('0x29')][_0xe7ba('0xa')](_0x4b20fd,_0x590bab),_0x4b20fd['voiceQueues'][_0x4e87f5][_0xe7ba('0x27')]*0x3e8);_0x4b20fd['timers'][_0x590bab][_0xe7ba('0x2a')]=moment()[_0xe7ba('0x2b')](_0xe7ba('0x2c'));_0x4b20fd['timers'][_0x590bab]['uniqueid']=_0x4390e3;_0x4b20fd[_0xe7ba('0x6')][_0x590bab][_0xe7ba('0x2d')]=_0x4e87f5;_0x4b20fd[_0xe7ba('0x6')][_0x590bab][_0xe7ba('0x2e')]=function(){var _0x268308=getDiff(_0x4b20fd['timers'][_0x590bab][_0xe7ba('0x2a')]);clearTimeout(_0x4b20fd[_0xe7ba('0x6')][_0x590bab]['timer']);_0x4b20fd[_0xe7ba('0x6')][_0x590bab]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x268308},_0x4b20fd[_0xe7ba('0x6')][_0x590bab][_0xe7ba('0x2f')],_0x590bab)[_0xe7ba('0x21')](function(_0x52f90e){logger[_0xe7ba('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x4390e3,_0x268308,_0x52f90e);})[_0xe7ba('0x30')](function(_0x343cd2){logger[_0xe7ba('0x31')](_0xe7ba('0x32'),_0x4390e3,_0x343cd2);});delete _0x4b20fd[_0xe7ba('0x6')][_0x590bab];};}});}else{logger['info'](_0xe7ba('0x33'),_0x4390e3,_0x590bab,_0x4e87f5);}});}})[_0xe7ba('0x30')](function(_0x4baf97){logger[_0xe7ba('0x31')](_0xe7ba('0x26'),_0x4390e3,_0x4b20fd[_0xe7ba('0x4')][_0x4e87f5]['acwTimeout'],_0x590bab,_0x4e87f5);})[_0xe7ba('0x34')](function(){delete _0x4b20fd[_0xe7ba('0x7')][_0x4390e3];});}catch(_0x5db8ab){logger[_0xe7ba('0x31')](_0xe7ba('0x35'),_0x5db8ab[_0xe7ba('0x36')]);}};Acw['prototype'][_0xe7ba('0x29')]=function(_0x43b313){try{var _0x575f4b=this;if(_0x575f4b[_0xe7ba('0x6')][_0x43b313]){_0x575f4b[_0xe7ba('0x6')][_0x43b313][_0xe7ba('0x28')]=![];var _0x582833=_0x575f4b['timers'][_0x43b313][_0xe7ba('0x2f')];var _0x2ebb27=_0x575f4b[_0xe7ba('0x6')][_0x43b313][_0xe7ba('0x2d')];var _0x3581ef=_0x575f4b['voiceQueues'][_0x2ebb27][_0xe7ba('0x27')];logger[_0xe7ba('0x23')](_0xe7ba('0x37'),_0x43b313);RpcUser[_0xe7ba('0x38')](this['agents'][_0x43b313]);RpcVoiceAgentReport[_0xe7ba('0x39')]({'acwtime':_0x3581ef,'agentacw':!![]},_0x582833,_0x43b313)[_0xe7ba('0x21')](function(_0x46e31a){logger[_0xe7ba('0x23')](_0xe7ba('0x3a'),_0x582833,_0x3581ef,_0x46e31a);})[_0xe7ba('0x30')](function(_0x124cc4){logger['error'](_0xe7ba('0x32'),_0x582833,_0x124cc4);});}else{logger[_0xe7ba('0x31')](_0xe7ba('0x3b'),_0x43b313);if(_0x575f4b[_0xe7ba('0x6')]){logger[_0xe7ba('0x23')](_0xe7ba('0x3c'),JSON[_0xe7ba('0x3d')](_0x575f4b[_0xe7ba('0x6')]));}}}catch(_0x39d903){logger['error'](_0xe7ba('0x3e'),_0x39d903[_0xe7ba('0x36')]);}};Acw['prototype']['syncAgentConnect']=function(_0x32053d){try{if(this[_0xe7ba('0x4')][_0x32053d[_0xe7ba('0x2d')]]&&(this['voiceQueues'][_0x32053d[_0xe7ba('0x2d')]][_0xe7ba('0x2')]||this[_0xe7ba('0x4')][_0x32053d[_0xe7ba('0x2d')]][_0xe7ba('0x1c')])){if(this['agents'][_0x32053d[_0xe7ba('0x1a')]]){this['channels'][_0x32053d[_0xe7ba('0x2f')]]={'queue':_0x32053d[_0xe7ba('0x2d')],'interface':_0x32053d[_0xe7ba('0x1a')],'destlinkedid':_0x32053d[_0xe7ba('0x3f')]};}}}catch(_0x3053a4){logger[_0xe7ba('0x31')](_0xe7ba('0x40'),_0x3053a4[_0xe7ba('0x36')]);}};Acw['prototype'][_0xe7ba('0x15')]=function(_0x4178b9){try{if(this[_0xe7ba('0x4')][_0x4178b9[_0xe7ba('0x2d')]]&&(this[_0xe7ba('0x4')][_0x4178b9[_0xe7ba('0x2d')]][_0xe7ba('0x2')]||this[_0xe7ba('0x4')][_0x4178b9[_0xe7ba('0x2d')]][_0xe7ba('0x1c')])){if(this['agents'][_0x4178b9[_0xe7ba('0x1a')]]){this['channels'][_0x4178b9[_0xe7ba('0x2f')]]={'queue':_0x4178b9[_0xe7ba('0x2d')],'interface':_0x4178b9[_0xe7ba('0x1a')]};}}}catch(_0x15177c){logger[_0xe7ba('0x31')](_0xe7ba('0x41'),_0x15177c['message']);}};Acw[_0xe7ba('0x19')][_0xe7ba('0xc')]=function(_0x3f17ed){try{if(this[_0xe7ba('0x7')][_0x3f17ed[_0xe7ba('0x2f')]]&&_[_0xe7ba('0x42')](this[_0xe7ba('0x7')][_0x3f17ed[_0xe7ba('0x2f')]][_0xe7ba('0x25')])){logger[_0xe7ba('0x23')](_0xe7ba('0x43'),_0x3f17ed['uniqueid']);this[_0xe7ba('0x44')](_0x3f17ed[_0xe7ba('0x2f')]);}else if(this[_0xe7ba('0x7')][_0x3f17ed[_0xe7ba('0x45')]]&&_[_0xe7ba('0x42')](this[_0xe7ba('0x7')][_0x3f17ed['linkedid']][_0xe7ba('0x25')])){logger[_0xe7ba('0x23')]('[%s][HANGUP:LINKEDID]',_0x3f17ed[_0xe7ba('0x45')]);this[_0xe7ba('0x44')](_0x3f17ed[_0xe7ba('0x45')]);}}catch(_0x1b9a05){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x1b9a05[_0xe7ba('0x36')]);}};Acw[_0xe7ba('0x19')][_0xe7ba('0xe')]=function(_0x5af106){try{if(this[_0xe7ba('0x7')][_0x5af106[_0xe7ba('0x2f')]]&&this[_0xe7ba('0x7')][_0x5af106[_0xe7ba('0x2f')]][_0xe7ba('0x25')]){logger[_0xe7ba('0x23')](_0xe7ba('0x46'),_0x5af106['uniqueid']);this[_0xe7ba('0x44')](_0x5af106[_0xe7ba('0x2f')]);}else if(this[_0xe7ba('0x7')][_0x5af106['linkedid']]&&this[_0xe7ba('0x7')][_0x5af106[_0xe7ba('0x45')]]['attended']){logger[_0xe7ba('0x23')](_0xe7ba('0x47'),_0x5af106['linkedid']);this[_0xe7ba('0x44')](_0x5af106['linkedid']);}}catch(_0xe2cbba){logger[_0xe7ba('0x31')](_0xe7ba('0x48'),_0xe2cbba['message']);}};Acw[_0xe7ba('0x19')][_0xe7ba('0x12')]=function(_0x314549){try{if(!_[_0xe7ba('0x49')](this[_0xe7ba('0x7')][_0x314549['transfereeuniqueid']])){this[_0xe7ba('0x44')](_0x314549[_0xe7ba('0x4a')]);if(this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4b')]]){this[_0xe7ba('0x7')][_0x314549['secondtransfereruniqueid']][_0xe7ba('0x25')]=!![];this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4c')]]=this[_0xe7ba('0x7')][_0x314549['secondtransfereruniqueid']];delete this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4b')]];}}else if(!_[_0xe7ba('0x49')](this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4c')]])){this[_0xe7ba('0x44')](_0x314549['transfertargetuniqueid']);if(this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4d')]]){this[_0xe7ba('0x7')][_0x314549['origtransfereruniqueid']][_0xe7ba('0x25')]=!![];this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4a')]]=this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4d')]];delete this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4d')]];}}}catch(_0x3351d5){logger[_0xe7ba('0x31')](_0xe7ba('0x4e'),_0x3351d5[_0xe7ba('0x36')]);}};Acw[_0xe7ba('0x19')]['syncBlindTransfer']=function(_0x131331){try{if(this[_0xe7ba('0x7')][_0x131331[_0xe7ba('0x4f')]]){logger['info'](_0xe7ba('0x50'),JSON['stringify'](_0x131331[_0xe7ba('0x4f')]));this[_0xe7ba('0x44')](_0x131331[_0xe7ba('0x4f')]);}else if(this['channels'][_0x131331['transfererlinkedid']]){logger[_0xe7ba('0x23')](_0xe7ba('0x51'),JSON[_0xe7ba('0x3d')](_0x131331['transfererlinkedid']));this[_0xe7ba('0x44')](_0x131331[_0xe7ba('0x52')]);}}catch(_0x3fe82a){logger[_0xe7ba('0x31')](_0xe7ba('0x53'),_0x3fe82a['message']);}};Acw[_0xe7ba('0x19')][_0xe7ba('0x10')]=function(_0x70ce9c){try{if(this['voiceQueues'][_0x70ce9c[_0xe7ba('0x2d')]]&&this[_0xe7ba('0x4')][_0x70ce9c[_0xe7ba('0x2d')]][_0xe7ba('0x54')]===_0xe7ba('0x55')){if(this[_0xe7ba('0x5')][_0x70ce9c[_0xe7ba('0x1a')]]){logger[_0xe7ba('0x23')](_0xe7ba('0x56'),_0x70ce9c[_0xe7ba('0x2f')],_0x70ce9c['interface'],_0x70ce9c[_0xe7ba('0x2d')]);return RpcUser[_0xe7ba('0x57')](this[_0xe7ba('0x5')][_0x70ce9c[_0xe7ba('0x1a')]],'Auto-Pause',_0x70ce9c['uniqueid']);}}}catch(_0x103eb8){logger[_0xe7ba('0x31')](_0xe7ba('0x58'),_0x103eb8['message']);}};module['exports']=Acw; \ No newline at end of file +var _0xac9d=['name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','[TIMER][STOP][AGENT:%s]','catch','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause'];(function(_0x4df063,_0x40bc28){var _0x4dc5e5=function(_0x4b81d4){while(--_0x4b81d4){_0x4df063['push'](_0x4df063['shift']());}};_0x4dc5e5(++_0x40bc28);}(_0xac9d,0x14d));var _0xdac9=function(_0x3f2a44,_0xf70f4b){_0x3f2a44=_0x3f2a44-0x0;var _0x50d3cb=_0xac9d[_0x3f2a44];return _0x50d3cb;};'use strict';var util=require(_0xdac9('0x0'));var _=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var ami=require(_0xdac9('0x3'));var logger=require(_0xdac9('0x4'))(_0xdac9('0x5'));var RpcUser=require(_0xdac9('0x6'));var RpcVoiceAgentReport=require(_0xdac9('0x7'));function Acw(_0x51a5d7){this[_0xdac9('0x8')]=_0x51a5d7['voiceQueues'];this[_0xdac9('0x9')]=_0x51a5d7[_0xdac9('0x9')];this[_0xdac9('0xa')]=_0x51a5d7[_0xdac9('0xa')];this[_0xdac9('0xb')]={};ami['on'](_0xdac9('0xc'),this['syncAgentConnect'][_0xdac9('0xd')](this));ami['on']('hanguprequest',this[_0xdac9('0xe')][_0xdac9('0xd')](this));ami['on'](_0xdac9('0xf'),this[_0xdac9('0x10')][_0xdac9('0xd')](this));ami['on'](_0xdac9('0x11'),this[_0xdac9('0x12')][_0xdac9('0xd')](this));ami['on'](_0xdac9('0x13'),this['syncAttendedTransfer'][_0xdac9('0xd')](this));ami['on'](_0xdac9('0x14'),this['syncBlindTransfer'][_0xdac9('0xd')](this));ami['on'](_0xdac9('0x15'),this[_0xdac9('0x16')]['bind'](this));}function getDiff(_0x16063f){var _0x33ba20=moment()[_0xdac9('0x17')](0x0);var _0x5f0bbd=moment(_0x16063f)['milliseconds'](0x0);return _0x33ba20[_0xdac9('0x18')](_0x5f0bbd,_0xdac9('0x19'));}Acw['prototype'][_0xdac9('0x1a')]=function(_0x36cbe4){try{var _0x152ea5=this;var _0x5b2f1b=this[_0xdac9('0xb')][_0x36cbe4][_0xdac9('0x1b')];var _0x34a85a=this[_0xdac9('0xb')][_0x36cbe4]['queue'];var _0x283343=this[_0xdac9('0x8')][_0x34a85a];var _0x571e07=![];var _0x1cd239=_0xdac9('0x1c');if(_0x283343[_0xdac9('0x1d')]){if(_0x283343[_0xdac9('0x1e')]['name']){_0x571e07=!![];_0x1cd239=_0x283343['mandatoryDispositionPause'][_0xdac9('0x1f')];}}ami[_0xdac9('0x20')]({'action':_0xdac9('0x21'),'interface':_0x5b2f1b,'paused':!![],'reason':_0x1cd239})[_0xdac9('0x22')](function(_0x52fb18){if(_0x152ea5[_0xdac9('0x9')][_0x5b2f1b]){return RpcUser[_0xdac9('0x23')](_0x152ea5[_0xdac9('0x9')][_0x5b2f1b]['id'])[_0xdac9('0x22')](function(_0xe7bd10){if(_0xe7bd10&&!_0xe7bd10[_0xdac9('0x24')]){logger[_0xdac9('0x25')](_0xdac9('0x26'),_0x36cbe4,_0x5b2f1b,_0x34a85a);var _0x419f0c=_0x152ea5[_0xdac9('0xb')][_0x36cbe4]['attended']&&_0x152ea5[_0xdac9('0xb')][_0x36cbe4][_0xdac9('0x27')]?_0x152ea5[_0xdac9('0xb')][_0x36cbe4][_0xdac9('0x27')]:_0x36cbe4;return RpcUser['savePause'](_0x152ea5[_0xdac9('0x9')][_0x5b2f1b],_0x1cd239,_0x419f0c)['then'](function(_0x3ce475){if(!_0x571e07){_0x152ea5[_0xdac9('0xa')][_0x5b2f1b]={};logger['info'](_0xdac9('0x28'),_0x36cbe4,_0x152ea5['voiceQueues'][_0x34a85a][_0xdac9('0x29')],_0x5b2f1b,_0x34a85a);_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2a')]=setTimeout(_0x152ea5[_0xdac9('0x2b')]['bind'](_0x152ea5,_0x5b2f1b),_0x152ea5['voiceQueues'][_0x34a85a][_0xdac9('0x29')]*0x3e8);_0x152ea5[_0xdac9('0xa')][_0x5b2f1b]['lastPauseAt']=moment()['format'](_0xdac9('0x2c'));_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2d')]=_0x36cbe4;_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2e')]=_0x34a85a;_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2f')]=function(){var _0x2cda4d=getDiff(_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x30')]);clearTimeout(_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2a')]);_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2a')]=![];RpcVoiceAgentReport[_0xdac9('0x31')]({'acwtime':_0x2cda4d},_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2d')],_0x5b2f1b)[_0xdac9('0x22')](function(_0x339f31){logger[_0xdac9('0x25')](_0xdac9('0x32'),_0x36cbe4,_0x2cda4d,_0x339f31);})['catch'](function(_0x5e7ebe){logger[_0xdac9('0x33')](_0xdac9('0x34'),_0x36cbe4,_0x5e7ebe);});delete _0x152ea5[_0xdac9('0xa')][_0x5b2f1b];};}});}else{logger[_0xdac9('0x25')](_0xdac9('0x35'),_0x36cbe4,_0x5b2f1b,_0x34a85a);}});}})['catch'](function(_0x1d125a){logger['error'](_0xdac9('0x28'),_0x36cbe4,_0x152ea5[_0xdac9('0x8')][_0x34a85a]['acwTimeout'],_0x5b2f1b,_0x34a85a);})[_0xdac9('0x36')](function(){delete _0x152ea5['channels'][_0x36cbe4];});}catch(_0x52d758){logger[_0xdac9('0x33')](_0xdac9('0x37'),_0x52d758[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x2b')]=function(_0x363d93){try{var _0x51cde6=this;if(_0x51cde6[_0xdac9('0xa')][_0x363d93]){_0x51cde6[_0xdac9('0xa')][_0x363d93]['timer']=![];var _0x244d1f=_0x51cde6[_0xdac9('0xa')][_0x363d93][_0xdac9('0x2d')];var _0x27bdfb=_0x51cde6[_0xdac9('0xa')][_0x363d93][_0xdac9('0x2e')];var _0x3ac9ae=_0x51cde6['voiceQueues'][_0x27bdfb][_0xdac9('0x29')];logger[_0xdac9('0x25')](_0xdac9('0x3a'),_0x363d93);RpcUser['saveUnpause'](this[_0xdac9('0x9')][_0x363d93]);RpcVoiceAgentReport[_0xdac9('0x31')]({'acwtime':_0x3ac9ae,'agentacw':!![]},_0x244d1f,_0x363d93)[_0xdac9('0x22')](function(_0x1d6f88){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x244d1f,_0x3ac9ae,_0x1d6f88);})[_0xdac9('0x3b')](function(_0xe47a3c){logger[_0xdac9('0x33')](_0xdac9('0x34'),_0x244d1f,_0xe47a3c);});}else{logger[_0xdac9('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x363d93);if(_0x51cde6[_0xdac9('0xa')]){logger['info'](_0xdac9('0x3c'),JSON[_0xdac9('0x3d')](_0x51cde6[_0xdac9('0xa')]));}}}catch(_0x1898e1){logger[_0xdac9('0x33')](_0xdac9('0x3e'),_0x1898e1[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x3f')]=function(_0x8a0538){try{if(this[_0xdac9('0x8')][_0x8a0538[_0xdac9('0x2e')]]&&(this[_0xdac9('0x8')][_0x8a0538[_0xdac9('0x2e')]]['acw']||this[_0xdac9('0x8')][_0x8a0538[_0xdac9('0x2e')]]['mandatoryDisposition'])){if(this[_0xdac9('0x9')][_0x8a0538[_0xdac9('0x1b')]]){this[_0xdac9('0xb')][_0x8a0538[_0xdac9('0x2d')]]={'queue':_0x8a0538[_0xdac9('0x2e')],'interface':_0x8a0538[_0xdac9('0x1b')],'destlinkedid':_0x8a0538['destlinkedid']};}}}catch(_0x1c3f15){logger['error'](_0xdac9('0x40'),_0x1c3f15[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x16')]=function(_0x5e61ac){try{if(this['voiceQueues'][_0x5e61ac['queue']]&&(this[_0xdac9('0x8')][_0x5e61ac['queue']]['acw']||this[_0xdac9('0x8')][_0x5e61ac[_0xdac9('0x2e')]]['mandatoryDisposition'])){if(this['agents'][_0x5e61ac[_0xdac9('0x1b')]]){this[_0xdac9('0xb')][_0x5e61ac[_0xdac9('0x2d')]]={'queue':_0x5e61ac[_0xdac9('0x2e')],'interface':_0x5e61ac[_0xdac9('0x1b')]};}}}catch(_0x2e07bc){logger[_0xdac9('0x33')](_0xdac9('0x41'),_0x2e07bc['message']);}};Acw[_0xdac9('0x39')][_0xdac9('0xe')]=function(_0xfa104f){try{if(this[_0xdac9('0xb')][_0xfa104f[_0xdac9('0x2d')]]&&_[_0xdac9('0x42')](this[_0xdac9('0xb')][_0xfa104f[_0xdac9('0x2d')]][_0xdac9('0x43')])){logger[_0xdac9('0x25')](_0xdac9('0x44'),_0xfa104f[_0xdac9('0x2d')]);this[_0xdac9('0x1a')](_0xfa104f[_0xdac9('0x2d')]);}else if(this['channels'][_0xfa104f['linkedid']]&&_['isUndefined'](this[_0xdac9('0xb')][_0xfa104f[_0xdac9('0x45')]]['attended'])){logger[_0xdac9('0x25')](_0xdac9('0x46'),_0xfa104f[_0xdac9('0x45')]);this['startAcw'](_0xfa104f[_0xdac9('0x45')]);}}catch(_0x9f6e4){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x9f6e4[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x10')]=function(_0x370532){try{if(this[_0xdac9('0xb')][_0x370532[_0xdac9('0x2d')]]&&this[_0xdac9('0xb')][_0x370532[_0xdac9('0x2d')]][_0xdac9('0x43')]){logger[_0xdac9('0x25')](_0xdac9('0x47'),_0x370532[_0xdac9('0x2d')]);this[_0xdac9('0x1a')](_0x370532[_0xdac9('0x2d')]);}else if(this[_0xdac9('0xb')][_0x370532['linkedid']]&&this[_0xdac9('0xb')][_0x370532[_0xdac9('0x45')]][_0xdac9('0x43')]){logger[_0xdac9('0x25')](_0xdac9('0x48'),_0x370532[_0xdac9('0x45')]);this['startAcw'](_0x370532[_0xdac9('0x45')]);}}catch(_0x401ab6){logger[_0xdac9('0x33')](_0xdac9('0x49'),_0x401ab6[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x4a')]=function(_0x243862){try{if(!_[_0xdac9('0x4b')](this['channels'][_0x243862[_0xdac9('0x4c')]])){this[_0xdac9('0x1a')](_0x243862[_0xdac9('0x4c')]);if(this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4d')]]){this[_0xdac9('0xb')][_0x243862['secondtransfereruniqueid']]['attended']=!![];this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4e')]]=this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4d')]];delete this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4d')]];}}else if(!_['isNil'](this['channels'][_0x243862['transfertargetuniqueid']])){this[_0xdac9('0x1a')](_0x243862[_0xdac9('0x4e')]);if(this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4f')]]){this['channels'][_0x243862[_0xdac9('0x4f')]][_0xdac9('0x43')]=!![];this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4c')]]=this[_0xdac9('0xb')][_0x243862['origtransfereruniqueid']];delete this[_0xdac9('0xb')][_0x243862['origtransfereruniqueid']];}}}catch(_0x60b64e){logger['error'](_0xdac9('0x50'),_0x60b64e[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x51')]=function(_0x303008){try{if(this[_0xdac9('0xb')][_0x303008[_0xdac9('0x52')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x303008[_0xdac9('0x52')]));this[_0xdac9('0x1a')](_0x303008[_0xdac9('0x52')]);}else if(this[_0xdac9('0xb')][_0x303008[_0xdac9('0x53')]]){logger[_0xdac9('0x25')](_0xdac9('0x54'),JSON['stringify'](_0x303008[_0xdac9('0x53')]));this['startAcw'](_0x303008['transfererlinkedid']);}}catch(_0x461c96){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x461c96[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x12')]=function(_0x55ce14){try{if(this['voiceQueues'][_0x55ce14[_0xdac9('0x2e')]]&&this[_0xdac9('0x8')][_0x55ce14['queue']][_0xdac9('0x55')]===_0xdac9('0x56')){if(this[_0xdac9('0x9')][_0x55ce14[_0xdac9('0x1b')]]){logger[_0xdac9('0x25')](_0xdac9('0x57'),_0x55ce14[_0xdac9('0x2d')],_0x55ce14[_0xdac9('0x1b')],_0x55ce14[_0xdac9('0x2e')]);return RpcUser[_0xdac9('0x58')](this[_0xdac9('0x9')][_0x55ce14[_0xdac9('0x1b')]],'Auto-Pause',_0x55ce14[_0xdac9('0x2d')]);}}}catch(_0x4df310){logger[_0xdac9('0x33')](_0xdac9('0x59'),_0x4df310['message']);}};module[_0xdac9('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f907f0a..70d2e93 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 _0x3e5a=['shutdown','info','resolve','then','actionSipPeerStatus','actionQueueSummary','log','asterisk-manager','bluebird','moment','util','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','port','once','close','connect'];(function(_0x30e01f,_0x4b4c42){var _0x54b90e=function(_0x503bec){while(--_0x503bec){_0x30e01f['push'](_0x30e01f['shift']());}};_0x54b90e(++_0x4b4c42);}(_0x3e5a,0x1db));var _0xa3e5=function(_0x4a9733,_0x1929ba){_0x4a9733=_0x4a9733-0x0;var _0x4753d4=_0x3e5a[_0x4a9733];return _0x4753d4;};'use strict';var Manager=require(_0xa3e5('0x0'));var BPromise=require(_0xa3e5('0x1'));var moment=require(_0xa3e5('0x2'));var util=require(_0xa3e5('0x3'));var _=require('lodash');var logger=require(_0xa3e5('0x4'))(_0xa3e5('0x5'));var config=require(_0xa3e5('0x6'));var ami=new Manager(config['asterisk']['port'],config['asterisk']['ip'],config[_0xa3e5('0x7')][_0xa3e5('0x8')],config[_0xa3e5('0x7')][_0xa3e5('0x9')],!![]);ami[_0xa3e5('0xa')]();ami['Action']=BPromise['promisify'](ami[_0xa3e5('0xb')]);function error(_0x1d5134){logger[_0xa3e5('0xc')](util[_0xa3e5('0xd')](_0xa3e5('0xe'),config[_0xa3e5('0x7')]['username'],config[_0xa3e5('0x7')]['ip'],config[_0xa3e5('0x7')]['port'],util[_0xa3e5('0xf')](_0x1d5134,![],null)));}function close(){logger[_0xa3e5('0xc')](util[_0xa3e5('0xd')](_0xa3e5('0x10'),config[_0xa3e5('0x7')][_0xa3e5('0x8')],config[_0xa3e5('0x7')]['ip'],config['asterisk']['port']));}ami[_0xa3e5('0x11')]=function(){return function(){return ami[_0xa3e5('0x12')]({'action':_0xa3e5('0x13')});};};ami[_0xa3e5('0x14')]=function(){return function(){return ami['Action']({'action':_0xa3e5('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xa3e5('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xa3e5('0x12')]({'action':'queuesummary'});};};ami[_0xa3e5('0x17')]=function(){return function(){return ami[_0xa3e5('0x12')]({'action':'coreshowchannels'});};};function connect(_0x4321a2){logger['info'](util[_0xa3e5('0xd')](_0xa3e5('0x18'),config['asterisk'][_0xa3e5('0x8')],config[_0xa3e5('0x7')]['ip'],config[_0xa3e5('0x7')][_0xa3e5('0x19')]));ami['once'](_0xa3e5('0xc'),error);ami[_0xa3e5('0x1a')](_0xa3e5('0x1b'),close);}ami['on'](_0xa3e5('0x1c'),connect);ami['on'](_0xa3e5('0x1d'),function(_0x198f4d){logger['info'](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa3e5('0x7')]['username'],config[_0xa3e5('0x7')]['ip'],config[_0xa3e5('0x7')][_0xa3e5('0x19')],util[_0xa3e5('0xf')](_0x198f4d,![],null)));});ami['on']('fullybooted',function(_0x1a21f6){logger[_0xa3e5('0x1e')](util[_0xa3e5('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xa3e5('0x7')]['username'],config[_0xa3e5('0x7')]['ip'],config[_0xa3e5('0x7')]['port']));return BPromise[_0xa3e5('0x1f')]()[_0xa3e5('0x20')](ami['actionSipShowRegistry']())[_0xa3e5('0x20')](ami[_0xa3e5('0x14')]())['then'](ami[_0xa3e5('0x21')]())[_0xa3e5('0x20')](ami[_0xa3e5('0x22')]())['then'](ami[_0xa3e5('0x17')]())['catch'](function(_0x1e0aae){console[_0xa3e5('0x23')](_0x1e0aae);});});ami['once'](_0xa3e5('0xc'),error);ami[_0xa3e5('0x1a')](_0xa3e5('0x1b'),close);module['exports']=ami; \ No newline at end of file +var _0x6488=['fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionQueueSummary','catch','log','exports','bluebird','moment','util','lodash','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionSipPeerStatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x2cebcf,_0x43eeba){var _0x38b76e=function(_0x2084ea){while(--_0x2084ea){_0x2cebcf['push'](_0x2cebcf['shift']());}};_0x38b76e(++_0x43eeba);}(_0x6488,0x1c1));var _0x8648=function(_0x1a5946,_0x426991){_0x1a5946=_0x1a5946-0x0;var _0x25e9d5=_0x6488[_0x1a5946];return _0x25e9d5;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x8648('0x0'));var moment=require(_0x8648('0x1'));var util=require(_0x8648('0x2'));var _=require(_0x8648('0x3'));var logger=require(_0x8648('0x4'))('ami');var config=require(_0x8648('0x5'));var ami=new Manager(config[_0x8648('0x6')][_0x8648('0x7')],config[_0x8648('0x6')]['ip'],config['asterisk'][_0x8648('0x8')],config[_0x8648('0x6')][_0x8648('0x9')],!![]);ami[_0x8648('0xa')]();ami[_0x8648('0xb')]=BPromise[_0x8648('0xc')](ami[_0x8648('0xd')]);function error(_0x1faac0){logger[_0x8648('0xe')](util[_0x8648('0xf')](_0x8648('0x10'),config[_0x8648('0x6')][_0x8648('0x8')],config[_0x8648('0x6')]['ip'],config['asterisk']['port'],util[_0x8648('0x11')](_0x1faac0,![],null)));}function close(){logger['error'](util[_0x8648('0xf')](_0x8648('0x12'),config[_0x8648('0x6')][_0x8648('0x8')],config[_0x8648('0x6')]['ip'],config[_0x8648('0x6')][_0x8648('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x8648('0xb')]({'action':_0x8648('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x8648('0xb')]({'action':'devicestatelist'});};};ami[_0x8648('0x14')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x8648('0xb')]({'action':_0x8648('0x15')});};};ami[_0x8648('0x16')]=function(){return function(){return ami[_0x8648('0xb')]({'action':_0x8648('0x17')});};};function connect(_0xb57c7){logger[_0x8648('0x18')](util['format'](_0x8648('0x19'),config[_0x8648('0x6')][_0x8648('0x8')],config[_0x8648('0x6')]['ip'],config[_0x8648('0x6')][_0x8648('0x7')]));ami[_0x8648('0x1a')](_0x8648('0xe'),error);ami['once'](_0x8648('0x1b'),close);}ami['on'](_0x8648('0x1c'),connect);ami['on'](_0x8648('0x1d'),function(_0x313970){logger['info'](util[_0x8648('0xf')](_0x8648('0x1e'),config['asterisk'][_0x8648('0x8')],config['asterisk']['ip'],config[_0x8648('0x6')]['port'],util[_0x8648('0x11')](_0x313970,![],null)));});ami['on'](_0x8648('0x1f'),function(_0x185046){logger[_0x8648('0x18')](util[_0x8648('0xf')](_0x8648('0x20'),config[_0x8648('0x6')][_0x8648('0x8')],config[_0x8648('0x6')]['ip'],config[_0x8648('0x6')][_0x8648('0x7')]));return BPromise[_0x8648('0x21')]()[_0x8648('0x22')](ami[_0x8648('0x23')]())[_0x8648('0x22')](ami['actionDeviceStateList']())[_0x8648('0x22')](ami[_0x8648('0x14')]())[_0x8648('0x22')](ami[_0x8648('0x24')]())[_0x8648('0x22')](ami[_0x8648('0x16')]())[_0x8648('0x25')](function(_0x359374){console[_0x8648('0x26')](_0x359374);});});ami[_0x8648('0x1a')]('error',error);ami[_0x8648('0x1a')]('close',close);module[_0x8648('0x27')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 31c4635..8c3f708 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 _0xef4e=['memberReport','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','ami','client','Request','request','rpc'];(function(_0x19c8ea,_0x22b480){var _0x55a71e=function(_0x28bbc0){while(--_0x28bbc0){_0x19c8ea['push'](_0x19c8ea['shift']());}};_0x55a71e(++_0x22b480);}(_0xef4e,0xa0));var _0xeef4=function(_0x3cdcfc,_0x5c259b){_0x3cdcfc=_0x3cdcfc-0x0;var _0x4b7c43=_0xef4e[_0x3cdcfc];return _0x4b7c43;};'use strict';var jayson=require(_0xeef4('0x0'));var BPromise=require(_0xeef4('0x1'));var logger=require(_0xeef4('0x2'))(_0xeef4('0x3'));var client=jayson[_0xeef4('0x4')]['http']({'port':0x2329});client[_0xeef4('0x5')]=function(_0x3cbefc,_0x5a651c){return new BPromise(function(_0x387d7f,_0x3c0f2b){return client[_0xeef4('0x6')](_0x3cbefc,_0x5a651c)['then'](function(_0x393d33){logger['debug'](_0xeef4('0x7'),_0xeef4('0x8'),_0x3cbefc,_0x5a651c,_0x393d33);if(_0x393d33['error']){logger['error'](_0xeef4('0x7'),_0xeef4('0x8'),_0x3cbefc,_0x393d33[_0xeef4('0x9')][_0xeef4('0xa')],_0x5a651c);return _0x3c0f2b(_0x393d33[_0xeef4('0x9')][_0xeef4('0xa')]);}else{return _0x387d7f(_0x393d33[_0xeef4('0xb')]);}})[_0xeef4('0xc')](function(_0x4567cd){logger[_0xeef4('0x9')](_0xeef4('0x7'),_0xeef4('0x8'),_0x3cbefc,_0x4567cd,_0x5a651c);return _0x3c0f2b(_0x4567cd);});});};module[_0xeef4('0xd')]=client; \ No newline at end of file +var _0x4eb9=['message','result','catch','jayson/promise','bluebird','../../config/logger','client','http','request','then','debug','rpc','error','memberReport'];(function(_0x42b049,_0x1a528b){var _0xaecab4=function(_0x31962a){while(--_0x31962a){_0x42b049['push'](_0x42b049['shift']());}};_0xaecab4(++_0x1a528b);}(_0x4eb9,0x1a7));var _0x94eb=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4eb9[_0x4243a3];return _0x1b2a33;};'use strict';var jayson=require(_0x94eb('0x0'));var BPromise=require(_0x94eb('0x1'));var logger=require(_0x94eb('0x2'))('ami');var client=jayson[_0x94eb('0x3')][_0x94eb('0x4')]({'port':0x2329});client['Request']=function(_0x4ad10f,_0x139ad8){return new BPromise(function(_0x155be9,_0x3d6c7b){return client[_0x94eb('0x5')](_0x4ad10f,_0x139ad8)[_0x94eb('0x6')](function(_0x5f9247){logger[_0x94eb('0x7')](_0x94eb('0x8'),'memberReport',_0x4ad10f,_0x139ad8,_0x5f9247);if(_0x5f9247['error']){logger[_0x94eb('0x9')]('rpc',_0x94eb('0xa'),_0x4ad10f,_0x5f9247['error'][_0x94eb('0xb')],_0x139ad8);return _0x3d6c7b(_0x5f9247['error']['message']);}else{return _0x155be9(_0x5f9247[_0x94eb('0xc')]);}})[_0x94eb('0xd')](function(_0x4f0c16){logger[_0x94eb('0x9')](_0x94eb('0x8'),_0x94eb('0xa'),_0x4ad10f,_0x4f0c16,_0x139ad8);return _0x3d6c7b(_0x4f0c16);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index e5bf6bf..74eb668 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 _0x7275=['voiceQueue','name','phone','firstName','Contact','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','substring','exports','util','lodash','moment','isNil','string'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7275,0x143));var _0x5727=function(_0x2ddad8,_0x11d8a9){_0x2ddad8=_0x2ddad8-0x0;var _0x2816d7=_0x7275[_0x2ddad8];return _0x2816d7;};'use strict';var util=require(_0x5727('0x0'));var _=require(_0x5727('0x1'));var moment=require(_0x5727('0x2'));function checkNameSurname(_0x517248,_0x3078c5,_0x49a209){var _0x2b1086='';if(!_[_0x5727('0x3')](_0x3078c5)&&'string'===typeof _0x3078c5){_0x2b1086+=_0x3078c5;}if(!_[_0x5727('0x3')](_0x49a209)&&_0x5727('0x4')===typeof _0x49a209){_0x2b1086+='\x20'+_0x49a209;}if(_0x2b1086!==''){return _0x2b1086;}return _0x517248;}function Action(_0x5b878c,_0x4c509e,_0x4872ba){this[_0x5727('0x5')]=_0x5b878c;this['uniqueid']=_0x4872ba||undefined;this[_0x5727('0x6')]=checkNameSurname(_0x4c509e['Contact'][_0x5727('0x7')],_0x4c509e['Contact'][_0x5727('0x8')],_0x4c509e[_0x5727('0x9')]['lastName']);this[_0x5727('0xa')]=_0x4c509e[_0x5727('0x9')]['phone'];this[_0x5727('0xb')]=_0x5b878c[_0x5727('0x6')];this['active']=_0x4c509e[_0x5727('0xc')]||![];this[_0x5727('0xd')]=_0x5b878c[_0x5727('0xd')];this[_0x5727('0xe')]=_0x5b878c[_0x5727('0xe')]||0x3;this[_0x5727('0xf')]=_0x4c509e['scheduledat'];this[_0x5727('0x10')]=_0x4c509e[_0x5727('0x10')];this[_0x5727('0x11')]=_0x4c509e[_0x5727('0x11')];this[_0x5727('0x12')]=_0x4c509e[_0x5727('0x12')];this[_0x5727('0x13')]=_0x4c509e['countnosuchnumberretry'];this[_0x5727('0x14')]=_0x4c509e[_0x5727('0x14')];this[_0x5727('0x15')]=_0x4c509e[_0x5727('0x15')];this[_0x5727('0x16')]=_0x4c509e[_0x5727('0x16')];this[_0x5727('0x17')]=_0x4c509e['countagentrejectretry'];this[_0x5727('0x18')]=_0x4c509e['ContactId'];this[_0x5727('0x19')]=_0x4c509e[_0x5727('0x19')];this['UserId']=_0x4c509e[_0x5727('0x1a')];this[_0x5727('0x1b')]=_0x4c509e[_0x5727('0x1b')];this[_0x5727('0x1c')]=_0x4c509e[_0x5727('0x1c')];this['idHopper']=_0x4c509e['id'];this['ContactFirstName']=_0x4c509e[_0x5727('0x9')][_0x5727('0x8')]||'';this[_0x5727('0x1d')]=moment()[_0x5727('0x1e')](_0x5727('0x1f'));this[_0x5727('0x20')]=_0x4c509e[_0x5727('0x20')];this['callbackuniqueid']=_0x4c509e[_0x5727('0x21')];this[_0x5727('0x22')]=_0x4c509e[_0x5727('0x22')];this['recallme']=_0x4c509e[_0x5727('0x23')];this[_0x5727('0x24')]='';this[_0x5727('0x25')]='';}Action['prototype']['getCaller']=function(){return util[_0x5727('0x1e')](_0x5727('0x26'),this['name'],this[_0x5727('0x5')]['dialCutDigit']>0x0?this[_0x5727('0xa')][_0x5727('0x27')](this['voiceQueue']['dialCutDigit']):this[_0x5727('0xa')]);};Action['prototype']['getQueue']=function(){return this[_0x5727('0xb')];};module[_0x5727('0x28')]=Action; \ No newline at end of file +var _0x876b=['recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','moment','isNil','string','voiceQueue','name','Contact','phone','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','callback','callbackuniqueid','callbackat'];(function(_0x553cf9,_0x2b5559){var _0x533a5d=function(_0x51fbb0){while(--_0x51fbb0){_0x553cf9['push'](_0x553cf9['shift']());}};_0x533a5d(++_0x2b5559);}(_0x876b,0x1ba));var _0xb876=function(_0xd864eb,_0x5f14fc){_0xd864eb=_0xd864eb-0x0;var _0x46cf86=_0x876b[_0xd864eb];return _0x46cf86;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xb876('0x0'));function checkNameSurname(_0x11fc80,_0x5c6895,_0x569fc2){var _0x34a150='';if(!_[_0xb876('0x1')](_0x5c6895)&&'string'===typeof _0x5c6895){_0x34a150+=_0x5c6895;}if(!_[_0xb876('0x1')](_0x569fc2)&&_0xb876('0x2')===typeof _0x569fc2){_0x34a150+='\x20'+_0x569fc2;}if(_0x34a150!==''){return _0x34a150;}return _0x11fc80;}function Action(_0x19baec,_0x5e1da8,_0x275125){this[_0xb876('0x3')]=_0x19baec;this['uniqueid']=_0x275125||undefined;this[_0xb876('0x4')]=checkNameSurname(_0x5e1da8[_0xb876('0x5')][_0xb876('0x6')],_0x5e1da8[_0xb876('0x5')]['firstName'],_0x5e1da8[_0xb876('0x5')]['lastName']);this[_0xb876('0x7')]=_0x5e1da8[_0xb876('0x5')]['phone'];this['queue']=_0x19baec['name'];this[_0xb876('0x8')]=_0x5e1da8['active']||![];this[_0xb876('0x9')]=_0x19baec[_0xb876('0x9')];this['dialQueueTimeout']=_0x19baec[_0xb876('0xa')]||0x3;this[_0xb876('0xb')]=_0x5e1da8[_0xb876('0xb')];this[_0xb876('0xc')]=_0x5e1da8[_0xb876('0xc')];this[_0xb876('0xd')]=_0x5e1da8[_0xb876('0xd')];this[_0xb876('0xe')]=_0x5e1da8[_0xb876('0xe')];this[_0xb876('0xf')]=_0x5e1da8[_0xb876('0xf')];this[_0xb876('0x10')]=_0x5e1da8['countdropretry'];this[_0xb876('0x11')]=_0x5e1da8[_0xb876('0x11')];this[_0xb876('0x12')]=_0x5e1da8[_0xb876('0x12')];this[_0xb876('0x13')]=_0x5e1da8[_0xb876('0x13')];this['ContactId']=_0x5e1da8[_0xb876('0x14')];this[_0xb876('0x15')]=_0x5e1da8['ListId'];this['UserId']=_0x5e1da8[_0xb876('0x16')];this[_0xb876('0x17')]=_0x5e1da8[_0xb876('0x17')];this['CampaignId']=_0x5e1da8[_0xb876('0x18')];this[_0xb876('0x19')]=_0x5e1da8['id'];this[_0xb876('0x1a')]=_0x5e1da8[_0xb876('0x5')][_0xb876('0x1b')]||'';this['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb876('0x1c')]=_0x5e1da8[_0xb876('0x1c')];this[_0xb876('0x1d')]=_0x5e1da8[_0xb876('0x1d')];this['callbackat']=_0x5e1da8[_0xb876('0x1e')];this[_0xb876('0x1f')]=_0x5e1da8[_0xb876('0x1f')];this[_0xb876('0x20')]='';this[_0xb876('0x21')]='';}Action[_0xb876('0x22')][_0xb876('0x23')]=function(){return util[_0xb876('0x24')](_0xb876('0x25'),this[_0xb876('0x4')],this[_0xb876('0x3')][_0xb876('0x26')]>0x0?this[_0xb876('0x7')][_0xb876('0x27')](this[_0xb876('0x3')][_0xb876('0x26')]):this[_0xb876('0x7')]);};Action['prototype'][_0xb876('0x28')]=function(){return this[_0xb876('0x29')];};module[_0xb876('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index cc94d1d..b56a8a2 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 _0x8df4=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8df4,0x18d));var _0x48df=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x8df4[_0x393d69];return _0x3cee37;};'use strict';var util=require(_0x48df('0x0'));var _=require(_0x48df('0x1'));var moment=require('moment');function getSeconds(_0x12162a,_0x3fd5f3){var _0x39ef66=moment(_0x12162a)[_0x48df('0x2')](0x0);var _0xa5e1c4=moment(_0x3fd5f3)[_0x48df('0x2')](0x0);return _0x39ef66[_0x48df('0x3')](_0xa5e1c4,_0x48df('0x4'));}function AdditionalPhone(_0x2ad2ef){this['uniqueid']=_0x2ad2ef['uniqueid'];this[_0x48df('0x5')]=_0x2ad2ef['scheduledat']||undefined;this[_0x48df('0x6')]=_0x2ad2ef[_0x48df('0x6')];this['campaigntype']=_0x2ad2ef[_0x48df('0x6')]==='outbound'?_0x48df('0x7'):_0x2ad2ef[_0x48df('0x6')];this['countbusyretry']=_0x2ad2ef[_0x48df('0x8')];this['countcongestionretry']=_0x2ad2ef[_0x48df('0x9')];this[_0x48df('0xa')]=_0x2ad2ef[_0x48df('0xa')];this['countglobal']=_0x2ad2ef[_0x48df('0x8')]+_0x2ad2ef['countcongestionretry']+_0x2ad2ef[_0x48df('0xa')]+_0x2ad2ef[_0x48df('0xb')]+_0x2ad2ef[_0x48df('0xc')]+_0x2ad2ef['countabandonedretry']+_0x2ad2ef['countmachineretry']+_0x2ad2ef['countagentrejectretry'];this[_0x48df('0xb')]=_0x2ad2ef[_0x48df('0xb')];this[_0x48df('0xc')]=_0x2ad2ef['countdropretry'];this[_0x48df('0xd')]=_0x2ad2ef['countabandonedretry'];this[_0x48df('0xe')]=_0x2ad2ef[_0x48df('0xe')];this['countagentrejectretry']=_0x2ad2ef[_0x48df('0xf')];this[_0x48df('0x7')]=_0x2ad2ef[_0x48df('0x7')];this[_0x48df('0x10')]=_0x2ad2ef['name'];this['calleridnum']=_0x2ad2ef[_0x48df('0x11')];this[_0x48df('0x12')]=_0x2ad2ef[_0x48df('0x12')];this[_0x48df('0x13')]=_0x2ad2ef[_0x48df('0x13')];this[_0x48df('0x14')]=_0x2ad2ef[_0x48df('0x13')];this[_0x48df('0x15')]=getSeconds(_0x2ad2ef['responsetime'],_0x2ad2ef[_0x48df('0x12')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x48df('0x16')]=_0x2ad2ef[_0x48df('0x16')];this[_0x48df('0x17')]=_0x2ad2ef['callbackuniqueid'];this[_0x48df('0x18')]=_0x2ad2ef[_0x48df('0x18')];this[_0x48df('0x19')]=_0x2ad2ef[_0x48df('0x19')];this[_0x48df('0x1a')]=_0x2ad2ef[_0x48df('0x1a')];this[_0x48df('0x1b')]=_0x2ad2ef[_0x48df('0x1b')];this[_0x48df('0x1c')]=_0x2ad2ef[_0x48df('0x1c')];this[_0x48df('0x1d')]=_0x2ad2ef['VoiceQueueId'];this[_0x48df('0x1e')]=_0x2ad2ef[_0x48df('0x1e')];this[_0x48df('0x1f')]=_0x2ad2ef[_0x48df('0x1f')]||'';this[_0x48df('0x20')]=_0x2ad2ef[_0x48df('0x20')]||'';}module[_0x48df('0x21')]=History; \ No newline at end of file +var _0xa90f=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xa90f,0x17c));var _0xfa90=function(_0x5a69ab,_0x610049){_0x5a69ab=_0x5a69ab-0x0;var _0x27f2f7=_0xa90f[_0x5a69ab];return _0x27f2f7;};'use strict';var util=require(_0xfa90('0x0'));var _=require(_0xfa90('0x1'));var moment=require(_0xfa90('0x2'));function getSeconds(_0x576575,_0x540d9a){var _0x3943c4=moment(_0x576575)[_0xfa90('0x3')](0x0);var _0x4565fe=moment(_0x540d9a)['milliseconds'](0x0);return _0x3943c4[_0xfa90('0x4')](_0x4565fe,'seconds');}function AdditionalPhone(_0x262519){this[_0xfa90('0x5')]=_0x262519['uniqueid'];this[_0xfa90('0x6')]=_0x262519['scheduledat']||undefined;this[_0xfa90('0x7')]=_0x262519[_0xfa90('0x7')];this[_0xfa90('0x8')]=_0x262519[_0xfa90('0x7')]===_0xfa90('0x9')?_0xfa90('0xa'):_0x262519[_0xfa90('0x7')];this[_0xfa90('0xb')]=_0x262519[_0xfa90('0xb')];this['countcongestionretry']=_0x262519[_0xfa90('0xc')];this['countnoanswerretry']=_0x262519[_0xfa90('0xd')];this[_0xfa90('0xe')]=_0x262519[_0xfa90('0xb')]+_0x262519['countcongestionretry']+_0x262519[_0xfa90('0xd')]+_0x262519['countnosuchnumberretry']+_0x262519[_0xfa90('0xf')]+_0x262519[_0xfa90('0x10')]+_0x262519[_0xfa90('0x11')]+_0x262519[_0xfa90('0x12')];this[_0xfa90('0x13')]=_0x262519[_0xfa90('0x13')];this['countdropretry']=_0x262519[_0xfa90('0xf')];this[_0xfa90('0x10')]=_0x262519[_0xfa90('0x10')];this[_0xfa90('0x11')]=_0x262519[_0xfa90('0x11')];this[_0xfa90('0x12')]=_0x262519[_0xfa90('0x12')];this[_0xfa90('0xa')]=_0x262519[_0xfa90('0xa')];this[_0xfa90('0x14')]=_0x262519[_0xfa90('0x15')];this[_0xfa90('0x16')]=_0x262519['number'];this['starttime']=_0x262519[_0xfa90('0x17')];this[_0xfa90('0x18')]=_0x262519[_0xfa90('0x18')];this[_0xfa90('0x19')]=_0x262519[_0xfa90('0x18')];this[_0xfa90('0x1a')]=getSeconds(_0x262519[_0xfa90('0x18')],_0x262519[_0xfa90('0x17')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0xfa90('0x1b')]=_0x262519[_0xfa90('0x1b')];this['callbackuniqueid']=_0x262519[_0xfa90('0x1c')];this[_0xfa90('0x1d')]=_0x262519[_0xfa90('0x1d')];this[_0xfa90('0x1e')]=_0x262519[_0xfa90('0x1e')];this[_0xfa90('0x1f')]=_0x262519[_0xfa90('0x1f')];this[_0xfa90('0x20')]=_0x262519[_0xfa90('0x20')];this[_0xfa90('0x21')]=_0x262519[_0xfa90('0x21')];this[_0xfa90('0x22')]=_0x262519[_0xfa90('0x22')];this['CampaignId']=_0x262519[_0xfa90('0x23')];this[_0xfa90('0x24')]=_0x262519['originatecalleridnum']||'';this['originatecalleridname']=_0x262519[_0xfa90('0x25')]||'';}module[_0xfa90('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 81ea69c..754682b 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 _0x2807=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x144929,_0x35767f){var _0x118e61=function(_0x5b5244){while(--_0x5b5244){_0x144929['push'](_0x144929['shift']());}};_0x118e61(++_0x35767f);}(_0x2807,0x1d8));var _0x7280=function(_0x359673,_0x595545){_0x359673=_0x359673-0x0;var _0x48c2ee=_0x2807[_0x359673];return _0x48c2ee;};'use strict';var util=require(_0x7280('0x0'));var _=require(_0x7280('0x1'));var moment=require(_0x7280('0x2'));function getSeconds(_0xf37c7b,_0x4af4f7){var _0x1a04a2=moment(_0xf37c7b)[_0x7280('0x3')](0x0);var _0x279de2=moment(_0x4af4f7)['milliseconds'](0x0);return _0x1a04a2['diff'](_0x279de2,_0x7280('0x4'));}function AgentComplete(_0x5f33a3,_0x265c91){this[_0x7280('0x5')]=0x4;this[_0x7280('0x6')]=_0x7280('0x7');this[_0x7280('0x8')]=_0x5f33a3[_0x7280('0x8')];this[_0x7280('0x9')]=_0x5f33a3[_0x7280('0x9')];this[_0x7280('0xa')]=_0x5f33a3[_0x7280('0x9')]===_0x7280('0xb')?'queue':_0x5f33a3[_0x7280('0x9')];this[_0x7280('0xc')]=_0x5f33a3[_0x7280('0xc')];this['countcongestionretry']=_0x5f33a3[_0x7280('0xd')];this[_0x7280('0xe')]=_0x5f33a3[_0x7280('0xe')];this[_0x7280('0xf')]=_0x5f33a3[_0x7280('0xc')]+_0x5f33a3[_0x7280('0xd')]+_0x5f33a3[_0x7280('0xe')]+_0x5f33a3[_0x7280('0x10')]+_0x5f33a3[_0x7280('0x11')]+_0x5f33a3[_0x7280('0x12')]+_0x5f33a3[_0x7280('0x13')]+_0x5f33a3[_0x7280('0x14')];this[_0x7280('0x10')]=_0x5f33a3[_0x7280('0x10')];this['countdropretry']=_0x5f33a3[_0x7280('0x11')];this[_0x7280('0x12')]=_0x5f33a3[_0x7280('0x12')];this[_0x7280('0x13')]=_0x5f33a3['countmachineretry'];this[_0x7280('0x14')]=_0x5f33a3[_0x7280('0x14')];this[_0x7280('0x15')]=_0x265c91[_0x7280('0x15')];this[_0x7280('0x16')]=_0x5f33a3[_0x7280('0x17')];this[_0x7280('0x18')]=_0x5f33a3[_0x7280('0x19')];this[_0x7280('0x1a')]=_0x5f33a3['starttime'];this[_0x7280('0x1b')]=_0x5f33a3[_0x7280('0x1b')];this[_0x7280('0x1c')]=_0x5f33a3[_0x7280('0x1c')];this[_0x7280('0x1d')]=moment()[_0x7280('0x1e')](_0x7280('0x1f'));this[_0x7280('0x20')]=getSeconds(_0x5f33a3[_0x7280('0x1b')],_0x5f33a3[_0x7280('0x1a')]);this[_0x7280('0x21')]=getSeconds(_0x5f33a3[_0x7280('0x1c')],_0x5f33a3[_0x7280('0x1b')]);this[_0x7280('0x22')]=getSeconds(this[_0x7280('0x1d')],_0x5f33a3['answertime']);this[_0x7280('0x23')]=_0x265c91['queue'];this['membername']=_0x265c91[_0x7280('0x24')];this['reason']=_0x265c91[_0x7280('0x25')];this[_0x7280('0x26')]=_0x5f33a3[_0x7280('0x26')];this[_0x7280('0x27')]=_0x5f33a3['callbackuniqueid'];this[_0x7280('0x28')]=_0x5f33a3['callbackat'];this['recallme']=_0x5f33a3['recallme'];this[_0x7280('0x29')]=_0x5f33a3[_0x7280('0x29')];this[_0x7280('0x2a')]=_0x5f33a3[_0x7280('0x2a')];this['UserId']=_0x5f33a3[_0x7280('0x2b')];this['VoiceQueueId']=_0x5f33a3[_0x7280('0x2c')];this['CampaignId']=_0x5f33a3[_0x7280('0x2d')];this[_0x7280('0x2e')]=_0x5f33a3['originatecalleridnum']||'';this[_0x7280('0x2f')]=_0x5f33a3[_0x7280('0x2f')]||'';}module[_0x7280('0x30')]=AgentComplete; \ No newline at end of file +var _0x1769=['talktime','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x1769,0x1f1));var _0x9176=function(_0x3b8885,_0x390f82){_0x3b8885=_0x3b8885-0x0;var _0x3718de=_0x1769[_0x3b8885];return _0x3718de;};'use strict';var util=require(_0x9176('0x0'));var _=require('lodash');var moment=require(_0x9176('0x1'));function getSeconds(_0xb05c01,_0x57b217){var _0x2a50bb=moment(_0xb05c01)[_0x9176('0x2')](0x0);var _0x37e90b=moment(_0x57b217)[_0x9176('0x2')](0x0);return _0x2a50bb[_0x9176('0x3')](_0x37e90b,_0x9176('0x4'));}function AgentComplete(_0x443701,_0x3a34e2){this['state']=0x4;this[_0x9176('0x5')]=_0x9176('0x6');this[_0x9176('0x7')]=_0x443701['scheduledat'];this[_0x9176('0x8')]=_0x443701[_0x9176('0x8')];this[_0x9176('0x9')]=_0x443701[_0x9176('0x8')]===_0x9176('0xa')?_0x9176('0xb'):_0x443701[_0x9176('0x8')];this[_0x9176('0xc')]=_0x443701['countbusyretry'];this[_0x9176('0xd')]=_0x443701[_0x9176('0xd')];this[_0x9176('0xe')]=_0x443701[_0x9176('0xe')];this[_0x9176('0xf')]=_0x443701[_0x9176('0xc')]+_0x443701[_0x9176('0xd')]+_0x443701[_0x9176('0xe')]+_0x443701[_0x9176('0x10')]+_0x443701['countdropretry']+_0x443701[_0x9176('0x11')]+_0x443701[_0x9176('0x12')]+_0x443701[_0x9176('0x13')];this[_0x9176('0x10')]=_0x443701[_0x9176('0x10')];this['countdropretry']=_0x443701['countdropretry'];this[_0x9176('0x11')]=_0x443701['countabandonedretry'];this[_0x9176('0x12')]=_0x443701[_0x9176('0x12')];this[_0x9176('0x13')]=_0x443701['countagentrejectretry'];this[_0x9176('0x14')]=_0x3a34e2['uniqueid'];this[_0x9176('0x15')]=_0x443701['name'];this[_0x9176('0x16')]=_0x443701[_0x9176('0x17')];this[_0x9176('0x18')]=_0x443701[_0x9176('0x18')];this[_0x9176('0x19')]=_0x443701[_0x9176('0x19')];this['answertime']=_0x443701[_0x9176('0x1a')];this[_0x9176('0x1b')]=moment()['format'](_0x9176('0x1c'));this[_0x9176('0x1d')]=getSeconds(_0x443701['responsetime'],_0x443701[_0x9176('0x18')]);this[_0x9176('0x1e')]=getSeconds(_0x443701[_0x9176('0x1a')],_0x443701[_0x9176('0x19')]);this[_0x9176('0x1f')]=getSeconds(this[_0x9176('0x1b')],_0x443701[_0x9176('0x1a')]);this[_0x9176('0xb')]=_0x3a34e2['queue'];this[_0x9176('0x20')]=_0x3a34e2[_0x9176('0x20')];this[_0x9176('0x21')]=_0x3a34e2[_0x9176('0x21')];this[_0x9176('0x22')]=_0x443701[_0x9176('0x22')];this['callbackuniqueid']=_0x443701['callbackuniqueid'];this[_0x9176('0x23')]=_0x443701[_0x9176('0x23')];this[_0x9176('0x24')]=_0x443701['recallme'];this['ContactId']=_0x443701[_0x9176('0x25')];this['ListId']=_0x443701[_0x9176('0x26')];this[_0x9176('0x27')]=_0x443701['UserId'];this[_0x9176('0x28')]=_0x443701[_0x9176('0x28')];this[_0x9176('0x29')]=_0x443701[_0x9176('0x29')];this[_0x9176('0x2a')]=_0x443701['originatecalleridnum']||'';this[_0x9176('0x2b')]=_0x443701[_0x9176('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 87fc866..256eb8d 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 _0xac7d=['starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','uniqueid','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0xac7d,0x1cb));var _0xdac7=function(_0xda7530,_0xd4f7db){_0xda7530=_0xda7530-0x0;var _0x27e498=_0xac7d[_0xda7530];return _0x27e498;};'use strict';var util=require(_0xdac7('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x599971,_0x5d7f60){var _0x586bb2=moment(_0x599971)[_0xdac7('0x1')](0x0);var _0x13fa23=moment(_0x5d7f60)[_0xdac7('0x1')](0x0);return _0x586bb2[_0xdac7('0x2')](_0x13fa23,'seconds');}function Final(_0x75333e){this[_0xdac7('0x3')]=_0x75333e[_0xdac7('0x3')];this['scheduledat']=_0x75333e['scheduledat'];this[_0xdac7('0x4')]=_0x75333e['type'];this['campaigntype']=_0x75333e[_0xdac7('0x4')]===_0xdac7('0x5')?'queue':_0x75333e[_0xdac7('0x4')];this[_0xdac7('0x6')]=_0x75333e['countbusyretry'];this[_0xdac7('0x7')]=_0x75333e['countcongestionretry'];this['countnoanswerretry']=_0x75333e[_0xdac7('0x8')];this['countglobal']=_0x75333e[_0xdac7('0x6')]+_0x75333e[_0xdac7('0x7')]+_0x75333e[_0xdac7('0x8')]+_0x75333e[_0xdac7('0x9')]+_0x75333e[_0xdac7('0xa')]+_0x75333e[_0xdac7('0xb')]+_0x75333e[_0xdac7('0xc')]+_0x75333e[_0xdac7('0xd')];this[_0xdac7('0x9')]=_0x75333e[_0xdac7('0x9')];this[_0xdac7('0xa')]=_0x75333e['countdropretry'];this[_0xdac7('0xb')]=_0x75333e['countabandonedretry'];this['countmachineretry']=_0x75333e[_0xdac7('0xc')];this[_0xdac7('0xd')]=_0x75333e[_0xdac7('0xd')];this[_0xdac7('0xe')]=_0x75333e['queue'];this[_0xdac7('0xf')]=_0x75333e['calleridname'];this['calleridnum']=_0x75333e[_0xdac7('0x10')];this['starttime']=_0x75333e[_0xdac7('0x11')];this[_0xdac7('0x12')]=_0x75333e[_0xdac7('0x12')];this['endtime']=_0x75333e[_0xdac7('0x12')];this[_0xdac7('0x13')]=_0x75333e[_0xdac7('0x13')]||0x0;this['holdtime']=_0x75333e[_0xdac7('0x14')]||0x0;this[_0xdac7('0x15')]=_0x75333e['talktime']||0x0;this[_0xdac7('0x16')]=_0x75333e[_0xdac7('0x16')];this[_0xdac7('0x17')]=_0x75333e[_0xdac7('0x17')];this[_0xdac7('0x18')]=_0x75333e[_0xdac7('0x18')];this[_0xdac7('0x19')]=_0x75333e[_0xdac7('0x19')];this[_0xdac7('0x1a')]=_0x75333e[_0xdac7('0x1a')];this[_0xdac7('0x1b')]=_0x75333e['ListId'];this[_0xdac7('0x1c')]=_0x75333e[_0xdac7('0x1c')];this['VoiceQueueId']=_0x75333e[_0xdac7('0x1d')];this[_0xdac7('0x1e')]=_0x75333e[_0xdac7('0x1e')];this[_0xdac7('0x1f')]=_0x75333e[_0xdac7('0x1f')]||'';this['originatecalleridname']=_0x75333e[_0xdac7('0x20')]||'';}module[_0xdac7('0x21')]=Final; \ No newline at end of file +var _0xb5ed=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0xb5ed,0x139));var _0xdb5e=function(_0x33680c,_0x17c254){_0x33680c=_0x33680c-0x0;var _0x37f88a=_0xb5ed[_0x33680c];return _0x37f88a;};'use strict';var util=require('util');var _=require(_0xdb5e('0x0'));var moment=require('moment');function getSeconds(_0x2b7f18,_0x4c0f09){var _0x1ef5e2=moment(_0x2b7f18)[_0xdb5e('0x1')](0x0);var _0x5a530b=moment(_0x4c0f09)['milliseconds'](0x0);return _0x1ef5e2[_0xdb5e('0x2')](_0x5a530b,_0xdb5e('0x3'));}function Final(_0x3c2e57){this['uniqueid']=_0x3c2e57['uniqueid'];this[_0xdb5e('0x4')]=_0x3c2e57[_0xdb5e('0x4')];this[_0xdb5e('0x5')]=_0x3c2e57[_0xdb5e('0x5')];this['campaigntype']=_0x3c2e57[_0xdb5e('0x5')]===_0xdb5e('0x6')?'queue':_0x3c2e57[_0xdb5e('0x5')];this[_0xdb5e('0x7')]=_0x3c2e57[_0xdb5e('0x7')];this['countcongestionretry']=_0x3c2e57[_0xdb5e('0x8')];this[_0xdb5e('0x9')]=_0x3c2e57['countnoanswerretry'];this[_0xdb5e('0xa')]=_0x3c2e57[_0xdb5e('0x7')]+_0x3c2e57[_0xdb5e('0x8')]+_0x3c2e57[_0xdb5e('0x9')]+_0x3c2e57[_0xdb5e('0xb')]+_0x3c2e57[_0xdb5e('0xc')]+_0x3c2e57[_0xdb5e('0xd')]+_0x3c2e57[_0xdb5e('0xe')]+_0x3c2e57[_0xdb5e('0xf')];this[_0xdb5e('0xb')]=_0x3c2e57[_0xdb5e('0xb')];this['countdropretry']=_0x3c2e57[_0xdb5e('0xc')];this[_0xdb5e('0xd')]=_0x3c2e57[_0xdb5e('0xd')];this[_0xdb5e('0xe')]=_0x3c2e57[_0xdb5e('0xe')];this[_0xdb5e('0xf')]=_0x3c2e57['countagentrejectretry'];this['queue']=_0x3c2e57['queue'];this[_0xdb5e('0x10')]=_0x3c2e57[_0xdb5e('0x10')];this['calleridnum']=_0x3c2e57[_0xdb5e('0x11')];this['starttime']=_0x3c2e57[_0xdb5e('0x12')];this[_0xdb5e('0x13')]=_0x3c2e57[_0xdb5e('0x13')];this[_0xdb5e('0x14')]=_0x3c2e57['responsetime'];this['ringtime']=_0x3c2e57[_0xdb5e('0x15')]||0x0;this[_0xdb5e('0x16')]=_0x3c2e57[_0xdb5e('0x16')]||0x0;this['talktime']=_0x3c2e57[_0xdb5e('0x17')]||0x0;this[_0xdb5e('0x18')]=_0x3c2e57['callback'];this[_0xdb5e('0x19')]=_0x3c2e57[_0xdb5e('0x19')];this['callbackat']=_0x3c2e57[_0xdb5e('0x1a')];this[_0xdb5e('0x1b')]=_0x3c2e57['recallme'];this[_0xdb5e('0x1c')]=_0x3c2e57[_0xdb5e('0x1c')];this[_0xdb5e('0x1d')]=_0x3c2e57[_0xdb5e('0x1d')];this[_0xdb5e('0x1e')]=_0x3c2e57[_0xdb5e('0x1e')];this['VoiceQueueId']=_0x3c2e57[_0xdb5e('0x1f')];this['CampaignId']=_0x3c2e57[_0xdb5e('0x20')];this[_0xdb5e('0x21')]=_0x3c2e57[_0xdb5e('0x21')]||'';this['originatecalleridname']=_0x3c2e57[_0xdb5e('0x22')]||'';}module[_0xdb5e('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 9330753..c1b9911 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 _0x0217=['ListId','UserId','VoiceQueueId','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x461d52,_0x43604b){var _0x25d252=function(_0x3bdc91){while(--_0x3bdc91){_0x461d52['push'](_0x461d52['shift']());}};_0x25d252(++_0x43604b);}(_0x0217,0xac));var _0x7021=function(_0x4ea845,_0x59dc7f){_0x4ea845=_0x4ea845-0x0;var _0x9b62e5=_0x0217[_0x4ea845];return _0x9b62e5;};'use strict';var util=require(_0x7021('0x0'));var _=require(_0x7021('0x1'));var moment=require(_0x7021('0x2'));function getSeconds(_0x3ca0d1,_0x4fa7e0){var _0x57483e=moment(_0x3ca0d1)[_0x7021('0x3')](0x0);var _0x1871e2=moment(_0x4fa7e0)[_0x7021('0x3')](0x0);return _0x57483e['diff'](_0x1871e2,_0x7021('0x4'));}function Hangup(_0x1ffd87,_0x469c3a){this['state']=0x4;this['statedesc']='Answer';this['scheduledat']=_0x1ffd87[_0x7021('0x5')];this[_0x7021('0x6')]=_0x1ffd87[_0x7021('0x6')];this[_0x7021('0x7')]=_0x1ffd87['type']===_0x7021('0x8')?_0x7021('0x9'):_0x1ffd87['type'];this['countbusyretry']=_0x1ffd87['countbusyretry'];this[_0x7021('0xa')]=_0x1ffd87[_0x7021('0xa')];this[_0x7021('0xb')]=_0x1ffd87[_0x7021('0xb')];this['countglobal']=_0x1ffd87[_0x7021('0xc')]+_0x1ffd87[_0x7021('0xa')]+_0x1ffd87[_0x7021('0xb')]+_0x1ffd87[_0x7021('0xd')]+_0x1ffd87['countdropretry']+_0x1ffd87[_0x7021('0xe')]+_0x1ffd87[_0x7021('0xf')]+_0x1ffd87[_0x7021('0x10')];this['countnosuchnumberretry']=_0x1ffd87['countnosuchnumberretry'];this[_0x7021('0x11')]=_0x1ffd87[_0x7021('0x11')];this[_0x7021('0xe')]=_0x1ffd87[_0x7021('0xe')];this['countmachineretry']=_0x1ffd87[_0x7021('0xf')];this[_0x7021('0x10')]=_0x1ffd87[_0x7021('0x10')];this[_0x7021('0x12')]=_0x469c3a[_0x7021('0x12')];this[_0x7021('0x13')]=_0x1ffd87['name'];this[_0x7021('0x14')]=_0x1ffd87[_0x7021('0x15')];this['starttime']=_0x1ffd87[_0x7021('0x16')];this[_0x7021('0x17')]=_0x1ffd87[_0x7021('0x17')];this[_0x7021('0x18')]=moment()[_0x7021('0x19')](_0x7021('0x1a'));this[_0x7021('0x1b')]=getSeconds(_0x1ffd87['responsetime'],_0x1ffd87[_0x7021('0x16')]);this[_0x7021('0x1c')]=0x0;this['talktime']=getSeconds(this[_0x7021('0x18')],_0x1ffd87['responsetime']);this[_0x7021('0x9')]=_0x1ffd87[_0x7021('0x9')];this[_0x7021('0x1d')]=_0x7021('0x1e');this[_0x7021('0x1f')]=_0x469c3a[_0x7021('0x20')];this[_0x7021('0x21')]=_0x1ffd87[_0x7021('0x21')];this['callbackuniqueid']=_0x1ffd87[_0x7021('0x22')];this['callbackat']=_0x1ffd87[_0x7021('0x23')];this[_0x7021('0x24')]=_0x1ffd87[_0x7021('0x24')];this[_0x7021('0x25')]=_0x1ffd87['ContactId'];this[_0x7021('0x26')]=_0x1ffd87[_0x7021('0x26')];this[_0x7021('0x27')]=_0x1ffd87[_0x7021('0x27')];this['VoiceQueueId']=_0x1ffd87[_0x7021('0x28')];this['CampaignId']=_0x1ffd87['CampaignId'];}module[_0x7021('0x29')]=Hangup; \ No newline at end of file +var _0x46af=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','diff','Answer','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x141910,_0x815a43){var _0x23a2a5=function(_0x1cfd64){while(--_0x1cfd64){_0x141910['push'](_0x141910['shift']());}};_0x23a2a5(++_0x815a43);}(_0x46af,0x189));var _0xf46a=function(_0x1503f6,_0x419b3d){_0x1503f6=_0x1503f6-0x0;var _0x5d8543=_0x46af[_0x1503f6];return _0x5d8543;};'use strict';var util=require(_0xf46a('0x0'));var _=require(_0xf46a('0x1'));var moment=require(_0xf46a('0x2'));function getSeconds(_0x18d0eb,_0x3b9b30){var _0x5c9b79=moment(_0x18d0eb)['milliseconds'](0x0);var _0x2eb532=moment(_0x3b9b30)['milliseconds'](0x0);return _0x5c9b79[_0xf46a('0x3')](_0x2eb532,'seconds');}function Hangup(_0x2f7956,_0x278740){this['state']=0x4;this['statedesc']=_0xf46a('0x4');this['scheduledat']=_0x2f7956[_0xf46a('0x5')];this['type']=_0x2f7956[_0xf46a('0x6')];this['campaigntype']=_0x2f7956[_0xf46a('0x6')]==='outbound'?_0xf46a('0x7'):_0x2f7956['type'];this[_0xf46a('0x8')]=_0x2f7956[_0xf46a('0x8')];this[_0xf46a('0x9')]=_0x2f7956[_0xf46a('0x9')];this['countnoanswerretry']=_0x2f7956[_0xf46a('0xa')];this[_0xf46a('0xb')]=_0x2f7956['countbusyretry']+_0x2f7956[_0xf46a('0x9')]+_0x2f7956[_0xf46a('0xa')]+_0x2f7956[_0xf46a('0xc')]+_0x2f7956[_0xf46a('0xd')]+_0x2f7956['countabandonedretry']+_0x2f7956[_0xf46a('0xe')]+_0x2f7956[_0xf46a('0xf')];this['countnosuchnumberretry']=_0x2f7956[_0xf46a('0xc')];this[_0xf46a('0xd')]=_0x2f7956[_0xf46a('0xd')];this[_0xf46a('0x10')]=_0x2f7956[_0xf46a('0x10')];this[_0xf46a('0xe')]=_0x2f7956[_0xf46a('0xe')];this[_0xf46a('0xf')]=_0x2f7956['countagentrejectretry'];this['uniqueid']=_0x278740[_0xf46a('0x11')];this[_0xf46a('0x12')]=_0x2f7956[_0xf46a('0x13')];this[_0xf46a('0x14')]=_0x2f7956[_0xf46a('0x15')];this[_0xf46a('0x16')]=_0x2f7956['starttime'];this['responsetime']=_0x2f7956['responsetime'];this['endtime']=moment()[_0xf46a('0x17')](_0xf46a('0x18'));this[_0xf46a('0x19')]=getSeconds(_0x2f7956[_0xf46a('0x1a')],_0x2f7956[_0xf46a('0x16')]);this[_0xf46a('0x1b')]=0x0;this[_0xf46a('0x1c')]=getSeconds(this[_0xf46a('0x1d')],_0x2f7956[_0xf46a('0x1a')]);this[_0xf46a('0x7')]=_0x2f7956[_0xf46a('0x7')];this[_0xf46a('0x1e')]=_0xf46a('0x1f');this[_0xf46a('0x20')]=_0x278740[_0xf46a('0x21')];this[_0xf46a('0x22')]=_0x2f7956['callback'];this[_0xf46a('0x23')]=_0x2f7956[_0xf46a('0x23')];this[_0xf46a('0x24')]=_0x2f7956[_0xf46a('0x24')];this[_0xf46a('0x25')]=_0x2f7956[_0xf46a('0x25')];this[_0xf46a('0x26')]=_0x2f7956[_0xf46a('0x26')];this[_0xf46a('0x27')]=_0x2f7956[_0xf46a('0x27')];this[_0xf46a('0x28')]=_0x2f7956[_0xf46a('0x28')];this[_0xf46a('0x29')]=_0x2f7956[_0xf46a('0x29')];this['CampaignId']=_0x2f7956[_0xf46a('0x2a')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index b5c97cf..223d4bd 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 _0x1320=['countagentrejectretry','countdropretry','queue','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry'];(function(_0x1a8cf1,_0x4a933e){var _0x23e11d=function(_0x5a8c17){while(--_0x5a8c17){_0x1a8cf1['push'](_0x1a8cf1['shift']());}};_0x23e11d(++_0x4a933e);}(_0x1320,0x128));var _0x0132=function(_0x16154c,_0x29b943){_0x16154c=_0x16154c-0x0;var _0x4a2bb8=_0x1320[_0x16154c];return _0x4a2bb8;};'use strict';var util=require(_0x0132('0x0'));var _=require(_0x0132('0x1'));var moment=require(_0x0132('0x2'));function getSeconds(_0x3f7809,_0x248c15){var _0x353545=moment(_0x3f7809)['milliseconds'](0x0);var _0x4f1267=moment(_0x248c15)[_0x0132('0x3')](0x0);return _0x353545[_0x0132('0x4')](_0x4f1267,_0x0132('0x5'));}function History(_0x1bc1f8){this[_0x0132('0x6')]=_0x1bc1f8[_0x0132('0x6')];this['scheduledat']=_0x1bc1f8[_0x0132('0x7')]||undefined;this[_0x0132('0x8')]=_0x1bc1f8['type'];this[_0x0132('0x9')]=_0x1bc1f8[_0x0132('0x8')]==='outbound'?'queue':_0x1bc1f8[_0x0132('0x8')];this[_0x0132('0xa')]=_0x1bc1f8[_0x0132('0xa')];this[_0x0132('0xb')]=_0x1bc1f8[_0x0132('0xb')];this['countnoanswerretry']=_0x1bc1f8[_0x0132('0xc')];this['countglobal']=_0x1bc1f8['countbusyretry']+_0x1bc1f8[_0x0132('0xb')]+_0x1bc1f8[_0x0132('0xc')]+_0x1bc1f8[_0x0132('0xd')]+_0x1bc1f8['countdropretry']+_0x1bc1f8[_0x0132('0xe')]+_0x1bc1f8[_0x0132('0xf')]+_0x1bc1f8[_0x0132('0x10')];this[_0x0132('0xd')]=_0x1bc1f8[_0x0132('0xd')];this[_0x0132('0x11')]=_0x1bc1f8[_0x0132('0x11')];this[_0x0132('0xe')]=_0x1bc1f8[_0x0132('0xe')];this[_0x0132('0xf')]=_0x1bc1f8[_0x0132('0xf')];this[_0x0132('0x10')]=_0x1bc1f8[_0x0132('0x10')];this[_0x0132('0x12')]=_0x1bc1f8[_0x0132('0x12')];this['calleridname']=_0x1bc1f8[_0x0132('0x13')];this[_0x0132('0x14')]=_0x1bc1f8[_0x0132('0x15')];this[_0x0132('0x16')]=_0x1bc1f8[_0x0132('0x16')];this['responsetime']=_0x1bc1f8[_0x0132('0x17')];this[_0x0132('0x18')]=_0x1bc1f8[_0x0132('0x17')];this[_0x0132('0x19')]=getSeconds(_0x1bc1f8[_0x0132('0x17')],_0x1bc1f8[_0x0132('0x16')]);this['holdtime']=0x0;this[_0x0132('0x1a')]=0x0;this[_0x0132('0x1b')]=_0x1bc1f8[_0x0132('0x1b')];this[_0x0132('0x1c')]=_0x1bc1f8[_0x0132('0x1c')];this[_0x0132('0x1d')]=_0x1bc1f8['callbackat'];this[_0x0132('0x1e')]=_0x1bc1f8['recallme'];this[_0x0132('0x1f')]=_0x1bc1f8[_0x0132('0x1f')];this[_0x0132('0x20')]=_0x1bc1f8['ListId'];this[_0x0132('0x21')]=_0x1bc1f8[_0x0132('0x21')];this[_0x0132('0x22')]=_0x1bc1f8[_0x0132('0x22')];this[_0x0132('0x23')]=_0x1bc1f8['CampaignId'];this[_0x0132('0x24')]=_0x1bc1f8[_0x0132('0x24')]||'';this['originatecalleridname']=_0x1bc1f8[_0x0132('0x25')]||'';}module[_0x0132('0x26')]=History; \ No newline at end of file +var _0x1521=['countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x2b5ef3,_0x3dc220){var _0x5aa683=function(_0x1b8b07){while(--_0x1b8b07){_0x2b5ef3['push'](_0x2b5ef3['shift']());}};_0x5aa683(++_0x3dc220);}(_0x1521,0x11c));var _0x1152=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x1521[_0x429948];return _0x35d5d1;};'use strict';var util=require('util');var _=require(_0x1152('0x0'));var moment=require(_0x1152('0x1'));function getSeconds(_0x679fb2,_0x3f90d5){var _0x1ee1af=moment(_0x679fb2)[_0x1152('0x2')](0x0);var _0x17b2f1=moment(_0x3f90d5)['milliseconds'](0x0);return _0x1ee1af[_0x1152('0x3')](_0x17b2f1,'seconds');}function History(_0x354b22){this[_0x1152('0x4')]=_0x354b22[_0x1152('0x4')];this['scheduledat']=_0x354b22[_0x1152('0x5')]||undefined;this[_0x1152('0x6')]=_0x354b22[_0x1152('0x6')];this['campaigntype']=_0x354b22[_0x1152('0x6')]===_0x1152('0x7')?_0x1152('0x8'):_0x354b22[_0x1152('0x6')];this[_0x1152('0x9')]=_0x354b22['countbusyretry'];this[_0x1152('0xa')]=_0x354b22[_0x1152('0xa')];this[_0x1152('0xb')]=_0x354b22[_0x1152('0xb')];this[_0x1152('0xc')]=_0x354b22[_0x1152('0x9')]+_0x354b22[_0x1152('0xa')]+_0x354b22[_0x1152('0xb')]+_0x354b22['countnosuchnumberretry']+_0x354b22[_0x1152('0xd')]+_0x354b22[_0x1152('0xe')]+_0x354b22['countmachineretry']+_0x354b22['countagentrejectretry'];this['countnosuchnumberretry']=_0x354b22[_0x1152('0xf')];this['countdropretry']=_0x354b22[_0x1152('0xd')];this['countabandonedretry']=_0x354b22[_0x1152('0xe')];this[_0x1152('0x10')]=_0x354b22['countmachineretry'];this[_0x1152('0x11')]=_0x354b22[_0x1152('0x11')];this[_0x1152('0x8')]=_0x354b22[_0x1152('0x8')];this[_0x1152('0x12')]=_0x354b22['name'];this[_0x1152('0x13')]=_0x354b22['number'];this['starttime']=_0x354b22[_0x1152('0x14')];this['responsetime']=_0x354b22['responsetime'];this[_0x1152('0x15')]=_0x354b22[_0x1152('0x16')];this[_0x1152('0x17')]=getSeconds(_0x354b22[_0x1152('0x16')],_0x354b22[_0x1152('0x14')]);this['holdtime']=0x0;this[_0x1152('0x18')]=0x0;this[_0x1152('0x19')]=_0x354b22[_0x1152('0x19')];this[_0x1152('0x1a')]=_0x354b22[_0x1152('0x1a')];this[_0x1152('0x1b')]=_0x354b22[_0x1152('0x1b')];this['recallme']=_0x354b22[_0x1152('0x1c')];this[_0x1152('0x1d')]=_0x354b22['ContactId'];this[_0x1152('0x1e')]=_0x354b22[_0x1152('0x1e')];this[_0x1152('0x1f')]=_0x354b22[_0x1152('0x1f')];this[_0x1152('0x20')]=_0x354b22['VoiceQueueId'];this['CampaignId']=_0x354b22[_0x1152('0x21')];this[_0x1152('0x22')]=_0x354b22[_0x1152('0x22')]||'';this[_0x1152('0x23')]=_0x354b22[_0x1152('0x23')]||'';}module[_0x1152('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index bc06c1b..18c5835 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 _0xdbe5=['launchHandleIvr','handleIvr','syncQueueSummary','dialActive','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','buildObj','dialNoSuchNumberMaxRetry','noanswer','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','predictiveIntervalErlangCallsDroppedCalls','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','dialRecallMeTimeout','Agent','run','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\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','Interval:\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','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','defaults','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','roundrobin','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','format','voice_queue:save','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startProgressive','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','stack','error','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','[actions]','enqueue','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','notFound','saveInDb','ListId','[emptyContact][createHistory]','Success','SIP/%s','status','unmonitored','uniqueid','variable','xcally-motion-dialer','dialAMDActive','value','state','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','outboundAnswerCallsDay','countmachineretry','countglobal','amd','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','CampaignId','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','[syncAgentComplete][createHistory][0]','countcongestionretry','add','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','reason','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','rrmemory','idHopper','queueStatusComplete','pick','syncQueueStatusComplete','[unlock][syncQueueStatusComplete]','_rr','unlockRR','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','method\x20not\x20recognized'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xdbe5,0xbb));var _0x5dbe=function(_0x45821b,_0x4e1691){_0x45821b=_0x45821b-0x0;var _0x338e15=_0xdbe5[_0x45821b];return _0x338e15;};'use strict';var util=require('util');var _=require(_0x5dbe('0x0'));var BPromise=require(_0x5dbe('0x1'));var uuid=require('uuid');var moment=require(_0x5dbe('0x2'));var rr=require('rr');var md5=require(_0x5dbe('0x3'));var Redis=require(_0x5dbe('0x4'));var ut=require(_0x5dbe('0x5'));var config=require(_0x5dbe('0x6'));var logger=require(_0x5dbe('0x7'))(_0x5dbe('0x8'));var loggerBooked=require('../../../config/logger')(_0x5dbe('0x9'));var loggerPredictive=require(_0x5dbe('0x7'))(_0x5dbe('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0x5dbe('0xb'));var loggerSyncQueueSummary=require(_0x5dbe('0x7'))('syncQueueSummary');var ami=require(_0x5dbe('0xc'));config['redis']=_[_0x5dbe('0xd')](config[_0x5dbe('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x5dbe('0xf'))(new Redis(config[_0x5dbe('0xe')]));var cmHopper=require(_0x5dbe('0x10'));var cmHopperFinal=require(_0x5dbe('0x11'));var cmHopperHistory=require(_0x5dbe('0x12'));var cmHopperBlack=require(_0x5dbe('0x13'));var voiceQueueRt=require(_0x5dbe('0x14'));var Action=require(_0x5dbe('0x15'));var History=require(_0x5dbe('0x16'));var Final=require(_0x5dbe('0x17'));var AgentComplete=require(_0x5dbe('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x5dbe('0x19'));var ipAgi=process[_0x5dbe('0x1a')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x5dbe('0x1b')};var Sequence=function(){};Sequence[_0x5dbe('0x1c')]['enqueue']=function(_0x2987fd){this[_0x5dbe('0x1d')]=this[_0x5dbe('0x1d')]?this[_0x5dbe('0x1d')]['finally'](_0x2987fd):_0x2987fd();};function Dialer(_0x42082b,_0x40be03){this[_0x5dbe('0x1e')]=new Sequence();this[_0x5dbe('0x1f')]=_0x40be03;this['voiceQueues']=_0x42082b[_0x5dbe('0x20')];this[_0x5dbe('0x21')]=_0x42082b[_0x5dbe('0x21')];this[_0x5dbe('0x22')]=_0x42082b[_0x5dbe('0x22')];this[_0x5dbe('0x23')]=_0x42082b[_0x5dbe('0x23')];this[_0x5dbe('0x24')]=config['maxNumberOriginate']||0x2;this[_0x5dbe('0x25')]={};this[_0x5dbe('0x26')]={};this[_0x5dbe('0x27')]={};this['uniqueId']={};this[_0x5dbe('0x28')]={};this[_0x5dbe('0x29')]={};this['startProgressive']={};this[_0x5dbe('0x2a')]={};this[_0x5dbe('0x2b')]={};this[_0x5dbe('0x2c')]={};ami['on']('agentconnect',this[_0x5dbe('0x2d')][_0x5dbe('0x2e')](this));ami['on'](_0x5dbe('0x2f'),this[_0x5dbe('0x30')][_0x5dbe('0x2e')](this));ami['on'](_0x5dbe('0x31'),this[_0x5dbe('0x32')][_0x5dbe('0x2e')](this));ami['on'](_0x5dbe('0x33'),this[_0x5dbe('0x34')]['bind'](this));ami['on'](_0x5dbe('0x35'),this['syncQueueSummary'][_0x5dbe('0x2e')](this));ami['on'](_0x5dbe('0x36'),this[_0x5dbe('0x37')]['bind'](this));ami['on'](_0x5dbe('0x38'),this[_0x5dbe('0x39')]['bind'](this));ami['on'](_0x5dbe('0x3a'),this[_0x5dbe('0x3b')][_0x5dbe('0x2e')](this));ami['on'](_0x5dbe('0x3c'),this['syncQueueMember']['bind'](this));ami['on'](_0x5dbe('0x3d'),this['syncQueueStatusComplete'][_0x5dbe('0x2e')](this));this[_0x5dbe('0x3e')]();this[_0x5dbe('0x3f')]();}function isNotNull(_0x580dcb){return _0x580dcb!==null&&!_[_0x5dbe('0x40')](_0x580dcb);}function checkIsLoggedIn(_0x195544,_0x3c96a4){return function(){if(_0x3c96a4<=0x0){_0x195544[_0x5dbe('0x41')]=_0x5dbe('0x42');throw _0x195544[_0x5dbe('0x43')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x476d15){return _0x476d15;}function checkIsActive(_0x44de3a,_0x3fefa5){return function(){if(!isActive(_0x3fefa5)){_0x44de3a[_0x5dbe('0x41')]=_0x5dbe('0x44');throw _0x44de3a[_0x5dbe('0x43')]+_0x5dbe('0x45');}};}function checkInterval(_0x2ff198){return function(){if(!isNotNull(_0x2ff198[_0x5dbe('0x46')])){_0x2ff198['message']=_0x5dbe('0x47');throw _0x2ff198[_0x5dbe('0x43')]+_0x5dbe('0x48');}if(!isNotNull(_0x2ff198[_0x5dbe('0x46')][_0x5dbe('0x49')])){_0x2ff198[_0x5dbe('0x41')]=_0x5dbe('0x47');throw _0x2ff198['name']+_0x5dbe('0x48');}if(!isNotNull(_[_0x5dbe('0x4a')](_0x2ff198[_0x5dbe('0x46')][_0x5dbe('0x49')]))){_0x2ff198[_0x5dbe('0x41')]=_0x5dbe('0x47');throw _0x2ff198[_0x5dbe('0x43')]+_0x5dbe('0x48');}};}function msgResponse(_0x1d1049,_0x2bafe3,_0x134f8b){return{'action':_0x1d1049,'response':_0x2bafe3,'message':_0x134f8b,'stack':_0x134f8b};}function myreject(_0xcfd686){return function(_0x8b2cc6){return _0xcfd686(msgResponse(_0x5dbe('0x4b'),_0x5dbe('0x4c'),JSON[_0x5dbe('0x4d')](_0x8b2cc6)));};}function getSeconds(_0x5a7321,_0x2e83c6){var _0xb79c47=moment(_0x5a7321)[_0x5dbe('0x4e')](0x0);var _0x3b7936=moment(_0x2e83c6)[_0x5dbe('0x4e')](0x0);return _0xb79c47[_0x5dbe('0x4f')](_0x3b7936,_0x5dbe('0x50'));}function emit(_0x13e9d0,_0x1710ed,_0x29fcc6){io['to'](_0x13e9d0)[_0x5dbe('0x51')](_0x1710ed,_0x29fcc6);}function emitVoiceQueueSummary(_0x1f998f){if(_0x1f998f['type']==='outbound'){var _0x2c1426={'id':_0x1f998f['id'],'name':_0x1f998f[_0x5dbe('0x43')],'strategy':_0x1f998f[_0x5dbe('0x52')],'answered':_0x1f998f[_0x5dbe('0x53')],'available':_0x1f998f[_0x5dbe('0x54')],'loggedIn':_0x1f998f[_0x5dbe('0x55')],'pTalking':_0x1f998f[_0x5dbe('0x56')],'sumBillable':_0x1f998f['sumBillable'],'sumDuration':_0x1f998f[_0x5dbe('0x57')],'sumHoldTime':_0x1f998f[_0x5dbe('0x58')]||0x0,'talking':_0x1f998f[_0x5dbe('0x59')],'total':_0x1f998f[_0x5dbe('0x5a')],'type':_0x1f998f[_0x5dbe('0x5b')],'unmanaged':_0x1f998f[_0x5dbe('0x5c')],'abandoned':_0x1f998f[_0x5dbe('0x5d')],'waiting':_0x1f998f[_0x5dbe('0x5e')],'loggedInDb':_0x1f998f[_0x5dbe('0x5f')],'dialActive':_0x1f998f['dialActive'],'dialMethod':_0x1f998f[_0x5dbe('0x60')],'dialOriginateCallerIdName':_0x1f998f[_0x5dbe('0x61')],'dialOriginateCallerIdNumber':_0x1f998f[_0x5dbe('0x62')],'dialOriginateTimeout':_0x1f998f[_0x5dbe('0x63')],'dialPrefix':_0x1f998f[_0x5dbe('0x64')],'outboundAnswerAgiCallsDay':_0x1f998f[_0x5dbe('0x65')],'outboundAnswerCallsDay':_0x1f998f['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1f998f[_0x5dbe('0x66')],'outboundBusyCallsDay':_0x1f998f[_0x5dbe('0x67')],'outboundCongestionCallsDay':_0x1f998f[_0x5dbe('0x68')],'outboundDropCallsDayACS':_0x1f998f[_0x5dbe('0x69')],'outboundDropCallsDayCallersExit':_0x1f998f[_0x5dbe('0x6a')],'outboundDropCallsDayTimeout':_0x1f998f[_0x5dbe('0x6b')],'outboundNoAnswerCallsDay':_0x1f998f[_0x5dbe('0x6c')],'outboundNoSuchCallsDay':_0x1f998f[_0x5dbe('0x6d')],'outboundOriginateFailureCallsDay':_0x1f998f[_0x5dbe('0x6e')],'outboundReCallsDay':_0x1f998f[_0x5dbe('0x6f')],'outboundRejectCallsDay':_0x1f998f['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1f998f['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x1f998f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1f998f['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1f998f[_0x5dbe('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x1f998f[_0x5dbe('0x71')],'predictiveIntervalDroppedCallsTimeout':_0x1f998f['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1f998f[_0x5dbe('0x72')],'predictiveIntervalErlangCallsDroppedCalls':_0x1f998f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1f998f[_0x5dbe('0x73')],'predictiveIntervalMultiplicativeFactor':_0x1f998f[_0x5dbe('0x74')],'predictiveIntervalPauses':_0x1f998f[_0x5dbe('0x75')],'predictiveIntervalAvailable':_0x1f998f[_0x5dbe('0x76')],'predictiveIntervalTotalCalls':_0x1f998f[_0x5dbe('0x77')],'message':_0x1f998f[_0x5dbe('0x41')],'originated':_0x1f998f[_0x5dbe('0x78')],'erlangCalls':_0x1f998f['erlangCalls'],'erlangCallToSecond':_0x1f998f[_0x5dbe('0x79')],'erlangAbandonmentRate':_0x1f998f[_0x5dbe('0x7a')],'erlangBusyFactor':_0x1f998f['erlangBusyFactor'],'startPredictive':_0x1f998f['startPredictive'],'startProgressive':_0x1f998f['startProgressive']};if(_0x1f998f[_0x5dbe('0x7b')]){_0x2c1426[_0x5dbe('0x7b')]={'id':_0x1f998f[_0x5dbe('0x7b')]['id'],'name':_0x1f998f[_0x5dbe('0x7b')]['name'],'active':_0x1f998f['Trunk'][_0x5dbe('0x7c')],'callerid':_0x1f998f[_0x5dbe('0x7b')][_0x5dbe('0x7d')]};}if(_0x1f998f[_0x5dbe('0x46')]){_0x2c1426[_0x5dbe('0x46')]={'id':_0x1f998f[_0x5dbe('0x46')]['id'],'name':_0x1f998f[_0x5dbe('0x46')][_0x5dbe('0x43')]};}var _0xd54999=md5(JSON[_0x5dbe('0x4d')](_0x2c1426));if(_0x1f998f[_0x5dbe('0x3')]!==_0xd54999){_0x1f998f[_0x5dbe('0x3')]=_0xd54999;emit(util[_0x5dbe('0x7e')]('voice:queue:%s',_0x2c1426['name']),_0x5dbe('0x7f'),_0x2c1426);}}}function emitCampaignSummary(_0x4b6c0a){if(_0x4b6c0a[_0x5dbe('0x5b')]==='ivr'){emit(util[_0x5dbe('0x7e')](_0x5dbe('0x80'),_0x4b6c0a[_0x5dbe('0x43')]),_0x5dbe('0x81'),_0x4b6c0a);}}function checkGetDataPredictive(_0x3516ca){if(isNotNull(_0x3516ca)){if(!_[_0x5dbe('0x4a')](_0x3516ca)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x83'),_0x3516ca[_0x5dbe('0x77')]);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x84'),_0x3516ca[_0x5dbe('0x85')]);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x86'),_0x3516ca[_0x5dbe('0x87')]);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x88'),_0x3516ca[_0x5dbe('0x71')]);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x89'),_0x3516ca[_0x5dbe('0x8a')]);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x8b'),_0x3516ca[_0x5dbe('0x70')]);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x8c'));if(_0x3516ca[_0x5dbe('0x77')]>0x0){if(!_[_0x5dbe('0x40')](_0x3516ca['predictiveIntervalAvgTalktime'])&&_0x3516ca[_0x5dbe('0x70')]>0x0){return!![];}else{loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x8d'));}if(!_['isUndefined'](_0x3516ca[_0x5dbe('0x8a')])&&_0x3516ca[_0x5dbe('0x8a')]>0x0){return!![];}else{loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x8e'));}}else{loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x8f'));}}else{loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x90'));}}else{loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x90'));}return![];}function mergeDataErlangB(_0x1d9f99){return function(_0x441da9){loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x91'));loggerPredictive['info'](_0x5dbe('0x92'),_0x441da9['erlangCalls']);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x441da9[_0x5dbe('0x79')]);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x93'),_0x441da9['erlangAbandonmentRate']);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x94'),_0x441da9[_0x5dbe('0x95')]);loggerPredictive['info'](_0x5dbe('0x93'),_0x441da9[_0x5dbe('0x7a')]);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x8c'));_[_0x5dbe('0x96')](_0x1d9f99,_0x441da9);};}function getDiff(_0x309415){var _0x1d4475=moment()['milliseconds'](0x0);var _0x5e6eb0=moment(_0x309415)['milliseconds'](0x0);return _0x1d4475[_0x5dbe('0x4f')](_0x5e6eb0,_0x5dbe('0x50'));}function ifInterval(_0x9177d6,_0x313678){if(_[_0x5dbe('0x40')](_0x313678)){return![];}if(getDiff(_0x313678)<_0x9177d6*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x4c84a7){if(isNotNull(_0x4c84a7)){if(!_[_0x5dbe('0x40')](_0x4c84a7[_0x5dbe('0x97')])){_0x4c84a7[_0x5dbe('0x97')]=undefined;loggerPredictive[_0x5dbe('0x82')](_0x4c84a7[_0x5dbe('0x43')],_0x5dbe('0x98'));}if(!_[_0x5dbe('0x40')](_0x4c84a7['startPredictive'])){_0x4c84a7[_0x5dbe('0x29')]=undefined;loggerPredictive['info'](_0x4c84a7['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x5dbe('0x40')](_0x4c84a7[_0x5dbe('0x99')])){clearInterval(_0x4c84a7[_0x5dbe('0x99')]);_0x4c84a7[_0x5dbe('0x99')]=undefined;loggerPredictive[_0x5dbe('0x82')](_0x4c84a7[_0x5dbe('0x43')],_0x5dbe('0x9a'));}}}function erlangb(_0x501976,_0x15dcfe){if(_0x15dcfe===0x0){return 0x0;}var _0x5876d9=0x1;for(var _0x1d5f07=0x1;_0x1d5f07<=_0x15dcfe;_0x1d5f07+=0x1){_0x5876d9=0x1+_0x5876d9*_0x1d5f07/_0x501976;}return 0x1/_0x5876d9;}function isVoiceQueueOutbound(_0x1a9fd0){return _0x1a9fd0===_0x5dbe('0x9b');}function isNotPreview(_0x2b219e){return _0x2b219e!==_0x5dbe('0x1f');}function isCampaignIvr(_0x3f371f){return _0x3f371f===_0x5dbe('0x9c');}function getCallerId(_0x3e2cb1,_0x247810,_0x2cb7cc){if(!_['isUndefined'](_0x2cb7cc)&&'string'===typeof _0x2cb7cc&&!_[_0x5dbe('0x4a')](_0x2cb7cc)){if(!_['isUndefined'](_0x247810)&&_0x5dbe('0x9d')===typeof _0x247810&&!_[_0x5dbe('0x4a')](_0x247810)){return util['format'](_0x5dbe('0x9e'),_0x247810,_0x2cb7cc);}return util['format']('\x22%s\x22\x20<%s>',_0x2cb7cc,_0x2cb7cc);}if(!_['isUndefined'](_0x3e2cb1)&&_0x5dbe('0x9d')===typeof _0x3e2cb1&&!_['isEmpty'](_0x3e2cb1)){return _0x3e2cb1;}return _0x5dbe('0x9f');}function loggerCatchQueueSummary(_0x168e9d,_0x38191b){return function(_0x480302){freeVariablesPredictive(_0x38191b);emitVoiceQueueSummary(_0x38191b);emitCampaignSummary(_0x38191b);loggerSyncQueueSummary['error'](_0x168e9d,util[_0x5dbe('0xa0')](_0x480302,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5c9121,_0x145935){return function(_0x10dbfc){loggerPredictive['error'](_0x145935[_0x5dbe('0x43')],_0x5c9121);loggerPredictive['error'](_0x10dbfc[_0x5dbe('0xa1')]);freeVariablesPredictive(_0x145935);};}function loggerCatch(_0xf11adb){return function(_0x133a0a){logger[_0x5dbe('0xa2')](_0xf11adb,util[_0x5dbe('0xa0')](_0x133a0a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x17e7e9){return _0x17e7e9&&!_[_0x5dbe('0x40')](_0x17e7e9)&&_0x17e7e9[_0x5dbe('0xa3')]>0x0;}function decremetOriginate(_0x42d740){if(!_[_0x5dbe('0x40')](_0x42d740)&&_0x42d740!==null){if(_0x42d740[_0x5dbe('0xa4')](_0x5dbe('0x78'))){if(_0x42d740[_0x5dbe('0x78')]>0x0){_0x42d740[_0x5dbe('0x78')]-=0x1;}else{logger['error'](_0x5dbe('0xa5'));}}}else{logger[_0x5dbe('0xa2')](_0x5dbe('0xa6'));}}function checkContactLowerLimitOriginate(_0xf96e40,_0x448554,_0x406fd7){if(_0x448554>_0x406fd7){for(var _0x33acb6=0x0;_0x33acb6<_0x448554-_0x406fd7;_0x33acb6+=0x1){decremetOriginate(_0xf96e40);}}}function loggerGetContactDialer(_0x524b00,_0x513a9d,_0x4f16c7){return function(_0x4ffbf0){checkContactLowerLimitOriginate(_0x513a9d,_0x4f16c7,0x0);logger['error'](_0x524b00,util[_0x5dbe('0xa0')](_0x4ffbf0,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5e2ae1){return function(_0x4e1934){if(isNotNull(_0x4e1934)&&isNotNull(_0x4e1934[0x0])){if(_0x4e1934[0x0]['contactsRescheduled']>0x0){_0x5e2ae1[_0x5dbe('0x41')]=_0x5dbe('0xa7');logger[_0x5dbe('0x82')]('[getContactDialer2][ReScheduled]'+_0x5e2ae1[_0x5dbe('0x43')],_0x4e1934[0x0]['contactsRescheduled'],_0x5dbe('0xa8'));}else{_0x5e2ae1[_0x5dbe('0x41')]=_0x5dbe('0xa9');logger['info'](_0x5dbe('0xaa')+_0x5e2ae1[_0x5dbe('0x43')]);}}};}function notSendMessagesQueue(_0x2916f3){if(_0x2916f3[_0x5dbe('0xab')]){freeVariablesPredictive(_0x2916f3);if(_0x2916f3[_0x5dbe('0x78')]===0x0&&_0x2916f3[_0x5dbe('0x59')]===0x0&&_0x2916f3[_0x5dbe('0x5e')]===0x0&&(_0x2916f3[_0x5dbe('0x56')]||0x0)===0x0){_0x2916f3[_0x5dbe('0xab')]=![];_0x2916f3['available']=0x0;_0x2916f3[_0x5dbe('0x41')]=_0x5dbe('0x44');loggerSyncQueueSummary[_0x5dbe('0xa2')](_0x5dbe('0xac'),_0x2916f3[_0x5dbe('0x43')],_0x5dbe('0xad'));}else{_0x2916f3[_0x5dbe('0x41')]=_0x5dbe('0xae');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2916f3[_0x5dbe('0x43')],_0x5dbe('0xaf'));}emitVoiceQueueSummary(_0x2916f3);}}function notSendMessagesCampaign(_0x5bd811){if(_0x5bd811['sendMessageOneNotActive']){if(_0x5bd811['originated']===0x0){_0x5bd811[_0x5dbe('0xab')]=![];_0x5bd811[_0x5dbe('0x41')]=_0x5dbe('0x44');loggerSyncQueueSummary[_0x5dbe('0xa2')](_0x5dbe('0xb0'),_0x5bd811['name'],_0x5dbe('0xad'));}else{_0x5bd811[_0x5dbe('0x41')]=_0x5dbe('0xae');loggerSyncQueueSummary[_0x5dbe('0xa2')](_0x5dbe('0xb0'),_0x5bd811['name'],_0x5dbe('0xaf'));}emitCampaignSummary(_0x5bd811);}}function createObjHistory(_0x566f9d,_0x4ce81c,_0x47de54,_0x4b9a90,_0x42491c){_0x566f9d['message']=_0x47de54;var _0x1fb035=new Action(_0x566f9d,_0x4ce81c);var _0x28bcc2=new History(_0x1fb035);_0x28bcc2['state']=_0x4b9a90;_0x28bcc2[_0x5dbe('0xb1')]=_0x42491c;_0x28bcc2[_0x5dbe('0xb2')]=_0x1fb035[_0x5dbe('0xb3')];return _0x28bcc2;}Dialer[_0x5dbe('0x1c')][_0x5dbe('0x3f')]=function(){var _0x1dcd6a=this;setInterval(function(){_0x1dcd6a[_0x5dbe('0xb4')](_0x1dcd6a[_0x5dbe('0xb5')],_0x5dbe('0xb6'));_0x1dcd6a[_0x5dbe('0xb4')](_0x1dcd6a[_0x5dbe('0x26')],_0x5dbe('0xb7'));},0x32c8);};Dialer[_0x5dbe('0x1c')]['clearZombieChannels']=function(_0x15bbd9,_0x36d834){var _0x385036=this;for(var _0x1387a5 in _0x15bbd9){if(_0x15bbd9['hasOwnProperty'](_0x1387a5)){this[_0x5dbe('0x1e')][_0x5dbe('0xb8')](function(){if(!_[_0x5dbe('0xb9')](_0x15bbd9[_0x1387a5])){return ami[_0x5dbe('0xba')]({'action':'status','channel':_0x15bbd9[_0x1387a5][_0x5dbe('0xbb')]})[_0x5dbe('0xbc')](function(_0x3fd8b0){if(_0x3fd8b0[_0x5dbe('0x41')]===_0x5dbe('0xbd')){setTimeout(function(){if(_0x15bbd9[_0x1387a5]&&_0x15bbd9[_0x1387a5][_0x5dbe('0x5b')]!==_0x5dbe('0x9c')){_0x385036[_0x5dbe('0xbe')](_0x385036[_0x5dbe('0x20')][_0x15bbd9[_0x1387a5][_0x5dbe('0xbf')]]);logger['error'](_0x5dbe('0xc0'),_0x36d834,_0x1387a5,_0x15bbd9[_0x1387a5]['queue']);delete _0x15bbd9[_0x1387a5];}if(_0x15bbd9[_0x1387a5]&&_0x15bbd9[_0x1387a5][_0x5dbe('0x5b')]===_0x5dbe('0x9c')){_0x385036[_0x5dbe('0xbe')](_0x385036[_0x5dbe('0x21')][_0x15bbd9[_0x1387a5]['queue']]);logger[_0x5dbe('0xa2')](_0x5dbe('0xc1'),_0x36d834,_0x1387a5,_0x15bbd9[_0x1387a5]['queue']);delete _0x15bbd9[_0x1387a5];}},0x2328);}});}});}}};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xc2')]=function(_0xdd632f){return BPromise[_0x5dbe('0xc3')]()[_0x5dbe('0xc4')](cmHopper[_0x5dbe('0xc2')](_0xdd632f))[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0xc5')));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xc6')]=function(_0x163276){return BPromise['resolve']()[_0x5dbe('0xc4')](cmHopperBlack['checkIsBlackList'](_0x163276))[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0xc7')));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xc8')]=function(_0x30a9ff){return BPromise[_0x5dbe('0xc3')]()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x30a9ff))[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0xc9')));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xca')]=function(_0x242872){return BPromise['resolve']()[_0x5dbe('0xc4')](cmHopperHistory['avgHandleTime'](_0x242872))[_0x5dbe('0xbc')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xcb')]=function(_0x2a7766){return BPromise[_0x5dbe('0xc3')]()[_0x5dbe('0xc4')](cmHopper[_0x5dbe('0xcb')](_0x2a7766))['catch'](loggerCatch(_0x5dbe('0xcc')));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xcd')]=function(_0x1dcc1f,_0x3ad6fc,_0x25a348){return BPromise[_0x5dbe('0xc3')]()[_0x5dbe('0xc4')](cmHopper[_0x5dbe('0xcd')](_0x1dcc1f,_0x3ad6fc,_0x25a348))[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0xce')));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xcf')]=function(_0x42e2cd,_0x296ab8,_0x21de2b,_0x3c3f1e){return BPromise[_0x5dbe('0xc3')]()[_0x5dbe('0xc4')](cmHopper['getContactDialer'](_0x42e2cd,_0x296ab8,_0x21de2b,_0x3c3f1e))[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0xd0')));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xd1')]=function(_0x57aa97,_0x134ddc,_0x5decf5){return BPromise['resolve']()[_0x5dbe('0xc4')](cmHopper[_0x5dbe('0xd1')](_0x57aa97,_0x134ddc,_0x5decf5))[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0xd0')));};Dialer[_0x5dbe('0x1c')]['getVoiceQueueRtPauses']=function(_0x301354){return BPromise[_0x5dbe('0xc3')]()['then'](voiceQueueRt[_0x5dbe('0xd2')](_0x301354))[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0xd3')));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xd4')]=function(_0x2cbb66){return BPromise[_0x5dbe('0xc3')]()[_0x5dbe('0xc4')](cmHopper[_0x5dbe('0xd4')](_0x2cbb66))[_0x5dbe('0xbc')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0x5dbe('0xd5')]=function(_0x78ecde){return BPromise[_0x5dbe('0xc3')]()[_0x5dbe('0xc4')](cmHopperHistory[_0x5dbe('0xd5')](_0x78ecde))[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0xd6')));};Dialer[_0x5dbe('0x1c')]['updateOriginated']=function(_0x197a8e){if(!_[_0x5dbe('0x40')](_0x197a8e)&&_0x197a8e!==null){if(_0x197a8e['hasOwnProperty'](_0x5dbe('0x78'))){if(_0x197a8e['originated']>0x0){_0x197a8e[_0x5dbe('0x78')]-=0x1;}else{logger[_0x5dbe('0xa2')](_0x5dbe('0xd7'));}}}else{logger[_0x5dbe('0xa2')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xd8')]=function(_0x3caa3e,_0x3db0cc){var _0x10cd93=this;return function(_0x32d99f){_0x10cd93[_0x5dbe('0xbe')](_0x3db0cc);logger[_0x5dbe('0xa2')](_0x3caa3e,util[_0x5dbe('0xa0')](_0x32d99f,{'showHidden':![],'depth':null}));};};Dialer[_0x5dbe('0x1c')]['emptyContact']=function(_0x20d8c8,_0x59672e,_0x43a846){var _0x3dcebb={'state':0x19,'statedesc':_0x5dbe('0xd9')};this['updateOriginated'](_0x59672e);this[_0x5dbe('0xda')](_['merge'](_0x3dcebb,_['pick'](_0x43a846,['ContactId',_0x5dbe('0xdb'),'UserId','VoiceQueueId','CampaignId'])),_0x5dbe('0xdc'),'[emptyContact]');logger['error'](_0x20d8c8);};Dialer[_0x5dbe('0x1c')]['isSuccess']=function(_0x30608c){return _0x30608c===_0x5dbe('0xdd');};Dialer[_0x5dbe('0x1c')]['isTrunkReachable']=function(_0x5674ae){return!_['isUndefined'](_0x5674ae)&&_0x5674ae&&!_[_0x5dbe('0x40')](_0x5674ae[_0x5dbe('0x43')])&&!_['isUndefined'](_0x5674ae[_0x5dbe('0x7c')])&&_0x5674ae[_0x5dbe('0x7c')]&&(this[_0x5dbe('0x23')][util[_0x5dbe('0x7e')](_0x5dbe('0xde'),_0x5674ae['name'])][_0x5dbe('0xdf')]==='reachable'||this[_0x5dbe('0x23')][util[_0x5dbe('0x7e')]('SIP/%s',_0x5674ae['name'])]['status']===_0x5dbe('0xe0'));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xda')]=function(_0x259e97,_0x4e9f56,_0x53f691){this['createHistory'](_0x259e97)[_0x5dbe('0xbc')](loggerCatch(_0x4e9f56));this[_0x5dbe('0xd4')](_0x259e97)[_0x5dbe('0xbc')](loggerCatch(_0x53f691));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0x3b')]=function(_0x19c1c7){var _0x3ea52c=this['uniqueId'][_0x19c1c7[_0x5dbe('0xe1')]];var _0x627a35;if(!_[_0x5dbe('0xb9')](_0x19c1c7)&&!_[_0x5dbe('0xb9')](_0x19c1c7[_0x5dbe('0xe2')])&&!_[_0x5dbe('0xb9')](_0x19c1c7[_0x5dbe('0xe2')]['amdstatus'])&&_0x19c1c7['exten']===_0x5dbe('0xe3')&&_0x3ea52c){if(_0x3ea52c[_0x5dbe('0x5b')]!==_0x5dbe('0x9c')&&this[_0x5dbe('0x20')][_0x3ea52c[_0x5dbe('0xbf')]][_0x5dbe('0xe4')]&&_0x19c1c7[_0x5dbe('0xe5')]==='HANGUP'){delete this[_0x5dbe('0xb5')][_0x19c1c7[_0x5dbe('0xe1')]];this[_0x5dbe('0xbe')](this[_0x5dbe('0x20')][_0x3ea52c['queue']]);this[_0x5dbe('0x20')][_0x3ea52c[_0x5dbe('0xbf')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x3ea52c[_0x5dbe('0xbf')]][_0x5dbe('0x65')]+=0x1;_0x627a35=new Hangup(_0x3ea52c,_0x19c1c7);_0x627a35[_0x5dbe('0xe6')]=0x12;_0x627a35[_0x5dbe('0xb1')]=_0x5dbe('0xe7');_0x627a35[_0x5dbe('0xe8')]=_0x5dbe('0xe9');this['saveInDb'](_0x627a35,_0x5dbe('0xea'),'[syncHangupInAMD]');}if(_0x3ea52c[_0x5dbe('0x5b')]!==_0x5dbe('0x9c')&&this[_0x5dbe('0x20')][_0x3ea52c[_0x5dbe('0xbf')]][_0x5dbe('0xe4')]&&_0x19c1c7['value']==='MACHINE'){var _0x2873c5=this;return new BPromise(function(_0x1b5ed9,_0x3685d0){delete _0x2873c5['uniqueId'][_0x19c1c7[_0x5dbe('0xe1')]];_0x2873c5[_0x5dbe('0xbe')](_0x2873c5[_0x5dbe('0x20')][_0x3ea52c[_0x5dbe('0xbf')]]);_0x2873c5['voiceQueues'][_0x3ea52c[_0x5dbe('0xbf')]][_0x5dbe('0xeb')]+=0x1;_0x2873c5[_0x5dbe('0x20')][_0x3ea52c[_0x5dbe('0xbf')]][_0x5dbe('0x65')]+=0x1;var _0x281047=_0x2873c5[_0x5dbe('0x20')][_0x3ea52c[_0x5dbe('0xbf')]];var _0x59da94=new Hangup(_0x3ea52c,_0x19c1c7);_0x59da94[_0x5dbe('0xe6')]=0x13;_0x59da94['statedesc']='Machine';_0x59da94['membername']=_0x5dbe('0xe9');_0x59da94[_0x5dbe('0xec')]+=0x1;_0x59da94[_0x5dbe('0xed')]+=0x1;_0x59da94[_0x5dbe('0xee')]=!![];_0x2873c5[_0x5dbe('0xd5')](_0x59da94)[_0x5dbe('0xbc')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x59da94[_0x5dbe('0xef')]+_0x59da94['countcongestionretry']+_0x59da94[_0x5dbe('0xf0')]+_0x59da94[_0x5dbe('0xf1')]+_0x59da94[_0x5dbe('0xf2')]+_0x59da94[_0x5dbe('0xf3')]+_0x59da94[_0x5dbe('0xec')]+_0x59da94[_0x5dbe('0xf4')]>=_0x281047[_0x5dbe('0xf5')]){_0x2873c5[_0x5dbe('0xf6')](_0x59da94,_0x1b5ed9,_0x3685d0,'reason19\x20machine....');}else{if(_0x59da94['countmachineretry']>=_0x281047[_0x5dbe('0xf7')]){_0x2873c5[_0x5dbe('0xf8')](_0x59da94,_0x1b5ed9,_0x3685d0,_0x5dbe('0xf9'));}else{_0x2873c5[_0x5dbe('0xcb')]({'active':![],'countmachineretry':_0x59da94[_0x5dbe('0xec')],'scheduledat':moment()['add'](_0x281047[_0x5dbe('0xfa')],_0x5dbe('0xfb'))[_0x5dbe('0x7e')](_0x5dbe('0xfc')),'ContactId':_0x59da94[_0x5dbe('0xfd')],'ListId':_0x59da94[_0x5dbe('0xdb')],'VoiceQueueId':_0x59da94[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x59da94[_0x5dbe('0xff')]||undefined})[_0x5dbe('0xbc')](loggerCatch('[rescheduleContact][Machine]'));_0x1b5ed9({'reschedule':0x1});}}});}if(_0x3ea52c['type']==='ivr'&&this[_0x5dbe('0x21')][_0x3ea52c[_0x5dbe('0xbf')]][_0x5dbe('0xe4')]&&_0x19c1c7[_0x5dbe('0xe5')]===_0x5dbe('0x100')){delete this[_0x5dbe('0xb5')][_0x19c1c7[_0x5dbe('0xe1')]];this[_0x5dbe('0xbe')](this[_0x5dbe('0x21')][_0x3ea52c[_0x5dbe('0xbf')]]);_0x627a35=new Hangup(_0x3ea52c,_0x19c1c7);_0x627a35['state']=0x12;_0x627a35['statedesc']=_0x5dbe('0xe7');_0x627a35[_0x5dbe('0xe8')]=_0x5dbe('0xe9');this[_0x5dbe('0xda')](_0x627a35,_0x5dbe('0x101'),_0x5dbe('0x102'));}if(_0x3ea52c[_0x5dbe('0x5b')]===_0x5dbe('0x9c')&&this[_0x5dbe('0x21')][_0x3ea52c[_0x5dbe('0xbf')]][_0x5dbe('0xe4')]&&_0x19c1c7['value']==='MACHINE'){var _0x2873c5=this;return new BPromise(function(_0x1f688d,_0x1c5aa2){delete _0x2873c5[_0x5dbe('0xb5')][_0x19c1c7[_0x5dbe('0xe1')]];_0x2873c5[_0x5dbe('0xbe')](_0x2873c5[_0x5dbe('0x21')][_0x3ea52c[_0x5dbe('0xbf')]]);_0x2873c5['campaigns'][_0x3ea52c[_0x5dbe('0xbf')]][_0x5dbe('0xeb')]+=0x1;_0x2873c5['campaigns'][_0x3ea52c[_0x5dbe('0xbf')]][_0x5dbe('0x65')]+=0x1;var _0x3dc37a=_0x2873c5[_0x5dbe('0x21')][_0x3ea52c[_0x5dbe('0xbf')]];var _0x347391=new Hangup(_0x3ea52c,_0x19c1c7);_0x347391[_0x5dbe('0xe6')]=0x13;_0x347391[_0x5dbe('0xb1')]=_0x5dbe('0x103');_0x347391[_0x5dbe('0xe8')]='AMD';_0x347391[_0x5dbe('0xec')]+=0x1;_0x347391[_0x5dbe('0xed')]+=0x1;_0x347391[_0x5dbe('0xee')]=!![];_0x2873c5[_0x5dbe('0xd5')](_0x347391)[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x104')));if(_0x347391[_0x5dbe('0xef')]+_0x347391[_0x5dbe('0x105')]+_0x347391[_0x5dbe('0xf0')]+_0x347391[_0x5dbe('0xf1')]+_0x347391[_0x5dbe('0xf2')]+_0x347391['countabandonedretry']+_0x347391[_0x5dbe('0xec')]+_0x347391[_0x5dbe('0xf4')]>=_0x3dc37a[_0x5dbe('0xf5')]){_0x2873c5[_0x5dbe('0xf6')](_0x347391,_0x1f688d,_0x1c5aa2,'reason19\x20machine....');}else{if(_0x347391[_0x5dbe('0xec')]>=_0x3dc37a[_0x5dbe('0xf7')]){_0x2873c5['createStateFinal'](_0x347391,_0x1f688d,_0x1c5aa2,_0x5dbe('0xf9'));}else{_0x2873c5[_0x5dbe('0xcb')]({'active':![],'countmachineretry':_0x347391['countmachineretry'],'scheduledat':moment()[_0x5dbe('0x106')](_0x3dc37a[_0x5dbe('0xfa')],_0x5dbe('0xfb'))[_0x5dbe('0x7e')](_0x5dbe('0xfc')),'ContactId':_0x347391['ContactId'],'ListId':_0x347391[_0x5dbe('0xdb')],'VoiceQueueId':_0x347391[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x347391[_0x5dbe('0xff')]||undefined})[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x107')));_0x1f688d({'reschedule':0x1});}}});}}};Dialer[_0x5dbe('0x1c')]['syncHangup']=function(_0x224987){var _0x1999b4=this[_0x5dbe('0xb5')][_0x224987[_0x5dbe('0xe1')]];var _0x1ff9a3=this;var _0x1eaa51;if(_0x1999b4&&_0x1999b4[_0x5dbe('0x5b')]===_0x5dbe('0x9c')){delete this[_0x5dbe('0xb5')][_0x224987[_0x5dbe('0xe1')]];this['updateOriginated'](this['campaigns'][_0x1999b4[_0x5dbe('0xbf')]]);this[_0x5dbe('0x21')][_0x1999b4[_0x5dbe('0xbf')]][_0x5dbe('0x108')]+=0x1;_0x1eaa51=new Hangup(_0x1999b4,_0x224987);this[_0x5dbe('0xd5')](_0x1eaa51)[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x109')));this['moveContactManagedDialer'](_0x1eaa51)['catch'](loggerCatch(_0x5dbe('0x10a')));}if(_0x1999b4&&_0x1999b4[_0x5dbe('0x5b')]!==_0x5dbe('0x9c')&&isNotNull(this[_0x5dbe('0x20')][_0x1999b4[_0x5dbe('0xbf')]][_0x5dbe('0x10b')])){delete this[_0x5dbe('0xb5')][_0x224987[_0x5dbe('0xe1')]];this[_0x5dbe('0xbe')](this['voiceQueues'][_0x1999b4['queue']]);this[_0x5dbe('0x20')][_0x1999b4[_0x5dbe('0xbf')]][_0x5dbe('0xeb')]+=0x1;this[_0x5dbe('0x20')][_0x1999b4[_0x5dbe('0xbf')]]['outboundAnswerAgiCallsDay']+=0x1;_0x1eaa51=new Hangup(_0x1999b4,_0x224987);_0x1eaa51[_0x5dbe('0xe6')]=0x10;_0x1eaa51[_0x5dbe('0xb1')]=_0x5dbe('0x10c');_0x1eaa51[_0x5dbe('0xe8')]=_0x5dbe('0x10d');this[_0x5dbe('0xd5')](_0x1eaa51)['catch'](loggerCatch(_0x5dbe('0x109')));this[_0x5dbe('0xd4')](_0x1eaa51)[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x10a')));}if(_0x1999b4&&_0x1999b4['type']!=='ivr'&&!isNotNull(this[_0x5dbe('0x20')][_0x1999b4['queue']]['dialQueueProject'])){delete this[_0x5dbe('0xb5')][_0x224987[_0x5dbe('0xe1')]];this['updateOriginated'](this['voiceQueues'][_0x1999b4[_0x5dbe('0xbf')]]);this[_0x5dbe('0x20')][_0x1999b4[_0x5dbe('0xbf')]][_0x5dbe('0x10e')]+=0x1;_0x1eaa51=new Hangup(_0x1999b4,_0x224987);_0x1eaa51[_0x5dbe('0xe6')]=0xc;_0x1eaa51[_0x5dbe('0xb1')]=_0x224987[_0x5dbe('0x10f')];_0x1eaa51[_0x5dbe('0xe8')]=_0x5dbe('0x110');this[_0x5dbe('0xd5')](_0x1eaa51)[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x109')));this[_0x5dbe('0xd4')](_0x1eaa51)['catch'](loggerCatch(_0x5dbe('0x10a')));}};Dialer[_0x5dbe('0x1c')][_0x5dbe('0x34')]=function(_0x3c8850){var _0x1370b8=this[_0x5dbe('0xb5')][_0x3c8850['uniqueid']];var _0x4370e0=this;if(this[_0x5dbe('0x20')][_0x3c8850[_0x5dbe('0xbf')]]){if(_0x1370b8&&_0x1370b8[_0x5dbe('0x5b')]!==_0x5dbe('0x9c')){delete this['uniqueId'][_0x3c8850[_0x5dbe('0xe1')]];this[_0x5dbe('0x20')][_0x3c8850[_0x5dbe('0xbf')]]['outboundAnswerCallsDay']+=0x1;var _0x469bda=new AgentComplete(_0x1370b8,_0x3c8850);if(_0x3c8850[_0x5dbe('0x111')]==='agent'){_0x469bda['agiafterat']=this[_0x5dbe('0x20')][_0x3c8850[_0x5dbe('0xbf')]][_0x5dbe('0x112')]&&this[_0x5dbe('0x20')][_0x3c8850[_0x5dbe('0xbf')]][_0x5dbe('0x113')]?moment()['format'](_0x5dbe('0xfc')):undefined;}this[_0x5dbe('0xd5')](_0x469bda)['catch'](loggerCatch(_0x5dbe('0x114')));this[_0x5dbe('0xd4')](_0x469bda)['catch'](loggerCatch(_0x5dbe('0x115')));}}};Dialer[_0x5dbe('0x1c')][_0x5dbe('0x2d')]=function(_0x2523a2){if(this[_0x5dbe('0x20')][_0x2523a2[_0x5dbe('0xbf')]]){if(this[_0x5dbe('0xb5')][_0x2523a2['uniqueid']]&&this[_0x5dbe('0xb5')][_0x2523a2[_0x5dbe('0xe1')]][_0x5dbe('0x5b')]!==_0x5dbe('0x9c')){this[_0x5dbe('0xbe')](this[_0x5dbe('0x20')][_0x2523a2[_0x5dbe('0xbf')]]);this[_0x5dbe('0xb5')][_0x2523a2[_0x5dbe('0xe1')]][_0x5dbe('0x116')]=moment()[_0x5dbe('0x7e')](_0x5dbe('0xfc'));}}};Dialer['prototype'][_0x5dbe('0x117')]=function(_0x4d7e1e){this['createHistory'](_0x4d7e1e)[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x114')));this[_0x5dbe('0xd4')](_0x4d7e1e)['catch'](loggerCatch(_0x5dbe('0x118')));};Dialer[_0x5dbe('0x1c')][_0x5dbe('0x30')]=function(_0x1a3d03){var _0x5d20b1=this[_0x5dbe('0xb5')][_0x1a3d03['uniqueid']];var _0x5678c8=this;if(this['voiceQueues'][_0x1a3d03[_0x5dbe('0xbf')]]){if(_0x5d20b1&&_0x5d20b1[_0x5dbe('0x5b')]!==_0x5dbe('0x9c')){delete this['uniqueId'][_0x1a3d03[_0x5dbe('0xe1')]];this['updateOriginated'](this[_0x5dbe('0x20')][_0x1a3d03['queue']]);_0x5d20b1[_0x5dbe('0x119')]=moment()[_0x5dbe('0x7e')](_0x5dbe('0xfc'));var _0xc446d=new QueueCallerAbandon(_0x5d20b1,_0x1a3d03);if(getSeconds(_0x5d20b1['droptime'],_0x5d20b1[_0x5dbe('0x11a')])>=_0x5d20b1[_0x5dbe('0x11b')]){this[_0x5dbe('0x20')][_0x1a3d03[_0x5dbe('0xbf')]][_0x5dbe('0x87')]+=0x1;this[_0x5dbe('0x20')][_0x1a3d03[_0x5dbe('0xbf')]][_0x5dbe('0x6b')]+=0x1;this['voiceQueues'][_0x1a3d03[_0x5dbe('0xbf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0xc446d['state']=0xa;_0xc446d[_0x5dbe('0xb1')]=_0x5dbe('0x11c');_0xc446d[_0x5dbe('0x11d')]=_0x5dbe('0x11e');_0xc446d[_0x5dbe('0x11f')]=this['voiceQueues'][_0x1a3d03[_0x5dbe('0xbf')]]['dialQueueProject2']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0xc446d[_0x5dbe('0xf2')]+=0x1;_0xc446d[_0x5dbe('0xed')]+=0x1;if(_0xc446d[_0x5dbe('0xf2')]>=this['voiceQueues'][_0x1a3d03[_0x5dbe('0xbf')]][_0x5dbe('0x120')]){this[_0x5dbe('0x117')](_0xc446d);}else{this[_0x5dbe('0xcb')]({'active':![],'countdropretry':_0xc446d[_0x5dbe('0xf2')],'scheduledat':moment()[_0x5dbe('0x106')](this[_0x5dbe('0x20')][_0x1a3d03[_0x5dbe('0xbf')]][_0x5dbe('0x121')],_0x5dbe('0xfb'))[_0x5dbe('0x7e')](_0x5dbe('0xfc')),'ContactId':_0x5d20b1[_0x5dbe('0xfd')],'ListId':_0x5d20b1['ListId'],'VoiceQueueId':_0x5d20b1[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x5d20b1[_0x5dbe('0xff')]||undefined})[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x122')));var _0x485727=new History(_0xc446d);_0x485727[_0x5dbe('0xe6')]=0xa;_0x485727[_0x5dbe('0xb1')]=_0x5dbe('0x11c');_0x485727[_0x5dbe('0xb3')]=moment()[_0x5dbe('0x7e')](_0x5dbe('0xfc'));_0x485727[_0x5dbe('0xb2')]=_0x485727[_0x5dbe('0xb3')];_0x485727[_0x5dbe('0x123')]=_0xc446d['calleridname'];_0x485727['calleridnum']=_0xc446d[_0x5dbe('0x124')];this[_0x5dbe('0xd5')](_0x485727)[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x125')));}}else{this['voiceQueues'][_0x1a3d03[_0x5dbe('0xbf')]][_0x5dbe('0x71')]+=0x1;this[_0x5dbe('0x20')][_0x1a3d03[_0x5dbe('0xbf')]][_0x5dbe('0x6a')]+=0x1;_0xc446d['state']=0xb;_0xc446d[_0x5dbe('0xb1')]=_0x5dbe('0x126');_0xc446d[_0x5dbe('0x11d')]=_0x5dbe('0x127');_0xc446d[_0x5dbe('0xf3')]+=0x1;_0xc446d[_0x5dbe('0xed')]+=0x1;if(_0xc446d[_0x5dbe('0xf3')]>=this['voiceQueues'][_0x1a3d03[_0x5dbe('0xbf')]]['dialAbandonedMaxRetry']){this[_0x5dbe('0x117')](_0xc446d);}else{this[_0x5dbe('0xcb')]({'active':![],'countabandonedretry':_0xc446d[_0x5dbe('0xf3')],'scheduledat':moment()[_0x5dbe('0x106')](this[_0x5dbe('0x20')][_0x1a3d03[_0x5dbe('0xbf')]]['dialAbandonedRetryFrequency'],_0x5dbe('0xfb'))[_0x5dbe('0x7e')](_0x5dbe('0xfc')),'ContactId':_0x5d20b1[_0x5dbe('0xfd')],'ListId':_0x5d20b1[_0x5dbe('0xdb')],'VoiceQueueId':_0x5d20b1[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x5d20b1[_0x5dbe('0xff')]||undefined})['catch'](loggerCatch(_0x5dbe('0x128')));var _0x485727=new History(_0xc446d);_0x485727[_0x5dbe('0xe6')]=0xb;_0x485727['statedesc']=_0x5dbe('0x126');_0x485727['starttime']=moment()[_0x5dbe('0x7e')](_0x5dbe('0xfc'));_0x485727[_0x5dbe('0xb2')]=_0x485727[_0x5dbe('0xb3')];_0x485727[_0x5dbe('0x123')]=_0xc446d[_0x5dbe('0x123')];_0x485727[_0x5dbe('0x124')]=_0xc446d[_0x5dbe('0x124')];this[_0x5dbe('0xd5')](_0x485727)['catch'](loggerCatch(_0x5dbe('0x129')));}}}}};Dialer[_0x5dbe('0x1c')]['syncNewExten']=function(_0x21bcad){if(this[_0x5dbe('0x26')][_0x21bcad['uniqueid']]){this['actions'][_0x21bcad['uniqueid']][_0x5dbe('0xbb')]=_0x21bcad[_0x5dbe('0xbb')];}if(this[_0x5dbe('0xb5')][_0x21bcad[_0x5dbe('0xe1')]]){this[_0x5dbe('0xb5')][_0x21bcad[_0x5dbe('0xe1')]][_0x5dbe('0xbb')]=_0x21bcad[_0x5dbe('0xbb')];}};Dialer[_0x5dbe('0x1c')][_0x5dbe('0x12a')]=function(_0x203d98){if(strategy[this[_0x5dbe('0x20')][this[_0x5dbe('0x26')][_0x203d98[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]][_0x5dbe('0x52')]]===_0x5dbe('0x1b')){if(this[_0x5dbe('0x26')][_0x203d98['actionid']]&&_[_0x5dbe('0xb9')](this[_0x5dbe('0x26')][_0x203d98[_0x5dbe('0x12b')]][_0x5dbe('0x12c')])&&_0x203d98[_0x5dbe('0xdf')]==='1'&&_0x203d98[_0x5dbe('0x12d')]==='0'){if(this[_0x5dbe('0x22')][_0x203d98[_0x5dbe('0x12e')]]){if(!this[_0x5dbe('0x22')][_0x203d98['stateinterface']][_0x5dbe('0x12c')]){this['agents'][_0x203d98[_0x5dbe('0x12e')]][_0x5dbe('0x12c')]=!![];this[_0x5dbe('0x26')][_0x203d98[_0x5dbe('0x12b')]][_0x5dbe('0x12c')]=!![];this[_0x5dbe('0x26')][_0x203d98[_0x5dbe('0x12b')]][_0x5dbe('0x12e')]=_0x203d98[_0x5dbe('0x12e')];}}}}else if((strategy[this[_0x5dbe('0x20')][this[_0x5dbe('0x26')][_0x203d98['actionid']]['queue']][_0x5dbe('0x52')]]||'rrmemory')===_0x5dbe('0x12f')){if(this[_0x5dbe('0x26')][_0x203d98[_0x5dbe('0x12b')]]){if(this[_0x5dbe('0x22')][_0x203d98[_0x5dbe('0x12e')]]){this['actions'][_0x203d98['actionid']][_0x5dbe('0x12e')]=_0x203d98[_0x5dbe('0x12e')];if(_[_0x5dbe('0xb9')](this[_0x5dbe('0x2b')][this['actions'][_0x203d98[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]])){this[_0x5dbe('0x2b')][this[_0x5dbe('0x26')][_0x203d98[_0x5dbe('0x12b')]]['queue']]=[];}this[_0x5dbe('0x2b')][this[_0x5dbe('0x26')][_0x203d98[_0x5dbe('0x12b')]]['queue']]['push'](_['merge'](_['pick'](this[_0x5dbe('0x26')][_0x203d98[_0x5dbe('0x12b')]],[_0x5dbe('0x130'),_0x5dbe('0x12e')]),{'status':_0x203d98[_0x5dbe('0xdf')],'paused':_0x203d98[_0x5dbe('0x12d')]}));}}}};function unlockQueueStatus(_0x4182a0,_0x49918a){setTimeout(function(){if(_['isUndefined'](_0x4182a0[_0x5dbe('0x131')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x49918a);}_0x4182a0['queueStatusComplete']=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x49918a,JSON[_0x5dbe('0x4d')](_[_0x5dbe('0x132')](_0x4182a0,['name','queueStatusComplete'])));},0x1f3);}Dialer['prototype'][_0x5dbe('0x133')]=function(_0x399177){var _0x4bcd7a=this;var _0x33e19e=_0x4bcd7a[_0x5dbe('0x20')][_0x4bcd7a[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]];if(strategy[this[_0x5dbe('0x20')][this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]][_0x5dbe('0x52')]]===_0x5dbe('0x1b')){if(this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]]&&this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0x12e')]){this[_0x5dbe('0x1f')]['run'](this[_0x5dbe('0x26')][_0x399177['actionid']][_0x5dbe('0x130')],this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0x12e')])[_0x5dbe('0xbc')](function(_0x16d99f){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x5dbe('0xa0')](_0x16d99f,{'showHidden':![],'depth':null}));})['finally'](function(){_0x4bcd7a[_0x5dbe('0xbe')](_0x4bcd7a[_0x5dbe('0x20')][_0x4bcd7a[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]]);_0x4bcd7a['agents'][_0x4bcd7a[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0x12e')]]['locked']=![];delete _0x4bcd7a[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]];unlockQueueStatus(_0x33e19e);});}else{this[_0x5dbe('0xbe')](this['voiceQueues'][this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]]);this[_0x5dbe('0xcb')]({'active':![],'ContactId':this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xfd')],'ListId':this['actions'][_0x399177['actionid']]['ListId'],'VoiceQueueId':this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xfe')]||undefined,'CampaignId':this[_0x5dbe('0x26')][_0x399177['actionid']][_0x5dbe('0xff')]||undefined})[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x134')));delete this['actions'][_0x399177[_0x5dbe('0x12b')]];unlockQueueStatus(_0x33e19e);}}else if((strategy[this[_0x5dbe('0x20')][this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]][_0x5dbe('0x52')]]||_0x5dbe('0x12f'))===_0x5dbe('0x12f')){var _0x27958b;if(this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]]&&!_[_0x5dbe('0x4a')](this[_0x5dbe('0x2b')][this[_0x5dbe('0x26')][_0x399177['actionid']]['queue']])){if(this[_0x5dbe('0x2c')][_0x4bcd7a[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]]){this[_0x5dbe('0x2c')][_0x4bcd7a[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]]=this[_0x5dbe('0x2c')][this[_0x5dbe('0x26')][_0x399177['actionid']][_0x5dbe('0xbf')]]?this['queueBookedRR'][this[_0x5dbe('0x26')][_0x399177['actionid']][_0x5dbe('0xbf')]]:this['queueBooked'][this['actions'][_0x399177['actionid']]['queue']]?this[_0x5dbe('0x2b')][this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]][_0x5dbe('0x135')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]][_0x5dbe('0x135')]=this[_0x5dbe('0x2c')][this[_0x5dbe('0x26')][_0x399177[_0x5dbe('0x12b')]][_0x5dbe('0xbf')]];for(var _0x148fc1=0x0;_0x148fc1=0x0?!![]:![];})[_0x5dbe('0xbc')](myreject(_0x2363e0)));}}else{_0x3de57a['push'](ami[_0x5dbe('0xba')]({'action':_0x5dbe('0x14d'),'command':util['format']('iftime\x20%s,%s',_0x1b5184,!_['isUndefined'](config['timezones'][_0x4d344f])?_0x4d344f:'')})[_0x5dbe('0xc4')](function(_0x12d081){return _0x12d081[_0x5dbe('0x150')][_0x5dbe('0x151')](_0x5dbe('0x152'))>=0x0?!![]:![];})[_0x5dbe('0xbc')](myreject(_0x2363e0)));}BPromise[_0x5dbe('0x153')](_0x3de57a)[_0x5dbe('0xc4')](function(_0x345b65){var _0x2f0d16=_[_0x5dbe('0x154')](_0x345b65);if(_0x2f0d16){return _0x2f9b47(_0x2f0d16);}else{_0x15ec31[_0x5dbe('0x41')]=_0x5355c4?_0x5dbe('0x155'):_0x5dbe('0x156');return _0x2363e0(msgResponse(_0x5dbe('0x157'),'Failure',_0x5dbe('0x158')+_0x5355c4+'\x20'+_0x5b2771+_0x5dbe('0x159')+util[_0x5dbe('0xa0')](_0x1b5184,{'showHidden':![],'depth':null})+_0x5dbe('0x15a')+_0x4d344f));}})[_0x5dbe('0xbc')](function(_0x8fa169){return _0x2363e0(msgResponse('ifTime',_0x5dbe('0x146'),JSON[_0x5dbe('0x4d')](_0x8fa169)));});});};Dialer[_0x5dbe('0x1c')][_0x5dbe('0x15b')]=function(_0x378d66){var _0x15d50a=this;return function(){switch(_0x378d66[_0x5dbe('0x60')]){case _0x5dbe('0x15c'):freeVariablesPredictive(_0x378d66);_0x15d50a[_0x5dbe('0x15d')](_0x378d66,0x1);break;case'power':freeVariablesPredictive(_0x378d66);_0x15d50a[_0x5dbe('0x15d')](_0x378d66,_0x378d66['dialPowerLevel']);break;case _0x5dbe('0xa'):_0x15d50a[_0x5dbe('0xa')](_0x378d66);break;case _0x5dbe('0x9'):freeVariablesPredictive(_0x378d66);_0x15d50a[_0x5dbe('0x15d')](_0x378d66,0x1);break;default:freeVariablesPredictive(_0x378d66);logger['error']('Queue',_0x378d66[_0x5dbe('0x43')],_0x5dbe('0x15e'));}};};Dialer['prototype'][_0x5dbe('0x15f')]=function(_0x424d64){var _0x53ce3c=this;return function(){_0x53ce3c[_0x5dbe('0x160')](_0x424d64);};};Dialer['prototype'][_0x5dbe('0x161')]=function(_0x13d437){var _0x322864=this;if(isNotPreview(_0x13d437[_0x5dbe('0x60')])){if(isVoiceQueueOutbound(_0x13d437[_0x5dbe('0x5b')])&&isActive(_0x13d437['dialActive'])){_0x13d437[_0x5dbe('0xab')]=!![];BPromise[_0x5dbe('0xc3')]()['then'](checkIsLoggedIn(_0x13d437,_0x13d437[_0x5dbe('0x55')]))[_0x5dbe('0xc4')](checkIsActive(_0x13d437,_0x13d437[_0x5dbe('0x162')]))[_0x5dbe('0xc4')](checkInterval(_0x13d437))[_0x5dbe('0xc4')](_0x322864[_0x5dbe('0x140')](_0x13d437))[_0x5dbe('0xc4')](_0x322864[_0x5dbe('0x144')](_0x13d437[_0x5dbe('0x163')],_0x13d437[_0x5dbe('0x164')],_0x13d437['name'],_0x13d437))[_0x5dbe('0xc4')](_0x322864[_0x5dbe('0x165')](_0x13d437[_0x5dbe('0x46')],_0x13d437[_0x5dbe('0x164')],_0x13d437[_0x5dbe('0x43')],_0x13d437))['then'](_0x322864[_0x5dbe('0x15b')](_0x13d437))[_0x5dbe('0xbc')](loggerCatchQueueSummary(_0x5dbe('0x166'),_0x13d437));}else{notSendMessagesQueue(_0x13d437);}}else{freeVariablesPredictive(_0x13d437);}};Dialer[_0x5dbe('0x1c')]['syncCampaigns']=function(){var _0x104155=this;var _0x3cea6e;for(var _0x30c48a in this[_0x5dbe('0x21')]){if(this[_0x5dbe('0x21')][_0x5dbe('0xa4')](_0x30c48a)){_0x3cea6e=this[_0x5dbe('0x21')][_0x30c48a];if(isCampaignIvr(_0x3cea6e[_0x5dbe('0x5b')])&&isActive(_0x3cea6e[_0x5dbe('0x7c')])){_0x3cea6e[_0x5dbe('0xab')]=!![];BPromise[_0x5dbe('0xc3')]()[_0x5dbe('0xc4')](checkIsActive(_0x3cea6e,_0x3cea6e[_0x5dbe('0x7c')]))[_0x5dbe('0xc4')](checkInterval(_0x3cea6e))['then'](_0x104155[_0x5dbe('0x140')](_0x3cea6e))[_0x5dbe('0xc4')](_0x104155[_0x5dbe('0x144')](_0x3cea6e[_0x5dbe('0x163')],_0x3cea6e[_0x5dbe('0x164')],_0x3cea6e[_0x5dbe('0x43')],_0x3cea6e))['then'](_0x104155[_0x5dbe('0x165')](_0x3cea6e[_0x5dbe('0x46')],_0x3cea6e[_0x5dbe('0x164')],_0x3cea6e['name'],_0x3cea6e))['then'](_0x104155[_0x5dbe('0x15f')](_0x3cea6e))['catch'](loggerCatchQueueSummary(_0x5dbe('0x167'),_0x3cea6e));}else{notSendMessagesCampaign(_0x3cea6e);}}}};function getCallerIdRandom(_0x60346,_0x386197){var _0x4fc526,_0x45b06d,_0xa5eaf6;if(_0x386197<=0x0){_0x386197=0x1;}_0x4fc526=new RegExp(_0x5dbe('0x168')+_0x386197+'}$');_0x45b06d=Math['pow'](0xa,_0x386197-0x1);_0xa5eaf6=Math[_0x5dbe('0x169')](0xa,_0x386197)-0x1;return util[_0x5dbe('0x7e')]('%s',_[_0x5dbe('0x16a')](_0x60346,_0x4fc526,_[_0x5dbe('0x16b')](_0x45b06d,_0xa5eaf6)));}function extractCalleridName(_0x42a283){var _0xbdd001=_0x42a283[_0x5dbe('0x16c')](/"(.*?)"/);return _0xbdd001?_0xbdd001[0x1]:_0x42a283;}function extractCalleridNumber(_0x3d56ab){var _0x3286c0=_0x3d56ab[_0x5dbe('0x16c')](/<(.*?)>/);return _0x3286c0?_0x3286c0[0x1]:_0x3d56ab;}Dialer[_0x5dbe('0x1c')][_0x5dbe('0x16d')]=function(_0x220ce5,_0x1716e7){var _0x21f9cc=this;var _0x55c7c2=uuid['v4']();this[_0x5dbe('0x26')][_0x55c7c2]=new Action(_0x220ce5,_0x1716e7,_0x55c7c2);return new BPromise(function(_0x1fb9d4,_0x10b482){if(_[_0x5dbe('0x40')](_0x220ce5)&&_0x5dbe('0x16e')!==typeof _0x220ce5){return _0x10b482(msgResponse(_0x5dbe('0x16f'),_0x5dbe('0x146'),_0x5dbe('0x170')));}if(_[_0x5dbe('0x40')](_0x1716e7[_0x5dbe('0x171')][_0x5dbe('0x172')])||_0x1716e7[_0x5dbe('0x171')][_0x5dbe('0x172')]===null){return _0x10b482(msgResponse(_0x5dbe('0x16f'),'Failure',_0x5dbe('0x173')));}var _0x404789={'XMD-CALLERID':_0x21f9cc[_0x5dbe('0x26')][_0x55c7c2]['getCaller'](),'XMD-AGI':_0x220ce5[_0x5dbe('0x10b')]?util[_0x5dbe('0x7e')]('\x22agi://%s/square,%s\x22',ipAgi,_0x220ce5[_0x5dbe('0x10b')]):_0x5dbe('0x174'),'XMD-AGIAFTER':_0x220ce5[_0x5dbe('0x112')]?util[_0x5dbe('0x7e')](_0x5dbe('0x175'),ipAgi,_0x220ce5[_0x5dbe('0x112')]):'NONE','XMD-QUEUE':_0x220ce5['type']===_0x5dbe('0x9b')?util[_0x5dbe('0x7e')](_0x5dbe('0x176'),_0x220ce5[_0x5dbe('0x43')],_0x220ce5['dialQueueOptions']||'',_0x220ce5['dialAgiAfterHangupAgent']?'c':'',_0x220ce5[_0x5dbe('0x11b')]||0x3):'NONE','XMD-CONTACTID':_0x1716e7['ContactId'],'XMD-CDRTYPE':_0x5dbe('0x8'),'CALLERID(all)':_0x21f9cc[_0x5dbe('0x26')][_0x55c7c2][_0x5dbe('0x177')](),'XMD-AMD':_0x220ce5[_0x5dbe('0xe4')]?_0x5dbe('0x178'):_0x5dbe('0x174'),'XMD-DESTINATION':_0x5dbe('0xe3')};if(_0x220ce5[_0x5dbe('0xe4')]){_0x404789[_0x5dbe('0x179')]=_0x220ce5['dialAMDInitialSilence']||0x9c4;_0x404789[_0x5dbe('0x17a')]=_0x220ce5['dialAMDGreeting']||0x5dc;_0x404789['XMD-AMDAFTERGREETINGSILENCE']=_0x220ce5[_0x5dbe('0x17b')]||0x320;_0x404789[_0x5dbe('0x17c')]=_0x220ce5[_0x5dbe('0x17d')]||0x1388;_0x404789[_0x5dbe('0x17e')]=_0x220ce5[_0x5dbe('0x17f')]||0x64;_0x404789['XMD-AMDBETWEENWORDSSILENCE']=_0x220ce5['dialAMDBetweenWordsSilence']||0x32;_0x404789[_0x5dbe('0x180')]=_0x220ce5[_0x5dbe('0x181')]||0x3;_0x404789[_0x5dbe('0x182')]=_0x220ce5[_0x5dbe('0x183')]||0x100;_0x404789[_0x5dbe('0x184')]=_0x220ce5[_0x5dbe('0x185')]||0x1388;}if(_0x220ce5[_0x5dbe('0x5b')]===_0x5dbe('0x9b')){_0x404789[_0x5dbe('0x186')]=_0x1716e7['VoiceQueueId'];}else{_0x404789[_0x5dbe('0x187')]=_0x1716e7[_0x5dbe('0xff')];}for(var _0x3d34fa in _0x1716e7[_0x5dbe('0x171')]){if(_0x1716e7['Contact']['hasOwnProperty'](_0x3d34fa)){if(isNotNull(_0x1716e7[_0x5dbe('0x171')][_0x3d34fa])&&_0x3d34fa!=='id'&&_0x3d34fa!==_0x5dbe('0x188')&&_0x3d34fa!==_0x5dbe('0x189')&&_0x3d34fa!==_0x5dbe('0x18a')){_0x404789[util[_0x5dbe('0x7e')]('%s%s',_0x5dbe('0x18b'),_[_0x5dbe('0x18c')](_0x3d34fa))]=_0x1716e7[_0x5dbe('0x171')][_0x3d34fa];}}}var _0x55ef6b=_0x21f9cc['isTrunkReachable'](_0x220ce5[_0x5dbe('0x7b')])?getCallerId(_0x220ce5[_0x5dbe('0x7b')]['callerid'],_0x220ce5[_0x5dbe('0x61')],_0x220ce5[_0x5dbe('0x18d')]>0x0?getCallerIdRandom(_0x220ce5[_0x5dbe('0x62')],_0x220ce5[_0x5dbe('0x18d')]):_0x220ce5['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x220ce5[_0x5dbe('0x142')])?_0x220ce5['Trunk'][_0x5dbe('0x7d')]:_0x220ce5['TrunkBackup'][_0x5dbe('0x7d')],_0x220ce5[_0x5dbe('0x61')],_0x220ce5['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x220ce5['dialOriginateCallerIdNumber'],_0x220ce5[_0x5dbe('0x18d')]):_0x220ce5[_0x5dbe('0x62')]);if(_0x55ef6b){_0x404789[_0x5dbe('0x18e')]=_0x21f9cc[_0x5dbe('0x26')][_0x55c7c2][_0x5dbe('0x18f')]=extractCalleridName(_0x55ef6b);_0x404789[_0x5dbe('0x190')]=_0x21f9cc[_0x5dbe('0x26')][_0x55c7c2]['originatecalleridnum']=extractCalleridNumber(_0x55ef6b);}return ami[_0x5dbe('0xba')]({'actionid':_0x55c7c2,'action':_0x5dbe('0x16f'),'channel':_0x21f9cc['isTrunkReachable'](_0x220ce5[_0x5dbe('0x7b')])?util[_0x5dbe('0x7e')](_0x5dbe('0x191'),_0x220ce5[_0x5dbe('0x7b')][_0x5dbe('0x43')],isNotNull(_0x220ce5[_0x5dbe('0x64')])?_0x220ce5[_0x5dbe('0x64')][_0x5dbe('0x192')]()||'':'',_0x220ce5['dialCutDigit']>0x0?_0x1716e7[_0x5dbe('0x171')][_0x5dbe('0x172')][_0x5dbe('0x193')](_0x220ce5[_0x5dbe('0x194')]):_0x1716e7['Contact'][_0x5dbe('0x172')]):util[_0x5dbe('0x7e')](_0x5dbe('0x191'),_[_0x5dbe('0xb9')](_0x220ce5[_0x5dbe('0x142')])?_0x220ce5[_0x5dbe('0x7b')][_0x5dbe('0x43')]:_0x220ce5[_0x5dbe('0x142')][_0x5dbe('0x43')],isNotNull(_0x220ce5[_0x5dbe('0x64')])?_0x220ce5[_0x5dbe('0x64')][_0x5dbe('0x192')]()||'':'',_0x220ce5[_0x5dbe('0x194')]>0x0?_0x1716e7[_0x5dbe('0x171')][_0x5dbe('0x172')][_0x5dbe('0x193')](_0x220ce5['dialCutDigit']):_0x1716e7[_0x5dbe('0x171')][_0x5dbe('0x172')]),'callerid':_0x55ef6b,'Exten':_0x5dbe('0xe3'),'Context':_0x5dbe('0x195'),'Priority':'1','variable':_0x404789,'timeout':(_0x220ce5[_0x5dbe('0x63')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55c7c2})[_0x5dbe('0xc4')](function(_0x31b15f){return _0x1fb9d4(_0x31b15f);})['catch'](function(_0x34c215){_0x220ce5[_0x5dbe('0x6e')]+=0x1;var _0x179354=new History(_0x21f9cc[_0x5dbe('0x26')][_0x55c7c2]);logger[_0x5dbe('0xa2')](util[_0x5dbe('0x7e')](_0x5dbe('0x196'),JSON[_0x5dbe('0x4d')](_0x34c215)));_0x179354[_0x5dbe('0xe6')]=0xe;_0x179354['statedesc']=_0x5dbe('0x197');_0x179354[_0x5dbe('0xb3')]=moment()[_0x5dbe('0x7e')](_0x5dbe('0xfc'));_0x179354[_0x5dbe('0xb2')]=_0x179354[_0x5dbe('0xb3')];_0x21f9cc['createHistory'](_0x179354)[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x198')));_0x21f9cc[_0x5dbe('0xd4')](_0x179354)[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x198')))['finally'](function(){delete _0x21f9cc[_0x5dbe('0x26')][_0x55c7c2];return _0x10b482(msgResponse(_0x5dbe('0x16f'),_0x5dbe('0x4c'),'originate\x20action\x20Error'));});});});};Dialer[_0x5dbe('0x1c')]['syncOriginateResponse']=function(_0x341b48){var _0x39646d=this[_0x5dbe('0x26')][_0x341b48[_0x5dbe('0x12b')]];var _0x35fc95=this;if(_0x39646d){delete this['actions'][_0x341b48[_0x5dbe('0x12b')]];_0x39646d[_0x5dbe('0x11a')]=moment()[_0x5dbe('0x7e')](_0x5dbe('0xfc'));var _0x13d461=_0x39646d[_0x5dbe('0x5b')]===_0x5dbe('0x9c')?this[_0x5dbe('0x21')][_0x39646d['queue']]:this[_0x5dbe('0x20')][_0x39646d[_0x5dbe('0x199')]()];if(!this['isSuccess'](_0x341b48[_0x5dbe('0x19a')])){this['updateOriginated'](_0x13d461);return this[_0x5dbe('0x19b')](_0x39646d,_0x13d461,_0x341b48)['then'](function(_0xbc8cfe){})[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x19c')));}else{this[_0x5dbe('0xb5')][_0x341b48['uniqueid']]=_0x39646d;}}};Dialer['prototype'][_0x5dbe('0x19d')]=function(_0x5c8e09,_0x218988,_0x51dbb1){var _0x53f633=new History(_0x218988);if(_0x53f633[_0x5dbe('0xef')]+_0x53f633['countcongestionretry']+_0x53f633['countnoanswerretry']+_0x53f633['countnosuchnumberretry']+_0x53f633[_0x5dbe('0xf2')]+_0x53f633[_0x5dbe('0xf3')]+_0x53f633[_0x5dbe('0xec')]+_0x53f633['countagentrejectretry']>=_0x51dbb1[_0x5dbe('0xf5')]-0x1){return!![];}switch(_0x5c8e09){case 0x3:if(_0x53f633[_0x5dbe('0xf0')]>=_0x51dbb1[_0x5dbe('0x19e')]-0x1){return!![];}else{this[_0x5dbe('0xcb')]({'active':![],'countnoanswerretry':_0x53f633[_0x5dbe('0xf0')]+=0x1,'scheduledat':moment()[_0x5dbe('0x106')](_0x51dbb1['dialNoAnswerRetryFrequency'],_0x5dbe('0xfb'))[_0x5dbe('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x53f633[_0x5dbe('0xfd')],'ListId':_0x53f633[_0x5dbe('0xdb')],'VoiceQueueId':_0x53f633[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x53f633[_0x5dbe('0xff')]||undefined})['catch'](loggerCatch(_0x5dbe('0x19f')));}break;case 0x5:if(_0x53f633[_0x5dbe('0xef')]>=_0x51dbb1['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x5dbe('0xcb')]({'active':![],'countbusyretry':_0x53f633[_0x5dbe('0xef')]+=0x1,'scheduledat':moment()[_0x5dbe('0x106')](_0x51dbb1['dialBusyRetryFrequency'],_0x5dbe('0xfb'))[_0x5dbe('0x7e')](_0x5dbe('0xfc')),'ContactId':_0x53f633[_0x5dbe('0xfd')],'ListId':_0x53f633['ListId'],'VoiceQueueId':_0x53f633[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x53f633['CampaignId']||undefined})[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x1a0')));}break;case 0x8:if(_0x53f633[_0x5dbe('0x105')]>=_0x51dbb1[_0x5dbe('0x1a1')]-0x1){return!![];}else{this[_0x5dbe('0xcb')]({'active':![],'countcongestionretry':_0x53f633[_0x5dbe('0x105')]+=0x1,'scheduledat':moment()[_0x5dbe('0x106')](_0x51dbb1['dialCongestionRetryFrequency'],'minutes')[_0x5dbe('0x7e')](_0x5dbe('0xfc')),'ContactId':_0x53f633[_0x5dbe('0xfd')],'ListId':_0x53f633[_0x5dbe('0xdb')],'VoiceQueueId':_0x53f633[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x53f633[_0x5dbe('0xff')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x53f633[_0x5dbe('0xf1')]>=_0x51dbb1['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x5dbe('0xcb')]({'active':![],'countnosuchnumberretry':_0x53f633[_0x5dbe('0xf1')]+=0x1,'scheduledat':moment()[_0x5dbe('0x106')](_0x51dbb1['dialNoSuchNumberRetryFrequency'],'minutes')[_0x5dbe('0x7e')](_0x5dbe('0xfc')),'ContactId':_0x53f633['ContactId'],'ListId':_0x53f633[_0x5dbe('0xdb')],'VoiceQueueId':_0x53f633[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x53f633[_0x5dbe('0xff')]||undefined})[_0x5dbe('0xbc')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x53f633[_0x5dbe('0xf2')]>=_0x51dbb1[_0x5dbe('0x120')]-0x1){return!![];}else{this[_0x5dbe('0xcb')]({'active':![],'countdropretry':_0x53f633[_0x5dbe('0xf2')]+=0x1,'scheduledat':moment()[_0x5dbe('0x106')](_0x51dbb1[_0x5dbe('0x121')],_0x5dbe('0xfb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x53f633[_0x5dbe('0xfd')],'ListId':_0x53f633[_0x5dbe('0xdb')],'VoiceQueueId':_0x53f633[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x53f633['CampaignId']||undefined})[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x122')));}break;case 0xb:if(_0x53f633[_0x5dbe('0xf3')]>=_0x51dbb1['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x5dbe('0xcb')]({'active':![],'countabandonedretry':_0x53f633[_0x5dbe('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x51dbb1['dialAbandonedRetryFrequency'],_0x5dbe('0xfb'))['format'](_0x5dbe('0xfc')),'ContactId':_0x53f633[_0x5dbe('0xfd')],'ListId':_0x53f633[_0x5dbe('0xdb')],'VoiceQueueId':_0x53f633['VoiceQueueId']||undefined,'CampaignId':_0x53f633[_0x5dbe('0xff')]||undefined})[_0x5dbe('0xbc')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x53f633[_0x5dbe('0xec')]>=_0x51dbb1[_0x5dbe('0xf7')]-0x1){return!![];}else{this[_0x5dbe('0xcb')]({'active':![],'countmachineretry':_0x53f633[_0x5dbe('0xec')]+=0x1,'scheduledat':moment()[_0x5dbe('0x106')](_0x51dbb1[_0x5dbe('0xfa')],_0x5dbe('0xfb'))[_0x5dbe('0x7e')](_0x5dbe('0xfc')),'ContactId':_0x53f633[_0x5dbe('0xfd')],'ListId':_0x53f633[_0x5dbe('0xdb')],'VoiceQueueId':_0x53f633[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x53f633['CampaignId']||undefined})['catch'](loggerCatch(_0x5dbe('0x107')));}break;case 0x14:if(_0x53f633[_0x5dbe('0xf4')]>=_0x51dbb1['dialAgentRejectMaxRetry']-0x1){return!![];}else{this[_0x5dbe('0xcb')]({'active':![],'countagentrejectretry':_0x53f633[_0x5dbe('0xf4')]+=0x1,'scheduledat':moment()[_0x5dbe('0x106')](_0x51dbb1[_0x5dbe('0x1a2')],_0x5dbe('0xfb'))[_0x5dbe('0x7e')](_0x5dbe('0xfc')),'ContactId':_0x53f633[_0x5dbe('0xfd')],'ListId':_0x53f633[_0x5dbe('0xdb')],'VoiceQueueId':_0x53f633[_0x5dbe('0xfe')]||undefined,'CampaignId':_0x53f633[_0x5dbe('0xff')]||undefined})['catch'](loggerCatch(_0x5dbe('0x1a3')));}break;default:return!![];}};Dialer[_0x5dbe('0x1c')]['callProgressDetecting']=function(_0x33a31a,_0x4b03b9,_0x401426){var _0x559e1f=this;var _0x3a9e3f=new History(_0x33a31a);return new BPromise(function(_0x358a4b,_0x1f3437){if(_[_0x5dbe('0x40')](_0x4b03b9)&&_0x5dbe('0x16e')!==typeof _0x4b03b9){return _0x1f3437(msgResponse(_0x5dbe('0x1a4'),_0x5dbe('0x146'),'entity\x20is\x20undefine'));}if(_[_0x5dbe('0x40')](_0x401426)&&_0x5dbe('0x16e')!==typeof _0x401426){return _0x1f3437(msgResponse(_0x5dbe('0x1a4'),_0x5dbe('0x146'),_0x5dbe('0x1a5')));}switch(_0x401426[_0x5dbe('0x111')]){case'0':_0x4b03b9[_0x5dbe('0x6d')]+=0x1;_0x3a9e3f[_0x5dbe('0xe6')]=0x0;_0x3a9e3f[_0x5dbe('0xb1')]=_0x5dbe('0x1a6');_0x3a9e3f[_0x5dbe('0xf1')]+=0x1;_0x3a9e3f[_0x5dbe('0xed')]+=0x1;ami[_0x5dbe('0x51')]('custom:agentnosuchnumber',ut[_0x5dbe('0x1a7')](_0x33a31a,'nosuchnumber'));_0x559e1f[_0x5dbe('0xd5')](_0x3a9e3f)[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x104')));if(_0x559e1f[_0x5dbe('0x19d')](0x0,_0x33a31a,_0x4b03b9)){if(_0x3a9e3f[_0x5dbe('0xf1')]>=_0x4b03b9[_0x5dbe('0x1a8')]){_0x559e1f[_0x5dbe('0xf8')](_0x3a9e3f,_0x358a4b,_0x1f3437,'reason\x200\x20no\x20such\x20number....');}else{_0x559e1f[_0x5dbe('0xf6')](_0x3a9e3f,_0x358a4b,_0x1f3437,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x4b03b9[_0x5dbe('0x6c')]+=0x1;_0x3a9e3f[_0x5dbe('0xe6')]=0x3;_0x3a9e3f['statedesc']='NoAnswer';_0x3a9e3f[_0x5dbe('0xf0')]+=0x1;_0x3a9e3f['countglobal']+=0x1;ami[_0x5dbe('0x51')]('custom:agentnoanswer',ut[_0x5dbe('0x1a7')](_0x33a31a,_0x5dbe('0x1a9')));_0x559e1f['createHistory'](_0x3a9e3f)[_0x5dbe('0xbc')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x559e1f['checkRetriveMax'](0x3,_0x33a31a,_0x4b03b9)){if(_0x3a9e3f[_0x5dbe('0xf0')]>=_0x4b03b9[_0x5dbe('0x19e')]){_0x559e1f['createStateFinal'](_0x3a9e3f,_0x358a4b,_0x1f3437,_0x5dbe('0x1aa'));}else{_0x559e1f[_0x5dbe('0xf6')](_0x3a9e3f,_0x358a4b,_0x1f3437,_0x5dbe('0x1aa'));}}break;case'5':_0x4b03b9[_0x5dbe('0x67')]+=0x1;_0x3a9e3f['state']=0x5;_0x3a9e3f[_0x5dbe('0xb1')]='Busy';_0x3a9e3f['countbusyretry']+=0x1;_0x3a9e3f['countglobal']+=0x1;ami[_0x5dbe('0x51')](_0x5dbe('0x1ab'),ut['buildObj'](_0x33a31a,_0x5dbe('0x1ac')));_0x559e1f['createHistory'](_0x3a9e3f)[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x1ad')));if(_0x559e1f[_0x5dbe('0x19d')](0x5,_0x33a31a,_0x4b03b9)){if(_0x3a9e3f['countbusyretry']>=_0x4b03b9['dialBusyMaxRetry']){_0x559e1f[_0x5dbe('0xf8')](_0x3a9e3f,_0x358a4b,_0x1f3437,'reason\x205\x20busy');}else{_0x559e1f[_0x5dbe('0xf6')](_0x3a9e3f,_0x358a4b,_0x1f3437,_0x5dbe('0x1ae'));}}break;case'8':_0x4b03b9[_0x5dbe('0x68')]+=0x1;_0x3a9e3f[_0x5dbe('0xe6')]=0x8;_0x3a9e3f[_0x5dbe('0xb1')]=_0x5dbe('0x1af');_0x3a9e3f[_0x5dbe('0x105')]+=0x1;_0x3a9e3f['countglobal']+=0x1;ami[_0x5dbe('0x51')](_0x5dbe('0x1b0'),ut[_0x5dbe('0x1a7')](_0x33a31a,'congestion'));_0x559e1f['createHistory'](_0x3a9e3f)[_0x5dbe('0xbc')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x559e1f[_0x5dbe('0x19d')](0x8,_0x33a31a,_0x4b03b9)){if(_0x3a9e3f[_0x5dbe('0x105')]>=_0x4b03b9[_0x5dbe('0x1a1')]){_0x559e1f['createStateFinal'](_0x3a9e3f,_0x358a4b,_0x1f3437,_0x5dbe('0x1b1'));}else{_0x559e1f['stateGlobal'](_0x3a9e3f,_0x358a4b,_0x1f3437,_0x5dbe('0x1b1'));}}break;case'11':_0x4b03b9[_0x5dbe('0x1b2')]+=0x1;_0x3a9e3f[_0x5dbe('0xe6')]=0xb;_0x3a9e3f['statedesc']=_0x5dbe('0x126');_0x3a9e3f['countabandonedretry']+=0x1;_0x3a9e3f[_0x5dbe('0xed')]+=0x1;_0x559e1f['createHistory'](_0x3a9e3f)['catch'](loggerCatch(_0x5dbe('0x129')));if(_0x559e1f['checkRetriveMax'](0xb,_0x33a31a,_0x4b03b9)){if(_0x3a9e3f[_0x5dbe('0xf3')]>=_0x4b03b9[_0x5dbe('0x1b3')]){_0x559e1f['createStateFinal'](_0x3a9e3f,_0x358a4b,_0x1f3437,_0x5dbe('0x1b4'));}else{_0x559e1f[_0x5dbe('0xf6')](_0x3a9e3f,_0x358a4b,_0x1f3437,_0x5dbe('0x1b4'));}}break;case'20':_0x4b03b9[_0x5dbe('0x1b5')]+=0x1;_0x3a9e3f[_0x5dbe('0xe6')]=0x14;_0x3a9e3f[_0x5dbe('0xb1')]='AgentReject';_0x3a9e3f[_0x5dbe('0xf4')]+=0x1;_0x3a9e3f[_0x5dbe('0xed')]+=0x1;ami[_0x5dbe('0x51')](_0x5dbe('0x1b6'),ut[_0x5dbe('0x1a7')](_0x33a31a,_0x5dbe('0x1b7')));_0x559e1f[_0x5dbe('0xd5')](_0x3a9e3f)['catch'](loggerCatch(_0x5dbe('0x1b8')));if(_0x559e1f['checkRetriveMax'](0x14,_0x33a31a,_0x4b03b9)){if(_0x3a9e3f[_0x5dbe('0xf4')]>=_0x4b03b9[_0x5dbe('0x1b9')]){_0x559e1f[_0x5dbe('0xf8')](_0x3a9e3f,_0x358a4b,_0x1f3437,'reason\x2020\x20agentreject');}else{_0x559e1f[_0x5dbe('0xf6')](_0x3a9e3f,_0x358a4b,_0x1f3437,_0x5dbe('0x1ba'));}}break;default:_0x4b03b9[_0x5dbe('0x10e')]+=0x1;_0x3a9e3f[_0x5dbe('0xe6')]=0xc;_0x3a9e3f['statedesc']=_0x401426[_0x5dbe('0x111')];_0x559e1f[_0x5dbe('0xd5')](_0x3a9e3f)['catch'](loggerCatch(_0x5dbe('0x1bb')));if(_0x559e1f['checkRetriveMax'](_0x401426[_0x5dbe('0x111')],_0x33a31a,_0x4b03b9)){if(_0x3a9e3f[_0x5dbe('0xef')]+_0x3a9e3f[_0x5dbe('0x105')]+_0x3a9e3f[_0x5dbe('0xf0')]+_0x3a9e3f[_0x5dbe('0xf1')]+_0x3a9e3f['countdropretry']+_0x3a9e3f[_0x5dbe('0xf3')]+_0x3a9e3f[_0x5dbe('0xec')]+_0x3a9e3f[_0x5dbe('0xf4')]>=_0x4b03b9['dialGlobalMaxRetry']){_0x559e1f[_0x5dbe('0xf6')](_0x3a9e3f,_0x358a4b,_0x1f3437,_0x401426[_0x5dbe('0x111')]);}else{_0x559e1f[_0x5dbe('0xf8')](_0x3a9e3f,_0x358a4b,_0x1f3437,_0x401426[_0x5dbe('0x111')]);}}}});};Dialer['prototype'][_0x5dbe('0xf6')]=function(_0x1c5c75,_0x1e88b0,_0x346c9f,_0x53d34a){var _0x3a88cf=new Final(_0x1c5c75);_0x3a88cf['state']=0xf;_0x3a88cf[_0x5dbe('0xb1')]=_0x5dbe('0x1bc');this['createStateFinal'](_0x3a88cf,_0x1e88b0,_0x346c9f,_0x53d34a);};Dialer[_0x5dbe('0x1c')][_0x5dbe('0xf8')]=function(_0x5de6ec,_0x252bd4,_0x4c7a96,_0x1a9fc0){this['moveContactManagedDialer'](_0x5de6ec)['then'](function(_0x25c661){return _0x252bd4(msgResponse('[callProgressDetecting]',_0x5dbe('0xdd'),_0x1a9fc0));})[_0x5dbe('0xbc')](function(_0x510d02){return _0x4c7a96(msgResponse('[moveContactManagedDialer][0]',_0x5dbe('0x146'),_0x5dbe('0x1bd')));});};Dialer['prototype'][_0x5dbe('0xa')]=function(_0x278e83){var _0x16da23=this;var _0x4f5c49=_0x278e83[_0x5dbe('0x1be')]/0x64;var _0x3cc877=_0x278e83[_0x5dbe('0x6b')]/(_0x278e83['outboundDropCallsDayTimeout']+_0x278e83['outboundAnswerCallsDay']);var _0x4332f2=Math[_0x5dbe('0x1bf')](_0x278e83[_0x5dbe('0x76')]*(_0x278e83[_0x5dbe('0x1c0')]/0x64));var _0x4c31c6=Math[_0x5dbe('0x1bf')](_0x278e83[_0x5dbe('0x76')]*(_0x278e83[_0x5dbe('0x1c1')]/0x64));var _0x28d71e=_0x278e83['available']+_0x278e83[_0x5dbe('0x59')];var _0x1f7bc9=Math[_0x5dbe('0x1c2')](_0x278e83['erlangCalls']*_0x278e83[_0x5dbe('0x7a')]*_0x278e83['predictiveIntervalHitRate']*_0x278e83['predictiveIntervalMultiplicativeFactor']);if(_[_0x5dbe('0x40')](_0x278e83[_0x5dbe('0x97')])){if(!_[_0x5dbe('0x40')](_0x278e83[_0x5dbe('0x29')])){_0x278e83[_0x5dbe('0x29')]=undefined;loggerPredictive[_0x5dbe('0xa2')](_0x5dbe('0x1c3'),_0x5dbe('0x1c4'));}if(!_[_0x5dbe('0x40')](_0x278e83[_0x5dbe('0x99')])){loggerPredictive[_0x5dbe('0xa2')](_0x5dbe('0x1c3'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x278e83[_0x5dbe('0x99')]);_0x278e83[_0x5dbe('0x99')]=undefined;}_0x278e83['startProgressive']=moment()[_0x5dbe('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x278e83[_0x5dbe('0x43')],'collection\x20data\x20in\x20progressive\x20at',_0x278e83[_0x5dbe('0x97')]);this[_0x5dbe('0x15d')](_0x278e83,0x1);}else if(ifInterval(_0x278e83[_0x5dbe('0x1c5')],_0x278e83[_0x5dbe('0x97')])){this[_0x5dbe('0x15d')](_0x278e83,0x1);loggerPredictiveCalls['info'](_0x5dbe('0x1c6'),_0x278e83[_0x5dbe('0x97')],_0x278e83[_0x5dbe('0x43')]);_0x278e83[_0x5dbe('0x1c7')]=0x0;_0x278e83[_0x5dbe('0x1c8')]=0x0;}else if(_0x4f5c49<_0x3cc877&&_0x278e83['dialPredictiveOptimization']===_0x5dbe('0x1c9')){freeVariablesPredictive(_0x278e83);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x1ca'),_0x5dbe('0x1cb'),_0x3cc877,'startProgressive',_0x278e83['name']);}else if(_0x1f7bc9<_0x278e83[_0x5dbe('0x1c8')]&&_0x278e83[_0x5dbe('0x1cc')]===_0x5dbe('0x1c9')){freeVariablesPredictive(_0x278e83);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x1cd'),_0x5dbe('0x1ce'),_0x1f7bc9,_0x5dbe('0x1cf'),_0x278e83['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x278e83[_0x5dbe('0x43')]);}else if(!ifInterval(_0x278e83['dialPredictiveInterval'],_0x278e83[_0x5dbe('0x97')])&&_[_0x5dbe('0x40')](_0x278e83[_0x5dbe('0x29')])&&!_['isUndefined'](_0x278e83[_0x5dbe('0x97')])){_0x278e83['startPredictive']=moment()[_0x5dbe('0x7e')](_0x5dbe('0xfc'));loggerPredictive[_0x5dbe('0x82')](_0x278e83['name'],'started\x20in\x20predictive\x20at',_0x278e83[_0x5dbe('0x29')]);this[_0x5dbe('0xca')](_0x278e83[_0x5dbe('0x1c5')])[_0x5dbe('0xc4')](this['getDataPredictive'](_0x278e83))['then'](mergeDataErlangB(_0x278e83))[_0x5dbe('0xc4')](this['startMethodPredictive'](_0x278e83))[_0x5dbe('0xbc')](loggerCatchPredictive(_0x5dbe('0x1d0'),_0x278e83));}else if(!ifInterval(_0x278e83['dialPredictiveInterval'],_0x278e83[_0x5dbe('0x29')])){_0x278e83[_0x5dbe('0x1c8')]=0x0;_0x278e83[_0x5dbe('0x29')]=moment()[_0x5dbe('0x7e')](_0x5dbe('0xfc'));loggerPredictive[_0x5dbe('0x82')](_0x278e83[_0x5dbe('0x43')],_0x5dbe('0x1d1'),_0x278e83['startPredictive']);clearInterval(_0x278e83['handlePredictive']);_0x278e83[_0x5dbe('0x99')]=undefined;this[_0x5dbe('0xca')](_0x278e83[_0x5dbe('0x1c5')])[_0x5dbe('0xc4')](this[_0x5dbe('0x1d2')](_0x278e83))[_0x5dbe('0xc4')](mergeDataErlangB(_0x278e83))[_0x5dbe('0xc4')](this['startMethodPredictive'](_0x278e83))[_0x5dbe('0xbc')](loggerCatchPredictive(_0x5dbe('0x1d3'),_0x278e83));}else if(_0x278e83[_0x5dbe('0x76')]&&_0x28d71e<_0x278e83[_0x5dbe('0x76')]-_0x4c31c6){freeVariablesPredictive(_0x278e83);loggerPredictive[_0x5dbe('0x82')](_0x278e83[_0x5dbe('0x43')],_0x5dbe('0x1d4'),_0x28d71e,_0x5dbe('0x1d5'),_0x278e83['predictiveIntervalAvailable'],'-',_0x4c31c6,'=',_0x278e83[_0x5dbe('0x76')]-_0x4c31c6,')');}else if(_0x278e83[_0x5dbe('0x76')]&&_0x28d71e>_0x278e83[_0x5dbe('0x76')]+_0x4332f2){freeVariablesPredictive(_0x278e83);loggerPredictive['info'](_0x278e83[_0x5dbe('0x43')],_0x5dbe('0x1d4'),_0x28d71e,_0x5dbe('0x1d6'),_0x278e83[_0x5dbe('0x76')],'+',_0x4332f2,'=',_0x278e83['predictiveIntervalAvailable']+_0x4332f2,')');}};Dialer[_0x5dbe('0x1c')][_0x5dbe('0x1d2')]=function(_0x21e17d){var _0x12d056=this;return function(_0x193bb5){return new BPromise(function(_0x3f2eac,_0x2aa8eb){_[_0x5dbe('0x96')](_0x21e17d,_0x193bb5[0x0]);if(checkGetDataPredictive(_0x193bb5[0x0])){var _0x5a0d4=_0x21e17d[_0x5dbe('0x76')]=_0x21e17d[_0x5dbe('0x59')]+_0x21e17d['available'];var _0x589645=_0x21e17d['dialPredictiveInterval']*0x3c;var _0x4a2165=_0x193bb5[0x0][_0x5dbe('0x70')]+_0x193bb5[0x0][_0x5dbe('0x8a')];var _0x3a813a=(_0x193bb5[0x0][_0x5dbe('0x85')]+_0x193bb5[0x0][_0x5dbe('0x87')]+_0x193bb5[0x0][_0x5dbe('0x71')])/_0x193bb5[0x0]['predictiveIntervalTotalCalls'];_0x21e17d[_0x5dbe('0x73')]=_0x3a813a>0x0?_0x3a813a:0x1;switch(_0x21e17d[_0x5dbe('0x1cc')]){case _0x5dbe('0x1c9'):var _0x35c869=_0x21e17d[_0x5dbe('0x1be')]/0x64;return _0x12d056[_0x5dbe('0x1d7')](_0x5a0d4,_0x589645,_0x4a2165,_0x3a813a,_0x35c869)['then'](function(_0x3a3c1e){return _0x3f2eac(_0x3a3c1e);});case'agentBusyFactor':var _0x52384b=_0x21e17d[_0x5dbe('0x1be')]/0x64;return _0x12d056[_0x5dbe('0x1d8')](_0x5a0d4,_0x589645,_0x4a2165,_0x3a813a,_0x52384b)[_0x5dbe('0xc4')](function(_0x5a855c){return _0x3f2eac(_0x5a855c);});default:return _0x2aa8eb(msgResponse(_0x5dbe('0x1d9'),_0x5dbe('0x146'),_0x5dbe('0x1da')));}}else{return _0x2aa8eb(msgResponse(_0x5dbe('0x1d9'),_0x5dbe('0x146'),_0x5dbe('0x1db')));}});};};Dialer[_0x5dbe('0x1c')][_0x5dbe('0x1dc')]=function(_0x4e828f){var _0x5ddb46=this;return function(_0x24e580){return new BPromise(function(_0x65490a,_0x2d256e){_['merge'](_0x4e828f,_0x24e580[0x0]);if(checkGetDataPredictive(_0x24e580[0x0])){loggerPredictive[_0x5dbe('0x82')](JSON[_0x5dbe('0x4d')](_0x24e580[0x0]));if(_0x4e828f['dialPredictiveOptimization']==='dropRate'){return _0x5ddb46[_0x5dbe('0xd2')](_0x4e828f['id'])[_0x5dbe('0xc4')](function(_0x1ee6a9){var _0x220972=_0x4e828f[_0x5dbe('0x55')]-_0x1ee6a9[0x0][_0x5dbe('0x1dd')];var _0x5a5e99=_0x4e828f[_0x5dbe('0x1c5')]*0x3c;var _0x49c7e3=_0x24e580[0x0][_0x5dbe('0x70')]+_0x24e580[0x0][_0x5dbe('0x8a')];var _0x37efad=(_0x24e580[0x0][_0x5dbe('0x85')]+_0x24e580[0x0][_0x5dbe('0x87')]+_0x24e580[0x0][_0x5dbe('0x71')])/_0x24e580[0x0][_0x5dbe('0x77')];var _0x4e5c34=_0x4e828f['dialPredictiveOptimizationPercentage']/0x64;_0x4e828f[_0x5dbe('0x75')]=_0x1ee6a9[0x0][_0x5dbe('0x1dd')]||0x0;_0x4e828f[_0x5dbe('0x73')]=_0x37efad>0x0?_0x37efad:0x1;return _0x5ddb46[_0x5dbe('0x1d7')](_0x220972,_0x5a5e99,_0x49c7e3,_0x37efad,_0x4e5c34);})[_0x5dbe('0xc4')](function(_0x532498){return _0x65490a(_0x532498);})[_0x5dbe('0xbc')](function(_0x16c50a){return _0x2d256e(msgResponse('[CatchErlangB]','Failure',JSON[_0x5dbe('0x4d')](_0x16c50a)));});}if(_0x4e828f[_0x5dbe('0x1cc')]===_0x5dbe('0x1de')){return _0x5ddb46['getVoiceQueueRtPauses'](_0x4e828f['id'])[_0x5dbe('0xc4')](function(_0x22206a){var _0x4da282=_0x4e828f[_0x5dbe('0x55')]-_0x22206a[0x0][_0x5dbe('0x1dd')];var _0x390839=_0x4e828f[_0x5dbe('0x1c5')]*0x3c;var _0x2fc626=_0x24e580[0x0][_0x5dbe('0x70')]+_0x24e580[0x0][_0x5dbe('0x8a')];var _0x3f5182=(_0x24e580[0x0]['predictiveIntervalAnsweredCalls']+_0x24e580[0x0][_0x5dbe('0x87')]+_0x24e580[0x0][_0x5dbe('0x71')])/_0x24e580[0x0]['predictiveIntervalTotalCalls'];var _0x280339=_0x4e828f[_0x5dbe('0x1be')]/0x64;_0x4e828f['predictiveIntervalPauses']=_0x22206a[0x0][_0x5dbe('0x1dd')]||0x0;_0x4e828f['predictiveIntervalHitRate']=_0x3f5182>0x0?_0x3f5182:0x1;return _0x5ddb46[_0x5dbe('0x1d8')](_0x4da282,_0x390839,_0x2fc626,_0x3f5182,_0x280339);})[_0x5dbe('0xc4')](function(_0x3174cd){return _0x65490a(_0x3174cd);})['catch'](function(_0x2f45b1){return _0x2d256e(msgResponse('[CatchErlangB]',_0x5dbe('0x146'),JSON['stringify'](_0x2f45b1)));});}}else{return _0x2d256e(msgResponse(_0x5dbe('0x1d9'),_0x5dbe('0x146'),_0x5dbe('0x1db')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x1a0c74){var _0xa1405b=this;return function(){var _0x59175f=0x0;var _0x2d6348=Math[_0x5dbe('0x1c2')](_0x1a0c74[_0x5dbe('0x79')]*0x3e8);if(_0x2d6348>0x0){_0x2d6348=_0x2d6348<0x64?0x64:_0x2d6348;loggerPredictive[_0x5dbe('0x82')](_0x1a0c74['name'],_0x5dbe('0x1df'),_0x2d6348,'milliseconds');_0x1a0c74[_0x5dbe('0x99')]=setInterval(function(){_0xa1405b[_0x5dbe('0x99')](_0x1a0c74);loggerPredictiveCalls[_0x5dbe('0x82')](_0x5dbe('0x1e0'),_0x59175f+=0x1);},_0x2d6348);}else{loggerPredictive[_0x5dbe('0x82')](_0x1a0c74[_0x5dbe('0x43')],_0x5dbe('0x1e1'));}};};Dialer['prototype'][_0x5dbe('0x1e2')]=function(_0x20db5f,_0x3cde4e){var _0x273c91=this;return function(_0x3ad59b){if(_[_0x5dbe('0x4a')](_0x3ad59b)){if(_[_0x5dbe('0xb9')](_0x3cde4e[_0x5dbe('0x1e3')])||!_0x3cde4e[_0x5dbe('0x1e4')]){if(_0x20db5f[_0x5dbe('0x60')]===_0x5dbe('0x9')){_0x20db5f['queueStatusComplete']=_[_0x5dbe('0x40')](_0x20db5f[_0x5dbe('0x131')])?!![]:_0x20db5f[_0x5dbe('0x131')];var _0x32d7b8=uuid['v4']();_0x273c91[_0x5dbe('0x26')][_0x32d7b8]=new Action(_0x20db5f,_0x3cde4e,_0x32d7b8);loggerBooked['info']('[booked][checkContactBlack]',_0x32d7b8,_0x5dbe('0x1e5'),JSON[_0x5dbe('0x4d')](_0x20db5f[_0x5dbe('0x131')]),'Queue:\x20',_0x20db5f[_0x5dbe('0x43')]);if(_0x20db5f[_0x5dbe('0x131')]){_0x20db5f[_0x5dbe('0x131')]=![];_0x273c91[_0x5dbe('0x2b')][_0x273c91[_0x5dbe('0x26')][_0x32d7b8]['queue']]=[];ami[_0x5dbe('0xba')]({'actionid':_0x32d7b8,'action':_0x5dbe('0x1e6'),'queue':_0x20db5f[_0x5dbe('0x43')]})[_0x5dbe('0xbc')](function(_0x265c4e){_0x273c91[_0x5dbe('0xbe')](_0x20db5f);_0x273c91[_0x5dbe('0xcb')]({'active':![],'ContactId':_0x273c91['actions'][_0x32d7b8][_0x5dbe('0xfd')],'ListId':_0x273c91[_0x5dbe('0x26')][_0x32d7b8][_0x5dbe('0xdb')],'VoiceQueueId':_0x273c91[_0x5dbe('0x26')][_0x32d7b8][_0x5dbe('0xfe')]||undefined,'CampaignId':_0x273c91[_0x5dbe('0x26')][_0x32d7b8][_0x5dbe('0xff')]||undefined})[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x1e7')));delete _0x273c91[_0x5dbe('0x26')][_0x32d7b8];});}else{loggerBooked[_0x5dbe('0x82')](_0x5dbe('0x1e8'),JSON[_0x5dbe('0x4d')](_0x20db5f[_0x5dbe('0x131')]),_0x5dbe('0x1e9'),_0x20db5f['name']);_0x273c91[_0x5dbe('0xbe')](_0x20db5f);_0x273c91[_0x5dbe('0xcb')]({'active':![],'ContactId':_0x273c91[_0x5dbe('0x26')][_0x32d7b8]['ContactId'],'ListId':_0x273c91['actions'][_0x32d7b8]['ListId'],'VoiceQueueId':_0x273c91[_0x5dbe('0x26')][_0x32d7b8][_0x5dbe('0xfe')]||undefined,'CampaignId':_0x273c91[_0x5dbe('0x26')][_0x32d7b8][_0x5dbe('0xff')]||undefined})[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x1e7')));delete _0x273c91[_0x5dbe('0x26')][_0x32d7b8];}}else{return _0x273c91[_0x5dbe('0x16d')](_0x20db5f,_0x3cde4e);}}else{if(getDiff(_0x3cde4e['scheduledat'])<_0x20db5f[_0x5dbe('0x1ea')]*0x3c){if(_0x3cde4e['Agent']&&!_0x3cde4e[_0x5dbe('0x1eb')]['voicePause']){_0x273c91[_0x5dbe('0x1f')][_0x5dbe('0x1ec')](_0x3cde4e['id'])['finally'](function(){_0x273c91['updateOriginated'](_0x20db5f);});}else{_0x273c91[_0x5dbe('0xcd')]({'active':![]},_0x3cde4e['id'],0x1)['finally'](function(){console[_0x5dbe('0x1ed')](_0x5dbe('0x1ee'));_0x273c91[_0x5dbe('0xbe')](_0x20db5f);});}}else{_0x20db5f[_0x5dbe('0x6f')]+=0x1;_0x273c91['updateOriginated'](_0x20db5f);if(_0x20db5f[_0x5dbe('0x1ef')]){_0x273c91[_0x5dbe('0xcb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3cde4e['ContactId'],'ListId':_0x3cde4e[_0x5dbe('0xdb')],'VoiceQueueId':_0x3cde4e['VoiceQueueId']||undefined,'CampaignId':_0x3cde4e['CampaignId']||undefined})[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x1f0')));_0x273c91[_0x5dbe('0xd5')](createObjHistory(_0x20db5f,_0x3cde4e,'RECALLINQUEUE',0x17,_0x5dbe('0x1f1')))[_0x5dbe('0xbc')](loggerCatch(_0x5dbe('0x1f2')));}else{_0x273c91[_0x5dbe('0xda')](createObjHistory(_0x20db5f,_0x3cde4e,'RECALLFAILEDTIMEOUT',0x16,_0x5dbe('0x1f3')),_0x5dbe('0x1f4'),_0x5dbe('0x1f5'));}}}}else{_0x20db5f[_0x5dbe('0x66')]+=0x1;_0x273c91[_0x5dbe('0xda')](createObjHistory(_0x20db5f,_0x3cde4e,_0x5dbe('0x1f6'),0xd,'Blacklist'),_0x5dbe('0x1f7'),'[Originate][MoveBlacklist]');throw _0x5dbe('0x1f8');}};};Dialer['prototype'][_0x5dbe('0x160')]=function(_0x18178f){var _0x350514=this;var _0x40ff06=[];var _0x278bfb=_0x18178f[_0x5dbe('0x1f9')]-_0x18178f['originated']-_0x18178f[_0x5dbe('0x1fa')];emitCampaignSummary(_0x18178f);if(_0x278bfb>0x0){if(_0x278bfb>this['maxNumberOriginate']){_0x278bfb=this[_0x5dbe('0x24')];}_0x18178f[_0x5dbe('0x1fa')]+=_0x278bfb;this[_0x5dbe('0xd1')](_0x18178f['id'],_0x278bfb,_0x18178f[_0x5dbe('0x1fb')])[_0x5dbe('0xc4')](function(_0x2976b2){_0x18178f[_0x5dbe('0x1fa')]-=_0x278bfb;_0x18178f['temp']=_0x18178f[_0x5dbe('0x1fa')]>0x0?_0x18178f[_0x5dbe('0x1fa')]:0x0;if(!checkContactEmpty(_0x2976b2)){_0x18178f['message']=_0x5dbe('0xa9');logger[_0x5dbe('0x82')](_0x5dbe('0x1fc')+_0x18178f[_0x5dbe('0x43')]);}else{_0x18178f[_0x5dbe('0x78')]+=_0x2976b2[_0x5dbe('0xa3')];_0x18178f[_0x5dbe('0x41')]=_0x5dbe('0x1fd');for(var _0x5c119a=0x0;_0x5c119a<_0x2976b2['length'];_0x5c119a+=0x1){_0x18178f[_0x5dbe('0x1fe')]+=0x1;if(_['isNil'](_0x2976b2[_0x5c119a])||_[_0x5dbe('0xb9')](_0x2976b2[_0x5c119a][_0x5dbe('0x171')])||_[_0x5dbe('0xb9')](_0x2976b2[_0x5c119a][_0x5dbe('0x171')][_0x5dbe('0x172')])){_0x350514[_0x5dbe('0x1ff')]('[actionOriginate]\x20',_0x18178f,_0x2976b2[_0x5c119a]);}else{_0x350514[_0x5dbe('0xc8')](_[_0x5dbe('0x132')](_0x2976b2[_0x5c119a],[_0x5dbe('0xff'),_0x5dbe('0x200')]))[_0x5dbe('0xc4')](_0x350514[_0x5dbe('0x1e2')](_0x18178f,_0x2976b2[_0x5c119a]))[_0x5dbe('0xbc')](_0x350514[_0x5dbe('0xd8')](_0x5dbe('0x201'),_0x18178f));}}}})[_0x5dbe('0xbc')](loggerGetContactDialer(_0x5dbe('0x202'),_0x18178f,_0x278bfb));}};Dialer['prototype'][_0x5dbe('0x15d')]=function(_0x28c902,_0x113fa9){var _0x2db6f4=this;var _0x57d7ef=[];var _0x26b84e=_0x113fa9>=0x1?_0x113fa9:0x1;var _0xd70e1=[];if(_0x28c902[_0x5dbe('0x60')]==='booked'){_0x26b84e=0x1;}var _0x302bbb=Math[_0x5dbe('0x1c2')](_0x28c902['available']*_0x26b84e)-_0x28c902[_0x5dbe('0x78')]-_0x28c902[_0x5dbe('0x1fa')];emitVoiceQueueSummary(_0x28c902);if(_0x28c902[_0x5dbe('0x203')]>0x0){var _0xaf417c=_0x28c902[_0x5dbe('0x203')]-_0x28c902[_0x5dbe('0x78')]-_0x28c902[_0x5dbe('0x59')]-_0x28c902['temp']-_0x28c902[_0x5dbe('0x56')];if(_0x302bbb>_0xaf417c){_0x302bbb=_0xaf417c;}}if(_0x302bbb>0x0){if(_0x28c902['dialMethod']==='booked'){_0x302bbb=0x1;}if(_0x302bbb>this[_0x5dbe('0x24')]){_0x302bbb=this[_0x5dbe('0x24')];}_0x28c902['temp']+=_0x302bbb;for(var _0x270eb4 in this['agents']){if(this[_0x5dbe('0x22')][_0x5dbe('0xa4')](_0x270eb4)){if(this[_0x5dbe('0x22')][_0x270eb4][_0x5dbe('0xe6')]===_0x5dbe('0x204')&&this['agents'][_0x270eb4]['status']===_0x5dbe('0x205')){_0x57d7ef['push'](this[_0x5dbe('0x22')][_0x270eb4]['id']);}}}this[_0x5dbe('0xcf')](_0x28c902['id'],_0x57d7ef,_0x302bbb,_0x28c902[_0x5dbe('0x1fb')])[_0x5dbe('0xc4')](function(_0x2df93b){_0x28c902[_0x5dbe('0x1fa')]-=_0x302bbb;_0x28c902[_0x5dbe('0x1fa')]=_0x28c902['temp']>0x0?_0x28c902[_0x5dbe('0x1fa')]:0x0;if(!checkContactEmpty(_0x2df93b)){_0x2db6f4[_0x5dbe('0xc2')](_0x28c902)[_0x5dbe('0xc4')](sendMessageReschedule(_0x28c902))[_0x5dbe('0xbc')](loggerCatch('[countReScheduled]\x20'));}else{_0x28c902[_0x5dbe('0x78')]+=_0x2df93b[_0x5dbe('0xa3')];_0x28c902[_0x5dbe('0x41')]=_0x28c902['dialMethod']===_0x5dbe('0x9')?_0x5dbe('0x178'):_0x5dbe('0x1fd');for(var _0x27cc43=0x0;_0x27cc43<_0x2df93b[_0x5dbe('0xa3')];_0x27cc43+=0x1){if(_[_0x5dbe('0xb9')](_0x2df93b[_0x27cc43])||_[_0x5dbe('0xb9')](_0x2df93b[_0x27cc43][_0x5dbe('0x171')])||_['isNil'](_0x2df93b[_0x27cc43][_0x5dbe('0x171')][_0x5dbe('0x172')])){_0x2db6f4[_0x5dbe('0x1ff')](_0x5dbe('0x206'),_0x28c902,_0x2df93b[_0x27cc43]);}else{_0x2db6f4[_0x5dbe('0xc6')](_[_0x5dbe('0x132')](_0x2df93b[_0x27cc43],[_0x5dbe('0xfe'),_0x5dbe('0x200')]))[_0x5dbe('0xc4')](_0x2db6f4[_0x5dbe('0x1e2')](_0x28c902,_0x2df93b[_0x27cc43]))[_0x5dbe('0xbc')](_0x2db6f4[_0x5dbe('0xd8')](_0x5dbe('0x206'),_0x28c902));}}}})[_0x5dbe('0xbc')](loggerGetContactDialer(_0x5dbe('0x207'),_0x28c902,_0x302bbb));}};Dialer['prototype'][_0x5dbe('0x99')]=function(_0x16e8a6){var _0x166d12=this;if(_0x16e8a6[_0x5dbe('0x203')]>0x0){var _0x208838=_0x16e8a6[_0x5dbe('0x203')]-_0x16e8a6[_0x5dbe('0x78')]-_0x16e8a6[_0x5dbe('0x59')];if(_0x208838>0x0){this[_0x5dbe('0x208')](_0x16e8a6);}else{loggerPredictiveCalls[_0x5dbe('0x82')](_0x5dbe('0x209'));}}else{this['tryOriginatePredictive'](_0x16e8a6);}};Dialer['prototype'][_0x5dbe('0x208')]=function(_0x2b2ccf){var _0x3d5bbd=this;var _0x1e685b=[];_0x2b2ccf[_0x5dbe('0x78')]+=0x1;for(var _0x2c6258 in this[_0x5dbe('0x22')]){if(this['agents'][_0x5dbe('0xa4')](_0x2c6258)){if(this[_0x5dbe('0x22')][_0x2c6258]['state']===_0x5dbe('0x204')&&this['agents'][_0x2c6258][_0x5dbe('0xdf')]===_0x5dbe('0x205')){_0x1e685b[_0x5dbe('0x14c')](this['agents'][_0x2c6258]['id']);}}}this[_0x5dbe('0xcf')](_0x2b2ccf['id'],_0x1e685b,0x1,_0x2b2ccf[_0x5dbe('0x1fb')])['then'](function(_0xba0000){if(!checkContactEmpty(_0xba0000)){checkContactLowerLimitOriginate(_0x2b2ccf,0x1,0x0);_0x3d5bbd[_0x5dbe('0xc2')](_0x2b2ccf)[_0x5dbe('0xc4')](sendMessageReschedule(_0x2b2ccf))['catch'](loggerCatch(_0x5dbe('0xc5')));}else{_0x2b2ccf[_0x5dbe('0x41')]=_0x5dbe('0x1fd');if(_[_0x5dbe('0xb9')](_0xba0000[0x0])||_['isNil'](_0xba0000[0x0][_0x5dbe('0x171')])||_[_0x5dbe('0xb9')](_0xba0000[0x0]['Contact'][_0x5dbe('0x172')])){_0x3d5bbd[_0x5dbe('0x1ff')](_0x5dbe('0x206'),_0x2b2ccf,_0xba0000[0x0]);}else{_0x3d5bbd['checkIsBlackList'](_[_0x5dbe('0x132')](_0xba0000[0x0],[_0x5dbe('0xfe'),'Contact.phone']))[_0x5dbe('0xc4')](_0x3d5bbd[_0x5dbe('0x1e2')](_0x2b2ccf,_0xba0000[0x0]))[_0x5dbe('0xbc')](_0x3d5bbd[_0x5dbe('0xd8')](_0x5dbe('0x20a'),_0x2b2ccf));}}})[_0x5dbe('0xbc')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2b2ccf,0x1));emitVoiceQueueSummary(_0x2b2ccf);};Dialer['prototype'][_0x5dbe('0x1d7')]=function(_0x1927f6,_0x84d01a,_0x56ff7a,_0x5e9219,_0x45b72a,_0x4c3f9f){loggerPredictive['info'](_0x5dbe('0x20b'));loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x20c'),_0x1927f6);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x20d'),_0x84d01a);loggerPredictive[_0x5dbe('0x82')]('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',_0x56ff7a);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x20e'),_0x5e9219);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x20f'),_0x45b72a);loggerPredictive['info'](_0x5dbe('0x8c'));return new BPromise(function(_0x167830,_0x5c4d40){if(_0x1927f6<=0x0||isNaN(_0x1927f6)){return _0x5c4d40(msgResponse('[abandonmentRate]',_0x5dbe('0x4c'),_0x5dbe('0x210')+_0x1927f6));}if(_0x56ff7a<=0x0||isNaN(_0x56ff7a)){return _0x5c4d40(msgResponse(_0x5dbe('0x211'),_0x5dbe('0x4c'),_0x5dbe('0x212')+_0x56ff7a));}if(_0x5e9219<=0x0||isNaN(_0x5e9219)){return _0x5c4d40(msgResponse(_0x5dbe('0x211'),_0x5dbe('0x4c'),_0x5dbe('0x213')+_0x5e9219));}if(_0x84d01a<=0x0||isNaN(_0x84d01a)){return _0x5c4d40(msgResponse(_0x5dbe('0x211'),_0x5dbe('0x4c'),_0x5dbe('0x214')+_0x84d01a));}if(_0x45b72a<=0x0||isNaN(_0x45b72a)){return _0x5c4d40(msgResponse(_0x5dbe('0x211'),'Error',_0x5dbe('0x215')+_0x45b72a));}_0x4c3f9f=_0x4c3f9f||0x0;var _0x3399ca=0x1/_0x56ff7a;var _0x1e5153=0x0;var _0x4592b1=0x0;var _0x21ceec=0x0;var _0x42eebc=0x0;for(var _0x1bbc59=0x0;_0x21ceec<_0x45b72a;_0x1bbc59+=0x1){_0x4592b1=_0x1bbc59/_0x84d01a;_0x1e5153=(_0x5e9219*_0x4592b1+_0x4c3f9f)/_0x3399ca;_0x21ceec=erlangb(_0x1e5153,_0x1927f6);_0x42eebc=_0x1e5153/_0x1927f6*(0x1-erlangb(_0x1e5153,_0x1927f6));}return _0x167830({'erlangCalls':_0x1bbc59,'erlangCallToSecond':_0x84d01a/_0x1bbc59,'erlangAbandonmentRate':_0x21ceec,'erlangBusyFactor':_0x42eebc});});};Dialer['prototype']['busyFactor']=function(_0x1c4ba4,_0x2f6e65,_0x151607,_0x3c9d53,_0x4a382c,_0x18368d){loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x216'));loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x20c'),_0x1c4ba4);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x20d'),_0x2f6e65);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x217'),_0x151607);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x20e'),_0x3c9d53);loggerPredictive[_0x5dbe('0x82')](_0x5dbe('0x218'),_0x4a382c);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x4c7fb2,_0x1386a7){if(_0x1c4ba4<=0x0||isNaN(_0x1c4ba4)){return _0x1386a7(msgResponse(_0x5dbe('0x219'),'Error',_0x5dbe('0x210')+_0x1c4ba4));}if(_0x151607<=0x0||isNaN(_0x151607)){return _0x1386a7(msgResponse('[busyFactor]',_0x5dbe('0x4c'),'Ts\x20=\x20'+_0x151607));}if(_0x3c9d53<=0x0||isNaN(_0x3c9d53)){return _0x1386a7(msgResponse(_0x5dbe('0x219'),_0x5dbe('0x4c'),_0x5dbe('0x213')+_0x3c9d53));}if(_0x2f6e65<=0x0||isNaN(_0x2f6e65)){return _0x1386a7(msgResponse(_0x5dbe('0x219'),'Error',_0x5dbe('0x214')+_0x2f6e65));}if(_0x4a382c<=0x0||isNaN(_0x4a382c)){return _0x1386a7(msgResponse(_0x5dbe('0x219'),'Error','Umin\x20=\x20'+_0x4a382c));}_0x18368d=_0x18368d||0x0;var _0xdfd72=0x1/_0x151607;var _0x307bcd=0x0;var _0x41c54d=0x0;var _0x57c2a1=0x0;var _0xe837e=0x0;for(var _0x2c3e02=0x0;_0xe837e<_0x4a382c;_0x2c3e02+=0x1){_0x41c54d=_0x2c3e02/_0x2f6e65;_0x307bcd=(_0x3c9d53*_0x41c54d+_0x18368d)/_0xdfd72;_0x57c2a1=erlangb(_0x307bcd,_0x1c4ba4);_0xe837e=_0x307bcd/_0x1c4ba4*(0x1-erlangb(_0x307bcd,_0x1c4ba4));}return _0x4c7fb2({'erlangCalls':_0x2c3e02,'erlangCallToSecond':_0x2f6e65/_0x2c3e02,'erlangAbandonmentRate':_0x57c2a1,'erlangBusyFactor':_0xe837e});});};module['exports']=Dialer; \ No newline at end of file +var _0x0004=['[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','active','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','dialAMDActive','MACHINE','Machine','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','countmachineretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','rescheduleContact','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','CampaignId','statedesc','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','add','[rescheduleContact][Machine]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','minutes','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','roundrobin','locked','stateinterface','agents','push','pick','idHopper','paused','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','buildObj','nosuchnumber','stateGlobal','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','check\x20failure','outboundQueuePauses','abandonmentRate','predictiveIntervalPauses','[CatchErlangB]','[getDataPredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','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','[abandonmentRate]','Ts\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','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./hangup','env','127.0.0.1','rrmemory','prototype','enqueue','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncQueueSummary','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','message','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangBusyFactor','Trunk','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\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','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','endtime','clearZombieChannels','[uniqueid]','hasOwnProperty','isNil','status','channel','catch','No\x20such\x20channel','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','updateOriginated','emptyContact','notFound','saveInDb','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x124cad,_0x3bd309){var _0x15e8c0=function(_0x593012){while(--_0x593012){_0x124cad['push'](_0x124cad['shift']());}};_0x15e8c0(++_0x3bd309);}(_0x0004,0x152));var _0x4000=function(_0x53dd63,_0x5e1852){_0x53dd63=_0x53dd63-0x0;var _0x460c0a=_0x0004[_0x53dd63];return _0x460c0a;};'use strict';var util=require(_0x4000('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x4000('0x1'));var moment=require(_0x4000('0x2'));var rr=require('rr');var md5=require(_0x4000('0x3'));var Redis=require(_0x4000('0x4'));var ut=require(_0x4000('0x5'));var config=require(_0x4000('0x6'));var logger=require(_0x4000('0x7'))(_0x4000('0x8'));var loggerBooked=require('../../../config/logger')(_0x4000('0x9'));var loggerPredictive=require(_0x4000('0x7'))('predictive');var loggerPredictiveCalls=require(_0x4000('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x4000('0xa'));config[_0x4000('0xb')]=_['defaults'](config['redis'],{'host':_0x4000('0xc'),'port':0x18eb});var io=require(_0x4000('0xd'))(new Redis(config[_0x4000('0xb')]));var cmHopper=require(_0x4000('0xe'));var cmHopperFinal=require(_0x4000('0xf'));var cmHopperHistory=require(_0x4000('0x10'));var cmHopperBlack=require(_0x4000('0x11'));var voiceQueueRt=require(_0x4000('0x12'));var Action=require(_0x4000('0x13'));var History=require(_0x4000('0x14'));var Final=require('./final');var AgentComplete=require(_0x4000('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x4000('0x16'));var ipAgi=process[_0x4000('0x17')]['XCALLY_IP_AGI']||_0x4000('0x18');var strategy={'rrmemory':_0x4000('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x4000('0x1a')][_0x4000('0x1b')]=function(_0x210781){this['tail']=this['tail']?this['tail'][_0x4000('0x1c')](_0x210781):_0x210781();};function Dialer(_0x129f0a,_0x21b47a){this[_0x4000('0x1d')]=new Sequence();this[_0x4000('0x1e')]=_0x21b47a;this[_0x4000('0x1f')]=_0x129f0a[_0x4000('0x1f')];this[_0x4000('0x20')]=_0x129f0a[_0x4000('0x20')];this['agents']=_0x129f0a['agents'];this[_0x4000('0x21')]=_0x129f0a[_0x4000('0x21')];this[_0x4000('0x22')]=config[_0x4000('0x22')]||0x2;this[_0x4000('0x23')]={};this[_0x4000('0x24')]={};this[_0x4000('0x25')]={};this[_0x4000('0x26')]={};this[_0x4000('0x27')]={};this[_0x4000('0x28')]={};this[_0x4000('0x29')]={};this[_0x4000('0x2a')]={};this[_0x4000('0x2b')]={};this[_0x4000('0x2c')]={};ami['on'](_0x4000('0x2d'),this[_0x4000('0x2e')][_0x4000('0x2f')](this));ami['on'](_0x4000('0x30'),this['syncQueueCallerAbandon'][_0x4000('0x2f')](this));ami['on'](_0x4000('0x31'),this[_0x4000('0x32')][_0x4000('0x2f')](this));ami['on'](_0x4000('0x33'),this['syncAgentComplete'][_0x4000('0x2f')](this));ami['on']('custom:queuesummary',this[_0x4000('0x34')][_0x4000('0x2f')](this));ami['on']('hangup',this['syncHangup'][_0x4000('0x2f')](this));ami['on']('newexten',this[_0x4000('0x35')][_0x4000('0x2f')](this));ami['on'](_0x4000('0x36'),this[_0x4000('0x37')][_0x4000('0x2f')](this));ami['on'](_0x4000('0x38'),this[_0x4000('0x39')][_0x4000('0x2f')](this));ami['on'](_0x4000('0x3a'),this[_0x4000('0x3b')][_0x4000('0x2f')](this));this[_0x4000('0x3c')]();this['loopClearZombieChannels']();}function isNotNull(_0x5f5870){return _0x5f5870!==null&&!_[_0x4000('0x3d')](_0x5f5870);}function checkIsLoggedIn(_0x458b52,_0x4fdfd5){return function(){if(_0x4fdfd5<=0x0){_0x458b52['message']='AGENTS_NOT_LOGGED';throw _0x458b52[_0x4000('0x3e')]+_0x4000('0x3f');}};}function isActive(_0x1339af){return _0x1339af;}function checkIsActive(_0x13ff83,_0x57f6fa){return function(){if(!isActive(_0x57f6fa)){_0x13ff83['message']=_0x4000('0x40');throw _0x13ff83[_0x4000('0x3e')]+'\x20NOT\x20Active';}};}function checkInterval(_0x58f444){return function(){if(!isNotNull(_0x58f444[_0x4000('0x41')])){_0x58f444[_0x4000('0x42')]='INTERVAL_IS_NULL';throw _0x58f444['name']+_0x4000('0x43');}if(!isNotNull(_0x58f444['Interval']['Intervals'])){_0x58f444[_0x4000('0x42')]=_0x4000('0x44');throw _0x58f444[_0x4000('0x3e')]+_0x4000('0x43');}if(!isNotNull(_[_0x4000('0x45')](_0x58f444[_0x4000('0x41')][_0x4000('0x46')]))){_0x58f444['message']='INTERVAL_IS_NULL';throw _0x58f444[_0x4000('0x3e')]+_0x4000('0x43');}};}function msgResponse(_0x12148e,_0x1af74e,_0x1816a9){return{'action':_0x12148e,'response':_0x1af74e,'message':_0x1816a9,'stack':_0x1816a9};}function myreject(_0x2f08ee){return function(_0x26e10f){return _0x2f08ee(msgResponse(_0x4000('0x47'),_0x4000('0x48'),JSON[_0x4000('0x49')](_0x26e10f)));};}function getSeconds(_0x29cdea,_0x26a1df){var _0x20b2d8=moment(_0x29cdea)[_0x4000('0x4a')](0x0);var _0x1fe2ff=moment(_0x26a1df)[_0x4000('0x4a')](0x0);return _0x20b2d8[_0x4000('0x4b')](_0x1fe2ff,'seconds');}function emit(_0x266509,_0x59cea3,_0x36884c){io['to'](_0x266509)[_0x4000('0x4c')](_0x59cea3,_0x36884c);}function emitVoiceQueueSummary(_0x3a9a5f){if(_0x3a9a5f[_0x4000('0x4d')]===_0x4000('0x4e')){var _0x4e3a8b={'id':_0x3a9a5f['id'],'name':_0x3a9a5f[_0x4000('0x3e')],'strategy':_0x3a9a5f[_0x4000('0x4f')],'answered':_0x3a9a5f[_0x4000('0x50')],'available':_0x3a9a5f[_0x4000('0x51')],'loggedIn':_0x3a9a5f[_0x4000('0x52')],'pTalking':_0x3a9a5f[_0x4000('0x53')],'sumBillable':_0x3a9a5f['sumBillable'],'sumDuration':_0x3a9a5f[_0x4000('0x54')],'sumHoldTime':_0x3a9a5f['sumHoldTime']||0x0,'talking':_0x3a9a5f[_0x4000('0x55')],'total':_0x3a9a5f[_0x4000('0x56')],'type':_0x3a9a5f[_0x4000('0x4d')],'unmanaged':_0x3a9a5f[_0x4000('0x57')],'abandoned':_0x3a9a5f[_0x4000('0x58')],'waiting':_0x3a9a5f[_0x4000('0x59')],'loggedInDb':_0x3a9a5f[_0x4000('0x5a')],'dialActive':_0x3a9a5f[_0x4000('0x5b')],'dialMethod':_0x3a9a5f[_0x4000('0x5c')],'dialOriginateCallerIdName':_0x3a9a5f[_0x4000('0x5d')],'dialOriginateCallerIdNumber':_0x3a9a5f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3a9a5f[_0x4000('0x5e')],'dialPrefix':_0x3a9a5f[_0x4000('0x5f')],'outboundAnswerAgiCallsDay':_0x3a9a5f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x3a9a5f[_0x4000('0x60')],'outboundBlacklistCallsDay':_0x3a9a5f[_0x4000('0x61')],'outboundBusyCallsDay':_0x3a9a5f[_0x4000('0x62')],'outboundCongestionCallsDay':_0x3a9a5f[_0x4000('0x63')],'outboundDropCallsDayACS':_0x3a9a5f[_0x4000('0x64')],'outboundDropCallsDayCallersExit':_0x3a9a5f[_0x4000('0x65')],'outboundDropCallsDayTimeout':_0x3a9a5f[_0x4000('0x66')],'outboundNoAnswerCallsDay':_0x3a9a5f[_0x4000('0x67')],'outboundNoSuchCallsDay':_0x3a9a5f[_0x4000('0x68')],'outboundOriginateFailureCallsDay':_0x3a9a5f[_0x4000('0x69')],'outboundReCallsDay':_0x3a9a5f[_0x4000('0x6a')],'outboundRejectCallsDay':_0x3a9a5f['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3a9a5f[_0x4000('0x6b')],'predictiveIntervalAnsweredCalls':_0x3a9a5f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3a9a5f[_0x4000('0x6c')],'predictiveIntervalAvgTalktime':_0x3a9a5f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3a9a5f[_0x4000('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x3a9a5f[_0x4000('0x6e')],'predictiveIntervalErlangCalls':_0x3a9a5f[_0x4000('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x3a9a5f[_0x4000('0x70')],'predictiveIntervalHitRate':_0x3a9a5f['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3a9a5f['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3a9a5f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3a9a5f[_0x4000('0x71')],'predictiveIntervalTotalCalls':_0x3a9a5f[_0x4000('0x72')],'message':_0x3a9a5f[_0x4000('0x42')],'originated':_0x3a9a5f[_0x4000('0x73')],'erlangCalls':_0x3a9a5f['erlangCalls'],'erlangCallToSecond':_0x3a9a5f[_0x4000('0x74')],'erlangAbandonmentRate':_0x3a9a5f['erlangAbandonmentRate'],'erlangBusyFactor':_0x3a9a5f[_0x4000('0x75')],'startPredictive':_0x3a9a5f[_0x4000('0x28')],'startProgressive':_0x3a9a5f['startProgressive']};if(_0x3a9a5f['Trunk']){_0x4e3a8b[_0x4000('0x76')]={'id':_0x3a9a5f[_0x4000('0x76')]['id'],'name':_0x3a9a5f['Trunk'][_0x4000('0x3e')],'active':_0x3a9a5f[_0x4000('0x76')]['active'],'callerid':_0x3a9a5f[_0x4000('0x76')][_0x4000('0x77')]};}if(_0x3a9a5f[_0x4000('0x41')]){_0x4e3a8b['Interval']={'id':_0x3a9a5f[_0x4000('0x41')]['id'],'name':_0x3a9a5f[_0x4000('0x41')][_0x4000('0x3e')]};}var _0x5802cb=md5(JSON[_0x4000('0x49')](_0x4e3a8b));if(_0x3a9a5f[_0x4000('0x3')]!==_0x5802cb){_0x3a9a5f[_0x4000('0x3')]=_0x5802cb;emit(util[_0x4000('0x78')]('voice:queue:%s',_0x4e3a8b[_0x4000('0x3e')]),_0x4000('0x79'),_0x4e3a8b);}}}function emitCampaignSummary(_0x4ca746){if(_0x4ca746[_0x4000('0x4d')]===_0x4000('0x7a')){emit(util[_0x4000('0x78')](_0x4000('0x7b'),_0x4ca746[_0x4000('0x3e')]),_0x4000('0x7c'),_0x4ca746);}}function checkGetDataPredictive(_0xcee4d1){if(isNotNull(_0xcee4d1)){if(!_[_0x4000('0x45')](_0xcee4d1)){loggerPredictive[_0x4000('0x7d')](_0x4000('0x7e'));loggerPredictive[_0x4000('0x7d')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xcee4d1['predictiveIntervalTotalCalls']);loggerPredictive[_0x4000('0x7d')](_0x4000('0x7f'),_0xcee4d1[_0x4000('0x80')]);loggerPredictive['info'](_0x4000('0x81'),_0xcee4d1[_0x4000('0x6e')]);loggerPredictive[_0x4000('0x7d')](_0x4000('0x82'),_0xcee4d1[_0x4000('0x6d')]);loggerPredictive[_0x4000('0x7d')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xcee4d1[_0x4000('0x6c')]);loggerPredictive[_0x4000('0x7d')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xcee4d1[_0x4000('0x83')]);loggerPredictive[_0x4000('0x7d')](_0x4000('0x84'));if(_0xcee4d1[_0x4000('0x72')]>0x0){if(!_['isUndefined'](_0xcee4d1[_0x4000('0x83')])&&_0xcee4d1[_0x4000('0x83')]>0x0){return!![];}else{loggerPredictive[_0x4000('0x7d')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0x4000('0x3d')](_0xcee4d1[_0x4000('0x6c')])&&_0xcee4d1[_0x4000('0x6c')]>0x0){return!![];}else{loggerPredictive[_0x4000('0x7d')](_0x4000('0x85'));}}else{loggerPredictive[_0x4000('0x7d')](_0x4000('0x86'));}}else{loggerPredictive[_0x4000('0x7d')]('History\x20information\x20are\x20empty');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5926ce){return function(_0xb23b14){loggerPredictive[_0x4000('0x7d')](_0x4000('0x87'));loggerPredictive['info'](_0x4000('0x88'),_0xb23b14['erlangCalls']);loggerPredictive[_0x4000('0x7d')](_0x4000('0x89'),_0xb23b14[_0x4000('0x74')]);loggerPredictive[_0x4000('0x7d')](_0x4000('0x8a'),_0xb23b14['erlangAbandonmentRate']);loggerPredictive['info'](_0x4000('0x8b'),_0xb23b14[_0x4000('0x75')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb23b14['erlangAbandonmentRate']);loggerPredictive['info'](_0x4000('0x84'));_[_0x4000('0x8c')](_0x5926ce,_0xb23b14);};}function getDiff(_0x21ed31){var _0xf2f09f=moment()[_0x4000('0x4a')](0x0);var _0x1e3de7=moment(_0x21ed31)[_0x4000('0x4a')](0x0);return _0xf2f09f[_0x4000('0x4b')](_0x1e3de7,_0x4000('0x8d'));}function ifInterval(_0x51f5ab,_0x2ec641){if(_[_0x4000('0x3d')](_0x2ec641)){return![];}if(getDiff(_0x2ec641)<_0x51f5ab*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x2b0d1c){if(isNotNull(_0x2b0d1c)){if(!_['isUndefined'](_0x2b0d1c[_0x4000('0x29')])){_0x2b0d1c[_0x4000('0x29')]=undefined;loggerPredictive[_0x4000('0x7d')](_0x2b0d1c['name'],_0x4000('0x8e'));}if(!_[_0x4000('0x3d')](_0x2b0d1c[_0x4000('0x28')])){_0x2b0d1c[_0x4000('0x28')]=undefined;loggerPredictive[_0x4000('0x7d')](_0x2b0d1c[_0x4000('0x3e')],_0x4000('0x8f'));}if(!_[_0x4000('0x3d')](_0x2b0d1c[_0x4000('0x90')])){clearInterval(_0x2b0d1c['handlePredictive']);_0x2b0d1c[_0x4000('0x90')]=undefined;loggerPredictive[_0x4000('0x7d')](_0x2b0d1c[_0x4000('0x3e')],_0x4000('0x91'));}}}function erlangb(_0x5670c7,_0x1e0a2c){if(_0x1e0a2c===0x0){return 0x0;}var _0x2dd2f7=0x1;for(var _0x29311e=0x1;_0x29311e<=_0x1e0a2c;_0x29311e+=0x1){_0x2dd2f7=0x1+_0x2dd2f7*_0x29311e/_0x5670c7;}return 0x1/_0x2dd2f7;}function isVoiceQueueOutbound(_0x3e5b9c){return _0x3e5b9c===_0x4000('0x4e');}function isNotPreview(_0x4f10c1){return _0x4f10c1!==_0x4000('0x1e');}function isCampaignIvr(_0x429669){return _0x429669==='ivr';}function getCallerId(_0x16d03f,_0x23b740,_0x31792a){if(!_[_0x4000('0x3d')](_0x31792a)&&_0x4000('0x92')===typeof _0x31792a&&!_[_0x4000('0x45')](_0x31792a)){if(!_['isUndefined'](_0x23b740)&&_0x4000('0x92')===typeof _0x23b740&&!_['isEmpty'](_0x23b740)){return util['format'](_0x4000('0x93'),_0x23b740,_0x31792a);}return util['format'](_0x4000('0x93'),_0x31792a,_0x31792a);}if(!_[_0x4000('0x3d')](_0x16d03f)&&'string'===typeof _0x16d03f&&!_[_0x4000('0x45')](_0x16d03f)){return _0x16d03f;}return _0x4000('0x94');}function loggerCatchQueueSummary(_0xf5a123,_0x3a64b0){return function(_0x472955){freeVariablesPredictive(_0x3a64b0);emitVoiceQueueSummary(_0x3a64b0);emitCampaignSummary(_0x3a64b0);loggerSyncQueueSummary[_0x4000('0x95')](_0xf5a123,util[_0x4000('0x96')](_0x472955,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3d9803,_0x51ce7c){return function(_0x22e162){loggerPredictive['error'](_0x51ce7c['name'],_0x3d9803);loggerPredictive[_0x4000('0x95')](_0x22e162[_0x4000('0x97')]);freeVariablesPredictive(_0x51ce7c);};}function loggerCatch(_0x269f18){return function(_0x2dac53){logger['error'](_0x269f18,util[_0x4000('0x96')](_0x2dac53,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x46be38){return _0x46be38&&!_[_0x4000('0x3d')](_0x46be38)&&_0x46be38[_0x4000('0x98')]>0x0;}function decremetOriginate(_0x2a9f59){if(!_[_0x4000('0x3d')](_0x2a9f59)&&_0x2a9f59!==null){if(_0x2a9f59['hasOwnProperty'](_0x4000('0x73'))){if(_0x2a9f59[_0x4000('0x73')]>0x0){_0x2a9f59[_0x4000('0x73')]-=0x1;}else{logger[_0x4000('0x95')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4000('0x95')](_0x4000('0x99'));}}function checkContactLowerLimitOriginate(_0x3d74e5,_0x4c23e4,_0x3d5531){if(_0x4c23e4>_0x3d5531){for(var _0x23569a=0x0;_0x23569a<_0x4c23e4-_0x3d5531;_0x23569a+=0x1){decremetOriginate(_0x3d74e5);}}}function loggerGetContactDialer(_0x188f66,_0x48a091,_0x284be4){return function(_0x18bdb4){checkContactLowerLimitOriginate(_0x48a091,_0x284be4,0x0);logger[_0x4000('0x95')](_0x188f66,util[_0x4000('0x96')](_0x18bdb4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x138e89){return function(_0x4bf94c){if(isNotNull(_0x4bf94c)&&isNotNull(_0x4bf94c[0x0])){if(_0x4bf94c[0x0][_0x4000('0x9a')]>0x0){_0x138e89[_0x4000('0x42')]=_0x4000('0x9b');logger[_0x4000('0x7d')]('[getContactDialer2][ReScheduled]'+_0x138e89[_0x4000('0x3e')],_0x4bf94c[0x0][_0x4000('0x9a')],_0x4000('0x9c'));}else{_0x138e89[_0x4000('0x42')]=_0x4000('0x9d');logger['info'](_0x4000('0x9e')+_0x138e89[_0x4000('0x3e')]);}}};}function notSendMessagesQueue(_0x497b4a){if(_0x497b4a['sendMessageOneNotActive']){freeVariablesPredictive(_0x497b4a);if(_0x497b4a['originated']===0x0&&_0x497b4a[_0x4000('0x55')]===0x0&&_0x497b4a[_0x4000('0x59')]===0x0&&(_0x497b4a[_0x4000('0x53')]||0x0)===0x0){_0x497b4a[_0x4000('0x9f')]=![];_0x497b4a['available']=0x0;_0x497b4a[_0x4000('0x42')]=_0x4000('0x40');loggerSyncQueueSummary[_0x4000('0x95')](_0x4000('0xa0'),_0x497b4a[_0x4000('0x3e')],'is\x20not\x20active');}else{_0x497b4a[_0x4000('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x4000('0x95')](_0x4000('0xa0'),_0x497b4a['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x497b4a);}}function notSendMessagesCampaign(_0x17bcc8){if(_0x17bcc8[_0x4000('0x9f')]){if(_0x17bcc8[_0x4000('0x73')]===0x0){_0x17bcc8['sendMessageOneNotActive']=![];_0x17bcc8[_0x4000('0x42')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x4000('0x95')](_0x4000('0xa1'),_0x17bcc8[_0x4000('0x3e')],_0x4000('0xa2'));}else{_0x17bcc8[_0x4000('0x42')]=_0x4000('0xa3');loggerSyncQueueSummary[_0x4000('0x95')](_0x4000('0xa1'),_0x17bcc8[_0x4000('0x3e')],_0x4000('0xa4'));}emitCampaignSummary(_0x17bcc8);}}function createObjHistory(_0x38a693,_0x200f9d,_0x101fcf,_0x463406,_0x3947eb){_0x38a693['message']=_0x101fcf;var _0xbdc340=new Action(_0x38a693,_0x200f9d);var _0x487df6=new History(_0xbdc340);_0x487df6[_0x4000('0xa5')]=_0x463406;_0x487df6['statedesc']=_0x3947eb;_0x487df6[_0x4000('0xa6')]=_0xbdc340['starttime'];return _0x487df6;}Dialer[_0x4000('0x1a')]['loopClearZombieChannels']=function(){var _0x7dbea8=this;setInterval(function(){_0x7dbea8[_0x4000('0xa7')](_0x7dbea8[_0x4000('0x26')],_0x4000('0xa8'));_0x7dbea8[_0x4000('0xa7')](_0x7dbea8['actions'],'[actions]');},0x32c8);};Dialer[_0x4000('0x1a')][_0x4000('0xa7')]=function(_0x79ba72,_0x24811a){var _0x85e2cd=this;for(var _0x10ce96 in _0x79ba72){if(_0x79ba72[_0x4000('0xa9')](_0x10ce96)){this[_0x4000('0x1d')][_0x4000('0x1b')](function(){if(!_[_0x4000('0xaa')](_0x79ba72[_0x10ce96])){return ami['Action']({'action':_0x4000('0xab'),'channel':_0x79ba72[_0x10ce96][_0x4000('0xac')]})[_0x4000('0xad')](function(_0x4a6fcb){if(_0x4a6fcb[_0x4000('0x42')]===_0x4000('0xae')){setTimeout(function(){if(_0x79ba72[_0x10ce96]&&_0x79ba72[_0x10ce96][_0x4000('0x4d')]!==_0x4000('0x7a')){_0x85e2cd['updateOriginated'](_0x85e2cd[_0x4000('0x1f')][_0x79ba72[_0x10ce96]['queue']]);logger[_0x4000('0x95')](_0x4000('0xaf'),_0x24811a,_0x10ce96,_0x79ba72[_0x10ce96][_0x4000('0xb0')]);delete _0x79ba72[_0x10ce96];}if(_0x79ba72[_0x10ce96]&&_0x79ba72[_0x10ce96]['type']===_0x4000('0x7a')){_0x85e2cd['updateOriginated'](_0x85e2cd['campaigns'][_0x79ba72[_0x10ce96]['queue']]);logger[_0x4000('0x95')](_0x4000('0xb1'),_0x24811a,_0x10ce96,_0x79ba72[_0x10ce96]['queue']);delete _0x79ba72[_0x10ce96];}},0x2328);}});}});}}};Dialer[_0x4000('0x1a')][_0x4000('0xb2')]=function(_0x2e8bc0){return BPromise[_0x4000('0xb3')]()[_0x4000('0xb4')](cmHopper[_0x4000('0xb2')](_0x2e8bc0))['catch'](loggerCatch(_0x4000('0xb5')));};Dialer[_0x4000('0x1a')][_0x4000('0xb6')]=function(_0x3260ae){return BPromise['resolve']()[_0x4000('0xb4')](cmHopperBlack[_0x4000('0xb6')](_0x3260ae))[_0x4000('0xad')](loggerCatch(_0x4000('0xb7')));};Dialer[_0x4000('0x1a')][_0x4000('0xb8')]=function(_0x8f1cfd){return BPromise[_0x4000('0xb3')]()[_0x4000('0xb4')](cmHopperBlack[_0x4000('0xb8')](_0x8f1cfd))[_0x4000('0xad')](loggerCatch(_0x4000('0xb9')));};Dialer[_0x4000('0x1a')]['averageHandleTime']=function(_0x3438e1){return BPromise[_0x4000('0xb3')]()[_0x4000('0xb4')](cmHopperHistory[_0x4000('0xba')](_0x3438e1))[_0x4000('0xad')](loggerCatch(_0x4000('0xbb')));};Dialer[_0x4000('0x1a')]['rescheduleContact']=function(_0x696a41){return BPromise[_0x4000('0xb3')]()['then'](cmHopper['rescheduleContact'](_0x696a41))[_0x4000('0xad')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x4000('0x1a')]['unlockContact']=function(_0x355c86,_0x26831e,_0x5c9a02){return BPromise[_0x4000('0xb3')]()[_0x4000('0xb4')](cmHopper[_0x4000('0xbc')](_0x355c86,_0x26831e,_0x5c9a02))[_0x4000('0xad')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x4000('0x1a')][_0x4000('0xbd')]=function(_0xfcd8eb,_0x4abb80,_0x16cce6,_0x1f0b3b){return BPromise[_0x4000('0xb3')]()[_0x4000('0xb4')](cmHopper[_0x4000('0xbd')](_0xfcd8eb,_0x4abb80,_0x16cce6,_0x1f0b3b))[_0x4000('0xad')](loggerCatch(_0x4000('0xbe')));};Dialer[_0x4000('0x1a')][_0x4000('0xbf')]=function(_0x32bda3,_0x343174,_0x381421){return BPromise[_0x4000('0xb3')]()[_0x4000('0xb4')](cmHopper[_0x4000('0xbf')](_0x32bda3,_0x343174,_0x381421))[_0x4000('0xad')](loggerCatch(_0x4000('0xbe')));};Dialer[_0x4000('0x1a')][_0x4000('0xc0')]=function(_0x166a54){return BPromise['resolve']()[_0x4000('0xb4')](voiceQueueRt[_0x4000('0xc0')](_0x166a54))['catch'](loggerCatch(_0x4000('0xc1')));};Dialer[_0x4000('0x1a')][_0x4000('0xc2')]=function(_0x390098){return BPromise[_0x4000('0xb3')]()[_0x4000('0xb4')](cmHopper[_0x4000('0xc2')](_0x390098))['catch'](loggerCatch(_0x4000('0xc3')));};Dialer['prototype'][_0x4000('0xc4')]=function(_0xcd2ff6){return BPromise['resolve']()[_0x4000('0xb4')](cmHopperHistory[_0x4000('0xc4')](_0xcd2ff6))[_0x4000('0xad')](loggerCatch(_0x4000('0xc5')));};Dialer[_0x4000('0x1a')][_0x4000('0xc6')]=function(_0x423154){if(!_[_0x4000('0x3d')](_0x423154)&&_0x423154!==null){if(_0x423154[_0x4000('0xa9')](_0x4000('0x73'))){if(_0x423154['originated']>0x0){_0x423154[_0x4000('0x73')]-=0x1;}else{logger[_0x4000('0x95')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4000('0x95')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x4000('0x1a')]['loggerHandler']=function(_0xf48371,_0x10fdad){var _0x2040c5=this;return function(_0x3bc693){_0x2040c5[_0x4000('0xc6')](_0x10fdad);logger[_0x4000('0x95')](_0xf48371,util[_0x4000('0x96')](_0x3bc693,{'showHidden':![],'depth':null}));};};Dialer[_0x4000('0x1a')][_0x4000('0xc7')]=function(_0x459e44,_0xf6e4d5,_0xb69c6){var _0x5b6be2={'state':0x19,'statedesc':_0x4000('0xc8')};this[_0x4000('0xc6')](_0xf6e4d5);this[_0x4000('0xc9')](_[_0x4000('0x8c')](_0x5b6be2,_['pick'](_0xb69c6,[_0x4000('0xca'),_0x4000('0xcb'),_0x4000('0xcc'),_0x4000('0xcd'),'CampaignId'])),_0x4000('0xce'),_0x4000('0xcf'));logger[_0x4000('0x95')](_0x459e44);};Dialer[_0x4000('0x1a')][_0x4000('0xd0')]=function(_0x18e22b){return _0x18e22b==='Success';};Dialer[_0x4000('0x1a')][_0x4000('0xd1')]=function(_0x39f906){return!_[_0x4000('0x3d')](_0x39f906)&&_0x39f906&&!_['isUndefined'](_0x39f906[_0x4000('0x3e')])&&!_['isUndefined'](_0x39f906[_0x4000('0xd2')])&&_0x39f906[_0x4000('0xd2')]&&(this[_0x4000('0x21')][util[_0x4000('0x78')]('SIP/%s',_0x39f906['name'])][_0x4000('0xab')]==='reachable'||this[_0x4000('0x21')][util[_0x4000('0x78')](_0x4000('0xd3'),_0x39f906[_0x4000('0x3e')])][_0x4000('0xab')]===_0x4000('0xd4'));};Dialer[_0x4000('0x1a')][_0x4000('0xc9')]=function(_0x777f38,_0x3d2bf5,_0x3028f6){this[_0x4000('0xc4')](_0x777f38)[_0x4000('0xad')](loggerCatch(_0x3d2bf5));this[_0x4000('0xc2')](_0x777f38)[_0x4000('0xad')](loggerCatch(_0x3028f6));};Dialer[_0x4000('0x1a')][_0x4000('0x37')]=function(_0x38e3fe){var _0x4f99b9=this[_0x4000('0x26')][_0x38e3fe[_0x4000('0xd5')]];var _0x561df5;if(!_[_0x4000('0xaa')](_0x38e3fe)&&!_['isNil'](_0x38e3fe[_0x4000('0xd6')])&&!_['isNil'](_0x38e3fe[_0x4000('0xd6')][_0x4000('0xd7')])&&_0x38e3fe[_0x4000('0xd8')]===_0x4000('0xd9')&&_0x4f99b9){if(_0x4f99b9[_0x4000('0x4d')]!==_0x4000('0x7a')&&this[_0x4000('0x1f')][_0x4f99b9[_0x4000('0xb0')]]['dialAMDActive']&&_0x38e3fe[_0x4000('0xda')]===_0x4000('0xdb')){delete this[_0x4000('0x26')][_0x38e3fe[_0x4000('0xd5')]];this['updateOriginated'](this[_0x4000('0x1f')][_0x4f99b9['queue']]);this[_0x4000('0x1f')][_0x4f99b9[_0x4000('0xb0')]]['outboundAnswerCallsDay']+=0x1;this[_0x4000('0x1f')][_0x4f99b9[_0x4000('0xb0')]][_0x4000('0xdc')]+=0x1;_0x561df5=new Hangup(_0x4f99b9,_0x38e3fe);_0x561df5[_0x4000('0xa5')]=0x12;_0x561df5['statedesc']=_0x4000('0xdd');_0x561df5[_0x4000('0xde')]=_0x4000('0xdf');this[_0x4000('0xc9')](_0x561df5,_0x4000('0xe0'),'[syncHangupInAMD]');}if(_0x4f99b9[_0x4000('0x4d')]!=='ivr'&&this[_0x4000('0x1f')][_0x4f99b9[_0x4000('0xb0')]][_0x4000('0xe1')]&&_0x38e3fe[_0x4000('0xda')]===_0x4000('0xe2')){var _0x1eaf31=this;return new BPromise(function(_0x257da2,_0x3768ff){delete _0x1eaf31['uniqueId'][_0x38e3fe[_0x4000('0xd5')]];_0x1eaf31[_0x4000('0xc6')](_0x1eaf31[_0x4000('0x1f')][_0x4f99b9['queue']]);_0x1eaf31[_0x4000('0x1f')][_0x4f99b9['queue']]['outboundAnswerCallsDay']+=0x1;_0x1eaf31['voiceQueues'][_0x4f99b9['queue']][_0x4000('0xdc')]+=0x1;var _0x12b07a=_0x1eaf31[_0x4000('0x1f')][_0x4f99b9[_0x4000('0xb0')]];var _0x3dccf5=new Hangup(_0x4f99b9,_0x38e3fe);_0x3dccf5[_0x4000('0xa5')]=0x13;_0x3dccf5['statedesc']=_0x4000('0xe3');_0x3dccf5['membername']=_0x4000('0xdf');_0x3dccf5['countmachineretry']+=0x1;_0x3dccf5[_0x4000('0xe4')]+=0x1;_0x3dccf5[_0x4000('0xe5')]=!![];_0x1eaf31[_0x4000('0xc4')](_0x3dccf5)[_0x4000('0xad')](loggerCatch(_0x4000('0xe6')));if(_0x3dccf5[_0x4000('0xe7')]+_0x3dccf5[_0x4000('0xe8')]+_0x3dccf5['countnoanswerretry']+_0x3dccf5[_0x4000('0xe9')]+_0x3dccf5[_0x4000('0xea')]+_0x3dccf5[_0x4000('0xeb')]+_0x3dccf5['countmachineretry']+_0x3dccf5[_0x4000('0xec')]>=_0x12b07a[_0x4000('0xed')]){_0x1eaf31['stateGlobal'](_0x3dccf5,_0x257da2,_0x3768ff,_0x4000('0xee'));}else{if(_0x3dccf5[_0x4000('0xef')]>=_0x12b07a[_0x4000('0xf0')]){_0x1eaf31[_0x4000('0xf1')](_0x3dccf5,_0x257da2,_0x3768ff,_0x4000('0xf2'));}else{_0x1eaf31[_0x4000('0xf3')]({'active':![],'countmachineretry':_0x3dccf5[_0x4000('0xef')],'scheduledat':moment()['add'](_0x12b07a[_0x4000('0xf4')],'minutes')['format'](_0x4000('0xf5')),'ContactId':_0x3dccf5[_0x4000('0xca')],'ListId':_0x3dccf5[_0x4000('0xcb')],'VoiceQueueId':_0x3dccf5['VoiceQueueId']||undefined,'CampaignId':_0x3dccf5[_0x4000('0xf6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x257da2({'reschedule':0x1});}}});}if(_0x4f99b9[_0x4000('0x4d')]===_0x4000('0x7a')&&this['campaigns'][_0x4f99b9[_0x4000('0xb0')]][_0x4000('0xe1')]&&_0x38e3fe[_0x4000('0xda')]==='HANGUP'){delete this[_0x4000('0x26')][_0x38e3fe[_0x4000('0xd5')]];this[_0x4000('0xc6')](this[_0x4000('0x20')][_0x4f99b9['queue']]);_0x561df5=new Hangup(_0x4f99b9,_0x38e3fe);_0x561df5[_0x4000('0xa5')]=0x12;_0x561df5[_0x4000('0xf7')]=_0x4000('0xdd');_0x561df5[_0x4000('0xde')]='AMD';this[_0x4000('0xc9')](_0x561df5,_0x4000('0xf8'),_0x4000('0xf9'));}if(_0x4f99b9['type']==='ivr'&&this[_0x4000('0x20')][_0x4f99b9[_0x4000('0xb0')]][_0x4000('0xe1')]&&_0x38e3fe[_0x4000('0xda')]===_0x4000('0xe2')){var _0x1eaf31=this;return new BPromise(function(_0x4e7f48,_0x231fbd){delete _0x1eaf31[_0x4000('0x26')][_0x38e3fe[_0x4000('0xd5')]];_0x1eaf31[_0x4000('0xc6')](_0x1eaf31[_0x4000('0x20')][_0x4f99b9['queue']]);_0x1eaf31[_0x4000('0x20')][_0x4f99b9[_0x4000('0xb0')]]['outboundAnswerCallsDay']+=0x1;_0x1eaf31['campaigns'][_0x4f99b9[_0x4000('0xb0')]][_0x4000('0xdc')]+=0x1;var _0x220f46=_0x1eaf31['campaigns'][_0x4f99b9[_0x4000('0xb0')]];var _0x36966f=new Hangup(_0x4f99b9,_0x38e3fe);_0x36966f[_0x4000('0xa5')]=0x13;_0x36966f[_0x4000('0xf7')]=_0x4000('0xe3');_0x36966f['membername']=_0x4000('0xdf');_0x36966f[_0x4000('0xef')]+=0x1;_0x36966f[_0x4000('0xe4')]+=0x1;_0x36966f[_0x4000('0xe5')]=!![];_0x1eaf31[_0x4000('0xc4')](_0x36966f)['catch'](loggerCatch(_0x4000('0xe6')));if(_0x36966f['countbusyretry']+_0x36966f[_0x4000('0xe8')]+_0x36966f[_0x4000('0xfa')]+_0x36966f['countnosuchnumberretry']+_0x36966f[_0x4000('0xea')]+_0x36966f[_0x4000('0xeb')]+_0x36966f[_0x4000('0xef')]+_0x36966f[_0x4000('0xec')]>=_0x220f46[_0x4000('0xed')]){_0x1eaf31['stateGlobal'](_0x36966f,_0x4e7f48,_0x231fbd,_0x4000('0xee'));}else{if(_0x36966f[_0x4000('0xef')]>=_0x220f46['dialMachineMaxRetry']){_0x1eaf31[_0x4000('0xf1')](_0x36966f,_0x4e7f48,_0x231fbd,_0x4000('0xf2'));}else{_0x1eaf31['rescheduleContact']({'active':![],'countmachineretry':_0x36966f[_0x4000('0xef')],'scheduledat':moment()[_0x4000('0xfb')](_0x220f46[_0x4000('0xf4')],'minutes')[_0x4000('0x78')](_0x4000('0xf5')),'ContactId':_0x36966f[_0x4000('0xca')],'ListId':_0x36966f[_0x4000('0xcb')],'VoiceQueueId':_0x36966f[_0x4000('0xcd')]||undefined,'CampaignId':_0x36966f['CampaignId']||undefined})['catch'](loggerCatch(_0x4000('0xfc')));_0x4e7f48({'reschedule':0x1});}}});}}};Dialer[_0x4000('0x1a')]['syncHangup']=function(_0x9b7316){var _0x488fb3=this[_0x4000('0x26')][_0x9b7316[_0x4000('0xd5')]];var _0x29f15b=this;var _0x38cba3;if(_0x488fb3&&_0x488fb3[_0x4000('0x4d')]===_0x4000('0x7a')){delete this['uniqueId'][_0x9b7316[_0x4000('0xd5')]];this[_0x4000('0xc6')](this[_0x4000('0x20')][_0x488fb3[_0x4000('0xb0')]]);this[_0x4000('0x20')][_0x488fb3[_0x4000('0xb0')]]['ivrAnswerCallsDay']+=0x1;_0x38cba3=new Hangup(_0x488fb3,_0x9b7316);this[_0x4000('0xc4')](_0x38cba3)[_0x4000('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x4000('0xc2')](_0x38cba3)[_0x4000('0xad')](loggerCatch(_0x4000('0xfd')));}if(_0x488fb3&&_0x488fb3[_0x4000('0x4d')]!=='ivr'&&isNotNull(this[_0x4000('0x1f')][_0x488fb3['queue']][_0x4000('0xfe')])){delete this[_0x4000('0x26')][_0x9b7316['uniqueid']];this[_0x4000('0xc6')](this[_0x4000('0x1f')][_0x488fb3['queue']]);this[_0x4000('0x1f')][_0x488fb3[_0x4000('0xb0')]][_0x4000('0x60')]+=0x1;this['voiceQueues'][_0x488fb3[_0x4000('0xb0')]][_0x4000('0xdc')]+=0x1;_0x38cba3=new Hangup(_0x488fb3,_0x9b7316);_0x38cba3[_0x4000('0xa5')]=0x10;_0x38cba3[_0x4000('0xf7')]=_0x4000('0xff');_0x38cba3[_0x4000('0xde')]=_0x4000('0x100');this['createHistory'](_0x38cba3)[_0x4000('0xad')](loggerCatch(_0x4000('0x101')));this[_0x4000('0xc2')](_0x38cba3)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x488fb3&&_0x488fb3['type']!=='ivr'&&!isNotNull(this[_0x4000('0x1f')][_0x488fb3[_0x4000('0xb0')]]['dialQueueProject'])){delete this[_0x4000('0x26')][_0x9b7316['uniqueid']];this[_0x4000('0xc6')](this[_0x4000('0x1f')][_0x488fb3[_0x4000('0xb0')]]);this[_0x4000('0x1f')][_0x488fb3[_0x4000('0xb0')]][_0x4000('0x6b')]+=0x1;_0x38cba3=new Hangup(_0x488fb3,_0x9b7316);_0x38cba3[_0x4000('0xa5')]=0xc;_0x38cba3[_0x4000('0xf7')]=_0x9b7316[_0x4000('0x102')];_0x38cba3[_0x4000('0xde')]=_0x4000('0x103');this['createHistory'](_0x38cba3)[_0x4000('0xad')](loggerCatch(_0x4000('0x101')));this[_0x4000('0xc2')](_0x38cba3)['catch'](loggerCatch(_0x4000('0xfd')));}};Dialer[_0x4000('0x1a')][_0x4000('0x104')]=function(_0x1967fc){var _0x10197f=this[_0x4000('0x26')][_0x1967fc[_0x4000('0xd5')]];var _0x50f31a=this;if(this[_0x4000('0x1f')][_0x1967fc['queue']]){if(_0x10197f&&_0x10197f[_0x4000('0x4d')]!==_0x4000('0x7a')){delete this[_0x4000('0x26')][_0x1967fc[_0x4000('0xd5')]];this[_0x4000('0x1f')][_0x1967fc[_0x4000('0xb0')]][_0x4000('0x60')]+=0x1;var _0x10bd68=new AgentComplete(_0x10197f,_0x1967fc);if(_0x1967fc[_0x4000('0x105')]===_0x4000('0x106')){_0x10bd68[_0x4000('0x107')]=this[_0x4000('0x1f')][_0x1967fc[_0x4000('0xb0')]][_0x4000('0x108')]&&this[_0x4000('0x1f')][_0x1967fc['queue']]['dialAgiAfterHangupAgent']?moment()[_0x4000('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x10bd68)[_0x4000('0xad')](loggerCatch(_0x4000('0x109')));this['moveContactManagedDialer'](_0x10bd68)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x4000('0x1a')]['syncAgentConnect']=function(_0x5ae6d9){if(this['voiceQueues'][_0x5ae6d9[_0x4000('0xb0')]]){if(this[_0x4000('0x26')][_0x5ae6d9[_0x4000('0xd5')]]&&this['uniqueId'][_0x5ae6d9['uniqueid']]['type']!==_0x4000('0x7a')){this[_0x4000('0xc6')](this['voiceQueues'][_0x5ae6d9[_0x4000('0xb0')]]);this[_0x4000('0x26')][_0x5ae6d9[_0x4000('0xd5')]][_0x4000('0x10a')]=moment()[_0x4000('0x78')](_0x4000('0xf5'));}}};Dialer['prototype'][_0x4000('0x10b')]=function(_0x2101e5){this[_0x4000('0xc4')](_0x2101e5)[_0x4000('0xad')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x4000('0xc2')](_0x2101e5)[_0x4000('0xad')](loggerCatch(_0x4000('0x10c')));};Dialer[_0x4000('0x1a')][_0x4000('0x10d')]=function(_0x47bc60){var _0x25ec87=this[_0x4000('0x26')][_0x47bc60['uniqueid']];var _0x386df8=this;if(this['voiceQueues'][_0x47bc60[_0x4000('0xb0')]]){if(_0x25ec87&&_0x25ec87['type']!==_0x4000('0x7a')){delete this[_0x4000('0x26')][_0x47bc60[_0x4000('0xd5')]];this[_0x4000('0xc6')](this['voiceQueues'][_0x47bc60[_0x4000('0xb0')]]);_0x25ec87[_0x4000('0x10e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xbaa3fe=new QueueCallerAbandon(_0x25ec87,_0x47bc60);if(getSeconds(_0x25ec87[_0x4000('0x10e')],_0x25ec87[_0x4000('0x10f')])>=_0x25ec87[_0x4000('0x110')]){this[_0x4000('0x1f')][_0x47bc60[_0x4000('0xb0')]][_0x4000('0x6e')]+=0x1;this[_0x4000('0x1f')][_0x47bc60[_0x4000('0xb0')]][_0x4000('0x66')]+=0x1;this[_0x4000('0x1f')][_0x47bc60[_0x4000('0xb0')]][_0x4000('0x70')]+=0x1;_0xbaa3fe[_0x4000('0xa5')]=0xa;_0xbaa3fe['statedesc']=_0x4000('0x111');_0xbaa3fe['dropreason']=_0x4000('0x112');_0xbaa3fe['agiafterat']=this[_0x4000('0x1f')][_0x47bc60[_0x4000('0xb0')]][_0x4000('0x108')]?moment()[_0x4000('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0xbaa3fe[_0x4000('0xea')]+=0x1;_0xbaa3fe['countglobal']+=0x1;if(_0xbaa3fe[_0x4000('0xea')]>=this['voiceQueues'][_0x47bc60[_0x4000('0xb0')]][_0x4000('0x113')]){this[_0x4000('0x10b')](_0xbaa3fe);}else{this[_0x4000('0xf3')]({'active':![],'countdropretry':_0xbaa3fe[_0x4000('0xea')],'scheduledat':moment()[_0x4000('0xfb')](this['voiceQueues'][_0x47bc60['queue']][_0x4000('0x114')],_0x4000('0x115'))[_0x4000('0x78')](_0x4000('0xf5')),'ContactId':_0x25ec87[_0x4000('0xca')],'ListId':_0x25ec87['ListId'],'VoiceQueueId':_0x25ec87[_0x4000('0xcd')]||undefined,'CampaignId':_0x25ec87[_0x4000('0xf6')]||undefined})[_0x4000('0xad')](loggerCatch(_0x4000('0x116')));var _0x36f4f9=new History(_0xbaa3fe);_0x36f4f9['state']=0xa;_0x36f4f9['statedesc']='Drop';_0x36f4f9[_0x4000('0x117')]=moment()[_0x4000('0x78')](_0x4000('0xf5'));_0x36f4f9[_0x4000('0xa6')]=_0x36f4f9[_0x4000('0x117')];_0x36f4f9[_0x4000('0x118')]=_0xbaa3fe['calleridname'];_0x36f4f9[_0x4000('0x119')]=_0xbaa3fe['calleridnum'];this['createHistory'](_0x36f4f9)[_0x4000('0xad')](loggerCatch(_0x4000('0x11a')));}}else{this['voiceQueues'][_0x47bc60['queue']][_0x4000('0x6d')]+=0x1;this[_0x4000('0x1f')][_0x47bc60[_0x4000('0xb0')]]['outboundDropCallsDayCallersExit']+=0x1;_0xbaa3fe[_0x4000('0xa5')]=0xb;_0xbaa3fe['statedesc']='Abandoned';_0xbaa3fe[_0x4000('0x11b')]=_0x4000('0x11c');_0xbaa3fe[_0x4000('0xeb')]+=0x1;_0xbaa3fe[_0x4000('0xe4')]+=0x1;if(_0xbaa3fe[_0x4000('0xeb')]>=this[_0x4000('0x1f')][_0x47bc60[_0x4000('0xb0')]][_0x4000('0x11d')]){this[_0x4000('0x10b')](_0xbaa3fe);}else{this[_0x4000('0xf3')]({'active':![],'countabandonedretry':_0xbaa3fe[_0x4000('0xeb')],'scheduledat':moment()[_0x4000('0xfb')](this['voiceQueues'][_0x47bc60[_0x4000('0xb0')]][_0x4000('0x11e')],_0x4000('0x115'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x25ec87[_0x4000('0xca')],'ListId':_0x25ec87[_0x4000('0xcb')],'VoiceQueueId':_0x25ec87[_0x4000('0xcd')]||undefined,'CampaignId':_0x25ec87['CampaignId']||undefined})[_0x4000('0xad')](loggerCatch(_0x4000('0x11f')));var _0x36f4f9=new History(_0xbaa3fe);_0x36f4f9['state']=0xb;_0x36f4f9['statedesc']='Abandoned';_0x36f4f9['starttime']=moment()[_0x4000('0x78')](_0x4000('0xf5'));_0x36f4f9[_0x4000('0xa6')]=_0x36f4f9[_0x4000('0x117')];_0x36f4f9[_0x4000('0x118')]=_0xbaa3fe['calleridname'];_0x36f4f9[_0x4000('0x119')]=_0xbaa3fe[_0x4000('0x119')];this[_0x4000('0xc4')](_0x36f4f9)[_0x4000('0xad')](loggerCatch(_0x4000('0x120')));}}}}};Dialer[_0x4000('0x1a')][_0x4000('0x35')]=function(_0x5e4029){if(this['actions'][_0x5e4029[_0x4000('0xd5')]]){this[_0x4000('0x24')][_0x5e4029['uniqueid']][_0x4000('0xac')]=_0x5e4029[_0x4000('0xac')];}if(this[_0x4000('0x26')][_0x5e4029[_0x4000('0xd5')]]){this[_0x4000('0x26')][_0x5e4029[_0x4000('0xd5')]]['channel']=_0x5e4029[_0x4000('0xac')];}};Dialer[_0x4000('0x1a')][_0x4000('0x39')]=function(_0x598570){if(strategy[this[_0x4000('0x1f')][this[_0x4000('0x24')][_0x598570[_0x4000('0x121')]][_0x4000('0xb0')]][_0x4000('0x4f')]]===_0x4000('0x122')){if(this['actions'][_0x598570[_0x4000('0x121')]]&&_[_0x4000('0xaa')](this['actions'][_0x598570[_0x4000('0x121')]][_0x4000('0x123')])&&_0x598570[_0x4000('0xab')]==='1'&&_0x598570['paused']==='0'){if(this['agents'][_0x598570[_0x4000('0x124')]]){if(!this[_0x4000('0x125')][_0x598570['stateinterface']][_0x4000('0x123')]){this[_0x4000('0x125')][_0x598570[_0x4000('0x124')]][_0x4000('0x123')]=!![];this[_0x4000('0x24')][_0x598570[_0x4000('0x121')]][_0x4000('0x123')]=!![];this[_0x4000('0x24')][_0x598570[_0x4000('0x121')]][_0x4000('0x124')]=_0x598570[_0x4000('0x124')];}}}}else if((strategy[this['voiceQueues'][this[_0x4000('0x24')][_0x598570[_0x4000('0x121')]]['queue']][_0x4000('0x4f')]]||_0x4000('0x19'))===_0x4000('0x19')){if(this[_0x4000('0x24')][_0x598570['actionid']]){if(this['agents'][_0x598570[_0x4000('0x124')]]){this['actions'][_0x598570[_0x4000('0x121')]]['stateinterface']=_0x598570[_0x4000('0x124')];if(_['isNil'](this[_0x4000('0x2b')][this[_0x4000('0x24')][_0x598570[_0x4000('0x121')]]['queue']])){this[_0x4000('0x2b')][this['actions'][_0x598570[_0x4000('0x121')]][_0x4000('0xb0')]]=[];}this[_0x4000('0x2b')][this[_0x4000('0x24')][_0x598570['actionid']][_0x4000('0xb0')]][_0x4000('0x126')](_['merge'](_[_0x4000('0x127')](this[_0x4000('0x24')][_0x598570[_0x4000('0x121')]],[_0x4000('0x128'),_0x4000('0x124')]),{'status':_0x598570['status'],'paused':_0x598570[_0x4000('0x129')]}));}}}};function unlockQueueStatus(_0x225533,_0x4516e5){setTimeout(function(){if(_['isUndefined'](_0x225533['queueStatusComplete'])){loggerBooked['error'](_0x4000('0x12a'),_0x4516e5);}_0x225533[_0x4000('0x12b')]=!![];loggerBooked['info'](_0x4000('0x12c'),_0x4516e5,JSON['stringify'](_['pick'](_0x225533,[_0x4000('0x3e'),_0x4000('0x12b')])));},0x1f3);}Dialer[_0x4000('0x1a')]['syncQueueStatusComplete']=function(_0x45eae3){var _0x3bd165=this;var _0x58a300=_0x3bd165[_0x4000('0x1f')][_0x3bd165['actions'][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]];if(strategy[this[_0x4000('0x1f')][this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]][_0x4000('0x4f')]]==='roundrobin'){if(this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]]&&this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0x124')]){this[_0x4000('0x1e')][_0x4000('0x12d')](this['actions'][_0x45eae3[_0x4000('0x121')]][_0x4000('0x128')],this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]]['stateinterface'])['catch'](function(_0x23fe3d){logger[_0x4000('0x95')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x4000('0x96')](_0x23fe3d,{'showHidden':![],'depth':null}));})[_0x4000('0x1c')](function(){_0x3bd165[_0x4000('0xc6')](_0x3bd165[_0x4000('0x1f')][_0x3bd165[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]]);_0x3bd165[_0x4000('0x125')][_0x3bd165[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0x124')]][_0x4000('0x123')]=![];delete _0x3bd165[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]];unlockQueueStatus(_0x58a300);});}else{this[_0x4000('0xc6')](this[_0x4000('0x1f')][this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x45eae3[_0x4000('0x121')]][_0x4000('0xca')],'ListId':this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0xcb')],'VoiceQueueId':this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0xcd')]||undefined,'CampaignId':this['actions'][_0x45eae3[_0x4000('0x121')]][_0x4000('0xf6')]||undefined})[_0x4000('0xad')](loggerCatch(_0x4000('0x12e')));delete this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]];unlockQueueStatus(_0x58a300);}}else if((strategy[this[_0x4000('0x1f')][this['actions'][_0x45eae3['actionid']][_0x4000('0xb0')]][_0x4000('0x4f')]]||_0x4000('0x19'))===_0x4000('0x19')){var _0xd02ebe;if(this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]]&&!_[_0x4000('0x45')](this[_0x4000('0x2b')][this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]])){if(this[_0x4000('0x2c')][_0x3bd165['actions'][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]]){this[_0x4000('0x2c')][_0x3bd165[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]]=this[_0x4000('0x2c')][this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]]?this[_0x4000('0x2c')][this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]]:this[_0x4000('0x2b')][this['actions'][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]]?this[_0x4000('0x2b')][this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]][_0x4000('0xb0')]][_0x4000('0x12f')]||0x0:0x0;}this['queueBooked'][this[_0x4000('0x24')][_0x45eae3['actionid']][_0x4000('0xb0')]][_0x4000('0x12f')]=this[_0x4000('0x2c')][this[_0x4000('0x24')][_0x45eae3[_0x4000('0x121')]]['queue']];for(var _0x223374=0x0;_0x223374=0x0?!![]:![];})[_0x4000('0xad')](myreject(_0x30a020)));}}else{_0x6f3618[_0x4000('0x126')](ami[_0x4000('0x148')]({'action':_0x4000('0x149'),'command':util[_0x4000('0x78')](_0x4000('0x14a'),_0x3f6baf,!_['isUndefined'](config[_0x4000('0x144')][_0x46fba2])?_0x46fba2:'')})['then'](function(_0x37bf47){return _0x37bf47['content']['indexOf'](_0x4000('0x14c'))>=0x0?!![]:![];})[_0x4000('0xad')](myreject(_0x30a020)));}BPromise[_0x4000('0x14d')](_0x6f3618)[_0x4000('0xb4')](function(_0x1c4cca){var _0x4b8e5a=_[_0x4000('0x14e')](_0x1c4cca);if(_0x4b8e5a){return _0x467e05(_0x4b8e5a);}else{_0x2774bd[_0x4000('0x42')]=_0x39deb7?_0x4000('0x14f'):_0x4000('0x150');return _0x30a020(msgResponse(_0x4000('0x151'),_0x4000('0x140'),'Global:\x20'+_0x39deb7+'\x20'+_0x1a46d1+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x3f6baf,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x46fba2));}})['catch'](function(_0x36308b){return _0x30a020(msgResponse(_0x4000('0x13f'),_0x4000('0x140'),JSON[_0x4000('0x49')](_0x36308b)));});});};Dialer['prototype'][_0x4000('0x152')]=function(_0x32779a){var _0x164f75=this;return function(){switch(_0x32779a[_0x4000('0x5c')]){case _0x4000('0x153'):freeVariablesPredictive(_0x32779a);_0x164f75[_0x4000('0x154')](_0x32779a,0x1);break;case _0x4000('0x155'):freeVariablesPredictive(_0x32779a);_0x164f75[_0x4000('0x154')](_0x32779a,_0x32779a[_0x4000('0x156')]);break;case _0x4000('0x157'):_0x164f75[_0x4000('0x157')](_0x32779a);break;case _0x4000('0x9'):freeVariablesPredictive(_0x32779a);_0x164f75[_0x4000('0x154')](_0x32779a,0x1);break;default:freeVariablesPredictive(_0x32779a);logger['error']('Queue',_0x32779a[_0x4000('0x3e')],_0x4000('0x158'));}};};Dialer[_0x4000('0x1a')][_0x4000('0x159')]=function(_0x45378c){var _0x313b81=this;return function(){_0x313b81[_0x4000('0x15a')](_0x45378c);};};Dialer['prototype']['syncQueueSummary']=function(_0x36a24f){var _0x511266=this;if(isNotPreview(_0x36a24f[_0x4000('0x5c')])){if(isVoiceQueueOutbound(_0x36a24f[_0x4000('0x4d')])&&isActive(_0x36a24f[_0x4000('0x5b')])){_0x36a24f[_0x4000('0x9f')]=!![];BPromise['resolve']()[_0x4000('0xb4')](checkIsLoggedIn(_0x36a24f,_0x36a24f[_0x4000('0x52')]))[_0x4000('0xb4')](checkIsActive(_0x36a24f,_0x36a24f[_0x4000('0x5b')]))[_0x4000('0xb4')](checkInterval(_0x36a24f))['then'](_0x511266[_0x4000('0x139')](_0x36a24f))[_0x4000('0xb4')](_0x511266[_0x4000('0x13d')](_0x36a24f[_0x4000('0x15b')],_0x36a24f['dialTimezone'],_0x36a24f['name'],_0x36a24f))[_0x4000('0xb4')](_0x511266[_0x4000('0x13e')](_0x36a24f[_0x4000('0x41')],_0x36a24f[_0x4000('0x15c')],_0x36a24f['name'],_0x36a24f))[_0x4000('0xb4')](_0x511266[_0x4000('0x152')](_0x36a24f))[_0x4000('0xad')](loggerCatchQueueSummary(_0x4000('0x15d'),_0x36a24f));}else{notSendMessagesQueue(_0x36a24f);}}else{freeVariablesPredictive(_0x36a24f);}};Dialer[_0x4000('0x1a')][_0x4000('0x138')]=function(){var _0x390ee5=this;var _0x430ce6;for(var _0x365e93 in this[_0x4000('0x20')]){if(this[_0x4000('0x20')][_0x4000('0xa9')](_0x365e93)){_0x430ce6=this[_0x4000('0x20')][_0x365e93];if(isCampaignIvr(_0x430ce6[_0x4000('0x4d')])&&isActive(_0x430ce6['active'])){_0x430ce6[_0x4000('0x9f')]=!![];BPromise[_0x4000('0xb3')]()['then'](checkIsActive(_0x430ce6,_0x430ce6[_0x4000('0xd2')]))[_0x4000('0xb4')](checkInterval(_0x430ce6))[_0x4000('0xb4')](_0x390ee5['checkIsTrunkReachable'](_0x430ce6))[_0x4000('0xb4')](_0x390ee5[_0x4000('0x13d')](_0x430ce6[_0x4000('0x15b')],_0x430ce6['dialTimezone'],_0x430ce6[_0x4000('0x3e')],_0x430ce6))[_0x4000('0xb4')](_0x390ee5['checkIfTimeIntervals'](_0x430ce6[_0x4000('0x41')],_0x430ce6['dialTimezone'],_0x430ce6[_0x4000('0x3e')],_0x430ce6))[_0x4000('0xb4')](_0x390ee5[_0x4000('0x159')](_0x430ce6))[_0x4000('0xad')](loggerCatchQueueSummary(_0x4000('0x15e'),_0x430ce6));}else{notSendMessagesCampaign(_0x430ce6);}}}};function getCallerIdRandom(_0x476186,_0x41144a){var _0x193017,_0x2778b0,_0x1600d8;if(_0x41144a<=0x0){_0x41144a=0x1;}_0x193017=new RegExp(_0x4000('0x15f')+_0x41144a+'}$');_0x2778b0=Math[_0x4000('0x160')](0xa,_0x41144a-0x1);_0x1600d8=Math[_0x4000('0x160')](0xa,_0x41144a)-0x1;return util['format']('%s',_[_0x4000('0x161')](_0x476186,_0x193017,_[_0x4000('0x162')](_0x2778b0,_0x1600d8)));}function extractCalleridName(_0x3ce075){var _0x3ccc6b=_0x3ce075['match'](/"(.*?)"/);return _0x3ccc6b?_0x3ccc6b[0x1]:_0x3ce075;}function extractCalleridNumber(_0xb8ab98){var _0x2489af=_0xb8ab98['match'](/<(.*?)>/);return _0x2489af?_0x2489af[0x1]:_0xb8ab98;}Dialer[_0x4000('0x1a')][_0x4000('0x163')]=function(_0x337521,_0x4213b4){var _0x12ac0e=this;var _0x15f8dd=uuid['v4']();this['actions'][_0x15f8dd]=new Action(_0x337521,_0x4213b4,_0x15f8dd);return new BPromise(function(_0x775816,_0x2e1c78){if(_[_0x4000('0x3d')](_0x337521)&&_0x4000('0x164')!==typeof _0x337521){return _0x2e1c78(msgResponse(_0x4000('0x165'),_0x4000('0x140'),_0x4000('0x166')));}if(_[_0x4000('0x3d')](_0x4213b4[_0x4000('0x167')][_0x4000('0x168')])||_0x4213b4[_0x4000('0x167')]['phone']===null){return _0x2e1c78(msgResponse(_0x4000('0x165'),_0x4000('0x140'),_0x4000('0x169')));}var _0x1ba429={'XMD-CALLERID':_0x12ac0e[_0x4000('0x24')][_0x15f8dd][_0x4000('0x16a')](),'XMD-AGI':_0x337521[_0x4000('0xfe')]?util[_0x4000('0x78')](_0x4000('0x16b'),ipAgi,_0x337521['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x337521[_0x4000('0x108')]?util[_0x4000('0x78')](_0x4000('0x16b'),ipAgi,_0x337521[_0x4000('0x108')]):_0x4000('0x16c'),'XMD-QUEUE':_0x337521['type']===_0x4000('0x4e')?util[_0x4000('0x78')](_0x4000('0x16d'),_0x337521[_0x4000('0x3e')],_0x337521[_0x4000('0x16e')]||'',_0x337521[_0x4000('0x16f')]?'c':'',_0x337521['dialQueueTimeout']||0x3):_0x4000('0x16c'),'XMD-CONTACTID':_0x4213b4[_0x4000('0xca')],'XMD-CDRTYPE':_0x4000('0x8'),'CALLERID(all)':_0x12ac0e[_0x4000('0x24')][_0x15f8dd][_0x4000('0x16a')](),'XMD-AMD':_0x337521['dialAMDActive']?_0x4000('0x170'):_0x4000('0x16c'),'XMD-DESTINATION':_0x4000('0xd9')};if(_0x337521[_0x4000('0xe1')]){_0x1ba429['XMD-AMDINITIALSILENCE']=_0x337521[_0x4000('0x171')]||0x9c4;_0x1ba429[_0x4000('0x172')]=_0x337521[_0x4000('0x173')]||0x5dc;_0x1ba429[_0x4000('0x174')]=_0x337521[_0x4000('0x175')]||0x320;_0x1ba429[_0x4000('0x176')]=_0x337521[_0x4000('0x177')]||0x1388;_0x1ba429[_0x4000('0x178')]=_0x337521[_0x4000('0x179')]||0x64;_0x1ba429[_0x4000('0x17a')]=_0x337521[_0x4000('0x17b')]||0x32;_0x1ba429[_0x4000('0x17c')]=_0x337521[_0x4000('0x17d')]||0x3;_0x1ba429[_0x4000('0x17e')]=_0x337521[_0x4000('0x17f')]||0x100;_0x1ba429[_0x4000('0x180')]=_0x337521[_0x4000('0x181')]||0x1388;}if(_0x337521[_0x4000('0x4d')]===_0x4000('0x4e')){_0x1ba429[_0x4000('0x182')]=_0x4213b4[_0x4000('0xcd')];}else{_0x1ba429[_0x4000('0x183')]=_0x4213b4[_0x4000('0xf6')];}for(var _0x51ec9c in _0x4213b4[_0x4000('0x167')]){if(_0x4213b4[_0x4000('0x167')][_0x4000('0xa9')](_0x51ec9c)){if(isNotNull(_0x4213b4[_0x4000('0x167')][_0x51ec9c])&&_0x51ec9c!=='id'&&_0x51ec9c!==_0x4000('0x184')&&_0x51ec9c!=='createdAt'&&_0x51ec9c!==_0x4000('0x185')){_0x1ba429[util['format']('%s%s',_0x4000('0x186'),_[_0x4000('0x187')](_0x51ec9c))]=_0x4213b4[_0x4000('0x167')][_0x51ec9c];}}}var _0x3ba27d=_0x12ac0e[_0x4000('0xd1')](_0x337521[_0x4000('0x76')])?getCallerId(_0x337521['Trunk'][_0x4000('0x77')],_0x337521[_0x4000('0x5d')],_0x337521[_0x4000('0x188')]>0x0?getCallerIdRandom(_0x337521['dialOriginateCallerIdNumber'],_0x337521['dialRandomLastDigitCallerIdNumber']):_0x337521[_0x4000('0x189')]):getCallerId(_['isNil'](_0x337521['TrunkBackup'])?_0x337521[_0x4000('0x76')][_0x4000('0x77')]:_0x337521[_0x4000('0x13a')]['callerid'],_0x337521[_0x4000('0x5d')],_0x337521['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x337521[_0x4000('0x189')],_0x337521[_0x4000('0x188')]):_0x337521[_0x4000('0x189')]);if(_0x3ba27d){_0x1ba429[_0x4000('0x18a')]=_0x12ac0e[_0x4000('0x24')][_0x15f8dd][_0x4000('0x18b')]=extractCalleridName(_0x3ba27d);_0x1ba429[_0x4000('0x18c')]=_0x12ac0e[_0x4000('0x24')][_0x15f8dd]['originatecalleridnum']=extractCalleridNumber(_0x3ba27d);}return ami[_0x4000('0x148')]({'actionid':_0x15f8dd,'action':_0x4000('0x165'),'channel':_0x12ac0e[_0x4000('0xd1')](_0x337521[_0x4000('0x76')])?util[_0x4000('0x78')](_0x4000('0x18d'),_0x337521[_0x4000('0x76')][_0x4000('0x3e')],isNotNull(_0x337521[_0x4000('0x5f')])?_0x337521[_0x4000('0x5f')][_0x4000('0x18e')]()||'':'',_0x337521[_0x4000('0x18f')]>0x0?_0x4213b4['Contact'][_0x4000('0x168')][_0x4000('0x190')](_0x337521[_0x4000('0x18f')]):_0x4213b4[_0x4000('0x167')]['phone']):util['format'](_0x4000('0x18d'),_['isNil'](_0x337521[_0x4000('0x13a')])?_0x337521['Trunk'][_0x4000('0x3e')]:_0x337521[_0x4000('0x13a')][_0x4000('0x3e')],isNotNull(_0x337521[_0x4000('0x5f')])?_0x337521['dialPrefix'][_0x4000('0x18e')]()||'':'',_0x337521[_0x4000('0x18f')]>0x0?_0x4213b4['Contact'][_0x4000('0x168')][_0x4000('0x190')](_0x337521['dialCutDigit']):_0x4213b4[_0x4000('0x167')][_0x4000('0x168')]),'callerid':_0x3ba27d,'Exten':_0x4000('0xd9'),'Context':'from-sip','Priority':'1','variable':_0x1ba429,'timeout':(_0x337521[_0x4000('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x15f8dd})[_0x4000('0xb4')](function(_0x52221e){return _0x775816(_0x52221e);})[_0x4000('0xad')](function(_0x33e1ed){_0x337521[_0x4000('0x69')]+=0x1;var _0x239b95=new History(_0x12ac0e[_0x4000('0x24')][_0x15f8dd]);logger[_0x4000('0x95')](util[_0x4000('0x78')](_0x4000('0x191'),JSON[_0x4000('0x49')](_0x33e1ed)));_0x239b95[_0x4000('0xa5')]=0xe;_0x239b95[_0x4000('0xf7')]=_0x4000('0x192');_0x239b95[_0x4000('0x117')]=moment()[_0x4000('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x239b95[_0x4000('0xa6')]=_0x239b95[_0x4000('0x117')];_0x12ac0e[_0x4000('0xc4')](_0x239b95)[_0x4000('0xad')](loggerCatch(_0x4000('0x193')));_0x12ac0e[_0x4000('0xc2')](_0x239b95)[_0x4000('0xad')](loggerCatch(_0x4000('0x193')))[_0x4000('0x1c')](function(){delete _0x12ac0e['actions'][_0x15f8dd];return _0x2e1c78(msgResponse(_0x4000('0x165'),_0x4000('0x48'),'originate\x20action\x20Error'));});});});};Dialer[_0x4000('0x1a')]['syncOriginateResponse']=function(_0x5d1026){var _0x4551c3=this[_0x4000('0x24')][_0x5d1026[_0x4000('0x121')]];var _0x2b6b29=this;if(_0x4551c3){delete this[_0x4000('0x24')][_0x5d1026[_0x4000('0x121')]];_0x4551c3[_0x4000('0x10f')]=moment()[_0x4000('0x78')](_0x4000('0xf5'));var _0x115e83=_0x4551c3[_0x4000('0x4d')]===_0x4000('0x7a')?this[_0x4000('0x20')][_0x4551c3[_0x4000('0xb0')]]:this['voiceQueues'][_0x4551c3[_0x4000('0x194')]()];if(!this['isSuccess'](_0x5d1026[_0x4000('0x195')])){this[_0x4000('0xc6')](_0x115e83);return this[_0x4000('0x196')](_0x4551c3,_0x115e83,_0x5d1026)['then'](function(_0x420df0){})[_0x4000('0xad')](loggerCatch(_0x4000('0x197')));}else{this['uniqueId'][_0x5d1026[_0x4000('0xd5')]]=_0x4551c3;}}};Dialer[_0x4000('0x1a')][_0x4000('0x198')]=function(_0x375ee6,_0x27493c,_0x50e813){var _0x4e2bb0=new History(_0x27493c);if(_0x4e2bb0[_0x4000('0xe7')]+_0x4e2bb0['countcongestionretry']+_0x4e2bb0[_0x4000('0xfa')]+_0x4e2bb0[_0x4000('0xe9')]+_0x4e2bb0[_0x4000('0xea')]+_0x4e2bb0['countabandonedretry']+_0x4e2bb0[_0x4000('0xef')]+_0x4e2bb0[_0x4000('0xec')]>=_0x50e813[_0x4000('0xed')]-0x1){return!![];}switch(_0x375ee6){case 0x3:if(_0x4e2bb0['countnoanswerretry']>=_0x50e813[_0x4000('0x199')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4e2bb0[_0x4000('0xfa')]+=0x1,'scheduledat':moment()['add'](_0x50e813[_0x4000('0x19a')],_0x4000('0x115'))[_0x4000('0x78')](_0x4000('0xf5')),'ContactId':_0x4e2bb0[_0x4000('0xca')],'ListId':_0x4e2bb0['ListId'],'VoiceQueueId':_0x4e2bb0[_0x4000('0xcd')]||undefined,'CampaignId':_0x4e2bb0['CampaignId']||undefined})[_0x4000('0xad')](loggerCatch(_0x4000('0x19b')));}break;case 0x5:if(_0x4e2bb0[_0x4000('0xe7')]>=_0x50e813['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x4000('0xf3')]({'active':![],'countbusyretry':_0x4e2bb0[_0x4000('0xe7')]+=0x1,'scheduledat':moment()[_0x4000('0xfb')](_0x50e813['dialBusyRetryFrequency'],_0x4000('0x115'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e2bb0['ContactId'],'ListId':_0x4e2bb0[_0x4000('0xcb')],'VoiceQueueId':_0x4e2bb0[_0x4000('0xcd')]||undefined,'CampaignId':_0x4e2bb0[_0x4000('0xf6')]||undefined})[_0x4000('0xad')](loggerCatch(_0x4000('0x19c')));}break;case 0x8:if(_0x4e2bb0[_0x4000('0xe8')]>=_0x50e813[_0x4000('0x19d')]-0x1){return!![];}else{this[_0x4000('0xf3')]({'active':![],'countcongestionretry':_0x4e2bb0[_0x4000('0xe8')]+=0x1,'scheduledat':moment()[_0x4000('0xfb')](_0x50e813[_0x4000('0x19e')],_0x4000('0x115'))[_0x4000('0x78')](_0x4000('0xf5')),'ContactId':_0x4e2bb0[_0x4000('0xca')],'ListId':_0x4e2bb0['ListId'],'VoiceQueueId':_0x4e2bb0[_0x4000('0xcd')]||undefined,'CampaignId':_0x4e2bb0[_0x4000('0xf6')]||undefined})[_0x4000('0xad')](loggerCatch(_0x4000('0x19f')));}break;case 0x0:if(_0x4e2bb0[_0x4000('0xe9')]>=_0x50e813[_0x4000('0x1a0')]-0x1){return!![];}else{this[_0x4000('0xf3')]({'active':![],'countnosuchnumberretry':_0x4e2bb0[_0x4000('0xe9')]+=0x1,'scheduledat':moment()[_0x4000('0xfb')](_0x50e813['dialNoSuchNumberRetryFrequency'],'minutes')[_0x4000('0x78')](_0x4000('0xf5')),'ContactId':_0x4e2bb0[_0x4000('0xca')],'ListId':_0x4e2bb0[_0x4000('0xcb')],'VoiceQueueId':_0x4e2bb0['VoiceQueueId']||undefined,'CampaignId':_0x4e2bb0[_0x4000('0xf6')]||undefined})['catch'](loggerCatch(_0x4000('0x1a1')));}break;case 0xa:if(_0x4e2bb0[_0x4000('0xea')]>=_0x50e813['dialDropMaxRetry']-0x1){return!![];}else{this[_0x4000('0xf3')]({'active':![],'countdropretry':_0x4e2bb0[_0x4000('0xea')]+=0x1,'scheduledat':moment()[_0x4000('0xfb')](_0x50e813[_0x4000('0x114')],_0x4000('0x115'))[_0x4000('0x78')](_0x4000('0xf5')),'ContactId':_0x4e2bb0['ContactId'],'ListId':_0x4e2bb0[_0x4000('0xcb')],'VoiceQueueId':_0x4e2bb0[_0x4000('0xcd')]||undefined,'CampaignId':_0x4e2bb0[_0x4000('0xf6')]||undefined})[_0x4000('0xad')](loggerCatch(_0x4000('0x116')));}break;case 0xb:if(_0x4e2bb0[_0x4000('0xeb')]>=_0x50e813[_0x4000('0x11d')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x4e2bb0[_0x4000('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x50e813['dialAbandonedRetryFrequency'],_0x4000('0x115'))[_0x4000('0x78')](_0x4000('0xf5')),'ContactId':_0x4e2bb0[_0x4000('0xca')],'ListId':_0x4e2bb0[_0x4000('0xcb')],'VoiceQueueId':_0x4e2bb0[_0x4000('0xcd')]||undefined,'CampaignId':_0x4e2bb0['CampaignId']||undefined})[_0x4000('0xad')](loggerCatch(_0x4000('0x11f')));}break;case 0x13:if(_0x4e2bb0[_0x4000('0xef')]>=_0x50e813[_0x4000('0xf0')]-0x1){return!![];}else{this[_0x4000('0xf3')]({'active':![],'countmachineretry':_0x4e2bb0[_0x4000('0xef')]+=0x1,'scheduledat':moment()['add'](_0x50e813['dialMachineRetryFrequency'],_0x4000('0x115'))[_0x4000('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e2bb0[_0x4000('0xca')],'ListId':_0x4e2bb0[_0x4000('0xcb')],'VoiceQueueId':_0x4e2bb0[_0x4000('0xcd')]||undefined,'CampaignId':_0x4e2bb0[_0x4000('0xf6')]||undefined})[_0x4000('0xad')](loggerCatch(_0x4000('0xfc')));}break;case 0x14:if(_0x4e2bb0[_0x4000('0xec')]>=_0x50e813[_0x4000('0x1a2')]-0x1){return!![];}else{this[_0x4000('0xf3')]({'active':![],'countagentrejectretry':_0x4e2bb0[_0x4000('0xec')]+=0x1,'scheduledat':moment()[_0x4000('0xfb')](_0x50e813[_0x4000('0x1a3')],'minutes')[_0x4000('0x78')](_0x4000('0xf5')),'ContactId':_0x4e2bb0[_0x4000('0xca')],'ListId':_0x4e2bb0['ListId'],'VoiceQueueId':_0x4e2bb0['VoiceQueueId']||undefined,'CampaignId':_0x4e2bb0['CampaignId']||undefined})[_0x4000('0xad')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x4000('0x1a')][_0x4000('0x196')]=function(_0x19ee57,_0xdd45bf,_0x48ad8a){var _0x4af650=this;var _0x2ed4f0=new History(_0x19ee57);return new BPromise(function(_0x1da7c5,_0x38cabd){if(_['isUndefined'](_0xdd45bf)&&'object'!==typeof _0xdd45bf){return _0x38cabd(msgResponse(_0x4000('0x1a4'),_0x4000('0x140'),_0x4000('0x1a5')));}if(_[_0x4000('0x3d')](_0x48ad8a)&&_0x4000('0x164')!==typeof _0x48ad8a){return _0x38cabd(msgResponse(_0x4000('0x1a4'),_0x4000('0x140'),_0x4000('0x1a6')));}switch(_0x48ad8a[_0x4000('0x105')]){case'0':_0xdd45bf[_0x4000('0x68')]+=0x1;_0x2ed4f0[_0x4000('0xa5')]=0x0;_0x2ed4f0[_0x4000('0xf7')]='NoSuchNumber';_0x2ed4f0[_0x4000('0xe9')]+=0x1;_0x2ed4f0[_0x4000('0xe4')]+=0x1;ami[_0x4000('0x4c')](_0x4000('0x1a7'),ut[_0x4000('0x1a8')](_0x19ee57,_0x4000('0x1a9')));_0x4af650[_0x4000('0xc4')](_0x2ed4f0)['catch'](loggerCatch(_0x4000('0xe6')));if(_0x4af650[_0x4000('0x198')](0x0,_0x19ee57,_0xdd45bf)){if(_0x2ed4f0[_0x4000('0xe9')]>=_0xdd45bf[_0x4000('0x1a0')]){_0x4af650[_0x4000('0xf1')](_0x2ed4f0,_0x1da7c5,_0x38cabd,'reason\x200\x20no\x20such\x20number....');}else{_0x4af650[_0x4000('0x1aa')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x4000('0x1ab'));}}break;case'3':_0xdd45bf[_0x4000('0x67')]+=0x1;_0x2ed4f0[_0x4000('0xa5')]=0x3;_0x2ed4f0['statedesc']=_0x4000('0x1ac');_0x2ed4f0['countnoanswerretry']+=0x1;_0x2ed4f0[_0x4000('0xe4')]+=0x1;ami[_0x4000('0x4c')]('custom:agentnoanswer',ut[_0x4000('0x1a8')](_0x19ee57,_0x4000('0x1ad')));_0x4af650[_0x4000('0xc4')](_0x2ed4f0)['catch'](loggerCatch(_0x4000('0x1ae')));if(_0x4af650['checkRetriveMax'](0x3,_0x19ee57,_0xdd45bf)){if(_0x2ed4f0[_0x4000('0xfa')]>=_0xdd45bf['dialNoAnswerMaxRetry']){_0x4af650[_0x4000('0xf1')](_0x2ed4f0,_0x1da7c5,_0x38cabd,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4af650[_0x4000('0x1aa')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x4000('0x1af'));}}break;case'5':_0xdd45bf[_0x4000('0x62')]+=0x1;_0x2ed4f0['state']=0x5;_0x2ed4f0['statedesc']=_0x4000('0x1b0');_0x2ed4f0[_0x4000('0xe7')]+=0x1;_0x2ed4f0[_0x4000('0xe4')]+=0x1;ami[_0x4000('0x4c')](_0x4000('0x1b1'),ut[_0x4000('0x1a8')](_0x19ee57,'busy'));_0x4af650['createHistory'](_0x2ed4f0)[_0x4000('0xad')](loggerCatch(_0x4000('0x1b2')));if(_0x4af650['checkRetriveMax'](0x5,_0x19ee57,_0xdd45bf)){if(_0x2ed4f0[_0x4000('0xe7')]>=_0xdd45bf[_0x4000('0x1b3')]){_0x4af650['createStateFinal'](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x4000('0x1b4'));}else{_0x4af650[_0x4000('0x1aa')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x4000('0x1b4'));}}break;case'8':_0xdd45bf[_0x4000('0x63')]+=0x1;_0x2ed4f0['state']=0x8;_0x2ed4f0['statedesc']=_0x4000('0x1b5');_0x2ed4f0['countcongestionretry']+=0x1;_0x2ed4f0[_0x4000('0xe4')]+=0x1;ami[_0x4000('0x4c')](_0x4000('0x1b6'),ut[_0x4000('0x1a8')](_0x19ee57,_0x4000('0x1b7')));_0x4af650[_0x4000('0xc4')](_0x2ed4f0)[_0x4000('0xad')](loggerCatch(_0x4000('0x1b8')));if(_0x4af650[_0x4000('0x198')](0x8,_0x19ee57,_0xdd45bf)){if(_0x2ed4f0[_0x4000('0xe8')]>=_0xdd45bf[_0x4000('0x19d')]){_0x4af650[_0x4000('0xf1')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x4000('0x1b9'));}else{_0x4af650[_0x4000('0x1aa')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x4000('0x1b9'));}}break;case'11':_0xdd45bf[_0x4000('0x1ba')]+=0x1;_0x2ed4f0[_0x4000('0xa5')]=0xb;_0x2ed4f0[_0x4000('0xf7')]=_0x4000('0x1bb');_0x2ed4f0['countabandonedretry']+=0x1;_0x2ed4f0['countglobal']+=0x1;_0x4af650[_0x4000('0xc4')](_0x2ed4f0)['catch'](loggerCatch(_0x4000('0x120')));if(_0x4af650[_0x4000('0x198')](0xb,_0x19ee57,_0xdd45bf)){if(_0x2ed4f0[_0x4000('0xeb')]>=_0xdd45bf[_0x4000('0x11d')]){_0x4af650[_0x4000('0xf1')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x4000('0x1bc'));}else{_0x4af650[_0x4000('0x1aa')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x4000('0x1bc'));}}break;case'20':_0xdd45bf[_0x4000('0x1bd')]+=0x1;_0x2ed4f0[_0x4000('0xa5')]=0x14;_0x2ed4f0[_0x4000('0xf7')]=_0x4000('0x1be');_0x2ed4f0[_0x4000('0xec')]+=0x1;_0x2ed4f0[_0x4000('0xe4')]+=0x1;ami[_0x4000('0x4c')](_0x4000('0x1bf'),ut[_0x4000('0x1a8')](_0x19ee57,_0x4000('0x1c0')));_0x4af650[_0x4000('0xc4')](_0x2ed4f0)['catch'](loggerCatch(_0x4000('0x1c1')));if(_0x4af650[_0x4000('0x198')](0x14,_0x19ee57,_0xdd45bf)){if(_0x2ed4f0[_0x4000('0xec')]>=_0xdd45bf[_0x4000('0x1a2')]){_0x4af650[_0x4000('0xf1')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x4000('0x1c2'));}else{_0x4af650[_0x4000('0x1aa')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x4000('0x1c2'));}}break;default:_0xdd45bf['outboundUnknownCallsDay']+=0x1;_0x2ed4f0[_0x4000('0xa5')]=0xc;_0x2ed4f0['statedesc']=_0x48ad8a['reason'];_0x4af650[_0x4000('0xc4')](_0x2ed4f0)[_0x4000('0xad')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4af650[_0x4000('0x198')](_0x48ad8a[_0x4000('0x105')],_0x19ee57,_0xdd45bf)){if(_0x2ed4f0[_0x4000('0xe7')]+_0x2ed4f0[_0x4000('0xe8')]+_0x2ed4f0[_0x4000('0xfa')]+_0x2ed4f0['countnosuchnumberretry']+_0x2ed4f0[_0x4000('0xea')]+_0x2ed4f0[_0x4000('0xeb')]+_0x2ed4f0[_0x4000('0xef')]+_0x2ed4f0[_0x4000('0xec')]>=_0xdd45bf[_0x4000('0xed')]){_0x4af650[_0x4000('0x1aa')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x48ad8a[_0x4000('0x105')]);}else{_0x4af650[_0x4000('0xf1')](_0x2ed4f0,_0x1da7c5,_0x38cabd,_0x48ad8a['reason']);}}}});};Dialer[_0x4000('0x1a')][_0x4000('0x1aa')]=function(_0x2fd9e1,_0x55c3f1,_0x166665,_0x4b7301){var _0x150ca6=new Final(_0x2fd9e1);_0x150ca6[_0x4000('0xa5')]=0xf;_0x150ca6[_0x4000('0xf7')]=_0x4000('0x1c3');this[_0x4000('0xf1')](_0x150ca6,_0x55c3f1,_0x166665,_0x4b7301);};Dialer[_0x4000('0x1a')][_0x4000('0xf1')]=function(_0xe24f43,_0x55e34b,_0x22a62e,_0x23b2a9){this[_0x4000('0xc2')](_0xe24f43)[_0x4000('0xb4')](function(_0x28b84d){return _0x55e34b(msgResponse(_0x4000('0x1a4'),_0x4000('0x1c4'),_0x23b2a9));})[_0x4000('0xad')](function(_0x5355ac){return _0x22a62e(msgResponse('[moveContactManagedDialer][0]',_0x4000('0x140'),_0x4000('0x1c5')));});};Dialer[_0x4000('0x1a')][_0x4000('0x157')]=function(_0x4bceae){var _0x245b44=this;var _0x1c3304=_0x4bceae[_0x4000('0x1c6')]/0x64;var _0x5782b3=_0x4bceae[_0x4000('0x66')]/(_0x4bceae[_0x4000('0x66')]+_0x4bceae['outboundAnswerCallsDay']);var _0x805ee8=Math[_0x4000('0x1c7')](_0x4bceae[_0x4000('0x71')]*(_0x4bceae[_0x4000('0x1c8')]/0x64));var _0x5b83f5=Math[_0x4000('0x1c7')](_0x4bceae[_0x4000('0x71')]*(_0x4bceae[_0x4000('0x1c9')]/0x64));var _0x124458=_0x4bceae[_0x4000('0x51')]+_0x4bceae[_0x4000('0x55')];var _0x2c1991=Math[_0x4000('0x1ca')](_0x4bceae[_0x4000('0x1cb')]*_0x4bceae['erlangAbandonmentRate']*_0x4bceae[_0x4000('0x1cc')]*_0x4bceae['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x4bceae['startProgressive'])){if(!_[_0x4000('0x3d')](_0x4bceae[_0x4000('0x28')])){_0x4bceae['startPredictive']=undefined;loggerPredictive[_0x4000('0x95')]('[startMethodPredictive][StartProgressive]',_0x4000('0x1cd'));}if(!_[_0x4000('0x3d')](_0x4bceae['handlePredictive'])){loggerPredictive[_0x4000('0x95')](_0x4000('0x1ce'),_0x4000('0x1cf'));clearInterval(_0x4bceae[_0x4000('0x90')]);_0x4bceae[_0x4000('0x90')]=undefined;}_0x4bceae[_0x4000('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4000('0x7d')](_0x4bceae[_0x4000('0x3e')],_0x4000('0x1d0'),_0x4bceae['startProgressive']);this[_0x4000('0x154')](_0x4bceae,0x1);}else if(ifInterval(_0x4bceae[_0x4000('0x1d1')],_0x4bceae[_0x4000('0x29')])){this[_0x4000('0x154')](_0x4bceae,0x1);loggerPredictiveCalls['info'](_0x4000('0x1d2'),_0x4bceae[_0x4000('0x29')],_0x4bceae['name']);_0x4bceae[_0x4000('0x1cb')]=0x0;_0x4bceae[_0x4000('0x70')]=0x0;}else if(_0x1c3304<_0x5782b3&&_0x4bceae[_0x4000('0x1d3')]===_0x4000('0x1d4')){freeVariablesPredictive(_0x4bceae);loggerPredictive[_0x4000('0x7d')](_0x4000('0x1d5'),_0x4000('0x1d6'),_0x5782b3,'startProgressive',_0x4bceae[_0x4000('0x3e')]);}else if(_0x2c1991<_0x4bceae['predictiveIntervalErlangCallsDroppedCalls']&&_0x4bceae['dialPredictiveOptimization']===_0x4000('0x1d4')){freeVariablesPredictive(_0x4bceae);loggerPredictive[_0x4000('0x7d')](_0x4000('0x1d7'),'Max\x20Drop\x20',_0x2c1991,_0x4000('0x1d8'),_0x4bceae[_0x4000('0x70')],_0x4000('0x29'),_0x4bceae['name']);}else if(!ifInterval(_0x4bceae[_0x4000('0x1d1')],_0x4bceae[_0x4000('0x29')])&&_[_0x4000('0x3d')](_0x4bceae['startPredictive'])&&!_[_0x4000('0x3d')](_0x4bceae[_0x4000('0x29')])){_0x4bceae[_0x4000('0x28')]=moment()[_0x4000('0x78')](_0x4000('0xf5'));loggerPredictive['info'](_0x4bceae['name'],'started\x20in\x20predictive\x20at',_0x4bceae[_0x4000('0x28')]);this[_0x4000('0x1d9')](_0x4bceae[_0x4000('0x1d1')])[_0x4000('0xb4')](this[_0x4000('0x1da')](_0x4bceae))[_0x4000('0xb4')](mergeDataErlangB(_0x4bceae))[_0x4000('0xb4')](this[_0x4000('0x1db')](_0x4bceae))[_0x4000('0xad')](loggerCatchPredictive(_0x4000('0x1dc'),_0x4bceae));}else if(!ifInterval(_0x4bceae[_0x4000('0x1d1')],_0x4bceae['startPredictive'])){_0x4bceae[_0x4000('0x70')]=0x0;_0x4bceae[_0x4000('0x28')]=moment()[_0x4000('0x78')](_0x4000('0xf5'));loggerPredictive[_0x4000('0x7d')](_0x4bceae[_0x4000('0x3e')],'recalculate\x20predictive\x20at',_0x4bceae['startPredictive']);clearInterval(_0x4bceae[_0x4000('0x90')]);_0x4bceae[_0x4000('0x90')]=undefined;this[_0x4000('0x1d9')](_0x4bceae[_0x4000('0x1d1')])[_0x4000('0xb4')](this['getDataPredictive'](_0x4bceae))['then'](mergeDataErlangB(_0x4bceae))[_0x4000('0xb4')](this[_0x4000('0x1db')](_0x4bceae))['catch'](loggerCatchPredictive(_0x4000('0x1dd'),_0x4bceae));}else if(_0x4bceae[_0x4000('0x71')]&&_0x124458<_0x4bceae[_0x4000('0x71')]-_0x5b83f5){freeVariablesPredictive(_0x4bceae);loggerPredictive[_0x4000('0x7d')](_0x4bceae[_0x4000('0x3e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x124458,_0x4000('0x1de'),_0x4bceae[_0x4000('0x71')],'-',_0x5b83f5,'=',_0x4bceae['predictiveIntervalAvailable']-_0x5b83f5,')');}else if(_0x4bceae[_0x4000('0x71')]&&_0x124458>_0x4bceae[_0x4000('0x71')]+_0x805ee8){freeVariablesPredictive(_0x4bceae);loggerPredictive[_0x4000('0x7d')](_0x4bceae[_0x4000('0x3e')],_0x4000('0x1df'),_0x124458,_0x4000('0x1e0'),_0x4bceae['predictiveIntervalAvailable'],'+',_0x805ee8,'=',_0x4bceae[_0x4000('0x71')]+_0x805ee8,')');}};Dialer[_0x4000('0x1a')][_0x4000('0x1da')]=function(_0x13aa57){var _0xab221a=this;return function(_0x3e5834){return new BPromise(function(_0x1b1c34,_0x41cb77){_['merge'](_0x13aa57,_0x3e5834[0x0]);if(checkGetDataPredictive(_0x3e5834[0x0])){var _0x4e7398=_0x13aa57[_0x4000('0x71')]=_0x13aa57[_0x4000('0x55')]+_0x13aa57[_0x4000('0x51')];var _0x3cd854=_0x13aa57['dialPredictiveInterval']*0x3c;var _0x5f3cd9=_0x3e5834[0x0][_0x4000('0x83')]+_0x3e5834[0x0][_0x4000('0x6c')];var _0x4547e5=(_0x3e5834[0x0][_0x4000('0x80')]+_0x3e5834[0x0][_0x4000('0x6e')]+_0x3e5834[0x0][_0x4000('0x6d')])/_0x3e5834[0x0][_0x4000('0x72')];_0x13aa57['predictiveIntervalHitRate']=_0x4547e5>0x0?_0x4547e5:0x1;switch(_0x13aa57[_0x4000('0x1d3')]){case _0x4000('0x1d4'):var _0x4daa07=_0x13aa57[_0x4000('0x1c6')]/0x64;return _0xab221a['abandonmentRate'](_0x4e7398,_0x3cd854,_0x5f3cd9,_0x4547e5,_0x4daa07)[_0x4000('0xb4')](function(_0xfb06ba){return _0x1b1c34(_0xfb06ba);});case _0x4000('0x1e1'):var _0xd38b3a=_0x13aa57[_0x4000('0x1c6')]/0x64;return _0xab221a[_0x4000('0x1e2')](_0x4e7398,_0x3cd854,_0x5f3cd9,_0x4547e5,_0xd38b3a)[_0x4000('0xb4')](function(_0x41e5d6){return _0x1b1c34(_0x41e5d6);});default:return _0x41cb77(msgResponse('[getDataPredictive]',_0x4000('0x140'),'Unknown\x20Predictive'));}}else{return _0x41cb77(msgResponse('[getDataPredictive]',_0x4000('0x140'),_0x4000('0x1e3')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x5b6714){var _0xa0cdff=this;return function(_0x38e367){return new BPromise(function(_0x33a7a0,_0x25d574){_['merge'](_0x5b6714,_0x38e367[0x0]);if(checkGetDataPredictive(_0x38e367[0x0])){loggerPredictive[_0x4000('0x7d')](JSON[_0x4000('0x49')](_0x38e367[0x0]));if(_0x5b6714[_0x4000('0x1d3')]===_0x4000('0x1d4')){return _0xa0cdff[_0x4000('0xc0')](_0x5b6714['id'])[_0x4000('0xb4')](function(_0x45e756){var _0xce306a=_0x5b6714[_0x4000('0x52')]-_0x45e756[0x0][_0x4000('0x1e4')];var _0x52a550=_0x5b6714[_0x4000('0x1d1')]*0x3c;var _0x5a3d80=_0x38e367[0x0][_0x4000('0x83')]+_0x38e367[0x0][_0x4000('0x6c')];var _0x302677=(_0x38e367[0x0][_0x4000('0x80')]+_0x38e367[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x38e367[0x0][_0x4000('0x6d')])/_0x38e367[0x0][_0x4000('0x72')];var _0x5d3273=_0x5b6714[_0x4000('0x1c6')]/0x64;_0x5b6714['predictiveIntervalPauses']=_0x45e756[0x0][_0x4000('0x1e4')]||0x0;_0x5b6714['predictiveIntervalHitRate']=_0x302677>0x0?_0x302677:0x1;return _0xa0cdff[_0x4000('0x1e5')](_0xce306a,_0x52a550,_0x5a3d80,_0x302677,_0x5d3273);})[_0x4000('0xb4')](function(_0x413477){return _0x33a7a0(_0x413477);})[_0x4000('0xad')](function(_0x3a6b67){return _0x25d574(msgResponse('[CatchErlangB]','Failure',JSON[_0x4000('0x49')](_0x3a6b67)));});}if(_0x5b6714[_0x4000('0x1d3')]===_0x4000('0x1e1')){return _0xa0cdff[_0x4000('0xc0')](_0x5b6714['id'])[_0x4000('0xb4')](function(_0x4d8c43){var _0x25eaa2=_0x5b6714[_0x4000('0x52')]-_0x4d8c43[0x0]['outboundQueuePauses'];var _0x2a15b0=_0x5b6714['dialPredictiveInterval']*0x3c;var _0x45083c=_0x38e367[0x0][_0x4000('0x83')]+_0x38e367[0x0][_0x4000('0x6c')];var _0x438b86=(_0x38e367[0x0][_0x4000('0x80')]+_0x38e367[0x0][_0x4000('0x6e')]+_0x38e367[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x38e367[0x0][_0x4000('0x72')];var _0x46b54b=_0x5b6714[_0x4000('0x1c6')]/0x64;_0x5b6714[_0x4000('0x1e6')]=_0x4d8c43[0x0][_0x4000('0x1e4')]||0x0;_0x5b6714[_0x4000('0x1cc')]=_0x438b86>0x0?_0x438b86:0x1;return _0xa0cdff['busyFactor'](_0x25eaa2,_0x2a15b0,_0x45083c,_0x438b86,_0x46b54b);})['then'](function(_0x560fe7){return _0x33a7a0(_0x560fe7);})['catch'](function(_0x1a16e4){return _0x25d574(msgResponse(_0x4000('0x1e7'),_0x4000('0x140'),JSON[_0x4000('0x49')](_0x1a16e4)));});}}else{return _0x25d574(msgResponse(_0x4000('0x1e8'),_0x4000('0x140'),_0x4000('0x1e3')));}});};};Dialer[_0x4000('0x1a')][_0x4000('0x1db')]=function(_0x2c5ade){var _0x2b54a4=this;return function(){var _0x91f3e3=0x0;var _0x29a3e9=Math[_0x4000('0x1ca')](_0x2c5ade['erlangCallToSecond']*0x3e8);if(_0x29a3e9>0x0){_0x29a3e9=_0x29a3e9<0x64?0x64:_0x29a3e9;loggerPredictive[_0x4000('0x7d')](_0x2c5ade['name'],'one\x20call\x20every:',_0x29a3e9,_0x4000('0x4a'));_0x2c5ade[_0x4000('0x90')]=setInterval(function(){_0x2b54a4[_0x4000('0x90')](_0x2c5ade);loggerPredictiveCalls['info']('[handlePredictive]',_0x91f3e3+=0x1);},_0x29a3e9);}else{loggerPredictive[_0x4000('0x7d')](_0x2c5ade[_0x4000('0x3e')],_0x4000('0x1e9'));}};};Dialer[_0x4000('0x1a')][_0x4000('0x1ea')]=function(_0x4ef758,_0x1eb0ec){var _0x350c22=this;return function(_0x4b8cb3){if(_[_0x4000('0x45')](_0x4b8cb3)){if(_[_0x4000('0xaa')](_0x1eb0ec[_0x4000('0xcc')])||!_0x1eb0ec[_0x4000('0x1eb')]){if(_0x4ef758['dialMethod']===_0x4000('0x9')){_0x4ef758['queueStatusComplete']=_['isUndefined'](_0x4ef758[_0x4000('0x12b')])?!![]:_0x4ef758[_0x4000('0x12b')];var _0x290ba3=uuid['v4']();_0x350c22['actions'][_0x290ba3]=new Action(_0x4ef758,_0x1eb0ec,_0x290ba3);loggerBooked['info'](_0x4000('0x1ec'),_0x290ba3,_0x4000('0x1ed'),JSON[_0x4000('0x49')](_0x4ef758[_0x4000('0x12b')]),_0x4000('0x1ee'),_0x4ef758[_0x4000('0x3e')]);if(_0x4ef758[_0x4000('0x12b')]){_0x4ef758[_0x4000('0x12b')]=![];_0x350c22[_0x4000('0x2b')][_0x350c22[_0x4000('0x24')][_0x290ba3]['queue']]=[];ami['Action']({'actionid':_0x290ba3,'action':'queuestatus','queue':_0x4ef758[_0x4000('0x3e')]})[_0x4000('0xad')](function(_0x52d616){_0x350c22[_0x4000('0xc6')](_0x4ef758);_0x350c22['rescheduleContact']({'active':![],'ContactId':_0x350c22['actions'][_0x290ba3][_0x4000('0xca')],'ListId':_0x350c22[_0x4000('0x24')][_0x290ba3][_0x4000('0xcb')],'VoiceQueueId':_0x350c22[_0x4000('0x24')][_0x290ba3][_0x4000('0xcd')]||undefined,'CampaignId':_0x350c22[_0x4000('0x24')][_0x290ba3][_0x4000('0xf6')]||undefined})[_0x4000('0xad')](loggerCatch(_0x4000('0x1ef')));delete _0x350c22[_0x4000('0x24')][_0x290ba3];});}else{loggerBooked[_0x4000('0x7d')](_0x4000('0x1f0'),JSON['stringify'](_0x4ef758[_0x4000('0x12b')]),'Queue:\x20',_0x4ef758[_0x4000('0x3e')]);_0x350c22[_0x4000('0xc6')](_0x4ef758);_0x350c22[_0x4000('0xf3')]({'active':![],'ContactId':_0x350c22[_0x4000('0x24')][_0x290ba3]['ContactId'],'ListId':_0x350c22[_0x4000('0x24')][_0x290ba3]['ListId'],'VoiceQueueId':_0x350c22['actions'][_0x290ba3][_0x4000('0xcd')]||undefined,'CampaignId':_0x350c22[_0x4000('0x24')][_0x290ba3][_0x4000('0xf6')]||undefined})['catch'](loggerCatch(_0x4000('0x1ef')));delete _0x350c22['actions'][_0x290ba3];}}else{return _0x350c22[_0x4000('0x163')](_0x4ef758,_0x1eb0ec);}}else{if(getDiff(_0x1eb0ec[_0x4000('0x1f1')])<_0x4ef758[_0x4000('0x1f2')]*0x3c){if(_0x1eb0ec[_0x4000('0x1f3')]&&!_0x1eb0ec[_0x4000('0x1f3')][_0x4000('0x1f4')]){_0x350c22[_0x4000('0x1e')][_0x4000('0x12d')](_0x1eb0ec['id'])[_0x4000('0x1c')](function(){_0x350c22['updateOriginated'](_0x4ef758);});}else{_0x350c22[_0x4000('0xbc')]({'active':![]},_0x1eb0ec['id'],0x1)[_0x4000('0x1c')](function(){console[_0x4000('0x1f5')](_0x4000('0x1f6'));_0x350c22[_0x4000('0xc6')](_0x4ef758);});}}else{_0x4ef758['outboundReCallsDay']+=0x1;_0x350c22[_0x4000('0xc6')](_0x4ef758);if(_0x4ef758[_0x4000('0x1f7')]){_0x350c22[_0x4000('0xf3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1eb0ec[_0x4000('0xca')],'ListId':_0x1eb0ec['ListId'],'VoiceQueueId':_0x1eb0ec[_0x4000('0xcd')]||undefined,'CampaignId':_0x1eb0ec[_0x4000('0xf6')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x350c22['createHistory'](createObjHistory(_0x4ef758,_0x1eb0ec,_0x4000('0x1f8'),0x17,_0x4000('0x1f9')))[_0x4000('0xad')](loggerCatch(_0x4000('0x1fa')));}else{_0x350c22[_0x4000('0xc9')](createObjHistory(_0x4ef758,_0x1eb0ec,'RECALLFAILEDTIMEOUT',0x16,_0x4000('0x1fb')),'[Originate][HistoryRecallClose][historyCatch]',_0x4000('0x1fc'));}}}}else{_0x4ef758[_0x4000('0x61')]+=0x1;_0x350c22[_0x4000('0xc9')](createObjHistory(_0x4ef758,_0x1eb0ec,_0x4000('0x1fd'),0xd,_0x4000('0x1fe')),_0x4000('0x1ff'),_0x4000('0x200'));throw'inBlackList';}};};Dialer[_0x4000('0x1a')][_0x4000('0x15a')]=function(_0x23ce80){var _0x486f11=this;var _0x4cb6d2=[];var _0x326263=_0x23ce80[_0x4000('0x201')]-_0x23ce80[_0x4000('0x73')]-_0x23ce80['temp'];emitCampaignSummary(_0x23ce80);if(_0x326263>0x0){if(_0x326263>this['maxNumberOriginate']){_0x326263=this[_0x4000('0x22')];}_0x23ce80[_0x4000('0x202')]+=_0x326263;this[_0x4000('0xbf')](_0x23ce80['id'],_0x326263,_0x23ce80['dialOrderByScheduledAt'])[_0x4000('0xb4')](function(_0x46ab6a){_0x23ce80[_0x4000('0x202')]-=_0x326263;_0x23ce80['temp']=_0x23ce80[_0x4000('0x202')]>0x0?_0x23ce80[_0x4000('0x202')]:0x0;if(!checkContactEmpty(_0x46ab6a)){_0x23ce80[_0x4000('0x42')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x4000('0x7d')](_0x4000('0x203')+_0x23ce80[_0x4000('0x3e')]);}else{_0x23ce80[_0x4000('0x73')]+=_0x46ab6a[_0x4000('0x98')];_0x23ce80[_0x4000('0x42')]=_0x4000('0x204');for(var _0x5018fe=0x0;_0x5018fe<_0x46ab6a[_0x4000('0x98')];_0x5018fe+=0x1){_0x23ce80[_0x4000('0x205')]+=0x1;if(_[_0x4000('0xaa')](_0x46ab6a[_0x5018fe])||_['isNil'](_0x46ab6a[_0x5018fe][_0x4000('0x167')])||_['isNil'](_0x46ab6a[_0x5018fe][_0x4000('0x167')][_0x4000('0x168')])){_0x486f11[_0x4000('0xc7')](_0x4000('0x206'),_0x23ce80,_0x46ab6a[_0x5018fe]);}else{_0x486f11['checkIsBlackListIvr'](_[_0x4000('0x127')](_0x46ab6a[_0x5018fe],['CampaignId',_0x4000('0x207')]))[_0x4000('0xb4')](_0x486f11['checkContactBlack'](_0x23ce80,_0x46ab6a[_0x5018fe]))['catch'](_0x486f11[_0x4000('0x208')](_0x4000('0x209'),_0x23ce80));}}}})[_0x4000('0xad')](loggerGetContactDialer(_0x4000('0x20a'),_0x23ce80,_0x326263));}};Dialer[_0x4000('0x1a')][_0x4000('0x154')]=function(_0xd4c86,_0x11433c){var _0x5ebd5c=this;var _0x26f628=[];var _0x31abb5=_0x11433c>=0x1?_0x11433c:0x1;var _0x3b6c0d=[];if(_0xd4c86[_0x4000('0x5c')]===_0x4000('0x9')){_0x31abb5=0x1;}var _0x49cdbb=Math[_0x4000('0x1ca')](_0xd4c86[_0x4000('0x51')]*_0x31abb5)-_0xd4c86['originated']-_0xd4c86[_0x4000('0x202')];emitVoiceQueueSummary(_0xd4c86);if(_0xd4c86[_0x4000('0x20b')]>0x0){var _0x4fc664=_0xd4c86[_0x4000('0x20b')]-_0xd4c86['originated']-_0xd4c86['talking']-_0xd4c86[_0x4000('0x202')]-_0xd4c86[_0x4000('0x53')];if(_0x49cdbb>_0x4fc664){_0x49cdbb=_0x4fc664;}}if(_0x49cdbb>0x0){if(_0xd4c86[_0x4000('0x5c')]===_0x4000('0x9')){_0x49cdbb=0x1;}if(_0x49cdbb>this[_0x4000('0x22')]){_0x49cdbb=this[_0x4000('0x22')];}_0xd4c86[_0x4000('0x202')]+=_0x49cdbb;for(var _0x421059 in this['agents']){if(this[_0x4000('0x125')][_0x4000('0xa9')](_0x421059)){if(this[_0x4000('0x125')][_0x421059][_0x4000('0xa5')]==='not_inuse'&&this[_0x4000('0x125')][_0x421059][_0x4000('0xab')]==='reachable'){_0x26f628['push'](this[_0x4000('0x125')][_0x421059]['id']);}}}this[_0x4000('0xbd')](_0xd4c86['id'],_0x26f628,_0x49cdbb,_0xd4c86[_0x4000('0x20c')])[_0x4000('0xb4')](function(_0x39d2a7){_0xd4c86[_0x4000('0x202')]-=_0x49cdbb;_0xd4c86['temp']=_0xd4c86[_0x4000('0x202')]>0x0?_0xd4c86[_0x4000('0x202')]:0x0;if(!checkContactEmpty(_0x39d2a7)){_0x5ebd5c['countReScheduled'](_0xd4c86)[_0x4000('0xb4')](sendMessageReschedule(_0xd4c86))[_0x4000('0xad')](loggerCatch(_0x4000('0xb5')));}else{_0xd4c86[_0x4000('0x73')]+=_0x39d2a7['length'];_0xd4c86['message']=_0xd4c86['dialMethod']==='booked'?_0x4000('0x170'):_0x4000('0x204');for(var _0x1f01bb=0x0;_0x1f01bb<_0x39d2a7[_0x4000('0x98')];_0x1f01bb+=0x1){if(_[_0x4000('0xaa')](_0x39d2a7[_0x1f01bb])||_[_0x4000('0xaa')](_0x39d2a7[_0x1f01bb]['Contact'])||_[_0x4000('0xaa')](_0x39d2a7[_0x1f01bb][_0x4000('0x167')][_0x4000('0x168')])){_0x5ebd5c['emptyContact'](_0x4000('0x206'),_0xd4c86,_0x39d2a7[_0x1f01bb]);}else{_0x5ebd5c['checkIsBlackList'](_['pick'](_0x39d2a7[_0x1f01bb],[_0x4000('0xcd'),_0x4000('0x207')]))[_0x4000('0xb4')](_0x5ebd5c['checkContactBlack'](_0xd4c86,_0x39d2a7[_0x1f01bb]))['catch'](_0x5ebd5c[_0x4000('0x208')]('[actionOriginate]\x20',_0xd4c86));}}}})[_0x4000('0xad')](loggerGetContactDialer(_0x4000('0x20d'),_0xd4c86,_0x49cdbb));}};Dialer[_0x4000('0x1a')][_0x4000('0x90')]=function(_0x11d934){var _0x5c6e52=this;if(_0x11d934[_0x4000('0x20b')]>0x0){var _0x46221d=_0x11d934[_0x4000('0x20b')]-_0x11d934[_0x4000('0x73')]-_0x11d934[_0x4000('0x55')];if(_0x46221d>0x0){this[_0x4000('0x20e')](_0x11d934);}else{loggerPredictiveCalls[_0x4000('0x7d')](_0x4000('0x20f'));}}else{this[_0x4000('0x20e')](_0x11d934);}};Dialer[_0x4000('0x1a')][_0x4000('0x20e')]=function(_0x495ad1){var _0x19035e=this;var _0x4cbf82=[];_0x495ad1[_0x4000('0x73')]+=0x1;for(var _0x167734 in this[_0x4000('0x125')]){if(this[_0x4000('0x125')][_0x4000('0xa9')](_0x167734)){if(this['agents'][_0x167734][_0x4000('0xa5')]===_0x4000('0x210')&&this[_0x4000('0x125')][_0x167734][_0x4000('0xab')]==='reachable'){_0x4cbf82[_0x4000('0x126')](this[_0x4000('0x125')][_0x167734]['id']);}}}this[_0x4000('0xbd')](_0x495ad1['id'],_0x4cbf82,0x1,_0x495ad1[_0x4000('0x20c')])[_0x4000('0xb4')](function(_0xd3057a){if(!checkContactEmpty(_0xd3057a)){checkContactLowerLimitOriginate(_0x495ad1,0x1,0x0);_0x19035e[_0x4000('0xb2')](_0x495ad1)[_0x4000('0xb4')](sendMessageReschedule(_0x495ad1))['catch'](loggerCatch(_0x4000('0xb5')));}else{_0x495ad1['message']=_0x4000('0x204');if(_[_0x4000('0xaa')](_0xd3057a[0x0])||_[_0x4000('0xaa')](_0xd3057a[0x0][_0x4000('0x167')])||_['isNil'](_0xd3057a[0x0][_0x4000('0x167')][_0x4000('0x168')])){_0x19035e[_0x4000('0xc7')](_0x4000('0x206'),_0x495ad1,_0xd3057a[0x0]);}else{_0x19035e[_0x4000('0xb6')](_[_0x4000('0x127')](_0xd3057a[0x0],[_0x4000('0xcd'),_0x4000('0x207')]))[_0x4000('0xb4')](_0x19035e[_0x4000('0x1ea')](_0x495ad1,_0xd3057a[0x0]))[_0x4000('0xad')](_0x19035e['loggerHandler']('[actionOriginatePredictive]\x20',_0x495ad1));}}})[_0x4000('0xad')](loggerGetContactDialer('[getContactDialerPredictive]',_0x495ad1,0x1));emitVoiceQueueSummary(_0x495ad1);};Dialer[_0x4000('0x1a')]['abandonmentRate']=function(_0x386981,_0x2e3e81,_0x1d4878,_0x53d30a,_0x14d23c,_0x536ac0){loggerPredictive[_0x4000('0x7d')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x4000('0x7d')]('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',_0x386981);loggerPredictive[_0x4000('0x7d')](_0x4000('0x211'),_0x2e3e81);loggerPredictive[_0x4000('0x7d')](_0x4000('0x212'),_0x1d4878);loggerPredictive[_0x4000('0x7d')](_0x4000('0x213'),_0x53d30a);loggerPredictive[_0x4000('0x7d')](_0x4000('0x214'),_0x14d23c);loggerPredictive[_0x4000('0x7d')]('---------------------------');return new BPromise(function(_0x43ac46,_0x4ba553){if(_0x386981<=0x0||isNaN(_0x386981)){return _0x4ba553(msgResponse('[abandonmentRate]',_0x4000('0x48'),_0x4000('0x215')+_0x386981));}if(_0x1d4878<=0x0||isNaN(_0x1d4878)){return _0x4ba553(msgResponse(_0x4000('0x216'),'Error',_0x4000('0x217')+_0x1d4878));}if(_0x53d30a<=0x0||isNaN(_0x53d30a)){return _0x4ba553(msgResponse(_0x4000('0x216'),_0x4000('0x48'),'p\x20=\x20'+_0x53d30a));}if(_0x2e3e81<=0x0||isNaN(_0x2e3e81)){return _0x4ba553(msgResponse(_0x4000('0x216'),_0x4000('0x48'),'interval\x20=\x20'+_0x2e3e81));}if(_0x14d23c<=0x0||isNaN(_0x14d23c)){return _0x4ba553(msgResponse(_0x4000('0x216'),_0x4000('0x48'),_0x4000('0x218')+_0x14d23c));}_0x536ac0=_0x536ac0||0x0;var _0x4f310c=0x1/_0x1d4878;var _0x1d28b8=0x0;var _0x247e80=0x0;var _0x2659ee=0x0;var _0x2dacc=0x0;for(var _0x1d459a=0x0;_0x2659ee<_0x14d23c;_0x1d459a+=0x1){_0x247e80=_0x1d459a/_0x2e3e81;_0x1d28b8=(_0x53d30a*_0x247e80+_0x536ac0)/_0x4f310c;_0x2659ee=erlangb(_0x1d28b8,_0x386981);_0x2dacc=_0x1d28b8/_0x386981*(0x1-erlangb(_0x1d28b8,_0x386981));}return _0x43ac46({'erlangCalls':_0x1d459a,'erlangCallToSecond':_0x2e3e81/_0x1d459a,'erlangAbandonmentRate':_0x2659ee,'erlangBusyFactor':_0x2dacc});});};Dialer['prototype'][_0x4000('0x1e2')]=function(_0x5e6237,_0x2fb495,_0x425ab0,_0x38cd51,_0x3eb94f,_0x4a5fdd){loggerPredictive[_0x4000('0x7d')](_0x4000('0x219'));loggerPredictive[_0x4000('0x7d')](_0x4000('0x21a'),_0x5e6237);loggerPredictive[_0x4000('0x7d')](_0x4000('0x211'),_0x2fb495);loggerPredictive[_0x4000('0x7d')](_0x4000('0x212'),_0x425ab0);loggerPredictive[_0x4000('0x7d')](_0x4000('0x213'),_0x38cd51);loggerPredictive[_0x4000('0x7d')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3eb94f);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x4a6eac,_0x4f559b){if(_0x5e6237<=0x0||isNaN(_0x5e6237)){return _0x4f559b(msgResponse(_0x4000('0x21b'),_0x4000('0x48'),_0x4000('0x215')+_0x5e6237));}if(_0x425ab0<=0x0||isNaN(_0x425ab0)){return _0x4f559b(msgResponse(_0x4000('0x21b'),_0x4000('0x48'),_0x4000('0x217')+_0x425ab0));}if(_0x38cd51<=0x0||isNaN(_0x38cd51)){return _0x4f559b(msgResponse(_0x4000('0x21b'),_0x4000('0x48'),_0x4000('0x21c')+_0x38cd51));}if(_0x2fb495<=0x0||isNaN(_0x2fb495)){return _0x4f559b(msgResponse('[busyFactor]',_0x4000('0x48'),_0x4000('0x21d')+_0x2fb495));}if(_0x3eb94f<=0x0||isNaN(_0x3eb94f)){return _0x4f559b(msgResponse(_0x4000('0x21b'),_0x4000('0x48'),_0x4000('0x21e')+_0x3eb94f));}_0x4a5fdd=_0x4a5fdd||0x0;var _0x568907=0x1/_0x425ab0;var _0x414a1e=0x0;var _0xd069c6=0x0;var _0x4ff63b=0x0;var _0x4326d8=0x0;for(var _0x843cce=0x0;_0x4326d8<_0x3eb94f;_0x843cce+=0x1){_0xd069c6=_0x843cce/_0x2fb495;_0x414a1e=(_0x38cd51*_0xd069c6+_0x4a5fdd)/_0x568907;_0x4ff63b=erlangb(_0x414a1e,_0x5e6237);_0x4326d8=_0x414a1e/_0x5e6237*(0x1-erlangb(_0x414a1e,_0x5e6237));}return _0x4a6eac({'erlangCalls':_0x843cce,'erlangCallToSecond':_0x2fb495/_0x843cce,'erlangAbandonmentRate':_0x4ff63b,'erlangBusyFactor':_0x4326d8});});};module[_0x4000('0x21f')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 36d75b1..5c08b9c 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 _0x7bcd=['endtime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime'];(function(_0x1c75ae,_0x2650e6){var _0x12cc39=function(_0x3ea4c2){while(--_0x3ea4c2){_0x1c75ae['push'](_0x1c75ae['shift']());}};_0x12cc39(++_0x2650e6);}(_0x7bcd,0x139));var _0xd7bc=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x7bcd[_0x12bcf7];return _0x2825a;};'use strict';var util=require(_0xd7bc('0x0'));var _=require('lodash');var moment=require(_0xd7bc('0x1'));function getSeconds(_0x884680,_0x4d8439){var _0x1a0808=moment(_0x884680)[_0xd7bc('0x2')](0x0);var _0x24340e=moment(_0x4d8439)[_0xd7bc('0x2')](0x0);return _0x1a0808[_0xd7bc('0x3')](_0x24340e,_0xd7bc('0x4'));}function QueueCallerAbandon(_0x76a88b,_0x36af90){this[_0xd7bc('0x5')]=_0x76a88b['scheduledat'];this[_0xd7bc('0x6')]=_0x76a88b[_0xd7bc('0x6')];this[_0xd7bc('0x7')]=_0x76a88b['type']==='outbound'?_0xd7bc('0x8'):_0x76a88b[_0xd7bc('0x6')];this[_0xd7bc('0x9')]=_0x76a88b['countbusyretry'];this['countcongestionretry']=_0x76a88b[_0xd7bc('0xa')];this[_0xd7bc('0xb')]=_0x76a88b[_0xd7bc('0xb')];this[_0xd7bc('0xc')]=_0x76a88b['countbusyretry']+_0x76a88b[_0xd7bc('0xa')]+_0x76a88b[_0xd7bc('0xb')]+_0x76a88b[_0xd7bc('0xd')]+_0x76a88b[_0xd7bc('0xe')]+_0x76a88b[_0xd7bc('0xf')]+_0x76a88b[_0xd7bc('0x10')]+_0x76a88b[_0xd7bc('0x11')];this[_0xd7bc('0xd')]=_0x76a88b[_0xd7bc('0xd')];this['countdropretry']=_0x76a88b[_0xd7bc('0xe')];this['countabandonedretry']=_0x76a88b[_0xd7bc('0xf')];this[_0xd7bc('0x10')]=_0x76a88b[_0xd7bc('0x10')];this[_0xd7bc('0x11')]=_0x76a88b[_0xd7bc('0x11')];this['uniqueid']=_0x36af90['uniqueid'];this[_0xd7bc('0x12')]=_0x76a88b[_0xd7bc('0x13')];this['calleridnum']=_0x76a88b[_0xd7bc('0x14')];this[_0xd7bc('0x15')]=_0x76a88b['starttime'];this[_0xd7bc('0x16')]=_0x76a88b[_0xd7bc('0x16')];this['droptime']=_0x76a88b['droptime'];this[_0xd7bc('0x17')]=this[_0xd7bc('0x18')];this[_0xd7bc('0x19')]=getSeconds(_0x76a88b['responsetime'],_0x76a88b[_0xd7bc('0x15')]);this[_0xd7bc('0x1a')]=getSeconds(this[_0xd7bc('0x18')],_0x76a88b[_0xd7bc('0x16')]);this[_0xd7bc('0x1b')]=0x0;this['queue']=_0x36af90[_0xd7bc('0x8')];this[_0xd7bc('0x1c')]=_0x36af90[_0xd7bc('0x1d')];this[_0xd7bc('0x1e')]=_0x36af90[_0xd7bc('0x1e')];this[_0xd7bc('0x1f')]=_0x76a88b['callback'];this[_0xd7bc('0x20')]=_0x76a88b[_0xd7bc('0x20')];this['callbackat']=_0x76a88b[_0xd7bc('0x21')];this[_0xd7bc('0x22')]=_0x76a88b[_0xd7bc('0x22')];this[_0xd7bc('0x23')]=_0x76a88b[_0xd7bc('0x23')];this[_0xd7bc('0x24')]=_0x76a88b['ListId'];this[_0xd7bc('0x25')]=_0x76a88b[_0xd7bc('0x25')];this[_0xd7bc('0x26')]=_0x76a88b[_0xd7bc('0x26')];this[_0xd7bc('0x27')]=_0x76a88b[_0xd7bc('0x27')];this['originatecalleridnum']=_0x76a88b[_0xd7bc('0x28')]||'';this['originatecalleridname']=_0x76a88b['originatecalleridname']||'';}module[_0xd7bc('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x9812=['scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds'];(function(_0xe22b04,_0x5f3a77){var _0x2ebd8d=function(_0x2572fe){while(--_0x2572fe){_0xe22b04['push'](_0xe22b04['shift']());}};_0x2ebd8d(++_0x5f3a77);}(_0x9812,0x1b4));var _0x2981=function(_0x350945,_0xfffbfa){_0x350945=_0x350945-0x0;var _0x1c72d7=_0x9812[_0x350945];return _0x1c72d7;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x2981('0x0'));function getSeconds(_0x24e57c,_0x25aeb2){var _0xf92a5b=moment(_0x24e57c)[_0x2981('0x1')](0x0);var _0x488dbc=moment(_0x25aeb2)[_0x2981('0x1')](0x0);return _0xf92a5b[_0x2981('0x2')](_0x488dbc,_0x2981('0x3'));}function QueueCallerAbandon(_0x54218c,_0x2b90aa){this[_0x2981('0x4')]=_0x54218c['scheduledat'];this[_0x2981('0x5')]=_0x54218c[_0x2981('0x5')];this[_0x2981('0x6')]=_0x54218c[_0x2981('0x5')]===_0x2981('0x7')?_0x2981('0x8'):_0x54218c[_0x2981('0x5')];this['countbusyretry']=_0x54218c['countbusyretry'];this[_0x2981('0x9')]=_0x54218c[_0x2981('0x9')];this['countnoanswerretry']=_0x54218c['countnoanswerretry'];this[_0x2981('0xa')]=_0x54218c['countbusyretry']+_0x54218c[_0x2981('0x9')]+_0x54218c[_0x2981('0xb')]+_0x54218c[_0x2981('0xc')]+_0x54218c[_0x2981('0xd')]+_0x54218c['countabandonedretry']+_0x54218c[_0x2981('0xe')]+_0x54218c[_0x2981('0xf')];this[_0x2981('0xc')]=_0x54218c[_0x2981('0xc')];this[_0x2981('0xd')]=_0x54218c[_0x2981('0xd')];this['countabandonedretry']=_0x54218c[_0x2981('0x10')];this[_0x2981('0xe')]=_0x54218c[_0x2981('0xe')];this[_0x2981('0xf')]=_0x54218c['countagentrejectretry'];this[_0x2981('0x11')]=_0x2b90aa['uniqueid'];this['calleridname']=_0x54218c['name'];this['calleridnum']=_0x54218c['number'];this[_0x2981('0x12')]=_0x54218c['starttime'];this[_0x2981('0x13')]=_0x54218c[_0x2981('0x13')];this[_0x2981('0x14')]=_0x54218c[_0x2981('0x14')];this[_0x2981('0x15')]=this[_0x2981('0x14')];this[_0x2981('0x16')]=getSeconds(_0x54218c[_0x2981('0x13')],_0x54218c[_0x2981('0x12')]);this[_0x2981('0x17')]=getSeconds(this[_0x2981('0x14')],_0x54218c[_0x2981('0x13')]);this[_0x2981('0x18')]=0x0;this[_0x2981('0x8')]=_0x2b90aa[_0x2981('0x8')];this[_0x2981('0x19')]=_0x2b90aa[_0x2981('0x1a')];this[_0x2981('0x1b')]=_0x2b90aa[_0x2981('0x1b')];this[_0x2981('0x1c')]=_0x54218c[_0x2981('0x1c')];this[_0x2981('0x1d')]=_0x54218c[_0x2981('0x1d')];this[_0x2981('0x1e')]=_0x54218c[_0x2981('0x1e')];this['recallme']=_0x54218c[_0x2981('0x1f')];this['ContactId']=_0x54218c[_0x2981('0x20')];this[_0x2981('0x21')]=_0x54218c[_0x2981('0x21')];this[_0x2981('0x22')]=_0x54218c[_0x2981('0x22')];this['VoiceQueueId']=_0x54218c[_0x2981('0x23')];this[_0x2981('0x24')]=_0x54218c[_0x2981('0x24')];this[_0x2981('0x25')]=_0x54218c['originatecalleridnum']||'';this[_0x2981('0x26')]=_0x54218c[_0x2981('0x26')]||'';}module[_0x2981('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 364f36b..6cbe745 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 _0x6912=['AttachmentId','exports','lodash','moment','uniqueid','channel','format','%s/%s/%s','Trunk','name','fax','localstationid','headerinfo','path'];(function(_0x196782,_0x515df1){var _0x3cbb13=function(_0x7be9ba){while(--_0x7be9ba){_0x196782['push'](_0x196782['shift']());}};_0x3cbb13(++_0x515df1);}(_0x6912,0x1ec));var _0x2691=function(_0x500440,_0x1d2a1e){_0x500440=_0x500440-0x0;var _0x180971=_0x6912[_0x500440];return _0x180971;};'use strict';var util=require('util');var _=require(_0x2691('0x0'));var moment=require(_0x2691('0x1'));function Action(_0x2ed6db,_0x2f85e7,_0x5ba92b){this[_0x2691('0x2')]=_0x2ed6db||undefined;this[_0x2691('0x3')]=util[_0x2691('0x4')](_0x2691('0x5'),_0x2f85e7['tech'],_0x2f85e7[_0x2691('0x6')][_0x2691('0x7')],_0x5ba92b[_0x2691('0x8')]);this['localstationid']=_0x2f85e7[_0x2691('0x9')];this[_0x2691('0xa')]=_0x2f85e7[_0x2691('0xa')];this[_0x2691('0xb')]=_0x5ba92b['path'];this[_0x2691('0xc')]=_0x5ba92b['AttachmentId'];}module[_0x2691('0xd')]=Action; \ No newline at end of file +var _0x962f=['localstationid','path','AttachmentId','exports','util','lodash','uniqueid','format','%s/%s/%s','Trunk','name','fax'];(function(_0x59a53a,_0x3865ff){var _0x891a8d=function(_0xde67a1){while(--_0xde67a1){_0x59a53a['push'](_0x59a53a['shift']());}};_0x891a8d(++_0x3865ff);}(_0x962f,0x70));var _0xf962=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x962f[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xf962('0x0'));var _=require(_0xf962('0x1'));var moment=require('moment');function Action(_0x481808,_0x21af7c,_0x3ef819){this[_0xf962('0x2')]=_0x481808||undefined;this['channel']=util[_0xf962('0x3')](_0xf962('0x4'),_0x21af7c['tech'],_0x21af7c[_0xf962('0x5')][_0xf962('0x6')],_0x3ef819[_0xf962('0x7')]);this[_0xf962('0x8')]=_0x21af7c['localstationid'];this['headerinfo']=_0x21af7c['headerinfo'];this['path']=_0x3ef819[_0xf962('0x9')];this[_0xf962('0xa')]=_0x3ef819[_0xf962('0xa')];}module[_0xf962('0xb')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 4ec2d7d..76e4c12 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 _0xbe6c=['newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','fax','.pdf','catch','error','\x20notify\x20','stringify','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','faxpages','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Action','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbe6c,0x1be));var _0xcbe6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xbe6c[_0x1694f5];return _0x5b4321;};'use strict';var util=require(_0xcbe6('0x0'));var _=require(_0xcbe6('0x1'));var BPromise=require(_0xcbe6('0x2'));var uuid=require('uuid');var moment=require(_0xcbe6('0x3'));var path=require(_0xcbe6('0x4'));var tiff2pdf=require(_0xcbe6('0x5'));var gs=require(_0xcbe6('0x6'));var logger=require(_0xcbe6('0x7'))('fax');var ami=require(_0xcbe6('0x8'));var rpcDb=require(_0xcbe6('0x9'));var Channel=require('./channel');var ut=require(_0xcbe6('0xa'));var Action=require('./action');var faxAccount=require(_0xcbe6('0xb'));var attachment=require(_0xcbe6('0xc'));var faxMessage=require(_0xcbe6('0xd'));function Fax(_0xde4c19){this[_0xcbe6('0xe')]={};this[_0xcbe6('0xf')]=_0xde4c19[_0xcbe6('0xf')];this[_0xcbe6('0x10')]=_0xde4c19[_0xcbe6('0x10')];this[_0xcbe6('0x11')]={};ami['on'](_0xcbe6('0x12'),this[_0xcbe6('0x13')][_0xcbe6('0x14')](this));ami['on'](_0xcbe6('0x15'),this['syncVarSet'][_0xcbe6('0x14')](this));ami['on'](_0xcbe6('0x16'),this[_0xcbe6('0x17')]['bind'](this));ami['on'](_0xcbe6('0x18'),this[_0xcbe6('0x19')][_0xcbe6('0x14')](this));ami['on'](_0xcbe6('0x1a'),this['syncFaxStatus'][_0xcbe6('0x14')](this));ami['on'](_0xcbe6('0x1b'),this['syncReceiveFax'][_0xcbe6('0x14')](this));ami['on']('hangup',this[_0xcbe6('0x1c')][_0xcbe6('0x14')](this));ami['on'](_0xcbe6('0x1d'),this[_0xcbe6('0x1e')][_0xcbe6('0x14')](this));}Fax[_0xcbe6('0x1f')][_0xcbe6('0x13')]=function(_0x5f40b0){if(_0x5f40b0[_0xcbe6('0x20')]==='from-voip-provider'){for(var _0x1e6a46 in this['faxAccounts']){if(this[_0xcbe6('0xf')]['hasOwnProperty'](_0x1e6a46)){if(_0x5f40b0[_0xcbe6('0x21')]===this[_0xcbe6('0xf')][_0x1e6a46][_0xcbe6('0x22')]){this[_0xcbe6('0xe')][_0x5f40b0['uniqueid']]={};this[_0xcbe6('0xe')][_0x5f40b0[_0xcbe6('0x23')]][_0xcbe6('0x24')]=_0x5f40b0[_0xcbe6('0x24')];this['channels'][_0x5f40b0[_0xcbe6('0x23')]]['id']=this['faxAccounts'][_0x1e6a46]['id'];this[_0xcbe6('0xe')][_0x5f40b0[_0xcbe6('0x23')]][_0xcbe6('0x25')]=this[_0xcbe6('0xf')][_0x1e6a46][_0xcbe6('0x25')];logger[_0xcbe6('0x26')](_0x5f40b0['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x5f40b0[_0xcbe6('0x23')]]){this[_0xcbe6('0xe')][_0x5f40b0[_0xcbe6('0x23')]]={};this[_0xcbe6('0xe')][_0x5f40b0[_0xcbe6('0x23')]]['channel']=_0x5f40b0[_0xcbe6('0x24')];logger[_0xcbe6('0x26')](_0x5f40b0[_0xcbe6('0x23')],_0xcbe6('0x27'));}};Fax[_0xcbe6('0x1f')]['syncVarSet']=function(_0x244065){if(this[_0xcbe6('0xe')][_0x244065[_0xcbe6('0x23')]]){for(var _0x374aa1 in _0x244065['variable']){if(_0x244065[_0xcbe6('0x28')][_0xcbe6('0x29')](_0x374aa1)){this['channels'][_0x244065['uniqueid']][_0x374aa1]=_0x244065['value'];}}}};Fax[_0xcbe6('0x1f')][_0xcbe6('0x17')]=function(_0x547e43){if(this[_0xcbe6('0xe')][_0x547e43[_0xcbe6('0x23')]]){this[_0xcbe6('0xe')][_0x547e43['uniqueid']][_0xcbe6('0x2a')]=_0x547e43[_0xcbe6('0x2a')];this['channels'][_0x547e43[_0xcbe6('0x23')]]['channelstatedesc']=_0x547e43[_0xcbe6('0x2b')];}};Fax[_0xcbe6('0x1f')][_0xcbe6('0x19')]=function(_0x1af2bd){if(this[_0xcbe6('0xe')][_0x1af2bd[_0xcbe6('0x23')]]){for(var _0x2bfc54 in _0x1af2bd['variable']){if(_0x1af2bd[_0xcbe6('0x28')][_0xcbe6('0x29')](_0x2bfc54)){this[_0xcbe6('0xe')][_0x1af2bd[_0xcbe6('0x23')]][_0x2bfc54]=_0x1af2bd[_0xcbe6('0x2c')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x54b9e7){if(this[_0xcbe6('0xe')][_0x54b9e7[_0xcbe6('0x23')]]){this['channels'][_0x54b9e7[_0xcbe6('0x23')]][_0xcbe6('0x2d')]=_0x54b9e7[_0xcbe6('0x2d')];this[_0xcbe6('0xe')][_0x54b9e7['uniqueid']][_0xcbe6('0x2e')]=_0x54b9e7[_0xcbe6('0x2e')];this[_0xcbe6('0xe')][_0x54b9e7['uniqueid']]['localstationid']=_0x54b9e7['localstationid'];this['channels'][_0x54b9e7[_0xcbe6('0x23')]][_0xcbe6('0x2f')]=_0x54b9e7[_0xcbe6('0x2f')];logger[_0xcbe6('0x26')](_0x54b9e7[_0xcbe6('0x23')],_0xcbe6('0x30'));}};Fax['prototype'][_0xcbe6('0x31')]=function(_0x307b0f){var _0x56b430=this;if(this[_0xcbe6('0xe')][_0x307b0f[_0xcbe6('0x23')]]){var _0x157311=this['channels'][_0x307b0f['uniqueid']]['id'];this[_0xcbe6('0xe')][_0x307b0f[_0xcbe6('0x23')]][_0xcbe6('0x32')]=_0x307b0f[_0xcbe6('0x32')];this[_0xcbe6('0xe')][_0x307b0f['uniqueid']]['pagestransferred']=_0x307b0f['pagestransferred'];this[_0xcbe6('0xe')][_0x307b0f['uniqueid']]['localstationid']=_0x307b0f['localstationid'];this[_0xcbe6('0xe')][_0x307b0f['uniqueid']][_0xcbe6('0x33')]=_0x307b0f[_0xcbe6('0x33')];this['channels'][_0x307b0f[_0xcbe6('0x23')]]['transferrate']=_0x307b0f[_0xcbe6('0x34')];this['channels'][_0x307b0f[_0xcbe6('0x23')]][_0xcbe6('0x2f')]=_0x307b0f[_0xcbe6('0x2f')];this[_0xcbe6('0xe')][_0x307b0f[_0xcbe6('0x23')]][_0xcbe6('0x35')]=_0x307b0f[_0xcbe6('0x35')];if(this[_0xcbe6('0xe')][_0x307b0f[_0xcbe6('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x307b0f[_0xcbe6('0x2f')],_0xcbe6('0x36'),function(_0xf673){logger[_0xcbe6('0x26')](_0x307b0f['uniqueid'],_0xcbe6('0x37'),_0xf673[_0xcbe6('0x38')]);attachment[_0xcbe6('0x39')]({'name':path[_0xcbe6('0x3a')](_0x307b0f[_0xcbe6('0x2f')])[_0xcbe6('0x25')],'basename':path[_0xcbe6('0x3a')](_0x307b0f[_0xcbe6('0x2f')])[_0xcbe6('0x25')]+'.pdf','type':_0xcbe6('0x3b')})[_0xcbe6('0x3c')](function(_0x18c90e){faxAccount[_0xcbe6('0x3d')](_0x157311,{'from':_0x307b0f[_0xcbe6('0x35')],'mapKey':_0xcbe6('0x3e'),'body':path['parse'](_0x307b0f[_0xcbe6('0x2f')])[_0xcbe6('0x25')]+_0xcbe6('0x3f'),'AttachmentId':_0x18c90e['id']})[_0xcbe6('0x40')](function(_0x23e36e){logger[_0xcbe6('0x41')](_0x307b0f[_0xcbe6('0x23')],_0xcbe6('0x42'),JSON[_0xcbe6('0x43')](_0x23e36e));});})[_0xcbe6('0x40')](function(_0x292173){logger[_0xcbe6('0x41')](_0x307b0f['uniqueid'],'\x20receiveFax\x20',JSON['stringify'](_0x292173));});});}logger['info'](_0x307b0f[_0xcbe6('0x23')],'\x20receiveFax\x20');}};Fax['prototype'][_0xcbe6('0x1e')]=function(_0x43fd1c){if(this[_0xcbe6('0x11')][_0x43fd1c[_0xcbe6('0x23')]]){_[_0xcbe6('0x44')](this[_0xcbe6('0xe')][_0x43fd1c[_0xcbe6('0x23')]],_[_0xcbe6('0x45')](_0x43fd1c,[_0xcbe6('0x46'),'reason']));}};function updateStatus(_0x2986df){if(_0x2986df[_0xcbe6('0x47')]){faxMessage['update'](_0x2986df[_0xcbe6('0x47')],{'failMessage':_0xcbe6('0x48')})[_0xcbe6('0x3c')](function(_0x1e54ec){ut[_0xcbe6('0x49')](_0xcbe6('0x4a'),_0x1e54ec);})[_0xcbe6('0x40')](function(_0x37f342){ut['logger'](_0xcbe6('0x4b'),_0x37f342);});}else{ut[_0xcbe6('0x49')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xcbe6('0x1f')]['updateStatus']=function(_0x4cbdbc,_0x454f9e,_0x9a1acc){var _0x32d111=this;var _0x1fa923={};if(_0x454f9e){_0x1fa923={'read':_0x454f9e};}else{_0x1fa923={'failMessage':_0x9a1acc};}if(this[_0xcbe6('0x11')][_0x4cbdbc]['AttachmentId']){faxMessage[_0xcbe6('0x4c')](this[_0xcbe6('0x11')][_0x4cbdbc][_0xcbe6('0x47')],_0x1fa923)[_0xcbe6('0x3c')](function(_0x2f0817){ut[_0xcbe6('0x49')](_0xcbe6('0x4d'),_0x2f0817);})['catch'](function(_0xddc13a){ut[_0xcbe6('0x49')](_0xcbe6('0x4e'),_0xddc13a);})[_0xcbe6('0x4f')](function(){delete _0x32d111['channels'][_0x4cbdbc];delete _0x32d111[_0xcbe6('0x11')][_0x4cbdbc];});}else{ut[_0xcbe6('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0xcbe6('0xe')][_0x4cbdbc];delete this[_0xcbe6('0x11')][_0x4cbdbc];}};Fax[_0xcbe6('0x1f')][_0xcbe6('0x1c')]=function(_0x420319){var _0x24746b=this;if(this[_0xcbe6('0xe')][_0x420319[_0xcbe6('0x23')]]){if(this['actions'][_0x420319[_0xcbe6('0x23')]]){this['channels'][_0x420319[_0xcbe6('0x23')]]['id']=this[_0xcbe6('0x11')][_0x420319[_0xcbe6('0x23')]]['id'];this[_0xcbe6('0xe')][_0x420319['uniqueid']][_0xcbe6('0x25')]=this[_0xcbe6('0x11')][_0x420319['uniqueid']][_0xcbe6('0x25')];}logger[_0xcbe6('0x26')](_0x420319['uniqueid'],this[_0xcbe6('0x11')][_0x420319[_0xcbe6('0x23')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this['channels'][_0x420319['uniqueid']]));if(this[_0xcbe6('0x11')][_0x420319[_0xcbe6('0x23')]]){if(this[_0xcbe6('0xe')][_0x420319[_0xcbe6('0x23')]][_0xcbe6('0x50')]>0x0&&this[_0xcbe6('0xe')][_0x420319[_0xcbe6('0x23')]][_0xcbe6('0x1a')]===_0xcbe6('0x51')){this[_0xcbe6('0x52')](_0x420319[_0xcbe6('0x23')],!![]);}else{this[_0xcbe6('0x52')](_0x420319[_0xcbe6('0x23')],![],this['channels'][_0x420319['uniqueid']]['faxstatusstring']?_0xcbe6('0x53')+this[_0xcbe6('0xe')][_0x420319[_0xcbe6('0x23')]][_0xcbe6('0x54')]:_0xcbe6('0x55'));}}}};Fax['prototype'][_0xcbe6('0x56')]=function(_0x5ba7b5){var _0x2ad812=this;return new BPromise(function(_0xe6e30d,_0xdd5730){_0x2ad812[_0xcbe6('0x57')](_0x5ba7b5,_0x2ad812[_0xcbe6('0xf')][_0x5ba7b5[_0xcbe6('0x58')]])[_0xcbe6('0x3c')](function(_0x85ce61){ut[_0xcbe6('0x49')]('[Fax][execOriginate][success]',_0x85ce61);_0xe6e30d(ut[_0xcbe6('0x38')](_0xcbe6('0x59')));})['catch'](function(_0x4345a3){ut[_0xcbe6('0x49')](_0xcbe6('0x5a'),_0x4345a3);updateStatus(_0x5ba7b5);_0xdd5730(ut[_0xcbe6('0x38')](_0xcbe6('0x5b')));});});};Fax['prototype'][_0xcbe6('0x5c')]=function(_0x280c91){var _0x325f5d=this;return new BPromise(function(_0x5f4d5d,_0x20350c){var _0x3dc691=_0x325f5d[_0xcbe6('0x5d')](_0x325f5d['faxAccounts'][_0x280c91['FaxAccountId']][_0xcbe6('0x5e')],_0x280c91);if(_0x3dc691[_0xcbe6('0x5f')]){_0x5f4d5d(ut['message'](_0xcbe6('0x60')));}else{_0x20350c(ut[_0xcbe6('0x38')](_0x3dc691[_0xcbe6('0x38')]));}});};function originate(_0xc4d7b1,_0x5c28dc,_0x54420a){return new BPromise(function(_0x5dcc3e,_0x54c952){if(_0x54420a){var _0x2ec113=util['format'](_0xcbe6('0x61'),path[_0xcbe6('0x3a')](_0xc4d7b1[_0xcbe6('0x4')])['name'],_0xc4d7b1[_0xcbe6('0x4')]);gs[_0xcbe6('0x62')](_0x2ec113)[_0xcbe6('0x3c')](function(){_0xc4d7b1[_0xcbe6('0x4')]=util['format'](_0xcbe6('0x63'),path[_0xcbe6('0x3a')](_0xc4d7b1[_0xcbe6('0x4')])[_0xcbe6('0x64')],path[_0xcbe6('0x3a')](_0xc4d7b1['path'])[_0xcbe6('0x25')]);_0x5c28dc[_0xcbe6('0x65')]=_0xc4d7b1['path'];ut[_0xcbe6('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0xcbe6('0x66')](ut['variablesAction'](_0xc4d7b1,_0x5c28dc))[_0xcbe6('0x3c')](function(_0x25eb75){_0x5dcc3e(_0x25eb75);})[_0xcbe6('0x40')](function(_0x49c423){_0x54c952(_0x49c423);});})[_0xcbe6('0x40')](function(_0x2a87a5){_0x54c952(_0x2a87a5);});}else{ami['Action'](ut['variablesAction'](_0xc4d7b1,_0x5c28dc))[_0xcbe6('0x3c')](function(_0x4bec13){_0x5dcc3e(_0x4bec13);})[_0xcbe6('0x40')](function(_0x151846){_0x54c952(_0x151846);});}});}Fax[_0xcbe6('0x1f')]['execOriginate']=function(_0x429d7d,_0x3993a0){var _0x4ed535=this;return new BPromise(function(_0x135d81,_0x3cb3a1){var _0x284660=uuid['v4']();var _0x3fdcf8=ut[_0xcbe6('0x67')](_0x429d7d,_0x3993a0);_0x4ed535[_0xcbe6('0x11')][_0x284660]=new Action(_0x284660,_0x3993a0,_0x429d7d);var _0x8fe5=_0x4ed535[_0xcbe6('0x11')][_0x284660];if(path['parse'](_0x429d7d[_0xcbe6('0x4')])[_0xcbe6('0x68')]==='.pdf'){originate(_0x8fe5,_0x3fdcf8,!![])[_0xcbe6('0x3c')](function(_0x15f970){_0x135d81(_0x15f970);})[_0xcbe6('0x40')](function(_0x267726){_0x3cb3a1(_0x267726);});}else{originate(_0x8fe5,_0x3fdcf8,![])[_0xcbe6('0x3c')](function(_0x5ed7d6){_0x135d81(_0x5ed7d6);})['catch'](function(_0x50e7e1){_0x3cb3a1(_0x50e7e1);});}});};Fax[_0xcbe6('0x1f')][_0xcbe6('0x69')]=function(_0x3b656e){return!_[_0xcbe6('0x6a')](_0x3b656e)&&!_[_0xcbe6('0x6a')](_0x3b656e[_0xcbe6('0x25')])&&!_[_0xcbe6('0x6a')](_0x3b656e[_0xcbe6('0x6b')])&&_0x3b656e[_0xcbe6('0x6b')]&&!_[_0xcbe6('0x6a')](this[_0xcbe6('0x10')][util[_0xcbe6('0x6c')](_0xcbe6('0x6d'),_0x3b656e[_0xcbe6('0x25')])])&&!_[_0xcbe6('0x6a')](this[_0xcbe6('0x10')][util[_0xcbe6('0x6c')](_0xcbe6('0x6d'),_0x3b656e[_0xcbe6('0x25')])][_0xcbe6('0x2e')])&&(this[_0xcbe6('0x10')][util[_0xcbe6('0x6c')]('SIP/%s',_0x3b656e[_0xcbe6('0x25')])][_0xcbe6('0x2e')]===_0xcbe6('0x6e')||this[_0xcbe6('0x10')][util[_0xcbe6('0x6c')](_0xcbe6('0x6d'),_0x3b656e[_0xcbe6('0x25')])][_0xcbe6('0x2e')]===_0xcbe6('0x6f'));};Fax['prototype']['checkTrunk']=function(_0x16ed9c,_0x7a19b4){if(!this['isTrunkReachable'](_0x16ed9c)){ut[_0xcbe6('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xcbe6('0x6a')](_0x16ed9c)?'':_0x16ed9c[_0xcbe6('0x25')]+_0xcbe6('0x70'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x7a19b4[_0xcbe6('0x3e')])){ut[_0xcbe6('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xcbe6('0x43')](_0x7a19b4));return{'isValid':![],'message':_0xcbe6('0x71')};}if(_[_0xcbe6('0x6a')](_0x7a19b4[_0xcbe6('0x4')])){ut[_0xcbe6('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x7a19b4));return{'isValid':![],'message':_0xcbe6('0x72')};}return{'isValid':!![],'message':_0xcbe6('0x73')};};module[_0xcbe6('0x74')]=Fax; \ No newline at end of file +var _0x6e75=['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','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','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','bluebird','uuid','moment','path','./util/gs','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','context','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','catch','error','\x20receiveFax\x20','stringify','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received'];(function(_0x25a764,_0x22127b){var _0x2d285d=function(_0x5f1ceb){while(--_0x5f1ceb){_0x25a764['push'](_0x25a764['shift']());}};_0x2d285d(++_0x22127b);}(_0x6e75,0x101));var _0x56e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e75[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x56e7('0x0'));var _=require('lodash');var BPromise=require(_0x56e7('0x1'));var uuid=require(_0x56e7('0x2'));var moment=require(_0x56e7('0x3'));var path=require(_0x56e7('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x56e7('0x5'));var logger=require('../../../config/logger')(_0x56e7('0x6'));var ami=require(_0x56e7('0x7'));var rpcDb=require(_0x56e7('0x8'));var Channel=require(_0x56e7('0x9'));var ut=require('./util/util');var Action=require(_0x56e7('0xa'));var faxAccount=require(_0x56e7('0xb'));var attachment=require(_0x56e7('0xc'));var faxMessage=require(_0x56e7('0xd'));function Fax(_0x1e09ac){this[_0x56e7('0xe')]={};this['faxAccounts']=_0x1e09ac['faxAccounts'];this[_0x56e7('0xf')]=_0x1e09ac['trunks'];this[_0x56e7('0x10')]={};ami['on'](_0x56e7('0x11'),this[_0x56e7('0x12')][_0x56e7('0x13')](this));ami['on'](_0x56e7('0x14'),this[_0x56e7('0x15')][_0x56e7('0x13')](this));ami['on'](_0x56e7('0x16'),this[_0x56e7('0x17')][_0x56e7('0x13')](this));ami['on']('newexten',this[_0x56e7('0x18')][_0x56e7('0x13')](this));ami['on']('faxstatus',this[_0x56e7('0x19')][_0x56e7('0x13')](this));ami['on'](_0x56e7('0x1a'),this[_0x56e7('0x1b')]['bind'](this));ami['on']('hangup',this[_0x56e7('0x1c')]['bind'](this));ami['on'](_0x56e7('0x1d'),this[_0x56e7('0x1e')]['bind'](this));}Fax['prototype']['syncNewchannel']=function(_0xcb539b){if(_0xcb539b[_0x56e7('0x1f')]==='from-voip-provider'){for(var _0x5e958a in this[_0x56e7('0x20')]){if(this[_0x56e7('0x20')][_0x56e7('0x21')](_0x5e958a)){if(_0xcb539b[_0x56e7('0x22')]===this['faxAccounts'][_0x5e958a][_0x56e7('0x23')]){this[_0x56e7('0xe')][_0xcb539b['uniqueid']]={};this['channels'][_0xcb539b[_0x56e7('0x24')]][_0x56e7('0x25')]=_0xcb539b['channel'];this[_0x56e7('0xe')][_0xcb539b[_0x56e7('0x24')]]['id']=this[_0x56e7('0x20')][_0x5e958a]['id'];this['channels'][_0xcb539b['uniqueid']]['name']=this[_0x56e7('0x20')][_0x5e958a][_0x56e7('0x26')];logger['info'](_0xcb539b[_0x56e7('0x24')],_0x56e7('0x27'));}}}}if(this[_0x56e7('0x10')][_0xcb539b[_0x56e7('0x24')]]){this[_0x56e7('0xe')][_0xcb539b[_0x56e7('0x24')]]={};this[_0x56e7('0xe')][_0xcb539b['uniqueid']][_0x56e7('0x25')]=_0xcb539b[_0x56e7('0x25')];logger[_0x56e7('0x28')](_0xcb539b[_0x56e7('0x24')],_0x56e7('0x27'));}};Fax[_0x56e7('0x29')][_0x56e7('0x15')]=function(_0x478f56){if(this['channels'][_0x478f56[_0x56e7('0x24')]]){for(var _0x579128 in _0x478f56[_0x56e7('0x2a')]){if(_0x478f56['variable'][_0x56e7('0x21')](_0x579128)){this['channels'][_0x478f56['uniqueid']][_0x579128]=_0x478f56['value'];}}}};Fax[_0x56e7('0x29')]['syncNewState']=function(_0xe2c940){if(this[_0x56e7('0xe')][_0xe2c940['uniqueid']]){this['channels'][_0xe2c940['uniqueid']][_0x56e7('0x2b')]=_0xe2c940['channelstate'];this[_0x56e7('0xe')][_0xe2c940[_0x56e7('0x24')]][_0x56e7('0x2c')]=_0xe2c940[_0x56e7('0x2c')];}};Fax[_0x56e7('0x29')][_0x56e7('0x18')]=function(_0x22ed45){if(this[_0x56e7('0xe')][_0x22ed45[_0x56e7('0x24')]]){for(var _0x10f0c9 in _0x22ed45[_0x56e7('0x2a')]){if(_0x22ed45['variable'][_0x56e7('0x21')](_0x10f0c9)){this[_0x56e7('0xe')][_0x22ed45[_0x56e7('0x24')]][_0x10f0c9]=_0x22ed45[_0x56e7('0x2d')];}}}};Fax[_0x56e7('0x29')]['syncFaxStatus']=function(_0x1cc6d4){if(this['channels'][_0x1cc6d4[_0x56e7('0x24')]]){this[_0x56e7('0xe')][_0x1cc6d4['uniqueid']]['operation']=_0x1cc6d4[_0x56e7('0x2e')];this[_0x56e7('0xe')][_0x1cc6d4[_0x56e7('0x24')]][_0x56e7('0x2f')]=_0x1cc6d4['status'];this[_0x56e7('0xe')][_0x1cc6d4[_0x56e7('0x24')]][_0x56e7('0x23')]=_0x1cc6d4[_0x56e7('0x23')];this[_0x56e7('0xe')][_0x1cc6d4[_0x56e7('0x24')]][_0x56e7('0x30')]=_0x1cc6d4['filename'];logger[_0x56e7('0x28')](_0x1cc6d4[_0x56e7('0x24')],_0x56e7('0x31'));}};Fax['prototype']['syncReceiveFax']=function(_0x264545){var _0x3443a1=this;if(this['channels'][_0x264545['uniqueid']]){var _0x57fca0=this[_0x56e7('0xe')][_0x264545[_0x56e7('0x24')]]['id'];this['channels'][_0x264545['uniqueid']][_0x56e7('0x32')]=_0x264545[_0x56e7('0x32')];this[_0x56e7('0xe')][_0x264545[_0x56e7('0x24')]][_0x56e7('0x33')]=_0x264545[_0x56e7('0x33')];this['channels'][_0x264545['uniqueid']]['localstationid']=_0x264545[_0x56e7('0x23')];this['channels'][_0x264545[_0x56e7('0x24')]][_0x56e7('0x34')]=_0x264545[_0x56e7('0x34')];this['channels'][_0x264545[_0x56e7('0x24')]][_0x56e7('0x35')]=_0x264545[_0x56e7('0x35')];this[_0x56e7('0xe')][_0x264545['uniqueid']]['filename']=_0x264545[_0x56e7('0x30')];this[_0x56e7('0xe')][_0x264545[_0x56e7('0x24')]][_0x56e7('0x36')]=_0x264545[_0x56e7('0x36')];if(this['channels'][_0x264545[_0x56e7('0x24')]][_0x56e7('0x33')]>0x0){tiff2pdf(_0x264545[_0x56e7('0x30')],_0x56e7('0x37'),function(_0x340ec){logger['info'](_0x264545['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x340ec['message']);attachment[_0x56e7('0x38')]({'name':path['parse'](_0x264545[_0x56e7('0x30')])[_0x56e7('0x26')],'basename':path[_0x56e7('0x39')](_0x264545[_0x56e7('0x30')])[_0x56e7('0x26')]+_0x56e7('0x3a'),'type':_0x56e7('0x3b')})[_0x56e7('0x3c')](function(_0x35428b){faxAccount['notify'](_0x57fca0,{'from':_0x264545[_0x56e7('0x36')],'mapKey':_0x56e7('0x6'),'body':path[_0x56e7('0x39')](_0x264545[_0x56e7('0x30')])[_0x56e7('0x26')]+_0x56e7('0x3a'),'AttachmentId':_0x35428b['id']})[_0x56e7('0x3d')](function(_0x1965fe){logger['error'](_0x264545['uniqueid'],'\x20notify\x20',JSON['stringify'](_0x1965fe));});})[_0x56e7('0x3d')](function(_0xf0f320){logger[_0x56e7('0x3e')](_0x264545[_0x56e7('0x24')],_0x56e7('0x3f'),JSON[_0x56e7('0x40')](_0xf0f320));});});}logger[_0x56e7('0x28')](_0x264545[_0x56e7('0x24')],_0x56e7('0x3f'));}};Fax['prototype'][_0x56e7('0x1e')]=function(_0x4ecdf8){if(this[_0x56e7('0x10')][_0x4ecdf8[_0x56e7('0x24')]]){_[_0x56e7('0x41')](this['channels'][_0x4ecdf8[_0x56e7('0x24')]],_[_0x56e7('0x42')](_0x4ecdf8,['response',_0x56e7('0x43')]));}};function updateStatus(_0x1e4a39){if(_0x1e4a39[_0x56e7('0x44')]){faxMessage[_0x56e7('0x45')](_0x1e4a39[_0x56e7('0x44')],{'failMessage':_0x56e7('0x46')})[_0x56e7('0x3c')](function(_0x33831f){ut['logger'](_0x56e7('0x47'),_0x33831f);})[_0x56e7('0x3d')](function(_0x3331df){ut[_0x56e7('0x48')](_0x56e7('0x49'),_0x3331df);});}else{ut[_0x56e7('0x48')](_0x56e7('0x4a'));}}Fax[_0x56e7('0x29')][_0x56e7('0x4b')]=function(_0x4469a7,_0x4d2f5e,_0x358a81){var _0x1e082f=this;var _0x156045={};if(_0x4d2f5e){_0x156045={'read':_0x4d2f5e};}else{_0x156045={'failMessage':_0x358a81};}if(this[_0x56e7('0x10')][_0x4469a7][_0x56e7('0x44')]){faxMessage[_0x56e7('0x45')](this[_0x56e7('0x10')][_0x4469a7][_0x56e7('0x44')],_0x156045)[_0x56e7('0x3c')](function(_0xed8b7e){ut[_0x56e7('0x48')]('[Fax][Message][Updated]',_0xed8b7e);})[_0x56e7('0x3d')](function(_0xcf57fa){ut['logger']('[Fax][Message][NoUpdate1]',_0xcf57fa);})[_0x56e7('0x4c')](function(){delete _0x1e082f[_0x56e7('0xe')][_0x4469a7];delete _0x1e082f[_0x56e7('0x10')][_0x4469a7];});}else{ut[_0x56e7('0x48')](_0x56e7('0x4d'));delete this[_0x56e7('0xe')][_0x4469a7];delete this[_0x56e7('0x10')][_0x4469a7];}};Fax['prototype'][_0x56e7('0x1c')]=function(_0x326516){var _0x5354ef=this;if(this[_0x56e7('0xe')][_0x326516[_0x56e7('0x24')]]){if(this[_0x56e7('0x10')][_0x326516[_0x56e7('0x24')]]){this['channels'][_0x326516[_0x56e7('0x24')]]['id']=this[_0x56e7('0x10')][_0x326516[_0x56e7('0x24')]]['id'];this[_0x56e7('0xe')][_0x326516[_0x56e7('0x24')]][_0x56e7('0x26')]=this['actions'][_0x326516[_0x56e7('0x24')]]['name'];}logger['info'](_0x326516[_0x56e7('0x24')],this[_0x56e7('0x10')][_0x326516['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x56e7('0x4e'),JSON[_0x56e7('0x40')](this[_0x56e7('0xe')][_0x326516[_0x56e7('0x24')]]));if(this[_0x56e7('0x10')][_0x326516[_0x56e7('0x24')]]){if(this['channels'][_0x326516[_0x56e7('0x24')]][_0x56e7('0x4f')]>0x0&&this[_0x56e7('0xe')][_0x326516[_0x56e7('0x24')]]['faxstatus']===_0x56e7('0x50')){this['updateStatus'](_0x326516[_0x56e7('0x24')],!![]);}else{this[_0x56e7('0x4b')](_0x326516[_0x56e7('0x24')],![],this[_0x56e7('0xe')][_0x326516['uniqueid']][_0x56e7('0x51')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x326516[_0x56e7('0x24')]][_0x56e7('0x51')]:_0x56e7('0x52'));}}}};Fax[_0x56e7('0x29')][_0x56e7('0x53')]=function(_0x235f53){var _0x384dde=this;return new BPromise(function(_0x3e6fc7,_0x118b53){_0x384dde[_0x56e7('0x54')](_0x235f53,_0x384dde[_0x56e7('0x20')][_0x235f53['FaxAccountId']])[_0x56e7('0x3c')](function(_0x2fd8c1){ut[_0x56e7('0x48')](_0x56e7('0x55'),_0x2fd8c1);_0x3e6fc7(ut[_0x56e7('0x56')](_0x56e7('0x57')));})[_0x56e7('0x3d')](function(_0x5bdea0){ut[_0x56e7('0x48')]('[Fax][execOriginate][failure]',_0x5bdea0);updateStatus(_0x235f53);_0x118b53(ut['message']('Fax\x20failed'));});});};Fax[_0x56e7('0x29')][_0x56e7('0x58')]=function(_0x2a7287){var _0x9828e2=this;return new BPromise(function(_0x1f7c35,_0x31e215){var _0x11e316=_0x9828e2[_0x56e7('0x59')](_0x9828e2['faxAccounts'][_0x2a7287[_0x56e7('0x5a')]][_0x56e7('0x5b')],_0x2a7287);if(_0x11e316['isValid']){_0x1f7c35(ut[_0x56e7('0x56')](_0x56e7('0x5c')));}else{_0x31e215(ut[_0x56e7('0x56')](_0x11e316['message']));}});};function originate(_0x40f56c,_0x3b76fd,_0x231ecc){return new BPromise(function(_0x3957a6,_0x2c7fbd){if(_0x231ecc){var _0x324528=util[_0x56e7('0x5d')](_0x56e7('0x5e'),path[_0x56e7('0x39')](_0x40f56c['path'])[_0x56e7('0x26')],_0x40f56c[_0x56e7('0x4')]);gs[_0x56e7('0x5f')](_0x324528)[_0x56e7('0x3c')](function(){_0x40f56c[_0x56e7('0x4')]=util['format'](_0x56e7('0x60'),path[_0x56e7('0x39')](_0x40f56c[_0x56e7('0x4')])['dir'],path[_0x56e7('0x39')](_0x40f56c['path'])[_0x56e7('0x26')]);_0x3b76fd[_0x56e7('0x61')]=_0x40f56c['path'];ut['logger'](_0x56e7('0x62'),'');ami[_0x56e7('0x63')](ut[_0x56e7('0x64')](_0x40f56c,_0x3b76fd))[_0x56e7('0x3c')](function(_0x3e2fa9){_0x3957a6(_0x3e2fa9);})[_0x56e7('0x3d')](function(_0x92f7bc){_0x2c7fbd(_0x92f7bc);});})[_0x56e7('0x3d')](function(_0x386750){_0x2c7fbd(_0x386750);});}else{ami[_0x56e7('0x63')](ut[_0x56e7('0x64')](_0x40f56c,_0x3b76fd))[_0x56e7('0x3c')](function(_0x425758){_0x3957a6(_0x425758);})['catch'](function(_0x2a0aa4){_0x2c7fbd(_0x2a0aa4);});}});}Fax[_0x56e7('0x29')][_0x56e7('0x54')]=function(_0x27bcde,_0x16b6ca){var _0x2b149e=this;return new BPromise(function(_0x1396ad,_0x2afdea){var _0x507ac2=uuid['v4']();var _0x151c73=ut[_0x56e7('0x65')](_0x27bcde,_0x16b6ca);_0x2b149e[_0x56e7('0x10')][_0x507ac2]=new Action(_0x507ac2,_0x16b6ca,_0x27bcde);var _0x4dbe37=_0x2b149e[_0x56e7('0x10')][_0x507ac2];if(path[_0x56e7('0x39')](_0x27bcde['path'])[_0x56e7('0x66')]===_0x56e7('0x3a')){originate(_0x4dbe37,_0x151c73,!![])[_0x56e7('0x3c')](function(_0x52e8a4){_0x1396ad(_0x52e8a4);})[_0x56e7('0x3d')](function(_0x1de89f){_0x2afdea(_0x1de89f);});}else{originate(_0x4dbe37,_0x151c73,![])[_0x56e7('0x3c')](function(_0xb84f7f){_0x1396ad(_0xb84f7f);})['catch'](function(_0x2c8d33){_0x2afdea(_0x2c8d33);});}});};Fax[_0x56e7('0x29')][_0x56e7('0x67')]=function(_0x540176){return!_['isNil'](_0x540176)&&!_[_0x56e7('0x68')](_0x540176[_0x56e7('0x26')])&&!_[_0x56e7('0x68')](_0x540176[_0x56e7('0x69')])&&_0x540176[_0x56e7('0x69')]&&!_[_0x56e7('0x68')](this[_0x56e7('0xf')][util[_0x56e7('0x5d')](_0x56e7('0x6a'),_0x540176[_0x56e7('0x26')])])&&!_['isNil'](this[_0x56e7('0xf')][util[_0x56e7('0x5d')](_0x56e7('0x6a'),_0x540176[_0x56e7('0x26')])][_0x56e7('0x2f')])&&(this['trunks'][util[_0x56e7('0x5d')](_0x56e7('0x6a'),_0x540176[_0x56e7('0x26')])][_0x56e7('0x2f')]===_0x56e7('0x6b')||this['trunks'][util['format'](_0x56e7('0x6a'),_0x540176[_0x56e7('0x26')])][_0x56e7('0x2f')]===_0x56e7('0x6c'));};Fax[_0x56e7('0x29')][_0x56e7('0x59')]=function(_0x22ea96,_0x2be6e7){if(!this[_0x56e7('0x67')](_0x22ea96)){ut[_0x56e7('0x48')](_0x56e7('0x6d'),_['isNil'](_0x22ea96)?'':_0x22ea96[_0x56e7('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x56e7('0x6e')};}if(_[_0x56e7('0x68')](_0x2be6e7['fax'])){ut[_0x56e7('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x2be6e7));return{'isValid':![],'message':_0x56e7('0x6f')};}if(_[_0x56e7('0x68')](_0x2be6e7['path'])){ut[_0x56e7('0x48')](_0x56e7('0x70'),JSON[_0x56e7('0x40')](_0x2be6e7));return{'isValid':![],'message':_0x56e7('0x71')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x56e7('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index cc485b0..02ac3cd 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 _0x6de3=['bluebird','../../../config/logger','preview','lodash','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x1e5693,_0x497f61){var _0x35242d=function(_0x24bc8b){while(--_0x24bc8b){_0x1e5693['push'](_0x1e5693['shift']());}};_0x35242d(++_0x497f61);}(_0x6de3,0x11d));var _0x36de=function(_0x15d2cf,_0x3f725b){_0x15d2cf=_0x15d2cf-0x0;var _0x200fcb=_0x6de3[_0x15d2cf];return _0x200fcb;};'use strict';var util=require(_0x36de('0x0'));var BPromise=require(_0x36de('0x1'));var logger=require(_0x36de('0x2'))(_0x36de('0x3'));var _=require(_0x36de('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x30dccd){return function(_0x33cad6){logger['error'](_0x30dccd,util[_0x36de('0x5')](_0x33cad6,{'showHidden':![],'depth':null}));};}exports[_0x36de('0x6')]=function(_0x152fc1,_0x1a1b2c){return BPromise[_0x36de('0x7')]()[_0x36de('0x8')](faxAccount['notify'](_0x152fc1,_0x1a1b2c))[_0x36de('0x9')](loggerCatch(_0x36de('0xa')));}; \ No newline at end of file +var _0xb8df=['inspect','notify','then','catch','[Notify]\x20','util','../../../config/logger','preview','lodash'];(function(_0xe85100,_0x2e3a80){var _0x807d41=function(_0x15cc87){while(--_0x15cc87){_0xe85100['push'](_0xe85100['shift']());}};_0x807d41(++_0x2e3a80);}(_0xb8df,0x191));var _0xfb8d=function(_0x54b396,_0x3612ee){_0x54b396=_0x54b396-0x0;var _0x532e6d=_0xb8df[_0x54b396];return _0x532e6d;};'use strict';var util=require(_0xfb8d('0x0'));var BPromise=require('bluebird');var logger=require(_0xfb8d('0x1'))(_0xfb8d('0x2'));var _=require(_0xfb8d('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0xd4635d){return function(_0x48c445){logger['error'](_0xd4635d,util[_0xfb8d('0x4')](_0x48c445,{'showHidden':![],'depth':null}));};}exports[_0xfb8d('0x5')]=function(_0x244ec2,_0x337ba0){return BPromise['resolve']()[_0xfb8d('0x6')](faxAccount[_0xfb8d('0x5')](_0x244ec2,_0x337ba0))[_0xfb8d('0x7')](loggerCatch(_0xfb8d('0x8')));}; \ 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 6bd782b..c37fb2c 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 _0xf216=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x457941,_0x3ec443){var _0x31254e=function(_0x8ae70e){while(--_0x8ae70e){_0x457941['push'](_0x457941['shift']());}};_0x31254e(++_0x3ec443);}(_0xf216,0x1cb));var _0x6f21=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xf216[_0x87b0ff];return _0x3bc0b2;};'use strict';var util=require(_0x6f21('0x0'));var logger=require(_0x6f21('0x1'))(_0x6f21('0x2'));var BPromise=require(_0x6f21('0x3'));var exec=require(_0x6f21('0x4'))[_0x6f21('0x5')];exports[_0x6f21('0x6')]=function(_0x4440e6){return new BPromise(function(_0x13f47a,_0x521438){exec(_0x4440e6,function(_0x1e389d,_0x3483cf,_0x43d84f){logger[_0x6f21('0x7')](_0x6f21('0x8'),_0x3483cf);if(_0x1e389d){logger[_0x6f21('0x7')](_0x6f21('0x8'),_0x6f21('0x9'),util[_0x6f21('0xa')](_0x1e389d,{'showHidden':![],'depth':null}),_0x3483cf,_0x43d84f);_0x521438(_0x1e389d);}_0x13f47a(_0x3483cf);});});}; \ No newline at end of file +var _0x0b68=['fax','child_process','exec','Exec\x20gs','info','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x17719f,_0x659644){var _0x31a4d2=function(_0x3f7c11){while(--_0x3f7c11){_0x17719f['push'](_0x17719f['shift']());}};_0x31a4d2(++_0x659644);}(_0x0b68,0x73));var _0x80b6=function(_0x3d8821,_0x4dca9d){_0x3d8821=_0x3d8821-0x0;var _0x4f82f9=_0x0b68[_0x3d8821];return _0x4f82f9;};'use strict';var util=require(_0x80b6('0x0'));var logger=require(_0x80b6('0x1'))(_0x80b6('0x2'));var BPromise=require('bluebird');var exec=require(_0x80b6('0x3'))[_0x80b6('0x4')];exports['execute']=function(_0x59da27){return new BPromise(function(_0x4b0004,_0x5e14d1){exec(_0x59da27,function(_0x9f0daf,_0x20811d,_0x5390d2){logger['info'](_0x80b6('0x5'),_0x20811d);if(_0x9f0daf){logger[_0x80b6('0x6')]('Exec\x20gs',_0x80b6('0x7'),util[_0x80b6('0x8')](_0x9f0daf,{'showHidden':![],'depth':null}),_0x20811d,_0x5390d2);_0x5e14d1(_0x9f0daf);}_0x4b0004(_0x20811d);});});}; \ 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 26ba14c..7e599a8 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 _0xde2c=['message','logger','info','inspect','addVariables','ecm','headerinfo','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','uniqueid','originate','channel','xcally-motion-fax','util','lodash','moment','../../../../config/logger','fax'];(function(_0x265eec,_0x4b78c5){var _0x4ed819=function(_0x1b65ed){while(--_0x1b65ed){_0x265eec['push'](_0x265eec['shift']());}};_0x4ed819(++_0x4b78c5);}(_0xde2c,0x7f));var _0xcde2=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0xde2c[_0x53bcc3];return _0x47c959;};'use strict';var util=require(_0xcde2('0x0'));var _=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var logger=require(_0xcde2('0x3'))(_0xcde2('0x4'));exports[_0xcde2('0x5')]=function(_0x33bb0c){return{'message':_0x33bb0c};};exports[_0xcde2('0x6')]=function(_0x55c175,_0x4353c8){logger[_0xcde2('0x7')](_0x55c175,util[_0xcde2('0x8')](_0x4353c8,{'showHidden':![],'depth':null}));};exports[_0xcde2('0x9')]=function(_0x401b16,_0x53c558){var _0x2b27ef={'XMF-ECM':_0x53c558[_0xcde2('0xa')],'XMF-HEADERINFO':_0x53c558[_0xcde2('0xb')],'XMF-MINRATE':_0x53c558['minrate'],'XMF-MAXRATE':_0x53c558['maxrate'],'XMF-MODEM':util[_0xcde2('0xc')](_0xcde2('0xd'),_0x53c558['modem']),'XMF-GATEWAY':_0x53c558[_0xcde2('0xe')],'XMF-FAXDETECT':_0x53c558[_0xcde2('0xf')],'XMF-T38TIMEOUT':_0x53c558[_0xcde2('0x10')],'XMF-LOCALSTATIONID':_0x53c558[_0xcde2('0x11')],'XMF-PATH':_0x401b16['path']};return _0x2b27ef;};exports['variablesAction']=function(_0x25677f,_0x1bc697){return{'actionid':_0x25677f[_0xcde2('0x12')],'action':_0xcde2('0x13'),'channel':_0x25677f[_0xcde2('0x14')],'Exten':_0xcde2('0x15'),'Context':'from-sip','Priority':'1','callerid':util[_0xcde2('0xc')]('\x22%s\x22\x20<%s>',_0x25677f[_0xcde2('0xb')]?_0x25677f['headerinfo']:'',_0x25677f['localstationid']),'variable':_0x1bc697,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x25677f[_0xcde2('0x12')]};}; \ No newline at end of file +var _0xb7c8=['logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','faxdetect','t38timeout','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','uniqueid','lodash','moment','../../../../config/logger','fax','message'];(function(_0x25dea5,_0x440b95){var _0x5cc4af=function(_0x22ad08){while(--_0x22ad08){_0x25dea5['push'](_0x25dea5['shift']());}};_0x5cc4af(++_0x440b95);}(_0xb7c8,0x119));var _0x8b7c=function(_0x19fc13,_0x338343){_0x19fc13=_0x19fc13-0x0;var _0x5bcdb6=_0xb7c8[_0x19fc13];return _0x5bcdb6;};'use strict';var util=require('util');var _=require(_0x8b7c('0x0'));var moment=require(_0x8b7c('0x1'));var logger=require(_0x8b7c('0x2'))(_0x8b7c('0x3'));exports[_0x8b7c('0x4')]=function(_0x31ad24){return{'message':_0x31ad24};};exports[_0x8b7c('0x5')]=function(_0x50113e,_0x38672b){logger[_0x8b7c('0x6')](_0x50113e,util[_0x8b7c('0x7')](_0x38672b,{'showHidden':![],'depth':null}));};exports[_0x8b7c('0x8')]=function(_0x107428,_0x12665c){var _0x7a3850={'XMF-ECM':_0x12665c[_0x8b7c('0x9')],'XMF-HEADERINFO':_0x12665c[_0x8b7c('0xa')],'XMF-MINRATE':_0x12665c[_0x8b7c('0xb')],'XMF-MAXRATE':_0x12665c[_0x8b7c('0xc')],'XMF-MODEM':util[_0x8b7c('0xd')]('\x22%s\x22',_0x12665c[_0x8b7c('0xe')]),'XMF-GATEWAY':_0x12665c['gateway'],'XMF-FAXDETECT':_0x12665c[_0x8b7c('0xf')],'XMF-T38TIMEOUT':_0x12665c[_0x8b7c('0x10')],'XMF-LOCALSTATIONID':_0x12665c['localstationid'],'XMF-PATH':_0x107428[_0x8b7c('0x11')]};return _0x7a3850;};exports[_0x8b7c('0x12')]=function(_0x3594b1,_0x586826){return{'actionid':_0x3594b1['uniqueid'],'action':_0x8b7c('0x13'),'channel':_0x3594b1[_0x8b7c('0x14')],'Exten':_0x8b7c('0x15'),'Context':_0x8b7c('0x16'),'Priority':'1','callerid':util[_0x8b7c('0xd')](_0x8b7c('0x17'),_0x3594b1[_0x8b7c('0xa')]?_0x3594b1['headerinfo']:'',_0x3594b1[_0x8b7c('0x18')]),'variable':_0x586826,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3594b1[_0x8b7c('0x19')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 10ad750..aa69060 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 _0xaba8=['then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','resolve'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0xaba8,0xaf));var _0x8aba=function(_0x2fcf2a,_0x418ad8){_0x2fcf2a=_0x2fcf2a-0x0;var _0x57e20e=_0xaba8[_0x2fcf2a];return _0x57e20e;};'use strict';var BPromise=require(_0x8aba('0x0'));var util=require(_0x8aba('0x1'));var moment=require(_0x8aba('0x2'));var server=require('./server');var Realtime=require(_0x8aba('0x3'));var Report=require(_0x8aba('0x4'));var Acw=require(_0x8aba('0x5'));var Trigger=require(_0x8aba('0x6'));var Dialer=require('./dialer');var Preview=require(_0x8aba('0x7'));var Fax=require(_0x8aba('0x8'));var user=require(_0x8aba('0x9'));var voiceQueue=require(_0x8aba('0xa'));var voiceQueueReport=require(_0x8aba('0xb'));var voiceCallReport=require(_0x8aba('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0x8aba('0xd'));var template=require(_0x8aba('0xe'));var cmHopperHistory=require(_0x8aba('0xf'));var campaign=require(_0x8aba('0x10'));var voiceExtension=require(_0x8aba('0x11'));var faxAccount=require(_0x8aba('0x12'));var zendesk=require(_0x8aba('0x13'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x8aba('0x14'));var freshdesk=require(_0x8aba('0x15'));var desk=require(_0x8aba('0x16'));var zoho=require(_0x8aba('0x17'));var vtiger=require(_0x8aba('0x18'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x8aba('0x19'));var dynamics365=require(_0x8aba('0x1a'));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']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x8aba('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8aba('0x1c')]()[_0x8aba('0x1d')](user['getAgents']())[_0x8aba('0x1d')](realtime[_0x8aba('0x1e')]())[_0x8aba('0x1d')](user[_0x8aba('0x1f')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x20')]())['then'](trunk[_0x8aba('0x21')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x22')]())[_0x8aba('0x1d')](voiceQueue[_0x8aba('0x23')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x24')]())[_0x8aba('0x1d')](trigger[_0x8aba('0x25')]())['then'](realtime[_0x8aba('0x26')]())[_0x8aba('0x1d')](template['getTemplates']())[_0x8aba('0x1d')](realtime['initTemplates']())[_0x8aba('0x1d')](zendesk[_0x8aba('0x27')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x28')]())[_0x8aba('0x1d')](salesforce[_0x8aba('0x29')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x2a')]())[_0x8aba('0x1d')](sugarcrm[_0x8aba('0x2b')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x2c')]())[_0x8aba('0x1d')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x8aba('0x2d')]())[_0x8aba('0x1d')](desk[_0x8aba('0x2e')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x2f')]())['then'](zoho[_0x8aba('0x30')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x31')]())[_0x8aba('0x1d')](vtiger[_0x8aba('0x32')]())[_0x8aba('0x1d')](realtime['initVtigerAccounts']())[_0x8aba('0x1d')](freshsales[_0x8aba('0x33')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x34')]())[_0x8aba('0x1d')](servicenow['getServicenowAccounts']())[_0x8aba('0x1d')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x8aba('0x35')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x36')]())[_0x8aba('0x1d')](campaign[_0x8aba('0x37')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x38')]())[_0x8aba('0x1d')](voiceExtension[_0x8aba('0x39')]())[_0x8aba('0x1d')](realtime[_0x8aba('0x3a')]())[_0x8aba('0x1d')](faxAccount[_0x8aba('0x3b')]())['then'](realtime[_0x8aba('0x3c')]())[_0x8aba('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x8aba('0x1c')]()[_0x8aba('0x1d')](voiceQueueReport['getVoiceQueueReports']())[_0x8aba('0x1d')](realtime['initVoiceQueueReports']())[_0x8aba('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x8aba('0x3d')]())['then'](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x8aba('0x3e')]())[_0x8aba('0x1d')](voiceCallReport['getVoiceCallReports']())[_0x8aba('0x1d')](realtime[_0x8aba('0x3f')]())[_0x8aba('0x1d')](function(_0x4143ff){})[_0x8aba('0x40')](function(_0x36f510){console[_0x8aba('0x41')](_0x36f510);});}function main(){return server[_0x8aba('0x42')](realtime,preview,fax)[_0x8aba('0x1d')](function(_0x1bef7c){return initRealtime();})[_0x8aba('0x1d')](function(){return initParams();})[_0x8aba('0x1d')](function(){report[_0x8aba('0x43')]();setInterval(initRealtime,0x1388);})[_0x8aba('0x40')](function(_0x9dfe93){console[_0x8aba('0x41')](_0x9dfe93);});}main(); \ No newline at end of file +var _0x5233=['./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','log','catch','bluebird','util','moment','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm'];(function(_0x39bb41,_0x449d2e){var _0x2595c1=function(_0x78fd57){while(--_0x78fd57){_0x39bb41['push'](_0x39bb41['shift']());}};_0x2595c1(++_0x449d2e);}(_0x5233,0x193));var _0x3523=function(_0x3775a5,_0x157da7){_0x3775a5=_0x3775a5-0x0;var _0x3233d0=_0x5233[_0x3775a5];return _0x3233d0;};'use strict';var BPromise=require(_0x3523('0x0'));var util=require(_0x3523('0x1'));var moment=require(_0x3523('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x3523('0x3'));var Acw=require(_0x3523('0x4'));var Trigger=require(_0x3523('0x5'));var Dialer=require(_0x3523('0x6'));var Preview=require(_0x3523('0x7'));var Fax=require(_0x3523('0x8'));var user=require(_0x3523('0x9'));var voiceQueue=require(_0x3523('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x3523('0xb'));var trigger=require(_0x3523('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0x3523('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x3523('0xe'));var salesforce=require(_0x3523('0xf'));var sugarcrm=require(_0x3523('0x10'));var freshdesk=require(_0x3523('0x11'));var desk=require(_0x3523('0x12'));var zoho=require(_0x3523('0x13'));var vtiger=require(_0x3523('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x3523('0x15'));var dynamics365=require(_0x3523('0x16'));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()[_0x3523('0x17')](_0x3523('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3523('0x17')](_0x3523('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x3523('0x19')]()[_0x3523('0x1a')](user[_0x3523('0x1b')]())[_0x3523('0x1a')](realtime['initAgents']())[_0x3523('0x1a')](user['getTelephones']())[_0x3523('0x1a')](realtime['initTelephones']())[_0x3523('0x1a')](trunk['getTrunks']())[_0x3523('0x1a')](realtime[_0x3523('0x1c')]())[_0x3523('0x1a')](voiceQueue[_0x3523('0x1d')]())[_0x3523('0x1a')](realtime[_0x3523('0x1e')]())[_0x3523('0x1a')](trigger[_0x3523('0x1f')]())[_0x3523('0x1a')](realtime[_0x3523('0x20')]())[_0x3523('0x1a')](template['getTemplates']())['then'](realtime['initTemplates']())[_0x3523('0x1a')](zendesk[_0x3523('0x21')]())['then'](realtime[_0x3523('0x22')]())[_0x3523('0x1a')](salesforce[_0x3523('0x23')]())[_0x3523('0x1a')](realtime[_0x3523('0x24')]())[_0x3523('0x1a')](sugarcrm[_0x3523('0x25')]())['then'](realtime[_0x3523('0x26')]())['then'](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x3523('0x27')]())[_0x3523('0x1a')](desk[_0x3523('0x28')]())[_0x3523('0x1a')](realtime[_0x3523('0x29')]())[_0x3523('0x1a')](zoho['getZohoAccounts']())[_0x3523('0x1a')](realtime[_0x3523('0x2a')]())['then'](vtiger['getVtigerAccounts']())['then'](realtime[_0x3523('0x2b')]())[_0x3523('0x1a')](freshsales[_0x3523('0x2c')]())[_0x3523('0x1a')](realtime['initFreshsalesAccounts']())[_0x3523('0x1a')](servicenow[_0x3523('0x2d')]())[_0x3523('0x1a')](realtime[_0x3523('0x2e')]())[_0x3523('0x1a')](dynamics365['getDynamics365Accounts']())[_0x3523('0x1a')](realtime[_0x3523('0x2f')]())['then'](campaign[_0x3523('0x30')]())[_0x3523('0x1a')](realtime[_0x3523('0x31')]())[_0x3523('0x1a')](voiceExtension[_0x3523('0x32')]())[_0x3523('0x1a')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x3523('0x33')]())[_0x3523('0x1a')](realtime[_0x3523('0x34')]())[_0x3523('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0x3523('0x19')]()[_0x3523('0x1a')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x3523('0x35')]())[_0x3523('0x1a')](cmHopperHistory[_0x3523('0x36')]())['then'](realtime[_0x3523('0x37')]())[_0x3523('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0x3523('0x1a')](realtime['initCampaignHopperHistory']())[_0x3523('0x1a')](voiceCallReport[_0x3523('0x38')]())['then'](realtime[_0x3523('0x39')]())[_0x3523('0x1a')](function(_0x1f9465){})['catch'](function(_0x29f447){console[_0x3523('0x3a')](_0x29f447);});}function main(){return server['listen'](realtime,preview,fax)[_0x3523('0x1a')](function(_0x4dd03a){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x3523('0x3b')](function(_0x125388){console[_0x3523('0x3a')](_0x125388);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 15060ab..7915dbd 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 _0x60f4=['stateTime','stringify','user:%s','exports','lodash','util','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','status','address','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','not_inuse','idle','statePause','toNumber','format'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x60f4,0xf9));var _0x460f=function(_0x15f5b2,_0x41b6d6){_0x15f5b2=_0x15f5b2-0x0;var _0x5d9a5c=_0x60f4[_0x15f5b2];return _0x5d9a5c;};'use strict';var _=require(_0x460f('0x0'));var util=require(_0x460f('0x1'));var moment=require('moment');var md5=require(_0x460f('0x2'));var Redis=require(_0x460f('0x3'));var config=require(_0x460f('0x4'));config[_0x460f('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x460f('0x6'))(new Redis(config['redis']));function Agent(_0xdc6889){this['id']=_0xdc6889['id']||0x0;this['name']=_0xdc6889[_0x460f('0x7')]||'';this['email']=_0xdc6889[_0x460f('0x8')]||'';this[_0x460f('0x9')]=_0xdc6889[_0x460f('0x9')]||'';this['fullname']=_0xdc6889[_0x460f('0xa')]||'';this[_0x460f('0xb')]=_0x460f('0xc');this['stateTime']=0x0;this[_0x460f('0xd')]=_0x460f('0xc');this[_0x460f('0xe')]='';this[_0x460f('0xf')]='';this['mobile']='';this[_0x460f('0x10')]='';this[_0x460f('0x11')]=_0xdc6889[_0x460f('0x11')]||![];this[_0x460f('0x12')]=_0x460f('0xc');this[_0x460f('0x13')]=0x0;this[_0x460f('0x14')]='';this[_0x460f('0x15')]='';this[_0x460f('0x16')]=![];this[_0x460f('0x17')]=![];this[_0x460f('0x2')]='';}Agent[_0x460f('0x18')][_0x460f('0x19')]=function(_0x4d120a){var _0x449d96;if(_0x4d120a&&_0x4d120a['state']){_0x449d96=_0x4d120a[_0x460f('0xb')]['toLowerCase']();switch(_0x449d96){case _0x460f('0x1a'):_0x449d96=_0x460f('0x1b');break;case'inuse':_0x449d96='talking';break;}}if(_0x449d96&&this[_0x460f('0x12')]!==_0x449d96||_0x4d120a[_0x460f('0x1c')]){this[_0x460f('0x13')]=_[_0x460f('0x1d')](moment()[_0x460f('0x1e')]('x'));}if(_0x449d96){this[_0x460f('0x12')]=_0x449d96;}var _0x166fa6={'id':this['id'],'name':this[_0x460f('0x7')],'email':this[_0x460f('0x8')],'accountcode':this[_0x460f('0x9')],'fullname':this['fullname'],'state':this[_0x460f('0xb')],'stateTime':this[_0x460f('0x1f')],'status':this[_0x460f('0xd')],'address':this[_0x460f('0xe')],'online':this[_0x460f('0x11')],'voiceStatus':this[_0x460f('0x12')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x460f('0x14')],'voiceStatusQueue':this[_0x460f('0x15')],'interface':this[_0x460f('0x10')],'onhold':this[_0x460f('0x16')]};var _0x10fd9d=md5(JSON[_0x460f('0x20')](_0x166fa6));if(this[_0x460f('0x2')]!==_0x10fd9d){this[_0x460f('0x2')]=_0x10fd9d;io['to'](util[_0x460f('0x1e')](_0x460f('0x21'),_0x166fa6[_0x460f('0x7')]))['emit']('user:save',_0x166fa6);}};module[_0x460f('0x22')]=Agent; \ No newline at end of file +var _0x1d29=['online','voiceStatusCallerIdNumber','local','prototype','not_inuse','idle','voiceStatus','statePause','voiceStatusTime','toNumber','format','accountcode','voiceStatusQueue','onhold','stringify','emit','user:save','exports','lodash','util','md5','ioredis','redis','defaults','localhost','name','email','fullname','state','stateTime','status','unknown','address','phone','mobile','interface'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x1d29,0xa2));var _0x91d2=function(_0x1c490a,_0x217f34){_0x1c490a=_0x1c490a-0x0;var _0x1e0b1d=_0x1d29[_0x1c490a];return _0x1e0b1d;};'use strict';var _=require(_0x91d2('0x0'));var util=require(_0x91d2('0x1'));var moment=require('moment');var md5=require(_0x91d2('0x2'));var Redis=require(_0x91d2('0x3'));var config=require('../../../config/environment');config[_0x91d2('0x4')]=_[_0x91d2('0x5')](config['redis'],{'host':_0x91d2('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x91d2('0x4')]));function Agent(_0x1ad28f){this['id']=_0x1ad28f['id']||0x0;this[_0x91d2('0x7')]=_0x1ad28f[_0x91d2('0x7')]||'';this[_0x91d2('0x8')]=_0x1ad28f[_0x91d2('0x8')]||'';this['accountcode']=_0x1ad28f['accountcode']||'';this[_0x91d2('0x9')]=_0x1ad28f[_0x91d2('0x9')]||'';this[_0x91d2('0xa')]='unknown';this[_0x91d2('0xb')]=0x0;this[_0x91d2('0xc')]=_0x91d2('0xd');this[_0x91d2('0xe')]='';this[_0x91d2('0xf')]='';this[_0x91d2('0x10')]='';this[_0x91d2('0x11')]='';this[_0x91d2('0x12')]=_0x1ad28f[_0x91d2('0x12')]||![];this['voiceStatus']=_0x91d2('0xd');this['voiceStatusTime']=0x0;this[_0x91d2('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x91d2('0x14')]=![];this[_0x91d2('0x2')]='';}Agent[_0x91d2('0x15')]['updateStatusRealtime']=function(_0x21631e){var _0x46dbd1;if(_0x21631e&&_0x21631e['state']){_0x46dbd1=_0x21631e[_0x91d2('0xa')]['toLowerCase']();switch(_0x46dbd1){case _0x91d2('0x16'):_0x46dbd1=_0x91d2('0x17');break;case'inuse':_0x46dbd1='talking';break;}}if(_0x46dbd1&&this[_0x91d2('0x18')]!==_0x46dbd1||_0x21631e[_0x91d2('0x19')]){this[_0x91d2('0x1a')]=_[_0x91d2('0x1b')](moment()[_0x91d2('0x1c')]('x'));}if(_0x46dbd1){this['voiceStatus']=_0x46dbd1;}var _0x5a902a={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x91d2('0x1d')],'fullname':this[_0x91d2('0x9')],'state':this['state'],'stateTime':this[_0x91d2('0xb')],'status':this[_0x91d2('0xc')],'address':this['address'],'online':this[_0x91d2('0x12')],'voiceStatus':this[_0x91d2('0x18')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x91d2('0x13')],'voiceStatusQueue':this[_0x91d2('0x1e')],'interface':this[_0x91d2('0x11')],'onhold':this[_0x91d2('0x1f')]};var _0x22192d=md5(JSON[_0x91d2('0x20')](_0x5a902a));if(this[_0x91d2('0x2')]!==_0x22192d){this['md5']=_0x22192d;io['to'](util[_0x91d2('0x1c')]('user:%s',_0x5a902a[_0x91d2('0x7')]))[_0x91d2('0x21')](_0x91d2('0x22'),_0x5a902a);}};module[_0x91d2('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 4e682cd..84bed2f 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 _0xce20=['Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup'];(function(_0x59fc7f,_0x33a2ba){var _0x25535a=function(_0xd11ba0){while(--_0xd11ba0){_0x59fc7f['push'](_0x59fc7f['shift']());}};_0x25535a(++_0x33a2ba);}(_0xce20,0xd7));var _0x0ce2=function(_0x23c0e5,_0x48368a){_0x23c0e5=_0x23c0e5-0x0;var _0x203842=_0xce20[_0x23c0e5];return _0x203842;};'use strict';function Campaign(_0x298c65){this['id']=_0x298c65['id']||0x0;this[_0x0ce2('0x0')]=_0x298c65[_0x0ce2('0x0')]||'';this['type']=_0x298c65[_0x0ce2('0x1')]||_0x0ce2('0x2');this['originated']=0x0;this[_0x0ce2('0x3')]=0x0;this[_0x0ce2('0x4')]=0x0;this[_0x0ce2('0x5')]=0x0;this[_0x0ce2('0x6')]='';this[_0x0ce2('0x7')]=!![];this['active']=_0x298c65[_0x0ce2('0x8')];this[_0x0ce2('0x9')]=_0x298c65[_0x0ce2('0x9')];this[_0x0ce2('0xa')]=_0x298c65['dialTimezone']||null;this[_0x0ce2('0xb')]=_0x298c65[_0x0ce2('0xb')]?_0x298c65[_0x0ce2('0xb')]:null;this['dialOriginateCallerIdName']=_0x298c65[_0x0ce2('0xc')];this['dialOriginateCallerIdNumber']=_0x298c65[_0x0ce2('0xd')];this[_0x0ce2('0xe')]=_0x298c65['dialOriginateTimeout']||0x1e;this[_0x0ce2('0xf')]=_0x298c65[_0x0ce2('0xf')];this[_0x0ce2('0x10')]=_0x298c65[_0x0ce2('0x10')];this[_0x0ce2('0x11')]=_0x298c65[_0x0ce2('0x11')];this[_0x0ce2('0x12')]=_0x298c65[_0x0ce2('0x12')];this['dialNoAnswerMaxRetry']=_0x298c65[_0x0ce2('0x13')];this[_0x0ce2('0x14')]=_0x298c65[_0x0ce2('0x14')];this[_0x0ce2('0x15')]=_0x298c65[_0x0ce2('0x15')];this[_0x0ce2('0x16')]=_0x298c65[_0x0ce2('0x16')]||0x3;this[_0x0ce2('0x17')]=_0x298c65[_0x0ce2('0x17')]||0x96;this[_0x0ce2('0x18')]=_0x298c65[_0x0ce2('0x18')]||0x3;this[_0x0ce2('0x19')]=_0x298c65[_0x0ce2('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x298c65['dialAbandonedMaxRetry']||0x3;this[_0x0ce2('0x1a')]=_0x298c65[_0x0ce2('0x1a')]||0x96;this[_0x0ce2('0x1b')]=_0x298c65[_0x0ce2('0x1b')]||0x3;this[_0x0ce2('0x1c')]=_0x298c65[_0x0ce2('0x1c')]||0x96;this[_0x0ce2('0x1d')]=_0x298c65['dialAgentRejectMaxRetry']||0x3;this[_0x0ce2('0x1e')]=_0x298c65[_0x0ce2('0x1e')]||0x96;this[_0x0ce2('0x1f')]=_0x298c65['dialOrderByScheduledAt']||'DESC';this['dialPrefix']=_0x298c65['dialPrefix']||undefined;this[_0x0ce2('0x20')]=_0x298c65['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x0ce2('0x21')]=_0x298c65[_0x0ce2('0x21')]||undefined;this[_0x0ce2('0x22')]=_0x298c65[_0x0ce2('0x22')]?_0x298c65['TrunkBackup']:undefined;this[_0x0ce2('0x23')]=_0x298c65[_0x0ce2('0x23')]?_0x298c65['Trunk']:undefined;this[_0x0ce2('0x24')]=_0x298c65['Interval']?_0x298c65[_0x0ce2('0x24')]:undefined;this['SquareProject']=_0x298c65[_0x0ce2('0x25')]?_0x298c65[_0x0ce2('0x25')]:undefined;this[_0x0ce2('0x26')]=_0x298c65[_0x0ce2('0x25')]?_0x298c65[_0x0ce2('0x25')][_0x0ce2('0x0')]:undefined;this[_0x0ce2('0x27')]=_0x298c65[_0x0ce2('0x27')]||![];this[_0x0ce2('0x28')]=_0x298c65[_0x0ce2('0x28')];this[_0x0ce2('0x29')]=_0x298c65['dialAMDGreeting'];this[_0x0ce2('0x2a')]=_0x298c65['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x298c65[_0x0ce2('0x2b')];this[_0x0ce2('0x2c')]=_0x298c65[_0x0ce2('0x2c')];this['dialAMDBetweenWordsSilence']=_0x298c65[_0x0ce2('0x2d')];this[_0x0ce2('0x2e')]=_0x298c65['dialAMDMaximumNumberOfWords'];this[_0x0ce2('0x2f')]=_0x298c65[_0x0ce2('0x2f')];this[_0x0ce2('0x30')]=_0x298c65['dialAMDMaximumWordLength'];}module[_0x0ce2('0x31')]=Campaign; \ No newline at end of file +var _0xdea1=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xdea1,0x1f4));var _0x1dea=function(_0x5bbeda,_0x553478){_0x5bbeda=_0x5bbeda-0x0;var _0x25e459=_0xdea1[_0x5bbeda];return _0x25e459;};'use strict';function Campaign(_0x453ef6){this['id']=_0x453ef6['id']||0x0;this[_0x1dea('0x0')]=_0x453ef6[_0x1dea('0x0')]||'';this[_0x1dea('0x1')]=_0x453ef6['type']||_0x1dea('0x2');this[_0x1dea('0x3')]=0x0;this[_0x1dea('0x4')]=0x0;this[_0x1dea('0x5')]=0x0;this[_0x1dea('0x6')]=0x0;this['message']='';this[_0x1dea('0x7')]=!![];this[_0x1dea('0x8')]=_0x453ef6[_0x1dea('0x8')];this[_0x1dea('0x9')]=_0x453ef6[_0x1dea('0x9')];this[_0x1dea('0xa')]=_0x453ef6[_0x1dea('0xa')]||null;this[_0x1dea('0xb')]=_0x453ef6[_0x1dea('0xb')]?_0x453ef6[_0x1dea('0xb')]:null;this[_0x1dea('0xc')]=_0x453ef6[_0x1dea('0xc')];this[_0x1dea('0xd')]=_0x453ef6['dialOriginateCallerIdNumber'];this[_0x1dea('0xe')]=_0x453ef6[_0x1dea('0xe')]||0x1e;this[_0x1dea('0xf')]=_0x453ef6[_0x1dea('0xf')];this['dialCongestionRetryFrequency']=_0x453ef6[_0x1dea('0x10')];this[_0x1dea('0x11')]=_0x453ef6[_0x1dea('0x11')];this['dialBusyRetryFrequency']=_0x453ef6[_0x1dea('0x12')];this[_0x1dea('0x13')]=_0x453ef6[_0x1dea('0x13')];this[_0x1dea('0x14')]=_0x453ef6['dialNoAnswerRetryFrequency'];this[_0x1dea('0x15')]=_0x453ef6['dialGlobalMaxRetry'];this[_0x1dea('0x16')]=_0x453ef6[_0x1dea('0x16')]||0x3;this[_0x1dea('0x17')]=_0x453ef6[_0x1dea('0x17')]||0x96;this[_0x1dea('0x18')]=_0x453ef6[_0x1dea('0x18')]||0x3;this[_0x1dea('0x19')]=_0x453ef6[_0x1dea('0x19')]||0x96;this[_0x1dea('0x1a')]=_0x453ef6['dialAbandonedMaxRetry']||0x3;this[_0x1dea('0x1b')]=_0x453ef6[_0x1dea('0x1b')]||0x96;this[_0x1dea('0x1c')]=_0x453ef6[_0x1dea('0x1c')]||0x3;this[_0x1dea('0x1d')]=_0x453ef6[_0x1dea('0x1d')]||0x96;this[_0x1dea('0x1e')]=_0x453ef6[_0x1dea('0x1e')]||0x3;this[_0x1dea('0x1f')]=_0x453ef6[_0x1dea('0x1f')]||0x96;this['dialOrderByScheduledAt']=_0x453ef6[_0x1dea('0x20')]||_0x1dea('0x21');this[_0x1dea('0x22')]=_0x453ef6[_0x1dea('0x22')]||undefined;this[_0x1dea('0x23')]=_0x453ef6[_0x1dea('0x23')]||undefined;this[_0x1dea('0x24')]=_0x453ef6['dialCutDigit']||undefined;this['TrunkBackup']=_0x453ef6[_0x1dea('0x25')]?_0x453ef6[_0x1dea('0x25')]:undefined;this['Trunk']=_0x453ef6[_0x1dea('0x26')]?_0x453ef6['Trunk']:undefined;this['Interval']=_0x453ef6[_0x1dea('0x27')]?_0x453ef6['Interval']:undefined;this['SquareProject']=_0x453ef6[_0x1dea('0x28')]?_0x453ef6['SquareProject']:undefined;this['dialQueueProject']=_0x453ef6[_0x1dea('0x28')]?_0x453ef6[_0x1dea('0x28')][_0x1dea('0x0')]:undefined;this[_0x1dea('0x29')]=_0x453ef6[_0x1dea('0x29')]||![];this[_0x1dea('0x2a')]=_0x453ef6[_0x1dea('0x2a')];this['dialAMDGreeting']=_0x453ef6[_0x1dea('0x2b')];this['dialAMDAfterGreetingSilence']=_0x453ef6[_0x1dea('0x2c')];this[_0x1dea('0x2d')]=_0x453ef6[_0x1dea('0x2d')];this[_0x1dea('0x2e')]=_0x453ef6[_0x1dea('0x2e')];this[_0x1dea('0x2f')]=_0x453ef6[_0x1dea('0x2f')];this[_0x1dea('0x30')]=_0x453ef6[_0x1dea('0x30')];this[_0x1dea('0x31')]=_0x453ef6['dialAMDSilenceThreshold'];this[_0x1dea('0x32')]=_0x453ef6['dialAMDMaximumWordLength'];}module[_0x1dea('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index cb66e59..f0a86d0 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 _0x6d0c=['queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','linkedid','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x211952,_0x22c0af){_0x211952=_0x211952-0x0;var _0x5eba8a=_0x6d0c[_0x211952];return _0x5eba8a;};'use strict';function Channel(){this[_0xc6d0('0x0')]=null;this[_0xc6d0('0x1')]='';this[_0xc6d0('0x2')]='';this[_0xc6d0('0x3')]=0x0;this[_0xc6d0('0x4')]='';this[_0xc6d0('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xc6d0('0x6')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0xc6d0('0x7')]=0x0;this['exten']=0x0;this['answered']=![];this[_0xc6d0('0x8')]=null;this[_0xc6d0('0x9')]=null;this[_0xc6d0('0xa')]=![];this[_0xc6d0('0xb')]=![];this[_0xc6d0('0xc')]='';this[_0xc6d0('0xd')]='';this[_0xc6d0('0xe')]=0x0;this[_0xc6d0('0xf')]=0x0;this[_0xc6d0('0x10')]=0x0;this[_0xc6d0('0x11')]=null;this[_0xc6d0('0x12')]=null;this[_0xc6d0('0x13')]=null;this[_0xc6d0('0x14')]=![];this[_0xc6d0('0x15')]=null;this[_0xc6d0('0x16')]=null;this[_0xc6d0('0x17')]=[];this[_0xc6d0('0x18')]=undefined;this[_0xc6d0('0x19')]=undefined;this[_0xc6d0('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xb0d2=['transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag','monitor','monitorFilename','queue'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0xb0d2,0x1b4));var _0x2b0d=function(_0x54308d,_0xff1ca4){_0x54308d=_0x54308d-0x0;var _0x4b88e2=_0xb0d2[_0x54308d];return _0x4b88e2;};'use strict';function Channel(){this[_0x2b0d('0x0')]=null;this['channel']='';this[_0x2b0d('0x1')]='';this[_0x2b0d('0x2')]=0x0;this[_0x2b0d('0x3')]='';this['connectedlinenum']=undefined;this[_0x2b0d('0x4')]=undefined;this[_0x2b0d('0x5')]=0x0;this[_0x2b0d('0x6')]='';this[_0x2b0d('0x7')]=0x0;this[_0x2b0d('0x8')]=0x0;this['exten']=0x0;this[_0x2b0d('0x9')]=![];this[_0x2b0d('0xa')]=null;this[_0x2b0d('0xb')]=null;this[_0x2b0d('0xc')]=![];this[_0x2b0d('0xd')]=![];this[_0x2b0d('0xe')]='';this[_0x2b0d('0xf')]='';this[_0x2b0d('0x10')]=0x0;this[_0x2b0d('0x11')]=0x0;this[_0x2b0d('0x12')]=0x0;this['type']=null;this[_0x2b0d('0x13')]=null;this['disposition']=null;this[_0x2b0d('0x14')]=![];this[_0x2b0d('0x15')]=null;this[_0x2b0d('0x16')]=null;this['monitors']=[];this[_0x2b0d('0x17')]=undefined;this[_0x2b0d('0x18')]=undefined;this[_0x2b0d('0x19')]=0x0;}module[_0x2b0d('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 5bf4a6c..37bd268 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 _0x4b1f=['remoteUri','authType','password','consumerKey','consumerSecret','token','type','serverUrl','exports','name','username'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x4b1f,0x195));var _0xf4b1=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x4b1f[_0x1da527];return _0x40fc7c;};'use strict';function DeskAccount(_0x3ca797){this['id']=_0x3ca797['id']||0x0;this[_0xf4b1('0x0')]=_0x3ca797['name']||'';this[_0xf4b1('0x1')]=_0x3ca797[_0xf4b1('0x1')]||'';this[_0xf4b1('0x2')]=_0x3ca797['remoteUri']||'';this[_0xf4b1('0x3')]=_0x3ca797[_0xf4b1('0x3')]||'';this[_0xf4b1('0x4')]=_0x3ca797['password']||'';this['consumerKey']=_0x3ca797[_0xf4b1('0x5')]||'';this[_0xf4b1('0x6')]=_0x3ca797[_0xf4b1('0x6')]||'';this[_0xf4b1('0x7')]=_0x3ca797[_0xf4b1('0x7')]||'';this['tokenSecret']=_0x3ca797['tokenSecret']||'';this['type']=_0x3ca797[_0xf4b1('0x8')]||'';this['serverUrl']=_0x3ca797[_0xf4b1('0x9')]||'';this['Configurations']=_0x3ca797['Configurations']||{};}module[_0xf4b1('0xa')]=DeskAccount; \ No newline at end of file +var _0xd6d2=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x8ccb99,_0x1568ea){var _0x3f0f26=function(_0x19757b){while(--_0x19757b){_0x8ccb99['push'](_0x8ccb99['shift']());}};_0x3f0f26(++_0x1568ea);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x158003,_0x2f94c8){_0x158003=_0x158003-0x0;var _0x5dd1fe=_0xd6d2[_0x158003];return _0x5dd1fe;};'use strict';function DeskAccount(_0x627178){this['id']=_0x627178['id']||0x0;this[_0x2d6d('0x0')]=_0x627178['name']||'';this[_0x2d6d('0x1')]=_0x627178[_0x2d6d('0x1')]||'';this['remoteUri']=_0x627178[_0x2d6d('0x2')]||'';this['authType']=_0x627178[_0x2d6d('0x3')]||'';this[_0x2d6d('0x4')]=_0x627178[_0x2d6d('0x4')]||'';this['consumerKey']=_0x627178[_0x2d6d('0x5')]||'';this[_0x2d6d('0x6')]=_0x627178[_0x2d6d('0x6')]||'';this[_0x2d6d('0x7')]=_0x627178[_0x2d6d('0x7')]||'';this[_0x2d6d('0x8')]=_0x627178[_0x2d6d('0x8')]||'';this[_0x2d6d('0x9')]=_0x627178[_0x2d6d('0x9')]||'';this[_0x2d6d('0xa')]=_0x627178[_0x2d6d('0xa')]||'';this['Configurations']=_0x627178[_0x2d6d('0xb')]||{};}module[_0x2d6d('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 20a0a8e..0d9bb5a 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 _0xc45b=['Configurations','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x579f88,_0xb8632d){var _0xcff854=function(_0x5ed35e){while(--_0x5ed35e){_0x579f88['push'](_0x579f88['shift']());}};_0xcff854(++_0xb8632d);}(_0xc45b,0x169));var _0xbc45=function(_0x3d0227,_0x37c3c1){_0x3d0227=_0x3d0227-0x0;var _0x19648e=_0xc45b[_0x3d0227];return _0x19648e;};'use strict';function Dynamics365Account(_0x115474){this['id']=_0x115474['id']||0x0;this[_0xbc45('0x0')]=_0x115474[_0xbc45('0x0')]||'';this[_0xbc45('0x1')]=_0x115474[_0xbc45('0x1')]||'';this[_0xbc45('0x2')]=_0x115474[_0xbc45('0x2')]||'';this[_0xbc45('0x3')]=_0x115474[_0xbc45('0x3')]||'';this[_0xbc45('0x4')]=_0x115474[_0xbc45('0x4')]||'';this[_0xbc45('0x5')]=_0x115474['clientId']||'';this[_0xbc45('0x6')]=_0x115474[_0xbc45('0x6')]||{};this['serverUrl']=_0x115474[_0xbc45('0x7')]||'';this[_0xbc45('0x8')]=_0x115474[_0xbc45('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x914c=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x914c,0xcd));var _0xc914=function(_0x5decec,_0x4e5761){_0x5decec=_0x5decec-0x0;var _0x35e1b4=_0x914c[_0x5decec];return _0x35e1b4;};'use strict';function Dynamics365Account(_0x58d2f7){this['id']=_0x58d2f7['id']||0x0;this[_0xc914('0x0')]=_0x58d2f7[_0xc914('0x0')]||'';this[_0xc914('0x1')]=_0x58d2f7['username']||'';this[_0xc914('0x2')]=_0x58d2f7[_0xc914('0x2')]||'';this[_0xc914('0x3')]=_0x58d2f7['remoteUri']||'';this[_0xc914('0x4')]=_0x58d2f7[_0xc914('0x4')]||'';this[_0xc914('0x5')]=_0x58d2f7[_0xc914('0x5')]||'';this['clientSecret']=_0x58d2f7[_0xc914('0x6')]||{};this['serverUrl']=_0x58d2f7[_0xc914('0x7')]||'';this[_0xc914('0x8')]=_0x58d2f7[_0xc914('0x8')]||{};}module[_0xc914('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 8effd45..710a18d 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 _0xa380=['ListId','name','description','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk'];(function(_0x273e8f,_0x4b9aea){var _0x5a9927=function(_0x564560){while(--_0x564560){_0x273e8f['push'](_0x273e8f['shift']());}};_0x5a9927(++_0x4b9aea);}(_0xa380,0x153));var _0x0a38=function(_0x2a5863,_0x22bfdc){_0x2a5863=_0x2a5863-0x0;var _0x4c4e00=_0xa380[_0x2a5863];return _0x4c4e00;};'use strict';function FaxAccount(_0x5a8adc){this['id']=_0x5a8adc['id']||0x0;this[_0x0a38('0x0')]=_0x5a8adc[_0x0a38('0x0')]||'';this[_0x0a38('0x1')]=_0x5a8adc['description'];this['ecm']=_0x5a8adc['ecm'];this[_0x0a38('0x2')]=_0x5a8adc[_0x0a38('0x2')];this[_0x0a38('0x3')]=_0x5a8adc[_0x0a38('0x3')];this[_0x0a38('0x4')]=_0x5a8adc['minrate']||0x960;this[_0x0a38('0x5')]=_0x5a8adc[_0x0a38('0x5')]||0x3840;this[_0x0a38('0x6')]=_0x5a8adc[_0x0a38('0x6')]||'v17,v27,v29';this['gateway']=_0x5a8adc[_0x0a38('0x7')]||'no';this[_0x0a38('0x8')]=_0x5a8adc[_0x0a38('0x8')]||'no';this[_0x0a38('0x9')]=_0x5a8adc[_0x0a38('0x9')]||0x1388;this[_0x0a38('0xa')]=_0x5a8adc[_0x0a38('0xa')]||'SIP';this[_0x0a38('0xb')]=_0x5a8adc[_0x0a38('0xb')]?_0x5a8adc[_0x0a38('0xb')]:undefined;this[_0x0a38('0xc')]=_0x5a8adc[_0x0a38('0xc')];this['key']=_0x5a8adc['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x0626=['description','ecm','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x5bfa94,_0x5cebe2){var _0x240d7f=function(_0x774e1e){while(--_0x774e1e){_0x5bfa94['push'](_0x5bfa94['shift']());}};_0x240d7f(++_0x5cebe2);}(_0x0626,0x1ef));var _0x6062=function(_0x26109e,_0x23a438){_0x26109e=_0x26109e-0x0;var _0x4e29be=_0x0626[_0x26109e];return _0x4e29be;};'use strict';function FaxAccount(_0x58f44d){this['id']=_0x58f44d['id']||0x0;this[_0x6062('0x0')]=_0x58f44d[_0x6062('0x0')]||'';this[_0x6062('0x1')]=_0x58f44d[_0x6062('0x1')];this[_0x6062('0x2')]=_0x58f44d[_0x6062('0x2')];this['headerinfo']=_0x58f44d['headerinfo'];this[_0x6062('0x3')]=_0x58f44d['localstationid'];this[_0x6062('0x4')]=_0x58f44d[_0x6062('0x4')]||0x960;this[_0x6062('0x5')]=_0x58f44d[_0x6062('0x5')]||0x3840;this['modem']=_0x58f44d[_0x6062('0x6')]||'v17,v27,v29';this[_0x6062('0x7')]=_0x58f44d[_0x6062('0x7')]||'no';this[_0x6062('0x8')]=_0x58f44d[_0x6062('0x8')]||'no';this['t38timeout']=_0x58f44d[_0x6062('0x9')]||0x1388;this[_0x6062('0xa')]=_0x58f44d[_0x6062('0xa')]||_0x6062('0xb');this[_0x6062('0xc')]=_0x58f44d[_0x6062('0xc')]?_0x58f44d[_0x6062('0xc')]:undefined;this[_0x6062('0xd')]=_0x58f44d[_0x6062('0xd')];this[_0x6062('0xe')]=_0x58f44d[_0x6062('0xe')];}module[_0x6062('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index db5c313..e0f1357 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 _0xc76a=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0xc7ac87,_0x2f8b4d){var _0x20cf60=function(_0x1035cb){while(--_0x1035cb){_0xc7ac87['push'](_0xc7ac87['shift']());}};_0x20cf60(++_0x2f8b4d);}(_0xc76a,0x1d3));var _0xac76=function(_0x374754,_0x35921e){_0x374754=_0x374754-0x0;var _0x1d203f=_0xc76a[_0x374754];return _0x1d203f;};'use strict';function FreshdeskAccount(_0x4283eb){this['id']=_0x4283eb['id']||0x0;this['name']=_0x4283eb[_0xac76('0x0')]||'';this[_0xac76('0x1')]=_0x4283eb['username']||'';this[_0xac76('0x2')]=_0x4283eb[_0xac76('0x3')]||'';this[_0xac76('0x4')]=_0x4283eb[_0xac76('0x4')]||'';this[_0xac76('0x5')]=_0x4283eb[_0xac76('0x5')]||'';this['Configurations']=_0x4283eb[_0xac76('0x6')]||{};}module[_0xac76('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x8efb=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8efb,0x191));var _0xb8ef=function(_0xac6926,_0x1db50b){_0xac6926=_0xac6926-0x0;var _0x14b67f=_0x8efb[_0xac6926];return _0x14b67f;};'use strict';function FreshdeskAccount(_0x4d9b92){this['id']=_0x4d9b92['id']||0x0;this[_0xb8ef('0x0')]=_0x4d9b92['name']||'';this['username']=_0x4d9b92[_0xb8ef('0x1')]||'';this[_0xb8ef('0x2')]=_0x4d9b92[_0xb8ef('0x3')]||'';this[_0xb8ef('0x4')]=_0x4d9b92['remoteUri']||'';this['serverUrl']=_0x4d9b92[_0xb8ef('0x5')]||'';this['Configurations']=_0x4d9b92[_0xb8ef('0x6')]||{};}module[_0xb8ef('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 1dca2e9..92f0e18 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 _0x602e=['name','username','apiKey','remoteUri','Configurations','exports'];(function(_0x275c8d,_0x12caef){var _0x30c4eb=function(_0x5ebaf3){while(--_0x5ebaf3){_0x275c8d['push'](_0x275c8d['shift']());}};_0x30c4eb(++_0x12caef);}(_0x602e,0x108));var _0xe602=function(_0x328bd3,_0x9cf5a5){_0x328bd3=_0x328bd3-0x0;var _0x458149=_0x602e[_0x328bd3];return _0x458149;};'use strict';function FreshsalesAccount(_0x1e7bf6){this['id']=_0x1e7bf6['id']||0x0;this['name']=_0x1e7bf6[_0xe602('0x0')]||'';this[_0xe602('0x1')]=_0x1e7bf6['username']||'';this[_0xe602('0x2')]=_0x1e7bf6['token']||'';this[_0xe602('0x3')]=_0x1e7bf6[_0xe602('0x3')]||'';this['serverUrl']=_0x1e7bf6['serverUrl']||'';this[_0xe602('0x4')]=_0x1e7bf6[_0xe602('0x4')]||{};}module[_0xe602('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0xbde4=['exports','name','username','apiKey','token','Configurations'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xbde4,0x1a5));var _0x4bde=function(_0x3f76ab,_0x593837){_0x3f76ab=_0x3f76ab-0x0;var _0xcb666f=_0xbde4[_0x3f76ab];return _0xcb666f;};'use strict';function FreshsalesAccount(_0x14a306){this['id']=_0x14a306['id']||0x0;this[_0x4bde('0x0')]=_0x14a306[_0x4bde('0x0')]||'';this[_0x4bde('0x1')]=_0x14a306[_0x4bde('0x1')]||'';this[_0x4bde('0x2')]=_0x14a306[_0x4bde('0x3')]||'';this['remoteUri']=_0x14a306['remoteUri']||'';this['serverUrl']=_0x14a306['serverUrl']||'';this['Configurations']=_0x14a306[_0x4bde('0x4')]||{};}module[_0x4bde('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 0d5b7fc..2e9df2b 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 _0x4916=['uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','mohtime','variables','exports','type','inbound'];(function(_0x491514,_0x55e112){var _0x1e1df0=function(_0x4f5a7d){while(--_0x4f5a7d){_0x491514['push'](_0x491514['shift']());}};_0x1e1df0(++_0x55e112);}(_0x4916,0x12a));var _0x6491=function(_0x32eb1f,_0x1fc0a6){_0x32eb1f=_0x32eb1f-0x0;var _0x47ff8f=_0x4916[_0x32eb1f];return _0x47ff8f;};'use strict';function QueueReport(){this[_0x6491('0x0')]=_0x6491('0x1');this[_0x6491('0x2')]='';this[_0x6491('0x3')]='';this['calleridname']='';this[_0x6491('0x4')]='';this[_0x6491('0x5')]=null;this[_0x6491('0x6')]=null;this[_0x6491('0x7')]=0x1;this[_0x6491('0x8')]=0x1;this[_0x6491('0x9')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x6491('0xa')]=null;this[_0x6491('0xb')]=![];this['queuecallerexitAt']=null;this[_0x6491('0xc')]=0x1;this[_0x6491('0xd')]='';this[_0x6491('0xe')]='';this[_0x6491('0xf')]='';this[_0x6491('0x10')]='';this[_0x6491('0x11')]='';this[_0x6491('0x12')]='';this[_0x6491('0x13')]='';this[_0x6491('0x14')]=0x0;this['assigned']=![];this[_0x6491('0x15')]='';this[_0x6491('0x16')]=0x0;this[_0x6491('0x17')]={};}module[_0x6491('0x18')]=QueueReport; \ No newline at end of file +var _0x363f=['originalposition','channel','connectedlinename','context','exten','priority','holdtime','assigned','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallercomplete','queuecallerexit'];(function(_0x33be02,_0x1cca56){var _0x4f8de0=function(_0x3ba5a0){while(--_0x3ba5a0){_0x33be02['push'](_0x33be02['shift']());}};_0x4f8de0(++_0x1cca56);}(_0x363f,0x13f));var _0xf363=function(_0x539fa8,_0x334b54){_0x539fa8=_0x539fa8-0x0;var _0x4f90bc=_0x363f[_0x539fa8];return _0x4f90bc;};'use strict';function QueueReport(){this[_0xf363('0x0')]=_0xf363('0x1');this[_0xf363('0x2')]='';this[_0xf363('0x3')]='';this['calleridname']='';this[_0xf363('0x4')]='';this[_0xf363('0x5')]=null;this[_0xf363('0x6')]=null;this[_0xf363('0x7')]=0x1;this['count']=0x1;this[_0xf363('0x8')]=![];this['queuecallerabandonAt']=null;this[_0xf363('0x9')]=![];this['queuecallercompleteAt']=null;this[_0xf363('0xa')]=![];this['queuecallerexitAt']=null;this[_0xf363('0xb')]=0x1;this[_0xf363('0xc')]='';this['connectedlinenum']='';this[_0xf363('0xd')]='';this['accountcode']='';this[_0xf363('0xe')]='';this[_0xf363('0xf')]='';this[_0xf363('0x10')]='';this[_0xf363('0x11')]=0x0;this[_0xf363('0x12')]=![];this['lastAssignedTo']='';this[_0xf363('0x13')]=0x0;this[_0xf363('0x14')]={};}module[_0xf363('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index febfdd4..9869794 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 _0x1892=['remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username'];(function(_0x341837,_0x52e151){var _0x3fe92a=function(_0x38200c){while(--_0x38200c){_0x341837['push'](_0x341837['shift']());}};_0x3fe92a(++_0x52e151);}(_0x1892,0x8d));var _0x2189=function(_0x559fb6,_0x29408b){_0x559fb6=_0x559fb6-0x0;var _0x270b89=_0x1892[_0x559fb6];return _0x270b89;};'use strict';function SalesforceAccount(_0x21cb2d){this['id']=_0x21cb2d['id']||0x0;this['name']=_0x21cb2d[_0x2189('0x0')]||'';this[_0x2189('0x1')]=_0x21cb2d['username']||'';this[_0x2189('0x2')]=_0x21cb2d[_0x2189('0x2')]||'';this['password']=_0x21cb2d[_0x2189('0x3')]||'';this[_0x2189('0x4')]=_0x21cb2d[_0x2189('0x4')]||'';this[_0x2189('0x5')]=_0x21cb2d[_0x2189('0x5')]||'';this[_0x2189('0x6')]=_0x21cb2d[_0x2189('0x6')]||'';this[_0x2189('0x7')]=_0x21cb2d[_0x2189('0x7')]||'integrationTab';this[_0x2189('0x8')]=_0x21cb2d[_0x2189('0x8')]||'';this[_0x2189('0x9')]=_0x21cb2d[_0x2189('0x9')]||{};}module[_0x2189('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xb5e5=['password','clientSecret','securityToken','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb5e5,0x12f));var _0x5b5e=function(_0x33c602,_0x3b40a3){_0x33c602=_0x33c602-0x0;var _0x1be326=_0xb5e5[_0x33c602];return _0x1be326;};'use strict';function SalesforceAccount(_0x1f160a){this['id']=_0x1f160a['id']||0x0;this['name']=_0x1f160a[_0x5b5e('0x0')]||'';this[_0x5b5e('0x1')]=_0x1f160a[_0x5b5e('0x1')]||'';this[_0x5b5e('0x2')]=_0x1f160a['remoteUri']||'';this[_0x5b5e('0x3')]=_0x1f160a[_0x5b5e('0x3')]||'';this['clientId']=_0x1f160a['clientId']||'';this[_0x5b5e('0x4')]=_0x1f160a[_0x5b5e('0x4')]||'';this[_0x5b5e('0x5')]=_0x1f160a['securityToken']||'';this[_0x5b5e('0x6')]=_0x1f160a[_0x5b5e('0x6')]||'integrationTab';this[_0x5b5e('0x7')]=_0x1f160a[_0x5b5e('0x7')]||'';this[_0x5b5e('0x8')]=_0x1f160a[_0x5b5e('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index da490ae..97bb510 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 _0xeaed=['password','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x33e38f,_0x470253){var _0x3afcfa=function(_0x3a558c){while(--_0x3a558c){_0x33e38f['push'](_0x33e38f['shift']());}};_0x3afcfa(++_0x470253);}(_0xeaed,0x15b));var _0xdeae=function(_0xe2941b,_0xc5bf1){_0xe2941b=_0xe2941b-0x0;var _0x515196=_0xeaed[_0xe2941b];return _0x515196;};'use strict';function ServicenowAccount(_0x353929){this['id']=_0x353929['id']||0x0;this['name']=_0x353929['name']||'';this['username']=_0x353929[_0xdeae('0x0')]||'';this[_0xdeae('0x1')]=_0x353929['password']||'';this[_0xdeae('0x2')]=_0x353929['remoteUri']||'';this[_0xdeae('0x3')]=_0x353929[_0xdeae('0x3')]||'';this[_0xdeae('0x4')]=_0x353929[_0xdeae('0x4')]||{};}module[_0xdeae('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x670e=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x670e,0x118));var _0xe670=function(_0x1fae38,_0x3d9fcc){_0x1fae38=_0x1fae38-0x0;var _0x244017=_0x670e[_0x1fae38];return _0x244017;};'use strict';function ServicenowAccount(_0x421085){this['id']=_0x421085['id']||0x0;this['name']=_0x421085[_0xe670('0x0')]||'';this[_0xe670('0x1')]=_0x421085[_0xe670('0x1')]||'';this[_0xe670('0x2')]=_0x421085[_0xe670('0x2')]||'';this[_0xe670('0x3')]=_0x421085[_0xe670('0x3')]||'';this[_0xe670('0x4')]=_0x421085[_0xe670('0x4')]||'';this[_0xe670('0x5')]=_0x421085[_0xe670('0x5')]||{};}module[_0xe670('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 66bac69..5ef97de 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 _0xe23c=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2c5d09,_0x104b0e){var _0x23f99d=function(_0x3bca0b){while(--_0x3bca0b){_0x2c5d09['push'](_0x2c5d09['shift']());}};_0x23f99d(++_0x104b0e);}(_0xe23c,0x15b));var _0xce23=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0xe23c[_0x4d8666];return _0x37175b;};'use strict';function SugarcrmAccount(_0x4c10e6){this['id']=_0x4c10e6['id']||0x0;this[_0xce23('0x0')]=_0x4c10e6['name']||'';this['username']=_0x4c10e6[_0xce23('0x1')]||'';this['password']=_0x4c10e6['password']||'';this[_0xce23('0x2')]=_0x4c10e6[_0xce23('0x2')]||'';this[_0xce23('0x3')]=_0x4c10e6['serverUrl']||'';this[_0xce23('0x4')]=_0x4c10e6[_0xce23('0x4')]||{};}module[_0xce23('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x3e71=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x1683cf,_0x20b3cb){var _0x1159ad=function(_0x241e90){while(--_0x241e90){_0x1683cf['push'](_0x1683cf['shift']());}};_0x1159ad(++_0x20b3cb);}(_0x3e71,0x149));var _0x13e7=function(_0x100443,_0x18748a){_0x100443=_0x100443-0x0;var _0x5369e7=_0x3e71[_0x100443];return _0x5369e7;};'use strict';function SugarcrmAccount(_0x3f108b){this['id']=_0x3f108b['id']||0x0;this['name']=_0x3f108b[_0x13e7('0x0')]||'';this[_0x13e7('0x1')]=_0x3f108b[_0x13e7('0x1')]||'';this[_0x13e7('0x2')]=_0x3f108b[_0x13e7('0x2')]||'';this['remoteUri']=_0x3f108b[_0x13e7('0x3')]||'';this[_0x13e7('0x4')]=_0x3f108b[_0x13e7('0x4')]||'';this[_0x13e7('0x5')]=_0x3f108b[_0x13e7('0x5')]||{};}module[_0x13e7('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index f8aa569..b0af5b8 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 _0x01f3=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x1a3aec,_0x1e36b2){var _0x6ed1bc=function(_0x165abb){while(--_0x165abb){_0x1a3aec['push'](_0x1a3aec['shift']());}};_0x6ed1bc(++_0x1e36b2);}(_0x01f3,0xa8));var _0x301f=function(_0x4fb789,_0x6b8092){_0x4fb789=_0x4fb789-0x0;var _0x49b5e4=_0x01f3[_0x4fb789];return _0x49b5e4;};'use strict';function Telephone(_0x1ce259){this['id']=_0x1ce259['id']||0x0;this[_0x301f('0x0')]=_0x1ce259[_0x301f('0x0')]||'';this['accountcode']=_0x1ce259[_0x301f('0x1')]||'';this[_0x301f('0x2')]=_0x301f('0x3');this[_0x301f('0x4')]=0x0;this[_0x301f('0x5')]=_0x301f('0x3');this[_0x301f('0x6')]='';}module[_0x301f('0x7')]=Telephone; \ No newline at end of file +var _0x10a8=['exports','name','accountcode','unknown','stateTime'];(function(_0x2f800c,_0x2a7f05){var _0x1268ca=function(_0x3cc49f){while(--_0x3cc49f){_0x2f800c['push'](_0x2f800c['shift']());}};_0x1268ca(++_0x2a7f05);}(_0x10a8,0x119));var _0x810a=function(_0x2e85cc,_0xc500b5){_0x2e85cc=_0x2e85cc-0x0;var _0x2adc53=_0x10a8[_0x2e85cc];return _0x2adc53;};'use strict';function Telephone(_0x4971c8){this['id']=_0x4971c8['id']||0x0;this[_0x810a('0x0')]=_0x4971c8[_0x810a('0x0')]||'';this['accountcode']=_0x4971c8[_0x810a('0x1')]||'';this['state']=_0x810a('0x2');this[_0x810a('0x3')]=0x0;this['status']=_0x810a('0x2');this['address']='';}module[_0x810a('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 94d1d92..9a58926 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 _0x5b92=['exports','name','html'];(function(_0x2d2e0d,_0x2bf907){var _0x103367=function(_0x14299c){while(--_0x14299c){_0x2d2e0d['push'](_0x2d2e0d['shift']());}};_0x103367(++_0x2bf907);}(_0x5b92,0xdf));var _0x25b9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5b92[_0x3947c9];return _0x2e7871;};'use strict';function template(_0x24716c){this['id']=_0x24716c['id']||0x0;this[_0x25b9('0x0')]=_0x24716c['name']||'';this[_0x25b9('0x1')]=_0x24716c[_0x25b9('0x1')]||'';}module[_0x25b9('0x2')]=template; \ No newline at end of file +var _0xa3b3=['name','html','exports'];(function(_0x5712d6,_0x240ceb){var _0x370a53=function(_0x4a0ddf){while(--_0x4a0ddf){_0x5712d6['push'](_0x5712d6['shift']());}};_0x370a53(++_0x240ceb);}(_0xa3b3,0x81));var _0x3a3b=function(_0x438a27,_0x2718fd){_0x438a27=_0x438a27-0x0;var _0x4e45dd=_0xa3b3[_0x438a27];return _0x4e45dd;};'use strict';function template(_0x188aba){this['id']=_0x188aba['id']||0x0;this[_0x3a3b('0x0')]=_0x188aba['name']||'';this[_0x3a3b('0x1')]=_0x188aba[_0x3a3b('0x1')]||'';}module[_0x3a3b('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 e22fea7..5c88160 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 _0x00bb=['status','AllConditions','AnyConditions','exports','name','channel'];(function(_0x1436c7,_0x242c82){var _0x520fbf=function(_0x236011){while(--_0x236011){_0x1436c7['push'](_0x1436c7['shift']());}};_0x520fbf(++_0x242c82);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';function Trigger(_0x4b870b){this['id']=_0x4b870b['id']||0x0;this[_0xb00b('0x0')]=_0x4b870b[_0xb00b('0x0')]||'';this['channel']=_0x4b870b[_0xb00b('0x1')]||'voice';this[_0xb00b('0x2')]=_0x4b870b[_0xb00b('0x2')]||![];this['AllConditions']=_0x4b870b[_0xb00b('0x3')]||[];this[_0xb00b('0x4')]=_0x4b870b['AnyConditions']||[];this['Actions']=_0x4b870b['Actions']||[];}module[_0xb00b('0x5')]=Trigger; \ No newline at end of file +var _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x19763d,_0xe6a0cf){var _0x22189a=function(_0x4dbabc){while(--_0x4dbabc){_0x19763d['push'](_0x19763d['shift']());}};_0x22189a(++_0xe6a0cf);}(_0x4b84,0x1cc));var _0x44b8=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x4b84[_0x487ab4];return _0x3bef77;};'use strict';function Trigger(_0x90ff31){this['id']=_0x90ff31['id']||0x0;this[_0x44b8('0x0')]=_0x90ff31['name']||'';this['channel']=_0x90ff31[_0x44b8('0x1')]||'voice';this['status']=_0x90ff31[_0x44b8('0x2')]||![];this[_0x44b8('0x3')]=_0x90ff31[_0x44b8('0x3')]||[];this['AnyConditions']=_0x90ff31['AnyConditions']||[];this['Actions']=_0x90ff31[_0x44b8('0x4')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index e69c6dd..cd5f83f 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 _0x55c7=['registry','indexOf','host','port','refresh','registrationtime','exports','active','name','state','unknown','status'];(function(_0x55c669,_0xbfa424){var _0x4f6b43=function(_0x3a83f4){while(--_0x3a83f4){_0x55c669['push'](_0x55c669['shift']());}};_0x4f6b43(++_0xbfa424);}(_0x55c7,0x127));var _0x755c=function(_0x9cc6a1,_0x176dc3){_0x9cc6a1=_0x9cc6a1-0x0;var _0x435800=_0x55c7[_0x9cc6a1];return _0x435800;};'use strict';function Trunk(_0x49c835){this['id']=_0x49c835['id']||0x0;this[_0x755c('0x0')]=_0x49c835[_0x755c('0x0')]||![];this[_0x755c('0x1')]=_0x49c835[_0x755c('0x1')]||'';this[_0x755c('0x2')]=_0x755c('0x3');this['stateTime']=0x0;this[_0x755c('0x4')]='unknown';this[_0x755c('0x5')]=_0x49c835['registry']&&_0x49c835[_0x755c('0x5')][_0x755c('0x6')](':')?_0x49c835[_0x755c('0x5')]['split'](':')[0x0]:'';this[_0x755c('0x7')]='';this[_0x755c('0x8')]='';this['domain']='';this['domainport']='';this[_0x755c('0x9')]='';this['stateRegistry']=_0x755c('0x3');this[_0x755c('0xa')]='';this['address']='';}module[_0x755c('0xb')]=Trunk; \ No newline at end of file +var _0xc833=['active','name','state','stateTime','unknown','registry','split','host','port','domainport','refresh'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0xc833,0x1d9));var _0x3c83=function(_0x1a2c2a,_0x37e7c5){_0x1a2c2a=_0x1a2c2a-0x0;var _0x46eeb0=_0xc833[_0x1a2c2a];return _0x46eeb0;};'use strict';function Trunk(_0x40dc44){this['id']=_0x40dc44['id']||0x0;this['active']=_0x40dc44[_0x3c83('0x0')]||![];this[_0x3c83('0x1')]=_0x40dc44['name']||'';this[_0x3c83('0x2')]='unknown';this[_0x3c83('0x3')]=0x0;this['status']=_0x3c83('0x4');this[_0x3c83('0x5')]=_0x40dc44['registry']&&_0x40dc44[_0x3c83('0x5')]['indexOf'](':')?_0x40dc44['registry'][_0x3c83('0x6')](':')[0x0]:'';this[_0x3c83('0x7')]='';this[_0x3c83('0x8')]='';this['domain']='';this[_0x3c83('0x9')]='';this[_0x3c83('0xa')]='';this['stateRegistry']='unknown';this['registrationtime']='';this['address']='';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 5917828..485c090 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 _0x6d76=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d76,0xee));var _0x66d7=function(_0x2087e6,_0x4e7e98){_0x2087e6=_0x2087e6-0x0;var _0x740ed2=_0x6d76[_0x2087e6];return _0x740ed2;};'use strict';function voiceExtension(_0x58499a){this['id']=_0x58499a['id']||0x0;this[_0x66d7('0x0')]=_0x58499a[_0x66d7('0x0')]||'';this[_0x66d7('0x1')]=_0x58499a[_0x66d7('0x1')]||'none';this[_0x66d7('0x2')]=_0x58499a['mandatoryDisposition']||![];}module[_0x66d7('0x3')]=voiceExtension; \ No newline at end of file +var _0xbe4b=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x57e37a,_0x1d64b4){var _0x4ed71c=function(_0xb8c843){while(--_0xb8c843){_0x57e37a['push'](_0x57e37a['shift']());}};_0x4ed71c(++_0x1d64b4);}(_0xbe4b,0x1cf));var _0xbbe4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xbe4b[_0x465a0c];return _0x1e202e;};'use strict';function voiceExtension(_0x18bd58){this['id']=_0x18bd58['id']||0x0;this[_0xbbe4('0x0')]=_0x18bd58[_0xbbe4('0x0')]||'';this[_0xbbe4('0x1')]=_0x18bd58['recordingFormat']||'none';this['mandatoryDisposition']=_0x18bd58[_0xbbe4('0x2')]||![];}module[_0xbbe4('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 0e25855..ced4ae2 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 _0x8cde=['not_inuse','inuse','busy','ringing','ringinuse','wav49','gsm','name','monitor_format','type','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x8cde,0x78));var _0xe8cd=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0x8cde[_0x12d6c2];return _0x1c9825;};'use strict';var statusDesc=[_0xe8cd('0x0'),_0xe8cd('0x1'),_0xe8cd('0x2'),_0xe8cd('0x3'),'invalid','unavailable',_0xe8cd('0x4'),_0xe8cd('0x5'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0xe8cd('0x6'),'gsm':_0xe8cd('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x42f772){this['id']=_0x42f772['id']||0x0;this[_0xe8cd('0x8')]=_0x42f772[_0xe8cd('0x8')]||'';this[_0xe8cd('0x9')]=_0x42f772['monitor_format']||'';this[_0xe8cd('0xa')]=_0x42f772[_0xe8cd('0xa')]||'inbound';this['waiting']=0x0;this[_0xe8cd('0xb')]=0x0;this[_0xe8cd('0xc')]=0x0;this[_0xe8cd('0xd')]=0x0;this[_0xe8cd('0xe')]=0x0;this[_0xe8cd('0xf')]=0x0;this[_0xe8cd('0x10')]=0x0;this[_0xe8cd('0x11')]=0x0;this[_0xe8cd('0x12')]=0x0;this[_0xe8cd('0x13')]=0x0;this[_0xe8cd('0x14')]=0x0;this['acw']=_0x42f772[_0xe8cd('0x15')]||![];this[_0xe8cd('0x16')]=_0x42f772[_0xe8cd('0x16')]||0xa;this['autopause']=_0x42f772[_0xe8cd('0x17')]||'no';this[_0xe8cd('0x18')]=!![];this[_0xe8cd('0x19')]='';this[_0xe8cd('0x1a')]=0x0;this[_0xe8cd('0x1b')]=0x0;this[_0xe8cd('0x1c')]=_0x42f772[_0xe8cd('0x1c')]||null;this[_0xe8cd('0x1d')]=_0x42f772[_0xe8cd('0x1d')]?_0x42f772[_0xe8cd('0x1d')]:null;this[_0xe8cd('0x1e')]=_0x42f772[_0xe8cd('0x1e')];this[_0xe8cd('0x1f')]=_0x42f772['dialMethod']||_0xe8cd('0x20');this[_0xe8cd('0x21')]=_0x42f772[_0xe8cd('0x21')]||0x0;this['dialLimitQueue']=_0x42f772[_0xe8cd('0x22')]||0x0;this[_0xe8cd('0x23')]=_0x42f772[_0xe8cd('0x23')]||0x1;this['dialPredictiveOptimization']=_0x42f772[_0xe8cd('0x24')]||_0xe8cd('0x25');this[_0xe8cd('0x26')]=_0x42f772[_0xe8cd('0x26')]||0.03;this[_0xe8cd('0x27')]=_0x42f772['dialPredictiveInterval']||0x258;this[_0xe8cd('0x28')]=_0x42f772[_0xe8cd('0x28')]||'anonymous';this[_0xe8cd('0x29')]=_0x42f772[_0xe8cd('0x29')]||'anonymous';this[_0xe8cd('0x2a')]=_0x42f772['dialOriginateTimeout']||0x1e;this[_0xe8cd('0x2b')]=_0x42f772[_0xe8cd('0x2b')]||_0xe8cd('0x2c');this['dialQueueTimeout']=_0x42f772[_0xe8cd('0x2d')]||0x3;this[_0xe8cd('0x2e')]=_0x42f772['dialQueueProject']||undefined;this[_0xe8cd('0x2f')]=_0x42f772['dialCongestionMaxRetry']||0x3;this[_0xe8cd('0x30')]=_0x42f772[_0xe8cd('0x30')]||0x96;this[_0xe8cd('0x31')]=_0x42f772[_0xe8cd('0x31')]||0x3;this[_0xe8cd('0x32')]=_0x42f772[_0xe8cd('0x32')]||0x96;this[_0xe8cd('0x33')]=_0x42f772[_0xe8cd('0x33')]||0x3;this[_0xe8cd('0x34')]=_0x42f772[_0xe8cd('0x34')]||0x96;this[_0xe8cd('0x35')]=_0x42f772[_0xe8cd('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x42f772[_0xe8cd('0x36')]||0x96;this['dialDropMaxRetry']=_0x42f772['dialDropMaxRetry']||0x3;this[_0xe8cd('0x37')]=_0x42f772[_0xe8cd('0x37')]||0x96;this[_0xe8cd('0x38')]=_0x42f772[_0xe8cd('0x38')]||0x3;this['dialAbandonedRetryFrequency']=_0x42f772[_0xe8cd('0x39')]||0x96;this[_0xe8cd('0x3a')]=_0x42f772[_0xe8cd('0x3a')]||0x3;this[_0xe8cd('0x3b')]=_0x42f772[_0xe8cd('0x3b')]||0x96;this[_0xe8cd('0x3c')]=_0x42f772[_0xe8cd('0x3c')]||0x3;this[_0xe8cd('0x3d')]=_0x42f772[_0xe8cd('0x3d')]||0x96;this[_0xe8cd('0x3e')]=_0x42f772[_0xe8cd('0x3e')]||0x4;this[_0xe8cd('0x3f')]=_0x42f772[_0xe8cd('0x3f')]?_0x42f772['Trunk']:undefined;this[_0xe8cd('0x40')]=_0x42f772[_0xe8cd('0x40')]?_0x42f772[_0xe8cd('0x40')]:undefined;this['dialPrefix']=_0x42f772[_0xe8cd('0x41')]||undefined;this[_0xe8cd('0x42')]=_0x42f772['Interval']?_0x42f772[_0xe8cd('0x42')]:undefined;this['dialOrderByScheduledAt']=_0x42f772[_0xe8cd('0x43')]||'DESC';this[_0xe8cd('0x44')]=_0x42f772[_0xe8cd('0x44')]||undefined;this[_0xe8cd('0x45')]=_0x42f772[_0xe8cd('0x45')]||undefined;this['strategy']=strategy[_0x42f772[_0xe8cd('0x46')]]||_0xe8cd('0x47');this[_0xe8cd('0x48')]=!![];this[_0xe8cd('0x49')]=_0x42f772['dialAMDActive']||![];this[_0xe8cd('0x4a')]=_0x42f772['dialAMDInitialSilence'];this[_0xe8cd('0x4b')]=_0x42f772[_0xe8cd('0x4b')];this[_0xe8cd('0x4c')]=_0x42f772[_0xe8cd('0x4c')];this[_0xe8cd('0x4d')]=_0x42f772['dialAMDTotalAnalysisTime'];this[_0xe8cd('0x4e')]=_0x42f772['dialAMDMinWordLength'];this[_0xe8cd('0x4f')]=_0x42f772[_0xe8cd('0x4f')];this['dialAMDMaximumNumberOfWords']=_0x42f772[_0xe8cd('0x50')];this[_0xe8cd('0x51')]=_0x42f772['dialAMDSilenceThreshold'];this[_0xe8cd('0x52')]=_0x42f772[_0xe8cd('0x52')];this[_0xe8cd('0x53')]=0x0;this['pTalking']=0x0;this[_0xe8cd('0x54')]=_0x42f772[_0xe8cd('0x54')];this[_0xe8cd('0x55')]=0x0;this[_0xe8cd('0x56')]=0x0;this[_0xe8cd('0x57')]=0x0;this[_0xe8cd('0x58')]=0x0;this[_0xe8cd('0x59')]=0x0;this[_0xe8cd('0x5a')]=0x0;this[_0xe8cd('0x5b')]=0x0;this[_0xe8cd('0x5c')]=0x0;this[_0xe8cd('0x5d')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xe8cd('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xe8cd('0x5f')]=0x0;this[_0xe8cd('0x60')]=0x0;this[_0xe8cd('0x61')]=undefined;this['startPredictive']=undefined;this[_0xe8cd('0x62')]=undefined;this[_0xe8cd('0x63')]=1.05;this[_0xe8cd('0x64')]=0x0;this[_0xe8cd('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xe8cd('0x66')]=0x0;this[_0xe8cd('0x67')]=0x0;this[_0xe8cd('0x68')]=0x0;this[_0xe8cd('0x69')]=0x0;this[_0xe8cd('0x6a')]=0x0;this[_0xe8cd('0x6b')]=_0x42f772['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x42f772[_0xe8cd('0x6c')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xe8cd('0x6d')]=0x0;this[_0xe8cd('0x6e')]=0x1;this[_0xe8cd('0x6f')]=0x0;this[_0xe8cd('0x70')]=0x0;this[_0xe8cd('0x71')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x42f772[_0xe8cd('0x72')]||0x1e;this[_0xe8cd('0x73')]=_0x42f772[_0xe8cd('0x73')]||![];this[_0xe8cd('0x74')]=_0x42f772['dialQueueProject2']||undefined;this[_0xe8cd('0x75')]=_0x42f772[_0xe8cd('0x75')]||![];this[_0xe8cd('0x76')]=_0x42f772['dialAgiAfterHangupAgent']||![];this[_0xe8cd('0x9')]=monitorFormat[_0x42f772[_0xe8cd('0x9')]]?monitorFormat[_0x42f772['monitor_format']]:undefined;this[_0xe8cd('0x77')]=_0x42f772['mandatoryDisposition']||![];this[_0xe8cd('0x78')]=_0x42f772[_0xe8cd('0x78')]?_0x42f772[_0xe8cd('0x78')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x13c3=['predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','unavailable','ringinuse','onhold','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls'];(function(_0x11b3f4,_0x371c17){var _0x47af1d=function(_0x11d38d){while(--_0x11d38d){_0x11b3f4['push'](_0x11b3f4['shift']());}};_0x47af1d(++_0x371c17);}(_0x13c3,0x81));var _0x313c=function(_0x5228a8,_0x11a1a4){_0x5228a8=_0x5228a8-0x0;var _0x4b99a3=_0x13c3[_0x5228a8];return _0x4b99a3;};'use strict';var statusDesc=['unknown',_0x313c('0x0'),_0x313c('0x1'),'busy','invalid',_0x313c('0x2'),'ringing',_0x313c('0x3'),_0x313c('0x4')];var monitorFormat={'wav':'wav','wav49':_0x313c('0x5'),'gsm':'gsm'};var strategy={'rrmemory':_0x313c('0x6'),'roundrobin':_0x313c('0x7')};function VoiceQueue(_0x166c66){this['id']=_0x166c66['id']||0x0;this[_0x313c('0x8')]=_0x166c66['name']||'';this[_0x313c('0x9')]=_0x166c66[_0x313c('0x9')]||'';this[_0x313c('0xa')]=_0x166c66[_0x313c('0xa')]||_0x313c('0xb');this[_0x313c('0xc')]=0x0;this['talking']=0x0;this['total']=0x0;this[_0x313c('0xd')]=0x0;this['sumDuration']=0x0;this[_0x313c('0xe')]=0x0;this[_0x313c('0xf')]=0x0;this[_0x313c('0x10')]=0x0;this[_0x313c('0x11')]=0x0;this['loggedIn']=0x0;this[_0x313c('0x12')]=0x0;this[_0x313c('0x13')]=_0x166c66[_0x313c('0x13')]||![];this['acwTimeout']=_0x166c66['acwTimeout']||0xa;this[_0x313c('0x14')]=_0x166c66[_0x313c('0x14')]||'no';this[_0x313c('0x15')]=!![];this[_0x313c('0x16')]='';this[_0x313c('0x17')]=0x0;this[_0x313c('0x18')]=0x0;this[_0x313c('0x19')]=_0x166c66[_0x313c('0x19')]||null;this[_0x313c('0x1a')]=_0x166c66['dialGlobalInterval']?_0x166c66[_0x313c('0x1a')]:null;this[_0x313c('0x1b')]=_0x166c66[_0x313c('0x1b')];this[_0x313c('0x1c')]=_0x166c66[_0x313c('0x1c')]||_0x313c('0x1d');this['dialLimitChannel']=_0x166c66['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x166c66[_0x313c('0x1e')]||0x0;this['dialPowerLevel']=_0x166c66[_0x313c('0x1f')]||0x1;this[_0x313c('0x20')]=_0x166c66[_0x313c('0x20')]||_0x313c('0x21');this['dialPredictiveOptimizationPercentage']=_0x166c66['dialPredictiveOptimizationPercentage']||0.03;this[_0x313c('0x22')]=_0x166c66[_0x313c('0x22')]||0x258;this[_0x313c('0x23')]=_0x166c66['dialOriginateCallerIdName']||'anonymous';this['dialOriginateCallerIdNumber']=_0x166c66[_0x313c('0x24')]||_0x313c('0x25');this[_0x313c('0x26')]=_0x166c66[_0x313c('0x26')]||0x1e;this[_0x313c('0x27')]=_0x166c66[_0x313c('0x27')]||'tTxX';this[_0x313c('0x28')]=_0x166c66[_0x313c('0x28')]||0x3;this['dialQueueProject']=_0x166c66['dialQueueProject']||undefined;this[_0x313c('0x29')]=_0x166c66['dialCongestionMaxRetry']||0x3;this[_0x313c('0x2a')]=_0x166c66[_0x313c('0x2a')]||0x96;this['dialBusyMaxRetry']=_0x166c66['dialBusyMaxRetry']||0x3;this[_0x313c('0x2b')]=_0x166c66[_0x313c('0x2b')]||0x96;this[_0x313c('0x2c')]=_0x166c66[_0x313c('0x2c')]||0x3;this[_0x313c('0x2d')]=_0x166c66['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x166c66['dialNoSuchNumberMaxRetry']||0x3;this[_0x313c('0x2e')]=_0x166c66[_0x313c('0x2e')]||0x96;this[_0x313c('0x2f')]=_0x166c66['dialDropMaxRetry']||0x3;this[_0x313c('0x30')]=_0x166c66['dialDropRetryFrequency']||0x96;this[_0x313c('0x31')]=_0x166c66['dialAbandonedMaxRetry']||0x3;this[_0x313c('0x32')]=_0x166c66[_0x313c('0x32')]||0x96;this[_0x313c('0x33')]=_0x166c66[_0x313c('0x33')]||0x3;this[_0x313c('0x34')]=_0x166c66['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x166c66[_0x313c('0x35')]||0x3;this[_0x313c('0x36')]=_0x166c66[_0x313c('0x36')]||0x96;this['dialGlobalMaxRetry']=_0x166c66[_0x313c('0x37')]||0x4;this[_0x313c('0x38')]=_0x166c66[_0x313c('0x38')]?_0x166c66['Trunk']:undefined;this[_0x313c('0x39')]=_0x166c66[_0x313c('0x39')]?_0x166c66[_0x313c('0x39')]:undefined;this[_0x313c('0x3a')]=_0x166c66[_0x313c('0x3a')]||undefined;this[_0x313c('0x3b')]=_0x166c66[_0x313c('0x3b')]?_0x166c66['Interval']:undefined;this[_0x313c('0x3c')]=_0x166c66[_0x313c('0x3c')]||_0x313c('0x3d');this['dialRandomLastDigitCallerIdNumber']=_0x166c66[_0x313c('0x3e')]||undefined;this[_0x313c('0x3f')]=_0x166c66[_0x313c('0x3f')]||undefined;this[_0x313c('0x40')]=strategy[_0x166c66['strategy']]||'rrmemory';this['queueStatusComplete']=!![];this['dialAMDActive']=_0x166c66[_0x313c('0x41')]||![];this[_0x313c('0x42')]=_0x166c66[_0x313c('0x42')];this['dialAMDGreeting']=_0x166c66[_0x313c('0x43')];this[_0x313c('0x44')]=_0x166c66[_0x313c('0x44')];this[_0x313c('0x45')]=_0x166c66['dialAMDTotalAnalysisTime'];this[_0x313c('0x46')]=_0x166c66[_0x313c('0x46')];this[_0x313c('0x47')]=_0x166c66[_0x313c('0x47')];this['dialAMDMaximumNumberOfWords']=_0x166c66[_0x313c('0x48')];this[_0x313c('0x49')]=_0x166c66[_0x313c('0x49')];this[_0x313c('0x4a')]=_0x166c66[_0x313c('0x4a')];this[_0x313c('0x4b')]=0x0;this['pTalking']=0x0;this[_0x313c('0x4c')]=_0x166c66[_0x313c('0x4c')];this[_0x313c('0x4d')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x313c('0x4e')]=0x0;this[_0x313c('0x4f')]=0x0;this[_0x313c('0x50')]=0x0;this[_0x313c('0x51')]=0x0;this[_0x313c('0x52')]=0x0;this[_0x313c('0x53')]=0x0;this[_0x313c('0x54')]=0x0;this[_0x313c('0x55')]=0x0;this[_0x313c('0x56')]=0x0;this[_0x313c('0x57')]=0x0;this[_0x313c('0x58')]=0x0;this[_0x313c('0x59')]=0x0;this[_0x313c('0x5a')]=undefined;this['startPredictive']=undefined;this[_0x313c('0x5b')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x313c('0x5c')]=0x0;this[_0x313c('0x5d')]=0x0;this[_0x313c('0x5e')]=0x0;this[_0x313c('0x5f')]=0x0;this[_0x313c('0x60')]=0x0;this[_0x313c('0x61')]=0x0;this[_0x313c('0x62')]=0x0;this[_0x313c('0x63')]=0x0;this[_0x313c('0x64')]=_0x166c66[_0x313c('0x65')]||0x14;this['predictiveIntervalMinThreshold']=_0x166c66[_0x313c('0x65')]||0xa;this[_0x313c('0x66')]=0x0;this[_0x313c('0x67')]=0x0;this[_0x313c('0x68')]=0x1;this[_0x313c('0x69')]=0x0;this['erlangCallToSecond']=0x0;this[_0x313c('0x6a')]=0x0;this[_0x313c('0x6b')]=0x0;this[_0x313c('0x6c')]=_0x166c66[_0x313c('0x6c')]||0x1e;this[_0x313c('0x6d')]=_0x166c66['dialRecallInQueue']||![];this[_0x313c('0x6e')]=_0x166c66['dialQueueProject2']||undefined;this[_0x313c('0x6f')]=_0x166c66['dialAgiAfterHangupClient']||![];this[_0x313c('0x70')]=_0x166c66[_0x313c('0x70')]||![];this[_0x313c('0x9')]=monitorFormat[_0x166c66[_0x313c('0x9')]]?monitorFormat[_0x166c66[_0x313c('0x9')]]:undefined;this[_0x313c('0x71')]=_0x166c66[_0x313c('0x71')]||![];this[_0x313c('0x72')]=_0x166c66[_0x313c('0x72')]?_0x166c66[_0x313c('0x72')]:undefined;}module[_0x313c('0x73')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 109e7d8..40ec4b4 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 _0xf17e=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x3a57b0,_0x567cdd){var _0x28bfbc=function(_0x2275f3){while(--_0x2275f3){_0x3a57b0['push'](_0x3a57b0['shift']());}};_0x28bfbc(++_0x567cdd);}(_0xf17e,0x1c1));var _0xef17=function(_0x56ea67,_0x255351){_0x56ea67=_0x56ea67-0x0;var _0x1958f7=_0xf17e[_0x56ea67];return _0x1958f7;};'use strict';function VtigerAccount(_0x56ca77){this['id']=_0x56ca77['id']||0x0;this[_0xef17('0x0')]=_0x56ca77[_0xef17('0x0')]||'';this[_0xef17('0x1')]=_0x56ca77[_0xef17('0x1')]||'';this[_0xef17('0x2')]=_0x56ca77[_0xef17('0x2')]||'';this[_0xef17('0x3')]=_0x56ca77['remoteUri']||'';this[_0xef17('0x4')]=_0x56ca77[_0xef17('0x4')]||'';this['Configurations']=_0x56ca77[_0xef17('0x5')]||{};}module[_0xef17('0x6')]=VtigerAccount; \ No newline at end of file +var _0xffe1=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x34e4be,_0x30fb59){var _0x143487=function(_0x28a7f3){while(--_0x28a7f3){_0x34e4be['push'](_0x34e4be['shift']());}};_0x143487(++_0x30fb59);}(_0xffe1,0x132));var _0x1ffe=function(_0x2cb877,_0x5799bc){_0x2cb877=_0x2cb877-0x0;var _0x4f0b56=_0xffe1[_0x2cb877];return _0x4f0b56;};'use strict';function VtigerAccount(_0x5a5661){this['id']=_0x5a5661['id']||0x0;this[_0x1ffe('0x0')]=_0x5a5661['name']||'';this[_0x1ffe('0x1')]=_0x5a5661[_0x1ffe('0x1')]||'';this[_0x1ffe('0x2')]=_0x5a5661['accessKey']||'';this[_0x1ffe('0x3')]=_0x5a5661[_0x1ffe('0x3')]||'';this[_0x1ffe('0x4')]=_0x5a5661[_0x1ffe('0x4')]||'';this['Configurations']=_0x5a5661[_0x1ffe('0x5')]||{};}module[_0x1ffe('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 5cff73b..fd938f2 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 _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x412686,_0x3fde24){_0x412686=_0x412686-0x0;var _0x18619e=_0x0b0e[_0x412686];return _0x18619e;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=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(_0x3b3297,_0x54b50b){_0x3b3297=_0x3b3297-0x0;var _0x50774d=_0xdb28[_0x3b3297];return _0x50774d;};'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 288d4a2..179b9aa 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 _0xbcae=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x139a25,_0x1707d7){var _0x330a62=function(_0x3092b4){while(--_0x3092b4){_0x139a25['push'](_0x139a25['shift']());}};_0x330a62(++_0x1707d7);}(_0xbcae,0xa9));var _0xebca=function(_0x35caba,_0x35f4a1){_0x35caba=_0x35caba-0x0;var _0x4bc428=_0xbcae[_0x35caba];return _0x4bc428;};'use strict';function ZohoAccount(_0x368872){this['id']=_0x368872['id']||0x0;this[_0xebca('0x0')]=_0x368872[_0xebca('0x0')]||'';this[_0xebca('0x1')]=_0x368872[_0xebca('0x1')]||'';this[_0xebca('0x2')]=_0x368872[_0xebca('0x2')]||'';this[_0xebca('0x3')]=_0x368872[_0xebca('0x3')]||'';this[_0xebca('0x4')]=_0x368872['clientId']||'';this[_0xebca('0x5')]=_0x368872[_0xebca('0x5')]||'';this['serverUrl']=_0x368872[_0xebca('0x6')]||'';this[_0xebca('0x7')]=_0x368872[_0xebca('0x7')]||'';this['refreshToken']=_0x368872[_0xebca('0x8')]||'';this[_0xebca('0x9')]=_0x368872[_0xebca('0x9')]||{};}module[_0xebca('0xa')]=ZohoAccount; \ No newline at end of file +var _0x5c96=['zone','clientId','clientSecret','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x8d5de5,_0x143d83){var _0x400b7d=function(_0x2abd97){while(--_0x2abd97){_0x8d5de5['push'](_0x8d5de5['shift']());}};_0x400b7d(++_0x143d83);}(_0x5c96,0x133));var _0x65c9=function(_0x1dd02a,_0x1347ca){_0x1dd02a=_0x1dd02a-0x0;var _0x18e921=_0x5c96[_0x1dd02a];return _0x18e921;};'use strict';function ZohoAccount(_0x1e81e3){this['id']=_0x1e81e3['id']||0x0;this[_0x65c9('0x0')]=_0x1e81e3[_0x65c9('0x0')]||'';this[_0x65c9('0x1')]=_0x1e81e3['description']||'';this[_0x65c9('0x2')]=_0x1e81e3[_0x65c9('0x2')]||'';this[_0x65c9('0x3')]=_0x1e81e3[_0x65c9('0x3')]||'';this[_0x65c9('0x4')]=_0x1e81e3[_0x65c9('0x4')]||'';this[_0x65c9('0x5')]=_0x1e81e3['clientSecret']||'';this['serverUrl']=_0x1e81e3['serverUrl']||'';this['code']=_0x1e81e3[_0x65c9('0x6')]||'';this[_0x65c9('0x7')]=_0x1e81e3[_0x65c9('0x7')]||'';this['Configurations']=_0x1e81e3[_0x65c9('0x8')]||{};}module[_0x65c9('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 9b98737..29cd621 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 _0x1e89=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','util','lodash','moment','isNil','uniqueid','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','active','phone','scheduledat','countbusyretry','countcongestionretry'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x1e89,0x64));var _0x91e8=function(_0x574851,_0x166518){_0x574851=_0x574851-0x0;var _0x5d7b4d=_0x1e89[_0x574851];return _0x5d7b4d;};'use strict';var util=require(_0x91e8('0x0'));var _=require(_0x91e8('0x1'));var moment=require(_0x91e8('0x2'));function checkNameSurname(_0x1521ce,_0x27db6c,_0x2082ce){var _0x2aab7b='';if(!_[_0x91e8('0x3')](_0x27db6c)&&'string'===typeof _0x27db6c){_0x2aab7b+=_0x27db6c;}if(!_[_0x91e8('0x3')](_0x2082ce)&&'string'===typeof _0x2082ce){_0x2aab7b+='\x20'+_0x2082ce;}if(_0x2aab7b!==''){return _0x2aab7b;}return _0x1521ce;}function Action(_0x5db141,_0x2666ca,_0x1676c2,_0x2e7133,_0x102a42){this[_0x91e8('0x4')]=_0x1676c2||undefined;this['idContact']=_0x5db141['id'];this['queue']=_0x2666ca[_0x91e8('0x5')];this[_0x91e8('0x6')]=_0x2666ca[_0x91e8('0x6')];this[_0x91e8('0x7')]=_0x91e8('0x8');this[_0x91e8('0x9')]=![];this[_0x91e8('0xa')]=_[_0x91e8('0x3')](_0x5db141[_0x91e8('0xb')])?undefined:_0x5db141[_0x91e8('0xb')][_0x91e8('0x5')];this[_0x91e8('0xc')]=this['membername']?util[_0x91e8('0xd')](_0x91e8('0xe'),this[_0x91e8('0xa')]):_0x2e7133||undefined;this[_0x91e8('0xf')]=checkNameSurname(_0x5db141[_0x91e8('0x10')]['phone'],_0x5db141['Contact'][_0x91e8('0x11')],_0x5db141[_0x91e8('0x10')]['lastName']);this[_0x91e8('0x12')]=_0x5db141[_0x91e8('0x12')]||![];this['calleridnum']=_0x5db141['Contact'][_0x91e8('0x13')];this['scheduledat']=_0x5db141[_0x91e8('0x14')];this['countbusyretry']=_0x5db141[_0x91e8('0x15')]||0x0;this[_0x91e8('0x16')]=_0x5db141[_0x91e8('0x16')]||0x0;this[_0x91e8('0x17')]=_0x5db141[_0x91e8('0x17')]||0x0;this['countglobal']=(_0x5db141[_0x91e8('0x15')]||0x0)+(_0x5db141[_0x91e8('0x16')]||0x0)+(_0x5db141[_0x91e8('0x17')]||0x0)+(_0x5db141[_0x91e8('0x18')]||0x0)+(_0x5db141[_0x91e8('0x19')]||0x0)+(_0x5db141[_0x91e8('0x1a')]||0x0)+(_0x5db141[_0x91e8('0x1b')]||0x0)+(_0x5db141[_0x91e8('0x1c')]||0x0);this['countnosuchnumberretry']=_0x5db141['countnosuchnumberretry']||0x0;this[_0x91e8('0x19')]=_0x5db141[_0x91e8('0x19')]||0x0;this[_0x91e8('0x1a')]=_0x5db141['countabandonedretry']||0x0;this['countmachineretry']=_0x5db141['countmachineretry']||0x0;this[_0x91e8('0x1c')]=_0x5db141[_0x91e8('0x1c')]||0x0;this[_0x91e8('0x1d')]=_0x5db141[_0x91e8('0x1d')];this['callbackuniqueid']=_0x5db141[_0x91e8('0x1e')];this[_0x91e8('0x1f')]=_0x5db141[_0x91e8('0x1f')];this[_0x91e8('0x20')]=_0x5db141[_0x91e8('0x20')];this[_0x91e8('0x21')]=_0x5db141[_0x91e8('0x21')];this['ListId']=_0x5db141[_0x91e8('0x22')];this['UserId']=_[_0x91e8('0x3')](_0x5db141['Agent'])?_0x5db141[_0x91e8('0x23')]:_0x5db141['Agent']['id'];this['VoiceQueueId']=_0x5db141['VoiceQueueId'];this[_0x91e8('0x24')]='';this[_0x91e8('0x25')]='';}Action[_0x91e8('0x26')][_0x91e8('0x27')]=function(){return util[_0x91e8('0xd')]('\x22%s\x22\x20<%s>',this[_0x91e8('0xf')],this[_0x91e8('0x28')]);};module['exports']=Action; \ No newline at end of file +var _0xa652=['lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','name','format','SIP/%s','calleridname','phone','Contact','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util'];(function(_0x56cf02,_0x5311e1){var _0x41a008=function(_0x9fbc7c){while(--_0x9fbc7c){_0x56cf02['push'](_0x56cf02['shift']());}};_0x41a008(++_0x5311e1);}(_0xa652,0x179));var _0x2a65=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa652[_0x5b561d];return _0x431060;};'use strict';var util=require(_0x2a65('0x0'));var _=require(_0x2a65('0x1'));var moment=require(_0x2a65('0x2'));function checkNameSurname(_0x49c027,_0x21aae9,_0xc02076){var _0x4a5f5e='';if(!_[_0x2a65('0x3')](_0x21aae9)&&_0x2a65('0x4')===typeof _0x21aae9){_0x4a5f5e+=_0x21aae9;}if(!_['isNil'](_0xc02076)&&'string'===typeof _0xc02076){_0x4a5f5e+='\x20'+_0xc02076;}if(_0x4a5f5e!==''){return _0x4a5f5e;}return _0x49c027;}function Action(_0x2c5a9f,_0x215549,_0x1d204d,_0x4abf7e,_0x1119fb){this[_0x2a65('0x5')]=_0x1d204d||undefined;this[_0x2a65('0x6')]=_0x2c5a9f['id'];this[_0x2a65('0x7')]=_0x215549['name'];this[_0x2a65('0x8')]=_0x215549[_0x2a65('0x8')];this[_0x2a65('0x9')]=_0x2a65('0x7');this[_0x2a65('0xa')]=![];this[_0x2a65('0xb')]=_['isNil'](_0x2c5a9f[_0x2a65('0xc')])?undefined:_0x2c5a9f[_0x2a65('0xc')][_0x2a65('0xd')];this['channelAgent']=this[_0x2a65('0xb')]?util[_0x2a65('0xe')](_0x2a65('0xf'),this['membername']):_0x4abf7e||undefined;this[_0x2a65('0x10')]=checkNameSurname(_0x2c5a9f['Contact'][_0x2a65('0x11')],_0x2c5a9f[_0x2a65('0x12')]['firstName'],_0x2c5a9f[_0x2a65('0x12')]['lastName']);this[_0x2a65('0x13')]=_0x2c5a9f[_0x2a65('0x13')]||![];this[_0x2a65('0x14')]=_0x2c5a9f[_0x2a65('0x12')][_0x2a65('0x11')];this[_0x2a65('0x15')]=_0x2c5a9f[_0x2a65('0x15')];this['countbusyretry']=_0x2c5a9f[_0x2a65('0x16')]||0x0;this[_0x2a65('0x17')]=_0x2c5a9f[_0x2a65('0x17')]||0x0;this[_0x2a65('0x18')]=_0x2c5a9f[_0x2a65('0x18')]||0x0;this['countglobal']=(_0x2c5a9f['countbusyretry']||0x0)+(_0x2c5a9f[_0x2a65('0x17')]||0x0)+(_0x2c5a9f[_0x2a65('0x18')]||0x0)+(_0x2c5a9f['countnosuchnumberretry']||0x0)+(_0x2c5a9f['countdropretry']||0x0)+(_0x2c5a9f[_0x2a65('0x19')]||0x0)+(_0x2c5a9f['countmachineretry']||0x0)+(_0x2c5a9f[_0x2a65('0x1a')]||0x0);this['countnosuchnumberretry']=_0x2c5a9f[_0x2a65('0x1b')]||0x0;this['countdropretry']=_0x2c5a9f['countdropretry']||0x0;this[_0x2a65('0x19')]=_0x2c5a9f[_0x2a65('0x19')]||0x0;this[_0x2a65('0x1c')]=_0x2c5a9f[_0x2a65('0x1c')]||0x0;this[_0x2a65('0x1a')]=_0x2c5a9f['countagentrejectretry']||0x0;this[_0x2a65('0x1d')]=_0x2c5a9f[_0x2a65('0x1d')];this['callbackuniqueid']=_0x2c5a9f['callbackuniqueid'];this[_0x2a65('0x1e')]=_0x2c5a9f['callbackat'];this[_0x2a65('0x1f')]=_0x2c5a9f[_0x2a65('0x1f')];this[_0x2a65('0x20')]=_0x2c5a9f[_0x2a65('0x20')];this[_0x2a65('0x21')]=_0x2c5a9f[_0x2a65('0x21')];this[_0x2a65('0x22')]=_[_0x2a65('0x3')](_0x2c5a9f[_0x2a65('0xc')])?_0x2c5a9f[_0x2a65('0x22')]:_0x2c5a9f['Agent']['id'];this[_0x2a65('0x23')]=_0x2c5a9f[_0x2a65('0x23')];this[_0x2a65('0x24')]='';this[_0x2a65('0x25')]='';}Action[_0x2a65('0x26')][_0x2a65('0x27')]=function(){return util[_0x2a65('0xe')]('\x22%s\x22\x20<%s>',this[_0x2a65('0x10')],this[_0x2a65('0x28')]);};module[_0x2a65('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index efaf81e..a27a1cf 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 _0x03ca=['extractCalleridNumber','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','variables','filterKey','keys','addVariable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','preview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','sequence','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','syncAttendedTransfer','syncBlindTransfer','campaignsPreview','emit','name','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','loopCampaigns','syncCampaigns','clockClearZombieChannels','clearZombieChannels','hasOwnProperty','outbound','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','pTalking:\x20','custom:agentconnect','buildAcw','custom:agentcomplete','complete','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','activeContact','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','catch','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerId','getCallerIdRandom','extractCalleridName'];(function(_0x58e582,_0x41b688){var _0x27f1cd=function(_0x530c74){while(--_0x530c74){_0x58e582['push'](_0x58e582['shift']());}};_0x27f1cd(++_0x41b688);}(_0x03ca,0x172));var _0xa03c=function(_0x4ab3ba,_0x512040){_0x4ab3ba=_0x4ab3ba-0x0;var _0x23c1bd=_0x03ca[_0x4ab3ba];return _0x23c1bd;};'use strict';var util=require(_0xa03c('0x0'));var _=require(_0xa03c('0x1'));var BPromise=require(_0xa03c('0x2'));var uuid=require(_0xa03c('0x3'));var moment=require(_0xa03c('0x4'));var md5=require(_0xa03c('0x5'));var Redis=require(_0xa03c('0x6'));var config=require(_0xa03c('0x7'));var logger=require('../../../config/logger')(_0xa03c('0x8'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0xa03c('0x9'));var rpcDb=require(_0xa03c('0xa'));var Action=require(_0xa03c('0xb'));var ut=require(_0xa03c('0xc'));config[_0xa03c('0xd')]=_[_0xa03c('0xe')](config[_0xa03c('0xd')],{'host':_0xa03c('0xf'),'port':0x18eb});var io=require(_0xa03c('0x10'))(new Redis(config[_0xa03c('0xd')]));var Sequence=function(){};Sequence[_0xa03c('0x11')]['enqueue']=function(_0x4f559e){this[_0xa03c('0x12')]=this[_0xa03c('0x12')]?this[_0xa03c('0x12')]['finally'](_0x4f559e):_0x4f559e();};function Preview(_0x29289d){this[_0xa03c('0x13')]=new Sequence();this['campaignsPreview']=_0x29289d['voiceQueues'];this[_0xa03c('0x14')]=_0x29289d['trunks'];this[_0xa03c('0x15')]={};this['agents']=_0x29289d[_0xa03c('0x16')];this['clockClearZombieChannels']=0x0;ami['on'](_0xa03c('0x17'),this[_0xa03c('0x18')][_0xa03c('0x19')](this));ami['on'](_0xa03c('0x1a'),this[_0xa03c('0x1b')][_0xa03c('0x19')](this));ami['on']('hanguprequest',this[_0xa03c('0x1c')][_0xa03c('0x19')](this));ami['on'](_0xa03c('0x1d'),this[_0xa03c('0x1e')][_0xa03c('0x19')](this));ami['on'](_0xa03c('0x1f'),this['syncNewExten'][_0xa03c('0x19')](this));ami['on'](_0xa03c('0x20'),this[_0xa03c('0x21')][_0xa03c('0x19')](this));ami['on']('attendedtransfer',this[_0xa03c('0x22')]['bind'](this));ami['on']('blindtransfer',this[_0xa03c('0x23')]['bind'](this));this['loopCampaigns'](this[_0xa03c('0x24')]);}function emit(_0x46cc31,_0x20963f,_0x2171d1){io['to'](_0x46cc31)[_0xa03c('0x25')](_0x20963f,_0x2171d1);}function emitCampaignPreview(_0x42cc1d){if(_0x42cc1d['type']==='outbound'){var _0xcb5c94={'id':_0x42cc1d['id'],'name':_0x42cc1d[_0xa03c('0x26')],'strategy':_0x42cc1d[_0xa03c('0x27')],'answered':_0x42cc1d['answered'],'available':_0x42cc1d[_0xa03c('0x28')],'loggedIn':_0x42cc1d[_0xa03c('0x29')],'pTalking':_0x42cc1d[_0xa03c('0x2a')],'sumBillable':_0x42cc1d[_0xa03c('0x2b')],'sumDuration':_0x42cc1d[_0xa03c('0x2c')],'sumHoldTime':_0x42cc1d[_0xa03c('0x2d')]||0x0,'talking':_0x42cc1d['talking'],'total':_0x42cc1d[_0xa03c('0x2e')],'type':_0x42cc1d[_0xa03c('0x2f')],'unmanaged':_0x42cc1d[_0xa03c('0x30')],'abandoned':_0x42cc1d[_0xa03c('0x31')],'waiting':_0x42cc1d[_0xa03c('0x32')],'loggedInDb':_0x42cc1d['loggedInDb'],'dialActive':_0x42cc1d[_0xa03c('0x33')],'dialMethod':_0x42cc1d[_0xa03c('0x34')],'dialOriginateCallerIdName':_0x42cc1d[_0xa03c('0x35')],'dialOriginateCallerIdNumber':_0x42cc1d[_0xa03c('0x36')],'dialOriginateTimeout':_0x42cc1d[_0xa03c('0x37')],'dialPrefix':_0x42cc1d['dialPrefix'],'outboundAnswerAgiCallsDay':_0x42cc1d['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x42cc1d[_0xa03c('0x38')],'outboundBlacklistCallsDay':_0x42cc1d['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x42cc1d['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x42cc1d['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x42cc1d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x42cc1d[_0xa03c('0x39')],'outboundDropCallsDayTimeout':_0x42cc1d[_0xa03c('0x3a')],'outboundNoAnswerCallsDay':_0x42cc1d[_0xa03c('0x3b')],'outboundNoSuchCallsDay':_0x42cc1d[_0xa03c('0x3c')],'outboundOriginateFailureCallsDay':_0x42cc1d[_0xa03c('0x3d')],'outboundReCallsDay':_0x42cc1d[_0xa03c('0x3e')],'outboundRejectCallsDay':_0x42cc1d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x42cc1d['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x42cc1d['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x42cc1d[_0xa03c('0x3f')],'predictiveIntervalAvgHoldtime':_0x42cc1d['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x42cc1d[_0xa03c('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x42cc1d['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x42cc1d[_0xa03c('0x41')],'predictiveIntervalErlangCalls':_0x42cc1d[_0xa03c('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x42cc1d[_0xa03c('0x43')],'predictiveIntervalHitRate':_0x42cc1d[_0xa03c('0x44')],'predictiveIntervalMultiplicativeFactor':_0x42cc1d[_0xa03c('0x45')],'predictiveIntervalPauses':_0x42cc1d[_0xa03c('0x46')],'predictiveIntervalAvailable':_0x42cc1d[_0xa03c('0x47')],'predictiveIntervalTotalCalls':_0x42cc1d[_0xa03c('0x48')],'message':_0x42cc1d[_0xa03c('0x49')],'originated':_0x42cc1d[_0xa03c('0x4a')],'erlangCalls':_0x42cc1d[_0xa03c('0x4b')],'erlangCallToSecond':_0x42cc1d[_0xa03c('0x4c')],'erlangAbandonmentRate':_0x42cc1d[_0xa03c('0x4d')],'erlangBusyFactor':_0x42cc1d['erlangBusyFactor'],'startPredictive':_0x42cc1d[_0xa03c('0x4e')],'startProgressive':_0x42cc1d[_0xa03c('0x4f')]};if(_0x42cc1d[_0xa03c('0x50')]){_0xcb5c94[_0xa03c('0x50')]={'id':_0x42cc1d[_0xa03c('0x50')]['id'],'name':_0x42cc1d[_0xa03c('0x50')][_0xa03c('0x26')],'active':_0x42cc1d[_0xa03c('0x50')]['active'],'callerid':_0x42cc1d['Trunk'][_0xa03c('0x51')]};}if(_0x42cc1d[_0xa03c('0x52')]){_0xcb5c94[_0xa03c('0x52')]={'id':_0x42cc1d['Interval']['id'],'name':_0x42cc1d[_0xa03c('0x52')][_0xa03c('0x26')]};}var _0x326da6=md5(JSON[_0xa03c('0x53')](_0xcb5c94));if(_0x42cc1d['md5']!==_0x326da6){_0x42cc1d[_0xa03c('0x5')]=_0x326da6;emit(util['format'](_0xa03c('0x54'),_0xcb5c94[_0xa03c('0x26')]),_0xa03c('0x55'),_0xcb5c94);}}}function emitVoiceQueueChannelRemove(_0x5e13f9){logger[_0xa03c('0x56')](_0xa03c('0x57'),JSON['stringify'](_0x5e13f9));emit(util[_0xa03c('0x58')](_0xa03c('0x54'),_0x5e13f9[_0xa03c('0x26')]),_0xa03c('0x59'),_0x5e13f9);}function notSendMessagesQueue(_0x5683d5){if(_0x5683d5[_0xa03c('0x5a')]){if(_0x5683d5[_0xa03c('0x4a')]===0x0&&_0x5683d5[_0xa03c('0x2a')]===0x0){_0x5683d5['sendMessageOneNotActive']=![];_0x5683d5[_0xa03c('0x28')]=0x0;_0x5683d5[_0xa03c('0x5b')]=0x0;_0x5683d5['message']=_0xa03c('0x5c');ut[_0xa03c('0x5d')](_0xa03c('0x5e'),_0x5683d5[_0xa03c('0x26')]+'\x20is\x20not\x20active');}else{_0x5683d5[_0xa03c('0x49')]=_0xa03c('0x5f');ut[_0xa03c('0x5d')](_0xa03c('0x5e'),_0x5683d5['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x5683d5);}}Preview[_0xa03c('0x11')][_0xa03c('0x60')]=function(){var _0xd54a10=this;setInterval(function(){_0xd54a10['syncCampaigns']();},0x7cf);};Preview['prototype'][_0xa03c('0x61')]=function(){var _0x4f2067=this[_0xa03c('0x24')];this[_0xa03c('0x62')]+=0x1;for(var _0x7e4bb5 in _0x4f2067){if(_0x4f2067['hasOwnProperty'](_0x7e4bb5)&&(_0x4f2067[_0x7e4bb5]['dialMethod']===_0xa03c('0x8')||_0x4f2067[_0x7e4bb5][_0xa03c('0x34')]==='booked')&&_0x4f2067[_0x7e4bb5]['type']==='outbound'){if(this[_0xa03c('0x62')]>0x7){this[_0xa03c('0x62')]=0x0;this[_0xa03c('0x63')]();}}if(_0x4f2067[_0xa03c('0x64')](_0x7e4bb5)&&_0x4f2067[_0x7e4bb5][_0xa03c('0x34')]===_0xa03c('0x8')&&_0x4f2067[_0x7e4bb5]['type']===_0xa03c('0x65')){if(_0x4f2067[_0x7e4bb5][_0xa03c('0x33')]){this[_0xa03c('0x66')](_0x4f2067[_0x7e4bb5]);this[_0xa03c('0x67')](_0x4f2067[_0x7e4bb5]);}else{notSendMessagesQueue(_0x4f2067[_0x7e4bb5]);}}}};Preview[_0xa03c('0x11')][_0xa03c('0x68')]=function(_0x37994f){var _0x4b1239=this;this['sequence'][_0xa03c('0x69')](function(){if(!_[_0xa03c('0x6a')](_0x4b1239[_0xa03c('0x15')][_0x37994f])){loggerAction['info'](_0xa03c('0x6b'),_0x37994f,_0xa03c('0x6c'),_0x4b1239['actions'][_0x37994f][_0xa03c('0x6d')],_0xa03c('0x6e'),JSON[_0xa03c('0x53')](_0x4b1239[_0xa03c('0x24')][_0x4b1239[_0xa03c('0x15')][_0x37994f][_0xa03c('0x6d')]][_0xa03c('0x4a')]),'pTalking:\x20',JSON[_0xa03c('0x53')](_0x4b1239[_0xa03c('0x24')][_0x4b1239[_0xa03c('0x15')][_0x37994f][_0xa03c('0x6d')]][_0xa03c('0x2a')]),JSON[_0xa03c('0x53')](_0x4b1239[_0xa03c('0x15')][_0x37994f][_0xa03c('0x6f')]),JSON[_0xa03c('0x53')](_[_0xa03c('0x70')](_0x4b1239[_0xa03c('0x15')][_0x37994f],[_0xa03c('0x71'),_0xa03c('0x72'),_0xa03c('0x73'),_0xa03c('0x74')])));return ami[_0xa03c('0x75')]({'action':_0xa03c('0x76'),'channel':_0x4b1239[_0xa03c('0x15')][_0x37994f][_0xa03c('0x77')]})['catch'](function(_0x7269e8){if(_0x7269e8['message']===_0xa03c('0x78')){setTimeout(function(){if(_0x4b1239[_0xa03c('0x15')][_0x37994f]){ut[_0xa03c('0x79')](_0x4b1239['campaignsPreview'][_0x4b1239['actions'][_0x37994f]['queue']],'[clearZombieChannel]');if(_0x4b1239['actions'][_0x37994f][_0xa03c('0x6f')]===!![]){ut[_0xa03c('0x7a')](_0x4b1239[_0xa03c('0x24')][_0x4b1239[_0xa03c('0x15')][_0x37994f]['queue']],'[clearZombieChannel]');ut[_0xa03c('0x7b')](_0xa03c('0x7c')+_0x37994f,_0x4b1239[_0xa03c('0x15')][_0x37994f][_0xa03c('0x6d')]);}ut[_0xa03c('0x7b')](_0xa03c('0x7d')+_0x37994f,_0x4b1239[_0xa03c('0x15')][_0x37994f]['queue']);delete _0x4b1239[_0xa03c('0x15')][_0x37994f];}},0x2328);}});}});};Preview['prototype'][_0xa03c('0x63')]=function(){var _0x181a3c=this;loggerAction[_0xa03c('0x56')](_0xa03c('0x7e'),_[_0xa03c('0x7f')](this['actions']));for(var _0x4a2a03 in this[_0xa03c('0x15')]){if(_0x181a3c[_0xa03c('0x15')][_0xa03c('0x64')](_0x4a2a03)){_0x181a3c[_0xa03c('0x68')](_0x4a2a03);}}};Preview[_0xa03c('0x11')][_0xa03c('0x67')]=function(_0x1caabd){var _0x14d3fd=this;rpcDb[_0xa03c('0x80')](_0x1caabd['id'],ut['agentReadyId'](this[_0xa03c('0x16')]))[_0xa03c('0x81')](function(_0x2fe9a6){if(!_['isNil'](_0x2fe9a6)){for(var _0x3cae1f=0x0;_0x3cae1f<_0x2fe9a6['length'];_0x3cae1f+=0x1){if(ut[_0xa03c('0x82')](_0x2fe9a6[_0x3cae1f][_0xa03c('0x83')])<_0x1caabd[_0xa03c('0x84')]*0x3c){if(_0x2fe9a6[_0x3cae1f][_0xa03c('0x85')]&&!_0x2fe9a6[_0x3cae1f][_0xa03c('0x85')][_0xa03c('0x86')]){_0x14d3fd[_0xa03c('0x87')](_0x2fe9a6[_0x3cae1f]['id'])[_0xa03c('0x81')](ut[_0xa03c('0x88')]('[RecallMe]'))['catch'](ut[_0xa03c('0x88')]('[RecallMe]'));}else{rpcDb[_0xa03c('0x89')](_0x2fe9a6[_0x3cae1f]['id']);}}else{var _0x3638c5=new Action(_0x2fe9a6[_0x3cae1f],_0x1caabd);_0x3638c5[_0xa03c('0x8a')]=moment()[_0xa03c('0x58')](_0xa03c('0x8b'));_0x1caabd[_0xa03c('0x3e')]+=0x1;ut[_0xa03c('0x8c')](_0x3638c5,0x17,_0xa03c('0x8d'));if(_0x1caabd['dialRecallInQueue']){rpcDb[_0xa03c('0x8e')](ut['createBody'](_0x2fe9a6[_0x3cae1f]));rpcDb[_0xa03c('0x8f')](_0x3638c5,_0xa03c('0x90'));}else{ut['logCustomer'](_0x3638c5,0x16,'RecallFailedTimeout');rpcDb[_0xa03c('0x8f')](_0x3638c5,_0xa03c('0x91'));rpcDb[_0xa03c('0x92')](_0x3638c5,_0xa03c('0x91'));}}}}})['catch'](ut['logger2'](_0xa03c('0x93')));};Preview[_0xa03c('0x11')][_0xa03c('0x66')]=function(_0x58be6f){_0x58be6f[_0xa03c('0x5a')]=!![];if(ut[_0xa03c('0x94')](_0x58be6f[_0xa03c('0x29')])){_0x58be6f[_0xa03c('0x49')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xa03c('0x95')](_0x58be6f[_0xa03c('0x33')])){_0x58be6f[_0xa03c('0x49')]='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x58be6f[_0xa03c('0x50')])){if(!this[_0xa03c('0x96')](_0x58be6f[_0xa03c('0x97')])){_0x58be6f[_0xa03c('0x49')]=_0xa03c('0x98');}else{_0x58be6f[_0xa03c('0x49')]=_0xa03c('0x99');}}else{_0x58be6f[_0xa03c('0x49')]=_0xa03c('0x99');}emitCampaignPreview(_0x58be6f);};Preview[_0xa03c('0x11')][_0xa03c('0x9a')]=function(_0x10b565,_0x112d59,_0x484eaf){var _0x5112be=this;var _0x211fd8=this['actions'][_0x112d59];var _0x329f41=this[_0xa03c('0x24')][_0x211fd8[_0xa03c('0x6d')]];var _0x4e2843;if(_0x329f41){switch(_0x484eaf){case'1':_0x329f41[_0xa03c('0x3c')]+=0x1;_0x211fd8[_0xa03c('0x9b')]+=0x1;_0x211fd8[_0xa03c('0x9c')]=ut[_0xa03c('0x9d')](_0x211fd8);ut[_0xa03c('0x8c')](_0x211fd8,0x0,_0xa03c('0x9e'));ami[_0xa03c('0x25')]('custom:agentnosuchnumber',ut[_0xa03c('0x9f')](_0x211fd8,_0xa03c('0xa0')));rpcDb['createCustomerHistory'](_0x211fd8,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xa03c('0x9d')](_0x211fd8)>=_0x329f41[_0xa03c('0xa1')]){_0x4e2843=ut[_0xa03c('0xa2')](_0x211fd8,0xf,_0xa03c('0xa3'));rpcDb['createCustomerFinal'](_0x4e2843,_0xa03c('0xa4'));}else{if(_0x211fd8[_0xa03c('0x9b')]>=_0x329f41['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x211fd8,_0xa03c('0xa4'));}else{rpcDb[_0xa03c('0xa5')](ut[_0xa03c('0xa6')](_0x211fd8,_0xa03c('0x9b'),_0x329f41['dialNoSuchNumberRetryFrequency']),_0x211fd8[_0xa03c('0xa7')],_0x211fd8['activeContact']);}}delete this[_0xa03c('0x15')][_0x10b565[_0xa03c('0xa8')]];break;case'ANSWER':var _0x53d422=moment()[_0xa03c('0x58')](_0xa03c('0x8b'));_0x211fd8[_0xa03c('0xa9')]=_0x53d422;_0x211fd8[_0xa03c('0xaa')]=_0x53d422;_0x211fd8['dialAnswer']=!![];_0x329f41['pTalking']+=0x1;logger[_0xa03c('0x56')](_0xa03c('0xab'),_0x211fd8['uniqueid'],_0xa03c('0xac'),_0x329f41[_0xa03c('0x26')],_0xa03c('0xad'),_0x329f41[_0xa03c('0x2a')]);ami[_0xa03c('0x25')](_0xa03c('0xae'),ut[_0xa03c('0x9f')](_0x211fd8,'connect'));if(_0x329f41['acw']){ami['emit']('custom:agentConnectPreview',ut[_0xa03c('0xaf')](_0x211fd8));}break;case'16':ami[_0xa03c('0x25')](_0xa03c('0xb0'),ut[_0xa03c('0x9f')](_0x211fd8,_0xa03c('0xb1')));emitVoiceQueueChannelRemove(ut[_0xa03c('0x9f')](_0x211fd8,_0xa03c('0xb1')));_0x329f41[_0xa03c('0x38')]+=0x1;_0x329f41[_0xa03c('0x2e')]+=0x1;_0x329f41[_0xa03c('0xb2')]+=0x1;ut[_0xa03c('0x7a')](_0x329f41,_0xa03c('0xb3'));_0x211fd8[_0xa03c('0x9c')]=ut[_0xa03c('0x9d')](_0x211fd8);ut[_0xa03c('0x8c')](_0x211fd8,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211fd8,_0xa03c('0xb4'));rpcDb['createCustomerFinal'](_0x211fd8,_0xa03c('0xb5'));rpcDb['crateCustomerReportQueue'](_0x211fd8);_0x329f41[_0xa03c('0x2c')]+=_0x211fd8['talktime'];_0x329f41[_0xa03c('0x2b')]+=_0x211fd8[_0xa03c('0xb6')];logger[_0xa03c('0x56')](_0xa03c('0xb7'),_0x211fd8[_0xa03c('0xb8')],_0xa03c('0xac'),_0x329f41['name'],_0xa03c('0xad'),_0x329f41[_0xa03c('0x2a')]);delete this[_0xa03c('0x15')][_0x10b565['linkedid']];break;case _0xa03c('0xb9'):_0x329f41[_0xa03c('0xba')]+=0x1;_0x211fd8[_0xa03c('0xbb')]+=0x1;_0x211fd8[_0xa03c('0x9c')]=ut[_0xa03c('0x9d')](_0x211fd8);ut[_0xa03c('0x8c')](_0x211fd8,0x5,_0xa03c('0xbc'));ami[_0xa03c('0x25')](_0xa03c('0xbd'),ut[_0xa03c('0x9f')](_0x211fd8,'busy'));rpcDb[_0xa03c('0x8f')](_0x211fd8,_0xa03c('0xbe'));if(ut[_0xa03c('0x9d')](_0x211fd8)>=_0x329f41[_0xa03c('0xa1')]){_0x4e2843=ut[_0xa03c('0xa2')](_0x211fd8,0xf,'Global');rpcDb[_0xa03c('0x92')](_0x4e2843,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x211fd8[_0xa03c('0xbb')]>=_0x329f41['dialBusyMaxRetry']){rpcDb[_0xa03c('0x92')](_0x211fd8,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0xa03c('0xa6')](_0x211fd8,_0xa03c('0xbb'),_0x329f41[_0xa03c('0xbf')]),_0x211fd8[_0xa03c('0xa7')],_0x211fd8[_0xa03c('0xc0')]);}}break;case'NOANSWER':_0x329f41['outboundNoAnswerCallsDay']+=0x1;_0x211fd8[_0xa03c('0xc1')]+=0x1;_0x211fd8[_0xa03c('0x9c')]=ut['totalGlobal'](_0x211fd8);ut[_0xa03c('0x8c')](_0x211fd8,0x3,_0xa03c('0xc2'));ami[_0xa03c('0x25')](_0xa03c('0xc3'),ut[_0xa03c('0x9f')](_0x211fd8,_0xa03c('0xc4')));rpcDb[_0xa03c('0x8f')](_0x211fd8,_0xa03c('0xc5'));if(ut[_0xa03c('0x9d')](_0x211fd8)>=_0x329f41[_0xa03c('0xa1')]){_0x4e2843=ut[_0xa03c('0xa2')](_0x211fd8,0xf,_0xa03c('0xa3'));rpcDb['createCustomerFinal'](_0x4e2843,_0xa03c('0xc6'));}else{if(_0x211fd8[_0xa03c('0xc1')]>=_0x329f41[_0xa03c('0xc7')]){rpcDb[_0xa03c('0x92')](_0x211fd8,_0xa03c('0xc5'));}else{rpcDb[_0xa03c('0xa5')](ut[_0xa03c('0xa6')](_0x211fd8,'countnoanswerretry',_0x329f41[_0xa03c('0xc8')]),_0x211fd8[_0xa03c('0xa7')],_0x211fd8['activeContact']);}}break;case'CONGESTION':_0x329f41[_0xa03c('0xc9')]+=0x1;_0x211fd8['countcongestionretry']+=0x1;_0x211fd8[_0xa03c('0x9c')]=ut[_0xa03c('0x9d')](_0x211fd8);ut[_0xa03c('0x8c')](_0x211fd8,0x8,'Congestion');ami[_0xa03c('0x25')](_0xa03c('0xca'),ut[_0xa03c('0x9f')](_0x211fd8,'congestion'));rpcDb[_0xa03c('0x8f')](_0x211fd8,_0xa03c('0xcb'));if(ut[_0xa03c('0x9d')](_0x211fd8)>=_0x329f41[_0xa03c('0xa1')]){_0x4e2843=ut[_0xa03c('0xa2')](_0x211fd8,0xf,_0xa03c('0xa3'));rpcDb[_0xa03c('0x92')](_0x4e2843,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x211fd8[_0xa03c('0xcc')]>=_0x329f41[_0xa03c('0xcd')]){rpcDb[_0xa03c('0x92')](_0x211fd8,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xa03c('0xa5')](ut[_0xa03c('0xa6')](_0x211fd8,_0xa03c('0xcc'),_0x329f41[_0xa03c('0xbf')]),_0x211fd8[_0xa03c('0xa7')],_0x211fd8[_0xa03c('0xc0')]);}}break;case _0xa03c('0xce'):_0x329f41[_0xa03c('0xcf')]+=0x1;_0x211fd8[_0xa03c('0xd0')]+=0x1;_0x211fd8[_0xa03c('0x9c')]=ut[_0xa03c('0x9d')](_0x211fd8);ut['logCustomer'](_0x211fd8,0x14,'AgentReject');ami[_0xa03c('0x25')](_0xa03c('0xd1'),ut[_0xa03c('0x9f')](_0x211fd8,_0xa03c('0xd2')));rpcDb[_0xa03c('0x8f')](_0x211fd8,_0xa03c('0xd3'));if(ut[_0xa03c('0x9d')](_0x211fd8)>=_0x329f41[_0xa03c('0xa1')]){_0x4e2843=ut[_0xa03c('0xa2')](_0x211fd8,0x14,_0xa03c('0xd4'));rpcDb[_0xa03c('0x92')](_0x4e2843,_0xa03c('0xd5'));}else{if(_0x211fd8[_0xa03c('0xd0')]>=_0x329f41[_0xa03c('0xd6')]){rpcDb[_0xa03c('0x92')](_0x211fd8,_0xa03c('0xd5'));}else{rpcDb[_0xa03c('0xa5')](ut['scheduledAt'](_0x211fd8,_0xa03c('0xd0'),_0x329f41[_0xa03c('0xd7')]),_0x211fd8['unlockAgent'],_0x211fd8['activeContact']);}}break;case'ABANDONED':_0x329f41[_0xa03c('0xd8')]+=0x1;_0x211fd8[_0xa03c('0xd9')]+=0x1;_0x211fd8[_0xa03c('0x9c')]=ut[_0xa03c('0x9d')](_0x211fd8);ut[_0xa03c('0x8c')](_0x211fd8,0xb,_0xa03c('0xda'));rpcDb[_0xa03c('0x8f')](_0x211fd8,_0xa03c('0xdb'));if(ut['totalGlobal'](_0x211fd8)>=_0x329f41[_0xa03c('0xa1')]){_0x4e2843=ut[_0xa03c('0xa2')](_0x211fd8,0xf,_0xa03c('0xa3'));rpcDb[_0xa03c('0x92')](_0x4e2843,_0xa03c('0xdb'));}else{if(_0x211fd8[_0xa03c('0xdc')]>=_0x329f41[_0xa03c('0xdd')]){rpcDb[_0xa03c('0x92')](_0x211fd8,_0xa03c('0xdb'));}else{rpcDb[_0xa03c('0xa5')](ut['scheduledAt'](_0x211fd8,_0xa03c('0xd9'),_0x329f41[_0xa03c('0xde')]),_0x211fd8[_0xa03c('0xa7')],_0x211fd8[_0xa03c('0xc0')]);}}break;default:if(_0x211fd8[_0xa03c('0x6f')]){ut['decrementTalkink'](_0x329f41,_0xa03c('0xdf'));ut[_0xa03c('0x7b')](_0xa03c('0xe0')+_0x329f41['name'],_0x10b565);}_0x329f41[_0xa03c('0xe1')]+=0x1;_0x211fd8['countglobal']=ut['totalGlobal'](_0x211fd8);ut[_0xa03c('0x8c')](_0x211fd8,0xc,_0x10b565[_0xa03c('0xe2')]||_0x10b565[_0xa03c('0xe3')]);rpcDb[_0xa03c('0x8f')](_0x211fd8,_0xa03c('0xe4'));if(ut[_0xa03c('0x9d')](_0x211fd8)>=_0x329f41[_0xa03c('0xa1')]){_0x4e2843=ut[_0xa03c('0xa2')](_0x211fd8,0xf,_0xa03c('0xa3'));rpcDb[_0xa03c('0x92')](_0x4e2843,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xa03c('0x92')](_0x211fd8,_0xa03c('0xe5'));}delete this[_0xa03c('0x15')][_0x10b565[_0xa03c('0xa8')]];}if(!(_0x211fd8['dialAnswer']&&_0x484eaf==='16')){ut['updateOriginated'](_0x329f41,'[callProgressDetectingCustomer]');logger[_0xa03c('0x56')](_0xa03c('0xe6'),_0x211fd8[_0xa03c('0xb8')],_0xa03c('0xac'),_0x329f41[_0xa03c('0x26')],_0xa03c('0x6e'),_0x329f41[_0xa03c('0x4a')]);}if(_0x484eaf!==_0xa03c('0xe7')){delete this[_0xa03c('0x15')][_0x10b565[_0xa03c('0xa8')]];delete this[_0xa03c('0x15')][_0x10b565['destlinkedid']];}}};Preview['prototype'][_0xa03c('0xe8')]=function(_0x4448c9,_0xf433f7,_0x121233){if(_[_0xa03c('0xe9')](_0xf433f7)&&_0xa03c('0xea')!==typeof _0xf433f7){return;}if(_[_0xa03c('0xe9')](_0x121233)&&_0xa03c('0xea')!==typeof _0x121233){return;}switch(_0x121233['reason']){case'0':ut['logAgent'](_0x4448c9,0x0,_0xa03c('0x9e'));rpcDb[_0xa03c('0xeb')](_0x4448c9,_0xa03c('0xec'));break;case'3':ut[_0xa03c('0xed')](_0x4448c9,0x3,_0xa03c('0xc2'));rpcDb[_0xa03c('0xeb')](_0x4448c9,_0xa03c('0xee'));break;case'5':ut[_0xa03c('0xed')](_0x4448c9,0x5,_0xa03c('0xbc'));rpcDb[_0xa03c('0xeb')](_0x4448c9,_0xa03c('0xef'));break;case'8':ut[_0xa03c('0xed')](_0x4448c9,0x8,'Congestion');rpcDb[_0xa03c('0xeb')](_0x4448c9,_0xa03c('0xf0'));break;case'22':ut[_0xa03c('0xed')](_0x4448c9,0x16,_0xa03c('0xf1'));rpcDb[_0xa03c('0xeb')](_0x4448c9,_0xa03c('0xf2'));break;default:ut['logAgent'](_0x4448c9,0xc,_0x121233[_0xa03c('0xf3')]);rpcDb[_0xa03c('0xeb')](_0x4448c9,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0xf433f7,'[callProgressDetectingAgent]');logger[_0xa03c('0x56')](_0xa03c('0xf4'),_0x4448c9[_0xa03c('0xb8')],_0xa03c('0xac'),_0xf433f7['name'],'originated:\x20',_0xf433f7[_0xa03c('0x4a')]);delete this[_0xa03c('0x15')][_0x4448c9[_0xa03c('0xb8')]];};Preview['prototype'][_0xa03c('0xf5')]=function(_0x1fecc6,_0x1e3665,_0x2972bd,_0x41350d,_0x2676b4){var _0x4e417f=this;return new BPromise(function(_0x31b850,_0x339fb4){if(_[_0xa03c('0x6a')](_0x1e3665)||_[_0xa03c('0x6a')](_0x1e3665[_0xa03c('0xf6')])||_[_0xa03c('0x6a')](_0x1e3665['Contact'][_0xa03c('0xf7')])||_[_0xa03c('0x6a')](_0x1e3665[_0xa03c('0x73')])){_0x339fb4(ut['message'](_0xa03c('0xf8'),_0x41350d,_0x2676b4));return;}var _0x3095a7=uuid['v4']();var _0x2a1311=_0x4e417f[_0xa03c('0x24')][_0x1e3665[_0xa03c('0x6c')][_0xa03c('0x26')]];var _0x1bad05=_0x2972bd?_0x4e417f[_0xa03c('0x16')][_0x2972bd]['id']:undefined;_0x4e417f[_0xa03c('0x15')][_0x3095a7]=new Action(_0x1e3665,_0x2a1311,_0x3095a7,_0x2972bd,_0x1bad05);var _0x162ce7=_0x4e417f[_0xa03c('0x15')][_0x3095a7];_0x162ce7[_0xa03c('0xa7')]=_0x41350d;_0x162ce7[_0xa03c('0xc0')]=_0x2676b4;_0x162ce7[_0xa03c('0xf9')]=_0x2972bd;if(_[_0xa03c('0xfa')](_0x1fecc6)){_0x4e417f[_0xa03c('0xfb')](_0x162ce7,_0x2a1311,_0x1e3665,_0x2972bd)[_0xa03c('0x81')](function(_0x249779){logger[_0xa03c('0x56')]('[Preview][execCall][success]',_0xa03c('0xfc')+_0x162ce7['queue']+_0xa03c('0xfd')+_0x162ce7[_0xa03c('0xfe')],JSON[_0xa03c('0x53')](_0x249779));ami[_0xa03c('0x25')](_0xa03c('0xff'),ut['buildObj'](_0x162ce7,_0xa03c('0x100')));_0x31b850(ut[_0xa03c('0x49')](_0xa03c('0x101')));})['catch'](function(_0x11cfe9){ut['logger'](_0xa03c('0x102'),_0x11cfe9);_0x339fb4(ut[_0xa03c('0x49')](_0xa03c('0x103'),_0x41350d,_0x2676b4));});}else{_0x2a1311[_0xa03c('0x104')]+=0x1;ut[_0xa03c('0x105')](_0x162ce7);rpcDb[_0xa03c('0x106')](_0x162ce7,_0xa03c('0x107'));delete _0x4e417f[_0xa03c('0x15')][_0x3095a7];_0x339fb4(ut[_0xa03c('0x49')](_0xa03c('0x108'),_0x41350d,_0x2676b4));}});};Preview['prototype'][_0xa03c('0x96')]=function(_0x4852ed){return!_[_0xa03c('0x6a')](_0x4852ed)&&!_[_0xa03c('0x6a')](_0x4852ed[_0xa03c('0x26')])&&!_['isNil'](_0x4852ed['active'])&&_0x4852ed[_0xa03c('0x109')]&&!_[_0xa03c('0x6a')](this[_0xa03c('0x14')][util[_0xa03c('0x58')]('SIP/%s',_0x4852ed[_0xa03c('0x26')])])&&!_[_0xa03c('0x6a')](this[_0xa03c('0x14')][util[_0xa03c('0x58')](_0xa03c('0x10a'),_0x4852ed[_0xa03c('0x26')])][_0xa03c('0x76')])&&(this[_0xa03c('0x14')][util[_0xa03c('0x58')](_0xa03c('0x10a'),_0x4852ed['name'])][_0xa03c('0x76')]===_0xa03c('0x10b')||this['trunks'][util[_0xa03c('0x58')]('SIP/%s',_0x4852ed[_0xa03c('0x26')])]['status']===_0xa03c('0x10c'));};Preview[_0xa03c('0x11')][_0xa03c('0x87')]=function(_0x5a6f92,_0x198cc7){var _0x493775=this;return new BPromise(function(_0x57f3ef,_0x16570d){_0x493775['execRun'](_0x5a6f92,_0x198cc7)['then'](function(_0xb2ef3d){_0x57f3ef(_[_0xa03c('0x70')](_0xb2ef3d,[_0xa03c('0x49')]));})['catch'](function(_0x2fa5ef){if(_0x2fa5ef[_0xa03c('0x10d')]){rpcDb[_0xa03c('0x10e')](_0x5a6f92);}if(_0x2fa5ef['active']){rpcDb[_0xa03c('0x89')](_0x5a6f92);}_0x16570d(_['pick'](_0x2fa5ef,[_0xa03c('0x49')]));});});};Preview[_0xa03c('0x11')][_0xa03c('0x10f')]=function(_0x148679,_0x28989b){var _0x5f0116=this;return new BPromise(function(_0x14c1ab,_0x147959){var _0x9f8c7d,_0x4650ab;rpcDb[_0xa03c('0x110')](_0x148679)['then'](function(_0x1dcf71){if(!_[_0xa03c('0x6a')](_0x1dcf71[0x0])){_0x4650ab=_0x1dcf71[0x0][_0xa03c('0x111')]?![]:!![];_0x9f8c7d=_0x1dcf71[0x0]['recallme']?!![]:![];_0x9f8c7d=_0x28989b?!![]:_0x9f8c7d;}var _0xcd853b=_0x5f0116[_0xa03c('0x112')](_0x1dcf71);if(_0xcd853b[_0xa03c('0x113')]){rpcDb[_0xa03c('0x114')](_['pick'](_0x1dcf71[0x0],[_0xa03c('0x73'),_0xa03c('0x115')]))['then'](function(_0x4eabb2){_0x5f0116['checkInBlack'](_0x4eabb2,_0x1dcf71[0x0],_0x28989b,_0x4650ab,_0x9f8c7d)['then'](function(_0x5af8de){_0x14c1ab(_0x5af8de);})['catch'](function(_0x222ef2){_0x147959(_0x222ef2);});})[_0xa03c('0x116')](function(_0x1d67cb){ut[_0xa03c('0x5d')](_0xa03c('0x117'),_0x1d67cb);_0x147959(ut[_0xa03c('0x49')]('Call\x20unsuccessful',_0x4650ab,_0x9f8c7d));});}else{_0x147959(ut['message'](_0xcd853b[_0xa03c('0x49')],_0x4650ab,_0x9f8c7d));}})[_0xa03c('0x116')](function(_0x5d9f9d){ut[_0xa03c('0x5d')]('[Preview][getContactPreview]',_0x5d9f9d);_0x147959(ut[_0xa03c('0x49')](_0xa03c('0x118'),![],!![]));});});};Preview[_0xa03c('0x11')][_0xa03c('0x112')]=function(_0x365866){if(_[_0xa03c('0x6a')](_0x365866)||_[_0xa03c('0xfa')](_0x365866)||!_['isNil'](_0x365866[0x0][_0xa03c('0x85')])&&_[_0xa03c('0x6a')](_0x365866[0x0]['Agent'][_0xa03c('0x26')])){ut[_0xa03c('0x5d')](_0xa03c('0x119'),_0x365866);return{'isValid':![],'message':_0xa03c('0x11a')};}var _0x3e10eb=this['campaignsPreview'][_0x365866[0x0]['Queue'][_0xa03c('0x26')]];_0x3e10eb['message']=_0xa03c('0x99');if(_[_0xa03c('0x6a')](_0x3e10eb)){ut['logger'](_0xa03c('0x11b'),_0x3e10eb);return{'isValid':![],'message':_0xa03c('0x11c')};}if(!this[_0xa03c('0x96')](_0x3e10eb['Trunk'])){ut[_0xa03c('0x5d')](_0xa03c('0x11d'),_0xa03c('0x11e')+_0x3e10eb['name']+_0xa03c('0x11f'));if(!this['isTrunkReachable'](_0x3e10eb[_0xa03c('0x97')])){ut[_0xa03c('0x5d')](_0xa03c('0x11d'),_0x3e10eb[_0xa03c('0x26')]+_0xa03c('0x120'));return{'isValid':![],'message':_0xa03c('0x121')};}}if(!ut[_0xa03c('0x95')](_0x3e10eb[_0xa03c('0x33')])){ut[_0xa03c('0x5d')](_0xa03c('0x122'),_0x3e10eb[_0xa03c('0x26')]+_0xa03c('0x123'));return{'isValid':![],'message':_0xa03c('0x11e')+_0x3e10eb[_0xa03c('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xa03c('0x124')};};Preview['prototype'][_0xa03c('0xfb')]=function(_0x693f08,_0x5e6967,_0x51b09f,_0x204ade){var _0x125a48=this;return new BPromise(function(_0x591372,_0x58d212){var _0xa7ad9=_0x693f08['uniqueid'];var _0x3c45a8=_0x125a48[_0xa03c('0x96')](_0x5e6967[_0xa03c('0x50')])?util[_0xa03c('0x58')](_0xa03c('0x125'),_0x5e6967['Trunk'][_0xa03c('0x26')],_[_0xa03c('0x6a')](_0x5e6967['dialPrefix'])?'':_0x5e6967[_0xa03c('0x126')][_0xa03c('0x127')]()||'',_0x5e6967[_0xa03c('0x128')]>0x0?_0x51b09f[_0xa03c('0xf6')][_0xa03c('0xf7')]['substring'](_0x5e6967[_0xa03c('0x128')]):_0x51b09f['Contact'][_0xa03c('0xf7')]):util[_0xa03c('0x58')](_0xa03c('0x125'),_['isNil'](_0x5e6967[_0xa03c('0x97')])?_0x5e6967[_0xa03c('0x50')]['name']:_0x5e6967['TrunkBackup'][_0xa03c('0x26')],_[_0xa03c('0x6a')](_0x5e6967[_0xa03c('0x126')])?'':_0x5e6967[_0xa03c('0x126')][_0xa03c('0x127')]()||'',_0x5e6967[_0xa03c('0x128')]>0x0?_0x51b09f[_0xa03c('0xf6')]['phone'][_0xa03c('0x129')](_0x5e6967['dialCutDigit']):_0x51b09f['Contact'][_0xa03c('0xf7')]);var _0xe9c680=_0x125a48[_0xa03c('0x96')](_0x5e6967[_0xa03c('0x50')])?ut['getCallerId'](_0x5e6967[_0xa03c('0x50')][_0xa03c('0x51')],_0x5e6967[_0xa03c('0x35')],_0x5e6967[_0xa03c('0x12a')]>0x0?ut['getCallerIdRandom'](_0x5e6967['dialOriginateCallerIdNumber'],_0x5e6967[_0xa03c('0x12a')]):_0x5e6967[_0xa03c('0x36')]):ut[_0xa03c('0x12b')](_[_0xa03c('0x6a')](_0x5e6967[_0xa03c('0x97')])?_0x5e6967[_0xa03c('0x50')][_0xa03c('0x51')]:_0x5e6967[_0xa03c('0x97')][_0xa03c('0x51')],_0x5e6967[_0xa03c('0x35')],_0x5e6967['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xa03c('0x12c')](_0x5e6967[_0xa03c('0x36')],_0x5e6967[_0xa03c('0x12a')]):_0x5e6967[_0xa03c('0x36')]);if(_0xe9c680){_0x693f08['originatecalleridname']=ut[_0xa03c('0x12d')](_0xe9c680);_0x693f08['originatecalleridnum']=ut[_0xa03c('0x12e')](_0xe9c680);}var _0x5560e3=ut['addVariables'](_0x5e6967,_0x51b09f,_0x3c45a8,_0xe9c680,_0xa7ad9,_0x693f08);_[_0xa03c('0x12f')](_0x693f08,ut[_0xa03c('0x130')](_0x5560e3));_0x693f08[_0xa03c('0x8a')]=moment()[_0xa03c('0x58')](_0xa03c('0x8b'));ami[_0xa03c('0x75')](ut[_0xa03c('0x131')](_0x693f08,_0x5e6967,_0x5560e3,_0x693f08[_0xa03c('0xc0')],_0x204ade))['then'](function(_0xb69339){_0x5e6967[_0xa03c('0x4a')]+=0x1;logger['info']('[originated][increment]',_0xa7ad9,'\x20Queue',_0x5e6967['name'],'originated:\x20',_0x5e6967[_0xa03c('0x4a')]);_0x591372(_0xb69339);})[_0xa03c('0x116')](function(_0x25e935){ut[_0xa03c('0xed')](_0x693f08,0xe,_0xa03c('0x132'));rpcDb[_0xa03c('0xeb')](_0x693f08,_0xa03c('0x133'));_0x58d212(_0x25e935);});});};Preview[_0xa03c('0x11')][_0xa03c('0x134')]=function(_0x162581){if(this['actions'][_0x162581[_0xa03c('0xa8')]]){this['actions'][_0x162581[_0xa03c('0xa8')]][_0xa03c('0x77')]=_0x162581[_0xa03c('0x77')];}};Preview[_0xa03c('0x11')][_0xa03c('0x18')]=function(_0x2ff6f6){var _0x1c9316=this;var _0x2997c2=this[_0xa03c('0x15')][_0x2ff6f6[_0xa03c('0x135')]];if(_0x2997c2){if(_0x2997c2[_0xa03c('0xf9')]&&this[_0xa03c('0x16')][_0x2997c2[_0xa03c('0xf9')]]){ut[_0xa03c('0x136')](_0x2997c2,this[_0xa03c('0x16')][_0x2997c2[_0xa03c('0xf9')]]['name'],this[_0xa03c('0x16')][_0x2997c2[_0xa03c('0xf9')]]['id']);}var _0x19fbf7=_[_0xa03c('0x137')](_0x2997c2);_0x19fbf7[_0xa03c('0xa9')]=moment()['format'](_0xa03c('0x8b'));var _0x1068bd=_0x1c9316[_0xa03c('0x24')][_0x2997c2[_0xa03c('0x6d')]];if(ut[_0xa03c('0x138')](_0x2ff6f6['response'])){if(_0x2997c2[_0xa03c('0xa7')]){rpcDb[_0xa03c('0x10e')](_0x2997c2[_0xa03c('0xfe')]);}if(_0x2997c2[_0xa03c('0xc0')]){rpcDb['disableContact'](_0x2997c2['idContact']);}ami[_0xa03c('0x25')]('custom:agentringnoanswer',ut[_0xa03c('0x9f')](_0x2997c2,_0xa03c('0x139')));this['callProgressDetectingAgent'](_0x19fbf7,_0x1068bd,_0x2ff6f6);}else{_0x2997c2[_0xa03c('0x8a')]=moment()['format'](_0xa03c('0x8b'));ut[_0xa03c('0xed')](_0x19fbf7,0x4,_0xa03c('0x13a'));rpcDb[_0xa03c('0xeb')](_0x19fbf7,_0xa03c('0x13b'));}}};Preview['prototype'][_0xa03c('0x1b')]=function(_0x45e672){var _0x39bc5a=this;var _0x548807=this[_0xa03c('0x15')][_0x45e672[_0xa03c('0xa8')]];var _0x1284d9;if(_0x548807){_0x1284d9=this[_0xa03c('0x24')][_0x548807[_0xa03c('0x6d')]];logger[_0xa03c('0x56')](_0xa03c('0x13c'),_0x45e672[_0xa03c('0xa8')],_0xa03c('0xac'),_0x1284d9['name'],_0xa03c('0xad'),_0x1284d9[_0xa03c('0x2a')]);}if(this[_0xa03c('0x15')][_0x45e672['linkedid']]&&_0x45e672[_0xa03c('0xa8')]!==_0x45e672[_0xa03c('0xb8')]){if(_0x45e672[_0xa03c('0x13d')]==='16'&&this[_0xa03c('0x15')][_0x45e672[_0xa03c('0xa8')]][_0xa03c('0x6f')]){this[_0xa03c('0x9a')](_0x45e672,_0x45e672[_0xa03c('0xa8')],_0x45e672[_0xa03c('0x13d')]);}else if(this[_0xa03c('0x15')][_0x45e672[_0xa03c('0xa8')]][_0xa03c('0x6f')]){logger[_0xa03c('0x56')](_0xa03c('0x13e'),_0x45e672[_0xa03c('0xa8')],_0x45e672[_0xa03c('0x13d')],_0xa03c('0xac'),_0x1284d9['name'],_0xa03c('0xad'),_0x1284d9[_0xa03c('0x2a')]);this[_0xa03c('0x9a')](_0x45e672,_0x45e672[_0xa03c('0xa8')],_0x45e672[_0xa03c('0x13d')]);}}else if(_0x548807&&_[_0xa03c('0x6a')](_0x548807[_0xa03c('0x13f')])&&_0x1284d9[_0xa03c('0x140')]&&_0x45e672['linkedid']===_0x45e672[_0xa03c('0xb8')]&&_[_0xa03c('0x6a')](_0x45e672[_0xa03c('0xf3')])&&_0x45e672[_0xa03c('0x13d')]==='16'&&_0x45e672[_0xa03c('0x141')]==='6'&&_[_0xa03c('0xe9')](_0x548807['transfer'])){if(_0x548807[_0xa03c('0xa7')]){rpcDb[_0xa03c('0x10e')](_0x548807[_0xa03c('0xfe')]);}if(_0x548807[_0xa03c('0xc0')]){rpcDb[_0xa03c('0x89')](_0x548807[_0xa03c('0xfe')]);}_0x45e672['reason']='22';this[_0xa03c('0xe8')](_0x548807,_0x1284d9,_0x45e672);}else if(_0x548807&&_0x548807[_0xa03c('0x142')]){if(_0x45e672[_0xa03c('0x13d')]==='16'&&this[_0xa03c('0x15')][_0x45e672[_0xa03c('0xa8')]][_0xa03c('0x6f')]){logger[_0xa03c('0x56')](_0xa03c('0x143'),_0x45e672[_0xa03c('0xa8')],_0x45e672['cause'],'\x20Queue',_0x1284d9['name'],_0xa03c('0xad'),_0x1284d9[_0xa03c('0x2a')]);this[_0xa03c('0x9a')](_0x45e672,_0x45e672[_0xa03c('0xa8')],_0x45e672[_0xa03c('0x13d')]);}else if(this[_0xa03c('0x15')][_0x45e672[_0xa03c('0xa8')]]['dialAnswer']){logger[_0xa03c('0x56')](_0xa03c('0x13e'),_0x45e672[_0xa03c('0xa8')],_0x45e672[_0xa03c('0x13d')],_0xa03c('0xac'),_0x1284d9[_0xa03c('0x26')],_0xa03c('0xad'),_0x1284d9['pTalking']);this[_0xa03c('0x9a')](_0x45e672,_0x45e672['linkedid'],_0x45e672[_0xa03c('0x13d')]);}}};Preview[_0xa03c('0x11')][_0xa03c('0x1e')]=function(_0x3cbf5b){if(this[_0xa03c('0x15')][_0x3cbf5b[_0xa03c('0x144')]]&&_0x3cbf5b[_0xa03c('0x144')]!==_0x3cbf5b[_0xa03c('0x145')]){this[_0xa03c('0x9a')](_0x3cbf5b,_0x3cbf5b[_0xa03c('0x144')],_0x3cbf5b[_0xa03c('0xe3')]);}};Preview[_0xa03c('0x11')]['syncHangupRequest']=function(_0x51ffd7){if(this[_0xa03c('0x15')][_0x51ffd7[_0xa03c('0xa8')]]&&_0x51ffd7['linkedid']!==_0x51ffd7[_0xa03c('0xb8')]&&!this[_0xa03c('0x15')][_0x51ffd7[_0xa03c('0xa8')]][_0xa03c('0x6f')]){if(_0x51ffd7['cause']==='1'){this[_0xa03c('0x9a')](_0x51ffd7,_0x51ffd7['linkedid'],_0x51ffd7[_0xa03c('0x13d')]);}}};Preview[_0xa03c('0x11')]['addVariable']=function(_0x111729,_0x51b85a,_0x1781ca){if(this['actions'][_0x111729]){if(_[_0xa03c('0x6a')](this[_0xa03c('0x15')][_0x111729][_0xa03c('0x146')])){this[_0xa03c('0x15')][_0x111729]['variables']={};}this[_0xa03c('0x15')][_0x111729][_0xa03c('0x146')][_0x51b85a]=_0x1781ca;}};Preview[_0xa03c('0x11')]['syncVarSet']=function(_0x44ecb1){try{if(!_['isNil'](_0x44ecb1)){if(ut[_0xa03c('0x147')](_[_0xa03c('0x148')](_0x44ecb1['variable'])[0x0])){this[_0xa03c('0x149')](_0x44ecb1['uniqueid'],_[_0xa03c('0x148')](_0x44ecb1['variable'])[0x0],_0x44ecb1[_0xa03c('0x14a')]);}}}catch(_0x4e01e1){logger['error'](_0xa03c('0x14b'),util[_0xa03c('0x14c')](_0x4e01e1,{'showHidden':![],'depth':null}));}};Preview[_0xa03c('0x11')][_0xa03c('0x22')]=function(_0x10ea2c){if(_0x10ea2c){if(this['actions'][_0x10ea2c[_0xa03c('0x14d')]]){this[_0xa03c('0x15')][_0x10ea2c[_0xa03c('0x14d')]][_0xa03c('0x142')]=!![];}}};Preview[_0xa03c('0x11')][_0xa03c('0x23')]=function(_0x21214f){if(_0x21214f){if(this[_0xa03c('0x15')][_0x21214f['transfererlinkedid']]){this[_0xa03c('0x15')][_0x21214f[_0xa03c('0x14e')]]['transfer']=!![];}}};module[_0xa03c('0x14f')]=Preview; \ No newline at end of file +var _0x3278=['inspect','transfertargetlinkedid','transfererlinkedid','util','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./action','./util/util','redis','localhost','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','hangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','name','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','prototype','hasOwnProperty','preview','booked','outbound','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','pick','UserId','VoiceQueueId','ListId','Action','status','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','voicePause','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','emit','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','uniqueid','linkedid','countbusyretry','cloneAction','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','outboundBlacklistCallsDay','logBlacklist','createHistory','SIP/%s','reachable','unmonitored','run','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','response','Answer','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]'];(function(_0x479f15,_0x544345){var _0x3455f1=function(_0xb1f392){while(--_0xb1f392){_0x479f15['push'](_0x479f15['shift']());}};_0x3455f1(++_0x544345);}(_0x3278,0x153));var _0x8327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3278[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x8327('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x8327('0x1'));var moment=require(_0x8327('0x2'));var md5=require('md5');var Redis=require(_0x8327('0x3'));var config=require(_0x8327('0x4'));var logger=require(_0x8327('0x5'))('preview');var loggerAction=require(_0x8327('0x5'))(_0x8327('0x6'));var ami=require('../ami');var rpcDb=require(_0x8327('0x7'));var Action=require(_0x8327('0x8'));var ut=require(_0x8327('0x9'));config[_0x8327('0xa')]=_['defaults'](config[_0x8327('0xa')],{'host':_0x8327('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8327('0xa')]));var Sequence=function(){};Sequence['prototype'][_0x8327('0xc')]=function(_0x364ad7){this[_0x8327('0xd')]=this[_0x8327('0xd')]?this[_0x8327('0xd')][_0x8327('0xe')](_0x364ad7):_0x364ad7();};function Preview(_0x40eac9){this[_0x8327('0xf')]=new Sequence();this[_0x8327('0x10')]=_0x40eac9['voiceQueues'];this[_0x8327('0x11')]=_0x40eac9[_0x8327('0x11')];this[_0x8327('0x12')]={};this[_0x8327('0x13')]=_0x40eac9['agents'];this[_0x8327('0x14')]=0x0;ami['on']('originateresponse',this[_0x8327('0x15')]['bind'](this));ami['on'](_0x8327('0x16'),this['syncHangup'][_0x8327('0x17')](this));ami['on'](_0x8327('0x18'),this[_0x8327('0x19')][_0x8327('0x17')](this));ami['on'](_0x8327('0x1a'),this[_0x8327('0x1b')][_0x8327('0x17')](this));ami['on'](_0x8327('0x1c'),this['syncNewExten'][_0x8327('0x17')](this));ami['on'](_0x8327('0x1d'),this['syncVarSet'][_0x8327('0x17')](this));ami['on']('attendedtransfer',this[_0x8327('0x1e')]['bind'](this));ami['on'](_0x8327('0x1f'),this[_0x8327('0x20')][_0x8327('0x17')](this));this[_0x8327('0x21')](this[_0x8327('0x10')]);}function emit(_0x460ef3,_0x349080,_0x25c5e9){io['to'](_0x460ef3)['emit'](_0x349080,_0x25c5e9);}function emitCampaignPreview(_0x31b18d){if(_0x31b18d[_0x8327('0x22')]==='outbound'){var _0x52adaf={'id':_0x31b18d['id'],'name':_0x31b18d[_0x8327('0x23')],'strategy':_0x31b18d[_0x8327('0x24')],'answered':_0x31b18d[_0x8327('0x25')],'available':_0x31b18d[_0x8327('0x26')],'loggedIn':_0x31b18d['loggedIn'],'pTalking':_0x31b18d[_0x8327('0x27')],'sumBillable':_0x31b18d[_0x8327('0x28')],'sumDuration':_0x31b18d[_0x8327('0x29')],'sumHoldTime':_0x31b18d[_0x8327('0x2a')]||0x0,'talking':_0x31b18d[_0x8327('0x2b')],'total':_0x31b18d[_0x8327('0x2c')],'type':_0x31b18d[_0x8327('0x22')],'unmanaged':_0x31b18d[_0x8327('0x2d')],'abandoned':_0x31b18d[_0x8327('0x2e')],'waiting':_0x31b18d[_0x8327('0x2f')],'loggedInDb':_0x31b18d[_0x8327('0x30')],'dialActive':_0x31b18d['dialActive'],'dialMethod':_0x31b18d[_0x8327('0x31')],'dialOriginateCallerIdName':_0x31b18d[_0x8327('0x32')],'dialOriginateCallerIdNumber':_0x31b18d['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x31b18d['dialOriginateTimeout'],'dialPrefix':_0x31b18d[_0x8327('0x33')],'outboundAnswerAgiCallsDay':_0x31b18d[_0x8327('0x34')],'outboundAnswerCallsDay':_0x31b18d[_0x8327('0x35')],'outboundBlacklistCallsDay':_0x31b18d['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x31b18d[_0x8327('0x36')],'outboundCongestionCallsDay':_0x31b18d[_0x8327('0x37')],'outboundDropCallsDayACS':_0x31b18d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x31b18d[_0x8327('0x38')],'outboundDropCallsDayTimeout':_0x31b18d[_0x8327('0x39')],'outboundNoAnswerCallsDay':_0x31b18d[_0x8327('0x3a')],'outboundNoSuchCallsDay':_0x31b18d[_0x8327('0x3b')],'outboundOriginateFailureCallsDay':_0x31b18d[_0x8327('0x3c')],'outboundReCallsDay':_0x31b18d[_0x8327('0x3d')],'outboundRejectCallsDay':_0x31b18d[_0x8327('0x3e')],'outboundUnknownCallsDay':_0x31b18d[_0x8327('0x3f')],'outboundAbandonedCallsDay':_0x31b18d[_0x8327('0x40')],'predictiveIntervalAnsweredCalls':_0x31b18d[_0x8327('0x41')],'predictiveIntervalAvgHoldtime':_0x31b18d[_0x8327('0x42')],'predictiveIntervalAvgTalktime':_0x31b18d[_0x8327('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x31b18d[_0x8327('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x31b18d[_0x8327('0x45')],'predictiveIntervalErlangCalls':_0x31b18d[_0x8327('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x31b18d['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x31b18d[_0x8327('0x47')],'predictiveIntervalMultiplicativeFactor':_0x31b18d[_0x8327('0x48')],'predictiveIntervalPauses':_0x31b18d['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x31b18d[_0x8327('0x49')],'predictiveIntervalTotalCalls':_0x31b18d['predictiveIntervalTotalCalls'],'message':_0x31b18d[_0x8327('0x4a')],'originated':_0x31b18d[_0x8327('0x4b')],'erlangCalls':_0x31b18d['erlangCalls'],'erlangCallToSecond':_0x31b18d[_0x8327('0x4c')],'erlangAbandonmentRate':_0x31b18d[_0x8327('0x4d')],'erlangBusyFactor':_0x31b18d[_0x8327('0x4e')],'startPredictive':_0x31b18d[_0x8327('0x4f')],'startProgressive':_0x31b18d['startProgressive']};if(_0x31b18d['Trunk']){_0x52adaf[_0x8327('0x50')]={'id':_0x31b18d['Trunk']['id'],'name':_0x31b18d[_0x8327('0x50')]['name'],'active':_0x31b18d[_0x8327('0x50')][_0x8327('0x51')],'callerid':_0x31b18d[_0x8327('0x50')][_0x8327('0x52')]};}if(_0x31b18d[_0x8327('0x53')]){_0x52adaf[_0x8327('0x53')]={'id':_0x31b18d[_0x8327('0x53')]['id'],'name':_0x31b18d[_0x8327('0x53')][_0x8327('0x23')]};}var _0x373d6b=md5(JSON[_0x8327('0x54')](_0x52adaf));if(_0x31b18d[_0x8327('0x55')]!==_0x373d6b){_0x31b18d[_0x8327('0x55')]=_0x373d6b;emit(util[_0x8327('0x56')](_0x8327('0x57'),_0x52adaf[_0x8327('0x23')]),_0x8327('0x58'),_0x52adaf);}}}function emitVoiceQueueChannelRemove(_0x5041d9){logger[_0x8327('0x59')](_0x8327('0x5a'),JSON[_0x8327('0x54')](_0x5041d9));emit(util[_0x8327('0x56')](_0x8327('0x57'),_0x5041d9[_0x8327('0x23')]),_0x8327('0x5b'),_0x5041d9);}function notSendMessagesQueue(_0x45d57d){if(_0x45d57d[_0x8327('0x5c')]){if(_0x45d57d['originated']===0x0&&_0x45d57d['pTalking']===0x0){_0x45d57d[_0x8327('0x5c')]=![];_0x45d57d[_0x8327('0x26')]=0x0;_0x45d57d[_0x8327('0x5d')]=0x0;_0x45d57d[_0x8327('0x4a')]=_0x8327('0x5e');ut[_0x8327('0x5f')](_0x8327('0x60'),_0x45d57d['name']+_0x8327('0x61'));}else{_0x45d57d[_0x8327('0x4a')]=_0x8327('0x62');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x45d57d[_0x8327('0x23')]+_0x8327('0x63'));}emitCampaignPreview(_0x45d57d);}}Preview['prototype'][_0x8327('0x21')]=function(){var _0x30cf99=this;setInterval(function(){_0x30cf99[_0x8327('0x64')]();},0x7cf);};Preview[_0x8327('0x65')][_0x8327('0x64')]=function(){var _0x4708fc=this[_0x8327('0x10')];this['clockClearZombieChannels']+=0x1;for(var _0x5afcc6 in _0x4708fc){if(_0x4708fc[_0x8327('0x66')](_0x5afcc6)&&(_0x4708fc[_0x5afcc6]['dialMethod']===_0x8327('0x67')||_0x4708fc[_0x5afcc6]['dialMethod']===_0x8327('0x68'))&&_0x4708fc[_0x5afcc6][_0x8327('0x22')]===_0x8327('0x69')){if(this[_0x8327('0x14')]>0x7){this[_0x8327('0x14')]=0x0;this['clearZombieChannels']();}}if(_0x4708fc[_0x8327('0x66')](_0x5afcc6)&&_0x4708fc[_0x5afcc6][_0x8327('0x31')]===_0x8327('0x67')&&_0x4708fc[_0x5afcc6][_0x8327('0x22')]==='outbound'){if(_0x4708fc[_0x5afcc6][_0x8327('0x6a')]){this[_0x8327('0x6b')](_0x4708fc[_0x5afcc6]);this[_0x8327('0x6c')](_0x4708fc[_0x5afcc6]);}else{notSendMessagesQueue(_0x4708fc[_0x5afcc6]);}}}};Preview[_0x8327('0x65')][_0x8327('0x6d')]=function(_0x1b6d46){var _0x403a09=this;this[_0x8327('0xf')][_0x8327('0xc')](function(){if(!_[_0x8327('0x6e')](_0x403a09[_0x8327('0x12')][_0x1b6d46])){loggerAction[_0x8327('0x59')](_0x8327('0x6f'),_0x1b6d46,_0x8327('0x70'),_0x403a09['actions'][_0x1b6d46][_0x8327('0x71')],'originated:\x20',JSON[_0x8327('0x54')](_0x403a09[_0x8327('0x10')][_0x403a09['actions'][_0x1b6d46]['queue']][_0x8327('0x4b')]),_0x8327('0x72'),JSON[_0x8327('0x54')](_0x403a09['campaignsPreview'][_0x403a09[_0x8327('0x12')][_0x1b6d46][_0x8327('0x71')]][_0x8327('0x27')]),JSON[_0x8327('0x54')](_0x403a09[_0x8327('0x12')][_0x1b6d46]['dialAnswer']),JSON[_0x8327('0x54')](_[_0x8327('0x73')](_0x403a09[_0x8327('0x12')][_0x1b6d46],['contactId',_0x8327('0x74'),_0x8327('0x75'),_0x8327('0x76')])));return ami[_0x8327('0x77')]({'action':_0x8327('0x78'),'channel':_0x403a09[_0x8327('0x12')][_0x1b6d46]['channel']})[_0x8327('0x79')](function(_0x2ea2b7){if(_0x2ea2b7['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x403a09['actions'][_0x1b6d46]){ut[_0x8327('0x7a')](_0x403a09[_0x8327('0x10')][_0x403a09[_0x8327('0x12')][_0x1b6d46][_0x8327('0x71')]],_0x8327('0x7b'));if(_0x403a09[_0x8327('0x12')][_0x1b6d46][_0x8327('0x7c')]===!![]){ut[_0x8327('0x7d')](_0x403a09[_0x8327('0x10')][_0x403a09[_0x8327('0x12')][_0x1b6d46][_0x8327('0x71')]],_0x8327('0x7b'));ut[_0x8327('0x7e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1b6d46,_0x403a09[_0x8327('0x12')][_0x1b6d46][_0x8327('0x71')]);}ut[_0x8327('0x7e')](_0x8327('0x7f')+_0x1b6d46,_0x403a09['actions'][_0x1b6d46][_0x8327('0x71')]);delete _0x403a09['actions'][_0x1b6d46];}},0x2328);}});}});};Preview[_0x8327('0x65')][_0x8327('0x80')]=function(){var _0x34cc1f=this;loggerAction[_0x8327('0x59')](_0x8327('0x81'),_[_0x8327('0x82')](this['actions']));for(var _0x3d4bfa in this[_0x8327('0x12')]){if(_0x34cc1f[_0x8327('0x12')][_0x8327('0x66')](_0x3d4bfa)){_0x34cc1f[_0x8327('0x6d')](_0x3d4bfa);}}};Preview[_0x8327('0x65')][_0x8327('0x6c')]=function(_0x38abc9){var _0x182fa1=this;rpcDb[_0x8327('0x83')](_0x38abc9['id'],ut[_0x8327('0x84')](this[_0x8327('0x13')]))['then'](function(_0x4465a2){if(!_[_0x8327('0x6e')](_0x4465a2)){for(var _0x44ab30=0x0;_0x44ab30<_0x4465a2[_0x8327('0x85')];_0x44ab30+=0x1){if(ut[_0x8327('0x86')](_0x4465a2[_0x44ab30][_0x8327('0x87')])<_0x38abc9['dialRecallMeTimeout']*0x3c){if(_0x4465a2[_0x44ab30]['Agent']&&!_0x4465a2[_0x44ab30][_0x8327('0x88')][_0x8327('0x89')]){_0x182fa1['run'](_0x4465a2[_0x44ab30]['id'])[_0x8327('0x8a')](ut[_0x8327('0x8b')](_0x8327('0x8c')))['catch'](ut['logger2'](_0x8327('0x8c')));}else{rpcDb[_0x8327('0x8d')](_0x4465a2[_0x44ab30]['id']);}}else{var _0xa3188b=new Action(_0x4465a2[_0x44ab30],_0x38abc9);_0xa3188b[_0x8327('0x8e')]=moment()[_0x8327('0x56')](_0x8327('0x8f'));_0x38abc9[_0x8327('0x3d')]+=0x1;ut[_0x8327('0x90')](_0xa3188b,0x17,_0x8327('0x91'));if(_0x38abc9[_0x8327('0x92')]){rpcDb[_0x8327('0x93')](ut[_0x8327('0x94')](_0x4465a2[_0x44ab30]));rpcDb[_0x8327('0x95')](_0xa3188b,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x8327('0x90')](_0xa3188b,0x16,_0x8327('0x96'));rpcDb[_0x8327('0x95')](_0xa3188b,_0x8327('0x97'));rpcDb[_0x8327('0x98')](_0xa3188b,_0x8327('0x97'));}}}}})[_0x8327('0x79')](ut[_0x8327('0x8b')](_0x8327('0x99')));};Preview['prototype'][_0x8327('0x6b')]=function(_0x1c56b3){_0x1c56b3[_0x8327('0x5c')]=!![];if(ut[_0x8327('0x9a')](_0x1c56b3[_0x8327('0x9b')])){_0x1c56b3[_0x8327('0x4a')]=_0x8327('0x9c');}else if(!ut[_0x8327('0x9d')](_0x1c56b3[_0x8327('0x6a')])){_0x1c56b3['message']=_0x8327('0x5e');}else if(!this['isTrunkReachable'](_0x1c56b3[_0x8327('0x50')])){if(!this[_0x8327('0x9e')](_0x1c56b3[_0x8327('0x9f')])){_0x1c56b3[_0x8327('0x4a')]=_0x8327('0xa0');}else{_0x1c56b3[_0x8327('0x4a')]='ACTIVE';}}else{_0x1c56b3['message']=_0x8327('0xa1');}emitCampaignPreview(_0x1c56b3);};Preview['prototype'][_0x8327('0xa2')]=function(_0x23cf81,_0x4bfaf5,_0x557726){var _0x1c44b9=this;var _0x1dad38=this[_0x8327('0x12')][_0x4bfaf5];var _0x515cb6=this[_0x8327('0x10')][_0x1dad38['queue']];var _0x5d53eb;if(_0x515cb6){switch(_0x557726){case'1':_0x515cb6['outboundNoSuchCallsDay']+=0x1;_0x1dad38['countnosuchnumberretry']+=0x1;_0x1dad38['countglobal']=ut[_0x8327('0xa3')](_0x1dad38);ut['logCustomer'](_0x1dad38,0x0,_0x8327('0xa4'));ami['emit'](_0x8327('0xa5'),ut[_0x8327('0xa6')](_0x1dad38,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x1dad38,_0x8327('0xa7'));if(ut[_0x8327('0xa3')](_0x1dad38)>=_0x515cb6[_0x8327('0xa8')]){_0x5d53eb=ut['cloneAction'](_0x1dad38,0xf,'Global');rpcDb['createCustomerFinal'](_0x5d53eb,_0x8327('0xa9'));}else{if(_0x1dad38[_0x8327('0xaa')]>=_0x515cb6[_0x8327('0xab')]){rpcDb['createCustomerFinal'](_0x1dad38,_0x8327('0xa9'));}else{rpcDb[_0x8327('0xac')](ut[_0x8327('0xad')](_0x1dad38,_0x8327('0xaa'),_0x515cb6[_0x8327('0xae')]),_0x1dad38[_0x8327('0xaf')],_0x1dad38['activeContact']);}}delete this[_0x8327('0x12')][_0x23cf81['linkedid']];break;case _0x8327('0xb0'):var _0x44ae88=moment()[_0x8327('0x56')](_0x8327('0x8f'));_0x1dad38[_0x8327('0xb1')]=_0x44ae88;_0x1dad38[_0x8327('0xb2')]=_0x44ae88;_0x1dad38[_0x8327('0x7c')]=!![];_0x515cb6[_0x8327('0x27')]+=0x1;logger[_0x8327('0x59')](_0x8327('0xb3'),_0x1dad38['uniqueid'],_0x8327('0xb4'),_0x515cb6[_0x8327('0x23')],_0x8327('0x72'),_0x515cb6[_0x8327('0x27')]);ami[_0x8327('0xb5')](_0x8327('0xb6'),ut[_0x8327('0xa6')](_0x1dad38,_0x8327('0xb7')));if(_0x515cb6[_0x8327('0xb8')]){ami['emit'](_0x8327('0xb9'),ut[_0x8327('0xba')](_0x1dad38));}break;case'16':ami[_0x8327('0xb5')](_0x8327('0xbb'),ut[_0x8327('0xa6')](_0x1dad38,'complete'));emitVoiceQueueChannelRemove(ut[_0x8327('0xa6')](_0x1dad38,_0x8327('0xbc')));_0x515cb6[_0x8327('0x35')]+=0x1;_0x515cb6[_0x8327('0x2c')]+=0x1;_0x515cb6[_0x8327('0x25')]+=0x1;ut[_0x8327('0x7d')](_0x515cb6,_0x8327('0xbd'));_0x1dad38[_0x8327('0xbe')]=ut[_0x8327('0xa3')](_0x1dad38);ut[_0x8327('0x90')](_0x1dad38,0x4,'Answer');rpcDb[_0x8327('0x95')](_0x1dad38,_0x8327('0xbf'));rpcDb[_0x8327('0x98')](_0x1dad38,_0x8327('0xc0'));rpcDb['crateCustomerReportQueue'](_0x1dad38);_0x515cb6[_0x8327('0x29')]+=_0x1dad38[_0x8327('0xc1')];_0x515cb6[_0x8327('0x28')]+=_0x1dad38[_0x8327('0xc1')];logger[_0x8327('0x59')]('[syncHangup][talking][decrement]',_0x1dad38[_0x8327('0xc2')],_0x8327('0xb4'),_0x515cb6[_0x8327('0x23')],_0x8327('0x72'),_0x515cb6[_0x8327('0x27')]);delete this[_0x8327('0x12')][_0x23cf81[_0x8327('0xc3')]];break;case'BUSY':_0x515cb6[_0x8327('0x36')]+=0x1;_0x1dad38[_0x8327('0xc4')]+=0x1;_0x1dad38[_0x8327('0xbe')]=ut[_0x8327('0xa3')](_0x1dad38);ut[_0x8327('0x90')](_0x1dad38,0x5,'Busy');ami[_0x8327('0xb5')]('custom:agentbusy',ut[_0x8327('0xa6')](_0x1dad38,'busy'));rpcDb[_0x8327('0x95')](_0x1dad38,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x1dad38)>=_0x515cb6['dialGlobalMaxRetry']){_0x5d53eb=ut[_0x8327('0xc5')](_0x1dad38,0xf,_0x8327('0xc6'));rpcDb['createCustomerFinal'](_0x5d53eb,_0x8327('0xc7'));}else{if(_0x1dad38[_0x8327('0xc4')]>=_0x515cb6[_0x8327('0xc8')]){rpcDb[_0x8327('0x98')](_0x1dad38,_0x8327('0xc9'));}else{rpcDb[_0x8327('0xac')](ut[_0x8327('0xad')](_0x1dad38,_0x8327('0xc4'),_0x515cb6[_0x8327('0xca')]),_0x1dad38[_0x8327('0xaf')],_0x1dad38[_0x8327('0xcb')]);}}break;case _0x8327('0xcc'):_0x515cb6[_0x8327('0x3a')]+=0x1;_0x1dad38[_0x8327('0xcd')]+=0x1;_0x1dad38[_0x8327('0xbe')]=ut['totalGlobal'](_0x1dad38);ut[_0x8327('0x90')](_0x1dad38,0x3,_0x8327('0xce'));ami[_0x8327('0xb5')]('custom:agentnoanswer',ut['buildObj'](_0x1dad38,'noanswer'));rpcDb[_0x8327('0x95')](_0x1dad38,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x1dad38)>=_0x515cb6[_0x8327('0xa8')]){_0x5d53eb=ut[_0x8327('0xc5')](_0x1dad38,0xf,'Global');rpcDb['createCustomerFinal'](_0x5d53eb,_0x8327('0xcf'));}else{if(_0x1dad38[_0x8327('0xcd')]>=_0x515cb6[_0x8327('0xd0')]){rpcDb[_0x8327('0x98')](_0x1dad38,_0x8327('0xd1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1dad38,_0x8327('0xcd'),_0x515cb6['dialNoAnswerRetryFrequency']),_0x1dad38[_0x8327('0xaf')],_0x1dad38[_0x8327('0xcb')]);}}break;case _0x8327('0xd2'):_0x515cb6[_0x8327('0x37')]+=0x1;_0x1dad38[_0x8327('0xd3')]+=0x1;_0x1dad38[_0x8327('0xbe')]=ut[_0x8327('0xa3')](_0x1dad38);ut[_0x8327('0x90')](_0x1dad38,0x8,_0x8327('0xd4'));ami['emit'](_0x8327('0xd5'),ut[_0x8327('0xa6')](_0x1dad38,_0x8327('0xd6')));rpcDb['createCustomerHistory'](_0x1dad38,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x8327('0xa3')](_0x1dad38)>=_0x515cb6[_0x8327('0xa8')]){_0x5d53eb=ut['cloneAction'](_0x1dad38,0xf,_0x8327('0xc6'));rpcDb[_0x8327('0x98')](_0x5d53eb,_0x8327('0xd7'));}else{if(_0x1dad38[_0x8327('0xd3')]>=_0x515cb6['dialCongestionMaxRetry']){rpcDb[_0x8327('0x98')](_0x1dad38,_0x8327('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x8327('0xad')](_0x1dad38,'countcongestionretry',_0x515cb6[_0x8327('0xca')]),_0x1dad38[_0x8327('0xaf')],_0x1dad38[_0x8327('0xcb')]);}}break;case _0x8327('0xd9'):_0x515cb6[_0x8327('0x3e')]+=0x1;_0x1dad38[_0x8327('0xda')]+=0x1;_0x1dad38[_0x8327('0xbe')]=ut[_0x8327('0xa3')](_0x1dad38);ut[_0x8327('0x90')](_0x1dad38,0x14,_0x8327('0xdb'));ami['emit'](_0x8327('0xdc'),ut['buildObj'](_0x1dad38,_0x8327('0xdd')));rpcDb['createCustomerHistory'](_0x1dad38,_0x8327('0xde'));if(ut[_0x8327('0xa3')](_0x1dad38)>=_0x515cb6['dialGlobalMaxRetry']){_0x5d53eb=ut[_0x8327('0xc5')](_0x1dad38,0x14,_0x8327('0xdb'));rpcDb[_0x8327('0x98')](_0x5d53eb,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x1dad38[_0x8327('0xda')]>=_0x515cb6['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x1dad38,_0x8327('0xdf'));}else{rpcDb[_0x8327('0xac')](ut[_0x8327('0xad')](_0x1dad38,_0x8327('0xda'),_0x515cb6['dialAgentRejectRetryFrequency']),_0x1dad38[_0x8327('0xaf')],_0x1dad38['activeContact']);}}break;case _0x8327('0xe0'):_0x515cb6[_0x8327('0x40')]+=0x1;_0x1dad38[_0x8327('0xe1')]+=0x1;_0x1dad38[_0x8327('0xbe')]=ut['totalGlobal'](_0x1dad38);ut[_0x8327('0x90')](_0x1dad38,0xb,_0x8327('0xe2'));rpcDb[_0x8327('0x95')](_0x1dad38,_0x8327('0xe3'));if(ut[_0x8327('0xa3')](_0x1dad38)>=_0x515cb6[_0x8327('0xa8')]){_0x5d53eb=ut[_0x8327('0xc5')](_0x1dad38,0xf,_0x8327('0xc6'));rpcDb[_0x8327('0x98')](_0x5d53eb,_0x8327('0xe3'));}else{if(_0x1dad38[_0x8327('0xe4')]>=_0x515cb6[_0x8327('0xe5')]){rpcDb['createCustomerFinal'](_0x1dad38,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0x8327('0xad')](_0x1dad38,_0x8327('0xe1'),_0x515cb6[_0x8327('0xe6')]),_0x1dad38[_0x8327('0xaf')],_0x1dad38[_0x8327('0xcb')]);}}break;default:if(_0x1dad38[_0x8327('0x7c')]){ut[_0x8327('0x7d')](_0x515cb6,'[default]');ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x515cb6['name'],_0x23cf81);}_0x515cb6['outboundUnknownCallsDay']+=0x1;_0x1dad38['countglobal']=ut['totalGlobal'](_0x1dad38);ut[_0x8327('0x90')](_0x1dad38,0xc,_0x23cf81[_0x8327('0xe7')]||_0x23cf81[_0x8327('0xe8')]);rpcDb[_0x8327('0x95')](_0x1dad38,_0x8327('0xe9'));if(ut['totalGlobal'](_0x1dad38)>=_0x515cb6['dialGlobalMaxRetry']){_0x5d53eb=ut[_0x8327('0xc5')](_0x1dad38,0xf,'Global');rpcDb['createCustomerFinal'](_0x5d53eb,_0x8327('0xea'));}else{rpcDb[_0x8327('0x98')](_0x1dad38,_0x8327('0xea'));}delete this['actions'][_0x23cf81['linkedid']];}if(!(_0x1dad38[_0x8327('0x7c')]&&_0x557726==='16')){ut['updateOriginated'](_0x515cb6,_0x8327('0xeb'));logger[_0x8327('0x59')](_0x8327('0xec'),_0x1dad38[_0x8327('0xc2')],_0x8327('0xb4'),_0x515cb6['name'],_0x8327('0xed'),_0x515cb6[_0x8327('0x4b')]);}if(_0x557726!=='ANSWER'){delete this[_0x8327('0x12')][_0x23cf81['linkedid']];delete this['actions'][_0x23cf81[_0x8327('0xee')]];}}};Preview[_0x8327('0x65')][_0x8327('0xef')]=function(_0x153323,_0x1c61bb,_0x845fc3){if(_[_0x8327('0xf0')](_0x1c61bb)&&_0x8327('0xf1')!==typeof _0x1c61bb){return;}if(_[_0x8327('0xf0')](_0x845fc3)&&_0x8327('0xf1')!==typeof _0x845fc3){return;}switch(_0x845fc3[_0x8327('0xf2')]){case'0':ut[_0x8327('0xf3')](_0x153323,0x0,'NoSuchNumber');rpcDb[_0x8327('0xf4')](_0x153323,_0x8327('0xf5'));break;case'3':ut[_0x8327('0xf3')](_0x153323,0x3,_0x8327('0xce'));rpcDb[_0x8327('0xf4')](_0x153323,_0x8327('0xf6'));break;case'5':ut[_0x8327('0xf3')](_0x153323,0x5,_0x8327('0xf7'));rpcDb[_0x8327('0xf4')](_0x153323,_0x8327('0xf8'));break;case'8':ut[_0x8327('0xf3')](_0x153323,0x8,_0x8327('0xd4'));rpcDb[_0x8327('0xf4')](_0x153323,_0x8327('0xf9'));break;case'22':ut[_0x8327('0xf3')](_0x153323,0x16,'AnswerAGI');rpcDb[_0x8327('0xf4')](_0x153323,_0x8327('0xfa'));break;default:ut['logAgent'](_0x153323,0xc,_0x845fc3[_0x8327('0xf2')]);rpcDb['createAgentHistory'](_0x153323,_0x8327('0xf9'));}ut[_0x8327('0x7a')](_0x1c61bb,_0x8327('0xfb'));logger[_0x8327('0x59')](_0x8327('0xfc'),_0x153323['uniqueid'],_0x8327('0xb4'),_0x1c61bb[_0x8327('0x23')],_0x8327('0xed'),_0x1c61bb[_0x8327('0x4b')]);delete this['actions'][_0x153323[_0x8327('0xc2')]];};Preview[_0x8327('0x65')][_0x8327('0xfd')]=function(_0xf49d55,_0x5f5171,_0x1e9b60,_0x38d55f,_0x5cb68e){var _0x46efd9=this;return new BPromise(function(_0xb8488d,_0x524ed8){if(_[_0x8327('0x6e')](_0x5f5171)||_['isNil'](_0x5f5171[_0x8327('0xfe')])||_[_0x8327('0x6e')](_0x5f5171[_0x8327('0xfe')][_0x8327('0xff')])||_['isNil'](_0x5f5171[_0x8327('0x75')])){_0x524ed8(ut[_0x8327('0x4a')](_0x8327('0x100'),_0x38d55f,_0x5cb68e));return;}var _0x29d75c=uuid['v4']();var _0x7aa9f0=_0x46efd9['campaignsPreview'][_0x5f5171[_0x8327('0x70')]['name']];var _0x238b3b=_0x1e9b60?_0x46efd9[_0x8327('0x13')][_0x1e9b60]['id']:undefined;_0x46efd9['actions'][_0x29d75c]=new Action(_0x5f5171,_0x7aa9f0,_0x29d75c,_0x1e9b60,_0x238b3b);var _0x1b5b63=_0x46efd9[_0x8327('0x12')][_0x29d75c];_0x1b5b63[_0x8327('0xaf')]=_0x38d55f;_0x1b5b63[_0x8327('0xcb')]=_0x5cb68e;_0x1b5b63[_0x8327('0x101')]=_0x1e9b60;if(_[_0x8327('0x102')](_0xf49d55)){_0x46efd9[_0x8327('0x103')](_0x1b5b63,_0x7aa9f0,_0x5f5171,_0x1e9b60)['then'](function(_0x24d9e9){logger[_0x8327('0x59')]('[Preview][execCall][success]',_0x8327('0x104')+_0x1b5b63['queue']+_0x8327('0x105')+_0x1b5b63[_0x8327('0x106')],JSON[_0x8327('0x54')](_0x24d9e9));ami['emit'](_0x8327('0x107'),ut['buildObj'](_0x1b5b63,'called'));_0xb8488d(ut[_0x8327('0x4a')](_0x8327('0x108')));})[_0x8327('0x79')](function(_0x1df011){ut[_0x8327('0x5f')]('[Preview][execCall][failure]',_0x1df011);_0x524ed8(ut[_0x8327('0x4a')]('Call\x20failed',_0x38d55f,_0x5cb68e));});}else{_0x7aa9f0[_0x8327('0x109')]+=0x1;ut[_0x8327('0x10a')](_0x1b5b63);rpcDb[_0x8327('0x10b')](_0x1b5b63,'[Blacklist][error]');delete _0x46efd9[_0x8327('0x12')][_0x29d75c];_0x524ed8(ut['message']('Contact\x20in\x20black\x20List',_0x38d55f,_0x5cb68e));}});};Preview['prototype'][_0x8327('0x9e')]=function(_0x3b2db8){return!_[_0x8327('0x6e')](_0x3b2db8)&&!_['isNil'](_0x3b2db8[_0x8327('0x23')])&&!_[_0x8327('0x6e')](_0x3b2db8['active'])&&_0x3b2db8[_0x8327('0x51')]&&!_['isNil'](this['trunks'][util[_0x8327('0x56')](_0x8327('0x10c'),_0x3b2db8[_0x8327('0x23')])])&&!_[_0x8327('0x6e')](this[_0x8327('0x11')][util[_0x8327('0x56')](_0x8327('0x10c'),_0x3b2db8[_0x8327('0x23')])][_0x8327('0x78')])&&(this['trunks'][util[_0x8327('0x56')](_0x8327('0x10c'),_0x3b2db8[_0x8327('0x23')])][_0x8327('0x78')]===_0x8327('0x10d')||this['trunks'][util[_0x8327('0x56')](_0x8327('0x10c'),_0x3b2db8[_0x8327('0x23')])][_0x8327('0x78')]===_0x8327('0x10e'));};Preview['prototype'][_0x8327('0x10f')]=function(_0xbfad27,_0x28ce52){var _0x432d8f=this;return new BPromise(function(_0x31e900,_0x24e5f1){_0x432d8f[_0x8327('0x110')](_0xbfad27,_0x28ce52)[_0x8327('0x8a')](function(_0x178283){_0x31e900(_[_0x8327('0x73')](_0x178283,[_0x8327('0x4a')]));})[_0x8327('0x79')](function(_0x73bc0f){if(_0x73bc0f[_0x8327('0x111')]){rpcDb[_0x8327('0x112')](_0xbfad27);}if(_0x73bc0f[_0x8327('0x51')]){rpcDb['disableContact'](_0xbfad27);}_0x24e5f1(_['pick'](_0x73bc0f,['message']));});});};Preview['prototype'][_0x8327('0x110')]=function(_0x449858,_0x23e94e){var _0x1f053e=this;return new BPromise(function(_0xa6c9d3,_0x430c48){var _0x16c352,_0x1140e7;rpcDb[_0x8327('0x113')](_0x449858)['then'](function(_0x2d609e){if(!_[_0x8327('0x6e')](_0x2d609e[0x0])){_0x1140e7=_0x2d609e[0x0]['recallme']?![]:!![];_0x16c352=_0x2d609e[0x0][_0x8327('0x114')]?!![]:![];_0x16c352=_0x23e94e?!![]:_0x16c352;}var _0x748a9c=_0x1f053e['validateContact'](_0x2d609e);if(_0x748a9c[_0x8327('0x115')]){rpcDb['checkIsBlackList'](_[_0x8327('0x73')](_0x2d609e[0x0],['VoiceQueueId','Contact.phone']))[_0x8327('0x8a')](function(_0x674b58){_0x1f053e['checkInBlack'](_0x674b58,_0x2d609e[0x0],_0x23e94e,_0x1140e7,_0x16c352)[_0x8327('0x8a')](function(_0x3dd1d2){_0xa6c9d3(_0x3dd1d2);})[_0x8327('0x79')](function(_0x5ec7d5){_0x430c48(_0x5ec7d5);});})['catch'](function(_0x284076){ut['logger']('[Preview][checkIsBlackList]',_0x284076);_0x430c48(ut[_0x8327('0x4a')](_0x8327('0x116'),_0x1140e7,_0x16c352));});}else{_0x430c48(ut['message'](_0x748a9c['message'],_0x1140e7,_0x16c352));}})['catch'](function(_0x3db258){ut[_0x8327('0x5f')](_0x8327('0x117'),_0x3db258);_0x430c48(ut[_0x8327('0x4a')](_0x8327('0x116'),![],!![]));});});};Preview['prototype'][_0x8327('0x118')]=function(_0x46bc70){if(_[_0x8327('0x6e')](_0x46bc70)||_[_0x8327('0x102')](_0x46bc70)||!_[_0x8327('0x6e')](_0x46bc70[0x0][_0x8327('0x88')])&&_[_0x8327('0x6e')](_0x46bc70[0x0][_0x8327('0x88')][_0x8327('0x23')])){ut[_0x8327('0x5f')]('[Preview][validateContact][Empty\x20Contact]',_0x46bc70);return{'isValid':![],'message':_0x8327('0x119')};}var _0x54ebc6=this['campaignsPreview'][_0x46bc70[0x0][_0x8327('0x70')][_0x8327('0x23')]];_0x54ebc6[_0x8327('0x4a')]=_0x8327('0xa1');if(_[_0x8327('0x6e')](_0x54ebc6)){ut[_0x8327('0x5f')](_0x8327('0x11a'),_0x54ebc6);return{'isValid':![],'message':_0x8327('0x11b')};}if(!this[_0x8327('0x9e')](_0x54ebc6[_0x8327('0x50')])){ut[_0x8327('0x5f')](_0x8327('0x11c'),'campaign\x20Name:\x20'+_0x54ebc6[_0x8327('0x23')]+_0x8327('0x11d'));if(!this[_0x8327('0x9e')](_0x54ebc6[_0x8327('0x9f')])){ut[_0x8327('0x5f')](_0x8327('0x11c'),_0x54ebc6[_0x8327('0x23')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x8327('0x11e')};}}if(!ut[_0x8327('0x9d')](_0x54ebc6[_0x8327('0x6a')])){ut[_0x8327('0x5f')](_0x8327('0x11f'),_0x54ebc6[_0x8327('0x23')]+_0x8327('0x120'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x54ebc6[_0x8327('0x23')]+_0x8327('0x120')};}return{'isValid':!![],'message':_0x8327('0x121')};};Preview[_0x8327('0x65')][_0x8327('0x103')]=function(_0x2409d7,_0x1236a0,_0x599a16,_0x5e9f46){var _0x3466bd=this;return new BPromise(function(_0x57b668,_0x257ecd){var _0x21ba1b=_0x2409d7[_0x8327('0xc2')];var _0xabb07e=_0x3466bd[_0x8327('0x9e')](_0x1236a0[_0x8327('0x50')])?util[_0x8327('0x56')](_0x8327('0x122'),_0x1236a0[_0x8327('0x50')][_0x8327('0x23')],_[_0x8327('0x6e')](_0x1236a0[_0x8327('0x33')])?'':_0x1236a0['dialPrefix'][_0x8327('0x123')]()||'',_0x1236a0[_0x8327('0x124')]>0x0?_0x599a16['Contact'][_0x8327('0xff')][_0x8327('0x125')](_0x1236a0['dialCutDigit']):_0x599a16['Contact'][_0x8327('0xff')]):util[_0x8327('0x56')]('SIP/%s/%s%s',_[_0x8327('0x6e')](_0x1236a0[_0x8327('0x9f')])?_0x1236a0['Trunk'][_0x8327('0x23')]:_0x1236a0[_0x8327('0x9f')]['name'],_[_0x8327('0x6e')](_0x1236a0[_0x8327('0x33')])?'':_0x1236a0[_0x8327('0x33')][_0x8327('0x123')]()||'',_0x1236a0[_0x8327('0x124')]>0x0?_0x599a16[_0x8327('0xfe')][_0x8327('0xff')]['substring'](_0x1236a0['dialCutDigit']):_0x599a16[_0x8327('0xfe')][_0x8327('0xff')]);var _0x1830d5=_0x3466bd[_0x8327('0x9e')](_0x1236a0[_0x8327('0x50')])?ut[_0x8327('0x126')](_0x1236a0[_0x8327('0x50')]['callerid'],_0x1236a0[_0x8327('0x32')],_0x1236a0['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x8327('0x127')](_0x1236a0[_0x8327('0x128')],_0x1236a0[_0x8327('0x129')]):_0x1236a0[_0x8327('0x128')]):ut[_0x8327('0x126')](_['isNil'](_0x1236a0[_0x8327('0x9f')])?_0x1236a0[_0x8327('0x50')]['callerid']:_0x1236a0[_0x8327('0x9f')][_0x8327('0x52')],_0x1236a0[_0x8327('0x32')],_0x1236a0[_0x8327('0x129')]>0x0?ut['getCallerIdRandom'](_0x1236a0[_0x8327('0x128')],_0x1236a0[_0x8327('0x129')]):_0x1236a0['dialOriginateCallerIdNumber']);if(_0x1830d5){_0x2409d7[_0x8327('0x12a')]=ut['extractCalleridName'](_0x1830d5);_0x2409d7[_0x8327('0x12b')]=ut[_0x8327('0x12c')](_0x1830d5);}var _0x2254d9=ut[_0x8327('0x12d')](_0x1236a0,_0x599a16,_0xabb07e,_0x1830d5,_0x21ba1b,_0x2409d7);_[_0x8327('0x12e')](_0x2409d7,ut[_0x8327('0x12f')](_0x2254d9));_0x2409d7[_0x8327('0x8e')]=moment()[_0x8327('0x56')](_0x8327('0x8f'));ami[_0x8327('0x77')](ut['variablesAction'](_0x2409d7,_0x1236a0,_0x2254d9,_0x2409d7[_0x8327('0xcb')],_0x5e9f46))['then'](function(_0xe674b4){_0x1236a0[_0x8327('0x4b')]+=0x1;logger[_0x8327('0x59')](_0x8327('0x130'),_0x21ba1b,_0x8327('0xb4'),_0x1236a0[_0x8327('0x23')],_0x8327('0xed'),_0x1236a0[_0x8327('0x4b')]);_0x57b668(_0xe674b4);})[_0x8327('0x79')](function(_0x2ac1c6){ut[_0x8327('0xf3')](_0x2409d7,0xe,_0x8327('0x131'));rpcDb['createAgentHistory'](_0x2409d7,_0x8327('0x132'));_0x257ecd(_0x2ac1c6);});});};Preview[_0x8327('0x65')][_0x8327('0x133')]=function(_0x3b58d6){if(this[_0x8327('0x12')][_0x3b58d6[_0x8327('0xc3')]]){this[_0x8327('0x12')][_0x3b58d6[_0x8327('0xc3')]][_0x8327('0x134')]=_0x3b58d6[_0x8327('0x134')];}};Preview[_0x8327('0x65')][_0x8327('0x15')]=function(_0x114286){var _0xe96b7d=this;var _0x276925=this[_0x8327('0x12')][_0x114286[_0x8327('0x135')]];if(_0x276925){if(_0x276925[_0x8327('0x101')]&&this[_0x8327('0x13')][_0x276925[_0x8327('0x101')]]){ut[_0x8327('0x136')](_0x276925,this['agents'][_0x276925[_0x8327('0x101')]]['name'],this[_0x8327('0x13')][_0x276925[_0x8327('0x101')]]['id']);}var _0x42f308=_[_0x8327('0x137')](_0x276925);_0x42f308['responsetime']=moment()[_0x8327('0x56')]('YYYY-MM-DD\x20HH:mm:ss');var _0x100a1e=_0xe96b7d[_0x8327('0x10')][_0x276925['queue']];if(ut[_0x8327('0x138')](_0x114286[_0x8327('0x139')])){if(_0x276925[_0x8327('0xaf')]){rpcDb[_0x8327('0x112')](_0x276925[_0x8327('0x106')]);}if(_0x276925[_0x8327('0xcb')]){rpcDb[_0x8327('0x8d')](_0x276925[_0x8327('0x106')]);}ami[_0x8327('0xb5')]('custom:agentringnoanswer',ut[_0x8327('0xa6')](_0x276925,'rejected'));this[_0x8327('0xef')](_0x42f308,_0x100a1e,_0x114286);}else{_0x276925[_0x8327('0x8e')]=moment()['format'](_0x8327('0x8f'));ut['logAgent'](_0x42f308,0x4,_0x8327('0x13a'));rpcDb[_0x8327('0xf4')](_0x42f308,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0x8327('0x13b')]=function(_0xfdbd1e){var _0x273fce=this;var _0x5a0c8c=this[_0x8327('0x12')][_0xfdbd1e[_0x8327('0xc3')]];var _0x2a171c;if(_0x5a0c8c){_0x2a171c=this[_0x8327('0x10')][_0x5a0c8c[_0x8327('0x71')]];logger[_0x8327('0x59')](_0x8327('0x13c'),_0xfdbd1e['linkedid'],_0x8327('0xb4'),_0x2a171c[_0x8327('0x23')],_0x8327('0x72'),_0x2a171c[_0x8327('0x27')]);}if(this['actions'][_0xfdbd1e['linkedid']]&&_0xfdbd1e[_0x8327('0xc3')]!==_0xfdbd1e[_0x8327('0xc2')]){if(_0xfdbd1e[_0x8327('0x13d')]==='16'&&this[_0x8327('0x12')][_0xfdbd1e[_0x8327('0xc3')]][_0x8327('0x7c')]){this[_0x8327('0xa2')](_0xfdbd1e,_0xfdbd1e[_0x8327('0xc3')],_0xfdbd1e['cause']);}else if(this[_0x8327('0x12')][_0xfdbd1e[_0x8327('0xc3')]]['dialAnswer']){logger['info'](_0x8327('0x13e'),_0xfdbd1e[_0x8327('0xc3')],_0xfdbd1e[_0x8327('0x13d')],'\x20Queue',_0x2a171c[_0x8327('0x23')],'pTalking:\x20',_0x2a171c['pTalking']);this['callProgressDetectingCustomer'](_0xfdbd1e,_0xfdbd1e['linkedid'],_0xfdbd1e[_0x8327('0x13d')]);}}else if(_0x5a0c8c&&_[_0x8327('0x6e')](_0x5a0c8c[_0x8327('0x13f')])&&_0x2a171c[_0x8327('0x140')]&&_0xfdbd1e[_0x8327('0xc3')]===_0xfdbd1e[_0x8327('0xc2')]&&_['isNil'](_0xfdbd1e[_0x8327('0xf2')])&&_0xfdbd1e['cause']==='16'&&_0xfdbd1e['channelstate']==='6'&&_['isUndefined'](_0x5a0c8c[_0x8327('0x141')])){if(_0x5a0c8c[_0x8327('0xaf')]){rpcDb['unlockContact'](_0x5a0c8c[_0x8327('0x106')]);}if(_0x5a0c8c[_0x8327('0xcb')]){rpcDb[_0x8327('0x8d')](_0x5a0c8c[_0x8327('0x106')]);}_0xfdbd1e[_0x8327('0xf2')]='22';this['callProgressDetectingAgent'](_0x5a0c8c,_0x2a171c,_0xfdbd1e);}else if(_0x5a0c8c&&_0x5a0c8c[_0x8327('0x141')]){if(_0xfdbd1e[_0x8327('0x13d')]==='16'&&this[_0x8327('0x12')][_0xfdbd1e['linkedid']]['dialAnswer']){logger['info'](_0x8327('0x142'),_0xfdbd1e[_0x8327('0xc3')],_0xfdbd1e['cause'],_0x8327('0xb4'),_0x2a171c['name'],'pTalking:\x20',_0x2a171c['pTalking']);this[_0x8327('0xa2')](_0xfdbd1e,_0xfdbd1e[_0x8327('0xc3')],_0xfdbd1e[_0x8327('0x13d')]);}else if(this[_0x8327('0x12')][_0xfdbd1e[_0x8327('0xc3')]][_0x8327('0x7c')]){logger[_0x8327('0x59')]('[syncHangup][talking][cause]',_0xfdbd1e[_0x8327('0xc3')],_0xfdbd1e[_0x8327('0x13d')],_0x8327('0xb4'),_0x2a171c[_0x8327('0x23')],_0x8327('0x72'),_0x2a171c[_0x8327('0x27')]);this['callProgressDetectingCustomer'](_0xfdbd1e,_0xfdbd1e[_0x8327('0xc3')],_0xfdbd1e[_0x8327('0x13d')]);}}};Preview[_0x8327('0x65')][_0x8327('0x1b')]=function(_0x33afa1){if(this['actions'][_0x33afa1['destlinkedid']]&&_0x33afa1[_0x8327('0xee')]!==_0x33afa1[_0x8327('0x143')]){this[_0x8327('0xa2')](_0x33afa1,_0x33afa1[_0x8327('0xee')],_0x33afa1[_0x8327('0xe8')]);}};Preview[_0x8327('0x65')]['syncHangupRequest']=function(_0x4c6b8d){if(this[_0x8327('0x12')][_0x4c6b8d['linkedid']]&&_0x4c6b8d[_0x8327('0xc3')]!==_0x4c6b8d[_0x8327('0xc2')]&&!this[_0x8327('0x12')][_0x4c6b8d['linkedid']][_0x8327('0x7c')]){if(_0x4c6b8d['cause']==='1'){this['callProgressDetectingCustomer'](_0x4c6b8d,_0x4c6b8d[_0x8327('0xc3')],_0x4c6b8d['cause']);}}};Preview[_0x8327('0x65')][_0x8327('0x144')]=function(_0x41bea1,_0x30c40b,_0x53fb21){if(this[_0x8327('0x12')][_0x41bea1]){if(_[_0x8327('0x6e')](this[_0x8327('0x12')][_0x41bea1][_0x8327('0x145')])){this[_0x8327('0x12')][_0x41bea1]['variables']={};}this[_0x8327('0x12')][_0x41bea1]['variables'][_0x30c40b]=_0x53fb21;}};Preview[_0x8327('0x65')][_0x8327('0x146')]=function(_0x599acb){try{if(!_[_0x8327('0x6e')](_0x599acb)){if(ut[_0x8327('0x147')](_[_0x8327('0x148')](_0x599acb['variable'])[0x0])){this[_0x8327('0x144')](_0x599acb[_0x8327('0xc2')],_[_0x8327('0x148')](_0x599acb[_0x8327('0x149')])[0x0],_0x599acb[_0x8327('0x14a')]);}}}catch(_0x196b42){logger[_0x8327('0x14b')](_0x8327('0x14c'),util[_0x8327('0x14d')](_0x196b42,{'showHidden':![],'depth':null}));}};Preview[_0x8327('0x65')][_0x8327('0x1e')]=function(_0x1f7ff5){if(_0x1f7ff5){if(this[_0x8327('0x12')][_0x1f7ff5[_0x8327('0x14e')]]){this[_0x8327('0x12')][_0x1f7ff5[_0x8327('0x14e')]][_0x8327('0x141')]=!![];}}};Preview['prototype'][_0x8327('0x20')]=function(_0x4a40f5){if(_0x4a40f5){if(this[_0x8327('0x12')][_0x4a40f5[_0x8327('0x14f')]]){this['actions'][_0x4a40f5[_0x8327('0x14f')]][_0x8327('0x141')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index b23366c..b5dac26 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 _0x3937=['queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','exten','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x31e5c0,_0x95f72c){var _0x5db965=function(_0x871a96){while(--_0x871a96){_0x31e5c0['push'](_0x31e5c0['shift']());}};_0x5db965(++_0x95f72c);}(_0x3937,0xbf));var _0x7393=function(_0x377ed7,_0x7b6295){_0x377ed7=_0x377ed7-0x0;var _0x5ea487=_0x3937[_0x377ed7];return _0x5ea487;};'use strict';var util=require(_0x7393('0x0'));var BPromise=require('bluebird');var logger=require(_0x7393('0x1'))(_0x7393('0x2'));var _=require('lodash');var cmHopper=require(_0x7393('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x7393('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x7393('0x5'));var agentReportPreview=require(_0x7393('0x6'));var voiceQueueReport=require(_0x7393('0x7'));function loggerCatch(_0x1f538f){return function(_0x15eabd){logger[_0x7393('0x8')](_0x1f538f,util[_0x7393('0x9')](_0x15eabd,{'showHidden':![],'depth':null}));};}function create(_0x26668a){return BPromise[_0x7393('0xa')]()['then'](cmHopperHistory['createHistory'](_0x26668a))[_0x7393('0xb')](loggerCatch(_0x7393('0xc')));}function createAgent(_0x1cc3fd){return BPromise['resolve']()[_0x7393('0xd')](agentReportPreview['createHistory'](_0x1cc3fd))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x497b6b){return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](cmHopper[_0x7393('0xe')](_0x497b6b,!![]))['catch'](loggerCatch(_0x7393('0xf')));}exports[_0x7393('0x10')]=function(_0x20fb41){return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](cmHopperBlack[_0x7393('0x10')](_0x20fb41))[_0x7393('0xb')](loggerCatch(_0x7393('0x11')));};exports[_0x7393('0x12')]=function(_0x4e521c){return BPromise['resolve']()[_0x7393('0xd')](cmHopper['getContactPreview'](_0x4e521c))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x7393('0x13')]=function(_0x54dc47,_0x2a1180){create(_0x54dc47)[_0x7393('0xb')](loggerCatch(_0x2a1180));moveContact(_0x54dc47)['catch'](loggerCatch(_0x2a1180));};exports[_0x7393('0x14')]=function(_0x5745cb,_0x5694b6){createAgent(_0x5745cb)[_0x7393('0xb')](loggerCatch(_0x5694b6));};exports[_0x7393('0x15')]=function(_0x1b032c,_0x1dc3e3){create(_0x1b032c)[_0x7393('0xb')](loggerCatch(_0x1dc3e3));};exports[_0x7393('0x16')]=function(_0x21f712,_0x208b9a){moveContact(_0x21f712)['catch'](loggerCatch(_0x208b9a));};exports['rescheduleContact']=function(_0x30eae3,_0x16f617,_0x3979b7){if(_0x16f617){_0x30eae3[_0x7393('0x17')]=null;}if(_0x3979b7){_0x30eae3[_0x7393('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x30eae3))[_0x7393('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x2bf7a9){return BPromise[_0x7393('0xa')]()['then'](cmHopper[_0x7393('0x19')](_0x2bf7a9))[_0x7393('0xb')](loggerCatch(_0x7393('0x1a')));};exports[_0x7393('0x1b')]=function(_0x3fe456){return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](cmHopper[_0x7393('0x1b')]({'UserId':null},_0x3fe456,0x1))[_0x7393('0xb')](loggerCatch(_0x7393('0x1c')));};exports[_0x7393('0x1d')]=function(_0x123ab4){return BPromise[_0x7393('0xa')]()['then'](cmHopper[_0x7393('0x1b')]({'active':![]},_0x123ab4,0x1))[_0x7393('0xb')](loggerCatch(_0x7393('0x1e')));};exports[_0x7393('0x1f')]=function(_0x1013aa){var _0xd8dfae={};_0xd8dfae['type']=_0x1013aa[_0x7393('0x20')];_0xd8dfae['uniqueid']=_0x1013aa[_0x7393('0x21')];_0xd8dfae['calleridnum']=_0x1013aa[_0x7393('0x22')];_0xd8dfae[_0x7393('0x23')]=_0x1013aa[_0x7393('0x23')];_0xd8dfae[_0x7393('0x24')]=_0x1013aa[_0x7393('0x24')];_0xd8dfae[_0x7393('0x25')]=_0x1013aa[_0x7393('0x26')];_0xd8dfae[_0x7393('0x27')]=_0x1013aa[_0x7393('0x26')];_0xd8dfae[_0x7393('0x28')]=0x1;_0xd8dfae[_0x7393('0x29')]=_0x1013aa[_0x7393('0x2a')];_0xd8dfae['connectedlinename']=_0x1013aa['membername'];_0xd8dfae[_0x7393('0x2b')]='from-sip';_0xd8dfae[_0x7393('0x2c')]='xcally-motion-preview';_0xd8dfae[_0x7393('0x2d')]=0x0;_0xd8dfae['assigned']=0x1;_0xd8dfae[_0x7393('0x2e')]=_0x1013aa[_0x7393('0x2f')];_0xd8dfae[_0x7393('0x30')]=_0x7393('0x31');return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](voiceQueueReport[_0x7393('0x32')](_0xd8dfae))[_0x7393('0xb')](loggerCatch(_0x7393('0x33')));};exports[_0x7393('0x34')]=function(_0x585d47,_0x17e110){return BPromise['resolve']()[_0x7393('0xd')](cmHopper['getContactRecallMe'](_0x585d47,_0x17e110))[_0x7393('0xb')](loggerCatch(_0x7393('0x35')));};exports[_0x7393('0x36')]=function(_0x308cfb){return BPromise[_0x7393('0xa')]()['then'](cmHopper[_0x7393('0x37')](_0x308cfb,!![],!![]))['catch'](loggerCatch(_0x7393('0x38')));}; \ No newline at end of file +var _0x84e7=['calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','exten','holdtime','lastAssignedTo','membername','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x84e7,0x122));var _0x784e=function(_0x46157f,_0x1a57df){_0x46157f=_0x46157f-0x0;var _0xe3408c=_0x84e7[_0x46157f];return _0xe3408c;};'use strict';var util=require('util');var BPromise=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('preview');var _=require(_0x784e('0x2'));var cmHopper=require(_0x784e('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x784e('0x4'));var cmHopperBlack=require(_0x784e('0x5'));var voiceQueueRt=require(_0x784e('0x6'));var agentReportPreview=require(_0x784e('0x7'));var voiceQueueReport=require(_0x784e('0x8'));function loggerCatch(_0x133296){return function(_0x48ed22){logger[_0x784e('0x9')](_0x133296,util['inspect'](_0x48ed22,{'showHidden':![],'depth':null}));};}function create(_0xfaa170){return BPromise[_0x784e('0xa')]()['then'](cmHopperHistory[_0x784e('0xb')](_0xfaa170))[_0x784e('0xc')](loggerCatch(_0x784e('0xd')));}function createAgent(_0x3ddd55){return BPromise['resolve']()['then'](agentReportPreview[_0x784e('0xb')](_0x3ddd55))[_0x784e('0xc')](loggerCatch(_0x784e('0xd')));}function moveContact(_0x2fd1b5){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0xf')](_0x2fd1b5,!![]))[_0x784e('0xc')](loggerCatch(_0x784e('0x10')));}exports[_0x784e('0x11')]=function(_0x208d24){return BPromise['resolve']()[_0x784e('0xe')](cmHopperBlack['checkIsBlackList'](_0x208d24))[_0x784e('0xc')](loggerCatch(_0x784e('0x12')));};exports[_0x784e('0x13')]=function(_0x21e844){return BPromise[_0x784e('0xa')]()[_0x784e('0xe')](cmHopper[_0x784e('0x13')](_0x21e844))[_0x784e('0xc')](loggerCatch(_0x784e('0x14')));};exports['createHistory']=function(_0x519059,_0x112ba1){create(_0x519059)[_0x784e('0xc')](loggerCatch(_0x112ba1));moveContact(_0x519059)[_0x784e('0xc')](loggerCatch(_0x112ba1));};exports[_0x784e('0x15')]=function(_0x3ac83,_0x19072b){createAgent(_0x3ac83)[_0x784e('0xc')](loggerCatch(_0x19072b));};exports['createCustomerHistory']=function(_0x2524d0,_0x285ddd){create(_0x2524d0)[_0x784e('0xc')](loggerCatch(_0x285ddd));};exports[_0x784e('0x16')]=function(_0x440cd6,_0x42f894){moveContact(_0x440cd6)[_0x784e('0xc')](loggerCatch(_0x42f894));};exports['rescheduleContact']=function(_0x5add8f,_0x12aacb,_0x52bc9d){if(_0x12aacb){_0x5add8f[_0x784e('0x17')]=null;}if(_0x52bc9d){_0x5add8f[_0x784e('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x784e('0x19')](_0x5add8f))[_0x784e('0xc')](loggerCatch(_0x784e('0x1a')));};exports[_0x784e('0x1b')]=function(_0x51f452){return BPromise['resolve']()['then'](cmHopper[_0x784e('0x1b')](_0x51f452))[_0x784e('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x784e('0x1c')]=function(_0x5e809a){return BPromise[_0x784e('0xa')]()['then'](cmHopper[_0x784e('0x1c')]({'UserId':null},_0x5e809a,0x1))[_0x784e('0xc')](loggerCatch(_0x784e('0x1d')));};exports[_0x784e('0x1e')]=function(_0x5cb14f){return BPromise[_0x784e('0xa')]()[_0x784e('0xe')](cmHopper[_0x784e('0x1c')]({'active':![]},_0x5cb14f,0x1))[_0x784e('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x784e('0x1f')]=function(_0xa3603f){var _0x5f3da2={};_0x5f3da2['type']=_0xa3603f[_0x784e('0x20')];_0x5f3da2[_0x784e('0x21')]=_0xa3603f[_0x784e('0x21')];_0x5f3da2[_0x784e('0x22')]=_0xa3603f[_0x784e('0x22')];_0x5f3da2[_0x784e('0x23')]=_0xa3603f[_0x784e('0x23')];_0x5f3da2[_0x784e('0x24')]=_0xa3603f[_0x784e('0x24')];_0x5f3da2[_0x784e('0x25')]=_0xa3603f[_0x784e('0x26')];_0x5f3da2[_0x784e('0x27')]=_0xa3603f[_0x784e('0x26')];_0x5f3da2[_0x784e('0x28')]=0x1;_0x5f3da2[_0x784e('0x29')]=_0xa3603f['endtime'];_0x5f3da2[_0x784e('0x2a')]=_0xa3603f['membername'];_0x5f3da2[_0x784e('0x2b')]=_0x784e('0x2c');_0x5f3da2[_0x784e('0x2d')]='xcally-motion-preview';_0x5f3da2[_0x784e('0x2e')]=0x0;_0x5f3da2['assigned']=0x1;_0x5f3da2[_0x784e('0x2f')]=_0xa3603f[_0x784e('0x30')];_0x5f3da2['queuecallerexitreason']=_0x784e('0x31');return BPromise[_0x784e('0xa')]()['then'](voiceQueueReport['create'](_0x5f3da2))[_0x784e('0xc')](loggerCatch(_0x784e('0x32')));};exports[_0x784e('0x33')]=function(_0x4724af,_0x33b2a6){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0x33')](_0x4724af,_0x33b2a6))['catch'](loggerCatch(_0x784e('0x34')));};exports['rescheduleContactInQueue']=function(_0x4adb1f){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0x19')](_0x4adb1f,!![],!![]))['catch'](loggerCatch(_0x784e('0x35')));}; \ 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 92dc6ac..92ff653 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 _0xc00b=['updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','state','logLookAgent','membername','UserId','logCustomer','ringtime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','clone','Global','scheduledAt','active','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','buildAcw','agentReadyId','not_inuse','status','reachable','getDiff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','scheduledat','countnoanswerretry','countglobal','callback','callbackat','recallme','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','util','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','format','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper'];(function(_0x1b5a6f,_0x122f36){var _0x21a20a=function(_0xfa2172){while(--_0xfa2172){_0x1b5a6f['push'](_0x1b5a6f['shift']());}};_0x21a20a(++_0x122f36);}(_0xc00b,0x1e5));var _0xbc00=function(_0x1baa84,_0x3c938e){_0x1baa84=_0x1baa84-0x0;var _0x18523b=_0xc00b[_0x1baa84];return _0x18523b;};'use strict';var util=require(_0xbc00('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0xbc00('0x1'));var ipAgi=process['env'][_0xbc00('0x2')]||_0xbc00('0x3');function getSeconds(_0x38080a,_0x161d6a){var _0x5db11b=moment(_0x38080a)[_0xbc00('0x4')](0x0);var _0x5b47bf=moment(_0x161d6a)[_0xbc00('0x4')](0x0);return _0x5db11b['diff'](_0x5b47bf,_0xbc00('0x5'));}exports[_0xbc00('0x6')]=function(_0x284270){return function(_0x221909){logger[_0xbc00('0x7')](_0x284270,util[_0xbc00('0x8')](_0x221909,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1a53a7,_0x57192a){logger[_0xbc00('0x9')](_0x1a53a7,util[_0xbc00('0x8')](_0x57192a,{'showHidden':![],'depth':null}));};exports[_0xbc00('0xa')]=function(_0x52706d,_0x45a418){logger['error'](_0x52706d,util[_0xbc00('0x8')](_0x45a418,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x466d56){return function(_0x248684){logger[_0xbc00('0x9')](_0x466d56,util['inspect'](_0x248684,{'showHidden':![],'depth':null}));};};exports[_0xbc00('0xb')]=function(_0x20f2c3,_0x7fb50c,_0x55f770){return{'message':_0x20f2c3,'unlock':_0x7fb50c,'active':_0x55f770};};exports[_0xbc00('0xc')]=function(_0xd05e85,_0x573cf4,_0x33ce58){if(!_[_0xbc00('0xd')](_0x33ce58)&&_0xbc00('0xe')===typeof _0x33ce58&&!_[_0xbc00('0xf')](_0x33ce58)){if(!_[_0xbc00('0xd')](_0x573cf4)&&_0xbc00('0xe')===typeof _0x573cf4&&!_[_0xbc00('0xf')](_0x573cf4)){return util['format']('\x22%s\x22\x20<%s>',_0x573cf4,_0x33ce58);}return util['format'](_0xbc00('0x10'),_0x33ce58,_0x33ce58);}if(!_['isUndefined'](_0xd05e85)&&_0xbc00('0xe')===typeof _0xd05e85&&!_['isEmpty'](_0xd05e85)){return _0xd05e85;}return _0xbc00('0x11');};exports[_0xbc00('0x12')]=function(_0x492c4f){if(_[_0xbc00('0x13')](_0x492c4f)){return![];}return _0x492c4f;};exports['addVariables']=function(_0x44590e,_0x2189b6,_0x48b39b,_0x340f91,_0x225ee6,_0x33780b){var _0x13abd5={'XMD-QUEUE':_0x2189b6[_0xbc00('0x14')]?_0x2189b6[_0xbc00('0x14')]['name']:'','XMD-CALLERID':_0x340f91,'XMD-CALLERID-PREVIEW':_0x33780b?util['format'](_0xbc00('0x10'),_0x33780b[_0xbc00('0x15')],_0x33780b[_0xbc00('0x16')]):_0x340f91,'XMD-DIALID':_0x225ee6,'XMD-CONTACTID':_0x2189b6['ContactId'],'XMD-CDRTYPE':_0xbc00('0x17'),'CALLERID(all)':_0x340f91,'XMD-VOICEQUEUEID':_0x2189b6[_0xbc00('0x18')],'XMD-DIALCHANNEL':_0x48b39b,'XMD-DIALTIMEOUT':_0x44590e['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xbc00('0x19'),_0x44590e[_0xbc00('0x1a')]?'g':'',_[_0xbc00('0xf')](_0x44590e['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x44590e[_0xbc00('0x1b')]||'','XMD-AGI':_0x44590e['dialQueueProject']?util[_0xbc00('0x1c')](_0xbc00('0x1d'),ipAgi,_0x44590e['dialQueueProject']):_0xbc00('0x1e'),'XMD-AGIAFTER':_0x44590e[_0xbc00('0x1a')]?util[_0xbc00('0x1c')](_0xbc00('0x1d'),ipAgi,_0x44590e['dialQueueProject2']):_0xbc00('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x33780b?_0x33780b[_0xbc00('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x33780b?_0x33780b[_0xbc00('0x20')]:'','XMD-DESTINATION':_0xbc00('0x21')};if(!_[_0xbc00('0xf')](_0x44590e[_0xbc00('0x22')])){_0x13abd5[util[_0xbc00('0x1c')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x44590e[_0xbc00('0x22')];_0x13abd5[util[_0xbc00('0x1c')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x225ee6;}if(_0x2189b6&&_0x2189b6[_0xbc00('0x23')]){for(var _0x2d4fad in _0x2189b6[_0xbc00('0x23')]){if(_0x2189b6[_0xbc00('0x23')][_0xbc00('0x24')](_0x2d4fad)){if(!_[_0xbc00('0x13')](_0x2189b6[_0xbc00('0x23')][_0x2d4fad])&&_0x2d4fad!=='id'&&_0x2d4fad!==_0xbc00('0x25')&&_0x2d4fad!==_0xbc00('0x26')&&_0x2d4fad!==_0xbc00('0x27')){_0x13abd5[util['format'](_0xbc00('0x28'),_0xbc00('0x29'),_[_0xbc00('0x2a')](_0x2d4fad))]=_0x2189b6[_0xbc00('0x23')][_0x2d4fad];}}}}return _0x13abd5;};exports['toLowerVariables']=function(_0xf61553){var _0x58d431={};for(var _0x10c1b8 in _0xf61553){if(_0xf61553[_0xbc00('0x24')](_0x10c1b8)){_0x58d431[util[_0xbc00('0x1c')]('%s',_['toLower'](_0x10c1b8))]=_0xf61553[_0x10c1b8];}}return{'variables':_0x58d431};};exports[_0xbc00('0x2b')]=function(_0x213b2e,_0x173d14){if(!_['isNil'](_0x213b2e)){if(_0x213b2e[_0xbc00('0x24')](_0xbc00('0x2c'))){if(_0x213b2e[_0xbc00('0x2c')]>0x0){_0x213b2e[_0xbc00('0x2c')]-=0x1;}else{logger[_0xbc00('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x173d14);}}}else{logger[_0xbc00('0x7')](_0xbc00('0x2d'),_0x173d14);}};exports[_0xbc00('0x2e')]=function(_0x20fca0){var _0x468625=moment()[_0xbc00('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');_0x20fca0['state']=0xd;_0x20fca0[_0xbc00('0x2f')]=_0xbc00('0x30');_0x20fca0[_0xbc00('0x31')]=_0x468625;_0x20fca0[_0xbc00('0x32')]=_0x468625;_0x20fca0[_0xbc00('0x33')]=_0x468625;};exports['logAgent']=function(_0x570060,_0x442562,_0x1856e7){var _0x24b091=moment()['format'](_0xbc00('0x34'));_0x570060[_0xbc00('0x35')]=_0x442562;_0x570060[_0xbc00('0x2f')]=_0x1856e7;_0x570060[_0xbc00('0x32')]=_0x24b091;_0x570060['ringtime']=getSeconds(_0x570060[_0xbc00('0x32')],_0x570060['starttime']);};exports[_0xbc00('0x36')]=function(_0xf0964f,_0x5ead44,_0x49d090){_0xf0964f[_0xbc00('0x37')]=_0x5ead44;_0xf0964f[_0xbc00('0x38')]=_0x49d090;};exports[_0xbc00('0x39')]=function(_0x7d36a2,_0x1ac48f,_0x30bb86){var _0x18dea0=moment()[_0xbc00('0x1c')](_0xbc00('0x34'));_0x7d36a2['state']=_0x1ac48f;_0x7d36a2[_0xbc00('0x2f')]=_0x30bb86;_0x7d36a2['responsetime']=_0x7d36a2[_0xbc00('0x32')]?_0x7d36a2[_0xbc00('0x32')]:_0x18dea0;_0x7d36a2['endtime']=_0x7d36a2[_0xbc00('0x33')]?_0x7d36a2['endtime']:_0x18dea0;_0x7d36a2[_0xbc00('0x3a')]=getSeconds(_0x7d36a2[_0xbc00('0x32')]||0x0,_0x7d36a2[_0xbc00('0x31')]||0x0);_0x7d36a2['talktime']=_0x7d36a2[_0xbc00('0x3b')]?getSeconds(_0x7d36a2['endtime'],_0x7d36a2[_0xbc00('0x3b')]):0x0;};exports[_0xbc00('0x3c')]=function(_0x3d0eb3){return _0x3d0eb3===_0xbc00('0x3d');};exports[_0xbc00('0x3e')]=function(_0x5353e4,_0x5e9861,_0x536944,_0x5621b1,_0x3516a7){var _0xebe335=_0x5621b1?'RECALL':_0x5353e4[_0xbc00('0x15')];_0xebe335=_0x3516a7?_0xbc00('0x3f'):_0xebe335;return{'actionid':_0x5353e4[_0xbc00('0x40')],'action':'originate','channel':_0x5353e4[_0xbc00('0x41')],'callerid':util[_0xbc00('0x1c')]('\x22%s\x22\x20<%s>',_0xebe335,_0x5353e4['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xbc00('0x42'),'Priority':'1','variable':_0x536944,'timeout':(_0x5e9861[_0xbc00('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5353e4[_0xbc00('0x40')]};};exports[_0xbc00('0x44')]=function(_0xc3bf7e){return _0xc3bf7e[_0xbc00('0x45')]+_0xc3bf7e[_0xbc00('0x46')]+_0xc3bf7e['countnoanswerretry']+_0xc3bf7e['countagentrejectretry']+_0xc3bf7e[_0xbc00('0x47')];};exports['cloneAction']=function(_0x43a386){var _0x5bd628=_[_0xbc00('0x48')](_0x43a386);_0x5bd628[_0xbc00('0x35')]=0xf;_0x5bd628['statedesc']=_0xbc00('0x49');return _0x5bd628;};exports[_0xbc00('0x4a')]=function(_0x5ec178,_0x3fa95f,_0x59f6a9){var _0x1a6642={};_0x1a6642[_0x3fa95f]=_0x5ec178[_0x3fa95f];_0x1a6642[_0xbc00('0x4b')]=![];_0x1a6642['scheduledat']=moment()[_0xbc00('0x4c')](_0x59f6a9,_0xbc00('0x4d'))['format'](_0xbc00('0x34'));_0x1a6642[_0xbc00('0x4e')]=_0x5ec178[_0xbc00('0x4e')];_0x1a6642[_0xbc00('0x4f')]=_0x5ec178[_0xbc00('0x4f')];_0x1a6642[_0xbc00('0x18')]=_0x5ec178[_0xbc00('0x18')]||undefined;return _0x1a6642;};exports[_0xbc00('0x50')]=function(_0x2ad010,_0x1377c0){if(!_[_0xbc00('0x13')](_0x2ad010)){if(_0x2ad010['pTalking']>0x0){_0x2ad010[_0xbc00('0x51')]-=0x1;}else{logger[_0xbc00('0x7')](_0x1377c0,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xbc00('0x7')](_0x1377c0,_0xbc00('0x52'));}};exports[_0xbc00('0x53')]=function(_0xa25584){if(_0xa25584<=0x0){return!![];}return![];};exports[_0xbc00('0x54')]=function(_0x175ea5,_0x38c9ee){_0x175ea5[_0xbc00('0x55')]=_0x38c9ee;_0x175ea5[_0xbc00('0x56')]=_0x175ea5[_0xbc00('0x57')];_0x175ea5[_0xbc00('0x58')]=_0x175ea5[_0xbc00('0x41')];return _0x175ea5;};exports[_0xbc00('0x59')]=function(_0x6aeba8){var _0x4da05c={};_0x4da05c[_0xbc00('0x57')]=_0x6aeba8[_0xbc00('0x57')];_0x4da05c[_0xbc00('0x58')]=_0x6aeba8['channelAgent'];_0x4da05c[_0xbc00('0x40')]=_0x6aeba8[_0xbc00('0x40')];return _0x4da05c;};exports[_0xbc00('0x5a')]=function(_0x2fc4f1){var _0x3292c0=[];for(var _0x2574ca in _0x2fc4f1){if(_0x2fc4f1[_0xbc00('0x24')](_0x2574ca)){if(!_[_0xbc00('0x13')](_0x2fc4f1[_0x2574ca])&&_0x2fc4f1[_0x2574ca][_0xbc00('0x35')]===_0xbc00('0x5b')&&_0x2fc4f1[_0x2574ca][_0xbc00('0x5c')]===_0xbc00('0x5d')){_0x3292c0['push'](_0x2fc4f1[_0x2574ca]['id']);}}}return _0x3292c0;};exports[_0xbc00('0x5e')]=function(_0x4eb0de){var _0xd764e5=moment()['milliseconds'](0x0);var _0x4040d0=moment(_0x4eb0de)['milliseconds'](0x0);return _0xd764e5['diff'](_0x4040d0,_0xbc00('0x5'));};exports[_0xbc00('0x5f')]=function(_0x13c338){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x13c338[_0xbc00('0x4e')],'ListId':_0x13c338['ListId'],'VoiceQueueId':_0x13c338[_0xbc00('0x18')]||undefined,'CampaignId':_0x13c338[_0xbc00('0x60')]||undefined};};exports[_0xbc00('0x61')]=function(_0x5c0a39){if(_0x5c0a39===_0xbc00('0x40')||_0x5c0a39===_0xbc00('0x62')||_0x5c0a39===_0xbc00('0x57')||_0x5c0a39===_0xbc00('0x63')||_0x5c0a39==='campaigntype'||_0x5c0a39===_0xbc00('0x64')||_0x5c0a39===_0xbc00('0x37')||_0x5c0a39===_0xbc00('0x41')||_0x5c0a39==='calleridname'||_0x5c0a39===_0xbc00('0x4b')||_0x5c0a39===_0xbc00('0x16')||_0x5c0a39===_0xbc00('0x65')||_0x5c0a39==='countbusyretry'||_0x5c0a39==='countcongestionretry'||_0x5c0a39===_0xbc00('0x66')||_0x5c0a39===_0xbc00('0x67')||_0x5c0a39===_0xbc00('0x68')||_0x5c0a39==='callbackuniqueid'||_0x5c0a39===_0xbc00('0x69')||_0x5c0a39===_0xbc00('0x6a')||_0x5c0a39===_0xbc00('0x4e')||_0x5c0a39===_0xbc00('0x4f')||_0x5c0a39===_0xbc00('0x38')||_0x5c0a39===_0xbc00('0x18')||_0x5c0a39==='sipcallid'||_0x5c0a39==='xmd-voicequeueid'||_0x5c0a39===_0xbc00('0x6b')||_0x5c0a39===_0xbc00('0x6c')||_0x5c0a39===_0xbc00('0x6d')||_0x5c0a39===_0xbc00('0x6e')||_0x5c0a39==='xmd-dialtimeout'||_0x5c0a39==='xmd-dialoptions'||_0x5c0a39===_0xbc00('0x6f')||_0x5c0a39===_0xbc00('0x70')||_0x5c0a39===_0xbc00('0x71')||_0x5c0a39===_0xbc00('0x72')||_0x5c0a39==='xmd-callerid'||_0x5c0a39===_0xbc00('0x73')||_0x5c0a39===_0xbc00('0x74')||_0x5c0a39===_0xbc00('0x75')||_0x5c0a39===_0xbc00('0x76')||_0x5c0a39===_0xbc00('0x77')||_0x5c0a39===_0xbc00('0x78')||_0x5c0a39===_0xbc00('0x79')||_0x5c0a39===_0xbc00('0x7a')||_0x5c0a39===_0xbc00('0x7b')||_0x5c0a39==='rtpaudioqosrttbridged'||_0x5c0a39===_0xbc00('0x75')||_0x5c0a39===_0xbc00('0x76')||_0x5c0a39===_0xbc00('0x77')||_0x5c0a39==='rtpaudioqosjitterbridged'||_0x5c0a39===_0xbc00('0x79')||_0x5c0a39===_0xbc00('0x7a')||_0x5c0a39===_0xbc00('0x7b')||_0x5c0a39===_0xbc00('0x7c')||_0x5c0a39===_0xbc00('0x7d')||_0x5c0a39==='bridgepvtcallid'||_0x5c0a39==='state'||_0x5c0a39===_0xbc00('0x2f')){return![];}return!![];};exports[_0xbc00('0x7e')]=function(_0x20375a,_0x55f2ac){var _0x2efabc,_0x1c0535,_0x549926;if(_0x55f2ac<=0x0){_0x55f2ac=0x1;}_0x2efabc=new RegExp(_0xbc00('0x7f')+_0x55f2ac+'}$');_0x1c0535=Math[_0xbc00('0x80')](0xa,_0x55f2ac-0x1);_0x549926=Math[_0xbc00('0x80')](0xa,_0x55f2ac)-0x1;return util['format']('%s',_['replace'](_0x20375a,_0x2efabc,_[_0xbc00('0x81')](_0x1c0535,_0x549926)));};exports[_0xbc00('0x82')]=function(_0x1c25b6){var _0x30d70d=_0x1c25b6[_0xbc00('0x83')](/"(.*?)"/);return _0x30d70d?_0x30d70d[0x1]:_0x1c25b6;};exports['extractCalleridNumber']=function(_0x540e58){var _0x4288d9=_0x540e58[_0xbc00('0x83')](/<(.*?)>/);return _0x4288d9?_0x4288d9[0x1]:_0x540e58;}; \ No newline at end of file +var _0x9c1d=['diff','seconds','loggerCatch','inspect','logger','info','loggerError','error','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','isNil','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','name','queue','buildAcw','interface','not_inuse','status','reachable','push','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','env','127.0.0.1','milliseconds'];(function(_0x3dd388,_0x19d76b){var _0x2db118=function(_0x59afa6){while(--_0x59afa6){_0x3dd388['push'](_0x3dd388['shift']());}};_0x2db118(++_0x19d76b);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x52d47d,_0x1310e5){_0x52d47d=_0x52d47d-0x0;var _0x2add6b=_0x9c1d[_0x52d47d];return _0x2add6b;};'use strict';var util=require(_0xd9c1('0x0'));var _=require(_0xd9c1('0x1'));var moment=require(_0xd9c1('0x2'));var logger=require('../../../../config/logger')(_0xd9c1('0x3'));var ipAgi=process[_0xd9c1('0x4')]['XCALLY_IP_AGI']||_0xd9c1('0x5');function getSeconds(_0x89163b,_0x4fb977){var _0x233f23=moment(_0x89163b)[_0xd9c1('0x6')](0x0);var _0x206639=moment(_0x4fb977)[_0xd9c1('0x6')](0x0);return _0x233f23[_0xd9c1('0x7')](_0x206639,_0xd9c1('0x8'));}exports[_0xd9c1('0x9')]=function(_0x56e650){return function(_0x3aae47){logger['error'](_0x56e650,util[_0xd9c1('0xa')](_0x3aae47,{'showHidden':![],'depth':null}));};};exports[_0xd9c1('0xb')]=function(_0x1b0050,_0x19bc13){logger[_0xd9c1('0xc')](_0x1b0050,util[_0xd9c1('0xa')](_0x19bc13,{'showHidden':![],'depth':null}));};exports[_0xd9c1('0xd')]=function(_0x51c217,_0x1c5ade){logger[_0xd9c1('0xe')](_0x51c217,util[_0xd9c1('0xa')](_0x1c5ade,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x1ead8c){return function(_0x50b02c){logger[_0xd9c1('0xc')](_0x1ead8c,util[_0xd9c1('0xa')](_0x50b02c,{'showHidden':![],'depth':null}));};};exports[_0xd9c1('0xf')]=function(_0x3eb09d,_0xb9cb5d,_0x221a24){return{'message':_0x3eb09d,'unlock':_0xb9cb5d,'active':_0x221a24};};exports[_0xd9c1('0x10')]=function(_0x13b927,_0xf95f06,_0x259305){if(!_[_0xd9c1('0x11')](_0x259305)&&_0xd9c1('0x12')===typeof _0x259305&&!_[_0xd9c1('0x13')](_0x259305)){if(!_[_0xd9c1('0x11')](_0xf95f06)&&_0xd9c1('0x12')===typeof _0xf95f06&&!_['isEmpty'](_0xf95f06)){return util['format'](_0xd9c1('0x14'),_0xf95f06,_0x259305);}return util[_0xd9c1('0x15')](_0xd9c1('0x14'),_0x259305,_0x259305);}if(!_[_0xd9c1('0x11')](_0x13b927)&&_0xd9c1('0x12')===typeof _0x13b927&&!_[_0xd9c1('0x13')](_0x13b927)){return _0x13b927;}return _0xd9c1('0x16');};exports[_0xd9c1('0x17')]=function(_0x3a8830){if(_['isNil'](_0x3a8830)){return![];}return _0x3a8830;};exports[_0xd9c1('0x18')]=function(_0x11611d,_0x37701d,_0x2aea78,_0x4643ad,_0x36728a,_0x509502){var _0x28f523={'XMD-QUEUE':_0x37701d[_0xd9c1('0x19')]?_0x37701d[_0xd9c1('0x19')]['name']:'','XMD-CALLERID':_0x4643ad,'XMD-CALLERID-PREVIEW':_0x509502?util['format'](_0xd9c1('0x14'),_0x509502[_0xd9c1('0x1a')],_0x509502[_0xd9c1('0x1b')]):_0x4643ad,'XMD-DIALID':_0x36728a,'XMD-CONTACTID':_0x37701d[_0xd9c1('0x1c')],'XMD-CDRTYPE':_0xd9c1('0x1d'),'CALLERID(all)':_0x4643ad,'XMD-VOICEQUEUEID':_0x37701d[_0xd9c1('0x1e')],'XMD-DIALCHANNEL':_0x2aea78,'XMD-DIALTIMEOUT':_0x11611d[_0xd9c1('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xd9c1('0x20'),_0x11611d[_0xd9c1('0x21')]?'g':'',_['isEmpty'](_0x11611d['monitor_format'])?'':_0xd9c1('0x22')),'XMD-DIALURL':_0x11611d[_0xd9c1('0x23')]||'','XMD-AGI':_0x11611d[_0xd9c1('0x24')]?util['format'](_0xd9c1('0x25'),ipAgi,_0x11611d[_0xd9c1('0x24')]):'NONE','XMD-AGIAFTER':_0x11611d['dialQueueProject2']?util[_0xd9c1('0x15')](_0xd9c1('0x25'),ipAgi,_0x11611d[_0xd9c1('0x21')]):_0xd9c1('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x509502?_0x509502[_0xd9c1('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x509502?_0x509502[_0xd9c1('0x28')]:'','XMD-DESTINATION':_0xd9c1('0x29')};if(!_['isEmpty'](_0x11611d[_0xd9c1('0x2a')])){_0x28f523[util[_0xd9c1('0x15')]('%s',_0xd9c1('0x2b'))]=_0x11611d[_0xd9c1('0x2a')];_0x28f523[util[_0xd9c1('0x15')]('%s',_0xd9c1('0x2c'))]=_0x36728a;}if(_0x37701d&&_0x37701d[_0xd9c1('0x2d')]){for(var _0x313f05 in _0x37701d['Contact']){if(_0x37701d['Contact']['hasOwnProperty'](_0x313f05)){if(!_[_0xd9c1('0x2e')](_0x37701d['Contact'][_0x313f05])&&_0x313f05!=='id'&&_0x313f05!==_0xd9c1('0x2f')&&_0x313f05!==_0xd9c1('0x30')&&_0x313f05!=='updatedAt'){_0x28f523[util[_0xd9c1('0x15')](_0xd9c1('0x31'),_0xd9c1('0x32'),_[_0xd9c1('0x33')](_0x313f05))]=_0x37701d[_0xd9c1('0x2d')][_0x313f05];}}}}return _0x28f523;};exports[_0xd9c1('0x34')]=function(_0xa0f03e){var _0x25e0e7={};for(var _0x2c5974 in _0xa0f03e){if(_0xa0f03e[_0xd9c1('0x35')](_0x2c5974)){_0x25e0e7[util[_0xd9c1('0x15')]('%s',_[_0xd9c1('0x36')](_0x2c5974))]=_0xa0f03e[_0x2c5974];}}return{'variables':_0x25e0e7};};exports['updateOriginated']=function(_0x580dc0,_0x10c6d3){if(!_[_0xd9c1('0x2e')](_0x580dc0)){if(_0x580dc0[_0xd9c1('0x35')]('originated')){if(_0x580dc0[_0xd9c1('0x37')]>0x0){_0x580dc0[_0xd9c1('0x37')]-=0x1;}else{logger['error'](_0xd9c1('0x38'),_0x10c6d3);}}}else{logger[_0xd9c1('0xe')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x10c6d3);}};exports['logBlacklist']=function(_0x339084){var _0xbdfa7=moment()[_0xd9c1('0x15')](_0xd9c1('0x39'));_0x339084[_0xd9c1('0x3a')]=0xd;_0x339084[_0xd9c1('0x3b')]='Blacklist';_0x339084[_0xd9c1('0x3c')]=_0xbdfa7;_0x339084[_0xd9c1('0x3d')]=_0xbdfa7;_0x339084[_0xd9c1('0x3e')]=_0xbdfa7;};exports['logAgent']=function(_0xe0d4a5,_0x13b41f,_0x1e765e){var _0xb70af2=moment()[_0xd9c1('0x15')](_0xd9c1('0x39'));_0xe0d4a5[_0xd9c1('0x3a')]=_0x13b41f;_0xe0d4a5[_0xd9c1('0x3b')]=_0x1e765e;_0xe0d4a5[_0xd9c1('0x3d')]=_0xb70af2;_0xe0d4a5[_0xd9c1('0x3f')]=getSeconds(_0xe0d4a5['responsetime'],_0xe0d4a5[_0xd9c1('0x3c')]);};exports[_0xd9c1('0x40')]=function(_0x5ddcb6,_0x4e8ce6,_0x54d5b0){_0x5ddcb6[_0xd9c1('0x41')]=_0x4e8ce6;_0x5ddcb6[_0xd9c1('0x42')]=_0x54d5b0;};exports[_0xd9c1('0x43')]=function(_0x20ce58,_0x518cfa,_0x14d6dd){var _0x418a64=moment()[_0xd9c1('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x20ce58['state']=_0x518cfa;_0x20ce58[_0xd9c1('0x3b')]=_0x14d6dd;_0x20ce58[_0xd9c1('0x3d')]=_0x20ce58[_0xd9c1('0x3d')]?_0x20ce58[_0xd9c1('0x3d')]:_0x418a64;_0x20ce58[_0xd9c1('0x3e')]=_0x20ce58[_0xd9c1('0x3e')]?_0x20ce58[_0xd9c1('0x3e')]:_0x418a64;_0x20ce58[_0xd9c1('0x3f')]=getSeconds(_0x20ce58[_0xd9c1('0x3d')]||0x0,_0x20ce58['starttime']||0x0);_0x20ce58[_0xd9c1('0x44')]=_0x20ce58[_0xd9c1('0x45')]?getSeconds(_0x20ce58[_0xd9c1('0x3e')],_0x20ce58['answertime']):0x0;};exports['isFailure']=function(_0x1a830d){return _0x1a830d==='Failure';};exports[_0xd9c1('0x46')]=function(_0x4b86ad,_0x5a933f,_0x29551b,_0x4fb98a,_0x3fd92a){var _0x43c85c=_0x4fb98a?_0xd9c1('0x47'):_0x4b86ad[_0xd9c1('0x1a')];_0x43c85c=_0x3fd92a?_0xd9c1('0x48'):_0x43c85c;return{'actionid':_0x4b86ad[_0xd9c1('0x49')],'action':_0xd9c1('0x4a'),'channel':_0x4b86ad[_0xd9c1('0x4b')],'callerid':util[_0xd9c1('0x15')](_0xd9c1('0x14'),_0x43c85c,_0x4b86ad[_0xd9c1('0x1b')]),'Exten':_0xd9c1('0x29'),'Context':_0xd9c1('0x4c'),'Priority':'1','variable':_0x29551b,'timeout':(_0x5a933f[_0xd9c1('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4b86ad['uniqueid']};};exports[_0xd9c1('0x4e')]=function(_0x4966fc){return _0x4966fc['countbusyretry']+_0x4966fc[_0xd9c1('0x4f')]+_0x4966fc[_0xd9c1('0x50')]+_0x4966fc[_0xd9c1('0x51')]+_0x4966fc[_0xd9c1('0x52')];};exports[_0xd9c1('0x53')]=function(_0x46cb82){var _0xdc46d7=_[_0xd9c1('0x54')](_0x46cb82);_0xdc46d7[_0xd9c1('0x3a')]=0xf;_0xdc46d7[_0xd9c1('0x3b')]='Global';return _0xdc46d7;};exports[_0xd9c1('0x55')]=function(_0x5834e5,_0x4ae001,_0xb8bf25){var _0x2f89a1={};_0x2f89a1[_0x4ae001]=_0x5834e5[_0x4ae001];_0x2f89a1[_0xd9c1('0x56')]=![];_0x2f89a1[_0xd9c1('0x57')]=moment()[_0xd9c1('0x58')](_0xb8bf25,'minutes')[_0xd9c1('0x15')](_0xd9c1('0x39'));_0x2f89a1['ContactId']=_0x5834e5[_0xd9c1('0x1c')];_0x2f89a1[_0xd9c1('0x59')]=_0x5834e5[_0xd9c1('0x59')];_0x2f89a1[_0xd9c1('0x1e')]=_0x5834e5[_0xd9c1('0x1e')]||undefined;return _0x2f89a1;};exports['decrementTalkink']=function(_0x15a566,_0x30b3a0){if(!_[_0xd9c1('0x2e')](_0x15a566)){if(_0x15a566[_0xd9c1('0x5a')]>0x0){_0x15a566['pTalking']-=0x1;}else{logger[_0xd9c1('0xe')](_0x30b3a0,_0xd9c1('0x5b'));}}else{logger[_0xd9c1('0xe')](_0x30b3a0,_0xd9c1('0x5c'));}};exports[_0xd9c1('0x5d')]=function(_0x2b5be7){if(_0x2b5be7<=0x0){return!![];}return![];};exports[_0xd9c1('0x5e')]=function(_0x765e00,_0x12fdab){_0x765e00['lastevent']=_0x12fdab;_0x765e00[_0xd9c1('0x5f')]=_0x765e00[_0xd9c1('0x60')];_0x765e00['interface']=_0x765e00[_0xd9c1('0x4b')];return _0x765e00;};exports[_0xd9c1('0x61')]=function(_0x4038f9){var _0x168e70={};_0x168e70[_0xd9c1('0x60')]=_0x4038f9[_0xd9c1('0x60')];_0x168e70[_0xd9c1('0x62')]=_0x4038f9[_0xd9c1('0x4b')];_0x168e70[_0xd9c1('0x49')]=_0x4038f9[_0xd9c1('0x49')];return _0x168e70;};exports['agentReadyId']=function(_0x10f67b){var _0x3429c5=[];for(var _0xc06968 in _0x10f67b){if(_0x10f67b[_0xd9c1('0x35')](_0xc06968)){if(!_[_0xd9c1('0x2e')](_0x10f67b[_0xc06968])&&_0x10f67b[_0xc06968][_0xd9c1('0x3a')]===_0xd9c1('0x63')&&_0x10f67b[_0xc06968][_0xd9c1('0x64')]===_0xd9c1('0x65')){_0x3429c5[_0xd9c1('0x66')](_0x10f67b[_0xc06968]['id']);}}}return _0x3429c5;};exports['getDiff']=function(_0x38af4e){var _0x4de746=moment()[_0xd9c1('0x6')](0x0);var _0x37475b=moment(_0x38af4e)[_0xd9c1('0x6')](0x0);return _0x4de746[_0xd9c1('0x7')](_0x37475b,'seconds');};exports[_0xd9c1('0x67')]=function(_0x148c50){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x148c50[_0xd9c1('0x1c')],'ListId':_0x148c50['ListId'],'VoiceQueueId':_0x148c50[_0xd9c1('0x1e')]||undefined,'CampaignId':_0x148c50[_0xd9c1('0x68')]||undefined};};exports['filterKey']=function(_0x22ef09){if(_0x22ef09===_0xd9c1('0x49')||_0x22ef09===_0xd9c1('0x69')||_0x22ef09===_0xd9c1('0x60')||_0x22ef09===_0xd9c1('0x6a')||_0x22ef09===_0xd9c1('0x6b')||_0x22ef09===_0xd9c1('0x6c')||_0x22ef09===_0xd9c1('0x41')||_0x22ef09==='channelAgent'||_0x22ef09==='calleridname'||_0x22ef09==='active'||_0x22ef09===_0xd9c1('0x1b')||_0x22ef09===_0xd9c1('0x57')||_0x22ef09===_0xd9c1('0x6d')||_0x22ef09===_0xd9c1('0x4f')||_0x22ef09==='countnoanswerretry'||_0x22ef09===_0xd9c1('0x6e')||_0x22ef09===_0xd9c1('0x6f')||_0x22ef09===_0xd9c1('0x70')||_0x22ef09===_0xd9c1('0x71')||_0x22ef09===_0xd9c1('0x72')||_0x22ef09==='ContactId'||_0x22ef09===_0xd9c1('0x59')||_0x22ef09==='UserId'||_0x22ef09===_0xd9c1('0x1e')||_0x22ef09===_0xd9c1('0x73')||_0x22ef09===_0xd9c1('0x74')||_0x22ef09==='xmd-queue'||_0x22ef09===_0xd9c1('0x75')||_0x22ef09===_0xd9c1('0x76')||_0x22ef09===_0xd9c1('0x77')||_0x22ef09===_0xd9c1('0x78')||_0x22ef09===_0xd9c1('0x79')||_0x22ef09===_0xd9c1('0x7a')||_0x22ef09===_0xd9c1('0x7b')||_0x22ef09===_0xd9c1('0x7c')||_0x22ef09==='xmd-cdrtype'||_0x22ef09===_0xd9c1('0x7d')||_0x22ef09==='xmd-agiafter'||_0x22ef09===_0xd9c1('0x7e')||_0x22ef09===_0xd9c1('0x7f')||_0x22ef09===_0xd9c1('0x80')||_0x22ef09===_0xd9c1('0x81')||_0x22ef09===_0xd9c1('0x82')||_0x22ef09===_0xd9c1('0x83')||_0x22ef09===_0xd9c1('0x84')||_0x22ef09===_0xd9c1('0x85')||_0x22ef09===_0xd9c1('0x86')||_0x22ef09===_0xd9c1('0x7f')||_0x22ef09===_0xd9c1('0x80')||_0x22ef09==='rtpaudioqosjitter'||_0x22ef09===_0xd9c1('0x82')||_0x22ef09==='rtpaudioqosloss'||_0x22ef09===_0xd9c1('0x84')||_0x22ef09==='rtpaudioqosrtt'||_0x22ef09===_0xd9c1('0x86')||_0x22ef09==='bridgepeer'||_0x22ef09===_0xd9c1('0x87')||_0x22ef09===_0xd9c1('0x3a')||_0x22ef09===_0xd9c1('0x3b')){return![];}return!![];};exports[_0xd9c1('0x88')]=function(_0x10e68c,_0x10b0ba){var _0xc91efc,_0x234484,_0x227d74;if(_0x10b0ba<=0x0){_0x10b0ba=0x1;}_0xc91efc=new RegExp(_0xd9c1('0x89')+_0x10b0ba+'}$');_0x234484=Math[_0xd9c1('0x8a')](0xa,_0x10b0ba-0x1);_0x227d74=Math[_0xd9c1('0x8a')](0xa,_0x10b0ba)-0x1;return util[_0xd9c1('0x15')]('%s',_[_0xd9c1('0x8b')](_0x10e68c,_0xc91efc,_[_0xd9c1('0x8c')](_0x234484,_0x227d74)));};exports[_0xd9c1('0x8d')]=function(_0x5e6ba1){var _0x3d80b6=_0x5e6ba1[_0xd9c1('0x8e')](/"(.*?)"/);return _0x3d80b6?_0x3d80b6[0x1]:_0x5e6ba1;};exports[_0xd9c1('0x8f')]=function(_0x2afc6c){var _0x42c14c=_0x2afc6c[_0xd9c1('0x8e')](/<(.*?)>/);return _0x42c14c?_0x42c14c[0x1]:_0x2afc6c;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index cb888ab..4420b97 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(_0x4ea1b1,_0x5f173d){var _0x1a7305=function(_0x486513){while(--_0x486513){_0x4ea1b1['push'](_0x4ea1b1['shift']());}};_0x1a7305(++_0x5f173d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e1913,_0x641418){_0x1e1913=_0x1e1913-0x0;var _0xcb59ce=_0x5f2f[_0x1e1913];return _0xcb59ce;};'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(_0x566aa7,_0x148031){var _0x55bc17=function(_0x1088e6){while(--_0x1088e6){_0x566aa7['push'](_0x566aa7['shift']());}};_0x55bc17(++_0x148031);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a7d9d,_0x52acf8){_0x4a7d9d=_0x4a7d9d-0x0;var _0x167e3f=_0x5f2f[_0x4a7d9d];return _0x167e3f;};'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 eee28f0..eaf82b8 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 _0xae2b=['format','SIP/%s','name','isNil','total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','answered','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','interface','isUndefined','initTelephones','initTrunks','voiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','diff','sumDuration','initVoiceCallReports','outbound','disposition','ANSWERED','duration','billableseconds','initCampaigns','campaigns','SquareProject','initFaxAccounts','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','templates','voiceExtensions','channels','queueChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty'];(function(_0x5a905e,_0x31aa4a){var _0x4124d6=function(_0x37c28a){while(--_0x37c28a){_0x5a905e['push'](_0x5a905e['shift']());}};_0x4124d6(++_0x31aa4a);}(_0xae2b,0xb3));var _0xbae2=function(_0x35a9d0,_0x31afde){_0x35a9d0=_0x35a9d0-0x0;var _0x440450=_0xae2b[_0x35a9d0];return _0x440450;};'use strict';var BPromise=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));var _=require('lodash');var moment=require(_0xbae2('0x2'));var Agent=require(_0xbae2('0x3'));var Telephone=require(_0xbae2('0x4'));var Trunk=require(_0xbae2('0x5'));var VoiceQueue=require(_0xbae2('0x6'));var Trigger=require(_0xbae2('0x7'));var Template=require('../model/template');var Campaign=require(_0xbae2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xbae2('0x9'));var SalesforceAccount=require(_0xbae2('0xa'));var FreshdeskAccount=require(_0xbae2('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xbae2('0xc'));var Dynamics365Account=require(_0xbae2('0xd'));var FreshsalesAccount=require(_0xbae2('0xe'));var FaxAccount=require(_0xbae2('0xf'));var Realtime=function(){this[_0xbae2('0x10')]={};this[_0xbae2('0x11')]={};this[_0xbae2('0x12')]={};this['voiceQueues']={};this['triggers']={};this['campaigns']={};this[_0xbae2('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbae2('0x14')]={};this[_0xbae2('0x15')]={};this[_0xbae2('0x16')]={};this['outboundChannels']={};this[_0xbae2('0x17')]={};this[_0xbae2('0x18')]={};this['salesforceAccounts']={};this[_0xbae2('0x19')]={};this[_0xbae2('0x1a')]={};this[_0xbae2('0x1b')]={};this[_0xbae2('0x1c')]={};this[_0xbae2('0x1d')]={};this[_0xbae2('0x1e')]={};this[_0xbae2('0x1f')]={};this['freshsalesAccounts']={};this[_0xbae2('0x20')]={};};function freeIsNotKey(_0x523e23,_0x2ad31c,_0x390e95){var _0x4fdcb3=_[_0xbae2('0x21')](_0x523e23,function(_0x45ab0f,_0x48ec0c){return _0x45ab0f[_0x390e95];});for(var _0x27e323 in _0x2ad31c){if(_0x2ad31c[_0xbae2('0x22')](_0x27e323)){if(!_0x4fdcb3[_0x27e323]){delete _0x2ad31c[_0x27e323];}}}}function freeIsNotKeySip(_0x46145a,_0x4ed862){var _0x21c9fa=_['mapKeys'](_0x46145a,function(_0x4ee2d1,_0xb9d11c){return util[_0xbae2('0x23')](_0xbae2('0x24'),_0x4ee2d1[_0xbae2('0x25')]);});for(var _0x53b581 in _0x4ed862){if(_0x4ed862[_0xbae2('0x22')](_0x53b581)){if(!_0x21c9fa[_0x53b581]){delete _0x4ed862[_0x53b581];}}}}function freeIsNotKeyAgent(_0x3f2d99,_0x4a42be){var _0x5ba648=_[_0xbae2('0x21')](_0x3f2d99,function(_0x3f1e04,_0xd01446){var _0x1b9b24=_[_0xbae2('0x26')](_0x3f1e04['interface'])?util['format'](_0xbae2('0x24'),_0x3f1e04[_0xbae2('0x25')]):_0x3f1e04['interface'];return _0x1b9b24;});for(var _0x2f1da9 in _0x4a42be){if(_0x4a42be[_0xbae2('0x22')](_0x2f1da9)){if(!_0x5ba648[_0x2f1da9]){delete _0x4a42be[_0x2f1da9];}}}}function clearVoiceCallReports(_0x4154fd){_0x4154fd[_0xbae2('0x27')]=0x0;_0x4154fd['answered']=0x0;_0x4154fd[_0xbae2('0x28')]=0x0;_0x4154fd['sumDuration']=0x0;_0x4154fd[_0xbae2('0x29')]=0x0;}function clearCampaigns(_0x90a9a8){if(!_[_0xbae2('0x2a')](_0x90a9a8)){for(var _0x352fd2 in _0x90a9a8){if(_0x90a9a8[_0xbae2('0x22')](_0x352fd2)){_0x90a9a8[_0x352fd2]['ivrTotalCallsDays']=0x0;_0x90a9a8[_0x352fd2][_0xbae2('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x2513c1){if(!_['isEmpty'](_0x2513c1)){for(var _0x1361e7 in _0x2513c1){if(_0x2513c1[_0xbae2('0x22')](_0x1361e7)){_0x2513c1[_0x1361e7][_0xbae2('0x27')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x2c')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x2d')]=0x0;_0x2513c1[_0x1361e7]['abandoned']=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x28')]=0x0;_0x2513c1[_0x1361e7]['sumDuration']=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x29')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x2e')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x2f')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x30')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x31')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x32')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x33')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x34')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x35')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x36')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x37')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x38')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x39')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x2e')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x3a')]=0x0;_0x2513c1[_0x1361e7][_0xbae2('0x3b')]=!![];}}}}Realtime['prototype'][_0xbae2('0x3c')]=function(_0x3ca0a9,_0x5dec6e){for(var _0x587d96 in _0x5dec6e){if(_0x3ca0a9[_0xbae2('0x22')](_0x587d96)){_0x3ca0a9[_0x587d96]=_0x5dec6e[_0x587d96];}}};Realtime[_0xbae2('0x3d')][_0xbae2('0x3e')]=function(){var _0xd6502f=this;return function(_0x5dc71c){if(_0x5dc71c){freeIsNotKeyAgent(_0x5dc71c,_0xd6502f[_0xbae2('0x10')]);for(var _0x225b56=0x0,_0x35c929={},_0x34492a={};_0x225b56<_0x5dc71c[_0xbae2('0x3f')];_0x225b56+=0x1){_0x35c929=_0x5dc71c[_0x225b56];var _0x144231=_[_0xbae2('0x26')](_0x35c929[_0xbae2('0x40')])?util[_0xbae2('0x23')]('SIP/%s',_0x35c929[_0xbae2('0x25')]):_0x35c929[_0xbae2('0x40')];if(_[_0xbae2('0x41')](_0xd6502f[_0xbae2('0x10')][_0x144231])){_0xd6502f['agents'][_0x144231]=new Agent(_0x35c929);}else{_0xd6502f[_0xbae2('0x3c')](_0xd6502f[_0xbae2('0x10')][_0x144231],_0x35c929);}}}return _0xd6502f[_0xbae2('0x10')];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x42')]=function(){var _0x4bbb21=this;return function(_0x21f1e1){if(_0x21f1e1){freeIsNotKeySip(_0x21f1e1,_0x4bbb21['telephones']);for(var _0x2f082d=0x0,_0x14ac8d={},_0x179856={};_0x2f082d<_0x21f1e1[_0xbae2('0x3f')];_0x2f082d+=0x1){_0x14ac8d=_0x21f1e1[_0x2f082d];if(_['isUndefined'](_0x4bbb21[_0xbae2('0x11')][util['format']('SIP/%s',_0x14ac8d['name'])])){_0x4bbb21[_0xbae2('0x11')][util[_0xbae2('0x23')](_0xbae2('0x24'),_0x14ac8d[_0xbae2('0x25')])]=new Telephone(_0x14ac8d);}else{_0x4bbb21[_0xbae2('0x3c')](_0x4bbb21['telephones'][util['format'](_0xbae2('0x24'),_0x14ac8d['name'])],_0x14ac8d);}}}return _0x4bbb21[_0xbae2('0x11')];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x43')]=function(){var _0x21175c=this;return function(_0x35be12){if(_0x35be12){freeIsNotKeySip(_0x35be12,_0x21175c[_0xbae2('0x12')]);for(var _0x680b84=0x0,_0x307457={},_0x672935={};_0x680b84<_0x35be12[_0xbae2('0x3f')];_0x680b84+=0x1){_0x307457=_0x35be12[_0x680b84];if(_[_0xbae2('0x41')](_0x21175c[_0xbae2('0x12')][util['format']('SIP/%s',_0x307457['name'])])){_0x21175c[_0xbae2('0x12')][util[_0xbae2('0x23')]('SIP/%s',_0x307457[_0xbae2('0x25')])]=new Trunk(_0x307457);}else{_0x21175c[_0xbae2('0x3c')](_0x21175c[_0xbae2('0x12')][util[_0xbae2('0x23')](_0xbae2('0x24'),_0x307457['name'])],_0x307457);}}}return _0x21175c['trunks'];};};Realtime[_0xbae2('0x3d')]['initVoiceQueues']=function(){var _0x3ba1f9=this;return function(_0x931ed7){if(_0x931ed7){freeIsNotKey(_0x931ed7,_0x3ba1f9[_0xbae2('0x44')],_0xbae2('0x25'));for(var _0x37fa18=0x0,_0x548842={},_0x5792e9={};_0x37fa18<_0x931ed7['length'];_0x37fa18+=0x1){_0x548842=_0x931ed7[_0x37fa18];if(_[_0xbae2('0x41')](_0x3ba1f9['voiceQueues'][_0x548842['name']])){_0x3ba1f9[_0xbae2('0x44')][_0x548842[_0xbae2('0x25')]]=new VoiceQueue(_0x548842);}else{_0x3ba1f9['mergeFromDatabase'](_0x3ba1f9['voiceQueues'][_0x548842['name']],_0x548842);}}}return _0x3ba1f9['voiceQueues'];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x45')]=function(){var _0x4dd072=this;return function(_0x472bf4){if(_0x472bf4){freeIsNotKey(_0x472bf4,_0x4dd072[_0xbae2('0x46')],'id');for(var _0x2a6903=0x0,_0x133285={},_0xbca7aa={};_0x2a6903<_0x472bf4[_0xbae2('0x3f')];_0x2a6903+=0x1){_0x133285=_0x472bf4[_0x2a6903];if(_[_0xbae2('0x41')](_0x4dd072[_0xbae2('0x46')][_0x133285['id']])){_0x4dd072[_0xbae2('0x46')][_0x133285['id']]=new Trigger(_0x133285);}else{_0x4dd072[_0xbae2('0x3c')](_0x4dd072[_0xbae2('0x46')][_0x133285['id']],_0x133285);}}}return _0x4dd072[_0xbae2('0x46')];};};Realtime['prototype'][_0xbae2('0x47')]=function(){var _0x5630ac=this;return function(_0x31ba99){if(_0x31ba99){freeIsNotKey(_0x31ba99,_0x5630ac['templates'],'id');for(var _0x2ad12b=0x0,_0x20fffa={},_0x4b184d={};_0x2ad12b<_0x31ba99['length'];_0x2ad12b+=0x1){_0x20fffa=_0x31ba99[_0x2ad12b];if(_[_0xbae2('0x41')](_0x5630ac[_0xbae2('0x13')][_0x20fffa['id']])){_0x5630ac[_0xbae2('0x13')][_0x20fffa['id']]=new Template(_0x20fffa);}else{_0x5630ac[_0xbae2('0x3c')](_0x5630ac[_0xbae2('0x13')][_0x20fffa['id']],_0x20fffa);}}}return _0x5630ac[_0xbae2('0x13')];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x48')]=function(){var _0x527514=this;return function(_0x3855b){if(_0x3855b){freeIsNotKey(_0x3855b,_0x527514[_0xbae2('0x18')],'id');for(var _0x485475=0x0,_0x1b14db={},_0x4779a1={};_0x485475<_0x3855b[_0xbae2('0x3f')];_0x485475+=0x1){_0x1b14db=_0x3855b[_0x485475];if(_[_0xbae2('0x41')](_0x527514[_0xbae2('0x18')][_0x1b14db['id']])){_0x527514[_0xbae2('0x18')][_0x1b14db['id']]=new ZendeskAccount(_0x1b14db);}else{_0x527514[_0xbae2('0x3c')](_0x527514['zendeskAccounts'][_0x1b14db['id']],_0x1b14db);}}}return _0x527514[_0xbae2('0x18')];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x49')]=function(){var _0x57221a=this;return function(_0x2b68e1){if(_0x2b68e1){freeIsNotKey(_0x2b68e1,_0x57221a['salesforceAccounts'],'id');for(var _0x1b107a=0x0,_0x12e2c0={},_0x117ed7={};_0x1b107a<_0x2b68e1[_0xbae2('0x3f')];_0x1b107a+=0x1){_0x12e2c0=_0x2b68e1[_0x1b107a];if(_[_0xbae2('0x41')](_0x57221a[_0xbae2('0x4a')][_0x12e2c0['id']])){_0x57221a[_0xbae2('0x4a')][_0x12e2c0['id']]=new SalesforceAccount(_0x12e2c0);}else{_0x57221a[_0xbae2('0x3c')](_0x57221a[_0xbae2('0x4a')][_0x12e2c0['id']],_0x12e2c0);}}}return _0x57221a[_0xbae2('0x4a')];};};Realtime['prototype'][_0xbae2('0x4b')]=function(){var _0x2d3635=this;return function(_0x473dd8){if(_0x473dd8){freeIsNotKey(_0x473dd8,_0x2d3635[_0xbae2('0x1a')],'id');for(var _0x349a96=0x0,_0x2472d8={},_0x135988={};_0x349a96<_0x473dd8[_0xbae2('0x3f')];_0x349a96+=0x1){_0x2472d8=_0x473dd8[_0x349a96];if(_['isUndefined'](_0x2d3635['freshdeskAccounts'][_0x2472d8['id']])){_0x2d3635[_0xbae2('0x1a')][_0x2472d8['id']]=new FreshdeskAccount(_0x2472d8);}else{_0x2d3635[_0xbae2('0x3c')](_0x2d3635[_0xbae2('0x1a')][_0x2472d8['id']],_0x2472d8);}}}return _0x2d3635['freshdeskAccounts'];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x4c')]=function(){var _0x451059=this;return function(_0x3a3058){if(_0x3a3058){freeIsNotKey(_0x3a3058,_0x451059[_0xbae2('0x1b')],'id');for(var _0x39074e=0x0,_0x39f697={},_0xe749ae={};_0x39074e<_0x3a3058['length'];_0x39074e+=0x1){_0x39f697=_0x3a3058[_0x39074e];if(_[_0xbae2('0x41')](_0x451059['zohoAccounts'][_0x39f697['id']])){_0x451059[_0xbae2('0x1b')][_0x39f697['id']]=new ZohoAccount(_0x39f697);}else{_0x451059['mergeFromDatabase'](_0x451059[_0xbae2('0x1b')][_0x39f697['id']],_0x39f697);}}}return _0x451059['zohoAccounts'];};};Realtime[_0xbae2('0x3d')]['initDeskAccounts']=function(){var _0x571be8=this;return function(_0x255504){if(_0x255504){freeIsNotKey(_0x255504,_0x571be8[_0xbae2('0x1c')],'id');for(var _0x4d6368=0x0,_0xca412d={},_0x332d68={};_0x4d6368<_0x255504[_0xbae2('0x3f')];_0x4d6368+=0x1){_0xca412d=_0x255504[_0x4d6368];if(_[_0xbae2('0x41')](_0x571be8[_0xbae2('0x1c')][_0xca412d['id']])){_0x571be8['deskAccounts'][_0xca412d['id']]=new DeskAccount(_0xca412d);}else{_0x571be8[_0xbae2('0x3c')](_0x571be8['deskAccounts'][_0xca412d['id']],_0xca412d);}}}return _0x571be8[_0xbae2('0x1c')];};};Realtime['prototype'][_0xbae2('0x4d')]=function(){var _0x412cbc=this;return function(_0x4e0625){if(_0x4e0625){freeIsNotKey(_0x4e0625,_0x412cbc['sugarcrmAccounts'],'id');for(var _0x2b238e=0x0,_0x1d8f54={},_0x33888e={};_0x2b238e<_0x4e0625[_0xbae2('0x3f')];_0x2b238e+=0x1){_0x1d8f54=_0x4e0625[_0x2b238e];if(_[_0xbae2('0x41')](_0x412cbc[_0xbae2('0x19')][_0x1d8f54['id']])){_0x412cbc['sugarcrmAccounts'][_0x1d8f54['id']]=new SugarcrmAccount(_0x1d8f54);}else{_0x412cbc[_0xbae2('0x3c')](_0x412cbc[_0xbae2('0x19')][_0x1d8f54['id']],_0x1d8f54);}}}return _0x412cbc[_0xbae2('0x19')];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x4e')]=function(){var _0x3a612e=this;return function(_0x262aef){if(_0x262aef){freeIsNotKey(_0x262aef,_0x3a612e['vtigerAccounts'],'id');for(var _0x530cab=0x0,_0x2e4ed2={},_0x828c72={};_0x530cab<_0x262aef[_0xbae2('0x3f')];_0x530cab+=0x1){_0x2e4ed2=_0x262aef[_0x530cab];if(_[_0xbae2('0x41')](_0x3a612e[_0xbae2('0x1d')][_0x2e4ed2['id']])){_0x3a612e[_0xbae2('0x1d')][_0x2e4ed2['id']]=new VtigerAccount(_0x2e4ed2);}else{_0x3a612e['mergeFromDatabase'](_0x3a612e[_0xbae2('0x1d')][_0x2e4ed2['id']],_0x2e4ed2);}}}return _0x3a612e['vtigerAccounts'];};};Realtime['prototype'][_0xbae2('0x4f')]=function(){var _0x491219=this;return function(_0x927a07){if(_0x927a07){freeIsNotKey(_0x927a07,_0x491219[_0xbae2('0x1e')],'id');for(var _0x4f8920=0x0,_0x234f5b={},_0xfb4696={};_0x4f8920<_0x927a07[_0xbae2('0x3f')];_0x4f8920+=0x1){_0x234f5b=_0x927a07[_0x4f8920];if(_['isUndefined'](_0x491219[_0xbae2('0x1e')][_0x234f5b['id']])){_0x491219[_0xbae2('0x1e')][_0x234f5b['id']]=new ServicenowAccount(_0x234f5b);}else{_0x491219[_0xbae2('0x3c')](_0x491219[_0xbae2('0x1e')][_0x234f5b['id']],_0x234f5b);}}}return _0x491219[_0xbae2('0x1e')];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x50')]=function(){var _0xf21479=this;return function(_0x369101){if(_0x369101){freeIsNotKey(_0x369101,_0xf21479[_0xbae2('0x1f')],'id');for(var _0x32e212=0x0,_0x386a99={},_0x26fb0c={};_0x32e212<_0x369101[_0xbae2('0x3f')];_0x32e212+=0x1){_0x386a99=_0x369101[_0x32e212];if(_[_0xbae2('0x41')](_0xf21479[_0xbae2('0x1f')][_0x386a99['id']])){_0xf21479['dynamics365Accounts'][_0x386a99['id']]=new Dynamics365Account(_0x386a99);}else{_0xf21479['mergeFromDatabase'](_0xf21479[_0xbae2('0x1f')][_0x386a99['id']],_0x386a99);}}}return _0xf21479['dynamics365Accounts'];};};Realtime[_0xbae2('0x3d')]['initFreshsalesAccounts']=function(){var _0x5af9c1=this;return function(_0x14405a){if(_0x14405a){freeIsNotKey(_0x14405a,_0x5af9c1[_0xbae2('0x51')],'id');for(var _0x4f7abd=0x0,_0x51e2a0={},_0x18eeb8={};_0x4f7abd<_0x14405a[_0xbae2('0x3f')];_0x4f7abd+=0x1){_0x51e2a0=_0x14405a[_0x4f7abd];if(_[_0xbae2('0x41')](_0x5af9c1[_0xbae2('0x51')][_0x51e2a0['id']])){_0x5af9c1[_0xbae2('0x51')][_0x51e2a0['id']]=new FreshsalesAccount(_0x51e2a0);}else{_0x5af9c1[_0xbae2('0x3c')](_0x5af9c1[_0xbae2('0x51')][_0x51e2a0['id']],_0x51e2a0);}}}return _0x5af9c1[_0xbae2('0x51')];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x52')]=function(){var _0x4be206=this;return function(_0x2cc88a){for(var _0x3ffdfe=0x0;_0x3ffdfe<_0x2cc88a[_0xbae2('0x3f')];_0x3ffdfe+=0x1){_[_0xbae2('0x53')](_0x4be206[_0xbae2('0x44')][_0x2cc88a[_0x3ffdfe][_0xbae2('0x25')]],_0x2cc88a[_0x3ffdfe]);}return _0x4be206[_0xbae2('0x44')];};};Realtime[_0xbae2('0x3d')]['initVoiceQueueReports']=function(){var _0x196031=this;return function(_0x1cbe50){clearVoiceQueues(_0x196031['voiceQueues']);if(_0x1cbe50){_0x1cbe50=_[_0xbae2('0x54')](_0x1cbe50,_0xbae2('0x55'));for(var _0x360b19 in _0x1cbe50){if(_0x1cbe50[_0xbae2('0x22')](_0x360b19)){var _0x5dee94={};for(var _0x131e72=0x0;_0x131e72<_0x1cbe50[_0x360b19]['length'];_0x131e72+=0x1){var _0x5fde4a=_0x1cbe50[_0x360b19][_0x131e72][_0xbae2('0x56')];if(_0x196031[_0xbae2('0x44')][_0x5fde4a]){if(_0x1cbe50[_0x360b19][_0x131e72][_0xbae2('0x57')]){_0x196031[_0xbae2('0x44')][_0x5fde4a]['unmanaged']+=0x1;}if(_0x1cbe50[_0x360b19][_0x131e72][_0xbae2('0x58')]){_0x196031[_0xbae2('0x44')][_0x5fde4a][_0xbae2('0x59')]+=0x1;}_0x196031[_0xbae2('0x44')][_0x5fde4a]['sumHoldTime']+=moment(_0x1cbe50[_0x360b19][_0x131e72][_0xbae2('0x5a')])['diff'](moment(_0x1cbe50[_0x360b19][_0x131e72]['queuecallerjoinAt']),_0xbae2('0x5b'))||0x0;if(_0x131e72===_0x1cbe50[_0x360b19][_0xbae2('0x3f')]-0x1){_0x196031[_0xbae2('0x44')][_0x5fde4a]['sumDuration']+=moment(_0x1cbe50[_0x360b19][_0x131e72][_0xbae2('0x5c')]||_0x1cbe50[_0x360b19][_0x131e72]['queuecallerabandonAt']||_0x1cbe50[_0x360b19][_0x131e72][_0xbae2('0x5d')])['diff'](moment(_0x1cbe50[_0x360b19][_0x131e72]['queuecallerjoinAt']),_0xbae2('0x5b'))||0x0;_0x196031[_0xbae2('0x44')][_0x5fde4a][_0xbae2('0x27')]+=0x1;if(_0x1cbe50[_0x360b19][_0x131e72][_0xbae2('0x5e')]){_0x196031['voiceQueues'][_0x5fde4a][_0xbae2('0x2c')]+=0x1;_0x196031['voiceQueues'][_0x5fde4a][_0xbae2('0x29')]+=moment(_0x1cbe50[_0x360b19][_0x131e72][_0xbae2('0x5c')])[_0xbae2('0x5f')](moment(_0x1cbe50[_0x360b19][_0x131e72][_0xbae2('0x5a')]),_0xbae2('0x5b'))||0x0;}}else{_0x196031[_0xbae2('0x44')][_0x5fde4a][_0xbae2('0x60')]+=_0x196031[_0xbae2('0x44')][_0x5fde4a][_0xbae2('0x28')]||0x0;}}}}}}return _0x196031[_0xbae2('0x44')];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x61')]=function(){var _0x5ebf69=this;return function(_0x1c768a){clearVoiceCallReports(_0x5ebf69[_0xbae2('0x62')]);if(_0x1c768a){for(var _0x3f9568=0x0;_0x3f9568<_0x1c768a[_0xbae2('0x3f')];_0x3f9568+=0x1){_0x5ebf69['outbound'][_0xbae2('0x27')]+=0x1;_0x5ebf69[_0xbae2('0x62')][_0xbae2('0x60')]+=_0x1c768a[_0x3f9568]['duration'];if(_0x1c768a[_0x3f9568][_0xbae2('0x63')]===_0xbae2('0x64')){_0x5ebf69[_0xbae2('0x62')][_0xbae2('0x2c')]+=0x1;_0x5ebf69[_0xbae2('0x62')][_0xbae2('0x28')]+=_0x1c768a[_0x3f9568][_0xbae2('0x65')]-_0x1c768a[_0x3f9568][_0xbae2('0x66')]||0x0;_0x5ebf69[_0xbae2('0x62')][_0xbae2('0x29')]+=_0x1c768a[_0x3f9568][_0xbae2('0x66')];}}}return _0x5ebf69[_0xbae2('0x62')];};};Realtime['prototype'][_0xbae2('0x67')]=function(){var _0x1a8e62=this;return function(_0x2abb9a){if(_0x2abb9a){freeIsNotKey(_0x2abb9a,_0x1a8e62['campaigns'],_0xbae2('0x25'));for(var _0x3f1ad2=0x0,_0x609a62={};_0x3f1ad2<_0x2abb9a[_0xbae2('0x3f')];_0x3f1ad2+=0x1){_0x609a62=_0x2abb9a[_0x3f1ad2];if(_[_0xbae2('0x41')](_0x1a8e62[_0xbae2('0x68')][_0x609a62[_0xbae2('0x25')]])){_0x1a8e62[_0xbae2('0x68')][_0x609a62[_0xbae2('0x25')]]=new Campaign(_0x609a62);}else{_0x1a8e62[_0xbae2('0x3c')](_0x1a8e62[_0xbae2('0x68')][_0x609a62[_0xbae2('0x25')]],_0x609a62);_0x1a8e62[_0xbae2('0x68')][_0x609a62[_0xbae2('0x25')]]['dialQueueProject']=_0x609a62['SquareProject']?_0x609a62[_0xbae2('0x69')][_0xbae2('0x25')]:undefined;}}}return _0x1a8e62[_0xbae2('0x68')];};};Realtime[_0xbae2('0x3d')]['initVoiceExtensions']=function(){var _0x421c57=this;return function(_0x4eb381){if(_0x4eb381){freeIsNotKey(_0x4eb381,_0x421c57[_0xbae2('0x14')],'id');for(var _0x42f471=0x0,_0x4cee8e={};_0x42f471<_0x4eb381[_0xbae2('0x3f')];_0x42f471+=0x1){_0x4cee8e=_0x4eb381[_0x42f471];if(_[_0xbae2('0x41')](_0x421c57[_0xbae2('0x14')][_0x4cee8e['id']])){_0x421c57[_0xbae2('0x14')][_0x4cee8e['id']]=new VoiceExtension(_0x4cee8e);}else{_0x421c57['mergeFromDatabase'](_0x421c57[_0xbae2('0x14')][_0x4cee8e['id']],_0x4cee8e);}}}return _0x421c57['voiceExtensions'];};};Realtime[_0xbae2('0x3d')]['initCampaignHopperHistory']=function(){var _0xfe8f0f=this;return function(_0x3707df){clearCampaigns(_0xfe8f0f[_0xbae2('0x68')]);for(var _0x32a3c3=0x0;_0x32a3c3<_0x3707df[_0xbae2('0x3f')];_0x32a3c3+=0x1){_[_0xbae2('0x53')](_0xfe8f0f[_0xbae2('0x68')][_0x3707df[_0x32a3c3][_0xbae2('0x25')]],_0x3707df[_0x32a3c3]);}return _0xfe8f0f['campaigns'];};};Realtime[_0xbae2('0x3d')][_0xbae2('0x6a')]=function(){var _0x2246f8=this;return function(_0xdd1cd7){if(_0xdd1cd7){freeIsNotKey(_0xdd1cd7,_0x2246f8[_0xbae2('0x20')],'id');for(var _0x2e8c86=0x0,_0x10571d={},_0x5cbd61={};_0x2e8c86<_0xdd1cd7['length'];_0x2e8c86+=0x1){_0x10571d=_0xdd1cd7[_0x2e8c86];if(_[_0xbae2('0x41')](_0x2246f8['faxAccounts'][_0x10571d['id']])){_0x2246f8[_0xbae2('0x20')][_0x10571d['id']]=new FaxAccount(_0x10571d);}else{_0x2246f8[_0xbae2('0x3c')](_0x2246f8['faxAccounts'][_0x10571d['id']],_0x10571d);}}}return _0x2246f8['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x9ca9=['../model/servicenowAccount','../model/freshsalesAccount','agents','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','SIP/%s','name','interface','answered','sumHoldTime','isEmpty','hasOwnProperty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','sumDuration','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','mergeFromDatabase','prototype','initAgents','length','isNil','format','initTelephones','telephones','initTrunks','isUndefined','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','sugarcrmAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercompleteAt','initVoiceCallReports','duration','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','voiceExtensions','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount'];(function(_0x55417e,_0x3ebc03){var _0x513aa7=function(_0x2ed62d){while(--_0x2ed62d){_0x55417e['push'](_0x55417e['shift']());}};_0x513aa7(++_0x3ebc03);}(_0x9ca9,0x189));var _0x99ca=function(_0x3e0dc4,_0x13971b){_0x3e0dc4=_0x3e0dc4-0x0;var _0x586111=_0x9ca9[_0x3e0dc4];return _0x586111;};'use strict';var BPromise=require(_0x99ca('0x0'));var util=require(_0x99ca('0x1'));var _=require(_0x99ca('0x2'));var moment=require(_0x99ca('0x3'));var Agent=require(_0x99ca('0x4'));var Telephone=require(_0x99ca('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x99ca('0x6'));var Trigger=require(_0x99ca('0x7'));var Template=require(_0x99ca('0x8'));var Campaign=require(_0x99ca('0x9'));var VoiceExtension=require(_0x99ca('0xa'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x99ca('0xb'));var FreshdeskAccount=require(_0x99ca('0xc'));var SugarcrmAccount=require(_0x99ca('0xd'));var ZohoAccount=require(_0x99ca('0xe'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x99ca('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x99ca('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x99ca('0x11')]={};this['telephones']={};this[_0x99ca('0x12')]={};this[_0x99ca('0x13')]={};this[_0x99ca('0x14')]={};this[_0x99ca('0x15')]={};this[_0x99ca('0x16')]={};this[_0x99ca('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x99ca('0x18')]={};this[_0x99ca('0x19')]={};this['outboundChannels']={};this[_0x99ca('0x1a')]={};this[_0x99ca('0x1b')]={};this[_0x99ca('0x1c')]={};this['sugarcrmAccounts']={};this[_0x99ca('0x1d')]={};this[_0x99ca('0x1e')]={};this[_0x99ca('0x1f')]={};this['vtigerAccounts']={};this[_0x99ca('0x20')]={};this['dynamics365Accounts']={};this[_0x99ca('0x21')]={};this[_0x99ca('0x22')]={};};function freeIsNotKey(_0xd0ca95,_0xe74b11,_0x4669ff){var _0x34de30=_[_0x99ca('0x23')](_0xd0ca95,function(_0x1d38d0,_0x4b8816){return _0x1d38d0[_0x4669ff];});for(var _0x99e77e in _0xe74b11){if(_0xe74b11['hasOwnProperty'](_0x99e77e)){if(!_0x34de30[_0x99e77e]){delete _0xe74b11[_0x99e77e];}}}}function freeIsNotKeySip(_0x2bbdb0,_0x218936){var _0x1ec638=_[_0x99ca('0x23')](_0x2bbdb0,function(_0x59bf1a,_0x5d8fdb){return util['format'](_0x99ca('0x24'),_0x59bf1a[_0x99ca('0x25')]);});for(var _0x12e4a0 in _0x218936){if(_0x218936['hasOwnProperty'](_0x12e4a0)){if(!_0x1ec638[_0x12e4a0]){delete _0x218936[_0x12e4a0];}}}}function freeIsNotKeyAgent(_0x16fee8,_0x423076){var _0x55240c=_[_0x99ca('0x23')](_0x16fee8,function(_0x5e341e,_0x1498c2){var _0x3f8d64=_['isNil'](_0x5e341e[_0x99ca('0x26')])?util['format'](_0x99ca('0x24'),_0x5e341e[_0x99ca('0x25')]):_0x5e341e[_0x99ca('0x26')];return _0x3f8d64;});for(var _0x5f215a in _0x423076){if(_0x423076['hasOwnProperty'](_0x5f215a)){if(!_0x55240c[_0x5f215a]){delete _0x423076[_0x5f215a];}}}}function clearVoiceCallReports(_0x370f17){_0x370f17['total']=0x0;_0x370f17[_0x99ca('0x27')]=0x0;_0x370f17[_0x99ca('0x28')]=0x0;_0x370f17['sumDuration']=0x0;_0x370f17['sumBillable']=0x0;}function clearCampaigns(_0x342cb5){if(!_[_0x99ca('0x29')](_0x342cb5)){for(var _0x11c6ca in _0x342cb5){if(_0x342cb5[_0x99ca('0x2a')](_0x11c6ca)){_0x342cb5[_0x11c6ca][_0x99ca('0x2b')]=0x0;_0x342cb5[_0x11c6ca][_0x99ca('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x35f572){if(!_[_0x99ca('0x29')](_0x35f572)){for(var _0x18e2f5 in _0x35f572){if(_0x35f572[_0x99ca('0x2a')](_0x18e2f5)){_0x35f572[_0x18e2f5][_0x99ca('0x2d')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x27')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x2e')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x2f')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x28')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x30')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x31')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x32')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x33')]=0x0;_0x35f572[_0x18e2f5]['outboundBusyCallsDay']=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x34')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x35')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x36')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x37')]=0x0;_0x35f572[_0x18e2f5]['outboundDropCallsDayCallersExit']=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x38')]=0x0;_0x35f572[_0x18e2f5]['outboundOriginateFailureCallsDay']=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x39')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x3a')]=0x0;_0x35f572[_0x18e2f5][_0x99ca('0x32')]=0x0;_0x35f572[_0x18e2f5]['outboundAnswerCallsDay']=0x0;_0x35f572[_0x18e2f5]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0x99ca('0x3b')]=function(_0x27ecf9,_0x25ae09){for(var _0x478519 in _0x25ae09){if(_0x27ecf9[_0x99ca('0x2a')](_0x478519)){_0x27ecf9[_0x478519]=_0x25ae09[_0x478519];}}};Realtime[_0x99ca('0x3c')][_0x99ca('0x3d')]=function(){var _0x353e08=this;return function(_0x5d4f0a){if(_0x5d4f0a){freeIsNotKeyAgent(_0x5d4f0a,_0x353e08[_0x99ca('0x11')]);for(var _0x3c1092=0x0,_0x482fb9={},_0x5483ce={};_0x3c1092<_0x5d4f0a[_0x99ca('0x3e')];_0x3c1092+=0x1){_0x482fb9=_0x5d4f0a[_0x3c1092];var _0x141fe3=_[_0x99ca('0x3f')](_0x482fb9[_0x99ca('0x26')])?util[_0x99ca('0x40')](_0x99ca('0x24'),_0x482fb9[_0x99ca('0x25')]):_0x482fb9[_0x99ca('0x26')];if(_['isUndefined'](_0x353e08['agents'][_0x141fe3])){_0x353e08[_0x99ca('0x11')][_0x141fe3]=new Agent(_0x482fb9);}else{_0x353e08[_0x99ca('0x3b')](_0x353e08[_0x99ca('0x11')][_0x141fe3],_0x482fb9);}}}return _0x353e08['agents'];};};Realtime['prototype'][_0x99ca('0x41')]=function(){var _0x281899=this;return function(_0x13e2cc){if(_0x13e2cc){freeIsNotKeySip(_0x13e2cc,_0x281899[_0x99ca('0x42')]);for(var _0x3d9393=0x0,_0x28cc8f={},_0x1c4e5e={};_0x3d9393<_0x13e2cc[_0x99ca('0x3e')];_0x3d9393+=0x1){_0x28cc8f=_0x13e2cc[_0x3d9393];if(_['isUndefined'](_0x281899['telephones'][util[_0x99ca('0x40')]('SIP/%s',_0x28cc8f['name'])])){_0x281899['telephones'][util[_0x99ca('0x40')](_0x99ca('0x24'),_0x28cc8f[_0x99ca('0x25')])]=new Telephone(_0x28cc8f);}else{_0x281899['mergeFromDatabase'](_0x281899[_0x99ca('0x42')][util[_0x99ca('0x40')](_0x99ca('0x24'),_0x28cc8f[_0x99ca('0x25')])],_0x28cc8f);}}}return _0x281899['telephones'];};};Realtime['prototype'][_0x99ca('0x43')]=function(){var _0x26f468=this;return function(_0xa55d79){if(_0xa55d79){freeIsNotKeySip(_0xa55d79,_0x26f468['trunks']);for(var _0x5b6938=0x0,_0x20c8fa={},_0x10ea71={};_0x5b6938<_0xa55d79[_0x99ca('0x3e')];_0x5b6938+=0x1){_0x20c8fa=_0xa55d79[_0x5b6938];if(_['isUndefined'](_0x26f468[_0x99ca('0x12')][util['format']('SIP/%s',_0x20c8fa['name'])])){_0x26f468[_0x99ca('0x12')][util[_0x99ca('0x40')](_0x99ca('0x24'),_0x20c8fa['name'])]=new Trunk(_0x20c8fa);}else{_0x26f468[_0x99ca('0x3b')](_0x26f468[_0x99ca('0x12')][util[_0x99ca('0x40')](_0x99ca('0x24'),_0x20c8fa[_0x99ca('0x25')])],_0x20c8fa);}}}return _0x26f468[_0x99ca('0x12')];};};Realtime[_0x99ca('0x3c')]['initVoiceQueues']=function(){var _0xe7b516=this;return function(_0x5e0005){if(_0x5e0005){freeIsNotKey(_0x5e0005,_0xe7b516[_0x99ca('0x13')],_0x99ca('0x25'));for(var _0x2d4162=0x0,_0x357f35={},_0x588306={};_0x2d4162<_0x5e0005[_0x99ca('0x3e')];_0x2d4162+=0x1){_0x357f35=_0x5e0005[_0x2d4162];if(_[_0x99ca('0x44')](_0xe7b516[_0x99ca('0x13')][_0x357f35[_0x99ca('0x25')]])){_0xe7b516[_0x99ca('0x13')][_0x357f35[_0x99ca('0x25')]]=new VoiceQueue(_0x357f35);}else{_0xe7b516[_0x99ca('0x3b')](_0xe7b516['voiceQueues'][_0x357f35[_0x99ca('0x25')]],_0x357f35);}}}return _0xe7b516['voiceQueues'];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x45')]=function(){var _0x51234e=this;return function(_0x138eab){if(_0x138eab){freeIsNotKey(_0x138eab,_0x51234e['triggers'],'id');for(var _0x4428ed=0x0,_0x380e22={},_0x41e1c6={};_0x4428ed<_0x138eab[_0x99ca('0x3e')];_0x4428ed+=0x1){_0x380e22=_0x138eab[_0x4428ed];if(_[_0x99ca('0x44')](_0x51234e['triggers'][_0x380e22['id']])){_0x51234e['triggers'][_0x380e22['id']]=new Trigger(_0x380e22);}else{_0x51234e[_0x99ca('0x3b')](_0x51234e[_0x99ca('0x14')][_0x380e22['id']],_0x380e22);}}}return _0x51234e[_0x99ca('0x14')];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x46')]=function(){var _0xbd5b92=this;return function(_0x15cb47){if(_0x15cb47){freeIsNotKey(_0x15cb47,_0xbd5b92[_0x99ca('0x16')],'id');for(var _0x3a998a=0x0,_0x2655ea={},_0x36b466={};_0x3a998a<_0x15cb47[_0x99ca('0x3e')];_0x3a998a+=0x1){_0x2655ea=_0x15cb47[_0x3a998a];if(_[_0x99ca('0x44')](_0xbd5b92['templates'][_0x2655ea['id']])){_0xbd5b92[_0x99ca('0x16')][_0x2655ea['id']]=new Template(_0x2655ea);}else{_0xbd5b92[_0x99ca('0x3b')](_0xbd5b92[_0x99ca('0x16')][_0x2655ea['id']],_0x2655ea);}}}return _0xbd5b92[_0x99ca('0x16')];};};Realtime['prototype'][_0x99ca('0x47')]=function(){var _0x2b20df=this;return function(_0x2d4f25){if(_0x2d4f25){freeIsNotKey(_0x2d4f25,_0x2b20df['zendeskAccounts'],'id');for(var _0x33f861=0x0,_0x48b7f7={},_0x3d8c9a={};_0x33f861<_0x2d4f25[_0x99ca('0x3e')];_0x33f861+=0x1){_0x48b7f7=_0x2d4f25[_0x33f861];if(_[_0x99ca('0x44')](_0x2b20df[_0x99ca('0x1b')][_0x48b7f7['id']])){_0x2b20df[_0x99ca('0x1b')][_0x48b7f7['id']]=new ZendeskAccount(_0x48b7f7);}else{_0x2b20df[_0x99ca('0x3b')](_0x2b20df[_0x99ca('0x1b')][_0x48b7f7['id']],_0x48b7f7);}}}return _0x2b20df[_0x99ca('0x1b')];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x48')]=function(){var _0x5c6298=this;return function(_0x16e338){if(_0x16e338){freeIsNotKey(_0x16e338,_0x5c6298['salesforceAccounts'],'id');for(var _0x47a54d=0x0,_0x4d12c5={},_0xd0bf07={};_0x47a54d<_0x16e338['length'];_0x47a54d+=0x1){_0x4d12c5=_0x16e338[_0x47a54d];if(_[_0x99ca('0x44')](_0x5c6298[_0x99ca('0x1c')][_0x4d12c5['id']])){_0x5c6298[_0x99ca('0x1c')][_0x4d12c5['id']]=new SalesforceAccount(_0x4d12c5);}else{_0x5c6298[_0x99ca('0x3b')](_0x5c6298[_0x99ca('0x1c')][_0x4d12c5['id']],_0x4d12c5);}}}return _0x5c6298[_0x99ca('0x1c')];};};Realtime['prototype'][_0x99ca('0x49')]=function(){var _0x165424=this;return function(_0x4e60de){if(_0x4e60de){freeIsNotKey(_0x4e60de,_0x165424[_0x99ca('0x1d')],'id');for(var _0x3d03dc=0x0,_0xab191b={},_0x25e3b4={};_0x3d03dc<_0x4e60de[_0x99ca('0x3e')];_0x3d03dc+=0x1){_0xab191b=_0x4e60de[_0x3d03dc];if(_[_0x99ca('0x44')](_0x165424['freshdeskAccounts'][_0xab191b['id']])){_0x165424[_0x99ca('0x1d')][_0xab191b['id']]=new FreshdeskAccount(_0xab191b);}else{_0x165424[_0x99ca('0x3b')](_0x165424[_0x99ca('0x1d')][_0xab191b['id']],_0xab191b);}}}return _0x165424[_0x99ca('0x1d')];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x4a')]=function(){var _0xfffe48=this;return function(_0x3377e5){if(_0x3377e5){freeIsNotKey(_0x3377e5,_0xfffe48[_0x99ca('0x1e')],'id');for(var _0x3bc642=0x0,_0x102846={},_0x2ccbe9={};_0x3bc642<_0x3377e5[_0x99ca('0x3e')];_0x3bc642+=0x1){_0x102846=_0x3377e5[_0x3bc642];if(_[_0x99ca('0x44')](_0xfffe48[_0x99ca('0x1e')][_0x102846['id']])){_0xfffe48[_0x99ca('0x1e')][_0x102846['id']]=new ZohoAccount(_0x102846);}else{_0xfffe48['mergeFromDatabase'](_0xfffe48[_0x99ca('0x1e')][_0x102846['id']],_0x102846);}}}return _0xfffe48['zohoAccounts'];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x33faab=this;return function(_0x2fc4f7){if(_0x2fc4f7){freeIsNotKey(_0x2fc4f7,_0x33faab[_0x99ca('0x1f')],'id');for(var _0x43a1b2=0x0,_0x17b49d={},_0x213ea0={};_0x43a1b2<_0x2fc4f7[_0x99ca('0x3e')];_0x43a1b2+=0x1){_0x17b49d=_0x2fc4f7[_0x43a1b2];if(_[_0x99ca('0x44')](_0x33faab[_0x99ca('0x1f')][_0x17b49d['id']])){_0x33faab['deskAccounts'][_0x17b49d['id']]=new DeskAccount(_0x17b49d);}else{_0x33faab[_0x99ca('0x3b')](_0x33faab[_0x99ca('0x1f')][_0x17b49d['id']],_0x17b49d);}}}return _0x33faab[_0x99ca('0x1f')];};};Realtime[_0x99ca('0x3c')]['initSugarcrmAccounts']=function(){var _0x24f61c=this;return function(_0x410a96){if(_0x410a96){freeIsNotKey(_0x410a96,_0x24f61c[_0x99ca('0x4b')],'id');for(var _0x3a78ab=0x0,_0x4e70df={},_0x23b04e={};_0x3a78ab<_0x410a96[_0x99ca('0x3e')];_0x3a78ab+=0x1){_0x4e70df=_0x410a96[_0x3a78ab];if(_[_0x99ca('0x44')](_0x24f61c[_0x99ca('0x4b')][_0x4e70df['id']])){_0x24f61c[_0x99ca('0x4b')][_0x4e70df['id']]=new SugarcrmAccount(_0x4e70df);}else{_0x24f61c['mergeFromDatabase'](_0x24f61c[_0x99ca('0x4b')][_0x4e70df['id']],_0x4e70df);}}}return _0x24f61c['sugarcrmAccounts'];};};Realtime[_0x99ca('0x3c')]['initVtigerAccounts']=function(){var _0xe692f6=this;return function(_0xf719c4){if(_0xf719c4){freeIsNotKey(_0xf719c4,_0xe692f6[_0x99ca('0x4c')],'id');for(var _0x373e9e=0x0,_0x2beeaf={},_0x32d6ff={};_0x373e9e<_0xf719c4[_0x99ca('0x3e')];_0x373e9e+=0x1){_0x2beeaf=_0xf719c4[_0x373e9e];if(_[_0x99ca('0x44')](_0xe692f6[_0x99ca('0x4c')][_0x2beeaf['id']])){_0xe692f6[_0x99ca('0x4c')][_0x2beeaf['id']]=new VtigerAccount(_0x2beeaf);}else{_0xe692f6[_0x99ca('0x3b')](_0xe692f6[_0x99ca('0x4c')][_0x2beeaf['id']],_0x2beeaf);}}}return _0xe692f6[_0x99ca('0x4c')];};};Realtime['prototype'][_0x99ca('0x4d')]=function(){var _0x5c847a=this;return function(_0x1e7093){if(_0x1e7093){freeIsNotKey(_0x1e7093,_0x5c847a['servicenowAccounts'],'id');for(var _0x56d0e2=0x0,_0x1b30fb={},_0x3eaad1={};_0x56d0e2<_0x1e7093[_0x99ca('0x3e')];_0x56d0e2+=0x1){_0x1b30fb=_0x1e7093[_0x56d0e2];if(_['isUndefined'](_0x5c847a[_0x99ca('0x20')][_0x1b30fb['id']])){_0x5c847a[_0x99ca('0x20')][_0x1b30fb['id']]=new ServicenowAccount(_0x1b30fb);}else{_0x5c847a['mergeFromDatabase'](_0x5c847a[_0x99ca('0x20')][_0x1b30fb['id']],_0x1b30fb);}}}return _0x5c847a[_0x99ca('0x20')];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x4e')]=function(){var _0x17554d=this;return function(_0x588a51){if(_0x588a51){freeIsNotKey(_0x588a51,_0x17554d[_0x99ca('0x4f')],'id');for(var _0x6218b7=0x0,_0x1c99ed={},_0x5d435b={};_0x6218b7<_0x588a51[_0x99ca('0x3e')];_0x6218b7+=0x1){_0x1c99ed=_0x588a51[_0x6218b7];if(_[_0x99ca('0x44')](_0x17554d[_0x99ca('0x4f')][_0x1c99ed['id']])){_0x17554d[_0x99ca('0x4f')][_0x1c99ed['id']]=new Dynamics365Account(_0x1c99ed);}else{_0x17554d[_0x99ca('0x3b')](_0x17554d[_0x99ca('0x4f')][_0x1c99ed['id']],_0x1c99ed);}}}return _0x17554d[_0x99ca('0x4f')];};};Realtime[_0x99ca('0x3c')]['initFreshsalesAccounts']=function(){var _0x14dc7c=this;return function(_0x21e31d){if(_0x21e31d){freeIsNotKey(_0x21e31d,_0x14dc7c[_0x99ca('0x21')],'id');for(var _0x5c48b7=0x0,_0x4b5a1e={},_0x3a52c8={};_0x5c48b7<_0x21e31d[_0x99ca('0x3e')];_0x5c48b7+=0x1){_0x4b5a1e=_0x21e31d[_0x5c48b7];if(_[_0x99ca('0x44')](_0x14dc7c[_0x99ca('0x21')][_0x4b5a1e['id']])){_0x14dc7c[_0x99ca('0x21')][_0x4b5a1e['id']]=new FreshsalesAccount(_0x4b5a1e);}else{_0x14dc7c[_0x99ca('0x3b')](_0x14dc7c[_0x99ca('0x21')][_0x4b5a1e['id']],_0x4b5a1e);}}}return _0x14dc7c[_0x99ca('0x21')];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x50')]=function(){var _0x360485=this;return function(_0x58d157){for(var _0x38a6f5=0x0;_0x38a6f5<_0x58d157[_0x99ca('0x3e')];_0x38a6f5+=0x1){_[_0x99ca('0x51')](_0x360485[_0x99ca('0x13')][_0x58d157[_0x38a6f5][_0x99ca('0x25')]],_0x58d157[_0x38a6f5]);}return _0x360485[_0x99ca('0x13')];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x52')]=function(){var _0x1652b9=this;return function(_0x2f8da0){clearVoiceQueues(_0x1652b9[_0x99ca('0x13')]);if(_0x2f8da0){_0x2f8da0=_[_0x99ca('0x53')](_0x2f8da0,_0x99ca('0x54'));for(var _0x283d23 in _0x2f8da0){if(_0x2f8da0['hasOwnProperty'](_0x283d23)){var _0x1b34ff={};for(var _0x2ba511=0x0;_0x2ba511<_0x2f8da0[_0x283d23][_0x99ca('0x3e')];_0x2ba511+=0x1){var _0x13f46e=_0x2f8da0[_0x283d23][_0x2ba511][_0x99ca('0x55')];if(_0x1652b9[_0x99ca('0x13')][_0x13f46e]){if(_0x2f8da0[_0x283d23][_0x2ba511]['queuecallerexit']){_0x1652b9[_0x99ca('0x13')][_0x13f46e][_0x99ca('0x2e')]+=0x1;}if(_0x2f8da0[_0x283d23][_0x2ba511][_0x99ca('0x56')]){_0x1652b9[_0x99ca('0x13')][_0x13f46e][_0x99ca('0x2f')]+=0x1;}_0x1652b9[_0x99ca('0x13')][_0x13f46e][_0x99ca('0x28')]+=moment(_0x2f8da0[_0x283d23][_0x2ba511]['queuecallerleaveAt'])[_0x99ca('0x57')](moment(_0x2f8da0[_0x283d23][_0x2ba511][_0x99ca('0x58')]),_0x99ca('0x59'))||0x0;if(_0x2ba511===_0x2f8da0[_0x283d23][_0x99ca('0x3e')]-0x1){_0x1652b9[_0x99ca('0x13')][_0x13f46e]['sumDuration']+=moment(_0x2f8da0[_0x283d23][_0x2ba511]['queuecallercompleteAt']||_0x2f8da0[_0x283d23][_0x2ba511][_0x99ca('0x5a')]||_0x2f8da0[_0x283d23][_0x2ba511][_0x99ca('0x5b')])[_0x99ca('0x57')](moment(_0x2f8da0[_0x283d23][_0x2ba511]['queuecallerjoinAt']),_0x99ca('0x59'))||0x0;_0x1652b9[_0x99ca('0x13')][_0x13f46e]['total']+=0x1;if(_0x2f8da0[_0x283d23][_0x2ba511]['queuecallercomplete']){_0x1652b9[_0x99ca('0x13')][_0x13f46e][_0x99ca('0x27')]+=0x1;_0x1652b9[_0x99ca('0x13')][_0x13f46e][_0x99ca('0x31')]+=moment(_0x2f8da0[_0x283d23][_0x2ba511][_0x99ca('0x5c')])[_0x99ca('0x57')](moment(_0x2f8da0[_0x283d23][_0x2ba511]['queuecallerleaveAt']),_0x99ca('0x59'))||0x0;}}else{_0x1652b9[_0x99ca('0x13')][_0x13f46e]['sumDuration']+=_0x1652b9['voiceQueues'][_0x13f46e][_0x99ca('0x28')]||0x0;}}}}}}return _0x1652b9[_0x99ca('0x13')];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x5d')]=function(){var _0x3bd5c3=this;return function(_0x48d827){clearVoiceCallReports(_0x3bd5c3[_0x99ca('0x17')]);if(_0x48d827){for(var _0x4d2338=0x0;_0x4d2338<_0x48d827[_0x99ca('0x3e')];_0x4d2338+=0x1){_0x3bd5c3[_0x99ca('0x17')][_0x99ca('0x2d')]+=0x1;_0x3bd5c3[_0x99ca('0x17')]['sumDuration']+=_0x48d827[_0x4d2338][_0x99ca('0x5e')];if(_0x48d827[_0x4d2338]['disposition']==='ANSWERED'){_0x3bd5c3['outbound'][_0x99ca('0x27')]+=0x1;_0x3bd5c3[_0x99ca('0x17')][_0x99ca('0x28')]+=_0x48d827[_0x4d2338][_0x99ca('0x5e')]-_0x48d827[_0x4d2338][_0x99ca('0x5f')]||0x0;_0x3bd5c3[_0x99ca('0x17')][_0x99ca('0x31')]+=_0x48d827[_0x4d2338][_0x99ca('0x5f')];}}}return _0x3bd5c3[_0x99ca('0x17')];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x60')]=function(){var _0x41107c=this;return function(_0x438ae9){if(_0x438ae9){freeIsNotKey(_0x438ae9,_0x41107c[_0x99ca('0x15')],'name');for(var _0x1b5240=0x0,_0x213dc3={};_0x1b5240<_0x438ae9[_0x99ca('0x3e')];_0x1b5240+=0x1){_0x213dc3=_0x438ae9[_0x1b5240];if(_[_0x99ca('0x44')](_0x41107c[_0x99ca('0x15')][_0x213dc3[_0x99ca('0x25')]])){_0x41107c[_0x99ca('0x15')][_0x213dc3[_0x99ca('0x25')]]=new Campaign(_0x213dc3);}else{_0x41107c['mergeFromDatabase'](_0x41107c[_0x99ca('0x15')][_0x213dc3[_0x99ca('0x25')]],_0x213dc3);_0x41107c[_0x99ca('0x15')][_0x213dc3['name']]['dialQueueProject']=_0x213dc3[_0x99ca('0x61')]?_0x213dc3[_0x99ca('0x61')][_0x99ca('0x25')]:undefined;}}}return _0x41107c[_0x99ca('0x15')];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x62')]=function(){var _0x3c3f57=this;return function(_0x559623){if(_0x559623){freeIsNotKey(_0x559623,_0x3c3f57['voiceExtensions'],'id');for(var _0x33941f=0x0,_0x2f89e8={};_0x33941f<_0x559623[_0x99ca('0x3e')];_0x33941f+=0x1){_0x2f89e8=_0x559623[_0x33941f];if(_[_0x99ca('0x44')](_0x3c3f57['voiceExtensions'][_0x2f89e8['id']])){_0x3c3f57[_0x99ca('0x63')][_0x2f89e8['id']]=new VoiceExtension(_0x2f89e8);}else{_0x3c3f57['mergeFromDatabase'](_0x3c3f57['voiceExtensions'][_0x2f89e8['id']],_0x2f89e8);}}}return _0x3c3f57[_0x99ca('0x63')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x1e9b15=this;return function(_0x58c6df){clearCampaigns(_0x1e9b15[_0x99ca('0x15')]);for(var _0x3e6550=0x0;_0x3e6550<_0x58c6df['length'];_0x3e6550+=0x1){_['merge'](_0x1e9b15[_0x99ca('0x15')][_0x58c6df[_0x3e6550][_0x99ca('0x25')]],_0x58c6df[_0x3e6550]);}return _0x1e9b15['campaigns'];};};Realtime[_0x99ca('0x3c')][_0x99ca('0x64')]=function(){var _0x2742fa=this;return function(_0x1fcaec){if(_0x1fcaec){freeIsNotKey(_0x1fcaec,_0x2742fa['faxAccounts'],'id');for(var _0x28f3c1=0x0,_0x48eb6f={},_0x21b212={};_0x28f3c1<_0x1fcaec[_0x99ca('0x3e')];_0x28f3c1+=0x1){_0x48eb6f=_0x1fcaec[_0x28f3c1];if(_[_0x99ca('0x44')](_0x2742fa[_0x99ca('0x22')][_0x48eb6f['id']])){_0x2742fa['faxAccounts'][_0x48eb6f['id']]=new FaxAccount(_0x48eb6f);}else{_0x2742fa[_0x99ca('0x3b')](_0x2742fa[_0x99ca('0x22')][_0x48eb6f['id']],_0x48eb6f);}}}return _0x2742fa['faxAccounts'];};};module[_0x99ca('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index eccdccd..1fcd3f3 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 _0xdbbc=['SIP/%s','blindTransfer','exports','lodash','../../../config/environment','../../../config/logger','ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','name','isNil','find','accountcode','interface','format','length','connectedlinenum','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','monitorFilename','createdAt','exten','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf'];(function(_0x1c3429,_0x11d159){var _0x1609bd=function(_0x5ce42c){while(--_0x5ce42c){_0x1c3429['push'](_0x1c3429['shift']());}};_0x1609bd(++_0x11d159);}(_0xdbbc,0x147));var _0xcdbb=function(_0x442c36,_0x3dbe3c){_0x442c36=_0x442c36-0x0;var _0x7f1070=_0xdbbc[_0x442c36];return _0x7f1070;};'use strict';var BPromise=require('bluebird');var _=require(_0xcdbb('0x0'));var moment=require('moment');var util=require('util');var config=require(_0xcdbb('0x1'));var logger=require(_0xcdbb('0x2'))(_0xcdbb('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xcdbb('0x4'));var RpcVoiceCallReport=require(_0xcdbb('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xcdbb('0x6'));var RpcVoiceQueueReport=require(_0xcdbb('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xcdbb('0x8'));var VoiceCallReport=require(_0xcdbb('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xcdbb('0xa'));var UserReport=require('./userReport');function Report(_0x148cf2){this[_0xcdbb('0xb')]=_0x148cf2;this[_0xcdbb('0xc')]=_0x148cf2[_0xcdbb('0xc')];this[_0xcdbb('0xd')]=_0x148cf2[_0xcdbb('0xd')];}Report[_0xcdbb('0xe')][_0xcdbb('0xf')]=function(_0x2737a9){var _0x34ee6a=new VoiceQueueReport(this['realtime']);var _0x36fd76=new VoiceAgentReport(this[_0xcdbb('0xb')]);var _0x5389fc=new VoiceDialReport(this[_0xcdbb('0xb')]);var _0x308c68=new VoiceCallReport(this[_0xcdbb('0xb')]);var _0x3e31a3=new UserReport(this['realtime']);if(config[_0xcdbb('0x10')]&&config['xdr'][_0xcdbb('0x11')]){ami['on']('custom:voiceQueueReport',this[_0xcdbb('0x12')][_0xcdbb('0x13')](this));ami['on']('custom:voiceCallReport',this[_0xcdbb('0x14')]['bind'](this));ami['on'](_0xcdbb('0x15'),this[_0xcdbb('0x16')][_0xcdbb('0x13')](this));ami['on']('custom:voiceDialReport',this[_0xcdbb('0x17')][_0xcdbb('0x13')](this));ami['on'](_0xcdbb('0x18'),this['blindTransfer'][_0xcdbb('0x13')](this));ami['on'](_0xcdbb('0x19'),this[_0xcdbb('0x1a')]['bind'](this));}};Report[_0xcdbb('0xe')][_0xcdbb('0x1b')]=function(_0x44c7b5){var _0x597e4e=undefined;_0x597e4e=_['find'](this[_0xcdbb('0xc')],function(_0x52994e){return _0x52994e['accountcode']==_0x44c7b5||_0x52994e[_0xcdbb('0x1c')]==_0x44c7b5;});if(_[_0xcdbb('0x1d')](_0x597e4e)){var _0x3c37db=_[_0xcdbb('0x1e')](this[_0xcdbb('0xd')],function(_0x1997df){return _0x1997df[_0xcdbb('0x1f')]==_0x44c7b5||_0x1997df[_0xcdbb('0x1c')]==_0x44c7b5;});if(_0x3c37db){_0x597e4e=_[_0xcdbb('0x1e')](this[_0xcdbb('0xc')],function(_0x4c643f){return _0x4c643f[_0xcdbb('0x20')]==util[_0xcdbb('0x21')]('SIP/%s',_0x3c37db[_0xcdbb('0x1c')]);});}}return _0x597e4e;};Report['prototype'][_0xcdbb('0x12')]=function(_0x11fdf9){for(var _0x3e7156=0x0;_0x3e7156<_0x11fdf9[_0xcdbb('0x22')];_0x3e7156+=0x1){var _0x32eba5=this['findAgent'](_0x11fdf9[_0x3e7156][_0xcdbb('0x23')]);if(_0x32eba5){_0x11fdf9[_0x3e7156]['accountcode']=_0x32eba5[_0xcdbb('0x1f')];_0x11fdf9[_0x3e7156]['assigned']=!![];_0x11fdf9[_0x3e7156][_0xcdbb('0x24')]=_0x32eba5[_0xcdbb('0x1c')];_0x11fdf9[_0x3e7156][_0xcdbb('0x20')]=_[_0xcdbb('0x1d')](_0x32eba5[_0xcdbb('0x20')])?util[_0xcdbb('0x21')]('SIP/%s',_0x32eba5[_0xcdbb('0x1c')]):_0x32eba5[_0xcdbb('0x20')];if(_0x11fdf9[_0x3e7156][_0xcdbb('0x25')]){_0x11fdf9[_0x3e7156][_0xcdbb('0x26')]=moment()[_0xcdbb('0x21')](_0xcdbb('0x27'));}if(_0x11fdf9[_0x3e7156][_0xcdbb('0x28')]){_0x11fdf9[_0x3e7156][_0xcdbb('0x29')]=moment()['format'](_0xcdbb('0x27'));}RpcMemberReport[_0xcdbb('0x12')](_0x11fdf9[_0x3e7156]);}RpcVoiceQueueReport[_0xcdbb('0x2a')](_0x11fdf9[_0x3e7156]);}};function extractCalleridNumber(_0x155cda){var _0xab6e80=_0x155cda[_0xcdbb('0x2b')](/<(.*?)>/);return _0xab6e80?_0xab6e80[0x1]:_0x155cda;}Report['prototype'][_0xcdbb('0x14')]=function(_0x5c589b){_0x5c589b[_0xcdbb('0x2c')]=_0x5c589b[_0xcdbb('0x2c')]||_0x5c589b['exten'];if(_0x5c589b[_0xcdbb('0x2d')]==_0xcdbb('0x2e')){_0x5c589b[_0xcdbb('0x2f')]=_0xcdbb('0x30');_0x5c589b[_0xcdbb('0x31')]=_0x5c589b[_0xcdbb('0x30')];if(_0x5c589b[_0xcdbb('0x32')]==_0xcdbb('0x33')){_0x5c589b[_0xcdbb('0x1f')]='';_0x5c589b[_0xcdbb('0x2c')]=extractCalleridNumber(_0x5c589b[_0xcdbb('0x34')]);}else if(_0x5c589b[_0xcdbb('0x32')]=='from-sip'){if(_0x5c589b[_0xcdbb('0x2c')]=='xcally-motion-preview'){_0x5c589b[_0xcdbb('0x2c')]=extractCalleridNumber(_0x5c589b[_0xcdbb('0x35')]);_0x5c589b[_0xcdbb('0x36')]=_0x5c589b[_0xcdbb('0x37')];_0x5c589b['destinationchannel']=[_0x5c589b[_0xcdbb('0x38')],_0x5c589b[_0xcdbb('0x38')]=_0x5c589b[_0xcdbb('0x39')]][0x0];_0x5c589b[_0xcdbb('0x34')]=_0x5c589b[_0xcdbb('0x35')];}else{_0x5c589b[_0xcdbb('0x2c')]=_0x5c589b[_0xcdbb('0x36')];_0x5c589b[_0xcdbb('0x36')]=_0x5c589b[_0xcdbb('0x37')];if(_0x5c589b[_0xcdbb('0x3a')]==_0xcdbb('0x3b')){_0x5c589b['accountcode']=_0x5c589b['connectedlinenum'];}else{_0x5c589b[_0xcdbb('0x1f')]='';}}}}else{_0x5c589b[_0xcdbb('0x34')]=util[_0xcdbb('0x21')](_0xcdbb('0x3c'),_0x5c589b[_0xcdbb('0x3d')],_0x5c589b[_0xcdbb('0x36')]);}RpcVoiceCallReport['create'](_0x5c589b);if(_0x5c589b[_0xcdbb('0x3e')]){for(var _0x55a859=0x0;_0x55a859<_0x5c589b[_0xcdbb('0x3f')]['length'];_0x55a859+=0x1){_0x5c589b[_0xcdbb('0x40')]=_0x5c589b['monitors'][_0x55a859]['filename'];_0x5c589b[_0xcdbb('0x41')]=_0x5c589b['monitors'][_0x55a859][_0xcdbb('0x41')];if(_0x5c589b[_0xcdbb('0x42')]==_0xcdbb('0x43')){_0x5c589b[_0xcdbb('0x36')]=_0x5c589b[_0xcdbb('0x23')];_0x5c589b[_0xcdbb('0x3d')]=_0x5c589b['connectedlinename'];_0x5c589b[_0xcdbb('0x23')]=_0x5c589b[_0xcdbb('0x1f')];_0x5c589b[_0xcdbb('0x44')]=_0x5c589b[_0xcdbb('0x45')];_0x5c589b[_0xcdbb('0x42')]=_0x5c589b[_0xcdbb('0x37')];}else if(_0x5c589b[_0xcdbb('0x42')]==_0xcdbb('0x46')){_0x5c589b['calleridnum']=_0x5c589b['destination'];_0x5c589b[_0xcdbb('0x42')]=_0x5c589b[_0xcdbb('0x37')];}RpcVoiceRecording[_0xcdbb('0x2a')](_0x5c589b);}}};Report[_0xcdbb('0xe')][_0xcdbb('0x16')]=function(_0x1cc44c){if(_['isArray'](_0x1cc44c)){_0x1cc44c[_0xcdbb('0x47')](function(_0x522394){RpcVoiceAgentReport[_0xcdbb('0x2a')](_0x522394);});}else{RpcVoiceAgentReport[_0xcdbb('0x2a')](_0x1cc44c);}};Report[_0xcdbb('0xe')][_0xcdbb('0x17')]=function(_0x566e2e){RpcVoiceDialReport[_0xcdbb('0x2a')](_0x566e2e);var _0xe100e=undefined;var _0x111055=_0x566e2e[_0xcdbb('0x38')];if(_[_0xcdbb('0x48')](_0x111055,'Local')){var _0x3e8512=_0x111055[_0xcdbb('0x49')](_0x111055[_0xcdbb('0x4a')]('/')+0x1,_0x111055[_0xcdbb('0x4a')]('@'));_0xe100e=_[_0xcdbb('0x1e')](this[_0xcdbb('0xc')],function(_0x3ce96b){return _0x3ce96b[_0xcdbb('0x4b')]==_0x3e8512||_0x3ce96b[_0xcdbb('0x4c')]==_0x3e8512||_0x3ce96b[_0xcdbb('0x1f')]==_0x3e8512;});}else{var _0x3e8512=_0x111055[_0xcdbb('0x49')](_0x111055[_0xcdbb('0x4a')]('/')+0x1,_0x111055[_0xcdbb('0x4d')]('-'));_0xe100e=this[_0xcdbb('0x1b')](_0x3e8512);}if(_0xe100e){_0x566e2e[_0xcdbb('0x20')]=_[_0xcdbb('0x1d')](_0xe100e[_0xcdbb('0x20')])?util[_0xcdbb('0x21')](_0xcdbb('0x4e'),_0xe100e[_0xcdbb('0x1c')]):_0xe100e[_0xcdbb('0x20')];_0x566e2e[_0xcdbb('0x45')]=_0xe100e['name'];_0x566e2e['accountcode']=_0xe100e[_0xcdbb('0x1f')];RpcMemberReport['voiceDialReport'](_0x566e2e);}};Report[_0xcdbb('0xe')][_0xcdbb('0x4f')]=function(_0xcf12b){RpcVoiceTransferReport[_0xcdbb('0x4f')](_0xcf12b);};Report[_0xcdbb('0xe')][_0xcdbb('0x1a')]=function(_0x2c6391){RpcVoiceTransferReport[_0xcdbb('0x1a')](_0x2c6391);};module[_0xcdbb('0x50')]=Report; \ No newline at end of file +var _0xb307=['createdAt','xcally-motion-preview','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','mobile','substring','blindTransfer','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','voiceQueueReport','voiceCallReport','bind','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','findAgent','accountcode','name','isNil','find','interface','format','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','\x22%s\x22\x20<%s>','length','monitorFilename','monitors'];(function(_0x590da5,_0x298084){var _0x54d4c4=function(_0xf67551){while(--_0xf67551){_0x590da5['push'](_0x590da5['shift']());}};_0x54d4c4(++_0x298084);}(_0xb307,0x10c));var _0x7b30=function(_0x1d75c9,_0x358245){_0x1d75c9=_0x1d75c9-0x0;var _0x253547=_0xb307[_0x1d75c9];return _0x253547;};'use strict';var BPromise=require('bluebird');var _=require(_0x7b30('0x0'));var moment=require(_0x7b30('0x1'));var util=require(_0x7b30('0x2'));var config=require(_0x7b30('0x3'));var logger=require(_0x7b30('0x4'))(_0x7b30('0x5'));var ami=require(_0x7b30('0x6'));var RpcVoiceAgentReport=require(_0x7b30('0x7'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x7b30('0x8'));var RpcMemberReport=require(_0x7b30('0x9'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x7b30('0xa'));var RpcVoiceTransferReport=require(_0x7b30('0xb'));var VoiceQueueReport=require(_0x7b30('0xc'));var VoiceCallReport=require(_0x7b30('0xd'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x7b30('0xe'));var UserReport=require(_0x7b30('0xf'));function Report(_0x5c5f21){this['realtime']=_0x5c5f21;this[_0x7b30('0x10')]=_0x5c5f21[_0x7b30('0x10')];this[_0x7b30('0x11')]=_0x5c5f21['telephones'];}Report[_0x7b30('0x12')][_0x7b30('0x13')]=function(_0x1a2b98){var _0x547623=new VoiceQueueReport(this['realtime']);var _0x5c8102=new VoiceAgentReport(this[_0x7b30('0x14')]);var _0x174b1c=new VoiceDialReport(this[_0x7b30('0x14')]);var _0x640362=new VoiceCallReport(this['realtime']);var _0x1acd48=new UserReport(this[_0x7b30('0x14')]);if(config[_0x7b30('0x15')]&&config[_0x7b30('0x15')][_0x7b30('0x16')]){ami['on']('custom:voiceQueueReport',this[_0x7b30('0x17')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x7b30('0x18')][_0x7b30('0x19')](this));ami['on']('custom:voiceAgentReport',this[_0x7b30('0x1a')][_0x7b30('0x19')](this));ami['on']('custom:voiceDialReport',this[_0x7b30('0x1b')]['bind'](this));ami['on'](_0x7b30('0x1c'),this['blindTransfer']['bind'](this));ami['on'](_0x7b30('0x1d'),this['attendedTransfer']['bind'](this));}};Report[_0x7b30('0x12')][_0x7b30('0x1e')]=function(_0xc0c94c){var _0x347a05=undefined;_0x347a05=_['find'](this[_0x7b30('0x10')],function(_0x39e369){return _0x39e369[_0x7b30('0x1f')]==_0xc0c94c||_0x39e369[_0x7b30('0x20')]==_0xc0c94c;});if(_[_0x7b30('0x21')](_0x347a05)){var _0x34bdc3=_['find'](this[_0x7b30('0x11')],function(_0x4fc494){return _0x4fc494[_0x7b30('0x1f')]==_0xc0c94c||_0x4fc494[_0x7b30('0x20')]==_0xc0c94c;});if(_0x34bdc3){_0x347a05=_[_0x7b30('0x22')](this['agents'],function(_0x4e8ad1){return _0x4e8ad1[_0x7b30('0x23')]==util[_0x7b30('0x24')]('SIP/%s',_0x34bdc3[_0x7b30('0x20')]);});}}return _0x347a05;};Report[_0x7b30('0x12')][_0x7b30('0x17')]=function(_0x34e5af){for(var _0x5ef57f=0x0;_0x5ef57f<_0x34e5af['length'];_0x5ef57f+=0x1){var _0x4bbdb6=this[_0x7b30('0x1e')](_0x34e5af[_0x5ef57f][_0x7b30('0x25')]);if(_0x4bbdb6){_0x34e5af[_0x5ef57f][_0x7b30('0x1f')]=_0x4bbdb6[_0x7b30('0x1f')];_0x34e5af[_0x5ef57f][_0x7b30('0x26')]=!![];_0x34e5af[_0x5ef57f][_0x7b30('0x27')]=_0x4bbdb6[_0x7b30('0x20')];_0x34e5af[_0x5ef57f][_0x7b30('0x23')]=_[_0x7b30('0x21')](_0x4bbdb6[_0x7b30('0x23')])?util['format'](_0x7b30('0x28'),_0x4bbdb6[_0x7b30('0x20')]):_0x4bbdb6['interface'];if(_0x34e5af[_0x5ef57f][_0x7b30('0x29')]){_0x34e5af[_0x5ef57f][_0x7b30('0x2a')]=moment()[_0x7b30('0x24')](_0x7b30('0x2b'));}if(_0x34e5af[_0x5ef57f]['queuecallerexit']){_0x34e5af[_0x5ef57f][_0x7b30('0x2c')]=moment()[_0x7b30('0x24')](_0x7b30('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x34e5af[_0x5ef57f]);}RpcVoiceQueueReport[_0x7b30('0x2d')](_0x34e5af[_0x5ef57f]);}};function extractCalleridNumber(_0x11caf2){var _0x251284=_0x11caf2[_0x7b30('0x2e')](/<(.*?)>/);return _0x251284?_0x251284[0x1]:_0x11caf2;}Report[_0x7b30('0x12')][_0x7b30('0x18')]=function(_0x28fe4f){_0x28fe4f[_0x7b30('0x2f')]=_0x28fe4f[_0x7b30('0x2f')]||_0x28fe4f[_0x7b30('0x30')];if(_0x28fe4f[_0x7b30('0x31')]==_0x7b30('0x32')){_0x28fe4f[_0x7b30('0x33')]=_0x7b30('0x34');_0x28fe4f[_0x7b30('0x35')]=_0x28fe4f[_0x7b30('0x34')];if(_0x28fe4f[_0x7b30('0x36')]==_0x7b30('0x37')){_0x28fe4f[_0x7b30('0x1f')]='';_0x28fe4f[_0x7b30('0x2f')]=extractCalleridNumber(_0x28fe4f[_0x7b30('0x38')]);}else if(_0x28fe4f['context']==_0x7b30('0x39')){if(_0x28fe4f['destination']=='xcally-motion-preview'){_0x28fe4f[_0x7b30('0x2f')]=extractCalleridNumber(_0x28fe4f[_0x7b30('0x3a')]);_0x28fe4f[_0x7b30('0x3b')]=_0x28fe4f[_0x7b30('0x3c')];_0x28fe4f[_0x7b30('0x3d')]=[_0x28fe4f['channel'],_0x28fe4f[_0x7b30('0x3e')]=_0x28fe4f[_0x7b30('0x3d')]][0x0];_0x28fe4f[_0x7b30('0x38')]=_0x28fe4f['calleridpreview'];}else{_0x28fe4f['destination']=_0x28fe4f[_0x7b30('0x3b')];_0x28fe4f[_0x7b30('0x3b')]=_0x28fe4f[_0x7b30('0x3c')];if(_0x28fe4f[_0x7b30('0x3f')]=='ANSWERED'){_0x28fe4f['accountcode']=_0x28fe4f['connectedlinenum'];}else{_0x28fe4f[_0x7b30('0x1f')]='';}}}}else{_0x28fe4f[_0x7b30('0x38')]=util[_0x7b30('0x24')](_0x7b30('0x40'),_0x28fe4f['calleridname'],_0x28fe4f[_0x7b30('0x3b')]);}RpcVoiceCallReport[_0x7b30('0x2d')](_0x28fe4f);if(_0x28fe4f['monitor']){for(var _0x23c677=0x0;_0x23c677<_0x28fe4f['monitors'][_0x7b30('0x41')];_0x23c677+=0x1){_0x28fe4f[_0x7b30('0x42')]=_0x28fe4f[_0x7b30('0x43')][_0x23c677]['filename'];_0x28fe4f['createdAt']=_0x28fe4f[_0x7b30('0x43')][_0x23c677][_0x7b30('0x44')];if(_0x28fe4f['exten']==_0x7b30('0x45')){_0x28fe4f[_0x7b30('0x3b')]=_0x28fe4f[_0x7b30('0x25')];_0x28fe4f[_0x7b30('0x46')]=_0x28fe4f[_0x7b30('0x47')];_0x28fe4f[_0x7b30('0x25')]=_0x28fe4f[_0x7b30('0x1f')];_0x28fe4f['connectedlinename']=_0x28fe4f[_0x7b30('0x48')];_0x28fe4f[_0x7b30('0x30')]=_0x28fe4f[_0x7b30('0x3c')];}else if(_0x28fe4f[_0x7b30('0x30')]==_0x7b30('0x49')){_0x28fe4f[_0x7b30('0x3b')]=_0x28fe4f['destination'];_0x28fe4f['exten']=_0x28fe4f[_0x7b30('0x3c')];}RpcVoiceRecording[_0x7b30('0x2d')](_0x28fe4f);}}};Report[_0x7b30('0x12')]['voiceAgentReport']=function(_0x207a6a){if(_[_0x7b30('0x4a')](_0x207a6a)){_0x207a6a[_0x7b30('0x4b')](function(_0x53e515){RpcVoiceAgentReport['create'](_0x53e515);});}else{RpcVoiceAgentReport[_0x7b30('0x2d')](_0x207a6a);}};Report['prototype'][_0x7b30('0x1b')]=function(_0x56ef53){RpcVoiceDialReport[_0x7b30('0x2d')](_0x56ef53);var _0x30e0d9=undefined;var _0x46c257=_0x56ef53[_0x7b30('0x3e')];if(_[_0x7b30('0x4c')](_0x46c257,_0x7b30('0x4d'))){var _0x41b0b5=_0x46c257['substring'](_0x46c257[_0x7b30('0x4e')]('/')+0x1,_0x46c257[_0x7b30('0x4e')]('@'));_0x30e0d9=_[_0x7b30('0x22')](this[_0x7b30('0x10')],function(_0x4f2765){return _0x4f2765[_0x7b30('0x4f')]==_0x41b0b5||_0x4f2765['phone']==_0x41b0b5||_0x4f2765[_0x7b30('0x1f')]==_0x41b0b5;});}else{var _0x41b0b5=_0x46c257[_0x7b30('0x50')](_0x46c257[_0x7b30('0x4e')]('/')+0x1,_0x46c257['lastIndexOf']('-'));_0x30e0d9=this[_0x7b30('0x1e')](_0x41b0b5);}if(_0x30e0d9){_0x56ef53[_0x7b30('0x23')]=_['isNil'](_0x30e0d9[_0x7b30('0x23')])?util[_0x7b30('0x24')](_0x7b30('0x28'),_0x30e0d9[_0x7b30('0x20')]):_0x30e0d9[_0x7b30('0x23')];_0x56ef53[_0x7b30('0x48')]=_0x30e0d9[_0x7b30('0x20')];_0x56ef53['accountcode']=_0x30e0d9[_0x7b30('0x1f')];RpcMemberReport[_0x7b30('0x1b')](_0x56ef53);}};Report[_0x7b30('0x12')][_0x7b30('0x51')]=function(_0x3b1735){RpcVoiceTransferReport[_0x7b30('0x51')](_0x3b1735);};Report['prototype'][_0x7b30('0x52')]=function(_0x2f7c07){RpcVoiceTransferReport[_0x7b30('0x52')](_0x2f7c07);};module[_0x7b30('0x53')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index d283200..8e70339 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 _0xd3ee=['resolve','actionSipShowRegistry','then','actionDeviceStateList','actionSipPeerStatus','catch','error','inspect','prototype','isNotNull','emit','find','state','omit','event','username','format','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','trunk:%s','startsWith','Queue','indexOf','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','address','status','telephone:save','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xd3ee,0xab));var _0xed3e=function(_0x3de6c1,_0x4cb097){_0x3de6c1=_0x3de6c1-0x0;var _0x4453c8=_0xd3ee[_0x3de6c1];return _0x4453c8;};'use strict';var _=require(_0xed3e('0x0'));var moment=require(_0xed3e('0x1'));var BPromise=require(_0xed3e('0x2'));var util=require(_0xed3e('0x3'));var Redis=require(_0xed3e('0x4'));var config=require(_0xed3e('0x5'));var logger=require('../../../config/logger')(_0xed3e('0x6'));var ami=require(_0xed3e('0x7'));config[_0xed3e('0x8')]=_[_0xed3e('0x9')](config[_0xed3e('0x8')],{'host':_0xed3e('0xa'),'port':0x18eb});var io=require(_0xed3e('0xb'))(new Redis(config[_0xed3e('0x8')]));function UserReport(_0x11858d){this[_0xed3e('0xc')]=_0x11858d[_0xed3e('0xc')];this[_0xed3e('0xd')]=_0x11858d[_0xed3e('0xd')];this[_0xed3e('0xe')]=_0x11858d[_0xed3e('0xe')];ami['on'](_0xed3e('0xf'),this[_0xed3e('0x10')][_0xed3e('0x11')](this));ami['on'](_0xed3e('0x12'),this[_0xed3e('0x10')][_0xed3e('0x11')](this));ami['on'](_0xed3e('0x13'),this[_0xed3e('0x14')]['bind'](this));ami['on'](_0xed3e('0x15'),this[_0xed3e('0x16')]['bind'](this));this[_0xed3e('0x17')]();return BPromise[_0xed3e('0x18')]()['then'](ami[_0xed3e('0x19')]())[_0xed3e('0x1a')](ami[_0xed3e('0x1b')]())['then'](ami[_0xed3e('0x1c')]())[_0xed3e('0x1d')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0xedd8f1){return function(_0x344edb){logger[_0xed3e('0x1e')](_0xedd8f1,util[_0xed3e('0x1f')](_0x344edb,{'showHidden':![],'depth':null}));};}UserReport[_0xed3e('0x20')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0xed3e('0x1a')](ami[_0xed3e('0x19')]())['then'](ami[_0xed3e('0x1b')]())['then'](ami[_0xed3e('0x1c')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xed3e('0x20')][_0xed3e('0x21')]=function(_0x1d5d4b){return _0x1d5d4b!==null&&!_['isUndefined'](_0x1d5d4b);};UserReport[_0xed3e('0x20')][_0xed3e('0x22')]=function(_0x108092,_0x5ee222,_0x105496){io['to'](_0x108092)[_0xed3e('0x22')](_0x5ee222,_0x105496);};UserReport[_0xed3e('0x20')][_0xed3e('0x10')]=function(_0x59ac69){try{if(this[_0xed3e('0x21')](_0x59ac69)){var _0x1a08a2=_[_0xed3e('0x23')](this[_0xed3e('0xc')],{'registry':_0x59ac69['username']});if(_0x1a08a2){_0x59ac69['stateRegistry']=_0x59ac69[_0xed3e('0x24')];_['merge'](_0x1a08a2,_[_0xed3e('0x25')](_0x59ac69,[_0xed3e('0x26'),'actionid',_0xed3e('0x27'),_0xed3e('0x24')]));this[_0xed3e('0x22')](util[_0xed3e('0x28')]('trunk:%s',_0x1a08a2[_0xed3e('0x29')]),_0xed3e('0x2a'),_0x1a08a2);}}}catch(_0x1393a1){logger[_0xed3e('0x1e')](_0xed3e('0x2b'),util['inspect'](_0x1393a1,{'showHidden':![],'depth':null}));}};UserReport[_0xed3e('0x20')][_0xed3e('0x14')]=function(_0x5ed164){try{if(this['isNotNull'](_0x5ed164)){if(this[_0xed3e('0xd')][_0x5ed164[_0xed3e('0x2c')]]){if(!this['agents'][_0x5ed164[_0xed3e('0x2c')]][_0xed3e('0x2d')]||_0x5ed164[_0xed3e('0x24')][_0xed3e('0x2e')]()==_0xed3e('0x2f')){this[_0xed3e('0xd')][_0x5ed164[_0xed3e('0x2c')]]['local']=![];if(this[_0xed3e('0xd')][_0x5ed164[_0xed3e('0x2c')]]['state']!==_0x5ed164[_0xed3e('0x24')]['toLowerCase']()){this['agents'][_0x5ed164[_0xed3e('0x2c')]][_0xed3e('0x30')]=_[_0xed3e('0x31')](moment()[_0xed3e('0x28')]('x'));}this[_0xed3e('0xd')][_0x5ed164['device']][_0xed3e('0x24')]=_0x5ed164[_0xed3e('0x24')][_0xed3e('0x2e')]();this[_0xed3e('0xd')][_0x5ed164[_0xed3e('0x2c')]][_0xed3e('0x32')](_0x5ed164);}}else if(this[_0xed3e('0xe')][_0x5ed164[_0xed3e('0x2c')]]){if(this['telephones'][_0x5ed164['device']][_0xed3e('0x24')]!==_0x5ed164[_0xed3e('0x24')][_0xed3e('0x2e')]()){this['telephones'][_0x5ed164[_0xed3e('0x2c')]][_0xed3e('0x30')]=_[_0xed3e('0x31')](moment()['format']('x'));}this['telephones'][_0x5ed164['device']][_0xed3e('0x24')]=_0x5ed164[_0xed3e('0x24')][_0xed3e('0x2e')]();this['emit'](util[_0xed3e('0x28')](_0xed3e('0x33'),this[_0xed3e('0xe')][_0x5ed164['device']][_0xed3e('0x29')]),'telephone:save',this['telephones'][_0x5ed164[_0xed3e('0x2c')]]);}else if(this['trunks'][_0x5ed164['device']]){if(this[_0xed3e('0xc')][_0x5ed164[_0xed3e('0x2c')]][_0xed3e('0x24')]!==_0x5ed164[_0xed3e('0x24')][_0xed3e('0x2e')]()){this[_0xed3e('0xc')][_0x5ed164[_0xed3e('0x2c')]][_0xed3e('0x30')]=_['toNumber'](moment()[_0xed3e('0x28')]('x'));}this[_0xed3e('0xc')][_0x5ed164['device']]['state']=_0x5ed164[_0xed3e('0x24')]['toLowerCase']();this['emit'](util[_0xed3e('0x28')](_0xed3e('0x34'),this['trunks'][_0x5ed164[_0xed3e('0x2c')]][_0xed3e('0x29')]),_0xed3e('0x2a'),this['trunks'][_0x5ed164[_0xed3e('0x2c')]]);}else if(_[_0xed3e('0x35')](_0x5ed164[_0xed3e('0x2c')],_0xed3e('0x36'))){}else if(_[_0xed3e('0x35')](_0x5ed164[_0xed3e('0x2c')],'Local')){var _0x1cf6a8=_0x5ed164['device'];var _0x27a107=_0x1cf6a8['substring'](_0x1cf6a8[_0xed3e('0x37')]('/')+0x1,_0x1cf6a8[_0xed3e('0x37')]('@'));var _0x22953c=_[_0xed3e('0x23')](this['agents'],function(_0x311b0f){return _0x311b0f['mobile']==_0x27a107||_0x311b0f[_0xed3e('0x38')]==_0x27a107||_0x311b0f[_0xed3e('0x39')]==_0x27a107;});if(_0x22953c){if(_0x22953c[_0xed3e('0x24')]!==_0x5ed164[_0xed3e('0x24')][_0xed3e('0x2e')]()){_0x22953c[_0xed3e('0x30')]=_[_0xed3e('0x31')](moment()[_0xed3e('0x28')]('x'));}_0x22953c[_0xed3e('0x24')]=_0x5ed164['state'][_0xed3e('0x2e')]();_0x22953c['local']=!![];_0x22953c['updateStatusRealtime'](_0x5ed164);}}else{}}}catch(_0x11463e){logger[_0xed3e('0x1e')](_0xed3e('0x3a'),util[_0xed3e('0x1f')](_0x11463e,{'showHidden':![],'depth':null}));}};UserReport[_0xed3e('0x20')][_0xed3e('0x16')]=function(_0x478e06){try{if(this[_0xed3e('0x21')](_0x478e06)&&this[_0xed3e('0x21')](_0x478e06[_0xed3e('0x15')])){if(this['agents'][_0x478e06[_0xed3e('0x3b')]]){if(!this[_0xed3e('0xd')][_0x478e06['peer']]['local']||_0x478e06[_0xed3e('0x15')][_0xed3e('0x2e')]()==_0xed3e('0x3c')){this[_0xed3e('0xd')][_0x478e06[_0xed3e('0x3b')]][_0xed3e('0x2d')]=![];this['agents'][_0x478e06['peer']]['status']=_0x478e06['peerstatus'][_0xed3e('0x2e')]();this[_0xed3e('0xd')][_0x478e06[_0xed3e('0x3b')]][_0xed3e('0x3d')]=_0x478e06[_0xed3e('0x3d')];this[_0xed3e('0xd')][_0x478e06[_0xed3e('0x3b')]][_0xed3e('0x32')](_0x478e06);}}else if(this[_0xed3e('0xe')][_0x478e06['peer']]){this[_0xed3e('0xe')][_0x478e06['peer']][_0xed3e('0x3e')]=_0x478e06[_0xed3e('0x15')]['toLowerCase']();this[_0xed3e('0xe')][_0x478e06[_0xed3e('0x3b')]][_0xed3e('0x3d')]=_0x478e06[_0xed3e('0x3d')];this[_0xed3e('0x22')](util[_0xed3e('0x28')](_0xed3e('0x33'),this[_0xed3e('0xe')][_0x478e06[_0xed3e('0x3b')]][_0xed3e('0x29')]),_0xed3e('0x3f'),this[_0xed3e('0xe')][_0x478e06[_0xed3e('0x3b')]]);}else if(this[_0xed3e('0xc')][_0x478e06[_0xed3e('0x3b')]]){this['trunks'][_0x478e06[_0xed3e('0x3b')]][_0xed3e('0x3e')]=_0x478e06[_0xed3e('0x15')][_0xed3e('0x2e')]();this['trunks'][_0x478e06[_0xed3e('0x3b')]]['address']=_0x478e06['address'];this[_0xed3e('0x22')](util[_0xed3e('0x28')](_0xed3e('0x34'),this[_0xed3e('0xc')][_0x478e06[_0xed3e('0x3b')]][_0xed3e('0x29')]),_0xed3e('0x2a'),this[_0xed3e('0xc')][_0x478e06[_0xed3e('0x3b')]]);}else{}}}catch(_0x1cd94d){logger[_0xed3e('0x1e')](_0xed3e('0x40'),util[_0xed3e('0x1f')](_0x1cd94d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x756a=['toNumber','startsWith','Queue','Local','indexOf','mobile','phone','accountcode','peer','registered','status','address','telephone:save','[syncPeerStatus][UserReport]','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','isNotNull','isUndefined','emit','find','stateRegistry','merge','omit','state','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','updateStatusRealtime'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x756a,0x14e));var _0xa756=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x756a[_0x541ea6];return _0x3c3e84;};'use strict';var _=require(_0xa756('0x0'));var moment=require(_0xa756('0x1'));var BPromise=require(_0xa756('0x2'));var util=require('util');var Redis=require(_0xa756('0x3'));var config=require(_0xa756('0x4'));var logger=require(_0xa756('0x5'))('ami');var ami=require('../ami');config['redis']=_[_0xa756('0x6')](config[_0xa756('0x7')],{'host':_0xa756('0x8'),'port':0x18eb});var io=require(_0xa756('0x9'))(new Redis(config[_0xa756('0x7')]));function UserReport(_0x4cfa87){this[_0xa756('0xa')]=_0x4cfa87['trunks'];this[_0xa756('0xb')]=_0x4cfa87['agents'];this[_0xa756('0xc')]=_0x4cfa87[_0xa756('0xc')];ami['on']('registryentry',this[_0xa756('0xd')][_0xa756('0xe')](this));ami['on'](_0xa756('0xf'),this[_0xa756('0xd')]['bind'](this));ami['on'](_0xa756('0x10'),this[_0xa756('0x11')][_0xa756('0xe')](this));ami['on'](_0xa756('0x12'),this[_0xa756('0x13')][_0xa756('0xe')](this));this[_0xa756('0x14')]();return BPromise[_0xa756('0x15')]()[_0xa756('0x16')](ami[_0xa756('0x17')]())[_0xa756('0x16')](ami[_0xa756('0x18')]())[_0xa756('0x16')](ami[_0xa756('0x19')]())[_0xa756('0x1a')](loggerCatch(_0xa756('0x1b')));}function loggerCatch(_0x36d668){return function(_0x30587e){logger[_0xa756('0x1c')](_0x36d668,util[_0xa756('0x1d')](_0x30587e,{'showHidden':![],'depth':null}));};}UserReport[_0xa756('0x1e')][_0xa756('0x14')]=function(){setInterval(function(){BPromise['resolve']()[_0xa756('0x16')](ami[_0xa756('0x17')]())[_0xa756('0x16')](ami[_0xa756('0x18')]())['then'](ami[_0xa756('0x19')]())['catch'](loggerCatch(_0xa756('0x1b')));},0x32c8);};UserReport[_0xa756('0x1e')][_0xa756('0x1f')]=function(_0xc3d924){return _0xc3d924!==null&&!_[_0xa756('0x20')](_0xc3d924);};UserReport[_0xa756('0x1e')][_0xa756('0x21')]=function(_0x3af063,_0xab9825,_0x555fa2){io['to'](_0x3af063)[_0xa756('0x21')](_0xab9825,_0x555fa2);};UserReport['prototype'][_0xa756('0xd')]=function(_0x18295c){try{if(this[_0xa756('0x1f')](_0x18295c)){var _0x3f9d5a=_[_0xa756('0x22')](this[_0xa756('0xa')],{'registry':_0x18295c['username']});if(_0x3f9d5a){_0x18295c[_0xa756('0x23')]=_0x18295c['state'];_[_0xa756('0x24')](_0x3f9d5a,_[_0xa756('0x25')](_0x18295c,['event','actionid','username',_0xa756('0x26')]));this[_0xa756('0x21')](util[_0xa756('0x27')](_0xa756('0x28'),_0x3f9d5a[_0xa756('0x29')]),_0xa756('0x2a'),_0x3f9d5a);}}}catch(_0x759dd4){logger[_0xa756('0x1c')](_0xa756('0x2b'),util['inspect'](_0x759dd4,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xa756('0x11')]=function(_0x4153c8){try{if(this[_0xa756('0x1f')](_0x4153c8)){if(this['agents'][_0x4153c8[_0xa756('0x2c')]]){if(!this['agents'][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x2d')]||_0x4153c8['state'][_0xa756('0x2e')]()==_0xa756('0x2f')){this['agents'][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x2d')]=![];if(this[_0xa756('0xb')][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x26')]!==_0x4153c8[_0xa756('0x26')][_0xa756('0x2e')]()){this[_0xa756('0xb')][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x30')]=_['toNumber'](moment()[_0xa756('0x27')]('x'));}this['agents'][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x26')]=_0x4153c8['state'][_0xa756('0x2e')]();this[_0xa756('0xb')][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x31')](_0x4153c8);}}else if(this['telephones'][_0x4153c8[_0xa756('0x2c')]]){if(this[_0xa756('0xc')][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x26')]!==_0x4153c8[_0xa756('0x26')][_0xa756('0x2e')]()){this[_0xa756('0xc')][_0x4153c8['device']]['stateTime']=_['toNumber'](moment()[_0xa756('0x27')]('x'));}this[_0xa756('0xc')][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x26')]=_0x4153c8[_0xa756('0x26')]['toLowerCase']();this[_0xa756('0x21')](util[_0xa756('0x27')]('telephone:%s',this[_0xa756('0xc')][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x29')]),'telephone:save',this['telephones'][_0x4153c8['device']]);}else if(this[_0xa756('0xa')][_0x4153c8[_0xa756('0x2c')]]){if(this[_0xa756('0xa')][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x26')]!==_0x4153c8[_0xa756('0x26')]['toLowerCase']()){this[_0xa756('0xa')][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x30')]=_[_0xa756('0x32')](moment()[_0xa756('0x27')]('x'));}this[_0xa756('0xa')][_0x4153c8[_0xa756('0x2c')]][_0xa756('0x26')]=_0x4153c8[_0xa756('0x26')]['toLowerCase']();this[_0xa756('0x21')](util[_0xa756('0x27')](_0xa756('0x28'),this[_0xa756('0xa')][_0x4153c8[_0xa756('0x2c')]]['name']),_0xa756('0x2a'),this['trunks'][_0x4153c8[_0xa756('0x2c')]]);}else if(_[_0xa756('0x33')](_0x4153c8['device'],_0xa756('0x34'))){}else if(_[_0xa756('0x33')](_0x4153c8['device'],_0xa756('0x35'))){var _0x2d6861=_0x4153c8[_0xa756('0x2c')];var _0x3e2019=_0x2d6861['substring'](_0x2d6861['indexOf']('/')+0x1,_0x2d6861[_0xa756('0x36')]('@'));var _0x2190b2=_[_0xa756('0x22')](this[_0xa756('0xb')],function(_0x2f1d0c){return _0x2f1d0c[_0xa756('0x37')]==_0x3e2019||_0x2f1d0c[_0xa756('0x38')]==_0x3e2019||_0x2f1d0c[_0xa756('0x39')]==_0x3e2019;});if(_0x2190b2){if(_0x2190b2['state']!==_0x4153c8[_0xa756('0x26')]['toLowerCase']()){_0x2190b2[_0xa756('0x30')]=_[_0xa756('0x32')](moment()[_0xa756('0x27')]('x'));}_0x2190b2[_0xa756('0x26')]=_0x4153c8[_0xa756('0x26')][_0xa756('0x2e')]();_0x2190b2[_0xa756('0x2d')]=!![];_0x2190b2['updateStatusRealtime'](_0x4153c8);}}else{}}}catch(_0x4309cb){logger[_0xa756('0x1c')]('[syncDeviceState][UserReport]',util[_0xa756('0x1d')](_0x4309cb,{'showHidden':![],'depth':null}));}};UserReport[_0xa756('0x1e')][_0xa756('0x13')]=function(_0x7cf301){try{if(this['isNotNull'](_0x7cf301)&&this[_0xa756('0x1f')](_0x7cf301[_0xa756('0x12')])){if(this[_0xa756('0xb')][_0x7cf301[_0xa756('0x3a')]]){if(!this[_0xa756('0xb')][_0x7cf301[_0xa756('0x3a')]][_0xa756('0x2d')]||_0x7cf301[_0xa756('0x12')][_0xa756('0x2e')]()==_0xa756('0x3b')){this[_0xa756('0xb')][_0x7cf301[_0xa756('0x3a')]][_0xa756('0x2d')]=![];this[_0xa756('0xb')][_0x7cf301[_0xa756('0x3a')]][_0xa756('0x3c')]=_0x7cf301[_0xa756('0x12')][_0xa756('0x2e')]();this[_0xa756('0xb')][_0x7cf301[_0xa756('0x3a')]][_0xa756('0x3d')]=_0x7cf301[_0xa756('0x3d')];this[_0xa756('0xb')][_0x7cf301[_0xa756('0x3a')]][_0xa756('0x31')](_0x7cf301);}}else if(this[_0xa756('0xc')][_0x7cf301[_0xa756('0x3a')]]){this[_0xa756('0xc')][_0x7cf301[_0xa756('0x3a')]][_0xa756('0x3c')]=_0x7cf301[_0xa756('0x12')][_0xa756('0x2e')]();this['telephones'][_0x7cf301['peer']][_0xa756('0x3d')]=_0x7cf301['address'];this[_0xa756('0x21')](util['format']('telephone:%s',this['telephones'][_0x7cf301[_0xa756('0x3a')]][_0xa756('0x29')]),_0xa756('0x3e'),this[_0xa756('0xc')][_0x7cf301['peer']]);}else if(this[_0xa756('0xa')][_0x7cf301['peer']]){this[_0xa756('0xa')][_0x7cf301[_0xa756('0x3a')]][_0xa756('0x3c')]=_0x7cf301[_0xa756('0x12')][_0xa756('0x2e')]();this[_0xa756('0xa')][_0x7cf301[_0xa756('0x3a')]]['address']=_0x7cf301['address'];this[_0xa756('0x21')](util['format']('trunk:%s',this[_0xa756('0xa')][_0x7cf301['peer']][_0xa756('0x29')]),'trunk:save',this[_0xa756('0xa')][_0x7cf301[_0xa756('0x3a')]]);}else{}}}catch(_0x4ddcbb){logger['error'](_0xa756('0x3f'),util[_0xa756('0x1d')](_0x4ddcbb,{'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 a40d078..6c0e61e 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 _0xa3d6=['[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','channel','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isUndefined','isNotNull','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','merge','event','privilege','custom:agentcalled','format','membername','user:called','error','hasOwnProperty','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:%s','custom:agentconnect','agentringnoanswerAt','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','reason','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','agentconnectAt','agentcompleteAt','complete','talktime','transfer','acw','agentacw','acwtime','acwTimeout','omit','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','diff','seconds','secondtransfereruniqueid'];(function(_0x38f358,_0x454d2b){var _0x88d447=function(_0x132ebb){while(--_0x132ebb){_0x38f358['push'](_0x38f358['shift']());}};_0x88d447(++_0x454d2b);}(_0xa3d6,0x7b));var _0x6a3d=function(_0x5c8d3b,_0x50e575){_0x5c8d3b=_0x5c8d3b-0x0;var _0xaccaf=_0xa3d6[_0x5c8d3b];return _0xaccaf;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x6a3d('0x0'));var Redis=require(_0x6a3d('0x1'));var config=require(_0x6a3d('0x2'));var logger=require('../../../config/logger')(_0x6a3d('0x3'));var ami=require(_0x6a3d('0x4'));config[_0x6a3d('0x5')]=_[_0x6a3d('0x6')](config['redis'],{'host':_0x6a3d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a3d('0x5')]));function VoiceAgentReport(_0x360a52){this[_0x6a3d('0x8')]={};this[_0x6a3d('0x9')]=_0x360a52['voiceQueues'];this[_0x6a3d('0xa')]=_0x360a52[_0x6a3d('0xa')];this[_0x6a3d('0xb')]={};ami['on'](_0x6a3d('0xc'),this[_0x6a3d('0xd')]['bind'](this));ami['on'](_0x6a3d('0xe'),this[_0x6a3d('0xf')][_0x6a3d('0x10')](this));ami['on'](_0x6a3d('0x11'),this[_0x6a3d('0x12')]['bind'](this));ami['on'](_0x6a3d('0x13'),this[_0x6a3d('0x14')][_0x6a3d('0x10')](this));ami['on'](_0x6a3d('0x15'),this[_0x6a3d('0x16')]['bind'](this));ami['on']('varset',this[_0x6a3d('0x17')][_0x6a3d('0x10')](this));ami['on']('hangup',this[_0x6a3d('0x18')]['bind'](this));ami['on']('musiconholdstart',this[_0x6a3d('0x19')][_0x6a3d('0x10')](this));ami['on'](_0x6a3d('0x1a'),this[_0x6a3d('0x1b')][_0x6a3d('0x10')](this));ami['on'](_0x6a3d('0x1c'),this[_0x6a3d('0x1d')]['bind'](this));ami['on'](_0x6a3d('0x1e'),this['syncBlindTransfer'][_0x6a3d('0x10')](this));}VoiceAgentReport[_0x6a3d('0x1f')]['emit']=function(_0x3ef8a3,_0x5bcc4c,_0x4bc245){io['to'](_0x3ef8a3)[_0x6a3d('0x20')](_0x5bcc4c,_0x4bc245);};VoiceAgentReport[_0x6a3d('0x1f')]['isNotNull']=function(_0x261d70){return _0x261d70!==null&&!_[_0x6a3d('0x21')](_0x261d70);};VoiceAgentReport[_0x6a3d('0x1f')][_0x6a3d('0xd')]=function(_0x34778b){try{if(this[_0x6a3d('0x22')](_0x34778b)){if(_[_0x6a3d('0x21')](this[_0x6a3d('0x8')][_0x34778b[_0x6a3d('0x23')]])){this[_0x6a3d('0x8')][_0x34778b[_0x6a3d('0x23')]]={};}if(_[_0x6a3d('0x21')](this[_0x6a3d('0x8')][_0x34778b[_0x6a3d('0x23')]][_0x34778b[_0x6a3d('0x24')]])){this[_0x6a3d('0x8')][_0x34778b['uniqueid']][_0x34778b[_0x6a3d('0x24')]]={'agentcalledAt':moment()['format'](_0x6a3d('0x25')),'lastevent':_0x6a3d('0x26'),'variables':this['variables'][_0x34778b['uniqueid']],'type':this[_0x6a3d('0x9')][_0x34778b[_0x6a3d('0x27')]]?this[_0x6a3d('0x9')][_0x34778b[_0x6a3d('0x27')]][_0x6a3d('0x28')]||'inbound':'inbound'};}_[_0x6a3d('0x29')](this[_0x6a3d('0x8')][_0x34778b['uniqueid']][_0x34778b[_0x6a3d('0x24')]],_['omit'](_0x34778b,[_0x6a3d('0x2a'),_0x6a3d('0x2b')]));ami[_0x6a3d('0x20')](_0x6a3d('0x2c'),this[_0x6a3d('0x8')][_0x34778b[_0x6a3d('0x23')]][_0x34778b[_0x6a3d('0x24')]]);this[_0x6a3d('0x20')](util[_0x6a3d('0x2d')]('user:%s',_0x34778b[_0x6a3d('0x2e')]),_0x6a3d('0x2f'),this[_0x6a3d('0x8')][_0x34778b[_0x6a3d('0x23')]][_0x34778b[_0x6a3d('0x24')]]);}}catch(_0x33ea5e){logger[_0x6a3d('0x30')]('[syncAgentCalled][VoiceAgentReport]',util['inspect'](_0x33ea5e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6a3d('0xf')]=function(_0x2687e2){try{if(this[_0x6a3d('0x22')](_0x2687e2)){if(this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]]){for(var _0xc079bf in this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]]){if(this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]][_0x6a3d('0x31')](_0xc079bf)){if(_0x2687e2[_0x6a3d('0x24')]===_0xc079bf){this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf]['agentconnectAt']=moment()['format'](_0x6a3d('0x25'));this['channels'][_0x2687e2['uniqueid']][_0xc079bf]['lastevent']=_0x6a3d('0x32');this[_0x6a3d('0x8')][_0x2687e2['uniqueid']][_0xc079bf]['holdtime']=_0x2687e2[_0x6a3d('0x33')];this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf]['connectedlinenum']=_0x2687e2[_0x6a3d('0x34')];this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf][_0x6a3d('0x35')]=_0x2687e2[_0x6a3d('0x35')];this['channels'][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf][_0x6a3d('0x36')]=_0x2687e2['destchannelstate'];this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf][_0x6a3d('0x37')]=_0x2687e2[_0x6a3d('0x37')];_[_0x6a3d('0x29')](this[_0x6a3d('0xa')][_0x2687e2[_0x6a3d('0x38')]],_[_0x6a3d('0x39')](_0x2687e2,[_0x6a3d('0x27'),_0x6a3d('0x3a')]));this[_0x6a3d('0x20')](util[_0x6a3d('0x2d')](_0x6a3d('0x3b'),_0x2687e2[_0x6a3d('0x2e')]),'user:agentconnect',this['channels'][_0x2687e2[_0x6a3d('0x23')]][_0x2687e2[_0x6a3d('0x24')]]);ami[_0x6a3d('0x20')](_0x6a3d('0x3c'),this['channels'][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf]);}else if(!this[_0x6a3d('0x8')][_0x2687e2['uniqueid']][_0xc079bf][_0x6a3d('0x11')]&&!this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf][_0x6a3d('0x15')]){this['channels'][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf]['agentringnoanswer']=!![];this['channels'][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf][_0x6a3d('0x3d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x6a3d('0x8')][_0x2687e2['uniqueid']][_0xc079bf]['reason']='answered_elsewhere';this[_0x6a3d('0x8')][_0x2687e2['uniqueid']][_0xc079bf][_0x6a3d('0x3e')]=_0x6a3d('0x3f');this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf][_0x6a3d('0x40')]=_0x2687e2[_0x6a3d('0x24')];this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf]['answeredelsewheremembername']=_0x2687e2['membername'];ami[_0x6a3d('0x20')](_0x6a3d('0x41'),this[_0x6a3d('0x8')][_0x2687e2[_0x6a3d('0x23')]][_0xc079bf]);}}}}}}catch(_0x3a336c){logger[_0x6a3d('0x30')](_0x6a3d('0x42'),util[_0x6a3d('0x43')](_0x3a336c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a3d('0x1f')][_0x6a3d('0x12')]=function(_0x268c20){try{if(this[_0x6a3d('0x22')](_0x268c20)){if(this[_0x6a3d('0x8')][_0x268c20['uniqueid']]&&this['channels'][_0x268c20[_0x6a3d('0x23')]][_0x268c20[_0x6a3d('0x24')]]){this[_0x6a3d('0x8')][_0x268c20[_0x6a3d('0x23')]][_0x268c20[_0x6a3d('0x24')]]['agentringnoanswer']=!![];this['channels'][_0x268c20[_0x6a3d('0x23')]][_0x268c20[_0x6a3d('0x24')]][_0x6a3d('0x3d')]=moment()[_0x6a3d('0x2d')](_0x6a3d('0x25'));this[_0x6a3d('0x8')][_0x268c20[_0x6a3d('0x23')]][_0x268c20[_0x6a3d('0x24')]][_0x6a3d('0x44')]=_0x6a3d('0x45');this[_0x6a3d('0x8')][_0x268c20[_0x6a3d('0x23')]][_0x268c20[_0x6a3d('0x24')]][_0x6a3d('0x3e')]='rejected';ami[_0x6a3d('0x20')]('custom:agentringnoanswer',this[_0x6a3d('0x8')][_0x268c20['uniqueid']][_0x268c20[_0x6a3d('0x24')]]);}}}catch(_0x18da2e){logger[_0x6a3d('0x30')](_0x6a3d('0x46'),util['inspect'](_0x18da2e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a3d('0x1f')][_0x6a3d('0x14')]=function(_0x44be01){try{if(this[_0x6a3d('0x22')](_0x44be01)){if(this[_0x6a3d('0x8')][_0x44be01[_0x6a3d('0x23')]]){for(var _0x39443c in this['channels'][_0x44be01['uniqueid']]){if(this['channels'][_0x44be01[_0x6a3d('0x23')]][_0x6a3d('0x31')](_0x39443c)&&!this['channels'][_0x44be01[_0x6a3d('0x23')]][_0x39443c][_0x6a3d('0x11')]&&!this[_0x6a3d('0x8')][_0x44be01['uniqueid']][_0x39443c][_0x6a3d('0x15')]){this[_0x6a3d('0x8')][_0x44be01['uniqueid']][_0x39443c]['agentringnoanswer']=!![];this[_0x6a3d('0x8')][_0x44be01[_0x6a3d('0x23')]][_0x39443c][_0x6a3d('0x3d')]=moment()[_0x6a3d('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6a3d('0x8')][_0x44be01[_0x6a3d('0x23')]][_0x39443c][_0x6a3d('0x44')]=_0x6a3d('0x47');this[_0x6a3d('0x8')][_0x44be01['uniqueid']][_0x39443c][_0x6a3d('0x3e')]=_0x6a3d('0x47');ami['emit'](_0x6a3d('0x48'),this[_0x6a3d('0x8')][_0x44be01['uniqueid']][_0x39443c]);}}}}}catch(_0xa8dd8f){logger[_0x6a3d('0x30')]('[syncQueueCallerAbandon][VoiceAgentReport]',util['inspect'](_0xa8dd8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a3d('0x1f')][_0x6a3d('0x16')]=function(_0x340c8d){try{if(this['isNotNull'](_0x340c8d)){if(this[_0x6a3d('0x8')][_0x340c8d[_0x6a3d('0x23')]]){for(var _0x4c4de1 in this['channels'][_0x340c8d[_0x6a3d('0x23')]]){if(this[_0x6a3d('0x8')][_0x340c8d[_0x6a3d('0x23')]]['hasOwnProperty'](_0x4c4de1)){if(this[_0x6a3d('0x8')][_0x340c8d[_0x6a3d('0x23')]][_0x4c4de1][_0x6a3d('0x49')]&&!this[_0x6a3d('0x8')][_0x340c8d['uniqueid']][_0x4c4de1][_0x6a3d('0x15')]){this[_0x6a3d('0x8')][_0x340c8d[_0x6a3d('0x23')]][_0x4c4de1][_0x6a3d('0x15')]=!![];this[_0x6a3d('0x8')][_0x340c8d[_0x6a3d('0x23')]][_0x4c4de1][_0x6a3d('0x4a')]=moment()[_0x6a3d('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6a3d('0x8')][_0x340c8d[_0x6a3d('0x23')]][_0x4c4de1][_0x6a3d('0x3e')]=_0x6a3d('0x4b');this['channels'][_0x340c8d[_0x6a3d('0x23')]][_0x4c4de1][_0x6a3d('0x4c')]=_0x340c8d['talktime'];this[_0x6a3d('0x8')][_0x340c8d['uniqueid']][_0x4c4de1][_0x6a3d('0x44')]=_0x340c8d[_0x6a3d('0x44')]==_0x6a3d('0x4d')?'agent':_0x340c8d[_0x6a3d('0x44')];if(this['voiceQueues'][_0x340c8d[_0x6a3d('0x27')]]&&this[_0x6a3d('0x9')][_0x340c8d[_0x6a3d('0x27')]][_0x6a3d('0x4e')]){this[_0x6a3d('0x8')][_0x340c8d[_0x6a3d('0x23')]][_0x4c4de1][_0x6a3d('0x4f')]=!![];this[_0x6a3d('0x8')][_0x340c8d[_0x6a3d('0x23')]][_0x4c4de1][_0x6a3d('0x50')]=this[_0x6a3d('0x9')][_0x340c8d[_0x6a3d('0x27')]][_0x6a3d('0x51')];}this[_0x6a3d('0xa')][_0x340c8d[_0x6a3d('0x38')]]=_[_0x6a3d('0x52')](this[_0x6a3d('0xa')][_0x340c8d[_0x6a3d('0x38')]],[_0x6a3d('0x27'),'destconnectedlinenum']);this[_0x6a3d('0x20')](util['format'](_0x6a3d('0x3b'),_0x340c8d[_0x6a3d('0x2e')]),_0x6a3d('0x53'),this[_0x6a3d('0x8')][_0x340c8d[_0x6a3d('0x23')]][_0x4c4de1]);ami[_0x6a3d('0x20')](_0x6a3d('0x54'),this['channels'][_0x340c8d[_0x6a3d('0x23')]][_0x4c4de1]);}}}}}}catch(_0x506d47){logger[_0x6a3d('0x30')](_0x6a3d('0x55'),util[_0x6a3d('0x43')](_0x506d47,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a3d('0x1f')]['syncVarSet']=function(_0x29d2ea){try{if(this[_0x6a3d('0x22')](_0x29d2ea)){this[_0x6a3d('0x56')](_0x29d2ea[_0x6a3d('0x23')],_[_0x6a3d('0x57')](_0x29d2ea[_0x6a3d('0x58')])[0x0],_0x29d2ea[_0x6a3d('0x59')]);if(this[_0x6a3d('0x8')][_0x29d2ea[_0x6a3d('0x23')]]){for(var _0x57b6a6 in this[_0x6a3d('0x8')][_0x29d2ea[_0x6a3d('0x23')]]){if(this[_0x6a3d('0x8')][_0x29d2ea[_0x6a3d('0x23')]][_0x6a3d('0x31')](_0x57b6a6)){if(_[_0x6a3d('0x21')](this[_0x6a3d('0x8')][_0x29d2ea[_0x6a3d('0x23')]][_0x57b6a6][_0x6a3d('0xb')])){this[_0x6a3d('0x8')][_0x29d2ea[_0x6a3d('0x23')]][_0x57b6a6][_0x6a3d('0xb')]={};}this[_0x6a3d('0x8')][_0x29d2ea[_0x6a3d('0x23')]][_0x57b6a6][_0x6a3d('0xb')]=this[_0x6a3d('0xb')][_0x29d2ea['uniqueid']];}}}}}catch(_0x1f1079){logger[_0x6a3d('0x30')]('[syncVarSet][VoiceAgentReport]',util[_0x6a3d('0x43')](_0x1f1079,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a3d('0x1f')][_0x6a3d('0x56')]=function(_0x193f0f,_0x25ae57,_0x18609f){var _0x2c9167=[_0x6a3d('0x5a'),'rtpaudioqosbridged',_0x6a3d('0x5b'),_0x6a3d('0x5c'),_0x6a3d('0x5d'),'rtpaudioqoslossbridged',_0x6a3d('0x5e'),_0x6a3d('0x5f'),_0x6a3d('0x60'),'sipuri',_0x6a3d('0x61'),'bridgepvtcallid',_0x6a3d('0x62'),_0x6a3d('0x63'),_0x6a3d('0x64'),_0x6a3d('0x65'),'membername',_0x6a3d('0x66'),'memberrealtime'];if(!_['isNil'](_0x25ae57)&&!_['includes'](_0x2c9167,_0x25ae57)){if(_[_0x6a3d('0x21')](this[_0x6a3d('0xb')][_0x193f0f])){this['variables'][_0x193f0f]={};}this['variables'][_0x193f0f][_0x25ae57]=_0x18609f;}};VoiceAgentReport[_0x6a3d('0x1f')][_0x6a3d('0x18')]=function(_0x585999){try{if(this[_0x6a3d('0x22')](_0x585999)){if(this[_0x6a3d('0x8')][_0x585999[_0x6a3d('0x23')]]){for(var _0x1d0aae in this[_0x6a3d('0x8')][_0x585999[_0x6a3d('0x23')]]){if(this[_0x6a3d('0x8')][_0x585999[_0x6a3d('0x23')]]['hasOwnProperty'](_0x1d0aae)){if(this[_0x6a3d('0x8')][_0x585999['uniqueid']][_0x1d0aae][_0x6a3d('0x44')]==_0x6a3d('0x4d')&&this[_0x6a3d('0x8')][_0x585999[_0x6a3d('0x23')]][_0x1d0aae][_0x6a3d('0x15')]){this[_0x6a3d('0x8')][_0x585999[_0x6a3d('0x23')]][_0x1d0aae]['agentcompleteAt']=moment()[_0x6a3d('0x2d')](_0x6a3d('0x25'));}}}ami[_0x6a3d('0x20')]('custom:voiceAgentReport',_[_0x6a3d('0x67')](this[_0x6a3d('0x8')][_0x585999['uniqueid']]));delete this[_0x6a3d('0x8')][_0x585999['uniqueid']];}if(this[_0x6a3d('0xb')][_0x585999[_0x6a3d('0x23')]]){delete this[_0x6a3d('0xb')][_0x585999[_0x6a3d('0x23')]];}}}catch(_0x4f3bdb){logger[_0x6a3d('0x30')](_0x6a3d('0x68'),util['inspect'](_0x4f3bdb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a3d('0x1f')][_0x6a3d('0x1d')]=function(_0x5842a3){try{if(this[_0x6a3d('0x22')](_0x5842a3)){if(this['channels'][_0x5842a3['transfereeuniqueid']]){for(var _0x254ac1 in this[_0x6a3d('0x8')][_0x5842a3['transfereeuniqueid']]){if(this[_0x6a3d('0x8')][_0x5842a3['transfereeuniqueid']][_0x6a3d('0x31')](_0x254ac1)){if(_0x5842a3['origtransfereruniqueid']===_0x254ac1){var _0x599183=moment();this[_0x6a3d('0x8')][_0x5842a3[_0x6a3d('0x69')]][_0x254ac1][_0x6a3d('0x15')]=!![];this[_0x6a3d('0x8')][_0x5842a3['transfereeuniqueid']][_0x254ac1][_0x6a3d('0x4a')]=moment()[_0x6a3d('0x2d')](_0x6a3d('0x25'));this[_0x6a3d('0x8')][_0x5842a3[_0x6a3d('0x69')]][_0x254ac1]['reason']=_0x6a3d('0x4d');this[_0x6a3d('0x8')][_0x5842a3[_0x6a3d('0x69')]][_0x254ac1][_0x6a3d('0x3e')]=_0x6a3d('0x4b');this[_0x6a3d('0x8')][_0x5842a3[_0x6a3d('0x69')]][_0x254ac1]['talktime']=_0x599183[_0x6a3d('0x6a')](this[_0x6a3d('0x8')][_0x5842a3[_0x6a3d('0x69')]][_0x254ac1]['agentconnectAt'],_0x6a3d('0x6b'));}}}}if(this[_0x6a3d('0x8')][_0x5842a3[_0x6a3d('0x6c')]]){var _0x3a38bc=this[_0x6a3d('0x8')][_0x5842a3[_0x6a3d('0x6c')]];this['channels'][_0x5842a3[_0x6a3d('0x6c')]]=this['channels'][_0x5842a3[_0x6a3d('0x69')]];this[_0x6a3d('0x8')][_0x5842a3[_0x6a3d('0x69')]]=_0x3a38bc;}}}catch(_0x340233){logger[_0x6a3d('0x30')](_0x6a3d('0x6d'),util[_0x6a3d('0x43')](_0x340233,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a3d('0x1f')][_0x6a3d('0x6e')]=function(_0x37c5f8){try{if(this[_0x6a3d('0x22')](_0x37c5f8)){if(this[_0x6a3d('0x8')][_0x37c5f8[_0x6a3d('0x69')]]){for(var _0x1ef256 in this[_0x6a3d('0x8')][_0x37c5f8[_0x6a3d('0x69')]]){if(this[_0x6a3d('0x8')][_0x37c5f8[_0x6a3d('0x69')]][_0x6a3d('0x31')](_0x1ef256)){if(_0x37c5f8[_0x6a3d('0x6f')]===_0x1ef256){var _0x11af9e=moment();this['channels'][_0x37c5f8[_0x6a3d('0x69')]][_0x1ef256][_0x6a3d('0x15')]=!![];this['channels'][_0x37c5f8[_0x6a3d('0x69')]][_0x1ef256][_0x6a3d('0x4a')]=_0x11af9e;this['channels'][_0x37c5f8[_0x6a3d('0x69')]][_0x1ef256][_0x6a3d('0x44')]=_0x6a3d('0x4d');this['channels'][_0x37c5f8['transfereeuniqueid']][_0x1ef256][_0x6a3d('0x3e')]=_0x6a3d('0x4b');this[_0x6a3d('0x8')][_0x37c5f8[_0x6a3d('0x69')]][_0x1ef256]['talktime']=_0x11af9e[_0x6a3d('0x6a')](this[_0x6a3d('0x8')][_0x37c5f8[_0x6a3d('0x69')]][_0x1ef256]['agentconnectAt'],'seconds');}}}}}}catch(_0x8be740){logger[_0x6a3d('0x30')]('[syncBlindTransfer][VoiceAgentReport]',util[_0x6a3d('0x43')](_0x8be740,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a3d('0x1f')][_0x6a3d('0x19')]=function(_0x1c84a6){var _0x168214='';try{if(this[_0x6a3d('0x22')](_0x1c84a6)){if(_0x1c84a6[_0x6a3d('0x70')]){_0x168214=_0x1c84a6[_0x6a3d('0x70')]['substring'](0x0,_0x1c84a6[_0x6a3d('0x70')][_0x6a3d('0x71')]('-'));if(this[_0x6a3d('0xa')][_0x168214]){this[_0x6a3d('0xa')][_0x168214][_0x6a3d('0x72')]=!![];}}}}catch(_0x51ce4a){logger[_0x6a3d('0x30')](_0x6a3d('0x73'),util['inspect'](_0x51ce4a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a3d('0x1f')][_0x6a3d('0x1b')]=function(_0x378e45){var _0x3f6d33='';try{if(this[_0x6a3d('0x22')](_0x378e45)){if(_0x378e45['channel']){_0x3f6d33=_0x378e45[_0x6a3d('0x70')]['substring'](0x0,_0x378e45[_0x6a3d('0x70')][_0x6a3d('0x71')]('-'));if(this[_0x6a3d('0xa')][_0x3f6d33]){this[_0x6a3d('0xa')][_0x3f6d33][_0x6a3d('0x72')]=![];}}}}catch(_0x2afb66){logger[_0x6a3d('0x30')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x6a3d('0x43')](_0x2afb66,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xeb3b=['agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStop','blindtransfer','prototype','emit','isNotNull','isUndefined','channels','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','privilege','custom:agentcalled','user:%s','membername','user:called','error','inspect','hasOwnProperty','lastevent','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','merge','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','reason','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentconnectAt','agentcompleteAt','complete','talktime','transfer','agent','acw','acwTimeout','omit','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','variable','[syncVarSet][VoiceAgentReport]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','membercalls','memberdynamic','memberlastcall','memberpenalty','isNil','includes','values','syncAttendedTransfer','transfereeuniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','syncMusicOnHoldStart','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','voiceQueues'];(function(_0x434007,_0x5356cd){var _0x17ab31=function(_0x280b5c){while(--_0x280b5c){_0x434007['push'](_0x434007['shift']());}};_0x17ab31(++_0x5356cd);}(_0xeb3b,0x15a));var _0xbeb3=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xeb3b[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xbeb3('0x0'));var moment=require(_0xbeb3('0x1'));var util=require(_0xbeb3('0x2'));var Redis=require('ioredis');var config=require(_0xbeb3('0x3'));var logger=require(_0xbeb3('0x4'))(_0xbeb3('0x5'));var ami=require(_0xbeb3('0x6'));config[_0xbeb3('0x7')]=_[_0xbeb3('0x8')](config[_0xbeb3('0x7')],{'host':_0xbeb3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbeb3('0x7')]));function VoiceAgentReport(_0x4cc117){this['channels']={};this[_0xbeb3('0xa')]=_0x4cc117[_0xbeb3('0xa')];this[_0xbeb3('0xb')]=_0x4cc117['agents'];this[_0xbeb3('0xc')]={};ami['on'](_0xbeb3('0xd'),this[_0xbeb3('0xe')][_0xbeb3('0xf')](this));ami['on']('agentconnect',this[_0xbeb3('0x10')][_0xbeb3('0xf')](this));ami['on'](_0xbeb3('0x11'),this[_0xbeb3('0x12')]['bind'](this));ami['on'](_0xbeb3('0x13'),this[_0xbeb3('0x14')][_0xbeb3('0xf')](this));ami['on'](_0xbeb3('0x15'),this[_0xbeb3('0x16')][_0xbeb3('0xf')](this));ami['on'](_0xbeb3('0x17'),this['syncVarSet'][_0xbeb3('0xf')](this));ami['on'](_0xbeb3('0x18'),this[_0xbeb3('0x19')][_0xbeb3('0xf')](this));ami['on'](_0xbeb3('0x1a'),this['syncMusicOnHoldStart'][_0xbeb3('0xf')](this));ami['on']('musiconholdstop',this[_0xbeb3('0x1b')][_0xbeb3('0xf')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xbeb3('0xf')](this));ami['on'](_0xbeb3('0x1c'),this['syncBlindTransfer'][_0xbeb3('0xf')](this));}VoiceAgentReport[_0xbeb3('0x1d')][_0xbeb3('0x1e')]=function(_0x562d11,_0x4ee006,_0x1e2ca8){io['to'](_0x562d11)[_0xbeb3('0x1e')](_0x4ee006,_0x1e2ca8);};VoiceAgentReport[_0xbeb3('0x1d')][_0xbeb3('0x1f')]=function(_0x1e498f){return _0x1e498f!==null&&!_['isUndefined'](_0x1e498f);};VoiceAgentReport[_0xbeb3('0x1d')][_0xbeb3('0xe')]=function(_0x5cd021){try{if(this['isNotNull'](_0x5cd021)){if(_[_0xbeb3('0x20')](this[_0xbeb3('0x21')][_0x5cd021['uniqueid']])){this[_0xbeb3('0x21')][_0x5cd021[_0xbeb3('0x22')]]={};}if(_[_0xbeb3('0x20')](this[_0xbeb3('0x21')][_0x5cd021['uniqueid']][_0x5cd021['destuniqueid']])){this['channels'][_0x5cd021[_0xbeb3('0x22')]][_0x5cd021[_0xbeb3('0x23')]]={'agentcalledAt':moment()[_0xbeb3('0x24')](_0xbeb3('0x25')),'lastevent':_0xbeb3('0x26'),'variables':this[_0xbeb3('0xc')][_0x5cd021[_0xbeb3('0x22')]],'type':this[_0xbeb3('0xa')][_0x5cd021[_0xbeb3('0x27')]]?this[_0xbeb3('0xa')][_0x5cd021[_0xbeb3('0x27')]][_0xbeb3('0x28')]||_0xbeb3('0x29'):_0xbeb3('0x29')};}_['merge'](this[_0xbeb3('0x21')][_0x5cd021[_0xbeb3('0x22')]][_0x5cd021[_0xbeb3('0x23')]],_['omit'](_0x5cd021,['event',_0xbeb3('0x2a')]));ami[_0xbeb3('0x1e')](_0xbeb3('0x2b'),this[_0xbeb3('0x21')][_0x5cd021[_0xbeb3('0x22')]][_0x5cd021[_0xbeb3('0x23')]]);this[_0xbeb3('0x1e')](util[_0xbeb3('0x24')](_0xbeb3('0x2c'),_0x5cd021[_0xbeb3('0x2d')]),_0xbeb3('0x2e'),this[_0xbeb3('0x21')][_0x5cd021[_0xbeb3('0x22')]][_0x5cd021[_0xbeb3('0x23')]]);}}catch(_0x78ab26){logger[_0xbeb3('0x2f')]('[syncAgentCalled][VoiceAgentReport]',util[_0xbeb3('0x30')](_0x78ab26,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbeb3('0x1d')][_0xbeb3('0x10')]=function(_0x10651a){try{if(this[_0xbeb3('0x1f')](_0x10651a)){if(this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]]){for(var _0x32fab7 in this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]]){if(this[_0xbeb3('0x21')][_0x10651a['uniqueid']][_0xbeb3('0x31')](_0x32fab7)){if(_0x10651a[_0xbeb3('0x23')]===_0x32fab7){this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7]['agentconnectAt']=moment()[_0xbeb3('0x24')](_0xbeb3('0x25'));this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7][_0xbeb3('0x32')]='connect';this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7][_0xbeb3('0x33')]=_0x10651a['holdtime'];this['channels'][_0x10651a['uniqueid']][_0x32fab7][_0xbeb3('0x34')]=_0x10651a[_0xbeb3('0x34')];this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7][_0xbeb3('0x35')]=_0x10651a['connectedlinename'];this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7]['destchannelstate']=_0x10651a[_0xbeb3('0x36')];this[_0xbeb3('0x21')][_0x10651a['uniqueid']][_0x32fab7][_0xbeb3('0x37')]=_0x10651a[_0xbeb3('0x37')];_[_0xbeb3('0x38')](this[_0xbeb3('0xb')][_0x10651a[_0xbeb3('0x39')]],_[_0xbeb3('0x3a')](_0x10651a,[_0xbeb3('0x27'),_0xbeb3('0x3b')]));this[_0xbeb3('0x1e')](util[_0xbeb3('0x24')](_0xbeb3('0x2c'),_0x10651a[_0xbeb3('0x2d')]),_0xbeb3('0x3c'),this[_0xbeb3('0x21')][_0x10651a['uniqueid']][_0x10651a[_0xbeb3('0x23')]]);ami[_0xbeb3('0x1e')](_0xbeb3('0x3d'),this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7]);}else if(!this[_0xbeb3('0x21')][_0x10651a['uniqueid']][_0x32fab7][_0xbeb3('0x11')]&&!this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7][_0xbeb3('0x15')]){this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7][_0xbeb3('0x11')]=!![];this['channels'][_0x10651a['uniqueid']][_0x32fab7][_0xbeb3('0x3e')]=moment()[_0xbeb3('0x24')](_0xbeb3('0x25'));this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7]['reason']=_0xbeb3('0x3f');this[_0xbeb3('0x21')][_0x10651a['uniqueid']][_0x32fab7][_0xbeb3('0x32')]='answered_elsewhere';this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7][_0xbeb3('0x40')]=_0x10651a[_0xbeb3('0x23')];this[_0xbeb3('0x21')][_0x10651a[_0xbeb3('0x22')]][_0x32fab7]['answeredelsewheremembername']=_0x10651a['membername'];ami[_0xbeb3('0x1e')](_0xbeb3('0x41'),this[_0xbeb3('0x21')][_0x10651a['uniqueid']][_0x32fab7]);}}}}}}catch(_0x57f4e7){logger[_0xbeb3('0x2f')](_0xbeb3('0x42'),util['inspect'](_0x57f4e7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbeb3('0x1d')]['syncAgentRingNoAnswer']=function(_0x38d354){try{if(this[_0xbeb3('0x1f')](_0x38d354)){if(this[_0xbeb3('0x21')][_0x38d354[_0xbeb3('0x22')]]&&this['channels'][_0x38d354[_0xbeb3('0x22')]][_0x38d354[_0xbeb3('0x23')]]){this['channels'][_0x38d354[_0xbeb3('0x22')]][_0x38d354[_0xbeb3('0x23')]][_0xbeb3('0x11')]=!![];this[_0xbeb3('0x21')][_0x38d354[_0xbeb3('0x22')]][_0x38d354['destuniqueid']]['agentringnoanswerAt']=moment()[_0xbeb3('0x24')](_0xbeb3('0x25'));this[_0xbeb3('0x21')][_0x38d354[_0xbeb3('0x22')]][_0x38d354[_0xbeb3('0x23')]][_0xbeb3('0x43')]=_0xbeb3('0x44');this[_0xbeb3('0x21')][_0x38d354[_0xbeb3('0x22')]][_0x38d354[_0xbeb3('0x23')]][_0xbeb3('0x32')]=_0xbeb3('0x44');ami[_0xbeb3('0x1e')]('custom:agentringnoanswer',this['channels'][_0x38d354['uniqueid']][_0x38d354[_0xbeb3('0x23')]]);}}}catch(_0x4602ed){logger[_0xbeb3('0x2f')](_0xbeb3('0x45'),util['inspect'](_0x4602ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbeb3('0x1d')][_0xbeb3('0x14')]=function(_0xa8f9dc){try{if(this[_0xbeb3('0x1f')](_0xa8f9dc)){if(this[_0xbeb3('0x21')][_0xa8f9dc[_0xbeb3('0x22')]]){for(var _0x1f83b0 in this[_0xbeb3('0x21')][_0xa8f9dc[_0xbeb3('0x22')]]){if(this[_0xbeb3('0x21')][_0xa8f9dc[_0xbeb3('0x22')]]['hasOwnProperty'](_0x1f83b0)&&!this[_0xbeb3('0x21')][_0xa8f9dc['uniqueid']][_0x1f83b0][_0xbeb3('0x11')]&&!this['channels'][_0xa8f9dc[_0xbeb3('0x22')]][_0x1f83b0][_0xbeb3('0x15')]){this['channels'][_0xa8f9dc[_0xbeb3('0x22')]][_0x1f83b0]['agentringnoanswer']=!![];this[_0xbeb3('0x21')][_0xa8f9dc[_0xbeb3('0x22')]][_0x1f83b0][_0xbeb3('0x3e')]=moment()['format'](_0xbeb3('0x25'));this[_0xbeb3('0x21')][_0xa8f9dc[_0xbeb3('0x22')]][_0x1f83b0][_0xbeb3('0x43')]=_0xbeb3('0x46');this[_0xbeb3('0x21')][_0xa8f9dc[_0xbeb3('0x22')]][_0x1f83b0][_0xbeb3('0x32')]=_0xbeb3('0x46');ami['emit'](_0xbeb3('0x47'),this['channels'][_0xa8f9dc[_0xbeb3('0x22')]][_0x1f83b0]);}}}}}catch(_0x2dea33){logger[_0xbeb3('0x2f')](_0xbeb3('0x48'),util[_0xbeb3('0x30')](_0x2dea33,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbeb3('0x16')]=function(_0x16cefd){try{if(this['isNotNull'](_0x16cefd)){if(this['channels'][_0x16cefd[_0xbeb3('0x22')]]){for(var _0x3e3857 in this[_0xbeb3('0x21')][_0x16cefd[_0xbeb3('0x22')]]){if(this[_0xbeb3('0x21')][_0x16cefd['uniqueid']][_0xbeb3('0x31')](_0x3e3857)){if(this['channels'][_0x16cefd[_0xbeb3('0x22')]][_0x3e3857][_0xbeb3('0x49')]&&!this['channels'][_0x16cefd[_0xbeb3('0x22')]][_0x3e3857][_0xbeb3('0x15')]){this[_0xbeb3('0x21')][_0x16cefd[_0xbeb3('0x22')]][_0x3e3857][_0xbeb3('0x15')]=!![];this[_0xbeb3('0x21')][_0x16cefd[_0xbeb3('0x22')]][_0x3e3857][_0xbeb3('0x4a')]=moment()['format'](_0xbeb3('0x25'));this[_0xbeb3('0x21')][_0x16cefd[_0xbeb3('0x22')]][_0x3e3857][_0xbeb3('0x32')]=_0xbeb3('0x4b');this['channels'][_0x16cefd[_0xbeb3('0x22')]][_0x3e3857][_0xbeb3('0x4c')]=_0x16cefd[_0xbeb3('0x4c')];this[_0xbeb3('0x21')][_0x16cefd[_0xbeb3('0x22')]][_0x3e3857][_0xbeb3('0x43')]=_0x16cefd[_0xbeb3('0x43')]==_0xbeb3('0x4d')?_0xbeb3('0x4e'):_0x16cefd['reason'];if(this[_0xbeb3('0xa')][_0x16cefd['queue']]&&this[_0xbeb3('0xa')][_0x16cefd[_0xbeb3('0x27')]][_0xbeb3('0x4f')]){this['channels'][_0x16cefd[_0xbeb3('0x22')]][_0x3e3857]['agentacw']=!![];this['channels'][_0x16cefd[_0xbeb3('0x22')]][_0x3e3857]['acwtime']=this['voiceQueues'][_0x16cefd[_0xbeb3('0x27')]][_0xbeb3('0x50')];}this[_0xbeb3('0xb')][_0x16cefd[_0xbeb3('0x39')]]=_[_0xbeb3('0x51')](this[_0xbeb3('0xb')][_0x16cefd['interface']],[_0xbeb3('0x27'),'destconnectedlinenum']);this[_0xbeb3('0x1e')](util[_0xbeb3('0x24')](_0xbeb3('0x2c'),_0x16cefd['membername']),'user:agentcomplete',this[_0xbeb3('0x21')][_0x16cefd['uniqueid']][_0x3e3857]);ami['emit'](_0xbeb3('0x52'),this[_0xbeb3('0x21')][_0x16cefd[_0xbeb3('0x22')]][_0x3e3857]);}}}}}}catch(_0x5ded8f){logger[_0xbeb3('0x2f')](_0xbeb3('0x53'),util[_0xbeb3('0x30')](_0x5ded8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbeb3('0x54')]=function(_0x230894){try{if(this['isNotNull'](_0x230894)){this[_0xbeb3('0x55')](_0x230894[_0xbeb3('0x22')],_[_0xbeb3('0x56')](_0x230894[_0xbeb3('0x57')])[0x0],_0x230894['value']);if(this[_0xbeb3('0x21')][_0x230894[_0xbeb3('0x22')]]){for(var _0x49e6ad in this[_0xbeb3('0x21')][_0x230894['uniqueid']]){if(this['channels'][_0x230894['uniqueid']][_0xbeb3('0x31')](_0x49e6ad)){if(_[_0xbeb3('0x20')](this[_0xbeb3('0x21')][_0x230894['uniqueid']][_0x49e6ad][_0xbeb3('0xc')])){this[_0xbeb3('0x21')][_0x230894[_0xbeb3('0x22')]][_0x49e6ad]['variables']={};}this[_0xbeb3('0x21')][_0x230894['uniqueid']][_0x49e6ad][_0xbeb3('0xc')]=this[_0xbeb3('0xc')][_0x230894[_0xbeb3('0x22')]];}}}}}catch(_0x530c98){logger[_0xbeb3('0x2f')](_0xbeb3('0x58'),util[_0xbeb3('0x30')](_0x530c98,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbeb3('0x1d')][_0xbeb3('0x55')]=function(_0x26d598,_0x41784d,_0x3529f0){var _0x3934c0=['rtpaudioqos','rtpaudioqosbridged',_0xbeb3('0x59'),_0xbeb3('0x5a'),'rtpaudioqosloss',_0xbeb3('0x5b'),_0xbeb3('0x5c'),_0xbeb3('0x5d'),'sipcallid',_0xbeb3('0x5e'),'bridgepeer','bridgepvtcallid',_0xbeb3('0x5f'),_0xbeb3('0x60'),'memberinterface',_0xbeb3('0x61'),_0xbeb3('0x2d'),_0xbeb3('0x62'),'memberrealtime'];if(!_[_0xbeb3('0x63')](_0x41784d)&&!_[_0xbeb3('0x64')](_0x3934c0,_0x41784d)){if(_['isUndefined'](this['variables'][_0x26d598])){this[_0xbeb3('0xc')][_0x26d598]={};}this['variables'][_0x26d598][_0x41784d]=_0x3529f0;}};VoiceAgentReport['prototype'][_0xbeb3('0x19')]=function(_0x2c1839){try{if(this[_0xbeb3('0x1f')](_0x2c1839)){if(this[_0xbeb3('0x21')][_0x2c1839['uniqueid']]){for(var _0x4f74da in this[_0xbeb3('0x21')][_0x2c1839[_0xbeb3('0x22')]]){if(this[_0xbeb3('0x21')][_0x2c1839[_0xbeb3('0x22')]]['hasOwnProperty'](_0x4f74da)){if(this[_0xbeb3('0x21')][_0x2c1839[_0xbeb3('0x22')]][_0x4f74da]['reason']==_0xbeb3('0x4d')&&this[_0xbeb3('0x21')][_0x2c1839['uniqueid']][_0x4f74da][_0xbeb3('0x15')]){this['channels'][_0x2c1839[_0xbeb3('0x22')]][_0x4f74da][_0xbeb3('0x4a')]=moment()['format'](_0xbeb3('0x25'));}}}ami[_0xbeb3('0x1e')]('custom:voiceAgentReport',_[_0xbeb3('0x65')](this['channels'][_0x2c1839['uniqueid']]));delete this[_0xbeb3('0x21')][_0x2c1839[_0xbeb3('0x22')]];}if(this['variables'][_0x2c1839[_0xbeb3('0x22')]]){delete this[_0xbeb3('0xc')][_0x2c1839[_0xbeb3('0x22')]];}}}catch(_0x2f94ab){logger[_0xbeb3('0x2f')]('[syncHangup][VoiceAgentReport]',util[_0xbeb3('0x30')](_0x2f94ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbeb3('0x1d')][_0xbeb3('0x66')]=function(_0x4155f3){try{if(this[_0xbeb3('0x1f')](_0x4155f3)){if(this[_0xbeb3('0x21')][_0x4155f3[_0xbeb3('0x67')]]){for(var _0x28afc0 in this['channels'][_0x4155f3[_0xbeb3('0x67')]]){if(this[_0xbeb3('0x21')][_0x4155f3[_0xbeb3('0x67')]][_0xbeb3('0x31')](_0x28afc0)){if(_0x4155f3['origtransfereruniqueid']===_0x28afc0){var _0x98bd89=moment();this[_0xbeb3('0x21')][_0x4155f3[_0xbeb3('0x67')]][_0x28afc0][_0xbeb3('0x15')]=!![];this[_0xbeb3('0x21')][_0x4155f3['transfereeuniqueid']][_0x28afc0][_0xbeb3('0x4a')]=moment()[_0xbeb3('0x24')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbeb3('0x21')][_0x4155f3[_0xbeb3('0x67')]][_0x28afc0][_0xbeb3('0x43')]='transfer';this[_0xbeb3('0x21')][_0x4155f3[_0xbeb3('0x67')]][_0x28afc0][_0xbeb3('0x32')]=_0xbeb3('0x4b');this[_0xbeb3('0x21')][_0x4155f3[_0xbeb3('0x67')]][_0x28afc0][_0xbeb3('0x4c')]=_0x98bd89[_0xbeb3('0x68')](this[_0xbeb3('0x21')][_0x4155f3[_0xbeb3('0x67')]][_0x28afc0][_0xbeb3('0x49')],_0xbeb3('0x69'));}}}}if(this['channels'][_0x4155f3[_0xbeb3('0x6a')]]){var _0x4bf60a=this[_0xbeb3('0x21')][_0x4155f3[_0xbeb3('0x6a')]];this['channels'][_0x4155f3[_0xbeb3('0x6a')]]=this[_0xbeb3('0x21')][_0x4155f3[_0xbeb3('0x67')]];this['channels'][_0x4155f3[_0xbeb3('0x67')]]=_0x4bf60a;}}}catch(_0x2ec96a){logger['error'](_0xbeb3('0x6b'),util[_0xbeb3('0x30')](_0x2ec96a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbeb3('0x1d')][_0xbeb3('0x6c')]=function(_0x568152){try{if(this[_0xbeb3('0x1f')](_0x568152)){if(this['channels'][_0x568152[_0xbeb3('0x67')]]){for(var _0x42493f in this[_0xbeb3('0x21')][_0x568152['transfereeuniqueid']]){if(this['channels'][_0x568152['transfereeuniqueid']][_0xbeb3('0x31')](_0x42493f)){if(_0x568152[_0xbeb3('0x6d')]===_0x42493f){var _0xcf2d80=moment();this['channels'][_0x568152[_0xbeb3('0x67')]][_0x42493f][_0xbeb3('0x15')]=!![];this[_0xbeb3('0x21')][_0x568152[_0xbeb3('0x67')]][_0x42493f][_0xbeb3('0x4a')]=_0xcf2d80;this['channels'][_0x568152[_0xbeb3('0x67')]][_0x42493f][_0xbeb3('0x43')]='transfer';this[_0xbeb3('0x21')][_0x568152[_0xbeb3('0x67')]][_0x42493f]['lastevent']=_0xbeb3('0x4b');this['channels'][_0x568152['transfereeuniqueid']][_0x42493f][_0xbeb3('0x4c')]=_0xcf2d80[_0xbeb3('0x68')](this['channels'][_0x568152[_0xbeb3('0x67')]][_0x42493f][_0xbeb3('0x49')],_0xbeb3('0x69'));}}}}}}catch(_0x1784fd){logger[_0xbeb3('0x2f')](_0xbeb3('0x6e'),util['inspect'](_0x1784fd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbeb3('0x1d')][_0xbeb3('0x6f')]=function(_0x346c64){var _0x46fa49='';try{if(this[_0xbeb3('0x1f')](_0x346c64)){if(_0x346c64[_0xbeb3('0x70')]){_0x46fa49=_0x346c64[_0xbeb3('0x70')][_0xbeb3('0x71')](0x0,_0x346c64['channel'][_0xbeb3('0x72')]('-'));if(this[_0xbeb3('0xb')][_0x46fa49]){this['agents'][_0x46fa49][_0xbeb3('0x73')]=!![];}}}}catch(_0x6167e3){logger['error'](_0xbeb3('0x74'),util['inspect'](_0x6167e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbeb3('0x1d')][_0xbeb3('0x1b')]=function(_0x2d0d5f){var _0x306bb2='';try{if(this[_0xbeb3('0x1f')](_0x2d0d5f)){if(_0x2d0d5f[_0xbeb3('0x70')]){_0x306bb2=_0x2d0d5f[_0xbeb3('0x70')][_0xbeb3('0x71')](0x0,_0x2d0d5f[_0xbeb3('0x70')][_0xbeb3('0x72')]('-'));if(this['agents'][_0x306bb2]){this[_0xbeb3('0xb')][_0x306bb2][_0xbeb3('0x73')]=![];}}}}catch(_0x141415){logger['error'](_0xbeb3('0x75'),util[_0xbeb3('0x30')](_0x141415,{'showHidden':![],'depth':null}));}};module[_0xbeb3('0x76')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 6765a20..b724c0e 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 _0x8958=['mohstarttime','[syncMusicOnHoldStop][VoiceCallReport]','exports','lodash','../../../config/environment','ami','../ami','../model/channel','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','resolve','then','actionCoreShowChannels','catch','log','prototype','isNotNull','emit','uniqueid','linkedid','isUndefined','pick','keys','[syncNewCallerId][VoiceCallReport]','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','from-sip','split','exten','name','user:agentconnect','accountcode','error','inspect','appdata','applicationdata','starttime','duration','seconds','merge','includes','application','startsWith','cdr(','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','calleridname','destinationchannel','toNumber','UserId','membername','syncMixMonitorFilename','monitor','.wav49','replace','.WAV','find','monitors','isNil','variable','mixmonitor_filename','xmd-callerid','callerid','value','xmd-cdrtype','type','xmd-queue','originatecalleridnum','destination','calleridpreview','xmcs-queue','sipcalluniqueid','sipcallid','syncHangup','endtime','answertime','billableseconds','context','omit','user:%s','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohtime','milliseconds'];(function(_0x43ec25,_0x22baa9){var _0x23fe70=function(_0x171e6a){while(--_0x171e6a){_0x43ec25['push'](_0x43ec25['shift']());}};_0x23fe70(++_0x22baa9);}(_0x8958,0x93));var _0x8895=function(_0x21a60e,_0x57a2eb){_0x21a60e=_0x21a60e-0x0;var _0x4ad1f3=_0x8958[_0x21a60e];return _0x4ad1f3;};'use strict';var BPromise=require('bluebird');var _=require(_0x8895('0x0'));var moment=require('moment');var util=require('util');var path=require('path');var Redis=require('ioredis');var config=require(_0x8895('0x1'));var logger=require('../../../config/logger')(_0x8895('0x2'));var ami=require(_0x8895('0x3'));var Channel=require(_0x8895('0x4'));var statusDesc=['unknown',_0x8895('0x5'),_0x8895('0x6'),_0x8895('0x7'),_0x8895('0x8'),_0x8895('0x9'),'ringing',_0x8895('0xa'),_0x8895('0xb')];var applications=[_0x8895('0xc'),_0x8895('0xd'),_0x8895('0xe'),_0x8895('0xf'),_0x8895('0x10'),_0x8895('0x11')];var dispositions=[_0x8895('0x12'),_0x8895('0x13'),'FAILED',_0x8895('0x12'),_0x8895('0x12'),_0x8895('0x12'),_0x8895('0x14'),_0x8895('0x15'),_0x8895('0x13'),'FAILED',_0x8895('0x13')];var actions={};config[_0x8895('0x16')]=_[_0x8895('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8895('0x18'))(new Redis(config['redis']));function VoiceCallReport(_0x4156f5){this[_0x8895('0x19')]=_0x4156f5[_0x8895('0x19')];this[_0x8895('0x1a')]=_0x4156f5[_0x8895('0x1a')];ami['on']('coreshowchannel',this[_0x8895('0x1b')][_0x8895('0x1c')](this));ami['on'](_0x8895('0x1d'),this[_0x8895('0x1b')][_0x8895('0x1c')](this));ami['on'](_0x8895('0x1e'),this[_0x8895('0x1f')][_0x8895('0x1c')](this));ami['on'](_0x8895('0x20'),this[_0x8895('0x21')][_0x8895('0x1c')](this));ami['on'](_0x8895('0x22'),this[_0x8895('0x23')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x8895('0x1c')](this));ami['on'](_0x8895('0x24'),this[_0x8895('0x25')][_0x8895('0x1c')](this));ami['on'](_0x8895('0x26'),this[_0x8895('0x27')][_0x8895('0x1c')](this));ami['on'](_0x8895('0x28'),this['syncBlindTransfer'][_0x8895('0x1c')](this));ami['on'](_0x8895('0x29'),this[_0x8895('0x2a')][_0x8895('0x1c')](this));ami['on'](_0x8895('0x2b'),this['syncMusicOnHoldStop']['bind'](this));return BPromise[_0x8895('0x2c')]()[_0x8895('0x2d')](ami[_0x8895('0x2e')]())[_0x8895('0x2f')](function(_0x4fc150){console[_0x8895('0x30')](_0x4fc150);});}VoiceCallReport[_0x8895('0x31')][_0x8895('0x32')]=function(_0x5486a6){return _0x5486a6!==null&&!_['isUndefined'](_0x5486a6);};VoiceCallReport[_0x8895('0x31')]['emit']=function(_0x3d51b0,_0x3e3b48,_0x10b48f){io['to'](_0x3d51b0)[_0x8895('0x33')](_0x3e3b48,_0x10b48f);};VoiceCallReport[_0x8895('0x31')]['syncNewCallerId']=function(_0x4d567a){try{if(this[_0x8895('0x32')](_0x4d567a)){if(_0x4d567a[_0x8895('0x34')]===_0x4d567a[_0x8895('0x35')]){if(!_[_0x8895('0x36')](this[_0x8895('0x19')][_0x4d567a['uniqueid']])){_['merge'](this[_0x8895('0x19')][_0x4d567a[_0x8895('0x34')]],_[_0x8895('0x37')](_0x4d567a,_[_0x8895('0x38')](this[_0x8895('0x19')][_0x4d567a['uniqueid']])));}}}}catch(_0x1da939){logger['error'](_0x8895('0x39'),util['inspect'](_0x1da939,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8895('0x31')][_0x8895('0x1f')]=function(_0x233473){try{if(this[_0x8895('0x32')](_0x233473)){if(_0x233473[_0x8895('0x34')]===_0x233473['linkedid']&&_0x233473[_0x8895('0x3a')]!=_0x8895('0x3b')){if(_[_0x8895('0x36')](this[_0x8895('0x19')][_0x233473[_0x8895('0x34')]])){this['channels'][_0x233473[_0x8895('0x34')]]=new Channel();this['channels'][_0x233473[_0x8895('0x34')]]['starttime']=moment()[_0x8895('0x3c')](_0x8895('0x3d'));this[_0x8895('0x19')][_0x233473[_0x8895('0x34')]][_0x8895('0x3e')]=dispositions[_['toNumber'](_0x233473[_0x8895('0x3f')])];_['merge'](this[_0x8895('0x19')][_0x233473[_0x8895('0x34')]],_[_0x8895('0x37')](_0x233473,_[_0x8895('0x38')](this[_0x8895('0x19')][_0x233473[_0x8895('0x34')]])));if(_0x233473['context']===_0x8895('0x40')){if(this[_0x8895('0x1a')][_0x233473['channel'][_0x8895('0x41')]('-')[0x0]]){this['agents'][_0x233473[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]]['destconnectedlinenum']=_0x233473[_0x8895('0x42')];this[_0x8895('0x33')](util['format']('user:%s',this[_0x8895('0x1a')][_0x233473[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]][_0x8895('0x43')]),_0x8895('0x44'),{'destaccountcode':this['agents'][_0x233473[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]][_0x8895('0x45')],'destconnectedlinenum':_0x233473[_0x8895('0x42')]});}}}}}}catch(_0x1d9e26){logger[_0x8895('0x46')]('[syncNewChannel][VoiceCallReport]',util[_0x8895('0x47')](_0x1d9e26,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8895('0x1b')]=function(_0x6eec55){try{if(this['isNotNull'](_0x6eec55)){if(_0x6eec55[_0x8895('0x34')]===_0x6eec55['linkedid']&&_0x6eec55[_0x8895('0x42')]!='h'&&_0x6eec55['channel']!='OutgoingSpoolFailed'){_0x6eec55['application']=_0x6eec55['application']['toLowerCase']();_0x6eec55['applicationdata']=(_0x6eec55[_0x8895('0x48')]||_0x6eec55[_0x8895('0x49')])['toLowerCase']();if(_['isUndefined'](this[_0x8895('0x19')][_0x6eec55[_0x8895('0x34')]])){this['channels'][_0x6eec55[_0x8895('0x34')]]=new Channel();this[_0x8895('0x19')][_0x6eec55[_0x8895('0x34')]][_0x8895('0x4a')]=_0x6eec55[_0x8895('0x4b')]?moment()['subtract'](moment['duration'](_0x6eec55['duration'])[_0x8895('0x4c')](),'seconds')[_0x8895('0x3c')](_0x8895('0x3d')):moment()[_0x8895('0x3c')](_0x8895('0x3d'));this['channels'][_0x6eec55[_0x8895('0x34')]][_0x8895('0x3e')]=_0x8895('0x12');}_[_0x8895('0x4d')](this[_0x8895('0x19')][_0x6eec55[_0x8895('0x34')]],_[_0x8895('0x37')](_0x6eec55,_[_0x8895('0x38')](this['channels'][_0x6eec55[_0x8895('0x34')]])));if(_[_0x8895('0x4e')](applications,_0x6eec55['application'])){this[_0x8895('0x19')][_0x6eec55['uniqueid']]['lastapplication']=_0x6eec55[_0x8895('0x4f')];this[_0x8895('0x19')][_0x6eec55[_0x8895('0x34')]]['lastdata']=_0x6eec55[_0x8895('0x49')];if(_0x6eec55['application']===_0x8895('0xc')&&_[_0x8895('0x50')](_0x6eec55[_0x8895('0x49')],_0x8895('0x51'))){var _0x2f3bf1=_0x6eec55[_0x8895('0x49')][_0x8895('0x41')]('=');var _0x4dde7c=_0x2f3bf1[0x0]['match'](/cdr\((.*)\)/);if(_0x4dde7c){this[_0x8895('0x19')][_0x6eec55[_0x8895('0x34')]][_0x4dde7c[0x1]]=_0x2f3bf1[0x1];}}else if(_0x6eec55['application']===_0x8895('0xd')){this['channels'][_0x6eec55['uniqueid']][_0x8895('0xd')]=_0x6eec55['applicationdata'][_0x8895('0x41')](',')[0x0];}}}}}catch(_0x2c2979){logger[_0x8895('0x46')](_0x8895('0x52'),util[_0x8895('0x47')](_0x2c2979,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8895('0x31')][_0x8895('0x21')]=function(_0x38d6ae){try{if(this['isNotNull'](_0x38d6ae)){if(_0x38d6ae[_0x8895('0x34')]!==_0x38d6ae[_0x8895('0x35')]){if(this[_0x8895('0x19')][_0x38d6ae['linkedid']]){if(_0x38d6ae[_0x8895('0x3f')]==='6'){if(!this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x35')]][_0x8895('0x53')]){var _0x1e264a=moment();this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x35')]][_0x8895('0x53')]=!![];this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x35')]]['answertime']=_0x1e264a[_0x8895('0x3c')](_0x8895('0x3d'));if(this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x35')]][_0x8895('0x4a')]){this['channels'][_0x38d6ae[_0x8895('0x35')]][_0x8895('0x54')]=_0x1e264a[_0x8895('0x55')](this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x35')]]['starttime'],_0x8895('0x4c'));}}this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x35')]]['linkedid']=_0x38d6ae[_0x8895('0x34')];if(_0x38d6ae[_0x8895('0x56')]!==_0x8895('0x57')){this['channels'][_0x38d6ae[_0x8895('0x35')]][_0x8895('0x58')]=_0x38d6ae['calleridnum'];}this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x35')]]['connectedlinename']=_0x38d6ae[_0x8895('0x59')];this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x35')]][_0x8895('0x5a')]=_0x38d6ae['channel'];this['channels'][_0x38d6ae[_0x8895('0x35')]][_0x8895('0x3e')]=dispositions[_[_0x8895('0x5b')](_0x38d6ae['channelstate'])];if(this[_0x8895('0x1a')][_0x38d6ae[_0x8895('0x3a')]['split']('-')[0x0]]){this[_0x8895('0x19')][_0x38d6ae['linkedid']][_0x8895('0x5c')]=this[_0x8895('0x1a')][_0x38d6ae[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]]['id'];this[_0x8895('0x19')][_0x38d6ae['linkedid']]['membername']=this[_0x8895('0x1a')][_0x38d6ae[_0x8895('0x3a')]['split']('-')[0x0]][_0x8895('0x43')];}}}}else{if(this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x34')]]){if(_0x38d6ae[_0x8895('0x3f')]==='6'){if(this['agents'][_0x38d6ae[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]]){this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x34')]][_0x8895('0x5c')]=this[_0x8895('0x1a')][_0x38d6ae[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]]['id'];this[_0x8895('0x19')][_0x38d6ae[_0x8895('0x34')]][_0x8895('0x5d')]=this[_0x8895('0x1a')][_0x38d6ae[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]][_0x8895('0x43')];}}}}}}catch(_0x534c7d){logger['error']('[syncNewState][VoiceCallReport]',util[_0x8895('0x47')](_0x534c7d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8895('0x31')][_0x8895('0x5e')]=function(_0x38f960,_0x148951){if(this['channels'][_0x38f960]){this[_0x8895('0x19')][_0x38f960][_0x8895('0x5f')]=!![];if(_['endsWith'](_0x148951,_0x8895('0x60'))){_0x148951=_0x148951[_0x8895('0x61')](_0x8895('0x60'),_0x8895('0x62'));}this[_0x8895('0x19')][_0x38f960]['monitorFilename']=_0x148951;var _0x6440ea=_[_0x8895('0x63')](this[_0x8895('0x19')][_0x38f960][_0x8895('0x64')],{'filename':_0x148951});if(_[_0x8895('0x65')](_0x6440ea)){this[_0x8895('0x19')][_0x38f960][_0x8895('0x64')]['push']({'filename':_0x148951,'createdAt':moment()[_0x8895('0x3c')](_0x8895('0x3d')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x8895('0x31')][_0x8895('0x23')]=function(_0x46efed){try{if(this[_0x8895('0x32')](_0x46efed)){if(this[_0x8895('0x19')][_0x46efed['uniqueid']]&&_0x46efed[_0x8895('0x3a')]!='OutgoingSpoolFailed'){if(this[_0x8895('0x32')](_0x46efed[_0x8895('0x66')])){if(this['isNotNull'](_0x46efed[_0x8895('0x66')][_0x8895('0x67')])){this[_0x8895('0x5e')](_0x46efed[_0x8895('0x34')],_0x46efed['value']);}else if(this[_0x8895('0x32')](_0x46efed['variable']['xmd-phone'])){this[_0x8895('0x19')][_0x46efed[_0x8895('0x34')]][_0x8895('0x56')]=_0x46efed['value'];}else if(this[_0x8895('0x32')](_0x46efed['variable'][_0x8895('0x68')])){this[_0x8895('0x19')][_0x46efed[_0x8895('0x34')]][_0x8895('0x69')]=_0x46efed[_0x8895('0x6a')];}else if(this['isNotNull'](_0x46efed['variable'][_0x8895('0x6b')])){this['channels'][_0x46efed[_0x8895('0x34')]][_0x8895('0x6c')]=_0x46efed['value'];}else if(this[_0x8895('0x32')](_0x46efed[_0x8895('0x66')][_0x8895('0x6d')])){this[_0x8895('0x19')][_0x46efed[_0x8895('0x34')]]['queue']=_0x46efed[_0x8895('0x6a')]['split'](',')[0x0];}else if(this['isNotNull'](_0x46efed[_0x8895('0x66')]['xmd-originatecalleridnum'])){this[_0x8895('0x19')][_0x46efed[_0x8895('0x34')]][_0x8895('0x6e')]=_0x46efed[_0x8895('0x6a')];}else if(this['isNotNull'](_0x46efed['variable']['xmd-destination'])){this[_0x8895('0x19')][_0x46efed[_0x8895('0x34')]][_0x8895('0x6f')]=_0x46efed[_0x8895('0x6a')];}else if(this[_0x8895('0x32')](_0x46efed[_0x8895('0x66')]['xmd-callerid-preview'])){this[_0x8895('0x19')][_0x46efed[_0x8895('0x34')]][_0x8895('0x70')]=_0x46efed['value'];}else if(this[_0x8895('0x32')](_0x46efed['variable'][_0x8895('0x71')])){this['channels'][_0x46efed[_0x8895('0x34')]][_0x8895('0xd')]=_0x46efed['value'];}else if(this[_0x8895('0x32')](_0x46efed[_0x8895('0x66')]['sipcallid'])){this[_0x8895('0x19')][_0x46efed[_0x8895('0x34')]][_0x8895('0x72')]=_0x46efed[_0x8895('0x6a')];}}}else if(this[_0x8895('0x32')](_0x46efed[_0x8895('0x66')][_0x8895('0x67')])){if(_0x46efed['value']){var _0x2816bf=path['parse'](_0x46efed[_0x8895('0x6a')])[_0x8895('0x43')];this[_0x8895('0x5e')](_0x2816bf,_0x46efed[_0x8895('0x6a')]);}}else if(this['channels'][_0x46efed[_0x8895('0x35')]]){if(this[_0x8895('0x32')](_0x46efed[_0x8895('0x66')])){if(this[_0x8895('0x32')](_0x46efed[_0x8895('0x66')][_0x8895('0x73')])){this[_0x8895('0x19')][_0x46efed[_0x8895('0x35')]]['sipcalllinkedid']=_0x46efed[_0x8895('0x6a')];}}}}}catch(_0x45cdca){logger['error']('[syncVarSet][VoiceCallReport]',util[_0x8895('0x47')](_0x45cdca,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8895('0x31')][_0x8895('0x74')]=function(_0xfbb2){try{if(this['isNotNull'](_0xfbb2)){if(this['channels'][_0xfbb2[_0x8895('0x34')]]){var _0x42ebe2=moment();this[_0x8895('0x19')][_0xfbb2[_0x8895('0x34')]][_0x8895('0x75')]=_0x42ebe2['format'](_0x8895('0x3d'));this[_0x8895('0x19')][_0xfbb2['uniqueid']][_0x8895('0x4b')]=_0x42ebe2[_0x8895('0x55')](this[_0x8895('0x19')][_0xfbb2[_0x8895('0x34')]][_0x8895('0x4a')],_0x8895('0x4c'));if(this['channels'][_0xfbb2[_0x8895('0x34')]][_0x8895('0x53')]){this['channels'][_0xfbb2['uniqueid']]['billableseconds']=_0x42ebe2[_0x8895('0x55')](this[_0x8895('0x19')][_0xfbb2['uniqueid']][_0x8895('0x76')],'seconds');this['channels'][_0xfbb2['uniqueid']][_0x8895('0x54')]=this[_0x8895('0x19')][_0xfbb2[_0x8895('0x34')]][_0x8895('0x4b')]-this[_0x8895('0x19')][_0xfbb2['uniqueid']][_0x8895('0x77')];}if(_0xfbb2[_0x8895('0x78')]===_0x8895('0x40')){if(this['agents'][_0xfbb2['channel']['split']('-')[0x0]]){this[_0x8895('0x1a')][_0xfbb2[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]]=_[_0x8895('0x79')](this[_0x8895('0x1a')][_0xfbb2[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]],['destconnectedlinenum']);this[_0x8895('0x33')](util['format'](_0x8895('0x7a'),this['agents'][_0xfbb2[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]][_0x8895('0x43')]),_0x8895('0x7b'),{'destaccountcode':this[_0x8895('0x1a')][_0xfbb2[_0x8895('0x3a')][_0x8895('0x41')]('-')[0x0]]['accountcode']});}}ami[_0x8895('0x33')](_0x8895('0x7c'),this[_0x8895('0x19')][_0xfbb2[_0x8895('0x34')]]);delete this[_0x8895('0x19')][_0xfbb2['uniqueid']];}}}catch(_0x464d1c){logger['error'](_0x8895('0x7d'),util[_0x8895('0x47')](_0x464d1c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8895('0x31')][_0x8895('0x27')]=function(_0x378e72){try{if(this[_0x8895('0x32')](_0x378e72)){if(this[_0x8895('0x19')][_0x378e72[_0x8895('0x7e')]]){this[_0x8895('0x19')][_0x378e72['transfereeuniqueid']][_0x8895('0x7f')]=_0x378e72['origtransferercalleridnum'];this[_0x8895('0x19')][_0x378e72[_0x8895('0x7e')]][_0x8895('0x80')]=_0x378e72['transfertargetcalleridnum'];if(this[_0x8895('0x19')][_0x378e72['secondtransfereruniqueid']]){var _0x620af9=this[_0x8895('0x19')][_0x378e72[_0x8895('0x81')]];this[_0x8895('0x19')][_0x378e72['secondtransfereruniqueid']]=this['channels'][_0x378e72[_0x8895('0x7e')]];this['channels'][_0x378e72['transfereeuniqueid']]=_0x620af9;}}else if(this[_0x8895('0x19')][_0x378e72['transfertargetuniqueid']]){this[_0x8895('0x19')][_0x378e72[_0x8895('0x82')]][_0x8895('0x7f')]=_0x378e72[_0x8895('0x83')];this[_0x8895('0x19')][_0x378e72[_0x8895('0x82')]][_0x8895('0x80')]=_0x378e72[_0x8895('0x84')];if(this[_0x8895('0x19')][_0x378e72['origtransfereruniqueid']]){var _0x620af9=this[_0x8895('0x19')][_0x378e72[_0x8895('0x85')]];this['channels'][_0x378e72[_0x8895('0x85')]]=this[_0x8895('0x19')][_0x378e72[_0x8895('0x82')]];this['channels'][_0x378e72[_0x8895('0x82')]]=_0x620af9;}}}}catch(_0x25511e){logger[_0x8895('0x46')](_0x8895('0x86'),util[_0x8895('0x47')](_0x25511e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8895('0x31')][_0x8895('0x87')]=function(_0x510d69){try{if(this[_0x8895('0x32')](_0x510d69)){if(this[_0x8895('0x19')][_0x510d69[_0x8895('0x7e')]]){this[_0x8895('0x19')][_0x510d69[_0x8895('0x7e')]][_0x8895('0x7f')]=_0x510d69['transfereecalleridnum'];this[_0x8895('0x19')][_0x510d69[_0x8895('0x7e')]]['transferconnectedlinenum']=_0x510d69['extension'];this[_0x8895('0x74')]({'event':_0x8895('0x88'),'uniqueid':_0x510d69['transfereeuniqueid'],'context':_0x510d69[_0x8895('0x78')],'channel':_0x510d69[_0x8895('0x89')]});}}}catch(_0x6715b){logger[_0x8895('0x46')](_0x8895('0x8a'),util['inspect'](_0x6715b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8895('0x31')][_0x8895('0x2a')]=function(_0x4691f2){try{if(this[_0x8895('0x32')](_0x4691f2)){if(this[_0x8895('0x19')][_0x4691f2[_0x8895('0x34')]]){if(!_[_0x8895('0x65')](this[_0x8895('0x19')][_0x4691f2[_0x8895('0x34')]][_0x8895('0x76')])){this[_0x8895('0x19')][_0x4691f2[_0x8895('0x34')]]['mohstarttime']=moment()[_0x8895('0x3c')](_0x8895('0x3d'));}}}}catch(_0x3e041f){logger[_0x8895('0x46')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x8895('0x47')](_0x3e041f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8895('0x31')]['syncMusicOnHoldStop']=function(_0x5d3262){try{if(this[_0x8895('0x32')](_0x5d3262)){if(this['channels'][_0x5d3262[_0x8895('0x34')]]){if(!_['isNil'](this['channels'][_0x5d3262[_0x8895('0x34')]]['mohstarttime'])){this[_0x8895('0x19')][_0x5d3262['uniqueid']][_0x8895('0x8b')]+=moment()[_0x8895('0x8c')](0x0)['diff'](this[_0x8895('0x19')][_0x5d3262[_0x8895('0x34')]][_0x8895('0x8d')],'seconds');delete this['channels'][_0x5d3262[_0x8895('0x34')]][_0x8895('0x8d')];}}}}catch(_0x36c828){logger[_0x8895('0x46')](_0x8895('0x8e'),util[_0x8895('0x47')](_0x36c828,{'showHidden':![],'depth':null}));}};module[_0x8895('0x8f')]=VoiceCallReport; \ No newline at end of file +var _0xabe7=['[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','calleridpreview','xmcs-queue','sipcallid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','billableseconds','answertime','custom:voiceCallReport','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','milliseconds','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','set','queue','agi','dial','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','newexten','newchannel','syncNewChannel','bind','newstate','syncNewState','varset','syncVarSet','syncHangup','syncNewCallerId','attendedtransfer','blindtransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','resolve','actionCoreShowChannels','catch','log','prototype','isNotNull','emit','isUndefined','uniqueid','merge','pick','[syncNewCallerId][VoiceCallReport]','linkedid','channel','starttime','format','disposition','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','exten','user:%s','name','accountcode','error','[syncNewChannel][VoiceCallReport]','inspect','OutgoingSpoolFailed','application','applicationdata','appdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','keys','includes','lastapplication','lastdata','startsWith','match','answered','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xabe7,0xce));var _0x7abe=function(_0x4cbef2,_0x4206e2){_0x4cbef2=_0x4cbef2-0x0;var _0x3a79a4=_0xabe7[_0x4cbef2];return _0x3a79a4;};'use strict';var BPromise=require(_0x7abe('0x0'));var _=require(_0x7abe('0x1'));var moment=require(_0x7abe('0x2'));var util=require(_0x7abe('0x3'));var path=require(_0x7abe('0x4'));var Redis=require(_0x7abe('0x5'));var config=require(_0x7abe('0x6'));var logger=require(_0x7abe('0x7'))(_0x7abe('0x8'));var ami=require(_0x7abe('0x9'));var Channel=require(_0x7abe('0xa'));var statusDesc=[_0x7abe('0xb'),_0x7abe('0xc'),_0x7abe('0xd'),_0x7abe('0xe'),_0x7abe('0xf'),_0x7abe('0x10'),'ringing',_0x7abe('0x11'),_0x7abe('0x12')];var applications=[_0x7abe('0x13'),_0x7abe('0x14'),_0x7abe('0x15'),_0x7abe('0x16'),'playback','voicemail'];var dispositions=[_0x7abe('0x17'),_0x7abe('0x18'),_0x7abe('0x18'),_0x7abe('0x17'),_0x7abe('0x17'),_0x7abe('0x17'),_0x7abe('0x19'),_0x7abe('0x1a'),_0x7abe('0x18'),_0x7abe('0x18'),'FAILED'];var actions={};config['redis']=_['defaults'](config[_0x7abe('0x1b')],{'host':'localhost','port':0x18eb});var io=require(_0x7abe('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0x158e12){this['channels']=_0x158e12[_0x7abe('0x1d')];this[_0x7abe('0x1e')]=_0x158e12['agents'];ami['on'](_0x7abe('0x1f'),this[_0x7abe('0x20')]['bind'](this));ami['on'](_0x7abe('0x21'),this[_0x7abe('0x20')]['bind'](this));ami['on'](_0x7abe('0x22'),this[_0x7abe('0x23')][_0x7abe('0x24')](this));ami['on'](_0x7abe('0x25'),this[_0x7abe('0x26')][_0x7abe('0x24')](this));ami['on'](_0x7abe('0x27'),this[_0x7abe('0x28')][_0x7abe('0x24')](this));ami['on']('hangup',this[_0x7abe('0x29')][_0x7abe('0x24')](this));ami['on']('newcallerid',this[_0x7abe('0x2a')][_0x7abe('0x24')](this));ami['on'](_0x7abe('0x2b'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x7abe('0x2c'),this['syncBlindTransfer'][_0x7abe('0x24')](this));ami['on'](_0x7abe('0x2d'),this['syncMusicOnHoldStart'][_0x7abe('0x24')](this));ami['on'](_0x7abe('0x2e'),this[_0x7abe('0x2f')][_0x7abe('0x24')](this));return BPromise[_0x7abe('0x30')]()['then'](ami[_0x7abe('0x31')]())[_0x7abe('0x32')](function(_0x5eafb3){console[_0x7abe('0x33')](_0x5eafb3);});}VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x35')]=function(_0x238016){return _0x238016!==null&&!_['isUndefined'](_0x238016);};VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x36')]=function(_0x24e0e4,_0x523c62,_0x40ec51){io['to'](_0x24e0e4)['emit'](_0x523c62,_0x40ec51);};VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x2a')]=function(_0x3f90c3){try{if(this['isNotNull'](_0x3f90c3)){if(_0x3f90c3['uniqueid']===_0x3f90c3['linkedid']){if(!_[_0x7abe('0x37')](this[_0x7abe('0x1d')][_0x3f90c3[_0x7abe('0x38')]])){_[_0x7abe('0x39')](this[_0x7abe('0x1d')][_0x3f90c3[_0x7abe('0x38')]],_[_0x7abe('0x3a')](_0x3f90c3,_['keys'](this['channels'][_0x3f90c3['uniqueid']])));}}}}catch(_0x4f3c3d){logger['error'](_0x7abe('0x3b'),util['inspect'](_0x4f3c3d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x23')]=function(_0x2674a8){try{if(this[_0x7abe('0x35')](_0x2674a8)){if(_0x2674a8[_0x7abe('0x38')]===_0x2674a8[_0x7abe('0x3c')]&&_0x2674a8[_0x7abe('0x3d')]!='OutgoingSpoolFailed'){if(_[_0x7abe('0x37')](this[_0x7abe('0x1d')][_0x2674a8[_0x7abe('0x38')]])){this[_0x7abe('0x1d')][_0x2674a8['uniqueid']]=new Channel();this['channels'][_0x2674a8[_0x7abe('0x38')]][_0x7abe('0x3e')]=moment()[_0x7abe('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7abe('0x1d')][_0x2674a8['uniqueid']][_0x7abe('0x40')]=dispositions[_[_0x7abe('0x41')](_0x2674a8[_0x7abe('0x42')])];_[_0x7abe('0x39')](this[_0x7abe('0x1d')][_0x2674a8[_0x7abe('0x38')]],_[_0x7abe('0x3a')](_0x2674a8,_['keys'](this[_0x7abe('0x1d')][_0x2674a8[_0x7abe('0x38')]])));if(_0x2674a8[_0x7abe('0x43')]===_0x7abe('0x44')){if(this[_0x7abe('0x1e')][_0x2674a8[_0x7abe('0x3d')][_0x7abe('0x45')]('-')[0x0]]){this[_0x7abe('0x1e')][_0x2674a8[_0x7abe('0x3d')][_0x7abe('0x45')]('-')[0x0]][_0x7abe('0x46')]=_0x2674a8[_0x7abe('0x47')];this[_0x7abe('0x36')](util[_0x7abe('0x3f')](_0x7abe('0x48'),this['agents'][_0x2674a8[_0x7abe('0x3d')][_0x7abe('0x45')]('-')[0x0]][_0x7abe('0x49')]),'user:agentconnect',{'destaccountcode':this[_0x7abe('0x1e')][_0x2674a8['channel'][_0x7abe('0x45')]('-')[0x0]][_0x7abe('0x4a')],'destconnectedlinenum':_0x2674a8[_0x7abe('0x47')]});}}}}}}catch(_0x4e444c){logger[_0x7abe('0x4b')](_0x7abe('0x4c'),util[_0x7abe('0x4d')](_0x4e444c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x20')]=function(_0x1e1850){try{if(this[_0x7abe('0x35')](_0x1e1850)){if(_0x1e1850[_0x7abe('0x38')]===_0x1e1850[_0x7abe('0x3c')]&&_0x1e1850['exten']!='h'&&_0x1e1850[_0x7abe('0x3d')]!=_0x7abe('0x4e')){_0x1e1850[_0x7abe('0x4f')]=_0x1e1850[_0x7abe('0x4f')]['toLowerCase']();_0x1e1850[_0x7abe('0x50')]=(_0x1e1850[_0x7abe('0x51')]||_0x1e1850[_0x7abe('0x50')])['toLowerCase']();if(_[_0x7abe('0x37')](this['channels'][_0x1e1850[_0x7abe('0x38')]])){this[_0x7abe('0x1d')][_0x1e1850[_0x7abe('0x38')]]=new Channel();this[_0x7abe('0x1d')][_0x1e1850[_0x7abe('0x38')]]['starttime']=_0x1e1850[_0x7abe('0x52')]?moment()[_0x7abe('0x53')](moment['duration'](_0x1e1850[_0x7abe('0x52')])['seconds'](),_0x7abe('0x54'))[_0x7abe('0x3f')](_0x7abe('0x55')):moment()[_0x7abe('0x3f')](_0x7abe('0x55'));this[_0x7abe('0x1d')][_0x1e1850['uniqueid']][_0x7abe('0x40')]=_0x7abe('0x17');}_[_0x7abe('0x39')](this[_0x7abe('0x1d')][_0x1e1850[_0x7abe('0x38')]],_[_0x7abe('0x3a')](_0x1e1850,_[_0x7abe('0x56')](this[_0x7abe('0x1d')][_0x1e1850[_0x7abe('0x38')]])));if(_[_0x7abe('0x57')](applications,_0x1e1850[_0x7abe('0x4f')])){this[_0x7abe('0x1d')][_0x1e1850[_0x7abe('0x38')]][_0x7abe('0x58')]=_0x1e1850[_0x7abe('0x4f')];this[_0x7abe('0x1d')][_0x1e1850[_0x7abe('0x38')]][_0x7abe('0x59')]=_0x1e1850[_0x7abe('0x50')];if(_0x1e1850[_0x7abe('0x4f')]===_0x7abe('0x13')&&_[_0x7abe('0x5a')](_0x1e1850[_0x7abe('0x50')],'cdr(')){var _0xaf4d6d=_0x1e1850[_0x7abe('0x50')][_0x7abe('0x45')]('=');var _0x303e4d=_0xaf4d6d[0x0][_0x7abe('0x5b')](/cdr\((.*)\)/);if(_0x303e4d){this[_0x7abe('0x1d')][_0x1e1850[_0x7abe('0x38')]][_0x303e4d[0x1]]=_0xaf4d6d[0x1];}}else if(_0x1e1850[_0x7abe('0x4f')]===_0x7abe('0x14')){this[_0x7abe('0x1d')][_0x1e1850[_0x7abe('0x38')]][_0x7abe('0x14')]=_0x1e1850['applicationdata']['split'](',')[0x0];}}}}}catch(_0x273fa8){logger[_0x7abe('0x4b')]('[syncNewExten][VoiceCallReport]',util[_0x7abe('0x4d')](_0x273fa8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x7ec978){try{if(this[_0x7abe('0x35')](_0x7ec978)){if(_0x7ec978[_0x7abe('0x38')]!==_0x7ec978[_0x7abe('0x3c')]){if(this[_0x7abe('0x1d')][_0x7ec978[_0x7abe('0x3c')]]){if(_0x7ec978[_0x7abe('0x42')]==='6'){if(!this[_0x7abe('0x1d')][_0x7ec978[_0x7abe('0x3c')]][_0x7abe('0x5c')]){var _0xcd122=moment();this['channels'][_0x7ec978[_0x7abe('0x3c')]][_0x7abe('0x5c')]=!![];this[_0x7abe('0x1d')][_0x7ec978['linkedid']]['answertime']=_0xcd122[_0x7abe('0x3f')](_0x7abe('0x55'));if(this[_0x7abe('0x1d')][_0x7ec978[_0x7abe('0x3c')]]['starttime']){this[_0x7abe('0x1d')][_0x7ec978['linkedid']][_0x7abe('0x5d')]=_0xcd122[_0x7abe('0x5e')](this[_0x7abe('0x1d')][_0x7ec978['linkedid']]['starttime'],_0x7abe('0x54'));}}this['channels'][_0x7ec978[_0x7abe('0x3c')]][_0x7abe('0x3c')]=_0x7ec978[_0x7abe('0x38')];if(_0x7ec978[_0x7abe('0x5f')]!==_0x7abe('0x60')){this['channels'][_0x7ec978[_0x7abe('0x3c')]][_0x7abe('0x61')]=_0x7ec978[_0x7abe('0x5f')];}this['channels'][_0x7ec978[_0x7abe('0x3c')]][_0x7abe('0x62')]=_0x7ec978['calleridname'];this[_0x7abe('0x1d')][_0x7ec978[_0x7abe('0x3c')]][_0x7abe('0x63')]=_0x7ec978['channel'];this[_0x7abe('0x1d')][_0x7ec978[_0x7abe('0x3c')]]['disposition']=dispositions[_[_0x7abe('0x41')](_0x7ec978['channelstate'])];if(this[_0x7abe('0x1e')][_0x7ec978['channel'][_0x7abe('0x45')]('-')[0x0]]){this['channels'][_0x7ec978[_0x7abe('0x3c')]][_0x7abe('0x64')]=this['agents'][_0x7ec978[_0x7abe('0x3d')]['split']('-')[0x0]]['id'];this[_0x7abe('0x1d')][_0x7ec978['linkedid']][_0x7abe('0x65')]=this[_0x7abe('0x1e')][_0x7ec978[_0x7abe('0x3d')][_0x7abe('0x45')]('-')[0x0]][_0x7abe('0x49')];}}}}else{if(this['channels'][_0x7ec978[_0x7abe('0x38')]]){if(_0x7ec978[_0x7abe('0x42')]==='6'){if(this[_0x7abe('0x1e')][_0x7ec978['channel'][_0x7abe('0x45')]('-')[0x0]]){this[_0x7abe('0x1d')][_0x7ec978[_0x7abe('0x38')]][_0x7abe('0x64')]=this[_0x7abe('0x1e')][_0x7ec978['channel'][_0x7abe('0x45')]('-')[0x0]]['id'];this['channels'][_0x7ec978[_0x7abe('0x38')]][_0x7abe('0x65')]=this[_0x7abe('0x1e')][_0x7ec978[_0x7abe('0x3d')][_0x7abe('0x45')]('-')[0x0]][_0x7abe('0x49')];}}}}}}catch(_0x3d19a8){logger[_0x7abe('0x4b')](_0x7abe('0x66'),util[_0x7abe('0x4d')](_0x3d19a8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x67')]=function(_0xc7481c,_0x486f5d){if(this[_0x7abe('0x1d')][_0xc7481c]){this['channels'][_0xc7481c][_0x7abe('0x68')]=!![];if(_[_0x7abe('0x69')](_0x486f5d,_0x7abe('0x6a'))){_0x486f5d=_0x486f5d[_0x7abe('0x6b')](_0x7abe('0x6a'),_0x7abe('0x6c'));}this[_0x7abe('0x1d')][_0xc7481c]['monitorFilename']=_0x486f5d;var _0x1e1c63=_[_0x7abe('0x6d')](this[_0x7abe('0x1d')][_0xc7481c][_0x7abe('0x6e')],{'filename':_0x486f5d});if(_[_0x7abe('0x6f')](_0x1e1c63)){this[_0x7abe('0x1d')][_0xc7481c][_0x7abe('0x6e')][_0x7abe('0x70')]({'filename':_0x486f5d,'createdAt':moment()[_0x7abe('0x3f')](_0x7abe('0x55')),'mixmonitorid':'','status':_0x7abe('0x71')});}}};VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x28')]=function(_0x26542a){try{if(this[_0x7abe('0x35')](_0x26542a)){if(this[_0x7abe('0x1d')][_0x26542a[_0x7abe('0x38')]]&&_0x26542a['channel']!=_0x7abe('0x4e')){if(this[_0x7abe('0x35')](_0x26542a[_0x7abe('0x72')])){if(this[_0x7abe('0x35')](_0x26542a[_0x7abe('0x72')][_0x7abe('0x73')])){this[_0x7abe('0x67')](_0x26542a[_0x7abe('0x38')],_0x26542a[_0x7abe('0x74')]);}else if(this[_0x7abe('0x35')](_0x26542a['variable'][_0x7abe('0x75')])){this['channels'][_0x26542a[_0x7abe('0x38')]]['calleridnum']=_0x26542a[_0x7abe('0x74')];}else if(this[_0x7abe('0x35')](_0x26542a[_0x7abe('0x72')][_0x7abe('0x76')])){this[_0x7abe('0x1d')][_0x26542a[_0x7abe('0x38')]][_0x7abe('0x77')]=_0x26542a[_0x7abe('0x74')];}else if(this['isNotNull'](_0x26542a[_0x7abe('0x72')]['xmd-cdrtype'])){this[_0x7abe('0x1d')][_0x26542a[_0x7abe('0x38')]][_0x7abe('0x78')]=_0x26542a[_0x7abe('0x74')];}else if(this[_0x7abe('0x35')](_0x26542a[_0x7abe('0x72')][_0x7abe('0x79')])){this[_0x7abe('0x1d')][_0x26542a[_0x7abe('0x38')]]['queue']=_0x26542a[_0x7abe('0x74')][_0x7abe('0x45')](',')[0x0];}else if(this['isNotNull'](_0x26542a[_0x7abe('0x72')][_0x7abe('0x7a')])){this['channels'][_0x26542a['uniqueid']][_0x7abe('0x7b')]=_0x26542a[_0x7abe('0x74')];}else if(this[_0x7abe('0x35')](_0x26542a[_0x7abe('0x72')][_0x7abe('0x7c')])){this[_0x7abe('0x1d')][_0x26542a[_0x7abe('0x38')]][_0x7abe('0x7d')]=_0x26542a[_0x7abe('0x74')];}else if(this['isNotNull'](_0x26542a[_0x7abe('0x72')]['xmd-callerid-preview'])){this[_0x7abe('0x1d')][_0x26542a[_0x7abe('0x38')]][_0x7abe('0x7e')]=_0x26542a[_0x7abe('0x74')];}else if(this[_0x7abe('0x35')](_0x26542a[_0x7abe('0x72')][_0x7abe('0x7f')])){this[_0x7abe('0x1d')][_0x26542a[_0x7abe('0x38')]]['queue']=_0x26542a[_0x7abe('0x74')];}else if(this[_0x7abe('0x35')](_0x26542a[_0x7abe('0x72')]['sipcallid'])){this['channels'][_0x26542a['uniqueid']]['sipcalluniqueid']=_0x26542a[_0x7abe('0x74')];}}}else if(this['isNotNull'](_0x26542a[_0x7abe('0x72')][_0x7abe('0x73')])){if(_0x26542a[_0x7abe('0x74')]){var _0x3a7261=path['parse'](_0x26542a[_0x7abe('0x74')])[_0x7abe('0x49')];this[_0x7abe('0x67')](_0x3a7261,_0x26542a[_0x7abe('0x74')]);}}else if(this[_0x7abe('0x1d')][_0x26542a[_0x7abe('0x3c')]]){if(this['isNotNull'](_0x26542a[_0x7abe('0x72')])){if(this[_0x7abe('0x35')](_0x26542a['variable'][_0x7abe('0x80')])){this[_0x7abe('0x1d')][_0x26542a[_0x7abe('0x3c')]][_0x7abe('0x81')]=_0x26542a[_0x7abe('0x74')];}}}}}catch(_0x33fbbd){logger[_0x7abe('0x4b')](_0x7abe('0x82'),util[_0x7abe('0x4d')](_0x33fbbd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x29')]=function(_0x33cd64){try{if(this[_0x7abe('0x35')](_0x33cd64)){if(this[_0x7abe('0x1d')][_0x33cd64['uniqueid']]){var _0x111e81=moment();this[_0x7abe('0x1d')][_0x33cd64['uniqueid']]['endtime']=_0x111e81[_0x7abe('0x3f')](_0x7abe('0x55'));this[_0x7abe('0x1d')][_0x33cd64[_0x7abe('0x38')]]['duration']=_0x111e81[_0x7abe('0x5e')](this[_0x7abe('0x1d')][_0x33cd64[_0x7abe('0x38')]][_0x7abe('0x3e')],_0x7abe('0x54'));if(this[_0x7abe('0x1d')][_0x33cd64[_0x7abe('0x38')]]['answered']){this[_0x7abe('0x1d')][_0x33cd64[_0x7abe('0x38')]][_0x7abe('0x83')]=_0x111e81[_0x7abe('0x5e')](this[_0x7abe('0x1d')][_0x33cd64['uniqueid']][_0x7abe('0x84')],_0x7abe('0x54'));this[_0x7abe('0x1d')][_0x33cd64['uniqueid']][_0x7abe('0x5d')]=this[_0x7abe('0x1d')][_0x33cd64[_0x7abe('0x38')]][_0x7abe('0x52')]-this['channels'][_0x33cd64[_0x7abe('0x38')]][_0x7abe('0x83')];}if(_0x33cd64[_0x7abe('0x43')]===_0x7abe('0x44')){if(this[_0x7abe('0x1e')][_0x33cd64['channel'][_0x7abe('0x45')]('-')[0x0]]){this[_0x7abe('0x1e')][_0x33cd64['channel']['split']('-')[0x0]]=_['omit'](this[_0x7abe('0x1e')][_0x33cd64[_0x7abe('0x3d')][_0x7abe('0x45')]('-')[0x0]],[_0x7abe('0x46')]);this[_0x7abe('0x36')](util[_0x7abe('0x3f')](_0x7abe('0x48'),this[_0x7abe('0x1e')][_0x33cd64[_0x7abe('0x3d')][_0x7abe('0x45')]('-')[0x0]][_0x7abe('0x49')]),'user:agentcomplete',{'destaccountcode':this['agents'][_0x33cd64['channel'][_0x7abe('0x45')]('-')[0x0]][_0x7abe('0x4a')]});}}ami[_0x7abe('0x36')](_0x7abe('0x85'),this[_0x7abe('0x1d')][_0x33cd64[_0x7abe('0x38')]]);delete this['channels'][_0x33cd64[_0x7abe('0x38')]];}}}catch(_0x4c61ca){logger[_0x7abe('0x4b')](_0x7abe('0x86'),util['inspect'](_0x4c61ca,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x87')]=function(_0x127209){try{if(this[_0x7abe('0x35')](_0x127209)){if(this[_0x7abe('0x1d')][_0x127209[_0x7abe('0x88')]]){this[_0x7abe('0x1d')][_0x127209[_0x7abe('0x88')]]['transfercalleridnum']=_0x127209[_0x7abe('0x89')];this[_0x7abe('0x1d')][_0x127209['transfereeuniqueid']][_0x7abe('0x8a')]=_0x127209[_0x7abe('0x8b')];if(this['channels'][_0x127209[_0x7abe('0x8c')]]){var _0xf98472=this[_0x7abe('0x1d')][_0x127209['secondtransfereruniqueid']];this[_0x7abe('0x1d')][_0x127209[_0x7abe('0x8c')]]=this[_0x7abe('0x1d')][_0x127209[_0x7abe('0x88')]];this[_0x7abe('0x1d')][_0x127209[_0x7abe('0x88')]]=_0xf98472;}}else if(this[_0x7abe('0x1d')][_0x127209[_0x7abe('0x8d')]]){this[_0x7abe('0x1d')][_0x127209['transfertargetuniqueid']][_0x7abe('0x8e')]=_0x127209[_0x7abe('0x89')];this[_0x7abe('0x1d')][_0x127209['transfertargetuniqueid']][_0x7abe('0x8a')]=_0x127209['transfertargetcalleridnum'];if(this[_0x7abe('0x1d')][_0x127209['origtransfereruniqueid']]){var _0xf98472=this['channels'][_0x127209[_0x7abe('0x8f')]];this[_0x7abe('0x1d')][_0x127209['origtransfereruniqueid']]=this[_0x7abe('0x1d')][_0x127209[_0x7abe('0x8d')]];this[_0x7abe('0x1d')][_0x127209[_0x7abe('0x8d')]]=_0xf98472;}}}}catch(_0x1ff976){logger[_0x7abe('0x4b')](_0x7abe('0x90'),util[_0x7abe('0x4d')](_0x1ff976,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x91')]=function(_0x1e5a34){try{if(this[_0x7abe('0x35')](_0x1e5a34)){if(this[_0x7abe('0x1d')][_0x1e5a34[_0x7abe('0x88')]]){this[_0x7abe('0x1d')][_0x1e5a34[_0x7abe('0x88')]][_0x7abe('0x8e')]=_0x1e5a34['transfereecalleridnum'];this['channels'][_0x1e5a34[_0x7abe('0x88')]][_0x7abe('0x8a')]=_0x1e5a34['extension'];this[_0x7abe('0x29')]({'event':_0x7abe('0x92'),'uniqueid':_0x1e5a34['transfereeuniqueid'],'context':_0x1e5a34[_0x7abe('0x43')],'channel':_0x1e5a34[_0x7abe('0x93')]});}}}catch(_0x5e32b8){logger[_0x7abe('0x4b')](_0x7abe('0x94'),util['inspect'](_0x5e32b8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7abe('0x34')]['syncMusicOnHoldStart']=function(_0x44b635){try{if(this[_0x7abe('0x35')](_0x44b635)){if(this[_0x7abe('0x1d')][_0x44b635[_0x7abe('0x38')]]){if(!_['isNil'](this[_0x7abe('0x1d')][_0x44b635[_0x7abe('0x38')]][_0x7abe('0x84')])){this['channels'][_0x44b635['uniqueid']]['mohstarttime']=moment()['format'](_0x7abe('0x55'));}}}}catch(_0x3ca5e9){logger[_0x7abe('0x4b')](_0x7abe('0x95'),util[_0x7abe('0x4d')](_0x3ca5e9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7abe('0x34')][_0x7abe('0x2f')]=function(_0x4f09e0){try{if(this['isNotNull'](_0x4f09e0)){if(this[_0x7abe('0x1d')][_0x4f09e0[_0x7abe('0x38')]]){if(!_[_0x7abe('0x6f')](this['channels'][_0x4f09e0[_0x7abe('0x38')]][_0x7abe('0x96')])){this[_0x7abe('0x1d')][_0x4f09e0[_0x7abe('0x38')]][_0x7abe('0x97')]+=moment()[_0x7abe('0x98')](0x0)[_0x7abe('0x5e')](this['channels'][_0x4f09e0[_0x7abe('0x38')]][_0x7abe('0x96')],'seconds');delete this[_0x7abe('0x1d')][_0x4f09e0[_0x7abe('0x38')]][_0x7abe('0x96')];}}}}catch(_0x56afc3){logger[_0x7abe('0x4b')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0x7abe('0x4d')](_0x56afc3,{'showHidden':![],'depth':null}));}};module[_0x7abe('0x99')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 0e0309f..c3fb485 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 _0x6ea5=['redis','outboundChannels','outbound','variables','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','privilege','voice:outbound','voice_outbound_channel:save','channels','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','membername','memberrealtime','isNil','endtime','duration','diff','starttime','seconds','complete','total','answertime','answered','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','ami','../ami','defaults','localhost','socket.io-emitter'];(function(_0x10904c,_0x5864a0){var _0x14fd02=function(_0x5480e4){while(--_0x5480e4){_0x10904c['push'](_0x10904c['shift']());}};_0x14fd02(++_0x5864a0);}(_0x6ea5,0xa5));var _0x56ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ea5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x56ea('0x0'));var moment=require(_0x56ea('0x1'));var util=require('util');var Redis=require(_0x56ea('0x2'));var config=require(_0x56ea('0x3'));var logger=require('../../../config/logger')(_0x56ea('0x4'));var ami=require(_0x56ea('0x5'));config['redis']=_[_0x56ea('0x6')](config['redis'],{'host':_0x56ea('0x7'),'port':0x18eb});var io=require(_0x56ea('0x8'))(new Redis(config[_0x56ea('0x9')]));function VoiceDialReport(_0x3235c7){this['channels']=_0x3235c7[_0x56ea('0xa')];this[_0x56ea('0xb')]=_0x3235c7[_0x56ea('0xb')];this[_0x56ea('0xc')]={};ami['on']('dialbegin',this[_0x56ea('0xd')][_0x56ea('0xe')](this));ami['on'](_0x56ea('0xf'),this[_0x56ea('0x10')][_0x56ea('0xe')](this));ami['on']('varset',this[_0x56ea('0x11')][_0x56ea('0xe')](this));ami['on'](_0x56ea('0x12'),this[_0x56ea('0x13')]['bind'](this));}VoiceDialReport[_0x56ea('0x14')]['isNotNull']=function(_0x54cfb7){return _0x54cfb7!==null&&!_[_0x56ea('0x15')](_0x54cfb7);};VoiceDialReport[_0x56ea('0x14')][_0x56ea('0x16')]=function(_0x3b8b45,_0xb74b3a,_0x54cf01){io['to'](_0x3b8b45)[_0x56ea('0x16')](_0xb74b3a,_0x54cf01);};VoiceDialReport[_0x56ea('0x14')][_0x56ea('0xd')]=function(_0x17f75c){try{if(this[_0x56ea('0x17')](_0x17f75c)){if(this['channels'][_0x17f75c['uniqueid']]){_[_0x56ea('0x18')](this['channels'][_0x17f75c[_0x56ea('0x19')]],{'starttime':moment()[_0x56ea('0x1a')](_0x56ea('0x1b')),'lastevent':_0x56ea('0x1c'),'interface':_0x17f75c[_0x56ea('0x1d')][_0x56ea('0x1e')](0x0,_0x17f75c[_0x56ea('0x1d')][_0x56ea('0x1f')]('-')),'membername':_0x17f75c['channel']['substring'](_0x17f75c[_0x56ea('0x1d')][_0x56ea('0x1f')]('/')+0x1,_0x17f75c[_0x56ea('0x1d')][_0x56ea('0x1f')]('-'))},_['omit'](_0x17f75c,['event',_0x56ea('0x20')]));this[_0x56ea('0x16')](_0x56ea('0x21'),_0x56ea('0x22'),this[_0x56ea('0x23')][_0x17f75c[_0x56ea('0x19')]]);ami['emit'](_0x56ea('0x24'),this[_0x56ea('0x23')][_0x17f75c[_0x56ea('0x19')]]);}}}catch(_0x5dc6ef){logger[_0x56ea('0x25')](_0x56ea('0x26'),util[_0x56ea('0x27')](_0x5dc6ef,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x56ea('0x14')][_0x56ea('0x10')]=function(_0xa3394){try{if(this[_0x56ea('0x17')](_0xa3394)){if(this['channels'][_0xa3394[_0x56ea('0x19')]]){this[_0x56ea('0x23')][_0xa3394[_0x56ea('0x19')]][_0x56ea('0x28')]=_0xa3394[_0x56ea('0x28')];if(_0xa3394[_0x56ea('0x28')]===_0x56ea('0x29')){this[_0x56ea('0x23')][_0xa3394['uniqueid']][_0x56ea('0x2a')]=_0xa3394[_0x56ea('0x2a')];this[_0x56ea('0x23')][_0xa3394[_0x56ea('0x19')]][_0x56ea('0x2b')]=_0xa3394[_0x56ea('0x2b')];this[_0x56ea('0x23')][_0xa3394['uniqueid']]['answertime']=moment()['format'](_0x56ea('0x1b'));this['channels'][_0xa3394[_0x56ea('0x19')]][_0x56ea('0x2c')]='connect';ami[_0x56ea('0x16')]('custom:dialconnect',this[_0x56ea('0x23')][_0xa3394[_0x56ea('0x19')]]);}this[_0x56ea('0x16')](_0x56ea('0x21'),_0x56ea('0x22'),this['channels'][_0xa3394[_0x56ea('0x19')]]);}}}catch(_0x1afb2d){logger['error'](_0x56ea('0x2d'),util[_0x56ea('0x27')](_0x1afb2d,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x56ea('0x11')]=function(_0xfb4e6){try{if(this[_0x56ea('0x17')](_0xfb4e6)){this[_0x56ea('0x2e')](_0xfb4e6[_0x56ea('0x19')],_[_0x56ea('0x2f')](_0xfb4e6[_0x56ea('0x30')])[0x0],_0xfb4e6['value']);if(this['isNotNull'](_0xfb4e6[_0x56ea('0x30')])&&this[_0x56ea('0x17')](_0xfb4e6[_0x56ea('0x30')]['outboundrouteid'])){if(_[_0x56ea('0x15')](this['channels'][_0xfb4e6[_0x56ea('0x19')]])){this[_0x56ea('0x23')][_0xfb4e6['uniqueid']]={'routeId':_0xfb4e6[_0x56ea('0x31')],'variables':this['variables'][_0xfb4e6[_0x56ea('0x19')]]};this[_0x56ea('0x16')](_0x56ea('0x21'),_0x56ea('0x22'),this[_0x56ea('0x23')][_0xfb4e6[_0x56ea('0x19')]]);}}}}catch(_0x3c7657){logger[_0x56ea('0x25')]('[syncVarSet][VoiceDialReport]',util['inspect'](_0x3c7657,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x56ea('0x14')][_0x56ea('0x2e')]=function(_0x3a717b,_0x23a2c7,_0x3b4291){var _0x1f3c30=['rtpaudioqos',_0x56ea('0x32'),_0x56ea('0x33'),_0x56ea('0x34'),_0x56ea('0x35'),_0x56ea('0x36'),_0x56ea('0x37'),'rtpaudioqosrttbridged',_0x56ea('0x38'),_0x56ea('0x39'),_0x56ea('0x3a'),'bridgepvtcallid','membercalls',_0x56ea('0x3b'),_0x56ea('0x3c'),_0x56ea('0x3d'),_0x56ea('0x3e'),'memberpenalty',_0x56ea('0x3f')];if(!_[_0x56ea('0x40')](_0x23a2c7)&&!_['includes'](_0x1f3c30,_0x23a2c7)){if(_[_0x56ea('0x15')](this[_0x56ea('0xc')][_0x3a717b])){this[_0x56ea('0xc')][_0x3a717b]={};}this[_0x56ea('0xc')][_0x3a717b][_0x23a2c7]=_0x3b4291;}};VoiceDialReport[_0x56ea('0x14')][_0x56ea('0x13')]=function(_0x16356d){try{if(this['isNotNull'](_0x16356d)){if(this[_0x56ea('0x23')][_0x16356d['uniqueid']]){this[_0x56ea('0x23')][_0x16356d[_0x56ea('0x19')]][_0x56ea('0x41')]=moment()[_0x56ea('0x1a')](_0x56ea('0x1b'));this[_0x56ea('0x23')][_0x16356d[_0x56ea('0x19')]][_0x56ea('0x42')]=moment(this['channels'][_0x16356d[_0x56ea('0x19')]][_0x56ea('0x41')])[_0x56ea('0x43')](this[_0x56ea('0x23')][_0x16356d['uniqueid']][_0x56ea('0x44')],_0x56ea('0x45'));this[_0x56ea('0x23')][_0x16356d[_0x56ea('0x19')]][_0x56ea('0x2c')]=_0x56ea('0x46');this[_0x56ea('0xb')][_0x56ea('0x47')]+=0x1;if(this[_0x56ea('0x23')][_0x16356d[_0x56ea('0x19')]][_0x56ea('0x48')]){this[_0x56ea('0xb')][_0x56ea('0x49')]+=0x1;this[_0x56ea('0x23')][_0x16356d[_0x56ea('0x19')]]['holdtime']=moment(this[_0x56ea('0x23')][_0x16356d[_0x56ea('0x19')]]['answertime'])[_0x56ea('0x43')](this[_0x56ea('0x23')][_0x16356d['uniqueid']][_0x56ea('0x44')],_0x56ea('0x45'));this[_0x56ea('0x23')][_0x16356d[_0x56ea('0x19')]][_0x56ea('0x4a')]=moment(this[_0x56ea('0x23')][_0x16356d[_0x56ea('0x19')]][_0x56ea('0x41')])[_0x56ea('0x43')](this[_0x56ea('0x23')][_0x16356d[_0x56ea('0x19')]]['answertime'],_0x56ea('0x45'));this[_0x56ea('0xb')][_0x56ea('0x4b')]+=this['channels'][_0x16356d['uniqueid']][_0x56ea('0x4c')]||0x0;this[_0x56ea('0xb')][_0x56ea('0x4d')]+=this['channels'][_0x16356d[_0x56ea('0x19')]]['billableseconds'];}this['outbound'][_0x56ea('0x4e')]+=this[_0x56ea('0x23')][_0x16356d['uniqueid']][_0x56ea('0x42')];ami[_0x56ea('0x16')](_0x56ea('0x4f'),this[_0x56ea('0x23')][_0x16356d['uniqueid']]);ami[_0x56ea('0x16')](_0x56ea('0x50'),this['channels'][_0x16356d[_0x56ea('0x19')]]);this['emit']('voice:outbound',_0x56ea('0x51'),this['outbound']);logger['info'](_0x56ea('0x52'),JSON[_0x56ea('0x53')](this['channels'][_0x16356d[_0x56ea('0x19')]]));this[_0x56ea('0x16')](_0x56ea('0x21'),_0x56ea('0x54'),this['channels'][_0x16356d[_0x56ea('0x19')]]);delete this[_0x56ea('0x23')][_0x16356d[_0x56ea('0x19')]];}if(this[_0x56ea('0xc')][_0x16356d[_0x56ea('0x19')]]){delete this['variables'][_0x16356d[_0x56ea('0x19')]];}}}catch(_0x5d9c86){logger[_0x56ea('0x25')](_0x56ea('0x55'),util['inspect'](_0x5d9c86,{'showHidden':![],'depth':null}));}};module[_0x56ea('0x56')]=VoiceDialReport; \ No newline at end of file +var _0x6d4e=['memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','syncHangup','endtime','duration','diff','starttime','seconds','complete','total','answered','holdtime','answertime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','varset','syncVarSet','isNotNull','isUndefined','prototype','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','custom:dialconnect','[syncDialEnd][VoiceDialReport]','inspect','addVariable','variable','value','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls'];(function(_0x1bf3df,_0x45b20d){var _0x4e937e=function(_0x4711d6){while(--_0x4711d6){_0x1bf3df['push'](_0x1bf3df['shift']());}};_0x4e937e(++_0x45b20d);}(_0x6d4e,0x12e));var _0xe6d4=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x6d4e[_0xf5d71c];return _0x5af672;};'use strict';var _=require(_0xe6d4('0x0'));var moment=require(_0xe6d4('0x1'));var util=require(_0xe6d4('0x2'));var Redis=require(_0xe6d4('0x3'));var config=require(_0xe6d4('0x4'));var logger=require(_0xe6d4('0x5'))(_0xe6d4('0x6'));var ami=require(_0xe6d4('0x7'));config[_0xe6d4('0x8')]=_[_0xe6d4('0x9')](config[_0xe6d4('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xe6d4('0xa'))(new Redis(config[_0xe6d4('0x8')]));function VoiceDialReport(_0x5e56b2){this[_0xe6d4('0xb')]=_0x5e56b2[_0xe6d4('0xc')];this[_0xe6d4('0xd')]=_0x5e56b2[_0xe6d4('0xd')];this[_0xe6d4('0xe')]={};ami['on'](_0xe6d4('0xf'),this[_0xe6d4('0x10')][_0xe6d4('0x11')](this));ami['on'](_0xe6d4('0x12'),this['syncDialEnd'][_0xe6d4('0x11')](this));ami['on'](_0xe6d4('0x13'),this[_0xe6d4('0x14')][_0xe6d4('0x11')](this));ami['on']('hangup',this['syncHangup'][_0xe6d4('0x11')](this));}VoiceDialReport['prototype'][_0xe6d4('0x15')]=function(_0x5a6189){return _0x5a6189!==null&&!_[_0xe6d4('0x16')](_0x5a6189);};VoiceDialReport[_0xe6d4('0x17')][_0xe6d4('0x18')]=function(_0x3eefc7,_0x45a10e,_0x704b9b){io['to'](_0x3eefc7)[_0xe6d4('0x18')](_0x45a10e,_0x704b9b);};VoiceDialReport[_0xe6d4('0x17')][_0xe6d4('0x10')]=function(_0x38cd9c){try{if(this[_0xe6d4('0x15')](_0x38cd9c)){if(this['channels'][_0x38cd9c[_0xe6d4('0x19')]]){_[_0xe6d4('0x1a')](this[_0xe6d4('0xb')][_0x38cd9c[_0xe6d4('0x19')]],{'starttime':moment()[_0xe6d4('0x1b')](_0xe6d4('0x1c')),'lastevent':_0xe6d4('0x1d'),'interface':_0x38cd9c[_0xe6d4('0x1e')][_0xe6d4('0x1f')](0x0,_0x38cd9c[_0xe6d4('0x1e')][_0xe6d4('0x20')]('-')),'membername':_0x38cd9c[_0xe6d4('0x1e')][_0xe6d4('0x1f')](_0x38cd9c[_0xe6d4('0x1e')][_0xe6d4('0x20')]('/')+0x1,_0x38cd9c[_0xe6d4('0x1e')]['lastIndexOf']('-'))},_[_0xe6d4('0x21')](_0x38cd9c,[_0xe6d4('0x22'),'privilege']));this[_0xe6d4('0x18')](_0xe6d4('0x23'),_0xe6d4('0x24'),this[_0xe6d4('0xb')][_0x38cd9c[_0xe6d4('0x19')]]);ami[_0xe6d4('0x18')](_0xe6d4('0x25'),this[_0xe6d4('0xb')][_0x38cd9c[_0xe6d4('0x19')]]);}}}catch(_0x415815){logger[_0xe6d4('0x26')](_0xe6d4('0x27'),util['inspect'](_0x415815,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe6d4('0x17')][_0xe6d4('0x28')]=function(_0x1c51af){try{if(this[_0xe6d4('0x15')](_0x1c51af)){if(this[_0xe6d4('0xb')][_0x1c51af[_0xe6d4('0x19')]]){this['channels'][_0x1c51af[_0xe6d4('0x19')]][_0xe6d4('0x29')]=_0x1c51af[_0xe6d4('0x29')];if(_0x1c51af[_0xe6d4('0x29')]===_0xe6d4('0x2a')){this['channels'][_0x1c51af['uniqueid']][_0xe6d4('0x2b')]=_0x1c51af['connectedlinenum'];this['channels'][_0x1c51af[_0xe6d4('0x19')]][_0xe6d4('0x2c')]=_0x1c51af[_0xe6d4('0x2c')];this['channels'][_0x1c51af[_0xe6d4('0x19')]]['answertime']=moment()[_0xe6d4('0x1b')](_0xe6d4('0x1c'));this['channels'][_0x1c51af[_0xe6d4('0x19')]][_0xe6d4('0x2d')]='connect';ami[_0xe6d4('0x18')](_0xe6d4('0x2e'),this[_0xe6d4('0xb')][_0x1c51af['uniqueid']]);}this['emit']('voice:outbound',_0xe6d4('0x24'),this[_0xe6d4('0xb')][_0x1c51af[_0xe6d4('0x19')]]);}}}catch(_0x4260f2){logger[_0xe6d4('0x26')](_0xe6d4('0x2f'),util[_0xe6d4('0x30')](_0x4260f2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe6d4('0x17')][_0xe6d4('0x14')]=function(_0x59e9ad){try{if(this[_0xe6d4('0x15')](_0x59e9ad)){this[_0xe6d4('0x31')](_0x59e9ad[_0xe6d4('0x19')],_['keys'](_0x59e9ad[_0xe6d4('0x32')])[0x0],_0x59e9ad[_0xe6d4('0x33')]);if(this['isNotNull'](_0x59e9ad[_0xe6d4('0x32')])&&this[_0xe6d4('0x15')](_0x59e9ad['variable']['outboundrouteid'])){if(_[_0xe6d4('0x16')](this[_0xe6d4('0xb')][_0x59e9ad[_0xe6d4('0x19')]])){this['channels'][_0x59e9ad[_0xe6d4('0x19')]]={'routeId':_0x59e9ad[_0xe6d4('0x33')],'variables':this[_0xe6d4('0xe')][_0x59e9ad[_0xe6d4('0x19')]]};this[_0xe6d4('0x18')](_0xe6d4('0x23'),_0xe6d4('0x24'),this[_0xe6d4('0xb')][_0x59e9ad[_0xe6d4('0x19')]]);}}}}catch(_0x24c1d1){logger[_0xe6d4('0x26')](_0xe6d4('0x34'),util[_0xe6d4('0x30')](_0x24c1d1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe6d4('0x17')][_0xe6d4('0x31')]=function(_0x39c592,_0x17693b,_0x45d73f){var _0x1c36eb=['rtpaudioqos',_0xe6d4('0x35'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xe6d4('0x36'),_0xe6d4('0x37'),_0xe6d4('0x38'),_0xe6d4('0x39'),_0xe6d4('0x3a'),_0xe6d4('0x3b'),'bridgepeer',_0xe6d4('0x3c'),_0xe6d4('0x3d'),'memberdynamic','memberinterface',_0xe6d4('0x3e'),_0xe6d4('0x3f'),_0xe6d4('0x40'),_0xe6d4('0x41')];if(!_[_0xe6d4('0x42')](_0x17693b)&&!_[_0xe6d4('0x43')](_0x1c36eb,_0x17693b)){if(_[_0xe6d4('0x16')](this['variables'][_0x39c592])){this[_0xe6d4('0xe')][_0x39c592]={};}this[_0xe6d4('0xe')][_0x39c592][_0x17693b]=_0x45d73f;}};VoiceDialReport['prototype'][_0xe6d4('0x44')]=function(_0x345d6f){try{if(this[_0xe6d4('0x15')](_0x345d6f)){if(this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]]){this[_0xe6d4('0xb')][_0x345d6f['uniqueid']][_0xe6d4('0x45')]=moment()[_0xe6d4('0x1b')](_0xe6d4('0x1c'));this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]][_0xe6d4('0x46')]=moment(this[_0xe6d4('0xb')][_0x345d6f['uniqueid']]['endtime'])[_0xe6d4('0x47')](this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]][_0xe6d4('0x48')],_0xe6d4('0x49'));this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]][_0xe6d4('0x2d')]=_0xe6d4('0x4a');this[_0xe6d4('0xd')][_0xe6d4('0x4b')]+=0x1;if(this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]]['answertime']){this[_0xe6d4('0xd')][_0xe6d4('0x4c')]+=0x1;this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]][_0xe6d4('0x4d')]=moment(this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]][_0xe6d4('0x4e')])[_0xe6d4('0x47')](this['channels'][_0x345d6f['uniqueid']]['starttime'],_0xe6d4('0x49'));this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]][_0xe6d4('0x4f')]=moment(this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]][_0xe6d4('0x45')])['diff'](this[_0xe6d4('0xb')][_0x345d6f['uniqueid']]['answertime'],'seconds');this[_0xe6d4('0xd')][_0xe6d4('0x50')]+=this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]]['holdtime']||0x0;this[_0xe6d4('0xd')][_0xe6d4('0x51')]+=this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]]['billableseconds'];}this[_0xe6d4('0xd')][_0xe6d4('0x52')]+=this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]]['duration'];ami[_0xe6d4('0x18')](_0xe6d4('0x53'),this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]]);ami['emit'](_0xe6d4('0x54'),this[_0xe6d4('0xb')][_0x345d6f['uniqueid']]);this[_0xe6d4('0x18')](_0xe6d4('0x23'),'voice_outbound:save',this['outbound']);logger[_0xe6d4('0x55')](_0xe6d4('0x56'),JSON[_0xe6d4('0x57')](this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]]));this['emit']('voice:outbound',_0xe6d4('0x58'),this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]]);delete this[_0xe6d4('0xb')][_0x345d6f[_0xe6d4('0x19')]];}if(this[_0xe6d4('0xe')][_0x345d6f[_0xe6d4('0x19')]]){delete this['variables'][_0x345d6f['uniqueid']];}}}catch(_0x10e253){logger[_0xe6d4('0x26')](_0xe6d4('0x59'),util['inspect'](_0x10e253,{'showHidden':![],'depth':null}));}};module[_0xe6d4('0x5a')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index a4b3783..72a4e9c 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 _0x8a97=['bluebird','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','queueStatusComplete','unlockRR','clearZombieChannels','channels','switch','isNil','Action','status','catch','message','error','[voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','name','voice_queue_channel:save','info','stringify','format','voice:queue:%s','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','answered','available','sumBillable','sumDuration','sumHoldTime','talking','total','waiting','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','queues','loopQueueSummary','then','[queuesummary]','syncQueueSummary','queue','callers','toNumber','loggedIn','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncQueueCallerJoin','uniqueid','queuecallerjoinAt','position','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','membername','queuecallerexit','transfer','reason','COMPLETED','startsWith','channel','linkedid','queuecallerexitAt','add','seconds','FORWARDTRANSFER','transfertype','transferexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','value','variable','queuestatus','CONTINUE','lastevent','queueposition','queuecallerabandon','EXITWITHKEY','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','length','unmanaged','abandoned','diff','milliseconds','custom:queuecallerunmanaged','custom:queuecallerabandon','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','ATTENDEDTRANSFER','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','syncBlindTransfer','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','syncMusicOnHoldStart','mohstarttime','syncMusicOnHoldStop','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','moment'];(function(_0x1b8ffe,_0x1e4707){var _0x2c38a5=function(_0x5447c){while(--_0x5447c){_0x1b8ffe['push'](_0x1b8ffe['shift']());}};_0x2c38a5(++_0x1e4707);}(_0x8a97,0xca));var _0x78a9=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x8a97[_0x47aa64];return _0x549c7a;};'use strict';var _=require('lodash');var moment=require(_0x78a9('0x0'));var BPromise=require(_0x78a9('0x1'));var util=require('util');var md5=require(_0x78a9('0x2'));var Redis=require(_0x78a9('0x3'));var config=require(_0x78a9('0x4'));var logger=require(_0x78a9('0x5'))(_0x78a9('0x6'));var ami=require(_0x78a9('0x7'));var QueueReport=require(_0x78a9('0x8'));config[_0x78a9('0x9')]=_['defaults'](config[_0x78a9('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x78a9('0xa'))(new Redis(config[_0x78a9('0x9')]));var Sequence=function(){};Sequence[_0x78a9('0xb')][_0x78a9('0xc')]=function(_0x1d1647){this['tail']=this[_0x78a9('0xd')]?this['tail'][_0x78a9('0xe')](_0x1d1647):_0x1d1647();};function VoiceQueueReport(_0x26ca6c){this[_0x78a9('0xf')]=new Sequence();this[_0x78a9('0x10')]={};this[_0x78a9('0x11')]=_0x26ca6c[_0x78a9('0x11')];this['channels']=_0x26ca6c[_0x78a9('0x12')];this['voiceQueues']=_0x26ca6c[_0x78a9('0x13')];this[_0x78a9('0x14')]=!![];this['campaigns']=_0x26ca6c[_0x78a9('0x15')];this[_0x78a9('0x16')]={};ami['on'](_0x78a9('0x17'),this['syncQueueSummary'][_0x78a9('0x18')](this));ami['on'](_0x78a9('0x19'),this[_0x78a9('0x1a')]['bind'](this));ami['on'](_0x78a9('0x1b'),this['syncQueueCallerJoin'][_0x78a9('0x18')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x78a9('0x18')](this));ami['on'](_0x78a9('0x1c'),this[_0x78a9('0x1d')][_0x78a9('0x18')](this));ami['on'](_0x78a9('0x1e'),this[_0x78a9('0x1f')]['bind'](this));ami['on'](_0x78a9('0x20'),this[_0x78a9('0x21')]['bind'](this));ami['on'](_0x78a9('0x22'),this['syncVarSet'][_0x78a9('0x18')](this));ami['on']('hangup',this[_0x78a9('0x23')][_0x78a9('0x18')](this));ami['on'](_0x78a9('0x24'),this[_0x78a9('0x25')][_0x78a9('0x18')](this));ami['on'](_0x78a9('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x78a9('0x27'),this['syncMusicOnHoldStop'][_0x78a9('0x18')](this));ami['on'](_0x78a9('0x28'),this[_0x78a9('0x29')]['bind'](this));ami['on'](_0x78a9('0x2a'),this['syncBlindTransfer'][_0x78a9('0x18')](this));this['loopQueueSummary']();this[_0x78a9('0x2b')]();}function isNotNull(_0x4e380a){return _0x4e380a!==null&&!_['isUndefined'](_0x4e380a);}function clearChannels(_0x1b9554){if(!_[_0x78a9('0x2c')](_0x1b9554)){for(var _0x178c65 in _0x1b9554){if(_0x1b9554[_0x78a9('0x2d')](_0x178c65)){delete _0x1b9554[_0x178c65];}}}}function clearCampaigns(_0x30dd74){if(!_['isEmpty'](_0x30dd74)){for(var _0x5b6a5d in _0x30dd74){if(_0x30dd74['hasOwnProperty'](_0x5b6a5d)){_0x30dd74[_0x5b6a5d][_0x78a9('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x80649e){if(!_[_0x78a9('0x2c')](_0x80649e)){for(var _0x1201e5 in _0x80649e){if(_0x80649e[_0x78a9('0x2d')](_0x1201e5)){_0x80649e[_0x1201e5][_0x78a9('0x2e')]=0x0;_0x80649e[_0x1201e5]['talking']=0x0;_0x80649e[_0x1201e5][_0x78a9('0x2f')]=0x0;_0x80649e[_0x1201e5]['waiting']=0x0;_0x80649e[_0x1201e5][_0x78a9('0x30')]=!![];}}}}function clearAgentBooked(_0x4137e7){if(!_[_0x78a9('0x2c')](_0x4137e7)){for(var _0x5d5eee in _0x4137e7){if(_0x4137e7[_0x78a9('0x2d')](_0x5d5eee)){_0x4137e7[_0x5d5eee][_0x78a9('0x31')]=!![];}}}}VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x32')]=function(){var _0x3ae5bf=this;for(var _0x1fc1c4 in this[_0x78a9('0x33')]){if(this[_0x78a9('0x33')][_0x78a9('0x2d')](_0x1fc1c4)&&!this[_0x78a9('0x33')][_0x1fc1c4][_0x78a9('0x34')]){this['sequence'][_0x78a9('0xc')](function(){if(!_[_0x78a9('0x35')](_0x3ae5bf[_0x78a9('0x33')][_0x1fc1c4])){return ami[_0x78a9('0x36')]({'action':_0x78a9('0x37'),'channel':_0x3ae5bf['channels'][_0x1fc1c4]['channel']})[_0x78a9('0x38')](function(_0x93acf5){if(_0x93acf5[_0x78a9('0x39')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3ae5bf[_0x78a9('0x33')][_0x1fc1c4]){delete _0x3ae5bf[_0x78a9('0x33')][_0x1fc1c4];logger[_0x78a9('0x3a')]('[voiceQueueReport][checkChannel]',_0x1fc1c4);}if(_0x3ae5bf[_0x78a9('0x10')][_0x1fc1c4]){delete _0x3ae5bf[_0x78a9('0x10')][_0x1fc1c4];logger[_0x78a9('0x3a')](_0x78a9('0x3b'),_0x1fc1c4);}if(_0x3ae5bf[_0x78a9('0x16')][_0x1fc1c4]){delete _0x3ae5bf[_0x78a9('0x16')][_0x1fc1c4];logger[_0x78a9('0x3a')]('[voiceQueueReport][checkVariables]',_0x1fc1c4);}},0x1f40);}});}});}}};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x25')]=function(){logger['error'](_0x78a9('0x3c'));clearChannels(this[_0x78a9('0x33')]);this[_0x78a9('0x3d')](this[_0x78a9('0x10')]);clearAgentBooked(this[_0x78a9('0x11')]);clearVoiceQueues(this[_0x78a9('0x13')]);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype'][_0x78a9('0x3d')]=function(_0x2bfdbf){var _0x4d753f=this;if(!_['isEmpty'](_0x2bfdbf)){for(var _0x303944 in _0x2bfdbf){if(_0x2bfdbf[_0x78a9('0x2d')](_0x303944)){_0x4d753f[_0x78a9('0x3e')](_0x2bfdbf[_0x303944]);delete _0x2bfdbf[_0x303944];}}}};function loggerCatch(_0x2c742b){return function(_0x89c1d){logger['error'](_0x2c742b,util[_0x78a9('0x3f')](_0x89c1d,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x78a9('0xb')]['emit']=function(_0x488fda,_0x44d8d6,_0x27a2e6){io['to'](_0x488fda)[_0x78a9('0x40')](_0x44d8d6,_0x27a2e6);};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x41')]=function(_0x4ac9ee){this[_0x78a9('0x40')](util['format']('voice:queue:%s',_0x4ac9ee[_0x78a9('0x42')]),_0x78a9('0x43'),_0x4ac9ee);};VoiceQueueReport[_0x78a9('0xb')]['emitVoiceQueueChannelRemove']=function(_0x4533db){logger[_0x78a9('0x44')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x78a9('0x45')](_0x4533db));this[_0x78a9('0x40')](util[_0x78a9('0x46')](_0x78a9('0x47'),_0x4533db[_0x78a9('0x42')]),_0x78a9('0x48'),_0x4533db);};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x49')]=function(_0x4b9410){if(_0x4b9410[_0x78a9('0x4a')]===_0x78a9('0x4b')){var _0x164666={'id':_0x4b9410['id'],'name':_0x4b9410['name'],'strategy':_0x4b9410['strategy'],'answered':_0x4b9410[_0x78a9('0x4c')],'available':_0x4b9410[_0x78a9('0x4d')],'loggedIn':_0x4b9410['loggedIn'],'pTalking':_0x4b9410[_0x78a9('0x2f')],'sumBillable':_0x4b9410[_0x78a9('0x4e')],'sumDuration':_0x4b9410[_0x78a9('0x4f')],'sumHoldTime':_0x4b9410[_0x78a9('0x50')]||0x0,'talking':_0x4b9410[_0x78a9('0x51')],'total':_0x4b9410[_0x78a9('0x52')],'type':_0x4b9410['type'],'unmanaged':_0x4b9410['unmanaged'],'abandoned':_0x4b9410['abandoned'],'waiting':_0x4b9410[_0x78a9('0x53')]};if(_0x4b9410[_0x78a9('0x54')]){_0x164666[_0x78a9('0x54')]={'id':_0x4b9410['Trunk']['id'],'name':_0x4b9410[_0x78a9('0x54')][_0x78a9('0x42')],'active':_0x4b9410[_0x78a9('0x54')][_0x78a9('0x55')],'callerid':_0x4b9410['Trunk'][_0x78a9('0x56')]};}if(_0x4b9410[_0x78a9('0x57')]){_0x164666['Interval']={'id':_0x4b9410[_0x78a9('0x57')]['id'],'name':_0x4b9410[_0x78a9('0x57')]['name']};}var _0x4a1c1c=md5(JSON['stringify'](_0x164666));if(_0x4b9410[_0x78a9('0x2')]!==_0x4a1c1c){_0x4b9410['md5']=_0x4a1c1c;this[_0x78a9('0x40')](util['format'](_0x78a9('0x47'),_0x164666[_0x78a9('0x42')]),_0x78a9('0x58'),_0x164666);}}};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x59')]=function(_0x4086cf){return _0x4086cf!==null&&!_['isUndefined'](_0x4086cf);};VoiceQueueReport['prototype'][_0x78a9('0x2b')]=function(){var _0x3b8e43=this;setInterval(function(){_0x3b8e43[_0x78a9('0x32')]();ami[_0x78a9('0x36')]({'action':_0x78a9('0x5a')})[_0x78a9('0x38')](loggerCatch('[queues]'));},0x2710);};VoiceQueueReport['prototype'][_0x78a9('0x5b')]=function(){var _0x8be77d=this;setInterval(function(){if(_0x8be77d[_0x78a9('0x14')]){return ami[_0x78a9('0x36')]({'action':_0x78a9('0x17')})[_0x78a9('0x5c')](function(_0x625b06){_0x8be77d['flagQueueSummary']=![];})['catch'](loggerCatch(_0x78a9('0x5d')));}},0x3e8);};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x5e')]=function(_0x3b802c){try{if(this[_0x78a9('0x59')](_0x3b802c)&&this['isNotNull'](_0x3b802c[_0x78a9('0x5f')])){if(this[_0x78a9('0x13')][_0x3b802c[_0x78a9('0x5f')]]){var _0x2c6109=_['countBy'](this[_0x78a9('0x33')],'queue')[_0x3b802c['queue']]||0x0;var _0x538b8f=_0x2c6109-_0x3b802c[_0x78a9('0x60')];if(this[_0x78a9('0x13')][_0x3b802c['queue']][_0x78a9('0x53')]!==_[_0x78a9('0x61')](_0x3b802c['callers'])||this['voiceQueues'][_0x3b802c[_0x78a9('0x5f')]][_0x78a9('0x62')]!==_[_0x78a9('0x61')](_0x3b802c[_0x78a9('0x63')])||this[_0x78a9('0x13')][_0x3b802c[_0x78a9('0x5f')]][_0x78a9('0x4d')]!==_[_0x78a9('0x61')](_0x3b802c[_0x78a9('0x4d')])||this[_0x78a9('0x13')][_0x3b802c[_0x78a9('0x5f')]][_0x78a9('0x51')]!==_0x538b8f){this[_0x78a9('0x13')][_0x3b802c[_0x78a9('0x5f')]][_0x78a9('0x53')]=_[_0x78a9('0x61')](_0x3b802c[_0x78a9('0x60')]);this[_0x78a9('0x13')][_0x3b802c[_0x78a9('0x5f')]][_0x78a9('0x62')]=_[_0x78a9('0x61')](_0x3b802c[_0x78a9('0x63')]);this['voiceQueues'][_0x3b802c['queue']][_0x78a9('0x4d')]=_[_0x78a9('0x61')](_0x3b802c['available']);this[_0x78a9('0x13')][_0x3b802c['queue']]['talking']=_0x538b8f>0x0?_0x538b8f:0x0;this[_0x78a9('0x13')][_0x3b802c[_0x78a9('0x5f')]][_0x78a9('0x51')]=this['voiceQueues'][_0x3b802c[_0x78a9('0x5f')]][_0x78a9('0x51')]>_[_0x78a9('0x61')](_0x3b802c[_0x78a9('0x63')])?_[_0x78a9('0x61')](_0x3b802c[_0x78a9('0x63')]):this['voiceQueues'][_0x3b802c[_0x78a9('0x5f')]][_0x78a9('0x51')];this['emitVoiceQueueSummary'](this[_0x78a9('0x13')][_0x3b802c[_0x78a9('0x5f')]]);}ami[_0x78a9('0x40')](_0x78a9('0x64'),this[_0x78a9('0x13')][_0x3b802c[_0x78a9('0x5f')]]);}}}catch(_0x31bb27){logger[_0x78a9('0x3a')](_0x78a9('0x65'),util[_0x78a9('0x3f')](_0x31bb27,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x78a9('0x1a')]=function(_0x162de2){this[_0x78a9('0x14')]=!![];};VoiceQueueReport[_0x78a9('0xb')]['syncNewExten']=function(_0x4ccd35){};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x66')]=function(_0x2bd3da){try{if(this[_0x78a9('0x59')](_0x2bd3da)){if(_['isUndefined'](this['queueReports'][_0x2bd3da[_0x78a9('0x67')]])){this['queueReports'][_0x2bd3da[_0x78a9('0x67')]]=[];this[_0x78a9('0x33')][_0x2bd3da[_0x78a9('0x67')]]={};}var _0x5c84a0=new QueueReport();_0x5c84a0[_0x78a9('0x42')]=_0x2bd3da['queue'];_0x5c84a0[_0x78a9('0x4a')]=this['voiceQueues'][_0x5c84a0[_0x78a9('0x42')]]&&this['voiceQueues'][_0x5c84a0[_0x78a9('0x42')]][_0x78a9('0x4a')]?this['voiceQueues'][_0x5c84a0['name']][_0x78a9('0x4a')]||_0x78a9('0x4b'):'inbound';_0x5c84a0[_0x78a9('0x5f')]=_0x2bd3da['queue'];_0x5c84a0[_0x78a9('0x68')]=moment()[_0x78a9('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c84a0[_0x78a9('0x69')]=_0x2bd3da[_0x78a9('0x69')];_0x5c84a0[_0x78a9('0x6a')]=_0x2bd3da[_0x78a9('0x6a')];_[_0x78a9('0x6b')](_0x5c84a0,_[_0x78a9('0x6c')](_0x2bd3da,_[_0x78a9('0x6d')](_0x5c84a0)));this[_0x78a9('0x10')][_0x2bd3da[_0x78a9('0x67')]][_0x78a9('0x6e')](_0x5c84a0);this[_0x78a9('0x33')][_0x2bd3da[_0x78a9('0x67')]]=_0x5c84a0;this['emitVoiceQueueChannelSave'](_0x5c84a0);}}catch(_0x203700){logger[_0x78a9('0x3a')](_0x78a9('0x6f'),util['inspect'](_0x203700,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x70')]=function(_0x2f128c){try{if(this[_0x78a9('0x59')](_0x2f128c)){if(this['queueReports'][_0x2f128c[_0x78a9('0x67')]]){var _0x5d5ff2=_['last'](this[_0x78a9('0x10')][_0x2f128c[_0x78a9('0x67')]]);_0x5d5ff2[_0x78a9('0x71')]=![];_0x5d5ff2[_0x78a9('0x72')]=null;_0x5d5ff2['holdtime']=_0x2f128c[_0x78a9('0x73')];_0x5d5ff2['originalposition']=_0x2f128c[_0x78a9('0x74')];_0x5d5ff2['queuecallerabandon']=!![];_0x5d5ff2[_0x78a9('0x75')]=moment()[_0x78a9('0x46')](_0x78a9('0x76'));_0x5d5ff2[_0x78a9('0x77')]=_0x78a9('0x78');_0x5d5ff2[_0x78a9('0x79')]=null;this[_0x78a9('0x33')][_0x2f128c[_0x78a9('0x67')]]=_0x5d5ff2;this[_0x78a9('0x3e')](_0x5d5ff2);}}}catch(_0xdc6394){logger[_0x78a9('0x3a')](_0x78a9('0x7a'),util[_0x78a9('0x3f')](_0xdc6394,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x1d')]=function(_0x288c20){try{if(this[_0x78a9('0x59')](_0x288c20)){if(this['queueReports'][_0x288c20['uniqueid']]){var _0x5eb4f3=_[_0x78a9('0x7b')](this[_0x78a9('0x10')][_0x288c20['uniqueid']]);_0x5eb4f3[_0x78a9('0x7c')]=moment()[_0x78a9('0x46')](_0x78a9('0x76'));_0x5eb4f3[_0x78a9('0x7d')]=_0x288c20[_0x78a9('0x7d')];_0x5eb4f3[_0x78a9('0x7e')]=_0x288c20['connectedlinename'];this[_0x78a9('0x33')][_0x288c20[_0x78a9('0x67')]]=_0x5eb4f3;this[_0x78a9('0x41')](_0x5eb4f3);}}}catch(_0x451e1e){logger[_0x78a9('0x3a')](_0x78a9('0x7f'),util[_0x78a9('0x3f')](_0x451e1e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x21')]=function(_0x3b3d94){try{if(this[_0x78a9('0x59')](_0x3b3d94)){if(this[_0x78a9('0x10')][_0x3b3d94[_0x78a9('0x67')]]){var _0x550394=_[_0x78a9('0x7b')](this[_0x78a9('0x10')][_0x3b3d94[_0x78a9('0x67')]]);_0x550394[_0x78a9('0x71')]=!![];_0x550394[_0x78a9('0x77')]=_0x78a9('0x80');}}}catch(_0x1f9245){logger[_0x78a9('0x3a')](_0x78a9('0x81'),util['inspect'](_0x1f9245,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x1f')]=function(_0x36a69c){try{if(this['isNotNull'](_0x36a69c)){if(this['queueReports'][_0x36a69c[_0x78a9('0x67')]]){var _0x227b75=_['last'](this[_0x78a9('0x10')][_0x36a69c['uniqueid']]);_0x227b75['queuecallerabandon']=![];_0x227b75[_0x78a9('0x75')]=null;_0x227b75[_0x78a9('0x82')]=!![];_0x227b75[_0x78a9('0x79')]=_0x36a69c[_0x78a9('0x83')];_0x227b75[_0x78a9('0x73')]=_0x36a69c[_0x78a9('0x73')];_0x227b75['queuecallercomplete']=!![];_0x227b75[_0x78a9('0x84')]=![];_0x227b75['queuecallerexitAt']=null;if(!_0x227b75[_0x78a9('0x85')]){if(_0x36a69c[_0x78a9('0x86')]=='transfer'){_0x227b75[_0x78a9('0x77')]=_0x78a9('0x87');}else{if(_[_0x78a9('0x88')](_0x36a69c[_0x78a9('0x89')]['toLowerCase'](),'local/')){if(this['queueReports'][_0x36a69c[_0x78a9('0x8a')]]){var _0x5c4281=_[_0x78a9('0x7b')](this['queueReports'][_0x36a69c[_0x78a9('0x8a')]]);_0x5c4281['queuecallercomplete']=![];_0x5c4281[_0x78a9('0x84')]=!![];_0x5c4281[_0x78a9('0x8b')]=moment(_0x227b75[_0x78a9('0x68')])[_0x78a9('0x8c')](_0x36a69c[_0x78a9('0x73')],_0x78a9('0x8d'))[_0x78a9('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c4281[_0x78a9('0x77')]=_0x78a9('0x8e');_0x5c4281[_0x78a9('0x85')]=!![];_0x5c4281[_0x78a9('0x8f')]='FORWARD';_0x5c4281[_0x78a9('0x90')]=_0x36a69c['destexten'];_0x5c4281[_0x78a9('0x91')]=_0x36a69c[_0x78a9('0x67')];var _0x33d890=this['queueReports'][_0x36a69c[_0x78a9('0x8a')]];this[_0x78a9('0x10')][_0x36a69c['linkedid']]=this[_0x78a9('0x10')][_0x36a69c[_0x78a9('0x67')]];this[_0x78a9('0x10')][_0x36a69c[_0x78a9('0x67')]]=_0x33d890;}}else{_0x227b75[_0x78a9('0x77')]=_0x78a9('0x92')+_0x36a69c[_0x78a9('0x86')][_0x78a9('0x93')]();}}}this['channels'][_0x36a69c[_0x78a9('0x67')]]=_0x227b75;this[_0x78a9('0x3e')](_0x227b75);}}}catch(_0x2799f2){logger['error'](_0x78a9('0x94'),util['inspect'](_0x2799f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x78a9('0x95')]=function(_0x2491dd){try{if(this[_0x78a9('0x59')](_0x2491dd)){this[_0x78a9('0x96')](_0x2491dd[_0x78a9('0x67')],_[_0x78a9('0x6d')](_0x2491dd['variable'])[0x0],_0x2491dd[_0x78a9('0x97')]);if(this[_0x78a9('0x10')][_0x2491dd['uniqueid']]){var _0x54e851=_[_0x78a9('0x7b')](this['queueReports'][_0x2491dd[_0x78a9('0x67')]]);if(_0x54e851){if(this[_0x78a9('0x59')](_0x2491dd[_0x78a9('0x98')])&&this[_0x78a9('0x59')](_0x2491dd[_0x78a9('0x98')][_0x78a9('0x99')])){switch(_0x2491dd[_0x78a9('0x97')]){case _0x78a9('0x9a'):_0x54e851[_0x78a9('0x84')]=![];_0x54e851[_0x78a9('0x8b')]=null;break;case'TIMEOUT':_0x54e851[_0x78a9('0x9b')]='timeout';ami[_0x78a9('0x40')]('custom:timeout',_0x54e851);break;default:_0x54e851[_0x78a9('0x84')]=!![];_0x54e851[_0x78a9('0x8b')]=moment()['format'](_0x78a9('0x76'));_0x54e851[_0x78a9('0x7c')]=moment()[_0x78a9('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}_0x54e851['queuecallerabandon']=![];_0x54e851[_0x78a9('0x75')]=null;_0x54e851[_0x78a9('0x77')]=_0x2491dd['value'];this['channels'][_0x2491dd[_0x78a9('0x67')]]=_0x54e851;this[_0x78a9('0x3e')](_0x54e851);}else if(this[_0x78a9('0x59')](_0x2491dd[_0x78a9('0x98')])&&this[_0x78a9('0x59')](_0x2491dd[_0x78a9('0x98')][_0x78a9('0x9c')])){if(!_0x54e851[_0x78a9('0x9d')]){_0x54e851['queuecallerexit']=!![];_0x54e851['queuecallerexitAt']=moment()['format'](_0x78a9('0x76'));_0x54e851[_0x78a9('0x77')]=_0x78a9('0x9e');_0x54e851[_0x78a9('0x7c')]=moment()['format'](_0x78a9('0x76'));this[_0x78a9('0x33')][_0x2491dd[_0x78a9('0x67')]]=_0x54e851;}}_0x54e851['variables']=this[_0x78a9('0x16')][_0x2491dd['uniqueid']];}}}}catch(_0x30c131){logger['error']('[syncVarSet][VoiceQueueReport]',util['inspect'](_0x30c131,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x2411f2,_0x1cd0d4,_0x5b4012){var _0x47b334=[_0x78a9('0x9f'),_0x78a9('0xa0'),_0x78a9('0xa1'),_0x78a9('0xa2'),_0x78a9('0xa3'),_0x78a9('0xa4'),_0x78a9('0xa5'),'rtpaudioqosrttbridged',_0x78a9('0xa6'),_0x78a9('0xa7'),_0x78a9('0xa8'),'bridgepvtcallid',_0x78a9('0xa9'),_0x78a9('0xaa'),'memberinterface',_0x78a9('0xab'),_0x78a9('0x83'),_0x78a9('0xac'),_0x78a9('0xad')];if(!_[_0x78a9('0x35')](_0x1cd0d4)&&!_['includes'](_0x47b334,_0x1cd0d4)){if(_['isUndefined'](this['variables'][_0x2411f2])){this['variables'][_0x2411f2]={};}this['variables'][_0x2411f2][_0x1cd0d4]=_0x5b4012;}};VoiceQueueReport[_0x78a9('0xb')][_0x78a9('0x23')]=function(_0x329af3){try{if(this[_0x78a9('0x59')](_0x329af3)){if(this[_0x78a9('0x10')][_0x329af3[_0x78a9('0x67')]]){for(var _0x5ccec9=0x0,_0x59be20={};_0x5ccec90x0?_0x11a42d:0x0;this[_0xe3ab('0x41')][_0x1b154d['queue']]['talking']=this[_0xe3ab('0x41')][_0x1b154d[_0xe3ab('0x61')]][_0xe3ab('0x65')]>_[_0xe3ab('0x64')](_0x1b154d[_0xe3ab('0x66')])?_[_0xe3ab('0x64')](_0x1b154d[_0xe3ab('0x66')]):this['voiceQueues'][_0x1b154d[_0xe3ab('0x61')]][_0xe3ab('0x65')];this['emitVoiceQueueSummary'](this[_0xe3ab('0x41')][_0x1b154d[_0xe3ab('0x61')]]);}ami[_0xe3ab('0x43')](_0xe3ab('0x67'),this[_0xe3ab('0x41')][_0x1b154d['queue']]);}}}catch(_0x2c24df){logger[_0xe3ab('0x3e')](_0xe3ab('0x68'),util['inspect'](_0x2c24df,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe3ab('0xc')][_0xe3ab('0x18')]=function(_0x3afacc){this[_0xe3ab('0x12')]=!![];};VoiceQueueReport[_0xe3ab('0xc')][_0xe3ab('0x69')]=function(_0x36abe5){};VoiceQueueReport['prototype'][_0xe3ab('0x1a')]=function(_0x50fe63){try{if(this['isNotNull'](_0x50fe63)){if(_[_0xe3ab('0x2c')](this['queueReports'][_0x50fe63[_0xe3ab('0x6a')]])){this[_0xe3ab('0xf')][_0x50fe63[_0xe3ab('0x6a')]]=[];this[_0xe3ab('0x35')][_0x50fe63[_0xe3ab('0x6a')]]={};}var _0x537806=new QueueReport();_0x537806['name']=_0x50fe63['queue'];_0x537806[_0xe3ab('0x56')]=this[_0xe3ab('0x41')][_0x537806[_0xe3ab('0x47')]]&&this[_0xe3ab('0x41')][_0x537806['name']][_0xe3ab('0x56')]?this[_0xe3ab('0x41')][_0x537806[_0xe3ab('0x47')]][_0xe3ab('0x56')]||_0xe3ab('0x4d'):_0xe3ab('0x4d');_0x537806[_0xe3ab('0x61')]=_0x50fe63[_0xe3ab('0x61')];_0x537806['queuecallerjoinAt']=moment()[_0xe3ab('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x537806[_0xe3ab('0x6b')]=_0x50fe63['position'];_0x537806[_0xe3ab('0x6c')]=_0x50fe63[_0xe3ab('0x6c')];_[_0xe3ab('0x6d')](_0x537806,_[_0xe3ab('0x6e')](_0x50fe63,_[_0xe3ab('0x6f')](_0x537806)));this[_0xe3ab('0xf')][_0x50fe63[_0xe3ab('0x6a')]][_0xe3ab('0x70')](_0x537806);this[_0xe3ab('0x35')][_0x50fe63[_0xe3ab('0x6a')]]=_0x537806;this[_0xe3ab('0x44')](_0x537806);}}catch(_0x462d41){logger[_0xe3ab('0x3e')](_0xe3ab('0x71'),util[_0xe3ab('0x42')](_0x462d41,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe3ab('0xc')][_0xe3ab('0x1c')]=function(_0x2f6613){try{if(this['isNotNull'](_0x2f6613)){if(this[_0xe3ab('0xf')][_0x2f6613[_0xe3ab('0x6a')]]){var _0x32f147=_[_0xe3ab('0x72')](this['queueReports'][_0x2f6613[_0xe3ab('0x6a')]]);_0x32f147[_0xe3ab('0x73')]=![];_0x32f147['queuecallercompleteAt']=null;_0x32f147[_0xe3ab('0x74')]=_0x2f6613[_0xe3ab('0x74')];_0x32f147[_0xe3ab('0x75')]=_0x2f6613['originalposition'];_0x32f147['queuecallerabandon']=!![];_0x32f147['queuecallerabandonAt']=moment()[_0xe3ab('0x45')](_0xe3ab('0x76'));_0x32f147[_0xe3ab('0x77')]=_0xe3ab('0x78');_0x32f147[_0xe3ab('0x79')]=null;this[_0xe3ab('0x35')][_0x2f6613[_0xe3ab('0x6a')]]=_0x32f147;this[_0xe3ab('0x49')](_0x32f147);}}}catch(_0x300f90){logger[_0xe3ab('0x3e')]('[syncQueueCallerAbandon][VoiceQueueReport]',util['inspect'](_0x300f90,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe3ab('0xc')]['syncQueueCallerLeave']=function(_0x41d3cc){try{if(this[_0xe3ab('0x5c')](_0x41d3cc)){if(this[_0xe3ab('0xf')][_0x41d3cc[_0xe3ab('0x6a')]]){var _0xe06175=_['last'](this[_0xe3ab('0xf')][_0x41d3cc[_0xe3ab('0x6a')]]);_0xe06175['queuecallerleaveAt']=moment()[_0xe3ab('0x45')](_0xe3ab('0x76'));_0xe06175['connectedlinenum']=_0x41d3cc[_0xe3ab('0x7a')];_0xe06175[_0xe3ab('0x7b')]=_0x41d3cc[_0xe3ab('0x7b')];this[_0xe3ab('0x35')][_0x41d3cc['uniqueid']]=_0xe06175;this[_0xe3ab('0x44')](_0xe06175);}}}catch(_0x405b92){logger[_0xe3ab('0x3e')](_0xe3ab('0x7c'),util[_0xe3ab('0x42')](_0x405b92,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe3ab('0xc')][_0xe3ab('0x21')]=function(_0xc75fd4){try{if(this[_0xe3ab('0x5c')](_0xc75fd4)){if(this[_0xe3ab('0xf')][_0xc75fd4[_0xe3ab('0x6a')]]){var _0x169a59=_[_0xe3ab('0x72')](this[_0xe3ab('0xf')][_0xc75fd4['uniqueid']]);_0x169a59[_0xe3ab('0x73')]=!![];_0x169a59[_0xe3ab('0x77')]=_0xe3ab('0x7d');}}}catch(_0x594817){logger[_0xe3ab('0x3e')]('[syncAgentConnect][VoiceQueueReport]',util[_0xe3ab('0x42')](_0x594817,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe3ab('0xc')][_0xe3ab('0x1f')]=function(_0xdc2198){try{if(this[_0xe3ab('0x5c')](_0xdc2198)){if(this[_0xe3ab('0xf')][_0xdc2198[_0xe3ab('0x6a')]]){var _0x452773=_[_0xe3ab('0x72')](this[_0xe3ab('0xf')][_0xdc2198[_0xe3ab('0x6a')]]);_0x452773[_0xe3ab('0x1b')]=![];_0x452773[_0xe3ab('0x7e')]=null;_0x452773['assigned']=!![];_0x452773[_0xe3ab('0x79')]=_0xdc2198['membername'];_0x452773[_0xe3ab('0x74')]=_0xdc2198[_0xe3ab('0x74')];_0x452773[_0xe3ab('0x73')]=!![];_0x452773[_0xe3ab('0x7f')]=![];_0x452773[_0xe3ab('0x80')]=null;if(!_0x452773['transfer']){if(_0xdc2198[_0xe3ab('0x81')]=='transfer'){_0x452773[_0xe3ab('0x77')]=_0xe3ab('0x82');}else{if(_[_0xe3ab('0x83')](_0xdc2198['channel'][_0xe3ab('0x84')](),_0xe3ab('0x85'))){if(this['queueReports'][_0xdc2198[_0xe3ab('0x86')]]){var _0x1c29cb=_[_0xe3ab('0x72')](this[_0xe3ab('0xf')][_0xdc2198[_0xe3ab('0x86')]]);_0x1c29cb[_0xe3ab('0x73')]=![];_0x1c29cb[_0xe3ab('0x7f')]=!![];_0x1c29cb[_0xe3ab('0x80')]=moment(_0x452773[_0xe3ab('0x87')])[_0xe3ab('0x88')](_0xdc2198[_0xe3ab('0x74')],_0xe3ab('0x89'))[_0xe3ab('0x45')](_0xe3ab('0x76'));_0x1c29cb['queuecallerexitreason']=_0xe3ab('0x8a');_0x1c29cb[_0xe3ab('0x8b')]=!![];_0x1c29cb[_0xe3ab('0x8c')]='FORWARD';_0x1c29cb['transferexten']=_0xdc2198[_0xe3ab('0x8d')];_0x1c29cb[_0xe3ab('0x8e')]=_0xdc2198[_0xe3ab('0x6a')];var _0x30d3f7=this['queueReports'][_0xdc2198[_0xe3ab('0x86')]];this[_0xe3ab('0xf')][_0xdc2198['linkedid']]=this['queueReports'][_0xdc2198[_0xe3ab('0x6a')]];this[_0xe3ab('0xf')][_0xdc2198[_0xe3ab('0x6a')]]=_0x30d3f7;}}else{_0x452773[_0xe3ab('0x77')]=_0xe3ab('0x8f')+_0xdc2198['reason'][_0xe3ab('0x90')]();}}}this['channels'][_0xdc2198[_0xe3ab('0x6a')]]=_0x452773;this[_0xe3ab('0x49')](_0x452773);}}}catch(_0x211767){logger[_0xe3ab('0x3e')](_0xe3ab('0x91'),util['inspect'](_0x211767,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe3ab('0x23')]=function(_0x361d6f){try{if(this['isNotNull'](_0x361d6f)){this['addVariable'](_0x361d6f[_0xe3ab('0x6a')],_[_0xe3ab('0x6f')](_0x361d6f['variable'])[0x0],_0x361d6f[_0xe3ab('0x92')]);if(this[_0xe3ab('0xf')][_0x361d6f[_0xe3ab('0x6a')]]){var _0x417cd1=_[_0xe3ab('0x72')](this['queueReports'][_0x361d6f[_0xe3ab('0x6a')]]);if(_0x417cd1){if(this[_0xe3ab('0x5c')](_0x361d6f[_0xe3ab('0x93')])&&this[_0xe3ab('0x5c')](_0x361d6f['variable'][_0xe3ab('0x94')])){switch(_0x361d6f[_0xe3ab('0x92')]){case _0xe3ab('0x95'):_0x417cd1['queuecallerexit']=![];_0x417cd1[_0xe3ab('0x80')]=null;break;case'TIMEOUT':_0x417cd1[_0xe3ab('0x96')]=_0xe3ab('0x97');ami[_0xe3ab('0x43')](_0xe3ab('0x98'),_0x417cd1);break;default:_0x417cd1[_0xe3ab('0x7f')]=!![];_0x417cd1['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x417cd1['queuecallerleaveAt']=moment()['format'](_0xe3ab('0x76'));}_0x417cd1[_0xe3ab('0x1b')]=![];_0x417cd1[_0xe3ab('0x7e')]=null;_0x417cd1[_0xe3ab('0x77')]=_0x361d6f['value'];this[_0xe3ab('0x35')][_0x361d6f[_0xe3ab('0x6a')]]=_0x417cd1;this[_0xe3ab('0x49')](_0x417cd1);}else if(this['isNotNull'](_0x361d6f['variable'])&&this[_0xe3ab('0x5c')](_0x361d6f[_0xe3ab('0x93')]['queueposition'])){if(!_0x417cd1[_0xe3ab('0x1b')]){_0x417cd1[_0xe3ab('0x7f')]=!![];_0x417cd1[_0xe3ab('0x80')]=moment()[_0xe3ab('0x45')](_0xe3ab('0x76'));_0x417cd1[_0xe3ab('0x77')]='EXITWITHKEY';_0x417cd1[_0xe3ab('0x99')]=moment()[_0xe3ab('0x45')](_0xe3ab('0x76'));this['channels'][_0x361d6f['uniqueid']]=_0x417cd1;}}_0x417cd1[_0xe3ab('0x14')]=this[_0xe3ab('0x14')][_0x361d6f[_0xe3ab('0x6a')]];}}}}catch(_0x44aec9){logger['error'](_0xe3ab('0x9a'),util[_0xe3ab('0x42')](_0x44aec9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe3ab('0x9b')]=function(_0x1a1378,_0x426c28,_0x3d7d8d){var _0x5a66f6=['rtpaudioqos','rtpaudioqosbridged',_0xe3ab('0x9c'),_0xe3ab('0x9d'),_0xe3ab('0x9e'),'rtpaudioqoslossbridged',_0xe3ab('0x9f'),'rtpaudioqosrttbridged',_0xe3ab('0xa0'),_0xe3ab('0xa1'),_0xe3ab('0xa2'),_0xe3ab('0xa3'),_0xe3ab('0xa4'),_0xe3ab('0xa5'),_0xe3ab('0xa6'),'memberlastcall','membername',_0xe3ab('0xa7'),_0xe3ab('0xa8')];if(!_[_0xe3ab('0x36')](_0x426c28)&&!_[_0xe3ab('0xa9')](_0x5a66f6,_0x426c28)){if(_[_0xe3ab('0x2c')](this[_0xe3ab('0x14')][_0x1a1378])){this[_0xe3ab('0x14')][_0x1a1378]={};}this['variables'][_0x1a1378][_0x426c28]=_0x3d7d8d;}};VoiceQueueReport['prototype'][_0xe3ab('0x24')]=function(_0x4b8398){try{if(this['isNotNull'](_0x4b8398)){if(this[_0xe3ab('0xf')][_0x4b8398['uniqueid']]){for(var _0x227334=0x0,_0x5f0b77={};_0x227334=0x0?moment(_0x3cc811[_0x4c85('0x16')])['diff'](_0x3cc811[_0x4c85('0x15')],_0x4c85('0x17')):null,'data1':'outbound','data2':_0x3cc811[_0x4c85('0xe')],'data3':_0x3cc811[_0x4c85('0xc')],'data4':_0x3cc811['dialstring']||null,'role':'agent','internal':_0x3cc811[_0x4c85('0xe')]?_[_0x4c85('0xf')](_0x3cc811['accountcode']):undefined,'uniqueid':_0x3cc811['uniqueid']},'log':_0x4c85('0x11')});}; \ No newline at end of file +var _0xb5e1=['TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','endtime','starttime','exten','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s'];(function(_0x1ffa1a,_0x29f3e6){var _0x50e3a3=function(_0x4202d3){while(--_0x4202d3){_0x1ffa1a['push'](_0x1ffa1a['shift']());}};_0x50e3a3(++_0x29f3e6);}(_0xb5e1,0x189));var _0x1b5e=function(_0x3d2a37,_0x1655a8){_0x3d2a37=_0x3d2a37-0x0;var _0x56d50f=_0xb5e1[_0x3d2a37];return _0x56d50f;};'use strict';var moment=require(_0x1b5e('0x0'));var _=require(_0x1b5e('0x1'));var util=require(_0x1b5e('0x2'));var client=require(_0x1b5e('0x3'));exports[_0x1b5e('0x4')]=function(_0x352310){var _0x2da524=_0x352310[_0x1b5e('0x5')]||_0x352310['queuecallerexitAt'];return client[_0x1b5e('0x6')](_0x1b5e('0x7'),{'body':{'channel':_0x1b5e('0x8'),'membername':_0x352310[_0x1b5e('0x9')],'interface':_[_0x1b5e('0xa')](_0x352310[_0x1b5e('0xb')])?util['format'](_0x1b5e('0xc'),_0x352310[_0x1b5e('0x9')]):_0x352310[_0x1b5e('0xb')],'type':_0x1b5e('0xd'),'enterAt':_0x352310[_0x1b5e('0xe')],'exitAt':_0x2da524,'duration':moment(_0x2da524)[_0x1b5e('0xf')](_0x352310[_0x1b5e('0xe')],_0x1b5e('0x10')),'data1':_0x1b5e('0x11'),'data2':_0x352310[_0x1b5e('0x12')],'data3':_0x352310['exten'],'data4':null,'data5':_0x352310[_0x1b5e('0x13')],'role':_0x1b5e('0x14'),'internal':_0x352310[_0x1b5e('0x15')]?_[_0x1b5e('0x16')](_0x352310[_0x1b5e('0x15')]):undefined,'uniqueid':_0x352310[_0x1b5e('0x17')]},'log':_0x1b5e('0x7')});};exports[_0x1b5e('0x18')]=function(_0x1e8374){return client[_0x1b5e('0x6')](_0x1b5e('0x7'),{'body':{'channel':_0x1b5e('0x8'),'membername':_0x1e8374[_0x1b5e('0x19')],'interface':_0x1e8374[_0x1b5e('0xb')],'type':_0x1b5e('0xd'),'enterAt':_0x1e8374['starttime'],'exitAt':_0x1e8374[_0x1b5e('0x1a')],'duration':moment(_0x1e8374['endtime'])[_0x1b5e('0xf')](_0x1e8374['starttime'],_0x1b5e('0x10'))>=0x0?moment(_0x1e8374['endtime'])['diff'](_0x1e8374[_0x1b5e('0x1b')],'seconds'):null,'data1':'outbound','data2':_0x1e8374['accountcode'],'data3':_0x1e8374[_0x1b5e('0x1c')],'data4':_0x1e8374['dialstring']||null,'role':_0x1b5e('0x14'),'internal':_0x1e8374[_0x1b5e('0x15')]?_[_0x1b5e('0x16')](_0x1e8374['accountcode']):undefined,'uniqueid':_0x1e8374[_0x1b5e('0x17')]},'log':_0x1b5e('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index e1e43cd..dbbbd62 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 _0xbf6e=['html','Request','GetTemplate','name'];(function(_0x573241,_0xb968af){var _0x1c5d0e=function(_0x192212){while(--_0x192212){_0x573241['push'](_0x573241['shift']());}};_0x1c5d0e(++_0xb968af);}(_0xbf6e,0x149));var _0xebf6=function(_0x3626fe,_0x33dbfd){_0x3626fe=_0x3626fe-0x0;var _0x23e475=_0xbf6e[_0x3626fe];return _0x23e475;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x1f94d5){return function(_0x2b658d){return client[_0xebf6('0x0')](_0xebf6('0x1'),{'options':{'raw':!![],'attributes':['id',_0xebf6('0x2'),_0xebf6('0x3')]},'log':_0xebf6('0x1')});};}; \ No newline at end of file +var _0x2bc6=['html','../client','getTemplates'];(function(_0x4613ae,_0xd99114){var _0x29eb26=function(_0x355fe8){while(--_0x355fe8){_0x4613ae['push'](_0x4613ae['shift']());}};_0x29eb26(++_0xd99114);}(_0x2bc6,0x163));var _0x62bc=function(_0x3ba671,_0x40d517){_0x3ba671=_0x3ba671-0x0;var _0x1a610d=_0x2bc6[_0x3ba671];return _0x1a610d;};'use strict';var client=require(_0x62bc('0x0'));exports[_0x62bc('0x1')]=function(_0x3b71d5){return function(_0x56939b){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x62bc('0x2')]},'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 7c4029d..57c72ec 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 _0x9cb2=['data7','../client','getTriggers','GetTrigger','name','channel','Condition','field','operator','value','AnyConditions','Action','action','data1','data3','data4','data5','data6'];(function(_0x4ed40a,_0x1502b0){var _0x4dfc9a=function(_0x15d17b){while(--_0x15d17b){_0x4ed40a['push'](_0x4ed40a['shift']());}};_0x4dfc9a(++_0x1502b0);}(_0x9cb2,0xc7));var _0x29cb=function(_0x316b9f,_0x56bc64){_0x316b9f=_0x316b9f-0x0;var _0x353d01=_0x9cb2[_0x316b9f];return _0x353d01;};'use strict';var client=require(_0x29cb('0x0'));exports[_0x29cb('0x1')]=function(_0xfc05e6){return function(_0x259194){return client['Request'](_0x29cb('0x2'),{'options':{'raw':![],'attributes':['id',_0x29cb('0x3'),_0x29cb('0x4'),'status'],'include':[{'model':_0x29cb('0x5'),'as':'AllConditions','attributes':['id',_0x29cb('0x6'),_0x29cb('0x7'),_0x29cb('0x8')]},{'model':_0x29cb('0x5'),'as':_0x29cb('0x9'),'attributes':['id',_0x29cb('0x6'),_0x29cb('0x7'),'value']},{'model':_0x29cb('0xa'),'as':'Actions','attributes':['id',_0x29cb('0xb'),_0x29cb('0xc'),'data2',_0x29cb('0xd'),_0x29cb('0xe'),_0x29cb('0xf'),_0x29cb('0x10'),_0x29cb('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xb279=['channel','status','Condition','AllConditions','field','operator','value','Action','Actions','action','data1','data2','data4','data5','data6','../client','getTriggers','GetTrigger'];(function(_0x17c8cc,_0x5e5647){var _0x3db4eb=function(_0x2082db){while(--_0x2082db){_0x17c8cc['push'](_0x17c8cc['shift']());}};_0x3db4eb(++_0x5e5647);}(_0xb279,0x165));var _0x9b27=function(_0x417f13,_0x5821b9){_0x417f13=_0x417f13-0x0;var _0x326c65=_0xb279[_0x417f13];return _0x326c65;};'use strict';var client=require(_0x9b27('0x0'));exports[_0x9b27('0x1')]=function(_0x5491c9){return function(_0x3a3368){return client['Request'](_0x9b27('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9b27('0x3'),_0x9b27('0x4')],'include':[{'model':_0x9b27('0x5'),'as':_0x9b27('0x6'),'attributes':['id',_0x9b27('0x7'),_0x9b27('0x8'),_0x9b27('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x9b27('0x7'),_0x9b27('0x8'),_0x9b27('0x9')]},{'model':_0x9b27('0xa'),'as':_0x9b27('0xb'),'attributes':['id',_0x9b27('0xc'),_0x9b27('0xd'),_0x9b27('0xe'),'data3',_0x9b27('0xf'),_0x9b27('0x10'),_0x9b27('0x11'),'data7']}]},'log':_0x9b27('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 4e3a027..f34ec95 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 _0xf4fa=['name','registry','GetTrunk','getTrunks','Request'];(function(_0x3d2c09,_0x5eff70){var _0x70316f=function(_0x264379){while(--_0x264379){_0x3d2c09['push'](_0x3d2c09['shift']());}};_0x70316f(++_0x5eff70);}(_0xf4fa,0x107));var _0xaf4f=function(_0x54fc83,_0x3e2f6a){_0x54fc83=_0x54fc83-0x0;var _0x5a0ec0=_0xf4fa[_0x54fc83];return _0x5a0ec0;};'use strict';var client=require('../client');exports[_0xaf4f('0x0')]=function(_0x49cb99){return function(_0x3da9a9){return client[_0xaf4f('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xaf4f('0x2'),_0xaf4f('0x3')]},'log':_0xaf4f('0x4')});};}; \ No newline at end of file +var _0xcd5c=['name','getTrunks','Request','GetTrunk'];(function(_0x54b76c,_0x4596b6){var _0x355906=function(_0x3d32a7){while(--_0x3d32a7){_0x54b76c['push'](_0x54b76c['shift']());}};_0x355906(++_0x4596b6);}(_0xcd5c,0x69));var _0xccd5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcd5c[_0x4565bf];return _0x5610ba;};'use strict';var client=require('../client');exports[_0xccd5('0x0')]=function(_0x3e1fca){return function(_0x265820){return client[_0xccd5('0x1')](_0xccd5('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xccd5('0x3'),'registry']},'log':_0xccd5('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index c7e4ba1..c6b16fa 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 _0x5f29=['savePause','saveUnpause','UnpauseUser','fullname','voicePause','getAgent','../client','getAgents','Request','GetUser','agent','name','email','accountcode','online','lastLoginAt','pauseType','lastPauseAt','phone','mobile','interface','telephone','internal','getTelephones'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x5f29,0x126));var _0x95f2=function(_0x165bf3,_0x49fcfc){_0x165bf3=_0x165bf3-0x0;var _0xd12540=_0x5f29[_0x165bf3];return _0xd12540;};'use strict';var client=require(_0x95f2('0x0'));exports[_0x95f2('0x1')]=function(){return function(){return client[_0x95f2('0x2')](_0x95f2('0x3'),{'options':{'raw':![],'where':{'role':_0x95f2('0x4')},'attributes':['id',_0x95f2('0x5'),_0x95f2('0x6'),_0x95f2('0x7'),'fullname',_0x95f2('0x8'),_0x95f2('0x9'),_0x95f2('0xa'),_0x95f2('0xb'),'voicePause',_0x95f2('0xc'),_0x95f2('0xd'),_0x95f2('0xe')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0x95f2('0x2')](_0x95f2('0x3'),{'options':{'raw':!![],'where':{'role':_0x95f2('0xf')},'attributes':['id',_0x95f2('0x5'),_0x95f2('0x7'),_0x95f2('0x10')]},'log':_0x95f2('0x11')});};};exports[_0x95f2('0x12')]=function(_0x1579ec,_0x1f4895,_0x16cbd4){return client['Request']('PauseUser',{'body':{'type':_0x1f4895,'uniqueid':_0x16cbd4},'options':{'where':{'id':_0x1579ec['id']}},'log':'savePause'});};exports[_0x95f2('0x13')]=function(_0x57fed4){return client[_0x95f2('0x2')](_0x95f2('0x14'),{'body':{},'options':{'where':{'id':_0x57fed4['id']}},'log':_0x95f2('0x12')});};exports['getAgent']=function(_0x47b583){return client[_0x95f2('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x95f2('0x4'),'id':_0x47b583},'attributes':['id',_0x95f2('0x5'),_0x95f2('0x6'),_0x95f2('0x7'),_0x95f2('0x15'),_0x95f2('0x8'),_0x95f2('0x9'),'pauseType','lastPauseAt',_0x95f2('0x16'),_0x95f2('0xe')]},'log':_0x95f2('0x17')});}; \ No newline at end of file +var _0xf8a8=['voicePause','phone','mobile','interface','getTelephones','GetUser','telephone','accountcode','internal','savePause','PauseUser','saveUnpause','Request','UnpauseUser','getAgent','ShowUser','agent','lastLoginAt','lastPauseAt','../client','name','email','fullname','online','pauseType'];(function(_0x35b190,_0x340522){var _0x322e9e=function(_0x8911ab){while(--_0x8911ab){_0x35b190['push'](_0x35b190['shift']());}};_0x322e9e(++_0x340522);}(_0xf8a8,0x126));var _0x8f8a=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xf8a8[_0x4c7fb5];return _0x2e10ac;};'use strict';var client=require(_0x8f8a('0x0'));exports['getAgents']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x8f8a('0x1'),_0x8f8a('0x2'),'accountcode',_0x8f8a('0x3'),_0x8f8a('0x4'),'lastLoginAt',_0x8f8a('0x5'),'lastPauseAt',_0x8f8a('0x6'),_0x8f8a('0x7'),_0x8f8a('0x8'),_0x8f8a('0x9')]},'log':'getAgents'});};};exports[_0x8f8a('0xa')]=function(){return function(){return client['Request'](_0x8f8a('0xb'),{'options':{'raw':!![],'where':{'role':_0x8f8a('0xc')},'attributes':['id',_0x8f8a('0x1'),_0x8f8a('0xd'),_0x8f8a('0xe')]},'log':_0x8f8a('0xa')});};};exports[_0x8f8a('0xf')]=function(_0x5c31aa,_0x1a78d5,_0x4bcfd4){return client['Request'](_0x8f8a('0x10'),{'body':{'type':_0x1a78d5,'uniqueid':_0x4bcfd4},'options':{'where':{'id':_0x5c31aa['id']}},'log':_0x8f8a('0xf')});};exports[_0x8f8a('0x11')]=function(_0x29faae){return client[_0x8f8a('0x12')](_0x8f8a('0x13'),{'body':{},'options':{'where':{'id':_0x29faae['id']}},'log':_0x8f8a('0xf')});};exports[_0x8f8a('0x14')]=function(_0x33d6d7){return client[_0x8f8a('0x12')](_0x8f8a('0x15'),{'options':{'raw':![],'where':{'role':_0x8f8a('0x16'),'id':_0x33d6d7},'attributes':['id',_0x8f8a('0x1'),'email',_0x8f8a('0xd'),_0x8f8a('0x3'),'online',_0x8f8a('0x17'),_0x8f8a('0x5'),_0x8f8a('0x18'),_0x8f8a('0x6'),_0x8f8a('0x9')]},'log':_0x8f8a('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index d99d1ca..22ac16e 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 _0xff14=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x1ebb10,_0x156b3e){var _0x20d709=function(_0x4cc093){while(--_0x4cc093){_0x1ebb10['push'](_0x1ebb10['shift']());}};_0x20d709(++_0x156b3e);}(_0xff14,0x1ca));var _0x4ff1=function(_0x253fb5,_0x1fe76d){_0x253fb5=_0x253fb5-0x0;var _0x179359=_0xff14[_0x253fb5];return _0x179359;};'use strict';var client=require(_0x4ff1('0x0'));exports[_0x4ff1('0x1')]=function(_0x4a6134){return client[_0x4ff1('0x2')](_0x4ff1('0x3'),{'body':_0x4a6134,'log':_0x4ff1('0x3')});};exports[_0x4ff1('0x4')]=function(_0x5b9afc,_0x3e5af7,_0x3857b3){return client[_0x4ff1('0x2')](_0x4ff1('0x5'),{'body':_0x5b9afc,'options':{'where':{'uniqueid':_0x3e5af7,'interface':_0x3857b3,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x62ed=['update','UpdateVoiceAgentReport','create','CreateVoiceAgentReport'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x62ed,0x18e));var _0xd62e=function(_0x117f99,_0x32cea4){_0x117f99=_0x117f99-0x0;var _0x27dd8c=_0x62ed[_0x117f99];return _0x27dd8c;};'use strict';var client=require('../client');exports[_0xd62e('0x0')]=function(_0xe2aebc){return client['Request'](_0xd62e('0x1'),{'body':_0xe2aebc,'log':_0xd62e('0x1')});};exports[_0xd62e('0x2')]=function(_0x94c426,_0x2c395c,_0x53f931){return client['Request'](_0xd62e('0x3'),{'body':_0x94c426,'options':{'where':{'uniqueid':_0x2c395c,'interface':_0x53f931,'agentcomplete':!![]}},'log':_0xd62e('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index c247537..ba9864a 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 _0x6d9a=['format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','disposition','duration','billableseconds','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','getVoiceCallReports','Request'];(function(_0x48bdb2,_0x229521){var _0x4a2a40=function(_0x2cd6b7){while(--_0x2cd6b7){_0x48bdb2['push'](_0x48bdb2['shift']());}};_0x4a2a40(++_0x229521);}(_0x6d9a,0x115));var _0xa6d9=function(_0x128b31,_0x577fb7){_0x128b31=_0x128b31-0x0;var _0x8c5b38=_0x6d9a[_0x128b31];return _0x8c5b38;};'use strict';var moment=require(_0xa6d9('0x0'));var util=require(_0xa6d9('0x1'));var _=require(_0xa6d9('0x2'));var client=require(_0xa6d9('0x3'));exports[_0xa6d9('0x4')]=function(_0x2a5131){return client['Request'](_0xa6d9('0x5'),{'body':_[_0xa6d9('0x6')](_0x2a5131,{'source':_0x2a5131[_0xa6d9('0x7')],'destinationcontext':_0x2a5131[_0xa6d9('0x8')],'callerid':_0x2a5131['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0xa6d9('0x9')]=function(){return function(){return client[_0xa6d9('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf']('day')[_0xa6d9('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xa6d9('0xc')](_0xa6d9('0xd'))[_0xa6d9('0xb')](_0xa6d9('0xe'))]}},'attributes':['type',_0xa6d9('0xf'),_0xa6d9('0x10'),_0xa6d9('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x4157=['disposition','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format'];(function(_0x188887,_0x1511ad){var _0x1af43a=function(_0x40c630){while(--_0x40c630){_0x188887['push'](_0x188887['shift']());}};_0x1af43a(++_0x1511ad);}(_0x4157,0x1ba));var _0x7415=function(_0x2f49a7,_0xe63f9e){_0x2f49a7=_0x2f49a7-0x0;var _0x551aeb=_0x4157[_0x2f49a7];return _0x551aeb;};'use strict';var moment=require(_0x7415('0x0'));var util=require('util');var _=require(_0x7415('0x1'));var client=require(_0x7415('0x2'));exports[_0x7415('0x3')]=function(_0x46e0c4){return client[_0x7415('0x4')](_0x7415('0x5'),{'body':_[_0x7415('0x6')](_0x46e0c4,{'source':_0x46e0c4[_0x7415('0x7')],'destinationcontext':_0x46e0c4[_0x7415('0x8')],'callerid':_0x46e0c4[_0x7415('0x9')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x7415('0xa')]=function(){return function(){return client[_0x7415('0x4')](_0x7415('0xb'),{'options':{'where':{'type':[_0x7415('0xc')],'createdAt':{'$between':[moment()[_0x7415('0xd')](_0x7415('0xe'))['format'](_0x7415('0xf')),moment()[_0x7415('0x10')](_0x7415('0xe'))[_0x7415('0x11')](_0x7415('0xf'))]}},'attributes':['type',_0x7415('0x12'),'duration','billableseconds']},'log':_0x7415('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 6964628..b2b30cc 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 _0x9beb=['create','CreateVoiceDialReport'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9beb,0xdc));var _0xb9be=function(_0x3a99ca,_0x1e1db9){_0x3a99ca=_0x3a99ca-0x0;var _0x4c7bf9=_0x9beb[_0x3a99ca];return _0x4c7bf9;};'use strict';var client=require('../client');exports[_0xb9be('0x0')]=function(_0x20d5b0){return client['Request'](_0xb9be('0x1'),{'body':_0x20d5b0,'log':_0xb9be('0x1')});}; \ No newline at end of file +var _0xe2b1=['CreateVoiceDialReport','create','Request'];(function(_0x5f0d4d,_0x4a30d2){var _0xd14c2=function(_0x450232){while(--_0x450232){_0x5f0d4d['push'](_0x5f0d4d['shift']());}};_0xd14c2(++_0x4a30d2);}(_0xe2b1,0x1a8));var _0x1e2b=function(_0x326142,_0x31bb07){_0x326142=_0x326142-0x0;var _0x16ebf5=_0xe2b1[_0x326142];return _0x16ebf5;};'use strict';var client=require('../client');exports[_0x1e2b('0x0')]=function(_0x5ed26c){return client[_0x1e2b('0x1')](_0x1e2b('0x2'),{'body':_0x5ed26c,'log':_0x1e2b('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index c08fe32..c8c851b 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 _0x9ffd=['../client','getVoiceExtensions','Request','exten','recordingFormat'];(function(_0x98f636,_0x40a8bc){var _0x2c7481=function(_0x2b6d67){while(--_0x2b6d67){_0x98f636['push'](_0x98f636['shift']());}};_0x2c7481(++_0x40a8bc);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x480a11,_0x598ff2){_0x480a11=_0x480a11-0x0;var _0xfee687=_0x9ffd[_0x480a11];return _0xfee687;};'use strict';var client=require(_0xd9ff('0x0'));exports[_0xd9ff('0x1')]=function(){return function(){return client[_0xd9ff('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xd9ff('0x3'),_0xd9ff('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xd9ff('0x1')});};}; \ No newline at end of file +var _0x0962=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x46828d,_0x155a60){var _0x75212f=function(_0x43fc48){while(--_0x43fc48){_0x46828d['push'](_0x46828d['shift']());}};_0x75212f(++_0x155a60);}(_0x0962,0x116));var _0x2096=function(_0x1f638f,_0xb06346){_0x1f638f=_0x1f638f-0x0;var _0x583077=_0x0962[_0x1f638f];return _0x583077;};'use strict';var client=require(_0x2096('0x0'));exports[_0x2096('0x1')]=function(){return function(){return client[_0x2096('0x2')](_0x2096('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2096('0x4'),_0x2096('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x2096('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c7a9651..e92fc74 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 _0xa619=['dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','../client','getVoiceQueues','GetVoiceQueue','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0xa619,0x182));var _0x9a61=function(_0x3d38a5,_0x24dee2){_0x3d38a5=_0x3d38a5-0x0;var _0x14fe9a=_0xa619[_0x3d38a5];return _0x14fe9a;};'use strict';var client=require(_0x9a61('0x0'));exports[_0x9a61('0x1')]=function(){return function(){return client['Request'](_0x9a61('0x2'),{'options':{'raw':![],'attributes':['id',_0x9a61('0x3'),'acw','acwTimeout',_0x9a61('0x4'),_0x9a61('0x5'),_0x9a61('0x6'),_0x9a61('0x7'),_0x9a61('0x8'),'dialLimitChannel',_0x9a61('0x9'),_0x9a61('0xa'),_0x9a61('0xb'),_0x9a61('0xc'),_0x9a61('0xd'),_0x9a61('0xe'),_0x9a61('0xf'),_0x9a61('0x10'),_0x9a61('0x11'),_0x9a61('0x12'),_0x9a61('0x13'),_0x9a61('0x14'),_0x9a61('0x15'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x9a61('0x16'),'dialNoAnswerRetryFrequency',_0x9a61('0x17'),'dialTimezone',_0x9a61('0x18'),_0x9a61('0x19'),_0x9a61('0x1a'),_0x9a61('0x1b'),_0x9a61('0x1c'),'dialAMDGreeting',_0x9a61('0x1d'),_0x9a61('0x1e'),_0x9a61('0x1f'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x9a61('0x20'),_0x9a61('0x21'),'timeout','dialRecallMeTimeout',_0x9a61('0x22'),'dialOrderByScheduledAt',_0x9a61('0x23'),_0x9a61('0x24'),_0x9a61('0x25'),_0x9a61('0x5'),_0x9a61('0x26'),_0x9a61('0x27'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0x9a61('0x28'),'dialDropMaxRetry',_0x9a61('0x29'),_0x9a61('0x2a'),_0x9a61('0x2b'),'dialMachineMaxRetry',_0x9a61('0x2c'),'dialAgentRejectMaxRetry',_0x9a61('0x2d'),_0x9a61('0x2e'),_0x9a61('0x2f'),_0x9a61('0x30')],'include':[{'model':_0x9a61('0x31'),'as':_0x9a61('0x31'),'attributes':['id',_0x9a61('0x3'),'callerid',_0x9a61('0x32')]},{'model':_0x9a61('0x33'),'as':_0x9a61('0x34'),'attributes':['id',_0x9a61('0x3')]},{'model':_0x9a61('0x31'),'as':_0x9a61('0x35'),'attributes':['id',_0x9a61('0x3'),_0x9a61('0x36'),'active']},{'model':_0x9a61('0x37'),'as':_0x9a61('0x37'),'attributes':['id',_0x9a61('0x3')],'include':[{'model':_0x9a61('0x37'),'as':'Intervals','attributes':['id',_0x9a61('0x3'),_0x9a61('0x38')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x7584=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','mandatoryDispositionPause','active','Interval','Intervals','../client','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject'];(function(_0x6ae7be,_0x3830b2){var _0xff7e70=function(_0x55ce46){while(--_0x55ce46){_0x6ae7be['push'](_0x6ae7be['shift']());}};_0xff7e70(++_0x3830b2);}(_0x7584,0xd4));var _0x4758=function(_0x10c115,_0x147ec2){_0x10c115=_0x10c115-0x0;var _0x165f36=_0x7584[_0x10c115];return _0x165f36;};'use strict';var client=require(_0x4758('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x4758('0x1'),{'options':{'raw':![],'attributes':['id',_0x4758('0x2'),'acw',_0x4758('0x3'),_0x4758('0x4'),_0x4758('0x5'),_0x4758('0x6'),'dialActive',_0x4758('0x7'),'dialLimitChannel',_0x4758('0x8'),_0x4758('0x9'),_0x4758('0xa'),'dialPredictiveOptimizationPercentage',_0x4758('0xb'),'dialOriginateCallerIdName',_0x4758('0xc'),_0x4758('0xd'),_0x4758('0xe'),'dialQueueTimeout',_0x4758('0xf'),_0x4758('0x10'),_0x4758('0x11'),'dialBusyMaxRetry',_0x4758('0x12'),_0x4758('0x13'),_0x4758('0x14'),_0x4758('0x15'),_0x4758('0x16'),_0x4758('0x17'),_0x4758('0x18'),'dialCheckDuplicateType',_0x4758('0x19'),'dialAMDInitialSilence',_0x4758('0x1a'),_0x4758('0x1b'),_0x4758('0x1c'),_0x4758('0x1d'),_0x4758('0x1e'),_0x4758('0x1f'),'dialAMDSilenceThreshold',_0x4758('0x20'),'timeout',_0x4758('0x21'),'dialRecallInQueue','dialOrderByScheduledAt',_0x4758('0x22'),_0x4758('0x23'),_0x4758('0x24'),_0x4758('0x5'),_0x4758('0x25'),_0x4758('0x26'),_0x4758('0x27'),'dialNoSuchNumberMaxRetry',_0x4758('0x28'),_0x4758('0x29'),_0x4758('0x2a'),'dialAbandonedMaxRetry',_0x4758('0x2b'),_0x4758('0x2c'),_0x4758('0x2d'),_0x4758('0x2e'),_0x4758('0x2f'),_0x4758('0x30'),_0x4758('0x31'),_0x4758('0x32')],'include':[{'model':_0x4758('0x33'),'as':_0x4758('0x33'),'attributes':['id','name',_0x4758('0x34'),'active']},{'model':'Pause','as':_0x4758('0x35'),'attributes':['id',_0x4758('0x2')]},{'model':_0x4758('0x33'),'as':'TrunkBackup','attributes':['id',_0x4758('0x2'),'callerid',_0x4758('0x36')]},{'model':'Interval','as':_0x4758('0x37'),'attributes':['id',_0x4758('0x2')],'include':[{'model':_0x4758('0x37'),'as':_0x4758('0x38'),'attributes':['id',_0x4758('0x2'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ec129f9..889ab3e 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 _0xef0a=['GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt'];(function(_0x191c9e,_0x2fa108){var _0x409289=function(_0x14a93d){while(--_0x14a93d){_0x191c9e['push'](_0x191c9e['shift']());}};_0x409289(++_0x2fa108);}(_0xef0a,0xdd));var _0xaef0=function(_0x190c00,_0xeebb5b){_0x190c00=_0x190c00-0x0;var _0xa11640=_0xef0a[_0x190c00];return _0xa11640;};'use strict';var moment=require(_0xaef0('0x0'));var _=require(_0xaef0('0x1'));var client=require(_0xaef0('0x2'));exports[_0xaef0('0x3')]=function(_0x2e0672){return client[_0xaef0('0x4')](_0xaef0('0x5'),{'body':_0x2e0672,'log':_0xaef0('0x5')});};exports[_0xaef0('0x6')]=function(){return function(){return client[_0xaef0('0x4')](_0xaef0('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xaef0('0x8'))[_0xaef0('0x9')](_0xaef0('0xa')),moment()[_0xaef0('0xb')]('day')['format'](_0xaef0('0xa'))]}},'attributes':[_0xaef0('0xc'),_0xaef0('0xd'),_0xaef0('0xe'),_0xaef0('0xf'),_0xaef0('0x10'),_0xaef0('0x11'),_0xaef0('0x12'),_0xaef0('0x13'),'queuecallerabandon',_0xaef0('0x14')]},'log':_0xaef0('0x15')});};}; \ No newline at end of file +var _0x44f6=['queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandonAt','GetVoiceQueueReports','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerjoinAt'];(function(_0x346e50,_0x498042){var _0x5b2edc=function(_0x1bb5fd){while(--_0x1bb5fd){_0x346e50['push'](_0x346e50['shift']());}};_0x5b2edc(++_0x498042);}(_0x44f6,0x116));var _0x644f=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x44f6[_0x599e60];return _0x468e19;};'use strict';var moment=require('moment');var _=require('lodash');var client=require('../client');exports[_0x644f('0x0')]=function(_0x1ae0c4){return client[_0x644f('0x1')](_0x644f('0x2'),{'body':_0x1ae0c4,'log':_0x644f('0x2')});};exports[_0x644f('0x3')]=function(){return function(){return client[_0x644f('0x1')](_0x644f('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x644f('0x5'))[_0x644f('0x6')](_0x644f('0x7')),moment()[_0x644f('0x8')]('day')[_0x644f('0x6')](_0x644f('0x7'))]}},'attributes':['uniqueid',_0x644f('0x9'),_0x644f('0xa'),_0x644f('0xb'),_0x644f('0xc'),_0x644f('0xd'),_0x644f('0xe'),'queuecallerexitAt','queuecallerabandon',_0x644f('0xf')]},'log':_0x644f('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 4e7448f..3781ac4 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 _0xff96=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x52cb4a,_0x217996){var _0x2d84e7=function(_0x1ecdb2){while(--_0x1ecdb2){_0x52cb4a['push'](_0x52cb4a['shift']());}};_0x2d84e7(++_0x217996);}(_0xff96,0x1f2));var _0x6ff9=function(_0x503a0c,_0xbc78c5){_0x503a0c=_0x503a0c-0x0;var _0x3b2e83=_0xff96[_0x503a0c];return _0x3b2e83;};'use strict';var client=require(_0x6ff9('0x0'));exports[_0x6ff9('0x1')]=function(_0xe0bfe7){return function(){return client[_0x6ff9('0x2')](_0x6ff9('0x3'),{'options':{'where':{'VoiceQueueId':_0xe0bfe7,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xb635=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0xb635,0x11b));var _0x5b63=function(_0x3eba35,_0x1e4788){_0x3eba35=_0x3eba35-0x0;var _0x4ad432=_0xb635[_0x3eba35];return _0x4ad432;};'use strict';var client=require('../client');exports[_0x5b63('0x0')]=function(_0x29f176){return function(){return client[_0x5b63('0x1')](_0x5b63('0x2'),{'options':{'where':{'VoiceQueueId':_0x29f176,'paused':!![]},'raw':!![]},'log':_0x5b63('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c6c34ac..da899a7 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 _0x99b2=['create','Request','CreateVoiceRecording','merge','monitorFilename','lodash'];(function(_0x59930e,_0x114ca7){var _0x5093a3=function(_0x2f9e69){while(--_0x2f9e69){_0x59930e['push'](_0x59930e['shift']());}};_0x5093a3(++_0x114ca7);}(_0x99b2,0x11f));var _0x299b=function(_0x2675ca,_0x2b0dd7){_0x2675ca=_0x2675ca-0x0;var _0x44a1a4=_0x99b2[_0x2675ca];return _0x44a1a4;};'use strict';var _=require(_0x299b('0x0'));var client=require('../client');exports[_0x299b('0x1')]=function(_0x1de2ce){return client[_0x299b('0x2')](_0x299b('0x3'),{'body':_[_0x299b('0x4')](_0x1de2ce,{'value':_0x1de2ce[_0x299b('0x5')]}),'log':_0x299b('0x3')});}; \ No newline at end of file +var _0x8966=['create','Request','monitorFilename','lodash','../client'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x8966,0x1ed));var _0x6896=function(_0x1f9996,_0x4ba9bb){_0x1f9996=_0x1f9996-0x0;var _0x23c175=_0x8966[_0x1f9996];return _0x23c175;};'use strict';var _=require(_0x6896('0x0'));var client=require(_0x6896('0x1'));exports[_0x6896('0x2')]=function(_0x299b3d){return client[_0x6896('0x3')]('CreateVoiceRecording',{'body':_['merge'](_0x299b3d,{'value':_0x299b3d[_0x6896('0x4')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 068e14c..b07f421 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 _0x8fc6=['Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereelinkedid','context','blind','attendedTransfer','result','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','blindTransfer'];(function(_0x32d6c3,_0x36288e){var _0x5cf4bc=function(_0x51538f){while(--_0x51538f){_0x32d6c3['push'](_0x32d6c3['shift']());}};_0x5cf4bc(++_0x36288e);}(_0x8fc6,0x6d));var _0x68fc=function(_0x3e0991,_0x4f7df4){_0x3e0991=_0x3e0991-0x0;var _0xea4798=_0x8fc6[_0x3e0991];return _0xea4798;};'use strict';var client=require(_0x68fc('0x0'));exports[_0x68fc('0x1')]=function(_0x3476ff){return client[_0x68fc('0x2')](_0x68fc('0x3'),{'body':{'result':_0x3476ff['result'],'transfererchannel':_0x3476ff[_0x68fc('0x4')],'transferercalleridnum':_0x3476ff[_0x68fc('0x5')],'transferercalleridname':_0x3476ff[_0x68fc('0x6')],'transfererconnectedlinenum':_0x3476ff[_0x68fc('0x7')],'transfererconnectedlinename':_0x3476ff[_0x68fc('0x8')],'transfereraccountcode':_0x3476ff[_0x68fc('0x9')],'transferercontext':_0x3476ff[_0x68fc('0xa')],'transfererexten':_0x3476ff[_0x68fc('0xb')],'transfererlinkedid':_0x3476ff['transfererlinkedid'],'transfereechannel':_0x3476ff[_0x68fc('0xc')],'transfereecalleridnum':_0x3476ff[_0x68fc('0xd')],'transfereecalleridname':_0x3476ff[_0x68fc('0xe')],'transfereeconnectedlinenum':_0x3476ff['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x3476ff['transfereeconnectedlinename'],'transfereeaccountcode':_0x3476ff[_0x68fc('0xf')],'transfereecontext':_0x3476ff[_0x68fc('0x10')],'transfereeexten':_0x3476ff['transfereeexten'],'transfereelinkedid':_0x3476ff[_0x68fc('0x11')],'isexternal':_0x3476ff['isexternal'],'context':_0x3476ff[_0x68fc('0x12')],'extension':_0x3476ff['extension'],'type':_0x68fc('0x13')},'log':_0x68fc('0x3')});};exports[_0x68fc('0x14')]=function(_0x429c4a){return client[_0x68fc('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x429c4a[_0x68fc('0x15')],'transfererchannel':_0x429c4a[_0x68fc('0x16')],'transferercalleridnum':_0x429c4a['origtransferercalleridnum'],'transferercalleridname':_0x429c4a['origtransferercalleridname'],'transfererconnectedlinenum':_0x429c4a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x429c4a[_0x68fc('0x17')],'transfereraccountcode':_0x429c4a[_0x68fc('0x18')],'transferercontext':_0x429c4a[_0x68fc('0x19')],'transfererexten':_0x429c4a[_0x68fc('0x1a')],'transfererlinkedid':_0x429c4a[_0x68fc('0x1b')],'transfereechannel':_0x429c4a['transfertargetchannel'],'transfereecalleridnum':_0x429c4a['transfertargetcalleridnum'],'transfereecalleridname':_0x429c4a['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x429c4a[_0x68fc('0x1c')],'transfereeconnectedlinename':_0x429c4a[_0x68fc('0x1d')],'transfereeaccountcode':_0x429c4a[_0x68fc('0x1e')],'transfereecontext':_0x429c4a['transfertargetcontext'],'transfereeexten':_0x429c4a[_0x68fc('0x1f')],'transfereelinkedid':_0x429c4a[_0x68fc('0x20')],'isexternal':_0x429c4a[_0x68fc('0x21')],'context':_0x429c4a[_0x68fc('0x22')],'extension':_0x429c4a[_0x68fc('0x23')],'type':_0x68fc('0x24')},'log':_0x68fc('0x3')});}; \ No newline at end of file +var _0x3440=['transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename'];(function(_0xff6511,_0x703fd5){var _0x40be3a=function(_0x190615){while(--_0x190615){_0xff6511['push'](_0xff6511['shift']());}};_0x40be3a(++_0x703fd5);}(_0x3440,0xbc));var _0x0344=function(_0x350f68,_0x5b7fe3){_0x350f68=_0x350f68-0x0;var _0x25c858=_0x3440[_0x350f68];return _0x25c858;};'use strict';var client=require(_0x0344('0x0'));exports[_0x0344('0x1')]=function(_0x52adce){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x52adce[_0x0344('0x2')],'transfererchannel':_0x52adce[_0x0344('0x3')],'transferercalleridnum':_0x52adce[_0x0344('0x4')],'transferercalleridname':_0x52adce[_0x0344('0x5')],'transfererconnectedlinenum':_0x52adce['transfererconnectedlinenum'],'transfererconnectedlinename':_0x52adce[_0x0344('0x6')],'transfereraccountcode':_0x52adce[_0x0344('0x7')],'transferercontext':_0x52adce[_0x0344('0x8')],'transfererexten':_0x52adce[_0x0344('0x9')],'transfererlinkedid':_0x52adce[_0x0344('0xa')],'transfereechannel':_0x52adce[_0x0344('0xb')],'transfereecalleridnum':_0x52adce[_0x0344('0xc')],'transfereecalleridname':_0x52adce[_0x0344('0xd')],'transfereeconnectedlinenum':_0x52adce[_0x0344('0xe')],'transfereeconnectedlinename':_0x52adce['transfereeconnectedlinename'],'transfereeaccountcode':_0x52adce[_0x0344('0xf')],'transfereecontext':_0x52adce[_0x0344('0x10')],'transfereeexten':_0x52adce['transfereeexten'],'transfereelinkedid':_0x52adce[_0x0344('0x11')],'isexternal':_0x52adce[_0x0344('0x12')],'context':_0x52adce[_0x0344('0x13')],'extension':_0x52adce[_0x0344('0x14')],'type':_0x0344('0x15')},'log':_0x0344('0x16')});};exports[_0x0344('0x17')]=function(_0x49531d){return client[_0x0344('0x18')](_0x0344('0x16'),{'body':{'result':_0x49531d[_0x0344('0x2')],'transfererchannel':_0x49531d[_0x0344('0x19')],'transferercalleridnum':_0x49531d[_0x0344('0x1a')],'transferercalleridname':_0x49531d[_0x0344('0x1b')],'transfererconnectedlinenum':_0x49531d[_0x0344('0x1c')],'transfererconnectedlinename':_0x49531d['secondtransfererconnectedlinename'],'transfereraccountcode':_0x49531d[_0x0344('0x1d')],'transferercontext':_0x49531d[_0x0344('0x1e')],'transfererexten':_0x49531d[_0x0344('0x1f')],'transfererlinkedid':_0x49531d['origtransfererlinkedid'],'transfereechannel':_0x49531d['transfertargetchannel'],'transfereecalleridnum':_0x49531d['transfertargetcalleridnum'],'transfereecalleridname':_0x49531d[_0x0344('0x20')],'transfereeconnectedlinenum':_0x49531d['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x49531d[_0x0344('0x21')],'transfereeaccountcode':_0x49531d[_0x0344('0x22')],'transfereecontext':_0x49531d['transfertargetcontext'],'transfereeexten':_0x49531d[_0x0344('0x23')],'transfereelinkedid':_0x49531d[_0x0344('0x24')],'isexternal':_0x49531d['isexternal'],'context':_0x49531d[_0x0344('0x25')],'extension':_0x49531d[_0x0344('0x26')],'type':'attended'},'log':_0x0344('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 3a6a183..367484f 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 _0xd155=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','values','channels','length','map','find','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','push','YYYY-MM-DD\x20HH:mm:ss','rec','status','uniqueid','MixMonitor\x20Success','mixmonitorid','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','trunks','outboundChannels','campaigns','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','pick','module','Action','then','message','catch','isConnected','ami\x20disconnected','join','command','action','Command','content','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd155,0x15d));var _0x5d15=function(_0x2460d9,_0x15da87){_0x2460d9=_0x2460d9-0x0;var _0x4bc204=_0xd155[_0x2460d9];return _0x4bc204;};'use strict';var _=require(_0x5d15('0x0'));var util=require('util');var jayson=require(_0x5d15('0x1'));var schema=require(_0x5d15('0x2'));var BPromise=require(_0x5d15('0x3'));var moment=require(_0x5d15('0x4'));var config=require(_0x5d15('0x5'));var properties=require(_0x5d15('0x6'));var ami=require(_0x5d15('0x7'));exports['listen']=function(_0x124ab7,_0x105abb,_0x112daa){return new BPromise(function(_0x204aa8,_0x5c4156){var _0x3df375={'QueuePause':function(_0x139e94){return new Promise(function(_0x3ad398,_0x423cf7){var _0xce24a5=util[_0x5d15('0x8')](_0x5d15('0x9'),'SIP',_0x139e94[_0x5d15('0xa')]);if(_0x124ab7[_0x5d15('0xb')]&&_0x124ab7[_0x5d15('0xb')][_0xce24a5]&&_0x124ab7['timers'][_0xce24a5][_0x5d15('0xc')]){_0x124ab7[_0x5d15('0xb')][_0xce24a5][_0x5d15('0xd')]();}if(_0x124ab7[_0x5d15('0xe')][_0xce24a5]){_0x124ab7['agents'][_0xce24a5][_0x5d15('0xf')]({'statePause':_0x139e94[_0x5d15('0x10')]?!![]:![]});}_0x3ad398({'code':0xc8,'message':_0x5d15('0x11')});});},'Reload':function(_0x3d94be){var _0x21c88e=this;return new Promise(function(_0x21c43d,_0x242c38){if(ami['isConnected']()==![]){return _0x242c38(_0x21c88e[_0x5d15('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x5d15('0x13')][_0x5d15('0x14')],'ami\x20disconnected']['join']('\x20')));}_0x3d94be=_[_0x5d15('0x15')](_0x3d94be,_['keys'](properties[_0x5d15('0x16')]));_0x3d94be['action']='Reload';return ami[_0x5d15('0x17')](_0x3d94be)[_0x5d15('0x18')](function(_0x2c9f02){_0x21c43d({'code':0xc8,'message':_0x2c9f02[_0x5d15('0x19')]});})[_0x5d15('0x1a')](function(_0xeb167b){_0x242c38(_0x21c88e['error'](0x1f5,_0xeb167b[_0x5d15('0x19')]));});});},'Command':function(_0x55be35){var _0x450917=this;return new Promise(function(_0x3e3c00,_0x5e66ed){if(ami[_0x5d15('0x1b')]()==![]){return _0x5e66ed(_0x450917[_0x5d15('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x5d15('0x13')][_0x5d15('0x14')],_0x5d15('0x1c')][_0x5d15('0x1d')]('\x20')));}_0x55be35=_[_0x5d15('0x15')](_0x55be35,_0x5d15('0x1e'));_0x55be35[_0x5d15('0x1f')]=_0x5d15('0x20');return ami['Action'](_0x55be35)['then'](function(_0x8bcd5b){_0x3e3c00({'code':0xc8,'message':_0x8bcd5b[_0x5d15('0x21')]});})['catch'](function(_0x52407a){_0x5e66ed(_0x450917[_0x5d15('0x12')](0x1f5,_0x52407a['message']));});});},'VoiceQueues':function(_0x2186dc){return new Promise(function(_0x216494,_0x4fb2a2){var _0x128fb4=[];for(var _0x1b57f8 in _0x124ab7[_0x5d15('0x22')]){if(_0x124ab7[_0x5d15('0x22')]['hasOwnProperty'](_0x1b57f8)){var _0x260134=_0x124ab7[_0x5d15('0x22')][_0x1b57f8];var _0x2533de={'id':_0x260134['id'],'name':_0x260134['name'],'strategy':_0x260134[_0x5d15('0x23')],'answered':_0x260134[_0x5d15('0x24')],'available':_0x260134[_0x5d15('0x25')],'loggedIn':_0x260134[_0x5d15('0x26')],'pTalking':_0x260134[_0x5d15('0x27')],'sumBillable':_0x260134[_0x5d15('0x28')],'sumDuration':_0x260134[_0x5d15('0x29')],'sumHoldTime':_0x260134[_0x5d15('0x2a')]||0x0,'talking':_0x260134[_0x5d15('0x2b')],'total':_0x260134[_0x5d15('0x2c')],'type':_0x260134[_0x5d15('0x2d')],'unmanaged':_0x260134[_0x5d15('0x2e')],'abandoned':_0x260134[_0x5d15('0x2f')],'waiting':_0x260134['waiting'],'loggedInDb':_0x260134[_0x5d15('0x30')]};if(_0x260134[_0x5d15('0x2d')]==='outbound'){_0x2533de[_0x5d15('0x31')]=_0x260134['dialActive'];_0x2533de[_0x5d15('0x32')]=_0x260134[_0x5d15('0x32')];_0x2533de[_0x5d15('0x33')]=_0x260134[_0x5d15('0x33')];_0x2533de['dialOriginateCallerIdNumber']=_0x260134[_0x5d15('0x34')];_0x2533de[_0x5d15('0x35')]=_0x260134[_0x5d15('0x35')];_0x2533de[_0x5d15('0x36')]=_0x260134['dialPrefix'];_0x2533de[_0x5d15('0x37')]=_0x260134[_0x5d15('0x37')];_0x2533de['outboundAnswerCallsDay']=_0x260134[_0x5d15('0x38')];_0x2533de[_0x5d15('0x39')]=_0x260134[_0x5d15('0x39')];_0x2533de[_0x5d15('0x3a')]=_0x260134[_0x5d15('0x3a')];_0x2533de['outboundCongestionCallsDay']=_0x260134['outboundCongestionCallsDay'];_0x2533de['outboundDropCallsDayACS']=_0x260134[_0x5d15('0x3b')];_0x2533de[_0x5d15('0x3c')]=_0x260134[_0x5d15('0x3c')];_0x2533de['outboundDropCallsDayTimeout']=_0x260134[_0x5d15('0x3d')];_0x2533de[_0x5d15('0x3e')]=_0x260134[_0x5d15('0x3e')];_0x2533de[_0x5d15('0x3f')]=_0x260134[_0x5d15('0x3f')];_0x2533de[_0x5d15('0x40')]=_0x260134[_0x5d15('0x40')];_0x2533de[_0x5d15('0x41')]=_0x260134[_0x5d15('0x41')];_0x2533de[_0x5d15('0x42')]=_0x260134[_0x5d15('0x42')];_0x2533de['outboundUnknownCallsDay']=_0x260134[_0x5d15('0x43')];_0x2533de['predictiveIntervalAnsweredCalls']=_0x260134[_0x5d15('0x44')];_0x2533de[_0x5d15('0x45')]=_0x260134['predictiveIntervalAvgHoldtime'];_0x2533de[_0x5d15('0x46')]=_0x260134[_0x5d15('0x46')];_0x2533de[_0x5d15('0x47')]=_0x260134[_0x5d15('0x47')];_0x2533de['predictiveIntervalDroppedCallsTimeout']=_0x260134[_0x5d15('0x48')];_0x2533de[_0x5d15('0x49')]=_0x260134[_0x5d15('0x49')];_0x2533de[_0x5d15('0x4a')]=_0x260134['predictiveIntervalErlangCallsDroppedCalls'];_0x2533de[_0x5d15('0x4b')]=_0x260134[_0x5d15('0x4b')];_0x2533de[_0x5d15('0x4c')]=_0x260134[_0x5d15('0x4c')];_0x2533de['predictiveIntervalPauses']=_0x260134['predictiveIntervalPauses'];_0x2533de['predictiveIntervalAvailable']=_0x260134[_0x5d15('0x4d')];_0x2533de[_0x5d15('0x4e')]=_0x260134['predictiveIntervalTotalCalls'];_0x2533de[_0x5d15('0x19')]=_0x260134['message'];_0x2533de[_0x5d15('0x4f')]=_0x260134[_0x5d15('0x4f')];_0x2533de[_0x5d15('0x50')]=_0x260134[_0x5d15('0x50')];_0x2533de[_0x5d15('0x51')]=_0x260134[_0x5d15('0x51')];_0x2533de[_0x5d15('0x52')]=_0x260134[_0x5d15('0x52')];_0x2533de[_0x5d15('0x53')]=_0x260134['erlangBusyFactor'];_0x2533de[_0x5d15('0x54')]=_0x260134['startPredictive'];_0x2533de[_0x5d15('0x55')]=_0x260134['startProgressive'];}if(_0x260134[_0x5d15('0x56')]){_0x2533de[_0x5d15('0x56')]={'id':_0x260134[_0x5d15('0x56')]['id'],'name':_0x260134['Trunk']['name'],'active':_0x260134['Trunk']['active'],'callerid':_0x260134[_0x5d15('0x56')][_0x5d15('0x57')]};}if(_0x260134[_0x5d15('0x58')]){_0x2533de['Interval']={'id':_0x260134[_0x5d15('0x58')]['id'],'name':_0x260134[_0x5d15('0x58')][_0x5d15('0xa')]};}_0x128fb4['push'](_0x2533de);}}_0x216494({'count':_0x128fb4['length'],'rows':_0x128fb4});});},'VoiceChannels':function(_0x13dee2){return new Promise(function(_0x27a62d,_0x6fc771){var _0x5b9028=_[_0x5d15('0x59')](_0x124ab7[_0x5d15('0x5a')]);_0x27a62d({'count':_0x5b9028[_0x5d15('0x5b')],'rows':_0x5b9028});});},'VoiceChannelMixMonitor':function(_0x39d79f){var _0x372d52=this;return new Promise(function(_0x11ac1c,_0xc34865){if(ami['isConnected']()==![]){return _0xc34865(_0x372d52[_0x5d15('0x12')](0x1f4,[config[_0x5d15('0x13')]['ip'],config[_0x5d15('0x13')][_0x5d15('0x14')],_0x5d15('0x1c')][_0x5d15('0x1d')]('\x20')));}var _0x51cfd8=schema(properties['voicechannel'])['validate'](_0x39d79f);if(_0x51cfd8['length']>0x0){return _0xc34865(_0x372d52[_0x5d15('0x12')](0x1f4,_[_0x5d15('0x5c')](_0x51cfd8,_0x5d15('0x19'))[_0x5d15('0x1d')](',\x20')));}var _0x215e0a=_[_0x5d15('0x5d')](_0x124ab7[_0x5d15('0x5a')],{'uniqueid':_0x39d79f['uniqueid']});if(_0x215e0a&&_0x215e0a[_0x5d15('0x5e')]){var _0x2a85bf=util[_0x5d15('0x8')](_0x5d15('0x5f'),_0x39d79f['filename']||_0x39d79f['uniqueid'],_0x39d79f['format']||_0x5d15('0x60'));return ami[_0x5d15('0x17')]({'action':_0x5d15('0x61'),'channel':_0x215e0a[_0x5d15('0x5e')],'file':_0x2a85bf,'options':_0x5d15('0x62')})[_0x5d15('0x18')](function(_0x1d8483){var _0x2635c9=_[_0x5d15('0x5d')](_0x215e0a['monitors'],{'filename':_0x5d15('0x63')+_0x2a85bf[_0x5d15('0x64')]()});if(_[_0x5d15('0x65')](_0x2635c9)){_0x215e0a[_0x5d15('0x66')][_0x5d15('0x67')]({'filename':_0x5d15('0x63')+_0x2a85bf[_0x5d15('0x64')](),'createdAt':moment()[_0x5d15('0x8')](_0x5d15('0x68')),'mixmonitorid':_0x1d8483['mixmonitorid'],'status':_0x5d15('0x69')});}else{_0x2635c9['mixmonitorid']=_0x1d8483['mixmonitorid'];_0x2635c9[_0x5d15('0x6a')]=_0x5d15('0x69');}_0x11ac1c({'code':0xc8,'message':[_0x39d79f[_0x5d15('0x6b')],_0x5d15('0x6c'),_0x1d8483[_0x5d15('0x6d')]]['join']('\x20'),'mixmonitorid':_0x1d8483[_0x5d15('0x6d')]});})[_0x5d15('0x1a')](function(_0x20a00d){_0xc34865(_0x372d52[_0x5d15('0x12')](0x1f5,[_0x39d79f[_0x5d15('0x6b')],_0x20a00d[_0x5d15('0x19')][_0x5d15('0x64')]()][_0x5d15('0x1d')]('\x20')));});}else{return _0xc34865(_0x372d52[_0x5d15('0x12')](0x1f5,_0x5d15('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x4a5887){var _0x573a46=this;return new Promise(function(_0x217558,_0x4f1679){if(ami[_0x5d15('0x1b')]()==![]){return _0x4f1679(_0x573a46[_0x5d15('0x12')](0x1f4,[config[_0x5d15('0x13')]['ip'],config[_0x5d15('0x13')][_0x5d15('0x14')],_0x5d15('0x1c')][_0x5d15('0x1d')]('\x20')));}var _0x2103a4=schema(properties[_0x5d15('0x6f')])['validate'](_0x4a5887);if(_0x2103a4[_0x5d15('0x5b')]>0x0){return _0x4f1679(_0x573a46[_0x5d15('0x12')](0x1f4,_['map'](_0x2103a4,'message')['join'](',\x20')));}var _0x5a0fcb=_['find'](_0x124ab7[_0x5d15('0x5a')],{'uniqueid':_0x4a5887[_0x5d15('0x6b')]});if(_0x5a0fcb){return BPromise[_0x5d15('0x70')]()['then'](function(){if(_0x5a0fcb[_0x5d15('0x5e')]){return ami['Action']({'action':_0x5d15('0x71'),'channel':_0x5a0fcb[_0x5d15('0x5e')],'mixmonitorid':_0x4a5887[_0x5d15('0x6d')]})['catch'](function(_0x32d01f){});}})[_0x5d15('0x18')](function(){if(_0x5a0fcb[_0x5d15('0x72')]){return ami['Action']({'action':_0x5d15('0x71'),'channel':_0x5a0fcb[_0x5d15('0x72')],'mixmonitorid':_0x4a5887[_0x5d15('0x6d')]})[_0x5d15('0x1a')](function(_0x11fc9b){});}})['then'](function(_0x3b340e){var _0x183fb5=_[_0x5d15('0x5d')](_0x5a0fcb[_0x5d15('0x66')],{'mixmonitorid':_0x4a5887[_0x5d15('0x6d')]});if(_0x183fb5){_0x183fb5['status']=_0x5d15('0x73');}})[_0x5d15('0x18')](function(){var _0x3f9e91=util[_0x5d15('0x8')](_0x5d15('0x5f'),_0x4a5887['filename']||_0x4a5887['uniqueid'],_0x4a5887[_0x5d15('0x8')]||_0x5d15('0x60'));var _0x1cd1c3=_[_0x5d15('0x5d')](_0x5a0fcb[_0x5d15('0x66')],{'filename':_0x5d15('0x63')+_0x3f9e91[_0x5d15('0x64')]()});if(_0x1cd1c3){_0x1cd1c3[_0x5d15('0x6a')]='stop';}})['then'](function(){_0x217558({'code':0xc8,'message':[_0x4a5887[_0x5d15('0x6b')],_0x5d15('0x74')][_0x5d15('0x1d')]('\x20')});})[_0x5d15('0x1a')](function(_0x408338){_0x4f1679(_0x573a46['error'](0x1f5,[_0x4a5887[_0x5d15('0x6b')],_0x408338[_0x5d15('0x19')][_0x5d15('0x64')]()][_0x5d15('0x1d')]('\x20')));});}else{return _0x4f1679(_0x573a46[_0x5d15('0x12')](0x1f5,_0x5d15('0x6e')));}});},'VoiceQueuesChannels':function(_0x3f0525){return new Promise(function(_0x469e6c,_0x27101c){var _0x31ac27=_[_0x5d15('0x59')](_0x124ab7[_0x5d15('0x75')]);_0x469e6c({'count':_0x31ac27[_0x5d15('0x5b')],'rows':_0x31ac27});});},'VoiceQueuesChannel':function(_0x4e5c79){var _0x5a8ef6=this;return new Promise(function(_0x3a30ce,_0x1b6649){var _0x54a29c=schema(properties[_0x5d15('0x76')])[_0x5d15('0x2')](_0x4e5c79);if(_0x54a29c[_0x5d15('0x5b')]>0x0){return _0x1b6649(_0x5a8ef6[_0x5d15('0x12')](0x1f4,_[_0x5d15('0x5c')](_0x54a29c,_0x5d15('0x19'))[_0x5d15('0x1d')](',\x20')));}var _0x43b718=_[_0x5d15('0x5d')](_0x124ab7[_0x5d15('0x75')],{'uniqueid':_0x4e5c79[_0x5d15('0x6b')]});if(_0x43b718){_0x3a30ce(_0x43b718);}else{return _0x1b6649(_0x5a8ef6[_0x5d15('0x12')](0x1f5,_0x5d15('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x215813){var _0x462ece=this;return new Promise(function(_0x24640b,_0x35dcac){if(ami[_0x5d15('0x1b')]()==![]){return _0x35dcac(_0x462ece[_0x5d15('0x12')](0x1f4,[config[_0x5d15('0x13')]['ip'],config[_0x5d15('0x13')][_0x5d15('0x14')],'ami\x20disconnected']['join']('\x20')));}var _0x1f36c1=schema(properties[_0x5d15('0x77')])[_0x5d15('0x2')](_0x215813);if(_0x1f36c1[_0x5d15('0x5b')]>0x0){return _0x35dcac(_0x462ece['error'](0x1f4,_[_0x5d15('0x5c')](_0x1f36c1,_0x5d15('0x19'))[_0x5d15('0x1d')](',\x20')));}var _0x1ec1a3=_[_0x5d15('0x5d')](_0x124ab7[_0x5d15('0x75')],{'uniqueid':_0x215813[_0x5d15('0x6b')]});if(_0x1ec1a3&&_0x1ec1a3[_0x5d15('0x5e')]){return ami[_0x5d15('0x17')]({'action':_0x5d15('0x78'),'channel':_0x1ec1a3['channel']})[_0x5d15('0x18')](function(_0x52cb4c){_0x24640b({'code':0xc8,'message':[_0x215813[_0x5d15('0x6b')],_0x52cb4c[_0x5d15('0x19')]['toLowerCase']()][_0x5d15('0x1d')]('\x20')});})['catch'](function(_0x2384ac){_0x35dcac(_0x462ece[_0x5d15('0x12')](0x1f5,[_0x215813[_0x5d15('0x6b')],_0x2384ac[_0x5d15('0x19')][_0x5d15('0x64')]()]['join']('\x20')));});}else{return _0x35dcac(_0x462ece['error'](0x1f5,_0x5d15('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x5d2f93){var _0x2437ee=this;return new Promise(function(_0x46da68,_0x59cb86){if(ami[_0x5d15('0x1b')]()==![]){return _0x59cb86(_0x2437ee[_0x5d15('0x12')](0x1f4,[config[_0x5d15('0x13')]['ip'],config[_0x5d15('0x13')][_0x5d15('0x14')],_0x5d15('0x1c')][_0x5d15('0x1d')]('\x20')));}var _0xceacf5=schema(properties[_0x5d15('0x79')])[_0x5d15('0x2')](_0x5d2f93);if(_0xceacf5[_0x5d15('0x5b')]>0x0){return _0x59cb86(_0x2437ee[_0x5d15('0x12')](0x1f4,_['map'](_0xceacf5,'message')[_0x5d15('0x1d')](',\x20')));}var _0x46b33c=_[_0x5d15('0x5d')](_0x124ab7[_0x5d15('0x75')],{'uniqueid':_0x5d2f93[_0x5d15('0x6b')]});if(_0x46b33c&&_0x46b33c[_0x5d15('0x5e')]){return ami['Action']({'action':'Redirect','channel':_0x46b33c[_0x5d15('0x5e')],'exten':_0x5d2f93[_0x5d15('0x7a')],'context':_0x5d2f93[_0x5d15('0x7b')]||_0x46b33c['context'],'priority':0x1})[_0x5d15('0x18')](function(_0x578fe5){_0x46da68({'code':0xc8,'message':[_0x5d2f93['uniqueid'],_0x578fe5[_0x5d15('0x19')][_0x5d15('0x64')]()][_0x5d15('0x1d')]('\x20')});})[_0x5d15('0x1a')](function(_0x234ba3){_0x59cb86(_0x2437ee[_0x5d15('0x12')](0x1f5,[_0x5d2f93[_0x5d15('0x6b')],_0x234ba3[_0x5d15('0x19')]['toLowerCase']()]['join']('\x20')));});}else{return _0x59cb86(_0x2437ee[_0x5d15('0x12')](0x1f5,_0x5d15('0x6e')));}});},'Agents':function(_0x2b8bbc){return new Promise(function(_0x38e8d0,_0x5a2280){var _0x3fe721=_[_0x5d15('0x59')](_0x124ab7[_0x5d15('0xe')]);_0x38e8d0({'count':_0x3fe721['length'],'rows':_0x3fe721});});},'Telephones':function(_0x412387){return new Promise(function(_0x41f126,_0x542d1b){var _0x1ac1e0=_[_0x5d15('0x59')](_0x124ab7['telephones']);_0x41f126({'count':_0x1ac1e0[_0x5d15('0x5b')],'rows':_0x1ac1e0});});},'Trunks':function(_0x2a0054){return new Promise(function(_0x338e50,_0xb621f3){var _0x36b99e=_[_0x5d15('0x59')](_0x124ab7[_0x5d15('0x7c')]);_0x338e50({'count':_0x36b99e[_0x5d15('0x5b')],'rows':_0x36b99e});});},'OutboundChannels':function(_0x2dc3c3){return new Promise(function(_0x16de6b,_0x56b694){var _0x1d331d=_[_0x5d15('0x59')](_0x124ab7[_0x5d15('0x7d')]);_0x16de6b({'count':_0x1d331d['length'],'rows':_0x1d331d});});},'Outbound':function(_0x5d3f39){return new Promise(function(_0x4e2142,_0x227a92){_0x4e2142(_0x124ab7['outbound']);});},'Campaigns':function(_0x29c62b){return new Promise(function(_0x16d277,_0x438f63){var _0x27d043=_[_0x5d15('0x59')](_0x124ab7[_0x5d15('0x7e')]);_0x16d277({'count':_0x27d043[_0x5d15('0x5b')],'rows':_0x27d043});});},'VoiceQueuesPreview':function(_0x7f09ba){var _0x5407b1=this;return new Promise(function(_0x78535f,_0x7ae008){_0x105abb['run'](_0x7f09ba['id'])[_0x5d15('0x18')](function(_0x21656a){_0x78535f({'code':0xc8,'message':_0x21656a['message']});})[_0x5d15('0x1a')](function(_0x1622ef){_0x7ae008(_0x5407b1['error'](0x1f4,_0x1622ef[_0x5d15('0x19')]));});});},'EventManager':function(_0x4ec0fe){var _0x17a9c8=this;return new Promise(function(_0x11df46,_0x308256){if(!_0x4ec0fe['event']){return _0x308256(_0x17a9c8[_0x5d15('0x12')](0x1f4,_0x5d15('0x7f')));}ami[_0x5d15('0x80')](_0x5d15('0x81')+_0x4ec0fe[_0x5d15('0x82')],_0x4ec0fe[_0x5d15('0x19')]);_0x11df46({'code':0xc8,'message':_0x4ec0fe});});},'FaxAccounts':function(_0x424dcd){return new Promise(function(_0x583bad,_0x15ee9c){var _0x5b1c85=_['values'](_0x124ab7[_0x5d15('0x83')]);_0x583bad({'count':_0x5b1c85['length'],'rows':_0x5b1c85});});},'SendFax':function(_0x2b3029){var _0x4adf5e=this;return new Promise(function(_0x4a9d91,_0x1d60de){_0x112daa[_0x5d15('0x84')](_0x2b3029)[_0x5d15('0x18')](function(_0x4b95ca){_0x4a9d91({'code':0xc8,'message':_0x4b95ca[_0x5d15('0x19')]});})['catch'](function(_0x50726b){_0x1d60de(_0x4adf5e['error'](0x1f4,_0x50726b[_0x5d15('0x19')]));});});},'CheckAfterSend':function(_0x165ef5){var _0x2ea391=this;return new Promise(function(_0x76acb3,_0x30c8b2){_0x112daa[_0x5d15('0x85')](_0x165ef5)['then'](function(_0x1ee105){_0x76acb3({'code':0xc8,'message':_0x1ee105['message']});})[_0x5d15('0x1a')](function(_0x3449f3){_0x30c8b2(_0x2ea391[_0x5d15('0x12')](0x1f4,_0x3449f3['message']));});});}};var _0x1ec340=jayson[_0x5d15('0x86')](_0x3df375)[_0x5d15('0x87')]();_0x1ec340['on'](_0x5d15('0x12'),function(_0xf26af){return _0x5c4156(_0xf26af);});_0x1ec340[_0x5d15('0x88')](0x232a,_0x5d15('0x89'),function(){console['log'](_0x5d15('0x8a'),0x232a);return _0x204aa8(_0x5d15('0x8b')+0x232a);});});}; \ No newline at end of file +var _0x004d=['module','action','Reload','Action','then','message','catch','error','isConnected','ami\x20disconnected','command','content','voiceQueues','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','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','length','values','channels','voicechannel','map','find','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','validate','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','trunks','outbound','run','event','emit','custom:','faxAccounts','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../ami','listen','%s/%s','name','timers','timer','updateAcw','agents','QueuePause','asterisk','username','join','pick'];(function(_0x4f4b99,_0xb89ce6){var _0x489dfe=function(_0x14578c){while(--_0x14578c){_0x4f4b99['push'](_0x4f4b99['shift']());}};_0x489dfe(++_0xb89ce6);}(_0x004d,0xfb));var _0xd004=function(_0x28c40e,_0x2d2390){_0x28c40e=_0x28c40e-0x0;var _0x53380c=_0x004d[_0x28c40e];return _0x53380c;};'use strict';var _=require(_0xd004('0x0'));var util=require(_0xd004('0x1'));var jayson=require(_0xd004('0x2'));var schema=require('validate');var BPromise=require(_0xd004('0x3'));var moment=require(_0xd004('0x4'));var config=require(_0xd004('0x5'));var properties=require('../properties');var ami=require(_0xd004('0x6'));exports[_0xd004('0x7')]=function(_0x2392aa,_0x15ba36,_0x16889f){return new BPromise(function(_0x37af7b,_0x3de0b5){var _0x1a82d7={'QueuePause':function(_0x6f5d1){return new Promise(function(_0x1ab23b,_0x45699a){var _0x404772=util['format'](_0xd004('0x8'),'SIP',_0x6f5d1[_0xd004('0x9')]);if(_0x2392aa[_0xd004('0xa')]&&_0x2392aa[_0xd004('0xa')][_0x404772]&&_0x2392aa['timers'][_0x404772][_0xd004('0xb')]){_0x2392aa[_0xd004('0xa')][_0x404772][_0xd004('0xc')]();}if(_0x2392aa[_0xd004('0xd')][_0x404772]){_0x2392aa[_0xd004('0xd')][_0x404772]['updateStatusRealtime']({'statePause':_0x6f5d1['pause']?!![]:![]});}_0x1ab23b({'code':0xc8,'message':_0xd004('0xe')});});},'Reload':function(_0x1149b8){var _0x55e5c2=this;return new Promise(function(_0x127292,_0x465c05){if(ami['isConnected']()==![]){return _0x465c05(_0x55e5c2['error'](0x1f4,[config[_0xd004('0xf')]['ip'],config[_0xd004('0xf')][_0xd004('0x10')],'ami\x20disconnected'][_0xd004('0x11')]('\x20')));}_0x1149b8=_[_0xd004('0x12')](_0x1149b8,_['keys'](properties[_0xd004('0x13')]));_0x1149b8[_0xd004('0x14')]=_0xd004('0x15');return ami[_0xd004('0x16')](_0x1149b8)[_0xd004('0x17')](function(_0x117c3e){_0x127292({'code':0xc8,'message':_0x117c3e[_0xd004('0x18')]});})[_0xd004('0x19')](function(_0x2581f2){_0x465c05(_0x55e5c2[_0xd004('0x1a')](0x1f5,_0x2581f2['message']));});});},'Command':function(_0x1a1283){var _0x389d63=this;return new Promise(function(_0x4cfa64,_0x477ec1){if(ami[_0xd004('0x1b')]()==![]){return _0x477ec1(_0x389d63['error'](0x1f4,[config[_0xd004('0xf')]['ip'],config[_0xd004('0xf')]['username'],_0xd004('0x1c')][_0xd004('0x11')]('\x20')));}_0x1a1283=_[_0xd004('0x12')](_0x1a1283,_0xd004('0x1d'));_0x1a1283['action']='Command';return ami[_0xd004('0x16')](_0x1a1283)['then'](function(_0x6e0a0e){_0x4cfa64({'code':0xc8,'message':_0x6e0a0e[_0xd004('0x1e')]});})[_0xd004('0x19')](function(_0x146ea5){_0x477ec1(_0x389d63[_0xd004('0x1a')](0x1f5,_0x146ea5['message']));});});},'VoiceQueues':function(_0x3cb7d6){return new Promise(function(_0x15b001,_0x170b97){var _0x4a1b43=[];for(var _0x16d5b6 in _0x2392aa[_0xd004('0x1f')]){if(_0x2392aa['voiceQueues']['hasOwnProperty'](_0x16d5b6)){var _0x1388c1=_0x2392aa['voiceQueues'][_0x16d5b6];var _0x2a8572={'id':_0x1388c1['id'],'name':_0x1388c1[_0xd004('0x9')],'strategy':_0x1388c1['strategy'],'answered':_0x1388c1[_0xd004('0x20')],'available':_0x1388c1[_0xd004('0x21')],'loggedIn':_0x1388c1[_0xd004('0x22')],'pTalking':_0x1388c1[_0xd004('0x23')],'sumBillable':_0x1388c1[_0xd004('0x24')],'sumDuration':_0x1388c1['sumDuration'],'sumHoldTime':_0x1388c1[_0xd004('0x25')]||0x0,'talking':_0x1388c1['talking'],'total':_0x1388c1[_0xd004('0x26')],'type':_0x1388c1[_0xd004('0x27')],'unmanaged':_0x1388c1[_0xd004('0x28')],'abandoned':_0x1388c1[_0xd004('0x29')],'waiting':_0x1388c1[_0xd004('0x2a')],'loggedInDb':_0x1388c1[_0xd004('0x2b')]};if(_0x1388c1[_0xd004('0x27')]==='outbound'){_0x2a8572[_0xd004('0x2c')]=_0x1388c1[_0xd004('0x2c')];_0x2a8572[_0xd004('0x2d')]=_0x1388c1[_0xd004('0x2d')];_0x2a8572['dialOriginateCallerIdName']=_0x1388c1['dialOriginateCallerIdName'];_0x2a8572['dialOriginateCallerIdNumber']=_0x1388c1[_0xd004('0x2e')];_0x2a8572[_0xd004('0x2f')]=_0x1388c1[_0xd004('0x2f')];_0x2a8572[_0xd004('0x30')]=_0x1388c1[_0xd004('0x30')];_0x2a8572[_0xd004('0x31')]=_0x1388c1[_0xd004('0x31')];_0x2a8572['outboundAnswerCallsDay']=_0x1388c1[_0xd004('0x32')];_0x2a8572[_0xd004('0x33')]=_0x1388c1[_0xd004('0x33')];_0x2a8572[_0xd004('0x34')]=_0x1388c1[_0xd004('0x34')];_0x2a8572[_0xd004('0x35')]=_0x1388c1[_0xd004('0x35')];_0x2a8572[_0xd004('0x36')]=_0x1388c1['outboundDropCallsDayACS'];_0x2a8572[_0xd004('0x37')]=_0x1388c1[_0xd004('0x37')];_0x2a8572[_0xd004('0x38')]=_0x1388c1[_0xd004('0x38')];_0x2a8572[_0xd004('0x39')]=_0x1388c1[_0xd004('0x39')];_0x2a8572[_0xd004('0x3a')]=_0x1388c1[_0xd004('0x3a')];_0x2a8572['outboundOriginateFailureCallsDay']=_0x1388c1[_0xd004('0x3b')];_0x2a8572[_0xd004('0x3c')]=_0x1388c1[_0xd004('0x3c')];_0x2a8572['outboundRejectCallsDay']=_0x1388c1['outboundRejectCallsDay'];_0x2a8572['outboundUnknownCallsDay']=_0x1388c1[_0xd004('0x3d')];_0x2a8572['predictiveIntervalAnsweredCalls']=_0x1388c1[_0xd004('0x3e')];_0x2a8572[_0xd004('0x3f')]=_0x1388c1['predictiveIntervalAvgHoldtime'];_0x2a8572[_0xd004('0x40')]=_0x1388c1[_0xd004('0x40')];_0x2a8572[_0xd004('0x41')]=_0x1388c1['predictiveIntervalDroppedCallsCallersExit'];_0x2a8572[_0xd004('0x42')]=_0x1388c1[_0xd004('0x42')];_0x2a8572[_0xd004('0x43')]=_0x1388c1[_0xd004('0x43')];_0x2a8572[_0xd004('0x44')]=_0x1388c1['predictiveIntervalErlangCallsDroppedCalls'];_0x2a8572[_0xd004('0x45')]=_0x1388c1[_0xd004('0x45')];_0x2a8572[_0xd004('0x46')]=_0x1388c1['predictiveIntervalMultiplicativeFactor'];_0x2a8572[_0xd004('0x47')]=_0x1388c1[_0xd004('0x47')];_0x2a8572[_0xd004('0x48')]=_0x1388c1[_0xd004('0x48')];_0x2a8572[_0xd004('0x49')]=_0x1388c1[_0xd004('0x49')];_0x2a8572[_0xd004('0x18')]=_0x1388c1['message'];_0x2a8572[_0xd004('0x4a')]=_0x1388c1[_0xd004('0x4a')];_0x2a8572[_0xd004('0x4b')]=_0x1388c1[_0xd004('0x4b')];_0x2a8572[_0xd004('0x4c')]=_0x1388c1[_0xd004('0x4c')];_0x2a8572[_0xd004('0x4d')]=_0x1388c1['erlangAbandonmentRate'];_0x2a8572[_0xd004('0x4e')]=_0x1388c1[_0xd004('0x4e')];_0x2a8572[_0xd004('0x4f')]=_0x1388c1['startPredictive'];_0x2a8572[_0xd004('0x50')]=_0x1388c1[_0xd004('0x50')];}if(_0x1388c1[_0xd004('0x51')]){_0x2a8572[_0xd004('0x51')]={'id':_0x1388c1[_0xd004('0x51')]['id'],'name':_0x1388c1[_0xd004('0x51')][_0xd004('0x9')],'active':_0x1388c1['Trunk'][_0xd004('0x52')],'callerid':_0x1388c1['Trunk'][_0xd004('0x53')]};}if(_0x1388c1[_0xd004('0x54')]){_0x2a8572[_0xd004('0x54')]={'id':_0x1388c1[_0xd004('0x54')]['id'],'name':_0x1388c1[_0xd004('0x54')]['name']};}_0x4a1b43[_0xd004('0x55')](_0x2a8572);}}_0x15b001({'count':_0x4a1b43[_0xd004('0x56')],'rows':_0x4a1b43});});},'VoiceChannels':function(_0x58ee0a){return new Promise(function(_0x2678db,_0x210ebc){var _0x3bc093=_[_0xd004('0x57')](_0x2392aa[_0xd004('0x58')]);_0x2678db({'count':_0x3bc093[_0xd004('0x56')],'rows':_0x3bc093});});},'VoiceChannelMixMonitor':function(_0x54cfaa){var _0x1277f4=this;return new Promise(function(_0x103f0d,_0x532d6d){if(ami[_0xd004('0x1b')]()==![]){return _0x532d6d(_0x1277f4[_0xd004('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0xd004('0xf')][_0xd004('0x10')],_0xd004('0x1c')]['join']('\x20')));}var _0x32b6d2=schema(properties[_0xd004('0x59')])['validate'](_0x54cfaa);if(_0x32b6d2['length']>0x0){return _0x532d6d(_0x1277f4[_0xd004('0x1a')](0x1f4,_[_0xd004('0x5a')](_0x32b6d2,_0xd004('0x18'))['join'](',\x20')));}var _0x858974=_[_0xd004('0x5b')](_0x2392aa[_0xd004('0x58')],{'uniqueid':_0x54cfaa[_0xd004('0x5c')]});if(_0x858974&&_0x858974[_0xd004('0x5d')]){var _0x2ebcfb=util[_0xd004('0x5e')](_0xd004('0x5f'),_0x54cfaa[_0xd004('0x60')]||_0x54cfaa[_0xd004('0x5c')],_0x54cfaa[_0xd004('0x5e')]||_0xd004('0x61'));return ami[_0xd004('0x16')]({'action':_0xd004('0x62'),'channel':_0x858974[_0xd004('0x5d')],'file':_0x2ebcfb,'options':_0xd004('0x63')})['then'](function(_0x2fdb4f){var _0x318a81=_[_0xd004('0x5b')](_0x858974[_0xd004('0x64')],{'filename':_0xd004('0x65')+_0x2ebcfb[_0xd004('0x66')]()});if(_[_0xd004('0x67')](_0x318a81)){_0x858974[_0xd004('0x64')]['push']({'filename':_0xd004('0x65')+_0x2ebcfb['toLowerCase'](),'createdAt':moment()[_0xd004('0x5e')](_0xd004('0x68')),'mixmonitorid':_0x2fdb4f['mixmonitorid'],'status':_0xd004('0x69')});}else{_0x318a81[_0xd004('0x6a')]=_0x2fdb4f['mixmonitorid'];_0x318a81[_0xd004('0x6b')]='rec';}_0x103f0d({'code':0xc8,'message':[_0x54cfaa['uniqueid'],_0xd004('0x6c'),_0x2fdb4f['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x2fdb4f[_0xd004('0x6a')]});})[_0xd004('0x19')](function(_0x411da4){_0x532d6d(_0x1277f4['error'](0x1f5,[_0x54cfaa['uniqueid'],_0x411da4[_0xd004('0x18')][_0xd004('0x66')]()][_0xd004('0x11')]('\x20')));});}else{return _0x532d6d(_0x1277f4['error'](0x1f5,_0xd004('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x196a3e){var _0x497298=this;return new Promise(function(_0x441fd2,_0x3bde5f){if(ami['isConnected']()==![]){return _0x3bde5f(_0x497298[_0xd004('0x1a')](0x1f4,[config[_0xd004('0xf')]['ip'],config[_0xd004('0xf')][_0xd004('0x10')],_0xd004('0x1c')][_0xd004('0x11')]('\x20')));}var _0x270e01=schema(properties[_0xd004('0x59')])[_0xd004('0x6e')](_0x196a3e);if(_0x270e01[_0xd004('0x56')]>0x0){return _0x3bde5f(_0x497298[_0xd004('0x1a')](0x1f4,_[_0xd004('0x5a')](_0x270e01,_0xd004('0x18'))[_0xd004('0x11')](',\x20')));}var _0x30d466=_[_0xd004('0x5b')](_0x2392aa['channels'],{'uniqueid':_0x196a3e[_0xd004('0x5c')]});if(_0x30d466){return BPromise[_0xd004('0x6f')]()['then'](function(){if(_0x30d466[_0xd004('0x5d')]){return ami[_0xd004('0x16')]({'action':_0xd004('0x70'),'channel':_0x30d466[_0xd004('0x5d')],'mixmonitorid':_0x196a3e[_0xd004('0x6a')]})['catch'](function(_0xda957d){});}})[_0xd004('0x17')](function(){if(_0x30d466[_0xd004('0x71')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x30d466[_0xd004('0x71')],'mixmonitorid':_0x196a3e[_0xd004('0x6a')]})[_0xd004('0x19')](function(_0xcf203a){});}})['then'](function(_0x2d5b2b){var _0x29fabf=_['find'](_0x30d466['monitors'],{'mixmonitorid':_0x196a3e[_0xd004('0x6a')]});if(_0x29fabf){_0x29fabf[_0xd004('0x6b')]=_0xd004('0x72');}})[_0xd004('0x17')](function(){var _0xbdf40f=util[_0xd004('0x5e')](_0xd004('0x5f'),_0x196a3e[_0xd004('0x60')]||_0x196a3e[_0xd004('0x5c')],_0x196a3e[_0xd004('0x5e')]||_0xd004('0x61'));var _0x1a6459=_['find'](_0x30d466[_0xd004('0x64')],{'filename':'/var/spool/asterisk/monitor/'+_0xbdf40f[_0xd004('0x66')]()});if(_0x1a6459){_0x1a6459[_0xd004('0x6b')]=_0xd004('0x72');}})[_0xd004('0x17')](function(){_0x441fd2({'code':0xc8,'message':[_0x196a3e['uniqueid'],_0xd004('0x73')][_0xd004('0x11')]('\x20')});})['catch'](function(_0x5e2bfc){_0x3bde5f(_0x497298[_0xd004('0x1a')](0x1f5,[_0x196a3e[_0xd004('0x5c')],_0x5e2bfc[_0xd004('0x18')][_0xd004('0x66')]()][_0xd004('0x11')]('\x20')));});}else{return _0x3bde5f(_0x497298['error'](0x1f5,_0xd004('0x6d')));}});},'VoiceQueuesChannels':function(_0x14fb8b){return new Promise(function(_0x554fa3,_0x5a760d){var _0x53cd84=_['values'](_0x2392aa[_0xd004('0x74')]);_0x554fa3({'count':_0x53cd84['length'],'rows':_0x53cd84});});},'VoiceQueuesChannel':function(_0x4d7662){var _0x3bbbb8=this;return new Promise(function(_0x4e44cb,_0xb50ea4){var _0x5964ed=schema(properties[_0xd004('0x75')])[_0xd004('0x6e')](_0x4d7662);if(_0x5964ed['length']>0x0){return _0xb50ea4(_0x3bbbb8['error'](0x1f4,_['map'](_0x5964ed,'message')['join'](',\x20')));}var _0x1fac56=_[_0xd004('0x5b')](_0x2392aa[_0xd004('0x74')],{'uniqueid':_0x4d7662[_0xd004('0x5c')]});if(_0x1fac56){_0x4e44cb(_0x1fac56);}else{return _0xb50ea4(_0x3bbbb8['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x540862){var _0x37df78=this;return new Promise(function(_0x3e1f18,_0x5b15e5){if(ami[_0xd004('0x1b')]()==![]){return _0x5b15e5(_0x37df78[_0xd004('0x1a')](0x1f4,[config[_0xd004('0xf')]['ip'],config[_0xd004('0xf')][_0xd004('0x10')],_0xd004('0x1c')][_0xd004('0x11')]('\x20')));}var _0x6db25d=schema(properties[_0xd004('0x76')])[_0xd004('0x6e')](_0x540862);if(_0x6db25d[_0xd004('0x56')]>0x0){return _0x5b15e5(_0x37df78[_0xd004('0x1a')](0x1f4,_['map'](_0x6db25d,'message')[_0xd004('0x11')](',\x20')));}var _0x207772=_[_0xd004('0x5b')](_0x2392aa[_0xd004('0x74')],{'uniqueid':_0x540862['uniqueid']});if(_0x207772&&_0x207772[_0xd004('0x5d')]){return ami[_0xd004('0x16')]({'action':_0xd004('0x77'),'channel':_0x207772[_0xd004('0x5d')]})[_0xd004('0x17')](function(_0x31ed47){_0x3e1f18({'code':0xc8,'message':[_0x540862[_0xd004('0x5c')],_0x31ed47[_0xd004('0x18')][_0xd004('0x66')]()]['join']('\x20')});})[_0xd004('0x19')](function(_0x5a61fd){_0x5b15e5(_0x37df78['error'](0x1f5,[_0x540862['uniqueid'],_0x5a61fd[_0xd004('0x18')][_0xd004('0x66')]()][_0xd004('0x11')]('\x20')));});}else{return _0x5b15e5(_0x37df78['error'](0x1f5,_0xd004('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x2111e0){var _0x52dece=this;return new Promise(function(_0x448267,_0x16ef2f){if(ami['isConnected']()==![]){return _0x16ef2f(_0x52dece[_0xd004('0x1a')](0x1f4,[config[_0xd004('0xf')]['ip'],config[_0xd004('0xf')][_0xd004('0x10')],_0xd004('0x1c')][_0xd004('0x11')]('\x20')));}var _0x2cdfca=schema(properties[_0xd004('0x78')])[_0xd004('0x6e')](_0x2111e0);if(_0x2cdfca['length']>0x0){return _0x16ef2f(_0x52dece[_0xd004('0x1a')](0x1f4,_['map'](_0x2cdfca,_0xd004('0x18'))[_0xd004('0x11')](',\x20')));}var _0x2845b6=_[_0xd004('0x5b')](_0x2392aa['queueChannels'],{'uniqueid':_0x2111e0[_0xd004('0x5c')]});if(_0x2845b6&&_0x2845b6[_0xd004('0x5d')]){return ami[_0xd004('0x16')]({'action':_0xd004('0x79'),'channel':_0x2845b6[_0xd004('0x5d')],'exten':_0x2111e0['exten'],'context':_0x2111e0['context']||_0x2845b6[_0xd004('0x7a')],'priority':0x1})[_0xd004('0x17')](function(_0x3a6220){_0x448267({'code':0xc8,'message':[_0x2111e0[_0xd004('0x5c')],_0x3a6220[_0xd004('0x18')]['toLowerCase']()][_0xd004('0x11')]('\x20')});})[_0xd004('0x19')](function(_0x440e56){_0x16ef2f(_0x52dece[_0xd004('0x1a')](0x1f5,[_0x2111e0[_0xd004('0x5c')],_0x440e56['message'][_0xd004('0x66')]()]['join']('\x20')));});}else{return _0x16ef2f(_0x52dece[_0xd004('0x1a')](0x1f5,_0xd004('0x6d')));}});},'Agents':function(_0xce1586){return new Promise(function(_0x340e12,_0x4deb12){var _0x155cc4=_[_0xd004('0x57')](_0x2392aa[_0xd004('0xd')]);_0x340e12({'count':_0x155cc4[_0xd004('0x56')],'rows':_0x155cc4});});},'Telephones':function(_0xd081c3){return new Promise(function(_0x565a2a,_0x251842){var _0x41f27e=_['values'](_0x2392aa['telephones']);_0x565a2a({'count':_0x41f27e['length'],'rows':_0x41f27e});});},'Trunks':function(_0x3a9092){return new Promise(function(_0x502689,_0x669116){var _0x179b44=_[_0xd004('0x57')](_0x2392aa[_0xd004('0x7b')]);_0x502689({'count':_0x179b44[_0xd004('0x56')],'rows':_0x179b44});});},'OutboundChannels':function(_0x518b15){return new Promise(function(_0x1c03f5,_0x49ad23){var _0x20ef52=_[_0xd004('0x57')](_0x2392aa['outboundChannels']);_0x1c03f5({'count':_0x20ef52[_0xd004('0x56')],'rows':_0x20ef52});});},'Outbound':function(_0xf1896b){return new Promise(function(_0x5dd76d,_0x24f0be){_0x5dd76d(_0x2392aa[_0xd004('0x7c')]);});},'Campaigns':function(_0x1d6cb5){return new Promise(function(_0x33f8bf,_0x3b0770){var _0x575453=_[_0xd004('0x57')](_0x2392aa['campaigns']);_0x33f8bf({'count':_0x575453['length'],'rows':_0x575453});});},'VoiceQueuesPreview':function(_0x25fe01){var _0x235800=this;return new Promise(function(_0x37975a,_0x52e73f){_0x15ba36[_0xd004('0x7d')](_0x25fe01['id'])[_0xd004('0x17')](function(_0x9cccfa){_0x37975a({'code':0xc8,'message':_0x9cccfa['message']});})[_0xd004('0x19')](function(_0x334024){_0x52e73f(_0x235800[_0xd004('0x1a')](0x1f4,_0x334024['message']));});});},'EventManager':function(_0x235307){var _0x5b03dd=this;return new Promise(function(_0x328daa,_0x199d1f){if(!_0x235307[_0xd004('0x7e')]){return _0x199d1f(_0x5b03dd['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xd004('0x7f')](_0xd004('0x80')+_0x235307[_0xd004('0x7e')],_0x235307[_0xd004('0x18')]);_0x328daa({'code':0xc8,'message':_0x235307});});},'FaxAccounts':function(_0x431ec0){return new Promise(function(_0x1cc64f,_0x328f12){var _0x1c5478=_[_0xd004('0x57')](_0x2392aa[_0xd004('0x81')]);_0x1cc64f({'count':_0x1c5478[_0xd004('0x56')],'rows':_0x1c5478});});},'SendFax':function(_0x1d2769){var _0x370f64=this;return new Promise(function(_0x5516a1,_0x33f305){_0x16889f['send'](_0x1d2769)[_0xd004('0x17')](function(_0x267cd4){_0x5516a1({'code':0xc8,'message':_0x267cd4[_0xd004('0x18')]});})['catch'](function(_0x2b555d){_0x33f305(_0x370f64[_0xd004('0x1a')](0x1f4,_0x2b555d[_0xd004('0x18')]));});});},'CheckAfterSend':function(_0x114739){var _0x3ef293=this;return new Promise(function(_0x5e900d,_0x9ca988){_0x16889f['checkAfterSend'](_0x114739)[_0xd004('0x17')](function(_0x463fac){_0x5e900d({'code':0xc8,'message':_0x463fac[_0xd004('0x18')]});})[_0xd004('0x19')](function(_0x4d7348){_0x9ca988(_0x3ef293[_0xd004('0x1a')](0x1f4,_0x4d7348[_0xd004('0x18')]));});});}};var _0x345066=jayson[_0xd004('0x82')](_0x1a82d7)[_0xd004('0x83')]();_0x345066['on']('error',function(_0x2c6861){return _0x3de0b5(_0x2c6861);});_0x345066[_0xd004('0x7')](0x232a,_0xd004('0x84'),function(){console[_0xd004('0x85')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x37af7b(_0xd004('0x86')+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 919823e..4cc6624 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 _0x5a13=['trigger:%s','action','toLowerCase','[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','xmd-contactid2','user:%s','format','merge','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','redis','info','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','destcalleridname','','destcalleridnum','uniqueid','phone','resolve','showContact','omit','then','[%s][%s]\x20Contact\x20found:%s','name'];(function(_0x464001,_0x2ed1db){var _0x5693d2=function(_0x225a76){while(--_0x225a76){_0x464001['push'](_0x464001['shift']());}};_0x5693d2(++_0x2ed1db);}(_0x5a13,0x92));var _0x35a1=function(_0x488a00,_0x192514){_0x488a00=_0x488a00-0x0;var _0x290c2f=_0x5a13[_0x488a00];return _0x290c2f;};'use strict';var BPromise=require('bluebird');var util=require(_0x35a1('0x0'));var _=require(_0x35a1('0x1'));var Redis=require(_0x35a1('0x2'));var config=require(_0x35a1('0x3'));var logger=require(_0x35a1('0x4'))(_0x35a1('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x35a1('0x6')]=_['defaults'](config[_0x35a1('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4222a1,_0x3bd7c9,_0xb00a35,_0x3ed235){logger[_0x35a1('0x7')]('[%s][%s]',_0x4222a1,'',_0x3bd7c9,_0xb00a35,JSON[_0x35a1('0x8')](_0x3ed235));io['to'](_0x3bd7c9)[_0x35a1('0x9')](_0xb00a35,_0x3ed235);}exports[_0x35a1('0xa')]=function(_0x3c4501,_0x10d627,_0x2d9801){_0x2d9801[_0x35a1('0xb')]=0x0;if(_0x10d627[_0x35a1('0xc')]&&parseInt(_0x10d627[_0x35a1('0xc')],0xa)){var _0x5ee208={'ListId':parseInt(_0x10d627[_0x35a1('0xd')],0xa),'phone':_0x2d9801[_0x35a1('0xe')]};if(_[_0x35a1('0xf')](_0x2d9801[_0x35a1('0x10')])){_0x5ee208[_0x35a1('0x11')]=_0x2d9801['calleridname']&&_0x2d9801[_0x35a1('0x12')]!==''?_0x2d9801[_0x35a1('0x12')]:_0x2d9801[_0x35a1('0xe')]||_0x2d9801['uniqueid'];}else{_0x5ee208[_0x35a1('0x11')]=_0x2d9801[_0x35a1('0x13')]&&_0x2d9801[_0x35a1('0x13')]!==_0x35a1('0x14')?_0x2d9801['destcalleridname']:_0x2d9801[_0x35a1('0x15')]||_0x2d9801[_0x35a1('0x16')];_0x5ee208[_0x35a1('0x17')]=_0x2d9801[_0x35a1('0x13')]&&_0x2d9801['destcalleridname']!==_0x35a1('0x14')?_0x2d9801[_0x35a1('0x13')]:_0x2d9801['destcalleridnum']||_0x2d9801[_0x35a1('0x16')];}BPromise[_0x35a1('0x18')]()['then'](cmContactRpc[_0x35a1('0x19')]({'where':_[_0x35a1('0x1a')](_0x5ee208,[_0x35a1('0x11')])}))[_0x35a1('0x1b')](function(_0x363fb4){if(_0x363fb4){logger['info'](_0x35a1('0x1c'),_0x2d9801[_0x35a1('0x16')],'',_0x363fb4['id']);if(_0x3c4501){_0x2d9801['xmd-contactid2']=_0x363fb4['id'];emit(_0x2d9801['uniqueid'],util['format']('user:%s',_0x3c4501[_0x35a1('0x1d')]),util['format'](_0x35a1('0x1e'),_0x10d627[_0x35a1('0x1f')][_0x35a1('0x20')]()),_['merge'](_0x2d9801,{'ListId':parseInt(_0x10d627[_0x35a1('0xd')],0xa)}));}return;}else{logger[_0x35a1('0x7')](_0x35a1('0x21'),_0x2d9801[_0x35a1('0x16')],'');return BPromise[_0x35a1('0x18')]()[_0x35a1('0x1b')](cmContactRpc[_0x35a1('0x22')](_0x5ee208));}})[_0x35a1('0x1b')](function(_0x4c8945){if(_0x4c8945){logger[_0x35a1('0x7')](_0x35a1('0x23'),_0x2d9801['uniqueid'],'',_0x4c8945['id']);if(_0x3c4501){_0x2d9801[_0x35a1('0x24')]=_0x4c8945['id'];emit(_0x2d9801[_0x35a1('0x16')],util['format'](_0x35a1('0x25'),_0x3c4501[_0x35a1('0x1d')]),util[_0x35a1('0x26')](_0x35a1('0x1e'),_0x10d627[_0x35a1('0x1f')][_0x35a1('0x20')]()),_[_0x35a1('0x27')](_0x2d9801,{'ListId':parseInt(_0x10d627[_0x35a1('0xd')],0xa)}));}}})[_0x35a1('0x28')](function(_0x516595){logger[_0x35a1('0x29')](_0x35a1('0x2a'),_0x2d9801['uniqueid'],'',JSON['stringify'](_0x516595));});}else{if(_0x3c4501){logger[_0x35a1('0x7')](_0x35a1('0x2b'),_0x2d9801[_0x35a1('0x16')],'');emit(_0x2d9801[_0x35a1('0x16')],util[_0x35a1('0x26')](_0x35a1('0x25'),_0x3c4501[_0x35a1('0x1d')]),util[_0x35a1('0x26')]('trigger:%s',_0x10d627['action'][_0x35a1('0x20')]()),_[_0x35a1('0x27')]({'ListId':parseInt(_0x10d627[_0x35a1('0xd')],0xa)},_0x2d9801));}}}; \ No newline at end of file +var _0xf4b9=['then','[%s][%s]\x20Contact\x20found:%s','format','user:%s','name','trigger:%s','toLowerCase','createContact','[%s][%s]\x20Contact\x20created:%s','xmd-contactid2','action','merge','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','util','lodash','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','redis','socket.io-emitter','info','[%s][%s]','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','calleridname','','uniqueid','firstName','destcalleridname','destcalleridnum','phone','showContact','omit'];(function(_0x4a15e2,_0x4816fc){var _0x243935=function(_0x2e252d){while(--_0x2e252d){_0x4a15e2['push'](_0x4a15e2['shift']());}};_0x243935(++_0x4816fc);}(_0xf4b9,0xbc));var _0x9f4b=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xf4b9[_0xd0b415];return _0x2bdf2c;};'use strict';var BPromise=require('bluebird');var util=require(_0x9f4b('0x0'));var _=require(_0x9f4b('0x1'));var Redis=require('ioredis');var config=require(_0x9f4b('0x2'));var logger=require(_0x9f4b('0x3'))('trigger');var cmContactRpc=require(_0x9f4b('0x4'));config['redis']=_[_0x9f4b('0x5')](config[_0x9f4b('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9f4b('0x7'))(new Redis(config[_0x9f4b('0x6')]));function emit(_0x38f3cb,_0x95d27a,_0x4c0a1c,_0x12ce7){logger[_0x9f4b('0x8')](_0x9f4b('0x9'),_0x38f3cb,'',_0x95d27a,_0x4c0a1c,JSON[_0x9f4b('0xa')](_0x12ce7));io['to'](_0x95d27a)[_0x9f4b('0xb')](_0x4c0a1c,_0x12ce7);}exports[_0x9f4b('0xc')]=function(_0xa8bb9f,_0x503f93,_0x4558af){_0x4558af[_0x9f4b('0xd')]=0x0;if(_0x503f93[_0x9f4b('0xe')]&&parseInt(_0x503f93[_0x9f4b('0xe')],0xa)){var _0x3b7941={'ListId':parseInt(_0x503f93[_0x9f4b('0xf')],0xa),'phone':_0x4558af[_0x9f4b('0x10')]};if(_[_0x9f4b('0x11')](_0x4558af['routeId'])){_0x3b7941['firstName']=_0x4558af['calleridname']&&_0x4558af[_0x9f4b('0x12')]!==_0x9f4b('0x13')?_0x4558af[_0x9f4b('0x12')]:_0x4558af[_0x9f4b('0x10')]||_0x4558af[_0x9f4b('0x14')];}else{_0x3b7941[_0x9f4b('0x15')]=_0x4558af[_0x9f4b('0x16')]&&_0x4558af[_0x9f4b('0x16')]!==_0x9f4b('0x13')?_0x4558af[_0x9f4b('0x16')]:_0x4558af[_0x9f4b('0x17')]||_0x4558af['uniqueid'];_0x3b7941[_0x9f4b('0x18')]=_0x4558af[_0x9f4b('0x16')]&&_0x4558af[_0x9f4b('0x16')]!==_0x9f4b('0x13')?_0x4558af['destcalleridname']:_0x4558af[_0x9f4b('0x17')]||_0x4558af['uniqueid'];}BPromise['resolve']()['then'](cmContactRpc[_0x9f4b('0x19')]({'where':_[_0x9f4b('0x1a')](_0x3b7941,[_0x9f4b('0x15')])}))[_0x9f4b('0x1b')](function(_0x303fe0){if(_0x303fe0){logger['info'](_0x9f4b('0x1c'),_0x4558af['uniqueid'],'',_0x303fe0['id']);if(_0xa8bb9f){_0x4558af['xmd-contactid2']=_0x303fe0['id'];emit(_0x4558af[_0x9f4b('0x14')],util[_0x9f4b('0x1d')](_0x9f4b('0x1e'),_0xa8bb9f[_0x9f4b('0x1f')]),util[_0x9f4b('0x1d')](_0x9f4b('0x20'),_0x503f93['action'][_0x9f4b('0x21')]()),_['merge'](_0x4558af,{'ListId':parseInt(_0x503f93[_0x9f4b('0xf')],0xa)}));}return;}else{logger['info']('[%s][%s]\x20Contact\x20not\x20found',_0x4558af[_0x9f4b('0x14')],'');return BPromise['resolve']()['then'](cmContactRpc[_0x9f4b('0x22')](_0x3b7941));}})['then'](function(_0x38ec55){if(_0x38ec55){logger[_0x9f4b('0x8')](_0x9f4b('0x23'),_0x4558af[_0x9f4b('0x14')],'',_0x38ec55['id']);if(_0xa8bb9f){_0x4558af[_0x9f4b('0x24')]=_0x38ec55['id'];emit(_0x4558af['uniqueid'],util[_0x9f4b('0x1d')](_0x9f4b('0x1e'),_0xa8bb9f[_0x9f4b('0x1f')]),util['format'](_0x9f4b('0x20'),_0x503f93[_0x9f4b('0x25')][_0x9f4b('0x21')]()),_[_0x9f4b('0x26')](_0x4558af,{'ListId':parseInt(_0x503f93[_0x9f4b('0xf')],0xa)}));}}})[_0x9f4b('0x27')](function(_0x3ad0f8){logger[_0x9f4b('0x28')](_0x9f4b('0x29'),_0x4558af['uniqueid'],'',JSON[_0x9f4b('0xa')](_0x3ad0f8));});}else{if(_0xa8bb9f){logger[_0x9f4b('0x8')](_0x9f4b('0x2a'),_0x4558af[_0x9f4b('0x14')],'');emit(_0x4558af[_0x9f4b('0x14')],util[_0x9f4b('0x1d')](_0x9f4b('0x1e'),_0xa8bb9f['name']),util[_0x9f4b('0x1d')](_0x9f4b('0x20'),_0x503f93[_0x9f4b('0x25')][_0x9f4b('0x21')]()),_['merge']({'ListId':parseInt(_0x503f93['data1'],0xa)},_0x4558af));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index c677984..24c6e9b 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 _0x79ca=['windowHeight','600','data6','winapp','winApplication','render','winArguments','format','user:%s','name','trigger:%s:%s','jscripty','action','trigger:%s','exec','integration','accounts','queue','urlforward','script','query','replace','checkTrigger','AllConditions','checkConditions','AnyConditions','some','channel','field','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','agent','membername','lastevent','routeId','exports','util','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','../rpc/cmContact','../../../config/logger','redis','defaults','socket.io-emitter','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','deskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','checkTriggers','interface','hasOwnProperty','status','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','html','template\x20not\x20found','isNil','data3','data4','location','uriLocation','windowWidth'];(function(_0x4d2a29,_0x4fa94a){var _0x417589=function(_0x1667ce){while(--_0x1667ce){_0x4d2a29['push'](_0x4d2a29['shift']());}};_0x417589(++_0x4fa94a);}(_0x79ca,0x9e));var _0xa79c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x79ca[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xa79c('0x0'));var _=require(_0xa79c('0x1'));var url=require('url');var Mustache=require(_0xa79c('0x2'));var Redis=require(_0xa79c('0x3'));var urlforward=require(_0xa79c('0x4'));var integration=require(_0xa79c('0x5'));var cmContact=require(_0xa79c('0x6'));var script=require('./script');var cmContactRpc=require(_0xa79c('0x7'));var config=require('../../../config/environment');var logger=require(_0xa79c('0x8'))('trigger');var ami=require('../ami');config[_0xa79c('0x9')]=_[_0xa79c('0xa')](config[_0xa79c('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xa79c('0xb'))(new Redis(config['redis']));var operators={'equals':function(_0x551bc5,_0x2dfbe3){return _0x551bc5==_0x2dfbe3;},'not_equals':function(_0x2335a2,_0xf511a6){return _0x2335a2!=_0xf511a6;}};var barAndWebActions=['popup',_0xa79c('0xc'),'winapp'];function Trigger(_0x33cb06){this['triggers']=_0x33cb06[_0xa79c('0xd')];this['agents']=_0x33cb06[_0xa79c('0xe')];this['voiceQueues']=_0x33cb06[_0xa79c('0xf')];this[_0xa79c('0x10')]=_0x33cb06[_0xa79c('0x10')];this[_0xa79c('0x11')]=_0x33cb06[_0xa79c('0x11')];this[_0xa79c('0x12')]=_0x33cb06[_0xa79c('0x12')];this[_0xa79c('0x13')]=_0x33cb06[_0xa79c('0x13')];this[_0xa79c('0x14')]=_0x33cb06[_0xa79c('0x14')];this[_0xa79c('0x15')]=_0x33cb06['sugarcrmAccounts'];this['zohoAccounts']=_0x33cb06[_0xa79c('0x16')];this['deskAccounts']=_0x33cb06['deskAccounts'];this[_0xa79c('0x17')]=_0x33cb06[_0xa79c('0x17')];this[_0xa79c('0x18')]=_0x33cb06[_0xa79c('0x18')];this[_0xa79c('0x19')]=_0x33cb06[_0xa79c('0x19')];this[_0xa79c('0x1a')]=_0x33cb06['freshsalesAccounts'];this['accounts']={'zendesk':this[_0xa79c('0x12')],'salesforce':this[_0xa79c('0x14')],'freshdesk':this[_0xa79c('0x13')],'sugarcrm':this[_0xa79c('0x15')],'zoho':this['zohoAccounts'],'desk':this[_0xa79c('0x1b')],'vtiger':this[_0xa79c('0x17')],'dynamics365':this[_0xa79c('0x19')],'freshsales':this[_0xa79c('0x1a')],'servicenow':this[_0xa79c('0x18')]};ami['on'](_0xa79c('0x1c'),this[_0xa79c('0x1d')][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x1f'),this[_0xa79c('0x1d')][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x20'),this[_0xa79c('0x1d')][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x21'),this[_0xa79c('0x1d')][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x22'),this[_0xa79c('0x1d')]['bind'](this));ami['on'](_0xa79c('0x23'),this[_0xa79c('0x1d')][_0xa79c('0x1e')](this));ami['on']('custom:agentbusy',this[_0xa79c('0x1d')][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0xa79c('0x25'),this['syncCustomEvent'][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x26'),this['syncCustomEvent'][_0xa79c('0x1e')](this));ami['on']('custom:timeout',this[_0xa79c('0x1d')][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x27'),this['syncAgentDial'][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x28'),this[_0xa79c('0x29')][_0xa79c('0x1e')](this));ami['on']('custom:dialend',this[_0xa79c('0x29')][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x2a'),this[_0xa79c('0x1d')][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x2b'),this[_0xa79c('0x1d')][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x2c'),this[_0xa79c('0x1d')]['bind'](this));ami['on'](_0xa79c('0x2d'),this['syncCustomEvent'][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x2e'),this[_0xa79c('0x1d')][_0xa79c('0x1e')](this));ami['on'](_0xa79c('0x2f'),this[_0xa79c('0x1d')]['bind'](this));}Trigger[_0xa79c('0x30')][_0xa79c('0x31')]=function(_0x32dc15,_0x3e4d5f,_0x3056b1){logger[_0xa79c('0x32')](_0x32dc15,_0x3e4d5f,JSON[_0xa79c('0x33')](_0x3056b1));io['to'](_0x32dc15)[_0xa79c('0x31')](_0x3e4d5f,_0x3056b1);};Trigger['prototype'][_0xa79c('0x1d')]=function(_0x3a91b2){var _0x38ca42=_['clone'](_0x3a91b2);this[_0xa79c('0x34')](_0x38ca42);};Trigger[_0xa79c('0x30')]['syncAgentDial']=function(_0x568853){if(this[_0xa79c('0xe')][_0x568853[_0xa79c('0x35')]]){this[_0xa79c('0x1d')](_0x568853);}};Trigger[_0xa79c('0x30')]['checkTriggers']=function(_0x4be191){var _0x5608fc;for(var _0xc69bd5 in this[_0xa79c('0xd')]){if(this[_0xa79c('0xd')][_0xa79c('0x36')](_0xc69bd5)){if(this[_0xa79c('0xd')][_0xc69bd5][_0xa79c('0x37')]){_0x5608fc=this['checkTrigger'](this['triggers'][_0xc69bd5],_0x4be191);if(_0x5608fc){_[_0xa79c('0x38')](_0x4be191,_0x4be191[_0xa79c('0x39')]);for(var _0x19a4e7=0x0,_0x4ee39b,_0x3ae6a9,_0x41d001;_0x19a4e70x0){_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(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 a8dd90d..191b127 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 _0xde5f=['substring','lastIndexOf','message','contacts?$select=telephone1','outbound','enduserId','forEach','type','string','customField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','Fields','phonecall','/contacts(','callDirection','queue','headers','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','ticketId','inspect','lodash','bluebird','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase','GET','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid','catch','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20'];(function(_0x4a3569,_0x24a2c0){var _0x1b89e9=function(_0x373e32){while(--_0x373e32){_0x4a3569['push'](_0x4a3569['shift']());}};_0x1b89e9(++_0x24a2c0);}(_0xde5f,0xd6));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfde5('0x0'));var BPromise=require(_0xfde5('0x1'));var rp=require(_0xfde5('0x2'));var util=require(_0xfde5('0x3'));var intUtil=require('./util');var md5=require(_0xfde5('0x4'));var Redis=require(_0xfde5('0x5'));var logger=require('../../../../config/logger')(_0xfde5('0x6'));var config=require(_0xfde5('0x7'));config[_0xfde5('0x8')]=_['defaults'](config['redis'],{'host':_0xfde5('0x9'),'port':0x18eb});var io=require(_0xfde5('0xa'))(new Redis(config[_0xfde5('0x8')]));function getAuthToken(_0x39ca57,_0x2a6fe9,_0x1ddae6){var _0x520823={'method':_0xfde5('0xb'),'uri':_0x2a6fe9,'form':{'client_id':_0x39ca57['clientId'],'resource':_0x39ca57[_0xfde5('0xc')],'username':_0x39ca57[_0xfde5('0xd')],'password':_0x39ca57['password'],'grant_type':_0xfde5('0xe'),'client_secret':_0x39ca57[_0xfde5('0xf')]},'json':!![]};return rp(_0x520823)[_0xfde5('0x10')](function(_0x3a07e0){return _0x3a07e0[_0xfde5('0x11')];})['catch'](function(_0x50fa1e){logger[_0xfde5('0x12')]('['+[_0x1ddae6[_0xfde5('0x13')]()]+']\x20Wrong\x20credentials!');return _0x50fa1e['message'];});}function getUser(_0x8bb77f,_0x35279c,_0x399fb2,_0x54aa11,_0x1a8599,_0x47c0ad){return new BPromise(function(_0x3c6f41,_0x23e56a){return getAuthToken(_0x35279c,_0x54aa11,_0x47c0ad)[_0xfde5('0x10')](function(_0x537710){var _0x231e28={'method':_0xfde5('0x14'),'uri':_0x1a8599+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x537710,'OData-Version':_0xfde5('0x15')},'json':!![]};return rp(_0x231e28);})[_0xfde5('0x10')](function(_0x25dbfd){var _0x3c449d=_0x25dbfd[_0xfde5('0x16')];var _0x4e972c=![];var _0x6d8fdc=null;if(!_[_0xfde5('0x17')](_0x399fb2)){if(intUtil[_0xfde5('0x18')](_0x399fb2[_0xfde5('0x19')])){_0x8bb77f[_0xfde5('0x1a')]=_0x399fb2[_0xfde5('0x19')];for(_0x6d8fdc=0x0;_0x6d8fdc<_0x3c449d[_0xfde5('0x1b')];_0x6d8fdc++){if(_0x3c449d[_0x6d8fdc][_0xfde5('0x1c')]===_0x399fb2['email']&&!_0x3c449d[_0x6d8fdc][_0xfde5('0x1d')]){_0x4e972c=!![];logger[_0xfde5('0x1e')]('['+[_0x47c0ad[_0xfde5('0x13')]()]+_0xfde5('0x1f')+_0x3c449d[_0x6d8fdc]['systemuserid']+'!');_0x8bb77f[_0xfde5('0x20')]=_0x3c449d[_0x6d8fdc][_0xfde5('0x21')];}}}}if(!_0x4e972c){logger['info']('['+[_0x47c0ad[_0xfde5('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x8bb77f[_0xfde5('0x1a')]=_0x35279c[_0xfde5('0xd')];for(_0x6d8fdc=0x0;_0x6d8fdc<_0x3c449d[_0xfde5('0x1b')];_0x6d8fdc++){if(_0x3c449d[_0x6d8fdc][_0xfde5('0x1c')]===_0x35279c['username']){_0x8bb77f[_0xfde5('0x20')]=_0x3c449d[_0x6d8fdc][_0xfde5('0x21')];}}}_0x3c6f41(_0x8bb77f);})[_0xfde5('0x22')](function(_0x347bcc){_0x23e56a(_0x347bcc['message']);});});}function createEndUser(_0x44dab4,_0x3f6ac6,_0x5bb256,_0x20cf7d,_0x460683,_0x42f019){return new BPromise(function(_0x2ab0a3,_0x5a29c4){return getAuthToken(_0x3f6ac6,_0x5bb256,_0x42f019)['then'](function(_0x3d579e){var _0x4f1246=_0x42f019[_0xfde5('0x23')]()==='outbound'?_0x460683[_0xfde5('0x24')]:_0x460683[_0xfde5('0x25')];var _0x3dbd34={'method':'POST','uri':_0x20cf7d+_0xfde5('0x26'),'body':{'telephone1':_0x4f1246,'fullname':_0x4f1246,'firstname':_0x4f1246,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xfde5('0x27')+_0x44dab4[_0xfde5('0x20')]+')'},'headers':{'Authorization':_0xfde5('0x28')+_0x3d579e,'OData-Version':_0xfde5('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3dbd34);})[_0xfde5('0x10')](function(_0x555c93){var _0x259b28=_0x555c93['headers']['odata-entityid'];var _0x5e5f61=_0x259b28[_0xfde5('0x29')](_0x259b28[_0xfde5('0x2a')]('(')+0x1,_0x259b28[_0xfde5('0x2a')](')'));_0x44dab4['enduserId']=_0x5e5f61;_0x2ab0a3(_0x44dab4);})[_0xfde5('0x22')](function(_0x2ccbb7){_0x5a29c4(_0x2ccbb7[_0xfde5('0x2b')]);});});}function getEndUser(_0x5becaa,_0x551615,_0x206e2b,_0x5daf64,_0xb303b3,_0x2874dd){return new BPromise(function(_0x487461,_0x44482b){return getAuthToken(_0x551615,_0x206e2b,_0x2874dd)[_0xfde5('0x10')](function(_0x4328b6){var _0x76a6dc={'method':'GET','uri':_0x5daf64+_0xfde5('0x2c'),'headers':{'Authorization':'Bearer\x20'+_0x4328b6,'If-None-Match':null,'OData-Version':_0xfde5('0x15')},'json':!![]};return rp(_0x76a6dc);})['then'](function(_0x5e5735){var _0x56ebed=null;if(_0x5e5735){var _0x67a33f=_0x5e5735[_0xfde5('0x16')];var _0x230240=![];for(_0x56ebed=0x0;_0x56ebed<_0x67a33f['length'];_0x56ebed++){var _0x3c0517=_0x2874dd[_0xfde5('0x23')]()===_0xfde5('0x2d')?_0xb303b3[_0xfde5('0x24')]:_0xb303b3[_0xfde5('0x25')];if(_0x67a33f[_0x56ebed]['telephone1']===_0x3c0517){_0x230240=!![];_0x5becaa['enduserId']=_0x67a33f[_0x56ebed]['contactid'];}}if(_0x230240){_0x487461(_0x5becaa);}else{return createEndUser(_0x5becaa,_0x551615,_0x206e2b,_0x5daf64,_0xb303b3,_0x2874dd)[_0xfde5('0x10')](function(_0x1a77bb){logger[_0xfde5('0x1e')]('['+[_0x2874dd[_0xfde5('0x13')]()]+']\x20Enduser\x20created!',_0x1a77bb['enduserId']);_0x487461(_0x1a77bb);});}}else{return createEndUser(_0x5becaa,_0x551615,_0x206e2b,_0x5daf64,_0xb303b3,_0x2874dd)['then'](function(_0x5dea7c){logger[_0xfde5('0x1e')]('['+[_0x2874dd[_0xfde5('0x13')]()]+']\x20Enduser\x20Created!',_0x5dea7c[_0xfde5('0x2e')]);_0x487461(_0x5dea7c);});}});});}function getCustomFields(_0x2bdd38,_0x57fc53,_0x58e88d){var _0x1d79d2={};if(_0x2bdd38[_0xfde5('0x1b')]>0x0){_[_0xfde5('0x2f')](_0x2bdd38,function(_0x9b7a03){if(_0x9b7a03[_0xfde5('0x30')]===_0xfde5('0x31')&&_0x9b7a03['nameField']&&!_0x9b7a03[_0xfde5('0x32')]){var _0x1ecc2b=_0x9b7a03[_0xfde5('0x33')][_0xfde5('0x23')]();var _0x37d271=_0x1ecc2b[_0xfde5('0x29')](0x0,_0x1ecc2b[_0xfde5('0x34')]('_'));var _0x31904e=_0x1ecc2b[_0xfde5('0x29')](_0x1ecc2b['indexOf']('_')+0x1);if(_0x37d271===_0x58e88d){_0x1d79d2[_0x31904e]=_0x9b7a03[_0xfde5('0x35')];}}});}return _0x1d79d2;}function getTicket(_0x5e3882,_0x32a8e0,_0x15329b,_0x2ae4b3,_0x6b829d,_0x32817f,_0x2d4635){return new BPromise(function(_0x3405ff,_0x4b0b79){var _0x1556aa;return getAuthToken(_0x32a8e0,_0x15329b,_0x2d4635)[_0xfde5('0x10')](function(_0x16e34f){if(_0x32817f[_0xfde5('0x36')]===_0xfde5('0x37')){_0x1556aa={'method':'POST','uri':_0x2ae4b3+'incidents','body':Object[_0xfde5('0x38')]({},{'title':intUtil[_0xfde5('0x39')](_0x32817f[_0xfde5('0x3a')],_0x6b829d,'\x20'),'description':intUtil[_0xfde5('0x39')](_0x32817f[_0xfde5('0x3b')],_0x6b829d,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x5e3882[_0xfde5('0x2e')]+')','ownerid@odata.bind':_0xfde5('0x27')+_0x5e3882[_0xfde5('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x32817f[_0xfde5('0x3c')],_0x6b829d,_0x32817f[_0xfde5('0x36')])),'headers':{'Authorization':_0xfde5('0x28')+_0x16e34f,'OData-Version':_0xfde5('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x32817f['ticketType']===_0xfde5('0x3d')){_0x1556aa={'method':_0xfde5('0xb'),'uri':_0x2ae4b3+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xfde5('0x39')](_0x32817f[_0xfde5('0x3a')],_0x6b829d,'\x20'),'phonenumber':String(_0x6b829d[_0xfde5('0x25')]),'description':intUtil['getString'](_0x32817f[_0xfde5('0x3b')],_0x6b829d,'\x0a'),'regardingobjectid_contact@odata.bind':_0xfde5('0x3e')+_0x5e3882[_0xfde5('0x2e')]+')','ownerid@odata.bind':_0xfde5('0x27')+_0x5e3882[_0xfde5('0x20')]+')','directioncode':_0x5e3882[_0xfde5('0x3f')]===_0xfde5('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xfde5('0x27')+_0x5e3882['userId']+')','participationtypemask':_0x5e3882[_0xfde5('0x3f')]===_0xfde5('0x40')?0x2:0x1},{'partyid_contact@odata.bind':_0xfde5('0x3e')+_0x5e3882[_0xfde5('0x2e')]+')','participationtypemask':_0x5e3882[_0xfde5('0x3f')]===_0xfde5('0x40')?0x1:0x2}]},getCustomFields(_0x32817f['Fields'],_0x6b829d,_0x32817f[_0xfde5('0x36')])),'headers':{'Authorization':_0xfde5('0x28')+_0x16e34f,'OData-Version':_0xfde5('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1556aa);})[_0xfde5('0x10')](function(_0x21545d){var _0xc51556=_0x21545d[_0xfde5('0x41')]['odata-entityid'];var _0x4c1293=_0xc51556['substring'](_0xc51556[_0xfde5('0x2a')]('(')+0x1,_0xc51556[_0xfde5('0x2a')](')'));_0x5e3882['ticketId']=_0x4c1293;_0x3405ff(_0x5e3882);})[_0xfde5('0x22')](function(_0x22e2de){_0x4b0b79(_0x22e2de[_0xfde5('0x2b')]);});});}function emit(_0x438334,_0xb420ac,_0xde1a9b,_0x1c8349){var _0x211280={'uri':util[_0xfde5('0x42')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x438334,_0xde1a9b,_0x1c8349)};io['to'](util[_0xfde5('0x42')](_0xfde5('0x43'),_0xb420ac))['emit'](_0xfde5('0x44'),_0x211280);}exports['cs']=function(_0xebc412,_0x56e4bf,_0x3284a1,_0x152e03,_0x139d30,_0x56da70,_0xb0a5a,_0x51da91){var _0x2e31c4={};_0x56da70[_0xfde5('0xc')]=intUtil[_0xfde5('0x45')](_0x56da70[_0xfde5('0xc')]);_0x56da70[_0xfde5('0x46')]=intUtil[_0xfde5('0x45')](_0x56da70[_0xfde5('0x46')]);_0x2e31c4[_0xfde5('0x3f')]=_0x51da91===_0xfde5('0x40')||_0x51da91===_0xfde5('0x47')?_0xfde5('0x40'):_0xfde5('0x2d');var _0x2090a9=util[_0xfde5('0x42')]('%s/api/data/v9.0/',_0x56da70['remoteUri']);var _0xac43b2=util[_0xfde5('0x42')](_0xfde5('0x48'),_0x56da70[_0xfde5('0x49')]);var _0x25f787=util[_0xfde5('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56da70[_0xfde5('0x46')],_0x56e4bf[_0xfde5('0x4a')],md5(_0x56e4bf[_0xfde5('0x4a')]));if(_0x139d30&&_0x139d30['monitor_format']){logger[_0xfde5('0x1e')](_0xfde5('0x4b'),_0xfde5('0x4c'));_0x56e4bf[_0xfde5('0x4d')]=_0x25f787;}else if(_0xb0a5a&&_0xb0a5a[_0xfde5('0x4e')]&&_0xb0a5a[_0xfde5('0x4e')]!=='none'){logger[_0xfde5('0x1e')](_0xfde5('0x4f'),_0xfde5('0x4c'));_0x56e4bf[_0xfde5('0x4d')]=_0x25f787;}else{_0x56e4bf[_0xfde5('0x4d')]='';}return getUser(_0x2e31c4,_0x56da70,_0x152e03,_0xac43b2,_0x2090a9,_0x51da91)[_0xfde5('0x10')](function(_0x178820){logger[_0xfde5('0x1e')]('['+_0x51da91[_0xfde5('0x13')]()+']\x20The\x20User\x20ID\x20is:',_0x178820['userId']);logger[_0xfde5('0x1e')]('['+_0x51da91[_0xfde5('0x13')]()+_0xfde5('0x50'),_0x178820[_0xfde5('0x1a')]);return getEndUser(_0x178820,_0x56da70,_0xac43b2,_0x2090a9,_0x56e4bf,_0x51da91);})[_0xfde5('0x10')](function(_0xec2ab2){logger[_0xfde5('0x1e')]('['+_0x51da91['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0xec2ab2[_0xfde5('0x2e')]);logger[_0xfde5('0x1e')]('['+_0x51da91['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x56e4bf[_0xfde5('0x25')]);return getTicket(_0xec2ab2,_0x56da70,_0xac43b2,_0x2090a9,_0x56e4bf,_0x3284a1,_0x51da91);})[_0xfde5('0x10')](function(_0x5f3da4){logger[_0xfde5('0x1e')](util[_0xfde5('0x42')]('['+_0x51da91[_0xfde5('0x13')]()+_0xfde5('0x51'),_0x3284a1[_0xfde5('0x36')],_0x5f3da4['ticketId']));logger['info'](util[_0xfde5('0x42')]('['+_0x51da91['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x51da91));if(_0x51da91!==_0xfde5('0x47')){logger['info']('['+_0x51da91[_0xfde5('0x13')]()+']',_0xfde5('0x52'));emit(_0x56da70[_0xfde5('0xc')],_0x152e03['name'],_0x3284a1[_0xfde5('0x36')],_0x5f3da4[_0xfde5('0x53')]);}})[_0xfde5('0x22')](function(_0x4322f6){logger[_0xfde5('0x12')]('['+_0x51da91['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0xfde5('0x54')](_0x4322f6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8c57=['inspect','lodash','bluebird','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','clientId','remoteUri','username','clientSecret','access_token','error','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','userEmail','length','internalemailaddress','email','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','Bearer\x20','4.0','headers','substring','lastIndexOf','enduserId','catch','telephone1','contactid',']\x20Enduser\x20Created!','type','string','nameField','customField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','Fields','ticketType','phonecall','phonecalls','callDirection','queue','/contacts(','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','serverUrl','stripTrailingSlash','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...'];(function(_0x2ee973,_0x284293){var _0x2b5468=function(_0x1edf6b){while(--_0x1edf6b){_0x2ee973['push'](_0x2ee973['shift']());}};_0x2b5468(++_0x284293);}(_0x8c57,0x181));var _0x78c5=function(_0x4d41b2,_0x3d7483){_0x4d41b2=_0x4d41b2-0x0;var _0xcd37fc=_0x8c57[_0x4d41b2];return _0xcd37fc;};'use strict';var _=require(_0x78c5('0x0'));var BPromise=require(_0x78c5('0x1'));var rp=require(_0x78c5('0x2'));var util=require(_0x78c5('0x3'));var intUtil=require(_0x78c5('0x4'));var md5=require(_0x78c5('0x5'));var Redis=require('ioredis');var logger=require(_0x78c5('0x6'))(_0x78c5('0x7'));var config=require(_0x78c5('0x8'));config[_0x78c5('0x9')]=_[_0x78c5('0xa')](config[_0x78c5('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x78c5('0xb'))(new Redis(config[_0x78c5('0x9')]));function getAuthToken(_0x24a286,_0x73779c,_0x5d3bd5){var _0x1f04b5={'method':'POST','uri':_0x73779c,'form':{'client_id':_0x24a286[_0x78c5('0xc')],'resource':_0x24a286[_0x78c5('0xd')],'username':_0x24a286[_0x78c5('0xe')],'password':_0x24a286['password'],'grant_type':'password','client_secret':_0x24a286[_0x78c5('0xf')]},'json':!![]};return rp(_0x1f04b5)['then'](function(_0x5a32e8){return _0x5a32e8[_0x78c5('0x10')];})['catch'](function(_0x2678c3){logger[_0x78c5('0x11')]('['+[_0x5d3bd5['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x2678c3[_0x78c5('0x12')];});}function getUser(_0x208ac0,_0x21687a,_0x1d8408,_0x29064f,_0x1cdf7e,_0x11b411){return new BPromise(function(_0x3cb3fe,_0x1651d4){return getAuthToken(_0x21687a,_0x29064f,_0x11b411)[_0x78c5('0x13')](function(_0x41e886){var _0x24b5ca={'method':_0x78c5('0x14'),'uri':_0x1cdf7e+_0x78c5('0x15'),'headers':{'Authorization':'Bearer\x20'+_0x41e886,'OData-Version':'4.0'},'json':!![]};return rp(_0x24b5ca);})['then'](function(_0x41414b){var _0x1ec1d0=_0x41414b[_0x78c5('0x16')];var _0x171533=![];var _0x2e6caa=null;if(!_[_0x78c5('0x17')](_0x1d8408)){if(intUtil[_0x78c5('0x18')](_0x1d8408['email'])){_0x208ac0[_0x78c5('0x19')]=_0x1d8408['email'];for(_0x2e6caa=0x0;_0x2e6caa<_0x1ec1d0[_0x78c5('0x1a')];_0x2e6caa++){if(_0x1ec1d0[_0x2e6caa][_0x78c5('0x1b')]===_0x1d8408[_0x78c5('0x1c')]&&!_0x1ec1d0[_0x2e6caa][_0x78c5('0x1d')]){_0x171533=!![];logger[_0x78c5('0x1e')]('['+[_0x11b411['toUpperCase']()]+_0x78c5('0x1f')+_0x1ec1d0[_0x2e6caa]['systemuserid']+'!');_0x208ac0['userId']=_0x1ec1d0[_0x2e6caa][_0x78c5('0x20')];}}}}if(!_0x171533){logger[_0x78c5('0x1e')]('['+[_0x11b411[_0x78c5('0x21')]()]+_0x78c5('0x22'));_0x208ac0['userEmail']=_0x21687a['username'];for(_0x2e6caa=0x0;_0x2e6caa<_0x1ec1d0['length'];_0x2e6caa++){if(_0x1ec1d0[_0x2e6caa][_0x78c5('0x1b')]===_0x21687a[_0x78c5('0xe')]){_0x208ac0[_0x78c5('0x23')]=_0x1ec1d0[_0x2e6caa][_0x78c5('0x20')];}}}_0x3cb3fe(_0x208ac0);})['catch'](function(_0x110ac7){_0x1651d4(_0x110ac7[_0x78c5('0x12')]);});});}function createEndUser(_0x5dfec7,_0x190f8d,_0x1342c4,_0x393280,_0x5ca89e,_0x2d951c){return new BPromise(function(_0x445db4,_0x52904f){return getAuthToken(_0x190f8d,_0x1342c4,_0x2d951c)['then'](function(_0x41e763){var _0x321185=_0x2d951c[_0x78c5('0x24')]()===_0x78c5('0x25')?_0x5ca89e[_0x78c5('0x26')]:_0x5ca89e[_0x78c5('0x27')];var _0x141c8e={'method':_0x78c5('0x28'),'uri':_0x393280+_0x78c5('0x29'),'body':{'telephone1':_0x321185,'fullname':_0x321185,'firstname':_0x321185,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x78c5('0x2a')+_0x5dfec7['userId']+')'},'headers':{'Authorization':_0x78c5('0x2b')+_0x41e763,'OData-Version':_0x78c5('0x2c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x141c8e);})['then'](function(_0x5f4de9){var _0x3878f3=_0x5f4de9[_0x78c5('0x2d')]['odata-entityid'];var _0x2d871d=_0x3878f3[_0x78c5('0x2e')](_0x3878f3[_0x78c5('0x2f')]('(')+0x1,_0x3878f3['lastIndexOf'](')'));_0x5dfec7[_0x78c5('0x30')]=_0x2d871d;_0x445db4(_0x5dfec7);})[_0x78c5('0x31')](function(_0x316c0f){_0x52904f(_0x316c0f['message']);});});}function getEndUser(_0x23a6b1,_0x36c33c,_0x269131,_0x169b05,_0x557c61,_0x5d8459){return new BPromise(function(_0x19d3cf,_0x3eaf6e){return getAuthToken(_0x36c33c,_0x269131,_0x5d8459)[_0x78c5('0x13')](function(_0x4a9a92){var _0x4eb30f={'method':'GET','uri':_0x169b05+'contacts?$select=telephone1','headers':{'Authorization':_0x78c5('0x2b')+_0x4a9a92,'If-None-Match':null,'OData-Version':_0x78c5('0x2c')},'json':!![]};return rp(_0x4eb30f);})[_0x78c5('0x13')](function(_0x47e961){var _0x9c7ca6=null;if(_0x47e961){var _0x1746ea=_0x47e961['value'];var _0x5358eb=![];for(_0x9c7ca6=0x0;_0x9c7ca6<_0x1746ea[_0x78c5('0x1a')];_0x9c7ca6++){var _0x320c17=_0x5d8459[_0x78c5('0x24')]()===_0x78c5('0x25')?_0x557c61['destcalleridnum']:_0x557c61[_0x78c5('0x27')];if(_0x1746ea[_0x9c7ca6][_0x78c5('0x32')]===_0x320c17){_0x5358eb=!![];_0x23a6b1[_0x78c5('0x30')]=_0x1746ea[_0x9c7ca6][_0x78c5('0x33')];}}if(_0x5358eb){_0x19d3cf(_0x23a6b1);}else{return createEndUser(_0x23a6b1,_0x36c33c,_0x269131,_0x169b05,_0x557c61,_0x5d8459)[_0x78c5('0x13')](function(_0x5d76ad){logger[_0x78c5('0x1e')]('['+[_0x5d8459[_0x78c5('0x21')]()]+']\x20Enduser\x20created!',_0x5d76ad[_0x78c5('0x30')]);_0x19d3cf(_0x5d76ad);});}}else{return createEndUser(_0x23a6b1,_0x36c33c,_0x269131,_0x169b05,_0x557c61,_0x5d8459)[_0x78c5('0x13')](function(_0x34d567){logger['info']('['+[_0x5d8459['toUpperCase']()]+_0x78c5('0x34'),_0x34d567['enduserId']);_0x19d3cf(_0x34d567);});}});});}function getCustomFields(_0x440b4a,_0x3666f1,_0x5240e0){var _0x36b138={};if(_0x440b4a[_0x78c5('0x1a')]>0x0){_['forEach'](_0x440b4a,function(_0x4413ef){if(_0x4413ef[_0x78c5('0x35')]===_0x78c5('0x36')&&_0x4413ef[_0x78c5('0x37')]&&!_0x4413ef[_0x78c5('0x38')]){var _0x14e42f=_0x4413ef['idField'][_0x78c5('0x24')]();var _0xb05179=_0x14e42f[_0x78c5('0x2e')](0x0,_0x14e42f['indexOf']('_'));var _0xf5978a=_0x14e42f[_0x78c5('0x2e')](_0x14e42f[_0x78c5('0x39')]('_')+0x1);if(_0xb05179===_0x5240e0){_0x36b138[_0xf5978a]=_0x4413ef[_0x78c5('0x3a')];}}});}return _0x36b138;}function getTicket(_0x3247a7,_0x553fe7,_0x5a24e0,_0xc795f8,_0x1988db,_0x310dec,_0x3ab373){return new BPromise(function(_0x2fbc7c,_0x2f5722){var _0x1df445;return getAuthToken(_0x553fe7,_0x5a24e0,_0x3ab373)['then'](function(_0x4b6f73){if(_0x310dec['ticketType']===_0x78c5('0x3b')){_0x1df445={'method':'POST','uri':_0xc795f8+_0x78c5('0x3c'),'body':Object[_0x78c5('0x3d')]({},{'title':intUtil[_0x78c5('0x3e')](_0x310dec[_0x78c5('0x3f')],_0x1988db,'\x20'),'description':intUtil[_0x78c5('0x3e')](_0x310dec[_0x78c5('0x40')],_0x1988db,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x3247a7[_0x78c5('0x30')]+')','ownerid@odata.bind':'/systemusers('+_0x3247a7['userId']+')','caseorigincode':'1'},getCustomFields(_0x310dec[_0x78c5('0x41')],_0x1988db,_0x310dec[_0x78c5('0x42')])),'headers':{'Authorization':_0x78c5('0x2b')+_0x4b6f73,'OData-Version':_0x78c5('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x310dec[_0x78c5('0x42')]===_0x78c5('0x43')){_0x1df445={'method':'POST','uri':_0xc795f8+_0x78c5('0x44'),'body':Object['assign']({},{'subject':intUtil[_0x78c5('0x3e')](_0x310dec['Subjects'],_0x1988db,'\x20'),'phonenumber':String(_0x1988db[_0x78c5('0x27')]),'description':intUtil[_0x78c5('0x3e')](_0x310dec[_0x78c5('0x40')],_0x1988db,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x3247a7[_0x78c5('0x30')]+')','ownerid@odata.bind':_0x78c5('0x2a')+_0x3247a7[_0x78c5('0x23')]+')','directioncode':_0x3247a7[_0x78c5('0x45')]===_0x78c5('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x78c5('0x2a')+_0x3247a7[_0x78c5('0x23')]+')','participationtypemask':_0x3247a7[_0x78c5('0x45')]===_0x78c5('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x78c5('0x47')+_0x3247a7[_0x78c5('0x30')]+')','participationtypemask':_0x3247a7[_0x78c5('0x45')]===_0x78c5('0x46')?0x1:0x2}]},getCustomFields(_0x310dec[_0x78c5('0x41')],_0x1988db,_0x310dec[_0x78c5('0x42')])),'headers':{'Authorization':_0x78c5('0x2b')+_0x4b6f73,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1df445);})['then'](function(_0x1ce6f3){var _0x2fb1a5=_0x1ce6f3[_0x78c5('0x2d')][_0x78c5('0x48')];var _0x986a35=_0x2fb1a5[_0x78c5('0x2e')](_0x2fb1a5['lastIndexOf']('(')+0x1,_0x2fb1a5[_0x78c5('0x2f')](')'));_0x3247a7['ticketId']=_0x986a35;_0x2fbc7c(_0x3247a7);})[_0x78c5('0x31')](function(_0x3409da){_0x2f5722(_0x3409da['message']);});});}function emit(_0x5c9a21,_0x12db6e,_0x32d346,_0x152706){var _0x57f769={'uri':util[_0x78c5('0x49')](_0x78c5('0x4a'),_0x5c9a21,_0x32d346,_0x152706)};io['to'](util[_0x78c5('0x49')](_0x78c5('0x4b'),_0x12db6e))[_0x78c5('0x4c')]('trigger:browser:url',_0x57f769);}exports['cs']=function(_0x308387,_0x51fda1,_0x5b2fdb,_0x2c658c,_0x227ff1,_0x208b86,_0x616d36,_0x17eb0b){var _0x5f483c={};_0x208b86['remoteUri']=intUtil['stripTrailingSlash'](_0x208b86[_0x78c5('0xd')]);_0x208b86[_0x78c5('0x4d')]=intUtil[_0x78c5('0x4e')](_0x208b86[_0x78c5('0x4d')]);_0x5f483c[_0x78c5('0x45')]=_0x17eb0b===_0x78c5('0x46')||_0x17eb0b===_0x78c5('0x4f')?_0x78c5('0x46'):_0x78c5('0x25');var _0x469bea=util[_0x78c5('0x49')]('%s/api/data/v9.0/',_0x208b86['remoteUri']);var _0x4b9490=util[_0x78c5('0x49')](_0x78c5('0x50'),_0x208b86['tenantId']);var _0x562f4e=util[_0x78c5('0x49')](_0x78c5('0x51'),_0x208b86[_0x78c5('0x4d')],_0x51fda1[_0x78c5('0x52')],md5(_0x51fda1['uniqueid']));if(_0x227ff1&&_0x227ff1[_0x78c5('0x53')]){logger[_0x78c5('0x1e')](_0x78c5('0x54'),'Recording\x20is\x20enabled!');_0x51fda1[_0x78c5('0x55')]=_0x562f4e;}else if(_0x616d36&&_0x616d36['recordingFormat']&&_0x616d36[_0x78c5('0x56')]!==_0x78c5('0x57')){logger['info'](_0x78c5('0x58'),'Recording\x20is\x20enabled!');_0x51fda1[_0x78c5('0x55')]=_0x562f4e;}else{_0x51fda1[_0x78c5('0x55')]='';}return getUser(_0x5f483c,_0x208b86,_0x2c658c,_0x4b9490,_0x469bea,_0x17eb0b)['then'](function(_0x456c21){logger[_0x78c5('0x1e')]('['+_0x17eb0b['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x456c21['userId']);logger[_0x78c5('0x1e')]('['+_0x17eb0b[_0x78c5('0x21')]()+_0x78c5('0x59'),_0x456c21[_0x78c5('0x19')]);return getEndUser(_0x456c21,_0x208b86,_0x4b9490,_0x469bea,_0x51fda1,_0x17eb0b);})[_0x78c5('0x13')](function(_0x4cb5f5){logger['info']('['+_0x17eb0b[_0x78c5('0x21')]()+_0x78c5('0x5a'),_0x4cb5f5[_0x78c5('0x30')]);logger[_0x78c5('0x1e')]('['+_0x17eb0b[_0x78c5('0x21')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x51fda1['calleridnum']);return getTicket(_0x4cb5f5,_0x208b86,_0x4b9490,_0x469bea,_0x51fda1,_0x5b2fdb,_0x17eb0b);})['then'](function(_0xa654f5){logger[_0x78c5('0x1e')](util['format']('['+_0x17eb0b[_0x78c5('0x21')]()+_0x78c5('0x5b'),_0x5b2fdb['ticketType'],_0xa654f5[_0x78c5('0x5c')]));logger['info'](util['format']('['+_0x17eb0b[_0x78c5('0x21')]()+_0x78c5('0x5d'),_0x17eb0b));if(_0x17eb0b!=='unmanaged'){logger[_0x78c5('0x1e')]('['+_0x17eb0b[_0x78c5('0x21')]()+']',_0x78c5('0x5e'));emit(_0x208b86[_0x78c5('0xd')],_0x2c658c['name'],_0x5b2fdb[_0x78c5('0x42')],_0xa654f5[_0x78c5('0x5c')]);}})[_0x78c5('0x31')](function(_0x54bf3e){logger[_0x78c5('0x11')]('['+_0x17eb0b[_0x78c5('0x21')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x78c5('0x5f')](_0x54bf3e,{'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 e18a3a6..84d32b7 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 _0x72f9=['debug','[HTTP]','stringify','defaults','GET','map','forEach','type','string','nameField','customField','toString','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','error','[QUEUE]','outbound','serverUrl','recordingFormat','none','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','request-promise','md5','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','Fields','keyBy','value','format','POST','then','Ticket\x20created!','validateEmail','remoteUri','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','base64'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x72f9,0xe9));var _0x972f=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x72f9[_0x3fe393];return _0x534d14;};'use strict';var _=require('lodash');var rp=require(_0x972f('0x0'));var md5=require(_0x972f('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x972f('0x2'))(_0x972f('0x3'));config[_0x972f('0x4')]=_['defaults'](config[_0x972f('0x4')],{'host':_0x972f('0x5'),'port':0x18eb});var io=require(_0x972f('0x6'))(new Redis(config[_0x972f('0x4')]));var headers={'Content-Type':_0x972f('0x7'),'Accept':_0x972f('0x7')};function emit(_0x2e826e,_0xf50589,_0x4bcdb6){io['to'](_0x2e826e)[_0x972f('0x8')](_0xf50589,_0x4bcdb6);}function getTicket(_0x463fd7,_0x438173,_0x3012b4,_0x42ed77,_0x4ac494){logger[_0x972f('0x9')](_0x972f('0xa'));var _0x1bb10e=_[_0x972f('0xb')]({'responder_id':_0x438173['id'],'requester_id':_0x3012b4['id'],'name':util['format'](_0x972f('0xc'),_0x4ac494[_0x972f('0xd')]),'phone':_0x4ac494[_0x972f('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x972f('0xf')](_0x42ed77['Subjects'],_0x4ac494,'\x20'),'description':intUtil['getString'](_0x42ed77[_0x972f('0x10')],_0x4ac494,_0x972f('0x11')),'tags':getTags(_0x42ed77[_0x972f('0x12')],'name')},getCustomFields(_0x42ed77[_0x972f('0x13')],_0x4ac494));_0x1bb10e['custom_fields']=_['mapValues'](_[_0x972f('0x14')](_0x1bb10e['custom_fields'],'id'),_0x972f('0x15'));return request({'uri':util[_0x972f('0x16')]('%s/api/v2/tickets',_0x463fd7['remoteUri']),'method':_0x972f('0x17'),'body':_0x1bb10e})[_0x972f('0x18')](function(_0x3f6df8){logger['info'](_0x972f('0x19'));return _0x3f6df8;});}function getUser(_0x43d3c5,_0x52ab12){if(intUtil[_0x972f('0x1a')](_0x52ab12)){return request({'uri':util[_0x972f('0x16')]('%s/api/v2/agents',_0x43d3c5[_0x972f('0x1b')]),'qs':{'email':_0x52ab12}})[_0x972f('0x18')](function(_0x2e8514){if(_0x2e8514[_0x972f('0x1c')]){logger[_0x972f('0x9')](_0x972f('0x1d'));return _[_0x972f('0x1e')](_0x2e8514,function(_0xd7ef0d){return _0xd7ef0d['contact'][_0x972f('0x1f')]===_0x52ab12;});}else{logger[_0x972f('0x9')](_0x972f('0x20'));return request({'uri':util[_0x972f('0x16')]('%s/api/v2/agents/me',_0x43d3c5[_0x972f('0x1b')])})['then'](function(_0x1cbf8e){logger['info'](_0x972f('0x21'));return _0x1cbf8e;});}});}else{logger[_0x972f('0x9')](_0x972f('0x22'));return request({'uri':util[_0x972f('0x16')](_0x972f('0x23'),_0x43d3c5['remoteUri'])})[_0x972f('0x18')](function(_0x284587){logger[_0x972f('0x9')]('Admin\x20account\x20selected.');return _0x284587;});}}function getEndUser(_0xff63d8,_0xa469ef,_0x196fb6){logger[_0x972f('0x9')](_0x972f('0x24'),_0x196fb6);return request({'uri':util[_0x972f('0x16')](_0x972f('0x25'),_0xff63d8[_0x972f('0x1b')]),'qs':{'phone':_0x196fb6}})[_0x972f('0x18')](function(_0x1f2615){if(_0x1f2615[_0x972f('0x1c')]){logger['info'](_0x972f('0x26'));return _[_0x972f('0x1e')](_0x1f2615,{'phone':_0x196fb6});}else{logger[_0x972f('0x9')](_0x972f('0x27'));return request({'uri':util['format'](_0x972f('0x25'),_0xff63d8[_0x972f('0x1b')]),'method':_0x972f('0x17'),'body':{'name':_0xa469ef,'phone':_0x196fb6}})[_0x972f('0x18')](function(_0x47d792){logger[_0x972f('0x9')]('Enduser\x20created.');return _0x47d792;});}});}function getAuth(_0x5c50fa){return util[_0x972f('0x16')](_0x972f('0x28'),new Buffer(_0x5c50fa[_0x972f('0x29')]+':X')['toString'](_0x972f('0x2a')));}function request(_0x3ed541){logger[_0x972f('0x2b')](_0x972f('0x2c'),JSON[_0x972f('0x2d')](_0x3ed541));return rp(_[_0x972f('0x2e')](_0x3ed541,{'method':_0x972f('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0xd627b5,_0x125038){var _0x1c8ded=[];if(_0xd627b5&&_0xd627b5['length']>0x0){_0x1c8ded=_[_0x972f('0x30')](_0xd627b5,_0x125038);}return _0x1c8ded;}function getCustomFields(_0x3b9c54,_0x29a10a){var _0x1cdc39=[];var _0x2fef36={'custom_fields':[]};if(_0x3b9c54['length']>0x0){_[_0x972f('0x31')](_0x3b9c54,function(_0x3b461d){if(_0x3b461d[_0x972f('0x32')]===_0x972f('0x33')&&_0x3b461d[_0x972f('0x34')]&&!_0x3b461d[_0x972f('0x35')]){_0x2fef36[_0x3b461d[_0x972f('0x34')]['toLowerCase']()]=_0x3b461d['content'][_0x972f('0x36')]();}else if(_0x3b461d[_0x972f('0x32')]===_0x972f('0x33')&&_0x3b461d[_0x972f('0x37')]&&_0x3b461d['customField']){_0x2fef36[_0x972f('0x38')][_0x972f('0x39')]({'id':_0x3b461d[_0x972f('0x37')],'value':_0x3b461d['content'][_0x972f('0x36')]()});}else if(_0x3b461d['type']===_0x972f('0x3a')&&_0x3b461d[_0x972f('0x3b')]&&_0x3b461d[_0x972f('0x37')]&&_0x3b461d['customField']){_0x29a10a[_0x3b461d[_0x972f('0x3b')]]&&_0x2fef36['custom_fields'][_0x972f('0x39')]({'id':_0x3b461d[_0x972f('0x37')],'value':_0x29a10a[_0x3b461d[_0x972f('0x3b')]]['toString']()});}else if(_0x3b461d['type']===_0x972f('0x3c')&&_0x3b461d[_0x972f('0x3d')]&&_0x3b461d['Variable']['name']&&_0x3b461d[_0x972f('0x37')]&&_0x3b461d['customField']){_0x29a10a[_0x3b461d[_0x972f('0x3d')][_0x972f('0x3e')][_0x972f('0x3f')]()]&&_0x2fef36[_0x972f('0x38')][_0x972f('0x39')]({'id':_0x3b461d[_0x972f('0x37')],'value':_0x29a10a[_0x3b461d[_0x972f('0x3d')]['name']['toLowerCase']()][_0x972f('0x36')]()});}});}return _0x2fef36;}exports[_0x972f('0x40')]=function(_0x592a8e,_0x5d0d0f,_0x4ad94c,_0x5d738a,_0x4bc67c,_0x5a470a){var _0x1ded26,_0xa19dbd;_0x5a470a[_0x972f('0x1b')]=intUtil[_0x972f('0x41')](_0x5a470a[_0x972f('0x1b')]);_0x5a470a['serverUrl']=intUtil[_0x972f('0x41')](_0x5a470a['serverUrl']);if(_0x4bc67c&&_0x4bc67c[_0x972f('0x42')]){logger['info']('[QUEUE]',_0x972f('0x43'));_0x5d0d0f[_0x972f('0x44')]=util[_0x972f('0x16')](_0x972f('0x45'),_0x5a470a['serverUrl'],_0x5d0d0f[_0x972f('0x46')],md5(_0x5d0d0f['uniqueid']));}else{_0x5d0d0f[_0x972f('0x44')]='';}headers['Authorization']=getAuth(_0x5a470a);return getUser(_0x5a470a,_0x5d738a[_0x972f('0x1f')])['then'](function(_0x49368c){_0x1ded26=_0x49368c;logger[_0x972f('0x9')]('The\x20User\x20ID\x20is:',_0x1ded26['id']);return getEndUser(_0x5a470a,_0x5d0d0f[_0x972f('0xd')],_0x5d0d0f[_0x972f('0xe')]);})[_0x972f('0x18')](function(_0x307380){_0xa19dbd=_0x307380;logger[_0x972f('0x9')]('The\x20Enduser\x20ID\x20is:',_0xa19dbd['id']);return getTicket(_0x5a470a,_0x1ded26,_0xa19dbd,_0x4ad94c,_0x5d0d0f);})[_0x972f('0x18')](function(_0x2ef7e4){if(_0x2ef7e4&&_0x2ef7e4['id']){logger['info'](_0x972f('0x19'));logger[_0x972f('0x9')](_0x972f('0x47'),_0x2ef7e4['id']);logger[_0x972f('0x9')]('[QUEUE]',_0x972f('0x48'));emit(util[_0x972f('0x16')](_0x972f('0x49'),_0x5d738a[_0x972f('0x3e')]),'trigger:browser:url',{'uri':util[_0x972f('0x16')](_0x972f('0x4a'),_0x5a470a['remoteUri'],_0x2ef7e4['id'])});}})['catch'](function(_0x33a379){logger[_0x972f('0x4b')](_0x972f('0x4c'),JSON['stringify'](_0x33a379));});};exports[_0x972f('0x4d')]=function(_0x4855d6,_0x405ce8,_0x1182df,_0x135d15,_0xe0bad3,_0x30f1d1,_0x131f14){var _0x44c4e0,_0x436c44;_0x30f1d1['remoteUri']=intUtil[_0x972f('0x41')](_0x30f1d1['remoteUri']);_0x30f1d1[_0x972f('0x4e')]=intUtil[_0x972f('0x41')](_0x30f1d1[_0x972f('0x4e')]);if(_0x131f14&&_0x131f14[_0x972f('0x4f')]&&_0x131f14[_0x972f('0x4f')]!==_0x972f('0x50')){logger[_0x972f('0x9')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x405ce8[_0x972f('0x44')]=util[_0x972f('0x16')](_0x972f('0x45'),_0x30f1d1[_0x972f('0x4e')],_0x405ce8[_0x972f('0x46')],md5(_0x405ce8['uniqueid']));}headers[_0x972f('0x51')]=getAuth(_0x30f1d1);return getUser(_0x30f1d1,_0x135d15['email'])[_0x972f('0x18')](function(_0x553fbe){_0x44c4e0=_0x553fbe;logger[_0x972f('0x9')](_0x972f('0x52'),_0x44c4e0['id']);return getEndUser(_0x30f1d1,_0x405ce8[_0x972f('0x53')],_0x405ce8[_0x972f('0x54')]);})[_0x972f('0x18')](function(_0x552b54){_0x436c44=_0x552b54;logger[_0x972f('0x9')](_0x972f('0x55'),_0x436c44['id']);return getTicket(_0x30f1d1,_0x44c4e0,_0x436c44,_0x1182df,_0x405ce8);})[_0x972f('0x18')](function(_0x11c9d7){if(_0x11c9d7&&_0x11c9d7['id']){logger[_0x972f('0x9')](_0x972f('0x19'));logger[_0x972f('0x9')](_0x972f('0x47'),_0x11c9d7['id']);logger[_0x972f('0x9')](_0x972f('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x972f('0x16')](_0x972f('0x49'),_0x135d15[_0x972f('0x3e')]),_0x972f('0x57'),{'uri':util[_0x972f('0x16')]('%s/helpdesk/tickets/%d',_0x30f1d1[_0x972f('0x1b')],_0x11c9d7['id'])});}})[_0x972f('0x58')](function(_0x223828){logger[_0x972f('0x4b')](_0x972f('0x56'),JSON[_0x972f('0x2d')](_0x223828));});};exports[_0x972f('0x59')]=function(_0x2f7afc,_0x3cca3e,_0x4c3311,_0x3b9fd9,_0x5354f9,_0x453bba){var _0x1d504a,_0x740147;_0x453bba[_0x972f('0x1b')]=intUtil[_0x972f('0x41')](_0x453bba['remoteUri']);_0x453bba[_0x972f('0x4e')]=intUtil[_0x972f('0x41')](_0x453bba[_0x972f('0x4e')]);if(_0x5354f9&&_0x5354f9[_0x972f('0x42')]){logger[_0x972f('0x9')]('['+_0x3cca3e[_0x972f('0x5a')][_0x972f('0x5b')]()+']',_0x972f('0x43'));_0x3cca3e[_0x972f('0x44')]=util[_0x972f('0x16')](_0x972f('0x45'),_0x453bba['serverUrl'],_0x3cca3e[_0x972f('0x46')],md5(_0x3cca3e[_0x972f('0x46')]));}else{_0x3cca3e[_0x972f('0x44')]='';}headers[_0x972f('0x51')]=getAuth(_0x453bba);return getUser(_0x453bba,'')['then'](function(_0x514287){_0x1d504a=_0x514287;logger[_0x972f('0x9')](_0x972f('0x52'),_0x1d504a['id']);return getEndUser(_0x453bba,_0x3cca3e[_0x972f('0xd')],_0x3cca3e[_0x972f('0xe')]);})[_0x972f('0x18')](function(_0x421570){_0x740147=_0x421570;logger[_0x972f('0x9')](_0x972f('0x55'),_0x740147['id']);return getTicket(_0x453bba,_0x1d504a,_0x740147,_0x4c3311,_0x3cca3e);})[_0x972f('0x18')](function(_0xa102a8){if(_0xa102a8){logger[_0x972f('0x9')](_0x972f('0x19'));logger[_0x972f('0x9')]('The\x20Ticket\x20ID\x20is:',_0xa102a8['id']);}})['catch'](function(_0x285a45){logger[_0x972f('0x4b')]('['+_0x3cca3e[_0x972f('0x5a')][_0x972f('0x5b')]()+']',JSON[_0x972f('0x2d')](_0x285a45));});}; \ No newline at end of file +var _0xe2ef=['../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','
','Tags','name','Fields','custom_fields','keyBy','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','apiKey','base64','debug','[HTTP]','GET','map','forEach','type','customField','nameField','content','string','idField','toString','variable','variableName','Variable','toLowerCase','push','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:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','stringify','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0xe2ef,0x171));var _0xfe2e=function(_0x4a03bb,_0x51aff1){_0x4a03bb=_0x4a03bb-0x0;var _0x4b1da3=_0xe2ef[_0x4a03bb];return _0x4b1da3;};'use strict';var _=require(_0xfe2e('0x0'));var rp=require(_0xfe2e('0x1'));var md5=require(_0xfe2e('0x2'));var util=require(_0xfe2e('0x3'));var Redis=require(_0xfe2e('0x4'));var intUtil=require(_0xfe2e('0x5'));var config=require(_0xfe2e('0x6'));var logger=require(_0xfe2e('0x7'))('freshdesk');config['redis']=_[_0xfe2e('0x8')](config[_0xfe2e('0x9')],{'host':_0xfe2e('0xa'),'port':0x18eb});var io=require(_0xfe2e('0xb'))(new Redis(config['redis']));var headers={'Content-Type':_0xfe2e('0xc'),'Accept':_0xfe2e('0xc')};function emit(_0xdd0214,_0x11cb3d,_0x3ae7ad){io['to'](_0xdd0214)['emit'](_0x11cb3d,_0x3ae7ad);}function getTicket(_0xcf8942,_0x32cf93,_0x525bc6,_0x54ea04,_0xa274e1){logger[_0xfe2e('0xd')](_0xfe2e('0xe'));var _0x43ea06=_[_0xfe2e('0xf')]({'responder_id':_0x32cf93['id'],'requester_id':_0x525bc6['id'],'name':util[_0xfe2e('0x10')](_0xfe2e('0x11'),_0xa274e1[_0xfe2e('0x12')]),'phone':_0xa274e1['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xfe2e('0x13')](_0x54ea04[_0xfe2e('0x14')],_0xa274e1,'\x20'),'description':intUtil[_0xfe2e('0x13')](_0x54ea04['Descriptions'],_0xa274e1,_0xfe2e('0x15')),'tags':getTags(_0x54ea04[_0xfe2e('0x16')],_0xfe2e('0x17'))},getCustomFields(_0x54ea04[_0xfe2e('0x18')],_0xa274e1));_0x43ea06[_0xfe2e('0x19')]=_['mapValues'](_[_0xfe2e('0x1a')](_0x43ea06[_0xfe2e('0x19')],'id'),'value');return request({'uri':util['format'](_0xfe2e('0x1b'),_0xcf8942['remoteUri']),'method':_0xfe2e('0x1c'),'body':_0x43ea06})['then'](function(_0x5501e6){logger[_0xfe2e('0xd')](_0xfe2e('0x1d'));return _0x5501e6;});}function getUser(_0x5c2850,_0x4f2186){if(intUtil[_0xfe2e('0x1e')](_0x4f2186)){return request({'uri':util[_0xfe2e('0x10')](_0xfe2e('0x1f'),_0x5c2850[_0xfe2e('0x20')]),'qs':{'email':_0x4f2186}})[_0xfe2e('0x21')](function(_0x4f452f){if(_0x4f452f[_0xfe2e('0x22')]){logger[_0xfe2e('0xd')](_0xfe2e('0x23'));return _[_0xfe2e('0x24')](_0x4f452f,function(_0x59e82a){return _0x59e82a[_0xfe2e('0x25')][_0xfe2e('0x26')]===_0x4f2186;});}else{logger['info'](_0xfe2e('0x27'));return request({'uri':util[_0xfe2e('0x10')](_0xfe2e('0x28'),_0x5c2850['remoteUri'])})[_0xfe2e('0x21')](function(_0xd25c87){logger[_0xfe2e('0xd')](_0xfe2e('0x29'));return _0xd25c87;});}});}else{logger[_0xfe2e('0xd')](_0xfe2e('0x2a'));return request({'uri':util['format'](_0xfe2e('0x28'),_0x5c2850['remoteUri'])})[_0xfe2e('0x21')](function(_0x27185b){logger['info']('Admin\x20account\x20selected.');return _0x27185b;});}}function getEndUser(_0x156423,_0x31eb9e,_0x2ea6f8){logger[_0xfe2e('0xd')]('Searching\x20enduser\x20with\x20phone',_0x2ea6f8);return request({'uri':util[_0xfe2e('0x10')](_0xfe2e('0x2b'),_0x156423[_0xfe2e('0x20')]),'qs':{'phone':_0x2ea6f8}})[_0xfe2e('0x21')](function(_0x25957a){if(_0x25957a[_0xfe2e('0x22')]){logger[_0xfe2e('0xd')](_0xfe2e('0x2c'));return _[_0xfe2e('0x24')](_0x25957a,{'phone':_0x2ea6f8});}else{logger[_0xfe2e('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xfe2e('0x10')](_0xfe2e('0x2b'),_0x156423[_0xfe2e('0x20')]),'method':_0xfe2e('0x1c'),'body':{'name':_0x31eb9e,'phone':_0x2ea6f8}})[_0xfe2e('0x21')](function(_0x2063db){logger[_0xfe2e('0xd')]('Enduser\x20created.');return _0x2063db;});}});}function getAuth(_0x415442){return util[_0xfe2e('0x10')](_0xfe2e('0x2d'),new Buffer(_0x415442[_0xfe2e('0x2e')]+':X')['toString'](_0xfe2e('0x2f')));}function request(_0xa17c69){logger[_0xfe2e('0x30')](_0xfe2e('0x31'),JSON['stringify'](_0xa17c69));return rp(_[_0xfe2e('0x8')](_0xa17c69,{'method':_0xfe2e('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x1ee7c6,_0x2f77a2){var _0x50a8a4=[];if(_0x1ee7c6&&_0x1ee7c6[_0xfe2e('0x22')]>0x0){_0x50a8a4=_[_0xfe2e('0x33')](_0x1ee7c6,_0x2f77a2);}return _0x50a8a4;}function getCustomFields(_0x4bee66,_0x53a9c5){var _0x47a1cc=[];var _0x160e7f={'custom_fields':[]};if(_0x4bee66[_0xfe2e('0x22')]>0x0){_[_0xfe2e('0x34')](_0x4bee66,function(_0x4608c2){if(_0x4608c2[_0xfe2e('0x35')]==='string'&&_0x4608c2['nameField']&&!_0x4608c2[_0xfe2e('0x36')]){_0x160e7f[_0x4608c2[_0xfe2e('0x37')]['toLowerCase']()]=_0x4608c2[_0xfe2e('0x38')]['toString']();}else if(_0x4608c2[_0xfe2e('0x35')]===_0xfe2e('0x39')&&_0x4608c2[_0xfe2e('0x3a')]&&_0x4608c2['customField']){_0x160e7f[_0xfe2e('0x19')]['push']({'id':_0x4608c2[_0xfe2e('0x3a')],'value':_0x4608c2[_0xfe2e('0x38')][_0xfe2e('0x3b')]()});}else if(_0x4608c2[_0xfe2e('0x35')]===_0xfe2e('0x3c')&&_0x4608c2[_0xfe2e('0x3d')]&&_0x4608c2['idField']&&_0x4608c2[_0xfe2e('0x36')]){_0x53a9c5[_0x4608c2['variableName']]&&_0x160e7f[_0xfe2e('0x19')]['push']({'id':_0x4608c2[_0xfe2e('0x3a')],'value':_0x53a9c5[_0x4608c2[_0xfe2e('0x3d')]][_0xfe2e('0x3b')]()});}else if(_0x4608c2[_0xfe2e('0x35')]==='customVariable'&&_0x4608c2['Variable']&&_0x4608c2[_0xfe2e('0x3e')]['name']&&_0x4608c2[_0xfe2e('0x3a')]&&_0x4608c2['customField']){_0x53a9c5[_0x4608c2[_0xfe2e('0x3e')][_0xfe2e('0x17')][_0xfe2e('0x3f')]()]&&_0x160e7f[_0xfe2e('0x19')][_0xfe2e('0x40')]({'id':_0x4608c2[_0xfe2e('0x3a')],'value':_0x53a9c5[_0x4608c2[_0xfe2e('0x3e')][_0xfe2e('0x17')][_0xfe2e('0x3f')]()][_0xfe2e('0x3b')]()});}});}return _0x160e7f;}exports[_0xfe2e('0x41')]=function(_0x2a0e00,_0x5c2ef0,_0x363921,_0x17fe5c,_0x3adcf9,_0x1c6bd8){var _0x3675b4,_0x271cf3;_0x1c6bd8['remoteUri']=intUtil['stripTrailingSlash'](_0x1c6bd8[_0xfe2e('0x20')]);_0x1c6bd8['serverUrl']=intUtil[_0xfe2e('0x42')](_0x1c6bd8[_0xfe2e('0x43')]);if(_0x3adcf9&&_0x3adcf9[_0xfe2e('0x44')]){logger[_0xfe2e('0xd')](_0xfe2e('0x45'),_0xfe2e('0x46'));_0x5c2ef0[_0xfe2e('0x47')]=util[_0xfe2e('0x10')](_0xfe2e('0x48'),_0x1c6bd8[_0xfe2e('0x43')],_0x5c2ef0[_0xfe2e('0x49')],md5(_0x5c2ef0[_0xfe2e('0x49')]));}else{_0x5c2ef0[_0xfe2e('0x47')]='';}headers['Authorization']=getAuth(_0x1c6bd8);return getUser(_0x1c6bd8,_0x17fe5c[_0xfe2e('0x26')])[_0xfe2e('0x21')](function(_0x946c2c){_0x3675b4=_0x946c2c;logger[_0xfe2e('0xd')](_0xfe2e('0x4a'),_0x3675b4['id']);return getEndUser(_0x1c6bd8,_0x5c2ef0[_0xfe2e('0x12')],_0x5c2ef0['calleridnum']);})[_0xfe2e('0x21')](function(_0x59fda4){_0x271cf3=_0x59fda4;logger[_0xfe2e('0xd')]('The\x20Enduser\x20ID\x20is:',_0x271cf3['id']);return getTicket(_0x1c6bd8,_0x3675b4,_0x271cf3,_0x363921,_0x5c2ef0);})['then'](function(_0x126053){if(_0x126053&&_0x126053['id']){logger[_0xfe2e('0xd')](_0xfe2e('0x1d'));logger[_0xfe2e('0xd')](_0xfe2e('0x4b'),_0x126053['id']);logger[_0xfe2e('0xd')](_0xfe2e('0x45'),_0xfe2e('0x4c'));emit(util[_0xfe2e('0x10')](_0xfe2e('0x4d'),_0x17fe5c['name']),_0xfe2e('0x4e'),{'uri':util[_0xfe2e('0x10')](_0xfe2e('0x4f'),_0x1c6bd8[_0xfe2e('0x20')],_0x126053['id'])});}})[_0xfe2e('0x50')](function(_0x124853){logger[_0xfe2e('0x51')](_0xfe2e('0x45'),JSON['stringify'](_0x124853));});};exports[_0xfe2e('0x52')]=function(_0x422f9a,_0xab8988,_0x11f024,_0x32d1dd,_0x4c5135,_0x4dcf22,_0x483ef0){var _0x3d3c66,_0x42a772;_0x4dcf22[_0xfe2e('0x20')]=intUtil[_0xfe2e('0x42')](_0x4dcf22[_0xfe2e('0x20')]);_0x4dcf22[_0xfe2e('0x43')]=intUtil[_0xfe2e('0x42')](_0x4dcf22[_0xfe2e('0x43')]);if(_0x483ef0&&_0x483ef0[_0xfe2e('0x53')]&&_0x483ef0['recordingFormat']!==_0xfe2e('0x54')){logger[_0xfe2e('0xd')](_0xfe2e('0x55'),_0xfe2e('0x46'));_0xab8988['recordingURL']=util[_0xfe2e('0x10')](_0xfe2e('0x48'),_0x4dcf22[_0xfe2e('0x43')],_0xab8988[_0xfe2e('0x49')],md5(_0xab8988['uniqueid']));}headers['Authorization']=getAuth(_0x4dcf22);return getUser(_0x4dcf22,_0x32d1dd['email'])[_0xfe2e('0x21')](function(_0x3353bf){_0x3d3c66=_0x3353bf;logger[_0xfe2e('0xd')](_0xfe2e('0x4a'),_0x3d3c66['id']);return getEndUser(_0x4dcf22,_0xab8988[_0xfe2e('0x56')],_0xab8988[_0xfe2e('0x57')]);})[_0xfe2e('0x21')](function(_0x38642f){_0x42a772=_0x38642f;logger['info'](_0xfe2e('0x58'),_0x42a772['id']);return getTicket(_0x4dcf22,_0x3d3c66,_0x42a772,_0x11f024,_0xab8988);})[_0xfe2e('0x21')](function(_0x5b53c2){if(_0x5b53c2&&_0x5b53c2['id']){logger['info'](_0xfe2e('0x1d'));logger[_0xfe2e('0xd')](_0xfe2e('0x4b'),_0x5b53c2['id']);logger[_0xfe2e('0xd')](_0xfe2e('0x55'),_0xfe2e('0x4c'));emit(util[_0xfe2e('0x10')]('user:%s',_0x32d1dd['name']),_0xfe2e('0x4e'),{'uri':util[_0xfe2e('0x10')]('%s/helpdesk/tickets/%d',_0x4dcf22[_0xfe2e('0x20')],_0x5b53c2['id'])});}})[_0xfe2e('0x50')](function(_0x50a52c){logger[_0xfe2e('0x51')](_0xfe2e('0x55'),JSON[_0xfe2e('0x59')](_0x50a52c));});};exports[_0xfe2e('0x5a')]=function(_0x4592f9,_0x12e954,_0x4a264c,_0x7eedf6,_0x1f470a,_0x20f2a7){var _0x5696dd,_0x4912db;_0x20f2a7['remoteUri']=intUtil['stripTrailingSlash'](_0x20f2a7[_0xfe2e('0x20')]);_0x20f2a7[_0xfe2e('0x43')]=intUtil[_0xfe2e('0x42')](_0x20f2a7['serverUrl']);if(_0x1f470a&&_0x1f470a['monitor_format']){logger[_0xfe2e('0xd')]('['+_0x12e954[_0xfe2e('0x5b')][_0xfe2e('0x5c')]()+']',_0xfe2e('0x46'));_0x12e954[_0xfe2e('0x47')]=util[_0xfe2e('0x10')](_0xfe2e('0x48'),_0x20f2a7['serverUrl'],_0x12e954[_0xfe2e('0x49')],md5(_0x12e954['uniqueid']));}else{_0x12e954[_0xfe2e('0x47')]='';}headers['Authorization']=getAuth(_0x20f2a7);return getUser(_0x20f2a7,'')[_0xfe2e('0x21')](function(_0x115ed6){_0x5696dd=_0x115ed6;logger['info'](_0xfe2e('0x4a'),_0x5696dd['id']);return getEndUser(_0x20f2a7,_0x12e954[_0xfe2e('0x12')],_0x12e954[_0xfe2e('0x5d')]);})[_0xfe2e('0x21')](function(_0xc91b7b){_0x4912db=_0xc91b7b;logger[_0xfe2e('0xd')]('The\x20Enduser\x20ID\x20is:',_0x4912db['id']);return getTicket(_0x20f2a7,_0x5696dd,_0x4912db,_0x4a264c,_0x12e954);})[_0xfe2e('0x21')](function(_0x4b77ad){if(_0x4b77ad){logger['info'](_0xfe2e('0x1d'));logger[_0xfe2e('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4b77ad['id']);}})['catch'](function(_0x5e74c1){logger['error']('['+_0x12e954[_0xfe2e('0x5b')][_0xfe2e('0x5c')]()+']',JSON['stringify'](_0x5e74c1));});}; \ 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 127daf5..1c86b4b 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 _0xedee=['freshsales','redis','localhost','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','Admin\x20found:','adminId','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','Admin\x20selected','userEmail','Requested\x20Resource\x20not\x20Found','filters','forEach','name','All\x20Contacts','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','format','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','apiKey','remoteUri','serverUrl','username','toLowerCase','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','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','moment','bluebird','ioredis','./util','../../../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedee,0x152));var _0xeede=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xedee[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var rp=require(_0xeede('0x0'));var md5=require('md5');var util=require('util');var moment=require(_0xeede('0x1'));var Promise=require(_0xeede('0x2'));var Redis=require(_0xeede('0x3'));var intUtil=require(_0xeede('0x4'));var config=require(_0xeede('0x5'));var logger=require('../../../../config/logger')(_0xeede('0x6'));config[_0xeede('0x7')]=_['defaults'](config[_0xeede('0x7')],{'host':_0xeede('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x4d32ab,_0x153daa,_0x35715f,_0x5925e8){return new Promise(function(_0x34e7e8,_0x5d1e71){var _0x203111=![];var _0x59fed5={'method':_0xeede('0x9'),'uri':_0x5925e8+'/api/selector/owners','json':!![]};_0x59fed5[_0xeede('0xa')]=_0x35715f;logger[_0xeede('0xb')](_0xeede('0xc'));return rp(_0x59fed5)[_0xeede('0xd')](function(_0x28b7c4){if(_0x28b7c4){var _0x237d54=_0x28b7c4[_0xeede('0xe')];var _0x5428f6=null;for(_0x5428f6=0x0;_0x5428f6<_0x237d54[_0xeede('0xf')];_0x5428f6++){if(_0x237d54[_0x5428f6][_0xeede('0x10')]===_0x4d32ab[_0xeede('0x11')]){_0x4d32ab['adminId']=_0x237d54[_0x5428f6]['id'];_0x203111=!![];}}if(_0x203111){logger[_0xeede('0xb')](_0xeede('0x12'),_0x4d32ab[_0xeede('0x13')]);_0x34e7e8(_0x4d32ab);}else{_0x5d1e71({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5d1e71({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xeede('0x14')](function(_0x673a40){logger[_0xeede('0x15')]('['+[_0x153daa[_0xeede('0x16')]()]+']',_0x673a40[_0xeede('0x17')]);_0x5d1e71(_0x673a40);});});}function getUser(_0xe4b5e6,_0x5ec578,_0x1ddc0f){return function(_0x49afa5){return new Promise(function(_0x4ef03c,_0x31493a){var _0x162478={'method':_0xeede('0x9'),'uri':_0x1ddc0f+'/api/selector/owners','json':!![]};_0x162478['headers']=_0x5ec578;logger[_0xeede('0xb')](_0xeede('0x18'));return rp(_0x162478)[_0xeede('0xd')](function(_0x21b1b5){if(_0x21b1b5){var _0x118bd5=_0x21b1b5[_0xeede('0xe')];var _0x18a28d=![];var _0x45aa19=null;if(_0x49afa5['agentEmail']!==null){logger['info'](_0xeede('0x19'),_0x49afa5[_0xeede('0x1a')]);_0x49afa5['userEmail']=_0x49afa5[_0xeede('0x1a')];for(_0x45aa19=0x0;_0x45aa19<_0x118bd5[_0xeede('0xf')];_0x45aa19++){if(_0x118bd5[_0x45aa19][_0xeede('0x10')]===_0x49afa5[_0xeede('0x1a')]){_0x18a28d=!![];_0x49afa5[_0xeede('0x1b')]=_0x118bd5[_0x45aa19]['id'];logger[_0xeede('0xb')](_0xeede('0x1c'),_0x49afa5[_0xeede('0x1b')]);}}}if(!_0x18a28d){logger['info'](_0xeede('0x1d'));_0x49afa5[_0xeede('0x1e')]=_0x49afa5[_0xeede('0x11')];_0x49afa5[_0xeede('0x1b')]=_0x49afa5[_0xeede('0x13')];_0x18a28d=!![];}if(_0x18a28d){_0x4ef03c(_0x49afa5);}else{_0x31493a({'statusCode':0x194,'message':_0xeede('0x1f')});}}else{_0x31493a({'statusCode':0x194,'message':_0xeede('0x1f')});}})[_0xeede('0x14')](function(_0x140c52){logger[_0xeede('0x15')]('['+[_0xe4b5e6[_0xeede('0x16')]()]+']',_0x140c52[_0xeede('0x17')]);_0x31493a(_0x140c52);});});};}function getEndUser(_0x5b9244,_0x43b3ac,_0x4dfb84){return function(_0x164530){return new Promise(function(_0x34e495,_0x9a9be7){var _0x55fd1b=0x0;var _0x58d3a8={'method':_0xeede('0x9'),'uri':_0x4dfb84+'/api/contacts/filters','json':!![]};_0x58d3a8[_0xeede('0xa')]=_0x43b3ac;logger[_0xeede('0xb')]('Getting\x20contacts\x20filter');return rp(_0x58d3a8)[_0xeede('0xd')](function(_0x2ecd53){_0x2ecd53[_0xeede('0x20')][_0xeede('0x21')](function(_0x3dd46a){if(_0x3dd46a[_0xeede('0x22')]===_0xeede('0x23')){_0x55fd1b=_0x3dd46a['id'];}});})[_0xeede('0xd')](function(){logger[_0xeede('0xb')]('Getting\x20contact\x20list');var _0x24f543={'method':_0xeede('0x9'),'uri':_0x4dfb84+_0xeede('0x24')+_0x55fd1b,'json':!![]};_0x24f543[_0xeede('0xa')]=_0x43b3ac;return rp(_0x24f543);})['then'](function(_0x43a07a){logger[_0xeede('0xb')](_0xeede('0x25'),_0x164530['contactNumber']);if(_0x43a07a[_0xeede('0x26')][_0xeede('0xf')]>0x0){var _0x182dbb=_[_0xeede('0x27')](_0x43a07a[_0xeede('0x26')],function(_0x4b2a71){if(_0x4b2a71[_0xeede('0x28')]===_0x164530[_0xeede('0x29')]||_0x4b2a71[_0xeede('0x2a')]===_0x164530[_0xeede('0x29')]){return _0x4b2a71;}});if(_0x182dbb){_0x164530[_0xeede('0x2b')]=_0x182dbb['id'];logger[_0xeede('0xb')]('Contact\x20found:',_0x164530[_0xeede('0x2b')]);_0x34e495(_0x164530);}else{return createEndUser(_0x164530,_0x5b9244,_0x43b3ac,_0x4dfb84)['then'](function(_0x26d993){logger[_0xeede('0xb')](_0xeede('0x2c'),_0x164530[_0xeede('0x2b')]);_0x34e495(_0x26d993);});}}else{return createEndUser(_0x164530,_0x5b9244,_0x43b3ac,_0x4dfb84)['then'](function(_0x24ba2f){logger['info'](_0xeede('0x2c'),_0x164530['endUserId']);_0x34e495(_0x24ba2f);});}})[_0xeede('0x14')](function(_0x484301){throw new Error(_0x484301['message']);});});};}function createEndUser(_0x2e55bd,_0x828103,_0x5e2d43,_0x2732b6){return new Promise(function(_0x4d2863,_0x41bf3d){var _0x5edb49=moment();var _0x38fa41={'method':_0xeede('0x2d'),'uri':_0x2732b6+_0xeede('0x2e'),'body':{'contact':{'last_name':_0x2e55bd[_0xeede('0x29')],'work_number':_0x2e55bd[_0xeede('0x29')],'mobile_number':_0x2e55bd[_0xeede('0x29')],'owner_id':_0x2e55bd[_0xeede('0x1b')],'created_at':_0x5edb49['format'](_0xeede('0x2f'))}},'json':!![]};_0x38fa41[_0xeede('0xa')]=_0x5e2d43;logger['info'](_0xeede('0x30'));return rp(_0x38fa41)['then'](function(_0x54be2c){_0x2e55bd[_0xeede('0x2b')]=_0x54be2c[_0xeede('0x31')]['id'];_0x4d2863(_0x2e55bd);})[_0xeede('0x14')](function(_0x2c02e3){logger[_0xeede('0x15')]('['+[_0x828103[_0xeede('0x16')]()]+']',_0x2c02e3[_0xeede('0x17')]);_0x41bf3d(_0x2c02e3[_0xeede('0x17')]);});});}function getTicket(_0x27402e,_0x360222,_0x5748b4,_0x462be5,_0x6fffdc){return function(_0x1fad71){logger[_0xeede('0xb')](_0xeede('0x32'));return new Promise(function(_0x331769,_0x422208){var _0x1f2cb1=moment();var _0x235488={'method':_0xeede('0x2d'),'uri':_0x5748b4+_0xeede('0x33'),'body':{'title':intUtil[_0xeede('0x34')](_0x462be5[_0xeede('0x35')],_0x6fffdc,'\x20'),'description':intUtil['getString'](_0x462be5[_0xeede('0x36')],_0x6fffdc,'\x0a'),'owner_id':_0x1fad71[_0xeede('0x1b')],'creater_id':_0x1fad71['adminId'],'targetable_id':_0x1fad71[_0xeede('0x2b')],'targetable_type':'Contact','created_at':_0x1f2cb1['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x1f2cb1['add'](0x1e,'m')[_0xeede('0x37')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x235488[_0xeede('0xa')]=_0x360222;return rp(_0x235488)[_0xeede('0xd')](function(_0x2fba4e){_0x1fad71[_0xeede('0x38')]=_0x2fba4e[_0xeede('0x39')]['id'];logger[_0xeede('0xb')](_0xeede('0x3a'),_0x1fad71[_0xeede('0x38')]);_0x331769(_0x1fad71);})[_0xeede('0x14')](function(_0x1013e4){logger[_0xeede('0x15')]('['+[_0x27402e[_0xeede('0x16')]()]+']',_0x1013e4['message']);_0x422208(_0x1013e4[_0xeede('0x17')]);});});};}function emit(_0x31c250,_0xafd48c,_0x39d0a2){var _0x4d126f={'uri':_0x31c250+_0xeede('0x3b')+_0x39d0a2};io['to'](util[_0xeede('0x37')](_0xeede('0x3c'),_0xafd48c))[_0xeede('0x3d')](_0xeede('0x3e'),_0x4d126f);}exports['cs']=function(_0x50bdf4,_0xda569d,_0x46c92b,_0x2f63c1,_0x13f295,_0xdb7f5b,_0x22a0d4,_0x3b5d70){var _0x46241e={};var _0x2480a2={'Authorization':'Token\x20token='+_0xdb7f5b[_0xeede('0x3f')]};_0xdb7f5b[_0xeede('0x40')]=intUtil['stripTrailingSlash'](_0xdb7f5b[_0xeede('0x40')]);_0xdb7f5b[_0xeede('0x41')]=intUtil['stripTrailingSlash'](_0xdb7f5b[_0xeede('0x41')]);var _0x470b36=_0xdb7f5b[_0xeede('0x40')];_0x46241e['adminEmail']=_0xdb7f5b[_0xeede('0x42')];_0x46241e[_0xeede('0x29')]=_0x3b5d70[_0xeede('0x43')]()===_0xeede('0x44')?_0xda569d[_0xeede('0x45')]:_0xda569d[_0xeede('0x46')];_0x46241e[_0xeede('0x47')]=_0x3b5d70===_0xeede('0x48')||_0x3b5d70===_0xeede('0x49')?_0xeede('0x48'):'outbound';if(_0x2f63c1){_0x46241e[_0xeede('0x1a')]=_0x2f63c1[_0xeede('0x10')];}var _0x4ad330=util[_0xeede('0x37')](_0xeede('0x4a'),_0xdb7f5b[_0xeede('0x41')],_0xda569d[_0xeede('0x4b')],md5(_0xda569d[_0xeede('0x4b')]));if(_0x13f295&&_0x13f295[_0xeede('0x4c')]){logger[_0xeede('0xb')](_0xeede('0x4d'),_0xeede('0x4e'));_0xda569d['recordingURL']=_0x4ad330;}else if(_0x22a0d4&&_0x22a0d4[_0xeede('0x4f')]&&_0x22a0d4[_0xeede('0x4f')]!==_0xeede('0x50')){logger[_0xeede('0xb')]('[OUTBOUND]',_0xeede('0x4e'));_0xda569d[_0xeede('0x51')]=_0x4ad330;}else{_0xda569d[_0xeede('0x51')]='';}return getAdminId(_0x46241e,_0x3b5d70,_0x2480a2,_0x470b36)[_0xeede('0xd')](getUser(_0x3b5d70,_0x2480a2,_0x470b36))[_0xeede('0xd')](getEndUser(_0x3b5d70,_0x2480a2,_0x470b36))[_0xeede('0xd')](getTicket(_0x3b5d70,_0x2480a2,_0x470b36,_0x46c92b,_0xda569d))['then'](function(_0x3eb371){logger[_0xeede('0xb')](util['format'](_0xeede('0x52'),_0x3eb371[_0xeede('0x38')]));if(_0x3b5d70!==_0xeede('0x49')){logger[_0xeede('0xb')]('['+[_0x3b5d70[_0xeede('0x16')]()]+']',_0xeede('0x53'));emit(_0x470b36,_0x2f63c1[_0xeede('0x22')],_0x3eb371[_0xeede('0x2b')]);}})[_0xeede('0x14')](function(_0x372236){logger[_0xeede('0x15')]('['+[_0x3b5d70[_0xeede('0x16')]()]+_0xeede('0x54'),util[_0xeede('0x55')](_0x372236,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9bec=['defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','adminEmail','Admin\x20found:','adminId','catch','error','toUpperCase','message','Getting\x20user\x20list','then','users','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','Admin\x20selected','Requested\x20Resource\x20not\x20Found','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','All\x20Contacts','Searching\x20contact\x20with\x20phone','contactNumber','contacts','length','find','work_number','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','callDirection','queue','unmanaged','outbound','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','bluebird','./util','redis'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x9bec,0x147));var _0xc9be=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x9bec[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0xc9be('0x0'));var rp=require(_0xc9be('0x1'));var md5=require('md5');var util=require('util');var moment=require('moment');var Promise=require(_0xc9be('0x2'));var Redis=require('ioredis');var intUtil=require(_0xc9be('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config[_0xc9be('0x4')]=_[_0xc9be('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc9be('0x6'))(new Redis(config[_0xc9be('0x4')]));function getAdminId(_0x1390d4,_0x399a85,_0x15fee9,_0x10a634){return new Promise(function(_0x49c067,_0x105e0d){var _0x48b3a6=![];var _0xd958={'method':_0xc9be('0x7'),'uri':_0x10a634+_0xc9be('0x8'),'json':!![]};_0xd958[_0xc9be('0x9')]=_0x15fee9;logger[_0xc9be('0xa')](_0xc9be('0xb'));return rp(_0xd958)['then'](function(_0x59eb65){if(_0x59eb65){var _0x4c4ef1=_0x59eb65['users'];var _0x36f58c=null;for(_0x36f58c=0x0;_0x36f58c<_0x4c4ef1['length'];_0x36f58c++){if(_0x4c4ef1[_0x36f58c]['email']===_0x1390d4[_0xc9be('0xc')]){_0x1390d4['adminId']=_0x4c4ef1[_0x36f58c]['id'];_0x48b3a6=!![];}}if(_0x48b3a6){logger[_0xc9be('0xa')](_0xc9be('0xd'),_0x1390d4[_0xc9be('0xe')]);_0x49c067(_0x1390d4);}else{_0x105e0d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x105e0d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc9be('0xf')](function(_0x3be298){logger[_0xc9be('0x10')]('['+[_0x399a85[_0xc9be('0x11')]()]+']',_0x3be298[_0xc9be('0x12')]);_0x105e0d(_0x3be298);});});}function getUser(_0x5e3173,_0x1cc22c,_0x1cd27d){return function(_0x3af05c){return new Promise(function(_0x2db683,_0x2864fd){var _0x1d6c96={'method':'GET','uri':_0x1cd27d+_0xc9be('0x8'),'json':!![]};_0x1d6c96[_0xc9be('0x9')]=_0x1cc22c;logger['info'](_0xc9be('0x13'));return rp(_0x1d6c96)[_0xc9be('0x14')](function(_0xa474a0){if(_0xa474a0){var _0xf229=_0xa474a0[_0xc9be('0x15')];var _0x262244=![];var _0x3f39e3=null;if(_0x3af05c['agentEmail']!==null){logger['info'](_0xc9be('0x16'),_0x3af05c[_0xc9be('0x17')]);_0x3af05c[_0xc9be('0x18')]=_0x3af05c[_0xc9be('0x17')];for(_0x3f39e3=0x0;_0x3f39e3<_0xf229['length'];_0x3f39e3++){if(_0xf229[_0x3f39e3]['email']===_0x3af05c[_0xc9be('0x17')]){_0x262244=!![];_0x3af05c[_0xc9be('0x19')]=_0xf229[_0x3f39e3]['id'];logger['info']('User\x20found:',_0x3af05c[_0xc9be('0x19')]);}}}if(!_0x262244){logger['info'](_0xc9be('0x1a'));_0x3af05c[_0xc9be('0x18')]=_0x3af05c[_0xc9be('0xc')];_0x3af05c[_0xc9be('0x19')]=_0x3af05c[_0xc9be('0xe')];_0x262244=!![];}if(_0x262244){_0x2db683(_0x3af05c);}else{_0x2864fd({'statusCode':0x194,'message':_0xc9be('0x1b')});}}else{_0x2864fd({'statusCode':0x194,'message':_0xc9be('0x1b')});}})['catch'](function(_0x2cb266){logger['error']('['+[_0x5e3173['toUpperCase']()]+']',_0x2cb266['message']);_0x2864fd(_0x2cb266);});});};}function getEndUser(_0x526606,_0x5289c3,_0x4b2c8c){return function(_0x2637ee){return new Promise(function(_0x23e47d,_0xf4fc4d){var _0x2e41e8=0x0;var _0x129b16={'method':_0xc9be('0x7'),'uri':_0x4b2c8c+_0xc9be('0x1c'),'json':!![]};_0x129b16[_0xc9be('0x9')]=_0x5289c3;logger[_0xc9be('0xa')](_0xc9be('0x1d'));return rp(_0x129b16)['then'](function(_0x1dc78c){_0x1dc78c[_0xc9be('0x1e')][_0xc9be('0x1f')](function(_0x4dbec2){if(_0x4dbec2['name']===_0xc9be('0x20')){_0x2e41e8=_0x4dbec2['id'];}});})['then'](function(){logger[_0xc9be('0xa')]('Getting\x20contact\x20list');var _0x24fc42={'method':_0xc9be('0x7'),'uri':_0x4b2c8c+'/api/contacts/view/'+_0x2e41e8,'json':!![]};_0x24fc42[_0xc9be('0x9')]=_0x5289c3;return rp(_0x24fc42);})[_0xc9be('0x14')](function(_0x56d334){logger['info'](_0xc9be('0x21'),_0x2637ee[_0xc9be('0x22')]);if(_0x56d334[_0xc9be('0x23')][_0xc9be('0x24')]>0x0){var _0x37cc60=_[_0xc9be('0x25')](_0x56d334[_0xc9be('0x23')],function(_0x56ab58){if(_0x56ab58[_0xc9be('0x26')]===_0x2637ee[_0xc9be('0x22')]||_0x56ab58[_0xc9be('0x27')]===_0x2637ee[_0xc9be('0x22')]){return _0x56ab58;}});if(_0x37cc60){_0x2637ee[_0xc9be('0x28')]=_0x37cc60['id'];logger[_0xc9be('0xa')](_0xc9be('0x29'),_0x2637ee[_0xc9be('0x28')]);_0x23e47d(_0x2637ee);}else{return createEndUser(_0x2637ee,_0x526606,_0x5289c3,_0x4b2c8c)[_0xc9be('0x14')](function(_0x4fdbc4){logger[_0xc9be('0xa')]('Contact\x20created:',_0x2637ee['endUserId']);_0x23e47d(_0x4fdbc4);});}}else{return createEndUser(_0x2637ee,_0x526606,_0x5289c3,_0x4b2c8c)[_0xc9be('0x14')](function(_0x32048b){logger[_0xc9be('0xa')](_0xc9be('0x2a'),_0x2637ee[_0xc9be('0x28')]);_0x23e47d(_0x32048b);});}})['catch'](function(_0x4e03e5){throw new Error(_0x4e03e5[_0xc9be('0x12')]);});});};}function createEndUser(_0x1e5a53,_0x59e984,_0x28dcb7,_0x2ccde7){return new Promise(function(_0x5c2ca5,_0xcefe56){var _0x1b4018=moment();var _0x2150fc={'method':_0xc9be('0x2b'),'uri':_0x2ccde7+_0xc9be('0x2c'),'body':{'contact':{'last_name':_0x1e5a53['contactNumber'],'work_number':_0x1e5a53['contactNumber'],'mobile_number':_0x1e5a53[_0xc9be('0x22')],'owner_id':_0x1e5a53[_0xc9be('0x19')],'created_at':_0x1b4018[_0xc9be('0x2d')](_0xc9be('0x2e'))}},'json':!![]};_0x2150fc[_0xc9be('0x9')]=_0x28dcb7;logger[_0xc9be('0xa')](_0xc9be('0x2f'));return rp(_0x2150fc)['then'](function(_0x403462){_0x1e5a53[_0xc9be('0x28')]=_0x403462[_0xc9be('0x30')]['id'];_0x5c2ca5(_0x1e5a53);})['catch'](function(_0x3ad7a1){logger['error']('['+[_0x59e984[_0xc9be('0x11')]()]+']',_0x3ad7a1[_0xc9be('0x12')]);_0xcefe56(_0x3ad7a1[_0xc9be('0x12')]);});});}function getTicket(_0x2050c1,_0x1b54b2,_0x463e6e,_0x1b9e00,_0x3c97e5){return function(_0x5df76f){logger[_0xc9be('0xa')](_0xc9be('0x31'));return new Promise(function(_0x3329ca,_0x389e20){var _0x10ef15=moment();var _0x140ae5={'method':'POST','uri':_0x463e6e+_0xc9be('0x32'),'body':{'title':intUtil[_0xc9be('0x33')](_0x1b9e00[_0xc9be('0x34')],_0x3c97e5,'\x20'),'description':intUtil[_0xc9be('0x33')](_0x1b9e00[_0xc9be('0x35')],_0x3c97e5,'\x0a'),'owner_id':_0x5df76f[_0xc9be('0x19')],'creater_id':_0x5df76f[_0xc9be('0xe')],'targetable_id':_0x5df76f['endUserId'],'targetable_type':_0xc9be('0x36'),'created_at':_0x10ef15[_0xc9be('0x2d')](_0xc9be('0x2e')),'due_date':_0x10ef15[_0xc9be('0x37')](0x1e,'m')[_0xc9be('0x2d')](_0xc9be('0x2e'))},'json':!![]};_0x140ae5[_0xc9be('0x9')]=_0x1b54b2;return rp(_0x140ae5)[_0xc9be('0x14')](function(_0x302ae3){_0x5df76f[_0xc9be('0x38')]=_0x302ae3['task']['id'];logger[_0xc9be('0xa')](_0xc9be('0x39'),_0x5df76f[_0xc9be('0x38')]);_0x3329ca(_0x5df76f);})[_0xc9be('0xf')](function(_0x4f7e5f){logger[_0xc9be('0x10')]('['+[_0x2050c1['toUpperCase']()]+']',_0x4f7e5f[_0xc9be('0x12')]);_0x389e20(_0x4f7e5f['message']);});});};}function emit(_0x4a643f,_0x122df0,_0x48c21b){var _0x58cbc4={'uri':_0x4a643f+'/contacts/'+_0x48c21b};io['to'](util['format']('user:%s',_0x122df0))[_0xc9be('0x3a')](_0xc9be('0x3b'),_0x58cbc4);}exports['cs']=function(_0x5b19cc,_0x28de69,_0xcad508,_0x264159,_0x46f368,_0x343955,_0x2c4156,_0x33089d){var _0x2d1d31={};var _0x3a7c35={'Authorization':'Token\x20token='+_0x343955[_0xc9be('0x3c')]};_0x343955[_0xc9be('0x3d')]=intUtil[_0xc9be('0x3e')](_0x343955[_0xc9be('0x3d')]);_0x343955[_0xc9be('0x3f')]=intUtil[_0xc9be('0x3e')](_0x343955['serverUrl']);var _0xa8e6c4=_0x343955[_0xc9be('0x3d')];_0x2d1d31[_0xc9be('0xc')]=_0x343955[_0xc9be('0x40')];_0x2d1d31[_0xc9be('0x22')]=_0x33089d[_0xc9be('0x41')]()==='outbound'?_0x28de69['destcalleridnum']:_0x28de69['calleridnum'];_0x2d1d31[_0xc9be('0x42')]=_0x33089d===_0xc9be('0x43')||_0x33089d===_0xc9be('0x44')?_0xc9be('0x43'):_0xc9be('0x45');if(_0x264159){_0x2d1d31[_0xc9be('0x17')]=_0x264159[_0xc9be('0x46')];}var _0x3a2f86=util[_0xc9be('0x2d')](_0xc9be('0x47'),_0x343955[_0xc9be('0x3f')],_0x28de69['uniqueid'],md5(_0x28de69['uniqueid']));if(_0x46f368&&_0x46f368[_0xc9be('0x48')]){logger['info'](_0xc9be('0x49'),_0xc9be('0x4a'));_0x28de69[_0xc9be('0x4b')]=_0x3a2f86;}else if(_0x2c4156&&_0x2c4156[_0xc9be('0x4c')]&&_0x2c4156['recordingFormat']!==_0xc9be('0x4d')){logger['info'](_0xc9be('0x4e'),_0xc9be('0x4a'));_0x28de69[_0xc9be('0x4b')]=_0x3a2f86;}else{_0x28de69['recordingURL']='';}return getAdminId(_0x2d1d31,_0x33089d,_0x3a7c35,_0xa8e6c4)['then'](getUser(_0x33089d,_0x3a7c35,_0xa8e6c4))[_0xc9be('0x14')](getEndUser(_0x33089d,_0x3a7c35,_0xa8e6c4))[_0xc9be('0x14')](getTicket(_0x33089d,_0x3a7c35,_0xa8e6c4,_0xcad508,_0x28de69))[_0xc9be('0x14')](function(_0x1dea9f){logger['info'](util[_0xc9be('0x2d')](_0xc9be('0x4f'),_0x1dea9f['ticketId']));if(_0x33089d!==_0xc9be('0x44')){logger[_0xc9be('0xa')]('['+[_0x33089d[_0xc9be('0x11')]()]+']',_0xc9be('0x50'));emit(_0xa8e6c4,_0x264159['name'],_0x1dea9f['endUserId']);}})[_0xc9be('0xf')](function(_0x54c9ec){logger[_0xc9be('0x10')]('['+[_0x33089d[_0xc9be('0x11')]()]+_0xc9be('0x51'),util[_0xc9be('0x52')](_0x54c9ec,{'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 cd915b7..556f763 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 _0x0b0e=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','unmanaged','freshdesk','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho'];(function(_0x43d94e,_0x5808ec){var _0x5a9ef7=function(_0x5501b9){while(--_0x5501b9){_0x43d94e['push'](_0x43d94e['shift']());}};_0x5a9ef7(++_0x5808ec);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0x0b0e[_0x2867d8];return _0x3b8176;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var zendesk=require(_0xe0b0('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xe0b0('0x2'));var freshdesk=require(_0xe0b0('0x3'));var zoho=require(_0xe0b0('0x4'));var desk=require(_0xe0b0('0x5'));var vtiger=require(_0xe0b0('0x6'));var servicenow=require(_0xe0b0('0x7'));var dynamics365=require(_0xe0b0('0x8'));var freshsales=require(_0xe0b0('0x9'));var integrations=[_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'freshdesk','zoho',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'servicenow'];exports[_0xe0b0('0x11')]=function(_0x1dd3b8,_0x553d4f,_0x1fef28,_0x2f32b6,_0x574d96,_0x399320){if(_0x1fef28){if(_[_0xe0b0('0x12')](integrations,_0x1dd3b8[_0xe0b0('0x13')]['toLowerCase']())){try{var _0x3068c0=null;var _0x1c358a='';var _0x3cc19a=_0x1fef28[_0x1dd3b8[_0xe0b0('0x13')][_0xe0b0('0x14')]()];if(_0x3cc19a){var _0x4d2bf7=_0x3cc19a[_0x1dd3b8[_0xe0b0('0x15')]];if(_0x4d2bf7){var _0x154de6=_[_0xe0b0('0x16')](_0x4d2bf7[_0xe0b0('0x17')],{'id':parseInt(_0x1dd3b8[_0xe0b0('0x18')],0xa)});if(_0x154de6){if(_0x2f32b6){if(_0x574d96&&_0x553d4f['queue']){_0x1c358a=_0xe0b0('0x19');}else if(_0x553d4f['routeId']){_0x1c358a=_0xe0b0('0x1a');}else{console[_0xe0b0('0x1b')]('EVENT\x20UNKNOWN',_0x553d4f);}}else{_0x1c358a=_0xe0b0('0x1c');}switch(_0x1dd3b8['data1'][_0xe0b0('0x14')]()){case _0xe0b0('0xa'):zendesk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'salesforce':salesforce[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'sugarcrm':sugarcrm[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case _0xe0b0('0x1d'):freshdesk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'zoho':zoho[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'desk':desk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'vtiger':vtiger[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case _0xe0b0('0x10'):freshsales['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;case'servicenow':servicenow['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;case'dynamics365':dynamics365['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;default:console[_0xe0b0('0x1b')]('unknown\x20integration');}}else{_0x3068c0=require(_0xe0b0('0x1e'))(_0x1dd3b8['data1'][_0xe0b0('0x14')]());_0x3068c0[_0xe0b0('0x1f')](_0xe0b0('0x20'),util[_0xe0b0('0x21')](_0xe0b0('0x22'),_0x1dd3b8['data1']['toLowerCase'](),_0x1dd3b8[_0xe0b0('0x18')]));}}else{_0x3068c0=require('../../../../config/logger')(_0x1dd3b8[_0xe0b0('0x13')][_0xe0b0('0x14')]());_0x3068c0['error'](_0xe0b0('0x20'),util['format'](_0xe0b0('0x23'),_0x1dd3b8['data1'][_0xe0b0('0x14')](),_0x1dd3b8['data2']));}}else{}}catch(_0x3e5c88){console['error'](_0x3e5c88);}}}}; \ No newline at end of file +var _0xefda=['./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0xefda,0x96));var _0xaefd=function(_0x310a54,_0x212d9a){_0x310a54=_0x310a54-0x0;var _0x4e4caa=_0xefda[_0x310a54];return _0x4e4caa;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xaefd('0x1'));var sugarcrm=require(_0xaefd('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xaefd('0x3'));var desk=require(_0xaefd('0x4'));var vtiger=require(_0xaefd('0x5'));var servicenow=require(_0xaefd('0x6'));var dynamics365=require(_0xaefd('0x7'));var freshsales=require(_0xaefd('0x8'));var integrations=['zendesk',_0xaefd('0x9'),_0xaefd('0xa'),_0xaefd('0xb'),_0xaefd('0xc'),'desk',_0xaefd('0xd'),_0xaefd('0xe'),_0xaefd('0xf'),'servicenow'];exports['exec']=function(_0x54a3b1,_0xa6239d,_0x16b36e,_0x20135c,_0x35eea5,_0x10272a){if(_0x16b36e){if(_[_0xaefd('0x10')](integrations,_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')]())){try{var _0x27be0f=null;var _0x382983='';var _0x2a310c=_0x16b36e[_0x54a3b1['data1'][_0xaefd('0x12')]()];if(_0x2a310c){var _0x4ac467=_0x2a310c[_0x54a3b1[_0xaefd('0x13')]];if(_0x4ac467){var _0x1725af=_[_0xaefd('0x14')](_0x4ac467[_0xaefd('0x15')],{'id':parseInt(_0x54a3b1['data3'],0xa)});if(_0x1725af){if(_0x20135c){if(_0x35eea5&&_0xa6239d[_0xaefd('0x16')]){_0x382983=_0xaefd('0x16');}else if(_0xa6239d[_0xaefd('0x17')]){_0x382983=_0xaefd('0x18');}else{console[_0xaefd('0x19')](_0xaefd('0x1a'),_0xa6239d);}}else{_0x382983=_0xaefd('0x1b');}switch(_0x54a3b1[_0xaefd('0x11')]['toLowerCase']()){case _0xaefd('0x1c'):zendesk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0x9'):salesforce[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xa'):sugarcrm[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xb'):freshdesk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xc'):zoho[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0x1d'):desk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case'vtiger':vtiger[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xf'):freshsales['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;case _0xaefd('0x1e'):servicenow['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;case _0xaefd('0xe'):dynamics365['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;default:console[_0xaefd('0x19')](_0xaefd('0x1f'));}}else{_0x27be0f=require(_0xaefd('0x20'))(_0x54a3b1['data1'][_0xaefd('0x12')]());_0x27be0f[_0xaefd('0x21')](_0xaefd('0x22'),util[_0xaefd('0x23')](_0xaefd('0x24'),_0x54a3b1['data1']['toLowerCase'](),_0x54a3b1['data3']));}}else{_0x27be0f=require(_0xaefd('0x20'))(_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')]());_0x27be0f['error'](_0xaefd('0x22'),util['format'](_0xaefd('0x25'),_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')](),_0x54a3b1['data2']));}}else{}}catch(_0x435413){console[_0xaefd('0x21')](_0x435413);}}}}; \ 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 bf9ec0e..ca97c68 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 _0xce38=['name','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','util','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','emit','ticketType','assign','utc','Subjects','getString','Descriptions','WhoId','Case','sobject','create','validateEmail','User','execute','length','Email','info','Agent\x20%s\x20found.','Name','identity','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','Task','moduleSearch','find','Lead','contact','Contact','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','type','string','idField','content','toString','variableName','customVariable','Variable','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xce38,0x163));var _0x8ce3=function(_0xec1b03,_0x1ed76f){_0xec1b03=_0xec1b03-0x0;var _0x140c51=_0xce38[_0xec1b03];return _0x140c51;};'use strict';var _=require(_0x8ce3('0x0'));var rp=require('request-promise');var moment=require(_0x8ce3('0x1'));var BPromise=require(_0x8ce3('0x2'));var md5=require(_0x8ce3('0x3'));var jsforce=require('jsforce');var util=require(_0x8ce3('0x4'));var Redis=require(_0x8ce3('0x5'));var intUtil=require(_0x8ce3('0x6'));var config=require('../../../../config/environment');var logger=require(_0x8ce3('0x7'))('salesforce');config[_0x8ce3('0x8')]=_['defaults'](config[_0x8ce3('0x8')],{'host':_0x8ce3('0x9'),'port':0x18eb});var io=require(_0x8ce3('0xa'))(new Redis(config['redis']));function emit(_0x241558,_0x3ddfc6,_0x11b3ad){io['to'](_0x241558)[_0x8ce3('0xb')](_0x3ddfc6,_0x11b3ad);}function getTicket(_0x2c04dc,_0xc75deb,_0x11b0ec,_0x4ad581,_0x2142ec,_0x529ec3,_0x259dfd,_0xf686b9){var _0xcb3d1f={};if(_0x4ad581[_0x8ce3('0xc')]==='Task'){_0xcb3d1f=Object[_0x8ce3('0xd')]({},{'OwnerId':_0xc75deb['id'],'ActivityDate':moment[_0x8ce3('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x4ad581[_0x8ce3('0xf')],_0x2142ec,'\x20'),'Description':intUtil[_0x8ce3('0x10')](_0x4ad581[_0x8ce3('0x11')],_0x2142ec,'\x0a')},getCustomFields(_0x529ec3,_0x2142ec));if(_0x11b0ec){_0xcb3d1f[_0x8ce3('0x12')]=_0x11b0ec['id'];}}else if(_0x4ad581[_0x8ce3('0xc')]===_0x8ce3('0x13')){_0xcb3d1f=Object[_0x8ce3('0xd')]({},{'OwnerId':_0xc75deb['id'],'Subject':intUtil[_0x8ce3('0x10')](_0x4ad581[_0x8ce3('0xf')],_0x2142ec,'\x20'),'Description':intUtil[_0x8ce3('0x10')](_0x4ad581[_0x8ce3('0x11')],_0x2142ec,'\x0a')},getCustomFields(_0x529ec3,_0x2142ec));if(_0x11b0ec){_0xcb3d1f['ContactId']=_0x11b0ec['id'];}}return _0x259dfd[_0x8ce3('0x14')](_0x4ad581[_0x8ce3('0xc')])[_0x8ce3('0x15')](_0xcb3d1f);}function getUser(_0x45df32,_0x595da1,_0x3b0f27){if(!_['isNil'](_0x595da1)&&intUtil[_0x8ce3('0x16')](_0x595da1)){var _0x3b99a3={'Email':_0x595da1};var _0x45f59d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3b0f27[_0x8ce3('0x14')](_0x8ce3('0x17'))['find'](_0x3b99a3,_0x45f59d)[_0x8ce3('0x18')]()['then'](function(_0x408f53){if(_0x408f53[_0x8ce3('0x19')]){var _0x12285f=_['find'](_0x408f53,function(_0x5afae8){return _0x5afae8[_0x8ce3('0x1a')]===_0x595da1;});if(_0x12285f){logger[_0x8ce3('0x1b')](_0x8ce3('0x1c'),_0x595da1);return BPromise['resolve']({'id':_0x12285f['Id'],'name':_0x12285f[_0x8ce3('0x1d')]});}}else{logger[_0x8ce3('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x595da1);return _0x3b0f27[_0x8ce3('0x1e')]()['then'](function(_0x41b385){return BPromise[_0x8ce3('0x1f')]({'id':_0x41b385[_0x8ce3('0x20')],'name':_0x41b385[_0x8ce3('0x21')]});});}});}else{logger[_0x8ce3('0x1b')](_0x8ce3('0x22'),_0x595da1);return _0x3b0f27[_0x8ce3('0x1e')]()[_0x8ce3('0x23')](function(_0x3bea55){return BPromise[_0x8ce3('0x1f')]({'id':_0x3bea55[_0x8ce3('0x20')],'name':_0x3bea55[_0x8ce3('0x21')]});});}}function getEndUser(_0x397648,_0x1ee1c8,_0x2c6a0c,_0x171b8e,_0xd92c){var _0x1c01c1={'Phone':_0x171b8e};var _0x139e2f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8ce3('0x1f')]()[_0x8ce3('0x23')](function(){if(_0x1ee1c8[_0x8ce3('0xc')]===_0x8ce3('0x24')){logger[_0x8ce3('0x1b')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x171b8e,_0x1ee1c8[_0x8ce3('0x25')]);switch(_0x1ee1c8[_0x8ce3('0x25')]){case'contact_lead':return _0xd92c['sobject']('Contact')[_0x8ce3('0x26')](_0x1c01c1,_0x139e2f)[_0x8ce3('0x18')]()[_0x8ce3('0x23')](function(_0x544a49){if(_0x544a49&&_0x544a49[_0x8ce3('0x19')]){return _0x544a49;}else{return _0xd92c['sobject'](_0x8ce3('0x27'))[_0x8ce3('0x26')](_0x1c01c1,_0x139e2f);}});case _0x8ce3('0x28'):return _0xd92c[_0x8ce3('0x14')](_0x8ce3('0x29'))[_0x8ce3('0x26')](_0x1c01c1,_0x139e2f)[_0x8ce3('0x18')]();case _0x8ce3('0x2a'):return _0xd92c['sobject']('Lead')['find'](_0x1c01c1,_0x139e2f);default:return null;}}else if(_0x1ee1c8[_0x8ce3('0xc')]===_0x8ce3('0x13')){logger[_0x8ce3('0x1b')](_0x8ce3('0x2b'),_0x171b8e,'contact');return _0xd92c[_0x8ce3('0x14')]('Contact')['find'](_0x1c01c1,_0x139e2f)['execute']();}})['then'](function(_0x2eff61){if(_0x2eff61&&_0x2eff61['length']){var _0x4b6e61=_[_0x8ce3('0x26')](_0x2eff61,function(_0x47be15){return _0x47be15[_0x8ce3('0x2c')]===_0x171b8e;});if(_0x4b6e61){return BPromise['resolve']({'id':_0x4b6e61['Id'],'name':_0x4b6e61[_0x8ce3('0x1d')],'phone':_0x4b6e61['Phone']});}}})[_0x8ce3('0x23')](function(_0x4d881f){if(_0x4d881f){logger[_0x8ce3('0x1b')](_0x8ce3('0x2d'),_0x171b8e);return BPromise[_0x8ce3('0x1f')](_0x4d881f);}else{logger[_0x8ce3('0x1b')](_0x8ce3('0x2e'),_0x171b8e);var _0x1e6cf5={'LastName':_0x2c6a0c!==''?_0x2c6a0c:util[_0x8ce3('0x2f')](_0x8ce3('0x30'),_0x171b8e),'Phone':_0x171b8e};if(_0x1ee1c8[_0x8ce3('0x31')]){if(_0x1ee1c8[_0x8ce3('0x31')]===_0x8ce3('0x28')){logger[_0x8ce3('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x171b8e,_0x1ee1c8['moduleCreate']);}else if(_0x1ee1c8[_0x8ce3('0x31')]===_0x8ce3('0x2a')&&_0x1ee1c8['ticketType']===_0x8ce3('0x24')){logger[_0x8ce3('0x1b')](_0x8ce3('0x32'),_0x171b8e,_0x1ee1c8[_0x8ce3('0x31')]);_0x1e6cf5['Company']=_0x8ce3('0x33');}else{return null;}}return _0xd92c[_0x8ce3('0x14')](_[_0x8ce3('0x34')](_0x1ee1c8[_0x8ce3('0x31')]))[_0x8ce3('0x15')](_0x1e6cf5);}});}function getCustomFields(_0x468616,_0x2340f1){var _0x24358a={};if(_0x468616['length']>0x0){_['forEach'](_0x468616,function(_0x440445){if(_0x440445[_0x8ce3('0x35')]===_0x8ce3('0x36')&&_0x440445[_0x8ce3('0x37')]){_0x24358a[_0x440445[_0x8ce3('0x37')]]=_0x440445[_0x8ce3('0x38')][_0x8ce3('0x39')]();}else if(_0x440445['type']==='variable'&&_0x440445[_0x8ce3('0x3a')]&&_0x440445[_0x8ce3('0x37')]){_0x2340f1[_0x440445[_0x8ce3('0x3a')]]&&(_0x24358a[_0x440445['idField']]=_0x2340f1[_0x440445[_0x8ce3('0x3a')]][_0x8ce3('0x39')]());}else if(_0x440445[_0x8ce3('0x35')]===_0x8ce3('0x3b')&&_0x440445[_0x8ce3('0x3c')]&&_0x440445['Variable']['name']&&_0x440445['idField']){_0x2340f1[_0x440445[_0x8ce3('0x3c')]['name'][_0x8ce3('0x3d')]()]&&(_0x24358a[_0x440445['idField']]=_0x2340f1[_0x440445['Variable']['name'][_0x8ce3('0x3d')]()][_0x8ce3('0x39')]());}});}return _0x24358a;}function getConnection(_0x1cdc0c){var _0x3da698=_0x1cdc0c[_0x8ce3('0x3e')][_0x8ce3('0x3f')](_0x1cdc0c['securityToken']);var _0x5fb9ff=new jsforce[(_0x8ce3('0x40'))]({'oauth2':{'loginUrl':_0x1cdc0c[_0x8ce3('0x41')]||_0x8ce3('0x42'),'clientId':_0x1cdc0c['clientId'],'clientSecret':_0x1cdc0c[_0x8ce3('0x43')]}});return _0x5fb9ff[_0x8ce3('0x44')](_0x1cdc0c['username'],_0x3da698)[_0x8ce3('0x23')](function(){logger[_0x8ce3('0x1b')](_0x8ce3('0x45'));return _0x5fb9ff;});}exports[_0x8ce3('0x46')]=function(_0x524392,_0x4cb5bc,_0x26e123,_0x213f8a,_0x5e8e5c,_0x1bfc8e){var _0x83a5a7,_0x592df2,_0x3cfc0c,_0x758d69;_0x1bfc8e[_0x8ce3('0x47')]=intUtil[_0x8ce3('0x48')](_0x1bfc8e[_0x8ce3('0x47')]);_0x1bfc8e[_0x8ce3('0x41')]=intUtil[_0x8ce3('0x48')](_0x1bfc8e[_0x8ce3('0x41')]);if(_0x5e8e5c&&_0x5e8e5c['monitor_format']){logger[_0x8ce3('0x1b')](_0x8ce3('0x49'),_0x8ce3('0x4a'));_0x4cb5bc[_0x8ce3('0x4b')]=util[_0x8ce3('0x2f')](_0x8ce3('0x4c'),_0x1bfc8e[_0x8ce3('0x47')],_0x4cb5bc['uniqueid'],md5(_0x4cb5bc['uniqueid']));}else{_0x4cb5bc[_0x8ce3('0x4b')]='';}return getConnection(_0x1bfc8e)[_0x8ce3('0x23')](function(_0x8a6273){_0x758d69=_0x8a6273;return getUser(_0x1bfc8e,_0x213f8a[_0x8ce3('0x4d')],_0x758d69);})['then'](function(_0x3da062){_0x83a5a7=_0x3da062;return getEndUser(_0x1bfc8e,_0x26e123,_0x4cb5bc['calleridname'],_0x4cb5bc[_0x8ce3('0x4e')],_0x758d69);})[_0x8ce3('0x23')](function(_0x493c4f){_0x592df2=_0x493c4f;return getTicket(_0x1bfc8e,_0x83a5a7,_0x592df2,_0x26e123,_0x4cb5bc,_0x26e123[_0x8ce3('0x4f')],_0x758d69,_0x8ce3('0x46'));})[_0x8ce3('0x23')](function(_0x2841e2){_0x3cfc0c=_0x2841e2;logger[_0x8ce3('0x1b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x3cfc0c['id']);logger[_0x8ce3('0x1b')](_0x8ce3('0x50'),_0x3cfc0c['id'],_0x213f8a[_0x8ce3('0x51')],_0x1bfc8e[_0x8ce3('0x35')]);switch(_0x1bfc8e['type']){case _0x8ce3('0x52'):emit(util[_0x8ce3('0x2f')](_0x8ce3('0x53'),_0x213f8a[_0x8ce3('0x51')]),_0x8ce3('0x54'),{'recordId':_0x3cfc0c['id']});break;case _0x8ce3('0x55'):emit(util[_0x8ce3('0x2f')](_0x8ce3('0x53'),_0x213f8a['name']),_0x8ce3('0x56'),{'uri':util[_0x8ce3('0x2f')](_0x8ce3('0x57'),_0x758d69[_0x8ce3('0x58')],_0x3cfc0c['id'])});break;default:logger[_0x8ce3('0x59')](_0x8ce3('0x5a'));}})[_0x8ce3('0x5b')](function(_0x3beaba){logger[_0x8ce3('0x59')](_0x8ce3('0x49'),JSON[_0x8ce3('0x5c')](_0x3beaba));});};exports[_0x8ce3('0x5d')]=function(_0x2808b2,_0x39e71f,_0x1820c3,_0x47edd1,_0x1b133c,_0x2b8f73,_0x1fd227){var _0x2a4a8d,_0x8ec7cf,_0x2816b6,_0x276890;_0x2b8f73[_0x8ce3('0x47')]=intUtil[_0x8ce3('0x48')](_0x2b8f73[_0x8ce3('0x47')]);_0x2b8f73[_0x8ce3('0x41')]=intUtil[_0x8ce3('0x48')](_0x2b8f73[_0x8ce3('0x41')]);if(_0x1fd227&&_0x1fd227[_0x8ce3('0x5e')]&&_0x1fd227[_0x8ce3('0x5e')]!==_0x8ce3('0x5f')){logger[_0x8ce3('0x1b')](_0x8ce3('0x60'),_0x8ce3('0x4a'));_0x39e71f[_0x8ce3('0x4b')]=util[_0x8ce3('0x2f')](_0x8ce3('0x4c'),_0x2b8f73[_0x8ce3('0x47')],_0x39e71f['uniqueid'],md5(_0x39e71f[_0x8ce3('0x61')]));}return getConnection(_0x2b8f73)['then'](function(_0x1fa796){_0x276890=_0x1fa796;return getUser(_0x2b8f73,_0x47edd1[_0x8ce3('0x4d')],_0x276890);})[_0x8ce3('0x23')](function(_0xc5c03f){_0x2a4a8d=_0xc5c03f;return getEndUser(_0x2b8f73,_0x1820c3,_0x39e71f[_0x8ce3('0x62')],_0x39e71f['destcalleridnum'],_0x276890);})['then'](function(_0x2f36bb){_0x8ec7cf=_0x2f36bb;return getTicket(_0x2b8f73,_0x2a4a8d,_0x8ec7cf,_0x1820c3,_0x39e71f,_0x1820c3['Fields'],_0x276890,_0x8ce3('0x5d'));})[_0x8ce3('0x23')](function(_0x629c46){_0x2816b6=_0x629c46;logger[_0x8ce3('0x1b')](_0x8ce3('0x63'),_0x2816b6['id']);logger[_0x8ce3('0x1b')](_0x8ce3('0x64'),_0x2816b6['id'],_0x47edd1[_0x8ce3('0x51')],_0x2b8f73['type']);switch(_0x2b8f73[_0x8ce3('0x35')]){case _0x8ce3('0x52'):emit(util[_0x8ce3('0x2f')](_0x8ce3('0x53'),_0x47edd1[_0x8ce3('0x51')]),'trigger:salesforce:display',{'recordId':_0x2816b6['id']});break;case _0x8ce3('0x55'):emit(util['format']('user:%s',_0x47edd1[_0x8ce3('0x51')]),_0x8ce3('0x56'),{'uri':util['format'](_0x8ce3('0x57'),_0x276890[_0x8ce3('0x58')],_0x2816b6['id'])});break;default:logger[_0x8ce3('0x59')](_0x8ce3('0x60'),_0x8ce3('0x65'));}})[_0x8ce3('0x5b')](function(_0x44912c){logger[_0x8ce3('0x59')]('[OUTBOUND]',JSON[_0x8ce3('0x5c')](_0x44912c));});};exports[_0x8ce3('0x66')]=function(_0xbf136f,_0x35fb7f,_0x1845fb,_0x1bf0a0,_0x4591d2,_0x409ca0){var _0x5b2092,_0x16336c,_0x297a08,_0xe64b66;_0x409ca0[_0x8ce3('0x47')]=intUtil[_0x8ce3('0x48')](_0x409ca0['serverUrl']);_0x409ca0[_0x8ce3('0x41')]=intUtil['stripTrailingSlash'](_0x409ca0['remoteUri']);if(_0x4591d2&&_0x4591d2[_0x8ce3('0x67')]){logger[_0x8ce3('0x1b')]('['+_0x35fb7f[_0x8ce3('0x68')][_0x8ce3('0x69')]()+']','Recording\x20is\x20enabled!');_0x35fb7f['recordingURL']=util['format'](_0x8ce3('0x4c'),_0x409ca0[_0x8ce3('0x47')],_0x35fb7f[_0x8ce3('0x61')],md5(_0x35fb7f[_0x8ce3('0x61')]));}else{_0x35fb7f[_0x8ce3('0x4b')]='';}return getConnection(_0x409ca0)[_0x8ce3('0x23')](function(_0x384a31){_0xe64b66=_0x384a31;if(!_['isNil'](_0x1bf0a0)){return getUser(_0x409ca0,_0x1bf0a0[_0x8ce3('0x51')],_0xe64b66);}else{return getUser(_0x409ca0,null,_0xe64b66);}})['then'](function(_0x3a08a5){_0x5b2092=_0x3a08a5;return getEndUser(_0x409ca0,_0x1845fb,_0x35fb7f[_0x8ce3('0x6a')],_0x35fb7f['calleridnum'],_0xe64b66);})[_0x8ce3('0x23')](function(_0x1d16b8){_0x16336c=_0x1d16b8;return getTicket(_0x409ca0,_0x5b2092,_0x16336c,_0x1845fb,_0x35fb7f,_0x1845fb[_0x8ce3('0x4f')],_0xe64b66);})[_0x8ce3('0x23')](function(_0x5b0b33){_0x297a08=_0x5b0b33;logger['info']('['+_0x35fb7f[_0x8ce3('0x68')][_0x8ce3('0x69')]()+_0x8ce3('0x6b'),_0x297a08['id']);logger[_0x8ce3('0x1b')]('['+_0x35fb7f['lastevent'][_0x8ce3('0x69')]()+_0x8ce3('0x6c'),_0x409ca0[_0x8ce3('0x35')]);})['catch'](function(_0x317d80){logger[_0x8ce3('0x59')]('['+_0x35fb7f['lastevent'][_0x8ce3('0x69')]()+']',JSON[_0x8ce3('0x5c')](_0x317d80));});}; \ No newline at end of file +var _0x629e=['none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','request-promise','bluebird','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','assign','utc','getString','Subjects','Descriptions','Case','ContactId','sobject','create','isNil','validateEmail','User','find','execute','then','info','Agent\x20%s\x20found.','Name','identity','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Task','moduleSearch','contact_lead','Contact','length','Lead','contact','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','idField','content','toString','type','variableName','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','stringify','outbound','recordingFormat'];(function(_0xab635a,_0x3ca754){var _0x345e0f=function(_0x57fdbf){while(--_0x57fdbf){_0xab635a['push'](_0xab635a['shift']());}};_0x345e0f(++_0x3ca754);}(_0x629e,0x160));var _0xe629=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x629e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe629('0x0'));var rp=require(_0xe629('0x1'));var moment=require('moment');var BPromise=require(_0xe629('0x2'));var md5=require('md5');var jsforce=require(_0xe629('0x3'));var util=require(_0xe629('0x4'));var Redis=require('ioredis');var intUtil=require(_0xe629('0x5'));var config=require(_0xe629('0x6'));var logger=require(_0xe629('0x7'))(_0xe629('0x8'));config[_0xe629('0x9')]=_[_0xe629('0xa')](config[_0xe629('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xe629('0xb'))(new Redis(config['redis']));function emit(_0x32c7d4,_0x5d1b79,_0x3c83b2){io['to'](_0x32c7d4)[_0xe629('0xc')](_0x5d1b79,_0x3c83b2);}function getTicket(_0x4ba46d,_0x2e8a75,_0x290a5d,_0x3b90e1,_0x34282a,_0x3f44df,_0x3f7e8c,_0x1fa1fe){var _0xfc9d2={};if(_0x3b90e1[_0xe629('0xd')]==='Task'){_0xfc9d2=Object[_0xe629('0xe')]({},{'OwnerId':_0x2e8a75['id'],'ActivityDate':moment[_0xe629('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xe629('0x10')](_0x3b90e1[_0xe629('0x11')],_0x34282a,'\x20'),'Description':intUtil['getString'](_0x3b90e1[_0xe629('0x12')],_0x34282a,'\x0a')},getCustomFields(_0x3f44df,_0x34282a));if(_0x290a5d){_0xfc9d2['WhoId']=_0x290a5d['id'];}}else if(_0x3b90e1[_0xe629('0xd')]===_0xe629('0x13')){_0xfc9d2=Object['assign']({},{'OwnerId':_0x2e8a75['id'],'Subject':intUtil['getString'](_0x3b90e1['Subjects'],_0x34282a,'\x20'),'Description':intUtil[_0xe629('0x10')](_0x3b90e1[_0xe629('0x12')],_0x34282a,'\x0a')},getCustomFields(_0x3f44df,_0x34282a));if(_0x290a5d){_0xfc9d2[_0xe629('0x14')]=_0x290a5d['id'];}}return _0x3f7e8c[_0xe629('0x15')](_0x3b90e1[_0xe629('0xd')])[_0xe629('0x16')](_0xfc9d2);}function getUser(_0x1c9be1,_0x3870bd,_0x588e01){if(!_[_0xe629('0x17')](_0x3870bd)&&intUtil[_0xe629('0x18')](_0x3870bd)){var _0x1cf74e={'Email':_0x3870bd};var _0x2da0e3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x588e01['sobject'](_0xe629('0x19'))[_0xe629('0x1a')](_0x1cf74e,_0x2da0e3)[_0xe629('0x1b')]()[_0xe629('0x1c')](function(_0x19b72a){if(_0x19b72a['length']){var _0x4748b7=_['find'](_0x19b72a,function(_0x3c9538){return _0x3c9538['Email']===_0x3870bd;});if(_0x4748b7){logger[_0xe629('0x1d')](_0xe629('0x1e'),_0x3870bd);return BPromise['resolve']({'id':_0x4748b7['Id'],'name':_0x4748b7[_0xe629('0x1f')]});}}else{logger[_0xe629('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3870bd);return _0x588e01[_0xe629('0x20')]()[_0xe629('0x1c')](function(_0x13cce9){return BPromise[_0xe629('0x21')]({'id':_0x13cce9[_0xe629('0x22')],'name':_0x13cce9[_0xe629('0x23')]});});}});}else{logger[_0xe629('0x1d')](_0xe629('0x24'),_0x3870bd);return _0x588e01[_0xe629('0x20')]()[_0xe629('0x1c')](function(_0x1335ce){return BPromise[_0xe629('0x21')]({'id':_0x1335ce['user_id'],'name':_0x1335ce['display_name']});});}}function getEndUser(_0x5db6c3,_0x5436fa,_0x568ff4,_0x5305a3,_0x3e6cbe){var _0x2abf37={'Phone':_0x5305a3};var _0x504c31={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe629('0x21')]()['then'](function(){if(_0x5436fa[_0xe629('0xd')]===_0xe629('0x25')){logger[_0xe629('0x1d')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5305a3,_0x5436fa[_0xe629('0x26')]);switch(_0x5436fa[_0xe629('0x26')]){case _0xe629('0x27'):return _0x3e6cbe[_0xe629('0x15')](_0xe629('0x28'))[_0xe629('0x1a')](_0x2abf37,_0x504c31)[_0xe629('0x1b')]()[_0xe629('0x1c')](function(_0x45fb9d){if(_0x45fb9d&&_0x45fb9d[_0xe629('0x29')]){return _0x45fb9d;}else{return _0x3e6cbe[_0xe629('0x15')](_0xe629('0x2a'))[_0xe629('0x1a')](_0x2abf37,_0x504c31);}});case _0xe629('0x2b'):return _0x3e6cbe[_0xe629('0x15')](_0xe629('0x28'))[_0xe629('0x1a')](_0x2abf37,_0x504c31)[_0xe629('0x1b')]();case _0xe629('0x2c'):return _0x3e6cbe['sobject']('Lead')[_0xe629('0x1a')](_0x2abf37,_0x504c31);default:return null;}}else if(_0x5436fa[_0xe629('0xd')]===_0xe629('0x13')){logger[_0xe629('0x1d')](_0xe629('0x2d'),_0x5305a3,_0xe629('0x2b'));return _0x3e6cbe[_0xe629('0x15')](_0xe629('0x28'))['find'](_0x2abf37,_0x504c31)[_0xe629('0x1b')]();}})[_0xe629('0x1c')](function(_0x585897){if(_0x585897&&_0x585897[_0xe629('0x29')]){var _0x5261d6=_[_0xe629('0x1a')](_0x585897,function(_0x3f4574){return _0x3f4574[_0xe629('0x2e')]===_0x5305a3;});if(_0x5261d6){return BPromise[_0xe629('0x21')]({'id':_0x5261d6['Id'],'name':_0x5261d6[_0xe629('0x1f')],'phone':_0x5261d6[_0xe629('0x2e')]});}}})[_0xe629('0x1c')](function(_0x3fccd6){if(_0x3fccd6){logger[_0xe629('0x1d')](_0xe629('0x2f'),_0x5305a3);return BPromise[_0xe629('0x21')](_0x3fccd6);}else{logger[_0xe629('0x1d')](_0xe629('0x30'),_0x5305a3);var _0x3a512a={'LastName':_0x568ff4!==_0xe629('0x31')?_0x568ff4:util[_0xe629('0x32')]('Caller\x20-\x20%s',_0x5305a3),'Phone':_0x5305a3};if(_0x5436fa[_0xe629('0x33')]){if(_0x5436fa['moduleCreate']==='contact'){logger['info'](_0xe629('0x34'),_0x5305a3,_0x5436fa[_0xe629('0x33')]);}else if(_0x5436fa[_0xe629('0x33')]==='lead'&&_0x5436fa[_0xe629('0xd')]===_0xe629('0x25')){logger[_0xe629('0x1d')](_0xe629('0x34'),_0x5305a3,_0x5436fa['moduleCreate']);_0x3a512a[_0xe629('0x35')]=_0xe629('0x36');}else{return null;}}return _0x3e6cbe['sobject'](_[_0xe629('0x37')](_0x5436fa['moduleCreate']))[_0xe629('0x16')](_0x3a512a);}});}function getCustomFields(_0x492157,_0x205569){var _0x54089b={};if(_0x492157[_0xe629('0x29')]>0x0){_[_0xe629('0x38')](_0x492157,function(_0x5e0d75){if(_0x5e0d75['type']==='string'&&_0x5e0d75[_0xe629('0x39')]){_0x54089b[_0x5e0d75['idField']]=_0x5e0d75[_0xe629('0x3a')][_0xe629('0x3b')]();}else if(_0x5e0d75[_0xe629('0x3c')]==='variable'&&_0x5e0d75[_0xe629('0x3d')]&&_0x5e0d75[_0xe629('0x39')]){_0x205569[_0x5e0d75['variableName']]&&(_0x54089b[_0x5e0d75['idField']]=_0x205569[_0x5e0d75[_0xe629('0x3d')]][_0xe629('0x3b')]());}else if(_0x5e0d75['type']==='customVariable'&&_0x5e0d75[_0xe629('0x3e')]&&_0x5e0d75[_0xe629('0x3e')][_0xe629('0x3f')]&&_0x5e0d75[_0xe629('0x39')]){_0x205569[_0x5e0d75[_0xe629('0x3e')][_0xe629('0x3f')][_0xe629('0x40')]()]&&(_0x54089b[_0x5e0d75['idField']]=_0x205569[_0x5e0d75[_0xe629('0x3e')]['name']['toLowerCase']()][_0xe629('0x3b')]());}});}return _0x54089b;}function getConnection(_0x3840ce){var _0x512940=_0x3840ce[_0xe629('0x41')]['concat'](_0x3840ce[_0xe629('0x42')]);var _0x436b4c=new jsforce[(_0xe629('0x43'))]({'oauth2':{'loginUrl':_0x3840ce[_0xe629('0x44')]||'https://login.salesforce.com','clientId':_0x3840ce[_0xe629('0x45')],'clientSecret':_0x3840ce[_0xe629('0x46')]}});return _0x436b4c[_0xe629('0x47')](_0x3840ce[_0xe629('0x48')],_0x512940)['then'](function(){logger[_0xe629('0x1d')](_0xe629('0x49'));return _0x436b4c;});}exports[_0xe629('0x4a')]=function(_0xa53b21,_0x6e1836,_0xd729b9,_0xd61dd7,_0x50e9f8,_0x164e3f){var _0xf5f306,_0x5f0e27,_0x1ce04e,_0x4e0310;_0x164e3f[_0xe629('0x4b')]=intUtil[_0xe629('0x4c')](_0x164e3f[_0xe629('0x4b')]);_0x164e3f[_0xe629('0x44')]=intUtil[_0xe629('0x4c')](_0x164e3f['remoteUri']);if(_0x50e9f8&&_0x50e9f8[_0xe629('0x4d')]){logger[_0xe629('0x1d')]('[QUEUE]',_0xe629('0x4e'));_0x6e1836[_0xe629('0x4f')]=util[_0xe629('0x32')](_0xe629('0x50'),_0x164e3f[_0xe629('0x4b')],_0x6e1836[_0xe629('0x51')],md5(_0x6e1836[_0xe629('0x51')]));}else{_0x6e1836[_0xe629('0x4f')]='';}return getConnection(_0x164e3f)[_0xe629('0x1c')](function(_0xdab0d2){_0x4e0310=_0xdab0d2;return getUser(_0x164e3f,_0xd61dd7[_0xe629('0x52')],_0x4e0310);})[_0xe629('0x1c')](function(_0x816ab7){_0xf5f306=_0x816ab7;return getEndUser(_0x164e3f,_0xd729b9,_0x6e1836[_0xe629('0x53')],_0x6e1836[_0xe629('0x54')],_0x4e0310);})[_0xe629('0x1c')](function(_0x221b64){_0x5f0e27=_0x221b64;return getTicket(_0x164e3f,_0xf5f306,_0x5f0e27,_0xd729b9,_0x6e1836,_0xd729b9[_0xe629('0x55')],_0x4e0310,_0xe629('0x4a'));})[_0xe629('0x1c')](function(_0x214708){_0x1ce04e=_0x214708;logger['info'](_0xe629('0x56'),_0x1ce04e['id']);logger[_0xe629('0x1d')](_0xe629('0x57'),_0x1ce04e['id'],_0xd61dd7[_0xe629('0x3f')],_0x164e3f[_0xe629('0x3c')]);switch(_0x164e3f[_0xe629('0x3c')]){case _0xe629('0x58'):emit(util[_0xe629('0x32')](_0xe629('0x59'),_0xd61dd7[_0xe629('0x3f')]),_0xe629('0x5a'),{'recordId':_0x1ce04e['id']});break;case _0xe629('0x5b'):emit(util[_0xe629('0x32')](_0xe629('0x59'),_0xd61dd7[_0xe629('0x3f')]),'trigger:browser:url',{'uri':util[_0xe629('0x32')](_0xe629('0x5c'),_0x4e0310[_0xe629('0x5d')],_0x1ce04e['id'])});break;default:logger[_0xe629('0x5e')](_0xe629('0x5f'));}})['catch'](function(_0x16d376){logger[_0xe629('0x5e')](_0xe629('0x60'),JSON[_0xe629('0x61')](_0x16d376));});};exports[_0xe629('0x62')]=function(_0x545310,_0x36aaf4,_0x30bda6,_0x5281b3,_0x406319,_0x42ce19,_0x558f20){var _0x514936,_0x3f3a46,_0x201080,_0x174dc3;_0x42ce19[_0xe629('0x4b')]=intUtil[_0xe629('0x4c')](_0x42ce19[_0xe629('0x4b')]);_0x42ce19[_0xe629('0x44')]=intUtil[_0xe629('0x4c')](_0x42ce19['remoteUri']);if(_0x558f20&&_0x558f20[_0xe629('0x63')]&&_0x558f20['recordingFormat']!==_0xe629('0x64')){logger[_0xe629('0x1d')](_0xe629('0x65'),'Recording\x20is\x20enabled!');_0x36aaf4[_0xe629('0x4f')]=util[_0xe629('0x32')](_0xe629('0x50'),_0x42ce19[_0xe629('0x4b')],_0x36aaf4[_0xe629('0x51')],md5(_0x36aaf4[_0xe629('0x51')]));}return getConnection(_0x42ce19)['then'](function(_0x2eceb2){_0x174dc3=_0x2eceb2;return getUser(_0x42ce19,_0x5281b3[_0xe629('0x52')],_0x174dc3);})[_0xe629('0x1c')](function(_0x16551b){_0x514936=_0x16551b;return getEndUser(_0x42ce19,_0x30bda6,_0x36aaf4[_0xe629('0x66')],_0x36aaf4[_0xe629('0x67')],_0x174dc3);})[_0xe629('0x1c')](function(_0xd922db){_0x3f3a46=_0xd922db;return getTicket(_0x42ce19,_0x514936,_0x3f3a46,_0x30bda6,_0x36aaf4,_0x30bda6[_0xe629('0x55')],_0x174dc3,_0xe629('0x62'));})[_0xe629('0x1c')](function(_0x306827){_0x201080=_0x306827;logger['info'](_0xe629('0x68'),_0x201080['id']);logger[_0xe629('0x1d')](_0xe629('0x69'),_0x201080['id'],_0x5281b3['name'],_0x42ce19[_0xe629('0x3c')]);switch(_0x42ce19[_0xe629('0x3c')]){case'integrationTab':emit(util[_0xe629('0x32')](_0xe629('0x59'),_0x5281b3[_0xe629('0x3f')]),_0xe629('0x5a'),{'recordId':_0x201080['id']});break;case _0xe629('0x5b'):emit(util[_0xe629('0x32')]('user:%s',_0x5281b3[_0xe629('0x3f')]),'trigger:browser:url',{'uri':util['format'](_0xe629('0x5c'),_0x174dc3[_0xe629('0x5d')],_0x201080['id'])});break;default:logger[_0xe629('0x5e')](_0xe629('0x65'),_0xe629('0x6a'));}})['catch'](function(_0x5363ef){logger['error'](_0xe629('0x65'),JSON[_0xe629('0x61')](_0x5363ef));});};exports[_0xe629('0x6b')]=function(_0x102855,_0x55e2ba,_0x121cc2,_0x1e5b8e,_0x3db91f,_0x5accfc){var _0xb41efc,_0x245d06,_0x1ce1b4,_0x53ce46;_0x5accfc[_0xe629('0x4b')]=intUtil['stripTrailingSlash'](_0x5accfc[_0xe629('0x4b')]);_0x5accfc[_0xe629('0x44')]=intUtil[_0xe629('0x4c')](_0x5accfc[_0xe629('0x44')]);if(_0x3db91f&&_0x3db91f[_0xe629('0x4d')]){logger['info']('['+_0x55e2ba['lastevent'][_0xe629('0x6c')]()+']',_0xe629('0x4e'));_0x55e2ba[_0xe629('0x4f')]=util[_0xe629('0x32')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5accfc[_0xe629('0x4b')],_0x55e2ba[_0xe629('0x51')],md5(_0x55e2ba[_0xe629('0x51')]));}else{_0x55e2ba[_0xe629('0x4f')]='';}return getConnection(_0x5accfc)[_0xe629('0x1c')](function(_0x66bc6){_0x53ce46=_0x66bc6;if(!_[_0xe629('0x17')](_0x1e5b8e)){return getUser(_0x5accfc,_0x1e5b8e['name'],_0x53ce46);}else{return getUser(_0x5accfc,null,_0x53ce46);}})[_0xe629('0x1c')](function(_0x2dc58e){_0xb41efc=_0x2dc58e;return getEndUser(_0x5accfc,_0x121cc2,_0x55e2ba[_0xe629('0x53')],_0x55e2ba[_0xe629('0x54')],_0x53ce46);})[_0xe629('0x1c')](function(_0x43ada7){_0x245d06=_0x43ada7;return getTicket(_0x5accfc,_0xb41efc,_0x245d06,_0x121cc2,_0x55e2ba,_0x121cc2[_0xe629('0x55')],_0x53ce46);})[_0xe629('0x1c')](function(_0x46f9b2){_0x1ce1b4=_0x46f9b2;logger['info']('['+_0x55e2ba[_0xe629('0x6d')]['toUpperCase']()+_0xe629('0x6e'),_0x1ce1b4['id']);logger[_0xe629('0x1d')]('['+_0x55e2ba[_0xe629('0x6d')][_0xe629('0x6c')]()+_0xe629('0x6f'),_0x5accfc[_0xe629('0x3c')]);})[_0xe629('0x70')](function(_0x3076bf){logger[_0xe629('0x5e')]('['+_0x55e2ba[_0xe629('0x6d')]['toUpperCase']()+']',JSON[_0xe629('0x61')](_0x3076bf));});}; \ 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 8797565..5836329 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 _0xadb5=['endUserNumber','user','System','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','forEach','push','length','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','userEmail','GET','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xadb5,0xad));var _0x5adb=function(_0x5314d6,_0x1718ec){_0x5314d6=_0x5314d6-0x0;var _0x1528d3=_0xadb5[_0x5314d6];return _0x1528d3;};'use strict';var _=require('lodash');var Promise=require(_0x5adb('0x0'));var rp=require('request-promise');var util=require(_0x5adb('0x1'));var md5=require(_0x5adb('0x2'));var Redis=require(_0x5adb('0x3'));var intUtil=require('./util');var config=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var io=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));function getAdminUser(_0x353885,_0x47228a,_0x6d1b45,_0x41261c,_0x7293ab,_0x34f59d){return new Promise(function(_0x336bad,_0x129f5a){var _0x275428={'method':'GET','uri':_0x41261c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x7293ab+'&'+_0x34f59d,'auth':_0x47228a,'json':!![]};return rp(_0x275428)[_0x5adb('0xb')](function(_0x1ea238){if(_0x1ea238[_0x5adb('0xc')]['length']>0x0){_0x6d1b45[_0x5adb('0xd')]=_0x1ea238['result'][0x0][_0x5adb('0xe')];}logger['info']('['+[_0x353885[_0x5adb('0xf')]()]+_0x5adb('0x10'),_0x6d1b45);_0x336bad(_0x6d1b45);})[_0x5adb('0x11')](function(_0x5c929a){logger[_0x5adb('0x12')]('['+[_0x353885[_0x5adb('0xf')]()]+']',_0x5c929a[_0x5adb('0x13')]);_0x129f5a(_0x5c929a['message']);});});}function getUser(_0x2312de,_0x518823,_0x367d82,_0x42a482,_0x30614e){return function(_0x304784){logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+_0x5adb('0x15'),_0x304784);return new Promise(function(_0x42f4c6,_0xb953a6){if(intUtil['validateEmail'](_0x304784[_0x5adb('0x16')])){var _0x5de028={'method':_0x5adb('0x17'),'uri':_0x367d82+'sys_user?sysparm_query=email%3D'+_0x304784[_0x5adb('0x16')]+'&'+_0x42a482+'&'+_0x30614e,'auth':_0x518823,'json':!![]};logger['info']('['+[_0x2312de['toUpperCase']()]+_0x5adb('0x18'),_0x5de028);return rp(_0x5de028)[_0x5adb('0xb')](function(_0x438671){logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+'],\x20getUser\x20entity',_0x438671);if(_0x438671[_0x5adb('0xc')]['length']>0x0&&String(_0x438671['result'][0x0][_0x5adb('0x19')])===_0x5adb('0x1a')){_0x304784[_0x5adb('0x1b')]=_0x438671[_0x5adb('0xc')][0x0][_0x5adb('0xe')];}else{_0x304784[_0x5adb('0x1b')]=_0x304784[_0x5adb('0xd')];_0x304784['userEmail']=_0x304784[_0x5adb('0x1c')];}logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+_0x5adb('0x1d'),_0x304784);_0x42f4c6(_0x304784);})[_0x5adb('0x11')](function(_0x49f203){logger[_0x5adb('0x12')]('['+[_0x2312de[_0x5adb('0xf')]()]+']',_0x49f203['message']);_0xb953a6(_0x49f203[_0x5adb('0x13')]);});}else{logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+']\x20using\x20admin\x20profile');_0x304784[_0x5adb('0x1b')]=_0x304784[_0x5adb('0xd')];_0x304784[_0x5adb('0x16')]=_0x304784[_0x5adb('0x1c')];_0x42f4c6(_0x304784);}});};}function createEndUser(_0x36459b,_0x1c06c4,_0x4a5d46,_0x49992e,_0x5d457e){logger[_0x5adb('0x14')]('['+[_0x36459b[_0x5adb('0xf')]()]+_0x5adb('0x1e'),_0x4a5d46);return new Promise(function(_0x512bab,_0x137a5c){var _0x4de310={'method':_0x5adb('0x1f'),'uri':_0x49992e+_0x5adb('0x20')+_0x5d457e,'body':{'user_name':_0x4a5d46[_0x5adb('0x21')],'roles':_0x5adb('0x22'),'first_name':_0x4a5d46[_0x5adb('0x21')],'active':_0x5adb('0x1a'),'date_format':_0x5adb('0x23'),'phone':_0x4a5d46[_0x5adb('0x21')]},'auth':_0x1c06c4,'json':!![]};return rp(_0x4de310)[_0x5adb('0xb')](function(_0x260295){logger['info']('['+[_0x36459b[_0x5adb('0xf')]()]+'],\x20EndUser\x20schema',_0x260295[_0x5adb('0xc')]);_0x4a5d46[_0x5adb('0x24')]=_0x260295['result'][_0x5adb('0xe')];_0x512bab(_0x4a5d46);})[_0x5adb('0x11')](function(_0x461a39){logger['error']('['+[_0x36459b[_0x5adb('0xf')]()]+']',_0x461a39[_0x5adb('0x13')]);_0x137a5c(_0x461a39['message']);});});}function getEndUser(_0x5bb227,_0x1ed9ea,_0x49dd03,_0x663ea0,_0x222568){return function(_0x3c2b07){logger[_0x5adb('0x14')]('['+[_0x5bb227[_0x5adb('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x3c2b07);return new Promise(function(_0x2f7abe,_0x215b88){var _0x1c3a5c={'method':'GET','uri':_0x49dd03+'sys_user?sysparm_query=phone%3D'+_0x3c2b07[_0x5adb('0x21')]+'&'+_0x663ea0+'&'+_0x222568,'auth':_0x1ed9ea,'json':!![]};return rp(_0x1c3a5c)[_0x5adb('0xb')](function(_0x586820){if(_0x586820[_0x5adb('0xc')]['length']>0x0){_0x3c2b07[_0x5adb('0x24')]=_0x586820['result'][0x0][_0x5adb('0xe')];logger['info']('['+[_0x5bb227[_0x5adb('0xf')]()]+_0x5adb('0x25'),_0x3c2b07);_0x2f7abe(_0x3c2b07);}else{return createEndUser(_0x5bb227,_0x1ed9ea,_0x3c2b07,_0x49dd03,_0x663ea0)['then'](function(_0x4761e3){logger['info']('['+[_0x5bb227[_0x5adb('0xf')]()]+_0x5adb('0x26'),_0x4761e3);_0x2f7abe(_0x4761e3);});}})[_0x5adb('0x11')](function(_0x50edd1){logger[_0x5adb('0x12')]('['+[_0x5bb227[_0x5adb('0xf')]()]+']',_0x50edd1[_0x5adb('0x13')]);_0x215b88(_0x50edd1[_0x5adb('0x13')]);});});};}function getCustomFields(_0x22aa95,_0x52d74f){var _0x50fe99={};if(_0x22aa95['length']>0x0){_['forEach'](_0x22aa95,function(_0x427c71){if(_0x427c71[_0x5adb('0x27')]===_0x5adb('0x28')&&_0x427c71[_0x5adb('0x29')]&&!_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x427c71[_0x5adb('0x2d')]['toString']();}else if(_0x427c71['type']===_0x5adb('0x28')&&_0x427c71['idField']&&_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x427c71[_0x5adb('0x2d')][_0x5adb('0x2e')]();}else if(_0x427c71['type']===_0x5adb('0x2f')&&_0x427c71[_0x5adb('0x30')]&&_0x427c71['idField']&&_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')]['toLowerCase']()]=_0x52d74f[_0x427c71[_0x5adb('0x30')]][_0x5adb('0x2e')]();}else if(_0x427c71[_0x5adb('0x27')]===_0x5adb('0x31')&&_0x427c71[_0x5adb('0x32')]&&_0x427c71[_0x5adb('0x32')][_0x5adb('0x33')]&&_0x427c71['idField']&&_0x427c71['customField']){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x52d74f[_0x427c71[_0x5adb('0x32')][_0x5adb('0x33')]['toLowerCase']()]['toString']();}});}return _0x50fe99;}function getTicket(_0xaa32e4,_0x4d7d86,_0x264dfd,_0x72218,_0x1713bc,_0x5358c0){return function(_0x182cbc){logger[_0x5adb('0x14')]('['+[_0xaa32e4['toUpperCase']()]+_0x5adb('0x34'),_0x182cbc);return new Promise(function(_0x251f45,_0x1cdb03){var _0x24758f=_0xaa32e4[_0x5adb('0x2c')]()===_0x5adb('0x35')?_0x182cbc[_0x5adb('0x1b')]:_0x182cbc[_0x5adb('0x24')];var _0x49e1a1={'method':_0x5adb('0x1f'),'uri':_0x264dfd+'incident'+'?'+_0x5358c0,'body':Object['assign']({},{'active':'true','caller_id':_0x24758f,'assigned_to':_0x182cbc[_0x5adb('0x1b')],'short_description':intUtil[_0x5adb('0x36')](_0x72218[_0x5adb('0x37')],_0x1713bc,'\x20'),'description':intUtil['getString'](_0x72218[_0x5adb('0x38')],_0x1713bc,'\x0a')},getCustomFields(_0x72218['Fields'],_0x1713bc)),'auth':_0x4d7d86,'json':!![]};return rp(_0x49e1a1)[_0x5adb('0xb')](function(_0x2c3f21){logger[_0x5adb('0x14')]('['+[_0xaa32e4['toUpperCase']()]+_0x5adb('0x39'),_0x2c3f21['result']);_0x182cbc[_0x5adb('0x3a')]=_0x2c3f21[_0x5adb('0xc')]['sys_id'];_0x182cbc[_0x5adb('0x3b')]=_0x2c3f21[_0x5adb('0xc')][_0x5adb('0x3c')];logger[_0x5adb('0x14')]('['+[_0xaa32e4[_0x5adb('0xf')]()]+']\x20getTicket\x20crm',_0x182cbc);_0x251f45(_0x182cbc);})[_0x5adb('0x11')](function(_0x3a5703){logger[_0x5adb('0x12')]('['+[_0xaa32e4[_0x5adb('0xf')]()]+']',_0x3a5703['message']);_0x1cdb03(_0x3a5703[_0x5adb('0x13')]);});});};}function createRemoteTag(_0x14a46f,_0x3b4794,_0x4d98d0,_0x2b34a8){return new Promise(function(_0xd0e5b7,_0x444a6c){var _0xfd3471={'method':'POST','uri':_0x4d98d0+_0x5adb('0x3d')+'?'+_0x2b34a8,'body':{'short_description':_0x14a46f,'global':!![],'active':!![],'name':_0x14a46f},'auth':_0x3b4794,'json':!![]};return rp(_0xfd3471)[_0x5adb('0xb')](function(_0x28b291){var _0x2cee37=_0x28b291[_0x5adb('0xc')]['sys_id'];_0xd0e5b7(_0x2cee37);});});}function getRemoteTag(_0x378938,_0x4b8d28,_0x2b790d,_0x4f7227,_0x31ae72){return new Promise(function(_0x35df22,_0x1a9358){var _0x42f6d9={'method':'GET','uri':_0x2b790d+_0x5adb('0x3d')+_0x5adb('0x3e')+_0x378938+'&'+_0x4f7227,'auth':_0x4b8d28,'json':!![]};return rp(_0x42f6d9)[_0x5adb('0xb')](function(_0x53d262){if(_0x53d262['result']['length']>0x0){var _0x18ee9a=_0x53d262[_0x5adb('0xc')][0x0][_0x5adb('0xe')];_0x35df22(_0x18ee9a);}else{return createRemoteTag(_0x378938,_0x4b8d28,_0x2b790d,_0x4f7227)[_0x5adb('0xb')](function(_0xa833f4){_0x35df22(_0xa833f4);});}});});}function assignTagToIncident(_0xb06bee,_0x204b9b,_0x8d7810,_0xc880af,_0x380d76){return new Promise(function(_0x452767,_0x1df439){var _0x2c2357={'method':'POST','uri':_0x8d7810+'label_entry'+'?'+_0x380d76,'body':{'label':_0xb06bee,'table':_0x5adb('0x3f'),'id_type':_0x5adb('0x40'),'table_key':_0xc880af[_0x5adb('0x3a')],'title':_0x5adb('0x41')+_0xc880af['ticketNumber'],'id_display':_0xc880af[_0x5adb('0x3b')]},'auth':_0x204b9b,'json':!![]};return rp(_0x2c2357)[_0x5adb('0xb')](function(_0x5d2d2f){_0x452767();})[_0x5adb('0x11')](function(){_0x452767();});});}function manageTags(_0x476e62,_0x1505f7,_0x5edd60,_0x30d185,_0x409357,_0x19df2f,_0x30c92c){return new Promise(function(_0x330290,_0x428019){var _0x513f26=[];_0x1505f7[_0x5adb('0x42')](function(_0x1f042f){_0x513f26[_0x5adb('0x43')](getRemoteTag(_0x1f042f,_0x5edd60,_0x30d185,_0x19df2f,_0x30c92c));});return Promise['all'](_0x513f26)[_0x5adb('0xb')](function(_0x239862){if(_0x239862[_0x5adb('0x44')]){logger['info']('['+[_0x476e62[_0x5adb('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x239862);var _0xa8ff64=[];_0x239862[_0x5adb('0x42')](function(_0x24e1ab){_0xa8ff64['push'](assignTagToIncident(_0x24e1ab,_0x5edd60,_0x30d185,_0x409357,_0x19df2f));});return Promise[_0x5adb('0x45')](_0xa8ff64)[_0x5adb('0xb')](function(){_0x330290();})['catch'](function(){_0x330290();});}else{_0x330290();}});});}function getTags(_0x12711e,_0x432a3e,_0x248739,_0x3fcad5,_0x55cd0a,_0x4290bb){return function(_0x2b8298){return new Promise(function(_0x307f07,_0x16716e){var _0x5b7556=[];var _0x53a4bc=_0x3fcad5[_0x5adb('0x46')];if(_0x53a4bc&&_0x53a4bc['length']>0x0){_0x5b7556=_['map'](_0x53a4bc,'name');}if(_0x5b7556[_0x5adb('0x44')]>0x0){return manageTags(_0x12711e,_0x5b7556,_0x432a3e,_0x248739,_0x2b8298,_0x55cd0a,_0x4290bb)[_0x5adb('0xb')](function(){_0x307f07(_0x2b8298);});}else{_0x307f07(_0x2b8298);}});};}function emit(_0x48bb5c,_0x395350,_0x91e023){var _0xcdde17=_0x5adb('0x47')+_0x5adb('0x48')+_0x5adb('0x49')+_0x5adb('0x4a');var _0x1ffcd3={'uri':_0x48bb5c+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x91e023+_0xcdde17};io['to'](util['format']('user:%s',_0x395350))[_0x5adb('0x4b')](_0x5adb('0x4c'),_0x1ffcd3);}exports['cs']=function(_0x3a0d1b,_0x2a55a3,_0x1f59bb,_0x2f6ef7,_0x386c76,_0x25f761,_0x58455b,_0x5e55c2){var _0x1fc73b={};var _0x56df90={'user':_0x25f761[_0x5adb('0x4d')],'pass':_0x25f761[_0x5adb('0x4e')]};var _0x2146f0=_0x5adb('0x4f');var _0x40140f=_0x5adb('0x50');_0x25f761[_0x5adb('0x51')]=intUtil[_0x5adb('0x52')](_0x25f761['remoteUri']);_0x25f761[_0x5adb('0x53')]=intUtil[_0x5adb('0x52')](_0x25f761[_0x5adb('0x53')]);var _0x5d3aa4=util[_0x5adb('0x54')](_0x5adb('0x55'),_0x25f761['remoteUri']);_0x1fc73b[_0x5adb('0x16')]=!_['isNil'](_0x2f6ef7)?_0x2f6ef7[_0x5adb('0x56')]:null;_0x1fc73b[_0x5adb('0x1c')]=_0x25f761['email'];_0x1fc73b[_0x5adb('0x21')]=_0x5e55c2[_0x5adb('0x2c')]()===_0x5adb('0x35')?_0x2a55a3[_0x5adb('0x57')]:_0x2a55a3[_0x5adb('0x58')];_0x1fc73b[_0x5adb('0x59')]=_0x5e55c2===_0x5adb('0x5a')||_0x5e55c2===_0x5adb('0x5b')?'queue':_0x5adb('0x35');var _0x31345d=util[_0x5adb('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25f761['serverUrl'],_0x2a55a3[_0x5adb('0x5c')],md5(_0x2a55a3['uniqueid']));if(_0x386c76&&_0x386c76[_0x5adb('0x5d')]){logger[_0x5adb('0x14')](_0x5adb('0x5e'),'Recording\x20is\x20enabled!');_0x2a55a3[_0x5adb('0x5f')]=_0x31345d;}else if(_0x58455b&&_0x58455b[_0x5adb('0x60')]&&_0x58455b[_0x5adb('0x60')]!==_0x5adb('0x61')){logger[_0x5adb('0x14')]('[OUTBOUND]',_0x5adb('0x62'));_0x2a55a3[_0x5adb('0x5f')]=_0x31345d;}else{_0x2a55a3[_0x5adb('0x5f')]='';}return getAdminUser(_0x5e55c2,_0x56df90,_0x1fc73b,_0x5d3aa4,_0x40140f,_0x2146f0)[_0x5adb('0xb')](getUser(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x40140f,_0x2146f0))['then'](getEndUser(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x40140f,_0x2146f0))[_0x5adb('0xb')](getTicket(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x1f59bb,_0x2a55a3,_0x40140f))[_0x5adb('0xb')](function(_0x182873){logger[_0x5adb('0x14')](util[_0x5adb('0x54')](_0x5adb('0x63'),_0x182873[_0x5adb('0x3a')]));logger['info'](util[_0x5adb('0x54')](_0x5adb('0x64'),_0x5e55c2));if(_0x5e55c2!=='unmanaged'){logger[_0x5adb('0x14')]('['+[_0x5e55c2[_0x5adb('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x25f761[_0x5adb('0x51')],_0x2f6ef7['name'],_0x182873[_0x5adb('0x3a')]);}})[_0x5adb('0x11')](function(_0x4a2ebc){logger[_0x5adb('0x12')]('['+[_0x5e55c2['toUpperCase']()]+_0x5adb('0x65'),util[_0x5adb('0x66')](_0x4a2ebc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x14eb03,_0x8d5034){var _0x21ce5d=function(_0x34beaa){while(--_0x34beaa){_0x14eb03['push'](_0x14eb03['shift']());}};_0x21ce5d(++_0x8d5034);}(_0x5fc3,0xa8));var _0x35fc=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0x5fc3[_0x47c5bf];return _0x11b779;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'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 aced4a9..02881cd 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 _0xa7ee=['Ticket\x20created!','charAt','[OUTBOUND]','toUpperCase','contacts','lastevent','lodash','bluebird','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','POST','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','duration_hours','parent_type','Contacts','parent_name','length','variableName','JSON','Calls','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','stringify','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','map','forEach','string','customField','nameField','content','idField','push','type','custom_fields','customVariable','Variable','toLowerCase','username','password','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','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','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Outbound'];(function(_0xbe3382,_0x5d6862){var _0xc809a4=function(_0x403573){while(--_0x403573){_0xbe3382['push'](_0xbe3382['shift']());}};_0xc809a4(++_0x5d6862);}(_0xa7ee,0x159));var _0xea7e=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0xa7ee[_0x118139];return _0x2fece9;};'use strict';var _=require(_0xea7e('0x0'));var rp=require('request-promise');var BPromise=require(_0xea7e('0x1'));var md5=require(_0xea7e('0x2'));var util=require(_0xea7e('0x3'));var Redis=require(_0xea7e('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xea7e('0x5'))('sugarcrm');config[_0xea7e('0x6')]=_[_0xea7e('0x7')](config[_0xea7e('0x6')],{'host':_0xea7e('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xea7e('0x6')]));var def={'method':_0xea7e('0x9'),'json':!![]};function emit(_0x303dab,_0x38d996,_0x8541da){io['to'](_0x303dab)['emit'](_0x38d996,_0x8541da);}function getTicket(_0x5b94d7,_0x30cf8c,_0x4b661f,_0xb52b7e,_0x141f18,_0x158eb7,_0x24a39b,_0x4da86b){logger[_0xea7e('0xa')]('Creating\x20new\x20ticket...');var _0x335f29=new Date();var _0x31b671=[{'name':_0xea7e('0xb'),'value':intUtil[_0xea7e('0xc')](_0xb52b7e[_0xea7e('0xd')],_0x141f18,'\x20')},{'name':_0xea7e('0xe'),'value':_0x30cf8c['id']},{'name':_0xea7e('0xf'),'value':_0x30cf8c['id']},{'name':_0xea7e('0x10'),'value':intUtil['getString'](_0xb52b7e[_0xea7e('0x11')],_0x141f18,'\x0a')},{'name':_0xea7e('0x12'),'value':_0x335f29[_0xea7e('0x13')]()[_0xea7e('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0xea7e('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x4b661f['id']},{'name':_0xea7e('0x16'),'value':_0xea7e('0x17')},{'name':_0xea7e('0x18'),'value':_0x4b661f['name']},{'name':'direction','value':_0x4da86b}];if(_0x158eb7[_0xea7e('0x19')]){_['forEach'](_0x158eb7,function(_0x195d5a){if(_0x141f18[_0x195d5a[_0xea7e('0x1a')]]){_0x31b671['push']({'name':_0x195d5a['idField'],'value':_0x141f18[_0x195d5a[_0xea7e('0x1a')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xea7e('0x1b'),'rest_data':JSON['stringify']({'session':_0x24a39b['id'],'module_name':_0xea7e('0x1c'),'name_value_list':_0x31b671})}});}function getAuth(_0x1def2a){return util['format'](_0xea7e('0x1d'),new Buffer(_0x1def2a['apiKey']+':X')[_0xea7e('0x1e')](_0xea7e('0x1f')));}function getServerInfo(_0xf779ad){return request({'form':{'method':_0xea7e('0x20'),'input_type':_0xea7e('0x1b'),'response_type':_0xea7e('0x1b'),'rest_data':JSON['stringify']({'session':_0xf779ad['id']})}});}function getUser(_0xd41599,_0x1ddcc7,_0x4e8b96){if(!_[_0xea7e('0x21')](_0x1ddcc7)){logger[_0xea7e('0xa')](_0xea7e('0x22'),_0x1ddcc7);return request({'form':{'method':'get_entry_list','input_type':_0xea7e('0x1b'),'response_type':_0xea7e('0x1b'),'rest_data':JSON[_0xea7e('0x23')]({'session':_0x4e8b96['id'],'module_name':'Employees','query':util[_0xea7e('0x24')](_0xea7e('0x25'),_0x1ddcc7),'order_by':'','offset':'0','select_fields':['id',_0xea7e('0xb'),_0xea7e('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xea7e('0x27')](function(_0x789f9e){if(_0x789f9e[_0xea7e('0x28')][_0xea7e('0x19')]){var _0x1067cd=_[_0xea7e('0x29')](_0x789f9e['entry_list'],function(_0x1744f3){return _0x1744f3[_0xea7e('0x2a')]['user_name'][_0xea7e('0x2b')]===_0x1ddcc7;});if(_0x1067cd){logger[_0xea7e('0xa')](_0xea7e('0x2c'));return BPromise[_0xea7e('0x2d')]({'id':_0x1067cd[_0xea7e('0x2a')]['id']['value'],'name':_0x1067cd[_0xea7e('0x2a')][_0xea7e('0xb')]['value']});}}logger[_0xea7e('0xa')](_0xea7e('0x2e'));return BPromise['resolve']({'id':_0x4e8b96[_0xea7e('0x2a')]['user_id'][_0xea7e('0x2b')],'name':_0x4e8b96[_0xea7e('0x2a')][_0xea7e('0x26')][_0xea7e('0x2b')]});});}else{logger[_0xea7e('0xa')](_0xea7e('0x2f'));return BPromise['resolve']({'id':_0x4e8b96[_0xea7e('0x2a')][_0xea7e('0x30')][_0xea7e('0x2b')],'name':_0x4e8b96[_0xea7e('0x2a')][_0xea7e('0x26')][_0xea7e('0x2b')]});}}function getEndUser(_0x55b63e,_0x519022,_0xb53ef9,_0x2b3744){logger[_0xea7e('0xa')]('Searching\x20enduser\x20with\x20phone',_0xb53ef9);return request({'form':{'method':_0xea7e('0x31'),'input_type':_0xea7e('0x1b'),'response_type':_0xea7e('0x1b'),'rest_data':JSON[_0xea7e('0x23')]({'session':_0x2b3744['id'],'module_name':_0xea7e('0x17'),'query':util[_0xea7e('0x24')](_0xea7e('0x32'),_0xb53ef9),'order_by':'','offset':'0','select_fields':['id',_0xea7e('0xb'),_0xea7e('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xea7e('0x27')](function(_0x334324){if(_0x334324[_0xea7e('0x28')][_0xea7e('0x19')]){var _0x2decb9=_[_0xea7e('0x29')](_0x334324['entry_list'],function(_0x3b4b4e){return _0x3b4b4e[_0xea7e('0x2a')][_0xea7e('0x33')][_0xea7e('0x2b')]===_0xb53ef9;});if(_0x2decb9){logger['info'](_0xea7e('0x34'));return BPromise['resolve']({'id':_0x2decb9[_0xea7e('0x2a')]['id']['value'],'name':_0x2decb9[_0xea7e('0x2a')][_0xea7e('0xb')][_0xea7e('0x2b')],'phone':_0x2decb9[_0xea7e('0x2a')][_0xea7e('0x33')][_0xea7e('0x2b')]});}}else{logger['info'](_0xea7e('0x35'));return request({'form':{'method':_0xea7e('0x36'),'input_type':'JSON','response_type':_0xea7e('0x1b'),'rest_data':JSON['stringify']({'session':_0x2b3744['id'],'module_name':_0xea7e('0x17'),'name_value_list':[{'name':_0xea7e('0x37'),'value':_0x519022!==''?_0x519022:util[_0xea7e('0x24')](_0xea7e('0x38'),_0xb53ef9)},{'name':_0xea7e('0x33'),'value':_0xb53ef9}]})}})[_0xea7e('0x27')](function(_0x157ec3){logger[_0xea7e('0xa')](_0xea7e('0x39'));return BPromise[_0xea7e('0x2d')]({'id':_0x157ec3['id'],'name':_0x157ec3[_0xea7e('0x28')][_0xea7e('0x37')][_0xea7e('0x2b')],'phone':_0x157ec3[_0xea7e('0x28')][_0xea7e('0x33')][_0xea7e('0x2b')]});});}});}function request(_0x507d92){logger['debug']('[HTTP]',JSON['stringify'](_0x507d92));return rp(_['merge'](def,_0x507d92));}function getTags(_0x5f0fbf,_0x2a6131){var _0x5c3a0c=[];if(_0x5f0fbf&&_0x5f0fbf[_0xea7e('0x19')]>0x0){_0x5c3a0c=_[_0xea7e('0x3a')](_0x5f0fbf,_0x2a6131);}return _0x5c3a0c;}function getCustomFields(_0x4e499e,_0x5c9e86){var _0x1ac12d=[];var _0x121ce6={'custom_fields':[]};if(_0x4e499e[_0xea7e('0x19')]>0x0){_[_0xea7e('0x3b')](_0x4e499e,function(_0x521744){if(_0x521744['type']===_0xea7e('0x3c')&&_0x521744['nameField']&&!_0x521744[_0xea7e('0x3d')]){_0x121ce6[_0x521744[_0xea7e('0x3e')]['toLowerCase']()]=_0x521744[_0xea7e('0x3f')][_0xea7e('0x1e')]();}else if(_0x521744['type']===_0xea7e('0x3c')&&_0x521744[_0xea7e('0x40')]&&_0x521744['customField']){_0x121ce6['custom_fields'][_0xea7e('0x41')]({'id':_0x521744[_0xea7e('0x40')],'value':_0x521744['content'][_0xea7e('0x1e')]()});}else if(_0x521744[_0xea7e('0x42')]==='variable'&&_0x521744[_0xea7e('0x1a')]&&_0x521744[_0xea7e('0x40')]&&_0x521744[_0xea7e('0x3d')]){_0x5c9e86[_0x521744[_0xea7e('0x1a')]]&&_0x121ce6[_0xea7e('0x43')][_0xea7e('0x41')]({'id':_0x521744[_0xea7e('0x40')],'value':_0x5c9e86[_0x521744['variableName']][_0xea7e('0x1e')]()});}else if(_0x521744[_0xea7e('0x42')]===_0xea7e('0x44')&&_0x521744[_0xea7e('0x45')]&&_0x521744[_0xea7e('0x45')][_0xea7e('0xb')]&&_0x521744['idField']&&_0x521744[_0xea7e('0x3d')]){_0x5c9e86[_0x521744[_0xea7e('0x45')][_0xea7e('0xb')][_0xea7e('0x46')]()]&&_0x121ce6[_0xea7e('0x43')][_0xea7e('0x41')]({'id':_0x521744['idField'],'value':_0x5c9e86[_0x521744[_0xea7e('0x45')][_0xea7e('0xb')][_0xea7e('0x46')]()]['toString']()});}});}return _0x121ce6;}function getConnection(_0x3d0243){return request({'method':_0xea7e('0x9'),'form':{'method':'login','input_type':_0xea7e('0x1b'),'response_type':_0xea7e('0x1b'),'rest_data':JSON[_0xea7e('0x23')]({'user_auth':{'user_name':_0x3d0243[_0xea7e('0x47')],'password':_0x3d0243[_0xea7e('0x48')],'encryption':_0xea7e('0x49')},'application':_0xea7e('0x4a')})}})[_0xea7e('0x27')](function(_0x3a2912){var _0x4c2c73=_0x3a2912;if(_0x4c2c73['id']){def['sessionID']=_0x4c2c73['id'];return BPromise[_0xea7e('0x2d')](_0x4c2c73);}else{throw new Error(util[_0xea7e('0x24')]('Account\x20%d\x20is\x20not\x20valid',_0x3d0243['id']));}});}function setRelationship(_0x338cbb,_0x5b0bcb,_0x10b3ba,_0x40f092){return request({'form':{'method':_0xea7e('0x4b'),'input_type':'JSON','response_type':_0xea7e('0x1b'),'rest_data':JSON[_0xea7e('0x23')]({'session':_0x338cbb['id'],'module_name':_0xea7e('0x1c'),'module_id':_0x10b3ba['id'],'link_field_name':_0x40f092,'related_ids':[_0x5b0bcb['id']]})}});}exports[_0xea7e('0x4c')]=function(_0x9aa251,_0x4fa681,_0x47de8f,_0xf8e601,_0x349705,_0xeae827){var _0x1da457,_0x57ee06,_0x2fde0c,_0x28529b;_0xeae827[_0xea7e('0x4d')]=intUtil[_0xea7e('0x4e')](_0xeae827[_0xea7e('0x4d')]);_0xeae827['serverUrl']=intUtil['stripTrailingSlash'](_0xeae827[_0xea7e('0x4f')]);def[_0xea7e('0x50')]=util['format'](_0xea7e('0x51'),_0xeae827[_0xea7e('0x4d')]);if(_0x349705&&_0x349705[_0xea7e('0x52')]){logger[_0xea7e('0xa')](_0xea7e('0x53'),'Recording\x20is\x20enabled!');_0x4fa681['recordingURL']=util[_0xea7e('0x24')](_0xea7e('0x54'),_0xeae827[_0xea7e('0x4f')],_0x4fa681[_0xea7e('0x55')],md5(_0x4fa681[_0xea7e('0x55')]));}else{_0x4fa681[_0xea7e('0x56')]='';}return getConnection(_0xeae827)[_0xea7e('0x27')](function(_0x4eb217){_0x28529b=_0x4eb217;return getUser(_0xeae827,_0xf8e601['name'],_0x28529b);})['then'](function(_0xf79204){_0x1da457=_0xf79204;logger[_0xea7e('0xa')]('The\x20User\x20ID\x20is:',_0x1da457['id']);return getEndUser(_0xeae827,_0x4fa681[_0xea7e('0x57')],_0x4fa681[_0xea7e('0x58')],_0x28529b);})['then'](function(_0x3a8514){_0x57ee06=_0x3a8514;logger[_0xea7e('0xa')]('The\x20Enduser\x20ID\x20is:',_0x57ee06['id']);return getTicket(_0xeae827,_0x1da457,_0x57ee06,_0x47de8f,_0x4fa681,_0x47de8f[_0xea7e('0x59')],_0x28529b,_0xea7e('0x5a'));})[_0xea7e('0x27')](function(_0x2a31d5){_0x2fde0c=_0x2a31d5;logger[_0xea7e('0xa')]('Ticket\x20created!');logger['info'](_0xea7e('0x5b'),_0x2fde0c['id']);return setRelationship(_0x28529b,_0x1da457,_0x2fde0c,_0xea7e('0x5c'));})[_0xea7e('0x27')](function(){return setRelationship(_0x28529b,_0x57ee06,_0x2fde0c,'contacts');})[_0xea7e('0x27')](function(){return getServerInfo(_0x28529b);})[_0xea7e('0x27')](function(_0x69c46){var _0x1645ba=parseInt(_0x69c46[_0xea7e('0x5d')]['charAt'](0x0));var _0x5398fa=util[_0xea7e('0x24')](_0xea7e('0x5e'),_0xeae827['remoteUri'],_0x2fde0c['id']);if(_0x1645ba>0x6){_0x5398fa=util[_0xea7e('0x24')](_0xea7e('0x5f'),_0xeae827['remoteUri'],_0x2fde0c['id']);}logger[_0xea7e('0xa')](_0xea7e('0x53'),_0xea7e('0x60'));emit(util[_0xea7e('0x24')](_0xea7e('0x61'),_0xf8e601[_0xea7e('0xb')]),'trigger:browser:url',{'uri':_0x5398fa});})[_0xea7e('0x62')](function(_0x53e59c){logger[_0xea7e('0x63')](_0xea7e('0x53'),JSON[_0xea7e('0x23')](_0x53e59c));});};exports[_0xea7e('0x64')]=function(_0x4a5607,_0x3d5022,_0x4b99c2,_0x460f8e,_0xfb16eb,_0x567313,_0x1c2bdd){var _0x139af6,_0x23ce9c,_0x4bd0bf,_0x306937;_0x567313['remoteUri']=intUtil['stripTrailingSlash'](_0x567313['remoteUri']);_0x567313[_0xea7e('0x4f')]=intUtil['stripTrailingSlash'](_0x567313['serverUrl']);def[_0xea7e('0x50')]=util[_0xea7e('0x24')](_0xea7e('0x51'),_0x567313[_0xea7e('0x4d')]);if(_0x1c2bdd&&_0x1c2bdd[_0xea7e('0x65')]&&_0x1c2bdd['recordingFormat']!==_0xea7e('0x66')){logger['info']('[OUTBOUND]',_0xea7e('0x67'));_0x3d5022[_0xea7e('0x56')]=util['format'](_0xea7e('0x54'),_0x567313[_0xea7e('0x4f')],_0x3d5022['uniqueid'],md5(_0x3d5022['uniqueid']));}return getConnection(_0x567313)['then'](function(_0x4fbaae){_0x306937=_0x4fbaae;return getUser(_0x567313,_0x460f8e[_0xea7e('0xb')],_0x306937);})['then'](function(_0x2c10a6){_0x139af6=_0x2c10a6;logger[_0xea7e('0xa')](_0xea7e('0x68'),_0x139af6['id']);return getEndUser(_0x567313,_0x3d5022['destcalleridname'],_0x3d5022['destcalleridnum'],_0x306937);})[_0xea7e('0x27')](function(_0x2102a5){_0x23ce9c=_0x2102a5;logger['info'](_0xea7e('0x69'),_0x23ce9c['id']);return getTicket(_0x567313,_0x139af6,_0x23ce9c,_0x4b99c2,_0x3d5022,_0x4b99c2[_0xea7e('0x59')],_0x306937,_0xea7e('0x6a'));})[_0xea7e('0x27')](function(_0x1314d0){_0x4bd0bf=_0x1314d0;logger[_0xea7e('0xa')](_0xea7e('0x6b'));logger[_0xea7e('0xa')](_0xea7e('0x5b'),_0x4bd0bf['id']);return setRelationship(_0x306937,_0x139af6,_0x4bd0bf,_0xea7e('0x5c'));})[_0xea7e('0x27')](function(){return setRelationship(_0x306937,_0x23ce9c,_0x4bd0bf,'contacts');})[_0xea7e('0x27')](function(){return getServerInfo(_0x306937);})[_0xea7e('0x27')](function(_0x3358a3){var _0x48933d=parseInt(_0x3358a3[_0xea7e('0x5d')][_0xea7e('0x6c')](0x0));var _0x31dbdc=util[_0xea7e('0x24')](_0xea7e('0x5e'),_0x567313[_0xea7e('0x4d')],_0x4bd0bf['id']);if(_0x48933d>0x6){_0x31dbdc=util[_0xea7e('0x24')](_0xea7e('0x5f'),_0x567313[_0xea7e('0x4d')],_0x4bd0bf['id']);}logger['info'](_0xea7e('0x6d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xea7e('0x24')](_0xea7e('0x61'),_0x460f8e['name']),'trigger:browser:url',{'uri':_0x31dbdc});})[_0xea7e('0x62')](function(_0x47afc2){logger['error'](_0xea7e('0x6d'),JSON['stringify'](_0x47afc2));});};exports['unmanaged']=function(_0xd18255,_0x25d46f,_0x31e468,_0x4f7da8,_0x5af7c9,_0x147826){var _0x1fed12,_0x1e9ffa,_0x8de69e,_0x563e40;_0x147826['remoteUri']=intUtil[_0xea7e('0x4e')](_0x147826[_0xea7e('0x4d')]);_0x147826[_0xea7e('0x4f')]=intUtil[_0xea7e('0x4e')](_0x147826[_0xea7e('0x4f')]);def[_0xea7e('0x50')]=util[_0xea7e('0x24')](_0xea7e('0x51'),_0x147826[_0xea7e('0x4d')]);if(_0x5af7c9&&_0x5af7c9[_0xea7e('0x52')]){logger[_0xea7e('0xa')]('['+_0x25d46f['lastevent'][_0xea7e('0x6e')]()+']',_0xea7e('0x67'));_0x25d46f[_0xea7e('0x56')]=util[_0xea7e('0x24')](_0xea7e('0x54'),_0x147826[_0xea7e('0x4f')],_0x25d46f[_0xea7e('0x55')],md5(_0x25d46f[_0xea7e('0x55')]));}else{_0x25d46f[_0xea7e('0x56')]='';}return getConnection(_0x147826)['then'](function(_0x10413e){_0x563e40=_0x10413e;if(!_[_0xea7e('0x21')](_0x4f7da8)){return getUser(_0x147826,_0x4f7da8[_0xea7e('0xb')],_0x563e40);}else{return getUser(_0x147826,null,_0x563e40);}})[_0xea7e('0x27')](function(_0x243f45){_0x1fed12=_0x243f45;logger[_0xea7e('0xa')](_0xea7e('0x68'),_0x1fed12['id']);return getEndUser(_0x147826,_0x25d46f[_0xea7e('0x57')],_0x25d46f[_0xea7e('0x58')],_0x563e40);})['then'](function(_0x318011){_0x1e9ffa=_0x318011;logger[_0xea7e('0xa')]('The\x20Enduser\x20ID\x20is:',_0x1e9ffa['id']);return getTicket(_0x147826,_0x1fed12,_0x1e9ffa,_0x31e468,_0x25d46f,_0x31e468[_0xea7e('0x59')],_0x563e40,'Inbound');})[_0xea7e('0x27')](function(_0x5eaa32){_0x8de69e=_0x5eaa32;logger[_0xea7e('0xa')](_0xea7e('0x6b'));logger[_0xea7e('0xa')](_0xea7e('0x5b'),_0x8de69e['id']);return setRelationship(_0x563e40,_0x1fed12,_0x8de69e,'users');})['then'](function(){return setRelationship(_0x563e40,_0x1e9ffa,_0x8de69e,_0xea7e('0x6f'));})[_0xea7e('0x27')](function(){return getServerInfo(_0x563e40);})['catch'](function(_0x3bbc33){logger['error']('['+_0x25d46f[_0xea7e('0x70')][_0xea7e('0x6e')]()+']',JSON['stringify'](_0x3bbc33));});}; \ No newline at end of file +var _0x0272=['description','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','length','push','variableName','set_entry','JSON','Calls','format','apiKey','toString','base64','Getting\x20agent\x20with\x20name','stringify','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','idField','variable','custom_fields','customVariable','Variable','POST','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','contacts','version','user:%s','trigger:browser:url','catch','unmanaged','toUpperCase','isNil','calleridnum','Inbound','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by'];(function(_0x58de4a,_0x564dbc){var _0x178820=function(_0x3576ef){while(--_0x3576ef){_0x58de4a['push'](_0x58de4a['shift']());}};_0x178820(++_0x564dbc);}(_0x0272,0x15a));var _0x2027=function(_0x2d8909,_0x18926d){_0x2d8909=_0x2d8909-0x0;var _0x4956f6=_0x0272[_0x2d8909];return _0x4956f6;};'use strict';var _=require(_0x2027('0x0'));var rp=require(_0x2027('0x1'));var BPromise=require('bluebird');var md5=require(_0x2027('0x2'));var util=require(_0x2027('0x3'));var Redis=require(_0x2027('0x4'));var intUtil=require(_0x2027('0x5'));var config=require(_0x2027('0x6'));var logger=require(_0x2027('0x7'))('sugarcrm');config['redis']=_[_0x2027('0x8')](config[_0x2027('0x9')],{'host':_0x2027('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x2ac3bd,_0x4eb86c,_0x756027){io['to'](_0x2ac3bd)['emit'](_0x4eb86c,_0x756027);}function getTicket(_0x2f549d,_0x2323d7,_0x16240b,_0x16785,_0x5e74f4,_0x42a771,_0x3e9c64,_0x88a0b7){logger[_0x2027('0xb')](_0x2027('0xc'));var _0x218a75=new Date();var _0x564d24=[{'name':_0x2027('0xd'),'value':intUtil[_0x2027('0xe')](_0x16785['Subjects'],_0x5e74f4,'\x20')},{'name':_0x2027('0xf'),'value':_0x2323d7['id']},{'name':_0x2027('0x10'),'value':_0x2323d7['id']},{'name':_0x2027('0x11'),'value':intUtil[_0x2027('0xe')](_0x16785['Descriptions'],_0x5e74f4,'\x0a')},{'name':_0x2027('0x12'),'value':_0x218a75['toISOString']()[_0x2027('0x13')](0x0,0x13)[_0x2027('0x14')]('T','\x20')},{'name':_0x2027('0x15'),'value':'0'},{'name':_0x2027('0x16'),'value':'15'},{'name':_0x2027('0x17'),'value':_0x16240b['id']},{'name':_0x2027('0x18'),'value':_0x2027('0x19')},{'name':'parent_name','value':_0x16240b[_0x2027('0xd')]},{'name':_0x2027('0x1a'),'value':_0x88a0b7}];if(_0x42a771[_0x2027('0x1b')]){_['forEach'](_0x42a771,function(_0x3bd053){if(_0x5e74f4[_0x3bd053['variableName']]){_0x564d24[_0x2027('0x1c')]({'name':_0x3bd053['idField'],'value':_0x5e74f4[_0x3bd053[_0x2027('0x1d')]]});}});}return request({'form':{'method':_0x2027('0x1e'),'input_type':_0x2027('0x1f'),'response_type':_0x2027('0x1f'),'rest_data':JSON['stringify']({'session':_0x3e9c64['id'],'module_name':_0x2027('0x20'),'name_value_list':_0x564d24})}});}function getAuth(_0x372d0b){return util[_0x2027('0x21')]('Basic\x20%s',new Buffer(_0x372d0b[_0x2027('0x22')]+':X')[_0x2027('0x23')](_0x2027('0x24')));}function getServerInfo(_0x1e049c){return request({'form':{'method':'get_server_info','input_type':_0x2027('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x1e049c['id']})}});}function getUser(_0x1a8b7f,_0x277880,_0x462ff){if(!_['isNil'](_0x277880)){logger['info'](_0x2027('0x25'),_0x277880);return request({'form':{'method':'get_entry_list','input_type':_0x2027('0x1f'),'response_type':_0x2027('0x1f'),'rest_data':JSON[_0x2027('0x26')]({'session':_0x462ff['id'],'module_name':_0x2027('0x27'),'query':util[_0x2027('0x21')](_0x2027('0x28'),_0x277880),'order_by':'','offset':'0','select_fields':['id',_0x2027('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2027('0x29')](function(_0x126fdd){if(_0x126fdd[_0x2027('0x2a')]['length']){var _0x482ed1=_[_0x2027('0x2b')](_0x126fdd['entry_list'],function(_0x90a6ae){return _0x90a6ae['name_value_list']['user_name'][_0x2027('0x2c')]===_0x277880;});if(_0x482ed1){logger[_0x2027('0xb')](_0x2027('0x2d'));return BPromise[_0x2027('0x2e')]({'id':_0x482ed1[_0x2027('0x2f')]['id'][_0x2027('0x2c')],'name':_0x482ed1[_0x2027('0x2f')][_0x2027('0xd')]['value']});}}logger[_0x2027('0xb')](_0x2027('0x30'));return BPromise[_0x2027('0x2e')]({'id':_0x462ff[_0x2027('0x2f')]['user_id']['value'],'name':_0x462ff[_0x2027('0x2f')][_0x2027('0x31')][_0x2027('0x2c')]});});}else{logger[_0x2027('0xb')](_0x2027('0x32'));return BPromise['resolve']({'id':_0x462ff['name_value_list'][_0x2027('0x33')]['value'],'name':_0x462ff[_0x2027('0x2f')][_0x2027('0x31')][_0x2027('0x2c')]});}}function getEndUser(_0x177618,_0x10afc7,_0x4afd07,_0x2b9653){logger[_0x2027('0xb')](_0x2027('0x34'),_0x4afd07);return request({'form':{'method':'get_entry_list','input_type':_0x2027('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2b9653['id'],'module_name':_0x2027('0x19'),'query':util[_0x2027('0x21')](_0x2027('0x35'),_0x4afd07),'order_by':'','offset':'0','select_fields':['id',_0x2027('0xd'),_0x2027('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x56cf49){if(_0x56cf49[_0x2027('0x2a')][_0x2027('0x1b')]){var _0x2734c4=_[_0x2027('0x2b')](_0x56cf49['entry_list'],function(_0x521bca){return _0x521bca[_0x2027('0x2f')][_0x2027('0x36')]['value']===_0x4afd07;});if(_0x2734c4){logger[_0x2027('0xb')](_0x2027('0x37'));return BPromise[_0x2027('0x2e')]({'id':_0x2734c4[_0x2027('0x2f')]['id'][_0x2027('0x2c')],'name':_0x2734c4[_0x2027('0x2f')][_0x2027('0xd')][_0x2027('0x2c')],'phone':_0x2734c4[_0x2027('0x2f')][_0x2027('0x36')]['value']});}}else{logger[_0x2027('0xb')](_0x2027('0x38'));return request({'form':{'method':_0x2027('0x1e'),'input_type':_0x2027('0x1f'),'response_type':'JSON','rest_data':JSON[_0x2027('0x26')]({'session':_0x2b9653['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x10afc7!==''?_0x10afc7:util['format'](_0x2027('0x39'),_0x4afd07)},{'name':_0x2027('0x36'),'value':_0x4afd07}]})}})[_0x2027('0x29')](function(_0x447f70){logger['info'](_0x2027('0x3a'));return BPromise[_0x2027('0x2e')]({'id':_0x447f70['id'],'name':_0x447f70[_0x2027('0x2a')][_0x2027('0x3b')][_0x2027('0x2c')],'phone':_0x447f70['entry_list'][_0x2027('0x36')]['value']});});}});}function request(_0x5a6e2f){logger[_0x2027('0x3c')](_0x2027('0x3d'),JSON[_0x2027('0x26')](_0x5a6e2f));return rp(_[_0x2027('0x3e')](def,_0x5a6e2f));}function getTags(_0xb138e6,_0x371147){var _0x38a801=[];if(_0xb138e6&&_0xb138e6[_0x2027('0x1b')]>0x0){_0x38a801=_[_0x2027('0x3f')](_0xb138e6,_0x371147);}return _0x38a801;}function getCustomFields(_0x376572,_0x1bdbd0){var _0x4404e9=[];var _0x32ee2c={'custom_fields':[]};if(_0x376572[_0x2027('0x1b')]>0x0){_['forEach'](_0x376572,function(_0x7ad40){if(_0x7ad40[_0x2027('0x40')]===_0x2027('0x41')&&_0x7ad40[_0x2027('0x42')]&&!_0x7ad40[_0x2027('0x43')]){_0x32ee2c[_0x7ad40[_0x2027('0x42')][_0x2027('0x44')]()]=_0x7ad40[_0x2027('0x45')][_0x2027('0x23')]();}else if(_0x7ad40[_0x2027('0x40')]===_0x2027('0x41')&&_0x7ad40[_0x2027('0x46')]&&_0x7ad40['customField']){_0x32ee2c['custom_fields'][_0x2027('0x1c')]({'id':_0x7ad40['idField'],'value':_0x7ad40['content']['toString']()});}else if(_0x7ad40[_0x2027('0x40')]===_0x2027('0x47')&&_0x7ad40[_0x2027('0x1d')]&&_0x7ad40[_0x2027('0x46')]&&_0x7ad40['customField']){_0x1bdbd0[_0x7ad40[_0x2027('0x1d')]]&&_0x32ee2c[_0x2027('0x48')][_0x2027('0x1c')]({'id':_0x7ad40[_0x2027('0x46')],'value':_0x1bdbd0[_0x7ad40['variableName']][_0x2027('0x23')]()});}else if(_0x7ad40[_0x2027('0x40')]===_0x2027('0x49')&&_0x7ad40[_0x2027('0x4a')]&&_0x7ad40[_0x2027('0x4a')]['name']&&_0x7ad40[_0x2027('0x46')]&&_0x7ad40[_0x2027('0x43')]){_0x1bdbd0[_0x7ad40[_0x2027('0x4a')][_0x2027('0xd')]['toLowerCase']()]&&_0x32ee2c[_0x2027('0x48')]['push']({'id':_0x7ad40['idField'],'value':_0x1bdbd0[_0x7ad40[_0x2027('0x4a')][_0x2027('0xd')]['toLowerCase']()]['toString']()});}});}return _0x32ee2c;}function getConnection(_0x1f7c3a){return request({'method':_0x2027('0x4b'),'form':{'method':'login','input_type':_0x2027('0x1f'),'response_type':_0x2027('0x1f'),'rest_data':JSON[_0x2027('0x26')]({'user_auth':{'user_name':_0x1f7c3a[_0x2027('0x4c')],'password':_0x1f7c3a[_0x2027('0x4d')],'encryption':_0x2027('0x4e')},'application':_0x2027('0x4f')})}})[_0x2027('0x29')](function(_0x23b894){var _0x24b58f=_0x23b894;if(_0x24b58f['id']){def[_0x2027('0x50')]=_0x24b58f['id'];return BPromise['resolve'](_0x24b58f);}else{throw new Error(util[_0x2027('0x21')](_0x2027('0x51'),_0x1f7c3a['id']));}});}function setRelationship(_0xec64de,_0x3e5cd7,_0x21c139,_0x3ec290){return request({'form':{'method':_0x2027('0x52'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0xec64de['id'],'module_name':_0x2027('0x20'),'module_id':_0x21c139['id'],'link_field_name':_0x3ec290,'related_ids':[_0x3e5cd7['id']]})}});}exports['queue']=function(_0x4f564b,_0xa10d53,_0xd6e8f5,_0x5399ed,_0x254a43,_0x5f3fe3){var _0x291aa0,_0x394f61,_0x4abc8f,_0x24e529;_0x5f3fe3[_0x2027('0x53')]=intUtil[_0x2027('0x54')](_0x5f3fe3[_0x2027('0x53')]);_0x5f3fe3[_0x2027('0x55')]=intUtil[_0x2027('0x54')](_0x5f3fe3[_0x2027('0x55')]);def[_0x2027('0x56')]=util[_0x2027('0x21')](_0x2027('0x57'),_0x5f3fe3['remoteUri']);if(_0x254a43&&_0x254a43['monitor_format']){logger[_0x2027('0xb')](_0x2027('0x58'),_0x2027('0x59'));_0xa10d53['recordingURL']=util[_0x2027('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5f3fe3[_0x2027('0x55')],_0xa10d53['uniqueid'],md5(_0xa10d53[_0x2027('0x5a')]));}else{_0xa10d53[_0x2027('0x5b')]='';}return getConnection(_0x5f3fe3)[_0x2027('0x29')](function(_0x1897c7){_0x24e529=_0x1897c7;return getUser(_0x5f3fe3,_0x5399ed['name'],_0x24e529);})[_0x2027('0x29')](function(_0x324cea){_0x291aa0=_0x324cea;logger['info']('The\x20User\x20ID\x20is:',_0x291aa0['id']);return getEndUser(_0x5f3fe3,_0xa10d53[_0x2027('0x5c')],_0xa10d53['calleridnum'],_0x24e529);})[_0x2027('0x29')](function(_0x5e07c4){_0x394f61=_0x5e07c4;logger[_0x2027('0xb')](_0x2027('0x5d'),_0x394f61['id']);return getTicket(_0x5f3fe3,_0x291aa0,_0x394f61,_0xd6e8f5,_0xa10d53,_0xd6e8f5[_0x2027('0x5e')],_0x24e529,'Inbound');})['then'](function(_0x188bd1){_0x4abc8f=_0x188bd1;logger[_0x2027('0xb')](_0x2027('0x5f'));logger[_0x2027('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4abc8f['id']);return setRelationship(_0x24e529,_0x291aa0,_0x4abc8f,_0x2027('0x60'));})[_0x2027('0x29')](function(){return setRelationship(_0x24e529,_0x394f61,_0x4abc8f,'contacts');})['then'](function(){return getServerInfo(_0x24e529);})[_0x2027('0x29')](function(_0x1e064e){var _0x273cbd=parseInt(_0x1e064e['version'][_0x2027('0x61')](0x0));var _0x4ba460=util['format'](_0x2027('0x62'),_0x5f3fe3[_0x2027('0x53')],_0x4abc8f['id']);if(_0x273cbd>0x6){_0x4ba460=util[_0x2027('0x21')](_0x2027('0x63'),_0x5f3fe3[_0x2027('0x53')],_0x4abc8f['id']);}logger['info'](_0x2027('0x58'),_0x2027('0x64'));emit(util[_0x2027('0x21')]('user:%s',_0x5399ed[_0x2027('0xd')]),'trigger:browser:url',{'uri':_0x4ba460});})['catch'](function(_0xf3bdb4){logger[_0x2027('0x65')]('[QUEUE]',JSON['stringify'](_0xf3bdb4));});};exports['outbound']=function(_0xb3a3a1,_0x6cab,_0x15caa9,_0x350751,_0xe0ecc3,_0x16dcd3,_0x3e0fa5){var _0x256993,_0x2a2d86,_0x578249,_0x42ceb8;_0x16dcd3[_0x2027('0x53')]=intUtil[_0x2027('0x54')](_0x16dcd3[_0x2027('0x53')]);_0x16dcd3['serverUrl']=intUtil[_0x2027('0x54')](_0x16dcd3[_0x2027('0x55')]);def['uri']=util[_0x2027('0x21')](_0x2027('0x57'),_0x16dcd3[_0x2027('0x53')]);if(_0x3e0fa5&&_0x3e0fa5['recordingFormat']&&_0x3e0fa5[_0x2027('0x66')]!==_0x2027('0x67')){logger[_0x2027('0xb')](_0x2027('0x68'),_0x2027('0x59'));_0x6cab['recordingURL']=util[_0x2027('0x21')](_0x2027('0x69'),_0x16dcd3[_0x2027('0x55')],_0x6cab['uniqueid'],md5(_0x6cab[_0x2027('0x5a')]));}return getConnection(_0x16dcd3)[_0x2027('0x29')](function(_0x156704){_0x42ceb8=_0x156704;return getUser(_0x16dcd3,_0x350751[_0x2027('0xd')],_0x42ceb8);})['then'](function(_0x3389c0){_0x256993=_0x3389c0;logger[_0x2027('0xb')]('The\x20User\x20ID\x20is:',_0x256993['id']);return getEndUser(_0x16dcd3,_0x6cab[_0x2027('0x6a')],_0x6cab[_0x2027('0x6b')],_0x42ceb8);})[_0x2027('0x29')](function(_0x2cebf6){_0x2a2d86=_0x2cebf6;logger[_0x2027('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2a2d86['id']);return getTicket(_0x16dcd3,_0x256993,_0x2a2d86,_0x15caa9,_0x6cab,_0x15caa9['Fields'],_0x42ceb8,_0x2027('0x6c'));})['then'](function(_0x4e25c5){_0x578249=_0x4e25c5;logger[_0x2027('0xb')]('Ticket\x20created!');logger[_0x2027('0xb')](_0x2027('0x6d'),_0x578249['id']);return setRelationship(_0x42ceb8,_0x256993,_0x578249,_0x2027('0x60'));})[_0x2027('0x29')](function(){return setRelationship(_0x42ceb8,_0x2a2d86,_0x578249,_0x2027('0x6e'));})[_0x2027('0x29')](function(){return getServerInfo(_0x42ceb8);})[_0x2027('0x29')](function(_0x286e52){var _0x226c1b=parseInt(_0x286e52[_0x2027('0x6f')]['charAt'](0x0));var _0xe4670c=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x16dcd3['remoteUri'],_0x578249['id']);if(_0x226c1b>0x6){_0xe4670c=util[_0x2027('0x21')](_0x2027('0x63'),_0x16dcd3['remoteUri'],_0x578249['id']);}logger[_0x2027('0xb')](_0x2027('0x68'),_0x2027('0x64'));emit(util['format'](_0x2027('0x70'),_0x350751[_0x2027('0xd')]),_0x2027('0x71'),{'uri':_0xe4670c});})[_0x2027('0x72')](function(_0x4a22cb){logger[_0x2027('0x65')]('[OUTBOUND]',JSON['stringify'](_0x4a22cb));});};exports[_0x2027('0x73')]=function(_0x42f98e,_0x39bf75,_0x3c2689,_0x3b9fc4,_0x412e24,_0x1bbd72){var _0x8308a7,_0x2c43e8,_0x5e2201,_0x498ebc;_0x1bbd72[_0x2027('0x53')]=intUtil[_0x2027('0x54')](_0x1bbd72[_0x2027('0x53')]);_0x1bbd72[_0x2027('0x55')]=intUtil[_0x2027('0x54')](_0x1bbd72[_0x2027('0x55')]);def[_0x2027('0x56')]=util['format'](_0x2027('0x57'),_0x1bbd72['remoteUri']);if(_0x412e24&&_0x412e24['monitor_format']){logger['info']('['+_0x39bf75['lastevent'][_0x2027('0x74')]()+']',_0x2027('0x59'));_0x39bf75[_0x2027('0x5b')]=util['format'](_0x2027('0x69'),_0x1bbd72[_0x2027('0x55')],_0x39bf75[_0x2027('0x5a')],md5(_0x39bf75[_0x2027('0x5a')]));}else{_0x39bf75['recordingURL']='';}return getConnection(_0x1bbd72)['then'](function(_0x31d548){_0x498ebc=_0x31d548;if(!_[_0x2027('0x75')](_0x3b9fc4)){return getUser(_0x1bbd72,_0x3b9fc4[_0x2027('0xd')],_0x498ebc);}else{return getUser(_0x1bbd72,null,_0x498ebc);}})['then'](function(_0x201188){_0x8308a7=_0x201188;logger[_0x2027('0xb')]('The\x20User\x20ID\x20is:',_0x8308a7['id']);return getEndUser(_0x1bbd72,_0x39bf75[_0x2027('0x5c')],_0x39bf75[_0x2027('0x76')],_0x498ebc);})[_0x2027('0x29')](function(_0x230a80){_0x2c43e8=_0x230a80;logger[_0x2027('0xb')](_0x2027('0x5d'),_0x2c43e8['id']);return getTicket(_0x1bbd72,_0x8308a7,_0x2c43e8,_0x3c2689,_0x39bf75,_0x3c2689[_0x2027('0x5e')],_0x498ebc,_0x2027('0x77'));})[_0x2027('0x29')](function(_0x521611){_0x5e2201=_0x521611;logger[_0x2027('0xb')](_0x2027('0x5f'));logger[_0x2027('0xb')]('The\x20Ticket\x20ID\x20is:',_0x5e2201['id']);return setRelationship(_0x498ebc,_0x8308a7,_0x5e2201,'users');})[_0x2027('0x29')](function(){return setRelationship(_0x498ebc,_0x2c43e8,_0x5e2201,_0x2027('0x6e'));})[_0x2027('0x29')](function(){return getServerInfo(_0x498ebc);})[_0x2027('0x72')](function(_0x4d9556){logger['error']('['+_0x39bf75[_0x2027('0x78')][_0x2027('0x74')]()+']',JSON[_0x2027('0x26')](_0x4d9556));});}; \ 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 0202f2f..e59951b 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 _0x48f5=['customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','push','content','type','variable','variableName','toString'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x48f5,0x1a7));var _0x548f=function(_0x60953a,_0x49ec5d){_0x60953a=_0x60953a-0x0;var _0x136a6e=_0x48f5[_0x60953a];return _0x136a6e;};'use strict';var _=require(_0x548f('0x0'));var util=require(_0x548f('0x1'));exports[_0x548f('0x2')]=function(_0x2388d3,_0x17c946,_0x2ceefb){var _0x1c53f4=[];if(_0x2388d3[_0x548f('0x3')]>0x0){var _0x3264ea=_[_0x548f('0x4')](_0x2388d3,['id']);for(var _0x40085a=0x0;_0x40085a<_0x3264ea[_0x548f('0x3')];_0x40085a++){var _0x49e928=_0x3264ea[_0x40085a];if(_0x49e928['type']===_0x548f('0x5')){_0x1c53f4[_0x548f('0x6')](_0x49e928[_0x548f('0x7')]);}else if(_0x49e928[_0x548f('0x8')]===_0x548f('0x9')&&_0x49e928[_0x548f('0xa')]){_0x17c946[_0x49e928['variableName']]&&_0x1c53f4['push'](_0x17c946[_0x49e928['variableName']][_0x548f('0xb')]());}else if(_0x49e928[_0x548f('0x8')]===_0x548f('0xc')&&_0x49e928['Variable']&&_0x49e928[_0x548f('0xd')]['name']){_0x17c946[_0x49e928[_0x548f('0xd')][_0x548f('0xe')][_0x548f('0xf')]()]&&_0x1c53f4[_0x548f('0x6')](_0x17c946[_0x49e928[_0x548f('0xd')][_0x548f('0xe')][_0x548f('0xf')]()]['toString']());}else if(_0x49e928['type']===_0x548f('0x10')){if(_0x49e928['keyType']==='string'&&_0x49e928[_0x548f('0x11')]){_0x1c53f4[_0x548f('0x6')](util[_0x548f('0x12')](_0x548f('0x13'),_0x49e928[_0x548f('0x11')],_0x49e928[_0x548f('0x14')]));}else if(_0x49e928['keyType']===_0x548f('0x9')&&_0x49e928[_0x548f('0xa')]&&_0x49e928[_0x548f('0x11')]){_0x17c946[_0x49e928[_0x548f('0xa')]]&&_0x1c53f4[_0x548f('0x6')](util[_0x548f('0x12')](_0x548f('0x13'),_0x49e928[_0x548f('0x11')],_0x17c946[_0x49e928['variableName']]));}else if(_0x49e928[_0x548f('0x15')]===_0x548f('0xc')&&_0x49e928[_0x548f('0xd')]&&_0x49e928[_0x548f('0xd')][_0x548f('0xe')]&&_0x49e928[_0x548f('0x11')]){_0x17c946[_0x49e928[_0x548f('0xd')][_0x548f('0xe')][_0x548f('0xf')]()]&&_0x1c53f4[_0x548f('0x6')](util[_0x548f('0x12')]('%s:\x20%s',_0x49e928['key'],_0x17c946[_0x49e928[_0x548f('0xd')][_0x548f('0xe')]['toLowerCase']()]));}}}}return _0x1c53f4[_0x548f('0x16')](_0x2ceefb);};exports[_0x548f('0x17')]=function(_0xaa885f){var _0x2753cc=_0xaa885f['slice'](-0x1);if(_0x2753cc==='/'){_0xaa885f=_0xaa885f[_0x548f('0x18')](0x0,_0xaa885f[_0x548f('0x19')](_0x2753cc));}return _0xaa885f;};exports[_0x548f('0x1a')]=function(_0x392d7b){if(!_[_0x548f('0x1b')](_0x392d7b)&&_0x392d7b!==''){var _0x570266=/^(([^<>()\[\]\\.,;:\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 _0x570266[_0x548f('0x1c')](String(_0x392d7b)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xdd29=['Variable','name','toLowerCase','type','keyValue','keyType','key','%s:\x20%s','format','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','lodash','util','sortBy','length','string','content','variable','variableName','push','toString','customVariable'];(function(_0xe86041,_0x2fbd7b){var _0x1230a9=function(_0x1366e8){while(--_0x1366e8){_0xe86041['push'](_0xe86041['shift']());}};_0x1230a9(++_0x2fbd7b);}(_0xdd29,0x1a5));var _0x9dd2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd29[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9dd2('0x0'));var util=require(_0x9dd2('0x1'));exports['getString']=function(_0x11338f,_0x513bf2,_0x1dd8c4){var _0x2fdcc7=[];if(_0x11338f['length']>0x0){var _0x54b8b1=_[_0x9dd2('0x2')](_0x11338f,['id']);for(var _0x155f68=0x0;_0x155f68<_0x54b8b1[_0x9dd2('0x3')];_0x155f68++){var _0x21ee79=_0x54b8b1[_0x155f68];if(_0x21ee79['type']===_0x9dd2('0x4')){_0x2fdcc7['push'](_0x21ee79[_0x9dd2('0x5')]);}else if(_0x21ee79['type']===_0x9dd2('0x6')&&_0x21ee79[_0x9dd2('0x7')]){_0x513bf2[_0x21ee79['variableName']]&&_0x2fdcc7[_0x9dd2('0x8')](_0x513bf2[_0x21ee79[_0x9dd2('0x7')]][_0x9dd2('0x9')]());}else if(_0x21ee79['type']===_0x9dd2('0xa')&&_0x21ee79[_0x9dd2('0xb')]&&_0x21ee79['Variable'][_0x9dd2('0xc')]){_0x513bf2[_0x21ee79[_0x9dd2('0xb')]['name'][_0x9dd2('0xd')]()]&&_0x2fdcc7[_0x9dd2('0x8')](_0x513bf2[_0x21ee79['Variable'][_0x9dd2('0xc')][_0x9dd2('0xd')]()][_0x9dd2('0x9')]());}else if(_0x21ee79[_0x9dd2('0xe')]===_0x9dd2('0xf')){if(_0x21ee79[_0x9dd2('0x10')]===_0x9dd2('0x4')&&_0x21ee79['key']){_0x2fdcc7[_0x9dd2('0x8')](util['format']('%s:\x20%s',_0x21ee79[_0x9dd2('0x11')],_0x21ee79['keyContent']));}else if(_0x21ee79[_0x9dd2('0x10')]===_0x9dd2('0x6')&&_0x21ee79[_0x9dd2('0x7')]&&_0x21ee79['key']){_0x513bf2[_0x21ee79[_0x9dd2('0x7')]]&&_0x2fdcc7['push'](util['format'](_0x9dd2('0x12'),_0x21ee79['key'],_0x513bf2[_0x21ee79[_0x9dd2('0x7')]]));}else if(_0x21ee79[_0x9dd2('0x10')]===_0x9dd2('0xa')&&_0x21ee79['Variable']&&_0x21ee79[_0x9dd2('0xb')][_0x9dd2('0xc')]&&_0x21ee79[_0x9dd2('0x11')]){_0x513bf2[_0x21ee79['Variable'][_0x9dd2('0xc')]['toLowerCase']()]&&_0x2fdcc7[_0x9dd2('0x8')](util[_0x9dd2('0x13')]('%s:\x20%s',_0x21ee79[_0x9dd2('0x11')],_0x513bf2[_0x21ee79[_0x9dd2('0xb')][_0x9dd2('0xc')][_0x9dd2('0xd')]()]));}}}}return _0x2fdcc7[_0x9dd2('0x14')](_0x1dd8c4);};exports[_0x9dd2('0x15')]=function(_0x2256d4){var _0x4c639a=_0x2256d4[_0x9dd2('0x16')](-0x1);if(_0x4c639a==='/'){_0x2256d4=_0x2256d4[_0x9dd2('0x17')](0x0,_0x2256d4[_0x9dd2('0x18')](_0x4c639a));}return _0x2256d4;};exports['validateEmail']=function(_0x2a080e){if(!_[_0x9dd2('0x19')](_0x2a080e)&&_0x2a080e!==''){var _0x4d8c24=/^(([^<>()\[\]\\.,;:\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 _0x4d8c24[_0x9dd2('0x1a')](String(_0x2a080e)['toLowerCase']());}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 f6057f2..87a7313 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 _0x8d4d=['[OUTBOUND]','unmanaged','lastevent','toUpperCase','Ticket\x20created!','lodash','request-promise','md5','util','ioredis','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','HelpDesk','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','stringify','validateEmail','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','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!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','sessionName','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','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','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','outbound','serverUrl','recordingFormat','none','destcalleridname','destcalleridnum','trigger:browser:url'];(function(_0x55d11b,_0x11f7de){var _0x145d2b=function(_0x5e2b1d){while(--_0x5e2b1d){_0x55d11b['push'](_0x55d11b['shift']());}};_0x145d2b(++_0x11f7de);}(_0x8d4d,0x134));var _0xd8d4=function(_0x54caf6,_0x4b4c6b){_0x54caf6=_0x54caf6-0x0;var _0x1e94f0=_0x8d4d[_0x54caf6];return _0x1e94f0;};'use strict';var _=require(_0xd8d4('0x0'));var rp=require(_0xd8d4('0x1'));var BPromise=require('bluebird');var md5=require(_0xd8d4('0x2'));var util=require(_0xd8d4('0x3'));var Redis=require(_0xd8d4('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xd8d4('0x5'))(_0xd8d4('0x6'));config[_0xd8d4('0x7')]=_['defaults'](config['redis'],{'host':_0xd8d4('0x8'),'port':0x18eb});var io=require(_0xd8d4('0x9'))(new Redis(config[_0xd8d4('0x7')]));function emit(_0x17fc68,_0x1fed99,_0x117b63){io['to'](_0x17fc68)[_0xd8d4('0xa')](_0x1fed99,_0x117b63);}function getCustomFields(_0x11078a,_0x5a5229){var _0x19f474={};if(_0x11078a[_0xd8d4('0xb')]>0x0){_[_0xd8d4('0xc')](_0x11078a,function(_0x45caeb){if(_0x45caeb[_0xd8d4('0xd')]===_0xd8d4('0xe')&&_0x45caeb[_0xd8d4('0xf')]){_0x19f474[_0x45caeb['idField']]=_0x45caeb[_0xd8d4('0x10')][_0xd8d4('0x11')]();}else if(_0x45caeb[_0xd8d4('0xd')]===_0xd8d4('0x12')&&_0x45caeb[_0xd8d4('0x13')]&&_0x45caeb[_0xd8d4('0xf')]&&_0x5a5229[_0x45caeb[_0xd8d4('0x13')]]){_0x19f474[_0x45caeb[_0xd8d4('0xf')]]=_0x5a5229[_0x45caeb[_0xd8d4('0x13')]]['toString']();}else if(_0x45caeb[_0xd8d4('0xd')]===_0xd8d4('0x14')&&_0x45caeb[_0xd8d4('0x15')]&&_0x45caeb['Variable'][_0xd8d4('0x16')]&&_0x45caeb['idField']&&_0x5a5229[_0x45caeb[_0xd8d4('0x15')][_0xd8d4('0x16')][_0xd8d4('0x17')]()]){_0x19f474[_0x45caeb[_0xd8d4('0xf')]]=_0x5a5229[_0x45caeb[_0xd8d4('0x15')][_0xd8d4('0x16')][_0xd8d4('0x17')]()]['toString']();}});}return _0x19f474;}function createTicket(_0x22cc7f,_0x1a6ca5,_0x4fbadf,_0x4c48eb,_0x3e033b,_0x721a4b,_0x496c56){logger[_0xd8d4('0x18')](_0xd8d4('0x19'));var _0x20993e=_[_0xd8d4('0x1a')]({'parent_id':'','assigned_user_id':_0x1a6ca5['id'],'ticketpriorities':'Normal','ticketstatus':_0xd8d4('0x1b'),'ticket_title':intUtil[_0xd8d4('0x1c')](_0x4c48eb[_0xd8d4('0x1d')],_0x3e033b,'\x20'),'description':intUtil[_0xd8d4('0x1c')](_0x4c48eb[_0xd8d4('0x1e')],_0x3e033b,'\x0a'),'contact_id':_0x4fbadf['id']},getCustomFields(_0x721a4b,_0x3e033b));var _0x3355df={'method':_0xd8d4('0x1f'),'uri':util[_0xd8d4('0x20')](_0xd8d4('0x21'),_0x22cc7f[_0xd8d4('0x22')]),'form':{'operation':_0xd8d4('0x23'),'username':_0x22cc7f[_0xd8d4('0x24')],'sessionName':_0x496c56['sessionName'],'elementType':_0xd8d4('0x25'),'element':JSON['stringify'](_0x20993e)},'json':!![]};return request(_0x3355df)[_0xd8d4('0x26')](function(_0x484f5a){if(_0x484f5a[_0xd8d4('0x27')]){return BPromise[_0xd8d4('0x28')]({'id':_0x484f5a['result']['id']});}else{throw new Error(util['format'](_0xd8d4('0x29'),JSON['stringify'](_0x484f5a[_0xd8d4('0x2a')])));}})[_0xd8d4('0x2b')](function(_0x1a680a){var _0x27b7cb=_0x1a680a[_0xd8d4('0x2c')]||0x1f4;logger[_0xd8d4('0x2a')](_0xd8d4('0x2d'),'createTicket',_0x27b7cb,JSON[_0xd8d4('0x2e')](_0x1a680a));});}function getUser(_0x41ad19,_0x10ba39,_0x2e29d8){if(intUtil[_0xd8d4('0x2f')](_0x10ba39)){logger[_0xd8d4('0x18')]('Getting\x20agent\x20with\x20email',_0x10ba39);return request({'method':'GET','uri':util[_0xd8d4('0x20')](_0xd8d4('0x21'),_0x41ad19[_0xd8d4('0x22')]),'qs':{'operation':'query','username':_0x41ad19[_0xd8d4('0x24')],'sessionName':_0x2e29d8['sessionName'],'query':util[_0xd8d4('0x20')](_0xd8d4('0x30'),_0x10ba39)},'json':!![]})[_0xd8d4('0x26')](function(_0x10a15c){if(_0x10a15c[_0xd8d4('0x27')]&&_0x10a15c[_0xd8d4('0x31')][_0xd8d4('0xb')]){logger[_0xd8d4('0x18')]('Agent\x20found!');return BPromise['resolve']({'id':_0x10a15c[_0xd8d4('0x31')][0x0]['id'],'email':_0x10a15c['result'][0x0]['email1'],'name':_0x10a15c['result'][0x0]['first_name']+'\x20'+_0x10a15c[_0xd8d4('0x31')][_0xd8d4('0x32')]});}else{logger[_0xd8d4('0x18')](_0xd8d4('0x33'));return BPromise[_0xd8d4('0x28')]({'id':_0x2e29d8[_0xd8d4('0x34')],'email':_0x41ad19[_0xd8d4('0x24')],'name':_0xd8d4('0x35')});}})[_0xd8d4('0x2b')](function(_0x997fc5){var _0x206de3=_0x997fc5[_0xd8d4('0x2c')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0xd8d4('0x36'),_0x206de3,JSON['stringify'](_0x997fc5));});}else{logger[_0xd8d4('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd8d4('0x28')]({'id':_0x2e29d8[_0xd8d4('0x34')],'email':_0x41ad19[_0xd8d4('0x24')],'name':'admin'})[_0xd8d4('0x2b')](function(_0x3aeb72){var _0x3f8ce7=_0x3aeb72[_0xd8d4('0x2c')]||0x1f4;logger[_0xd8d4('0x2a')](_0xd8d4('0x2d'),_0xd8d4('0x36'),_0x3f8ce7,JSON[_0xd8d4('0x2e')](_0x3aeb72));});}}function getEndUser(_0x4d73bf,_0x35d06f,_0x324669,_0x4974c9){logger[_0xd8d4('0x18')](_0xd8d4('0x37'),_0x324669);return request({'method':_0xd8d4('0x38'),'uri':util['format'](_0xd8d4('0x21'),_0x4d73bf['remoteUri']),'qs':{'operation':_0xd8d4('0x39'),'username':_0x4d73bf[_0xd8d4('0x24')],'sessionName':_0x4974c9['sessionName'],'query':util[_0xd8d4('0x20')](_0xd8d4('0x3a'),_0x324669,_0x324669,_0x324669,_0x324669,_0x324669)},'json':!![]})['then'](function(_0x585fbc){if(_0x585fbc[_0xd8d4('0x27')]&&_0x585fbc[_0xd8d4('0x31')]['length']){logger[_0xd8d4('0x18')](_0xd8d4('0x3b'));return BPromise[_0xd8d4('0x28')]({'id':_0x585fbc['result'][0x0]['id'],'name':_0x585fbc[_0xd8d4('0x31')][0x0]['firstname']+'\x20'+_0x585fbc[_0xd8d4('0x31')][0x0][_0xd8d4('0x3c')],'phone':_0x324669});}else{logger[_0xd8d4('0x18')](_0xd8d4('0x3d'));return request({'method':_0xd8d4('0x1f'),'uri':util[_0xd8d4('0x20')](_0xd8d4('0x21'),_0x4d73bf[_0xd8d4('0x22')]),'form':{'operation':'create','sessionName':_0x4974c9[_0xd8d4('0x3e')],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0x35d06f,'phone':_0x324669,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x379bb0){logger[_0xd8d4('0x18')](_0xd8d4('0x3f'));return BPromise[_0xd8d4('0x28')]({'id':_0x379bb0[_0xd8d4('0x31')]['id'],'name':_0x379bb0[_0xd8d4('0x31')][_0xd8d4('0x3c')],'phone':_0x379bb0[_0xd8d4('0x31')][_0xd8d4('0x40')]});})[_0xd8d4('0x2b')](function(_0x27198a){var _0x2b6f5d=_0x27198a[_0xd8d4('0x2c')]||0x1f4;logger['error'](_0xd8d4('0x2d'),_0xd8d4('0x41'),_0x2b6f5d,JSON[_0xd8d4('0x2e')](_0x27198a));});}});}function getConnection(_0x4c3cca){var _0x4e2f18=_0x4c3cca[_0xd8d4('0x24')];var _0x3d608d=_0x4c3cca[_0xd8d4('0x42')];return request({'method':_0xd8d4('0x38'),'uri':util[_0xd8d4('0x20')]('%s/webservice.php',_0x4c3cca[_0xd8d4('0x22')]),'qs':{'operation':_0xd8d4('0x43'),'username':_0x4e2f18},'json':!![]})[_0xd8d4('0x26')](function(_0x8bf742){if(_0x8bf742[_0xd8d4('0x27')]){return request({'method':_0xd8d4('0x1f'),'uri':util[_0xd8d4('0x20')](_0xd8d4('0x21'),_0x4c3cca[_0xd8d4('0x22')]),'form':{'operation':'login','username':_0x4e2f18,'accessKey':md5(_0x8bf742[_0xd8d4('0x31')][_0xd8d4('0x44')]+_0x3d608d)},'json':!![]});}})[_0xd8d4('0x26')](function(_0x654a19){if(_0x654a19[_0xd8d4('0x27')]){return BPromise[_0xd8d4('0x28')](_0x654a19[_0xd8d4('0x31')]);}else{throw new Error(util[_0xd8d4('0x20')](_0xd8d4('0x45'),_0x4c3cca['id']));}})[_0xd8d4('0x2b')](function(_0x118e0f){var _0x506bef=_0x118e0f[_0xd8d4('0x2c')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0xd8d4('0x46'),_0x506bef,JSON[_0xd8d4('0x2e')](_0x118e0f));});}function request(_0x4dcb3b){logger[_0xd8d4('0x18')](_0xd8d4('0x47'),JSON[_0xd8d4('0x2e')](_0x4dcb3b));return rp(_0x4dcb3b);}exports[_0xd8d4('0x48')]=function(_0x44c5e7,_0x3fb85d,_0x154f12,_0x28b15a,_0x1bbc25,_0x404387){var _0x1f741e,_0x50bb66,_0x257666,_0x441b27;_0x404387[_0xd8d4('0x22')]=intUtil[_0xd8d4('0x49')](_0x404387['remoteUri']);if(_0x1bbc25&&_0x1bbc25[_0xd8d4('0x4a')]){logger[_0xd8d4('0x18')](_0xd8d4('0x4b'),_0xd8d4('0x4c'));_0x3fb85d[_0xd8d4('0x4d')]=util['format'](_0xd8d4('0x4e'),_0x404387['serverUrl'],_0x3fb85d[_0xd8d4('0x4f')],md5(_0x3fb85d[_0xd8d4('0x4f')]));}else{_0x3fb85d[_0xd8d4('0x4d')]='';}return getConnection(_0x404387)[_0xd8d4('0x26')](function(_0x5e072a){_0x441b27=_0x5e072a;return getUser(_0x404387,_0x28b15a[_0xd8d4('0x50')],_0x441b27);})[_0xd8d4('0x26')](function(_0x45a73c){_0x1f741e=_0x45a73c;logger[_0xd8d4('0x18')](_0xd8d4('0x51'),_0x1f741e['id']);return getEndUser(_0x404387,_0x3fb85d[_0xd8d4('0x52')],_0x3fb85d['calleridnum'],_0x441b27);})[_0xd8d4('0x26')](function(_0x2c63ea){_0x50bb66=_0x2c63ea;logger['info'](_0xd8d4('0x53'),_0x50bb66['id']);return createTicket(_0x404387,_0x1f741e,_0x50bb66,_0x154f12,_0x3fb85d,_0x154f12[_0xd8d4('0x54')],_0x441b27);})[_0xd8d4('0x26')](function(_0x3e7590){_0x257666=_0x3e7590;logger['info']('Ticket\x20created!');logger[_0xd8d4('0x18')](_0xd8d4('0x55'),_0x257666['id']);var _0x4bf48b=util[_0xd8d4('0x20')](_0xd8d4('0x56'),_0x404387['remoteUri'],_[_0xd8d4('0x57')](_0x257666['id'],'x')[0x1]);logger[_0xd8d4('0x18')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xd8d4('0x58'),_0x28b15a[_0xd8d4('0x16')]),'trigger:browser:url',{'uri':_0x4bf48b});})[_0xd8d4('0x2b')](function(_0x3c7933){logger['error'](_0xd8d4('0x4b'),JSON[_0xd8d4('0x2e')](_0x3c7933));});};exports[_0xd8d4('0x59')]=function(_0x4f4203,_0x1ee1f5,_0x3f1677,_0x2dba17,_0x204064,_0x4b367d,_0x16d1b3){var _0x428a23,_0x514295,_0x32e11e,_0x2cd8ba;_0x4b367d['remoteUri']=intUtil[_0xd8d4('0x49')](_0x4b367d[_0xd8d4('0x22')]);_0x4b367d[_0xd8d4('0x5a')]=intUtil['stripTrailingSlash'](_0x4b367d[_0xd8d4('0x5a')]);if(_0x16d1b3&&_0x16d1b3[_0xd8d4('0x5b')]&&_0x16d1b3['recordingFormat']!==_0xd8d4('0x5c')){logger[_0xd8d4('0x18')]('[OUTBOUND]',_0xd8d4('0x4c'));_0x1ee1f5[_0xd8d4('0x4d')]=util[_0xd8d4('0x20')](_0xd8d4('0x4e'),_0x4b367d['serverUrl'],_0x1ee1f5['uniqueid'],md5(_0x1ee1f5[_0xd8d4('0x4f')]));}return getConnection(_0x4b367d)['then'](function(_0x4cca03){_0x2cd8ba=_0x4cca03;return getUser(_0x4b367d,_0x2dba17[_0xd8d4('0x50')],_0x2cd8ba);})['then'](function(_0x4d9d12){_0x428a23=_0x4d9d12;logger['info'](_0xd8d4('0x51'),_0x428a23['id']);return getEndUser(_0x4b367d,_0x1ee1f5[_0xd8d4('0x5d')],_0x1ee1f5[_0xd8d4('0x5e')],_0x2cd8ba);})[_0xd8d4('0x26')](function(_0x1deaef){_0x514295=_0x1deaef;logger[_0xd8d4('0x18')](_0xd8d4('0x53'),_0x514295['id']);return createTicket(_0x4b367d,_0x428a23,_0x514295,_0x3f1677,_0x1ee1f5,_0x3f1677[_0xd8d4('0x54')],_0x2cd8ba);})[_0xd8d4('0x26')](function(_0x598a4f){_0x32e11e=_0x598a4f;logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x32e11e['id']);var _0x5f06b4=util[_0xd8d4('0x20')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4b367d[_0xd8d4('0x22')],_['split'](_0x32e11e['id'],'x')[0x1]);logger[_0xd8d4('0x18')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd8d4('0x20')]('user:%s',_0x2dba17[_0xd8d4('0x16')]),_0xd8d4('0x5f'),{'uri':_0x5f06b4});})[_0xd8d4('0x2b')](function(_0x1f53fd){logger['error'](_0xd8d4('0x60'),JSON['stringify'](_0x1f53fd));});};exports[_0xd8d4('0x61')]=function(_0x542a65,_0x2f4145,_0x14edea,_0x551e74,_0x5eb07f,_0x4f2f58){var _0x3f2c9c,_0x4f5067,_0x4b8987,_0x51c3d3;_0x4f2f58[_0xd8d4('0x22')]=intUtil[_0xd8d4('0x49')](_0x4f2f58[_0xd8d4('0x22')]);_0x4f2f58[_0xd8d4('0x5a')]=intUtil['stripTrailingSlash'](_0x4f2f58[_0xd8d4('0x5a')]);if(_0x5eb07f&&_0x5eb07f[_0xd8d4('0x4a')]){logger[_0xd8d4('0x18')]('['+_0x2f4145[_0xd8d4('0x62')][_0xd8d4('0x63')]()+']','Recording\x20is\x20enabled!');_0x2f4145[_0xd8d4('0x4d')]=util[_0xd8d4('0x20')](_0xd8d4('0x4e'),_0x4f2f58[_0xd8d4('0x5a')],_0x2f4145[_0xd8d4('0x4f')],md5(_0x2f4145[_0xd8d4('0x4f')]));}else{_0x2f4145[_0xd8d4('0x4d')]='';}return getConnection(_0x4f2f58)[_0xd8d4('0x26')](function(_0x8cdd90){_0x51c3d3=_0x8cdd90;return getUser(_0x4f2f58,'',_0x51c3d3);})[_0xd8d4('0x26')](function(_0x408ebf){_0x3f2c9c=_0x408ebf;logger[_0xd8d4('0x18')]('The\x20User\x20ID\x20is:',_0x3f2c9c['id']);return getEndUser(_0x4f2f58,_0x2f4145[_0xd8d4('0x52')],_0x2f4145['calleridnum'],_0x51c3d3);})[_0xd8d4('0x26')](function(_0xf248cb){_0x4f5067=_0xf248cb;logger[_0xd8d4('0x18')](_0xd8d4('0x53'),_0x4f5067['id']);return createTicket(_0x4f2f58,_0x3f2c9c,_0x4f5067,_0x14edea,_0x2f4145,_0x14edea['Fields'],_0x51c3d3);})[_0xd8d4('0x26')](function(_0x4d2761){_0x4b8987=_0x4d2761;logger[_0xd8d4('0x18')](_0xd8d4('0x64'));logger[_0xd8d4('0x18')](_0xd8d4('0x55'),_0x4b8987['id']);})[_0xd8d4('0x2b')](function(_0x3627ad){logger[_0xd8d4('0x2a')]('['+_0x2f4145['lastevent'][_0xd8d4('0x63')]()+']',JSON[_0xd8d4('0x2e')](_0x3627ad));});}; \ No newline at end of file +var _0x8bca=['variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','Descriptions','format','%s/webservice.php','remoteUri','sessionName','HelpDesk','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','username','admin','getUser','length','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','create','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','trigger:browser:url','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','toUpperCase','recordingURL','calleridname','lastevent','lodash','request-promise','bluebird','./util','../../../../config/environment','../../../../config/logger','vTiger','defaults','redis','localhost','socket.io-emitter','forEach','type','string','idField','content','toString','variable'];(function(_0x5cecad,_0x38181f){var _0x2e01fe=function(_0x3d9dd6){while(--_0x3d9dd6){_0x5cecad['push'](_0x5cecad['shift']());}};_0x2e01fe(++_0x38181f);}(_0x8bca,0x126));var _0xa8bc=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x8bca[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xa8bc('0x0'));var rp=require(_0xa8bc('0x1'));var BPromise=require(_0xa8bc('0x2'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa8bc('0x3'));var config=require(_0xa8bc('0x4'));var logger=require(_0xa8bc('0x5'))(_0xa8bc('0x6'));config['redis']=_[_0xa8bc('0x7')](config[_0xa8bc('0x8')],{'host':_0xa8bc('0x9'),'port':0x18eb});var io=require(_0xa8bc('0xa'))(new Redis(config[_0xa8bc('0x8')]));function emit(_0x269e06,_0x57ae61,_0xb03e3a){io['to'](_0x269e06)['emit'](_0x57ae61,_0xb03e3a);}function getCustomFields(_0xbc2470,_0x59a325){var _0x328f55={};if(_0xbc2470['length']>0x0){_[_0xa8bc('0xb')](_0xbc2470,function(_0xac1100){if(_0xac1100[_0xa8bc('0xc')]===_0xa8bc('0xd')&&_0xac1100['idField']){_0x328f55[_0xac1100[_0xa8bc('0xe')]]=_0xac1100[_0xa8bc('0xf')][_0xa8bc('0x10')]();}else if(_0xac1100[_0xa8bc('0xc')]===_0xa8bc('0x11')&&_0xac1100[_0xa8bc('0x12')]&&_0xac1100[_0xa8bc('0xe')]&&_0x59a325[_0xac1100[_0xa8bc('0x12')]]){_0x328f55[_0xac1100[_0xa8bc('0xe')]]=_0x59a325[_0xac1100['variableName']][_0xa8bc('0x10')]();}else if(_0xac1100[_0xa8bc('0xc')]===_0xa8bc('0x13')&&_0xac1100[_0xa8bc('0x14')]&&_0xac1100[_0xa8bc('0x14')][_0xa8bc('0x15')]&&_0xac1100[_0xa8bc('0xe')]&&_0x59a325[_0xac1100[_0xa8bc('0x14')][_0xa8bc('0x15')][_0xa8bc('0x16')]()]){_0x328f55[_0xac1100['idField']]=_0x59a325[_0xac1100[_0xa8bc('0x14')][_0xa8bc('0x15')][_0xa8bc('0x16')]()][_0xa8bc('0x10')]();}});}return _0x328f55;}function createTicket(_0x4cdbb0,_0x5be23b,_0xce8598,_0x105bf1,_0x5251ad,_0x4fbec9,_0x108811){logger[_0xa8bc('0x17')](_0xa8bc('0x18'));var _0xce75be=_[_0xa8bc('0x19')]({'parent_id':'','assigned_user_id':_0x5be23b['id'],'ticketpriorities':_0xa8bc('0x1a'),'ticketstatus':'Open','ticket_title':intUtil[_0xa8bc('0x1b')](_0x105bf1[_0xa8bc('0x1c')],_0x5251ad,'\x20'),'description':intUtil[_0xa8bc('0x1b')](_0x105bf1[_0xa8bc('0x1d')],_0x5251ad,'\x0a'),'contact_id':_0xce8598['id']},getCustomFields(_0x4fbec9,_0x5251ad));var _0x528667={'method':'POST','uri':util[_0xa8bc('0x1e')](_0xa8bc('0x1f'),_0x4cdbb0[_0xa8bc('0x20')]),'form':{'operation':'create','username':_0x4cdbb0['username'],'sessionName':_0x108811[_0xa8bc('0x21')],'elementType':_0xa8bc('0x22'),'element':JSON['stringify'](_0xce75be)},'json':!![]};return request(_0x528667)[_0xa8bc('0x23')](function(_0x2a737a){if(_0x2a737a[_0xa8bc('0x24')]){return BPromise[_0xa8bc('0x25')]({'id':_0x2a737a[_0xa8bc('0x26')]['id']});}else{throw new Error(util['format'](_0xa8bc('0x27'),JSON[_0xa8bc('0x28')](_0x2a737a['error'])));}})[_0xa8bc('0x29')](function(_0x375436){var _0x415960=_0x375436[_0xa8bc('0x2a')]||0x1f4;logger[_0xa8bc('0x2b')](_0xa8bc('0x2c'),'createTicket',_0x415960,JSON['stringify'](_0x375436));});}function getUser(_0x642ee0,_0x191115,_0x181696){if(intUtil[_0xa8bc('0x2d')](_0x191115)){logger['info']('Getting\x20agent\x20with\x20email',_0x191115);return request({'method':_0xa8bc('0x2e'),'uri':util[_0xa8bc('0x1e')](_0xa8bc('0x1f'),_0x642ee0[_0xa8bc('0x20')]),'qs':{'operation':_0xa8bc('0x2f'),'username':_0x642ee0['username'],'sessionName':_0x181696[_0xa8bc('0x21')],'query':util['format'](_0xa8bc('0x30'),_0x191115)},'json':!![]})[_0xa8bc('0x23')](function(_0x337dee){if(_0x337dee[_0xa8bc('0x24')]&&_0x337dee[_0xa8bc('0x26')]['length']){logger['info'](_0xa8bc('0x31'));return BPromise[_0xa8bc('0x25')]({'id':_0x337dee['result'][0x0]['id'],'email':_0x337dee['result'][0x0][_0xa8bc('0x32')],'name':_0x337dee['result'][0x0][_0xa8bc('0x33')]+'\x20'+_0x337dee[_0xa8bc('0x26')][_0xa8bc('0x34')]});}else{logger['info'](_0xa8bc('0x35'));return BPromise[_0xa8bc('0x25')]({'id':_0x181696[_0xa8bc('0x36')],'email':_0x642ee0[_0xa8bc('0x37')],'name':_0xa8bc('0x38')});}})['catch'](function(_0x24f2f3){var _0x190306=_0x24f2f3[_0xa8bc('0x2a')]||0x1f4;logger[_0xa8bc('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa8bc('0x39'),_0x190306,JSON['stringify'](_0x24f2f3));});}else{logger['info'](_0xa8bc('0x35'));return BPromise[_0xa8bc('0x25')]({'id':_0x181696['userId'],'email':_0x642ee0[_0xa8bc('0x37')],'name':'admin'})[_0xa8bc('0x29')](function(_0x53dbe1){var _0x2ede3a=_0x53dbe1['statusCode']||0x1f4;logger[_0xa8bc('0x2b')](_0xa8bc('0x2c'),_0xa8bc('0x39'),_0x2ede3a,JSON['stringify'](_0x53dbe1));});}}function getEndUser(_0x172231,_0x184c21,_0x4adbdd,_0x1219e6){logger[_0xa8bc('0x17')]('Searching\x20end\x20user\x20with\x20phone',_0x4adbdd);return request({'method':_0xa8bc('0x2e'),'uri':util[_0xa8bc('0x1e')]('%s/webservice.php',_0x172231[_0xa8bc('0x20')]),'qs':{'operation':_0xa8bc('0x2f'),'username':_0x172231[_0xa8bc('0x37')],'sessionName':_0x1219e6[_0xa8bc('0x21')],'query':util['format']('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;',_0x4adbdd,_0x4adbdd,_0x4adbdd,_0x4adbdd,_0x4adbdd)},'json':!![]})[_0xa8bc('0x23')](function(_0x80e439){if(_0x80e439['success']&&_0x80e439[_0xa8bc('0x26')][_0xa8bc('0x3a')]){logger[_0xa8bc('0x17')](_0xa8bc('0x3b'));return BPromise[_0xa8bc('0x25')]({'id':_0x80e439[_0xa8bc('0x26')][0x0]['id'],'name':_0x80e439[_0xa8bc('0x26')][0x0][_0xa8bc('0x3c')]+'\x20'+_0x80e439[_0xa8bc('0x26')][0x0][_0xa8bc('0x3d')],'phone':_0x4adbdd});}else{logger[_0xa8bc('0x17')](_0xa8bc('0x3e'));return request({'method':_0xa8bc('0x3f'),'uri':util[_0xa8bc('0x1e')](_0xa8bc('0x1f'),_0x172231['remoteUri']),'form':{'operation':_0xa8bc('0x40'),'sessionName':_0x1219e6[_0xa8bc('0x21')],'elementType':_0xa8bc('0x41'),'element':JSON['stringify']({'lastname':_0x184c21,'phone':_0x4adbdd,'assigned_user_id':'\x20'})},'json':!![]})[_0xa8bc('0x23')](function(_0x1044ae){logger[_0xa8bc('0x17')](_0xa8bc('0x42'));return BPromise[_0xa8bc('0x25')]({'id':_0x1044ae[_0xa8bc('0x26')]['id'],'name':_0x1044ae[_0xa8bc('0x26')][_0xa8bc('0x3d')],'phone':_0x1044ae['result'][_0xa8bc('0x43')]});})[_0xa8bc('0x29')](function(_0x382329){var _0x5071a0=_0x382329[_0xa8bc('0x2a')]||0x1f4;logger[_0xa8bc('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa8bc('0x44'),_0x5071a0,JSON[_0xa8bc('0x28')](_0x382329));});}});}function getConnection(_0x5841d5){var _0x51d7a6=_0x5841d5[_0xa8bc('0x37')];var _0x4694cb=_0x5841d5[_0xa8bc('0x45')];return request({'method':_0xa8bc('0x2e'),'uri':util[_0xa8bc('0x1e')](_0xa8bc('0x1f'),_0x5841d5[_0xa8bc('0x20')]),'qs':{'operation':_0xa8bc('0x46'),'username':_0x51d7a6},'json':!![]})[_0xa8bc('0x23')](function(_0x36c491){if(_0x36c491[_0xa8bc('0x24')]){return request({'method':'POST','uri':util['format'](_0xa8bc('0x1f'),_0x5841d5[_0xa8bc('0x20')]),'form':{'operation':_0xa8bc('0x47'),'username':_0x51d7a6,'accessKey':md5(_0x36c491['result']['token']+_0x4694cb)},'json':!![]});}})[_0xa8bc('0x23')](function(_0x1f1e36){if(_0x1f1e36[_0xa8bc('0x24')]){return BPromise[_0xa8bc('0x25')](_0x1f1e36[_0xa8bc('0x26')]);}else{throw new Error(util[_0xa8bc('0x1e')](_0xa8bc('0x48'),_0x5841d5['id']));}})[_0xa8bc('0x29')](function(_0x58429d){var _0x269922=_0x58429d[_0xa8bc('0x2a')]||0x1f4;logger['error'](_0xa8bc('0x2c'),_0xa8bc('0x49'),_0x269922,JSON[_0xa8bc('0x28')](_0x58429d));});}function request(_0x560d18){logger[_0xa8bc('0x17')](_0xa8bc('0x4a'),JSON[_0xa8bc('0x28')](_0x560d18));return rp(_0x560d18);}exports[_0xa8bc('0x4b')]=function(_0x451c71,_0x4f1612,_0x573f03,_0x9f42ff,_0x31b51b,_0x25f881){var _0xff7006,_0x3cd9db,_0x2df362,_0x17faa3;_0x25f881[_0xa8bc('0x20')]=intUtil[_0xa8bc('0x4c')](_0x25f881['remoteUri']);if(_0x31b51b&&_0x31b51b['monitor_format']){logger[_0xa8bc('0x17')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4f1612['recordingURL']=util[_0xa8bc('0x1e')](_0xa8bc('0x4d'),_0x25f881[_0xa8bc('0x4e')],_0x4f1612[_0xa8bc('0x4f')],md5(_0x4f1612[_0xa8bc('0x4f')]));}else{_0x4f1612['recordingURL']='';}return getConnection(_0x25f881)['then'](function(_0x40daf6){_0x17faa3=_0x40daf6;return getUser(_0x25f881,_0x9f42ff[_0xa8bc('0x50')],_0x17faa3);})[_0xa8bc('0x23')](function(_0x2bb7ee){_0xff7006=_0x2bb7ee;logger[_0xa8bc('0x17')]('The\x20User\x20ID\x20is:',_0xff7006['id']);return getEndUser(_0x25f881,_0x4f1612['calleridname'],_0x4f1612[_0xa8bc('0x51')],_0x17faa3);})[_0xa8bc('0x23')](function(_0x261354){_0x3cd9db=_0x261354;logger[_0xa8bc('0x17')](_0xa8bc('0x52'),_0x3cd9db['id']);return createTicket(_0x25f881,_0xff7006,_0x3cd9db,_0x573f03,_0x4f1612,_0x573f03[_0xa8bc('0x53')],_0x17faa3);})[_0xa8bc('0x23')](function(_0x2c6d15){_0x2df362=_0x2c6d15;logger[_0xa8bc('0x17')](_0xa8bc('0x54'));logger['info'](_0xa8bc('0x55'),_0x2df362['id']);var _0x4bb002=util[_0xa8bc('0x1e')](_0xa8bc('0x56'),_0x25f881[_0xa8bc('0x20')],_['split'](_0x2df362['id'],'x')[0x1]);logger[_0xa8bc('0x17')](_0xa8bc('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x9f42ff['name']),_0xa8bc('0x58'),{'uri':_0x4bb002});})['catch'](function(_0x484858){logger[_0xa8bc('0x2b')](_0xa8bc('0x57'),JSON[_0xa8bc('0x28')](_0x484858));});};exports['outbound']=function(_0xd671fc,_0x57c2d3,_0x965559,_0x5a6318,_0x274faa,_0x3be4b6,_0x2164a4){var _0x43f116,_0x453796,_0x2594ac,_0x596486;_0x3be4b6[_0xa8bc('0x20')]=intUtil[_0xa8bc('0x4c')](_0x3be4b6[_0xa8bc('0x20')]);_0x3be4b6[_0xa8bc('0x4e')]=intUtil[_0xa8bc('0x4c')](_0x3be4b6[_0xa8bc('0x4e')]);if(_0x2164a4&&_0x2164a4[_0xa8bc('0x59')]&&_0x2164a4[_0xa8bc('0x59')]!==_0xa8bc('0x5a')){logger[_0xa8bc('0x17')](_0xa8bc('0x5b'),_0xa8bc('0x5c'));_0x57c2d3['recordingURL']=util['format'](_0xa8bc('0x4d'),_0x3be4b6[_0xa8bc('0x4e')],_0x57c2d3[_0xa8bc('0x4f')],md5(_0x57c2d3['uniqueid']));}return getConnection(_0x3be4b6)[_0xa8bc('0x23')](function(_0x31be41){_0x596486=_0x31be41;return getUser(_0x3be4b6,_0x5a6318[_0xa8bc('0x50')],_0x596486);})[_0xa8bc('0x23')](function(_0xdef08){_0x43f116=_0xdef08;logger[_0xa8bc('0x17')](_0xa8bc('0x5d'),_0x43f116['id']);return getEndUser(_0x3be4b6,_0x57c2d3[_0xa8bc('0x5e')],_0x57c2d3[_0xa8bc('0x5f')],_0x596486);})[_0xa8bc('0x23')](function(_0x5970ed){_0x453796=_0x5970ed;logger[_0xa8bc('0x17')](_0xa8bc('0x52'),_0x453796['id']);return createTicket(_0x3be4b6,_0x43f116,_0x453796,_0x965559,_0x57c2d3,_0x965559[_0xa8bc('0x53')],_0x596486);})[_0xa8bc('0x23')](function(_0x132c9c){_0x2594ac=_0x132c9c;logger[_0xa8bc('0x17')](_0xa8bc('0x54'));logger[_0xa8bc('0x17')](_0xa8bc('0x55'),_0x2594ac['id']);var _0x1ab752=util[_0xa8bc('0x1e')](_0xa8bc('0x56'),_0x3be4b6[_0xa8bc('0x20')],_[_0xa8bc('0x60')](_0x2594ac['id'],'x')[0x1]);logger[_0xa8bc('0x17')](_0xa8bc('0x5b'),_0xa8bc('0x61'));emit(util[_0xa8bc('0x1e')]('user:%s',_0x5a6318[_0xa8bc('0x15')]),_0xa8bc('0x58'),{'uri':_0x1ab752});})[_0xa8bc('0x29')](function(_0x5ac693){logger['error'](_0xa8bc('0x5b'),JSON[_0xa8bc('0x28')](_0x5ac693));});};exports[_0xa8bc('0x62')]=function(_0x16ca11,_0x1943e7,_0x3b53c1,_0x51993e,_0x495495,_0x4131c1){var _0x2527b8,_0x2c91c1,_0x154fc0,_0x4d5b5e;_0x4131c1[_0xa8bc('0x20')]=intUtil[_0xa8bc('0x4c')](_0x4131c1[_0xa8bc('0x20')]);_0x4131c1[_0xa8bc('0x4e')]=intUtil[_0xa8bc('0x4c')](_0x4131c1['serverUrl']);if(_0x495495&&_0x495495[_0xa8bc('0x63')]){logger[_0xa8bc('0x17')]('['+_0x1943e7['lastevent'][_0xa8bc('0x64')]()+']',_0xa8bc('0x5c'));_0x1943e7[_0xa8bc('0x65')]=util[_0xa8bc('0x1e')](_0xa8bc('0x4d'),_0x4131c1[_0xa8bc('0x4e')],_0x1943e7['uniqueid'],md5(_0x1943e7[_0xa8bc('0x4f')]));}else{_0x1943e7[_0xa8bc('0x65')]='';}return getConnection(_0x4131c1)['then'](function(_0x2fbed6){_0x4d5b5e=_0x2fbed6;return getUser(_0x4131c1,'',_0x4d5b5e);})[_0xa8bc('0x23')](function(_0xd4cccf){_0x2527b8=_0xd4cccf;logger[_0xa8bc('0x17')](_0xa8bc('0x5d'),_0x2527b8['id']);return getEndUser(_0x4131c1,_0x1943e7[_0xa8bc('0x66')],_0x1943e7['calleridnum'],_0x4d5b5e);})[_0xa8bc('0x23')](function(_0x2882ce){_0x2c91c1=_0x2882ce;logger[_0xa8bc('0x17')](_0xa8bc('0x52'),_0x2c91c1['id']);return createTicket(_0x4131c1,_0x2527b8,_0x2c91c1,_0x3b53c1,_0x1943e7,_0x3b53c1[_0xa8bc('0x53')],_0x4d5b5e);})['then'](function(_0x57355f){_0x154fc0=_0x57355f;logger[_0xa8bc('0x17')]('Ticket\x20created!');logger[_0xa8bc('0x17')](_0xa8bc('0x55'),_0x154fc0['id']);})[_0xa8bc('0x29')](function(_0x287ec8){logger['error']('['+_0x1943e7[_0xa8bc('0x67')][_0xa8bc('0x64')]()+']',JSON[_0xa8bc('0x28')](_0x287ec8));});}; \ 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 5e92da8..78a19b6 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 _0x80df=['stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','Tags','getString','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','type','nameField','toLowerCase','content','string','customField','custom_fields','push','variable','variableName','idField','customVariable','Variable','name','queue'];(function(_0x1e2475,_0x52fbdc){var _0x23afde=function(_0x10f3d7){while(--_0x10f3d7){_0x1e2475['push'](_0x1e2475['shift']());}};_0x23afde(++_0x52fbdc);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf80d('0x0'));var rp=require(_0xf80d('0x1'));var md5=require(_0xf80d('0x2'));var util=require(_0xf80d('0x3'));var Redis=require('ioredis');var intUtil=require(_0xf80d('0x4'));var config=require(_0xf80d('0x5'));var logger=require(_0xf80d('0x6'))(_0xf80d('0x7'));config[_0xf80d('0x8')]=_[_0xf80d('0x9')](config[_0xf80d('0x8')],{'host':_0xf80d('0xa'),'port':0x18eb});var io=require(_0xf80d('0xb'))(new Redis(config[_0xf80d('0x8')]));function emit(_0x5068d4,_0x30e2b3,_0x16b219){io['to'](_0x5068d4)[_0xf80d('0xc')](_0x30e2b3,_0x16b219);}var headers={'Content-Type':_0xf80d('0xd'),'Accept':_0xf80d('0xd')};function getTicket(_0x186339,_0x41595f,_0x45d290,_0x2fddc2,_0x2ef5d1){logger[_0xf80d('0xe')](_0xf80d('0xf'));return request({'uri':util[_0xf80d('0x10')](_0xf80d('0x11'),_0x186339['remoteUri']),'method':'POST','body':{'ticket':_[_0xf80d('0x12')]({'requester_id':_0x45d290['id'],'submitter_id':_0x41595f?_0x41595f['id']:undefined,'assignee_id':_0x41595f?_0x41595f['id']:undefined,'tags':getTags(_0x2fddc2[_0xf80d('0x13')],'name'),'subject':intUtil[_0xf80d('0x14')](_0x2fddc2['Subjects'],_0x2ef5d1,'\x20'),'description':intUtil[_0xf80d('0x14')](_0x2fddc2['Descriptions'],_0x2ef5d1,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf80d('0x14')](_0x2fddc2['Descriptions'],_0x2ef5d1,'\x0a')}},getCustomFields(_0x2fddc2[_0xf80d('0x15')],_0x2ef5d1))}})[_0xf80d('0x16')](function(_0x369609){logger[_0xf80d('0xe')](_0xf80d('0x17'));return _0x369609[_0xf80d('0x18')];});}function getUser(_0x482043,_0x27f3a2){if(intUtil[_0xf80d('0x19')](_0x27f3a2)){logger[_0xf80d('0xe')](_0xf80d('0x1a'),_0x27f3a2);return request({'uri':util[_0xf80d('0x10')](_0xf80d('0x1b'),_0x482043[_0xf80d('0x1c')]),'qs':{'query':util[_0xf80d('0x10')](_0xf80d('0x1d'),_0x27f3a2)}})[_0xf80d('0x16')](function(_0x124174){if(_0x124174[_0xf80d('0x1e')]){logger['info'](_0xf80d('0x1f'));return _[_0xf80d('0x20')](_0x124174['results'],{'email':_0x27f3a2,'role':_0xf80d('0x21')});}else{logger['info'](_0xf80d('0x22'));return request({'uri':util[_0xf80d('0x10')](_0xf80d('0x23'),_0x482043[_0xf80d('0x1c')])})[_0xf80d('0x16')](function(_0x25d031){logger[_0xf80d('0xe')](_0xf80d('0x24'));return _0x25d031[_0xf80d('0x25')];});}});}else{logger[_0xf80d('0xe')](_0xf80d('0x22'));return request({'uri':util[_0xf80d('0x10')]('%s/users/me.json',_0x482043[_0xf80d('0x1c')])})[_0xf80d('0x16')](function(_0x5906fa){logger[_0xf80d('0xe')](_0xf80d('0x24'));return _0x5906fa[_0xf80d('0x25')];});}}function getEndUser(_0x947bb,_0x4986ad,_0x79142a){logger[_0xf80d('0xe')](_0xf80d('0x26'),_0x79142a);return request({'uri':util[_0xf80d('0x10')](_0xf80d('0x1b'),_0x947bb[_0xf80d('0x1c')]),'qs':{'query':util[_0xf80d('0x10')](_0xf80d('0x27'),_0x79142a)}})[_0xf80d('0x16')](function(_0x4d2579){var _0xe940d6;if(_0x4d2579[_0xf80d('0x28')][_0xf80d('0x29')]){_0x4d2579[_0xf80d('0x28')]=_[_0xf80d('0x2a')](_0x4d2579[_0xf80d('0x28')],{'suspended':![],'role':_0xf80d('0x2b')});if(_0x4d2579['results'][_0xf80d('0x29')]){_0xe940d6=_[_0xf80d('0x2c')](_0x4d2579[_0xf80d('0x28')]);}}if(_0xe940d6){logger[_0xf80d('0xe')]('Enduser\x20found!');return _0xe940d6;}else{logger['info'](_0xf80d('0x2d'));return request({'uri':util['format'](_0xf80d('0x2e'),_0x947bb[_0xf80d('0x1c')]),'method':_0xf80d('0x2f'),'body':{'user':{'role':'end-user','name':util[_0xf80d('0x10')](_0xf80d('0x30'),_0x4986ad||_0x79142a),'phone':_0x79142a}}})['then'](function(_0x2c36a5){logger[_0xf80d('0xe')](_0xf80d('0x31'));return _0x2c36a5['user'];});}});}function getAuth(_0x1d9769){var _0x9f700b;if(_0x1d9769[_0xf80d('0x32')]===_0xf80d('0x33')){_0x9f700b=util[_0xf80d('0x10')]('%s:%s',_0x1d9769[_0xf80d('0x34')],_0x1d9769['password']);}else if(_0x1d9769[_0xf80d('0x32')]===_0xf80d('0x35')){_0x9f700b=util[_0xf80d('0x10')](_0xf80d('0x36'),_0x1d9769['username'],_0x1d9769[_0xf80d('0x35')]);}return util[_0xf80d('0x10')](_0xf80d('0x37'),new Buffer(_0x9f700b)[_0xf80d('0x38')]('base64'));}function request(_0x1d4103){logger[_0xf80d('0x39')](_0xf80d('0x3a'),JSON[_0xf80d('0x3b')](_0x1d4103));return rp(_[_0xf80d('0x9')](_0x1d4103,{'method':_0xf80d('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x35039f,_0x45765a){var _0x503b42=[];if(_0x35039f&&_0x35039f[_0xf80d('0x29')]>0x0){_0x503b42=_[_0xf80d('0x3d')](_0x35039f,_0x45765a);}return _0x503b42;}function getCustomFields(_0x2e9e12,_0x4b0cdb){var _0x1ed344=[];var _0x47cd14={'custom_fields':[]};if(_0x2e9e12[_0xf80d('0x29')]>0x0){_[_0xf80d('0x3e')](_0x2e9e12,function(_0x13435c){if(_0x13435c[_0xf80d('0x3f')]==='string'&&_0x13435c['nameField']&&!_0x13435c['customField']){_0x47cd14[_0x13435c[_0xf80d('0x40')][_0xf80d('0x41')]()]=_0x13435c[_0xf80d('0x42')][_0xf80d('0x38')]();}else if(_0x13435c[_0xf80d('0x3f')]===_0xf80d('0x43')&&_0x13435c['idField']&&_0x13435c[_0xf80d('0x44')]){_0x47cd14[_0xf80d('0x45')][_0xf80d('0x46')]({'id':_0x13435c['idField'],'value':_0x13435c[_0xf80d('0x42')]['toString']()});}else if(_0x13435c[_0xf80d('0x3f')]===_0xf80d('0x47')&&_0x13435c[_0xf80d('0x48')]&&_0x13435c[_0xf80d('0x49')]&&_0x13435c[_0xf80d('0x44')]){_0x4b0cdb[_0x13435c[_0xf80d('0x48')]]&&_0x47cd14[_0xf80d('0x45')][_0xf80d('0x46')]({'id':_0x13435c[_0xf80d('0x49')],'value':_0x4b0cdb[_0x13435c[_0xf80d('0x48')]][_0xf80d('0x38')]()});}else if(_0x13435c[_0xf80d('0x3f')]===_0xf80d('0x4a')&&_0x13435c[_0xf80d('0x4b')]&&_0x13435c[_0xf80d('0x4b')][_0xf80d('0x4c')]&&_0x13435c[_0xf80d('0x49')]&&_0x13435c[_0xf80d('0x44')]){_0x4b0cdb[_0x13435c[_0xf80d('0x4b')][_0xf80d('0x4c')][_0xf80d('0x41')]()]&&_0x47cd14[_0xf80d('0x45')][_0xf80d('0x46')]({'id':_0x13435c[_0xf80d('0x49')],'value':_0x4b0cdb[_0x13435c[_0xf80d('0x4b')]['name'][_0xf80d('0x41')]()][_0xf80d('0x38')]()});}});}return _0x47cd14;}exports[_0xf80d('0x4d')]=function(_0x40d5ec,_0x2fbbe5,_0x558c24,_0x1bacb3,_0x26a848,_0x2b84f1){var _0x1819ae,_0x1a5b95;_0x2b84f1[_0xf80d('0x1c')]=intUtil[_0xf80d('0x4e')](_0x2b84f1[_0xf80d('0x1c')]);_0x2b84f1[_0xf80d('0x4f')]=intUtil[_0xf80d('0x4e')](_0x2b84f1[_0xf80d('0x4f')]);if(_0x26a848&&_0x26a848[_0xf80d('0x50')]){logger[_0xf80d('0xe')](_0xf80d('0x51'),_0xf80d('0x52'));_0x2fbbe5[_0xf80d('0x53')]=util[_0xf80d('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b84f1[_0xf80d('0x4f')],_0x2fbbe5[_0xf80d('0x54')],md5(_0x2fbbe5[_0xf80d('0x54')]));}else{_0x2fbbe5['recordingURL']='';}headers[_0xf80d('0x55')]=getAuth(_0x2b84f1);return getUser(_0x2b84f1,_0x1bacb3[_0xf80d('0x56')])['then'](function(_0x57673b){_0x1819ae=_0x57673b;logger[_0xf80d('0xe')]('The\x20User\x20ID\x20is:',_0x1819ae['id']);return getEndUser(_0x2b84f1,_0x2fbbe5[_0xf80d('0x57')],_0x2fbbe5[_0xf80d('0x58')]);})[_0xf80d('0x16')](function(_0x26fcee){_0x1a5b95=_0x26fcee;logger[_0xf80d('0xe')](_0xf80d('0x59'),_0x1a5b95['id']);return getTicket(_0x2b84f1,_0x1819ae,_0x1a5b95,_0x558c24,_0x2fbbe5);})[_0xf80d('0x16')](function(_0x114132){if(_0x114132){logger[_0xf80d('0xe')](_0xf80d('0x5a'),_0x114132['id']);switch(_0x2b84f1[_0xf80d('0x3f')]){case _0xf80d('0x5b'):logger['info'](_0xf80d('0x51'),_0xf80d('0x5c'));return request({'uri':util[_0xf80d('0x10')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2b84f1[_0xf80d('0x1c')],_0x1819ae['id'],_0x114132['id']),'method':_0xf80d('0x2f')});case'newTab':logger[_0xf80d('0xe')](_0xf80d('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf80d('0x10')](_0xf80d('0x5d'),_0x1bacb3[_0xf80d('0x4c')]),_0xf80d('0x5e'),{'uri':util['format'](_0xf80d('0x5f'),_0x2b84f1[_0xf80d('0x1c')],_0x114132['id'])});break;default:logger[_0xf80d('0x60')]('[QUEUE]',_0xf80d('0x61'));}}})[_0xf80d('0x62')](function(_0x31796f){logger[_0xf80d('0x60')](_0xf80d('0x63'),util[_0xf80d('0x64')](_0x31796f,{'showHidden':!![],'depth':null}));});};exports[_0xf80d('0x65')]=function(_0x31ecdc,_0x6d0b18,_0x22b2e9,_0x543dba,_0x112342,_0x15aa20,_0x4501f4){var _0x32c02e,_0x5cec7c;_0x15aa20['remoteUri']=intUtil[_0xf80d('0x4e')](_0x15aa20[_0xf80d('0x1c')]);_0x15aa20['serverUrl']=intUtil[_0xf80d('0x4e')](_0x15aa20[_0xf80d('0x4f')]);if(_0x4501f4&&_0x4501f4[_0xf80d('0x66')]&&_0x4501f4[_0xf80d('0x66')]!=='none'){logger[_0xf80d('0xe')]('[OUTBOUND]',_0xf80d('0x52'));_0x6d0b18[_0xf80d('0x53')]=util[_0xf80d('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x15aa20['serverUrl'],_0x6d0b18[_0xf80d('0x54')],md5(_0x6d0b18[_0xf80d('0x54')]));}headers['Authorization']=getAuth(_0x15aa20);return getUser(_0x15aa20,_0x543dba['email'])[_0xf80d('0x16')](function(_0x3fe270){_0x32c02e=_0x3fe270;logger[_0xf80d('0xe')](_0xf80d('0x67'),_0x32c02e['id']);return getEndUser(_0x15aa20,_0x6d0b18[_0xf80d('0x68')],_0x6d0b18[_0xf80d('0x69')]);})[_0xf80d('0x16')](function(_0xd65617){_0x5cec7c=_0xd65617;logger['info'](_0xf80d('0x59'),_0x5cec7c['id']);return getTicket(_0x15aa20,_0x32c02e,_0x5cec7c,_0x22b2e9,_0x6d0b18);})[_0xf80d('0x16')](function(_0x246d1d){if(_0x246d1d){logger['info'](_0xf80d('0x5a'),_0x246d1d['id']);switch(_0x15aa20[_0xf80d('0x3f')]){case'integrationTab':logger[_0xf80d('0xe')](_0xf80d('0x6a'),_0xf80d('0x5c'));return request({'uri':util['format'](_0xf80d('0x6b'),_0x15aa20[_0xf80d('0x1c')],_0x32c02e['id'],_0x246d1d['id']),'method':_0xf80d('0x2f')});case'newTab':logger['info'](_0xf80d('0x6a'),_0xf80d('0x6c'));emit(util['format'](_0xf80d('0x5d'),_0x543dba['name']),_0xf80d('0x5e'),{'uri':util[_0xf80d('0x10')](_0xf80d('0x5f'),_0x15aa20['remoteUri'],_0x246d1d['id'])});break;default:logger[_0xf80d('0x60')](_0xf80d('0x6a'),_0xf80d('0x61'));}}})[_0xf80d('0x62')](function(_0x24c608){logger[_0xf80d('0x60')](_0xf80d('0x6d'),util[_0xf80d('0x64')](_0x24c608,{'showHidden':!![],'depth':null}));});};exports[_0xf80d('0x6e')]=function(_0x3a810f,_0x3bd5dd,_0x44709f,_0x532be4,_0x12f3a5,_0x1eb3e2){var _0x2ee191,_0x5e14f4;_0x1eb3e2[_0xf80d('0x1c')]=intUtil[_0xf80d('0x4e')](_0x1eb3e2['remoteUri']);_0x1eb3e2['serverUrl']=intUtil[_0xf80d('0x4e')](_0x1eb3e2[_0xf80d('0x4f')]);if(_0x12f3a5&&_0x12f3a5['monitor_format']){logger[_0xf80d('0xe')]('['+_0x3bd5dd[_0xf80d('0x6f')][_0xf80d('0x70')]()+']','Recording\x20is\x20enabled!');_0x3bd5dd['recordingURL']=util[_0xf80d('0x10')](_0xf80d('0x71'),_0x1eb3e2[_0xf80d('0x4f')],_0x3bd5dd[_0xf80d('0x54')],md5(_0x3bd5dd[_0xf80d('0x54')]));}else{_0x3bd5dd['recordingURL']='';}headers[_0xf80d('0x55')]=getAuth(_0x1eb3e2);return getUser(_0x1eb3e2)[_0xf80d('0x16')](function(_0x5bcbd9){_0x2ee191=_0x5bcbd9;logger[_0xf80d('0xe')](_0xf80d('0x67'),_0x2ee191['id']);return getEndUser(_0x1eb3e2,_0x3bd5dd[_0xf80d('0x57')],_0x3bd5dd[_0xf80d('0x58')]);})['then'](function(_0x38b552){_0x5e14f4=_0x38b552;logger[_0xf80d('0xe')](_0xf80d('0x59'),_0x5e14f4['id']);return getTicket(_0x1eb3e2,_0x2ee191,_0x5e14f4,_0x44709f,_0x3bd5dd);})[_0xf80d('0x16')](function(_0x297266){if(_0x297266){logger[_0xf80d('0xe')](_0xf80d('0x5a'),_0x297266['id']);}})[_0xf80d('0x62')](function(_0xcf78b){logger[_0xf80d('0x60')]('['+_0x3bd5dd[_0xf80d('0x6f')][_0xf80d('0x70')]()+']'+_0xf80d('0x72'),util[_0xf80d('0x64')](_0xcf78b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6ae2=['Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','authType','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','type','string','toLowerCase','content','customField','custom_fields','push','idField','variableName','customVariable'];(function(_0x3e978c,_0x1d5774){var _0x295585=function(_0x309460){while(--_0x309460){_0x3e978c['push'](_0x3e978c['shift']());}};_0x295585(++_0x1d5774);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x198a60,_0x33fca7){_0x198a60=_0x198a60-0x0;var _0x45dfa8=_0x6ae2[_0x198a60];return _0x45dfa8;};'use strict';var _=require(_0x26ae('0x0'));var rp=require(_0x26ae('0x1'));var md5=require(_0x26ae('0x2'));var util=require(_0x26ae('0x3'));var Redis=require(_0x26ae('0x4'));var intUtil=require(_0x26ae('0x5'));var config=require(_0x26ae('0x6'));var logger=require(_0x26ae('0x7'))(_0x26ae('0x8'));config['redis']=_[_0x26ae('0x9')](config[_0x26ae('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x26ae('0xa')]));function emit(_0xde4226,_0x473907,_0x151de3){io['to'](_0xde4226)[_0x26ae('0xb')](_0x473907,_0x151de3);}var headers={'Content-Type':_0x26ae('0xc'),'Accept':_0x26ae('0xc')};function getTicket(_0x4b3eca,_0x3d165a,_0x18baac,_0x1f8dff,_0x4061ad){logger['info'](_0x26ae('0xd'));return request({'uri':util['format'](_0x26ae('0xe'),_0x4b3eca['remoteUri']),'method':'POST','body':{'ticket':_[_0x26ae('0xf')]({'requester_id':_0x18baac['id'],'submitter_id':_0x3d165a?_0x3d165a['id']:undefined,'assignee_id':_0x3d165a?_0x3d165a['id']:undefined,'tags':getTags(_0x1f8dff[_0x26ae('0x10')],_0x26ae('0x11')),'subject':intUtil[_0x26ae('0x12')](_0x1f8dff[_0x26ae('0x13')],_0x4061ad,'\x20'),'description':intUtil[_0x26ae('0x12')](_0x1f8dff[_0x26ae('0x14')],_0x4061ad,'\x0a'),'comment':{'public':![],'body':intUtil[_0x26ae('0x12')](_0x1f8dff[_0x26ae('0x14')],_0x4061ad,'\x0a')}},getCustomFields(_0x1f8dff[_0x26ae('0x15')],_0x4061ad))}})[_0x26ae('0x16')](function(_0xe264da){logger['info'](_0x26ae('0x17'));return _0xe264da[_0x26ae('0x18')];});}function getUser(_0x497974,_0x444397){if(intUtil[_0x26ae('0x19')](_0x444397)){logger[_0x26ae('0x1a')](_0x26ae('0x1b'),_0x444397);return request({'uri':util[_0x26ae('0x1c')](_0x26ae('0x1d'),_0x497974[_0x26ae('0x1e')]),'qs':{'query':util[_0x26ae('0x1c')](_0x26ae('0x1f'),_0x444397)}})[_0x26ae('0x16')](function(_0x1e5cf5){if(_0x1e5cf5[_0x26ae('0x20')]){logger[_0x26ae('0x1a')](_0x26ae('0x21'));return _[_0x26ae('0x22')](_0x1e5cf5[_0x26ae('0x23')],{'email':_0x444397,'role':_0x26ae('0x24')});}else{logger[_0x26ae('0x1a')](_0x26ae('0x25'));return request({'uri':util[_0x26ae('0x1c')](_0x26ae('0x26'),_0x497974['remoteUri'])})['then'](function(_0x2a2ba5){logger['info'](_0x26ae('0x27'));return _0x2a2ba5['user'];});}});}else{logger[_0x26ae('0x1a')](_0x26ae('0x25'));return request({'uri':util[_0x26ae('0x1c')]('%s/users/me.json',_0x497974['remoteUri'])})[_0x26ae('0x16')](function(_0x377a09){logger[_0x26ae('0x1a')]('Admin\x20account\x20selected.');return _0x377a09[_0x26ae('0x28')];});}}function getEndUser(_0x295cc2,_0x53e0da,_0x1a0a32){logger[_0x26ae('0x1a')](_0x26ae('0x29'),_0x1a0a32);return request({'uri':util['format'](_0x26ae('0x1d'),_0x295cc2['remoteUri']),'qs':{'query':util[_0x26ae('0x1c')](_0x26ae('0x2a'),_0x1a0a32)}})[_0x26ae('0x16')](function(_0x4cef91){var _0x29eeb4;if(_0x4cef91['results']['length']){_0x4cef91[_0x26ae('0x23')]=_[_0x26ae('0x2b')](_0x4cef91['results'],{'suspended':![],'role':_0x26ae('0x2c')});if(_0x4cef91[_0x26ae('0x23')][_0x26ae('0x2d')]){_0x29eeb4=_[_0x26ae('0x2e')](_0x4cef91[_0x26ae('0x23')]);}}if(_0x29eeb4){logger['info'](_0x26ae('0x2f'));return _0x29eeb4;}else{logger[_0x26ae('0x1a')](_0x26ae('0x30'));return request({'uri':util[_0x26ae('0x1c')](_0x26ae('0x31'),_0x295cc2['remoteUri']),'method':_0x26ae('0x32'),'body':{'user':{'role':_0x26ae('0x2c'),'name':util[_0x26ae('0x1c')](_0x26ae('0x33'),_0x53e0da||_0x1a0a32),'phone':_0x1a0a32}}})[_0x26ae('0x16')](function(_0x298df4){logger[_0x26ae('0x1a')](_0x26ae('0x34'));return _0x298df4['user'];});}});}function getAuth(_0x170dd4){var _0x543044;if(_0x170dd4['authType']===_0x26ae('0x35')){_0x543044=util[_0x26ae('0x1c')](_0x26ae('0x36'),_0x170dd4['username'],_0x170dd4[_0x26ae('0x35')]);}else if(_0x170dd4[_0x26ae('0x37')]===_0x26ae('0x38')){_0x543044=util[_0x26ae('0x1c')](_0x26ae('0x39'),_0x170dd4[_0x26ae('0x3a')],_0x170dd4[_0x26ae('0x38')]);}return util[_0x26ae('0x1c')](_0x26ae('0x3b'),new Buffer(_0x543044)[_0x26ae('0x3c')](_0x26ae('0x3d')));}function request(_0x778a7a){logger[_0x26ae('0x3e')](_0x26ae('0x3f'),JSON['stringify'](_0x778a7a));return rp(_[_0x26ae('0x9')](_0x778a7a,{'method':_0x26ae('0x40'),'headers':headers,'json':!![]}));}function getTags(_0x2e5d70,_0x484dec){var _0x20c60a=[];if(_0x2e5d70&&_0x2e5d70[_0x26ae('0x2d')]>0x0){_0x20c60a=_[_0x26ae('0x41')](_0x2e5d70,_0x484dec);}return _0x20c60a;}function getCustomFields(_0x40c3df,_0xf4a40f){var _0x4e3f44=[];var _0x3d4e10={'custom_fields':[]};if(_0x40c3df[_0x26ae('0x2d')]>0x0){_[_0x26ae('0x42')](_0x40c3df,function(_0x2ef6f4){if(_0x2ef6f4[_0x26ae('0x43')]===_0x26ae('0x44')&&_0x2ef6f4['nameField']&&!_0x2ef6f4['customField']){_0x3d4e10[_0x2ef6f4['nameField'][_0x26ae('0x45')]()]=_0x2ef6f4[_0x26ae('0x46')][_0x26ae('0x3c')]();}else if(_0x2ef6f4[_0x26ae('0x43')]===_0x26ae('0x44')&&_0x2ef6f4['idField']&&_0x2ef6f4[_0x26ae('0x47')]){_0x3d4e10[_0x26ae('0x48')][_0x26ae('0x49')]({'id':_0x2ef6f4[_0x26ae('0x4a')],'value':_0x2ef6f4[_0x26ae('0x46')][_0x26ae('0x3c')]()});}else if(_0x2ef6f4[_0x26ae('0x43')]==='variable'&&_0x2ef6f4[_0x26ae('0x4b')]&&_0x2ef6f4[_0x26ae('0x4a')]&&_0x2ef6f4['customField']){_0xf4a40f[_0x2ef6f4[_0x26ae('0x4b')]]&&_0x3d4e10['custom_fields'][_0x26ae('0x49')]({'id':_0x2ef6f4[_0x26ae('0x4a')],'value':_0xf4a40f[_0x2ef6f4[_0x26ae('0x4b')]]['toString']()});}else if(_0x2ef6f4[_0x26ae('0x43')]===_0x26ae('0x4c')&&_0x2ef6f4[_0x26ae('0x4d')]&&_0x2ef6f4[_0x26ae('0x4d')][_0x26ae('0x11')]&&_0x2ef6f4[_0x26ae('0x4a')]&&_0x2ef6f4['customField']){_0xf4a40f[_0x2ef6f4['Variable']['name'][_0x26ae('0x45')]()]&&_0x3d4e10[_0x26ae('0x48')][_0x26ae('0x49')]({'id':_0x2ef6f4[_0x26ae('0x4a')],'value':_0xf4a40f[_0x2ef6f4[_0x26ae('0x4d')]['name']['toLowerCase']()][_0x26ae('0x3c')]()});}});}return _0x3d4e10;}exports[_0x26ae('0x4e')]=function(_0x686879,_0x4d0093,_0x434396,_0x50317d,_0xcbc76e,_0x42d40b){var _0x53f9d1,_0x507d42;_0x42d40b[_0x26ae('0x1e')]=intUtil['stripTrailingSlash'](_0x42d40b[_0x26ae('0x1e')]);_0x42d40b[_0x26ae('0x4f')]=intUtil[_0x26ae('0x50')](_0x42d40b[_0x26ae('0x4f')]);if(_0xcbc76e&&_0xcbc76e[_0x26ae('0x51')]){logger[_0x26ae('0x1a')](_0x26ae('0x52'),_0x26ae('0x53'));_0x4d0093[_0x26ae('0x54')]=util[_0x26ae('0x1c')](_0x26ae('0x55'),_0x42d40b['serverUrl'],_0x4d0093[_0x26ae('0x56')],md5(_0x4d0093[_0x26ae('0x56')]));}else{_0x4d0093[_0x26ae('0x54')]='';}headers[_0x26ae('0x57')]=getAuth(_0x42d40b);return getUser(_0x42d40b,_0x50317d[_0x26ae('0x58')])[_0x26ae('0x16')](function(_0x2af049){_0x53f9d1=_0x2af049;logger[_0x26ae('0x1a')](_0x26ae('0x59'),_0x53f9d1['id']);return getEndUser(_0x42d40b,_0x4d0093[_0x26ae('0x5a')],_0x4d0093[_0x26ae('0x5b')]);})[_0x26ae('0x16')](function(_0x2790de){_0x507d42=_0x2790de;logger['info'](_0x26ae('0x5c'),_0x507d42['id']);return getTicket(_0x42d40b,_0x53f9d1,_0x507d42,_0x434396,_0x4d0093);})['then'](function(_0x3dd581){if(_0x3dd581){logger[_0x26ae('0x1a')](_0x26ae('0x5d'),_0x3dd581['id']);switch(_0x42d40b[_0x26ae('0x43')]){case _0x26ae('0x5e'):logger[_0x26ae('0x1a')]('[QUEUE]',_0x26ae('0x5f'));return request({'uri':util['format'](_0x26ae('0x60'),_0x42d40b['remoteUri'],_0x53f9d1['id'],_0x3dd581['id']),'method':_0x26ae('0x32')});case _0x26ae('0x61'):logger['info'](_0x26ae('0x52'),_0x26ae('0x62'));emit(util[_0x26ae('0x1c')](_0x26ae('0x63'),_0x50317d[_0x26ae('0x11')]),'trigger:browser:url',{'uri':util['format'](_0x26ae('0x64'),_0x42d40b[_0x26ae('0x1e')],_0x3dd581['id'])});break;default:logger['error'](_0x26ae('0x52'),_0x26ae('0x65'));}}})[_0x26ae('0x66')](function(_0x51b9ec){logger[_0x26ae('0x67')](_0x26ae('0x68'),util[_0x26ae('0x69')](_0x51b9ec,{'showHidden':!![],'depth':null}));});};exports[_0x26ae('0x6a')]=function(_0x1c47e9,_0xe4f3a3,_0x162d68,_0x2312e4,_0x3ca5a1,_0x4302a6,_0x3e4506){var _0x441a74,_0x38815a;_0x4302a6[_0x26ae('0x1e')]=intUtil[_0x26ae('0x50')](_0x4302a6[_0x26ae('0x1e')]);_0x4302a6[_0x26ae('0x4f')]=intUtil[_0x26ae('0x50')](_0x4302a6[_0x26ae('0x4f')]);if(_0x3e4506&&_0x3e4506[_0x26ae('0x6b')]&&_0x3e4506['recordingFormat']!=='none'){logger[_0x26ae('0x1a')](_0x26ae('0x6c'),_0x26ae('0x53'));_0xe4f3a3['recordingURL']=util[_0x26ae('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4302a6[_0x26ae('0x4f')],_0xe4f3a3[_0x26ae('0x56')],md5(_0xe4f3a3['uniqueid']));}headers[_0x26ae('0x57')]=getAuth(_0x4302a6);return getUser(_0x4302a6,_0x2312e4[_0x26ae('0x58')])[_0x26ae('0x16')](function(_0x2cfd47){_0x441a74=_0x2cfd47;logger[_0x26ae('0x1a')](_0x26ae('0x59'),_0x441a74['id']);return getEndUser(_0x4302a6,_0xe4f3a3[_0x26ae('0x6d')],_0xe4f3a3[_0x26ae('0x6e')]);})[_0x26ae('0x16')](function(_0x4c183a){_0x38815a=_0x4c183a;logger[_0x26ae('0x1a')](_0x26ae('0x5c'),_0x38815a['id']);return getTicket(_0x4302a6,_0x441a74,_0x38815a,_0x162d68,_0xe4f3a3);})[_0x26ae('0x16')](function(_0x1a99a2){if(_0x1a99a2){logger[_0x26ae('0x1a')]('The\x20Ticket\x20ID\x20is:',_0x1a99a2['id']);switch(_0x4302a6[_0x26ae('0x43')]){case'integrationTab':logger[_0x26ae('0x1a')]('[OUTBOUND]',_0x26ae('0x5f'));return request({'uri':util[_0x26ae('0x1c')](_0x26ae('0x60'),_0x4302a6[_0x26ae('0x1e')],_0x441a74['id'],_0x1a99a2['id']),'method':_0x26ae('0x32')});case'newTab':logger['info'](_0x26ae('0x6c'),_0x26ae('0x62'));emit(util[_0x26ae('0x1c')]('user:%s',_0x2312e4['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x4302a6[_0x26ae('0x1e')],_0x1a99a2['id'])});break;default:logger['error'](_0x26ae('0x6c'),_0x26ae('0x65'));}}})['catch'](function(_0x285db3){logger[_0x26ae('0x67')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x26ae('0x69')](_0x285db3,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3f071f,_0x27e66f,_0xea38b5,_0x3990c3,_0x475376,_0x1d890c){var _0x2dea1f,_0x2d3685;_0x1d890c[_0x26ae('0x1e')]=intUtil['stripTrailingSlash'](_0x1d890c['remoteUri']);_0x1d890c[_0x26ae('0x4f')]=intUtil[_0x26ae('0x50')](_0x1d890c[_0x26ae('0x4f')]);if(_0x475376&&_0x475376[_0x26ae('0x51')]){logger[_0x26ae('0x1a')]('['+_0x27e66f[_0x26ae('0x6f')][_0x26ae('0x70')]()+']',_0x26ae('0x53'));_0x27e66f[_0x26ae('0x54')]=util[_0x26ae('0x1c')](_0x26ae('0x55'),_0x1d890c['serverUrl'],_0x27e66f['uniqueid'],md5(_0x27e66f['uniqueid']));}else{_0x27e66f[_0x26ae('0x54')]='';}headers[_0x26ae('0x57')]=getAuth(_0x1d890c);return getUser(_0x1d890c)['then'](function(_0x5ab688){_0x2dea1f=_0x5ab688;logger['info']('The\x20User\x20ID\x20is:',_0x2dea1f['id']);return getEndUser(_0x1d890c,_0x27e66f[_0x26ae('0x5a')],_0x27e66f[_0x26ae('0x5b')]);})['then'](function(_0x4ec8e7){_0x2d3685=_0x4ec8e7;logger[_0x26ae('0x1a')](_0x26ae('0x5c'),_0x2d3685['id']);return getTicket(_0x1d890c,_0x2dea1f,_0x2d3685,_0xea38b5,_0x27e66f);})[_0x26ae('0x16')](function(_0x33be99){if(_0x33be99){logger[_0x26ae('0x1a')](_0x26ae('0x5d'),_0x33be99['id']);}})[_0x26ae('0x66')](function(_0x479647){logger[_0x26ae('0x67')]('['+_0x27e66f[_0x26ae('0x6f')]['toUpperCase']()+']'+_0x26ae('0x71'),util[_0x26ae('0x69')](_0x479647,{'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 19230b6..72a9a52 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 _0xb2af=['answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridname','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','toUpperCase','com','calleridnum','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isBefore','expires_in','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','/oauth/v2/token','refreshToken','clientSecret','refresh_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','isNil','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Descriptions','Full_Name','First_Name','Last_Name','talktime','Call_Duration','utc'];(function(_0x48b99d,_0x487222){var _0x41b88c=function(_0x33869e){while(--_0x33869e){_0x48b99d['push'](_0x48b99d['shift']());}};_0x41b88c(++_0x487222);}(_0xb2af,0xd2));var _0xfb2a=function(_0x606e37,_0x393926){_0x606e37=_0x606e37-0x0;var _0x59a939=_0xb2af[_0x606e37];return _0x59a939;};'use strict';var _=require(_0xfb2a('0x0'));var rp=require(_0xfb2a('0x1'));var md5=require(_0xfb2a('0x2'));var util=require(_0xfb2a('0x3'));var intUtil=require('./util');var moment=require(_0xfb2a('0x4'));var Redis=require(_0xfb2a('0x5'));var BPromise=require(_0xfb2a('0x6'));var config=require(_0xfb2a('0x7'));var logger=require(_0xfb2a('0x8'))('zoho');config[_0xfb2a('0x9')]=_[_0xfb2a('0xa')](config[_0xfb2a('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xfb2a('0xb'))(new Redis(config[_0xfb2a('0x9')]));function emit(_0x1f3315,_0x55bb4e,_0x2c529e){io['to'](_0x1f3315)[_0xfb2a('0xc')](_0x55bb4e,_0x2c529e);}function request(_0x3d3333){logger[_0xfb2a('0xd')](_0xfb2a('0xe'),JSON[_0xfb2a('0xf')](_0x3d3333));return rp(_0x3d3333);}function getCustomFields(_0x2f4f0e,_0x3cf887){var _0x4712f5={};if(_0x2f4f0e[_0xfb2a('0x10')]>0x0){_[_0xfb2a('0x11')](_0x2f4f0e,function(_0x383645){if(_0x383645['type']==='string'&&_0x383645['idField']){_0x4712f5[_0x383645[_0xfb2a('0x12')]]=_0x383645[_0xfb2a('0x13')][_0xfb2a('0x14')]();}else if(_0x383645[_0xfb2a('0x15')]==='variable'&&_0x383645[_0xfb2a('0x16')]&&_0x383645['idField']&&_0x3cf887[_0x383645['variableName']]){_0x4712f5[_0x383645[_0xfb2a('0x12')]]=_0x3cf887[_0x383645['variableName']]['toString']();}else if(_0x383645[_0xfb2a('0x15')]===_0xfb2a('0x17')&&_0x383645[_0xfb2a('0x18')]&&_0x383645[_0xfb2a('0x18')][_0xfb2a('0x19')]&&_0x383645[_0xfb2a('0x12')]&&_0x3cf887[_0x383645[_0xfb2a('0x18')][_0xfb2a('0x19')][_0xfb2a('0x1a')]()]){_0x4712f5[_0x383645['idField']]=_0x3cf887[_0x383645[_0xfb2a('0x18')][_0xfb2a('0x19')][_0xfb2a('0x1a')]()][_0xfb2a('0x14')]();}});}return _0x4712f5;}function getName(_0x4a2ad5){if(_0x4a2ad5[_0xfb2a('0x1b')]('\x20')>0x0){var _0x5200e6=_0x4a2ad5[_0xfb2a('0x1c')](/ (.+)/);if(_0x5200e6[0x1]){return _0x5200e6;}}return[_0x4a2ad5,_0x4a2ad5];}var accountsTokens={};function getAccessToken(_0x2e2743){return new Promise(function(_0x1f230b,_0x593291){if(!_['isNil'](accountsTokens[_0x2e2743['id']])&&!_['isNil'](accountsTokens[_0x2e2743['id']]['access_token'])){if(moment()[_0xfb2a('0x1d')](accountsTokens[_0x2e2743['id']][_0xfb2a('0x1e')])){_0x1f230b(accountsTokens[_0x2e2743['id']][_0xfb2a('0x1f')]);}}var _0x3145d3;switch(_0x2e2743[_0xfb2a('0x20')]){case'US':_0x3145d3=_0xfb2a('0x21');break;case'AU':_0x3145d3=_0xfb2a('0x22');break;case'EU':_0x3145d3=_0xfb2a('0x23');break;case'IN':_0x3145d3=_0xfb2a('0x24');break;case'CN':_0x3145d3=_0xfb2a('0x25');break;default:_0x3145d3='https://accounts.zoho.eu';break;}var _0x3115f2={'method':'POST','uri':_0x3145d3+_0xfb2a('0x26'),'qs':{'refresh_token':_0x2e2743[_0xfb2a('0x27')],'client_id':_0x2e2743['clientId'],'client_secret':_0x2e2743[_0xfb2a('0x28')],'grant_type':_0xfb2a('0x29')},'json':!![]};return rp(_0x3115f2)['then'](function(_0x446dfa){accountsTokens[_0x2e2743['id']]={'access_token':_0x446dfa[_0xfb2a('0x1f')],'expires_in':moment()['add'](_0x446dfa[_0xfb2a('0x1e')],_0xfb2a('0x2a'))};_0x1f230b(_0x446dfa[_0xfb2a('0x1f')]);})[_0xfb2a('0x2b')](function(_0x3f9190){logger[_0xfb2a('0x2c')](_0xfb2a('0x2d'),_0x3f9190[_0xfb2a('0x2e')]);_0x593291(_0x3f9190);});});}function getUser(_0x111c67,_0x3d6768,_0x4b79e5,_0xbbf3b4){logger[_0xfb2a('0x2f')](_0xfb2a('0x30'));return request({'method':_0xfb2a('0x31'),'uri':util[_0xfb2a('0x32')](_0xfb2a('0x33'),_0x3d6768),'qs':{'type':_0xfb2a('0x34')},'headers':{'Authorization':_0xfb2a('0x35')+_0x111c67},'json':!![]})['then'](function(_0x225e04){if(_0x225e04['users']){var _0x4e53f1=-0x1;if(_[_0xfb2a('0x36')](_0x225e04[_0xfb2a('0x37')])){if(!_[_0xfb2a('0x38')](_0xbbf3b4)){_0x4e53f1=_['findIndex'](_0x225e04[_0xfb2a('0x37')],function(_0x4ee3b9){return _0x4ee3b9[_0xfb2a('0x39')]===_0xbbf3b4;});}if(_0x4e53f1>=0x0){logger[_0xfb2a('0x2f')](_0xfb2a('0x3a'));}else{logger[_0xfb2a('0x2f')](_0xfb2a('0x3b'));_0x4e53f1=_[_0xfb2a('0x3c')](_0x225e04['users'],function(_0x4966b3){return _0x4966b3[_0xfb2a('0x3d')][_0xfb2a('0x19')]==='Administrator';});}return _0x225e04['users'][_0x4e53f1];}else{if(_0x225e04[_0xfb2a('0x3e')][_0xfb2a('0x3d')][_0xfb2a('0x19')]===_0xfb2a('0x3f')){logger[_0xfb2a('0x2f')](_0xfb2a('0x3b'));user=_0x225e04['user'];return user;}else{logger[_0xfb2a('0x2c')](_0xfb2a('0x40'),JSON[_0xfb2a('0xf')](_0x225e04));throw new Error(_0xfb2a('0x41')+JSON[_0xfb2a('0xf')](_0x225e04));}}}else{logger[_0xfb2a('0x2c')](_0xfb2a('0x40'),JSON[_0xfb2a('0xf')](_0x225e04));throw new Error(_0xfb2a('0x41')+JSON[_0xfb2a('0xf')](_0x225e04));}})[_0xfb2a('0x2b')](function(_0x30614d){console[_0xfb2a('0x2c')](_0x30614d);});}function getZohoUser(_0x17bb29,_0xee9d74){return new BPromise(function(_0x2d336c,_0x319f14){request(_0x17bb29)[_0xfb2a('0x42')](function(_0x318e84){var _0x45ea7b=null;if(_0x318e84){_0x45ea7b=_0x318e84[_0xfb2a('0x43')][0x0];_0x45ea7b[_0xfb2a('0x44')]=_0xee9d74;}_0x2d336c(_0x45ea7b);})[_0xfb2a('0x2b')](function(_0x2cb825){_0x319f14(_0x2cb825);});});}function createEndUser(_0xcb6e47,_0x24f784,_0x357ff6,_0x25597a,_0x2e4b2f,_0x55c4ee){var _0x357ff6=getName(_0x357ff6);return request({'method':_0xfb2a('0x45'),'uri':_0xfb2a('0x46')+_0x24f784+_0xfb2a('0x47')+_[_0xfb2a('0x48')](_0x55c4ee[_0xfb2a('0x49')])+'s','body':{'data':[{'Last_Name':_0x357ff6[0x1],'First_Name':_0x357ff6[0x0],'Phone':_0x25597a,'Owner':{'name':!_['isNil'](_0x2e4b2f[_0xfb2a('0x4a')][_0xfb2a('0x19')])?_0x2e4b2f[_0xfb2a('0x4a')]['name']:!_[_0xfb2a('0x38')](_0x2e4b2f[_0xfb2a('0x4b')])?_0x2e4b2f[_0xfb2a('0x4b')]+'\x20'+_0x2e4b2f[_0xfb2a('0x4c')]:_0x2e4b2f['last_name'],'id':_0x2e4b2f['id']}}]},'headers':{'Authorization':_0xfb2a('0x35')+_0xcb6e47},'json':!![]})[_0xfb2a('0x42')](function(_0x1b9bd5){if(_0x1b9bd5&&_0x1b9bd5[_0xfb2a('0x43')][0x0][_0xfb2a('0x4d')]===_0xfb2a('0x4e')){var _0xfc1b13=_0x1b9bd5[_0xfb2a('0x43')][0x0][_0xfb2a('0x4f')];_0xfc1b13['enduserType']=_['startCase'](_0x55c4ee['moduleCreate'])+'s';return _0xfc1b13;}logger[_0xfb2a('0x2c')](_0xfb2a('0x40'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xfb2a('0x2b')](function(_0x1d7367){console[_0xfb2a('0x50')](_0xfb2a('0x51'),_0x1d7367);});}function getEndUser(_0x4ba252,_0x10b446,_0x24d7b2,_0x69687,_0x4b1cc1,_0x5be2ae,_0x5613c1){var _0x321c0b={'method':_0xfb2a('0x31'),'uri':'','headers':{'Authorization':_0xfb2a('0x35')+_0x4ba252},'json':!![]};switch(_0x5613c1[_0xfb2a('0x52')]){case _0xfb2a('0x53'):_0x321c0b[_0xfb2a('0x54')]=_0xfb2a('0x46')+_0x10b446+_0xfb2a('0x55')+_0x4b1cc1+'))';return getZohoUser(_0x321c0b,_0xfb2a('0x56'))['then'](function(_0x4f9460){if(_0x4f9460)return _0x4f9460;_0x321c0b['uri']=_0xfb2a('0x46')+_0x10b446+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4b1cc1+'))';return getZohoUser(_0x321c0b,_0xfb2a('0x57'))['then'](function(_0x523414){if(_0x523414)return _0x523414;if(_0x5613c1[_0xfb2a('0x49')]!=_0xfb2a('0x58')){return createEndUser(_0x4ba252,_0x10b446,_0x69687,_0x4b1cc1,_0x5be2ae,_0x5613c1);}else{return{};}});});break;case'contact':_0x321c0b[_0xfb2a('0x54')]=_0xfb2a('0x46')+_0x10b446+_0xfb2a('0x55')+_0x4b1cc1+'))';return getZohoUser(_0x321c0b,'Contacts')[_0xfb2a('0x42')](function(_0xec9121){if(_0xec9121)return _0xec9121;if(_0x5613c1['moduleCreate']!='nothing'){return createEndUser(_0x4ba252,_0x10b446,_0x69687,_0x4b1cc1,_0x5be2ae,_0x5613c1);}else{return{};}});break;case _0xfb2a('0x59'):_0x321c0b[_0xfb2a('0x54')]=_0xfb2a('0x46')+_0x10b446+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4b1cc1+'))';return getZohoUser(_0x321c0b,_0xfb2a('0x57'))[_0xfb2a('0x42')](function(_0x1f5555){if(_0x1f5555)return _0x1f5555;if(_0x5613c1['moduleCreate']!=_0xfb2a('0x58')){return createEndUser(_0x4ba252,_0x10b446,_0x69687,_0x4b1cc1,_0x5be2ae,_0x5613c1);}else{return{};}});break;}}function getCall(_0x49a9a4,_0x4c42d4,_0x3b33f0,_0x2f1be3,_0x4f3a81,_0x124ee2,_0x2f5d29,_0x370f1d){logger[_0xfb2a('0x2f')](_0xfb2a('0x5a'));var _0x320741={};_0x320741[_0xfb2a('0x5b')]={'name':!_[_0xfb2a('0x38')](_0x2f1be3[_0xfb2a('0x4a')][_0xfb2a('0x19')])&&!_[_0xfb2a('0x38')](_0x2f1be3[_0xfb2a('0x3d')][_0xfb2a('0x19')])&&_0x2f1be3['profile'][_0xfb2a('0x19')]===_0xfb2a('0x5c')?_0x2f1be3[_0xfb2a('0x4a')][_0xfb2a('0x19')]:!_[_0xfb2a('0x38')](_0x2f1be3[_0xfb2a('0x4b')])?_0x2f1be3['first_name']+'\x20'+_0x2f1be3[_0xfb2a('0x4c')]:_0x2f1be3[_0xfb2a('0x4c')],'id':_0x2f1be3['id']};_0x320741[_0xfb2a('0x5d')]=intUtil[_0xfb2a('0x5e')](_0x124ee2['Subjects'],_0x2f5d29,'\x20');_0x320741['Description']=intUtil['getString'](_0x124ee2[_0xfb2a('0x5f')],_0x2f5d29,'\x0a');if(_0x4f3a81[_0xfb2a('0x44')]==='Contacts'){_0x320741['Who_Id']={'name':!_['isNil'](_0x4f3a81[_0xfb2a('0x60')])?_0x4f3a81[_0xfb2a('0x60')]:!_['isNil'](_0x4f3a81[_0xfb2a('0x61')])?_0x4f3a81[_0xfb2a('0x61')]+'\x20'+_0x4f3a81[_0xfb2a('0x62')]:_0x4f3a81['Last_Name'],'id':_0x4f3a81['id']};}if(_0x4f3a81[_0xfb2a('0x44')]==='Leads'){_0x320741['What_Id']={'name':!_['isNil'](_0x4f3a81[_0xfb2a('0x60')])?_0x4f3a81['Full_Name']:!_[_0xfb2a('0x38')](_0x4f3a81[_0xfb2a('0x61')])?_0x4f3a81[_0xfb2a('0x61')]+'\x20'+_0x4f3a81['Last_Name']:_0x4f3a81[_0xfb2a('0x62')],'id':_0x4f3a81['id']};_0x320741['$se_module']=_[_0xfb2a('0x48')](_0x4f3a81[_0xfb2a('0x44')]);}if(_0x2f5d29[_0xfb2a('0x63')]){_0x320741[_0xfb2a('0x64')]=moment[_0xfb2a('0x65')](parseInt(_0x2f5d29[_0xfb2a('0x63')])*0x3e8)[_0xfb2a('0x32')]('mm:ss');}else if(_0x2f5d29[_0xfb2a('0x66')]&&_0x2f5d29[_0xfb2a('0x67')]){_0x320741[_0xfb2a('0x64')]=moment['utc'](moment(_0x2f5d29['endtime'],_0xfb2a('0x68'))[_0xfb2a('0x69')](moment(_0x2f5d29[_0xfb2a('0x6a')],'YYYY-MM-DDTHH:mm:ss')))[_0xfb2a('0x32')](_0xfb2a('0x6b'));}switch(_0x2f5d29[_0xfb2a('0x6c')]){case _0xfb2a('0x6d'):_0x320741[_0xfb2a('0x6e')]=_0xfb2a('0x6f');break;case _0xfb2a('0x70'):case _0xfb2a('0x71'):_0x320741['Call_Result']='Answered';break;case _0xfb2a('0x72'):_0x320741['Call_Result']='Rejected';break;case _0xfb2a('0x73'):_0x320741['Call_Result']=_0xfb2a('0x74');break;case _0xfb2a('0x75'):_0x320741[_0xfb2a('0x6e')]=_0xfb2a('0x76');default:}_0x320741[_0xfb2a('0x77')]=(_0x370f1d==='outbound'?moment(_0x2f5d29['starttime'])[_0xfb2a('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x2f5d29[_0xfb2a('0x78')])[_0xfb2a('0x32')](_0xfb2a('0x68')))||moment()[_0xfb2a('0x32')]('YYYY-MM-DDTHH:mm:ss');_0x320741['Call_Type']=_0x370f1d||'Inbound';_0x320741=_[_0xfb2a('0x79')](_0x320741,getCustomFields(_0x124ee2[_0xfb2a('0x7a')],_0x2f5d29));return request({'method':_0xfb2a('0x45'),'uri':'https://www.zohoapis.'+_0x4c42d4+_0xfb2a('0x7b'),'headers':{'Authorization':_0xfb2a('0x35')+_0x49a9a4},'body':{'data':[_0x320741]},'json':!![]})[_0xfb2a('0x42')](function(_0x3a9d2c){if(_0x3a9d2c&&_0x3a9d2c['data'][0x0][_0xfb2a('0x4d')]===_0xfb2a('0x4e')){logger[_0xfb2a('0x2f')](_0xfb2a('0x7c'));return{'id':_0x3a9d2c[_0xfb2a('0x43')][0x0][_0xfb2a('0x4f')]['id']};}})['catch'](function(_0x1fdbdb){logger[_0xfb2a('0x2f')](_0xfb2a('0x7d'),_0x1fdbdb[_0xfb2a('0x2e')]);console[_0xfb2a('0x50')](_0xfb2a('0x7d'),_0x1fdbdb);});}exports[_0xfb2a('0x7e')]=function(_0x32125c,_0x33f42c,_0x2c1b41,_0x5cd07e,_0x43470d,_0x55c52a){var _0x30c0ad,_0x3b94dd,_0x36d19c;_0x55c52a[_0xfb2a('0x7f')]=intUtil[_0xfb2a('0x80')](_0x55c52a[_0xfb2a('0x7f')]);_0x55c52a[_0xfb2a('0x81')]=intUtil['stripTrailingSlash'](_0x55c52a[_0xfb2a('0x81')]);if(_0x43470d&&_0x43470d[_0xfb2a('0x82')]){logger[_0xfb2a('0x2f')]('[QUEUE]',_0xfb2a('0x83'));_0x33f42c[_0xfb2a('0x84')]=_0x55c52a[_0xfb2a('0x81')]+_0xfb2a('0x85')+_0x33f42c[_0xfb2a('0x86')]+_0xfb2a('0x87')+md5(_0x33f42c[_0xfb2a('0x86')]);}else{_0x33f42c[_0xfb2a('0x84')]='';}var _0x574138=_0x55c52a[_0xfb2a('0x7f')]===_0xfb2a('0x88')?'eu':'com';return getAccessToken(_0x55c52a)['then'](function(_0x52a0c6){_0x36d19c=_0x52a0c6;return getUser(_0x36d19c,_0x574138,_0x55c52a,_0x5cd07e['email']);})[_0xfb2a('0x42')](function(_0x55f45f){_0x30c0ad=_0x55f45f;logger[_0xfb2a('0x2f')](_0xfb2a('0x89'),_0x30c0ad['id']);return getEndUser(_0x36d19c,_0x574138,_0x55c52a,_0x33f42c[_0xfb2a('0x8a')],_0x33f42c['calleridnum'],_0x30c0ad,_0x2c1b41);})[_0xfb2a('0x42')](function(_0x5bae9f){_0x3b94dd=_0x5bae9f;return getCall(_0x36d19c,_0x574138,_0x55c52a,_0x30c0ad,_0x3b94dd,_0x2c1b41,_0x33f42c,_0xfb2a('0x8b'));})['then'](function(_0x4e33a8){if(_0x4e33a8){logger[_0xfb2a('0x2f')](_0xfb2a('0x8c'),_0x4e33a8['id']);logger[_0xfb2a('0x2f')](_0xfb2a('0x8d'),_0xfb2a('0x8e'));emit(util[_0xfb2a('0x32')](_0xfb2a('0x8f'),_0x5cd07e[_0xfb2a('0x19')]),_0xfb2a('0x90'),{'uri':_0xfb2a('0x91')+_0x55c52a[_0xfb2a('0x7f')]+_0xfb2a('0x92')+_0x4e33a8['id']});}})[_0xfb2a('0x2b')](function(_0x495f30){logger[_0xfb2a('0x2c')](_0xfb2a('0x8d'),JSON[_0xfb2a('0xf')](_0x495f30));});};exports[_0xfb2a('0x93')]=function(_0x31b310,_0x3cea35,_0x8cfb6c,_0x4e8f5b,_0x38d4f9,_0x277c4a,_0x26d01c){var _0x4192e6,_0x3a1732,_0x2f6656;_0x277c4a[_0xfb2a('0x7f')]=intUtil[_0xfb2a('0x80')](_0x277c4a[_0xfb2a('0x7f')]);_0x277c4a[_0xfb2a('0x81')]=intUtil[_0xfb2a('0x80')](_0x277c4a[_0xfb2a('0x81')]);if(_0x26d01c&&_0x26d01c[_0xfb2a('0x94')]&&_0x26d01c['recordingFormat']!==_0xfb2a('0x95')){logger[_0xfb2a('0x2f')](_0xfb2a('0x96'),_0xfb2a('0x83'));_0x3cea35['recordingURL']=_0x277c4a[_0xfb2a('0x81')]+_0xfb2a('0x85')+_0x3cea35[_0xfb2a('0x86')]+_0xfb2a('0x87')+md5(_0x3cea35[_0xfb2a('0x86')]);}var _0x3b8e83=_0x277c4a[_0xfb2a('0x7f')]===_0xfb2a('0x88')?'eu':'com';return getAccessToken(_0x277c4a)[_0xfb2a('0x42')](function(_0x2b3a51){_0x2f6656=_0x2b3a51;return getUser(_0x2f6656,_0x3b8e83,_0x277c4a,_0x4e8f5b['email']);})[_0xfb2a('0x42')](function(_0xa22a99){_0x4192e6=_0xa22a99;logger[_0xfb2a('0x2f')]('The\x20User\x20ID\x20is:',_0x4192e6['id']);return getEndUser(_0x2f6656,_0x3b8e83,_0x277c4a,_0x3cea35[_0xfb2a('0x97')],_0x3cea35['destcalleridnum'],_0x4192e6,_0x8cfb6c);})[_0xfb2a('0x42')](function(_0x2b3921){_0x3a1732=_0x2b3921;return getCall(_0x2f6656,_0x3b8e83,_0x277c4a,_0x4192e6,_0x3a1732,_0x8cfb6c,_0x3cea35,_0xfb2a('0x98'));})['then'](function(_0x558e78){if(_0x558e78){logger[_0xfb2a('0x2f')](_0xfb2a('0x8c'),_0x558e78['id']);logger[_0xfb2a('0x2f')]('[OUTBOUND]',_0xfb2a('0x8e'));emit(util[_0xfb2a('0x32')]('user:%s',_0x4e8f5b[_0xfb2a('0x19')]),'trigger:browser:url',{'uri':_0xfb2a('0x91')+_0x277c4a[_0xfb2a('0x7f')]+_0xfb2a('0x92')+_0x558e78['id']});}})[_0xfb2a('0x2b')](function(_0x5d8ecd){logger[_0xfb2a('0x2c')](_0xfb2a('0x96'),JSON[_0xfb2a('0xf')](_0x5d8ecd));});};exports['unmanaged']=function(_0x2548e5,_0x239cdd,_0x2d680b,_0x385c1b,_0x40303b,_0x2996fd){var _0x54a811,_0x32fc1f,_0x1cfefd;_0x2996fd[_0xfb2a('0x7f')]=intUtil[_0xfb2a('0x80')](_0x2996fd[_0xfb2a('0x7f')]);_0x2996fd[_0xfb2a('0x81')]=intUtil[_0xfb2a('0x80')](_0x2996fd[_0xfb2a('0x81')]);if(_0x40303b&&_0x40303b[_0xfb2a('0x82')]){logger[_0xfb2a('0x2f')]('['+_0x239cdd[_0xfb2a('0x6c')][_0xfb2a('0x99')]()+']',_0xfb2a('0x83'));_0x239cdd[_0xfb2a('0x84')]=_0x2996fd[_0xfb2a('0x81')]+'/api/voice/recordings/'+_0x239cdd['uniqueid']+_0xfb2a('0x87')+md5(_0x239cdd[_0xfb2a('0x86')]);}else{_0x239cdd[_0xfb2a('0x84')]='';}var _0x23a918=_0x2996fd[_0xfb2a('0x7f')]==='zoho.eu'?'eu':_0xfb2a('0x9a');return getAccessToken(_0x2996fd)[_0xfb2a('0x42')](function(_0x448eff){_0x1cfefd=_0x448eff;return getUser(_0x1cfefd,_0x23a918,_0x2996fd);})[_0xfb2a('0x42')](function(_0x502cda){_0x54a811=_0x502cda;logger[_0xfb2a('0x2f')](_0xfb2a('0x89'),_0x54a811['id']);return getEndUser(_0x1cfefd,_0x23a918,_0x2996fd,_0x239cdd[_0xfb2a('0x8a')],_0x239cdd[_0xfb2a('0x9b')],_0x54a811,_0x2d680b);})[_0xfb2a('0x42')](function(_0xda92d2){_0x32fc1f=_0xda92d2;return getCall(_0x1cfefd,_0x23a918,_0x2996fd,_0x54a811,_0x32fc1f,_0x2d680b,_0x239cdd,_0xfb2a('0x8b'));})[_0xfb2a('0x42')](function(_0x2d8495){if(_0x2d8495){logger[_0xfb2a('0x2f')](_0xfb2a('0x8c'),_0x2d8495['id']);}})[_0xfb2a('0x2b')](function(_0x1ac5a9){logger[_0xfb2a('0x2c')]('['+_0x239cdd[_0xfb2a('0x6c')]['toUpperCase']()+']',JSON['stringify'](_0x1ac5a9));});}; \ No newline at end of file +var _0x7ae6=['calleridname','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','name','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientId','clientSecret','refresh_token','then','add','error','Failing\x20creating\x20the\x20access_token','stack','https://www.zohoapis.%s/crm/v2/users','users','info','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','/crm/v2/','startCase','first_name','last_name','Zoho-oauthtoken\x20','code','CREATE\x20ERROR','GET','contact_lead','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','moduleCreate','lead','Owner','role','administrator','Subject','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','format','lastevent','called','Called','complete','connect','Call_Result','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','details','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','com','user:%s','trigger:browser:url','unmanaged','toUpperCase'];(function(_0x3755f3,_0xcce3d5){var _0x551500=function(_0x448fb4){while(--_0x448fb4){_0x3755f3['push'](_0x3755f3['shift']());}};_0x551500(++_0xcce3d5);}(_0x7ae6,0x94));var _0x67ae=function(_0x503a8c,_0x46d5d1){_0x503a8c=_0x503a8c-0x0;var _0x493b8a=_0x7ae6[_0x503a8c];return _0x493b8a;};'use strict';var _=require('lodash');var rp=require(_0x67ae('0x0'));var md5=require('md5');var util=require(_0x67ae('0x1'));var intUtil=require(_0x67ae('0x2'));var moment=require(_0x67ae('0x3'));var Redis=require(_0x67ae('0x4'));var BPromise=require(_0x67ae('0x5'));var config=require(_0x67ae('0x6'));var logger=require('../../../../config/logger')(_0x67ae('0x7'));config[_0x67ae('0x8')]=_[_0x67ae('0x9')](config[_0x67ae('0x8')],{'host':_0x67ae('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x67ae('0x8')]));function emit(_0x460304,_0x2591a1,_0x20b931){io['to'](_0x460304)[_0x67ae('0xb')](_0x2591a1,_0x20b931);}function request(_0x11c49a){logger[_0x67ae('0xc')](_0x67ae('0xd'),JSON[_0x67ae('0xe')](_0x11c49a));return rp(_0x11c49a);}function getCustomFields(_0x28d20a,_0x3143cb){var _0x109d16={};if(_0x28d20a[_0x67ae('0xf')]>0x0){_[_0x67ae('0x10')](_0x28d20a,function(_0x16b364){if(_0x16b364[_0x67ae('0x11')]===_0x67ae('0x12')&&_0x16b364[_0x67ae('0x13')]){_0x109d16[_0x16b364[_0x67ae('0x13')]]=_0x16b364[_0x67ae('0x14')][_0x67ae('0x15')]();}else if(_0x16b364[_0x67ae('0x11')]===_0x67ae('0x16')&&_0x16b364[_0x67ae('0x17')]&&_0x16b364['idField']&&_0x3143cb[_0x16b364[_0x67ae('0x17')]]){_0x109d16[_0x16b364[_0x67ae('0x13')]]=_0x3143cb[_0x16b364[_0x67ae('0x17')]]['toString']();}else if(_0x16b364['type']===_0x67ae('0x18')&&_0x16b364['Variable']&&_0x16b364['Variable'][_0x67ae('0x19')]&&_0x16b364[_0x67ae('0x13')]&&_0x3143cb[_0x16b364['Variable']['name']['toLowerCase']()]){_0x109d16[_0x16b364[_0x67ae('0x13')]]=_0x3143cb[_0x16b364['Variable'][_0x67ae('0x19')]['toLowerCase']()][_0x67ae('0x15')]();}});}return _0x109d16;}function getName(_0x415e37){if(_0x415e37[_0x67ae('0x1a')]('\x20')>0x0){var _0x5d63fe=_0x415e37[_0x67ae('0x1b')](/ (.+)/);if(_0x5d63fe[0x1]){return _0x5d63fe;}}return[_0x415e37,_0x415e37];}var accountsTokens={};function getAccessToken(_0x18876d){return new Promise(function(_0x23ca2c,_0xbe6112){if(!_[_0x67ae('0x1c')](accountsTokens[_0x18876d['id']])&&!_[_0x67ae('0x1c')](accountsTokens[_0x18876d['id']][_0x67ae('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x18876d['id']][_0x67ae('0x1e')])){_0x23ca2c(accountsTokens[_0x18876d['id']][_0x67ae('0x1d')]);}}var _0x54163c;switch(_0x18876d['zone']){case'US':_0x54163c='https://accounts.zoho.com';break;case'AU':_0x54163c=_0x67ae('0x1f');break;case'EU':_0x54163c=_0x67ae('0x20');break;case'IN':_0x54163c=_0x67ae('0x21');break;case'CN':_0x54163c='https://accounts.zoho.com.cn';break;default:_0x54163c=_0x67ae('0x20');break;}var _0x5ac25d={'method':'POST','uri':_0x54163c+'/oauth/v2/token','qs':{'refresh_token':_0x18876d[_0x67ae('0x22')],'client_id':_0x18876d[_0x67ae('0x23')],'client_secret':_0x18876d[_0x67ae('0x24')],'grant_type':_0x67ae('0x25')},'json':!![]};return rp(_0x5ac25d)[_0x67ae('0x26')](function(_0x4000e5){accountsTokens[_0x18876d['id']]={'access_token':_0x4000e5[_0x67ae('0x1d')],'expires_in':moment()[_0x67ae('0x27')](_0x4000e5[_0x67ae('0x1e')],'seconds')};_0x23ca2c(_0x4000e5[_0x67ae('0x1d')]);})['catch'](function(_0xe7fce1){logger[_0x67ae('0x28')](_0x67ae('0x29'),_0xe7fce1[_0x67ae('0x2a')]);_0xbe6112(_0xe7fce1);});});}function getUser(_0xf5b101,_0x320274,_0x13d219,_0x361f98){logger['info']('Search\x20user');return request({'method':'GET','uri':util['format'](_0x67ae('0x2b'),_0x320274),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xf5b101},'json':!![]})[_0x67ae('0x26')](function(_0x4b9962){if(_0x4b9962[_0x67ae('0x2c')]){var _0x4f204d=-0x1;if(_['isArrayLikeObject'](_0x4b9962[_0x67ae('0x2c')])){if(!_[_0x67ae('0x1c')](_0x361f98)){_0x4f204d=_['findIndex'](_0x4b9962['users'],function(_0x416e23){return _0x416e23['email']===_0x361f98;});}if(_0x4f204d>=0x0){logger[_0x67ae('0x2d')](_0x67ae('0x2e'));}else{logger[_0x67ae('0x2d')](_0x67ae('0x2f'));_0x4f204d=_[_0x67ae('0x30')](_0x4b9962['users'],function(_0x1c4fd6){return _0x1c4fd6[_0x67ae('0x31')][_0x67ae('0x19')]===_0x67ae('0x32');});}return _0x4b9962[_0x67ae('0x2c')][_0x4f204d];}else{if(_0x4b9962[_0x67ae('0x33')]['profile'][_0x67ae('0x19')]==='Administrator'){logger[_0x67ae('0x2d')](_0x67ae('0x2f'));user=_0x4b9962[_0x67ae('0x33')];return user;}else{logger['error'](_0x67ae('0x34'),JSON[_0x67ae('0xe')](_0x4b9962));throw new Error(_0x67ae('0x35')+JSON[_0x67ae('0xe')](_0x4b9962));}}}else{logger[_0x67ae('0x28')](_0x67ae('0x34'),JSON[_0x67ae('0xe')](_0x4b9962));throw new Error(_0x67ae('0x35')+JSON['stringify'](_0x4b9962));}})[_0x67ae('0x36')](function(_0x4e6083){console[_0x67ae('0x28')](_0x4e6083);});}function getZohoUser(_0x3834ce,_0x82ba8c){return new BPromise(function(_0x6439d,_0x4f5681){request(_0x3834ce)['then'](function(_0x567f10){var _0x9d3d6=null;if(_0x567f10){_0x9d3d6=_0x567f10[_0x67ae('0x37')][0x0];_0x9d3d6[_0x67ae('0x38')]=_0x82ba8c;}_0x6439d(_0x9d3d6);})['catch'](function(_0x59f336){_0x4f5681(_0x59f336);});});}function createEndUser(_0x26a6d7,_0x188ec0,_0x4440c5,_0x4d140f,_0x39268e,_0x24b0df){var _0x4440c5=getName(_0x4440c5);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x188ec0+_0x67ae('0x39')+_[_0x67ae('0x3a')](_0x24b0df['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4440c5[0x1],'First_Name':_0x4440c5[0x0],'Phone':_0x4d140f,'Owner':{'name':!_[_0x67ae('0x1c')](_0x39268e['role'][_0x67ae('0x19')])?_0x39268e['role'][_0x67ae('0x19')]:!_['isNil'](_0x39268e['first_name'])?_0x39268e[_0x67ae('0x3b')]+'\x20'+_0x39268e[_0x67ae('0x3c')]:_0x39268e[_0x67ae('0x3c')],'id':_0x39268e['id']}}]},'headers':{'Authorization':_0x67ae('0x3d')+_0x26a6d7},'json':!![]})[_0x67ae('0x26')](function(_0x58bb2c){if(_0x58bb2c&&_0x58bb2c[_0x67ae('0x37')][0x0][_0x67ae('0x3e')]==='SUCCESS'){var _0x1253bf=_0x58bb2c[_0x67ae('0x37')][0x0]['details'];_0x1253bf[_0x67ae('0x38')]=_[_0x67ae('0x3a')](_0x24b0df['moduleCreate'])+'s';return _0x1253bf;}logger['error'](_0x67ae('0x34'),JSON[_0x67ae('0xe')](data));throw new Error('Error:\x20'+JSON[_0x67ae('0xe')](data));})['catch'](function(_0x3e8760){console['log'](_0x67ae('0x3f'),_0x3e8760);});}function getEndUser(_0x4868a5,_0x3edcaa,_0x5bc221,_0xe1d058,_0x15e414,_0x39f232,_0xe4b971){var _0x4424b3={'method':_0x67ae('0x40'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4868a5},'json':!![]};switch(_0xe4b971['moduleSearch']){case _0x67ae('0x41'):_0x4424b3[_0x67ae('0x42')]=_0x67ae('0x43')+_0x3edcaa+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x15e414+'))';return getZohoUser(_0x4424b3,_0x67ae('0x44'))['then'](function(_0x11046e){if(_0x11046e)return _0x11046e;_0x4424b3[_0x67ae('0x42')]=_0x67ae('0x43')+_0x3edcaa+_0x67ae('0x45')+_0x15e414+'))';return getZohoUser(_0x4424b3,_0x67ae('0x46'))[_0x67ae('0x26')](function(_0x91a770){if(_0x91a770)return _0x91a770;if(_0xe4b971['moduleCreate']!=_0x67ae('0x47')){return createEndUser(_0x4868a5,_0x3edcaa,_0xe1d058,_0x15e414,_0x39f232,_0xe4b971);}else{return{};}});});break;case'contact':_0x4424b3[_0x67ae('0x42')]=_0x67ae('0x43')+_0x3edcaa+_0x67ae('0x48')+_0x15e414+'))';return getZohoUser(_0x4424b3,'Contacts')[_0x67ae('0x26')](function(_0xc65ec3){if(_0xc65ec3)return _0xc65ec3;if(_0xe4b971[_0x67ae('0x49')]!=_0x67ae('0x47')){return createEndUser(_0x4868a5,_0x3edcaa,_0xe1d058,_0x15e414,_0x39f232,_0xe4b971);}else{return{};}});break;case _0x67ae('0x4a'):_0x4424b3[_0x67ae('0x42')]='https://www.zohoapis.'+_0x3edcaa+_0x67ae('0x45')+_0x15e414+'))';return getZohoUser(_0x4424b3,_0x67ae('0x46'))[_0x67ae('0x26')](function(_0x3b66dc){if(_0x3b66dc)return _0x3b66dc;if(_0xe4b971[_0x67ae('0x49')]!=_0x67ae('0x47')){return createEndUser(_0x4868a5,_0x3edcaa,_0xe1d058,_0x15e414,_0x39f232,_0xe4b971);}else{return{};}});break;}}function getCall(_0x3a730c,_0x498adf,_0x21f4ce,_0x31d96c,_0x4da3f3,_0xa8569e,_0x266aef,_0x3a3ac6){logger[_0x67ae('0x2d')]('Creating\x20new\x20call...');var _0x36b39b={};_0x36b39b[_0x67ae('0x4b')]={'name':!_[_0x67ae('0x1c')](_0x31d96c[_0x67ae('0x4c')]['name'])&&!_['isNil'](_0x31d96c[_0x67ae('0x31')][_0x67ae('0x19')])&&_0x31d96c[_0x67ae('0x31')][_0x67ae('0x19')]===_0x67ae('0x4d')?_0x31d96c[_0x67ae('0x4c')]['name']:!_['isNil'](_0x31d96c[_0x67ae('0x3b')])?_0x31d96c['first_name']+'\x20'+_0x31d96c['last_name']:_0x31d96c['last_name'],'id':_0x31d96c['id']};_0x36b39b[_0x67ae('0x4e')]=intUtil[_0x67ae('0x4f')](_0xa8569e['Subjects'],_0x266aef,'\x20');_0x36b39b[_0x67ae('0x50')]=intUtil[_0x67ae('0x4f')](_0xa8569e[_0x67ae('0x51')],_0x266aef,'\x0a');if(_0x4da3f3['enduserType']==='Contacts'){_0x36b39b['Who_Id']={'name':!_[_0x67ae('0x1c')](_0x4da3f3[_0x67ae('0x52')])?_0x4da3f3[_0x67ae('0x52')]:!_[_0x67ae('0x1c')](_0x4da3f3['First_Name'])?_0x4da3f3[_0x67ae('0x53')]+'\x20'+_0x4da3f3[_0x67ae('0x54')]:_0x4da3f3[_0x67ae('0x54')],'id':_0x4da3f3['id']};}if(_0x4da3f3[_0x67ae('0x38')]===_0x67ae('0x46')){_0x36b39b[_0x67ae('0x55')]={'name':!_[_0x67ae('0x1c')](_0x4da3f3[_0x67ae('0x52')])?_0x4da3f3[_0x67ae('0x52')]:!_[_0x67ae('0x1c')](_0x4da3f3[_0x67ae('0x53')])?_0x4da3f3['First_Name']+'\x20'+_0x4da3f3[_0x67ae('0x54')]:_0x4da3f3['Last_Name'],'id':_0x4da3f3['id']};_0x36b39b[_0x67ae('0x56')]=_[_0x67ae('0x3a')](_0x4da3f3[_0x67ae('0x38')]);}if(_0x266aef['talktime']){_0x36b39b[_0x67ae('0x57')]=moment[_0x67ae('0x58')](parseInt(_0x266aef[_0x67ae('0x59')])*0x3e8)['format'](_0x67ae('0x5a'));}else if(_0x266aef[_0x67ae('0x5b')]&&_0x266aef[_0x67ae('0x5c')]){_0x36b39b[_0x67ae('0x57')]=moment['utc'](moment(_0x266aef[_0x67ae('0x5c')],'YYYY-MM-DDTHH:mm:ss')[_0x67ae('0x5d')](moment(_0x266aef[_0x67ae('0x5e')],_0x67ae('0x5f'))))[_0x67ae('0x60')](_0x67ae('0x5a'));}switch(_0x266aef[_0x67ae('0x61')]){case _0x67ae('0x62'):_0x36b39b['Call_Result']=_0x67ae('0x63');break;case _0x67ae('0x64'):case _0x67ae('0x65'):_0x36b39b[_0x67ae('0x66')]='Answered';break;case _0x67ae('0x67'):_0x36b39b[_0x67ae('0x66')]='Rejected';break;case _0x67ae('0x68'):_0x36b39b[_0x67ae('0x66')]=_0x67ae('0x69');break;case _0x67ae('0x6a'):_0x36b39b[_0x67ae('0x66')]=_0x67ae('0x6b');default:}_0x36b39b[_0x67ae('0x6c')]=(_0x3a3ac6===_0x67ae('0x6d')?moment(_0x266aef[_0x67ae('0x5e')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x266aef[_0x67ae('0x6e')])[_0x67ae('0x60')](_0x67ae('0x5f')))||moment()[_0x67ae('0x60')]('YYYY-MM-DDTHH:mm:ss');_0x36b39b[_0x67ae('0x6f')]=_0x3a3ac6||_0x67ae('0x70');_0x36b39b=_['merge'](_0x36b39b,getCustomFields(_0xa8569e[_0x67ae('0x71')],_0x266aef));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x498adf+_0x67ae('0x72'),'headers':{'Authorization':_0x67ae('0x3d')+_0x3a730c},'body':{'data':[_0x36b39b]},'json':!![]})['then'](function(_0x4cce71){if(_0x4cce71&&_0x4cce71[_0x67ae('0x37')][0x0]['code']==='SUCCESS'){logger['info'](_0x67ae('0x73'));return{'id':_0x4cce71['data'][0x0][_0x67ae('0x74')]['id']};}})[_0x67ae('0x36')](function(_0x401a92){logger[_0x67ae('0x2d')](_0x67ae('0x75'),_0x401a92['stack']);console[_0x67ae('0x76')]('err',_0x401a92);});}exports[_0x67ae('0x77')]=function(_0x2d6f38,_0x50c7bb,_0x103834,_0x594418,_0x39ad02,_0xa0a90a){var _0xbc7f0,_0x5e0d6a,_0x440188;_0xa0a90a[_0x67ae('0x78')]=intUtil[_0x67ae('0x79')](_0xa0a90a[_0x67ae('0x78')]);_0xa0a90a[_0x67ae('0x7a')]=intUtil['stripTrailingSlash'](_0xa0a90a['serverUrl']);if(_0x39ad02&&_0x39ad02[_0x67ae('0x7b')]){logger['info'](_0x67ae('0x7c'),_0x67ae('0x7d'));_0x50c7bb[_0x67ae('0x7e')]=_0xa0a90a[_0x67ae('0x7a')]+_0x67ae('0x7f')+_0x50c7bb[_0x67ae('0x80')]+_0x67ae('0x81')+md5(_0x50c7bb[_0x67ae('0x80')]);}else{_0x50c7bb[_0x67ae('0x7e')]='';}var _0x49563a=_0xa0a90a[_0x67ae('0x78')]===_0x67ae('0x82')?'eu':'com';return getAccessToken(_0xa0a90a)[_0x67ae('0x26')](function(_0x3e6bfa){_0x440188=_0x3e6bfa;return getUser(_0x440188,_0x49563a,_0xa0a90a,_0x594418[_0x67ae('0x83')]);})['then'](function(_0x3d80d5){_0xbc7f0=_0x3d80d5;logger[_0x67ae('0x2d')](_0x67ae('0x84'),_0xbc7f0['id']);return getEndUser(_0x440188,_0x49563a,_0xa0a90a,_0x50c7bb['calleridname'],_0x50c7bb[_0x67ae('0x85')],_0xbc7f0,_0x103834);})[_0x67ae('0x26')](function(_0x37ee65){_0x5e0d6a=_0x37ee65;return getCall(_0x440188,_0x49563a,_0xa0a90a,_0xbc7f0,_0x5e0d6a,_0x103834,_0x50c7bb,_0x67ae('0x70'));})[_0x67ae('0x26')](function(_0x29012a){if(_0x29012a){logger[_0x67ae('0x2d')](_0x67ae('0x86'),_0x29012a['id']);logger['info'](_0x67ae('0x7c'),_0x67ae('0x87'));emit(util[_0x67ae('0x60')]('user:%s',_0x594418[_0x67ae('0x19')]),'trigger:browser:url',{'uri':_0x67ae('0x88')+_0xa0a90a[_0x67ae('0x78')]+_0x67ae('0x89')+_0x29012a['id']});}})[_0x67ae('0x36')](function(_0x3bf393){logger['error'](_0x67ae('0x7c'),JSON[_0x67ae('0xe')](_0x3bf393));});};exports[_0x67ae('0x6d')]=function(_0x175ad7,_0x12a9fc,_0x4ff10d,_0x34c4c0,_0x20a938,_0x11a5c9,_0x42ab3d){var _0x50fec1,_0x4bc91d,_0x8573b6;_0x11a5c9[_0x67ae('0x78')]=intUtil[_0x67ae('0x79')](_0x11a5c9[_0x67ae('0x78')]);_0x11a5c9[_0x67ae('0x7a')]=intUtil[_0x67ae('0x79')](_0x11a5c9['serverUrl']);if(_0x42ab3d&&_0x42ab3d[_0x67ae('0x8a')]&&_0x42ab3d['recordingFormat']!==_0x67ae('0x8b')){logger['info'](_0x67ae('0x8c'),_0x67ae('0x7d'));_0x12a9fc['recordingURL']=_0x11a5c9[_0x67ae('0x7a')]+'/api/voice/recordings/'+_0x12a9fc[_0x67ae('0x80')]+_0x67ae('0x81')+md5(_0x12a9fc[_0x67ae('0x80')]);}var _0x283c00=_0x11a5c9[_0x67ae('0x78')]===_0x67ae('0x82')?'eu':_0x67ae('0x8d');return getAccessToken(_0x11a5c9)['then'](function(_0x53a670){_0x8573b6=_0x53a670;return getUser(_0x8573b6,_0x283c00,_0x11a5c9,_0x34c4c0[_0x67ae('0x83')]);})[_0x67ae('0x26')](function(_0x1f88e1){_0x50fec1=_0x1f88e1;logger[_0x67ae('0x2d')](_0x67ae('0x84'),_0x50fec1['id']);return getEndUser(_0x8573b6,_0x283c00,_0x11a5c9,_0x12a9fc['destcalleridname'],_0x12a9fc['destcalleridnum'],_0x50fec1,_0x4ff10d);})[_0x67ae('0x26')](function(_0x4ebdd0){_0x4bc91d=_0x4ebdd0;return getCall(_0x8573b6,_0x283c00,_0x11a5c9,_0x50fec1,_0x4bc91d,_0x4ff10d,_0x12a9fc,'Outbound');})['then'](function(_0x2df164){if(_0x2df164){logger[_0x67ae('0x2d')]('The\x20Call\x20ID\x20is:',_0x2df164['id']);logger[_0x67ae('0x2d')](_0x67ae('0x8c'),_0x67ae('0x87'));emit(util[_0x67ae('0x60')](_0x67ae('0x8e'),_0x34c4c0[_0x67ae('0x19')]),_0x67ae('0x8f'),{'uri':_0x67ae('0x88')+_0x11a5c9[_0x67ae('0x78')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2df164['id']});}})['catch'](function(_0x45fa47){logger[_0x67ae('0x28')](_0x67ae('0x8c'),JSON['stringify'](_0x45fa47));});};exports[_0x67ae('0x90')]=function(_0x20f286,_0x18835e,_0x17a306,_0x58781c,_0x3c9b6d,_0xada10f){var _0x558d77,_0x3f25bf,_0x4f83ca;_0xada10f[_0x67ae('0x78')]=intUtil[_0x67ae('0x79')](_0xada10f[_0x67ae('0x78')]);_0xada10f[_0x67ae('0x7a')]=intUtil['stripTrailingSlash'](_0xada10f[_0x67ae('0x7a')]);if(_0x3c9b6d&&_0x3c9b6d[_0x67ae('0x7b')]){logger[_0x67ae('0x2d')]('['+_0x18835e[_0x67ae('0x61')][_0x67ae('0x91')]()+']',_0x67ae('0x7d'));_0x18835e[_0x67ae('0x7e')]=_0xada10f[_0x67ae('0x7a')]+_0x67ae('0x7f')+_0x18835e['uniqueid']+_0x67ae('0x81')+md5(_0x18835e[_0x67ae('0x80')]);}else{_0x18835e[_0x67ae('0x7e')]='';}var _0x41b07c=_0xada10f['host']===_0x67ae('0x82')?'eu':_0x67ae('0x8d');return getAccessToken(_0xada10f)[_0x67ae('0x26')](function(_0x483005){_0x4f83ca=_0x483005;return getUser(_0x4f83ca,_0x41b07c,_0xada10f);})[_0x67ae('0x26')](function(_0x295139){_0x558d77=_0x295139;logger[_0x67ae('0x2d')](_0x67ae('0x84'),_0x558d77['id']);return getEndUser(_0x4f83ca,_0x41b07c,_0xada10f,_0x18835e[_0x67ae('0x92')],_0x18835e['calleridnum'],_0x558d77,_0x17a306);})[_0x67ae('0x26')](function(_0x28167c){_0x3f25bf=_0x28167c;return getCall(_0x4f83ca,_0x41b07c,_0xada10f,_0x558d77,_0x3f25bf,_0x17a306,_0x18835e,_0x67ae('0x70'));})[_0x67ae('0x26')](function(_0x2c7902){if(_0x2c7902){logger[_0x67ae('0x2d')](_0x67ae('0x86'),_0x2c7902['id']);}})[_0x67ae('0x36')](function(_0xbefed0){logger['error']('['+_0x18835e[_0x67ae('0x61')][_0x67ae('0x91')]()+']',JSON[_0x67ae('0xe')](_0xbefed0));});}; \ 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 8cdff64..9b426bc 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(_0x3318d6,_0x5964da){var _0x4d4418=function(_0x3f1ce1){while(--_0x3f1ce1){_0x3318d6['push'](_0x3318d6['shift']());}};_0x4d4418(++_0x5964da);}(_0x7a54,0x106));var _0x47a5=function(_0x57d42f,_0x34a8d7){_0x57d42f=_0x57d42f-0x0;var _0xbbd36f=_0x7a54[_0x57d42f];return _0xbbd36f;};'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(_0x24d3ab,_0x45bb09){var _0x6fc4e7=function(_0x202fd6){while(--_0x202fd6){_0x24d3ab['push'](_0x24d3ab['shift']());}};_0x6fc4e7(++_0x45bb09);}(_0x7a54,0x106));var _0x47a5=function(_0x2a810e,_0x4ce547){_0x2a810e=_0x2a810e-0x0;var _0x4ffde0=_0x7a54[_0x2a810e];return _0x4ffde0;};'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 2d44c34..b92c66c 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 _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x169506,_0x3a4891){var _0x310dbc=function(_0x39ea78){while(--_0x39ea78){_0x169506['push'](_0x169506['shift']());}};_0x310dbc(++_0x3a4891);}(_0x7a54,0x106));var _0x47a5=function(_0x378126,_0x3769f2){_0x378126=_0x378126-0x0;var _0x6c4e38=_0x7a54[_0x378126];return _0x6c4e38;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ 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(_0x478596,_0x1329fd){var _0x125d65=function(_0x4c9306){while(--_0x4c9306){_0x478596['push'](_0x478596['shift']());}};_0x125d65(++_0x1329fd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x55aea5,_0x167e99){_0x55aea5=_0x55aea5-0x0;var _0x1ee183=_0x5f2f[_0x55aea5];return _0x1ee183;};'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 dbb00ea..4c71bbf 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 _0x32ff=['rpc','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','error'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0x32ff,0xc7));var _0xf32f=function(_0x324bcd,_0x347993){_0x324bcd=_0x324bcd-0x0;var _0x2a864d=_0x32ff[_0x324bcd];return _0x2a864d;};'use strict';var jayson=require(_0xf32f('0x0'));var BPromise=require(_0xf32f('0x1'));var logger=require(_0xf32f('0x2'))(_0xf32f('0x3'));var client=jayson[_0xf32f('0x4')][_0xf32f('0x5')]({'port':0x2329});client[_0xf32f('0x6')]=function(_0x3ee77b,_0x1f96f0){return new BPromise(function(_0x397240,_0x1f6ca4){return client[_0xf32f('0x7')](_0x3ee77b,_0x1f96f0)[_0xf32f('0x8')](function(_0x5e5080){logger[_0xf32f('0x9')]('rpc',_0xf32f('0x3'),_0x3ee77b,_0x1f96f0,_0x5e5080);if(_0x5e5080[_0xf32f('0xa')]){logger[_0xf32f('0xa')](_0xf32f('0xb'),_0xf32f('0x3'),_0x3ee77b,_0x5e5080[_0xf32f('0xa')][_0xf32f('0xc')],_0x1f96f0);return _0x1f6ca4(_0x5e5080[_0xf32f('0xa')]['message']);}else{return _0x397240(_0x5e5080['result']);}})[_0xf32f('0xd')](function(_0x55ef47){logger['error'](_0xf32f('0xb'),_0xf32f('0x3'),_0x3ee77b,_0x55ef47,_0x1f96f0);return _0x1f6ca4(_0x55ef47);});});};module[_0xf32f('0xe')]=client; \ No newline at end of file +var _0x95f4=['exports','jayson/promise','bluebird','../../config/logger','http','Request','request','debug','rpc','error','message','catch'];(function(_0x1d5d49,_0x2c2b65){var _0x3cfb67=function(_0x2c829a){while(--_0x2c829a){_0x1d5d49['push'](_0x1d5d49['shift']());}};_0x3cfb67(++_0x2c2b65);}(_0x95f4,0xf1));var _0x495f=function(_0x1059f5,_0x302f68){_0x1059f5=_0x1059f5-0x0;var _0x38e23c=_0x95f4[_0x1059f5];return _0x38e23c;};'use strict';var jayson=require(_0x495f('0x0'));var BPromise=require(_0x495f('0x1'));var logger=require(_0x495f('0x2'))('routing');var client=jayson['client'][_0x495f('0x3')]({'port':0x2329});client[_0x495f('0x4')]=function(_0x5edb36,_0x501377){return new BPromise(function(_0x87cc22,_0x22465d){return client[_0x495f('0x5')](_0x5edb36,_0x501377)['then'](function(_0x704a46){logger[_0x495f('0x6')](_0x495f('0x7'),'routing',_0x5edb36,_0x501377,_0x704a46);if(_0x704a46[_0x495f('0x8')]){logger[_0x495f('0x8')](_0x495f('0x7'),'routing',_0x5edb36,_0x704a46['error'][_0x495f('0x9')],_0x501377);return _0x22465d(_0x704a46['error'][_0x495f('0x9')]);}else{return _0x87cc22(_0x704a46['result']);}})[_0x495f('0xa')](function(_0x41aa07){logger[_0x495f('0x8')](_0x495f('0x7'),'routing',_0x5edb36,_0x41aa07,_0x501377);return _0x22465d(_0x41aa07);});});};module[_0x495f('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 6526a94..b3889d9 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 _0xf8af=['./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','then','getMailAccounts','initMailAccounts','mailAccounts','Setting','findOne','loginMailFrequency','catch','log','bluebird'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xf8af,0x8b));var _0xff8a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf8af[_0x2be8c2];return _0x97f531;};'use strict';var BPromise=require(_0xff8a('0x0'));var server=require('./server');var Realtime=require(_0xff8a('0x1'));var EmailChannel=require(_0xff8a('0x2'));var mailAccount=require(_0xff8a('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xff8a('0x4'))['db'];function initRealtime(){return BPromise['resolve']()[_0xff8a('0x5')](mailAccount[_0xff8a('0x6')]())[_0xff8a('0x5')](realtime[_0xff8a('0x7')]())['then'](function(){email['refresh'](realtime[_0xff8a('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xff8a('0x5')](function(_0x406e06){return initRealtime();})[_0xff8a('0x5')](function(_0x1ce66c){return db[_0xff8a('0x9')][_0xff8a('0xa')]({'attributes':['id',_0xff8a('0xb')],'raw':!![]});})[_0xff8a('0x5')](function(_0x3bb1ba){return setInterval(initRealtime,_0x3bb1ba[_0xff8a('0xb')]*0x3e8);})[_0xff8a('0xc')](function(_0x5a31cb){console[_0xff8a('0xd')](_0x5a31cb);});}main(); \ No newline at end of file +var _0x8a5c=['catch','log','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency'];(function(_0x5664f6,_0x2a7278){var _0x3a1996=function(_0x566f33){while(--_0x566f33){_0x5664f6['push'](_0x5664f6['shift']());}};_0x3a1996(++_0x2a7278);}(_0x8a5c,0x112));var _0xc8a5=function(_0x2e2cd0,_0x2d726b){_0x2e2cd0=_0x2e2cd0-0x0;var _0x59d31c=_0x8a5c[_0x2e2cd0];return _0x59d31c;};'use strict';var BPromise=require('bluebird');var server=require(_0xc8a5('0x0'));var Realtime=require(_0xc8a5('0x1'));var EmailChannel=require(_0xc8a5('0x2'));var mailAccount=require(_0xc8a5('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xc8a5('0x4'))['db'];function initRealtime(){return BPromise['resolve']()[_0xc8a5('0x5')](mailAccount[_0xc8a5('0x6')]())['then'](realtime[_0xc8a5('0x7')]())['then'](function(){email[_0xc8a5('0x8')](realtime[_0xc8a5('0x9')]);return realtime;});}function main(){return server[_0xc8a5('0xa')](realtime,email)[_0xc8a5('0x5')](function(_0x276c15){return initRealtime();})[_0xc8a5('0x5')](function(_0x1de487){return db[_0xc8a5('0xb')][_0xc8a5('0xc')]({'attributes':['id',_0xc8a5('0xd')],'raw':!![]});})[_0xc8a5('0x5')](function(_0x1a5d79){return setInterval(initRealtime,_0x1a5d79[_0xc8a5('0xd')]*0x3e8);})[_0xc8a5('0xe')](function(_0x270030){console[_0xc8a5('0xf')](_0x270030);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c1cc731..5d1c85b 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 _0xa2c1=['New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','localhost','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','prototype','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','connected','messages','info'];(function(_0x637d19,_0x193894){var _0x4d9842=function(_0x11938f){while(--_0x11938f){_0x637d19['push'](_0x637d19['shift']());}};_0x4d9842(++_0x193894);}(_0xa2c1,0x7b));var _0x1a2c=function(_0x115a89,_0x24c57d){_0x115a89=_0x115a89-0x0;var _0x5945d9=_0xa2c1[_0x115a89];return _0x5945d9;};'use strict';var _=require(_0x1a2c('0x0'));var moment=require(_0x1a2c('0x1'));var BPromise=require(_0x1a2c('0x2'));var md5=require(_0x1a2c('0x3'));var Redis=require(_0x1a2c('0x4'));var config=require(_0x1a2c('0x5'));var logger=require('../../../config/logger')(_0x1a2c('0x6'));config[_0x1a2c('0x7')]=_['defaults'](config[_0x1a2c('0x7')],{'host':_0x1a2c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1a2c('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x1a2c('0x9'));var md5Accounts={};function EmailChannel(_0x3b4cec){logger['info']('start\x20email\x20channel');this['mailAccounts']=_0x3b4cec[_0x1a2c('0xa')];this[_0x1a2c('0xb')]={};this[_0x1a2c('0xc')]=new EmailSmtp();}EmailChannel['prototype'][_0x1a2c('0xd')]=function(_0x4457c6){var _0x3ee8b8=this[_0x1a2c('0xa')][_0x4457c6];var _0x5f59b3={'id':_0x3ee8b8['id'],'name':_0x3ee8b8[_0x1a2c('0xe')],'key':_0x3ee8b8[_0x1a2c('0xf')],'active':_0x3ee8b8[_0x1a2c('0x10')],'Imap':{'status':_0x3ee8b8[_0x1a2c('0x11')][_0x1a2c('0x12')],'messageStatus':_0x3ee8b8[_0x1a2c('0x11')][_0x1a2c('0x13')],'total':_0x3ee8b8[_0x1a2c('0x11')][_0x1a2c('0x14')]}};if(_[_0x1a2c('0x15')](md5Accounts[_0x4457c6])){md5Accounts[_0x4457c6]={};}var _0xb688d0=md5(JSON[_0x1a2c('0x16')](_0x5f59b3));if(md5Accounts[_0x4457c6][_0x1a2c('0x3')]!==_0xb688d0){md5Accounts[_0x4457c6][_0x1a2c('0x3')]=_0xb688d0;io[_0x1a2c('0xd')]('mailAccount:update',_0x5f59b3);}};EmailChannel[_0x1a2c('0x17')][_0x1a2c('0x18')]=function(_0x3ceafa){for(var _0x45eeec in _0x3ceafa){if(_0x3ceafa[_0x1a2c('0x19')](_0x45eeec)){if(_0x3ceafa[_0x45eeec][_0x1a2c('0x11')]&&_0x3ceafa[_0x45eeec][_0x1a2c('0x10')]){var _0x162533=_0x3ceafa[_0x45eeec][_0x1a2c('0x11')];if(!this[_0x1a2c('0xb')]['hasOwnProperty'](_0x162533['id'])){this[_0x1a2c('0xb')][_0x162533['id']]=new EmailImap(_0x162533,_0x3ceafa[_0x45eeec][_0x1a2c('0x6')]);this[_0x1a2c('0xb')][_0x162533['id']]['on'](_0x1a2c('0x1a'),this[_0x1a2c('0x1b')][_0x1a2c('0x1c')](this,_0x45eeec));this['imapAccounts'][_0x162533['id']]['on'](_0x1a2c('0x6'),this[_0x1a2c('0x1d')][_0x1a2c('0x1c')](this,_0x45eeec));this[_0x1a2c('0xb')][_0x162533['id']]['on'](_0x1a2c('0x1e'),this[_0x1a2c('0x1f')][_0x1a2c('0x1c')](this,_0x45eeec));this[_0x1a2c('0xb')][_0x162533['id']]['on'](_0x1a2c('0x20'),this['handleImapError'][_0x1a2c('0x1c')](this,_0x45eeec));}}else{if(_['isNil'](this[_0x1a2c('0xa')][_0x45eeec]['Imap'])){this[_0x1a2c('0xa')][_0x45eeec]['Imap']={};}this[_0x1a2c('0xa')][_0x45eeec][_0x1a2c('0x11')][_0x1a2c('0x12')]='disabled';this[_0x1a2c('0xa')][_0x45eeec][_0x1a2c('0x11')][_0x1a2c('0x13')]='';this['emit'](_0x45eeec);}}}};EmailChannel[_0x1a2c('0x17')]['handleImapBox']=function(_0x405fb7,_0x1882fe){if(this[_0x1a2c('0xa')][_0x405fb7]){this[_0x1a2c('0xa')][_0x405fb7][_0x1a2c('0x11')][_0x1a2c('0x12')]=_0x1a2c('0x21');this[_0x1a2c('0xa')][_0x405fb7][_0x1a2c('0x11')][_0x1a2c('0x13')]=_0x1882fe[_0x1a2c('0xe')];if(_0x1882fe['messages']){this[_0x1a2c('0xa')][_0x405fb7][_0x1a2c('0x11')][_0x1a2c('0x14')]=_0x1882fe[_0x1a2c('0x22')][_0x1a2c('0x14')];}return this[_0x1a2c('0xd')](_0x405fb7);}};EmailChannel['prototype'][_0x1a2c('0x1d')]=function(_0x5a8636,_0xa5abf4){logger[_0x1a2c('0x23')](_0x1a2c('0x24'),_0xa5abf4[_0x1a2c('0x25')],_0xa5abf4[_0x1a2c('0x26')],_0xa5abf4[_0x1a2c('0x27')],_0x5a8636);if(this[_0x1a2c('0xa')][_0x5a8636]){return mailAccount[_0x1a2c('0x28')](_0x5a8636,_0xa5abf4)['then'](function(_0x3a869a){if(_0x3a869a){logger[_0x1a2c('0x23')]('Mail\x20accepted\x20from\x20routing');}})[_0x1a2c('0x29')](function(_0x3ccc83){logger[_0x1a2c('0x20')](_0x1a2c('0x2a'),JSON[_0x1a2c('0x16')](_0x3ccc83));});}};EmailChannel[_0x1a2c('0x17')][_0x1a2c('0x1f')]=function(_0x3f402d){if(this[_0x1a2c('0xa')][_0x3f402d]&&this[_0x1a2c('0xa')][_0x3f402d][_0x1a2c('0x11')]){if(this[_0x1a2c('0xb')][this[_0x1a2c('0xa')][_0x3f402d]['Imap']['id']]){delete this[_0x1a2c('0xb')][this[_0x1a2c('0xa')][_0x3f402d][_0x1a2c('0x11')]['id']];}this['mailAccounts'][_0x3f402d][_0x1a2c('0x11')][_0x1a2c('0x2b')]=moment();this[_0x1a2c('0xd')](_0x3f402d);}};EmailChannel[_0x1a2c('0x17')][_0x1a2c('0x2c')]=function(_0x5cf2e0,_0xc894bd){if(this[_0x1a2c('0xa')][_0x5cf2e0]){this[_0x1a2c('0xa')][_0x5cf2e0][_0x1a2c('0x11')][_0x1a2c('0x12')]=_0x1a2c('0x20');this[_0x1a2c('0xa')][_0x5cf2e0][_0x1a2c('0x11')][_0x1a2c('0x13')]=_0xc894bd;return this[_0x1a2c('0xd')](_0x5cf2e0);}};EmailChannel['prototype'][_0x1a2c('0x2d')]=function(_0x52cd54,_0x4fdbb0){return this[_0x1a2c('0xc')][_0x1a2c('0x2e')](_0x52cd54,_0x4fdbb0);};EmailChannel['prototype'][_0x1a2c('0x2f')]=function(_0x4ec593){var _0x42f0bd=this;if(this[_0x1a2c('0xa')][_0x4ec593['id']]){if(_[_0x1a2c('0x15')](this[_0x1a2c('0xa')][_0x4ec593['id']][_0x1a2c('0x30')])){this['mailAccounts'][_0x4ec593['id']][_0x1a2c('0x30')]={};}this[_0x1a2c('0xa')][_0x4ec593['id']]['Smtp'][_0x1a2c('0x2b')]=moment();return new BPromise(function(_0x21ca96,_0xcc1504){return _0x42f0bd[_0x1a2c('0xc')][_0x1a2c('0x31')](_0x4ec593)[_0x1a2c('0x32')](function(_0x8cf437){_0x42f0bd['mailAccounts'][_0x4ec593['id']][_0x1a2c('0x30')][_0x1a2c('0x12')]=_0x1a2c('0x33');_0x42f0bd[_0x1a2c('0xa')][_0x4ec593['id']][_0x1a2c('0x30')][_0x1a2c('0x13')]='';_0x42f0bd[_0x1a2c('0xd')](_0x4ec593['id']);_0x21ca96(_0x8cf437);})['catch'](function(_0x59b9d9){_0x42f0bd[_0x1a2c('0xa')][_0x4ec593['id']][_0x1a2c('0x30')][_0x1a2c('0x12')]=_0x1a2c('0x20');_0x42f0bd[_0x1a2c('0xa')][_0x4ec593['id']][_0x1a2c('0x30')][_0x1a2c('0x13')]=_0x59b9d9;_0x42f0bd[_0x1a2c('0xd')](_0x4ec593['id']);_0xcc1504(_0x59b9d9);});});}return this[_0x1a2c('0xc')]['verify'](_0x4ec593);};module[_0x1a2c('0x34')]=EmailChannel; \ No newline at end of file +var _0xde82=['catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','md5','ioredis','../../../config/environment','email','defaults','redis','localhost','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','name','key','active','Imap','messageStatus','isNil','stringify','emit','mailAccount:update','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','error','status','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing'];(function(_0x3a10e3,_0x3cdb35){var _0xf067c8=function(_0x184beb){while(--_0x184beb){_0x3a10e3['push'](_0x3a10e3['shift']());}};_0xf067c8(++_0x3cdb35);}(_0xde82,0x1c4));var _0x2de8=function(_0x18a36b,_0x2d3e5f){_0x18a36b=_0x18a36b-0x0;var _0x58d4c3=_0xde82[_0x18a36b];return _0x58d4c3;};'use strict';var _=require(_0x2de8('0x0'));var moment=require(_0x2de8('0x1'));var BPromise=require('bluebird');var md5=require(_0x2de8('0x2'));var Redis=require(_0x2de8('0x3'));var config=require(_0x2de8('0x4'));var logger=require('../../../config/logger')(_0x2de8('0x5'));config['redis']=_[_0x2de8('0x6')](config[_0x2de8('0x7')],{'host':_0x2de8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2de8('0x7')]));var EmailImap=require(_0x2de8('0x9'));var EmailSmtp=require(_0x2de8('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3aba5b){logger[_0x2de8('0xb')]('start\x20email\x20channel');this[_0x2de8('0xc')]=_0x3aba5b['mailAccounts'];this[_0x2de8('0xd')]={};this[_0x2de8('0xe')]=new EmailSmtp();}EmailChannel[_0x2de8('0xf')]['emit']=function(_0x5a17fe){var _0x251f0f=this[_0x2de8('0xc')][_0x5a17fe];var _0x5db200={'id':_0x251f0f['id'],'name':_0x251f0f[_0x2de8('0x10')],'key':_0x251f0f[_0x2de8('0x11')],'active':_0x251f0f[_0x2de8('0x12')],'Imap':{'status':_0x251f0f[_0x2de8('0x13')]['status'],'messageStatus':_0x251f0f[_0x2de8('0x13')][_0x2de8('0x14')],'total':_0x251f0f[_0x2de8('0x13')]['total']}};if(_[_0x2de8('0x15')](md5Accounts[_0x5a17fe])){md5Accounts[_0x5a17fe]={};}var _0x5b30d7=md5(JSON[_0x2de8('0x16')](_0x5db200));if(md5Accounts[_0x5a17fe][_0x2de8('0x2')]!==_0x5b30d7){md5Accounts[_0x5a17fe][_0x2de8('0x2')]=_0x5b30d7;io[_0x2de8('0x17')](_0x2de8('0x18'),_0x5db200);}};EmailChannel[_0x2de8('0xf')][_0x2de8('0x19')]=function(_0x507810){for(var _0x3a65f9 in _0x507810){if(_0x507810[_0x2de8('0x1a')](_0x3a65f9)){if(_0x507810[_0x3a65f9][_0x2de8('0x13')]&&_0x507810[_0x3a65f9][_0x2de8('0x12')]){var _0x18fbc6=_0x507810[_0x3a65f9]['Imap'];if(!this['imapAccounts'][_0x2de8('0x1a')](_0x18fbc6['id'])){this['imapAccounts'][_0x18fbc6['id']]=new EmailImap(_0x18fbc6,_0x507810[_0x3a65f9][_0x2de8('0x5')]);this[_0x2de8('0xd')][_0x18fbc6['id']]['on']('box',this[_0x2de8('0x1b')][_0x2de8('0x1c')](this,_0x3a65f9));this['imapAccounts'][_0x18fbc6['id']]['on'](_0x2de8('0x5'),this[_0x2de8('0x1d')][_0x2de8('0x1c')](this,_0x3a65f9));this[_0x2de8('0xd')][_0x18fbc6['id']]['on'](_0x2de8('0x1e'),this['handleImapEnd'][_0x2de8('0x1c')](this,_0x3a65f9));this[_0x2de8('0xd')][_0x18fbc6['id']]['on'](_0x2de8('0x1f'),this['handleImapError'][_0x2de8('0x1c')](this,_0x3a65f9));}}else{if(_['isNil'](this['mailAccounts'][_0x3a65f9]['Imap'])){this[_0x2de8('0xc')][_0x3a65f9][_0x2de8('0x13')]={};}this[_0x2de8('0xc')][_0x3a65f9][_0x2de8('0x13')][_0x2de8('0x20')]=_0x2de8('0x21');this['mailAccounts'][_0x3a65f9]['Imap'][_0x2de8('0x14')]='';this[_0x2de8('0x17')](_0x3a65f9);}}}};EmailChannel[_0x2de8('0xf')][_0x2de8('0x1b')]=function(_0x1b1b18,_0x22c7b5){if(this[_0x2de8('0xc')][_0x1b1b18]){this[_0x2de8('0xc')][_0x1b1b18][_0x2de8('0x13')][_0x2de8('0x20')]=_0x2de8('0x22');this[_0x2de8('0xc')][_0x1b1b18][_0x2de8('0x13')][_0x2de8('0x14')]=_0x22c7b5[_0x2de8('0x10')];if(_0x22c7b5[_0x2de8('0x23')]){this['mailAccounts'][_0x1b1b18][_0x2de8('0x13')]['total']=_0x22c7b5['messages'][_0x2de8('0x24')];}return this[_0x2de8('0x17')](_0x1b1b18);}};EmailChannel[_0x2de8('0xf')][_0x2de8('0x1d')]=function(_0xdf6a82,_0xa873da){logger[_0x2de8('0xb')](_0x2de8('0x25'),_0xa873da[_0x2de8('0x26')],_0xa873da['lastName'],_0xa873da[_0x2de8('0x27')],_0xdf6a82);if(this[_0x2de8('0xc')][_0xdf6a82]){return mailAccount[_0x2de8('0x28')](_0xdf6a82,_0xa873da)[_0x2de8('0x29')](function(_0xc18996){if(_0xc18996){logger['info'](_0x2de8('0x2a'));}})[_0x2de8('0x2b')](function(_0x5ed9cb){logger[_0x2de8('0x1f')](_0x2de8('0x2c'),JSON[_0x2de8('0x16')](_0x5ed9cb));});}};EmailChannel['prototype'][_0x2de8('0x2d')]=function(_0x4904f0){if(this[_0x2de8('0xc')][_0x4904f0]&&this[_0x2de8('0xc')][_0x4904f0][_0x2de8('0x13')]){if(this[_0x2de8('0xd')][this[_0x2de8('0xc')][_0x4904f0][_0x2de8('0x13')]['id']]){delete this['imapAccounts'][this[_0x2de8('0xc')][_0x4904f0][_0x2de8('0x13')]['id']];}this[_0x2de8('0xc')][_0x4904f0][_0x2de8('0x13')][_0x2de8('0x2e')]=moment();this[_0x2de8('0x17')](_0x4904f0);}};EmailChannel['prototype'][_0x2de8('0x2f')]=function(_0x428198,_0x455b9c){if(this['mailAccounts'][_0x428198]){this[_0x2de8('0xc')][_0x428198][_0x2de8('0x13')][_0x2de8('0x20')]=_0x2de8('0x1f');this[_0x2de8('0xc')][_0x428198][_0x2de8('0x13')]['messageStatus']=_0x455b9c;return this[_0x2de8('0x17')](_0x428198);}};EmailChannel['prototype'][_0x2de8('0x30')]=function(_0x303005,_0x536324){return this[_0x2de8('0xe')][_0x2de8('0x31')](_0x303005,_0x536324);};EmailChannel[_0x2de8('0xf')][_0x2de8('0x32')]=function(_0x40c8bc){var _0x3a63c4=this;if(this[_0x2de8('0xc')][_0x40c8bc['id']]){if(_[_0x2de8('0x15')](this['mailAccounts'][_0x40c8bc['id']][_0x2de8('0x33')])){this[_0x2de8('0xc')][_0x40c8bc['id']][_0x2de8('0x33')]={};}this[_0x2de8('0xc')][_0x40c8bc['id']]['Smtp'][_0x2de8('0x2e')]=moment();return new BPromise(function(_0x12364f,_0x37ce5c){return _0x3a63c4[_0x2de8('0xe')][_0x2de8('0x34')](_0x40c8bc)[_0x2de8('0x29')](function(_0x5908bc){_0x3a63c4['mailAccounts'][_0x40c8bc['id']][_0x2de8('0x33')]['status']=_0x2de8('0x35');_0x3a63c4['mailAccounts'][_0x40c8bc['id']][_0x2de8('0x33')][_0x2de8('0x14')]='';_0x3a63c4[_0x2de8('0x17')](_0x40c8bc['id']);_0x12364f(_0x5908bc);})['catch'](function(_0x3bc65a){_0x3a63c4[_0x2de8('0xc')][_0x40c8bc['id']][_0x2de8('0x33')][_0x2de8('0x20')]=_0x2de8('0x1f');_0x3a63c4[_0x2de8('0xc')][_0x40c8bc['id']][_0x2de8('0x33')]['messageStatus']=_0x3bc65a;_0x3a63c4[_0x2de8('0x17')](_0x40c8bc['id']);_0x37ce5c(_0x3bc65a);});});}return this[_0x2de8('0xe')][_0x2de8('0x34')](_0x40c8bc);};module[_0x2de8('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index c420da9..b2020e8 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 _0xaabc=['events','EventEmitter','./utils','../../../config/logger','mailbox','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','password','host','port','tls','autotls','required','user','getHost','email','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','stringify','textCode','upperFirst','exports','util','imap','randomstring','mailparser','simpleParser','iconv','Iconv'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xaabc,0x13e));var _0xcaab=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xaabc[_0x2300c7];return _0x23f720;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xcaab('0x0'));var Imap=require(_0xcaab('0x1'));var _=require('lodash');var rs=require(_0xcaab('0x2'));var simpleParser=require(_0xcaab('0x3'))[_0xcaab('0x4')];var Iconv=require(_0xcaab('0x5'))[_0xcaab('0x6')];var EventEmitter=require(_0xcaab('0x7'))[_0xcaab('0x8')];var utils=require(_0xcaab('0x9'));var logger=require(_0xcaab('0xa'))('email');function EmailImap(_0x238f7a,_0x3b8185){this[_0xcaab('0xb')]='INBOX';this['account']=this[_0xcaab('0xc')](_0x238f7a,_0x3b8185);this['imap']=new Imap(this['account']);this[_0xcaab('0x1')][_0xcaab('0xd')](_0xcaab('0xe'),this[_0xcaab('0xf')][_0xcaab('0x10')](this));this[_0xcaab('0x1')][_0xcaab('0xd')](_0xcaab('0x11'),this[_0xcaab('0x12')][_0xcaab('0x10')](this));this[_0xcaab('0x1')]['on'](_0xcaab('0x13'),this[_0xcaab('0x14')][_0xcaab('0x10')](this));this[_0xcaab('0x1')][_0xcaab('0x15')]();}util[_0xcaab('0x16')](EmailImap,EventEmitter);EmailImap[_0xcaab('0x17')]['getAccount']=function(_0x924fd1,_0x402f44){var _0x4f40f5={'connTimeout':_0x924fd1['connTimeout']?_0x924fd1[_0xcaab('0x18')]*0x3e8:0x2710,'authTimeout':_0x924fd1[_0xcaab('0x19')]?_0x924fd1[_0xcaab('0x19')]*0x3e8:0x1388};if(_[_0xcaab('0x1a')](_0x924fd1[_0xcaab('0x1b')])){if(_0x924fd1[_0xcaab('0x1c')]){_0x4f40f5['user']=_0x924fd1['user'];_0x4f40f5['password']=_0x924fd1[_0xcaab('0x1d')];}_0x4f40f5[_0xcaab('0x1e')]=_0x924fd1['host'];_0x4f40f5[_0xcaab('0x1f')]=_0x924fd1[_0xcaab('0x1f')]||0x3e1;if(_0x924fd1[_0xcaab('0x20')]){_0x4f40f5[_0xcaab('0x20')]=!![];}else{_0x4f40f5[_0xcaab('0x20')]=![];_0x4f40f5[_0xcaab('0x21')]=_0xcaab('0x22');}}else{_0x4f40f5[_0xcaab('0x23')]=_0x924fd1['user'];_0x4f40f5['password']=_0x924fd1[_0xcaab('0x1d')];_0x4f40f5['host']=utils[_0xcaab('0x24')](_0x924fd1['service']);_0x4f40f5['port']=0x3e1;_0x4f40f5[_0xcaab('0x20')]=!![];}_0x4f40f5[_0xcaab('0x25')]=_0x402f44||_0x924fd1['user']||_0xcaab('0x26');return _0x4f40f5;};EmailImap[_0xcaab('0x17')][_0xcaab('0xf')]=function(){this[_0xcaab('0x1')][_0xcaab('0x27')](this['mailbox'],![],this[_0xcaab('0x28')][_0xcaab('0x10')](this));};EmailImap[_0xcaab('0x17')][_0xcaab('0x28')]=function(_0x541359,_0x2a52aa){if(_0x541359){this[_0xcaab('0x14')](_0x541359,!![]);}else{this[_0xcaab('0x29')](_0xcaab('0x2a'),_0x2a52aa);this[_0xcaab('0x2b')]();}};EmailImap[_0xcaab('0x17')][_0xcaab('0x2c')]=function(_0x5d2d9a){if(_0x5d2d9a){this['handleError'](_0x5d2d9a,!![]);}else{this['imap'][_0xcaab('0x11')]();}};EmailImap[_0xcaab('0x17')][_0xcaab('0x2b')]=function(){this[_0xcaab('0x1')][_0xcaab('0x2d')]([_0xcaab('0x2e')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype']['handleReadUnseen']=function(_0xb0da40,_0x284720){if(_0xb0da40){this[_0xcaab('0x14')](_0xb0da40,!![]);}else{if(_0x284720[_0xcaab('0x2f')]){try{var _0x38621c=this[_0xcaab('0x1')][_0xcaab('0x30')](_0x284720,{'bodies':'','markSeen':!![]});_0x38621c['on']('message',this[_0xcaab('0x31')][_0xcaab('0x10')](this));_0x38621c[_0xcaab('0xd')](_0xcaab('0x13'),this[_0xcaab('0x32')][_0xcaab('0x10')](this));_0x38621c['once'](_0xcaab('0x11'),this[_0xcaab('0x33')][_0xcaab('0x10')](this));}catch(_0x3648c8){logger[_0xcaab('0x13')](_0x3648c8);}}else{this[_0xcaab('0x1')][_0xcaab('0x34')](!![],this[_0xcaab('0x2c')][_0xcaab('0x10')](this));}}};EmailImap[_0xcaab('0x17')][_0xcaab('0x31')]=function(_0x5debc1,_0x596156){_0x5debc1['on'](_0xcaab('0x35'),this[_0xcaab('0x36')][_0xcaab('0x10')](this));_0x5debc1[_0xcaab('0xd')](_0xcaab('0x37'),this[_0xcaab('0x38')][_0xcaab('0x10')](this));_0x5debc1['once'](_0xcaab('0x11'),this[_0xcaab('0x39')][_0xcaab('0x10')](this));};EmailImap[_0xcaab('0x17')][_0xcaab('0x36')]=function(_0xe4a33f,_0x24ef4f){simpleParser(_0xe4a33f,{'Iconv':Iconv},this[_0xcaab('0x3a')][_0xcaab('0x10')](this));};EmailImap[_0xcaab('0x17')][_0xcaab('0x38')]=function(_0x457a5a){};EmailImap[_0xcaab('0x17')][_0xcaab('0x39')]=function(){};EmailImap[_0xcaab('0x17')]['handleSimpleParser']=function(_0x2b501c,_0xb1935){if(_0x2b501c){logger[_0xcaab('0x13')](_0x2b501c);}else{var _0xdc4752=this;utils[_0xcaab('0x3b')](this[_0xcaab('0x3c')],_0xb1935,function(_0x540e4d){_0xdc4752[_0xcaab('0x29')](_0xcaab('0x25'),_0x540e4d);});}};EmailImap[_0xcaab('0x17')][_0xcaab('0x33')]=function(){this[_0xcaab('0x1')][_0xcaab('0x34')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xcaab('0x17')][_0xcaab('0x32')]=function(_0x228050){this[_0xcaab('0x14')](_0x228050);this['imap']['closeBox'](!![],this[_0xcaab('0x2c')]['bind'](this));};EmailImap[_0xcaab('0x17')][_0xcaab('0x12')]=function(){this[_0xcaab('0x29')](_0xcaab('0x11'));};EmailImap['prototype'][_0xcaab('0x14')]=function(_0x4e0007,_0x101f30){logger[_0xcaab('0x13')](_0xcaab('0x14'),this[_0xcaab('0x3c')]['email'],JSON[_0xcaab('0x3d')](_0x4e0007));var _0x49c86d='';if(_0x4e0007){if(_0x4e0007[_0xcaab('0x3e')]){_0x49c86d=_0x4e0007['textCode'];}else{for(var _0x3da6ca in _0x4e0007){if(_0x4e0007['hasOwnProperty'](_0x3da6ca)){_0x49c86d+=_[_0xcaab('0x3f')](_0x3da6ca)+':\x20'+_0x4e0007[_0x3da6ca]+'\x0a';}}}}if(_0x101f30){this[_0xcaab('0x1')]['end']();}else{this[_0xcaab('0x29')]('error',_0x49c86d);this[_0xcaab('0x29')](_0xcaab('0x11'));}};module[_0xcaab('0x40')]=EmailImap; \ No newline at end of file +var _0xfce8=['handleSimpleParser','stringify','textCode','upperFirst','exports','path','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','getHost','email','anonymous@xcally.com','prototype','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfce8,0xf9));var _0x8fce=function(_0x1c1f72,_0x219e0b){_0x1c1f72=_0x1c1f72-0x0;var _0x4baf14=_0xfce8[_0x1c1f72];return _0x4baf14;};'use strict';var fs=require('fs');var path=require(_0x8fce('0x0'));var util=require('util');var Imap=require(_0x8fce('0x1'));var _=require(_0x8fce('0x2'));var rs=require(_0x8fce('0x3'));var simpleParser=require(_0x8fce('0x4'))[_0x8fce('0x5')];var Iconv=require(_0x8fce('0x6'))[_0x8fce('0x7')];var EventEmitter=require(_0x8fce('0x8'))[_0x8fce('0x9')];var utils=require(_0x8fce('0xa'));var logger=require(_0x8fce('0xb'))('email');function EmailImap(_0x392070,_0x822489){this['mailbox']='INBOX';this[_0x8fce('0xc')]=this[_0x8fce('0xd')](_0x392070,_0x822489);this[_0x8fce('0x1')]=new Imap(this['account']);this[_0x8fce('0x1')][_0x8fce('0xe')](_0x8fce('0xf'),this[_0x8fce('0x10')][_0x8fce('0x11')](this));this[_0x8fce('0x1')][_0x8fce('0xe')](_0x8fce('0x12'),this[_0x8fce('0x13')]['bind'](this));this['imap']['on'](_0x8fce('0x14'),this[_0x8fce('0x15')][_0x8fce('0x11')](this));this[_0x8fce('0x1')][_0x8fce('0x16')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x8fce('0xd')]=function(_0x580102,_0x86dc8f){var _0x4b9947={'connTimeout':_0x580102['connTimeout']?_0x580102[_0x8fce('0x17')]*0x3e8:0x2710,'authTimeout':_0x580102['authTimeout']?_0x580102[_0x8fce('0x18')]*0x3e8:0x1388};if(_[_0x8fce('0x19')](_0x580102[_0x8fce('0x1a')])){if(_0x580102[_0x8fce('0x1b')]){_0x4b9947[_0x8fce('0x1c')]=_0x580102['user'];_0x4b9947[_0x8fce('0x1d')]=_0x580102['password'];}_0x4b9947['host']=_0x580102[_0x8fce('0x1e')];_0x4b9947[_0x8fce('0x1f')]=_0x580102[_0x8fce('0x1f')]||0x3e1;if(_0x580102[_0x8fce('0x20')]){_0x4b9947['tls']=!![];}else{_0x4b9947[_0x8fce('0x20')]=![];_0x4b9947['autotls']=_0x8fce('0x21');}}else{_0x4b9947[_0x8fce('0x1c')]=_0x580102[_0x8fce('0x1c')];_0x4b9947['password']=_0x580102[_0x8fce('0x1d')];_0x4b9947[_0x8fce('0x1e')]=utils[_0x8fce('0x22')](_0x580102[_0x8fce('0x1a')]);_0x4b9947[_0x8fce('0x1f')]=0x3e1;_0x4b9947[_0x8fce('0x20')]=!![];}_0x4b9947[_0x8fce('0x23')]=_0x86dc8f||_0x580102[_0x8fce('0x1c')]||_0x8fce('0x24');return _0x4b9947;};EmailImap[_0x8fce('0x25')][_0x8fce('0x10')]=function(){this[_0x8fce('0x1')][_0x8fce('0x26')](this[_0x8fce('0x27')],![],this['handleOpenBox'][_0x8fce('0x11')](this));};EmailImap[_0x8fce('0x25')][_0x8fce('0x28')]=function(_0x23ca9e,_0x20a102){if(_0x23ca9e){this['handleError'](_0x23ca9e,!![]);}else{this[_0x8fce('0x29')](_0x8fce('0x2a'),_0x20a102);this[_0x8fce('0x2b')]();}};EmailImap[_0x8fce('0x25')][_0x8fce('0x2c')]=function(_0x2487ef){if(_0x2487ef){this[_0x8fce('0x15')](_0x2487ef,!![]);}else{this[_0x8fce('0x1')][_0x8fce('0x12')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x8fce('0x2d')]([_0x8fce('0x2e')],this['handleReadUnseen'][_0x8fce('0x11')](this));};EmailImap[_0x8fce('0x25')][_0x8fce('0x2f')]=function(_0x312a83,_0x99329c){if(_0x312a83){this[_0x8fce('0x15')](_0x312a83,!![]);}else{if(_0x99329c['length']){try{var _0x54171f=this[_0x8fce('0x1')]['fetch'](_0x99329c,{'bodies':'','markSeen':!![]});_0x54171f['on']('message',this['handleFetchMessage']['bind'](this));_0x54171f[_0x8fce('0xe')]('error',this[_0x8fce('0x30')][_0x8fce('0x11')](this));_0x54171f['once'](_0x8fce('0x12'),this[_0x8fce('0x31')]['bind'](this));}catch(_0x208819){logger[_0x8fce('0x14')](_0x208819);}}else{this[_0x8fce('0x1')][_0x8fce('0x32')](!![],this[_0x8fce('0x2c')][_0x8fce('0x11')](this));}}};EmailImap['prototype'][_0x8fce('0x33')]=function(_0x47c3e3,_0x213c91){_0x47c3e3['on']('body',this['handleMessageBody'][_0x8fce('0x11')](this));_0x47c3e3['once'](_0x8fce('0x34'),this[_0x8fce('0x35')][_0x8fce('0x11')](this));_0x47c3e3[_0x8fce('0xe')](_0x8fce('0x12'),this[_0x8fce('0x36')]['bind'](this));};EmailImap[_0x8fce('0x25')][_0x8fce('0x37')]=function(_0x36764c,_0xe2ccc2){simpleParser(_0x36764c,{'Iconv':Iconv},this[_0x8fce('0x38')]['bind'](this));};EmailImap[_0x8fce('0x25')][_0x8fce('0x35')]=function(_0x5a0ce8){};EmailImap[_0x8fce('0x25')]['handleMessageEnd']=function(){};EmailImap[_0x8fce('0x25')]['handleSimpleParser']=function(_0x4655b5,_0xe21588){if(_0x4655b5){logger[_0x8fce('0x14')](_0x4655b5);}else{var _0x2aec37=this;utils['parser'](this[_0x8fce('0xc')],_0xe21588,function(_0x2cdb70){_0x2aec37[_0x8fce('0x29')]('email',_0x2cdb70);});}};EmailImap[_0x8fce('0x25')]['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this[_0x8fce('0x2c')][_0x8fce('0x11')](this));};EmailImap[_0x8fce('0x25')][_0x8fce('0x30')]=function(_0x29d52f){this[_0x8fce('0x15')](_0x29d52f);this['imap']['closeBox'](!![],this[_0x8fce('0x2c')]['bind'](this));};EmailImap[_0x8fce('0x25')][_0x8fce('0x13')]=function(){this[_0x8fce('0x29')](_0x8fce('0x12'));};EmailImap['prototype'][_0x8fce('0x15')]=function(_0x3a756f,_0x3b0e9f){logger[_0x8fce('0x14')]('handleError',this[_0x8fce('0xc')][_0x8fce('0x23')],JSON[_0x8fce('0x39')](_0x3a756f));var _0x2ed9f0='';if(_0x3a756f){if(_0x3a756f[_0x8fce('0x3a')]){_0x2ed9f0=_0x3a756f['textCode'];}else{for(var _0x40790c in _0x3a756f){if(_0x3a756f['hasOwnProperty'](_0x40790c)){_0x2ed9f0+=_[_0x8fce('0x3b')](_0x40790c)+':\x20'+_0x3a756f[_0x40790c]+'\x0a';}}}}if(_0x3b0e9f){this[_0x8fce('0x1')][_0x8fce('0x12')]();}else{this[_0x8fce('0x29')](_0x8fce('0x14'),_0x2ed9f0);this[_0x8fce('0x29')]('end');}};module[_0x8fce('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 9bb901f..4262d5d 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 _0x4d83=['verify','exports','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','toString'];(function(_0x27ad07,_0x2d3d47){var _0x3148b4=function(_0x3e8f75){while(--_0x3e8f75){_0x27ad07['push'](_0x27ad07['shift']());}};_0x3148b4(++_0x2d3d47);}(_0x4d83,0xf4));var _0x34d8=function(_0x923f9b,_0x911264){_0x923f9b=_0x923f9b-0x0;var _0xfdf48e=_0x4d83[_0x923f9b];return _0xfdf48e;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x34d8('0x0'));var inlineBase64=require(_0x34d8('0x1'));function EmailSmtp(){}EmailSmtp[_0x34d8('0x2')][_0x34d8('0x3')]=function(_0x17815b,_0x4e8ecf){return new BPromise(function(_0x3640d8,_0x536157){var _0x53e764=nodemailer[_0x34d8('0x4')](_0x17815b);_0x53e764[_0x34d8('0x5')](_0x34d8('0x6'),inlineBase64());_0x53e764[_0x34d8('0x7')](_0x4e8ecf,function(_0xd3a043,_0x4b52e4){if(_0xd3a043){_0x536157(_0xd3a043[_0x34d8('0x8')]());}else{_0x3640d8(_0x4b52e4);}});});};EmailSmtp[_0x34d8('0x2')][_0x34d8('0x9')]=function(_0x413b26){return new BPromise(function(_0xb88477,_0x1f1bfa){var _0x5b576c=nodemailer[_0x34d8('0x4')](_0x413b26);_0x5b576c['verify'](function(_0xaa2be3,_0x56952c){if(_0xaa2be3){_0x1f1bfa(_0xaa2be3[_0x34d8('0x8')]());}else{if(_0x56952c){_0xb88477(_0x56952c);}else{_0x1f1bfa('Not\x20verifired');}}});});};module[_0x34d8('0xa')]=EmailSmtp; \ No newline at end of file +var _0x21b3=['sendMail','toString','verify','Not\x20verifired','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','use','compile'];(function(_0x1dce91,_0x175f4b){var _0x33653d=function(_0x145108){while(--_0x145108){_0x1dce91['push'](_0x1dce91['shift']());}};_0x33653d(++_0x175f4b);}(_0x21b3,0x1d2));var _0x321b=function(_0x34b4a4,_0x5decf4){_0x34b4a4=_0x34b4a4-0x0;var _0x2e849d=_0x21b3[_0x34b4a4];return _0x2e849d;};'use strict';var nodemailer=require(_0x321b('0x0'));var BPromise=require(_0x321b('0x1'));var inlineBase64=require(_0x321b('0x2'));function EmailSmtp(){}EmailSmtp[_0x321b('0x3')][_0x321b('0x4')]=function(_0x4c0d61,_0x34694a){return new BPromise(function(_0x238156,_0x2f9eaf){var _0x291bdb=nodemailer['createTransport'](_0x4c0d61);_0x291bdb[_0x321b('0x5')](_0x321b('0x6'),inlineBase64());_0x291bdb[_0x321b('0x7')](_0x34694a,function(_0x1928e7,_0x34af13){if(_0x1928e7){_0x2f9eaf(_0x1928e7[_0x321b('0x8')]());}else{_0x238156(_0x34af13);}});});};EmailSmtp['prototype'][_0x321b('0x9')]=function(_0x2ed685){return new BPromise(function(_0x24655e,_0x39f933){var _0x46a698=nodemailer['createTransport'](_0x2ed685);_0x46a698[_0x321b('0x9')](function(_0x253272,_0x3bb187){if(_0x253272){_0x39f933(_0x253272['toString']());}else{if(_0x3bb187){_0x24655e(_0x3bb187);}else{_0x39f933(_0x321b('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 1a6f814..8ee8438 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 _0x1675=['isEmpty','anonymous','generate','html','replace','body','message','originTo','originCc','includes','bcc','attachments','attach','type','attachment','filename','attachment-','%s-%s','now','server/files/attachments/','writeFileSync','push','from','subject','inReplyTo','format','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','first','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','path','util','node-tnef','email','../../../config/environment','value','address','@xcally.com','head','name','join','split','length','pop'];(function(_0x1cede9,_0x913a29){var _0x12a1f4=function(_0x4c857d){while(--_0x4c857d){_0x1cede9['push'](_0x1cede9['shift']());}};_0x12a1f4(++_0x913a29);}(_0x1675,0x13a));var _0x5167=function(_0x4f0e1a,_0x59b17d){_0x4f0e1a=_0x4f0e1a-0x0;var _0x19a052=_0x1675[_0x4f0e1a];return _0x19a052;};'use strict';var _=require(_0x5167('0x0'));var moment=require('moment');var random=require(_0x5167('0x1'));var fs=require('fs');var path=require(_0x5167('0x2'));var util=require(_0x5167('0x3'));var tnef=require(_0x5167('0x4'));var logger=require('../../../config/logger')(_0x5167('0x5'));var config=require(_0x5167('0x6'));function getAddress(_0x3f7905){var _0x49ca8a=_['head'](_0x3f7905[_0x5167('0x7')]);return _0x49ca8a&&_0x49ca8a[_0x5167('0x8')]?_0x49ca8a['address']:'anonymous'+random['generate'](0x6)+_0x5167('0x9');}function getFirstName(_0x3f4789){var _0x5db454=_[_0x5167('0xa')](_0x3f4789['value']);if(_0x5db454&&_0x5db454['name']){var _0x32420b=_0x5db454[_0x5167('0xb')]['split'](/\s+/);return _0x32420b['length']?_0x32420b['slice'](0x0,-0x1)[_0x5167('0xc')]('\x20'):_0x5db454['name'];}return'Anonymous';}function getLastName(_0x565195){var _0x1eb333=_[_0x5167('0xa')](_0x565195['value']);if(_0x1eb333&&_0x1eb333[_0x5167('0xb')]){var _0x13e2bd=_0x1eb333['name'][_0x5167('0xd')](/\s+/);return _0x13e2bd[_0x5167('0xe')]>0x1?_0x13e2bd[_0x5167('0xf')]():'';}return'';}function getMails(_0x4e7259,_0x1c2f77){var _0x316350='';for(var _0x440d6c=0x0;_0x440d6c<_0x1c2f77[_0x5167('0x7')][_0x5167('0xe')];_0x440d6c+=0x1){if(_0x1c2f77[_0x5167('0x7')][_0x440d6c][_0x5167('0x8')]!==_0x4e7259){if(!_[_0x5167('0x10')](_0x316350)){_0x316350+=',';}_0x316350+=_0x1c2f77['value'][_0x440d6c]['name']||_0x1c2f77['value'][_0x440d6c][_0x5167('0x8')]||'';_0x316350+='\x20<';_0x316350+=_0x1c2f77[_0x5167('0x7')][_0x440d6c][_0x5167('0x8')]?_0x1c2f77['value'][_0x440d6c][_0x5167('0x8')]:_0x5167('0x11')+random[_0x5167('0x12')](0x6)+_0x5167('0x9');_0x316350+='>';}}return _0x316350;}function parseEmail(_0x20858f,_0x1bb1ca,_0x526162){if(_0x1bb1ca[_0x5167('0x13')]){var _0x5b412d=/)<[^<]*)*<\/script>/gi;while(_0x5b412d['test'](_0x1bb1ca[_0x5167('0x13')])){_0x1bb1ca['html']=_0x1bb1ca[_0x5167('0x13')][_0x5167('0x14')](_0x5b412d,'');}_0x526162[_0x5167('0x15')]=_0x1bb1ca[_0x5167('0x13')];}else{_0x526162[_0x5167('0x15')]=_0x1bb1ca['textAsHtml'];}if(_0x526162[_0x5167('0x15')]){_0x526162[_0x5167('0x15')]=_0x526162[_0x5167('0x15')][_0x5167('0x14')](/Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','outlook365','lodash','moment','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','split','slice','join','Anonymous','length','pop','isEmpty','html','test','replace','body','textAsHtml','0x1?_0x2a5be1[_0xa3af('0x13')]():'';}return'';}function getMails(_0x117782,_0xf09d86){var _0x7ad952='';for(var _0x167937=0x0;_0x167937<_0xf09d86[_0xa3af('0x8')][_0xa3af('0x12')];_0x167937+=0x1){if(_0xf09d86['value'][_0x167937][_0xa3af('0x9')]!==_0x117782){if(!_[_0xa3af('0x14')](_0x7ad952)){_0x7ad952+=',';}_0x7ad952+=_0xf09d86[_0xa3af('0x8')][_0x167937][_0xa3af('0xd')]||_0xf09d86['value'][_0x167937][_0xa3af('0x9')]||'';_0x7ad952+='\x20<';_0x7ad952+=_0xf09d86[_0xa3af('0x8')][_0x167937][_0xa3af('0x9')]?_0xf09d86[_0xa3af('0x8')][_0x167937][_0xa3af('0x9')]:'anonymous'+random['generate'](0x6)+_0xa3af('0xc');_0x7ad952+='>';}}return _0x7ad952;}function parseEmail(_0x2f61b4,_0x5a9421,_0x5dfb4c){if(_0x5a9421[_0xa3af('0x15')]){var _0x55619c=/)<[^<]*)*<\/script>/gi;while(_0x55619c[_0xa3af('0x16')](_0x5a9421[_0xa3af('0x15')])){_0x5a9421[_0xa3af('0x15')]=_0x5a9421['html'][_0xa3af('0x17')](_0x55619c,'');}_0x5dfb4c[_0xa3af('0x18')]=_0x5a9421['html'];}else{_0x5dfb4c[_0xa3af('0x18')]=_0x5a9421[_0xa3af('0x19')];}if(_0x5dfb4c[_0xa3af('0x18')]){_0x5dfb4c[_0xa3af('0x18')]=_0x5dfb4c[_0xa3af('0x18')][_0xa3af('0x17')](/0x0){if(this[_0xd6d324+'Capacity']>0x0&&this[_0xd6d324+_0x1420('0x22')]>=this[_0xd6d324+_0x1420('0x23')]){return _0x1420('0x24');}else{return _0x1420('0x25');}}else{return _0x1420('0x26');}};Agent[_0x1420('0x20')]['updateRealtime']=function(){var _0x5efb06=['mail',_0x1420('0x27'),_0x1420('0x28'),_0x1420('0x29'),_0x1420('0x2a'),_0x1420('0x2b')];for(var _0x5aba30=0x0;_0x5aba30<_0x5efb06['length'];_0x5aba30+=0x1){var _0xabedea=this[_0x1420('0x21')](_0x5efb06[_0x5aba30]);if(this[_0x5efb06[_0x5aba30]+_0x1420('0x2c')]!==_0xabedea){this[_0x5efb06[_0x5aba30]+_0x1420('0x2d')]=_[_0x1420('0x2e')](moment()[_0x1420('0x2f')]('x'));}this[_0x5efb06[_0x5aba30]+'Status']=_0xabedea;}var _0x31369b={'id':this['id'],'name':this[_0x1420('0x7')],'online':this[_0x1420('0x8')],'voicePause':this[_0x1420('0x30')],'chatPause':this['chatPause'],'mailPause':this[_0x1420('0xa')],'smsPause':this[_0x1420('0xb')],'faxPause':this[_0x1420('0x31')],'openchannelPause':this[_0x1420('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x1420('0xf')],'chatCapacity':this[_0x1420('0x10')],'chatCurrentCapacity':this[_0x1420('0x11')],'mailStatus':this[_0x1420('0x12')],'mailStatusTime':this[_0x1420('0x32')],'mailCapacity':this[_0x1420('0x33')],'mailCurrentCapacity':this[_0x1420('0x13')],'faxStatus':this[_0x1420('0x14')],'faxStatusTime':this[_0x1420('0x15')],'faxCapacity':this[_0x1420('0x16')],'faxCurrentCapacity':this[_0x1420('0x34')],'smsStatus':this[_0x1420('0x35')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x1420('0x17')],'smsCurrentCapacity':this[_0x1420('0x18')],'whatsappStatus':this[_0x1420('0x19')],'whatsappStatusTime':this[_0x1420('0x36')],'whatsappCapacity':this[_0x1420('0x1a')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x1420('0x37')],'openchannelStatusTime':this[_0x1420('0x1c')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x1420('0x38')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x481ede=md5(JSON[_0x1420('0x39')](_0x31369b));if(this[_0x1420('0x3a')]!==_0x481ede){this[_0x1420('0x3a')]=_0x481ede;io[_0x1420('0x3b')](_0x1420('0x3c'),_0x31369b);}};module[_0x1420('0x3d')]=Agent; \ No newline at end of file +var _0xe5fb=['whatsapp','Status','StatusTime','toNumber','format','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','openchannelStatus','openchannelStatusTime','stringify','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','prototype','mail','chat','openchannel','fax','sms'];(function(_0x14ea94,_0x3af75b){var _0x294e5f=function(_0x401bd1){while(--_0x401bd1){_0x14ea94['push'](_0x14ea94['shift']());}};_0x294e5f(++_0x3af75b);}(_0xe5fb,0xce));var _0xbe5f=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0xe5fb[_0x2dbce7];return _0x3a3ed0;};'use strict';var _=require(_0xbe5f('0x0'));var moment=require(_0xbe5f('0x1'));var md5=require('md5');var Redis=require(_0xbe5f('0x2'));var config=require(_0xbe5f('0x3'));config[_0xbe5f('0x4')]=_['defaults'](config[_0xbe5f('0x4')],{'host':_0xbe5f('0x5'),'port':0x18eb});var io=require(_0xbe5f('0x6'))(new Redis(config[_0xbe5f('0x4')]));function Agent(_0x2b1a47){this['id']=_0x2b1a47['id']||0x0;this['name']=_0x2b1a47[_0xbe5f('0x7')]||'';this[_0xbe5f('0x8')]=_0x2b1a47[_0xbe5f('0x8')]||!![];this[_0xbe5f('0x9')]=_0x2b1a47[_0xbe5f('0x9')]||![];this[_0xbe5f('0xa')]=_0x2b1a47['chatPause']||![];this[_0xbe5f('0xb')]=_0x2b1a47[_0xbe5f('0xb')]||![];this[_0xbe5f('0xc')]=_0x2b1a47[_0xbe5f('0xc')]||![];this[_0xbe5f('0xd')]=_0x2b1a47[_0xbe5f('0xd')]||![];this[_0xbe5f('0xe')]=_0x2b1a47[_0xbe5f('0xe')]||![];this[_0xbe5f('0xf')]=_0xbe5f('0x10');this[_0xbe5f('0x11')]=0x0;this[_0xbe5f('0x12')]=_0x2b1a47['chatCapacity']||0x0;this[_0xbe5f('0x13')]=0x0;this[_0xbe5f('0x14')]=_0xbe5f('0x10');this[_0xbe5f('0x15')]=0x0;this[_0xbe5f('0x16')]=_0x2b1a47[_0xbe5f('0x16')]||0x0;this[_0xbe5f('0x17')]=0x0;this[_0xbe5f('0x18')]=_0xbe5f('0x10');this[_0xbe5f('0x19')]=0x0;this[_0xbe5f('0x1a')]=_0x2b1a47[_0xbe5f('0x1a')]||0x0;this[_0xbe5f('0x1b')]=0x0;this[_0xbe5f('0x1c')]=_0xbe5f('0x10');this[_0xbe5f('0x1d')]=0x0;this[_0xbe5f('0x1e')]=_0x2b1a47[_0xbe5f('0x1e')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']='unknown';this['whatsappStatusTime']=0x0;this[_0xbe5f('0x1f')]=_0x2b1a47[_0xbe5f('0x1f')]||0x0;this[_0xbe5f('0x20')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0xbe5f('0x21')]=_0x2b1a47[_0xbe5f('0x21')]||0x0;this[_0xbe5f('0x22')]=0x0;this[_0xbe5f('0x23')]=![];this[_0xbe5f('0x24')]=undefined;this[_0xbe5f('0x25')]='';this[_0xbe5f('0x26')]();}Agent['prototype'][_0xbe5f('0x27')]=function(_0x37c972){if(this[_0x37c972+_0xbe5f('0x28')]>0x0){if(this[_0x37c972+_0xbe5f('0x29')]>0x0&&this[_0x37c972+_0xbe5f('0x28')]>=this[_0x37c972+_0xbe5f('0x29')]){return _0xbe5f('0x2a');}else{return'working';}}else{return _0xbe5f('0x2b');}};Agent[_0xbe5f('0x2c')]['updateRealtime']=function(){var _0x37b5a9=[_0xbe5f('0x2d'),_0xbe5f('0x2e'),_0xbe5f('0x2f'),_0xbe5f('0x30'),_0xbe5f('0x31'),_0xbe5f('0x32')];for(var _0x5326a5=0x0;_0x5326a5<_0x37b5a9['length'];_0x5326a5+=0x1){var _0x5e85f7=this['getChannelStatus'](_0x37b5a9[_0x5326a5]);if(this[_0x37b5a9[_0x5326a5]+_0xbe5f('0x33')]!==_0x5e85f7){this[_0x37b5a9[_0x5326a5]+_0xbe5f('0x34')]=_[_0xbe5f('0x35')](moment()[_0xbe5f('0x36')]('x'));}this[_0x37b5a9[_0x5326a5]+_0xbe5f('0x33')]=_0x5e85f7;}var _0x1ca5ef={'id':this['id'],'name':this[_0xbe5f('0x7')],'online':this[_0xbe5f('0x8')],'voicePause':this[_0xbe5f('0x9')],'chatPause':this[_0xbe5f('0xa')],'mailPause':this[_0xbe5f('0xb')],'smsPause':this[_0xbe5f('0xd')],'faxPause':this[_0xbe5f('0xc')],'openchannelPause':this[_0xbe5f('0xe')],'chatStatus':this[_0xbe5f('0xf')],'chatStatusTime':this[_0xbe5f('0x11')],'chatCapacity':this[_0xbe5f('0x12')],'chatCurrentCapacity':this[_0xbe5f('0x13')],'mailStatus':this[_0xbe5f('0x14')],'mailStatusTime':this[_0xbe5f('0x15')],'mailCapacity':this[_0xbe5f('0x16')],'mailCurrentCapacity':this[_0xbe5f('0x17')],'faxStatus':this[_0xbe5f('0x18')],'faxStatusTime':this[_0xbe5f('0x19')],'faxCapacity':this[_0xbe5f('0x1a')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xbe5f('0x1d')],'smsCapacity':this[_0xbe5f('0x1e')],'smsCurrentCapacity':this[_0xbe5f('0x37')],'whatsappStatus':this[_0xbe5f('0x38')],'whatsappStatusTime':this[_0xbe5f('0x39')],'whatsappCapacity':this[_0xbe5f('0x1f')],'whatsappCurrentCapacity':this[_0xbe5f('0x20')],'openchannelStatus':this[_0xbe5f('0x3a')],'openchannelStatusTime':this[_0xbe5f('0x3b')],'openchannelCapacity':this[_0xbe5f('0x21')],'openchannelCurrentCapacity':this[_0xbe5f('0x22')],'busy':this['busy'],'busyQueue':this[_0xbe5f('0x24')]};var _0x48c8ed=md5(JSON[_0xbe5f('0x3c')](_0x1ca5ef));if(this[_0xbe5f('0x25')]!==_0x48c8ed){this[_0xbe5f('0x25')]=_0x48c8ed;io[_0xbe5f('0x3d')](_0xbe5f('0x3e'),_0x1ca5ef);}};module[_0xbe5f('0x3f')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index bf2682c..ee33a46 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 _0x5f93=['lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','chatPause','available','format','emit','chat_queue:save','exports'];(function(_0xfd4875,_0x15c2f0){var _0x25dfa4=function(_0x337af0){while(--_0x337af0){_0xfd4875['push'](_0xfd4875['shift']());}};_0x25dfa4(++_0x15c2f0);}(_0x5f93,0x188));var _0x35f9=function(_0x541081,_0x5539e5){_0x541081=_0x541081-0x0;var _0xa4359e=_0x5f93[_0x541081];return _0xa4359e;};'use strict';var _=require(_0x35f9('0x0'));var md5=require(_0x35f9('0x1'));var util=require(_0x35f9('0x2'));var Redis=require(_0x35f9('0x3'));var config=require('../../../config/environment');config[_0x35f9('0x4')]=_[_0x35f9('0x5')](config[_0x35f9('0x4')],{'host':_0x35f9('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35f9('0x4')]));function ChatQueue(_0x50b08f){this['id']=_0x50b08f['id']||0x0;this[_0x35f9('0x7')]=_0x50b08f[_0x35f9('0x7')]||'';this[_0x35f9('0x8')]=_0x50b08f[_0x35f9('0x8')]||0xa;this[_0x35f9('0x9')]=_0x50b08f['strategy']||'beepall';this['Agents']=_0x50b08f[_0x35f9('0xa')];this[_0x35f9('0xb')]={};this[_0x35f9('0xc')]=0x0;this['md5']='';this[_0x35f9('0xd')]();this['updateRealtime']();}ChatQueue[_0x35f9('0xe')][_0x35f9('0xd')]=function(){var _0x366e76=this[_0x35f9('0xb')][_0x35f9('0xf')];this['mapAgentsId']=_[_0x35f9('0x10')](this['Agents'],'id');this[_0x35f9('0xb')][_0x35f9('0xf')]=_0x366e76;};ChatQueue[_0x35f9('0xe')][_0x35f9('0x11')]=function(){this[_0x35f9('0x12')]=0x0;this[_0x35f9('0x13')]=0x0;for(var _0x5acf7b=0x0;_0x5acf7b=0x0?this[_0x35f9('0x17')]:0x0;var _0x9067d0={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x35f9('0x7')],'paused':this[_0x35f9('0x13')],'waiting':this[_0x35f9('0xc')]};var _0x501eb7=md5(JSON['stringify'](_0x9067d0));if(this[_0x35f9('0x1')]!==_0x501eb7){this[_0x35f9('0x1')]=_0x501eb7;io['to'](util[_0x35f9('0x18')]('chat:queue:%s',_0x9067d0[_0x35f9('0x7')]))[_0x35f9('0x19')](_0x35f9('0x1a'),_0x9067d0);}};module[_0x35f9('0x1b')]=ChatQueue; \ No newline at end of file +var _0x9199=['online','chatPause','paused','available','waiting','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','beepall','Agents','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0x9199,0xe2));var _0x9919=function(_0x175f1b,_0x1a7de0){_0x175f1b=_0x175f1b-0x0;var _0x2da79a=_0x9199[_0x175f1b];return _0x2da79a;};'use strict';var _=require(_0x9919('0x0'));var md5=require(_0x9919('0x1'));var util=require(_0x9919('0x2'));var Redis=require(_0x9919('0x3'));var config=require(_0x9919('0x4'));config[_0x9919('0x5')]=_[_0x9919('0x6')](config[_0x9919('0x5')],{'host':_0x9919('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9919('0x5')]));function ChatQueue(_0x99e668){this['id']=_0x99e668['id']||0x0;this[_0x9919('0x8')]=_0x99e668[_0x9919('0x8')]||'';this['timeout']=_0x99e668['timeout']||0xa;this[_0x9919('0x9')]=_0x99e668['strategy']||_0x9919('0xa');this[_0x9919('0xb')]=_0x99e668[_0x9919('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x9919('0x1')]='';this[_0x9919('0xc')]();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0x3b4d04=this[_0x9919('0xd')][_0x9919('0xe')];this[_0x9919('0xd')]=_['map'](this['Agents'],'id');this[_0x9919('0xd')][_0x9919('0xe')]=_0x3b4d04;};ChatQueue['prototype'][_0x9919('0xf')]=function(){this[_0x9919('0x10')]=0x0;this['paused']=0x0;for(var _0x2d5c38=0x0;_0x2d5c38=0x0?this[_0x9919('0x14')]:0x0;var _0xfb4410={'id':this['id'],'available':this[_0x9919('0x14')],'loggedIn':this[_0x9919('0x10')],'name':this[_0x9919('0x8')],'paused':this['paused'],'waiting':this[_0x9919('0x15')]};var _0x6afecb=md5(JSON[_0x9919('0x16')](_0xfb4410));if(this['md5']!==_0x6afecb){this[_0x9919('0x1')]=_0x6afecb;io['to'](util[_0x9919('0x17')](_0x9919('0x18'),_0xfb4410[_0x9919('0x8')]))['emit'](_0x9919('0x19'),_0xfb4410);}};module[_0x9919('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e52b237..3dc761a 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(_0x24e7f9,_0x4be2db){var _0x23c3bc=function(_0x57aabd){while(--_0x57aabd){_0x24e7f9['push'](_0x24e7f9['shift']());}};_0x23c3bc(++_0x4be2db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x313fa9,_0x2fbd07){var _0x2b7fdd=function(_0x434464){while(--_0x434464){_0x313fa9['push'](_0x313fa9['shift']());}};_0x2b7fdd(++_0x2fbd07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 2f3dbf6..b84b9f2 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 _0xc507=['exports','name','Intervals'];(function(_0x4617be,_0x17df97){var _0x365795=function(_0x2beab7){while(--_0x2beab7){_0x4617be['push'](_0x4617be['shift']());}};_0x365795(++_0x17df97);}(_0xc507,0xdf));var _0x7c50=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0xc507[_0x2f0057];return _0x17f2c3;};'use strict';function Interval(_0x4dff8d){this['id']=_0x4dff8d['id']||0x0;this[_0x7c50('0x0')]=_0x4dff8d[_0x7c50('0x0')]||'';this[_0x7c50('0x1')]=_0x4dff8d[_0x7c50('0x1')]||{};}module[_0x7c50('0x2')]=Interval; \ No newline at end of file +var _0xea97=['exports','name','Intervals'];(function(_0x480a80,_0x34891c){var _0x4636eb=function(_0x1b4b1e){while(--_0x1b4b1e){_0x480a80['push'](_0x480a80['shift']());}};_0x4636eb(++_0x34891c);}(_0xea97,0xeb));var _0x7ea9=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xea97[_0x403c20];return _0x2b271a;};'use strict';function Interval(_0x111d76){this['id']=_0x111d76['id']||0x0;this['name']=_0x111d76[_0x7ea9('0x0')]||'';this['Intervals']=_0x111d76[_0x7ea9('0x1')]||{};}module[_0x7ea9('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 d86eed0..e88bafa 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 _0xdfcf=['_rr','loggedIn','paused','length','online','available','stringify','format','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype'];(function(_0x30d4c3,_0x35136d){var _0x7c7dad=function(_0x326fb0){while(--_0x326fb0){_0x30d4c3['push'](_0x30d4c3['shift']());}};_0x7c7dad(++_0x35136d);}(_0xdfcf,0x185));var _0xfdfc=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xdfcf[_0x44bcb0];return _0xfaf881;};'use strict';var _=require('lodash');var md5=require(_0xfdfc('0x0'));var util=require(_0xfdfc('0x1'));var Redis=require(_0xfdfc('0x2'));var config=require(_0xfdfc('0x3'));config[_0xfdfc('0x4')]=_[_0xfdfc('0x5')](config[_0xfdfc('0x4')],{'host':_0xfdfc('0x6'),'port':0x18eb});var io=require(_0xfdfc('0x7'))(new Redis(config[_0xfdfc('0x4')]));function MailQueue(_0x476939){this['id']=_0x476939['id']||0x0;this[_0xfdfc('0x8')]=_0x476939[_0xfdfc('0x8')]||'';this[_0xfdfc('0x9')]=_0x476939[_0xfdfc('0x9')]||0xa;this[_0xfdfc('0xa')]=_0x476939[_0xfdfc('0xa')]||'beepall';this[_0xfdfc('0xb')]=_0x476939[_0xfdfc('0xb')];this[_0xfdfc('0xc')]={};this[_0xfdfc('0xd')]=0x0;this[_0xfdfc('0x0')]='';this['updateRouting']();this[_0xfdfc('0xe')]();}MailQueue[_0xfdfc('0xf')]['updateRouting']=function(){var _0x351cb4=this[_0xfdfc('0xc')][_0xfdfc('0x10')];this[_0xfdfc('0xc')]=_['map'](this[_0xfdfc('0xb')],'id');this[_0xfdfc('0xc')][_0xfdfc('0x10')]=_0x351cb4;};MailQueue[_0xfdfc('0xf')]['updateRealtime']=function(){this[_0xfdfc('0x11')]=0x0;this[_0xfdfc('0x12')]=0x0;for(var _0x3080b5=0x0;_0x3080b5=0x0?this['available']:0x0;var _0x1d2ca5={'id':this['id'],'available':this[_0xfdfc('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xfdfc('0x8')],'paused':this[_0xfdfc('0x12')],'waiting':this[_0xfdfc('0xd')]};var _0x2aa8bc=md5(JSON[_0xfdfc('0x16')](_0x1d2ca5));if(this[_0xfdfc('0x0')]!==_0x2aa8bc){this[_0xfdfc('0x0')]=_0x2aa8bc;io['to'](util[_0xfdfc('0x17')]('mail:queue:%s',_0x1d2ca5[_0xfdfc('0x8')]))[_0xfdfc('0x18')](_0xfdfc('0x19'),_0x1d2ca5);}};module[_0xfdfc('0x1a')]=MailQueue; \ No newline at end of file +var _0x4a6d=['updateRouting','updateRealtime','prototype','_rr','paused','length','loggedIn','mailPause','available','stringify','format','emit','mail_queue:save','exports','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x2f419d,_0x14ad0c){var _0x561965=function(_0x278de9){while(--_0x278de9){_0x2f419d['push'](_0x2f419d['shift']());}};_0x561965(++_0x14ad0c);}(_0x4a6d,0x121));var _0xd4a6=function(_0x665699,_0x3a0aec){_0x665699=_0x665699-0x0;var _0xf86c65=_0x4a6d[_0x665699];return _0xf86c65;};'use strict';var _=require('lodash');var md5=require(_0xd4a6('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xd4a6('0x1'));config[_0xd4a6('0x2')]=_[_0xd4a6('0x3')](config[_0xd4a6('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xd4a6('0x4'))(new Redis(config['redis']));function MailQueue(_0x48bbfe){this['id']=_0x48bbfe['id']||0x0;this['name']=_0x48bbfe[_0xd4a6('0x5')]||'';this[_0xd4a6('0x6')]=_0x48bbfe[_0xd4a6('0x6')]||0xa;this[_0xd4a6('0x7')]=_0x48bbfe['strategy']||'beepall';this[_0xd4a6('0x8')]=_0x48bbfe[_0xd4a6('0x8')];this[_0xd4a6('0x9')]={};this[_0xd4a6('0xa')]=0x0;this['md5']='';this[_0xd4a6('0xb')]();this[_0xd4a6('0xc')]();}MailQueue[_0xd4a6('0xd')][_0xd4a6('0xb')]=function(){var _0x2714d7=this['mapAgentsId'][_0xd4a6('0xe')];this[_0xd4a6('0x9')]=_['map'](this[_0xd4a6('0x8')],'id');this[_0xd4a6('0x9')][_0xd4a6('0xe')]=_0x2714d7;};MailQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xd4a6('0xf')]=0x0;for(var _0xeafa3f=0x0;_0xeafa3f=0x0?this[_0xd4a6('0x13')]:0x0;var _0x1b456d={'id':this['id'],'available':this[_0xd4a6('0x13')],'loggedIn':this[_0xd4a6('0x11')],'name':this[_0xd4a6('0x5')],'paused':this[_0xd4a6('0xf')],'waiting':this[_0xd4a6('0xa')]};var _0x44713d=md5(JSON[_0xd4a6('0x14')](_0x1b456d));if(this[_0xd4a6('0x0')]!==_0x44713d){this[_0xd4a6('0x0')]=_0x44713d;io['to'](util[_0xd4a6('0x15')]('mail:queue:%s',_0x1b456d[_0xd4a6('0x5')]))[_0xd4a6('0x16')](_0xd4a6('0x17'),_0x1b456d);}};module[_0xd4a6('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 4570424..ffffb6c 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 _0xe725=['openchannel_queue:save','exports','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','paused','available','stringify','md5','openchannel:queue:%s','emit'];(function(_0x2bd007,_0x281ba0){var _0x53c252=function(_0x35844b){while(--_0x35844b){_0x2bd007['push'](_0x2bd007['shift']());}};_0x53c252(++_0x281ba0);}(_0xe725,0x17c));var _0x5e72=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe725[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x5e72('0x0'));var Redis=require('ioredis');var config=require(_0x5e72('0x1'));config[_0x5e72('0x2')]=_[_0x5e72('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5e72('0x4'))(new Redis(config['redis']));function OpenchannelQueue(_0x4161d2){this['id']=_0x4161d2['id']||0x0;this[_0x5e72('0x5')]=_0x4161d2[_0x5e72('0x5')]||'';this[_0x5e72('0x6')]=_0x4161d2[_0x5e72('0x6')]||0xa;this['strategy']=_0x4161d2[_0x5e72('0x7')]||_0x5e72('0x8');this[_0x5e72('0x9')]=_0x4161d2[_0x5e72('0x9')];this[_0x5e72('0xa')]={};this[_0x5e72('0xb')]=0x0;this['md5']='';this[_0x5e72('0xc')]();this[_0x5e72('0xd')]();}OpenchannelQueue[_0x5e72('0xe')]['updateRouting']=function(){var _0xea000e=this[_0x5e72('0xa')]['_rr'];this[_0x5e72('0xa')]=_[_0x5e72('0xf')](this[_0x5e72('0x9')],'id');this[_0x5e72('0xa')][_0x5e72('0x10')]=_0xea000e;};OpenchannelQueue[_0x5e72('0xe')][_0x5e72('0xd')]=function(){this[_0x5e72('0x11')]=0x0;this['paused']=0x0;for(var _0x2a098d=0x0;_0x2a098d=0x0?this['available']:0x0;var _0x223988={'id':this['id'],'available':this[_0x5e72('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x4758b2=md5(JSON[_0x5e72('0x15')](_0x223988));if(this[_0x5e72('0x16')]!==_0x4758b2){this[_0x5e72('0x16')]=_0x4758b2;io['to'](util['format'](_0x5e72('0x17'),_0x223988[_0x5e72('0x5')]))[_0x5e72('0x18')](_0x5e72('0x19'),_0x223988);}};module[_0x5e72('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0xfa4d=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','_rr','prototype','updateRealtime','loggedIn','paused','length','online','available','emit','openchannel_queue:save','exports','lodash','ioredis'];(function(_0x5084a8,_0x35f0b3){var _0x2be01e=function(_0x34c054){while(--_0x34c054){_0x5084a8['push'](_0x5084a8['shift']());}};_0x2be01e(++_0x35f0b3);}(_0xfa4d,0xe8));var _0xdfa4=function(_0x384d38,_0x2acf8a){_0x384d38=_0x384d38-0x0;var _0x1cecd6=_0xfa4d[_0x384d38];return _0x1cecd6;};'use strict';var _=require(_0xdfa4('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xdfa4('0x1'));var config=require('../../../config/environment');config[_0xdfa4('0x2')]=_[_0xdfa4('0x3')](config[_0xdfa4('0x2')],{'host':_0xdfa4('0x4'),'port':0x18eb});var io=require(_0xdfa4('0x5'))(new Redis(config[_0xdfa4('0x2')]));function OpenchannelQueue(_0x243b9e){this['id']=_0x243b9e['id']||0x0;this['name']=_0x243b9e[_0xdfa4('0x6')]||'';this[_0xdfa4('0x7')]=_0x243b9e[_0xdfa4('0x7')]||0xa;this[_0xdfa4('0x8')]=_0x243b9e[_0xdfa4('0x8')]||_0xdfa4('0x9');this[_0xdfa4('0xa')]=_0x243b9e[_0xdfa4('0xa')];this[_0xdfa4('0xb')]={};this[_0xdfa4('0xc')]=0x0;this[_0xdfa4('0xd')]='';this[_0xdfa4('0xe')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0xdfa4('0xe')]=function(){var _0x4a1413=this[_0xdfa4('0xb')][_0xdfa4('0xf')];this[_0xdfa4('0xb')]=_['map'](this[_0xdfa4('0xa')],'id');this[_0xdfa4('0xb')][_0xdfa4('0xf')]=_0x4a1413;};OpenchannelQueue[_0xdfa4('0x10')][_0xdfa4('0x11')]=function(){this[_0xdfa4('0x12')]=0x0;this[_0xdfa4('0x13')]=0x0;for(var _0x4d53d3=0x0;_0x4d53d3=0x0?this['available']:0x0;var _0x591fcc={'id':this['id'],'available':this[_0xdfa4('0x16')],'loggedIn':this[_0xdfa4('0x12')],'name':this[_0xdfa4('0x6')],'paused':this[_0xdfa4('0x13')],'waiting':this[_0xdfa4('0xc')]};var _0x3c22f7=md5(JSON['stringify'](_0x591fcc));if(this[_0xdfa4('0xd')]!==_0x3c22f7){this[_0xdfa4('0xd')]=_0x3c22f7;io['to'](util['format']('openchannel:queue:%s',_0x591fcc[_0xdfa4('0x6')]))[_0xdfa4('0x17')](_0xdfa4('0x18'),_0x591fcc);}};module[_0xdfa4('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 5c60cc0..6f814e4 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 _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(_0x2e87e4,_0x591ef7){var _0x3c9855=function(_0x5e43e0){while(--_0x5e43e0){_0x2e87e4['push'](_0x2e87e4['shift']());}};_0x3c9855(++_0x591ef7);}(_0xe706,0xa3));var _0x6e70=function(_0x4fac58,_0x213b99){_0x4fac58=_0x4fac58-0x0;var _0x10e5d1=_0xe706[_0x4fac58];return _0x10e5d1;};'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 +var _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x321592,_0x198cc3){var _0x5b7250=function(_0x427bde){while(--_0x427bde){_0x321592['push'](_0x321592['shift']());}};_0x5b7250(++_0x198cc3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 8845864..f273a34 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 _0x7822=['prototype','updateRouting','_rr','loggedIn','online','whatsappPause','available','paused','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime'];(function(_0x2c201f,_0x339507){var _0x3d1819=function(_0x2ac0b6){while(--_0x2ac0b6){_0x2c201f['push'](_0x2c201f['shift']());}};_0x3d1819(++_0x339507);}(_0x7822,0x10a));var _0x2782=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7822[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2782('0x0'));var md5=require('md5');var util=require(_0x2782('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x2782('0x2')]=_['defaults'](config[_0x2782('0x2')],{'host':_0x2782('0x3'),'port':0x18eb});var io=require(_0x2782('0x4'))(new Redis(config[_0x2782('0x2')]));function WhatsappQueue(_0x5a8014){this['id']=_0x5a8014['id']||0x0;this[_0x2782('0x5')]=_0x5a8014[_0x2782('0x5')]||'';this[_0x2782('0x6')]=_0x5a8014[_0x2782('0x6')]||0xa;this[_0x2782('0x7')]=_0x5a8014['strategy']||_0x2782('0x8');this['Agents']=_0x5a8014[_0x2782('0x9')];this[_0x2782('0xa')]={};this[_0x2782('0xb')]=0x0;this[_0x2782('0xc')]='';this['updateRouting']();this[_0x2782('0xd')]();}WhatsappQueue[_0x2782('0xe')][_0x2782('0xf')]=function(){var _0x4ac757=this[_0x2782('0xa')][_0x2782('0x10')];this[_0x2782('0xa')]=_['map'](this[_0x2782('0x9')],'id');this[_0x2782('0xa')][_0x2782('0x10')]=_0x4ac757;};WhatsappQueue[_0x2782('0xe')]['updateRealtime']=function(){this[_0x2782('0x11')]=0x0;this['paused']=0x0;for(var _0x29fb3a=0x0;_0x29fb3a=0x0?this[_0x2782('0x14')]:0x0;var _0x1f7bca={'id':this['id'],'available':this[_0x2782('0x14')],'loggedIn':this[_0x2782('0x11')],'name':this[_0x2782('0x5')],'paused':this[_0x2782('0x15')],'waiting':this[_0x2782('0xb')]};var _0x4ae733=md5(JSON[_0x2782('0x16')](_0x1f7bca));if(this[_0x2782('0xc')]!==_0x4ae733){this[_0x2782('0xc')]=_0x4ae733;io['to'](util[_0x2782('0x17')](_0x2782('0x18'),_0x1f7bca['name']))[_0x2782('0x19')](_0x2782('0x1a'),_0x1f7bca);}};module[_0x2782('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xd988=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','loggedIn','whatsappPause','available','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd988,0x17d));var _0x8d98=function(_0x58b21c,_0x57b83b){_0x58b21c=_0x58b21c-0x0;var _0x6682d3=_0xd988[_0x58b21c];return _0x6682d3;};'use strict';var _=require('lodash');var md5=require(_0x8d98('0x0'));var util=require('util');var Redis=require(_0x8d98('0x1'));var config=require(_0x8d98('0x2'));config[_0x8d98('0x3')]=_['defaults'](config[_0x8d98('0x3')],{'host':_0x8d98('0x4'),'port':0x18eb});var io=require(_0x8d98('0x5'))(new Redis(config[_0x8d98('0x3')]));function WhatsappQueue(_0x3b6c60){this['id']=_0x3b6c60['id']||0x0;this['name']=_0x3b6c60[_0x8d98('0x6')]||'';this[_0x8d98('0x7')]=_0x3b6c60[_0x8d98('0x7')]||0xa;this[_0x8d98('0x8')]=_0x3b6c60[_0x8d98('0x8')]||_0x8d98('0x9');this[_0x8d98('0xa')]=_0x3b6c60[_0x8d98('0xa')];this[_0x8d98('0xb')]={};this[_0x8d98('0xc')]=0x0;this[_0x8d98('0x0')]='';this[_0x8d98('0xd')]();this[_0x8d98('0xe')]();}WhatsappQueue[_0x8d98('0xf')]['updateRouting']=function(){var _0x4b806b=this['mapAgentsId'][_0x8d98('0x10')];this['mapAgentsId']=_['map'](this[_0x8d98('0xa')],'id');this[_0x8d98('0xb')][_0x8d98('0x10')]=_0x4b806b;};WhatsappQueue[_0x8d98('0xf')][_0x8d98('0xe')]=function(){this['loggedIn']=0x0;this[_0x8d98('0x11')]=0x0;for(var _0x5a4205=0x0;_0x5a4205=0x0?this[_0x8d98('0x15')]:0x0;var _0x9b2e9f={'id':this['id'],'available':this[_0x8d98('0x15')],'loggedIn':this[_0x8d98('0x13')],'name':this[_0x8d98('0x6')],'paused':this[_0x8d98('0x11')],'waiting':this['waiting']};var _0x34e7d5=md5(JSON['stringify'](_0x9b2e9f));if(this[_0x8d98('0x0')]!==_0x34e7d5){this[_0x8d98('0x0')]=_0x34e7d5;io['to'](util['format'](_0x8d98('0x16'),_0x9b2e9f[_0x8d98('0x6')]))[_0x8d98('0x17')](_0x8d98('0x18'),_0x9b2e9f);}};module[_0x8d98('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index ed44e42..165941c 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 _0xe14b=['initMailQueues','mailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','../model/agent','../model/interval','../model/chatQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues'];(function(_0x60c50b,_0x208bec){var _0x3b8588=function(_0x2f8a66){while(--_0x2f8a66){_0x60c50b['push'](_0x60c50b['shift']());}};_0x3b8588(++_0x208bec);}(_0xe14b,0x93));var _0xbe14=function(_0x1e23e2,_0x2c67d2){_0x1e23e2=_0x1e23e2-0x0;var _0x1398f4=_0xe14b[_0x1e23e2];return _0x1398f4;};'use strict';var BPromise=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0xbe14('0x2'));var Interval=require(_0xbe14('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0xbe14('0x4'));var SmsQueue=require('../model/smsQueue');var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xbe14('0x5'));var WhatsappQueue=require(_0xbe14('0x6'));var Realtime=function(){this[_0xbe14('0x7')]={};this[_0xbe14('0x8')]={};this[_0xbe14('0x9')]={};this[_0xbe14('0xa')]={};this[_0xbe14('0xb')]={};this['mailQueues']={};this['faxQueues']={};this['whatsappQueues']={};this[_0xbe14('0xc')]={};this[_0xbe14('0xd')]={};this[_0xbe14('0xe')]={};this[_0xbe14('0xf')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x113243,_0x3f70cb,_0x4935cc){var _0x254c3b=_[_0xbe14('0x10')](_0x113243,function(_0x886a5e,_0x3d38c2){return _0x886a5e[_0x4935cc];});for(var _0x27792f in _0x3f70cb){if(_0x3f70cb[_0xbe14('0x11')](_0x27792f)){if(!_0x254c3b[_0x27792f]){delete _0x3f70cb[_0x27792f];}}}}Realtime[_0xbe14('0x12')][_0xbe14('0x13')]=function(_0x16893f,_0xa2cf72){for(var _0x1e4826 in _0xa2cf72){if(_0x16893f[_0xbe14('0x11')](_0x1e4826)){_0x16893f[_0x1e4826]=_0xa2cf72[_0x1e4826];}}};Realtime[_0xbe14('0x12')]['initAgents']=function(){var _0x55b3a7=this;return function(_0x3f58f5){if(_0x3f58f5){freeIsNotKey(_0x3f58f5,_0x55b3a7[_0xbe14('0x7')],'id');for(var _0xf4ac9=0x0,_0x37ce4e={},_0x4e8f34={};_0xf4ac9<_0x3f58f5[_0xbe14('0x14')];_0xf4ac9+=0x1){_0x37ce4e=_0x3f58f5[_0xf4ac9];if(_[_0xbe14('0x15')](_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']])){_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']]=new Agent(_0x37ce4e);}else{_0x55b3a7[_0xbe14('0x13')](_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']],_0x37ce4e);}}}return _0x55b3a7[_0xbe14('0x7')];};};Realtime['prototype'][_0xbe14('0x16')]=function(){var _0x456ca8=this;return function(_0x329588){if(_0x329588){freeIsNotKey(_0x329588,_0x456ca8[_0xbe14('0x8')],'id');for(var _0x3249da=0x0,_0x37e4c1={},_0x59a9e3={};_0x3249da<_0x329588[_0xbe14('0x14')];_0x3249da+=0x1){_0x37e4c1=_0x329588[_0x3249da];if(_[_0xbe14('0x15')](_0x456ca8[_0xbe14('0x8')][_0x37e4c1['id']])){_0x456ca8[_0xbe14('0x8')][_0x37e4c1['id']]=new Interval(_0x37e4c1);}else{_0x456ca8[_0xbe14('0x13')](_0x456ca8['intervals'][_0x37e4c1['id']],_0x37e4c1);}}}return _0x456ca8[_0xbe14('0x8')];};};Realtime['prototype'][_0xbe14('0x17')]=function(){var _0x56e80c=this;return function(_0x32e8eb){if(_0x32e8eb){freeIsNotKey(_0x32e8eb,_0x56e80c['openchannelQueues'],'id');for(var _0x274018=0x0,_0x3d3608={},_0x505dbd={};_0x274018<_0x32e8eb[_0xbe14('0x14')];_0x274018+=0x1){_0x3d3608=_0x32e8eb[_0x274018];if(_['isUndefined'](_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']])){_0x56e80c['openchannelQueues'][_0x3d3608['id']]=new OpenchannelQueue(_0x3d3608);}else{_0x56e80c[_0xbe14('0x13')](_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']],_0x3d3608);}_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']][_0xbe14('0x18')]();_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']][_0xbe14('0x19')]();}}return _0x56e80c['openchannelQueues'];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1a')]=function(){var _0x391556=this;return function(_0x169369){if(_0x169369){freeIsNotKey(_0x169369,_0x391556['chatQueues'],'id');for(var _0x16f884=0x0,_0x29fc64={},_0x59bf34={};_0x16f884<_0x169369[_0xbe14('0x14')];_0x16f884+=0x1){_0x29fc64=_0x169369[_0x16f884];if(_[_0xbe14('0x15')](_0x391556[_0xbe14('0xa')][_0x29fc64['id']])){_0x391556[_0xbe14('0xa')][_0x29fc64['id']]=new ChatQueue(_0x29fc64);}else{_0x391556[_0xbe14('0x13')](_0x391556[_0xbe14('0xa')][_0x29fc64['id']],_0x29fc64);}_0x391556[_0xbe14('0xa')][_0x29fc64['id']][_0xbe14('0x18')]();_0x391556[_0xbe14('0xa')][_0x29fc64['id']][_0xbe14('0x19')]();}}return _0x391556[_0xbe14('0xa')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1b')]=function(){var _0x10ae36=this;return function(_0x223f7a){if(_0x223f7a){freeIsNotKey(_0x223f7a,_0x10ae36[_0xbe14('0xb')],'id');for(var _0x6ba36c=0x0,_0x2ff48e={},_0x29e76a={};_0x6ba36c<_0x223f7a[_0xbe14('0x14')];_0x6ba36c+=0x1){_0x2ff48e=_0x223f7a[_0x6ba36c];if(_['isUndefined'](_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']])){_0x10ae36['smsQueues'][_0x2ff48e['id']]=new SmsQueue(_0x2ff48e);}else{_0x10ae36['mergeFromDatabase'](_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']],_0x2ff48e);}_0x10ae36['smsQueues'][_0x2ff48e['id']][_0xbe14('0x18')]();_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']]['updateRealtime']();}}return _0x10ae36['smsQueues'];};};Realtime['prototype'][_0xbe14('0x1c')]=function(){var _0xa3d24=this;return function(_0x5f27b6){if(_0x5f27b6){freeIsNotKey(_0x5f27b6,_0xa3d24[_0xbe14('0x1d')],'id');for(var _0x1faf3e=0x0,_0x452635={},_0x1aa849={};_0x1faf3e<_0x5f27b6[_0xbe14('0x14')];_0x1faf3e+=0x1){_0x452635=_0x5f27b6[_0x1faf3e];if(_['isUndefined'](_0xa3d24['mailQueues'][_0x452635['id']])){_0xa3d24[_0xbe14('0x1d')][_0x452635['id']]=new MailQueue(_0x452635);}else{_0xa3d24['mergeFromDatabase'](_0xa3d24['mailQueues'][_0x452635['id']],_0x452635);}_0xa3d24['mailQueues'][_0x452635['id']][_0xbe14('0x18')]();_0xa3d24[_0xbe14('0x1d')][_0x452635['id']][_0xbe14('0x19')]();}}return _0xa3d24[_0xbe14('0x1d')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1e')]=function(){var _0xcdc50=this;return function(_0x10ec3c){if(_0x10ec3c){freeIsNotKey(_0x10ec3c,_0xcdc50[_0xbe14('0x1f')],'id');for(var _0x2dfd5a=0x0,_0x41652d={},_0x32c59d={};_0x2dfd5a<_0x10ec3c['length'];_0x2dfd5a+=0x1){_0x41652d=_0x10ec3c[_0x2dfd5a];if(_['isUndefined'](_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']])){_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']]=new FaxQueue(_0x41652d);}else{_0xcdc50[_0xbe14('0x13')](_0xcdc50['faxQueues'][_0x41652d['id']],_0x41652d);}_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']][_0xbe14('0x18')]();_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']][_0xbe14('0x19')]();}}return _0xcdc50[_0xbe14('0x1f')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x20')]=function(){var _0x128843=this;return function(_0x1b2608){if(_0x1b2608){freeIsNotKey(_0x1b2608,_0x128843['whatsappQueues'],'id');for(var _0xe51424=0x0,_0x841b71={},_0x3463c4={};_0xe51424<_0x1b2608[_0xbe14('0x14')];_0xe51424+=0x1){_0x841b71=_0x1b2608[_0xe51424];if(_[_0xbe14('0x15')](_0x128843[_0xbe14('0x21')][_0x841b71['id']])){_0x128843['whatsappQueues'][_0x841b71['id']]=new WhatsappQueue(_0x841b71);}else{_0x128843[_0xbe14('0x13')](_0x128843[_0xbe14('0x21')][_0x841b71['id']],_0x841b71);}_0x128843[_0xbe14('0x21')][_0x841b71['id']][_0xbe14('0x18')]();_0x128843['whatsappQueues'][_0x841b71['id']]['updateRealtime']();}}return _0x128843[_0xbe14('0x21')];};};module[_0xbe14('0x22')]=Realtime; \ No newline at end of file +var _0x4b84=['../model/agent','../model/chatQueue','../model/smsQueue','../model/mailQueue','intervals','chatQueues','mailQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','agents','isUndefined','mergeFromDatabase','length','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','bluebird','util'];(function(_0x4d112e,_0x1b4c32){var _0x13908f=function(_0x4193b6){while(--_0x4193b6){_0x4d112e['push'](_0x4d112e['shift']());}};_0x13908f(++_0x1b4c32);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0x4b84[_0x1a72b8];return _0x39f72d;};'use strict';var BPromise=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x44b8('0x2'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x44b8('0x3'));var SmsQueue=require(_0x44b8('0x4'));var MailQueue=require(_0x44b8('0x5'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this[_0x44b8('0x6')]={};this['openchannelQueues']={};this[_0x44b8('0x7')]={};this['smsQueues']={};this[_0x44b8('0x8')]={};this['faxQueues']={};this['whatsappQueues']={};this[_0x44b8('0x9')]={};this[_0x44b8('0xa')]={};this[_0x44b8('0xb')]={};this['smsQueuesWaitingInteractions']={};this[_0x44b8('0xc')]={};this[_0x44b8('0xd')]={};};function freeIsNotKey(_0x4315f6,_0x9b6048,_0x24dd10){var _0x37e471=_[_0x44b8('0xe')](_0x4315f6,function(_0x4ae8a1,_0x147529){return _0x4ae8a1[_0x24dd10];});for(var _0x4301a6 in _0x9b6048){if(_0x9b6048['hasOwnProperty'](_0x4301a6)){if(!_0x37e471[_0x4301a6]){delete _0x9b6048[_0x4301a6];}}}}Realtime[_0x44b8('0xf')]['mergeFromDatabase']=function(_0x833ea3,_0x18d642){for(var _0x4df670 in _0x18d642){if(_0x833ea3[_0x44b8('0x10')](_0x4df670)){_0x833ea3[_0x4df670]=_0x18d642[_0x4df670];}}};Realtime['prototype']['initAgents']=function(){var _0x2a3e4c=this;return function(_0x2af0ad){if(_0x2af0ad){freeIsNotKey(_0x2af0ad,_0x2a3e4c[_0x44b8('0x11')],'id');for(var _0x41ab46=0x0,_0x5e52f2={},_0x495c74={};_0x41ab46<_0x2af0ad['length'];_0x41ab46+=0x1){_0x5e52f2=_0x2af0ad[_0x41ab46];if(_[_0x44b8('0x12')](_0x2a3e4c['agents'][_0x5e52f2['id']])){_0x2a3e4c[_0x44b8('0x11')][_0x5e52f2['id']]=new Agent(_0x5e52f2);}else{_0x2a3e4c[_0x44b8('0x13')](_0x2a3e4c['agents'][_0x5e52f2['id']],_0x5e52f2);}}}return _0x2a3e4c[_0x44b8('0x11')];};};Realtime[_0x44b8('0xf')]['initIntervals']=function(){var _0x89bc30=this;return function(_0x3f4688){if(_0x3f4688){freeIsNotKey(_0x3f4688,_0x89bc30['intervals'],'id');for(var _0xcce202=0x0,_0x8b4301={},_0xebfe79={};_0xcce202<_0x3f4688[_0x44b8('0x14')];_0xcce202+=0x1){_0x8b4301=_0x3f4688[_0xcce202];if(_[_0x44b8('0x12')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']])){_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']]=new Interval(_0x8b4301);}else{_0x89bc30[_0x44b8('0x13')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']],_0x8b4301);}}}return _0x89bc30[_0x44b8('0x6')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x15')]=function(){var _0x48327e=this;return function(_0x56549a){if(_0x56549a){freeIsNotKey(_0x56549a,_0x48327e[_0x44b8('0x16')],'id');for(var _0x416b34=0x0,_0x1418db={},_0x305a5c={};_0x416b34<_0x56549a['length'];_0x416b34+=0x1){_0x1418db=_0x56549a[_0x416b34];if(_[_0x44b8('0x12')](_0x48327e['openchannelQueues'][_0x1418db['id']])){_0x48327e[_0x44b8('0x16')][_0x1418db['id']]=new OpenchannelQueue(_0x1418db);}else{_0x48327e[_0x44b8('0x13')](_0x48327e[_0x44b8('0x16')][_0x1418db['id']],_0x1418db);}_0x48327e[_0x44b8('0x16')][_0x1418db['id']][_0x44b8('0x17')]();_0x48327e['openchannelQueues'][_0x1418db['id']][_0x44b8('0x18')]();}}return _0x48327e['openchannelQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x19')]=function(){var _0x549a26=this;return function(_0x17ac44){if(_0x17ac44){freeIsNotKey(_0x17ac44,_0x549a26[_0x44b8('0x7')],'id');for(var _0x2656d7=0x0,_0x59c1bf={},_0xb22107={};_0x2656d7<_0x17ac44[_0x44b8('0x14')];_0x2656d7+=0x1){_0x59c1bf=_0x17ac44[_0x2656d7];if(_['isUndefined'](_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']])){_0x549a26['chatQueues'][_0x59c1bf['id']]=new ChatQueue(_0x59c1bf);}else{_0x549a26[_0x44b8('0x13')](_0x549a26['chatQueues'][_0x59c1bf['id']],_0x59c1bf);}_0x549a26['chatQueues'][_0x59c1bf['id']]['updateRouting']();_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']][_0x44b8('0x18')]();}}return _0x549a26[_0x44b8('0x7')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1a')]=function(){var _0xc3f667=this;return function(_0x2cf205){if(_0x2cf205){freeIsNotKey(_0x2cf205,_0xc3f667[_0x44b8('0x1b')],'id');for(var _0xd1d320=0x0,_0x28f918={},_0x5e1129={};_0xd1d320<_0x2cf205[_0x44b8('0x14')];_0xd1d320+=0x1){_0x28f918=_0x2cf205[_0xd1d320];if(_[_0x44b8('0x12')](_0xc3f667['smsQueues'][_0x28f918['id']])){_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']]=new SmsQueue(_0x28f918);}else{_0xc3f667['mergeFromDatabase'](_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']],_0x28f918);}_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x17')]();_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x18')]();}}return _0xc3f667['smsQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1c')]=function(){var _0x26265f=this;return function(_0x339f0f){if(_0x339f0f){freeIsNotKey(_0x339f0f,_0x26265f[_0x44b8('0x8')],'id');for(var _0x5f541d=0x0,_0x3875a5={},_0x400edc={};_0x5f541d<_0x339f0f[_0x44b8('0x14')];_0x5f541d+=0x1){_0x3875a5=_0x339f0f[_0x5f541d];if(_[_0x44b8('0x12')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']])){_0x26265f[_0x44b8('0x8')][_0x3875a5['id']]=new MailQueue(_0x3875a5);}else{_0x26265f[_0x44b8('0x13')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']],_0x3875a5);}_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x17')]();_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x18')]();}}return _0x26265f[_0x44b8('0x8')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1d')]=function(){var _0x1becb0=this;return function(_0x323c50){if(_0x323c50){freeIsNotKey(_0x323c50,_0x1becb0[_0x44b8('0x1e')],'id');for(var _0x28faa9=0x0,_0x3984f8={},_0x2c02d6={};_0x28faa9<_0x323c50[_0x44b8('0x14')];_0x28faa9+=0x1){_0x3984f8=_0x323c50[_0x28faa9];if(_['isUndefined'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']])){_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]=new FaxQueue(_0x3984f8);}else{_0x1becb0['mergeFromDatabase'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']],_0x3984f8);}_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']][_0x44b8('0x17')]();_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]['updateRealtime']();}}return _0x1becb0[_0x44b8('0x1e')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1f')]=function(){var _0x1ee3cc=this;return function(_0x9cb2a){if(_0x9cb2a){freeIsNotKey(_0x9cb2a,_0x1ee3cc[_0x44b8('0x20')],'id');for(var _0x46aadd=0x0,_0x3581b8={},_0x209039={};_0x46aadd<_0x9cb2a[_0x44b8('0x14')];_0x46aadd+=0x1){_0x3581b8=_0x9cb2a[_0x46aadd];if(_[_0x44b8('0x12')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']])){_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]=new WhatsappQueue(_0x3581b8);}else{_0x1ee3cc[_0x44b8('0x13')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']],_0x3581b8);}_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]['updateRouting']();_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']][_0x44b8('0x18')]();}}return _0x1ee3cc[_0x44b8('0x20')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 3bd140a..67bce09 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 _0xbc23=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x52a1d5,_0x1c201c){var _0x57b1ab=function(_0x1fb27d){while(--_0x1fb27d){_0x52a1d5['push'](_0x52a1d5['shift']());}};_0x57b1ab(++_0x1c201c);}(_0xbc23,0x102));var _0x3bc2=function(_0x34aeb3,_0x3b043a){_0x34aeb3=_0x34aeb3-0x0;var _0x402584=_0xbc23[_0x34aeb3];return _0x402584;};'use strict';var client=require('../client');exports[_0x3bc2('0x0')]=function(_0x37320c,_0x239204){return client[_0x3bc2('0x1')](_0x3bc2('0x2'),{'body':_0x239204,'options':{'where':{'id':_0x37320c}},'log':_0x3bc2('0x3')});};exports[_0x3bc2('0x4')]=function(_0x69b74f,_0x3fad1d){return client[_0x3bc2('0x1')](_0x3bc2('0x5'),{'body':_0x3fad1d,'options':{'where':{'id':_0x69b74f}},'log':_0x3bc2('0x6')});}; \ No newline at end of file +var _0xe8d7=['addTags','AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x460dae,_0x3a907f){var _0x36e6d0=function(_0x447057){while(--_0x447057){_0x460dae['push'](_0x460dae['shift']());}};_0x36e6d0(++_0x3a907f);}(_0xe8d7,0x136));var _0x7e8d=function(_0x38b5c2,_0x7d4968){_0x38b5c2=_0x38b5c2-0x0;var _0x318136=_0xe8d7[_0x38b5c2];return _0x318136;};'use strict';var client=require(_0x7e8d('0x0'));exports[_0x7e8d('0x1')]=function(_0x1928b3,_0x31b39e){return client[_0x7e8d('0x2')](_0x7e8d('0x3'),{'body':_0x31b39e,'options':{'where':{'id':_0x1928b3}},'log':_0x7e8d('0x4')});};exports[_0x7e8d('0x5')]=function(_0x3430e0,_0x922550){return client[_0x7e8d('0x2')](_0x7e8d('0x6'),{'body':_0x922550,'options':{'where':{'id':_0x3430e0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 6ea0eaa..d78f217 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 _0x4210=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x332859,_0x5cb412){var _0x2c747a=function(_0x3d5c13){while(--_0x3d5c13){_0x332859['push'](_0x332859['shift']());}};_0x2c747a(++_0x5cb412);}(_0x4210,0x19a));var _0x0421=function(_0x5cf58a,_0x195a2d){_0x5cf58a=_0x5cf58a-0x0;var _0x15fd37=_0x4210[_0x5cf58a];return _0x15fd37;};'use strict';var client=require(_0x0421('0x0'));exports[_0x0421('0x1')]=function(_0x16dfd5){return client[_0x0421('0x2')](_0x0421('0x3'),{'body':_0x16dfd5,'log':_0x0421('0x4')});}; \ No newline at end of file +var _0xee0f=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0xee0f,0x153));var _0xfee0=function(_0x41a3ab,_0x4bb061){_0x41a3ab=_0x41a3ab-0x0;var _0x3c9da9=_0xee0f[_0x41a3ab];return _0x3c9da9;};'use strict';var client=require(_0xfee0('0x0'));exports[_0xfee0('0x1')]=function(_0x1b7869){return client[_0xfee0('0x2')](_0xfee0('0x3'),{'body':_0x1b7869,'log':_0xfee0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 135ef1b..936c420 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 _0x1c15=['GetChatQueue','timeout','strategy','User','Agents','name','online','../client','getChatQueues','Request'];(function(_0x13125b,_0x4e4ff1){var _0x3c76c6=function(_0x2d1b43){while(--_0x2d1b43){_0x13125b['push'](_0x13125b['shift']());}};_0x3c76c6(++_0x4e4ff1);}(_0x1c15,0xed));var _0x51c1=function(_0x271688,_0x3be140){_0x271688=_0x271688-0x0;var _0x37c1fa=_0x1c15[_0x271688];return _0x37c1fa;};'use strict';var client=require(_0x51c1('0x0'));exports[_0x51c1('0x1')]=function(){return function(){return client[_0x51c1('0x2')](_0x51c1('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x51c1('0x4'),_0x51c1('0x5')],'include':[{'model':_0x51c1('0x6'),'as':_0x51c1('0x7'),'attributes':['id',_0x51c1('0x8'),_0x51c1('0x9'),'chatPause']}]},'log':_0x51c1('0x1')});};}; \ No newline at end of file +var _0x2fd2=['chatPause','getChatQueues','../client','Request','timeout','strategy','User','Agents','online'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2fd2,0x1b2));var _0x22fd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2fd2[_0x432682];return _0x463d05;};'use strict';var client=require(_0x22fd('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x22fd('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x22fd('0x2'),_0x22fd('0x3')],'include':[{'model':_0x22fd('0x4'),'as':_0x22fd('0x5'),'attributes':['id','name',_0x22fd('0x6'),_0x22fd('0x7')]}]},'log':_0x22fd('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 920d73d..3245e46 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 _0x3c7b=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x2e030a,_0x8e4c48){var _0x597df6=function(_0x3da9ce){while(--_0x3da9ce){_0x2e030a['push'](_0x2e030a['shift']());}};_0x597df6(++_0x8e4c48);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x1851b5,_0x3c439b){_0x1851b5=_0x1851b5-0x0;var _0x3a79eb=_0x3c7b[_0x1851b5];return _0x3a79eb;};'use strict';var client=require(_0xb3c7('0x0'));exports[_0xb3c7('0x1')]=function(_0xc43ced){return client[_0xb3c7('0x2')](_0xb3c7('0x3'),{'body':_0xc43ced,'log':'CreateChatQueueReport'});};exports['update']=function(_0x500bea,_0x5b34ef){return client[_0xb3c7('0x2')](_0xb3c7('0x4'),{'body':_0x5b34ef,'options':{'where':{'uniqueid':_0x500bea},'order':[['id','DESC']],'limit':0x1},'log':_0xb3c7('0x4')});}; \ No newline at end of file +var _0xf194=['DESC','../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x3fcf7a,_0x599ecc){var _0x34cc20=function(_0x1df993){while(--_0x1df993){_0x3fcf7a['push'](_0x3fcf7a['shift']());}};_0x34cc20(++_0x599ecc);}(_0xf194,0x91));var _0x4f19=function(_0x4c59ed,_0x5242bf){_0x4c59ed=_0x4c59ed-0x0;var _0x59af1b=_0xf194[_0x4c59ed];return _0x59af1b;};'use strict';var client=require(_0x4f19('0x0'));exports[_0x4f19('0x1')]=function(_0x1ab42a){return client[_0x4f19('0x2')]('CreateChatQueueReport',{'body':_0x1ab42a,'log':_0x4f19('0x3')});};exports['update']=function(_0x5db065,_0x5c0587){return client[_0x4f19('0x2')](_0x4f19('0x4'),{'body':_0x5c0587,'options':{'where':{'uniqueid':_0x5db065},'order':[['id',_0x4f19('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ba61825..732b930 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 _0x6e40=['addTagsToFaxInteraction','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x6e40,0x1e5));var _0x06e4=function(_0x208b08,_0x31055a){_0x208b08=_0x208b08-0x0;var _0x5d8335=_0x6e40[_0x208b08];return _0x5d8335;};'use strict';var client=require('../client');exports['update']=function(_0x4c70bc,_0x2e1a23){return client['Request'](_0x06e4('0x0'),{'body':_0x2e1a23,'options':{'where':{'id':_0x4c70bc}},'log':_0x06e4('0x1')});};exports[_0x06e4('0x2')]=function(_0x5dcf3e,_0x293b5a){return client['Request']('AddTagsToFaxInteraction',{'body':_0x293b5a,'options':{'where':{'id':_0x5dcf3e}},'log':_0x06e4('0x3')});}; \ No newline at end of file +var _0x5df6=['updateFaxInteraction','addTags','addTagsToFaxInteraction','../client','update','Request'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x5df6,0x15f));var _0x65df=function(_0x195686,_0xd329df){_0x195686=_0x195686-0x0;var _0xaf27a1=_0x5df6[_0x195686];return _0xaf27a1;};'use strict';var client=require(_0x65df('0x0'));exports[_0x65df('0x1')]=function(_0x4d7572,_0x4362f6){return client[_0x65df('0x2')]('UpdateFaxInteraction',{'body':_0x4362f6,'options':{'where':{'id':_0x4d7572}},'log':_0x65df('0x3')});};exports[_0x65df('0x4')]=function(_0x5610f6,_0x344d1f){return client[_0x65df('0x2')]('AddTagsToFaxInteraction',{'body':_0x344d1f,'options':{'where':{'id':_0x5610f6}},'log':_0x65df('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index b390973..006c86a 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 _0x80c2=['CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x5baabf,_0x255f4c){var _0x3cf967=function(_0x82d749){while(--_0x82d749){_0x5baabf['push'](_0x5baabf['shift']());}};_0x3cf967(++_0x255f4c);}(_0x80c2,0xc2));var _0x280c=function(_0xbf5ef9,_0x38f812){_0xbf5ef9=_0xbf5ef9-0x0;var _0x5b8161=_0x80c2[_0xbf5ef9];return _0x5b8161;};'use strict';var client=require(_0x280c('0x0'));exports[_0x280c('0x1')]=function(_0x36de9a){return client['Request'](_0x280c('0x2'),{'body':_0x36de9a,'log':_0x280c('0x3')});}; \ No newline at end of file +var _0xba2a=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x2a555a,_0x194f35){var _0x4dc4fd=function(_0x3faf62){while(--_0x3faf62){_0x2a555a['push'](_0x2a555a['shift']());}};_0x4dc4fd(++_0x194f35);}(_0xba2a,0x86));var _0xaba2=function(_0xb61562,_0x1c8d99){_0xb61562=_0xb61562-0x0;var _0x4f73c0=_0xba2a[_0xb61562];return _0x4f73c0;};'use strict';var client=require(_0xaba2('0x0'));exports[_0xaba2('0x1')]=function(_0x3ec2d1){return client[_0xaba2('0x2')](_0xaba2('0x3'),{'body':_0x3ec2d1,'log':_0xaba2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 057c2b1..16bd17f 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 _0x56d8=['GetFaxQueue','name','timeout','strategy','User','Agents','faxPause','getFaxQueues','../client','Request'];(function(_0x3a85c7,_0xc6f274){var _0x341765=function(_0x4211f1){while(--_0x4211f1){_0x3a85c7['push'](_0x3a85c7['shift']());}};_0x341765(++_0xc6f274);}(_0x56d8,0x17a));var _0x856d=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x56d8[_0x278e3c];return _0x3e2d9b;};'use strict';var client=require(_0x856d('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x856d('0x1')](_0x856d('0x2'),{'options':{'raw':![],'attributes':['id',_0x856d('0x3'),_0x856d('0x4'),_0x856d('0x5')],'include':[{'model':_0x856d('0x6'),'as':_0x856d('0x7'),'attributes':['id','name','online',_0x856d('0x8')]}]},'log':_0x856d('0x9')});};}; \ No newline at end of file +var _0x898a=['timeout','strategy','User','name','online','../client','getFaxQueues'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x898a,0x1e1));var _0xa898=function(_0xf656b3,_0xc8dc48){_0xf656b3=_0xf656b3-0x0;var _0x467a5f=_0x898a[_0xf656b3];return _0x467a5f;};'use strict';var client=require(_0xa898('0x0'));exports[_0xa898('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0xa898('0x2'),_0xa898('0x3')],'include':[{'model':_0xa898('0x4'),'as':'Agents','attributes':['id',_0xa898('0x5'),_0xa898('0x6'),'faxPause']}]},'log':_0xa898('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0112300..c2c60cb 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 _0x66f7=['Request','DESC','UpdateFaxQueueReport','create','CreateFaxQueueReport','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x66f7,0x16b));var _0x766f=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x66f7[_0x15fc3c];return _0x94c5c8;};'use strict';var client=require('../client');exports[_0x766f('0x0')]=function(_0x610cd6){return client['Request'](_0x766f('0x1'),{'body':_0x610cd6,'log':'CreateFaxQueueReport'});};exports[_0x766f('0x2')]=function(_0x50e9d3,_0x56bb70){return client[_0x766f('0x3')]('UpdateFaxQueueReport',{'body':_0x56bb70,'options':{'where':{'uniqueid':_0x50e9d3},'order':[['id',_0x766f('0x4')]],'limit':0x1},'log':_0x766f('0x5')});}; \ No newline at end of file +var _0xc96b=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x1e39dc,_0x38a8ae){var _0xd2c696=function(_0x264c19){while(--_0x264c19){_0x1e39dc['push'](_0x1e39dc['shift']());}};_0xd2c696(++_0x38a8ae);}(_0xc96b,0x16d));var _0xbc96=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc96b[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xbc96('0x0'));exports[_0xbc96('0x1')]=function(_0x477287){return client[_0xbc96('0x2')](_0xbc96('0x3'),{'body':_0x477287,'log':_0xbc96('0x3')});};exports[_0xbc96('0x4')]=function(_0xb855a4,_0xa0bba6){return client[_0xbc96('0x2')](_0xbc96('0x5'),{'body':_0xa0bba6,'options':{'where':{'uniqueid':_0xb855a4},'order':[['id',_0xbc96('0x6')]],'limit':0x1},'log':_0xbc96('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index cbe3528..6f152ff 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 _0xa866=['interval','../client','getIntervals','Request','GetInterval','name','Intervals'];(function(_0x5a6326,_0x569236){var _0x2dfedd=function(_0xc3e81c){while(--_0xc3e81c){_0x5a6326['push'](_0x5a6326['shift']());}};_0x2dfedd(++_0x569236);}(_0xa866,0x6a));var _0x6a86=function(_0x2d2082,_0x343b76){_0x2d2082=_0x2d2082-0x0;var _0x351506=_0xa866[_0x2d2082];return _0x351506;};'use strict';var client=require(_0x6a86('0x0'));exports[_0x6a86('0x1')]=function(){return function(){return client[_0x6a86('0x2')](_0x6a86('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6a86('0x4')],'include':[{'model':'Interval','as':_0x6a86('0x5'),'attributes':['id',_0x6a86('0x4'),_0x6a86('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xb9be=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x512c74,_0x104492){var _0x1a4cd8=function(_0x7c30e4){while(--_0x7c30e4){_0x512c74['push'](_0x512c74['shift']());}};_0x1a4cd8(++_0x104492);}(_0xb9be,0xc5));var _0xeb9b=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0xb9be[_0x59e821];return _0x5333f6;};'use strict';var client=require(_0xeb9b('0x0'));exports[_0xeb9b('0x1')]=function(){return function(){return client[_0xeb9b('0x2')](_0xeb9b('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeb9b('0x4')],'include':[{'model':_0xeb9b('0x5'),'as':_0xeb9b('0x6'),'attributes':['id',_0xeb9b('0x4'),_0xeb9b('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 3a8db9f..f1e9819 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 _0x83af=['Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x393348,_0x533dcd){var _0x51c1de=function(_0x2f7b26){while(--_0x2f7b26){_0x393348['push'](_0x393348['shift']());}};_0x51c1de(++_0x533dcd);}(_0x83af,0x1cd));var _0xf83a=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0x83af[_0x290fa6];return _0x47f1f3;};'use strict';var client=require(_0xf83a('0x0'));exports['update']=function(_0x8b4ea5,_0xb14b37){return client[_0xf83a('0x1')](_0xf83a('0x2'),{'body':_0xb14b37,'options':{'where':{'id':_0x8b4ea5}},'log':'updateMailInteraction'});};exports[_0xf83a('0x3')]=function(_0x2dd959,_0x10df22){return client[_0xf83a('0x1')](_0xf83a('0x4'),{'body':_0x10df22,'options':{'where':{'id':_0x2dd959}},'log':_0xf83a('0x5')});}; \ No newline at end of file +var _0xabb7=['UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xabb7,0x13a));var _0x7abb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xabb7[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require('../client');exports[_0x7abb('0x0')]=function(_0x2dbf69,_0x46a71e){return client['Request'](_0x7abb('0x1'),{'body':_0x46a71e,'options':{'where':{'id':_0x2dbf69}},'log':_0x7abb('0x2')});};exports[_0x7abb('0x3')]=function(_0x820863,_0x3395f5){return client[_0x7abb('0x4')](_0x7abb('0x5'),{'body':_0x3395f5,'options':{'where':{'id':_0x820863}},'log':_0x7abb('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 39e6a49..e06fe15 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 _0x5ddc=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x103292,_0x1386a6){var _0x4c4435=function(_0x53be7c){while(--_0x53be7c){_0x103292['push'](_0x103292['shift']());}};_0x4c4435(++_0x1386a6);}(_0x5ddc,0x151));var _0xc5dd=function(_0x3299aa,_0x25c86d){_0x3299aa=_0x3299aa-0x0;var _0x43fa11=_0x5ddc[_0x3299aa];return _0x43fa11;};'use strict';var client=require(_0xc5dd('0x0'));exports[_0xc5dd('0x1')]=function(_0x1fa1a9){return client['Request'](_0xc5dd('0x2'),{'body':_0x1fa1a9,'log':_0xc5dd('0x3')});}; \ No newline at end of file +var _0xd4b7=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x629c83,_0x367800){var _0x315d48=function(_0x571bb9){while(--_0x571bb9){_0x629c83['push'](_0x629c83['shift']());}};_0x315d48(++_0x367800);}(_0xd4b7,0xf4));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7d4b('0x0'));exports[_0x7d4b('0x1')]=function(_0x2a59cb){return client['Request'](_0x7d4b('0x2'),{'body':_0x2a59cb,'log':_0x7d4b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index fd5baeb..131bead 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 _0xd3b9=['User','Agents','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy'];(function(_0x156aa8,_0x2639c1){var _0x44bc0b=function(_0x4e684a){while(--_0x4e684a){_0x156aa8['push'](_0x156aa8['shift']());}};_0x44bc0b(++_0x2639c1);}(_0xd3b9,0x6e));var _0x9d3b=function(_0x17998f,_0x5b5f2c){_0x17998f=_0x17998f-0x0;var _0x328a85=_0xd3b9[_0x17998f];return _0x328a85;};'use strict';var client=require(_0x9d3b('0x0'));exports[_0x9d3b('0x1')]=function(){return function(){return client[_0x9d3b('0x2')](_0x9d3b('0x3'),{'options':{'raw':![],'attributes':['id',_0x9d3b('0x4'),_0x9d3b('0x5'),_0x9d3b('0x6')],'include':[{'model':_0x9d3b('0x7'),'as':_0x9d3b('0x8'),'attributes':['id','name','online','mailPause']}]},'log':_0x9d3b('0x1')});};}; \ No newline at end of file +var _0x4153=['name','online','mailPause','getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0x4153,0x176));var _0x3415=function(_0x13c65a,_0x571ca1){_0x13c65a=_0x13c65a-0x0;var _0x1337b3=_0x4153[_0x13c65a];return _0x1337b3;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x3415('0x0')](_0x3415('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x3415('0x2'),_0x3415('0x3')],'include':[{'model':_0x3415('0x4'),'as':_0x3415('0x5'),'attributes':['id',_0x3415('0x6'),_0x3415('0x7'),_0x3415('0x8')]}]},'log':_0x3415('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index d0e31e8..e963d1f 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 _0xebf6=['CreateMailQueueReport','UpdateMailQueueReport','../client','create','Request'];(function(_0x425831,_0x5724b5){var _0x1c337f=function(_0x36f0dc){while(--_0x36f0dc){_0x425831['push'](_0x425831['shift']());}};_0x1c337f(++_0x5724b5);}(_0xebf6,0x75));var _0x6ebf=function(_0x2805d0,_0x47a649){_0x2805d0=_0x2805d0-0x0;var _0x2d4bf5=_0xebf6[_0x2805d0];return _0x2d4bf5;};'use strict';var client=require(_0x6ebf('0x0'));exports[_0x6ebf('0x1')]=function(_0x456571){return client[_0x6ebf('0x2')](_0x6ebf('0x3'),{'body':_0x456571,'log':'CreateMailQueueReport'});};exports['update']=function(_0x213ab9,_0x6f924c){return client['Request'](_0x6ebf('0x4'),{'body':_0x6f924c,'options':{'where':{'uniqueid':_0x213ab9},'order':[['id','DESC']],'limit':0x1},'log':_0x6ebf('0x4')});}; \ No newline at end of file +var _0x89b5=['UpdateMailQueueReport','create','CreateMailQueueReport','update','Request','DESC'];(function(_0x2213ab,_0x487773){var _0x5b6403=function(_0x289005){while(--_0x289005){_0x2213ab['push'](_0x2213ab['shift']());}};_0x5b6403(++_0x487773);}(_0x89b5,0xfd));var _0x589b=function(_0x4abbca,_0x11ba72){_0x4abbca=_0x4abbca-0x0;var _0x4a7a44=_0x89b5[_0x4abbca];return _0x4a7a44;};'use strict';var client=require('../client');exports[_0x589b('0x0')]=function(_0x2fb95a){return client['Request']('CreateMailQueueReport',{'body':_0x2fb95a,'log':_0x589b('0x1')});};exports[_0x589b('0x2')]=function(_0x4d48e4,_0x12c72d){return client[_0x589b('0x3')]('UpdateMailQueueReport',{'body':_0x12c72d,'options':{'where':{'uniqueid':_0x4d48e4},'order':[['id',_0x589b('0x4')]],'limit':0x1},'log':_0x589b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 8cce9fe..98ccdc7 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 _0xe489=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','../client','update'];(function(_0x25d542,_0x462ad9){var _0x377a7e=function(_0x5bd8ee){while(--_0x5bd8ee){_0x25d542['push'](_0x25d542['shift']());}};_0x377a7e(++_0x462ad9);}(_0xe489,0xa0));var _0x9e48=function(_0x21b3ba,_0x18c9f6){_0x21b3ba=_0x21b3ba-0x0;var _0x495325=_0xe489[_0x21b3ba];return _0x495325;};'use strict';var client=require(_0x9e48('0x0'));exports[_0x9e48('0x1')]=function(_0x2d1d0c,_0x5710c3){return client[_0x9e48('0x2')](_0x9e48('0x3'),{'body':_0x5710c3,'options':{'where':{'id':_0x2d1d0c}},'log':_0x9e48('0x4')});};exports[_0x9e48('0x5')]=function(_0x3cf125,_0x8bae9a){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x8bae9a,'options':{'where':{'id':_0x3cf125}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x8e63=['Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','updateOpenchannelInteraction'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x8e63,0x83));var _0x38e6=function(_0x5be2f7,_0x1d4d63){_0x5be2f7=_0x5be2f7-0x0;var _0x432e78=_0x8e63[_0x5be2f7];return _0x432e78;};'use strict';var client=require('../client');exports['update']=function(_0x16971a,_0x512186){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x512186,'options':{'where':{'id':_0x16971a}},'log':_0x38e6('0x0')});};exports['addTags']=function(_0x456fd9,_0x5c212f){return client[_0x38e6('0x1')](_0x38e6('0x2'),{'body':_0x5c212f,'options':{'where':{'id':_0x456fd9}},'log':_0x38e6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 56b08ac..21d5261 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 _0x153f=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x153f,0x15b));var _0xf153=function(_0x337303,_0x4cc371){_0x337303=_0x337303-0x0;var _0x40c49e=_0x153f[_0x337303];return _0x40c49e;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(_0xde7eae){return client[_0xf153('0x2')](_0xf153('0x3'),{'body':_0xde7eae,'log':_0xf153('0x4')});}; \ No newline at end of file +var _0xe706=['create','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x461d62,_0x5041bf){var _0x5deb71=function(_0x50b84a){while(--_0x50b84a){_0x461d62['push'](_0x461d62['shift']());}};_0x5deb71(++_0x5041bf);}(_0xe706,0xa3));var _0x6e70=function(_0x141310,_0x4fb243){_0x141310=_0x141310-0x0;var _0x4680ae=_0xe706[_0x141310];return _0x4680ae;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(_0x311951){return client['Request'](_0x6e70('0x2'),{'body':_0x311951,'log':_0x6e70('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 1218b93..4849a75 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 _0x46ec=['Agents','name','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy'];(function(_0x352da8,_0x298198){var _0x3a60a4=function(_0x2351ed){while(--_0x2351ed){_0x352da8['push'](_0x352da8['shift']());}};_0x3a60a4(++_0x298198);}(_0x46ec,0x15a));var _0xc46e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x46ec[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xc46e('0x0')]=function(){return function(){return client[_0xc46e('0x1')](_0xc46e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xc46e('0x3'),_0xc46e('0x4')],'include':[{'model':'User','as':_0xc46e('0x5'),'attributes':['id',_0xc46e('0x6'),_0xc46e('0x7'),_0xc46e('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xeb70=['getOpenchannelQueues','Request','name','strategy','User','online','../client'];(function(_0x35f8bf,_0x8bfff1){var _0x6cf3f4=function(_0x22ffa6){while(--_0x22ffa6){_0x35f8bf['push'](_0x35f8bf['shift']());}};_0x6cf3f4(++_0x8bfff1);}(_0xeb70,0xca));var _0x0eb7=function(_0x857df7,_0x5068ce){_0x857df7=_0x857df7-0x0;var _0x1da2ca=_0xeb70[_0x857df7];return _0x1da2ca;};'use strict';var client=require(_0x0eb7('0x0'));exports[_0x0eb7('0x1')]=function(){return function(){return client[_0x0eb7('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x0eb7('0x3'),'timeout',_0x0eb7('0x4')],'include':[{'model':_0x0eb7('0x5'),'as':'Agents','attributes':['id','name',_0x0eb7('0x6'),'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 0fe07bb..91a4186 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 _0x0b60=['update','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b60,0x86));var _0x00b6=function(_0x1f8f97,_0x1c8de4){_0x1f8f97=_0x1f8f97-0x0;var _0x59871e=_0x0b60[_0x1f8f97];return _0x59871e;};'use strict';var client=require(_0x00b6('0x0'));exports[_0x00b6('0x1')]=function(_0x5b7c16){return client[_0x00b6('0x2')]('CreateOpenchannelQueueReport',{'body':_0x5b7c16,'log':_0x00b6('0x3')});};exports[_0x00b6('0x4')]=function(_0x48771c,_0x2bcb54){return client[_0x00b6('0x2')](_0x00b6('0x5'),{'body':_0x2bcb54,'options':{'where':{'uniqueid':_0x48771c},'order':[['id','DESC']],'limit':0x1},'log':_0x00b6('0x5')});}; \ No newline at end of file +var _0xb73e=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x57d567,_0x633013){var _0x16f031=function(_0x5a13ce){while(--_0x5a13ce){_0x57d567['push'](_0x57d567['shift']());}};_0x16f031(++_0x633013);}(_0xb73e,0x101));var _0xeb73=function(_0x280377,_0x456bce){_0x280377=_0x280377-0x0;var _0x40836d=_0xb73e[_0x280377];return _0x40836d;};'use strict';var client=require(_0xeb73('0x0'));exports[_0xeb73('0x1')]=function(_0x276ff6){return client[_0xeb73('0x2')]('CreateOpenchannelQueueReport',{'body':_0x276ff6,'log':_0xeb73('0x3')});};exports[_0xeb73('0x4')]=function(_0x45b4d9,_0x51c538){return client[_0xeb73('0x2')](_0xeb73('0x5'),{'body':_0x51c538,'options':{'where':{'uniqueid':_0x45b4d9},'order':[['id',_0xeb73('0x6')]],'limit':0x1},'log':_0xeb73('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 27d521b..c4b54be 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 _0x3004=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x101783,_0x137615){var _0x6df94e=function(_0x55aadc){while(--_0x55aadc){_0x101783['push'](_0x101783['shift']());}};_0x6df94e(++_0x137615);}(_0x3004,0x123));var _0x4300=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x3004[_0x58c20f];return _0x3b0318;};'use strict';var client=require(_0x4300('0x0'));exports[_0x4300('0x1')]=function(_0x16a1d1,_0x450505){return client[_0x4300('0x2')]('UpdateSmsInteraction',{'body':_0x450505,'options':{'where':{'id':_0x16a1d1}},'log':_0x4300('0x3')});};exports[_0x4300('0x4')]=function(_0x47d3d8,_0x1766fc){return client['Request'](_0x4300('0x5'),{'body':_0x1766fc,'options':{'where':{'id':_0x47d3d8}},'log':_0x4300('0x6')});}; \ No newline at end of file +var _0xf831=['addTags','AddTagsToSmsInteraction','update','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf831,0x72));var _0x1f83=function(_0x35a6f5,_0x18f43c){_0x35a6f5=_0x35a6f5-0x0;var _0x314baf=_0xf831[_0x35a6f5];return _0x314baf;};'use strict';var client=require('../client');exports[_0x1f83('0x0')]=function(_0x297356,_0x5136fa){return client[_0x1f83('0x1')]('UpdateSmsInteraction',{'body':_0x5136fa,'options':{'where':{'id':_0x297356}},'log':'updateSmsInteraction'});};exports[_0x1f83('0x2')]=function(_0x196085,_0x2a3ac3){return client[_0x1f83('0x1')](_0x1f83('0x3'),{'body':_0x2a3ac3,'options':{'where':{'id':_0x196085}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ca61d5b..656b0d4 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 _0xe2cc=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0x4d03d6,_0x438a06){var _0x22752e=function(_0x1b2894){while(--_0x1b2894){_0x4d03d6['push'](_0x4d03d6['shift']());}};_0x22752e(++_0x438a06);}(_0xe2cc,0x69));var _0xce2c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xe2cc[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0xce2c('0x0'));exports[_0xce2c('0x1')]=function(_0x59c9fc){return client['Request'](_0xce2c('0x2'),{'body':_0x59c9fc,'log':_0xce2c('0x3')});}; \ No newline at end of file +var _0xc282=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0x235071,_0x30b4d2){var _0x5cc2c5=function(_0x3887ad){while(--_0x3887ad){_0x235071['push'](_0x235071['shift']());}};_0x5cc2c5(++_0x30b4d2);}(_0xc282,0x1b5));var _0x2c28=function(_0x5e09bf,_0x5dfc6f){_0x5e09bf=_0x5e09bf-0x0;var _0x18cc19=_0xc282[_0x5e09bf];return _0x18cc19;};'use strict';var client=require('../client');exports[_0x2c28('0x0')]=function(_0x76818a){return client[_0x2c28('0x1')](_0x2c28('0x2'),{'body':_0x76818a,'log':_0x2c28('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1f8c4ff..0359960 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 _0x1b38=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','User','Agents','smsPause','../client'];(function(_0x336bd4,_0x261a92){var _0x5a9961=function(_0x56274e){while(--_0x56274e){_0x336bd4['push'](_0x336bd4['shift']());}};_0x5a9961(++_0x261a92);}(_0x1b38,0x95));var _0x81b3=function(_0x2bf8ac,_0x4226be){_0x2bf8ac=_0x2bf8ac-0x0;var _0x3ef094=_0x1b38[_0x2bf8ac];return _0x3ef094;};'use strict';var client=require(_0x81b3('0x0'));exports[_0x81b3('0x1')]=function(){return function(){return client[_0x81b3('0x2')](_0x81b3('0x3'),{'options':{'raw':![],'attributes':['id',_0x81b3('0x4'),_0x81b3('0x5'),_0x81b3('0x6')],'include':[{'model':_0x81b3('0x7'),'as':_0x81b3('0x8'),'attributes':['id',_0x81b3('0x4'),'online',_0x81b3('0x9')]}]},'log':_0x81b3('0x1')});};}; \ No newline at end of file +var _0xf2f2=['../client','getSmsQueues','GetSmsQueue','timeout','strategy','User','online'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xf2f2,0x70));var _0x2f2f=function(_0x4e11d5,_0x1ce514){_0x4e11d5=_0x4e11d5-0x0;var _0x5e4e4c=_0xf2f2[_0x4e11d5];return _0x5e4e4c;};'use strict';var client=require(_0x2f2f('0x0'));exports[_0x2f2f('0x1')]=function(){return function(){return client['Request'](_0x2f2f('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x2f2f('0x3'),_0x2f2f('0x4')],'include':[{'model':_0x2f2f('0x5'),'as':'Agents','attributes':['id','name',_0x2f2f('0x6'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a1aed76..68d510e 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 _0x60a5=['DESC','../client','Request','update','UpdateSmsQueueReport'];(function(_0x5ac548,_0x181d98){var _0x55e4cb=function(_0x5a960f){while(--_0x5a960f){_0x5ac548['push'](_0x5ac548['shift']());}};_0x55e4cb(++_0x181d98);}(_0x60a5,0x83));var _0x560a=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x60a5[_0x2d7f0e];return _0x110b07;};'use strict';var client=require(_0x560a('0x0'));exports['create']=function(_0x58d464){return client[_0x560a('0x1')]('CreateSmsQueueReport',{'body':_0x58d464,'log':'CreateSmsQueueReport'});};exports[_0x560a('0x2')]=function(_0x121561,_0xe97b87){return client['Request'](_0x560a('0x3'),{'body':_0xe97b87,'options':{'where':{'uniqueid':_0x121561},'order':[['id',_0x560a('0x4')]],'limit':0x1},'log':_0x560a('0x3')});}; \ No newline at end of file +var _0x8ac5=['DESC','UpdateSmsQueueReport','../client','create','Request','CreateSmsQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ac5,0x105));var _0x58ac=function(_0x348683,_0x3ec631){_0x348683=_0x348683-0x0;var _0x35f06a=_0x8ac5[_0x348683];return _0x35f06a;};'use strict';var client=require(_0x58ac('0x0'));exports[_0x58ac('0x1')]=function(_0xff25a2){return client[_0x58ac('0x2')](_0x58ac('0x3'),{'body':_0xff25a2,'log':_0x58ac('0x3')});};exports[_0x58ac('0x4')]=function(_0x276bc0,_0x474fa3){return client[_0x58ac('0x2')]('UpdateSmsQueueReport',{'body':_0x474fa3,'options':{'where':{'uniqueid':_0x276bc0},'order':[['id',_0x58ac('0x5')]],'limit':0x1},'log':_0x58ac('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 5590354..10ffa06 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 _0x8bf2=['online','voicePause','mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','../client','Request','GetUser'];(function(_0x3fa9a3,_0x30c55d){var _0x146e4e=function(_0x34aa72){while(--_0x34aa72){_0x3fa9a3['push'](_0x3fa9a3['shift']());}};_0x146e4e(++_0x30c55d);}(_0x8bf2,0xde));var _0x28bf=function(_0x11bb3d,_0x275daa){_0x11bb3d=_0x11bb3d-0x0;var _0x50838f=_0x8bf2[_0x11bb3d];return _0x50838f;};'use strict';var client=require(_0x28bf('0x0'));exports['getAgents']=function(){return function(){return client[_0x28bf('0x1')](_0x28bf('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name',_0x28bf('0x3'),'pauseType','lastPauseAt',_0x28bf('0x4'),'chatPause',_0x28bf('0x5'),'faxPause',_0x28bf('0x6'),_0x28bf('0x7'),_0x28bf('0x8'),_0x28bf('0x9'),_0x28bf('0xa'),'faxCapacity',_0x28bf('0xb'),_0x28bf('0xc'),_0x28bf('0xd')]},'log':_0x28bf('0xe')});};}; \ No newline at end of file +var _0xa581=['agent','name','pauseType','lastPauseAt','mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa581,0x194));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1a58('0x0'));exports[_0x1a58('0x1')]=function(){return function(){return client[_0x1a58('0x2')](_0x1a58('0x3'),{'options':{'raw':!![],'where':{'role':_0x1a58('0x4')},'attributes':['id',_0x1a58('0x5'),'online',_0x1a58('0x6'),_0x1a58('0x7'),'voicePause','chatPause',_0x1a58('0x8'),'faxPause',_0x1a58('0x9'),_0x1a58('0xa'),_0x1a58('0xb'),_0x1a58('0xc'),_0x1a58('0xd'),_0x1a58('0xe'),_0x1a58('0xf'),'whatsappCapacity',_0x1a58('0x10')]},'log':_0x1a58('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index efccdee..eb4b9ec 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 _0x1738=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x46e7f9,_0x1bd875){var _0x363df5=function(_0x277d3f){while(--_0x277d3f){_0x46e7f9['push'](_0x46e7f9['shift']());}};_0x363df5(++_0x1bd875);}(_0x1738,0x1bc));var _0x8173=function(_0x4b1660,_0x2805de){_0x4b1660=_0x4b1660-0x0;var _0x5d2b93=_0x1738[_0x4b1660];return _0x5d2b93;};'use strict';var client=require(_0x8173('0x0'));exports[_0x8173('0x1')]=function(_0x5b1fa9,_0x483503){return client[_0x8173('0x2')](_0x8173('0x3'),{'body':_0x483503,'options':{'where':{'id':_0x5b1fa9}},'log':_0x8173('0x4')});};exports['addTags']=function(_0x555d4e,_0x30da17){return client[_0x8173('0x2')](_0x8173('0x5'),{'body':_0x30da17,'options':{'where':{'id':_0x555d4e}},'log':_0x8173('0x6')});}; \ No newline at end of file +var _0xf296=['updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','../client','update'];(function(_0x12e682,_0x33f3a3){var _0x26e600=function(_0x4d79dc){while(--_0x4d79dc){_0x12e682['push'](_0x12e682['shift']());}};_0x26e600(++_0x33f3a3);}(_0xf296,0x94));var _0x6f29=function(_0x2eedb5,_0x2e1801){_0x2eedb5=_0x2eedb5-0x0;var _0x534cd6=_0xf296[_0x2eedb5];return _0x534cd6;};'use strict';var client=require(_0x6f29('0x0'));exports[_0x6f29('0x1')]=function(_0x4e5239,_0x45ff60){return client['Request']('UpdateWhatsappInteraction',{'body':_0x45ff60,'options':{'where':{'id':_0x4e5239}},'log':_0x6f29('0x2')});};exports[_0x6f29('0x3')]=function(_0x4cdc12,_0x15e80c){return client[_0x6f29('0x4')](_0x6f29('0x5'),{'body':_0x15e80c,'options':{'where':{'id':_0x4cdc12}},'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 bdc5cb8..f238fab 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 _0xc6d3=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xc6d3,0x11b));var _0x3c6d=function(_0x2f5aaa,_0x4e684c){_0x2f5aaa=_0x2f5aaa-0x0;var _0x14e2c6=_0xc6d3[_0x2f5aaa];return _0x14e2c6;};'use strict';var client=require(_0x3c6d('0x0'));exports[_0x3c6d('0x1')]=function(_0xf738b9){return client[_0x3c6d('0x2')](_0x3c6d('0x3'),{'body':_0xf738b9,'log':_0x3c6d('0x4')});}; \ No newline at end of file +var _0x714d=['CreateWhatsappMessage','Request'];(function(_0x3c3b7a,_0x545178){var _0x28eaa2=function(_0x1f4b99){while(--_0x1f4b99){_0x3c3b7a['push'](_0x3c3b7a['shift']());}};_0x28eaa2(++_0x545178);}(_0x714d,0x1ed));var _0xd714=function(_0x2420b7,_0x3e4150){_0x2420b7=_0x2420b7-0x0;var _0x2251c1=_0x714d[_0x2420b7];return _0x2251c1;};'use strict';var client=require('../client');exports['create']=function(_0xaecb0a){return client[_0xd714('0x0')](_0xd714('0x1'),{'body':_0xaecb0a,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 9d1da55..0fe4561 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 _0x7af2=['online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','strategy','User','Agents'];(function(_0xc26e6d,_0x2886f0){var _0x4f49f0=function(_0xa1f8d2){while(--_0xa1f8d2){_0xc26e6d['push'](_0xc26e6d['shift']());}};_0x4f49f0(++_0x2886f0);}(_0x7af2,0x119));var _0x27af=function(_0x49e444,_0x1afd8f){_0x49e444=_0x49e444-0x0;var _0x3d578e=_0x7af2[_0x49e444];return _0x3d578e;};'use strict';var client=require('../client');exports[_0x27af('0x0')]=function(){return function(){return client[_0x27af('0x1')](_0x27af('0x2'),{'options':{'raw':![],'attributes':['id',_0x27af('0x3'),'timeout',_0x27af('0x4')],'include':[{'model':_0x27af('0x5'),'as':_0x27af('0x6'),'attributes':['id',_0x27af('0x3'),_0x27af('0x7'),_0x27af('0x8')]}]},'log':_0x27af('0x0')});};}; \ No newline at end of file +var _0x9c00=['../client','getWhatsappQueues','name','timeout','User','Agents','online','whatsappPause'];(function(_0x1f38c6,_0x428650){var _0x259367=function(_0x22bad0){while(--_0x22bad0){_0x1f38c6['push'](_0x1f38c6['shift']());}};_0x259367(++_0x428650);}(_0x9c00,0x1a0));var _0x09c0=function(_0x16df8f,_0x3dbe15){_0x16df8f=_0x16df8f-0x0;var _0x56ffee=_0x9c00[_0x16df8f];return _0x56ffee;};'use strict';var client=require(_0x09c0('0x0'));exports[_0x09c0('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x09c0('0x2'),_0x09c0('0x3'),'strategy'],'include':[{'model':_0x09c0('0x4'),'as':_0x09c0('0x5'),'attributes':['id',_0x09c0('0x2'),_0x09c0('0x6'),_0x09c0('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index cbf0f9e..3dbad53 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 _0x4fe8=['Request','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4fe8,0x160));var _0x84fe=function(_0x48195a,_0x38622c){_0x48195a=_0x48195a-0x0;var _0x3ca1d8=_0x4fe8[_0x48195a];return _0x3ca1d8;};'use strict';var client=require(_0x84fe('0x0'));exports[_0x84fe('0x1')]=function(_0x4f0431){return client[_0x84fe('0x2')]('CreateWhatsappQueueReport',{'body':_0x4f0431,'log':'CreateWhatsappQueueReport'});};exports[_0x84fe('0x3')]=function(_0x3f774f,_0x416683){return client[_0x84fe('0x2')](_0x84fe('0x4'),{'body':_0x416683,'options':{'where':{'uniqueid':_0x3f774f},'order':[['id',_0x84fe('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x0f45=['CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','../client','create'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x0f45,0x9a));var _0x50f4=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x0f45[_0x1762b4];return _0x29beda;};'use strict';var client=require(_0x50f4('0x0'));exports[_0x50f4('0x1')]=function(_0x135f73){return client['Request'](_0x50f4('0x2'),{'body':_0x135f73,'log':'CreateWhatsappQueueReport'});};exports[_0x50f4('0x3')]=function(_0x1c05e0,_0x180c92){return client[_0x50f4('0x4')]('UpdateWhatsappQueueReport',{'body':_0x180c92,'options':{'where':{'uniqueid':_0x1c05e0},'order':[['id','DESC']],'limit':0x1},'log':_0x50f4('0x5')});}; \ 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 de97288..1218693 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 _0xe62e=['stack','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','log','[%s][QUEUE]\x20%s'];(function(_0x31109c,_0x5660ea){var _0x1121fa=function(_0x30e8c7){while(--_0x30e8c7){_0x31109c['push'](_0x31109c['shift']());}};_0x1121fa(++_0x5660ea);}(_0xe62e,0x73));var _0xee62=function(_0x42506f,_0x6adadb){_0x42506f=_0x42506f-0x0;var _0x7a6b4b=_0xe62e[_0x42506f];return _0x7a6b4b;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xee62('0x0'));var seqqueue=require(_0xee62('0x1'));var logger=require(_0xee62('0x2'))(_0xee62('0x3'));var strategy=require(_0xee62('0x4'));var queue=schema({'name':{'type':_0xee62('0x5'),'required':!![],'message':_0xee62('0x6')},'timeout':{'type':_0xee62('0x7'),'message':_0xee62('0x8')}});function writeLog(_0x211af7,_0x4292f4,_0x2422ad){return logger[_0xee62('0x9')](util[_0xee62('0xa')](_0xee62('0xb'),_0x211af7,_0x4292f4[_0xee62('0xc')],_0x2422ad));}function handleFindAgent(_0x3a9f65){return function(_0x170f49){return _0x170f49['name'][_0xee62('0xd')]()===_0x3a9f65[_0xee62('0xd')]();};}exports[_0xee62('0xe')]=function(_0x5cf860,_0x5be28f,_0xbe72fc,_0x1a60b6){return function(_0x68e606){try{var _0xa451ba={'name':_0x5be28f[0x0],'timeout':_0x5be28f[0x1]};var _0x1b2399=queue['validate'](_0xa451ba,{'typecast':!![]});if(_0x1b2399[_0xee62('0xf')]){logger[_0xee62('0x10')](_0xee62('0x11'),_0x5cf860,_[_0xee62('0x12')](_0x1b2399,_0xee62('0x13'))[_0xee62('0x14')](',\x20'));_0x68e606[_0xee62('0x15')]();}else{var _0x4cd6de=_['find'](_0xbe72fc[_0xee62('0x16')],handleFindAgent(_0xa451ba['name']));if(_0x4cd6de){var _0x3eb13b=(_0xa451ba[_0xee62('0x17')]||0xa)*0x3e8;var _0x1d44eb,_0xf08f1a;var _0x342fd6=seqqueue[_0xee62('0x18')](_0x3eb13b);_0x342fd6['id']=_0x5cf860;_0x342fd6[_0xee62('0x19')]=_0x3eb13b;_0x342fd6[_0xee62('0x1a')]=_0x1a60b6[_0xee62('0x1a')];writeLog(_0x5cf860,_0x4cd6de,util[_0xee62('0xa')]('START:%s',_0x3eb13b));_0xbe72fc[_0xee62('0x1b')][_0x5cf860]['on'](_0xee62('0x1c'),function(){logger['info'](_0xee62('0x1d'),_0x5cf860);clearTimeout(_0xf08f1a);_0xf08f1a=undefined;_0x342fd6['close']();if(_0xbe72fc[_0xee62('0x1b')][_0x5cf860]){delete _0xbe72fc[_0xee62('0x1b')][_0x5cf860];}_0x68e606[_0xee62('0x15')]();});_0xbe72fc[_0xee62('0x1b')][_0x5cf860]['on'](_0xee62('0x1e'),function(){if(_0xbe72fc['rules'][_0x5cf860]){delete _0xbe72fc['rules'][_0x5cf860];}});_0xf08f1a=setTimeout(function(){logger[_0xee62('0x9')](_0xee62('0x1f'),_0x5cf860);clearTimeout(_0xf08f1a);_0x342fd6[_0xee62('0x20')]();_0x68e606[_0xee62('0x21')]();},_0x3eb13b);strategy[_0xee62('0x22')](_0x342fd6,_0x4cd6de,_0xbe72fc,_0x1a60b6);}else{logger[_0xee62('0x10')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x5cf860,_0xa451ba['name']);_0x68e606[_0xee62('0x15')]();}}}catch(_0x36dfea){console[_0xee62('0x23')](_0x36dfea);logger['error'](_0xee62('0x24'),_0x5cf860,_0x36dfea[_0xee62('0x25')]);_0x68e606[_0xee62('0x15')]();}};}; \ No newline at end of file +var _0x5cd9=['string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','map','message','join','stop','find','timeout','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','complete','info','close','next','agent','error','log','stack','validate','seq-queue','../../../../config/logger','routing','./strategy'];(function(_0x274b55,_0x2823fe){var _0x1bafce=function(_0x19524b){while(--_0x19524b){_0x274b55['push'](_0x274b55['shift']());}};_0x1bafce(++_0x2823fe);}(_0x5cd9,0xcd));var _0x95cd=function(_0x5237fa,_0x2219d8){_0x5237fa=_0x5237fa-0x0;var _0x3f1a66=_0x5cd9[_0x5237fa];return _0x3f1a66;};'use strict';var schema=require(_0x95cd('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x95cd('0x1'));var logger=require(_0x95cd('0x2'))(_0x95cd('0x3'));var strategy=require(_0x95cd('0x4'));var queue=schema({'name':{'type':_0x95cd('0x5'),'required':!![],'message':_0x95cd('0x6')},'timeout':{'type':_0x95cd('0x7'),'message':_0x95cd('0x8')}});function writeLog(_0x55d299,_0x455f7d,_0x3f03d7){return logger['info'](util[_0x95cd('0x9')](_0x95cd('0xa'),_0x55d299,_0x455f7d[_0x95cd('0xb')],_0x3f03d7));}function handleFindAgent(_0x450e54){return function(_0x4e236f){return _0x4e236f[_0x95cd('0xb')][_0x95cd('0xc')]()===_0x450e54[_0x95cd('0xc')]();};}exports[_0x95cd('0xd')]=function(_0x121a4e,_0x294e54,_0x6b9610,_0x511cf2){return function(_0x1fbab8){try{var _0x1d3edd={'name':_0x294e54[0x0],'timeout':_0x294e54[0x1]};var _0x510ce8=queue[_0x95cd('0x0')](_0x1d3edd,{'typecast':!![]});if(_0x510ce8[_0x95cd('0xe')]){logger['error']('[%s][AGENT]\x20%s',_0x121a4e,_[_0x95cd('0xf')](_0x510ce8,_0x95cd('0x10'))[_0x95cd('0x11')](',\x20'));_0x1fbab8[_0x95cd('0x12')]();}else{var _0x3fd28b=_[_0x95cd('0x13')](_0x6b9610['agents'],handleFindAgent(_0x1d3edd[_0x95cd('0xb')]));if(_0x3fd28b){var _0xf1483c=(_0x1d3edd[_0x95cd('0x14')]||0xa)*0x3e8;var _0x46d790,_0x1c9812;var _0x56ff86=seqqueue['createQueue'](_0xf1483c);_0x56ff86['id']=_0x121a4e;_0x56ff86[_0x95cd('0x15')]=_0xf1483c;_0x56ff86[_0x95cd('0x16')]=_0x511cf2['channel'];writeLog(_0x121a4e,_0x3fd28b,util['format'](_0x95cd('0x17'),_0xf1483c));_0x6b9610['rules'][_0x121a4e]['on'](_0x95cd('0x18'),function(){logger['info'](_0x95cd('0x19'),_0x121a4e);clearTimeout(_0x1c9812);_0x1c9812=undefined;_0x56ff86['close']();if(_0x6b9610[_0x95cd('0x1a')][_0x121a4e]){delete _0x6b9610['rules'][_0x121a4e];}_0x1fbab8[_0x95cd('0x12')]();});_0x6b9610[_0x95cd('0x1a')][_0x121a4e]['on'](_0x95cd('0x1b'),function(){if(_0x6b9610[_0x95cd('0x1a')][_0x121a4e]){delete _0x6b9610[_0x95cd('0x1a')][_0x121a4e];}});_0x1c9812=setTimeout(function(){logger[_0x95cd('0x1c')]('[%s][AGENT]\x20ROUTING\x20END',_0x121a4e);clearTimeout(_0x1c9812);_0x56ff86[_0x95cd('0x1d')]();_0x1fbab8[_0x95cd('0x1e')]();},_0xf1483c);strategy[_0x95cd('0x1f')](_0x56ff86,_0x3fd28b,_0x6b9610,_0x511cf2);}else{logger[_0x95cd('0x20')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x121a4e,_0x1d3edd['name']);_0x1fbab8['stop']();}}}catch(_0x38912b){console[_0x95cd('0x21')](_0x38912b);logger[_0x95cd('0x20')]('[%s][QUEUE]\x20%s',_0x121a4e,_0x38912b[_0x95cd('0x22')]);_0x1fbab8[_0x95cd('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 84bc527..d880450 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 _0x7a54=['../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','next','format','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','Message','create','then','info','catch','[%s][AMAZONLEX]\x20%s','stringify','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','error','amazonlex','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x5291ec,_0x4cb526){var _0x56d700=function(_0x5c2b0a){while(--_0x5c2b0a){_0x5291ec['push'](_0x5291ec['shift']());}};_0x56d700(++_0x4cb526);}(_0x7a54,0x106));var _0x47a5=function(_0x1fe34c,_0x2e56e2){_0x1fe34c=_0x1fe34c-0x0;var _0x9fbdee=_0x7a54[_0x1fe34c];return _0x9fbdee;};'use strict';var _=require(_0x47a5('0x0'));var moment=require(_0x47a5('0x1'));var AWS=require(_0x47a5('0x2'));var utils=require('./utils');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x47a5('0x5')),'mailMessage':require(_0x47a5('0x6')),'smsMessage':require(_0x47a5('0x7')),'faxMessage':require(_0x47a5('0x8')),'whatsappMessage':require(_0x47a5('0x9'))};exports['consequence']=function(_0x3d5629,_0x59199c){return function(_0x343372){try{if(!_[_0x47a5('0xa')](this['interaction'][_0x47a5('0xb')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3d5629,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x343372[_0x47a5('0xc')]();}var _0x2baee7={'ContactId':this['contact']['id'],'sentAt':moment()[_0x47a5('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x1f47f4=this[_0x47a5('0xe')];if(_0x1f47f4===_0x47a5('0xf')){_0x2baee7[_0x47a5('0x10')]=this[_0x47a5('0x11')]['id'];}else{_0x2baee7[_[_0x47a5('0x12')](_0x1f47f4)+_0x47a5('0x13')]=this['account']['id'];}_0x2baee7[_[_0x47a5('0x12')](_0x1f47f4)+_0x47a5('0x14')]=this[_0x47a5('0x15')]['id'];if(this[_0x47a5('0x15')][_0x47a5('0x16')]){var _0x620ee9=_0x59199c[0x4];if(!_[_0x47a5('0x17')](_0x620ee9)){_0x2baee7[_0x47a5('0x18')]=utils['getMustacheRender'](_0x620ee9,this);return rpc[_0x1f47f4+_0x47a5('0x19')][_0x47a5('0x1a')](_0x2baee7)[_0x47a5('0x1b')](function(_0x2a2cbb){logger[_0x47a5('0x1c')]('[%s][AMAZONLEX]\x20%s',_0x3d5629,_0x2baee7['body']);})[_0x47a5('0x1d')](function(_0x4b966e){logger['error'](_0x47a5('0x1e'),_0x3d5629,JSON[_0x47a5('0x1f')](_0x4b966e));})[_0x47a5('0x20')](function(){logger[_0x47a5('0x1c')](_0x47a5('0x21'),_0x3d5629);_0x343372[_0x47a5('0x22')]();});}else{logger[_0x47a5('0x1c')](_0x47a5('0x23'),_0x3d5629);_0x343372[_0x47a5('0x22')]();}}else{var _0x4a9fcb=this;var _0x1570bc=new AWS[(_0x47a5('0x24'))]({'accessKeyId':_0x59199c[0x0],'secretAccessKey':_0x59199c[0x1],'region':_0x59199c[0x2]});var _0x47cf3c={'botAlias':_0x47a5('0x25'),'botName':_0x59199c[0x3],'inputText':this[_0x47a5('0x26')][_0x47a5('0x18')],'userId':this['channel']+':'+this[_0x47a5('0x15')]['id'][_0x47a5('0x27')]()};_0x1570bc[_0x47a5('0x28')](_0x47cf3c,function(_0x7a9f9e,_0x5ef1b1){if(_0x7a9f9e){logger[_0x47a5('0x29')](_0x47a5('0x1e'),_0x3d5629,_0x7a9f9e['message']);_0x343372[_0x47a5('0xc')]();}else if(_0x5ef1b1&&_0x5ef1b1[_0x47a5('0x26')]){_0x4a9fcb[_0x47a5('0x18')][_0x47a5('0x2a')]=_0x5ef1b1;_0x2baee7[_0x47a5('0x18')]=_0x5ef1b1['message'];return rpc[_0x1f47f4+'Message'][_0x47a5('0x1a')](_0x2baee7)['then'](function(_0x1ea9c8){logger['info'](_0x47a5('0x1e'),_0x3d5629,_0x2baee7[_0x47a5('0x18')]);if(_0x5ef1b1[_0x47a5('0x2b')]==_0x47a5('0x2c')){_0x343372[_0x47a5('0xc')]();}else{_0x343372[_0x47a5('0x22')]();}})[_0x47a5('0x1d')](function(_0x136b14){logger[_0x47a5('0x29')](_0x47a5('0x1e'),_0x3d5629,JSON[_0x47a5('0x1f')](_0x136b14));_0x343372[_0x47a5('0xc')]();});}else{_0x343372[_0x47a5('0xc')]();}});}}catch(_0x528582){logger[_0x47a5('0x29')]('[%s][AMAZONLEX]\x20%s',_0x3d5629,JSON[_0x47a5('0x1f')](_0x528582));_0x343372[_0x47a5('0x22')]();}};}; \ No newline at end of file +var _0x4975=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','message','amazonlex','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','account','upperFirst','AccountId','InteractionId','created','body','Message','create','then','[%s][AMAZONLEX]\x20%s','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4975,0x86));var _0x5497=function(_0x394dcf,_0x37546a){_0x394dcf=_0x394dcf-0x0;var _0x5406a8=_0x4975[_0x394dcf];return _0x5406a8;};'use strict';var _=require(_0x5497('0x0'));var moment=require('moment');var AWS=require(_0x5497('0x1'));var utils=require(_0x5497('0x2'));var logger=require(_0x5497('0x3'))(_0x5497('0x4'));var rpc={'chatMessage':require(_0x5497('0x5')),'openchannelMessage':require(_0x5497('0x6')),'mailMessage':require(_0x5497('0x7')),'smsMessage':require(_0x5497('0x8')),'faxMessage':require(_0x5497('0x9')),'whatsappMessage':require(_0x5497('0xa'))};exports['consequence']=function(_0x37e48d,_0x4f563d){return function(_0x1d0019){try{if(!_[_0x5497('0xb')](this[_0x5497('0xc')]['UserId'])){logger[_0x5497('0xd')]('[%s][AMAZONLEX]\x20%s',_0x37e48d,_0x5497('0xe'));return _0x1d0019[_0x5497('0xf')]();}var _0x2ec5a4={'ContactId':this[_0x5497('0x10')]['id'],'sentAt':moment()[_0x5497('0x11')](_0x5497('0x12')),'direction':_0x5497('0x13')};var _0x769e11=this['channel'];if(_0x769e11==='chat'){_0x2ec5a4['ChatWebsiteId']=this[_0x5497('0x14')]['id'];}else{_0x2ec5a4[_[_0x5497('0x15')](_0x769e11)+_0x5497('0x16')]=this[_0x5497('0x14')]['id'];}_0x2ec5a4[_[_0x5497('0x15')](_0x769e11)+_0x5497('0x17')]=this[_0x5497('0xc')]['id'];if(this[_0x5497('0xc')][_0x5497('0x18')]){var _0x1a4c74=_0x4f563d[0x4];if(!_['isEmpty'](_0x1a4c74)){_0x2ec5a4[_0x5497('0x19')]=utils['getMustacheRender'](_0x1a4c74,this);return rpc[_0x769e11+_0x5497('0x1a')][_0x5497('0x1b')](_0x2ec5a4)[_0x5497('0x1c')](function(_0x3ce50b){logger[_0x5497('0xd')](_0x5497('0x1d'),_0x37e48d,_0x2ec5a4[_0x5497('0x19')]);})['catch'](function(_0x56a788){logger[_0x5497('0x1e')](_0x5497('0x1d'),_0x37e48d,JSON[_0x5497('0x1f')](_0x56a788));})['finally'](function(){logger[_0x5497('0xd')](_0x5497('0x20'),_0x37e48d);_0x1d0019[_0x5497('0x21')]();});}else{logger[_0x5497('0xd')](_0x5497('0x22'),_0x37e48d);_0x1d0019[_0x5497('0x21')]();}}else{var _0x16d378=this;var _0x10226f=new AWS[(_0x5497('0x23'))]({'accessKeyId':_0x4f563d[0x0],'secretAccessKey':_0x4f563d[0x1],'region':_0x4f563d[0x2]});var _0x3f54ef={'botAlias':_0x5497('0x24'),'botName':_0x4f563d[0x3],'inputText':this['message'][_0x5497('0x19')],'userId':this['channel']+':'+this[_0x5497('0xc')]['id'][_0x5497('0x25')]()};_0x10226f[_0x5497('0x26')](_0x3f54ef,function(_0x2f587d,_0x35ecd9){if(_0x2f587d){logger[_0x5497('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x37e48d,_0x2f587d['message']);_0x1d0019[_0x5497('0xf')]();}else if(_0x35ecd9&&_0x35ecd9[_0x5497('0x27')]){_0x16d378[_0x5497('0x19')][_0x5497('0x28')]=_0x35ecd9;_0x2ec5a4['body']=_0x35ecd9[_0x5497('0x27')];return rpc[_0x769e11+'Message'][_0x5497('0x1b')](_0x2ec5a4)[_0x5497('0x1c')](function(_0x429d36){logger[_0x5497('0xd')](_0x5497('0x1d'),_0x37e48d,_0x2ec5a4[_0x5497('0x19')]);if(_0x35ecd9['dialogState']==_0x5497('0x29')){_0x1d0019['next']();}else{_0x1d0019['stop']();}})['catch'](function(_0x39a2b7){logger['error']('[%s][AMAZONLEX]\x20%s',_0x37e48d,JSON[_0x5497('0x1f')](_0x39a2b7));_0x1d0019[_0x5497('0xf')]();});}else{_0x1d0019[_0x5497('0xf')]();}});}}catch(_0x4c442a){logger['error']('[%s][AMAZONLEX]\x20%s',_0x37e48d,JSON[_0x5497('0x1f')](_0x4c442a));_0x1d0019[_0x5497('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index ce172a7..7e4a038 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 _0xbbd5=['host','port','authentication','auth','user','pass','inReplyTo','messageId','replace','body','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','catch','error','finally','next','create','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Smtp','service'];(function(_0x2aed7d,_0x797a22){var _0x52fa17=function(_0x56386d){while(--_0x56386d){_0x2aed7d['push'](_0x2aed7d['shift']());}};_0x52fa17(++_0x797a22);}(_0xbbd5,0x84));var _0x5bbd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbbd5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5bbd('0x0'));var moment=require(_0x5bbd('0x1'));var utils=require('./utils');var logger=require(_0x5bbd('0x2'))(_0x5bbd('0x3'));var rpc={'chatMessage':require(_0x5bbd('0x4')),'openchannelMessage':require(_0x5bbd('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5bbd('0x6')),'faxMessage':require(_0x5bbd('0x7')),'whatsappMessage':require(_0x5bbd('0x8'))};var mailRpc=require('../../mailRpc');exports[_0x5bbd('0x9')]=function(_0x3b4f5f,_0xd859d4){return function(_0x59acc9){try{if(_0xd859d4[0x0]==='1'&&(_[_0x5bbd('0xa')](this[_0x5bbd('0xb')][_0x5bbd('0xc')])||!this[_0x5bbd('0xb')][_0x5bbd('0xc')])){logger[_0x5bbd('0xd')](_0x5bbd('0xe'),_0x3b4f5f,_0x5bbd('0xf'));return _0x59acc9['next']();}var _0x1363e5=this[_0x5bbd('0x10')];var _0x3bad69={'body':utils[_0x5bbd('0x11')](_0xd859d4[0x1],this),'ContactId':this[_0x5bbd('0x12')]['id'],'sentAt':moment()[_0x5bbd('0x13')](_0x5bbd('0x14')),'direction':_0x5bbd('0x15')};if(this['message']){_0x3bad69['to']=this[_0x5bbd('0x16')][_0x5bbd('0x17')]||'';_0x3bad69['cc']=this[_0x5bbd('0x16')]['cc']||'';_0x3bad69[_0x5bbd('0x17')]=this[_0x5bbd('0x16')]['to']||'';_0x3bad69[_0x5bbd('0x18')]=this[_0x5bbd('0x16')]['phone']||'';_0x3bad69['read']=!![];if(this[_0x5bbd('0x16')]['subject']){_0x3bad69['subject']='';_0x3bad69[_0x5bbd('0x19')]+=_[_0x5bbd('0x1a')](this[_0x5bbd('0x16')][_0x5bbd('0x19')],_0x5bbd('0x1b'))?'':_0x5bbd('0x1c');_0x3bad69['subject']+=this[_0x5bbd('0x16')][_0x5bbd('0x19')];}}if(this[_0x5bbd('0x10')]===_0x5bbd('0x1d')){_0x3bad69[_0x5bbd('0x1e')]=this[_0x5bbd('0x1f')]['id'];}else{_0x3bad69[_[_0x5bbd('0x20')](this[_0x5bbd('0x10')])+'AccountId']=this['account']['id'];}_0x3bad69[_[_0x5bbd('0x20')](this[_0x5bbd('0x10')])+_0x5bbd('0x21')]=this[_0x5bbd('0xb')]['id'];if(rpc[this[_0x5bbd('0x10')]+'Message']){if(this[_0x5bbd('0x10')]==='mail'){var _0x42409a={'tls':{'rejectUnauthorized':![]}};if(this[_0x5bbd('0x1f')][_0x5bbd('0x22')]['service']){_0x42409a[_0x5bbd('0x23')]=this[_0x5bbd('0x1f')][_0x5bbd('0x22')][_0x5bbd('0x23')];}else{_0x42409a[_0x5bbd('0x24')]=this['account']['Smtp']['host'];_0x42409a[_0x5bbd('0x25')]=this[_0x5bbd('0x1f')]['Smtp'][_0x5bbd('0x25')];_0x42409a['secure']=this['account']['Smtp']['secure'];}if(this[_0x5bbd('0x1f')][_0x5bbd('0x22')][_0x5bbd('0x26')]){_0x42409a[_0x5bbd('0x27')]={'user':this[_0x5bbd('0x1f')][_0x5bbd('0x22')][_0x5bbd('0x28')],'pass':this['account']['Smtp'][_0x5bbd('0x29')]};}_0x3bad69[_0x5bbd('0x2a')]=this[_0x5bbd('0x16')][_0x5bbd('0x2b')];_0x3bad69['html']=''+_[_0x5bbd('0x2c')](_0x3bad69[_0x5bbd('0x2d')],'';return mailRpc['sendMailMessage'](_0x42409a,_0x3bad69)[_0x5bbd('0x2e')](function(_0x2f6dd9){logger[_0x5bbd('0xd')](_0x5bbd('0x2f'),_0x3b4f5f);_0x3bad69[_0x5bbd('0x2b')]=_0x2f6dd9[_0x5bbd('0x16')][_0x5bbd('0x2b')];return rpc[_0x1363e5+_0x5bbd('0x30')]['create'](_0x3bad69);})[_0x5bbd('0x2e')](function(_0x47836f){logger['info'](_0x5bbd('0xe'),_0x3b4f5f,JSON[_0x5bbd('0x31')](_0x47836f));})[_0x5bbd('0x32')](function(_0x59153e){logger[_0x5bbd('0x33')]('[RPC][%s][AUTOREPLY]\x20%s',_0x3b4f5f,JSON[_0x5bbd('0x31')](_0x59153e));})[_0x5bbd('0x34')](function(){_0x59acc9[_0x5bbd('0x35')]();});}else{return rpc[this[_0x5bbd('0x10')]+'Message'][_0x5bbd('0x36')](_0x3bad69)['then'](function(_0x1f7003){logger['info'](_0x5bbd('0xe'),_0x3b4f5f,_0x3bad69[_0x5bbd('0x2d')]);})[_0x5bbd('0x32')](function(_0x194737){logger[_0x5bbd('0x33')](_0x5bbd('0xe'),_0x3b4f5f,JSON[_0x5bbd('0x31')](_0x194737));})[_0x5bbd('0x34')](function(){_0x59acc9[_0x5bbd('0x35')]();});}}}catch(_0x4b5f45){logger[_0x5bbd('0x33')](_0x5bbd('0xe'),_0x3b4f5f,JSON[_0x5bbd('0x31')](_0x4b5f45));_0x59acc9[_0x5bbd('0x37')]();}};}; \ No newline at end of file +var _0xcfab=['../../rpc/whatsappMessage','../../mailRpc','consequence','created','interaction','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','getMustacheRender','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','mail','service','Smtp','host','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','body','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','next','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x14d76a,_0x38c683){var _0x5baef8=function(_0x4cb8ae){while(--_0x4cb8ae){_0x14d76a['push'](_0x14d76a['shift']());}};_0x5baef8(++_0x38c683);}(_0xcfab,0x12e));var _0xbcfa=function(_0x372a8e,_0x16a38d){_0x372a8e=_0x372a8e-0x0;var _0x39aa2d=_0xcfab[_0x372a8e];return _0x39aa2d;};'use strict';var _=require(_0xbcfa('0x0'));var moment=require('moment');var utils=require(_0xbcfa('0x1'));var logger=require(_0xbcfa('0x2'))(_0xbcfa('0x3'));var rpc={'chatMessage':require(_0xbcfa('0x4')),'openchannelMessage':require(_0xbcfa('0x5')),'mailMessage':require(_0xbcfa('0x6')),'smsMessage':require(_0xbcfa('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xbcfa('0x8'))};var mailRpc=require(_0xbcfa('0x9'));exports[_0xbcfa('0xa')]=function(_0x54edc,_0x46744a){return function(_0x207bf6){try{if(_0x46744a[0x0]==='1'&&(_['isNil'](this['interaction'][_0xbcfa('0xb')])||!this[_0xbcfa('0xc')][_0xbcfa('0xb')])){logger[_0xbcfa('0xd')](_0xbcfa('0xe'),_0x54edc,_0xbcfa('0xf'));return _0x207bf6['next']();}var _0x224353=this[_0xbcfa('0x10')];var _0x3fd8a9={'body':utils[_0xbcfa('0x11')](_0x46744a[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xbcfa('0x12')),'direction':_0xbcfa('0x13')};if(this[_0xbcfa('0x14')]){_0x3fd8a9['to']=this[_0xbcfa('0x14')][_0xbcfa('0x15')]||'';_0x3fd8a9['cc']=this[_0xbcfa('0x14')]['cc']||'';_0x3fd8a9['from']=this[_0xbcfa('0x14')]['to']||'';_0x3fd8a9[_0xbcfa('0x16')]=this[_0xbcfa('0x14')][_0xbcfa('0x16')]||'';_0x3fd8a9[_0xbcfa('0x17')]=!![];if(this[_0xbcfa('0x14')]['subject']){_0x3fd8a9[_0xbcfa('0x18')]='';_0x3fd8a9[_0xbcfa('0x18')]+=_[_0xbcfa('0x19')](this[_0xbcfa('0x14')][_0xbcfa('0x18')],_0xbcfa('0x1a'))?'':_0xbcfa('0x1b');_0x3fd8a9[_0xbcfa('0x18')]+=this[_0xbcfa('0x14')][_0xbcfa('0x18')];}}if(this[_0xbcfa('0x10')]===_0xbcfa('0x1c')){_0x3fd8a9[_0xbcfa('0x1d')]=this[_0xbcfa('0x1e')]['id'];}else{_0x3fd8a9[_['upperFirst'](this[_0xbcfa('0x10')])+_0xbcfa('0x1f')]=this[_0xbcfa('0x1e')]['id'];}_0x3fd8a9[_[_0xbcfa('0x20')](this[_0xbcfa('0x10')])+_0xbcfa('0x21')]=this[_0xbcfa('0xc')]['id'];if(rpc[this[_0xbcfa('0x10')]+'Message']){if(this[_0xbcfa('0x10')]===_0xbcfa('0x22')){var _0x348f5a={'tls':{'rejectUnauthorized':![]}};if(this[_0xbcfa('0x1e')]['Smtp']['service']){_0x348f5a[_0xbcfa('0x23')]=this[_0xbcfa('0x1e')][_0xbcfa('0x24')][_0xbcfa('0x23')];}else{_0x348f5a[_0xbcfa('0x25')]=this['account'][_0xbcfa('0x24')]['host'];_0x348f5a[_0xbcfa('0x26')]=this['account'][_0xbcfa('0x24')][_0xbcfa('0x26')];_0x348f5a[_0xbcfa('0x27')]=this[_0xbcfa('0x1e')][_0xbcfa('0x24')][_0xbcfa('0x27')];}if(this[_0xbcfa('0x1e')][_0xbcfa('0x24')]['authentication']){_0x348f5a[_0xbcfa('0x28')]={'user':this['account'][_0xbcfa('0x24')][_0xbcfa('0x29')],'pass':this[_0xbcfa('0x1e')][_0xbcfa('0x24')][_0xbcfa('0x2a')]};}_0x3fd8a9[_0xbcfa('0x2b')]=this[_0xbcfa('0x14')][_0xbcfa('0x2c')];_0x3fd8a9[_0xbcfa('0x2d')]=_0xbcfa('0x2e')+_[_0xbcfa('0x2f')](_0x3fd8a9[_0xbcfa('0x30')],']+(>|$)/g,''),'priorityTrue':_0x1b179e[0x1],'priorityFalse':_0x1b179e[0x2]};var _0x10ad06=gotoif['validate'](_0x55ef9f,{'typecast':!![]});if(_0x10ad06[_0x9cd3('0xd')]){logger[_0x9cd3('0xe')]('[%s][GOTOIF]\x20%s',_0x4eab24,_[_0x9cd3('0xf')](_0x10ad06,_0x9cd3('0x10'))[_0x9cd3('0x11')](',\x20'));_0x547566['stop']();}else{try{var _0x4d7880=eval('('+_0x55ef9f[_0x9cd3('0x12')]+')');var _0x378c8a=_0x4d7880?_0x55ef9f[_0x9cd3('0x13')]:_0x55ef9f[_0x9cd3('0x14')];logger[_0x9cd3('0x15')](_0x9cd3('0x16'),_0x4eab24,_0x55ef9f[_0x9cd3('0x12')],_0x4d7880,_0x378c8a||_0x9cd3('0x17'));if(_0x378c8a){var _0x264ddb=_[_0x9cd3('0x18')](_0x547566[_0x9cd3('0x19')](),{'p':_0x378c8a});if(_0x264ddb>=0x0){logger[_0x9cd3('0x15')](_0x9cd3('0x1a'),_0x4eab24,_0x378c8a||_0x9cd3('0x17'),_0x264ddb);_0x547566[_0x9cd3('0x17')](_0x264ddb);}else{logger[_0x9cd3('0x15')](_0x9cd3('0x1b'),_0x4eab24,_0x378c8a||_0x9cd3('0x17'));_0x547566[_0x9cd3('0x1c')]();}}else{_0x547566[_0x9cd3('0x17')]();}}catch(_0x30d8c8){logger[_0x9cd3('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4eab24,_0x30d8c8[_0x9cd3('0x10')]);_0x547566[_0x9cd3('0x1c')]();}}}catch(_0x4b83e6){logger[_0x9cd3('0xe')]('[%s][GOTOIF]\x20%s',_0x4eab24,JSON['stringify'](_0x4b83e6));_0x547566['stop']();}};}; \ No newline at end of file +var _0x4559=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','error','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','fromString','length','map','message','join','stop','condition','priorityTrue','next','findIndex','rules','info'];(function(_0x244439,_0x3dcf7d){var _0x5da463=function(_0x5c20c9){while(--_0x5c20c9){_0x244439['push'](_0x244439['shift']());}};_0x5da463(++_0x3dcf7d);}(_0x4559,0x13d));var _0x9455=function(_0x35e6db,_0x53779d){_0x35e6db=_0x35e6db-0x0;var _0x249409=_0x4559[_0x35e6db];return _0x249409;};'use strict';var schema=require(_0x9455('0x0'));var _=require(_0x9455('0x1'));var htmlToText=require(_0x9455('0x2'));var utils=require('./utils');var logger=require(_0x9455('0x3'))(_0x9455('0x4'));var gotoif=schema({'condition':{'type':_0x9455('0x5'),'required':!![],'message':_0x9455('0x6')},'priorityTrue':{'type':_0x9455('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x9455('0x7'),'message':_0x9455('0x8')}});exports['consequence']=function(_0x36131b,_0x53c1cf){return function(_0x4d6abb){try{var _0x50bae6={'condition':htmlToText[_0x9455('0x9')](utils['getMustacheRender'](_0x53c1cf[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x53c1cf[0x1],'priorityFalse':_0x53c1cf[0x2]};var _0x213271=gotoif['validate'](_0x50bae6,{'typecast':!![]});if(_0x213271[_0x9455('0xa')]){logger['error']('[%s][GOTOIF]\x20%s',_0x36131b,_[_0x9455('0xb')](_0x213271,_0x9455('0xc'))[_0x9455('0xd')](',\x20'));_0x4d6abb[_0x9455('0xe')]();}else{try{var _0x11a262=eval('('+_0x50bae6[_0x9455('0xf')]+')');var _0x5d2ba0=_0x11a262?_0x50bae6[_0x9455('0x10')]:_0x50bae6['priorityFalse'];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x36131b,_0x50bae6[_0x9455('0xf')],_0x11a262,_0x5d2ba0||_0x9455('0x11'));if(_0x5d2ba0){var _0x3290c5=_[_0x9455('0x12')](_0x4d6abb[_0x9455('0x13')](),{'p':_0x5d2ba0});if(_0x3290c5>=0x0){logger[_0x9455('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x36131b,_0x5d2ba0||_0x9455('0x11'),_0x3290c5);_0x4d6abb[_0x9455('0x11')](_0x3290c5);}else{logger[_0x9455('0x14')](_0x9455('0x15'),_0x36131b,_0x5d2ba0||_0x9455('0x11'));_0x4d6abb[_0x9455('0xe')]();}}else{_0x4d6abb[_0x9455('0x11')]();}}catch(_0x498961){logger['error'](_0x9455('0x16'),_0x36131b,_0x498961['message']);_0x4d6abb['stop']();}}}catch(_0x3f21c0){logger[_0x9455('0x17')](_0x9455('0x18'),_0x36131b,JSON[_0x9455('0x19')](_0x3f21c0));_0x4d6abb[_0x9455('0xe')]();}};}; \ 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 a3545f0..0686a74 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 _0x60c0=['routing','number','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x60c0,0x107));var _0x060c=function(_0x5a2ccb,_0x4e11be){_0x5a2ccb=_0x5a2ccb-0x0;var _0x3c0045=_0x60c0[_0x5a2ccb];return _0x3c0045;};'use strict';var schema=require(_0x060c('0x0'));var _=require(_0x060c('0x1'));var logger=require(_0x060c('0x2'))(_0x060c('0x3'));var gotop=schema({'priority':{'type':_0x060c('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x4c407f,_0x3bfe91){return function(_0x2f38b0){try{var _0x27a5f0={'priority':_0x3bfe91[0x0]};var _0x103f05=gotop['validate'](_0x27a5f0,{'typecast':!![]});if(_0x103f05[_0x060c('0x5')]){logger[_0x060c('0x6')](_0x060c('0x7'),_0x4c407f,_[_0x060c('0x8')](_0x103f05,'message')[_0x060c('0x9')](',\x20'));_0x2f38b0[_0x060c('0xa')]();}else{logger[_0x060c('0xb')](_0x060c('0xc'),_0x4c407f,_0x27a5f0[_0x060c('0xd')]);if(_0x27a5f0[_0x060c('0xd')]){var _0x326ff1=_[_0x060c('0xe')](_0x2f38b0[_0x060c('0xf')](),{'p':_0x27a5f0[_0x060c('0xd')]});if(_0x326ff1>=0x0){logger[_0x060c('0xb')](_0x060c('0x10'),_0x4c407f,_0x27a5f0[_0x060c('0xd')]||_0x060c('0x11'),_0x326ff1);_0x2f38b0['next'](_0x326ff1);}else{logger[_0x060c('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x4c407f,_0x27a5f0['priority']||_0x060c('0x11'));_0x2f38b0[_0x060c('0xa')]();}}else{_0x2f38b0['next']();}}}catch(_0x267c74){logger[_0x060c('0x6')](_0x060c('0x7'),_0x4c407f,JSON[_0x060c('0x12')](_0x267c74));_0x2f38b0['stop']();}};}; \ No newline at end of file +var _0x942f=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0x942f,0x10c));var _0xf942=function(_0xf878f4,_0x4bce12){_0xf878f4=_0xf878f4-0x0;var _0x3703bb=_0x942f[_0xf878f4];return _0x3703bb;};'use strict';var schema=require(_0xf942('0x0'));var _=require(_0xf942('0x1'));var logger=require(_0xf942('0x2'))(_0xf942('0x3'));var gotop=schema({'priority':{'type':_0xf942('0x4'),'required':!![],'message':_0xf942('0x5')}});exports['consequence']=function(_0x3f857c,_0x31be85){return function(_0x40b841){try{var _0x43927d={'priority':_0x31be85[0x0]};var _0x5e0591=gotop[_0xf942('0x0')](_0x43927d,{'typecast':!![]});if(_0x5e0591[_0xf942('0x6')]){logger[_0xf942('0x7')]('[%s][GOTOP]\x20%s',_0x3f857c,_['map'](_0x5e0591,_0xf942('0x8'))[_0xf942('0x9')](',\x20'));_0x40b841[_0xf942('0xa')]();}else{logger['info'](_0xf942('0xb'),_0x3f857c,_0x43927d[_0xf942('0xc')]);if(_0x43927d['priority']){var _0x5ecdda=_['findIndex'](_0x40b841[_0xf942('0xd')](),{'p':_0x43927d[_0xf942('0xc')]});if(_0x5ecdda>=0x0){logger[_0xf942('0xe')](_0xf942('0xf'),_0x3f857c,_0x43927d[_0xf942('0xc')]||_0xf942('0x10'),_0x5ecdda);_0x40b841['next'](_0x5ecdda);}else{logger[_0xf942('0xe')](_0xf942('0x11'),_0x3f857c,_0x43927d[_0xf942('0xc')]||_0xf942('0x10'));_0x40b841[_0xf942('0xa')]();}}else{_0x40b841[_0xf942('0x10')]();}}}catch(_0x4d683b){logger[_0xf942('0x7')]('[%s][GOTOP]\x20%s',_0x3f857c,JSON[_0xf942('0x12')](_0x4d683b));_0x40b841['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 adde649..1c1f727 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 _0x7de0=['create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','ChatWebsiteId','account','upperFirst','AccountId','channel','InteractionId','interaction','Message'];(function(_0x3db9d0,_0xfcb61a){var _0x37772e=function(_0xdd7e30){while(--_0xdd7e30){_0x3db9d0['push'](_0x3db9d0['shift']());}};_0x37772e(++_0xfcb61a);}(_0x7de0,0x1ad));var _0x07de=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7de0[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x07de('0x0'));var utils=require(_0x07de('0x1'));var logger=require(_0x07de('0x2'))(_0x07de('0x3'));var rpc={'chatMessage':require(_0x07de('0x4')),'openchannelMessage':require(_0x07de('0x5')),'mailMessage':require(_0x07de('0x6')),'smsMessage':require(_0x07de('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x07de('0x8'))};exports[_0x07de('0x9')]=function(_0x41b158,_0x3c4106){return function(_0x364c1c){try{var _0x16d9b7={'body':utils[_0x07de('0xa')](_0x3c4106[0x0],this),'ContactId':this['contact']['id']};if(this['channel']==='chat'){_0x16d9b7[_0x07de('0xb')]=this[_0x07de('0xc')]['id'];}else{_0x16d9b7[_[_0x07de('0xd')](this['channel'])+_0x07de('0xe')]=this[_0x07de('0xc')]['id'];}_0x16d9b7[_['upperFirst'](this[_0x07de('0xf')])+_0x07de('0x10')]=this[_0x07de('0x11')]['id'];if(rpc[this[_0x07de('0xf')]+_0x07de('0x12')]){return rpc[this[_0x07de('0xf')]+'Message'][_0x07de('0x13')](_0x16d9b7)[_0x07de('0x14')](function(_0x2c1187){logger[_0x07de('0x15')](_0x07de('0x16'),_0x41b158,_0x16d9b7[_0x07de('0x17')]);_0x364c1c[_0x07de('0x18')]();})['catch'](function(_0x31d17d){logger[_0x07de('0x19')]('[%s][MESSAGE]\x20%s',_0x41b158,JSON[_0x07de('0x1a')](_0x31d17d));_0x364c1c['stop']();});}}catch(_0x18c92a){logger[_0x07de('0x19')]('[%s][MESSAGE]\x20%s',_0x41b158,JSON['stringify'](_0x18c92a));_0x364c1c[_0x07de('0x1b')]();}};}; \ No newline at end of file +var _0x2f71=['Message','then','info','next','catch','stringify','stop','error','[%s][MESSAGE]\x20%s','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','channel','AccountId','account','InteractionId','interaction'];(function(_0x5caaa0,_0x393cc3){var _0x46b273=function(_0x4056ce){while(--_0x4056ce){_0x5caaa0['push'](_0x5caaa0['shift']());}};_0x46b273(++_0x393cc3);}(_0x2f71,0x8b));var _0x12f7=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2f71[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var utils=require(_0x12f7('0x0'));var logger=require(_0x12f7('0x1'))('routing');var rpc={'chatMessage':require(_0x12f7('0x2')),'openchannelMessage':require(_0x12f7('0x3')),'mailMessage':require(_0x12f7('0x4')),'smsMessage':require(_0x12f7('0x5')),'faxMessage':require(_0x12f7('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x12f7('0x7')]=function(_0x5b977a,_0x671aab){return function(_0x2fdfbb){try{var _0x344bde={'body':utils[_0x12f7('0x8')](_0x671aab[0x0],this),'ContactId':this[_0x12f7('0x9')]['id']};if(this['channel']===_0x12f7('0xa')){_0x344bde[_0x12f7('0xb')]=this['account']['id'];}else{_0x344bde[_['upperFirst'](this[_0x12f7('0xc')])+_0x12f7('0xd')]=this[_0x12f7('0xe')]['id'];}_0x344bde[_['upperFirst'](this['channel'])+_0x12f7('0xf')]=this[_0x12f7('0x10')]['id'];if(rpc[this['channel']+_0x12f7('0x11')]){return rpc[this['channel']+_0x12f7('0x11')]['create'](_0x344bde)[_0x12f7('0x12')](function(_0x5d5289){logger[_0x12f7('0x13')]('[%s][MESSAGE]\x20%s',_0x5b977a,_0x344bde['body']);_0x2fdfbb[_0x12f7('0x14')]();})[_0x12f7('0x15')](function(_0x5ebe01){logger['error']('[%s][MESSAGE]\x20%s',_0x5b977a,JSON[_0x12f7('0x16')](_0x5ebe01));_0x2fdfbb[_0x12f7('0x17')]();});}}catch(_0x5f12a1){logger[_0x12f7('0x18')](_0x12f7('0x19'),_0x5b977a,JSON['stringify'](_0x5f12a1));_0x2fdfbb[_0x12f7('0x17')]();}};}; \ 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 939d530..2303d9a 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 _0x6dbc=['next','error','stringify','stop','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s'];(function(_0x57bb3a,_0x237ede){var _0x5decaa=function(_0x262a8f){while(--_0x262a8f){_0x57bb3a['push'](_0x57bb3a['shift']());}};_0x5decaa(++_0x237ede);}(_0x6dbc,0x1cf));var _0xc6db=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x6dbc[_0x11ce46];return _0x368a1e;};'use strict';var utils=require(_0xc6db('0x0'));var logger=require(_0xc6db('0x1'))(_0xc6db('0x2'));exports['consequence']=function(_0x518035,_0x497ef7){return function(_0x233525){try{logger[_0xc6db('0x3')](_0xc6db('0x4'),_0x518035,utils['getMustacheRender'](_0x497ef7[0x0],this));_0x233525[_0xc6db('0x5')]();}catch(_0x441e77){logger[_0xc6db('0x6')](_0xc6db('0x4'),_0x518035,JSON[_0xc6db('0x7')](_0x441e77));_0x233525[_0xc6db('0x8')]();}};}; \ No newline at end of file +var _0xa1f0=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','../../../../config/logger','consequence'];(function(_0x5065a8,_0x5d2a33){var _0x34d49b=function(_0x490015){while(--_0x490015){_0x5065a8['push'](_0x5065a8['shift']());}};_0x34d49b(++_0x5d2a33);}(_0xa1f0,0x7e));var _0x0a1f=function(_0x10271c,_0x55778c){_0x10271c=_0x10271c-0x0;var _0x3b9803=_0xa1f0[_0x10271c];return _0x3b9803;};'use strict';var utils=require('./utils');var logger=require(_0x0a1f('0x0'))('routing');exports[_0x0a1f('0x1')]=function(_0x274af3,_0x21e48c){return function(_0x240e4e){try{logger[_0x0a1f('0x2')](_0x0a1f('0x3'),_0x274af3,utils[_0x0a1f('0x4')](_0x21e48c[0x0],this));_0x240e4e[_0x0a1f('0x5')]();}catch(_0x5161e0){logger[_0x0a1f('0x6')]('[%s][NOOP]\x20%s',_0x274af3,JSON[_0x0a1f('0x7')](_0x5161e0));_0x240e4e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 32ed6ac..8275986 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(_0x3d037c,_0x50a5d8){var _0x590089=function(_0x3d8348){while(--_0x3d8348){_0x3d037c['push'](_0x3d037c['shift']());}};_0x590089(++_0x50a5d8);}(_0x008c,0x188));var _0xc008=function(_0x569407,_0x115d0f){_0x569407=_0x569407-0x0;var _0x51d1e3=_0x008c[_0x569407];return _0x51d1e3;};'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 _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0x57aa2f,_0x397f18){var _0x27ddca=function(_0x2b9c2a){while(--_0x2b9c2a){_0x57aa2f['push'](_0x57aa2f['shift']());}};_0x27ddca(++_0x397f18);}(_0xedd9,0xfc));var _0x9edd=function(_0x52d098,_0x4e2b52){_0x52d098=_0x52d098-0x0;var _0x2f0b4e=_0xedd9[_0x52d098];return _0x2f0b4e;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ 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 85c84aa..fea26e3 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 _0x1961=['agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','realtime','channel','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','timeout','handleDrained','push','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil'];(function(_0x2a9f4,_0x25c14a){var _0x3c39e0=function(_0x3b8deb){while(--_0x3b8deb){_0x2a9f4['push'](_0x2a9f4['shift']());}};_0x3c39e0(++_0x25c14a);}(_0x1961,0xd0));var _0x1196=function(_0xb57b4a,_0x44bfcf){_0xb57b4a=_0xb57b4a-0x0;var _0x12b63b=_0x1961[_0xb57b4a];return _0x12b63b;};'use strict';var _=require('lodash');var uuid=require(_0x1196('0x0'));var util=require(_0x1196('0x1'));var logger=require(_0x1196('0x2'))(_0x1196('0x3'));var Agent=function(_0x8a11ac,_0x552a68,_0x5c2eed,_0x263592){this[_0x1196('0x4')]=uuid['v4']();this[_0x1196('0x5')]=_0x8a11ac;this[_0x1196('0x6')]=_0x552a68;this['realtime']=_0x5c2eed;this['routing']=_0x263592;this['squeue']['push'](this[_0x1196('0x7')][_0x1196('0x8')](this),this[_0x1196('0x9')][_0x1196('0x8')](this));this['squeue']['on'](_0x1196('0xa'),this[_0x1196('0x9')][_0x1196('0x8')](this));this['squeue']['on']('drained',this[_0x1196('0xb')][_0x1196('0x8')](this));};Agent['prototype'][_0x1196('0xc')]=function(){this[_0x1196('0x5')][_0x1196('0xc')](this[_0x1196('0x7')][_0x1196('0x8')](this),this[_0x1196('0x9')][_0x1196('0x8')](this));};Agent[_0x1196('0xd')][_0x1196('0xb')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x1196('0x7')]=function(_0x241647){logger['info'](_0x1196('0xe'),this['squeue']['id'],this['agent']['id']);if(_[_0x1196('0xf')](this['realtime'][_0x1196('0x10')][this['agent']['id']])){logger[_0x1196('0x11')](_0x1196('0x12'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x1196('0x8')](this),0x3e8);}else{if(this[_0x1196('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0x1196('0x5')]['id'],this[_0x1196('0x13')][_0x1196('0x10')][this[_0x1196('0x6')]['id']],this[_0x1196('0x5')][_0x1196('0x14')],![])){this[_0x1196('0x13')][_0x1196('0x10')][this[_0x1196('0x6')]['id']]['busy']=!![];this[_0x1196('0x13')][_0x1196('0x10')][this['agent']['id']][_0x1196('0x15')]=undefined;util[_0x1196('0x16')](this['notificationId'],this[_0x1196('0x5')]['id'],this['realtime'][_0x1196('0x10')][this[_0x1196('0x6')]['id']],null,this['routing']);util[_0x1196('0x17')](this[_0x1196('0x5')]['id'],this[_0x1196('0x13')][_0x1196('0x10')][this[_0x1196('0x6')]['id']],_0x1196('0x18')+(this[_0x1196('0x3')][_0x1196('0x19')]?_0x1196('0x1a'):''));}else{logger[_0x1196('0x11')](_0x1196('0x1b'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x1196('0xc')][_0x1196('0x8')](this),0x3e8);}}};Agent[_0x1196('0xd')][_0x1196('0x9')]=function(_0x11846a){if(_['isNil'](this[_0x1196('0x13')]['agents'][this[_0x1196('0x6')]['id']])){return logger['info'](_0x1196('0x12'),this[_0x1196('0x5')]['id'],this['agent']['id']);}else{logger[_0x1196('0x11')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x1196('0x5')]['id'],this['agent']['id']);util[_0x1196('0x1c')](this[_0x1196('0x4')],this['squeue']['id'],this[_0x1196('0x13')]['agents'][this[_0x1196('0x6')]['id']],null,this['routing']);this[_0x1196('0x13')][_0x1196('0x10')][this[_0x1196('0x6')]['id']][_0x1196('0x1d')]=![];this[_0x1196('0x13')][_0x1196('0x10')][this[_0x1196('0x6')]['id']]['busyQueue']=undefined;util[_0x1196('0x17')](this['squeue']['id'],this['realtime'][_0x1196('0x10')][this[_0x1196('0x6')]['id']],_0x11846a?_0x1196('0x1e'):_0x1196('0x1f'));}if(!_0x11846a){setTimeout(this['push'][_0x1196('0x8')](this),0x3e8);}};function agent(_0x1d4443,_0x4ce207,_0x8e12d,_0x5dc48d){return new Agent(_0x1d4443,_0x4ce207,_0x8e12d,_0x5dc48d);}module['exports']=agent; \ No newline at end of file +var _0xe3e0=['push','handleRun','prototype','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','writeLog','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','bind','handleTimeout','drained','handleDrained'];(function(_0x21d249,_0x42b4d6){var _0x4cf81c=function(_0xfb938b){while(--_0xfb938b){_0x21d249['push'](_0x21d249['shift']());}};_0x4cf81c(++_0x42b4d6);}(_0xe3e0,0x188));var _0x0e3e=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0xe3e0[_0x57d13b];return _0x467696;};'use strict';var _=require('lodash');var uuid=require(_0x0e3e('0x0'));var util=require(_0x0e3e('0x1'));var logger=require(_0x0e3e('0x2'))(_0x0e3e('0x3'));var Agent=function(_0x4e2434,_0x2de472,_0x3a700c,_0x474777){this[_0x0e3e('0x4')]=uuid['v4']();this[_0x0e3e('0x5')]=_0x4e2434;this[_0x0e3e('0x6')]=_0x2de472;this['realtime']=_0x3a700c;this[_0x0e3e('0x3')]=_0x474777;this[_0x0e3e('0x5')]['push'](this['handleRun'][_0x0e3e('0x7')](this),this[_0x0e3e('0x8')]['bind'](this));this[_0x0e3e('0x5')]['on']('timeout',this[_0x0e3e('0x8')][_0x0e3e('0x7')](this));this['squeue']['on'](_0x0e3e('0x9'),this[_0x0e3e('0xa')][_0x0e3e('0x7')](this));};Agent['prototype'][_0x0e3e('0xb')]=function(){this[_0x0e3e('0x5')][_0x0e3e('0xb')](this[_0x0e3e('0xc')]['bind'](this),this[_0x0e3e('0x8')]['bind'](this));};Agent['prototype']['handleDrained']=function(){this[_0x0e3e('0x8')](!![]);};Agent[_0x0e3e('0xd')]['handleRun']=function(_0x5d8f06){logger['info'](_0x0e3e('0xe'),this[_0x0e3e('0x5')]['id'],this[_0x0e3e('0x6')]['id']);if(_['isNil'](this[_0x0e3e('0xf')][_0x0e3e('0x10')][this[_0x0e3e('0x6')]['id']])){logger[_0x0e3e('0x11')](_0x0e3e('0x12'),this[_0x0e3e('0x5')]['id'],this[_0x0e3e('0x6')]['id']);setTimeout(this[_0x0e3e('0xb')][_0x0e3e('0x7')](this),0x3e8);}else{if(this['routing'][_0x0e3e('0x13')]||util[_0x0e3e('0x14')](this[_0x0e3e('0x5')]['id'],this['realtime'][_0x0e3e('0x10')][this[_0x0e3e('0x6')]['id']],this[_0x0e3e('0x5')]['channel'],![])){this[_0x0e3e('0xf')]['agents'][this['agent']['id']][_0x0e3e('0x15')]=!![];this[_0x0e3e('0xf')][_0x0e3e('0x10')][this['agent']['id']]['busyQueue']=undefined;util[_0x0e3e('0x16')](this['notificationId'],this[_0x0e3e('0x5')]['id'],this[_0x0e3e('0xf')][_0x0e3e('0x10')][this[_0x0e3e('0x6')]['id']],null,this[_0x0e3e('0x3')]);util['writeLog'](this[_0x0e3e('0x5')]['id'],this['realtime'][_0x0e3e('0x10')][this['agent']['id']],_0x0e3e('0x17')+(this['routing'][_0x0e3e('0x13')]?_0x0e3e('0x18'):''));}else{logger[_0x0e3e('0x11')](_0x0e3e('0x19'),this[_0x0e3e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x0e3e('0xb')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x0e3e('0x8')]=function(_0x1052d4){if(_['isNil'](this[_0x0e3e('0xf')][_0x0e3e('0x10')][this[_0x0e3e('0x6')]['id']])){return logger['info'](_0x0e3e('0x12'),this[_0x0e3e('0x5')]['id'],this[_0x0e3e('0x6')]['id']);}else{logger[_0x0e3e('0x11')](_0x0e3e('0x1a'),this[_0x0e3e('0x5')]['id'],this[_0x0e3e('0x6')]['id']);util[_0x0e3e('0x1b')](this[_0x0e3e('0x4')],this['squeue']['id'],this['realtime'][_0x0e3e('0x10')][this[_0x0e3e('0x6')]['id']],null,this[_0x0e3e('0x3')]);this[_0x0e3e('0xf')][_0x0e3e('0x10')][this['agent']['id']][_0x0e3e('0x15')]=![];this[_0x0e3e('0xf')]['agents'][this[_0x0e3e('0x6')]['id']][_0x0e3e('0x1c')]=undefined;util[_0x0e3e('0x1d')](this[_0x0e3e('0x5')]['id'],this[_0x0e3e('0xf')]['agents'][this['agent']['id']],_0x1052d4?'STOP':'TIMEOUT');}if(!_0x1052d4){setTimeout(this['push'][_0x0e3e('0x7')](this),0x3e8);}};function agent(_0x4b0606,_0x5318a1,_0x163fc3,_0x13fea7){return new Agent(_0x4b0606,_0x5318a1,_0x163fc3,_0x13fea7);}module[_0x0e3e('0x1e')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index f409d42..6be1a33 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 _0x1c8a=['name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','notificationId','STOP','TIMEOUT','exports','uuid','./util','routing','squeue','queue','realtime','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','isNil','length','Agents','agents','info','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue'];(function(_0x932729,_0x22f569){var _0x13e53b=function(_0x20dfff){while(--_0x20dfff){_0x932729['push'](_0x932729['shift']());}};_0x13e53b(++_0x22f569);}(_0x1c8a,0x17f));var _0xa1c8=function(_0x4b9118,_0x1ecf2f){_0x4b9118=_0x4b9118-0x0;var _0x516c27=_0x1c8a[_0x4b9118];return _0x516c27;};'use strict';var _=require('lodash');var uuid=require(_0xa1c8('0x0'));var util=require(_0xa1c8('0x1'));var logger=require('../../../../../config/logger')(_0xa1c8('0x2'));var Beepall=function(_0x11c087,_0x5840c5,_0x529d39,_0x370ce2){this['notificationId']=uuid['v4']();this[_0xa1c8('0x3')]=_0x11c087;this[_0xa1c8('0x4')]=_0x5840c5;this[_0xa1c8('0x5')]=_0x529d39;this['routing']=_0x370ce2;this[_0xa1c8('0x3')][_0xa1c8('0x6')](this[_0xa1c8('0x7')][_0xa1c8('0x8')](this),this['handleTimeout']['bind'](this));this['squeue']['on'](_0xa1c8('0x9'),this[_0xa1c8('0xa')]['bind'](this));this['squeue']['on'](_0xa1c8('0xb'),this[_0xa1c8('0xc')][_0xa1c8('0x8')](this));};Beepall[_0xa1c8('0xd')][_0xa1c8('0x6')]=function(){this[_0xa1c8('0x3')][_0xa1c8('0x6')](this[_0xa1c8('0x7')][_0xa1c8('0x8')](this),this[_0xa1c8('0xa')]['bind'](this));};Beepall[_0xa1c8('0xd')][_0xa1c8('0xc')]=function(_0x3113e2){this[_0xa1c8('0xa')](!![]);};Beepall['prototype']['handleRun']=function(_0x180c5d){var _0x421fa2=!![];if(!_[_0xa1c8('0xe')](this[_0xa1c8('0x4')])&&!_['isNil'](this[_0xa1c8('0x4')]['Agents'])&&this[_0xa1c8('0x4')]['Agents'][_0xa1c8('0xf')]>0x0){for(var _0x249986=0x0,_0x4d80ea;_0x2499860x0){for(var _0x11fcf2=0x0,_0x421a19;_0x11fcf20x0&&_0x1c5bd9[_0x3c42bb+'CurrentCapacity']>=_0x1c5bd9[_0x3c42bb+_0x786e('0x24')]){writeLog(_0x339de2,_0x1c5bd9,_0x3c42bb[_0x786e('0x25')]()+_0x786e('0x26'));return![];}}return!![];};exports[_0x786e('0x27')]=function(_0x22259f,_0x20be43,_0xa692,_0x185d27,_0x2f996e){return sendNotification(!![],_0x22259f,_0x20be43,_0xa692,_0x185d27,_0x2f996e);};exports[_0x786e('0x28')]=function(_0x3ce018,_0x73def4,_0x23d935,_0x4a1aa4,_0x52efe2){return sendNotification(![],_0x3ce018,_0x73def4,_0x23d935,_0x4a1aa4,_0x52efe2);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x91d0=['queue','body','msg','getMustacheRender','error','[%s][QUEUE]\x20%s','message','remove','info','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','\x20MAXCAPACITY','hideNotification','writeLog','util','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','emit','format','user:%s','user:save','split','\x20interaction','name','account','notificationSound','notificationShake'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91d0,0xb6));var _0x091d=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x91d0[_0x1f7996];return _0x584609;};'use strict';var _=require('lodash');var util=require(_0x091d('0x0'));var utils=require(_0x091d('0x1'));var Mustache=require('mustache');var Redis=require(_0x091d('0x2'));var config=require('../../../../../config/environment');var logger=require(_0x091d('0x3'))(_0x091d('0x4'));config[_0x091d('0x5')]=_[_0x091d('0x6')](config[_0x091d('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x091d('0x7'))(new Redis(config['redis']));function emit(_0x3caae4,_0x22abaa,_0x59bc6e){io['to'](_0x3caae4)[_0x091d('0x8')](_0x22abaa,_0x59bc6e);}function sendNotification(_0x3bd53f,_0x53a64a,_0x297b71,_0x133ce7,_0x24b9ef,_0x232c88){io['to'](util[_0x091d('0x9')](_0x091d('0xa'),_0x133ce7['name']))[_0x091d('0x8')](_0x091d('0xb'),_0x133ce7);var _0x462de2=_0x232c88||{};var _0x200057=_0x297b71[_0x091d('0xc')]('.');var _0x42c2b3={'uniqueid':_0x53a64a,'channel':_0x200057[0x0],'id':_0x200057[0x1],'title':_0x200057[0x0]+_0x091d('0xd'),'interactionId':_0x200057[0x2],'queue':_0x24b9ef?_0x24b9ef[_0x091d('0xe')]:null,'sound':_0x462de2[_0x091d('0xf')][_0x091d('0x10')],'shake':_0x462de2['account'][_0x091d('0x11')]};try{if(!_0x462de2['body']){_0x462de2['body']={};}if(_0x24b9ef){_0x462de2['body'][_0x091d('0x12')]=_0x24b9ef;}else if(_0x462de2[_0x091d('0x13')][_0x091d('0x12')]){delete _0x462de2['body'][_0x091d('0x12')];}_0x42c2b3[_0x091d('0x14')]=utils[_0x091d('0x15')](_0x462de2[_0x091d('0xf')]['notificationTemplate'],_0x462de2);}catch(_0xafd146){_0x42c2b3['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x091d('0x16')](util[_0x091d('0x9')](_0x091d('0x17'),_0x53a64a,_0xafd146[_0x091d('0x18')]));}io['to'](util[_0x091d('0x9')](_0x091d('0xa'),_0x133ce7[_0x091d('0xe')]))[_0x091d('0x8')](util[_0x091d('0x9')]('notification:%s',_0x3bd53f?'save':_0x091d('0x19')),_0x42c2b3);}function writeLog(_0x36d47a,_0x58c9a4,_0x3660d7){return logger[_0x091d('0x1a')](util[_0x091d('0x9')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x36d47a,_0x58c9a4[_0x091d('0xe')],_0x3660d7));}exports[_0x091d('0x1b')]=function(_0x381358,_0x163908,_0x55464b,_0x3737fb){if(_0x163908[_0x091d('0x1c')]){writeLog(_0x381358,_0x163908,_0x091d('0x1d'));return![];}if(!_0x163908[_0x091d('0x1e')]){writeLog(_0x381358,_0x163908,_0x091d('0x1f'));return![];}if(_0x163908[_0x55464b+_0x091d('0x20')]){writeLog(_0x381358,_0x163908,_0x091d('0x21'));return![];}if(_0x3737fb&&_0x163908['hasOwnProperty'](_0x55464b+_0x091d('0x22'))&&_0x163908[_0x091d('0x23')](_0x55464b+_0x091d('0x24'))){if(_0x163908[_0x55464b+_0x091d('0x22')]>0x0&&_0x163908[_0x55464b+_0x091d('0x24')]>=_0x163908[_0x55464b+_0x091d('0x22')]){writeLog(_0x381358,_0x163908,_0x55464b['toUpperCase']()+_0x091d('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x455529,_0x4452e6,_0x6476e9,_0x5a50db,_0x2df900){return sendNotification(!![],_0x455529,_0x4452e6,_0x6476e9,_0x5a50db,_0x2df900);};exports[_0x091d('0x26')]=function(_0x37a5b5,_0x4934ce,_0x1a23a5,_0x61e16c,_0x49eb1e){return sendNotification(![],_0x37a5b5,_0x4934ce,_0x1a23a5,_0x61e16c,_0x49eb1e);};exports[_0x091d('0x27')]=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 3fdceeb..e147555 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 _0x7204=['isObject','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7204,0x135));var _0x4720=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7204[_0xfae23b];return _0x200640;};'use strict';var schema=require('validate');var sh=require(_0x4720('0x0'));var _=require(_0x4720('0x1'));var utils=require(_0x4720('0x2'));var logger=require(_0x4720('0x3'))(_0x4720('0x4'));var system=schema({'command':{'type':_0x4720('0x5'),'required':!![],'message':_0x4720('0x6')}});exports[_0x4720('0x7')]=function(_0x26a9c2,_0x442490){return function(_0x14b4e4){try{var _0x55f7d5={'command':_0x442490[0x0]};var _0x372209=system[_0x4720('0x8')](_0x55f7d5,{'typecast':!![]});if(_0x372209[_0x4720('0x9')]){logger['error'](_0x4720('0xa'),_0x26a9c2,_[_0x4720('0xb')](_0x372209,'message')[_0x4720('0xc')](',\x20'));logger[_0x4720('0xd')](_0x4720('0xe'),_0x26a9c2);_0x14b4e4[_0x4720('0xf')]();}else{var _0x5d2e8b=this;var _0x53d8ae=utils[_0x4720('0x10')](_0x442490[0x0],this);logger[_0x4720('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x26a9c2,_0x53d8ae);sh[_0x4720('0x11')](_[_0x4720('0x12')](_0x53d8ae),function(_0x377531,_0x4c285c){logger[_0x4720('0xd')](_0x4720('0x13'),_0x26a9c2,_0x377531);if(_0x377531==0x0){var _0xd25f0c=_0x4c285c[_0x4720('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x4720('0x15')](_0x442490[0x1])||_[_0x4720('0x16')](_0x442490[0x1])){logger['info'](_0x4720('0x17'),_0x26a9c2);_0x5d2e8b[_0x4720('0x18')][_0x442490[0x1]]=_0xd25f0c;}else{logger[_0x4720('0xd')](_0x4720('0x19'),_0x26a9c2,_0x442490[0x1],_0xd25f0c);_0x5d2e8b['body'][_0x442490[0x1]]=_0xd25f0c;}}_0x14b4e4['next']();});}}catch(_0x2619c8){logger[_0x4720('0x1a')](_0x4720('0xa'),_0x26a9c2,_[_0x4720('0x1b')](_0x2619c8)?JSON['stringify'](_0x2619c8):_0x2619c8);logger[_0x4720('0xd')](_0x4720('0xe'),_0x26a9c2);_0x14b4e4[_0x4720('0xf')]();}};}; \ No newline at end of file +var _0xfcc1=['validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','next','error','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xfcc1,0x144));var _0x1fcc=function(_0x3ad191,_0x29e58b){_0x3ad191=_0x3ad191-0x0;var _0x4384e5=_0xfcc1[_0x3ad191];return _0x4384e5;};'use strict';var schema=require(_0x1fcc('0x0'));var sh=require(_0x1fcc('0x1'));var _=require(_0x1fcc('0x2'));var utils=require(_0x1fcc('0x3'));var logger=require(_0x1fcc('0x4'))(_0x1fcc('0x5'));var system=schema({'command':{'type':_0x1fcc('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1fcc('0x7')]=function(_0x9897a7,_0x27d3c3){return function(_0x2ecc94){try{var _0x5089ad={'command':_0x27d3c3[0x0]};var _0x35f509=system[_0x1fcc('0x0')](_0x5089ad,{'typecast':!![]});if(_0x35f509[_0x1fcc('0x8')]){logger['error'](_0x1fcc('0x9'),_0x9897a7,_[_0x1fcc('0xa')](_0x35f509,_0x1fcc('0xb'))[_0x1fcc('0xc')](',\x20'));logger[_0x1fcc('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x9897a7);_0x2ecc94['next']();}else{var _0xd22421=this;var _0x593963=utils[_0x1fcc('0xe')](_0x27d3c3[0x0],this);logger[_0x1fcc('0xd')](_0x1fcc('0xf'),_0x9897a7,_0x593963);sh['exec'](_[_0x1fcc('0x10')](_0x593963),function(_0x5a5f99,_0x58f252){logger[_0x1fcc('0xd')](_0x1fcc('0x11'),_0x9897a7,_0x5a5f99);if(_0x5a5f99==0x0){var _0x30bd38=_0x58f252['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x1fcc('0x12')](_0x27d3c3[0x1])||_[_0x1fcc('0x13')](_0x27d3c3[0x1])){logger[_0x1fcc('0xd')](_0x1fcc('0x14'),_0x9897a7);_0xd22421[_0x1fcc('0x15')][_0x27d3c3[0x1]]=_0x30bd38;}else{logger[_0x1fcc('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x9897a7,_0x27d3c3[0x1],_0x30bd38);_0xd22421['body'][_0x27d3c3[0x1]]=_0x30bd38;}}_0x2ecc94[_0x1fcc('0x16')]();});}}catch(_0x4e2c3b){logger[_0x1fcc('0x17')](_0x1fcc('0x9'),_0x9897a7,_[_0x1fcc('0x18')](_0x4e2c3b)?JSON[_0x1fcc('0x19')](_0x4e2c3b):_0x4e2c3b);logger['info'](_0x1fcc('0x1a'),_0x9897a7);_0x2ecc94[_0x1fcc('0x16')]();}};}; \ 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 a236a6a..e6991af 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 _0x5c34=['number','consequence','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','addTags','then','interaction','catch','stringify','finally','next','[%s][TAG]\x20%s','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing'];(function(_0x5edee5,_0x281cdf){var _0x379eb6=function(_0x3c6dc7){while(--_0x3c6dc7){_0x5edee5['push'](_0x5edee5['shift']());}};_0x379eb6(++_0x281cdf);}(_0x5c34,0x18d));var _0x45c3=function(_0x5d1266,_0x2e304b){_0x5d1266=_0x5d1266-0x0;var _0x5c8b87=_0x5c34[_0x5d1266];return _0x5c8b87;};'use strict';var schema=require(_0x45c3('0x0'));var _=require(_0x45c3('0x1'));var rpc={'chatInteraction':require(_0x45c3('0x2')),'openchannelInteraction':require(_0x45c3('0x3')),'smsInteraction':require(_0x45c3('0x4')),'mailInteraction':require(_0x45c3('0x5')),'faxInteraction':require(_0x45c3('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x45c3('0x7'))(_0x45c3('0x8'));var tag=schema({'tag':{'type':_0x45c3('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x45c3('0xa')]=function(_0x1100a1,_0x29a0aa,_0x2fe6b5,_0x2cd73d){return function(_0x577f8a){try{var _0x2ef17d={'tag':_0x29a0aa[0x0]};var _0x350f67=tag[_0x45c3('0x0')](_0x2ef17d,{'typecast':!![]});if(_0x350f67[_0x45c3('0xb')]){logger[_0x45c3('0xc')]('[%s][TAG]\x20%s',_0x1100a1,_[_0x45c3('0xd')](_0x350f67,_0x45c3('0xe'))[_0x45c3('0xf')](',\x20'));logger[_0x45c3('0x10')](_0x45c3('0x11'),_0x1100a1);_0x577f8a['next']();}else{var _0x4594f8={'ids':[_0x29a0aa[0x0]]};if(rpc[_0x2cd73d['channel']+_0x45c3('0x12')]){rpc[_0x2cd73d[_0x45c3('0x13')]+_0x45c3('0x12')][_0x45c3('0x14')](_0x2cd73d['interaction']['id'],_0x4594f8)[_0x45c3('0x15')](function(_0xb534f0){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x1100a1,_0x29a0aa[0x1],_0x2cd73d[_0x45c3('0x13')],_0x2cd73d[_0x45c3('0x16')]['id']);})[_0x45c3('0x17')](function(_0x56e2f9){logger[_0x45c3('0xc')]('[%s][TAG]\x20%s',_0x1100a1,JSON[_0x45c3('0x18')](_0x56e2f9));logger[_0x45c3('0x10')](_0x45c3('0x11'),_0x1100a1);})[_0x45c3('0x19')](function(){_0x577f8a[_0x45c3('0x1a')]();});}}}catch(_0x2e9f45){logger[_0x45c3('0xc')](_0x45c3('0x1b'),_0x1100a1,_[_0x45c3('0x1c')](_0x2e9f45)?JSON[_0x45c3('0x18')](_0x2e9f45):_0x2e9f45);logger[_0x45c3('0x10')](_0x45c3('0x11'),_0x1100a1);_0x577f8a[_0x45c3('0x1a')]();}};}; \ No newline at end of file +var _0x392e=['interaction','then','catch','error','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','message','join','info','next','channel','Interaction','addTags'];(function(_0x22ca53,_0x30e1a9){var _0x80aacf=function(_0x55f0b9){while(--_0x55f0b9){_0x22ca53['push'](_0x22ca53['shift']());}};_0x80aacf(++_0x30e1a9);}(_0x392e,0x6b));var _0xe392=function(_0x145eb4,_0x48ba65){_0x145eb4=_0x145eb4-0x0;var _0x3a1fe3=_0x392e[_0x145eb4];return _0x3a1fe3;};'use strict';var schema=require(_0xe392('0x0'));var _=require(_0xe392('0x1'));var rpc={'chatInteraction':require(_0xe392('0x2')),'openchannelInteraction':require(_0xe392('0x3')),'smsInteraction':require(_0xe392('0x4')),'mailInteraction':require(_0xe392('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xe392('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xe392('0x7')}});exports['consequence']=function(_0x1fcad7,_0x3c7ee4,_0x544468,_0x5f56d4){return function(_0x58c3b0){try{var _0x2d97fd={'tag':_0x3c7ee4[0x0]};var _0x4785a1=tag[_0xe392('0x0')](_0x2d97fd,{'typecast':!![]});if(_0x4785a1[_0xe392('0x8')]){logger['error'](_0xe392('0x9'),_0x1fcad7,_[_0xe392('0xa')](_0x4785a1,_0xe392('0xb'))[_0xe392('0xc')](',\x20'));logger[_0xe392('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1fcad7);_0x58c3b0[_0xe392('0xe')]();}else{var _0x361dc9={'ids':[_0x3c7ee4[0x0]]};if(rpc[_0x5f56d4[_0xe392('0xf')]+_0xe392('0x10')]){rpc[_0x5f56d4[_0xe392('0xf')]+_0xe392('0x10')][_0xe392('0x11')](_0x5f56d4[_0xe392('0x12')]['id'],_0x361dc9)[_0xe392('0x13')](function(_0x14bfb7){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x1fcad7,_0x3c7ee4[0x1],_0x5f56d4[_0xe392('0xf')],_0x5f56d4[_0xe392('0x12')]['id']);})[_0xe392('0x14')](function(_0x338703){logger[_0xe392('0x15')](_0xe392('0x9'),_0x1fcad7,JSON[_0xe392('0x16')](_0x338703));logger[_0xe392('0xd')](_0xe392('0x17'),_0x1fcad7);})[_0xe392('0x18')](function(){_0x58c3b0[_0xe392('0xe')]();});}}}catch(_0x4a0de4){logger[_0xe392('0x15')]('[%s][TAG]\x20%s',_0x1fcad7,_['isObject'](_0x4a0de4)?JSON[_0xe392('0x16')](_0x4a0de4):_0x4a0de4);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1fcad7);_0x58c3b0[_0xe392('0xe')]();}};}; \ 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 30cae42..f378900 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 _0x32ef=['render','body','contact','account','interaction','list','mustache','lodash','exports'];(function(_0x4963fc,_0xed063e){var _0x456419=function(_0x294023){while(--_0x294023){_0x4963fc['push'](_0x4963fc['shift']());}};_0x456419(++_0xed063e);}(_0x32ef,0xf9));var _0xf32e=function(_0x2f7f5b,_0x41c7a1){_0x2f7f5b=_0x2f7f5b-0x0;var _0x55e5e7=_0x32ef[_0x2f7f5b];return _0x55e5e7;};'use strict';var Mustache=require(_0xf32e('0x0'));var _=require(_0xf32e('0x1'));module[_0xf32e('0x2')]={'getMustacheRender':function(_0x2aaadd,_0x286041){return Mustache[_0xf32e('0x3')](_0x2aaadd,_['merge'](_0x286041[_0xf32e('0x4')],{'contact':_0x286041[_0xf32e('0x5')],'message':_0x286041['message'],'account':_0x286041[_0xf32e('0x6')],'interaction':_0x286041[_0xf32e('0x7')],'list':_0x286041[_0xf32e('0x8')]}))||'';}}; \ No newline at end of file +var _0x885e=['body','account','interaction','list','mustache','lodash','render','merge'];(function(_0x38cb4c,_0x27e17a){var _0x16c7cf=function(_0x249145){while(--_0x249145){_0x38cb4c['push'](_0x38cb4c['shift']());}};_0x16c7cf(++_0x27e17a);}(_0x885e,0xe4));var _0xe885=function(_0x4be318,_0x3f9877){_0x4be318=_0x4be318-0x0;var _0x19926b=_0x885e[_0x4be318];return _0x19926b;};'use strict';var Mustache=require(_0xe885('0x0'));var _=require(_0xe885('0x1'));module['exports']={'getMustacheRender':function(_0x45b20b,_0x1cd11a){return Mustache[_0xe885('0x2')](_0x45b20b,_[_0xe885('0x3')](_0x1cd11a[_0xe885('0x4')],{'contact':_0x1cd11a['contact'],'message':_0x1cd11a['message'],'account':_0x1cd11a[_0xe885('0x5')],'interaction':_0x1cd11a[_0xe885('0x6')],'list':_0x1cd11a[_0xe885('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8cc66b8..35e3347 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 _0x3a6d=['UserId','error\x20update\x20queue\x20report','agent','agents','busy','busyQueue','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','mailQueues','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','IntervalId','isNil','Intervals','interval','listen','channel','message','interaction','applications','isArray','app','.js','toLowerCase','autoreply','appdata','split','push','slice','length','join','dialogflow','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','Applications\x20executed','complete','No\x20applications\x20to\x20execute','stack','emit','end','QueueReport','update'];(function(_0x52801d,_0x59737a){var _0x24623d=function(_0x20e0d9){while(--_0x20e0d9){_0x52801d['push'](_0x52801d['shift']());}};_0x24623d(++_0x59737a);}(_0x3a6d,0x1e3));var _0xd3a6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3a6d[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xd3a6('0x2'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require(_0xd3a6('0x3'))(_0xd3a6('0x4'));var rpc={'openchannelQueueReport':require(_0xd3a6('0x5')),'mailQueueReport':require(_0xd3a6('0x6')),'chatQueueReport':require(_0xd3a6('0x7')),'smsQueueReport':require(_0xd3a6('0x8')),'faxQueueReport':require(_0xd3a6('0x9')),'whatsappQueueReport':require(_0xd3a6('0xa'))};var RuleEngine=require(_0xd3a6('0xb'));function getId(_0xfefc1,_0x61f036,_0x4e5d02){return util[_0xd3a6('0xc')]('%s.%s.%s',_0xfefc1,_0x61f036||0x0,_0x4e5d02||0x0);}function getIntervals(_0x534089,_0x5d21d1){var _0x9cc1eb=[];if(!_['isNil'](_0x5d21d1[_0xd3a6('0xd')])&&!_[_0xd3a6('0xe')](_0x534089[_0x5d21d1[_0xd3a6('0xd')]])&&!_[_0xd3a6('0xe')](_0x534089[_0x5d21d1[_0xd3a6('0xd')]][_0xd3a6('0xf')])){_0x9cc1eb=_['map'](_0x534089[_0x5d21d1[_0xd3a6('0xd')]][_0xd3a6('0xf')],_0xd3a6('0x10'));}else if(!_['isNil'](_0x5d21d1[_0xd3a6('0x10')])){_0x9cc1eb=[_0x5d21d1[_0xd3a6('0x10')]];}return _0x9cc1eb;}exports[_0xd3a6('0x11')]=function(_0x162d2a){_0x162d2a['rules']={};return new BPromise(function(_0x33dad2,_0x332867){var _0xae600f={'Start':function(_0x3fdebc){var _0x12bd6c=this;return new Promise(function(_0x11daaa,_0x3e9cb1){if(_0x3fdebc){try{var _0x2cd477=[];var _0x63497c=getId(_0x3fdebc[_0xd3a6('0x12')],_0x3fdebc[_0xd3a6('0x13')]?_0x3fdebc[_0xd3a6('0x13')]['id']:0x0,_0x3fdebc[_0xd3a6('0x14')]?_0x3fdebc[_0xd3a6('0x14')]['id']:0x0);if(_0x3fdebc[_0xd3a6('0x15')]&&_[_0xd3a6('0x16')](_0x3fdebc[_0xd3a6('0x15')])&&_0x3fdebc[_0xd3a6('0x15')]['length']){for(var _0x45144c=0x0;_0x45144c<_0x3fdebc[_0xd3a6('0x15')]['length'];_0x45144c+=0x1){var _0x405371=_0x3fdebc['applications'][_0x45144c];if(fs['existsSync'](path['join'](__dirname,'applications',_0x405371[_0xd3a6('0x17')]+_0xd3a6('0x18')))){var _0x521946=[];switch(_0x405371['app'][_0xd3a6('0x19')]()){case _0xd3a6('0x1a'):var _0x4ecf5b=_0x405371[_0xd3a6('0x1b')][_0xd3a6('0x1c')](',');_0x521946[_0xd3a6('0x1d')](_0x4ecf5b[0x0]);_0x521946[_0xd3a6('0x1d')](_0x4ecf5b[_0xd3a6('0x1e')](0x1,_0x4ecf5b[_0xd3a6('0x1f')])[_0xd3a6('0x20')](','));break;case _0xd3a6('0x21'):var _0x50ba3b=_0x405371[_0xd3a6('0x1b')][_0xd3a6('0x1c')](',');_0x521946['push'](_0x50ba3b[0x0]);_0x521946[_0xd3a6('0x1d')](_0x50ba3b[0x1]);_0x521946[_0xd3a6('0x1d')](_0x50ba3b[_0xd3a6('0x1e')](0x2,_0x50ba3b['length'])['join'](','));break;case _0xd3a6('0x22'):var _0x56976c=_0x405371[_0xd3a6('0x1b')][_0xd3a6('0x1c')](',');_0x521946[_0xd3a6('0x1d')](_0x56976c[0x0]);_0x521946['push'](_0x56976c[0x1]);_0x521946[_0xd3a6('0x1d')](_0x56976c[0x2]);_0x521946[_0xd3a6('0x1d')](_0x56976c[0x3]);_0x521946[_0xd3a6('0x1d')](_0x56976c[_0xd3a6('0x1e')](0x4,_0x56976c[_0xd3a6('0x1f')])[_0xd3a6('0x20')](','));break;case'message':_0x521946[_0xd3a6('0x1d')](_0x405371['appdata']);break;case _0xd3a6('0x23'):_0x521946[_0xd3a6('0x1d')](_0x405371[_0xd3a6('0x24')]);_0x521946[_0xd3a6('0x1d')](_0x405371[_0xd3a6('0x1b')]);break;default:_0x521946=_['isNil'](_0x405371[_0xd3a6('0x1b')])?[]:_0x405371[_0xd3a6('0x1b')][_0xd3a6('0x1c')](',');}var _0x19de0e={'id':util[_0xd3a6('0xc')](_0xd3a6('0x25'),_0x63497c,_0x405371['id'],_0x405371[_0xd3a6('0x17')]),'condition':require(_0xd3a6('0x26'))[_0xd3a6('0x27')](_0x63497c,getIntervals(_0x162d2a[_0xd3a6('0x28')],_0x405371),_0x162d2a),'consequence':require(_0xd3a6('0x29')+_0x405371['app'])[_0xd3a6('0x2a')](_0x63497c,_0x521946,_0x162d2a,_0x3fdebc),'p':_0x405371['priority']||0x0};logger['info']('Push\x20new\x20rule',_0x19de0e['id'],_0xd3a6('0x2b'),getIntervals(_0x162d2a[_0xd3a6('0x28')],_0x405371)[_0xd3a6('0x20')]('\x20|\x20'));_0x2cd477['push'](_0x19de0e);}else{logger[_0xd3a6('0x2c')](_0xd3a6('0x2d'),path[_0xd3a6('0x20')](__dirname,_0xd3a6('0x15'),_0x405371[_0xd3a6('0x17')]+_0xd3a6('0x18')));}}_0x162d2a['rules'][_0x63497c]=new RuleEngine(_0x2cd477);_0x162d2a[_0xd3a6('0x2e')][_0x63497c][_0xd3a6('0x2f')](_0x3fdebc,function(_0x1c2f80){logger[_0xd3a6('0x30')](_0xd3a6('0x31'),JSON['stringify'](_0x1c2f80['matchPath']));if(_0x162d2a[_0xd3a6('0x2e')][_0x63497c]){_0x162d2a[_0xd3a6('0x2e')][_0x63497c]['emit'](_0xd3a6('0x32'));}});return _0x11daaa({'code':0xc8,'message':_0x3fdebc});}else{logger[_0xd3a6('0x30')](_0xd3a6('0x33'));return _0x11daaa({'code':0xc8,'message':_0x3fdebc});}}catch(_0x532d72){logger[_0xd3a6('0x2c')](_0x532d72[_0xd3a6('0x34')]);return _0x3e9cb1(_0x12bd6c[_0xd3a6('0x2c')](0x1f4,_0x532d72));}}return _0x3e9cb1('routing\x20is\x20empty');});},'AcceptMessage':function(_0x392991){var _0x451458=this;return new Promise(function(_0x156697,_0x433921){if(_0x392991[_0xd3a6('0x13')]&&_0x392991[_0xd3a6('0x13')]['id']){try{var _0x5c8b99=getId(_0x392991[_0xd3a6('0x12')],_0x392991[_0xd3a6('0x13')]?_0x392991[_0xd3a6('0x13')]['id']:0x0,_0x392991[_0xd3a6('0x14')]?_0x392991['interaction']['id']:0x0);if(_0x162d2a[_0xd3a6('0x2e')][_0x5c8b99]){_0x162d2a[_0xd3a6('0x2e')][_0x5c8b99][_0xd3a6('0x35')](_0xd3a6('0x36'));if(rpc[_0x392991[_0xd3a6('0x12')]+_0xd3a6('0x37')]){rpc[_0x392991['channel']+_0xd3a6('0x37')][_0xd3a6('0x38')](_0x5c8b99,{'UserId':_0x392991[_0xd3a6('0x13')][_0xd3a6('0x39')]})['catch'](function(_0x401a7b){logger[_0xd3a6('0x2c')](_0xd3a6('0x3a'));});}}return _0x156697({'code':0xc8,'message':_0x392991});}catch(_0x41e403){logger[_0xd3a6('0x2c')](_0x41e403[_0xd3a6('0x34')]);return _0x433921(_0x451458[_0xd3a6('0x2c')](0x1f4,_0x41e403));}}logger[_0xd3a6('0x2c')]('message\x20is\x20empty');return _0x433921(_0x451458['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x1993e1){var _0x306866=this;return new Promise(function(_0x1b3969,_0x2efe2c){if(_0x1993e1[_0xd3a6('0x3b')]&&_0x1993e1['agent']['id']){try{if(_0x162d2a[_0xd3a6('0x3c')][_0x1993e1[_0xd3a6('0x3b')]['id']]){_0x162d2a[_0xd3a6('0x3c')][_0x1993e1[_0xd3a6('0x3b')]['id']][_0xd3a6('0x3d')]=![];_0x162d2a[_0xd3a6('0x3c')][_0x1993e1[_0xd3a6('0x3b')]['id']][_0xd3a6('0x3e')]=undefined;}return _0x1b3969({'code':0xc8,'message':_0x1993e1});}catch(_0x1b250c){logger[_0xd3a6('0x2c')](_0x1b250c['stack']);return _0x2efe2c(_0x306866[_0xd3a6('0x2c')](0x1f4,_0x1b250c));}}logger[_0xd3a6('0x2c')]('message\x20is\x20empty');return _0x2efe2c(_0x306866[_0xd3a6('0x2c')](0x1f4,_0xd3a6('0x3f')));});},'AbandonInteraction':function(_0x1e6dfc){var _0x26f2ce=this;return new Promise(function(_0x54c131,_0x1bb767){if(_0x1e6dfc['channel']&&_0x1e6dfc[_0xd3a6('0x14')]&&_0x1e6dfc[_0xd3a6('0x14')]['id']){try{var _0x5ccf9f=getId(_0x1e6dfc[_0xd3a6('0x12')],_0x1e6dfc[_0xd3a6('0x13')]?_0x1e6dfc['message']['id']:0x0,_0x1e6dfc[_0xd3a6('0x14')]?_0x1e6dfc['interaction']['id']:0x0);if(_0x162d2a[_0xd3a6('0x2e')][_0x5ccf9f]){_0x162d2a[_0xd3a6('0x2e')][_0x5ccf9f]['emit'](_0xd3a6('0x36'));}return _0x54c131({'code':0xc8,'message':_0x1e6dfc});}catch(_0x24e005){logger['error'](_0x24e005[_0xd3a6('0x34')]);return _0x1bb767(_0x26f2ce[_0xd3a6('0x2c')](0x1f4,_0x24e005));}}logger['error'](_0xd3a6('0x3f'));return _0x1bb767(_0x26f2ce['error'](0x1f4,_0xd3a6('0x3f')));});},'AgentCapacity':function(_0xf963bf){var _0x10f03f=this;return new Promise(function(_0x7d09c0,_0x34d11d){if(_0x162d2a['agents']['hasOwnProperty'](_0xf963bf['id'])){for(var _0x8c2565 in _0xf963bf[_0xd3a6('0x40')]){if(_0xf963bf[_0xd3a6('0x40')]['hasOwnProperty'](_0x8c2565)){if(_0x162d2a[_0xd3a6('0x3c')][_0xf963bf['id']][_0xd3a6('0x41')](_0x8c2565+_0xd3a6('0x42'))){_0x162d2a[_0xd3a6('0x3c')][_0xf963bf['id']][_0x8c2565+_0xd3a6('0x42')]=parseInt(_0xf963bf[_0xd3a6('0x40')][_0x8c2565],0xa);}}}_0x162d2a[_0xd3a6('0x3c')][_0xf963bf['id']][_0xd3a6('0x43')]();return _0x7d09c0({'code':0xc8,'message':_0x162d2a[_0xd3a6('0x3c')][_0xf963bf['id']]});}else{return _0x34d11d(_0x10f03f[_0xd3a6('0x2c')](0x1f4,_0xd3a6('0x44')));}});},'Agents':function(_0x93a6e1){return new Promise(function(_0x124441,_0x350c64){var _0x5e3fa9=_[_0xd3a6('0x45')](_0x162d2a[_0xd3a6('0x3c')]);_0x124441({'count':_0x5e3fa9[_0xd3a6('0x1f')],'rows':_0x5e3fa9});});},'ChatQueues':function(_0x15257f){return new Promise(function(_0x27195a,_0x592d7b){var _0x426b55=[];for(var _0x220d6c in _0x162d2a[_0xd3a6('0x46')]){if(_0x162d2a['chatQueues'][_0xd3a6('0x41')](_0x220d6c)){var _0x296577=_0x162d2a[_0xd3a6('0x46')][_0x220d6c];var _0x2f346a={'id':_0x296577['id'],'available':_0x296577[_0xd3a6('0x47')],'loggedIn':_0x296577[_0xd3a6('0x48')],'name':_0x296577[_0xd3a6('0x49')],'paused':_0x296577['paused'],'waiting':_0x296577['waiting']};_0x426b55[_0xd3a6('0x1d')](_0x2f346a);}}_0x27195a({'count':_0x426b55['length'],'rows':_0x426b55});});},'MailQueues':function(_0x1446d5){return new Promise(function(_0xa3c935,_0x161676){var _0x164087=[];for(var _0x1080b6 in _0x162d2a[_0xd3a6('0x4a')]){if(_0x162d2a[_0xd3a6('0x4a')]['hasOwnProperty'](_0x1080b6)){var _0x464619=_0x162d2a[_0xd3a6('0x4a')][_0x1080b6];var _0x1b0d5f={'id':_0x464619['id'],'available':_0x464619[_0xd3a6('0x47')],'loggedIn':_0x464619['loggedIn'],'name':_0x464619[_0xd3a6('0x49')],'paused':_0x464619[_0xd3a6('0x4b')],'waiting':_0x464619[_0xd3a6('0x4c')]};_0x164087[_0xd3a6('0x1d')](_0x1b0d5f);}}_0xa3c935({'count':_0x164087['length'],'rows':_0x164087});});},'OpenchannelQueues':function(_0x4f55bd){return new Promise(function(_0x34ef1c,_0x36dd92){var _0x39a964=[];for(var _0x23b7a4 in _0x162d2a[_0xd3a6('0x4d')]){if(_0x162d2a[_0xd3a6('0x4d')][_0xd3a6('0x41')](_0x23b7a4)){var _0x2d89ec=_0x162d2a[_0xd3a6('0x4d')][_0x23b7a4];var _0xc96f2f={'id':_0x2d89ec['id'],'available':_0x2d89ec['available'],'loggedIn':_0x2d89ec[_0xd3a6('0x48')],'name':_0x2d89ec[_0xd3a6('0x49')],'paused':_0x2d89ec[_0xd3a6('0x4b')],'waiting':_0x2d89ec[_0xd3a6('0x4c')]};_0x39a964[_0xd3a6('0x1d')](_0xc96f2f);}}_0x34ef1c({'count':_0x39a964['length'],'rows':_0x39a964});});},'SmsQueues':function(_0x31ee1e){return new Promise(function(_0x3122c2,_0x577ddc){var _0x19f98d=[];for(var _0x231e5a in _0x162d2a[_0xd3a6('0x4e')]){if(_0x162d2a[_0xd3a6('0x4e')]['hasOwnProperty'](_0x231e5a)){var _0x34cc7f=_0x162d2a[_0xd3a6('0x4e')][_0x231e5a];var _0x25e5d0={'id':_0x34cc7f['id'],'available':_0x34cc7f[_0xd3a6('0x47')],'loggedIn':_0x34cc7f['loggedIn'],'name':_0x34cc7f[_0xd3a6('0x49')],'paused':_0x34cc7f['paused'],'waiting':_0x34cc7f['waiting']};_0x19f98d['push'](_0x25e5d0);}}_0x3122c2({'count':_0x19f98d[_0xd3a6('0x1f')],'rows':_0x19f98d});});},'FaxQueues':function(_0x459290){return new Promise(function(_0x5053e9,_0x53437e){var _0x44c638=[];for(var _0x26ade0 in _0x162d2a[_0xd3a6('0x4f')]){if(_0x162d2a[_0xd3a6('0x4f')][_0xd3a6('0x41')](_0x26ade0)){var _0x4ad2d5=_0x162d2a[_0xd3a6('0x4f')][_0x26ade0];var _0x3525ed={'id':_0x4ad2d5['id'],'available':_0x4ad2d5['available'],'loggedIn':_0x4ad2d5[_0xd3a6('0x48')],'name':_0x4ad2d5[_0xd3a6('0x49')],'paused':_0x4ad2d5['paused'],'waiting':_0x4ad2d5['waiting']};_0x44c638[_0xd3a6('0x1d')](_0x3525ed);}}_0x5053e9({'count':_0x44c638[_0xd3a6('0x1f')],'rows':_0x44c638});});},'WhatsappQueues':function(_0x43dea8){return new Promise(function(_0x24d8ea,_0x21c202){var _0x3ffc81=[];for(var _0x535d69 in _0x162d2a[_0xd3a6('0x50')]){if(_0x162d2a[_0xd3a6('0x50')][_0xd3a6('0x41')](_0x535d69)){var _0x4e6eee=_0x162d2a['whatsappQueues'][_0x535d69];var _0x4a9ad8={'id':_0x4e6eee['id'],'available':_0x4e6eee['available'],'loggedIn':_0x4e6eee[_0xd3a6('0x48')],'name':_0x4e6eee[_0xd3a6('0x49')],'paused':_0x4e6eee[_0xd3a6('0x4b')],'waiting':_0x4e6eee[_0xd3a6('0x4c')]};_0x3ffc81[_0xd3a6('0x1d')](_0x4a9ad8);}}_0x24d8ea({'count':_0x3ffc81[_0xd3a6('0x1f')],'rows':_0x3ffc81});});},'ChatQueuesWaitingInteractions':function(_0x38550d){return new Promise(function(_0x188f43,_0x378ea1){var _0x4536ab=_['values'](_0x162d2a[_0xd3a6('0x51')]);_0x188f43({'count':_0x4536ab[_0xd3a6('0x1f')],'rows':_0x4536ab});});},'MailQueuesWaitingInteractions':function(_0x489dbc){return new Promise(function(_0x53a626,_0xdbb29b){var _0xa51289=_['values'](_0x162d2a['mailQueuesWaitingInteractions']);_0x53a626({'count':_0xa51289['length'],'rows':_0xa51289});});},'OpenchannelQueuesWaitingInteractions':function(_0x31375d){return new Promise(function(_0x4eeb2f,_0x576e35){var _0x311373=_['values'](_0x162d2a[_0xd3a6('0x52')]);_0x4eeb2f({'count':_0x311373['length'],'rows':_0x311373});});},'SmsQueuesWaitingInteractions':function(_0xbac7a2){return new Promise(function(_0x5ee198,_0x3df610){var _0x1612d4=_[_0xd3a6('0x45')](_0x162d2a[_0xd3a6('0x53')]);_0x5ee198({'count':_0x1612d4[_0xd3a6('0x1f')],'rows':_0x1612d4});});},'FaxQueuesWaitingInteractions':function(_0x146b71){return new Promise(function(_0x3fbc38,_0x130cca){var _0xfe446f=_[_0xd3a6('0x45')](_0x162d2a['faxQueuesWaitingInteractions']);_0x3fbc38({'count':_0xfe446f[_0xd3a6('0x1f')],'rows':_0xfe446f});});},'WhatsappQueuesWaitingInteractions':function(_0xcaa294){return new Promise(function(_0x3b8c07,_0x3a7376){var _0x2c85c8=_[_0xd3a6('0x45')](_0x162d2a['whatsappQueuesWaitingInteractions']);_0x3b8c07({'count':_0x2c85c8['length'],'rows':_0x2c85c8});});}};var _0x47a865=jayson[_0xd3a6('0x54')](_0xae600f)[_0xd3a6('0x55')]();_0x47a865['on'](_0xd3a6('0x2c'),function(_0x12318b){logger[_0xd3a6('0x2c')](JSON[_0xd3a6('0x56')](_0x12318b));return _0x332867(_0x12318b);});_0x47a865[_0xd3a6('0x11')](0x232c,_0xd3a6('0x57'),function(){console[_0xd3a6('0x58')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x33dad2(_0xd3a6('0x59')+0x232c);});});}; \ No newline at end of file +var _0x30dd=['channel','end','QueueReport','UserId','catch','message\x20is\x20empty','agent','agents','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','push','slice','appdata','split','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','emit','complete','stack','routing\x20is\x20empty'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x30dd,0xd8));var _0xd30d=function(_0x1182e8,_0x14cc0e){_0x1182e8=_0x1182e8-0x0;var _0x4deabd=_0x30dd[_0x1182e8];return _0x4deabd;};'use strict';var _=require(_0xd30d('0x0'));var util=require(_0xd30d('0x1'));var path=require(_0xd30d('0x2'));var fs=require('fs');var jayson=require(_0xd30d('0x3'));var BPromise=require(_0xd30d('0x4'));var uuid=require(_0xd30d('0x5'));var config=require(_0xd30d('0x6'));var logger=require(_0xd30d('0x7'))(_0xd30d('0x8'));var rpc={'openchannelQueueReport':require(_0xd30d('0x9')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xd30d('0xa')),'smsQueueReport':require(_0xd30d('0xb')),'faxQueueReport':require(_0xd30d('0xc')),'whatsappQueueReport':require(_0xd30d('0xd'))};var RuleEngine=require(_0xd30d('0xe'));function getId(_0x2d4f5c,_0x34b0f3,_0x5a6cff){return util[_0xd30d('0xf')](_0xd30d('0x10'),_0x2d4f5c,_0x34b0f3||0x0,_0x5a6cff||0x0);}function getIntervals(_0x2b8b56,_0x2b9ad8){var _0x5c26f0=[];if(!_[_0xd30d('0x11')](_0x2b9ad8[_0xd30d('0x12')])&&!_[_0xd30d('0x11')](_0x2b8b56[_0x2b9ad8['IntervalId']])&&!_[_0xd30d('0x11')](_0x2b8b56[_0x2b9ad8[_0xd30d('0x12')]][_0xd30d('0x13')])){_0x5c26f0=_[_0xd30d('0x14')](_0x2b8b56[_0x2b9ad8[_0xd30d('0x12')]][_0xd30d('0x13')],_0xd30d('0x15'));}else if(!_[_0xd30d('0x11')](_0x2b9ad8[_0xd30d('0x15')])){_0x5c26f0=[_0x2b9ad8[_0xd30d('0x15')]];}return _0x5c26f0;}exports[_0xd30d('0x16')]=function(_0x48bab0){_0x48bab0[_0xd30d('0x17')]={};return new BPromise(function(_0x4a8251,_0x16c1e0){var _0x22dd9e={'Start':function(_0x21dc8a){var _0x29cb40=this;return new Promise(function(_0x1f56a1,_0xf22db4){if(_0x21dc8a){try{var _0x20bbf5=[];var _0x44ccec=getId(_0x21dc8a['channel'],_0x21dc8a[_0xd30d('0x18')]?_0x21dc8a[_0xd30d('0x18')]['id']:0x0,_0x21dc8a['interaction']?_0x21dc8a[_0xd30d('0x19')]['id']:0x0);if(_0x21dc8a[_0xd30d('0x1a')]&&_[_0xd30d('0x1b')](_0x21dc8a[_0xd30d('0x1a')])&&_0x21dc8a[_0xd30d('0x1a')][_0xd30d('0x1c')]){for(var _0x2934ce=0x0;_0x2934ce<_0x21dc8a[_0xd30d('0x1a')][_0xd30d('0x1c')];_0x2934ce+=0x1){var _0x3c5556=_0x21dc8a[_0xd30d('0x1a')][_0x2934ce];if(fs[_0xd30d('0x1d')](path[_0xd30d('0x1e')](__dirname,_0xd30d('0x1a'),_0x3c5556[_0xd30d('0x1f')]+'.js'))){var _0x2ced8b=[];switch(_0x3c5556[_0xd30d('0x1f')][_0xd30d('0x20')]()){case _0xd30d('0x21'):var _0x349f0c=_0x3c5556['appdata']['split'](',');_0x2ced8b[_0xd30d('0x22')](_0x349f0c[0x0]);_0x2ced8b[_0xd30d('0x22')](_0x349f0c[_0xd30d('0x23')](0x1,_0x349f0c['length'])[_0xd30d('0x1e')](','));break;case'dialogflow':var _0x1fd449=_0x3c5556[_0xd30d('0x24')][_0xd30d('0x25')](',');_0x2ced8b[_0xd30d('0x22')](_0x1fd449[0x0]);_0x2ced8b['push'](_0x1fd449[0x1]);_0x2ced8b[_0xd30d('0x22')](_0x1fd449[_0xd30d('0x23')](0x2,_0x1fd449['length'])[_0xd30d('0x1e')](','));break;case'amazonlex':var _0x4ad420=_0x3c5556['appdata'][_0xd30d('0x25')](',');_0x2ced8b['push'](_0x4ad420[0x0]);_0x2ced8b[_0xd30d('0x22')](_0x4ad420[0x1]);_0x2ced8b[_0xd30d('0x22')](_0x4ad420[0x2]);_0x2ced8b[_0xd30d('0x22')](_0x4ad420[0x3]);_0x2ced8b['push'](_0x4ad420[_0xd30d('0x23')](0x4,_0x4ad420[_0xd30d('0x1c')])[_0xd30d('0x1e')](','));break;case'message':_0x2ced8b[_0xd30d('0x22')](_0x3c5556[_0xd30d('0x24')]);break;case'tag':_0x2ced8b[_0xd30d('0x22')](_0x3c5556[_0xd30d('0x26')]);_0x2ced8b[_0xd30d('0x22')](_0x3c5556[_0xd30d('0x24')]);break;default:_0x2ced8b=_['isNil'](_0x3c5556[_0xd30d('0x24')])?[]:_0x3c5556[_0xd30d('0x24')][_0xd30d('0x25')](',');}var _0x389821={'id':util[_0xd30d('0xf')](_0xd30d('0x27'),_0x44ccec,_0x3c5556['id'],_0x3c5556['app']),'condition':require(_0xd30d('0x28'))[_0xd30d('0x29')](_0x44ccec,getIntervals(_0x48bab0[_0xd30d('0x2a')],_0x3c5556),_0x48bab0),'consequence':require(_0xd30d('0x2b')+_0x3c5556[_0xd30d('0x1f')])[_0xd30d('0x2c')](_0x44ccec,_0x2ced8b,_0x48bab0,_0x21dc8a),'p':_0x3c5556['priority']||0x0};logger[_0xd30d('0x2d')](_0xd30d('0x2e'),_0x389821['id'],_0xd30d('0x2f'),getIntervals(_0x48bab0[_0xd30d('0x2a')],_0x3c5556)[_0xd30d('0x1e')](_0xd30d('0x30')));_0x20bbf5[_0xd30d('0x22')](_0x389821);}else{logger[_0xd30d('0x31')](_0xd30d('0x32'),path[_0xd30d('0x1e')](__dirname,_0xd30d('0x1a'),_0x3c5556[_0xd30d('0x1f')]+_0xd30d('0x33')));}}_0x48bab0[_0xd30d('0x17')][_0x44ccec]=new RuleEngine(_0x20bbf5);_0x48bab0[_0xd30d('0x17')][_0x44ccec][_0xd30d('0x34')](_0x21dc8a,function(_0x18a68d){logger[_0xd30d('0x2d')]('Applications\x20executed',JSON['stringify'](_0x18a68d['matchPath']));if(_0x48bab0[_0xd30d('0x17')][_0x44ccec]){_0x48bab0['rules'][_0x44ccec][_0xd30d('0x35')](_0xd30d('0x36'));}});return _0x1f56a1({'code':0xc8,'message':_0x21dc8a});}else{logger[_0xd30d('0x2d')]('No\x20applications\x20to\x20execute');return _0x1f56a1({'code':0xc8,'message':_0x21dc8a});}}catch(_0x31c2a9){logger[_0xd30d('0x31')](_0x31c2a9[_0xd30d('0x37')]);return _0xf22db4(_0x29cb40[_0xd30d('0x31')](0x1f4,_0x31c2a9));}}return _0xf22db4(_0xd30d('0x38'));});},'AcceptMessage':function(_0x13df74){var _0x1271c0=this;return new Promise(function(_0x13671e,_0x377fec){if(_0x13df74[_0xd30d('0x18')]&&_0x13df74['message']['id']){try{var _0x9537d3=getId(_0x13df74[_0xd30d('0x39')],_0x13df74['message']?_0x13df74[_0xd30d('0x18')]['id']:0x0,_0x13df74['interaction']?_0x13df74['interaction']['id']:0x0);if(_0x48bab0[_0xd30d('0x17')][_0x9537d3]){_0x48bab0[_0xd30d('0x17')][_0x9537d3]['emit'](_0xd30d('0x3a'));if(rpc[_0x13df74[_0xd30d('0x39')]+_0xd30d('0x3b')]){rpc[_0x13df74[_0xd30d('0x39')]+_0xd30d('0x3b')]['update'](_0x9537d3,{'UserId':_0x13df74[_0xd30d('0x18')][_0xd30d('0x3c')]})[_0xd30d('0x3d')](function(_0x31febd){logger[_0xd30d('0x31')]('error\x20update\x20queue\x20report');});}}return _0x13671e({'code':0xc8,'message':_0x13df74});}catch(_0x3e41a9){logger[_0xd30d('0x31')](_0x3e41a9[_0xd30d('0x37')]);return _0x377fec(_0x1271c0['error'](0x1f4,_0x3e41a9));}}logger['error'](_0xd30d('0x3e'));return _0x377fec(_0x1271c0[_0xd30d('0x31')](0x1f4,_0xd30d('0x3e')));});},'RejectMessage':function(_0x44914b){var _0x3fefaf=this;return new Promise(function(_0x463dd4,_0x2da361){if(_0x44914b[_0xd30d('0x3f')]&&_0x44914b[_0xd30d('0x3f')]['id']){try{if(_0x48bab0['agents'][_0x44914b[_0xd30d('0x3f')]['id']]){_0x48bab0[_0xd30d('0x40')][_0x44914b[_0xd30d('0x3f')]['id']]['busy']=![];_0x48bab0[_0xd30d('0x40')][_0x44914b['agent']['id']]['busyQueue']=undefined;}return _0x463dd4({'code':0xc8,'message':_0x44914b});}catch(_0x2d328a){logger[_0xd30d('0x31')](_0x2d328a['stack']);return _0x2da361(_0x3fefaf[_0xd30d('0x31')](0x1f4,_0x2d328a));}}logger['error'](_0xd30d('0x3e'));return _0x2da361(_0x3fefaf[_0xd30d('0x31')](0x1f4,_0xd30d('0x3e')));});},'AbandonInteraction':function(_0x241e18){var _0x40e1df=this;return new Promise(function(_0x15c448,_0x42840c){if(_0x241e18[_0xd30d('0x39')]&&_0x241e18['interaction']&&_0x241e18[_0xd30d('0x19')]['id']){try{var _0x21d6b3=getId(_0x241e18[_0xd30d('0x39')],_0x241e18['message']?_0x241e18[_0xd30d('0x18')]['id']:0x0,_0x241e18[_0xd30d('0x19')]?_0x241e18[_0xd30d('0x19')]['id']:0x0);if(_0x48bab0[_0xd30d('0x17')][_0x21d6b3]){_0x48bab0[_0xd30d('0x17')][_0x21d6b3][_0xd30d('0x35')](_0xd30d('0x3a'));}return _0x15c448({'code':0xc8,'message':_0x241e18});}catch(_0x1cccaa){logger[_0xd30d('0x31')](_0x1cccaa[_0xd30d('0x37')]);return _0x42840c(_0x40e1df[_0xd30d('0x31')](0x1f4,_0x1cccaa));}}logger[_0xd30d('0x31')]('message\x20is\x20empty');return _0x42840c(_0x40e1df['error'](0x1f4,_0xd30d('0x3e')));});},'AgentCapacity':function(_0x2ffaca){var _0x1a69a0=this;return new Promise(function(_0x2dadda,_0x34fdb0){if(_0x48bab0[_0xd30d('0x40')][_0xd30d('0x41')](_0x2ffaca['id'])){for(var _0x3b99c1 in _0x2ffaca['capacity']){if(_0x2ffaca[_0xd30d('0x42')][_0xd30d('0x41')](_0x3b99c1)){if(_0x48bab0[_0xd30d('0x40')][_0x2ffaca['id']]['hasOwnProperty'](_0x3b99c1+'CurrentCapacity')){_0x48bab0[_0xd30d('0x40')][_0x2ffaca['id']][_0x3b99c1+_0xd30d('0x43')]=parseInt(_0x2ffaca[_0xd30d('0x42')][_0x3b99c1],0xa);}}}_0x48bab0[_0xd30d('0x40')][_0x2ffaca['id']][_0xd30d('0x44')]();return _0x2dadda({'code':0xc8,'message':_0x48bab0['agents'][_0x2ffaca['id']]});}else{return _0x34fdb0(_0x1a69a0[_0xd30d('0x31')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x243960){return new Promise(function(_0x54c123,_0x3ebceb){var _0x437a16=_[_0xd30d('0x45')](_0x48bab0[_0xd30d('0x40')]);_0x54c123({'count':_0x437a16[_0xd30d('0x1c')],'rows':_0x437a16});});},'ChatQueues':function(_0x43bff4){return new Promise(function(_0x40eafc,_0x75ec10){var _0x5280d8=[];for(var _0x57122a in _0x48bab0['chatQueues']){if(_0x48bab0[_0xd30d('0x46')][_0xd30d('0x41')](_0x57122a)){var _0x18b7c8=_0x48bab0['chatQueues'][_0x57122a];var _0x5be42d={'id':_0x18b7c8['id'],'available':_0x18b7c8[_0xd30d('0x47')],'loggedIn':_0x18b7c8[_0xd30d('0x48')],'name':_0x18b7c8[_0xd30d('0x49')],'paused':_0x18b7c8[_0xd30d('0x4a')],'waiting':_0x18b7c8[_0xd30d('0x4b')]};_0x5280d8['push'](_0x5be42d);}}_0x40eafc({'count':_0x5280d8[_0xd30d('0x1c')],'rows':_0x5280d8});});},'MailQueues':function(_0x2e0837){return new Promise(function(_0x3716ed,_0x2fda80){var _0x4c2e21=[];for(var _0x530faf in _0x48bab0['mailQueues']){if(_0x48bab0[_0xd30d('0x4c')][_0xd30d('0x41')](_0x530faf)){var _0x5ca0f5=_0x48bab0[_0xd30d('0x4c')][_0x530faf];var _0x39fc54={'id':_0x5ca0f5['id'],'available':_0x5ca0f5[_0xd30d('0x47')],'loggedIn':_0x5ca0f5['loggedIn'],'name':_0x5ca0f5[_0xd30d('0x49')],'paused':_0x5ca0f5[_0xd30d('0x4a')],'waiting':_0x5ca0f5[_0xd30d('0x4b')]};_0x4c2e21[_0xd30d('0x22')](_0x39fc54);}}_0x3716ed({'count':_0x4c2e21[_0xd30d('0x1c')],'rows':_0x4c2e21});});},'OpenchannelQueues':function(_0x2f960f){return new Promise(function(_0x5ed096,_0x44ae84){var _0x36cacf=[];for(var _0x4bb4a8 in _0x48bab0['openchannelQueues']){if(_0x48bab0[_0xd30d('0x4d')][_0xd30d('0x41')](_0x4bb4a8)){var _0x4b90b1=_0x48bab0[_0xd30d('0x4d')][_0x4bb4a8];var _0x352e82={'id':_0x4b90b1['id'],'available':_0x4b90b1[_0xd30d('0x47')],'loggedIn':_0x4b90b1[_0xd30d('0x48')],'name':_0x4b90b1[_0xd30d('0x49')],'paused':_0x4b90b1[_0xd30d('0x4a')],'waiting':_0x4b90b1[_0xd30d('0x4b')]};_0x36cacf['push'](_0x352e82);}}_0x5ed096({'count':_0x36cacf['length'],'rows':_0x36cacf});});},'SmsQueues':function(_0x4ab97f){return new Promise(function(_0xcdd149,_0x1f601b){var _0x300154=[];for(var _0x5b156d in _0x48bab0[_0xd30d('0x4e')]){if(_0x48bab0['smsQueues'][_0xd30d('0x41')](_0x5b156d)){var _0x4c9cef=_0x48bab0['smsQueues'][_0x5b156d];var _0x2c3408={'id':_0x4c9cef['id'],'available':_0x4c9cef[_0xd30d('0x47')],'loggedIn':_0x4c9cef[_0xd30d('0x48')],'name':_0x4c9cef['name'],'paused':_0x4c9cef[_0xd30d('0x4a')],'waiting':_0x4c9cef[_0xd30d('0x4b')]};_0x300154['push'](_0x2c3408);}}_0xcdd149({'count':_0x300154[_0xd30d('0x1c')],'rows':_0x300154});});},'FaxQueues':function(_0x3c67cd){return new Promise(function(_0x95d797,_0x4de3ff){var _0x54c03c=[];for(var _0x3c3f08 in _0x48bab0[_0xd30d('0x4f')]){if(_0x48bab0[_0xd30d('0x4f')]['hasOwnProperty'](_0x3c3f08)){var _0x31ab14=_0x48bab0['faxQueues'][_0x3c3f08];var _0x41f4b9={'id':_0x31ab14['id'],'available':_0x31ab14[_0xd30d('0x47')],'loggedIn':_0x31ab14[_0xd30d('0x48')],'name':_0x31ab14[_0xd30d('0x49')],'paused':_0x31ab14['paused'],'waiting':_0x31ab14[_0xd30d('0x4b')]};_0x54c03c['push'](_0x41f4b9);}}_0x95d797({'count':_0x54c03c[_0xd30d('0x1c')],'rows':_0x54c03c});});},'WhatsappQueues':function(_0x29629a){return new Promise(function(_0x2516c6,_0x1b2a8b){var _0x17141e=[];for(var _0x557c82 in _0x48bab0[_0xd30d('0x50')]){if(_0x48bab0[_0xd30d('0x50')][_0xd30d('0x41')](_0x557c82)){var _0x2ef8ca=_0x48bab0[_0xd30d('0x50')][_0x557c82];var _0x4381ef={'id':_0x2ef8ca['id'],'available':_0x2ef8ca[_0xd30d('0x47')],'loggedIn':_0x2ef8ca[_0xd30d('0x48')],'name':_0x2ef8ca[_0xd30d('0x49')],'paused':_0x2ef8ca['paused'],'waiting':_0x2ef8ca[_0xd30d('0x4b')]};_0x17141e[_0xd30d('0x22')](_0x4381ef);}}_0x2516c6({'count':_0x17141e[_0xd30d('0x1c')],'rows':_0x17141e});});},'ChatQueuesWaitingInteractions':function(_0x17a1d9){return new Promise(function(_0x3d09a3,_0x23cb0c){var _0x103edc=_[_0xd30d('0x45')](_0x48bab0[_0xd30d('0x51')]);_0x3d09a3({'count':_0x103edc[_0xd30d('0x1c')],'rows':_0x103edc});});},'MailQueuesWaitingInteractions':function(_0x90e7da){return new Promise(function(_0x33d063,_0x339e8f){var _0x5a8cf7=_[_0xd30d('0x45')](_0x48bab0[_0xd30d('0x52')]);_0x33d063({'count':_0x5a8cf7[_0xd30d('0x1c')],'rows':_0x5a8cf7});});},'OpenchannelQueuesWaitingInteractions':function(_0xcaec2f){return new Promise(function(_0x5a71a9,_0x502b70){var _0x2c74c2=_[_0xd30d('0x45')](_0x48bab0[_0xd30d('0x53')]);_0x5a71a9({'count':_0x2c74c2[_0xd30d('0x1c')],'rows':_0x2c74c2});});},'SmsQueuesWaitingInteractions':function(_0x291904){return new Promise(function(_0x4eef5e,_0x333fdd){var _0x4f689b=_[_0xd30d('0x45')](_0x48bab0[_0xd30d('0x54')]);_0x4eef5e({'count':_0x4f689b[_0xd30d('0x1c')],'rows':_0x4f689b});});},'FaxQueuesWaitingInteractions':function(_0xbd3074){return new Promise(function(_0x5194e1,_0x1e0139){var _0x126bb5=_[_0xd30d('0x45')](_0x48bab0[_0xd30d('0x55')]);_0x5194e1({'count':_0x126bb5[_0xd30d('0x1c')],'rows':_0x126bb5});});},'WhatsappQueuesWaitingInteractions':function(_0x577fb4){return new Promise(function(_0x2985c7,_0x1d2f4d){var _0x396492=_[_0xd30d('0x45')](_0x48bab0[_0xd30d('0x56')]);_0x2985c7({'count':_0x396492[_0xd30d('0x1c')],'rows':_0x396492});});}};var _0x50a2ab=jayson[_0xd30d('0x57')](_0x22dd9e)['http']();_0x50a2ab['on'](_0xd30d('0x31'),function(_0x4c24eb){logger['error'](JSON[_0xd30d('0x58')](_0x4c24eb));return _0x16c1e0(_0x4c24eb);});_0x50a2ab[_0xd30d('0x16')](0x232c,_0xd30d('0x59'),function(){console['log'](_0xd30d('0x5a'),0x232c);return _0x4a8251('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 8467445..7e9cb27 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 _0x8d9d=['client','http','then','error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','Command','iftime\x20%s','message','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','util','bluebird','../../../config/logger','routing'];(function(_0x1c3f8e,_0x2f7794){var _0x40b720=function(_0xd92bec){while(--_0xd92bec){_0x1c3f8e['push'](_0x1c3f8e['shift']());}};_0x40b720(++_0x2f7794);}(_0x8d9d,0x1d0));var _0xd8d9=function(_0x3c5eaa,_0x5c4850){_0x3c5eaa=_0x3c5eaa-0x0;var _0x9c76e4=_0x8d9d[_0x3c5eaa];return _0x9c76e4;};'use strict';var util=require(_0xd8d9('0x0'));var BPromise=require(_0xd8d9('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xd8d9('0x2'))(_0xd8d9('0x3'));var client=jayson[_0xd8d9('0x4')][_0xd8d9('0x5')]({'port':0x232a});function request(_0xe8bc6e,_0x5b485d){return new BPromise(function(_0x5cde39,_0x23cbb9){return client['request'](_0xe8bc6e,_0x5b485d)[_0xd8d9('0x6')](function(_0x84241a){if(_0x84241a[_0xd8d9('0x7')]){return _0x23cbb9(_0x84241a[_0xd8d9('0x7')]['message']);}else{return _0x5cde39(_0x84241a['result']);}})[_0xd8d9('0x8')](function(_0xe96239){return _0x23cbb9(_0xe96239);});});}exports[_0xd8d9('0x9')]=function(_0x15ee81,_0x2c7be,_0x513f91){return function(_0x574aa0){if(_0x513f91['rules']&&!_0x513f91[_0xd8d9('0xa')][_0x15ee81]){logger[_0xd8d9('0xb')](_0xd8d9('0xc'),_0x15ee81);return _0x574aa0['stop']();}var _0x5512f9=[];for(var _0x366f12=0x0;_0x366f12<_0x2c7be['length'];_0x366f12+=0x1){_0x5512f9['push'](request(_0xd8d9('0xd'),{'command':util['format'](_0xd8d9('0xe'),_0x2c7be[_0x366f12])})[_0xd8d9('0x6')](function(_0x348255){return _0x348255&&_0x348255[_0xd8d9('0xf')]&&_0x348255[_0xd8d9('0xf')]['indexOf'](_0xd8d9('0x10'))>=0x0?!![]:![];})['catch'](function(_0x455c42){logger[_0xd8d9('0x7')](_0xd8d9('0x11'),_0x15ee81,_0x2c7be[_0x366f12]);}));}BPromise[_0xd8d9('0x12')](_0x5512f9)[_0xd8d9('0x6')](function(_0x44b891){var _0x307e83=_['some'](_0x44b891);logger[_0xd8d9('0xb')](_0xd8d9('0x13'),_0x15ee81,_0x2c7be[_0xd8d9('0x14')](_0xd8d9('0x15')),_0x307e83);_0x574aa0[_0xd8d9('0x16')](_0x307e83);})[_0xd8d9('0x8')](function(_0x44cfad){console[_0xd8d9('0x17')](_0x44cfad);logger['error'](_0xd8d9('0x13'),_0x15ee81,_0x2c7be[_0xd8d9('0x14')](_0xd8d9('0x15')),_0x44cfad[_0xd8d9('0x18')]);_0x574aa0[_0xd8d9('0x19')]();});};}; \ No newline at end of file +var _0xe2ab=['stop','length','push','Command','format','indexOf','true','catch','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe2ab,0x127));var _0xbe2a=function(_0x30bd36,_0x1b934b){_0x30bd36=_0x30bd36-0x0;var _0x5976b1=_0xe2ab[_0x30bd36];return _0x5976b1;};'use strict';var util=require(_0xbe2a('0x0'));var BPromise=require(_0xbe2a('0x1'));var jayson=require(_0xbe2a('0x2'));var _=require(_0xbe2a('0x3'));var logger=require(_0xbe2a('0x4'))(_0xbe2a('0x5'));var client=jayson['client'][_0xbe2a('0x6')]({'port':0x232a});function request(_0x65d4f0,_0x121e20){return new BPromise(function(_0x5bcb99,_0x48a9d8){return client[_0xbe2a('0x7')](_0x65d4f0,_0x121e20)[_0xbe2a('0x8')](function(_0x2d7bf2){if(_0x2d7bf2[_0xbe2a('0x9')]){return _0x48a9d8(_0x2d7bf2[_0xbe2a('0x9')][_0xbe2a('0xa')]);}else{return _0x5bcb99(_0x2d7bf2[_0xbe2a('0xb')]);}})['catch'](function(_0x251e0a){return _0x48a9d8(_0x251e0a);});});}exports['condition']=function(_0x69d1e2,_0x1f91c4,_0x2509ce){return function(_0xea4374){if(_0x2509ce[_0xbe2a('0xc')]&&!_0x2509ce[_0xbe2a('0xc')][_0x69d1e2]){logger[_0xbe2a('0xd')](_0xbe2a('0xe'),_0x69d1e2);return _0xea4374[_0xbe2a('0xf')]();}var _0x16df36=[];for(var _0x3146de=0x0;_0x3146de<_0x1f91c4[_0xbe2a('0x10')];_0x3146de+=0x1){_0x16df36[_0xbe2a('0x11')](request(_0xbe2a('0x12'),{'command':util[_0xbe2a('0x13')]('iftime\x20%s',_0x1f91c4[_0x3146de])})[_0xbe2a('0x8')](function(_0x3817e8){return _0x3817e8&&_0x3817e8[_0xbe2a('0xa')]&&_0x3817e8[_0xbe2a('0xa')][_0xbe2a('0x14')](_0xbe2a('0x15'))>=0x0?!![]:![];})[_0xbe2a('0x16')](function(_0x235687){logger[_0xbe2a('0x9')](_0xbe2a('0x17'),_0x69d1e2,_0x1f91c4[_0x3146de]);}));}BPromise['all'](_0x16df36)['then'](function(_0xe28c6e){var _0xb074ee=_[_0xbe2a('0x18')](_0xe28c6e);logger[_0xbe2a('0xd')](_0xbe2a('0x19'),_0x69d1e2,_0x1f91c4['join'](_0xbe2a('0x1a')),_0xb074ee);_0xea4374[_0xbe2a('0x1b')](_0xb074ee);})[_0xbe2a('0x16')](function(_0x28ba9c){console[_0xbe2a('0x1c')](_0x28ba9c);logger[_0xbe2a('0x9')](_0xbe2a('0x19'),_0x69d1e2,_0x1f91c4[_0xbe2a('0x1d')](_0xbe2a('0x1a')),_0x28ba9c[_0xbe2a('0x1e')]);_0xea4374[_0xbe2a('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index d80feaf..b9fd595 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 _0x1a2d=['transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','rejected','indexOf','splice','diffTime','agent','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','agentacw','acw','acwtime','CreateVoiceAgentReport','request','uniqueid','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','agentringnoanswer','isNil','timeout','reason','holdtime','ringtime','stack','queuecallerabandon','includes','abandoned','talktime','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentcompleteAt','agentconnectAt','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension'];(function(_0x5253dd,_0x33dba9){var _0x2cb041=function(_0x2cd1a7){while(--_0x2cd1a7){_0x5253dd['push'](_0x5253dd['shift']());}};_0x2cb041(++_0x33dba9);}(_0x1a2d,0xe0));var _0xd1a2=function(_0x14a43e,_0x3a0a3e){_0x14a43e=_0x14a43e-0x0;var _0x586860=_0x1a2d[_0x14a43e];return _0x586860;};'use strict';var _=require('lodash');var util=require(_0xd1a2('0x0'));var utils=require(_0xd1a2('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1c00f2,_0x7ac1ac){utils['info'](util[_0xd1a2('0x2')](_0xd1a2('0x3'),_0x1c00f2['uniqueid'],_0x1c00f2['channel'],_0x1c00f2[_0xd1a2('0x4')],_0x1c00f2[_0xd1a2('0x5')],_0x1c00f2[_0xd1a2('0x6')],_0x1c00f2[_0xd1a2('0x7')],_0x1c00f2[_0xd1a2('0x8')],_0x1c00f2[_0xd1a2('0x9')]));if(_0x1c00f2[_0xd1a2('0x4')]){utils['getVoiceQueueByName'](_0x1c00f2[_0xd1a2('0x4')])[_0xd1a2('0xa')](function(_0x3d2772){if(_0x3d2772){_0x1c00f2[_0xd1a2('0xb')]=_0x3d2772['type'];_0x1c00f2[_0xd1a2('0xc')]=_0x1c00f2['agentcomplete']?_0x3d2772[_0xd1a2('0xd')]:![];_0x1c00f2[_0xd1a2('0xe')]=_0x1c00f2[_0xd1a2('0xc')]?_0x3d2772['acwTimeout']:0x0;}utils['request'](_0xd1a2('0xf'),_0x1c00f2);});}else{utils[_0xd1a2('0x10')](_0xd1a2('0xf'),_0x1c00f2);}if(_0x7ac1ac){delete transfers[_0x1c00f2[_0xd1a2('0x11')]];}else{delete agents[_0x1c00f2[_0xd1a2('0x12')]];}}exports[_0xd1a2('0x13')]=function(_0x50553b){try{agents[_0x50553b['destuniqueid']]=_0x50553b;agents[_0x50553b[_0xd1a2('0x12')]][_0xd1a2('0x14')]=utils[_0xd1a2('0x15')]();agents[_0x50553b[_0xd1a2('0x12')]][_0xd1a2('0x9')]=_0xd1a2('0x16');agents[_0x50553b[_0xd1a2('0x12')]][_0xd1a2('0x8')]=null;agents[_0x50553b[_0xd1a2('0x12')]][_0xd1a2('0x17')]=null;}catch(_0x1c46e1){utils[_0xd1a2('0x18')](_0x1c46e1['stack']);}};exports[_0xd1a2('0x19')]=function(_0x4d5869){try{if(!_[_0xd1a2('0x1a')](agents[_0x4d5869['destuniqueid']])){agents[_0x4d5869[_0xd1a2('0x12')]]['agentringnoanswer']=!![];agents[_0x4d5869[_0xd1a2('0x12')]]['agentringnoanswerAt']=utils['now']();agents[_0x4d5869['destuniqueid']][_0xd1a2('0x9')]=_0xd1a2('0x1b');agents[_0x4d5869[_0xd1a2('0x12')]][_0xd1a2('0x1c')]='timeout';agents[_0x4d5869[_0xd1a2('0x12')]][_0xd1a2('0x1d')]=_0x4d5869['ringtime']?parseInt(_0x4d5869[_0xd1a2('0x1e')])/0x3e8:0x0;agents[_0x4d5869[_0xd1a2('0x12')]]['talktime']=0x0;unanswered['push'](_0x4d5869[_0xd1a2('0x12')]);}}catch(_0x9ef33f){utils[_0xd1a2('0x18')](_0x9ef33f[_0xd1a2('0x1f')]);}};exports[_0xd1a2('0x20')]=function(_0x138a25){try{_['forIn'](agents,function(_0xd69624,_0x22d2ec){if(_0xd69624[_0xd1a2('0x11')]==_0x138a25['uniqueid']&&!_[_0xd1a2('0x21')](unanswered,_0xd69624[_0xd1a2('0x12')])){_0xd69624[_0xd1a2('0x19')]=!![];_0xd69624['agentringnoanswerAt']=utils['now']();_0xd69624[_0xd1a2('0x9')]=_0xd1a2('0x22');_0xd69624['reason']=_0xd1a2('0x22');_0xd69624[_0xd1a2('0x1d')]=_0x138a25[_0xd1a2('0x1d')];_0xd69624[_0xd1a2('0x23')]=0x0;writeDB(_0xd69624);}});}catch(_0x16c968){utils[_0xd1a2('0x18')](_0x16c968[_0xd1a2('0x1f')]);}};exports['agentconnect']=function(_0x5a7969){try{if(agents[_0x5a7969['destuniqueid']]){agents[_0x5a7969[_0xd1a2('0x12')]]['agentconnectAt']=utils['now']();agents[_0x5a7969[_0xd1a2('0x12')]][_0xd1a2('0x8')]=_0x5a7969[_0xd1a2('0x8')];agents[_0x5a7969[_0xd1a2('0x12')]][_0xd1a2('0x17')]=_0x5a7969['connectedlinename'];agents[_0x5a7969[_0xd1a2('0x12')]][_0xd1a2('0x1d')]=_0x5a7969[_0xd1a2('0x1e')];agents[_0x5a7969['destuniqueid']][_0xd1a2('0x9')]=_0xd1a2('0x24');_[_0xd1a2('0x25')](agents,function(_0x40662a,_0x35e7a2){if(_0x40662a[_0xd1a2('0x12')]!=_0x5a7969['destuniqueid']&&_0x40662a['uniqueid']==_0x5a7969[_0xd1a2('0x11')]){_0x40662a['talktime']=0x0;_0x40662a[_0xd1a2('0x1d')]=_0x5a7969[_0xd1a2('0x1e')];_0x40662a[_0xd1a2('0x19')]=!![];_0x40662a['agentringnoanswerAt']=utils[_0xd1a2('0x15')]();_0x40662a[_0xd1a2('0x9')]=_0xd1a2('0x26');_0x40662a[_0xd1a2('0x1c')]=_0xd1a2('0x26');_0x40662a[_0xd1a2('0x27')]=_0x5a7969[_0xd1a2('0x12')];_0x40662a[_0xd1a2('0x28')]=_0x5a7969['membername'];writeDB(_0x40662a);}});}}catch(_0x43c395){utils[_0xd1a2('0x18')](_0x43c395[_0xd1a2('0x1f')]);}};exports['agentcomplete']=function(_0x2a682e){try{if(!_[_0xd1a2('0x1a')](agents[_0x2a682e['destuniqueid']])){agents[_0x2a682e['destuniqueid']][_0xd1a2('0x29')]=!![];agents[_0x2a682e[_0xd1a2('0x12')]][_0xd1a2('0x2a')]=utils['now']();agents[_0x2a682e[_0xd1a2('0x12')]][_0xd1a2('0x23')]=utils['diffTime'](agents[_0x2a682e[_0xd1a2('0x12')]][_0xd1a2('0x2a')],agents[_0x2a682e[_0xd1a2('0x12')]][_0xd1a2('0x2b')]);agents[_0x2a682e[_0xd1a2('0x12')]][_0xd1a2('0x1c')]=_0x2a682e['reason'];agents[_0x2a682e['destuniqueid']][_0xd1a2('0x9')]=_0xd1a2('0x2c');writeDB(agents[_0x2a682e[_0xd1a2('0x12')]]);}}catch(_0x90754a){utils['error'](_0x90754a[_0xd1a2('0x1f')]);}};exports[_0xd1a2('0x2d')]=function(_0x3e0ac5){try{if(!_[_0xd1a2('0x1a')](agents[_0x3e0ac5[_0xd1a2('0x2e')]])){agents[_0x3e0ac5[_0xd1a2('0x2e')]][_0xd1a2('0x2f')]=!![];agents[_0x3e0ac5[_0xd1a2('0x2e')]][_0xd1a2('0x30')]=_0xd1a2('0x31');agents[_0x3e0ac5[_0xd1a2('0x2e')]][_0xd1a2('0x32')]=_0x3e0ac5[_0xd1a2('0x33')];agents[_0x3e0ac5[_0xd1a2('0x2e')]][_0xd1a2('0x34')]=agents[_0x3e0ac5['transfereruniqueid']][_0xd1a2('0x11')];}}catch(_0x232a13){utils[_0xd1a2('0x18')](_0x232a13[_0xd1a2('0x1f')]);}};exports['attendedtransfer']=function(_0x3bc568){try{if(_0x3bc568[_0xd1a2('0x35')]==_0x3bc568[_0xd1a2('0x36')]){if(!_[_0xd1a2('0x1a')](agents[_0x3bc568['secondtransfereruniqueid']])){agents[_0x3bc568[_0xd1a2('0x37')]][_0xd1a2('0x2f')]=!![];agents[_0x3bc568['secondtransfereruniqueid']][_0xd1a2('0x30')]=_0xd1a2('0x38');agents[_0x3bc568[_0xd1a2('0x37')]]['transferexten']=_0x3bc568[_0xd1a2('0x39')];agents[_0x3bc568[_0xd1a2('0x37')]]['transferuniqueid']=_0x3bc568[_0xd1a2('0x35')];}if(_0x3bc568['transfereeuniqueid']&&agents[_0x3bc568[_0xd1a2('0x3a')]]){agents[_0x3bc568[_0xd1a2('0x3a')]][_0xd1a2('0x3b')]=0x1;transfers[_0x3bc568[_0xd1a2('0x3a')]]=_[_0xd1a2('0x3c')](agents[_0x3bc568[_0xd1a2('0x3a')]]);transfers[_0x3bc568[_0xd1a2('0x3a')]]['calleridnum']=agents[_0x3bc568[_0xd1a2('0x37')]][_0xd1a2('0x7')];transfers[_0x3bc568[_0xd1a2('0x3a')]][_0xd1a2('0x3d')]=agents[_0x3bc568[_0xd1a2('0x37')]]['calleridname'];transfers[_0x3bc568[_0xd1a2('0x3a')]][_0xd1a2('0x14')]=utils['now']();transfers[_0x3bc568[_0xd1a2('0x3a')]][_0xd1a2('0x2b')]=utils[_0xd1a2('0x15')]();transfers[_0x3bc568[_0xd1a2('0x3a')]][_0xd1a2('0x1d')]=0x0;transfers[_0x3bc568[_0xd1a2('0x3a')]][_0xd1a2('0x3b')]=0x2;}}else if(_0x3bc568[_0xd1a2('0x37')]==_0x3bc568['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x3bc568[_0xd1a2('0x35')]])){agents[_0x3bc568[_0xd1a2('0x35')]][_0xd1a2('0x2f')]=!![];agents[_0x3bc568[_0xd1a2('0x35')]][_0xd1a2('0x30')]=_0xd1a2('0x38');agents[_0x3bc568['origtransfereruniqueid']]['transferexten']=_0x3bc568[_0xd1a2('0x3e')];agents[_0x3bc568[_0xd1a2('0x35')]][_0xd1a2('0x34')]=_0x3bc568[_0xd1a2('0x37')];}if(_0x3bc568['transfertargetuniqueid']&&agents[_0x3bc568[_0xd1a2('0x3f')]]){agents[_0x3bc568[_0xd1a2('0x3f')]][_0xd1a2('0x3b')]=0x1;transfers[_0x3bc568[_0xd1a2('0x3f')]]=_[_0xd1a2('0x3c')](agents[_0x3bc568[_0xd1a2('0x3f')]]);transfers[_0x3bc568[_0xd1a2('0x3f')]][_0xd1a2('0x7')]=agents[_0x3bc568['origtransfereruniqueid']][_0xd1a2('0x7')];transfers[_0x3bc568[_0xd1a2('0x3f')]][_0xd1a2('0x3d')]=agents[_0x3bc568[_0xd1a2('0x35')]][_0xd1a2('0x3d')];transfers[_0x3bc568['transfertargetuniqueid']]['agentcalledAt']=utils[_0xd1a2('0x15')]();transfers[_0x3bc568[_0xd1a2('0x3f')]]['agentconnectAt']=utils[_0xd1a2('0x15')]();transfers[_0x3bc568['transfertargetuniqueid']][_0xd1a2('0x1d')]=0x0;transfers[_0x3bc568['transfertargetuniqueid']][_0xd1a2('0x3b')]=0x2;}}}catch(_0x4f1613){utils[_0xd1a2('0x18')](_0x4f1613[_0xd1a2('0x1f')]);}};exports['hangup']=function(_0xfb4bad){try{if(agents[_0xfb4bad['uniqueid']]&&agents[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x1c')]===_0xd1a2('0x1b')){if(_0xfb4bad['cause']==='21'){agents[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x1c')]='rejected';agents[_0xfb4bad['uniqueid']]['lastevent']=_0xd1a2('0x40');}writeDB(agents[_0xfb4bad[_0xd1a2('0x11')]]);var _0x5f1366=unanswered[_0xd1a2('0x41')](_0xfb4bad['uniqueid']);if(_0x5f1366>-0x1)unanswered[_0xd1a2('0x42')](_0x5f1366,0x1);}if(transfers[_0xfb4bad[_0xd1a2('0x11')]]){transfers[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x29')]=!![];transfers[_0xfb4bad['uniqueid']][_0xd1a2('0x2a')]=utils[_0xd1a2('0x15')]();transfers[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x23')]=utils[_0xd1a2('0x43')](transfers[_0xfb4bad[_0xd1a2('0x11')]]['agentcompleteAt'],transfers[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x2b')]);transfers[_0xfb4bad[_0xd1a2('0x11')]]['reason']='agent';transfers[_0xfb4bad['uniqueid']][_0xd1a2('0x9')]=_0xd1a2('0x2c');writeDB(transfers[_0xfb4bad[_0xd1a2('0x11')]],!![]);}if(agents[_0xfb4bad[_0xd1a2('0x11')]]&&agents[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x2b')]){agents[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x29')]=!![];agents[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x2a')]=utils[_0xd1a2('0x15')]();agents[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x23')]=utils[_0xd1a2('0x43')](agents[_0xfb4bad['uniqueid']][_0xd1a2('0x2a')],agents[_0xfb4bad['uniqueid']][_0xd1a2('0x2b')]);agents[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x1c')]=agents[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x2f')]?_0xd1a2('0x2f'):_0xd1a2('0x44');agents[_0xfb4bad[_0xd1a2('0x11')]][_0xd1a2('0x9')]=_0xd1a2('0x2c');writeDB(agents[_0xfb4bad[_0xd1a2('0x11')]]);}}catch(_0x429f4f){utils[_0xd1a2('0x18')](_0x429f4f[_0xd1a2('0x1f')]);}}; \ No newline at end of file +var _0xb5d1=['agentcalled','agentcalledAt','now','called','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','error','forIn','includes','abandoned','holdtime','agentconnect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','complete','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','splice','diffTime','agent','util','./utils','format','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','uniqueid','destuniqueid'];(function(_0x51e91e,_0x3554aa){var _0x12c6a1=function(_0xe0e608){while(--_0xe0e608){_0x51e91e['push'](_0x51e91e['shift']());}};_0x12c6a1(++_0x3554aa);}(_0xb5d1,0x147));var _0x1b5d=function(_0x498b38,_0x2d9583){_0x498b38=_0x498b38-0x0;var _0x10feb7=_0xb5d1[_0x498b38];return _0x10feb7;};'use strict';var _=require('lodash');var util=require(_0x1b5d('0x0'));var utils=require(_0x1b5d('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x172d5f,_0x4ba3c3){utils['info'](util[_0x1b5d('0x2')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x172d5f['uniqueid'],_0x172d5f[_0x1b5d('0x3')],_0x172d5f[_0x1b5d('0x4')],_0x172d5f[_0x1b5d('0x5')],_0x172d5f['interface'],_0x172d5f['calleridnum'],_0x172d5f[_0x1b5d('0x6')],_0x172d5f[_0x1b5d('0x7')]));if(_0x172d5f[_0x1b5d('0x4')]){utils[_0x1b5d('0x8')](_0x172d5f['queue'])['then'](function(_0x5eda61){if(_0x5eda61){_0x172d5f['type']=_0x5eda61[_0x1b5d('0x9')];_0x172d5f[_0x1b5d('0xa')]=_0x172d5f[_0x1b5d('0xb')]?_0x5eda61[_0x1b5d('0xc')]:![];_0x172d5f[_0x1b5d('0xd')]=_0x172d5f[_0x1b5d('0xa')]?_0x5eda61['acwTimeout']:0x0;}utils[_0x1b5d('0xe')](_0x1b5d('0xf'),_0x172d5f);});}else{utils[_0x1b5d('0xe')](_0x1b5d('0xf'),_0x172d5f);}if(_0x4ba3c3){delete transfers[_0x172d5f[_0x1b5d('0x10')]];}else{delete agents[_0x172d5f[_0x1b5d('0x11')]];}}exports[_0x1b5d('0x12')]=function(_0x25f320){try{agents[_0x25f320[_0x1b5d('0x11')]]=_0x25f320;agents[_0x25f320['destuniqueid']][_0x1b5d('0x13')]=utils[_0x1b5d('0x14')]();agents[_0x25f320[_0x1b5d('0x11')]][_0x1b5d('0x7')]=_0x1b5d('0x15');agents[_0x25f320[_0x1b5d('0x11')]][_0x1b5d('0x6')]=null;agents[_0x25f320[_0x1b5d('0x11')]]['connectedlinename']=null;}catch(_0x5a0b0e){utils['error'](_0x5a0b0e[_0x1b5d('0x16')]);}};exports[_0x1b5d('0x17')]=function(_0x30c3db){try{if(!_[_0x1b5d('0x18')](agents[_0x30c3db[_0x1b5d('0x11')]])){agents[_0x30c3db[_0x1b5d('0x11')]][_0x1b5d('0x17')]=!![];agents[_0x30c3db[_0x1b5d('0x11')]][_0x1b5d('0x19')]=utils['now']();agents[_0x30c3db['destuniqueid']][_0x1b5d('0x7')]=_0x1b5d('0x1a');agents[_0x30c3db['destuniqueid']][_0x1b5d('0x1b')]=_0x1b5d('0x1a');agents[_0x30c3db['destuniqueid']]['holdtime']=_0x30c3db[_0x1b5d('0x1c')]?parseInt(_0x30c3db[_0x1b5d('0x1c')])/0x3e8:0x0;agents[_0x30c3db['destuniqueid']][_0x1b5d('0x1d')]=0x0;unanswered[_0x1b5d('0x1e')](_0x30c3db[_0x1b5d('0x11')]);}}catch(_0x2c717f){utils[_0x1b5d('0x1f')](_0x2c717f[_0x1b5d('0x16')]);}};exports['queuecallerabandon']=function(_0x128ec8){try{_[_0x1b5d('0x20')](agents,function(_0x150399,_0x2fc5b5){if(_0x150399[_0x1b5d('0x10')]==_0x128ec8[_0x1b5d('0x10')]&&!_[_0x1b5d('0x21')](unanswered,_0x150399[_0x1b5d('0x11')])){_0x150399[_0x1b5d('0x17')]=!![];_0x150399['agentringnoanswerAt']=utils[_0x1b5d('0x14')]();_0x150399[_0x1b5d('0x7')]=_0x1b5d('0x22');_0x150399[_0x1b5d('0x1b')]=_0x1b5d('0x22');_0x150399[_0x1b5d('0x23')]=_0x128ec8[_0x1b5d('0x23')];_0x150399[_0x1b5d('0x1d')]=0x0;writeDB(_0x150399);}});}catch(_0x5bf231){utils['error'](_0x5bf231['stack']);}};exports[_0x1b5d('0x24')]=function(_0x30a15e){try{if(agents[_0x30a15e[_0x1b5d('0x11')]]){agents[_0x30a15e[_0x1b5d('0x11')]][_0x1b5d('0x25')]=utils[_0x1b5d('0x14')]();agents[_0x30a15e[_0x1b5d('0x11')]][_0x1b5d('0x6')]=_0x30a15e['connectedlinenum'];agents[_0x30a15e[_0x1b5d('0x11')]][_0x1b5d('0x26')]=_0x30a15e[_0x1b5d('0x26')];agents[_0x30a15e[_0x1b5d('0x11')]][_0x1b5d('0x23')]=_0x30a15e['ringtime'];agents[_0x30a15e[_0x1b5d('0x11')]]['lastevent']='connect';_[_0x1b5d('0x20')](agents,function(_0x7dcfb1,_0x4dc9c0){if(_0x7dcfb1[_0x1b5d('0x11')]!=_0x30a15e['destuniqueid']&&_0x7dcfb1[_0x1b5d('0x10')]==_0x30a15e['uniqueid']){_0x7dcfb1['talktime']=0x0;_0x7dcfb1[_0x1b5d('0x23')]=_0x30a15e[_0x1b5d('0x1c')];_0x7dcfb1[_0x1b5d('0x17')]=!![];_0x7dcfb1['agentringnoanswerAt']=utils[_0x1b5d('0x14')]();_0x7dcfb1['lastevent']=_0x1b5d('0x27');_0x7dcfb1['reason']=_0x1b5d('0x27');_0x7dcfb1['answeredelsewheredestinationuniqueid']=_0x30a15e[_0x1b5d('0x11')];_0x7dcfb1[_0x1b5d('0x28')]=_0x30a15e[_0x1b5d('0x5')];writeDB(_0x7dcfb1);}});}}catch(_0x1a6891){utils[_0x1b5d('0x1f')](_0x1a6891[_0x1b5d('0x16')]);}};exports[_0x1b5d('0xb')]=function(_0x3c328b){try{if(!_[_0x1b5d('0x18')](agents[_0x3c328b[_0x1b5d('0x11')]])){agents[_0x3c328b[_0x1b5d('0x11')]][_0x1b5d('0xb')]=!![];agents[_0x3c328b[_0x1b5d('0x11')]][_0x1b5d('0x29')]=utils[_0x1b5d('0x14')]();agents[_0x3c328b[_0x1b5d('0x11')]][_0x1b5d('0x1d')]=utils['diffTime'](agents[_0x3c328b[_0x1b5d('0x11')]][_0x1b5d('0x29')],agents[_0x3c328b[_0x1b5d('0x11')]][_0x1b5d('0x25')]);agents[_0x3c328b[_0x1b5d('0x11')]][_0x1b5d('0x1b')]=_0x3c328b[_0x1b5d('0x1b')];agents[_0x3c328b[_0x1b5d('0x11')]][_0x1b5d('0x7')]=_0x1b5d('0x2a');writeDB(agents[_0x3c328b['destuniqueid']]);}}catch(_0x458a41){utils[_0x1b5d('0x1f')](_0x458a41[_0x1b5d('0x16')]);}};exports['blindtransfer']=function(_0x29e0ad){try{if(!_[_0x1b5d('0x18')](agents[_0x29e0ad[_0x1b5d('0x2b')]])){agents[_0x29e0ad['transfereruniqueid']][_0x1b5d('0x2c')]=!![];agents[_0x29e0ad[_0x1b5d('0x2b')]][_0x1b5d('0x2d')]=_0x1b5d('0x2e');agents[_0x29e0ad['transfereruniqueid']][_0x1b5d('0x2f')]=_0x29e0ad['extension'];agents[_0x29e0ad[_0x1b5d('0x2b')]][_0x1b5d('0x30')]=agents[_0x29e0ad[_0x1b5d('0x2b')]][_0x1b5d('0x10')];}}catch(_0x570414){utils[_0x1b5d('0x1f')](_0x570414[_0x1b5d('0x16')]);}};exports[_0x1b5d('0x31')]=function(_0x351634){try{if(_0x351634[_0x1b5d('0x32')]==_0x351634[_0x1b5d('0x33')]){if(!_[_0x1b5d('0x18')](agents[_0x351634[_0x1b5d('0x34')]])){agents[_0x351634[_0x1b5d('0x34')]][_0x1b5d('0x2c')]=!![];agents[_0x351634['secondtransfereruniqueid']][_0x1b5d('0x2d')]=_0x1b5d('0x35');agents[_0x351634[_0x1b5d('0x34')]][_0x1b5d('0x2f')]=_0x351634[_0x1b5d('0x36')];agents[_0x351634[_0x1b5d('0x34')]]['transferuniqueid']=_0x351634[_0x1b5d('0x32')];}if(_0x351634['transfereeuniqueid']&&agents[_0x351634['transfereeuniqueid']]){agents[_0x351634[_0x1b5d('0x37')]][_0x1b5d('0x38')]=0x1;transfers[_0x351634['transfereeuniqueid']]=_[_0x1b5d('0x39')](agents[_0x351634[_0x1b5d('0x37')]]);transfers[_0x351634[_0x1b5d('0x37')]]['calleridnum']=agents[_0x351634[_0x1b5d('0x34')]][_0x1b5d('0x3a')];transfers[_0x351634['transfereeuniqueid']][_0x1b5d('0x3b')]=agents[_0x351634[_0x1b5d('0x34')]]['calleridname'];transfers[_0x351634[_0x1b5d('0x37')]][_0x1b5d('0x13')]=utils['now']();transfers[_0x351634['transfereeuniqueid']][_0x1b5d('0x25')]=utils[_0x1b5d('0x14')]();transfers[_0x351634[_0x1b5d('0x37')]][_0x1b5d('0x23')]=0x0;transfers[_0x351634[_0x1b5d('0x37')]]['agententerreason']=0x2;}}else if(_0x351634[_0x1b5d('0x34')]==_0x351634['secondtransfererlinkedid']){if(!_[_0x1b5d('0x18')](agents[_0x351634['origtransfereruniqueid']])){agents[_0x351634[_0x1b5d('0x32')]]['transfer']=!![];agents[_0x351634['origtransfereruniqueid']][_0x1b5d('0x2d')]=_0x1b5d('0x35');agents[_0x351634[_0x1b5d('0x32')]][_0x1b5d('0x2f')]=_0x351634[_0x1b5d('0x3c')];agents[_0x351634['origtransfereruniqueid']][_0x1b5d('0x30')]=_0x351634[_0x1b5d('0x34')];}if(_0x351634[_0x1b5d('0x3d')]&&agents[_0x351634[_0x1b5d('0x3d')]]){agents[_0x351634[_0x1b5d('0x3d')]][_0x1b5d('0x38')]=0x1;transfers[_0x351634[_0x1b5d('0x3d')]]=_['clone'](agents[_0x351634[_0x1b5d('0x3d')]]);transfers[_0x351634[_0x1b5d('0x3d')]][_0x1b5d('0x3a')]=agents[_0x351634[_0x1b5d('0x32')]][_0x1b5d('0x3a')];transfers[_0x351634['transfertargetuniqueid']][_0x1b5d('0x3b')]=agents[_0x351634[_0x1b5d('0x32')]][_0x1b5d('0x3b')];transfers[_0x351634[_0x1b5d('0x3d')]]['agentcalledAt']=utils[_0x1b5d('0x14')]();transfers[_0x351634[_0x1b5d('0x3d')]]['agentconnectAt']=utils[_0x1b5d('0x14')]();transfers[_0x351634[_0x1b5d('0x3d')]][_0x1b5d('0x23')]=0x0;transfers[_0x351634['transfertargetuniqueid']][_0x1b5d('0x38')]=0x2;}}}catch(_0x24fd31){utils[_0x1b5d('0x1f')](_0x24fd31[_0x1b5d('0x16')]);}};exports[_0x1b5d('0x3e')]=function(_0x3c0d26){try{if(agents[_0x3c0d26[_0x1b5d('0x10')]]&&agents[_0x3c0d26['uniqueid']][_0x1b5d('0x1b')]===_0x1b5d('0x1a')){if(_0x3c0d26[_0x1b5d('0x3f')]==='21'){agents[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0x1b')]=_0x1b5d('0x40');agents[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0x7')]='rejected';}writeDB(agents[_0x3c0d26[_0x1b5d('0x10')]]);var _0x2a07a9=unanswered[_0x1b5d('0x41')](_0x3c0d26[_0x1b5d('0x10')]);if(_0x2a07a9>-0x1)unanswered[_0x1b5d('0x42')](_0x2a07a9,0x1);}if(transfers[_0x3c0d26[_0x1b5d('0x10')]]){transfers[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0xb')]=!![];transfers[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0x29')]=utils[_0x1b5d('0x14')]();transfers[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0x1d')]=utils[_0x1b5d('0x43')](transfers[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0x29')],transfers[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0x25')]);transfers[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0x1b')]=_0x1b5d('0x44');transfers[_0x3c0d26['uniqueid']][_0x1b5d('0x7')]=_0x1b5d('0x2a');writeDB(transfers[_0x3c0d26[_0x1b5d('0x10')]],!![]);}if(agents[_0x3c0d26[_0x1b5d('0x10')]]&&agents[_0x3c0d26['uniqueid']]['agentconnectAt']){agents[_0x3c0d26[_0x1b5d('0x10')]]['agentcomplete']=!![];agents[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0x29')]=utils['now']();agents[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0x1d')]=utils[_0x1b5d('0x43')](agents[_0x3c0d26[_0x1b5d('0x10')]]['agentcompleteAt'],agents[_0x3c0d26[_0x1b5d('0x10')]][_0x1b5d('0x25')]);agents[_0x3c0d26[_0x1b5d('0x10')]]['reason']=agents[_0x3c0d26[_0x1b5d('0x10')]]['transfer']?_0x1b5d('0x2c'):_0x1b5d('0x44');agents[_0x3c0d26[_0x1b5d('0x10')]]['lastevent']=_0x1b5d('0x2a');writeDB(agents[_0x3c0d26['uniqueid']]);}}catch(_0x147ad8){utils[_0x1b5d('0x1f')](_0x147ad8[_0x1b5d('0x16')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3f4c1c3..c00d289 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 _0x9a72=['xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','set','startsWith','toLowerCase','cdr','appdata','split','substring','lastIndexOf','includes','noop','execif','gotoif','util','./utils','NO\x20ANSWER','ANSWERED','FAILED','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','source','destination','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','linkedid','OutgoingSpoolFailed','exten','context','now','DOCUMENTATION','newstate','isNil','systemanswertime','channelstate','transfer','accountcode','answertime','toNumber','error','stack','hangup','callerid','calleridnum','diffTime','endtime','attendedtransfer','localtwolinkedid','transfereechannel','destinationchannel','secondtransfererchannel','userfield','origtransfererchannel','_attended','musiconholdstart','musiconholdstop','musiconholdstartAt','varset','xmd-originatecalleridnum','value','variable','xmd-phone','xmd-callerid-preview','xmd-callerid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a72,0x10c));var _0x29a7=function(_0x398c06,_0x1e56bb){_0x398c06=_0x398c06-0x0;var _0x463ed2=_0x9a72[_0x398c06];return _0x463ed2;};'use strict';var _=require('lodash');var util=require(_0x29a7('0x0'));var utils=require(_0x29a7('0x1'));var dispositions=[_0x29a7('0x2'),'FAILED','FAILED',_0x29a7('0x2'),_0x29a7('0x2'),_0x29a7('0x2'),_0x29a7('0x3'),'BUSY',_0x29a7('0x4'),_0x29a7('0x4'),_0x29a7('0x4')];var channels={};function writeDB(_0x691456){utils['info'](util['format'](_0x29a7('0x5'),_0x691456[_0x29a7('0x6')],_0x691456[_0x29a7('0x7')],_0x691456[_0x29a7('0x8')],_0x691456['accountcode'],_0x691456[_0x29a7('0x9')],_0x691456[_0x29a7('0xa')],_0x691456['callerid'],_0x691456[_0x29a7('0xb')]));if(_0x691456['accountcode']){utils[_0x29a7('0xc')](_0x691456['accountcode'])[_0x29a7('0xd')](function(_0x52a041){if(_0x52a041){_0x691456[_0x29a7('0xe')]=_0x52a041['id'];}utils[_0x29a7('0xf')](_0x29a7('0x10'),_0x691456);});}else{utils[_0x29a7('0xf')](_0x29a7('0x10'),_0x691456);}if(channels[_0x691456[_0x29a7('0x6')]]){delete channels[_0x691456[_0x29a7('0x6')]];}}exports['newchannel']=function(_0xeb6846){try{if(_0xeb6846[_0x29a7('0x6')]==_0xeb6846[_0x29a7('0x11')]&&_0xeb6846['channel']!=_0x29a7('0x12')){channels[_0xeb6846[_0x29a7('0x6')]]={'uniqueid':_0xeb6846[_0x29a7('0x6')],'accountcode':_0xeb6846['accountcode'],'source':_0xeb6846['calleridnum'],'destination':_0xeb6846[_0x29a7('0x13')],'destinationcontext':_0xeb6846[_0x29a7('0x14')],'channel':_0xeb6846[_0x29a7('0x7')],'starttime':utils[_0x29a7('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x29a7('0x2'),'amaflags':_0x29a7('0x16')};}}catch(_0x3a1ddf){utils['error'](_0x3a1ddf['stack']);}};exports[_0x29a7('0x17')]=function(_0x1f22b8){try{if(!_[_0x29a7('0x18')](channels[_0x1f22b8[_0x29a7('0x6')]])&&_0x1f22b8['channelstate']==0x6){if(_[_0x29a7('0x18')](channels[_0x1f22b8[_0x29a7('0x6')]]['systemanswertime'])){channels[_0x1f22b8[_0x29a7('0x6')]][_0x29a7('0x19')]=utils[_0x29a7('0x15')]();}}else if(!_[_0x29a7('0x18')](channels[_0x1f22b8[_0x29a7('0x11')]])&&_0x1f22b8[_0x29a7('0x1a')]==0x6&&_0x1f22b8[_0x29a7('0x14')]!=_0x29a7('0x1b')){channels[_0x1f22b8[_0x29a7('0x11')]][_0x29a7('0x1c')]=_0x1f22b8[_0x29a7('0x1c')];channels[_0x1f22b8[_0x29a7('0x11')]]['destinationchannel']=_0x1f22b8['channel'];if(_[_0x29a7('0x18')](channels[_0x1f22b8[_0x29a7('0x11')]][_0x29a7('0x1d')])){channels[_0x1f22b8[_0x29a7('0x11')]][_0x29a7('0x1d')]=utils[_0x29a7('0x15')]();}channels[_0x1f22b8[_0x29a7('0x11')]][_0x29a7('0xb')]=dispositions[_[_0x29a7('0x1e')](_0x1f22b8['channelstate'])]||_0x29a7('0x3');}}catch(_0x337b80){utils[_0x29a7('0x1f')](_0x337b80[_0x29a7('0x20')]);}};exports[_0x29a7('0x21')]=function(_0x42ac64){try{if(!_[_0x29a7('0x18')](channels[_0x42ac64[_0x29a7('0x6')]])){if(_['isNil'](channels[_0x42ac64[_0x29a7('0x6')]][_0x29a7('0x22')])){channels[_0x42ac64[_0x29a7('0x6')]][_0x29a7('0x22')]=_0x42ac64['calleridname']+'\x20<'+_0x42ac64[_0x29a7('0x23')]+'>';}channels[_0x42ac64[_0x29a7('0x6')]]['endtime']=utils[_0x29a7('0x15')]();channels[_0x42ac64[_0x29a7('0x6')]]['duration']=utils[_0x29a7('0x24')](channels[_0x42ac64[_0x29a7('0x6')]][_0x29a7('0x25')],channels[_0x42ac64[_0x29a7('0x6')]]['starttime']);channels[_0x42ac64[_0x29a7('0x6')]]['billableseconds']=channels[_0x42ac64[_0x29a7('0x6')]][_0x29a7('0x1d')]?utils[_0x29a7('0x24')](channels[_0x42ac64[_0x29a7('0x6')]][_0x29a7('0x25')],channels[_0x42ac64[_0x29a7('0x6')]][_0x29a7('0x1d')]):0x0;writeDB(channels[_0x42ac64[_0x29a7('0x6')]]);}}catch(_0x5ab9b2){utils[_0x29a7('0x1f')](_0x5ab9b2[_0x29a7('0x20')]);}};exports[_0x29a7('0x26')]=function(_0x3fc621){try{if(!_[_0x29a7('0x18')](channels[_0x3fc621[_0x29a7('0x27')]])){if(channels[_0x3fc621[_0x29a7('0x27')]][_0x29a7('0x7')]==_0x3fc621[_0x29a7('0x28')]){channels[_0x3fc621[_0x29a7('0x27')]][_0x29a7('0x29')]=_0x3fc621[_0x29a7('0x2a')];channels[_0x3fc621[_0x29a7('0x27')]][_0x29a7('0x2b')]='_attended';}else if(channels[_0x3fc621[_0x29a7('0x27')]][_0x29a7('0x7')]=_0x3fc621['transfertargetchannel']){channels[_0x3fc621['localtwolinkedid']][_0x29a7('0x29')]=_0x3fc621[_0x29a7('0x2c')];channels[_0x3fc621[_0x29a7('0x27')]][_0x29a7('0x2b')]=_0x29a7('0x2d');}}}catch(_0x1f978a){utils[_0x29a7('0x1f')](_0x1f978a['stack']);}};exports[_0x29a7('0x2e')]=function(_0x2a85eb){try{if(!_[_0x29a7('0x18')](channels[_0x2a85eb[_0x29a7('0x6')]])){channels[_0x2a85eb[_0x29a7('0x6')]]['musiconholdstartAt']=utils[_0x29a7('0x15')]();}}catch(_0x528caa){utils['error'](_0x528caa[_0x29a7('0x20')]);}};exports[_0x29a7('0x2f')]=function(_0x8339b6){try{if(!_['isNil'](channels[_0x8339b6[_0x29a7('0x6')]])){if(!_[_0x29a7('0x18')](channels[_0x8339b6[_0x29a7('0x6')]][_0x29a7('0x30')])){channels[_0x8339b6[_0x29a7('0x6')]]['mohtime']+=utils['diffTime'](utils[_0x29a7('0x15')](),channels[_0x8339b6['uniqueid']][_0x29a7('0x30')]);delete channels[_0x8339b6['uniqueid']][_0x29a7('0x30')];}}}catch(_0x1c6d52){utils[_0x29a7('0x1f')](_0x1c6d52[_0x29a7('0x20')]);}};exports[_0x29a7('0x31')]=function(_0x5a3562){try{if(!_[_0x29a7('0x18')](channels[_0x5a3562['uniqueid']])){if(!_['isNil'](_0x5a3562['variable'][_0x29a7('0x32')])){channels[_0x5a3562[_0x29a7('0x6')]][_0x29a7('0x9')]=_0x5a3562[_0x29a7('0x33')];}if(!_[_0x29a7('0x18')](_0x5a3562[_0x29a7('0x34')][_0x29a7('0x35')])){channels[_0x5a3562['uniqueid']][_0x29a7('0xa')]=_0x5a3562['value'];channels[_0x5a3562[_0x29a7('0x6')]][_0x29a7('0x22')]='\x22'+_0x5a3562[_0x29a7('0x33')]+'\x22\x20<'+_0x5a3562[_0x29a7('0x33')]+'>';}if(!_[_0x29a7('0x18')](_0x5a3562[_0x29a7('0x34')][_0x29a7('0x36')])||!_[_0x29a7('0x18')](_0x5a3562['variable'][_0x29a7('0x37')])){channels[_0x5a3562[_0x29a7('0x6')]]['callerid']=_0x5a3562[_0x29a7('0x33')];}if(!_[_0x29a7('0x18')](_0x5a3562[_0x29a7('0x34')][_0x29a7('0x38')])||!_[_0x29a7('0x18')](_0x5a3562[_0x29a7('0x34')][_0x29a7('0x39')])){channels[_0x5a3562[_0x29a7('0x6')]][_0x29a7('0x3a')]=_0x29a7('0x3b');channels[_0x5a3562['uniqueid']][_0x29a7('0x3c')]=_0x5a3562[_0x29a7('0x33')];channels[_0x5a3562['uniqueid']][_0x29a7('0x3d')]=!![];}if(!_[_0x29a7('0x18')](_0x5a3562['variable']['xmd-contactid'])){channels[_0x5a3562[_0x29a7('0x6')]][_0x29a7('0x3e')]=_0x5a3562[_0x29a7('0x33')];}if(!_['isNil'](_0x5a3562[_0x29a7('0x34')][_0x29a7('0x3f')])){channels[_0x5a3562[_0x29a7('0x6')]]['type']=_0x5a3562[_0x29a7('0x33')];}if(!_['isNil'](_0x5a3562['variable'][_0x29a7('0x40')])){channels[_0x5a3562['uniqueid']][_0x29a7('0x41')]=_0x5a3562[_0x29a7('0x33')];}if(!_[_0x29a7('0x18')](_0x5a3562[_0x29a7('0x34')][_0x29a7('0x42')])){channels[_0x5a3562[_0x29a7('0x6')]][_0x29a7('0x42')]=_0x5a3562[_0x29a7('0x33')];}}}catch(_0x2112f8){utils[_0x29a7('0x1f')](_0x2112f8['stack']);}};exports[_0x29a7('0x43')]=function(_0x5bd567){try{if(!_[_0x29a7('0x18')](channels[_0x5bd567[_0x29a7('0x6')]])){if(_0x5bd567[_0x29a7('0x44')]['toLowerCase']()==_0x29a7('0x45')&&_[_0x29a7('0x46')](_0x5bd567['appdata'][_0x29a7('0x47')](),_0x29a7('0x48'))){var _0x23918d=_0x5bd567[_0x29a7('0x49')][_0x29a7('0x4a')]('=');var _0x333910=_0x23918d[0x0][_0x29a7('0x4b')](_0x23918d[0x0][_0x29a7('0x4c')]('(')+0x1,_0x23918d[0x0][_0x29a7('0x4c')](')'));var _0x1d3e55=_0x23918d[0x1];channels[_0x5bd567['uniqueid']][_0x333910]=_0x1d3e55;}if(!_[_0x29a7('0x4d')]([_0x29a7('0x21'),_0x29a7('0x4e'),_0x29a7('0x4f'),'set',_0x29a7('0x50')],_0x5bd567[_0x29a7('0x44')]['toLowerCase']())){channels[_0x5bd567[_0x29a7('0x6')]][_0x29a7('0x3a')]=_0x5bd567[_0x29a7('0x44')];channels[_0x5bd567['uniqueid']][_0x29a7('0x3c')]=_0x5bd567[_0x29a7('0x49')];}}}catch(_0xad23b4){utils['error'](_0xad23b4['stack']);}}; \ No newline at end of file +var _0xc032=['lastapplication','lastdata','xmd-contactid','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','toLowerCase','set','appdata','cdr','split','substring','lastIndexOf','noop','gotoif','application','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','channel','type','accountcode','source','destination','callerid','disposition','then','UserId','CreateVoiceCallReport','request','newchannel','OutgoingSpoolFailed','calleridnum','exten','context','now','error','stack','newstate','isNil','channelstate','systemanswertime','linkedid','transfer','destinationchannel','answertime','calleridname','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue'];(function(_0xf44608,_0x4d8e55){var _0x129f91=function(_0x2dda9a){while(--_0x2dda9a){_0xf44608['push'](_0xf44608['shift']());}};_0x129f91(++_0x4d8e55);}(_0xc032,0x1e6));var _0x2c03=function(_0x529097,_0x50777a){_0x529097=_0x529097-0x0;var _0x3e525a=_0xc032[_0x529097];return _0x3e525a;};'use strict';var _=require('lodash');var util=require(_0x2c03('0x0'));var utils=require(_0x2c03('0x1'));var dispositions=[_0x2c03('0x2'),_0x2c03('0x3'),_0x2c03('0x3'),_0x2c03('0x2'),_0x2c03('0x2'),_0x2c03('0x2'),_0x2c03('0x4'),_0x2c03('0x5'),'FAILED','FAILED',_0x2c03('0x3')];var channels={};function writeDB(_0x50e448){utils['info'](util['format']('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x50e448[_0x2c03('0x6')],_0x50e448[_0x2c03('0x7')],_0x50e448[_0x2c03('0x8')],_0x50e448[_0x2c03('0x9')],_0x50e448[_0x2c03('0xa')],_0x50e448[_0x2c03('0xb')],_0x50e448[_0x2c03('0xc')],_0x50e448[_0x2c03('0xd')]));if(_0x50e448[_0x2c03('0x9')]){utils['getUserByInternal'](_0x50e448[_0x2c03('0x9')])[_0x2c03('0xe')](function(_0x59cecb){if(_0x59cecb){_0x50e448[_0x2c03('0xf')]=_0x59cecb['id'];}utils['request'](_0x2c03('0x10'),_0x50e448);});}else{utils[_0x2c03('0x11')](_0x2c03('0x10'),_0x50e448);}if(channels[_0x50e448[_0x2c03('0x6')]]){delete channels[_0x50e448[_0x2c03('0x6')]];}}exports[_0x2c03('0x12')]=function(_0x3c86eb){try{if(_0x3c86eb[_0x2c03('0x6')]==_0x3c86eb['linkedid']&&_0x3c86eb[_0x2c03('0x7')]!=_0x2c03('0x13')){channels[_0x3c86eb['uniqueid']]={'uniqueid':_0x3c86eb[_0x2c03('0x6')],'accountcode':_0x3c86eb[_0x2c03('0x9')],'source':_0x3c86eb[_0x2c03('0x14')],'destination':_0x3c86eb[_0x2c03('0x15')],'destinationcontext':_0x3c86eb[_0x2c03('0x16')],'channel':_0x3c86eb[_0x2c03('0x7')],'starttime':utils[_0x2c03('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2c03('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x5b0209){utils[_0x2c03('0x18')](_0x5b0209[_0x2c03('0x19')]);}};exports[_0x2c03('0x1a')]=function(_0x462b91){try{if(!_[_0x2c03('0x1b')](channels[_0x462b91[_0x2c03('0x6')]])&&_0x462b91[_0x2c03('0x1c')]==0x6){if(_[_0x2c03('0x1b')](channels[_0x462b91[_0x2c03('0x6')]][_0x2c03('0x1d')])){channels[_0x462b91['uniqueid']][_0x2c03('0x1d')]=utils[_0x2c03('0x17')]();}}else if(!_[_0x2c03('0x1b')](channels[_0x462b91[_0x2c03('0x1e')]])&&_0x462b91[_0x2c03('0x1c')]==0x6&&_0x462b91[_0x2c03('0x16')]!=_0x2c03('0x1f')){channels[_0x462b91[_0x2c03('0x1e')]][_0x2c03('0x9')]=_0x462b91[_0x2c03('0x9')];channels[_0x462b91[_0x2c03('0x1e')]][_0x2c03('0x20')]=_0x462b91[_0x2c03('0x7')];if(_[_0x2c03('0x1b')](channels[_0x462b91[_0x2c03('0x1e')]][_0x2c03('0x21')])){channels[_0x462b91['linkedid']][_0x2c03('0x21')]=utils[_0x2c03('0x17')]();}channels[_0x462b91[_0x2c03('0x1e')]][_0x2c03('0xd')]=dispositions[_['toNumber'](_0x462b91[_0x2c03('0x1c')])]||'ANSWERED';}}catch(_0x2ebdda){utils[_0x2c03('0x18')](_0x2ebdda[_0x2c03('0x19')]);}};exports['hangup']=function(_0x26f540){try{if(!_[_0x2c03('0x1b')](channels[_0x26f540[_0x2c03('0x6')]])){if(_[_0x2c03('0x1b')](channels[_0x26f540[_0x2c03('0x6')]]['callerid'])){channels[_0x26f540[_0x2c03('0x6')]][_0x2c03('0xc')]=_0x26f540[_0x2c03('0x22')]+'\x20<'+_0x26f540[_0x2c03('0x14')]+'>';}channels[_0x26f540[_0x2c03('0x6')]][_0x2c03('0x23')]=utils['now']();channels[_0x26f540[_0x2c03('0x6')]][_0x2c03('0x24')]=utils[_0x2c03('0x25')](channels[_0x26f540['uniqueid']][_0x2c03('0x23')],channels[_0x26f540[_0x2c03('0x6')]][_0x2c03('0x26')]);channels[_0x26f540[_0x2c03('0x6')]][_0x2c03('0x27')]=channels[_0x26f540['uniqueid']][_0x2c03('0x21')]?utils[_0x2c03('0x25')](channels[_0x26f540['uniqueid']][_0x2c03('0x23')],channels[_0x26f540['uniqueid']]['answertime']):0x0;writeDB(channels[_0x26f540[_0x2c03('0x6')]]);}}catch(_0x5ba75d){utils[_0x2c03('0x18')](_0x5ba75d[_0x2c03('0x19')]);}};exports[_0x2c03('0x28')]=function(_0x97b9a){try{if(!_['isNil'](channels[_0x97b9a[_0x2c03('0x29')]])){if(channels[_0x97b9a['localtwolinkedid']][_0x2c03('0x7')]==_0x97b9a[_0x2c03('0x2a')]){channels[_0x97b9a[_0x2c03('0x29')]]['destinationchannel']=_0x97b9a[_0x2c03('0x2b')];channels[_0x97b9a[_0x2c03('0x29')]][_0x2c03('0x2c')]=_0x2c03('0x2d');}else if(channels[_0x97b9a[_0x2c03('0x29')]][_0x2c03('0x7')]=_0x97b9a['transfertargetchannel']){channels[_0x97b9a[_0x2c03('0x29')]][_0x2c03('0x20')]=_0x97b9a[_0x2c03('0x2e')];channels[_0x97b9a['localtwolinkedid']][_0x2c03('0x2c')]=_0x2c03('0x2d');}}}catch(_0x1404fd){utils[_0x2c03('0x18')](_0x1404fd[_0x2c03('0x19')]);}};exports[_0x2c03('0x2f')]=function(_0x397174){try{if(!_['isNil'](channels[_0x397174[_0x2c03('0x6')]])){channels[_0x397174[_0x2c03('0x6')]][_0x2c03('0x30')]=utils['now']();}}catch(_0x13f345){utils['error'](_0x13f345['stack']);}};exports[_0x2c03('0x31')]=function(_0x9b0512){try{if(!_['isNil'](channels[_0x9b0512[_0x2c03('0x6')]])){if(!_[_0x2c03('0x1b')](channels[_0x9b0512[_0x2c03('0x6')]][_0x2c03('0x30')])){channels[_0x9b0512[_0x2c03('0x6')]]['mohtime']+=utils[_0x2c03('0x25')](utils[_0x2c03('0x17')](),channels[_0x9b0512[_0x2c03('0x6')]][_0x2c03('0x30')]);delete channels[_0x9b0512['uniqueid']]['musiconholdstartAt'];}}}catch(_0xd7ce9){utils['error'](_0xd7ce9['stack']);}};exports[_0x2c03('0x32')]=function(_0x969c4c){try{if(!_[_0x2c03('0x1b')](channels[_0x969c4c[_0x2c03('0x6')]])){if(!_[_0x2c03('0x1b')](_0x969c4c[_0x2c03('0x33')][_0x2c03('0x34')])){channels[_0x969c4c[_0x2c03('0x6')]][_0x2c03('0xa')]=_0x969c4c[_0x2c03('0x35')];}if(!_[_0x2c03('0x1b')](_0x969c4c[_0x2c03('0x33')][_0x2c03('0x36')])){channels[_0x969c4c['uniqueid']][_0x2c03('0xb')]=_0x969c4c[_0x2c03('0x35')];channels[_0x969c4c[_0x2c03('0x6')]][_0x2c03('0xc')]='\x22'+_0x969c4c['value']+_0x2c03('0x37')+_0x969c4c[_0x2c03('0x35')]+'>';}if(!_[_0x2c03('0x1b')](_0x969c4c[_0x2c03('0x33')][_0x2c03('0x38')])||!_[_0x2c03('0x1b')](_0x969c4c[_0x2c03('0x33')][_0x2c03('0x39')])){channels[_0x969c4c[_0x2c03('0x6')]][_0x2c03('0xc')]=_0x969c4c[_0x2c03('0x35')];}if(!_[_0x2c03('0x1b')](_0x969c4c[_0x2c03('0x33')][_0x2c03('0x3a')])||!_[_0x2c03('0x1b')](_0x969c4c[_0x2c03('0x33')][_0x2c03('0x3b')])){channels[_0x969c4c[_0x2c03('0x6')]][_0x2c03('0x3c')]='Queue';channels[_0x969c4c[_0x2c03('0x6')]][_0x2c03('0x3d')]=_0x969c4c[_0x2c03('0x35')];channels[_0x969c4c[_0x2c03('0x6')]]['queue']=!![];}if(!_[_0x2c03('0x1b')](_0x969c4c[_0x2c03('0x33')][_0x2c03('0x3e')])){channels[_0x969c4c['uniqueid']]['ContactId']=_0x969c4c[_0x2c03('0x35')];}if(!_[_0x2c03('0x1b')](_0x969c4c['variable'][_0x2c03('0x3f')])){channels[_0x969c4c['uniqueid']][_0x2c03('0x8')]=_0x969c4c[_0x2c03('0x35')];}if(!_['isNil'](_0x969c4c[_0x2c03('0x33')][_0x2c03('0x40')])){channels[_0x969c4c[_0x2c03('0x6')]][_0x2c03('0x41')]=_0x969c4c['value'];}if(!_[_0x2c03('0x1b')](_0x969c4c[_0x2c03('0x33')][_0x2c03('0x42')])){channels[_0x969c4c[_0x2c03('0x6')]][_0x2c03('0x42')]=_0x969c4c[_0x2c03('0x35')];}}}catch(_0x24cc64){utils['error'](_0x24cc64[_0x2c03('0x19')]);}};exports[_0x2c03('0x43')]=function(_0x3f33b2){try{if(!_[_0x2c03('0x1b')](channels[_0x3f33b2[_0x2c03('0x6')]])){if(_0x3f33b2['application'][_0x2c03('0x44')]()==_0x2c03('0x45')&&_['startsWith'](_0x3f33b2[_0x2c03('0x46')][_0x2c03('0x44')](),_0x2c03('0x47'))){var _0x4dbb77=_0x3f33b2[_0x2c03('0x46')][_0x2c03('0x48')]('=');var _0x46c529=_0x4dbb77[0x0][_0x2c03('0x49')](_0x4dbb77[0x0][_0x2c03('0x4a')]('(')+0x1,_0x4dbb77[0x0][_0x2c03('0x4a')](')'));var _0x348f0f=_0x4dbb77[0x1];channels[_0x3f33b2['uniqueid']][_0x46c529]=_0x348f0f;}if(!_['includes'](['hangup',_0x2c03('0x4b'),'execif','set',_0x2c03('0x4c')],_0x3f33b2[_0x2c03('0x4d')][_0x2c03('0x44')]())){channels[_0x3f33b2[_0x2c03('0x6')]][_0x2c03('0x3c')]=_0x3f33b2[_0x2c03('0x4d')];channels[_0x3f33b2[_0x2c03('0x6')]][_0x2c03('0x3d')]=_0x3f33b2[_0x2c03('0x46')];}}}catch(_0xaf7aee){utils[_0x2c03('0x18')](_0xaf7aee[_0x2c03('0x19')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 6b848e3..796de0a 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 _0x5d58=['info','fullybooted','error','close','CLOSE','managerevent','shutdown'];(function(_0x5906a0,_0x19435){var _0x23d6e3=function(_0x393201){while(--_0x393201){_0x5906a0['push'](_0x5906a0['shift']());}};_0x23d6e3(++_0x19435);}(_0x5d58,0x187));var _0x85d5=function(_0x5c95d4,_0x4cb976){_0x5c95d4=_0x5c95d4-0x0;var _0x3fc265=_0x5d58[_0x5c95d4];return _0x3fc265;};'use strict';var utils=require('./utils');var _=require('lodash');exports['connect']=function(){utils['info']('CONNECTED');};exports[_0x85d5('0x0')]=function(){utils[_0x85d5('0x1')]('SHUTDOWN');};exports[_0x85d5('0x2')]=function(){utils[_0x85d5('0x1')]('FULLYBOOTED');};exports[_0x85d5('0x3')]=function(_0x2d457a){utils[_0x85d5('0x3')](_0x2d457a);};exports[_0x85d5('0x4')]=function(){utils['info'](_0x85d5('0x5'));};exports[_0x85d5('0x6')]=function(_0x4ca293){}; \ No newline at end of file +var _0xbff5=['error','close','CLOSE','managerevent','./utils','lodash','connect','info','CONNECTED','shutdown','fullybooted'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xbff5,0x1bc));var _0x5bff=function(_0x49f566,_0x21b58b){_0x49f566=_0x49f566-0x0;var _0x3b54dd=_0xbff5[_0x49f566];return _0x3b54dd;};'use strict';var utils=require(_0x5bff('0x0'));var _=require(_0x5bff('0x1'));exports[_0x5bff('0x2')]=function(){utils[_0x5bff('0x3')](_0x5bff('0x4'));};exports[_0x5bff('0x5')]=function(){utils[_0x5bff('0x3')]('SHUTDOWN');};exports[_0x5bff('0x6')]=function(){utils['info']('FULLYBOOTED');};exports[_0x5bff('0x7')]=function(_0x1d8650){utils[_0x5bff('0x7')](_0x1d8650);};exports[_0x5bff('0x8')]=function(){utils[_0x5bff('0x3')](_0x5bff('0x9'));};exports[_0x5bff('0xa')]=function(_0x139c99){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index cafd830..b8af840 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 _0x071d=['varset','variable','outboundrouteid','value','dialbegin','assign','now','dialend','isNil','ANSWER','answertime','lastevent','connect','hangup','duration','diffTime','starttime','holdtime','endtime','./utils','info','format','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','application','toLowerCase','set','appdata','cdr(routeid)','error','stack'];(function(_0x1fda03,_0x5bae71){var _0x3a829a=function(_0x4a2d45){while(--_0x4a2d45){_0x1fda03['push'](_0x1fda03['shift']());}};_0x3a829a(++_0x5bae71);}(_0x071d,0x82));var _0xd071=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x071d[_0x18cac4];return _0x2227c6;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xd071('0x0'));var dials={};function writeDB(_0x160075){utils[_0xd071('0x1')](util[_0xd071('0x2')]('DIAL|%s|%s|%s|%s|%s|%s',_0x160075[_0xd071('0x3')],_0x160075[_0xd071('0x4')],_0x160075['dialstring'],_0x160075[_0xd071('0x5')],_0x160075[_0xd071('0x6')],_0x160075[_0xd071('0x7')]));utils[_0xd071('0x8')](_0xd071('0x9'),_0x160075);delete dials[_0x160075[_0xd071('0x3')]];}exports[_0xd071('0xa')]=function(_0x3f09fb){try{if(_0x3f09fb[_0xd071('0xb')][_0xd071('0xc')]()==_0xd071('0xd')&&_['startsWith'](_0x3f09fb[_0xd071('0xe')][_0xd071('0xc')](),_0xd071('0xf'))){var _0x240f31=_0x3f09fb[_0xd071('0xe')]['split']('=');dials[_0x3f09fb[_0xd071('0x3')]]={'routeId':_0x240f31[0x1]};}}catch(_0x393f43){utils[_0xd071('0x10')](_0x393f43[_0xd071('0x11')]);}};exports[_0xd071('0x12')]=function(_0x2de8d4){try{if(!_['isNil'](_0x2de8d4[_0xd071('0x13')][_0xd071('0x14')])){dials[_0x2de8d4['uniqueid']]={'routeId':_0x2de8d4[_0xd071('0x15')]};}}catch(_0x2b4cbe){utils[_0xd071('0x10')](_0x2b4cbe['stack']);}};exports[_0xd071('0x16')]=function(_0x307f9f){try{if(!_['isNil'](dials[_0x307f9f[_0xd071('0x3')]])){dials[_0x307f9f[_0xd071('0x3')]]=_[_0xd071('0x17')](dials[_0x307f9f[_0xd071('0x3')]],_0x307f9f);dials[_0x307f9f[_0xd071('0x3')]]['starttime']=utils[_0xd071('0x18')]();dials[_0x307f9f['uniqueid']]['lastevent']='called';}}catch(_0x1941f4){utils[_0xd071('0x10')](_0x1941f4[_0xd071('0x11')]);}};exports[_0xd071('0x19')]=function(_0x5187a3){try{if(!_[_0xd071('0x1a')](dials[_0x5187a3[_0xd071('0x3')]])){dials[_0x5187a3['uniqueid']][_0xd071('0x7')]=_0x5187a3[_0xd071('0x7')];if(_0x5187a3['dialstatus']==_0xd071('0x1b')){dials[_0x5187a3['uniqueid']]=_[_0xd071('0x17')](dials[_0x5187a3[_0xd071('0x3')]],_0x5187a3);dials[_0x5187a3[_0xd071('0x3')]][_0xd071('0x1c')]=utils[_0xd071('0x18')]();dials[_0x5187a3[_0xd071('0x3')]][_0xd071('0x1d')]=_0xd071('0x1e');}}}catch(_0x2f7f87){utils['error'](_0x2f7f87['stack']);}};exports[_0xd071('0x1f')]=function(_0x41b661){try{if(!_[_0xd071('0x1a')](dials[_0x41b661[_0xd071('0x3')]])){dials[_0x41b661[_0xd071('0x3')]]=_[_0xd071('0x17')](dials[_0x41b661[_0xd071('0x3')]],{'endtime':utils[_0xd071('0x18')](),'lastevent':'complete'});dials[_0x41b661[_0xd071('0x3')]][_0xd071('0x20')]=utils[_0xd071('0x21')](dials[_0x41b661[_0xd071('0x3')]]['endtime'],dials[_0x41b661[_0xd071('0x3')]][_0xd071('0x22')]);dials[_0x41b661[_0xd071('0x3')]][_0xd071('0x23')]=utils[_0xd071('0x21')](dials[_0x41b661['uniqueid']][_0xd071('0x1c')]||dials[_0x41b661[_0xd071('0x3')]][_0xd071('0x24')],dials[_0x41b661[_0xd071('0x3')]][_0xd071('0x22')]);dials[_0x41b661[_0xd071('0x3')]]['billableseconds']=dials[_0x41b661[_0xd071('0x3')]][_0xd071('0x1c')]?utils[_0xd071('0x21')](dials[_0x41b661[_0xd071('0x3')]][_0xd071('0x24')],dials[_0x41b661[_0xd071('0x3')]]['answertime']):0x0;writeDB(dials[_0x41b661[_0xd071('0x3')]]);}}catch(_0x5f385e){utils['error'](_0x5f385e['stack']);}}; \ No newline at end of file +var _0x8d39=['connect','hangup','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','format','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','stack','isNil','variable','outboundrouteid','dialbegin','assign','starttime','now','lastevent','dialend','ANSWER','answertime'];(function(_0x1079f9,_0x4c825c){var _0x4aa21f=function(_0x4de028){while(--_0x4de028){_0x1079f9['push'](_0x1079f9['shift']());}};_0x4aa21f(++_0x4c825c);}(_0x8d39,0x120));var _0x98d3=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x8d39[_0x37ffea];return _0x2e2615;};'use strict';var _=require(_0x98d3('0x0'));var util=require(_0x98d3('0x1'));var utils=require(_0x98d3('0x2'));var dials={};function writeDB(_0x2ad0a1){utils['info'](util[_0x98d3('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x2ad0a1['uniqueid'],_0x2ad0a1[_0x98d3('0x4')],_0x2ad0a1[_0x98d3('0x5')],_0x2ad0a1[_0x98d3('0x6')],_0x2ad0a1[_0x98d3('0x7')],_0x2ad0a1[_0x98d3('0x8')]));utils[_0x98d3('0x9')](_0x98d3('0xa'),_0x2ad0a1);delete dials[_0x2ad0a1[_0x98d3('0xb')]];}exports['newexten']=function(_0x1dbbf8){try{if(_0x1dbbf8[_0x98d3('0xc')][_0x98d3('0xd')]()==_0x98d3('0xe')&&_[_0x98d3('0xf')](_0x1dbbf8[_0x98d3('0x10')]['toLowerCase'](),_0x98d3('0x11'))){var _0x4bb40b=_0x1dbbf8[_0x98d3('0x10')][_0x98d3('0x12')]('=');dials[_0x1dbbf8['uniqueid']]={'routeId':_0x4bb40b[0x1]};}}catch(_0x307884){utils[_0x98d3('0x13')](_0x307884[_0x98d3('0x14')]);}};exports['varset']=function(_0x1737c6){try{if(!_[_0x98d3('0x15')](_0x1737c6[_0x98d3('0x16')][_0x98d3('0x17')])){dials[_0x1737c6[_0x98d3('0xb')]]={'routeId':_0x1737c6['value']};}}catch(_0xab6a3e){utils[_0x98d3('0x13')](_0xab6a3e['stack']);}};exports[_0x98d3('0x18')]=function(_0x59728e){try{if(!_[_0x98d3('0x15')](dials[_0x59728e['uniqueid']])){dials[_0x59728e[_0x98d3('0xb')]]=_[_0x98d3('0x19')](dials[_0x59728e[_0x98d3('0xb')]],_0x59728e);dials[_0x59728e['uniqueid']][_0x98d3('0x1a')]=utils[_0x98d3('0x1b')]();dials[_0x59728e[_0x98d3('0xb')]][_0x98d3('0x1c')]='called';}}catch(_0x4cb0ba){utils[_0x98d3('0x13')](_0x4cb0ba[_0x98d3('0x14')]);}};exports[_0x98d3('0x1d')]=function(_0x2e2234){try{if(!_[_0x98d3('0x15')](dials[_0x2e2234[_0x98d3('0xb')]])){dials[_0x2e2234[_0x98d3('0xb')]][_0x98d3('0x8')]=_0x2e2234[_0x98d3('0x8')];if(_0x2e2234[_0x98d3('0x8')]==_0x98d3('0x1e')){dials[_0x2e2234[_0x98d3('0xb')]]=_[_0x98d3('0x19')](dials[_0x2e2234[_0x98d3('0xb')]],_0x2e2234);dials[_0x2e2234['uniqueid']][_0x98d3('0x1f')]=utils[_0x98d3('0x1b')]();dials[_0x2e2234['uniqueid']][_0x98d3('0x1c')]=_0x98d3('0x20');}}}catch(_0x56914a){utils[_0x98d3('0x13')](_0x56914a['stack']);}};exports[_0x98d3('0x21')]=function(_0xf64b30){try{if(!_[_0x98d3('0x15')](dials[_0xf64b30['uniqueid']])){dials[_0xf64b30[_0x98d3('0xb')]]=_[_0x98d3('0x19')](dials[_0xf64b30['uniqueid']],{'endtime':utils[_0x98d3('0x1b')](),'lastevent':_0x98d3('0x22')});dials[_0xf64b30[_0x98d3('0xb')]][_0x98d3('0x23')]=utils[_0x98d3('0x24')](dials[_0xf64b30[_0x98d3('0xb')]][_0x98d3('0x25')],dials[_0xf64b30[_0x98d3('0xb')]][_0x98d3('0x1a')]);dials[_0xf64b30['uniqueid']][_0x98d3('0x26')]=utils[_0x98d3('0x24')](dials[_0xf64b30[_0x98d3('0xb')]][_0x98d3('0x1f')]||dials[_0xf64b30[_0x98d3('0xb')]]['endtime'],dials[_0xf64b30[_0x98d3('0xb')]]['starttime']);dials[_0xf64b30[_0x98d3('0xb')]][_0x98d3('0x27')]=dials[_0xf64b30['uniqueid']][_0x98d3('0x1f')]?utils[_0x98d3('0x24')](dials[_0xf64b30[_0x98d3('0xb')]][_0x98d3('0x25')],dials[_0xf64b30[_0x98d3('0xb')]][_0x98d3('0x1f')]):0x0;writeDB(dials[_0xf64b30['uniqueid']]);}}catch(_0x226a78){utils[_0x98d3('0x13')](_0x226a78[_0x98d3('0x14')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8570029..16cdd84 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 _0x36f1=['keepConnected','xdr','disabled','info','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','port','asterisk','password'];(function(_0x175374,_0x3c2440){var _0x4e1f61=function(_0x23e306){while(--_0x23e306){_0x175374['push'](_0x175374['shift']());}};_0x4e1f61(++_0x3c2440);}(_0x36f1,0x119));var _0x136f=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x36f1[_0x4fc9e6];return _0x551d28;};var AsteriskManager=require(_0x136f('0x0'));var config=require(_0x136f('0x1'));var utils=require(_0x136f('0x2'));var ami=new AsteriskManager(config['asterisk'][_0x136f('0x3')],config[_0x136f('0x4')]['ip'],config[_0x136f('0x4')]['username'],config[_0x136f('0x4')][_0x136f('0x5')],!![]);ami[_0x136f('0x6')]();if(config['xdr']&&config[_0x136f('0x7')][_0x136f('0x8')]){utils[_0x136f('0x9')](_0x136f('0xa'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x136f('0xb'));var recordings=require(_0x136f('0xc'));var members=require(_0x136f('0xd'));var dials=require(_0x136f('0xe'));var transfers=require(_0x136f('0xf'));var core=require('./core.controller');ami['on'](_0x136f('0x10'),core[_0x136f('0x10')]);ami['on'](_0x136f('0x11'),core[_0x136f('0x11')]);ami['on'](_0x136f('0x12'),core[_0x136f('0x12')]);ami['on']('error',core[_0x136f('0x13')]);ami['on'](_0x136f('0x14'),core[_0x136f('0x14')]);ami['on']('managerevent',core[_0x136f('0x15')]);ami['on'](_0x136f('0x16'),function(_0x44b83b){try{members[_0x136f('0x16')](_0x44b83b);}catch(_0xb824b0){utils[_0x136f('0x13')](_0xb824b0);}});ami['on']('agentcalled',function(_0x318383){try{agents['agentcalled'](_0x318383);}catch(_0x597e62){utils[_0x136f('0x13')](_0x597e62);}});ami['on'](_0x136f('0x17'),function(_0x38fc98){try{agents[_0x136f('0x17')](_0x38fc98);}catch(_0x25363e){utils['error'](_0x25363e);}});ami['on'](_0x136f('0x18'),function(_0x2a76e5){try{agents['agentconnect'](_0x2a76e5);queues[_0x136f('0x18')](_0x2a76e5);}catch(_0x378361){utils[_0x136f('0x13')](_0x378361);}});ami['on'](_0x136f('0x19'),function(_0x17cc37){try{agents['agentcomplete'](_0x17cc37);queues[_0x136f('0x19')](_0x17cc37);members[_0x136f('0x19')](_0x17cc37);}catch(_0x5bb508){utils[_0x136f('0x13')](_0x5bb508);}});ami['on'](_0x136f('0x1a'),function(_0x31213f){try{agents[_0x136f('0x1a')](_0x31213f);queues[_0x136f('0x1a')](_0x31213f);}catch(_0xb9dbb2){utils[_0x136f('0x13')](_0xb9dbb2);}});ami['on'](_0x136f('0x1b'),function(_0xfd667b){try{queues['queuecallerjoin'](_0xfd667b);recordings['queuecallerjoin'](_0xfd667b);}catch(_0x12eade){utils[_0x136f('0x13')](_0x12eade);}});ami['on']('queuecallerleave',function(_0x59a4a2){try{queues[_0x136f('0x1c')](_0x59a4a2);}catch(_0x43d693){utils[_0x136f('0x13')](_0x43d693);}});ami['on']('musiconholdstart',function(_0x383906){try{queues[_0x136f('0x1d')](_0x383906);calls[_0x136f('0x1d')](_0x383906);}catch(_0x2992a1){utils[_0x136f('0x13')](_0x2992a1);}});ami['on']('musiconholdstop',function(_0x552406){try{queues[_0x136f('0x1e')](_0x552406);calls[_0x136f('0x1e')](_0x552406);}catch(_0x4fbded){utils[_0x136f('0x13')](_0x4fbded);}});ami['on'](_0x136f('0x1f'),function(_0xb28cbd){try{calls[_0x136f('0x1f')](_0xb28cbd);recordings['newstate'](_0xb28cbd);}catch(_0x405dd6){utils[_0x136f('0x13')](_0x405dd6);}});ami['on'](_0x136f('0x20'),function(_0x36da54){try{calls[_0x136f('0x20')](_0x36da54);recordings['hangup'](_0x36da54);dials[_0x136f('0x20')](_0x36da54);agents[_0x136f('0x20')](_0x36da54);queues[_0x136f('0x20')](_0x36da54);}catch(_0x2b82d3){utils[_0x136f('0x13')](_0x2b82d3);}});ami['on'](_0x136f('0x21'),function(_0x33333c){try{members[_0x136f('0x21')](_0x33333c);}catch(_0xc11e43){utils[_0x136f('0x13')](_0xc11e43);}});ami['on'](_0x136f('0x22'),function(_0xf5d419){try{queues[_0x136f('0x22')](_0xf5d419);agents[_0x136f('0x22')](_0xf5d419);transfers[_0x136f('0x22')](_0xf5d419);}catch(_0x33b24d){utils[_0x136f('0x13')](_0x33b24d);}});ami['on'](_0x136f('0x23'),function(_0xd8af5a){try{queues['attendedtransfer'](_0xd8af5a);transfers[_0x136f('0x23')](_0xd8af5a);agents[_0x136f('0x23')](_0xd8af5a);calls['attendedtransfer'](_0xd8af5a);}catch(_0x935a1b){utils[_0x136f('0x13')](_0x935a1b);}});ami['on'](_0x136f('0x24'),function(_0x2904bc){try{queues[_0x136f('0x24')](_0x2904bc);recordings[_0x136f('0x24')](_0x2904bc);calls[_0x136f('0x24')](_0x2904bc);dials[_0x136f('0x24')](_0x2904bc);}catch(_0x42668a){utils[_0x136f('0x13')](_0x42668a);}});ami['on'](_0x136f('0x25'),function(_0x5e156a){try{calls[_0x136f('0x25')](_0x5e156a);recordings[_0x136f('0x25')](_0x5e156a);dials[_0x136f('0x25')](_0x5e156a);}catch(_0x1338f3){utils[_0x136f('0x13')](_0x1338f3);}});ami['on'](_0x136f('0x26'),function(_0x3b10cb){try{calls['newchannel'](_0x3b10cb);recordings['newchannel'](_0x3b10cb);}catch(_0x580cc7){utils[_0x136f('0x13')](_0x580cc7);}});ami['on'](_0x136f('0x27'),function(_0x4547e2){try{dials[_0x136f('0x27')](_0x4547e2);}catch(_0x43d13d){utils[_0x136f('0x13')](_0x43d13d);}});ami['on'](_0x136f('0x28'),function(_0x363b3b){try{dials[_0x136f('0x28')](_0x363b3b);}catch(_0x3d5e2d){utils[_0x136f('0x13')](_0x3d5e2d);}});} \ No newline at end of file +var _0x486f=['connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','password','xdr','info','XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller'];(function(_0xf2d1bf,_0x19c53a){var _0x388d2c=function(_0x217e55){while(--_0x217e55){_0xf2d1bf['push'](_0xf2d1bf['shift']());}};_0x388d2c(++_0x19c53a);}(_0x486f,0x1e1));var _0xf486=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x486f[_0x4a9fb1];return _0x348672;};var AsteriskManager=require(_0xf486('0x0'));var config=require(_0xf486('0x1'));var utils=require(_0xf486('0x2'));var ami=new AsteriskManager(config[_0xf486('0x3')]['port'],config[_0xf486('0x3')]['ip'],config[_0xf486('0x3')]['username'],config['asterisk'][_0xf486('0x4')],!![]);ami['keepConnected']();if(config[_0xf486('0x5')]&&config['xdr']['disabled']){utils[_0xf486('0x6')](_0xf486('0x7'));}else{var agents=require('./agents.controller');var calls=require(_0xf486('0x8'));var queues=require('./queues.controller');var recordings=require(_0xf486('0x9'));var members=require(_0xf486('0xa'));var dials=require('./dials.controller');var transfers=require(_0xf486('0xb'));var core=require(_0xf486('0xc'));ami['on'](_0xf486('0xd'),core[_0xf486('0xd')]);ami['on'](_0xf486('0xe'),core['shutdown']);ami['on'](_0xf486('0xf'),core['fullybooted']);ami['on'](_0xf486('0x10'),core[_0xf486('0x10')]);ami['on'](_0xf486('0x11'),core[_0xf486('0x11')]);ami['on'](_0xf486('0x12'),core[_0xf486('0x12')]);ami['on'](_0xf486('0x13'),function(_0x29ea80){try{members['devicestatechange'](_0x29ea80);}catch(_0x87da5){utils[_0xf486('0x10')](_0x87da5);}});ami['on'](_0xf486('0x14'),function(_0x239561){try{agents[_0xf486('0x14')](_0x239561);}catch(_0x152051){utils['error'](_0x152051);}});ami['on']('agentringnoanswer',function(_0x1b3059){try{agents[_0xf486('0x15')](_0x1b3059);}catch(_0x29ab76){utils['error'](_0x29ab76);}});ami['on'](_0xf486('0x16'),function(_0x2d9e4a){try{agents[_0xf486('0x16')](_0x2d9e4a);queues['agentconnect'](_0x2d9e4a);}catch(_0x8497dd){utils[_0xf486('0x10')](_0x8497dd);}});ami['on']('agentcomplete',function(_0x151ff3){try{agents[_0xf486('0x17')](_0x151ff3);queues['agentcomplete'](_0x151ff3);members[_0xf486('0x17')](_0x151ff3);}catch(_0x31130b){utils[_0xf486('0x10')](_0x31130b);}});ami['on'](_0xf486('0x18'),function(_0x4d5cc6){try{agents[_0xf486('0x18')](_0x4d5cc6);queues[_0xf486('0x18')](_0x4d5cc6);}catch(_0x3b1851){utils[_0xf486('0x10')](_0x3b1851);}});ami['on'](_0xf486('0x19'),function(_0x40e4d8){try{queues[_0xf486('0x19')](_0x40e4d8);recordings[_0xf486('0x19')](_0x40e4d8);}catch(_0x198f9b){utils['error'](_0x198f9b);}});ami['on']('queuecallerleave',function(_0x129a87){try{queues['queuecallerleave'](_0x129a87);}catch(_0x35a46a){utils['error'](_0x35a46a);}});ami['on'](_0xf486('0x1a'),function(_0x5545ad){try{queues['musiconholdstart'](_0x5545ad);calls[_0xf486('0x1a')](_0x5545ad);}catch(_0x10516d){utils[_0xf486('0x10')](_0x10516d);}});ami['on'](_0xf486('0x1b'),function(_0x39bd70){try{queues[_0xf486('0x1b')](_0x39bd70);calls[_0xf486('0x1b')](_0x39bd70);}catch(_0x21755a){utils[_0xf486('0x10')](_0x21755a);}});ami['on'](_0xf486('0x1c'),function(_0x274dc7){try{calls[_0xf486('0x1c')](_0x274dc7);recordings[_0xf486('0x1c')](_0x274dc7);}catch(_0x546566){utils['error'](_0x546566);}});ami['on'](_0xf486('0x1d'),function(_0x322ede){try{calls[_0xf486('0x1d')](_0x322ede);recordings[_0xf486('0x1d')](_0x322ede);dials[_0xf486('0x1d')](_0x322ede);agents['hangup'](_0x322ede);queues[_0xf486('0x1d')](_0x322ede);}catch(_0x4dd6a6){utils[_0xf486('0x10')](_0x4dd6a6);}});ami['on'](_0xf486('0x1e'),function(_0x35bf32){try{members['cdr'](_0x35bf32);}catch(_0x3328f6){utils[_0xf486('0x10')](_0x3328f6);}});ami['on'](_0xf486('0x1f'),function(_0x417946){try{queues[_0xf486('0x1f')](_0x417946);agents[_0xf486('0x1f')](_0x417946);transfers[_0xf486('0x1f')](_0x417946);}catch(_0x404e8f){utils[_0xf486('0x10')](_0x404e8f);}});ami['on'](_0xf486('0x20'),function(_0x35fd66){try{queues[_0xf486('0x20')](_0x35fd66);transfers['attendedtransfer'](_0x35fd66);agents[_0xf486('0x20')](_0x35fd66);calls[_0xf486('0x20')](_0x35fd66);}catch(_0x878443){utils[_0xf486('0x10')](_0x878443);}});ami['on']('varset',function(_0xf5425){try{queues[_0xf486('0x21')](_0xf5425);recordings[_0xf486('0x21')](_0xf5425);calls['varset'](_0xf5425);dials[_0xf486('0x21')](_0xf5425);}catch(_0x5075c6){utils[_0xf486('0x10')](_0x5075c6);}});ami['on'](_0xf486('0x22'),function(_0x5732a3){try{calls[_0xf486('0x22')](_0x5732a3);recordings[_0xf486('0x22')](_0x5732a3);dials[_0xf486('0x22')](_0x5732a3);}catch(_0xa377c7){utils['error'](_0xa377c7);}});ami['on'](_0xf486('0x23'),function(_0x24102e){try{calls[_0xf486('0x23')](_0x24102e);recordings['newchannel'](_0x24102e);}catch(_0x41ce96){utils['error'](_0x41ce96);}});ami['on']('dialbegin',function(_0x1299cd){try{dials[_0xf486('0x24')](_0x1299cd);}catch(_0x55f59e){utils[_0xf486('0x10')](_0x55f59e);}});ami['on']('dialend',function(_0x1f6ab2){try{dials[_0xf486('0x25')](_0x1f6ab2);}catch(_0x4927e4){utils[_0xf486('0x10')](_0x4927e4);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index e7f49e7..45a07be 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 _0x5758=['Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','data2','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','membername','catch','some','devicestatechange','state','INUSE','BUSY','device','TALKING','now','NOT_INUSE','exitAt','duration','diffTime','enterAt','uniqueid','agentcomplete','isNil','assign','queue','source','destination','destinationchannel','data1','data3','util'];(function(_0x11026e,_0x164422){var _0x334d99=function(_0x1c9568){while(--_0x1c9568){_0x11026e['push'](_0x11026e['shift']());}};_0x334d99(++_0x164422);}(_0x5758,0x125));var _0x8575=function(_0x58fa98,_0x21a6f8){_0x58fa98=_0x58fa98-0x0;var _0x25ca31=_0x5758[_0x58fa98];return _0x25ca31;};'use strict';var _=require('lodash');var util=require(_0x8575('0x0'));var utils=require('./utils');var members={};var exclude=[_0x8575('0x1'),_0x8575('0x2')];function writeDB(_0xab6b1){utils[_0x8575('0x3')](util[_0x8575('0x4')](_0x8575('0x5'),_0xab6b1['uniqueid'],_0xab6b1[_0x8575('0x6')],_0xab6b1[_0x8575('0x7')],_0xab6b1[_0x8575('0x8')],_0xab6b1['membername'],_0xab6b1[_0x8575('0x9')]));if(_0xab6b1['interface']){utils[_0x8575('0xa')](_0xab6b1['interface'])[_0x8575('0xb')](function(_0x1e09bc){if(_0x1e09bc){_0xab6b1['membername']=_0x1e09bc['name'];_0xab6b1[_0x8575('0xc')]=_0x1e09bc[_0x8575('0xc')];utils[_0x8575('0xd')](_0x8575('0xe'),_0xab6b1);}else{utils[_0x8575('0xf')](_0xab6b1['interface'][_0x8575('0x10')]('/')[0x1])[_0x8575('0xb')](function(_0x5f29fe){if(_0x5f29fe){_0xab6b1[_0x8575('0x11')]=_0x5f29fe['name'];_0xab6b1[_0x8575('0xc')]=_0x5f29fe[_0x8575('0xc')];utils['request']('CreateMemberReport',_0xab6b1);}});}})[_0x8575('0x12')](function(_0x3d5315){utils['error'](_0x3d5315);});}delete members[_0xab6b1[_0x8575('0x6')]];}function startsWith(_0x1368a7,_0x21e0a8){return _[_0x8575('0x13')](_0x1368a7,function(_0x455038){return _['startsWith'](_0x21e0a8,_0x455038);});}exports[_0x8575('0x14')]=function(_0x18b48b){switch(_0x18b48b[_0x8575('0x15')]){case _0x8575('0x16'):case _0x8575('0x17'):if(!startsWith(exclude,_0x18b48b[_0x8575('0x18')])){members[_0x18b48b[_0x8575('0x18')]]={'channel':'voice','interface':_0x18b48b[_0x8575('0x18')],'type':_0x8575('0x19'),'enterAt':utils[_0x8575('0x1a')](),'role':'agent'};}break;case _0x8575('0x1b'):if(!_['isNil'](members[_0x18b48b['device']])){members[_0x18b48b[_0x8575('0x18')]][_0x8575('0x1c')]=utils[_0x8575('0x1a')]();members[_0x18b48b[_0x8575('0x18')]][_0x8575('0x1d')]=utils[_0x8575('0x1e')](members[_0x18b48b[_0x8575('0x18')]][_0x8575('0x1c')],members[_0x18b48b[_0x8575('0x18')]][_0x8575('0x1f')]);if(members[_0x18b48b[_0x8575('0x18')]][_0x8575('0x20')]){writeDB(members[_0x18b48b[_0x8575('0x18')]]);}}default:break;}};exports[_0x8575('0x21')]=function(_0x33157d){if(!_[_0x8575('0x22')](members[_0x33157d[_0x8575('0x6')]])){members[_0x33157d[_0x8575('0x6')]]=_[_0x8575('0x23')](members[_0x33157d[_0x8575('0x6')]],{'data4':_0x33157d[_0x8575('0x24')],'uniqueid':_0x33157d['uniqueid']});}};exports['cdr']=function(_0x3e919d){if(_0x3e919d[_0x8575('0x7')]){var _0x3c7679=_0x3e919d[_0x8575('0x7')][_0x8575('0x10')]('-')[0x0];if(!_[_0x8575('0x22')](members[_0x3c7679])){members[_0x3c7679]=_[_0x8575('0x23')](members[_0x3c7679],{'data1':members[_0x3c7679]['data1']||_0x3e919d[_0x8575('0x9')],'data2':members[_0x3c7679]['data2']||_0x3e919d[_0x8575('0x25')],'data3':members[_0x3c7679]['data3']||_0x3e919d[_0x8575('0x26')],'uniqueid':members[_0x3c7679]['uniqueid']||_0x3e919d[_0x8575('0x20')]});if(members[_0x3c7679]['exitAt']){writeDB(members[_0x3c7679]);}}}if(_0x3e919d[_0x8575('0x27')]){var _0x14e163=_0x3e919d[_0x8575('0x27')][_0x8575('0x10')]('-')[0x0];if(!_[_0x8575('0x22')](members[_0x14e163])){members[_0x14e163]=_[_0x8575('0x23')](members[_0x14e163],{'data1':members[_0x14e163][_0x8575('0x28')]||_0x3e919d[_0x8575('0x9')],'data2':members[_0x14e163]['data2']||_0x3e919d[_0x8575('0x25')],'data3':members[_0x14e163][_0x8575('0x29')]||_0x3e919d['destination'],'uniqueid':members[_0x14e163][_0x8575('0x20')]||_0x3e919d['uniqueid']});if(members[_0x14e163][_0x8575('0x1c')]){writeDB(members[_0x14e163]);}}}}; \ No newline at end of file +var _0xee0d=['BUSY','device','voice','now','agent','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','queue','cdr','assign','data1','source','data3','destination','destinationchannel','data2','lodash','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','split','then','startsWith','devicestatechange','state'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xee0d,0x66));var _0xdee0=function(_0x21f822,_0x138136){_0x21f822=_0x21f822-0x0;var _0x4abd1b=_0xee0d[_0x21f822];return _0x4abd1b;};'use strict';var _=require(_0xdee0('0x0'));var util=require('util');var utils=require(_0xdee0('0x1'));var members={};var exclude=[_0xdee0('0x2'),_0xdee0('0x3')];function writeDB(_0x10ae9e){utils[_0xdee0('0x4')](util[_0xdee0('0x5')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x10ae9e[_0xdee0('0x6')],_0x10ae9e[_0xdee0('0x7')],_0x10ae9e[_0xdee0('0x8')],_0x10ae9e['data2'],_0x10ae9e[_0xdee0('0x9')],_0x10ae9e[_0xdee0('0xa')]));if(_0x10ae9e[_0xdee0('0x7')]){utils[_0xdee0('0xb')](_0x10ae9e[_0xdee0('0x7')])['then'](function(_0x59dd8a){if(_0x59dd8a){_0x10ae9e['membername']=_0x59dd8a[_0xdee0('0xc')];_0x10ae9e[_0xdee0('0xd')]=_0x59dd8a[_0xdee0('0xd')];utils[_0xdee0('0xe')](_0xdee0('0xf'),_0x10ae9e);}else{utils['getUserByName'](_0x10ae9e[_0xdee0('0x7')][_0xdee0('0x10')]('/')[0x1])[_0xdee0('0x11')](function(_0x44f4be){if(_0x44f4be){_0x10ae9e[_0xdee0('0x9')]=_0x44f4be[_0xdee0('0xc')];_0x10ae9e[_0xdee0('0xd')]=_0x44f4be[_0xdee0('0xd')];utils[_0xdee0('0xe')](_0xdee0('0xf'),_0x10ae9e);}});}})['catch'](function(_0x4cce73){utils['error'](_0x4cce73);});}delete members[_0x10ae9e[_0xdee0('0x7')]];}function startsWith(_0x4e7fe1,_0x286967){return _['some'](_0x4e7fe1,function(_0x285b2c){return _[_0xdee0('0x12')](_0x286967,_0x285b2c);});}exports[_0xdee0('0x13')]=function(_0x4d0e03){switch(_0x4d0e03[_0xdee0('0x14')]){case'INUSE':case _0xdee0('0x15'):if(!startsWith(exclude,_0x4d0e03[_0xdee0('0x16')])){members[_0x4d0e03[_0xdee0('0x16')]]={'channel':_0xdee0('0x17'),'interface':_0x4d0e03[_0xdee0('0x16')],'type':'TALKING','enterAt':utils[_0xdee0('0x18')](),'role':_0xdee0('0x19')};}break;case'NOT_INUSE':if(!_[_0xdee0('0x1a')](members[_0x4d0e03[_0xdee0('0x16')]])){members[_0x4d0e03[_0xdee0('0x16')]][_0xdee0('0x1b')]=utils[_0xdee0('0x18')]();members[_0x4d0e03['device']][_0xdee0('0x1c')]=utils[_0xdee0('0x1d')](members[_0x4d0e03['device']][_0xdee0('0x1b')],members[_0x4d0e03[_0xdee0('0x16')]][_0xdee0('0x1e')]);if(members[_0x4d0e03[_0xdee0('0x16')]][_0xdee0('0x6')]){writeDB(members[_0x4d0e03[_0xdee0('0x16')]]);}}default:break;}};exports[_0xdee0('0x1f')]=function(_0x1041cb){if(!_[_0xdee0('0x1a')](members[_0x1041cb[_0xdee0('0x7')]])){members[_0x1041cb[_0xdee0('0x7')]]=_['assign'](members[_0x1041cb[_0xdee0('0x7')]],{'data4':_0x1041cb[_0xdee0('0x20')],'uniqueid':_0x1041cb[_0xdee0('0x6')]});}};exports[_0xdee0('0x21')]=function(_0x494e6a){if(_0x494e6a[_0xdee0('0x8')]){var _0x4534d2=_0x494e6a[_0xdee0('0x8')][_0xdee0('0x10')]('-')[0x0];if(!_[_0xdee0('0x1a')](members[_0x4534d2])){members[_0x4534d2]=_[_0xdee0('0x22')](members[_0x4534d2],{'data1':members[_0x4534d2][_0xdee0('0x23')]||_0x494e6a[_0xdee0('0xa')],'data2':members[_0x4534d2]['data2']||_0x494e6a[_0xdee0('0x24')],'data3':members[_0x4534d2][_0xdee0('0x25')]||_0x494e6a[_0xdee0('0x26')],'uniqueid':members[_0x4534d2]['uniqueid']||_0x494e6a[_0xdee0('0x6')]});if(members[_0x4534d2][_0xdee0('0x1b')]){writeDB(members[_0x4534d2]);}}}if(_0x494e6a[_0xdee0('0x27')]){var _0x5dccbb=_0x494e6a[_0xdee0('0x27')]['split']('-')[0x0];if(!_[_0xdee0('0x1a')](members[_0x5dccbb])){members[_0x5dccbb]=_[_0xdee0('0x22')](members[_0x5dccbb],{'data1':members[_0x5dccbb][_0xdee0('0x23')]||_0x494e6a[_0xdee0('0xa')],'data2':members[_0x5dccbb][_0xdee0('0x28')]||_0x494e6a[_0xdee0('0x24')],'data3':members[_0x5dccbb][_0xdee0('0x25')]||_0x494e6a[_0xdee0('0x26')],'uniqueid':members[_0x5dccbb]['uniqueid']||_0x494e6a[_0xdee0('0x6')]});if(members[_0x5dccbb]['exitAt']){writeDB(members[_0x5dccbb]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4cb50da..085fba6 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 _0x4d67=['format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','accountcode','getVoiceQueueByName','type','request','transfereduniqueid','queuecallerjoin','assign','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','now','queuecallerexitreason','queuecallerenterreason','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','agentconnect','assigned','membername','agentcomplete','queuecallercomplete','reason','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfer','transfertype','BLIND','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','secondtransfereruniqueid','transfertargetlinkedid','mohtime','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info'];(function(_0x4612f0,_0x224135){var _0x36eeb2=function(_0x498285){while(--_0x498285){_0x4612f0['push'](_0x4612f0['shift']());}};_0x36eeb2(++_0x224135);}(_0x4d67,0xe0));var _0x74d6=function(_0x51b12d,_0xf4dd4d){_0x51b12d=_0x51b12d-0x0;var _0x5c2dd3=_0x4d67[_0x51b12d];return _0x5c2dd3;};'use strict';var _=require(_0x74d6('0x0'));var util=require(_0x74d6('0x1'));var utils=require(_0x74d6('0x2'));var queues={};function writeDB(_0x7c7544){utils[_0x74d6('0x3')](util[_0x74d6('0x4')](_0x74d6('0x5'),_0x7c7544[_0x74d6('0x6')],_0x7c7544[_0x74d6('0x7')],_0x7c7544[_0x74d6('0x8')],_0x7c7544[_0x74d6('0x9')],_0x7c7544['calleridnum'],_0x7c7544[_0x74d6('0xa')],_0x7c7544['queuecallerexitreason']));if(_0x7c7544[_0x74d6('0x8')]){utils[_0x74d6('0xb')](_0x7c7544[_0x74d6('0x8')])['then'](function(_0x5ab2b6){if(_0x5ab2b6){_0x7c7544[_0x74d6('0xc')]=_0x5ab2b6[_0x74d6('0xc')];}utils[_0x74d6('0xd')]('CreateVoiceQueueReport',_0x7c7544);});}else{utils['request']('CreateVoiceQueueReport',_0x7c7544);}if(_0x7c7544['transfereduniqueid']){delete queues[_0x7c7544[_0x74d6('0xe')]];}else{delete queues[_0x7c7544['uniqueid']];}}exports[_0x74d6('0xf')]=function(_0x39bbc2){queues[_0x39bbc2[_0x74d6('0x6')]]=_[_0x74d6('0x10')](_0x39bbc2,{'originalposition':_0x39bbc2['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0x74d6('0x11')]=function(_0x34c436){if(!_[_0x74d6('0x12')](queues[_0x34c436[_0x74d6('0x6')]])){if(queues[_0x34c436['uniqueid']][_0x74d6('0x13')]){if(!queues[_0x34c436[_0x74d6('0x6')]][_0x74d6('0x14')]&&!queues[_0x34c436[_0x74d6('0x6')]]['queuecallerexit']){queues[_0x34c436[_0x74d6('0x6')]]['queuecallercomplete']=!![];queues[_0x34c436['uniqueid']][_0x74d6('0x15')]=utils[_0x74d6('0x16')]();queues[_0x34c436[_0x74d6('0x6')]][_0x74d6('0x17')]='COMPLETEDBYAGENT';}writeDB(queues[_0x34c436[_0x74d6('0x6')]]);}else{if(queues[_0x34c436[_0x74d6('0x6')]][_0x74d6('0xe')]){queues[queues[_0x34c436[_0x74d6('0x6')]][_0x74d6('0xe')]]=queues[_0x34c436[_0x74d6('0x6')]];queues[queues[_0x34c436[_0x74d6('0x6')]]['transfereduniqueid']][_0x74d6('0x18')]=0x2;delete queues[_0x34c436[_0x74d6('0x6')]];}}}};exports['varset']=function(_0x306440){if(!_[_0x74d6('0x12')](_0x306440[_0x74d6('0x19')][_0x74d6('0x1a')])&&_0x306440[_0x74d6('0x1b')][_0x74d6('0x1c')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x306440[_0x74d6('0x6')]])){queues[_0x306440['uniqueid']][_0x74d6('0x14')]=![];queues[_0x306440[_0x74d6('0x6')]][_0x74d6('0x1d')]=null;queues[_0x306440[_0x74d6('0x6')]][_0x74d6('0x1e')]=!![];queues[_0x306440['uniqueid']][_0x74d6('0x1f')]=utils[_0x74d6('0x16')]();queues[_0x306440[_0x74d6('0x6')]][_0x74d6('0x17')]=_0x306440[_0x74d6('0x1b')][_0x74d6('0x1c')]();writeDB(queues[_0x306440[_0x74d6('0x6')]]);}}else if(!_[_0x74d6('0x12')](_0x306440[_0x74d6('0x19')]['queueposition'])){if(!_[_0x74d6('0x12')](queues[_0x306440[_0x74d6('0x6')]])&&!queues[_0x306440[_0x74d6('0x6')]]['queuecallerabandon']){queues[_0x306440[_0x74d6('0x6')]][_0x74d6('0x14')]=![];queues[_0x306440['uniqueid']]['queuecallerabandonAt']=null;queues[_0x306440[_0x74d6('0x6')]][_0x74d6('0x1e')]=!![];queues[_0x306440['uniqueid']][_0x74d6('0x1f')]=utils[_0x74d6('0x16')]();queues[_0x306440[_0x74d6('0x6')]][_0x74d6('0x17')]=_0x74d6('0x20');}}};exports['queuecallerabandon']=function(_0x147477){if(!_[_0x74d6('0x12')](queues[_0x147477[_0x74d6('0x6')]])){queues[_0x147477[_0x74d6('0x6')]][_0x74d6('0x1e')]=![];queues[_0x147477[_0x74d6('0x6')]][_0x74d6('0x1f')]=null;queues[_0x147477[_0x74d6('0x6')]][_0x74d6('0x14')]=!![];queues[_0x147477['uniqueid']][_0x74d6('0x1d')]=utils[_0x74d6('0x16')]();queues[_0x147477['uniqueid']]['queuecallerexitreason']=_0x74d6('0x21');}};exports[_0x74d6('0x22')]=function(_0x3b143e){if(!_[_0x74d6('0x12')](queues[_0x3b143e['uniqueid']])){queues[_0x3b143e[_0x74d6('0x6')]]['queuecallerleave']=!![];queues[_0x3b143e[_0x74d6('0x6')]][_0x74d6('0x13')]=utils[_0x74d6('0x16')]();queues[_0x3b143e[_0x74d6('0x6')]][_0x74d6('0x23')]=utils[_0x74d6('0x24')](queues[_0x3b143e[_0x74d6('0x6')]][_0x74d6('0x13')],queues[_0x3b143e[_0x74d6('0x6')]][_0x74d6('0x25')]);queues[_0x3b143e[_0x74d6('0x6')]][_0x74d6('0x26')]=_0x3b143e['position'];queues[_0x3b143e[_0x74d6('0x6')]][_0x74d6('0x27')]=_0x3b143e[_0x74d6('0x27')];queues[_0x3b143e[_0x74d6('0x6')]][_0x74d6('0x28')]=_0x3b143e[_0x74d6('0x28')];queues[_0x3b143e[_0x74d6('0x6')]][_0x74d6('0x29')]=_0x3b143e[_0x74d6('0x29')];}};exports[_0x74d6('0x2a')]=function(_0x4aa69a){if(!_['isNil'](queues[_0x4aa69a['uniqueid']])){queues[_0x4aa69a[_0x74d6('0x6')]]['queuecallerabandon']=![];queues[_0x4aa69a[_0x74d6('0x6')]][_0x74d6('0x14')]=![];queues[_0x4aa69a[_0x74d6('0x6')]][_0x74d6('0x1d')]=null;queues[_0x4aa69a['uniqueid']][_0x74d6('0x1e')]=![];queues[_0x4aa69a['uniqueid']]['queuecallerexitreason']=null;queues[_0x4aa69a[_0x74d6('0x6')]][_0x74d6('0x1f')]=null;queues[_0x4aa69a[_0x74d6('0x6')]][_0x74d6('0x2b')]=!![];queues[_0x4aa69a[_0x74d6('0x6')]]['accountcode']=_0x4aa69a['destaccountcode'];queues[_0x4aa69a[_0x74d6('0x6')]]['lastAssignedTo']=_0x4aa69a[_0x74d6('0x2c')];}};exports[_0x74d6('0x2d')]=function(_0x33075f){if(!_[_0x74d6('0x12')](queues[_0x33075f['uniqueid']])){if(queues[_0x33075f[_0x74d6('0x6')]][_0x74d6('0x13')]){queues[_0x33075f[_0x74d6('0x6')]]['queuecallerabandon']=![];queues[_0x33075f[_0x74d6('0x6')]][_0x74d6('0x14')]=![];queues[_0x33075f[_0x74d6('0x6')]][_0x74d6('0x1d')]=null;queues[_0x33075f[_0x74d6('0x6')]][_0x74d6('0x1e')]=![];queues[_0x33075f[_0x74d6('0x6')]][_0x74d6('0x1f')]=null;queues[_0x33075f[_0x74d6('0x6')]][_0x74d6('0x2b')]=!![];queues[_0x33075f[_0x74d6('0x6')]][_0x74d6('0x9')]=_0x33075f['membername'];queues[_0x33075f[_0x74d6('0x6')]][_0x74d6('0x2e')]=!![];queues[_0x33075f['uniqueid']][_0x74d6('0x15')]=utils[_0x74d6('0x16')]();if(_0x33075f[_0x74d6('0x2f')]=='transfer'){if(!queues[_0x33075f[_0x74d6('0x6')]]['transfer']){queues[_0x33075f['uniqueid']]['queuecallerexitreason']=_0x74d6('0x30');}}else{queues[_0x33075f['uniqueid']][_0x74d6('0x17')]=_0x74d6('0x31')+_0x33075f['reason'][_0x74d6('0x1c')]();}writeDB(queues[_0x33075f[_0x74d6('0x6')]]);}}};exports[_0x74d6('0x32')]=function(_0x3fc9a3){if(!_[_0x74d6('0x12')](queues[_0x3fc9a3[_0x74d6('0x33')]])){queues[_0x3fc9a3[_0x74d6('0x33')]][_0x74d6('0x34')]=!![];queues[_0x3fc9a3['transfereeuniqueid']][_0x74d6('0x35')]=_0x74d6('0x36');queues[_0x3fc9a3[_0x74d6('0x33')]]['transferexten']=_0x3fc9a3[_0x74d6('0x37')];queues[_0x3fc9a3[_0x74d6('0x33')]][_0x74d6('0x38')]=_0x3fc9a3[_0x74d6('0x33')];queues[_0x3fc9a3['transfereeuniqueid']][_0x74d6('0x17')]='BLINDTRANSFER';}};exports['attendedtransfer']=function(_0x36a154){try{if(_0x36a154[_0x74d6('0x39')]==_0x36a154[_0x74d6('0x3a')]){if(!_[_0x74d6('0x12')](queues[_0x36a154[_0x74d6('0x3b')]])){queues[_0x36a154[_0x74d6('0x3b')]][_0x74d6('0x34')]=!![];queues[_0x36a154[_0x74d6('0x3b')]][_0x74d6('0x35')]=_0x74d6('0x3c');queues[_0x36a154[_0x74d6('0x3b')]][_0x74d6('0x3d')]=_0x36a154[_0x74d6('0x3e')];queues[_0x36a154[_0x74d6('0x3b')]]['transferuniqueid']=_0x36a154['origtransfereruniqueid'];queues[_0x36a154['secondtransfererlinkedid']][_0x74d6('0x17')]=_0x74d6('0x3f');}if(!_[_0x74d6('0x12')](queues[_0x36a154['origtransfererlinkedid']])){if(_0x36a154['transfereelinkedid']&&queues[_0x36a154['transfereelinkedid']]){queues[_0x36a154['transfereelinkedid']][_0x74d6('0x18')]=0x1;queues[_0x36a154[_0x74d6('0x33')]]=_['clone'](queues[_0x36a154[_0x74d6('0x40')]]);queues[_0x36a154[_0x74d6('0x33')]]['transfereduniqueid']=_0x36a154[_0x74d6('0x41')];queues[_0x36a154[_0x74d6('0x33')]][_0x74d6('0x18')]=0x2;queues[_0x36a154[_0x74d6('0x33')]][_0x74d6('0x42')]=queues[_0x36a154['secondtransfererlinkedid']][_0x74d6('0x42')];queues[_0x36a154[_0x74d6('0x33')]]['calleridname']=queues[_0x36a154[_0x74d6('0x3b')]][_0x74d6('0x43')];queues[_0x36a154[_0x74d6('0x33')]][_0x74d6('0x25')]=utils['now']();queues[_0x36a154['transfereeuniqueid']][_0x74d6('0x13')]=utils[_0x74d6('0x16')]();queues[_0x36a154[_0x74d6('0x33')]][_0x74d6('0x23')]=0x0;queues[_0x36a154[_0x74d6('0x33')]]['mohtime']=0x0;}else{queues[_0x36a154[_0x74d6('0x3a')]]['transfereduniqueid']=_0x36a154[_0x74d6('0x3b')];}}}else if(_0x36a154['secondtransfereruniqueid']==_0x36a154[_0x74d6('0x3b')]){if(!_[_0x74d6('0x12')](queues[_0x36a154[_0x74d6('0x3a')]])){queues[_0x36a154['origtransfererlinkedid']][_0x74d6('0x34')]=!![];queues[_0x36a154['origtransfererlinkedid']][_0x74d6('0x35')]=_0x74d6('0x3c');queues[_0x36a154['origtransfererlinkedid']][_0x74d6('0x3d')]=_0x36a154['secondtransfererexten'];queues[_0x36a154['origtransfererlinkedid']]['transferuniqueid']=_0x36a154[_0x74d6('0x44')];queues[_0x36a154['origtransfererlinkedid']][_0x74d6('0x17')]='ATTENDEDTRANSFER';}if(!_[_0x74d6('0x12')](queues[_0x36a154[_0x74d6('0x3b')]])){if(_0x36a154[_0x74d6('0x45')]&&queues[_0x36a154[_0x74d6('0x45')]]){queues[_0x36a154[_0x74d6('0x45')]]['queuecallerenterreason']=0x1;queues[_0x36a154[_0x74d6('0x41')]]=_['clone'](queues[_0x36a154[_0x74d6('0x45')]]);queues[_0x36a154[_0x74d6('0x41')]]['transfereduniqueid']=_0x36a154['transfertargetuniqueid'];queues[_0x36a154[_0x74d6('0x41')]][_0x74d6('0x18')]=0x2;queues[_0x36a154[_0x74d6('0x41')]][_0x74d6('0x42')]=queues[_0x36a154['origtransfererlinkedid']][_0x74d6('0x42')];queues[_0x36a154[_0x74d6('0x41')]][_0x74d6('0x43')]=queues[_0x36a154[_0x74d6('0x3a')]]['calleridname'];queues[_0x36a154[_0x74d6('0x41')]][_0x74d6('0x25')]=utils[_0x74d6('0x16')]();queues[_0x36a154[_0x74d6('0x41')]]['queuecallerleaveAt']=utils['now']();queues[_0x36a154['transfertargetuniqueid']][_0x74d6('0x23')]=0x0;queues[_0x36a154[_0x74d6('0x41')]][_0x74d6('0x46')]=0x0;}else{queues[_0x36a154['secondtransfererlinkedid']][_0x74d6('0xe')]=_0x36a154[_0x74d6('0x3a')];}}}}catch(_0x59ab98){utils[_0x74d6('0x47')](_0x59ab98[_0x74d6('0x48')]);}};exports[_0x74d6('0x49')]=function(_0x413bfb){if(!_[_0x74d6('0x12')](queues[_0x413bfb[_0x74d6('0x6')]])){queues[_0x413bfb[_0x74d6('0x6')]][_0x74d6('0x4a')]=utils[_0x74d6('0x16')]();}};exports[_0x74d6('0x4b')]=function(_0x266ea7){if(!_[_0x74d6('0x12')](queues[_0x266ea7[_0x74d6('0x6')]])){if(!_['isNil'](queues[_0x266ea7['uniqueid']][_0x74d6('0x4a')])){queues[_0x266ea7[_0x74d6('0x6')]][_0x74d6('0x46')]+=utils['diffTime'](utils['now'](),queues[_0x266ea7['uniqueid']]['musiconholdstartAt']);delete queues[_0x266ea7[_0x74d6('0x6')]][_0x74d6('0x4a')];}}}; \ No newline at end of file +var _0xea5f=['lastAssignedTo','agentcomplete','membername','transfer','blindtransfer','transfereeuniqueid','transfertype','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transferexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','error','stack','musiconholdstart','musiconholdstartAt','lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','assign','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queuecallerexitreason','toUpperCase','queueposition','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode'];(function(_0x16098e,_0x54c595){var _0x4474cb=function(_0x47bb1d){while(--_0x47bb1d){_0x16098e['push'](_0x16098e['shift']());}};_0x4474cb(++_0x54c595);}(_0xea5f,0x1a7));var _0xfea5=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xea5f[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xfea5('0x0'));var util=require('util');var utils=require(_0xfea5('0x1'));var queues={};function writeDB(_0x4c6011){utils[_0xfea5('0x2')](util[_0xfea5('0x3')](_0xfea5('0x4'),_0x4c6011[_0xfea5('0x5')],_0x4c6011[_0xfea5('0x6')],_0x4c6011[_0xfea5('0x7')],_0x4c6011['lastAssignedTo'],_0x4c6011[_0xfea5('0x8')],_0x4c6011[_0xfea5('0x9')],_0x4c6011['queuecallerexitreason']));if(_0x4c6011['queue']){utils[_0xfea5('0xa')](_0x4c6011['queue'])[_0xfea5('0xb')](function(_0x41f34e){if(_0x41f34e){_0x4c6011[_0xfea5('0xc')]=_0x41f34e[_0xfea5('0xc')];}utils['request'](_0xfea5('0xd'),_0x4c6011);});}else{utils[_0xfea5('0xe')](_0xfea5('0xd'),_0x4c6011);}if(_0x4c6011[_0xfea5('0xf')]){delete queues[_0x4c6011[_0xfea5('0xf')]];}else{delete queues[_0x4c6011[_0xfea5('0x5')]];}}exports[_0xfea5('0x10')]=function(_0x34ab36){queues[_0x34ab36['uniqueid']]=_[_0xfea5('0x11')](_0x34ab36,{'originalposition':_0x34ab36['position'],'queuecallerjoinAt':utils[_0xfea5('0x12')](),'mohtime':0x0});};exports[_0xfea5('0x13')]=function(_0x352db3){if(!_[_0xfea5('0x14')](queues[_0x352db3[_0xfea5('0x5')]])){if(queues[_0x352db3[_0xfea5('0x5')]][_0xfea5('0x15')]){if(!queues[_0x352db3[_0xfea5('0x5')]][_0xfea5('0x16')]&&!queues[_0x352db3[_0xfea5('0x5')]][_0xfea5('0x17')]){queues[_0x352db3[_0xfea5('0x5')]][_0xfea5('0x18')]=!![];queues[_0x352db3['uniqueid']][_0xfea5('0x19')]=utils[_0xfea5('0x12')]();queues[_0x352db3[_0xfea5('0x5')]]['queuecallerexitreason']=_0xfea5('0x1a');}writeDB(queues[_0x352db3[_0xfea5('0x5')]]);}else{if(queues[_0x352db3['uniqueid']]['transfereduniqueid']){queues[queues[_0x352db3[_0xfea5('0x5')]][_0xfea5('0xf')]]=queues[_0x352db3[_0xfea5('0x5')]];queues[queues[_0x352db3['uniqueid']]['transfereduniqueid']][_0xfea5('0x1b')]=0x2;delete queues[_0x352db3[_0xfea5('0x5')]];}}}};exports[_0xfea5('0x1c')]=function(_0x20b082){if(!_[_0xfea5('0x14')](_0x20b082[_0xfea5('0x1d')][_0xfea5('0x1e')])&&_0x20b082[_0xfea5('0x1f')]['toUpperCase']()!==_0xfea5('0x20')){if(!_[_0xfea5('0x14')](queues[_0x20b082['uniqueid']])){queues[_0x20b082[_0xfea5('0x5')]][_0xfea5('0x16')]=![];queues[_0x20b082['uniqueid']][_0xfea5('0x21')]=null;queues[_0x20b082[_0xfea5('0x5')]][_0xfea5('0x17')]=!![];queues[_0x20b082['uniqueid']][_0xfea5('0x22')]=utils[_0xfea5('0x12')]();queues[_0x20b082[_0xfea5('0x5')]][_0xfea5('0x23')]=_0x20b082[_0xfea5('0x1f')][_0xfea5('0x24')]();writeDB(queues[_0x20b082[_0xfea5('0x5')]]);}}else if(!_[_0xfea5('0x14')](_0x20b082[_0xfea5('0x1d')][_0xfea5('0x25')])){if(!_[_0xfea5('0x14')](queues[_0x20b082[_0xfea5('0x5')]])&&!queues[_0x20b082[_0xfea5('0x5')]][_0xfea5('0x16')]){queues[_0x20b082[_0xfea5('0x5')]][_0xfea5('0x16')]=![];queues[_0x20b082[_0xfea5('0x5')]]['queuecallerabandonAt']=null;queues[_0x20b082[_0xfea5('0x5')]][_0xfea5('0x17')]=!![];queues[_0x20b082[_0xfea5('0x5')]][_0xfea5('0x22')]=utils[_0xfea5('0x12')]();queues[_0x20b082['uniqueid']]['queuecallerexitreason']=_0xfea5('0x26');}}};exports[_0xfea5('0x16')]=function(_0x3b3884){if(!_[_0xfea5('0x14')](queues[_0x3b3884[_0xfea5('0x5')]])){queues[_0x3b3884[_0xfea5('0x5')]][_0xfea5('0x17')]=![];queues[_0x3b3884[_0xfea5('0x5')]][_0xfea5('0x22')]=null;queues[_0x3b3884['uniqueid']][_0xfea5('0x16')]=!![];queues[_0x3b3884['uniqueid']][_0xfea5('0x21')]=utils[_0xfea5('0x12')]();queues[_0x3b3884[_0xfea5('0x5')]][_0xfea5('0x23')]=_0xfea5('0x27');}};exports['queuecallerleave']=function(_0x37af40){if(!_[_0xfea5('0x14')](queues[_0x37af40['uniqueid']])){queues[_0x37af40['uniqueid']][_0xfea5('0x28')]=!![];queues[_0x37af40[_0xfea5('0x5')]]['queuecallerleaveAt']=utils[_0xfea5('0x12')]();queues[_0x37af40[_0xfea5('0x5')]][_0xfea5('0x29')]=utils[_0xfea5('0x2a')](queues[_0x37af40['uniqueid']]['queuecallerleaveAt'],queues[_0x37af40[_0xfea5('0x5')]][_0xfea5('0x2b')]);queues[_0x37af40[_0xfea5('0x5')]][_0xfea5('0x2c')]=_0x37af40[_0xfea5('0x2c')];queues[_0x37af40['uniqueid']][_0xfea5('0x2d')]=_0x37af40['count'];queues[_0x37af40[_0xfea5('0x5')]][_0xfea5('0x2e')]=_0x37af40[_0xfea5('0x2e')];queues[_0x37af40[_0xfea5('0x5')]][_0xfea5('0x2f')]=_0x37af40[_0xfea5('0x2f')];}};exports[_0xfea5('0x30')]=function(_0x2c025a){if(!_[_0xfea5('0x14')](queues[_0x2c025a[_0xfea5('0x5')]])){queues[_0x2c025a[_0xfea5('0x5')]]['queuecallerabandon']=![];queues[_0x2c025a[_0xfea5('0x5')]][_0xfea5('0x16')]=![];queues[_0x2c025a[_0xfea5('0x5')]]['queuecallerabandonAt']=null;queues[_0x2c025a['uniqueid']][_0xfea5('0x17')]=![];queues[_0x2c025a[_0xfea5('0x5')]][_0xfea5('0x23')]=null;queues[_0x2c025a['uniqueid']][_0xfea5('0x22')]=null;queues[_0x2c025a[_0xfea5('0x5')]][_0xfea5('0x31')]=!![];queues[_0x2c025a[_0xfea5('0x5')]][_0xfea5('0x9')]=_0x2c025a[_0xfea5('0x32')];queues[_0x2c025a['uniqueid']][_0xfea5('0x33')]=_0x2c025a['membername'];}};exports[_0xfea5('0x34')]=function(_0x2cb21a){if(!_[_0xfea5('0x14')](queues[_0x2cb21a[_0xfea5('0x5')]])){if(queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x15')]){queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x16')]=![];queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x16')]=![];queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x21')]=null;queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x17')]=![];queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x22')]=null;queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x31')]=!![];queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x33')]=_0x2cb21a[_0xfea5('0x35')];queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x18')]=!![];queues[_0x2cb21a[_0xfea5('0x5')]]['queuecallercompleteAt']=utils[_0xfea5('0x12')]();if(_0x2cb21a['reason']==_0xfea5('0x36')){if(!queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x36')]){queues[_0x2cb21a[_0xfea5('0x5')]][_0xfea5('0x23')]='TRANSFER';}}else{queues[_0x2cb21a['uniqueid']][_0xfea5('0x23')]='COMPLETEDBY'+_0x2cb21a['reason'][_0xfea5('0x24')]();}writeDB(queues[_0x2cb21a[_0xfea5('0x5')]]);}}};exports[_0xfea5('0x37')]=function(_0x5ce9e7){if(!_[_0xfea5('0x14')](queues[_0x5ce9e7[_0xfea5('0x38')]])){queues[_0x5ce9e7[_0xfea5('0x38')]][_0xfea5('0x36')]=!![];queues[_0x5ce9e7[_0xfea5('0x38')]][_0xfea5('0x39')]='BLIND';queues[_0x5ce9e7[_0xfea5('0x38')]]['transferexten']=_0x5ce9e7[_0xfea5('0x3a')];queues[_0x5ce9e7[_0xfea5('0x38')]][_0xfea5('0x3b')]=_0x5ce9e7[_0xfea5('0x38')];queues[_0x5ce9e7[_0xfea5('0x38')]][_0xfea5('0x23')]=_0xfea5('0x3c');}};exports[_0xfea5('0x3d')]=function(_0x2cd4a1){try{if(_0x2cd4a1[_0xfea5('0x3e')]==_0x2cd4a1[_0xfea5('0x3f')]){if(!_[_0xfea5('0x14')](queues[_0x2cd4a1[_0xfea5('0x40')]])){queues[_0x2cd4a1[_0xfea5('0x40')]][_0xfea5('0x36')]=!![];queues[_0x2cd4a1['secondtransfererlinkedid']][_0xfea5('0x39')]='ATTENDED';queues[_0x2cd4a1[_0xfea5('0x40')]][_0xfea5('0x41')]=_0x2cd4a1['origtransfererexten'];queues[_0x2cd4a1[_0xfea5('0x40')]][_0xfea5('0x3b')]=_0x2cd4a1[_0xfea5('0x3e')];queues[_0x2cd4a1[_0xfea5('0x40')]][_0xfea5('0x23')]='ATTENDEDTRANSFER';}if(!_[_0xfea5('0x14')](queues[_0x2cd4a1[_0xfea5('0x3f')]])){if(_0x2cd4a1[_0xfea5('0x42')]&&queues[_0x2cd4a1['transfereelinkedid']]){queues[_0x2cd4a1['transfereelinkedid']][_0xfea5('0x1b')]=0x1;queues[_0x2cd4a1[_0xfea5('0x38')]]=_[_0xfea5('0x43')](queues[_0x2cd4a1[_0xfea5('0x42')]]);queues[_0x2cd4a1['transfereeuniqueid']][_0xfea5('0xf')]=_0x2cd4a1[_0xfea5('0x44')];queues[_0x2cd4a1[_0xfea5('0x38')]][_0xfea5('0x1b')]=0x2;queues[_0x2cd4a1['transfereeuniqueid']][_0xfea5('0x8')]=queues[_0x2cd4a1['secondtransfererlinkedid']][_0xfea5('0x8')];queues[_0x2cd4a1[_0xfea5('0x38')]]['calleridname']=queues[_0x2cd4a1[_0xfea5('0x40')]][_0xfea5('0x45')];queues[_0x2cd4a1[_0xfea5('0x38')]][_0xfea5('0x2b')]=utils[_0xfea5('0x12')]();queues[_0x2cd4a1[_0xfea5('0x38')]][_0xfea5('0x15')]=utils[_0xfea5('0x12')]();queues[_0x2cd4a1[_0xfea5('0x38')]]['holdtime']=0x0;queues[_0x2cd4a1[_0xfea5('0x38')]][_0xfea5('0x46')]=0x0;}else{queues[_0x2cd4a1['origtransfererlinkedid']][_0xfea5('0xf')]=_0x2cd4a1[_0xfea5('0x40')];}}}else if(_0x2cd4a1[_0xfea5('0x47')]==_0x2cd4a1[_0xfea5('0x40')]){if(!_['isNil'](queues[_0x2cd4a1['origtransfererlinkedid']])){queues[_0x2cd4a1['origtransfererlinkedid']]['transfer']=!![];queues[_0x2cd4a1['origtransfererlinkedid']][_0xfea5('0x39')]=_0xfea5('0x48');queues[_0x2cd4a1[_0xfea5('0x3f')]][_0xfea5('0x41')]=_0x2cd4a1[_0xfea5('0x49')];queues[_0x2cd4a1[_0xfea5('0x3f')]][_0xfea5('0x3b')]=_0x2cd4a1[_0xfea5('0x47')];queues[_0x2cd4a1[_0xfea5('0x3f')]][_0xfea5('0x23')]='ATTENDEDTRANSFER';}if(!_[_0xfea5('0x14')](queues[_0x2cd4a1[_0xfea5('0x40')]])){if(_0x2cd4a1['transfertargetlinkedid']&&queues[_0x2cd4a1[_0xfea5('0x4a')]]){queues[_0x2cd4a1['transfertargetlinkedid']][_0xfea5('0x1b')]=0x1;queues[_0x2cd4a1[_0xfea5('0x44')]]=_[_0xfea5('0x43')](queues[_0x2cd4a1['transfertargetlinkedid']]);queues[_0x2cd4a1[_0xfea5('0x44')]][_0xfea5('0xf')]=_0x2cd4a1[_0xfea5('0x44')];queues[_0x2cd4a1[_0xfea5('0x44')]][_0xfea5('0x1b')]=0x2;queues[_0x2cd4a1[_0xfea5('0x44')]][_0xfea5('0x8')]=queues[_0x2cd4a1[_0xfea5('0x3f')]][_0xfea5('0x8')];queues[_0x2cd4a1[_0xfea5('0x44')]][_0xfea5('0x45')]=queues[_0x2cd4a1[_0xfea5('0x3f')]][_0xfea5('0x45')];queues[_0x2cd4a1[_0xfea5('0x44')]][_0xfea5('0x2b')]=utils[_0xfea5('0x12')]();queues[_0x2cd4a1[_0xfea5('0x44')]][_0xfea5('0x15')]=utils['now']();queues[_0x2cd4a1[_0xfea5('0x44')]][_0xfea5('0x29')]=0x0;queues[_0x2cd4a1['transfertargetuniqueid']][_0xfea5('0x46')]=0x0;}else{queues[_0x2cd4a1[_0xfea5('0x40')]][_0xfea5('0xf')]=_0x2cd4a1['origtransfererlinkedid'];}}}}catch(_0x412646){utils[_0xfea5('0x4b')](_0x412646[_0xfea5('0x4c')]);}};exports[_0xfea5('0x4d')]=function(_0xba55a5){if(!_[_0xfea5('0x14')](queues[_0xba55a5[_0xfea5('0x5')]])){queues[_0xba55a5[_0xfea5('0x5')]][_0xfea5('0x4e')]=utils['now']();}};exports['musiconholdstop']=function(_0x822369){if(!_[_0xfea5('0x14')](queues[_0x822369[_0xfea5('0x5')]])){if(!_['isNil'](queues[_0x822369['uniqueid']][_0xfea5('0x4e')])){queues[_0x822369[_0xfea5('0x5')]][_0xfea5('0x46')]+=utils[_0xfea5('0x2a')](utils['now'](),queues[_0x822369[_0xfea5('0x5')]][_0xfea5('0x4e')]);delete queues[_0x822369[_0xfea5('0x5')]]['musiconholdstartAt'];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 47e2ddd..2fc6651 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 _0x9c44=['getUserByInternal','then','name','request','CreateVoiceRecording','newchannel','uniqueid','linkedid','context','channel','error','stack','isNil','transfer','variable','endsWith','value','replace','.wav49','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode'];(function(_0x544d95,_0x3ef92b){var _0x3ba9a7=function(_0x4251fd){while(--_0x4251fd){_0x544d95['push'](_0x544d95['shift']());}};_0x3ba9a7(++_0x3ef92b);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x1ffbbf){utils[_0x49c4('0x0')](_0x1ffbbf);if(_0x1ffbbf[_0x49c4('0x1')]){utils[_0x49c4('0x2')](_0x1ffbbf[_0x49c4('0x1')])[_0x49c4('0x3')](function(_0x4e0313){if(_0x4e0313){_0x1ffbbf['membername']=_0x4e0313[_0x49c4('0x4')];_0x1ffbbf['UserId']=_0x4e0313['id'];}utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);});}else{utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);}}exports[_0x49c4('0x7')]=function(_0x511d53){try{if(_0x511d53[_0x49c4('0x8')]==_0x511d53[_0x49c4('0x9')]){recordings[_0x511d53[_0x49c4('0x8')]]={'uniqueid':_0x511d53[_0x49c4('0x8')],'accountcode':_0x511d53['accountcode'],'exten':_0x511d53['exten'],'context':_0x511d53[_0x49c4('0xa')],'channel':_0x511d53[_0x49c4('0xb')],'monitors':[]};}}catch(_0x58cad7){utils[_0x49c4('0xc')](_0x58cad7[_0x49c4('0xd')]);}};exports['newstate']=function(_0x536d42){try{if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x8')]])&&_0x536d42['channelstate']==0x6){}else if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x9')]])&&_0x536d42['channelstate']==0x6&&_0x536d42[_0x49c4('0xa')]!=_0x49c4('0xf')){recordings[_0x536d42[_0x49c4('0x9')]][_0x49c4('0x1')]=_0x536d42[_0x49c4('0x1')];}}catch(_0x18211c){utils[_0x49c4('0xc')](_0x18211c[_0x49c4('0xd')]);}};exports['varset']=function(_0x3acd06){try{if(!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')])&&!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')]['mixmonitor_filename'])){if(_[_0x49c4('0x11')](_0x3acd06[_0x49c4('0x12')],'.wav49')){_0x3acd06['value']=_0x3acd06[_0x49c4('0x12')][_0x49c4('0x13')](_0x49c4('0x14'),'.WAV');}if(recordings[_0x3acd06[_0x49c4('0x9')]]){var _0x50b151=_[_0x49c4('0x15')](recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')],{'value':_0x3acd06[_0x49c4('0x12')]});if(_[_0x49c4('0xe')](_0x50b151)){recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')][_0x49c4('0x17')]({'value':_0x3acd06[_0x49c4('0x12')]});}}}}catch(_0x578447){utils['error'](_0x578447['stack']);}};exports[_0x49c4('0x18')]=function(_0x4f0b62){try{if(!_['isNil'](recordings[_0x4f0b62[_0x49c4('0x8')]])){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x19')]=_0x4f0b62[_0x49c4('0x19')];recordings[_0x4f0b62['uniqueid']]['calleridname']=_0x4f0b62[_0x49c4('0x1a')];recordings[_0x4f0b62[_0x49c4('0x8')]]['connectedlinenum']=_0x4f0b62[_0x49c4('0x1b')];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]=_0x4f0b62[_0x49c4('0x1c')];if(recordings[_0x4f0b62['uniqueid']]['type']==_0x49c4('0x1d')&&recordings[_0x4f0b62['uniqueid']][_0x49c4('0x1')]){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1b')]=recordings[_0x4f0b62[_0x49c4('0x8')]]['accountcode'];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]='';}recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x16')][_0x49c4('0x1e')](_0x29f835=>{var _0x26ba17=_[_0x49c4('0x1f')](recordings[_0x4f0b62[_0x49c4('0x8')]]);_0x26ba17[_0x49c4('0x12')]=_0x29f835[_0x49c4('0x12')];writeDB(_0x26ba17);});delete recordings[_0x4f0b62['uniqueid']];}}catch(_0x4f4495){utils['error'](_0x4f4495[_0x49c4('0xd')]);}};exports[_0x49c4('0x20')]=function(_0x1eb035){try{if(!_[_0x49c4('0xe')](recordings[_0x1eb035[_0x49c4('0x8')]])){if(_0x1eb035['application'][_0x49c4('0x21')]()==_0x49c4('0x22')&&_[_0x49c4('0x23')](_0x1eb035[_0x49c4('0x24')]['toLowerCase'](),'cdr')){var _0xce57ef=_0x1eb035[_0x49c4('0x24')][_0x49c4('0x25')]('=');var _0x13b3b4=_0xce57ef[0x0][_0x49c4('0x26')](_0xce57ef[0x0]['lastIndexOf']('(')+0x1,_0xce57ef[0x0][_0x49c4('0x27')](')'));var _0x84c621=_0xce57ef[0x1];recordings[_0x1eb035[_0x49c4('0x8')]][_0x13b3b4]=_0x84c621;}}}catch(_0x512d02){utils['error'](_0x512d02[_0x49c4('0xd')]);}};exports[_0x49c4('0x28')]=function(_0x3bec0a){try{if(!_[_0x49c4('0xe')](recordings[_0x3bec0a[_0x49c4('0x8')]])){recordings[_0x3bec0a[_0x49c4('0x8')]][_0x49c4('0x29')]=_0x3bec0a[_0x49c4('0x29')];}}catch(_0x3209cd){utils['error'](_0x3209cd[_0x49c4('0xd')]);}}; \ No newline at end of file +var _0x70e0=['.WAV','find','monitors','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','set','appdata','toLowerCase','split','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','accountcode','then','name','request','newchannel','uniqueid','linkedid','channel','error','stack','newstate','isNil','channelstate','transfer','variable','endsWith','value','.wav49'];(function(_0x5cd9b2,_0x26f267){var _0x37002b=function(_0x107d66){while(--_0x107d66){_0x5cd9b2['push'](_0x5cd9b2['shift']());}};_0x37002b(++_0x26f267);}(_0x70e0,0x17b));var _0x070e=function(_0x238423,_0x5ddc28){_0x238423=_0x238423-0x0;var _0x3ec89e=_0x70e0[_0x238423];return _0x3ec89e;};'use strict';var _=require(_0x070e('0x0'));var utils=require(_0x070e('0x1'));var recordings={};function writeDB(_0x198c2e){utils['debug'](_0x198c2e);if(_0x198c2e['accountcode']){utils[_0x070e('0x2')](_0x198c2e[_0x070e('0x3')])[_0x070e('0x4')](function(_0x2593e5){if(_0x2593e5){_0x198c2e['membername']=_0x2593e5[_0x070e('0x5')];_0x198c2e['UserId']=_0x2593e5['id'];}utils[_0x070e('0x6')]('CreateVoiceRecording',_0x198c2e);});}else{utils['request']('CreateVoiceRecording',_0x198c2e);}}exports[_0x070e('0x7')]=function(_0x1e11f0){try{if(_0x1e11f0[_0x070e('0x8')]==_0x1e11f0[_0x070e('0x9')]){recordings[_0x1e11f0[_0x070e('0x8')]]={'uniqueid':_0x1e11f0[_0x070e('0x8')],'accountcode':_0x1e11f0[_0x070e('0x3')],'exten':_0x1e11f0['exten'],'context':_0x1e11f0['context'],'channel':_0x1e11f0[_0x070e('0xa')],'monitors':[]};}}catch(_0x2e3e5e){utils[_0x070e('0xb')](_0x2e3e5e[_0x070e('0xc')]);}};exports[_0x070e('0xd')]=function(_0xffcdd6){try{if(!_[_0x070e('0xe')](recordings[_0xffcdd6[_0x070e('0x8')]])&&_0xffcdd6[_0x070e('0xf')]==0x6){}else if(!_[_0x070e('0xe')](recordings[_0xffcdd6[_0x070e('0x9')]])&&_0xffcdd6['channelstate']==0x6&&_0xffcdd6['context']!=_0x070e('0x10')){recordings[_0xffcdd6['linkedid']]['accountcode']=_0xffcdd6['accountcode'];}}catch(_0x11d2ce){utils[_0x070e('0xb')](_0x11d2ce['stack']);}};exports['varset']=function(_0x373d86){try{if(!_[_0x070e('0xe')](_0x373d86[_0x070e('0x11')])&&!_[_0x070e('0xe')](_0x373d86['variable']['mixmonitor_filename'])){if(_[_0x070e('0x12')](_0x373d86[_0x070e('0x13')],_0x070e('0x14'))){_0x373d86[_0x070e('0x13')]=_0x373d86[_0x070e('0x13')]['replace'](_0x070e('0x14'),_0x070e('0x15'));}if(recordings[_0x373d86[_0x070e('0x9')]]){var _0x3ea105=_[_0x070e('0x16')](recordings[_0x373d86['linkedid']]['monitors'],{'value':_0x373d86['value']});if(_[_0x070e('0xe')](_0x3ea105)){recordings[_0x373d86[_0x070e('0x9')]][_0x070e('0x17')]['push']({'value':_0x373d86[_0x070e('0x13')]});}}}}catch(_0x5dc5d2){utils[_0x070e('0xb')](_0x5dc5d2[_0x070e('0xc')]);}};exports[_0x070e('0x18')]=function(_0x33e8c6){try{if(!_[_0x070e('0xe')](recordings[_0x33e8c6[_0x070e('0x8')]])){recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x19')]=_0x33e8c6['calleridnum'];recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1a')]=_0x33e8c6[_0x070e('0x1a')];recordings[_0x33e8c6['uniqueid']][_0x070e('0x1b')]=_0x33e8c6['connectedlinenum'];recordings[_0x33e8c6['uniqueid']][_0x070e('0x1c')]=_0x33e8c6[_0x070e('0x1c')];if(recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1d')]==_0x070e('0x1e')&&recordings[_0x33e8c6['uniqueid']][_0x070e('0x3')]){recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1b')]=recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x3')];recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1c')]='';}recordings[_0x33e8c6[_0x070e('0x8')]]['monitors'][_0x070e('0x1f')](_0x351641=>{var _0x3a16d0=_['clone'](recordings[_0x33e8c6['uniqueid']]);_0x3a16d0[_0x070e('0x13')]=_0x351641[_0x070e('0x13')];writeDB(_0x3a16d0);});delete recordings[_0x33e8c6[_0x070e('0x8')]];}}catch(_0x51402c){utils[_0x070e('0xb')](_0x51402c[_0x070e('0xc')]);}};exports[_0x070e('0x20')]=function(_0x5f2bee){try{if(!_['isNil'](recordings[_0x5f2bee['uniqueid']])){if(_0x5f2bee['application']['toLowerCase']()==_0x070e('0x21')&&_['startsWith'](_0x5f2bee[_0x070e('0x22')][_0x070e('0x23')](),'cdr')){var _0x47a739=_0x5f2bee[_0x070e('0x22')][_0x070e('0x24')]('=');var _0x55288a=_0x47a739[0x0]['substring'](_0x47a739[0x0][_0x070e('0x25')]('(')+0x1,_0x47a739[0x0][_0x070e('0x25')](')'));var _0x444d02=_0x47a739[0x1];recordings[_0x5f2bee[_0x070e('0x8')]][_0x55288a]=_0x444d02;}}}catch(_0x18f0ad){utils['error'](_0x18f0ad['stack']);}};exports[_0x070e('0x26')]=function(_0x3011c4){try{if(!_[_0x070e('0xe')](recordings[_0x3011c4[_0x070e('0x8')]])){recordings[_0x3011c4[_0x070e('0x8')]]['queue']=_0x3011c4[_0x070e('0x27')];}}catch(_0x1927f4){utils['error'](_0x1927f4[_0x070e('0xc')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 64881ed..a479a05 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 _0xc252=['lodash','util','./utils','info','format','TRANSFER|%s','type','blindtransfer','blind','error','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransfererexten','attended','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid'];(function(_0x4a334d,_0x1fe608){var _0x14dc14=function(_0x31f123){while(--_0x31f123){_0x4a334d['push'](_0x4a334d['shift']());}};_0x14dc14(++_0x1fe608);}(_0xc252,0x118));var _0x2c25=function(_0xe9794,_0x408b5c){_0xe9794=_0xe9794-0x0;var _0x372448=_0xc252[_0xe9794];return _0x372448;};'use strict';var _=require(_0x2c25('0x0'));var util=require(_0x2c25('0x1'));var utils=require(_0x2c25('0x2'));function writeDB(_0x2755dd){utils[_0x2c25('0x3')](util[_0x2c25('0x4')](_0x2c25('0x5'),_0x2755dd[_0x2c25('0x6')]));utils['request']('CreateVoiceTransferReport',_0x2755dd);}exports[_0x2c25('0x7')]=function(_0x492313){try{_0x492313[_0x2c25('0x6')]=_0x2c25('0x8');writeDB(_0x492313);}catch(_0x39972f){utils[_0x2c25('0x9')](_0x39972f['stack']);}};exports['attendedtransfer']=function(_0x16f20){try{_0x16f20=_[_0x2c25('0xa')](_0x16f20,{'transfererchannel':_0x16f20[_0x2c25('0xb')],'transferercalleridnum':_0x16f20[_0x2c25('0xc')],'transferercalleridname':_0x16f20[_0x2c25('0xd')],'transfererconnectedlinenum':_0x16f20[_0x2c25('0xe')],'transfererconnectedlinename':_0x16f20[_0x2c25('0xf')],'transfereraccountcode':_0x16f20['origtransfereraccountcode'],'transferercontext':_0x16f20[_0x2c25('0x10')],'transfererexten':_0x16f20['secondtransfererexten'],'transfererlinkedid':_0x16f20[_0x2c25('0x11')],'context':_0x16f20['origtransferercontext'],'extension':_0x16f20[_0x2c25('0x12')],'type':_0x2c25('0x13')});if(_['isNil'](_0x16f20[_0x2c25('0x14')])){_0x16f20=_[_0x2c25('0xa')](_0x16f20,{'transfereechannel':_0x16f20['transfertargetchannel'],'transfereecalleridnum':_0x16f20['transfertargetcalleridnum'],'transfereecalleridname':_0x16f20[_0x2c25('0x15')],'transfereeconnectedlinenum':_0x16f20[_0x2c25('0x16')],'transfereeconnectedlinename':_0x16f20[_0x2c25('0x17')],'transfereeaccountcode':_0x16f20[_0x2c25('0x18')],'transfereecontext':_0x16f20[_0x2c25('0x19')],'transfereeexten':_0x16f20[_0x2c25('0x1a')],'transfereelinkedid':_0x16f20[_0x2c25('0x1b')]});}writeDB(_0x16f20);}catch(_0x2e9e8e){utils[_0x2c25('0x9')](_0x2e9e8e['stack']);}}; \ No newline at end of file +var _0x9ec3=['transfertargetlinkedid','error','lodash','util','info','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','stack','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten'];(function(_0x525276,_0xd269da){var _0x49d8e2=function(_0x4725b0){while(--_0x4725b0){_0x525276['push'](_0x525276['shift']());}};_0x49d8e2(++_0xd269da);}(_0x9ec3,0xcd));var _0x39ec=function(_0x440723,_0x411fec){_0x440723=_0x440723-0x0;var _0xb3cc53=_0x9ec3[_0x440723];return _0xb3cc53;};'use strict';var _=require(_0x39ec('0x0'));var util=require(_0x39ec('0x1'));var utils=require('./utils');function writeDB(_0x4dfde3){utils[_0x39ec('0x2')](util['format'](_0x39ec('0x3'),_0x4dfde3[_0x39ec('0x4')]));utils[_0x39ec('0x5')](_0x39ec('0x6'),_0x4dfde3);}exports[_0x39ec('0x7')]=function(_0x32c897){try{_0x32c897[_0x39ec('0x4')]=_0x39ec('0x8');writeDB(_0x32c897);}catch(_0x58db37){utils['error'](_0x58db37[_0x39ec('0x9')]);}};exports['attendedtransfer']=function(_0x272a29){try{_0x272a29=_[_0x39ec('0xa')](_0x272a29,{'transfererchannel':_0x272a29[_0x39ec('0xb')],'transferercalleridnum':_0x272a29['origtransferercalleridnum'],'transferercalleridname':_0x272a29[_0x39ec('0xc')],'transfererconnectedlinenum':_0x272a29['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x272a29[_0x39ec('0xd')],'transfereraccountcode':_0x272a29[_0x39ec('0xe')],'transferercontext':_0x272a29['secondtransferercontext'],'transfererexten':_0x272a29[_0x39ec('0xf')],'transfererlinkedid':_0x272a29[_0x39ec('0x10')],'context':_0x272a29[_0x39ec('0x11')],'extension':_0x272a29['origtransfererexten'],'type':'attended'});if(_[_0x39ec('0x12')](_0x272a29[_0x39ec('0x13')])){_0x272a29=_['assign'](_0x272a29,{'transfereechannel':_0x272a29[_0x39ec('0x14')],'transfereecalleridnum':_0x272a29[_0x39ec('0x15')],'transfereecalleridname':_0x272a29[_0x39ec('0x16')],'transfereeconnectedlinenum':_0x272a29['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x272a29[_0x39ec('0x17')],'transfereeaccountcode':_0x272a29[_0x39ec('0x18')],'transfereecontext':_0x272a29[_0x39ec('0x19')],'transfereeexten':_0x272a29[_0x39ec('0x1a')],'transfereelinkedid':_0x272a29[_0x39ec('0x1b')]});}writeDB(_0x272a29);}catch(_0x50ce3c){utils[_0x39ec('0x1c')](_0x50ce3c[_0x39ec('0x9')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 0543c36..e582bf4 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 _0x5623=['acwTimeout','GETVOICEQUEUEBYNAME|','add','format','subtractTime','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','http','../../config/logger','xdr','info','debug','stringify','stack','request','then','catch','error','GetUser','name','interface','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw'];(function(_0x1395a2,_0x5255a2){var _0x529a96=function(_0x5d4f4f){while(--_0x5d4f4f){_0x1395a2['push'](_0x1395a2['shift']());}};_0x529a96(++_0x5255a2);}(_0x5623,0x15e));var _0x3562=function(_0x1e2857,_0x54c755){_0x1e2857=_0x1e2857-0x0;var _0x4e66c2=_0x5623[_0x1e2857];return _0x4e66c2;};'use strict';var jayson=require(_0x3562('0x0'));var moment=require(_0x3562('0x1'));var BPromise=require('bluebird');var client=jayson['client'][_0x3562('0x2')]({'port':0x2329});var logger=require(_0x3562('0x3'))(_0x3562('0x4'));exports[_0x3562('0x5')]=function(_0x12c7e9){logger[_0x3562('0x5')](_0x12c7e9);};exports[_0x3562('0x6')]=function(_0x4462a0){logger[_0x3562('0x6')](JSON[_0x3562('0x7')](_0x4462a0));};exports['error']=function(_0x454b68){logger['error'](_0x454b68[_0x3562('0x8')]);};exports[_0x3562('0x9')]=function(_0xb973a7,_0x265574){return client['request'](_0xb973a7,{'body':_0x265574})[_0x3562('0xa')](function(_0x55fdfa){logger[_0x3562('0x6')](JSON[_0x3562('0x7')](_0x55fdfa));})[_0x3562('0xb')](function(_0x34256f){logger[_0x3562('0xc')](_0x34256f[_0x3562('0x8')]);});};function getUser(_0x59b07c){return client[_0x3562('0x9')](_0x3562('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x3562('0xe'),_0x3562('0xf')],'where':_0x59b07c,'limit':0x1}})[_0x3562('0xa')](function(_0x49489e){logger[_0x3562('0x5')](_0x3562('0x10')+JSON['stringify'](_0x59b07c)+'|'+(_0x49489e[_0x3562('0x11')][_0x3562('0x12')]?_0x3562('0x13'):_0x3562('0x14')));return _0x49489e[_0x3562('0x11')][_0x3562('0x12')]?_0x49489e[_0x3562('0x11')][0x0]:null;});}exports[_0x3562('0x15')]=function(_0x38dc4a){return new BPromise(function(_0x42207e,_0x219749){if(_0x38dc4a){return getUser({'internal':_0x38dc4a})['then'](function(_0x7a0dd9){return _0x42207e(_0x7a0dd9);})[_0x3562('0xb')](function(_0x4b8cc3){logger[_0x3562('0xc')](_0x4b8cc3[_0x3562('0x8')]);return _0x42207e(null);});}else{return _0x42207e(null);}});};exports[_0x3562('0x16')]=function(_0x502224){return new BPromise(function(_0x8311a7,_0x53b60b){if(_0x502224){return getUser({'interface':_0x502224})['then'](function(_0x340950){return _0x8311a7(_0x340950);})['catch'](function(_0x4b9ea4){logger[_0x3562('0xc')](_0x4b9ea4[_0x3562('0x8')]);return _0x8311a7(null);});}else{return _0x8311a7(null);}});};exports[_0x3562('0x17')]=function(_0x5f4a18){return new BPromise(function(_0x461d3c,_0x32aa76){if(_0x5f4a18){return getUser({'name':_0x5f4a18})[_0x3562('0xa')](function(_0x188793){return _0x461d3c(_0x188793);})[_0x3562('0xb')](function(_0x13e7b0){logger[_0x3562('0xc')](_0x13e7b0[_0x3562('0x8')]);return _0x461d3c(null);});}else{return _0x461d3c(null);}});};exports[_0x3562('0x18')]=function(_0x4821fd){return new BPromise(function(_0x35e5df,_0x28f573){if(_0x4821fd){return client[_0x3562('0x9')](_0x3562('0x19'),{'options':{'raw':!![],'attributes':['id',_0x3562('0xe'),_0x3562('0x1a'),_0x3562('0x1b'),_0x3562('0x1c')],'where':{'name':_0x4821fd},'limit':0x1}})['then'](function(_0x1128cb){logger['info'](_0x3562('0x1d')+_0x4821fd+'|'+(_0x1128cb[_0x3562('0x11')][_0x3562('0x12')]?'FOUND':_0x3562('0x14')));return _0x35e5df(_0x1128cb['result']['length']?_0x1128cb[_0x3562('0x11')][0x0]:null);})[_0x3562('0xb')](function(_0x4ff62f){logger[_0x3562('0xc')](_0x4ff62f['stack']);return _0x35e5df(null);});}else{return _0x35e5df(null);}});};exports['addTime']=function(_0x4c88ae,_0x103b12){return moment(_0x4c88ae)[_0x3562('0x1e')](_0x103b12,'seconds')[_0x3562('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3562('0x20')]=function(_0x7acbdc,_0x4d6037){return moment(_0x7acbdc)[_0x3562('0x21')](_0x4d6037,_0x3562('0x22'))[_0x3562('0x1f')](_0x3562('0x23'));};exports[_0x3562('0x24')]=function(_0xcc089e,_0x2af2ee){return moment(_0xcc089e)[_0x3562('0x25')](moment(_0x2af2ee),'seconds');};exports[_0x3562('0x26')]=function(_0x596ba8,_0x37f3ca){return parseInt(_0x596ba8,0xa)+parseInt(_0x37f3ca,0xa);};exports[_0x3562('0x27')]=function(){return moment()['format'](_0x3562('0x23'));};exports[_0x3562('0x28')]=function(_0x5574ee,_0xf77988){if(_0xf77988){return moment(_0x5574ee)[_0x3562('0x28')](_0xf77988);}else{return!![];}};exports[_0x3562('0x29')]=function(_0x362ab5,_0x42f505){if(_0x42f505){return moment(_0x362ab5)[_0x3562('0x29')](_0x42f505);}else if(_0x362ab5){return!![];}else{return![];}}; \ No newline at end of file +var _0xfa3c=['stack','request','catch','internal','name','then','GETUSER|','result','NOTFOUND','length','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','acw','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND','addTime','seconds','format','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','isAfter','isBefore','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfa3c,0x143));var _0xcfa3=function(_0xa6a23e,_0x8b657a){_0xa6a23e=_0xa6a23e-0x0;var _0x210e65=_0xfa3c[_0xa6a23e];return _0x210e65;};'use strict';var jayson=require('jayson/promise');var moment=require(_0xcfa3('0x0'));var BPromise=require(_0xcfa3('0x1'));var client=jayson[_0xcfa3('0x2')][_0xcfa3('0x3')]({'port':0x2329});var logger=require(_0xcfa3('0x4'))(_0xcfa3('0x5'));exports[_0xcfa3('0x6')]=function(_0x3640ea){logger['info'](_0x3640ea);};exports[_0xcfa3('0x7')]=function(_0xc96c1c){logger['debug'](JSON[_0xcfa3('0x8')](_0xc96c1c));};exports[_0xcfa3('0x9')]=function(_0x3ad268){logger['error'](_0x3ad268[_0xcfa3('0xa')]);};exports[_0xcfa3('0xb')]=function(_0x172349,_0x5771d7){return client[_0xcfa3('0xb')](_0x172349,{'body':_0x5771d7})['then'](function(_0x1e869e){logger[_0xcfa3('0x7')](JSON[_0xcfa3('0x8')](_0x1e869e));})[_0xcfa3('0xc')](function(_0x4edaa7){logger[_0xcfa3('0x9')](_0x4edaa7[_0xcfa3('0xa')]);});};function getUser(_0x1920b8){return client[_0xcfa3('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xcfa3('0xd'),_0xcfa3('0xe'),'interface'],'where':_0x1920b8,'limit':0x1}})[_0xcfa3('0xf')](function(_0x1fbf21){logger['info'](_0xcfa3('0x10')+JSON['stringify'](_0x1920b8)+'|'+(_0x1fbf21[_0xcfa3('0x11')]['length']?'FOUND':_0xcfa3('0x12')));return _0x1fbf21['result'][_0xcfa3('0x13')]?_0x1fbf21[_0xcfa3('0x11')][0x0]:null;});}exports[_0xcfa3('0x14')]=function(_0x2c1a47){return new BPromise(function(_0x8ad8af,_0xee20cb){if(_0x2c1a47){return getUser({'internal':_0x2c1a47})[_0xcfa3('0xf')](function(_0x529faa){return _0x8ad8af(_0x529faa);})[_0xcfa3('0xc')](function(_0x2a141c){logger[_0xcfa3('0x9')](_0x2a141c[_0xcfa3('0xa')]);return _0x8ad8af(null);});}else{return _0x8ad8af(null);}});};exports[_0xcfa3('0x15')]=function(_0x4d0c62){return new BPromise(function(_0x586338,_0x4cd633){if(_0x4d0c62){return getUser({'interface':_0x4d0c62})[_0xcfa3('0xf')](function(_0x1356dd){return _0x586338(_0x1356dd);})[_0xcfa3('0xc')](function(_0x1543fc){logger[_0xcfa3('0x9')](_0x1543fc[_0xcfa3('0xa')]);return _0x586338(null);});}else{return _0x586338(null);}});};exports[_0xcfa3('0x16')]=function(_0x4820b6){return new BPromise(function(_0x3d15bb,_0x12751a){if(_0x4820b6){return getUser({'name':_0x4820b6})['then'](function(_0x24d493){return _0x3d15bb(_0x24d493);})[_0xcfa3('0xc')](function(_0x2e624e){logger[_0xcfa3('0x9')](_0x2e624e['stack']);return _0x3d15bb(null);});}else{return _0x3d15bb(null);}});};exports[_0xcfa3('0x17')]=function(_0x4dd5d5){return new BPromise(function(_0x199c65,_0x5d6b5e){if(_0x4dd5d5){return client[_0xcfa3('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xcfa3('0xe'),'type',_0xcfa3('0x18'),_0xcfa3('0x19')],'where':{'name':_0x4dd5d5},'limit':0x1}})[_0xcfa3('0xf')](function(_0x566441){logger[_0xcfa3('0x6')](_0xcfa3('0x1a')+_0x4dd5d5+'|'+(_0x566441[_0xcfa3('0x11')][_0xcfa3('0x13')]?_0xcfa3('0x1b'):_0xcfa3('0x12')));return _0x199c65(_0x566441[_0xcfa3('0x11')][_0xcfa3('0x13')]?_0x566441['result'][0x0]:null);})[_0xcfa3('0xc')](function(_0x3422d8){logger[_0xcfa3('0x9')](_0x3422d8[_0xcfa3('0xa')]);return _0x199c65(null);});}else{return _0x199c65(null);}});};exports[_0xcfa3('0x1c')]=function(_0x1a503a,_0xd31010){return moment(_0x1a503a)['add'](_0xd31010,_0xcfa3('0x1d'))[_0xcfa3('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x395fa3,_0xaeaf2b){return moment(_0x395fa3)[_0xcfa3('0x1f')](_0xaeaf2b,_0xcfa3('0x1d'))[_0xcfa3('0x1e')](_0xcfa3('0x20'));};exports['diffTime']=function(_0xb810ef,_0x5e0e2d){return moment(_0xb810ef)[_0xcfa3('0x21')](moment(_0x5e0e2d),'seconds');};exports[_0xcfa3('0x22')]=function(_0x5b68fd,_0x1c5a29){return parseInt(_0x5b68fd,0xa)+parseInt(_0x1c5a29,0xa);};exports['now']=function(){return moment()[_0xcfa3('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xcfa3('0x23')]=function(_0x2b29e5,_0x29aa19){if(_0x29aa19){return moment(_0x2b29e5)[_0xcfa3('0x23')](_0x29aa19);}else{return!![];}};exports['isBefore']=function(_0x2c77ee,_0x26d814){if(_0x26d814){return moment(_0x2c77ee)[_0xcfa3('0x24')](_0x26d814);}else if(_0x2c77ee){return!![];}else{return![];}}; \ No newline at end of file